From: support Date: Thu, 4 May 2023 14:00:29 +0000 (+0000) Subject: Built motion from commit cb845558.|2.6.34 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.mail?a=commitdiff_plain;h=89c416240d5d7894f59ffb8a088ab852f4944e14;p=motion2.git Built motion from commit cb845558.|2.6.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index eff039b..5d791a1 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.33", + "version": "2.6.34", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-05-04T13:23:07.638Z", + "time": "2023-05-04T13:51:21.691Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3702cb0..94a4a6e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.33", + "version": "2.6.34", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-05-04T13:23:07.638Z", + "time": "2023-05-04T13:51:21.691Z", "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 8f3b435..41e6a5f 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 _0xaf50=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot'];(function(_0x208e19,_0x2696aa){var _0x42f5eb=function(_0x3e1644){while(--_0x3e1644){_0x208e19['push'](_0x208e19['shift']());}};_0x42f5eb(++_0x2696aa);}(_0xaf50,0x186));var _0x0af5=function(_0x24373c,_0x88fa8e){_0x24373c=_0x24373c-0x0;var _0x15ef73=_0xaf50[_0x24373c];return _0x15ef73;};'use strict';var Sequelize=require('sequelize');module[_0x0af5('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3de0ad){return this[_0x0af5('0x1')](_0x0af5('0x2'));}},'action':{'type':Sequelize[_0x0af5('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0af5('0x4'),_0x0af5('0x5'),_0x0af5('0x6'),_0x0af5('0x7'),_0x0af5('0x8'),'browser',_0x0af5('0x9'),'script']],'msg':_0x0af5('0xa')}},'comment':_0x0af5('0xa')},'data1':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comment':_0x0af5('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x0af5('0xc')},'data3':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x0af5('0x3')],'comments':_0x0af5('0xd')},'data7':{'type':Sequelize[_0x0af5('0xe')],'comments':_0x0af5('0xf')}}; \ No newline at end of file +var _0x8e7b=['STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','VIRTUAL','action','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x2e29ea,_0x32c951){var _0x1cb268=function(_0x4e707f){while(--_0x4e707f){_0x2e29ea['push'](_0x2e29ea['shift']());}};_0x1cb268(++_0x32c951);}(_0x8e7b,0x184));var _0xb8e7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8e7b[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xb8e7('0x0'));module['exports']={'name':{'type':Sequelize[_0xb8e7('0x1')],'get':function(_0x11ffde){return this['getDataValue'](_0xb8e7('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xb8e7('0x3'),_0xb8e7('0x4'),_0xb8e7('0x5'),_0xb8e7('0x6'),_0xb8e7('0x7'),'browser',_0xb8e7('0x8'),_0xb8e7('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xb8e7('0xa')},'data1':{'type':Sequelize[_0xb8e7('0xb')](0x1000),'comment':_0xb8e7('0xc')},'data2':{'type':Sequelize[_0xb8e7('0xb')](0x1000),'comment':_0xb8e7('0xd')},'data3':{'type':Sequelize[_0xb8e7('0xb')](0x1000),'comment':_0xb8e7('0xe')},'data4':{'type':Sequelize[_0xb8e7('0xb')](0x1000),'comments':_0xb8e7('0xf')},'data5':{'type':Sequelize[_0xb8e7('0xb')](0x1000),'comments':_0xb8e7('0x10')},'data6':{'type':Sequelize[_0xb8e7('0xb')],'comments':_0xb8e7('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0xb8e7('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9a0edba..2b4c167 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 _0xda24=['../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','update','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api'];(function(_0x14db0a,_0xea5e2c){var _0x1eae4d=function(_0x395612){while(--_0x395612){_0x14db0a['push'](_0x14db0a['shift']());}};_0x1eae4d(++_0xea5e2c);}(_0xda24,0x1ac));var _0x4da2=function(_0x5e5ad9,_0x18845f){_0x5e5ad9=_0x5e5ad9-0x0;var _0x396036=_0xda24[_0x5e5ad9];return _0x396036;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4da2('0x0'));var zipdir=require(_0x4da2('0x1'));var jsonpatch=require(_0x4da2('0x2'));var rp=require(_0x4da2('0x3'));var moment=require(_0x4da2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4da2('0x5'));var util=require(_0x4da2('0x6'));var path=require('path');var sox=require(_0x4da2('0x7'));var csv=require(_0x4da2('0x8'));var ejs=require(_0x4da2('0x9'));var fs=require('fs');var fs_extra=require(_0x4da2('0xa'));var _=require(_0x4da2('0xb'));var squel=require(_0x4da2('0xc'));var crypto=require(_0x4da2('0xd'));var jsforce=require(_0x4da2('0xe'));var deskjs=require(_0x4da2('0xf'));var toCsv=require(_0x4da2('0x8'));var querystring=require(_0x4da2('0x10'));var Papa=require(_0x4da2('0x11'));var Redis=require(_0x4da2('0x12'));var authService=require(_0x4da2('0x13'));var qs=require(_0x4da2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4da2('0x15'));var utils=require(_0x4da2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2547e7,_0xe653fa){_0xe653fa=_0xe653fa||0xcc;return function(_0x5955a5){if(_0x5955a5){return _0x2547e7[_0x4da2('0x17')](_0xe653fa);}return _0x2547e7[_0x4da2('0x18')](_0xe653fa)[_0x4da2('0x19')]();};}function respondWithResult(_0x50c848,_0x487144){_0x487144=_0x487144||0xc8;return function(_0x4168c5){if(_0x4168c5){return _0x50c848[_0x4da2('0x18')](_0x487144)[_0x4da2('0x1a')](_0x4168c5);}};}function respondWithFilteredResult(_0x453ac0,_0x4aedf1){return function(_0x878eb0){if(_0x878eb0){var _0x3ec2e7=typeof _0x4aedf1[_0x4da2('0x1b')]===_0x4da2('0x1c')&&typeof _0x4aedf1[_0x4da2('0x1d')]===_0x4da2('0x1c');var _0x6024cc=_0x878eb0[_0x4da2('0x1e')];var _0x53c7ae=_0x3ec2e7?0x0:_0x4aedf1[_0x4da2('0x1b')];var _0x3bd46f=_0x3ec2e7?_0x878eb0[_0x4da2('0x1e')]:_0x4aedf1[_0x4da2('0x1b')]+_0x4aedf1['limit'];var _0x2e21e5;if(_0x3bd46f>=_0x6024cc){_0x3bd46f=_0x6024cc;_0x2e21e5=0xc8;}else{_0x2e21e5=0xce;}_0x453ac0[_0x4da2('0x18')](_0x2e21e5);return _0x453ac0[_0x4da2('0x1f')](_0x4da2('0x20'),_0x53c7ae+'-'+_0x3bd46f+'/'+_0x6024cc)['json'](_0x878eb0);}return null;};}function patchUpdates(_0x1e329f){return function(_0x649f7a){try{jsonpatch['apply'](_0x649f7a,_0x1e329f,!![]);}catch(_0x51db90){return BPromise['reject'](_0x51db90);}return _0x649f7a[_0x4da2('0x21')]();};}function saveUpdates(_0x1d3dfa,_0x52ef96){return function(_0x47ec2d){if(_0x47ec2d){return _0x47ec2d['update'](_0x1d3dfa)[_0x4da2('0x22')](function(_0x3563ae){return _0x3563ae;});}return null;};}function removeEntity(_0x40f5ad,_0x18c754){return function(_0x1888de){if(_0x1888de){return _0x1888de[_0x4da2('0x23')]()[_0x4da2('0x22')](function(){_0x40f5ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2672fb,_0x59442e){return function(_0x279c8b){if(!_0x279c8b){_0x2672fb[_0x4da2('0x17')](0x194);}return _0x279c8b;};}function handleError(_0x157335,_0x1dff39){_0x1dff39=_0x1dff39||0x1f4;return function(_0x330670){logger[_0x4da2('0x24')](_0x330670[_0x4da2('0x25')]);if(_0x330670[_0x4da2('0x26')]){delete _0x330670[_0x4da2('0x26')];}_0x157335['status'](_0x1dff39)['send'](_0x330670);};}exports[_0x4da2('0x27')]=function(_0x53edf2,_0x1345b6){if(_0x53edf2[_0x4da2('0x28')]['id']){delete _0x53edf2[_0x4da2('0x28')]['id'];}return db[_0x4da2('0x29')][_0x4da2('0x2a')]({'where':{'id':_0x53edf2[_0x4da2('0x2b')]['id']}})[_0x4da2('0x22')](handleEntityNotFound(_0x1345b6,null))[_0x4da2('0x22')](saveUpdates(_0x53edf2[_0x4da2('0x28')],null))[_0x4da2('0x22')](respondWithResult(_0x1345b6,null))[_0x4da2('0x2c')](handleError(_0x1345b6,null));};exports[_0x4da2('0x23')]=function(_0x2eb25e,_0x24de9b){return db[_0x4da2('0x29')]['find']({'where':{'id':_0x2eb25e[_0x4da2('0x2b')]['id']}})[_0x4da2('0x22')](handleEntityNotFound(_0x24de9b,null))[_0x4da2('0x22')](removeEntity(_0x24de9b,null))[_0x4da2('0x2c')](handleError(_0x24de9b,null));}; \ No newline at end of file +var _0xf3f1=['bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','update','body','Action','find','catch','params','eml-format','zip-dir','request-promise','moment'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0xf3f1,0x1e6));var _0x1f3f=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xf3f1[_0x599e60];return _0x468e19;};'use strict';var emlformat=require(_0x1f3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f3f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f3f('0x2'));var moment=require(_0x1f3f('0x3'));var BPromise=require(_0x1f3f('0x4'));var Mustache=require(_0x1f3f('0x5'));var util=require('util');var path=require(_0x1f3f('0x6'));var sox=require(_0x1f3f('0x7'));var csv=require(_0x1f3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f3f('0x9'));var _=require(_0x1f3f('0xa'));var squel=require(_0x1f3f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f3f('0xc'));var toCsv=require(_0x1f3f('0x8'));var querystring=require(_0x1f3f('0xd'));var Papa=require('papaparse');var Redis=require(_0x1f3f('0xe'));var authService=require(_0x1f3f('0xf'));var qs=require(_0x1f3f('0x10'));var as=require(_0x1f3f('0x11'));var hardwareService=require(_0x1f3f('0x12'));var logger=require('../../config/logger')(_0x1f3f('0x13'));var utils=require(_0x1f3f('0x14'));var config=require(_0x1f3f('0x15'));var licenseUtil=require(_0x1f3f('0x16'));var db=require(_0x1f3f('0x17'))['db'];function respondWithStatusCode(_0xfc8a0,_0x2cfd54){_0x2cfd54=_0x2cfd54||0xcc;return function(_0x334cbd){if(_0x334cbd){return _0xfc8a0[_0x1f3f('0x18')](_0x2cfd54);}return _0xfc8a0[_0x1f3f('0x19')](_0x2cfd54)[_0x1f3f('0x1a')]();};}function respondWithResult(_0xf9aff1,_0x47a9f9){_0x47a9f9=_0x47a9f9||0xc8;return function(_0x5e141f){if(_0x5e141f){return _0xf9aff1['status'](_0x47a9f9)['json'](_0x5e141f);}};}function respondWithFilteredResult(_0x595c15,_0x5e4d3a){return function(_0x1faa1f){if(_0x1faa1f){var _0x369917=typeof _0x5e4d3a[_0x1f3f('0x1b')]==='undefined'&&typeof _0x5e4d3a['limit']===_0x1f3f('0x1c');var _0x809eae=_0x1faa1f[_0x1f3f('0x1d')];var _0x409228=_0x369917?0x0:_0x5e4d3a['offset'];var _0x309290=_0x369917?_0x1faa1f[_0x1f3f('0x1d')]:_0x5e4d3a[_0x1f3f('0x1b')]+_0x5e4d3a[_0x1f3f('0x1e')];var _0x189cbc;if(_0x309290>=_0x809eae){_0x309290=_0x809eae;_0x189cbc=0xc8;}else{_0x189cbc=0xce;}_0x595c15['status'](_0x189cbc);return _0x595c15[_0x1f3f('0x1f')](_0x1f3f('0x20'),_0x409228+'-'+_0x309290+'/'+_0x809eae)[_0x1f3f('0x21')](_0x1faa1f);}return null;};}function patchUpdates(_0x5001d2){return function(_0x22bea2){try{jsonpatch[_0x1f3f('0x22')](_0x22bea2,_0x5001d2,!![]);}catch(_0x473af2){return BPromise[_0x1f3f('0x23')](_0x473af2);}return _0x22bea2[_0x1f3f('0x24')]();};}function saveUpdates(_0x3ac3bb,_0x5ad64c){return function(_0x286b00){if(_0x286b00){return _0x286b00['update'](_0x3ac3bb)[_0x1f3f('0x25')](function(_0x1ae0ce){return _0x1ae0ce;});}return null;};}function removeEntity(_0x171061,_0x3734a8){return function(_0x3a1222){if(_0x3a1222){return _0x3a1222[_0x1f3f('0x26')]()[_0x1f3f('0x25')](function(){_0x171061['status'](0xcc)[_0x1f3f('0x1a')]();});}};}function handleEntityNotFound(_0x140ed5,_0x3db37f){return function(_0x280284){if(!_0x280284){_0x140ed5['sendStatus'](0x194);}return _0x280284;};}function handleError(_0x4f39cb,_0x366a6b){_0x366a6b=_0x366a6b||0x1f4;return function(_0x4a9da4){logger[_0x1f3f('0x27')](_0x4a9da4[_0x1f3f('0x28')]);if(_0x4a9da4[_0x1f3f('0x29')]){delete _0x4a9da4[_0x1f3f('0x29')];}_0x4f39cb[_0x1f3f('0x19')](_0x366a6b)[_0x1f3f('0x2a')](_0x4a9da4);};}exports[_0x1f3f('0x2b')]=function(_0x6f571c,_0x31313c){if(_0x6f571c[_0x1f3f('0x2c')]['id']){delete _0x6f571c[_0x1f3f('0x2c')]['id'];}return db[_0x1f3f('0x2d')][_0x1f3f('0x2e')]({'where':{'id':_0x6f571c['params']['id']}})['then'](handleEntityNotFound(_0x31313c,null))[_0x1f3f('0x25')](saveUpdates(_0x6f571c['body'],null))[_0x1f3f('0x25')](respondWithResult(_0x31313c,null))[_0x1f3f('0x2f')](handleError(_0x31313c,null));};exports[_0x1f3f('0x26')]=function(_0x1bf5df,_0x3ce664){return db[_0x1f3f('0x2d')][_0x1f3f('0x2e')]({'where':{'id':_0x1bf5df[_0x1f3f('0x30')]['id']}})[_0x1f3f('0x25')](handleEntityNotFound(_0x3ce664,null))[_0x1f3f('0x25')](removeEntity(_0x3ce664,null))['catch'](handleError(_0x3ce664,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1f0c5a9..3b613c9 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 _0x9ec1=['../../config/logger','api','request-promise','rimraf','../../config/environment','./action.attributes','Action','lodash'];(function(_0x1875cf,_0x1c26e5){var _0x133ea2=function(_0x502bea){while(--_0x502bea){_0x1875cf['push'](_0x1875cf['shift']());}};_0x133ea2(++_0x1c26e5);}(_0x9ec1,0xe7));var _0x19ec=function(_0x2ae2cd,_0xb42c96){_0x2ae2cd=_0x2ae2cd-0x0;var _0xc52725=_0x9ec1[_0x2ae2cd];return _0xc52725;};'use strict';var _=require(_0x19ec('0x0'));var util=require('util');var logger=require(_0x19ec('0x1'))(_0x19ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x19ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19ec('0x4'));var config=require(_0x19ec('0x5'));var attributes=require(_0x19ec('0x6'));module['exports']=function(_0x1035ba,_0xba0219){return _0x1035ba['define'](_0x19ec('0x7'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38b5=['request-promise','path','rimraf','../../config/environment','exports','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x4869b9,_0x391996){var _0x5a31cc=function(_0x8c7069){while(--_0x8c7069){_0x4869b9['push'](_0x4869b9['shift']());}};_0x5a31cc(++_0x391996);}(_0x38b5,0x124));var _0x538b=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x38b5[_0x2c6810];return _0x213881;};'use strict';var _=require(_0x538b('0x0'));var util=require(_0x538b('0x1'));var logger=require(_0x538b('0x2'))(_0x538b('0x3'));var moment=require(_0x538b('0x4'));var BPromise=require('bluebird');var rp=require(_0x538b('0x5'));var fs=require('fs');var path=require(_0x538b('0x6'));var rimraf=require(_0x538b('0x7'));var config=require(_0x538b('0x8'));var attributes=require('./action.attributes');module[_0x538b('0x9')]=function(_0x36b43d,_0x2983ad){return _0x36b43d['define']('Action',attributes,{'tableName':_0x538b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index d8eac64..d65dde9 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a0c8f,_0x512b1a){var _0x2bdadc=function(_0x605443){while(--_0x605443){_0x2a0c8f['push'](_0x2a0c8f['shift']());}};_0x2bdadc(++_0x512b1a);}(_0x326f,0xd1));var _0xf326=function(_0x22e3a8,_0x2eb8e8){_0x22e3a8=_0x22e3a8-0x0;var _0x56e9b4=_0x326f[_0x22e3a8];return _0x56e9b4;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x181736,_0x2ab7cf){var _0x150207=function(_0x117808){while(--_0x117808){_0x181736['push'](_0x181736['shift']());}};_0x150207(++_0x2ab7cf);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x86527a,_0x2787c6){_0x86527a=_0x86527a-0x0;var _0x2f14b6=_0x7fbe[_0x86527a];return _0x2f14b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 39a4301..dd20330 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 _0xca25=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','isAuthenticated','destroy','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca25,0x14f));var _0x5ca2=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0xca25[_0x3c6c1b];return _0x15170e;};'use strict';var multer=require(_0x5ca2('0x0'));var util=require('util');var path=require(_0x5ca2('0x1'));var timeout=require(_0x5ca2('0x2'));var express=require(_0x5ca2('0x3'));var router=express[_0x5ca2('0x4')]();var fs_extra=require(_0x5ca2('0x5'));var auth=require(_0x5ca2('0x6'));var interaction=require(_0x5ca2('0x7'));var config=require(_0x5ca2('0x8'));var controller=require(_0x5ca2('0x9'));router[_0x5ca2('0xa')](_0x5ca2('0xb'),auth['isAuthenticated'](),controller[_0x5ca2('0xc')]);router['delete']('/:id',auth[_0x5ca2('0xd')](),controller[_0x5ca2('0xe')]);module[_0x5ca2('0xf')]=router; \ No newline at end of file +var _0xe222=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','update','/:id','exports'];(function(_0x1caf05,_0x4a597a){var _0x4d38fc=function(_0x81de01){while(--_0x81de01){_0x1caf05['push'](_0x1caf05['shift']());}};_0x4d38fc(++_0x4a597a);}(_0xe222,0x168));var _0x2e22=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xe222[_0x36bf88];return _0x332914;};'use strict';var multer=require(_0x2e22('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2e22('0x1'));var express=require('express');var router=express[_0x2e22('0x2')]();var fs_extra=require(_0x2e22('0x3'));var auth=require(_0x2e22('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2e22('0x5'));var controller=require(_0x2e22('0x6'));router[_0x2e22('0x7')]('/:id',auth[_0x2e22('0x8')](),controller[_0x2e22('0x9')]);router['delete'](_0x2e22('0xa'),auth[_0x2e22('0x8')](),controller['destroy']);module[_0x2e22('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d9d573a..cc16c1d 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 _0xda19=['exports','STRING','TEXT'];(function(_0x124fb0,_0x4addf2){var _0x2265d6=function(_0xd03631){while(--_0xd03631){_0x124fb0['push'](_0x124fb0['shift']());}};_0x2265d6(++_0x4addf2);}(_0xda19,0xd5));var _0x9da1=function(_0x5b25f1,_0x21d1ee){_0x5b25f1=_0x5b25f1-0x0;var _0x5a269f=_0xda19[_0x5b25f1];return _0x5a269f;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x435d28,_0xcfe3ae){var _0x4d0132=function(_0x27a5ab){while(--_0x27a5ab){_0x435d28['push'](_0x435d28['shift']());}};_0x4d0132(++_0xcfe3ae);}(_0xd8fb,0x99));var _0xbd8f=function(_0x438cdf,_0x39b2a1){_0x438cdf=_0x438cdf-0x0;var _0x236c4d=_0xd8fb[_0x438cdf];return _0x236c4d;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f7ada88..236ca21 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 _0x6890=['body','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MAX(%s)','AVG(%s)','DATE(%s)','IS\x20EMPTY','getFields','from','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','join','../../components/export/','savename','countTable','COUNT(*)','run','clone','SELECT','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','CustomReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','findAll','rows','catch','params','length','include','find','create','user','get','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x5b7ef6,_0x3e5212){var _0x27d038=function(_0x3db34e){while(--_0x3db34e){_0x5b7ef6['push'](_0x5b7ef6['shift']());}};_0x27d038(++_0x3e5212);}(_0x6890,0xf7));var _0x0689=function(_0x3482da,_0x347b50){_0x3482da=_0x3482da-0x0;var _0x27adfe=_0x6890[_0x3482da];return _0x27adfe;};'use strict';var emlformat=require(_0x0689('0x0'));var rimraf=require(_0x0689('0x1'));var zipdir=require(_0x0689('0x2'));var jsonpatch=require(_0x0689('0x3'));var rp=require('request-promise');var moment=require(_0x0689('0x4'));var BPromise=require(_0x0689('0x5'));var Mustache=require(_0x0689('0x6'));var util=require(_0x0689('0x7'));var path=require('path');var sox=require(_0x0689('0x8'));var csv=require(_0x0689('0x9'));var ejs=require(_0x0689('0xa'));var fs=require('fs');var fs_extra=require(_0x0689('0xb'));var _=require(_0x0689('0xc'));var squel=require(_0x0689('0xd'));var crypto=require(_0x0689('0xe'));var jsforce=require(_0x0689('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0689('0x9'));var querystring=require(_0x0689('0x10'));var Papa=require(_0x0689('0x11'));var Redis=require(_0x0689('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0689('0x13'));var as=require(_0x0689('0x14'));var hardwareService=require(_0x0689('0x15'));var logger=require('../../config/logger')(_0x0689('0x16'));var utils=require(_0x0689('0x17'));var config=require(_0x0689('0x18'));var licenseUtil=require(_0x0689('0x19'));var db=require(_0x0689('0x1a'))['db'];var dbH=require(_0x0689('0x1a'))[_0x0689('0x1b')];function respondWithStatusCode(_0x51b527,_0x17bef7){_0x17bef7=_0x17bef7||0xcc;return function(_0x491cbb){if(_0x491cbb){return _0x51b527[_0x0689('0x1c')](_0x17bef7);}return _0x51b527[_0x0689('0x1d')](_0x17bef7)[_0x0689('0x1e')]();};}function respondWithResult(_0x3ffc37,_0x433d17){_0x433d17=_0x433d17||0xc8;return function(_0x49a1d5){if(_0x49a1d5){return _0x3ffc37[_0x0689('0x1d')](_0x433d17)[_0x0689('0x1f')](_0x49a1d5);}};}function respondWithFilteredResult(_0x14eed3,_0x1d1de6){return function(_0x48f2f1){if(_0x48f2f1){var _0x391897=typeof _0x1d1de6[_0x0689('0x20')]===_0x0689('0x21')&&typeof _0x1d1de6[_0x0689('0x22')]==='undefined';var _0x25a124=_0x48f2f1['count'];var _0x376b66=_0x391897?0x0:_0x1d1de6[_0x0689('0x20')];var _0x87b6a0=_0x391897?_0x48f2f1[_0x0689('0x23')]:_0x1d1de6[_0x0689('0x20')]+_0x1d1de6['limit'];var _0x258e63;if(_0x87b6a0>=_0x25a124){_0x87b6a0=_0x25a124;_0x258e63=0xc8;}else{_0x258e63=0xce;}_0x14eed3[_0x0689('0x1d')](_0x258e63);return _0x14eed3['set'](_0x0689('0x24'),_0x376b66+'-'+_0x87b6a0+'/'+_0x25a124)[_0x0689('0x1f')](_0x48f2f1);}return null;};}function patchUpdates(_0x2431ab){return function(_0x11b668){try{jsonpatch[_0x0689('0x25')](_0x11b668,_0x2431ab,!![]);}catch(_0x11623d){return BPromise[_0x0689('0x26')](_0x11623d);}return _0x11b668['save']();};}function saveUpdates(_0x414a5f,_0x341978){return function(_0x58846f){if(_0x58846f){return _0x58846f[_0x0689('0x27')](_0x414a5f)['then'](function(_0x25765c){return _0x25765c;});}return null;};}function removeEntity(_0x3926d8,_0x3c648f){return function(_0x73113e){if(_0x73113e){return _0x73113e[_0x0689('0x28')]()[_0x0689('0x29')](function(){var _0x3e5c95=_0x73113e['get']({'plain':!![]});var _0x4bdf11=_0x0689('0x2a');return db[_0x0689('0x2b')][_0x0689('0x28')]({'where':{'type':_0x4bdf11,'resourceId':_0x3e5c95['id']}})[_0x0689('0x29')](function(){return _0x73113e;});})[_0x0689('0x29')](function(){_0x3926d8[_0x0689('0x1d')](0xcc)[_0x0689('0x1e')]();});}};}function handleEntityNotFound(_0x16f459,_0x47c840){return function(_0x34a21f){if(!_0x34a21f){_0x16f459['sendStatus'](0x194);}return _0x34a21f;};}function handleError(_0x5381f7,_0x4acef0){_0x4acef0=_0x4acef0||0x1f4;return function(_0x417b9e){logger[_0x0689('0x2c')](_0x417b9e[_0x0689('0x2d')]);if(_0x417b9e[_0x0689('0x2e')]){delete _0x417b9e[_0x0689('0x2e')];}_0x5381f7[_0x0689('0x1d')](_0x4acef0)[_0x0689('0x2f')](_0x417b9e);};}exports[_0x0689('0x30')]=function(_0x4a7be4,_0x1e2208){var _0x436327={},_0xa8a557={},_0x5a4e0a={'count':0x0,'rows':[]};var _0x3dbe57=_[_0x0689('0x31')](db['AnalyticCustomReport'][_0x0689('0x32')],function(_0x23cca4){return{'name':_0x23cca4[_0x0689('0x33')],'type':_0x23cca4[_0x0689('0x34')][_0x0689('0x35')]};});_0xa8a557[_0x0689('0x36')]=_[_0x0689('0x31')](_0x3dbe57,_0x0689('0x2e'));_0xa8a557[_0x0689('0x37')]=_[_0x0689('0x38')](_0x4a7be4[_0x0689('0x37')]);_0xa8a557['filters']=_[_0x0689('0x39')](_0xa8a557[_0x0689('0x36')],_0xa8a557[_0x0689('0x37')]);_0x436327[_0x0689('0x3a')]=_[_0x0689('0x39')](_0xa8a557[_0x0689('0x36')],qs[_0x0689('0x3b')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x3b')]));_0x436327[_0x0689('0x3a')]=_0x436327[_0x0689('0x3a')]['length']?_0x436327[_0x0689('0x3a')]:_0xa8a557[_0x0689('0x36')];if(!_0x4a7be4['query'][_0x0689('0x3c')](_0x0689('0x3d'))){_0x436327[_0x0689('0x22')]=qs[_0x0689('0x22')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x22')]);_0x436327['offset']=qs[_0x0689('0x20')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x20')]);}_0x436327['order']=qs[_0x0689('0x3e')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x3e')]);_0x436327['where']=qs[_0x0689('0x3f')](_[_0x0689('0x40')](_0x4a7be4[_0x0689('0x37')],_0xa8a557['filters']),_0x3dbe57);if(_0x4a7be4[_0x0689('0x37')][_0x0689('0x41')]){_0x436327[_0x0689('0x42')]=_[_0x0689('0x43')](_0x436327[_0x0689('0x42')],{'$or':_['map'](_0x3dbe57,function(_0x32e27c){if(_0x32e27c[_0x0689('0x34')]!==_0x0689('0x44')){var _0xac3ddb={};_0xac3ddb[_0x32e27c[_0x0689('0x2e')]]={'$like':'%'+_0x4a7be4[_0x0689('0x37')][_0x0689('0x41')]+'%'};return _0xac3ddb;}})});}_0x436327=_[_0x0689('0x43')]({},_0x436327,_0x4a7be4[_0x0689('0x45')]);var _0x6f56b0={'where':_0x436327[_0x0689('0x42')]};return db[_0x0689('0x46')][_0x0689('0x23')](_0x6f56b0)[_0x0689('0x29')](function(_0xd7116d){_0x5a4e0a['count']=_0xd7116d;if(_0x4a7be4['query'][_0x0689('0x47')]){_0x436327['include']=[{'all':!![]}];}return db[_0x0689('0x46')][_0x0689('0x48')](_0x436327);})['then'](function(_0x1ece44){_0x5a4e0a[_0x0689('0x49')]=_0x1ece44;return _0x5a4e0a;})[_0x0689('0x29')](respondWithFilteredResult(_0x1e2208,_0x436327))[_0x0689('0x4a')](handleError(_0x1e2208,null));};exports['show']=function(_0x116897,_0x108267){var _0x4bf869={'raw':![],'where':{'id':_0x116897[_0x0689('0x4b')]['id']}},_0x56990c={};_0x56990c[_0x0689('0x36')]=_[_0x0689('0x38')](db[_0x0689('0x46')]['rawAttributes']);_0x56990c[_0x0689('0x37')]=_[_0x0689('0x38')](_0x116897[_0x0689('0x37')]);_0x56990c[_0x0689('0x3f')]=_['intersection'](_0x56990c[_0x0689('0x36')],_0x56990c['query']);_0x4bf869[_0x0689('0x3a')]=_[_0x0689('0x39')](_0x56990c[_0x0689('0x36')],qs[_0x0689('0x3b')](_0x116897[_0x0689('0x37')][_0x0689('0x3b')]));_0x4bf869['attributes']=_0x4bf869[_0x0689('0x3a')][_0x0689('0x4c')]?_0x4bf869['attributes']:_0x56990c[_0x0689('0x36')];if(_0x116897['query'][_0x0689('0x47')]){_0x4bf869[_0x0689('0x4d')]=[{'all':!![]}];}_0x4bf869=_[_0x0689('0x43')]({},_0x4bf869,_0x116897['options']);return db[_0x0689('0x46')][_0x0689('0x4e')](_0x4bf869)[_0x0689('0x29')](handleEntityNotFound(_0x108267,null))[_0x0689('0x29')](respondWithResult(_0x108267,null))['catch'](handleError(_0x108267,null));};exports[_0x0689('0x4f')]=function(_0x2c36bf,_0x200195){return db[_0x0689('0x46')][_0x0689('0x4f')](_0x2c36bf['body'],{})[_0x0689('0x29')](function(_0x3d2c64){var _0x456f36=_0x2c36bf[_0x0689('0x50')][_0x0689('0x51')]({'plain':!![]});if(!_0x456f36)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x456f36[_0x0689('0x52')]===_0x0689('0x50')){var _0x1808a3=_0x3d2c64[_0x0689('0x51')]({'plain':!![]});var _0x2ee3e5=_0x0689('0x53');return db[_0x0689('0x54')][_0x0689('0x4e')]({'where':{'name':_0x2ee3e5,'userProfileId':_0x456f36[_0x0689('0x55')]},'raw':!![]})[_0x0689('0x29')](function(_0x9155af){if(_0x9155af&&_0x9155af['autoAssociation']===0x0){return db[_0x0689('0x2b')]['create']({'name':_0x1808a3[_0x0689('0x2e')],'resourceId':_0x1808a3['id'],'type':'CustomReports','sectionId':_0x9155af['id']},{})[_0x0689('0x29')](function(){return _0x3d2c64;});}else{return _0x3d2c64;}})['catch'](function(_0x34a7eb){logger['error'](_0x0689('0x56'),_0x34a7eb);throw _0x34a7eb;});}return _0x3d2c64;})[_0x0689('0x29')](respondWithResult(_0x200195,0xc9))[_0x0689('0x4a')](handleError(_0x200195,null));};exports[_0x0689('0x27')]=function(_0x2fb8fa,_0xf666c7){if(_0x2fb8fa[_0x0689('0x57')]['id']){delete _0x2fb8fa['body']['id'];}return db['AnalyticCustomReport'][_0x0689('0x4e')]({'where':{'id':_0x2fb8fa[_0x0689('0x4b')]['id']}})[_0x0689('0x29')](handleEntityNotFound(_0xf666c7,null))[_0x0689('0x29')](saveUpdates(_0x2fb8fa[_0x0689('0x57')],null))[_0x0689('0x29')](respondWithResult(_0xf666c7,null))[_0x0689('0x4a')](handleError(_0xf666c7,null));};exports[_0x0689('0x28')]=function(_0x42543b,_0x3ca834){return db['AnalyticCustomReport'][_0x0689('0x4e')]({'where':{'id':_0x42543b[_0x0689('0x4b')]['id']}})[_0x0689('0x29')](handleEntityNotFound(_0x3ca834,null))['then'](removeEntity(_0x3ca834,null))[_0x0689('0x4a')](handleError(_0x3ca834,null));};exports['preview']=function(_0x8412ed,_0x3caec0){var _0x5a7884=0xa;var _0x196a1d=['join',_0x0689('0x58'),_0x0689('0x59'),_0x0689('0x5a')];var _0xb66604={'SUM':_0x0689('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0689('0x5c'),'MAX':'MAX(%s)','MIN':_0x0689('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0689('0x5e'),'GROUP_CONCAT ASC':_0x0689('0x5f'),'GROUP_CONCAT DESC':_0x0689('0x60')};var _0x4b4723={'SEC_TO_TIME':_0x0689('0x61'),'DATE':'DATE(%s)','HOUR':_0x0689('0x62'),'ROUND':_0x0689('0x63'),'UNIX_TIMESTAMP':_0x0689('0x64')};var _0x3e3f32=function(_0x6a5f5a){return!_[_0x0689('0x65')]([_0x0689('0x66'),_0x0689('0x67'),'IS\x20EMPTY',_0x0689('0x68')],_0x6a5f5a);};var _0x5489eb=function(_0x3db2c1){if(!_0x3db2c1||!_0x3db2c1[_0x0689('0x69')][_0x0689('0x4c')]){return'';}for(var _0x58b3eb='(',_0x90ca1f=0x0;_0x90ca1f<_0x3db2c1['rules']['length'];_0x90ca1f+=0x1){_0x90ca1f>0x0&&(_0x58b3eb+='\x20'+_0x3db2c1[_0x0689('0x6a')]+'\x20');_0x58b3eb+=_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6b')]?_0x5489eb(_0x3db2c1['rules'][_0x90ca1f][_0x0689('0x6b')]):_0x3db2c1['rules'][_0x90ca1f][_0x0689('0x6c')]+'\x20'+_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6d')]+(_0x3e3f32(_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6d')])?'\x20'+_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6e')]:'');}return _0x58b3eb+')';};var _0x56cad={'where':{'id':_0x8412ed[_0x0689('0x4b')]['id']}},_0x9bddef,_0x4492e5,_0x58bd66,_0x210fe9,_0x3439a8;_0x56cad=_[_0x0689('0x43')]({},_0x56cad,_0x8412ed['options']);return db[_0x0689('0x46')][_0x0689('0x4e')](_0x56cad)['then'](function(_0xa55db9){if(_0xa55db9){_0x9bddef=_0xa55db9;return _0xa55db9['getFields']();}return null;})['then'](function(_0x4b070b){if(_0x4b070b){if(!_0x4b070b[_0x0689('0x4c')]){throw new db['Sequelize'][(_0x0689('0x6f'))](_0x0689('0x70'),0x193);}_0x4492e5=_0x4b070b;return db[_0x0689('0x71')][_0x0689('0x48')]({'raw':!![]});}return null;})[_0x0689('0x29')](function(_0x3e8a69){if(_0x3e8a69){_0x58bd66=_[_0x0689('0x72')](_0x3e8a69,'id');var _0x2c0694;var _0x93d21e=squel[_0x0689('0x73')]();_0x93d21e['from'](_0x9bddef[_0x0689('0x74')]);for(var _0x23de56=0x0;_0x23de56<_0x4492e5[_0x0689('0x4c')];_0x23de56+=0x1){_0x2c0694=_0x4492e5[_0x23de56]['MetricId']?_0x58bd66[_0x4492e5[_0x23de56][_0x0689('0x75')]][_0x0689('0x76')]:_0x4492e5[_0x23de56][_0x0689('0x6c')];_0x2c0694=_0x4492e5[_0x23de56][_0x0689('0x77')]?_['replace'](_0xb66604[_0x4492e5[_0x23de56]['function']],'%s',_0x2c0694):_0x2c0694;_0x2c0694=_0x4492e5[_0x23de56][_0x0689('0x78')]?_[_0x0689('0x79')](_0x4b4723[_0x4492e5[_0x23de56][_0x0689('0x78')]],'%s',_0x2c0694):_0x2c0694;if(_0x4492e5[_0x23de56][_0x0689('0x7a')]){_0x93d21e['group'](_0x2c0694);}_0x4492e5[_0x23de56][_0x0689('0x7b')]&&_0x93d21e[_0x0689('0x7c')](_0x2c0694,_0x4492e5[_0x23de56][_0x0689('0x7b')]===_0x0689('0x7d')?![]:!![]);_0x93d21e[_0x0689('0x6c')](_0x2c0694,_0x4492e5[_0x23de56][_0x0689('0x7e')]||_0x2c0694);}if(_0x9bddef['joins']){_0x9bddef[_0x0689('0x7f')]=JSON[_0x0689('0x80')](_0x9bddef[_0x0689('0x7f')]);for(var _0x46eff7=0x0;_0x46eff7<_0x9bddef['joins'][_0x0689('0x4c')];_0x46eff7+=0x1){if(_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x34')]&&_[_0x0689('0x65')](_0x196a1d,_0x9bddef['joins'][_0x46eff7][_0x0689('0x34')])&&_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x81')]&&_0x9bddef[_0x0689('0x7f')][_0x46eff7]['foreignTable']&&_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x82')]){_0x93d21e[_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x34')]](_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x83')],null,util[_0x0689('0x78')](_0x0689('0x84'),_0x9bddef[_0x0689('0x74')],_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x81')],_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x83')],_0x9bddef['joins'][_0x46eff7]['foreignKey']));}}}if(_0x9bddef['conditions']){_0x9bddef[_0x0689('0x85')]=JSON[_0x0689('0x80')](_0x9bddef['conditions']);_0x93d21e['where'](_0x5489eb(_0x9bddef[_0x0689('0x85')][_0x0689('0x6b')]));}_0x3439a8=_0x93d21e['clone']();_0x93d21e[_0x0689('0x22')](_0x5a7884);_0x93d21e[_0x0689('0x20')](0x0);logger[_0x0689('0x86')](_0x0689('0x87'),_0x93d21e[_0x0689('0x88')]());return dbH[_0x0689('0x89')][_0x0689('0x37')](_0x93d21e[_0x0689('0x88')](),{'type':dbH['sequelize'][_0x0689('0x8a')]['SELECT']});}})[_0x0689('0x29')](respondWithResult(_0x3caec0,null))[_0x0689('0x4a')](handleError(_0x3caec0,null));};function runReport(_0x2c68d7,_0x39ffcb,_0x30af2c){var _0x1823f5=_0x39ffcb[_0x0689('0x2e')];var _0x369bb3=0xa;var _0x108596=['join',_0x0689('0x58'),'right_join',_0x0689('0x5a')];var _0x1a368e={'SUM':_0x0689('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0689('0x5c'),'MAX':_0x0689('0x8b'),'MIN':_0x0689('0x5d'),'AVG':_0x0689('0x8c'),'GROUP_CONCAT':_0x0689('0x5e'),'GROUP_CONCAT ASC':_0x0689('0x5f'),'GROUP_CONCAT DESC':_0x0689('0x60')};var _0x5d4245={'SEC_TO_TIME':_0x0689('0x61'),'DATE':_0x0689('0x8d'),'HOUR':_0x0689('0x62'),'ROUND':_0x0689('0x63'),'UNIX_TIMESTAMP':_0x0689('0x64')};var _0x230388=function(_0x3fcf08){return!_['includes']([_0x0689('0x66'),_0x0689('0x67'),_0x0689('0x8e'),_0x0689('0x68')],_0x3fcf08);};var _0x1932d9=function(_0x12fb77){if(!_0x12fb77||!_0x12fb77['rules'][_0x0689('0x4c')]){return'';}for(var _0x13995d='(',_0x2d8285=0x0;_0x2d8285<_0x12fb77[_0x0689('0x69')][_0x0689('0x4c')];_0x2d8285+=0x1){_0x2d8285>0x0&&(_0x13995d+='\x20'+_0x12fb77['operator']+'\x20');_0x13995d+=_0x12fb77[_0x0689('0x69')][_0x2d8285]['group']?_0x1932d9(_0x12fb77[_0x0689('0x69')][_0x2d8285][_0x0689('0x6b')]):_0x12fb77[_0x0689('0x69')][_0x2d8285]['field']+'\x20'+_0x12fb77[_0x0689('0x69')][_0x2d8285]['condition']+(_0x230388(_0x12fb77[_0x0689('0x69')][_0x2d8285]['condition'])?'\x20'+_0x12fb77['rules'][_0x2d8285][_0x0689('0x6e')]:'');}return _0x13995d+')';};var _0x55a112={'where':{'id':_0x2c68d7['id']}},_0x5dc22c,_0x4a5f01,_0x180184,_0x2f7678,_0x39ff2f;_0x55a112=_['merge']({},_0x55a112,_0x30af2c);return db[_0x0689('0x46')][_0x0689('0x4e')](_0x55a112)[_0x0689('0x29')](function(_0x4f264a){if(_0x4f264a){_0x5dc22c=_0x4f264a;return _0x4f264a[_0x0689('0x8f')]();}return null;})['then'](function(_0x366c61){if(_0x366c61){if(!_0x366c61[_0x0689('0x4c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x0689('0x70'),0x193);}_0x4a5f01=_0x366c61;return db[_0x0689('0x71')][_0x0689('0x48')]({'raw':!![]});}return null;})[_0x0689('0x29')](function(_0x44ea35){if(_0x44ea35){_0x180184=_[_0x0689('0x72')](_0x44ea35,'id');var _0x342404;var _0x6331dc=squel[_0x0689('0x73')]();_0x6331dc[_0x0689('0x90')](_0x5dc22c[_0x0689('0x74')]);for(var _0x10d9a6=0x0;_0x10d9a6<_0x4a5f01[_0x0689('0x4c')];_0x10d9a6+=0x1){_0x342404=_0x4a5f01[_0x10d9a6][_0x0689('0x75')]?_0x180184[_0x4a5f01[_0x10d9a6][_0x0689('0x75')]][_0x0689('0x76')]:_0x4a5f01[_0x10d9a6][_0x0689('0x6c')];_0x342404=_0x4a5f01[_0x10d9a6][_0x0689('0x77')]?_[_0x0689('0x79')](_0x1a368e[_0x4a5f01[_0x10d9a6]['function']],'%s',_0x342404):_0x342404;_0x342404=_0x4a5f01[_0x10d9a6][_0x0689('0x78')]?_['replace'](_0x5d4245[_0x4a5f01[_0x10d9a6][_0x0689('0x78')]],'%s',_0x342404):_0x342404;if(_0x4a5f01[_0x10d9a6][_0x0689('0x7a')]){_0x6331dc[_0x0689('0x6b')](_0x342404);}_0x4a5f01[_0x10d9a6][_0x0689('0x7b')]&&_0x6331dc[_0x0689('0x7c')](_0x342404,_0x4a5f01[_0x10d9a6][_0x0689('0x7b')]===_0x0689('0x7d')?![]:!![]);_0x6331dc[_0x0689('0x6c')](_0x342404,_0x4a5f01[_0x10d9a6][_0x0689('0x7e')]||_0x342404);}if(_0x5dc22c[_0x0689('0x7f')]){_0x5dc22c[_0x0689('0x7f')]=JSON['parse'](_0x5dc22c[_0x0689('0x7f')]);for(var _0x4c77fd=0x0;_0x4c77fd<_0x5dc22c['joins'][_0x0689('0x4c')];_0x4c77fd+=0x1){if(_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x34')]&&_['includes'](_0x108596,_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x34')])&&_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x81')]&&_0x5dc22c[_0x0689('0x7f')][_0x4c77fd]['foreignTable']&&_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x82')]){_0x6331dc[_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x34')]](_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x83')],null,util[_0x0689('0x78')](_0x0689('0x84'),_0x5dc22c[_0x0689('0x74')],_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x81')],_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x83')],_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x82')]));}}}if(_0x5dc22c[_0x0689('0x85')]){_0x5dc22c['conditions']=JSON[_0x0689('0x80')](_0x5dc22c[_0x0689('0x85')]);_0x6331dc[_0x0689('0x42')](_0x1932d9(_0x5dc22c['conditions']['group']));}_0x39ff2f=_0x6331dc['clone']();_0x6331dc[_0x0689('0x22')](_0x369bb3);_0x6331dc[_0x0689('0x20')](0x0);return;}})[_0x0689('0x29')](function(){if(_0x39ffcb[_0x0689('0x91')]===_0x0689('0x92')){return null;}var _0x5f4fc0=_['merge'](_0x39ffcb,{'name':_0x39ffcb[_0x0689('0x93')]||_0x39ffcb[_0x0689('0x2e')]||_0x5dc22c[_0x0689('0x2e')],'basename':_0x1823f5,'savename':util[_0x0689('0x78')](_0x0689('0x94'),_0x39ffcb['name']||_0x5dc22c[_0x0689('0x2e')],require(_0x0689('0x95'))[_0x0689('0x96')](0x4),_0x39ffcb['output']||'csv'),'reportId':_0x5dc22c['id'],'reportType':_0x0689('0x97')});return db[_0x0689('0x98')][_0x0689('0x4f')](_0x5f4fc0,{'raw':!![]});})[_0x0689('0x29')](function(_0x4f20fe){if(_0x5dc22c[_0x0689('0x74')]==='cdr'){_0x39ff2f[_0x0689('0x42')](_0x5dc22c[_0x0689('0x74')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x39ffcb[_0x0689('0x99')],_0x39ffcb[_0x0689('0x9a')]);}else{_0x39ff2f[_0x0689('0x42')](_0x5dc22c[_0x0689('0x74')]+_0x0689('0x9b'),_0x39ffcb[_0x0689('0x99')],_0x39ffcb[_0x0689('0x9a')]);}if(_0x4f20fe){logger[_0x0689('0x9c')](_0x0689('0x9d'),_0x39ff2f[_0x0689('0x88')]());require(_0x0689('0x9e'))['fork'](path[_0x0689('0x9f')](__dirname,_0x0689('0xa0'),_0x4f20fe['output']),[_0x4f20fe['id'],_0x39ff2f[_0x0689('0x88')](),path[_0x0689('0x9f')](__dirname,'../../files/reports',_0x4f20fe[_0x0689('0xa1')]),_0x1823f5]);return _0x4f20fe;}else{var _0x4d3847=squel['select']();_0x4d3847[_0x0689('0x90')]('('+_0x39ff2f['toString']()+')',_0x0689('0xa2'));_0x4d3847['field'](_0x0689('0xa3'),'count');_0x39ff2f['limit'](_0x39ffcb['limit']||_0x369bb3);_0x39ff2f[_0x0689('0x20')](_0x39ffcb['offset']||0x0);return dbH[_0x0689('0x89')][_0x0689('0x37')](_0x4d3847[_0x0689('0x88')](),{'type':dbH[_0x0689('0x89')][_0x0689('0x8a')]['SELECT']})['then'](function(_0x2c263b){if(!_0x2c263b[_0x0689('0x4c')]){_0x2f7678=0x0;}else{_0x2f7678=_0x2c263b[0x0][_0x0689('0x23')]||0x0;}return dbH[_0x0689('0x89')]['query'](_0x39ff2f['toString'](),{'type':dbH['sequelize'][_0x0689('0x8a')]['SELECT']});})[_0x0689('0x29')](function(_0x5914dc){return{'rows':_0x5914dc||[],'count':_0x2f7678};});}});}exports[_0x0689('0xa4')]=function(_0x1c17a5,_0x57009f){return runReport(_0x1c17a5['params'],_0x1c17a5[_0x0689('0x37')],_0x1c17a5[_0x0689('0x45')])[_0x0689('0x29')](respondWithResult(_0x57009f,null))[_0x0689('0x4a')](handleError(_0x57009f,null));};exports['runReport']=runReport;exports[_0x0689('0x37')]=function(_0x3d3333,_0x4dd34){var _0x459b51=0xa;var _0x505499=[_0x0689('0x9f'),_0x0689('0x58'),'right_join',_0x0689('0x5a')];var _0x203e84={'SUM':_0x0689('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0689('0x5c'),'MAX':_0x0689('0x8b'),'MIN':_0x0689('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0689('0x5e'),'GROUP_CONCAT ASC':_0x0689('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xef506b={'SEC_TO_TIME':_0x0689('0x61'),'DATE':_0x0689('0x8d'),'HOUR':_0x0689('0x62'),'ROUND':_0x0689('0x63'),'UNIX_TIMESTAMP':_0x0689('0x64')};var _0x12d0a6=function(_0x44e7d0){return!_['includes']([_0x0689('0x66'),_0x0689('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x44e7d0);};var _0x4702b8=function(_0x333441){if(!_0x333441||!_0x333441[_0x0689('0x69')][_0x0689('0x4c')]){return'';}for(var _0x5d7128='(',_0x29c2ac=0x0;_0x29c2ac<_0x333441[_0x0689('0x69')][_0x0689('0x4c')];_0x29c2ac+=0x1){_0x29c2ac>0x0&&(_0x5d7128+='\x20'+_0x333441[_0x0689('0x6a')]+'\x20');_0x5d7128+=_0x333441['rules'][_0x29c2ac][_0x0689('0x6b')]?_0x4702b8(_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6b')]):_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6c')]+'\x20'+_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6d')]+(_0x12d0a6(_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6d')])?'\x20'+_0x333441[_0x0689('0x69')][_0x29c2ac]['value']:'');}return _0x5d7128+')';};var _0x47d1c6={'where':{'id':_0x3d3333[_0x0689('0x4b')]['id']}},_0x5d70b8,_0x290f1a,_0xda2413,_0x86943a,_0x2619e2;_0x47d1c6=_['merge']({},_0x47d1c6,_0x3d3333[_0x0689('0x45')]);return db[_0x0689('0x46')]['find'](_0x47d1c6)[_0x0689('0x29')](function(_0x57b80f){if(_0x57b80f){_0x5d70b8=_0x57b80f;return _0x57b80f['getFields']();}return null;})[_0x0689('0x29')](function(_0x1a8e34){if(_0x1a8e34){if(!_0x1a8e34[_0x0689('0x4c')]){throw new db['Sequelize'][(_0x0689('0x6f'))](_0x0689('0x70'),0x193);}_0x290f1a=_0x1a8e34;return db[_0x0689('0x71')][_0x0689('0x48')]({'raw':!![]});}return null;})[_0x0689('0x29')](function(_0x3fd0fe){if(_0x3fd0fe){_0xda2413=_[_0x0689('0x72')](_0x3fd0fe,'id');var _0x1121fb;var _0xbebfe5=squel[_0x0689('0x73')]();_0xbebfe5[_0x0689('0x90')](_0x5d70b8[_0x0689('0x74')]);for(var _0x13f589=0x0;_0x13f589<_0x290f1a['length'];_0x13f589+=0x1){_0x1121fb=_0x290f1a[_0x13f589][_0x0689('0x75')]?_0xda2413[_0x290f1a[_0x13f589]['MetricId']][_0x0689('0x76')]:_0x290f1a[_0x13f589][_0x0689('0x6c')];_0x1121fb=_0x290f1a[_0x13f589]['function']?_[_0x0689('0x79')](_0x203e84[_0x290f1a[_0x13f589][_0x0689('0x77')]],'%s',_0x1121fb):_0x1121fb;_0x1121fb=_0x290f1a[_0x13f589][_0x0689('0x78')]?_[_0x0689('0x79')](_0xef506b[_0x290f1a[_0x13f589]['format']],'%s',_0x1121fb):_0x1121fb;if(_0x290f1a[_0x13f589]['groupBy']){_0xbebfe5['group'](_0x1121fb);}_0x290f1a[_0x13f589][_0x0689('0x7b')]&&_0xbebfe5[_0x0689('0x7c')](_0x1121fb,_0x290f1a[_0x13f589][_0x0689('0x7b')]===_0x0689('0x7d')?![]:!![]);_0xbebfe5[_0x0689('0x6c')](_0x1121fb,_0x290f1a[_0x13f589][_0x0689('0x7e')]||_0x1121fb);}if(_0x5d70b8[_0x0689('0x7f')]){_0x5d70b8[_0x0689('0x7f')]=JSON[_0x0689('0x80')](_0x5d70b8[_0x0689('0x7f')]);for(var _0x1e95cb=0x0;_0x1e95cb<_0x5d70b8[_0x0689('0x7f')]['length'];_0x1e95cb+=0x1){if(_0x5d70b8['joins'][_0x1e95cb][_0x0689('0x34')]&&_[_0x0689('0x65')](_0x505499,_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x34')])&&_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x81')]&&_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x83')]&&_0x5d70b8[_0x0689('0x7f')][_0x1e95cb]['foreignKey']){_0xbebfe5[_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x34')]](_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x83')],null,util[_0x0689('0x78')](_0x0689('0x84'),_0x5d70b8[_0x0689('0x74')],_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x81')],_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x83')],_0x5d70b8['joins'][_0x1e95cb][_0x0689('0x82')]));}}}if(_0x5d70b8[_0x0689('0x85')]){_0x5d70b8[_0x0689('0x85')]=JSON[_0x0689('0x80')](_0x5d70b8[_0x0689('0x85')]);_0xbebfe5['where'](_0x4702b8(_0x5d70b8[_0x0689('0x85')][_0x0689('0x6b')]));}_0x2619e2=_0xbebfe5[_0x0689('0xa5')]();_0xbebfe5[_0x0689('0x22')](_0x459b51);_0xbebfe5['offset'](0x0);logger['debug'](_0x0689('0x87'),_0xbebfe5[_0x0689('0x88')]());return dbH[_0x0689('0x89')][_0x0689('0x37')](_0xbebfe5[_0x0689('0x88')](),{'type':dbH[_0x0689('0x89')][_0x0689('0x8a')][_0x0689('0xa6')]});}})[_0x0689('0x29')](function(){return{'sql':_0x2619e2['toString']()};})['then'](respondWithResult(_0x4dd34,null))[_0x0689('0x4a')](handleError(_0x4dd34,null));}; \ No newline at end of file +var _0x516a=['toString','sequelize','SELECT','left_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','operator','keyBy','select','from','parentKey','clone','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','QueryTypes','run','runReport','getFields','eml-format','rimraf','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','CustomReports','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','table','MetricId','metric','function','format','replace','groupBy','group','orderBy','DESC','alias','joins','parse','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','debug','Limited\x20Query:'];(function(_0x566180,_0x341806){var _0xbdc228=function(_0x2d1ec2){while(--_0x2d1ec2){_0x566180['push'](_0x566180['shift']());}};_0xbdc228(++_0x341806);}(_0x516a,0xc8));var _0xa516=function(_0x57211b,_0x41ccef){_0x57211b=_0x57211b-0x0;var _0x457b58=_0x516a[_0x57211b];return _0x457b58;};'use strict';var emlformat=require(_0xa516('0x0'));var rimraf=require(_0xa516('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa516('0x2'));var moment=require(_0xa516('0x3'));var BPromise=require(_0xa516('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa516('0x5'));var sox=require(_0xa516('0x6'));var csv=require('to-csv');var ejs=require(_0xa516('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa516('0x8'));var squel=require('squel');var crypto=require(_0xa516('0x9'));var jsforce=require(_0xa516('0xa'));var deskjs=require(_0xa516('0xb'));var toCsv=require(_0xa516('0xc'));var querystring=require('querystring');var Papa=require(_0xa516('0xd'));var Redis=require(_0xa516('0xe'));var authService=require(_0xa516('0xf'));var qs=require(_0xa516('0x10'));var as=require(_0xa516('0x11'));var hardwareService=require(_0xa516('0x12'));var logger=require(_0xa516('0x13'))('api');var utils=require(_0xa516('0x14'));var config=require(_0xa516('0x15'));var licenseUtil=require(_0xa516('0x16'));var db=require(_0xa516('0x17'))['db'];var dbH=require(_0xa516('0x17'))['dbH'];function respondWithStatusCode(_0x1c0c43,_0x12be07){_0x12be07=_0x12be07||0xcc;return function(_0x278920){if(_0x278920){return _0x1c0c43[_0xa516('0x18')](_0x12be07);}return _0x1c0c43[_0xa516('0x19')](_0x12be07)['end']();};}function respondWithResult(_0x4f3a33,_0x25e651){_0x25e651=_0x25e651||0xc8;return function(_0x53d273){if(_0x53d273){return _0x4f3a33['status'](_0x25e651)[_0xa516('0x1a')](_0x53d273);}};}function respondWithFilteredResult(_0x42debc,_0xfb5197){return function(_0x3ba1e2){if(_0x3ba1e2){var _0xe1bc58=typeof _0xfb5197[_0xa516('0x1b')]===_0xa516('0x1c')&&typeof _0xfb5197[_0xa516('0x1d')]===_0xa516('0x1c');var _0x47fd14=_0x3ba1e2[_0xa516('0x1e')];var _0x79d1cc=_0xe1bc58?0x0:_0xfb5197[_0xa516('0x1b')];var _0x587ac9=_0xe1bc58?_0x3ba1e2['count']:_0xfb5197[_0xa516('0x1b')]+_0xfb5197[_0xa516('0x1d')];var _0x62107;if(_0x587ac9>=_0x47fd14){_0x587ac9=_0x47fd14;_0x62107=0xc8;}else{_0x62107=0xce;}_0x42debc[_0xa516('0x19')](_0x62107);return _0x42debc['set'](_0xa516('0x1f'),_0x79d1cc+'-'+_0x587ac9+'/'+_0x47fd14)[_0xa516('0x1a')](_0x3ba1e2);}return null;};}function patchUpdates(_0x45b240){return function(_0x68fbe7){try{jsonpatch[_0xa516('0x20')](_0x68fbe7,_0x45b240,!![]);}catch(_0x35dae6){return BPromise[_0xa516('0x21')](_0x35dae6);}return _0x68fbe7[_0xa516('0x22')]();};}function saveUpdates(_0x1ffe5f,_0x277600){return function(_0x379231){if(_0x379231){return _0x379231['update'](_0x1ffe5f)[_0xa516('0x23')](function(_0x95f496){return _0x95f496;});}return null;};}function removeEntity(_0xfa4b76,_0x2d9be6){return function(_0x7802dc){if(_0x7802dc){return _0x7802dc[_0xa516('0x24')]()[_0xa516('0x23')](function(){var _0x5e450a=_0x7802dc[_0xa516('0x25')]({'plain':!![]});var _0x32a37=_0xa516('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x32a37,'resourceId':_0x5e450a['id']}})['then'](function(){return _0x7802dc;});})[_0xa516('0x23')](function(){_0xfa4b76[_0xa516('0x19')](0xcc)[_0xa516('0x27')]();});}};}function handleEntityNotFound(_0x22534f,_0xf37ea9){return function(_0x22837e){if(!_0x22837e){_0x22534f['sendStatus'](0x194);}return _0x22837e;};}function handleError(_0x397104,_0xca3c83){_0xca3c83=_0xca3c83||0x1f4;return function(_0x190cf0){logger[_0xa516('0x28')](_0x190cf0[_0xa516('0x29')]);if(_0x190cf0[_0xa516('0x2a')]){delete _0x190cf0[_0xa516('0x2a')];}_0x397104[_0xa516('0x19')](_0xca3c83)[_0xa516('0x2b')](_0x190cf0);};}exports[_0xa516('0x2c')]=function(_0x274f0b,_0x2f0c0e){var _0x334242={},_0x3d00e6={},_0x74a78f={'count':0x0,'rows':[]};var _0x5a438f=_[_0xa516('0x2d')](db[_0xa516('0x2e')][_0xa516('0x2f')],function(_0x3fd4ec){return{'name':_0x3fd4ec['fieldName'],'type':_0x3fd4ec[_0xa516('0x30')][_0xa516('0x31')]};});_0x3d00e6[_0xa516('0x32')]=_[_0xa516('0x2d')](_0x5a438f,'name');_0x3d00e6[_0xa516('0x33')]=_[_0xa516('0x34')](_0x274f0b['query']);_0x3d00e6[_0xa516('0x35')]=_['intersection'](_0x3d00e6[_0xa516('0x32')],_0x3d00e6[_0xa516('0x33')]);_0x334242[_0xa516('0x36')]=_['intersection'](_0x3d00e6[_0xa516('0x32')],qs['fields'](_0x274f0b['query'][_0xa516('0x37')]));_0x334242[_0xa516('0x36')]=_0x334242[_0xa516('0x36')][_0xa516('0x38')]?_0x334242[_0xa516('0x36')]:_0x3d00e6[_0xa516('0x32')];if(!_0x274f0b[_0xa516('0x33')][_0xa516('0x39')](_0xa516('0x3a'))){_0x334242[_0xa516('0x1d')]=qs[_0xa516('0x1d')](_0x274f0b[_0xa516('0x33')][_0xa516('0x1d')]);_0x334242['offset']=qs[_0xa516('0x1b')](_0x274f0b[_0xa516('0x33')]['offset']);}_0x334242[_0xa516('0x3b')]=qs[_0xa516('0x3c')](_0x274f0b[_0xa516('0x33')][_0xa516('0x3c')]);_0x334242['where']=qs['filters'](_[_0xa516('0x3d')](_0x274f0b['query'],_0x3d00e6['filters']),_0x5a438f);if(_0x274f0b['query'][_0xa516('0x3e')]){_0x334242['where']=_[_0xa516('0x3f')](_0x334242[_0xa516('0x40')],{'$or':_[_0xa516('0x2d')](_0x5a438f,function(_0x4152b0){if(_0x4152b0['type']!==_0xa516('0x41')){var _0x387cba={};_0x387cba[_0x4152b0[_0xa516('0x2a')]]={'$like':'%'+_0x274f0b[_0xa516('0x33')][_0xa516('0x3e')]+'%'};return _0x387cba;}})});}_0x334242=_[_0xa516('0x3f')]({},_0x334242,_0x274f0b[_0xa516('0x42')]);var _0xe43565={'where':_0x334242['where']};return db[_0xa516('0x2e')]['count'](_0xe43565)[_0xa516('0x23')](function(_0x2d5064){_0x74a78f[_0xa516('0x1e')]=_0x2d5064;if(_0x274f0b[_0xa516('0x33')]['includeAll']){_0x334242[_0xa516('0x43')]=[{'all':!![]}];}return db[_0xa516('0x2e')][_0xa516('0x44')](_0x334242);})[_0xa516('0x23')](function(_0xab09d){_0x74a78f['rows']=_0xab09d;return _0x74a78f;})[_0xa516('0x23')](respondWithFilteredResult(_0x2f0c0e,_0x334242))[_0xa516('0x45')](handleError(_0x2f0c0e,null));};exports[_0xa516('0x46')]=function(_0x48c9d5,_0x2d4201){var _0x481e66={'raw':![],'where':{'id':_0x48c9d5[_0xa516('0x47')]['id']}},_0x3b6eb1={};_0x3b6eb1[_0xa516('0x32')]=_[_0xa516('0x34')](db['AnalyticCustomReport'][_0xa516('0x2f')]);_0x3b6eb1['query']=_[_0xa516('0x34')](_0x48c9d5[_0xa516('0x33')]);_0x3b6eb1[_0xa516('0x35')]=_[_0xa516('0x48')](_0x3b6eb1[_0xa516('0x32')],_0x3b6eb1['query']);_0x481e66[_0xa516('0x36')]=_['intersection'](_0x3b6eb1[_0xa516('0x32')],qs['fields'](_0x48c9d5[_0xa516('0x33')][_0xa516('0x37')]));_0x481e66[_0xa516('0x36')]=_0x481e66[_0xa516('0x36')]['length']?_0x481e66[_0xa516('0x36')]:_0x3b6eb1[_0xa516('0x32')];if(_0x48c9d5[_0xa516('0x33')][_0xa516('0x49')]){_0x481e66['include']=[{'all':!![]}];}_0x481e66=_['merge']({},_0x481e66,_0x48c9d5[_0xa516('0x42')]);return db['AnalyticCustomReport'][_0xa516('0x4a')](_0x481e66)[_0xa516('0x23')](handleEntityNotFound(_0x2d4201,null))[_0xa516('0x23')](respondWithResult(_0x2d4201,null))[_0xa516('0x45')](handleError(_0x2d4201,null));};exports[_0xa516('0x4b')]=function(_0x549de5,_0x265ffd){return db['AnalyticCustomReport'][_0xa516('0x4b')](_0x549de5[_0xa516('0x4c')],{})[_0xa516('0x23')](function(_0x391980){var _0x59008c=_0x549de5[_0xa516('0x4d')][_0xa516('0x25')]({'plain':!![]});if(!_0x59008c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59008c[_0xa516('0x4e')]===_0xa516('0x4d')){var _0x4df298=_0x391980['get']({'plain':!![]});var _0x2c49b3=_0xa516('0x4f');return db[_0xa516('0x50')][_0xa516('0x4a')]({'where':{'name':_0x2c49b3,'userProfileId':_0x59008c[_0xa516('0x51')]},'raw':!![]})['then'](function(_0x10eefc){if(_0x10eefc&&_0x10eefc[_0xa516('0x52')]===0x0){return db[_0xa516('0x53')]['create']({'name':_0x4df298[_0xa516('0x2a')],'resourceId':_0x4df298['id'],'type':_0xa516('0x26'),'sectionId':_0x10eefc['id']},{})[_0xa516('0x23')](function(){return _0x391980;});}else{return _0x391980;}})[_0xa516('0x45')](function(_0x487d5a){logger[_0xa516('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487d5a);throw _0x487d5a;});}return _0x391980;})[_0xa516('0x23')](respondWithResult(_0x265ffd,0xc9))['catch'](handleError(_0x265ffd,null));};exports[_0xa516('0x54')]=function(_0x4d2413,_0x2ac017){if(_0x4d2413[_0xa516('0x4c')]['id']){delete _0x4d2413['body']['id'];}return db[_0xa516('0x2e')][_0xa516('0x4a')]({'where':{'id':_0x4d2413['params']['id']}})[_0xa516('0x23')](handleEntityNotFound(_0x2ac017,null))[_0xa516('0x23')](saveUpdates(_0x4d2413['body'],null))['then'](respondWithResult(_0x2ac017,null))[_0xa516('0x45')](handleError(_0x2ac017,null));};exports[_0xa516('0x24')]=function(_0x541a46,_0x3f1340){return db['AnalyticCustomReport'][_0xa516('0x4a')]({'where':{'id':_0x541a46[_0xa516('0x47')]['id']}})[_0xa516('0x23')](handleEntityNotFound(_0x3f1340,null))[_0xa516('0x23')](removeEntity(_0x3f1340,null))[_0xa516('0x45')](handleError(_0x3f1340,null));};exports[_0xa516('0x55')]=function(_0x3c1951,_0x4a3ad4){var _0x14b187=0xa;var _0x11d824=[_0xa516('0x56'),'left_join',_0xa516('0x57'),_0xa516('0x58')];var _0x59f100={'SUM':'SUM(%s)','COUNT':_0xa516('0x59'),'COUNT DISTINCT':_0xa516('0x5a'),'MAX':_0xa516('0x5b'),'MIN':_0xa516('0x5c'),'AVG':_0xa516('0x5d'),'GROUP_CONCAT':_0xa516('0x5e'),'GROUP_CONCAT ASC':_0xa516('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2bde14={'SEC_TO_TIME':_0xa516('0x60'),'DATE':_0xa516('0x61'),'HOUR':_0xa516('0x62'),'ROUND':_0xa516('0x63'),'UNIX_TIMESTAMP':_0xa516('0x64')};var _0x3f74b7=function(_0x3ddc10){return!_[_0xa516('0x65')]([_0xa516('0x66'),_0xa516('0x67'),_0xa516('0x68'),_0xa516('0x69')],_0x3ddc10);};var _0x321b63=function(_0x1e29d7){if(!_0x1e29d7||!_0x1e29d7[_0xa516('0x6a')]['length']){return'';}for(var _0x502a3b='(',_0x1fac8f=0x0;_0x1fac8f<_0x1e29d7[_0xa516('0x6a')][_0xa516('0x38')];_0x1fac8f+=0x1){_0x1fac8f>0x0&&(_0x502a3b+='\x20'+_0x1e29d7['operator']+'\x20');_0x502a3b+=_0x1e29d7[_0xa516('0x6a')][_0x1fac8f]['group']?_0x321b63(_0x1e29d7[_0xa516('0x6a')][_0x1fac8f]['group']):_0x1e29d7[_0xa516('0x6a')][_0x1fac8f][_0xa516('0x6b')]+'\x20'+_0x1e29d7[_0xa516('0x6a')][_0x1fac8f][_0xa516('0x6c')]+(_0x3f74b7(_0x1e29d7[_0xa516('0x6a')][_0x1fac8f][_0xa516('0x6c')])?'\x20'+_0x1e29d7[_0xa516('0x6a')][_0x1fac8f][_0xa516('0x6d')]:'');}return _0x502a3b+')';};var _0x3bebfa={'where':{'id':_0x3c1951[_0xa516('0x47')]['id']}},_0x5396b8,_0x19fe18,_0x11e598,_0x100c82,_0x28754f;_0x3bebfa=_['merge']({},_0x3bebfa,_0x3c1951[_0xa516('0x42')]);return db[_0xa516('0x2e')][_0xa516('0x4a')](_0x3bebfa)['then'](function(_0x3d5346){if(_0x3d5346){_0x5396b8=_0x3d5346;return _0x3d5346['getFields']();}return null;})[_0xa516('0x23')](function(_0x22d56c){if(_0x22d56c){if(!_0x22d56c[_0xa516('0x38')]){throw new db['Sequelize'][(_0xa516('0x6e'))](_0xa516('0x6f'),0x193);}_0x19fe18=_0x22d56c;return db[_0xa516('0x70')][_0xa516('0x44')]({'raw':!![]});}return null;})[_0xa516('0x23')](function(_0x9a7174){if(_0x9a7174){_0x11e598=_['keyBy'](_0x9a7174,'id');var _0x34f6a7;var _0x2f978a=squel['select']();_0x2f978a['from'](_0x5396b8[_0xa516('0x71')]);for(var _0x3fa5a2=0x0;_0x3fa5a2<_0x19fe18[_0xa516('0x38')];_0x3fa5a2+=0x1){_0x34f6a7=_0x19fe18[_0x3fa5a2][_0xa516('0x72')]?_0x11e598[_0x19fe18[_0x3fa5a2]['MetricId']][_0xa516('0x73')]:_0x19fe18[_0x3fa5a2][_0xa516('0x6b')];_0x34f6a7=_0x19fe18[_0x3fa5a2]['function']?_['replace'](_0x59f100[_0x19fe18[_0x3fa5a2][_0xa516('0x74')]],'%s',_0x34f6a7):_0x34f6a7;_0x34f6a7=_0x19fe18[_0x3fa5a2][_0xa516('0x75')]?_[_0xa516('0x76')](_0x2bde14[_0x19fe18[_0x3fa5a2]['format']],'%s',_0x34f6a7):_0x34f6a7;if(_0x19fe18[_0x3fa5a2][_0xa516('0x77')]){_0x2f978a[_0xa516('0x78')](_0x34f6a7);}_0x19fe18[_0x3fa5a2][_0xa516('0x79')]&&_0x2f978a['order'](_0x34f6a7,_0x19fe18[_0x3fa5a2][_0xa516('0x79')]===_0xa516('0x7a')?![]:!![]);_0x2f978a['field'](_0x34f6a7,_0x19fe18[_0x3fa5a2][_0xa516('0x7b')]||_0x34f6a7);}if(_0x5396b8[_0xa516('0x7c')]){_0x5396b8[_0xa516('0x7c')]=JSON[_0xa516('0x7d')](_0x5396b8[_0xa516('0x7c')]);for(var _0x18f2ba=0x0;_0x18f2ba<_0x5396b8[_0xa516('0x7c')][_0xa516('0x38')];_0x18f2ba+=0x1){if(_0x5396b8[_0xa516('0x7c')][_0x18f2ba][_0xa516('0x30')]&&_[_0xa516('0x65')](_0x11d824,_0x5396b8[_0xa516('0x7c')][_0x18f2ba][_0xa516('0x30')])&&_0x5396b8[_0xa516('0x7c')][_0x18f2ba]['parentKey']&&_0x5396b8[_0xa516('0x7c')][_0x18f2ba]['foreignTable']&&_0x5396b8[_0xa516('0x7c')][_0x18f2ba][_0xa516('0x7e')]){_0x2f978a[_0x5396b8[_0xa516('0x7c')][_0x18f2ba][_0xa516('0x30')]](_0x5396b8[_0xa516('0x7c')][_0x18f2ba]['foreignTable'],null,util[_0xa516('0x75')](_0xa516('0x7f'),_0x5396b8[_0xa516('0x71')],_0x5396b8[_0xa516('0x7c')][_0x18f2ba]['parentKey'],_0x5396b8['joins'][_0x18f2ba][_0xa516('0x80')],_0x5396b8['joins'][_0x18f2ba]['foreignKey']));}}}if(_0x5396b8[_0xa516('0x81')]){_0x5396b8[_0xa516('0x81')]=JSON[_0xa516('0x7d')](_0x5396b8['conditions']);_0x2f978a[_0xa516('0x40')](_0x321b63(_0x5396b8['conditions'][_0xa516('0x78')]));}_0x28754f=_0x2f978a['clone']();_0x2f978a[_0xa516('0x1d')](_0x14b187);_0x2f978a[_0xa516('0x1b')](0x0);logger[_0xa516('0x82')](_0xa516('0x83'),_0x2f978a[_0xa516('0x84')]());return dbH[_0xa516('0x85')]['query'](_0x2f978a['toString'](),{'type':dbH[_0xa516('0x85')]['QueryTypes'][_0xa516('0x86')]});}})[_0xa516('0x23')](respondWithResult(_0x4a3ad4,null))[_0xa516('0x45')](handleError(_0x4a3ad4,null));};function runReport(_0x5788e1,_0x360e25,_0x45cf6e){var _0x5cb4d=_0x360e25['name'];var _0x2dc04f=0xa;var _0x3ec37b=['join',_0xa516('0x87'),'right_join','cross_join'];var _0x59384a={'SUM':_0xa516('0x88'),'COUNT':_0xa516('0x59'),'COUNT DISTINCT':_0xa516('0x5a'),'MAX':_0xa516('0x5b'),'MIN':_0xa516('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa516('0x5e'),'GROUP_CONCAT ASC':_0xa516('0x5f'),'GROUP_CONCAT DESC':_0xa516('0x89')};var _0x26f40d={'SEC_TO_TIME':_0xa516('0x60'),'DATE':'DATE(%s)','HOUR':_0xa516('0x62'),'ROUND':_0xa516('0x63'),'UNIX_TIMESTAMP':_0xa516('0x64')};var _0x500d79=function(_0x3f5911){return!_[_0xa516('0x65')]([_0xa516('0x66'),_0xa516('0x67'),_0xa516('0x68'),_0xa516('0x69')],_0x3f5911);};var _0x25e1cd=function(_0x137c34){if(!_0x137c34||!_0x137c34[_0xa516('0x6a')]['length']){return'';}for(var _0xc44083='(',_0x106d63=0x0;_0x106d63<_0x137c34[_0xa516('0x6a')][_0xa516('0x38')];_0x106d63+=0x1){_0x106d63>0x0&&(_0xc44083+='\x20'+_0x137c34[_0xa516('0x8a')]+'\x20');_0xc44083+=_0x137c34[_0xa516('0x6a')][_0x106d63]['group']?_0x25e1cd(_0x137c34[_0xa516('0x6a')][_0x106d63][_0xa516('0x78')]):_0x137c34['rules'][_0x106d63]['field']+'\x20'+_0x137c34[_0xa516('0x6a')][_0x106d63][_0xa516('0x6c')]+(_0x500d79(_0x137c34['rules'][_0x106d63][_0xa516('0x6c')])?'\x20'+_0x137c34['rules'][_0x106d63][_0xa516('0x6d')]:'');}return _0xc44083+')';};var _0x28cc3c={'where':{'id':_0x5788e1['id']}},_0xb23dce,_0x5662cc,_0x256765,_0x43cc8e,_0x1cad4e;_0x28cc3c=_[_0xa516('0x3f')]({},_0x28cc3c,_0x45cf6e);return db[_0xa516('0x2e')][_0xa516('0x4a')](_0x28cc3c)[_0xa516('0x23')](function(_0x5eed33){if(_0x5eed33){_0xb23dce=_0x5eed33;return _0x5eed33['getFields']();}return null;})[_0xa516('0x23')](function(_0xaafb95){if(_0xaafb95){if(!_0xaafb95[_0xa516('0x38')]){throw new db['Sequelize'][(_0xa516('0x6e'))](_0xa516('0x6f'),0x193);}_0x5662cc=_0xaafb95;return db[_0xa516('0x70')]['findAll']({'raw':!![]});}return null;})[_0xa516('0x23')](function(_0x951bc3){if(_0x951bc3){_0x256765=_[_0xa516('0x8b')](_0x951bc3,'id');var _0x80be84;var _0x522753=squel[_0xa516('0x8c')]();_0x522753[_0xa516('0x8d')](_0xb23dce[_0xa516('0x71')]);for(var _0x236582=0x0;_0x236582<_0x5662cc[_0xa516('0x38')];_0x236582+=0x1){_0x80be84=_0x5662cc[_0x236582]['MetricId']?_0x256765[_0x5662cc[_0x236582][_0xa516('0x72')]][_0xa516('0x73')]:_0x5662cc[_0x236582][_0xa516('0x6b')];_0x80be84=_0x5662cc[_0x236582][_0xa516('0x74')]?_['replace'](_0x59384a[_0x5662cc[_0x236582][_0xa516('0x74')]],'%s',_0x80be84):_0x80be84;_0x80be84=_0x5662cc[_0x236582][_0xa516('0x75')]?_[_0xa516('0x76')](_0x26f40d[_0x5662cc[_0x236582][_0xa516('0x75')]],'%s',_0x80be84):_0x80be84;if(_0x5662cc[_0x236582]['groupBy']){_0x522753['group'](_0x80be84);}_0x5662cc[_0x236582][_0xa516('0x79')]&&_0x522753['order'](_0x80be84,_0x5662cc[_0x236582][_0xa516('0x79')]===_0xa516('0x7a')?![]:!![]);_0x522753['field'](_0x80be84,_0x5662cc[_0x236582][_0xa516('0x7b')]||_0x80be84);}if(_0xb23dce[_0xa516('0x7c')]){_0xb23dce[_0xa516('0x7c')]=JSON[_0xa516('0x7d')](_0xb23dce[_0xa516('0x7c')]);for(var _0x138265=0x0;_0x138265<_0xb23dce['joins'][_0xa516('0x38')];_0x138265+=0x1){if(_0xb23dce['joins'][_0x138265][_0xa516('0x30')]&&_[_0xa516('0x65')](_0x3ec37b,_0xb23dce['joins'][_0x138265][_0xa516('0x30')])&&_0xb23dce['joins'][_0x138265][_0xa516('0x8e')]&&_0xb23dce[_0xa516('0x7c')][_0x138265]['foreignTable']&&_0xb23dce[_0xa516('0x7c')][_0x138265][_0xa516('0x7e')]){_0x522753[_0xb23dce['joins'][_0x138265][_0xa516('0x30')]](_0xb23dce[_0xa516('0x7c')][_0x138265]['foreignTable'],null,util[_0xa516('0x75')]('%s.%s\x20=\x20%s.%s',_0xb23dce['table'],_0xb23dce[_0xa516('0x7c')][_0x138265]['parentKey'],_0xb23dce[_0xa516('0x7c')][_0x138265][_0xa516('0x80')],_0xb23dce[_0xa516('0x7c')][_0x138265][_0xa516('0x7e')]));}}}if(_0xb23dce[_0xa516('0x81')]){_0xb23dce[_0xa516('0x81')]=JSON['parse'](_0xb23dce['conditions']);_0x522753['where'](_0x25e1cd(_0xb23dce[_0xa516('0x81')][_0xa516('0x78')]));}_0x1cad4e=_0x522753[_0xa516('0x8f')]();_0x522753['limit'](_0x2dc04f);_0x522753[_0xa516('0x1b')](0x0);return;}})[_0xa516('0x23')](function(){if(_0x360e25[_0xa516('0x90')]===_0xa516('0x91')){return null;}var _0x5e87ba=_[_0xa516('0x3f')](_0x360e25,{'name':_0x360e25[_0xa516('0x92')]||_0x360e25['name']||_0xb23dce[_0xa516('0x2a')],'basename':_0x5cb4d,'savename':util[_0xa516('0x75')](_0xa516('0x93'),_0x360e25[_0xa516('0x2a')]||_0xb23dce[_0xa516('0x2a')],require(_0xa516('0x94'))['generate'](0x4),_0x360e25['output']||_0xa516('0x95')),'reportId':_0xb23dce['id'],'reportType':'custom'});return db[_0xa516('0x96')][_0xa516('0x4b')](_0x5e87ba,{'raw':!![]});})[_0xa516('0x23')](function(_0x33775d){if(_0xb23dce[_0xa516('0x71')]===_0xa516('0x97')){_0x1cad4e['where'](_0xb23dce[_0xa516('0x71')]+_0xa516('0x98'),_0x360e25[_0xa516('0x99')],_0x360e25[_0xa516('0x9a')]);}else{_0x1cad4e[_0xa516('0x40')](_0xb23dce[_0xa516('0x71')]+_0xa516('0x9b'),_0x360e25[_0xa516('0x99')],_0x360e25[_0xa516('0x9a')]);}if(_0x33775d){logger['info'](_0xa516('0x9c'),_0x1cad4e[_0xa516('0x84')]());require('child_process')[_0xa516('0x9d')](path[_0xa516('0x56')](__dirname,_0xa516('0x9e'),_0x33775d[_0xa516('0x90')]),[_0x33775d['id'],_0x1cad4e[_0xa516('0x84')](),path[_0xa516('0x56')](__dirname,'../../files/reports',_0x33775d[_0xa516('0x9f')]),_0x5cb4d]);return _0x33775d;}else{var _0x5beba4=squel['select']();_0x5beba4['from']('('+_0x1cad4e[_0xa516('0x84')]()+')',_0xa516('0xa0'));_0x5beba4[_0xa516('0x6b')](_0xa516('0xa1'),_0xa516('0x1e'));_0x1cad4e[_0xa516('0x1d')](_0x360e25[_0xa516('0x1d')]||_0x2dc04f);_0x1cad4e[_0xa516('0x1b')](_0x360e25['offset']||0x0);return dbH[_0xa516('0x85')][_0xa516('0x33')](_0x5beba4[_0xa516('0x84')](),{'type':dbH[_0xa516('0x85')][_0xa516('0xa2')][_0xa516('0x86')]})[_0xa516('0x23')](function(_0x54c327){if(!_0x54c327[_0xa516('0x38')]){_0x43cc8e=0x0;}else{_0x43cc8e=_0x54c327[0x0][_0xa516('0x1e')]||0x0;}return dbH[_0xa516('0x85')][_0xa516('0x33')](_0x1cad4e[_0xa516('0x84')](),{'type':dbH['sequelize'][_0xa516('0xa2')][_0xa516('0x86')]});})[_0xa516('0x23')](function(_0x554dcf){return{'rows':_0x554dcf||[],'count':_0x43cc8e};});}});}exports[_0xa516('0xa3')]=function(_0x168934,_0x5bccfe){return runReport(_0x168934[_0xa516('0x47')],_0x168934[_0xa516('0x33')],_0x168934['options'])[_0xa516('0x23')](respondWithResult(_0x5bccfe,null))[_0xa516('0x45')](handleError(_0x5bccfe,null));};exports[_0xa516('0xa4')]=runReport;exports['query']=function(_0x3e0c50,_0x220819){var _0x1c9290=0xa;var _0x5cc70f=[_0xa516('0x56'),_0xa516('0x87'),'right_join',_0xa516('0x58')];var _0x4e70d8={'SUM':_0xa516('0x88'),'COUNT':_0xa516('0x59'),'COUNT DISTINCT':_0xa516('0x5a'),'MAX':_0xa516('0x5b'),'MIN':_0xa516('0x5c'),'AVG':_0xa516('0x5d'),'GROUP_CONCAT':_0xa516('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa516('0x89')};var _0x469bf1={'SEC_TO_TIME':_0xa516('0x60'),'DATE':_0xa516('0x61'),'HOUR':_0xa516('0x62'),'ROUND':_0xa516('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x30fcc=function(_0x505fba){return!_[_0xa516('0x65')]([_0xa516('0x66'),_0xa516('0x67'),_0xa516('0x68'),_0xa516('0x69')],_0x505fba);};var _0x32eba8=function(_0x3e8fb5){if(!_0x3e8fb5||!_0x3e8fb5[_0xa516('0x6a')]['length']){return'';}for(var _0x4c7e37='(',_0x2c956c=0x0;_0x2c956c<_0x3e8fb5['rules'][_0xa516('0x38')];_0x2c956c+=0x1){_0x2c956c>0x0&&(_0x4c7e37+='\x20'+_0x3e8fb5['operator']+'\x20');_0x4c7e37+=_0x3e8fb5[_0xa516('0x6a')][_0x2c956c][_0xa516('0x78')]?_0x32eba8(_0x3e8fb5[_0xa516('0x6a')][_0x2c956c]['group']):_0x3e8fb5[_0xa516('0x6a')][_0x2c956c][_0xa516('0x6b')]+'\x20'+_0x3e8fb5[_0xa516('0x6a')][_0x2c956c][_0xa516('0x6c')]+(_0x30fcc(_0x3e8fb5[_0xa516('0x6a')][_0x2c956c][_0xa516('0x6c')])?'\x20'+_0x3e8fb5[_0xa516('0x6a')][_0x2c956c]['value']:'');}return _0x4c7e37+')';};var _0x227238={'where':{'id':_0x3e0c50['params']['id']}},_0x2af564,_0x4721ae,_0x25a02f,_0x5476c4,_0x4ce0ae;_0x227238=_[_0xa516('0x3f')]({},_0x227238,_0x3e0c50[_0xa516('0x42')]);return db[_0xa516('0x2e')][_0xa516('0x4a')](_0x227238)['then'](function(_0x1ef523){if(_0x1ef523){_0x2af564=_0x1ef523;return _0x1ef523[_0xa516('0xa5')]();}return null;})[_0xa516('0x23')](function(_0x27b5f1){if(_0x27b5f1){if(!_0x27b5f1[_0xa516('0x38')]){throw new db['Sequelize'][(_0xa516('0x6e'))](_0xa516('0x6f'),0x193);}_0x4721ae=_0x27b5f1;return db[_0xa516('0x70')]['findAll']({'raw':!![]});}return null;})[_0xa516('0x23')](function(_0x328df8){if(_0x328df8){_0x25a02f=_['keyBy'](_0x328df8,'id');var _0x453369;var _0x203aad=squel[_0xa516('0x8c')]();_0x203aad['from'](_0x2af564[_0xa516('0x71')]);for(var _0x12eb2e=0x0;_0x12eb2e<_0x4721ae[_0xa516('0x38')];_0x12eb2e+=0x1){_0x453369=_0x4721ae[_0x12eb2e][_0xa516('0x72')]?_0x25a02f[_0x4721ae[_0x12eb2e][_0xa516('0x72')]][_0xa516('0x73')]:_0x4721ae[_0x12eb2e][_0xa516('0x6b')];_0x453369=_0x4721ae[_0x12eb2e][_0xa516('0x74')]?_['replace'](_0x4e70d8[_0x4721ae[_0x12eb2e][_0xa516('0x74')]],'%s',_0x453369):_0x453369;_0x453369=_0x4721ae[_0x12eb2e][_0xa516('0x75')]?_[_0xa516('0x76')](_0x469bf1[_0x4721ae[_0x12eb2e]['format']],'%s',_0x453369):_0x453369;if(_0x4721ae[_0x12eb2e][_0xa516('0x77')]){_0x203aad[_0xa516('0x78')](_0x453369);}_0x4721ae[_0x12eb2e][_0xa516('0x79')]&&_0x203aad[_0xa516('0x3b')](_0x453369,_0x4721ae[_0x12eb2e][_0xa516('0x79')]===_0xa516('0x7a')?![]:!![]);_0x203aad[_0xa516('0x6b')](_0x453369,_0x4721ae[_0x12eb2e][_0xa516('0x7b')]||_0x453369);}if(_0x2af564['joins']){_0x2af564[_0xa516('0x7c')]=JSON[_0xa516('0x7d')](_0x2af564[_0xa516('0x7c')]);for(var _0x3d6f9b=0x0;_0x3d6f9b<_0x2af564[_0xa516('0x7c')]['length'];_0x3d6f9b+=0x1){if(_0x2af564[_0xa516('0x7c')][_0x3d6f9b][_0xa516('0x30')]&&_['includes'](_0x5cc70f,_0x2af564[_0xa516('0x7c')][_0x3d6f9b][_0xa516('0x30')])&&_0x2af564[_0xa516('0x7c')][_0x3d6f9b]['parentKey']&&_0x2af564[_0xa516('0x7c')][_0x3d6f9b]['foreignTable']&&_0x2af564[_0xa516('0x7c')][_0x3d6f9b][_0xa516('0x7e')]){_0x203aad[_0x2af564[_0xa516('0x7c')][_0x3d6f9b][_0xa516('0x30')]](_0x2af564[_0xa516('0x7c')][_0x3d6f9b][_0xa516('0x80')],null,util[_0xa516('0x75')]('%s.%s\x20=\x20%s.%s',_0x2af564['table'],_0x2af564['joins'][_0x3d6f9b][_0xa516('0x8e')],_0x2af564[_0xa516('0x7c')][_0x3d6f9b][_0xa516('0x80')],_0x2af564[_0xa516('0x7c')][_0x3d6f9b][_0xa516('0x7e')]));}}}if(_0x2af564[_0xa516('0x81')]){_0x2af564[_0xa516('0x81')]=JSON[_0xa516('0x7d')](_0x2af564[_0xa516('0x81')]);_0x203aad[_0xa516('0x40')](_0x32eba8(_0x2af564['conditions']['group']));}_0x4ce0ae=_0x203aad['clone']();_0x203aad[_0xa516('0x1d')](_0x1c9290);_0x203aad[_0xa516('0x1b')](0x0);logger['debug'](_0xa516('0x83'),_0x203aad[_0xa516('0x84')]());return dbH['sequelize']['query'](_0x203aad['toString'](),{'type':dbH[_0xa516('0x85')]['QueryTypes'][_0xa516('0x86')]});}})[_0xa516('0x23')](function(){return{'sql':_0x4ce0ae[_0xa516('0x84')]()};})[_0xa516('0x23')](respondWithResult(_0x220819,null))[_0xa516('0x45')](handleError(_0x220819,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f41ab07..95f7a57 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 _0xa72b=['request-promise','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment'];(function(_0x40030f,_0x97cd95){var _0x31d4c5=function(_0xe9eef1){while(--_0xe9eef1){_0x40030f['push'](_0x40030f['shift']());}};_0x31d4c5(++_0x97cd95);}(_0xa72b,0xce));var _0xba72=function(_0x1f5763,_0x3ed2c8){_0x1f5763=_0x1f5763-0x0;var _0x221aa4=_0xa72b[_0x1f5763];return _0x221aa4;};'use strict';var _=require(_0xba72('0x0'));var util=require(_0xba72('0x1'));var logger=require('../../config/logger')(_0xba72('0x2'));var moment=require(_0xba72('0x3'));var BPromise=require('bluebird');var rp=require(_0xba72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba72('0x5'));var attributes=require(_0xba72('0x6'));module['exports']=function(_0x179bf3,_0x342769){return _0x179bf3[_0xba72('0x7')](_0xba72('0x8'),attributes,{'tableName':_0xba72('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x240e=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x479215,_0x575606){var _0x4608a4=function(_0x1d20f8){while(--_0x1d20f8){_0x479215['push'](_0x479215['shift']());}};_0x4608a4(++_0x575606);}(_0x240e,0x18f));var _0xe240=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x240e[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xe240('0x0'));var util=require(_0xe240('0x1'));var logger=require(_0xe240('0x2'))(_0xe240('0x3'));var moment=require(_0xe240('0x4'));var BPromise=require(_0xe240('0x5'));var rp=require(_0xe240('0x6'));var fs=require('fs');var path=require(_0xe240('0x7'));var rimraf=require(_0xe240('0x8'));var config=require(_0xe240('0x9'));var attributes=require(_0xe240('0xa'));module[_0xe240('0xb')]=function(_0x30f120,_0x1205db){return _0x30f120[_0xe240('0xc')](_0xe240('0xd'),attributes,{'tableName':_0xe240('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 3f55c0a..288ef8f 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 _0x5add=['../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4f5b11,_0x41741e){var _0x2ec258=function(_0x523247){while(--_0x523247){_0x4f5b11['push'](_0x4f5b11['shift']());}};_0x2ec258(++_0x41741e);}(_0x5add,0x1e8));var _0xd5ad=function(_0x634b8e,_0x4840e9){_0x634b8e=_0x634b8e-0x0;var _0x35f155=_0x5add[_0x634b8e];return _0x35f155;};'use strict';var _=require(_0xd5ad('0x0'));var util=require('util');var moment=require(_0xd5ad('0x1'));var BPromise=require(_0xd5ad('0x2'));var rs=require(_0xd5ad('0x3'));var fs=require('fs');var Redis=require(_0xd5ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5ad('0x5'));var logger=require(_0xd5ad('0x6'))(_0xd5ad('0x7'));var config=require('../../config/environment');var jayson=require(_0xd5ad('0x8'));var client=jayson[_0xd5ad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38f717,_0x5c33c8,_0x171f16){return new BPromise(function(_0xf3796d,_0x4903a8){return client[_0xd5ad('0xa')](_0x38f717,_0x171f16)[_0xd5ad('0xb')](function(_0x2eb269){logger[_0xd5ad('0xc')](_0xd5ad('0xd'),_0x5c33c8,_0xd5ad('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x5c33c8,_0xd5ad('0xe'),JSON[_0xd5ad('0xf')](_0x2eb269));if(_0x2eb269[_0xd5ad('0x10')]){if(_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x11')]===0x1f4){logger[_0xd5ad('0x10')](_0xd5ad('0xd'),_0x5c33c8,_0x2eb269['error']['message']);return _0x4903a8(_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x12')]);}logger[_0xd5ad('0x10')](_0xd5ad('0xd'),_0x5c33c8,_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x12')]);return _0xf3796d(_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x12')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5c33c8,_0xd5ad('0xe'));_0xf3796d(_0x2eb269['result'][_0xd5ad('0x12')]);}})['catch'](function(_0x2ca78d){logger[_0xd5ad('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5c33c8,_0x2ca78d);_0x4903a8(_0x2ca78d);});});} \ No newline at end of file +var _0x9892=['client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x1d3b9d,_0xdd459c){var _0x5caef6=function(_0x43283b){while(--_0x43283b){_0x1d3b9d['push'](_0x1d3b9d['shift']());}};_0x5caef6(++_0xdd459c);}(_0x9892,0xfd));var _0x2989=function(_0x431361,_0x7457e1){_0x431361=_0x431361-0x0;var _0x5d6f96=_0x9892[_0x431361];return _0x5d6f96;};'use strict';var _=require('lodash');var util=require(_0x2989('0x0'));var moment=require(_0x2989('0x1'));var BPromise=require(_0x2989('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2989('0x3'))['db'];var utils=require(_0x2989('0x4'));var logger=require('../../config/logger')(_0x2989('0x5'));var config=require('../../config/environment');var jayson=require(_0x2989('0x6'));var client=jayson[_0x2989('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41bd6e,_0x46228c,_0x1bfc7f){return new BPromise(function(_0x283f6a,_0x57d568){return client[_0x2989('0x8')](_0x41bd6e,_0x1bfc7f)[_0x2989('0x9')](function(_0x53156e){logger[_0x2989('0xa')](_0x2989('0xb'),_0x46228c,_0x2989('0xc'));logger[_0x2989('0xd')](_0x2989('0xe'),_0x46228c,'request\x20sent',JSON[_0x2989('0xf')](_0x53156e));if(_0x53156e[_0x2989('0x10')]){if(_0x53156e[_0x2989('0x10')][_0x2989('0x11')]===0x1f4){logger[_0x2989('0x10')](_0x2989('0xb'),_0x46228c,_0x53156e[_0x2989('0x10')]['message']);return _0x57d568(_0x53156e[_0x2989('0x10')][_0x2989('0x12')]);}logger[_0x2989('0x10')](_0x2989('0xb'),_0x46228c,_0x53156e[_0x2989('0x10')][_0x2989('0x12')]);return _0x283f6a(_0x53156e[_0x2989('0x10')][_0x2989('0x12')]);}else{logger[_0x2989('0xa')](_0x2989('0xb'),_0x46228c,_0x2989('0xc'));_0x283f6a(_0x53156e['result'][_0x2989('0x12')]);}})[_0x2989('0x13')](function(_0x45c2c6){logger['error'](_0x2989('0xb'),_0x46228c,_0x45c2c6);_0x57d568(_0x45c2c6);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index eeabd2d..f9c1f5d 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 _0xa092=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','delete','destroy'];(function(_0x1cb0dc,_0x264c1d){var _0x42db69=function(_0x503cf7){while(--_0x503cf7){_0x1cb0dc['push'](_0x1cb0dc['shift']());}};_0x42db69(++_0x264c1d);}(_0xa092,0x79));var _0x2a09=function(_0x1b1365,_0x205568){_0x1b1365=_0x1b1365-0x0;var _0x5edfd8=_0xa092[_0x1b1365];return _0x5edfd8;};'use strict';var multer=require('multer');var util=require(_0x2a09('0x0'));var path=require(_0x2a09('0x1'));var timeout=require(_0x2a09('0x2'));var express=require(_0x2a09('0x3'));var router=express[_0x2a09('0x4')]();var fs_extra=require(_0x2a09('0x5'));var auth=require(_0x2a09('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a09('0x7'));var controller=require(_0x2a09('0x8'));router[_0x2a09('0x9')]('/',auth[_0x2a09('0xa')](),controller[_0x2a09('0xb')]);router[_0x2a09('0x9')](_0x2a09('0xc'),auth[_0x2a09('0xa')](),controller[_0x2a09('0xd')]);router[_0x2a09('0x9')](_0x2a09('0xe'),auth[_0x2a09('0xa')](),controller[_0x2a09('0xf')]);router[_0x2a09('0x9')](_0x2a09('0x10'),auth[_0x2a09('0xa')](),controller[_0x2a09('0x11')]);router[_0x2a09('0x9')](_0x2a09('0x12'),auth['isAuthenticated'](),controller[_0x2a09('0x13')]);router[_0x2a09('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2a09('0xc'),auth[_0x2a09('0xa')](),controller['update']);router[_0x2a09('0x15')]('/:id',auth[_0x2a09('0xa')](),controller[_0x2a09('0x16')]);module[_0x2a09('0x17')]=router; \ No newline at end of file +var _0x7b34=['fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0x7b34,0x194));var _0x47b3=function(_0x38d78f,_0x4d4d40){_0x38d78f=_0x38d78f-0x0;var _0x13afad=_0x7b34[_0x38d78f];return _0x13afad;};'use strict';var multer=require(_0x47b3('0x0'));var util=require(_0x47b3('0x1'));var path=require(_0x47b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x47b3('0x3'));var router=express['Router']();var fs_extra=require(_0x47b3('0x4'));var auth=require(_0x47b3('0x5'));var interaction=require(_0x47b3('0x6'));var config=require('../../config/environment');var controller=require(_0x47b3('0x7'));router[_0x47b3('0x8')]('/',auth[_0x47b3('0x9')](),controller[_0x47b3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x47b3('0xb')]);router[_0x47b3('0x8')](_0x47b3('0xc'),auth[_0x47b3('0x9')](),controller['preview']);router[_0x47b3('0x8')](_0x47b3('0xd'),auth[_0x47b3('0x9')](),controller[_0x47b3('0xe')]);router[_0x47b3('0x8')](_0x47b3('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x47b3('0x10')]('/',auth[_0x47b3('0x9')](),controller[_0x47b3('0x11')]);router[_0x47b3('0x12')]('/:id',auth[_0x47b3('0x9')](),controller[_0x47b3('0x13')]);router[_0x47b3('0x14')](_0x47b3('0x15'),auth[_0x47b3('0x9')](),controller[_0x47b3('0x16')]);module[_0x47b3('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 63b5f33..31f4bab 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 _0x24ca=['sequelize','STRING','TEXT'];(function(_0x27999e,_0x1cbbd2){var _0x19498d=function(_0x2bd9ab){while(--_0x2bd9ab){_0x27999e['push'](_0x27999e['shift']());}};_0x19498d(++_0x1cbbd2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x24ca[_0x22431e];return _0xd978e9;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0x7fbe=['STRING','TEXT'];(function(_0x4421b5,_0x13d0f6){var _0x26cca3=function(_0x295016){while(--_0x295016){_0x4421b5['push'](_0x4421b5['shift']());}};_0x26cca3(++_0x13d0f6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x12e1fa,_0x2da3b8){_0x12e1fa=_0x12e1fa-0x0;var _0x498b71=_0x7fbe[_0x12e1fa];return _0x498b71;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 30db908..a3a6015 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x3d7562,_0x36eb1e){var _0x276c53=function(_0x376feb){while(--_0x376feb){_0x3d7562['push'](_0x3d7562['shift']());}};_0x276c53(++_0x36eb1e);}(_0x53ec,0x192));var _0xc53e=function(_0x641f18,_0x2919e8){_0x641f18=_0x641f18-0x0;var _0x16eefe=_0x53ec[_0x641f18];return _0x16eefe;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x4cd57d,_0x4fa3f9){var _0xb0430a=function(_0x452f0c){while(--_0x452f0c){_0x4cd57d['push'](_0x4cd57d['shift']());}};_0xb0430a(++_0x4fa3f9);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3176e2,_0x272935){_0x3176e2=_0x3176e2-0x0;var _0x4622bf=_0x3f8a[_0x3176e2];return _0x4622bf;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 599306f..f1cedd8 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 _0xe14f=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0xe14f,0x160));var _0xfe14=function(_0x517da2,_0x3be777){_0x517da2=_0x517da2-0x0;var _0x2c1acc=_0xe14f[_0x517da2];return _0x2c1acc;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var logger=require(_0xfe14('0x2'))(_0xfe14('0x3'));var moment=require(_0xfe14('0x4'));var BPromise=require('bluebird');var rp=require(_0xfe14('0x5'));var fs=require('fs');var path=require(_0xfe14('0x6'));var rimraf=require('rimraf');var config=require(_0xfe14('0x7'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0xca5420,_0x38c228){return _0xca5420[_0xfe14('0x8')](_0xfe14('0x9'),attributes,{'tableName':_0xfe14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4373=['exports','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x2bcd32,_0x225451){var _0x26b77d=function(_0x5e4548){while(--_0x5e4548){_0x2bcd32['push'](_0x2bcd32['shift']());}};_0x26b77d(++_0x225451);}(_0x4373,0x1b1));var _0x3437=function(_0x20f11f,_0x2eb43f){_0x20f11f=_0x20f11f-0x0;var _0x37afdf=_0x4373[_0x20f11f];return _0x37afdf;};'use strict';var _=require(_0x3437('0x0'));var util=require('util');var logger=require(_0x3437('0x1'))(_0x3437('0x2'));var moment=require('moment');var BPromise=require(_0x3437('0x3'));var rp=require(_0x3437('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3437('0x5'));var attributes=require(_0x3437('0x6'));module[_0x3437('0x7')]=function(_0x10f679,_0x489ec0){return _0x10f679['define'](_0x3437('0x8'),attributes,{'tableName':_0x3437('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 65e1463..c0dd936 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 _0x96d7=['http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x355103,_0x4a0357){var _0x85c59f=function(_0x4fa6ec){while(--_0x4fa6ec){_0x355103['push'](_0x355103['shift']());}};_0x85c59f(++_0x4a0357);}(_0x96d7,0x97));var _0x796d=function(_0x46e9f8,_0x890cc9){_0x46e9f8=_0x46e9f8-0x0;var _0x70660b=_0x96d7[_0x46e9f8];return _0x70660b;};'use strict';var _=require(_0x796d('0x0'));var util=require(_0x796d('0x1'));var moment=require('moment');var BPromise=require(_0x796d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x796d('0x3'));var db=require(_0x796d('0x4'))['db'];var utils=require(_0x796d('0x5'));var logger=require(_0x796d('0x6'))(_0x796d('0x7'));var config=require(_0x796d('0x8'));var jayson=require(_0x796d('0x9'));var client=jayson['client'][_0x796d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ca77,_0x4de054,_0x29d977){return new BPromise(function(_0x39cb8a,_0x176880){return client[_0x796d('0xb')](_0x33ca77,_0x29d977)[_0x796d('0xc')](function(_0x526f87){logger[_0x796d('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4de054,_0x796d('0xe'));logger[_0x796d('0xf')](_0x796d('0x10'),_0x4de054,_0x796d('0xe'),JSON[_0x796d('0x11')](_0x526f87));if(_0x526f87[_0x796d('0x12')]){if(_0x526f87[_0x796d('0x12')][_0x796d('0x13')]===0x1f4){logger[_0x796d('0x12')](_0x796d('0x14'),_0x4de054,_0x526f87[_0x796d('0x12')][_0x796d('0x15')]);return _0x176880(_0x526f87[_0x796d('0x12')]['message']);}logger[_0x796d('0x12')](_0x796d('0x14'),_0x4de054,_0x526f87[_0x796d('0x12')][_0x796d('0x15')]);return _0x39cb8a(_0x526f87[_0x796d('0x12')]['message']);}else{logger[_0x796d('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4de054,_0x796d('0xe'));_0x39cb8a(_0x526f87['result'][_0x796d('0x15')]);}})[_0x796d('0x16')](function(_0xb61624){logger[_0x796d('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4de054,_0xb61624);_0x176880(_0xb61624);});});} \ No newline at end of file +var _0xcc6f=['rpc','jayson/promise','client','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x57a53b,_0x11494e){var _0x29e81c=function(_0x24c522){while(--_0x24c522){_0x57a53b['push'](_0x57a53b['shift']());}};_0x29e81c(++_0x11494e);}(_0xcc6f,0x89));var _0xfcc6=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xcc6f[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xfcc6('0x0'));var util=require('util');var moment=require(_0xfcc6('0x1'));var BPromise=require(_0xfcc6('0x2'));var rs=require(_0xfcc6('0x3'));var fs=require('fs');var Redis=require(_0xfcc6('0x4'));var db=require(_0xfcc6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcc6('0x6'))(_0xfcc6('0x7'));var config=require('../../config/environment');var jayson=require(_0xfcc6('0x8'));var client=jayson[_0xfcc6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556ce2,_0x378bbd,_0x1750a9){return new BPromise(function(_0x2f3f7d,_0x2ce601){return client[_0xfcc6('0xa')](_0x556ce2,_0x1750a9)['then'](function(_0x178b37){logger[_0xfcc6('0xb')](_0xfcc6('0xc'),_0x378bbd,_0xfcc6('0xd'));logger[_0xfcc6('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x378bbd,_0xfcc6('0xd'),JSON['stringify'](_0x178b37));if(_0x178b37[_0xfcc6('0xf')]){if(_0x178b37[_0xfcc6('0xf')]['code']===0x1f4){logger['error'](_0xfcc6('0xc'),_0x378bbd,_0x178b37[_0xfcc6('0xf')]['message']);return _0x2ce601(_0x178b37['error']['message']);}logger[_0xfcc6('0xf')](_0xfcc6('0xc'),_0x378bbd,_0x178b37[_0xfcc6('0xf')][_0xfcc6('0x10')]);return _0x2f3f7d(_0x178b37[_0xfcc6('0xf')][_0xfcc6('0x10')]);}else{logger[_0xfcc6('0xb')](_0xfcc6('0xc'),_0x378bbd,'request\x20sent');_0x2f3f7d(_0x178b37['result'][_0xfcc6('0x10')]);}})[_0xfcc6('0x11')](function(_0xcbf166){logger[_0xfcc6('0xf')](_0xfcc6('0xc'),_0x378bbd,_0xcbf166);_0x2ce601(_0xcbf166);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4674dc6..049fe1a 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 _0x242e=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','index','get','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','/:id','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x425a95,_0x2743b6){var _0x270c10=function(_0x5a18ed){while(--_0x5a18ed){_0x425a95['push'](_0x425a95['shift']());}};_0x270c10(++_0x2743b6);}(_0x242e,0x12f));var _0xe242=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x242e[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xe242('0x0'));var util=require('util');var path=require(_0xe242('0x1'));var timeout=require(_0xe242('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe242('0x3'));var auth=require(_0xe242('0x4'));var interaction=require(_0xe242('0x5'));var config=require(_0xe242('0x6'));var controller=require(_0xe242('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe242('0x8')]);router[_0xe242('0x9')]('/:id',auth[_0xe242('0xa')](),controller[_0xe242('0xb')]);router[_0xe242('0x9')](_0xe242('0xc'),auth[_0xe242('0xa')](),controller['preview']);router[_0xe242('0x9')](_0xe242('0xd'),auth[_0xe242('0xa')](),controller[_0xe242('0xe')]);router[_0xe242('0x9')](_0xe242('0xf'),auth[_0xe242('0xa')](),controller[_0xe242('0x10')]);router['post']('/',auth[_0xe242('0xa')](),controller[_0xe242('0x11')]);router[_0xe242('0x12')](_0xe242('0x13'),auth[_0xe242('0xa')](),controller['update']);router[_0xe242('0x14')](_0xe242('0x13'),auth[_0xe242('0xa')](),controller[_0xe242('0x15')]);module['exports']=router; \ No newline at end of file +var _0x061c=['/:id/run','run','query','create','delete','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','/:id','show','get','preview'];(function(_0x327cb7,_0x4b7f1d){var _0x405388=function(_0x384b02){while(--_0x384b02){_0x327cb7['push'](_0x327cb7['shift']());}};_0x405388(++_0x4b7f1d);}(_0x061c,0x1d0));var _0xc061=function(_0x869e93,_0x189df2){_0x869e93=_0x869e93-0x0;var _0x1077ff=_0x061c[_0x869e93];return _0x1077ff;};'use strict';var multer=require('multer');var util=require(_0xc061('0x0'));var path=require('path');var timeout=require(_0xc061('0x1'));var express=require(_0xc061('0x2'));var router=express['Router']();var fs_extra=require(_0xc061('0x3'));var auth=require(_0xc061('0x4'));var interaction=require(_0xc061('0x5'));var config=require('../../config/environment');var controller=require(_0xc061('0x6'));router['get']('/',auth[_0xc061('0x7')](),controller['index']);router['get'](_0xc061('0x8'),auth['isAuthenticated'](),controller[_0xc061('0x9')]);router[_0xc061('0xa')]('/:id/preview',auth['isAuthenticated'](),controller[_0xc061('0xb')]);router[_0xc061('0xa')](_0xc061('0xc'),auth[_0xc061('0x7')](),controller[_0xc061('0xd')]);router[_0xc061('0xa')]('/:id/query',auth['isAuthenticated'](),controller[_0xc061('0xe')]);router['post']('/',auth[_0xc061('0x7')](),controller[_0xc061('0xf')]);router['put'](_0xc061('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xc061('0x10')](_0xc061('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 0126f7b..2eb8f56 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 _0xe278=['pdf','xlsx','DATE','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xe278,0x156));var _0x8e27=function(_0x4c4287,_0x3ab735){_0x4c4287=_0x4c4287-0x0;var _0x561a27=_0xe278[_0x4c4287];return _0x561a27;};'use strict';var Sequelize=require(_0x8e27('0x0'));var moment=require(_0x8e27('0x1'));module[_0x8e27('0x2')]={'name':{'type':Sequelize[_0x8e27('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8e27('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8e27('0x4')](_0x8e27('0x5'),_0x8e27('0x6'),_0x8e27('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x8e27('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8e27('0x8')]},'endDate':{'type':Sequelize[_0x8e27('0x8')]},'status':{'type':Sequelize[_0x8e27('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x8e27('0x4')](_0x8e27('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x8e27('0x9')},'reportId':{'type':Sequelize[_0x8e27('0xa')](0xb)[_0x8e27('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcfd6=['exports','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','manual','INTEGER','UNSIGNED','moment'];(function(_0x3f7b1f,_0x54880d){var _0x151f98=function(_0x3b5fd0){while(--_0x3b5fd0){_0x3f7b1f['push'](_0x3f7b1f['shift']());}};_0x151f98(++_0x54880d);}(_0xcfd6,0x12b));var _0x6cfd=function(_0x3df41b,_0x2a9150){_0x3df41b=_0x3df41b-0x0;var _0x1add52=_0xcfd6[_0x3df41b];return _0x1add52;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6cfd('0x0'));module[_0x6cfd('0x1')]={'name':{'type':Sequelize[_0x6cfd('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x6cfd('0x3'),_0x6cfd('0x4'),_0x6cfd('0x5')),'allowNull':![],'defaultValue':_0x6cfd('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x6cfd('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x6cfd('0x7')},'type':{'type':Sequelize[_0x6cfd('0x8')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x6cfd('0x9')},'reportId':{'type':Sequelize[_0x6cfd('0xa')](0xb)[_0x6cfd('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f2aecbe..8df2c1e 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 _0xb806=['path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','include','findAll','catch','show','params','keys','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x517fa8,_0x3adce0){var _0x5409f4=function(_0x501e80){while(--_0x501e80){_0x517fa8['push'](_0x517fa8['shift']());}};_0x5409f4(++_0x3adce0);}(_0xb806,0x1e7));var _0x6b80=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xb806[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0x6b80('0x0'));var rimraf=require(_0x6b80('0x1'));var zipdir=require(_0x6b80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b80('0x3'));var moment=require(_0x6b80('0x4'));var BPromise=require(_0x6b80('0x5'));var Mustache=require(_0x6b80('0x6'));var util=require(_0x6b80('0x7'));var path=require(_0x6b80('0x8'));var sox=require(_0x6b80('0x9'));var csv=require('to-csv');var ejs=require(_0x6b80('0xa'));var fs=require('fs');var fs_extra=require(_0x6b80('0xb'));var _=require('lodash');var squel=require(_0x6b80('0xc'));var crypto=require(_0x6b80('0xd'));var jsforce=require(_0x6b80('0xe'));var deskjs=require(_0x6b80('0xf'));var toCsv=require(_0x6b80('0x10'));var querystring=require(_0x6b80('0x11'));var Papa=require('papaparse');var Redis=require(_0x6b80('0x12'));var authService=require(_0x6b80('0x13'));var qs=require(_0x6b80('0x14'));var as=require(_0x6b80('0x15'));var hardwareService=require(_0x6b80('0x16'));var logger=require(_0x6b80('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6b80('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b80('0x19'))['db'];function respondWithStatusCode(_0x5d4acc,_0x24ba8b){_0x24ba8b=_0x24ba8b||0xcc;return function(_0xa2ff66){if(_0xa2ff66){return _0x5d4acc[_0x6b80('0x1a')](_0x24ba8b);}return _0x5d4acc[_0x6b80('0x1b')](_0x24ba8b)[_0x6b80('0x1c')]();};}function respondWithResult(_0x29aa5e,_0x3d0714){_0x3d0714=_0x3d0714||0xc8;return function(_0x2fbc14){if(_0x2fbc14){return _0x29aa5e[_0x6b80('0x1b')](_0x3d0714)[_0x6b80('0x1d')](_0x2fbc14);}};}function respondWithFilteredResult(_0xe7bb1c,_0x2b935f){return function(_0x520a5a){if(_0x520a5a){var _0x100504=typeof _0x2b935f[_0x6b80('0x1e')]===_0x6b80('0x1f')&&typeof _0x2b935f['limit']===_0x6b80('0x1f');var _0x1779ed=_0x520a5a[_0x6b80('0x20')];var _0x2c0bda=_0x100504?0x0:_0x2b935f['offset'];var _0x568fc0=_0x100504?_0x520a5a[_0x6b80('0x20')]:_0x2b935f[_0x6b80('0x1e')]+_0x2b935f[_0x6b80('0x21')];var _0x1b8a80;if(_0x568fc0>=_0x1779ed){_0x568fc0=_0x1779ed;_0x1b8a80=0xc8;}else{_0x1b8a80=0xce;}_0xe7bb1c[_0x6b80('0x1b')](_0x1b8a80);return _0xe7bb1c[_0x6b80('0x22')](_0x6b80('0x23'),_0x2c0bda+'-'+_0x568fc0+'/'+_0x1779ed)[_0x6b80('0x1d')](_0x520a5a);}return null;};}function patchUpdates(_0x326f10){return function(_0x409663){try{jsonpatch[_0x6b80('0x24')](_0x409663,_0x326f10,!![]);}catch(_0x103f62){return BPromise[_0x6b80('0x25')](_0x103f62);}return _0x409663[_0x6b80('0x26')]();};}function saveUpdates(_0x2d0086,_0x4b31a4){return function(_0x12045c){if(_0x12045c){return _0x12045c[_0x6b80('0x27')](_0x2d0086)[_0x6b80('0x28')](function(_0x4eae3a){return _0x4eae3a;});}return null;};}function removeEntity(_0x50637e,_0x46e3a0){return function(_0x47d59e){if(_0x47d59e){return _0x47d59e[_0x6b80('0x29')]()[_0x6b80('0x28')](function(){var _0x21b694=_0x47d59e[_0x6b80('0x2a')]({'plain':!![]});var _0x3f85df=_0x6b80('0x2b');return db[_0x6b80('0x2c')]['destroy']({'where':{'type':_0x3f85df,'resourceId':_0x21b694['id']}})[_0x6b80('0x28')](function(){return _0x47d59e;});})[_0x6b80('0x28')](function(){_0x50637e['status'](0xcc)[_0x6b80('0x1c')]();});}};}function handleEntityNotFound(_0x1e066d,_0x21f2ee){return function(_0x471809){if(!_0x471809){_0x1e066d[_0x6b80('0x1a')](0x194);}return _0x471809;};}function handleError(_0x5aa160,_0x41d737){_0x41d737=_0x41d737||0x1f4;return function(_0x3d6724){logger[_0x6b80('0x2d')](_0x3d6724[_0x6b80('0x2e')]);if(_0x3d6724[_0x6b80('0x2f')]){delete _0x3d6724[_0x6b80('0x2f')];}_0x5aa160[_0x6b80('0x1b')](_0x41d737)[_0x6b80('0x30')](_0x3d6724);};}exports['index']=function(_0x3932c7,_0x2e4859){var _0x4364b5={},_0x2f205b={},_0x4785ed={'count':0x0,'rows':[]};var _0x18143d=_[_0x6b80('0x31')](db['AnalyticExtractedReport'][_0x6b80('0x32')],function(_0x275a6f){return{'name':_0x275a6f[_0x6b80('0x33')],'type':_0x275a6f[_0x6b80('0x34')]['key']};});_0x2f205b['model']=_[_0x6b80('0x31')](_0x18143d,_0x6b80('0x2f'));_0x2f205b[_0x6b80('0x35')]=_['keys'](_0x3932c7[_0x6b80('0x35')]);_0x2f205b[_0x6b80('0x36')]=_[_0x6b80('0x37')](_0x2f205b[_0x6b80('0x38')],_0x2f205b[_0x6b80('0x35')]);_0x4364b5[_0x6b80('0x39')]=_['intersection'](_0x2f205b[_0x6b80('0x38')],qs[_0x6b80('0x3a')](_0x3932c7['query']['fields']));_0x4364b5[_0x6b80('0x39')]=_0x4364b5[_0x6b80('0x39')]['length']?_0x4364b5[_0x6b80('0x39')]:_0x2f205b[_0x6b80('0x38')];if(!_0x3932c7[_0x6b80('0x35')][_0x6b80('0x3b')](_0x6b80('0x3c'))){_0x4364b5[_0x6b80('0x21')]=qs[_0x6b80('0x21')](_0x3932c7[_0x6b80('0x35')]['limit']);_0x4364b5[_0x6b80('0x1e')]=qs[_0x6b80('0x1e')](_0x3932c7[_0x6b80('0x35')][_0x6b80('0x1e')]);}_0x4364b5[_0x6b80('0x3d')]=qs['sort'](_0x3932c7['query'][_0x6b80('0x3e')]);_0x4364b5[_0x6b80('0x3f')]=qs[_0x6b80('0x36')](_[_0x6b80('0x40')](_0x3932c7[_0x6b80('0x35')],_0x2f205b[_0x6b80('0x36')]),_0x18143d);if(_0x3932c7[_0x6b80('0x35')][_0x6b80('0x41')]){_0x4364b5[_0x6b80('0x3f')]=_[_0x6b80('0x42')](_0x4364b5[_0x6b80('0x3f')],{'$or':_['map'](_0x18143d,function(_0x27b768){if(_0x27b768[_0x6b80('0x34')]!==_0x6b80('0x43')){var _0x2d82bb={};_0x2d82bb[_0x27b768[_0x6b80('0x2f')]]={'$like':'%'+_0x3932c7[_0x6b80('0x35')][_0x6b80('0x41')]+'%'};return _0x2d82bb;}})});}_0x4364b5=_[_0x6b80('0x42')]({},_0x4364b5,_0x3932c7[_0x6b80('0x44')]);var _0x631fc0={'where':_0x4364b5['where']};return db[_0x6b80('0x45')][_0x6b80('0x20')](_0x631fc0)[_0x6b80('0x28')](function(_0x1065da){_0x4785ed[_0x6b80('0x20')]=_0x1065da;if(_0x3932c7[_0x6b80('0x35')]['includeAll']){_0x4364b5[_0x6b80('0x46')]=[{'all':!![]}];}return db[_0x6b80('0x45')][_0x6b80('0x47')](_0x4364b5);})[_0x6b80('0x28')](function(_0x435471){_0x4785ed['rows']=_0x435471;return _0x4785ed;})[_0x6b80('0x28')](respondWithFilteredResult(_0x2e4859,_0x4364b5))[_0x6b80('0x48')](handleError(_0x2e4859,null));};exports[_0x6b80('0x49')]=function(_0x58e11f,_0x1e1cb0){var _0x777d11={'raw':!![],'where':{'id':_0x58e11f[_0x6b80('0x4a')]['id']}},_0x47894b={};_0x47894b[_0x6b80('0x38')]=_['keys'](db[_0x6b80('0x45')]['rawAttributes']);_0x47894b['query']=_[_0x6b80('0x4b')](_0x58e11f[_0x6b80('0x35')]);_0x47894b[_0x6b80('0x36')]=_['intersection'](_0x47894b[_0x6b80('0x38')],_0x47894b[_0x6b80('0x35')]);_0x777d11[_0x6b80('0x39')]=_[_0x6b80('0x37')](_0x47894b[_0x6b80('0x38')],qs[_0x6b80('0x3a')](_0x58e11f[_0x6b80('0x35')][_0x6b80('0x3a')]));_0x777d11[_0x6b80('0x39')]=_0x777d11[_0x6b80('0x39')][_0x6b80('0x4c')]?_0x777d11[_0x6b80('0x39')]:_0x47894b['model'];if(_0x58e11f[_0x6b80('0x35')][_0x6b80('0x4d')]){_0x777d11[_0x6b80('0x46')]=[{'all':!![]}];}_0x777d11=_[_0x6b80('0x42')]({},_0x777d11,_0x58e11f[_0x6b80('0x44')]);return db['AnalyticExtractedReport'][_0x6b80('0x4e')](_0x777d11)[_0x6b80('0x28')](handleEntityNotFound(_0x1e1cb0,null))[_0x6b80('0x28')](respondWithResult(_0x1e1cb0,null))[_0x6b80('0x48')](handleError(_0x1e1cb0,null));};exports[_0x6b80('0x4f')]=function(_0x1dba91,_0x1ee506){return db[_0x6b80('0x45')][_0x6b80('0x4f')](_0x1dba91['body'],{})[_0x6b80('0x28')](function(_0x40069b){var _0x12e10c=_0x1dba91[_0x6b80('0x50')][_0x6b80('0x2a')]({'plain':!![]});if(!_0x12e10c)throw new Error(_0x6b80('0x51'));if(_0x12e10c['role']===_0x6b80('0x50')){var _0x5edd98=_0x40069b[_0x6b80('0x2a')]({'plain':!![]});var _0x236c81=_0x6b80('0x2b');return db[_0x6b80('0x52')][_0x6b80('0x4e')]({'where':{'name':_0x236c81,'userProfileId':_0x12e10c[_0x6b80('0x53')]},'raw':!![]})[_0x6b80('0x28')](function(_0x4aa8b1){if(_0x4aa8b1&&_0x4aa8b1[_0x6b80('0x54')]===0x0){return db[_0x6b80('0x2c')][_0x6b80('0x4f')]({'name':_0x5edd98[_0x6b80('0x2f')],'resourceId':_0x5edd98['id'],'type':_0x4aa8b1[_0x6b80('0x2f')],'sectionId':_0x4aa8b1['id']},{})['then'](function(){return _0x40069b;});}else{return _0x40069b;}})['catch'](function(_0x162399){logger['error'](_0x6b80('0x55'),_0x162399);throw _0x162399;});}return _0x40069b;})[_0x6b80('0x28')](respondWithResult(_0x1ee506,0xc9))[_0x6b80('0x48')](handleError(_0x1ee506,null));};exports[_0x6b80('0x27')]=function(_0x55f499,_0x391405){if(_0x55f499[_0x6b80('0x56')]['id']){delete _0x55f499[_0x6b80('0x56')]['id'];}return db[_0x6b80('0x45')]['find']({'where':{'id':_0x55f499[_0x6b80('0x4a')]['id']}})[_0x6b80('0x28')](handleEntityNotFound(_0x391405,null))['then'](saveUpdates(_0x55f499[_0x6b80('0x56')],null))[_0x6b80('0x28')](respondWithResult(_0x391405,null))[_0x6b80('0x48')](handleError(_0x391405,null));};exports['destroy']=function(_0x3f19ea,_0x36ac28){return db[_0x6b80('0x45')][_0x6b80('0x4e')]({'where':{'id':_0x3f19ea[_0x6b80('0x4a')]['id']}})['then'](handleEntityNotFound(_0x36ac28,null))[_0x6b80('0x28')](removeEntity(_0x36ac28,null))[_0x6b80('0x48')](handleError(_0x36ac28,null));};exports['download']=function(_0xa9806b,_0x27ad1d,_0x3b43d8){return db[_0x6b80('0x45')][_0x6b80('0x4e')]({'where':{'id':_0xa9806b[_0x6b80('0x4a')]['id']},'attributes':['name',_0x6b80('0x57'),_0x6b80('0x58'),_0x6b80('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x27ad1d,null))[_0x6b80('0x28')](function(_0x413c9b){if(_0x413c9b){if(!fs['existsSync'](path[_0x6b80('0x5a')](config[_0x6b80('0x5b')],_0x6b80('0x5c'),_0x413c9b['savename']))){throw new db[(_0x6b80('0x5d'))][(_0x6b80('0x5e'))](_0x6b80('0x5f'));}if(_0xa9806b[_0x6b80('0x35')][_0x6b80('0x60')]){return _0x27ad1d['sendStatus'](0xc8);}return _0x27ad1d['download'](path[_0x6b80('0x5a')](config[_0x6b80('0x5b')],_0x6b80('0x5c'),_0x413c9b['savename']),util['format'](_0x6b80('0x61'),_0x413c9b['basename']||_0x413c9b[_0x6b80('0x2f')],_0x413c9b[_0x6b80('0x59')][_0x6b80('0x62')]()));}})[_0x6b80('0x48')](handleError(_0x27ad1d,null));}; \ No newline at end of file +var _0xed14=['exists','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','offset','Content-Range','json','apply','reject','then','ExtractedReports','UserProfileResource','destroy','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','catch','show','params','include','find','create','body','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xed14,0x179));var _0x4ed1=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xed14[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x4ed1('0x0'));var rimraf=require(_0x4ed1('0x1'));var zipdir=require(_0x4ed1('0x2'));var jsonpatch=require(_0x4ed1('0x3'));var rp=require(_0x4ed1('0x4'));var moment=require(_0x4ed1('0x5'));var BPromise=require(_0x4ed1('0x6'));var Mustache=require(_0x4ed1('0x7'));var util=require(_0x4ed1('0x8'));var path=require(_0x4ed1('0x9'));var sox=require(_0x4ed1('0xa'));var csv=require(_0x4ed1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ed1('0xc'));var _=require(_0x4ed1('0xd'));var squel=require(_0x4ed1('0xe'));var crypto=require(_0x4ed1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4ed1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4ed1('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4ed1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ed1('0x13'))('api');var utils=require(_0x4ed1('0x14'));var config=require(_0x4ed1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5adc,_0x5438f9){_0x5438f9=_0x5438f9||0xcc;return function(_0x4066d2){if(_0x4066d2){return _0x1e5adc[_0x4ed1('0x16')](_0x5438f9);}return _0x1e5adc[_0x4ed1('0x17')](_0x5438f9)[_0x4ed1('0x18')]();};}function respondWithResult(_0x421184,_0x2bdc06){_0x2bdc06=_0x2bdc06||0xc8;return function(_0x5c7a35){if(_0x5c7a35){return _0x421184[_0x4ed1('0x17')](_0x2bdc06)['json'](_0x5c7a35);}};}function respondWithFilteredResult(_0x19f025,_0x355fe9){return function(_0x455f64){if(_0x455f64){var _0x15a605=typeof _0x355fe9['offset']===_0x4ed1('0x19')&&typeof _0x355fe9[_0x4ed1('0x1a')]===_0x4ed1('0x19');var _0x27b7eb=_0x455f64['count'];var _0x38750a=_0x15a605?0x0:_0x355fe9['offset'];var _0x52a746=_0x15a605?_0x455f64['count']:_0x355fe9[_0x4ed1('0x1b')]+_0x355fe9[_0x4ed1('0x1a')];var _0x1ddc96;if(_0x52a746>=_0x27b7eb){_0x52a746=_0x27b7eb;_0x1ddc96=0xc8;}else{_0x1ddc96=0xce;}_0x19f025[_0x4ed1('0x17')](_0x1ddc96);return _0x19f025['set'](_0x4ed1('0x1c'),_0x38750a+'-'+_0x52a746+'/'+_0x27b7eb)[_0x4ed1('0x1d')](_0x455f64);}return null;};}function patchUpdates(_0x225f04){return function(_0x27fac6){try{jsonpatch[_0x4ed1('0x1e')](_0x27fac6,_0x225f04,!![]);}catch(_0x4df3ee){return BPromise[_0x4ed1('0x1f')](_0x4df3ee);}return _0x27fac6['save']();};}function saveUpdates(_0x2b7247,_0x126ad4){return function(_0x2ad172){if(_0x2ad172){return _0x2ad172['update'](_0x2b7247)[_0x4ed1('0x20')](function(_0x281cfa){return _0x281cfa;});}return null;};}function removeEntity(_0xdc9bc7,_0x364418){return function(_0x2de3b9){if(_0x2de3b9){return _0x2de3b9['destroy']()[_0x4ed1('0x20')](function(){var _0x445a41=_0x2de3b9['get']({'plain':!![]});var _0x4e5a7c=_0x4ed1('0x21');return db[_0x4ed1('0x22')][_0x4ed1('0x23')]({'where':{'type':_0x4e5a7c,'resourceId':_0x445a41['id']}})['then'](function(){return _0x2de3b9;});})[_0x4ed1('0x20')](function(){_0xdc9bc7[_0x4ed1('0x17')](0xcc)[_0x4ed1('0x18')]();});}};}function handleEntityNotFound(_0xf5cbb1,_0x523ada){return function(_0x155ef8){if(!_0x155ef8){_0xf5cbb1[_0x4ed1('0x16')](0x194);}return _0x155ef8;};}function handleError(_0x32eca1,_0x38172c){_0x38172c=_0x38172c||0x1f4;return function(_0x52557a){logger['error'](_0x52557a[_0x4ed1('0x24')]);if(_0x52557a['name']){delete _0x52557a[_0x4ed1('0x25')];}_0x32eca1['status'](_0x38172c)[_0x4ed1('0x26')](_0x52557a);};}exports[_0x4ed1('0x27')]=function(_0x2fcbd8,_0x2b06c0){var _0x577312={},_0x1e50e5={},_0x22c875={'count':0x0,'rows':[]};var _0x2126d1=_[_0x4ed1('0x28')](db[_0x4ed1('0x29')][_0x4ed1('0x2a')],function(_0x8a754c){return{'name':_0x8a754c[_0x4ed1('0x2b')],'type':_0x8a754c[_0x4ed1('0x2c')][_0x4ed1('0x2d')]};});_0x1e50e5['model']=_[_0x4ed1('0x28')](_0x2126d1,_0x4ed1('0x25'));_0x1e50e5['query']=_[_0x4ed1('0x2e')](_0x2fcbd8[_0x4ed1('0x2f')]);_0x1e50e5[_0x4ed1('0x30')]=_['intersection'](_0x1e50e5[_0x4ed1('0x31')],_0x1e50e5['query']);_0x577312[_0x4ed1('0x32')]=_[_0x4ed1('0x33')](_0x1e50e5[_0x4ed1('0x31')],qs[_0x4ed1('0x34')](_0x2fcbd8[_0x4ed1('0x2f')][_0x4ed1('0x34')]));_0x577312[_0x4ed1('0x32')]=_0x577312['attributes'][_0x4ed1('0x35')]?_0x577312[_0x4ed1('0x32')]:_0x1e50e5['model'];if(!_0x2fcbd8[_0x4ed1('0x2f')]['hasOwnProperty'](_0x4ed1('0x36'))){_0x577312['limit']=qs['limit'](_0x2fcbd8['query']['limit']);_0x577312[_0x4ed1('0x1b')]=qs[_0x4ed1('0x1b')](_0x2fcbd8[_0x4ed1('0x2f')][_0x4ed1('0x1b')]);}_0x577312[_0x4ed1('0x37')]=qs[_0x4ed1('0x38')](_0x2fcbd8[_0x4ed1('0x2f')][_0x4ed1('0x38')]);_0x577312[_0x4ed1('0x39')]=qs[_0x4ed1('0x30')](_[_0x4ed1('0x3a')](_0x2fcbd8['query'],_0x1e50e5[_0x4ed1('0x30')]),_0x2126d1);if(_0x2fcbd8[_0x4ed1('0x2f')]['filter']){_0x577312[_0x4ed1('0x39')]=_['merge'](_0x577312[_0x4ed1('0x39')],{'$or':_['map'](_0x2126d1,function(_0x345df5){if(_0x345df5['type']!=='VIRTUAL'){var _0x34358a={};_0x34358a[_0x345df5[_0x4ed1('0x25')]]={'$like':'%'+_0x2fcbd8['query'][_0x4ed1('0x3b')]+'%'};return _0x34358a;}})});}_0x577312=_[_0x4ed1('0x3c')]({},_0x577312,_0x2fcbd8[_0x4ed1('0x3d')]);var _0x554ba6={'where':_0x577312[_0x4ed1('0x39')]};return db[_0x4ed1('0x29')]['count'](_0x554ba6)['then'](function(_0x344186){_0x22c875[_0x4ed1('0x3e')]=_0x344186;if(_0x2fcbd8['query'][_0x4ed1('0x3f')]){_0x577312['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x4ed1('0x40')](_0x577312);})[_0x4ed1('0x20')](function(_0x408352){_0x22c875['rows']=_0x408352;return _0x22c875;})[_0x4ed1('0x20')](respondWithFilteredResult(_0x2b06c0,_0x577312))[_0x4ed1('0x41')](handleError(_0x2b06c0,null));};exports[_0x4ed1('0x42')]=function(_0x549435,_0xb80d39){var _0x2c2c79={'raw':!![],'where':{'id':_0x549435[_0x4ed1('0x43')]['id']}},_0x1022ff={};_0x1022ff['model']=_[_0x4ed1('0x2e')](db['AnalyticExtractedReport'][_0x4ed1('0x2a')]);_0x1022ff[_0x4ed1('0x2f')]=_[_0x4ed1('0x2e')](_0x549435[_0x4ed1('0x2f')]);_0x1022ff[_0x4ed1('0x30')]=_[_0x4ed1('0x33')](_0x1022ff[_0x4ed1('0x31')],_0x1022ff['query']);_0x2c2c79[_0x4ed1('0x32')]=_['intersection'](_0x1022ff[_0x4ed1('0x31')],qs['fields'](_0x549435[_0x4ed1('0x2f')]['fields']));_0x2c2c79[_0x4ed1('0x32')]=_0x2c2c79[_0x4ed1('0x32')][_0x4ed1('0x35')]?_0x2c2c79[_0x4ed1('0x32')]:_0x1022ff[_0x4ed1('0x31')];if(_0x549435[_0x4ed1('0x2f')]['includeAll']){_0x2c2c79[_0x4ed1('0x44')]=[{'all':!![]}];}_0x2c2c79=_['merge']({},_0x2c2c79,_0x549435[_0x4ed1('0x3d')]);return db['AnalyticExtractedReport'][_0x4ed1('0x45')](_0x2c2c79)[_0x4ed1('0x20')](handleEntityNotFound(_0xb80d39,null))[_0x4ed1('0x20')](respondWithResult(_0xb80d39,null))[_0x4ed1('0x41')](handleError(_0xb80d39,null));};exports[_0x4ed1('0x46')]=function(_0x26c441,_0xede30){return db[_0x4ed1('0x29')][_0x4ed1('0x46')](_0x26c441[_0x4ed1('0x47')],{})['then'](function(_0x369930){var _0x3cb159=_0x26c441['user'][_0x4ed1('0x48')]({'plain':!![]});if(!_0x3cb159)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cb159[_0x4ed1('0x49')]==='user'){var _0x3094af=_0x369930[_0x4ed1('0x48')]({'plain':!![]});var _0x29672a=_0x4ed1('0x21');return db['UserProfileSection'][_0x4ed1('0x45')]({'where':{'name':_0x29672a,'userProfileId':_0x3cb159[_0x4ed1('0x4a')]},'raw':!![]})[_0x4ed1('0x20')](function(_0x15aa86){if(_0x15aa86&&_0x15aa86[_0x4ed1('0x4b')]===0x0){return db[_0x4ed1('0x22')]['create']({'name':_0x3094af['name'],'resourceId':_0x3094af['id'],'type':_0x15aa86[_0x4ed1('0x25')],'sectionId':_0x15aa86['id']},{})[_0x4ed1('0x20')](function(){return _0x369930;});}else{return _0x369930;}})[_0x4ed1('0x41')](function(_0x1a8210){logger[_0x4ed1('0x4c')](_0x4ed1('0x4d'),_0x1a8210);throw _0x1a8210;});}return _0x369930;})[_0x4ed1('0x20')](respondWithResult(_0xede30,0xc9))[_0x4ed1('0x41')](handleError(_0xede30,null));};exports[_0x4ed1('0x4e')]=function(_0x24358e,_0x21fd36){if(_0x24358e[_0x4ed1('0x47')]['id']){delete _0x24358e['body']['id'];}return db[_0x4ed1('0x29')]['find']({'where':{'id':_0x24358e[_0x4ed1('0x43')]['id']}})[_0x4ed1('0x20')](handleEntityNotFound(_0x21fd36,null))[_0x4ed1('0x20')](saveUpdates(_0x24358e[_0x4ed1('0x47')],null))[_0x4ed1('0x20')](respondWithResult(_0x21fd36,null))[_0x4ed1('0x41')](handleError(_0x21fd36,null));};exports[_0x4ed1('0x23')]=function(_0x108836,_0x3e8b09){return db[_0x4ed1('0x29')][_0x4ed1('0x45')]({'where':{'id':_0x108836[_0x4ed1('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e8b09,null))[_0x4ed1('0x20')](removeEntity(_0x3e8b09,null))[_0x4ed1('0x41')](handleError(_0x3e8b09,null));};exports[_0x4ed1('0x4f')]=function(_0x38b09b,_0x34153c,_0x3f9270){return db[_0x4ed1('0x29')][_0x4ed1('0x45')]({'where':{'id':_0x38b09b[_0x4ed1('0x43')]['id']},'attributes':[_0x4ed1('0x25'),_0x4ed1('0x50'),_0x4ed1('0x51'),'output'],'raw':!![]})[_0x4ed1('0x20')](handleEntityNotFound(_0x34153c,null))[_0x4ed1('0x20')](function(_0x3aad30){if(_0x3aad30){if(!fs[_0x4ed1('0x52')](path[_0x4ed1('0x53')](config[_0x4ed1('0x54')],'server/files/reports',_0x3aad30[_0x4ed1('0x51')]))){throw new db[(_0x4ed1('0x55'))][(_0x4ed1('0x56'))](_0x4ed1('0x57'));}if(_0x38b09b[_0x4ed1('0x2f')][_0x4ed1('0x58')]){return _0x34153c['sendStatus'](0xc8);}return _0x34153c[_0x4ed1('0x4f')](path[_0x4ed1('0x53')](config[_0x4ed1('0x54')],'server/files/reports',_0x3aad30[_0x4ed1('0x51')]),util[_0x4ed1('0x59')](_0x4ed1('0x5a'),_0x3aad30[_0x4ed1('0x50')]||_0x3aad30['name'],_0x3aad30[_0x4ed1('0x5b')][_0x4ed1('0x5c')]()));}})['catch'](handleError(_0x34153c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c680b5f..20bbde4 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 _0xcb57=['api','moment','path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0xcb57,0x148));var _0x7cb5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xcb57[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7cb5('0x0'));var util=require('util');var logger=require(_0x7cb5('0x1'))(_0x7cb5('0x2'));var moment=require(_0x7cb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cb5('0x4'));var rimraf=require(_0x7cb5('0x5'));var config=require('../../config/environment');var attributes=require(_0x7cb5('0x6'));module[_0x7cb5('0x7')]=function(_0x145556,_0x364005){return _0x145556[_0x7cb5('0x8')](_0x7cb5('0x9'),attributes,{'tableName':_0x7cb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2767=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','../../config/logger','api','moment','request-promise'];(function(_0x283365,_0x704c4d){var _0x178caf=function(_0x165e54){while(--_0x165e54){_0x283365['push'](_0x283365['shift']());}};_0x178caf(++_0x704c4d);}(_0x2767,0x16f));var _0x7276=function(_0x44fc24,_0xdbbe3f){_0x44fc24=_0x44fc24-0x0;var _0x8f9756=_0x2767[_0x44fc24];return _0x8f9756;};'use strict';var _=require(_0x7276('0x0'));var util=require('util');var logger=require(_0x7276('0x1'))(_0x7276('0x2'));var moment=require(_0x7276('0x3'));var BPromise=require('bluebird');var rp=require(_0x7276('0x4'));var fs=require('fs');var path=require(_0x7276('0x5'));var rimraf=require(_0x7276('0x6'));var config=require(_0x7276('0x7'));var attributes=require(_0x7276('0x8'));module[_0x7276('0x9')]=function(_0xf8b21c,_0x5edaf3){return _0xf8b21c[_0x7276('0xa')](_0x7276('0xb'),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 bd2c982..eb4a3f6 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 _0x61c7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x51ee4b,_0x1a1bed){var _0x57904d=function(_0x34602){while(--_0x34602){_0x51ee4b['push'](_0x51ee4b['shift']());}};_0x57904d(++_0x1a1bed);}(_0x61c7,0x127));var _0x761c=function(_0x2edb70,_0x12a185){_0x2edb70=_0x2edb70-0x0;var _0x36ebd4=_0x61c7[_0x2edb70];return _0x36ebd4;};'use strict';var _=require(_0x761c('0x0'));var util=require(_0x761c('0x1'));var moment=require(_0x761c('0x2'));var BPromise=require(_0x761c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x761c('0x4'));var db=require(_0x761c('0x5'))['db'];var utils=require(_0x761c('0x6'));var logger=require(_0x761c('0x7'))(_0x761c('0x8'));var config=require(_0x761c('0x9'));var jayson=require(_0x761c('0xa'));var client=jayson[_0x761c('0xb')][_0x761c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12db27,_0x46d11e,_0x534de7){return new BPromise(function(_0x3211b7,_0x399d57){return client[_0x761c('0xd')](_0x12db27,_0x534de7)['then'](function(_0x47f1f6){logger[_0x761c('0xe')](_0x761c('0xf'),_0x46d11e,'request\x20sent');logger[_0x761c('0x10')](_0x761c('0x11'),_0x46d11e,_0x761c('0x12'),JSON[_0x761c('0x13')](_0x47f1f6));if(_0x47f1f6[_0x761c('0x14')]){if(_0x47f1f6[_0x761c('0x14')][_0x761c('0x15')]===0x1f4){logger[_0x761c('0x14')](_0x761c('0xf'),_0x46d11e,_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);return _0x399d57(_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);}logger[_0x761c('0x14')](_0x761c('0xf'),_0x46d11e,_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);return _0x3211b7(_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);}else{logger[_0x761c('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x46d11e,'request\x20sent');_0x3211b7(_0x47f1f6['result'][_0x761c('0x16')]);}})['catch'](function(_0x3e19ed){logger['error'](_0x761c('0xf'),_0x46d11e,_0x3e19ed);_0x399d57(_0x3e19ed);});});} \ No newline at end of file +var _0x8d41=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x30352d,_0x4b4384){var _0x44e00a=function(_0x502aac){while(--_0x502aac){_0x30352d['push'](_0x30352d['shift']());}};_0x44e00a(++_0x4b4384);}(_0x8d41,0x12c));var _0x18d4=function(_0x477491,_0x5ca700){_0x477491=_0x477491-0x0;var _0xac6aec=_0x8d41[_0x477491];return _0xac6aec;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var moment=require(_0x18d4('0x2'));var BPromise=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var fs=require('fs');var Redis=require(_0x18d4('0x5'));var db=require(_0x18d4('0x6'))['db'];var utils=require(_0x18d4('0x7'));var logger=require(_0x18d4('0x8'))(_0x18d4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x18d4('0xa')][_0x18d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20275f,_0x1e1961,_0x81d9bf){return new BPromise(function(_0x1b0f97,_0x108508){return client[_0x18d4('0xc')](_0x20275f,_0x81d9bf)['then'](function(_0x3d3876){logger['info'](_0x18d4('0xd'),_0x1e1961,'request\x20sent');logger[_0x18d4('0xe')](_0x18d4('0xf'),_0x1e1961,'request\x20sent',JSON['stringify'](_0x3d3876));if(_0x3d3876['error']){if(_0x3d3876[_0x18d4('0x10')][_0x18d4('0x11')]===0x1f4){logger[_0x18d4('0x10')](_0x18d4('0xd'),_0x1e1961,_0x3d3876[_0x18d4('0x10')][_0x18d4('0x12')]);return _0x108508(_0x3d3876['error'][_0x18d4('0x12')]);}logger[_0x18d4('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e1961,_0x3d3876[_0x18d4('0x10')]['message']);return _0x1b0f97(_0x3d3876['error'][_0x18d4('0x12')]);}else{logger[_0x18d4('0x13')](_0x18d4('0xd'),_0x1e1961,'request\x20sent');_0x1b0f97(_0x3d3876['result'][_0x18d4('0x12')]);}})['catch'](function(_0x596e52){logger['error'](_0x18d4('0xd'),_0x1e1961,_0x596e52);_0x108508(_0x596e52);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d7989c8..7195926 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 _0x6880=['index','/:id','show','get','/:id/download','download','post','create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated'];(function(_0x2bb5b3,_0x29373f){var _0x1e0d91=function(_0x5bcb7d){while(--_0x5bcb7d){_0x2bb5b3['push'](_0x2bb5b3['shift']());}};_0x1e0d91(++_0x29373f);}(_0x6880,0x8a));var _0x0688=function(_0x5adc07,_0x326d9e){_0x5adc07=_0x5adc07-0x0;var _0x4e677e=_0x6880[_0x5adc07];return _0x4e677e;};'use strict';var multer=require('multer');var util=require(_0x0688('0x0'));var path=require(_0x0688('0x1'));var timeout=require(_0x0688('0x2'));var express=require(_0x0688('0x3'));var router=express['Router']();var fs_extra=require(_0x0688('0x4'));var auth=require(_0x0688('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0688('0x6'));var controller=require(_0x0688('0x7'));router['get']('/',auth[_0x0688('0x8')](),controller[_0x0688('0x9')]);router['get'](_0x0688('0xa'),auth['isAuthenticated'](),controller[_0x0688('0xb')]);router[_0x0688('0xc')](_0x0688('0xd'),auth['isAuthenticated'](),controller[_0x0688('0xe')]);router[_0x0688('0xf')]('/',auth['isAuthenticated'](),controller[_0x0688('0x10')]);router[_0x0688('0x11')](_0x0688('0xa'),auth['isAuthenticated'](),controller[_0x0688('0x12')]);router['delete'](_0x0688('0xa'),auth['isAuthenticated'](),controller[_0x0688('0x13')]);module[_0x0688('0x14')]=router; \ No newline at end of file +var _0x8c13=['update','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','download','post','create'];(function(_0x5f2acc,_0x47fcfd){var _0x1ec79c=function(_0xe1d16b){while(--_0xe1d16b){_0x5f2acc['push'](_0x5f2acc['shift']());}};_0x1ec79c(++_0x47fcfd);}(_0x8c13,0x1b2));var _0x38c1=function(_0x2d3edb,_0x152d90){_0x2d3edb=_0x2d3edb-0x0;var _0x5d0722=_0x8c13[_0x2d3edb];return _0x5d0722;};'use strict';var multer=require(_0x38c1('0x0'));var util=require(_0x38c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x38c1('0x2'));var router=express['Router']();var fs_extra=require(_0x38c1('0x3'));var auth=require(_0x38c1('0x4'));var interaction=require(_0x38c1('0x5'));var config=require(_0x38c1('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x38c1('0x7')]('/',auth[_0x38c1('0x8')](),controller[_0x38c1('0x9')]);router[_0x38c1('0x7')](_0x38c1('0xa'),auth[_0x38c1('0x8')](),controller['show']);router[_0x38c1('0x7')]('/:id/download',auth[_0x38c1('0x8')](),controller[_0x38c1('0xb')]);router[_0x38c1('0xc')]('/',auth[_0x38c1('0x8')](),controller[_0x38c1('0xd')]);router['put'](_0x38c1('0xa'),auth['isAuthenticated'](),controller[_0x38c1('0xe')]);router['delete'](_0x38c1('0xa'),auth[_0x38c1('0x8')](),controller[_0x38c1('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9b783ad..1e9943a 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 _0xd560=['BOOLEAN','STRING'];(function(_0x5a7242,_0x5bc9e7){var _0x15d862=function(_0x30ea0a){while(--_0x30ea0a){_0x5a7242['push'](_0x5a7242['shift']());}};_0x15d862(++_0x5bc9e7);}(_0xd560,0x69));var _0x0d56=function(_0x34105a,_0xb17783){_0x34105a=_0x34105a-0x0;var _0x3c53f9=_0xd560[_0x34105a];return _0x3c53f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x0d56('0x0')]},'function':{'type':Sequelize[_0x0d56('0x0')]},'format':{'type':Sequelize[_0x0d56('0x0')]},'groupBy':{'type':Sequelize[_0x0d56('0x1')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x0d56('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xb093=['exports','STRING','BOOLEAN'];(function(_0x1b5966,_0x4aaf1a){var _0x47b1a1=function(_0x279d99){while(--_0x279d99){_0x1b5966['push'](_0x1b5966['shift']());}};_0x47b1a1(++_0x4aaf1a);}(_0xb093,0x135));var _0x3b09=function(_0x3cba26,_0x10e31){_0x3cba26=_0x3cba26-0x0;var _0x36f3a8=_0xb093[_0x3cba26];return _0x36f3a8;};'use strict';var Sequelize=require('sequelize');module[_0x3b09('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x3b09('0x1')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x3b09('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3b09('0x1')]},'custom':{'type':Sequelize[_0x3b09('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ba30db7..2f1cb41 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 _0x5d6c=['mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','filter','merge','VIRTUAL','options','where','AnalyticFieldReport','include','findAll','rows','show','params','length','find','catch','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x458ff5,_0x3584f1){var _0x535703=function(_0x5a961e){while(--_0x5a961e){_0x458ff5['push'](_0x458ff5['shift']());}};_0x535703(++_0x3584f1);}(_0x5d6c,0x184));var _0xc5d6=function(_0x2bcbc3,_0x5b509e){_0x2bcbc3=_0x2bcbc3-0x0;var _0x5c1c86=_0x5d6c[_0x2bcbc3];return _0x5c1c86;};'use strict';var emlformat=require(_0xc5d6('0x0'));var rimraf=require(_0xc5d6('0x1'));var zipdir=require(_0xc5d6('0x2'));var jsonpatch=require(_0xc5d6('0x3'));var rp=require(_0xc5d6('0x4'));var moment=require(_0xc5d6('0x5'));var BPromise=require(_0xc5d6('0x6'));var Mustache=require(_0xc5d6('0x7'));var util=require(_0xc5d6('0x8'));var path=require(_0xc5d6('0x9'));var sox=require(_0xc5d6('0xa'));var csv=require(_0xc5d6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5d6('0xc'));var _=require('lodash');var squel=require(_0xc5d6('0xd'));var crypto=require(_0xc5d6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc5d6('0xb'));var querystring=require(_0xc5d6('0xf'));var Papa=require(_0xc5d6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc5d6('0x11'));var hardwareService=require(_0xc5d6('0x12'));var logger=require(_0xc5d6('0x13'))('api');var utils=require(_0xc5d6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc5d6('0x15'));var db=require(_0xc5d6('0x16'))['db'];function respondWithStatusCode(_0xbbc447,_0x1b500e){_0x1b500e=_0x1b500e||0xcc;return function(_0x2e34e9){if(_0x2e34e9){return _0xbbc447[_0xc5d6('0x17')](_0x1b500e);}return _0xbbc447['status'](_0x1b500e)[_0xc5d6('0x18')]();};}function respondWithResult(_0x2365cc,_0x28ced0){_0x28ced0=_0x28ced0||0xc8;return function(_0x27c824){if(_0x27c824){return _0x2365cc[_0xc5d6('0x19')](_0x28ced0)['json'](_0x27c824);}};}function respondWithFilteredResult(_0x19c654,_0x4b1a94){return function(_0x3d7a5c){if(_0x3d7a5c){var _0x3ce415=typeof _0x4b1a94[_0xc5d6('0x1a')]==='undefined'&&typeof _0x4b1a94[_0xc5d6('0x1b')]==='undefined';var _0x204d41=_0x3d7a5c[_0xc5d6('0x1c')];var _0x3cff82=_0x3ce415?0x0:_0x4b1a94[_0xc5d6('0x1a')];var _0x3e0c57=_0x3ce415?_0x3d7a5c[_0xc5d6('0x1c')]:_0x4b1a94[_0xc5d6('0x1a')]+_0x4b1a94['limit'];var _0x3d332c;if(_0x3e0c57>=_0x204d41){_0x3e0c57=_0x204d41;_0x3d332c=0xc8;}else{_0x3d332c=0xce;}_0x19c654[_0xc5d6('0x19')](_0x3d332c);return _0x19c654['set'](_0xc5d6('0x1d'),_0x3cff82+'-'+_0x3e0c57+'/'+_0x204d41)[_0xc5d6('0x1e')](_0x3d7a5c);}return null;};}function patchUpdates(_0x323edf){return function(_0x3e8e96){try{jsonpatch[_0xc5d6('0x1f')](_0x3e8e96,_0x323edf,!![]);}catch(_0x109287){return BPromise['reject'](_0x109287);}return _0x3e8e96[_0xc5d6('0x20')]();};}function saveUpdates(_0x138fc5,_0x2f3587){return function(_0x266eb8){if(_0x266eb8){return _0x266eb8['update'](_0x138fc5)[_0xc5d6('0x21')](function(_0x1f7beb){return _0x1f7beb;});}return null;};}function removeEntity(_0x268b76,_0x2de5ee){return function(_0x2b6dc6){if(_0x2b6dc6){return _0x2b6dc6[_0xc5d6('0x22')]()['then'](function(){_0x268b76[_0xc5d6('0x19')](0xcc)[_0xc5d6('0x18')]();});}};}function handleEntityNotFound(_0x2f7055,_0x371e51){return function(_0x3e2328){if(!_0x3e2328){_0x2f7055[_0xc5d6('0x17')](0x194);}return _0x3e2328;};}function handleError(_0x541bff,_0x2758ba){_0x2758ba=_0x2758ba||0x1f4;return function(_0x5aa726){logger['error'](_0x5aa726[_0xc5d6('0x23')]);if(_0x5aa726['name']){delete _0x5aa726[_0xc5d6('0x24')];}_0x541bff[_0xc5d6('0x19')](_0x2758ba)[_0xc5d6('0x25')](_0x5aa726);};}exports[_0xc5d6('0x26')]=function(_0x40cb75,_0x303247){var _0x5695a4={},_0x325ac7={},_0x4c2b51={'count':0x0,'rows':[]};var _0x5b048f=_[_0xc5d6('0x27')](db['AnalyticFieldReport'][_0xc5d6('0x28')],function(_0x2178c4){return{'name':_0x2178c4[_0xc5d6('0x29')],'type':_0x2178c4[_0xc5d6('0x2a')][_0xc5d6('0x2b')]};});_0x325ac7[_0xc5d6('0x2c')]=_[_0xc5d6('0x27')](_0x5b048f,_0xc5d6('0x24'));_0x325ac7[_0xc5d6('0x2d')]=_[_0xc5d6('0x2e')](_0x40cb75['query']);_0x325ac7['filters']=_[_0xc5d6('0x2f')](_0x325ac7['model'],_0x325ac7[_0xc5d6('0x2d')]);_0x5695a4[_0xc5d6('0x30')]=_[_0xc5d6('0x2f')](_0x325ac7[_0xc5d6('0x2c')],qs[_0xc5d6('0x31')](_0x40cb75['query'][_0xc5d6('0x31')]));_0x5695a4[_0xc5d6('0x30')]=_0x5695a4['attributes']['length']?_0x5695a4[_0xc5d6('0x30')]:_0x325ac7[_0xc5d6('0x2c')];if(!_0x40cb75['query']['hasOwnProperty'](_0xc5d6('0x32'))){_0x5695a4['limit']=qs[_0xc5d6('0x1b')](_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x1b')]);_0x5695a4['offset']=qs[_0xc5d6('0x1a')](_0x40cb75['query'][_0xc5d6('0x1a')]);}_0x5695a4[_0xc5d6('0x33')]=qs['sort'](_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x34')]);_0x5695a4['where']=qs['filters'](_['pick'](_0x40cb75[_0xc5d6('0x2d')],_0x325ac7[_0xc5d6('0x35')]),_0x5b048f);if(_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x36')]){_0x5695a4['where']=_[_0xc5d6('0x37')](_0x5695a4['where'],{'$or':_['map'](_0x5b048f,function(_0x390ca9){if(_0x390ca9[_0xc5d6('0x2a')]!==_0xc5d6('0x38')){var _0x57cb4b={};_0x57cb4b[_0x390ca9[_0xc5d6('0x24')]]={'$like':'%'+_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x36')]+'%'};return _0x57cb4b;}})});}_0x5695a4=_[_0xc5d6('0x37')]({},_0x5695a4,_0x40cb75[_0xc5d6('0x39')]);var _0x25ae1e={'where':_0x5695a4[_0xc5d6('0x3a')]};return db[_0xc5d6('0x3b')][_0xc5d6('0x1c')](_0x25ae1e)['then'](function(_0x5b101f){_0x4c2b51['count']=_0x5b101f;if(_0x40cb75[_0xc5d6('0x2d')]['includeAll']){_0x5695a4[_0xc5d6('0x3c')]=[{'all':!![]}];}return db[_0xc5d6('0x3b')][_0xc5d6('0x3d')](_0x5695a4);})[_0xc5d6('0x21')](function(_0x1f785c){_0x4c2b51[_0xc5d6('0x3e')]=_0x1f785c;return _0x4c2b51;})[_0xc5d6('0x21')](respondWithFilteredResult(_0x303247,_0x5695a4))['catch'](handleError(_0x303247,null));};exports[_0xc5d6('0x3f')]=function(_0x5e8a28,_0x5d510d){var _0x295f77={'raw':![],'where':{'id':_0x5e8a28[_0xc5d6('0x40')]['id']}},_0x135c97={};_0x135c97[_0xc5d6('0x2c')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x135c97[_0xc5d6('0x2d')]=_[_0xc5d6('0x2e')](_0x5e8a28[_0xc5d6('0x2d')]);_0x135c97['filters']=_['intersection'](_0x135c97['model'],_0x135c97[_0xc5d6('0x2d')]);_0x295f77[_0xc5d6('0x30')]=_['intersection'](_0x135c97[_0xc5d6('0x2c')],qs[_0xc5d6('0x31')](_0x5e8a28[_0xc5d6('0x2d')][_0xc5d6('0x31')]));_0x295f77['attributes']=_0x295f77[_0xc5d6('0x30')][_0xc5d6('0x41')]?_0x295f77[_0xc5d6('0x30')]:_0x135c97['model'];if(_0x5e8a28[_0xc5d6('0x2d')]['includeAll']){_0x295f77[_0xc5d6('0x3c')]=[{'all':!![]}];}_0x295f77=_[_0xc5d6('0x37')]({},_0x295f77,_0x5e8a28[_0xc5d6('0x39')]);return db['AnalyticFieldReport'][_0xc5d6('0x42')](_0x295f77)[_0xc5d6('0x21')](handleEntityNotFound(_0x5d510d,null))[_0xc5d6('0x21')](respondWithResult(_0x5d510d,null))[_0xc5d6('0x43')](handleError(_0x5d510d,null));};exports['create']=function(_0x1eab83,_0xc80268){return db[_0xc5d6('0x3b')][_0xc5d6('0x44')](_0x1eab83[_0xc5d6('0x45')],{})[_0xc5d6('0x21')](respondWithResult(_0xc80268,0xc9))[_0xc5d6('0x43')](handleError(_0xc80268,null));};exports[_0xc5d6('0x46')]=function(_0x361bca,_0x6e2550){return db[_0xc5d6('0x3b')][_0xc5d6('0x46')](_0x361bca[_0xc5d6('0x45')],{'raw':![],'individualHooks':!![]})[_0xc5d6('0x21')](respondWithResult(_0x6e2550,0xc9))[_0xc5d6('0x43')](handleError(_0x6e2550,null));};exports[_0xc5d6('0x47')]=function(_0x3a7c85,_0xe14025){if(_0x3a7c85['body']['id']){delete _0x3a7c85[_0xc5d6('0x45')]['id'];}return db[_0xc5d6('0x3b')][_0xc5d6('0x42')]({'where':{'id':_0x3a7c85[_0xc5d6('0x40')]['id']}})[_0xc5d6('0x21')](handleEntityNotFound(_0xe14025,null))[_0xc5d6('0x21')](saveUpdates(_0x3a7c85[_0xc5d6('0x45')],null))[_0xc5d6('0x21')](respondWithResult(_0xe14025,null))[_0xc5d6('0x43')](handleError(_0xe14025,null));};exports[_0xc5d6('0x22')]=function(_0x2c5e3d,_0x31526b){return db[_0xc5d6('0x3b')][_0xc5d6('0x42')]({'where':{'id':_0x2c5e3d[_0xc5d6('0x40')]['id']}})[_0xc5d6('0x21')](handleEntityNotFound(_0x31526b,null))[_0xc5d6('0x21')](removeEntity(_0x31526b,null))['catch'](handleError(_0x31526b,null));};exports[_0xc5d6('0x48')]=function(_0x472368,_0x3f05ac){return db['AnalyticFieldReport'][_0xc5d6('0x22')]({'where':{'id':_0x472368['query'][_0xc5d6('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3f05ac,0xcc))[_0xc5d6('0x43')](handleError(_0x3f05ac,null));};exports[_0xc5d6('0x4a')]=function(_0x4bcd03,_0xa5da21,_0x4e5d7e){return db[_0xc5d6('0x4b')]['findOne']({'where':{'id':_0x4bcd03[_0xc5d6('0x40')]['id']}})[_0xc5d6('0x21')](handleEntityNotFound(_0xa5da21,null))[_0xc5d6('0x21')](function(_0xf9070a){if(_0xf9070a){return db[_0xc5d6('0x4c')][_0xc5d6('0x4d')](function(_0x3808e4){return db[_0xc5d6('0x3b')]['destroy']({'where':{'CustomReportId':_0x4bcd03[_0xc5d6('0x40')]['id']},'transaction':_0x3808e4})[_0xc5d6('0x21')](function(_0x45cbd){var _0x43a07c=_[_0xc5d6('0x27')](_0x4bcd03[_0xc5d6('0x45')],function(_0x17f5bd){delete _0x17f5bd['id'];_0x17f5bd[_0xc5d6('0x4e')]=_0x4bcd03[_0xc5d6('0x40')]['id'];return _0x17f5bd;});return db[_0xc5d6('0x3b')][_0xc5d6('0x46')](_0x43a07c,{'transaction':_0x3808e4});});})[_0xc5d6('0x21')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x4bcd03[_0xc5d6('0x40')]['id']}});});}})[_0xc5d6('0x21')](respondWithResult(_0xa5da21,null))['catch'](handleError(_0xa5da21,null));}; \ No newline at end of file +var _0x895d=['set','Content-Range','apply','reject','save','update','destroy','error','send','map','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','include','AnalyticFieldReport','findAll','then','show','params','filters','length','options','catch','create','body','bulkCreate','find','bulkDestroy','ids','AnalyticCustomReport','findOne','CustomReportId','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0x895d,0x1bf));var _0xd895=function(_0x43151a,_0xe351a9){_0x43151a=_0x43151a-0x0;var _0x5852c7=_0x895d[_0x43151a];return _0x5852c7;};'use strict';var emlformat=require(_0xd895('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd895('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd895('0x2'));var moment=require(_0xd895('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd895('0x4'));var util=require(_0xd895('0x5'));var path=require(_0xd895('0x6'));var sox=require(_0xd895('0x7'));var csv=require(_0xd895('0x8'));var ejs=require(_0xd895('0x9'));var fs=require('fs');var fs_extra=require(_0xd895('0xa'));var _=require(_0xd895('0xb'));var squel=require(_0xd895('0xc'));var crypto=require(_0xd895('0xd'));var jsforce=require(_0xd895('0xe'));var deskjs=require(_0xd895('0xf'));var toCsv=require(_0xd895('0x8'));var querystring=require(_0xd895('0x10'));var Papa=require(_0xd895('0x11'));var Redis=require(_0xd895('0x12'));var authService=require(_0xd895('0x13'));var qs=require(_0xd895('0x14'));var as=require(_0xd895('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd895('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd895('0x17'));var db=require(_0xd895('0x18'))['db'];function respondWithStatusCode(_0x34f812,_0x22b38d){_0x22b38d=_0x22b38d||0xcc;return function(_0x2bfe0c){if(_0x2bfe0c){return _0x34f812[_0xd895('0x19')](_0x22b38d);}return _0x34f812[_0xd895('0x1a')](_0x22b38d)[_0xd895('0x1b')]();};}function respondWithResult(_0x4113d9,_0x3623f3){_0x3623f3=_0x3623f3||0xc8;return function(_0x1f90f3){if(_0x1f90f3){return _0x4113d9[_0xd895('0x1a')](_0x3623f3)[_0xd895('0x1c')](_0x1f90f3);}};}function respondWithFilteredResult(_0x37d93b,_0x12094d){return function(_0x32f6df){if(_0x32f6df){var _0xa6fd98=typeof _0x12094d[_0xd895('0x1d')]===_0xd895('0x1e')&&typeof _0x12094d[_0xd895('0x1f')]===_0xd895('0x1e');var _0x296fc6=_0x32f6df[_0xd895('0x20')];var _0x11510d=_0xa6fd98?0x0:_0x12094d[_0xd895('0x1d')];var _0x5d1ecd=_0xa6fd98?_0x32f6df[_0xd895('0x20')]:_0x12094d[_0xd895('0x1d')]+_0x12094d[_0xd895('0x1f')];var _0x48f7dd;if(_0x5d1ecd>=_0x296fc6){_0x5d1ecd=_0x296fc6;_0x48f7dd=0xc8;}else{_0x48f7dd=0xce;}_0x37d93b[_0xd895('0x1a')](_0x48f7dd);return _0x37d93b[_0xd895('0x21')](_0xd895('0x22'),_0x11510d+'-'+_0x5d1ecd+'/'+_0x296fc6)[_0xd895('0x1c')](_0x32f6df);}return null;};}function patchUpdates(_0x3f2887){return function(_0x177f8d){try{jsonpatch[_0xd895('0x23')](_0x177f8d,_0x3f2887,!![]);}catch(_0x5d3215){return BPromise[_0xd895('0x24')](_0x5d3215);}return _0x177f8d[_0xd895('0x25')]();};}function saveUpdates(_0x59a27a,_0x2fa152){return function(_0x31a43e){if(_0x31a43e){return _0x31a43e[_0xd895('0x26')](_0x59a27a)['then'](function(_0x3d6e29){return _0x3d6e29;});}return null;};}function removeEntity(_0x77e76b,_0x3dc78f){return function(_0x5ca4ba){if(_0x5ca4ba){return _0x5ca4ba[_0xd895('0x27')]()['then'](function(){_0x77e76b[_0xd895('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd1c44,_0x4aec5a){return function(_0xa8e8c3){if(!_0xa8e8c3){_0xdd1c44[_0xd895('0x19')](0x194);}return _0xa8e8c3;};}function handleError(_0x512ab8,_0x5abdc5){_0x5abdc5=_0x5abdc5||0x1f4;return function(_0xd82c86){logger[_0xd895('0x28')](_0xd82c86['stack']);if(_0xd82c86['name']){delete _0xd82c86['name'];}_0x512ab8[_0xd895('0x1a')](_0x5abdc5)[_0xd895('0x29')](_0xd82c86);};}exports['index']=function(_0x458e2d,_0x1417f0){var _0x24b0af={},_0x101fb7={},_0x43d794={'count':0x0,'rows':[]};var _0x5b6db9=_[_0xd895('0x2a')](db['AnalyticFieldReport'][_0xd895('0x2b')],function(_0x1b15f4){return{'name':_0x1b15f4[_0xd895('0x2c')],'type':_0x1b15f4[_0xd895('0x2d')][_0xd895('0x2e')]};});_0x101fb7[_0xd895('0x2f')]=_[_0xd895('0x2a')](_0x5b6db9,_0xd895('0x30'));_0x101fb7['query']=_[_0xd895('0x31')](_0x458e2d[_0xd895('0x32')]);_0x101fb7['filters']=_[_0xd895('0x33')](_0x101fb7[_0xd895('0x2f')],_0x101fb7[_0xd895('0x32')]);_0x24b0af[_0xd895('0x34')]=_[_0xd895('0x33')](_0x101fb7[_0xd895('0x2f')],qs['fields'](_0x458e2d['query'][_0xd895('0x35')]));_0x24b0af['attributes']=_0x24b0af['attributes']['length']?_0x24b0af['attributes']:_0x101fb7[_0xd895('0x2f')];if(!_0x458e2d[_0xd895('0x32')]['hasOwnProperty'](_0xd895('0x36'))){_0x24b0af[_0xd895('0x1f')]=qs[_0xd895('0x1f')](_0x458e2d[_0xd895('0x32')][_0xd895('0x1f')]);_0x24b0af[_0xd895('0x1d')]=qs[_0xd895('0x1d')](_0x458e2d[_0xd895('0x32')][_0xd895('0x1d')]);}_0x24b0af[_0xd895('0x37')]=qs[_0xd895('0x38')](_0x458e2d['query'][_0xd895('0x38')]);_0x24b0af[_0xd895('0x39')]=qs['filters'](_['pick'](_0x458e2d[_0xd895('0x32')],_0x101fb7['filters']),_0x5b6db9);if(_0x458e2d['query'][_0xd895('0x3a')]){_0x24b0af[_0xd895('0x39')]=_[_0xd895('0x3b')](_0x24b0af[_0xd895('0x39')],{'$or':_[_0xd895('0x2a')](_0x5b6db9,function(_0x1f9293){if(_0x1f9293[_0xd895('0x2d')]!==_0xd895('0x3c')){var _0x4f7da9={};_0x4f7da9[_0x1f9293['name']]={'$like':'%'+_0x458e2d['query'][_0xd895('0x3a')]+'%'};return _0x4f7da9;}})});}_0x24b0af=_[_0xd895('0x3b')]({},_0x24b0af,_0x458e2d['options']);var _0x1766e1={'where':_0x24b0af['where']};return db['AnalyticFieldReport']['count'](_0x1766e1)['then'](function(_0x52bcf8){_0x43d794[_0xd895('0x20')]=_0x52bcf8;if(_0x458e2d[_0xd895('0x32')]['includeAll']){_0x24b0af[_0xd895('0x3d')]=[{'all':!![]}];}return db[_0xd895('0x3e')][_0xd895('0x3f')](_0x24b0af);})[_0xd895('0x40')](function(_0x41850b){_0x43d794['rows']=_0x41850b;return _0x43d794;})[_0xd895('0x40')](respondWithFilteredResult(_0x1417f0,_0x24b0af))['catch'](handleError(_0x1417f0,null));};exports[_0xd895('0x41')]=function(_0x1cd19d,_0x12abed){var _0x1946c9={'raw':![],'where':{'id':_0x1cd19d[_0xd895('0x42')]['id']}},_0x515d59={};_0x515d59[_0xd895('0x2f')]=_['keys'](db[_0xd895('0x3e')][_0xd895('0x2b')]);_0x515d59[_0xd895('0x32')]=_[_0xd895('0x31')](_0x1cd19d[_0xd895('0x32')]);_0x515d59[_0xd895('0x43')]=_[_0xd895('0x33')](_0x515d59[_0xd895('0x2f')],_0x515d59[_0xd895('0x32')]);_0x1946c9[_0xd895('0x34')]=_[_0xd895('0x33')](_0x515d59['model'],qs['fields'](_0x1cd19d[_0xd895('0x32')][_0xd895('0x35')]));_0x1946c9[_0xd895('0x34')]=_0x1946c9[_0xd895('0x34')][_0xd895('0x44')]?_0x1946c9[_0xd895('0x34')]:_0x515d59[_0xd895('0x2f')];if(_0x1cd19d[_0xd895('0x32')]['includeAll']){_0x1946c9[_0xd895('0x3d')]=[{'all':!![]}];}_0x1946c9=_[_0xd895('0x3b')]({},_0x1946c9,_0x1cd19d[_0xd895('0x45')]);return db[_0xd895('0x3e')]['find'](_0x1946c9)[_0xd895('0x40')](handleEntityNotFound(_0x12abed,null))[_0xd895('0x40')](respondWithResult(_0x12abed,null))[_0xd895('0x46')](handleError(_0x12abed,null));};exports[_0xd895('0x47')]=function(_0x5b241b,_0x3ac658){return db[_0xd895('0x3e')][_0xd895('0x47')](_0x5b241b[_0xd895('0x48')],{})[_0xd895('0x40')](respondWithResult(_0x3ac658,0xc9))['catch'](handleError(_0x3ac658,null));};exports['bulkCreate']=function(_0x1df36d,_0x15ac2c){return db[_0xd895('0x3e')][_0xd895('0x49')](_0x1df36d['body'],{'raw':![],'individualHooks':!![]})[_0xd895('0x40')](respondWithResult(_0x15ac2c,0xc9))['catch'](handleError(_0x15ac2c,null));};exports[_0xd895('0x26')]=function(_0x155438,_0xa434be){if(_0x155438[_0xd895('0x48')]['id']){delete _0x155438['body']['id'];}return db[_0xd895('0x3e')][_0xd895('0x4a')]({'where':{'id':_0x155438[_0xd895('0x42')]['id']}})[_0xd895('0x40')](handleEntityNotFound(_0xa434be,null))['then'](saveUpdates(_0x155438[_0xd895('0x48')],null))[_0xd895('0x40')](respondWithResult(_0xa434be,null))[_0xd895('0x46')](handleError(_0xa434be,null));};exports[_0xd895('0x27')]=function(_0x4fa1ff,_0x107d99){return db[_0xd895('0x3e')][_0xd895('0x4a')]({'where':{'id':_0x4fa1ff[_0xd895('0x42')]['id']}})[_0xd895('0x40')](handleEntityNotFound(_0x107d99,null))[_0xd895('0x40')](removeEntity(_0x107d99,null))['catch'](handleError(_0x107d99,null));};exports[_0xd895('0x4b')]=function(_0x11ad72,_0x2547b3){return db[_0xd895('0x3e')][_0xd895('0x27')]({'where':{'id':_0x11ad72[_0xd895('0x32')][_0xd895('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2547b3,0xcc))[_0xd895('0x46')](handleError(_0x2547b3,null));};exports['addFields']=function(_0x27bfe3,_0x3c579c,_0x5a3476){return db[_0xd895('0x4d')][_0xd895('0x4e')]({'where':{'id':_0x27bfe3[_0xd895('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c579c,null))[_0xd895('0x40')](function(_0xb5207b){if(_0xb5207b){return db['sequelize']['transaction'](function(_0x2f4964){return db[_0xd895('0x3e')]['destroy']({'where':{'CustomReportId':_0x27bfe3[_0xd895('0x42')]['id']},'transaction':_0x2f4964})[_0xd895('0x40')](function(_0x4f107e){var _0x491a6c=_[_0xd895('0x2a')](_0x27bfe3[_0xd895('0x48')],function(_0x122fdb){delete _0x122fdb['id'];_0x122fdb[_0xd895('0x4f')]=_0x27bfe3[_0xd895('0x42')]['id'];return _0x122fdb;});return db[_0xd895('0x3e')]['bulkCreate'](_0x491a6c,{'transaction':_0x2f4964});});})[_0xd895('0x40')](function(){return db['AnalyticFieldReport'][_0xd895('0x3f')]({'where':{'CustomReportId':_0x27bfe3[_0xd895('0x42')]['id']}});});}})['then'](respondWithResult(_0x3c579c,null))['catch'](handleError(_0x3c579c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 668f8a3..0902d73 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 _0x67ba=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x67ba,0xf0));var _0xa67b=function(_0x112fc4,_0x9381f0){_0x112fc4=_0x112fc4-0x0;var _0x36cd0d=_0x67ba[_0x112fc4];return _0x36cd0d;};'use strict';var _=require(_0xa67b('0x0'));var util=require('util');var logger=require(_0xa67b('0x1'))(_0xa67b('0x2'));var moment=require(_0xa67b('0x3'));var BPromise=require(_0xa67b('0x4'));var rp=require(_0xa67b('0x5'));var fs=require('fs');var path=require(_0xa67b('0x6'));var rimraf=require(_0xa67b('0x7'));var config=require(_0xa67b('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0xa67b('0x9')]=function(_0x30b83e,_0x3c41ac){return _0x30b83e[_0xa67b('0xa')](_0xa67b('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23bb=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x363965,_0xe1e687){var _0x3e3849=function(_0x2e5d29){while(--_0x2e5d29){_0x363965['push'](_0x363965['shift']());}};_0x3e3849(++_0xe1e687);}(_0x23bb,0x12e));var _0xb23b=function(_0x4808d3,_0x3353c6){_0x4808d3=_0x4808d3-0x0;var _0x3057fa=_0x23bb[_0x4808d3];return _0x3057fa;};'use strict';var _=require(_0xb23b('0x0'));var util=require(_0xb23b('0x1'));var logger=require('../../config/logger')(_0xb23b('0x2'));var moment=require(_0xb23b('0x3'));var BPromise=require(_0xb23b('0x4'));var rp=require(_0xb23b('0x5'));var fs=require('fs');var path=require(_0xb23b('0x6'));var rimraf=require('rimraf');var config=require(_0xb23b('0x7'));var attributes=require(_0xb23b('0x8'));module[_0xb23b('0x9')]=function(_0x1f1310,_0x2246c4){return _0x1f1310[_0xb23b('0xa')](_0xb23b('0xb'),attributes,{'tableName':_0xb23b('0xc'),'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 a7b357e..df1b2f4 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 _0x249e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x249e,0x140));var _0xe249=function(_0x3d16a5,_0x1e4c3c){_0x3d16a5=_0x3d16a5-0x0;var _0x558613=_0x249e[_0x3d16a5];return _0x558613;};'use strict';var _=require(_0xe249('0x0'));var util=require(_0xe249('0x1'));var moment=require(_0xe249('0x2'));var BPromise=require('bluebird');var rs=require(_0xe249('0x3'));var fs=require('fs');var Redis=require(_0xe249('0x4'));var db=require(_0xe249('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe249('0x6'))('rpc');var config=require(_0xe249('0x7'));var jayson=require(_0xe249('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2abb96,_0x2b8647,_0x5bf29f){return new BPromise(function(_0x3c674c,_0xd1ca7d){return client['request'](_0x2abb96,_0x5bf29f)[_0xe249('0x9')](function(_0x31adcd){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2b8647,_0xe249('0xa'));logger[_0xe249('0xb')](_0xe249('0xc'),_0x2b8647,_0xe249('0xa'),JSON[_0xe249('0xd')](_0x31adcd));if(_0x31adcd[_0xe249('0xe')]){if(_0x31adcd[_0xe249('0xe')][_0xe249('0xf')]===0x1f4){logger[_0xe249('0xe')](_0xe249('0x10'),_0x2b8647,_0x31adcd[_0xe249('0xe')]['message']);return _0xd1ca7d(_0x31adcd[_0xe249('0xe')][_0xe249('0x11')]);}logger[_0xe249('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2b8647,_0x31adcd[_0xe249('0xe')][_0xe249('0x11')]);return _0x3c674c(_0x31adcd[_0xe249('0xe')]['message']);}else{logger['info'](_0xe249('0x10'),_0x2b8647,_0xe249('0xa'));_0x3c674c(_0x31adcd[_0xe249('0x12')][_0xe249('0x11')]);}})[_0xe249('0x13')](function(_0xc49e62){logger[_0xe249('0xe')](_0xe249('0x10'),_0x2b8647,_0xc49e62);_0xd1ca7d(_0xc49e62);});});} \ No newline at end of file +var _0x1464=['request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2457d7,_0x16e9cd){var _0x43a218=function(_0x2fca0c){while(--_0x2fca0c){_0x2457d7['push'](_0x2457d7['shift']());}};_0x43a218(++_0x16e9cd);}(_0x1464,0x1d5));var _0x4146=function(_0x14652e,_0x59fb87){_0x14652e=_0x14652e-0x0;var _0x1e3b87=_0x1464[_0x14652e];return _0x1e3b87;};'use strict';var _=require(_0x4146('0x0'));var util=require(_0x4146('0x1'));var moment=require(_0x4146('0x2'));var BPromise=require('bluebird');var rs=require(_0x4146('0x3'));var fs=require('fs');var Redis=require(_0x4146('0x4'));var db=require(_0x4146('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4146('0x6'))(_0x4146('0x7'));var config=require('../../config/environment');var jayson=require(_0x4146('0x8'));var client=jayson[_0x4146('0x9')][_0x4146('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x384abc,_0x40b23b,_0x480601){return new BPromise(function(_0x55200f,_0x56959d){return client[_0x4146('0xb')](_0x384abc,_0x480601)[_0x4146('0xc')](function(_0x3bdc1a){logger[_0x4146('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x40b23b,_0x4146('0xe'));logger[_0x4146('0xf')](_0x4146('0x10'),_0x40b23b,_0x4146('0xe'),JSON[_0x4146('0x11')](_0x3bdc1a));if(_0x3bdc1a[_0x4146('0x12')]){if(_0x3bdc1a[_0x4146('0x12')]['code']===0x1f4){logger[_0x4146('0x12')](_0x4146('0x13'),_0x40b23b,_0x3bdc1a['error'][_0x4146('0x14')]);return _0x56959d(_0x3bdc1a[_0x4146('0x12')][_0x4146('0x14')]);}logger[_0x4146('0x12')](_0x4146('0x13'),_0x40b23b,_0x3bdc1a[_0x4146('0x12')][_0x4146('0x14')]);return _0x55200f(_0x3bdc1a[_0x4146('0x12')][_0x4146('0x14')]);}else{logger[_0x4146('0xd')](_0x4146('0x13'),_0x40b23b,_0x4146('0xe'));_0x55200f(_0x3bdc1a[_0x4146('0x15')]['message']);}})[_0x4146('0x16')](function(_0x214ba6){logger[_0x4146('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x40b23b,_0x214ba6);_0x56959d(_0x214ba6);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 137b692..54c1f82 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(_0x4b3fe3,_0x194dad){var _0x476091=function(_0x5cf290){while(--_0x5cf290){_0x4b3fe3['push'](_0x4b3fe3['shift']());}};_0x476091(++_0x194dad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x3f58ce,_0x4e967e){var _0x4902bd=function(_0x554062){while(--_0x554062){_0x3f58ce['push'](_0x3f58ce['shift']());}};_0x4902bd(++_0x4e967e);}(_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'));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 92af735..4e64f21 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 _0x2746=['TEXT','STRING','name'];(function(_0x30b53a,_0x5ebc30){var _0x51c395=function(_0x527bba){while(--_0x527bba){_0x30b53a['push'](_0x30b53a['shift']());}};_0x51c395(++_0x5ebc30);}(_0x2746,0x19c));var _0x6274=function(_0x970579,_0x515788){_0x970579=_0x970579-0x0;var _0x1dcc78=_0x2746[_0x970579];return _0x1dcc78;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6274('0x0')],'allowNull':![],'unique':_0x6274('0x1')},'table':{'type':Sequelize[_0x6274('0x0')]},'metric':{'type':Sequelize[_0x6274('0x2')]},'description':{'type':Sequelize[_0x6274('0x0')]}}; \ No newline at end of file +var _0xe706=['exports','STRING','TEXT','sequelize'];(function(_0x5d7686,_0x5d11b1){var _0x408ab4=function(_0x424411){while(--_0x424411){_0x5d7686['push'](_0x5d7686['shift']());}};_0x408ab4(++_0x5d11b1);}(_0xe706,0xa3));var _0x6e70=function(_0x4ed2c1,_0x8c9475){_0x4ed2c1=_0x4ed2c1-0x0;var _0x397295=_0xe706[_0x4ed2c1];return _0x397295;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6e70('0x2')]},'metric':{'type':Sequelize[_0x6e70('0x3')]},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c1a2d29..64a5af9 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(_0x3ac1f3,_0x8ba690){var _0x1f96ca=function(_0x16b072){while(--_0x16b072){_0x3ac1f3['push'](_0x3ac1f3['shift']());}};_0x1f96ca(++_0x8ba690);}(_0xe5b3,0x133));var _0x3e5b=function(_0x243c94,_0x156778){_0x243c94=_0x243c94-0x0;var _0x33624f=_0xe5b3[_0x243c94];return _0x33624f;};'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 _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x286998,_0x2c6620){var _0x14f372=function(_0x4bf8be){while(--_0x4bf8be){_0x286998['push'](_0x286998['shift']());}};_0x14f372(++_0x2c6620);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1a1d1e,_0x13fb1a){_0x1a1d1e=_0x1a1d1e-0x0;var _0x1cd5ec=_0x8ef6[_0x1a1d1e];return _0x1cd5ec;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index a1365f2..c2bbab5 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 _0xb2f1=['path','./analyticMetric.attributes','exports','analytics_metrics','lodash','util','api','moment','request-promise'];(function(_0x1ced88,_0x477e93){var _0x4eafbd=function(_0xc92d8e){while(--_0xc92d8e){_0x1ced88['push'](_0x1ced88['shift']());}};_0x4eafbd(++_0x477e93);}(_0xb2f1,0xee));var _0x1b2f=function(_0xbcb777,_0xb0960){_0xbcb777=_0xbcb777-0x0;var _0x5aafed=_0xb2f1[_0xbcb777];return _0x5aafed;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require('../../config/logger')(_0x1b2f('0x2'));var moment=require(_0x1b2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b2f('0x4'));var fs=require('fs');var path=require(_0x1b2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b2f('0x6'));module[_0x1b2f('0x7')]=function(_0xad728b,_0x4326ba){return _0xad728b['define']('AnalyticMetric',attributes,{'tableName':_0x1b2f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c32=['analytics_metrics','lodash','../../config/logger','moment','request-promise','path','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x2860f0,_0x231ab7){var _0x4211a6=function(_0x2f5c8f){while(--_0x2f5c8f){_0x2860f0['push'](_0x2860f0['shift']());}};_0x4211a6(++_0x231ab7);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x26c3('0x0'));var util=require('util');var logger=require(_0x26c3('0x1'))('api');var moment=require(_0x26c3('0x2'));var BPromise=require('bluebird');var rp=require(_0x26c3('0x3'));var fs=require('fs');var path=require(_0x26c3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26c3('0x5'));module[_0x26c3('0x6')]=function(_0x421941,_0x402393){return _0x421941[_0x26c3('0x7')](_0x26c3('0x8'),attributes,{'tableName':_0x26c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 1fc786e..7910fef 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 _0xff86=['result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticMetric,\x20%s,\x20%s','message'];(function(_0x386306,_0x1363c9){var _0xcb23d=function(_0x1fc525){while(--_0x1fc525){_0x386306['push'](_0x386306['shift']());}};_0xcb23d(++_0x1363c9);}(_0xff86,0x151));var _0x6ff8=function(_0x187324,_0x284da5){_0x187324=_0x187324-0x0;var _0x2c2081=_0xff86[_0x187324];return _0x2c2081;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ff8('0x0'));var BPromise=require(_0x6ff8('0x1'));var rs=require(_0x6ff8('0x2'));var fs=require('fs');var Redis=require(_0x6ff8('0x3'));var db=require(_0x6ff8('0x4'))['db'];var utils=require(_0x6ff8('0x5'));var logger=require('../../config/logger')(_0x6ff8('0x6'));var config=require(_0x6ff8('0x7'));var jayson=require(_0x6ff8('0x8'));var client=jayson[_0x6ff8('0x9')][_0x6ff8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d902,_0x508e92,_0x750a03){return new BPromise(function(_0x32e62e,_0x452d1b){return client[_0x6ff8('0xb')](_0x10d902,_0x750a03)['then'](function(_0x581549){logger[_0x6ff8('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x508e92,'request\x20sent');logger[_0x6ff8('0xd')](_0x6ff8('0xe'),_0x508e92,_0x6ff8('0xf'),JSON['stringify'](_0x581549));if(_0x581549[_0x6ff8('0x10')]){if(_0x581549['error'][_0x6ff8('0x11')]===0x1f4){logger[_0x6ff8('0x10')](_0x6ff8('0x12'),_0x508e92,_0x581549['error'][_0x6ff8('0x13')]);return _0x452d1b(_0x581549[_0x6ff8('0x10')]['message']);}logger[_0x6ff8('0x10')](_0x6ff8('0x12'),_0x508e92,_0x581549[_0x6ff8('0x10')][_0x6ff8('0x13')]);return _0x32e62e(_0x581549[_0x6ff8('0x10')][_0x6ff8('0x13')]);}else{logger[_0x6ff8('0xc')](_0x6ff8('0x12'),_0x508e92,'request\x20sent');_0x32e62e(_0x581549[_0x6ff8('0x14')][_0x6ff8('0x13')]);}})['catch'](function(_0x3b5c79){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x508e92,_0x3b5c79);_0x452d1b(_0x3b5c79);});});} \ No newline at end of file +var _0x5937=['AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x5937,0xb8));var _0x7593=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5937[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x7593('0x0'));var moment=require(_0x7593('0x1'));var BPromise=require(_0x7593('0x2'));var rs=require(_0x7593('0x3'));var fs=require('fs');var Redis=require(_0x7593('0x4'));var db=require(_0x7593('0x5'))['db'];var utils=require(_0x7593('0x6'));var logger=require(_0x7593('0x7'))(_0x7593('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xec3eee,_0x5a63b7,_0x17427a){return new BPromise(function(_0x16601e,_0x3de2f0){return client[_0x7593('0x9')](_0xec3eee,_0x17427a)[_0x7593('0xa')](function(_0x51e04d){logger[_0x7593('0xb')](_0x7593('0xc'),_0x5a63b7,'request\x20sent');logger[_0x7593('0xd')](_0x7593('0xe'),_0x5a63b7,_0x7593('0xf'),JSON[_0x7593('0x10')](_0x51e04d));if(_0x51e04d['error']){if(_0x51e04d[_0x7593('0x11')][_0x7593('0x12')]===0x1f4){logger[_0x7593('0x11')](_0x7593('0xc'),_0x5a63b7,_0x51e04d[_0x7593('0x11')][_0x7593('0x13')]);return _0x3de2f0(_0x51e04d[_0x7593('0x11')][_0x7593('0x13')]);}logger[_0x7593('0x11')](_0x7593('0xc'),_0x5a63b7,_0x51e04d[_0x7593('0x11')][_0x7593('0x13')]);return _0x16601e(_0x51e04d['error'][_0x7593('0x13')]);}else{logger[_0x7593('0xb')](_0x7593('0xc'),_0x5a63b7,_0x7593('0xf'));_0x16601e(_0x51e04d[_0x7593('0x14')][_0x7593('0x13')]);}})[_0x7593('0x15')](function(_0x1875bf){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x5a63b7,_0x1875bf);_0x3de2f0(_0x1875bf);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 61f1b91..df42cbf 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 _0x1dcc=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','put','update'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x34e0db,_0x6be33b){_0x34e0db=_0x34e0db-0x0;var _0x1202d8=_0x1dcc[_0x34e0db];return _0x1202d8;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1dc('0x5'));var interaction=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x9')]);router[_0xc1dc('0xa')]('/:id',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xb')]);router['post']('/',auth[_0xc1dc('0x8')](),controller['create']);router[_0xc1dc('0xc')]('/:id',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xd')]);router[_0xc1dc('0xe')](_0xc1dc('0xf'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x10')]);module[_0xc1dc('0x11')]=router; \ No newline at end of file +var _0x3dd6=['update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','/:id','post','create','put'];(function(_0x578e17,_0x5ca701){var _0x3d439f=function(_0x23ab8b){while(--_0x23ab8b){_0x578e17['push'](_0x578e17['shift']());}};_0x3d439f(++_0x5ca701);}(_0x3dd6,0xcf));var _0x63dd=function(_0x366655,_0x4d032){_0x366655=_0x366655-0x0;var _0x11e076=_0x3dd6[_0x366655];return _0x11e076;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x63dd('0x0'));var express=require(_0x63dd('0x1'));var router=express[_0x63dd('0x2')]();var fs_extra=require(_0x63dd('0x3'));var auth=require(_0x63dd('0x4'));var interaction=require(_0x63dd('0x5'));var config=require('../../config/environment');var controller=require(_0x63dd('0x6'));router['get']('/',auth[_0x63dd('0x7')](),controller[_0x63dd('0x8')]);router[_0x63dd('0x9')](_0x63dd('0xa'),auth[_0x63dd('0x7')](),controller['show']);router[_0x63dd('0xb')]('/',auth[_0x63dd('0x7')](),controller[_0x63dd('0xc')]);router[_0x63dd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x63dd('0xe')]);router[_0x63dd('0xf')](_0x63dd('0xa'),auth[_0x63dd('0x7')](),controller[_0x63dd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f05079c..6cb042f 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 _0x8835=['exports','TEXT'];(function(_0x3ab4c8,_0x1e05a4){var _0x59f1e2=function(_0x51afc0){while(--_0x51afc0){_0x3ab4c8['push'](_0x3ab4c8['shift']());}};_0x59f1e2(++_0x1e05a4);}(_0x8835,0xc0));var _0x5883=function(_0xdfa37a,_0x5ac389){_0xdfa37a=_0xdfa37a-0x0;var _0x440926=_0x8835[_0xdfa37a];return _0x440926;};'use strict';var Sequelize=require('sequelize');module[_0x5883('0x0')]={'tree':{'type':Sequelize[_0x5883('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x582f=['TEXT','sequelize'];(function(_0x49d802,_0x37c287){var _0x23ce8b=function(_0x1d19e7){while(--_0x1d19e7){_0x49d802['push'](_0x49d802['shift']());}};_0x23ce8b(++_0x37c287);}(_0x582f,0x7f));var _0xf582=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x582f[_0x242a4f];return _0x122117;};'use strict';var Sequelize=require(_0xf582('0x0'));module['exports']={'tree':{'type':Sequelize[_0xf582('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 320f80f..f39628f 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 _0x94b3=['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','api','../../config/environment','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','AnalyticTreeReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','keys','include','create','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x94b3,0x1f2));var _0x394b=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x94b3[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x394b('0x0'));var rp=require(_0x394b('0x1'));var moment=require(_0x394b('0x2'));var BPromise=require(_0x394b('0x3'));var Mustache=require(_0x394b('0x4'));var util=require(_0x394b('0x5'));var path=require(_0x394b('0x6'));var sox=require(_0x394b('0x7'));var csv=require(_0x394b('0x8'));var ejs=require(_0x394b('0x9'));var fs=require('fs');var fs_extra=require(_0x394b('0xa'));var _=require(_0x394b('0xb'));var squel=require(_0x394b('0xc'));var crypto=require(_0x394b('0xd'));var jsforce=require(_0x394b('0xe'));var deskjs=require(_0x394b('0xf'));var toCsv=require(_0x394b('0x8'));var querystring=require('querystring');var Papa=require(_0x394b('0x10'));var Redis=require(_0x394b('0x11'));var authService=require(_0x394b('0x12'));var qs=require(_0x394b('0x13'));var as=require(_0x394b('0x14'));var hardwareService=require(_0x394b('0x15'));var logger=require('../../config/logger')(_0x394b('0x16'));var utils=require('../../config/utils');var config=require(_0x394b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13832b,_0x5de9cf){_0x5de9cf=_0x5de9cf||0xcc;return function(_0x206429){if(_0x206429){return _0x13832b['sendStatus'](_0x5de9cf);}return _0x13832b[_0x394b('0x18')](_0x5de9cf)['end']();};}function respondWithResult(_0x582bc2,_0x29ed86){_0x29ed86=_0x29ed86||0xc8;return function(_0x3ec1d1){if(_0x3ec1d1){return _0x582bc2[_0x394b('0x18')](_0x29ed86)[_0x394b('0x19')](_0x3ec1d1);}};}function respondWithFilteredResult(_0x37d056,_0x50a984){return function(_0x4dc0e9){if(_0x4dc0e9){var _0x4dd99f=typeof _0x50a984[_0x394b('0x1a')]===_0x394b('0x1b')&&typeof _0x50a984['limit']==='undefined';var _0x5cbb7a=_0x4dc0e9[_0x394b('0x1c')];var _0x26f694=_0x4dd99f?0x0:_0x50a984[_0x394b('0x1a')];var _0x1e2fa2=_0x4dd99f?_0x4dc0e9['count']:_0x50a984[_0x394b('0x1a')]+_0x50a984[_0x394b('0x1d')];var _0x578062;if(_0x1e2fa2>=_0x5cbb7a){_0x1e2fa2=_0x5cbb7a;_0x578062=0xc8;}else{_0x578062=0xce;}_0x37d056[_0x394b('0x18')](_0x578062);return _0x37d056['set'](_0x394b('0x1e'),_0x26f694+'-'+_0x1e2fa2+'/'+_0x5cbb7a)[_0x394b('0x19')](_0x4dc0e9);}return null;};}function patchUpdates(_0x148ab3){return function(_0x13ba7c){try{jsonpatch[_0x394b('0x1f')](_0x13ba7c,_0x148ab3,!![]);}catch(_0x56db78){return BPromise[_0x394b('0x20')](_0x56db78);}return _0x13ba7c['save']();};}function saveUpdates(_0x32bd6a,_0x15e91c){return function(_0x22cbf2){if(_0x22cbf2){return _0x22cbf2[_0x394b('0x21')](_0x32bd6a)['then'](function(_0x1a8b3b){return _0x1a8b3b;});}return null;};}function removeEntity(_0x2c434b,_0xf336fa){return function(_0x2d3770){if(_0x2d3770){return _0x2d3770[_0x394b('0x22')]()[_0x394b('0x23')](function(){_0x2c434b[_0x394b('0x18')](0xcc)[_0x394b('0x24')]();});}};}function handleEntityNotFound(_0x13d66f,_0x4f78ca){return function(_0x2a2e94){if(!_0x2a2e94){_0x13d66f['sendStatus'](0x194);}return _0x2a2e94;};}function handleError(_0x5699da,_0x4c9272){_0x4c9272=_0x4c9272||0x1f4;return function(_0x4282a7){logger[_0x394b('0x25')](_0x4282a7[_0x394b('0x26')]);if(_0x4282a7[_0x394b('0x27')]){delete _0x4282a7['name'];}_0x5699da[_0x394b('0x18')](_0x4c9272)[_0x394b('0x28')](_0x4282a7);};}exports[_0x394b('0x29')]=function(_0x19212a,_0x2c5bcd){var _0x556396={},_0x3223b3={},_0x3b06ab={'count':0x0,'rows':[]};var _0x353160=_['map'](db[_0x394b('0x2a')]['rawAttributes'],function(_0x8de99d){return{'name':_0x8de99d[_0x394b('0x2b')],'type':_0x8de99d[_0x394b('0x2c')]['key']};});_0x3223b3[_0x394b('0x2d')]=_[_0x394b('0x2e')](_0x353160,_0x394b('0x27'));_0x3223b3['query']=_['keys'](_0x19212a[_0x394b('0x2f')]);_0x3223b3[_0x394b('0x30')]=_[_0x394b('0x31')](_0x3223b3[_0x394b('0x2d')],_0x3223b3[_0x394b('0x2f')]);_0x556396[_0x394b('0x32')]=_[_0x394b('0x31')](_0x3223b3['model'],qs['fields'](_0x19212a[_0x394b('0x2f')][_0x394b('0x33')]));_0x556396['attributes']=_0x556396[_0x394b('0x32')][_0x394b('0x34')]?_0x556396[_0x394b('0x32')]:_0x3223b3['model'];if(!_0x19212a[_0x394b('0x2f')][_0x394b('0x35')](_0x394b('0x36'))){_0x556396[_0x394b('0x1d')]=qs[_0x394b('0x1d')](_0x19212a['query']['limit']);_0x556396[_0x394b('0x1a')]=qs['offset'](_0x19212a['query'][_0x394b('0x1a')]);}_0x556396[_0x394b('0x37')]=qs[_0x394b('0x38')](_0x19212a['query'][_0x394b('0x38')]);_0x556396[_0x394b('0x39')]=qs[_0x394b('0x30')](_[_0x394b('0x3a')](_0x19212a['query'],_0x3223b3[_0x394b('0x30')]),_0x353160);if(_0x19212a[_0x394b('0x2f')][_0x394b('0x3b')]){_0x556396[_0x394b('0x39')]=_['merge'](_0x556396['where'],{'$or':_[_0x394b('0x2e')](_0x353160,function(_0x5cfe5b){if(_0x5cfe5b[_0x394b('0x2c')]!==_0x394b('0x3c')){var _0x297a7e={};_0x297a7e[_0x5cfe5b['name']]={'$like':'%'+_0x19212a[_0x394b('0x2f')][_0x394b('0x3b')]+'%'};return _0x297a7e;}})});}_0x556396=_[_0x394b('0x3d')]({},_0x556396,_0x19212a[_0x394b('0x3e')]);var _0x2c4eca={'where':_0x556396[_0x394b('0x39')]};return db[_0x394b('0x2a')]['count'](_0x2c4eca)[_0x394b('0x23')](function(_0x1eaf33){_0x3b06ab['count']=_0x1eaf33;if(_0x19212a['query'][_0x394b('0x3f')]){_0x556396['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x394b('0x40')](_0x556396);})[_0x394b('0x23')](function(_0x3f714f){_0x3b06ab['rows']=_0x3f714f;return _0x3b06ab;})[_0x394b('0x23')](respondWithFilteredResult(_0x2c5bcd,_0x556396))[_0x394b('0x41')](handleError(_0x2c5bcd,null));};exports['show']=function(_0xeb489b,_0x41c992){var _0x11b43e={'raw':!![],'where':{'id':_0xeb489b[_0x394b('0x42')]['id']}},_0x23b3bb={};_0x23b3bb['model']=_[_0x394b('0x43')](db[_0x394b('0x2a')]['rawAttributes']);_0x23b3bb[_0x394b('0x2f')]=_[_0x394b('0x43')](_0xeb489b[_0x394b('0x2f')]);_0x23b3bb['filters']=_['intersection'](_0x23b3bb[_0x394b('0x2d')],_0x23b3bb['query']);_0x11b43e[_0x394b('0x32')]=_[_0x394b('0x31')](_0x23b3bb['model'],qs[_0x394b('0x33')](_0xeb489b['query']['fields']));_0x11b43e[_0x394b('0x32')]=_0x11b43e[_0x394b('0x32')][_0x394b('0x34')]?_0x11b43e[_0x394b('0x32')]:_0x23b3bb[_0x394b('0x2d')];if(_0xeb489b['query'][_0x394b('0x3f')]){_0x11b43e[_0x394b('0x44')]=[{'all':!![]}];}_0x11b43e=_[_0x394b('0x3d')]({},_0x11b43e,_0xeb489b[_0x394b('0x3e')]);return db[_0x394b('0x2a')]['find'](_0x11b43e)[_0x394b('0x23')](handleEntityNotFound(_0x41c992,null))[_0x394b('0x23')](respondWithResult(_0x41c992,null))['catch'](handleError(_0x41c992,null));};exports['create']=function(_0x23162f,_0x244086){return db[_0x394b('0x2a')][_0x394b('0x45')](_0x23162f[_0x394b('0x46')],{})[_0x394b('0x23')](respondWithResult(_0x244086,0xc9))[_0x394b('0x41')](handleError(_0x244086,null));};exports[_0x394b('0x21')]=function(_0x121932,_0x4c84f3){if(_0x121932[_0x394b('0x46')]['id']){delete _0x121932['body']['id'];}return db[_0x394b('0x2a')][_0x394b('0x47')]({'where':{'id':_0x121932[_0x394b('0x42')]['id']}})[_0x394b('0x23')](handleEntityNotFound(_0x4c84f3,null))[_0x394b('0x23')](saveUpdates(_0x121932['body'],null))[_0x394b('0x23')](respondWithResult(_0x4c84f3,null))[_0x394b('0x41')](handleError(_0x4c84f3,null));};exports[_0x394b('0x22')]=function(_0xa6d49,_0x3fdcdb){return db[_0x394b('0x2a')][_0x394b('0x47')]({'where':{'id':_0xa6d49[_0x394b('0x42')]['id']}})[_0x394b('0x23')](handleEntityNotFound(_0x3fdcdb,null))[_0x394b('0x23')](removeEntity(_0x3fdcdb,null))[_0x394b('0x41')](handleError(_0x3fdcdb,null));}; \ No newline at end of file +var _0xf835=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','sort','where','pick','filters','merge','options','includeAll','include','catch','length','create','body','destroy','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x4404c5,_0x3d9f5c){var _0x30f6c7=function(_0x4e3ee2){while(--_0x4e3ee2){_0x4404c5['push'](_0x4404c5['shift']());}};_0x30f6c7(++_0x3d9f5c);}(_0xf835,0x10c));var _0x5f83=function(_0x2df3fe,_0x34e7dc){_0x2df3fe=_0x2df3fe-0x0;var _0x2cce43=_0xf835[_0x2df3fe];return _0x2cce43;};'use strict';var emlformat=require(_0x5f83('0x0'));var rimraf=require(_0x5f83('0x1'));var zipdir=require(_0x5f83('0x2'));var jsonpatch=require(_0x5f83('0x3'));var rp=require(_0x5f83('0x4'));var moment=require(_0x5f83('0x5'));var BPromise=require(_0x5f83('0x6'));var Mustache=require('mustache');var util=require(_0x5f83('0x7'));var path=require('path');var sox=require(_0x5f83('0x8'));var csv=require(_0x5f83('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f83('0xa'));var _=require(_0x5f83('0xb'));var squel=require(_0x5f83('0xc'));var crypto=require(_0x5f83('0xd'));var jsforce=require(_0x5f83('0xe'));var deskjs=require(_0x5f83('0xf'));var toCsv=require(_0x5f83('0x9'));var querystring=require(_0x5f83('0x10'));var Papa=require(_0x5f83('0x11'));var Redis=require(_0x5f83('0x12'));var authService=require(_0x5f83('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5f83('0x14'));var hardwareService=require(_0x5f83('0x15'));var logger=require('../../config/logger')(_0x5f83('0x16'));var utils=require(_0x5f83('0x17'));var config=require(_0x5f83('0x18'));var licenseUtil=require(_0x5f83('0x19'));var db=require(_0x5f83('0x1a'))['db'];function respondWithStatusCode(_0x3951a0,_0xa9a0e3){_0xa9a0e3=_0xa9a0e3||0xcc;return function(_0x4efc10){if(_0x4efc10){return _0x3951a0[_0x5f83('0x1b')](_0xa9a0e3);}return _0x3951a0[_0x5f83('0x1c')](_0xa9a0e3)['end']();};}function respondWithResult(_0x10fa7e,_0x188390){_0x188390=_0x188390||0xc8;return function(_0x42ead7){if(_0x42ead7){return _0x10fa7e[_0x5f83('0x1c')](_0x188390)[_0x5f83('0x1d')](_0x42ead7);}};}function respondWithFilteredResult(_0x103c0f,_0xc12775){return function(_0x495aaf){if(_0x495aaf){var _0x1e3880=typeof _0xc12775[_0x5f83('0x1e')]===_0x5f83('0x1f')&&typeof _0xc12775['limit']==='undefined';var _0xee690a=_0x495aaf[_0x5f83('0x20')];var _0xfbc23b=_0x1e3880?0x0:_0xc12775['offset'];var _0x2da228=_0x1e3880?_0x495aaf[_0x5f83('0x20')]:_0xc12775['offset']+_0xc12775['limit'];var _0x594e0a;if(_0x2da228>=_0xee690a){_0x2da228=_0xee690a;_0x594e0a=0xc8;}else{_0x594e0a=0xce;}_0x103c0f['status'](_0x594e0a);return _0x103c0f[_0x5f83('0x21')](_0x5f83('0x22'),_0xfbc23b+'-'+_0x2da228+'/'+_0xee690a)[_0x5f83('0x1d')](_0x495aaf);}return null;};}function patchUpdates(_0x2615ee){return function(_0x5672aa){try{jsonpatch[_0x5f83('0x23')](_0x5672aa,_0x2615ee,!![]);}catch(_0x40fe26){return BPromise[_0x5f83('0x24')](_0x40fe26);}return _0x5672aa[_0x5f83('0x25')]();};}function saveUpdates(_0x5042ca,_0x534415){return function(_0x5cd3e6){if(_0x5cd3e6){return _0x5cd3e6[_0x5f83('0x26')](_0x5042ca)[_0x5f83('0x27')](function(_0x208381){return _0x208381;});}return null;};}function removeEntity(_0x111ac7,_0x21af22){return function(_0x103192){if(_0x103192){return _0x103192['destroy']()[_0x5f83('0x27')](function(){_0x111ac7[_0x5f83('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x189c31,_0x29bdf8){return function(_0x1ec460){if(!_0x1ec460){_0x189c31['sendStatus'](0x194);}return _0x1ec460;};}function handleError(_0x155283,_0x535d37){_0x535d37=_0x535d37||0x1f4;return function(_0x3949e5){logger[_0x5f83('0x28')](_0x3949e5[_0x5f83('0x29')]);if(_0x3949e5['name']){delete _0x3949e5[_0x5f83('0x2a')];}_0x155283[_0x5f83('0x1c')](_0x535d37)[_0x5f83('0x2b')](_0x3949e5);};}exports[_0x5f83('0x2c')]=function(_0x1ba57d,_0x5e73cc){var _0x199eb8={},_0x14954e={},_0x38e777={'count':0x0,'rows':[]};var _0x20db99=_['map'](db[_0x5f83('0x2d')][_0x5f83('0x2e')],function(_0x23a663){return{'name':_0x23a663[_0x5f83('0x2f')],'type':_0x23a663[_0x5f83('0x30')][_0x5f83('0x31')]};});_0x14954e[_0x5f83('0x32')]=_['map'](_0x20db99,'name');_0x14954e[_0x5f83('0x33')]=_[_0x5f83('0x34')](_0x1ba57d[_0x5f83('0x33')]);_0x14954e['filters']=_[_0x5f83('0x35')](_0x14954e[_0x5f83('0x32')],_0x14954e[_0x5f83('0x33')]);_0x199eb8[_0x5f83('0x36')]=_[_0x5f83('0x35')](_0x14954e[_0x5f83('0x32')],qs['fields'](_0x1ba57d['query'][_0x5f83('0x37')]));_0x199eb8[_0x5f83('0x36')]=_0x199eb8[_0x5f83('0x36')]['length']?_0x199eb8[_0x5f83('0x36')]:_0x14954e[_0x5f83('0x32')];if(!_0x1ba57d[_0x5f83('0x33')]['hasOwnProperty'](_0x5f83('0x38'))){_0x199eb8['limit']=qs[_0x5f83('0x39')](_0x1ba57d['query'][_0x5f83('0x39')]);_0x199eb8[_0x5f83('0x1e')]=qs[_0x5f83('0x1e')](_0x1ba57d['query']['offset']);}_0x199eb8['order']=qs[_0x5f83('0x3a')](_0x1ba57d[_0x5f83('0x33')][_0x5f83('0x3a')]);_0x199eb8[_0x5f83('0x3b')]=qs['filters'](_[_0x5f83('0x3c')](_0x1ba57d['query'],_0x14954e[_0x5f83('0x3d')]),_0x20db99);if(_0x1ba57d[_0x5f83('0x33')]['filter']){_0x199eb8[_0x5f83('0x3b')]=_['merge'](_0x199eb8[_0x5f83('0x3b')],{'$or':_['map'](_0x20db99,function(_0x1cc312){if(_0x1cc312[_0x5f83('0x30')]!=='VIRTUAL'){var _0x575213={};_0x575213[_0x1cc312[_0x5f83('0x2a')]]={'$like':'%'+_0x1ba57d['query']['filter']+'%'};return _0x575213;}})});}_0x199eb8=_[_0x5f83('0x3e')]({},_0x199eb8,_0x1ba57d[_0x5f83('0x3f')]);var _0x2e9401={'where':_0x199eb8[_0x5f83('0x3b')]};return db['AnalyticTreeReport'][_0x5f83('0x20')](_0x2e9401)['then'](function(_0x2e09b1){_0x38e777[_0x5f83('0x20')]=_0x2e09b1;if(_0x1ba57d[_0x5f83('0x33')][_0x5f83('0x40')]){_0x199eb8[_0x5f83('0x41')]=[{'all':!![]}];}return db[_0x5f83('0x2d')]['findAll'](_0x199eb8);})[_0x5f83('0x27')](function(_0x18cf98){_0x38e777['rows']=_0x18cf98;return _0x38e777;})[_0x5f83('0x27')](respondWithFilteredResult(_0x5e73cc,_0x199eb8))[_0x5f83('0x42')](handleError(_0x5e73cc,null));};exports['show']=function(_0x5c0445,_0x268206){var _0x337029={'raw':!![],'where':{'id':_0x5c0445['params']['id']}},_0x1d539e={};_0x1d539e['model']=_[_0x5f83('0x34')](db['AnalyticTreeReport'][_0x5f83('0x2e')]);_0x1d539e[_0x5f83('0x33')]=_['keys'](_0x5c0445[_0x5f83('0x33')]);_0x1d539e[_0x5f83('0x3d')]=_[_0x5f83('0x35')](_0x1d539e['model'],_0x1d539e[_0x5f83('0x33')]);_0x337029['attributes']=_[_0x5f83('0x35')](_0x1d539e[_0x5f83('0x32')],qs[_0x5f83('0x37')](_0x5c0445[_0x5f83('0x33')][_0x5f83('0x37')]));_0x337029[_0x5f83('0x36')]=_0x337029['attributes'][_0x5f83('0x43')]?_0x337029[_0x5f83('0x36')]:_0x1d539e[_0x5f83('0x32')];if(_0x5c0445[_0x5f83('0x33')]['includeAll']){_0x337029[_0x5f83('0x41')]=[{'all':!![]}];}_0x337029=_[_0x5f83('0x3e')]({},_0x337029,_0x5c0445[_0x5f83('0x3f')]);return db['AnalyticTreeReport']['find'](_0x337029)[_0x5f83('0x27')](handleEntityNotFound(_0x268206,null))[_0x5f83('0x27')](respondWithResult(_0x268206,null))['catch'](handleError(_0x268206,null));};exports[_0x5f83('0x44')]=function(_0x45f365,_0x2bc60d){return db[_0x5f83('0x2d')][_0x5f83('0x44')](_0x45f365[_0x5f83('0x45')],{})['then'](respondWithResult(_0x2bc60d,0xc9))[_0x5f83('0x42')](handleError(_0x2bc60d,null));};exports['update']=function(_0x579889,_0x155e49){if(_0x579889[_0x5f83('0x45')]['id']){delete _0x579889[_0x5f83('0x45')]['id'];}return db[_0x5f83('0x2d')]['find']({'where':{'id':_0x579889['params']['id']}})[_0x5f83('0x27')](handleEntityNotFound(_0x155e49,null))[_0x5f83('0x27')](saveUpdates(_0x579889[_0x5f83('0x45')],null))[_0x5f83('0x27')](respondWithResult(_0x155e49,null))[_0x5f83('0x42')](handleError(_0x155e49,null));};exports[_0x5f83('0x46')]=function(_0x3f64b0,_0x25ab36){return db[_0x5f83('0x2d')][_0x5f83('0x47')]({'where':{'id':_0x3f64b0[_0x5f83('0x48')]['id']}})['then'](handleEntityNotFound(_0x25ab36,null))[_0x5f83('0x27')](removeEntity(_0x25ab36,null))[_0x5f83('0x42')](handleError(_0x25ab36,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 2c88be3..480f2a4 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 _0x3831=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x108a63,_0x350742){var _0x4d4254=function(_0x1427de){while(--_0x1427de){_0x108a63['push'](_0x108a63['shift']());}};_0x4d4254(++_0x350742);}(_0x3831,0xc3));var _0x1383=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x3831[_0x45ee03];return _0x13d535;};'use strict';var _=require(_0x1383('0x0'));var util=require(_0x1383('0x1'));var logger=require(_0x1383('0x2'))(_0x1383('0x3'));var moment=require(_0x1383('0x4'));var BPromise=require(_0x1383('0x5'));var rp=require(_0x1383('0x6'));var fs=require('fs');var path=require(_0x1383('0x7'));var rimraf=require(_0x1383('0x8'));var config=require(_0x1383('0x9'));var attributes=require(_0x1383('0xa'));module[_0x1383('0xb')]=function(_0x1d9c52,_0x586289){return _0x1d9c52[_0x1383('0xc')](_0x1383('0xd'),attributes,{'tableName':_0x1383('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5135=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xd56445,_0x2b8bd1){var _0xf1feda=function(_0x5c43a2){while(--_0x5c43a2){_0xd56445['push'](_0xd56445['shift']());}};_0xf1feda(++_0x2b8bd1);}(_0x5135,0x1c2));var _0x5513=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x5135[_0x3c2a69];return _0x596bc8;};'use strict';var _=require('lodash');var util=require(_0x5513('0x0'));var logger=require(_0x5513('0x1'))('api');var moment=require(_0x5513('0x2'));var BPromise=require(_0x5513('0x3'));var rp=require(_0x5513('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5513('0x5'));var config=require(_0x5513('0x6'));var attributes=require(_0x5513('0x7'));module[_0x5513('0x8')]=function(_0xca9440,_0x11f23e){return _0xca9440[_0x5513('0x9')](_0x5513('0xa'),attributes,{'tableName':_0x5513('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index ecde24c..8ffbbb5 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\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(_0x558a6b,_0x43532e){var _0x35e4c2=function(_0x40a747){while(--_0x40a747){_0x558a6b['push'](_0x558a6b['shift']());}};_0x35e4c2(++_0x43532e);}(_0x1261,0x144));var _0x1126=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x1261[_0x28089e];return _0x46a73c;};'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')]('AnalyticTreeReport,\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 +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\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(_0x232ff7,_0x32573f){var _0x6c5f43=function(_0x44ef8f){while(--_0x44ef8f){_0x232ff7['push'](_0x232ff7['shift']());}};_0x6c5f43(++_0x32573f);}(_0x1261,0x144));var _0x1126=function(_0x27b0c4,_0xaf6d02){_0x27b0c4=_0x27b0c4-0x0;var _0xcb87b2=_0x1261[_0x27b0c4];return _0xcb87b2;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 74d00c3..01b7e49 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 _0xe781=['destroy','exports','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x8a22de,_0x1fbd75){var _0x273eea=function(_0x55a01d){while(--_0x55a01d){_0x8a22de['push'](_0x8a22de['shift']());}};_0x273eea(++_0x1fbd75);}(_0xe781,0x1e8));var _0x1e78=function(_0x277b05,_0x2dc697){_0x277b05=_0x277b05-0x0;var _0x5bc781=_0xe781[_0x277b05];return _0x5bc781;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e78('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e78('0x1'));var auth=require(_0x1e78('0x2'));var interaction=require(_0x1e78('0x3'));var config=require(_0x1e78('0x4'));var controller=require(_0x1e78('0x5'));router[_0x1e78('0x6')]('/',auth[_0x1e78('0x7')](),controller[_0x1e78('0x8')]);router['get'](_0x1e78('0x9'),auth[_0x1e78('0x7')](),controller[_0x1e78('0xa')]);router[_0x1e78('0xb')]('/',auth['isAuthenticated'](),controller[_0x1e78('0xc')]);router[_0x1e78('0xd')]('/:id',auth[_0x1e78('0x7')](),controller[_0x1e78('0xe')]);router[_0x1e78('0xf')](_0x1e78('0x9'),auth[_0x1e78('0x7')](),controller[_0x1e78('0x10')]);module[_0x1e78('0x11')]=router; \ No newline at end of file +var _0x2c42=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d8d5f,_0x1adf93){var _0x10be5c=function(_0x6866bb){while(--_0x6866bb){_0x5d8d5f['push'](_0x5d8d5f['shift']());}};_0x10be5c(++_0x1adf93);}(_0x2c42,0x1a2));var _0x22c4=function(_0x24d15e,_0x242fa4){_0x24d15e=_0x24d15e-0x0;var _0x9dcd72=_0x2c42[_0x24d15e];return _0x9dcd72;};'use strict';var multer=require('multer');var util=require(_0x22c4('0x0'));var path=require(_0x22c4('0x1'));var timeout=require(_0x22c4('0x2'));var express=require(_0x22c4('0x3'));var router=express[_0x22c4('0x4')]();var fs_extra=require(_0x22c4('0x5'));var auth=require(_0x22c4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x22c4('0x7'));router[_0x22c4('0x8')]('/',auth[_0x22c4('0x9')](),controller[_0x22c4('0xa')]);router[_0x22c4('0x8')](_0x22c4('0xb'),auth[_0x22c4('0x9')](),controller[_0x22c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22c4('0xd')]);router[_0x22c4('0xe')](_0x22c4('0xb'),auth[_0x22c4('0x9')](),controller[_0x22c4('0xf')]);router[_0x22c4('0x10')](_0x22c4('0xb'),auth[_0x22c4('0x9')](),controller['destroy']);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 1cb888f..f938cb6 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 _0x1f63=['exports','STRING','sequelize'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x1f63,0x7a));var _0x31f6=function(_0x57f602,_0x1efb27){_0x57f602=_0x57f602-0x0;var _0x1fb86a=_0x1f63[_0x57f602];return _0x1fb86a;};'use strict';var Sequelize=require(_0x31f6('0x0'));module[_0x31f6('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x31f6('0x2')]},'type':{'type':Sequelize[_0x31f6('0x2')]}}; \ No newline at end of file +var _0xbc17=['STRING','sequelize','exports'];(function(_0x3d12d6,_0x3bb5a9){var _0x42e3fe=function(_0x2ed66c){while(--_0x2ed66c){_0x3d12d6['push'](_0x3d12d6['shift']());}};_0x42e3fe(++_0x3bb5a9);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x2a0fc4,_0x2eaf74){_0x2a0fc4=_0x2a0fc4-0x0;var _0x531d00=_0xbc17[_0x2a0fc4];return _0x531d00;};'use strict';var Sequelize=require(_0x7bc1('0x0'));module[_0x7bc1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x7bc1('0x2')]},'type':{'type':Sequelize[_0x7bc1('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index efc04c1..0e138a8 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 _0xbc70=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','findAll','rows','catch','show','keys','find','clone','params','get','omit','updatedAt','body','createdAt','create','destroy','originalname','basename','file','filename','type','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x150de7,_0x3e1c6b){var _0x3c2a16=function(_0x11324a){while(--_0x11324a){_0x150de7['push'](_0x150de7['shift']());}};_0x3c2a16(++_0x3e1c6b);}(_0xbc70,0x168));var _0x0bc7=function(_0x110338,_0x2b36f8){_0x110338=_0x110338-0x0;var _0x16bdcb=_0xbc70[_0x110338];return _0x16bdcb;};'use strict';var emlformat=require(_0x0bc7('0x0'));var rimraf=require(_0x0bc7('0x1'));var zipdir=require(_0x0bc7('0x2'));var jsonpatch=require(_0x0bc7('0x3'));var rp=require(_0x0bc7('0x4'));var moment=require(_0x0bc7('0x5'));var BPromise=require(_0x0bc7('0x6'));var Mustache=require(_0x0bc7('0x7'));var util=require(_0x0bc7('0x8'));var path=require(_0x0bc7('0x9'));var sox=require('sox');var csv=require(_0x0bc7('0xa'));var ejs=require(_0x0bc7('0xb'));var fs=require('fs');var fs_extra=require(_0x0bc7('0xc'));var _=require('lodash');var squel=require(_0x0bc7('0xd'));var crypto=require(_0x0bc7('0xe'));var jsforce=require(_0x0bc7('0xf'));var deskjs=require(_0x0bc7('0x10'));var toCsv=require(_0x0bc7('0xa'));var querystring=require(_0x0bc7('0x11'));var Papa=require(_0x0bc7('0x12'));var Redis=require(_0x0bc7('0x13'));var authService=require(_0x0bc7('0x14'));var qs=require(_0x0bc7('0x15'));var as=require(_0x0bc7('0x16'));var hardwareService=require(_0x0bc7('0x17'));var logger=require('../../config/logger')(_0x0bc7('0x18'));var utils=require(_0x0bc7('0x19'));var config=require(_0x0bc7('0x1a'));var licenseUtil=require(_0x0bc7('0x1b'));var db=require(_0x0bc7('0x1c'))['db'];function respondWithStatusCode(_0x435f19,_0x4cd51e){_0x4cd51e=_0x4cd51e||0xcc;return function(_0x42583b){if(_0x42583b){return _0x435f19['sendStatus'](_0x4cd51e);}return _0x435f19[_0x0bc7('0x1d')](_0x4cd51e)[_0x0bc7('0x1e')]();};}function respondWithResult(_0x2d4b1d,_0x191222){_0x191222=_0x191222||0xc8;return function(_0x49c66b){if(_0x49c66b){return _0x2d4b1d[_0x0bc7('0x1d')](_0x191222)[_0x0bc7('0x1f')](_0x49c66b);}};}function respondWithFilteredResult(_0x43daeb,_0x40bac2){return function(_0x53030d){if(_0x53030d){var _0x12c674=typeof _0x40bac2[_0x0bc7('0x20')]===_0x0bc7('0x21')&&typeof _0x40bac2[_0x0bc7('0x22')]===_0x0bc7('0x21');var _0x4260ce=_0x53030d[_0x0bc7('0x23')];var _0x4341e2=_0x12c674?0x0:_0x40bac2[_0x0bc7('0x20')];var _0x17dddb=_0x12c674?_0x53030d[_0x0bc7('0x23')]:_0x40bac2[_0x0bc7('0x20')]+_0x40bac2[_0x0bc7('0x22')];var _0x32b026;if(_0x17dddb>=_0x4260ce){_0x17dddb=_0x4260ce;_0x32b026=0xc8;}else{_0x32b026=0xce;}_0x43daeb['status'](_0x32b026);return _0x43daeb['set'](_0x0bc7('0x24'),_0x4341e2+'-'+_0x17dddb+'/'+_0x4260ce)['json'](_0x53030d);}return null;};}function patchUpdates(_0x37d90c){return function(_0x25f071){try{jsonpatch['apply'](_0x25f071,_0x37d90c,!![]);}catch(_0x2b56d4){return BPromise[_0x0bc7('0x25')](_0x2b56d4);}return _0x25f071[_0x0bc7('0x26')]();};}function saveUpdates(_0x3ee70f,_0x5690ba){return function(_0x4fa5d0){if(_0x4fa5d0){return _0x4fa5d0[_0x0bc7('0x27')](_0x3ee70f)[_0x0bc7('0x28')](function(_0x19839d){return _0x19839d;});}return null;};}function removeEntity(_0x59b92b,_0x213d0f){return function(_0x1a7fe5){if(_0x1a7fe5){return _0x1a7fe5['destroy']()['then'](function(){_0x59b92b[_0x0bc7('0x1d')](0xcc)[_0x0bc7('0x1e')]();});}};}function handleEntityNotFound(_0x2a2225,_0x5a17dc){return function(_0x5180bc){if(!_0x5180bc){_0x2a2225[_0x0bc7('0x29')](0x194);}return _0x5180bc;};}function handleError(_0x34ab06,_0x54bdab){_0x54bdab=_0x54bdab||0x1f4;return function(_0x397389){logger['error'](_0x397389[_0x0bc7('0x2a')]);if(_0x397389[_0x0bc7('0x2b')]){delete _0x397389[_0x0bc7('0x2b')];}_0x34ab06[_0x0bc7('0x1d')](_0x54bdab)[_0x0bc7('0x2c')](_0x397389);};}exports['index']=function(_0x223a32,_0x308ee3){var _0x391b94={},_0x4910fb={},_0xd71ee8={'count':0x0,'rows':[]};var _0x5a64c1=_[_0x0bc7('0x2d')](db['Attachment'][_0x0bc7('0x2e')],function(_0x2ec7ce){return{'name':_0x2ec7ce[_0x0bc7('0x2f')],'type':_0x2ec7ce['type'][_0x0bc7('0x30')]};});_0x4910fb[_0x0bc7('0x31')]=_[_0x0bc7('0x2d')](_0x5a64c1,'name');_0x4910fb[_0x0bc7('0x32')]=_['keys'](_0x223a32['query']);_0x4910fb[_0x0bc7('0x33')]=_[_0x0bc7('0x34')](_0x4910fb[_0x0bc7('0x31')],_0x4910fb[_0x0bc7('0x32')]);_0x391b94['attributes']=_[_0x0bc7('0x34')](_0x4910fb[_0x0bc7('0x31')],qs[_0x0bc7('0x35')](_0x223a32[_0x0bc7('0x32')]['fields']));_0x391b94['attributes']=_0x391b94[_0x0bc7('0x36')][_0x0bc7('0x37')]?_0x391b94[_0x0bc7('0x36')]:_0x4910fb[_0x0bc7('0x31')];if(!_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x38')]('nolimit')){_0x391b94[_0x0bc7('0x22')]=qs['limit'](_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x22')]);_0x391b94[_0x0bc7('0x20')]=qs[_0x0bc7('0x20')](_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x20')]);}_0x391b94[_0x0bc7('0x39')]=qs[_0x0bc7('0x3a')](_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x3a')]);_0x391b94[_0x0bc7('0x3b')]=qs[_0x0bc7('0x33')](_[_0x0bc7('0x3c')](_0x223a32[_0x0bc7('0x32')],_0x4910fb[_0x0bc7('0x33')]),_0x5a64c1);if(_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x3d')]){_0x391b94['where']=_[_0x0bc7('0x3e')](_0x391b94['where'],{'$or':_['map'](_0x5a64c1,function(_0x38cf0d){if(_0x38cf0d['type']!==_0x0bc7('0x3f')){var _0x4b7a74={};_0x4b7a74[_0x38cf0d[_0x0bc7('0x2b')]]={'$like':'%'+_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x3d')]+'%'};return _0x4b7a74;}})});}_0x391b94=_[_0x0bc7('0x3e')]({},_0x391b94,_0x223a32[_0x0bc7('0x40')]);var _0x4d10f2={'where':_0x391b94[_0x0bc7('0x3b')]};return db[_0x0bc7('0x41')]['count'](_0x4d10f2)[_0x0bc7('0x28')](function(_0x86ba75){_0xd71ee8[_0x0bc7('0x23')]=_0x86ba75;if(_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x42')]){_0x391b94[_0x0bc7('0x43')]=[{'all':!![]}];}return db[_0x0bc7('0x41')][_0x0bc7('0x44')](_0x391b94);})[_0x0bc7('0x28')](function(_0x265925){_0xd71ee8[_0x0bc7('0x45')]=_0x265925;return _0xd71ee8;})[_0x0bc7('0x28')](respondWithFilteredResult(_0x308ee3,_0x391b94))[_0x0bc7('0x46')](handleError(_0x308ee3,null));};exports[_0x0bc7('0x47')]=function(_0x42541f,_0x5d71f0){var _0x5b29cd={'raw':!![],'where':{'id':_0x42541f['params']['id']}},_0x1b7930={};_0x1b7930['model']=_[_0x0bc7('0x48')](db['Attachment'][_0x0bc7('0x2e')]);_0x1b7930['query']=_['keys'](_0x42541f['query']);_0x1b7930[_0x0bc7('0x33')]=_[_0x0bc7('0x34')](_0x1b7930[_0x0bc7('0x31')],_0x1b7930[_0x0bc7('0x32')]);_0x5b29cd[_0x0bc7('0x36')]=_[_0x0bc7('0x34')](_0x1b7930[_0x0bc7('0x31')],qs[_0x0bc7('0x35')](_0x42541f['query']['fields']));_0x5b29cd[_0x0bc7('0x36')]=_0x5b29cd[_0x0bc7('0x36')]['length']?_0x5b29cd[_0x0bc7('0x36')]:_0x1b7930[_0x0bc7('0x31')];if(_0x42541f[_0x0bc7('0x32')]['includeAll']){_0x5b29cd[_0x0bc7('0x43')]=[{'all':!![]}];}_0x5b29cd=_[_0x0bc7('0x3e')]({},_0x5b29cd,_0x42541f[_0x0bc7('0x40')]);return db[_0x0bc7('0x41')][_0x0bc7('0x49')](_0x5b29cd)[_0x0bc7('0x28')](handleEntityNotFound(_0x5d71f0,null))['then'](respondWithResult(_0x5d71f0,null))[_0x0bc7('0x46')](handleError(_0x5d71f0,null));};exports[_0x0bc7('0x4a')]=function(_0x486f32,_0x50cd85){var _0x29506d={'where':{'id':_0x486f32[_0x0bc7('0x4b')]['id']}},_0x440b10={};_0x440b10[_0x0bc7('0x31')]=_[_0x0bc7('0x48')](db[_0x0bc7('0x41')]['rawAttributes']);_0x29506d[_0x0bc7('0x36')]=_[_0x0bc7('0x34')](_0x440b10[_0x0bc7('0x31')],qs['fields'](_0x486f32['query'][_0x0bc7('0x35')]));_0x29506d[_0x0bc7('0x36')]=_0x29506d['attributes'][_0x0bc7('0x37')]?_0x29506d[_0x0bc7('0x36')]:_0x440b10[_0x0bc7('0x31')];if(_0x486f32[_0x0bc7('0x32')][_0x0bc7('0x42')]){_0x29506d['include']=[{'all':!![]}];}_0x29506d=_[_0x0bc7('0x3e')]({},_0x29506d,_0x486f32[_0x0bc7('0x40')]);return db[_0x0bc7('0x41')][_0x0bc7('0x49')](_0x29506d)[_0x0bc7('0x28')](handleEntityNotFound(_0x50cd85,null))['then'](function(_0x3427ad){if(_0x3427ad){var _0x3ae442=_0x3427ad[_0x0bc7('0x4c')]({'plain':!![]});_0x3ae442=qs[_0x0bc7('0x4d')](_0x3ae442,['id','createdAt',_0x0bc7('0x4e')]);_0x486f32['body']=_[_0x0bc7('0x4d')](_0x486f32[_0x0bc7('0x4f')],['id',_0x0bc7('0x50'),_0x0bc7('0x4e')]);return db[_0x0bc7('0x41')][_0x0bc7('0x51')](_['merge'](_0x3ae442,_0x486f32[_0x0bc7('0x4f')]),{'include':_0x486f32[_0x0bc7('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x0bc7('0x28')](respondWithResult(_0x50cd85,0xc9))[_0x0bc7('0x46')](handleError(_0x50cd85,null));};exports[_0x0bc7('0x27')]=function(_0x15ab16,_0x3c85d9){if(_0x15ab16['body']['id']){delete _0x15ab16[_0x0bc7('0x4f')]['id'];}return db['Attachment'][_0x0bc7('0x49')]({'where':{'id':_0x15ab16[_0x0bc7('0x4b')]['id']}})[_0x0bc7('0x28')](handleEntityNotFound(_0x3c85d9,null))['then'](saveUpdates(_0x15ab16[_0x0bc7('0x4f')],null))['then'](respondWithResult(_0x3c85d9,null))[_0x0bc7('0x46')](handleError(_0x3c85d9,null));};exports[_0x0bc7('0x52')]=function(_0x49f8fc,_0x585ed0){return db[_0x0bc7('0x41')][_0x0bc7('0x49')]({'where':{'id':_0x49f8fc[_0x0bc7('0x4b')]['id']}})[_0x0bc7('0x28')](handleEntityNotFound(_0x585ed0,null))[_0x0bc7('0x28')](removeEntity(_0x585ed0,null))[_0x0bc7('0x46')](handleError(_0x585ed0,null));};exports[_0x0bc7('0x51')]=function(_0x30db02,_0x4ce7fb,_0x466322){_0x30db02[_0x0bc7('0x4f')][_0x0bc7('0x2b')]=_0x30db02['file'][_0x0bc7('0x53')];_0x30db02['body'][_0x0bc7('0x54')]=_0x30db02[_0x0bc7('0x55')][_0x0bc7('0x56')];_0x30db02['body'][_0x0bc7('0x57')]=_0x30db02['file'][_0x0bc7('0x58')];return db[_0x0bc7('0x41')][_0x0bc7('0x51')](_0x30db02[_0x0bc7('0x4f')])[_0x0bc7('0x28')](respondWithResult(_0x4ce7fb,0xc9))[_0x0bc7('0x46')](handleError(_0x4ce7fb,null));};exports[_0x0bc7('0x59')]=function(_0x443f67,_0x43ba9a,_0x79d23f){return db[_0x0bc7('0x41')][_0x0bc7('0x5a')]({'where':{'id':_0x443f67[_0x0bc7('0x4b')]['id']},'raw':!![]})[_0x0bc7('0x28')](handleEntityNotFound(_0x43ba9a,null))[_0x0bc7('0x28')](function(_0x510bf5){if(_0x510bf5){var _0x29904e=_0x510bf5[_0x0bc7('0x5b')]!==null;var _0x1a02d4=path['join'](config[_0x0bc7('0x5c')],_0x0bc7('0x5d'));if(_0x29904e){_0x1a02d4=path[_0x0bc7('0x5e')](_0x1a02d4,_0x0bc7('0x5f'));}var _0x14ce39=path[_0x0bc7('0x5e')](_0x1a02d4,_0x510bf5[_0x0bc7('0x54')]);return _0x43ba9a[_0x0bc7('0x59')](_0x14ce39);}})[_0x0bc7('0x46')](handleError(_0x43ba9a,null));}; \ No newline at end of file +var _0xd5d6=['status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','map','Attachment','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','findOne','ChatOfflineMessageId','join','server/files/attachments/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xd5d6,0x1e5));var _0x6d5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6d5d('0x0'));var rimraf=require(_0x6d5d('0x1'));var zipdir=require(_0x6d5d('0x2'));var jsonpatch=require(_0x6d5d('0x3'));var rp=require(_0x6d5d('0x4'));var moment=require(_0x6d5d('0x5'));var BPromise=require(_0x6d5d('0x6'));var Mustache=require(_0x6d5d('0x7'));var util=require(_0x6d5d('0x8'));var path=require(_0x6d5d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d5d('0xa'));var _=require('lodash');var squel=require(_0x6d5d('0xb'));var crypto=require(_0x6d5d('0xc'));var jsforce=require(_0x6d5d('0xd'));var deskjs=require(_0x6d5d('0xe'));var toCsv=require(_0x6d5d('0xf'));var querystring=require('querystring');var Papa=require(_0x6d5d('0x10'));var Redis=require(_0x6d5d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6d5d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d5d('0x13'))(_0x6d5d('0x14'));var utils=require('../../config/utils');var config=require(_0x6d5d('0x15'));var licenseUtil=require(_0x6d5d('0x16'));var db=require(_0x6d5d('0x17'))['db'];function respondWithStatusCode(_0x408d84,_0x4222f7){_0x4222f7=_0x4222f7||0xcc;return function(_0x202c62){if(_0x202c62){return _0x408d84[_0x6d5d('0x18')](_0x4222f7);}return _0x408d84[_0x6d5d('0x19')](_0x4222f7)[_0x6d5d('0x1a')]();};}function respondWithResult(_0x14c82f,_0x28bb06){_0x28bb06=_0x28bb06||0xc8;return function(_0x4d22da){if(_0x4d22da){return _0x14c82f[_0x6d5d('0x19')](_0x28bb06)['json'](_0x4d22da);}};}function respondWithFilteredResult(_0x4fcc83,_0x4bcb32){return function(_0x545366){if(_0x545366){var _0x3a32bb=typeof _0x4bcb32['offset']===_0x6d5d('0x1b')&&typeof _0x4bcb32[_0x6d5d('0x1c')]===_0x6d5d('0x1b');var _0x30904a=_0x545366[_0x6d5d('0x1d')];var _0x457a3d=_0x3a32bb?0x0:_0x4bcb32[_0x6d5d('0x1e')];var _0x5d63b4=_0x3a32bb?_0x545366[_0x6d5d('0x1d')]:_0x4bcb32[_0x6d5d('0x1e')]+_0x4bcb32[_0x6d5d('0x1c')];var _0x373708;if(_0x5d63b4>=_0x30904a){_0x5d63b4=_0x30904a;_0x373708=0xc8;}else{_0x373708=0xce;}_0x4fcc83[_0x6d5d('0x19')](_0x373708);return _0x4fcc83['set'](_0x6d5d('0x1f'),_0x457a3d+'-'+_0x5d63b4+'/'+_0x30904a)[_0x6d5d('0x20')](_0x545366);}return null;};}function patchUpdates(_0x4977b8){return function(_0x4d5c39){try{jsonpatch[_0x6d5d('0x21')](_0x4d5c39,_0x4977b8,!![]);}catch(_0x48a50b){return BPromise[_0x6d5d('0x22')](_0x48a50b);}return _0x4d5c39['save']();};}function saveUpdates(_0x3775f8,_0x5a3065){return function(_0x944058){if(_0x944058){return _0x944058[_0x6d5d('0x23')](_0x3775f8)[_0x6d5d('0x24')](function(_0x405515){return _0x405515;});}return null;};}function removeEntity(_0x1e6a01,_0x3f41e6){return function(_0x1c91fc){if(_0x1c91fc){return _0x1c91fc[_0x6d5d('0x25')]()[_0x6d5d('0x24')](function(){_0x1e6a01[_0x6d5d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49aa67,_0x558e7d){return function(_0x4b1630){if(!_0x4b1630){_0x49aa67['sendStatus'](0x194);}return _0x4b1630;};}function handleError(_0x3d1e16,_0x14f8d9){_0x14f8d9=_0x14f8d9||0x1f4;return function(_0x16f72a){logger['error'](_0x16f72a[_0x6d5d('0x26')]);if(_0x16f72a[_0x6d5d('0x27')]){delete _0x16f72a[_0x6d5d('0x27')];}_0x3d1e16['status'](_0x14f8d9)['send'](_0x16f72a);};}exports[_0x6d5d('0x28')]=function(_0x53e4c,_0xd6d23){var _0x365925={},_0x2a0779={},_0x260f23={'count':0x0,'rows':[]};var _0x11be03=_[_0x6d5d('0x29')](db[_0x6d5d('0x2a')][_0x6d5d('0x2b')],function(_0x26b1b1){return{'name':_0x26b1b1[_0x6d5d('0x2c')],'type':_0x26b1b1['type'][_0x6d5d('0x2d')]};});_0x2a0779['model']=_[_0x6d5d('0x29')](_0x11be03,_0x6d5d('0x27'));_0x2a0779[_0x6d5d('0x2e')]=_[_0x6d5d('0x2f')](_0x53e4c['query']);_0x2a0779[_0x6d5d('0x30')]=_[_0x6d5d('0x31')](_0x2a0779[_0x6d5d('0x32')],_0x2a0779[_0x6d5d('0x2e')]);_0x365925[_0x6d5d('0x33')]=_['intersection'](_0x2a0779[_0x6d5d('0x32')],qs[_0x6d5d('0x34')](_0x53e4c[_0x6d5d('0x2e')][_0x6d5d('0x34')]));_0x365925[_0x6d5d('0x33')]=_0x365925[_0x6d5d('0x33')][_0x6d5d('0x35')]?_0x365925[_0x6d5d('0x33')]:_0x2a0779[_0x6d5d('0x32')];if(!_0x53e4c[_0x6d5d('0x2e')]['hasOwnProperty'](_0x6d5d('0x36'))){_0x365925['limit']=qs[_0x6d5d('0x1c')](_0x53e4c[_0x6d5d('0x2e')]['limit']);_0x365925[_0x6d5d('0x1e')]=qs['offset'](_0x53e4c[_0x6d5d('0x2e')][_0x6d5d('0x1e')]);}_0x365925[_0x6d5d('0x37')]=qs['sort'](_0x53e4c[_0x6d5d('0x2e')][_0x6d5d('0x38')]);_0x365925[_0x6d5d('0x39')]=qs['filters'](_['pick'](_0x53e4c[_0x6d5d('0x2e')],_0x2a0779[_0x6d5d('0x30')]),_0x11be03);if(_0x53e4c['query']['filter']){_0x365925[_0x6d5d('0x39')]=_[_0x6d5d('0x3a')](_0x365925[_0x6d5d('0x39')],{'$or':_[_0x6d5d('0x29')](_0x11be03,function(_0x4a2b23){if(_0x4a2b23[_0x6d5d('0x3b')]!==_0x6d5d('0x3c')){var _0x5ebf69={};_0x5ebf69[_0x4a2b23[_0x6d5d('0x27')]]={'$like':'%'+_0x53e4c['query'][_0x6d5d('0x3d')]+'%'};return _0x5ebf69;}})});}_0x365925=_[_0x6d5d('0x3a')]({},_0x365925,_0x53e4c[_0x6d5d('0x3e')]);var _0xc131e5={'where':_0x365925['where']};return db[_0x6d5d('0x2a')]['count'](_0xc131e5)[_0x6d5d('0x24')](function(_0x31356c){_0x260f23[_0x6d5d('0x1d')]=_0x31356c;if(_0x53e4c[_0x6d5d('0x2e')][_0x6d5d('0x3f')]){_0x365925[_0x6d5d('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x365925);})[_0x6d5d('0x24')](function(_0x1b28f4){_0x260f23[_0x6d5d('0x41')]=_0x1b28f4;return _0x260f23;})[_0x6d5d('0x24')](respondWithFilteredResult(_0xd6d23,_0x365925))[_0x6d5d('0x42')](handleError(_0xd6d23,null));};exports[_0x6d5d('0x43')]=function(_0x10aa5d,_0x45297a){var _0x353c3f={'raw':!![],'where':{'id':_0x10aa5d[_0x6d5d('0x44')]['id']}},_0x485d68={};_0x485d68[_0x6d5d('0x32')]=_[_0x6d5d('0x2f')](db[_0x6d5d('0x2a')]['rawAttributes']);_0x485d68['query']=_[_0x6d5d('0x2f')](_0x10aa5d[_0x6d5d('0x2e')]);_0x485d68['filters']=_[_0x6d5d('0x31')](_0x485d68[_0x6d5d('0x32')],_0x485d68['query']);_0x353c3f[_0x6d5d('0x33')]=_[_0x6d5d('0x31')](_0x485d68['model'],qs['fields'](_0x10aa5d[_0x6d5d('0x2e')][_0x6d5d('0x34')]));_0x353c3f[_0x6d5d('0x33')]=_0x353c3f['attributes']['length']?_0x353c3f[_0x6d5d('0x33')]:_0x485d68['model'];if(_0x10aa5d[_0x6d5d('0x2e')]['includeAll']){_0x353c3f[_0x6d5d('0x40')]=[{'all':!![]}];}_0x353c3f=_[_0x6d5d('0x3a')]({},_0x353c3f,_0x10aa5d['options']);return db[_0x6d5d('0x2a')][_0x6d5d('0x45')](_0x353c3f)[_0x6d5d('0x24')](handleEntityNotFound(_0x45297a,null))['then'](respondWithResult(_0x45297a,null))[_0x6d5d('0x42')](handleError(_0x45297a,null));};exports['clone']=function(_0x3e598b,_0x275e3d){var _0x3f730f={'where':{'id':_0x3e598b[_0x6d5d('0x44')]['id']}},_0x430223={};_0x430223[_0x6d5d('0x32')]=_[_0x6d5d('0x2f')](db['Attachment'][_0x6d5d('0x2b')]);_0x3f730f[_0x6d5d('0x33')]=_[_0x6d5d('0x31')](_0x430223[_0x6d5d('0x32')],qs[_0x6d5d('0x34')](_0x3e598b[_0x6d5d('0x2e')][_0x6d5d('0x34')]));_0x3f730f[_0x6d5d('0x33')]=_0x3f730f[_0x6d5d('0x33')][_0x6d5d('0x35')]?_0x3f730f[_0x6d5d('0x33')]:_0x430223[_0x6d5d('0x32')];if(_0x3e598b[_0x6d5d('0x2e')][_0x6d5d('0x3f')]){_0x3f730f[_0x6d5d('0x40')]=[{'all':!![]}];}_0x3f730f=_[_0x6d5d('0x3a')]({},_0x3f730f,_0x3e598b[_0x6d5d('0x3e')]);return db[_0x6d5d('0x2a')][_0x6d5d('0x45')](_0x3f730f)['then'](handleEntityNotFound(_0x275e3d,null))['then'](function(_0x2b5b9e){if(_0x2b5b9e){var _0x1533f1=_0x2b5b9e[_0x6d5d('0x46')]({'plain':!![]});_0x1533f1=qs[_0x6d5d('0x47')](_0x1533f1,['id',_0x6d5d('0x48'),_0x6d5d('0x49')]);_0x3e598b['body']=_[_0x6d5d('0x47')](_0x3e598b['body'],['id','createdAt',_0x6d5d('0x49')]);return db[_0x6d5d('0x2a')]['create'](_[_0x6d5d('0x3a')](_0x1533f1,_0x3e598b[_0x6d5d('0x4a')]),{'include':_0x3e598b[_0x6d5d('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x6d5d('0x24')](respondWithResult(_0x275e3d,0xc9))[_0x6d5d('0x42')](handleError(_0x275e3d,null));};exports[_0x6d5d('0x23')]=function(_0xe58b6b,_0x4996ed){if(_0xe58b6b[_0x6d5d('0x4a')]['id']){delete _0xe58b6b[_0x6d5d('0x4a')]['id'];}return db[_0x6d5d('0x2a')]['find']({'where':{'id':_0xe58b6b[_0x6d5d('0x44')]['id']}})[_0x6d5d('0x24')](handleEntityNotFound(_0x4996ed,null))[_0x6d5d('0x24')](saveUpdates(_0xe58b6b[_0x6d5d('0x4a')],null))[_0x6d5d('0x24')](respondWithResult(_0x4996ed,null))[_0x6d5d('0x42')](handleError(_0x4996ed,null));};exports['destroy']=function(_0x41c8b8,_0x4b01b7){return db['Attachment'][_0x6d5d('0x45')]({'where':{'id':_0x41c8b8[_0x6d5d('0x44')]['id']}})[_0x6d5d('0x24')](handleEntityNotFound(_0x4b01b7,null))[_0x6d5d('0x24')](removeEntity(_0x4b01b7,null))['catch'](handleError(_0x4b01b7,null));};exports[_0x6d5d('0x4b')]=function(_0x3716c0,_0x59a091,_0x3f200c){_0x3716c0[_0x6d5d('0x4a')][_0x6d5d('0x27')]=_0x3716c0[_0x6d5d('0x4c')][_0x6d5d('0x4d')];_0x3716c0[_0x6d5d('0x4a')][_0x6d5d('0x4e')]=_0x3716c0[_0x6d5d('0x4c')]['filename'];_0x3716c0[_0x6d5d('0x4a')][_0x6d5d('0x3b')]=_0x3716c0['file'][_0x6d5d('0x4f')];return db[_0x6d5d('0x2a')]['create'](_0x3716c0[_0x6d5d('0x4a')])[_0x6d5d('0x24')](respondWithResult(_0x59a091,0xc9))[_0x6d5d('0x42')](handleError(_0x59a091,null));};exports['download']=function(_0x8f9f08,_0x33a0d3,_0xf5b90){return db[_0x6d5d('0x2a')][_0x6d5d('0x50')]({'where':{'id':_0x8f9f08[_0x6d5d('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x33a0d3,null))['then'](function(_0x57aa9a){if(_0x57aa9a){var _0x7d6c30=_0x57aa9a[_0x6d5d('0x51')]!==null;var _0x5ebbb7=path[_0x6d5d('0x52')](config['root'],_0x6d5d('0x53'));if(_0x7d6c30){_0x5ebbb7=path[_0x6d5d('0x52')](_0x5ebbb7,'offline-chat/');}var _0x33f5a3=path[_0x6d5d('0x52')](_0x5ebbb7,_0x57aa9a['basename']);return _0x33a0d3[_0x6d5d('0x54')](_0x33f5a3);}})[_0x6d5d('0x42')](handleError(_0x33a0d3,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 21ed8eb..7b51271 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 _0xdb3c=['moment','bluebird','path','rimraf','../../config/environment','exports','Attachment','attachments','lodash','util','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb3c,0x1e1));var _0xcdb3=function(_0x22ea49,_0x4a785c){_0x22ea49=_0x22ea49-0x0;var _0x580ac8=_0xdb3c[_0x22ea49];return _0x580ac8;};'use strict';var _=require(_0xcdb3('0x0'));var util=require(_0xcdb3('0x1'));var logger=require('../../config/logger')(_0xcdb3('0x2'));var moment=require(_0xcdb3('0x3'));var BPromise=require(_0xcdb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdb3('0x5'));var rimraf=require(_0xcdb3('0x6'));var config=require(_0xcdb3('0x7'));var attributes=require('./attachment.attributes');module[_0xcdb3('0x8')]=function(_0x3efe3a,_0x1d7408){return _0x3efe3a['define'](_0xcdb3('0x9'),attributes,{'tableName':_0xcdb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ab2=['request-promise','path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment'];(function(_0x2b8b4d,_0x833705){var _0x38150e=function(_0x484130){while(--_0x484130){_0x2b8b4d['push'](_0x2b8b4d['shift']());}};_0x38150e(++_0x833705);}(_0x8ab2,0x174));var _0x28ab=function(_0x1d87f3,_0x4c5748){_0x1d87f3=_0x1d87f3-0x0;var _0x58ecce=_0x8ab2[_0x1d87f3];return _0x58ecce;};'use strict';var _=require(_0x28ab('0x0'));var util=require(_0x28ab('0x1'));var logger=require(_0x28ab('0x2'))(_0x28ab('0x3'));var moment=require(_0x28ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x28ab('0x5'));var fs=require('fs');var path=require(_0x28ab('0x6'));var rimraf=require(_0x28ab('0x7'));var config=require(_0x28ab('0x8'));var attributes=require('./attachment.attributes');module[_0x28ab('0x9')]=function(_0xdbbc6f,_0x387583){return _0xdbbc6f[_0x28ab('0xa')](_0x28ab('0xb'),attributes,{'tableName':_0x28ab('0xc'),'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 9fc134d..e888d10 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 _0x49e9=['request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5a633a,_0x4e8830){var _0x4a9df=function(_0x1a6732){while(--_0x1a6732){_0x5a633a['push'](_0x5a633a['shift']());}};_0x4a9df(++_0x4e8830);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('Attachment,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});}exports[_0x949e('0x16')]=function(_0x43498d){var _0x868913=this;return new Promise(function(_0x20333c,_0x5caac9){return db[_0x949e('0x17')][_0x949e('0x18')](_0x43498d[_0x949e('0x19')],{'raw':_0x43498d[_0x949e('0x1a')]?_0x43498d[_0x949e('0x1a')][_0x949e('0x1b')]===undefined?!![]:![]:!![]})[_0x949e('0xa')](function(_0x2f21bd){logger[_0x949e('0xb')](_0x949e('0x16'),_0x43498d);logger[_0x949e('0xd')](_0x949e('0x16'),_0x43498d,JSON[_0x949e('0xf')](_0x2f21bd));_0x20333c(_0x2f21bd);})[_0x949e('0x15')](function(_0x199d53){logger[_0x949e('0x10')]('CreateAttachment',_0x199d53[_0x949e('0x13')],_0x43498d);_0x5caac9(_0x868913[_0x949e('0x10')](0x1f4,_0x199d53['message']));});});}; \ No newline at end of file +var _0x0834=['message','result','catch','create','options','raw','CreateAttachment','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1dfcea,_0x59c299){var _0x19a567=function(_0x2dead0){while(--_0x2dead0){_0x1dfcea['push'](_0x1dfcea['shift']());}};_0x19a567(++_0x59c299);}(_0x0834,0x18e));var _0x4083=function(_0x2fb37d,_0x5ac84d){_0x2fb37d=_0x2fb37d-0x0;var _0x287bd9=_0x0834[_0x2fb37d];return _0x287bd9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4083('0x0'));var BPromise=require(_0x4083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('rpc');var config=require(_0x4083('0x4'));var jayson=require(_0x4083('0x5'));var client=jayson['client'][_0x4083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a54,_0x31c7ef,_0x26ed53){return new BPromise(function(_0x2c42bb,_0x1d56dd){return client[_0x4083('0x7')](_0x5c5a54,_0x26ed53)[_0x4083('0x8')](function(_0x3cee37){logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));logger[_0x4083('0xc')](_0x4083('0xd'),_0x31c7ef,_0x4083('0xb'),JSON[_0x4083('0xe')](_0x3cee37));if(_0x3cee37[_0x4083('0xf')]){if(_0x3cee37['error']['code']===0x1f4){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x3cee37['error'][_0x4083('0x10')]);return _0x1d56dd(_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x31c7ef,_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);return _0x2c42bb(_0x3cee37['error'][_0x4083('0x10')]);}else{logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));_0x2c42bb(_0x3cee37[_0x4083('0x11')]['message']);}})[_0x4083('0x12')](function(_0x10cadd){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x10cadd);_0x1d56dd(_0x10cadd);});});}exports['CreateAttachment']=function(_0x4e7d59){var _0x4d6089=this;return new Promise(function(_0xafda0c,_0x53d525){return db['Attachment'][_0x4083('0x13')](_0x4e7d59['body'],{'raw':_0x4e7d59[_0x4083('0x14')]?_0x4e7d59[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![]})[_0x4083('0x8')](function(_0x4b32e9){logger[_0x4083('0x9')]('CreateAttachment',_0x4e7d59);logger[_0x4083('0xc')](_0x4083('0x16'),_0x4e7d59,JSON[_0x4083('0xe')](_0x4b32e9));_0xafda0c(_0x4b32e9);})[_0x4083('0x12')](function(_0x5d7461){logger[_0x4083('0xf')]('CreateAttachment',_0x5d7461[_0x4083('0x10')],_0x4e7d59);_0x53d525(_0x4d6089[_0x4083('0xf')](0x1f4,_0x5d7461['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index c97805c..da60488 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 _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(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x0b0e,0x187));var _0xe0b0=function(_0x384d39,_0xf060fc){_0x384d39=_0x384d39-0x0;var _0x13bf22=_0x0b0e[_0x384d39];return _0x13bf22;};'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 +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x37edd7,_0xd238e6){var _0x1b83b5=function(_0x1b8122){while(--_0x1b8122){_0x37edd7['push'](_0x37edd7['shift']());}};_0x1b83b5(++_0xd238e6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44ab72,_0xf815c8){_0x44ab72=_0x44ab72-0x0;var _0x3e3476=_0x5f2f[_0x44ab72];return _0x3e3476;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4594775..5704107 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf324=['blocked','online','user','agent','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','url','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled'];(function(_0x206971,_0x49148c){var _0x39fce2=function(_0x4776a9){while(--_0x4776a9){_0x206971['push'](_0x206971['shift']());}};_0x39fce2(++_0x49148c);}(_0xf324,0xa6));var _0x4f32=function(_0x769fd9,_0x1d699e){_0x769fd9=_0x769fd9-0x0;var _0x1202b6=_0xf324[_0x769fd9];return _0x1202b6;};'use strict';var passport=require(_0x4f32('0x0'));var LocalStrategy=require(_0x4f32('0x1'))[_0x4f32('0x2')];var moment=require(_0x4f32('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x4f32('0x4'));var util=require(_0x4f32('0x5'));var db=require(_0x4f32('0x6'))['db'];var authService=require(_0x4f32('0x7'));var utils=require(_0x4f32('0x8'));var config=require(_0x4f32('0x9'));var logger=require(_0x4f32('0xa'))('api');function isActiveDirectoryConfigured(_0x5051e2){var _0x238d8a=![];if(typeof _0x5051e2[_0x4f32('0xb')]!==_0x4f32('0xc')){_0x238d8a=_0x5051e2[_0x4f32('0xb')]['baseDN']&&_0x5051e2[_0x4f32('0xb')][_0x4f32('0xd')]&&_0x5051e2[_0x4f32('0xb')][_0x4f32('0xe')];}return _0x238d8a;}function adAuthenticate(_0x1c1faf,_0x27c803,_0x13dc39){return new BPromise(function(_0x24d01c,_0x2a3e88){try{var _0x491cf0=new ActiveDirectory(_0x1c1faf);_0x491cf0['authenticate'](_0x27c803,_0x13dc39,function(_0x44f4d3,_0xaf3917){if(_0x44f4d3){logger['error'](_0x4f32('0xf'),_0x27c803,util[_0x4f32('0x10')](_0x44f4d3,{'showHidden':![],'depth':null}));_0x2a3e88(_0x4f32('0x11'));}else if(!_0xaf3917){logger[_0x4f32('0x12')](_0x4f32('0x13'),_0x27c803);_0x2a3e88(_0x4f32('0x11'));}else{_0x24d01c(_0xaf3917);}});}catch(_0x3c6daf){_0x2a3e88(_0x3c6daf);}});}function ActiveDirectoryAuthenticate(_0x25aad3,_0xda352a,_0x48a827,_0x194ad4){var _0x1bc483,_0x192461;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x4f32('0x14'),_0xda352a);return _0x194ad4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x4f32('0x15')][_0x4f32('0x16')]({'where':{'id':0x1},'attributes':[_0x4f32('0x17'),'blockDuration'],'raw':!![]})[_0x4f32('0x18')](function(_0x5ceba9){_0x1bc483=_0x5ceba9;if(!_0x1bc483[_0x4f32('0x17')]){logger[_0x4f32('0x12')](_0x4f32('0x19'),_0xda352a);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x25aad3[_0x4f32('0x16')]({'attributes':['id',_0x4f32('0x1a'),'password',_0x4f32('0x1b'),_0x4f32('0x1c'),_0x4f32('0x1d'),_0x4f32('0x1e'),'blockedAt',_0x4f32('0x1f')],'where':{'name':_0xda352a,'role':{'$or':['admin',_0x4f32('0x20'),_0x4f32('0x21')]},'adSsoEnabled':!![]}});})[_0x4f32('0x18')](function(_0x4ce898){if(!_0x4ce898||_0x4ce898&&_0x4ce898[_0x4f32('0x1a')]!==_0xda352a){throw new Error(_0x4f32('0x11'));}_0x192461=_0x4ce898;var _0x62be60=_0x192461['name']+'@'+config[_0x4f32('0xb')][_0x4f32('0xe')];return adAuthenticate(config[_0x4f32('0xb')],_0x62be60,_0x48a827);})['then'](function(_0x21b023){if(_0x192461[_0x4f32('0x1d')]){throw new Error(_0x4f32('0x11'));}if(_0x1bc483[_0x4f32('0x22')]>0x0){if(_0x192461[_0x4f32('0x1e')]){if(moment(_0x192461[_0x4f32('0x23')])[_0x4f32('0x24')](_0x1bc483[_0x4f32('0x22')],_0x4f32('0x25'))>moment()){throw new Error(_0x4f32('0x11'));}return utils[_0x4f32('0x26')](_0x192461,0x0,![],null)[_0x4f32('0x18')](function(){return utils['getLicense'](_0x192461);})['then'](function(){return _0x194ad4(null,_0x192461);});}else{return utils[_0x4f32('0x27')](_0x192461)[_0x4f32('0x18')](function(){return _0x194ad4(null,_0x192461);});}}else{return utils[_0x4f32('0x27')](_0x192461)[_0x4f32('0x18')](function(){return _0x194ad4(null,_0x192461);});}})[_0x4f32('0x28')](function(_0x302017){return _0x194ad4(null,![],_0x302017);});}function handleError(_0x31fcb5,_0x2fc04a,_0x357c25){return _0x31fcb5[_0x4f32('0x29')](_0x2fc04a||0x1f4)[_0x4f32('0x2a')]({'message':_0x357c25?_0x357c25[_0x4f32('0x2b')]||_0x357c25:''});}exports[_0x4f32('0x2c')]=function(_0x490698,_0x2c9666,_0x4f8242){passport['authenticate'](_0x4f32('0x2d'),function(_0x82c280,_0x16e0f1,_0x420c80){var _0x5c1669=_0x82c280||_0x420c80;if(_0x5c1669){return handleError(_0x2c9666,0x191,_0x5c1669);}if(!_0x16e0f1){return handleError(_0x2c9666,0x194,{'message':_0x4f32('0x2e')});}else{var _0x37af02={'payload':{'id':_0x16e0f1['id'],'role':_0x16e0f1[_0x4f32('0x1c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x37af02)['then'](function(_0x30da38){_0x2c9666[_0x4f32('0x2f')]({'id':_0x16e0f1['id'],'token':_0x30da38,'statusCall':'','isAlreadyLogged':_0x16e0f1['online']});});}})(_0x490698,_0x2c9666,_0x4f8242);};passport['use'](_0x4f32('0x2d'),new LocalStrategy({'usernameField':_0x4f32('0x1a'),'passwordField':'password'},function(_0x2ca8e2,_0x17b0ec,_0x3d657e){return ActiveDirectoryAuthenticate(db[_0x4f32('0x30')],_0x2ca8e2,_0x17b0ec,_0x3d657e);})); \ No newline at end of file +var _0x377e=['blocked','blockedAt','online','user','agent','domain','disabled','add','minutes','getLicense','catch','status','send','login','ad-login','signToken','json','use','User','passport','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role'];(function(_0x443cef,_0x2cd289){var _0x147c47=function(_0x56c979){while(--_0x56c979){_0x443cef['push'](_0x443cef['shift']());}};_0x147c47(++_0x2cd289);}(_0x377e,0x1e9));var _0xe377=function(_0x212950,_0x412c4a){_0x212950=_0x212950-0x0;var _0x1eb5d6=_0x377e[_0x212950];return _0x1eb5d6;};'use strict';var passport=require(_0xe377('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0xe377('0x1'));var BPromise=require(_0xe377('0x2'));var util=require(_0xe377('0x3'));var db=require(_0xe377('0x4'))['db'];var authService=require(_0xe377('0x5'));var utils=require(_0xe377('0x6'));var config=require(_0xe377('0x7'));var logger=require(_0xe377('0x8'))(_0xe377('0x9'));function isActiveDirectoryConfigured(_0x2cc42a){var _0x4c26ac=![];if(typeof _0x2cc42a[_0xe377('0xa')]!=='undefined'){_0x4c26ac=_0x2cc42a[_0xe377('0xa')][_0xe377('0xb')]&&_0x2cc42a['activedirectory']['url']&&_0x2cc42a[_0xe377('0xa')]['domain'];}return _0x4c26ac;}function adAuthenticate(_0x71745,_0x2c4ea2,_0x5cd665){return new BPromise(function(_0x541cf0,_0xa1e50){try{var _0x3e6a9c=new ActiveDirectory(_0x71745);_0x3e6a9c[_0xe377('0xc')](_0x2c4ea2,_0x5cd665,function(_0x2bdf60,_0x1abf8a){if(_0x2bdf60){logger[_0xe377('0xd')]('Error\x20authenticate\x20%s:\x20%s',_0x2c4ea2,util[_0xe377('0xe')](_0x2bdf60,{'showHidden':![],'depth':null}));_0xa1e50(_0xe377('0xf'));}else if(!_0x1abf8a){logger[_0xe377('0xd')](_0xe377('0x10'),_0x2c4ea2);_0xa1e50(_0xe377('0xf'));}else{_0x541cf0(_0x1abf8a);}});}catch(_0x376552){_0xa1e50(_0x376552);}});}function ActiveDirectoryAuthenticate(_0x13ee31,_0x260108,_0x521100,_0x5aeb2b){var _0x30e073,_0x3f15d9;if(!isActiveDirectoryConfigured(config)){logger[_0xe377('0xd')](_0xe377('0x11'),_0x260108);return _0x5aeb2b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xe377('0x12')][_0xe377('0x13')]({'where':{'id':0x1},'attributes':[_0xe377('0x14'),_0xe377('0x15')],'raw':!![]})[_0xe377('0x16')](function(_0x52d066){_0x30e073=_0x52d066;if(!_0x30e073[_0xe377('0x14')]){logger[_0xe377('0xd')](_0xe377('0x17'),_0x260108);throw new Error(_0xe377('0xf'));}return _0x13ee31[_0xe377('0x13')]({'attributes':['id',_0xe377('0x18'),_0xe377('0x19'),_0xe377('0x1a'),_0xe377('0x1b'),'disabled',_0xe377('0x1c'),_0xe377('0x1d'),_0xe377('0x1e')],'where':{'name':_0x260108,'role':{'$or':['admin',_0xe377('0x1f'),_0xe377('0x20')]},'adSsoEnabled':!![]}});})[_0xe377('0x16')](function(_0x5243b1){if(!_0x5243b1||_0x5243b1&&_0x5243b1[_0xe377('0x18')]!==_0x260108){throw new Error(_0xe377('0xf'));}_0x3f15d9=_0x5243b1;var _0x5d8014=_0x3f15d9[_0xe377('0x18')]+'@'+config[_0xe377('0xa')][_0xe377('0x21')];return adAuthenticate(config[_0xe377('0xa')],_0x5d8014,_0x521100);})['then'](function(_0x199c8a){if(_0x3f15d9[_0xe377('0x22')]){throw new Error(_0xe377('0xf'));}if(_0x30e073[_0xe377('0x15')]>0x0){if(_0x3f15d9[_0xe377('0x1c')]){if(moment(_0x3f15d9[_0xe377('0x1d')])[_0xe377('0x23')](_0x30e073[_0xe377('0x15')],_0xe377('0x24'))>moment()){throw new Error(_0xe377('0xf'));}return utils['clearBlockUser'](_0x3f15d9,0x0,![],null)[_0xe377('0x16')](function(){return utils[_0xe377('0x25')](_0x3f15d9);})['then'](function(){return _0x5aeb2b(null,_0x3f15d9);});}else{return utils[_0xe377('0x25')](_0x3f15d9)['then'](function(){return _0x5aeb2b(null,_0x3f15d9);});}}else{return utils[_0xe377('0x25')](_0x3f15d9)[_0xe377('0x16')](function(){return _0x5aeb2b(null,_0x3f15d9);});}})[_0xe377('0x26')](function(_0x2dde1c){return _0x5aeb2b(null,![],_0x2dde1c);});}function handleError(_0x5d23ea,_0xc19885,_0xbd5fc3){return _0x5d23ea[_0xe377('0x27')](_0xc19885||0x1f4)[_0xe377('0x28')]({'message':_0xbd5fc3?_0xbd5fc3['message']||_0xbd5fc3:''});}exports[_0xe377('0x29')]=function(_0x47bed2,_0xb9417d,_0x2f2e41){passport['authenticate'](_0xe377('0x2a'),function(_0x4b4c9a,_0x5c6146,_0x43dcb3){var _0x5122cd=_0x4b4c9a||_0x43dcb3;if(_0x5122cd){return handleError(_0xb9417d,0x191,_0x5122cd);}if(!_0x5c6146){return handleError(_0xb9417d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x569e8b={'payload':{'id':_0x5c6146['id'],'role':_0x5c6146[_0xe377('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xe377('0x2b')](_0x569e8b)[_0xe377('0x16')](function(_0x4c2e03){_0xb9417d[_0xe377('0x2c')]({'id':_0x5c6146['id'],'token':_0x4c2e03,'statusCall':'','isAlreadyLogged':_0x5c6146['online']});});}})(_0x47bed2,_0xb9417d,_0x2f2e41);};passport[_0xe377('0x2d')](_0xe377('0x2a'),new LocalStrategy({'usernameField':_0xe377('0x18'),'passwordField':_0xe377('0x19')},function(_0x2ddad3,_0x4f80fd,_0xab9188){return ActiveDirectoryAuthenticate(db[_0xe377('0x2e')],_0x2ddad3,_0x4f80fd,_0xab9188);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 0e2555d..f807e9f 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95dc=['login','exports','express','./authActiveDirectory.controller'];(function(_0x4ceb9d,_0x5d172c){var _0x4b35f7=function(_0x316c9a){while(--_0x316c9a){_0x4ceb9d['push'](_0x4ceb9d['shift']());}};_0x4b35f7(++_0x5d172c);}(_0x95dc,0x8a));var _0xc95d=function(_0x1e1f45,_0x24bda0){_0x1e1f45=_0x1e1f45-0x0;var _0x4df2b7=_0x95dc[_0x1e1f45];return _0x4df2b7;};'use strict';var express=require(_0xc95d('0x0'));var router=express['Router']();var controller=require(_0xc95d('0x1'));router['post']('/',controller[_0xc95d('0x2')]);module[_0xc95d('0x3')]=router; \ No newline at end of file +var _0xc763=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x692d3d,_0x36c9df){var _0x180d0a=function(_0x48b4e3){while(--_0x48b4e3){_0x692d3d['push'](_0x692d3d['shift']());}};_0x180d0a(++_0x36c9df);}(_0xc763,0xdb));var _0x3c76=function(_0xc69ffc,_0x6c5b2c){_0xc69ffc=_0xc69ffc-0x0;var _0x68bbf5=_0xc763[_0xc69ffc];return _0x68bbf5;};'use strict';var express=require(_0x3c76('0x0'));var router=express[_0x3c76('0x1')]();var controller=require(_0x3c76('0x2'));router[_0x3c76('0x3')]('/',controller[_0x3c76('0x4')]);module[_0x3c76('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e07a5ba..cec3d11 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x7a54,0x106));var _0x47a5=function(_0x39182c,_0x2810a3){_0x39182c=_0x39182c-0x0;var _0x2dedcd=_0x7a54[_0x39182c];return _0x2dedcd;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x7a54,0x106));var _0x47a5=function(_0x57bc53,_0x1cdaa6){_0x57bc53=_0x57bc53-0x0;var _0x120c3b=_0x7a54[_0x57bc53];return _0x120c3b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f6e79d4..dd7a7f1 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 _0x151d=['callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','login','get','/callback'];(function(_0x3d9732,_0x3d37cd){var _0x13f6b1=function(_0xb1a2de){while(--_0xb1a2de){_0x3d9732['push'](_0x3d9732['shift']());}};_0x13f6b1(++_0x3d37cd);}(_0x151d,0x1e7));var _0xd151=function(_0x776d43,_0x15a958){_0x776d43=_0x776d43-0x0;var _0x10fce5=_0x151d[_0x776d43];return _0x10fce5;};'use strict';var express=require(_0xd151('0x0'));var passport=require(_0xd151('0x1'));var router=express[_0xd151('0x2')]();var controller=require(_0xd151('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xd151('0x4'));router['get']('/',controller[_0xd151('0x5')]);router[_0xd151('0x6')](_0xd151('0x7'),controller[_0xd151('0x8')],authService[_0xd151('0x9')],userController[_0xd151('0x5')],authService['setTokenCookie']);module[_0xd151('0xa')]=router; \ No newline at end of file +var _0x02a0=['isMiddleware','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x468120,_0x3a5007){var _0x12e1c6=function(_0x23aad4){while(--_0x23aad4){_0x468120['push'](_0x468120['shift']());}};_0x12e1c6(++_0x3a5007);}(_0x02a0,0x1db));var _0x002a=function(_0x1d6d2f,_0x4f0757){_0x1d6d2f=_0x1d6d2f-0x0;var _0x4fc3ee=_0x02a0[_0x1d6d2f];return _0x4fc3ee;};'use strict';var express=require(_0x002a('0x0'));var passport=require(_0x002a('0x1'));var router=express[_0x002a('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x002a('0x3'));var authService=require(_0x002a('0x4'));router[_0x002a('0x5')]('/',controller[_0x002a('0x6')]);router['get'](_0x002a('0x7'),controller[_0x002a('0x8')],authService[_0x002a('0x9')],userController[_0x002a('0x6')],authService['setTokenCookie']);module[_0x002a('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 247e177..c87b75e 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 _0x1270=['signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','disabled','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','blockedAt','minutes','clearBlockUser','add','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1270,0x1b4));var _0x0127=function(_0x5a0cd1,_0x3f524f){_0x5a0cd1=_0x5a0cd1-0x0;var _0x2d1564=_0x1270[_0x5a0cd1];return _0x2d1564;};'use strict';var util=require('util');var passport=require(_0x0127('0x0'));var LocalStrategy=require(_0x0127('0x1'))[_0x0127('0x2')];var jayson=require(_0x0127('0x3'));var _=require(_0x0127('0x4'));var rs=require(_0x0127('0x5'));var moment=require('moment');var db=require(_0x0127('0x6'))['db'];var authService=require(_0x0127('0x7'));var utils=require(_0x0127('0x8'));var client=jayson['client'][_0x0127('0x9')]({'port':0x232b});function localAuthenticate(_0x35bf63,_0x351b23,_0x4f3608,_0x308183){var _0x291989,_0x4d0b29;return db[_0x0127('0xa')][_0x0127('0xb')]({'where':{'id':0x1},'attributes':[_0x0127('0xc'),_0x0127('0xd')],'raw':!![]})['then'](function(_0x393d74){_0x291989=_0x393d74;return _0x35bf63[_0x0127('0xb')]({'attributes':['id',_0x0127('0xe'),_0x0127('0xf'),'salt','role',_0x0127('0x10'),'blocked','blockedAt',_0x0127('0x11')],'where':{'name':_0x351b23,'role':{'$or':[_0x0127('0x12'),_0x0127('0x13'),_0x0127('0x14')]}}});})[_0x0127('0x15')](function(_0x3ded0d){if(!_0x3ded0d||_0x3ded0d&&_0x3ded0d['name']!==_0x351b23){throw new Error(_0x0127('0x16'));}else{_0x4d0b29=_0x3ded0d;return _0x4d0b29;}})[_0x0127('0x15')](function(){_0x4d0b29[_0x0127('0x17')](_0x4f3608,function(_0x3f633a,_0x31e56c){var _0x5c2f7d=_0x4d0b29[_0x0127('0x11')]+0x1;if(_0x3f633a){return _0x308183(_0x3f633a);}else if(!_0x31e56c){if(_0x4d0b29['disabled']){return _0x308183(null,![],{'message':_0x0127('0x16')});}else if(_0x291989[_0x0127('0xc')]>0x0){if(_0x4d0b29[_0x0127('0x18')]){if(_0x291989[_0x0127('0xd')]>0x0){if(moment(_0x4d0b29[_0x0127('0x19')])['add'](_0x291989[_0x0127('0xd')],_0x0127('0x1a'))>moment()){return _0x308183(null,![],{'message':_0x0127('0x16')});}else{return utils[_0x0127('0x1b')](_0x4d0b29,_0x5c2f7d,![],null)[_0x0127('0x15')](function(){return _0x308183(null,![],{'message':_0x0127('0x16')});});}}else{return _0x308183(null,![],{'message':_0x0127('0x16')});}}else{if(_0x5c2f7d>=_0x291989['allowedLoginAttempts']){return utils[_0x0127('0x1b')](_0x4d0b29,0x0,!![],moment())['then'](function(){return _0x308183(null,![],{'message':_0x0127('0x16')});});}else{return utils[_0x0127('0x1b')](_0x4d0b29,_0x5c2f7d,![],null)[_0x0127('0x15')](function(){return _0x308183(null,![],{'message':_0x0127('0x16')});});}}}else{return _0x308183(null,![],{'message':_0x0127('0x16')});}}else{if(_0x4d0b29[_0x0127('0x10')]){return _0x308183(null,![],{'message':_0x0127('0x16')});}else if(_0x291989[_0x0127('0xc')]>0x0){if(_0x4d0b29[_0x0127('0x18')]){if(_0x291989['blockDuration']>0x0){if(moment(_0x4d0b29[_0x0127('0x19')])[_0x0127('0x1c')](_0x291989[_0x0127('0xd')],'minutes')>moment()){return _0x308183(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0127('0x1b')](_0x4d0b29,0x0,![],null)[_0x0127('0x15')](function(){return utils['getLicense'](_0x4d0b29);})[_0x0127('0x15')](function(){return _0x308183(null,_0x4d0b29);});}}else{return _0x308183(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0127('0x1b')](_0x4d0b29,0x0,![],null)[_0x0127('0x15')](function(){return utils[_0x0127('0x1d')](_0x4d0b29);})[_0x0127('0x15')](function(){return _0x308183(null,_0x4d0b29);})['catch'](function(_0x2b2450){return _0x308183(null,![],_0x2b2450);});}}else{if(_0x4d0b29['blocked']){return _0x308183(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x4d0b29)[_0x0127('0x15')](function(){return _0x308183(null,_0x4d0b29);});}}}});})[_0x0127('0x1e')](function(_0x3042be){return _0x308183(null,![],_0x3042be);});}function sendServiceMail(_0x55dd87){return db['MailAccount'][_0x0127('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x0127('0xe'),_0x0127('0x20')],'include':[{'model':db[_0x0127('0x21')],'as':_0x0127('0x22'),'include':[{'model':db[_0x0127('0x23')],'as':_0x0127('0x23')}]}]})[_0x0127('0x15')](function(_0x46c199){if(!_0x46c199){throw new Error(_0x0127('0x24'));}var _0x506f0d=_0x46c199['getSmtpOptions']();var _0x51118e={'account':_0x506f0d,'message':_[_0x0127('0x25')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x46c199[_0x0127('0xe')],_0x46c199['email']||_0x46c199[_0x0127('0x22')][_0x0127('0x13')])},_0x55dd87)};return client['request'](_0x0127('0x26'),_0x51118e);})[_0x0127('0x15')](function(_0xf2ebfd){if(_0xf2ebfd[_0x0127('0x27')]){throw new Error(util[_0x0127('0x28')](_0x0127('0x29'),_0xf2ebfd['error'][_0x0127('0x2a')]||JSON[_0x0127('0x2b')](_0xf2ebfd[_0x0127('0x27')])));}return!![];});}function handleError(_0x439030,_0x5d26a1,_0x42866b){return _0x439030[_0x0127('0x2c')](_0x5d26a1||0x1f4)[_0x0127('0x2d')]({'message':_0x42866b?_0x42866b[_0x0127('0x2a')]||_0x42866b:''});}exports[_0x0127('0x2e')]=function(_0x1b9771,_0x190f32,_0x307dfc){passport[_0x0127('0x17')](_0x0127('0x2f'),function(_0x370fac,_0x1bffd7,_0x124f28){var _0x294a35=_0x370fac||_0x124f28;if(_0x294a35){return handleError(_0x190f32,0x191,_0x294a35);}if(!_0x1bffd7){return handleError(_0x190f32,0x194,{'message':_0x0127('0x30')});}else{var _0x5933a1={'payload':{'id':_0x1bffd7['id'],'role':_0x1bffd7[_0x0127('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0x0127('0x32')](_0x5933a1)[_0x0127('0x15')](function(_0x279d68){_0x190f32[_0x0127('0x33')]({'id':_0x1bffd7['id'],'token':_0x279d68,'statusCall':'','isAlreadyLogged':_0x1bffd7['online']});});}})(_0x1b9771,_0x190f32,_0x307dfc);};exports[_0x0127('0x34')]=function(_0x4ffaf3,_0xe97016){if(!_0x4ffaf3[_0x0127('0x35')][_0x0127('0x20')]){return handleError(_0xe97016,0x1f4,{'message':_0x0127('0x36')});}var _0x4f6fc3=rs[_0x0127('0x37')]();_0x4ffaf3[_0x0127('0x35')][_0x0127('0x20')]=_0x4ffaf3[_0x0127('0x35')]['email'][_0x0127('0x38')]()[_0x0127('0x39')]();var _0x3ece2c;return db[_0x0127('0xa')][_0x0127('0xb')]({'where':{'id':0x1},'attributes':[_0x0127('0xc'),_0x0127('0xd')],'raw':!![]})[_0x0127('0x15')](function(_0x22286d){_0x3ece2c=_0x22286d;return db[_0x0127('0x3a')][_0x0127('0x1f')]({'where':{'email':_0x4ffaf3[_0x0127('0x35')]['email']}});})[_0x0127('0x15')](function(_0xcf51c2){if(!_0xcf51c2){throw new Error(_0x0127('0x3b'));}if(_0xcf51c2['disabled']){throw new Error(_0x0127('0x3c'));}if(_0xcf51c2['blocked']){if(moment(_0xcf51c2['blockedAt'])[_0x0127('0x1c')](_0x3ece2c['blockDuration'],_0x0127('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xcf51c2[_0x0127('0x18')]=![];_0xcf51c2[_0x0127('0x19')]=null;}}_0xcf51c2[_0x0127('0x3d')]=_0x4f6fc3;_0xcf51c2[_0x0127('0x3e')]=Date[_0x0127('0x3f')]()+0x36ee80;return _0xcf51c2[_0x0127('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x4ffaf3['body']['email'],'subject':_0x0127('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x0127('0x42')+_0x0127('0x43')+_0x4ffaf3[_0x0127('0x44')]['host']+_0x0127('0x45')+_0x4f6fc3+'\x0a\x0a'+_0x0127('0x46')});})[_0x0127('0x15')](function(){_0xe97016['status'](0xc8)[_0x0127('0x2d')]({'message':_0x0127('0x47')});})[_0x0127('0x1e')](function(_0x472e2b){return handleError(_0xe97016,0x1f4,_0x472e2b);});};exports[_0x0127('0x48')]=function(_0x5754da,_0x305c9d){return db[_0x0127('0x3a')][_0x0127('0x1f')]({'where':{'resetPasswordToken':_0x5754da[_0x0127('0x49')][_0x0127('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x0127('0x3f')]()}}})[_0x0127('0x15')](function(_0x44fff7){if(!_0x44fff7){throw new Error(_0x0127('0x4b'));}return db[_0x0127('0xa')][_0x0127('0xb')]({'attributes':['id',_0x0127('0x4c'),_0x0127('0x4d'),_0x0127('0x4e')]})[_0x0127('0x15')](function(_0x580603){if(_0x580603['securePassword'])authService['validatePasswordPattern'](_0x5754da['body'][_0x0127('0xf')]);if(!_0x580603[_0x0127('0x4d')]||!_0x44fff7[_0x0127('0x4f')])return _0x44fff7;authService['validatePasswordHistory'](_0x5754da[_0x0127('0x35')][_0x0127('0xf')],_0x44fff7[_0x0127('0x4f')],_0x580603['passwordHistoryLimit']);return _0x44fff7;})['then'](function(){_0x44fff7[_0x0127('0xf')]=_0x5754da[_0x0127('0x35')][_0x0127('0xf')];_0x44fff7[_0x0127('0x3d')]=null;_0x44fff7['resetPasswordExpires']=null;return _0x44fff7['save']();});})[_0x0127('0x15')](function(){_0x305c9d[_0x0127('0x2c')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x0127('0x1e')](function(_0x4fdf1d){return handleError(_0x305c9d,0x1f4,_0x4fdf1d);});};passport[_0x0127('0x50')](_0x0127('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':_0x0127('0xf')},function(_0x13d023,_0x265ad1,_0x75c844){return localAuthenticate(db['User'],_0x13d023,_0x265ad1,_0x75c844);})); \ No newline at end of file +var _0x0c69=['jayson/promise','lodash','randomstring','../../components/auth/service','../../config/utils','client','http','findOne','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','allowedLoginAttempts','add','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','format','email','SendMail','error','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','Setting','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','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','passport-local'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c69,0x96));var _0x90c6=function(_0x57d961,_0xd0800b){_0x57d961=_0x57d961-0x0;var _0x2ee280=_0x0c69[_0x57d961];return _0x2ee280;};'use strict';var util=require('util');var passport=require(_0x90c6('0x0'));var LocalStrategy=require(_0x90c6('0x1'))['Strategy'];var jayson=require(_0x90c6('0x2'));var _=require(_0x90c6('0x3'));var rs=require(_0x90c6('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x90c6('0x5'));var utils=require(_0x90c6('0x6'));var client=jayson[_0x90c6('0x7')][_0x90c6('0x8')]({'port':0x232b});function localAuthenticate(_0x3742a0,_0x23d36d,_0x55b607,_0x19e782){var _0xba9bd7,_0x2b7fad;return db['Setting'][_0x90c6('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x90c6('0xa')],'raw':!![]})[_0x90c6('0xb')](function(_0x489658){_0xba9bd7=_0x489658;return _0x3742a0[_0x90c6('0x9')]({'attributes':['id',_0x90c6('0xc'),'password','salt',_0x90c6('0xd'),_0x90c6('0xe'),_0x90c6('0xf'),_0x90c6('0x10'),_0x90c6('0x11')],'where':{'name':_0x23d36d,'role':{'$or':[_0x90c6('0x12'),_0x90c6('0x13'),_0x90c6('0x14')]}}});})[_0x90c6('0xb')](function(_0x5f2b5a){if(!_0x5f2b5a||_0x5f2b5a&&_0x5f2b5a[_0x90c6('0xc')]!==_0x23d36d){throw new Error(_0x90c6('0x15'));}else{_0x2b7fad=_0x5f2b5a;return _0x2b7fad;}})[_0x90c6('0xb')](function(){_0x2b7fad[_0x90c6('0x16')](_0x55b607,function(_0x12796f,_0xdfe19d){var _0x1cee74=_0x2b7fad[_0x90c6('0x11')]+0x1;if(_0x12796f){return _0x19e782(_0x12796f);}else if(!_0xdfe19d){if(_0x2b7fad[_0x90c6('0xe')]){return _0x19e782(null,![],{'message':_0x90c6('0x15')});}else if(_0xba9bd7['allowedLoginAttempts']>0x0){if(_0x2b7fad[_0x90c6('0xf')]){if(_0xba9bd7[_0x90c6('0xa')]>0x0){if(moment(_0x2b7fad[_0x90c6('0x10')])['add'](_0xba9bd7[_0x90c6('0xa')],_0x90c6('0x17'))>moment()){return _0x19e782(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x90c6('0x18')](_0x2b7fad,_0x1cee74,![],null)[_0x90c6('0xb')](function(){return _0x19e782(null,![],{'message':_0x90c6('0x15')});});}}else{return _0x19e782(null,![],{'message':_0x90c6('0x15')});}}else{if(_0x1cee74>=_0xba9bd7[_0x90c6('0x19')]){return utils['clearBlockUser'](_0x2b7fad,0x0,!![],moment())[_0x90c6('0xb')](function(){return _0x19e782(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x90c6('0x18')](_0x2b7fad,_0x1cee74,![],null)[_0x90c6('0xb')](function(){return _0x19e782(null,![],{'message':_0x90c6('0x15')});});}}}else{return _0x19e782(null,![],{'message':_0x90c6('0x15')});}}else{if(_0x2b7fad[_0x90c6('0xe')]){return _0x19e782(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xba9bd7[_0x90c6('0x19')]>0x0){if(_0x2b7fad[_0x90c6('0xf')]){if(_0xba9bd7[_0x90c6('0xa')]>0x0){if(moment(_0x2b7fad[_0x90c6('0x10')])[_0x90c6('0x1a')](_0xba9bd7[_0x90c6('0xa')],_0x90c6('0x17'))>moment()){return _0x19e782(null,![],{'message':_0x90c6('0x15')});}else{return utils['clearBlockUser'](_0x2b7fad,0x0,![],null)['then'](function(){return utils[_0x90c6('0x1b')](_0x2b7fad);})[_0x90c6('0xb')](function(){return _0x19e782(null,_0x2b7fad);});}}else{return _0x19e782(null,![],{'message':_0x90c6('0x15')});}}else{return utils[_0x90c6('0x18')](_0x2b7fad,0x0,![],null)[_0x90c6('0xb')](function(){return utils[_0x90c6('0x1b')](_0x2b7fad);})[_0x90c6('0xb')](function(){return _0x19e782(null,_0x2b7fad);})['catch'](function(_0x41a62b){return _0x19e782(null,![],_0x41a62b);});}}else{if(_0x2b7fad[_0x90c6('0xf')]){return _0x19e782(null,![],{'message':_0x90c6('0x15')});}else{return utils[_0x90c6('0x1b')](_0x2b7fad)[_0x90c6('0xb')](function(){return _0x19e782(null,_0x2b7fad);});}}}});})[_0x90c6('0x1c')](function(_0x1f160a){return _0x19e782(null,![],_0x1f160a);});}function sendServiceMail(_0x1dfe89){return db['MailAccount'][_0x90c6('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x90c6('0xc'),'email'],'include':[{'model':db[_0x90c6('0x1e')],'as':_0x90c6('0x1f'),'include':[{'model':db['CloudProvider'],'as':_0x90c6('0x20')}]}]})[_0x90c6('0xb')](function(_0x25cf54){if(!_0x25cf54){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2388df=_0x25cf54[_0x90c6('0x21')]();var _0x23bded={'account':_0x2388df,'message':_[_0x90c6('0x22')]({'from':util[_0x90c6('0x23')]('\x22%s\x22\x20<%s>',_0x25cf54[_0x90c6('0xc')],_0x25cf54[_0x90c6('0x24')]||_0x25cf54[_0x90c6('0x1f')]['user'])},_0x1dfe89)};return client['request'](_0x90c6('0x25'),_0x23bded);})['then'](function(_0x3bbe07){if(_0x3bbe07[_0x90c6('0x26')]){throw new Error(util[_0x90c6('0x23')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3bbe07[_0x90c6('0x26')]['message']||JSON['stringify'](_0x3bbe07[_0x90c6('0x26')])));}return!![];});}function handleError(_0x3d93bc,_0x1610c5,_0x2f2045){return _0x3d93bc[_0x90c6('0x27')](_0x1610c5||0x1f4)[_0x90c6('0x28')]({'message':_0x2f2045?_0x2f2045[_0x90c6('0x29')]||_0x2f2045:''});}exports[_0x90c6('0x2a')]=function(_0x3dd65d,_0x34cc23,_0x50724f){passport[_0x90c6('0x16')](_0x90c6('0x2b'),function(_0x4387b4,_0x26e64b,_0x4d51aa){var _0x5cc64b=_0x4387b4||_0x4d51aa;if(_0x5cc64b){return handleError(_0x34cc23,0x191,_0x5cc64b);}if(!_0x26e64b){return handleError(_0x34cc23,0x194,{'message':_0x90c6('0x2c')});}else{var _0x37d5bf={'payload':{'id':_0x26e64b['id'],'role':_0x26e64b['role']},'options':{'expiresIn':0x15180}};return authService[_0x90c6('0x2d')](_0x37d5bf)[_0x90c6('0xb')](function(_0x1d6162){_0x34cc23[_0x90c6('0x2e')]({'id':_0x26e64b['id'],'token':_0x1d6162,'statusCall':'','isAlreadyLogged':_0x26e64b[_0x90c6('0x2f')]});});}})(_0x3dd65d,_0x34cc23,_0x50724f);};exports['forgot']=function(_0x3c47d1,_0x4d00d1){if(!_0x3c47d1['body'][_0x90c6('0x24')]){return handleError(_0x4d00d1,0x1f4,{'message':_0x90c6('0x30')});}var _0x234273=rs[_0x90c6('0x31')]();_0x3c47d1[_0x90c6('0x32')][_0x90c6('0x24')]=_0x3c47d1[_0x90c6('0x32')][_0x90c6('0x24')]['trim']()[_0x90c6('0x33')]();var _0x233a06;return db[_0x90c6('0x34')][_0x90c6('0x9')]({'where':{'id':0x1},'attributes':[_0x90c6('0x19'),_0x90c6('0xa')],'raw':!![]})[_0x90c6('0xb')](function(_0x5df7cc){_0x233a06=_0x5df7cc;return db[_0x90c6('0x35')][_0x90c6('0x1d')]({'where':{'email':_0x3c47d1[_0x90c6('0x32')][_0x90c6('0x24')]}});})[_0x90c6('0xb')](function(_0x220480){if(!_0x220480){throw new Error(_0x90c6('0x36'));}if(_0x220480[_0x90c6('0xe')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x220480['blocked']){if(moment(_0x220480['blockedAt'])['add'](_0x233a06[_0x90c6('0xa')],_0x90c6('0x17'))>moment()){throw new Error(_0x90c6('0x37'));}else{_0x220480['blocked']=![];_0x220480[_0x90c6('0x10')]=null;}}_0x220480[_0x90c6('0x38')]=_0x234273;_0x220480[_0x90c6('0x39')]=Date[_0x90c6('0x3a')]()+0x36ee80;return _0x220480[_0x90c6('0x3b')]();})['then'](function(){return sendServiceMail({'to':_0x3c47d1[_0x90c6('0x32')]['email'],'subject':_0x90c6('0x3c'),'text':_0x90c6('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x3c47d1[_0x90c6('0x3e')][_0x90c6('0x3f')]+'/reset/'+_0x234273+'\x0a\x0a'+_0x90c6('0x40')});})[_0x90c6('0xb')](function(){_0x4d00d1[_0x90c6('0x27')](0xc8)[_0x90c6('0x28')]({'message':_0x90c6('0x41')});})[_0x90c6('0x1c')](function(_0x7a2e75){return handleError(_0x4d00d1,0x1f4,_0x7a2e75);});};exports['reset']=function(_0x4cc720,_0x61eb21){return db[_0x90c6('0x35')][_0x90c6('0x1d')]({'where':{'resetPasswordToken':_0x4cc720[_0x90c6('0x42')][_0x90c6('0x43')],'resetPasswordExpires':{'$gt':Date[_0x90c6('0x3a')]()}}})[_0x90c6('0xb')](function(_0x1bb5be){if(!_0x1bb5be){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x90c6('0x34')][_0x90c6('0x9')]({'attributes':['id','securePassword',_0x90c6('0x44'),_0x90c6('0x45')]})['then'](function(_0x2e741a){if(_0x2e741a[_0x90c6('0x46')])authService['validatePasswordPattern'](_0x4cc720[_0x90c6('0x32')][_0x90c6('0x47')]);if(!_0x2e741a[_0x90c6('0x44')]||!_0x1bb5be[_0x90c6('0x48')])return _0x1bb5be;authService[_0x90c6('0x49')](_0x4cc720[_0x90c6('0x32')][_0x90c6('0x47')],_0x1bb5be[_0x90c6('0x48')],_0x2e741a[_0x90c6('0x45')]);return _0x1bb5be;})[_0x90c6('0xb')](function(){_0x1bb5be[_0x90c6('0x47')]=_0x4cc720[_0x90c6('0x32')]['password'];_0x1bb5be[_0x90c6('0x38')]=null;_0x1bb5be[_0x90c6('0x39')]=null;return _0x1bb5be[_0x90c6('0x3b')]();});})[_0x90c6('0xb')](function(){_0x61eb21[_0x90c6('0x27')](0xc8)['send']({'message':_0x90c6('0x4a')});})['catch'](function(_0x52eab6){return handleError(_0x61eb21,0x1f4,_0x52eab6);});};passport[_0x90c6('0x4b')](_0x90c6('0x2b'),new LocalStrategy({'usernameField':_0x90c6('0xc'),'passwordField':'password'},function(_0x50332b,_0xa00e3b,_0x13575b){return localAuthenticate(db['User'],_0x50332b,_0xa00e3b,_0x13575b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0d54a41..b3896a2 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 _0xbf4b=['post','login','forgot','express','Router','./authLocal.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbf4b,0xe1));var _0xbbf4=function(_0xf9e76,_0x2e6b9a){_0xf9e76=_0xf9e76-0x0;var _0x119a9b=_0xbf4b[_0xf9e76];return _0x119a9b;};'use strict';var express=require(_0xbbf4('0x0'));var router=express[_0xbbf4('0x1')]();var controller=require(_0xbbf4('0x2'));router[_0xbbf4('0x3')]('/',controller[_0xbbf4('0x4')]);router[_0xbbf4('0x3')]('/forgot',controller[_0xbbf4('0x5')]);router[_0xbbf4('0x3')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file +var _0x1d2a=['express','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x8494aa,_0x4ce41e){var _0x42053b=function(_0x1b26d2){while(--_0x1b26d2){_0x8494aa['push'](_0x8494aa['shift']());}};_0x42053b(++_0x4ce41e);}(_0x1d2a,0x130));var _0xa1d2=function(_0x46f8d4,_0x10a90a){_0x46f8d4=_0x46f8d4-0x0;var _0x11dde7=_0x1d2a[_0x46f8d4];return _0x11dde7;};'use strict';var express=require(_0xa1d2('0x0'));var router=express['Router']();var controller=require(_0xa1d2('0x1'));router[_0xa1d2('0x2')]('/',controller[_0xa1d2('0x3')]);router[_0xa1d2('0x2')](_0xa1d2('0x4'),controller[_0xa1d2('0x5')]);router['post'](_0xa1d2('0x6'),controller[_0xa1d2('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 5ab52a4..6ea37ce 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 _0x0ce6=['INTEGER','exports','STRING'];(function(_0x434969,_0x3ef4fe){var _0xac29d7=function(_0x30ef6c){while(--_0x30ef6c){_0x434969['push'](_0x434969['shift']());}};_0xac29d7(++_0x3ef4fe);}(_0x0ce6,0x100));var _0x60ce=function(_0x272e68,_0x49f8c4){_0x272e68=_0x272e68-0x0;var _0x532fc7=_0x0ce6[_0x272e68];return _0x532fc7;};'use strict';var Sequelize=require('sequelize');module[_0x60ce('0x0')]={'name':{'type':Sequelize[_0x60ce('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60ce('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x60ce('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x667b=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x475e33,_0x42824a){var _0x318871=function(_0x54394c){while(--_0x54394c){_0x475e33['push'](_0x475e33['shift']());}};_0x318871(++_0x42824a);}(_0x667b,0x1da));var _0xb667=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x667b[_0xf48cce];return _0x2a5c38;};'use strict';var Sequelize=require('sequelize');module[_0xb667('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb667('0x1')]},'status':{'type':Sequelize[_0xb667('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb667('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index b285e56..e5b01ee 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 _0x2787=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','map','Automation','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','fields','find','create','body','update','addConditions','omit','ids','getConditions','Condition','nolimit','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0x2787,0x18a));var _0x7278=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2787[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7278('0x0'));var rimraf=require(_0x7278('0x1'));var zipdir=require(_0x7278('0x2'));var jsonpatch=require(_0x7278('0x3'));var rp=require('request-promise');var moment=require(_0x7278('0x4'));var BPromise=require(_0x7278('0x5'));var Mustache=require(_0x7278('0x6'));var util=require('util');var path=require(_0x7278('0x7'));var sox=require(_0x7278('0x8'));var csv=require(_0x7278('0x9'));var ejs=require(_0x7278('0xa'));var fs=require('fs');var fs_extra=require(_0x7278('0xb'));var _=require(_0x7278('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7278('0xd'));var deskjs=require(_0x7278('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7278('0xf'));var Papa=require(_0x7278('0x10'));var Redis=require(_0x7278('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7278('0x12'));var as=require(_0x7278('0x13'));var hardwareService=require(_0x7278('0x14'));var logger=require('../../config/logger')(_0x7278('0x15'));var utils=require('../../config/utils');var config=require(_0x7278('0x16'));var licenseUtil=require(_0x7278('0x17'));var db=require(_0x7278('0x18'))['db'];function respondWithStatusCode(_0x404b51,_0x424548){_0x424548=_0x424548||0xcc;return function(_0x4788a4){if(_0x4788a4){return _0x404b51['sendStatus'](_0x424548);}return _0x404b51[_0x7278('0x19')](_0x424548)['end']();};}function respondWithResult(_0x21b9ea,_0x4c431b){_0x4c431b=_0x4c431b||0xc8;return function(_0x4b5356){if(_0x4b5356){return _0x21b9ea[_0x7278('0x19')](_0x4c431b)[_0x7278('0x1a')](_0x4b5356);}};}function respondWithFilteredResult(_0x3c10ae,_0x44f6b8){return function(_0x3c55c9){if(_0x3c55c9){var _0x368641=typeof _0x44f6b8['offset']===_0x7278('0x1b')&&typeof _0x44f6b8[_0x7278('0x1c')]===_0x7278('0x1b');var _0x5283f4=_0x3c55c9[_0x7278('0x1d')];var _0x919d62=_0x368641?0x0:_0x44f6b8['offset'];var _0x4188ff=_0x368641?_0x3c55c9[_0x7278('0x1d')]:_0x44f6b8[_0x7278('0x1e')]+_0x44f6b8[_0x7278('0x1c')];var _0x5d7b85;if(_0x4188ff>=_0x5283f4){_0x4188ff=_0x5283f4;_0x5d7b85=0xc8;}else{_0x5d7b85=0xce;}_0x3c10ae[_0x7278('0x19')](_0x5d7b85);return _0x3c10ae[_0x7278('0x1f')](_0x7278('0x20'),_0x919d62+'-'+_0x4188ff+'/'+_0x5283f4)[_0x7278('0x1a')](_0x3c55c9);}return null;};}function patchUpdates(_0x258853){return function(_0x595b6b){try{jsonpatch[_0x7278('0x21')](_0x595b6b,_0x258853,!![]);}catch(_0x380a35){return BPromise[_0x7278('0x22')](_0x380a35);}return _0x595b6b[_0x7278('0x23')]();};}function saveUpdates(_0x4fc0d4,_0x3ea92a){return function(_0x4289eb){if(_0x4289eb){return _0x4289eb['update'](_0x4fc0d4)['then'](function(_0x4daa96){return _0x4daa96;});}return null;};}function removeEntity(_0x982ae2,_0x9f3a3a){return function(_0x31be59){if(_0x31be59){return _0x31be59[_0x7278('0x24')]()['then'](function(){_0x982ae2[_0x7278('0x19')](0xcc)[_0x7278('0x25')]();});}};}function handleEntityNotFound(_0x57bcb1,_0x2f6804){return function(_0x1f9213){if(!_0x1f9213){_0x57bcb1[_0x7278('0x26')](0x194);}return _0x1f9213;};}function handleError(_0x13ffc4,_0x161a9f){_0x161a9f=_0x161a9f||0x1f4;return function(_0x2c3403){logger['error'](_0x2c3403[_0x7278('0x27')]);if(_0x2c3403[_0x7278('0x28')]){delete _0x2c3403['name'];}_0x13ffc4[_0x7278('0x19')](_0x161a9f)['send'](_0x2c3403);};}exports['index']=function(_0x4309b6,_0x10f11d){var _0x32f534={},_0x2e94bd={},_0x1cca94={'count':0x0,'rows':[]};var _0x2d0b18=_[_0x7278('0x29')](db[_0x7278('0x2a')][_0x7278('0x2b')],function(_0x10604e){return{'name':_0x10604e[_0x7278('0x2c')],'type':_0x10604e['type']['key']};});_0x2e94bd[_0x7278('0x2d')]=_[_0x7278('0x29')](_0x2d0b18,'name');_0x2e94bd[_0x7278('0x2e')]=_[_0x7278('0x2f')](_0x4309b6[_0x7278('0x2e')]);_0x2e94bd[_0x7278('0x30')]=_[_0x7278('0x31')](_0x2e94bd[_0x7278('0x2d')],_0x2e94bd['query']);_0x32f534['attributes']=_['intersection'](_0x2e94bd[_0x7278('0x2d')],qs['fields'](_0x4309b6[_0x7278('0x2e')]['fields']));_0x32f534[_0x7278('0x32')]=_0x32f534[_0x7278('0x32')][_0x7278('0x33')]?_0x32f534['attributes']:_0x2e94bd['model'];if(!_0x4309b6['query'][_0x7278('0x34')]('nolimit')){_0x32f534[_0x7278('0x1c')]=qs[_0x7278('0x1c')](_0x4309b6[_0x7278('0x2e')][_0x7278('0x1c')]);_0x32f534[_0x7278('0x1e')]=qs[_0x7278('0x1e')](_0x4309b6[_0x7278('0x2e')][_0x7278('0x1e')]);}_0x32f534[_0x7278('0x35')]=qs[_0x7278('0x36')](_0x4309b6[_0x7278('0x2e')][_0x7278('0x36')]);_0x32f534[_0x7278('0x37')]=qs[_0x7278('0x30')](_[_0x7278('0x38')](_0x4309b6[_0x7278('0x2e')],_0x2e94bd['filters']),_0x2d0b18);if(_0x4309b6['query'][_0x7278('0x39')]){_0x32f534[_0x7278('0x37')]=_[_0x7278('0x3a')](_0x32f534[_0x7278('0x37')],{'$or':_['map'](_0x2d0b18,function(_0x3f6621){if(_0x3f6621[_0x7278('0x3b')]!==_0x7278('0x3c')){var _0x530a92={};_0x530a92[_0x3f6621['name']]={'$like':'%'+_0x4309b6[_0x7278('0x2e')]['filter']+'%'};return _0x530a92;}})});}_0x32f534=_[_0x7278('0x3a')]({},_0x32f534,_0x4309b6[_0x7278('0x3d')]);var _0x4250dc={'where':_0x32f534[_0x7278('0x37')]};return db[_0x7278('0x2a')][_0x7278('0x1d')](_0x4250dc)[_0x7278('0x3e')](function(_0x2b5e26){_0x1cca94['count']=_0x2b5e26;if(_0x4309b6[_0x7278('0x2e')][_0x7278('0x3f')]){_0x32f534[_0x7278('0x40')]=[{'all':!![]}];}return db[_0x7278('0x2a')][_0x7278('0x41')](_0x32f534);})[_0x7278('0x3e')](function(_0xfa247a){_0x1cca94[_0x7278('0x42')]=_0xfa247a;return _0x1cca94;})['then'](respondWithFilteredResult(_0x10f11d,_0x32f534))[_0x7278('0x43')](handleError(_0x10f11d,null));};exports['show']=function(_0x363aca,_0x4caea1){var _0x58d882={'raw':![],'where':{'id':_0x363aca[_0x7278('0x44')]['id']}},_0x202faa={};_0x202faa[_0x7278('0x2d')]=_[_0x7278('0x2f')](db['Automation'][_0x7278('0x2b')]);_0x202faa[_0x7278('0x2e')]=_[_0x7278('0x2f')](_0x363aca[_0x7278('0x2e')]);_0x202faa[_0x7278('0x30')]=_[_0x7278('0x31')](_0x202faa[_0x7278('0x2d')],_0x202faa[_0x7278('0x2e')]);_0x58d882[_0x7278('0x32')]=_[_0x7278('0x31')](_0x202faa[_0x7278('0x2d')],qs[_0x7278('0x45')](_0x363aca[_0x7278('0x2e')][_0x7278('0x45')]));_0x58d882[_0x7278('0x32')]=_0x58d882['attributes'][_0x7278('0x33')]?_0x58d882[_0x7278('0x32')]:_0x202faa[_0x7278('0x2d')];if(_0x363aca[_0x7278('0x2e')][_0x7278('0x3f')]){_0x58d882['include']=[{'all':!![]}];}_0x58d882=_[_0x7278('0x3a')]({},_0x58d882,_0x363aca[_0x7278('0x3d')]);return db[_0x7278('0x2a')][_0x7278('0x46')](_0x58d882)['then'](handleEntityNotFound(_0x4caea1,null))[_0x7278('0x3e')](respondWithResult(_0x4caea1,null))[_0x7278('0x43')](handleError(_0x4caea1,null));};exports[_0x7278('0x47')]=function(_0x226a41,_0x2a50da){return db[_0x7278('0x2a')][_0x7278('0x47')](_0x226a41[_0x7278('0x48')],{})[_0x7278('0x3e')](respondWithResult(_0x2a50da,0xc9))['catch'](handleError(_0x2a50da,null));};exports[_0x7278('0x49')]=function(_0x515457,_0x2aaee5){if(_0x515457[_0x7278('0x48')]['id']){delete _0x515457['body']['id'];}return db[_0x7278('0x2a')][_0x7278('0x46')]({'where':{'id':_0x515457['params']['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x2aaee5,null))['then'](saveUpdates(_0x515457['body'],null))[_0x7278('0x3e')](respondWithResult(_0x2aaee5,null))['catch'](handleError(_0x2aaee5,null));};exports['destroy']=function(_0x1b3655,_0x146f9a){return db[_0x7278('0x2a')]['find']({'where':{'id':_0x1b3655[_0x7278('0x44')]['id']}})['then'](handleEntityNotFound(_0x146f9a,null))[_0x7278('0x3e')](removeEntity(_0x146f9a,null))[_0x7278('0x43')](handleError(_0x146f9a,null));};exports[_0x7278('0x4a')]=function(_0xf62cfe,_0x2c011b,_0x373af0){return db['Condition'][_0x7278('0x46')]({'where':{'id':_0xf62cfe['params']['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x2c011b,null))['then'](function(_0xe480c2){if(_0xe480c2){return _0xe480c2[_0x7278('0x4a')](_0xf62cfe[_0x7278('0x48')]['ids'],_[_0x7278('0x4b')](_0xf62cfe[_0x7278('0x48')],[_0x7278('0x4c'),'id'])||{});}})[_0x7278('0x3e')](respondWithResult(_0x2c011b,null))[_0x7278('0x43')](handleError(_0x2c011b,null));};exports[_0x7278('0x4d')]=function(_0x16913c,_0x339501,_0x59f7a4){var _0x2f85ca={};var _0x1ba7b4={};var _0xf93bc7;var _0x310ad3;return db[_0x7278('0x2a')]['findOne']({'where':{'id':_0x16913c[_0x7278('0x44')]['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x339501,null))['then'](function(_0x28b84e){if(_0x28b84e){_0xf93bc7=_0x28b84e;_0x1ba7b4[_0x7278('0x2d')]=_[_0x7278('0x2f')](db[_0x7278('0x4e')]['rawAttributes']);_0x1ba7b4['query']=_[_0x7278('0x2f')](_0x16913c['query']);_0x1ba7b4[_0x7278('0x30')]=_[_0x7278('0x31')](_0x1ba7b4[_0x7278('0x2d')],_0x1ba7b4['query']);_0x2f85ca[_0x7278('0x32')]=_[_0x7278('0x31')](_0x1ba7b4['model'],qs[_0x7278('0x45')](_0x16913c[_0x7278('0x2e')][_0x7278('0x45')]));_0x2f85ca[_0x7278('0x32')]=_0x2f85ca[_0x7278('0x32')][_0x7278('0x33')]?_0x2f85ca[_0x7278('0x32')]:_0x1ba7b4[_0x7278('0x2d')];_0x2f85ca[_0x7278('0x35')]=qs[_0x7278('0x36')](_0x16913c[_0x7278('0x2e')][_0x7278('0x36')]);_0x2f85ca[_0x7278('0x37')]=qs[_0x7278('0x30')](_[_0x7278('0x38')](_0x16913c['query'],_0x1ba7b4[_0x7278('0x30')]));if(_0x16913c[_0x7278('0x2e')][_0x7278('0x39')]){_0x2f85ca['where']=_[_0x7278('0x3a')](_0x2f85ca[_0x7278('0x37')],{'$or':_[_0x7278('0x29')](_0x2f85ca[_0x7278('0x32')],function(_0xabe7e9){var _0x3c22e4={};_0x3c22e4[_0xabe7e9]={'$like':'%'+_0x16913c[_0x7278('0x2e')][_0x7278('0x39')]+'%'};return _0x3c22e4;})});}_0x2f85ca=_[_0x7278('0x3a')]({},_0x2f85ca,_0x16913c['options']);return _0xf93bc7['getConditions'](_0x2f85ca);}})['then'](function(_0x358486){if(_0x358486){_0x310ad3=_0x358486[_0x7278('0x33')];if(!_0x16913c[_0x7278('0x2e')]['hasOwnProperty'](_0x7278('0x4f'))){_0x2f85ca[_0x7278('0x1c')]=qs[_0x7278('0x1c')](_0x16913c['query']['limit']);_0x2f85ca[_0x7278('0x1e')]=qs[_0x7278('0x1e')](_0x16913c['query'][_0x7278('0x1e')]);}return _0xf93bc7[_0x7278('0x4d')](_0x2f85ca);}})[_0x7278('0x3e')](function(_0xf1945){if(_0xf1945){return _0xf1945?{'count':_0x310ad3,'rows':_0xf1945}:null;}})['then'](respondWithResult(_0x339501,null))[_0x7278('0x43')](handleError(_0x339501,null));};exports[_0x7278('0x50')]=function(_0x2bc5b1,_0x1cc45e,_0x30e527){return db[_0x7278('0x51')][_0x7278('0x46')]({'where':{'id':_0x2bc5b1[_0x7278('0x44')]['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x1cc45e,null))[_0x7278('0x3e')](function(_0x41b79d){if(_0x41b79d){return _0x41b79d[_0x7278('0x50')](_0x2bc5b1[_0x7278('0x48')][_0x7278('0x4c')],_[_0x7278('0x4b')](_0x2bc5b1[_0x7278('0x48')],[_0x7278('0x4c'),'id'])||{});}})[_0x7278('0x3e')](respondWithResult(_0x1cc45e,null))[_0x7278('0x43')](handleError(_0x1cc45e,null));};exports[_0x7278('0x52')]=function(_0x5318ac,_0x1fc564,_0x24bb5a){var _0x32cf55={};var _0x4999fe={};var _0x34695e;var _0x18c740;return db[_0x7278('0x2a')][_0x7278('0x53')]({'where':{'id':_0x5318ac[_0x7278('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fc564,null))[_0x7278('0x3e')](function(_0x2c1217){if(_0x2c1217){_0x34695e=_0x2c1217;_0x4999fe[_0x7278('0x2d')]=_['keys'](db[_0x7278('0x51')]['rawAttributes']);_0x4999fe['query']=_['keys'](_0x5318ac[_0x7278('0x2e')]);_0x4999fe[_0x7278('0x30')]=_[_0x7278('0x31')](_0x4999fe['model'],_0x4999fe[_0x7278('0x2e')]);_0x32cf55['attributes']=_[_0x7278('0x31')](_0x4999fe[_0x7278('0x2d')],qs[_0x7278('0x45')](_0x5318ac[_0x7278('0x2e')][_0x7278('0x45')]));_0x32cf55[_0x7278('0x32')]=_0x32cf55[_0x7278('0x32')][_0x7278('0x33')]?_0x32cf55[_0x7278('0x32')]:_0x4999fe['model'];_0x32cf55['order']=qs[_0x7278('0x36')](_0x5318ac[_0x7278('0x2e')][_0x7278('0x36')]);_0x32cf55[_0x7278('0x37')]=qs[_0x7278('0x30')](_['pick'](_0x5318ac[_0x7278('0x2e')],_0x4999fe[_0x7278('0x30')]));if(_0x5318ac[_0x7278('0x2e')][_0x7278('0x39')]){_0x32cf55[_0x7278('0x37')]=_['merge'](_0x32cf55['where'],{'$or':_[_0x7278('0x29')](_0x32cf55['attributes'],function(_0x58ec93){var _0x1a4d63={};_0x1a4d63[_0x58ec93]={'$like':'%'+_0x5318ac[_0x7278('0x2e')][_0x7278('0x39')]+'%'};return _0x1a4d63;})});}_0x32cf55=_[_0x7278('0x3a')]({},_0x32cf55,_0x5318ac[_0x7278('0x3d')]);return _0x34695e[_0x7278('0x52')](_0x32cf55);}})[_0x7278('0x3e')](function(_0x5ab7af){if(_0x5ab7af){_0x18c740=_0x5ab7af['length'];if(!_0x5318ac['query'][_0x7278('0x34')](_0x7278('0x4f'))){_0x32cf55[_0x7278('0x1c')]=qs[_0x7278('0x1c')](_0x5318ac[_0x7278('0x2e')]['limit']);_0x32cf55[_0x7278('0x1e')]=qs[_0x7278('0x1e')](_0x5318ac[_0x7278('0x2e')][_0x7278('0x1e')]);}return _0x34695e['getActions'](_0x32cf55);}})[_0x7278('0x3e')](function(_0x3d6693){if(_0x3d6693){return _0x3d6693?{'count':_0x18c740,'rows':_0x3d6693}:null;}})[_0x7278('0x3e')](respondWithResult(_0x1fc564,null))[_0x7278('0x43')](handleError(_0x1fc564,null));}; \ No newline at end of file +var _0x29b2=['papaparse','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','reject','save','update','then','destroy','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','Automation','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','options','find','create','body','params','addConditions','Condition','ids','findOne','getConditions','addActions','Action','omit','getActions','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x29b2,0x19e));var _0x229b=function(_0x364263,_0x544cfe){_0x364263=_0x364263-0x0;var _0x3d6507=_0x29b2[_0x364263];return _0x3d6507;};'use strict';var emlformat=require(_0x229b('0x0'));var rimraf=require(_0x229b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x229b('0x2'));var rp=require(_0x229b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x229b('0x4'));var util=require('util');var path=require(_0x229b('0x5'));var sox=require(_0x229b('0x6'));var csv=require('to-csv');var ejs=require(_0x229b('0x7'));var fs=require('fs');var fs_extra=require(_0x229b('0x8'));var _=require(_0x229b('0x9'));var squel=require(_0x229b('0xa'));var crypto=require(_0x229b('0xb'));var jsforce=require(_0x229b('0xc'));var deskjs=require(_0x229b('0xd'));var toCsv=require(_0x229b('0xe'));var querystring=require(_0x229b('0xf'));var Papa=require(_0x229b('0x10'));var Redis=require(_0x229b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x229b('0x12'));var as=require(_0x229b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x229b('0x14'));var utils=require('../../config/utils');var config=require(_0x229b('0x15'));var licenseUtil=require(_0x229b('0x16'));var db=require(_0x229b('0x17'))['db'];function respondWithStatusCode(_0x39638f,_0x42fa8c){_0x42fa8c=_0x42fa8c||0xcc;return function(_0x20c127){if(_0x20c127){return _0x39638f[_0x229b('0x18')](_0x42fa8c);}return _0x39638f[_0x229b('0x19')](_0x42fa8c)[_0x229b('0x1a')]();};}function respondWithResult(_0x2eaeb9,_0x2b1f46){_0x2b1f46=_0x2b1f46||0xc8;return function(_0x29e4d4){if(_0x29e4d4){return _0x2eaeb9[_0x229b('0x19')](_0x2b1f46)[_0x229b('0x1b')](_0x29e4d4);}};}function respondWithFilteredResult(_0x3a0e51,_0x4b6365){return function(_0x114266){if(_0x114266){var _0x5c0bde=typeof _0x4b6365[_0x229b('0x1c')]===_0x229b('0x1d')&&typeof _0x4b6365[_0x229b('0x1e')]===_0x229b('0x1d');var _0x59ae7e=_0x114266[_0x229b('0x1f')];var _0x31966c=_0x5c0bde?0x0:_0x4b6365[_0x229b('0x1c')];var _0x34e557=_0x5c0bde?_0x114266[_0x229b('0x1f')]:_0x4b6365['offset']+_0x4b6365['limit'];var _0xb2a928;if(_0x34e557>=_0x59ae7e){_0x34e557=_0x59ae7e;_0xb2a928=0xc8;}else{_0xb2a928=0xce;}_0x3a0e51[_0x229b('0x19')](_0xb2a928);return _0x3a0e51[_0x229b('0x20')](_0x229b('0x21'),_0x31966c+'-'+_0x34e557+'/'+_0x59ae7e)[_0x229b('0x1b')](_0x114266);}return null;};}function patchUpdates(_0x39198a){return function(_0x5bd2b8){try{jsonpatch[_0x229b('0x22')](_0x5bd2b8,_0x39198a,!![]);}catch(_0x15f32d){return BPromise[_0x229b('0x23')](_0x15f32d);}return _0x5bd2b8[_0x229b('0x24')]();};}function saveUpdates(_0x5d20ce,_0xcb4ace){return function(_0x4ae4c3){if(_0x4ae4c3){return _0x4ae4c3[_0x229b('0x25')](_0x5d20ce)[_0x229b('0x26')](function(_0x583c62){return _0x583c62;});}return null;};}function removeEntity(_0x5594c9,_0x182512){return function(_0x406303){if(_0x406303){return _0x406303[_0x229b('0x27')]()['then'](function(){_0x5594c9['status'](0xcc)[_0x229b('0x1a')]();});}};}function handleEntityNotFound(_0x1cf53d,_0x3ee803){return function(_0x53bc6b){if(!_0x53bc6b){_0x1cf53d[_0x229b('0x18')](0x194);}return _0x53bc6b;};}function handleError(_0x36dda9,_0x27baca){_0x27baca=_0x27baca||0x1f4;return function(_0x2bc97e){logger['error'](_0x2bc97e['stack']);if(_0x2bc97e[_0x229b('0x28')]){delete _0x2bc97e[_0x229b('0x28')];}_0x36dda9[_0x229b('0x19')](_0x27baca)[_0x229b('0x29')](_0x2bc97e);};}exports[_0x229b('0x2a')]=function(_0x4a8dc2,_0x516e0d){var _0x5cdeae={},_0x1b3f03={},_0x4af3b1={'count':0x0,'rows':[]};var _0x518d5f=_[_0x229b('0x2b')](db['Automation']['rawAttributes'],function(_0x23b553){return{'name':_0x23b553[_0x229b('0x2c')],'type':_0x23b553['type'][_0x229b('0x2d')]};});_0x1b3f03[_0x229b('0x2e')]=_[_0x229b('0x2b')](_0x518d5f,_0x229b('0x28'));_0x1b3f03[_0x229b('0x2f')]=_['keys'](_0x4a8dc2[_0x229b('0x2f')]);_0x1b3f03[_0x229b('0x30')]=_[_0x229b('0x31')](_0x1b3f03[_0x229b('0x2e')],_0x1b3f03[_0x229b('0x2f')]);_0x5cdeae[_0x229b('0x32')]=_[_0x229b('0x31')](_0x1b3f03['model'],qs[_0x229b('0x33')](_0x4a8dc2['query'][_0x229b('0x33')]));_0x5cdeae[_0x229b('0x32')]=_0x5cdeae['attributes'][_0x229b('0x34')]?_0x5cdeae['attributes']:_0x1b3f03['model'];if(!_0x4a8dc2['query'][_0x229b('0x35')](_0x229b('0x36'))){_0x5cdeae[_0x229b('0x1e')]=qs['limit'](_0x4a8dc2[_0x229b('0x2f')][_0x229b('0x1e')]);_0x5cdeae[_0x229b('0x1c')]=qs[_0x229b('0x1c')](_0x4a8dc2[_0x229b('0x2f')][_0x229b('0x1c')]);}_0x5cdeae[_0x229b('0x37')]=qs[_0x229b('0x38')](_0x4a8dc2[_0x229b('0x2f')][_0x229b('0x38')]);_0x5cdeae[_0x229b('0x39')]=qs[_0x229b('0x30')](_[_0x229b('0x3a')](_0x4a8dc2['query'],_0x1b3f03[_0x229b('0x30')]),_0x518d5f);if(_0x4a8dc2[_0x229b('0x2f')][_0x229b('0x3b')]){_0x5cdeae[_0x229b('0x39')]=_[_0x229b('0x3c')](_0x5cdeae[_0x229b('0x39')],{'$or':_[_0x229b('0x2b')](_0x518d5f,function(_0x37a45d){if(_0x37a45d[_0x229b('0x3d')]!==_0x229b('0x3e')){var _0x37eef5={};_0x37eef5[_0x37a45d[_0x229b('0x28')]]={'$like':'%'+_0x4a8dc2['query'][_0x229b('0x3b')]+'%'};return _0x37eef5;}})});}_0x5cdeae=_[_0x229b('0x3c')]({},_0x5cdeae,_0x4a8dc2['options']);var _0x2ba36e={'where':_0x5cdeae[_0x229b('0x39')]};return db[_0x229b('0x3f')]['count'](_0x2ba36e)[_0x229b('0x26')](function(_0x60a1fd){_0x4af3b1[_0x229b('0x1f')]=_0x60a1fd;if(_0x4a8dc2[_0x229b('0x2f')]['includeAll']){_0x5cdeae[_0x229b('0x40')]=[{'all':!![]}];}return db[_0x229b('0x3f')][_0x229b('0x41')](_0x5cdeae);})[_0x229b('0x26')](function(_0x58df5e){_0x4af3b1[_0x229b('0x42')]=_0x58df5e;return _0x4af3b1;})[_0x229b('0x26')](respondWithFilteredResult(_0x516e0d,_0x5cdeae))[_0x229b('0x43')](handleError(_0x516e0d,null));};exports[_0x229b('0x44')]=function(_0x42a1af,_0x1e65fc){var _0xc13249={'raw':![],'where':{'id':_0x42a1af['params']['id']}},_0x96aa5e={};_0x96aa5e[_0x229b('0x2e')]=_[_0x229b('0x45')](db['Automation'][_0x229b('0x46')]);_0x96aa5e[_0x229b('0x2f')]=_[_0x229b('0x45')](_0x42a1af['query']);_0x96aa5e['filters']=_[_0x229b('0x31')](_0x96aa5e['model'],_0x96aa5e['query']);_0xc13249['attributes']=_[_0x229b('0x31')](_0x96aa5e[_0x229b('0x2e')],qs['fields'](_0x42a1af[_0x229b('0x2f')][_0x229b('0x33')]));_0xc13249[_0x229b('0x32')]=_0xc13249[_0x229b('0x32')][_0x229b('0x34')]?_0xc13249[_0x229b('0x32')]:_0x96aa5e['model'];if(_0x42a1af[_0x229b('0x2f')][_0x229b('0x47')]){_0xc13249['include']=[{'all':!![]}];}_0xc13249=_[_0x229b('0x3c')]({},_0xc13249,_0x42a1af[_0x229b('0x48')]);return db[_0x229b('0x3f')][_0x229b('0x49')](_0xc13249)['then'](handleEntityNotFound(_0x1e65fc,null))[_0x229b('0x26')](respondWithResult(_0x1e65fc,null))[_0x229b('0x43')](handleError(_0x1e65fc,null));};exports[_0x229b('0x4a')]=function(_0x349d1a,_0x3d81e3){return db[_0x229b('0x3f')][_0x229b('0x4a')](_0x349d1a[_0x229b('0x4b')],{})[_0x229b('0x26')](respondWithResult(_0x3d81e3,0xc9))[_0x229b('0x43')](handleError(_0x3d81e3,null));};exports['update']=function(_0x17c075,_0x46ba29){if(_0x17c075['body']['id']){delete _0x17c075['body']['id'];}return db['Automation'][_0x229b('0x49')]({'where':{'id':_0x17c075[_0x229b('0x4c')]['id']}})[_0x229b('0x26')](handleEntityNotFound(_0x46ba29,null))[_0x229b('0x26')](saveUpdates(_0x17c075[_0x229b('0x4b')],null))[_0x229b('0x26')](respondWithResult(_0x46ba29,null))[_0x229b('0x43')](handleError(_0x46ba29,null));};exports[_0x229b('0x27')]=function(_0xbc66c1,_0xbe91c){return db[_0x229b('0x3f')][_0x229b('0x49')]({'where':{'id':_0xbc66c1[_0x229b('0x4c')]['id']}})[_0x229b('0x26')](handleEntityNotFound(_0xbe91c,null))['then'](removeEntity(_0xbe91c,null))[_0x229b('0x43')](handleError(_0xbe91c,null));};exports[_0x229b('0x4d')]=function(_0x1259c1,_0x2267bb,_0x581f50){return db[_0x229b('0x4e')][_0x229b('0x49')]({'where':{'id':_0x1259c1[_0x229b('0x4c')]['id']}})[_0x229b('0x26')](handleEntityNotFound(_0x2267bb,null))[_0x229b('0x26')](function(_0x58638b){if(_0x58638b){return _0x58638b['addConditions'](_0x1259c1[_0x229b('0x4b')][_0x229b('0x4f')],_['omit'](_0x1259c1[_0x229b('0x4b')],[_0x229b('0x4f'),'id'])||{});}})[_0x229b('0x26')](respondWithResult(_0x2267bb,null))['catch'](handleError(_0x2267bb,null));};exports['getConditions']=function(_0x4d1e69,_0x42b915,_0x5e7d1f){var _0x582d5f={};var _0x277259={};var _0x3cf0b9;var _0x2bf0ea;return db[_0x229b('0x3f')][_0x229b('0x50')]({'where':{'id':_0x4d1e69[_0x229b('0x4c')]['id']}})[_0x229b('0x26')](handleEntityNotFound(_0x42b915,null))[_0x229b('0x26')](function(_0xa8ef63){if(_0xa8ef63){_0x3cf0b9=_0xa8ef63;_0x277259['model']=_[_0x229b('0x45')](db[_0x229b('0x4e')][_0x229b('0x46')]);_0x277259[_0x229b('0x2f')]=_[_0x229b('0x45')](_0x4d1e69['query']);_0x277259[_0x229b('0x30')]=_[_0x229b('0x31')](_0x277259[_0x229b('0x2e')],_0x277259[_0x229b('0x2f')]);_0x582d5f['attributes']=_[_0x229b('0x31')](_0x277259[_0x229b('0x2e')],qs['fields'](_0x4d1e69[_0x229b('0x2f')][_0x229b('0x33')]));_0x582d5f[_0x229b('0x32')]=_0x582d5f[_0x229b('0x32')][_0x229b('0x34')]?_0x582d5f['attributes']:_0x277259['model'];_0x582d5f[_0x229b('0x37')]=qs[_0x229b('0x38')](_0x4d1e69[_0x229b('0x2f')][_0x229b('0x38')]);_0x582d5f['where']=qs[_0x229b('0x30')](_['pick'](_0x4d1e69[_0x229b('0x2f')],_0x277259[_0x229b('0x30')]));if(_0x4d1e69[_0x229b('0x2f')][_0x229b('0x3b')]){_0x582d5f[_0x229b('0x39')]=_[_0x229b('0x3c')](_0x582d5f[_0x229b('0x39')],{'$or':_[_0x229b('0x2b')](_0x582d5f[_0x229b('0x32')],function(_0x4bf0af){var _0x431578={};_0x431578[_0x4bf0af]={'$like':'%'+_0x4d1e69[_0x229b('0x2f')][_0x229b('0x3b')]+'%'};return _0x431578;})});}_0x582d5f=_['merge']({},_0x582d5f,_0x4d1e69[_0x229b('0x48')]);return _0x3cf0b9[_0x229b('0x51')](_0x582d5f);}})[_0x229b('0x26')](function(_0x7ee599){if(_0x7ee599){_0x2bf0ea=_0x7ee599[_0x229b('0x34')];if(!_0x4d1e69[_0x229b('0x2f')][_0x229b('0x35')]('nolimit')){_0x582d5f[_0x229b('0x1e')]=qs[_0x229b('0x1e')](_0x4d1e69[_0x229b('0x2f')][_0x229b('0x1e')]);_0x582d5f[_0x229b('0x1c')]=qs[_0x229b('0x1c')](_0x4d1e69[_0x229b('0x2f')]['offset']);}return _0x3cf0b9[_0x229b('0x51')](_0x582d5f);}})[_0x229b('0x26')](function(_0x34e19f){if(_0x34e19f){return _0x34e19f?{'count':_0x2bf0ea,'rows':_0x34e19f}:null;}})[_0x229b('0x26')](respondWithResult(_0x42b915,null))[_0x229b('0x43')](handleError(_0x42b915,null));};exports[_0x229b('0x52')]=function(_0x24ea80,_0x335336,_0x2f9873){return db[_0x229b('0x53')]['find']({'where':{'id':_0x24ea80[_0x229b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x335336,null))[_0x229b('0x26')](function(_0x476620){if(_0x476620){return _0x476620[_0x229b('0x52')](_0x24ea80[_0x229b('0x4b')]['ids'],_[_0x229b('0x54')](_0x24ea80[_0x229b('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x335336,null))['catch'](handleError(_0x335336,null));};exports[_0x229b('0x55')]=function(_0xa70203,_0x43aff9,_0x2f7074){var _0x1af3d8={};var _0x43124f={};var _0x5cfc65;var _0xa449b3;return db[_0x229b('0x3f')][_0x229b('0x50')]({'where':{'id':_0xa70203[_0x229b('0x4c')]['id']}})[_0x229b('0x26')](handleEntityNotFound(_0x43aff9,null))[_0x229b('0x26')](function(_0x156546){if(_0x156546){_0x5cfc65=_0x156546;_0x43124f[_0x229b('0x2e')]=_[_0x229b('0x45')](db[_0x229b('0x53')]['rawAttributes']);_0x43124f[_0x229b('0x2f')]=_[_0x229b('0x45')](_0xa70203[_0x229b('0x2f')]);_0x43124f[_0x229b('0x30')]=_[_0x229b('0x31')](_0x43124f['model'],_0x43124f[_0x229b('0x2f')]);_0x1af3d8[_0x229b('0x32')]=_[_0x229b('0x31')](_0x43124f['model'],qs[_0x229b('0x33')](_0xa70203[_0x229b('0x2f')][_0x229b('0x33')]));_0x1af3d8['attributes']=_0x1af3d8['attributes'][_0x229b('0x34')]?_0x1af3d8[_0x229b('0x32')]:_0x43124f[_0x229b('0x2e')];_0x1af3d8['order']=qs[_0x229b('0x38')](_0xa70203[_0x229b('0x2f')]['sort']);_0x1af3d8[_0x229b('0x39')]=qs[_0x229b('0x30')](_[_0x229b('0x3a')](_0xa70203[_0x229b('0x2f')],_0x43124f['filters']));if(_0xa70203[_0x229b('0x2f')]['filter']){_0x1af3d8[_0x229b('0x39')]=_[_0x229b('0x3c')](_0x1af3d8[_0x229b('0x39')],{'$or':_[_0x229b('0x2b')](_0x1af3d8['attributes'],function(_0xb4c9af){var _0x2b422c={};_0x2b422c[_0xb4c9af]={'$like':'%'+_0xa70203[_0x229b('0x2f')][_0x229b('0x3b')]+'%'};return _0x2b422c;})});}_0x1af3d8=_[_0x229b('0x3c')]({},_0x1af3d8,_0xa70203[_0x229b('0x48')]);return _0x5cfc65['getActions'](_0x1af3d8);}})[_0x229b('0x26')](function(_0x19b663){if(_0x19b663){_0xa449b3=_0x19b663[_0x229b('0x34')];if(!_0xa70203[_0x229b('0x2f')][_0x229b('0x35')](_0x229b('0x36'))){_0x1af3d8['limit']=qs[_0x229b('0x1e')](_0xa70203[_0x229b('0x2f')][_0x229b('0x1e')]);_0x1af3d8[_0x229b('0x1c')]=qs['offset'](_0xa70203[_0x229b('0x2f')][_0x229b('0x1c')]);}return _0x5cfc65[_0x229b('0x55')](_0x1af3d8);}})[_0x229b('0x26')](function(_0x2c8421){if(_0x2c8421){return _0x2c8421?{'count':_0xa449b3,'rows':_0x2c8421}:null;}})[_0x229b('0x26')](respondWithResult(_0x43aff9,null))[_0x229b('0x43')](handleError(_0x43aff9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 57c2682..d6fe67b 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 _0xb37a=['exports','define','Automation','tools_automations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes'];(function(_0x35bf7c,_0x3b27bc){var _0x2c9413=function(_0x547185){while(--_0x547185){_0x35bf7c['push'](_0x35bf7c['shift']());}};_0x2c9413(++_0x3b27bc);}(_0xb37a,0x12f));var _0xab37=function(_0x2a8811,_0x281afa){_0x2a8811=_0x2a8811-0x0;var _0x312324=_0xb37a[_0x2a8811];return _0x312324;};'use strict';var _=require(_0xab37('0x0'));var util=require(_0xab37('0x1'));var logger=require('../../config/logger')(_0xab37('0x2'));var moment=require(_0xab37('0x3'));var BPromise=require(_0xab37('0x4'));var rp=require(_0xab37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab37('0x6'));var config=require(_0xab37('0x7'));var attributes=require(_0xab37('0x8'));module[_0xab37('0x9')]=function(_0x212896,_0x1e3df6){return _0x212896[_0xab37('0xa')](_0xab37('0xb'),attributes,{'tableName':_0xab37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7de=['./automation.attributes','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc7de,0x1e0));var _0xec7d=function(_0x3fbeef,_0x2840b4){_0x3fbeef=_0x3fbeef-0x0;var _0x14ec1f=_0xc7de[_0x3fbeef];return _0x14ec1f;};'use strict';var _=require(_0xec7d('0x0'));var util=require(_0xec7d('0x1'));var logger=require(_0xec7d('0x2'))(_0xec7d('0x3'));var moment=require(_0xec7d('0x4'));var BPromise=require(_0xec7d('0x5'));var rp=require(_0xec7d('0x6'));var fs=require('fs');var path=require(_0xec7d('0x7'));var rimraf=require(_0xec7d('0x8'));var config=require(_0xec7d('0x9'));var attributes=require(_0xec7d('0xa'));module['exports']=function(_0x59d46c,_0x44d04d){return _0x59d46c[_0xec7d('0xb')](_0xec7d('0xc'),attributes,{'tableName':_0xec7d('0xd'),'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 f4341be..99444a7 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 _0x866a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x278e39,_0x379ba4){var _0x211e88=function(_0x38bdfa){while(--_0x38bdfa){_0x278e39['push'](_0x278e39['shift']());}};_0x211e88(++_0x379ba4);}(_0x866a,0x156));var _0xa866=function(_0x1b3a9e,_0x3b6e29){_0x1b3a9e=_0x1b3a9e-0x0;var _0x53cdc2=_0x866a[_0x1b3a9e];return _0x53cdc2;};'use strict';var _=require('lodash');var util=require(_0xa866('0x0'));var moment=require(_0xa866('0x1'));var BPromise=require(_0xa866('0x2'));var rs=require(_0xa866('0x3'));var fs=require('fs');var Redis=require(_0xa866('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa866('0x5'));var logger=require(_0xa866('0x6'))(_0xa866('0x7'));var config=require('../../config/environment');var jayson=require(_0xa866('0x8'));var client=jayson[_0xa866('0x9')][_0xa866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288582,_0x3d1380,_0x2c7278){return new BPromise(function(_0x41a92a,_0x208625){return client[_0xa866('0xb')](_0x288582,_0x2c7278)[_0xa866('0xc')](function(_0x525ce6){logger[_0xa866('0xd')](_0xa866('0xe'),_0x3d1380,_0xa866('0xf'));logger['debug'](_0xa866('0x10'),_0x3d1380,_0xa866('0xf'),JSON[_0xa866('0x11')](_0x525ce6));if(_0x525ce6[_0xa866('0x12')]){if(_0x525ce6[_0xa866('0x12')][_0xa866('0x13')]===0x1f4){logger['error'](_0xa866('0xe'),_0x3d1380,_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);return _0x208625(_0x525ce6[_0xa866('0x12')]['message']);}logger[_0xa866('0x12')]('Automation,\x20%s,\x20%s',_0x3d1380,_0x525ce6[_0xa866('0x12')]['message']);return _0x41a92a(_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);}else{logger[_0xa866('0xd')]('Automation,\x20%s,\x20%s',_0x3d1380,_0xa866('0xf'));_0x41a92a(_0x525ce6[_0xa866('0x15')][_0xa866('0x14')]);}})[_0xa866('0x16')](function(_0x1e2211){logger[_0xa866('0x12')](_0xa866('0xe'),_0x3d1380,_0x1e2211);_0x208625(_0x1e2211);});});} \ No newline at end of file +var _0xc274=['../../config/logger','rpc','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b188c,_0x27afc5){var _0x38c26f=function(_0x1b900){while(--_0x1b900){_0x5b188c['push'](_0x5b188c['shift']());}};_0x38c26f(++_0x27afc5);}(_0xc274,0x151));var _0x4c27=function(_0x4be050,_0x58bb8c){_0x4be050=_0x4be050-0x0;var _0x3d95cc=_0xc274[_0x4be050];return _0x3d95cc;};'use strict';var _=require('lodash');var util=require(_0x4c27('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c27('0x1'));var fs=require('fs');var Redis=require(_0x4c27('0x2'));var db=require(_0x4c27('0x3'))['db'];var utils=require(_0x4c27('0x4'));var logger=require(_0x4c27('0x5'))(_0x4c27('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c27('0x7'));var client=jayson['client'][_0x4c27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18fd2c,_0x38de2d,_0x5f5058){return new BPromise(function(_0x478a91,_0x36daa2){return client['request'](_0x18fd2c,_0x5f5058)[_0x4c27('0x9')](function(_0x2a0c76){logger[_0x4c27('0xa')](_0x4c27('0xb'),_0x38de2d,_0x4c27('0xc'));logger['debug'](_0x4c27('0xd'),_0x38de2d,_0x4c27('0xc'),JSON[_0x4c27('0xe')](_0x2a0c76));if(_0x2a0c76[_0x4c27('0xf')]){if(_0x2a0c76['error']['code']===0x1f4){logger[_0x4c27('0xf')](_0x4c27('0xb'),_0x38de2d,_0x2a0c76['error']['message']);return _0x36daa2(_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);}logger[_0x4c27('0xf')]('Automation,\x20%s,\x20%s',_0x38de2d,_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);return _0x478a91(_0x2a0c76[_0x4c27('0xf')]['message']);}else{logger[_0x4c27('0xa')]('Automation,\x20%s,\x20%s',_0x38de2d,'request\x20sent');_0x478a91(_0x2a0c76[_0x4c27('0x11')][_0x4c27('0x10')]);}})[_0x4c27('0x12')](function(_0x4762ad){logger['error'](_0x4c27('0xb'),_0x38de2d,_0x4762ad);_0x36daa2(_0x4762ad);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index dbdb30f..da5dbf2 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 _0xd730=['get','/:id/actions','post','create','/:id/conditions','addConditions','addActions','put','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','/:id','show'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xd730,0xfd));var _0x0d73=function(_0x26a846,_0x261438){_0x26a846=_0x26a846-0x0;var _0x286a31=_0xd730[_0x26a846];return _0x286a31;};'use strict';var multer=require('multer');var util=require(_0x0d73('0x0'));var path=require('path');var timeout=require(_0x0d73('0x1'));var express=require('express');var router=express[_0x0d73('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0d73('0x3'));var interaction=require(_0x0d73('0x4'));var config=require(_0x0d73('0x5'));var controller=require(_0x0d73('0x6'));router['get']('/',auth[_0x0d73('0x7')](),controller[_0x0d73('0x8')]);router['get'](_0x0d73('0x9'),auth['isAuthenticated'](),controller[_0x0d73('0xa')]);router['get']('/:id/conditions',auth[_0x0d73('0x7')](),controller['getConditions']);router[_0x0d73('0xb')](_0x0d73('0xc'),auth[_0x0d73('0x7')](),controller['getActions']);router[_0x0d73('0xd')]('/',auth['isAuthenticated'](),controller[_0x0d73('0xe')]);router[_0x0d73('0xd')](_0x0d73('0xf'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x10')]);router[_0x0d73('0xd')](_0x0d73('0xc'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x11')]);router[_0x0d73('0x12')](_0x0d73('0x9'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x13')]);router['delete'](_0x0d73('0x9'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x14')]);module[_0x0d73('0x15')]=router; \ No newline at end of file +var _0x3e8e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','getActions','post','create','addActions','update','delete','destroy','util','path'];(function(_0x546e5d,_0x3abae2){var _0x3a8a61=function(_0xfd68ff){while(--_0xfd68ff){_0x546e5d['push'](_0x546e5d['shift']());}};_0x3a8a61(++_0x3abae2);}(_0x3e8e,0x106));var _0xe3e8=function(_0x17df88,_0x2d8962){_0x17df88=_0x17df88-0x0;var _0x2bdca9=_0x3e8e[_0x17df88];return _0x2bdca9;};'use strict';var multer=require('multer');var util=require(_0xe3e8('0x0'));var path=require(_0xe3e8('0x1'));var timeout=require(_0xe3e8('0x2'));var express=require(_0xe3e8('0x3'));var router=express[_0xe3e8('0x4')]();var fs_extra=require(_0xe3e8('0x5'));var auth=require(_0xe3e8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe3e8('0x7'));router[_0xe3e8('0x8')]('/',auth[_0xe3e8('0x9')](),controller[_0xe3e8('0xa')]);router[_0xe3e8('0x8')](_0xe3e8('0xb'),auth['isAuthenticated'](),controller[_0xe3e8('0xc')]);router['get']('/:id/conditions',auth[_0xe3e8('0x9')](),controller[_0xe3e8('0xd')]);router['get'](_0xe3e8('0xe'),auth[_0xe3e8('0x9')](),controller[_0xe3e8('0xf')]);router[_0xe3e8('0x10')]('/',auth[_0xe3e8('0x9')](),controller[_0xe3e8('0x11')]);router[_0xe3e8('0x10')]('/:id/conditions',auth[_0xe3e8('0x9')](),controller['addConditions']);router[_0xe3e8('0x10')](_0xe3e8('0xe'),auth['isAuthenticated'](),controller[_0xe3e8('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe3e8('0x13')]);router[_0xe3e8('0x14')](_0xe3e8('0xb'),auth[_0xe3e8('0x9')](),controller[_0xe3e8('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e44c451..6128feb 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 _0x1071=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen'];(function(_0xb113d7,_0x2fc306){var _0xd5a08d=function(_0x873634){while(--_0x873634){_0xb113d7['push'](_0xb113d7['shift']());}};_0xd5a08d(++_0x2fc306);}(_0x1071,0xde));var _0x1107=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1071[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x1107('0x0')]={'name':{'type':Sequelize[_0x1107('0x1')],'unique':_0x1107('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1107('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x1107('0x4')},'description':{'type':Sequelize[_0x1107('0x1')]},'active':{'type':Sequelize[_0x1107('0x5')],'defaultValue':0x0,'comment':_0x1107('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x1107('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1107('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1107('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1107('0x9')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'comment':_0x1107('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1107('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1107('0x1')],'defaultValue':_0x1107('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1107('0x3')](_0x1107('0xf'),_0x1107('0x10'),_0x1107('0x11')),'defaultValue':_0x1107('0xf')},'dialAMDActive':{'type':Sequelize[_0x1107('0x5')],'defaultValue':0x0,'comment':_0x1107('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x1107('0x9')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1107('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1107('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1107('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1107('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1107('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1107('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1107('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1107('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1107('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1107('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1107('0x3')](_0x1107('0x1b'),_0x1107('0x1c')),'defaultValue':_0x1107('0x1b')},'dialPrefix':{'type':Sequelize[_0x1107('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1107('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1107('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x27')}}; \ No newline at end of file +var _0x1126=['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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\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)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0x1126,0x177));var _0x6112=function(_0x1722bf,_0x2fa7f4){_0x1722bf=_0x1722bf-0x0;var _0x58c607=_0x1126[_0x1722bf];return _0x58c607;};'use strict';var Sequelize=require(_0x6112('0x0'));module[_0x6112('0x1')]={'name':{'type':Sequelize[_0x6112('0x2')],'unique':_0x6112('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6112('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x6112('0x5')},'description':{'type':Sequelize[_0x6112('0x2')]},'active':{'type':Sequelize[_0x6112('0x6')],'defaultValue':0x0,'comment':_0x6112('0x7')},'limitCalls':{'type':Sequelize[_0x6112('0x8')](0x4)[_0x6112('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6112('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6112('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6112('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6112('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6112('0x8')](0x5)[_0x6112('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x6112('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x6112('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6112('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'defaultValue':0x3,'comment':_0x6112('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6112('0x8')](0x5)[_0x6112('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6112('0xf')},'dialTimezone':{'type':Sequelize[_0x6112('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x6112('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x6112('0x11'),_0x6112('0x12'),_0x6112('0x13')),'defaultValue':_0x6112('0x11')},'dialAMDActive':{'type':Sequelize[_0x6112('0x6')],'defaultValue':0x0,'comment':_0x6112('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x6112('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6112('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x6112('0x8')](0x9)[_0x6112('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6112('0x8')](0x9)[_0x6112('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6112('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x6112('0x8')](0x9)[_0x6112('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6112('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x6112('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6112('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6112('0x8')](0x9)[_0x6112('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6112('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6112('0x8')](0x5)[_0x6112('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6112('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6112('0x8')](0x9)[_0x6112('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x6112('0x4')]('DESC',_0x6112('0x1b')),'defaultValue':_0x6112('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6112('0x1d')},'dialCutDigit':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6112('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6112('0x8')](0x5)[_0x6112('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6112('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6112('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x6112('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6112('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6112('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6112('0x8')](0x5)[_0x6112('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6112('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6112('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6112('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6112('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6112('0x8')](0x3)[_0x6112('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6112('0x8')](0x5)[_0x6112('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6112('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index bbe467c..f68fd0f 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 _0x58c4=['field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','CampaignId\x20=\x20?','cm_hopper_additional_phones','OrderBy','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','filter','merge','options','Campaign','rows','catch','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','userProfileId','error','includeAll','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','nolimit','order','pick','findAll','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x58c4,0x135));var _0x458c=function(_0x32eb00,_0x428dc0){_0x32eb00=_0x32eb00-0x0;var _0x4447ce=_0x58c4[_0x32eb00];return _0x4447ce;};'use strict';var emlformat=require(_0x458c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x458c('0x1'));var jsonpatch=require(_0x458c('0x2'));var rp=require(_0x458c('0x3'));var moment=require(_0x458c('0x4'));var BPromise=require(_0x458c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x458c('0x6'));var sox=require(_0x458c('0x7'));var csv=require(_0x458c('0x8'));var ejs=require(_0x458c('0x9'));var fs=require('fs');var fs_extra=require(_0x458c('0xa'));var _=require(_0x458c('0xb'));var squel=require(_0x458c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x458c('0xd'));var toCsv=require(_0x458c('0x8'));var querystring=require(_0x458c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x458c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x458c('0x10'))(_0x458c('0x11'));var utils=require(_0x458c('0x12'));var config=require(_0x458c('0x13'));var licenseUtil=require(_0x458c('0x14'));var db=require(_0x458c('0x15'))['db'];function respondWithStatusCode(_0xdbfe9e,_0x5ea16d){_0x5ea16d=_0x5ea16d||0xcc;return function(_0x13249c){if(_0x13249c){return _0xdbfe9e[_0x458c('0x16')](_0x5ea16d);}return _0xdbfe9e['status'](_0x5ea16d)[_0x458c('0x17')]();};}function respondWithResult(_0x385e15,_0x4dd1bb){_0x4dd1bb=_0x4dd1bb||0xc8;return function(_0x4096fb){if(_0x4096fb){return _0x385e15[_0x458c('0x18')](_0x4dd1bb)[_0x458c('0x19')](_0x4096fb);}};}function respondWithFilteredResult(_0x4ab110,_0x4d85bf){return function(_0x586048){if(_0x586048){var _0x54cc0c=typeof _0x4d85bf['offset']==='undefined'&&typeof _0x4d85bf[_0x458c('0x1a')]==='undefined';var _0x108b97=_0x586048[_0x458c('0x1b')];var _0x2aac1b=_0x54cc0c?0x0:_0x4d85bf['offset'];var _0x52674a=_0x54cc0c?_0x586048[_0x458c('0x1b')]:_0x4d85bf[_0x458c('0x1c')]+_0x4d85bf[_0x458c('0x1a')];var _0x484804;if(_0x52674a>=_0x108b97){_0x52674a=_0x108b97;_0x484804=0xc8;}else{_0x484804=0xce;}_0x4ab110[_0x458c('0x18')](_0x484804);return _0x4ab110[_0x458c('0x1d')](_0x458c('0x1e'),_0x2aac1b+'-'+_0x52674a+'/'+_0x108b97)['json'](_0x586048);}return null;};}function patchUpdates(_0x7b4338){return function(_0x1e88ee){try{jsonpatch[_0x458c('0x1f')](_0x1e88ee,_0x7b4338,!![]);}catch(_0x13fcd6){return BPromise[_0x458c('0x20')](_0x13fcd6);}return _0x1e88ee[_0x458c('0x21')]();};}function saveUpdates(_0x1adc6b,_0x5d325d){return function(_0x4f0ac){if(_0x4f0ac){return _0x4f0ac['update'](_0x1adc6b)[_0x458c('0x22')](function(_0x24da99){return _0x24da99;});}return null;};}function removeEntity(_0x4e0572,_0x311496){return function(_0x55c116){if(_0x55c116){return _0x55c116[_0x458c('0x23')]()[_0x458c('0x22')](function(){var _0x2039fc=_0x55c116[_0x458c('0x24')]({'plain':!![]});var _0x26d037='IvrCampaigns';return db[_0x458c('0x25')][_0x458c('0x23')]({'where':{'type':_0x26d037,'resourceId':_0x2039fc['id']}})[_0x458c('0x22')](function(){return _0x55c116;});})[_0x458c('0x22')](function(){_0x4e0572[_0x458c('0x18')](0xcc)[_0x458c('0x17')]();});}};}function handleEntityNotFound(_0xb3135e,_0x125eff){return function(_0x33ec76){if(!_0x33ec76){_0xb3135e[_0x458c('0x16')](0x194);}return _0x33ec76;};}function handleError(_0x4841ba,_0x2403fd){_0x2403fd=_0x2403fd||0x1f4;return function(_0x25a965){logger['error'](_0x25a965['stack']);if(_0x25a965[_0x458c('0x26')]){delete _0x25a965[_0x458c('0x26')];}_0x4841ba[_0x458c('0x18')](_0x2403fd)[_0x458c('0x27')](_0x25a965);};}exports[_0x458c('0x28')]=function(_0x579630,_0x360fd0){var _0x43093e={},_0xf7a600={},_0x485faa={'count':0x0,'rows':[]};var _0x4b1de4=_['map'](db['Campaign'][_0x458c('0x29')],function(_0x12f4f0){return{'name':_0x12f4f0[_0x458c('0x2a')],'type':_0x12f4f0['type'][_0x458c('0x2b')]};});_0xf7a600['model']=_[_0x458c('0x2c')](_0x4b1de4,'name');_0xf7a600[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x579630[_0x458c('0x2d')]);_0xf7a600[_0x458c('0x2f')]=_[_0x458c('0x30')](_0xf7a600[_0x458c('0x31')],_0xf7a600[_0x458c('0x2d')]);_0x43093e[_0x458c('0x32')]=_['intersection'](_0xf7a600['model'],qs[_0x458c('0x33')](_0x579630[_0x458c('0x2d')][_0x458c('0x33')]));_0x43093e['attributes']=_0x43093e[_0x458c('0x32')]['length']?_0x43093e[_0x458c('0x32')]:_0xf7a600[_0x458c('0x31')];if(!_0x579630['query'][_0x458c('0x34')]('nolimit')){_0x43093e[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x579630['query'][_0x458c('0x1a')]);_0x43093e[_0x458c('0x1c')]=qs['offset'](_0x579630[_0x458c('0x2d')]['offset']);}_0x43093e['order']=qs[_0x458c('0x35')](_0x579630[_0x458c('0x2d')][_0x458c('0x35')]);_0x43093e[_0x458c('0x36')]=qs[_0x458c('0x2f')](_['pick'](_0x579630[_0x458c('0x2d')],_0xf7a600[_0x458c('0x2f')]),_0x4b1de4);if(_0x579630[_0x458c('0x2d')][_0x458c('0x37')]){_0x43093e['where']=_[_0x458c('0x38')](_0x43093e[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x4b1de4,function(_0x2125ad){if(_0x2125ad['type']!=='VIRTUAL'){var _0x31066b={};_0x31066b[_0x2125ad[_0x458c('0x26')]]={'$like':'%'+_0x579630['query'][_0x458c('0x37')]+'%'};return _0x31066b;}})});}_0x43093e=_[_0x458c('0x38')]({},_0x43093e,_0x579630[_0x458c('0x39')]);var _0x1e1aa3={'where':_0x43093e[_0x458c('0x36')]};return db[_0x458c('0x3a')]['count'](_0x1e1aa3)[_0x458c('0x22')](function(_0x1992b0){_0x485faa['count']=_0x1992b0;if(_0x579630[_0x458c('0x2d')]['includeAll']){_0x43093e['include']=[{'all':!![]}];}return db['Campaign']['findAll'](_0x43093e);})['then'](function(_0x2e9ebd){_0x485faa[_0x458c('0x3b')]=_0x2e9ebd;return _0x485faa;})[_0x458c('0x22')](respondWithFilteredResult(_0x360fd0,_0x43093e))[_0x458c('0x3c')](handleError(_0x360fd0,null));};exports['show']=function(_0x3b856c,_0x237348){var _0x25ca5c={'raw':![],'where':{'id':_0x3b856c[_0x458c('0x3d')]['id']}},_0x2ce446={};_0x2ce446['model']=_[_0x458c('0x2e')](db['Campaign'][_0x458c('0x29')]);_0x2ce446[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x3b856c['query']);_0x2ce446[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x2ce446[_0x458c('0x31')],_0x2ce446[_0x458c('0x2d')]);_0x25ca5c[_0x458c('0x32')]=_['intersection'](_0x2ce446['model'],qs[_0x458c('0x33')](_0x3b856c[_0x458c('0x2d')][_0x458c('0x33')]));_0x25ca5c[_0x458c('0x32')]=_0x25ca5c[_0x458c('0x32')][_0x458c('0x3e')]?_0x25ca5c[_0x458c('0x32')]:_0x2ce446[_0x458c('0x31')];if(_0x3b856c[_0x458c('0x2d')]['includeAll']){_0x25ca5c[_0x458c('0x3f')]=[{'all':!![]}];}_0x25ca5c=_[_0x458c('0x38')]({},_0x25ca5c,_0x3b856c[_0x458c('0x39')]);return db[_0x458c('0x3a')][_0x458c('0x40')](_0x25ca5c)[_0x458c('0x22')](handleEntityNotFound(_0x237348,null))['then'](respondWithResult(_0x237348,null))['catch'](handleError(_0x237348,null));};exports['create']=function(_0x365903,_0x45f949){return db['Campaign'][_0x458c('0x41')](_0x365903[_0x458c('0x42')],{})[_0x458c('0x22')](function(_0x3637bd){var _0x5bc35c=_0x365903['user'][_0x458c('0x24')]({'plain':!![]});if(!_0x5bc35c)throw new Error(_0x458c('0x43'));if(_0x5bc35c[_0x458c('0x44')]===_0x458c('0x45')){var _0x3cee04=_0x3637bd['get']({'plain':!![]});var _0x36a25e=_0x458c('0x46');return db['UserProfileSection']['find']({'where':{'name':_0x36a25e,'userProfileId':_0x5bc35c[_0x458c('0x47')]},'raw':!![]})[_0x458c('0x22')](function(_0x30f82e){if(_0x30f82e&&_0x30f82e['autoAssociation']===0x0){return db['UserProfileResource'][_0x458c('0x41')]({'name':_0x3cee04[_0x458c('0x26')],'resourceId':_0x3cee04['id'],'type':_0x30f82e[_0x458c('0x26')],'sectionId':_0x30f82e['id']},{})[_0x458c('0x22')](function(){return _0x3637bd;});}else{return _0x3637bd;}})[_0x458c('0x3c')](function(_0x3a0105){logger[_0x458c('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a0105);throw _0x3a0105;});}return _0x3637bd;})[_0x458c('0x22')](respondWithResult(_0x45f949,0xc9))[_0x458c('0x3c')](handleError(_0x45f949,null));};exports['clone']=function(_0x4f8b67,_0x28eef2){var _0x66760={'where':{'id':_0x4f8b67[_0x458c('0x3d')]['id']}},_0x30d7ec={};_0x30d7ec[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x3a')]['rawAttributes']);_0x66760[_0x458c('0x32')]=_['intersection'](_0x30d7ec[_0x458c('0x31')],qs['fields'](_0x4f8b67[_0x458c('0x2d')][_0x458c('0x33')]));_0x66760[_0x458c('0x32')]=_0x66760['attributes']['length']?_0x66760[_0x458c('0x32')]:_0x30d7ec[_0x458c('0x31')];if(_0x4f8b67[_0x458c('0x2d')][_0x458c('0x49')]){_0x66760[_0x458c('0x3f')]=[{'all':!![]}];}_0x66760=_[_0x458c('0x38')]({},_0x66760,_0x4f8b67['options']);return db['Campaign'][_0x458c('0x40')](_0x66760)[_0x458c('0x22')](handleEntityNotFound(_0x28eef2,null))[_0x458c('0x22')](function(_0xc99888){if(_0xc99888){var _0x57311c=_0xc99888[_0x458c('0x24')]({'plain':!![]});_0x57311c=qs[_0x458c('0x4a')](_0x57311c,['id',_0x458c('0x4b'),'updatedAt']);_0x4f8b67['body']=_[_0x458c('0x4a')](_0x4f8b67[_0x458c('0x42')],['id','createdAt',_0x458c('0x4c')]);return db['Campaign'][_0x458c('0x41')](_['merge'](_0x57311c,_0x4f8b67['body']),{'include':_0x4f8b67['query'][_0x458c('0x49')]?[{'all':!![]}]:undefined})[_0x458c('0x22')](function(_0x3ce854){var _0x35d6f1=_0x4f8b67[_0x458c('0x45')][_0x458c('0x24')]({'plain':!![]});if(!_0x35d6f1)throw new Error(_0x458c('0x43'));if(_0x35d6f1[_0x458c('0x44')]===_0x458c('0x45')){var _0x3e183e=_0x3ce854[_0x458c('0x24')]({'plain':!![]});var _0x569099=_0x458c('0x46');return db[_0x458c('0x4d')][_0x458c('0x40')]({'where':{'name':_0x569099,'userProfileId':_0x35d6f1['userProfileId']},'raw':!![]})[_0x458c('0x22')](function(_0x3fec3c){if(_0x3fec3c&&_0x3fec3c[_0x458c('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3e183e[_0x458c('0x26')],'resourceId':_0x3e183e['id'],'type':_0x3fec3c['name'],'sectionId':_0x3fec3c['id']},{})[_0x458c('0x22')](function(){return _0x3ce854;});}else{return _0x3ce854;}})[_0x458c('0x3c')](function(_0x51248c){logger['error'](_0x458c('0x4f'),_0x51248c);throw _0x51248c;});}return _0x3ce854;});}})[_0x458c('0x22')](respondWithResult(_0x28eef2,0xc9))[_0x458c('0x3c')](handleError(_0x28eef2,null));};exports[_0x458c('0x50')]=function(_0x26a68d,_0x5b746c){if(_0x26a68d['body']['id']){delete _0x26a68d['body']['id'];}return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x26a68d[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x5b746c,null))['then'](saveUpdates(_0x26a68d[_0x458c('0x42')],null))[_0x458c('0x22')](respondWithResult(_0x5b746c,null))[_0x458c('0x3c')](handleError(_0x5b746c,null));};exports[_0x458c('0x23')]=function(_0x53c4e0,_0x290a65){return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x53c4e0[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x290a65,null))[_0x458c('0x22')](removeEntity(_0x290a65,null))[_0x458c('0x3c')](handleError(_0x290a65,null));};exports['getHoppers']=function(_0x2b8a61,_0x212dba,_0x3b9df2){var _0x1a2123={'raw':!![],'where':{}};var _0xb07f74={};var _0x52025c={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x2b8a61[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x212dba,null))['then'](function(_0x282c5e){if(_0x282c5e){_0xb07f74[_0x458c('0x31')]=_['keys'](db[_0x458c('0x52')]['rawAttributes']);_0xb07f74[_0x458c('0x2d')]=_['keys'](_0x2b8a61[_0x458c('0x2d')]);_0xb07f74['filters']=_[_0x458c('0x30')](_0xb07f74[_0x458c('0x31')],_0xb07f74[_0x458c('0x2d')]);_0x1a2123[_0x458c('0x32')]=_[_0x458c('0x30')](_0xb07f74[_0x458c('0x31')],qs[_0x458c('0x33')](_0x2b8a61[_0x458c('0x2d')][_0x458c('0x33')]));_0x1a2123['attributes']=_0x1a2123[_0x458c('0x32')][_0x458c('0x3e')]?_0x1a2123[_0x458c('0x32')]:_0xb07f74[_0x458c('0x31')];if(!_0x2b8a61[_0x458c('0x2d')][_0x458c('0x34')](_0x458c('0x53'))){_0x1a2123[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x2b8a61[_0x458c('0x2d')][_0x458c('0x1a')]);_0x1a2123[_0x458c('0x1c')]=qs['offset'](_0x2b8a61[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x1a2123[_0x458c('0x54')]=qs[_0x458c('0x35')](_0x2b8a61[_0x458c('0x2d')]['sort']);_0x1a2123['where']=qs[_0x458c('0x2f')](_[_0x458c('0x55')](_0x2b8a61[_0x458c('0x2d')],_0xb07f74['filters']));_0x1a2123[_0x458c('0x36')]['CampaignId']=_0x282c5e['id'];if(_0x2b8a61[_0x458c('0x2d')][_0x458c('0x37')]){_0x1a2123[_0x458c('0x36')]=_[_0x458c('0x38')](_0x1a2123[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x1a2123[_0x458c('0x32')],function(_0x4ddece){var _0x348535={};_0x348535[_0x4ddece]={'$like':'%'+_0x2b8a61[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x348535;})});}_0x1a2123=_['merge']({},_0x1a2123,_0x2b8a61[_0x458c('0x39')]);return db[_0x458c('0x52')][_0x458c('0x1b')]({'where':_0x1a2123[_0x458c('0x36')]})['then'](function(_0x2b7f63){_0x52025c[_0x458c('0x1b')]=_0x2b7f63;if(_0x2b8a61[_0x458c('0x2d')][_0x458c('0x49')]){_0x1a2123[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x52')][_0x458c('0x56')](_0x1a2123);})[_0x458c('0x22')](function(_0x1471c1){_0x52025c[_0x458c('0x3b')]=_0x1471c1;return _0x52025c;});}})[_0x458c('0x22')](respondWithFilteredResult(_0x212dba,_0x1a2123))['catch'](handleError(_0x212dba,null));};exports['getHopperHistories']=function(_0x9b0359,_0x23070a,_0x24837d){var _0x55bd9e={'raw':!![],'where':{}};var _0x24856e={};var _0x1f0aa3={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x9b0359['params']['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x23070a,null))[_0x458c('0x22')](function(_0x4ff8cb){if(_0x4ff8cb){_0x24856e[_0x458c('0x31')]=_[_0x458c('0x2e')](db['CmHopperHistory'][_0x458c('0x29')]);_0x24856e[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x9b0359['query']);_0x24856e['filters']=_[_0x458c('0x30')](_0x24856e[_0x458c('0x31')],_0x24856e['query']);_0x55bd9e['attributes']=_[_0x458c('0x30')](_0x24856e[_0x458c('0x31')],qs[_0x458c('0x33')](_0x9b0359['query']['fields']));_0x55bd9e[_0x458c('0x32')]=_0x55bd9e[_0x458c('0x32')]['length']?_0x55bd9e[_0x458c('0x32')]:_0x24856e[_0x458c('0x31')];if(!_0x9b0359[_0x458c('0x2d')][_0x458c('0x34')]('nolimit')){_0x55bd9e[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x9b0359[_0x458c('0x2d')][_0x458c('0x1a')]);_0x55bd9e[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x9b0359[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x55bd9e['order']=qs[_0x458c('0x35')](_0x9b0359[_0x458c('0x2d')]['sort']);_0x55bd9e['where']=qs[_0x458c('0x2f')](_['pick'](_0x9b0359[_0x458c('0x2d')],_0x24856e['filters']));_0x55bd9e[_0x458c('0x36')][_0x458c('0x57')]=_0x4ff8cb['id'];if(_0x9b0359[_0x458c('0x2d')][_0x458c('0x37')]){_0x55bd9e[_0x458c('0x36')]=_[_0x458c('0x38')](_0x55bd9e[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x55bd9e[_0x458c('0x32')],function(_0x2a0105){var _0x4b5dbd={};_0x4b5dbd[_0x2a0105]={'$like':'%'+_0x9b0359[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x4b5dbd;})});}_0x55bd9e=_[_0x458c('0x38')]({},_0x55bd9e,_0x9b0359[_0x458c('0x39')]);return db[_0x458c('0x58')]['count']({'where':_0x55bd9e['where']})['then'](function(_0x1b7b07){_0x1f0aa3['count']=_0x1b7b07;if(_0x9b0359[_0x458c('0x2d')]['includeAll']){_0x55bd9e[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x58')][_0x458c('0x56')](_0x55bd9e);})[_0x458c('0x22')](function(_0x140f29){_0x1f0aa3[_0x458c('0x3b')]=_0x140f29;return _0x1f0aa3;});}})[_0x458c('0x22')](respondWithFilteredResult(_0x23070a,_0x55bd9e))[_0x458c('0x3c')](handleError(_0x23070a,null));};exports[_0x458c('0x59')]=function(_0x5cfbc5,_0x400d44,_0x5143b3){var _0x2c70c3={'raw':!![],'where':{}};var _0x2a4e96={};var _0x5297a9={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x5cfbc5[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x400d44,null))['then'](function(_0x3af8dc){if(_0x3af8dc){_0x2a4e96[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5a')][_0x458c('0x29')]);_0x2a4e96[_0x458c('0x2d')]=_['keys'](_0x5cfbc5[_0x458c('0x2d')]);_0x2a4e96[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x2a4e96[_0x458c('0x31')],_0x2a4e96[_0x458c('0x2d')]);_0x2c70c3[_0x458c('0x32')]=_['intersection'](_0x2a4e96[_0x458c('0x31')],qs[_0x458c('0x33')](_0x5cfbc5['query']['fields']));_0x2c70c3[_0x458c('0x32')]=_0x2c70c3[_0x458c('0x32')]['length']?_0x2c70c3[_0x458c('0x32')]:_0x2a4e96[_0x458c('0x31')];if(!_0x5cfbc5['query'][_0x458c('0x34')](_0x458c('0x53'))){_0x2c70c3['limit']=qs[_0x458c('0x1a')](_0x5cfbc5[_0x458c('0x2d')][_0x458c('0x1a')]);_0x2c70c3[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x5cfbc5[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x2c70c3['order']=qs[_0x458c('0x35')](_0x5cfbc5[_0x458c('0x2d')]['sort']);_0x2c70c3['where']=qs[_0x458c('0x2f')](_['pick'](_0x5cfbc5['query'],_0x2a4e96[_0x458c('0x2f')]));_0x2c70c3[_0x458c('0x36')]['CampaignId']=_0x3af8dc['id'];if(_0x5cfbc5[_0x458c('0x2d')]['filter']){_0x2c70c3[_0x458c('0x36')]=_[_0x458c('0x38')](_0x2c70c3[_0x458c('0x36')],{'$or':_['map'](_0x2c70c3['attributes'],function(_0x2dd9c2){var _0x31fc1c={};_0x31fc1c[_0x2dd9c2]={'$like':'%'+_0x5cfbc5[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x31fc1c;})});}_0x2c70c3=_['merge']({},_0x2c70c3,_0x5cfbc5[_0x458c('0x39')]);return db[_0x458c('0x5a')][_0x458c('0x1b')]({'where':_0x2c70c3[_0x458c('0x36')]})[_0x458c('0x22')](function(_0x5ba396){_0x5297a9[_0x458c('0x1b')]=_0x5ba396;if(_0x5cfbc5['query']['includeAll']){_0x2c70c3[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x5a')][_0x458c('0x56')](_0x2c70c3);})['then'](function(_0x8b4e9d){_0x5297a9[_0x458c('0x3b')]=_0x8b4e9d;return _0x5297a9;});}})['then'](respondWithFilteredResult(_0x400d44,_0x2c70c3))['catch'](handleError(_0x400d44,null));};exports[_0x458c('0x5b')]=function(_0x184494,_0x456a61,_0x2f679c){var _0x4c8d43={'raw':!![],'where':{}};var _0x5a6fcd={};var _0x1c7023={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x184494[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x456a61,null))[_0x458c('0x22')](function(_0x57d2db){if(_0x57d2db){_0x5a6fcd[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5c')][_0x458c('0x29')]);_0x5a6fcd[_0x458c('0x2d')]=_['keys'](_0x184494[_0x458c('0x2d')]);_0x5a6fcd['filters']=_[_0x458c('0x30')](_0x5a6fcd[_0x458c('0x31')],_0x5a6fcd[_0x458c('0x2d')]);_0x4c8d43[_0x458c('0x32')]=_[_0x458c('0x30')](_0x5a6fcd[_0x458c('0x31')],qs[_0x458c('0x33')](_0x184494[_0x458c('0x2d')]['fields']));_0x4c8d43[_0x458c('0x32')]=_0x4c8d43['attributes'][_0x458c('0x3e')]?_0x4c8d43[_0x458c('0x32')]:_0x5a6fcd[_0x458c('0x31')];if(!_0x184494[_0x458c('0x2d')][_0x458c('0x34')]('nolimit')){_0x4c8d43[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x184494[_0x458c('0x2d')][_0x458c('0x1a')]);_0x4c8d43[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x184494[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x4c8d43[_0x458c('0x54')]=qs[_0x458c('0x35')](_0x184494[_0x458c('0x2d')][_0x458c('0x35')]);_0x4c8d43['where']=qs['filters'](_[_0x458c('0x55')](_0x184494[_0x458c('0x2d')],_0x5a6fcd['filters']));_0x4c8d43[_0x458c('0x36')][_0x458c('0x57')]=_0x57d2db['id'];if(_0x184494[_0x458c('0x2d')][_0x458c('0x37')]){_0x4c8d43['where']=_[_0x458c('0x38')](_0x4c8d43[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x4c8d43[_0x458c('0x32')],function(_0x532758){var _0x389ed0={};_0x389ed0[_0x532758]={'$like':'%'+_0x184494[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x389ed0;})});}_0x4c8d43=_[_0x458c('0x38')]({},_0x4c8d43,_0x184494[_0x458c('0x39')]);return db['CmHopperBlack'][_0x458c('0x1b')]({'where':_0x4c8d43[_0x458c('0x36')]})[_0x458c('0x22')](function(_0x4dd870){_0x1c7023['count']=_0x4dd870;if(_0x184494['query'][_0x458c('0x49')]){_0x4c8d43[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x5c')][_0x458c('0x56')](_0x4c8d43);})[_0x458c('0x22')](function(_0xadcbc1){_0x1c7023[_0x458c('0x3b')]=_0xadcbc1;return _0x1c7023;});}})[_0x458c('0x22')](respondWithFilteredResult(_0x456a61,_0x4c8d43))[_0x458c('0x3c')](handleError(_0x456a61,null));};exports[_0x458c('0x5d')]=function(_0xd3e523,_0x3efc5c,_0x5c17f4){var _0x227fc5={};var _0x2e4bc4={};var _0x2c5822;var _0x1c3b95;return db[_0x458c('0x3a')]['findOne']({'where':{'id':_0xd3e523[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x3efc5c,null))[_0x458c('0x22')](function(_0x51d4e1){if(_0x51d4e1){_0x2c5822=_0x51d4e1;_0x2e4bc4[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5e')][_0x458c('0x29')]);_0x2e4bc4['query']=_[_0x458c('0x2e')](_0xd3e523['query']);_0x2e4bc4[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x2e4bc4['model'],_0x2e4bc4[_0x458c('0x2d')]);_0x227fc5[_0x458c('0x32')]=_[_0x458c('0x30')](_0x2e4bc4['model'],qs['fields'](_0xd3e523[_0x458c('0x2d')][_0x458c('0x33')]));_0x227fc5[_0x458c('0x32')]=_0x227fc5['attributes'][_0x458c('0x3e')]?_0x227fc5[_0x458c('0x32')]:_0x2e4bc4[_0x458c('0x31')];_0x227fc5[_0x458c('0x54')]=qs['sort'](_0xd3e523['query'][_0x458c('0x35')]);_0x227fc5[_0x458c('0x36')]=qs[_0x458c('0x2f')](_[_0x458c('0x55')](_0xd3e523[_0x458c('0x2d')],_0x2e4bc4[_0x458c('0x2f')]));if(_0xd3e523['query'][_0x458c('0x37')]){_0x227fc5[_0x458c('0x36')]=_[_0x458c('0x38')](_0x227fc5[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x227fc5[_0x458c('0x32')],function(_0x98206f){var _0x2955ef={};_0x2955ef[_0x98206f]={'$like':'%'+_0xd3e523[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x2955ef;})});}_0x227fc5=_[_0x458c('0x38')]({},_0x227fc5,_0xd3e523['options']);return _0x2c5822[_0x458c('0x5d')](_0x227fc5);}})['then'](function(_0x5664b6){if(_0x5664b6){_0x1c3b95=_0x5664b6['length'];if(!_0xd3e523[_0x458c('0x2d')][_0x458c('0x34')](_0x458c('0x53'))){_0x227fc5[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0xd3e523['query'][_0x458c('0x1a')]);_0x227fc5[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0xd3e523[_0x458c('0x2d')][_0x458c('0x1c')]);}return _0x2c5822[_0x458c('0x5d')](_0x227fc5);}})[_0x458c('0x22')](function(_0x478a51){if(_0x478a51){return _0x478a51?{'count':_0x1c3b95,'rows':_0x478a51}:null;}})[_0x458c('0x22')](respondWithResult(_0x3efc5c,null))[_0x458c('0x3c')](handleError(_0x3efc5c,null));};exports[_0x458c('0x5f')]=function(_0x3e7910,_0x14336c,_0x4765eb){var _0x386b1a,_0x518898;var _0x4a895d=[];var _0x31087c=moment()[_0x458c('0x60')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x3e7910['params']['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x14336c,null))[_0x458c('0x22')](function(_0x21269d){if(_0x21269d){_0x518898=_0x21269d;return _0x21269d[_0x458c('0x5f')](_0x3e7910[_0x458c('0x42')][_0x458c('0x61')],_[_0x458c('0x4a')](_0x3e7910[_0x458c('0x42')],[_0x458c('0x61'),'id'])||{});}return null;})[_0x458c('0x62')](function(_0xef131e){var _0x46ad33;var _0x529e04;_0x386b1a=_0xef131e||[];var _0x3d03fa=[];if(_0xef131e){for(var _0x200187=0x0;_0x200187<_0xef131e['length'];_0x200187+=0x1){var _0x563921=_0xef131e[_0x200187]['get']({'plain':!![]});_0x518898[_0x458c('0x63')]=_0x3e7910[_0x458c('0x42')][_0x458c('0x63')]?_0x3e7910['body'][_0x458c('0x63')]:_0x518898[_0x458c('0x63')];switch(_0x518898[_0x458c('0x63')]){case _0x458c('0x64'):_0x46ad33=squel[_0x458c('0x65')]()['into'](_0x458c('0x66'))[_0x458c('0x67')]([_0x458c('0x68'),_0x458c('0x69'),_0x458c('0x6a'),_0x458c('0x6b'),_0x458c('0x57'),_0x458c('0x4b'),_0x458c('0x4c')],squel['select']()[_0x458c('0x6c')](_0x458c('0x68'),'phone')['field'](_0x458c('0x6d'),_0x458c('0x69'))[_0x458c('0x6c')]('id',_0x458c('0x6a'))[_0x458c('0x6c')](_0x563921[_0x458c('0x6e')][_0x458c('0x6f')](),_0x458c('0x6b'))['field'](_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')](),_0x458c('0x57'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))[_0x458c('0x6c')]('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x71'))[_0x458c('0x36')](_0x458c('0x72'))['where'](_0x458c('0x73'),_0x563921['CmListId']['toString']())[_0x458c('0x36')](_0x458c('0x74'))[_0x458c('0x36')](_0x458c('0x75'),squel[_0x458c('0x76')]()[_0x458c('0x6c')]('COALESCE(calleridnum,\x27\x27)')[_0x458c('0x70')](_0x458c('0x77'))['where']('CampaignId\x20=\x20?',_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')]()))[_0x458c('0x36')](_0x458c('0x75'),squel[_0x458c('0x76')]()['field'](_0x458c('0x78'))[_0x458c('0x70')](_0x458c('0x66'))['where']('CampaignId\x20=\x20?',_0x3e7910[_0x458c('0x3d')]['id']['toString']())))[_0x458c('0x6f')]();break;case _0x458c('0x79'):_0x46ad33=squel[_0x458c('0x65')]()[_0x458c('0x7a')](_0x458c('0x66'))[_0x458c('0x67')]([_0x458c('0x68'),_0x458c('0x69'),'ContactId',_0x458c('0x6b'),_0x458c('0x57'),'createdAt','updatedAt'],squel['select']()['field'](_0x458c('0x68'),_0x458c('0x68'))['field'](_0x458c('0x6d'),_0x458c('0x69'))[_0x458c('0x6c')]('id',_0x458c('0x6a'))[_0x458c('0x6c')](_0x563921[_0x458c('0x6e')]['toString'](),'ListId')[_0x458c('0x6c')](_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')](),'CampaignId')[_0x458c('0x6c')]('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')]('cm_contacts')['where'](_0x458c('0x72'))[_0x458c('0x36')]('ListId\x20=\x20?',_0x563921[_0x458c('0x6e')][_0x458c('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x458c('0x36')](_0x458c('0x75'),squel[_0x458c('0x76')]()[_0x458c('0x6c')](_0x458c('0x78'))['from'](_0x458c('0x66'))[_0x458c('0x36')](_0x458c('0x7b'),_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')]())))[_0x458c('0x6f')]();break;default:_0x46ad33=squel[_0x458c('0x65')]()['into']('cm_hopper')[_0x458c('0x67')]([_0x458c('0x68'),_0x458c('0x69'),_0x458c('0x6a'),'ListId','CampaignId',_0x458c('0x4b'),_0x458c('0x4c')],squel[_0x458c('0x76')]()[_0x458c('0x6c')](_0x458c('0x68'),_0x458c('0x68'))[_0x458c('0x6c')](_0x458c('0x6d'),_0x458c('0x69'))[_0x458c('0x6c')]('id','ContactId')[_0x458c('0x6c')](_0x563921[_0x458c('0x6e')][_0x458c('0x6f')](),'ListId')[_0x458c('0x6c')](_0x3e7910['params']['id'][_0x458c('0x6f')](),_0x458c('0x57'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))[_0x458c('0x6c')]('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x71'))[_0x458c('0x36')]('deletedAt\x20IS\x20NULL')[_0x458c('0x36')](_0x458c('0x73'),_0x563921[_0x458c('0x6e')]['toString']())[_0x458c('0x36')](_0x458c('0x74')))[_0x458c('0x6f')]();}_0x529e04=squel['insert']()['into'](_0x458c('0x7c'))['fromQuery'](['cmHopperId',_0x458c('0x69'),_0x458c('0x68'),_0x458c('0x7d'),_0x458c('0x4b'),_0x458c('0x4c')],squel[_0x458c('0x76')]()[_0x458c('0x6c')]('h.id','id')[_0x458c('0x6c')](_0x458c('0x6d'),'scheduledAt')[_0x458c('0x6c')](_0x458c('0x7e'),_0x458c('0x68'))['field']('ci.OrderBY',_0x458c('0x7d'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x7f'),'ci')['join'](_0x458c('0x66'),'h',_0x458c('0x80'))[_0x458c('0x36')]('h.ListId\x20=\x20?',_0x563921[_0x458c('0x6e')]['toString']())['where']('h.CampaignId=?',_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')]())[_0x458c('0x36')](_0x458c('0x81'),_0x31087c))[_0x458c('0x6f')]();_0x3d03fa[_0x458c('0x82')](db[_0x458c('0x83')]['query'](_0x46ad33));_0x4a895d['push'](db['sequelize'][_0x458c('0x2d')](_0x529e04));}return BPromise[_0x458c('0x84')](_0x3d03fa);}})[_0x458c('0x22')](function(){return BPromise[_0x458c('0x84')](_0x4a895d);})['then'](function(){return _0x386b1a;})[_0x458c('0x22')](respondWithResult(_0x14336c,null))[_0x458c('0x3c')](handleError(_0x14336c,null));};exports['removeLists']=function(_0x3029c2,_0x5414a4,_0x2fa7b3){return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x3029c2[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x5414a4,null))[_0x458c('0x22')](function(_0x4cf5d5){if(_0x4cf5d5){return _0x4cf5d5[_0x458c('0x85')](_0x3029c2['query'][_0x458c('0x61')]);}})['then'](function(_0xba9d38){if(_0xba9d38){return db[_0x458c('0x52')][_0x458c('0x23')]({'where':{'ListId':_0x3029c2['query']['ids'],'CampaignId':_0x3029c2[_0x458c('0x3d')]['id']}})['then'](function(){return _0xba9d38;});}})[_0x458c('0x22')](respondWithStatusCode(_0x5414a4,null))['catch'](handleError(_0x5414a4,null));};exports['getBlackLists']=function(_0x496fed,_0x4f6924,_0x31f215){var _0x42067f={};var _0x140bca={};var _0x2386a8;var _0x438edd;return db['Campaign'][_0x458c('0x51')]({'where':{'id':_0x496fed[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x4f6924,null))['then'](function(_0x3320fc){if(_0x3320fc){_0x2386a8=_0x3320fc;_0x140bca[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5e')][_0x458c('0x29')]);_0x140bca[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x496fed[_0x458c('0x2d')]);_0x140bca[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x140bca['model'],_0x140bca[_0x458c('0x2d')]);_0x42067f[_0x458c('0x32')]=_[_0x458c('0x30')](_0x140bca[_0x458c('0x31')],qs[_0x458c('0x33')](_0x496fed['query'][_0x458c('0x33')]));_0x42067f[_0x458c('0x32')]=_0x42067f[_0x458c('0x32')][_0x458c('0x3e')]?_0x42067f['attributes']:_0x140bca['model'];_0x42067f['order']=qs[_0x458c('0x35')](_0x496fed[_0x458c('0x2d')][_0x458c('0x35')]);_0x42067f['where']=qs[_0x458c('0x2f')](_[_0x458c('0x55')](_0x496fed['query'],_0x140bca[_0x458c('0x2f')]));if(_0x496fed['query'][_0x458c('0x37')]){_0x42067f[_0x458c('0x36')]=_['merge'](_0x42067f[_0x458c('0x36')],{'$or':_['map'](_0x42067f['attributes'],function(_0x13fcff){var _0x55fcf7={};_0x55fcf7[_0x13fcff]={'$like':'%'+_0x496fed['query'][_0x458c('0x37')]+'%'};return _0x55fcf7;})});}_0x42067f=_[_0x458c('0x38')]({},_0x42067f,_0x496fed['options']);return _0x2386a8[_0x458c('0x86')](_0x42067f);}})[_0x458c('0x22')](function(_0x8914b){if(_0x8914b){_0x438edd=_0x8914b['length'];if(!_0x496fed['query'][_0x458c('0x34')]('nolimit')){_0x42067f[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x496fed[_0x458c('0x2d')]['limit']);_0x42067f[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x496fed[_0x458c('0x2d')][_0x458c('0x1c')]);}return _0x2386a8['getBlackLists'](_0x42067f);}})[_0x458c('0x22')](function(_0x574380){if(_0x574380){return _0x574380?{'count':_0x438edd,'rows':_0x574380}:null;}})[_0x458c('0x22')](respondWithResult(_0x4f6924,null))[_0x458c('0x3c')](handleError(_0x4f6924,null));};exports[_0x458c('0x87')]=function(_0x5b9701,_0x59bc3a,_0x1244d1){var _0x4ff89f,_0x4f009b;var _0x576ba1=[];var _0x4ccdd6=moment()[_0x458c('0x60')](_0x458c('0x88'));return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x5b9701[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x59bc3a,null))[_0x458c('0x22')](function(_0xd0ab84){if(_0xd0ab84){_0x4f009b=_0xd0ab84;return _0xd0ab84[_0x458c('0x87')](_0x5b9701[_0x458c('0x42')]['ids'],_['omit'](_0x5b9701[_0x458c('0x42')],[_0x458c('0x61'),'id'])||{});}return null;})['spread'](function(_0x4a88fd){var _0x39a128;var _0x429ba2;_0x4ff89f=_0x4a88fd||[];var _0x5e06dd=[];if(_0x4a88fd){for(var _0x146162=0x0;_0x146162<_0x4a88fd[_0x458c('0x3e')];_0x146162+=0x1){var _0x4c45df=_0x4a88fd[_0x146162][_0x458c('0x24')]({'plain':!![]});_0x39a128=squel['insert']()[_0x458c('0x7a')](_0x458c('0x89'))[_0x458c('0x67')](['phone','ContactId',_0x458c('0x6b'),_0x458c('0x57'),_0x458c('0x4b'),_0x458c('0x4c')],squel[_0x458c('0x76')]()['field']('phone',_0x458c('0x68'))[_0x458c('0x6c')]('id',_0x458c('0x6a'))[_0x458c('0x6c')](_0x4c45df[_0x458c('0x6e')]['toString'](),'ListId')['field'](_0x5b9701[_0x458c('0x3d')]['id'][_0x458c('0x6f')](),_0x458c('0x57'))[_0x458c('0x6c')](_0x458c('0x6d'),'createdAt')['field']('NOW()',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x71'))[_0x458c('0x36')](_0x458c('0x72'))['where'](_0x458c('0x73'),_0x4c45df['CmListId'][_0x458c('0x6f')]())[_0x458c('0x36')](_0x458c('0x74')))['toString']();_0x5e06dd[_0x458c('0x82')](db['sequelize'][_0x458c('0x2d')](_0x39a128));}return BPromise[_0x458c('0x84')](_0x5e06dd);}})['then'](function(){return _0x4ff89f;})[_0x458c('0x22')](respondWithResult(_0x59bc3a,null))[_0x458c('0x3c')](handleError(_0x59bc3a,null));};exports['removeBlackLists']=function(_0x45d7bc,_0xbf348,_0x11c432){return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x45d7bc[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0xbf348,null))[_0x458c('0x22')](function(_0x43dc50){if(_0x43dc50){return _0x43dc50[_0x458c('0x8a')](_0x45d7bc[_0x458c('0x2d')][_0x458c('0x61')]);}})[_0x458c('0x22')](function(_0x561ee0){if(_0x561ee0){return db[_0x458c('0x5c')][_0x458c('0x23')]({'where':{'ListId':_0x45d7bc['query']['ids'],'CampaignId':_0x45d7bc[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](function(){return _0x561ee0;});}})['then'](respondWithStatusCode(_0xbf348,null))[_0x458c('0x3c')](handleError(_0xbf348,null));}; \ No newline at end of file +var _0x1477=['h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','options','where','Campaign','includeAll','include','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','clone','find','omit','createdAt','updatedAt','user','getHoppers','CmHopper','findAll','getHopperHistories','findOne','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','ContactId','into','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?'];(function(_0x5a3a60,_0x3c3ad5){var _0xe5ea9=function(_0x1dd2f0){while(--_0x1dd2f0){_0x5a3a60['push'](_0x5a3a60['shift']());}};_0xe5ea9(++_0x3c3ad5);}(_0x1477,0x122));var _0x7147=function(_0x5b8357,_0x16b012){_0x5b8357=_0x5b8357-0x0;var _0x5c63c7=_0x1477[_0x5b8357];return _0x5c63c7;};'use strict';var emlformat=require(_0x7147('0x0'));var rimraf=require(_0x7147('0x1'));var zipdir=require(_0x7147('0x2'));var jsonpatch=require(_0x7147('0x3'));var rp=require(_0x7147('0x4'));var moment=require('moment');var BPromise=require(_0x7147('0x5'));var Mustache=require(_0x7147('0x6'));var util=require('util');var path=require(_0x7147('0x7'));var sox=require(_0x7147('0x8'));var csv=require(_0x7147('0x9'));var ejs=require(_0x7147('0xa'));var fs=require('fs');var fs_extra=require(_0x7147('0xb'));var _=require(_0x7147('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7147('0x9'));var querystring=require(_0x7147('0xd'));var Papa=require('papaparse');var Redis=require(_0x7147('0xe'));var authService=require(_0x7147('0xf'));var qs=require(_0x7147('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7147('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7147('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7147('0x13'));var db=require(_0x7147('0x14'))['db'];function respondWithStatusCode(_0x50e05e,_0x495512){_0x495512=_0x495512||0xcc;return function(_0x24d58b){if(_0x24d58b){return _0x50e05e[_0x7147('0x15')](_0x495512);}return _0x50e05e[_0x7147('0x16')](_0x495512)[_0x7147('0x17')]();};}function respondWithResult(_0xd4156b,_0x4ded34){_0x4ded34=_0x4ded34||0xc8;return function(_0xe1a401){if(_0xe1a401){return _0xd4156b[_0x7147('0x16')](_0x4ded34)[_0x7147('0x18')](_0xe1a401);}};}function respondWithFilteredResult(_0xd3fabf,_0x36a6a7){return function(_0x40d373){if(_0x40d373){var _0x32fdc9=typeof _0x36a6a7['offset']===_0x7147('0x19')&&typeof _0x36a6a7[_0x7147('0x1a')]===_0x7147('0x19');var _0x517bf9=_0x40d373[_0x7147('0x1b')];var _0x4ae0d3=_0x32fdc9?0x0:_0x36a6a7['offset'];var _0x10b987=_0x32fdc9?_0x40d373[_0x7147('0x1b')]:_0x36a6a7[_0x7147('0x1c')]+_0x36a6a7[_0x7147('0x1a')];var _0x272229;if(_0x10b987>=_0x517bf9){_0x10b987=_0x517bf9;_0x272229=0xc8;}else{_0x272229=0xce;}_0xd3fabf[_0x7147('0x16')](_0x272229);return _0xd3fabf[_0x7147('0x1d')]('Content-Range',_0x4ae0d3+'-'+_0x10b987+'/'+_0x517bf9)[_0x7147('0x18')](_0x40d373);}return null;};}function patchUpdates(_0x43a9a3){return function(_0x58ed61){try{jsonpatch[_0x7147('0x1e')](_0x58ed61,_0x43a9a3,!![]);}catch(_0xb7a297){return BPromise[_0x7147('0x1f')](_0xb7a297);}return _0x58ed61[_0x7147('0x20')]();};}function saveUpdates(_0x2f19a3,_0x37acfa){return function(_0x12b2a0){if(_0x12b2a0){return _0x12b2a0['update'](_0x2f19a3)[_0x7147('0x21')](function(_0x2cc01b){return _0x2cc01b;});}return null;};}function removeEntity(_0x1a4048,_0x169dd9){return function(_0x12cdcc){if(_0x12cdcc){return _0x12cdcc[_0x7147('0x22')]()[_0x7147('0x21')](function(){var _0x2b8e0a=_0x12cdcc[_0x7147('0x23')]({'plain':!![]});var _0x5ecc40=_0x7147('0x24');return db[_0x7147('0x25')][_0x7147('0x22')]({'where':{'type':_0x5ecc40,'resourceId':_0x2b8e0a['id']}})['then'](function(){return _0x12cdcc;});})[_0x7147('0x21')](function(){_0x1a4048[_0x7147('0x16')](0xcc)[_0x7147('0x17')]();});}};}function handleEntityNotFound(_0x215617,_0x37a9ac){return function(_0x129328){if(!_0x129328){_0x215617[_0x7147('0x15')](0x194);}return _0x129328;};}function handleError(_0x4f6ca4,_0x189384){_0x189384=_0x189384||0x1f4;return function(_0x574a43){logger[_0x7147('0x26')](_0x574a43[_0x7147('0x27')]);if(_0x574a43[_0x7147('0x28')]){delete _0x574a43[_0x7147('0x28')];}_0x4f6ca4[_0x7147('0x16')](_0x189384)[_0x7147('0x29')](_0x574a43);};}exports[_0x7147('0x2a')]=function(_0x2d968c,_0x39dd79){var _0x3d5a4a={},_0x18a79c={},_0x16fd8f={'count':0x0,'rows':[]};var _0x464487=_['map'](db['Campaign'][_0x7147('0x2b')],function(_0x4db8a0){return{'name':_0x4db8a0[_0x7147('0x2c')],'type':_0x4db8a0[_0x7147('0x2d')][_0x7147('0x2e')]};});_0x18a79c[_0x7147('0x2f')]=_[_0x7147('0x30')](_0x464487,_0x7147('0x28'));_0x18a79c[_0x7147('0x31')]=_[_0x7147('0x32')](_0x2d968c[_0x7147('0x31')]);_0x18a79c['filters']=_[_0x7147('0x33')](_0x18a79c[_0x7147('0x2f')],_0x18a79c[_0x7147('0x31')]);_0x3d5a4a[_0x7147('0x34')]=_['intersection'](_0x18a79c[_0x7147('0x2f')],qs[_0x7147('0x35')](_0x2d968c['query'][_0x7147('0x35')]));_0x3d5a4a['attributes']=_0x3d5a4a[_0x7147('0x34')][_0x7147('0x36')]?_0x3d5a4a['attributes']:_0x18a79c[_0x7147('0x2f')];if(!_0x2d968c[_0x7147('0x31')][_0x7147('0x37')](_0x7147('0x38'))){_0x3d5a4a['limit']=qs[_0x7147('0x1a')](_0x2d968c[_0x7147('0x31')][_0x7147('0x1a')]);_0x3d5a4a[_0x7147('0x1c')]=qs[_0x7147('0x1c')](_0x2d968c[_0x7147('0x31')]['offset']);}_0x3d5a4a[_0x7147('0x39')]=qs[_0x7147('0x3a')](_0x2d968c[_0x7147('0x31')][_0x7147('0x3a')]);_0x3d5a4a['where']=qs[_0x7147('0x3b')](_[_0x7147('0x3c')](_0x2d968c['query'],_0x18a79c['filters']),_0x464487);if(_0x2d968c['query'][_0x7147('0x3d')]){_0x3d5a4a['where']=_[_0x7147('0x3e')](_0x3d5a4a['where'],{'$or':_[_0x7147('0x30')](_0x464487,function(_0x2ffddf){if(_0x2ffddf[_0x7147('0x2d')]!=='VIRTUAL'){var _0x4d9c6b={};_0x4d9c6b[_0x2ffddf[_0x7147('0x28')]]={'$like':'%'+_0x2d968c[_0x7147('0x31')][_0x7147('0x3d')]+'%'};return _0x4d9c6b;}})});}_0x3d5a4a=_[_0x7147('0x3e')]({},_0x3d5a4a,_0x2d968c[_0x7147('0x3f')]);var _0x122a07={'where':_0x3d5a4a[_0x7147('0x40')]};return db[_0x7147('0x41')]['count'](_0x122a07)['then'](function(_0x45cc0a){_0x16fd8f['count']=_0x45cc0a;if(_0x2d968c[_0x7147('0x31')][_0x7147('0x42')]){_0x3d5a4a[_0x7147('0x43')]=[{'all':!![]}];}return db[_0x7147('0x41')]['findAll'](_0x3d5a4a);})[_0x7147('0x21')](function(_0x355245){_0x16fd8f[_0x7147('0x44')]=_0x355245;return _0x16fd8f;})[_0x7147('0x21')](respondWithFilteredResult(_0x39dd79,_0x3d5a4a))[_0x7147('0x45')](handleError(_0x39dd79,null));};exports[_0x7147('0x46')]=function(_0x16f0e9,_0x15326){var _0xe3851b={'raw':![],'where':{'id':_0x16f0e9[_0x7147('0x47')]['id']}},_0x12c37b={};_0x12c37b['model']=_[_0x7147('0x32')](db[_0x7147('0x41')][_0x7147('0x2b')]);_0x12c37b[_0x7147('0x31')]=_[_0x7147('0x32')](_0x16f0e9['query']);_0x12c37b[_0x7147('0x3b')]=_[_0x7147('0x33')](_0x12c37b['model'],_0x12c37b[_0x7147('0x31')]);_0xe3851b['attributes']=_[_0x7147('0x33')](_0x12c37b[_0x7147('0x2f')],qs[_0x7147('0x35')](_0x16f0e9[_0x7147('0x31')][_0x7147('0x35')]));_0xe3851b[_0x7147('0x34')]=_0xe3851b[_0x7147('0x34')][_0x7147('0x36')]?_0xe3851b[_0x7147('0x34')]:_0x12c37b[_0x7147('0x2f')];if(_0x16f0e9[_0x7147('0x31')][_0x7147('0x42')]){_0xe3851b['include']=[{'all':!![]}];}_0xe3851b=_[_0x7147('0x3e')]({},_0xe3851b,_0x16f0e9[_0x7147('0x3f')]);return db[_0x7147('0x41')]['find'](_0xe3851b)[_0x7147('0x21')](handleEntityNotFound(_0x15326,null))[_0x7147('0x21')](respondWithResult(_0x15326,null))[_0x7147('0x45')](handleError(_0x15326,null));};exports[_0x7147('0x48')]=function(_0x4c163f,_0x4f37bf){return db[_0x7147('0x41')][_0x7147('0x48')](_0x4c163f[_0x7147('0x49')],{})['then'](function(_0x5709c1){var _0x825217=_0x4c163f['user'][_0x7147('0x23')]({'plain':!![]});if(!_0x825217)throw new Error(_0x7147('0x4a'));if(_0x825217['role']==='user'){var _0x5d204b=_0x5709c1[_0x7147('0x23')]({'plain':!![]});var _0x1df3ba=_0x7147('0x24');return db[_0x7147('0x4b')]['find']({'where':{'name':_0x1df3ba,'userProfileId':_0x825217[_0x7147('0x4c')]},'raw':!![]})['then'](function(_0x1d4f8f){if(_0x1d4f8f&&_0x1d4f8f[_0x7147('0x4d')]===0x0){return db[_0x7147('0x25')]['create']({'name':_0x5d204b[_0x7147('0x28')],'resourceId':_0x5d204b['id'],'type':_0x1d4f8f[_0x7147('0x28')],'sectionId':_0x1d4f8f['id']},{})['then'](function(){return _0x5709c1;});}else{return _0x5709c1;}})[_0x7147('0x45')](function(_0x40a5d9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40a5d9);throw _0x40a5d9;});}return _0x5709c1;})[_0x7147('0x21')](respondWithResult(_0x4f37bf,0xc9))['catch'](handleError(_0x4f37bf,null));};exports[_0x7147('0x4e')]=function(_0x2aed53,_0x5a70d8){var _0x51dab1={'where':{'id':_0x2aed53[_0x7147('0x47')]['id']}},_0x15cc7c={};_0x15cc7c[_0x7147('0x2f')]=_[_0x7147('0x32')](db['Campaign'][_0x7147('0x2b')]);_0x51dab1[_0x7147('0x34')]=_['intersection'](_0x15cc7c[_0x7147('0x2f')],qs['fields'](_0x2aed53[_0x7147('0x31')]['fields']));_0x51dab1[_0x7147('0x34')]=_0x51dab1[_0x7147('0x34')][_0x7147('0x36')]?_0x51dab1['attributes']:_0x15cc7c['model'];if(_0x2aed53[_0x7147('0x31')][_0x7147('0x42')]){_0x51dab1['include']=[{'all':!![]}];}_0x51dab1=_['merge']({},_0x51dab1,_0x2aed53['options']);return db[_0x7147('0x41')][_0x7147('0x4f')](_0x51dab1)[_0x7147('0x21')](handleEntityNotFound(_0x5a70d8,null))[_0x7147('0x21')](function(_0x505a22){if(_0x505a22){var _0x9f0dfa=_0x505a22['get']({'plain':!![]});_0x9f0dfa=qs[_0x7147('0x50')](_0x9f0dfa,['id',_0x7147('0x51'),_0x7147('0x52')]);_0x2aed53[_0x7147('0x49')]=_['omit'](_0x2aed53[_0x7147('0x49')],['id',_0x7147('0x51'),_0x7147('0x52')]);return db[_0x7147('0x41')][_0x7147('0x48')](_[_0x7147('0x3e')](_0x9f0dfa,_0x2aed53[_0x7147('0x49')]),{'include':_0x2aed53[_0x7147('0x31')][_0x7147('0x42')]?[{'all':!![]}]:undefined})[_0x7147('0x21')](function(_0x540bfa){var _0x4aa4e8=_0x2aed53[_0x7147('0x53')][_0x7147('0x23')]({'plain':!![]});if(!_0x4aa4e8)throw new Error(_0x7147('0x4a'));if(_0x4aa4e8['role']===_0x7147('0x53')){var _0x488bc7=_0x540bfa[_0x7147('0x23')]({'plain':!![]});var _0x1add4a=_0x7147('0x24');return db[_0x7147('0x4b')][_0x7147('0x4f')]({'where':{'name':_0x1add4a,'userProfileId':_0x4aa4e8[_0x7147('0x4c')]},'raw':!![]})[_0x7147('0x21')](function(_0xcebce9){if(_0xcebce9&&_0xcebce9[_0x7147('0x4d')]===0x0){return db[_0x7147('0x25')]['create']({'name':_0x488bc7[_0x7147('0x28')],'resourceId':_0x488bc7['id'],'type':_0xcebce9[_0x7147('0x28')],'sectionId':_0xcebce9['id']},{})[_0x7147('0x21')](function(){return _0x540bfa;});}else{return _0x540bfa;}})[_0x7147('0x45')](function(_0x160b14){logger[_0x7147('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x160b14);throw _0x160b14;});}return _0x540bfa;});}})[_0x7147('0x21')](respondWithResult(_0x5a70d8,0xc9))[_0x7147('0x45')](handleError(_0x5a70d8,null));};exports['update']=function(_0x1316d6,_0x341ed0){if(_0x1316d6[_0x7147('0x49')]['id']){delete _0x1316d6['body']['id'];}return db[_0x7147('0x41')]['find']({'where':{'id':_0x1316d6[_0x7147('0x47')]['id']}})[_0x7147('0x21')](handleEntityNotFound(_0x341ed0,null))['then'](saveUpdates(_0x1316d6[_0x7147('0x49')],null))[_0x7147('0x21')](respondWithResult(_0x341ed0,null))[_0x7147('0x45')](handleError(_0x341ed0,null));};exports[_0x7147('0x22')]=function(_0x5d7ade,_0xddcac8){return db[_0x7147('0x41')]['find']({'where':{'id':_0x5d7ade[_0x7147('0x47')]['id']}})[_0x7147('0x21')](handleEntityNotFound(_0xddcac8,null))[_0x7147('0x21')](removeEntity(_0xddcac8,null))[_0x7147('0x45')](handleError(_0xddcac8,null));};exports[_0x7147('0x54')]=function(_0x33ff8b,_0x539c19,_0x2f6bb8){var _0x535c79={'raw':!![],'where':{}};var _0x5249a6={};var _0x32df3f={'count':0x0,'rows':[]};return db[_0x7147('0x41')]['findOne']({'where':{'id':_0x33ff8b[_0x7147('0x47')]['id']}})['then'](handleEntityNotFound(_0x539c19,null))['then'](function(_0x4a6721){if(_0x4a6721){_0x5249a6[_0x7147('0x2f')]=_[_0x7147('0x32')](db[_0x7147('0x55')][_0x7147('0x2b')]);_0x5249a6[_0x7147('0x31')]=_[_0x7147('0x32')](_0x33ff8b[_0x7147('0x31')]);_0x5249a6['filters']=_[_0x7147('0x33')](_0x5249a6[_0x7147('0x2f')],_0x5249a6[_0x7147('0x31')]);_0x535c79[_0x7147('0x34')]=_['intersection'](_0x5249a6['model'],qs[_0x7147('0x35')](_0x33ff8b['query'][_0x7147('0x35')]));_0x535c79[_0x7147('0x34')]=_0x535c79[_0x7147('0x34')][_0x7147('0x36')]?_0x535c79[_0x7147('0x34')]:_0x5249a6[_0x7147('0x2f')];if(!_0x33ff8b[_0x7147('0x31')][_0x7147('0x37')]('nolimit')){_0x535c79[_0x7147('0x1a')]=qs['limit'](_0x33ff8b[_0x7147('0x31')]['limit']);_0x535c79['offset']=qs[_0x7147('0x1c')](_0x33ff8b[_0x7147('0x31')][_0x7147('0x1c')]);}_0x535c79[_0x7147('0x39')]=qs[_0x7147('0x3a')](_0x33ff8b[_0x7147('0x31')][_0x7147('0x3a')]);_0x535c79[_0x7147('0x40')]=qs[_0x7147('0x3b')](_[_0x7147('0x3c')](_0x33ff8b['query'],_0x5249a6[_0x7147('0x3b')]));_0x535c79[_0x7147('0x40')]['CampaignId']=_0x4a6721['id'];if(_0x33ff8b[_0x7147('0x31')]['filter']){_0x535c79[_0x7147('0x40')]=_[_0x7147('0x3e')](_0x535c79[_0x7147('0x40')],{'$or':_[_0x7147('0x30')](_0x535c79['attributes'],function(_0x41c29b){var _0x148420={};_0x148420[_0x41c29b]={'$like':'%'+_0x33ff8b['query'][_0x7147('0x3d')]+'%'};return _0x148420;})});}_0x535c79=_[_0x7147('0x3e')]({},_0x535c79,_0x33ff8b[_0x7147('0x3f')]);return db['CmHopper'][_0x7147('0x1b')]({'where':_0x535c79[_0x7147('0x40')]})[_0x7147('0x21')](function(_0x4c1df0){_0x32df3f[_0x7147('0x1b')]=_0x4c1df0;if(_0x33ff8b[_0x7147('0x31')][_0x7147('0x42')]){_0x535c79['include']=[{'all':!![]}];}return db[_0x7147('0x55')][_0x7147('0x56')](_0x535c79);})[_0x7147('0x21')](function(_0x247d73){_0x32df3f[_0x7147('0x44')]=_0x247d73;return _0x32df3f;});}})[_0x7147('0x21')](respondWithFilteredResult(_0x539c19,_0x535c79))[_0x7147('0x45')](handleError(_0x539c19,null));};exports[_0x7147('0x57')]=function(_0xcd081a,_0x1dd167,_0x104ab1){var _0x52334e={'raw':!![],'where':{}};var _0x1bbd0c={};var _0x1fe851={'count':0x0,'rows':[]};return db[_0x7147('0x41')][_0x7147('0x58')]({'where':{'id':_0xcd081a[_0x7147('0x47')]['id']}})[_0x7147('0x21')](handleEntityNotFound(_0x1dd167,null))[_0x7147('0x21')](function(_0x263f6a){if(_0x263f6a){_0x1bbd0c['model']=_[_0x7147('0x32')](db['CmHopperHistory'][_0x7147('0x2b')]);_0x1bbd0c[_0x7147('0x31')]=_[_0x7147('0x32')](_0xcd081a[_0x7147('0x31')]);_0x1bbd0c[_0x7147('0x3b')]=_[_0x7147('0x33')](_0x1bbd0c[_0x7147('0x2f')],_0x1bbd0c[_0x7147('0x31')]);_0x52334e[_0x7147('0x34')]=_[_0x7147('0x33')](_0x1bbd0c[_0x7147('0x2f')],qs[_0x7147('0x35')](_0xcd081a[_0x7147('0x31')][_0x7147('0x35')]));_0x52334e[_0x7147('0x34')]=_0x52334e[_0x7147('0x34')][_0x7147('0x36')]?_0x52334e[_0x7147('0x34')]:_0x1bbd0c[_0x7147('0x2f')];if(!_0xcd081a[_0x7147('0x31')][_0x7147('0x37')](_0x7147('0x38'))){_0x52334e[_0x7147('0x1a')]=qs['limit'](_0xcd081a[_0x7147('0x31')][_0x7147('0x1a')]);_0x52334e['offset']=qs[_0x7147('0x1c')](_0xcd081a[_0x7147('0x31')][_0x7147('0x1c')]);}_0x52334e[_0x7147('0x39')]=qs[_0x7147('0x3a')](_0xcd081a[_0x7147('0x31')]['sort']);_0x52334e['where']=qs[_0x7147('0x3b')](_[_0x7147('0x3c')](_0xcd081a[_0x7147('0x31')],_0x1bbd0c[_0x7147('0x3b')]));_0x52334e[_0x7147('0x40')][_0x7147('0x59')]=_0x263f6a['id'];if(_0xcd081a['query'][_0x7147('0x3d')]){_0x52334e[_0x7147('0x40')]=_[_0x7147('0x3e')](_0x52334e[_0x7147('0x40')],{'$or':_[_0x7147('0x30')](_0x52334e[_0x7147('0x34')],function(_0x5b5658){var _0x20cb31={};_0x20cb31[_0x5b5658]={'$like':'%'+_0xcd081a[_0x7147('0x31')][_0x7147('0x3d')]+'%'};return _0x20cb31;})});}_0x52334e=_['merge']({},_0x52334e,_0xcd081a[_0x7147('0x3f')]);return db['CmHopperHistory'][_0x7147('0x1b')]({'where':_0x52334e[_0x7147('0x40')]})[_0x7147('0x21')](function(_0x55933d){_0x1fe851[_0x7147('0x1b')]=_0x55933d;if(_0xcd081a[_0x7147('0x31')][_0x7147('0x42')]){_0x52334e[_0x7147('0x43')]=[{'all':!![]}];}return db[_0x7147('0x5a')][_0x7147('0x56')](_0x52334e);})[_0x7147('0x21')](function(_0x2e952e){_0x1fe851[_0x7147('0x44')]=_0x2e952e;return _0x1fe851;});}})[_0x7147('0x21')](respondWithFilteredResult(_0x1dd167,_0x52334e))[_0x7147('0x45')](handleError(_0x1dd167,null));};exports[_0x7147('0x5b')]=function(_0x44af2c,_0x31e776,_0x4966c9){var _0x36cd3d={'raw':!![],'where':{}};var _0x454d1b={};var _0x5c83ce={'count':0x0,'rows':[]};return db['Campaign'][_0x7147('0x58')]({'where':{'id':_0x44af2c[_0x7147('0x47')]['id']}})[_0x7147('0x21')](handleEntityNotFound(_0x31e776,null))[_0x7147('0x21')](function(_0x590dd0){if(_0x590dd0){_0x454d1b[_0x7147('0x2f')]=_[_0x7147('0x32')](db[_0x7147('0x5c')]['rawAttributes']);_0x454d1b[_0x7147('0x31')]=_['keys'](_0x44af2c[_0x7147('0x31')]);_0x454d1b['filters']=_[_0x7147('0x33')](_0x454d1b[_0x7147('0x2f')],_0x454d1b['query']);_0x36cd3d[_0x7147('0x34')]=_[_0x7147('0x33')](_0x454d1b[_0x7147('0x2f')],qs[_0x7147('0x35')](_0x44af2c[_0x7147('0x31')][_0x7147('0x35')]));_0x36cd3d[_0x7147('0x34')]=_0x36cd3d[_0x7147('0x34')][_0x7147('0x36')]?_0x36cd3d[_0x7147('0x34')]:_0x454d1b['model'];if(!_0x44af2c[_0x7147('0x31')]['hasOwnProperty'](_0x7147('0x38'))){_0x36cd3d['limit']=qs[_0x7147('0x1a')](_0x44af2c[_0x7147('0x31')]['limit']);_0x36cd3d['offset']=qs[_0x7147('0x1c')](_0x44af2c['query'][_0x7147('0x1c')]);}_0x36cd3d[_0x7147('0x39')]=qs[_0x7147('0x3a')](_0x44af2c[_0x7147('0x31')]['sort']);_0x36cd3d['where']=qs[_0x7147('0x3b')](_[_0x7147('0x3c')](_0x44af2c[_0x7147('0x31')],_0x454d1b[_0x7147('0x3b')]));_0x36cd3d[_0x7147('0x40')][_0x7147('0x59')]=_0x590dd0['id'];if(_0x44af2c[_0x7147('0x31')][_0x7147('0x3d')]){_0x36cd3d[_0x7147('0x40')]=_['merge'](_0x36cd3d['where'],{'$or':_['map'](_0x36cd3d[_0x7147('0x34')],function(_0x4caa58){var _0x133cff={};_0x133cff[_0x4caa58]={'$like':'%'+_0x44af2c[_0x7147('0x31')]['filter']+'%'};return _0x133cff;})});}_0x36cd3d=_[_0x7147('0x3e')]({},_0x36cd3d,_0x44af2c[_0x7147('0x3f')]);return db[_0x7147('0x5c')][_0x7147('0x1b')]({'where':_0x36cd3d[_0x7147('0x40')]})[_0x7147('0x21')](function(_0x21beaa){_0x5c83ce[_0x7147('0x1b')]=_0x21beaa;if(_0x44af2c[_0x7147('0x31')][_0x7147('0x42')]){_0x36cd3d[_0x7147('0x43')]=[{'all':!![]}];}return db[_0x7147('0x5c')][_0x7147('0x56')](_0x36cd3d);})[_0x7147('0x21')](function(_0x56109d){_0x5c83ce[_0x7147('0x44')]=_0x56109d;return _0x5c83ce;});}})[_0x7147('0x21')](respondWithFilteredResult(_0x31e776,_0x36cd3d))[_0x7147('0x45')](handleError(_0x31e776,null));};exports[_0x7147('0x5d')]=function(_0x406111,_0x48d254,_0x28b50a){var _0x24ec6f={'raw':!![],'where':{}};var _0x47b2aa={};var _0x1a1949={'count':0x0,'rows':[]};return db[_0x7147('0x41')]['findOne']({'where':{'id':_0x406111[_0x7147('0x47')]['id']}})[_0x7147('0x21')](handleEntityNotFound(_0x48d254,null))[_0x7147('0x21')](function(_0x4383bd){if(_0x4383bd){_0x47b2aa[_0x7147('0x2f')]=_[_0x7147('0x32')](db['CmHopperBlack'][_0x7147('0x2b')]);_0x47b2aa[_0x7147('0x31')]=_['keys'](_0x406111[_0x7147('0x31')]);_0x47b2aa[_0x7147('0x3b')]=_[_0x7147('0x33')](_0x47b2aa[_0x7147('0x2f')],_0x47b2aa['query']);_0x24ec6f[_0x7147('0x34')]=_[_0x7147('0x33')](_0x47b2aa[_0x7147('0x2f')],qs[_0x7147('0x35')](_0x406111[_0x7147('0x31')][_0x7147('0x35')]));_0x24ec6f[_0x7147('0x34')]=_0x24ec6f[_0x7147('0x34')][_0x7147('0x36')]?_0x24ec6f[_0x7147('0x34')]:_0x47b2aa[_0x7147('0x2f')];if(!_0x406111[_0x7147('0x31')]['hasOwnProperty'](_0x7147('0x38'))){_0x24ec6f[_0x7147('0x1a')]=qs[_0x7147('0x1a')](_0x406111['query']['limit']);_0x24ec6f[_0x7147('0x1c')]=qs['offset'](_0x406111[_0x7147('0x31')]['offset']);}_0x24ec6f[_0x7147('0x39')]=qs['sort'](_0x406111[_0x7147('0x31')]['sort']);_0x24ec6f['where']=qs[_0x7147('0x3b')](_[_0x7147('0x3c')](_0x406111[_0x7147('0x31')],_0x47b2aa['filters']));_0x24ec6f[_0x7147('0x40')][_0x7147('0x59')]=_0x4383bd['id'];if(_0x406111[_0x7147('0x31')][_0x7147('0x3d')]){_0x24ec6f['where']=_['merge'](_0x24ec6f['where'],{'$or':_[_0x7147('0x30')](_0x24ec6f[_0x7147('0x34')],function(_0x1b4e46){var _0x2b32ba={};_0x2b32ba[_0x1b4e46]={'$like':'%'+_0x406111[_0x7147('0x31')][_0x7147('0x3d')]+'%'};return _0x2b32ba;})});}_0x24ec6f=_[_0x7147('0x3e')]({},_0x24ec6f,_0x406111[_0x7147('0x3f')]);return db[_0x7147('0x5e')][_0x7147('0x1b')]({'where':_0x24ec6f[_0x7147('0x40')]})[_0x7147('0x21')](function(_0x36dda){_0x1a1949[_0x7147('0x1b')]=_0x36dda;if(_0x406111[_0x7147('0x31')][_0x7147('0x42')]){_0x24ec6f[_0x7147('0x43')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7147('0x56')](_0x24ec6f);})[_0x7147('0x21')](function(_0x1152f1){_0x1a1949[_0x7147('0x44')]=_0x1152f1;return _0x1a1949;});}})[_0x7147('0x21')](respondWithFilteredResult(_0x48d254,_0x24ec6f))['catch'](handleError(_0x48d254,null));};exports[_0x7147('0x5f')]=function(_0x3bbe6b,_0xf9a6b3,_0x27ead3){var _0x48c03a={};var _0x55c8ff={};var _0x4a32f6;var _0xe374da;return db['Campaign'][_0x7147('0x58')]({'where':{'id':_0x3bbe6b[_0x7147('0x47')]['id']}})[_0x7147('0x21')](handleEntityNotFound(_0xf9a6b3,null))[_0x7147('0x21')](function(_0x247440){if(_0x247440){_0x4a32f6=_0x247440;_0x55c8ff[_0x7147('0x2f')]=_[_0x7147('0x32')](db[_0x7147('0x60')]['rawAttributes']);_0x55c8ff[_0x7147('0x31')]=_[_0x7147('0x32')](_0x3bbe6b[_0x7147('0x31')]);_0x55c8ff[_0x7147('0x3b')]=_[_0x7147('0x33')](_0x55c8ff['model'],_0x55c8ff['query']);_0x48c03a[_0x7147('0x34')]=_['intersection'](_0x55c8ff[_0x7147('0x2f')],qs[_0x7147('0x35')](_0x3bbe6b[_0x7147('0x31')][_0x7147('0x35')]));_0x48c03a[_0x7147('0x34')]=_0x48c03a['attributes']['length']?_0x48c03a['attributes']:_0x55c8ff['model'];_0x48c03a['order']=qs[_0x7147('0x3a')](_0x3bbe6b['query'][_0x7147('0x3a')]);_0x48c03a['where']=qs[_0x7147('0x3b')](_[_0x7147('0x3c')](_0x3bbe6b[_0x7147('0x31')],_0x55c8ff[_0x7147('0x3b')]));if(_0x3bbe6b['query'][_0x7147('0x3d')]){_0x48c03a[_0x7147('0x40')]=_[_0x7147('0x3e')](_0x48c03a['where'],{'$or':_[_0x7147('0x30')](_0x48c03a[_0x7147('0x34')],function(_0x20f344){var _0x4d5b51={};_0x4d5b51[_0x20f344]={'$like':'%'+_0x3bbe6b[_0x7147('0x31')][_0x7147('0x3d')]+'%'};return _0x4d5b51;})});}_0x48c03a=_[_0x7147('0x3e')]({},_0x48c03a,_0x3bbe6b['options']);return _0x4a32f6['getLists'](_0x48c03a);}})[_0x7147('0x21')](function(_0x381ef7){if(_0x381ef7){_0xe374da=_0x381ef7[_0x7147('0x36')];if(!_0x3bbe6b['query'][_0x7147('0x37')](_0x7147('0x38'))){_0x48c03a['limit']=qs[_0x7147('0x1a')](_0x3bbe6b['query']['limit']);_0x48c03a[_0x7147('0x1c')]=qs[_0x7147('0x1c')](_0x3bbe6b[_0x7147('0x31')][_0x7147('0x1c')]);}return _0x4a32f6[_0x7147('0x5f')](_0x48c03a);}})[_0x7147('0x21')](function(_0x57c24f){if(_0x57c24f){return _0x57c24f?{'count':_0xe374da,'rows':_0x57c24f}:null;}})[_0x7147('0x21')](respondWithResult(_0xf9a6b3,null))[_0x7147('0x45')](handleError(_0xf9a6b3,null));};exports[_0x7147('0x61')]=function(_0x236c71,_0x5707b1,_0x2c89c6){var _0x53b2e6,_0x5425de;var _0x5deffa=[];var _0x1feb73=moment()[_0x7147('0x62')](_0x7147('0x63'));return db['Campaign'][_0x7147('0x4f')]({'where':{'id':_0x236c71['params']['id']}})['then'](handleEntityNotFound(_0x5707b1,null))[_0x7147('0x21')](function(_0x1d7052){if(_0x1d7052){_0x5425de=_0x1d7052;return _0x1d7052[_0x7147('0x61')](_0x236c71[_0x7147('0x49')][_0x7147('0x64')],_['omit'](_0x236c71[_0x7147('0x49')],[_0x7147('0x64'),'id'])||{});}return null;})['spread'](function(_0x2cf7fb){var _0xd91b27;var _0xeb9c37;_0x53b2e6=_0x2cf7fb||[];var _0x32f861=[];if(_0x2cf7fb){for(var _0x2fd2ba=0x0;_0x2fd2ba<_0x2cf7fb['length'];_0x2fd2ba+=0x1){var _0x1f9b34=_0x2cf7fb[_0x2fd2ba][_0x7147('0x23')]({'plain':!![]});_0x5425de[_0x7147('0x65')]=_0x236c71['body'][_0x7147('0x65')]?_0x236c71['body']['dialCheckDuplicateType']:_0x5425de[_0x7147('0x65')];switch(_0x5425de['dialCheckDuplicateType']){case'always':_0xd91b27=squel[_0x7147('0x66')]()['into'](_0x7147('0x67'))[_0x7147('0x68')]([_0x7147('0x69'),'scheduledAt','ContactId',_0x7147('0x6a'),_0x7147('0x59'),_0x7147('0x51'),_0x7147('0x52')],squel[_0x7147('0x6b')]()[_0x7147('0x6c')](_0x7147('0x69'),'phone')[_0x7147('0x6c')](_0x7147('0x6d'),'scheduledAt')['field']('id','ContactId')[_0x7147('0x6c')](_0x1f9b34['CmListId'][_0x7147('0x6e')](),_0x7147('0x6a'))[_0x7147('0x6c')](_0x236c71[_0x7147('0x47')]['id'][_0x7147('0x6e')](),'CampaignId')[_0x7147('0x6c')]('\x27'+_0x1feb73+'\x27',_0x7147('0x51'))[_0x7147('0x6c')]('\x27'+_0x1feb73+'\x27',_0x7147('0x52'))[_0x7147('0x6f')](_0x7147('0x70'))[_0x7147('0x40')](_0x7147('0x71'))[_0x7147('0x40')](_0x7147('0x72'),_0x1f9b34[_0x7147('0x73')][_0x7147('0x6e')]())[_0x7147('0x40')](_0x7147('0x74'))[_0x7147('0x40')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7147('0x6c')]('COALESCE(calleridnum,\x27\x27)')[_0x7147('0x6f')](_0x7147('0x75'))['where'](_0x7147('0x76'),_0x236c71['params']['id']['toString']()))[_0x7147('0x40')](_0x7147('0x77'),squel[_0x7147('0x6b')]()[_0x7147('0x6c')](_0x7147('0x78'))[_0x7147('0x6f')](_0x7147('0x67'))[_0x7147('0x40')]('CampaignId\x20=\x20?',_0x236c71[_0x7147('0x47')]['id'][_0x7147('0x6e')]())))[_0x7147('0x6e')]();break;case _0x7147('0x79'):_0xd91b27=squel[_0x7147('0x66')]()['into'](_0x7147('0x67'))[_0x7147('0x68')]([_0x7147('0x69'),_0x7147('0x7a'),_0x7147('0x7b'),'ListId',_0x7147('0x59'),_0x7147('0x51'),_0x7147('0x52')],squel[_0x7147('0x6b')]()[_0x7147('0x6c')](_0x7147('0x69'),_0x7147('0x69'))[_0x7147('0x6c')]('NOW()',_0x7147('0x7a'))[_0x7147('0x6c')]('id',_0x7147('0x7b'))[_0x7147('0x6c')](_0x1f9b34['CmListId'][_0x7147('0x6e')](),_0x7147('0x6a'))[_0x7147('0x6c')](_0x236c71['params']['id']['toString'](),_0x7147('0x59'))[_0x7147('0x6c')]('\x27'+_0x1feb73+'\x27',_0x7147('0x51'))[_0x7147('0x6c')]('\x27'+_0x1feb73+'\x27',_0x7147('0x52'))[_0x7147('0x6f')](_0x7147('0x70'))[_0x7147('0x40')](_0x7147('0x71'))[_0x7147('0x40')]('ListId\x20=\x20?',_0x1f9b34[_0x7147('0x73')][_0x7147('0x6e')]())['where'](_0x7147('0x74'))[_0x7147('0x40')](_0x7147('0x77'),squel[_0x7147('0x6b')]()[_0x7147('0x6c')](_0x7147('0x78'))[_0x7147('0x6f')](_0x7147('0x67'))[_0x7147('0x40')](_0x7147('0x76'),_0x236c71[_0x7147('0x47')]['id'][_0x7147('0x6e')]())))[_0x7147('0x6e')]();break;default:_0xd91b27=squel['insert']()[_0x7147('0x7c')](_0x7147('0x67'))[_0x7147('0x68')]([_0x7147('0x69'),'scheduledAt',_0x7147('0x7b'),_0x7147('0x6a'),'CampaignId',_0x7147('0x51'),_0x7147('0x52')],squel[_0x7147('0x6b')]()[_0x7147('0x6c')](_0x7147('0x69'),_0x7147('0x69'))[_0x7147('0x6c')](_0x7147('0x6d'),_0x7147('0x7a'))['field']('id',_0x7147('0x7b'))[_0x7147('0x6c')](_0x1f9b34[_0x7147('0x73')][_0x7147('0x6e')](),'ListId')[_0x7147('0x6c')](_0x236c71[_0x7147('0x47')]['id']['toString'](),_0x7147('0x59'))['field']('\x27'+_0x1feb73+'\x27','createdAt')[_0x7147('0x6c')]('\x27'+_0x1feb73+'\x27','updatedAt')[_0x7147('0x6f')](_0x7147('0x70'))[_0x7147('0x40')](_0x7147('0x71'))[_0x7147('0x40')](_0x7147('0x72'),_0x1f9b34[_0x7147('0x73')]['toString']())[_0x7147('0x40')](_0x7147('0x74')))[_0x7147('0x6e')]();}_0xeb9c37=squel[_0x7147('0x66')]()[_0x7147('0x7c')](_0x7147('0x7d'))['fromQuery']([_0x7147('0x7e'),'scheduledAt','phone','OrderBy',_0x7147('0x51'),_0x7147('0x52')],squel[_0x7147('0x6b')]()[_0x7147('0x6c')](_0x7147('0x7f'),'id')[_0x7147('0x6c')](_0x7147('0x6d'),_0x7147('0x7a'))[_0x7147('0x6c')](_0x7147('0x80'),_0x7147('0x69'))['field']('ci.OrderBY','OrderBy')[_0x7147('0x6c')]('\x27'+_0x1feb73+'\x27',_0x7147('0x51'))['field']('\x27'+_0x1feb73+'\x27',_0x7147('0x52'))[_0x7147('0x6f')](_0x7147('0x81'),'ci')[_0x7147('0x82')](_0x7147('0x67'),'h',_0x7147('0x83'))[_0x7147('0x40')](_0x7147('0x84'),_0x1f9b34[_0x7147('0x73')]['toString']())[_0x7147('0x40')](_0x7147('0x85'),_0x236c71[_0x7147('0x47')]['id'][_0x7147('0x6e')]())['where']('h.createdAt\x20=\x20?',_0x1feb73))[_0x7147('0x6e')]();_0x32f861[_0x7147('0x86')](db[_0x7147('0x87')]['query'](_0xd91b27));_0x5deffa['push'](db[_0x7147('0x87')][_0x7147('0x31')](_0xeb9c37));}return BPromise[_0x7147('0x88')](_0x32f861);}})['then'](function(){return BPromise['all'](_0x5deffa);})['then'](function(){return _0x53b2e6;})['then'](respondWithResult(_0x5707b1,null))['catch'](handleError(_0x5707b1,null));};exports['removeLists']=function(_0x41111f,_0xfd3593,_0x2b2488){return db['Campaign'][_0x7147('0x4f')]({'where':{'id':_0x41111f['params']['id']}})[_0x7147('0x21')](handleEntityNotFound(_0xfd3593,null))[_0x7147('0x21')](function(_0x4d947a){if(_0x4d947a){return _0x4d947a[_0x7147('0x89')](_0x41111f[_0x7147('0x31')]['ids']);}})[_0x7147('0x21')](function(_0x1e6dd9){if(_0x1e6dd9){return db[_0x7147('0x55')][_0x7147('0x22')]({'where':{'ListId':_0x41111f[_0x7147('0x31')]['ids'],'CampaignId':_0x41111f['params']['id']}})[_0x7147('0x21')](function(){return _0x1e6dd9;});}})[_0x7147('0x21')](respondWithStatusCode(_0xfd3593,null))[_0x7147('0x45')](handleError(_0xfd3593,null));};exports['getBlackLists']=function(_0x5649e6,_0x5941a8,_0x4454ab){var _0x54309c={};var _0x51f28c={};var _0x5debdc;var _0x1fbff9;return db[_0x7147('0x41')][_0x7147('0x58')]({'where':{'id':_0x5649e6['params']['id']}})[_0x7147('0x21')](handleEntityNotFound(_0x5941a8,null))[_0x7147('0x21')](function(_0x4fb58f){if(_0x4fb58f){_0x5debdc=_0x4fb58f;_0x51f28c[_0x7147('0x2f')]=_['keys'](db[_0x7147('0x60')]['rawAttributes']);_0x51f28c[_0x7147('0x31')]=_[_0x7147('0x32')](_0x5649e6[_0x7147('0x31')]);_0x51f28c[_0x7147('0x3b')]=_[_0x7147('0x33')](_0x51f28c[_0x7147('0x2f')],_0x51f28c['query']);_0x54309c[_0x7147('0x34')]=_[_0x7147('0x33')](_0x51f28c[_0x7147('0x2f')],qs['fields'](_0x5649e6['query']['fields']));_0x54309c[_0x7147('0x34')]=_0x54309c[_0x7147('0x34')]['length']?_0x54309c[_0x7147('0x34')]:_0x51f28c[_0x7147('0x2f')];_0x54309c[_0x7147('0x39')]=qs['sort'](_0x5649e6[_0x7147('0x31')]['sort']);_0x54309c['where']=qs[_0x7147('0x3b')](_[_0x7147('0x3c')](_0x5649e6['query'],_0x51f28c[_0x7147('0x3b')]));if(_0x5649e6[_0x7147('0x31')][_0x7147('0x3d')]){_0x54309c[_0x7147('0x40')]=_['merge'](_0x54309c[_0x7147('0x40')],{'$or':_[_0x7147('0x30')](_0x54309c[_0x7147('0x34')],function(_0xb3496d){var _0x3def56={};_0x3def56[_0xb3496d]={'$like':'%'+_0x5649e6[_0x7147('0x31')][_0x7147('0x3d')]+'%'};return _0x3def56;})});}_0x54309c=_['merge']({},_0x54309c,_0x5649e6[_0x7147('0x3f')]);return _0x5debdc[_0x7147('0x8a')](_0x54309c);}})['then'](function(_0x28fb05){if(_0x28fb05){_0x1fbff9=_0x28fb05[_0x7147('0x36')];if(!_0x5649e6[_0x7147('0x31')]['hasOwnProperty'](_0x7147('0x38'))){_0x54309c[_0x7147('0x1a')]=qs['limit'](_0x5649e6[_0x7147('0x31')][_0x7147('0x1a')]);_0x54309c[_0x7147('0x1c')]=qs[_0x7147('0x1c')](_0x5649e6['query'][_0x7147('0x1c')]);}return _0x5debdc[_0x7147('0x8a')](_0x54309c);}})[_0x7147('0x21')](function(_0x3922f4){if(_0x3922f4){return _0x3922f4?{'count':_0x1fbff9,'rows':_0x3922f4}:null;}})[_0x7147('0x21')](respondWithResult(_0x5941a8,null))['catch'](handleError(_0x5941a8,null));};exports[_0x7147('0x8b')]=function(_0x2eb2db,_0x3ba24f,_0x44dd79){var _0x4684c2,_0x349031;var _0x3f3f7d=[];var _0x370da0=moment()[_0x7147('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x7147('0x41')]['find']({'where':{'id':_0x2eb2db[_0x7147('0x47')]['id']}})[_0x7147('0x21')](handleEntityNotFound(_0x3ba24f,null))[_0x7147('0x21')](function(_0x60ed4d){if(_0x60ed4d){_0x349031=_0x60ed4d;return _0x60ed4d[_0x7147('0x8b')](_0x2eb2db[_0x7147('0x49')][_0x7147('0x64')],_['omit'](_0x2eb2db[_0x7147('0x49')],['ids','id'])||{});}return null;})[_0x7147('0x8c')](function(_0x43063c){var _0x452e8f;var _0x3e6f89;_0x4684c2=_0x43063c||[];var _0x441242=[];if(_0x43063c){for(var _0x478b55=0x0;_0x478b55<_0x43063c[_0x7147('0x36')];_0x478b55+=0x1){var _0x1855ad=_0x43063c[_0x478b55]['get']({'plain':!![]});_0x452e8f=squel['insert']()[_0x7147('0x7c')]('cm_hopper_black')[_0x7147('0x68')](['phone',_0x7147('0x7b'),_0x7147('0x6a'),_0x7147('0x59'),'createdAt','updatedAt'],squel['select']()[_0x7147('0x6c')]('phone',_0x7147('0x69'))[_0x7147('0x6c')]('id',_0x7147('0x7b'))[_0x7147('0x6c')](_0x1855ad[_0x7147('0x73')][_0x7147('0x6e')](),_0x7147('0x6a'))[_0x7147('0x6c')](_0x2eb2db[_0x7147('0x47')]['id'][_0x7147('0x6e')](),_0x7147('0x59'))[_0x7147('0x6c')](_0x7147('0x6d'),_0x7147('0x51'))[_0x7147('0x6c')](_0x7147('0x6d'),_0x7147('0x52'))[_0x7147('0x6f')](_0x7147('0x70'))['where']('deletedAt\x20IS\x20NULL')[_0x7147('0x40')]('ListId\x20=\x20?',_0x1855ad[_0x7147('0x73')][_0x7147('0x6e')]())[_0x7147('0x40')](_0x7147('0x74')))['toString']();_0x441242['push'](db[_0x7147('0x87')][_0x7147('0x31')](_0x452e8f));}return BPromise[_0x7147('0x88')](_0x441242);}})['then'](function(){return _0x4684c2;})[_0x7147('0x21')](respondWithResult(_0x3ba24f,null))[_0x7147('0x45')](handleError(_0x3ba24f,null));};exports['removeBlackLists']=function(_0x41814c,_0x5e5738,_0x259cb0){return db[_0x7147('0x41')][_0x7147('0x4f')]({'where':{'id':_0x41814c['params']['id']}})['then'](handleEntityNotFound(_0x5e5738,null))[_0x7147('0x21')](function(_0x18ad42){if(_0x18ad42){return _0x18ad42['removeBlackLists'](_0x41814c[_0x7147('0x31')]['ids']);}})[_0x7147('0x21')](function(_0x375f1d){if(_0x375f1d){return db[_0x7147('0x5e')][_0x7147('0x22')]({'where':{'ListId':_0x41814c[_0x7147('0x31')][_0x7147('0x64')],'CampaignId':_0x41814c['params']['id']}})['then'](function(){return _0x375f1d;});}})['then'](respondWithStatusCode(_0x5e5738,null))['catch'](handleError(_0x5e5738,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 378243e..19d90fe 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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4b727f,_0x47e390){var _0xe51025=function(_0x36cb55){while(--_0x36cb55){_0x4b727f['push'](_0x4b727f['shift']());}};_0xe51025(++_0x47e390);}(_0x7a54,0x106));var _0x47a5=function(_0x86a861,_0x131f18){_0x86a861=_0x86a861-0x0;var _0x3e4199=_0x7a54[_0x86a861];return _0x3e4199;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index dfb82ab..944fcd0 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 _0xf6fb=['map','model','debug','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','attributes','limit','include'];(function(_0x271b53,_0x48386e){var _0x8660ef=function(_0x3f8886){while(--_0x3f8886){_0x271b53['push'](_0x271b53['shift']());}};_0x8660ef(++_0x48386e);}(_0xf6fb,0x111));var _0xbf6f=function(_0x3d62c4,_0x134b8c){_0x3d62c4=_0x3d62c4-0x0;var _0x114fef=_0xf6fb[_0x3d62c4];return _0x114fef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf6f('0x0'));var BPromise=require(_0xbf6f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf6f('0x2'));var db=require(_0xbf6f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf6f('0x4'))('rpc');var config=require(_0xbf6f('0x5'));var jayson=require(_0xbf6f('0x6'));var client=jayson[_0xbf6f('0x7')][_0xbf6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d8ecf,_0x26bc7b,_0x9d0c63){return new BPromise(function(_0x43d56b,_0x5948cf){return client[_0xbf6f('0x9')](_0x3d8ecf,_0x9d0c63)[_0xbf6f('0xa')](function(_0x2ac2f8){logger[_0xbf6f('0xb')](_0xbf6f('0xc'),_0x26bc7b,'request\x20sent');logger['debug'](_0xbf6f('0xd'),_0x26bc7b,_0xbf6f('0xe'),JSON[_0xbf6f('0xf')](_0x2ac2f8));if(_0x2ac2f8['error']){if(_0x2ac2f8[_0xbf6f('0x10')]['code']===0x1f4){logger[_0xbf6f('0x10')](_0xbf6f('0xc'),_0x26bc7b,_0x2ac2f8[_0xbf6f('0x10')]['message']);return _0x5948cf(_0x2ac2f8[_0xbf6f('0x10')][_0xbf6f('0x11')]);}logger[_0xbf6f('0x10')](_0xbf6f('0xc'),_0x26bc7b,_0x2ac2f8[_0xbf6f('0x10')][_0xbf6f('0x11')]);return _0x43d56b(_0x2ac2f8['error'][_0xbf6f('0x11')]);}else{logger[_0xbf6f('0xb')](_0xbf6f('0xc'),_0x26bc7b,_0xbf6f('0xe'));_0x43d56b(_0x2ac2f8[_0xbf6f('0x12')][_0xbf6f('0x11')]);}})[_0xbf6f('0x13')](function(_0x586f33){logger['error'](_0xbf6f('0xc'),_0x26bc7b,_0x586f33);_0x5948cf(_0x586f33);});});}exports[_0xbf6f('0x14')]=function(_0x21b485){var _0x4b3c33=this;return new Promise(function(_0x56b4da,_0x2a0537){return db[_0xbf6f('0x15')][_0xbf6f('0x16')]({'raw':_0x21b485[_0xbf6f('0x17')]?_0x21b485[_0xbf6f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x21b485['options']?_0x21b485[_0xbf6f('0x17')]['where']||null:null,'attributes':_0x21b485[_0xbf6f('0x17')]?_0x21b485[_0xbf6f('0x17')][_0xbf6f('0x18')]||null:null,'limit':_0x21b485['options']?_0x21b485[_0xbf6f('0x17')][_0xbf6f('0x19')]||null:null,'include':_0x21b485[_0xbf6f('0x17')]?_0x21b485['options'][_0xbf6f('0x1a')]?_['map'](_0x21b485[_0xbf6f('0x17')][_0xbf6f('0x1a')],function(_0xba4b6a){return{'model':db[_0xba4b6a['model']],'as':_0xba4b6a['as'],'attributes':_0xba4b6a[_0xbf6f('0x18')],'include':_0xba4b6a[_0xbf6f('0x1a')]?_[_0xbf6f('0x1b')](_0xba4b6a[_0xbf6f('0x1a')],function(_0x44d47f){return{'model':db[_0x44d47f[_0xbf6f('0x1c')]],'as':_0x44d47f['as'],'attributes':_0x44d47f['attributes'],'include':_0x44d47f[_0xbf6f('0x1a')]?_[_0xbf6f('0x1b')](_0x44d47f['include'],function(_0x506302){return{'model':db[_0x506302['model']],'as':_0x506302['as'],'attributes':_0x506302[_0xbf6f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3588c0){logger[_0xbf6f('0xb')](_0xbf6f('0x14'),_0x21b485);logger[_0xbf6f('0x1d')](_0xbf6f('0x14'),_0x21b485,JSON[_0xbf6f('0xf')](_0x3588c0));_0x56b4da(_0x3588c0);})[_0xbf6f('0x13')](function(_0x58c120){logger['error'](_0xbf6f('0x14'),_0x58c120[_0xbf6f('0x11')],_0x21b485);_0x2a0537(_0x4b3c33['error'](0x1f4,_0x58c120[_0xbf6f('0x11')]));});});}; \ No newline at end of file +var _0xad95=['Campaign','findAll','options','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','rpc','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetCampaign'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xad95,0x70));var _0x5ad9=function(_0x33c6ce,_0x1702ff){_0x33c6ce=_0x33c6ce-0x0;var _0x3420fd=_0xad95[_0x33c6ce];return _0x3420fd;};'use strict';var _=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var moment=require(_0x5ad9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ad9('0x3'));var db=require(_0x5ad9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ad9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bef4e,_0x117fde,_0x2a0915){return new BPromise(function(_0x3d937a,_0x404b33){return client['request'](_0x2bef4e,_0x2a0915)[_0x5ad9('0x6')](function(_0x4fdb7b){logger['info'](_0x5ad9('0x7'),_0x117fde,_0x5ad9('0x8'));logger[_0x5ad9('0x9')]('Campaign,\x20%s,\x20%s,\x20%s',_0x117fde,_0x5ad9('0x8'),JSON[_0x5ad9('0xa')](_0x4fdb7b));if(_0x4fdb7b['error']){if(_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xc')]===0x1f4){logger[_0x5ad9('0xb')](_0x5ad9('0x7'),_0x117fde,_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xd')]);return _0x404b33(_0x4fdb7b['error']['message']);}logger['error'](_0x5ad9('0x7'),_0x117fde,_0x4fdb7b[_0x5ad9('0xb')]['message']);return _0x3d937a(_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xd')]);}else{logger[_0x5ad9('0xe')](_0x5ad9('0x7'),_0x117fde,_0x5ad9('0x8'));_0x3d937a(_0x4fdb7b[_0x5ad9('0xf')][_0x5ad9('0xd')]);}})[_0x5ad9('0x10')](function(_0x36e61f){logger[_0x5ad9('0xb')]('Campaign,\x20%s,\x20%s',_0x117fde,_0x36e61f);_0x404b33(_0x36e61f);});});}exports[_0x5ad9('0x11')]=function(_0x54f392){var _0x3d1c8f=this;return new Promise(function(_0x28682f,_0xe4171b){return db[_0x5ad9('0x12')][_0x5ad9('0x13')]({'raw':_0x54f392[_0x5ad9('0x14')]?_0x54f392[_0x5ad9('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x54f392[_0x5ad9('0x14')]?_0x54f392['options']['where']||null:null,'attributes':_0x54f392[_0x5ad9('0x14')]?_0x54f392['options'][_0x5ad9('0x15')]||null:null,'limit':_0x54f392[_0x5ad9('0x14')]?_0x54f392[_0x5ad9('0x14')][_0x5ad9('0x16')]||null:null,'include':_0x54f392[_0x5ad9('0x14')]?_0x54f392['options'][_0x5ad9('0x17')]?_['map'](_0x54f392[_0x5ad9('0x14')]['include'],function(_0x570d3c){return{'model':db[_0x570d3c['model']],'as':_0x570d3c['as'],'attributes':_0x570d3c[_0x5ad9('0x15')],'include':_0x570d3c[_0x5ad9('0x17')]?_[_0x5ad9('0x18')](_0x570d3c[_0x5ad9('0x17')],function(_0x1252e6){return{'model':db[_0x1252e6[_0x5ad9('0x19')]],'as':_0x1252e6['as'],'attributes':_0x1252e6[_0x5ad9('0x15')],'include':_0x1252e6['include']?_['map'](_0x1252e6[_0x5ad9('0x17')],function(_0x4f3889){return{'model':db[_0x4f3889[_0x5ad9('0x19')]],'as':_0x4f3889['as'],'attributes':_0x4f3889['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ad9('0x6')](function(_0x55a0e4){logger['info'](_0x5ad9('0x11'),_0x54f392);logger[_0x5ad9('0x9')]('GetCampaign',_0x54f392,JSON['stringify'](_0x55a0e4));_0x28682f(_0x55a0e4);})[_0x5ad9('0x10')](function(_0x129804){logger[_0x5ad9('0xb')](_0x5ad9('0x11'),_0x129804[_0x5ad9('0xd')],_0x54f392);_0xe4171b(_0x3d1c8f[_0x5ad9('0xb')](0x1f4,_0x129804['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 43d9e87..ac5b56c 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 _0xf07a=['connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','create','clone','/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util'];(function(_0x2d2029,_0x30582b){var _0x575839=function(_0x5ed7de){while(--_0x5ed7de){_0x2d2029['push'](_0x2d2029['shift']());}};_0x575839(++_0x30582b);}(_0xf07a,0x86));var _0xaf07=function(_0x11fe8d,_0x19aba4){_0x11fe8d=_0x11fe8d-0x0;var _0x356099=_0xf07a[_0x11fe8d];return _0x356099;};'use strict';var multer=require(_0xaf07('0x0'));var util=require(_0xaf07('0x1'));var path=require('path');var timeout=require(_0xaf07('0x2'));var express=require(_0xaf07('0x3'));var router=express[_0xaf07('0x4')]();var fs_extra=require(_0xaf07('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf07('0x6'));var controller=require('./campaign.controller');router[_0xaf07('0x7')]('/',auth['isAuthenticated'](),controller[_0xaf07('0x8')]);router['get'](_0xaf07('0x9'),auth[_0xaf07('0xa')](),controller[_0xaf07('0xb')]);router[_0xaf07('0x7')](_0xaf07('0xc'),auth[_0xaf07('0xa')](),controller['getHoppers']);router[_0xaf07('0x7')](_0xaf07('0xd'),auth[_0xaf07('0xa')](),controller[_0xaf07('0xe')]);router[_0xaf07('0x7')]('/:id/hopper_finals',auth[_0xaf07('0xa')](),controller[_0xaf07('0xf')]);router[_0xaf07('0x7')](_0xaf07('0x10'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x11')]);router['get']('/:id/lists',auth[_0xaf07('0xa')](),controller[_0xaf07('0x12')]);router['get']('/:id/blacklists',auth[_0xaf07('0xa')](),controller[_0xaf07('0x13')]);router[_0xaf07('0x14')]('/',auth[_0xaf07('0xa')](),controller[_0xaf07('0x15')]);router[_0xaf07('0x14')]('/:id/clone',auth[_0xaf07('0xa')](),controller[_0xaf07('0x16')]);router[_0xaf07('0x14')](_0xaf07('0x17'),auth['isAuthenticated'](),controller[_0xaf07('0x18')]);router['post'](_0xaf07('0x19'),auth['isAuthenticated'](),controller[_0xaf07('0x1a')]);router[_0xaf07('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xaf07('0x1c')]);router[_0xaf07('0x1d')](_0xaf07('0x9'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x1e')]);router[_0xaf07('0x1d')](_0xaf07('0x17'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x1f')]);router[_0xaf07('0x1d')](_0xaf07('0x19'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x20')]);module[_0xaf07('0x21')]=router; \ No newline at end of file +var _0xc9df=['destroy','removeLists','removeBlackLists','util','path','connect-timeout','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','addBlackLists','put','delete'];(function(_0x5f5b5c,_0x529e05){var _0x5339c0=function(_0x4d9cb5){while(--_0x4d9cb5){_0x5f5b5c['push'](_0x5f5b5c['shift']());}};_0x5339c0(++_0x529e05);}(_0xc9df,0x121));var _0xfc9d=function(_0x447952,_0x575c24){_0x447952=_0x447952-0x0;var _0x42f54f=_0xc9df[_0x447952];return _0x42f54f;};'use strict';var multer=require('multer');var util=require(_0xfc9d('0x0'));var path=require(_0xfc9d('0x1'));var timeout=require(_0xfc9d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xfc9d('0x3')]('/',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x5')]);router[_0xfc9d('0x3')](_0xfc9d('0x6'),auth[_0xfc9d('0x4')](),controller['show']);router[_0xfc9d('0x3')](_0xfc9d('0x7'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x8')]);router[_0xfc9d('0x3')](_0xfc9d('0x9'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xa')]);router[_0xfc9d('0x3')](_0xfc9d('0xb'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xc')]);router[_0xfc9d('0x3')](_0xfc9d('0xd'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xe')]);router['get'](_0xfc9d('0xf'),auth['isAuthenticated'](),controller[_0xfc9d('0x10')]);router['get'](_0xfc9d('0x11'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x12')]);router[_0xfc9d('0x13')]('/',auth[_0xfc9d('0x4')](),controller['create']);router[_0xfc9d('0x13')]('/:id/clone',auth[_0xfc9d('0x4')](),controller['clone']);router[_0xfc9d('0x13')](_0xfc9d('0xf'),auth[_0xfc9d('0x4')](),controller['addLists']);router['post'](_0xfc9d('0x11'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x14')]);router[_0xfc9d('0x15')](_0xfc9d('0x6'),auth[_0xfc9d('0x4')](),controller['update']);router[_0xfc9d('0x16')]('/:id',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x17')]);router[_0xfc9d('0x16')]('/:id/lists',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x18')]);router[_0xfc9d('0x16')](_0xfc9d('0x11'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c9765fa..89f0c76 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 _0x1a31=['exports','STRING','TEXT','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x15fef7,_0xbc02c5){var _0x13bb57=function(_0x488ce0){while(--_0x488ce0){_0x15fef7['push'](_0x15fef7['shift']());}};_0x13bb57(++_0xbc02c5);}(_0x1a31,0x16f));var _0x11a3=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x1a31[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x11a3('0x0'));module[_0x11a3('0x1')]={'key':{'type':Sequelize[_0x11a3('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x11a3('0x3')],'length':_0x11a3('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x11a3('0x5')],'get':function(){return this[_0x11a3('0x6')](_0x11a3('0x7'));}}}; \ No newline at end of file +var _0xc6bf=['VIRTUAL','getDataValue','sequelize','STRING','TEXT','medium'];(function(_0x5b64e5,_0x54b8ec){var _0x2b3f81=function(_0x47aaae){while(--_0x47aaae){_0x5b64e5['push'](_0x5b64e5['shift']());}};_0x2b3f81(++_0x54b8ec);}(_0xc6bf,0x1be));var _0xfc6b=function(_0x18e875,_0x54fff7){_0x18e875=_0x18e875-0x0;var _0x1643c6=_0xc6bf[_0x18e875];return _0x1643c6;};'use strict';var Sequelize=require(_0xfc6b('0x0'));module['exports']={'key':{'type':Sequelize[_0xfc6b('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xfc6b('0x2')],'length':_0xfc6b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xfc6b('0x4')],'get':function(){return this[_0xfc6b('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 13869f1..ada9185 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 _0xb875=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x180b9b,_0x2121e2){var _0x1dae04=function(_0xbe5c27){while(--_0xbe5c27){_0x180b9b['push'](_0x180b9b['shift']());}};_0x1dae04(++_0x2121e2);}(_0xb875,0xf4));var _0x5b87=function(_0x4be53d,_0x1f1c6e){_0x4be53d=_0x4be53d-0x0;var _0x1ae3dd=_0xb875[_0x4be53d];return _0x1ae3dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5b87('0x0'));var jsonpatch=require(_0x5b87('0x1'));var rp=require('request-promise');var moment=require(_0x5b87('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5b87('0x3'));var util=require(_0x5b87('0x4'));var path=require('path');var sox=require(_0x5b87('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b87('0x6'));var _=require(_0x5b87('0x7'));var squel=require(_0x5b87('0x8'));var crypto=require('crypto');var jsforce=require(_0x5b87('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5b87('0xa'));var querystring=require(_0x5b87('0xb'));var Papa=require(_0x5b87('0xc'));var Redis=require(_0x5b87('0xd'));var authService=require(_0x5b87('0xe'));var qs=require(_0x5b87('0xf'));var as=require(_0x5b87('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b87('0x11'))(_0x5b87('0x12'));var utils=require('../../config/utils');var config=require(_0x5b87('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b87('0x14'))['db'];function respondWithStatusCode(_0x384d77,_0x203279){_0x203279=_0x203279||0xcc;return function(_0x58638f){if(_0x58638f){return _0x384d77[_0x5b87('0x15')](_0x203279);}return _0x384d77['status'](_0x203279)['end']();};}function respondWithResult(_0x38750a,_0xcd3bc0){_0xcd3bc0=_0xcd3bc0||0xc8;return function(_0xb6d39d){if(_0xb6d39d){return _0x38750a[_0x5b87('0x16')](_0xcd3bc0)[_0x5b87('0x17')](_0xb6d39d);}};}function respondWithFilteredResult(_0x10f9d4,_0x328fb1){return function(_0x2c6032){if(_0x2c6032){var _0x563b1c=typeof _0x328fb1[_0x5b87('0x18')]===_0x5b87('0x19')&&typeof _0x328fb1[_0x5b87('0x1a')]===_0x5b87('0x19');var _0x558d0a=_0x2c6032[_0x5b87('0x1b')];var _0x475804=_0x563b1c?0x0:_0x328fb1[_0x5b87('0x18')];var _0x2af69d=_0x563b1c?_0x2c6032['count']:_0x328fb1[_0x5b87('0x18')]+_0x328fb1[_0x5b87('0x1a')];var _0x42a8c6;if(_0x2af69d>=_0x558d0a){_0x2af69d=_0x558d0a;_0x42a8c6=0xc8;}else{_0x42a8c6=0xce;}_0x10f9d4[_0x5b87('0x16')](_0x42a8c6);return _0x10f9d4['set'](_0x5b87('0x1c'),_0x475804+'-'+_0x2af69d+'/'+_0x558d0a)['json'](_0x2c6032);}return null;};}function patchUpdates(_0x581a2f){return function(_0x4ae8d5){try{jsonpatch[_0x5b87('0x1d')](_0x4ae8d5,_0x581a2f,!![]);}catch(_0x417deb){return BPromise[_0x5b87('0x1e')](_0x417deb);}return _0x4ae8d5[_0x5b87('0x1f')]();};}function saveUpdates(_0x493814,_0x14dc58){return function(_0x10e4cc){if(_0x10e4cc){return _0x10e4cc['update'](_0x493814)[_0x5b87('0x20')](function(_0x5d6d72){return _0x5d6d72;});}return null;};}function removeEntity(_0xf3d360,_0x75fcb9){return function(_0x129b40){if(_0x129b40){return _0x129b40[_0x5b87('0x21')]()[_0x5b87('0x20')](function(){var _0x488986=_0x129b40[_0x5b87('0x22')]({'plain':!![]});var _0x1170b8=_0x5b87('0x23');return db[_0x5b87('0x24')][_0x5b87('0x21')]({'where':{'type':_0x1170b8,'resourceId':_0x488986['id']}})[_0x5b87('0x20')](function(){return _0x129b40;});})[_0x5b87('0x20')](function(){_0xf3d360[_0x5b87('0x16')](0xcc)[_0x5b87('0x25')]();});}};}function handleEntityNotFound(_0x524ad8,_0x3c3c65){return function(_0x3e3616){if(!_0x3e3616){_0x524ad8[_0x5b87('0x15')](0x194);}return _0x3e3616;};}function handleError(_0x3c1095,_0x181615){_0x181615=_0x181615||0x1f4;return function(_0x31b619){logger[_0x5b87('0x26')](_0x31b619['stack']);if(_0x31b619['name']){delete _0x31b619[_0x5b87('0x27')];}_0x3c1095[_0x5b87('0x16')](_0x181615)[_0x5b87('0x28')](_0x31b619);};}exports[_0x5b87('0x29')]=function(_0x5d46de,_0x474c91){var _0x39d825={},_0x17a1bb={},_0x4c519a={'count':0x0,'rows':[]};var _0x3a63df=_[_0x5b87('0x2a')](db[_0x5b87('0x2b')]['rawAttributes'],function(_0x375d37){return{'name':_0x375d37[_0x5b87('0x2c')],'type':_0x375d37[_0x5b87('0x2d')][_0x5b87('0x2e')]};});_0x17a1bb[_0x5b87('0x2f')]=_['map'](_0x3a63df,_0x5b87('0x27'));_0x17a1bb[_0x5b87('0x30')]=_['keys'](_0x5d46de[_0x5b87('0x30')]);_0x17a1bb[_0x5b87('0x31')]=_[_0x5b87('0x32')](_0x17a1bb[_0x5b87('0x2f')],_0x17a1bb[_0x5b87('0x30')]);_0x39d825['attributes']=_[_0x5b87('0x32')](_0x17a1bb[_0x5b87('0x2f')],qs[_0x5b87('0x33')](_0x5d46de[_0x5b87('0x30')][_0x5b87('0x33')]));_0x39d825[_0x5b87('0x34')]=_0x39d825[_0x5b87('0x34')]['length']?_0x39d825[_0x5b87('0x34')]:_0x17a1bb[_0x5b87('0x2f')];if(!_0x5d46de[_0x5b87('0x30')]['hasOwnProperty'](_0x5b87('0x35'))){_0x39d825[_0x5b87('0x1a')]=qs[_0x5b87('0x1a')](_0x5d46de[_0x5b87('0x30')][_0x5b87('0x1a')]);_0x39d825['offset']=qs[_0x5b87('0x18')](_0x5d46de[_0x5b87('0x30')][_0x5b87('0x18')]);}_0x39d825[_0x5b87('0x36')]=qs[_0x5b87('0x37')](_0x5d46de['query']['sort']);_0x39d825[_0x5b87('0x38')]=qs[_0x5b87('0x31')](_[_0x5b87('0x39')](_0x5d46de['query'],_0x17a1bb[_0x5b87('0x31')]),_0x3a63df);if(_0x5d46de[_0x5b87('0x30')][_0x5b87('0x3a')]){_0x39d825[_0x5b87('0x38')]=_[_0x5b87('0x3b')](_0x39d825[_0x5b87('0x38')],{'$or':[{'key':{'$like':'%'+_0x5d46de[_0x5b87('0x30')][_0x5b87('0x3a')]+'%'}},{'value':{'$like':'%'+_0x5d46de[_0x5b87('0x30')][_0x5b87('0x3a')]+'%'}}]});}_0x39d825=_['merge']({},_0x39d825,_0x5d46de['options']);var _0x405833={'where':_0x39d825[_0x5b87('0x38')]};return db[_0x5b87('0x2b')][_0x5b87('0x1b')](_0x405833)['then'](function(_0x420950){_0x4c519a['count']=_0x420950;if(_0x5d46de['query'][_0x5b87('0x3c')]){_0x39d825[_0x5b87('0x3d')]=[{'all':!![]}];}return db[_0x5b87('0x2b')][_0x5b87('0x3e')](_0x39d825);})[_0x5b87('0x20')](function(_0x152d5e){_0x4c519a[_0x5b87('0x3f')]=_0x152d5e;return _0x4c519a;})['then'](respondWithFilteredResult(_0x474c91,_0x39d825))[_0x5b87('0x40')](handleError(_0x474c91,null));};exports[_0x5b87('0x41')]=function(_0x5b0bc2,_0x1c8e57){var _0x361bcd={'raw':!![],'where':{'id':_0x5b0bc2[_0x5b87('0x42')]['id']}},_0x2f7c94={};_0x2f7c94[_0x5b87('0x2f')]=_['keys'](db[_0x5b87('0x2b')][_0x5b87('0x43')]);_0x2f7c94['query']=_['keys'](_0x5b0bc2['query']);_0x2f7c94[_0x5b87('0x31')]=_[_0x5b87('0x32')](_0x2f7c94['model'],_0x2f7c94[_0x5b87('0x30')]);_0x361bcd['attributes']=_[_0x5b87('0x32')](_0x2f7c94[_0x5b87('0x2f')],qs['fields'](_0x5b0bc2[_0x5b87('0x30')]['fields']));_0x361bcd['attributes']=_0x361bcd['attributes'][_0x5b87('0x44')]?_0x361bcd[_0x5b87('0x34')]:_0x2f7c94['model'];if(_0x5b0bc2['query'][_0x5b87('0x3c')]){_0x361bcd[_0x5b87('0x3d')]=[{'all':!![]}];}_0x361bcd=_['merge']({},_0x361bcd,_0x5b0bc2[_0x5b87('0x45')]);return db['CannedAnswer'][_0x5b87('0x46')](_0x361bcd)['then'](handleEntityNotFound(_0x1c8e57,null))[_0x5b87('0x20')](respondWithResult(_0x1c8e57,null))[_0x5b87('0x40')](handleError(_0x1c8e57,null));};exports[_0x5b87('0x47')]=function(_0x297371,_0x1bd417){if(_0x297371[_0x5b87('0x48')]['id']){delete _0x297371[_0x5b87('0x48')]['id'];}return db['CannedAnswer'][_0x5b87('0x46')]({'where':{'id':_0x297371['params']['id']}})[_0x5b87('0x20')](handleEntityNotFound(_0x1bd417,null))[_0x5b87('0x20')](saveUpdates(_0x297371[_0x5b87('0x48')],null))['then'](respondWithResult(_0x1bd417,null))[_0x5b87('0x40')](handleError(_0x1bd417,null));};exports['destroy']=function(_0x3a0791,_0x2f9197){return db[_0x5b87('0x2b')]['find']({'where':{'id':_0x3a0791[_0x5b87('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f9197,null))[_0x5b87('0x20')](removeEntity(_0x2f9197,null))['catch'](handleError(_0x2f9197,null));};exports[_0x5b87('0x49')]=function(_0x3da522,_0x2ffb55){var _0x3b6b6b={'key':_0x3da522[_0x5b87('0x48')][_0x5b87('0x2e')]};if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4a')]){_0x3b6b6b[_0x5b87('0x4a')]=_0x3da522[_0x5b87('0x48')][_0x5b87('0x4a')];}else if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4b')]){_0x3b6b6b[_0x5b87('0x4b')]=_0x3da522['body']['SmsAccountId'];}else if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4c')]){_0x3b6b6b[_0x5b87('0x4c')]=_0x3da522[_0x5b87('0x48')]['OpenchannelAccountId'];}else if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4d')]){_0x3b6b6b[_0x5b87('0x4d')]=_0x3da522['body'][_0x5b87('0x4d')];}return db[_0x5b87('0x2b')][_0x5b87('0x46')]({'where':_0x3b6b6b})[_0x5b87('0x20')](function(_0x23ae71){if(_0x23ae71){throw new db[(_0x5b87('0x4e'))][(_0x5b87('0x4f'))](_0x5b87('0x50'));}return db['CannedAnswer'][_0x5b87('0x49')](_0x3da522[_0x5b87('0x48')]);})['then'](function(_0x533d13){var _0xe45281=_0x3da522[_0x5b87('0x51')][_0x5b87('0x22')]({'plain':!![]});if(!_0xe45281)throw new Error(_0x5b87('0x52'));if(_0xe45281[_0x5b87('0x53')]===_0x5b87('0x51')){var _0x3d563b=_0x533d13[_0x5b87('0x22')]({'plain':!![]});return db[_0x5b87('0x54')][_0x5b87('0x46')]({'where':{'name':_0x5b87('0x23'),'userProfileId':_0xe45281[_0x5b87('0x55')]},'raw':!![]})['then'](function(_0x23fe18){if(_0x23fe18&&_0x23fe18[_0x5b87('0x56')]===0x0){return db[_0x5b87('0x24')][_0x5b87('0x49')]({'name':_0x3d563b['name'],'resourceId':_0x3d563b['id'],'type':_0x23fe18[_0x5b87('0x27')],'sectionId':_0x23fe18['id']},{})[_0x5b87('0x20')](function(){return _0x533d13;});}else{return _0x533d13;}})[_0x5b87('0x40')](function(_0x12e2d7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12e2d7);throw _0x12e2d7;});}return _0x533d13;})[_0x5b87('0x20')](respondWithResult(_0x2ffb55,0xc9))[_0x5b87('0x40')](handleError(_0x2ffb55,null));}; \ No newline at end of file +var _0x2699=['zip-dir','request-promise','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','get','CannedAnswers','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','CannedAnswer','findAll','rows','catch','show','includeAll','include','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf'];(function(_0x40b63e,_0x41fb03){var _0x594acd=function(_0x5f145e){while(--_0x5f145e){_0x40b63e['push'](_0x40b63e['shift']());}};_0x594acd(++_0x41fb03);}(_0x2699,0xaf));var _0x9269=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x2699[_0x47e549];return _0x251374;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9269('0x0'));var zipdir=require(_0x9269('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9269('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9269('0x3'));var util=require('util');var path=require(_0x9269('0x4'));var sox=require('sox');var csv=require(_0x9269('0x5'));var ejs=require(_0x9269('0x6'));var fs=require('fs');var fs_extra=require(_0x9269('0x7'));var _=require('lodash');var squel=require(_0x9269('0x8'));var crypto=require(_0x9269('0x9'));var jsforce=require(_0x9269('0xa'));var deskjs=require(_0x9269('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9269('0xc'));var Papa=require(_0x9269('0xd'));var Redis=require(_0x9269('0xe'));var authService=require(_0x9269('0xf'));var qs=require(_0x9269('0x10'));var as=require(_0x9269('0x11'));var hardwareService=require(_0x9269('0x12'));var logger=require(_0x9269('0x13'))(_0x9269('0x14'));var utils=require('../../config/utils');var config=require(_0x9269('0x15'));var licenseUtil=require(_0x9269('0x16'));var db=require(_0x9269('0x17'))['db'];function respondWithStatusCode(_0x320b2a,_0x1c5531){_0x1c5531=_0x1c5531||0xcc;return function(_0x24731c){if(_0x24731c){return _0x320b2a[_0x9269('0x18')](_0x1c5531);}return _0x320b2a[_0x9269('0x19')](_0x1c5531)['end']();};}function respondWithResult(_0x30817d,_0x1405b3){_0x1405b3=_0x1405b3||0xc8;return function(_0xa67c1d){if(_0xa67c1d){return _0x30817d[_0x9269('0x19')](_0x1405b3)[_0x9269('0x1a')](_0xa67c1d);}};}function respondWithFilteredResult(_0x35ce65,_0x38c417){return function(_0xafaa5a){if(_0xafaa5a){var _0x59d90e=typeof _0x38c417[_0x9269('0x1b')]==='undefined'&&typeof _0x38c417[_0x9269('0x1c')]===_0x9269('0x1d');var _0x4ec8ec=_0xafaa5a[_0x9269('0x1e')];var _0x124b52=_0x59d90e?0x0:_0x38c417['offset'];var _0x36a892=_0x59d90e?_0xafaa5a['count']:_0x38c417['offset']+_0x38c417[_0x9269('0x1c')];var _0x17a88a;if(_0x36a892>=_0x4ec8ec){_0x36a892=_0x4ec8ec;_0x17a88a=0xc8;}else{_0x17a88a=0xce;}_0x35ce65[_0x9269('0x19')](_0x17a88a);return _0x35ce65['set'](_0x9269('0x1f'),_0x124b52+'-'+_0x36a892+'/'+_0x4ec8ec)[_0x9269('0x1a')](_0xafaa5a);}return null;};}function patchUpdates(_0x181b0e){return function(_0x49d888){try{jsonpatch['apply'](_0x49d888,_0x181b0e,!![]);}catch(_0x1fb588){return BPromise['reject'](_0x1fb588);}return _0x49d888[_0x9269('0x20')]();};}function saveUpdates(_0x1be64c,_0x24bcc6){return function(_0x4c7d7b){if(_0x4c7d7b){return _0x4c7d7b[_0x9269('0x21')](_0x1be64c)[_0x9269('0x22')](function(_0x5e87f5){return _0x5e87f5;});}return null;};}function removeEntity(_0x32b3b9,_0x40ca87){return function(_0x447644){if(_0x447644){return _0x447644[_0x9269('0x23')]()[_0x9269('0x22')](function(){var _0x20f9e9=_0x447644[_0x9269('0x24')]({'plain':!![]});var _0x41d981=_0x9269('0x25');return db['UserProfileResource'][_0x9269('0x23')]({'where':{'type':_0x41d981,'resourceId':_0x20f9e9['id']}})[_0x9269('0x22')](function(){return _0x447644;});})['then'](function(){_0x32b3b9[_0x9269('0x19')](0xcc)[_0x9269('0x26')]();});}};}function handleEntityNotFound(_0x47a683,_0x2bb107){return function(_0x50b546){if(!_0x50b546){_0x47a683[_0x9269('0x18')](0x194);}return _0x50b546;};}function handleError(_0xb42618,_0x1580a6){_0x1580a6=_0x1580a6||0x1f4;return function(_0x4c6950){logger[_0x9269('0x27')](_0x4c6950[_0x9269('0x28')]);if(_0x4c6950[_0x9269('0x29')]){delete _0x4c6950[_0x9269('0x29')];}_0xb42618[_0x9269('0x19')](_0x1580a6)[_0x9269('0x2a')](_0x4c6950);};}exports[_0x9269('0x2b')]=function(_0x31fbfa,_0x291985){var _0x5ac6d5={},_0x263a34={},_0x137858={'count':0x0,'rows':[]};var _0x4f2ca1=_[_0x9269('0x2c')](db['CannedAnswer'][_0x9269('0x2d')],function(_0x1ae3c0){return{'name':_0x1ae3c0[_0x9269('0x2e')],'type':_0x1ae3c0['type'][_0x9269('0x2f')]};});_0x263a34[_0x9269('0x30')]=_['map'](_0x4f2ca1,_0x9269('0x29'));_0x263a34[_0x9269('0x31')]=_[_0x9269('0x32')](_0x31fbfa[_0x9269('0x31')]);_0x263a34[_0x9269('0x33')]=_[_0x9269('0x34')](_0x263a34['model'],_0x263a34['query']);_0x5ac6d5[_0x9269('0x35')]=_[_0x9269('0x34')](_0x263a34[_0x9269('0x30')],qs['fields'](_0x31fbfa[_0x9269('0x31')][_0x9269('0x36')]));_0x5ac6d5[_0x9269('0x35')]=_0x5ac6d5[_0x9269('0x35')][_0x9269('0x37')]?_0x5ac6d5[_0x9269('0x35')]:_0x263a34[_0x9269('0x30')];if(!_0x31fbfa[_0x9269('0x31')][_0x9269('0x38')](_0x9269('0x39'))){_0x5ac6d5[_0x9269('0x1c')]=qs[_0x9269('0x1c')](_0x31fbfa[_0x9269('0x31')][_0x9269('0x1c')]);_0x5ac6d5[_0x9269('0x1b')]=qs[_0x9269('0x1b')](_0x31fbfa[_0x9269('0x31')][_0x9269('0x1b')]);}_0x5ac6d5[_0x9269('0x3a')]=qs['sort'](_0x31fbfa[_0x9269('0x31')][_0x9269('0x3b')]);_0x5ac6d5[_0x9269('0x3c')]=qs[_0x9269('0x33')](_[_0x9269('0x3d')](_0x31fbfa[_0x9269('0x31')],_0x263a34[_0x9269('0x33')]),_0x4f2ca1);if(_0x31fbfa[_0x9269('0x31')]['filter']){_0x5ac6d5[_0x9269('0x3c')]=_[_0x9269('0x3e')](_0x5ac6d5[_0x9269('0x3c')],{'$or':[{'key':{'$like':'%'+_0x31fbfa[_0x9269('0x31')][_0x9269('0x3f')]+'%'}},{'value':{'$like':'%'+_0x31fbfa[_0x9269('0x31')][_0x9269('0x3f')]+'%'}}]});}_0x5ac6d5=_[_0x9269('0x3e')]({},_0x5ac6d5,_0x31fbfa[_0x9269('0x40')]);var _0x26661a={'where':_0x5ac6d5['where']};return db[_0x9269('0x41')][_0x9269('0x1e')](_0x26661a)[_0x9269('0x22')](function(_0x501b6a){_0x137858['count']=_0x501b6a;if(_0x31fbfa['query']['includeAll']){_0x5ac6d5['include']=[{'all':!![]}];}return db[_0x9269('0x41')][_0x9269('0x42')](_0x5ac6d5);})[_0x9269('0x22')](function(_0x499d48){_0x137858[_0x9269('0x43')]=_0x499d48;return _0x137858;})['then'](respondWithFilteredResult(_0x291985,_0x5ac6d5))[_0x9269('0x44')](handleError(_0x291985,null));};exports[_0x9269('0x45')]=function(_0x4e11f8,_0x146bfe){var _0xd5c11a={'raw':!![],'where':{'id':_0x4e11f8['params']['id']}},_0x59906c={};_0x59906c[_0x9269('0x30')]=_[_0x9269('0x32')](db['CannedAnswer'][_0x9269('0x2d')]);_0x59906c[_0x9269('0x31')]=_[_0x9269('0x32')](_0x4e11f8[_0x9269('0x31')]);_0x59906c['filters']=_[_0x9269('0x34')](_0x59906c[_0x9269('0x30')],_0x59906c[_0x9269('0x31')]);_0xd5c11a[_0x9269('0x35')]=_['intersection'](_0x59906c[_0x9269('0x30')],qs[_0x9269('0x36')](_0x4e11f8[_0x9269('0x31')][_0x9269('0x36')]));_0xd5c11a[_0x9269('0x35')]=_0xd5c11a[_0x9269('0x35')][_0x9269('0x37')]?_0xd5c11a['attributes']:_0x59906c[_0x9269('0x30')];if(_0x4e11f8[_0x9269('0x31')][_0x9269('0x46')]){_0xd5c11a[_0x9269('0x47')]=[{'all':!![]}];}_0xd5c11a=_[_0x9269('0x3e')]({},_0xd5c11a,_0x4e11f8['options']);return db[_0x9269('0x41')]['find'](_0xd5c11a)[_0x9269('0x22')](handleEntityNotFound(_0x146bfe,null))[_0x9269('0x22')](respondWithResult(_0x146bfe,null))[_0x9269('0x44')](handleError(_0x146bfe,null));};exports[_0x9269('0x21')]=function(_0xa2df60,_0x218584){if(_0xa2df60['body']['id']){delete _0xa2df60[_0x9269('0x48')]['id'];}return db['CannedAnswer'][_0x9269('0x49')]({'where':{'id':_0xa2df60[_0x9269('0x4a')]['id']}})[_0x9269('0x22')](handleEntityNotFound(_0x218584,null))[_0x9269('0x22')](saveUpdates(_0xa2df60[_0x9269('0x48')],null))[_0x9269('0x22')](respondWithResult(_0x218584,null))['catch'](handleError(_0x218584,null));};exports['destroy']=function(_0xd3341f,_0x35caa9){return db[_0x9269('0x41')]['find']({'where':{'id':_0xd3341f['params']['id']}})[_0x9269('0x22')](handleEntityNotFound(_0x35caa9,null))[_0x9269('0x22')](removeEntity(_0x35caa9,null))[_0x9269('0x44')](handleError(_0x35caa9,null));};exports[_0x9269('0x4b')]=function(_0x328dd4,_0x304a83){var _0xe48fae={'key':_0x328dd4[_0x9269('0x48')][_0x9269('0x2f')]};if(_0x328dd4[_0x9269('0x48')][_0x9269('0x4c')]){_0xe48fae[_0x9269('0x4c')]=_0x328dd4[_0x9269('0x48')][_0x9269('0x4c')];}else if(_0x328dd4[_0x9269('0x48')][_0x9269('0x4d')]){_0xe48fae[_0x9269('0x4d')]=_0x328dd4['body'][_0x9269('0x4d')];}else if(_0x328dd4['body'][_0x9269('0x4e')]){_0xe48fae[_0x9269('0x4e')]=_0x328dd4[_0x9269('0x48')][_0x9269('0x4e')];}else if(_0x328dd4['body']['ChatWebsiteId']){_0xe48fae[_0x9269('0x4f')]=_0x328dd4[_0x9269('0x48')]['ChatWebsiteId'];}return db[_0x9269('0x41')]['find']({'where':_0xe48fae})['then'](function(_0x3f048d){if(_0x3f048d){throw new db[(_0x9269('0x50'))]['ValidationError'](_0x9269('0x51'));}return db[_0x9269('0x41')][_0x9269('0x4b')](_0x328dd4[_0x9269('0x48')]);})['then'](function(_0x1ab02b){var _0x5062e9=_0x328dd4[_0x9269('0x52')]['get']({'plain':!![]});if(!_0x5062e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5062e9[_0x9269('0x53')]===_0x9269('0x52')){var _0x2303c1=_0x1ab02b[_0x9269('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x9269('0x49')]({'where':{'name':_0x9269('0x25'),'userProfileId':_0x5062e9[_0x9269('0x54')]},'raw':!![]})['then'](function(_0x5015c9){if(_0x5015c9&&_0x5015c9[_0x9269('0x55')]===0x0){return db[_0x9269('0x56')][_0x9269('0x4b')]({'name':_0x2303c1[_0x9269('0x29')],'resourceId':_0x2303c1['id'],'type':_0x5015c9[_0x9269('0x29')],'sectionId':_0x5015c9['id']},{})['then'](function(){return _0x1ab02b;});}else{return _0x1ab02b;}})[_0x9269('0x44')](function(_0x21291b){logger[_0x9269('0x27')](_0x9269('0x57'),_0x21291b);throw _0x21291b;});}return _0x1ab02b;})[_0x9269('0x22')](respondWithResult(_0x304a83,0xc9))[_0x9269('0x44')](handleError(_0x304a83,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b17230f..a89cc9f 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 _0x7728=['define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x17953f,_0x115870){var _0x4e3a07=function(_0x482004){while(--_0x482004){_0x17953f['push'](_0x17953f['shift']());}};_0x4e3a07(++_0x115870);}(_0x7728,0xd5));var _0x8772=function(_0x2f8000,_0x37c02b){_0x2f8000=_0x2f8000-0x0;var _0x25cfee=_0x7728[_0x2f8000];return _0x25cfee;};'use strict';var _=require('lodash');var util=require(_0x8772('0x0'));var logger=require(_0x8772('0x1'))(_0x8772('0x2'));var moment=require(_0x8772('0x3'));var BPromise=require(_0x8772('0x4'));var rp=require(_0x8772('0x5'));var fs=require('fs');var path=require(_0x8772('0x6'));var rimraf=require(_0x8772('0x7'));var config=require(_0x8772('0x8'));var attributes=require(_0x8772('0x9'));module[_0x8772('0xa')]=function(_0x1897a2,_0x1b10e8){return _0x1897a2[_0x8772('0xb')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8772('0xc'),'collate':_0x8772('0xd')});}; \ No newline at end of file +var _0x685f=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x32e520,_0x1c109c){var _0x536dab=function(_0x1e253f){while(--_0x1e253f){_0x32e520['push'](_0x32e520['shift']());}};_0x536dab(++_0x1c109c);}(_0x685f,0xc7));var _0xf685=function(_0x4fcf41,_0x979bd7){_0x4fcf41=_0x4fcf41-0x0;var _0x5ebe15=_0x685f[_0x4fcf41];return _0x5ebe15;};'use strict';var _=require(_0xf685('0x0'));var util=require('util');var logger=require(_0xf685('0x1'))(_0xf685('0x2'));var moment=require(_0xf685('0x3'));var BPromise=require(_0xf685('0x4'));var rp=require(_0xf685('0x5'));var fs=require('fs');var path=require(_0xf685('0x6'));var rimraf=require(_0xf685('0x7'));var config=require(_0xf685('0x8'));var attributes=require(_0xf685('0x9'));module[_0xf685('0xa')]=function(_0x3594aa,_0x2ca7d8){return _0x3594aa[_0xf685('0xb')](_0xf685('0xc'),attributes,{'tableName':_0xf685('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf685('0xe'),'collate':_0xf685('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 8fc2cf7..ed876d2 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(_0x26a6c7,_0x3a9b26){var _0xbbb3c2=function(_0x3eaf2d){while(--_0x3eaf2d){_0x26a6c7['push'](_0x26a6c7['shift']());}};_0xbbb3c2(++_0x3a9b26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x17e71a,_0x363028){var _0x33d55d=function(_0x3a3c9d){while(--_0x3a3c9d){_0x17e71a['push'](_0x17e71a['shift']());}};_0x33d55d(++_0x363028);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 f1060f1..18f83ea 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 _0x8cf0=['isAuthenticated','index','show','post','create','put','/:id','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x205abb,_0x130e47){var _0x390baa=function(_0x309536){while(--_0x309536){_0x205abb['push'](_0x205abb['shift']());}};_0x390baa(++_0x130e47);}(_0x8cf0,0x1a7));var _0x08cf=function(_0x4f6e90,_0x1f15e0){_0x4f6e90=_0x4f6e90-0x0;var _0x11cc0c=_0x8cf0[_0x4f6e90];return _0x11cc0c;};'use strict';var multer=require(_0x08cf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x08cf('0x1'));var router=express[_0x08cf('0x2')]();var fs_extra=require(_0x08cf('0x3'));var auth=require(_0x08cf('0x4'));var interaction=require(_0x08cf('0x5'));var config=require(_0x08cf('0x6'));var controller=require(_0x08cf('0x7'));router[_0x08cf('0x8')]('/',auth[_0x08cf('0x9')](),controller[_0x08cf('0xa')]);router['get']('/:id',auth[_0x08cf('0x9')](),controller[_0x08cf('0xb')]);router[_0x08cf('0xc')]('/',auth[_0x08cf('0x9')](),controller[_0x08cf('0xd')]);router[_0x08cf('0xe')](_0x08cf('0xf'),auth[_0x08cf('0x9')](),controller['update']);router[_0x08cf('0x10')](_0x08cf('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x08cf('0x11')]=router; \ No newline at end of file +var _0x3c70=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','post','put','update','destroy','exports','util'];(function(_0x217f77,_0x2b17ed){var _0x43d08d=function(_0x2d6ada){while(--_0x2d6ada){_0x217f77['push'](_0x217f77['shift']());}};_0x43d08d(++_0x2b17ed);}(_0x3c70,0x1df));var _0x03c7=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x3c70[_0x38a7ac];return _0x53061a;};'use strict';var multer=require('multer');var util=require(_0x03c7('0x0'));var path=require(_0x03c7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x03c7('0x2')]();var fs_extra=require(_0x03c7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x03c7('0x4'));var config=require(_0x03c7('0x5'));var controller=require(_0x03c7('0x6'));router[_0x03c7('0x7')]('/',auth[_0x03c7('0x8')](),controller['index']);router[_0x03c7('0x7')](_0x03c7('0x9'),auth[_0x03c7('0x8')](),controller['show']);router[_0x03c7('0xa')]('/',auth[_0x03c7('0x8')](),controller['create']);router[_0x03c7('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x03c7('0xc')]);router['delete'](_0x03c7('0x9'),auth['isAuthenticated'](),controller[_0x03c7('0xd')]);module[_0x03c7('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e191e2a..5dd6847 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 _0x3cb3=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2273ad,_0x4effd6){var _0x3f6622=function(_0x5d8df9){while(--_0x5d8df9){_0x2273ad['push'](_0x2273ad['shift']());}};_0x3f6622(++_0x4effd6);}(_0x3cb3,0x156));var _0x33cb=function(_0x872e48,_0x21c55f){_0x872e48=_0x872e48-0x0;var _0x4cb0ff=_0x3cb3[_0x872e48];return _0x4cb0ff;};'use strict';var Sequelize=require(_0x33cb('0x0'));module[_0x33cb('0x1')]={'calldate':{'type':Sequelize[_0x33cb('0x2')],'allowNull':![],'defaultValue':_0x33cb('0x3')},'clid':{'type':Sequelize[_0x33cb('0x4')]},'src':{'type':Sequelize[_0x33cb('0x4')]},'dst':{'type':Sequelize[_0x33cb('0x4')]},'dcontext':{'type':Sequelize[_0x33cb('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x33cb('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x33cb('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x33cb('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x33cb('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x33cb('0x4')]},'linkedid':{'type':Sequelize[_0x33cb('0x4')]},'sequence':{'type':Sequelize[_0x33cb('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x33cb('0x4')]},'tag':{'type':Sequelize[_0x33cb('0x4')]}}; \ No newline at end of file +var _0xae75=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0xae75,0x1a8));var _0x5ae7=function(_0xd8c413,_0x5249d1){_0xd8c413=_0xd8c413-0x0;var _0x1e08ab=_0xae75[_0xd8c413];return _0x1e08ab;};'use strict';var Sequelize=require(_0x5ae7('0x0'));module[_0x5ae7('0x1')]={'calldate':{'type':Sequelize[_0x5ae7('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x5ae7('0x3')]},'src':{'type':Sequelize[_0x5ae7('0x3')]},'dst':{'type':Sequelize[_0x5ae7('0x3')]},'dcontext':{'type':Sequelize[_0x5ae7('0x3')]},'channel':{'type':Sequelize[_0x5ae7('0x3')]},'dstchannel':{'type':Sequelize[_0x5ae7('0x3')]},'lastapp':{'type':Sequelize[_0x5ae7('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x5ae7('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5ae7('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x5ae7('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5ae7('0x3')]},'userfield':{'type':Sequelize[_0x5ae7('0x3')]},'uniqueid':{'type':Sequelize[_0x5ae7('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x5ae7('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 63a1b5c..6d8e14c 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 _0xca9e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','Cdr','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','fields','find','create','body','describe','eml-format','rimraf'];(function(_0x3db102,_0x281787){var _0x3be7da=function(_0x3ca143){while(--_0x3ca143){_0x3db102['push'](_0x3db102['shift']());}};_0x3be7da(++_0x281787);}(_0xca9e,0x136));var _0xeca9=function(_0x3d99d8,_0x32e0c5){_0x3d99d8=_0x3d99d8-0x0;var _0x46f0b1=_0xca9e[_0x3d99d8];return _0x46f0b1;};'use strict';var emlformat=require(_0xeca9('0x0'));var rimraf=require(_0xeca9('0x1'));var zipdir=require(_0xeca9('0x2'));var jsonpatch=require(_0xeca9('0x3'));var rp=require(_0xeca9('0x4'));var moment=require(_0xeca9('0x5'));var BPromise=require(_0xeca9('0x6'));var Mustache=require(_0xeca9('0x7'));var util=require(_0xeca9('0x8'));var path=require(_0xeca9('0x9'));var sox=require(_0xeca9('0xa'));var csv=require(_0xeca9('0xb'));var ejs=require(_0xeca9('0xc'));var fs=require('fs');var fs_extra=require(_0xeca9('0xd'));var _=require('lodash');var squel=require(_0xeca9('0xe'));var crypto=require(_0xeca9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeca9('0xb'));var querystring=require(_0xeca9('0x10'));var Papa=require(_0xeca9('0x11'));var Redis=require('ioredis');var authService=require(_0xeca9('0x12'));var qs=require(_0xeca9('0x13'));var as=require(_0xeca9('0x14'));var hardwareService=require(_0xeca9('0x15'));var logger=require(_0xeca9('0x16'))(_0xeca9('0x17'));var utils=require('../../config/utils');var config=require(_0xeca9('0x18'));var licenseUtil=require(_0xeca9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27ca6f,_0x4b2ae1){_0x4b2ae1=_0x4b2ae1||0xcc;return function(_0x3c6cc7){if(_0x3c6cc7){return _0x27ca6f[_0xeca9('0x1a')](_0x4b2ae1);}return _0x27ca6f['status'](_0x4b2ae1)[_0xeca9('0x1b')]();};}function respondWithResult(_0x384ae2,_0x1ba9e9){_0x1ba9e9=_0x1ba9e9||0xc8;return function(_0x4d65ee){if(_0x4d65ee){return _0x384ae2[_0xeca9('0x1c')](_0x1ba9e9)[_0xeca9('0x1d')](_0x4d65ee);}};}function respondWithFilteredResult(_0x910814,_0x6e9fd4){return function(_0x551393){if(_0x551393){var _0x520411=typeof _0x6e9fd4[_0xeca9('0x1e')]===_0xeca9('0x1f')&&typeof _0x6e9fd4['limit']===_0xeca9('0x1f');var _0x11bf78=_0x551393['count'];var _0x517060=_0x520411?0x0:_0x6e9fd4['offset'];var _0x132008=_0x520411?_0x551393[_0xeca9('0x20')]:_0x6e9fd4[_0xeca9('0x1e')]+_0x6e9fd4['limit'];var _0xf1ef9f;if(_0x132008>=_0x11bf78){_0x132008=_0x11bf78;_0xf1ef9f=0xc8;}else{_0xf1ef9f=0xce;}_0x910814['status'](_0xf1ef9f);return _0x910814['set'](_0xeca9('0x21'),_0x517060+'-'+_0x132008+'/'+_0x11bf78)['json'](_0x551393);}return null;};}function patchUpdates(_0x31720b){return function(_0x1c4dd6){try{jsonpatch['apply'](_0x1c4dd6,_0x31720b,!![]);}catch(_0x5a2cca){return BPromise[_0xeca9('0x22')](_0x5a2cca);}return _0x1c4dd6['save']();};}function saveUpdates(_0x3647ed,_0x5279d0){return function(_0x3a3608){if(_0x3a3608){return _0x3a3608[_0xeca9('0x23')](_0x3647ed)[_0xeca9('0x24')](function(_0x5c3495){return _0x5c3495;});}return null;};}function removeEntity(_0x3fcfb8,_0x466883){return function(_0x515e63){if(_0x515e63){return _0x515e63[_0xeca9('0x25')]()[_0xeca9('0x24')](function(){_0x3fcfb8[_0xeca9('0x1c')](0xcc)[_0xeca9('0x1b')]();});}};}function handleEntityNotFound(_0x498f4a,_0x32699b){return function(_0x57e190){if(!_0x57e190){_0x498f4a[_0xeca9('0x1a')](0x194);}return _0x57e190;};}function handleError(_0x251ce4,_0x1702fb){_0x1702fb=_0x1702fb||0x1f4;return function(_0x3e41df){logger[_0xeca9('0x26')](_0x3e41df[_0xeca9('0x27')]);if(_0x3e41df[_0xeca9('0x28')]){delete _0x3e41df[_0xeca9('0x28')];}_0x251ce4[_0xeca9('0x1c')](_0x1702fb)[_0xeca9('0x29')](_0x3e41df);};}exports[_0xeca9('0x2a')]=function(_0x3b0aab,_0x424f7b){var _0x1436d0={},_0x8d9a8d={},_0x4910a3={'count':0x0,'rows':[]};var _0x4db3e2=_['map'](db[_0xeca9('0x2b')]['rawAttributes'],function(_0x2ca943){return{'name':_0x2ca943[_0xeca9('0x2c')],'type':_0x2ca943[_0xeca9('0x2d')][_0xeca9('0x2e')]};});_0x8d9a8d[_0xeca9('0x2f')]=_[_0xeca9('0x30')](_0x4db3e2,'name');_0x8d9a8d[_0xeca9('0x31')]=_['keys'](_0x3b0aab[_0xeca9('0x31')]);_0x8d9a8d[_0xeca9('0x32')]=_[_0xeca9('0x33')](_0x8d9a8d['model'],_0x8d9a8d[_0xeca9('0x31')]);_0x1436d0[_0xeca9('0x34')]=_[_0xeca9('0x33')](_0x8d9a8d[_0xeca9('0x2f')],qs['fields'](_0x3b0aab[_0xeca9('0x31')]['fields']));_0x1436d0[_0xeca9('0x34')]=_0x1436d0[_0xeca9('0x34')][_0xeca9('0x35')]?_0x1436d0[_0xeca9('0x34')]:_0x8d9a8d[_0xeca9('0x2f')];if(!_0x3b0aab[_0xeca9('0x31')]['hasOwnProperty'](_0xeca9('0x36'))){_0x1436d0[_0xeca9('0x37')]=qs[_0xeca9('0x37')](_0x3b0aab[_0xeca9('0x31')][_0xeca9('0x37')]);_0x1436d0[_0xeca9('0x1e')]=qs[_0xeca9('0x1e')](_0x3b0aab['query'][_0xeca9('0x1e')]);}_0x1436d0[_0xeca9('0x38')]=qs[_0xeca9('0x39')](_0x3b0aab[_0xeca9('0x31')][_0xeca9('0x39')]);_0x1436d0[_0xeca9('0x3a')]=qs['filters'](_[_0xeca9('0x3b')](_0x3b0aab['query'],_0x8d9a8d[_0xeca9('0x32')]),_0x4db3e2);if(_0x3b0aab['query'][_0xeca9('0x3c')]){_0x1436d0[_0xeca9('0x3a')]=_['merge'](_0x1436d0[_0xeca9('0x3a')],{'$or':_['map'](_0x4db3e2,function(_0x2a249b){if(_0x2a249b['type']!==_0xeca9('0x3d')){var _0x5aa0b1={};_0x5aa0b1[_0x2a249b[_0xeca9('0x28')]]={'$like':'%'+_0x3b0aab[_0xeca9('0x31')]['filter']+'%'};return _0x5aa0b1;}})});}_0x1436d0=_[_0xeca9('0x3e')]({},_0x1436d0,_0x3b0aab[_0xeca9('0x3f')]);var _0x4e8080={'where':_0x1436d0[_0xeca9('0x3a')]};return db[_0xeca9('0x2b')][_0xeca9('0x20')](_0x4e8080)[_0xeca9('0x24')](function(_0xb1f2fc){_0x4910a3[_0xeca9('0x20')]=_0xb1f2fc;if(_0x3b0aab[_0xeca9('0x31')][_0xeca9('0x40')]){_0x1436d0[_0xeca9('0x41')]=[{'all':!![]}];}return db['Cdr'][_0xeca9('0x42')](_0x1436d0);})[_0xeca9('0x24')](function(_0x15ef4e){_0x4910a3[_0xeca9('0x43')]=_0x15ef4e;return _0x4910a3;})[_0xeca9('0x24')](respondWithFilteredResult(_0x424f7b,_0x1436d0))[_0xeca9('0x44')](handleError(_0x424f7b,null));};exports[_0xeca9('0x45')]=function(_0x5cb0d1,_0x1d3338){var _0x388943={'raw':!![],'where':{'id':_0x5cb0d1[_0xeca9('0x46')]['id']}},_0x188ebc={};_0x188ebc[_0xeca9('0x2f')]=_['keys'](db[_0xeca9('0x2b')][_0xeca9('0x47')]);_0x188ebc[_0xeca9('0x31')]=_[_0xeca9('0x48')](_0x5cb0d1['query']);_0x188ebc[_0xeca9('0x32')]=_[_0xeca9('0x33')](_0x188ebc['model'],_0x188ebc[_0xeca9('0x31')]);_0x388943[_0xeca9('0x34')]=_[_0xeca9('0x33')](_0x188ebc[_0xeca9('0x2f')],qs[_0xeca9('0x49')](_0x5cb0d1[_0xeca9('0x31')][_0xeca9('0x49')]));_0x388943[_0xeca9('0x34')]=_0x388943[_0xeca9('0x34')][_0xeca9('0x35')]?_0x388943[_0xeca9('0x34')]:_0x188ebc[_0xeca9('0x2f')];if(_0x5cb0d1[_0xeca9('0x31')][_0xeca9('0x40')]){_0x388943[_0xeca9('0x41')]=[{'all':!![]}];}_0x388943=_['merge']({},_0x388943,_0x5cb0d1[_0xeca9('0x3f')]);return db[_0xeca9('0x2b')][_0xeca9('0x4a')](_0x388943)[_0xeca9('0x24')](handleEntityNotFound(_0x1d3338,null))['then'](respondWithResult(_0x1d3338,null))[_0xeca9('0x44')](handleError(_0x1d3338,null));};exports[_0xeca9('0x4b')]=function(_0x548fab,_0x5e6dc2){return db[_0xeca9('0x2b')][_0xeca9('0x4b')](_0x548fab[_0xeca9('0x4c')],{})[_0xeca9('0x24')](respondWithResult(_0x5e6dc2,0xc9))['catch'](handleError(_0x5e6dc2,null));};exports[_0xeca9('0x23')]=function(_0xa4faf9,_0x346c62){if(_0xa4faf9[_0xeca9('0x4c')]['id']){delete _0xa4faf9[_0xeca9('0x4c')]['id'];}return db[_0xeca9('0x2b')][_0xeca9('0x4a')]({'where':{'id':_0xa4faf9[_0xeca9('0x46')]['id']}})[_0xeca9('0x24')](handleEntityNotFound(_0x346c62,null))['then'](saveUpdates(_0xa4faf9['body'],null))[_0xeca9('0x24')](respondWithResult(_0x346c62,null))[_0xeca9('0x44')](handleError(_0x346c62,null));};exports['destroy']=function(_0x283d2d,_0x315f54){return db[_0xeca9('0x2b')][_0xeca9('0x4a')]({'where':{'id':_0x283d2d[_0xeca9('0x46')]['id']}})[_0xeca9('0x24')](handleEntityNotFound(_0x315f54,null))[_0xeca9('0x24')](removeEntity(_0x315f54,null))[_0xeca9('0x44')](handleError(_0x315f54,null));};exports[_0xeca9('0x4d')]=function(_0x56a212,_0x5cd84d){return db['Cdr']['describe']()[_0xeca9('0x24')](respondWithResult(_0x5cd84d,null))['catch'](handleError(_0x5cd84d,null));}; \ No newline at end of file +var _0x5ad3=['destroy','error','stack','name','index','map','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','Cdr','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then'];(function(_0x5cba92,_0x250215){var _0x11f9a9=function(_0x39a311){while(--_0x39a311){_0x5cba92['push'](_0x5cba92['shift']());}};_0x11f9a9(++_0x250215);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x2ef252,_0x1993fe){_0x2ef252=_0x2ef252-0x0;var _0x1139ca=_0x5ad3[_0x2ef252];return _0x1139ca;};'use strict';var emlformat=require(_0x35ad('0x0'));var rimraf=require(_0x35ad('0x1'));var zipdir=require(_0x35ad('0x2'));var jsonpatch=require(_0x35ad('0x3'));var rp=require('request-promise');var moment=require(_0x35ad('0x4'));var BPromise=require(_0x35ad('0x5'));var Mustache=require(_0x35ad('0x6'));var util=require(_0x35ad('0x7'));var path=require(_0x35ad('0x8'));var sox=require(_0x35ad('0x9'));var csv=require(_0x35ad('0xa'));var ejs=require(_0x35ad('0xb'));var fs=require('fs');var fs_extra=require(_0x35ad('0xc'));var _=require(_0x35ad('0xd'));var squel=require('squel');var crypto=require(_0x35ad('0xe'));var jsforce=require(_0x35ad('0xf'));var deskjs=require(_0x35ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x35ad('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35ad('0x12'));var qs=require(_0x35ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ad('0x14'));var logger=require(_0x35ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ad('0x16'));var licenseUtil=require(_0x35ad('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c4dd5,_0x33e2ec){_0x33e2ec=_0x33e2ec||0xcc;return function(_0x595fe8){if(_0x595fe8){return _0x3c4dd5['sendStatus'](_0x33e2ec);}return _0x3c4dd5[_0x35ad('0x18')](_0x33e2ec)[_0x35ad('0x19')]();};}function respondWithResult(_0x3cda5e,_0x4b7ad9){_0x4b7ad9=_0x4b7ad9||0xc8;return function(_0x3e2676){if(_0x3e2676){return _0x3cda5e[_0x35ad('0x18')](_0x4b7ad9)['json'](_0x3e2676);}};}function respondWithFilteredResult(_0x1494be,_0x4d5185){return function(_0x4e3cd8){if(_0x4e3cd8){var _0x3a981a=typeof _0x4d5185[_0x35ad('0x1a')]===_0x35ad('0x1b')&&typeof _0x4d5185['limit']===_0x35ad('0x1b');var _0x2f3f27=_0x4e3cd8[_0x35ad('0x1c')];var _0x3158a1=_0x3a981a?0x0:_0x4d5185[_0x35ad('0x1a')];var _0x418416=_0x3a981a?_0x4e3cd8['count']:_0x4d5185[_0x35ad('0x1a')]+_0x4d5185[_0x35ad('0x1d')];var _0x574557;if(_0x418416>=_0x2f3f27){_0x418416=_0x2f3f27;_0x574557=0xc8;}else{_0x574557=0xce;}_0x1494be['status'](_0x574557);return _0x1494be[_0x35ad('0x1e')](_0x35ad('0x1f'),_0x3158a1+'-'+_0x418416+'/'+_0x2f3f27)['json'](_0x4e3cd8);}return null;};}function patchUpdates(_0x21f611){return function(_0x32735e){try{jsonpatch['apply'](_0x32735e,_0x21f611,!![]);}catch(_0x37c03d){return BPromise[_0x35ad('0x20')](_0x37c03d);}return _0x32735e[_0x35ad('0x21')]();};}function saveUpdates(_0x30542c,_0x1be6d2){return function(_0x43a6a8){if(_0x43a6a8){return _0x43a6a8[_0x35ad('0x22')](_0x30542c)[_0x35ad('0x23')](function(_0x2fb296){return _0x2fb296;});}return null;};}function removeEntity(_0xebc6c5,_0x4c5740){return function(_0x1cb9da){if(_0x1cb9da){return _0x1cb9da[_0x35ad('0x24')]()['then'](function(){_0xebc6c5[_0x35ad('0x18')](0xcc)[_0x35ad('0x19')]();});}};}function handleEntityNotFound(_0xa3cb9f,_0xfc80ac){return function(_0x368468){if(!_0x368468){_0xa3cb9f['sendStatus'](0x194);}return _0x368468;};}function handleError(_0x37e9bd,_0x226167){_0x226167=_0x226167||0x1f4;return function(_0x3dc3c4){logger[_0x35ad('0x25')](_0x3dc3c4[_0x35ad('0x26')]);if(_0x3dc3c4[_0x35ad('0x27')]){delete _0x3dc3c4[_0x35ad('0x27')];}_0x37e9bd[_0x35ad('0x18')](_0x226167)['send'](_0x3dc3c4);};}exports[_0x35ad('0x28')]=function(_0x11da54,_0x2f8b3){var _0x34b8b9={},_0x2c82f1={},_0x481803={'count':0x0,'rows':[]};var _0x571ad6=_[_0x35ad('0x29')](db['Cdr'][_0x35ad('0x2a')],function(_0x4ccaea){return{'name':_0x4ccaea['fieldName'],'type':_0x4ccaea['type']['key']};});_0x2c82f1[_0x35ad('0x2b')]=_['map'](_0x571ad6,'name');_0x2c82f1[_0x35ad('0x2c')]=_['keys'](_0x11da54[_0x35ad('0x2c')]);_0x2c82f1['filters']=_[_0x35ad('0x2d')](_0x2c82f1['model'],_0x2c82f1[_0x35ad('0x2c')]);_0x34b8b9['attributes']=_[_0x35ad('0x2d')](_0x2c82f1[_0x35ad('0x2b')],qs[_0x35ad('0x2e')](_0x11da54['query'][_0x35ad('0x2e')]));_0x34b8b9[_0x35ad('0x2f')]=_0x34b8b9[_0x35ad('0x2f')][_0x35ad('0x30')]?_0x34b8b9[_0x35ad('0x2f')]:_0x2c82f1['model'];if(!_0x11da54['query'][_0x35ad('0x31')](_0x35ad('0x32'))){_0x34b8b9[_0x35ad('0x1d')]=qs[_0x35ad('0x1d')](_0x11da54['query'][_0x35ad('0x1d')]);_0x34b8b9[_0x35ad('0x1a')]=qs[_0x35ad('0x1a')](_0x11da54[_0x35ad('0x2c')][_0x35ad('0x1a')]);}_0x34b8b9[_0x35ad('0x33')]=qs['sort'](_0x11da54['query'][_0x35ad('0x34')]);_0x34b8b9[_0x35ad('0x35')]=qs[_0x35ad('0x36')](_[_0x35ad('0x37')](_0x11da54[_0x35ad('0x2c')],_0x2c82f1[_0x35ad('0x36')]),_0x571ad6);if(_0x11da54[_0x35ad('0x2c')][_0x35ad('0x38')]){_0x34b8b9[_0x35ad('0x35')]=_['merge'](_0x34b8b9[_0x35ad('0x35')],{'$or':_['map'](_0x571ad6,function(_0x25e63e){if(_0x25e63e[_0x35ad('0x39')]!==_0x35ad('0x3a')){var _0x38d1c9={};_0x38d1c9[_0x25e63e[_0x35ad('0x27')]]={'$like':'%'+_0x11da54[_0x35ad('0x2c')][_0x35ad('0x38')]+'%'};return _0x38d1c9;}})});}_0x34b8b9=_[_0x35ad('0x3b')]({},_0x34b8b9,_0x11da54[_0x35ad('0x3c')]);var _0x5dd327={'where':_0x34b8b9[_0x35ad('0x35')]};return db[_0x35ad('0x3d')][_0x35ad('0x1c')](_0x5dd327)['then'](function(_0x19d82d){_0x481803[_0x35ad('0x1c')]=_0x19d82d;if(_0x11da54[_0x35ad('0x2c')][_0x35ad('0x3e')]){_0x34b8b9[_0x35ad('0x3f')]=[{'all':!![]}];}return db[_0x35ad('0x3d')][_0x35ad('0x40')](_0x34b8b9);})[_0x35ad('0x23')](function(_0x11de09){_0x481803[_0x35ad('0x41')]=_0x11de09;return _0x481803;})[_0x35ad('0x23')](respondWithFilteredResult(_0x2f8b3,_0x34b8b9))['catch'](handleError(_0x2f8b3,null));};exports[_0x35ad('0x42')]=function(_0x4edc2b,_0x3de722){var _0x3b80c0={'raw':!![],'where':{'id':_0x4edc2b[_0x35ad('0x43')]['id']}},_0x3df623={};_0x3df623[_0x35ad('0x2b')]=_[_0x35ad('0x44')](db[_0x35ad('0x3d')][_0x35ad('0x2a')]);_0x3df623[_0x35ad('0x2c')]=_['keys'](_0x4edc2b[_0x35ad('0x2c')]);_0x3df623[_0x35ad('0x36')]=_[_0x35ad('0x2d')](_0x3df623[_0x35ad('0x2b')],_0x3df623[_0x35ad('0x2c')]);_0x3b80c0['attributes']=_[_0x35ad('0x2d')](_0x3df623[_0x35ad('0x2b')],qs['fields'](_0x4edc2b['query'][_0x35ad('0x2e')]));_0x3b80c0[_0x35ad('0x2f')]=_0x3b80c0[_0x35ad('0x2f')][_0x35ad('0x30')]?_0x3b80c0['attributes']:_0x3df623[_0x35ad('0x2b')];if(_0x4edc2b[_0x35ad('0x2c')][_0x35ad('0x3e')]){_0x3b80c0[_0x35ad('0x3f')]=[{'all':!![]}];}_0x3b80c0=_[_0x35ad('0x3b')]({},_0x3b80c0,_0x4edc2b[_0x35ad('0x3c')]);return db[_0x35ad('0x3d')]['find'](_0x3b80c0)[_0x35ad('0x23')](handleEntityNotFound(_0x3de722,null))[_0x35ad('0x23')](respondWithResult(_0x3de722,null))[_0x35ad('0x45')](handleError(_0x3de722,null));};exports['create']=function(_0x5e3f96,_0x5644c4){return db[_0x35ad('0x3d')][_0x35ad('0x46')](_0x5e3f96[_0x35ad('0x47')],{})[_0x35ad('0x23')](respondWithResult(_0x5644c4,0xc9))['catch'](handleError(_0x5644c4,null));};exports[_0x35ad('0x22')]=function(_0x46c462,_0x3583ca){if(_0x46c462[_0x35ad('0x47')]['id']){delete _0x46c462[_0x35ad('0x47')]['id'];}return db[_0x35ad('0x3d')]['find']({'where':{'id':_0x46c462['params']['id']}})[_0x35ad('0x23')](handleEntityNotFound(_0x3583ca,null))[_0x35ad('0x23')](saveUpdates(_0x46c462['body'],null))['then'](respondWithResult(_0x3583ca,null))[_0x35ad('0x45')](handleError(_0x3583ca,null));};exports[_0x35ad('0x24')]=function(_0x196ebd,_0x5c7dbd){return db['Cdr'][_0x35ad('0x48')]({'where':{'id':_0x196ebd[_0x35ad('0x43')]['id']}})[_0x35ad('0x23')](handleEntityNotFound(_0x5c7dbd,null))['then'](removeEntity(_0x5c7dbd,null))[_0x35ad('0x45')](handleError(_0x5c7dbd,null));};exports[_0x35ad('0x49')]=function(_0x34061c,_0x467887){return db[_0x35ad('0x3d')][_0x35ad('0x49')]()['then'](respondWithResult(_0x467887,null))[_0x35ad('0x45')](handleError(_0x467887,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 662f6e6..12fd3ea 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4b84df,_0x21d1ce){var _0x4d31fe=function(_0xbf78dc){while(--_0xbf78dc){_0x4b84df['push'](_0x4b84df['shift']());}};_0x4d31fe(++_0x21d1ce);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x586336,_0xa94667){var _0xbf3686=function(_0x21ffc3){while(--_0x21ffc3){_0x586336['push'](_0x586336['shift']());}};_0xbf3686(++_0xa94667);}(_0x7a54,0x106));var _0x47a5=function(_0x55d611,_0x3dcec5){_0x55d611=_0x55d611-0x0;var _0x54c460=_0x7a54[_0x55d611];return _0x54c460;};'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 3392427..3cde704 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 _0x7732=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Cdr,\x20%s,\x20%s'];(function(_0x10aec2,_0x1b346f){var _0x5b69ab=function(_0xe8505a){while(--_0xe8505a){_0x10aec2['push'](_0x10aec2['shift']());}};_0x5b69ab(++_0x1b346f);}(_0x7732,0x173));var _0x2773=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x7732[_0x595013];return _0x2a29e3;};'use strict';var _=require(_0x2773('0x0'));var util=require('util');var moment=require(_0x2773('0x1'));var BPromise=require(_0x2773('0x2'));var rs=require(_0x2773('0x3'));var fs=require('fs');var Redis=require(_0x2773('0x4'));var db=require(_0x2773('0x5'))['db'];var utils=require(_0x2773('0x6'));var logger=require('../../config/logger')(_0x2773('0x7'));var config=require(_0x2773('0x8'));var jayson=require(_0x2773('0x9'));var client=jayson['client'][_0x2773('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x440dac,_0xd3e2b9,_0x1134c7){return new BPromise(function(_0x2bb392,_0x5c8256){return client[_0x2773('0xb')](_0x440dac,_0x1134c7)[_0x2773('0xc')](function(_0x211ae5){logger[_0x2773('0xd')]('Cdr,\x20%s,\x20%s',_0xd3e2b9,'request\x20sent');logger[_0x2773('0xe')](_0x2773('0xf'),_0xd3e2b9,_0x2773('0x10'),JSON['stringify'](_0x211ae5));if(_0x211ae5['error']){if(_0x211ae5[_0x2773('0x11')][_0x2773('0x12')]===0x1f4){logger['error'](_0x2773('0x13'),_0xd3e2b9,_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);return _0x5c8256(_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);}logger[_0x2773('0x11')](_0x2773('0x13'),_0xd3e2b9,_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);return _0x2bb392(_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);}else{logger[_0x2773('0xd')]('Cdr,\x20%s,\x20%s',_0xd3e2b9,'request\x20sent');_0x2bb392(_0x211ae5[_0x2773('0x15')][_0x2773('0x14')]);}})[_0x2773('0x16')](function(_0x1f5ce3){logger[_0x2773('0x11')](_0x2773('0x13'),_0xd3e2b9,_0x1f5ce3);_0x5c8256(_0x1f5ce3);});});} \ No newline at end of file +var _0x93d7=['../../config/logger','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x452217,_0x1cc6bb){var _0xdf3b73=function(_0x89c60b){while(--_0x89c60b){_0x452217['push'](_0x452217['shift']());}};_0xdf3b73(++_0x1cc6bb);}(_0x93d7,0x1da));var _0x793d=function(_0x4ce159,_0x2179be){_0x4ce159=_0x4ce159-0x0;var _0x526517=_0x93d7[_0x4ce159];return _0x526517;};'use strict';var _=require(_0x793d('0x0'));var util=require(_0x793d('0x1'));var moment=require(_0x793d('0x2'));var BPromise=require('bluebird');var rs=require(_0x793d('0x3'));var fs=require('fs');var Redis=require(_0x793d('0x4'));var db=require(_0x793d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x793d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x793d('0x7'));var client=jayson['client'][_0x793d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21bebd,_0x912746,_0x1c9dca){return new BPromise(function(_0x467fdd,_0x42792e){return client[_0x793d('0x9')](_0x21bebd,_0x1c9dca)[_0x793d('0xa')](function(_0x516d4a){logger[_0x793d('0xb')](_0x793d('0xc'),_0x912746,'request\x20sent');logger['debug'](_0x793d('0xd'),_0x912746,_0x793d('0xe'),JSON['stringify'](_0x516d4a));if(_0x516d4a[_0x793d('0xf')]){if(_0x516d4a[_0x793d('0xf')][_0x793d('0x10')]===0x1f4){logger[_0x793d('0xf')](_0x793d('0xc'),_0x912746,_0x516d4a[_0x793d('0xf')][_0x793d('0x11')]);return _0x42792e(_0x516d4a[_0x793d('0xf')][_0x793d('0x11')]);}logger['error'](_0x793d('0xc'),_0x912746,_0x516d4a[_0x793d('0xf')][_0x793d('0x11')]);return _0x467fdd(_0x516d4a[_0x793d('0xf')][_0x793d('0x11')]);}else{logger['info'](_0x793d('0xc'),_0x912746,_0x793d('0xe'));_0x467fdd(_0x516d4a[_0x793d('0x12')][_0x793d('0x11')]);}})[_0x793d('0x13')](function(_0x31f617){logger[_0x793d('0xf')](_0x793d('0xc'),_0x912746,_0x31f617);_0x42792e(_0x31f617);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 39399ec..ff53b9a 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xc3f3bd,_0x20b7f5){var _0x27d0bd=function(_0x2d0977){while(--_0x2d0977){_0xc3f3bd['push'](_0xc3f3bd['shift']());}};_0x27d0bd(++_0x20b7f5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f050dec..549ea4e 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 _0x1bf0=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1bf0,0x116));var _0x01bf=function(_0x248c1e,_0x3468f6){_0x248c1e=_0x248c1e-0x0;var _0x330688=_0x1bf0[_0x248c1e];return _0x330688;};'use strict';var Sequelize=require(_0x01bf('0x0'));module[_0x01bf('0x1')]={'priority':{'type':Sequelize[_0x01bf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x01bf('0x3')],'allowNull':![],'defaultValue':_0x01bf('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x01bf('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x01bf('0x5')}}; \ No newline at end of file +var _0x9320=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x9320,0x72));var _0x0932=function(_0x3af017,_0x6b7516){_0x3af017=_0x3af017-0x0;var _0x104228=_0x9320[_0x3af017];return _0x104228;};'use strict';var Sequelize=require(_0x0932('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0932('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0932('0x2')],'allowNull':![],'defaultValue':_0x0932('0x3')},'appdata':{'type':Sequelize[_0x0932('0x4')]()},'description':{'type':Sequelize[_0x0932('0x2')]},'interval':{'type':Sequelize[_0x0932('0x2')],'defaultValue':_0x0932('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 10f6be2..9128f7c 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 _0x7229=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','params','keys','ChatApplication','query','filters','intersection','model','fields','attributes','length','include','merge','options','find','catch','body','eml-format','rimraf'];(function(_0x1f07a8,_0x407446){var _0x23cabd=function(_0x357c38){while(--_0x357c38){_0x1f07a8['push'](_0x1f07a8['shift']());}};_0x23cabd(++_0x407446);}(_0x7229,0x76));var _0x9722=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7229[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x9722('0x0'));var rimraf=require(_0x9722('0x1'));var zipdir=require(_0x9722('0x2'));var jsonpatch=require(_0x9722('0x3'));var rp=require(_0x9722('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9722('0x5'));var util=require(_0x9722('0x6'));var path=require(_0x9722('0x7'));var sox=require(_0x9722('0x8'));var csv=require(_0x9722('0x9'));var ejs=require(_0x9722('0xa'));var fs=require('fs');var fs_extra=require(_0x9722('0xb'));var _=require('lodash');var squel=require(_0x9722('0xc'));var crypto=require('crypto');var jsforce=require(_0x9722('0xd'));var deskjs=require(_0x9722('0xe'));var toCsv=require(_0x9722('0x9'));var querystring=require(_0x9722('0xf'));var Papa=require(_0x9722('0x10'));var Redis=require(_0x9722('0x11'));var authService=require(_0x9722('0x12'));var qs=require(_0x9722('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9722('0x14'))(_0x9722('0x15'));var utils=require(_0x9722('0x16'));var config=require(_0x9722('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9722('0x18'))['db'];function respondWithStatusCode(_0x32fd25,_0x11942f){_0x11942f=_0x11942f||0xcc;return function(_0x124bfc){if(_0x124bfc){return _0x32fd25['sendStatus'](_0x11942f);}return _0x32fd25[_0x9722('0x19')](_0x11942f)[_0x9722('0x1a')]();};}function respondWithResult(_0x256348,_0x248bdf){_0x248bdf=_0x248bdf||0xc8;return function(_0x2f1c3b){if(_0x2f1c3b){return _0x256348['status'](_0x248bdf)[_0x9722('0x1b')](_0x2f1c3b);}};}function respondWithFilteredResult(_0x203db5,_0x2f2f96){return function(_0x482ad4){if(_0x482ad4){var _0xc802f7=typeof _0x2f2f96[_0x9722('0x1c')]==='undefined'&&typeof _0x2f2f96[_0x9722('0x1d')]===_0x9722('0x1e');var _0x38e179=_0x482ad4['count'];var _0x43b3fa=_0xc802f7?0x0:_0x2f2f96[_0x9722('0x1c')];var _0x38112a=_0xc802f7?_0x482ad4[_0x9722('0x1f')]:_0x2f2f96[_0x9722('0x1c')]+_0x2f2f96[_0x9722('0x1d')];var _0x2481f5;if(_0x38112a>=_0x38e179){_0x38112a=_0x38e179;_0x2481f5=0xc8;}else{_0x2481f5=0xce;}_0x203db5[_0x9722('0x19')](_0x2481f5);return _0x203db5[_0x9722('0x20')](_0x9722('0x21'),_0x43b3fa+'-'+_0x38112a+'/'+_0x38e179)[_0x9722('0x1b')](_0x482ad4);}return null;};}function patchUpdates(_0x23e9d0){return function(_0x451ce8){try{jsonpatch[_0x9722('0x22')](_0x451ce8,_0x23e9d0,!![]);}catch(_0x3b094d){return BPromise[_0x9722('0x23')](_0x3b094d);}return _0x451ce8['save']();};}function saveUpdates(_0x22a3e2,_0x3ab4d4){return function(_0x3abf4b){if(_0x3abf4b){return _0x3abf4b[_0x9722('0x24')](_0x22a3e2)[_0x9722('0x25')](function(_0x392d59){return _0x392d59;});}return null;};}function removeEntity(_0x4aeea7,_0x73c303){return function(_0x1aff40){if(_0x1aff40){return _0x1aff40[_0x9722('0x26')]()[_0x9722('0x25')](function(){_0x4aeea7[_0x9722('0x19')](0xcc)[_0x9722('0x1a')]();});}};}function handleEntityNotFound(_0x3b3ce9,_0x1f2ad8){return function(_0x4aab4e){if(!_0x4aab4e){_0x3b3ce9[_0x9722('0x27')](0x194);}return _0x4aab4e;};}function handleError(_0x5bf6f2,_0x141c7d){_0x141c7d=_0x141c7d||0x1f4;return function(_0x19a7b6){logger[_0x9722('0x28')](_0x19a7b6[_0x9722('0x29')]);if(_0x19a7b6[_0x9722('0x2a')]){delete _0x19a7b6[_0x9722('0x2a')];}_0x5bf6f2[_0x9722('0x19')](_0x141c7d)[_0x9722('0x2b')](_0x19a7b6);};}exports['show']=function(_0x19ffa8,_0x4805be){var _0x568ddc={'raw':!![],'where':{'id':_0x19ffa8[_0x9722('0x2c')]['id']}},_0x18fa43={};_0x18fa43['model']=_[_0x9722('0x2d')](db[_0x9722('0x2e')]['rawAttributes']);_0x18fa43['query']=_[_0x9722('0x2d')](_0x19ffa8[_0x9722('0x2f')]);_0x18fa43[_0x9722('0x30')]=_[_0x9722('0x31')](_0x18fa43[_0x9722('0x32')],_0x18fa43[_0x9722('0x2f')]);_0x568ddc['attributes']=_[_0x9722('0x31')](_0x18fa43[_0x9722('0x32')],qs[_0x9722('0x33')](_0x19ffa8[_0x9722('0x2f')]['fields']));_0x568ddc[_0x9722('0x34')]=_0x568ddc[_0x9722('0x34')][_0x9722('0x35')]?_0x568ddc['attributes']:_0x18fa43['model'];if(_0x19ffa8[_0x9722('0x2f')]['includeAll']){_0x568ddc[_0x9722('0x36')]=[{'all':!![]}];}_0x568ddc=_[_0x9722('0x37')]({},_0x568ddc,_0x19ffa8[_0x9722('0x38')]);return db[_0x9722('0x2e')][_0x9722('0x39')](_0x568ddc)[_0x9722('0x25')](handleEntityNotFound(_0x4805be,null))[_0x9722('0x25')](respondWithResult(_0x4805be,null))[_0x9722('0x3a')](handleError(_0x4805be,null));};exports[_0x9722('0x24')]=function(_0x463dd8,_0x427244){if(_0x463dd8[_0x9722('0x3b')]['id']){delete _0x463dd8['body']['id'];}return db['ChatApplication'][_0x9722('0x39')]({'where':{'id':_0x463dd8[_0x9722('0x2c')]['id']}})[_0x9722('0x25')](handleEntityNotFound(_0x427244,null))[_0x9722('0x25')](saveUpdates(_0x463dd8[_0x9722('0x3b')],null))[_0x9722('0x25')](respondWithResult(_0x427244,null))[_0x9722('0x3a')](handleError(_0x427244,null));};exports[_0x9722('0x26')]=function(_0x519368,_0x44b9f4){return db['ChatApplication']['find']({'where':{'id':_0x519368[_0x9722('0x2c')]['id']}})[_0x9722('0x25')](handleEntityNotFound(_0x44b9f4,null))[_0x9722('0x25')](removeEntity(_0x44b9f4,null))['catch'](handleError(_0x44b9f4,null));}; \ No newline at end of file +var _0x3d15=['squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','catch','update','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x3d15,0x127));var _0x53d1=function(_0x3d9dc2,_0x4d0f69){_0x3d9dc2=_0x3d9dc2-0x0;var _0x9f75a0=_0x3d15[_0x3d9dc2];return _0x9f75a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53d1('0x0'));var zipdir=require(_0x53d1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53d1('0x2'));var moment=require(_0x53d1('0x3'));var BPromise=require(_0x53d1('0x4'));var Mustache=require('mustache');var util=require(_0x53d1('0x5'));var path=require(_0x53d1('0x6'));var sox=require(_0x53d1('0x7'));var csv=require('to-csv');var ejs=require(_0x53d1('0x8'));var fs=require('fs');var fs_extra=require(_0x53d1('0x9'));var _=require('lodash');var squel=require(_0x53d1('0xa'));var crypto=require(_0x53d1('0xb'));var jsforce=require(_0x53d1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x53d1('0xd'));var querystring=require(_0x53d1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53d1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x53d1('0x10'));var hardwareService=require(_0x53d1('0x11'));var logger=require(_0x53d1('0x12'))(_0x53d1('0x13'));var utils=require(_0x53d1('0x14'));var config=require(_0x53d1('0x15'));var licenseUtil=require(_0x53d1('0x16'));var db=require(_0x53d1('0x17'))['db'];function respondWithStatusCode(_0x518ed8,_0x28fd72){_0x28fd72=_0x28fd72||0xcc;return function(_0x4467db){if(_0x4467db){return _0x518ed8[_0x53d1('0x18')](_0x28fd72);}return _0x518ed8[_0x53d1('0x19')](_0x28fd72)[_0x53d1('0x1a')]();};}function respondWithResult(_0xc2dba9,_0x17ccb5){_0x17ccb5=_0x17ccb5||0xc8;return function(_0x4fd437){if(_0x4fd437){return _0xc2dba9[_0x53d1('0x19')](_0x17ccb5)[_0x53d1('0x1b')](_0x4fd437);}};}function respondWithFilteredResult(_0x11d41c,_0xcb529b){return function(_0x1b94f3){if(_0x1b94f3){var _0x5a1de3=typeof _0xcb529b[_0x53d1('0x1c')]===_0x53d1('0x1d')&&typeof _0xcb529b[_0x53d1('0x1e')]==='undefined';var _0x8de663=_0x1b94f3[_0x53d1('0x1f')];var _0x280900=_0x5a1de3?0x0:_0xcb529b[_0x53d1('0x1c')];var _0x2e9e96=_0x5a1de3?_0x1b94f3[_0x53d1('0x1f')]:_0xcb529b[_0x53d1('0x1c')]+_0xcb529b[_0x53d1('0x1e')];var _0x52095a;if(_0x2e9e96>=_0x8de663){_0x2e9e96=_0x8de663;_0x52095a=0xc8;}else{_0x52095a=0xce;}_0x11d41c[_0x53d1('0x19')](_0x52095a);return _0x11d41c[_0x53d1('0x20')](_0x53d1('0x21'),_0x280900+'-'+_0x2e9e96+'/'+_0x8de663)[_0x53d1('0x1b')](_0x1b94f3);}return null;};}function patchUpdates(_0x5e5a56){return function(_0x21cffe){try{jsonpatch[_0x53d1('0x22')](_0x21cffe,_0x5e5a56,!![]);}catch(_0x25323b){return BPromise[_0x53d1('0x23')](_0x25323b);}return _0x21cffe[_0x53d1('0x24')]();};}function saveUpdates(_0x503a8e,_0x60aee1){return function(_0x4ed348){if(_0x4ed348){return _0x4ed348['update'](_0x503a8e)[_0x53d1('0x25')](function(_0x57afd8){return _0x57afd8;});}return null;};}function removeEntity(_0x31adde,_0x56c15f){return function(_0x567f46){if(_0x567f46){return _0x567f46[_0x53d1('0x26')]()['then'](function(){_0x31adde['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd304d2,_0x1fbf33){return function(_0x5eaf29){if(!_0x5eaf29){_0xd304d2[_0x53d1('0x18')](0x194);}return _0x5eaf29;};}function handleError(_0x10275c,_0x4ae83b){_0x4ae83b=_0x4ae83b||0x1f4;return function(_0x465698){logger[_0x53d1('0x27')](_0x465698[_0x53d1('0x28')]);if(_0x465698[_0x53d1('0x29')]){delete _0x465698[_0x53d1('0x29')];}_0x10275c[_0x53d1('0x19')](_0x4ae83b)['send'](_0x465698);};}exports[_0x53d1('0x2a')]=function(_0x25e54d,_0x2f7609){var _0x81c56b={'raw':!![],'where':{'id':_0x25e54d['params']['id']}},_0x421306={};_0x421306[_0x53d1('0x2b')]=_[_0x53d1('0x2c')](db[_0x53d1('0x2d')][_0x53d1('0x2e')]);_0x421306[_0x53d1('0x2f')]=_[_0x53d1('0x2c')](_0x25e54d[_0x53d1('0x2f')]);_0x421306[_0x53d1('0x30')]=_[_0x53d1('0x31')](_0x421306['model'],_0x421306[_0x53d1('0x2f')]);_0x81c56b[_0x53d1('0x32')]=_[_0x53d1('0x31')](_0x421306[_0x53d1('0x2b')],qs['fields'](_0x25e54d[_0x53d1('0x2f')][_0x53d1('0x33')]));_0x81c56b[_0x53d1('0x32')]=_0x81c56b['attributes'][_0x53d1('0x34')]?_0x81c56b[_0x53d1('0x32')]:_0x421306[_0x53d1('0x2b')];if(_0x25e54d[_0x53d1('0x2f')][_0x53d1('0x35')]){_0x81c56b[_0x53d1('0x36')]=[{'all':!![]}];}_0x81c56b=_[_0x53d1('0x37')]({},_0x81c56b,_0x25e54d['options']);return db[_0x53d1('0x2d')]['find'](_0x81c56b)[_0x53d1('0x25')](handleEntityNotFound(_0x2f7609,null))[_0x53d1('0x25')](respondWithResult(_0x2f7609,null))[_0x53d1('0x38')](handleError(_0x2f7609,null));};exports[_0x53d1('0x39')]=function(_0x163eb6,_0x529213){if(_0x163eb6['body']['id']){delete _0x163eb6[_0x53d1('0x3a')]['id'];}return db['ChatApplication'][_0x53d1('0x3b')]({'where':{'id':_0x163eb6[_0x53d1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x529213,null))['then'](saveUpdates(_0x163eb6[_0x53d1('0x3a')],null))[_0x53d1('0x25')](respondWithResult(_0x529213,null))[_0x53d1('0x38')](handleError(_0x529213,null));};exports[_0x53d1('0x26')]=function(_0x32f304,_0x1685ab){return db['ChatApplication']['find']({'where':{'id':_0x32f304['params']['id']}})['then'](handleEntityNotFound(_0x1685ab,null))[_0x53d1('0x25')](removeEntity(_0x1685ab,null))[_0x53d1('0x38')](handleError(_0x1685ab,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9fca96e..df49ae3 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 _0xdb6e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','lodash'];(function(_0x2ae255,_0x41e53a){var _0x43e3f8=function(_0x1943ff){while(--_0x1943ff){_0x2ae255['push'](_0x2ae255['shift']());}};_0x43e3f8(++_0x41e53a);}(_0xdb6e,0x179));var _0xedb6=function(_0x54f072,_0x39e1fd){_0x54f072=_0x54f072-0x0;var _0x42e317=_0xdb6e[_0x54f072];return _0x42e317;};'use strict';var _=require(_0xedb6('0x0'));var util=require(_0xedb6('0x1'));var logger=require(_0xedb6('0x2'))(_0xedb6('0x3'));var moment=require(_0xedb6('0x4'));var BPromise=require(_0xedb6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedb6('0x6'));var rimraf=require(_0xedb6('0x7'));var config=require(_0xedb6('0x8'));var attributes=require(_0xedb6('0x9'));module[_0xedb6('0xa')]=function(_0x30de0d,_0x35f987){return _0x30de0d['define'](_0xedb6('0xb'),attributes,{'tableName':_0xedb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xedb6('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x190a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x368247,_0x30870d){var _0x35547b=function(_0x3c1b2b){while(--_0x3c1b2b){_0x368247['push'](_0x368247['shift']());}};_0x35547b(++_0x30870d);}(_0x190a,0x1ea));var _0xa190=function(_0x5ea0b2,_0x288293){_0x5ea0b2=_0x5ea0b2-0x0;var _0x1d27f8=_0x190a[_0x5ea0b2];return _0x1d27f8;};'use strict';var _=require(_0xa190('0x0'));var util=require(_0xa190('0x1'));var logger=require(_0xa190('0x2'))(_0xa190('0x3'));var moment=require(_0xa190('0x4'));var BPromise=require(_0xa190('0x5'));var rp=require(_0xa190('0x6'));var fs=require('fs');var path=require(_0xa190('0x7'));var rimraf=require(_0xa190('0x8'));var config=require('../../config/environment');var attributes=require(_0xa190('0x9'));module['exports']=function(_0x230098,_0x2207f2){return _0x230098['define']('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa190('0xa'),'collate':_0xa190('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 39a8af2..c601ba8 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 _0x4142=['stringify','error','code','message','ChatApplication,\x20%s,\x20%s','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4142,0x1f4));var _0x2414=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4142[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2414('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2414('0x1'));var db=require(_0x2414('0x2'))['db'];var utils=require(_0x2414('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2414('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2414('0x5')][_0x2414('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58895f,_0x321050,_0x50c5ad){return new BPromise(function(_0x43a54f,_0x36e886){return client[_0x2414('0x7')](_0x58895f,_0x50c5ad)[_0x2414('0x8')](function(_0x3d6b06){logger[_0x2414('0x9')]('ChatApplication,\x20%s,\x20%s',_0x321050,_0x2414('0xa'));logger[_0x2414('0xb')](_0x2414('0xc'),_0x321050,'request\x20sent',JSON[_0x2414('0xd')](_0x3d6b06));if(_0x3d6b06[_0x2414('0xe')]){if(_0x3d6b06[_0x2414('0xe')][_0x2414('0xf')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x321050,_0x3d6b06[_0x2414('0xe')][_0x2414('0x10')]);return _0x36e886(_0x3d6b06[_0x2414('0xe')]['message']);}logger[_0x2414('0xe')]('ChatApplication,\x20%s,\x20%s',_0x321050,_0x3d6b06[_0x2414('0xe')]['message']);return _0x43a54f(_0x3d6b06['error'][_0x2414('0x10')]);}else{logger[_0x2414('0x9')](_0x2414('0x11'),_0x321050,'request\x20sent');_0x43a54f(_0x3d6b06['result']['message']);}})[_0x2414('0x12')](function(_0x8cca88){logger['error'](_0x2414('0x11'),_0x321050,_0x8cca88);_0x36e886(_0x8cca88);});});} \ No newline at end of file +var _0xcef8=['util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','lodash'];(function(_0x25a09c,_0x544c01){var _0x4d8538=function(_0x1ae38d){while(--_0x1ae38d){_0x25a09c['push'](_0x25a09c['shift']());}};_0x4d8538(++_0x544c01);}(_0xcef8,0x7d));var _0x8cef=function(_0x148cd4,_0x3bb783){_0x148cd4=_0x148cd4-0x0;var _0x1b8338=_0xcef8[_0x148cd4];return _0x1b8338;};'use strict';var _=require(_0x8cef('0x0'));var util=require(_0x8cef('0x1'));var moment=require(_0x8cef('0x2'));var BPromise=require(_0x8cef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8cef('0x4'));var logger=require(_0x8cef('0x5'))(_0x8cef('0x6'));var config=require(_0x8cef('0x7'));var jayson=require(_0x8cef('0x8'));var client=jayson[_0x8cef('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ca929,_0x228694,_0xbe529d){return new BPromise(function(_0x2f2999,_0x40d5cd){return client[_0x8cef('0xa')](_0x2ca929,_0xbe529d)['then'](function(_0x2ce131){logger[_0x8cef('0xb')](_0x8cef('0xc'),_0x228694,'request\x20sent');logger['debug'](_0x8cef('0xd'),_0x228694,'request\x20sent',JSON['stringify'](_0x2ce131));if(_0x2ce131['error']){if(_0x2ce131[_0x8cef('0xe')]['code']===0x1f4){logger[_0x8cef('0xe')](_0x8cef('0xc'),_0x228694,_0x2ce131['error']['message']);return _0x40d5cd(_0x2ce131[_0x8cef('0xe')][_0x8cef('0xf')]);}logger[_0x8cef('0xe')]('ChatApplication,\x20%s,\x20%s',_0x228694,_0x2ce131[_0x8cef('0xe')]['message']);return _0x2f2999(_0x2ce131[_0x8cef('0xe')]['message']);}else{logger[_0x8cef('0xb')](_0x8cef('0xc'),_0x228694,_0x8cef('0x10'));_0x2f2999(_0x2ce131[_0x8cef('0x11')]['message']);}})['catch'](function(_0x106efa){logger[_0x8cef('0xe')](_0x8cef('0xc'),_0x228694,_0x106efa);_0x40d5cd(_0x106efa);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index dd3f83f..e2fbb69 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 _0x33b5=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x33b5,0x1e1));var _0x533b=function(_0x4d57a6,_0x4555ec){_0x4d57a6=_0x4d57a6-0x0;var _0x250376=_0x33b5[_0x4d57a6];return _0x250376;};'use strict';var multer=require(_0x533b('0x0'));var util=require(_0x533b('0x1'));var path=require(_0x533b('0x2'));var timeout=require(_0x533b('0x3'));var express=require(_0x533b('0x4'));var router=express[_0x533b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x533b('0x6'));var interaction=require(_0x533b('0x7'));var config=require('../../config/environment');var controller=require(_0x533b('0x8'));router[_0x533b('0x9')](_0x533b('0xa'),auth[_0x533b('0xb')](),controller['show']);router[_0x533b('0xc')](_0x533b('0xa'),auth['isAuthenticated'](),controller[_0x533b('0xd')]);router[_0x533b('0xe')](_0x533b('0xa'),auth[_0x533b('0xb')](),controller[_0x533b('0xf')]);module[_0x533b('0x10')]=router; \ No newline at end of file +var _0x2761=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x2761,0xa2));var _0x1276=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2761[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x1276('0x0'));var util=require(_0x1276('0x1'));var path=require(_0x1276('0x2'));var timeout=require(_0x1276('0x3'));var express=require('express');var router=express[_0x1276('0x4')]();var fs_extra=require(_0x1276('0x5'));var auth=require(_0x1276('0x6'));var interaction=require(_0x1276('0x7'));var config=require(_0x1276('0x8'));var controller=require(_0x1276('0x9'));router[_0x1276('0xa')](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0xd')]);router[_0x1276('0xe')](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0xf')]);router[_0x1276('0x10')]('/:id',auth[_0x1276('0xc')](),controller[_0x1276('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4101069..78e0aac 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 _0x6fb2=['sequelize','exports','STRING'];(function(_0x1dabba,_0xde90f7){var _0x368044=function(_0x4404d3){while(--_0x4404d3){_0x1dabba['push'](_0x1dabba['shift']());}};_0x368044(++_0xde90f7);}(_0x6fb2,0x1ef));var _0x26fb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6fb2[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x26fb('0x0'));module[_0x26fb('0x1')]={'name':{'type':Sequelize[_0x26fb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x26fb('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6f8e=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3f2c8e,_0x4248d3){var _0x214b7d=function(_0x43117f){while(--_0x43117f){_0x3f2c8e['push'](_0x3f2c8e['shift']());}};_0x214b7d(++_0x4248d3);}(_0x6f8e,0x15a));var _0xe6f8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f8e[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xe6f8('0x0'));module[_0xe6f8('0x1')]={'name':{'type':Sequelize[_0xe6f8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xe6f8('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 72ea61e..2bf2ef7 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 _0xee72=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','name','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','then','rows','catch','show','params','keys','includeAll','include','options','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','removeMembers','ChatGroupId','getMessages','length','$gte','split','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x51f1e7,_0x175572){var _0x2956bd=function(_0x3cd085){while(--_0x3cd085){_0x51f1e7['push'](_0x51f1e7['shift']());}};_0x2956bd(++_0x175572);}(_0xee72,0x1c6));var _0x2ee7=function(_0xe6f10a,_0x3ecd25){_0xe6f10a=_0xe6f10a-0x0;var _0x132c5f=_0xee72[_0xe6f10a];return _0x132c5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ee7('0x0'));var zipdir=require(_0x2ee7('0x1'));var jsonpatch=require(_0x2ee7('0x2'));var rp=require(_0x2ee7('0x3'));var moment=require('moment');var BPromise=require(_0x2ee7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2ee7('0x5'));var csv=require(_0x2ee7('0x6'));var ejs=require(_0x2ee7('0x7'));var fs=require('fs');var fs_extra=require(_0x2ee7('0x8'));var _=require(_0x2ee7('0x9'));var squel=require('squel');var crypto=require(_0x2ee7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2ee7('0xb'));var toCsv=require(_0x2ee7('0x6'));var querystring=require(_0x2ee7('0xc'));var Papa=require(_0x2ee7('0xd'));var Redis=require(_0x2ee7('0xe'));var authService=require(_0x2ee7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2ee7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ee7('0x11'))(_0x2ee7('0x12'));var utils=require(_0x2ee7('0x13'));var config=require(_0x2ee7('0x14'));var licenseUtil=require(_0x2ee7('0x15'));var db=require(_0x2ee7('0x16'))['db'];config[_0x2ee7('0x17')]=_[_0x2ee7('0x18')](config[_0x2ee7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ee7('0x19'))(new Redis(config[_0x2ee7('0x17')]));require(_0x2ee7('0x1a'))[_0x2ee7('0x1b')](socket);function respondWithStatusCode(_0x320a83,_0x22c4fb){_0x22c4fb=_0x22c4fb||0xcc;return function(_0x19f03f){if(_0x19f03f){return _0x320a83[_0x2ee7('0x1c')](_0x22c4fb);}return _0x320a83[_0x2ee7('0x1d')](_0x22c4fb)[_0x2ee7('0x1e')]();};}function respondWithResult(_0x44c043,_0x3b8b37){_0x3b8b37=_0x3b8b37||0xc8;return function(_0x4f817a){if(_0x4f817a){return _0x44c043['status'](_0x3b8b37)[_0x2ee7('0x1f')](_0x4f817a);}};}function respondWithFilteredResult(_0xc8eab9,_0x23b21d){return function(_0x21e53f){if(_0x21e53f){var _0x240bbb=typeof _0x23b21d['offset']===_0x2ee7('0x20')&&typeof _0x23b21d[_0x2ee7('0x21')]===_0x2ee7('0x20');var _0x1cb9ef=_0x21e53f[_0x2ee7('0x22')];var _0x35d5b7=_0x240bbb?0x0:_0x23b21d['offset'];var _0x4beae8=_0x240bbb?_0x21e53f['count']:_0x23b21d[_0x2ee7('0x23')]+_0x23b21d['limit'];var _0x12392c;if(_0x4beae8>=_0x1cb9ef){_0x4beae8=_0x1cb9ef;_0x12392c=0xc8;}else{_0x12392c=0xce;}_0xc8eab9[_0x2ee7('0x1d')](_0x12392c);return _0xc8eab9[_0x2ee7('0x24')](_0x2ee7('0x25'),_0x35d5b7+'-'+_0x4beae8+'/'+_0x1cb9ef)[_0x2ee7('0x1f')](_0x21e53f);}return null;};}function patchUpdates(_0x4957da){return function(_0x1ef7f6){try{jsonpatch[_0x2ee7('0x26')](_0x1ef7f6,_0x4957da,!![]);}catch(_0x207f05){return BPromise['reject'](_0x207f05);}return _0x1ef7f6[_0x2ee7('0x27')]();};}function saveUpdates(_0x122b90,_0x39d2da){return function(_0x4dc04e){if(_0x4dc04e){return _0x4dc04e['update'](_0x122b90)['then'](function(_0x23f713){return _0x23f713;});}return null;};}function removeEntity(_0x315264,_0x2398f7){return function(_0x8d1230){if(_0x8d1230){return _0x8d1230[_0x2ee7('0x28')]()['then'](function(){_0x315264[_0x2ee7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509eda,_0xa8147f){return function(_0x2809c9){if(!_0x2809c9){_0x509eda[_0x2ee7('0x1c')](0x194);}return _0x2809c9;};}function handleError(_0x4a45f1,_0x487475){_0x487475=_0x487475||0x1f4;return function(_0x5b99b4){logger['error'](_0x5b99b4['stack']);if(_0x5b99b4['name']){delete _0x5b99b4[_0x2ee7('0x29')];}_0x4a45f1['status'](_0x487475)['send'](_0x5b99b4);};}exports[_0x2ee7('0x2a')]=function(_0x2c1724,_0x2732de){var _0x52c2aa={},_0x26ed96={},_0x2afc84={'count':0x0,'rows':[]};var _0x5029d5=_['map'](db[_0x2ee7('0x2b')][_0x2ee7('0x2c')],function(_0x53bf6a){return{'name':_0x53bf6a[_0x2ee7('0x2d')],'type':_0x53bf6a[_0x2ee7('0x2e')][_0x2ee7('0x2f')]};});_0x26ed96[_0x2ee7('0x30')]=_[_0x2ee7('0x31')](_0x5029d5,_0x2ee7('0x29'));_0x26ed96[_0x2ee7('0x32')]=_['keys'](_0x2c1724[_0x2ee7('0x32')]);_0x26ed96[_0x2ee7('0x33')]=_[_0x2ee7('0x34')](_0x26ed96[_0x2ee7('0x30')],_0x26ed96[_0x2ee7('0x32')]);_0x52c2aa['attributes']=_[_0x2ee7('0x34')](_0x26ed96[_0x2ee7('0x30')],qs['fields'](_0x2c1724['query'][_0x2ee7('0x35')]));_0x52c2aa['attributes']=_0x52c2aa['attributes']['length']?_0x52c2aa[_0x2ee7('0x36')]:_0x26ed96[_0x2ee7('0x30')];if(!_0x2c1724['query'][_0x2ee7('0x37')](_0x2ee7('0x38'))){_0x52c2aa[_0x2ee7('0x21')]=qs['limit'](_0x2c1724[_0x2ee7('0x32')]['limit']);_0x52c2aa[_0x2ee7('0x23')]=qs[_0x2ee7('0x23')](_0x2c1724[_0x2ee7('0x32')][_0x2ee7('0x23')]);}_0x52c2aa[_0x2ee7('0x39')]=qs[_0x2ee7('0x3a')](_0x2c1724[_0x2ee7('0x32')]['sort']);_0x52c2aa[_0x2ee7('0x3b')]=qs['filters'](_[_0x2ee7('0x3c')](_0x2c1724[_0x2ee7('0x32')],_0x26ed96[_0x2ee7('0x33')]),_0x5029d5);if(_0x2c1724[_0x2ee7('0x32')][_0x2ee7('0x3d')]){_0x52c2aa['where']=_['merge'](_0x52c2aa[_0x2ee7('0x3b')],{'$or':_[_0x2ee7('0x31')](_0x5029d5,function(_0x563349){if(_0x563349[_0x2ee7('0x2e')]!==_0x2ee7('0x3e')){var _0x2b4bc={};_0x2b4bc[_0x563349[_0x2ee7('0x29')]]={'$like':'%'+_0x2c1724[_0x2ee7('0x32')][_0x2ee7('0x3d')]+'%'};return _0x2b4bc;}})});}_0x52c2aa=_[_0x2ee7('0x3f')]({},_0x52c2aa,_0x2c1724['options']);var _0x5c42a0={'where':_0x52c2aa['where']};return db[_0x2ee7('0x2b')][_0x2ee7('0x22')](_0x5c42a0)[_0x2ee7('0x40')](function(_0x403096){_0x2afc84[_0x2ee7('0x22')]=_0x403096;if(_0x2c1724[_0x2ee7('0x32')]['includeAll']){_0x52c2aa['include']=[{'all':!![]}];}return db[_0x2ee7('0x2b')]['findAll'](_0x52c2aa);})[_0x2ee7('0x40')](function(_0x4885f6){_0x2afc84[_0x2ee7('0x41')]=_0x4885f6;return _0x2afc84;})[_0x2ee7('0x40')](respondWithFilteredResult(_0x2732de,_0x52c2aa))[_0x2ee7('0x42')](handleError(_0x2732de,null));};exports[_0x2ee7('0x43')]=function(_0xe8b30f,_0x491022){var _0x212344={'raw':!![],'where':{'id':_0xe8b30f[_0x2ee7('0x44')]['id']}},_0x3bf096={};_0x3bf096[_0x2ee7('0x30')]=_['keys'](db['ChatGroup'][_0x2ee7('0x2c')]);_0x3bf096['query']=_[_0x2ee7('0x45')](_0xe8b30f['query']);_0x3bf096[_0x2ee7('0x33')]=_[_0x2ee7('0x34')](_0x3bf096[_0x2ee7('0x30')],_0x3bf096[_0x2ee7('0x32')]);_0x212344['attributes']=_['intersection'](_0x3bf096[_0x2ee7('0x30')],qs[_0x2ee7('0x35')](_0xe8b30f[_0x2ee7('0x32')][_0x2ee7('0x35')]));_0x212344[_0x2ee7('0x36')]=_0x212344['attributes']['length']?_0x212344['attributes']:_0x3bf096[_0x2ee7('0x30')];if(_0xe8b30f[_0x2ee7('0x32')][_0x2ee7('0x46')]){_0x212344[_0x2ee7('0x47')]=[{'all':!![]}];}_0x212344=_[_0x2ee7('0x3f')]({},_0x212344,_0xe8b30f[_0x2ee7('0x48')]);return db['ChatGroup']['find'](_0x212344)['then'](handleEntityNotFound(_0x491022,null))[_0x2ee7('0x40')](respondWithResult(_0x491022,null))[_0x2ee7('0x42')](handleError(_0x491022,null));};exports['create']=function(_0x51954a,_0x58d45b){return db['ChatGroup'][_0x2ee7('0x49')](_0x51954a['body'],{})['then'](respondWithResult(_0x58d45b,0xc9))[_0x2ee7('0x42')](handleError(_0x58d45b,null));};exports['update']=function(_0x20db02,_0x3b8812){if(_0x20db02[_0x2ee7('0x4a')]['id']){delete _0x20db02[_0x2ee7('0x4a')]['id'];}return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x20db02['params']['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x3b8812,null))[_0x2ee7('0x40')](saveUpdates(_0x20db02[_0x2ee7('0x4a')],null))[_0x2ee7('0x40')](respondWithResult(_0x3b8812,null))[_0x2ee7('0x42')](handleError(_0x3b8812,null));};exports[_0x2ee7('0x28')]=function(_0x2aac2b,_0x5a21c4){return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x2aac2b[_0x2ee7('0x44')]['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x5a21c4,null))[_0x2ee7('0x40')](removeEntity(_0x5a21c4,null))['catch'](handleError(_0x5a21c4,null));};exports['describe']=function(_0x30dc96,_0x18c911){return db[_0x2ee7('0x2b')][_0x2ee7('0x4c')]()[_0x2ee7('0x40')](respondWithResult(_0x18c911,null))[_0x2ee7('0x42')](handleError(_0x18c911,null));};exports[_0x2ee7('0x4d')]=function(_0x1724ec,_0x515e1e,_0x304652){return db[_0x2ee7('0x4e')][_0x2ee7('0x22')]({'where':{'ChatGroupId':_0x1724ec[_0x2ee7('0x44')]['id'],'ToId':_0x1724ec[_0x2ee7('0x4f')]['id'],'read':![]}})[_0x2ee7('0x40')](function(_0x48ef3d){return{'id':_[_0x2ee7('0x50')](_0x1724ec[_0x2ee7('0x44')]['id']),'count':_0x48ef3d};})[_0x2ee7('0x40')](respondWithResult(_0x515e1e,null))[_0x2ee7('0x42')](handleError(_0x515e1e,null));};exports[_0x2ee7('0x51')]=function(_0x4f439a,_0x1c6264,_0x58c387){return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x4f439a[_0x2ee7('0x44')]['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x1c6264,null))['then'](function(_0x432638){if(_0x432638){return _0x432638[_0x2ee7('0x51')](_0x4f439a[_0x2ee7('0x4a')]['ids'],_[_0x2ee7('0x52')](_0x4f439a[_0x2ee7('0x4a')],[_0x2ee7('0x53'),'id'])||{});}})['then'](respondWithResult(_0x1c6264,null))['catch'](handleError(_0x1c6264,null));};exports[_0x2ee7('0x54')]=function(_0x16bc48,_0x990264,_0x1e974f){var _0x5c76a4={};var _0x47295a={};var _0x206126;var _0x361a0e;return db[_0x2ee7('0x2b')][_0x2ee7('0x55')]({'where':{'id':_0x16bc48[_0x2ee7('0x44')]['id']}})['then'](handleEntityNotFound(_0x990264,null))[_0x2ee7('0x40')](function(_0x29787f){if(_0x29787f){_0x206126=_0x29787f;_0x47295a[_0x2ee7('0x30')]=_[_0x2ee7('0x45')](db[_0x2ee7('0x56')][_0x2ee7('0x2c')]);_0x47295a[_0x2ee7('0x32')]=_[_0x2ee7('0x45')](_0x16bc48['query']);_0x47295a['filters']=_['intersection'](_0x47295a[_0x2ee7('0x30')],_0x47295a['query']);_0x5c76a4['attributes']=_[_0x2ee7('0x34')](_0x47295a[_0x2ee7('0x30')],qs[_0x2ee7('0x35')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x35')]));_0x5c76a4[_0x2ee7('0x36')]=_0x5c76a4[_0x2ee7('0x36')]['length']?_0x5c76a4['attributes']:_0x47295a[_0x2ee7('0x30')];_0x5c76a4[_0x2ee7('0x39')]=qs[_0x2ee7('0x3a')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x3a')]);_0x5c76a4[_0x2ee7('0x3b')]=qs['filters'](_[_0x2ee7('0x3c')](_0x16bc48['query'],_0x47295a[_0x2ee7('0x33')]));if(_0x16bc48['query'][_0x2ee7('0x3d')]){_0x5c76a4[_0x2ee7('0x3b')]=_[_0x2ee7('0x3f')](_0x5c76a4[_0x2ee7('0x3b')],{'$or':_['map'](_0x5c76a4[_0x2ee7('0x36')],function(_0x30d239){var _0x58f4ac={};_0x58f4ac[_0x30d239]={'$like':'%'+_0x16bc48[_0x2ee7('0x32')]['filter']+'%'};return _0x58f4ac;})});}_0x5c76a4=_[_0x2ee7('0x3f')]({},_0x5c76a4,_0x16bc48[_0x2ee7('0x48')]);return _0x206126[_0x2ee7('0x54')](_0x5c76a4);}})[_0x2ee7('0x40')](function(_0xb12692){if(_0xb12692){_0x361a0e=_0xb12692['length'];if(!_0x16bc48['query']['hasOwnProperty'](_0x2ee7('0x38'))){_0x5c76a4['limit']=qs[_0x2ee7('0x21')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x21')]);_0x5c76a4[_0x2ee7('0x23')]=qs[_0x2ee7('0x23')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x23')]);}return _0x206126['getMembers'](_0x5c76a4);}})['then'](function(_0x3231b5){if(_0x3231b5){return _0x3231b5?{'count':_0x361a0e,'rows':_0x3231b5}:null;}})[_0x2ee7('0x40')](respondWithResult(_0x990264,null))['catch'](handleError(_0x990264,null));};exports[_0x2ee7('0x57')]=function(_0x39d5fb,_0x4b7e08,_0x1feb6f){return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x39d5fb[_0x2ee7('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b7e08,null))['then'](function(_0x5cd504){if(_0x5cd504){return _0x5cd504['removeMembers'](_0x39d5fb[_0x2ee7('0x32')][_0x2ee7('0x53')]);}})[_0x2ee7('0x40')](respondWithStatusCode(_0x4b7e08,null))[_0x2ee7('0x42')](handleError(_0x4b7e08,null));};exports['addMessage']=function(_0x361705,_0x190b85,_0x40d065){if(_0x361705['body']['id']){delete _0x361705[_0x2ee7('0x4a')]['id'];}return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x361705[_0x2ee7('0x44')]['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x190b85,null))['then'](function(_0x3eb5c1){if(_0x3eb5c1){_0x361705[_0x2ee7('0x4a')][_0x2ee7('0x58')]=_0x3eb5c1['id'];return db[_0x2ee7('0x4e')][_0x2ee7('0x49')](_0x361705[_0x2ee7('0x4a')]);}})[_0x2ee7('0x40')](respondWithResult(_0x190b85,null))[_0x2ee7('0x42')](handleError(_0x190b85,null));};exports[_0x2ee7('0x59')]=function(_0x13e50b,_0x292a4c,_0x1817d5){var _0x257fc0={};var _0x5876fb={};var _0x1e0936;var _0x309631;return db['ChatGroup'][_0x2ee7('0x55')]({'where':{'id':_0x13e50b[_0x2ee7('0x44')]['id']}})['then'](handleEntityNotFound(_0x292a4c,null))[_0x2ee7('0x40')](function(_0x4e8c89){if(_0x4e8c89){_0x1e0936=_0x4e8c89;_0x5876fb['model']=_[_0x2ee7('0x45')](db[_0x2ee7('0x4e')][_0x2ee7('0x2c')]);_0x5876fb[_0x2ee7('0x32')]=_[_0x2ee7('0x45')](_0x13e50b['query']);_0x5876fb['filters']=_['intersection'](_0x5876fb['model'],_0x5876fb['query']);_0x257fc0[_0x2ee7('0x36')]=_[_0x2ee7('0x34')](_0x5876fb[_0x2ee7('0x30')],qs[_0x2ee7('0x35')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x35')]));_0x257fc0[_0x2ee7('0x36')]=_0x257fc0[_0x2ee7('0x36')][_0x2ee7('0x5a')]?_0x257fc0['attributes']:_0x5876fb[_0x2ee7('0x30')];_0x257fc0[_0x2ee7('0x39')]=qs[_0x2ee7('0x3a')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x3a')]);_0x257fc0[_0x2ee7('0x3b')]=qs['filters'](_['pick'](_0x13e50b['query'],_0x5876fb['filters']));if(_0x13e50b['query'][_0x2ee7('0x3d')]){_0x257fc0[_0x2ee7('0x3b')]=_[_0x2ee7('0x3f')](_0x257fc0[_0x2ee7('0x3b')],{'$or':_['map'](_0x257fc0[_0x2ee7('0x36')],function(_0x214108){var _0x3c2a5b={};_0x3c2a5b[_0x214108]={'$like':'%'+_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x3d')]+'%'};return _0x3c2a5b;})});}if(_0x13e50b['query'][_0x2ee7('0x5b')]){var _0x2bd11e=_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x5b')][_0x2ee7('0x5c')](',');var _0x38e560={};_0x38e560[_0x2bd11e[0x0]]={'$gte':moment(_0x2bd11e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x257fc0[_0x2ee7('0x3b')]=_[_0x2ee7('0x3f')](_0x257fc0[_0x2ee7('0x3b')],_0x38e560);}_0x257fc0=_[_0x2ee7('0x3f')]({},_0x257fc0,_0x13e50b['options']);return _0x1e0936[_0x2ee7('0x59')](_0x257fc0);}})[_0x2ee7('0x40')](function(_0x54f7a3){if(_0x54f7a3){_0x309631=_0x54f7a3[_0x2ee7('0x5a')];if(!_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x37')]('nolimit')){_0x257fc0['limit']=qs[_0x2ee7('0x21')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x21')]);_0x257fc0[_0x2ee7('0x23')]=qs[_0x2ee7('0x23')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x23')]);}return _0x1e0936['getMessages'](_0x257fc0);}})[_0x2ee7('0x40')](function(_0x5b8f70){if(_0x5b8f70){return _0x5b8f70?{'count':_0x309631,'rows':_0x5b8f70}:null;}})[_0x2ee7('0x40')](respondWithResult(_0x292a4c,null))[_0x2ee7('0x42')](handleError(_0x292a4c,null));}; \ No newline at end of file +var _0xceb6=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','ChatInternalMessage','toInteger','addMembers','omit','pick','merge','getMembers','hasOwnProperty','removeMembers','ids','addMessage','ChatGroupId','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','request-promise','moment','mustache','sox'];(function(_0x132b3b,_0x30424a){var _0x1c425a=function(_0x3f6093){while(--_0x3f6093){_0x132b3b['push'](_0x132b3b['shift']());}};_0x1c425a(++_0x30424a);}(_0xceb6,0xb3));var _0x6ceb=function(_0x17165a,_0x8641a8){_0x17165a=_0x17165a-0x0;var _0x109de3=_0xceb6[_0x17165a];return _0x109de3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ceb('0x0'));var rp=require(_0x6ceb('0x1'));var moment=require(_0x6ceb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6ceb('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6ceb('0x4'));var csv=require(_0x6ceb('0x5'));var ejs=require(_0x6ceb('0x6'));var fs=require('fs');var fs_extra=require(_0x6ceb('0x7'));var _=require(_0x6ceb('0x8'));var squel=require(_0x6ceb('0x9'));var crypto=require(_0x6ceb('0xa'));var jsforce=require(_0x6ceb('0xb'));var deskjs=require(_0x6ceb('0xc'));var toCsv=require(_0x6ceb('0x5'));var querystring=require(_0x6ceb('0xd'));var Papa=require(_0x6ceb('0xe'));var Redis=require(_0x6ceb('0xf'));var authService=require(_0x6ceb('0x10'));var qs=require(_0x6ceb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ceb('0x12'))(_0x6ceb('0x13'));var utils=require(_0x6ceb('0x14'));var config=require(_0x6ceb('0x15'));var licenseUtil=require(_0x6ceb('0x16'));var db=require(_0x6ceb('0x17'))['db'];config[_0x6ceb('0x18')]=_[_0x6ceb('0x19')](config[_0x6ceb('0x18')],{'host':_0x6ceb('0x1a'),'port':0x18eb});var socket=require(_0x6ceb('0x1b'))(new Redis(config[_0x6ceb('0x18')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x310540,_0x5cc46a){_0x5cc46a=_0x5cc46a||0xcc;return function(_0x53f31c){if(_0x53f31c){return _0x310540['sendStatus'](_0x5cc46a);}return _0x310540[_0x6ceb('0x1c')](_0x5cc46a)[_0x6ceb('0x1d')]();};}function respondWithResult(_0x2dce2f,_0x2cbd8e){_0x2cbd8e=_0x2cbd8e||0xc8;return function(_0x4f827f){if(_0x4f827f){return _0x2dce2f[_0x6ceb('0x1c')](_0x2cbd8e)[_0x6ceb('0x1e')](_0x4f827f);}};}function respondWithFilteredResult(_0x2e4729,_0x4a07bf){return function(_0x3c5ab4){if(_0x3c5ab4){var _0x44c6b1=typeof _0x4a07bf[_0x6ceb('0x1f')]===_0x6ceb('0x20')&&typeof _0x4a07bf[_0x6ceb('0x21')]===_0x6ceb('0x20');var _0x266ef2=_0x3c5ab4[_0x6ceb('0x22')];var _0x4ca3bd=_0x44c6b1?0x0:_0x4a07bf[_0x6ceb('0x1f')];var _0xf18a77=_0x44c6b1?_0x3c5ab4['count']:_0x4a07bf[_0x6ceb('0x1f')]+_0x4a07bf[_0x6ceb('0x21')];var _0xc4c282;if(_0xf18a77>=_0x266ef2){_0xf18a77=_0x266ef2;_0xc4c282=0xc8;}else{_0xc4c282=0xce;}_0x2e4729[_0x6ceb('0x1c')](_0xc4c282);return _0x2e4729['set'](_0x6ceb('0x23'),_0x4ca3bd+'-'+_0xf18a77+'/'+_0x266ef2)[_0x6ceb('0x1e')](_0x3c5ab4);}return null;};}function patchUpdates(_0x26d897){return function(_0x4e4b29){try{jsonpatch[_0x6ceb('0x24')](_0x4e4b29,_0x26d897,!![]);}catch(_0xa56bc){return BPromise[_0x6ceb('0x25')](_0xa56bc);}return _0x4e4b29[_0x6ceb('0x26')]();};}function saveUpdates(_0x3c589c,_0x4aa829){return function(_0x26eb6f){if(_0x26eb6f){return _0x26eb6f[_0x6ceb('0x27')](_0x3c589c)[_0x6ceb('0x28')](function(_0x245b0f){return _0x245b0f;});}return null;};}function removeEntity(_0x595037,_0x5608dd){return function(_0x3678dd){if(_0x3678dd){return _0x3678dd[_0x6ceb('0x29')]()[_0x6ceb('0x28')](function(){_0x595037[_0x6ceb('0x1c')](0xcc)[_0x6ceb('0x1d')]();});}};}function handleEntityNotFound(_0x4db80d,_0x382e37){return function(_0x13d741){if(!_0x13d741){_0x4db80d[_0x6ceb('0x2a')](0x194);}return _0x13d741;};}function handleError(_0x484699,_0x1a2dc5){_0x1a2dc5=_0x1a2dc5||0x1f4;return function(_0x2e4c45){logger[_0x6ceb('0x2b')](_0x2e4c45[_0x6ceb('0x2c')]);if(_0x2e4c45[_0x6ceb('0x2d')]){delete _0x2e4c45['name'];}_0x484699[_0x6ceb('0x1c')](_0x1a2dc5)[_0x6ceb('0x2e')](_0x2e4c45);};}exports[_0x6ceb('0x2f')]=function(_0x2bf13b,_0x5493eb){var _0x8d67a3={},_0x7b62ad={},_0xc885e={'count':0x0,'rows':[]};var _0x190aa7=_[_0x6ceb('0x30')](db[_0x6ceb('0x31')][_0x6ceb('0x32')],function(_0x535dfa){return{'name':_0x535dfa['fieldName'],'type':_0x535dfa[_0x6ceb('0x33')][_0x6ceb('0x34')]};});_0x7b62ad['model']=_[_0x6ceb('0x30')](_0x190aa7,_0x6ceb('0x2d'));_0x7b62ad[_0x6ceb('0x35')]=_[_0x6ceb('0x36')](_0x2bf13b[_0x6ceb('0x35')]);_0x7b62ad[_0x6ceb('0x37')]=_[_0x6ceb('0x38')](_0x7b62ad['model'],_0x7b62ad['query']);_0x8d67a3[_0x6ceb('0x39')]=_[_0x6ceb('0x38')](_0x7b62ad[_0x6ceb('0x3a')],qs[_0x6ceb('0x3b')](_0x2bf13b[_0x6ceb('0x35')][_0x6ceb('0x3b')]));_0x8d67a3[_0x6ceb('0x39')]=_0x8d67a3['attributes']['length']?_0x8d67a3[_0x6ceb('0x39')]:_0x7b62ad['model'];if(!_0x2bf13b['query']['hasOwnProperty'](_0x6ceb('0x3c'))){_0x8d67a3[_0x6ceb('0x21')]=qs[_0x6ceb('0x21')](_0x2bf13b['query'][_0x6ceb('0x21')]);_0x8d67a3[_0x6ceb('0x1f')]=qs[_0x6ceb('0x1f')](_0x2bf13b[_0x6ceb('0x35')]['offset']);}_0x8d67a3[_0x6ceb('0x3d')]=qs[_0x6ceb('0x3e')](_0x2bf13b[_0x6ceb('0x35')]['sort']);_0x8d67a3[_0x6ceb('0x3f')]=qs[_0x6ceb('0x37')](_['pick'](_0x2bf13b[_0x6ceb('0x35')],_0x7b62ad[_0x6ceb('0x37')]),_0x190aa7);if(_0x2bf13b[_0x6ceb('0x35')][_0x6ceb('0x40')]){_0x8d67a3['where']=_['merge'](_0x8d67a3[_0x6ceb('0x3f')],{'$or':_[_0x6ceb('0x30')](_0x190aa7,function(_0x5d6948){if(_0x5d6948[_0x6ceb('0x33')]!==_0x6ceb('0x41')){var _0x255ab4={};_0x255ab4[_0x5d6948[_0x6ceb('0x2d')]]={'$like':'%'+_0x2bf13b[_0x6ceb('0x35')][_0x6ceb('0x40')]+'%'};return _0x255ab4;}})});}_0x8d67a3=_['merge']({},_0x8d67a3,_0x2bf13b[_0x6ceb('0x42')]);var _0x4eef05={'where':_0x8d67a3[_0x6ceb('0x3f')]};return db[_0x6ceb('0x31')][_0x6ceb('0x22')](_0x4eef05)[_0x6ceb('0x28')](function(_0x3169d8){_0xc885e['count']=_0x3169d8;if(_0x2bf13b[_0x6ceb('0x35')][_0x6ceb('0x43')]){_0x8d67a3[_0x6ceb('0x44')]=[{'all':!![]}];}return db['ChatGroup'][_0x6ceb('0x45')](_0x8d67a3);})[_0x6ceb('0x28')](function(_0x3cbe41){_0xc885e['rows']=_0x3cbe41;return _0xc885e;})[_0x6ceb('0x28')](respondWithFilteredResult(_0x5493eb,_0x8d67a3))[_0x6ceb('0x46')](handleError(_0x5493eb,null));};exports[_0x6ceb('0x47')]=function(_0x9b0a57,_0x4937fd){var _0x3fdcdc={'raw':!![],'where':{'id':_0x9b0a57['params']['id']}},_0x3a6050={};_0x3a6050[_0x6ceb('0x3a')]=_[_0x6ceb('0x36')](db['ChatGroup'][_0x6ceb('0x32')]);_0x3a6050[_0x6ceb('0x35')]=_['keys'](_0x9b0a57[_0x6ceb('0x35')]);_0x3a6050['filters']=_[_0x6ceb('0x38')](_0x3a6050[_0x6ceb('0x3a')],_0x3a6050['query']);_0x3fdcdc[_0x6ceb('0x39')]=_[_0x6ceb('0x38')](_0x3a6050['model'],qs['fields'](_0x9b0a57['query'][_0x6ceb('0x3b')]));_0x3fdcdc['attributes']=_0x3fdcdc[_0x6ceb('0x39')][_0x6ceb('0x48')]?_0x3fdcdc[_0x6ceb('0x39')]:_0x3a6050['model'];if(_0x9b0a57[_0x6ceb('0x35')][_0x6ceb('0x43')]){_0x3fdcdc['include']=[{'all':!![]}];}_0x3fdcdc=_['merge']({},_0x3fdcdc,_0x9b0a57['options']);return db[_0x6ceb('0x31')][_0x6ceb('0x49')](_0x3fdcdc)['then'](handleEntityNotFound(_0x4937fd,null))['then'](respondWithResult(_0x4937fd,null))[_0x6ceb('0x46')](handleError(_0x4937fd,null));};exports[_0x6ceb('0x4a')]=function(_0x358bc1,_0x1511c7){return db[_0x6ceb('0x31')][_0x6ceb('0x4a')](_0x358bc1['body'],{})['then'](respondWithResult(_0x1511c7,0xc9))[_0x6ceb('0x46')](handleError(_0x1511c7,null));};exports['update']=function(_0x28448f,_0x1d8747){if(_0x28448f[_0x6ceb('0x4b')]['id']){delete _0x28448f[_0x6ceb('0x4b')]['id'];}return db[_0x6ceb('0x31')][_0x6ceb('0x49')]({'where':{'id':_0x28448f['params']['id']}})['then'](handleEntityNotFound(_0x1d8747,null))[_0x6ceb('0x28')](saveUpdates(_0x28448f['body'],null))[_0x6ceb('0x28')](respondWithResult(_0x1d8747,null))[_0x6ceb('0x46')](handleError(_0x1d8747,null));};exports[_0x6ceb('0x29')]=function(_0x3e9788,_0x17fac8){return db['ChatGroup'][_0x6ceb('0x49')]({'where':{'id':_0x3e9788[_0x6ceb('0x4c')]['id']}})[_0x6ceb('0x28')](handleEntityNotFound(_0x17fac8,null))[_0x6ceb('0x28')](removeEntity(_0x17fac8,null))[_0x6ceb('0x46')](handleError(_0x17fac8,null));};exports['describe']=function(_0x7b8632,_0x5a87c3){return db['ChatGroup']['describe']()['then'](respondWithResult(_0x5a87c3,null))[_0x6ceb('0x46')](handleError(_0x5a87c3,null));};exports['getUnread']=function(_0x558431,_0x2cc34b,_0x5a5d0b){return db[_0x6ceb('0x4d')]['count']({'where':{'ChatGroupId':_0x558431[_0x6ceb('0x4c')]['id'],'ToId':_0x558431['user']['id'],'read':![]}})[_0x6ceb('0x28')](function(_0xb411d2){return{'id':_[_0x6ceb('0x4e')](_0x558431[_0x6ceb('0x4c')]['id']),'count':_0xb411d2};})['then'](respondWithResult(_0x2cc34b,null))[_0x6ceb('0x46')](handleError(_0x2cc34b,null));};exports[_0x6ceb('0x4f')]=function(_0x376c15,_0x55f168,_0x4c2eea){return db[_0x6ceb('0x31')][_0x6ceb('0x49')]({'where':{'id':_0x376c15[_0x6ceb('0x4c')]['id']}})[_0x6ceb('0x28')](handleEntityNotFound(_0x55f168,null))[_0x6ceb('0x28')](function(_0x3023c9){if(_0x3023c9){return _0x3023c9[_0x6ceb('0x4f')](_0x376c15['body']['ids'],_[_0x6ceb('0x50')](_0x376c15[_0x6ceb('0x4b')],['ids','id'])||{});}})[_0x6ceb('0x28')](respondWithResult(_0x55f168,null))[_0x6ceb('0x46')](handleError(_0x55f168,null));};exports['getMembers']=function(_0xef6e91,_0xd41c20,_0x686f87){var _0x3c5cf2={};var _0x19ec03={};var _0xe0dcc2;var _0x427656;return db[_0x6ceb('0x31')]['findOne']({'where':{'id':_0xef6e91[_0x6ceb('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd41c20,null))['then'](function(_0xdb9751){if(_0xdb9751){_0xe0dcc2=_0xdb9751;_0x19ec03[_0x6ceb('0x3a')]=_[_0x6ceb('0x36')](db['User'][_0x6ceb('0x32')]);_0x19ec03[_0x6ceb('0x35')]=_[_0x6ceb('0x36')](_0xef6e91[_0x6ceb('0x35')]);_0x19ec03[_0x6ceb('0x37')]=_[_0x6ceb('0x38')](_0x19ec03[_0x6ceb('0x3a')],_0x19ec03[_0x6ceb('0x35')]);_0x3c5cf2['attributes']=_[_0x6ceb('0x38')](_0x19ec03[_0x6ceb('0x3a')],qs['fields'](_0xef6e91[_0x6ceb('0x35')][_0x6ceb('0x3b')]));_0x3c5cf2[_0x6ceb('0x39')]=_0x3c5cf2['attributes'][_0x6ceb('0x48')]?_0x3c5cf2[_0x6ceb('0x39')]:_0x19ec03['model'];_0x3c5cf2[_0x6ceb('0x3d')]=qs['sort'](_0xef6e91['query'][_0x6ceb('0x3e')]);_0x3c5cf2[_0x6ceb('0x3f')]=qs['filters'](_[_0x6ceb('0x51')](_0xef6e91['query'],_0x19ec03[_0x6ceb('0x37')]));if(_0xef6e91[_0x6ceb('0x35')][_0x6ceb('0x40')]){_0x3c5cf2[_0x6ceb('0x3f')]=_[_0x6ceb('0x52')](_0x3c5cf2['where'],{'$or':_['map'](_0x3c5cf2[_0x6ceb('0x39')],function(_0x5a7797){var _0x4b08fa={};_0x4b08fa[_0x5a7797]={'$like':'%'+_0xef6e91[_0x6ceb('0x35')]['filter']+'%'};return _0x4b08fa;})});}_0x3c5cf2=_[_0x6ceb('0x52')]({},_0x3c5cf2,_0xef6e91[_0x6ceb('0x42')]);return _0xe0dcc2[_0x6ceb('0x53')](_0x3c5cf2);}})['then'](function(_0xf4e8c4){if(_0xf4e8c4){_0x427656=_0xf4e8c4[_0x6ceb('0x48')];if(!_0xef6e91[_0x6ceb('0x35')][_0x6ceb('0x54')](_0x6ceb('0x3c'))){_0x3c5cf2[_0x6ceb('0x21')]=qs[_0x6ceb('0x21')](_0xef6e91[_0x6ceb('0x35')][_0x6ceb('0x21')]);_0x3c5cf2[_0x6ceb('0x1f')]=qs[_0x6ceb('0x1f')](_0xef6e91[_0x6ceb('0x35')]['offset']);}return _0xe0dcc2[_0x6ceb('0x53')](_0x3c5cf2);}})[_0x6ceb('0x28')](function(_0x57b32f){if(_0x57b32f){return _0x57b32f?{'count':_0x427656,'rows':_0x57b32f}:null;}})[_0x6ceb('0x28')](respondWithResult(_0xd41c20,null))[_0x6ceb('0x46')](handleError(_0xd41c20,null));};exports['removeMembers']=function(_0x570c5d,_0x586f9f,_0x30cd5b){return db[_0x6ceb('0x31')][_0x6ceb('0x49')]({'where':{'id':_0x570c5d[_0x6ceb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x586f9f,null))[_0x6ceb('0x28')](function(_0x42ffce){if(_0x42ffce){return _0x42ffce[_0x6ceb('0x55')](_0x570c5d[_0x6ceb('0x35')][_0x6ceb('0x56')]);}})['then'](respondWithStatusCode(_0x586f9f,null))[_0x6ceb('0x46')](handleError(_0x586f9f,null));};exports[_0x6ceb('0x57')]=function(_0x141282,_0x15e57b,_0x16ab74){if(_0x141282[_0x6ceb('0x4b')]['id']){delete _0x141282[_0x6ceb('0x4b')]['id'];}return db[_0x6ceb('0x31')][_0x6ceb('0x49')]({'where':{'id':_0x141282[_0x6ceb('0x4c')]['id']}})[_0x6ceb('0x28')](handleEntityNotFound(_0x15e57b,null))[_0x6ceb('0x28')](function(_0x5d7ca7){if(_0x5d7ca7){_0x141282['body'][_0x6ceb('0x58')]=_0x5d7ca7['id'];return db[_0x6ceb('0x4d')][_0x6ceb('0x4a')](_0x141282[_0x6ceb('0x4b')]);}})[_0x6ceb('0x28')](respondWithResult(_0x15e57b,null))[_0x6ceb('0x46')](handleError(_0x15e57b,null));};exports[_0x6ceb('0x59')]=function(_0x36658e,_0x1011f4,_0x386f7f){var _0x5abeea={};var _0x1d245b={};var _0xf5950a;var _0x1ddf3d;return db['ChatGroup']['findOne']({'where':{'id':_0x36658e[_0x6ceb('0x4c')]['id']}})[_0x6ceb('0x28')](handleEntityNotFound(_0x1011f4,null))[_0x6ceb('0x28')](function(_0x2066f9){if(_0x2066f9){_0xf5950a=_0x2066f9;_0x1d245b[_0x6ceb('0x3a')]=_[_0x6ceb('0x36')](db['ChatInternalMessage']['rawAttributes']);_0x1d245b[_0x6ceb('0x35')]=_[_0x6ceb('0x36')](_0x36658e[_0x6ceb('0x35')]);_0x1d245b[_0x6ceb('0x37')]=_[_0x6ceb('0x38')](_0x1d245b[_0x6ceb('0x3a')],_0x1d245b[_0x6ceb('0x35')]);_0x5abeea[_0x6ceb('0x39')]=_['intersection'](_0x1d245b[_0x6ceb('0x3a')],qs[_0x6ceb('0x3b')](_0x36658e[_0x6ceb('0x35')][_0x6ceb('0x3b')]));_0x5abeea[_0x6ceb('0x39')]=_0x5abeea[_0x6ceb('0x39')][_0x6ceb('0x48')]?_0x5abeea[_0x6ceb('0x39')]:_0x1d245b[_0x6ceb('0x3a')];_0x5abeea['order']=qs['sort'](_0x36658e['query'][_0x6ceb('0x3e')]);_0x5abeea[_0x6ceb('0x3f')]=qs[_0x6ceb('0x37')](_['pick'](_0x36658e['query'],_0x1d245b[_0x6ceb('0x37')]));if(_0x36658e['query'][_0x6ceb('0x40')]){_0x5abeea[_0x6ceb('0x3f')]=_[_0x6ceb('0x52')](_0x5abeea['where'],{'$or':_[_0x6ceb('0x30')](_0x5abeea[_0x6ceb('0x39')],function(_0x1b03d0){var _0x4e940b={};_0x4e940b[_0x1b03d0]={'$like':'%'+_0x36658e[_0x6ceb('0x35')][_0x6ceb('0x40')]+'%'};return _0x4e940b;})});}if(_0x36658e[_0x6ceb('0x35')]['$gte']){var _0xfcd9cb=_0x36658e[_0x6ceb('0x35')]['$gte']['split'](',');var _0x9abcc8={};_0x9abcc8[_0xfcd9cb[0x0]]={'$gte':moment(_0xfcd9cb[0x1])[_0x6ceb('0x5a')](_0x6ceb('0x5b'))};_0x5abeea[_0x6ceb('0x3f')]=_[_0x6ceb('0x52')](_0x5abeea['where'],_0x9abcc8);}_0x5abeea=_[_0x6ceb('0x52')]({},_0x5abeea,_0x36658e[_0x6ceb('0x42')]);return _0xf5950a[_0x6ceb('0x59')](_0x5abeea);}})[_0x6ceb('0x28')](function(_0x446559){if(_0x446559){_0x1ddf3d=_0x446559[_0x6ceb('0x48')];if(!_0x36658e[_0x6ceb('0x35')]['hasOwnProperty'](_0x6ceb('0x3c'))){_0x5abeea[_0x6ceb('0x21')]=qs[_0x6ceb('0x21')](_0x36658e[_0x6ceb('0x35')]['limit']);_0x5abeea[_0x6ceb('0x1f')]=qs['offset'](_0x36658e[_0x6ceb('0x35')]['offset']);}return _0xf5950a[_0x6ceb('0x59')](_0x5abeea);}})[_0x6ceb('0x28')](function(_0x51d7e5){if(_0x51d7e5){return _0x51d7e5?{'count':_0x1ddf3d,'rows':_0x51d7e5}:null;}})[_0x6ceb('0x28')](respondWithResult(_0x1011f4,null))[_0x6ceb('0x46')](handleError(_0x1011f4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index a5c1178..300b81e 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 _0x83d4=['hasOwnProperty','hook','exports','events','setMaxListeners','update','emit'];(function(_0x20115d,_0x1a193f){var _0x49958b=function(_0x14b604){while(--_0x14b604){_0x20115d['push'](_0x20115d['shift']());}};_0x49958b(++_0x1a193f);}(_0x83d4,0xf1));var _0x483d=function(_0x4f92eb,_0x1237a4){_0x4f92eb=_0x4f92eb-0x0;var _0x2e7f4f=_0x83d4[_0x4f92eb];return _0x2e7f4f;};'use strict';var EventEmitter=require(_0x483d('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x483d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x483d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x838b4c){return function(_0x447f73,_0x224829,_0x1e1c37){ChatGroupEvents[_0x483d('0x3')](_0x838b4c+':'+_0x447f73['id'],_0x447f73);ChatGroupEvents['emit'](_0x838b4c,_0x447f73);_0x1e1c37(null);};}for(var e in events){if(events[_0x483d('0x4')](e)){var event=events[e];ChatGroup[_0x483d('0x5')](e,emitEvent(event));}}module[_0x483d('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x2905=['update','remove','emit','exports','events','../../mysqldb','ChatGroup','save'];(function(_0x491f4b,_0x3b0baa){var _0x34fcf0=function(_0xa83cc0){while(--_0xa83cc0){_0x491f4b['push'](_0x491f4b['shift']());}};_0x34fcf0(++_0x3b0baa);}(_0x2905,0x19c));var _0x5290=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2905[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x5290('0x0'));var ChatGroup=require(_0x5290('0x1'))['db'][_0x5290('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5290('0x3'),'afterUpdate':_0x5290('0x4'),'afterDestroy':_0x5290('0x5')};function emitEvent(_0x8f2404){return function(_0x313bbe,_0x4c09d8,_0x223a29){ChatGroupEvents[_0x5290('0x6')](_0x8f2404+':'+_0x313bbe['id'],_0x313bbe);ChatGroupEvents[_0x5290('0x6')](_0x8f2404,_0x313bbe);_0x223a29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x5290('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c19b10c..cc2570f 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 _0x7918=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define','ChatGroup'];(function(_0x5bee28,_0x1dc7e2){var _0x395d1d=function(_0x33af90){while(--_0x33af90){_0x5bee28['push'](_0x5bee28['shift']());}};_0x395d1d(++_0x1dc7e2);}(_0x7918,0x11e));var _0x8791=function(_0x10bc04,_0x669fa5){_0x10bc04=_0x10bc04-0x0;var _0x1fd6de=_0x7918[_0x10bc04];return _0x1fd6de;};'use strict';var _=require(_0x8791('0x0'));var util=require(_0x8791('0x1'));var logger=require('../../config/logger')(_0x8791('0x2'));var moment=require(_0x8791('0x3'));var BPromise=require(_0x8791('0x4'));var rp=require(_0x8791('0x5'));var fs=require('fs');var path=require(_0x8791('0x6'));var rimraf=require(_0x8791('0x7'));var config=require('../../config/environment');var attributes=require(_0x8791('0x8'));module['exports']=function(_0x354f76,_0x81d64){return _0x354f76[_0x8791('0x9')](_0x8791('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe29a=['bluebird','request-promise','path','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','api','moment'];(function(_0x1107ed,_0x292041){var _0x3ae7f7=function(_0x426b7d){while(--_0x426b7d){_0x1107ed['push'](_0x1107ed['shift']());}};_0x3ae7f7(++_0x292041);}(_0xe29a,0x1b4));var _0xae29=function(_0x2e8abc,_0xe408ae){_0x2e8abc=_0x2e8abc-0x0;var _0x1e7a8e=_0xe29a[_0x2e8abc];return _0x1e7a8e;};'use strict';var _=require(_0xae29('0x0'));var util=require(_0xae29('0x1'));var logger=require('../../config/logger')(_0xae29('0x2'));var moment=require(_0xae29('0x3'));var BPromise=require(_0xae29('0x4'));var rp=require(_0xae29('0x5'));var fs=require('fs');var path=require(_0xae29('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae29('0x7'));module[_0xae29('0x8')]=function(_0x1c7e2c,_0x409188){return _0x1c7e2c['define'](_0xae29('0x9'),attributes,{'tableName':_0xae29('0xa'),'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 3c206ef..48a19b1 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 _0x1134=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x3bba57,_0x440aad){var _0x1f13b7=function(_0x8ec7f6){while(--_0x8ec7f6){_0x3bba57['push'](_0x3bba57['shift']());}};_0x1f13b7(++_0x440aad);}(_0x1134,0x19c));var _0x4113=function(_0x342386,_0x369070){_0x342386=_0x342386-0x0;var _0x29616c=_0x1134[_0x342386];return _0x29616c;};'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});config['redis']=_[_0x4113('0x9')](config[_0x4113('0xa')],{'host':_0x4113('0xb'),'port':0x18eb});var socket=require(_0x4113('0xc'))(new Redis(config[_0x4113('0xa')]));require(_0x4113('0xd'))[_0x4113('0xe')](socket);function respondWithRpcPromise(_0x19b6f2,_0x5e635c,_0x85a9dd){return new BPromise(function(_0x207442,_0x29c7f9){return client[_0x4113('0xf')](_0x19b6f2,_0x85a9dd)[_0x4113('0x10')](function(_0x30f02a){logger[_0x4113('0x11')](_0x4113('0x12'),_0x5e635c,_0x4113('0x13'));logger[_0x4113('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5e635c,'request\x20sent',JSON['stringify'](_0x30f02a));if(_0x30f02a[_0x4113('0x15')]){if(_0x30f02a[_0x4113('0x15')]['code']===0x1f4){logger['error'](_0x4113('0x12'),_0x5e635c,_0x30f02a['error'][_0x4113('0x16')]);return _0x29c7f9(_0x30f02a['error']['message']);}logger[_0x4113('0x15')](_0x4113('0x12'),_0x5e635c,_0x30f02a[_0x4113('0x15')][_0x4113('0x16')]);return _0x207442(_0x30f02a[_0x4113('0x15')][_0x4113('0x16')]);}else{logger[_0x4113('0x11')](_0x4113('0x12'),_0x5e635c,_0x4113('0x13'));_0x207442(_0x30f02a[_0x4113('0x17')]['message']);}})[_0x4113('0x18')](function(_0x287efd){logger[_0x4113('0x15')](_0x4113('0x12'),_0x5e635c,_0x287efd);_0x29c7f9(_0x287efd);});});} \ No newline at end of file +var _0xec46=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','catch','lodash','util','moment','bluebird'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xec46,0x19c));var _0x6ec4=function(_0x357979,_0x56feef){_0x357979=_0x357979-0x0;var _0xabb42f=_0xec46[_0x357979];return _0xabb42f;};'use strict';var _=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var moment=require(_0x6ec4('0x2'));var BPromise=require(_0x6ec4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ec4('0x4'))['db'];var utils=require(_0x6ec4('0x5'));var logger=require(_0x6ec4('0x6'))('rpc');var config=require(_0x6ec4('0x7'));var jayson=require(_0x6ec4('0x8'));var client=jayson['client'][_0x6ec4('0x9')]({'port':0x232a});config['redis']=_[_0x6ec4('0xa')](config[_0x6ec4('0xb')],{'host':_0x6ec4('0xc'),'port':0x18eb});var socket=require(_0x6ec4('0xd'))(new Redis(config[_0x6ec4('0xb')]));require(_0x6ec4('0xe'))[_0x6ec4('0xf')](socket);function respondWithRpcPromise(_0x164b81,_0x5e8746,_0x259d07){return new BPromise(function(_0xe51f56,_0x47bfaa){return client['request'](_0x164b81,_0x259d07)[_0x6ec4('0x10')](function(_0x45f738){logger[_0x6ec4('0x11')]('ChatGroup,\x20%s,\x20%s',_0x5e8746,_0x6ec4('0x12'));logger['debug'](_0x6ec4('0x13'),_0x5e8746,'request\x20sent',JSON[_0x6ec4('0x14')](_0x45f738));if(_0x45f738[_0x6ec4('0x15')]){if(_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x16')]===0x1f4){logger[_0x6ec4('0x15')]('ChatGroup,\x20%s,\x20%s',_0x5e8746,_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);return _0x47bfaa(_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);}logger[_0x6ec4('0x15')](_0x6ec4('0x18'),_0x5e8746,_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);return _0xe51f56(_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);}else{logger[_0x6ec4('0x11')]('ChatGroup,\x20%s,\x20%s',_0x5e8746,_0x6ec4('0x12'));_0xe51f56(_0x45f738['result']['message']);}})[_0x6ec4('0x19')](function(_0x49594b){logger[_0x6ec4('0x15')](_0x6ec4('0x18'),_0x5e8746,_0x49594b);_0x47bfaa(_0x49594b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 487832d..cdd180f 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 _0x7581=['./chatGroup.events','remove','update','emit','removeListener','length','chatGroup:'];(function(_0x34368f,_0x27ca25){var _0x3ffc70=function(_0x5c27c5){while(--_0x5c27c5){_0x34368f['push'](_0x34368f['shift']());}};_0x3ffc70(++_0x27ca25);}(_0x7581,0x1ce));var _0x1758=function(_0x24a819,_0x33eb25){_0x24a819=_0x24a819-0x0;var _0xbd47fd=_0x7581[_0x24a819];return _0xbd47fd;};'use strict';var ChatGroupEvents=require(_0x1758('0x0'));var events=['save',_0x1758('0x1'),_0x1758('0x2')];function createListener(_0x556d20,_0x2fe42f){return function(_0x5433b9){_0x2fe42f[_0x1758('0x3')](_0x556d20,_0x5433b9);};}function removeListener(_0x3d7937,_0xb78f3f){return function(){ChatGroupEvents[_0x1758('0x4')](_0x3d7937,_0xb78f3f);};}exports['register']=function(_0x3f329d){for(var _0x4fb467=0x0,_0x1f9dd3=events[_0x1758('0x5')];_0x4fb467<_0x1f9dd3;_0x4fb467++){var _0x311198=events[_0x4fb467];var _0x672a73=createListener(_0x1758('0x6')+_0x311198,_0x3f329d);ChatGroupEvents['on'](_0x311198,_0x672a73);}}; \ No newline at end of file +var _0x5539=['emit','register','chatGroup:','./chatGroup.events','save','remove'];(function(_0x373d92,_0x35a07f){var _0x2fd989=function(_0x48f986){while(--_0x48f986){_0x373d92['push'](_0x373d92['shift']());}};_0x2fd989(++_0x35a07f);}(_0x5539,0x141));var _0x9553=function(_0x533643,_0x2fd320){_0x533643=_0x533643-0x0;var _0x158b07=_0x5539[_0x533643];return _0x158b07;};'use strict';var ChatGroupEvents=require(_0x9553('0x0'));var events=[_0x9553('0x1'),_0x9553('0x2'),'update'];function createListener(_0x5309b0,_0x5f3698){return function(_0x1d2cc4){_0x5f3698[_0x9553('0x3')](_0x5309b0,_0x1d2cc4);};}function removeListener(_0x9c4bb1,_0x1999a0){return function(){ChatGroupEvents['removeListener'](_0x9c4bb1,_0x1999a0);};}exports[_0x9553('0x4')]=function(_0x38bc9e){for(var _0x11135c=0x0,_0x19da57=events['length'];_0x11135c<_0x19da57;_0x11135c++){var _0x5e78bc=events[_0x11135c];var _0x3e3d45=createListener(_0x9553('0x5')+_0x5e78bc,_0x38bc9e);ChatGroupEvents['on'](_0x5e78bc,_0x3e3d45);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 40e4a0d..23d2a7e 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 _0xe729=['isAuthenticated','/:id','show','/:id/unread','/:id/members','/:id/messages','post','create','addMembers','addMessage','put','delete','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe729,0x160));var _0x9e72=function(_0xb65eb5,_0x5601db){_0xb65eb5=_0xb65eb5-0x0;var _0x41359b=_0xe729[_0xb65eb5];return _0x41359b;};'use strict';var multer=require(_0x9e72('0x0'));var util=require(_0x9e72('0x1'));var path=require(_0x9e72('0x2'));var timeout=require(_0x9e72('0x3'));var express=require(_0x9e72('0x4'));var router=express['Router']();var fs_extra=require(_0x9e72('0x5'));var auth=require(_0x9e72('0x6'));var interaction=require(_0x9e72('0x7'));var config=require(_0x9e72('0x8'));var controller=require(_0x9e72('0x9'));router[_0x9e72('0xa')]('/',auth['isAuthenticated'](),controller[_0x9e72('0xb')]);router[_0x9e72('0xa')]('/describe',auth[_0x9e72('0xc')](),controller['describe']);router[_0x9e72('0xa')](_0x9e72('0xd'),auth[_0x9e72('0xc')](),controller[_0x9e72('0xe')]);router[_0x9e72('0xa')](_0x9e72('0xf'),auth[_0x9e72('0xc')](),controller['getUnread']);router[_0x9e72('0xa')](_0x9e72('0x10'),auth[_0x9e72('0xc')](),controller['getMembers']);router[_0x9e72('0xa')](_0x9e72('0x11'),auth[_0x9e72('0xc')](),controller['getMessages']);router[_0x9e72('0x12')]('/',auth[_0x9e72('0xc')](),controller[_0x9e72('0x13')]);router[_0x9e72('0x12')]('/:id/members',auth[_0x9e72('0xc')](),controller[_0x9e72('0x14')]);router['post'](_0x9e72('0x11'),auth[_0x9e72('0xc')](),controller[_0x9e72('0x15')]);router[_0x9e72('0x16')]('/:id',auth[_0x9e72('0xc')](),controller['update']);router[_0x9e72('0x17')](_0x9e72('0xd'),auth[_0x9e72('0xc')](),controller['destroy']);router['delete'](_0x9e72('0x10'),auth[_0x9e72('0xc')](),controller[_0x9e72('0x18')]);module[_0x9e72('0x19')]=router; \ No newline at end of file +var _0xc207=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','put','update','delete','destroy','removeMembers','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2afa7d,_0x1591f0){var _0x2a781d=function(_0x4b82bc){while(--_0x4b82bc){_0x2afa7d['push'](_0x2afa7d['shift']());}};_0x2a781d(++_0x1591f0);}(_0xc207,0x79));var _0x7c20=function(_0x1bc95c,_0x109aec){_0x1bc95c=_0x1bc95c-0x0;var _0x1a9fdc=_0xc207[_0x1bc95c];return _0x1a9fdc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7c20('0x0'));var express=require(_0x7c20('0x1'));var router=express[_0x7c20('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7c20('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7c20('0x4'));var controller=require(_0x7c20('0x5'));router[_0x7c20('0x6')]('/',auth[_0x7c20('0x7')](),controller[_0x7c20('0x8')]);router['get'](_0x7c20('0x9'),auth[_0x7c20('0x7')](),controller['describe']);router[_0x7c20('0x6')](_0x7c20('0xa'),auth['isAuthenticated'](),controller[_0x7c20('0xb')]);router[_0x7c20('0x6')]('/:id/unread',auth['isAuthenticated'](),controller[_0x7c20('0xc')]);router[_0x7c20('0x6')](_0x7c20('0xd'),auth[_0x7c20('0x7')](),controller[_0x7c20('0xe')]);router[_0x7c20('0x6')](_0x7c20('0xf'),auth[_0x7c20('0x7')](),controller[_0x7c20('0x10')]);router['post']('/',auth[_0x7c20('0x7')](),controller[_0x7c20('0x11')]);router['post'](_0x7c20('0xd'),auth[_0x7c20('0x7')](),controller['addMembers']);router[_0x7c20('0x12')](_0x7c20('0xf'),auth[_0x7c20('0x7')](),controller['addMessage']);router[_0x7c20('0x13')](_0x7c20('0xa'),auth[_0x7c20('0x7')](),controller[_0x7c20('0x14')]);router[_0x7c20('0x15')](_0x7c20('0xa'),auth[_0x7c20('0x7')](),controller[_0x7c20('0x16')]);router[_0x7c20('0x15')](_0x7c20('0xd'),auth['isAuthenticated'](),controller[_0x7c20('0x17')]);module[_0x7c20('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 43da563..9a5f0be 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 _0x12e5=['star','TEXT','DATE','STRING','long','out','exports','BOOLEAN','INTEGER','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x12e5,0x100));var _0x512e=function(_0x45212,_0xa6803){_0x45212=_0x45212-0x0;var _0x42437a=_0x12e5[_0x45212];return _0x42437a;};'use strict';var Sequelize=require('sequelize');module[_0x512e('0x0')]={'closed':{'type':Sequelize[_0x512e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x512e('0x2')]},'ratingType':{'type':Sequelize[_0x512e('0x3')]('star','thumb'),'defaultValue':_0x512e('0x4')},'ratingMessage':{'type':Sequelize[_0x512e('0x5')]},'pathTranscript':{'type':Sequelize[_0x512e('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x512e('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x512e('0x7')]},'thirdDisposition':{'type':Sequelize[_0x512e('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x512e('0x7')]},'browserVersion':{'type':Sequelize[_0x512e('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x512e('0x7')]},'deviceModel':{'type':Sequelize[_0x512e('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x512e('0x7')]},'referer':{'type':Sequelize[_0x512e('0x5')]},'customerIp':{'type':Sequelize[_0x512e('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x512e('0x8'))},'read1stAt':{'type':Sequelize[_0x512e('0x6')]},'lastMsgAt':{'type':Sequelize[_0x512e('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x512e('0x3')]('in',_0x512e('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x512e('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x512e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x512e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x512e('0x2')]}}; \ No newline at end of file +var _0xfff1=['TEXT','STRING','DATE','long','ENUM','out','exports','BOOLEAN','star','thumb'];(function(_0x1d1a90,_0x40f97){var _0x36fc75=function(_0x984dfe){while(--_0x984dfe){_0x1d1a90['push'](_0x1d1a90['shift']());}};_0x36fc75(++_0x40f97);}(_0xfff1,0x150));var _0x1fff=function(_0x536216,_0xdcc088){_0x536216=_0x536216-0x0;var _0x2a2a25=_0xfff1[_0x536216];return _0x2a2a25;};'use strict';var Sequelize=require('sequelize');module[_0x1fff('0x0')]={'closed':{'type':Sequelize[_0x1fff('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x1fff('0x2'),_0x1fff('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1fff('0x4')]},'pathTranscript':{'type':Sequelize[_0x1fff('0x4')]},'mailTranscript':{'type':Sequelize[_0x1fff('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1fff('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1fff('0x5')]},'thirdDisposition':{'type':Sequelize[_0x1fff('0x5')]},'note':{'type':Sequelize[_0x1fff('0x5')]},'browserName':{'type':Sequelize[_0x1fff('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x1fff('0x5')]},'osVersion':{'type':Sequelize[_0x1fff('0x5')]},'deviceModel':{'type':Sequelize[_0x1fff('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x1fff('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x1fff('0x7'))},'read1stAt':{'type':Sequelize[_0x1fff('0x6')]},'lastMsgAt':{'type':Sequelize[_0x1fff('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x1fff('0x8')]('in',_0x1fff('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1fff('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x1fff('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x1fff('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 84c4d4f..483e7b1 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 _0x2e9b=['query','model','keys','filters','intersection','fields','attributes','length','find','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','user','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','User','UserId','format','%s%d','agentAlias','Visitor','ContactId','agentIdentifier','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','hasOwnProperty','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','nolimit','include','includeAgent','push','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','firstName','lastName','secret','read','Account','get','mkdirSync','Chat','Owner','N.A.','disposition','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','index','map','ChatInteraction','rawAttributes','type','getOptions','findAll','chat'];(function(_0x36765e,_0x14ed23){var _0x5e33b8=function(_0x3a84d3){while(--_0x3a84d3){_0x36765e['push'](_0x36765e['shift']());}};_0x5e33b8(++_0x14ed23);}(_0x2e9b,0x167));var _0xb2e9=function(_0x37a7e9,_0x4bb5aa){_0x37a7e9=_0x37a7e9-0x0;var _0x50e838=_0x2e9b[_0x37a7e9];return _0x50e838;};'use strict';var rimraf=require(_0xb2e9('0x0'));var zipdir=require(_0xb2e9('0x1'));var rp=require('request-promise');var moment=require(_0xb2e9('0x2'));var BPromise=require(_0xb2e9('0x3'));var Mustache=require(_0xb2e9('0x4'));var util=require(_0xb2e9('0x5'));var path=require(_0xb2e9('0x6'));var ejs=require(_0xb2e9('0x7'));var fs=require('fs');var _=require(_0xb2e9('0x8'));var Redis=require(_0xb2e9('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0xb2e9('0xa'));var pdf=require(_0xb2e9('0xb'));var logger=require(_0xb2e9('0xc'))('api');var config=require(_0xb2e9('0xd'));var db=require(_0xb2e9('0xe'))['db'];config[_0xb2e9('0xf')]=_[_0xb2e9('0x10')](config[_0xb2e9('0xf')],{'host':_0xb2e9('0x11'),'port':0x18eb});var socket=require(_0xb2e9('0x12'))(new Redis(config[_0xb2e9('0xf')]));require(_0xb2e9('0x13'))[_0xb2e9('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb2e9('0x15')]({'port':0x232b});var client9004=jayson[_0xb2e9('0x16')][_0xb2e9('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x97e466,_0xce9ee3,_0x1fc6ef,_0x5801ca){return new BPromise(function(_0x472c35,_0x3ee37a){var _0x235ba9=_0x5801ca||client;return _0x235ba9[_0xb2e9('0x17')](_0x97e466,_0x1fc6ef)[_0xb2e9('0x18')](function(_0x25c06f){logger[_0xb2e9('0x19')](_0xb2e9('0x1a'),_0xce9ee3,'request\x20sent');logger[_0xb2e9('0x1b')](_0xb2e9('0x1c'),_0xce9ee3,_0xb2e9('0x1d'),JSON[_0xb2e9('0x1e')](_0x25c06f));if(_0x25c06f[_0xb2e9('0x1f')]){if(_0x25c06f['error'][_0xb2e9('0x20')]===0x1f4){logger[_0xb2e9('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0xce9ee3,_0x25c06f['error'][_0xb2e9('0x21')]);return _0x3ee37a(_0x25c06f[_0xb2e9('0x1f')]['message']);}logger[_0xb2e9('0x1f')](_0xb2e9('0x1a'),_0xce9ee3,_0x25c06f[_0xb2e9('0x1f')][_0xb2e9('0x21')]);return _0x472c35(_0x25c06f[_0xb2e9('0x1f')][_0xb2e9('0x21')]);}else{logger['info'](_0xb2e9('0x1a'),_0xce9ee3,_0xb2e9('0x1d'));_0x472c35(_0x25c06f[_0xb2e9('0x22')][_0xb2e9('0x21')]);}})[_0xb2e9('0x23')](function(_0x33dd15){logger['error'](_0xb2e9('0x1a'),_0xce9ee3,_0x33dd15);_0x3ee37a(_0x33dd15);});});}function respondWithStatusCode(_0x4c165b,_0x2e5980){_0x2e5980=_0x2e5980||0xcc;return function(_0x2290d9){if(_0x2290d9){return _0x4c165b[_0xb2e9('0x24')](_0x2e5980);}return _0x4c165b[_0xb2e9('0x25')](_0x2e5980)['end']();};}function respondWithResult(_0x4b683d,_0x5e3db7){_0x5e3db7=_0x5e3db7||0xc8;return function(_0x546717){if(_0x546717){return _0x4b683d['status'](_0x5e3db7)[_0xb2e9('0x26')](_0x546717);}};}function respondWithFilteredResult(_0x3268e9,_0x3056bd){return function(_0x43b51c){if(_0x43b51c){var _0x59d56e=typeof _0x3056bd[_0xb2e9('0x27')]===_0xb2e9('0x28')&&typeof _0x3056bd[_0xb2e9('0x29')]===_0xb2e9('0x28');var _0x588b30=_0x43b51c[_0xb2e9('0x2a')];var _0x36c836=_0x59d56e?0x0:_0x3056bd['offset'];var _0x2c11f3=_0x59d56e?_0x43b51c['count']:_0x3056bd['offset']+_0x3056bd[_0xb2e9('0x29')];var _0x38e55e;if(_0x2c11f3>=_0x588b30){_0x2c11f3=_0x588b30;_0x38e55e=0xc8;}else{_0x38e55e=0xce;}_0x3268e9['status'](_0x38e55e);return _0x3268e9[_0xb2e9('0x2b')](_0xb2e9('0x2c'),_0x36c836+'-'+_0x2c11f3+'/'+_0x588b30)[_0xb2e9('0x26')](_0x43b51c);}return null;};}function saveUpdates(_0x2b1813){return function(_0x3b8562){if(_0x3b8562){return _0x3b8562[_0xb2e9('0x2d')](_0x2b1813)[_0xb2e9('0x18')](function(_0x1a3421){return _0x1a3421;});}return null;};}function removeEntity(_0x1c5b55){return function(_0x5677b2){if(_0x5677b2){return _0x5677b2[_0xb2e9('0x2e')]()['then'](function(){_0x1c5b55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0fb4){return function(_0x362d4f){if(!_0x362d4f){_0x5f0fb4['sendStatus'](0x194);}return _0x362d4f;};}function handleError(_0x1a7dea,_0x59ca76){_0x59ca76=_0x59ca76||0x1f4;return function(_0x3e8f3f){logger[_0xb2e9('0x1f')](_0x3e8f3f[_0xb2e9('0x2f')]);if(_0x3e8f3f[_0xb2e9('0x30')]){delete _0x3e8f3f[_0xb2e9('0x30')];}_0x1a7dea[_0xb2e9('0x25')](_0x59ca76)[_0xb2e9('0x31')](_0x3e8f3f);};}function getMustacheRender(_0x585a53,_0xf3c192){return Mustache[_0xb2e9('0x32')](_0x585a53,_[_0xb2e9('0x33')](_0xf3c192[_0xb2e9('0x34')],{'contact':_0xf3c192[_0xb2e9('0x35')],'message':_0xf3c192[_0xb2e9('0x21')],'agent':_0xf3c192[_0xb2e9('0x36')],'interaction':_0xf3c192['interaction'],'account':_0xf3c192['account']}))||'';}exports[_0xb2e9('0x37')]=function(_0x9faa4d,_0x6b25f7){var _0x400c47={};var _0x4ac7f3=_[_0xb2e9('0x38')](db[_0xb2e9('0x39')][_0xb2e9('0x3a')],function(_0x5b4e0f){return{'name':_0x5b4e0f['fieldName'],'type':_0x5b4e0f[_0xb2e9('0x3b')]['key']};});_0x400c47=qs[_0xb2e9('0x3c')](_0x4ac7f3,_0x9faa4d);return interaction[_0xb2e9('0x3d')](_0xb2e9('0x3e'),_0x9faa4d[_0xb2e9('0x3f')],_0x9faa4d['user'],_0x400c47,_0x4ac7f3)['then'](respondWithFilteredResult(_0x6b25f7,_0x400c47))['catch'](handleError(_0x6b25f7,null));};exports['show']=function(_0xb6a505,_0x8b7807){var _0x2a8dbc={'raw':![],'where':{'id':_0xb6a505['params']['id']}},_0x4f5164={};_0x4f5164[_0xb2e9('0x40')]=_[_0xb2e9('0x41')](db[_0xb2e9('0x39')][_0xb2e9('0x3a')]);_0x4f5164[_0xb2e9('0x3f')]=_['keys'](_0xb6a505[_0xb2e9('0x3f')]);_0x4f5164[_0xb2e9('0x42')]=_['intersection'](_0x4f5164[_0xb2e9('0x40')],_0x4f5164[_0xb2e9('0x3f')]);_0x2a8dbc['attributes']=_[_0xb2e9('0x43')](_0x4f5164[_0xb2e9('0x40')],qs[_0xb2e9('0x44')](_0xb6a505[_0xb2e9('0x3f')][_0xb2e9('0x44')]));_0x2a8dbc[_0xb2e9('0x45')]=_0x2a8dbc[_0xb2e9('0x45')][_0xb2e9('0x46')]?_0x2a8dbc['attributes']:_0x4f5164[_0xb2e9('0x40')];if(_0xb6a505[_0xb2e9('0x3f')]['includeAll']){_0x2a8dbc['include']=[{'all':!![]}];}_0x2a8dbc=_[_0xb2e9('0x33')]({},_0x2a8dbc,_0xb6a505['options']);return db[_0xb2e9('0x39')][_0xb2e9('0x47')](_0x2a8dbc)['then'](handleEntityNotFound(_0x8b7807,null))[_0xb2e9('0x18')](respondWithResult(_0x8b7807,null))['catch'](handleError(_0x8b7807,null));};exports[_0xb2e9('0x48')]=function(_0x13b005,_0x4c12b9){return db[_0xb2e9('0x39')][_0xb2e9('0x48')](_0x13b005[_0xb2e9('0x34')],{})[_0xb2e9('0x18')](respondWithResult(_0x4c12b9,0xc9))[_0xb2e9('0x23')](handleError(_0x4c12b9,null));};exports[_0xb2e9('0x2d')]=function(_0x4f2f66,_0x2ea643){if(_0x4f2f66[_0xb2e9('0x34')]['id']){delete _0x4f2f66[_0xb2e9('0x34')]['id'];}return db['ChatInteraction'][_0xb2e9('0x47')]({'where':{'id':_0x4f2f66['params']['id']}})['then'](handleEntityNotFound(_0x2ea643,null))[_0xb2e9('0x18')](saveUpdates(_0x4f2f66['body'],null))[_0xb2e9('0x18')](respondWithResult(_0x2ea643,null))[_0xb2e9('0x23')](handleError(_0x2ea643,null));};exports[_0xb2e9('0x2e')]=function(_0x567068,_0x1de1b4){return db['ChatInteraction'][_0xb2e9('0x47')]({'where':{'id':_0x567068[_0xb2e9('0x49')]['id']}})[_0xb2e9('0x18')](handleEntityNotFound(_0x1de1b4,null))[_0xb2e9('0x18')](removeEntity(_0x1de1b4,null))['catch'](handleError(_0x1de1b4,null));};exports[_0xb2e9('0x4a')]=function(_0x55617b,_0x11ec59){return db[_0xb2e9('0x39')]['describe']()[_0xb2e9('0x18')](respondWithResult(_0x11ec59,null))[_0xb2e9('0x23')](handleError(_0x11ec59,null));};exports[_0xb2e9('0x4b')]=function(_0x34a111,_0x39e289){var _0x3244e5=_0x34a111['params']['id'];var _0xfd36ae;var _0x7b0d00;var _0x459cc6;return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x3244e5}})[_0xb2e9('0x18')](function(_0xfbcb2b){_0xfd36ae=_0xfbcb2b;return db[_0xb2e9('0x4d')][_0xb2e9('0x4c')]({'where':{'id':_0xfbcb2b['ChatWebsiteId']},'attributes':['id',_0xb2e9('0x4e'),_0xb2e9('0x4f'),_0xb2e9('0x50'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xb2e9('0x18')](function(_0x3accb8){if(_0x3accb8&&_0x3accb8['vidaooApiKey']&&_0x3accb8[_0xb2e9('0x4f')]){_0x7b0d00=_0x3accb8;var _0x5b3b7d={'interaction':{'id':_0x3244e5},'agent':{'id':_0x34a111['user']['id'],'name':_0x34a111[_0xb2e9('0x51')][_0xb2e9('0x30')],'fullname':_0x34a111['user'][_0xb2e9('0x52')],'email':_0x34a111[_0xb2e9('0x51')][_0xb2e9('0x53')]},'contact':_0x34a111[_0xb2e9('0x34')][_0xb2e9('0x35')],'account':_0x34a111[_0xb2e9('0x34')][_0xb2e9('0x54')]};var _0x35dbcb={'rejectUnauthorized':![],'method':_0xb2e9('0x55'),'url':_0xb2e9('0x56'),'headers':{'X-APIKEY':_0x3accb8[_0xb2e9('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x34a111[_0xb2e9('0x51')]['email']],'buttons':null,'topic':_0x7b0d00[_0xb2e9('0x50')],'note':_[_0xb2e9('0x57')](_0x7b0d00[_0xb2e9('0x58')])?null:getMustacheRender(_0x7b0d00[_0xb2e9('0x58')],_0x5b3b7d),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xb2e9('0x57')](_0x7b0d00[_0xb2e9('0x59')])){var _0xaa2a2e=getMustacheRender(_0x7b0d00['vidaooMetadata'],_0x5b3b7d);var _0x199d4a=JSON[_0xb2e9('0x5a')](_0xaa2a2e);_0x35dbcb[_0xb2e9('0x34')][_0xb2e9('0x5b')]=_0x199d4a;}}catch(_0x642bf4){throw new db[(_0xb2e9('0x5c'))][(_0xb2e9('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35dbcb);}else{throw new db[(_0xb2e9('0x5c'))][(_0xb2e9('0x5d'))](_0xb2e9('0x5e'));}})[_0xb2e9('0x18')](function(_0x558ad0){_0x459cc6=_0x558ad0;if(_0x459cc6['id']){var _0x326f89={'body':_0x459cc6[_0xb2e9('0x5f')],'ChatWebsiteId':_0x7b0d00['id'],'ChatInteractionId':_0xfd36ae['id'],'direction':_0xb2e9('0x60'),'UserId':_0x34a111[_0xb2e9('0x51')]['id']};return db[_0xb2e9('0x61')][_0xb2e9('0x48')](_0x326f89,{});}else{throw new db[(_0xb2e9('0x5c'))]['ValidationError'](_0xb2e9('0x62'));}})['then'](function(){return _0xfd36ae[_0xb2e9('0x63')]({'vidaooSessionId':_0x459cc6['id']});})[_0xb2e9('0x18')](respondWithResult(_0x39e289,null))[_0xb2e9('0x23')](handleError(_0x39e289,null));};exports[_0xb2e9('0x64')]=function(_0x352e92,_0xd1e6c0){if(_0x352e92[_0xb2e9('0x34')]['id']){delete _0x352e92[_0xb2e9('0x34')]['id'];}return db[_0xb2e9('0x39')][_0xb2e9('0x47')]({'where':{'id':_0x352e92['params']['id']},'include':[{'model':db[_0xb2e9('0x65')],'as':_0xb2e9('0x66')}]})[_0xb2e9('0x18')](handleEntityNotFound(_0xd1e6c0,null))[_0xb2e9('0x18')](saveUpdates(_0x352e92[_0xb2e9('0x34')],null))['then'](respondWithResult(_0xd1e6c0,null))[_0xb2e9('0x23')](handleError(_0xd1e6c0,null));};exports['abandon']=function(_0x801a87,_0x373cdc){if(_0x801a87['body']['id']){delete _0x801a87[_0xb2e9('0x34')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x801a87[_0xb2e9('0x49')]['id']}})[_0xb2e9('0x18')](function(_0x344939){if(!_0x344939){logger[_0xb2e9('0x1f')](_0xb2e9('0x67'),_0xb2e9('0x68'),0x194,'entity\x20not\x20found');_0x373cdc[_0xb2e9('0x24')](0x194);}else{if(_0x344939['UserId']){throw new db[(_0xb2e9('0x5c'))][(_0xb2e9('0x5d'))]('Interaction\x20already\x20assigned');}}return _0x344939;})[_0xb2e9('0x18')](function(_0x3ec097){if(_0x3ec097){return _0x3ec097[_0xb2e9('0x2d')]({'closed':_0x801a87[_0xb2e9('0x34')][_0xb2e9('0x69')],'disposition':_0x801a87[_0xb2e9('0x34')]['disposition']})[_0xb2e9('0x18')](function(_0x41420d){return _0x41420d;});}})[_0xb2e9('0x18')](function(){return respondWithRpcPromise(_0xb2e9('0x6a'),_0xb2e9('0x68'),_0x801a87[_0xb2e9('0x34')],client9004);})[_0xb2e9('0x18')](respondWithResult(_0x373cdc,null))[_0xb2e9('0x23')](handleError(_0x373cdc,null));};exports[_0xb2e9('0x6b')]=function(_0x43dc11,_0x4219c0){_0x43dc11['body'][_0xb2e9('0x30')]=_0x43dc11[_0xb2e9('0x6c')][_0xb2e9('0x6d')];_0x43dc11['body'][_0xb2e9('0x6e')]=_0x43dc11[_0xb2e9('0x6c')][_0xb2e9('0x6f')];_0x43dc11[_0xb2e9('0x34')][_0xb2e9('0x3b')]=_0x43dc11['file'][_0xb2e9('0x70')];return db['Attachment'][_0xb2e9('0x48')](_0x43dc11[_0xb2e9('0x34')])[_0xb2e9('0x18')](respondWithResult(_0x4219c0,0xc9))['catch'](handleError(_0x4219c0,null));};exports[_0xb2e9('0x71')]=function(_0x3649d0,_0x3d93c9){return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x3649d0[_0xb2e9('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3d93c9,null))['then'](function(_0x2ce906){if(_0x2ce906){if(_0x2ce906[_0xb2e9('0x69')]){return _0x3d93c9[_0xb2e9('0x25')](0x193)[_0xb2e9('0x26')]({'status':0x193,'message':_0xb2e9('0x72')});}return db[_0xb2e9('0x73')][_0xb2e9('0x4c')]({'where':{'id':_0x3649d0[_0xb2e9('0x3f')][_0xb2e9('0x74')]},'raw':!![]})['then'](handleEntityNotFound(_0x3d93c9,null));}})[_0xb2e9('0x18')](function(_0x4555cc){if(_0x4555cc){var _0x228f63=_0x4555cc['ChatOfflineMessageId']!==null;var _0x6c3b20=path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0x77'));if(_0x228f63){_0x6c3b20=path[_0xb2e9('0x75')](_0x6c3b20,_0xb2e9('0x78'));}var _0x4fd5e1=path['join'](_0x6c3b20,_0x4555cc[_0xb2e9('0x6e')]);return _0x3d93c9[_0xb2e9('0x79')](_0x4fd5e1);}})['catch'](handleError(_0x3d93c9,null));};exports[_0xb2e9('0x7a')]=function(_0x49fac9,_0x9a3c3a){var _0x1b75a4=null;var _0x163ff7=null;var _0x294a34=null;if(_0x49fac9[_0xb2e9('0x34')]['id']){delete _0x49fac9[_0xb2e9('0x34')]['id'];}if(_0x49fac9[_0xb2e9('0x34')][_0xb2e9('0x7b')]){_0x294a34=path[_0xb2e9('0x75')](config['root'],'server/files/chat/upload/',util['format'](_0xb2e9('0x7c'),Date[_0xb2e9('0x7d')]()));_0x49fac9[_0xb2e9('0x34')][_0xb2e9('0x7e')]=_0x294a34;}return db['ChatInteraction'][_0xb2e9('0x47')]({'where':{'id':_0x49fac9['params']['id']},'include':[{'model':db[_0xb2e9('0x61')],'as':_0xb2e9('0x7f'),'include':[{'model':db[_0xb2e9('0x80')],'as':_0xb2e9('0x80')}]}]})[_0xb2e9('0x18')](handleEntityNotFound(_0x9a3c3a,null))[_0xb2e9('0x18')](saveUpdates(_0x49fac9[_0xb2e9('0x34')],null))[_0xb2e9('0x18')](function(_0x3cd648){if(_0x3cd648){_0x1b75a4=_0x3cd648;return db['ChatWebsite'][_0xb2e9('0x47')]({'where':{'id':_0x1b75a4['ChatWebsiteId']}});}})[_0xb2e9('0x18')](function(_0x4ad4b6){if(_0x4ad4b6){_0x163ff7=_0x4ad4b6;return db['CmContact'][_0xb2e9('0x47')]({'where':{'id':_0x1b75a4['ContactId']}});}})[_0xb2e9('0x18')](function(_0x1bc550){if(_0x1bc550){if(_0x294a34){var _0x457cc7=null;for(var _0x463cc5=0x1;_0x463cc5<_0x1b75a4[_0xb2e9('0x7f')][_0xb2e9('0x46')];++_0x463cc5){_0x457cc7=_0x1b75a4[_0xb2e9('0x7f')][_0x463cc5];var _0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?util[_0xb2e9('0x82')](_0xb2e9('0x83'),_0x163ff7[_0xb2e9('0x84')],_0x457cc7['UserId']):'System';var _0x24bff2=_0x49fac9[_0xb2e9('0x34')]['customer']||util['format'](_0xb2e9('0x83'),_0xb2e9('0x85'),_0x457cc7[_0xb2e9('0x86')]);switch(_0x163ff7[_0xb2e9('0x87')]){case _0xb2e9('0x88'):_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?util[_0xb2e9('0x82')](_0xb2e9('0x83'),_0x163ff7[_0xb2e9('0x84')],_0x457cc7[_0xb2e9('0x81')]):_0xb2e9('0x89');break;case _0xb2e9('0x8a'):_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?_0x457cc7[_0xb2e9('0x80')][_0xb2e9('0x8b')]||_0x457cc7['User'][_0xb2e9('0x52')]:_0xb2e9('0x89');break;case'agent_fullname':_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?_0x457cc7['User'][_0xb2e9('0x52')]:_0xb2e9('0x89');break;default:_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?util[_0xb2e9('0x82')]('%s%d',_0x163ff7[_0xb2e9('0x84')],_0x457cc7['UserId']):_0xb2e9('0x89');}var _0x5e0b7f=util[_0xb2e9('0x82')](_0xb2e9('0x8c'),moment(_0x457cc7[_0xb2e9('0x8d')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x457cc7[_0xb2e9('0x8e')]==='in'?_0x24bff2:_0x18ba3a,_0x457cc7[_0xb2e9('0x34')]);if(!_0x457cc7['secret']){fs[_0xb2e9('0x8f')](_0x294a34,_0x5e0b7f);}}return db[_0xb2e9('0x90')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb2e9('0x91'),'raw':!![],'include':[{'model':db[_0xb2e9('0x92')],'as':_0xb2e9('0x92'),'raw':!![]}]}]});}}})[_0xb2e9('0x18')](function(_0x30b2b6){if(!_0x30b2b6||!_0x30b2b6[_0xb2e9('0x91')]||!_0x49fac9[_0xb2e9('0x34')])return _0x1b75a4;var _0x2151af=_0x30b2b6[_0xb2e9('0x93')]();return respondWithRpcPromise('SendMail',_0xb2e9('0x94'),{'account':_0x2151af,'message':{'from':util[_0xb2e9('0x82')](_0xb2e9('0x95'),_0x30b2b6[_0xb2e9('0x30')],_0x30b2b6[_0xb2e9('0x53')]||_0x30b2b6[_0xb2e9('0x91')]['user']),'to':_0x49fac9[_0xb2e9('0x34')]['mailTranscript'],'subject':_0xb2e9('0x96'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x49fac9['body'][_0xb2e9('0x7b')]),'attachments':[{'path':_0x294a34}]}})[_0xb2e9('0x18')](function(){return _0x1b75a4;})['catch'](function(_0xb3f0ee){logger['error'](_0xb3f0ee);});})[_0xb2e9('0x18')](respondWithStatusCode(_0x9a3c3a,0xc8))[_0xb2e9('0x23')](handleError(_0x9a3c3a,null));};exports['addMessage']=function(_0x3d455a,_0x28701c){return db[_0xb2e9('0x61')][_0xb2e9('0x47')]({'where':{'id':_0x3d455a[_0xb2e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x28701c,null))[_0xb2e9('0x18')](function(_0x6a34a6){if(_0x6a34a6){return _0x6a34a6[_0xb2e9('0x97')](_0x3d455a['body'][_0xb2e9('0x98')],_[_0xb2e9('0x99')](_0x3d455a[_0xb2e9('0x34')],['ids','id'])||{});}})[_0xb2e9('0x18')](respondWithResult(_0x28701c,null))[_0xb2e9('0x23')](handleError(_0x28701c,null));};exports['getMessages']=function(_0x22bf3e,_0x3b815f){var _0x2f62a3={'raw':![],'where':{}};var _0x5d2e8f={};var _0x56ac35={'count':0x0,'rows':[]};return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x22bf3e[_0xb2e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b815f,null))[_0xb2e9('0x18')](function(_0x38741e){if(_0x38741e){_0x5d2e8f['model']=_[_0xb2e9('0x41')](db[_0xb2e9('0x61')][_0xb2e9('0x3a')]);_0x5d2e8f[_0xb2e9('0x3f')]=_[_0xb2e9('0x41')](_0x22bf3e[_0xb2e9('0x3f')]);_0x5d2e8f[_0xb2e9('0x42')]=_[_0xb2e9('0x43')](_0x5d2e8f[_0xb2e9('0x40')],_0x5d2e8f['query']);_0x2f62a3['attributes']=_[_0xb2e9('0x43')](_0x5d2e8f['model'],qs[_0xb2e9('0x44')](_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0x44')]));_0x2f62a3[_0xb2e9('0x45')]=_0x2f62a3['attributes']['length']?_0x2f62a3[_0xb2e9('0x45')]:_0x5d2e8f[_0xb2e9('0x40')];if(!_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0x9a')]('nolimit')){_0x2f62a3[_0xb2e9('0x29')]=qs[_0xb2e9('0x29')](_0x22bf3e[_0xb2e9('0x3f')]['limit']);_0x2f62a3[_0xb2e9('0x27')]=qs['offset'](_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0x27')]);}_0x2f62a3[_0xb2e9('0x9b')]=qs[_0xb2e9('0x9c')](_0x22bf3e[_0xb2e9('0x3f')]['sort']);_0x2f62a3['where']=qs[_0xb2e9('0x42')](_[_0xb2e9('0x9d')](_0x22bf3e['query'],_0x5d2e8f[_0xb2e9('0x42')]));_0x2f62a3[_0xb2e9('0x9e')][_0xb2e9('0x9f')]=_0x38741e['id'];if(_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa0')]){_0x2f62a3[_0xb2e9('0x9e')]=_[_0xb2e9('0x33')](_0x2f62a3[_0xb2e9('0x9e')],{'$or':_['map'](_0x2f62a3[_0xb2e9('0x45')],function(_0x314bc1){var _0x11f231={};_0x11f231[_0x314bc1]={'$like':'%'+_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa0')]+'%'};return _0x11f231;})});}if(_0x22bf3e['query'][_0xb2e9('0xa1')]){var _0x575132=_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa1')][_0xb2e9('0xa2')](',');var _0x34f032={};_0x34f032[_0x575132[0x0]]={'$gte':moment(_0x575132[0x1])[_0xb2e9('0x82')](_0xb2e9('0xa3'))};_0x2f62a3[_0xb2e9('0x9e')]=_[_0xb2e9('0x33')](_0x2f62a3[_0xb2e9('0x9e')],_0x34f032);}_0x2f62a3=_[_0xb2e9('0x33')]({},_0x2f62a3,_0x22bf3e[_0xb2e9('0xa4')]);return db[_0xb2e9('0x61')][_0xb2e9('0x2a')]({'where':_0x2f62a3[_0xb2e9('0x9e')]})[_0xb2e9('0x18')](function(_0x3767ca){_0x56ac35[_0xb2e9('0x2a')]=_0x3767ca;if(_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa5')]){_0x2f62a3['include']=[{'all':!![]}];}return db[_0xb2e9('0x61')]['findAll'](_0x2f62a3);})['then'](function(_0xf74c0){_0x56ac35['rows']=_0xf74c0;return _0x56ac35;});}})[_0xb2e9('0x18')](respondWithFilteredResult(_0x3b815f,_0x2f62a3))[_0xb2e9('0x23')](handleError(_0x3b815f,null));};exports['getMyMessages']=function(_0x5ddaa6,_0x59bed0){var _0x399b5a={'where':{}},_0x11b7a1={},_0x1cd41a={'count':0x0,'rows':[]};return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x5ddaa6[_0xb2e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x59bed0,null))[_0xb2e9('0x18')](function(_0x259588){if(_0x259588){_0x11b7a1[_0xb2e9('0x40')]=_[_0xb2e9('0x41')](db[_0xb2e9('0x61')][_0xb2e9('0x3a')]);_0x11b7a1['query']=_[_0xb2e9('0x41')](_0x5ddaa6[_0xb2e9('0x3f')]);_0x11b7a1[_0xb2e9('0x42')]=_[_0xb2e9('0x43')](_0x11b7a1['model'],_0x11b7a1[_0xb2e9('0x3f')]);_0x399b5a[_0xb2e9('0x45')]=_[_0xb2e9('0x43')](_0x11b7a1[_0xb2e9('0x40')],qs['fields'](_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0x44')]));_0x399b5a['attributes']=_0x399b5a[_0xb2e9('0x45')][_0xb2e9('0x46')]?_0x399b5a[_0xb2e9('0x45')]:_0x11b7a1['model'];if(!_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0x9a')](_0xb2e9('0xa6'))){_0x399b5a[_0xb2e9('0x29')]=qs[_0xb2e9('0x29')](_0x5ddaa6['query'][_0xb2e9('0x29')]);_0x399b5a['offset']=qs[_0xb2e9('0x27')](_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0x27')]);}_0x399b5a[_0xb2e9('0x9b')]=qs[_0xb2e9('0x9c')](_0x5ddaa6['query']['sort']);_0x399b5a['where']=qs[_0xb2e9('0x42')](_['pick'](_0x5ddaa6[_0xb2e9('0x3f')],_0x11b7a1[_0xb2e9('0x42')]));_0x399b5a[_0xb2e9('0x9e')][_0xb2e9('0x9f')]=_0x259588['id'];if(_0x5ddaa6['query'][_0xb2e9('0xa0')]){_0x399b5a[_0xb2e9('0x9e')]=_[_0xb2e9('0x33')](_0x399b5a[_0xb2e9('0x9e')],{'$or':_[_0xb2e9('0x38')](_0x399b5a['attributes'],function(_0x240d39){var _0x4af753={};_0x4af753[_0x240d39]={'$like':'%'+_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0xa0')]+'%'};return _0x4af753;})});}_0x399b5a[_0xb2e9('0x9e')]['secret']=![];if(_0x5ddaa6[_0xb2e9('0x3f')]['id']){_0x399b5a[_0xb2e9('0x9e')]['id']={'$gt':_0x5ddaa6[_0xb2e9('0x3f')]['id']};}_0x399b5a=_['merge']({},_0x399b5a,_0x5ddaa6['options']);return db[_0xb2e9('0x61')][_0xb2e9('0x2a')]({'where':_0x399b5a[_0xb2e9('0x9e')]})['then'](function(_0x2a29bb){_0x1cd41a['count']=_0x2a29bb;_0x399b5a[_0xb2e9('0xa7')]=[];if(_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0xa8')]){_0x399b5a[_0xb2e9('0xa7')][_0xb2e9('0xa9')]({'model':db[_0xb2e9('0x80')],'as':_0xb2e9('0x80'),'attributes':['id','fullname',_0xb2e9('0x8b')]});}if(_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0xa5')]){_0x399b5a[_0xb2e9('0xa7')]=[{'all':!![]}];}return db['ChatMessage'][_0xb2e9('0x3d')](_0x399b5a);})['then'](function(_0x2f6394){_0x1cd41a[_0xb2e9('0xaa')]=_0x2f6394;return _0x1cd41a;});}})[_0xb2e9('0x18')](respondWithFilteredResult(_0x59bed0,_0x399b5a))[_0xb2e9('0x23')](handleError(_0x59bed0,null));};exports[_0xb2e9('0xab')]=function(_0x170022,_0x22c476){return db[_0xb2e9('0x39')]['find']({'where':{'id':_0x170022['params']['id']}})[_0xb2e9('0x18')](handleEntityNotFound(_0x22c476,null))[_0xb2e9('0x18')](function(_0x55923c){if(_0x55923c){return _0x55923c[_0xb2e9('0xac')](_0x170022[_0xb2e9('0x34')][_0xb2e9('0x98')],_['omit'](_0x170022[_0xb2e9('0x34')],[_0xb2e9('0x98'),'id'])||{})[_0xb2e9('0xad')](function(){return db[_0xb2e9('0xae')][_0xb2e9('0x3d')]({'attributes':['id',_0xb2e9('0x30'),_0xb2e9('0xaf')],'where':{'id':_0x170022[_0xb2e9('0x34')]['ids']}});})[_0xb2e9('0x18')](function(_0x302114){socket[_0xb2e9('0xb0')](_0xb2e9('0xb1'),{'id':Number(_0x170022[_0xb2e9('0x49')]['id']),'tags':_0x302114||[]});return{'id':Number(_0x170022['params']['id']),'tags':_0x302114||[]};});}})[_0xb2e9('0x18')](respondWithResult(_0x22c476,null))[_0xb2e9('0x23')](handleError(_0x22c476,null));};exports[_0xb2e9('0xb2')]=function(_0x552e8a,_0x950e56){return db[_0xb2e9('0x39')][_0xb2e9('0x47')]({'where':{'id':_0x552e8a[_0xb2e9('0x49')]['id']}})[_0xb2e9('0x18')](handleEntityNotFound(_0x950e56,null))['then'](function(_0xc09714){if(_0xc09714){return _0xc09714[_0xb2e9('0xb2')](_0x552e8a[_0xb2e9('0x3f')][_0xb2e9('0x98')]);}})[_0xb2e9('0x18')](respondWithStatusCode(_0x950e56,null))[_0xb2e9('0x23')](handleError(_0x950e56,null));};exports[_0xb2e9('0x79')]=function(_0x24b5dd,_0x4e4bf3){var _0x174740=moment()[_0xb2e9('0xb3')]()[_0xb2e9('0xb4')]();var _0x13178a=path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0xb5'),_0xb2e9('0xb6'),_0xb2e9('0xb7'));var _0x2bbcb9=path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0xb5'),_0xb2e9('0xb6'),_0xb2e9('0xb8'));var _0xec07ae=path[_0xb2e9('0x75')](_0x13178a,_0x174740);var _0x4f763b=util[_0xb2e9('0x82')]('transcript-%d-%s.zip',_0x24b5dd[_0xb2e9('0x49')]['id'],_0x174740);var _0x12b98=path[_0xb2e9('0x75')](_0x13178a,_0x4f763b);var _0x114401=[];_0x114401['push']({'model':db[_0xb2e9('0x80')],'as':_0xb2e9('0x80'),'attributes':['id',_0xb2e9('0x52')],'raw':!![]});_0x114401[_0xb2e9('0xa9')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xb2e9('0xb9'),_0xb2e9('0xba')],'raw':!![]});if(_0x24b5dd[_0xb2e9('0x3f')][_0xb2e9('0xb8')]){_0x114401['push']({'model':db[_0xb2e9('0x73')],'as':'Attachment','raw':!![]});}var _0x318619=[{'model':db[_0xb2e9('0x61')],'as':'Messages','attributes':['id',_0xb2e9('0x34'),_0xb2e9('0x8d'),_0xb2e9('0x8e'),_0xb2e9('0xbb'),_0xb2e9('0xbc')],'include':_0x114401}];_0x318619[_0xb2e9('0xa9')]({'model':db[_0xb2e9('0x4d')],'as':_0xb2e9('0xbd'),'attributes':['id',_0xb2e9('0x30')]});_0x318619[_0xb2e9('0xa9')]({'model':db[_0xb2e9('0x80')],'as':'Owner','attributes':['id',_0xb2e9('0x52')]});return db[_0xb2e9('0x39')]['find']({'where':{'id':_0x24b5dd[_0xb2e9('0x49')]['id']},'include':_0x318619})[_0xb2e9('0x18')](handleEntityNotFound(_0x4e4bf3,null))[_0xb2e9('0x18')](function(_0x23455b){if(_0x23455b){var _0x283c89=_0x23455b[_0xb2e9('0xbe')]({'plain':!![]});fs[_0xb2e9('0xbf')](_0xec07ae);var _0xdc8a07={'channel':_0xb2e9('0xc0'),'account':_0x283c89[_0xb2e9('0xbd')][_0xb2e9('0x30')],'agent':_0x283c89[_0xb2e9('0xc1')]?_0x283c89[_0xb2e9('0xc1')][_0xb2e9('0x52')]:_0xb2e9('0xc2'),'createdAt':moment(_0x283c89[_0xb2e9('0x8d')])[_0xb2e9('0x82')](_0xb2e9('0xa3'))['toString'](),'closedAt':_0x283c89[_0xb2e9('0x69')]?moment(_0x283c89['closedAt'])[_0xb2e9('0x82')](_0xb2e9('0xa3'))[_0xb2e9('0xb4')]():'','disposition':_0x283c89[_0xb2e9('0xc3')],'chatInfo':{'browser':_0x283c89[_0xb2e9('0xc4')],'os':_0x283c89['osName'],'referer':_0x283c89[_0xb2e9('0xc5')],'customerIp':_0x283c89[_0xb2e9('0xc6')],'customerPort':_0x283c89['customerPort']?_0x283c89[_0xb2e9('0xc7')]:_0xb2e9('0xc2')},'messages':_(_0x283c89[_0xb2e9('0x7f')])[_0xb2e9('0xc8')]()[_0xb2e9('0xa0')]({'secret':![]})[_0xb2e9('0x38')](function(_0x750ada){if(_0x750ada['Attachment']){var _0x173c39=path[_0xb2e9('0x75')](_0x2bbcb9,_0x750ada[_0xb2e9('0x73')]['basename']);if(fs[_0xb2e9('0xc9')](_0x173c39)){fs[_0xb2e9('0xca')](_0x173c39)[_0xb2e9('0xcb')](fs['createWriteStream'](path[_0xb2e9('0x75')](_0xec07ae,_0x750ada[_0xb2e9('0x73')][_0xb2e9('0x6e')])));}}return{'date':moment(_0x750ada[_0xb2e9('0x8d')])[_0xb2e9('0x82')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb2e9('0xb4')](),'sender':_0x750ada['direction']==='out'?_0x750ada[_0xb2e9('0x80')]?_0x750ada[_0xb2e9('0x80')][_0xb2e9('0x52')]:_0xb2e9('0x89'):_0x750ada[_0xb2e9('0x66')][_0xb2e9('0xb9')]+(_0x750ada[_0xb2e9('0x66')][_0xb2e9('0xba')]?'\x20'+_0x750ada[_0xb2e9('0x66')][_0xb2e9('0xba')]:''),'body':_0x750ada['Attachment']?_0x750ada['Attachment'][_0xb2e9('0x6e')]:_0x750ada['body'],'direction':_0x750ada[_0xb2e9('0x8e')]===_0xb2e9('0x60')?'A':'C','secret':_0x750ada[_0xb2e9('0xbb')],'read':_0x750ada['read'],'attachment':_0x750ada['Attachment']};})['value']()};return ejs[_0xb2e9('0xcc')](path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0xb5'),_0xb2e9('0xcd'),_0xb2e9('0xce')),{'interaction':_0xdc8a07})[_0xb2e9('0x18')](function(_0x425ccc){var _0x268102=path[_0xb2e9('0x75')](_0xec07ae,_0xb2e9('0xcf')+_0x283c89['id']+'-'+_0x174740+_0xb2e9('0xd0'));var _0x954165={'path':_0x268102,'channel':_0xb2e9('0xc0'),'interactionId':_0x283c89['id']};return pdf[_0xb2e9('0xd1')](_0x425ccc,_0x954165);})[_0xb2e9('0x18')](function(){return new Promise(function(_0xfbea79,_0x2d9b98){zipdir(_0xec07ae,{'saveTo':_0x12b98},function(_0x3d7ba1,_0x358925){if(_0x3d7ba1)return _0x2d9b98(_0x3d7ba1);return _0xfbea79(_0x358925);});})[_0xb2e9('0x18')](function(){return new BPromise(function(_0x299d57,_0x454325){rimraf(_0xec07ae,function(_0x4841be){if(_0x4841be)_0x454325(_0x4841be);return _0x299d57();});});})[_0xb2e9('0x18')](function(){return _0x4e4bf3[_0xb2e9('0x79')](_0x12b98,_0x4f763b,function(_0x2e9e7c){if(_0x2e9e7c){logger[_0xb2e9('0x1f')](_0xb2e9('0xd2'),_0x2e9e7c);}else{fs['unlinkSync'](_0x12b98);}});});});}else{return _0x4e4bf3[_0xb2e9('0x24')](0xc8);}})[_0xb2e9('0x23')](handleError(_0x4e4bf3,null));}; \ No newline at end of file +var _0x95c4=['alias','findAll','addTags','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','toString','root','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','read','Owner','mkdirSync','Chat','Account','N.A.','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','unlinkSync','rimraf','zip-dir','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','sendStatus','name','send','render','merge','body','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','getOptions','chat','query','user','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','ChatInteraction','find','catch','create','update','describe','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','ChatOfflineMessageId','server/files/attachments/','offline-chat/','join','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ContactId','format','%s%d','agentAlias','Visitor','agentIdentifier','website_alias','UserId','agent_alias','User','fullname','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','nolimit','includeAgent','push'];(function(_0x406cf7,_0xe378a5){var _0x325d00=function(_0x80872f){while(--_0x80872f){_0x406cf7['push'](_0x406cf7['shift']());}};_0x325d00(++_0xe378a5);}(_0x95c4,0xfd));var _0x495c=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x95c4[_0x3fba9f];return _0x192cf1;};'use strict';var rimraf=require(_0x495c('0x0'));var zipdir=require(_0x495c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x495c('0x2'));var Mustache=require(_0x495c('0x3'));var util=require(_0x495c('0x4'));var path=require(_0x495c('0x5'));var ejs=require(_0x495c('0x6'));var fs=require('fs');var _=require(_0x495c('0x7'));var Redis=require('ioredis');var interaction=require(_0x495c('0x8'));var qs=require(_0x495c('0x9'));var pdf=require(_0x495c('0xa'));var logger=require(_0x495c('0xb'))('api');var config=require('../../config/environment');var db=require(_0x495c('0xc'))['db'];config[_0x495c('0xd')]=_[_0x495c('0xe')](config[_0x495c('0xd')],{'host':_0x495c('0xf'),'port':0x18eb});var socket=require(_0x495c('0x10'))(new Redis(config[_0x495c('0xd')]));require(_0x495c('0x11'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x495c('0x12')]({'port':0x232b});var client9004=jayson['client'][_0x495c('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x27a29e,_0x14830a,_0x528f24,_0x10417b){return new BPromise(function(_0x80a73a,_0x3404d7){var _0x4dbe14=_0x10417b||client;return _0x4dbe14[_0x495c('0x13')](_0x27a29e,_0x528f24)[_0x495c('0x14')](function(_0x313efc){logger[_0x495c('0x15')](_0x495c('0x16'),_0x14830a,'request\x20sent');logger[_0x495c('0x17')](_0x495c('0x18'),_0x14830a,_0x495c('0x19'),JSON['stringify'](_0x313efc));if(_0x313efc[_0x495c('0x1a')]){if(_0x313efc['error'][_0x495c('0x1b')]===0x1f4){logger[_0x495c('0x1a')](_0x495c('0x16'),_0x14830a,_0x313efc[_0x495c('0x1a')][_0x495c('0x1c')]);return _0x3404d7(_0x313efc[_0x495c('0x1a')][_0x495c('0x1c')]);}logger[_0x495c('0x1a')](_0x495c('0x16'),_0x14830a,_0x313efc[_0x495c('0x1a')][_0x495c('0x1c')]);return _0x80a73a(_0x313efc[_0x495c('0x1a')][_0x495c('0x1c')]);}else{logger[_0x495c('0x15')](_0x495c('0x16'),_0x14830a,'request\x20sent');_0x80a73a(_0x313efc['result'][_0x495c('0x1c')]);}})['catch'](function(_0xc608d1){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x14830a,_0xc608d1);_0x3404d7(_0xc608d1);});});}function respondWithStatusCode(_0x1a5e1f,_0x19c363){_0x19c363=_0x19c363||0xcc;return function(_0xadc628){if(_0xadc628){return _0x1a5e1f['sendStatus'](_0x19c363);}return _0x1a5e1f[_0x495c('0x1d')](_0x19c363)[_0x495c('0x1e')]();};}function respondWithResult(_0xd4f8ed,_0x455050){_0x455050=_0x455050||0xc8;return function(_0x37198a){if(_0x37198a){return _0xd4f8ed[_0x495c('0x1d')](_0x455050)[_0x495c('0x1f')](_0x37198a);}};}function respondWithFilteredResult(_0x58f681,_0x172306){return function(_0x26d359){if(_0x26d359){var _0x4f323a=typeof _0x172306['offset']===_0x495c('0x20')&&typeof _0x172306[_0x495c('0x21')]==='undefined';var _0x341f65=_0x26d359[_0x495c('0x22')];var _0x3f80aa=_0x4f323a?0x0:_0x172306[_0x495c('0x23')];var _0x299744=_0x4f323a?_0x26d359[_0x495c('0x22')]:_0x172306['offset']+_0x172306[_0x495c('0x21')];var _0x158f8e;if(_0x299744>=_0x341f65){_0x299744=_0x341f65;_0x158f8e=0xc8;}else{_0x158f8e=0xce;}_0x58f681[_0x495c('0x1d')](_0x158f8e);return _0x58f681[_0x495c('0x24')](_0x495c('0x25'),_0x3f80aa+'-'+_0x299744+'/'+_0x341f65)[_0x495c('0x1f')](_0x26d359);}return null;};}function saveUpdates(_0xe5bbd0){return function(_0x38bc66){if(_0x38bc66){return _0x38bc66['update'](_0xe5bbd0)[_0x495c('0x14')](function(_0x2706d0){return _0x2706d0;});}return null;};}function removeEntity(_0x266b99){return function(_0x3b404a){if(_0x3b404a){return _0x3b404a[_0x495c('0x26')]()[_0x495c('0x14')](function(){_0x266b99[_0x495c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d8df){return function(_0x5825c8){if(!_0x5825c8){_0x16d8df[_0x495c('0x27')](0x194);}return _0x5825c8;};}function handleError(_0x4978e2,_0x36b978){_0x36b978=_0x36b978||0x1f4;return function(_0x41650a){logger[_0x495c('0x1a')](_0x41650a['stack']);if(_0x41650a[_0x495c('0x28')]){delete _0x41650a[_0x495c('0x28')];}_0x4978e2[_0x495c('0x1d')](_0x36b978)[_0x495c('0x29')](_0x41650a);};}function getMustacheRender(_0x364081,_0x42e340){return Mustache[_0x495c('0x2a')](_0x364081,_[_0x495c('0x2b')](_0x42e340[_0x495c('0x2c')],{'contact':_0x42e340['contact'],'message':_0x42e340['message'],'agent':_0x42e340[_0x495c('0x2d')],'interaction':_0x42e340[_0x495c('0x2e')],'account':_0x42e340[_0x495c('0x2f')]}))||'';}exports[_0x495c('0x30')]=function(_0x9214e5,_0xaac129){var _0x2432bc={};var _0x44c4ab=_[_0x495c('0x31')](db['ChatInteraction'][_0x495c('0x32')],function(_0x2571a5){return{'name':_0x2571a5[_0x495c('0x33')],'type':_0x2571a5[_0x495c('0x34')][_0x495c('0x35')]};});_0x2432bc=qs[_0x495c('0x36')](_0x44c4ab,_0x9214e5);return interaction['findAll'](_0x495c('0x37'),_0x9214e5[_0x495c('0x38')],_0x9214e5[_0x495c('0x39')],_0x2432bc,_0x44c4ab)[_0x495c('0x14')](respondWithFilteredResult(_0xaac129,_0x2432bc))['catch'](handleError(_0xaac129,null));};exports['show']=function(_0x252d52,_0x17e779){var _0x138221={'raw':![],'where':{'id':_0x252d52[_0x495c('0x3a')]['id']}},_0x1a3cf3={};_0x1a3cf3[_0x495c('0x3b')]=_[_0x495c('0x3c')](db['ChatInteraction'][_0x495c('0x32')]);_0x1a3cf3[_0x495c('0x38')]=_[_0x495c('0x3c')](_0x252d52[_0x495c('0x38')]);_0x1a3cf3[_0x495c('0x3d')]=_[_0x495c('0x3e')](_0x1a3cf3[_0x495c('0x3b')],_0x1a3cf3[_0x495c('0x38')]);_0x138221[_0x495c('0x3f')]=_[_0x495c('0x3e')](_0x1a3cf3[_0x495c('0x3b')],qs[_0x495c('0x40')](_0x252d52[_0x495c('0x38')][_0x495c('0x40')]));_0x138221[_0x495c('0x3f')]=_0x138221[_0x495c('0x3f')][_0x495c('0x41')]?_0x138221[_0x495c('0x3f')]:_0x1a3cf3[_0x495c('0x3b')];if(_0x252d52[_0x495c('0x38')][_0x495c('0x42')]){_0x138221[_0x495c('0x43')]=[{'all':!![]}];}_0x138221=_[_0x495c('0x2b')]({},_0x138221,_0x252d52[_0x495c('0x44')]);return db[_0x495c('0x45')][_0x495c('0x46')](_0x138221)[_0x495c('0x14')](handleEntityNotFound(_0x17e779,null))['then'](respondWithResult(_0x17e779,null))[_0x495c('0x47')](handleError(_0x17e779,null));};exports['create']=function(_0x2cd88c,_0xbdffce){return db[_0x495c('0x45')][_0x495c('0x48')](_0x2cd88c['body'],{})['then'](respondWithResult(_0xbdffce,0xc9))[_0x495c('0x47')](handleError(_0xbdffce,null));};exports[_0x495c('0x49')]=function(_0x27701f,_0x38f89c){if(_0x27701f[_0x495c('0x2c')]['id']){delete _0x27701f[_0x495c('0x2c')]['id'];}return db[_0x495c('0x45')]['find']({'where':{'id':_0x27701f[_0x495c('0x3a')]['id']}})[_0x495c('0x14')](handleEntityNotFound(_0x38f89c,null))[_0x495c('0x14')](saveUpdates(_0x27701f[_0x495c('0x2c')],null))[_0x495c('0x14')](respondWithResult(_0x38f89c,null))[_0x495c('0x47')](handleError(_0x38f89c,null));};exports[_0x495c('0x26')]=function(_0x34345f,_0x123d91){return db['ChatInteraction'][_0x495c('0x46')]({'where':{'id':_0x34345f[_0x495c('0x3a')]['id']}})[_0x495c('0x14')](handleEntityNotFound(_0x123d91,null))[_0x495c('0x14')](removeEntity(_0x123d91,null))[_0x495c('0x47')](handleError(_0x123d91,null));};exports[_0x495c('0x4a')]=function(_0x2ed021,_0x1d4cb8){return db[_0x495c('0x45')]['describe']()[_0x495c('0x14')](respondWithResult(_0x1d4cb8,null))[_0x495c('0x47')](handleError(_0x1d4cb8,null));};exports['createVidaooSession']=function(_0x4405c6,_0x36e407){var _0x457359=_0x4405c6[_0x495c('0x3a')]['id'];var _0x5eba88;var _0x485aab;var _0xfa584;return db[_0x495c('0x45')]['findOne']({'where':{'id':_0x457359}})[_0x495c('0x14')](function(_0xd46511){_0x5eba88=_0xd46511;return db[_0x495c('0x4b')]['findOne']({'where':{'id':_0xd46511[_0x495c('0x4c')]},'attributes':['id',_0x495c('0x4d'),_0x495c('0x4e'),_0x495c('0x4f'),_0x495c('0x50'),_0x495c('0x51')],'raw':!![]});})[_0x495c('0x14')](function(_0x39aab7){if(_0x39aab7&&_0x39aab7[_0x495c('0x4d')]&&_0x39aab7[_0x495c('0x4e')]){_0x485aab=_0x39aab7;var _0x3e10f6={'interaction':{'id':_0x457359},'agent':{'id':_0x4405c6[_0x495c('0x39')]['id'],'name':_0x4405c6['user'][_0x495c('0x28')],'fullname':_0x4405c6[_0x495c('0x39')]['fullname'],'email':_0x4405c6[_0x495c('0x39')][_0x495c('0x52')]},'contact':_0x4405c6[_0x495c('0x2c')][_0x495c('0x53')],'account':_0x4405c6[_0x495c('0x2c')][_0x495c('0x2f')]};var _0x23895e={'rejectUnauthorized':![],'method':_0x495c('0x54'),'url':_0x495c('0x55'),'headers':{'X-APIKEY':_0x39aab7[_0x495c('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4405c6[_0x495c('0x39')][_0x495c('0x52')]],'buttons':null,'topic':_0x485aab[_0x495c('0x4f')],'note':_[_0x495c('0x56')](_0x485aab['vidaooNote'])?null:getMustacheRender(_0x485aab[_0x495c('0x50')],_0x3e10f6),'metadata':null},'redirect':_0x495c('0x57'),'json':!![]};try{if(!_[_0x495c('0x56')](_0x485aab['vidaooMetadata'])){var _0x45ce7c=getMustacheRender(_0x485aab[_0x495c('0x51')],_0x3e10f6);var _0x199a6d=JSON[_0x495c('0x58')](_0x45ce7c);_0x23895e[_0x495c('0x2c')][_0x495c('0x59')]=_0x199a6d;}}catch(_0xdf5ccf){throw new db[(_0x495c('0x5a'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x23895e);}else{throw new db[(_0x495c('0x5a'))][(_0x495c('0x5b'))](_0x495c('0x5c'));}})[_0x495c('0x14')](function(_0x3f92fc){_0xfa584=_0x3f92fc;if(_0xfa584['id']){var _0x490d86={'body':_0xfa584[_0x495c('0x5d')],'ChatWebsiteId':_0x485aab['id'],'ChatInteractionId':_0x5eba88['id'],'direction':_0x495c('0x5e'),'UserId':_0x4405c6[_0x495c('0x39')]['id']};return db[_0x495c('0x5f')][_0x495c('0x48')](_0x490d86,{});}else{throw new db[(_0x495c('0x5a'))][(_0x495c('0x5b'))](_0x495c('0x60'));}})[_0x495c('0x14')](function(){return _0x5eba88[_0x495c('0x61')]({'vidaooSessionId':_0xfa584['id']});})['then'](respondWithResult(_0x36e407,null))['catch'](handleError(_0x36e407,null));};exports[_0x495c('0x62')]=function(_0x2bef92,_0x2ae9c0){if(_0x2bef92[_0x495c('0x2c')]['id']){delete _0x2bef92[_0x495c('0x2c')]['id'];}return db[_0x495c('0x45')][_0x495c('0x46')]({'where':{'id':_0x2bef92[_0x495c('0x3a')]['id']},'include':[{'model':db[_0x495c('0x63')],'as':_0x495c('0x64')}]})[_0x495c('0x14')](handleEntityNotFound(_0x2ae9c0,null))[_0x495c('0x14')](saveUpdates(_0x2bef92[_0x495c('0x2c')],null))[_0x495c('0x14')](respondWithResult(_0x2ae9c0,null))[_0x495c('0x47')](handleError(_0x2ae9c0,null));};exports['abandon']=function(_0x3a16f6,_0x418a7e){if(_0x3a16f6[_0x495c('0x2c')]['id']){delete _0x3a16f6[_0x495c('0x2c')]['id'];}return db['ChatInteraction'][_0x495c('0x46')]({'where':{'id':_0x3a16f6['params']['id']}})[_0x495c('0x14')](function(_0x62bf06){if(!_0x62bf06){logger[_0x495c('0x1a')](_0x495c('0x65'),'abandon',0x194,'entity\x20not\x20found');_0x418a7e[_0x495c('0x27')](0x194);}else{if(_0x62bf06['UserId']){throw new db[(_0x495c('0x5a'))][(_0x495c('0x5b'))](_0x495c('0x66'));}}return _0x62bf06;})[_0x495c('0x14')](function(_0x23513e){if(_0x23513e){return _0x23513e[_0x495c('0x49')]({'closed':_0x3a16f6[_0x495c('0x2c')][_0x495c('0x67')],'disposition':_0x3a16f6[_0x495c('0x2c')][_0x495c('0x68')]})[_0x495c('0x14')](function(_0x4f59b2){return _0x4f59b2;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x495c('0x69'),_0x3a16f6[_0x495c('0x2c')],client9004);})[_0x495c('0x14')](respondWithResult(_0x418a7e,null))[_0x495c('0x47')](handleError(_0x418a7e,null));};exports[_0x495c('0x6a')]=function(_0x5da0de,_0x1371a9){_0x5da0de[_0x495c('0x2c')][_0x495c('0x28')]=_0x5da0de[_0x495c('0x6b')][_0x495c('0x6c')];_0x5da0de['body'][_0x495c('0x6d')]=_0x5da0de[_0x495c('0x6b')][_0x495c('0x6e')];_0x5da0de[_0x495c('0x2c')][_0x495c('0x34')]=_0x5da0de['file'][_0x495c('0x6f')];return db[_0x495c('0x70')][_0x495c('0x48')](_0x5da0de['body'])[_0x495c('0x14')](respondWithResult(_0x1371a9,0xc9))['catch'](handleError(_0x1371a9,null));};exports[_0x495c('0x71')]=function(_0xda0f84,_0x59365f){return db[_0x495c('0x45')][_0x495c('0x72')]({'where':{'id':_0xda0f84['params']['id']},'raw':!![]})[_0x495c('0x14')](handleEntityNotFound(_0x59365f,null))[_0x495c('0x14')](function(_0x250d75){if(_0x250d75){if(_0x250d75[_0x495c('0x67')]){return _0x59365f[_0x495c('0x1d')](0x193)['json']({'status':0x193,'message':_0x495c('0x73')});}return db['Attachment'][_0x495c('0x72')]({'where':{'id':_0xda0f84[_0x495c('0x38')]['attachId']},'raw':!![]})[_0x495c('0x14')](handleEntityNotFound(_0x59365f,null));}})[_0x495c('0x14')](function(_0x328691){if(_0x328691){var _0x3b9df4=_0x328691[_0x495c('0x74')]!==null;var _0x956a5c=path['join'](config['root'],_0x495c('0x75'));if(_0x3b9df4){_0x956a5c=path['join'](_0x956a5c,_0x495c('0x76'));}var _0x56110a=path[_0x495c('0x77')](_0x956a5c,_0x328691['basename']);return _0x59365f['download'](_0x56110a);}})['catch'](handleError(_0x59365f,null));};exports['close']=function(_0x5b3a1e,_0x1ce2d4){var _0x3f3b2e=null;var _0x21483a=null;var _0x30dc41=null;if(_0x5b3a1e['body']['id']){delete _0x5b3a1e[_0x495c('0x2c')]['id'];}if(_0x5b3a1e[_0x495c('0x2c')][_0x495c('0x78')]){_0x30dc41=path[_0x495c('0x77')](config['root'],_0x495c('0x79'),util['format'](_0x495c('0x7a'),Date[_0x495c('0x7b')]()));_0x5b3a1e['body'][_0x495c('0x7c')]=_0x30dc41;}return db[_0x495c('0x45')][_0x495c('0x46')]({'where':{'id':_0x5b3a1e[_0x495c('0x3a')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x495c('0x7d'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x495c('0x14')](handleEntityNotFound(_0x1ce2d4,null))[_0x495c('0x14')](saveUpdates(_0x5b3a1e['body'],null))[_0x495c('0x14')](function(_0x5262a1){if(_0x5262a1){_0x3f3b2e=_0x5262a1;return db[_0x495c('0x4b')][_0x495c('0x46')]({'where':{'id':_0x3f3b2e['ChatWebsiteId']}});}})[_0x495c('0x14')](function(_0x3ac6da){if(_0x3ac6da){_0x21483a=_0x3ac6da;return db[_0x495c('0x63')][_0x495c('0x46')]({'where':{'id':_0x3f3b2e[_0x495c('0x7e')]}});}})[_0x495c('0x14')](function(_0x43ac8d){if(_0x43ac8d){if(_0x30dc41){var _0x3b0ddb=null;for(var _0x59a5bd=0x1;_0x59a5bd<_0x3f3b2e[_0x495c('0x7d')]['length'];++_0x59a5bd){_0x3b0ddb=_0x3f3b2e[_0x495c('0x7d')][_0x59a5bd];var _0xa3893c=_0x3b0ddb['UserId']?util[_0x495c('0x7f')](_0x495c('0x80'),_0x21483a[_0x495c('0x81')],_0x3b0ddb['UserId']):'System';var _0x862e6c=_0x5b3a1e['body']['customer']||util[_0x495c('0x7f')](_0x495c('0x80'),_0x495c('0x82'),_0x3b0ddb[_0x495c('0x7e')]);switch(_0x21483a[_0x495c('0x83')]){case _0x495c('0x84'):_0xa3893c=_0x3b0ddb[_0x495c('0x85')]?util[_0x495c('0x7f')](_0x495c('0x80'),_0x21483a[_0x495c('0x81')],_0x3b0ddb[_0x495c('0x85')]):'System';break;case _0x495c('0x86'):_0xa3893c=_0x3b0ddb[_0x495c('0x85')]?_0x3b0ddb[_0x495c('0x87')]['alias']||_0x3b0ddb['User'][_0x495c('0x88')]:_0x495c('0x89');break;case _0x495c('0x8a'):_0xa3893c=_0x3b0ddb['UserId']?_0x3b0ddb[_0x495c('0x87')][_0x495c('0x88')]:'System';break;default:_0xa3893c=_0x3b0ddb['UserId']?util['format']('%s%d',_0x21483a[_0x495c('0x81')],_0x3b0ddb[_0x495c('0x85')]):_0x495c('0x89');}var _0x26952b=util[_0x495c('0x7f')](_0x495c('0x8b'),moment(_0x3b0ddb[_0x495c('0x8c')])[_0x495c('0x7f')](_0x495c('0x8d')),_0x3b0ddb['direction']==='in'?_0x862e6c:_0xa3893c,_0x3b0ddb[_0x495c('0x2c')]);if(!_0x3b0ddb[_0x495c('0x8e')]){fs[_0x495c('0x8f')](_0x30dc41,_0x26952b);}}return db[_0x495c('0x90')][_0x495c('0x72')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x495c('0x91'),'raw':!![],'include':[{'model':db[_0x495c('0x92')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x495c('0x14')](function(_0x17785d){if(!_0x17785d||!_0x17785d[_0x495c('0x91')]||!_0x5b3a1e[_0x495c('0x2c')])return _0x3f3b2e;var _0x4efb46=_0x17785d['getSmtpOptions']();return respondWithRpcPromise(_0x495c('0x93'),_0x495c('0x94'),{'account':_0x4efb46,'message':{'from':util[_0x495c('0x7f')](_0x495c('0x95'),_0x17785d[_0x495c('0x28')],_0x17785d[_0x495c('0x52')]||_0x17785d[_0x495c('0x91')][_0x495c('0x39')]),'to':_0x5b3a1e[_0x495c('0x2c')][_0x495c('0x78')],'subject':_0x495c('0x96'),'text':util[_0x495c('0x7f')](_0x495c('0x97'),_0x5b3a1e['body'][_0x495c('0x78')]),'attachments':[{'path':_0x30dc41}]}})[_0x495c('0x14')](function(){return _0x3f3b2e;})[_0x495c('0x47')](function(_0x34007e){logger[_0x495c('0x1a')](_0x34007e);});})[_0x495c('0x14')](respondWithStatusCode(_0x1ce2d4,0xc8))[_0x495c('0x47')](handleError(_0x1ce2d4,null));};exports[_0x495c('0x98')]=function(_0x3ae5aa,_0x20b760){return db[_0x495c('0x5f')][_0x495c('0x46')]({'where':{'id':_0x3ae5aa['params']['id']}})[_0x495c('0x14')](handleEntityNotFound(_0x20b760,null))[_0x495c('0x14')](function(_0x2f00f0){if(_0x2f00f0){return _0x2f00f0['addMessage'](_0x3ae5aa[_0x495c('0x2c')][_0x495c('0x99')],_['omit'](_0x3ae5aa['body'],[_0x495c('0x99'),'id'])||{});}})['then'](respondWithResult(_0x20b760,null))[_0x495c('0x47')](handleError(_0x20b760,null));};exports[_0x495c('0x9a')]=function(_0x50577e,_0x150bc6){var _0xf60b19={'raw':![],'where':{}};var _0x1b5c16={};var _0x2f8f4a={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x495c('0x72')]({'where':{'id':_0x50577e['params']['id']}})[_0x495c('0x14')](handleEntityNotFound(_0x150bc6,null))[_0x495c('0x14')](function(_0x370012){if(_0x370012){_0x1b5c16[_0x495c('0x3b')]=_[_0x495c('0x3c')](db['ChatMessage'][_0x495c('0x32')]);_0x1b5c16[_0x495c('0x38')]=_[_0x495c('0x3c')](_0x50577e[_0x495c('0x38')]);_0x1b5c16[_0x495c('0x3d')]=_[_0x495c('0x3e')](_0x1b5c16[_0x495c('0x3b')],_0x1b5c16[_0x495c('0x38')]);_0xf60b19['attributes']=_[_0x495c('0x3e')](_0x1b5c16[_0x495c('0x3b')],qs[_0x495c('0x40')](_0x50577e['query']['fields']));_0xf60b19[_0x495c('0x3f')]=_0xf60b19['attributes'][_0x495c('0x41')]?_0xf60b19[_0x495c('0x3f')]:_0x1b5c16[_0x495c('0x3b')];if(!_0x50577e[_0x495c('0x38')][_0x495c('0x9b')]('nolimit')){_0xf60b19['limit']=qs[_0x495c('0x21')](_0x50577e[_0x495c('0x38')][_0x495c('0x21')]);_0xf60b19[_0x495c('0x23')]=qs['offset'](_0x50577e[_0x495c('0x38')]['offset']);}_0xf60b19[_0x495c('0x9c')]=qs[_0x495c('0x9d')](_0x50577e[_0x495c('0x38')][_0x495c('0x9d')]);_0xf60b19[_0x495c('0x9e')]=qs['filters'](_[_0x495c('0x9f')](_0x50577e[_0x495c('0x38')],_0x1b5c16[_0x495c('0x3d')]));_0xf60b19[_0x495c('0x9e')][_0x495c('0xa0')]=_0x370012['id'];if(_0x50577e[_0x495c('0x38')][_0x495c('0xa1')]){_0xf60b19[_0x495c('0x9e')]=_['merge'](_0xf60b19[_0x495c('0x9e')],{'$or':_[_0x495c('0x31')](_0xf60b19[_0x495c('0x3f')],function(_0x2b0d42){var _0x4ca57b={};_0x4ca57b[_0x2b0d42]={'$like':'%'+_0x50577e[_0x495c('0x38')][_0x495c('0xa1')]+'%'};return _0x4ca57b;})});}if(_0x50577e[_0x495c('0x38')][_0x495c('0xa2')]){var _0x4ada27=_0x50577e['query'][_0x495c('0xa2')]['split'](',');var _0x12a828={};_0x12a828[_0x4ada27[0x0]]={'$gte':moment(_0x4ada27[0x1])[_0x495c('0x7f')](_0x495c('0xa3'))};_0xf60b19[_0x495c('0x9e')]=_['merge'](_0xf60b19[_0x495c('0x9e')],_0x12a828);}_0xf60b19=_['merge']({},_0xf60b19,_0x50577e[_0x495c('0x44')]);return db[_0x495c('0x5f')]['count']({'where':_0xf60b19[_0x495c('0x9e')]})[_0x495c('0x14')](function(_0xf6ac23){_0x2f8f4a[_0x495c('0x22')]=_0xf6ac23;if(_0x50577e[_0x495c('0x38')][_0x495c('0x42')]){_0xf60b19[_0x495c('0x43')]=[{'all':!![]}];}return db[_0x495c('0x5f')]['findAll'](_0xf60b19);})[_0x495c('0x14')](function(_0x41f243){_0x2f8f4a[_0x495c('0xa4')]=_0x41f243;return _0x2f8f4a;});}})[_0x495c('0x14')](respondWithFilteredResult(_0x150bc6,_0xf60b19))['catch'](handleError(_0x150bc6,null));};exports[_0x495c('0xa5')]=function(_0x5279ec,_0x52f16a){var _0x57a084={'where':{}},_0x275d90={},_0x4b7c43={'count':0x0,'rows':[]};return db[_0x495c('0x45')][_0x495c('0x72')]({'where':{'id':_0x5279ec[_0x495c('0x3a')]['id']}})[_0x495c('0x14')](handleEntityNotFound(_0x52f16a,null))[_0x495c('0x14')](function(_0x1d804f){if(_0x1d804f){_0x275d90[_0x495c('0x3b')]=_[_0x495c('0x3c')](db[_0x495c('0x5f')][_0x495c('0x32')]);_0x275d90[_0x495c('0x38')]=_['keys'](_0x5279ec[_0x495c('0x38')]);_0x275d90[_0x495c('0x3d')]=_['intersection'](_0x275d90['model'],_0x275d90['query']);_0x57a084[_0x495c('0x3f')]=_[_0x495c('0x3e')](_0x275d90[_0x495c('0x3b')],qs[_0x495c('0x40')](_0x5279ec[_0x495c('0x38')][_0x495c('0x40')]));_0x57a084['attributes']=_0x57a084[_0x495c('0x3f')][_0x495c('0x41')]?_0x57a084[_0x495c('0x3f')]:_0x275d90['model'];if(!_0x5279ec[_0x495c('0x38')][_0x495c('0x9b')](_0x495c('0xa6'))){_0x57a084[_0x495c('0x21')]=qs[_0x495c('0x21')](_0x5279ec[_0x495c('0x38')][_0x495c('0x21')]);_0x57a084[_0x495c('0x23')]=qs[_0x495c('0x23')](_0x5279ec[_0x495c('0x38')][_0x495c('0x23')]);}_0x57a084['order']=qs[_0x495c('0x9d')](_0x5279ec[_0x495c('0x38')][_0x495c('0x9d')]);_0x57a084[_0x495c('0x9e')]=qs[_0x495c('0x3d')](_[_0x495c('0x9f')](_0x5279ec[_0x495c('0x38')],_0x275d90[_0x495c('0x3d')]));_0x57a084[_0x495c('0x9e')][_0x495c('0xa0')]=_0x1d804f['id'];if(_0x5279ec[_0x495c('0x38')][_0x495c('0xa1')]){_0x57a084['where']=_['merge'](_0x57a084[_0x495c('0x9e')],{'$or':_[_0x495c('0x31')](_0x57a084[_0x495c('0x3f')],function(_0x3ad5eb){var _0x8df879={};_0x8df879[_0x3ad5eb]={'$like':'%'+_0x5279ec[_0x495c('0x38')][_0x495c('0xa1')]+'%'};return _0x8df879;})});}_0x57a084[_0x495c('0x9e')][_0x495c('0x8e')]=![];if(_0x5279ec['query']['id']){_0x57a084[_0x495c('0x9e')]['id']={'$gt':_0x5279ec[_0x495c('0x38')]['id']};}_0x57a084=_['merge']({},_0x57a084,_0x5279ec[_0x495c('0x44')]);return db[_0x495c('0x5f')][_0x495c('0x22')]({'where':_0x57a084[_0x495c('0x9e')]})[_0x495c('0x14')](function(_0x24d05c){_0x4b7c43['count']=_0x24d05c;_0x57a084[_0x495c('0x43')]=[];if(_0x5279ec['query'][_0x495c('0xa7')]){_0x57a084[_0x495c('0x43')][_0x495c('0xa8')]({'model':db['User'],'as':_0x495c('0x87'),'attributes':['id',_0x495c('0x88'),_0x495c('0xa9')]});}if(_0x5279ec[_0x495c('0x38')][_0x495c('0x42')]){_0x57a084[_0x495c('0x43')]=[{'all':!![]}];}return db[_0x495c('0x5f')][_0x495c('0xaa')](_0x57a084);})['then'](function(_0x50527c){_0x4b7c43[_0x495c('0xa4')]=_0x50527c;return _0x4b7c43;});}})[_0x495c('0x14')](respondWithFilteredResult(_0x52f16a,_0x57a084))[_0x495c('0x47')](handleError(_0x52f16a,null));};exports[_0x495c('0xab')]=function(_0x2e3b5d,_0x1ca03c){return db[_0x495c('0x45')][_0x495c('0x46')]({'where':{'id':_0x2e3b5d['params']['id']}})[_0x495c('0x14')](handleEntityNotFound(_0x1ca03c,null))[_0x495c('0x14')](function(_0x19c257){if(_0x19c257){return _0x19c257['setTags'](_0x2e3b5d['body'][_0x495c('0x99')],_[_0x495c('0xac')](_0x2e3b5d[_0x495c('0x2c')],['ids','id'])||{})[_0x495c('0xad')](function(){return db['Tag'][_0x495c('0xaa')]({'attributes':['id','name',_0x495c('0xae')],'where':{'id':_0x2e3b5d[_0x495c('0x2c')][_0x495c('0x99')]}});})[_0x495c('0x14')](function(_0x6b13a5){socket[_0x495c('0xaf')](_0x495c('0xb0'),{'id':Number(_0x2e3b5d[_0x495c('0x3a')]['id']),'tags':_0x6b13a5||[]});return{'id':Number(_0x2e3b5d[_0x495c('0x3a')]['id']),'tags':_0x6b13a5||[]};});}})[_0x495c('0x14')](respondWithResult(_0x1ca03c,null))[_0x495c('0x47')](handleError(_0x1ca03c,null));};exports['removeTags']=function(_0x48cd74,_0x9342e4){return db[_0x495c('0x45')][_0x495c('0x46')]({'where':{'id':_0x48cd74[_0x495c('0x3a')]['id']}})['then'](handleEntityNotFound(_0x9342e4,null))[_0x495c('0x14')](function(_0x2fa82d){if(_0x2fa82d){return _0x2fa82d[_0x495c('0xb1')](_0x48cd74['query'][_0x495c('0x99')]);}})[_0x495c('0x14')](respondWithStatusCode(_0x9342e4,null))[_0x495c('0x47')](handleError(_0x9342e4,null));};exports['download']=function(_0x3d4600,_0xe18db4){var _0x416249=moment()[_0x495c('0xb2')]()[_0x495c('0xb3')]();var _0x27e62a=path[_0x495c('0x77')](config[_0x495c('0xb4')],_0x495c('0xb5'),_0x495c('0xb6'),'tmp');var _0x244972=path[_0x495c('0x77')](config[_0x495c('0xb4')],_0x495c('0xb5'),'files',_0x495c('0xb7'));var _0x4c8c85=path[_0x495c('0x77')](_0x27e62a,_0x416249);var _0x3212b3=util[_0x495c('0x7f')](_0x495c('0xb8'),_0x3d4600[_0x495c('0x3a')]['id'],_0x416249);var _0x563f74=path[_0x495c('0x77')](_0x27e62a,_0x3212b3);var _0x268460=[];_0x268460[_0x495c('0xa8')]({'model':db['User'],'as':'User','attributes':['id',_0x495c('0x88')],'raw':!![]});_0x268460[_0x495c('0xa8')]({'model':db['CmContact'],'as':_0x495c('0x64'),'attributes':['id',_0x495c('0xb9'),_0x495c('0xba')],'raw':!![]});if(_0x3d4600['query'][_0x495c('0xb7')]){_0x268460[_0x495c('0xa8')]({'model':db[_0x495c('0x70')],'as':_0x495c('0x70'),'raw':!![]});}var _0x1dcb0e=[{'model':db[_0x495c('0x5f')],'as':_0x495c('0x7d'),'attributes':['id',_0x495c('0x2c'),_0x495c('0x8c'),_0x495c('0xbb'),'secret',_0x495c('0xbc')],'include':_0x268460}];_0x1dcb0e[_0x495c('0xa8')]({'model':db[_0x495c('0x4b')],'as':'Account','attributes':['id',_0x495c('0x28')]});_0x1dcb0e['push']({'model':db[_0x495c('0x87')],'as':_0x495c('0xbd'),'attributes':['id','fullname']});return db[_0x495c('0x45')][_0x495c('0x46')]({'where':{'id':_0x3d4600[_0x495c('0x3a')]['id']},'include':_0x1dcb0e})[_0x495c('0x14')](handleEntityNotFound(_0xe18db4,null))['then'](function(_0x40d15b){if(_0x40d15b){var _0x44c1ac=_0x40d15b['get']({'plain':!![]});fs[_0x495c('0xbe')](_0x4c8c85);var _0x352ee5={'channel':_0x495c('0xbf'),'account':_0x44c1ac[_0x495c('0xc0')][_0x495c('0x28')],'agent':_0x44c1ac[_0x495c('0xbd')]?_0x44c1ac[_0x495c('0xbd')][_0x495c('0x88')]:_0x495c('0xc1'),'createdAt':moment(_0x44c1ac['createdAt'])[_0x495c('0x7f')](_0x495c('0xa3'))[_0x495c('0xb3')](),'closedAt':_0x44c1ac[_0x495c('0x67')]?moment(_0x44c1ac['closedAt'])[_0x495c('0x7f')](_0x495c('0xa3'))[_0x495c('0xb3')]():'','disposition':_0x44c1ac[_0x495c('0x68')],'chatInfo':{'browser':_0x44c1ac['browserName'],'os':_0x44c1ac[_0x495c('0xc2')],'referer':_0x44c1ac['referer'],'customerIp':_0x44c1ac[_0x495c('0xc3')],'customerPort':_0x44c1ac[_0x495c('0xc4')]?_0x44c1ac[_0x495c('0xc4')]:_0x495c('0xc1')},'messages':_(_0x44c1ac[_0x495c('0x7d')])[_0x495c('0xc5')]()[_0x495c('0xa1')]({'secret':![]})['map'](function(_0x2ef042){if(_0x2ef042[_0x495c('0x70')]){var _0x80dd85=path[_0x495c('0x77')](_0x244972,_0x2ef042[_0x495c('0x70')]['basename']);if(fs[_0x495c('0xc6')](_0x80dd85)){fs[_0x495c('0xc7')](_0x80dd85)[_0x495c('0xc8')](fs[_0x495c('0xc9')](path[_0x495c('0x77')](_0x4c8c85,_0x2ef042[_0x495c('0x70')][_0x495c('0x6d')])));}}return{'date':moment(_0x2ef042[_0x495c('0x8c')])[_0x495c('0x7f')](_0x495c('0xa3'))[_0x495c('0xb3')](),'sender':_0x2ef042[_0x495c('0xbb')]===_0x495c('0x5e')?_0x2ef042[_0x495c('0x87')]?_0x2ef042[_0x495c('0x87')]['fullname']:_0x495c('0x89'):_0x2ef042[_0x495c('0x64')][_0x495c('0xb9')]+(_0x2ef042[_0x495c('0x64')][_0x495c('0xba')]?'\x20'+_0x2ef042[_0x495c('0x64')]['lastName']:''),'body':_0x2ef042[_0x495c('0x70')]?_0x2ef042[_0x495c('0x70')]['basename']:_0x2ef042[_0x495c('0x2c')],'direction':_0x2ef042[_0x495c('0xbb')]==='out'?'A':'C','secret':_0x2ef042['secret'],'read':_0x2ef042[_0x495c('0xbc')],'attachment':_0x2ef042[_0x495c('0x70')]};})[_0x495c('0xca')]()};return ejs[_0x495c('0xcb')](path[_0x495c('0x77')](config[_0x495c('0xb4')],_0x495c('0xb5'),_0x495c('0xcc'),_0x495c('0xcd')),{'interaction':_0x352ee5})[_0x495c('0x14')](function(_0x4f35bf){var _0x571212=path['join'](_0x4c8c85,_0x495c('0xce')+_0x44c1ac['id']+'-'+_0x416249+_0x495c('0xcf'));var _0x3e5399={'path':_0x571212,'channel':_0x495c('0xbf'),'interactionId':_0x44c1ac['id']};return pdf[_0x495c('0xd0')](_0x4f35bf,_0x3e5399);})[_0x495c('0x14')](function(){return new Promise(function(_0xe23150,_0x5a0290){zipdir(_0x4c8c85,{'saveTo':_0x563f74},function(_0x447ae7,_0x4b5e79){if(_0x447ae7)return _0x5a0290(_0x447ae7);return _0xe23150(_0x4b5e79);});})[_0x495c('0x14')](function(){return new BPromise(function(_0x5bb01d,_0x476d21){rimraf(_0x4c8c85,function(_0x5d74d9){if(_0x5d74d9)_0x476d21(_0x5d74d9);return _0x5bb01d();});});})[_0x495c('0x14')](function(){return _0xe18db4[_0x495c('0xd1')](_0x563f74,_0x3212b3,function(_0x5a379b){if(_0x5a379b){logger[_0x495c('0x1a')]('err',_0x5a379b);}else{fs[_0x495c('0xd2')](_0x563f74);}});});});}else{return _0xe18db4[_0x495c('0x27')](0xc8);}})['catch'](handleError(_0xe18db4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index deab900..029af46 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 _0x8a9d=['hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','then','setDataValue','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a9d,0x162));var _0xd8a9=function(_0x4250b4,_0x3fd543){_0x4250b4=_0x4250b4-0x0;var _0x8a4807=_0x8a9d[_0x4250b4];return _0x8a4807;};'use strict';var EventEmitter=require(_0xd8a9('0x0'));var ChatInteraction=require(_0xd8a9('0x1'))['db'][_0xd8a9('0x2')];var ChatMessage=require(_0xd8a9('0x1'))['db'][_0xd8a9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xd8a9('0x4')](0x0);var events={'afterCreate':_0xd8a9('0x5'),'afterUpdate':'update','afterDestroy':_0xd8a9('0x6')};function emitEvent(_0x2b0e2a){return function(_0x153529,_0x3d24b7,_0x18d4eb){_0x153529['getUsers']({'attributes':['id'],'raw':!![]})[_0xd8a9('0x7')](function(_0x14351d){_0x153529[_0xd8a9('0x8')]('Users',_0x14351d['map'](function(_0x311012){return{'id':_0x311012['id']};}));return ChatMessage[_0xd8a9('0x9')]({'where':{'ChatInteractionId':_0x153529['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd8a9('0x7')](function(_0x3294dd){_0x153529[_0xd8a9('0x8')](_0xd8a9('0xa'),_0x3294dd['length']);ChatInteractionEvents[_0xd8a9('0xb')](_0x2b0e2a+':'+_0x153529['id'],_0x153529);ChatInteractionEvents[_0xd8a9('0xb')](_0x2b0e2a,_0x153529);_0x18d4eb(null);})[_0xd8a9('0xc')](_0x18d4eb(null));};}for(var e in events){if(events[_0xd8a9('0xd')](e)){var event=events[e];ChatInteraction[_0xd8a9('0xe')](e,emitEvent(event));}}module[_0xd8a9('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x2e94=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0xc587ed,_0x11cbc2){var _0x41d137=function(_0x2d288f){while(--_0x2d288f){_0xc587ed['push'](_0xc587ed['shift']());}};_0x41d137(++_0x11cbc2);}(_0x2e94,0x68));var _0x42e9=function(_0x126359,_0x59fd24){_0x126359=_0x126359-0x0;var _0x2db227=_0x2e94[_0x126359];return _0x2db227;};'use strict';var EventEmitter=require(_0x42e9('0x0'));var ChatInteraction=require(_0x42e9('0x1'))['db'][_0x42e9('0x2')];var ChatMessage=require(_0x42e9('0x1'))['db'][_0x42e9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x42e9('0x4')](0x0);var events={'afterCreate':_0x42e9('0x5'),'afterUpdate':'update','afterDestroy':_0x42e9('0x6')};function emitEvent(_0x5b26f4){return function(_0x39d2ce,_0x1bb80d,_0xb28b02){_0x39d2ce[_0x42e9('0x7')]({'attributes':['id'],'raw':!![]})[_0x42e9('0x8')](function(_0x14b9fa){_0x39d2ce[_0x42e9('0x9')](_0x42e9('0xa'),_0x14b9fa[_0x42e9('0xb')](function(_0x9dd01){return{'id':_0x9dd01['id']};}));return ChatMessage[_0x42e9('0xc')]({'where':{'ChatInteractionId':_0x39d2ce['id'],'direction':'in','read':![]},'raw':!![]});})[_0x42e9('0x8')](function(_0x4ffc66){_0x39d2ce[_0x42e9('0x9')](_0x42e9('0xd'),_0x4ffc66['length']);ChatInteractionEvents['emit'](_0x5b26f4+':'+_0x39d2ce['id'],_0x39d2ce);ChatInteractionEvents[_0x42e9('0xe')](_0x5b26f4,_0x39d2ce);_0xb28b02(null);})[_0x42e9('0xf')](_0xb28b02(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x42e9('0x10')](e,emitEvent(event));}}module[_0x42e9('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4846e76..7d26a08 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 _0xbb38=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4'];(function(_0x22b0cb,_0x5a764a){var _0x444178=function(_0x5aed3d){while(--_0x5aed3d){_0x22b0cb['push'](_0x22b0cb['shift']());}};_0x444178(++_0x5a764a);}(_0xbb38,0x177));var _0x8bb3=function(_0x1c8c07,_0x2579af){_0x1c8c07=_0x1c8c07-0x0;var _0x4aa88f=_0xbb38[_0x1c8c07];return _0x4aa88f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8bb3('0x0'));var BPromise=require(_0x8bb3('0x1'));var rp=require(_0x8bb3('0x2'));var fs=require('fs');var path=require(_0x8bb3('0x3'));var rimraf=require(_0x8bb3('0x4'));var config=require(_0x8bb3('0x5'));var attributes=require(_0x8bb3('0x6'));module['exports']=function(_0x3bfa50,_0x5efe7e){return _0x3bfa50[_0x8bb3('0x7')](_0x8bb3('0x8'),attributes,{'tableName':_0x8bb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50c67d,_0x2acbe3,_0x31547b){if(_0x50c67d[_0x8bb3('0xa')](_0x8bb3('0xb'))){_0x50c67d[_0x8bb3('0xc')]=moment()[_0x8bb3('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x31547b(null,_0x50c67d);}},'charset':_0x8bb3('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xeb9f=['format','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x449aae,_0x394f3d){var _0x3ba2ae=function(_0x206d6f){while(--_0x206d6f){_0x449aae['push'](_0x449aae['shift']());}};_0x3ba2ae(++_0x394f3d);}(_0xeb9f,0x173));var _0xfeb9=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xeb9f[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require('lodash');var util=require(_0xfeb9('0x0'));var logger=require(_0xfeb9('0x1'))(_0xfeb9('0x2'));var moment=require(_0xfeb9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfeb9('0x4'));var rimraf=require(_0xfeb9('0x5'));var config=require('../../config/environment');var attributes=require(_0xfeb9('0x6'));module[_0xfeb9('0x7')]=function(_0x16a101,_0x19228d){return _0x16a101[_0xfeb9('0x8')](_0xfeb9('0x9'),attributes,{'tableName':_0xfeb9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19eeb9,_0x513f8b,_0x3e9fac){if(_0x19eeb9[_0xfeb9('0xb')](_0xfeb9('0xc'))){_0x19eeb9['closedAt']=moment()[_0xfeb9('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3e9fac(null,_0x19eeb9);}},'charset':_0xfeb9('0xe'),'collate':_0xfeb9('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d5cc615..07e5de4 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 _0x786f=['info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then'];(function(_0x2b74c8,_0x82f97f){var _0x339692=function(_0x5d07f4){while(--_0x5d07f4){_0x2b74c8['push'](_0x2b74c8['shift']());}};_0x339692(++_0x82f97f);}(_0x786f,0x9c));var _0xf786=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x786f[_0x20fb02];return _0x24a33e;};'use strict';var _=require(_0xf786('0x0'));var util=require(_0xf786('0x1'));var moment=require(_0xf786('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf786('0x3'));var db=require(_0xf786('0x4'))['db'];var utils=require(_0xf786('0x5'));var logger=require(_0xf786('0x6'))(_0xf786('0x7'));var config=require(_0xf786('0x8'));var jayson=require(_0xf786('0x9'));var client=jayson[_0xf786('0xa')][_0xf786('0xb')]({'port':0x232a});config[_0xf786('0xc')]=_[_0xf786('0xd')](config[_0xf786('0xc')],{'host':_0xf786('0xe'),'port':0x18eb});var socket=require(_0xf786('0xf'))(new Redis(config[_0xf786('0xc')]));require(_0xf786('0x10'))[_0xf786('0x11')](socket);function respondWithRpcPromise(_0x4340c2,_0xbd312,_0x48d823){return new BPromise(function(_0x444796,_0x2ec530){return client[_0xf786('0x12')](_0x4340c2,_0x48d823)[_0xf786('0x13')](function(_0x2c3b55){logger[_0xf786('0x14')](_0xf786('0x15'),_0xbd312,'request\x20sent');logger[_0xf786('0x16')](_0xf786('0x17'),_0xbd312,'request\x20sent',JSON[_0xf786('0x18')](_0x2c3b55));if(_0x2c3b55[_0xf786('0x19')]){if(_0x2c3b55[_0xf786('0x19')]['code']===0x1f4){logger[_0xf786('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xbd312,_0x2c3b55[_0xf786('0x19')]['message']);return _0x2ec530(_0x2c3b55[_0xf786('0x19')][_0xf786('0x1a')]);}logger[_0xf786('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xbd312,_0x2c3b55[_0xf786('0x19')]['message']);return _0x444796(_0x2c3b55[_0xf786('0x19')]['message']);}else{logger[_0xf786('0x14')](_0xf786('0x15'),_0xbd312,'request\x20sent');_0x444796(_0x2c3b55['result'][_0xf786('0x1a')]);}})['catch'](function(_0x12bd62){logger[_0xf786('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xbd312,_0x12bd62);_0x2ec530(_0x12bd62);});});}exports[_0xf786('0x1b')]=function(_0x47d546){var _0x126d59=this;return new Promise(function(_0x34bd2f,_0x1345ee){return db[_0xf786('0x1c')][_0xf786('0x1d')](_0x47d546[_0xf786('0x1e')],{'raw':_0x47d546['options']?_0x47d546[_0xf786('0x1f')][_0xf786('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d546['options']?_0x47d546[_0xf786('0x1f')][_0xf786('0x21')]||null:null,'attributes':_0x47d546['options']?_0x47d546[_0xf786('0x1f')][_0xf786('0x22')]||null:null,'limit':_0x47d546[_0xf786('0x1f')]?_0x47d546[_0xf786('0x1f')][_0xf786('0x23')]||null:null})[_0xf786('0x13')](function(_0x3dfb89){logger[_0xf786('0x14')](_0xf786('0x1b'),_0x47d546);logger['debug'](_0xf786('0x1b'),_0x47d546,JSON[_0xf786('0x18')](_0x3dfb89));_0x34bd2f(_0x3dfb89);})[_0xf786('0x24')](function(_0x4c19b9){logger['error'](_0xf786('0x1b'),_0x4c19b9[_0xf786('0x1a')],_0x47d546);_0x1345ee(_0x126d59['error'](0x1f4,_0x4c19b9[_0xf786('0x1a')]));});});};exports[_0xf786('0x25')]=function(_0x1dae8d){return new Promise(function(_0x525e8f,_0x4d6f69){return db['ChatInteraction'][_0xf786('0x26')]({'where':_0x1dae8d['options']?_0x1dae8d[_0xf786('0x1f')][_0xf786('0x21')]||null:null})[_0xf786('0x13')](function(_0x564d11){if(_0x564d11){return _0x564d11[_0xf786('0x27')](_0x1dae8d[_0xf786('0x1e')][_0xf786('0x28')],_[_0xf786('0x29')](_0x1dae8d[_0xf786('0x1e')],['ids','id'])||{});}})[_0xf786('0x2a')](function(_0x24146c){logger['info'](_0xf786('0x2b'),_0x1dae8d);logger[_0xf786('0x16')](_0xf786('0x2b'),_0x1dae8d,JSON[_0xf786('0x18')](_0x24146c));_0x525e8f(_0x24146c);})[_0xf786('0x24')](function(_0x21eafb){logger[_0xf786('0x19')](_0xf786('0x2b'),_0x21eafb[_0xf786('0x1a')],_0x1dae8d);_0x4d6f69(_this[_0xf786('0x19')](0x1f4,_0x21eafb['message']));});});}; \ No newline at end of file +var _0xfcb1=['omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','find','addTags','ids'];(function(_0x3bc3cf,_0x252ce9){var _0x2b66b3=function(_0x487930){while(--_0x487930){_0x3bc3cf['push'](_0x3bc3cf['shift']());}};_0x2b66b3(++_0x252ce9);}(_0xfcb1,0xaf));var _0x1fcb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfcb1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1fcb('0x0'));var util=require(_0x1fcb('0x1'));var moment=require(_0x1fcb('0x2'));var BPromise=require('bluebird');var rs=require(_0x1fcb('0x3'));var fs=require('fs');var Redis=require(_0x1fcb('0x4'));var db=require(_0x1fcb('0x5'))['db'];var utils=require(_0x1fcb('0x6'));var logger=require(_0x1fcb('0x7'))(_0x1fcb('0x8'));var config=require(_0x1fcb('0x9'));var jayson=require(_0x1fcb('0xa'));var client=jayson['client'][_0x1fcb('0xb')]({'port':0x232a});config[_0x1fcb('0xc')]=_[_0x1fcb('0xd')](config[_0x1fcb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1fcb('0xe'))(new Redis(config[_0x1fcb('0xc')]));require(_0x1fcb('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ee0b4,_0x49a245,_0x802fb4){return new BPromise(function(_0x3f6003,_0x24859d){return client[_0x1fcb('0x10')](_0x5ee0b4,_0x802fb4)[_0x1fcb('0x11')](function(_0x106627){logger[_0x1fcb('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x49a245,_0x1fcb('0x13'));logger[_0x1fcb('0x14')](_0x1fcb('0x15'),_0x49a245,_0x1fcb('0x13'),JSON[_0x1fcb('0x16')](_0x106627));if(_0x106627[_0x1fcb('0x17')]){if(_0x106627[_0x1fcb('0x17')][_0x1fcb('0x18')]===0x1f4){logger['error'](_0x1fcb('0x19'),_0x49a245,_0x106627[_0x1fcb('0x17')][_0x1fcb('0x1a')]);return _0x24859d(_0x106627[_0x1fcb('0x17')]['message']);}logger[_0x1fcb('0x17')](_0x1fcb('0x19'),_0x49a245,_0x106627[_0x1fcb('0x17')]['message']);return _0x3f6003(_0x106627[_0x1fcb('0x17')][_0x1fcb('0x1a')]);}else{logger[_0x1fcb('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x49a245,_0x1fcb('0x13'));_0x3f6003(_0x106627[_0x1fcb('0x1b')][_0x1fcb('0x1a')]);}})[_0x1fcb('0x1c')](function(_0x364a50){logger[_0x1fcb('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x49a245,_0x364a50);_0x24859d(_0x364a50);});});}exports[_0x1fcb('0x1d')]=function(_0x145778){var _0x45b7d1=this;return new Promise(function(_0x466517,_0x599a3f){return db[_0x1fcb('0x1e')][_0x1fcb('0x1f')](_0x145778[_0x1fcb('0x20')],{'raw':_0x145778['options']?_0x145778['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145778[_0x1fcb('0x21')]?_0x145778[_0x1fcb('0x21')][_0x1fcb('0x22')]||null:null,'attributes':_0x145778[_0x1fcb('0x21')]?_0x145778[_0x1fcb('0x21')][_0x1fcb('0x23')]||null:null,'limit':_0x145778[_0x1fcb('0x21')]?_0x145778['options'][_0x1fcb('0x24')]||null:null})['then'](function(_0x20e8dc){logger[_0x1fcb('0x12')](_0x1fcb('0x1d'),_0x145778);logger['debug']('UpdateChatInteraction',_0x145778,JSON[_0x1fcb('0x16')](_0x20e8dc));_0x466517(_0x20e8dc);})[_0x1fcb('0x1c')](function(_0x2344c4){logger[_0x1fcb('0x17')](_0x1fcb('0x1d'),_0x2344c4['message'],_0x145778);_0x599a3f(_0x45b7d1[_0x1fcb('0x17')](0x1f4,_0x2344c4[_0x1fcb('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x504037){return new Promise(function(_0x335c28,_0x509fdc){return db['ChatInteraction'][_0x1fcb('0x25')]({'where':_0x504037[_0x1fcb('0x21')]?_0x504037[_0x1fcb('0x21')][_0x1fcb('0x22')]||null:null})['then'](function(_0x4ce880){if(_0x4ce880){return _0x4ce880[_0x1fcb('0x26')](_0x504037[_0x1fcb('0x20')][_0x1fcb('0x27')],_[_0x1fcb('0x28')](_0x504037[_0x1fcb('0x20')],['ids','id'])||{});}})[_0x1fcb('0x29')](function(_0x2bb669){logger[_0x1fcb('0x12')]('AddTags',_0x504037);logger[_0x1fcb('0x14')](_0x1fcb('0x2a'),_0x504037,JSON['stringify'](_0x2bb669));_0x335c28(_0x2bb669);})[_0x1fcb('0x1c')](function(_0x10ddba){logger['error'](_0x1fcb('0x2a'),_0x10ddba[_0x1fcb('0x1a')],_0x504037);_0x509fdc(_this[_0x1fcb('0x17')](0x1f4,_0x10ddba[_0x1fcb('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2110e44..ab46917 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 _0x8388=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x8388,0x18d));var _0x8838=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x8388[_0x1057a3];return _0x131cdb;};'use strict';var ChatInteractionEvents=require(_0x8838('0x0'));var events=[_0x8838('0x1'),_0x8838('0x2'),_0x8838('0x3')];function createListener(_0x5307bd,_0x140ee6){return function(_0x3dbcd4){_0x140ee6[_0x8838('0x4')](_0x5307bd,_0x3dbcd4);};}function removeListener(_0x20a813,_0xd474f2){return function(){ChatInteractionEvents['removeListener'](_0x20a813,_0xd474f2);};}exports[_0x8838('0x5')]=function(_0x471568){for(var _0x49cac2=0x0,_0xca2d0f=events[_0x8838('0x6')];_0x49cac2<_0xca2d0f;_0x49cac2++){var _0x27707c=events[_0x49cac2];var _0x56596f=createListener(_0x8838('0x7')+_0x27707c,_0x471568);ChatInteractionEvents['on'](_0x27707c,_0x56596f);}}; \ No newline at end of file +var _0xa9d7=['remove','length','./chatInteraction.events'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xa9d7,0x134));var _0x7a9d=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0xa9d7[_0x254076];return _0x21a93e;};'use strict';var ChatInteractionEvents=require(_0x7a9d('0x0'));var events=['save',_0x7a9d('0x1'),'update'];function createListener(_0x513369,_0x59c5d6){return function(_0x3f7e30){_0x59c5d6['emit'](_0x513369,_0x3f7e30);};}function removeListener(_0x24409f,_0x3bbe6d){return function(){ChatInteractionEvents['removeListener'](_0x24409f,_0x3bbe6d);};}exports['register']=function(_0xeb9176){for(var _0x4d860b=0x0,_0x54d582=events[_0x7a9d('0x2')];_0x4d860b<_0x54d582;_0x4d860b++){var _0x4e274c=events[_0x4d860b];var _0x26405b=createListener('chatInteraction:'+_0x4e274c,_0xeb9176);ChatInteractionEvents['on'](_0x4e274c,_0x26405b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 44f4111..17a5558 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 _0x0c99=['diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','create','post','/:id/vidaoo','createVidaooSession'];(function(_0x2529a6,_0x45598a){var _0x515326=function(_0xf5824b){while(--_0xf5824b){_0x2529a6['push'](_0x2529a6['shift']());}};_0x515326(++_0x45598a);}(_0x0c99,0x8a));var _0x90c9=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x0c99[_0x5951e8];return _0x20a1f5;};'use strict';var multer=require(_0x90c9('0x0'));var util=require(_0x90c9('0x1'));var path=require(_0x90c9('0x2'));var timeout=require(_0x90c9('0x3'));var express=require(_0x90c9('0x4'));var router=express[_0x90c9('0x5')]();var fs_extra=require(_0x90c9('0x6'));var auth=require(_0x90c9('0x7'));var interaction=require(_0x90c9('0x8'));var config=require(_0x90c9('0x9'));var controller=require('./chatInteraction.controller');router[_0x90c9('0xa')]('/',auth[_0x90c9('0xb')](),controller[_0x90c9('0xc')]);router[_0x90c9('0xa')](_0x90c9('0xd'),auth[_0x90c9('0xb')](),controller['describe']);router[_0x90c9('0xa')](_0x90c9('0xe'),auth[_0x90c9('0xf')](),controller[_0x90c9('0x10')]);router[_0x90c9('0xa')](_0x90c9('0x11'),auth[_0x90c9('0xf')](),controller[_0x90c9('0x12')]);router[_0x90c9('0xa')](_0x90c9('0x13'),auth[_0x90c9('0xb')](),controller[_0x90c9('0x14')]);router['get']('/:id/my_messages',auth[_0x90c9('0xf')](),controller[_0x90c9('0x15')]);router[_0x90c9('0xa')](_0x90c9('0x16'),auth[_0x90c9('0xb')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x90c9('0x17')]);router[_0x90c9('0x18')](_0x90c9('0x19'),auth['isAuthenticated'](),controller[_0x90c9('0x1a')]);var upload=multer({'storage':multer[_0x90c9('0x1b')]({'destination':function(_0x1c8faa,_0x44f184,_0x40aa87){_0x40aa87(null,path[_0x90c9('0x1c')](config['root'],_0x90c9('0x1d')));},'filename':function(_0xddd9f1,_0x410920,_0x16fb6f){_0x16fb6f(null,util[_0x90c9('0x1e')](_0x90c9('0x1f'),Date[_0x90c9('0x20')](),_0x410920[_0x90c9('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x90c9('0x18')](_0x90c9('0x22'),upload[_0x90c9('0x23')]('file'),controller[_0x90c9('0x24')]);router[_0x90c9('0x18')](_0x90c9('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x90c9('0x25')]);router[_0x90c9('0x18')]('/:id/tags',auth[_0x90c9('0xb')](),interaction[_0x90c9('0x26')](_0x90c9('0x27'),_0x90c9('0x28')),controller['addTags']);router[_0x90c9('0x29')]('/:id',auth['isAuthenticated'](),interaction[_0x90c9('0x26')](_0x90c9('0x27'),_0x90c9('0x2a')),controller[_0x90c9('0x2b')]);router[_0x90c9('0x29')]('/:id/custom_update',controller[_0x90c9('0x2c')]);router[_0x90c9('0x29')](_0x90c9('0x2d'),auth[_0x90c9('0xf')](),controller[_0x90c9('0x2e')]);router[_0x90c9('0x29')](_0x90c9('0x2f'),controller[_0x90c9('0x30')]);router[_0x90c9('0x31')](_0x90c9('0xe'),auth[_0x90c9('0xb')](),interaction['tracked'](_0x90c9('0x27'),_0x90c9('0x32')),controller[_0x90c9('0x33')]);router[_0x90c9('0x31')](_0x90c9('0x34'),auth[_0x90c9('0xb')](),controller[_0x90c9('0x35')]);module[_0x90c9('0x36')]=router; \ No newline at end of file +var _0x19ff=['%s-%s','now','replace','/:id/attachment_upload','attachmentUpload','tracked','addTags','/:id/custom_update','customUpdate','put','/:id/abandon','abandon','/:id/close','close','/:id','chatinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/'];(function(_0x49497b,_0x185992){var _0x2a33b9=function(_0x473fba){while(--_0x473fba){_0x49497b['push'](_0x49497b['shift']());}};_0x2a33b9(++_0x185992);}(_0x19ff,0x165));var _0xf19f=function(_0x5b5d68,_0x575d65){_0x5b5d68=_0x5b5d68-0x0;var _0x9f45c3=_0x19ff[_0x5b5d68];return _0x9f45c3;};'use strict';var multer=require('multer');var util=require(_0xf19f('0x0'));var path=require(_0xf19f('0x1'));var timeout=require(_0xf19f('0x2'));var express=require(_0xf19f('0x3'));var router=express[_0xf19f('0x4')]();var fs_extra=require(_0xf19f('0x5'));var auth=require(_0xf19f('0x6'));var interaction=require(_0xf19f('0x7'));var config=require('../../config/environment');var controller=require(_0xf19f('0x8'));router[_0xf19f('0x9')]('/',auth[_0xf19f('0xa')](),controller['index']);router[_0xf19f('0x9')](_0xf19f('0xb'),auth[_0xf19f('0xa')](),controller[_0xf19f('0xc')]);router[_0xf19f('0x9')]('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router['get']('/:id/attachment_download',auth[_0xf19f('0xd')](),controller[_0xf19f('0xe')]);router[_0xf19f('0x9')](_0xf19f('0xf'),auth[_0xf19f('0xa')](),controller[_0xf19f('0x10')]);router['get']('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0xf19f('0x11')]);router[_0xf19f('0x9')](_0xf19f('0x12'),auth[_0xf19f('0xa')](),controller[_0xf19f('0x13')]);router[_0xf19f('0x14')]('/',auth[_0xf19f('0xa')](),controller[_0xf19f('0x15')]);router[_0xf19f('0x14')](_0xf19f('0x16'),auth[_0xf19f('0xa')](),controller[_0xf19f('0x17')]);var upload=multer({'storage':multer[_0xf19f('0x18')]({'destination':function(_0x3f23a1,_0x1231be,_0x2a344b){_0x2a344b(null,path['join'](config[_0xf19f('0x19')],_0xf19f('0x1a')));},'filename':function(_0x56f576,_0x5dc01d,_0x2a6f74){_0x2a6f74(null,util['format'](_0xf19f('0x1b'),Date[_0xf19f('0x1c')](),_0x5dc01d['originalname'][_0xf19f('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf19f('0x14')](_0xf19f('0x1e'),upload['single']('file'),controller[_0xf19f('0x1f')]);router[_0xf19f('0x14')](_0xf19f('0xf'),auth[_0xf19f('0xd')](),controller['addMessage']);router[_0xf19f('0x14')]('/:id/tags',auth[_0xf19f('0xa')](),interaction[_0xf19f('0x20')]('chat','chatinteraction:addtags'),controller[_0xf19f('0x21')]);router['put']('/:id',auth[_0xf19f('0xa')](),interaction[_0xf19f('0x20')]('chat','chatinteraction:update'),controller['update']);router['put'](_0xf19f('0x22'),controller[_0xf19f('0x23')]);router[_0xf19f('0x24')](_0xf19f('0x25'),auth[_0xf19f('0xd')](),controller[_0xf19f('0x26')]);router['put'](_0xf19f('0x27'),controller[_0xf19f('0x28')]);router['delete'](_0xf19f('0x29'),auth['isAuthenticated'](),interaction[_0xf19f('0x20')]('chat',_0xf19f('0x2a')),controller[_0xf19f('0x2b')]);router[_0xf19f('0x2c')](_0xf19f('0x2d'),auth[_0xf19f('0xa')](),controller[_0xf19f('0x2e')]);module[_0xf19f('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 0d9d6c4..410d1e1 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 _0x6866=['BOOLEAN','sequelize','medium'];(function(_0x5e92b6,_0x23219a){var _0x487171=function(_0x1ac1dc){while(--_0x1ac1dc){_0x5e92b6['push'](_0x5e92b6['shift']());}};_0x487171(++_0x23219a);}(_0x6866,0x14e));var _0x6686=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x6866[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x6686('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x6686('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6686('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa827=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xa827,0x7c));var _0x7a82=function(_0x52b2d4,_0x1b74b8){_0x52b2d4=_0x52b2d4-0x0;var _0x259b2c=_0xa827[_0x52b2d4];return _0x259b2c;};'use strict';var Sequelize=require(_0x7a82('0x0'));module[_0x7a82('0x1')]={'body':{'type':Sequelize[_0x7a82('0x2')](_0x7a82('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7a82('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7a82('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index b8605df..8495659 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 _0x3b71=['./chatInternalMessage.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','send','index','map','ChatInternalMessage','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','sort','where','merge','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','find','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b71,0x181));var _0x13b7=function(_0x4949e2,_0x1bf3be){_0x4949e2=_0x4949e2-0x0;var _0x1e45d8=_0x3b71[_0x4949e2];return _0x1e45d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13b7('0x0'));var zipdir=require(_0x13b7('0x1'));var jsonpatch=require(_0x13b7('0x2'));var rp=require(_0x13b7('0x3'));var moment=require(_0x13b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13b7('0x5'));var util=require(_0x13b7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x13b7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13b7('0x8'));var _=require(_0x13b7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x13b7('0xa'));var deskjs=require(_0x13b7('0xb'));var toCsv=require(_0x13b7('0x7'));var querystring=require(_0x13b7('0xc'));var Papa=require(_0x13b7('0xd'));var Redis=require('ioredis');var authService=require(_0x13b7('0xe'));var qs=require(_0x13b7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13b7('0x10'));var logger=require('../../config/logger')(_0x13b7('0x11'));var utils=require(_0x13b7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x13b7('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x13b7('0x14')](config[_0x13b7('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x13b7('0x16'))(new Redis(config[_0x13b7('0x15')]));require(_0x13b7('0x17'))['register'](socket);function respondWithStatusCode(_0x26fa4b,_0x2822b9){_0x2822b9=_0x2822b9||0xcc;return function(_0x4f93fd){if(_0x4f93fd){return _0x26fa4b[_0x13b7('0x18')](_0x2822b9);}return _0x26fa4b['status'](_0x2822b9)[_0x13b7('0x19')]();};}function respondWithResult(_0x2d9f9f,_0x1f51c3){_0x1f51c3=_0x1f51c3||0xc8;return function(_0x84f408){if(_0x84f408){return _0x2d9f9f[_0x13b7('0x1a')](_0x1f51c3)[_0x13b7('0x1b')](_0x84f408);}};}function respondWithFilteredResult(_0xd4144a,_0x3c4cba){return function(_0x3dc345){if(_0x3dc345){var _0x3fb14c=typeof _0x3c4cba[_0x13b7('0x1c')]===_0x13b7('0x1d')&&typeof _0x3c4cba[_0x13b7('0x1e')]==='undefined';var _0xec09d9=_0x3dc345[_0x13b7('0x1f')];var _0x2e4f15=_0x3fb14c?0x0:_0x3c4cba[_0x13b7('0x1c')];var _0x346bc0=_0x3fb14c?_0x3dc345[_0x13b7('0x1f')]:_0x3c4cba['offset']+_0x3c4cba[_0x13b7('0x1e')];var _0x4b1b73;if(_0x346bc0>=_0xec09d9){_0x346bc0=_0xec09d9;_0x4b1b73=0xc8;}else{_0x4b1b73=0xce;}_0xd4144a[_0x13b7('0x1a')](_0x4b1b73);return _0xd4144a[_0x13b7('0x20')]('Content-Range',_0x2e4f15+'-'+_0x346bc0+'/'+_0xec09d9)[_0x13b7('0x1b')](_0x3dc345);}return null;};}function patchUpdates(_0xff9324){return function(_0x13246b){try{jsonpatch[_0x13b7('0x21')](_0x13246b,_0xff9324,!![]);}catch(_0x2a85a5){return BPromise[_0x13b7('0x22')](_0x2a85a5);}return _0x13246b[_0x13b7('0x23')]();};}function saveUpdates(_0x21d474,_0x3ac2e1){return function(_0x55144b){if(_0x55144b){return _0x55144b[_0x13b7('0x24')](_0x21d474)[_0x13b7('0x25')](function(_0x21e8a1){return _0x21e8a1;});}return null;};}function removeEntity(_0x584f76,_0x2cfc5c){return function(_0x265b61){if(_0x265b61){return _0x265b61[_0x13b7('0x26')]()[_0x13b7('0x25')](function(){_0x584f76[_0x13b7('0x1a')](0xcc)[_0x13b7('0x19')]();});}};}function handleEntityNotFound(_0x231cee,_0xa51bd1){return function(_0x21ece9){if(!_0x21ece9){_0x231cee[_0x13b7('0x18')](0x194);}return _0x21ece9;};}function handleError(_0x5e4723,_0x366b47){_0x366b47=_0x366b47||0x1f4;return function(_0x1ab4c8){logger['error'](_0x1ab4c8[_0x13b7('0x27')]);if(_0x1ab4c8['name']){delete _0x1ab4c8['name'];}_0x5e4723[_0x13b7('0x1a')](_0x366b47)[_0x13b7('0x28')](_0x1ab4c8);};}exports[_0x13b7('0x29')]=function(_0x190e60,_0x54e634){var _0x5a3bc4={},_0x4a88b1={},_0x38df97={'count':0x0,'rows':[]};var _0x5214f5=_[_0x13b7('0x2a')](db[_0x13b7('0x2b')]['rawAttributes'],function(_0x4c4bdd){return{'name':_0x4c4bdd[_0x13b7('0x2c')],'type':_0x4c4bdd[_0x13b7('0x2d')]['key']};});_0x4a88b1[_0x13b7('0x2e')]=_[_0x13b7('0x2a')](_0x5214f5,_0x13b7('0x2f'));_0x4a88b1[_0x13b7('0x30')]=_[_0x13b7('0x31')](_0x190e60[_0x13b7('0x30')]);_0x4a88b1[_0x13b7('0x32')]=_[_0x13b7('0x33')](_0x4a88b1['model'],_0x4a88b1[_0x13b7('0x30')]);_0x5a3bc4[_0x13b7('0x34')]=_[_0x13b7('0x33')](_0x4a88b1[_0x13b7('0x2e')],qs[_0x13b7('0x35')](_0x190e60[_0x13b7('0x30')]['fields']));_0x5a3bc4[_0x13b7('0x34')]=_0x5a3bc4[_0x13b7('0x34')][_0x13b7('0x36')]?_0x5a3bc4[_0x13b7('0x34')]:_0x4a88b1[_0x13b7('0x2e')];if(!_0x190e60['query']['hasOwnProperty']('nolimit')){_0x5a3bc4[_0x13b7('0x1e')]=qs[_0x13b7('0x1e')](_0x190e60[_0x13b7('0x30')][_0x13b7('0x1e')]);_0x5a3bc4[_0x13b7('0x1c')]=qs[_0x13b7('0x1c')](_0x190e60[_0x13b7('0x30')][_0x13b7('0x1c')]);}_0x5a3bc4['order']=qs[_0x13b7('0x37')](_0x190e60[_0x13b7('0x30')][_0x13b7('0x37')]);_0x5a3bc4[_0x13b7('0x38')]=qs[_0x13b7('0x32')](_['pick'](_0x190e60['query'],_0x4a88b1['filters']),_0x5214f5);if(_0x190e60[_0x13b7('0x30')]['filter']){_0x5a3bc4[_0x13b7('0x38')]=_[_0x13b7('0x39')](_0x5a3bc4[_0x13b7('0x38')],{'$or':_[_0x13b7('0x2a')](_0x5214f5,function(_0x36b60b){if(_0x36b60b[_0x13b7('0x2d')]!=='VIRTUAL'){var _0x123c61={};_0x123c61[_0x36b60b['name']]={'$like':'%'+_0x190e60[_0x13b7('0x30')][_0x13b7('0x3a')]+'%'};return _0x123c61;}})});}_0x5a3bc4=_[_0x13b7('0x39')]({},_0x5a3bc4,_0x190e60[_0x13b7('0x3b')]);var _0x4e9a4a={'where':_0x5a3bc4[_0x13b7('0x38')]};return db[_0x13b7('0x2b')][_0x13b7('0x1f')](_0x4e9a4a)['then'](function(_0x1008cb){_0x38df97[_0x13b7('0x1f')]=_0x1008cb;if(_0x190e60[_0x13b7('0x30')][_0x13b7('0x3c')]){_0x5a3bc4['include']=[{'all':!![]}];}return db[_0x13b7('0x2b')][_0x13b7('0x3d')](_0x5a3bc4);})['then'](function(_0x23271b){_0x38df97['rows']=_0x23271b;return _0x38df97;})[_0x13b7('0x25')](respondWithFilteredResult(_0x54e634,_0x5a3bc4))[_0x13b7('0x3e')](handleError(_0x54e634,null));};exports[_0x13b7('0x3f')]=function(_0x256a3e,_0x168705){var _0x1c6ed1={'raw':!![],'where':{'id':_0x256a3e[_0x13b7('0x40')]['id']}},_0x491af1={};_0x491af1[_0x13b7('0x2e')]=_['keys'](db[_0x13b7('0x2b')][_0x13b7('0x41')]);_0x491af1['query']=_[_0x13b7('0x31')](_0x256a3e['query']);_0x491af1[_0x13b7('0x32')]=_['intersection'](_0x491af1[_0x13b7('0x2e')],_0x491af1[_0x13b7('0x30')]);_0x1c6ed1[_0x13b7('0x34')]=_[_0x13b7('0x33')](_0x491af1[_0x13b7('0x2e')],qs[_0x13b7('0x35')](_0x256a3e['query'][_0x13b7('0x35')]));_0x1c6ed1[_0x13b7('0x34')]=_0x1c6ed1[_0x13b7('0x34')][_0x13b7('0x36')]?_0x1c6ed1['attributes']:_0x491af1[_0x13b7('0x2e')];if(_0x256a3e[_0x13b7('0x30')][_0x13b7('0x3c')]){_0x1c6ed1[_0x13b7('0x42')]=[{'all':!![]}];}_0x1c6ed1=_[_0x13b7('0x39')]({},_0x1c6ed1,_0x256a3e['options']);return db['ChatInternalMessage']['find'](_0x1c6ed1)['then'](handleEntityNotFound(_0x168705,null))[_0x13b7('0x25')](respondWithResult(_0x168705,null))[_0x13b7('0x3e')](handleError(_0x168705,null));};exports['create']=function(_0x2a4172,_0x202623){return db[_0x13b7('0x2b')][_0x13b7('0x43')](_0x2a4172[_0x13b7('0x44')],{})['then'](respondWithResult(_0x202623,0xc9))[_0x13b7('0x3e')](handleError(_0x202623,null));};exports['update']=function(_0x403b0c,_0x1c725b){if(_0x403b0c[_0x13b7('0x44')]['id']){delete _0x403b0c[_0x13b7('0x44')]['id'];}return db[_0x13b7('0x2b')][_0x13b7('0x45')]({'where':{'id':_0x403b0c[_0x13b7('0x40')]['id']}})[_0x13b7('0x25')](handleEntityNotFound(_0x1c725b,null))[_0x13b7('0x25')](saveUpdates(_0x403b0c[_0x13b7('0x44')],null))[_0x13b7('0x25')](respondWithResult(_0x1c725b,null))[_0x13b7('0x3e')](handleError(_0x1c725b,null));};exports['destroy']=function(_0x35bd5b,_0x43055f){return db[_0x13b7('0x2b')][_0x13b7('0x45')]({'where':{'id':_0x35bd5b['params']['id']}})[_0x13b7('0x25')](handleEntityNotFound(_0x43055f,null))[_0x13b7('0x25')](removeEntity(_0x43055f,null))[_0x13b7('0x3e')](handleError(_0x43055f,null));};exports['describe']=function(_0x1144ed,_0x3e491){return db[_0x13b7('0x2b')]['describe']()[_0x13b7('0x25')](respondWithResult(_0x3e491,null))[_0x13b7('0x3e')](handleError(_0x3e491,null));};function wrapUser(_0x134df3){return function(_0x5886ef){var _0x39a720=_0x134df3['get']({'plain':!![]});_0x39a720[_0x13b7('0x46')]=[];if(_0x5886ef){_0x39a720[_0x13b7('0x47')]=_0x5886ef[_0x13b7('0x48')];_0x39a720[_0x13b7('0x49')]=_0x5886ef;}else{_0x39a720[_0x13b7('0x47')]=moment(0x0)[_0x13b7('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x39a720[_0x13b7('0x49')]={};}return _0x39a720;};}exports[_0x13b7('0x4b')]=function(_0x3135da,_0x54af24,_0x5a0022){var _0x125c24=[];return db[_0x13b7('0x4c')]['findAll']({'where':{'role':[_0x13b7('0x4d'),_0x13b7('0x4e'),_0x13b7('0x4f')]},'attributes':['id',_0x13b7('0x50'),_0x13b7('0x2f'),_0x13b7('0x51'),_0x13b7('0x52'),_0x13b7('0x53'),_0x13b7('0x54'),_0x13b7('0x55'),_0x13b7('0x56'),_0x13b7('0x57')],'order':qs[_0x13b7('0x37')](_0x13b7('0x58')),'include':[{'model':db['VoiceQueue'],'as':_0x13b7('0x59'),'attributes':['id',_0x13b7('0x2f'),_0x13b7('0x2d')],'through':{'attributes':[]}}]})[_0x13b7('0x25')](function(_0x434552){if(_0x434552){var _0x1b8215=_0x3135da[_0x13b7('0x4f')][_0x13b7('0x5a')]({'plain':!![]});if(!_0x1b8215)throw new Error(_0x13b7('0x5b'));if(_0x1b8215['role']===_0x13b7('0x4f')){return db['UserProfileSection'][_0x13b7('0x45')]({'where':{'name':_0x13b7('0x5c'),'userProfileId':_0x1b8215[_0x13b7('0x5d')]},'raw':!![]})[_0x13b7('0x25')](function(_0x31329d){if(_0x31329d){if(_0x31329d['autoAssociation']===0x0){return db[_0x13b7('0x5e')][_0x13b7('0x3d')]({'where':{'sectionId':_0x31329d['id']},'raw':!![]})['then'](function(_0xb0d3f4){var _0x3489c8=[];if(_[_0x13b7('0x5f')](_0xb0d3f4)){_0x3489c8=_['filter'](_0x434552,function(_0x47730f){if(_0x47730f[_0x13b7('0x51')]!=='agent'){return _0x47730f;}});return _0x3489c8;}else{for(var _0x2c6a3f=0x0;_0x2c6a3f<_0x434552[_0x13b7('0x36')];_0x2c6a3f++){var _0x3fdaf6=_0x434552[_0x2c6a3f];if(_0x3fdaf6[_0x13b7('0x51')]===_0x13b7('0x4d')){var _0xf78590=_[_0x13b7('0x45')](_0xb0d3f4,function(_0x2a78cb){return _0x2a78cb[_0x13b7('0x60')]===_0x3fdaf6['id'];});if(_0xf78590)_0x3489c8[_0x13b7('0x61')](_0x3fdaf6);}else{_0x3489c8['push'](_0x3fdaf6);}}return _0x3489c8;}});}else{return _0x434552;}}else{var _0x41e938=_['filter'](_0x434552,function(_0x2a27c1){if(_0x2a27c1[_0x13b7('0x51')]!==_0x13b7('0x4d')){return _0x2a27c1;}});return _0x41e938;}});}else{return _0x434552;}}})[_0x13b7('0x25')](function(_0x2d3bec){var _0x1309d5=[];if(_0x2d3bec){_0x125c24=_0x2d3bec;for(var _0x2822d4=0x0;_0x2822d4<_0x2d3bec['length'];_0x2822d4+=0x1){_0x125c24[_0x2822d4]['messages']=[];_0x1309d5[_0x13b7('0x61')](db[_0x13b7('0x2b')]['find']({'where':{'FromId':[_0x3135da['user']['id'],_0x2d3bec[_0x2822d4]['id']],'ToId':[_0x3135da[_0x13b7('0x4f')]['id'],_0x2d3bec[_0x2822d4]['id']],'ChatGroupId':null},'attributes':['id',_0x13b7('0x48'),_0x13b7('0x62'),_0x13b7('0x63'),_0x13b7('0x64'),_0x13b7('0x44')],'order':qs['sort'](_0x13b7('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x13b7('0x25')](wrapUser(_0x2d3bec[_0x2822d4])));}return BPromise['all'](_0x1309d5);}return[];})['then'](function(_0x10ed99){return{'rows':_0x10ed99,'count':_0x10ed99['length']};})['then'](respondWithResult(_0x54af24,null))[_0x13b7('0x3e')](handleError(_0x54af24,null));}; \ No newline at end of file +var _0x662e=['index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','messages','createdAt','lastMessage','lastMessageAt','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','get','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x4a6b92,_0x53929c){var _0x303f17=function(_0x30a218){while(--_0x30a218){_0x4a6b92['push'](_0x4a6b92['shift']());}};_0x303f17(++_0x53929c);}(_0x662e,0x19f));var _0xe662=function(_0x5abdf9,_0xd088d9){_0x5abdf9=_0x5abdf9-0x0;var _0x3856d8=_0x662e[_0x5abdf9];return _0x3856d8;};'use strict';var emlformat=require(_0xe662('0x0'));var rimraf=require(_0xe662('0x1'));var zipdir=require(_0xe662('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe662('0x3'));var moment=require(_0xe662('0x4'));var BPromise=require(_0xe662('0x5'));var Mustache=require('mustache');var util=require(_0xe662('0x6'));var path=require(_0xe662('0x7'));var sox=require(_0xe662('0x8'));var csv=require(_0xe662('0x9'));var ejs=require(_0xe662('0xa'));var fs=require('fs');var fs_extra=require(_0xe662('0xb'));var _=require(_0xe662('0xc'));var squel=require(_0xe662('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe662('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe662('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe662('0x10'));var hardwareService=require(_0xe662('0x11'));var logger=require(_0xe662('0x12'))('api');var utils=require(_0xe662('0x13'));var config=require(_0xe662('0x14'));var licenseUtil=require(_0xe662('0x15'));var db=require('../../mysqldb')['db'];config[_0xe662('0x16')]=_[_0xe662('0x17')](config['redis'],{'host':_0xe662('0x18'),'port':0x18eb});var socket=require(_0xe662('0x19'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xe662('0x1a')](socket);function respondWithStatusCode(_0x2f4fa4,_0x5def07){_0x5def07=_0x5def07||0xcc;return function(_0x30fc09){if(_0x30fc09){return _0x2f4fa4[_0xe662('0x1b')](_0x5def07);}return _0x2f4fa4['status'](_0x5def07)[_0xe662('0x1c')]();};}function respondWithResult(_0x57672d,_0x1a1689){_0x1a1689=_0x1a1689||0xc8;return function(_0x39a5e0){if(_0x39a5e0){return _0x57672d[_0xe662('0x1d')](_0x1a1689)[_0xe662('0x1e')](_0x39a5e0);}};}function respondWithFilteredResult(_0xa4b806,_0x34138f){return function(_0x435a58){if(_0x435a58){var _0x5ade08=typeof _0x34138f[_0xe662('0x1f')]==='undefined'&&typeof _0x34138f['limit']===_0xe662('0x20');var _0x26bb11=_0x435a58['count'];var _0x31b702=_0x5ade08?0x0:_0x34138f['offset'];var _0x30846d=_0x5ade08?_0x435a58['count']:_0x34138f['offset']+_0x34138f[_0xe662('0x21')];var _0x5f58e5;if(_0x30846d>=_0x26bb11){_0x30846d=_0x26bb11;_0x5f58e5=0xc8;}else{_0x5f58e5=0xce;}_0xa4b806[_0xe662('0x1d')](_0x5f58e5);return _0xa4b806[_0xe662('0x22')](_0xe662('0x23'),_0x31b702+'-'+_0x30846d+'/'+_0x26bb11)['json'](_0x435a58);}return null;};}function patchUpdates(_0x13a597){return function(_0x2c3261){try{jsonpatch[_0xe662('0x24')](_0x2c3261,_0x13a597,!![]);}catch(_0x214111){return BPromise[_0xe662('0x25')](_0x214111);}return _0x2c3261[_0xe662('0x26')]();};}function saveUpdates(_0x1b6b78,_0x3e9974){return function(_0x4917d4){if(_0x4917d4){return _0x4917d4[_0xe662('0x27')](_0x1b6b78)[_0xe662('0x28')](function(_0x4ab2a3){return _0x4ab2a3;});}return null;};}function removeEntity(_0x4d2afa,_0x2ebb2b){return function(_0x2b032f){if(_0x2b032f){return _0x2b032f[_0xe662('0x29')]()[_0xe662('0x28')](function(){_0x4d2afa[_0xe662('0x1d')](0xcc)[_0xe662('0x1c')]();});}};}function handleEntityNotFound(_0x170967,_0x514b2e){return function(_0x17aedb){if(!_0x17aedb){_0x170967[_0xe662('0x1b')](0x194);}return _0x17aedb;};}function handleError(_0x1999d7,_0x3860ad){_0x3860ad=_0x3860ad||0x1f4;return function(_0x141400){logger[_0xe662('0x2a')](_0x141400['stack']);if(_0x141400[_0xe662('0x2b')]){delete _0x141400[_0xe662('0x2b')];}_0x1999d7[_0xe662('0x1d')](_0x3860ad)[_0xe662('0x2c')](_0x141400);};}exports[_0xe662('0x2d')]=function(_0x5aa02d,_0x5bcccb){var _0x45d91b={},_0x17cc64={},_0x301736={'count':0x0,'rows':[]};var _0xfb0fb2=_[_0xe662('0x2e')](db[_0xe662('0x2f')][_0xe662('0x30')],function(_0x5da04c){return{'name':_0x5da04c[_0xe662('0x31')],'type':_0x5da04c[_0xe662('0x32')][_0xe662('0x33')]};});_0x17cc64['model']=_[_0xe662('0x2e')](_0xfb0fb2,'name');_0x17cc64[_0xe662('0x34')]=_[_0xe662('0x35')](_0x5aa02d[_0xe662('0x34')]);_0x17cc64['filters']=_[_0xe662('0x36')](_0x17cc64[_0xe662('0x37')],_0x17cc64[_0xe662('0x34')]);_0x45d91b[_0xe662('0x38')]=_[_0xe662('0x36')](_0x17cc64[_0xe662('0x37')],qs[_0xe662('0x39')](_0x5aa02d[_0xe662('0x34')][_0xe662('0x39')]));_0x45d91b[_0xe662('0x38')]=_0x45d91b[_0xe662('0x38')][_0xe662('0x3a')]?_0x45d91b[_0xe662('0x38')]:_0x17cc64['model'];if(!_0x5aa02d['query'][_0xe662('0x3b')](_0xe662('0x3c'))){_0x45d91b[_0xe662('0x21')]=qs[_0xe662('0x21')](_0x5aa02d[_0xe662('0x34')][_0xe662('0x21')]);_0x45d91b[_0xe662('0x1f')]=qs[_0xe662('0x1f')](_0x5aa02d[_0xe662('0x34')]['offset']);}_0x45d91b[_0xe662('0x3d')]=qs[_0xe662('0x3e')](_0x5aa02d[_0xe662('0x34')][_0xe662('0x3e')]);_0x45d91b[_0xe662('0x3f')]=qs['filters'](_[_0xe662('0x40')](_0x5aa02d[_0xe662('0x34')],_0x17cc64[_0xe662('0x41')]),_0xfb0fb2);if(_0x5aa02d[_0xe662('0x34')][_0xe662('0x42')]){_0x45d91b[_0xe662('0x3f')]=_[_0xe662('0x43')](_0x45d91b[_0xe662('0x3f')],{'$or':_[_0xe662('0x2e')](_0xfb0fb2,function(_0x513f2b){if(_0x513f2b[_0xe662('0x32')]!==_0xe662('0x44')){var _0x565c19={};_0x565c19[_0x513f2b[_0xe662('0x2b')]]={'$like':'%'+_0x5aa02d[_0xe662('0x34')]['filter']+'%'};return _0x565c19;}})});}_0x45d91b=_['merge']({},_0x45d91b,_0x5aa02d[_0xe662('0x45')]);var _0x47e982={'where':_0x45d91b[_0xe662('0x3f')]};return db['ChatInternalMessage'][_0xe662('0x46')](_0x47e982)[_0xe662('0x28')](function(_0x48e654){_0x301736[_0xe662('0x46')]=_0x48e654;if(_0x5aa02d[_0xe662('0x34')][_0xe662('0x47')]){_0x45d91b[_0xe662('0x48')]=[{'all':!![]}];}return db[_0xe662('0x2f')][_0xe662('0x49')](_0x45d91b);})[_0xe662('0x28')](function(_0x24be36){_0x301736[_0xe662('0x4a')]=_0x24be36;return _0x301736;})['then'](respondWithFilteredResult(_0x5bcccb,_0x45d91b))[_0xe662('0x4b')](handleError(_0x5bcccb,null));};exports[_0xe662('0x4c')]=function(_0xb04f9c,_0xde933c){var _0x5b52a8={'raw':!![],'where':{'id':_0xb04f9c['params']['id']}},_0x5eee9b={};_0x5eee9b['model']=_['keys'](db[_0xe662('0x2f')][_0xe662('0x30')]);_0x5eee9b[_0xe662('0x34')]=_[_0xe662('0x35')](_0xb04f9c[_0xe662('0x34')]);_0x5eee9b[_0xe662('0x41')]=_['intersection'](_0x5eee9b[_0xe662('0x37')],_0x5eee9b['query']);_0x5b52a8['attributes']=_[_0xe662('0x36')](_0x5eee9b['model'],qs[_0xe662('0x39')](_0xb04f9c[_0xe662('0x34')][_0xe662('0x39')]));_0x5b52a8[_0xe662('0x38')]=_0x5b52a8['attributes'][_0xe662('0x3a')]?_0x5b52a8[_0xe662('0x38')]:_0x5eee9b[_0xe662('0x37')];if(_0xb04f9c[_0xe662('0x34')][_0xe662('0x47')]){_0x5b52a8[_0xe662('0x48')]=[{'all':!![]}];}_0x5b52a8=_[_0xe662('0x43')]({},_0x5b52a8,_0xb04f9c['options']);return db[_0xe662('0x2f')]['find'](_0x5b52a8)[_0xe662('0x28')](handleEntityNotFound(_0xde933c,null))[_0xe662('0x28')](respondWithResult(_0xde933c,null))[_0xe662('0x4b')](handleError(_0xde933c,null));};exports[_0xe662('0x4d')]=function(_0x359381,_0x3399fd){return db[_0xe662('0x2f')]['create'](_0x359381[_0xe662('0x4e')],{})[_0xe662('0x28')](respondWithResult(_0x3399fd,0xc9))['catch'](handleError(_0x3399fd,null));};exports[_0xe662('0x27')]=function(_0x22a580,_0x53c33d){if(_0x22a580[_0xe662('0x4e')]['id']){delete _0x22a580[_0xe662('0x4e')]['id'];}return db[_0xe662('0x2f')][_0xe662('0x4f')]({'where':{'id':_0x22a580[_0xe662('0x50')]['id']}})['then'](handleEntityNotFound(_0x53c33d,null))[_0xe662('0x28')](saveUpdates(_0x22a580[_0xe662('0x4e')],null))[_0xe662('0x28')](respondWithResult(_0x53c33d,null))[_0xe662('0x4b')](handleError(_0x53c33d,null));};exports[_0xe662('0x29')]=function(_0x5ade31,_0x208bec){return db['ChatInternalMessage'][_0xe662('0x4f')]({'where':{'id':_0x5ade31['params']['id']}})[_0xe662('0x28')](handleEntityNotFound(_0x208bec,null))['then'](removeEntity(_0x208bec,null))['catch'](handleError(_0x208bec,null));};exports[_0xe662('0x51')]=function(_0x417928,_0x16e41b){return db[_0xe662('0x2f')][_0xe662('0x51')]()[_0xe662('0x28')](respondWithResult(_0x16e41b,null))[_0xe662('0x4b')](handleError(_0x16e41b,null));};function wrapUser(_0x26ccf9){return function(_0x59ba04){var _0x2c8f4c=_0x26ccf9['get']({'plain':!![]});_0x2c8f4c[_0xe662('0x52')]=[];if(_0x59ba04){_0x2c8f4c['lastMessageAt']=_0x59ba04[_0xe662('0x53')];_0x2c8f4c[_0xe662('0x54')]=_0x59ba04;}else{_0x2c8f4c[_0xe662('0x55')]=moment(0x0)[_0xe662('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c8f4c[_0xe662('0x54')]={};}return _0x2c8f4c;};}exports[_0xe662('0x57')]=function(_0x5e93a5,_0x443ec9,_0x146df4){var _0x580e81=[];return db[_0xe662('0x58')]['findAll']({'where':{'role':[_0xe662('0x59'),_0xe662('0x5a'),_0xe662('0x5b')]},'attributes':['id',_0xe662('0x5c'),_0xe662('0x2b'),_0xe662('0x5d'),_0xe662('0x5e'),_0xe662('0x5f'),_0xe662('0x60'),_0xe662('0x61'),_0xe662('0x62'),_0xe662('0x63')],'order':qs['sort']('-online'),'include':[{'model':db[_0xe662('0x64')],'as':_0xe662('0x65'),'attributes':['id','name',_0xe662('0x32')],'through':{'attributes':[]}}]})[_0xe662('0x28')](function(_0x251004){if(_0x251004){var _0x47356d=_0x5e93a5[_0xe662('0x5b')][_0xe662('0x66')]({'plain':!![]});if(!_0x47356d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47356d[_0xe662('0x5d')]==='user'){return db[_0xe662('0x67')][_0xe662('0x4f')]({'where':{'name':_0xe662('0x68'),'userProfileId':_0x47356d[_0xe662('0x69')]},'raw':!![]})[_0xe662('0x28')](function(_0x232210){if(_0x232210){if(_0x232210[_0xe662('0x6a')]===0x0){return db[_0xe662('0x6b')][_0xe662('0x49')]({'where':{'sectionId':_0x232210['id']},'raw':!![]})[_0xe662('0x28')](function(_0x2875d7){var _0x2edef8=[];if(_[_0xe662('0x6c')](_0x2875d7)){_0x2edef8=_[_0xe662('0x42')](_0x251004,function(_0x36c423){if(_0x36c423[_0xe662('0x5d')]!=='agent'){return _0x36c423;}});return _0x2edef8;}else{for(var _0x419216=0x0;_0x419216<_0x251004[_0xe662('0x3a')];_0x419216++){var _0x4c0f34=_0x251004[_0x419216];if(_0x4c0f34[_0xe662('0x5d')]===_0xe662('0x59')){var _0x129076=_['find'](_0x2875d7,function(_0xcd1fe1){return _0xcd1fe1[_0xe662('0x6d')]===_0x4c0f34['id'];});if(_0x129076)_0x2edef8[_0xe662('0x6e')](_0x4c0f34);}else{_0x2edef8['push'](_0x4c0f34);}}return _0x2edef8;}});}else{return _0x251004;}}else{var _0x535ae3=_[_0xe662('0x42')](_0x251004,function(_0x4de454){if(_0x4de454['role']!==_0xe662('0x59')){return _0x4de454;}});return _0x535ae3;}});}else{return _0x251004;}}})['then'](function(_0x9a7919){var _0x1de565=[];if(_0x9a7919){_0x580e81=_0x9a7919;for(var _0x5dada3=0x0;_0x5dada3<_0x9a7919[_0xe662('0x3a')];_0x5dada3+=0x1){_0x580e81[_0x5dada3][_0xe662('0x52')]=[];_0x1de565['push'](db[_0xe662('0x2f')]['find']({'where':{'FromId':[_0x5e93a5[_0xe662('0x5b')]['id'],_0x9a7919[_0x5dada3]['id']],'ToId':[_0x5e93a5[_0xe662('0x5b')]['id'],_0x9a7919[_0x5dada3]['id']],'ChatGroupId':null},'attributes':['id',_0xe662('0x53'),_0xe662('0x6f'),'ToId',_0xe662('0x70'),_0xe662('0x4e')],'order':qs[_0xe662('0x3e')](_0xe662('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe662('0x28')](wrapUser(_0x9a7919[_0x5dada3])));}return BPromise[_0xe662('0x72')](_0x1de565);}return[];})[_0xe662('0x28')](function(_0x1bd47e){return{'rows':_0x1bd47e,'count':_0x1bd47e[_0xe662('0x3a')]};})[_0xe662('0x28')](respondWithResult(_0x443ec9,null))[_0xe662('0x4b')](handleError(_0x443ec9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7cc8b68..236e91f 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 _0xe003=['update','remove','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x3dca5f,_0x3bf609){var _0x2ad290=function(_0x35ca60){while(--_0x35ca60){_0x3dca5f['push'](_0x3dca5f['shift']());}};_0x2ad290(++_0x3bf609);}(_0xe003,0x1c4));var _0x3e00=function(_0x5bfb3e,_0x4975ca){_0x5bfb3e=_0x5bfb3e-0x0;var _0x58e6cd=_0xe003[_0x5bfb3e];return _0x58e6cd;};'use strict';var EventEmitter=require(_0x3e00('0x0'));var ChatInternalMessage=require(_0x3e00('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3e00('0x2')](0x0);var events={'afterCreate':_0x3e00('0x3'),'afterUpdate':_0x3e00('0x4'),'afterDestroy':_0x3e00('0x5')};function emitEvent(_0x19e0a4){return function(_0x4f3d98,_0x3705d5,_0x2c75a3){ChatInternalMessageEvents['emit'](_0x19e0a4+':'+_0x4f3d98['id'],_0x4f3d98);ChatInternalMessageEvents[_0x3e00('0x6')](_0x19e0a4,_0x4f3d98);_0x2c75a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x3e00('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x4ef9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','remove'];(function(_0x223983,_0x6e97cb){var _0x4c8fb4=function(_0x89ebeb){while(--_0x89ebeb){_0x223983['push'](_0x223983['shift']());}};_0x4c8fb4(++_0x6e97cb);}(_0x4ef9,0x144));var _0x94ef=function(_0x16d3c7,_0x82a2c4){_0x16d3c7=_0x16d3c7-0x0;var _0x1f6edc=_0x4ef9[_0x16d3c7];return _0x1f6edc;};'use strict';var EventEmitter=require(_0x94ef('0x0'));var ChatInternalMessage=require(_0x94ef('0x1'))['db'][_0x94ef('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x94ef('0x3'),'afterUpdate':_0x94ef('0x4'),'afterDestroy':_0x94ef('0x5')};function emitEvent(_0x53eae1){return function(_0x1a8030,_0x2cb58e,_0x4b2398){ChatInternalMessageEvents[_0x94ef('0x6')](_0x53eae1+':'+_0x1a8030['id'],_0x1a8030);ChatInternalMessageEvents[_0x94ef('0x6')](_0x53eae1,_0x1a8030);_0x4b2398(null);};}for(var e in events){if(events[_0x94ef('0x7')](e)){var event=events[e];ChatInternalMessage[_0x94ef('0x8')](e,emitEvent(event));}}module[_0x94ef('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c827db9..6430f0f 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 _0x69f1=['moment','request-promise','path','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69f1,0x6b));var _0x169f=function(_0x59ff13,_0x2a91c1){_0x59ff13=_0x59ff13-0x0;var _0x4f3045=_0x69f1[_0x59ff13];return _0x4f3045;};'use strict';var _=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var logger=require(_0x169f('0x2'))('api');var moment=require(_0x169f('0x3'));var BPromise=require('bluebird');var rp=require(_0x169f('0x4'));var fs=require('fs');var path=require(_0x169f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x169f('0x6'));module[_0x169f('0x7')]=function(_0x3d6092,_0x2f58a0){return _0x3d6092[_0x169f('0x8')](_0x169f('0x9'),attributes,{'tableName':_0x169f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x57ac=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x139280,_0x1da61c){var _0x48ecdf=function(_0x5e5fbe){while(--_0x5e5fbe){_0x139280['push'](_0x139280['shift']());}};_0x48ecdf(++_0x1da61c);}(_0x57ac,0x1b4));var _0xc57a=function(_0x1a5245,_0x4b71ba){_0x1a5245=_0x1a5245-0x0;var _0x6ee039=_0x57ac[_0x1a5245];return _0x6ee039;};'use strict';var _=require(_0xc57a('0x0'));var util=require(_0xc57a('0x1'));var logger=require('../../config/logger')(_0xc57a('0x2'));var moment=require(_0xc57a('0x3'));var BPromise=require(_0xc57a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc57a('0x5'));var rimraf=require(_0xc57a('0x6'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xc57a('0x7')]=function(_0x4cb128,_0x52cdfa){return _0x4cb128[_0xc57a('0x8')](_0xc57a('0x9'),attributes,{'tableName':_0xc57a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc57a('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1daa473..4e0c1ff 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 _0x5d53=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','register','request','then','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x52171e,_0x45804b){var _0x4bcaa5=function(_0x1aa4c8){while(--_0x1aa4c8){_0x52171e['push'](_0x52171e['shift']());}};_0x4bcaa5(++_0x45804b);}(_0x5d53,0x81));var _0x35d5=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0x5d53[_0x69a451];return _0x3d6ef5;};'use strict';var _=require('lodash');var util=require(_0x35d5('0x0'));var moment=require(_0x35d5('0x1'));var BPromise=require(_0x35d5('0x2'));var rs=require(_0x35d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35d5('0x4'))['db'];var utils=require(_0x35d5('0x5'));var logger=require('../../config/logger')(_0x35d5('0x6'));var config=require(_0x35d5('0x7'));var jayson=require(_0x35d5('0x8'));var client=jayson[_0x35d5('0x9')]['http']({'port':0x232a});config[_0x35d5('0xa')]=_['defaults'](config[_0x35d5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35d5('0xa')]));require('./chatInternalMessage.socket')[_0x35d5('0xb')](socket);function respondWithRpcPromise(_0x3a6018,_0x4a5f1b,_0x241f6e){return new BPromise(function(_0x292ef3,_0xbd56a1){return client[_0x35d5('0xc')](_0x3a6018,_0x241f6e)[_0x35d5('0xd')](function(_0x5eb042){logger['info'](_0x35d5('0xe'),_0x4a5f1b,_0x35d5('0xf'));logger[_0x35d5('0x10')](_0x35d5('0x11'),_0x4a5f1b,'request\x20sent',JSON[_0x35d5('0x12')](_0x5eb042));if(_0x5eb042[_0x35d5('0x13')]){if(_0x5eb042[_0x35d5('0x13')][_0x35d5('0x14')]===0x1f4){logger[_0x35d5('0x13')](_0x35d5('0xe'),_0x4a5f1b,_0x5eb042[_0x35d5('0x13')][_0x35d5('0x15')]);return _0xbd56a1(_0x5eb042['error'][_0x35d5('0x15')]);}logger[_0x35d5('0x13')](_0x35d5('0xe'),_0x4a5f1b,_0x5eb042[_0x35d5('0x13')][_0x35d5('0x15')]);return _0x292ef3(_0x5eb042['error'][_0x35d5('0x15')]);}else{logger[_0x35d5('0x16')](_0x35d5('0xe'),_0x4a5f1b,_0x35d5('0xf'));_0x292ef3(_0x5eb042['result'][_0x35d5('0x15')]);}})[_0x35d5('0x17')](function(_0x912809){logger[_0x35d5('0x13')](_0x35d5('0xe'),_0x4a5f1b,_0x912809);_0xbd56a1(_0x912809);});});} \ No newline at end of file +var _0xc452=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0xc452,0x154));var _0x2c45=function(_0x16d661,_0x39513b){_0x16d661=_0x16d661-0x0;var _0x2effde=_0xc452[_0x16d661];return _0x2effde;};'use strict';var _=require('lodash');var util=require(_0x2c45('0x0'));var moment=require('moment');var BPromise=require(_0x2c45('0x1'));var rs=require(_0x2c45('0x2'));var fs=require('fs');var Redis=require(_0x2c45('0x3'));var db=require(_0x2c45('0x4'))['db'];var utils=require(_0x2c45('0x5'));var logger=require(_0x2c45('0x6'))(_0x2c45('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c45('0x8'));var client=jayson[_0x2c45('0x9')][_0x2c45('0xa')]({'port':0x232a});config['redis']=_[_0x2c45('0xb')](config[_0x2c45('0xc')],{'host':_0x2c45('0xd'),'port':0x18eb});var socket=require(_0x2c45('0xe'))(new Redis(config[_0x2c45('0xc')]));require(_0x2c45('0xf'))[_0x2c45('0x10')](socket);function respondWithRpcPromise(_0xb4d847,_0x2499b6,_0x17c7cf){return new BPromise(function(_0x3957a4,_0x228500){return client[_0x2c45('0x11')](_0xb4d847,_0x17c7cf)[_0x2c45('0x12')](function(_0xde0f62){logger[_0x2c45('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x2499b6,'request\x20sent');logger[_0x2c45('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2499b6,_0x2c45('0x15'),JSON[_0x2c45('0x16')](_0xde0f62));if(_0xde0f62[_0x2c45('0x17')]){if(_0xde0f62[_0x2c45('0x17')][_0x2c45('0x18')]===0x1f4){logger[_0x2c45('0x17')](_0x2c45('0x19'),_0x2499b6,_0xde0f62[_0x2c45('0x17')][_0x2c45('0x1a')]);return _0x228500(_0xde0f62['error'][_0x2c45('0x1a')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x2499b6,_0xde0f62[_0x2c45('0x17')][_0x2c45('0x1a')]);return _0x3957a4(_0xde0f62[_0x2c45('0x17')][_0x2c45('0x1a')]);}else{logger['info'](_0x2c45('0x19'),_0x2499b6,_0x2c45('0x15'));_0x3957a4(_0xde0f62[_0x2c45('0x1b')][_0x2c45('0x1a')]);}})[_0x2c45('0x1c')](function(_0x2370ec){logger[_0x2c45('0x17')](_0x2c45('0x19'),_0x2499b6,_0x2370ec);_0x228500(_0x2370ec);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a4af659..88c5f55 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 _0x2e4f=['chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener','register','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2e4f,0x1a5));var _0xf2e4=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0x2e4f[_0x98db33];return _0x5ae63a;};'use strict';var ChatInternalMessageEvents=require(_0xf2e4('0x0'));var events=[_0xf2e4('0x1'),'remove','update'];function createListener(_0x11c359,_0x5ea72a){return function(_0x36a9a6){_0x5ea72a[_0xf2e4('0x2')](_0x11c359,_0x36a9a6);};}function removeListener(_0x185a9b,_0x447f79){return function(){ChatInternalMessageEvents[_0xf2e4('0x3')](_0x185a9b,_0x447f79);};}exports[_0xf2e4('0x4')]=function(_0x5a072b){for(var _0xa0c128=0x0,_0x53ea9b=events[_0xf2e4('0x5')];_0xa0c128<_0x53ea9b;_0xa0c128++){var _0x29d4a3=events[_0xa0c128];var _0x269685=createListener(_0xf2e4('0x6')+_0x29d4a3,_0x5a072b);ChatInternalMessageEvents['on'](_0x29d4a3,_0x269685);}}; \ No newline at end of file +var _0x179b=['remove','update','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x179b,0x1e1));var _0xb179=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x179b[_0x2a55f8];return _0x245efd;};'use strict';var ChatInternalMessageEvents=require(_0xb179('0x0'));var events=[_0xb179('0x1'),_0xb179('0x2'),_0xb179('0x3')];function createListener(_0x1645bc,_0xe785c1){return function(_0x344b30){_0xe785c1['emit'](_0x1645bc,_0x344b30);};}function removeListener(_0x5a9107,_0x96eb8c){return function(){ChatInternalMessageEvents['removeListener'](_0x5a9107,_0x96eb8c);};}exports[_0xb179('0x4')]=function(_0x1f203d){for(var _0x25de37=0x0,_0x1e56be=events[_0xb179('0x5')];_0x25de37<_0x1e56be;_0x25de37++){var _0x23bee2=events[_0x25de37];var _0x4bbbed=createListener(_0xb179('0x6')+_0x23bee2,_0x1f203d);ChatInternalMessageEvents['on'](_0x23bee2,_0x4bbbed);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4acab42..fc37ce4 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 _0xa0de=['isAuthenticated','get','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','fs-extra','../../config/environment','./chatInternalMessage.controller'];(function(_0x49f59e,_0x3b3fce){var _0x1786a0=function(_0x5d51e8){while(--_0x5d51e8){_0x49f59e['push'](_0x49f59e['shift']());}};_0x1786a0(++_0x3b3fce);}(_0xa0de,0x1c3));var _0xea0d=function(_0x2ad159,_0x22b591){_0x2ad159=_0x2ad159-0x0;var _0x507651=_0xa0de[_0x2ad159];return _0x507651;};'use strict';var multer=require(_0xea0d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea0d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xea0d('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea0d('0x3'));var controller=require(_0xea0d('0x4'));router['get']('/',auth[_0xea0d('0x5')](),controller['index']);router[_0xea0d('0x6')](_0xea0d('0x7'),auth['isAuthenticated'](),controller[_0xea0d('0x8')]);router['get'](_0xea0d('0x9'),auth[_0xea0d('0x5')](),controller[_0xea0d('0xa')]);router[_0xea0d('0x6')](_0xea0d('0xb'),auth['isAuthenticated'](),controller[_0xea0d('0xc')]);router[_0xea0d('0xd')]('/',auth[_0xea0d('0x5')](),controller[_0xea0d('0xe')]);router[_0xea0d('0xf')](_0xea0d('0xb'),controller[_0xea0d('0x10')]);router[_0xea0d('0x11')](_0xea0d('0xb'),auth[_0xea0d('0x5')](),controller['destroy']);module[_0xea0d('0x12')]=router; \ No newline at end of file +var _0x616b=['create','put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','/describe','isAuthenticated','getUsers','/:id'];(function(_0x124a88,_0x20514e){var _0x2b0d88=function(_0xe5d7bc){while(--_0xe5d7bc){_0x124a88['push'](_0x124a88['shift']());}};_0x2b0d88(++_0x20514e);}(_0x616b,0x1e5));var _0xb616=function(_0x2b365f,_0x17aa37){_0x2b365f=_0x2b365f-0x0;var _0x26b060=_0x616b[_0x2b365f];return _0x26b060;};'use strict';var multer=require('multer');var util=require(_0xb616('0x0'));var path=require('path');var timeout=require(_0xb616('0x1'));var express=require('express');var router=express[_0xb616('0x2')]();var fs_extra=require(_0xb616('0x3'));var auth=require(_0xb616('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb616('0x5'));router[_0xb616('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb616('0x7'),auth[_0xb616('0x8')](),controller['describe']);router[_0xb616('0x6')]('/users',auth[_0xb616('0x8')](),controller[_0xb616('0x9')]);router[_0xb616('0x6')](_0xb616('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb616('0x8')](),controller[_0xb616('0xb')]);router[_0xb616('0xc')](_0xb616('0xa'),controller[_0xb616('0xd')]);router[_0xb616('0xe')](_0xb616('0xa'),auth[_0xb616('0x8')](),controller[_0xb616('0xf')]);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 8d87eed..6094502 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 _0x0cfa=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0xc7a446,_0x555b8b){var _0x37ab03=function(_0x327204){while(--_0x327204){_0xc7a446['push'](_0xc7a446['shift']());}};_0x37ab03(++_0x555b8b);}(_0x0cfa,0x73));var _0xa0cf=function(_0x43317b,_0xc88025){_0x43317b=_0x43317b-0x0;var _0xaee277=_0x0cfa[_0x43317b];return _0xaee277;};'use strict';var Sequelize=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]={'body':{'type':Sequelize[_0xa0cf('0x2')](_0xa0cf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa0cf('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xa0cf('0x6')]},'providerName':{'type':Sequelize[_0xa0cf('0x7')]},'providerResponse':{'type':Sequelize[_0xa0cf('0x2')]}}; \ No newline at end of file +var _0x6ea9=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3ac0e8,_0x3d51c1){var _0x23dcd2=function(_0x14d20e){while(--_0x14d20e){_0x3ac0e8['push'](_0x3ac0e8['shift']());}};_0x23dcd2(++_0x3d51c1);}(_0x6ea9,0x89));var _0x96ea=function(_0x1ed7d4,_0x4b17a5){_0x1ed7d4=_0x1ed7d4-0x0;var _0x488f90=_0x6ea9[_0x1ed7d4];return _0x488f90;};'use strict';var Sequelize=require(_0x96ea('0x0'));module[_0x96ea('0x1')]={'body':{'type':Sequelize[_0x96ea('0x2')](_0x96ea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96ea('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x96ea('0x5')]('in',_0x96ea('0x6')),'defaultValue':_0x96ea('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x96ea('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 3ab387c..cdbc998 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 _0x8e74=['fullname','email','internal','interface','channel','motionChannel','event','EventManager','formData','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','update','destroy','end','sendStatus','stack','name','index','ChatMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','describe','accept','chat','reject','UserId','user','agent','get','ChatInteractionId','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8e74,0x189));var _0x48e7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e74[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require(_0x48e7('0x0'));var Redis=require(_0x48e7('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0x48e7('0x2'));var logger=require(_0x48e7('0x3'))('api');var config=require(_0x48e7('0x4'));var db=require(_0x48e7('0x5'))['db'];config[_0x48e7('0x6')]=_['defaults'](config[_0x48e7('0x6')],{'host':_0x48e7('0x7'),'port':0x18eb});var socket=require(_0x48e7('0x8'))(new Redis(config[_0x48e7('0x6')]));require(_0x48e7('0x9'))[_0x48e7('0xa')](socket);var jayson=require(_0x48e7('0xb'));var client=jayson[_0x48e7('0xc')][_0x48e7('0xd')]({'port':0x232c});var client9002=jayson[_0x48e7('0xc')][_0x48e7('0xd')]({'port':0x232a});var interaction_log=require(_0x48e7('0x3'))('chat-interactions');function respondWithRpcPromise(_0x3b0136,_0x4a7240,_0x48f10e,_0x279cba){return new Promise(function(_0x2ed224,_0x528b51){var _0x5ce0f8=_0x279cba||client;return _0x5ce0f8[_0x48e7('0xe')](_0x3b0136,_0x48f10e)[_0x48e7('0xf')](function(_0x3b0610){logger[_0x48e7('0x10')]('ChatMessage,\x20%s,\x20%s',_0x4a7240,_0x48e7('0x11'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4a7240,'request\x20sent',JSON['stringify'](_0x3b0610));if(_0x3b0610[_0x48e7('0x12')]){if(_0x3b0610[_0x48e7('0x12')][_0x48e7('0x13')]===0x1f4){logger[_0x48e7('0x12')](_0x48e7('0x14'),_0x4a7240,_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);return _0x528b51(_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);}logger[_0x48e7('0x12')](_0x48e7('0x14'),_0x4a7240,_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);return _0x2ed224(_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);}else{logger['info'](_0x48e7('0x14'),_0x4a7240,'request\x20sent');_0x2ed224(_0x3b0610[_0x48e7('0x16')][_0x48e7('0x15')]);}})[_0x48e7('0x17')](function(_0x3a2bb3){logger[_0x48e7('0x12')](_0x48e7('0x14'),_0x4a7240,_0x3a2bb3);_0x528b51(_0x3a2bb3);});});}function respondWithResult(_0x7cae1f,_0x38f21c){_0x38f21c=_0x38f21c||0xc8;return function(_0x59649f){if(_0x59649f){return _0x7cae1f[_0x48e7('0x18')](_0x38f21c)[_0x48e7('0x19')](_0x59649f);}};}function respondWithFilteredResult(_0x4d05ed,_0x472eea){return function(_0xbee7b4){if(_0xbee7b4){var _0x89b571=typeof _0x472eea[_0x48e7('0x1a')]===_0x48e7('0x1b')&&typeof _0x472eea['limit']==='undefined';var _0x445d0e=_0xbee7b4[_0x48e7('0x1c')];var _0x26da01=_0x89b571?0x0:_0x472eea[_0x48e7('0x1a')];var _0x513a3f=_0x89b571?_0xbee7b4[_0x48e7('0x1c')]:_0x472eea[_0x48e7('0x1a')]+_0x472eea[_0x48e7('0x1d')];var _0x2421c2;if(_0x513a3f>=_0x445d0e){_0x513a3f=_0x445d0e;_0x2421c2=0xc8;}else{_0x2421c2=0xce;}_0x4d05ed[_0x48e7('0x18')](_0x2421c2);return _0x4d05ed['set']('Content-Range',_0x26da01+'-'+_0x513a3f+'/'+_0x445d0e)[_0x48e7('0x19')](_0xbee7b4);}return null;};}function saveUpdates(_0x2f35e8){return function(_0x5b6b51){if(_0x5b6b51){return _0x5b6b51[_0x48e7('0x1e')](_0x2f35e8)['then'](function(_0x2cdf75){return _0x2cdf75;});}return null;};}function removeEntity(_0xf1b55b){return function(_0x6a7a7f){if(_0x6a7a7f){return _0x6a7a7f[_0x48e7('0x1f')]()[_0x48e7('0xf')](function(){_0xf1b55b[_0x48e7('0x18')](0xcc)[_0x48e7('0x20')]();});}};}function handleEntityNotFound(_0x1a6591){return function(_0x3ca412){if(!_0x3ca412){_0x1a6591[_0x48e7('0x21')](0x194);}return _0x3ca412;};}function handleError(_0x197274,_0x763e05){_0x763e05=_0x763e05||0x1f4;return function(_0x4acec0){logger['error'](_0x4acec0[_0x48e7('0x22')]);if(_0x4acec0['name']){delete _0x4acec0[_0x48e7('0x23')];}_0x197274['status'](_0x763e05)['send'](_0x4acec0);};}exports[_0x48e7('0x24')]=function(_0x5ffc66,_0x339a56){var _0x505923={},_0xb98a10={},_0x38a495={'count':0x0,'rows':[]};var _0x552061=_['map'](db[_0x48e7('0x25')]['rawAttributes'],function(_0x561e38){return{'name':_0x561e38[_0x48e7('0x26')],'type':_0x561e38[_0x48e7('0x27')][_0x48e7('0x28')]};});_0xb98a10[_0x48e7('0x29')]=_[_0x48e7('0x2a')](_0x552061,_0x48e7('0x23'));_0xb98a10[_0x48e7('0x2b')]=_[_0x48e7('0x2c')](_0x5ffc66['query']);_0xb98a10[_0x48e7('0x2d')]=_[_0x48e7('0x2e')](_0xb98a10[_0x48e7('0x29')],_0xb98a10[_0x48e7('0x2b')]);_0x505923[_0x48e7('0x2f')]=_[_0x48e7('0x2e')](_0xb98a10[_0x48e7('0x29')],qs[_0x48e7('0x30')](_0x5ffc66['query'][_0x48e7('0x30')]));_0x505923[_0x48e7('0x2f')]=_0x505923[_0x48e7('0x2f')]['length']?_0x505923[_0x48e7('0x2f')]:_0xb98a10['model'];if(!_0x5ffc66[_0x48e7('0x2b')]['hasOwnProperty'](_0x48e7('0x31'))){_0x505923['limit']=qs['limit'](_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x1d')]);_0x505923[_0x48e7('0x1a')]=qs[_0x48e7('0x1a')](_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x1a')]);}_0x505923[_0x48e7('0x32')]=qs[_0x48e7('0x33')](_0x5ffc66['query'][_0x48e7('0x33')]);_0x505923[_0x48e7('0x34')]=qs[_0x48e7('0x2d')](_[_0x48e7('0x35')](_0x5ffc66['query'],_0xb98a10[_0x48e7('0x2d')]),_0x552061);if(_0x5ffc66['query'][_0x48e7('0x36')]){_0x505923[_0x48e7('0x34')]=_[_0x48e7('0x37')](_0x505923[_0x48e7('0x34')],{'$or':_[_0x48e7('0x2a')](_0x552061,function(_0x395dad){if(_0x395dad[_0x48e7('0x27')]!=='VIRTUAL'){var _0x59b2b2={};_0x59b2b2[_0x395dad[_0x48e7('0x23')]]={'$like':'%'+_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x36')]+'%'};return _0x59b2b2;}})});}_0x505923=_['merge']({},_0x505923,_0x5ffc66['options']);var _0x52117d={'where':_0x505923['where']};return db['ChatMessage'][_0x48e7('0x1c')](_0x52117d)[_0x48e7('0xf')](function(_0x3a7128){_0x38a495[_0x48e7('0x1c')]=_0x3a7128;if(_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x38')]){_0x505923[_0x48e7('0x39')]=[{'all':!![]}];}return db['ChatMessage'][_0x48e7('0x3a')](_0x505923);})[_0x48e7('0xf')](function(_0x561876){_0x38a495[_0x48e7('0x3b')]=_0x561876;return _0x38a495;})[_0x48e7('0xf')](respondWithFilteredResult(_0x339a56,_0x505923))[_0x48e7('0x17')](handleError(_0x339a56,null));};exports[_0x48e7('0x3c')]=function(_0x412f3f,_0x3c8219){var _0xe0bddb={'raw':!![],'where':{'id':_0x412f3f['params']['id']}},_0x5120e7={};_0x5120e7[_0x48e7('0x29')]=_[_0x48e7('0x2c')](db[_0x48e7('0x25')][_0x48e7('0x3d')]);_0x5120e7['query']=_['keys'](_0x412f3f[_0x48e7('0x2b')]);_0x5120e7['filters']=_[_0x48e7('0x2e')](_0x5120e7[_0x48e7('0x29')],_0x5120e7[_0x48e7('0x2b')]);_0xe0bddb[_0x48e7('0x2f')]=_[_0x48e7('0x2e')](_0x5120e7['model'],qs[_0x48e7('0x30')](_0x412f3f[_0x48e7('0x2b')]['fields']));_0xe0bddb[_0x48e7('0x2f')]=_0xe0bddb['attributes']['length']?_0xe0bddb[_0x48e7('0x2f')]:_0x5120e7[_0x48e7('0x29')];if(_0x412f3f[_0x48e7('0x2b')][_0x48e7('0x38')]){_0xe0bddb[_0x48e7('0x39')]=[{'all':!![]}];}_0xe0bddb=_[_0x48e7('0x37')]({},_0xe0bddb,_0x412f3f['options']);return db[_0x48e7('0x25')][_0x48e7('0x3e')](_0xe0bddb)['then'](handleEntityNotFound(_0x3c8219,null))[_0x48e7('0xf')](respondWithResult(_0x3c8219,null))[_0x48e7('0x17')](handleError(_0x3c8219,null));};exports[_0x48e7('0x3f')]=function(_0x31bfd7,_0x2e4eb0){return db[_0x48e7('0x25')][_0x48e7('0x3f')](_0x31bfd7['body'],{})[_0x48e7('0xf')](respondWithResult(_0x2e4eb0,0xc9))['catch'](handleError(_0x2e4eb0,null));};exports[_0x48e7('0x1e')]=function(_0x21e58d,_0x4a1ab0){if(_0x21e58d[_0x48e7('0x40')]['id']){delete _0x21e58d[_0x48e7('0x40')]['id'];}return db['ChatMessage'][_0x48e7('0x3e')]({'where':{'id':_0x21e58d[_0x48e7('0x41')]['id']}})[_0x48e7('0xf')](handleEntityNotFound(_0x4a1ab0,null))[_0x48e7('0xf')](saveUpdates(_0x21e58d[_0x48e7('0x40')],null))[_0x48e7('0xf')](respondWithResult(_0x4a1ab0,null))[_0x48e7('0x17')](handleError(_0x4a1ab0,null));};exports[_0x48e7('0x1f')]=function(_0x3a6aa0,_0x599fd3){return db['ChatMessage'][_0x48e7('0x3e')]({'where':{'id':_0x3a6aa0[_0x48e7('0x41')]['id']}})[_0x48e7('0xf')](handleEntityNotFound(_0x599fd3,null))[_0x48e7('0xf')](removeEntity(_0x599fd3,null))['catch'](handleError(_0x599fd3,null));};exports[_0x48e7('0x42')]=function(_0x28859e,_0x2a9e03){return db[_0x48e7('0x25')][_0x48e7('0x42')]()['then'](respondWithResult(_0x2a9e03,null))['catch'](handleError(_0x2a9e03,null));};exports[_0x48e7('0x43')]=function(_0x473a16,_0x3ca4c9){var _0x4191c9=_0x48e7('0x44');return interactionService['acceptMessage'](_0x473a16,_0x4191c9)[_0x48e7('0xf')](respondWithResult(_0x3ca4c9,null))[_0x48e7('0x17')](handleError(_0x3ca4c9,null));};exports[_0x48e7('0x45')]=function(_0x4eeeee,_0x596ffd){var _0x26dfc7={'agent':{},'channel':_0x48e7('0x44')};if(_0x4eeeee[_0x48e7('0x40')]['id']){delete _0x4eeeee[_0x48e7('0x40')]['id'];}_0x4eeeee[_0x48e7('0x40')][_0x48e7('0x46')]=_0x4eeeee[_0x48e7('0x40')]['UserId']||_0x4eeeee[_0x48e7('0x47')]['id'];_0x26dfc7[_0x48e7('0x48')]['id']=_0x4eeeee[_0x48e7('0x40')][_0x48e7('0x46')];return db['ChatMessage'][_0x48e7('0x3e')]({'where':{'id':_0x4eeeee[_0x48e7('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x596ffd,null))['then'](function(_0x4d7a55){if(_0x4d7a55){_0x26dfc7[_0x48e7('0x15')]=_0x4d7a55[_0x48e7('0x49')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x4d7a55[_0x48e7('0x4a')]}});}return null;})['then'](handleEntityNotFound(_0x596ffd,null))[_0x48e7('0xf')](function(_0x3e818b){if(_0x3e818b){_0x26dfc7[_0x48e7('0x4b')]=_0x3e818b['get']({'plain':!![]});interaction_log[_0x48e7('0x10')](_0x48e7('0x4c'),_0x4eeeee[_0x48e7('0x47')]['id'],_0x4eeeee[_0x48e7('0x47')][_0x48e7('0x23')],_0x4eeeee['user'][_0x48e7('0x4d')],_0x26dfc7[_0x48e7('0x4b')]['id'],_0x4eeeee[_0x48e7('0x40')]?JSON[_0x48e7('0x4e')](_0x4eeeee[_0x48e7('0x40')]):'null');return respondWithRpcPromise(_0x48e7('0x4f'),_0x48e7('0x50'),_0x26dfc7);}return null;})[_0x48e7('0xf')](function(_0x5b91b8){var _0x5a95a8=_0x48e7('0x51')+_0x5b91b8[_0x48e7('0x15')][_0x48e7('0x52')];return db[_0x48e7('0x53')][_0x48e7('0x2b')](_0x5a95a8,{'type':db['Sequelize'][_0x48e7('0x54')][_0x48e7('0x55')],'raw':!![]})['then'](function(_0x2b7913){return _0x2b7913;});})[_0x48e7('0xf')](function(_0x23b6b8){if(_0x23b6b8){_0x26dfc7[_0x48e7('0x15')]['contact']=_0x23b6b8[0x0];if(!_0x4eeeee[_0x48e7('0x40')]['UserId'])return;return db[_0x48e7('0x56')][_0x48e7('0x3e')]({'where':{'id':_0x4eeeee[_0x48e7('0x40')][_0x48e7('0x46')],'role':_0x48e7('0x48')},'attributes':['id','name',_0x48e7('0x57'),_0x48e7('0x58'),_0x48e7('0x59')],'raw':!![]});}return null;})[_0x48e7('0xf')](function(_0x30a8c7){if(!_0x30a8c7)return null;_0x26dfc7['message'][_0x48e7('0x48')]=_0x30a8c7;return _0x26dfc7;})[_0x48e7('0xf')](function(_0x1625b1){if(_0x1625b1){_0x1625b1['message'][_0x48e7('0x5a')]=util['format']('SIP/%s',_0x4eeeee[_0x48e7('0x47')][_0x48e7('0x23')]);_0x1625b1['message'][_0x48e7('0x5b')]=_0x26dfc7[_0x48e7('0x5b')];_0x1625b1[_0x48e7('0x15')][_0x48e7('0x5c')]=_0x26dfc7['channel'];_0x1625b1[_0x48e7('0x15')][_0x48e7('0x5d')]=_0x48e7('0x45');respondWithRpcPromise(_0x48e7('0x5e'),'EventManager',{'event':'rejectmessage','message':_[_0x48e7('0x37')](_0x26dfc7[_0x48e7('0x15')],JSON['parse'](_0x26dfc7['interaction'][_0x48e7('0x5f')]))},client9002);return _0x26dfc7;}return null;})[_0x48e7('0xf')](respondWithResult(_0x596ffd,null))[_0x48e7('0x17')](handleError(_0x596ffd,null));}; \ No newline at end of file +var _0xc644=['findAll','rows','show','params','keys','intersection','includeAll','create','body','find','describe','accept','chat','reject','UserId','agent','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','json','offset','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','send','index','ChatMessage','rawAttributes','fieldName','type','key','name','query','filters','attributes','fields','length','model','nolimit','limit','order','sort','where','filter','merge','options','include'];(function(_0x20737e,_0x3e70c0){var _0x4ade3c=function(_0x1d76a0){while(--_0x1d76a0){_0x20737e['push'](_0x20737e['shift']());}};_0x4ade3c(++_0x3e70c0);}(_0xc644,0x16d));var _0x4c64=function(_0x389a12,_0x41a036){_0x389a12=_0x389a12-0x0;var _0x1db8a9=_0xc644[_0x389a12];return _0x1db8a9;};'use strict';var util=require(_0x4c64('0x0'));var _=require('lodash');var Redis=require(_0x4c64('0x1'));var interactionService=require(_0x4c64('0x2'));var qs=require(_0x4c64('0x3'));var logger=require(_0x4c64('0x4'))(_0x4c64('0x5'));var config=require('../../config/environment');var db=require(_0x4c64('0x6'))['db'];config['redis']=_[_0x4c64('0x7')](config[_0x4c64('0x8')],{'host':_0x4c64('0x9'),'port':0x18eb});var socket=require(_0x4c64('0xa'))(new Redis(config[_0x4c64('0x8')]));require(_0x4c64('0xb'))[_0x4c64('0xc')](socket);var jayson=require(_0x4c64('0xd'));var client=jayson[_0x4c64('0xe')][_0x4c64('0xf')]({'port':0x232c});var client9002=jayson[_0x4c64('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x4c64('0x4'))(_0x4c64('0x10'));function respondWithRpcPromise(_0x54d4a5,_0x3b4908,_0x29102a,_0x20b09a){return new Promise(function(_0x1cd328,_0x8f6351){var _0x355ae7=_0x20b09a||client;return _0x355ae7[_0x4c64('0x11')](_0x54d4a5,_0x29102a)[_0x4c64('0x12')](function(_0x40457b){logger[_0x4c64('0x13')](_0x4c64('0x14'),_0x3b4908,_0x4c64('0x15'));logger[_0x4c64('0x16')](_0x4c64('0x17'),_0x3b4908,'request\x20sent',JSON['stringify'](_0x40457b));if(_0x40457b[_0x4c64('0x18')]){if(_0x40457b['error']['code']===0x1f4){logger[_0x4c64('0x18')]('ChatMessage,\x20%s,\x20%s',_0x3b4908,_0x40457b['error']['message']);return _0x8f6351(_0x40457b[_0x4c64('0x18')][_0x4c64('0x19')]);}logger['error'](_0x4c64('0x14'),_0x3b4908,_0x40457b[_0x4c64('0x18')]['message']);return _0x1cd328(_0x40457b[_0x4c64('0x18')][_0x4c64('0x19')]);}else{logger[_0x4c64('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3b4908,_0x4c64('0x15'));_0x1cd328(_0x40457b[_0x4c64('0x1a')][_0x4c64('0x19')]);}})[_0x4c64('0x1b')](function(_0x23dd08){logger['error']('ChatMessage,\x20%s,\x20%s',_0x3b4908,_0x23dd08);_0x8f6351(_0x23dd08);});});}function respondWithResult(_0x355653,_0x1fea22){_0x1fea22=_0x1fea22||0xc8;return function(_0x188471){if(_0x188471){return _0x355653[_0x4c64('0x1c')](_0x1fea22)[_0x4c64('0x1d')](_0x188471);}};}function respondWithFilteredResult(_0x171214,_0x559449){return function(_0x480e02){if(_0x480e02){var _0x16b9ea=typeof _0x559449[_0x4c64('0x1e')]==='undefined'&&typeof _0x559449['limit']===_0x4c64('0x1f');var _0x383918=_0x480e02['count'];var _0x368137=_0x16b9ea?0x0:_0x559449[_0x4c64('0x1e')];var _0x2b6fe8=_0x16b9ea?_0x480e02[_0x4c64('0x20')]:_0x559449[_0x4c64('0x1e')]+_0x559449['limit'];var _0x3f2ca1;if(_0x2b6fe8>=_0x383918){_0x2b6fe8=_0x383918;_0x3f2ca1=0xc8;}else{_0x3f2ca1=0xce;}_0x171214[_0x4c64('0x1c')](_0x3f2ca1);return _0x171214[_0x4c64('0x21')](_0x4c64('0x22'),_0x368137+'-'+_0x2b6fe8+'/'+_0x383918)['json'](_0x480e02);}return null;};}function saveUpdates(_0x54a3be){return function(_0x4a1f5a){if(_0x4a1f5a){return _0x4a1f5a[_0x4c64('0x23')](_0x54a3be)[_0x4c64('0x12')](function(_0x296004){return _0x296004;});}return null;};}function removeEntity(_0x583afd){return function(_0xfe8cba){if(_0xfe8cba){return _0xfe8cba[_0x4c64('0x24')]()[_0x4c64('0x12')](function(){_0x583afd[_0x4c64('0x1c')](0xcc)[_0x4c64('0x25')]();});}};}function handleEntityNotFound(_0x4f7f24){return function(_0x5dc6d1){if(!_0x5dc6d1){_0x4f7f24[_0x4c64('0x26')](0x194);}return _0x5dc6d1;};}function handleError(_0x26512c,_0x202b7c){_0x202b7c=_0x202b7c||0x1f4;return function(_0xa748ee){logger[_0x4c64('0x18')](_0xa748ee[_0x4c64('0x27')]);if(_0xa748ee['name']){delete _0xa748ee['name'];}_0x26512c[_0x4c64('0x1c')](_0x202b7c)[_0x4c64('0x28')](_0xa748ee);};}exports[_0x4c64('0x29')]=function(_0x5741fb,_0x1f1ef2){var _0x139259={},_0x15f8fa={},_0x42fe51={'count':0x0,'rows':[]};var _0x4cd347=_['map'](db[_0x4c64('0x2a')][_0x4c64('0x2b')],function(_0x467c4e){return{'name':_0x467c4e[_0x4c64('0x2c')],'type':_0x467c4e[_0x4c64('0x2d')][_0x4c64('0x2e')]};});_0x15f8fa['model']=_['map'](_0x4cd347,_0x4c64('0x2f'));_0x15f8fa[_0x4c64('0x30')]=_['keys'](_0x5741fb[_0x4c64('0x30')]);_0x15f8fa[_0x4c64('0x31')]=_['intersection'](_0x15f8fa['model'],_0x15f8fa[_0x4c64('0x30')]);_0x139259[_0x4c64('0x32')]=_['intersection'](_0x15f8fa['model'],qs[_0x4c64('0x33')](_0x5741fb['query'][_0x4c64('0x33')]));_0x139259[_0x4c64('0x32')]=_0x139259['attributes'][_0x4c64('0x34')]?_0x139259[_0x4c64('0x32')]:_0x15f8fa[_0x4c64('0x35')];if(!_0x5741fb[_0x4c64('0x30')]['hasOwnProperty'](_0x4c64('0x36'))){_0x139259['limit']=qs[_0x4c64('0x37')](_0x5741fb[_0x4c64('0x30')][_0x4c64('0x37')]);_0x139259['offset']=qs['offset'](_0x5741fb[_0x4c64('0x30')][_0x4c64('0x1e')]);}_0x139259[_0x4c64('0x38')]=qs['sort'](_0x5741fb['query'][_0x4c64('0x39')]);_0x139259[_0x4c64('0x3a')]=qs[_0x4c64('0x31')](_['pick'](_0x5741fb[_0x4c64('0x30')],_0x15f8fa['filters']),_0x4cd347);if(_0x5741fb['query'][_0x4c64('0x3b')]){_0x139259['where']=_[_0x4c64('0x3c')](_0x139259['where'],{'$or':_['map'](_0x4cd347,function(_0x4b75ff){if(_0x4b75ff[_0x4c64('0x2d')]!=='VIRTUAL'){var _0x3b55c8={};_0x3b55c8[_0x4b75ff[_0x4c64('0x2f')]]={'$like':'%'+_0x5741fb['query'][_0x4c64('0x3b')]+'%'};return _0x3b55c8;}})});}_0x139259=_['merge']({},_0x139259,_0x5741fb[_0x4c64('0x3d')]);var _0xb71d99={'where':_0x139259['where']};return db[_0x4c64('0x2a')][_0x4c64('0x20')](_0xb71d99)[_0x4c64('0x12')](function(_0x18202f){_0x42fe51['count']=_0x18202f;if(_0x5741fb[_0x4c64('0x30')]['includeAll']){_0x139259[_0x4c64('0x3e')]=[{'all':!![]}];}return db[_0x4c64('0x2a')][_0x4c64('0x3f')](_0x139259);})[_0x4c64('0x12')](function(_0x1f274c){_0x42fe51[_0x4c64('0x40')]=_0x1f274c;return _0x42fe51;})[_0x4c64('0x12')](respondWithFilteredResult(_0x1f1ef2,_0x139259))[_0x4c64('0x1b')](handleError(_0x1f1ef2,null));};exports[_0x4c64('0x41')]=function(_0x31229b,_0x39d79b){var _0x27eb80={'raw':!![],'where':{'id':_0x31229b[_0x4c64('0x42')]['id']}},_0x581477={};_0x581477['model']=_[_0x4c64('0x43')](db[_0x4c64('0x2a')][_0x4c64('0x2b')]);_0x581477[_0x4c64('0x30')]=_[_0x4c64('0x43')](_0x31229b[_0x4c64('0x30')]);_0x581477[_0x4c64('0x31')]=_['intersection'](_0x581477[_0x4c64('0x35')],_0x581477[_0x4c64('0x30')]);_0x27eb80[_0x4c64('0x32')]=_[_0x4c64('0x44')](_0x581477[_0x4c64('0x35')],qs[_0x4c64('0x33')](_0x31229b['query'][_0x4c64('0x33')]));_0x27eb80[_0x4c64('0x32')]=_0x27eb80[_0x4c64('0x32')][_0x4c64('0x34')]?_0x27eb80[_0x4c64('0x32')]:_0x581477['model'];if(_0x31229b['query'][_0x4c64('0x45')]){_0x27eb80[_0x4c64('0x3e')]=[{'all':!![]}];}_0x27eb80=_[_0x4c64('0x3c')]({},_0x27eb80,_0x31229b[_0x4c64('0x3d')]);return db['ChatMessage']['find'](_0x27eb80)['then'](handleEntityNotFound(_0x39d79b,null))['then'](respondWithResult(_0x39d79b,null))[_0x4c64('0x1b')](handleError(_0x39d79b,null));};exports['create']=function(_0x57c556,_0x2cc4f4){return db[_0x4c64('0x2a')][_0x4c64('0x46')](_0x57c556[_0x4c64('0x47')],{})[_0x4c64('0x12')](respondWithResult(_0x2cc4f4,0xc9))[_0x4c64('0x1b')](handleError(_0x2cc4f4,null));};exports[_0x4c64('0x23')]=function(_0x14e262,_0x35274c){if(_0x14e262[_0x4c64('0x47')]['id']){delete _0x14e262[_0x4c64('0x47')]['id'];}return db[_0x4c64('0x2a')][_0x4c64('0x48')]({'where':{'id':_0x14e262['params']['id']}})[_0x4c64('0x12')](handleEntityNotFound(_0x35274c,null))[_0x4c64('0x12')](saveUpdates(_0x14e262[_0x4c64('0x47')],null))[_0x4c64('0x12')](respondWithResult(_0x35274c,null))[_0x4c64('0x1b')](handleError(_0x35274c,null));};exports[_0x4c64('0x24')]=function(_0x3696e4,_0x188a79){return db[_0x4c64('0x2a')]['find']({'where':{'id':_0x3696e4[_0x4c64('0x42')]['id']}})['then'](handleEntityNotFound(_0x188a79,null))[_0x4c64('0x12')](removeEntity(_0x188a79,null))[_0x4c64('0x1b')](handleError(_0x188a79,null));};exports[_0x4c64('0x49')]=function(_0x205575,_0x44ede3){return db[_0x4c64('0x2a')][_0x4c64('0x49')]()[_0x4c64('0x12')](respondWithResult(_0x44ede3,null))[_0x4c64('0x1b')](handleError(_0x44ede3,null));};exports[_0x4c64('0x4a')]=function(_0x2ab73a,_0x533af9){var _0x159dbd=_0x4c64('0x4b');return interactionService['acceptMessage'](_0x2ab73a,_0x159dbd)['then'](respondWithResult(_0x533af9,null))[_0x4c64('0x1b')](handleError(_0x533af9,null));};exports[_0x4c64('0x4c')]=function(_0x18e79a,_0x586657){var _0x350a11={'agent':{},'channel':_0x4c64('0x4b')};if(_0x18e79a[_0x4c64('0x47')]['id']){delete _0x18e79a[_0x4c64('0x47')]['id'];}_0x18e79a['body'][_0x4c64('0x4d')]=_0x18e79a['body']['UserId']||_0x18e79a['user']['id'];_0x350a11[_0x4c64('0x4e')]['id']=_0x18e79a['body'][_0x4c64('0x4d')];return db[_0x4c64('0x2a')][_0x4c64('0x48')]({'where':{'id':_0x18e79a['params']['id'],'UserId':null}})[_0x4c64('0x12')](handleEntityNotFound(_0x586657,null))[_0x4c64('0x12')](function(_0x4ade66){if(_0x4ade66){_0x350a11[_0x4c64('0x19')]=_0x4ade66[_0x4c64('0x4f')]({'plain':!![]});return db[_0x4c64('0x50')][_0x4c64('0x48')]({'where':{'id':_0x4ade66[_0x4c64('0x51')]}});}return null;})[_0x4c64('0x12')](handleEntityNotFound(_0x586657,null))[_0x4c64('0x12')](function(_0x22c67e){if(_0x22c67e){_0x350a11['interaction']=_0x22c67e['get']({'plain':!![]});interaction_log[_0x4c64('0x13')](_0x4c64('0x52'),_0x18e79a['user']['id'],_0x18e79a[_0x4c64('0x53')][_0x4c64('0x2f')],_0x18e79a[_0x4c64('0x53')][_0x4c64('0x54')],_0x350a11[_0x4c64('0x55')]['id'],_0x18e79a[_0x4c64('0x47')]?JSON[_0x4c64('0x56')](_0x18e79a[_0x4c64('0x47')]):_0x4c64('0x57'));return respondWithRpcPromise(_0x4c64('0x58'),_0x4c64('0x59'),_0x350a11);}return null;})['then'](function(_0x26843d){var _0x2bae69=_0x4c64('0x5a')+_0x26843d[_0x4c64('0x19')]['ContactId'];return db[_0x4c64('0x5b')]['query'](_0x2bae69,{'type':db[_0x4c64('0x5c')]['QueryTypes'][_0x4c64('0x5d')],'raw':!![]})[_0x4c64('0x12')](function(_0x1a0422){return _0x1a0422;});})[_0x4c64('0x12')](function(_0x5a4d02){if(_0x5a4d02){_0x350a11[_0x4c64('0x19')][_0x4c64('0x5e')]=_0x5a4d02[0x0];if(!_0x18e79a[_0x4c64('0x47')][_0x4c64('0x4d')])return;return db[_0x4c64('0x5f')][_0x4c64('0x48')]({'where':{'id':_0x18e79a['body'][_0x4c64('0x4d')],'role':_0x4c64('0x4e')},'attributes':['id',_0x4c64('0x2f'),'fullname',_0x4c64('0x60'),_0x4c64('0x61')],'raw':!![]});}return null;})[_0x4c64('0x12')](function(_0x11366f){if(!_0x11366f)return null;_0x350a11[_0x4c64('0x19')][_0x4c64('0x4e')]=_0x11366f;return _0x350a11;})[_0x4c64('0x12')](function(_0x5ee0ef){if(_0x5ee0ef){_0x5ee0ef['message'][_0x4c64('0x62')]=util[_0x4c64('0x63')](_0x4c64('0x64'),_0x18e79a[_0x4c64('0x53')]['name']);_0x5ee0ef[_0x4c64('0x19')]['channel']=_0x350a11[_0x4c64('0x65')];_0x5ee0ef[_0x4c64('0x19')][_0x4c64('0x66')]=_0x350a11['channel'];_0x5ee0ef['message'][_0x4c64('0x67')]='reject';respondWithRpcPromise(_0x4c64('0x68'),_0x4c64('0x68'),{'event':'rejectmessage','message':_[_0x4c64('0x3c')](_0x350a11[_0x4c64('0x19')],JSON[_0x4c64('0x69')](_0x350a11[_0x4c64('0x55')][_0x4c64('0x6a')]))},client9002);return _0x350a11;}return null;})[_0x4c64('0x12')](respondWithResult(_0x586657,null))[_0x4c64('0x1b')](handleError(_0x586657,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index fc04452..2b1dfd0 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 _0x0769=['hook','exports','events','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0769,0xda));var _0x9076=function(_0x204587,_0x3e40c2){_0x204587=_0x204587-0x0;var _0x224eb0=_0x0769[_0x204587];return _0x224eb0;};'use strict';var EventEmitter=require(_0x9076('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x9076('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9076('0x2')](0x0);var events={'afterCreate':_0x9076('0x3'),'afterUpdate':_0x9076('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e3b88){return function(_0x55b70b,_0x4215e4,_0x2c435a){ChatMessageEvents[_0x9076('0x5')](_0x2e3b88+':'+_0x55b70b['id'],_0x55b70b);ChatMessageEvents[_0x9076('0x5')](_0x2e3b88,_0x55b70b);_0x2c435a(null);};}for(var e in events){if(events[_0x9076('0x6')](e)){var event=events[e];ChatMessage[_0x9076('0x7')](e,emitEvent(event));}}module[_0x9076('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xdb56=['ChatMessage','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x473bdc,_0x28ecf9){var _0x1478fd=function(_0x2fed7e){while(--_0x2fed7e){_0x473bdc['push'](_0x473bdc['shift']());}};_0x1478fd(++_0x28ecf9);}(_0xdb56,0xec));var _0x6db5=function(_0x291a25,_0x31ae01){_0x291a25=_0x291a25-0x0;var _0x380fab=_0xdb56[_0x291a25];return _0x380fab;};'use strict';var EventEmitter=require(_0x6db5('0x0'));var ChatMessage=require(_0x6db5('0x1'))['db'][_0x6db5('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6db5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x19e9d0){return function(_0x16a695,_0x988334,_0x5c6a9b){ChatMessageEvents[_0x6db5('0x4')](_0x19e9d0+':'+_0x16a695['id'],_0x16a695);ChatMessageEvents[_0x6db5('0x4')](_0x19e9d0,_0x16a695);_0x5c6a9b(null);};}for(var e in events){if(events[_0x6db5('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x6db5('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 005794c..76f6d87 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 _0xd772=['../../config/logger','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','util'];(function(_0x4b7c2a,_0x3de9a8){var _0x405fe6=function(_0x56a583){while(--_0x56a583){_0x4b7c2a['push'](_0x4b7c2a['shift']());}};_0x405fe6(++_0x3de9a8);}(_0xd772,0xd7));var _0x2d77=function(_0x4f0853,_0x13791a){_0x4f0853=_0x4f0853-0x0;var _0x59c809=_0xd772[_0x4f0853];return _0x59c809;};'use strict';var _=require('lodash');var util=require(_0x2d77('0x0'));var logger=require(_0x2d77('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2d77('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d77('0x3'));var rimraf=require(_0x2d77('0x4'));var config=require(_0x2d77('0x5'));var attributes=require(_0x2d77('0x6'));module['exports']=function(_0x2a7860,_0x1ad986){return _0x2a7860[_0x2d77('0x7')]('ChatMessage',attributes,{'tableName':_0x2d77('0x8'),'paranoid':![],'indexes':[{'name':_0x2d77('0x9'),'fields':['body'],'type':_0x2d77('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20f8ad,_0x27f698,_0x1b798a){var _0x559bbc=_0x2a7860[_0x2d77('0xb')];var _0x4b78c=_0x20f8ad[_0x2d77('0xc')]({'plain':!![]});if(_0x4b78c[_0x2d77('0xd')][_0x2d77('0xe')]()==='in'||_0x4b78c[_0x2d77('0xd')][_0x2d77('0xe')]()===_0x2d77('0xf')&&!_0x4b78c['secret']&&!_[_0x2d77('0x10')](_0x4b78c[_0x2d77('0x11')])){_0x559bbc[_0x2d77('0x12')][_0x2d77('0x13')]({'where':{'id':_0x4b78c[_0x2d77('0x14')]}})[_0x2d77('0x15')](function(_0x431d5c){if(_0x431d5c){_0x431d5c[_0x2d77('0x16')]({'lastMsgAt':_0x4b78c[_0x2d77('0x17')],'lastMsgDirection':_0x4b78c[_0x2d77('0xd')][_0x2d77('0xe')]()});}})[_0x2d77('0x18')](function(_0x29d308){console[_0x2d77('0x19')](_0x29d308);});}_0x1b798a();}},'charset':_0x2d77('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3b0d=['../../config/environment','./chatMessage.attributes','exports','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','rimraf'];(function(_0x5536e8,_0x3ff64d){var _0x277a3b=function(_0x30b13b){while(--_0x30b13b){_0x5536e8['push'](_0x5536e8['shift']());}};_0x277a3b(++_0x3ff64d);}(_0x3b0d,0x1db));var _0xd3b0=function(_0x1cacd0,_0x574d30){_0x1cacd0=_0x1cacd0-0x0;var _0x4a2df2=_0x3b0d[_0x1cacd0];return _0x4a2df2;};'use strict';var _=require('lodash');var util=require(_0xd3b0('0x0'));var logger=require('../../config/logger')(_0xd3b0('0x1'));var moment=require(_0xd3b0('0x2'));var BPromise=require('bluebird');var rp=require(_0xd3b0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3b0('0x4'));var config=require(_0xd3b0('0x5'));var attributes=require(_0xd3b0('0x6'));module[_0xd3b0('0x7')]=function(_0xfca637,_0x10d7db){return _0xfca637['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xd3b0('0x8'),'fields':[_0xd3b0('0x9')],'type':_0xd3b0('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dee3e,_0x13553b,_0x37da08){var _0x183d94=_0xfca637[_0xd3b0('0xb')];var _0x1ab897=_0x3dee3e[_0xd3b0('0xc')]({'plain':!![]});if(_0x1ab897[_0xd3b0('0xd')][_0xd3b0('0xe')]()==='in'||_0x1ab897[_0xd3b0('0xd')][_0xd3b0('0xe')]()==='out'&&!_0x1ab897[_0xd3b0('0xf')]&&!_['isNil'](_0x1ab897['UserId'])){_0x183d94['ChatInteraction'][_0xd3b0('0x10')]({'where':{'id':_0x1ab897[_0xd3b0('0x11')]}})[_0xd3b0('0x12')](function(_0x4e8baa){if(_0x4e8baa){_0x4e8baa[_0xd3b0('0x13')]({'lastMsgAt':_0x1ab897[_0xd3b0('0x14')],'lastMsgDirection':_0x1ab897[_0xd3b0('0xd')]['toLowerCase']()});}})[_0xd3b0('0x15')](function(_0x2d2177){console['error'](_0x2d2177);});}_0x37da08();}},'charset':_0xd3b0('0x16'),'collate':_0xd3b0('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7c9b380..47295a9 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 _0x18e9=['http','defaults','redis','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x59747c,_0x4de5fc){var _0x5b7e3a=function(_0x58741c){while(--_0x58741c){_0x59747c['push'](_0x59747c['shift']());}};_0x5b7e3a(++_0x4de5fc);}(_0x18e9,0x1e5));var _0x918e=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x18e9[_0x3a3c17];return _0xd07f21;};'use strict';var _=require(_0x918e('0x0'));var util=require(_0x918e('0x1'));var moment=require(_0x918e('0x2'));var BPromise=require(_0x918e('0x3'));var rs=require(_0x918e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x918e('0x5'))['db'];var utils=require(_0x918e('0x6'));var logger=require('../../config/logger')(_0x918e('0x7'));var config=require('../../config/environment');var jayson=require(_0x918e('0x8'));var client=jayson[_0x918e('0x9')][_0x918e('0xa')]({'port':0x232a});config['redis']=_[_0x918e('0xb')](config[_0x918e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x918e('0xd'))(new Redis(config[_0x918e('0xc')]));require(_0x918e('0xe'))[_0x918e('0xf')](socket);function respondWithRpcPromise(_0x2a7a5a,_0x335f8b,_0x403dd2){return new BPromise(function(_0x11510a,_0x545ed1){return client[_0x918e('0x10')](_0x2a7a5a,_0x403dd2)[_0x918e('0x11')](function(_0x5a8390){logger[_0x918e('0x12')]('ChatMessage,\x20%s,\x20%s',_0x335f8b,_0x918e('0x13'));logger[_0x918e('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x335f8b,_0x918e('0x13'),JSON[_0x918e('0x15')](_0x5a8390));if(_0x5a8390[_0x918e('0x16')]){if(_0x5a8390[_0x918e('0x16')][_0x918e('0x17')]===0x1f4){logger[_0x918e('0x16')](_0x918e('0x18'),_0x335f8b,_0x5a8390['error']['message']);return _0x545ed1(_0x5a8390[_0x918e('0x16')][_0x918e('0x19')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x335f8b,_0x5a8390[_0x918e('0x16')][_0x918e('0x19')]);return _0x11510a(_0x5a8390[_0x918e('0x16')]['message']);}else{logger[_0x918e('0x12')](_0x918e('0x18'),_0x335f8b,'request\x20sent');_0x11510a(_0x5a8390[_0x918e('0x1a')]['message']);}})[_0x918e('0x1b')](function(_0x38a621){logger[_0x918e('0x16')](_0x918e('0x18'),_0x335f8b,_0x38a621);_0x545ed1(_0x38a621);});});}exports['CreateChatMessage']=function(_0x2aa152){var _0x218862=this;return new Promise(function(_0x6f2728,_0x1d8777){return db['ChatMessage'][_0x918e('0x1c')](_0x2aa152[_0x918e('0x1d')],{'raw':_0x2aa152[_0x918e('0x1e')]?_0x2aa152[_0x918e('0x1e')][_0x918e('0x1f')]===undefined?!![]:![]:!![]})[_0x918e('0x11')](function(_0x41968e){logger[_0x918e('0x12')](_0x918e('0x20'),_0x2aa152);logger[_0x918e('0x14')](_0x918e('0x20'),_0x2aa152,JSON[_0x918e('0x15')](_0x41968e));_0x6f2728(_0x41968e);})[_0x918e('0x1b')](function(_0x3b7e92){logger[_0x918e('0x16')](_0x918e('0x20'),_0x3b7e92[_0x918e('0x19')],_0x2aa152);_0x1d8777(_0x218862[_0x918e('0x16')](0x1f4,_0x3b7e92[_0x918e('0x19')]));});});}; \ No newline at end of file +var _0x28e4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','create','body','options','util','moment','randomstring'];(function(_0x35a041,_0x955e98){var _0x4b9efd=function(_0x2fa4be){while(--_0x2fa4be){_0x35a041['push'](_0x35a041['shift']());}};_0x4b9efd(++_0x955e98);}(_0x28e4,0x81));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x428e('0x0'));var moment=require(_0x428e('0x1'));var BPromise=require('bluebird');var rs=require(_0x428e('0x2'));var fs=require('fs');var Redis=require(_0x428e('0x3'));var db=require(_0x428e('0x4'))['db'];var utils=require(_0x428e('0x5'));var logger=require(_0x428e('0x6'))(_0x428e('0x7'));var config=require(_0x428e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x428e('0x9')][_0x428e('0xa')]({'port':0x232a});config[_0x428e('0xb')]=_[_0x428e('0xc')](config[_0x428e('0xb')],{'host':_0x428e('0xd'),'port':0x18eb});var socket=require(_0x428e('0xe'))(new Redis(config[_0x428e('0xb')]));require(_0x428e('0xf'))[_0x428e('0x10')](socket);function respondWithRpcPromise(_0x4641d3,_0x21ece0,_0xc8afd7){return new BPromise(function(_0x76b197,_0x1ae465){return client[_0x428e('0x11')](_0x4641d3,_0xc8afd7)['then'](function(_0x2e621b){logger[_0x428e('0x12')](_0x428e('0x13'),_0x21ece0,_0x428e('0x14'));logger[_0x428e('0x15')](_0x428e('0x16'),_0x21ece0,_0x428e('0x14'),JSON[_0x428e('0x17')](_0x2e621b));if(_0x2e621b[_0x428e('0x18')]){if(_0x2e621b[_0x428e('0x18')][_0x428e('0x19')]===0x1f4){logger[_0x428e('0x18')](_0x428e('0x13'),_0x21ece0,_0x2e621b[_0x428e('0x18')][_0x428e('0x1a')]);return _0x1ae465(_0x2e621b[_0x428e('0x18')][_0x428e('0x1a')]);}logger[_0x428e('0x18')](_0x428e('0x13'),_0x21ece0,_0x2e621b[_0x428e('0x18')][_0x428e('0x1a')]);return _0x76b197(_0x2e621b[_0x428e('0x18')][_0x428e('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x21ece0,'request\x20sent');_0x76b197(_0x2e621b[_0x428e('0x1b')][_0x428e('0x1a')]);}})[_0x428e('0x1c')](function(_0x3e929a){logger[_0x428e('0x18')](_0x428e('0x13'),_0x21ece0,_0x3e929a);_0x1ae465(_0x3e929a);});});}exports[_0x428e('0x1d')]=function(_0x4de3ca){var _0x4dd0a3=this;return new Promise(function(_0x35a568,_0x25b1a1){return db['ChatMessage'][_0x428e('0x1e')](_0x4de3ca[_0x428e('0x1f')],{'raw':_0x4de3ca[_0x428e('0x20')]?_0x4de3ca[_0x428e('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53d482){logger[_0x428e('0x12')](_0x428e('0x1d'),_0x4de3ca);logger[_0x428e('0x15')](_0x428e('0x1d'),_0x4de3ca,JSON['stringify'](_0x53d482));_0x35a568(_0x53d482);})[_0x428e('0x1c')](function(_0x5ec409){logger[_0x428e('0x18')](_0x428e('0x1d'),_0x5ec409[_0x428e('0x1a')],_0x4de3ca);_0x25b1a1(_0x4dd0a3[_0x428e('0x18')](0x1f4,_0x5ec409[_0x428e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d96d231..593b920 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 _0x1c3b=['removeListener','./chatMessage.events','save','remove','emit'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x1c3b,0xab));var _0xb1c3=function(_0x514c64,_0x29a704){_0x514c64=_0x514c64-0x0;var _0x5b0287=_0x1c3b[_0x514c64];return _0x5b0287;};'use strict';var ChatMessageEvents=require(_0xb1c3('0x0'));var events=[_0xb1c3('0x1'),_0xb1c3('0x2'),'update'];function createListener(_0x4eeac2,_0x28a375){return function(_0x89ce0b){_0x28a375[_0xb1c3('0x3')](_0x4eeac2,_0x89ce0b);};}function removeListener(_0x34dbb5,_0x24d4c0){return function(){ChatMessageEvents[_0xb1c3('0x4')](_0x34dbb5,_0x24d4c0);};}exports['register']=function(_0x472813){for(var _0x62da34=0x0,_0x211254=events['length'];_0x62da34<_0x211254;_0x62da34++){var _0x504fc9=events[_0x62da34];var _0x4ed6cf=createListener('chatMessage:'+_0x504fc9,_0x472813);ChatMessageEvents['on'](_0x504fc9,_0x4ed6cf);}}; \ No newline at end of file +var _0xabce=['chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x24254e,_0x5a29d0){var _0x180cdb=function(_0x2c59ae){while(--_0x2c59ae){_0x24254e['push'](_0x24254e['shift']());}};_0x180cdb(++_0x5a29d0);}(_0xabce,0x103));var _0xeabc=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabce[_0xdc37a1];return _0x99b4fe;};'use strict';var ChatMessageEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){ChatMessageEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);ChatMessageEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 013c146..bdd7899 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 _0x57a6=['../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','reject','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x310ab4,_0x525c3e){var _0x28dfbb=function(_0x18820a){while(--_0x18820a){_0x310ab4['push'](_0x310ab4['shift']());}};_0x28dfbb(++_0x525c3e);}(_0x57a6,0x172));var _0x657a=function(_0x2ba9aa,_0x2cdb8f){_0x2ba9aa=_0x2ba9aa-0x0;var _0x4b753b=_0x57a6[_0x2ba9aa];return _0x4b753b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x657a('0x0'));var express=require(_0x657a('0x1'));var router=express[_0x657a('0x2')]();var fs_extra=require(_0x657a('0x3'));var auth=require(_0x657a('0x4'));var interaction=require(_0x657a('0x5'));var config=require(_0x657a('0x6'));var controller=require(_0x657a('0x7'));router['get']('/',auth[_0x657a('0x8')](),controller[_0x657a('0x9')]);router[_0x657a('0xa')](_0x657a('0xb'),auth['isAuthenticated'](),controller[_0x657a('0xc')]);router[_0x657a('0xa')](_0x657a('0xd'),auth[_0x657a('0x8')](),controller[_0x657a('0xe')]);router['post']('/',auth[_0x657a('0x8')](),interaction[_0x657a('0xf')](_0x657a('0x10'),_0x657a('0x11')),controller['create']);router[_0x657a('0x12')](_0x657a('0xd'),controller[_0x657a('0x13')]);router[_0x657a('0x12')](_0x657a('0x14'),auth[_0x657a('0x8')](),controller[_0x657a('0x15')]);router[_0x657a('0x12')]('/:id/reject',auth[_0x657a('0x8')](),controller[_0x657a('0x16')]);router[_0x657a('0x17')](_0x657a('0xd'),auth[_0x657a('0x8')](),controller[_0x657a('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0e33=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','/describe','describe','/:id','isAuthenticated','show','post','tracked','chatmessage:create','put','update'];(function(_0x3322a0,_0xc75fc7){var _0x15be8e=function(_0x44983b){while(--_0x44983b){_0x3322a0['push'](_0x3322a0['shift']());}};_0x15be8e(++_0xc75fc7);}(_0x0e33,0x119));var _0x30e3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0e33[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x30e3('0x0'));var util=require(_0x30e3('0x1'));var path=require('path');var timeout=require(_0x30e3('0x2'));var express=require(_0x30e3('0x3'));var router=express['Router']();var fs_extra=require(_0x30e3('0x4'));var auth=require(_0x30e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x30e3('0x6'));var controller=require(_0x30e3('0x7'));router[_0x30e3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x30e3('0x8')](_0x30e3('0x9'),auth['isAuthenticated'](),controller[_0x30e3('0xa')]);router[_0x30e3('0x8')](_0x30e3('0xb'),auth[_0x30e3('0xc')](),controller[_0x30e3('0xd')]);router[_0x30e3('0xe')]('/',auth[_0x30e3('0xc')](),interaction[_0x30e3('0xf')]('chat',_0x30e3('0x10')),controller['create']);router[_0x30e3('0x11')]('/:id',controller[_0x30e3('0x12')]);router['put']('/:id/accept',auth[_0x30e3('0xc')](),controller[_0x30e3('0x13')]);router[_0x30e3('0x11')](_0x30e3('0x14'),auth['isAuthenticated'](),controller[_0x30e3('0x15')]);router[_0x30e3('0x16')]('/:id',auth[_0x30e3('0xc')](),controller[_0x30e3('0x17')]);module[_0x30e3('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1b27ca6..459772f 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x267bc6,_0x1843a7){var _0x14856c=function(_0x37e51f){while(--_0x37e51f){_0x267bc6['push'](_0x267bc6['shift']());}};_0x14856c(++_0x1843a7);}(_0xdb28,0x106));var _0x8db2=function(_0x294136,_0xf5c874){_0x294136=_0x294136-0x0;var _0x1498a4=_0xdb28[_0x294136];return _0x1498a4;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x3da776,_0x1279e9){var _0x4bb9fb=function(_0x2e81aa){while(--_0x2e81aa){_0x3da776['push'](_0x3da776['shift']());}};_0x4bb9fb(++_0x1279e9);}(_0xdb28,0x106));var _0x8db2=function(_0x1a40e1,_0x48372f){_0x1a40e1=_0x1a40e1-0x0;var _0x53c3cc=_0xdb28[_0x1a40e1];return _0x53c3cc;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 55c88d1..8c80d45 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x27e8c4,_0x1b4f89){var _0x519f5a=function(_0x34d70b){while(--_0x34d70b){_0x27e8c4['push'](_0x27e8c4['shift']());}};_0x519f5a(++_0x1b4f89);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x136b08,_0x2ec4c5){var _0x5239d2=function(_0xbcf2cc){while(--_0xbcf2cc){_0x136b08['push'](_0x136b08['shift']());}};_0x5239d2(++_0x2ec4c5);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 7a5c352..308899c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26e9=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','save'];(function(_0xa84996,_0x16c698){var _0x1b9325=function(_0x4f2a31){while(--_0x4f2a31){_0xa84996['push'](_0xa84996['shift']());}};_0x1b9325(++_0x16c698);}(_0x26e9,0x1a2));var _0x926e=function(_0x3113b1,_0x42646c){_0x3113b1=_0x3113b1-0x0;var _0x4d45a8=_0x26e9[_0x3113b1];return _0x4d45a8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x926e('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x926e('0x1'),'afterUpdate':_0x926e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x37c0ca){return function(_0x2308af,_0x1e2798,_0x554f3a){ChatOfflineMessageEvents[_0x926e('0x3')](_0x37c0ca+':'+_0x2308af['id'],_0x2308af);ChatOfflineMessageEvents[_0x926e('0x3')](_0x37c0ca,_0x2308af);_0x554f3a(null);};}for(var e in events){if(events[_0x926e('0x4')](e)){var event=events[e];ChatOfflineMessage[_0x926e('0x5')](e,emitEvent(event));}}module[_0x926e('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4734=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x22ed4b,_0x5c80ef){var _0x4309fa=function(_0x5065e2){while(--_0x5065e2){_0x22ed4b['push'](_0x22ed4b['shift']());}};_0x4309fa(++_0x5c80ef);}(_0x4734,0x87));var _0x4473=function(_0x55b3f6,_0x4b03cf){_0x55b3f6=_0x55b3f6-0x0;var _0x1b7ede=_0x4734[_0x55b3f6];return _0x1b7ede;};'use strict';var EventEmitter=require(_0x4473('0x0'));var ChatOfflineMessage=require(_0x4473('0x1'))['db'][_0x4473('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4473('0x3')](0x0);var events={'afterCreate':_0x4473('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x433ab9){return function(_0x2c13d3,_0x58f2e4,_0xfab7bf){ChatOfflineMessageEvents[_0x4473('0x5')](_0x433ab9+':'+_0x2c13d3['id'],_0x2c13d3);ChatOfflineMessageEvents[_0x4473('0x5')](_0x433ab9,_0x2c13d3);_0xfab7bf(null);};}for(var e in events){if(events[_0x4473('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x4473('0x7')](e,emitEvent(event));}}module[_0x4473('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 394a0fe..e9f25b4 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 _0x8099=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x487eeb,_0x120b41){var _0x34917b=function(_0x4d0ab0){while(--_0x4d0ab0){_0x487eeb['push'](_0x487eeb['shift']());}};_0x34917b(++_0x120b41);}(_0x8099,0x91));var _0x9809=function(_0x2e010c,_0x1819a2){_0x2e010c=_0x2e010c-0x0;var _0x1b19d9=_0x8099[_0x2e010c];return _0x1b19d9;};'use strict';var attributes=require(_0x9809('0x0'));module[_0x9809('0x1')]=function(_0x29969e){return _0x29969e['define'](_0x9809('0x2'),attributes,{'tableName':_0x9809('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9809('0x4'),'collate':_0x9809('0x5')});}; \ No newline at end of file +var _0x3682=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x3682,0x95));var _0x2368=function(_0xf7ff4,_0x543a19){_0xf7ff4=_0xf7ff4-0x0;var _0x554e6a=_0x3682[_0xf7ff4];return _0x554e6a;};'use strict';var attributes=require(_0x2368('0x0'));module[_0x2368('0x1')]=function(_0x4ea49e){return _0x4ea49e[_0x2368('0x2')](_0x2368('0x3'),attributes,{'tableName':_0x2368('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2368('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7710cc1..39962c3 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 _0x39c7=['stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x39c7,0x85));var _0x739c=function(_0xb5b557,_0x4a4eae){_0xb5b557=_0xb5b557-0x0;var _0x4a1090=_0x39c7[_0xb5b557];return _0x4a1090;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var moment=require(_0x739c('0x1'));var BPromise=require(_0x739c('0x2'));var rs=require(_0x739c('0x3'));var fs=require('fs');var Redis=require(_0x739c('0x4'));var db=require(_0x739c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x739c('0x6'))(_0x739c('0x7'));var config=require(_0x739c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x739c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0af1,_0x5df5d3,_0x480159){return new BPromise(function(_0x27c5a4,_0x3475f2){return client['request'](_0x3c0af1,_0x480159)[_0x739c('0xa')](function(_0x277f61){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5df5d3,_0x739c('0xb'));logger[_0x739c('0xc')](_0x739c('0xd'),_0x5df5d3,_0x739c('0xb'),JSON[_0x739c('0xe')](_0x277f61));if(_0x277f61[_0x739c('0xf')]){if(_0x277f61[_0x739c('0xf')][_0x739c('0x10')]===0x1f4){logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x3475f2(_0x277f61['error'][_0x739c('0x12')]);}logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x27c5a4(_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);}else{logger[_0x739c('0x13')](_0x739c('0x11'),_0x5df5d3,_0x739c('0xb'));_0x27c5a4(_0x277f61['result']['message']);}})[_0x739c('0x14')](function(_0x23888d){logger[_0x739c('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5df5d3,_0x23888d);_0x3475f2(_0x23888d);});});} \ No newline at end of file +var _0x80ce=['code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5793e2,_0x430100){var _0x37776b=function(_0xb30111){while(--_0xb30111){_0x5793e2['push'](_0x5793e2['shift']());}};_0x37776b(++_0x430100);}(_0x80ce,0xae));var _0xe80c=function(_0x264d47,_0x2c97c6){_0x264d47=_0x264d47-0x0;var _0x5a3414=_0x80ce[_0x264d47];return _0x5a3414;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe80c('0x0'));var rs=require(_0xe80c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe80c('0x2'))['db'];var utils=require(_0xe80c('0x3'));var logger=require(_0xe80c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe80c('0x5')][_0xe80c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x320a7e,_0x704aa3,_0x591a4a){return new BPromise(function(_0x4da07c,_0x1fdd3b){return client[_0xe80c('0x7')](_0x320a7e,_0x591a4a)['then'](function(_0x104665){logger[_0xe80c('0x8')](_0xe80c('0x9'),_0x704aa3,_0xe80c('0xa'));logger[_0xe80c('0xb')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x704aa3,'request\x20sent',JSON['stringify'](_0x104665));if(_0x104665[_0xe80c('0xc')]){if(_0x104665[_0xe80c('0xc')][_0xe80c('0xd')]===0x1f4){logger[_0xe80c('0xc')](_0xe80c('0x9'),_0x704aa3,_0x104665[_0xe80c('0xc')][_0xe80c('0xe')]);return _0x1fdd3b(_0x104665[_0xe80c('0xc')][_0xe80c('0xe')]);}logger[_0xe80c('0xc')](_0xe80c('0x9'),_0x704aa3,_0x104665[_0xe80c('0xc')][_0xe80c('0xe')]);return _0x4da07c(_0x104665['error'][_0xe80c('0xe')]);}else{logger['info'](_0xe80c('0x9'),_0x704aa3,_0xe80c('0xa'));_0x4da07c(_0x104665[_0xe80c('0xf')]['message']);}})[_0xe80c('0x10')](function(_0x35d108){logger['error'](_0xe80c('0x9'),_0x704aa3,_0x35d108);_0x1fdd3b(_0x35d108);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index cde7695..3e94eba 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 _0x0274=['delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update'];(function(_0x577247,_0x269bff){var _0x5e07d2=function(_0x625269){while(--_0x625269){_0x577247['push'](_0x577247['shift']());}};_0x5e07d2(++_0x269bff);}(_0x0274,0x10c));var _0x4027=function(_0x1c924c,_0x425bb3){_0x1c924c=_0x1c924c-0x0;var _0x30909d=_0x0274[_0x1c924c];return _0x30909d;};'use strict';var multer=require(_0x4027('0x0'));var util=require('util');var path=require(_0x4027('0x1'));var timeout=require(_0x4027('0x2'));var express=require('express');var router=express[_0x4027('0x3')]();var fs_extra=require(_0x4027('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4027('0x5'));var config=require(_0x4027('0x6'));var controller=require(_0x4027('0x7'));router[_0x4027('0x8')]('/',auth[_0x4027('0x9')](),controller[_0x4027('0xa')]);router[_0x4027('0x8')](_0x4027('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4027('0xc'),auth[_0x4027('0x9')](),controller[_0x4027('0xd')]);router[_0x4027('0xe')]('/',auth[_0x4027('0x9')](),controller['create']);router[_0x4027('0xf')]('/:id',auth[_0x4027('0x9')](),controller[_0x4027('0x10')]);router[_0x4027('0x11')](_0x4027('0xc'),auth[_0x4027('0x9')](),controller[_0x4027('0x12')]);module['exports']=router; \ No newline at end of file +var _0x955f=['Router','../../components/auth/service','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0xc8c149,_0x104184){var _0x261259=function(_0x314df3){while(--_0x314df3){_0xc8c149['push'](_0xc8c149['shift']());}};_0x261259(++_0x104184);}(_0x955f,0x6e));var _0xf955=function(_0x25d616,_0x438694){_0x25d616=_0x25d616-0x0;var _0x380b29=_0x955f[_0x25d616];return _0x380b29;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require('path');var timeout=require(_0xf955('0x2'));var express=require(_0xf955('0x3'));var router=express[_0xf955('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf955('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf955('0x6'));router[_0xf955('0x7')]('/',auth['isAuthenticated'](),controller[_0xf955('0x8')]);router['get'](_0xf955('0x9'),auth[_0xf955('0xa')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0xa')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth['isAuthenticated'](),controller[_0xf955('0xe')]);router[_0xf955('0xf')]('/:id',auth[_0xf955('0xa')](),controller[_0xf955('0x10')]);router['delete'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module[_0xf955('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5160aa8..ab4049f 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 _0xdeb8=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0xbbc40e,_0x4297ea){var _0x2abd33=function(_0x4f7ea5){while(--_0x4f7ea5){_0xbbc40e['push'](_0xbbc40e['shift']());}};_0x2abd33(++_0x4297ea);}(_0xdeb8,0xef));var _0x8deb=function(_0x5632d3,_0x2eed0b){_0x5632d3=_0x5632d3-0x0;var _0x2c4ba8=_0xdeb8[_0x5632d3];return _0x2c4ba8;};'use strict';var Sequelize=require(_0x8deb('0x0'));module[_0x8deb('0x1')]={'name':{'type':Sequelize[_0x8deb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8deb('0x3')](_0x8deb('0x4'),_0x8deb('0x5')),'defaultValue':_0x8deb('0x4')},'selector':{'type':Sequelize[_0x8deb('0x2')]},'timeout':{'type':Sequelize[_0x8deb('0x6')]}}; \ No newline at end of file +var _0xf411=['mouseOver','timeout','STRING','exports','ENUM'];(function(_0x1d6cb8,_0x31a3f3){var _0x38a43f=function(_0x4ef6bd){while(--_0x4ef6bd){_0x1d6cb8['push'](_0x1d6cb8['shift']());}};_0x38a43f(++_0x31a3f3);}(_0xf411,0x1c5));var _0x1f41=function(_0x19c434,_0x8f3986){_0x19c434=_0x19c434-0x0;var _0x363fd2=_0xf411[_0x19c434];return _0x363fd2;};'use strict';var Sequelize=require('sequelize');module[_0x1f41('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1f41('0x1')](_0x1f41('0x2'),_0x1f41('0x3')),'defaultValue':_0x1f41('0x2')},'selector':{'type':Sequelize[_0x1f41('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 44b6930..18ccc9e 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 _0x3d9f=['undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','query','length','includeAll','include','merge','find','catch','create','body','ChatProactiveAction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset'];(function(_0x28bef9,_0x28e8d6){var _0x45db81=function(_0x269033){while(--_0x269033){_0x28bef9['push'](_0x28bef9['shift']());}};_0x45db81(++_0x28e8d6);}(_0x3d9f,0xd2));var _0xf3d9=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3d9f[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0xf3d9('0x0'));var rimraf=require(_0xf3d9('0x1'));var zipdir=require(_0xf3d9('0x2'));var jsonpatch=require(_0xf3d9('0x3'));var rp=require(_0xf3d9('0x4'));var moment=require(_0xf3d9('0x5'));var BPromise=require(_0xf3d9('0x6'));var Mustache=require(_0xf3d9('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf3d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3d9('0x9'));var _=require(_0xf3d9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3d9('0xb'));var deskjs=require(_0xf3d9('0xc'));var toCsv=require(_0xf3d9('0x8'));var querystring=require(_0xf3d9('0xd'));var Papa=require(_0xf3d9('0xe'));var Redis=require(_0xf3d9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf3d9('0x10'));var hardwareService=require(_0xf3d9('0x11'));var logger=require(_0xf3d9('0x12'))(_0xf3d9('0x13'));var utils=require(_0xf3d9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf3d9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b08c8,_0x2eb42c){_0x2eb42c=_0x2eb42c||0xcc;return function(_0x5b91a7){if(_0x5b91a7){return _0x1b08c8['sendStatus'](_0x2eb42c);}return _0x1b08c8[_0xf3d9('0x16')](_0x2eb42c)[_0xf3d9('0x17')]();};}function respondWithResult(_0x898431,_0x15a74e){_0x15a74e=_0x15a74e||0xc8;return function(_0x55e310){if(_0x55e310){return _0x898431[_0xf3d9('0x16')](_0x15a74e)[_0xf3d9('0x18')](_0x55e310);}};}function respondWithFilteredResult(_0x1f3f9b,_0x4a8e70){return function(_0x4033a6){if(_0x4033a6){var _0x1508f2=typeof _0x4a8e70[_0xf3d9('0x19')]===_0xf3d9('0x1a')&&typeof _0x4a8e70[_0xf3d9('0x1b')]==='undefined';var _0x18393a=_0x4033a6[_0xf3d9('0x1c')];var _0x3e2206=_0x1508f2?0x0:_0x4a8e70[_0xf3d9('0x19')];var _0x3386cb=_0x1508f2?_0x4033a6[_0xf3d9('0x1c')]:_0x4a8e70[_0xf3d9('0x19')]+_0x4a8e70[_0xf3d9('0x1b')];var _0x473085;if(_0x3386cb>=_0x18393a){_0x3386cb=_0x18393a;_0x473085=0xc8;}else{_0x473085=0xce;}_0x1f3f9b[_0xf3d9('0x16')](_0x473085);return _0x1f3f9b[_0xf3d9('0x1d')]('Content-Range',_0x3e2206+'-'+_0x3386cb+'/'+_0x18393a)['json'](_0x4033a6);}return null;};}function patchUpdates(_0x3d4945){return function(_0x2145b3){try{jsonpatch[_0xf3d9('0x1e')](_0x2145b3,_0x3d4945,!![]);}catch(_0x22d2f6){return BPromise[_0xf3d9('0x1f')](_0x22d2f6);}return _0x2145b3[_0xf3d9('0x20')]();};}function saveUpdates(_0x207cea,_0x269890){return function(_0x7770dc){if(_0x7770dc){return _0x7770dc[_0xf3d9('0x21')](_0x207cea)[_0xf3d9('0x22')](function(_0x36e868){return _0x36e868;});}return null;};}function removeEntity(_0x3aeec9,_0x5aecca){return function(_0x168ca6){if(_0x168ca6){return _0x168ca6[_0xf3d9('0x23')]()[_0xf3d9('0x22')](function(){_0x3aeec9['status'](0xcc)[_0xf3d9('0x17')]();});}};}function handleEntityNotFound(_0x289d62,_0x26f206){return function(_0x21c846){if(!_0x21c846){_0x289d62[_0xf3d9('0x24')](0x194);}return _0x21c846;};}function handleError(_0x3e1c4d,_0x41a6ac){_0x41a6ac=_0x41a6ac||0x1f4;return function(_0x240c44){logger[_0xf3d9('0x25')](_0x240c44['stack']);if(_0x240c44[_0xf3d9('0x26')]){delete _0x240c44['name'];}_0x3e1c4d[_0xf3d9('0x16')](_0x41a6ac)[_0xf3d9('0x27')](_0x240c44);};}exports[_0xf3d9('0x28')]=function(_0x3d9c23,_0x4e336a){var _0x1d51ce={'raw':!![],'where':{'id':_0x3d9c23[_0xf3d9('0x29')]['id']}},_0x367b60={};_0x367b60['model']=_[_0xf3d9('0x2a')](db['ChatProactiveAction'][_0xf3d9('0x2b')]);_0x367b60['query']=_[_0xf3d9('0x2a')](_0x3d9c23['query']);_0x367b60[_0xf3d9('0x2c')]=_[_0xf3d9('0x2d')](_0x367b60[_0xf3d9('0x2e')],_0x367b60['query']);_0x1d51ce[_0xf3d9('0x2f')]=_['intersection'](_0x367b60[_0xf3d9('0x2e')],qs[_0xf3d9('0x30')](_0x3d9c23[_0xf3d9('0x31')][_0xf3d9('0x30')]));_0x1d51ce[_0xf3d9('0x2f')]=_0x1d51ce[_0xf3d9('0x2f')][_0xf3d9('0x32')]?_0x1d51ce[_0xf3d9('0x2f')]:_0x367b60[_0xf3d9('0x2e')];if(_0x3d9c23[_0xf3d9('0x31')][_0xf3d9('0x33')]){_0x1d51ce[_0xf3d9('0x34')]=[{'all':!![]}];}_0x1d51ce=_[_0xf3d9('0x35')]({},_0x1d51ce,_0x3d9c23['options']);return db['ChatProactiveAction'][_0xf3d9('0x36')](_0x1d51ce)[_0xf3d9('0x22')](handleEntityNotFound(_0x4e336a,null))[_0xf3d9('0x22')](respondWithResult(_0x4e336a,null))[_0xf3d9('0x37')](handleError(_0x4e336a,null));};exports[_0xf3d9('0x38')]=function(_0x3b98b5,_0x14fa3c){return db['ChatProactiveAction'][_0xf3d9('0x38')](_0x3b98b5[_0xf3d9('0x39')],{})['then'](respondWithResult(_0x14fa3c,0xc9))[_0xf3d9('0x37')](handleError(_0x14fa3c,null));};exports['update']=function(_0x25ef2d,_0x164c27){if(_0x25ef2d[_0xf3d9('0x39')]['id']){delete _0x25ef2d[_0xf3d9('0x39')]['id'];}return db[_0xf3d9('0x3a')]['find']({'where':{'id':_0x25ef2d[_0xf3d9('0x29')]['id']}})[_0xf3d9('0x22')](handleEntityNotFound(_0x164c27,null))[_0xf3d9('0x22')](saveUpdates(_0x25ef2d[_0xf3d9('0x39')],null))['then'](respondWithResult(_0x164c27,null))[_0xf3d9('0x37')](handleError(_0x164c27,null));};exports[_0xf3d9('0x23')]=function(_0x3f6b21,_0x43d598){return db['ChatProactiveAction'][_0xf3d9('0x36')]({'where':{'id':_0x3f6b21['params']['id']}})[_0xf3d9('0x22')](handleEntityNotFound(_0x43d598,null))[_0xf3d9('0x22')](removeEntity(_0x43d598,null))[_0xf3d9('0x37')](handleError(_0x43d598,null));}; \ No newline at end of file +var _0xd6bb=['find','create','body','catch','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xd6bb[_0x126fb9];return _0xc8a3b1;};'use strict';var emlformat=require(_0xbd6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd6b('0x1'));var jsonpatch=require(_0xbd6b('0x2'));var rp=require(_0xbd6b('0x3'));var moment=require(_0xbd6b('0x4'));var BPromise=require(_0xbd6b('0x5'));var Mustache=require('mustache');var util=require(_0xbd6b('0x6'));var path=require(_0xbd6b('0x7'));var sox=require(_0xbd6b('0x8'));var csv=require('to-csv');var ejs=require(_0xbd6b('0x9'));var fs=require('fs');var fs_extra=require(_0xbd6b('0xa'));var _=require(_0xbd6b('0xb'));var squel=require(_0xbd6b('0xc'));var crypto=require(_0xbd6b('0xd'));var jsforce=require(_0xbd6b('0xe'));var deskjs=require(_0xbd6b('0xf'));var toCsv=require(_0xbd6b('0x10'));var querystring=require(_0xbd6b('0x11'));var Papa=require(_0xbd6b('0x12'));var Redis=require(_0xbd6b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbd6b('0x14'));var as=require(_0xbd6b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd6b('0x16'))(_0xbd6b('0x17'));var utils=require('../../config/utils');var config=require(_0xbd6b('0x18'));var licenseUtil=require(_0xbd6b('0x19'));var db=require(_0xbd6b('0x1a'))['db'];function respondWithStatusCode(_0x34992e,_0x372139){_0x372139=_0x372139||0xcc;return function(_0x5225ea){if(_0x5225ea){return _0x34992e[_0xbd6b('0x1b')](_0x372139);}return _0x34992e[_0xbd6b('0x1c')](_0x372139)[_0xbd6b('0x1d')]();};}function respondWithResult(_0x4952ed,_0x504785){_0x504785=_0x504785||0xc8;return function(_0x557820){if(_0x557820){return _0x4952ed[_0xbd6b('0x1c')](_0x504785)[_0xbd6b('0x1e')](_0x557820);}};}function respondWithFilteredResult(_0xecaf18,_0x13e93a){return function(_0xa40969){if(_0xa40969){var _0x2208de=typeof _0x13e93a['offset']===_0xbd6b('0x1f')&&typeof _0x13e93a['limit']==='undefined';var _0x5437c1=_0xa40969[_0xbd6b('0x20')];var _0x1c0cad=_0x2208de?0x0:_0x13e93a[_0xbd6b('0x21')];var _0x50d857=_0x2208de?_0xa40969[_0xbd6b('0x20')]:_0x13e93a[_0xbd6b('0x21')]+_0x13e93a['limit'];var _0x11b28f;if(_0x50d857>=_0x5437c1){_0x50d857=_0x5437c1;_0x11b28f=0xc8;}else{_0x11b28f=0xce;}_0xecaf18[_0xbd6b('0x1c')](_0x11b28f);return _0xecaf18[_0xbd6b('0x22')](_0xbd6b('0x23'),_0x1c0cad+'-'+_0x50d857+'/'+_0x5437c1)[_0xbd6b('0x1e')](_0xa40969);}return null;};}function patchUpdates(_0x59aa3f){return function(_0x1233a4){try{jsonpatch[_0xbd6b('0x24')](_0x1233a4,_0x59aa3f,!![]);}catch(_0x2389c1){return BPromise[_0xbd6b('0x25')](_0x2389c1);}return _0x1233a4[_0xbd6b('0x26')]();};}function saveUpdates(_0x447b7a,_0x5e0be3){return function(_0x24ce5b){if(_0x24ce5b){return _0x24ce5b['update'](_0x447b7a)[_0xbd6b('0x27')](function(_0x34c452){return _0x34c452;});}return null;};}function removeEntity(_0x3ece0f,_0x5d6329){return function(_0x314526){if(_0x314526){return _0x314526['destroy']()[_0xbd6b('0x27')](function(){_0x3ece0f[_0xbd6b('0x1c')](0xcc)[_0xbd6b('0x1d')]();});}};}function handleEntityNotFound(_0x323964,_0x25d609){return function(_0x450a6e){if(!_0x450a6e){_0x323964[_0xbd6b('0x1b')](0x194);}return _0x450a6e;};}function handleError(_0x1218f3,_0x33014a){_0x33014a=_0x33014a||0x1f4;return function(_0x139948){logger[_0xbd6b('0x28')](_0x139948[_0xbd6b('0x29')]);if(_0x139948[_0xbd6b('0x2a')]){delete _0x139948[_0xbd6b('0x2a')];}_0x1218f3['status'](_0x33014a)[_0xbd6b('0x2b')](_0x139948);};}exports[_0xbd6b('0x2c')]=function(_0x391b59,_0x4f8879){var _0x3b3e77={'raw':!![],'where':{'id':_0x391b59[_0xbd6b('0x2d')]['id']}},_0x2ddf8c={};_0x2ddf8c['model']=_[_0xbd6b('0x2e')](db[_0xbd6b('0x2f')][_0xbd6b('0x30')]);_0x2ddf8c[_0xbd6b('0x31')]=_[_0xbd6b('0x2e')](_0x391b59[_0xbd6b('0x31')]);_0x2ddf8c[_0xbd6b('0x32')]=_[_0xbd6b('0x33')](_0x2ddf8c[_0xbd6b('0x34')],_0x2ddf8c[_0xbd6b('0x31')]);_0x3b3e77[_0xbd6b('0x35')]=_[_0xbd6b('0x33')](_0x2ddf8c[_0xbd6b('0x34')],qs['fields'](_0x391b59[_0xbd6b('0x31')][_0xbd6b('0x36')]));_0x3b3e77[_0xbd6b('0x35')]=_0x3b3e77[_0xbd6b('0x35')][_0xbd6b('0x37')]?_0x3b3e77[_0xbd6b('0x35')]:_0x2ddf8c[_0xbd6b('0x34')];if(_0x391b59['query'][_0xbd6b('0x38')]){_0x3b3e77[_0xbd6b('0x39')]=[{'all':!![]}];}_0x3b3e77=_[_0xbd6b('0x3a')]({},_0x3b3e77,_0x391b59[_0xbd6b('0x3b')]);return db[_0xbd6b('0x2f')][_0xbd6b('0x3c')](_0x3b3e77)[_0xbd6b('0x27')](handleEntityNotFound(_0x4f8879,null))[_0xbd6b('0x27')](respondWithResult(_0x4f8879,null))['catch'](handleError(_0x4f8879,null));};exports[_0xbd6b('0x3d')]=function(_0x4c913d,_0xf33931){return db[_0xbd6b('0x2f')][_0xbd6b('0x3d')](_0x4c913d[_0xbd6b('0x3e')],{})[_0xbd6b('0x27')](respondWithResult(_0xf33931,0xc9))['catch'](handleError(_0xf33931,null));};exports['update']=function(_0x23c4ae,_0x5e4a4e){if(_0x23c4ae[_0xbd6b('0x3e')]['id']){delete _0x23c4ae[_0xbd6b('0x3e')]['id'];}return db[_0xbd6b('0x2f')][_0xbd6b('0x3c')]({'where':{'id':_0x23c4ae[_0xbd6b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5e4a4e,null))[_0xbd6b('0x27')](saveUpdates(_0x23c4ae['body'],null))['then'](respondWithResult(_0x5e4a4e,null))[_0xbd6b('0x3f')](handleError(_0x5e4a4e,null));};exports[_0xbd6b('0x40')]=function(_0x2ccc30,_0x18c674){return db[_0xbd6b('0x2f')]['find']({'where':{'id':_0x2ccc30[_0xbd6b('0x2d')]['id']}})[_0xbd6b('0x27')](handleEntityNotFound(_0x18c674,null))[_0xbd6b('0x27')](removeEntity(_0x18c674,null))['catch'](handleError(_0x18c674,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index bd913f9..033b991 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 _0xd447=['chat_proactive_actions','util','../../config/logger','api','moment','bluebird','path','./chatProactiveAction.attributes','exports','define'];(function(_0x41b4e9,_0x51a253){var _0x36d5ca=function(_0x5db9d0){while(--_0x5db9d0){_0x41b4e9['push'](_0x41b4e9['shift']());}};_0x36d5ca(++_0x51a253);}(_0xd447,0x1e1));var _0x7d44=function(_0x41a12c,_0x362888){_0x41a12c=_0x41a12c-0x0;var _0x13d8d0=_0xd447[_0x41a12c];return _0x13d8d0;};'use strict';var _=require('lodash');var util=require(_0x7d44('0x0'));var logger=require(_0x7d44('0x1'))(_0x7d44('0x2'));var moment=require(_0x7d44('0x3'));var BPromise=require(_0x7d44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d44('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d44('0x6'));module[_0x7d44('0x7')]=function(_0x4b7b6d,_0x2fed56){return _0x4b7b6d[_0x7d44('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x7d44('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7318=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x49aa1c,_0x56d2b9){var _0x1041c8=function(_0x48e6b8){while(--_0x48e6b8){_0x49aa1c['push'](_0x49aa1c['shift']());}};_0x1041c8(++_0x56d2b9);}(_0x7318,0xac));var _0x8731=function(_0x42cce1,_0x5811de){_0x42cce1=_0x42cce1-0x0;var _0x5c0e27=_0x7318[_0x42cce1];return _0x5c0e27;};'use strict';var _=require(_0x8731('0x0'));var util=require(_0x8731('0x1'));var logger=require(_0x8731('0x2'))(_0x8731('0x3'));var moment=require(_0x8731('0x4'));var BPromise=require(_0x8731('0x5'));var rp=require(_0x8731('0x6'));var fs=require('fs');var path=require(_0x8731('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8731('0x8'));module[_0x8731('0x9')]=function(_0x3f0f81,_0x31125f){return _0x3f0f81[_0x8731('0xa')](_0x8731('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 2ed3127..bb39d35 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 _0x1e50=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x5076e9,_0x22454a){var _0x2a0de1=function(_0x5b6895){while(--_0x5b6895){_0x5076e9['push'](_0x5076e9['shift']());}};_0x2a0de1(++_0x22454a);}(_0x1e50,0x1d4));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x01e5('0x0'));var util=require(_0x01e5('0x1'));var moment=require(_0x01e5('0x2'));var BPromise=require(_0x01e5('0x3'));var rs=require(_0x01e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01e5('0x6'))('rpc');var config=require(_0x01e5('0x7'));var jayson=require(_0x01e5('0x8'));var client=jayson[_0x01e5('0x9')][_0x01e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43284e,_0x32d502,_0x19af63){return new BPromise(function(_0x5860cd,_0x5257f5){return client[_0x01e5('0xb')](_0x43284e,_0x19af63)[_0x01e5('0xc')](function(_0x511973){logger[_0x01e5('0xd')](_0x01e5('0xe'),_0x32d502,_0x01e5('0xf'));logger[_0x01e5('0x10')](_0x01e5('0x11'),_0x32d502,_0x01e5('0xf'),JSON['stringify'](_0x511973));if(_0x511973[_0x01e5('0x12')]){if(_0x511973[_0x01e5('0x12')][_0x01e5('0x13')]===0x1f4){logger[_0x01e5('0x12')](_0x01e5('0xe'),_0x32d502,_0x511973[_0x01e5('0x12')][_0x01e5('0x14')]);return _0x5257f5(_0x511973[_0x01e5('0x12')][_0x01e5('0x14')]);}logger['error'](_0x01e5('0xe'),_0x32d502,_0x511973[_0x01e5('0x12')][_0x01e5('0x14')]);return _0x5860cd(_0x511973[_0x01e5('0x12')]['message']);}else{logger['info'](_0x01e5('0xe'),_0x32d502,_0x01e5('0xf'));_0x5860cd(_0x511973[_0x01e5('0x15')][_0x01e5('0x14')]);}})['catch'](function(_0x494cf7){logger[_0x01e5('0x12')](_0x01e5('0xe'),_0x32d502,_0x494cf7);_0x5257f5(_0x494cf7);});});} \ No newline at end of file +var _0xff0d=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0xff0d,0xe8));var _0xdff0=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xff0d[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xdff0('0x0'));var util=require(_0xdff0('0x1'));var moment=require('moment');var BPromise=require(_0xdff0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdff0('0x3'));var db=require(_0xdff0('0x4'))['db'];var utils=require(_0xdff0('0x5'));var logger=require('../../config/logger')(_0xdff0('0x6'));var config=require(_0xdff0('0x7'));var jayson=require(_0xdff0('0x8'));var client=jayson[_0xdff0('0x9')][_0xdff0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4242d7,_0x394541,_0x14b0b3){return new BPromise(function(_0x1ae075,_0x4922f5){return client[_0xdff0('0xb')](_0x4242d7,_0x14b0b3)[_0xdff0('0xc')](function(_0x4ec159){logger[_0xdff0('0xd')](_0xdff0('0xe'),_0x394541,'request\x20sent');logger[_0xdff0('0xf')](_0xdff0('0x10'),_0x394541,'request\x20sent',JSON['stringify'](_0x4ec159));if(_0x4ec159[_0xdff0('0x11')]){if(_0x4ec159[_0xdff0('0x11')][_0xdff0('0x12')]===0x1f4){logger['error'](_0xdff0('0xe'),_0x394541,_0x4ec159[_0xdff0('0x11')][_0xdff0('0x13')]);return _0x4922f5(_0x4ec159[_0xdff0('0x11')]['message']);}logger[_0xdff0('0x11')](_0xdff0('0xe'),_0x394541,_0x4ec159[_0xdff0('0x11')][_0xdff0('0x13')]);return _0x1ae075(_0x4ec159[_0xdff0('0x11')][_0xdff0('0x13')]);}else{logger[_0xdff0('0xd')](_0xdff0('0xe'),_0x394541,'request\x20sent');_0x1ae075(_0x4ec159[_0xdff0('0x14')][_0xdff0('0x13')]);}})['catch'](function(_0xcf3b35){logger['error'](_0xdff0('0xe'),_0x394541,_0xcf3b35);_0x4922f5(_0xcf3b35);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 917b28c..b2806bd 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 _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x179c19,_0x43a64a){var _0x3cdfa0=function(_0x5d40d4){while(--_0x5d40d4){_0x179c19['push'](_0x179c19['shift']());}};_0x3cdfa0(++_0x43a64a);}(_0x032e,0x124));var _0xe032=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x032e[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'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('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 95e9fa2..265aa85 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 _0xe611=['INTEGER','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x353627,_0xf01069){var _0x426c5b=function(_0x3d1428){while(--_0x3d1428){_0x353627['push'](_0x353627['shift']());}};_0x426c5b(++_0xf01069);}(_0xe611,0x135));var _0x1e61=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe611[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x1e61('0x0'));module[_0x1e61('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1e61('0x2')]},'timeout':{'type':Sequelize[_0x1e61('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1e61('0x4'),_0x1e61('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x17ac=['beepall','roundrobin','sequelize','exports','STRING','rrmemory'];(function(_0x4160de,_0x14a94a){var _0xf76365=function(_0x2a4ef5){while(--_0x2a4ef5){_0x4160de['push'](_0x4160de['shift']());}};_0xf76365(++_0x14a94a);}(_0x17ac,0x1a0));var _0xc17a=function(_0x7a7c1a,_0x273806){_0x7a7c1a=_0x7a7c1a-0x0;var _0x4e9327=_0x17ac[_0x7a7c1a];return _0x4e9327;};'use strict';var Sequelize=require(_0xc17a('0x0'));module[_0xc17a('0x1')]={'name':{'type':Sequelize[_0xc17a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc17a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc17a('0x3'),_0xc17a('0x4'),_0xc17a('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d052e5d..e934490 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 _0x289a=['params','model','keys','filters','attributes','intersection','fields','includeAll','merge','options','find','create','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','length','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','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','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./chatQueue.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','update','then','destroy','get','ChatQueues','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x289a,0x156));var _0xa289=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x289a[_0x3c22e0];return _0x215811;};'use strict';var BPromise=require('bluebird');var util=require(_0xa289('0x0'));var _=require(_0xa289('0x1'));var squel=require(_0xa289('0x2'));var Redis=require(_0xa289('0x3'));var qs=require(_0xa289('0x4'));var logger=require(_0xa289('0x5'))(_0xa289('0x6'));var config=require(_0xa289('0x7'));var db=require(_0xa289('0x8'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa289('0x9'))(new Redis(config[_0xa289('0xa')]));require(_0xa289('0xb'))[_0xa289('0xc')](socket);function respondWithStatusCode(_0x451c6f,_0x475932){_0x475932=_0x475932||0xcc;return function(_0x57b220){if(_0x57b220){return _0x451c6f[_0xa289('0xd')](_0x475932);}return _0x451c6f[_0xa289('0xe')](_0x475932)[_0xa289('0xf')]();};}function respondWithResult(_0x3bc67a,_0x2512ef){_0x2512ef=_0x2512ef||0xc8;return function(_0x4bcfaa){if(_0x4bcfaa){return _0x3bc67a[_0xa289('0xe')](_0x2512ef)['json'](_0x4bcfaa);}};}function respondWithFilteredResult(_0x34fc45,_0x53a3f1){return function(_0x1e75e5){if(_0x1e75e5){var _0x3c9556=typeof _0x53a3f1['offset']===_0xa289('0x10')&&typeof _0x53a3f1['limit']===_0xa289('0x10');var _0x397e8b=_0x1e75e5[_0xa289('0x11')];var _0x569d8b=_0x3c9556?0x0:_0x53a3f1[_0xa289('0x12')];var _0x5ed4dd=_0x3c9556?_0x1e75e5[_0xa289('0x11')]:_0x53a3f1[_0xa289('0x12')]+_0x53a3f1[_0xa289('0x13')];var _0x107610;if(_0x5ed4dd>=_0x397e8b){_0x5ed4dd=_0x397e8b;_0x107610=0xc8;}else{_0x107610=0xce;}_0x34fc45['status'](_0x107610);return _0x34fc45[_0xa289('0x14')](_0xa289('0x15'),_0x569d8b+'-'+_0x5ed4dd+'/'+_0x397e8b)[_0xa289('0x16')](_0x1e75e5);}return null;};}function saveUpdates(_0xd96b86){return function(_0x45ff1b){if(_0x45ff1b){return _0x45ff1b[_0xa289('0x17')](_0xd96b86)[_0xa289('0x18')](function(_0x3e738e){return _0x3e738e;});}return null;};}function removeEntity(_0x536e01){return function(_0x5a1d20){if(_0x5a1d20){return _0x5a1d20[_0xa289('0x19')]()['then'](function(){var _0x50d32e=_0x5a1d20[_0xa289('0x1a')]({'plain':!![]});var _0x365897=_0xa289('0x1b');return db['UserProfileResource']['destroy']({'where':{'type':_0x365897,'resourceId':_0x50d32e['id']}})[_0xa289('0x18')](function(){return _0x5a1d20;});})[_0xa289('0x18')](function(){_0x536e01[_0xa289('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a8c20){return function(_0x75bf34){if(!_0x75bf34){_0x7a8c20['sendStatus'](0x194);}return _0x75bf34;};}function handleError(_0x965927,_0x440689){_0x440689=_0x440689||0x1f4;return function(_0x3f0a7f){logger[_0xa289('0x1c')](_0x3f0a7f['stack']);if(_0x3f0a7f[_0xa289('0x1d')]){delete _0x3f0a7f[_0xa289('0x1d')];}_0x965927[_0xa289('0xe')](_0x440689)[_0xa289('0x1e')](_0x3f0a7f);};}exports[_0xa289('0x1f')]=function(_0x3cec16,_0x159645){var _0x48036d={};var _0x3defa8={'count':0x0,'rows':[]};var _0xe677d9=_[_0xa289('0x20')](db[_0xa289('0x21')][_0xa289('0x22')],function(_0x107440){return{'name':_0x107440[_0xa289('0x23')],'type':_0x107440[_0xa289('0x24')][_0xa289('0x25')]};});_0x48036d=qs[_0xa289('0x26')](_0xe677d9,_0x3cec16);var _0x23cc3d={'where':_0x48036d[_0xa289('0x27')]};return db['ChatQueue'][_0xa289('0x11')](_0x23cc3d)[_0xa289('0x18')](function(_0x40b19c){_0x3defa8['count']=_0x40b19c;_0x48036d[_0xa289('0x28')]=qs[_0xa289('0x28')](_0x3cec16[_0xa289('0x29')]);return db['ChatQueue'][_0xa289('0x2a')](_0x48036d);})['then'](function(_0x2b5f4b){_0x3defa8[_0xa289('0x2b')]=_0x2b5f4b;return _0x3defa8;})['then'](respondWithFilteredResult(_0x159645,_0x48036d))[_0xa289('0x2c')](handleError(_0x159645,null));};exports['show']=function(_0x227988,_0x1b4fb0){var _0x357f5c={'raw':!![],'where':{'id':_0x227988[_0xa289('0x2d')]['id']}},_0x727adf={};_0x727adf[_0xa289('0x2e')]=_[_0xa289('0x2f')](db[_0xa289('0x21')][_0xa289('0x22')]);_0x727adf['query']=_[_0xa289('0x2f')](_0x227988[_0xa289('0x29')]);_0x727adf[_0xa289('0x30')]=_['intersection'](_0x727adf[_0xa289('0x2e')],_0x727adf[_0xa289('0x29')]);_0x357f5c[_0xa289('0x31')]=_[_0xa289('0x32')](_0x727adf['model'],qs[_0xa289('0x33')](_0x227988[_0xa289('0x29')][_0xa289('0x33')]));_0x357f5c[_0xa289('0x31')]=_0x357f5c[_0xa289('0x31')]['length']?_0x357f5c[_0xa289('0x31')]:_0x727adf[_0xa289('0x2e')];if(_0x227988[_0xa289('0x29')][_0xa289('0x34')]){_0x357f5c['include']=[{'all':!![]}];}_0x357f5c=_[_0xa289('0x35')]({},_0x357f5c,_0x227988[_0xa289('0x36')]);return db['ChatQueue'][_0xa289('0x37')](_0x357f5c)[_0xa289('0x18')](handleEntityNotFound(_0x1b4fb0,null))[_0xa289('0x18')](respondWithResult(_0x1b4fb0,null))[_0xa289('0x2c')](handleError(_0x1b4fb0,null));};exports[_0xa289('0x38')]=function(_0x3bbc47,_0x5b0c35){return db['ChatQueue'][_0xa289('0x38')](_0x3bbc47['body'],{})['then'](function(_0x247b54){var _0x5d7c66=_0x3bbc47[_0xa289('0x39')][_0xa289('0x1a')]({'plain':!![]});if(!_0x5d7c66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d7c66[_0xa289('0x3a')]===_0xa289('0x39')){var _0x388c7b=_0x247b54['get']({'plain':!![]});var _0x3a521c=_0xa289('0x1b');return db[_0xa289('0x3b')][_0xa289('0x37')]({'where':{'name':_0x3a521c,'userProfileId':_0x5d7c66['userProfileId']},'raw':!![]})[_0xa289('0x18')](function(_0x485b11){if(_0x485b11&&_0x485b11[_0xa289('0x3c')]===0x0){return db[_0xa289('0x3d')][_0xa289('0x38')]({'name':_0x388c7b[_0xa289('0x1d')],'resourceId':_0x388c7b['id'],'type':_0x485b11[_0xa289('0x1d')],'sectionId':_0x485b11['id']},{})[_0xa289('0x18')](function(){return _0x247b54;});}else{return _0x247b54;}})['catch'](function(_0x4e809b){logger[_0xa289('0x1c')](_0xa289('0x3e'),_0x4e809b);throw _0x4e809b;});}return _0x247b54;})[_0xa289('0x18')](respondWithResult(_0x5b0c35,0xc9))['catch'](handleError(_0x5b0c35,null));};exports[_0xa289('0x17')]=function(_0x183be3,_0xb47c14){if(_0x183be3['body']['id']){delete _0x183be3['body']['id'];}return db[_0xa289('0x21')]['find']({'where':{'id':_0x183be3[_0xa289('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb47c14,null))[_0xa289('0x18')](saveUpdates(_0x183be3[_0xa289('0x3f')],null))[_0xa289('0x18')](respondWithResult(_0xb47c14,null))[_0xa289('0x2c')](handleError(_0xb47c14,null));};exports['destroy']=function(_0x3e2f0a,_0x4d0633){return db[_0xa289('0x21')][_0xa289('0x37')]({'where':{'id':_0x3e2f0a[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x4d0633,null))[_0xa289('0x18')](removeEntity(_0x4d0633,null))[_0xa289('0x2c')](handleError(_0x4d0633,null));};exports[_0xa289('0x40')]=function(_0x1eda3c,_0x582e99){return db[_0xa289('0x21')][_0xa289('0x40')]()['then'](respondWithResult(_0x582e99,null))[_0xa289('0x2c')](handleError(_0x582e99,null));};exports[_0xa289('0x41')]=function(_0x3cafc4,_0x5b950e){var _0x20a443={'raw':!![],'where':{}},_0x48aff1={},_0x37b2c4;return db[_0xa289('0x21')][_0xa289('0x42')]({'where':{'id':_0x3cafc4[_0xa289('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5b950e,null))[_0xa289('0x18')](function(_0x50a1aa){if(_0x50a1aa){_0x37b2c4=_0x50a1aa['get']({'plain':!![]});_0x48aff1['model']=_[_0xa289('0x2f')](db[_0xa289('0x43')]['rawAttributes']);_0x48aff1[_0xa289('0x29')]=_[_0xa289('0x2f')](_0x3cafc4[_0xa289('0x29')]);_0x48aff1['filters']=_[_0xa289('0x32')](_0x48aff1['model'],_0x48aff1[_0xa289('0x29')]);_0x20a443['attributes']=_[_0xa289('0x32')](_0x48aff1[_0xa289('0x2e')],qs[_0xa289('0x33')](_0x3cafc4[_0xa289('0x29')]['fields']));_0x20a443[_0xa289('0x31')]=_0x20a443[_0xa289('0x31')][_0xa289('0x44')]?_0x20a443['attributes']:_0x48aff1['model'];if(!_0x3cafc4[_0xa289('0x29')][_0xa289('0x45')](_0xa289('0x46'))){_0x20a443[_0xa289('0x13')]=qs[_0xa289('0x13')](_0x3cafc4[_0xa289('0x29')]['limit']);_0x20a443['offset']=qs[_0xa289('0x12')](_0x3cafc4['query']['offset']);}_0x20a443[_0xa289('0x47')]=qs[_0xa289('0x48')](_0x3cafc4[_0xa289('0x29')][_0xa289('0x48')]);_0x20a443[_0xa289('0x27')]=qs[_0xa289('0x30')](_[_0xa289('0x49')](_0x3cafc4['query'],_0x48aff1[_0xa289('0x30')]));_0x20a443[_0xa289('0x27')][_0xa289('0x4a')]=_0x50a1aa['id'];if(_0x3cafc4['query']['filter']){_0x20a443['where']=_[_0xa289('0x35')](_0x20a443['where'],{'$or':_['map'](_0x20a443[_0xa289('0x31')],function(_0x2da4c6){var _0x5d9cef={};_0x5d9cef[_0x2da4c6]={'$like':'%'+_0x3cafc4[_0xa289('0x29')][_0xa289('0x4b')]+'%'};return _0x5d9cef;})});}_0x20a443=_[_0xa289('0x35')]({},_0x20a443,_0x3cafc4[_0xa289('0x36')]);return db[_0xa289('0x43')]['findAll'](_0x20a443);}})['then'](function(_0xb779c9){if(_0xb779c9){return db['User'][_0xa289('0x4c')]({'where':{'id':_[_0xa289('0x20')](_0xb779c9,'UserId'),'role':_0xa289('0x4d')},'attributes':['id','name',_0xa289('0x4e'),_0xa289('0x4f'),'createdAt']});}})[_0xa289('0x18')](function(_0xd4562f){if(_0xd4562f){return{'count':_0xd4562f['count'],'rows':_[_0xa289('0x20')](_0xd4562f[_0xa289('0x2b')],function(_0x5952da){return{'membername':_0x5952da[_0xa289('0x1d')],'UserId':_0x5952da['id'],'queue_name':_0x37b2c4[_0xa289('0x1d')],'ChatQueueId':_0x37b2c4['id'],'interface':util[_0xa289('0x50')](_0xa289('0x51'),_0xa289('0x52'),_0x5952da['name']),'penalty':0x0,'paused':_0x5952da[_0xa289('0x4e')],'createdAt':_0x5952da[_0xa289('0x53')],'updatedAt':_0x5952da['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa289('0x18')](respondWithFilteredResult(_0x5b950e,_0x20a443))[_0xa289('0x2c')](handleError(_0x5b950e,null));};exports['getTeams']=function(_0x53ca40,_0x5d24b6){var _0x20a94f={};var _0x38d015={};var _0xf4e0aa;var _0xb41e4c;return db[_0xa289('0x21')][_0xa289('0x42')]({'where':{'id':_0x53ca40[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x5d24b6,null))[_0xa289('0x18')](function(_0x4622b7){if(_0x4622b7){_0xf4e0aa=_0x4622b7;_0x38d015[_0xa289('0x2e')]=_['keys'](db[_0xa289('0x54')]['rawAttributes']);_0x38d015[_0xa289('0x29')]=_[_0xa289('0x2f')](_0x53ca40[_0xa289('0x29')]);_0x38d015[_0xa289('0x30')]=_['intersection'](_0x38d015[_0xa289('0x2e')],_0x38d015[_0xa289('0x29')]);_0x20a94f[_0xa289('0x31')]=_['intersection'](_0x38d015[_0xa289('0x2e')],qs[_0xa289('0x33')](_0x53ca40[_0xa289('0x29')][_0xa289('0x33')]));_0x20a94f[_0xa289('0x31')]=_0x20a94f[_0xa289('0x31')][_0xa289('0x44')]?_0x20a94f[_0xa289('0x31')]:_0x38d015[_0xa289('0x2e')];_0x20a94f[_0xa289('0x47')]=qs[_0xa289('0x48')](_0x53ca40[_0xa289('0x29')][_0xa289('0x48')]);_0x20a94f[_0xa289('0x27')]=qs['filters'](_[_0xa289('0x49')](_0x53ca40[_0xa289('0x29')],_0x38d015['filters']));if(_0x53ca40[_0xa289('0x29')]['filter']){_0x20a94f[_0xa289('0x27')]=_[_0xa289('0x35')](_0x20a94f[_0xa289('0x27')],{'$or':_[_0xa289('0x20')](_0x20a94f[_0xa289('0x31')],function(_0x4bd070){var _0x4051fe={};_0x4051fe[_0x4bd070]={'$like':'%'+_0x53ca40[_0xa289('0x29')][_0xa289('0x4b')]+'%'};return _0x4051fe;})});}_0x20a94f=_[_0xa289('0x35')]({},_0x20a94f,_0x53ca40[_0xa289('0x36')]);return _0xf4e0aa['getTeams'](_0x20a94f);}})[_0xa289('0x18')](function(_0x3ad149){if(_0x3ad149){_0xb41e4c=_0x3ad149[_0xa289('0x44')];if(!_0x53ca40['query'][_0xa289('0x45')](_0xa289('0x46'))){_0x20a94f[_0xa289('0x13')]=qs[_0xa289('0x13')](_0x53ca40[_0xa289('0x29')][_0xa289('0x13')]);_0x20a94f[_0xa289('0x12')]=qs[_0xa289('0x12')](_0x53ca40[_0xa289('0x29')][_0xa289('0x12')]);}return _0xf4e0aa[_0xa289('0x55')](_0x20a94f);}})['then'](function(_0x44b164){if(_0x44b164){return _0x44b164?{'count':_0xb41e4c,'rows':_0x44b164}:null;}})['then'](respondWithResult(_0x5d24b6,null))['catch'](handleError(_0x5d24b6,null));};exports[_0xa289('0x56')]=function(_0x22cd62,_0x5a0151){var _0x316c60=_0x22cd62[_0xa289('0x3f')][_0xa289('0x57')];return db[_0xa289('0x54')][_0xa289('0x2a')]({'where':{'id':_0x316c60},'attributes':['id'],'include':[{'model':db[_0xa289('0x58')],'as':_0xa289('0x59'),'attributes':['id',_0xa289('0x1d'),_0xa289('0x5a'),_0xa289('0x5b'),_0xa289('0x5c')],'raw':!![]}]})[_0xa289('0x18')](function(_0x48716c){if(_0x48716c){var _0x40ae46=_[_0xa289('0x5d')](_0x48716c,function(_0x4f3b4d){var _0x32370c=_0x4f3b4d['get']({'plain':!![]});return _0x32370c[_0xa289('0x59')];});return db[_0xa289('0x21')][_0xa289('0x37')]({'where':{'id':_0x22cd62['params']['id']}})[_0xa289('0x18')](function(_0x4b0eb1){return db[_0xa289('0x5e')][_0xa289('0x5f')](function(_0x519969){return _0x4b0eb1[_0xa289('0x56')](_0x316c60,{'transaction':_0x519969})[_0xa289('0x18')](function(){return BPromise[_0xa289('0x60')](_0x40ae46,function(_0x79151d){return db['UserChatQueue'][_0xa289('0x61')]({'where':{'UserId':_0x79151d['id'],'ChatQueueId':_0x22cd62[_0xa289('0x2d')]['id']},'transaction':_0x519969});});})[_0xa289('0x18')](function(){_0x40ae46[_0xa289('0x62')](function(_0x4514e2){socket['emit'](_0xa289('0x63'),{'UserId':_0x4514e2['id'],'ChatQueueId':_0x4b0eb1['id']});});});});});}})[_0xa289('0x18')](respondWithStatusCode(_0x5a0151,null))[_0xa289('0x2c')](handleError(_0x5a0151,null));};exports[_0xa289('0x64')]=function(_0x363ec7,_0x2ba687){return db[_0xa289('0x54')][_0xa289('0x2a')]({'where':{'id':_0x363ec7[_0xa289('0x29')][_0xa289('0x57')]},'attributes':['id'],'include':[{'model':db[_0xa289('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ba687,null))['then'](function(_0x2dbd1b){var _0x43a7ef=_[_0xa289('0x20')](_0x2dbd1b,'id');var _0x3adf86=[];var _0x563b8f=[];var _0x1aaaad=squel[_0xa289('0x65')]();_0x1aaaad['field'](_0xa289('0x66'))[_0xa289('0x67')](_0xa289('0x68'),'tq')[_0xa289('0x69')](_0xa289('0x6a'),'ut',_0xa289('0x6b'))[_0xa289('0x27')](_0xa289('0x6c'),_0x363ec7[_0xa289('0x2d')]['id']);for(var _0x1458f7=0x0;_0x1458f7<_0x2dbd1b[_0xa289('0x44')];_0x1458f7+=0x1){let _0x389831=_0x2dbd1b[_0x1458f7];for(var _0x572403=0x0;_0x572403<_0x389831[_0xa289('0x59')][_0xa289('0x44')];_0x572403+=0x1){let _0x4521fe=_0x389831['Agents'][_0x572403];var _0x31124b=_0x1aaaad[_0xa289('0x6d')]();_0x31124b[_0xa289('0x27')](_0xa289('0x6e'),_0x4521fe['id']);_0x563b8f[_0xa289('0x6f')](db[_0xa289('0x5e')][_0xa289('0x29')](_0x31124b[_0xa289('0x70')](),{'type':db[_0xa289('0x5e')][_0xa289('0x71')]['SELECT']})[_0xa289('0x18')](function(_0x413c22){if(_0x413c22[_0xa289('0x44')]===0x1){return _0x4521fe['id'];}else{var _0x2a539c=_[_0xa289('0x72')](_[_0xa289('0x20')](_0x413c22,_0xa289('0x73')),function(_0x4a95d9){return _[_0xa289('0x74')](_0x43a7ef,_0x4a95d9);});if(_0x2a539c){return _0x4521fe['id'];}}}));}}return BPromise[_0xa289('0x75')](_0x563b8f)[_0xa289('0x18')](function(_0x50c32a){_0x3adf86=_(_0x3adf86)['union'](_0x50c32a)[_0xa289('0x76')]()[_0xa289('0x77')]();return db['ChatQueue'][_0xa289('0x37')]({'where':{'id':_0x363ec7[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](function(_0x3430ce){return db[_0xa289('0x5e')]['transaction'](function(_0x331cf8){return _0x3430ce[_0xa289('0x64')](_0x363ec7['query'][_0xa289('0x57')],{'transaction':_0x331cf8})[_0xa289('0x18')](function(){if(!_[_0xa289('0x78')](_0x3adf86)){return _0x3430ce[_0xa289('0x79')](_0x3adf86,{'transaction':_0x331cf8});}})[_0xa289('0x18')](function(){_0x3adf86['forEach'](function(_0x2c9ad3){socket[_0xa289('0x7a')](_0xa289('0x7b'),{'UserId':_0x2c9ad3,'ChatQueueId':_0x3430ce['id']});});});});});});})[_0xa289('0x18')](respondWithStatusCode(_0x2ba687,null))[_0xa289('0x2c')](handleError(_0x2ba687,null));};exports[_0xa289('0x7c')]=function(_0x3b6d46,_0x5d4f64){return db[_0xa289('0x21')][_0xa289('0x37')]({'where':{'id':_0x3b6d46[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x5d4f64,null))['then'](function(_0x1d003f){if(_0x1d003f){return _0x1d003f[_0xa289('0x7c')](_0x3b6d46[_0xa289('0x3f')]['ids'],_[_0xa289('0x7d')](_0x3b6d46[_0xa289('0x3f')],[_0xa289('0x57'),'id'])||{})[_0xa289('0x7e')](function(_0x251f37){for(var _0x412fc5=0x0;_0x412fc5<_0x3b6d46[_0xa289('0x3f')]['ids'][_0xa289('0x44')];_0x412fc5+=0x1){socket[_0xa289('0x7a')](_0xa289('0x63'),{'UserId':Number(_0x3b6d46[_0xa289('0x3f')][_0xa289('0x57')][_0x412fc5]),'ChatQueueId':Number(_0x3b6d46[_0xa289('0x2d')]['id'])});}return _0x251f37;});}})[_0xa289('0x18')](respondWithResult(_0x5d4f64,null))[_0xa289('0x2c')](handleError(_0x5d4f64,null));};exports[_0xa289('0x79')]=function(_0x100916,_0x586472){return db['ChatQueue'][_0xa289('0x37')]({'where':{'id':_0x100916[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x586472,null))[_0xa289('0x18')](function(_0x373442){if(_0x373442){return _0x373442[_0xa289('0x79')](_0x100916[_0xa289('0x29')]['ids'])['then'](function(){if(_[_0xa289('0x7f')](_0x100916[_0xa289('0x29')][_0xa289('0x57')])){for(var _0x20791c=0x0;_0x20791c<_0x100916[_0xa289('0x29')][_0xa289('0x57')]['length'];_0x20791c+=0x1){socket['emit'](_0xa289('0x7b'),{'UserId':Number(_0x100916[_0xa289('0x29')]['ids'][_0x20791c]),'ChatQueueId':Number(_0x100916[_0xa289('0x2d')]['id'])});}}else{socket[_0xa289('0x7a')](_0xa289('0x7b'),{'UserId':Number(_0x100916[_0xa289('0x29')][_0xa289('0x57')]),'ChatQueueId':Number(_0x100916[_0xa289('0x2d')]['id'])});}});}})[_0xa289('0x18')](respondWithStatusCode(_0x586472,null))[_0xa289('0x2c')](handleError(_0x586472,null));};exports[_0xa289('0x80')]=function(_0x8d57fc,_0x2b2f0a){var _0x41a758={};var _0x3006e3={};var _0x92294d;var _0x3eef5f;return db[_0xa289('0x21')][_0xa289('0x42')]({'where':{'id':_0x8d57fc['params']['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x2b2f0a,null))[_0xa289('0x18')](function(_0x484d00){if(_0x484d00){_0x92294d=_0x484d00;_0x3006e3[_0xa289('0x2e')]=_['keys'](db[_0xa289('0x58')]['rawAttributes']);_0x3006e3['query']=_[_0xa289('0x2f')](_0x8d57fc['query']);_0x3006e3[_0xa289('0x30')]=_[_0xa289('0x32')](_0x3006e3['model'],_0x3006e3['query']);_0x41a758['attributes']=_[_0xa289('0x32')](_0x3006e3[_0xa289('0x2e')],qs[_0xa289('0x33')](_0x8d57fc[_0xa289('0x29')]['fields']));_0x41a758[_0xa289('0x31')]=_0x41a758[_0xa289('0x31')]['length']?_0x41a758[_0xa289('0x31')]:_0x3006e3['model'];_0x41a758['order']=qs[_0xa289('0x48')](_0x8d57fc['query'][_0xa289('0x48')]);_0x41a758[_0xa289('0x27')]=qs[_0xa289('0x30')](_[_0xa289('0x49')](_0x8d57fc[_0xa289('0x29')],_0x3006e3[_0xa289('0x30')]));if(_0x8d57fc[_0xa289('0x29')][_0xa289('0x4b')]){_0x41a758[_0xa289('0x27')]=_[_0xa289('0x35')](_0x41a758[_0xa289('0x27')],{'$or':_[_0xa289('0x20')](_0x41a758[_0xa289('0x31')],function(_0x41425f){var _0x1f72e7={};_0x1f72e7[_0x41425f]={'$like':'%'+_0x8d57fc['query'][_0xa289('0x4b')]+'%'};return _0x1f72e7;})});}_0x41a758=_['merge']({},_0x41a758,_0x8d57fc['options']);return _0x92294d[_0xa289('0x80')](_0x41a758);}})['then'](function(_0xa86769){if(_0xa86769){_0x3eef5f=_0xa86769[_0xa289('0x44')];if(!_0x8d57fc['query'][_0xa289('0x45')](_0xa289('0x46'))){_0x41a758[_0xa289('0x13')]=qs['limit'](_0x8d57fc[_0xa289('0x29')]['limit']);_0x41a758[_0xa289('0x12')]=qs['offset'](_0x8d57fc[_0xa289('0x29')][_0xa289('0x12')]);}return _0x92294d[_0xa289('0x80')](_0x41a758);}})[_0xa289('0x18')](function(_0x3ea82c){if(_0x3ea82c){return _0x3ea82c?{'count':_0x3eef5f,'rows':_0x3ea82c}:null;}})[_0xa289('0x18')](respondWithResult(_0x2b2f0a,null))['catch'](handleError(_0x2b2f0a,null));}; \ No newline at end of file +var _0x4389=['ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','then','destroy','ChatQueues','error','name','send','index','map','ChatQueue','rawAttributes','type','where','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','options','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','merge','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userChatQueue:save','removeTeams','Agents','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x2631f6,_0x552ce5){var _0x45917c=function(_0x14b140){while(--_0x14b140){_0x2631f6['push'](_0x2631f6['shift']());}};_0x45917c(++_0x552ce5);}(_0x4389,0x17d));var _0x9438=function(_0x207695,_0x30389a){_0x207695=_0x207695-0x0;var _0x392cc7=_0x4389[_0x207695];return _0x392cc7;};'use strict';var BPromise=require('bluebird');var util=require(_0x9438('0x0'));var _=require(_0x9438('0x1'));var squel=require(_0x9438('0x2'));var Redis=require('ioredis');var qs=require(_0x9438('0x3'));var logger=require(_0x9438('0x4'))('api');var config=require(_0x9438('0x5'));var db=require(_0x9438('0x6'))['db'];config[_0x9438('0x7')]=_['defaults'](config[_0x9438('0x7')],{'host':_0x9438('0x8'),'port':0x18eb});var socket=require(_0x9438('0x9'))(new Redis(config['redis']));require(_0x9438('0xa'))[_0x9438('0xb')](socket);function respondWithStatusCode(_0x2d6e70,_0x1535f6){_0x1535f6=_0x1535f6||0xcc;return function(_0x4ffa21){if(_0x4ffa21){return _0x2d6e70[_0x9438('0xc')](_0x1535f6);}return _0x2d6e70[_0x9438('0xd')](_0x1535f6)[_0x9438('0xe')]();};}function respondWithResult(_0x2bd4a5,_0x4b8a0d){_0x4b8a0d=_0x4b8a0d||0xc8;return function(_0x173165){if(_0x173165){return _0x2bd4a5[_0x9438('0xd')](_0x4b8a0d)['json'](_0x173165);}};}function respondWithFilteredResult(_0x57257a,_0xb6a6ce){return function(_0x4e80f5){if(_0x4e80f5){var _0x5175a7=typeof _0xb6a6ce[_0x9438('0xf')]==='undefined'&&typeof _0xb6a6ce['limit']===_0x9438('0x10');var _0x28edb1=_0x4e80f5[_0x9438('0x11')];var _0x2b8171=_0x5175a7?0x0:_0xb6a6ce[_0x9438('0xf')];var _0x308d83=_0x5175a7?_0x4e80f5[_0x9438('0x11')]:_0xb6a6ce[_0x9438('0xf')]+_0xb6a6ce[_0x9438('0x12')];var _0x8c37ed;if(_0x308d83>=_0x28edb1){_0x308d83=_0x28edb1;_0x8c37ed=0xc8;}else{_0x8c37ed=0xce;}_0x57257a[_0x9438('0xd')](_0x8c37ed);return _0x57257a[_0x9438('0x13')](_0x9438('0x14'),_0x2b8171+'-'+_0x308d83+'/'+_0x28edb1)[_0x9438('0x15')](_0x4e80f5);}return null;};}function saveUpdates(_0x23cde7){return function(_0xef68da){if(_0xef68da){return _0xef68da['update'](_0x23cde7)[_0x9438('0x16')](function(_0x26c9c6){return _0x26c9c6;});}return null;};}function removeEntity(_0x548624){return function(_0x40bd3b){if(_0x40bd3b){return _0x40bd3b[_0x9438('0x17')]()[_0x9438('0x16')](function(){var _0x302162=_0x40bd3b['get']({'plain':!![]});var _0x2b8c2b=_0x9438('0x18');return db['UserProfileResource'][_0x9438('0x17')]({'where':{'type':_0x2b8c2b,'resourceId':_0x302162['id']}})['then'](function(){return _0x40bd3b;});})[_0x9438('0x16')](function(){_0x548624[_0x9438('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3587){return function(_0x2bbea3){if(!_0x2bbea3){_0x1b3587[_0x9438('0xc')](0x194);}return _0x2bbea3;};}function handleError(_0x4b5cb3,_0x52228c){_0x52228c=_0x52228c||0x1f4;return function(_0x116331){logger[_0x9438('0x19')](_0x116331['stack']);if(_0x116331[_0x9438('0x1a')]){delete _0x116331[_0x9438('0x1a')];}_0x4b5cb3[_0x9438('0xd')](_0x52228c)[_0x9438('0x1b')](_0x116331);};}exports[_0x9438('0x1c')]=function(_0x143537,_0x525433){var _0x55e978={};var _0x38c716={'count':0x0,'rows':[]};var _0xa3f2f=_[_0x9438('0x1d')](db[_0x9438('0x1e')][_0x9438('0x1f')],function(_0x3f08e6){return{'name':_0x3f08e6['fieldName'],'type':_0x3f08e6[_0x9438('0x20')]['key']};});_0x55e978=qs['getOptions'](_0xa3f2f,_0x143537);var _0x5d2d77={'where':_0x55e978[_0x9438('0x21')]};return db[_0x9438('0x1e')][_0x9438('0x11')](_0x5d2d77)[_0x9438('0x16')](function(_0x584251){_0x38c716[_0x9438('0x11')]=_0x584251;_0x55e978['include']=qs['include'](_0x143537[_0x9438('0x22')]);return db[_0x9438('0x1e')][_0x9438('0x23')](_0x55e978);})[_0x9438('0x16')](function(_0x86042){_0x38c716['rows']=_0x86042;return _0x38c716;})[_0x9438('0x16')](respondWithFilteredResult(_0x525433,_0x55e978))[_0x9438('0x24')](handleError(_0x525433,null));};exports[_0x9438('0x25')]=function(_0x3f00ef,_0x2f8c90){var _0xf0601c={'raw':!![],'where':{'id':_0x3f00ef[_0x9438('0x26')]['id']}},_0x2f230d={};_0x2f230d[_0x9438('0x27')]=_[_0x9438('0x28')](db['ChatQueue'][_0x9438('0x1f')]);_0x2f230d[_0x9438('0x22')]=_[_0x9438('0x28')](_0x3f00ef[_0x9438('0x22')]);_0x2f230d[_0x9438('0x29')]=_[_0x9438('0x2a')](_0x2f230d[_0x9438('0x27')],_0x2f230d['query']);_0xf0601c[_0x9438('0x2b')]=_[_0x9438('0x2a')](_0x2f230d[_0x9438('0x27')],qs[_0x9438('0x2c')](_0x3f00ef[_0x9438('0x22')]['fields']));_0xf0601c['attributes']=_0xf0601c['attributes'][_0x9438('0x2d')]?_0xf0601c['attributes']:_0x2f230d['model'];if(_0x3f00ef[_0x9438('0x22')]['includeAll']){_0xf0601c['include']=[{'all':!![]}];}_0xf0601c=_['merge']({},_0xf0601c,_0x3f00ef[_0x9438('0x2e')]);return db['ChatQueue'][_0x9438('0x2f')](_0xf0601c)[_0x9438('0x16')](handleEntityNotFound(_0x2f8c90,null))[_0x9438('0x16')](respondWithResult(_0x2f8c90,null))[_0x9438('0x24')](handleError(_0x2f8c90,null));};exports[_0x9438('0x30')]=function(_0x30d414,_0x571a5f){return db[_0x9438('0x1e')]['create'](_0x30d414[_0x9438('0x31')],{})[_0x9438('0x16')](function(_0x1dbbf6){var _0x4e16b8=_0x30d414[_0x9438('0x32')]['get']({'plain':!![]});if(!_0x4e16b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e16b8[_0x9438('0x33')]===_0x9438('0x32')){var _0x1d1921=_0x1dbbf6[_0x9438('0x34')]({'plain':!![]});var _0x4b7537=_0x9438('0x18');return db[_0x9438('0x35')][_0x9438('0x2f')]({'where':{'name':_0x4b7537,'userProfileId':_0x4e16b8[_0x9438('0x36')]},'raw':!![]})[_0x9438('0x16')](function(_0x86d6d3){if(_0x86d6d3&&_0x86d6d3[_0x9438('0x37')]===0x0){return db[_0x9438('0x38')][_0x9438('0x30')]({'name':_0x1d1921[_0x9438('0x1a')],'resourceId':_0x1d1921['id'],'type':_0x86d6d3['name'],'sectionId':_0x86d6d3['id']},{})[_0x9438('0x16')](function(){return _0x1dbbf6;});}else{return _0x1dbbf6;}})['catch'](function(_0x185a50){logger[_0x9438('0x19')](_0x9438('0x39'),_0x185a50);throw _0x185a50;});}return _0x1dbbf6;})[_0x9438('0x16')](respondWithResult(_0x571a5f,0xc9))[_0x9438('0x24')](handleError(_0x571a5f,null));};exports[_0x9438('0x3a')]=function(_0x54ef6c,_0x3da4f9){if(_0x54ef6c[_0x9438('0x31')]['id']){delete _0x54ef6c[_0x9438('0x31')]['id'];}return db[_0x9438('0x1e')][_0x9438('0x2f')]({'where':{'id':_0x54ef6c[_0x9438('0x26')]['id']}})['then'](handleEntityNotFound(_0x3da4f9,null))[_0x9438('0x16')](saveUpdates(_0x54ef6c[_0x9438('0x31')],null))['then'](respondWithResult(_0x3da4f9,null))[_0x9438('0x24')](handleError(_0x3da4f9,null));};exports[_0x9438('0x17')]=function(_0x3bfe19,_0x46ff58){return db[_0x9438('0x1e')][_0x9438('0x2f')]({'where':{'id':_0x3bfe19[_0x9438('0x26')]['id']}})[_0x9438('0x16')](handleEntityNotFound(_0x46ff58,null))[_0x9438('0x16')](removeEntity(_0x46ff58,null))[_0x9438('0x24')](handleError(_0x46ff58,null));};exports[_0x9438('0x3b')]=function(_0x358f5e,_0x4a7961){return db[_0x9438('0x1e')]['describe']()['then'](respondWithResult(_0x4a7961,null))[_0x9438('0x24')](handleError(_0x4a7961,null));};exports[_0x9438('0x3c')]=function(_0x26acd1,_0x4b2f1e){var _0x46ef73={'raw':!![],'where':{}},_0x1baa4e={},_0x356262;return db[_0x9438('0x1e')][_0x9438('0x3d')]({'where':{'id':_0x26acd1['params']['id']}})['then'](handleEntityNotFound(_0x4b2f1e,null))['then'](function(_0x4805c8){if(_0x4805c8){_0x356262=_0x4805c8[_0x9438('0x34')]({'plain':!![]});_0x1baa4e[_0x9438('0x27')]=_[_0x9438('0x28')](db[_0x9438('0x3e')][_0x9438('0x1f')]);_0x1baa4e['query']=_[_0x9438('0x28')](_0x26acd1['query']);_0x1baa4e[_0x9438('0x29')]=_[_0x9438('0x2a')](_0x1baa4e[_0x9438('0x27')],_0x1baa4e['query']);_0x46ef73[_0x9438('0x2b')]=_[_0x9438('0x2a')](_0x1baa4e[_0x9438('0x27')],qs[_0x9438('0x2c')](_0x26acd1[_0x9438('0x22')]['fields']));_0x46ef73[_0x9438('0x2b')]=_0x46ef73['attributes'][_0x9438('0x2d')]?_0x46ef73[_0x9438('0x2b')]:_0x1baa4e[_0x9438('0x27')];if(!_0x26acd1['query'][_0x9438('0x3f')](_0x9438('0x40'))){_0x46ef73[_0x9438('0x12')]=qs[_0x9438('0x12')](_0x26acd1[_0x9438('0x22')][_0x9438('0x12')]);_0x46ef73['offset']=qs[_0x9438('0xf')](_0x26acd1[_0x9438('0x22')][_0x9438('0xf')]);}_0x46ef73[_0x9438('0x41')]=qs[_0x9438('0x42')](_0x26acd1[_0x9438('0x22')][_0x9438('0x42')]);_0x46ef73['where']=qs[_0x9438('0x29')](_[_0x9438('0x43')](_0x26acd1[_0x9438('0x22')],_0x1baa4e[_0x9438('0x29')]));_0x46ef73['where'][_0x9438('0x44')]=_0x4805c8['id'];if(_0x26acd1['query'][_0x9438('0x45')]){_0x46ef73['where']=_[_0x9438('0x46')](_0x46ef73[_0x9438('0x21')],{'$or':_['map'](_0x46ef73[_0x9438('0x2b')],function(_0x2f07b1){var _0x2acbee={};_0x2acbee[_0x2f07b1]={'$like':'%'+_0x26acd1[_0x9438('0x22')][_0x9438('0x45')]+'%'};return _0x2acbee;})});}_0x46ef73=_[_0x9438('0x46')]({},_0x46ef73,_0x26acd1[_0x9438('0x2e')]);return db[_0x9438('0x3e')]['findAll'](_0x46ef73);}})[_0x9438('0x16')](function(_0x19c49a){if(_0x19c49a){return db[_0x9438('0x47')][_0x9438('0x48')]({'where':{'id':_[_0x9438('0x1d')](_0x19c49a,_0x9438('0x49')),'role':_0x9438('0x4a')},'attributes':['id',_0x9438('0x1a'),_0x9438('0x4b'),_0x9438('0x4c'),_0x9438('0x4d')]});}})[_0x9438('0x16')](function(_0x16fb38){if(_0x16fb38){return{'count':_0x16fb38[_0x9438('0x11')],'rows':_[_0x9438('0x1d')](_0x16fb38[_0x9438('0x4e')],function(_0x330f9b){return{'membername':_0x330f9b[_0x9438('0x1a')],'UserId':_0x330f9b['id'],'queue_name':_0x356262[_0x9438('0x1a')],'ChatQueueId':_0x356262['id'],'interface':util[_0x9438('0x4f')](_0x9438('0x50'),_0x9438('0x51'),_0x330f9b[_0x9438('0x1a')]),'penalty':0x0,'paused':_0x330f9b[_0x9438('0x4b')],'createdAt':_0x330f9b[_0x9438('0x4d')],'updatedAt':_0x330f9b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9438('0x16')](respondWithFilteredResult(_0x4b2f1e,_0x46ef73))[_0x9438('0x24')](handleError(_0x4b2f1e,null));};exports[_0x9438('0x52')]=function(_0x415374,_0x38b70f){var _0x2dc554={};var _0x38f964={};var _0x51f283;var _0x275d92;return db[_0x9438('0x1e')][_0x9438('0x3d')]({'where':{'id':_0x415374['params']['id']}})['then'](handleEntityNotFound(_0x38b70f,null))[_0x9438('0x16')](function(_0x4e3a39){if(_0x4e3a39){_0x51f283=_0x4e3a39;_0x38f964['model']=_[_0x9438('0x28')](db[_0x9438('0x53')][_0x9438('0x1f')]);_0x38f964[_0x9438('0x22')]=_[_0x9438('0x28')](_0x415374['query']);_0x38f964[_0x9438('0x29')]=_[_0x9438('0x2a')](_0x38f964[_0x9438('0x27')],_0x38f964[_0x9438('0x22')]);_0x2dc554[_0x9438('0x2b')]=_[_0x9438('0x2a')](_0x38f964[_0x9438('0x27')],qs[_0x9438('0x2c')](_0x415374[_0x9438('0x22')][_0x9438('0x2c')]));_0x2dc554[_0x9438('0x2b')]=_0x2dc554[_0x9438('0x2b')][_0x9438('0x2d')]?_0x2dc554[_0x9438('0x2b')]:_0x38f964[_0x9438('0x27')];_0x2dc554[_0x9438('0x41')]=qs['sort'](_0x415374[_0x9438('0x22')]['sort']);_0x2dc554[_0x9438('0x21')]=qs['filters'](_[_0x9438('0x43')](_0x415374[_0x9438('0x22')],_0x38f964[_0x9438('0x29')]));if(_0x415374[_0x9438('0x22')][_0x9438('0x45')]){_0x2dc554[_0x9438('0x21')]=_[_0x9438('0x46')](_0x2dc554[_0x9438('0x21')],{'$or':_[_0x9438('0x1d')](_0x2dc554[_0x9438('0x2b')],function(_0x3a8cc5){var _0x1acf4f={};_0x1acf4f[_0x3a8cc5]={'$like':'%'+_0x415374[_0x9438('0x22')][_0x9438('0x45')]+'%'};return _0x1acf4f;})});}_0x2dc554=_['merge']({},_0x2dc554,_0x415374[_0x9438('0x2e')]);return _0x51f283[_0x9438('0x52')](_0x2dc554);}})['then'](function(_0x2c4d2c){if(_0x2c4d2c){_0x275d92=_0x2c4d2c[_0x9438('0x2d')];if(!_0x415374[_0x9438('0x22')]['hasOwnProperty'](_0x9438('0x40'))){_0x2dc554['limit']=qs[_0x9438('0x12')](_0x415374[_0x9438('0x22')][_0x9438('0x12')]);_0x2dc554['offset']=qs[_0x9438('0xf')](_0x415374[_0x9438('0x22')][_0x9438('0xf')]);}return _0x51f283[_0x9438('0x52')](_0x2dc554);}})[_0x9438('0x16')](function(_0x544b52){if(_0x544b52){return _0x544b52?{'count':_0x275d92,'rows':_0x544b52}:null;}})[_0x9438('0x16')](respondWithResult(_0x38b70f,null))[_0x9438('0x24')](handleError(_0x38b70f,null));};exports[_0x9438('0x54')]=function(_0x14755d,_0x5b92f4){var _0xb4fcfb=_0x14755d['body'][_0x9438('0x55')];return db[_0x9438('0x53')]['findAll']({'where':{'id':_0xb4fcfb},'attributes':['id'],'include':[{'model':db[_0x9438('0x47')],'as':'Agents','attributes':['id','name',_0x9438('0x56'),_0x9438('0x57'),_0x9438('0x58')],'raw':!![]}]})[_0x9438('0x16')](function(_0x59a8cd){if(_0x59a8cd){var _0x2f91d8=_[_0x9438('0x59')](_0x59a8cd,function(_0x5919be){var _0x662bbf=_0x5919be['get']({'plain':!![]});return _0x662bbf['Agents'];});return db[_0x9438('0x1e')][_0x9438('0x2f')]({'where':{'id':_0x14755d[_0x9438('0x26')]['id']}})['then'](function(_0x5cb26d){return db[_0x9438('0x5a')][_0x9438('0x5b')](function(_0x56894d){return _0x5cb26d[_0x9438('0x54')](_0xb4fcfb,{'transaction':_0x56894d})['then'](function(){return BPromise['each'](_0x2f91d8,function(_0x2793b7){return db[_0x9438('0x3e')]['findOrCreate']({'where':{'UserId':_0x2793b7['id'],'ChatQueueId':_0x14755d[_0x9438('0x26')]['id']},'transaction':_0x56894d});});})['then'](function(){_0x2f91d8[_0x9438('0x5c')](function(_0x4541f8){socket[_0x9438('0x5d')](_0x9438('0x5e'),{'UserId':_0x4541f8['id'],'ChatQueueId':_0x5cb26d['id']});});});});});}})[_0x9438('0x16')](respondWithStatusCode(_0x5b92f4,null))[_0x9438('0x24')](handleError(_0x5b92f4,null));};exports[_0x9438('0x5f')]=function(_0x14f2b7,_0x51bb97){return db[_0x9438('0x53')][_0x9438('0x23')]({'where':{'id':_0x14f2b7[_0x9438('0x22')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9438('0x47')],'as':_0x9438('0x60'),'attributes':['id'],'raw':!![]}]})[_0x9438('0x16')](handleEntityNotFound(_0x51bb97,null))['then'](function(_0x41c44d){var _0x26a6fa=_['map'](_0x41c44d,'id');var _0x3943fd=[];var _0x49b56a=[];var _0xd5a687=squel['select']();_0xd5a687[_0x9438('0x61')](_0x9438('0x62'))[_0x9438('0x63')](_0x9438('0x64'),'tq')[_0x9438('0x65')]('user_has_teams','ut',_0x9438('0x66'))['where'](_0x9438('0x67'),_0x14f2b7[_0x9438('0x26')]['id']);for(var _0x228251=0x0;_0x228251<_0x41c44d[_0x9438('0x2d')];_0x228251+=0x1){let _0x3514eb=_0x41c44d[_0x228251];for(var _0x2eed52=0x0;_0x2eed52<_0x3514eb[_0x9438('0x60')][_0x9438('0x2d')];_0x2eed52+=0x1){let _0x43c1b5=_0x3514eb['Agents'][_0x2eed52];var _0x7913c0=_0xd5a687[_0x9438('0x68')]();_0x7913c0['where']('ut.UserId\x20=\x20?',_0x43c1b5['id']);_0x49b56a['push'](db[_0x9438('0x5a')]['query'](_0x7913c0[_0x9438('0x69')](),{'type':db[_0x9438('0x5a')][_0x9438('0x6a')][_0x9438('0x6b')]})[_0x9438('0x16')](function(_0x2ebb0a){if(_0x2ebb0a['length']===0x1){return _0x43c1b5['id'];}else{var _0x2eb8a8=_[_0x9438('0x6c')](_['map'](_0x2ebb0a,_0x9438('0x6d')),function(_0x3138c8){return _[_0x9438('0x6e')](_0x26a6fa,_0x3138c8);});if(_0x2eb8a8){return _0x43c1b5['id'];}}}));}}return BPromise[_0x9438('0x6f')](_0x49b56a)['then'](function(_0x2a41af){_0x3943fd=_(_0x3943fd)[_0x9438('0x70')](_0x2a41af)[_0x9438('0x71')]()[_0x9438('0x72')]();return db['ChatQueue']['find']({'where':{'id':_0x14f2b7[_0x9438('0x26')]['id']}})[_0x9438('0x16')](function(_0x5fc695){return db[_0x9438('0x5a')][_0x9438('0x5b')](function(_0x146f9d){return _0x5fc695[_0x9438('0x5f')](_0x14f2b7[_0x9438('0x22')][_0x9438('0x55')],{'transaction':_0x146f9d})['then'](function(){if(!_['isEmpty'](_0x3943fd)){return _0x5fc695[_0x9438('0x73')](_0x3943fd,{'transaction':_0x146f9d});}})['then'](function(){_0x3943fd[_0x9438('0x5c')](function(_0x2ce80b){socket[_0x9438('0x5d')]('userChatQueue:remove',{'UserId':_0x2ce80b,'ChatQueueId':_0x5fc695['id']});});});});});});})[_0x9438('0x16')](respondWithStatusCode(_0x51bb97,null))['catch'](handleError(_0x51bb97,null));};exports['addAgents']=function(_0xe3bc19,_0x166668){return db[_0x9438('0x1e')][_0x9438('0x2f')]({'where':{'id':_0xe3bc19[_0x9438('0x26')]['id']}})['then'](handleEntityNotFound(_0x166668,null))[_0x9438('0x16')](function(_0x4031f){if(_0x4031f){return _0x4031f[_0x9438('0x74')](_0xe3bc19['body']['ids'],_[_0x9438('0x75')](_0xe3bc19[_0x9438('0x31')],[_0x9438('0x55'),'id'])||{})[_0x9438('0x76')](function(_0x4d5caf){for(var _0x5958a6=0x0;_0x5958a6<_0xe3bc19['body'][_0x9438('0x55')][_0x9438('0x2d')];_0x5958a6+=0x1){socket['emit'](_0x9438('0x5e'),{'UserId':Number(_0xe3bc19[_0x9438('0x31')][_0x9438('0x55')][_0x5958a6]),'ChatQueueId':Number(_0xe3bc19['params']['id'])});}return _0x4d5caf;});}})[_0x9438('0x16')](respondWithResult(_0x166668,null))[_0x9438('0x24')](handleError(_0x166668,null));};exports[_0x9438('0x73')]=function(_0x28c11f,_0x4ccc95){return db[_0x9438('0x1e')][_0x9438('0x2f')]({'where':{'id':_0x28c11f[_0x9438('0x26')]['id']}})[_0x9438('0x16')](handleEntityNotFound(_0x4ccc95,null))[_0x9438('0x16')](function(_0x2f3ee6){if(_0x2f3ee6){return _0x2f3ee6[_0x9438('0x73')](_0x28c11f[_0x9438('0x22')]['ids'])[_0x9438('0x16')](function(){if(_[_0x9438('0x77')](_0x28c11f['query'][_0x9438('0x55')])){for(var _0x5b3e76=0x0;_0x5b3e76<_0x28c11f[_0x9438('0x22')][_0x9438('0x55')][_0x9438('0x2d')];_0x5b3e76+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x28c11f[_0x9438('0x22')][_0x9438('0x55')][_0x5b3e76]),'ChatQueueId':Number(_0x28c11f[_0x9438('0x26')]['id'])});}}else{socket[_0x9438('0x5d')]('userChatQueue:remove',{'UserId':Number(_0x28c11f['query']['ids']),'ChatQueueId':Number(_0x28c11f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4ccc95,null))[_0x9438('0x24')](handleError(_0x4ccc95,null));};exports[_0x9438('0x78')]=function(_0x1d14cd,_0x13a720){var _0x528e80={};var _0x56d7c8={};var _0x22b5a1;var _0x5c5878;return db[_0x9438('0x1e')]['findOne']({'where':{'id':_0x1d14cd[_0x9438('0x26')]['id']}})['then'](handleEntityNotFound(_0x13a720,null))[_0x9438('0x16')](function(_0x3c8d97){if(_0x3c8d97){_0x22b5a1=_0x3c8d97;_0x56d7c8[_0x9438('0x27')]=_[_0x9438('0x28')](db[_0x9438('0x47')][_0x9438('0x1f')]);_0x56d7c8[_0x9438('0x22')]=_[_0x9438('0x28')](_0x1d14cd[_0x9438('0x22')]);_0x56d7c8[_0x9438('0x29')]=_[_0x9438('0x2a')](_0x56d7c8[_0x9438('0x27')],_0x56d7c8[_0x9438('0x22')]);_0x528e80[_0x9438('0x2b')]=_[_0x9438('0x2a')](_0x56d7c8[_0x9438('0x27')],qs[_0x9438('0x2c')](_0x1d14cd[_0x9438('0x22')][_0x9438('0x2c')]));_0x528e80[_0x9438('0x2b')]=_0x528e80[_0x9438('0x2b')][_0x9438('0x2d')]?_0x528e80['attributes']:_0x56d7c8[_0x9438('0x27')];_0x528e80[_0x9438('0x41')]=qs[_0x9438('0x42')](_0x1d14cd[_0x9438('0x22')][_0x9438('0x42')]);_0x528e80[_0x9438('0x21')]=qs['filters'](_[_0x9438('0x43')](_0x1d14cd[_0x9438('0x22')],_0x56d7c8['filters']));if(_0x1d14cd[_0x9438('0x22')][_0x9438('0x45')]){_0x528e80[_0x9438('0x21')]=_['merge'](_0x528e80['where'],{'$or':_['map'](_0x528e80['attributes'],function(_0x41a94a){var _0x2404f9={};_0x2404f9[_0x41a94a]={'$like':'%'+_0x1d14cd[_0x9438('0x22')][_0x9438('0x45')]+'%'};return _0x2404f9;})});}_0x528e80=_[_0x9438('0x46')]({},_0x528e80,_0x1d14cd[_0x9438('0x2e')]);return _0x22b5a1[_0x9438('0x78')](_0x528e80);}})[_0x9438('0x16')](function(_0x191279){if(_0x191279){_0x5c5878=_0x191279[_0x9438('0x2d')];if(!_0x1d14cd[_0x9438('0x22')][_0x9438('0x3f')](_0x9438('0x40'))){_0x528e80[_0x9438('0x12')]=qs[_0x9438('0x12')](_0x1d14cd[_0x9438('0x22')][_0x9438('0x12')]);_0x528e80[_0x9438('0xf')]=qs[_0x9438('0xf')](_0x1d14cd[_0x9438('0x22')][_0x9438('0xf')]);}return _0x22b5a1[_0x9438('0x78')](_0x528e80);}})[_0x9438('0x16')](function(_0x262d4f){if(_0x262d4f){return _0x262d4f?{'count':_0x5c5878,'rows':_0x262d4f}:null;}})['then'](respondWithResult(_0x13a720,null))[_0x9438('0x24')](handleError(_0x13a720,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index de4a0ae..18b7f38 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 _0x6108=['ChatQueue','setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0x4b0733,_0x2324ed){var _0x1d5fdc=function(_0x2fb672){while(--_0x2fb672){_0x4b0733['push'](_0x4b0733['shift']());}};_0x1d5fdc(++_0x2324ed);}(_0x6108,0xbc));var _0x8610=function(_0x3fc430,_0x17dcdf){_0x3fc430=_0x3fc430-0x0;var _0x59a28d=_0x6108[_0x3fc430];return _0x59a28d;};'use strict';var EventEmitter=require(_0x8610('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x8610('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8610('0x2')](0x0);var events={'afterCreate':_0x8610('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x142cb5){return function(_0x42741d,_0x54802f,_0x4aa00f){ChatQueueEvents[_0x8610('0x4')](_0x142cb5+':'+_0x42741d['id'],_0x42741d);ChatQueueEvents[_0x8610('0x4')](_0x142cb5,_0x42741d);_0x4aa00f(null);};}for(var e in events){if(events[_0x8610('0x5')](e)){var event=events[e];ChatQueue[_0x8610('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x61a2=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3a97d2,_0x45ac9e){var _0x3a927c=function(_0x3c7f48){while(--_0x3c7f48){_0x3a97d2['push'](_0x3a97d2['shift']());}};_0x3a927c(++_0x45ac9e);}(_0x61a2,0x184));var _0x261a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x61a2[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x261a('0x0'));var ChatQueue=require(_0x261a('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x261a('0x2')](0x0);var events={'afterCreate':_0x261a('0x3'),'afterUpdate':_0x261a('0x4'),'afterDestroy':_0x261a('0x5')};function emitEvent(_0x27eb98){return function(_0x156ef3,_0x104617,_0x3463e4){ChatQueueEvents[_0x261a('0x6')](_0x27eb98+':'+_0x156ef3['id'],_0x156ef3);ChatQueueEvents[_0x261a('0x6')](_0x27eb98,_0x156ef3);_0x3463e4(null);};}for(var e in events){if(events[_0x261a('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x261a('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 869899e..4cde105 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 _0xe2a6=['./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x241ec1,_0x2fac9e){var _0x3de936=function(_0x5f3ce5){while(--_0x5f3ce5){_0x241ec1['push'](_0x241ec1['shift']());}};_0x3de936(++_0x2fac9e);}(_0xe2a6,0xcb));var _0x6e2a=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0xe2a6[_0x1f6f84];return _0x177f40;};'use strict';var _=require(_0x6e2a('0x0'));var util=require(_0x6e2a('0x1'));var logger=require(_0x6e2a('0x2'))('api');var moment=require(_0x6e2a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6e2a('0x4'));var fs=require('fs');var path=require(_0x6e2a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e2a('0x6'));module[_0x6e2a('0x7')]=function(_0x21c8c9,_0x5a7340){return _0x21c8c9[_0x6e2a('0x8')](_0x6e2a('0x9'),attributes,{'tableName':_0x6e2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c76=['ChatQueue','chat_queues','lodash','util','api','bluebird','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x332960,_0x52d3a5){var _0x3ac280=function(_0x42ae36){while(--_0x42ae36){_0x332960['push'](_0x332960['shift']());}};_0x3ac280(++_0x52d3a5);}(_0x0c76,0x120));var _0x60c7=function(_0x47c4bd,_0x4492f2){_0x47c4bd=_0x47c4bd-0x0;var _0x356830=_0x0c76[_0x47c4bd];return _0x356830;};'use strict';var _=require(_0x60c7('0x0'));var util=require(_0x60c7('0x1'));var logger=require('../../config/logger')(_0x60c7('0x2'));var moment=require('moment');var BPromise=require(_0x60c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x60c7('0x4'));var config=require(_0x60c7('0x5'));var attributes=require(_0x60c7('0x6'));module[_0x60c7('0x7')]=function(_0x1f29b6,_0x5470e4){return _0x1f29b6[_0x60c7('0x8')](_0x60c7('0x9'),attributes,{'tableName':_0x60c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index dabf809..067b9af 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 _0xafcd=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','map','include','model','stringify','ShowChatQueue'];(function(_0x9bcc0b,_0x120f6c){var _0x195399=function(_0x5be8b9){while(--_0x5be8b9){_0x9bcc0b['push'](_0x9bcc0b['shift']());}};_0x195399(++_0x120f6c);}(_0xafcd,0x157));var _0xdafc=function(_0x292380,_0x2c9565){_0x292380=_0x292380-0x0;var _0x148f5d=_0xafcd[_0x292380];return _0x148f5d;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require(_0xdafc('0x4'));var fs=require('fs');var Redis=require(_0xdafc('0x5'));var db=require(_0xdafc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdafc('0x7'))(_0xdafc('0x8'));var config=require(_0xdafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdafc('0xa')][_0xdafc('0xb')]({'port':0x232a});config[_0xdafc('0xc')]=_['defaults'](config[_0xdafc('0xc')],{'host':_0xdafc('0xd'),'port':0x18eb});var socket=require(_0xdafc('0xe'))(new Redis(config[_0xdafc('0xc')]));require(_0xdafc('0xf'))[_0xdafc('0x10')](socket);function respondWithRpcPromise(_0x3df5fb,_0x312e69,_0x1f87c5){return new BPromise(function(_0x2fdc39,_0x39561b){return client['request'](_0x3df5fb,_0x1f87c5)['then'](function(_0x2a1a6b){logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x312e69,_0xdafc('0x13'));logger[_0xdafc('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x312e69,'request\x20sent',JSON['stringify'](_0x2a1a6b));if(_0x2a1a6b[_0xdafc('0x15')]){if(_0x2a1a6b['error'][_0xdafc('0x16')]===0x1f4){logger['error'](_0xdafc('0x12'),_0x312e69,_0x2a1a6b[_0xdafc('0x15')][_0xdafc('0x17')]);return _0x39561b(_0x2a1a6b[_0xdafc('0x15')]['message']);}logger['error'](_0xdafc('0x12'),_0x312e69,_0x2a1a6b[_0xdafc('0x15')][_0xdafc('0x17')]);return _0x2fdc39(_0x2a1a6b['error']['message']);}else{logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x312e69,_0xdafc('0x13'));_0x2fdc39(_0x2a1a6b[_0xdafc('0x18')][_0xdafc('0x17')]);}})[_0xdafc('0x19')](function(_0x1ff505){logger[_0xdafc('0x15')]('ChatQueue,\x20%s,\x20%s',_0x312e69,_0x1ff505);_0x39561b(_0x1ff505);});});}exports[_0xdafc('0x1a')]=function(_0x10258f){var _0x5f4d1d=this;return new Promise(function(_0x239908,_0xb825df){return db[_0xdafc('0x1b')][_0xdafc('0x1c')]({'raw':_0x10258f[_0xdafc('0x1d')]?_0x10258f[_0xdafc('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x10258f['options']?_0x10258f['options'][_0xdafc('0x1e')]||null:null,'attributes':_0x10258f['options']?_0x10258f[_0xdafc('0x1d')][_0xdafc('0x1f')]||null:null,'limit':_0x10258f[_0xdafc('0x1d')]?_0x10258f[_0xdafc('0x1d')]['limit']||null:null,'include':_0x10258f[_0xdafc('0x1d')]?_0x10258f[_0xdafc('0x1d')]['include']?_[_0xdafc('0x20')](_0x10258f[_0xdafc('0x1d')][_0xdafc('0x21')],function(_0x3d3f06){return{'model':db[_0x3d3f06[_0xdafc('0x22')]],'as':_0x3d3f06['as'],'attributes':_0x3d3f06[_0xdafc('0x1f')],'include':_0x3d3f06[_0xdafc('0x21')]?_['map'](_0x3d3f06[_0xdafc('0x21')],function(_0x2d8bb0){return{'model':db[_0x2d8bb0['model']],'as':_0x2d8bb0['as'],'attributes':_0x2d8bb0[_0xdafc('0x1f')],'include':_0x2d8bb0['include']?_['map'](_0x2d8bb0[_0xdafc('0x21')],function(_0x56a820){return{'model':db[_0x56a820[_0xdafc('0x22')]],'as':_0x56a820['as'],'attributes':_0x56a820[_0xdafc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2752bd){logger['info']('GetChatQueue',_0x10258f);logger['debug'](_0xdafc('0x1a'),_0x10258f,JSON[_0xdafc('0x23')](_0x2752bd));_0x239908(_0x2752bd);})[_0xdafc('0x19')](function(_0x219e1e){logger[_0xdafc('0x15')](_0xdafc('0x1a'),_0x219e1e[_0xdafc('0x17')],_0x10258f);_0xb825df(_0x5f4d1d['error'](0x1f4,_0x219e1e[_0xdafc('0x17')]));});});};exports[_0xdafc('0x24')]=function(_0x51f59f){var _0x5e1f4c=this;return new Promise(function(_0x3d91b5,_0x727050){return db['ChatQueue']['find']({'raw':_0x51f59f[_0xdafc('0x1d')]?_0x51f59f[_0xdafc('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x51f59f['options']?_0x51f59f['options']['where']||null:null,'attributes':_0x51f59f[_0xdafc('0x1d')]?_0x51f59f['options'][_0xdafc('0x1f')]||null:null,'include':_0x51f59f[_0xdafc('0x1d')]?_0x51f59f[_0xdafc('0x1d')][_0xdafc('0x21')]?_['map'](_0x51f59f[_0xdafc('0x1d')][_0xdafc('0x21')],function(_0x25ee4c){return{'model':db[_0x25ee4c[_0xdafc('0x22')]],'as':_0x25ee4c['as'],'attributes':_0x25ee4c[_0xdafc('0x1f')],'include':_0x25ee4c[_0xdafc('0x21')]?_['map'](_0x25ee4c[_0xdafc('0x21')],function(_0x413862){return{'model':db[_0x413862[_0xdafc('0x22')]],'as':_0x413862['as'],'attributes':_0x413862['attributes'],'include':_0x413862[_0xdafc('0x21')]?_['map'](_0x413862[_0xdafc('0x21')],function(_0x4a1591){return{'model':db[_0x4a1591[_0xdafc('0x22')]],'as':_0x4a1591['as'],'attributes':_0x4a1591[_0xdafc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdafc('0x25')](function(_0x52ff5b){logger[_0xdafc('0x11')](_0xdafc('0x24'),_0x51f59f);logger[_0xdafc('0x14')]('ShowChatQueue',_0x51f59f,JSON[_0xdafc('0x23')](_0x52ff5b));_0x3d91b5(_0x52ff5b);})['catch'](function(_0x13fc41){logger[_0xdafc('0x15')](_0xdafc('0x24'),_0x13fc41['message'],_0x51f59f);_0x727050(_0x5e1f4c['error'](0x1f4,_0x13fc41[_0xdafc('0x17')]));});});}; \ No newline at end of file +var _0xf7d9=['then','ShowChatQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','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','raw','options','where','limit','include','model','attributes','map'];(function(_0x32632b,_0x2c134c){var _0x7f7571=function(_0xb0b978){while(--_0xb0b978){_0x32632b['push'](_0x32632b['shift']());}};_0x7f7571(++_0x2c134c);}(_0xf7d9,0x122));var _0x9f7d=function(_0x1c293b,_0x2bffe4){_0x1c293b=_0x1c293b-0x0;var _0x245d04=_0xf7d9[_0x1c293b];return _0x245d04;};'use strict';var _=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var moment=require(_0x9f7d('0x2'));var BPromise=require(_0x9f7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))(_0x9f7d('0x6'));var config=require(_0x9f7d('0x7'));var jayson=require(_0x9f7d('0x8'));var client=jayson[_0x9f7d('0x9')]['http']({'port':0x232a});config['redis']=_[_0x9f7d('0xa')](config[_0x9f7d('0xb')],{'host':_0x9f7d('0xc'),'port':0x18eb});var socket=require(_0x9f7d('0xd'))(new Redis(config[_0x9f7d('0xb')]));require(_0x9f7d('0xe'))['register'](socket);function respondWithRpcPromise(_0x9a9655,_0x2baa65,_0x4eecfd){return new BPromise(function(_0x405b3c,_0x2227e3){return client[_0x9f7d('0xf')](_0x9a9655,_0x4eecfd)['then'](function(_0x43a48e){logger[_0x9f7d('0x10')](_0x9f7d('0x11'),_0x2baa65,_0x9f7d('0x12'));logger[_0x9f7d('0x13')](_0x9f7d('0x14'),_0x2baa65,'request\x20sent',JSON[_0x9f7d('0x15')](_0x43a48e));if(_0x43a48e[_0x9f7d('0x16')]){if(_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x17')]===0x1f4){logger['error'](_0x9f7d('0x11'),_0x2baa65,_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x18')]);return _0x2227e3(_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x18')]);}logger[_0x9f7d('0x16')](_0x9f7d('0x11'),_0x2baa65,_0x43a48e['error']['message']);return _0x405b3c(_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x18')]);}else{logger[_0x9f7d('0x10')](_0x9f7d('0x11'),_0x2baa65,_0x9f7d('0x12'));_0x405b3c(_0x43a48e[_0x9f7d('0x19')][_0x9f7d('0x18')]);}})[_0x9f7d('0x1a')](function(_0x3d2bcf){logger['error'](_0x9f7d('0x11'),_0x2baa65,_0x3d2bcf);_0x2227e3(_0x3d2bcf);});});}exports[_0x9f7d('0x1b')]=function(_0x50204c){var _0x4c2977=this;return new Promise(function(_0x5b17ad,_0x3f650e){return db[_0x9f7d('0x1c')][_0x9f7d('0x1d')]({'raw':_0x50204c['options']?_0x50204c['options'][_0x9f7d('0x1e')]===undefined?!![]:![]:!![],'where':_0x50204c[_0x9f7d('0x1f')]?_0x50204c[_0x9f7d('0x1f')][_0x9f7d('0x20')]||null:null,'attributes':_0x50204c[_0x9f7d('0x1f')]?_0x50204c[_0x9f7d('0x1f')]['attributes']||null:null,'limit':_0x50204c[_0x9f7d('0x1f')]?_0x50204c['options'][_0x9f7d('0x21')]||null:null,'include':_0x50204c['options']?_0x50204c['options'][_0x9f7d('0x22')]?_['map'](_0x50204c['options'][_0x9f7d('0x22')],function(_0xe2ada9){return{'model':db[_0xe2ada9[_0x9f7d('0x23')]],'as':_0xe2ada9['as'],'attributes':_0xe2ada9[_0x9f7d('0x24')],'include':_0xe2ada9['include']?_['map'](_0xe2ada9[_0x9f7d('0x22')],function(_0x238d13){return{'model':db[_0x238d13[_0x9f7d('0x23')]],'as':_0x238d13['as'],'attributes':_0x238d13[_0x9f7d('0x24')],'include':_0x238d13['include']?_[_0x9f7d('0x25')](_0x238d13[_0x9f7d('0x22')],function(_0x8c6833){return{'model':db[_0x8c6833[_0x9f7d('0x23')]],'as':_0x8c6833['as'],'attributes':_0x8c6833[_0x9f7d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9f7d('0x26')](function(_0x3ec5a0){logger[_0x9f7d('0x10')]('GetChatQueue',_0x50204c);logger['debug'](_0x9f7d('0x1b'),_0x50204c,JSON[_0x9f7d('0x15')](_0x3ec5a0));_0x5b17ad(_0x3ec5a0);})[_0x9f7d('0x1a')](function(_0x1a467d){logger[_0x9f7d('0x16')](_0x9f7d('0x1b'),_0x1a467d[_0x9f7d('0x18')],_0x50204c);_0x3f650e(_0x4c2977[_0x9f7d('0x16')](0x1f4,_0x1a467d['message']));});});};exports[_0x9f7d('0x27')]=function(_0x1d4f34){var _0x30a12e=this;return new Promise(function(_0x4fa5b4,_0x2c27fd){return db[_0x9f7d('0x1c')][_0x9f7d('0x28')]({'raw':_0x1d4f34['options']?_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d4f34['options']?_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x20')]||null:null,'attributes':_0x1d4f34[_0x9f7d('0x1f')]?_0x1d4f34['options']['attributes']||null:null,'include':_0x1d4f34[_0x9f7d('0x1f')]?_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x22')]?_[_0x9f7d('0x25')](_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x22')],function(_0x498bdf){return{'model':db[_0x498bdf['model']],'as':_0x498bdf['as'],'attributes':_0x498bdf[_0x9f7d('0x24')],'include':_0x498bdf['include']?_['map'](_0x498bdf[_0x9f7d('0x22')],function(_0x2dd9ff){return{'model':db[_0x2dd9ff[_0x9f7d('0x23')]],'as':_0x2dd9ff['as'],'attributes':_0x2dd9ff[_0x9f7d('0x24')],'include':_0x2dd9ff['include']?_[_0x9f7d('0x25')](_0x2dd9ff['include'],function(_0x1ef808){return{'model':db[_0x1ef808[_0x9f7d('0x23')]],'as':_0x1ef808['as'],'attributes':_0x1ef808[_0x9f7d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9f7d('0x26')](function(_0x4bb270){logger[_0x9f7d('0x10')](_0x9f7d('0x27'),_0x1d4f34);logger[_0x9f7d('0x13')](_0x9f7d('0x27'),_0x1d4f34,JSON['stringify'](_0x4bb270));_0x4fa5b4(_0x4bb270);})[_0x9f7d('0x1a')](function(_0x1f61b0){logger[_0x9f7d('0x16')](_0x9f7d('0x27'),_0x1f61b0[_0x9f7d('0x18')],_0x1d4f34);_0x2c27fd(_0x30a12e[_0x9f7d('0x16')](0x1f4,_0x1f61b0[_0x9f7d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6f4bb2c..02c3367 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 _0x04de=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x04de,0x107));var _0xe04d=function(_0x376ca9,_0x3754dd){_0x376ca9=_0x376ca9-0x0;var _0xeda94=_0x04de[_0x376ca9];return _0xeda94;};'use strict';var ChatQueueEvents=require(_0xe04d('0x0'));var events=[_0xe04d('0x1'),_0xe04d('0x2'),_0xe04d('0x3')];function createListener(_0x1e650d,_0x28f63f){return function(_0x1113af){_0x28f63f[_0xe04d('0x4')](_0x1e650d,_0x1113af);};}function removeListener(_0x2593a4,_0x70ead0){return function(){ChatQueueEvents[_0xe04d('0x5')](_0x2593a4,_0x70ead0);};}exports['register']=function(_0x4bb925){for(var _0x4f7637=0x0,_0x531688=events[_0xe04d('0x6')];_0x4f7637<_0x531688;_0x4f7637++){var _0x210e93=events[_0x4f7637];var _0x72b1ce=createListener(_0xe04d('0x7')+_0x210e93,_0x4bb925);ChatQueueEvents['on'](_0x210e93,_0x72b1ce);}}; \ No newline at end of file +var _0x4ea3=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x7b6b42,_0x20eea3){var _0x1496c3=function(_0x2b1815){while(--_0x2b1815){_0x7b6b42['push'](_0x7b6b42['shift']());}};_0x1496c3(++_0x20eea3);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var ChatQueueEvents=require(_0x34ea('0x0'));var events=[_0x34ea('0x1'),_0x34ea('0x2'),_0x34ea('0x3')];function createListener(_0x588172,_0x374ec1){return function(_0x494b56){_0x374ec1[_0x34ea('0x4')](_0x588172,_0x494b56);};}function removeListener(_0x571f1b,_0x5e5a84){return function(){ChatQueueEvents[_0x34ea('0x5')](_0x571f1b,_0x5e5a84);};}exports[_0x34ea('0x6')]=function(_0x962596){for(var _0x123d48=0x0,_0x40434e=events[_0x34ea('0x7')];_0x123d48<_0x40434e;_0x123d48++){var _0x22b09e=events[_0x123d48];var _0x5bec7c=createListener(_0x34ea('0x8')+_0x22b09e,_0x962596);ChatQueueEvents['on'](_0x22b09e,_0x5bec7c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e895da3..726dc4e 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(_0x3d6fb8,_0x1cb6e5){var _0xf21d8a=function(_0x1f9429){while(--_0x1f9429){_0x3d6fb8['push'](_0x3d6fb8['shift']());}};_0xf21d8a(++_0x1cb6e5);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x310af3,_0x1e6f47){var _0x317f9a=function(_0x33667f){while(--_0x33667f){_0x310af3['push'](_0x310af3['shift']());}};_0x317f9a(++_0x1e6f47);}(_0xe14b,0x93));var _0xbe14=function(_0x19d0f4,_0x38b420){_0x19d0f4=_0x19d0f4-0x0;var _0x186ed6=_0xe14b[_0x19d0f4];return _0x186ed6;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 710ef8d..f9b7c5e 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 _0x3739=['DATE','moment','exports','STRING'];(function(_0x177135,_0x156a57){var _0x356eee=function(_0x59a61f){while(--_0x59a61f){_0x177135['push'](_0x177135['shift']());}};_0x356eee(++_0x156a57);}(_0x3739,0x1f1));var _0x9373=function(_0x415ac5,_0x663a59){_0x415ac5=_0x415ac5-0x0;var _0x2fb770=_0x3739[_0x415ac5];return _0x2fb770;};'use strict';var moment=require(_0x9373('0x0'));var Sequelize=require('sequelize');module[_0x9373('0x1')]={'uniqueid':{'type':Sequelize[_0x9373('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9373('0x2')]},'joinAt':{'type':Sequelize[_0x9373('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9373('0x3')]},'reason':{'type':Sequelize[_0x9373('0x2')]}}; \ No newline at end of file +var _0xc51e=['sequelize','exports','STRING','DATE'];(function(_0x4ddf8a,_0x1fe45e){var _0x1794b1=function(_0x55c1b7){while(--_0x55c1b7){_0x4ddf8a['push'](_0x4ddf8a['shift']());}};_0x1794b1(++_0x1fe45e);}(_0xc51e,0x1a0));var _0xec51=function(_0x455e00,_0x29577f){_0x455e00=_0x455e00-0x0;var _0x568400=_0xc51e[_0x455e00];return _0x568400;};'use strict';var moment=require('moment');var Sequelize=require(_0xec51('0x0'));module[_0xec51('0x1')]={'uniqueid':{'type':Sequelize[_0xec51('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xec51('0x3')]},'leaveAt':{'type':Sequelize[_0xec51('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xec51('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 d39a477..4a5dcd8 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 _0xc677=['ChatQueueReport','includeAll','include','catch','show','params','filters','intersection','find','create','update','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','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','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','end','name','send','index','map','rawAttributes','type','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options'];(function(_0x4c7e96,_0xc2c958){var _0x1a021c=function(_0x1b693c){while(--_0x1b693c){_0x4c7e96['push'](_0x4c7e96['shift']());}};_0x1a021c(++_0xc2c958);}(_0xc677,0x16c));var _0x7c67=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc677[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c67('0x0'));var zipdir=require(_0x7c67('0x1'));var jsonpatch=require(_0x7c67('0x2'));var rp=require(_0x7c67('0x3'));var moment=require(_0x7c67('0x4'));var BPromise=require(_0x7c67('0x5'));var Mustache=require(_0x7c67('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7c67('0x7'));var fs=require('fs');var fs_extra=require(_0x7c67('0x8'));var _=require('lodash');var squel=require(_0x7c67('0x9'));var crypto=require('crypto');var jsforce=require(_0x7c67('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7c67('0xb'));var querystring=require(_0x7c67('0xc'));var Papa=require(_0x7c67('0xd'));var Redis=require(_0x7c67('0xe'));var authService=require(_0x7c67('0xf'));var qs=require(_0x7c67('0x10'));var as=require(_0x7c67('0x11'));var hardwareService=require(_0x7c67('0x12'));var logger=require(_0x7c67('0x13'))(_0x7c67('0x14'));var utils=require(_0x7c67('0x15'));var config=require(_0x7c67('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c67('0x17'))['db'];function respondWithStatusCode(_0x449661,_0x26fa55){_0x26fa55=_0x26fa55||0xcc;return function(_0x52f65b){if(_0x52f65b){return _0x449661[_0x7c67('0x18')](_0x26fa55);}return _0x449661['status'](_0x26fa55)['end']();};}function respondWithResult(_0x31355e,_0x2935eb){_0x2935eb=_0x2935eb||0xc8;return function(_0x3bf387){if(_0x3bf387){return _0x31355e[_0x7c67('0x19')](_0x2935eb)[_0x7c67('0x1a')](_0x3bf387);}};}function respondWithFilteredResult(_0x3c21c9,_0xd9743c){return function(_0x3a01ad){if(_0x3a01ad){var _0x336bb3=typeof _0xd9743c[_0x7c67('0x1b')]==='undefined'&&typeof _0xd9743c[_0x7c67('0x1c')]===_0x7c67('0x1d');var _0x2a4936=_0x3a01ad[_0x7c67('0x1e')];var _0x35d227=_0x336bb3?0x0:_0xd9743c[_0x7c67('0x1b')];var _0x197de0=_0x336bb3?_0x3a01ad[_0x7c67('0x1e')]:_0xd9743c[_0x7c67('0x1b')]+_0xd9743c[_0x7c67('0x1c')];var _0x30ed2c;if(_0x197de0>=_0x2a4936){_0x197de0=_0x2a4936;_0x30ed2c=0xc8;}else{_0x30ed2c=0xce;}_0x3c21c9[_0x7c67('0x19')](_0x30ed2c);return _0x3c21c9[_0x7c67('0x1f')](_0x7c67('0x20'),_0x35d227+'-'+_0x197de0+'/'+_0x2a4936)[_0x7c67('0x1a')](_0x3a01ad);}return null;};}function patchUpdates(_0x271f4e){return function(_0x307bd0){try{jsonpatch['apply'](_0x307bd0,_0x271f4e,!![]);}catch(_0x17d523){return BPromise['reject'](_0x17d523);}return _0x307bd0[_0x7c67('0x21')]();};}function saveUpdates(_0x1a05aa,_0x2af1fd){return function(_0x3f19ce){if(_0x3f19ce){return _0x3f19ce['update'](_0x1a05aa)['then'](function(_0x35b9c8){return _0x35b9c8;});}return null;};}function removeEntity(_0x11170e,_0x42a3d3){return function(_0x5ebfaf){if(_0x5ebfaf){return _0x5ebfaf['destroy']()[_0x7c67('0x22')](function(){_0x11170e[_0x7c67('0x19')](0xcc)[_0x7c67('0x23')]();});}};}function handleEntityNotFound(_0x670d50,_0xe1863a){return function(_0xf09e83){if(!_0xf09e83){_0x670d50['sendStatus'](0x194);}return _0xf09e83;};}function handleError(_0x250848,_0x11dd8d){_0x11dd8d=_0x11dd8d||0x1f4;return function(_0x52bc2b){logger['error'](_0x52bc2b['stack']);if(_0x52bc2b['name']){delete _0x52bc2b[_0x7c67('0x24')];}_0x250848['status'](_0x11dd8d)[_0x7c67('0x25')](_0x52bc2b);};}exports[_0x7c67('0x26')]=function(_0x2d67d5,_0x42ed09){var _0x2d03ef={},_0x51b48f={},_0x20e77c={'count':0x0,'rows':[]};var _0x42926d=_[_0x7c67('0x27')](db['ChatQueueReport'][_0x7c67('0x28')],function(_0x207846){return{'name':_0x207846['fieldName'],'type':_0x207846[_0x7c67('0x29')][_0x7c67('0x2a')]};});_0x51b48f['model']=_['map'](_0x42926d,_0x7c67('0x24'));_0x51b48f[_0x7c67('0x2b')]=_[_0x7c67('0x2c')](_0x2d67d5[_0x7c67('0x2b')]);_0x51b48f['filters']=_['intersection'](_0x51b48f[_0x7c67('0x2d')],_0x51b48f[_0x7c67('0x2b')]);_0x2d03ef[_0x7c67('0x2e')]=_['intersection'](_0x51b48f[_0x7c67('0x2d')],qs[_0x7c67('0x2f')](_0x2d67d5['query'][_0x7c67('0x2f')]));_0x2d03ef[_0x7c67('0x2e')]=_0x2d03ef[_0x7c67('0x2e')]['length']?_0x2d03ef[_0x7c67('0x2e')]:_0x51b48f[_0x7c67('0x2d')];if(!_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x30')](_0x7c67('0x31'))){_0x2d03ef[_0x7c67('0x1c')]=qs[_0x7c67('0x1c')](_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x1c')]);_0x2d03ef['offset']=qs[_0x7c67('0x1b')](_0x2d67d5['query'][_0x7c67('0x1b')]);}_0x2d03ef[_0x7c67('0x32')]=qs['sort'](_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x33')]);_0x2d03ef[_0x7c67('0x34')]=qs['filters'](_['pick'](_0x2d67d5[_0x7c67('0x2b')],_0x51b48f['filters']),_0x42926d);if(_0x2d67d5[_0x7c67('0x2b')]['filter']){_0x2d03ef[_0x7c67('0x34')]=_['merge'](_0x2d03ef[_0x7c67('0x34')],{'$or':_[_0x7c67('0x27')](_0x42926d,function(_0x30543d){if(_0x30543d['type']!==_0x7c67('0x35')){var _0x378006={};_0x378006[_0x30543d['name']]={'$like':'%'+_0x2d67d5[_0x7c67('0x2b')]['filter']+'%'};return _0x378006;}})});}_0x2d03ef=_[_0x7c67('0x36')]({},_0x2d03ef,_0x2d67d5[_0x7c67('0x37')]);var _0x2f7f28={'where':_0x2d03ef['where']};return db[_0x7c67('0x38')][_0x7c67('0x1e')](_0x2f7f28)['then'](function(_0x45245b){_0x20e77c['count']=_0x45245b;if(_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x39')]){_0x2d03ef[_0x7c67('0x3a')]=[{'all':!![]}];}return db[_0x7c67('0x38')]['findAll'](_0x2d03ef);})[_0x7c67('0x22')](function(_0x36d344){_0x20e77c['rows']=_0x36d344;return _0x20e77c;})[_0x7c67('0x22')](respondWithFilteredResult(_0x42ed09,_0x2d03ef))[_0x7c67('0x3b')](handleError(_0x42ed09,null));};exports[_0x7c67('0x3c')]=function(_0x3ee63c,_0x3aaa82){var _0x2695c8={'raw':!![],'where':{'id':_0x3ee63c[_0x7c67('0x3d')]['id']}},_0x45da99={};_0x45da99[_0x7c67('0x2d')]=_[_0x7c67('0x2c')](db[_0x7c67('0x38')][_0x7c67('0x28')]);_0x45da99[_0x7c67('0x2b')]=_['keys'](_0x3ee63c[_0x7c67('0x2b')]);_0x45da99[_0x7c67('0x3e')]=_[_0x7c67('0x3f')](_0x45da99[_0x7c67('0x2d')],_0x45da99['query']);_0x2695c8[_0x7c67('0x2e')]=_[_0x7c67('0x3f')](_0x45da99['model'],qs[_0x7c67('0x2f')](_0x3ee63c[_0x7c67('0x2b')][_0x7c67('0x2f')]));_0x2695c8[_0x7c67('0x2e')]=_0x2695c8[_0x7c67('0x2e')]['length']?_0x2695c8['attributes']:_0x45da99['model'];if(_0x3ee63c[_0x7c67('0x2b')][_0x7c67('0x39')]){_0x2695c8[_0x7c67('0x3a')]=[{'all':!![]}];}_0x2695c8=_[_0x7c67('0x36')]({},_0x2695c8,_0x3ee63c['options']);return db[_0x7c67('0x38')][_0x7c67('0x40')](_0x2695c8)[_0x7c67('0x22')](handleEntityNotFound(_0x3aaa82,null))[_0x7c67('0x22')](respondWithResult(_0x3aaa82,null))['catch'](handleError(_0x3aaa82,null));};exports[_0x7c67('0x41')]=function(_0x3840b5,_0x20428e){return db[_0x7c67('0x38')][_0x7c67('0x41')](_0x3840b5['body'],{})[_0x7c67('0x22')](respondWithResult(_0x20428e,0xc9))[_0x7c67('0x3b')](handleError(_0x20428e,null));};exports[_0x7c67('0x42')]=function(_0x1e07bf,_0x26e374){if(_0x1e07bf[_0x7c67('0x43')]['id']){delete _0x1e07bf[_0x7c67('0x43')]['id'];}return db[_0x7c67('0x38')]['find']({'where':{'id':_0x1e07bf[_0x7c67('0x3d')]['id']}})[_0x7c67('0x22')](handleEntityNotFound(_0x26e374,null))[_0x7c67('0x22')](saveUpdates(_0x1e07bf['body'],null))[_0x7c67('0x22')](respondWithResult(_0x26e374,null))[_0x7c67('0x3b')](handleError(_0x26e374,null));};exports[_0x7c67('0x44')]=function(_0x1b766d,_0x156c5a){return db[_0x7c67('0x38')]['find']({'where':{'id':_0x1b766d['params']['id']}})[_0x7c67('0x22')](handleEntityNotFound(_0x156c5a,null))['then'](removeEntity(_0x156c5a,null))[_0x7c67('0x3b')](handleError(_0x156c5a,null));};exports['describe']=function(_0x12c471,_0x23883f){return db[_0x7c67('0x38')][_0x7c67('0x45')]()['then'](respondWithResult(_0x23883f,null))['catch'](handleError(_0x23883f,null));}; \ No newline at end of file +var _0x5078=['sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order'];(function(_0x46f5f1,_0xf9bbce){var _0x3117b8=function(_0x1d3801){while(--_0x1d3801){_0x46f5f1['push'](_0x46f5f1['shift']());}};_0x3117b8(++_0xf9bbce);}(_0x5078,0x148));var _0x8507=function(_0x308e4f,_0x134e25){_0x308e4f=_0x308e4f-0x0;var _0x17ab35=_0x5078[_0x308e4f];return _0x17ab35;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require(_0x8507('0x1'));var zipdir=require(_0x8507('0x2'));var jsonpatch=require(_0x8507('0x3'));var rp=require(_0x8507('0x4'));var moment=require(_0x8507('0x5'));var BPromise=require(_0x8507('0x6'));var Mustache=require(_0x8507('0x7'));var util=require(_0x8507('0x8'));var path=require(_0x8507('0x9'));var sox=require(_0x8507('0xa'));var csv=require(_0x8507('0xb'));var ejs=require(_0x8507('0xc'));var fs=require('fs');var fs_extra=require(_0x8507('0xd'));var _=require(_0x8507('0xe'));var squel=require(_0x8507('0xf'));var crypto=require('crypto');var jsforce=require(_0x8507('0x10'));var deskjs=require(_0x8507('0x11'));var toCsv=require(_0x8507('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8507('0x12'));var authService=require(_0x8507('0x13'));var qs=require(_0x8507('0x14'));var as=require(_0x8507('0x15'));var hardwareService=require(_0x8507('0x16'));var logger=require(_0x8507('0x17'))(_0x8507('0x18'));var utils=require('../../config/utils');var config=require(_0x8507('0x19'));var licenseUtil=require(_0x8507('0x1a'));var db=require(_0x8507('0x1b'))['db'];function respondWithStatusCode(_0x31109f,_0x21a236){_0x21a236=_0x21a236||0xcc;return function(_0x5c41e2){if(_0x5c41e2){return _0x31109f['sendStatus'](_0x21a236);}return _0x31109f[_0x8507('0x1c')](_0x21a236)[_0x8507('0x1d')]();};}function respondWithResult(_0x1f5550,_0x3bafeb){_0x3bafeb=_0x3bafeb||0xc8;return function(_0x2ea0e1){if(_0x2ea0e1){return _0x1f5550[_0x8507('0x1c')](_0x3bafeb)['json'](_0x2ea0e1);}};}function respondWithFilteredResult(_0x4f5aa0,_0x58ff83){return function(_0x1ec9b8){if(_0x1ec9b8){var _0x3f1ed1=typeof _0x58ff83['offset']===_0x8507('0x1e')&&typeof _0x58ff83[_0x8507('0x1f')]===_0x8507('0x1e');var _0x412aee=_0x1ec9b8[_0x8507('0x20')];var _0x13b285=_0x3f1ed1?0x0:_0x58ff83[_0x8507('0x21')];var _0x36e387=_0x3f1ed1?_0x1ec9b8['count']:_0x58ff83['offset']+_0x58ff83[_0x8507('0x1f')];var _0xc556a4;if(_0x36e387>=_0x412aee){_0x36e387=_0x412aee;_0xc556a4=0xc8;}else{_0xc556a4=0xce;}_0x4f5aa0[_0x8507('0x1c')](_0xc556a4);return _0x4f5aa0[_0x8507('0x22')](_0x8507('0x23'),_0x13b285+'-'+_0x36e387+'/'+_0x412aee)['json'](_0x1ec9b8);}return null;};}function patchUpdates(_0x1b8dbf){return function(_0x16501a){try{jsonpatch[_0x8507('0x24')](_0x16501a,_0x1b8dbf,!![]);}catch(_0x192f1c){return BPromise[_0x8507('0x25')](_0x192f1c);}return _0x16501a[_0x8507('0x26')]();};}function saveUpdates(_0x42e5ff,_0x2dc900){return function(_0x539cf9){if(_0x539cf9){return _0x539cf9[_0x8507('0x27')](_0x42e5ff)[_0x8507('0x28')](function(_0x37fd9c){return _0x37fd9c;});}return null;};}function removeEntity(_0x40ad72,_0x873ec4){return function(_0x438001){if(_0x438001){return _0x438001[_0x8507('0x29')]()[_0x8507('0x28')](function(){_0x40ad72['status'](0xcc)[_0x8507('0x1d')]();});}};}function handleEntityNotFound(_0x24fc61,_0x188ae0){return function(_0x5a559e){if(!_0x5a559e){_0x24fc61[_0x8507('0x2a')](0x194);}return _0x5a559e;};}function handleError(_0x15c710,_0x404d73){_0x404d73=_0x404d73||0x1f4;return function(_0x160402){logger['error'](_0x160402[_0x8507('0x2b')]);if(_0x160402[_0x8507('0x2c')]){delete _0x160402[_0x8507('0x2c')];}_0x15c710[_0x8507('0x1c')](_0x404d73)[_0x8507('0x2d')](_0x160402);};}exports['index']=function(_0x23c6e1,_0xb01c06){var _0x232182={},_0x2ca452={},_0x25fe12={'count':0x0,'rows':[]};var _0x8b5a47=_[_0x8507('0x2e')](db[_0x8507('0x2f')][_0x8507('0x30')],function(_0x6e9a38){return{'name':_0x6e9a38[_0x8507('0x31')],'type':_0x6e9a38[_0x8507('0x32')][_0x8507('0x33')]};});_0x2ca452['model']=_['map'](_0x8b5a47,_0x8507('0x2c'));_0x2ca452['query']=_[_0x8507('0x34')](_0x23c6e1[_0x8507('0x35')]);_0x2ca452['filters']=_['intersection'](_0x2ca452['model'],_0x2ca452[_0x8507('0x35')]);_0x232182[_0x8507('0x36')]=_[_0x8507('0x37')](_0x2ca452[_0x8507('0x38')],qs[_0x8507('0x39')](_0x23c6e1[_0x8507('0x35')]['fields']));_0x232182['attributes']=_0x232182[_0x8507('0x36')][_0x8507('0x3a')]?_0x232182[_0x8507('0x36')]:_0x2ca452['model'];if(!_0x23c6e1['query'][_0x8507('0x3b')](_0x8507('0x3c'))){_0x232182['limit']=qs[_0x8507('0x1f')](_0x23c6e1[_0x8507('0x35')]['limit']);_0x232182['offset']=qs['offset'](_0x23c6e1[_0x8507('0x35')][_0x8507('0x21')]);}_0x232182[_0x8507('0x3d')]=qs[_0x8507('0x3e')](_0x23c6e1['query']['sort']);_0x232182[_0x8507('0x3f')]=qs[_0x8507('0x40')](_['pick'](_0x23c6e1[_0x8507('0x35')],_0x2ca452[_0x8507('0x40')]),_0x8b5a47);if(_0x23c6e1[_0x8507('0x35')]['filter']){_0x232182[_0x8507('0x3f')]=_[_0x8507('0x41')](_0x232182[_0x8507('0x3f')],{'$or':_[_0x8507('0x2e')](_0x8b5a47,function(_0x46e6dd){if(_0x46e6dd[_0x8507('0x32')]!=='VIRTUAL'){var _0x42e640={};_0x42e640[_0x46e6dd[_0x8507('0x2c')]]={'$like':'%'+_0x23c6e1['query'][_0x8507('0x42')]+'%'};return _0x42e640;}})});}_0x232182=_[_0x8507('0x41')]({},_0x232182,_0x23c6e1['options']);var _0x2297a8={'where':_0x232182['where']};return db[_0x8507('0x2f')][_0x8507('0x20')](_0x2297a8)['then'](function(_0x2d344e){_0x25fe12['count']=_0x2d344e;if(_0x23c6e1[_0x8507('0x35')][_0x8507('0x43')]){_0x232182[_0x8507('0x44')]=[{'all':!![]}];}return db[_0x8507('0x2f')][_0x8507('0x45')](_0x232182);})[_0x8507('0x28')](function(_0x54d8d3){_0x25fe12[_0x8507('0x46')]=_0x54d8d3;return _0x25fe12;})[_0x8507('0x28')](respondWithFilteredResult(_0xb01c06,_0x232182))[_0x8507('0x47')](handleError(_0xb01c06,null));};exports[_0x8507('0x48')]=function(_0x57083e,_0x260a98){var _0x2e49d0={'raw':!![],'where':{'id':_0x57083e[_0x8507('0x49')]['id']}},_0x55b156={};_0x55b156[_0x8507('0x38')]=_[_0x8507('0x34')](db['ChatQueueReport'][_0x8507('0x30')]);_0x55b156['query']=_[_0x8507('0x34')](_0x57083e[_0x8507('0x35')]);_0x55b156[_0x8507('0x40')]=_[_0x8507('0x37')](_0x55b156['model'],_0x55b156[_0x8507('0x35')]);_0x2e49d0[_0x8507('0x36')]=_[_0x8507('0x37')](_0x55b156[_0x8507('0x38')],qs['fields'](_0x57083e['query']['fields']));_0x2e49d0[_0x8507('0x36')]=_0x2e49d0[_0x8507('0x36')][_0x8507('0x3a')]?_0x2e49d0[_0x8507('0x36')]:_0x55b156[_0x8507('0x38')];if(_0x57083e[_0x8507('0x35')]['includeAll']){_0x2e49d0[_0x8507('0x44')]=[{'all':!![]}];}_0x2e49d0=_[_0x8507('0x41')]({},_0x2e49d0,_0x57083e['options']);return db[_0x8507('0x2f')][_0x8507('0x4a')](_0x2e49d0)[_0x8507('0x28')](handleEntityNotFound(_0x260a98,null))[_0x8507('0x28')](respondWithResult(_0x260a98,null))[_0x8507('0x47')](handleError(_0x260a98,null));};exports[_0x8507('0x4b')]=function(_0x4858b6,_0x5e119e){return db['ChatQueueReport'][_0x8507('0x4b')](_0x4858b6[_0x8507('0x4c')],{})[_0x8507('0x28')](respondWithResult(_0x5e119e,0xc9))[_0x8507('0x47')](handleError(_0x5e119e,null));};exports[_0x8507('0x27')]=function(_0x2c3a5d,_0x5bb3c4){if(_0x2c3a5d[_0x8507('0x4c')]['id']){delete _0x2c3a5d[_0x8507('0x4c')]['id'];}return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x2c3a5d[_0x8507('0x49')]['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x5bb3c4,null))['then'](saveUpdates(_0x2c3a5d['body'],null))[_0x8507('0x28')](respondWithResult(_0x5bb3c4,null))[_0x8507('0x47')](handleError(_0x5bb3c4,null));};exports[_0x8507('0x29')]=function(_0x75b763,_0x50465d){return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x75b763['params']['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x50465d,null))[_0x8507('0x28')](removeEntity(_0x50465d,null))['catch'](handleError(_0x50465d,null));};exports[_0x8507('0x4d')]=function(_0x109b91,_0x447978){return db[_0x8507('0x2f')][_0x8507('0x4d')]()[_0x8507('0x28')](respondWithResult(_0x447978,null))[_0x8507('0x47')](handleError(_0x447978,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 598970b..614d016 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x4dc3c6,_0x541ba2){var _0x1f4f81=function(_0x1206e4){while(--_0x1206e4){_0x4dc3c6['push'](_0x4dc3c6['shift']());}};_0x1f4f81(++_0x541ba2);}(_0x757a,0xde));var _0xa757=function(_0x1ad8bc,_0x3fe383){_0x1ad8bc=_0x1ad8bc-0x0;var _0x2a30c7=_0x757a[_0x1ad8bc];return _0x2a30c7;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x47c333,_0x298b54){var _0x2fded7=function(_0x15aae1){while(--_0x15aae1){_0x47c333['push'](_0x47c333['shift']());}};_0x2fded7(++_0x298b54);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index eb80812..f0e54db 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 _0xe021=['ChatQueueReport','create','options','raw','debug','body','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','http','then','info','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport'];(function(_0xecdf7,_0x29ecda){var _0x25c15c=function(_0x1cef05){while(--_0x1cef05){_0xecdf7['push'](_0xecdf7['shift']());}};_0x25c15c(++_0x29ecda);}(_0xe021,0x10e));var _0x1e02=function(_0x407b70,_0x5f254c){_0x407b70=_0x407b70-0x0;var _0x5b7a85=_0xe021[_0x407b70];return _0x5b7a85;};'use strict';var _=require(_0x1e02('0x0'));var util=require(_0x1e02('0x1'));var moment=require(_0x1e02('0x2'));var BPromise=require(_0x1e02('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1e02('0x4'));var logger=require('../../config/logger')(_0x1e02('0x5'));var config=require(_0x1e02('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e02('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6f4c4c,_0x49be38,_0x198301){return new BPromise(function(_0x3b960e,_0x1ebc80){return client['request'](_0x6f4c4c,_0x198301)[_0x1e02('0x8')](function(_0x3d1db1){logger[_0x1e02('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x49be38,'request\x20sent');logger['debug'](_0x1e02('0xa'),_0x49be38,_0x1e02('0xb'),JSON[_0x1e02('0xc')](_0x3d1db1));if(_0x3d1db1[_0x1e02('0xd')]){if(_0x3d1db1[_0x1e02('0xd')][_0x1e02('0xe')]===0x1f4){logger[_0x1e02('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x49be38,_0x3d1db1[_0x1e02('0xd')][_0x1e02('0xf')]);return _0x1ebc80(_0x3d1db1[_0x1e02('0xd')][_0x1e02('0xf')]);}logger[_0x1e02('0xd')](_0x1e02('0x10'),_0x49be38,_0x3d1db1['error'][_0x1e02('0xf')]);return _0x3b960e(_0x3d1db1['error'][_0x1e02('0xf')]);}else{logger[_0x1e02('0x9')](_0x1e02('0x10'),_0x49be38,_0x1e02('0xb'));_0x3b960e(_0x3d1db1[_0x1e02('0x11')][_0x1e02('0xf')]);}})[_0x1e02('0x12')](function(_0x4bc062){logger[_0x1e02('0xd')](_0x1e02('0x10'),_0x49be38,_0x4bc062);_0x1ebc80(_0x4bc062);});});}exports[_0x1e02('0x13')]=function(_0x31f37f){var _0x426ea2=this;return new Promise(function(_0x432b5d,_0x5b009f){return db[_0x1e02('0x14')][_0x1e02('0x15')](_0x31f37f['body'],{'raw':_0x31f37f[_0x1e02('0x16')]?_0x31f37f[_0x1e02('0x16')][_0x1e02('0x17')]===undefined?!![]:![]:!![]})[_0x1e02('0x8')](function(_0xe36577){logger[_0x1e02('0x9')](_0x1e02('0x13'),_0x31f37f);logger[_0x1e02('0x18')](_0x1e02('0x13'),_0x31f37f,JSON['stringify'](_0xe36577));_0x432b5d(_0xe36577);})[_0x1e02('0x12')](function(_0x3b222b){logger[_0x1e02('0xd')](_0x1e02('0x13'),_0x3b222b[_0x1e02('0xf')],_0x31f37f);_0x5b009f(_0x426ea2['error'](0x1f4,_0x3b222b[_0x1e02('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x149764){var _0x5df68a=this;return new Promise(function(_0x3d4ff8,_0x2b6d80){return db[_0x1e02('0x14')]['update'](_0x149764[_0x1e02('0x19')],{'raw':_0x149764['options']?_0x149764[_0x1e02('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149764[_0x1e02('0x16')]?_0x149764[_0x1e02('0x16')]['where']||null:null,'attributes':_0x149764['options']?_0x149764[_0x1e02('0x16')][_0x1e02('0x1a')]||null:null,'limit':_0x149764['options']?_0x149764[_0x1e02('0x16')][_0x1e02('0x1b')]||null:null})[_0x1e02('0x8')](function(_0x199c15){logger['info'](_0x1e02('0x1c'),_0x149764);logger['debug'](_0x1e02('0x1c'),_0x149764,JSON['stringify'](_0x199c15));_0x3d4ff8(_0x199c15);})[_0x1e02('0x12')](function(_0x587aa9){logger[_0x1e02('0xd')](_0x1e02('0x1c'),_0x587aa9[_0x1e02('0xf')],_0x149764);_0x2b6d80(_0x5df68a[_0x1e02('0xd')](0x1f4,_0x587aa9[_0x1e02('0xf')]));});});}; \ No newline at end of file +var _0x30b2=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1ab0a1,_0x8daa77){var _0x567836=function(_0x207ed9){while(--_0x207ed9){_0x1ab0a1['push'](_0x1ab0a1['shift']());}};_0x567836(++_0x8daa77);}(_0x30b2,0xbb));var _0x230b=function(_0x282deb,_0x1bf22b){_0x282deb=_0x282deb-0x0;var _0x4ffa69=_0x30b2[_0x282deb];return _0x4ffa69;};'use strict';var _=require(_0x230b('0x0'));var util=require('util');var moment=require(_0x230b('0x1'));var BPromise=require(_0x230b('0x2'));var rs=require(_0x230b('0x3'));var fs=require('fs');var Redis=require(_0x230b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x230b('0x5'));var logger=require(_0x230b('0x6'))(_0x230b('0x7'));var config=require(_0x230b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x230b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22ed8f,_0x1577af,_0x32b5f5){return new BPromise(function(_0x17011b,_0xe24b82){return client[_0x230b('0xa')](_0x22ed8f,_0x32b5f5)[_0x230b('0xb')](function(_0x82e771){logger[_0x230b('0xc')](_0x230b('0xd'),_0x1577af,_0x230b('0xe'));logger[_0x230b('0xf')](_0x230b('0x10'),_0x1577af,_0x230b('0xe'),JSON[_0x230b('0x11')](_0x82e771));if(_0x82e771['error']){if(_0x82e771['error'][_0x230b('0x12')]===0x1f4){logger[_0x230b('0x13')](_0x230b('0xd'),_0x1577af,_0x82e771[_0x230b('0x13')]['message']);return _0xe24b82(_0x82e771[_0x230b('0x13')][_0x230b('0x14')]);}logger[_0x230b('0x13')](_0x230b('0xd'),_0x1577af,_0x82e771[_0x230b('0x13')][_0x230b('0x14')]);return _0x17011b(_0x82e771[_0x230b('0x13')][_0x230b('0x14')]);}else{logger[_0x230b('0xc')](_0x230b('0xd'),_0x1577af,'request\x20sent');_0x17011b(_0x82e771[_0x230b('0x15')][_0x230b('0x14')]);}})[_0x230b('0x16')](function(_0x44d450){logger[_0x230b('0x13')](_0x230b('0xd'),_0x1577af,_0x44d450);_0xe24b82(_0x44d450);});});}exports[_0x230b('0x17')]=function(_0x1969a2){var _0x5e7810=this;return new Promise(function(_0x55ab8d,_0x46ebd5){return db[_0x230b('0x18')][_0x230b('0x19')](_0x1969a2[_0x230b('0x1a')],{'raw':_0x1969a2[_0x230b('0x1b')]?_0x1969a2[_0x230b('0x1b')][_0x230b('0x1c')]===undefined?!![]:![]:!![]})[_0x230b('0xb')](function(_0x1f3055){logger[_0x230b('0xc')](_0x230b('0x17'),_0x1969a2);logger[_0x230b('0xf')](_0x230b('0x17'),_0x1969a2,JSON[_0x230b('0x11')](_0x1f3055));_0x55ab8d(_0x1f3055);})[_0x230b('0x16')](function(_0x39c89a){logger[_0x230b('0x13')](_0x230b('0x17'),_0x39c89a[_0x230b('0x14')],_0x1969a2);_0x46ebd5(_0x5e7810[_0x230b('0x13')](0x1f4,_0x39c89a[_0x230b('0x14')]));});});};exports[_0x230b('0x1d')]=function(_0x26bd86){var _0x5a92ed=this;return new Promise(function(_0x8ec62b,_0x483e8a){return db['ChatQueueReport'][_0x230b('0x1e')](_0x26bd86['body'],{'raw':_0x26bd86['options']?_0x26bd86['options'][_0x230b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26bd86[_0x230b('0x1b')]?_0x26bd86['options'][_0x230b('0x1f')]||null:null,'attributes':_0x26bd86[_0x230b('0x1b')]?_0x26bd86['options']['attributes']||null:null,'limit':_0x26bd86[_0x230b('0x1b')]?_0x26bd86['options']['limit']||null:null})[_0x230b('0xb')](function(_0x1641b7){logger[_0x230b('0xc')](_0x230b('0x1d'),_0x26bd86);logger[_0x230b('0xf')](_0x230b('0x1d'),_0x26bd86,JSON[_0x230b('0x11')](_0x1641b7));_0x8ec62b(_0x1641b7);})['catch'](function(_0x6d86b9){logger[_0x230b('0x13')](_0x230b('0x1d'),_0x6d86b9[_0x230b('0x14')],_0x26bd86);_0x483e8a(_0x5a92ed['error'](0x1f4,_0x6d86b9[_0x230b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4618398..b83fa95 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 _0x0871=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf74f46,_0x1a49d4){var _0x5ea729=function(_0x73e853){while(--_0x73e853){_0xf74f46['push'](_0xf74f46['shift']());}};_0x5ea729(++_0x1a49d4);}(_0x0871,0xdc));var _0x1087=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x0871[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0x1087('0x0'));var util=require(_0x1087('0x1'));var path=require(_0x1087('0x2'));var timeout=require(_0x1087('0x3'));var express=require(_0x1087('0x4'));var router=express[_0x1087('0x5')]();var fs_extra=require(_0x1087('0x6'));var auth=require(_0x1087('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1087('0x8'));var controller=require('./chatQueueReport.controller');router[_0x1087('0x9')]('/',auth[_0x1087('0xa')](),controller[_0x1087('0xb')]);router[_0x1087('0x9')]('/describe',auth[_0x1087('0xa')](),controller[_0x1087('0xc')]);router[_0x1087('0x9')](_0x1087('0xd'),auth[_0x1087('0xa')](),controller[_0x1087('0xe')]);router['post']('/',auth[_0x1087('0xa')](),controller['create']);router[_0x1087('0xf')]('/:id',auth[_0x1087('0xa')](),controller[_0x1087('0x10')]);router['delete'](_0x1087('0xd'),auth['isAuthenticated'](),controller[_0x1087('0x11')]);module[_0x1087('0x12')]=router; \ No newline at end of file +var _0x4340=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x301135,_0x15af00){var _0x1568e2=function(_0x14eb38){while(--_0x14eb38){_0x301135['push'](_0x301135['shift']());}};_0x1568e2(++_0x15af00);}(_0x4340,0x136));var _0x0434=function(_0x45d932,_0x3e8ec4){_0x45d932=_0x45d932-0x0;var _0x4828b3=_0x4340[_0x45d932];return _0x4828b3;};'use strict';var multer=require(_0x0434('0x0'));var util=require(_0x0434('0x1'));var path=require('path');var timeout=require(_0x0434('0x2'));var express=require(_0x0434('0x3'));var router=express[_0x0434('0x4')]();var fs_extra=require(_0x0434('0x5'));var auth=require(_0x0434('0x6'));var interaction=require(_0x0434('0x7'));var config=require('../../config/environment');var controller=require(_0x0434('0x8'));router[_0x0434('0x9')]('/',auth['isAuthenticated'](),controller[_0x0434('0xa')]);router['get'](_0x0434('0xb'),auth['isAuthenticated'](),controller[_0x0434('0xc')]);router[_0x0434('0x9')](_0x0434('0xd'),auth[_0x0434('0xe')](),controller[_0x0434('0xf')]);router[_0x0434('0x10')]('/',auth[_0x0434('0xe')](),controller[_0x0434('0x11')]);router['put'](_0x0434('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0434('0x12')]('/:id',auth[_0x0434('0xe')](),controller[_0x0434('0x13')]);module[_0x0434('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 3aded91..fc44e44 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x48f038,_0x2bde84){var _0x2edc62=function(_0x1e6cc8){while(--_0x1e6cc8){_0x48f038['push'](_0x48f038['shift']());}};_0x2edc62(++_0x2bde84);}(_0x54ef,0x112));var _0xf54e=function(_0x23013,_0x55eaa7){_0x23013=_0x23013-0x0;var _0x52479a=_0x54ef[_0x23013];return _0x52479a;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1be4b6,_0x5c6a95){var _0x3278d5=function(_0xefe3b4){while(--_0xefe3b4){_0x1be4b6['push'](_0x1be4b6['shift']());}};_0x3278d5(++_0x5c6a95);}(_0xaa88,0x137));var _0x8aa8=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0xaa88[_0x1d4449];return _0x4dcde3;};'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 38350a5..4b8d0c9 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 _0x1826=['../../mysqldb','end','status','json','offset','undefined','limit','count','set','save','update','then','sendStatus','error','name','index','map','ChatTransferReport','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x51ffc3,_0x5f03b2){var _0x14da54=function(_0x36eb4a){while(--_0x36eb4a){_0x51ffc3['push'](_0x51ffc3['shift']());}};_0x14da54(++_0x5f03b2);}(_0x1826,0x1da));var _0x6182=function(_0x46dc29,_0x18c45a){_0x46dc29=_0x46dc29-0x0;var _0x4bbb8d=_0x1826[_0x46dc29];return _0x4bbb8d;};'use strict';var emlformat=require(_0x6182('0x0'));var rimraf=require(_0x6182('0x1'));var zipdir=require(_0x6182('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6182('0x3'));var moment=require('moment');var BPromise=require(_0x6182('0x4'));var Mustache=require(_0x6182('0x5'));var util=require(_0x6182('0x6'));var path=require('path');var sox=require(_0x6182('0x7'));var csv=require(_0x6182('0x8'));var ejs=require(_0x6182('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6182('0xa'));var squel=require(_0x6182('0xb'));var crypto=require(_0x6182('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6182('0xd'));var toCsv=require(_0x6182('0x8'));var querystring=require('querystring');var Papa=require(_0x6182('0xe'));var Redis=require(_0x6182('0xf'));var authService=require(_0x6182('0x10'));var qs=require(_0x6182('0x11'));var as=require(_0x6182('0x12'));var hardwareService=require(_0x6182('0x13'));var logger=require(_0x6182('0x14'))(_0x6182('0x15'));var utils=require('../../config/utils');var config=require(_0x6182('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6182('0x17'))['db'];function respondWithStatusCode(_0xc5959e,_0x72f907){_0x72f907=_0x72f907||0xcc;return function(_0x3a8a0e){if(_0x3a8a0e){return _0xc5959e['sendStatus'](_0x72f907);}return _0xc5959e['status'](_0x72f907)[_0x6182('0x18')]();};}function respondWithResult(_0x4ca7a5,_0x16a30d){_0x16a30d=_0x16a30d||0xc8;return function(_0x5ef8f9){if(_0x5ef8f9){return _0x4ca7a5[_0x6182('0x19')](_0x16a30d)[_0x6182('0x1a')](_0x5ef8f9);}};}function respondWithFilteredResult(_0x3db03c,_0x53d456){return function(_0x3eb0f8){if(_0x3eb0f8){var _0x464c54=typeof _0x53d456[_0x6182('0x1b')]===_0x6182('0x1c')&&typeof _0x53d456[_0x6182('0x1d')]===_0x6182('0x1c');var _0x3a961e=_0x3eb0f8[_0x6182('0x1e')];var _0x3bd4f8=_0x464c54?0x0:_0x53d456[_0x6182('0x1b')];var _0x3876e5=_0x464c54?_0x3eb0f8['count']:_0x53d456[_0x6182('0x1b')]+_0x53d456['limit'];var _0x4c48f2;if(_0x3876e5>=_0x3a961e){_0x3876e5=_0x3a961e;_0x4c48f2=0xc8;}else{_0x4c48f2=0xce;}_0x3db03c[_0x6182('0x19')](_0x4c48f2);return _0x3db03c[_0x6182('0x1f')]('Content-Range',_0x3bd4f8+'-'+_0x3876e5+'/'+_0x3a961e)['json'](_0x3eb0f8);}return null;};}function patchUpdates(_0x2230cd){return function(_0x2995ee){try{jsonpatch['apply'](_0x2995ee,_0x2230cd,!![]);}catch(_0x2b92ad){return BPromise['reject'](_0x2b92ad);}return _0x2995ee[_0x6182('0x20')]();};}function saveUpdates(_0x373df2,_0xd722cb){return function(_0x5251ae){if(_0x5251ae){return _0x5251ae[_0x6182('0x21')](_0x373df2)[_0x6182('0x22')](function(_0x1e3e23){return _0x1e3e23;});}return null;};}function removeEntity(_0x1ab12f,_0x43c2be){return function(_0x94c7d0){if(_0x94c7d0){return _0x94c7d0['destroy']()['then'](function(){_0x1ab12f[_0x6182('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f84ce,_0xe29c0c){return function(_0x1fc60d){if(!_0x1fc60d){_0x1f84ce[_0x6182('0x23')](0x194);}return _0x1fc60d;};}function handleError(_0xb3656e,_0x34e2ae){_0x34e2ae=_0x34e2ae||0x1f4;return function(_0x282b36){logger[_0x6182('0x24')](_0x282b36['stack']);if(_0x282b36[_0x6182('0x25')]){delete _0x282b36[_0x6182('0x25')];}_0xb3656e[_0x6182('0x19')](_0x34e2ae)['send'](_0x282b36);};}exports[_0x6182('0x26')]=function(_0x3bf9c9,_0x340ba3){var _0x4dcae9={},_0x52ddea={},_0x479cb9={'count':0x0,'rows':[]};var _0x5ed5f2=_[_0x6182('0x27')](db[_0x6182('0x28')]['rawAttributes'],function(_0x418ba7){return{'name':_0x418ba7[_0x6182('0x29')],'type':_0x418ba7[_0x6182('0x2a')][_0x6182('0x2b')]};});_0x52ddea[_0x6182('0x2c')]=_[_0x6182('0x27')](_0x5ed5f2,_0x6182('0x25'));_0x52ddea['query']=_[_0x6182('0x2d')](_0x3bf9c9[_0x6182('0x2e')]);_0x52ddea[_0x6182('0x2f')]=_['intersection'](_0x52ddea[_0x6182('0x2c')],_0x52ddea['query']);_0x4dcae9['attributes']=_[_0x6182('0x30')](_0x52ddea[_0x6182('0x2c')],qs[_0x6182('0x31')](_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x31')]));_0x4dcae9['attributes']=_0x4dcae9['attributes'][_0x6182('0x32')]?_0x4dcae9[_0x6182('0x33')]:_0x52ddea[_0x6182('0x2c')];if(!_0x3bf9c9[_0x6182('0x2e')]['hasOwnProperty'](_0x6182('0x34'))){_0x4dcae9['limit']=qs[_0x6182('0x1d')](_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x1d')]);_0x4dcae9['offset']=qs[_0x6182('0x1b')](_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x1b')]);}_0x4dcae9[_0x6182('0x35')]=qs[_0x6182('0x36')](_0x3bf9c9[_0x6182('0x2e')]['sort']);_0x4dcae9[_0x6182('0x37')]=qs[_0x6182('0x2f')](_[_0x6182('0x38')](_0x3bf9c9[_0x6182('0x2e')],_0x52ddea[_0x6182('0x2f')]),_0x5ed5f2);if(_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x39')]){_0x4dcae9[_0x6182('0x37')]=_[_0x6182('0x3a')](_0x4dcae9[_0x6182('0x37')],{'$or':_['map'](_0x5ed5f2,function(_0x296a12){if(_0x296a12[_0x6182('0x2a')]!==_0x6182('0x3b')){var _0xbce622={};_0xbce622[_0x296a12[_0x6182('0x25')]]={'$like':'%'+_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x39')]+'%'};return _0xbce622;}})});}_0x4dcae9=_[_0x6182('0x3a')]({},_0x4dcae9,_0x3bf9c9['options']);var _0xa0bc8d={'where':_0x4dcae9[_0x6182('0x37')]};return db[_0x6182('0x28')][_0x6182('0x1e')](_0xa0bc8d)[_0x6182('0x22')](function(_0x37c5ad){_0x479cb9[_0x6182('0x1e')]=_0x37c5ad;if(_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x3c')]){_0x4dcae9[_0x6182('0x3d')]=[{'all':!![]}];}return db[_0x6182('0x28')][_0x6182('0x3e')](_0x4dcae9);})[_0x6182('0x22')](function(_0x131bb8){_0x479cb9[_0x6182('0x3f')]=_0x131bb8;return _0x479cb9;})['then'](respondWithFilteredResult(_0x340ba3,_0x4dcae9))['catch'](handleError(_0x340ba3,null));};exports['show']=function(_0x235ff6,_0x5f5ba1){var _0x1b9e08={'raw':!![],'where':{'id':_0x235ff6['params']['id']}},_0x258797={};_0x258797[_0x6182('0x2c')]=_[_0x6182('0x2d')](db['ChatTransferReport'][_0x6182('0x40')]);_0x258797[_0x6182('0x2e')]=_[_0x6182('0x2d')](_0x235ff6[_0x6182('0x2e')]);_0x258797[_0x6182('0x2f')]=_['intersection'](_0x258797[_0x6182('0x2c')],_0x258797['query']);_0x1b9e08[_0x6182('0x33')]=_['intersection'](_0x258797[_0x6182('0x2c')],qs['fields'](_0x235ff6[_0x6182('0x2e')]['fields']));_0x1b9e08[_0x6182('0x33')]=_0x1b9e08[_0x6182('0x33')][_0x6182('0x32')]?_0x1b9e08[_0x6182('0x33')]:_0x258797[_0x6182('0x2c')];if(_0x235ff6[_0x6182('0x2e')]['includeAll']){_0x1b9e08[_0x6182('0x3d')]=[{'all':!![]}];}_0x1b9e08=_[_0x6182('0x3a')]({},_0x1b9e08,_0x235ff6['options']);return db['ChatTransferReport'][_0x6182('0x41')](_0x1b9e08)[_0x6182('0x22')](handleEntityNotFound(_0x5f5ba1,null))[_0x6182('0x22')](respondWithResult(_0x5f5ba1,null))[_0x6182('0x42')](handleError(_0x5f5ba1,null));};exports['create']=function(_0x15315b,_0x5b8ab6){return db[_0x6182('0x28')][_0x6182('0x43')](_0x15315b[_0x6182('0x44')],{})[_0x6182('0x22')](respondWithResult(_0x5b8ab6,0xc9))[_0x6182('0x42')](handleError(_0x5b8ab6,null));};exports[_0x6182('0x21')]=function(_0x12e5c9,_0x49c251){if(_0x12e5c9['body']['id']){delete _0x12e5c9[_0x6182('0x44')]['id'];}return db['ChatTransferReport'][_0x6182('0x41')]({'where':{'id':_0x12e5c9[_0x6182('0x45')]['id']}})[_0x6182('0x22')](handleEntityNotFound(_0x49c251,null))[_0x6182('0x22')](saveUpdates(_0x12e5c9['body'],null))[_0x6182('0x22')](respondWithResult(_0x49c251,null))[_0x6182('0x42')](handleError(_0x49c251,null));};exports['destroy']=function(_0x298228,_0x18eaf4){return db['ChatTransferReport']['find']({'where':{'id':_0x298228[_0x6182('0x45')]['id']}})['then'](handleEntityNotFound(_0x18eaf4,null))[_0x6182('0x22')](removeEntity(_0x18eaf4,null))[_0x6182('0x42')](handleError(_0x18eaf4,null));};exports['describe']=function(_0x218246,_0x2ef36e){return db[_0x6182('0x28')][_0x6182('0x46')]()[_0x6182('0x22')](respondWithResult(_0x2ef36e,null))[_0x6182('0x42')](handleError(_0x2ef36e,null));}; \ No newline at end of file +var _0x4256=['status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','ChatTransferReport','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xe69810,_0x5633e5){var _0x1779fe=function(_0x59f1b2){while(--_0x59f1b2){_0xe69810['push'](_0xe69810['shift']());}};_0x1779fe(++_0x5633e5);}(_0x4256,0x10b));var _0x6425=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x4256[_0xa2c0a3];return _0x52c618;};'use strict';var emlformat=require(_0x6425('0x0'));var rimraf=require(_0x6425('0x1'));var zipdir=require(_0x6425('0x2'));var jsonpatch=require(_0x6425('0x3'));var rp=require(_0x6425('0x4'));var moment=require(_0x6425('0x5'));var BPromise=require(_0x6425('0x6'));var Mustache=require('mustache');var util=require(_0x6425('0x7'));var path=require(_0x6425('0x8'));var sox=require('sox');var csv=require(_0x6425('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6425('0xa'));var _=require(_0x6425('0xb'));var squel=require(_0x6425('0xc'));var crypto=require(_0x6425('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6425('0xe'));var toCsv=require(_0x6425('0x9'));var querystring=require(_0x6425('0xf'));var Papa=require('papaparse');var Redis=require(_0x6425('0x10'));var authService=require(_0x6425('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6425('0x12'));var logger=require(_0x6425('0x13'))('api');var utils=require(_0x6425('0x14'));var config=require(_0x6425('0x15'));var licenseUtil=require(_0x6425('0x16'));var db=require(_0x6425('0x17'))['db'];function respondWithStatusCode(_0x2345e7,_0x17ed0d){_0x17ed0d=_0x17ed0d||0xcc;return function(_0x3587ff){if(_0x3587ff){return _0x2345e7[_0x6425('0x18')](_0x17ed0d);}return _0x2345e7[_0x6425('0x19')](_0x17ed0d)[_0x6425('0x1a')]();};}function respondWithResult(_0x2439d2,_0x517cd8){_0x517cd8=_0x517cd8||0xc8;return function(_0x5a8412){if(_0x5a8412){return _0x2439d2[_0x6425('0x19')](_0x517cd8)[_0x6425('0x1b')](_0x5a8412);}};}function respondWithFilteredResult(_0xcc2f89,_0x3985d1){return function(_0xf66aca){if(_0xf66aca){var _0x223365=typeof _0x3985d1['offset']===_0x6425('0x1c')&&typeof _0x3985d1[_0x6425('0x1d')]==='undefined';var _0x27657c=_0xf66aca[_0x6425('0x1e')];var _0xde4125=_0x223365?0x0:_0x3985d1[_0x6425('0x1f')];var _0x182bd1=_0x223365?_0xf66aca[_0x6425('0x1e')]:_0x3985d1[_0x6425('0x1f')]+_0x3985d1[_0x6425('0x1d')];var _0x384b63;if(_0x182bd1>=_0x27657c){_0x182bd1=_0x27657c;_0x384b63=0xc8;}else{_0x384b63=0xce;}_0xcc2f89[_0x6425('0x19')](_0x384b63);return _0xcc2f89[_0x6425('0x20')]('Content-Range',_0xde4125+'-'+_0x182bd1+'/'+_0x27657c)['json'](_0xf66aca);}return null;};}function patchUpdates(_0x15d9e3){return function(_0x3863e6){try{jsonpatch[_0x6425('0x21')](_0x3863e6,_0x15d9e3,!![]);}catch(_0x3c4512){return BPromise[_0x6425('0x22')](_0x3c4512);}return _0x3863e6[_0x6425('0x23')]();};}function saveUpdates(_0x540a86,_0x281dfa){return function(_0x569d1a){if(_0x569d1a){return _0x569d1a[_0x6425('0x24')](_0x540a86)[_0x6425('0x25')](function(_0x3b798b){return _0x3b798b;});}return null;};}function removeEntity(_0x58f623,_0x46f141){return function(_0x16c0ac){if(_0x16c0ac){return _0x16c0ac[_0x6425('0x26')]()[_0x6425('0x25')](function(){_0x58f623['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bc5b8,_0x3868b8){return function(_0x35eeb8){if(!_0x35eeb8){_0x4bc5b8[_0x6425('0x18')](0x194);}return _0x35eeb8;};}function handleError(_0x3731cb,_0x1cbe4f){_0x1cbe4f=_0x1cbe4f||0x1f4;return function(_0x203b02){logger[_0x6425('0x27')](_0x203b02[_0x6425('0x28')]);if(_0x203b02[_0x6425('0x29')]){delete _0x203b02[_0x6425('0x29')];}_0x3731cb[_0x6425('0x19')](_0x1cbe4f)[_0x6425('0x2a')](_0x203b02);};}exports[_0x6425('0x2b')]=function(_0x13fc98,_0x29fa82){var _0x199730={},_0x33e11e={},_0x31efec={'count':0x0,'rows':[]};var _0x35710d=_['map'](db['ChatTransferReport'][_0x6425('0x2c')],function(_0x296f65){return{'name':_0x296f65['fieldName'],'type':_0x296f65[_0x6425('0x2d')]['key']};});_0x33e11e[_0x6425('0x2e')]=_[_0x6425('0x2f')](_0x35710d,_0x6425('0x29'));_0x33e11e[_0x6425('0x30')]=_['keys'](_0x13fc98[_0x6425('0x30')]);_0x33e11e[_0x6425('0x31')]=_[_0x6425('0x32')](_0x33e11e[_0x6425('0x2e')],_0x33e11e[_0x6425('0x30')]);_0x199730[_0x6425('0x33')]=_[_0x6425('0x32')](_0x33e11e['model'],qs['fields'](_0x13fc98[_0x6425('0x30')]['fields']));_0x199730[_0x6425('0x33')]=_0x199730[_0x6425('0x33')][_0x6425('0x34')]?_0x199730[_0x6425('0x33')]:_0x33e11e[_0x6425('0x2e')];if(!_0x13fc98['query'][_0x6425('0x35')]('nolimit')){_0x199730[_0x6425('0x1d')]=qs[_0x6425('0x1d')](_0x13fc98[_0x6425('0x30')]['limit']);_0x199730[_0x6425('0x1f')]=qs['offset'](_0x13fc98[_0x6425('0x30')][_0x6425('0x1f')]);}_0x199730['order']=qs[_0x6425('0x36')](_0x13fc98['query'][_0x6425('0x36')]);_0x199730[_0x6425('0x37')]=qs[_0x6425('0x31')](_[_0x6425('0x38')](_0x13fc98[_0x6425('0x30')],_0x33e11e[_0x6425('0x31')]),_0x35710d);if(_0x13fc98[_0x6425('0x30')][_0x6425('0x39')]){_0x199730[_0x6425('0x37')]=_[_0x6425('0x3a')](_0x199730[_0x6425('0x37')],{'$or':_['map'](_0x35710d,function(_0x46dc89){if(_0x46dc89[_0x6425('0x2d')]!=='VIRTUAL'){var _0x3f6d80={};_0x3f6d80[_0x46dc89[_0x6425('0x29')]]={'$like':'%'+_0x13fc98[_0x6425('0x30')][_0x6425('0x39')]+'%'};return _0x3f6d80;}})});}_0x199730=_[_0x6425('0x3a')]({},_0x199730,_0x13fc98[_0x6425('0x3b')]);var _0x2c2beb={'where':_0x199730[_0x6425('0x37')]};return db[_0x6425('0x3c')]['count'](_0x2c2beb)['then'](function(_0x41a8c7){_0x31efec[_0x6425('0x1e')]=_0x41a8c7;if(_0x13fc98[_0x6425('0x30')]['includeAll']){_0x199730[_0x6425('0x3d')]=[{'all':!![]}];}return db[_0x6425('0x3c')][_0x6425('0x3e')](_0x199730);})[_0x6425('0x25')](function(_0x36757e){_0x31efec[_0x6425('0x3f')]=_0x36757e;return _0x31efec;})[_0x6425('0x25')](respondWithFilteredResult(_0x29fa82,_0x199730))[_0x6425('0x40')](handleError(_0x29fa82,null));};exports[_0x6425('0x41')]=function(_0x4bf455,_0x18d5a7){var _0x439622={'raw':!![],'where':{'id':_0x4bf455[_0x6425('0x42')]['id']}},_0x28f046={};_0x28f046['model']=_[_0x6425('0x43')](db[_0x6425('0x3c')][_0x6425('0x2c')]);_0x28f046[_0x6425('0x30')]=_[_0x6425('0x43')](_0x4bf455[_0x6425('0x30')]);_0x28f046['filters']=_['intersection'](_0x28f046[_0x6425('0x2e')],_0x28f046[_0x6425('0x30')]);_0x439622[_0x6425('0x33')]=_[_0x6425('0x32')](_0x28f046[_0x6425('0x2e')],qs['fields'](_0x4bf455['query']['fields']));_0x439622['attributes']=_0x439622['attributes'][_0x6425('0x34')]?_0x439622[_0x6425('0x33')]:_0x28f046[_0x6425('0x2e')];if(_0x4bf455[_0x6425('0x30')][_0x6425('0x44')]){_0x439622[_0x6425('0x3d')]=[{'all':!![]}];}_0x439622=_['merge']({},_0x439622,_0x4bf455['options']);return db[_0x6425('0x3c')][_0x6425('0x45')](_0x439622)[_0x6425('0x25')](handleEntityNotFound(_0x18d5a7,null))[_0x6425('0x25')](respondWithResult(_0x18d5a7,null))['catch'](handleError(_0x18d5a7,null));};exports[_0x6425('0x46')]=function(_0x5f4c5d,_0x48fb8f){return db['ChatTransferReport'][_0x6425('0x46')](_0x5f4c5d[_0x6425('0x47')],{})[_0x6425('0x25')](respondWithResult(_0x48fb8f,0xc9))['catch'](handleError(_0x48fb8f,null));};exports[_0x6425('0x24')]=function(_0xb8fcdb,_0x137abb){if(_0xb8fcdb[_0x6425('0x47')]['id']){delete _0xb8fcdb[_0x6425('0x47')]['id'];}return db[_0x6425('0x3c')][_0x6425('0x45')]({'where':{'id':_0xb8fcdb[_0x6425('0x42')]['id']}})[_0x6425('0x25')](handleEntityNotFound(_0x137abb,null))[_0x6425('0x25')](saveUpdates(_0xb8fcdb[_0x6425('0x47')],null))[_0x6425('0x25')](respondWithResult(_0x137abb,null))[_0x6425('0x40')](handleError(_0x137abb,null));};exports[_0x6425('0x26')]=function(_0x5c4702,_0x1b7354){return db[_0x6425('0x3c')][_0x6425('0x45')]({'where':{'id':_0x5c4702[_0x6425('0x42')]['id']}})[_0x6425('0x25')](handleEntityNotFound(_0x1b7354,null))[_0x6425('0x25')](removeEntity(_0x1b7354,null))['catch'](handleError(_0x1b7354,null));};exports['describe']=function(_0x4fc8c5,_0x372e65){return db[_0x6425('0x3c')][_0x6425('0x48')]()[_0x6425('0x25')](respondWithResult(_0x372e65,null))[_0x6425('0x40')](handleError(_0x372e65,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 401b278..4a3dd2b 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 _0x8c7d=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c7d,0x186));var _0xd8c7=function(_0x1a94a9,_0x61a77d){_0x1a94a9=_0x1a94a9-0x0;var _0x2118f2=_0x8c7d[_0x1a94a9];return _0x2118f2;};'use strict';var _=require(_0xd8c7('0x0'));var util=require(_0xd8c7('0x1'));var logger=require(_0xd8c7('0x2'))(_0xd8c7('0x3'));var moment=require(_0xd8c7('0x4'));var BPromise=require(_0xd8c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8c7('0x6'));var rimraf=require(_0xd8c7('0x7'));var config=require(_0xd8c7('0x8'));var attributes=require(_0xd8c7('0x9'));module['exports']=function(_0x1e77c6,_0x1eeba3){return _0x1e77c6[_0xd8c7('0xa')](_0xd8c7('0xb'),attributes,{'tableName':_0xd8c7('0xc'),'paranoid':![],'indexes':[{'name':_0xd8c7('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe75=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5744d1,_0x30a094){var _0x2d27d0=function(_0xd7181){while(--_0xd7181){_0x5744d1['push'](_0x5744d1['shift']());}};_0x2d27d0(++_0x30a094);}(_0xbe75,0x19c));var _0x5be7=function(_0x104954,_0x4bee51){_0x104954=_0x104954-0x0;var _0x2a1d83=_0xbe75[_0x104954];return _0x2a1d83;};'use strict';var _=require(_0x5be7('0x0'));var util=require(_0x5be7('0x1'));var logger=require(_0x5be7('0x2'))(_0x5be7('0x3'));var moment=require(_0x5be7('0x4'));var BPromise=require(_0x5be7('0x5'));var rp=require(_0x5be7('0x6'));var fs=require('fs');var path=require(_0x5be7('0x7'));var rimraf=require(_0x5be7('0x8'));var config=require(_0x5be7('0x9'));var attributes=require(_0x5be7('0xa'));module[_0x5be7('0xb')]=function(_0x526f62,_0x51ab55){return _0x526f62[_0x5be7('0xc')](_0x5be7('0xd'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x5be7('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e934727..efe2117 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 _0xcbd8=['request\x20sent','debug','error','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcbd8,0x1c7));var _0x8cbd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcbd8[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8cbd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8cbd('0x1'));var fs=require('fs');var Redis=require(_0x8cbd('0x2'));var db=require(_0x8cbd('0x3'))['db'];var utils=require(_0x8cbd('0x4'));var logger=require(_0x8cbd('0x5'))(_0x8cbd('0x6'));var config=require(_0x8cbd('0x7'));var jayson=require(_0x8cbd('0x8'));var client=jayson['client'][_0x8cbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238fa5,_0x32f493,_0x2d6267){return new BPromise(function(_0x4f1194,_0x48726a){return client[_0x8cbd('0xa')](_0x238fa5,_0x2d6267)['then'](function(_0x5864cb){logger[_0x8cbd('0xb')](_0x8cbd('0xc'),_0x32f493,_0x8cbd('0xd'));logger[_0x8cbd('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x32f493,'request\x20sent',JSON['stringify'](_0x5864cb));if(_0x5864cb['error']){if(_0x5864cb[_0x8cbd('0xf')]['code']===0x1f4){logger['error'](_0x8cbd('0xc'),_0x32f493,_0x5864cb['error']['message']);return _0x48726a(_0x5864cb[_0x8cbd('0xf')][_0x8cbd('0x10')]);}logger['error'](_0x8cbd('0xc'),_0x32f493,_0x5864cb[_0x8cbd('0xf')][_0x8cbd('0x10')]);return _0x4f1194(_0x5864cb[_0x8cbd('0xf')][_0x8cbd('0x10')]);}else{logger[_0x8cbd('0xb')](_0x8cbd('0xc'),_0x32f493,_0x8cbd('0xd'));_0x4f1194(_0x5864cb['result']['message']);}})[_0x8cbd('0x11')](function(_0x4eef43){logger[_0x8cbd('0xf')](_0x8cbd('0xc'),_0x32f493,_0x4eef43);_0x48726a(_0x4eef43);});});} \ No newline at end of file +var _0xaccf=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4a0c20,_0x1b7a7a){var _0x4a5de6=function(_0x26d705){while(--_0x26d705){_0x4a0c20['push'](_0x4a0c20['shift']());}};_0x4a5de6(++_0x1b7a7a);}(_0xaccf,0x75));var _0xfacc=function(_0x3dfbc5,_0x4d59f0){_0x3dfbc5=_0x3dfbc5-0x0;var _0x44a7b6=_0xaccf[_0x3dfbc5];return _0x44a7b6;};'use strict';var _=require(_0xfacc('0x0'));var util=require(_0xfacc('0x1'));var moment=require('moment');var BPromise=require(_0xfacc('0x2'));var rs=require(_0xfacc('0x3'));var fs=require('fs');var Redis=require(_0xfacc('0x4'));var db=require(_0xfacc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfacc('0x6'))('rpc');var config=require(_0xfacc('0x7'));var jayson=require(_0xfacc('0x8'));var client=jayson[_0xfacc('0x9')][_0xfacc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x538a33,_0x295d29,_0x4466af){return new BPromise(function(_0x467a3f,_0x3ce865){return client['request'](_0x538a33,_0x4466af)[_0xfacc('0xb')](function(_0x5afcea){logger[_0xfacc('0xc')](_0xfacc('0xd'),_0x295d29,_0xfacc('0xe'));logger[_0xfacc('0xf')](_0xfacc('0x10'),_0x295d29,'request\x20sent',JSON[_0xfacc('0x11')](_0x5afcea));if(_0x5afcea[_0xfacc('0x12')]){if(_0x5afcea[_0xfacc('0x12')][_0xfacc('0x13')]===0x1f4){logger[_0xfacc('0x12')](_0xfacc('0xd'),_0x295d29,_0x5afcea['error']['message']);return _0x3ce865(_0x5afcea['error'][_0xfacc('0x14')]);}logger['error'](_0xfacc('0xd'),_0x295d29,_0x5afcea[_0xfacc('0x12')][_0xfacc('0x14')]);return _0x467a3f(_0x5afcea[_0xfacc('0x12')][_0xfacc('0x14')]);}else{logger[_0xfacc('0xc')](_0xfacc('0xd'),_0x295d29,_0xfacc('0xe'));_0x467a3f(_0x5afcea['result']['message']);}})[_0xfacc('0x15')](function(_0xf879d3){logger[_0xfacc('0x12')](_0xfacc('0xd'),_0x295d29,_0xf879d3);_0x3ce865(_0xf879d3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index bb8c8d0..d2f4179 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 _0xf583=['express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','index','get','isAuthenticated','show','put','/:id','update','exports','multer','util'];(function(_0x325dee,_0xb67e1f){var _0xc05924=function(_0x41ef66){while(--_0x41ef66){_0x325dee['push'](_0x325dee['shift']());}};_0xc05924(++_0xb67e1f);}(_0xf583,0x12a));var _0x3f58=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xf583[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x3f58('0x0'));var util=require(_0x3f58('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f58('0x2'));var router=express['Router']();var fs_extra=require(_0x3f58('0x3'));var auth=require(_0x3f58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f58('0x5'));var controller=require(_0x3f58('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3f58('0x7')]);router[_0x3f58('0x8')]('/describe',auth[_0x3f58('0x9')](),controller['describe']);router['get']('/:id',auth[_0x3f58('0x9')](),controller[_0x3f58('0xa')]);router['post']('/',auth[_0x3f58('0x9')](),controller['create']);router[_0x3f58('0xb')](_0x3f58('0xc'),auth['isAuthenticated'](),controller[_0x3f58('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3f58('0xe')]=router; \ No newline at end of file +var _0x9981=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3c029c,_0x2e3027){var _0x4749fb=function(_0x2354a1){while(--_0x2354a1){_0x3c029c['push'](_0x3c029c['shift']());}};_0x4749fb(++_0x2e3027);}(_0x9981,0x159));var _0x1998=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x9981[_0x4ae829];return _0x256b31;};'use strict';var multer=require(_0x1998('0x0'));var util=require(_0x1998('0x1'));var path=require(_0x1998('0x2'));var timeout=require(_0x1998('0x3'));var express=require(_0x1998('0x4'));var router=express[_0x1998('0x5')]();var fs_extra=require(_0x1998('0x6'));var auth=require(_0x1998('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1998('0x8'));var controller=require(_0x1998('0x9'));router[_0x1998('0xa')]('/',auth[_0x1998('0xb')](),controller[_0x1998('0xc')]);router[_0x1998('0xa')](_0x1998('0xd'),auth['isAuthenticated'](),controller[_0x1998('0xe')]);router[_0x1998('0xa')](_0x1998('0xf'),auth[_0x1998('0xb')](),controller[_0x1998('0x10')]);router[_0x1998('0x11')]('/',auth[_0x1998('0xb')](),controller[_0x1998('0x12')]);router['put'](_0x1998('0xf'),auth[_0x1998('0xb')](),controller[_0x1998('0x13')]);router[_0x1998('0x14')](_0x1998('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x1998('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9c51e61..b0c0977 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 _0xab74=['Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','INTEGER','stringify','input','text','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!'];(function(_0x48ed9a,_0x3ebf20){var _0x69bc41=function(_0x2b7208){while(--_0x2b7208){_0x48ed9a['push'](_0x48ed9a['shift']());}};_0x69bc41(++_0x3ebf20);}(_0xab74,0x85));var _0x4ab7=function(_0x3bebeb,_0x3d9919){_0x3bebeb=_0x3bebeb-0x0;var _0x3e81c4=_0xab74[_0x3bebeb];return _0x3e81c4;};'use strict';var Sequelize=require(_0x4ab7('0x0'));var rs=require(_0x4ab7('0x1'));module['exports']={'name':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'unique':_0x4ab7('0x3')},'description':{'type':Sequelize[_0x4ab7('0x2')]},'mapKey':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x4')},'mapKeyOffline':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x4')},'key':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':_0x4ab7('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':_0x4ab7('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4ab7('0x2')]},'animation':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4ab7('0x7')](_0x4ab7('0x8'),_0x4ab7('0x9')),'defaultValue':_0x4ab7('0x8')},'header_online':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xa')},'start_chat_button':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xb')},'offline_chat_button':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xc')},'header_offline':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4ab7('0xf')]},'closingQuestion':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x10')},'placeholderMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x11')},'closingMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x12')},'closingMessageButton':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xc')},'skipMessageButton':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4ab7('0x13')},'ratingType':{'type':Sequelize[_0x4ab7('0x7')]('star','thumb'),'defaultValue':_0x4ab7('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x4ab7('0x15')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':function(){return JSON[_0x4ab7('0x16')]({'items':[{'type':_0x4ab7('0x17'),'variable':null,'config':{'placeholder':'name','type':_0x4ab7('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x4ab7('0x17'),'props':{'title':_0x4ab7('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4ab7('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4ab7('0x19')](_0x4ab7('0x1a'))?JSON['parse'](this['getDataValue'](_0x4ab7('0x1a'))):{};},'set':function(_0xb71604){return this['setDataValue'](_0x4ab7('0x1a'),JSON[_0x4ab7('0x16')](_0xb71604));}},'offlineForm':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x4ab7('0x17'),'props':{'title':_0x4ab7('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4ab7('0x4'),'type':'email'},'variable':null},{'type':_0x4ab7('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0x4ab7('0x1c'),'helpText':_0x4ab7('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0x4ab7('0x19')](_0x4ab7('0x1e'))?JSON[_0x4ab7('0x1f')](this['getDataValue'](_0x4ab7('0x1e'))):{};},'set':function(_0x3c6570){return this[_0x4ab7('0x20')](_0x4ab7('0x1e'),JSON[_0x4ab7('0x16')](_0x3c6570));}},'token':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':function(){return rs[_0x4ab7('0x21')]();}},'autoclose':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4ab7('0x2')]},'forwardOffline':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4ab7('0x2')]},'waitingTitle':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x22')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x23')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x24')},'sendUnmanaged':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4ab7('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':function(){return _0x4ab7('0x25');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x4ab7('0x15')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x27')},'messagesAlignment':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x28')},'defaultTitle':{'type':Sequelize[_0x4ab7('0x2')]},'customerAvatar':{'type':Sequelize[_0x4ab7('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4ab7('0x15')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':_0x4ab7('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ab7('0x15')],'comment':_0x4ab7('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![],'comment':_0x4ab7('0x2c'),'set':function(_0x533e52){if(!_0x533e52)this['setDataValue'](_0x4ab7('0x2d'),null);this[_0x4ab7('0x20')](_0x4ab7('0x2e'),_0x533e52);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x4ab7('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8188=['Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','star','TEXT','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x8188,0x1e2));var _0x8818=function(_0x28fd67,_0xa0de0d){_0x28fd67=_0x28fd67-0x0;var _0x12e454=_0x8188[_0x28fd67];return _0x12e454;};'use strict';var Sequelize=require(_0x8818('0x0'));var rs=require(_0x8818('0x1'));module['exports']={'name':{'type':Sequelize[_0x8818('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x8818('0x2')],'allowNull':![],'unique':_0x8818('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x8818('0x4')},'key':{'type':Sequelize[_0x8818('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x5')},'customerAlias':{'type':Sequelize[_0x8818('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8818('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8818('0x2')],'allowNull':![],'defaultValue':_0x8818('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8818('0x2')],'allowNull':![],'defaultValue':_0x8818('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8818('0x2')],'allowNull':![],'defaultValue':_0x8818('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8818('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8818('0x8')](_0x8818('0x9'),'squared'),'defaultValue':_0x8818('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x8818('0xa')},'start_chat_button':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8818('0xc')},'header_offline':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0xd')},'download_transcript':{'type':Sequelize[_0x8818('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8818('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x8818('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x8818('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8818('0x14')},'closingMessageButton':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0xc')},'skipMessageButton':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x15')},'conditionAgreement':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x8818('0x16'),'thumb'),'defaultValue':_0x8818('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8818('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8818('0x17')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x8818('0x18'),'type':_0x8818('0x19'),'required':!![]},'props':{'title':_0x8818('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x8818('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8818('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8818('0x1a')](_0x8818('0x1b'))?JSON[_0x8818('0x1c')](this[_0x8818('0x1a')](_0x8818('0x1b'))):{};},'set':function(_0x32189e){return this[_0x8818('0x1d')](_0x8818('0x1b'),JSON[_0x8818('0x1e')](_0x32189e));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x8818('0x1e')]({'items':[{'type':_0x8818('0x1f'),'props':{'title':_0x8818('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x8818('0x20'),'config':{'placeholder':_0x8818('0x21')},'props':{'title':_0x8818('0x21'),'helpText':_0x8818('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8818('0x23'))?JSON[_0x8818('0x1c')](this['getDataValue'](_0x8818('0x23'))):{};},'set':function(_0x241adb){return this[_0x8818('0x1d')](_0x8818('0x23'),JSON[_0x8818('0x1e')](_0x241adb));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8818('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8818('0x2')]},'waitingTitle':{'type':Sequelize[_0x8818('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x26')},'offlineMessageBody':{'type':Sequelize[_0x8818('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8818('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8818('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x15')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x8818('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8818('0x17')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8818('0x17')],'defaultValue':function(){return _0x8818('0x27');}},'notificationSound':{'type':Sequelize[_0x8818('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8818('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x8818('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8818('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x28')},'verticalAlignment':{'type':Sequelize[_0x8818('0xf')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x29')},'messagesAlignment':{'type':Sequelize[_0x8818('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8818('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8818('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8818('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8818('0x2')],'defaultValue':_0x8818('0x2b')},'systemAvatar':{'type':Sequelize[_0x8818('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8818('0xf')],'comment':_0x8818('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8818('0x2d'),'set':function(_0x5ebcef){if(!_0x5ebcef)this[_0x8818('0x1d')](_0x8818('0x2e'),null);this[_0x8818('0x1d')](_0x8818('0x2f'),_0x5ebcef);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x8818('0x2')],'allowNull':![],'defaultValue':_0x8818('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x8818('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x8818('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8818('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8818('0x17')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c9e24fc..70a2bd0 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 _0xf3cd=['split','firstName','lastName','x-real-port','referer','browser','name','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','length','find','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','create','update','addDisposition','Disposition','pick','ChatWebsiteId','options','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','orderBy','list','ListId','contact','headers','threadId','closed','ChatInteraction','customerIp','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','applications','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','Start','startRouting','EventManager','offline','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','server','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','Tag','color','tag','getProactiveActions','virtual','License','chatLicenseExceeded','timezone','3.13.0','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','transaction','Transaction','bulkCreate','findAndCountAll','priority','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','html-to-text','ioredis','jayson/promise','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','get','UserProfileResource','destroy','stack','user-agent-parser','setUA','getResult','cf-connecting-ip','x-forwarded-for'];(function(_0x148cab,_0xe10466){var _0x4df904=function(_0x53d14d){while(--_0x53d14d){_0x148cab['push'](_0x148cab['shift']());}};_0x4df904(++_0xe10466);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0xf3cd[_0x5da0d9];return _0x4b6d2f;};'use strict';var Mustache=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var ejs=require(_0xdf3c('0x3'));var fs=require('fs');var fs_extra=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var querystring=require('querystring');var htmlToText=require(_0xdf3c('0x6'));var Redis=require(_0xdf3c('0x7'));var jayson=require(_0xdf3c('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x9'))(_0xdf3c('0xa'));var config=require(_0xdf3c('0xb'));var APIBadRequestError=require(_0xdf3c('0xc'))[_0xdf3c('0xd')];var APINotFoundError=require(_0xdf3c('0xc'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xdf3c('0xc'))['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0xdf3c('0xe')];var APIConflictError=require(_0xdf3c('0xc'))['APIConflictError'];var wildcardUtils=require(_0xdf3c('0xf'));var URL=require(_0xdf3c('0x10'))[_0xdf3c('0x11')];var db=require(_0xdf3c('0x12'))['db'];config[_0xdf3c('0x13')]=_[_0xdf3c('0x14')](config[_0xdf3c('0x13')],{'host':_0xdf3c('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf3c('0x13')]));require(_0xdf3c('0x16'))[_0xdf3c('0x17')](socket);var client=jayson[_0xdf3c('0x18')]['http']({'port':0x232c});var client9002=jayson[_0xdf3c('0x18')][_0xdf3c('0x19')]({'port':0x232a});var client9003=jayson[_0xdf3c('0x18')]['http']({'port':0x232b});var client9001=jayson[_0xdf3c('0x18')][_0xdf3c('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x173041,_0x4274fd,_0x21e587,_0x1a7a5a){return new Promise(function(_0x305ea5,_0x92008b){var _0x2986d0=_0x1a7a5a||client;return _0x2986d0[_0xdf3c('0x1a')](_0x173041,_0x21e587)['then'](function(_0x13b0e6){logger[_0xdf3c('0x1b')](_0xdf3c('0x1c'),_0x4274fd,_0xdf3c('0x1d'));logger[_0xdf3c('0x1e')](_0xdf3c('0x1f'),_0x4274fd,_0xdf3c('0x1d'),JSON[_0xdf3c('0x20')](_0x13b0e6));if(_0x13b0e6[_0xdf3c('0x21')]){if(_0x13b0e6[_0xdf3c('0x21')][_0xdf3c('0x22')]===0x1f4){logger[_0xdf3c('0x21')](_0xdf3c('0x1c'),_0x4274fd,_0x13b0e6['error']['message']);return _0x92008b(_0x13b0e6[_0xdf3c('0x21')]['message']);}logger[_0xdf3c('0x21')](_0xdf3c('0x1c'),_0x4274fd,_0x13b0e6[_0xdf3c('0x21')][_0xdf3c('0x23')]);return _0x305ea5(_0x13b0e6[_0xdf3c('0x21')][_0xdf3c('0x23')]);}else{logger['info'](_0xdf3c('0x1c'),_0x4274fd,_0xdf3c('0x1d'));_0x305ea5(_0x13b0e6[_0xdf3c('0x24')][_0xdf3c('0x23')]);}})[_0xdf3c('0x25')](function(_0x3b5371){logger[_0xdf3c('0x21')](_0xdf3c('0x1c'),_0x4274fd,_0x3b5371);_0x92008b(_0x3b5371);});});}function respondWithStatusCode(_0x18cb46,_0x1adee4){_0x1adee4=_0x1adee4||0xcc;return function(_0x4c076c){if(_0x4c076c){return _0x18cb46[_0xdf3c('0x26')](_0x1adee4);}return _0x18cb46[_0xdf3c('0x27')](_0x1adee4)['end']();};}function respondWithResult(_0xdc8962,_0x59659e){_0x59659e=_0x59659e||0xc8;return function(_0x4eaced){if(_0x4eaced){return _0xdc8962['status'](_0x59659e)[_0xdf3c('0x28')](_0x4eaced);}};}function respondWithFilteredResult(_0x186bba,_0x52b8f6){return function(_0x5c3b5a){if(_0x5c3b5a){var _0x37ecfd=typeof _0x52b8f6[_0xdf3c('0x29')]===_0xdf3c('0x2a')&&typeof _0x52b8f6[_0xdf3c('0x2b')]==='undefined';var _0x43ce06=_0x5c3b5a[_0xdf3c('0x2c')];var _0x5386bf=_0x37ecfd?0x0:_0x52b8f6['offset'];var _0x1f1d8a=_0x37ecfd?_0x5c3b5a[_0xdf3c('0x2c')]:_0x52b8f6[_0xdf3c('0x29')]+_0x52b8f6['limit'];var _0x2355f6;if(_0x1f1d8a>=_0x43ce06){_0x1f1d8a=_0x43ce06;_0x2355f6=0xc8;}else{_0x2355f6=0xce;}_0x186bba[_0xdf3c('0x27')](_0x2355f6);return _0x186bba[_0xdf3c('0x2d')](_0xdf3c('0x2e'),_0x5386bf+'-'+_0x1f1d8a+'/'+_0x43ce06)['json'](_0x5c3b5a);}return null;};}function saveUpdates(_0xda0de0){return function(_0x46b445){if(_0x46b445){return _0x46b445['update'](_0xda0de0)[_0xdf3c('0x2f')](function(_0x3daeda){return _0x3daeda;});}return null;};}function removeEntity(_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x2f')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x30')]({'plain':!![]});var _0x3b9ce8='ChatWebsites';return db[_0xdf3c('0x31')][_0xdf3c('0x32')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x217a65[_0xdf3c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115){return function(_0x5e8130){if(!_0x5e8130){_0x216115['sendStatus'](0x194);}return _0x5e8130;};}function handleError(_0x52f0c3,_0x44a478){_0x44a478=_0x44a478||0x1f4;return function(_0x2ee9ad){logger[_0xdf3c('0x21')](_0x2ee9ad[_0xdf3c('0x33')]);if(_0x2ee9ad['name']){delete _0x2ee9ad['name'];}_0x52f0c3[_0xdf3c('0x27')](_0x44a478)['send'](_0x2ee9ad);};}function createInteractionObject(_0x46e40f,_0x17b502,_0x3628ae,_0xcdd731){var _0x1004e9=require(_0xdf3c('0x34'));var _0x1c7335=new _0x1004e9();var _0x809f3d=_0x1c7335[_0xdf3c('0x35')](_0x3628ae['user-agent'])[_0xdf3c('0x36')]();var _0x54e689=_0x17b502['customerIp'];if(_0x3628ae[_0xdf3c('0x37')]){_0x54e689=_0x3628ae['cf-connecting-ip'];}else if(_0x3628ae[_0xdf3c('0x38')]){_0x54e689=_['first'](_0x3628ae[_0xdf3c('0x38')][_0xdf3c('0x39')](','));}return{'ContactId':_0xcdd731['id'],'ChatWebsiteId':_0x46e40f,'from':(_0xcdd731[_0xdf3c('0x3a')]||'')+'\x20'+(_0xcdd731[_0xdf3c('0x3b')]||''),'customerIp':_0x54e689,'customerPort':_0x3628ae[_0xdf3c('0x3c')]?_0x3628ae[_0xdf3c('0x3c')]:null,'referer':_0x17b502[_0xdf3c('0x3d')],'browserName':_0x809f3d[_0xdf3c('0x3e')][_0xdf3c('0x3f')]&&_0x809f3d[_0xdf3c('0x3e')][_0xdf3c('0x40')]?util[_0xdf3c('0x41')]('%s\x20%s',_0x809f3d['browser'][_0xdf3c('0x3f')],_0x809f3d['browser'][_0xdf3c('0x40')]):_0xdf3c('0x42'),'browserVersion':_0x809f3d[_0xdf3c('0x3e')][_0xdf3c('0x40')]||'unknown','osName':util['format'](_0xdf3c('0x43'),_0x809f3d['os'][_0xdf3c('0x3f')],_0x809f3d['os'][_0xdf3c('0x40')]),'osVersion':_0x809f3d['os']['version'],'deviceModel':_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x45')]&&_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x46')]?util['format'](_0xdf3c('0x47'),_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x45')],_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x46')],_0x809f3d['device'][_0xdf3c('0x48')]):null,'deviceVendor':_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x46')],'deviceType':_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x48')],'formData':JSON[_0xdf3c('0x20')](_0x17b502)};}exports['index']=function(_0x4d6349,_0x2c6c6d){var _0x2be86d={'include':[{'model':db[_0xdf3c('0x49')],'as':_0xdf3c('0x4a')}]},_0x5a4443={},_0x5c9885={'count':0x0,'rows':[]};var _0x46b2bd=_[_0xdf3c('0x4b')](db[_0xdf3c('0x4c')][_0xdf3c('0x4d')],function(_0x466ea1){return{'name':_0x466ea1[_0xdf3c('0x4e')],'type':_0x466ea1[_0xdf3c('0x48')]['key']};});_0x5a4443[_0xdf3c('0x45')]=_[_0xdf3c('0x4b')](_0x46b2bd,_0xdf3c('0x3f'));_0x5a4443[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x4d6349[_0xdf3c('0x4f')]);_0x5a4443[_0xdf3c('0x51')]=_['intersection'](_0x5a4443[_0xdf3c('0x45')],_0x5a4443['query']);_0x2be86d[_0xdf3c('0x52')]=_['intersection'](_0x5a4443[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x2be86d['attributes']=_0x2be86d['attributes']['length']?_0x2be86d[_0xdf3c('0x52')]:_0x5a4443['model'];if(!_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0x2be86d[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x4d6349['query']['limit']);_0x2be86d[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x4d6349['query'][_0xdf3c('0x29')]);}_0x2be86d[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x2be86d[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_['pick'](_0x4d6349['query'],_0x5a4443[_0xdf3c('0x51')]),_0x46b2bd);if(_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x2be86d[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x2be86d[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x46b2bd,function(_0x2aace4){if(_0x2aace4[_0xdf3c('0x48')]!==_0xdf3c('0x5b')){var _0x393ad2={};_0x393ad2[_0x2aace4['name']]={'$like':'%'+_0x4d6349[_0xdf3c('0x4f')]['filter']+'%'};return _0x393ad2;}})});}_0x2be86d=_['merge']({},_0x2be86d,_0x4d6349['options']);var _0x58fcbf={'where':_0x2be86d['where']};return db[_0xdf3c('0x4c')][_0xdf3c('0x2c')](_0x58fcbf)['then'](function(_0x4257c4){_0x5c9885[_0xdf3c('0x2c')]=_0x4257c4;if(_0x4d6349['query'][_0xdf3c('0x5c')]){_0x2be86d[_0xdf3c('0x5d')]=[{'all':!![]}];}return db[_0xdf3c('0x4c')][_0xdf3c('0x5e')](_0x2be86d);})[_0xdf3c('0x2f')](function(_0x28f387){_0x5c9885[_0xdf3c('0x5f')]=_0x28f387;return _0x5c9885;})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x2c6c6d,_0x2be86d))[_0xdf3c('0x25')](handleError(_0x2c6c6d,null));};exports[_0xdf3c('0x60')]=function(_0x55e29b,_0x503d94){var _0x1ed898={'raw':![],'where':{'id':_0x55e29b[_0xdf3c('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0xdf3c('0x4a')}]},_0x158932={};_0x158932[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db['ChatWebsite'][_0xdf3c('0x4d')]);_0x158932[_0xdf3c('0x4f')]=_['keys'](_0x55e29b[_0xdf3c('0x4f')]);_0x158932['filters']=_[_0xdf3c('0x62')](_0x158932[_0xdf3c('0x45')],_0x158932[_0xdf3c('0x4f')]);_0x1ed898[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x158932[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x55e29b[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x1ed898[_0xdf3c('0x52')]=_0x1ed898[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x1ed898[_0xdf3c('0x52')]:_0x158932[_0xdf3c('0x45')];if(_0x55e29b[_0xdf3c('0x4f')][_0xdf3c('0x5c')]){_0x1ed898[_0xdf3c('0x5d')]=[{'all':!![]}];}_0x1ed898=_['merge']({},_0x1ed898,_0x55e29b['options']);return db[_0xdf3c('0x4c')][_0xdf3c('0x64')](_0x1ed898)[_0xdf3c('0x2f')](handleEntityNotFound(_0x503d94,null))['then'](respondWithResult(_0x503d94,null))[_0xdf3c('0x25')](handleError(_0x503d94,null));};exports['create']=function(_0x574852,_0x184952){var _0x399db6=null;_0x574852[_0xdf3c('0x65')][_0xdf3c('0x66')][_0xdf3c('0x39')](',')[_0xdf3c('0x67')](_0x1a31d7=>{if(_0x1a31d7[_0xdf3c('0x68')]()!==''&&!wildcardUtils[_0xdf3c('0x69')](_0x1a31d7[_0xdf3c('0x68')]())){_0x399db6=new APIBadRequestError('\x22'+_0x1a31d7[_0xdf3c('0x68')]()+_0xdf3c('0x6a'));}});if(_0x399db6){return handleError(_0x184952,null)(_0x399db6);}return db[_0xdf3c('0x4c')]['create'](_0x574852[_0xdf3c('0x65')],{})[_0xdf3c('0x2f')](function(_0x149cd5){var _0x16d6ea=_0x574852[_0xdf3c('0x6b')]['get']({'plain':!![]});if(!_0x16d6ea)throw new Error(_0xdf3c('0x6c'));if(_0x16d6ea[_0xdf3c('0x6d')]===_0xdf3c('0x6b')){var _0x12d791=_0x149cd5[_0xdf3c('0x30')]({'plain':!![]});var _0x50805c=_0xdf3c('0x6e');return db[_0xdf3c('0x6f')][_0xdf3c('0x64')]({'where':{'name':_0x50805c,'userProfileId':_0x16d6ea[_0xdf3c('0x70')]},'raw':!![]})['then'](function(_0xb867a1){if(_0xb867a1&&_0xb867a1[_0xdf3c('0x71')]===0x0){return db[_0xdf3c('0x31')][_0xdf3c('0x72')]({'name':_0x12d791[_0xdf3c('0x3f')],'resourceId':_0x12d791['id'],'type':_0xb867a1[_0xdf3c('0x3f')],'sectionId':_0xb867a1['id']},{})[_0xdf3c('0x2f')](function(){return _0x149cd5;});}else{return _0x149cd5;}})['catch'](function(_0x2b6069){logger[_0xdf3c('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b6069);throw _0x2b6069;});}return _0x149cd5;})['then'](respondWithResult(_0x184952,0xc9))[_0xdf3c('0x25')](handleError(_0x184952,null));};exports[_0xdf3c('0x73')]=function(_0x3064de,_0x1e6529){var _0x87f730=null;_0x3064de[_0xdf3c('0x65')][_0xdf3c('0x66')][_0xdf3c('0x39')](',')['forEach'](_0x14cd72=>{if(_0x14cd72[_0xdf3c('0x68')]()!==''&&!wildcardUtils[_0xdf3c('0x69')](_0x14cd72['trim']())){_0x87f730=new APIBadRequestError('\x22'+_0x14cd72[_0xdf3c('0x68')]()+_0xdf3c('0x6a'));}});if(_0x87f730){return handleError(_0x1e6529,null)(_0x87f730);}if(_0x3064de[_0xdf3c('0x65')]['id']){delete _0x3064de['body']['id'];}return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3064de[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0x49')],'as':_0xdf3c('0x4a')}]})[_0xdf3c('0x2f')](handleEntityNotFound(_0x1e6529,null))['then'](saveUpdates(_0x3064de['body'],null))['then'](respondWithResult(_0x1e6529,null))['catch'](handleError(_0x1e6529,null));};exports['destroy']=function(_0x2a4e4c,_0x3f43a0){return db[_0xdf3c('0x4c')]['find']({'where':{'id':_0x2a4e4c[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3f43a0,null))[_0xdf3c('0x2f')](removeEntity(_0x3f43a0,null))['catch'](handleError(_0x3f43a0,null));};exports['describe']=function(_0x233718,_0x4e3517){return db[_0xdf3c('0x4c')]['describe']()[_0xdf3c('0x2f')](respondWithResult(_0x4e3517,null))[_0xdf3c('0x25')](handleError(_0x4e3517,null));};exports[_0xdf3c('0x74')]=function(_0x31f023,_0x5316ef){if(_0x31f023['body']['id']){delete _0x31f023[_0xdf3c('0x65')]['id'];}return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x31f023[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x5316ef,null))[_0xdf3c('0x2f')](function(_0x4eb295){if(_0x4eb295){_0x31f023[_0xdf3c('0x65')]['ChatWebsiteId']=_0x4eb295['id'];return db[_0xdf3c('0x75')][_0xdf3c('0x72')](_0x31f023[_0xdf3c('0x65')]);}})[_0xdf3c('0x2f')](respondWithResult(_0x5316ef,null))[_0xdf3c('0x25')](handleError(_0x5316ef,null));};exports['getDispositions']=function(_0x45e4e0,_0x5c27cc){var _0x332041={'raw':![],'where':{}};var _0x4fabda={};var _0x591578={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x45e4e0[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x5c27cc,null))[_0xdf3c('0x2f')](function(_0x391042){if(_0x391042){_0x4fabda[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db['Disposition'][_0xdf3c('0x4d')]);_0x4fabda['query']=_[_0xdf3c('0x50')](_0x45e4e0[_0xdf3c('0x4f')]);_0x4fabda[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x4fabda[_0xdf3c('0x45')],_0x4fabda[_0xdf3c('0x4f')]);_0x332041[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x4fabda[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x332041[_0xdf3c('0x52')]=_0x332041[_0xdf3c('0x52')]['length']?_0x332041[_0xdf3c('0x52')]:_0x4fabda[_0xdf3c('0x45')];if(!_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x54')]('nolimit')){_0x332041[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x45e4e0['query']['limit']);_0x332041[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x29')]);}_0x332041[_0xdf3c('0x56')]=qs['sort'](_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x332041[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_[_0xdf3c('0x76')](_0x45e4e0[_0xdf3c('0x4f')],_0x4fabda['filters']));_0x332041[_0xdf3c('0x58')][_0xdf3c('0x77')]=_0x391042['id'];if(_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x332041[_0xdf3c('0x58')]=_['merge'](_0x332041['where'],{'$or':_['map'](_0x332041[_0xdf3c('0x52')],function(_0x2cdc6d){var _0x2d4ece={};_0x2d4ece[_0x2cdc6d]={'$like':'%'+_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x2d4ece;})});}_0x332041=_[_0xdf3c('0x5a')]({},_0x332041,_0x45e4e0[_0xdf3c('0x78')]);return db[_0xdf3c('0x75')]['count']({'where':_0x332041[_0xdf3c('0x58')]})[_0xdf3c('0x2f')](function(_0x1cb9fd){_0x591578[_0xdf3c('0x2c')]=_0x1cb9fd;if(_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x5c')]){_0x332041['include']=[{'all':!![]}];}return db[_0xdf3c('0x75')][_0xdf3c('0x5e')](_0x332041);})['then'](function(_0x5115ea){_0x591578[_0xdf3c('0x5f')]=_0x5115ea;return _0x591578;});}})['then'](respondWithFilteredResult(_0x5c27cc,_0x332041))[_0xdf3c('0x25')](handleError(_0x5c27cc,null));};exports[_0xdf3c('0x79')]=function(_0x4e917f,_0x2b4084){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x4e917f[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x2b4084,null))[_0xdf3c('0x2f')](function(_0x498882){if(_0x498882){return _0x498882[_0xdf3c('0x79')](_0x4e917f[_0xdf3c('0x4f')][_0xdf3c('0x7a')]);}})[_0xdf3c('0x2f')](respondWithStatusCode(_0x2b4084,null))[_0xdf3c('0x25')](handleError(_0x2b4084,null));};exports[_0xdf3c('0x7b')]=function(_0x3deacb,_0x48b892){if(_0x3deacb['body']['id']){delete _0x3deacb[_0xdf3c('0x65')]['id'];}return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3deacb['params']['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x48b892,null))['then'](function(_0x56a655){if(_0x56a655){_0x3deacb[_0xdf3c('0x65')][_0xdf3c('0x77')]=_0x56a655['id'];return db['CannedAnswer'][_0xdf3c('0x72')](_0x3deacb['body']);}})[_0xdf3c('0x2f')](respondWithResult(_0x48b892,null))['catch'](handleError(_0x48b892,null));};exports[_0xdf3c('0x7c')]=function(_0x3676a2,_0x284635){var _0xb91d51={'raw':![],'where':{}};var _0x8da8b8={};var _0x87e942={'count':0x0,'rows':[]};return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x3676a2[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x284635,null))[_0xdf3c('0x2f')](function(_0x404761){if(_0x404761){_0x8da8b8[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db['CannedAnswer'][_0xdf3c('0x4d')]);_0x8da8b8[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x3676a2['query']);_0x8da8b8[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x8da8b8[_0xdf3c('0x45')],_0x8da8b8[_0xdf3c('0x4f')]);_0xb91d51[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x8da8b8[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0xb91d51[_0xdf3c('0x52')]=_0xb91d51['attributes'][_0xdf3c('0x63')]?_0xb91d51[_0xdf3c('0x52')]:_0x8da8b8[_0xdf3c('0x45')];if(!_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0xb91d51[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0xb91d51[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x3676a2['query'][_0xdf3c('0x29')]);}_0xb91d51[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0xb91d51[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_['pick'](_0x3676a2[_0xdf3c('0x4f')],_0x8da8b8[_0xdf3c('0x51')]));_0xb91d51[_0xdf3c('0x58')][_0xdf3c('0x77')]=_0x404761['id'];if(_0x3676a2['query'][_0xdf3c('0x59')]){_0xb91d51[_0xdf3c('0x58')]=_['merge'](_0xb91d51[_0xdf3c('0x58')],{'$or':_['map'](_0xb91d51[_0xdf3c('0x52')],function(_0x1b2363){var _0x5e6cc1={};_0x5e6cc1[_0x1b2363]={'$like':'%'+_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x5e6cc1;})});}_0xb91d51=_[_0xdf3c('0x5a')]({},_0xb91d51,_0x3676a2['options']);return db['CannedAnswer'][_0xdf3c('0x2c')]({'where':_0xb91d51['where']})[_0xdf3c('0x2f')](function(_0x82225d){_0x87e942[_0xdf3c('0x2c')]=_0x82225d;if(_0x3676a2[_0xdf3c('0x4f')]['includeAll']){_0xb91d51[_0xdf3c('0x5d')]=[{'all':!![]}];}return db[_0xdf3c('0x7e')]['findAll'](_0xb91d51);})[_0xdf3c('0x2f')](function(_0x545e1c){_0x87e942[_0xdf3c('0x5f')]=_0x545e1c;return _0x87e942;});}})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x284635,_0xb91d51))['catch'](handleError(_0x284635,null));};exports['removeAnswers']=function(_0x243fbf,_0x4e01ca){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x243fbf[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x4e01ca,null))[_0xdf3c('0x2f')](function(_0x12bd07){if(_0x12bd07){return _0x12bd07[_0xdf3c('0x7f')](_0x243fbf[_0xdf3c('0x4f')][_0xdf3c('0x7a')]);}})[_0xdf3c('0x2f')](respondWithStatusCode(_0x4e01ca,null))[_0xdf3c('0x25')](handleError(_0x4e01ca,null));};exports['addLogo']=function(_0x4299d1,_0x132c27){_0x4299d1['body'][_0xdf3c('0x80')]=_0x4299d1[_0xdf3c('0x81')][_0xdf3c('0x82')];return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x4299d1[_0xdf3c('0x61')]['id']}})['then'](handleEntityNotFound(_0x132c27,null))[_0xdf3c('0x2f')](saveUpdates(_0x4299d1['body'],null))[_0xdf3c('0x2f')](respondWithResult(_0x132c27,null))[_0xdf3c('0x25')](handleError(_0x132c27,null));};exports[_0xdf3c('0x83')]=function(_0x2dafff,_0x2a934a){_0x2dafff[_0xdf3c('0x65')]['agentAvatar']=_0x2dafff[_0xdf3c('0x81')][_0xdf3c('0x82')];return db['ChatWebsite'][_0xdf3c('0x64')]({'where':{'id':_0x2dafff[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x2a934a,null))[_0xdf3c('0x2f')](saveUpdates(_0x2dafff[_0xdf3c('0x65')],null))[_0xdf3c('0x2f')](respondWithResult(_0x2a934a,null))[_0xdf3c('0x25')](handleError(_0x2a934a,null));};exports[_0xdf3c('0x84')]=function(_0x59cfce,_0x50b470){_0x59cfce[_0xdf3c('0x65')][_0xdf3c('0x85')]=_0x59cfce[_0xdf3c('0x81')][_0xdf3c('0x82')];return db['ChatWebsite']['find']({'where':{'id':_0x59cfce[_0xdf3c('0x61')]['id']}})['then'](handleEntityNotFound(_0x50b470,null))[_0xdf3c('0x2f')](saveUpdates(_0x59cfce['body'],null))[_0xdf3c('0x2f')](respondWithResult(_0x50b470,null))[_0xdf3c('0x25')](handleError(_0x50b470,null));};exports[_0xdf3c('0x86')]=function(_0x53555a,_0x292798){_0x53555a[_0xdf3c('0x65')]['systemAvatar']=_0x53555a['file'][_0xdf3c('0x82')];return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x53555a[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x292798,null))[_0xdf3c('0x2f')](saveUpdates(_0x53555a[_0xdf3c('0x65')],null))['then'](respondWithResult(_0x292798,null))['catch'](handleError(_0x292798,null));};exports[_0xdf3c('0x87')]=function(_0x39c993,_0x2efe5b){var _0x140e5e=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x8a'));var _0x828c9c={'where':{'id':_0x39c993[_0xdf3c('0x61')]['id']},'attributes':['id',_0xdf3c('0x80')],'raw':!![]};var _0x3e4a0e=![];return require(_0xdf3c('0x8b'))[_0xdf3c('0x8c')]()[_0xdf3c('0x2f')](function(_0x434b1b){if(_0x434b1b){_0x3e4a0e=_0x434b1b[_0xdf3c('0x8d')];}})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')](_0x828c9c);})['then'](handleEntityNotFound(_0x2efe5b,null))['then'](function(_0x7cf0de){if(_0x7cf0de){if(!_['isNil'](_0x7cf0de['sitepic'])){if(fs[_0xdf3c('0x8e')](path['join'](config[_0xdf3c('0x89')],_0xdf3c('0x8f'),_0x7cf0de['sitepic']))&&_0x3e4a0e){_0x140e5e=path['join'](config['root'],_0xdf3c('0x8f'),_0x7cf0de[_0xdf3c('0x80')]);}}return _0x2efe5b[_0xdf3c('0x90')](_0x140e5e);}})['catch'](handleError(_0x2efe5b,null));};exports[_0xdf3c('0x91')]=function(_0x51f4b6,_0x37b921){var _0x4ba88f=path['join'](config[_0xdf3c('0x89')],_0xdf3c('0x92'));var _0x3ff959={'where':{'id':_0x51f4b6[_0xdf3c('0x61')]['id']},'attributes':['id',_0xdf3c('0x93')],'raw':!![]};return db[_0xdf3c('0x4c')]['find'](_0x3ff959)['then'](handleEntityNotFound(_0x37b921,null))[_0xdf3c('0x2f')](function(_0x57484a){if(_0x57484a){if(!_[_0xdf3c('0x94')](_0x57484a[_0xdf3c('0x93')])){if(fs[_0xdf3c('0x8e')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x95'),_0x57484a[_0xdf3c('0x93')]))){_0x4ba88f=path['join'](config['root'],_0xdf3c('0x95'),_0x57484a[_0xdf3c('0x93')]);}}return _0x37b921[_0xdf3c('0x90')](_0x4ba88f);}})[_0xdf3c('0x25')](handleError(_0x37b921,null));};exports['getCustomerAvatar']=function(_0xe14463,_0x364b5e){var _0x32ec3c=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x96'));var _0x524482={'where':{'id':_0xe14463[_0xdf3c('0x61')]['id']},'attributes':['id',_0xdf3c('0x85'),'showCustomerAvatar'],'raw':!![]};return db[_0xdf3c('0x4c')][_0xdf3c('0x64')](_0x524482)[_0xdf3c('0x2f')](handleEntityNotFound(_0x364b5e,null))['then'](function(_0x87ec92){if(_0x87ec92){if(!_[_0xdf3c('0x94')](_0x87ec92[_0xdf3c('0x85')])){if(fs[_0xdf3c('0x8e')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x95'),_0x87ec92[_0xdf3c('0x85')]))&&_0x87ec92[_0xdf3c('0x97')]){_0x32ec3c=path['join'](config[_0xdf3c('0x89')],'server/files/images/avatars/',_0x87ec92[_0xdf3c('0x85')]);}}return _0x364b5e[_0xdf3c('0x90')](_0x32ec3c);}})[_0xdf3c('0x25')](handleError(_0x364b5e,null));};exports[_0xdf3c('0x98')]=function(_0x90c66,_0x34344b){var _0x1e2f88=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x99'));var _0x3a90f4={'where':{'id':_0x90c66['params']['id']},'attributes':['id',_0xdf3c('0x9a')],'raw':!![]};return db[_0xdf3c('0x4c')]['find'](_0x3a90f4)[_0xdf3c('0x2f')](handleEntityNotFound(_0x34344b,null))[_0xdf3c('0x2f')](function(_0x367cd3){if(_0x367cd3){if(!_[_0xdf3c('0x94')](_0x367cd3['systemAvatar'])){if(fs[_0xdf3c('0x8e')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],'server/files/images/avatars/',_0x367cd3['systemAvatar']))){_0x1e2f88=path['join'](config[_0xdf3c('0x89')],_0xdf3c('0x95'),_0x367cd3[_0xdf3c('0x9a')]);}}return _0x34344b[_0xdf3c('0x90')](_0x1e2f88);}})[_0xdf3c('0x25')](handleError(_0x34344b,null));};function checkWebsiteInterval(_0x33132b){var _0x18a7ac=_0x33132b[_0xdf3c('0x9b')];if(!_0x18a7ac){return Promise['resolve'](_0x33132b);}var _0x1a0613=_0x33132b['timezone']||undefined;return _0x18a7ac[_0xdf3c('0x9c')](_0x1a0613)[_0xdf3c('0x2f')](function(_0x1b2e93){if(!_0x1b2e93){throw new APIOutOfIntervalError();}return _0x33132b;});}exports[_0xdf3c('0x9d')]=function(_0x3cb8a7,_0x440c7c){var _0x4e5569={'body':_0x3cb8a7[_0xdf3c('0x65')],'channel':_0xdf3c('0x9e')};var _0x4d3059=[];var _0x28337a=[];var _0x270353={};var _0x5926b6=![];if(_0x3cb8a7[_0xdf3c('0x65')]['id']){delete _0x3cb8a7['body']['id'];}if(_[_0xdf3c('0x94')](_0x3cb8a7['body'][_0xdf3c('0x9f')])){throw new APIBadRequestError(_0xdf3c('0xa0'));}if(_[_0xdf3c('0x94')](_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xa1')])){throw new APIBadRequestError(_0xdf3c('0xa2'));}if(_['isEmpty'](_0x3cb8a7['body']['body'])){throw new APIBadRequestError(_0xdf3c('0xa3'));}var _0x18f52c=_0x3cb8a7['body']['customerIp']&&_0x3cb8a7[_0xdf3c('0x65')]['referer'];return db['CmContact']['describe']()[_0xdf3c('0x2f')](function(_0x242b95){if(!_0x242b95){throw new Error(_0xdf3c('0xa4'));}_0x4d3059=Object['keys'](_0x242b95)[_0xdf3c('0x59')](function(_0x51d880){return![_0xdf3c('0xa5'),_0xdf3c('0xa6')][_0xdf3c('0xa7')](_0x51d880);});_0x28337a=Object[_0xdf3c('0x50')](_0x242b95)[_0xdf3c('0x59')](function(_0x467090){return![_0xdf3c('0xa5'),_0xdf3c('0xa6'),_0xdf3c('0xa8'),'ListId'][_0xdf3c('0xa7')](_0x467090);});if(!_[_0xdf3c('0xa7')](_0x28337a,_0x3cb8a7['body'][_0xdf3c('0xa1')])){throw new APIBadRequestError(_0xdf3c('0xa9')+_0x28337a['join'](',\x20'));}_0x270353[_0x3cb8a7[_0xdf3c('0x65')]['mapKey']]=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x9f')];})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3cb8a7[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0xaa')],'as':_0xdf3c('0xab'),'include':[{'model':db[_0xdf3c('0xac')],'as':_0xdf3c('0xad'),'where':_0x270353,'limit':0x1,'order':[[_0xdf3c('0xa6'),_0xdf3c('0xae')]]}]},{'model':db[_0xdf3c('0xaf')],'as':_0xdf3c('0xb0')},{'model':db[_0xdf3c('0x9b')],'as':_0xdf3c('0x9b'),'include':[{'model':db['Interval'],'as':_0xdf3c('0xb1'),'attributes':['id',_0xdf3c('0xb2')],'raw':!![]}]}]});})['then'](function(_0x518292){if(!_0x518292){throw new APINotFoundError(util[_0xdf3c('0x41')](_0xdf3c('0xb3'),_0x3cb8a7[_0xdf3c('0x61')]['id']));}if(_0x18f52c){return checkWebsiteInterval(_0x518292);}return _0x518292;})['then'](function(_0x5c3767){_0x4e5569[_0xdf3c('0xb4')]=_0x5c3767;_0x4e5569['applications']=_[_0xdf3c('0xb5')](_0x5c3767[_0xdf3c('0xb0')],['priority'],['asc']);if(_0x4e5569[_0xdf3c('0xb4')][_0xdf3c('0xb0')]){delete _0x4e5569[_0xdf3c('0xb4')]['Applications'];}_0x4e5569[_0xdf3c('0xb6')]=_0x5c3767['List']||{'id':_0x5c3767[_0xdf3c('0xb7')]};if(_0x4e5569[_0xdf3c('0xb6')]&&_0x4e5569[_0xdf3c('0xb6')][_0xdf3c('0xad')][_0xdf3c('0x63')]){return _0x4e5569[_0xdf3c('0xb6')]['Contacts'][0x0];}var _0x16ae87=_['defaults'](_0x3cb8a7[_0xdf3c('0x65')],{'firstName':_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x9f')],'ListId':_0x5c3767['ListId']});_0x16ae87[_0x3cb8a7[_0xdf3c('0x65')]['mapKey']]=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x9f')];return db['CmContact'][_0xdf3c('0x72')](_0x16ae87,{'fields':_0x4d3059,'raw':!![]});})[_0xdf3c('0x2f')](function(_0x2c3655){_0x4e5569[_0xdf3c('0xb8')]=_0x2c3655;var _0x55969c=createInteractionObject(_0x3cb8a7[_0xdf3c('0x61')]['id'],_0x3cb8a7[_0xdf3c('0x65')],_0x3cb8a7[_0xdf3c('0xb9')],_0x2c3655);var _0x393d06={'ChatWebsiteId':_0x3cb8a7[_0xdf3c('0x61')]['id']};if(_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xba')]){_0x393d06['threadId']=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xba')];_0x393d06[_0xdf3c('0xbb')]=![];return db[_0xdf3c('0xbc')][_0xdf3c('0x64')]({'where':_0x393d06})[_0xdf3c('0x2f')](function(_0x282f44){var _0x6e0498=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xbd')]&&_0x3cb8a7[_0xdf3c('0x65')]['referer'];if(_0x282f44){_0x5926b6=!![];return _0x282f44;}else if(!_0x6e0498&&_0x282f44&&_0x282f44[_0xdf3c('0xbb')]){throw new APIConflictError(_0xdf3c('0xbe'));}_0x55969c[_0xdf3c('0xba')]=_0x3cb8a7['body'][_0xdf3c('0xba')];_0x55969c[_0xdf3c('0xbf')]=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xbf')];return db[_0xdf3c('0xbc')]['create'](_0x55969c);});}_0x393d06[_0xdf3c('0xc0')]=_0x2c3655['id'];if(_0x3cb8a7[_0xdf3c('0x65')]['interaction']&&_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc1')]['id']){_0x393d06['id']=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc1')]['id'];return db[_0xdf3c('0xbc')][_0xdf3c('0x64')]({'where':_0x393d06})[_0xdf3c('0x2f')](function(_0x3d9041){var _0x16564c=_0x3cb8a7['body'][_0xdf3c('0xbd')]&&_0x3cb8a7[_0xdf3c('0x65')]['referer'];if(!_0x16564c&&_0x3d9041&&_0x3d9041[_0xdf3c('0xbb')]){throw new APIConflictError(_0xdf3c('0xbe'));}else if(_0x3d9041){_0x5926b6=!![];return _0x3d9041;}else{return db['ChatInteraction']['create'](_0x55969c);}});}return db[_0xdf3c('0xbc')][_0xdf3c('0x72')](_0x55969c);})[_0xdf3c('0x2f')](function(_0x2bf92d){if(!_0x5926b6){return _0x2bf92d;}var _0x1f5c1b={'from':(_0x4e5569[_0xdf3c('0xb8')][_0xdf3c('0x3a')]||'')+'\x20'+(_0x4e5569[_0xdf3c('0xb8')]['lastName']||'')};if(_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xba')]&&_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc2')]&&_0x3cb8a7['body'][_0xdf3c('0xba')]!=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc2')]){_0x1f5c1b[_0xdf3c('0xba')]=_0x3cb8a7['body'][_0xdf3c('0xc2')];}return _0x2bf92d[_0xdf3c('0x73')](_0x1f5c1b);})[_0xdf3c('0x2f')](function(_0x58bc3a){_0x4e5569['interaction']=_0x58bc3a[_0xdf3c('0x30')]({'plain':!![]});_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xc3')]=!_0x5926b6;if(_0x4e5569['interaction'][_0xdf3c('0xc3')]){if(_0x4e5569[_0xdf3c('0xb4')][_0xdf3c('0xc4')]){_0x4e5569[_0xdf3c('0xc5')][_0xdf3c('0xc6')]({'id':0x0,'priority':_0x4e5569['applications']['length']+0x1,'app':_0xdf3c('0xc7'),'appdata':'unmanaged','interval':_0xdf3c('0xc8')});}}return db[_0xdf3c('0xc9')][_0xdf3c('0x72')]({'body':_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x65')],'ChatWebsiteId':_0x3cb8a7[_0xdf3c('0x61')]['id'],'ChatInteractionId':_0x58bc3a['id'],'direction':'in','ContactId':_0x4e5569['contact']['id'],'AttachmentId':_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xca')]});})[_0xdf3c('0x2f')](function(_0x5fcc1){_0x4e5569['message']=_0x5fcc1;if(!_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xcb')]){return;}return db[_0xdf3c('0xcc')]['find']({'attributes':['id','name'],'where':{'id':_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xcb')]}});})['then'](function(_0x20af56){if(_0x20af56){_0x4e5569['applications'][_0xdf3c('0xcd')]({'id':0x0,'priority':0x0,'app':_0xdf3c('0xce'),'appdata':_0x20af56[_0xdf3c('0x3f')]+','+(_0x4e5569[_0xdf3c('0xb4')][_0xdf3c('0xcf')]||0xa),'interval':_0xdf3c('0xc8')});_0x4e5569['forcedOwnership']=!![];}if(!_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xd0')]){return;}return db[_0xdf3c('0xd1')][_0xdf3c('0x64')]({'attributes':['id',_0xdf3c('0x3f')],'where':{'id':_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xd0')]}});})[_0xdf3c('0x2f')](function(_0x43ce1f){if(_0x43ce1f){_0x4e5569[_0xdf3c('0xc5')][_0xdf3c('0xcd')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x43ce1f[_0xdf3c('0x3f')]+','+(_0x4e5569[_0xdf3c('0xb4')]['waitForTheAssignedQueue']||0x12c),'interval':_0xdf3c('0xc8')});}return respondWithRpcPromise(_0xdf3c('0xd2'),_0xdf3c('0xd3'),_0x4e5569);})[_0xdf3c('0x2f')](function(_0xa316ce){respondWithRpcPromise('EventManager',_0xdf3c('0xd4'),{'event':_0xdf3c('0x9d'),'message':_0xa316ce},client9002);return _0xa316ce;})[_0xdf3c('0x2f')](respondWithResult(_0x440c7c,null))[_0xdf3c('0x25')](APIHandleError(_0x440c7c));};exports[_0xdf3c('0xd5')]=function(_0x31391d,_0x158c75){var _0x7554e2,_0xdc8438,_0x4727f2;var _0x299dc3=[];var _0x4c3c70={};var _0x352c54=_0x31391d['files']||[];var _0x40c59b=[];var _0x11a887;return db['CmContact'][_0xdf3c('0xd6')]()[_0xdf3c('0x2f')](function(_0x44388c){if(!_0x44388c){throw new db[(_0xdf3c('0xd7'))][(_0xdf3c('0xd8'))](_0xdf3c('0xd9'));}_0x299dc3=_[_0xdf3c('0xda')](_[_0xdf3c('0x50')](_0x44388c),[_0xdf3c('0xa5'),_0xdf3c('0xa6'),'CompanyId',_0xdf3c('0xb7')]);if(_0x31391d[_0xdf3c('0x65')]['id']){delete _0x31391d['body']['id'];}if(_[_0xdf3c('0x94')](_0x31391d['body'][_0xdf3c('0x9f')])){throw _0x158c75['status'](0x1f4)[_0xdf3c('0xdb')](new db['Sequelize'][(_0xdf3c('0xd8'))](_0xdf3c('0xdc')));}if(_[_0xdf3c('0x94')](_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x65')])||_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x65')]===''){throw _0x158c75[_0xdf3c('0x27')](0x1f4)['send'](new db[(_0xdf3c('0xd7'))][(_0xdf3c('0xd8'))](_0xdf3c('0xdd')));}if(_['isNil'](_0x31391d[_0xdf3c('0x65')][_0xdf3c('0xde')])){throw _0x158c75[_0xdf3c('0x27')](0x1f4)[_0xdf3c('0xdb')](new db['Sequelize']['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x299dc3));}if(!_['includes'](_0x299dc3,_0x31391d[_0xdf3c('0x65')][_0xdf3c('0xde')])){throw _0x158c75[_0xdf3c('0x27')](0x1f4)[_0xdf3c('0xdb')](new db[(_0xdf3c('0xd7'))][(_0xdf3c('0xd8'))](_0xdf3c('0xdf')+_0x299dc3));}_0x4c3c70[_0x31391d['body'][_0xdf3c('0xde')]]=_0x31391d['body'][_0xdf3c('0x9f')];})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x31391d[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0xaa')],'as':_0xdf3c('0xab')},{'model':db[_0xdf3c('0xe0')],'as':'MailAccount'}]});})[_0xdf3c('0x2f')](handleEntityNotFound(_0x158c75,null))[_0xdf3c('0x2f')](function(_0x474e78){if(_0x474e78&&_0x474e78[_0xdf3c('0xab')]){_0xdc8438=_0x474e78;var _0x25bc5a=_['defaults'](_0x31391d['body'],{'firstName':_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x9f')],'phone':_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x9f')],'ListId':_0x474e78[_0xdf3c('0xb7')]});_0x25bc5a[_0x31391d[_0xdf3c('0x65')][_0xdf3c('0xde')]]=_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x9f')];return db[_0xdf3c('0xac')][_0xdf3c('0xe1')]({'where':_0x4c3c70,'defaults':_0x25bc5a});}})['spread'](function(_0x345a7b){if(_0x345a7b){_0x4727f2=_0x345a7b;var _0x14a995=fs[_0xdf3c('0xe2')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0xe3')),_0xdf3c('0xe4'));var _0x4e8ad8=ejs[_0xdf3c('0xe5')](_0x14a995,{'body':_['toPairs'](_0x31391d[_0xdf3c('0x65')]['body']),'bodyTitle':_0xdc8438[_0xdf3c('0xe6')]});return db[_0xdf3c('0xe7')]['create']({'body':_0x4e8ad8,'plainBody':htmlToText['fromString'](_0x4e8ad8),'ContactId':_0x345a7b['id'],'ChatWebsiteId':_0xdc8438['id']});}})[_0xdf3c('0x2f')](function(_0x10b2d9){_0x11a887=_0x10b2d9;if(_0x352c54[_0xdf3c('0x63')]){var _0x31d7d7=_0x352c54[_0xdf3c('0x4b')](function(_0x50e6e7){return{'name':_0x50e6e7[_0xdf3c('0xe8')],'basename':_0x50e6e7[_0xdf3c('0x82')],'type':_0x50e6e7[_0xdf3c('0xe9')],'ChatOfflineMessageId':_0x10b2d9['id']};});_0x40c59b=_0x31d7d7[_0xdf3c('0x4b')](_0x40944d=>{var _0x5b6c9a={'filename':_0x40944d[_0xdf3c('0x3f')],'path':path['join'](config[_0xdf3c('0x89')],'server','files',_0xdf3c('0xea'),_0xdf3c('0xeb'),_0x40944d[_0xdf3c('0xec')])};return _0x5b6c9a;});if(!_0xdc8438[_0xdf3c('0xed')]){return db[_0xdf3c('0xee')]['transaction'](function(_0xd3d760){return db[_0xdf3c('0xef')]['bulkCreate'](_0x31d7d7,{'transaction':_0xd3d760});});}}})[_0xdf3c('0x2f')](function(){if(_0x11a887){_0x7554e2=_0x11a887;return db[_0xdf3c('0xe0')][_0xdf3c('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0xdf3c('0xf0')],'as':_0xdf3c('0xf1'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xdf3c('0xf2'),'raw':!![]}]}]});}})[_0xdf3c('0x2f')](function(_0x25ed77){if(_0x25ed77&&_0x25ed77[_0xdf3c('0xf1')]&&_0xdc8438[_0xdf3c('0xf3')]&&_0xdc8438['forwardOfflineAddress']){var _0x2cf46=_0x25ed77[_0xdf3c('0xf4')]();return respondWithRpcPromise(_0xdf3c('0xf5'),_0xdf3c('0xf6'),{'account':_0x2cf46,'message':{'from':util[_0xdf3c('0x41')](_0xdf3c('0xf7'),_0x25ed77[_0xdf3c('0x3f')],_0x25ed77[_0xdf3c('0xf8')]||_0x25ed77[_0xdf3c('0xf1')][_0xdf3c('0x6b')]),'to':_0xdc8438[_0xdf3c('0xf9')],'subject':_0xdc8438[_0xdf3c('0xfa')],'html':_0x7554e2[_0xdf3c('0x65')],'attachments':_0x40c59b}},client9003)[_0xdf3c('0x2f')](function(){return _0x7554e2;})[_0xdf3c('0x25')](function(_0x2be6c7){logger[_0xdf3c('0x21')](_0x2be6c7);});}})[_0xdf3c('0x2f')](function(){if(_0xdc8438&&_0xdc8438['openNewInteraction']&&_0xdc8438[_0xdf3c('0xfb')]){var _0x350e07=[];if(_0x352c54[_0xdf3c('0x63')]){_0x350e07=_0x352c54['map'](function(_0xb9f71c){return{'name':_0xb9f71c['originalname'],'basename':_0xb9f71c[_0xdf3c('0x82')],'type':_0xb9f71c['mimetype'],'ChatOfflineMessageId':_0x11a887['id']};});}var _0x425ddb;if(!_[_0xdf3c('0x94')](_0xdc8438[_0xdf3c('0xfc')])){var _0xd9aaa5=_[_0xdf3c('0x4b')](_0x31391d[_0xdf3c('0x65')],function(_0xd8be1){return _0xd8be1;});var _0x4642ca=_[_0xdf3c('0xfd')](_0xd9aaa5)[0x0];var _0x4e3a41=_[_0xdf3c('0xfe')](_0x4642ca,function(_0x3e3d63){return _0x3e3d63;});_0x425ddb=_0x4e3a41[0x1][_0xdc8438[_0xdf3c('0xfc')]];}var _0x2964ed={'from':_0x4727f2['email'],'firstName':_0x4727f2['firstName'],'lastName':_0x4727f2[_0xdf3c('0x3b')],'mapKey':_0xdf3c('0xf8'),'message':{'from':_0x4727f2[_0xdf3c('0xf8')],'to':_0xdc8438[_0xdf3c('0xe0')]['email'],'cc':'','subject':_[_0xdf3c('0x94')](_0x425ddb)?_0xdc8438['offlineMessageSubject']:_0x425ddb,'messageId':'','sentAt':new Date(),'attach':_0x350e07['length'],'attachments':_0x350e07,'originChannel':_0xdf3c('0xff'),'ChatWebsiteId':_0xdc8438['id'],'ChatOfflineMessageId':_0x7554e2['id'],'originTo':_0xdc8438[_0xdf3c('0xe0')]['email']},'body':_0x7554e2[_0xdf3c('0x65')]};var _0x19024e={'account':{'id':_0xdc8438['MailAccountId']},'body':_0x2964ed,'log':_0xdf3c('0x100')};return respondWithRpcPromise(_0xdf3c('0x100'),'notifyMail',_0x19024e,client9001)[_0xdf3c('0x2f')](function(){return _0x7554e2;})[_0xdf3c('0x25')](function(_0x119524){logger[_0xdf3c('0x21')](_0x119524);});}return;})[_0xdf3c('0x2f')](function(){if(_0x7554e2){return _0x7554e2;}})[_0xdf3c('0x2f')](respondWithResult(_0x158c75,null))['catch'](function(){for(var _0x5291d8 of _0x352c54){var _0x1a79a1=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x101'),_0xdf3c('0x102'),_0xdf3c('0xea'),'offline-chat',_0x5291d8[_0xdf3c('0x82')]);fs_extra[_0xdf3c('0x103')](_0x1a79a1)[_0xdf3c('0x25')](function(_0xb25239){logger['error'](_0xdf3c('0x104'),_0x1a79a1,_0xb25239);});}});};exports[_0xdf3c('0x105')]=function(_0x50d59a,_0x112e4){return db[_0xdf3c('0xbc')][_0xdf3c('0x64')]({'where':{'id':_0x50d59a[_0xdf3c('0x61')]['id']}})['then'](handleEntityNotFound(_0x112e4,null))[_0xdf3c('0x2f')](function(_0xcb362a){if(_0xcb362a){return _0xcb362a[_0xdf3c('0x105')](_0x50d59a[_0xdf3c('0x65')]['ids'],_['omit'](_0x50d59a[_0xdf3c('0x65')],[_0xdf3c('0x7a'),'id'])||{});}})[_0xdf3c('0x2f')](respondWithResult(_0x112e4,null))[_0xdf3c('0x25')](handleError(_0x112e4,null));};exports[_0xdf3c('0x106')]=function(_0x3eb7b2,_0x3fec35){var _0x2fefc1={'raw':![],'where':{}};var _0x5b8dc4={};var _0x375d8d={'count':0x0,'rows':[]};return db[_0xdf3c('0x4c')]['findOne']({'where':{'id':_0x3eb7b2[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3fec35,null))['then'](function(_0x3d497d){if(_0x3d497d){_0x5b8dc4['model']=_[_0xdf3c('0x50')](db[_0xdf3c('0xbc')][_0xdf3c('0x4d')]);_0x5b8dc4[_0xdf3c('0x4f')]=_['keys'](_0x3eb7b2['query']);_0x5b8dc4['filters']=_[_0xdf3c('0x62')](_0x5b8dc4[_0xdf3c('0x45')],_0x5b8dc4[_0xdf3c('0x4f')]);_0x2fefc1[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x5b8dc4[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x3eb7b2['query'][_0xdf3c('0x53')]));_0x2fefc1[_0xdf3c('0x52')]=_0x2fefc1['attributes'][_0xdf3c('0x63')]?_0x2fefc1['attributes']:_0x5b8dc4[_0xdf3c('0x45')];if(!_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x54')]('nolimit')){_0x2fefc1[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0x2fefc1[_0xdf3c('0x29')]=qs['offset'](_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x29')]);}_0x2fefc1[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x2fefc1[_0xdf3c('0x58')]=qs['filters'](_[_0xdf3c('0x76')](_0x3eb7b2[_0xdf3c('0x4f')],_0x5b8dc4[_0xdf3c('0x51')]));_0x2fefc1['where'][_0xdf3c('0x77')]=_0x3d497d['id'];if(_0x3eb7b2['query'][_0xdf3c('0x59')]){_0x2fefc1[_0xdf3c('0x58')]=_['merge'](_0x2fefc1[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x2fefc1[_0xdf3c('0x52')],function(_0x27a534){var _0x45a467={};_0x45a467[_0x27a534]={'$like':'%'+_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x45a467;})});}_0x2fefc1=_[_0xdf3c('0x5a')]({},_0x2fefc1,_0x3eb7b2[_0xdf3c('0x78')]);return db[_0xdf3c('0xbc')][_0xdf3c('0x2c')]({'where':_0x2fefc1[_0xdf3c('0x58')]})['then'](function(_0x2888e3){_0x375d8d['count']=_0x2888e3;if(_0x3eb7b2['query']['includeAll']){_0x2fefc1['include']=[{'model':db[_0xdf3c('0xac')],'as':_0xdf3c('0x107'),'required':![]},{'model':db[_0xdf3c('0xcc')],'as':_0xdf3c('0x108'),'attributes':[_0xdf3c('0x3f'),_0xdf3c('0x109'),'internal'],'required':![]},{'model':db[_0xdf3c('0x10a')],'as':'Tags','attributes':['id',_0xdf3c('0x3f'),_0xdf3c('0x10b')],'where':_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x10c')]?{'id':_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x10c')]}:undefined,'required':_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x10c')]?!![]:![]}];}return db[_0xdf3c('0xbc')]['findAll'](_0x2fefc1);})[_0xdf3c('0x2f')](function(_0x258b2d){_0x375d8d[_0xdf3c('0x5f')]=_0x258b2d;return _0x375d8d;});}})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x3fec35,_0x2fefc1))['catch'](handleError(_0x3fec35,null));};exports['getSnippet']=function(_0x1a1ac0,_0x22d16f){var _0x427a90=0x0;var _0x5f557c=0x0;var _0x559e83=![];var _0x2fc1d8;var _0x2c2775;return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x1a1ac0[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0x9b')],'as':_0xdf3c('0x9b'),'include':[{'model':db['Interval'],'as':_0xdf3c('0xb1'),'attributes':['id',_0xdf3c('0xb2')]}]}]})[_0xdf3c('0x2f')](handleEntityNotFound(_0x22d16f,null))[_0xdf3c('0x2f')](function(_0x367df9){if(_0x367df9){_0x2fc1d8=_0x367df9;return _0x367df9[_0xdf3c('0x10d')]({'raw':!![]});}})['then'](function(_0x4cfc67){if(_0x2fc1d8){if(_0x4cfc67){_0x2c2775=_0x4cfc67;}}return require(_0xdf3c('0x8b'))[_0xdf3c('0x8c')]();})[_0xdf3c('0x2f')](function(_0x1b2961){if(_0x1b2961){_0x5f557c=_0x1b2961[_0xdf3c('0x10e')];_0x559e83=_0x1b2961['custom'];}})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0xbc')][_0xdf3c('0x2c')]({'where':{'closed':![]}});})[_0xdf3c('0x2f')](function(_0x2cab31){_0x427a90=_0x2cab31;if(_0x5f557c&&_0x2cab31>_0x5f557c){return db[_0xdf3c('0x10f')]['findOne']({'where':{'id':0x1}})[_0xdf3c('0x2f')](function(_0x462195){if(_0x462195){_0x462195['increment'](_0xdf3c('0x110'));}});}})['then'](function(){var _0x32c476=_0x2fc1d8[_0xdf3c('0x9b')];var _0xa6fa19=_0x2fc1d8[_0xdf3c('0x111')]||undefined;return _0x32c476?_0x32c476['ifTime'](_0xa6fa19):!![];})['then'](function(_0xa523c8){var _0x52ae27=fs[_0xdf3c('0xe2')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],'server/files/chat/iframe.ejs'),_0xdf3c('0xe4'));var _0x148785=_0xdf3c('0x112');var _0x2b0e64=![];var _0x479252,_0x5696dd;if(_0x1a1ac0[_0xdf3c('0xb9')]['referer']){_0x479252=new URL(_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x3d')])[_0xdf3c('0x113')];}else if(_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x113')]){_0x479252=new URL(_0x1a1ac0['headers'][_0xdf3c('0x113')])[_0xdf3c('0x113')];}else{_0x479252=_0xdf3c('0x114');}_0x5696dd=typeof _0x2fc1d8['address'][_0xdf3c('0x39')](',')[_0xdf3c('0x64')](function(_0x8f769e){return wildcardUtils[_0xdf3c('0x115')](_0x8f769e,_0x479252);})!==_0xdf3c('0x2a');var _0xc2306c={'chatVersion':_0x148785,'chatWebsiteAddressOrigin':_0x5696dd?_0x479252:_0x2fc1d8[_0xdf3c('0x66')],'remote':_0x2fc1d8['remote'],'query':querystring['stringify'](_[_0xdf3c('0x5a')](_0x2fc1d8['get']({'plain':!![]}),{'customerIp':_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x38')]||_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x116')]||_0x1a1ac0['connection'][_0xdf3c('0x117')]||_0x1a1ac0['ip'],'referer':_0x1a1ac0['headers'][_0xdf3c('0x3d')],'openedInteractions':_0x427a90,'maxInteractions':_0x5f557c,'virtual':_0x559e83['virtual'],'online':_0xa523c8,'custom':_0x559e83,'address':_0x5696dd?_0x479252:null}))[_0xdf3c('0x118')](/'/g,'\x5c\x27')};_0x22d16f[_0xdf3c('0xdb')](ejs[_0xdf3c('0xe5')](Mustache[_0xdf3c('0xe5')](_0x52ae27,_0xc2306c),{'proactiveActions':_0x2c2775,'alignment':_0x2fc1d8[_0xdf3c('0x119')],'verticalAlignment':_0x2fc1d8[_0xdf3c('0x11a')],'div_color':_0x2fc1d8[_0xdf3c('0x10b')],'labelText':_0x2fc1d8['labelText'],'text_color':_0x2fc1d8[_0xdf3c('0x11b')],'text_button_color':_0x2fc1d8[_0xdf3c('0x11c')],'button_color':_0x2fc1d8[_0xdf3c('0x11d')],'background_color':_0x2fc1d8[_0xdf3c('0x11e')],'hideWhenOffline':_0x2fc1d8['hideWhenOffline'],'intervalId':_0x2fc1d8[_0xdf3c('0x11f')],'isDevelopment':_0x2b0e64,'chatVersion':_0x148785}));})[_0xdf3c('0x25')](handleError(_0x22d16f,null));};exports[_0xdf3c('0x120')]=function(_0x2ac5c7,_0x361143){var _0x526533=_0x2ac5c7['params']['id'];var _0x54a06b=_0x2ac5c7[_0xdf3c('0x65')];var _0x47bef6=0xc8;var _0x3ff664=null;return db['sequelize'][_0xdf3c('0x121')]({'isolationLevel':db[_0xdf3c('0xee')][_0xdf3c('0x122')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4dd133){return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x526533},'transaction':_0x4dd133})['then'](function(_0x3819cd){if(_0x3819cd){return db[_0xdf3c('0xaf')][_0xdf3c('0x32')]({'where':{'ChatWebsiteId':_0x526533},'transaction':_0x4dd133})[_0xdf3c('0x2f')](function(){var _0xa729d1=_[_0xdf3c('0x4b')](_0x54a06b,function(_0x2e0bf3){_0x2e0bf3[_0xdf3c('0x77')]=_0x526533;return _0x2e0bf3;});return db['ChatApplication'][_0xdf3c('0x123')](_0xa729d1,{'transaction':_0x4dd133});});}else{_0x47bef6=0x194;_0x3ff664=[];}});})[_0xdf3c('0x2f')](function(){if(_0x47bef6!==0x194){return db[_0xdf3c('0xaf')][_0xdf3c('0x124')]({'where':{'ChatWebsiteId':_0x526533},'order':_0xdf3c('0x125')})['then'](function(_0x461212){_0x3ff664=_0x461212;});}})[_0xdf3c('0x25')](function(_0x41f47a){_0x47bef6=0x1f4;logger[_0xdf3c('0x21')](_0x41f47a[_0xdf3c('0x33')]);if(_0x41f47a[_0xdf3c('0x3f')]){delete _0x41f47a['name'];}_0x3ff664=_0x41f47a;})[_0xdf3c('0x126')](function(){if(_0x3ff664===null){_0x361143['sendStatus'](_0x47bef6);}else{if(_0x47bef6===0x1f4){_0x361143[_0xdf3c('0x27')](_0x47bef6)[_0xdf3c('0xdb')](_0x3ff664);}else{_0x361143[_0xdf3c('0x27')](_0x47bef6)[_0xdf3c('0x28')](_0x3ff664);}}});};exports[_0xdf3c('0x127')]=function(_0x2724b6,_0x3c1a8a){var _0x3b0c07={};var _0x40506e={};var _0x4b46cf;var _0x31cdad;return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x2724b6['params']['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3c1a8a,null))['then'](function(_0xddf03e){if(_0xddf03e){_0x4b46cf=_0xddf03e;_0x40506e[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db[_0xdf3c('0xaf')][_0xdf3c('0x4d')]);_0x40506e[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x2724b6[_0xdf3c('0x4f')]);_0x40506e[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x40506e[_0xdf3c('0x45')],_0x40506e[_0xdf3c('0x4f')]);_0x3b0c07['attributes']=_['intersection'](_0x40506e['model'],qs[_0xdf3c('0x53')](_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x3b0c07[_0xdf3c('0x52')]=_0x3b0c07[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x3b0c07[_0xdf3c('0x52')]:_0x40506e[_0xdf3c('0x45')];_0x3b0c07[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x3b0c07[_0xdf3c('0x58')]=qs['filters'](_['pick'](_0x2724b6[_0xdf3c('0x4f')],_0x40506e[_0xdf3c('0x51')]));if(_0x2724b6[_0xdf3c('0x4f')]['filter']){_0x3b0c07[_0xdf3c('0x58')]=_['merge'](_0x3b0c07[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x3b0c07['attributes'],function(_0xabf05c){var _0x2e4a90={};_0x2e4a90[_0xabf05c]={'$like':'%'+_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x2e4a90;})});}_0x3b0c07=_[_0xdf3c('0x5a')]({},_0x3b0c07,_0x2724b6[_0xdf3c('0x78')]);return _0x4b46cf[_0xdf3c('0x127')](_0x3b0c07);}})[_0xdf3c('0x2f')](function(_0x5e6a87){if(_0x5e6a87){_0x31cdad=_0x5e6a87[_0xdf3c('0x63')];if(!_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0x3b0c07['limit']=qs['limit'](_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0x3b0c07[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x2724b6['query']['offset']);}return _0x4b46cf[_0xdf3c('0x127')](_0x3b0c07);}})[_0xdf3c('0x2f')](function(_0x381d88){if(_0x381d88){return _0x381d88?{'count':_0x31cdad,'rows':_0x381d88}:null;}})['then'](respondWithResult(_0x3c1a8a,null))[_0xdf3c('0x25')](handleError(_0x3c1a8a,null));};exports['addProactiveActions']=function(_0x10bdce,_0x3cb78b){return db[_0xdf3c('0x128')]['find']({'where':{'id':_0x10bdce['params']['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3cb78b,null))[_0xdf3c('0x2f')](function(_0x3c0d93){if(_0x3c0d93){return _0x3c0d93['addProactiveActions'](_0x10bdce[_0xdf3c('0x65')][_0xdf3c('0x7a')],_['omit'](_0x10bdce[_0xdf3c('0x65')],[_0xdf3c('0x7a'),'id'])||{});}})[_0xdf3c('0x2f')](respondWithResult(_0x3cb78b,null))[_0xdf3c('0x25')](handleError(_0x3cb78b,null));};exports[_0xdf3c('0x10d')]=function(_0x3e8060,_0x1d61c5){var _0x7d5fda={};var _0x9f1875={};var _0x21e823;var _0xd66ea7;return db['ChatWebsite'][_0xdf3c('0x7d')]({'where':{'id':_0x3e8060[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x1d61c5,null))['then'](function(_0x6cce5f){if(_0x6cce5f){_0x21e823=_0x6cce5f;_0x9f1875[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db[_0xdf3c('0x129')]['rawAttributes']);_0x9f1875[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x3e8060[_0xdf3c('0x4f')]);_0x9f1875[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x9f1875[_0xdf3c('0x45')],_0x9f1875['query']);_0x7d5fda[_0xdf3c('0x52')]=_['intersection'](_0x9f1875[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x3e8060[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x7d5fda[_0xdf3c('0x52')]=_0x7d5fda[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x7d5fda[_0xdf3c('0x52')]:_0x9f1875['model'];_0x7d5fda[_0xdf3c('0x56')]=qs['sort'](_0x3e8060[_0xdf3c('0x4f')]['sort']);_0x7d5fda['where']=qs[_0xdf3c('0x51')](_[_0xdf3c('0x76')](_0x3e8060['query'],_0x9f1875[_0xdf3c('0x51')]));if(_0x3e8060['query']['filter']){_0x7d5fda[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x7d5fda[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x7d5fda[_0xdf3c('0x52')],function(_0x4280ac){var _0x2a2447={};_0x2a2447[_0x4280ac]={'$like':'%'+_0x3e8060[_0xdf3c('0x4f')]['filter']+'%'};return _0x2a2447;})});}_0x7d5fda=_[_0xdf3c('0x5a')]({},_0x7d5fda,_0x3e8060[_0xdf3c('0x78')]);return _0x21e823[_0xdf3c('0x10d')](_0x7d5fda);}})[_0xdf3c('0x2f')](function(_0x69233c){if(_0x69233c){_0xd66ea7=_0x69233c[_0xdf3c('0x63')];if(!_0x3e8060['query'][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0x7d5fda[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x3e8060['query']['limit']);_0x7d5fda[_0xdf3c('0x29')]=qs['offset'](_0x3e8060[_0xdf3c('0x4f')]['offset']);}return _0x21e823[_0xdf3c('0x10d')](_0x7d5fda);}})[_0xdf3c('0x2f')](function(_0x58d739){if(_0x58d739){return _0x58d739?{'count':_0xd66ea7,'rows':_0x58d739}:null;}})[_0xdf3c('0x2f')](respondWithResult(_0x1d61c5,null))[_0xdf3c('0x25')](handleError(_0x1d61c5,null));};exports[_0xdf3c('0x12a')]=function(_0x346270,_0x2c732e){var _0x396f50=_0x346270['query']['online']===_0xdf3c('0x12b')?'offlineForm':_0xdf3c('0x12c');return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'attributes':['id',_0x396f50],'where':{'id':_0x346270[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x2c732e,null))[_0xdf3c('0x2f')](function(_0x5ef7a6){if(_0x5ef7a6){var _0x54acce=_0x5ef7a6[_0x396f50];var _0x58a7b7=_0x54acce&&_0x54acce[_0xdf3c('0x12d')]?_0x54acce['items']:[];_0x2c732e[_0xdf3c('0xdb')]({'fromKey':_[_0xdf3c('0x94')](_0x54acce['fromKey'])?undefined:_0x54acce[_0xdf3c('0x12e')],'count':_0x58a7b7[_0xdf3c('0x63')],'rows':_0x58a7b7});}})[_0xdf3c('0x25')](handleError(_0x2c732e,null));};exports[_0xdf3c('0x12f')]=function(_0x2beff1,_0x4264e6){var _0x26dbe6={'raw':![],'where':{}};var _0xdb9eb4={};var _0x5adb7b={'count':0x0,'rows':[]};return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x2beff1[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x4264e6,null))[_0xdf3c('0x2f')](function(_0x120f66){if(_0x120f66){_0xdb9eb4[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db[_0xdf3c('0xe7')][_0xdf3c('0x4d')]);_0xdb9eb4[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x2beff1[_0xdf3c('0x4f')]);_0xdb9eb4[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0xdb9eb4['model'],_0xdb9eb4[_0xdf3c('0x4f')]);_0x26dbe6['attributes']=_[_0xdf3c('0x62')](_0xdb9eb4[_0xdf3c('0x45')],qs['fields'](_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x26dbe6['attributes']=_0x26dbe6[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x26dbe6[_0xdf3c('0x52')]:_0xdb9eb4[_0xdf3c('0x45')];if(!_0x2beff1['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x26dbe6[_0xdf3c('0x2b')]=qs['limit'](_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0x26dbe6[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x29')]);}_0x26dbe6[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x2beff1['query'][_0xdf3c('0x57')]);_0x26dbe6[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_[_0xdf3c('0x76')](_0x2beff1[_0xdf3c('0x4f')],_0xdb9eb4[_0xdf3c('0x51')]));_0x26dbe6[_0xdf3c('0x58')]['ChatWebsiteId']=_0x120f66['id'];if(_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x26dbe6[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x26dbe6[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x26dbe6[_0xdf3c('0x52')],function(_0x14d34d){var _0x367cf0={};_0x367cf0[_0x14d34d]={'$like':'%'+_0x2beff1[_0xdf3c('0x4f')]['filter']+'%'};return _0x367cf0;})});}_0x26dbe6=_[_0xdf3c('0x5a')]({},_0x26dbe6,_0x2beff1[_0xdf3c('0x78')]);return db[_0xdf3c('0xe7')][_0xdf3c('0x2c')]({'where':_0x26dbe6[_0xdf3c('0x58')]})[_0xdf3c('0x2f')](function(_0x82b7ee){_0x5adb7b[_0xdf3c('0x2c')]=_0x82b7ee;if(_0x2beff1['query']['includeAll']){_0x26dbe6[_0xdf3c('0x5d')]=[{'all':!![]}];}else{_0x26dbe6['include']=[{'model':db[_0xdf3c('0xac')],'as':_0xdf3c('0x107'),'required':![]},{'model':db[_0xdf3c('0xef')],'as':_0xdf3c('0x130'),'required':![]}];}return db[_0xdf3c('0xe7')]['findAll'](_0x26dbe6);})[_0xdf3c('0x2f')](function(_0xf864e2){_0x5adb7b[_0xdf3c('0x5f')]=_0xf864e2;return _0x5adb7b;});}})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x4264e6,_0x26dbe6))[_0xdf3c('0x25')](handleError(_0x4264e6,null));};exports['addAgents']=function(_0x4fcf64,_0x471f69){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x4fcf64[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x471f69,null))[_0xdf3c('0x2f')](function(_0x4fe59c){if(_0x4fe59c){return _0x4fe59c[_0xdf3c('0x131')](_0x4fcf64[_0xdf3c('0x65')][_0xdf3c('0x7a')],_['omit'](_0x4fcf64['body'],[_0xdf3c('0x7a'),'id'])||{})['spread'](function(_0x4dc604){for(var _0x136935=0x0;_0x136935<_0x4fcf64[_0xdf3c('0x65')]['ids'][_0xdf3c('0x63')];_0x136935+=0x1){socket[_0xdf3c('0x132')](_0xdf3c('0x133'),{'UserId':Number(_0x4fcf64[_0xdf3c('0x65')][_0xdf3c('0x7a')][_0x136935]),'ChatWebsiteId':Number(_0x4fcf64[_0xdf3c('0x61')]['id'])});}return _0x4dc604;});}})[_0xdf3c('0x2f')](respondWithResult(_0x471f69,null))['catch'](handleError(_0x471f69,null));};exports['removeAgents']=function(_0x3dc2da,_0x413aa3){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3dc2da[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x413aa3,null))[_0xdf3c('0x2f')](function(_0x20e6b0){if(_0x20e6b0){return _0x20e6b0[_0xdf3c('0x134')](_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')])[_0xdf3c('0x2f')](function(){if(_['isArray'](_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')])){for(var _0x20d58c=0x0;_0x20d58c<_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')][_0xdf3c('0x63')];_0x20d58c+=0x1){socket[_0xdf3c('0x132')](_0xdf3c('0x135'),{'UserId':Number(_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')][_0x20d58c]),'ChatWebsiteId':Number(_0x3dc2da['params']['id'])});}}else{socket[_0xdf3c('0x132')](_0xdf3c('0x135'),{'UserId':Number(_0x3dc2da[_0xdf3c('0x4f')]['ids']),'ChatWebsiteId':Number(_0x3dc2da[_0xdf3c('0x61')]['id'])});}});}})[_0xdf3c('0x2f')](respondWithStatusCode(_0x413aa3,null))[_0xdf3c('0x25')](handleError(_0x413aa3,null));};exports[_0xdf3c('0x136')]=function(_0x5226da,_0x1c9417){var _0x5e7070={};var _0xd096c7={};var _0x2af066;var _0x4a9157;return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x5226da[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x1c9417,null))['then'](function(_0x5b59e6){if(_0x5b59e6){_0x2af066=_0x5b59e6;_0xd096c7[_0xdf3c('0x45')]=_['keys'](db[_0xdf3c('0xcc')]['rawAttributes']);_0xd096c7[_0xdf3c('0x4f')]=_['keys'](_0x5226da[_0xdf3c('0x4f')]);_0xd096c7[_0xdf3c('0x51')]=_['intersection'](_0xd096c7[_0xdf3c('0x45')],_0xd096c7['query']);_0x5e7070[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0xd096c7[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x5226da[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x5e7070['attributes']=_0x5e7070['attributes'][_0xdf3c('0x63')]?_0x5e7070['attributes']:_0xd096c7[_0xdf3c('0x45')];_0x5e7070[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x5226da['query'][_0xdf3c('0x57')]);_0x5e7070[_0xdf3c('0x58')]=qs['filters'](_['pick'](_0x5226da[_0xdf3c('0x4f')],_0xd096c7['filters']));if(_0x5226da[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x5e7070[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x5e7070['where'],{'$or':_['map'](_0x5e7070[_0xdf3c('0x52')],function(_0xc5ad19){var _0x275ac3={};_0x275ac3[_0xc5ad19]={'$like':'%'+_0x5226da[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x275ac3;})});}_0x5e7070=_['merge']({},_0x5e7070,_0x5226da[_0xdf3c('0x78')]);return _0x2af066[_0xdf3c('0x136')](_0x5e7070);}})[_0xdf3c('0x2f')](function(_0x17a760){if(_0x17a760){_0x4a9157=_0x17a760[_0xdf3c('0x63')];if(!_0x5226da[_0xdf3c('0x4f')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x5e7070['limit']=qs[_0xdf3c('0x2b')](_0x5226da['query'][_0xdf3c('0x2b')]);_0x5e7070[_0xdf3c('0x29')]=qs['offset'](_0x5226da[_0xdf3c('0x4f')]['offset']);}return _0x2af066[_0xdf3c('0x136')](_0x5e7070);}})[_0xdf3c('0x2f')](function(_0x241f9d){if(_0x241f9d){return _0x241f9d?{'count':_0x4a9157,'rows':_0x241f9d}:null;}})[_0xdf3c('0x2f')](respondWithResult(_0x1c9417,null))[_0xdf3c('0x25')](handleError(_0x1c9417,null));}; \ No newline at end of file +var _0xb458=['ChatWebsites','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','model','vendor','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','body','address','forEach','trim','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','params','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','existsSync','download','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Intervals','interval','account','applications','orderBy','priority','asc','list','defaults','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','Sequelize','ValidationError','difference','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','files','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','openNewInteraction','toPairsIn','subjectOffline','email','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','remove','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','origin','x-real-ip','remoteAddress','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','url','URL','localhost','socket.io-emitter','redis','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','get'];(function(_0x3f7e37,_0x32f790){var _0x2a3ec7=function(_0x32922c){while(--_0x32922c){_0x3f7e37['push'](_0x3f7e37['shift']());}};_0x2a3ec7(++_0x32f790);}(_0xb458,0x103));var _0x8b45=function(_0x1ec606,_0x1a2d83){_0x1ec606=_0x1ec606-0x0;var _0x5418e4=_0xb458[_0x1ec606];return _0x5418e4;};'use strict';var Mustache=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b45('0x3'));var querystring=require(_0x8b45('0x4'));var htmlToText=require(_0x8b45('0x5'));var Redis=require(_0x8b45('0x6'));var jayson=require('jayson/promise');var qs=require(_0x8b45('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x8b45('0x8'));var APIBadRequestError=require(_0x8b45('0x9'))[_0x8b45('0xa')];var APINotFoundError=require(_0x8b45('0x9'))[_0x8b45('0xb')];var APIOutOfIntervalError=require('../../errors/api')[_0x8b45('0xc')];var APIHandleError=require(_0x8b45('0x9'))[_0x8b45('0xd')];var APIConflictError=require(_0x8b45('0x9'))[_0x8b45('0xe')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0x8b45('0xf'))[_0x8b45('0x10')];var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x8b45('0x11'),'port':0x18eb});var socket=require(_0x8b45('0x12'))(new Redis(config[_0x8b45('0x13')]));require('./chatWebsite.socket')[_0x8b45('0x14')](socket);var client=jayson[_0x8b45('0x15')][_0x8b45('0x16')]({'port':0x232c});var client9002=jayson[_0x8b45('0x15')][_0x8b45('0x16')]({'port':0x232a});var client9003=jayson[_0x8b45('0x15')]['http']({'port':0x232b});var client9001=jayson['client'][_0x8b45('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x23f1dd,_0x445170,_0x39c1d1,_0x4781d7){return new Promise(function(_0x27ebb3,_0x902c50){var _0x147d6b=_0x4781d7||client;return _0x147d6b[_0x8b45('0x17')](_0x23f1dd,_0x39c1d1)[_0x8b45('0x18')](function(_0x287a3b){logger[_0x8b45('0x19')](_0x8b45('0x1a'),_0x445170,_0x8b45('0x1b'));logger[_0x8b45('0x1c')](_0x8b45('0x1d'),_0x445170,_0x8b45('0x1b'),JSON[_0x8b45('0x1e')](_0x287a3b));if(_0x287a3b['error']){if(_0x287a3b[_0x8b45('0x1f')][_0x8b45('0x20')]===0x1f4){logger[_0x8b45('0x1f')](_0x8b45('0x1a'),_0x445170,_0x287a3b[_0x8b45('0x1f')][_0x8b45('0x21')]);return _0x902c50(_0x287a3b[_0x8b45('0x1f')][_0x8b45('0x21')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x445170,_0x287a3b[_0x8b45('0x1f')]['message']);return _0x27ebb3(_0x287a3b[_0x8b45('0x1f')][_0x8b45('0x21')]);}else{logger[_0x8b45('0x19')](_0x8b45('0x1a'),_0x445170,_0x8b45('0x1b'));_0x27ebb3(_0x287a3b[_0x8b45('0x22')][_0x8b45('0x21')]);}})['catch'](function(_0x59d36b){logger[_0x8b45('0x1f')](_0x8b45('0x1a'),_0x445170,_0x59d36b);_0x902c50(_0x59d36b);});});}function respondWithStatusCode(_0x500044,_0x5723a2){_0x5723a2=_0x5723a2||0xcc;return function(_0x129c35){if(_0x129c35){return _0x500044[_0x8b45('0x23')](_0x5723a2);}return _0x500044[_0x8b45('0x24')](_0x5723a2)[_0x8b45('0x25')]();};}function respondWithResult(_0x4e84cc,_0x3df287){_0x3df287=_0x3df287||0xc8;return function(_0x24be07){if(_0x24be07){return _0x4e84cc[_0x8b45('0x24')](_0x3df287)[_0x8b45('0x26')](_0x24be07);}};}function respondWithFilteredResult(_0x395dc3,_0xf334b2){return function(_0x461017){if(_0x461017){var _0x234f62=typeof _0xf334b2[_0x8b45('0x27')]===_0x8b45('0x28')&&typeof _0xf334b2[_0x8b45('0x29')]===_0x8b45('0x28');var _0x5b6151=_0x461017['count'];var _0x1d98c3=_0x234f62?0x0:_0xf334b2[_0x8b45('0x27')];var _0x34eb03=_0x234f62?_0x461017[_0x8b45('0x2a')]:_0xf334b2[_0x8b45('0x27')]+_0xf334b2[_0x8b45('0x29')];var _0x1a8974;if(_0x34eb03>=_0x5b6151){_0x34eb03=_0x5b6151;_0x1a8974=0xc8;}else{_0x1a8974=0xce;}_0x395dc3[_0x8b45('0x24')](_0x1a8974);return _0x395dc3['set'](_0x8b45('0x2b'),_0x1d98c3+'-'+_0x34eb03+'/'+_0x5b6151)[_0x8b45('0x26')](_0x461017);}return null;};}function saveUpdates(_0x50302){return function(_0xc2ae94){if(_0xc2ae94){return _0xc2ae94[_0x8b45('0x2c')](_0x50302)['then'](function(_0x29fbec){return _0x29fbec;});}return null;};}function removeEntity(_0x59f257){return function(_0x5a07de){if(_0x5a07de){return _0x5a07de[_0x8b45('0x2d')]()[_0x8b45('0x18')](function(){var _0xd3ba91=_0x5a07de[_0x8b45('0x2e')]({'plain':!![]});var _0x1e72d2=_0x8b45('0x2f');return db['UserProfileResource'][_0x8b45('0x2d')]({'where':{'type':_0x1e72d2,'resourceId':_0xd3ba91['id']}})[_0x8b45('0x18')](function(){return _0x5a07de;});})[_0x8b45('0x18')](function(){_0x59f257[_0x8b45('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b6fba){return function(_0x213037){if(!_0x213037){_0x1b6fba[_0x8b45('0x23')](0x194);}return _0x213037;};}function handleError(_0x55b76b,_0x29c606){_0x29c606=_0x29c606||0x1f4;return function(_0x475401){logger[_0x8b45('0x1f')](_0x475401['stack']);if(_0x475401[_0x8b45('0x30')]){delete _0x475401[_0x8b45('0x30')];}_0x55b76b[_0x8b45('0x24')](_0x29c606)[_0x8b45('0x31')](_0x475401);};}function createInteractionObject(_0x58d94f,_0x14788c,_0x1077bd,_0x2de02d){var _0x15df7c=require(_0x8b45('0x32'));var _0x9acf8=new _0x15df7c();var _0x56d959=_0x9acf8['setUA'](_0x1077bd[_0x8b45('0x33')])[_0x8b45('0x34')]();var _0x41d6b5=_0x14788c[_0x8b45('0x35')];if(_0x1077bd[_0x8b45('0x36')]){_0x41d6b5=_0x1077bd['cf-connecting-ip'];}else if(_0x1077bd[_0x8b45('0x37')]){_0x41d6b5=_['first'](_0x1077bd[_0x8b45('0x37')][_0x8b45('0x38')](','));}return{'ContactId':_0x2de02d['id'],'ChatWebsiteId':_0x58d94f,'from':(_0x2de02d[_0x8b45('0x39')]||'')+'\x20'+(_0x2de02d[_0x8b45('0x3a')]||''),'customerIp':_0x41d6b5,'customerPort':_0x1077bd[_0x8b45('0x3b')]?_0x1077bd[_0x8b45('0x3b')]:null,'referer':_0x14788c[_0x8b45('0x3c')],'browserName':_0x56d959[_0x8b45('0x3d')][_0x8b45('0x30')]&&_0x56d959[_0x8b45('0x3d')][_0x8b45('0x3e')]?util['format'](_0x8b45('0x3f'),_0x56d959['browser'][_0x8b45('0x30')],_0x56d959['browser'][_0x8b45('0x3e')]):_0x8b45('0x40'),'browserVersion':_0x56d959[_0x8b45('0x3d')][_0x8b45('0x3e')]||_0x8b45('0x40'),'osName':util[_0x8b45('0x41')]('%s\x20%s',_0x56d959['os'][_0x8b45('0x30')],_0x56d959['os']['version']),'osVersion':_0x56d959['os']['version'],'deviceModel':_0x56d959[_0x8b45('0x42')][_0x8b45('0x43')]&&_0x56d959[_0x8b45('0x42')]['vendor']?util[_0x8b45('0x41')]('%s\x20%s\x20%s',_0x56d959[_0x8b45('0x42')][_0x8b45('0x43')],_0x56d959[_0x8b45('0x42')][_0x8b45('0x44')],_0x56d959[_0x8b45('0x42')][_0x8b45('0x45')]):null,'deviceVendor':_0x56d959['device'][_0x8b45('0x44')],'deviceType':_0x56d959[_0x8b45('0x42')][_0x8b45('0x45')],'formData':JSON[_0x8b45('0x1e')](_0x14788c)};}exports[_0x8b45('0x46')]=function(_0x11ba01,_0x371553){var _0x3de3c2={'include':[{'model':db[_0x8b45('0x47')],'as':_0x8b45('0x48')}]},_0x37b94a={},_0x462b51={'count':0x0,'rows':[]};var _0x1a87e4=_[_0x8b45('0x49')](db[_0x8b45('0x4a')][_0x8b45('0x4b')],function(_0x5e9499){return{'name':_0x5e9499['fieldName'],'type':_0x5e9499['type'][_0x8b45('0x4c')]};});_0x37b94a[_0x8b45('0x43')]=_[_0x8b45('0x49')](_0x1a87e4,_0x8b45('0x30'));_0x37b94a[_0x8b45('0x4d')]=_[_0x8b45('0x4e')](_0x11ba01[_0x8b45('0x4d')]);_0x37b94a[_0x8b45('0x4f')]=_['intersection'](_0x37b94a[_0x8b45('0x43')],_0x37b94a['query']);_0x3de3c2[_0x8b45('0x50')]=_[_0x8b45('0x51')](_0x37b94a[_0x8b45('0x43')],qs[_0x8b45('0x52')](_0x11ba01['query'][_0x8b45('0x52')]));_0x3de3c2[_0x8b45('0x50')]=_0x3de3c2['attributes'][_0x8b45('0x53')]?_0x3de3c2[_0x8b45('0x50')]:_0x37b94a['model'];if(!_0x11ba01[_0x8b45('0x4d')][_0x8b45('0x54')](_0x8b45('0x55'))){_0x3de3c2[_0x8b45('0x29')]=qs[_0x8b45('0x29')](_0x11ba01[_0x8b45('0x4d')]['limit']);_0x3de3c2['offset']=qs[_0x8b45('0x27')](_0x11ba01[_0x8b45('0x4d')][_0x8b45('0x27')]);}_0x3de3c2['order']=qs[_0x8b45('0x56')](_0x11ba01[_0x8b45('0x4d')][_0x8b45('0x56')]);_0x3de3c2[_0x8b45('0x57')]=qs[_0x8b45('0x4f')](_['pick'](_0x11ba01[_0x8b45('0x4d')],_0x37b94a[_0x8b45('0x4f')]),_0x1a87e4);if(_0x11ba01['query'][_0x8b45('0x58')]){_0x3de3c2['where']=_[_0x8b45('0x59')](_0x3de3c2[_0x8b45('0x57')],{'$or':_[_0x8b45('0x49')](_0x1a87e4,function(_0x39a609){if(_0x39a609['type']!==_0x8b45('0x5a')){var _0x423231={};_0x423231[_0x39a609[_0x8b45('0x30')]]={'$like':'%'+_0x11ba01[_0x8b45('0x4d')][_0x8b45('0x58')]+'%'};return _0x423231;}})});}_0x3de3c2=_[_0x8b45('0x59')]({},_0x3de3c2,_0x11ba01[_0x8b45('0x5b')]);var _0x2a35c1={'where':_0x3de3c2[_0x8b45('0x57')]};return db[_0x8b45('0x4a')][_0x8b45('0x2a')](_0x2a35c1)[_0x8b45('0x18')](function(_0x1405f3){_0x462b51[_0x8b45('0x2a')]=_0x1405f3;if(_0x11ba01[_0x8b45('0x4d')]['includeAll']){_0x3de3c2[_0x8b45('0x5c')]=[{'all':!![]}];}return db[_0x8b45('0x4a')][_0x8b45('0x5d')](_0x3de3c2);})['then'](function(_0x29fde9){_0x462b51[_0x8b45('0x5e')]=_0x29fde9;return _0x462b51;})[_0x8b45('0x18')](respondWithFilteredResult(_0x371553,_0x3de3c2))[_0x8b45('0x5f')](handleError(_0x371553,null));};exports['show']=function(_0x456c0e,_0x1a8822){var _0x1d99bb={'raw':![],'where':{'id':_0x456c0e['params']['id']},'include':[{'model':db[_0x8b45('0x47')],'as':_0x8b45('0x48')}]},_0xbb5e67={};_0xbb5e67[_0x8b45('0x43')]=_[_0x8b45('0x4e')](db[_0x8b45('0x4a')]['rawAttributes']);_0xbb5e67[_0x8b45('0x4d')]=_['keys'](_0x456c0e[_0x8b45('0x4d')]);_0xbb5e67[_0x8b45('0x4f')]=_[_0x8b45('0x51')](_0xbb5e67[_0x8b45('0x43')],_0xbb5e67[_0x8b45('0x4d')]);_0x1d99bb[_0x8b45('0x50')]=_['intersection'](_0xbb5e67['model'],qs[_0x8b45('0x52')](_0x456c0e[_0x8b45('0x4d')]['fields']));_0x1d99bb[_0x8b45('0x50')]=_0x1d99bb[_0x8b45('0x50')][_0x8b45('0x53')]?_0x1d99bb['attributes']:_0xbb5e67['model'];if(_0x456c0e[_0x8b45('0x4d')][_0x8b45('0x60')]){_0x1d99bb['include']=[{'all':!![]}];}_0x1d99bb=_[_0x8b45('0x59')]({},_0x1d99bb,_0x456c0e['options']);return db[_0x8b45('0x4a')]['find'](_0x1d99bb)['then'](handleEntityNotFound(_0x1a8822,null))[_0x8b45('0x18')](respondWithResult(_0x1a8822,null))[_0x8b45('0x5f')](handleError(_0x1a8822,null));};exports['create']=function(_0x324592,_0x73ec44){var _0x165b1c=null;_0x324592[_0x8b45('0x61')][_0x8b45('0x62')]['split'](',')[_0x8b45('0x63')](_0x3b3d21=>{if(_0x3b3d21[_0x8b45('0x64')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x3b3d21['trim']())){_0x165b1c=new APIBadRequestError('\x22'+_0x3b3d21[_0x8b45('0x64')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x165b1c){return handleError(_0x73ec44,null)(_0x165b1c);}return db[_0x8b45('0x4a')]['create'](_0x324592['body'],{})['then'](function(_0x2e3d2f){var _0x4df581=_0x324592[_0x8b45('0x65')][_0x8b45('0x2e')]({'plain':!![]});if(!_0x4df581)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4df581[_0x8b45('0x66')]===_0x8b45('0x65')){var _0x5f3477=_0x2e3d2f[_0x8b45('0x2e')]({'plain':!![]});var _0x46b686=_0x8b45('0x2f');return db[_0x8b45('0x67')][_0x8b45('0x68')]({'where':{'name':_0x46b686,'userProfileId':_0x4df581[_0x8b45('0x69')]},'raw':!![]})[_0x8b45('0x18')](function(_0x35048c){if(_0x35048c&&_0x35048c[_0x8b45('0x6a')]===0x0){return db[_0x8b45('0x6b')][_0x8b45('0x6c')]({'name':_0x5f3477[_0x8b45('0x30')],'resourceId':_0x5f3477['id'],'type':_0x35048c['name'],'sectionId':_0x35048c['id']},{})[_0x8b45('0x18')](function(){return _0x2e3d2f;});}else{return _0x2e3d2f;}})[_0x8b45('0x5f')](function(_0x283eb6){logger[_0x8b45('0x1f')](_0x8b45('0x6d'),_0x283eb6);throw _0x283eb6;});}return _0x2e3d2f;})[_0x8b45('0x18')](respondWithResult(_0x73ec44,0xc9))[_0x8b45('0x5f')](handleError(_0x73ec44,null));};exports[_0x8b45('0x2c')]=function(_0x243632,_0x1542db){var _0x183c34=null;_0x243632[_0x8b45('0x61')][_0x8b45('0x62')][_0x8b45('0x38')](',')[_0x8b45('0x63')](_0x53143d=>{if(_0x53143d[_0x8b45('0x64')]()!==''&&!wildcardUtils[_0x8b45('0x6e')](_0x53143d[_0x8b45('0x64')]())){_0x183c34=new APIBadRequestError('\x22'+_0x53143d[_0x8b45('0x64')]()+_0x8b45('0x6f'));}});if(_0x183c34){return handleError(_0x1542db,null)(_0x183c34);}if(_0x243632[_0x8b45('0x61')]['id']){delete _0x243632[_0x8b45('0x61')]['id'];}return db[_0x8b45('0x4a')]['find']({'where':{'id':_0x243632[_0x8b45('0x70')]['id']},'include':[{'model':db[_0x8b45('0x47')],'as':_0x8b45('0x48')}]})[_0x8b45('0x18')](handleEntityNotFound(_0x1542db,null))[_0x8b45('0x18')](saveUpdates(_0x243632[_0x8b45('0x61')],null))[_0x8b45('0x18')](respondWithResult(_0x1542db,null))[_0x8b45('0x5f')](handleError(_0x1542db,null));};exports[_0x8b45('0x2d')]=function(_0xd19d7c,_0x2d0045){return db['ChatWebsite']['find']({'where':{'id':_0xd19d7c[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x2d0045,null))[_0x8b45('0x18')](removeEntity(_0x2d0045,null))[_0x8b45('0x5f')](handleError(_0x2d0045,null));};exports[_0x8b45('0x71')]=function(_0x19b851,_0x6cdd2b){return db[_0x8b45('0x4a')][_0x8b45('0x71')]()['then'](respondWithResult(_0x6cdd2b,null))['catch'](handleError(_0x6cdd2b,null));};exports[_0x8b45('0x72')]=function(_0x28b0b9,_0x19497b){if(_0x28b0b9[_0x8b45('0x61')]['id']){delete _0x28b0b9['body']['id'];}return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x28b0b9[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x19497b,null))[_0x8b45('0x18')](function(_0x17588b){if(_0x17588b){_0x28b0b9['body']['ChatWebsiteId']=_0x17588b['id'];return db[_0x8b45('0x73')]['create'](_0x28b0b9['body']);}})['then'](respondWithResult(_0x19497b,null))[_0x8b45('0x5f')](handleError(_0x19497b,null));};exports[_0x8b45('0x74')]=function(_0xcc1330,_0x1e7a9c){var _0x430551={'raw':![],'where':{}};var _0x37ef4c={};var _0x274902={'count':0x0,'rows':[]};return db[_0x8b45('0x4a')][_0x8b45('0x75')]({'where':{'id':_0xcc1330[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x1e7a9c,null))[_0x8b45('0x18')](function(_0x324d93){if(_0x324d93){_0x37ef4c[_0x8b45('0x43')]=_[_0x8b45('0x4e')](db['Disposition'][_0x8b45('0x4b')]);_0x37ef4c[_0x8b45('0x4d')]=_[_0x8b45('0x4e')](_0xcc1330[_0x8b45('0x4d')]);_0x37ef4c[_0x8b45('0x4f')]=_[_0x8b45('0x51')](_0x37ef4c[_0x8b45('0x43')],_0x37ef4c[_0x8b45('0x4d')]);_0x430551[_0x8b45('0x50')]=_[_0x8b45('0x51')](_0x37ef4c['model'],qs[_0x8b45('0x52')](_0xcc1330[_0x8b45('0x4d')][_0x8b45('0x52')]));_0x430551[_0x8b45('0x50')]=_0x430551['attributes'][_0x8b45('0x53')]?_0x430551['attributes']:_0x37ef4c[_0x8b45('0x43')];if(!_0xcc1330['query'][_0x8b45('0x54')](_0x8b45('0x55'))){_0x430551[_0x8b45('0x29')]=qs[_0x8b45('0x29')](_0xcc1330[_0x8b45('0x4d')][_0x8b45('0x29')]);_0x430551['offset']=qs[_0x8b45('0x27')](_0xcc1330[_0x8b45('0x4d')][_0x8b45('0x27')]);}_0x430551[_0x8b45('0x76')]=qs['sort'](_0xcc1330[_0x8b45('0x4d')][_0x8b45('0x56')]);_0x430551['where']=qs['filters'](_[_0x8b45('0x77')](_0xcc1330[_0x8b45('0x4d')],_0x37ef4c[_0x8b45('0x4f')]));_0x430551['where'][_0x8b45('0x78')]=_0x324d93['id'];if(_0xcc1330['query'][_0x8b45('0x58')]){_0x430551[_0x8b45('0x57')]=_['merge'](_0x430551['where'],{'$or':_[_0x8b45('0x49')](_0x430551[_0x8b45('0x50')],function(_0x445bca){var _0x36e785={};_0x36e785[_0x445bca]={'$like':'%'+_0xcc1330['query'][_0x8b45('0x58')]+'%'};return _0x36e785;})});}_0x430551=_[_0x8b45('0x59')]({},_0x430551,_0xcc1330[_0x8b45('0x5b')]);return db[_0x8b45('0x73')][_0x8b45('0x2a')]({'where':_0x430551[_0x8b45('0x57')]})['then'](function(_0x175269){_0x274902[_0x8b45('0x2a')]=_0x175269;if(_0xcc1330['query'][_0x8b45('0x60')]){_0x430551[_0x8b45('0x5c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x430551);})['then'](function(_0x186aa2){_0x274902[_0x8b45('0x5e')]=_0x186aa2;return _0x274902;});}})[_0x8b45('0x18')](respondWithFilteredResult(_0x1e7a9c,_0x430551))[_0x8b45('0x5f')](handleError(_0x1e7a9c,null));};exports[_0x8b45('0x79')]=function(_0x378e53,_0xd4b4eb){return db['ChatWebsite'][_0x8b45('0x68')]({'where':{'id':_0x378e53[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0xd4b4eb,null))[_0x8b45('0x18')](function(_0x2fde22){if(_0x2fde22){return _0x2fde22[_0x8b45('0x79')](_0x378e53['query'][_0x8b45('0x7a')]);}})[_0x8b45('0x18')](respondWithStatusCode(_0xd4b4eb,null))[_0x8b45('0x5f')](handleError(_0xd4b4eb,null));};exports[_0x8b45('0x7b')]=function(_0x224b7a,_0x4c3bc9){if(_0x224b7a['body']['id']){delete _0x224b7a[_0x8b45('0x61')]['id'];}return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x224b7a[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x4c3bc9,null))['then'](function(_0x1f7f33){if(_0x1f7f33){_0x224b7a['body'][_0x8b45('0x78')]=_0x1f7f33['id'];return db['CannedAnswer'][_0x8b45('0x6c')](_0x224b7a[_0x8b45('0x61')]);}})[_0x8b45('0x18')](respondWithResult(_0x4c3bc9,null))[_0x8b45('0x5f')](handleError(_0x4c3bc9,null));};exports[_0x8b45('0x7c')]=function(_0x2b8492,_0x19cea1){var _0x46f88={'raw':![],'where':{}};var _0x39d000={};var _0xfff1e={'count':0x0,'rows':[]};return db[_0x8b45('0x4a')][_0x8b45('0x75')]({'where':{'id':_0x2b8492[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x19cea1,null))['then'](function(_0x3db51c){if(_0x3db51c){_0x39d000[_0x8b45('0x43')]=_[_0x8b45('0x4e')](db['CannedAnswer'][_0x8b45('0x4b')]);_0x39d000['query']=_[_0x8b45('0x4e')](_0x2b8492[_0x8b45('0x4d')]);_0x39d000['filters']=_[_0x8b45('0x51')](_0x39d000['model'],_0x39d000[_0x8b45('0x4d')]);_0x46f88[_0x8b45('0x50')]=_[_0x8b45('0x51')](_0x39d000[_0x8b45('0x43')],qs[_0x8b45('0x52')](_0x2b8492[_0x8b45('0x4d')]['fields']));_0x46f88['attributes']=_0x46f88[_0x8b45('0x50')][_0x8b45('0x53')]?_0x46f88['attributes']:_0x39d000['model'];if(!_0x2b8492['query'][_0x8b45('0x54')]('nolimit')){_0x46f88[_0x8b45('0x29')]=qs[_0x8b45('0x29')](_0x2b8492[_0x8b45('0x4d')][_0x8b45('0x29')]);_0x46f88['offset']=qs[_0x8b45('0x27')](_0x2b8492[_0x8b45('0x4d')][_0x8b45('0x27')]);}_0x46f88[_0x8b45('0x76')]=qs[_0x8b45('0x56')](_0x2b8492[_0x8b45('0x4d')][_0x8b45('0x56')]);_0x46f88[_0x8b45('0x57')]=qs['filters'](_[_0x8b45('0x77')](_0x2b8492['query'],_0x39d000[_0x8b45('0x4f')]));_0x46f88['where']['ChatWebsiteId']=_0x3db51c['id'];if(_0x2b8492['query'][_0x8b45('0x58')]){_0x46f88[_0x8b45('0x57')]=_['merge'](_0x46f88[_0x8b45('0x57')],{'$or':_[_0x8b45('0x49')](_0x46f88[_0x8b45('0x50')],function(_0x18a754){var _0x123610={};_0x123610[_0x18a754]={'$like':'%'+_0x2b8492[_0x8b45('0x4d')][_0x8b45('0x58')]+'%'};return _0x123610;})});}_0x46f88=_[_0x8b45('0x59')]({},_0x46f88,_0x2b8492[_0x8b45('0x5b')]);return db['CannedAnswer'][_0x8b45('0x2a')]({'where':_0x46f88[_0x8b45('0x57')]})[_0x8b45('0x18')](function(_0x43545b){_0xfff1e['count']=_0x43545b;if(_0x2b8492[_0x8b45('0x4d')][_0x8b45('0x60')]){_0x46f88[_0x8b45('0x5c')]=[{'all':!![]}];}return db[_0x8b45('0x7d')][_0x8b45('0x5d')](_0x46f88);})['then'](function(_0xe58ecf){_0xfff1e['rows']=_0xe58ecf;return _0xfff1e;});}})[_0x8b45('0x18')](respondWithFilteredResult(_0x19cea1,_0x46f88))[_0x8b45('0x5f')](handleError(_0x19cea1,null));};exports['removeAnswers']=function(_0x574d49,_0x4c13c3){return db['ChatWebsite'][_0x8b45('0x68')]({'where':{'id':_0x574d49['params']['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x4c13c3,null))[_0x8b45('0x18')](function(_0x2af25b){if(_0x2af25b){return _0x2af25b['removeAnswers'](_0x574d49[_0x8b45('0x4d')]['ids']);}})[_0x8b45('0x18')](respondWithStatusCode(_0x4c13c3,null))[_0x8b45('0x5f')](handleError(_0x4c13c3,null));};exports[_0x8b45('0x7e')]=function(_0x1f62e0,_0x1c5e4c){_0x1f62e0[_0x8b45('0x61')][_0x8b45('0x7f')]=_0x1f62e0[_0x8b45('0x80')][_0x8b45('0x81')];return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x1f62e0[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x1c5e4c,null))[_0x8b45('0x18')](saveUpdates(_0x1f62e0[_0x8b45('0x61')],null))['then'](respondWithResult(_0x1c5e4c,null))[_0x8b45('0x5f')](handleError(_0x1c5e4c,null));};exports[_0x8b45('0x82')]=function(_0x49cf74,_0x49cc78){_0x49cf74[_0x8b45('0x61')][_0x8b45('0x83')]=_0x49cf74[_0x8b45('0x80')][_0x8b45('0x81')];return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x49cf74[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x49cc78,null))[_0x8b45('0x18')](saveUpdates(_0x49cf74['body'],null))[_0x8b45('0x18')](respondWithResult(_0x49cc78,null))[_0x8b45('0x5f')](handleError(_0x49cc78,null));};exports['addCustomerAvatar']=function(_0x76b6b,_0x2434a8){_0x76b6b[_0x8b45('0x61')][_0x8b45('0x84')]=_0x76b6b[_0x8b45('0x80')][_0x8b45('0x81')];return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x76b6b[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x2434a8,null))[_0x8b45('0x18')](saveUpdates(_0x76b6b[_0x8b45('0x61')],null))[_0x8b45('0x18')](respondWithResult(_0x2434a8,null))['catch'](handleError(_0x2434a8,null));};exports[_0x8b45('0x85')]=function(_0x5b7f57,_0x2714e6){_0x5b7f57[_0x8b45('0x61')][_0x8b45('0x86')]=_0x5b7f57['file'][_0x8b45('0x81')];return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x5b7f57[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x2714e6,null))[_0x8b45('0x18')](saveUpdates(_0x5b7f57['body'],null))[_0x8b45('0x18')](respondWithResult(_0x2714e6,null))[_0x8b45('0x5f')](handleError(_0x2714e6,null));};exports[_0x8b45('0x87')]=function(_0x1ba08f,_0x588510){var _0x3db5dc=path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x8a'));var _0x505d13={'where':{'id':_0x1ba08f[_0x8b45('0x70')]['id']},'attributes':['id',_0x8b45('0x7f')],'raw':!![]};var _0x2b8e5c=![];return require('../../config/license/util')[_0x8b45('0x8b')]()[_0x8b45('0x18')](function(_0xeee220){if(_0xeee220){_0x2b8e5c=_0xeee220[_0x8b45('0x8c')];}})[_0x8b45('0x18')](function(){return db[_0x8b45('0x4a')]['find'](_0x505d13);})[_0x8b45('0x18')](handleEntityNotFound(_0x588510,null))[_0x8b45('0x18')](function(_0x59ea0d){if(_0x59ea0d){if(!_[_0x8b45('0x8d')](_0x59ea0d[_0x8b45('0x7f')])){if(fs['existsSync'](path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x8e'),_0x59ea0d[_0x8b45('0x7f')]))&&_0x2b8e5c){_0x3db5dc=path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x8e'),_0x59ea0d[_0x8b45('0x7f')]);}}return _0x588510['download'](_0x3db5dc);}})[_0x8b45('0x5f')](handleError(_0x588510,null));};exports['getAvatar']=function(_0x1b11e0,_0x255b6a){var _0x192932=path['join'](config[_0x8b45('0x89')],_0x8b45('0x8f'));var _0x48ab1b={'where':{'id':_0x1b11e0[_0x8b45('0x70')]['id']},'attributes':['id',_0x8b45('0x83')],'raw':!![]};return db[_0x8b45('0x4a')][_0x8b45('0x68')](_0x48ab1b)[_0x8b45('0x18')](handleEntityNotFound(_0x255b6a,null))[_0x8b45('0x18')](function(_0x1d1584){if(_0x1d1584){if(!_[_0x8b45('0x8d')](_0x1d1584[_0x8b45('0x83')])){if(fs['existsSync'](path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x90'),_0x1d1584['agentAvatar']))){_0x192932=path[_0x8b45('0x88')](config['root'],_0x8b45('0x90'),_0x1d1584['agentAvatar']);}}return _0x255b6a['download'](_0x192932);}})[_0x8b45('0x5f')](handleError(_0x255b6a,null));};exports[_0x8b45('0x91')]=function(_0x404a06,_0x5d8e63){var _0x2d31a8=path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x92'));var _0x256d7e={'where':{'id':_0x404a06[_0x8b45('0x70')]['id']},'attributes':['id',_0x8b45('0x84'),_0x8b45('0x93')],'raw':!![]};return db['ChatWebsite'][_0x8b45('0x68')](_0x256d7e)[_0x8b45('0x18')](handleEntityNotFound(_0x5d8e63,null))[_0x8b45('0x18')](function(_0x4148bd){if(_0x4148bd){if(!_[_0x8b45('0x8d')](_0x4148bd[_0x8b45('0x84')])){if(fs['existsSync'](path['join'](config[_0x8b45('0x89')],'server/files/images/avatars/',_0x4148bd['customerAvatar']))&&_0x4148bd[_0x8b45('0x93')]){_0x2d31a8=path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x90'),_0x4148bd[_0x8b45('0x84')]);}}return _0x5d8e63['download'](_0x2d31a8);}})[_0x8b45('0x5f')](handleError(_0x5d8e63,null));};exports[_0x8b45('0x94')]=function(_0x4b88be,_0x48ab84){var _0xc5bb1f=path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x95'));var _0x38c778={'where':{'id':_0x4b88be[_0x8b45('0x70')]['id']},'attributes':['id',_0x8b45('0x86')],'raw':!![]};return db[_0x8b45('0x4a')][_0x8b45('0x68')](_0x38c778)[_0x8b45('0x18')](handleEntityNotFound(_0x48ab84,null))[_0x8b45('0x18')](function(_0xe804a){if(_0xe804a){if(!_['isNil'](_0xe804a[_0x8b45('0x86')])){if(fs[_0x8b45('0x96')](path[_0x8b45('0x88')](config['root'],_0x8b45('0x90'),_0xe804a['systemAvatar']))){_0xc5bb1f=path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0x90'),_0xe804a[_0x8b45('0x86')]);}}return _0x48ab84[_0x8b45('0x97')](_0xc5bb1f);}})[_0x8b45('0x5f')](handleError(_0x48ab84,null));};function checkWebsiteInterval(_0x36f411){var _0x2f94c9=_0x36f411[_0x8b45('0x98')];if(!_0x2f94c9){return Promise[_0x8b45('0x99')](_0x36f411);}var _0x543f81=_0x36f411[_0x8b45('0x9a')]||undefined;return _0x2f94c9[_0x8b45('0x9b')](_0x543f81)['then'](function(_0x252ef3){if(!_0x252ef3){throw new APIOutOfIntervalError();}return _0x36f411;});}exports[_0x8b45('0x9c')]=function(_0x3cafc4,_0x461169){var _0x221594={'body':_0x3cafc4[_0x8b45('0x61')],'channel':_0x8b45('0x9d')};var _0x593609=[];var _0x19222d=[];var _0x5bd946={};var _0x3344f9=![];if(_0x3cafc4[_0x8b45('0x61')]['id']){delete _0x3cafc4['body']['id'];}if(_[_0x8b45('0x8d')](_0x3cafc4[_0x8b45('0x61')][_0x8b45('0x9e')])){throw new APIBadRequestError(_0x8b45('0x9f'));}if(_[_0x8b45('0x8d')](_0x3cafc4['body'][_0x8b45('0xa0')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x8b45('0xa1')](_0x3cafc4[_0x8b45('0x61')]['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x4a998f=_0x3cafc4['body'][_0x8b45('0x35')]&&_0x3cafc4[_0x8b45('0x61')][_0x8b45('0x3c')];return db[_0x8b45('0xa2')][_0x8b45('0x71')]()[_0x8b45('0x18')](function(_0xf20f24){if(!_0xf20f24){throw new Error(_0x8b45('0xa3'));}_0x593609=Object[_0x8b45('0x4e')](_0xf20f24)[_0x8b45('0x58')](function(_0x3b6dae){return![_0x8b45('0xa4'),_0x8b45('0xa5')][_0x8b45('0xa6')](_0x3b6dae);});_0x19222d=Object[_0x8b45('0x4e')](_0xf20f24)['filter'](function(_0x583fa0){return![_0x8b45('0xa4'),_0x8b45('0xa5'),'CompanyId',_0x8b45('0xa7')][_0x8b45('0xa6')](_0x583fa0);});if(!_[_0x8b45('0xa6')](_0x19222d,_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xa0')])){throw new APIBadRequestError(_0x8b45('0xa8')+_0x19222d['join'](',\x20'));}_0x5bd946[_0x3cafc4[_0x8b45('0x61')]['mapKey']]=_0x3cafc4['body'][_0x8b45('0x9e')];})['then'](function(){return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x3cafc4[_0x8b45('0x70')]['id']},'include':[{'model':db[_0x8b45('0xa9')],'as':_0x8b45('0xaa'),'include':[{'model':db[_0x8b45('0xa2')],'as':_0x8b45('0xab'),'where':_0x5bd946,'limit':0x1,'order':[[_0x8b45('0xa5'),_0x8b45('0xac')]]}]},{'model':db[_0x8b45('0xad')],'as':_0x8b45('0xae')},{'model':db[_0x8b45('0x98')],'as':_0x8b45('0x98'),'include':[{'model':db['Interval'],'as':_0x8b45('0xaf'),'attributes':['id',_0x8b45('0xb0')],'raw':!![]}]}]});})[_0x8b45('0x18')](function(_0x271c7b){if(!_0x271c7b){throw new APINotFoundError(util[_0x8b45('0x41')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x3cafc4[_0x8b45('0x70')]['id']));}if(_0x4a998f){return checkWebsiteInterval(_0x271c7b);}return _0x271c7b;})[_0x8b45('0x18')](function(_0x693a6){_0x221594[_0x8b45('0xb1')]=_0x693a6;_0x221594[_0x8b45('0xb2')]=_[_0x8b45('0xb3')](_0x693a6[_0x8b45('0xae')],[_0x8b45('0xb4')],[_0x8b45('0xb5')]);if(_0x221594[_0x8b45('0xb1')][_0x8b45('0xae')]){delete _0x221594[_0x8b45('0xb1')][_0x8b45('0xae')];}_0x221594[_0x8b45('0xb6')]=_0x693a6[_0x8b45('0xaa')]||{'id':_0x693a6[_0x8b45('0xa7')]};if(_0x221594[_0x8b45('0xb6')]&&_0x221594[_0x8b45('0xb6')][_0x8b45('0xab')][_0x8b45('0x53')]){return _0x221594[_0x8b45('0xb6')]['Contacts'][0x0];}var _0xbf7715=_[_0x8b45('0xb7')](_0x3cafc4['body'],{'firstName':_0x3cafc4[_0x8b45('0x61')][_0x8b45('0x9e')],'ListId':_0x693a6[_0x8b45('0xa7')]});_0xbf7715[_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xa0')]]=_0x3cafc4['body'][_0x8b45('0x9e')];return db[_0x8b45('0xa2')][_0x8b45('0x6c')](_0xbf7715,{'fields':_0x593609,'raw':!![]});})[_0x8b45('0x18')](function(_0x32f600){_0x221594[_0x8b45('0xb8')]=_0x32f600;var _0x4978b8=createInteractionObject(_0x3cafc4['params']['id'],_0x3cafc4[_0x8b45('0x61')],_0x3cafc4[_0x8b45('0xb9')],_0x32f600);var _0x358316={'ChatWebsiteId':_0x3cafc4['params']['id']};if(_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xba')]){_0x358316['threadId']=_0x3cafc4[_0x8b45('0x61')]['threadId'];_0x358316[_0x8b45('0xbb')]=![];return db[_0x8b45('0xbc')][_0x8b45('0x68')]({'where':_0x358316})[_0x8b45('0x18')](function(_0x5bf7cf){var _0x7ea3d6=_0x3cafc4[_0x8b45('0x61')][_0x8b45('0x35')]&&_0x3cafc4[_0x8b45('0x61')][_0x8b45('0x3c')];if(_0x5bf7cf){_0x3344f9=!![];return _0x5bf7cf;}else if(!_0x7ea3d6&&_0x5bf7cf&&_0x5bf7cf[_0x8b45('0xbb')]){throw new APIConflictError(_0x8b45('0xbd'));}_0x4978b8[_0x8b45('0xba')]=_0x3cafc4[_0x8b45('0x61')]['threadId'];_0x4978b8[_0x8b45('0xbe')]=_0x3cafc4['body'][_0x8b45('0xbe')];return db[_0x8b45('0xbc')][_0x8b45('0x6c')](_0x4978b8);});}_0x358316[_0x8b45('0xbf')]=_0x32f600['id'];if(_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xc0')]&&_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xc0')]['id']){_0x358316['id']=_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xc0')]['id'];return db[_0x8b45('0xbc')]['find']({'where':_0x358316})[_0x8b45('0x18')](function(_0x425ae2){var _0x1595e7=_0x3cafc4[_0x8b45('0x61')][_0x8b45('0x35')]&&_0x3cafc4[_0x8b45('0x61')]['referer'];if(!_0x1595e7&&_0x425ae2&&_0x425ae2[_0x8b45('0xbb')]){throw new APIConflictError(_0x8b45('0xbd'));}else if(_0x425ae2){_0x3344f9=!![];return _0x425ae2;}else{return db[_0x8b45('0xbc')][_0x8b45('0x6c')](_0x4978b8);}});}return db[_0x8b45('0xbc')][_0x8b45('0x6c')](_0x4978b8);})[_0x8b45('0x18')](function(_0x31802c){if(!_0x3344f9){return _0x31802c;}var _0x3a0417={'from':(_0x221594[_0x8b45('0xb8')][_0x8b45('0x39')]||'')+'\x20'+(_0x221594['contact'][_0x8b45('0x3a')]||'')};if(_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xba')]&&_0x3cafc4['body']['messageId']&&_0x3cafc4[_0x8b45('0x61')]['threadId']!=_0x3cafc4['body'][_0x8b45('0xc1')]){_0x3a0417[_0x8b45('0xba')]=_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xc1')];}return _0x31802c[_0x8b45('0x2c')](_0x3a0417);})[_0x8b45('0x18')](function(_0x76c89f){_0x221594[_0x8b45('0xc0')]=_0x76c89f[_0x8b45('0x2e')]({'plain':!![]});_0x221594['interaction']['created']=!_0x3344f9;if(_0x221594[_0x8b45('0xc0')][_0x8b45('0xc2')]){if(_0x221594['account']['autoclose']){_0x221594[_0x8b45('0xb2')]['push']({'id':0x0,'priority':_0x221594[_0x8b45('0xb2')][_0x8b45('0x53')]+0x1,'app':_0x8b45('0xc3'),'appdata':_0x8b45('0xc4'),'interval':_0x8b45('0xc5')});}}return db[_0x8b45('0xc6')][_0x8b45('0x6c')]({'body':_0x3cafc4[_0x8b45('0x61')][_0x8b45('0x61')],'ChatWebsiteId':_0x3cafc4[_0x8b45('0x70')]['id'],'ChatInteractionId':_0x76c89f['id'],'direction':'in','ContactId':_0x221594[_0x8b45('0xb8')]['id'],'AttachmentId':_0x3cafc4[_0x8b45('0x61')][_0x8b45('0xc7')]});})[_0x8b45('0x18')](function(_0x4f1d30){_0x221594[_0x8b45('0x21')]=_0x4f1d30;if(!_0x221594[_0x8b45('0xc0')][_0x8b45('0xc8')]){return;}return db['User']['find']({'attributes':['id',_0x8b45('0x30')],'where':{'id':_0x221594[_0x8b45('0xc0')][_0x8b45('0xc8')]}});})['then'](function(_0x5a686a){if(_0x5a686a){_0x221594[_0x8b45('0xb2')][_0x8b45('0xc9')]({'id':0x0,'priority':0x0,'app':_0x8b45('0xca'),'appdata':_0x5a686a[_0x8b45('0x30')]+','+(_0x221594['account'][_0x8b45('0xcb')]||0xa),'interval':_0x8b45('0xc5')});_0x221594[_0x8b45('0xcc')]=!![];}if(!_0x221594[_0x8b45('0xc0')][_0x8b45('0xcd')]){return;}return db[_0x8b45('0xce')][_0x8b45('0x68')]({'attributes':['id',_0x8b45('0x30')],'where':{'id':_0x221594[_0x8b45('0xc0')][_0x8b45('0xcd')]}});})['then'](function(_0x4e8da8){if(_0x4e8da8){_0x221594[_0x8b45('0xb2')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8b45('0xcf'),'appdata':_0x4e8da8['name']+','+(_0x221594[_0x8b45('0xb1')][_0x8b45('0xd0')]||0x12c),'interval':_0x8b45('0xc5')});}return respondWithRpcPromise('Start',_0x8b45('0xd1'),_0x221594);})[_0x8b45('0x18')](function(_0x6760ef){respondWithRpcPromise(_0x8b45('0xd2'),_0x8b45('0xd2'),{'event':_0x8b45('0x9c'),'message':_0x6760ef},client9002);return _0x6760ef;})[_0x8b45('0x18')](respondWithResult(_0x461169,null))[_0x8b45('0x5f')](APIHandleError(_0x461169));};exports['offline']=function(_0x5bd65a,_0x305ab){var _0x1ed04b,_0x491e39,_0xbfbad4;var _0x56f793=[];var _0x1fee78={};var _0x37ef44=_0x5bd65a['files']||[];var _0x1639ea=[];var _0x4ba0c3;return db['CmContact'][_0x8b45('0x71')]()[_0x8b45('0x18')](function(_0x1dce03){if(!_0x1dce03){throw new db[(_0x8b45('0xd3'))][(_0x8b45('0xd4'))]('no\x20available\x20attributes');}_0x56f793=_[_0x8b45('0xd5')](_[_0x8b45('0x4e')](_0x1dce03),['createdAt',_0x8b45('0xa5'),_0x8b45('0xd6'),'ListId']);if(_0x5bd65a['body']['id']){delete _0x5bd65a[_0x8b45('0x61')]['id'];}if(_[_0x8b45('0x8d')](_0x5bd65a[_0x8b45('0x61')][_0x8b45('0x9e')])){throw _0x305ab['status'](0x1f4)[_0x8b45('0x31')](new db[(_0x8b45('0xd3'))][(_0x8b45('0xd4'))](_0x8b45('0xd7')));}if(_[_0x8b45('0x8d')](_0x5bd65a[_0x8b45('0x61')][_0x8b45('0x61')])||_0x5bd65a[_0x8b45('0x61')][_0x8b45('0x61')]===''){throw _0x305ab[_0x8b45('0x24')](0x1f4)[_0x8b45('0x31')](new db['Sequelize'][(_0x8b45('0xd4'))](_0x8b45('0xd8')));}if(_[_0x8b45('0x8d')](_0x5bd65a[_0x8b45('0x61')][_0x8b45('0xd9')])){throw _0x305ab[_0x8b45('0x24')](0x1f4)['send'](new db[(_0x8b45('0xd3'))][(_0x8b45('0xd4'))](_0x8b45('0xda')+_0x56f793));}if(!_[_0x8b45('0xa6')](_0x56f793,_0x5bd65a[_0x8b45('0x61')][_0x8b45('0xd9')])){throw _0x305ab[_0x8b45('0x24')](0x1f4)[_0x8b45('0x31')](new db[(_0x8b45('0xd3'))][(_0x8b45('0xd4'))](_0x8b45('0xdb')+_0x56f793));}_0x1fee78[_0x5bd65a[_0x8b45('0x61')][_0x8b45('0xd9')]]=_0x5bd65a[_0x8b45('0x61')][_0x8b45('0x9e')];})[_0x8b45('0x18')](function(){return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x5bd65a[_0x8b45('0x70')]['id']},'include':[{'model':db[_0x8b45('0xa9')],'as':_0x8b45('0xaa')},{'model':db[_0x8b45('0xdc')],'as':_0x8b45('0xdc')}]});})['then'](handleEntityNotFound(_0x305ab,null))[_0x8b45('0x18')](function(_0x2657be){if(_0x2657be&&_0x2657be['List']){_0x491e39=_0x2657be;var _0x3c3c87=_[_0x8b45('0xb7')](_0x5bd65a[_0x8b45('0x61')],{'firstName':_0x5bd65a[_0x8b45('0x61')][_0x8b45('0x9e')],'phone':_0x5bd65a[_0x8b45('0x61')]['from'],'ListId':_0x2657be[_0x8b45('0xa7')]});_0x3c3c87[_0x5bd65a['body'][_0x8b45('0xd9')]]=_0x5bd65a[_0x8b45('0x61')][_0x8b45('0x9e')];return db[_0x8b45('0xa2')]['findOrCreate']({'where':_0x1fee78,'defaults':_0x3c3c87});}})[_0x8b45('0xdd')](function(_0x46147b){if(_0x46147b){_0xbfbad4=_0x46147b;var _0x277de9=fs[_0x8b45('0xde')](path[_0x8b45('0x88')](config['root'],_0x8b45('0xdf')),_0x8b45('0xe0'));var _0x218d77=ejs['render'](_0x277de9,{'body':_[_0x8b45('0xe1')](_0x5bd65a[_0x8b45('0x61')][_0x8b45('0x61')]),'bodyTitle':_0x491e39['offlineMessageBody']});return db[_0x8b45('0xe2')][_0x8b45('0x6c')]({'body':_0x218d77,'plainBody':htmlToText[_0x8b45('0xe3')](_0x218d77),'ContactId':_0x46147b['id'],'ChatWebsiteId':_0x491e39['id']});}})['then'](function(_0x2c6db3){_0x4ba0c3=_0x2c6db3;if(_0x37ef44[_0x8b45('0x53')]){var _0x54e723=_0x37ef44[_0x8b45('0x49')](function(_0x1908a8){return{'name':_0x1908a8[_0x8b45('0xe4')],'basename':_0x1908a8[_0x8b45('0x81')],'type':_0x1908a8[_0x8b45('0xe5')],'ChatOfflineMessageId':_0x2c6db3['id']};});_0x1639ea=_0x54e723['map'](_0x4c4e8d=>{var _0x1f7f17={'filename':_0x4c4e8d['name'],'path':path[_0x8b45('0x88')](config['root'],_0x8b45('0xe6'),_0x8b45('0xe7'),'attachments',_0x8b45('0xe8'),_0x4c4e8d[_0x8b45('0xe9')])};return _0x1f7f17;});if(!_0x491e39['openNewInteraction']){return db[_0x8b45('0xea')][_0x8b45('0xeb')](function(_0x58117e){return db[_0x8b45('0xec')][_0x8b45('0xed')](_0x54e723,{'transaction':_0x58117e});});}}})[_0x8b45('0x18')](function(){if(_0x4ba0c3){_0x1ed04b=_0x4ba0c3;return db[_0x8b45('0xdc')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8b45('0xee')],'as':_0x8b45('0xef'),'raw':!![],'include':[{'model':db[_0x8b45('0xf0')],'as':_0x8b45('0xf0'),'raw':!![]}]}]});}})[_0x8b45('0x18')](function(_0x2de555){if(_0x2de555&&_0x2de555[_0x8b45('0xef')]&&_0x491e39['forwardOffline']&&_0x491e39['forwardOfflineAddress']){var _0x1a2d5d=_0x2de555[_0x8b45('0xf1')]();return respondWithRpcPromise('SendMail',_0x8b45('0xf2'),{'account':_0x1a2d5d,'message':{'from':util[_0x8b45('0x41')](_0x8b45('0xf3'),_0x2de555[_0x8b45('0x30')],_0x2de555['email']||_0x2de555[_0x8b45('0xef')][_0x8b45('0x65')]),'to':_0x491e39['forwardOfflineAddress'],'subject':_0x491e39['offlineMessageSubject'],'html':_0x1ed04b[_0x8b45('0x61')],'attachments':_0x1639ea}},client9003)[_0x8b45('0x18')](function(){return _0x1ed04b;})[_0x8b45('0x5f')](function(_0x302f68){logger[_0x8b45('0x1f')](_0x302f68);});}})['then'](function(){if(_0x491e39&&_0x491e39[_0x8b45('0xf4')]&&_0x491e39['MailAccountId']){var _0x3aba04=[];if(_0x37ef44['length']){_0x3aba04=_0x37ef44[_0x8b45('0x49')](function(_0x140bf0){return{'name':_0x140bf0['originalname'],'basename':_0x140bf0[_0x8b45('0x81')],'type':_0x140bf0[_0x8b45('0xe5')],'ChatOfflineMessageId':_0x4ba0c3['id']};});}var _0x40ec6b;if(!_['isNil'](_0x491e39['subjectOffline'])){var _0x40daf3=_[_0x8b45('0x49')](_0x5bd65a[_0x8b45('0x61')],function(_0x515774){return _0x515774;});var _0x1342c9=_[_0x8b45('0xf5')](_0x40daf3)[0x0];var _0x5b35f3=_['mapValues'](_0x1342c9,function(_0x1c1a90){return _0x1c1a90;});_0x40ec6b=_0x5b35f3[0x1][_0x491e39[_0x8b45('0xf6')]];}var _0x5c3245={'from':_0xbfbad4[_0x8b45('0xf7')],'firstName':_0xbfbad4['firstName'],'lastName':_0xbfbad4[_0x8b45('0x3a')],'mapKey':_0x8b45('0xf7'),'message':{'from':_0xbfbad4[_0x8b45('0xf7')],'to':_0x491e39[_0x8b45('0xdc')][_0x8b45('0xf7')],'cc':'','subject':_[_0x8b45('0x8d')](_0x40ec6b)?_0x491e39[_0x8b45('0xf8')]:_0x40ec6b,'messageId':'','sentAt':new Date(),'attach':_0x3aba04[_0x8b45('0x53')],'attachments':_0x3aba04,'originChannel':_0x8b45('0xf9'),'ChatWebsiteId':_0x491e39['id'],'ChatOfflineMessageId':_0x1ed04b['id'],'originTo':_0x491e39[_0x8b45('0xdc')][_0x8b45('0xf7')]},'body':_0x1ed04b[_0x8b45('0x61')]};var _0x27d264={'account':{'id':_0x491e39[_0x8b45('0xfa')]},'body':_0x5c3245,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x8b45('0xfb'),'notifyMail',_0x27d264,client9001)[_0x8b45('0x18')](function(){return _0x1ed04b;})[_0x8b45('0x5f')](function(_0x2ae0d){logger[_0x8b45('0x1f')](_0x2ae0d);});}return;})[_0x8b45('0x18')](function(){if(_0x1ed04b){return _0x1ed04b;}})['then'](respondWithResult(_0x305ab,null))['catch'](function(){for(var _0x5b3543 of _0x37ef44){var _0x41437d=path[_0x8b45('0x88')](config[_0x8b45('0x89')],_0x8b45('0xe6'),_0x8b45('0xe7'),'attachments','offline-chat',_0x5b3543[_0x8b45('0x81')]);fs_extra[_0x8b45('0xfc')](_0x41437d)[_0x8b45('0x5f')](function(_0x5d870e){logger[_0x8b45('0x1f')]('Could\x20not\x20remove\x20attachment\x20file',_0x41437d,_0x5d870e);});}});};exports[_0x8b45('0xfd')]=function(_0x2312bc,_0x3eebd9){return db['ChatInteraction'][_0x8b45('0x68')]({'where':{'id':_0x2312bc['params']['id']}})['then'](handleEntityNotFound(_0x3eebd9,null))[_0x8b45('0x18')](function(_0x5f4829){if(_0x5f4829){return _0x5f4829[_0x8b45('0xfd')](_0x2312bc[_0x8b45('0x61')][_0x8b45('0x7a')],_[_0x8b45('0xfe')](_0x2312bc[_0x8b45('0x61')],[_0x8b45('0x7a'),'id'])||{});}})['then'](respondWithResult(_0x3eebd9,null))[_0x8b45('0x5f')](handleError(_0x3eebd9,null));};exports[_0x8b45('0xff')]=function(_0x1f024a,_0x5a5ee1){var _0x182c39={'raw':![],'where':{}};var _0x3bd9b0={};var _0xebb778={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8b45('0x75')]({'where':{'id':_0x1f024a['params']['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x5a5ee1,null))['then'](function(_0x51a46f){if(_0x51a46f){_0x3bd9b0[_0x8b45('0x43')]=_[_0x8b45('0x4e')](db[_0x8b45('0xbc')][_0x8b45('0x4b')]);_0x3bd9b0[_0x8b45('0x4d')]=_['keys'](_0x1f024a[_0x8b45('0x4d')]);_0x3bd9b0['filters']=_[_0x8b45('0x51')](_0x3bd9b0[_0x8b45('0x43')],_0x3bd9b0[_0x8b45('0x4d')]);_0x182c39[_0x8b45('0x50')]=_['intersection'](_0x3bd9b0[_0x8b45('0x43')],qs[_0x8b45('0x52')](_0x1f024a['query'][_0x8b45('0x52')]));_0x182c39[_0x8b45('0x50')]=_0x182c39[_0x8b45('0x50')]['length']?_0x182c39['attributes']:_0x3bd9b0['model'];if(!_0x1f024a[_0x8b45('0x4d')][_0x8b45('0x54')](_0x8b45('0x55'))){_0x182c39['limit']=qs[_0x8b45('0x29')](_0x1f024a[_0x8b45('0x4d')][_0x8b45('0x29')]);_0x182c39[_0x8b45('0x27')]=qs[_0x8b45('0x27')](_0x1f024a['query'][_0x8b45('0x27')]);}_0x182c39[_0x8b45('0x76')]=qs['sort'](_0x1f024a[_0x8b45('0x4d')][_0x8b45('0x56')]);_0x182c39['where']=qs[_0x8b45('0x4f')](_[_0x8b45('0x77')](_0x1f024a[_0x8b45('0x4d')],_0x3bd9b0[_0x8b45('0x4f')]));_0x182c39['where'][_0x8b45('0x78')]=_0x51a46f['id'];if(_0x1f024a[_0x8b45('0x4d')][_0x8b45('0x58')]){_0x182c39[_0x8b45('0x57')]=_[_0x8b45('0x59')](_0x182c39[_0x8b45('0x57')],{'$or':_['map'](_0x182c39[_0x8b45('0x50')],function(_0x290f64){var _0x2d2d6a={};_0x2d2d6a[_0x290f64]={'$like':'%'+_0x1f024a[_0x8b45('0x4d')][_0x8b45('0x58')]+'%'};return _0x2d2d6a;})});}_0x182c39=_[_0x8b45('0x59')]({},_0x182c39,_0x1f024a['options']);return db[_0x8b45('0xbc')][_0x8b45('0x2a')]({'where':_0x182c39[_0x8b45('0x57')]})['then'](function(_0x3f58bf){_0xebb778['count']=_0x3f58bf;if(_0x1f024a['query'][_0x8b45('0x60')]){_0x182c39[_0x8b45('0x5c')]=[{'model':db[_0x8b45('0xa2')],'as':_0x8b45('0x100'),'required':![]},{'model':db[_0x8b45('0x101')],'as':_0x8b45('0x102'),'attributes':[_0x8b45('0x30'),_0x8b45('0x103'),_0x8b45('0x104')],'required':![]},{'model':db[_0x8b45('0x105')],'as':_0x8b45('0x106'),'attributes':['id',_0x8b45('0x30'),_0x8b45('0x107')],'where':_0x1f024a[_0x8b45('0x4d')][_0x8b45('0x108')]?{'id':_0x1f024a[_0x8b45('0x4d')]['tag']}:undefined,'required':_0x1f024a['query'][_0x8b45('0x108')]?!![]:![]}];}return db['ChatInteraction'][_0x8b45('0x5d')](_0x182c39);})[_0x8b45('0x18')](function(_0x16b14a){_0xebb778[_0x8b45('0x5e')]=_0x16b14a;return _0xebb778;});}})[_0x8b45('0x18')](respondWithFilteredResult(_0x5a5ee1,_0x182c39))[_0x8b45('0x5f')](handleError(_0x5a5ee1,null));};exports[_0x8b45('0x109')]=function(_0x4f3af1,_0x2f0036){var _0x5ec0c1=0x0;var _0x2f0e4a=0x0;var _0x5a7969=![];var _0x39bc34;var _0x355213;return db['ChatWebsite']['find']({'where':{'id':_0x4f3af1['params']['id']},'include':[{'model':db[_0x8b45('0x98')],'as':_0x8b45('0x98'),'include':[{'model':db[_0x8b45('0x98')],'as':_0x8b45('0xaf'),'attributes':['id',_0x8b45('0xb0')]}]}]})[_0x8b45('0x18')](handleEntityNotFound(_0x2f0036,null))[_0x8b45('0x18')](function(_0x65c5d7){if(_0x65c5d7){_0x39bc34=_0x65c5d7;return _0x65c5d7[_0x8b45('0x10a')]({'raw':!![]});}})[_0x8b45('0x18')](function(_0x30781a){if(_0x39bc34){if(_0x30781a){_0x355213=_0x30781a;}}return require(_0x8b45('0x10b'))['getLicense']();})['then'](function(_0x28c0f1){if(_0x28c0f1){_0x2f0e4a=_0x28c0f1[_0x8b45('0x10c')];_0x5a7969=_0x28c0f1[_0x8b45('0x8c')];}})[_0x8b45('0x18')](function(){return db[_0x8b45('0xbc')][_0x8b45('0x2a')]({'where':{'closed':![]}});})['then'](function(_0x482021){_0x5ec0c1=_0x482021;if(_0x2f0e4a&&_0x482021>_0x2f0e4a){return db[_0x8b45('0x10d')][_0x8b45('0x75')]({'where':{'id':0x1}})['then'](function(_0x2b618b){if(_0x2b618b){_0x2b618b[_0x8b45('0x10e')](_0x8b45('0x10f'));}});}})[_0x8b45('0x18')](function(){var _0x4eb05d=_0x39bc34[_0x8b45('0x98')];var _0x36a341=_0x39bc34[_0x8b45('0x9a')]||undefined;return _0x4eb05d?_0x4eb05d[_0x8b45('0x9b')](_0x36a341):!![];})[_0x8b45('0x18')](function(_0x4f329c){var _0x5b3e5a=fs['readFileSync'](path[_0x8b45('0x88')](config[_0x8b45('0x89')],'server/files/chat/iframe.ejs'),'utf8');var _0x2cb0d4='3.13.0';var _0x385842=![];var _0x19f33f,_0x6a6e5;if(_0x4f3af1[_0x8b45('0xb9')][_0x8b45('0x3c')]){_0x19f33f=new URL(_0x4f3af1['headers'][_0x8b45('0x3c')])[_0x8b45('0x110')];}else if(_0x4f3af1[_0x8b45('0xb9')][_0x8b45('0x110')]){_0x19f33f=new URL(_0x4f3af1[_0x8b45('0xb9')][_0x8b45('0x110')])[_0x8b45('0x110')];}else{_0x19f33f='http://localhost:9000';}_0x6a6e5=typeof _0x39bc34[_0x8b45('0x62')][_0x8b45('0x38')](',')['find'](function(_0xd31105){return wildcardUtils['testWebsiteWithWildcard'](_0xd31105,_0x19f33f);})!==_0x8b45('0x28');var _0x3af143={'chatVersion':_0x2cb0d4,'chatWebsiteAddressOrigin':_0x6a6e5?_0x19f33f:_0x39bc34['address'],'remote':_0x39bc34['remote'],'query':querystring[_0x8b45('0x1e')](_[_0x8b45('0x59')](_0x39bc34[_0x8b45('0x2e')]({'plain':!![]}),{'customerIp':_0x4f3af1[_0x8b45('0xb9')][_0x8b45('0x37')]||_0x4f3af1[_0x8b45('0xb9')][_0x8b45('0x111')]||_0x4f3af1['connection'][_0x8b45('0x112')]||_0x4f3af1['ip'],'referer':_0x4f3af1[_0x8b45('0xb9')][_0x8b45('0x3c')],'openedInteractions':_0x5ec0c1,'maxInteractions':_0x2f0e4a,'virtual':_0x5a7969[_0x8b45('0x10c')],'online':_0x4f329c,'custom':_0x5a7969,'address':_0x6a6e5?_0x19f33f:null}))['replace'](/'/g,'\x5c\x27')};_0x2f0036[_0x8b45('0x31')](ejs[_0x8b45('0x113')](Mustache[_0x8b45('0x113')](_0x5b3e5a,_0x3af143),{'proactiveActions':_0x355213,'alignment':_0x39bc34[_0x8b45('0x114')],'verticalAlignment':_0x39bc34[_0x8b45('0x115')],'div_color':_0x39bc34['color'],'labelText':_0x39bc34[_0x8b45('0x116')],'text_color':_0x39bc34[_0x8b45('0x117')],'text_button_color':_0x39bc34[_0x8b45('0x118')],'button_color':_0x39bc34['color_button'],'background_color':_0x39bc34[_0x8b45('0x119')],'hideWhenOffline':_0x39bc34[_0x8b45('0x11a')],'intervalId':_0x39bc34[_0x8b45('0x11b')],'isDevelopment':_0x385842,'chatVersion':_0x2cb0d4}));})[_0x8b45('0x5f')](handleError(_0x2f0036,null));};exports[_0x8b45('0x11c')]=function(_0x5cb4a4,_0x36fbda){var _0x298c84=_0x5cb4a4['params']['id'];var _0x1fd7ae=_0x5cb4a4[_0x8b45('0x61')];var _0x48ebcf=0xc8;var _0x4fdf7c=null;return db[_0x8b45('0xea')][_0x8b45('0xeb')]({'isolationLevel':db[_0x8b45('0xea')]['Transaction'][_0x8b45('0x11d')]['READ_COMMITTED']},function(_0x64c270){return db[_0x8b45('0x4a')][_0x8b45('0x75')]({'where':{'id':_0x298c84},'transaction':_0x64c270})['then'](function(_0x23b731){if(_0x23b731){return db[_0x8b45('0xad')][_0x8b45('0x2d')]({'where':{'ChatWebsiteId':_0x298c84},'transaction':_0x64c270})[_0x8b45('0x18')](function(){var _0x45d2ed=_[_0x8b45('0x49')](_0x1fd7ae,function(_0x167215){_0x167215['ChatWebsiteId']=_0x298c84;return _0x167215;});return db['ChatApplication'][_0x8b45('0xed')](_0x45d2ed,{'transaction':_0x64c270});});}else{_0x48ebcf=0x194;_0x4fdf7c=[];}});})['then'](function(){if(_0x48ebcf!==0x194){return db[_0x8b45('0xad')][_0x8b45('0x11e')]({'where':{'ChatWebsiteId':_0x298c84},'order':_0x8b45('0xb4')})[_0x8b45('0x18')](function(_0x3e26e8){_0x4fdf7c=_0x3e26e8;});}})[_0x8b45('0x5f')](function(_0x3a6577){_0x48ebcf=0x1f4;logger[_0x8b45('0x1f')](_0x3a6577['stack']);if(_0x3a6577[_0x8b45('0x30')]){delete _0x3a6577['name'];}_0x4fdf7c=_0x3a6577;})[_0x8b45('0x11f')](function(){if(_0x4fdf7c===null){_0x36fbda['sendStatus'](_0x48ebcf);}else{if(_0x48ebcf===0x1f4){_0x36fbda['status'](_0x48ebcf)['send'](_0x4fdf7c);}else{_0x36fbda[_0x8b45('0x24')](_0x48ebcf)[_0x8b45('0x26')](_0x4fdf7c);}}});};exports[_0x8b45('0x120')]=function(_0x43320d,_0x847faf){var _0x198279={};var _0x580011={};var _0x4976bb;var _0x3cf1b1;return db[_0x8b45('0x4a')][_0x8b45('0x75')]({'where':{'id':_0x43320d['params']['id']}})['then'](handleEntityNotFound(_0x847faf,null))['then'](function(_0x42bfb5){if(_0x42bfb5){_0x4976bb=_0x42bfb5;_0x580011[_0x8b45('0x43')]=_[_0x8b45('0x4e')](db[_0x8b45('0xad')][_0x8b45('0x4b')]);_0x580011[_0x8b45('0x4d')]=_[_0x8b45('0x4e')](_0x43320d[_0x8b45('0x4d')]);_0x580011['filters']=_[_0x8b45('0x51')](_0x580011[_0x8b45('0x43')],_0x580011[_0x8b45('0x4d')]);_0x198279[_0x8b45('0x50')]=_['intersection'](_0x580011[_0x8b45('0x43')],qs[_0x8b45('0x52')](_0x43320d[_0x8b45('0x4d')][_0x8b45('0x52')]));_0x198279[_0x8b45('0x50')]=_0x198279[_0x8b45('0x50')]['length']?_0x198279['attributes']:_0x580011[_0x8b45('0x43')];_0x198279[_0x8b45('0x76')]=qs[_0x8b45('0x56')](_0x43320d[_0x8b45('0x4d')][_0x8b45('0x56')]);_0x198279[_0x8b45('0x57')]=qs[_0x8b45('0x4f')](_[_0x8b45('0x77')](_0x43320d[_0x8b45('0x4d')],_0x580011[_0x8b45('0x4f')]));if(_0x43320d['query']['filter']){_0x198279['where']=_[_0x8b45('0x59')](_0x198279[_0x8b45('0x57')],{'$or':_[_0x8b45('0x49')](_0x198279['attributes'],function(_0x563c40){var _0x1e5d48={};_0x1e5d48[_0x563c40]={'$like':'%'+_0x43320d[_0x8b45('0x4d')][_0x8b45('0x58')]+'%'};return _0x1e5d48;})});}_0x198279=_[_0x8b45('0x59')]({},_0x198279,_0x43320d[_0x8b45('0x5b')]);return _0x4976bb[_0x8b45('0x120')](_0x198279);}})[_0x8b45('0x18')](function(_0x3d90c0){if(_0x3d90c0){_0x3cf1b1=_0x3d90c0[_0x8b45('0x53')];if(!_0x43320d[_0x8b45('0x4d')][_0x8b45('0x54')]('nolimit')){_0x198279[_0x8b45('0x29')]=qs[_0x8b45('0x29')](_0x43320d[_0x8b45('0x4d')][_0x8b45('0x29')]);_0x198279[_0x8b45('0x27')]=qs[_0x8b45('0x27')](_0x43320d[_0x8b45('0x4d')]['offset']);}return _0x4976bb[_0x8b45('0x120')](_0x198279);}})[_0x8b45('0x18')](function(_0x217b56){if(_0x217b56){return _0x217b56?{'count':_0x3cf1b1,'rows':_0x217b56}:null;}})[_0x8b45('0x18')](respondWithResult(_0x847faf,null))[_0x8b45('0x5f')](handleError(_0x847faf,null));};exports[_0x8b45('0x121')]=function(_0x52e041,_0x1ac5cf){return db['chatProactiveAction'][_0x8b45('0x68')]({'where':{'id':_0x52e041[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x1ac5cf,null))[_0x8b45('0x18')](function(_0x373401){if(_0x373401){return _0x373401[_0x8b45('0x121')](_0x52e041['body']['ids'],_[_0x8b45('0xfe')](_0x52e041[_0x8b45('0x61')],['ids','id'])||{});}})[_0x8b45('0x18')](respondWithResult(_0x1ac5cf,null))[_0x8b45('0x5f')](handleError(_0x1ac5cf,null));};exports[_0x8b45('0x10a')]=function(_0xf516ad,_0x377f5e){var _0xdd4dcd={};var _0x2ab03c={};var _0x2a89f5;var _0x540997;return db[_0x8b45('0x4a')]['findOne']({'where':{'id':_0xf516ad['params']['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x377f5e,null))[_0x8b45('0x18')](function(_0x4a1bc1){if(_0x4a1bc1){_0x2a89f5=_0x4a1bc1;_0x2ab03c['model']=_[_0x8b45('0x4e')](db[_0x8b45('0x122')][_0x8b45('0x4b')]);_0x2ab03c[_0x8b45('0x4d')]=_[_0x8b45('0x4e')](_0xf516ad[_0x8b45('0x4d')]);_0x2ab03c[_0x8b45('0x4f')]=_[_0x8b45('0x51')](_0x2ab03c[_0x8b45('0x43')],_0x2ab03c[_0x8b45('0x4d')]);_0xdd4dcd[_0x8b45('0x50')]=_['intersection'](_0x2ab03c[_0x8b45('0x43')],qs[_0x8b45('0x52')](_0xf516ad['query']['fields']));_0xdd4dcd[_0x8b45('0x50')]=_0xdd4dcd['attributes']['length']?_0xdd4dcd['attributes']:_0x2ab03c[_0x8b45('0x43')];_0xdd4dcd['order']=qs[_0x8b45('0x56')](_0xf516ad['query'][_0x8b45('0x56')]);_0xdd4dcd[_0x8b45('0x57')]=qs['filters'](_['pick'](_0xf516ad[_0x8b45('0x4d')],_0x2ab03c[_0x8b45('0x4f')]));if(_0xf516ad[_0x8b45('0x4d')][_0x8b45('0x58')]){_0xdd4dcd[_0x8b45('0x57')]=_[_0x8b45('0x59')](_0xdd4dcd[_0x8b45('0x57')],{'$or':_['map'](_0xdd4dcd[_0x8b45('0x50')],function(_0x515fc0){var _0x48c3e4={};_0x48c3e4[_0x515fc0]={'$like':'%'+_0xf516ad[_0x8b45('0x4d')][_0x8b45('0x58')]+'%'};return _0x48c3e4;})});}_0xdd4dcd=_[_0x8b45('0x59')]({},_0xdd4dcd,_0xf516ad[_0x8b45('0x5b')]);return _0x2a89f5['getProactiveActions'](_0xdd4dcd);}})[_0x8b45('0x18')](function(_0x36fbe3){if(_0x36fbe3){_0x540997=_0x36fbe3[_0x8b45('0x53')];if(!_0xf516ad[_0x8b45('0x4d')][_0x8b45('0x54')]('nolimit')){_0xdd4dcd[_0x8b45('0x29')]=qs[_0x8b45('0x29')](_0xf516ad[_0x8b45('0x4d')]['limit']);_0xdd4dcd['offset']=qs[_0x8b45('0x27')](_0xf516ad[_0x8b45('0x4d')][_0x8b45('0x27')]);}return _0x2a89f5['getProactiveActions'](_0xdd4dcd);}})[_0x8b45('0x18')](function(_0x49d6d1){if(_0x49d6d1){return _0x49d6d1?{'count':_0x540997,'rows':_0x49d6d1}:null;}})[_0x8b45('0x18')](respondWithResult(_0x377f5e,null))[_0x8b45('0x5f')](handleError(_0x377f5e,null));};exports[_0x8b45('0x123')]=function(_0x10fe20,_0x434e42){var _0x2db12a=_0x10fe20[_0x8b45('0x4d')][_0x8b45('0x124')]===_0x8b45('0x125')?_0x8b45('0x126'):_0x8b45('0x127');return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'attributes':['id',_0x2db12a],'where':{'id':_0x10fe20[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x434e42,null))[_0x8b45('0x18')](function(_0x1fc0f4){if(_0x1fc0f4){var _0x119702=_0x1fc0f4[_0x2db12a];var _0x14659b=_0x119702&&_0x119702['items']?_0x119702[_0x8b45('0x128')]:[];_0x434e42[_0x8b45('0x31')]({'fromKey':_['isNil'](_0x119702[_0x8b45('0x129')])?undefined:_0x119702[_0x8b45('0x129')],'count':_0x14659b[_0x8b45('0x53')],'rows':_0x14659b});}})[_0x8b45('0x5f')](handleError(_0x434e42,null));};exports[_0x8b45('0x12a')]=function(_0xa19e1,_0x3b4c23){var _0x427161={'raw':![],'where':{}};var _0x43237b={};var _0x450624={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0xa19e1[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x3b4c23,null))[_0x8b45('0x18')](function(_0x493a0c){if(_0x493a0c){_0x43237b['model']=_[_0x8b45('0x4e')](db['ChatOfflineMessage']['rawAttributes']);_0x43237b[_0x8b45('0x4d')]=_[_0x8b45('0x4e')](_0xa19e1[_0x8b45('0x4d')]);_0x43237b[_0x8b45('0x4f')]=_[_0x8b45('0x51')](_0x43237b[_0x8b45('0x43')],_0x43237b[_0x8b45('0x4d')]);_0x427161[_0x8b45('0x50')]=_[_0x8b45('0x51')](_0x43237b[_0x8b45('0x43')],qs[_0x8b45('0x52')](_0xa19e1[_0x8b45('0x4d')][_0x8b45('0x52')]));_0x427161['attributes']=_0x427161[_0x8b45('0x50')]['length']?_0x427161[_0x8b45('0x50')]:_0x43237b['model'];if(!_0xa19e1['query'][_0x8b45('0x54')](_0x8b45('0x55'))){_0x427161[_0x8b45('0x29')]=qs['limit'](_0xa19e1['query'][_0x8b45('0x29')]);_0x427161[_0x8b45('0x27')]=qs[_0x8b45('0x27')](_0xa19e1[_0x8b45('0x4d')][_0x8b45('0x27')]);}_0x427161['order']=qs[_0x8b45('0x56')](_0xa19e1[_0x8b45('0x4d')][_0x8b45('0x56')]);_0x427161[_0x8b45('0x57')]=qs[_0x8b45('0x4f')](_[_0x8b45('0x77')](_0xa19e1[_0x8b45('0x4d')],_0x43237b[_0x8b45('0x4f')]));_0x427161['where']['ChatWebsiteId']=_0x493a0c['id'];if(_0xa19e1[_0x8b45('0x4d')]['filter']){_0x427161['where']=_[_0x8b45('0x59')](_0x427161['where'],{'$or':_[_0x8b45('0x49')](_0x427161[_0x8b45('0x50')],function(_0x164f7a){var _0x5d194d={};_0x5d194d[_0x164f7a]={'$like':'%'+_0xa19e1[_0x8b45('0x4d')][_0x8b45('0x58')]+'%'};return _0x5d194d;})});}_0x427161=_[_0x8b45('0x59')]({},_0x427161,_0xa19e1[_0x8b45('0x5b')]);return db['ChatOfflineMessage'][_0x8b45('0x2a')]({'where':_0x427161[_0x8b45('0x57')]})[_0x8b45('0x18')](function(_0x4bd1ab){_0x450624[_0x8b45('0x2a')]=_0x4bd1ab;if(_0xa19e1['query'][_0x8b45('0x60')]){_0x427161[_0x8b45('0x5c')]=[{'all':!![]}];}else{_0x427161[_0x8b45('0x5c')]=[{'model':db[_0x8b45('0xa2')],'as':_0x8b45('0x100'),'required':![]},{'model':db['Attachment'],'as':_0x8b45('0x12b'),'required':![]}];}return db[_0x8b45('0xe2')][_0x8b45('0x5d')](_0x427161);})[_0x8b45('0x18')](function(_0x52879d){_0x450624[_0x8b45('0x5e')]=_0x52879d;return _0x450624;});}})['then'](respondWithFilteredResult(_0x3b4c23,_0x427161))['catch'](handleError(_0x3b4c23,null));};exports[_0x8b45('0x12c')]=function(_0xaad3df,_0x1ff5e5){return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0xaad3df['params']['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x1ff5e5,null))[_0x8b45('0x18')](function(_0x19722b){if(_0x19722b){return _0x19722b['addAgents'](_0xaad3df['body']['ids'],_[_0x8b45('0xfe')](_0xaad3df[_0x8b45('0x61')],[_0x8b45('0x7a'),'id'])||{})[_0x8b45('0xdd')](function(_0x2796a7){for(var _0x116bd2=0x0;_0x116bd2<_0xaad3df[_0x8b45('0x61')][_0x8b45('0x7a')][_0x8b45('0x53')];_0x116bd2+=0x1){socket[_0x8b45('0x12d')](_0x8b45('0x12e'),{'UserId':Number(_0xaad3df[_0x8b45('0x61')]['ids'][_0x116bd2]),'ChatWebsiteId':Number(_0xaad3df[_0x8b45('0x70')]['id'])});}return _0x2796a7;});}})[_0x8b45('0x18')](respondWithResult(_0x1ff5e5,null))[_0x8b45('0x5f')](handleError(_0x1ff5e5,null));};exports[_0x8b45('0x12f')]=function(_0x868c05,_0x27fc9c){return db[_0x8b45('0x4a')][_0x8b45('0x68')]({'where':{'id':_0x868c05[_0x8b45('0x70')]['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x27fc9c,null))[_0x8b45('0x18')](function(_0x39b657){if(_0x39b657){return _0x39b657[_0x8b45('0x12f')](_0x868c05[_0x8b45('0x4d')]['ids'])[_0x8b45('0x18')](function(){if(_['isArray'](_0x868c05[_0x8b45('0x4d')][_0x8b45('0x7a')])){for(var _0x1e7c92=0x0;_0x1e7c92<_0x868c05['query'][_0x8b45('0x7a')][_0x8b45('0x53')];_0x1e7c92+=0x1){socket[_0x8b45('0x12d')](_0x8b45('0x130'),{'UserId':Number(_0x868c05[_0x8b45('0x4d')][_0x8b45('0x7a')][_0x1e7c92]),'ChatWebsiteId':Number(_0x868c05['params']['id'])});}}else{socket[_0x8b45('0x12d')](_0x8b45('0x130'),{'UserId':Number(_0x868c05[_0x8b45('0x4d')][_0x8b45('0x7a')]),'ChatWebsiteId':Number(_0x868c05['params']['id'])});}});}})['then'](respondWithStatusCode(_0x27fc9c,null))[_0x8b45('0x5f')](handleError(_0x27fc9c,null));};exports[_0x8b45('0x131')]=function(_0x3ae9b2,_0x531db4){var _0x1a5564={};var _0x348ee0={};var _0x3537d3;var _0x27ed43;return db[_0x8b45('0x4a')][_0x8b45('0x75')]({'where':{'id':_0x3ae9b2['params']['id']}})[_0x8b45('0x18')](handleEntityNotFound(_0x531db4,null))[_0x8b45('0x18')](function(_0x164648){if(_0x164648){_0x3537d3=_0x164648;_0x348ee0[_0x8b45('0x43')]=_[_0x8b45('0x4e')](db[_0x8b45('0x101')][_0x8b45('0x4b')]);_0x348ee0[_0x8b45('0x4d')]=_[_0x8b45('0x4e')](_0x3ae9b2[_0x8b45('0x4d')]);_0x348ee0['filters']=_[_0x8b45('0x51')](_0x348ee0[_0x8b45('0x43')],_0x348ee0['query']);_0x1a5564['attributes']=_[_0x8b45('0x51')](_0x348ee0[_0x8b45('0x43')],qs['fields'](_0x3ae9b2[_0x8b45('0x4d')]['fields']));_0x1a5564[_0x8b45('0x50')]=_0x1a5564[_0x8b45('0x50')][_0x8b45('0x53')]?_0x1a5564[_0x8b45('0x50')]:_0x348ee0['model'];_0x1a5564['order']=qs[_0x8b45('0x56')](_0x3ae9b2[_0x8b45('0x4d')]['sort']);_0x1a5564[_0x8b45('0x57')]=qs[_0x8b45('0x4f')](_['pick'](_0x3ae9b2['query'],_0x348ee0[_0x8b45('0x4f')]));if(_0x3ae9b2['query'][_0x8b45('0x58')]){_0x1a5564['where']=_[_0x8b45('0x59')](_0x1a5564[_0x8b45('0x57')],{'$or':_[_0x8b45('0x49')](_0x1a5564['attributes'],function(_0x45a4f2){var _0x5be512={};_0x5be512[_0x45a4f2]={'$like':'%'+_0x3ae9b2[_0x8b45('0x4d')][_0x8b45('0x58')]+'%'};return _0x5be512;})});}_0x1a5564=_[_0x8b45('0x59')]({},_0x1a5564,_0x3ae9b2[_0x8b45('0x5b')]);return _0x3537d3[_0x8b45('0x131')](_0x1a5564);}})[_0x8b45('0x18')](function(_0x2db8d8){if(_0x2db8d8){_0x27ed43=_0x2db8d8[_0x8b45('0x53')];if(!_0x3ae9b2[_0x8b45('0x4d')][_0x8b45('0x54')](_0x8b45('0x55'))){_0x1a5564[_0x8b45('0x29')]=qs['limit'](_0x3ae9b2[_0x8b45('0x4d')][_0x8b45('0x29')]);_0x1a5564[_0x8b45('0x27')]=qs['offset'](_0x3ae9b2['query'][_0x8b45('0x27')]);}return _0x3537d3[_0x8b45('0x131')](_0x1a5564);}})['then'](function(_0x5b97ca){if(_0x5b97ca){return _0x5b97ca?{'count':_0x27ed43,'rows':_0x5b97ca}:null;}})[_0x8b45('0x18')](respondWithResult(_0x531db4,null))['catch'](handleError(_0x531db4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3e250b6..c9f0154 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 _0x87df=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x12813f,_0x38ae10){var _0x313ce3=function(_0x4006fe){while(--_0x4006fe){_0x12813f['push'](_0x12813f['shift']());}};_0x313ce3(++_0x38ae10);}(_0x87df,0x167));var _0xf87d=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0x87df[_0x3fc287];return _0x33af9f;};'use strict';var EventEmitter=require(_0xf87d('0x0'));var ChatWebsite=require(_0xf87d('0x1'))['db'][_0xf87d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf87d('0x3')](0x0);var events={'afterCreate':_0xf87d('0x4'),'afterUpdate':_0xf87d('0x5'),'afterDestroy':_0xf87d('0x6')};function emitEvent(_0xb0fb5a){return function(_0x25290a,_0x1d4ff6,_0x4fbca2){ChatWebsiteEvents['emit'](_0xb0fb5a+':'+_0x25290a['id'],_0x25290a);ChatWebsiteEvents[_0xf87d('0x7')](_0xb0fb5a,_0x25290a);_0x4fbca2(null);};}for(var e in events){if(events[_0xf87d('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xf87d('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x0689=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x4d86d7,_0x29884d){var _0x4c80ca=function(_0x21b53b){while(--_0x21b53b){_0x4d86d7['push'](_0x4d86d7['shift']());}};_0x4c80ca(++_0x29884d);}(_0x0689,0x161));var _0x9068=function(_0x435fa1,_0x58550a){_0x435fa1=_0x435fa1-0x0;var _0x845f9f=_0x0689[_0x435fa1];return _0x845f9f;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9068('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9068('0x1')](0x0);var events={'afterCreate':_0x9068('0x2'),'afterUpdate':_0x9068('0x3'),'afterDestroy':_0x9068('0x4')};function emitEvent(_0x44080a){return function(_0x1c35ba,_0x3b12f4,_0x1dbc6f){ChatWebsiteEvents[_0x9068('0x5')](_0x44080a+':'+_0x1c35ba['id'],_0x1c35ba);ChatWebsiteEvents[_0x9068('0x5')](_0x44080a,_0x1c35ba);_0x1dbc6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9068('0x6')](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 7ea285b..b27c2a5 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 _0xaa9e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xaa9e,0xa8));var _0xeaa9=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xaa9e[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xeaa9('0x0'));var util=require('util');var logger=require(_0xeaa9('0x1'))(_0xeaa9('0x2'));var moment=require(_0xeaa9('0x3'));var BPromise=require(_0xeaa9('0x4'));var rp=require(_0xeaa9('0x5'));var fs=require('fs');var path=require(_0xeaa9('0x6'));var rimraf=require(_0xeaa9('0x7'));var config=require(_0xeaa9('0x8'));var attributes=require(_0xeaa9('0x9'));module[_0xeaa9('0xa')]=function(_0x5cb17c,_0x3d2e78){return _0x5cb17c[_0xeaa9('0xb')](_0xeaa9('0xc'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd6a=['../../config/environment','exports','define','ChatWebsite','chat_websites','util','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd6a,0x195));var _0xabd6=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xbd6a[_0x18abd2];return _0x1dcad6;};'use strict';var _=require('lodash');var util=require(_0xabd6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xabd6('0x1'));var BPromise=require(_0xabd6('0x2'));var rp=require(_0xabd6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabd6('0x4'));var config=require(_0xabd6('0x5'));var attributes=require('./chatWebsite.attributes');module[_0xabd6('0x6')]=function(_0x1f5ae6,_0x465464){return _0x1f5ae6[_0xabd6('0x7')](_0xabd6('0x8'),attributes,{'tableName':_0xabd6('0x9'),'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 b32b52f..c530210 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 _0x32e0=['stringify','error','ChatWebsite,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x32e0,0xc5));var _0x032e=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x32e0[_0x39ffd1];return _0x31267e;};'use strict';var _=require('lodash');var util=require(_0x032e('0x0'));var moment=require(_0x032e('0x1'));var BPromise=require(_0x032e('0x2'));var rs=require(_0x032e('0x3'));var fs=require('fs');var Redis=require(_0x032e('0x4'));var db=require(_0x032e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x032e('0x6'));var config=require(_0x032e('0x7'));var jayson=require(_0x032e('0x8'));var client=jayson[_0x032e('0x9')][_0x032e('0xa')]({'port':0x232a});config[_0x032e('0xb')]=_['defaults'](config[_0x032e('0xb')],{'host':_0x032e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x032e('0xb')]));require('./chatWebsite.socket')[_0x032e('0xd')](socket);function respondWithRpcPromise(_0x1d2214,_0x1a7922,_0x175402){return new BPromise(function(_0xefcdf1,_0x34e439){return client[_0x032e('0xe')](_0x1d2214,_0x175402)['then'](function(_0xabef99){logger[_0x032e('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0x032e('0x10'));logger[_0x032e('0x11')](_0x032e('0x12'),_0x1a7922,'request\x20sent',JSON[_0x032e('0x13')](_0xabef99));if(_0xabef99[_0x032e('0x14')]){if(_0xabef99['error']['code']===0x1f4){logger[_0x032e('0x14')](_0x032e('0x15'),_0x1a7922,_0xabef99['error']['message']);return _0x34e439(_0xabef99[_0x032e('0x14')][_0x032e('0x16')]);}logger[_0x032e('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0xabef99['error'][_0x032e('0x16')]);return _0xefcdf1(_0xabef99[_0x032e('0x14')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0x032e('0x10'));_0xefcdf1(_0xabef99['result'][_0x032e('0x16')]);}})[_0x032e('0x17')](function(_0x529d96){logger[_0x032e('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0x529d96);_0x34e439(_0x529d96);});});} \ No newline at end of file +var _0x94ca=['code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x39c138,_0x244b52){var _0x5e737a=function(_0x3ff4a8){while(--_0x3ff4a8){_0x39c138['push'](_0x39c138['shift']());}};_0x5e737a(++_0x244b52);}(_0x94ca,0x8e));var _0xa94c=function(_0x6d989d,_0x416427){_0x6d989d=_0x6d989d-0x0;var _0x5c5535=_0x94ca[_0x6d989d];return _0x5c5535;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa94c('0x0'));var rs=require(_0xa94c('0x1'));var fs=require('fs');var Redis=require(_0xa94c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa94c('0x3'));var logger=require(_0xa94c('0x4'))(_0xa94c('0x5'));var config=require(_0xa94c('0x6'));var jayson=require(_0xa94c('0x7'));var client=jayson['client'][_0xa94c('0x8')]({'port':0x232a});config[_0xa94c('0x9')]=_[_0xa94c('0xa')](config[_0xa94c('0x9')],{'host':_0xa94c('0xb'),'port':0x18eb});var socket=require(_0xa94c('0xc'))(new Redis(config[_0xa94c('0x9')]));require('./chatWebsite.socket')[_0xa94c('0xd')](socket);function respondWithRpcPromise(_0x5f3199,_0x2a0d6c,_0x51c065){return new BPromise(function(_0x50cd48,_0x46aefe){return client['request'](_0x5f3199,_0x51c065)['then'](function(_0x267171){logger[_0xa94c('0xe')](_0xa94c('0xf'),_0x2a0d6c,_0xa94c('0x10'));logger[_0xa94c('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2a0d6c,_0xa94c('0x10'),JSON['stringify'](_0x267171));if(_0x267171[_0xa94c('0x12')]){if(_0x267171[_0xa94c('0x12')][_0xa94c('0x13')]===0x1f4){logger[_0xa94c('0x12')](_0xa94c('0xf'),_0x2a0d6c,_0x267171['error'][_0xa94c('0x14')]);return _0x46aefe(_0x267171['error'][_0xa94c('0x14')]);}logger[_0xa94c('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x2a0d6c,_0x267171[_0xa94c('0x12')][_0xa94c('0x14')]);return _0x50cd48(_0x267171[_0xa94c('0x12')]['message']);}else{logger[_0xa94c('0xe')](_0xa94c('0xf'),_0x2a0d6c,'request\x20sent');_0x50cd48(_0x267171[_0xa94c('0x15')]['message']);}})[_0xa94c('0x16')](function(_0x419ea7){logger['error'](_0xa94c('0xf'),_0x2a0d6c,_0x419ea7);_0x46aefe(_0x419ea7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index de3c021..2e925ef 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 _0x13d9=['removeListener','register','chatWebsite:','./chatWebsite.events','save','update','emit'];(function(_0x4b9a64,_0x3c3a2a){var _0xdb31de=function(_0x35d4f5){while(--_0x35d4f5){_0x4b9a64['push'](_0x4b9a64['shift']());}};_0xdb31de(++_0x3c3a2a);}(_0x13d9,0xa4));var _0x913d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13d9[_0x14add3];return _0x4a174f;};'use strict';var ChatWebsiteEvents=require(_0x913d('0x0'));var events=[_0x913d('0x1'),'remove',_0x913d('0x2')];function createListener(_0x5136a7,_0x13e669){return function(_0x106c03){_0x13e669[_0x913d('0x3')](_0x5136a7,_0x106c03);};}function removeListener(_0x332464,_0x295b1e){return function(){ChatWebsiteEvents[_0x913d('0x4')](_0x332464,_0x295b1e);};}exports[_0x913d('0x5')]=function(_0x3c1e0d){for(var _0x33dee8=0x0,_0x15bcc3=events['length'];_0x33dee8<_0x15bcc3;_0x33dee8++){var _0x5606dd=events[_0x33dee8];var _0x38257e=createListener(_0x913d('0x6')+_0x5606dd,_0x3c1e0d);ChatWebsiteEvents['on'](_0x5606dd,_0x38257e);}}; \ No newline at end of file +var _0x6b39=['length','chatWebsite:','./chatWebsite.events','update','emit','register'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6b39,0xf2));var _0x96b3=function(_0x1a3f88,_0x3e0d6d){_0x1a3f88=_0x1a3f88-0x0;var _0x1dca45=_0x6b39[_0x1a3f88];return _0x1dca45;};'use strict';var ChatWebsiteEvents=require(_0x96b3('0x0'));var events=['save','remove',_0x96b3('0x1')];function createListener(_0x349ab5,_0x182019){return function(_0x52e49e){_0x182019[_0x96b3('0x2')](_0x349ab5,_0x52e49e);};}function removeListener(_0x175b8f,_0x40532e){return function(){ChatWebsiteEvents['removeListener'](_0x175b8f,_0x40532e);};}exports[_0x96b3('0x3')]=function(_0x291a7e){for(var _0x3787ec=0x0,_0x4d1e0e=events[_0x96b3('0x4')];_0x3787ec<_0x4d1e0e;_0x3787ec++){var _0x2b5403=events[_0x3787ec];var _0x5ca6e7=createListener(_0x96b3('0x5')+_0x2b5403,_0x291a7e);ChatWebsiteEvents['on'](_0x2b5403,_0x5ca6e7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 81e2755..6fb047c 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['escapeRegExp','URL','replace','localhost','test','trim','exports','../../../utils/misc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x66fa,0x117));var _0xa66f=function(_0x152330,_0x2c86d1){_0x152330=_0x152330-0x0;var _0xc44ae3=_0x66fa[_0x152330];return _0xc44ae3;};var escapeRegExp=require(_0xa66f('0x0'))[_0xa66f('0x1')];var URL=require('url')[_0xa66f('0x2')];function testWildcardValidity(_0x2dcf24){var _0x234f2d=!![];try{new URL(_0x2dcf24[_0xa66f('0x3')]('*',_0xa66f('0x4')));}catch(_0x2a2abf){_0x234f2d=![];}return _0x234f2d&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xa66f('0x5')](_0x2dcf24);}function testWebsiteWithWildcard(_0x5ebea5,_0x4fd9d0){var _0x2239d3;var _0x20a150=escapeRegExp(_0x5ebea5[_0xa66f('0x6')]()[_0xa66f('0x3')](/\/$/,''))[_0xa66f('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x5ebea5[_0xa66f('0x3')]('\x5c*','localhost'));_0x2239d3=new RegExp(_0x20a150)[_0xa66f('0x5')](_0x4fd9d0);}catch(_0x597c7c){_0x2239d3=![];}return _0x2239d3;}module[_0xa66f('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x1261=['escapeRegExp','url','URL','replace','localhost','test','trim','([\x5cw]+)','exports'];(function(_0x2a94f8,_0x454b8d){var _0x29cbfe=function(_0x3630d0){while(--_0x3630d0){_0x2a94f8['push'](_0x2a94f8['shift']());}};_0x29cbfe(++_0x454b8d);}(_0x1261,0x144));var _0x1126=function(_0x8d8f23,_0x8c1961){_0x8d8f23=_0x8d8f23-0x0;var _0x22bf54=_0x1261[_0x8d8f23];return _0x22bf54;};var escapeRegExp=require('../../../utils/misc')[_0x1126('0x0')];var URL=require(_0x1126('0x1'))[_0x1126('0x2')];function testWildcardValidity(_0x331a2c){var _0x39b786=!![];try{new URL(_0x331a2c[_0x1126('0x3')]('*',_0x1126('0x4')));}catch(_0x4245ca){_0x39b786=![];}return _0x39b786&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x1126('0x5')](_0x331a2c);}function testWebsiteWithWildcard(_0x75a851,_0x5a2189){var _0x5c68c8;var _0x40ba58=escapeRegExp(_0x75a851[_0x1126('0x6')]()['replace'](/\/$/,''))[_0x1126('0x3')]('\x5c*',_0x1126('0x7'));try{new URL(_0x75a851[_0x1126('0x3')]('\x5c*',_0x1126('0x4')));_0x5c68c8=new RegExp(_0x40ba58)[_0x1126('0x5')](_0x5a2189);}catch(_0x59cfa1){_0x5c68c8=![];}return _0x5c68c8;}module[_0x1126('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cfbdf0c..7eaa1ba 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 _0x8fe9=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/fields','getFields','/:id/users','post','diskStorage','join','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','root','server/files/images/avatars/','/:id/avatar','addAvatar','/:id/customer_avatar','addCustomerAvatar','originalname','addSystemAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','/:id/applications','addAgents','put','update','delete','destroy','removeDispositions','exports','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x522c1a,_0x1299ed){var _0x5807ee=function(_0x4e5601){while(--_0x4e5601){_0x522c1a['push'](_0x522c1a['shift']());}};_0x5807ee(++_0x1299ed);}(_0x8fe9,0x122));var _0x98fe=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0x8fe9[_0xd1a252];return _0x560ee1;};'use strict';var multer=require('multer');var util=require(_0x98fe('0x0'));var path=require(_0x98fe('0x1'));var timeout=require(_0x98fe('0x2'));var express=require(_0x98fe('0x3'));var router=express[_0x98fe('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98fe('0x5'));var controller=require('./chatWebsite.controller');router[_0x98fe('0x6')]('/',auth[_0x98fe('0x7')](),controller['index']);router[_0x98fe('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x98fe('0x6')](_0x98fe('0x8'),auth['isAuthenticated'](),controller[_0x98fe('0x9')]);router['get'](_0x98fe('0xa'),auth[_0x98fe('0x7')](),controller[_0x98fe('0xb')]);router[_0x98fe('0x6')](_0x98fe('0xc'),auth[_0x98fe('0x7')](),controller[_0x98fe('0xd')]);router['get'](_0x98fe('0xe'),controller['getLogo']);router[_0x98fe('0x6')]('/:id/avatar',controller[_0x98fe('0xf')]);router[_0x98fe('0x6')]('/:id/customer_avatar',controller[_0x98fe('0x10')]);router[_0x98fe('0x6')](_0x98fe('0x11'),controller['getSystemAvatar']);router['get'](_0x98fe('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x98fe('0x6')](_0x98fe('0x13'),controller[_0x98fe('0x14')]);router[_0x98fe('0x6')]('/:id/applications',auth[_0x98fe('0x7')](),controller[_0x98fe('0x15')]);router[_0x98fe('0x6')]('/:id/proactive_actions',auth[_0x98fe('0x7')](),controller['getProactiveActions']);router[_0x98fe('0x6')](_0x98fe('0x16'),controller[_0x98fe('0x17')]);router[_0x98fe('0x6')]('/:id/offline_messages',auth[_0x98fe('0x7')](),controller['getOfflineMessages']);router['get'](_0x98fe('0x18'),auth[_0x98fe('0x7')](),controller['getAgents']);router[_0x98fe('0x19')]('/',auth[_0x98fe('0x7')](),controller['create']);router[_0x98fe('0x19')](_0x98fe('0xa'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x98fe('0x19')](_0x98fe('0xc'),auth[_0x98fe('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x98fe('0x1a')]({'destination':function(_0x521f99,_0x486414,_0xbcbff0){_0xbcbff0(null,path[_0x98fe('0x1b')](config['root'],_0x98fe('0x1c')));},'filename':function(_0x1d1090,_0x472f9e,_0x44dacf){_0x44dacf(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date[_0x98fe('0x1f')](),_0x472f9e['originalname']));}})});router[_0x98fe('0x19')]('/:id/logo',upload[_0x98fe('0x20')](_0x98fe('0x21')),controller[_0x98fe('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb9789e,_0x1d502e,_0x1ec6c){_0x1ec6c(null,path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x24')));},'filename':function(_0x9ae7d4,_0x216259,_0xefd76){_0xefd76(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date['now'](),_0x216259['originalname']));}})});router[_0x98fe('0x19')](_0x98fe('0x25'),upload['single'](_0x98fe('0x21')),controller[_0x98fe('0x26')]);var upload=multer({'storage':multer[_0x98fe('0x1a')]({'destination':function(_0x1e3cb6,_0x6f1275,_0x131193){_0x131193(null,path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x24')));},'filename':function(_0x399684,_0x40af93,_0x5bf1b3){_0x5bf1b3(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date[_0x98fe('0x1f')](),_0x40af93['originalname']));}})});router[_0x98fe('0x19')](_0x98fe('0x27'),upload[_0x98fe('0x20')](_0x98fe('0x21')),controller[_0x98fe('0x28')]);var upload=multer({'storage':multer[_0x98fe('0x1a')]({'destination':function(_0x5ab2b1,_0x49530a,_0x34b923){_0x34b923(null,path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x24')));},'filename':function(_0x2b0690,_0x44b513,_0xfc29ed){_0xfc29ed(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date['now'](),_0x44b513[_0x98fe('0x29')]));}})});router[_0x98fe('0x19')](_0x98fe('0x11'),upload[_0x98fe('0x20')]('file'),controller[_0x98fe('0x2a')]);router[_0x98fe('0x19')](_0x98fe('0x2b'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x41ab90,_0x2dd6ee,_0xe1d93f){const _0x1a2a56=path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x2c'),'attachments',_0x98fe('0x2d'));fs_extra[_0x98fe('0x2e')](_0x1a2a56,function(){_0xe1d93f(null,_0x1a2a56);});},'filename':function(_0x5b4f24,_0x7f0023,_0x519bad){const _0x3bb170=_0x7f0023[_0x98fe('0x29')][_0x98fe('0x2f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3bd8ca=path[_0x98fe('0x30')](_0x3bb170);const _0xf85f0=Date[_0x98fe('0x1f')]()+'-'+_0x3bb170['replace'](_0x3bd8ca,'')+_0x3bd8ca;_0x519bad(null,_0xf85f0);}})});router['post']('/:id/offline',offlineUploadMulter[_0x98fe('0x31')](),controller[_0x98fe('0x32')]);router['post']('/:id/interactions',auth[_0x98fe('0x7')](),controller[_0x98fe('0x33')]);router[_0x98fe('0x19')](_0x98fe('0x34'),auth[_0x98fe('0x7')](),controller['addApplications']);router[_0x98fe('0x19')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x98fe('0x19')](_0x98fe('0x18'),auth[_0x98fe('0x7')](),controller[_0x98fe('0x35')]);router[_0x98fe('0x36')](_0x98fe('0x8'),auth['isAuthenticated'](),controller[_0x98fe('0x37')]);router[_0x98fe('0x38')](_0x98fe('0x8'),auth[_0x98fe('0x7')](),controller[_0x98fe('0x39')]);router[_0x98fe('0x38')](_0x98fe('0xa'),auth['isAuthenticated'](),controller[_0x98fe('0x3a')]);router[_0x98fe('0x38')]('/:id/canned_answers',auth[_0x98fe('0x7')](),controller['removeAnswers']);router[_0x98fe('0x38')](_0x98fe('0x18'),auth[_0x98fe('0x7')](),controller['removeAgents']);module[_0x98fe('0x3b')]=router; \ No newline at end of file +var _0x525f=['server/files/images/avatars/','originalname','single','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','update','destroy','delete','removeDispositions','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','file','addLogo','join','%s-%s','now','addAvatar'];(function(_0x3d9cfa,_0x596edc){var _0x21d89d=function(_0x5668c2){while(--_0x5668c2){_0x3d9cfa['push'](_0x3d9cfa['shift']());}};_0x21d89d(++_0x596edc);}(_0x525f,0x180));var _0xf525=function(_0x171e21,_0x2762da){_0x171e21=_0x171e21-0x0;var _0x57afa4=_0x525f[_0x171e21];return _0x57afa4;};'use strict';var multer=require(_0xf525('0x0'));var util=require(_0xf525('0x1'));var path=require(_0xf525('0x2'));var timeout=require('connect-timeout');var express=require(_0xf525('0x3'));var router=express[_0xf525('0x4')]();var fs_extra=require(_0xf525('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf525('0x6'));var config=require(_0xf525('0x7'));var controller=require(_0xf525('0x8'));router[_0xf525('0x9')]('/',auth[_0xf525('0xa')](),controller[_0xf525('0xb')]);router[_0xf525('0x9')]('/describe',auth[_0xf525('0xa')](),controller['describe']);router[_0xf525('0x9')](_0xf525('0xc'),auth[_0xf525('0xa')](),controller[_0xf525('0xd')]);router['get'](_0xf525('0xe'),auth[_0xf525('0xa')](),controller['getDispositions']);router[_0xf525('0x9')](_0xf525('0xf'),auth[_0xf525('0xa')](),controller[_0xf525('0x10')]);router[_0xf525('0x9')](_0xf525('0x11'),controller[_0xf525('0x12')]);router[_0xf525('0x9')]('/:id/avatar',controller[_0xf525('0x13')]);router[_0xf525('0x9')](_0xf525('0x14'),controller[_0xf525('0x15')]);router[_0xf525('0x9')]('/:id/system_avatar',controller[_0xf525('0x16')]);router[_0xf525('0x9')](_0xf525('0x17'),auth[_0xf525('0xa')](),controller[_0xf525('0x18')]);router['get'](_0xf525('0x19'),controller[_0xf525('0x1a')]);router[_0xf525('0x9')](_0xf525('0x1b'),auth[_0xf525('0xa')](),controller[_0xf525('0x1c')]);router[_0xf525('0x9')](_0xf525('0x1d'),auth[_0xf525('0xa')](),controller[_0xf525('0x1e')]);router[_0xf525('0x9')]('/:id/fields',controller['getFields']);router[_0xf525('0x9')](_0xf525('0x1f'),auth[_0xf525('0xa')](),controller['getOfflineMessages']);router['get'](_0xf525('0x20'),auth['isAuthenticated'](),controller[_0xf525('0x21')]);router[_0xf525('0x22')]('/',auth[_0xf525('0xa')](),controller[_0xf525('0x23')]);router[_0xf525('0x22')](_0xf525('0xe'),auth[_0xf525('0xa')](),controller[_0xf525('0x24')]);router[_0xf525('0x22')](_0xf525('0xf'),auth['isAuthenticated'](),controller[_0xf525('0x25')]);var upload=multer({'storage':multer[_0xf525('0x26')]({'destination':function(_0x2842b9,_0x4154ba,_0x2d0bc9){_0x2d0bc9(null,path['join'](config[_0xf525('0x27')],_0xf525('0x28')));},'filename':function(_0x24b4aa,_0x16c8b3,_0x311a9e){_0x311a9e(null,util[_0xf525('0x29')]('%s-%s',Date['now'](),_0x16c8b3['originalname']));}})});router[_0xf525('0x22')](_0xf525('0x11'),upload['single'](_0xf525('0x2a')),controller[_0xf525('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x26a090,_0x459253,_0x4af5cd){_0x4af5cd(null,path[_0xf525('0x2c')](config[_0xf525('0x27')],'server/files/images/avatars/'));},'filename':function(_0x32e87e,_0x5b062c,_0x50464d){_0x50464d(null,util['format'](_0xf525('0x2d'),Date[_0xf525('0x2e')](),_0x5b062c['originalname']));}})});router[_0xf525('0x22')]('/:id/avatar',upload['single'](_0xf525('0x2a')),controller[_0xf525('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4bea76,_0x48d585,_0x12bd54){_0x12bd54(null,path[_0xf525('0x2c')](config[_0xf525('0x27')],_0xf525('0x30')));},'filename':function(_0x2fa113,_0x4ae91e,_0x309522){_0x309522(null,util[_0xf525('0x29')](_0xf525('0x2d'),Date[_0xf525('0x2e')](),_0x4ae91e[_0xf525('0x31')]));}})});router[_0xf525('0x22')](_0xf525('0x14'),upload[_0xf525('0x32')]('file'),controller[_0xf525('0x33')]);var upload=multer({'storage':multer[_0xf525('0x26')]({'destination':function(_0x5f4238,_0x43b83a,_0x3377c6){_0x3377c6(null,path[_0xf525('0x2c')](config['root'],_0xf525('0x30')));},'filename':function(_0x108357,_0x55b19b,_0x38c30e){_0x38c30e(null,util['format'](_0xf525('0x2d'),Date['now'](),_0x55b19b[_0xf525('0x31')]));}})});router['post'](_0xf525('0x34'),upload[_0xf525('0x32')](_0xf525('0x2a')),controller[_0xf525('0x35')]);router[_0xf525('0x22')](_0xf525('0x36'),controller[_0xf525('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x362350,_0x1f924d,_0x5681cf){const _0x1ed66c=path[_0xf525('0x2c')](config[_0xf525('0x27')],_0xf525('0x38'),'attachments',_0xf525('0x39'));fs_extra[_0xf525('0x3a')](_0x1ed66c,function(){_0x5681cf(null,_0x1ed66c);});},'filename':function(_0x498c7f,_0x2f96f2,_0xec6fe8){const _0x41441d=_0x2f96f2[_0xf525('0x31')][_0xf525('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5ee12f=path[_0xf525('0x3c')](_0x41441d);const _0x5e2dc1=Date[_0xf525('0x2e')]()+'-'+_0x41441d[_0xf525('0x3b')](_0x5ee12f,'')+_0x5ee12f;_0xec6fe8(null,_0x5e2dc1);}})});router[_0xf525('0x22')](_0xf525('0x3d'),offlineUploadMulter[_0xf525('0x3e')](),controller[_0xf525('0x3f')]);router[_0xf525('0x22')](_0xf525('0x17'),auth[_0xf525('0xa')](),controller[_0xf525('0x40')]);router[_0xf525('0x22')](_0xf525('0x1b'),auth[_0xf525('0xa')](),controller['addApplications']);router[_0xf525('0x22')](_0xf525('0x1d'),auth[_0xf525('0xa')](),controller[_0xf525('0x41')]);router[_0xf525('0x22')](_0xf525('0x20'),auth[_0xf525('0xa')](),controller[_0xf525('0x42')]);router['put']('/:id',auth[_0xf525('0xa')](),controller[_0xf525('0x43')]);router['delete'](_0xf525('0xc'),auth[_0xf525('0xa')](),controller[_0xf525('0x44')]);router[_0xf525('0x45')](_0xf525('0xe'),auth['isAuthenticated'](),controller[_0xf525('0x46')]);router[_0xf525('0x45')](_0xf525('0xf'),auth[_0xf525('0xa')](),controller['removeAnswers']);router[_0xf525('0x45')](_0xf525('0x20'),auth[_0xf525('0xa')](),controller['removeAgents']);module[_0xf525('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 11bbcd0..f5cb688 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['/client-logs','isAuthenticated','exports','beaver-logger/server','../components/auth/service','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x368590,_0x48ad74){var _0x5ceb60=function(_0x322b8e){while(--_0x322b8e){_0x368590['push'](_0x368590['shift']());}};_0x5ceb60(++_0x48ad74);}(_0x9c00,0x13b));var _0x09c0=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c00[_0x3511d3];return _0x5d6321;};var beaverLogger=require(_0x09c0('0x0'));var express=require('express');var auth=require(_0x09c0('0x1'));var config=require('../config/environment');var router=express[_0x09c0('0x2')]();var isProduction=config[_0x09c0('0x3')]===_0x09c0('0x4')||![];function clientSideLogs(_0x927b75,_0x456dbc,_0x433146){var _0x1838a5=_0x927b75[_0x09c0('0x5')]['get'](_0x09c0('0x6'));if(!_0x1838a5){throw new Error(_0x09c0('0x7'));}return beaverLogger[_0x09c0('0x8')]({'uri':_0x09c0('0x9'),'logger':_0x1838a5,'enableCors':!isProduction})(_0x927b75,_0x456dbc,_0x433146);}router['use'](auth[_0x09c0('0xa')](),clientSideLogs);module[_0x09c0('0xb')]=router; \ No newline at end of file +var _0xff16=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../config/environment','Router'];(function(_0x4c8048,_0x510d1b){var _0x2abe23=function(_0x28b49a){while(--_0x28b49a){_0x4c8048['push'](_0x4c8048['shift']());}};_0x2abe23(++_0x510d1b);}(_0xff16,0xa6));var _0x6ff1=function(_0xe460e8,_0xeb563c){_0xe460e8=_0xe460e8-0x0;var _0x4ee203=_0xff16[_0xe460e8];return _0x4ee203;};var beaverLogger=require('beaver-logger/server');var express=require(_0x6ff1('0x0'));var auth=require('../components/auth/service');var config=require(_0x6ff1('0x1'));var router=express[_0x6ff1('0x2')]();var isProduction=config['env']===_0x6ff1('0x3')||![];function clientSideLogs(_0x368b03,_0x56c49c,_0x47a853){var _0x21bbe8=_0x368b03[_0x6ff1('0x4')][_0x6ff1('0x5')](_0x6ff1('0x6'));if(!_0x21bbe8){throw new Error(_0x6ff1('0x7'));}return beaverLogger[_0x6ff1('0x8')]({'uri':_0x6ff1('0x9'),'logger':_0x21bbe8,'enableCors':!isProduction})(_0x368b03,_0x56c49c,_0x47a853);}router[_0x6ff1('0xa')](auth[_0x6ff1('0xb')](),clientSideLogs);module[_0x6ff1('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e45ef78..768fb48 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 _0x6c9f=['STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x20dbe8,_0x3998af){var _0x2c06c6=function(_0x4d6b02){while(--_0x4d6b02){_0x20dbe8['push'](_0x20dbe8['shift']());}};_0x2c06c6(++_0x3998af);}(_0x6c9f,0xe8));var _0xf6c9=function(_0x3aa2d3,_0x550bbe){_0x3aa2d3=_0x3aa2d3-0x0;var _0x3daba8=_0x6c9f[_0x3aa2d3];return _0x3daba8;};'use strict';var Sequelize=require(_0xf6c9('0x0'));module[_0xf6c9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf6c9('0x2')](_0xf6c9('0x3'),_0xf6c9('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf6c9('0x2')](_0xf6c9('0x5'),_0xf6c9('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xf6c9('0x7')},'data2':{'type':Sequelize[_0xf6c9('0x8')],'comment':_0xf6c9('0x9')},'data3':{'type':Sequelize[_0xf6c9('0x8')],'comment':_0xf6c9('0xa')},'data4':{'type':Sequelize[_0xf6c9('0x8')],'comment':_0xf6c9('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xf6c9('0xc')},'data6':{'type':Sequelize[_0xf6c9('0xd')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xf6c9('0xd')],'comment':_0xf6c9('0xe')}}; \ No newline at end of file +var _0x0cf9=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','Outlook365'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x0cf9,0x120));var _0x90cf=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x0cf9[_0x3ce2c4];return _0x4047c1;};'use strict';var Sequelize=require(_0x90cf('0x0'));module[_0x90cf('0x1')]={'name':{'type':Sequelize[_0x90cf('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x90cf('0x3'),_0x90cf('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x90cf('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x90cf('0x2')],'comment':_0x90cf('0x6')},'data2':{'type':Sequelize[_0x90cf('0x2')],'comment':_0x90cf('0x7')},'data3':{'type':Sequelize[_0x90cf('0x2')],'comment':_0x90cf('0x8')},'data4':{'type':Sequelize['STRING'],'comment':_0x90cf('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0x90cf('0xa')},'data6':{'type':Sequelize[_0x90cf('0xb')],'comment':_0x90cf('0xc')},'data7':{'type':Sequelize[_0x90cf('0xb')],'comment':_0x90cf('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b2b88a6..b7ffd3e 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 _0x80fd=['create','body','Name\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','catch','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','from','base64','toString','ascii','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','offset','undefined','limit','count','set','json','update','then','destroy','end','stack','name','padEnd','slice','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','CloudProvider','includeAll','find'];(function(_0x1d4481,_0x305c65){var _0x1f3cc6=function(_0x33c5cf){while(--_0x33c5cf){_0x1d4481['push'](_0x1d4481['shift']());}};_0x1f3cc6(++_0x305c65);}(_0x80fd,0xde));var _0xd80f=function(_0x4fccaf,_0x139397){_0x4fccaf=_0x4fccaf-0x0;var _0x2256b0=_0x80fd[_0x4fccaf];return _0x2256b0;};'use strict';var _=require(_0xd80f('0x0'));var Redis=require(_0xd80f('0x1'));var qs=require(_0xd80f('0x2'));var encryptor=require(_0xd80f('0x3'));var config=require(_0xd80f('0x4'));var logger=require(_0xd80f('0x5'))('api');var db=require(_0xd80f('0x6'))['db'];var oauth=require(_0xd80f('0x7'));config[_0xd80f('0x8')]=_[_0xd80f('0x9')](config[_0xd80f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd80f('0xa'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1d5bb7,_0x48a3e2){_0x48a3e2=_0x48a3e2||0xcc;return function(_0x16ba71){if(_0x16ba71){return _0x1d5bb7[_0xd80f('0xb')](_0x48a3e2);}return _0x1d5bb7[_0xd80f('0xc')](_0x48a3e2)['end']();};}function respondWithResult(_0x2004be,_0x1857b6){_0x1857b6=_0x1857b6||0xc8;return function(_0x49e315){if(_0x49e315){return _0x2004be['status'](_0x1857b6)['json'](_0x49e315);}};}function respondWithFilteredResult(_0x34840a,_0x5349d6){return function(_0x22620b){if(_0x22620b){var _0x568395=typeof _0x5349d6[_0xd80f('0xd')]===_0xd80f('0xe')&&typeof _0x5349d6[_0xd80f('0xf')]===_0xd80f('0xe');var _0x134546=_0x22620b['count'];var _0x29603f=_0x568395?0x0:_0x5349d6[_0xd80f('0xd')];var _0x5f57d2=_0x568395?_0x22620b[_0xd80f('0x10')]:_0x5349d6['offset']+_0x5349d6[_0xd80f('0xf')];var _0x213987;if(_0x5f57d2>=_0x134546){_0x5f57d2=_0x134546;_0x213987=0xc8;}else{_0x213987=0xce;}_0x34840a[_0xd80f('0xc')](_0x213987);return _0x34840a[_0xd80f('0x11')]('Content-Range',_0x29603f+'-'+_0x5f57d2+'/'+_0x134546)[_0xd80f('0x12')](_0x22620b);}return null;};}function saveUpdates(_0x545269){return function(_0x206185){if(_0x206185){return _0x206185[_0xd80f('0x13')](_0x545269)[_0xd80f('0x14')](function(_0x5740f5){return _0x5740f5;});}return null;};}function removeEntity(_0x523421){return function(_0x47fe4a){if(_0x47fe4a){return _0x47fe4a[_0xd80f('0x15')]()[_0xd80f('0x14')](function(){_0x523421['status'](0xcc)[_0xd80f('0x16')]();});}};}function handleEntityNotFound(_0x1d53e0){return function(_0x59dac2){if(!_0x59dac2){_0x1d53e0['sendStatus'](0x194);}return _0x59dac2;};}function handleError(_0x5b0b31,_0x345f31){_0x345f31=_0x345f31||0x1f4;return function(_0x311465){logger['error'](_0x311465[_0xd80f('0x17')]);if(_0x311465[_0xd80f('0x18')]){delete _0x311465[_0xd80f('0x18')];}_0x5b0b31['status'](_0x345f31)['send'](_0x311465);};}function maskClientSecret(_0x9f45a9){return _[_0xd80f('0x19')](_0x9f45a9[_0xd80f('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x54ca50,_0x38283b){var _0x1f9e67={},_0x1b2eb3={},_0x19f852={'count':0x0,'rows':[]};var _0x19465c=_[_0xd80f('0x1b')](db['CloudProvider'][_0xd80f('0x1c')],function(_0x4ea83d){return{'name':_0x4ea83d[_0xd80f('0x1d')],'type':_0x4ea83d[_0xd80f('0x1e')][_0xd80f('0x1f')]};});_0x1b2eb3['model']=_['map'](_0x19465c,_0xd80f('0x18'));_0x1b2eb3[_0xd80f('0x20')]=_['keys'](_0x54ca50[_0xd80f('0x20')]);_0x1b2eb3[_0xd80f('0x21')]=_[_0xd80f('0x22')](_0x1b2eb3[_0xd80f('0x23')],_0x1b2eb3[_0xd80f('0x20')]);_0x1f9e67[_0xd80f('0x24')]=_[_0xd80f('0x22')](_0x1b2eb3[_0xd80f('0x23')],qs[_0xd80f('0x25')](_0x54ca50[_0xd80f('0x20')][_0xd80f('0x25')]));_0x1f9e67[_0xd80f('0x24')]=_0x1f9e67[_0xd80f('0x24')][_0xd80f('0x26')]?_0x1f9e67[_0xd80f('0x24')]:_0x1b2eb3[_0xd80f('0x23')];if(!_0x54ca50[_0xd80f('0x20')][_0xd80f('0x27')](_0xd80f('0x28'))){_0x1f9e67[_0xd80f('0xf')]=qs[_0xd80f('0xf')](_0x54ca50[_0xd80f('0x20')][_0xd80f('0xf')]);_0x1f9e67[_0xd80f('0xd')]=qs[_0xd80f('0xd')](_0x54ca50['query'][_0xd80f('0xd')]);}_0x1f9e67[_0xd80f('0x29')]=qs[_0xd80f('0x2a')](_0x54ca50[_0xd80f('0x20')][_0xd80f('0x2a')]);_0x1f9e67['where']=qs['filters'](_[_0xd80f('0x2b')](_0x54ca50[_0xd80f('0x20')],_0x1b2eb3[_0xd80f('0x21')]),_0x19465c);if(_0x54ca50[_0xd80f('0x20')]['filter']){_0x1f9e67[_0xd80f('0x2c')]=_['merge'](_0x1f9e67['where'],{'$or':_[_0xd80f('0x1b')](_0x19465c,function(_0x38bfb8){if(_0x38bfb8[_0xd80f('0x1e')]!=='VIRTUAL'){var _0x22e845={};_0x22e845[_0x38bfb8['name']]={'$like':'%'+_0x54ca50[_0xd80f('0x20')][_0xd80f('0x2d')]+'%'};return _0x22e845;}})});}_0x1f9e67=_[_0xd80f('0x2e')]({},_0x1f9e67,_0x54ca50[_0xd80f('0x2f')]);var _0x175baf={'where':_0x1f9e67[_0xd80f('0x2c')]};return db['CloudProvider'][_0xd80f('0x10')](_0x175baf)[_0xd80f('0x14')](function(_0x800f98){_0x19f852[_0xd80f('0x10')]=_0x800f98;if(_0x54ca50[_0xd80f('0x20')]['includeAll']){_0x1f9e67[_0xd80f('0x30')]=[{'all':!![]}];}return db['CloudProvider'][_0xd80f('0x31')](_0x1f9e67);})[_0xd80f('0x14')](function(_0x5bacde){_0x19f852[_0xd80f('0x32')]=_[_0xd80f('0x1b')](_0x5bacde,function(_0x1a4cc0){if(_0x1a4cc0[_0xd80f('0x33')]===_0xd80f('0x34')){var _0x5b7cbb=encryptor[_0xd80f('0x35')](_0x1a4cc0[_0xd80f('0x36')]);_0x1a4cc0[_0xd80f('0x36')]=maskClientSecret(_0x5b7cbb);}return _0x1a4cc0;});return _0x19f852;})[_0xd80f('0x14')](respondWithFilteredResult(_0x38283b,_0x1f9e67))['catch'](handleError(_0x38283b,null));};exports[_0xd80f('0x37')]=function(_0x70fe41,_0x1dceda){var _0x403c0f={'raw':!![],'where':{'id':_0x70fe41[_0xd80f('0x38')]['id']}},_0x398f70={};_0x398f70[_0xd80f('0x23')]=_['keys'](db[_0xd80f('0x39')][_0xd80f('0x1c')]);_0x398f70[_0xd80f('0x20')]=_['keys'](_0x70fe41[_0xd80f('0x20')]);_0x398f70[_0xd80f('0x21')]=_[_0xd80f('0x22')](_0x398f70[_0xd80f('0x23')],_0x398f70['query']);_0x403c0f['attributes']=_[_0xd80f('0x22')](_0x398f70[_0xd80f('0x23')],qs[_0xd80f('0x25')](_0x70fe41[_0xd80f('0x20')][_0xd80f('0x25')]));_0x403c0f[_0xd80f('0x24')]=_0x403c0f[_0xd80f('0x24')][_0xd80f('0x26')]?_0x403c0f[_0xd80f('0x24')]:_0x398f70[_0xd80f('0x23')];if(_0x70fe41[_0xd80f('0x20')][_0xd80f('0x3a')]){_0x403c0f['include']=[{'all':!![]}];}_0x403c0f=_[_0xd80f('0x2e')]({},_0x403c0f,_0x70fe41[_0xd80f('0x2f')]);return db[_0xd80f('0x39')][_0xd80f('0x3b')](_0x403c0f)['then'](handleEntityNotFound(_0x1dceda,null))[_0xd80f('0x14')](function(_0x10dd7f){if(_0x10dd7f[_0xd80f('0x33')]===_0xd80f('0x34')){var _0x42cc90=encryptor['decryptString'](_0x10dd7f['data3']);_0x10dd7f[_0xd80f('0x36')]=maskClientSecret(_0x42cc90);}return _0x10dd7f;})[_0xd80f('0x14')](respondWithResult(_0x1dceda,null))['catch'](handleError(_0x1dceda,null));};exports[_0xd80f('0x3c')]=function(_0xeb33bf,_0x2abed9){if(!_0xeb33bf[_0xd80f('0x3d')][_0xd80f('0x18')])throw new Error(_0xd80f('0x3e'));if(!_0xeb33bf[_0xd80f('0x3d')][_0xd80f('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x277f98=db[_0xd80f('0x39')]['rawAttributes'][_0xd80f('0x33')]['values'];if(!_0x277f98[_0xd80f('0x3f')](_0xeb33bf['body'][_0xd80f('0x33')]))throw new Error(_0xd80f('0x40')+_0x277f98[_0xd80f('0x41')](',\x20'));if(_0xeb33bf['body'][_0xd80f('0x33')]===_0xd80f('0x34')&&_0xeb33bf['body'][_0xd80f('0x36')]){_0xeb33bf[_0xd80f('0x3d')]['data3']=encryptor['encryptString'](_0xeb33bf[_0xd80f('0x3d')]['data3']);}return db[_0xd80f('0x39')][_0xd80f('0x3c')](_0xeb33bf['body'],{})[_0xd80f('0x14')](respondWithResult(_0x2abed9,0xc9))['catch'](handleError(_0x2abed9,null));};exports[_0xd80f('0x13')]=function(_0x36ae4f,_0x24caa4){if(_0x36ae4f[_0xd80f('0x3d')]['id']){delete _0x36ae4f[_0xd80f('0x3d')]['id'];}return db[_0xd80f('0x39')][_0xd80f('0x3b')]({'where':{'id':_0x36ae4f[_0xd80f('0x38')]['id']}})[_0xd80f('0x14')](handleEntityNotFound(_0x24caa4,null))[_0xd80f('0x14')](function(_0x4f2e10){if(_0x4f2e10[_0xd80f('0x33')]===_0xd80f('0x34')&&_0x36ae4f[_0xd80f('0x3d')]['data3']){_0x36ae4f[_0xd80f('0x3d')][_0xd80f('0x36')]=encryptor['encryptString'](_0x36ae4f[_0xd80f('0x3d')]['data3']);}return _0x4f2e10;})[_0xd80f('0x14')](saveUpdates(_0x36ae4f[_0xd80f('0x3d')],null))[_0xd80f('0x14')](respondWithResult(_0x24caa4,null))[_0xd80f('0x42')](handleError(_0x24caa4,null));};exports['destroy']=function(_0x1999b2,_0x5d8f32){return db[_0xd80f('0x39')][_0xd80f('0x3b')]({'where':{'id':_0x1999b2[_0xd80f('0x38')]['id']}})[_0xd80f('0x14')](handleEntityNotFound(_0x5d8f32,null))[_0xd80f('0x14')](removeEntity(_0x5d8f32,null))['catch'](handleError(_0x5d8f32,null));};exports[_0xd80f('0x43')]=function(_0x3ea796,_0x413b65){return db[_0xd80f('0x39')][_0xd80f('0x44')]({'where':{'id':_0x3ea796[_0xd80f('0x38')]['id']},'raw':!![]})['then'](function(_0x23a38f){if(!_0x23a38f)return _0x413b65[_0xd80f('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x23a38f,_0x3ea796[_0xd80f('0x45')]['id'])};})['then'](respondWithResult(_0x413b65,null))[_0xd80f('0x42')](handleError(_0x413b65,null));};exports[_0xd80f('0x46')]=function(_0x801a33,_0x546a70){var _0x2ba6f5=_0x801a33[_0xd80f('0x3d')];var _0x3835ca;var _0x4e5a27;if(_0x2ba6f5['error'])throw _0x2ba6f5;redis[_0xd80f('0x47')](_0x2ba6f5[_0xd80f('0x48')])[_0xd80f('0x14')](function(_0x418b9c){if(!_0x418b9c)throw new Error('Invalid\x20state\x20parameter');_0x3835ca=JSON['parse'](_0x418b9c);var _0x21c4fc=Buffer[_0xd80f('0x49')](_0x2ba6f5[_0xd80f('0x48')],_0xd80f('0x4a'))[_0xd80f('0x4b')](_0xd80f('0x4c'));_0x4e5a27=JSON['parse'](_0x21c4fc);if(!oauth['isValidIdToken'](_0x2ba6f5[_0xd80f('0x4d')],_0x3835ca[_0xd80f('0x4e')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xd80f('0x4f')](_0x2ba6f5[_0xd80f('0x48')]);return oauth[_0xd80f('0x50')](_0x2ba6f5[_0xd80f('0x51')],_0x3835ca);})[_0xd80f('0x14')](function(_0x462ee5){_0x3835ca[_0xd80f('0x52')]=_0x462ee5['access_token'];_0x3835ca[_0xd80f('0x53')]=_0x462ee5[_0xd80f('0x54')];return db[_0xd80f('0x39')][_0xd80f('0x13')]({'data5':_0x3835ca[_0xd80f('0x52')],'data6':_0x3835ca[_0xd80f('0x53')]},{'where':{'id':_0x3835ca['id']}});})[_0xd80f('0x14')](function(){oauth[_0xd80f('0x55')](_0x3835ca);socket[_0xd80f('0x56')](_0xd80f('0x57'),{'id':_0x4e5a27['id']});return;})[_0xd80f('0x14')](respondWithStatusCode(_0x546a70,null))['catch'](function(_0x3f9b70){if(_0x4e5a27){socket[_0xd80f('0x56')](_0xd80f('0x58'),{'id':_0x4e5a27['id']});}if(!_0x3835ca){logger[_0xd80f('0x59')](_0xd80f('0x5a'),_0x3f9b70);return _0x546a70[_0xd80f('0xc')](0x1f4)[_0xd80f('0x5b')](_0x3f9b70['message']);}logger[_0xd80f('0x59')](_0xd80f('0x5c'),_0x3835ca['id'],JSON[_0xd80f('0x5d')](_0x3f9b70));});}; \ No newline at end of file +var _0x4614=['service','MicrosoftAzure','decryptString','catch','show','params','include','find','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','get','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','state','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','./cloudProvider.oauth','defaults','socket.io-emitter','redis','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','name','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows'];(function(_0x1b2c0f,_0x3a5c80){var _0x490df4=function(_0x4f0aef){while(--_0x4f0aef){_0x1b2c0f['push'](_0x1b2c0f['shift']());}};_0x490df4(++_0x3a5c80);}(_0x4614,0x8f));var _0x4461=function(_0x17de78,_0x419b00){_0x17de78=_0x17de78-0x0;var _0x4c82ac=_0x4614[_0x17de78];return _0x4c82ac;};'use strict';var _=require(_0x4461('0x0'));var Redis=require(_0x4461('0x1'));var qs=require(_0x4461('0x2'));var encryptor=require(_0x4461('0x3'));var config=require('../../config/environment');var logger=require(_0x4461('0x4'))(_0x4461('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x4461('0x6'));config['redis']=_[_0x4461('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4461('0x8'))(new Redis(config[_0x4461('0x9')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x5aabe5,_0x4de37a){_0x4de37a=_0x4de37a||0xcc;return function(_0x5a4d8e){if(_0x5a4d8e){return _0x5aabe5[_0x4461('0xa')](_0x4de37a);}return _0x5aabe5[_0x4461('0xb')](_0x4de37a)[_0x4461('0xc')]();};}function respondWithResult(_0x4206cb,_0x2e0f1b){_0x2e0f1b=_0x2e0f1b||0xc8;return function(_0x2b8c16){if(_0x2b8c16){return _0x4206cb[_0x4461('0xb')](_0x2e0f1b)[_0x4461('0xd')](_0x2b8c16);}};}function respondWithFilteredResult(_0x26afee,_0x4f5b69){return function(_0x488bf1){if(_0x488bf1){var _0x656b79=typeof _0x4f5b69[_0x4461('0xe')]==='undefined'&&typeof _0x4f5b69[_0x4461('0xf')]===_0x4461('0x10');var _0x3ad545=_0x488bf1['count'];var _0x3615e9=_0x656b79?0x0:_0x4f5b69[_0x4461('0xe')];var _0x4fec44=_0x656b79?_0x488bf1[_0x4461('0x11')]:_0x4f5b69['offset']+_0x4f5b69['limit'];var _0x1cf560;if(_0x4fec44>=_0x3ad545){_0x4fec44=_0x3ad545;_0x1cf560=0xc8;}else{_0x1cf560=0xce;}_0x26afee[_0x4461('0xb')](_0x1cf560);return _0x26afee['set'](_0x4461('0x12'),_0x3615e9+'-'+_0x4fec44+'/'+_0x3ad545)[_0x4461('0xd')](_0x488bf1);}return null;};}function saveUpdates(_0x436e44){return function(_0x380f2b){if(_0x380f2b){return _0x380f2b[_0x4461('0x13')](_0x436e44)[_0x4461('0x14')](function(_0x5e5b80){return _0x5e5b80;});}return null;};}function removeEntity(_0x5b6d1c){return function(_0x371c87){if(_0x371c87){return _0x371c87[_0x4461('0x15')]()[_0x4461('0x14')](function(){_0x5b6d1c[_0x4461('0xb')](0xcc)[_0x4461('0xc')]();});}};}function handleEntityNotFound(_0x173930){return function(_0x252336){if(!_0x252336){_0x173930[_0x4461('0xa')](0x194);}return _0x252336;};}function handleError(_0x367c5e,_0x46e641){_0x46e641=_0x46e641||0x1f4;return function(_0x55f414){logger['error'](_0x55f414['stack']);if(_0x55f414[_0x4461('0x16')]){delete _0x55f414['name'];}_0x367c5e[_0x4461('0xb')](_0x46e641)['send'](_0x55f414);};}function maskClientSecret(_0x4a8a10){return _[_0x4461('0x17')](_0x4a8a10[_0x4461('0x18')](0x0,0x3),0x14,'*');}exports[_0x4461('0x19')]=function(_0x17fdc7,_0x4b91ef){var _0x4c78fa={},_0x22abe6={},_0x2e5d33={'count':0x0,'rows':[]};var _0x10d693=_['map'](db[_0x4461('0x1a')][_0x4461('0x1b')],function(_0x17a504){return{'name':_0x17a504[_0x4461('0x1c')],'type':_0x17a504[_0x4461('0x1d')]['key']};});_0x22abe6['model']=_[_0x4461('0x1e')](_0x10d693,_0x4461('0x16'));_0x22abe6[_0x4461('0x1f')]=_[_0x4461('0x20')](_0x17fdc7[_0x4461('0x1f')]);_0x22abe6[_0x4461('0x21')]=_[_0x4461('0x22')](_0x22abe6[_0x4461('0x23')],_0x22abe6[_0x4461('0x1f')]);_0x4c78fa[_0x4461('0x24')]=_['intersection'](_0x22abe6[_0x4461('0x23')],qs[_0x4461('0x25')](_0x17fdc7[_0x4461('0x1f')][_0x4461('0x25')]));_0x4c78fa['attributes']=_0x4c78fa[_0x4461('0x24')][_0x4461('0x26')]?_0x4c78fa['attributes']:_0x22abe6['model'];if(!_0x17fdc7[_0x4461('0x1f')][_0x4461('0x27')](_0x4461('0x28'))){_0x4c78fa[_0x4461('0xf')]=qs[_0x4461('0xf')](_0x17fdc7[_0x4461('0x1f')][_0x4461('0xf')]);_0x4c78fa[_0x4461('0xe')]=qs[_0x4461('0xe')](_0x17fdc7[_0x4461('0x1f')][_0x4461('0xe')]);}_0x4c78fa[_0x4461('0x29')]=qs[_0x4461('0x2a')](_0x17fdc7[_0x4461('0x1f')][_0x4461('0x2a')]);_0x4c78fa[_0x4461('0x2b')]=qs[_0x4461('0x21')](_[_0x4461('0x2c')](_0x17fdc7[_0x4461('0x1f')],_0x22abe6[_0x4461('0x21')]),_0x10d693);if(_0x17fdc7[_0x4461('0x1f')][_0x4461('0x2d')]){_0x4c78fa[_0x4461('0x2b')]=_[_0x4461('0x2e')](_0x4c78fa['where'],{'$or':_['map'](_0x10d693,function(_0x48ae6a){if(_0x48ae6a['type']!==_0x4461('0x2f')){var _0x12e96e={};_0x12e96e[_0x48ae6a[_0x4461('0x16')]]={'$like':'%'+_0x17fdc7[_0x4461('0x1f')][_0x4461('0x2d')]+'%'};return _0x12e96e;}})});}_0x4c78fa=_[_0x4461('0x2e')]({},_0x4c78fa,_0x17fdc7[_0x4461('0x30')]);var _0x249724={'where':_0x4c78fa[_0x4461('0x2b')]};return db[_0x4461('0x1a')]['count'](_0x249724)[_0x4461('0x14')](function(_0x2c5d82){_0x2e5d33['count']=_0x2c5d82;if(_0x17fdc7[_0x4461('0x1f')][_0x4461('0x31')]){_0x4c78fa['include']=[{'all':!![]}];}return db[_0x4461('0x1a')]['findAll'](_0x4c78fa);})[_0x4461('0x14')](function(_0x55bc21){_0x2e5d33[_0x4461('0x32')]=_[_0x4461('0x1e')](_0x55bc21,function(_0x31fe34){if(_0x31fe34[_0x4461('0x33')]===_0x4461('0x34')){var _0x2274d5=encryptor[_0x4461('0x35')](_0x31fe34['data3']);_0x31fe34['data3']=maskClientSecret(_0x2274d5);}return _0x31fe34;});return _0x2e5d33;})['then'](respondWithFilteredResult(_0x4b91ef,_0x4c78fa))[_0x4461('0x36')](handleError(_0x4b91ef,null));};exports[_0x4461('0x37')]=function(_0x414abb,_0x46f774){var _0x2de345={'raw':!![],'where':{'id':_0x414abb[_0x4461('0x38')]['id']}},_0x4d3b96={};_0x4d3b96[_0x4461('0x23')]=_['keys'](db['CloudProvider']['rawAttributes']);_0x4d3b96[_0x4461('0x1f')]=_[_0x4461('0x20')](_0x414abb[_0x4461('0x1f')]);_0x4d3b96[_0x4461('0x21')]=_[_0x4461('0x22')](_0x4d3b96[_0x4461('0x23')],_0x4d3b96[_0x4461('0x1f')]);_0x2de345[_0x4461('0x24')]=_[_0x4461('0x22')](_0x4d3b96['model'],qs[_0x4461('0x25')](_0x414abb[_0x4461('0x1f')]['fields']));_0x2de345[_0x4461('0x24')]=_0x2de345['attributes'][_0x4461('0x26')]?_0x2de345['attributes']:_0x4d3b96[_0x4461('0x23')];if(_0x414abb[_0x4461('0x1f')][_0x4461('0x31')]){_0x2de345[_0x4461('0x39')]=[{'all':!![]}];}_0x2de345=_[_0x4461('0x2e')]({},_0x2de345,_0x414abb[_0x4461('0x30')]);return db[_0x4461('0x1a')][_0x4461('0x3a')](_0x2de345)['then'](handleEntityNotFound(_0x46f774,null))['then'](function(_0xbbafac){if(_0xbbafac[_0x4461('0x33')]===_0x4461('0x34')){var _0x43800f=encryptor[_0x4461('0x35')](_0xbbafac[_0x4461('0x3b')]);_0xbbafac['data3']=maskClientSecret(_0x43800f);}return _0xbbafac;})[_0x4461('0x14')](respondWithResult(_0x46f774,null))[_0x4461('0x36')](handleError(_0x46f774,null));};exports[_0x4461('0x3c')]=function(_0x32831c,_0x4dd678){if(!_0x32831c[_0x4461('0x3d')][_0x4461('0x16')])throw new Error(_0x4461('0x3e'));if(!_0x32831c[_0x4461('0x3d')]['service'])throw new Error(_0x4461('0x3f'));var _0x4caed2=db[_0x4461('0x1a')][_0x4461('0x1b')]['service'][_0x4461('0x40')];if(!_0x4caed2['includes'](_0x32831c[_0x4461('0x3d')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x4caed2[_0x4461('0x41')](',\x20'));if(_0x32831c[_0x4461('0x3d')][_0x4461('0x33')]==='MicrosoftAzure'&&_0x32831c[_0x4461('0x3d')][_0x4461('0x3b')]){_0x32831c[_0x4461('0x3d')][_0x4461('0x3b')]=encryptor['encryptString'](_0x32831c[_0x4461('0x3d')][_0x4461('0x3b')]);}return db[_0x4461('0x1a')]['create'](_0x32831c['body'],{})[_0x4461('0x14')](respondWithResult(_0x4dd678,0xc9))['catch'](handleError(_0x4dd678,null));};exports[_0x4461('0x13')]=function(_0x2c230f,_0xfdef0){if(_0x2c230f[_0x4461('0x3d')]['id']){delete _0x2c230f[_0x4461('0x3d')]['id'];}return db[_0x4461('0x1a')][_0x4461('0x3a')]({'where':{'id':_0x2c230f[_0x4461('0x38')]['id']}})[_0x4461('0x14')](handleEntityNotFound(_0xfdef0,null))[_0x4461('0x14')](function(_0x2bf972){if(_0x2bf972[_0x4461('0x33')]===_0x4461('0x34')&&_0x2c230f['body'][_0x4461('0x3b')]){_0x2c230f['body']['data3']=encryptor[_0x4461('0x42')](_0x2c230f['body']['data3']);}return _0x2bf972;})[_0x4461('0x14')](saveUpdates(_0x2c230f[_0x4461('0x3d')],null))[_0x4461('0x14')](respondWithResult(_0xfdef0,null))[_0x4461('0x36')](handleError(_0xfdef0,null));};exports['destroy']=function(_0x2ce3ba,_0x15ff6d){return db[_0x4461('0x1a')][_0x4461('0x3a')]({'where':{'id':_0x2ce3ba[_0x4461('0x38')]['id']}})[_0x4461('0x14')](handleEntityNotFound(_0x15ff6d,null))[_0x4461('0x14')](removeEntity(_0x15ff6d,null))[_0x4461('0x36')](handleError(_0x15ff6d,null));};exports[_0x4461('0x43')]=function(_0x4d868e,_0x18f4c0){return db[_0x4461('0x1a')][_0x4461('0x44')]({'where':{'id':_0x4d868e[_0x4461('0x38')]['id']},'raw':!![]})[_0x4461('0x14')](function(_0x2d1edf){if(!_0x2d1edf)return _0x18f4c0[_0x4461('0xa')](0x194);return{'url':oauth[_0x4461('0x45')](_0x2d1edf,_0x4d868e['user']['id'])};})[_0x4461('0x14')](respondWithResult(_0x18f4c0,null))[_0x4461('0x36')](handleError(_0x18f4c0,null));};exports[_0x4461('0x46')]=function(_0x42fd5e,_0x2195d1){var _0x390582=_0x42fd5e[_0x4461('0x3d')];var _0x2eb9d9;var _0x420670;if(_0x390582[_0x4461('0x47')])throw _0x390582;redis[_0x4461('0x48')](_0x390582['state'])[_0x4461('0x14')](function(_0xec6e18){if(!_0xec6e18)throw new Error(_0x4461('0x49'));_0x2eb9d9=JSON[_0x4461('0x4a')](_0xec6e18);var _0x532d69=Buffer[_0x4461('0x4b')](_0x390582['state'],'base64')[_0x4461('0x4c')](_0x4461('0x4d'));_0x420670=JSON[_0x4461('0x4a')](_0x532d69);if(!oauth[_0x4461('0x4e')](_0x390582[_0x4461('0x4f')],_0x2eb9d9[_0x4461('0x50')]))throw new Error(_0x4461('0x51'));redis[_0x4461('0x52')](_0x390582[_0x4461('0x53')]);return oauth['getOauth2MicrosoftAccessToken'](_0x390582[_0x4461('0x54')],_0x2eb9d9);})[_0x4461('0x14')](function(_0x4e7ee8){_0x2eb9d9[_0x4461('0x55')]=_0x4e7ee8[_0x4461('0x56')];_0x2eb9d9[_0x4461('0x57')]=_0x4e7ee8[_0x4461('0x58')];return db['CloudProvider'][_0x4461('0x13')]({'data5':_0x2eb9d9['data5'],'data6':_0x2eb9d9[_0x4461('0x57')]},{'where':{'id':_0x2eb9d9['id']}});})[_0x4461('0x14')](function(){oauth[_0x4461('0x59')](_0x2eb9d9);socket['emit']('microsoftAuthorization:success',{'id':_0x420670['id']});return;})['then'](respondWithStatusCode(_0x2195d1,null))[_0x4461('0x36')](function(_0x346533){if(_0x420670){socket[_0x4461('0x5a')](_0x4461('0x5b'),{'id':_0x420670['id']});}if(!_0x2eb9d9){logger[_0x4461('0x47')](_0x4461('0x5c'),_0x346533);return _0x2195d1[_0x4461('0xb')](0x1f4)[_0x4461('0x5d')](_0x346533[_0x4461('0x5e')]);}logger[_0x4461('0x47')](_0x4461('0x5f'),_0x2eb9d9['id'],JSON[_0x4461('0x60')](_0x346533));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2fad96f..e92629f 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 _0x944b=['rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','lodash','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x944b,0x191));var _0xb944=function(_0x3e69cd,_0x4d3233){_0x3e69cd=_0x3e69cd-0x0;var _0x209c12=_0x944b[_0x3e69cd];return _0x209c12;};'use strict';var _=require(_0xb944('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb944('0x1'));var moment=require('moment');var BPromise=require(_0xb944('0x2'));var rp=require(_0xb944('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb944('0x4'));var config=require(_0xb944('0x5'));var attributes=require(_0xb944('0x6'));module['exports']=function(_0x268bce,_0x4c17ae){return _0x268bce[_0xb944('0x7')](_0xb944('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaea=['rimraf','exports','define','cloud_providers','util','api','moment','bluebird','request-promise','path'];(function(_0x3213b4,_0x3cddd0){var _0xa97785=function(_0x3c9282){while(--_0x3c9282){_0x3213b4['push'](_0x3213b4['shift']());}};_0xa97785(++_0x3cddd0);}(_0xbaea,0x162));var _0xabae=function(_0x394439,_0xf2f0a9){_0x394439=_0x394439-0x0;var _0x2f9468=_0xbaea[_0x394439];return _0x2f9468;};'use strict';var _=require('lodash');var util=require(_0xabae('0x0'));var logger=require('../../config/logger')(_0xabae('0x1'));var moment=require(_0xabae('0x2'));var BPromise=require(_0xabae('0x3'));var rp=require(_0xabae('0x4'));var fs=require('fs');var path=require(_0xabae('0x5'));var rimraf=require(_0xabae('0x6'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xabae('0x7')]=function(_0x360ddf,_0x11da33){return _0x360ddf[_0xabae('0x8')]('CloudProvider',attributes,{'tableName':_0xabae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 28aa472..c9a571f 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c2a=['code','stringify','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','iss','issuer','aud','isAfter','exp','resolve','findOne','then','refresh_token','data6','data4','decryptString','data3','POST','access_token','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','type','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','Dynamics365','{TENANT_ID}','data2'];(function(_0x214330,_0x266cac){var _0x4d408f=function(_0x49e5be){while(--_0x49e5be){_0x214330['push'](_0x214330['shift']());}};_0x4d408f(++_0x266cac);}(_0x4c2a,0x11c));var _0xa4c2=function(_0x367ede,_0x834347){_0x367ede=_0x367ede-0x0;var _0x3d0da0=_0x4c2a[_0x367ede];return _0x3d0da0;};'use strict';var _=require(_0xa4c2('0x0'));var crypto=require('crypto');var jwt=require(_0xa4c2('0x1'));var moment=require(_0xa4c2('0x2'));var Redis=require('ioredis');var rp=require(_0xa4c2('0x3'));var util=require(_0xa4c2('0x4'));var encryptor=require(_0xa4c2('0x5'));var config=require('../../config/environment');var logger=require(_0xa4c2('0x6'))(_0xa4c2('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xa4c2('0x8')]=_[_0xa4c2('0x9')](config[_0xa4c2('0x8')],{'host':_0xa4c2('0xa'),'port':0x18eb});var redis=new Redis(config[_0xa4c2('0x8')]);var MICROSOFT_AUTH_URL=_0xa4c2('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa4c2('0xc'),'profile',_0xa4c2('0xd'),_0xa4c2('0xe'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xa4c2('0xf'),_0xa4c2('0x10')],'Dynamics365':[_0xa4c2('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xa4c2('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5e907f){var _0x389fdd=_['map'](AZURE_AUTH_SCOPES[_0x5e907f['type']]);if(_0x5e907f[_0xa4c2('0x12')]==='Dynamics365')_0x389fdd[_0xa4c2('0x13')](_0x5e907f[_0xa4c2('0x14')]+_0xa4c2('0x15'));return _0x389fdd[_0xa4c2('0x16')]('\x20');}function getAccessTokenScope(_0x19cbce){if(_0x19cbce[_0xa4c2('0x12')]===_0xa4c2('0x17'))return _0xa4c2('0x18');if(_0x19cbce[_0xa4c2('0x12')]===_0xa4c2('0x19'))return _0x19cbce[_0xa4c2('0x14')]+_0xa4c2('0x15');}function generateMicrosoftAuthorizationUrl(_0x5e3833,_0x12316e){var _0x58fc26=MICROSOFT_AUTH_URL['replace'](_0xa4c2('0x1a'),_0x5e3833[_0xa4c2('0x1b')]);var _0x5a2c4a=[_0xa4c2('0x1c'),'id_token'];var _0x5ab07f=Buffer['from'](JSON[_0xa4c2('0x1d')]({'id':_0x12316e}))[_0xa4c2('0x1e')]('base64');var _0x5855=crypto[_0xa4c2('0x1f')](0x10)['toString'](_0xa4c2('0x20'));var _0x207a79=getAuthorizationScopes(_0x5e3833);var _0x59cd50=[{'key':_0xa4c2('0x21'),'value':_0x5e3833[_0xa4c2('0x22')]},{'key':_0xa4c2('0x23'),'value':encodeURIComponent(_0x5a2c4a[_0xa4c2('0x16')]('\x20'))},{'key':_0xa4c2('0x24'),'value':_0x5e3833['data4']},{'key':_0xa4c2('0x25'),'value':_0xa4c2('0x26')},{'key':_0xa4c2('0x27'),'value':encodeURIComponent(_0x207a79)},{'key':_0xa4c2('0x28'),'value':_0x5ab07f},{'key':_0xa4c2('0x29'),'value':_0x5855},{'key':_0xa4c2('0x2a'),'value':_0xa4c2('0x2b')}];var _0x1c17dc=_0x58fc26+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x59cd50,function(_0x152757){return _0x152757[_0xa4c2('0x2c')]+'='+_0x152757[_0xa4c2('0x2d')];})['join']('&');_0x5e3833[_0xa4c2('0x2e')]={'issuer':_0x58fc26[_0xa4c2('0x2f')](_0xa4c2('0x30'),''),'audience':_0x5e3833[_0xa4c2('0x22')],'state':_0x5ab07f,'nonce':_0x5855};redis[_0xa4c2('0x31')](_0x5ab07f,JSON[_0xa4c2('0x1d')](_0x5e3833));return _0x1c17dc;}function isValidIdToken(_0x4a7156,_0x3dfa21){try{var _0x45aaeb=jwt[_0xa4c2('0x32')](_0x4a7156,{'complete':!![]});var _0x183ba0=_0x45aaeb['payload'];if(_0x183ba0[_0xa4c2('0x33')]!==_0x3dfa21[_0xa4c2('0x34')])return![];if(_0x183ba0[_0xa4c2('0x35')]!==_0x3dfa21['audience'])return![];if(_0x183ba0[_0xa4c2('0x29')]!==_0x3dfa21[_0xa4c2('0x29')])return![];if(moment()[_0xa4c2('0x36')](moment['unix'](_0x183ba0[_0xa4c2('0x37')])))return![];return!![];}catch(_0x436c0f){throw _0x436c0f;}}function refreshOauth2MicrosoftAccessToken(_0x55fd68){return Promise[_0xa4c2('0x38')]()['then'](function(){if(_0x55fd68['data3'])return _0x55fd68;return db['CloudProvider'][_0xa4c2('0x39')]({'where':{'id':_0x55fd68['id']},'raw':!![]});})[_0xa4c2('0x3a')](function(_0x1ac8d2){var _0x1bf55f={'grant_type':_0xa4c2('0x3b'),'refresh_token':_0x1ac8d2[_0xa4c2('0x3c')],'scope':getAccessTokenScope(_0x1ac8d2),'redirect_uri':_0x1ac8d2[_0xa4c2('0x3d')],'client_id':_0x1ac8d2[_0xa4c2('0x22')],'client_secret':encryptor[_0xa4c2('0x3e')](_0x1ac8d2[_0xa4c2('0x3f')])};var _0x1d856d={'method':_0xa4c2('0x40'),'uri':MICROSOFT_AUTH_URL[_0xa4c2('0x2f')](_0xa4c2('0x1a'),_0x1ac8d2[_0xa4c2('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1bf55f,'json':!![]};return rp(_0x1d856d);})[_0xa4c2('0x3a')](function(_0x4d634b){_0x55fd68['data5']=_0x4d634b[_0xa4c2('0x41')];_0x55fd68[_0xa4c2('0x3c')]=_0x4d634b['refresh_token'];return db[_0xa4c2('0x42')][_0xa4c2('0x43')]({'data5':_0x55fd68['data5'],'data6':_0x55fd68[_0xa4c2('0x3c')]},{'where':{'id':_0x55fd68['id']}});})[_0xa4c2('0x3a')](function(){return _0x55fd68;})[_0xa4c2('0x44')](function(_0xe0ac77){logger[_0xa4c2('0x45')](_0xa4c2('0x46'),_0x55fd68['id'],_0xe0ac77);});}function getOauth2MicrosoftAccessToken(_0x21f4ed,_0x494d66){var _0x438bac={'grant_type':_0xa4c2('0x47'),'code':_0x21f4ed,'scope':getAccessTokenScope(_0x494d66),'redirect_uri':_0x494d66[_0xa4c2('0x3d')],'client_id':_0x494d66['data1'],'client_secret':encryptor[_0xa4c2('0x3e')](_0x494d66[_0xa4c2('0x3f')])};var _0x5587ee={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xa4c2('0x2f')]('{TENANT_ID}',_0x494d66[_0xa4c2('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x438bac,'json':!![]};return rp(_0x5587ee);}function startRefreshInterval(_0xc902d3){var _0x5a4a6d=schedule['intervals'];if(_0x5a4a6d[_0xc902d3['id']])clearInterval(_0x5a4a6d[_0xc902d3['id']]);_0x5a4a6d[_0xc902d3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa4c2('0x48')](this,{'id':_0xc902d3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa4c2('0x49')]=_0x5a4a6d;}function startAllRefreshIntervals(){return db[_0xa4c2('0x42')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa4c2('0x3a')](function(_0x143f2b){var _0x5f0849=_0x143f2b['map'](function(_0x3f1b56){return refreshOauth2MicrosoftAccessToken(_0x3f1b56)[_0xa4c2('0x3a')](function(_0x162d47){startRefreshInterval(_0x162d47);});});return Promise[_0xa4c2('0x4a')](_0x5f0849);})[_0xa4c2('0x44')](function(_0x37efd6){var _0x46bc14=_0x37efd6?util[_0xa4c2('0x4b')](_0x37efd6,{'showHidden':![],'depth':null}):'';logger['error'](_0xa4c2('0x4c'),_0x46bc14);});}module[_0xa4c2('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xea86=['profile','email','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','code','id_token','from','stringify','toString','base64','hex','response_type','redirect_uri','data4','response_mode','form_post','scope','prompt','login','value','oauth2Claims','replace','oauth2/','data1','set','decode','payload','iss','aud','nonce','isAfter','unix','exp','then','CloudProvider','refresh_token','data6','data3','POST','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','{TENANT_ID}','intervals','bind','findAll','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid'];(function(_0xcee7f3,_0x53c7e1){var _0x4841f1=function(_0x27f0d0){while(--_0x27f0d0){_0xcee7f3['push'](_0xcee7f3['shift']());}};_0x4841f1(++_0x53c7e1);}(_0xea86,0x16d));var _0x6ea8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea86[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6ea8('0x0'));var crypto=require(_0x6ea8('0x1'));var jwt=require(_0x6ea8('0x2'));var moment=require(_0x6ea8('0x3'));var Redis=require(_0x6ea8('0x4'));var rp=require(_0x6ea8('0x5'));var util=require(_0x6ea8('0x6'));var encryptor=require(_0x6ea8('0x7'));var config=require('../../config/environment');var logger=require(_0x6ea8('0x8'))(_0x6ea8('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x6ea8('0xa'))['db'];config[_0x6ea8('0xb')]=_[_0x6ea8('0xc')](config[_0x6ea8('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x6ea8('0xb')]);var MICROSOFT_AUTH_URL=_0x6ea8('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x6ea8('0xe'),_0x6ea8('0xf'),_0x6ea8('0x10'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0x6ea8('0x11')],'Dynamics365':[_0x6ea8('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x6ea8('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x6ea8('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2d408b){var _0x1949fb=_[_0x6ea8('0x14')](AZURE_AUTH_SCOPES[_0x2d408b['type']]);if(_0x2d408b[_0x6ea8('0x15')]===_0x6ea8('0x16'))_0x1949fb[_0x6ea8('0x17')](_0x2d408b[_0x6ea8('0x18')]+_0x6ea8('0x19'));return _0x1949fb[_0x6ea8('0x1a')]('\x20');}function getAccessTokenScope(_0x558d0c){if(_0x558d0c[_0x6ea8('0x15')]===_0x6ea8('0x1b'))return _0x6ea8('0x1c');if(_0x558d0c['type']===_0x6ea8('0x16'))return _0x558d0c[_0x6ea8('0x18')]+_0x6ea8('0x19');}function generateMicrosoftAuthorizationUrl(_0x168150,_0x38800a){var _0x4905ef=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x168150['data2']);var _0x21c206=[_0x6ea8('0x1d'),_0x6ea8('0x1e')];var _0x3e7878=Buffer[_0x6ea8('0x1f')](JSON[_0x6ea8('0x20')]({'id':_0x38800a}))[_0x6ea8('0x21')](_0x6ea8('0x22'));var _0x3bd345=crypto['randomBytes'](0x10)['toString'](_0x6ea8('0x23'));var _0x5e21d2=getAuthorizationScopes(_0x168150);var _0x2d44ec=[{'key':'client_id','value':_0x168150['data1']},{'key':_0x6ea8('0x24'),'value':encodeURIComponent(_0x21c206[_0x6ea8('0x1a')]('\x20'))},{'key':_0x6ea8('0x25'),'value':_0x168150[_0x6ea8('0x26')]},{'key':_0x6ea8('0x27'),'value':_0x6ea8('0x28')},{'key':_0x6ea8('0x29'),'value':encodeURIComponent(_0x5e21d2)},{'key':'state','value':_0x3e7878},{'key':'nonce','value':_0x3bd345},{'key':_0x6ea8('0x2a'),'value':_0x6ea8('0x2b')}];var _0x5cc903=_0x4905ef+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x6ea8('0x14')](_0x2d44ec,function(_0x5a95b7){return _0x5a95b7['key']+'='+_0x5a95b7[_0x6ea8('0x2c')];})[_0x6ea8('0x1a')]('&');_0x168150[_0x6ea8('0x2d')]={'issuer':_0x4905ef[_0x6ea8('0x2e')](_0x6ea8('0x2f'),''),'audience':_0x168150[_0x6ea8('0x30')],'state':_0x3e7878,'nonce':_0x3bd345};redis[_0x6ea8('0x31')](_0x3e7878,JSON['stringify'](_0x168150));return _0x5cc903;}function isValidIdToken(_0x432943,_0x2e13ad){try{var _0x34a896=jwt[_0x6ea8('0x32')](_0x432943,{'complete':!![]});var _0x1371c7=_0x34a896[_0x6ea8('0x33')];if(_0x1371c7[_0x6ea8('0x34')]!==_0x2e13ad['issuer'])return![];if(_0x1371c7[_0x6ea8('0x35')]!==_0x2e13ad['audience'])return![];if(_0x1371c7['nonce']!==_0x2e13ad[_0x6ea8('0x36')])return![];if(moment()[_0x6ea8('0x37')](moment[_0x6ea8('0x38')](_0x1371c7[_0x6ea8('0x39')])))return![];return!![];}catch(_0x54d1fd){throw _0x54d1fd;}}function refreshOauth2MicrosoftAccessToken(_0x4413fe){return Promise['resolve']()[_0x6ea8('0x3a')](function(){if(_0x4413fe['data3'])return _0x4413fe;return db[_0x6ea8('0x3b')]['findOne']({'where':{'id':_0x4413fe['id']},'raw':!![]});})[_0x6ea8('0x3a')](function(_0x3c05a9){var _0x3bcc93={'grant_type':_0x6ea8('0x3c'),'refresh_token':_0x3c05a9[_0x6ea8('0x3d')],'scope':getAccessTokenScope(_0x3c05a9),'redirect_uri':_0x3c05a9[_0x6ea8('0x26')],'client_id':_0x3c05a9[_0x6ea8('0x30')],'client_secret':encryptor['decryptString'](_0x3c05a9[_0x6ea8('0x3e')])};var _0x5913e7={'method':_0x6ea8('0x3f'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x3c05a9['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3bcc93,'json':!![]};return rp(_0x5913e7);})[_0x6ea8('0x3a')](function(_0x1a02c4){_0x4413fe[_0x6ea8('0x40')]=_0x1a02c4['access_token'];_0x4413fe[_0x6ea8('0x3d')]=_0x1a02c4[_0x6ea8('0x3c')];return db[_0x6ea8('0x3b')][_0x6ea8('0x41')]({'data5':_0x4413fe['data5'],'data6':_0x4413fe[_0x6ea8('0x3d')]},{'where':{'id':_0x4413fe['id']}});})[_0x6ea8('0x3a')](function(){return _0x4413fe;})[_0x6ea8('0x42')](function(_0x2523e2){logger[_0x6ea8('0x43')](_0x6ea8('0x44'),_0x4413fe['id'],_0x2523e2);});}function getOauth2MicrosoftAccessToken(_0x12ab9c,_0x5de999){var _0x506a2b={'grant_type':_0x6ea8('0x45'),'code':_0x12ab9c,'scope':getAccessTokenScope(_0x5de999),'redirect_uri':_0x5de999['data4'],'client_id':_0x5de999[_0x6ea8('0x30')],'client_secret':encryptor[_0x6ea8('0x46')](_0x5de999[_0x6ea8('0x3e')])};var _0x5ad1bb={'method':_0x6ea8('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x6ea8('0x2e')](_0x6ea8('0x47'),_0x5de999['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x506a2b,'json':!![]};return rp(_0x5ad1bb);}function startRefreshInterval(_0x5a484f){var _0x5dacbe=schedule[_0x6ea8('0x48')];if(_0x5dacbe[_0x5a484f['id']])clearInterval(_0x5dacbe[_0x5a484f['id']]);_0x5dacbe[_0x5a484f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x6ea8('0x49')](this,{'id':_0x5a484f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x6ea8('0x48')]=_0x5dacbe;}function startAllRefreshIntervals(){return db[_0x6ea8('0x3b')][_0x6ea8('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3b0de2){var _0x32e8fe=_0x3b0de2['map'](function(_0x46f1b9){return refreshOauth2MicrosoftAccessToken(_0x46f1b9)['then'](function(_0x1c7df9){startRefreshInterval(_0x1c7df9);});});return Promise['all'](_0x32e8fe);})[_0x6ea8('0x42')](function(_0x2ab281){var _0x19ad55=_0x2ab281?util['inspect'](_0x2ab281,{'showHidden':![],'depth':null}):'';logger[_0x6ea8('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x19ad55);});}module[_0x6ea8('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 71d0be8..bc3e144 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 _0x4813=['lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x431360,_0x436708){var _0x561365=function(_0x10796c){while(--_0x10796c){_0x431360['push'](_0x431360['shift']());}};_0x561365(++_0x436708);}(_0x4813,0xdc));var _0x3481=function(_0x494322,_0x1e6e02){_0x494322=_0x494322-0x0;var _0x2cc75d=_0x4813[_0x494322];return _0x2cc75d;};'use strict';var _=require(_0x3481('0x0'));var util=require('util');var moment=require(_0x3481('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3481('0x2'));var db=require(_0x3481('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3481('0x4'))(_0x3481('0x5'));var config=require(_0x3481('0x6'));var jayson=require(_0x3481('0x7'));var client=jayson[_0x3481('0x8')][_0x3481('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x369c3b,_0x54a2c8,_0x4d23ef){return new BPromise(function(_0x41592f,_0x527c3c){return client[_0x3481('0xa')](_0x369c3b,_0x4d23ef)[_0x3481('0xb')](function(_0x39b6c4){logger[_0x3481('0xc')](_0x3481('0xd'),_0x54a2c8,_0x3481('0xe'));logger[_0x3481('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x54a2c8,'request\x20sent',JSON[_0x3481('0x10')](_0x39b6c4));if(_0x39b6c4[_0x3481('0x11')]){if(_0x39b6c4[_0x3481('0x11')][_0x3481('0x12')]===0x1f4){logger[_0x3481('0x11')]('CloudProvider,\x20%s,\x20%s',_0x54a2c8,_0x39b6c4[_0x3481('0x11')][_0x3481('0x13')]);return _0x527c3c(_0x39b6c4[_0x3481('0x11')][_0x3481('0x13')]);}logger[_0x3481('0x11')]('CloudProvider,\x20%s,\x20%s',_0x54a2c8,_0x39b6c4['error'][_0x3481('0x13')]);return _0x41592f(_0x39b6c4[_0x3481('0x11')]['message']);}else{logger[_0x3481('0xc')](_0x3481('0xd'),_0x54a2c8,_0x3481('0xe'));_0x41592f(_0x39b6c4[_0x3481('0x14')][_0x3481('0x13')]);}})[_0x3481('0x15')](function(_0x2a3981){logger['error'](_0x3481('0xd'),_0x54a2c8,_0x2a3981);_0x527c3c(_0x2a3981);});});} \ No newline at end of file +var _0x7da6=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird'];(function(_0x1c0db9,_0x5c9e88){var _0xc4e085=function(_0x31ea17){while(--_0x31ea17){_0x1c0db9['push'](_0x1c0db9['shift']());}};_0xc4e085(++_0x5c9e88);}(_0x7da6,0x124));var _0x67da=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0x7da6[_0x1b8f5a];return _0x594189;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x67da('0x0'));var BPromise=require(_0x67da('0x1'));var rs=require(_0x67da('0x2'));var fs=require('fs');var Redis=require(_0x67da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x67da('0x4'));var logger=require(_0x67da('0x5'))(_0x67da('0x6'));var config=require(_0x67da('0x7'));var jayson=require(_0x67da('0x8'));var client=jayson[_0x67da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb7f52,_0x49025f,_0x4cfe49){return new BPromise(function(_0x3d971d,_0x5ac004){return client[_0x67da('0xa')](_0xb7f52,_0x4cfe49)['then'](function(_0x1e8a4c){logger[_0x67da('0xb')](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));logger[_0x67da('0xe')](_0x67da('0xf'),_0x49025f,_0x67da('0xd'),JSON['stringify'](_0x1e8a4c));if(_0x1e8a4c[_0x67da('0x10')]){if(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x11')]===0x1f4){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x5ac004(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x3d971d(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}else{logger['info'](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));_0x3d971d(_0x1e8a4c[_0x67da('0x13')][_0x67da('0x12')]);}})[_0x67da('0x14')](function(_0xb3a67){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0xb3a67);_0x5ac004(_0xb3a67);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7088e67..927851c 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x3cbada,_0x41fa40){var _0x3e31e5=function(_0x30d7bc){while(--_0x30d7bc){_0x3cbada['push'](_0x3cbada['shift']());}};_0x3e31e5(++_0x41fa40);}(_0xdb28,0x106));var _0x8db2=function(_0x150ff2,_0x30f506){_0x150ff2=_0x150ff2-0x0;var _0xba3f80=_0xdb28[_0x150ff2];return _0xba3f80;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x29b514,_0x50cfa6){var _0x482a2f=function(_0x10dca1){while(--_0x10dca1){_0x29b514['push'](_0x29b514['shift']());}};_0x482a2f(++_0x50cfa6);}(_0x2ef3,0xba));var _0x32ef=function(_0x1f90b9,_0x3ed853){_0x1f90b9=_0x1f90b9-0x0;var _0x6b61bf=_0x2ef3[_0x1f90b9];return _0x6b61bf;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 816f9f2..b11adee 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 _0x2b68=['STRING','exports'];(function(_0x261992,_0x31cfbb){var _0x356f3b=function(_0x5ce0d7){while(--_0x5ce0d7){_0x261992['push'](_0x261992['shift']());}};_0x356f3b(++_0x31cfbb);}(_0x2b68,0x99));var _0x82b6=function(_0x237fd6,_0x59d931){_0x237fd6=_0x237fd6-0x0;var _0x253f77=_0x2b68[_0x237fd6];return _0x253f77;};'use strict';var Sequelize=require('sequelize');module[_0x82b6('0x0')]={'name':{'type':Sequelize[_0x82b6('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x82b6('0x1')]},'companyId':{'type':Sequelize[_0x82b6('0x1')]},'website':{'type':Sequelize[_0x82b6('0x1')]},'phone':{'type':Sequelize[_0x82b6('0x1')]},'fax':{'type':Sequelize[_0x82b6('0x1')]},'type':{'type':Sequelize[_0x82b6('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x82b6('0x1')]},'city':{'type':Sequelize[_0x82b6('0x1')]},'country':{'type':Sequelize[_0x82b6('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x82b6('0x1')]},'sPostalCode':{'type':Sequelize[_0x82b6('0x1')]},'sCity':{'type':Sequelize[_0x82b6('0x1')]},'sCountry':{'type':Sequelize[_0x82b6('0x1')]},'description':{'type':Sequelize[_0x82b6('0x1')]}}; \ No newline at end of file +var _0x3315=['STRING','exports','name'];(function(_0x9b4145,_0x347ccc){var _0x12b6cf=function(_0x491908){while(--_0x491908){_0x9b4145['push'](_0x9b4145['shift']());}};_0x12b6cf(++_0x347ccc);}(_0x3315,0x7f));var _0x5331=function(_0x2d962e,_0x5aafab){_0x2d962e=_0x2d962e-0x0;var _0x2038a7=_0x3315[_0x2d962e];return _0x2038a7;};'use strict';var Sequelize=require('sequelize');module[_0x5331('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5331('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5331('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x5331('0x2')]},'phone':{'type':Sequelize[_0x5331('0x2')]},'fax':{'type':Sequelize[_0x5331('0x2')]},'type':{'type':Sequelize[_0x5331('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5331('0x2')]},'country':{'type':Sequelize[_0x5331('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x5331('0x2')]},'sPostalCode':{'type':Sequelize[_0x5331('0x2')]},'sCity':{'type':Sequelize[_0x5331('0x2')]},'sCountry':{'type':Sequelize[_0x5331('0x2')]},'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 f0e49f2..1f8401c 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 _0x274f=['pick','getContacts','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','update','then','destroy','get','Companies','UserProfileResource','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','name','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','findOne'];(function(_0x584da3,_0x388a44){var _0x37aeb9=function(_0x1f5b77){while(--_0x1f5b77){_0x584da3['push'](_0x584da3['shift']());}};_0x37aeb9(++_0x388a44);}(_0x274f,0x102));var _0xf274=function(_0x745c75,_0x3ddc96){_0x745c75=_0x745c75-0x0;var _0x15d6c2=_0x274f[_0x745c75];return _0x15d6c2;};'use strict';var emlformat=require(_0xf274('0x0'));var rimraf=require(_0xf274('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf274('0x2'));var rp=require(_0xf274('0x3'));var moment=require(_0xf274('0x4'));var BPromise=require(_0xf274('0x5'));var Mustache=require(_0xf274('0x6'));var util=require(_0xf274('0x7'));var path=require('path');var sox=require(_0xf274('0x8'));var csv=require(_0xf274('0x9'));var ejs=require(_0xf274('0xa'));var fs=require('fs');var fs_extra=require(_0xf274('0xb'));var _=require(_0xf274('0xc'));var squel=require(_0xf274('0xd'));var crypto=require(_0xf274('0xe'));var jsforce=require(_0xf274('0xf'));var deskjs=require(_0xf274('0x10'));var toCsv=require(_0xf274('0x9'));var querystring=require(_0xf274('0x11'));var Papa=require('papaparse');var Redis=require(_0xf274('0x12'));var authService=require(_0xf274('0x13'));var qs=require(_0xf274('0x14'));var as=require(_0xf274('0x15'));var hardwareService=require(_0xf274('0x16'));var logger=require(_0xf274('0x17'))(_0xf274('0x18'));var utils=require(_0xf274('0x19'));var config=require(_0xf274('0x1a'));var licenseUtil=require(_0xf274('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f773b,_0x2e9fd7){_0x2e9fd7=_0x2e9fd7||0xcc;return function(_0x515974){if(_0x515974){return _0x2f773b[_0xf274('0x1c')](_0x2e9fd7);}return _0x2f773b[_0xf274('0x1d')](_0x2e9fd7)[_0xf274('0x1e')]();};}function respondWithResult(_0x3ff324,_0x3d8dfb){_0x3d8dfb=_0x3d8dfb||0xc8;return function(_0x1c2178){if(_0x1c2178){return _0x3ff324['status'](_0x3d8dfb)[_0xf274('0x1f')](_0x1c2178);}};}function respondWithFilteredResult(_0x5248cb,_0x3cabeb){return function(_0x30cb68){if(_0x30cb68){var _0x556594=typeof _0x3cabeb[_0xf274('0x20')]===_0xf274('0x21')&&typeof _0x3cabeb['limit']===_0xf274('0x21');var _0x34de73=_0x30cb68[_0xf274('0x22')];var _0xf246ed=_0x556594?0x0:_0x3cabeb[_0xf274('0x20')];var _0x3522fd=_0x556594?_0x30cb68[_0xf274('0x22')]:_0x3cabeb[_0xf274('0x20')]+_0x3cabeb['limit'];var _0x3f48a5;if(_0x3522fd>=_0x34de73){_0x3522fd=_0x34de73;_0x3f48a5=0xc8;}else{_0x3f48a5=0xce;}_0x5248cb[_0xf274('0x1d')](_0x3f48a5);return _0x5248cb['set'](_0xf274('0x23'),_0xf246ed+'-'+_0x3522fd+'/'+_0x34de73)['json'](_0x30cb68);}return null;};}function patchUpdates(_0x3fdbd5){return function(_0x554b4e){try{jsonpatch['apply'](_0x554b4e,_0x3fdbd5,!![]);}catch(_0x147dbe){return BPromise[_0xf274('0x24')](_0x147dbe);}return _0x554b4e['save']();};}function saveUpdates(_0x85c31a,_0x14087e){return function(_0x1b62f9){if(_0x1b62f9){return _0x1b62f9[_0xf274('0x25')](_0x85c31a)[_0xf274('0x26')](function(_0x35cec0){return _0x35cec0;});}return null;};}function removeEntity(_0x3b0ae4,_0x22cc8b){return function(_0x1e8b12){if(_0x1e8b12){return _0x1e8b12[_0xf274('0x27')]()[_0xf274('0x26')](function(){var _0x137cbc=_0x1e8b12[_0xf274('0x28')]({'plain':!![]});var _0x3f93f4=_0xf274('0x29');return db[_0xf274('0x2a')]['destroy']({'where':{'type':_0x3f93f4,'resourceId':_0x137cbc['id']}})['then'](function(){return _0x1e8b12;});})[_0xf274('0x26')](function(){_0x3b0ae4[_0xf274('0x1d')](0xcc)[_0xf274('0x1e')]();});}};}function handleEntityNotFound(_0x5ead3d,_0x423d89){return function(_0x6f3fe0){if(!_0x6f3fe0){_0x5ead3d[_0xf274('0x1c')](0x194);}return _0x6f3fe0;};}function handleError(_0x39898a,_0x4fd345){_0x4fd345=_0x4fd345||0x1f4;return function(_0x6f706d){logger['error'](_0x6f706d['stack']);if(_0x6f706d['name']){delete _0x6f706d['name'];}_0x39898a[_0xf274('0x1d')](_0x4fd345)['send'](_0x6f706d);};}exports['index']=function(_0x44ecaf,_0x263d00){var _0x5809f1={},_0x31a470={},_0x455637={'count':0x0,'rows':[]};return db[_0xf274('0x2b')][_0xf274('0x2c')]()[_0xf274('0x26')](function(_0xfc6bf5){_0x31a470[_0xf274('0x2d')]=_[_0xf274('0x2e')](_0xfc6bf5);_0x31a470[_0xf274('0x2f')]=_[_0xf274('0x2e')](_0x44ecaf[_0xf274('0x2f')]);_0x31a470['filters']=_[_0xf274('0x30')](_0x31a470[_0xf274('0x2d')],_0x31a470[_0xf274('0x2f')]);_0x5809f1[_0xf274('0x31')]=_[_0xf274('0x30')](_0x31a470[_0xf274('0x2d')],qs[_0xf274('0x32')](_0x44ecaf['query'][_0xf274('0x32')]));_0x5809f1['attributes']=_0x5809f1[_0xf274('0x31')][_0xf274('0x33')]?_0x5809f1[_0xf274('0x31')]:_0x31a470[_0xf274('0x2d')];if(!_0x44ecaf[_0xf274('0x2f')]['hasOwnProperty'](_0xf274('0x34'))){_0x5809f1[_0xf274('0x35')]=qs[_0xf274('0x35')](_0x44ecaf[_0xf274('0x2f')]['limit']);_0x5809f1[_0xf274('0x20')]=qs[_0xf274('0x20')](_0x44ecaf['query'][_0xf274('0x20')]);}_0x5809f1[_0xf274('0x36')]=qs[_0xf274('0x37')](_0x44ecaf[_0xf274('0x2f')][_0xf274('0x37')]);_0x5809f1[_0xf274('0x38')]=qs[_0xf274('0x39')](_['pick'](_0x44ecaf[_0xf274('0x2f')],_0x31a470[_0xf274('0x39')]),_0xfc6bf5);if(_0x44ecaf[_0xf274('0x2f')][_0xf274('0x3a')]){_0x5809f1[_0xf274('0x38')]=_[_0xf274('0x3b')](_0x5809f1[_0xf274('0x38')],{'$or':_[_0xf274('0x3c')](_0x5809f1['attributes'],function(_0xfe6ab8){var _0x1ad012={};_0x1ad012[_0xfe6ab8]={'$like':'%'+_0x44ecaf[_0xf274('0x2f')][_0xf274('0x3a')]+'%'};return _0x1ad012;})});}_0x5809f1=_[_0xf274('0x3b')]({},_0x5809f1,_0x44ecaf[_0xf274('0x3d')]);var _0x13496c={'where':_0x5809f1[_0xf274('0x38')]};return db[_0xf274('0x2b')][_0xf274('0x22')](_0x13496c)['then'](function(_0xe8e622){_0x455637[_0xf274('0x22')]=_0xe8e622;if(_0x44ecaf[_0xf274('0x2f')][_0xf274('0x3e')]){_0x5809f1[_0xf274('0x3f')]=[{'all':!![]}];}return db[_0xf274('0x2b')][_0xf274('0x40')](_0x5809f1);})[_0xf274('0x26')](function(_0x3b6faa){_0x455637[_0xf274('0x41')]=_0x3b6faa;return _0x455637;})[_0xf274('0x26')](respondWithFilteredResult(_0x263d00,_0x5809f1))['catch'](handleError(_0x263d00,null));})['catch'](handleError(_0x263d00,null));};exports['show']=function(_0x2c26fd,_0x1f3416){var _0x420219={'raw':![],'where':{'id':_0x2c26fd[_0xf274('0x42')]['id']}},_0x43b17f={};_0x43b17f[_0xf274('0x2d')]=_[_0xf274('0x2e')](db[_0xf274('0x2b')][_0xf274('0x43')]);_0x43b17f[_0xf274('0x2f')]=_['keys'](_0x2c26fd[_0xf274('0x2f')]);_0x43b17f['filters']=_[_0xf274('0x30')](_0x43b17f[_0xf274('0x2d')],_0x43b17f[_0xf274('0x2f')]);_0x420219['attributes']=_[_0xf274('0x30')](_0x43b17f['model'],qs[_0xf274('0x32')](_0x2c26fd[_0xf274('0x2f')]['fields']));_0x420219[_0xf274('0x31')]=_0x420219[_0xf274('0x31')][_0xf274('0x33')]?_0x420219[_0xf274('0x31')]:_0x43b17f[_0xf274('0x2d')];if(_0x2c26fd['query']['includeAll']){_0x420219[_0xf274('0x3f')]=[{'all':!![]}];}_0x420219=_['merge']({},_0x420219,_0x2c26fd[_0xf274('0x3d')]);return db['CmCompany'][_0xf274('0x44')](_0x420219)[_0xf274('0x26')](handleEntityNotFound(_0x1f3416,null))['then'](respondWithResult(_0x1f3416,null))['catch'](handleError(_0x1f3416,null));};exports[_0xf274('0x45')]=function(_0x181594,_0x1904a7){return db['CmCompany']['create'](_0x181594[_0xf274('0x46')],{})[_0xf274('0x26')](function(_0x2b230a){var _0x1616c8=_0x181594['user'][_0xf274('0x28')]({'plain':!![]});if(!_0x1616c8)throw new Error(_0xf274('0x47'));if(_0x1616c8['role']===_0xf274('0x48')){var _0x34e0c8=_0x2b230a[_0xf274('0x28')]({'plain':!![]});var _0x4b68ae=_0xf274('0x29');return db[_0xf274('0x49')][_0xf274('0x44')]({'where':{'name':_0x4b68ae,'userProfileId':_0x1616c8['userProfileId']},'raw':!![]})[_0xf274('0x26')](function(_0x24f4bf){if(_0x24f4bf&&_0x24f4bf[_0xf274('0x4a')]===0x0){return db['UserProfileResource'][_0xf274('0x45')]({'name':_0x34e0c8[_0xf274('0x4b')],'resourceId':_0x34e0c8['id'],'type':_0x24f4bf[_0xf274('0x4b')],'sectionId':_0x24f4bf['id']},{})[_0xf274('0x26')](function(){return _0x2b230a;});}else{return _0x2b230a;}})[_0xf274('0x4c')](function(_0x2711a5){logger['error'](_0xf274('0x4d'),_0x2711a5);throw _0x2711a5;});}return _0x2b230a;})[_0xf274('0x26')](respondWithResult(_0x1904a7,0xc9))[_0xf274('0x4c')](handleError(_0x1904a7,null));};exports[_0xf274('0x25')]=function(_0xad1e2f,_0x31b06a){if(_0xad1e2f[_0xf274('0x46')]['id']){delete _0xad1e2f[_0xf274('0x46')]['id'];}return db[_0xf274('0x2b')][_0xf274('0x44')]({'where':{'id':_0xad1e2f[_0xf274('0x42')]['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x31b06a,null))[_0xf274('0x26')](saveUpdates(_0xad1e2f[_0xf274('0x46')],null))[_0xf274('0x26')](respondWithResult(_0x31b06a,null))[_0xf274('0x4c')](handleError(_0x31b06a,null));};exports['destroy']=function(_0x53a4ae,_0x343ff7){return db[_0xf274('0x2b')][_0xf274('0x44')]({'where':{'id':_0x53a4ae['params']['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x343ff7,null))['then'](removeEntity(_0x343ff7,null))[_0xf274('0x4c')](handleError(_0x343ff7,null));};exports[_0xf274('0x2c')]=function(_0x4f6f8b,_0xd9b1a7){return db[_0xf274('0x2b')]['describe']()[_0xf274('0x26')](respondWithResult(_0xd9b1a7,null))[_0xf274('0x4c')](handleError(_0xd9b1a7,null));};exports[_0xf274('0x4e')]=function(_0x57c003,_0x5bf5ce,_0x4e4cf6){return db[_0xf274('0x4f')][_0xf274('0x44')]({'where':{'id':_0x57c003[_0xf274('0x42')]['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x5bf5ce,null))[_0xf274('0x26')](function(_0x590764){if(_0x590764){return _0x590764[_0xf274('0x4e')](_0x57c003[_0xf274('0x46')]['ids'],_['omit'](_0x57c003[_0xf274('0x46')],[_0xf274('0x50'),'id'])||{});}})[_0xf274('0x26')](respondWithResult(_0x5bf5ce,null))[_0xf274('0x4c')](handleError(_0x5bf5ce,null));};exports['getContacts']=function(_0x45e3a5,_0x2b8626,_0x6ef802){var _0x4fe88f={};var _0x4473e5={};var _0x4a9d1e;var _0x1e86a5;return db[_0xf274('0x2b')][_0xf274('0x51')]({'where':{'id':_0x45e3a5[_0xf274('0x42')]['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x2b8626,null))[_0xf274('0x26')](function(_0x1c423b){if(_0x1c423b){_0x4a9d1e=_0x1c423b;_0x4473e5[_0xf274('0x2d')]=_[_0xf274('0x2e')](db['CmContact'][_0xf274('0x43')]);_0x4473e5[_0xf274('0x2f')]=_[_0xf274('0x2e')](_0x45e3a5['query']);_0x4473e5[_0xf274('0x39')]=_[_0xf274('0x30')](_0x4473e5['model'],_0x4473e5[_0xf274('0x2f')]);_0x4fe88f[_0xf274('0x31')]=_[_0xf274('0x30')](_0x4473e5[_0xf274('0x2d')],qs[_0xf274('0x32')](_0x45e3a5[_0xf274('0x2f')][_0xf274('0x32')]));_0x4fe88f[_0xf274('0x31')]=_0x4fe88f[_0xf274('0x31')]['length']?_0x4fe88f[_0xf274('0x31')]:_0x4473e5['model'];_0x4fe88f['order']=qs[_0xf274('0x37')](_0x45e3a5[_0xf274('0x2f')][_0xf274('0x37')]);_0x4fe88f[_0xf274('0x38')]=qs[_0xf274('0x39')](_[_0xf274('0x52')](_0x45e3a5[_0xf274('0x2f')],_0x4473e5['filters']));if(_0x45e3a5[_0xf274('0x2f')]['filter']){_0x4fe88f[_0xf274('0x38')]=_[_0xf274('0x3b')](_0x4fe88f['where'],{'$or':_['map'](_0x4fe88f['attributes'],function(_0x25ed71){var _0x4f4a00={};_0x4f4a00[_0x25ed71]={'$like':'%'+_0x45e3a5[_0xf274('0x2f')]['filter']+'%'};return _0x4f4a00;})});}_0x4fe88f=_[_0xf274('0x3b')]({},_0x4fe88f,_0x45e3a5[_0xf274('0x3d')]);return _0x4a9d1e[_0xf274('0x53')](_0x4fe88f);}})[_0xf274('0x26')](function(_0x5976bc){if(_0x5976bc){_0x1e86a5=_0x5976bc[_0xf274('0x33')];if(!_0x45e3a5['query'][_0xf274('0x54')](_0xf274('0x34'))){_0x4fe88f[_0xf274('0x35')]=qs[_0xf274('0x35')](_0x45e3a5[_0xf274('0x2f')]['limit']);_0x4fe88f[_0xf274('0x20')]=qs[_0xf274('0x20')](_0x45e3a5[_0xf274('0x2f')][_0xf274('0x20')]);}return _0x4a9d1e[_0xf274('0x53')](_0x4fe88f);}})[_0xf274('0x26')](function(_0x383f37){if(_0x383f37){return _0x383f37?{'count':_0x1e86a5,'rows':_0x383f37}:null;}})[_0xf274('0x26')](respondWithResult(_0x2b8626,null))[_0xf274('0x4c')](handleError(_0x2b8626,null));}; \ No newline at end of file +var _0xb9ff=['show','params','rawAttributes','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','CmContact','addContacts','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','CmCompany','count','includeAll','include','rows','catch'];(function(_0x355515,_0x52573e){var _0x1d829c=function(_0x4a1ad2){while(--_0x4a1ad2){_0x355515['push'](_0x355515['shift']());}};_0x1d829c(++_0x52573e);}(_0xb9ff,0x1be));var _0xfb9f=function(_0x8743ad,_0x2f11a2){_0x8743ad=_0x8743ad-0x0;var _0x247c94=_0xb9ff[_0x8743ad];return _0x247c94;};'use strict';var emlformat=require(_0xfb9f('0x0'));var rimraf=require(_0xfb9f('0x1'));var zipdir=require(_0xfb9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb9f('0x3'));var Mustache=require(_0xfb9f('0x4'));var util=require(_0xfb9f('0x5'));var path=require(_0xfb9f('0x6'));var sox=require(_0xfb9f('0x7'));var csv=require(_0xfb9f('0x8'));var ejs=require(_0xfb9f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb9f('0xa'));var squel=require(_0xfb9f('0xb'));var crypto=require(_0xfb9f('0xc'));var jsforce=require(_0xfb9f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfb9f('0x8'));var querystring=require(_0xfb9f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb9f('0xf'));var qs=require(_0xfb9f('0x10'));var as=require(_0xfb9f('0x11'));var hardwareService=require(_0xfb9f('0x12'));var logger=require(_0xfb9f('0x13'))(_0xfb9f('0x14'));var utils=require(_0xfb9f('0x15'));var config=require(_0xfb9f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb9f('0x17'))['db'];function respondWithStatusCode(_0x1cae06,_0x4c8013){_0x4c8013=_0x4c8013||0xcc;return function(_0x29010d){if(_0x29010d){return _0x1cae06[_0xfb9f('0x18')](_0x4c8013);}return _0x1cae06['status'](_0x4c8013)[_0xfb9f('0x19')]();};}function respondWithResult(_0x3c5da9,_0x218d08){_0x218d08=_0x218d08||0xc8;return function(_0x4e2dc9){if(_0x4e2dc9){return _0x3c5da9[_0xfb9f('0x1a')](_0x218d08)[_0xfb9f('0x1b')](_0x4e2dc9);}};}function respondWithFilteredResult(_0x3b4599,_0xbca2a8){return function(_0x346208){if(_0x346208){var _0x55895a=typeof _0xbca2a8[_0xfb9f('0x1c')]===_0xfb9f('0x1d')&&typeof _0xbca2a8[_0xfb9f('0x1e')]===_0xfb9f('0x1d');var _0x879422=_0x346208['count'];var _0x280b16=_0x55895a?0x0:_0xbca2a8['offset'];var _0x55ae32=_0x55895a?_0x346208['count']:_0xbca2a8[_0xfb9f('0x1c')]+_0xbca2a8[_0xfb9f('0x1e')];var _0x457ef5;if(_0x55ae32>=_0x879422){_0x55ae32=_0x879422;_0x457ef5=0xc8;}else{_0x457ef5=0xce;}_0x3b4599[_0xfb9f('0x1a')](_0x457ef5);return _0x3b4599['set'](_0xfb9f('0x1f'),_0x280b16+'-'+_0x55ae32+'/'+_0x879422)[_0xfb9f('0x1b')](_0x346208);}return null;};}function patchUpdates(_0x53b19c){return function(_0x13c50b){try{jsonpatch[_0xfb9f('0x20')](_0x13c50b,_0x53b19c,!![]);}catch(_0x3ceb08){return BPromise['reject'](_0x3ceb08);}return _0x13c50b[_0xfb9f('0x21')]();};}function saveUpdates(_0xc6e325,_0x495630){return function(_0x5332e0){if(_0x5332e0){return _0x5332e0[_0xfb9f('0x22')](_0xc6e325)[_0xfb9f('0x23')](function(_0x1ce5e3){return _0x1ce5e3;});}return null;};}function removeEntity(_0x113767,_0x310420){return function(_0x5c1465){if(_0x5c1465){return _0x5c1465[_0xfb9f('0x24')]()[_0xfb9f('0x23')](function(){var _0x202443=_0x5c1465[_0xfb9f('0x25')]({'plain':!![]});var _0x2ae1ad=_0xfb9f('0x26');return db[_0xfb9f('0x27')][_0xfb9f('0x24')]({'where':{'type':_0x2ae1ad,'resourceId':_0x202443['id']}})[_0xfb9f('0x23')](function(){return _0x5c1465;});})['then'](function(){_0x113767['status'](0xcc)[_0xfb9f('0x19')]();});}};}function handleEntityNotFound(_0x5d0812,_0x37178b){return function(_0x2a6ffa){if(!_0x2a6ffa){_0x5d0812[_0xfb9f('0x18')](0x194);}return _0x2a6ffa;};}function handleError(_0x41b8ac,_0x1835c9){_0x1835c9=_0x1835c9||0x1f4;return function(_0x11a69f){logger[_0xfb9f('0x28')](_0x11a69f[_0xfb9f('0x29')]);if(_0x11a69f[_0xfb9f('0x2a')]){delete _0x11a69f[_0xfb9f('0x2a')];}_0x41b8ac[_0xfb9f('0x1a')](_0x1835c9)[_0xfb9f('0x2b')](_0x11a69f);};}exports[_0xfb9f('0x2c')]=function(_0x15e3b8,_0x4a5a59){var _0x38227c={},_0x2caccc={},_0x125fa9={'count':0x0,'rows':[]};return db['CmCompany'][_0xfb9f('0x2d')]()[_0xfb9f('0x23')](function(_0x4caffc){_0x2caccc[_0xfb9f('0x2e')]=_[_0xfb9f('0x2f')](_0x4caffc);_0x2caccc[_0xfb9f('0x30')]=_[_0xfb9f('0x2f')](_0x15e3b8[_0xfb9f('0x30')]);_0x2caccc[_0xfb9f('0x31')]=_[_0xfb9f('0x32')](_0x2caccc[_0xfb9f('0x2e')],_0x2caccc[_0xfb9f('0x30')]);_0x38227c['attributes']=_['intersection'](_0x2caccc['model'],qs[_0xfb9f('0x33')](_0x15e3b8['query'][_0xfb9f('0x33')]));_0x38227c[_0xfb9f('0x34')]=_0x38227c[_0xfb9f('0x34')][_0xfb9f('0x35')]?_0x38227c[_0xfb9f('0x34')]:_0x2caccc[_0xfb9f('0x2e')];if(!_0x15e3b8['query'][_0xfb9f('0x36')](_0xfb9f('0x37'))){_0x38227c[_0xfb9f('0x1e')]=qs['limit'](_0x15e3b8['query']['limit']);_0x38227c[_0xfb9f('0x1c')]=qs[_0xfb9f('0x1c')](_0x15e3b8['query'][_0xfb9f('0x1c')]);}_0x38227c[_0xfb9f('0x38')]=qs[_0xfb9f('0x39')](_0x15e3b8[_0xfb9f('0x30')][_0xfb9f('0x39')]);_0x38227c[_0xfb9f('0x3a')]=qs['filters'](_[_0xfb9f('0x3b')](_0x15e3b8['query'],_0x2caccc['filters']),_0x4caffc);if(_0x15e3b8[_0xfb9f('0x30')][_0xfb9f('0x3c')]){_0x38227c[_0xfb9f('0x3a')]=_[_0xfb9f('0x3d')](_0x38227c[_0xfb9f('0x3a')],{'$or':_[_0xfb9f('0x3e')](_0x38227c[_0xfb9f('0x34')],function(_0x3dd83e){var _0x340916={};_0x340916[_0x3dd83e]={'$like':'%'+_0x15e3b8['query'][_0xfb9f('0x3c')]+'%'};return _0x340916;})});}_0x38227c=_['merge']({},_0x38227c,_0x15e3b8[_0xfb9f('0x3f')]);var _0x39ce9f={'where':_0x38227c['where']};return db[_0xfb9f('0x40')][_0xfb9f('0x41')](_0x39ce9f)[_0xfb9f('0x23')](function(_0x4b2c9e){_0x125fa9[_0xfb9f('0x41')]=_0x4b2c9e;if(_0x15e3b8[_0xfb9f('0x30')][_0xfb9f('0x42')]){_0x38227c[_0xfb9f('0x43')]=[{'all':!![]}];}return db[_0xfb9f('0x40')]['findAll'](_0x38227c);})[_0xfb9f('0x23')](function(_0x9fa60a){_0x125fa9[_0xfb9f('0x44')]=_0x9fa60a;return _0x125fa9;})['then'](respondWithFilteredResult(_0x4a5a59,_0x38227c))[_0xfb9f('0x45')](handleError(_0x4a5a59,null));})[_0xfb9f('0x45')](handleError(_0x4a5a59,null));};exports[_0xfb9f('0x46')]=function(_0x255e2f,_0x286713){var _0x42e094={'raw':![],'where':{'id':_0x255e2f[_0xfb9f('0x47')]['id']}},_0x243940={};_0x243940['model']=_[_0xfb9f('0x2f')](db[_0xfb9f('0x40')][_0xfb9f('0x48')]);_0x243940[_0xfb9f('0x30')]=_[_0xfb9f('0x2f')](_0x255e2f['query']);_0x243940[_0xfb9f('0x31')]=_[_0xfb9f('0x32')](_0x243940[_0xfb9f('0x2e')],_0x243940[_0xfb9f('0x30')]);_0x42e094[_0xfb9f('0x34')]=_[_0xfb9f('0x32')](_0x243940[_0xfb9f('0x2e')],qs[_0xfb9f('0x33')](_0x255e2f[_0xfb9f('0x30')][_0xfb9f('0x33')]));_0x42e094[_0xfb9f('0x34')]=_0x42e094[_0xfb9f('0x34')][_0xfb9f('0x35')]?_0x42e094[_0xfb9f('0x34')]:_0x243940[_0xfb9f('0x2e')];if(_0x255e2f[_0xfb9f('0x30')][_0xfb9f('0x42')]){_0x42e094[_0xfb9f('0x43')]=[{'all':!![]}];}_0x42e094=_[_0xfb9f('0x3d')]({},_0x42e094,_0x255e2f[_0xfb9f('0x3f')]);return db[_0xfb9f('0x40')][_0xfb9f('0x49')](_0x42e094)['then'](handleEntityNotFound(_0x286713,null))[_0xfb9f('0x23')](respondWithResult(_0x286713,null))[_0xfb9f('0x45')](handleError(_0x286713,null));};exports[_0xfb9f('0x4a')]=function(_0x41cd3d,_0x36e522){return db['CmCompany'][_0xfb9f('0x4a')](_0x41cd3d[_0xfb9f('0x4b')],{})[_0xfb9f('0x23')](function(_0x3b2719){var _0x456422=_0x41cd3d[_0xfb9f('0x4c')]['get']({'plain':!![]});if(!_0x456422)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x456422['role']===_0xfb9f('0x4c')){var _0x311ee1=_0x3b2719[_0xfb9f('0x25')]({'plain':!![]});var _0x1bfcd0=_0xfb9f('0x26');return db[_0xfb9f('0x4d')]['find']({'where':{'name':_0x1bfcd0,'userProfileId':_0x456422[_0xfb9f('0x4e')]},'raw':!![]})['then'](function(_0x30fefe){if(_0x30fefe&&_0x30fefe[_0xfb9f('0x4f')]===0x0){return db[_0xfb9f('0x27')][_0xfb9f('0x4a')]({'name':_0x311ee1[_0xfb9f('0x2a')],'resourceId':_0x311ee1['id'],'type':_0x30fefe[_0xfb9f('0x2a')],'sectionId':_0x30fefe['id']},{})['then'](function(){return _0x3b2719;});}else{return _0x3b2719;}})[_0xfb9f('0x45')](function(_0xa61db0){logger[_0xfb9f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa61db0);throw _0xa61db0;});}return _0x3b2719;})['then'](respondWithResult(_0x36e522,0xc9))[_0xfb9f('0x45')](handleError(_0x36e522,null));};exports[_0xfb9f('0x22')]=function(_0x280c0b,_0x171c24){if(_0x280c0b[_0xfb9f('0x4b')]['id']){delete _0x280c0b[_0xfb9f('0x4b')]['id'];}return db[_0xfb9f('0x40')][_0xfb9f('0x49')]({'where':{'id':_0x280c0b[_0xfb9f('0x47')]['id']}})['then'](handleEntityNotFound(_0x171c24,null))[_0xfb9f('0x23')](saveUpdates(_0x280c0b[_0xfb9f('0x4b')],null))['then'](respondWithResult(_0x171c24,null))[_0xfb9f('0x45')](handleError(_0x171c24,null));};exports[_0xfb9f('0x24')]=function(_0x3096dc,_0x36371a){return db['CmCompany'][_0xfb9f('0x49')]({'where':{'id':_0x3096dc[_0xfb9f('0x47')]['id']}})[_0xfb9f('0x23')](handleEntityNotFound(_0x36371a,null))[_0xfb9f('0x23')](removeEntity(_0x36371a,null))[_0xfb9f('0x45')](handleError(_0x36371a,null));};exports[_0xfb9f('0x2d')]=function(_0x240a89,_0x4a920f){return db[_0xfb9f('0x40')][_0xfb9f('0x2d')]()[_0xfb9f('0x23')](respondWithResult(_0x4a920f,null))['catch'](handleError(_0x4a920f,null));};exports['addContacts']=function(_0x80f03b,_0x58b562,_0x31eaf9){return db[_0xfb9f('0x50')][_0xfb9f('0x49')]({'where':{'id':_0x80f03b['params']['id']}})['then'](handleEntityNotFound(_0x58b562,null))[_0xfb9f('0x23')](function(_0x4db8f3){if(_0x4db8f3){return _0x4db8f3[_0xfb9f('0x51')](_0x80f03b[_0xfb9f('0x4b')][_0xfb9f('0x52')],_[_0xfb9f('0x53')](_0x80f03b['body'],[_0xfb9f('0x52'),'id'])||{});}})[_0xfb9f('0x23')](respondWithResult(_0x58b562,null))[_0xfb9f('0x45')](handleError(_0x58b562,null));};exports[_0xfb9f('0x54')]=function(_0x38cdf9,_0x25e4af,_0xfd353b){var _0x2e3176={};var _0x3505e6={};var _0x11225b;var _0x1c5c2e;return db[_0xfb9f('0x40')][_0xfb9f('0x55')]({'where':{'id':_0x38cdf9[_0xfb9f('0x47')]['id']}})[_0xfb9f('0x23')](handleEntityNotFound(_0x25e4af,null))['then'](function(_0x25e291){if(_0x25e291){_0x11225b=_0x25e291;_0x3505e6[_0xfb9f('0x2e')]=_['keys'](db['CmContact'][_0xfb9f('0x48')]);_0x3505e6[_0xfb9f('0x30')]=_[_0xfb9f('0x2f')](_0x38cdf9['query']);_0x3505e6[_0xfb9f('0x31')]=_[_0xfb9f('0x32')](_0x3505e6[_0xfb9f('0x2e')],_0x3505e6['query']);_0x2e3176[_0xfb9f('0x34')]=_[_0xfb9f('0x32')](_0x3505e6[_0xfb9f('0x2e')],qs[_0xfb9f('0x33')](_0x38cdf9[_0xfb9f('0x30')]['fields']));_0x2e3176[_0xfb9f('0x34')]=_0x2e3176[_0xfb9f('0x34')][_0xfb9f('0x35')]?_0x2e3176['attributes']:_0x3505e6[_0xfb9f('0x2e')];_0x2e3176[_0xfb9f('0x38')]=qs[_0xfb9f('0x39')](_0x38cdf9[_0xfb9f('0x30')][_0xfb9f('0x39')]);_0x2e3176['where']=qs[_0xfb9f('0x31')](_[_0xfb9f('0x3b')](_0x38cdf9['query'],_0x3505e6['filters']));if(_0x38cdf9['query']['filter']){_0x2e3176['where']=_['merge'](_0x2e3176[_0xfb9f('0x3a')],{'$or':_[_0xfb9f('0x3e')](_0x2e3176[_0xfb9f('0x34')],function(_0x24860a){var _0x153af9={};_0x153af9[_0x24860a]={'$like':'%'+_0x38cdf9[_0xfb9f('0x30')][_0xfb9f('0x3c')]+'%'};return _0x153af9;})});}_0x2e3176=_[_0xfb9f('0x3d')]({},_0x2e3176,_0x38cdf9[_0xfb9f('0x3f')]);return _0x11225b[_0xfb9f('0x54')](_0x2e3176);}})[_0xfb9f('0x23')](function(_0x1cf92f){if(_0x1cf92f){_0x1c5c2e=_0x1cf92f[_0xfb9f('0x35')];if(!_0x38cdf9['query']['hasOwnProperty'](_0xfb9f('0x37'))){_0x2e3176[_0xfb9f('0x1e')]=qs[_0xfb9f('0x1e')](_0x38cdf9['query'][_0xfb9f('0x1e')]);_0x2e3176[_0xfb9f('0x1c')]=qs[_0xfb9f('0x1c')](_0x38cdf9[_0xfb9f('0x30')][_0xfb9f('0x1c')]);}return _0x11225b[_0xfb9f('0x54')](_0x2e3176);}})[_0xfb9f('0x23')](function(_0x3ca102){if(_0x3ca102){return _0x3ca102?{'count':_0x1c5c2e,'rows':_0x3ca102}:null;}})[_0xfb9f('0x23')](respondWithResult(_0x25e4af,null))[_0xfb9f('0x45')](handleError(_0x25e4af,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a604de5..c0db184 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 _0x2c89=['request-promise','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','util','api','moment','bluebird'];(function(_0x4d2aea,_0x4a8f11){var _0x1715b8=function(_0x50aadc){while(--_0x50aadc){_0x4d2aea['push'](_0x4d2aea['shift']());}};_0x1715b8(++_0x4a8f11);}(_0x2c89,0x193));var _0x92c8=function(_0x578eb4,_0x657262){_0x578eb4=_0x578eb4-0x0;var _0x49eca8=_0x2c89[_0x578eb4];return _0x49eca8;};'use strict';var _=require('lodash');var util=require(_0x92c8('0x0'));var logger=require('../../config/logger')(_0x92c8('0x1'));var moment=require(_0x92c8('0x2'));var BPromise=require(_0x92c8('0x3'));var rp=require(_0x92c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92c8('0x5'));var config=require(_0x92c8('0x6'));var attributes=require('./cmCompany.attributes');module[_0x92c8('0x7')]=function(_0x5c7cdc,_0x522f04){return _0x5c7cdc[_0x92c8('0x8')](_0x92c8('0x9'),attributes,{'tableName':_0x92c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb90=['api','moment','request-promise','path','rimraf','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x9f0be5,_0x1e81b9){var _0x3fb280=function(_0x5b87c8){while(--_0x5b87c8){_0x9f0be5['push'](_0x9f0be5['shift']());}};_0x3fb280(++_0x1e81b9);}(_0xfb90,0x135));var _0x0fb9=function(_0x16adf1,_0x1273a5){_0x16adf1=_0x16adf1-0x0;var _0xc13362=_0xfb90[_0x16adf1];return _0xc13362;};'use strict';var _=require(_0x0fb9('0x0'));var util=require(_0x0fb9('0x1'));var logger=require(_0x0fb9('0x2'))(_0x0fb9('0x3'));var moment=require(_0x0fb9('0x4'));var BPromise=require('bluebird');var rp=require(_0x0fb9('0x5'));var fs=require('fs');var path=require(_0x0fb9('0x6'));var rimraf=require(_0x0fb9('0x7'));var config=require('../../config/environment');var attributes=require(_0x0fb9('0x8'));module[_0x0fb9('0x9')]=function(_0x375538,_0xf3f1ea){return _0x375538['define'](_0x0fb9('0xa'),attributes,{'tableName':_0x0fb9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index f4f8bf3..111fcda 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 _0xadf6=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xadf6,0xb0));var _0x6adf=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xadf6[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x6adf('0x0'));var util=require(_0x6adf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6adf('0x2'));var fs=require('fs');var Redis=require(_0x6adf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6adf('0x4'));var logger=require(_0x6adf('0x5'))(_0x6adf('0x6'));var config=require(_0x6adf('0x7'));var jayson=require(_0x6adf('0x8'));var client=jayson[_0x6adf('0x9')][_0x6adf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6ccce7,_0x4bfb5f,_0x194109){return new BPromise(function(_0x3d61c7,_0x51cc1b){return client[_0x6adf('0xb')](_0x6ccce7,_0x194109)[_0x6adf('0xc')](function(_0x52351c){logger[_0x6adf('0xd')](_0x6adf('0xe'),_0x4bfb5f,_0x6adf('0xf'));logger[_0x6adf('0x10')](_0x6adf('0x11'),_0x4bfb5f,_0x6adf('0xf'),JSON[_0x6adf('0x12')](_0x52351c));if(_0x52351c[_0x6adf('0x13')]){if(_0x52351c[_0x6adf('0x13')][_0x6adf('0x14')]===0x1f4){logger['error'](_0x6adf('0xe'),_0x4bfb5f,_0x52351c[_0x6adf('0x13')][_0x6adf('0x15')]);return _0x51cc1b(_0x52351c[_0x6adf('0x13')]['message']);}logger[_0x6adf('0x13')]('CmCompany,\x20%s,\x20%s',_0x4bfb5f,_0x52351c[_0x6adf('0x13')][_0x6adf('0x15')]);return _0x3d61c7(_0x52351c[_0x6adf('0x13')][_0x6adf('0x15')]);}else{logger[_0x6adf('0xd')](_0x6adf('0xe'),_0x4bfb5f,_0x6adf('0xf'));_0x3d61c7(_0x52351c[_0x6adf('0x16')][_0x6adf('0x15')]);}})[_0x6adf('0x17')](function(_0x425dcb){logger['error'](_0x6adf('0xe'),_0x4bfb5f,_0x425dcb);_0x51cc1b(_0x425dcb);});});} \ No newline at end of file +var _0x17bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x17bd,0x175));var _0xd17b=function(_0x15ca10,_0x4607c4){_0x15ca10=_0x15ca10-0x0;var _0x1e634c=_0x17bd[_0x15ca10];return _0x1e634c;};'use strict';var _=require(_0xd17b('0x0'));var util=require(_0xd17b('0x1'));var moment=require(_0xd17b('0x2'));var BPromise=require(_0xd17b('0x3'));var rs=require(_0xd17b('0x4'));var fs=require('fs');var Redis=require(_0xd17b('0x5'));var db=require(_0xd17b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd17b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd17b('0x8'));var client=jayson[_0xd17b('0x9')][_0xd17b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dab3c,_0x39c343,_0x124a1d){return new BPromise(function(_0x47109b,_0x15e6a0){return client[_0xd17b('0xb')](_0x2dab3c,_0x124a1d)[_0xd17b('0xc')](function(_0x5a10ab){logger[_0xd17b('0xd')](_0xd17b('0xe'),_0x39c343,_0xd17b('0xf'));logger[_0xd17b('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x39c343,_0xd17b('0xf'),JSON[_0xd17b('0x11')](_0x5a10ab));if(_0x5a10ab[_0xd17b('0x12')]){if(_0x5a10ab['error'][_0xd17b('0x13')]===0x1f4){logger[_0xd17b('0x12')](_0xd17b('0xe'),_0x39c343,_0x5a10ab['error'][_0xd17b('0x14')]);return _0x15e6a0(_0x5a10ab[_0xd17b('0x12')][_0xd17b('0x14')]);}logger[_0xd17b('0x12')](_0xd17b('0xe'),_0x39c343,_0x5a10ab['error'][_0xd17b('0x14')]);return _0x47109b(_0x5a10ab['error'][_0xd17b('0x14')]);}else{logger[_0xd17b('0xd')](_0xd17b('0xe'),_0x39c343,_0xd17b('0xf'));_0x47109b(_0x5a10ab['result'][_0xd17b('0x14')]);}})[_0xd17b('0x15')](function(_0x56e756){logger[_0xd17b('0x12')](_0xd17b('0xe'),_0x39c343,_0x56e756);_0x15e6a0(_0x56e756);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5d75bb0..deeb582 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 _0xa5ff=['put','/:id','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','getContacts','post','create','/:id/contacts','addContacts'];(function(_0x5ef3cf,_0x334435){var _0x126707=function(_0x363908){while(--_0x363908){_0x5ef3cf['push'](_0x5ef3cf['shift']());}};_0x126707(++_0x334435);}(_0xa5ff,0xa4));var _0xfa5f=function(_0x1fa463,_0x460713){_0x1fa463=_0x1fa463-0x0;var _0x1ec77b=_0xa5ff[_0x1fa463];return _0x1ec77b;};'use strict';var multer=require(_0xfa5f('0x0'));var util=require(_0xfa5f('0x1'));var path=require(_0xfa5f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa5f('0x3')]();var fs_extra=require(_0xfa5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfa5f('0x5'));var config=require(_0xfa5f('0x6'));var controller=require('./cmCompany.controller');router[_0xfa5f('0x7')]('/',auth['isAuthenticated'](),controller[_0xfa5f('0x8')]);router[_0xfa5f('0x7')]('/describe',auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xa')]);router[_0xfa5f('0x7')]('/:id',auth[_0xfa5f('0x9')](),controller['show']);router[_0xfa5f('0x7')]('/:id/contacts',auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xb')]);router[_0xfa5f('0xc')]('/',auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xd')]);router[_0xfa5f('0xc')](_0xfa5f('0xe'),auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xf')]);router[_0xfa5f('0x10')](_0xfa5f('0x11'),auth[_0xfa5f('0x9')](),controller['update']);router[_0xfa5f('0x12')](_0xfa5f('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa5f('0x13')]=router; \ No newline at end of file +var _0x89bf=['../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xaf0197,_0x390c5d){var _0x168213=function(_0x315646){while(--_0x315646){_0xaf0197['push'](_0xaf0197['shift']());}};_0x168213(++_0x390c5d);}(_0x89bf,0xab));var _0xf89b=function(_0x58d43b,_0x92918c){_0x58d43b=_0x58d43b-0x0;var _0x1fbbbc=_0x89bf[_0x58d43b];return _0x1fbbbc;};'use strict';var multer=require(_0xf89b('0x0'));var util=require(_0xf89b('0x1'));var path=require(_0xf89b('0x2'));var timeout=require(_0xf89b('0x3'));var express=require(_0xf89b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf89b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf89b('0x6'));var controller=require(_0xf89b('0x7'));router[_0xf89b('0x8')]('/',auth[_0xf89b('0x9')](),controller['index']);router[_0xf89b('0x8')]('/describe',auth[_0xf89b('0x9')](),controller[_0xf89b('0xa')]);router[_0xf89b('0x8')](_0xf89b('0xb'),auth[_0xf89b('0x9')](),controller[_0xf89b('0xc')]);router['get']('/:id/contacts',auth[_0xf89b('0x9')](),controller[_0xf89b('0xd')]);router[_0xf89b('0xe')]('/',auth['isAuthenticated'](),controller[_0xf89b('0xf')]);router['post'](_0xf89b('0x10'),auth[_0xf89b('0x9')](),controller[_0xf89b('0x11')]);router[_0xf89b('0x12')](_0xf89b('0xb'),auth[_0xf89b('0x9')](),controller['update']);router[_0xf89b('0x13')](_0xf89b('0xb'),auth['isAuthenticated'](),controller[_0xf89b('0x14')]);module[_0xf89b('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 b6423ec..7f9f8db 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 _0x6d26=['DATE','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x2dda1a,_0x1d9ba8){var _0x33dacb=function(_0x333139){while(--_0x333139){_0x2dda1a['push'](_0x2dda1a['shift']());}};_0x33dacb(++_0x1d9ba8);}(_0x6d26,0xa3));var _0x66d2=function(_0x3db4d2,_0x4a7632){_0x3db4d2=_0x3db4d2-0x0;var _0x53dbbb=_0x6d26[_0x3db4d2];return _0x53dbbb;};'use strict';var _=require(_0x66d2('0x0'));var Sequelize=require(_0x66d2('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x66d2('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x66d2('0x2')]},'street':{'type':Sequelize[_0x66d2('0x2')]},'postalCode':{'type':Sequelize[_0x66d2('0x2')]},'city':{'type':Sequelize[_0x66d2('0x2')]},'country':{'type':Sequelize[_0x66d2('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x66d2('0x3')]},'phone':{'type':Sequelize[_0x66d2('0x2')]},'mobile':{'type':Sequelize[_0x66d2('0x2')]},'fax':{'type':Sequelize[_0x66d2('0x2')]},'email':{'type':Sequelize[_0x66d2('0x2')]},'url':{'type':Sequelize[_0x66d2('0x2')]},'facebook':{'type':Sequelize[_0x66d2('0x2')]},'fb_data':{'type':Sequelize[_0x66d2('0x2')]},'twitter':{'type':Sequelize[_0x66d2('0x2')]},'skype':{'type':Sequelize[_0x66d2('0x2')]},'teams':{'type':Sequelize[_0x66d2('0x2')]},'viber':{'type':Sequelize[_0x66d2('0x2')]},'line':{'type':Sequelize[_0x66d2('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x66d2('0x2')]},'UserId':{'type':Sequelize[_0x66d2('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x66d2('0x2')]},'priority':{'type':Sequelize[_0x66d2('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x66d2('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x66d2('0x2')]},'utcOffset':{'type':Sequelize[_0x66d2('0x4')]}}; \ No newline at end of file +var _0x768b=['lodash','sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x150ed2,_0x1705e2){var _0x9668ba=function(_0x464398){while(--_0x464398){_0x150ed2['push'](_0x150ed2['shift']());}};_0x9668ba(++_0x1705e2);}(_0x768b,0x140));var _0xb768=function(_0x2f8fdf,_0x440bc3){_0x2f8fdf=_0x2f8fdf-0x0;var _0xc24053=_0x768b[_0x2f8fdf];return _0xc24053;};'use strict';var _=require(_0xb768('0x0'));var Sequelize=require(_0xb768('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xb768('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb768('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb768('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb768('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb768('0x2')]},'description':{'type':Sequelize[_0xb768('0x3')]},'phone':{'type':Sequelize[_0xb768('0x2')]},'mobile':{'type':Sequelize[_0xb768('0x2')]},'fax':{'type':Sequelize[_0xb768('0x2')]},'email':{'type':Sequelize[_0xb768('0x2')]},'url':{'type':Sequelize[_0xb768('0x2')]},'facebook':{'type':Sequelize[_0xb768('0x2')]},'fb_data':{'type':Sequelize[_0xb768('0x2')]},'twitter':{'type':Sequelize[_0xb768('0x2')]},'skype':{'type':Sequelize[_0xb768('0x2')]},'teams':{'type':Sequelize[_0xb768('0x2')]},'viber':{'type':Sequelize[_0xb768('0x2')]},'line':{'type':Sequelize[_0xb768('0x2')]},'wechat':{'type':Sequelize[_0xb768('0x2')]},'telegram':{'type':Sequelize[_0xb768('0x2')]},'UserId':{'type':Sequelize[_0xb768('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb768('0x4')](0x2)[_0xb768('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb768('0x6')],'defaultValue':Sequelize[_0xb768('0x7')]},'dialTimezone':{'type':Sequelize[_0xb768('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d566c24..46de3be 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 _0xbf3e=['get','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','spread','contact','all','show','Tags','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','findOne','Tag','filters','model','attributes','intersection','fields','order','sort','pick','filter','map','hasOwnProperty','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopper','item','PHONE','CmHopperId','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','hopperId','rawAttributes','nolimit','ContactId','options','include','rows','CmHopperHistory','getHopperFinals','includeAll','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csvUpdates','mail','chat','fax','whatsapp','voice','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','fullname','DESC','startCase','Account','closed','closedAt','disposition','secondDisposition','UserId','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Owner','flatten','sortBy','reverse','value','slice','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','stack','name','send','describe','findAll','user','catch','CmContact','find','params','keys','startsWith','cf_','query','CmCustomField','length','columnName','displayName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from'];(function(_0x57207d,_0x1edb04){var _0x35166a=function(_0x57067a){while(--_0x57067a){_0x57207d['push'](_0x57207d['shift']());}};_0x35166a(++_0x1edb04);}(_0xbf3e,0xc0));var _0xebf3=function(_0x1bd1c3,_0x1ed2d9){_0x1bd1c3=_0x1bd1c3-0x0;var _0x5a1e76=_0xbf3e[_0x1bd1c3];return _0x5a1e76;};'use strict';var moment=require(_0xebf3('0x0'));var BPromise=require('bluebird');var util=require(_0xebf3('0x1'));var path=require(_0xebf3('0x2'));var fs=require('fs');var _=require(_0xebf3('0x3'));var squel=require(_0xebf3('0x4'));var Papa=require(_0xebf3('0x5'));var Redis=require(_0xebf3('0x6'));var contacts=require(_0xebf3('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xebf3('0x8'));var shared=require('../../config/environment/shared');var db=require(_0xebf3('0x9'))['db'];config['redis']=_['defaults'](config[_0xebf3('0xa')],{'host':_0xebf3('0xb'),'port':0x18eb});var socket=require(_0xebf3('0xc'))(new Redis(config[_0xebf3('0xa')]));require(_0xebf3('0xd'))['register'](socket);function respondWithResult(_0x476b21,_0x24348f){_0x24348f=_0x24348f||0xc8;return function(_0x3578e1){if(_0x3578e1){return _0x476b21[_0xebf3('0xe')](_0x24348f)[_0xebf3('0xf')](_0x3578e1);}};}function respondWithFilteredResult(_0x2c0d1f,_0x12da59){return function(_0x2c7b9e){if(_0x2c7b9e){var _0x300e30=typeof _0x12da59[_0xebf3('0x10')]===_0xebf3('0x11')&&typeof _0x12da59['limit']===_0xebf3('0x11');var _0x420daf=_0x2c7b9e['count'];var _0x26e2a2=_0x300e30?0x0:_0x12da59[_0xebf3('0x10')];var _0xe2f0db=_0x300e30?_0x2c7b9e[_0xebf3('0x12')]:_0x12da59[_0xebf3('0x10')]+_0x12da59[_0xebf3('0x13')];var _0x2a64c2;if(_0xe2f0db>=_0x420daf){_0xe2f0db=_0x420daf;_0x2a64c2=0xc8;}else{_0x2a64c2=0xce;}_0x2c0d1f[_0xebf3('0xe')](_0x2a64c2);return _0x2c0d1f[_0xebf3('0x14')](_0xebf3('0x15'),_0x26e2a2+'-'+_0xe2f0db+'/'+_0x420daf)[_0xebf3('0xf')](_0x2c7b9e);}return null;};}function saveUpdates(_0xbb562a){return function(_0x3c4d83){if(_0x3c4d83){return _0x3c4d83[_0xebf3('0x16')](_0xbb562a)[_0xebf3('0x17')](function(_0x154799){return _0x154799;});}return null;};}function removeEntity(_0x3fa349){return function(_0x2140ce){if(_0x2140ce){return _0x2140ce[_0xebf3('0x18')]()[_0xebf3('0x17')](function(){_0x3fa349[_0xebf3('0xe')](0xcc)[_0xebf3('0x19')]();});}};}function handleEntityNotFound(_0x2c2db9){return function(_0x3e57fe){if(!_0x3e57fe){_0x2c2db9['sendStatus'](0x194);}return _0x3e57fe;};}function handleError(_0x1c9622,_0x29e7fb){_0x29e7fb=_0x29e7fb||0x1f4;return function(_0x2e1dfa){logger[_0xebf3('0x1a')](_0x2e1dfa[_0xebf3('0x1b')]);if(_0x2e1dfa[_0xebf3('0x1c')]){delete _0x2e1dfa[_0xebf3('0x1c')];}_0x1c9622[_0xebf3('0xe')](_0x29e7fb)[_0xebf3('0x1d')](_0x2e1dfa);};}exports['index']=function(_0x391861,_0x2d43cf){var _0x2c9dc9={};return contacts[_0xebf3('0x1e')]()[_0xebf3('0x17')](function(_0x2d4bf3){_0x2c9dc9=qs['getOptions'](_0x2d4bf3,_0x391861);return contacts[_0xebf3('0x1f')](_0x391861['query'],_0x391861[_0xebf3('0x20')],_0x2c9dc9,_0x2d4bf3);})['then'](respondWithFilteredResult(_0x2d43cf,_0x2c9dc9))[_0xebf3('0x21')](handleError(_0x2d43cf,null));};exports[_0xebf3('0x18')]=function(_0x333671,_0x253276){return db[_0xebf3('0x22')][_0xebf3('0x23')]({'where':{'id':_0x333671[_0xebf3('0x24')]['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x253276,null))[_0xebf3('0x17')](removeEntity(_0x253276,null))[_0xebf3('0x21')](handleError(_0x253276,null));};exports['describe']=function(_0x31592d,_0x2c72cc){return db[_0xebf3('0x22')][_0xebf3('0x1e')]()[_0xebf3('0x17')](function(_0x1d607d){delete _0x1d607d['tags'];for(var _0x4c2e52=0x0;_0x4c2e520x0){return new Promise(function(_0x234073){var _0x5d0656=[];for(var _0x255466=0x0;_0x255466<_0x11f7ca[_0xebf3('0x2a')];_0x255466++){_0x5d0656['push'](insertAdditionalPhones(_0x11f7ca[_0x255466][_0xebf3('0x5d')],_0x11f7ca[_0x255466]['additionalPhones']));}Promise[_0xebf3('0x5e')](_0x5d0656)[_0xebf3('0x17')](function(){_0x234073(0x1);});})[_0xebf3('0x17')](function(){return{'success':_0x9bc837,'failure':_0x482460,'duplicates':_0x2e3718};});}else{return{'success':_0x9bc837,'failure':_0x482460,'duplicates':_0x2e3718};}}})[_0xebf3('0x17')](respondWithResult(_0x1bf9c8,0xc9))[_0xebf3('0x21')](handleError(_0x1bf9c8,null));};exports[_0xebf3('0x5f')]=function(_0x24bbbc,_0x4c66aa){var _0x47f210;return db[_0xebf3('0x22')][_0xebf3('0x1e')]()['then'](function(_0x3349c9){return db[_0xebf3('0x22')][_0xebf3('0x23')]({'where':{'id':_0x24bbbc[_0xebf3('0x24')]['id']},'include':[{'model':db['Tag'],'as':_0xebf3('0x60'),'attributes':['id',_0xebf3('0x1c'),'color'],'required':_0x24bbbc[_0xebf3('0x28')][_0xebf3('0x61')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x24bbbc[_0xebf3('0x24')]['id']},'required':![],'include':[{'model':db[_0xebf3('0x62')],'as':_0xebf3('0x63')}]}],'order':[db[_0xebf3('0x64')][_0xebf3('0x65')](_0xebf3('0x66'))],'attributes':_['keys'](_0x3349c9)});})[_0xebf3('0x17')](function(_0x34f7d6){if(!_['isNil'](_0x34f7d6)){_0x47f210=_0x34f7d6['get']({'plain':!![]});var _0x4bba2a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x34f7d6&&_0x34f7d6[_0xebf3('0x5b')]){if(_0x34f7d6[_0xebf3('0x5b')]){_0x4bba2a[_0xebf3('0x58')][_0xebf3('0x67')][_0xebf3('0x5a')]({'ListId':{'$ne':_0x34f7d6[_0xebf3('0x5b')]}});}}return db[_0xebf3('0x29')][_0xebf3('0x1f')](_0x4bba2a);}})[_0xebf3('0x17')](function(_0x18b2b7){if(!_[_0xebf3('0x51')](_0x18b2b7)){return _[_0xebf3('0x68')](_0x47f210,_['map'](_0x18b2b7,function(_0x162dac){return util[_0xebf3('0x69')](_0xebf3('0x6a'),_0x162dac['id']);}));}})['then'](handleEntityNotFound(_0x4c66aa,null))[_0xebf3('0x17')](respondWithResult(_0x4c66aa,null))[_0xebf3('0x21')](handleError(_0x4c66aa,null));};exports[_0xebf3('0x16')]=function(_0x10f860,_0x5145bb){var _0x1d6b10;if(_0x10f860['body']['id']){delete _0x10f860['body']['id'];}if(!_[_0xebf3('0x51')](_0x10f860[_0xebf3('0x35')][_0xebf3('0x52')])){var _0x28db14=_0x10f860['body'][_0xebf3('0x52')];if(!_[_0xebf3('0x51')](shared[_0xebf3('0x53')][_0x28db14]))_0x10f860[_0xebf3('0x35')][_0xebf3('0x54')]=shared[_0xebf3('0x53')][_0x28db14]['utcOffset'];}return db[_0xebf3('0x22')][_0xebf3('0x23')]({'where':{'id':_0x10f860[_0xebf3('0x24')]['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x5145bb,null))[_0xebf3('0x17')](saveUpdates(_0x10f860[_0xebf3('0x35')],null))[_0xebf3('0x17')](function(_0x10b42f){_0x1d6b10=_0x10b42f;var _0x3693b0={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x10b42f&&_0x10b42f[_0xebf3('0x5b')]){if(_0x10b42f[_0xebf3('0x5b')]){_0x3693b0[_0xebf3('0x58')][_0xebf3('0x67')][_0xebf3('0x5a')]({'ListId':{'$ne':_0x10b42f['ListId']}});}}return db[_0xebf3('0x29')]['findAll'](_0x3693b0);})[_0xebf3('0x17')](function(_0xd26603){if(_0xd26603){return _['omit'](_[_0xebf3('0x6b')](_0x10f860['body'],function(_0x423417,_0x73f8bf){return _[_0xebf3('0x26')](_0x73f8bf,_0xebf3('0x27'));}),_['map'](_0xd26603,function(_0x1fc970){return util[_0xebf3('0x69')](_0xebf3('0x6a'),_0x1fc970['id']);}));}})['then'](function(_0x3cc70a){if(_0x3cc70a&&!_[_0xebf3('0x6c')](_0x3cc70a)){var _0x316625=squel[_0xebf3('0x16')]()['table'](_0xebf3('0x6d'))['setFields'](_0x3cc70a)['where'](_0xebf3('0x6e'),_0x10f860[_0xebf3('0x24')]['id'])[_0xebf3('0x6f')]();return db['sequelize']['query'](_0x316625[_0xebf3('0x70')],{'replacements':_0x316625['values']});}})['then'](function(){if(_0x10f860[_0xebf3('0x35')][_0xebf3('0x71')]&&_0x1d6b10){return db['CmHopper'][_0xebf3('0x16')]({'phone':_0x10f860[_0xebf3('0x35')][_0xebf3('0x71')],'OrderBy':0x0},{'where':{'ContactId':_0x1d6b10['id']}});}})[_0xebf3('0x17')](function(){return _0x1d6b10;})[_0xebf3('0x17')](respondWithResult(_0x5145bb,null))[_0xebf3('0x21')](handleError(_0x5145bb,null));};exports[_0xebf3('0x72')]=function(_0x11b5c0,_0x7e1dd2){var _0x4a971d={};var _0x3fabd6={};var _0x45f6c5;var _0x4b443e;return db[_0xebf3('0x22')][_0xebf3('0x73')]({'where':{'id':_0x11b5c0[_0xebf3('0x24')]['id']}})['then'](handleEntityNotFound(_0x7e1dd2,null))['then'](function(_0x50761c){if(_0x50761c){_0x45f6c5=_0x50761c;_0x3fabd6['model']=_[_0xebf3('0x25')](db[_0xebf3('0x74')]['rawAttributes']);_0x3fabd6[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x11b5c0[_0xebf3('0x28')]);_0x3fabd6[_0xebf3('0x75')]=_['intersection'](_0x3fabd6[_0xebf3('0x76')],_0x3fabd6['query']);_0x4a971d[_0xebf3('0x77')]=_[_0xebf3('0x78')](_0x3fabd6['model'],qs['fields'](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x79')]));_0x4a971d['attributes']=_0x4a971d['attributes'][_0xebf3('0x2a')]?_0x4a971d[_0xebf3('0x77')]:_0x3fabd6[_0xebf3('0x76')];_0x4a971d[_0xebf3('0x7a')]=qs[_0xebf3('0x7b')](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x7b')]);_0x4a971d[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x11b5c0['query'],_0x3fabd6[_0xebf3('0x75')]));if(_0x11b5c0['query'][_0xebf3('0x7d')]){_0x4a971d[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x4a971d['where'],{'$or':_[_0xebf3('0x7e')](_0x4a971d[_0xebf3('0x77')],function(_0x1ca5fa){var _0x39cb10={};_0x39cb10[_0x1ca5fa]={'$like':'%'+_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x7d')]+'%'};return _0x39cb10;})});}_0x4a971d=_['merge']({},_0x4a971d,_0x11b5c0['options']);return _0x45f6c5[_0xebf3('0x72')](_0x4a971d);}})['then'](function(_0xfb3866){if(_0xfb3866){_0x4b443e=_0xfb3866['length'];if(!_0x11b5c0['query'][_0xebf3('0x7f')]('nolimit')){_0x4a971d[_0xebf3('0x13')]=qs['limit'](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x13')]);_0x4a971d['offset']=qs['offset'](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x10')]);}return _0x45f6c5[_0xebf3('0x72')](_0x4a971d);}})[_0xebf3('0x17')](function(_0x160e52){if(_0x160e52){return _0x160e52?{'count':_0x4b443e,'rows':_0x160e52}:null;}})[_0xebf3('0x17')](respondWithResult(_0x7e1dd2,null))[_0xebf3('0x21')](handleError(_0x7e1dd2,null));};exports['setTags']=function(_0x4ba4cb,_0x57e1bd){if(_0x4ba4cb[_0xebf3('0x35')]['id']){delete _0x4ba4cb['body']['id'];}return db[_0xebf3('0x22')]['findOne']({'where':{'id':_0x4ba4cb[_0xebf3('0x24')]['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x57e1bd,null))[_0xebf3('0x17')](function(_0x282f3f){if(_0x282f3f){return _0x282f3f['setTags'](_0x4ba4cb[_0xebf3('0x35')][_0xebf3('0x80')]||[]);}return null;})['then'](respondWithResult(_0x57e1bd,null))['catch'](handleError(_0x57e1bd,null));};exports['setAdditionalPhones']=function(_0x5be720,_0x3d5f27){var _0x160fdb=[];_0x160fdb[_0xebf3('0x5a')](addAdditionalPhones(_0x5be720[_0xebf3('0x35')]));Promise[_0xebf3('0x5e')](_0x160fdb)['then'](function(){_0x160fdb=[];_0x160fdb[_0xebf3('0x5a')](deleteCmHopperPhones(_0x5be720[_0xebf3('0x35')]['id']));_0x160fdb['push'](addCmHopperPhones(_0x5be720['body']['id']));Promise[_0xebf3('0x5e')](_0x160fdb)[_0xebf3('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x3d5f27,null));});};function addAdditionalPhones(_0x41b366){var _0x3e04ab;return new Promise(function(_0x31321a){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x41b366['id']}})[_0xebf3('0x17')](function(){db['ContactItemType'][_0xebf3('0x1f')]({'raw':!![],'attributes':['id',_0xebf3('0x81')]})[_0xebf3('0x17')](function(_0x263a16){var _0x28ed2d=[];for(var _0x3052f8=0x0;_0x3052f8<_0x41b366[_0xebf3('0x82')][_0xebf3('0x2a')];_0x3052f8++){var _0x126d7d=_0x41b366[_0xebf3('0x83')]?_[_0xebf3('0x51')](_0x41b366[_0xebf3('0x83')][_0x3052f8])?'':_0x41b366['item_types'][_0x3052f8]:_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x84')]?_0x41b366['items'][_0x3052f8][_0xebf3('0x84')]:'';var _0x4759ec=_[_0xebf3('0x51')](_0x41b366[_0xebf3('0x82')][_0x3052f8]['description'])?'':_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x85')];var _0x8c6f04=_0x126d7d+':'+_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x71')]+'§'+_0x4759ec;if(_['isNil'](_0x3e04ab))_0x3e04ab=_0x8c6f04;else _0x3e04ab+=';'+_0x8c6f04;var _0x4b1280=null;var _0x4f8b0b=null;if(_0x41b366[_0xebf3('0x83')]){if(!_['isNil'](_0x41b366[_0xebf3('0x83')][_0x3052f8])){_0x4f8b0b=_['find'](_0x263a16,function(_0xbe4eec){return _0xbe4eec['id']===_0x41b366[_0xebf3('0x83')][_0x3052f8];});if(!_[_0xebf3('0x51')](_0x4f8b0b)){_0x4b1280=_0x4f8b0b[_0xebf3('0x81')];}}}else{if(!_['isNil'](_0x41b366['items'][_0x3052f8])){_0x4f8b0b=_[_0xebf3('0x23')](_0x263a16,function(_0x508922){return _0x508922['id']===_0x41b366[_0xebf3('0x82')][_0x3052f8]['ItemTypeId'];});if(!_[_0xebf3('0x51')](_0x4f8b0b)){_0x4b1280=_0x3052f8;}}}if(_[_0xebf3('0x51')](_0x4b1280)){_0x4b1280=0x64;}_0x28ed2d[_0xebf3('0x5a')](addAdditionalPhone(_0x41b366['id'],_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x71')],_0x41b366[_0xebf3('0x83')]?_[_0xebf3('0x51')](_0x41b366[_0xebf3('0x83')][_0x3052f8])?null:_0x41b366[_0xebf3('0x83')][_0x3052f8]:_0x41b366['items'][_0x3052f8]['ItemTypeId']?_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x84')]:null,_0x4b1280,_0x4759ec));}Promise['all'](_0x28ed2d)[_0xebf3('0x17')](function(){db[_0xebf3('0x22')]['update']({'AdditionalPhones':_0x3e04ab},{'where':{'id':_0x41b366['id']}})[_0xebf3('0x17')](function(){_0x31321a(0x1);});});});});});}function addAdditionalPhone(_0x56fec0,_0x505b7e,_0x17a396,_0x2a2d78,_0x12d455){return db[_0xebf3('0x47')][_0xebf3('0x23')]({'where':{'CmContactId':_0x56fec0,'item':_0x505b7e}})['then'](function(_0x1d24d7){if(_0x1d24d7)logger[_0xebf3('0x31')](_0xebf3('0x86'),_0x1d24d7);else{db['CmContactHasItem'][_0xebf3('0x3e')]({'CmContactId':_0x56fec0,'item':_0x505b7e,'ItemTypeId':_0x17a396,'OrderBy':_0x2a2d78,'ItemClass':'PHONE','description':_0x12d455});}});}function deleteCmHopperPhones(_0x3a3095){return new Promise(function(_0x5213b1){return db[_0xebf3('0x87')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3a3095}})[_0xebf3('0x17')](function(_0x429c2f){db['CmHopperAdditionalPhone'][_0xebf3('0x18')]({'where':{'CmHopperId':{'$in':_[_0xebf3('0x7e')](_0x429c2f,'id')}}});})[_0xebf3('0x17')](function(){_0x5213b1(0x1);});});}function addCmHopperPhones(_0x2490ea){return new Promise(function(_0x389ce0){return db[_0xebf3('0x87')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2490ea}})[_0xebf3('0x17')](function(_0x44180f){var _0x1172dd=[];_[_0xebf3('0x7e')](_0x44180f,function(_0x2ac68d){_0x1172dd[_0xebf3('0x5a')](createCmHopperPhone(_0x2490ea,_0x2ac68d['id']));});Promise[_0xebf3('0x5e')](_0x1172dd)['then'](function(){_0x389ce0(0x1);});});});}function createCmHopperPhone(_0x1891da,_0x1d912a){return new Promise(function(_0x16991d){db['CmContactHasItem'][_0xebf3('0x1f')]({'raw':!![],'attributes':[_0xebf3('0x88'),'OrderBy'],'where':{'CmContactId':_0x1891da,'ItemClass':_0xebf3('0x89')},'include':[{'model':db[_0xebf3('0x62')],'attributes':[_0xebf3('0x81')],'as':'ItemType'}],'order':[_0xebf3('0x81'),db['sequelize'][_0xebf3('0x65')]('`ItemType`.OrderBy')]})[_0xebf3('0x17')](function(_0x3272de){var _0x5e0cb8=0x1;var _0x39955b=_[_0xebf3('0x7e')](_0x3272de,function(_0x4f296b){_0x4f296b[_0xebf3('0x8a')]=_0x1d912a;_0x4f296b[_0xebf3('0x71')]=_0x4f296b['item'];_0x4f296b['OrderBy']=_0x5e0cb8;delete _0x4f296b['ItemType.OrderBy'];_0x5e0cb8=_0x5e0cb8+0x1;return _0x4f296b;});return db[_0xebf3('0x8b')]['bulkCreate'](_0x39955b,{});})[_0xebf3('0x17')](function(){_0x16991d(0x1);});});}function insertAdditionalPhones(_0x2d51b5,_0xc12da6){return new Promise(function(_0x56e2bc){var _0x4c7458=[];for(var _0x42ce6c=0x0;_0x42ce6c<_0xc12da6[_0xebf3('0x2a')];_0x42ce6c++){var _0x5546d3=_0xc12da6[_0x42ce6c];_0x4c7458[_0xebf3('0x5a')](parseContactItemType(_0x5546d3));}Promise[_0xebf3('0x5e')](_0x4c7458)[_0xebf3('0x17')](function(){var _0x2e9c23={'id':_0x2d51b5['id'],'items':_0xc12da6};return addAdditionalPhones(_0x2e9c23)['then'](function(){return addCmHopperPhones(_0x2d51b5['id']);});})['then'](function(){_0x56e2bc(_0x2d51b5);});});}function parseContactItemType(_0x25f420){return new Promise(function(_0x4be31b){if(_0x25f420[_0xebf3('0x7f')](_0xebf3('0x84'))){_0x4be31b(_0x25f420);}else{return db['ContactItemType'][_0xebf3('0x23')]({'where':{'name':_0x25f420['ItemType']}})[_0xebf3('0x17')](function(_0x42ac1d){if(_[_0xebf3('0x51')](_0x42ac1d))_0x25f420['ItemTypeId']=null;else _0x25f420[_0xebf3('0x84')]=_0x42ac1d['id'];_0x4be31b(_0x25f420);});}});}exports[_0xebf3('0x8c')]=function(_0x489ba9,_0x1333a0){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x489ba9[_0xebf3('0x24')]['id'],'ItemClass':_0xebf3('0x89')},'include':[{'model':db[_0xebf3('0x62')],'as':_0xebf3('0x63')}],'order':[[_0xebf3('0x81')],[db[_0xebf3('0x64')][_0xebf3('0x65')]('`ItemType`.OrderBy')]]})[_0xebf3('0x17')](function(_0xc9a1fe){return _0xc9a1fe;})[_0xebf3('0x17')](respondWithResult(_0x1333a0,null))[_0xebf3('0x21')](handleError(_0x1333a0,null));};exports[_0xebf3('0x8d')]=function(_0xdd79e4,_0x191873){return db[_0xebf3('0x47')]['findAll']({'raw':!![],'where':{'CmContactId':_0xdd79e4[_0xebf3('0x35')]['fromContactId']}})[_0xebf3('0x17')](function(_0x4cb69d){var _0x4b1a66=_['map'](_0x4cb69d,function(_0x1fe493){_0x1fe493[_0xebf3('0x8e')]=_0xdd79e4['body'][_0xebf3('0x8f')];return _0x1fe493;});return db[_0xebf3('0x47')][_0xebf3('0x90')](_0x4b1a66,{});})[_0xebf3('0x17')](function(){return addCmHopperPhones(_0xdd79e4[_0xebf3('0x35')][_0xebf3('0x8f')]);})[_0xebf3('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x191873,null))[_0xebf3('0x21')](handleError(_0x191873,null));};exports[_0xebf3('0x91')]=function(_0x4906ff,_0x2ad800){var _0x1b53cb=[];_0x1b53cb['push'](createCmHopperPhone(_0x4906ff['body']['id'],_0x4906ff[_0xebf3('0x35')][_0xebf3('0x92')]));Promise[_0xebf3('0x5e')](_0x1b53cb)['then'](function(){return[0x1];})[_0xebf3('0x17')](respondWithResult(_0x2ad800,null));};exports['getHoppers']=function(_0x1093dc,_0x5a0b54){var _0x35c9ad={'raw':![],'where':{}};var _0x28af37={};var _0x23bc4d={'count':0x0,'rows':[]};return db['CmContact'][_0xebf3('0x73')]({'where':{'id':_0x1093dc['params']['id']}})['then'](handleEntityNotFound(_0x5a0b54,null))[_0xebf3('0x17')](function(_0x5a1da8){if(_0x5a1da8){_0x28af37[_0xebf3('0x76')]=_[_0xebf3('0x25')](db[_0xebf3('0x87')][_0xebf3('0x93')]);_0x28af37[_0xebf3('0x28')]=_['keys'](_0x1093dc[_0xebf3('0x28')]);_0x28af37[_0xebf3('0x75')]=_[_0xebf3('0x78')](_0x28af37[_0xebf3('0x76')],_0x28af37[_0xebf3('0x28')]);_0x35c9ad[_0xebf3('0x77')]=_[_0xebf3('0x78')](_0x28af37[_0xebf3('0x76')],qs[_0xebf3('0x79')](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x79')]));_0x35c9ad['attributes']=_0x35c9ad[_0xebf3('0x77')][_0xebf3('0x2a')]?_0x35c9ad[_0xebf3('0x77')]:_0x28af37[_0xebf3('0x76')];if(!_0x1093dc[_0xebf3('0x28')][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x35c9ad['limit']=qs['limit'](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x13')]);_0x35c9ad[_0xebf3('0x10')]=qs['offset'](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x10')]);}_0x35c9ad[_0xebf3('0x7a')]=qs[_0xebf3('0x7b')](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x7b')]);_0x35c9ad[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x1093dc[_0xebf3('0x28')],_0x28af37[_0xebf3('0x75')]));_0x35c9ad[_0xebf3('0x58')][_0xebf3('0x95')]=_0x5a1da8['id'];if(_0x1093dc['query'][_0xebf3('0x7d')]){_0x35c9ad[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x35c9ad['where'],{'$or':_[_0xebf3('0x7e')](_0x35c9ad['attributes'],function(_0x1489c8){var _0xc23d8e={};_0xc23d8e[_0x1489c8]={'$like':'%'+_0x1093dc['query'][_0xebf3('0x7d')]+'%'};return _0xc23d8e;})});}_0x35c9ad=_[_0xebf3('0x34')]({},_0x35c9ad,_0x1093dc[_0xebf3('0x96')]);return db[_0xebf3('0x87')][_0xebf3('0x12')]({'where':_0x35c9ad[_0xebf3('0x58')]})[_0xebf3('0x17')](function(_0xfdba86){_0x23bc4d['count']=_0xfdba86;if(_0x1093dc[_0xebf3('0x28')]['includeAll']){_0x35c9ad[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x87')]['findAll'](_0x35c9ad);})[_0xebf3('0x17')](function(_0x2e60a7){_0x23bc4d[_0xebf3('0x98')]=_0x2e60a7;return _0x23bc4d;});}})[_0xebf3('0x17')](respondWithFilteredResult(_0x5a0b54,_0x35c9ad))['catch'](handleError(_0x5a0b54,null));};exports['getHopperHistories']=function(_0x32151b,_0x54ae7d){var _0x304b37={'raw':!![],'where':{}};var _0x2728fc={};var _0x2a6e80={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x32151b['params']['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x54ae7d,null))['then'](function(_0x307c27){if(_0x307c27){_0x2728fc[_0xebf3('0x76')]=_[_0xebf3('0x25')](db[_0xebf3('0x99')][_0xebf3('0x93')]);_0x2728fc[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x32151b[_0xebf3('0x28')]);_0x2728fc[_0xebf3('0x75')]=_[_0xebf3('0x78')](_0x2728fc[_0xebf3('0x76')],_0x2728fc[_0xebf3('0x28')]);_0x304b37[_0xebf3('0x77')]=_[_0xebf3('0x78')](_0x2728fc[_0xebf3('0x76')],qs[_0xebf3('0x79')](_0x32151b['query'][_0xebf3('0x79')]));_0x304b37[_0xebf3('0x77')]=_0x304b37[_0xebf3('0x77')][_0xebf3('0x2a')]?_0x304b37[_0xebf3('0x77')]:_0x2728fc['model'];if(!_0x32151b['query'][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x304b37['limit']=qs['limit'](_0x32151b[_0xebf3('0x28')]['limit']);_0x304b37[_0xebf3('0x10')]=qs[_0xebf3('0x10')](_0x32151b['query'][_0xebf3('0x10')]);}_0x304b37[_0xebf3('0x7a')]=qs['sort'](_0x32151b[_0xebf3('0x28')]['sort']);_0x304b37[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x32151b[_0xebf3('0x28')],_0x2728fc[_0xebf3('0x75')]));_0x304b37[_0xebf3('0x58')]['ContactId']=_0x307c27['id'];if(_0x32151b[_0xebf3('0x28')][_0xebf3('0x7d')]){_0x304b37[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x304b37[_0xebf3('0x58')],{'$or':_[_0xebf3('0x7e')](_0x304b37[_0xebf3('0x77')],function(_0x459132){var _0x11e055={};_0x11e055[_0x459132]={'$like':'%'+_0x32151b['query'][_0xebf3('0x7d')]+'%'};return _0x11e055;})});}_0x304b37=_[_0xebf3('0x34')]({},_0x304b37,_0x32151b[_0xebf3('0x96')]);return db['CmHopperHistory'][_0xebf3('0x12')]({'where':_0x304b37[_0xebf3('0x58')]})[_0xebf3('0x17')](function(_0x5b97bf){_0x2a6e80[_0xebf3('0x12')]=_0x5b97bf;if(_0x32151b[_0xebf3('0x28')]['includeAll']){_0x304b37[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x99')][_0xebf3('0x1f')](_0x304b37);})['then'](function(_0x39a8a3){_0x2a6e80[_0xebf3('0x98')]=_0x39a8a3;return _0x2a6e80;});}})[_0xebf3('0x17')](respondWithFilteredResult(_0x54ae7d,_0x304b37))[_0xebf3('0x21')](handleError(_0x54ae7d,null));};exports[_0xebf3('0x9a')]=function(_0x4ca533,_0x5db1a8){var _0x5edda2={'raw':!![],'where':{}};var _0x3f0de8={};var _0x13306d={'count':0x0,'rows':[]};return db[_0xebf3('0x22')][_0xebf3('0x73')]({'where':{'id':_0x4ca533['params']['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x5db1a8,null))['then'](function(_0x14b493){if(_0x14b493){_0x3f0de8[_0xebf3('0x76')]=_[_0xebf3('0x25')](db['CmHopperFinal'][_0xebf3('0x93')]);_0x3f0de8[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x4ca533[_0xebf3('0x28')]);_0x3f0de8[_0xebf3('0x75')]=_[_0xebf3('0x78')](_0x3f0de8[_0xebf3('0x76')],_0x3f0de8[_0xebf3('0x28')]);_0x5edda2['attributes']=_['intersection'](_0x3f0de8[_0xebf3('0x76')],qs[_0xebf3('0x79')](_0x4ca533[_0xebf3('0x28')][_0xebf3('0x79')]));_0x5edda2['attributes']=_0x5edda2[_0xebf3('0x77')]['length']?_0x5edda2[_0xebf3('0x77')]:_0x3f0de8['model'];if(!_0x4ca533['query']['hasOwnProperty']('nolimit')){_0x5edda2[_0xebf3('0x13')]=qs['limit'](_0x4ca533[_0xebf3('0x28')]['limit']);_0x5edda2[_0xebf3('0x10')]=qs['offset'](_0x4ca533['query']['offset']);}_0x5edda2['order']=qs[_0xebf3('0x7b')](_0x4ca533[_0xebf3('0x28')][_0xebf3('0x7b')]);_0x5edda2['where']=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x4ca533[_0xebf3('0x28')],_0x3f0de8[_0xebf3('0x75')]));_0x5edda2[_0xebf3('0x58')][_0xebf3('0x95')]=_0x14b493['id'];if(_0x4ca533[_0xebf3('0x28')][_0xebf3('0x7d')]){_0x5edda2[_0xebf3('0x58')]=_['merge'](_0x5edda2[_0xebf3('0x58')],{'$or':_[_0xebf3('0x7e')](_0x5edda2[_0xebf3('0x77')],function(_0x205e57){var _0x2dab82={};_0x2dab82[_0x205e57]={'$like':'%'+_0x4ca533[_0xebf3('0x28')][_0xebf3('0x7d')]+'%'};return _0x2dab82;})});}_0x5edda2=_[_0xebf3('0x34')]({},_0x5edda2,_0x4ca533[_0xebf3('0x96')]);return db[_0xebf3('0x48')][_0xebf3('0x12')]({'where':_0x5edda2['where']})[_0xebf3('0x17')](function(_0x39656d){_0x13306d[_0xebf3('0x12')]=_0x39656d;if(_0x4ca533[_0xebf3('0x28')][_0xebf3('0x9b')]){_0x5edda2[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x48')][_0xebf3('0x1f')](_0x5edda2);})['then'](function(_0x265cba){_0x13306d['rows']=_0x265cba;return _0x13306d;});}})['then'](respondWithFilteredResult(_0x5db1a8,_0x5edda2))['catch'](handleError(_0x5db1a8,null));};exports[_0xebf3('0x9c')]=function(_0x5e29e8,_0x5df7cb){var _0x3068b1={'raw':!![],'where':{}};var _0x9db397={};var _0x4deab6={'count':0x0,'rows':[]};return db['CmContact'][_0xebf3('0x73')]({'where':{'id':_0x5e29e8['params']['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x5df7cb,null))[_0xebf3('0x17')](function(_0x2ae5ba){if(_0x2ae5ba){_0x9db397[_0xebf3('0x76')]=_[_0xebf3('0x25')](db[_0xebf3('0x4e')][_0xebf3('0x93')]);_0x9db397[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x5e29e8[_0xebf3('0x28')]);_0x9db397['filters']=_[_0xebf3('0x78')](_0x9db397['model'],_0x9db397[_0xebf3('0x28')]);_0x3068b1[_0xebf3('0x77')]=_['intersection'](_0x9db397['model'],qs[_0xebf3('0x79')](_0x5e29e8[_0xebf3('0x28')]['fields']));_0x3068b1[_0xebf3('0x77')]=_0x3068b1[_0xebf3('0x77')][_0xebf3('0x2a')]?_0x3068b1[_0xebf3('0x77')]:_0x9db397['model'];if(!_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x3068b1[_0xebf3('0x13')]=qs[_0xebf3('0x13')](_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x13')]);_0x3068b1[_0xebf3('0x10')]=qs[_0xebf3('0x10')](_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x10')]);}_0x3068b1[_0xebf3('0x7a')]=qs[_0xebf3('0x7b')](_0x5e29e8['query'][_0xebf3('0x7b')]);_0x3068b1[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x5e29e8[_0xebf3('0x28')],_0x9db397[_0xebf3('0x75')]));_0x3068b1[_0xebf3('0x58')][_0xebf3('0x95')]=_0x2ae5ba['id'];if(_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x7d')]){_0x3068b1[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x3068b1[_0xebf3('0x58')],{'$or':_[_0xebf3('0x7e')](_0x3068b1[_0xebf3('0x77')],function(_0x56db5f){var _0x399904={};_0x399904[_0x56db5f]={'$like':'%'+_0x5e29e8['query'][_0xebf3('0x7d')]+'%'};return _0x399904;})});}_0x3068b1=_[_0xebf3('0x34')]({},_0x3068b1,_0x5e29e8[_0xebf3('0x96')]);return db[_0xebf3('0x4e')][_0xebf3('0x12')]({'where':_0x3068b1[_0xebf3('0x58')]})[_0xebf3('0x17')](function(_0x1f1058){_0x4deab6[_0xebf3('0x12')]=_0x1f1058;if(_0x5e29e8[_0xebf3('0x28')]['includeAll']){_0x3068b1[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x4e')][_0xebf3('0x1f')](_0x3068b1);})[_0xebf3('0x17')](function(_0x5ea7d8){_0x4deab6[_0xebf3('0x98')]=_0x5ea7d8;return _0x4deab6;});}})['then'](respondWithFilteredResult(_0x5df7cb,_0x3068b1))[_0xebf3('0x21')](handleError(_0x5df7cb,null));};exports[_0xebf3('0x9d')]=function(_0x286b76,_0x2d0e9e){try{if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0x5b')]){throw new Error(_0xebf3('0x9e'));}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0x9f')]){throw new Error(_0xebf3('0xa0'));}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0xa1')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0xa2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2a0095=_0x286b76[_0xebf3('0x35')][_0xebf3('0x9f')]['split'](',');var _0x36e72c=_0x286b76[_0xebf3('0x35')][_0xebf3('0xa1')]['split'](',');if(!_0x2a0095[_0xebf3('0x2a')]||!_0x36e72c['length']||_0x2a0095[_0xebf3('0x2a')]!==_0x36e72c[_0xebf3('0x2a')]){throw new Error(_0xebf3('0xa3'));}_0x286b76[_0xebf3('0x35')][_0xebf3('0x79')]=_[_0xebf3('0xa4')](_0x2a0095,_0x36e72c);if(!_0x286b76[_0xebf3('0x35')]['fields'][_0xebf3('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0x79')][_0xebf3('0xa5')]){throw new Error(_0xebf3('0xa6'));}var _0x5aaa77=path[_0xebf3('0xa7')](config[_0xebf3('0xa8')],_0xebf3('0xa9'),_0x286b76[_0xebf3('0xaa')]['filename']);fs[_0xebf3('0xab')](_0x5aaa77,parseInt(_0xebf3('0xac'),0x8));var _0x4025fb=require(_0xebf3('0xad'))[_0xebf3('0xae')](path[_0xebf3('0xa7')](__dirname,'../../components/import/cm/csv'),[_0x5aaa77,_0x286b76['body'][_0xebf3('0x9f')],_0x286b76[_0xebf3('0x35')]['binding_values'],_0x286b76[_0xebf3('0x35')][_0xebf3('0x5b')],_0x286b76[_0xebf3('0x35')][_0xebf3('0xaf')],_0x286b76[_0xebf3('0x35')][_0xebf3('0x57')],_0x286b76[_0xebf3('0x35')]['socket_timestamp']]);return _0x2d0e9e['status'](0xc8)[_0xebf3('0xf')]({'message':_0xebf3('0xb0'),'pid':_0x4025fb[_0xebf3('0xb1')]});}catch(_0x58aaa4){return _0x2d0e9e['status'](0x1f4)['send'](_0x58aaa4);}};exports[_0xebf3('0xb2')]=function(_0x36871f,_0x37918a){var _0x5f2ab1=fs[_0xebf3('0xb3')](_0x36871f[_0xebf3('0xaa')]['path']);Papa[_0xebf3('0xb4')](_0x5f2ab1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5d57e6){return _0x37918a[_0xebf3('0xe')](0xc8)[_0xebf3('0xf')]({'file':_0x36871f[_0xebf3('0xaa')],'fields':_0x5d57e6[_0xebf3('0xb5')]['fields']});}});};exports[_0xebf3('0xb6')]=function(_0x4d0805,_0x4853c8){return db[_0xebf3('0xb7')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xebf3('0xb8')}})[_0xebf3('0x17')](function(_0x2c7fd0){var _0x32d992=![];if(!_0x4d0805[_0xebf3('0x35')]['ListId']){throw new Error(_0xebf3('0x9e'));}if(!_0x4d0805[_0xebf3('0x35')][_0xebf3('0xb9')][_0xebf3('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4d0805[_0xebf3('0x35')][_0xebf3('0xb9')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x4d0805['body'][_0xebf3('0xa2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x46050f=require(_0xebf3('0xad'))[_0xebf3('0xae')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x4d0805[_0xebf3('0x24')]['id'],JSON[_0xebf3('0xba')](_0x4d0805[_0xebf3('0x35')]),JSON['stringify'](_0x2c7fd0)]);_0x46050f['on'](_0xebf3('0xbb'),function(){_0x32d992=!![];return _0x4853c8[_0xebf3('0xe')](0xc8)[_0xebf3('0xf')]({'message':_0xebf3('0xbc'),'pid':_0x46050f[_0xebf3('0xb1')]});});_0x46050f['on'](_0xebf3('0xbd'),function(_0x5a1753){if(_0x5a1753&&!_0x32d992){return _0x4853c8[_0xebf3('0xe')](0x1f4)[_0xebf3('0xf')]({'message':_0xebf3('0xbe'),'pid':_0x46050f[_0xebf3('0xb1')]});}});})[_0xebf3('0x21')](handleError(_0x4853c8,null));};exports[_0xebf3('0xbf')]=function(_0x21bb14,_0xf322fb){return db[_0xebf3('0xb7')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xebf3('0xb8')}})[_0xebf3('0x17')](function(_0x52e0d9){var _0x1eec61=![];if(!_0x21bb14[_0xebf3('0x35')][_0xebf3('0x5b')]){throw new Error(_0xebf3('0x9e'));}if(!_0x21bb14[_0xebf3('0x35')][_0xebf3('0xb9')][_0xebf3('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x21bb14[_0xebf3('0x35')][_0xebf3('0xb9')][_0xebf3('0xa5')]){throw new Error(_0xebf3('0xa6'));}if(!_0x21bb14['body']['socket_timestamp']){throw new Error(_0xebf3('0xc0'));}var _0x23666d=require(_0xebf3('0xad'))[_0xebf3('0xae')](path[_0xebf3('0xa7')](__dirname,_0xebf3('0xc1')),[_0x21bb14[_0xebf3('0x24')]['id'],JSON[_0xebf3('0xba')](_0x21bb14[_0xebf3('0x35')]),JSON['stringify'](_0x52e0d9)]);_0x23666d['on'](_0xebf3('0xbb'),function(){_0x1eec61=!![];return _0xf322fb[_0xebf3('0xe')](0xc8)[_0xebf3('0xf')]({'message':_0xebf3('0xbc'),'pid':_0x23666d[_0xebf3('0xb1')]});});_0x23666d['on']('exit',function(_0x25cfb3){if(_0x25cfb3&&!_0x1eec61){return _0xf322fb[_0xebf3('0xe')](0x1f4)['json']({'message':_0xebf3('0xbe'),'pid':_0x23666d[_0xebf3('0xb1')]});}});})['catch'](handleError(_0xf322fb,null));};exports['getJourney']=function(_0x4a1b07,_0x16c6b5){var _0x185b60=[_0xebf3('0xc2'),_0xebf3('0xc3'),'sms','openchannel',_0xebf3('0xc4'),_0xebf3('0xc5'),_0xebf3('0xc6')];var _0x585a6a={'offset':0x0,'order':qs[_0xebf3('0x7b')]('-createdAt')},_0x2864a0={'count':0x0,'rows':[]};Promise[_0xebf3('0xc7')]()[_0xebf3('0x17')](function(){if(_0x4a1b07[_0xebf3('0x28')]['channel']){if(!_[_0xebf3('0xc8')](_0x185b60,_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xc9')][_0xebf3('0xca')]())){throw new Error(_0xebf3('0xcb'));}_0x185b60=[_0x4a1b07[_0xebf3('0x28')]['channel'][_0xebf3('0xca')]()];}if(_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]){try{var _0x47c45b=JSON[_0xebf3('0xb4')](_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]);if(!moment(_0x47c45b[_0xebf3('0x36')])[_0xebf3('0xcd')]()){throw new Error(_0xebf3('0xce'));}if(!moment(_0x47c45b['to'])[_0xebf3('0xcd')]()){throw new Error(_0xebf3('0xcf'));}}catch(_0x29f57a){throw new Error(_0xebf3('0xd0'));}}if(!_0x4a1b07[_0xebf3('0x28')][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x585a6a[_0xebf3('0x13')]=qs[_0xebf3('0x13')](_0x4a1b07[_0xebf3('0x28')]['limit']||0xa);_0x585a6a[_0xebf3('0x10')]=qs['offset'](_0x4a1b07[_0xebf3('0x28')]['offset']);}var _0x39ac4d=_0x185b60[_0xebf3('0x7e')](function(_0x18ac83){if(_0x18ac83===_0xebf3('0xc6')){var _0x8f2072={'attributes':['id','uniqueid',_0xebf3('0x2f'),'source',_0xebf3('0xd1'),_0xebf3('0xd2'),_0xebf3('0xd3'),_0xebf3('0xd4'),_0xebf3('0xd5'),_0xebf3('0xd6'),_0xebf3('0xd7'),_0xebf3('0xd8'),_0xebf3('0xd9'),'userThirdDisposition','UserId'],'where':{'ContactId':_0x4a1b07[_0xebf3('0x24')]['id']},'include':[{'model':db[_0xebf3('0xb7')],'as':'User','attributes':['id',_0xebf3('0x1c'),_0xebf3('0xda'),_0xebf3('0x2d')]}],'order':[[_0xebf3('0xd7'),_0xebf3('0xdb')]]};if(_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]){_0x8f2072[_0xebf3('0x58')][_0xebf3('0xd7')]={'$gte':_0x47c45b[_0xebf3('0x36')],'$lte':_0x47c45b['to']};}return db[_0xebf3('0x4a')]['findAndCountAll'](_0x8f2072)['then'](function(_0x36dff8){_0x2864a0['count']+=_0x36dff8[_0xebf3('0x12')];return _['map'](_0x36dff8['rows'],function(_0x5bd19d){var _0x4ea1eb=_0x5bd19d['get']({'plain':!![]});_0x4ea1eb[_0xebf3('0xc9')]=_0x18ac83;if(_0x4ea1eb[_0xebf3('0xb7')]){_0x4ea1eb[_0xebf3('0xb7')]={'id':_0x4ea1eb['User']['id'],'name':_0x4ea1eb['User']['name'],'fullname':_0x4ea1eb['User'][_0xebf3('0xda')],'alias':_0x4ea1eb['User'][_0xebf3('0x2d')]};}return _0x4ea1eb;});});}else{var _0x135e5f=_[_0xebf3('0xdc')](_0x18ac83)+(_0x18ac83===_0xebf3('0xc3')?'Website':_0xebf3('0xdd'));var _0x30c511={'attributes':['id',_0xebf3('0xde'),_0xebf3('0xdf'),_0xebf3('0xd7'),_0xebf3('0xd6'),_0xebf3('0xe0'),_0xebf3('0xe1'),'thirdDisposition',_0xebf3('0xe2'),_0x135e5f+'Id'],'where':{'ContactId':_0x4a1b07[_0xebf3('0x24')]['id']},'include':[{'model':db[_0x135e5f],'as':_0xebf3('0xdd'),'attributes':['id',_0xebf3('0x1c'),_0xebf3('0xe3')]},{'model':db[_0xebf3('0xb7')],'as':'Owner','attributes':['id',_0xebf3('0x1c'),_0xebf3('0xda')]},{'model':db[_0xebf3('0x74')],'as':_0xebf3('0x60'),'attributes':['id',_0xebf3('0x1c'),'color'],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]){_0x30c511[_0xebf3('0x58')][_0xebf3('0xd7')]={'$gte':_0x47c45b[_0xebf3('0x36')],'$lte':_0x47c45b['to']};}switch(_0x18ac83){case _0xebf3('0xc3'):_0x30c511[_0xebf3('0x77')][_0xebf3('0x5a')](_0xebf3('0xe4'),_0xebf3('0xe5'),_0xebf3('0xe6'),_0xebf3('0xe7'),_0xebf3('0xe8'),_0xebf3('0xe9'),'ratingType',_0xebf3('0xea'),_0xebf3('0xeb'));break;case _0xebf3('0xc2'):_0x30c511[_0xebf3('0x77')][_0xebf3('0x5a')](_0xebf3('0xec'),_0xebf3('0xed'));break;case _0xebf3('0xee'):_0x30c511['attributes'][_0xebf3('0x5a')](_0xebf3('0xef'),_0xebf3('0xf0'));break;}return db[_[_0xebf3('0xdc')](_0x18ac83)+'Interaction']['findAndCountAll'](_0x30c511)[_0xebf3('0x17')](function(_0x4fadc8){_0x2864a0[_0xebf3('0x12')]+=_0x4fadc8[_0xebf3('0x12')];return _[_0xebf3('0x7e')](_0x4fadc8[_0xebf3('0x98')],function(_0x543952){var _0x3e0077=_0x543952[_0xebf3('0x37')]({'plain':!![]});_0x3e0077[_0xebf3('0xc9')]=_0x18ac83;if(_0x3e0077[_0xebf3('0xf1')]){_0x3e0077[_0xebf3('0xf1')]={'id':_0x3e0077['Owner']['id'],'name':_0x3e0077['Owner'][_0xebf3('0x1c')],'fullname':_0x3e0077[_0xebf3('0xf1')]['fullname']};}return _0x3e0077;});});}});return Promise['all'](_0x39ac4d);})[_0xebf3('0x17')](function(_0x58486c){return _(_0x58486c)[_0xebf3('0xf2')]()[_0xebf3('0xf3')](_0xebf3('0xd7'))[_0xebf3('0xf4')]()[_0xebf3('0xf5')]();})[_0xebf3('0x17')](function(_0x581fa3){_0x2864a0[_0xebf3('0x98')]=_0x585a6a[_0xebf3('0x13')]?_0x581fa3[_0xebf3('0xf6')](_0x585a6a['offset'],_0x585a6a[_0xebf3('0x10')]+_0x585a6a[_0xebf3('0x13')]):_0x581fa3;return _0x2864a0;})[_0xebf3('0x17')](respondWithFilteredResult(_0x16c6b5,_0x585a6a))[_0xebf3('0x21')](handleError(_0x16c6b5,null));}; \ No newline at end of file +var _0xfee8=['toContactId','order','ContactId','merge','include','rows','getHopperHistories','includeAll','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','chmodSync','0777','child_process','../../components/import/cm/csv','binding_keys','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','import','User','agent','binding','fork','stringify','message','exit','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','chat','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','type','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','VoiceCallReport','fullname','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','externalUrl','threadId','startCase','Interaction','findAndCountAll','Owner','sortBy','reverse','value','slice','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','error','stack','name','send','index','describe','query','user','catch','CmContact','find','tags','length','keys','startsWith','cf_','columnName','displayName','analytics','findAll','alias','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','update','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','all','show','params','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','format','cf_%d','pickBy','map','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','intersection','model','attributes','fields','sort','pick','filters','filter','options','nolimit','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','PHONE','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfee8,0x6a));var _0x8fee=function(_0x4adad3,_0x202bba){_0x4adad3=_0x4adad3-0x0;var _0x52dae4=_0xfee8[_0x4adad3];return _0x52dae4;};'use strict';var moment=require(_0x8fee('0x0'));var BPromise=require('bluebird');var util=require(_0x8fee('0x1'));var path=require(_0x8fee('0x2'));var fs=require('fs');var _=require(_0x8fee('0x3'));var squel=require(_0x8fee('0x4'));var Papa=require(_0x8fee('0x5'));var Redis=require(_0x8fee('0x6'));var contacts=require(_0x8fee('0x7'));var qs=require(_0x8fee('0x8'));var logger=require(_0x8fee('0x9'))('api');var config=require(_0x8fee('0xa'));var shared=require(_0x8fee('0xb'));var db=require(_0x8fee('0xc'))['db'];config[_0x8fee('0xd')]=_[_0x8fee('0xe')](config[_0x8fee('0xd')],{'host':_0x8fee('0xf'),'port':0x18eb});var socket=require(_0x8fee('0x10'))(new Redis(config[_0x8fee('0xd')]));require(_0x8fee('0x11'))[_0x8fee('0x12')](socket);function respondWithResult(_0x898d9b,_0x1a817c){_0x1a817c=_0x1a817c||0xc8;return function(_0x9f8fa0){if(_0x9f8fa0){return _0x898d9b[_0x8fee('0x13')](_0x1a817c)[_0x8fee('0x14')](_0x9f8fa0);}};}function respondWithFilteredResult(_0x12d873,_0x5ca9c7){return function(_0x1c12ff){if(_0x1c12ff){var _0x1544ba=typeof _0x5ca9c7[_0x8fee('0x15')]==='undefined'&&typeof _0x5ca9c7[_0x8fee('0x16')]===_0x8fee('0x17');var _0x4b313d=_0x1c12ff[_0x8fee('0x18')];var _0x3e7619=_0x1544ba?0x0:_0x5ca9c7[_0x8fee('0x15')];var _0x47bf90=_0x1544ba?_0x1c12ff[_0x8fee('0x18')]:_0x5ca9c7[_0x8fee('0x15')]+_0x5ca9c7['limit'];var _0x135d18;if(_0x47bf90>=_0x4b313d){_0x47bf90=_0x4b313d;_0x135d18=0xc8;}else{_0x135d18=0xce;}_0x12d873[_0x8fee('0x13')](_0x135d18);return _0x12d873[_0x8fee('0x19')](_0x8fee('0x1a'),_0x3e7619+'-'+_0x47bf90+'/'+_0x4b313d)['json'](_0x1c12ff);}return null;};}function saveUpdates(_0x132c12){return function(_0x344bfa){if(_0x344bfa){return _0x344bfa['update'](_0x132c12)[_0x8fee('0x1b')](function(_0x34365f){return _0x34365f;});}return null;};}function removeEntity(_0x36507b){return function(_0x492280){if(_0x492280){return _0x492280[_0x8fee('0x1c')]()[_0x8fee('0x1b')](function(){_0x36507b[_0x8fee('0x13')](0xcc)[_0x8fee('0x1d')]();});}};}function handleEntityNotFound(_0xd9778a){return function(_0x163265){if(!_0x163265){_0xd9778a['sendStatus'](0x194);}return _0x163265;};}function handleError(_0x2945dc,_0xdf6552){_0xdf6552=_0xdf6552||0x1f4;return function(_0x305658){logger[_0x8fee('0x1e')](_0x305658[_0x8fee('0x1f')]);if(_0x305658[_0x8fee('0x20')]){delete _0x305658['name'];}_0x2945dc[_0x8fee('0x13')](_0xdf6552)[_0x8fee('0x21')](_0x305658);};}exports[_0x8fee('0x22')]=function(_0x4f5477,_0x9d40ed){var _0x1bb13e={};return contacts[_0x8fee('0x23')]()[_0x8fee('0x1b')](function(_0x7b97dc){_0x1bb13e=qs['getOptions'](_0x7b97dc,_0x4f5477);return contacts['findAll'](_0x4f5477[_0x8fee('0x24')],_0x4f5477[_0x8fee('0x25')],_0x1bb13e,_0x7b97dc);})[_0x8fee('0x1b')](respondWithFilteredResult(_0x9d40ed,_0x1bb13e))[_0x8fee('0x26')](handleError(_0x9d40ed,null));};exports[_0x8fee('0x1c')]=function(_0x5e7b5e,_0x4e1da8){return db[_0x8fee('0x27')][_0x8fee('0x28')]({'where':{'id':_0x5e7b5e['params']['id']}})[_0x8fee('0x1b')](handleEntityNotFound(_0x4e1da8,null))[_0x8fee('0x1b')](removeEntity(_0x4e1da8,null))['catch'](handleError(_0x4e1da8,null));};exports['describe']=function(_0x839cfc,_0x134779){return db[_0x8fee('0x27')]['describe']()['then'](function(_0x1a8b4a){delete _0x1a8b4a[_0x8fee('0x29')];for(var _0x4e15fd=0x0;_0x4e15fd0x0){return new Promise(function(_0x585c0c){var _0x2b76fd=[];for(var _0x56c531=0x0;_0x56c531<_0x50bee9[_0x8fee('0x2a')];_0x56c531++){_0x2b76fd[_0x8fee('0x60')](insertAdditionalPhones(_0x50bee9[_0x56c531]['contact'],_0x50bee9[_0x56c531][_0x8fee('0x5a')]));}Promise[_0x8fee('0x63')](_0x2b76fd)[_0x8fee('0x1b')](function(){_0x585c0c(0x1);});})[_0x8fee('0x1b')](function(){return{'success':_0x252154,'failure':_0x352190,'duplicates':_0x48b8fa};});}else{return{'success':_0x252154,'failure':_0x352190,'duplicates':_0x48b8fa};}}})[_0x8fee('0x1b')](respondWithResult(_0x18fb55,0xc9))['catch'](handleError(_0x18fb55,null));};exports[_0x8fee('0x64')]=function(_0x5b2895,_0x3715c6){var _0x169475;return db[_0x8fee('0x27')][_0x8fee('0x23')]()[_0x8fee('0x1b')](function(_0x88b638){return db['CmContact'][_0x8fee('0x28')]({'where':{'id':_0x5b2895[_0x8fee('0x65')]['id']},'include':[{'model':db[_0x8fee('0x66')],'as':_0x8fee('0x67'),'attributes':['id','name',_0x8fee('0x68')],'required':_0x5b2895[_0x8fee('0x24')][_0x8fee('0x69')]?!![]:![]},{'model':db[_0x8fee('0x4b')],'as':_0x8fee('0x6a'),'where':{'CmContactId':_0x5b2895[_0x8fee('0x65')]['id']},'required':![],'include':[{'model':db[_0x8fee('0x6b')],'as':_0x8fee('0x6c')}]}],'order':[db[_0x8fee('0x6d')][_0x8fee('0x6e')](_0x8fee('0x6f'))],'attributes':_[_0x8fee('0x2b')](_0x88b638)});})['then'](function(_0xb5346d){if(!_[_0x8fee('0x57')](_0xb5346d)){_0x169475=_0xb5346d[_0x8fee('0x38')]({'plain':!![]});var _0x4107e9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xb5346d&&_0xb5346d[_0x8fee('0x61')]){if(_0xb5346d[_0x8fee('0x61')]){_0x4107e9[_0x8fee('0x5e')][_0x8fee('0x70')][_0x8fee('0x60')]({'ListId':{'$ne':_0xb5346d['ListId']}});}}return db[_0x8fee('0x71')][_0x8fee('0x31')](_0x4107e9);}})[_0x8fee('0x1b')](function(_0x549e01){if(!_[_0x8fee('0x57')](_0x549e01)){return _[_0x8fee('0x72')](_0x169475,_['map'](_0x549e01,function(_0x5895af){return util[_0x8fee('0x73')](_0x8fee('0x74'),_0x5895af['id']);}));}})[_0x8fee('0x1b')](handleEntityNotFound(_0x3715c6,null))[_0x8fee('0x1b')](respondWithResult(_0x3715c6,null))['catch'](handleError(_0x3715c6,null));};exports[_0x8fee('0x43')]=function(_0x14271c,_0x1127be){var _0x4dba75;if(_0x14271c[_0x8fee('0x36')]['id']){delete _0x14271c[_0x8fee('0x36')]['id'];}if(!_[_0x8fee('0x57')](_0x14271c[_0x8fee('0x36')]['dialTimezone'])){var _0x170e7c=_0x14271c['body']['dialTimezone'];if(!_[_0x8fee('0x57')](shared[_0x8fee('0x58')][_0x170e7c]))_0x14271c[_0x8fee('0x36')][_0x8fee('0x59')]=shared[_0x8fee('0x58')][_0x170e7c][_0x8fee('0x59')];}return db[_0x8fee('0x27')][_0x8fee('0x28')]({'where':{'id':_0x14271c['params']['id']}})[_0x8fee('0x1b')](handleEntityNotFound(_0x1127be,null))[_0x8fee('0x1b')](saveUpdates(_0x14271c[_0x8fee('0x36')],null))[_0x8fee('0x1b')](function(_0x71956c){_0x4dba75=_0x71956c;var _0x2671fc={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x71956c&&_0x71956c[_0x8fee('0x61')]){if(_0x71956c[_0x8fee('0x61')]){_0x2671fc[_0x8fee('0x5e')]['$and'][_0x8fee('0x60')]({'ListId':{'$ne':_0x71956c[_0x8fee('0x61')]}});}}return db[_0x8fee('0x71')][_0x8fee('0x31')](_0x2671fc);})['then'](function(_0x19390e){if(_0x19390e){return _[_0x8fee('0x72')](_[_0x8fee('0x75')](_0x14271c['body'],function(_0x15442d,_0x3c2633){return _[_0x8fee('0x2c')](_0x3c2633,_0x8fee('0x2d'));}),_[_0x8fee('0x76')](_0x19390e,function(_0x244d48){return util[_0x8fee('0x73')](_0x8fee('0x74'),_0x244d48['id']);}));}})[_0x8fee('0x1b')](function(_0x31843f){if(_0x31843f&&!_[_0x8fee('0x77')](_0x31843f)){var _0x5885dc=squel[_0x8fee('0x43')]()[_0x8fee('0x78')](_0x8fee('0x79'))[_0x8fee('0x7a')](_0x31843f)[_0x8fee('0x5e')](_0x8fee('0x7b'),_0x14271c['params']['id'])[_0x8fee('0x7c')]();return db[_0x8fee('0x6d')][_0x8fee('0x24')](_0x5885dc[_0x8fee('0x7d')],{'replacements':_0x5885dc['values']});}})[_0x8fee('0x1b')](function(){if(_0x14271c[_0x8fee('0x36')][_0x8fee('0x7e')]&&_0x4dba75){return db[_0x8fee('0x3d')][_0x8fee('0x43')]({'phone':_0x14271c[_0x8fee('0x36')][_0x8fee('0x7e')],'OrderBy':0x0},{'where':{'ContactId':_0x4dba75['id']}});}})['then'](function(){return _0x4dba75;})[_0x8fee('0x1b')](respondWithResult(_0x1127be,null))[_0x8fee('0x26')](handleError(_0x1127be,null));};exports[_0x8fee('0x7f')]=function(_0x34c4dd,_0x510153){var _0x3cda57={};var _0xd3ad4c={};var _0x322372;var _0x31e524;return db[_0x8fee('0x27')][_0x8fee('0x80')]({'where':{'id':_0x34c4dd[_0x8fee('0x65')]['id']}})[_0x8fee('0x1b')](handleEntityNotFound(_0x510153,null))[_0x8fee('0x1b')](function(_0x56dc2e){if(_0x56dc2e){_0x322372=_0x56dc2e;_0xd3ad4c['model']=_[_0x8fee('0x2b')](db['Tag'][_0x8fee('0x81')]);_0xd3ad4c[_0x8fee('0x24')]=_[_0x8fee('0x2b')](_0x34c4dd['query']);_0xd3ad4c['filters']=_[_0x8fee('0x82')](_0xd3ad4c[_0x8fee('0x83')],_0xd3ad4c[_0x8fee('0x24')]);_0x3cda57[_0x8fee('0x84')]=_[_0x8fee('0x82')](_0xd3ad4c[_0x8fee('0x83')],qs[_0x8fee('0x85')](_0x34c4dd[_0x8fee('0x24')][_0x8fee('0x85')]));_0x3cda57['attributes']=_0x3cda57[_0x8fee('0x84')][_0x8fee('0x2a')]?_0x3cda57[_0x8fee('0x84')]:_0xd3ad4c[_0x8fee('0x83')];_0x3cda57['order']=qs[_0x8fee('0x86')](_0x34c4dd[_0x8fee('0x24')][_0x8fee('0x86')]);_0x3cda57[_0x8fee('0x5e')]=qs['filters'](_[_0x8fee('0x87')](_0x34c4dd[_0x8fee('0x24')],_0xd3ad4c[_0x8fee('0x88')]));if(_0x34c4dd['query']['filter']){_0x3cda57[_0x8fee('0x5e')]=_['merge'](_0x3cda57['where'],{'$or':_['map'](_0x3cda57[_0x8fee('0x84')],function(_0x28ef94){var _0x31988a={};_0x31988a[_0x28ef94]={'$like':'%'+_0x34c4dd['query'][_0x8fee('0x89')]+'%'};return _0x31988a;})});}_0x3cda57=_['merge']({},_0x3cda57,_0x34c4dd[_0x8fee('0x8a')]);return _0x322372['getTags'](_0x3cda57);}})[_0x8fee('0x1b')](function(_0x16a3dd){if(_0x16a3dd){_0x31e524=_0x16a3dd['length'];if(!_0x34c4dd['query']['hasOwnProperty'](_0x8fee('0x8b'))){_0x3cda57[_0x8fee('0x16')]=qs[_0x8fee('0x16')](_0x34c4dd[_0x8fee('0x24')][_0x8fee('0x16')]);_0x3cda57[_0x8fee('0x15')]=qs[_0x8fee('0x15')](_0x34c4dd['query'][_0x8fee('0x15')]);}return _0x322372[_0x8fee('0x7f')](_0x3cda57);}})[_0x8fee('0x1b')](function(_0x39e44e){if(_0x39e44e){return _0x39e44e?{'count':_0x31e524,'rows':_0x39e44e}:null;}})['then'](respondWithResult(_0x510153,null))[_0x8fee('0x26')](handleError(_0x510153,null));};exports['setTags']=function(_0x551e82,_0x2617a7){if(_0x551e82[_0x8fee('0x36')]['id']){delete _0x551e82[_0x8fee('0x36')]['id'];}return db['CmContact'][_0x8fee('0x80')]({'where':{'id':_0x551e82[_0x8fee('0x65')]['id']}})[_0x8fee('0x1b')](handleEntityNotFound(_0x2617a7,null))[_0x8fee('0x1b')](function(_0x57da26){if(_0x57da26){return _0x57da26['setTags'](_0x551e82[_0x8fee('0x36')][_0x8fee('0x8c')]||[]);}return null;})['then'](respondWithResult(_0x2617a7,null))['catch'](handleError(_0x2617a7,null));};exports[_0x8fee('0x8d')]=function(_0x4f3205,_0x35beb0){var _0x413829=[];_0x413829[_0x8fee('0x60')](addAdditionalPhones(_0x4f3205['body']));Promise['all'](_0x413829)['then'](function(){_0x413829=[];_0x413829[_0x8fee('0x60')](deleteCmHopperPhones(_0x4f3205['body']['id']));_0x413829[_0x8fee('0x60')](addCmHopperPhones(_0x4f3205[_0x8fee('0x36')]['id']));Promise[_0x8fee('0x63')](_0x413829)['then'](function(){return[0x1];})[_0x8fee('0x1b')](respondWithResult(_0x35beb0,null));});};function addAdditionalPhones(_0x5eada8){var _0xf90d98;return new Promise(function(_0xe6220a){return db[_0x8fee('0x4b')][_0x8fee('0x1c')]({'where':{'CmContactId':_0x5eada8['id']}})[_0x8fee('0x1b')](function(){db[_0x8fee('0x6b')][_0x8fee('0x31')]({'raw':!![],'attributes':['id',_0x8fee('0x8e')]})[_0x8fee('0x1b')](function(_0x45b615){var _0x3e0fee=[];for(var _0x46d75e=0x0;_0x46d75e<_0x5eada8[_0x8fee('0x8f')][_0x8fee('0x2a')];_0x46d75e++){var _0x469f1d=_0x5eada8['item_types']?_['isNil'](_0x5eada8[_0x8fee('0x90')][_0x46d75e])?'':_0x5eada8[_0x8fee('0x90')][_0x46d75e]:_0x5eada8[_0x8fee('0x8f')][_0x46d75e][_0x8fee('0x91')]?_0x5eada8[_0x8fee('0x8f')][_0x46d75e][_0x8fee('0x91')]:'';var _0x3e2b35=_['isNil'](_0x5eada8[_0x8fee('0x8f')][_0x46d75e][_0x8fee('0x92')])?'':_0x5eada8['items'][_0x46d75e][_0x8fee('0x92')];var _0x369978=_0x469f1d+':'+_0x5eada8[_0x8fee('0x8f')][_0x46d75e][_0x8fee('0x7e')]+'§'+_0x3e2b35;if(_[_0x8fee('0x57')](_0xf90d98))_0xf90d98=_0x369978;else _0xf90d98+=';'+_0x369978;var _0x281dcb=null;var _0x377c31=null;if(_0x5eada8[_0x8fee('0x90')]){if(!_[_0x8fee('0x57')](_0x5eada8[_0x8fee('0x90')][_0x46d75e])){_0x377c31=_['find'](_0x45b615,function(_0x15ebe6){return _0x15ebe6['id']===_0x5eada8[_0x8fee('0x90')][_0x46d75e];});if(!_[_0x8fee('0x57')](_0x377c31)){_0x281dcb=_0x377c31[_0x8fee('0x8e')];}}}else{if(!_[_0x8fee('0x57')](_0x5eada8[_0x8fee('0x8f')][_0x46d75e])){_0x377c31=_['find'](_0x45b615,function(_0x448cc2){return _0x448cc2['id']===_0x5eada8[_0x8fee('0x8f')][_0x46d75e][_0x8fee('0x91')];});if(!_[_0x8fee('0x57')](_0x377c31)){_0x281dcb=_0x46d75e;}}}if(_['isNil'](_0x281dcb)){_0x281dcb=0x64;}_0x3e0fee[_0x8fee('0x60')](addAdditionalPhone(_0x5eada8['id'],_0x5eada8[_0x8fee('0x8f')][_0x46d75e][_0x8fee('0x7e')],_0x5eada8[_0x8fee('0x90')]?_[_0x8fee('0x57')](_0x5eada8[_0x8fee('0x90')][_0x46d75e])?null:_0x5eada8[_0x8fee('0x90')][_0x46d75e]:_0x5eada8['items'][_0x46d75e][_0x8fee('0x91')]?_0x5eada8[_0x8fee('0x8f')][_0x46d75e][_0x8fee('0x91')]:null,_0x281dcb,_0x3e2b35));}Promise[_0x8fee('0x63')](_0x3e0fee)[_0x8fee('0x1b')](function(){db['CmContact']['update']({'AdditionalPhones':_0xf90d98},{'where':{'id':_0x5eada8['id']}})[_0x8fee('0x1b')](function(){_0xe6220a(0x1);});});});});});}function addAdditionalPhone(_0x2d24ae,_0x3788a6,_0x173eae,_0x5773dd,_0x2c011a){return db[_0x8fee('0x4b')][_0x8fee('0x28')]({'where':{'CmContactId':_0x2d24ae,'item':_0x3788a6}})[_0x8fee('0x1b')](function(_0x4b9752){if(_0x4b9752)logger[_0x8fee('0x3e')](_0x8fee('0x93'),_0x4b9752);else{db[_0x8fee('0x4b')]['create']({'CmContactId':_0x2d24ae,'item':_0x3788a6,'ItemTypeId':_0x173eae,'OrderBy':_0x5773dd,'ItemClass':'PHONE','description':_0x2c011a});}});}function deleteCmHopperPhones(_0x6a9a5a){return new Promise(function(_0x3cd0a6){return db[_0x8fee('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x6a9a5a}})[_0x8fee('0x1b')](function(_0x1e582c){db[_0x8fee('0x94')][_0x8fee('0x1c')]({'where':{'CmHopperId':{'$in':_[_0x8fee('0x76')](_0x1e582c,'id')}}});})[_0x8fee('0x1b')](function(){_0x3cd0a6(0x1);});});}function addCmHopperPhones(_0x24aff9){return new Promise(function(_0xa9efa7){return db[_0x8fee('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x24aff9}})[_0x8fee('0x1b')](function(_0x2e4d4b){var _0x3868df=[];_['map'](_0x2e4d4b,function(_0x30840f){_0x3868df[_0x8fee('0x60')](createCmHopperPhone(_0x24aff9,_0x30840f['id']));});Promise[_0x8fee('0x63')](_0x3868df)['then'](function(){_0xa9efa7(0x1);});});});}function createCmHopperPhone(_0x2f1633,_0x386df5){return new Promise(function(_0x3def64){db[_0x8fee('0x4b')]['findAll']({'raw':!![],'attributes':['item',_0x8fee('0x8e')],'where':{'CmContactId':_0x2f1633,'ItemClass':_0x8fee('0x95')},'include':[{'model':db[_0x8fee('0x6b')],'attributes':[_0x8fee('0x8e')],'as':_0x8fee('0x6c')}],'order':[_0x8fee('0x8e'),db[_0x8fee('0x6d')]['literal']('`ItemType`.OrderBy')]})[_0x8fee('0x1b')](function(_0x3501e6){var _0x5458d0=0x1;var _0x4432ee=_['map'](_0x3501e6,function(_0x29e096){_0x29e096[_0x8fee('0x96')]=_0x386df5;_0x29e096[_0x8fee('0x7e')]=_0x29e096[_0x8fee('0x97')];_0x29e096[_0x8fee('0x8e')]=_0x5458d0;delete _0x29e096[_0x8fee('0x98')];_0x5458d0=_0x5458d0+0x1;return _0x29e096;});return db[_0x8fee('0x94')][_0x8fee('0x5b')](_0x4432ee,{});})[_0x8fee('0x1b')](function(){_0x3def64(0x1);});});}function insertAdditionalPhones(_0x406cca,_0x83eda3){return new Promise(function(_0x2508f7){var _0x14c446=[];for(var _0x5a604b=0x0;_0x5a604b<_0x83eda3[_0x8fee('0x2a')];_0x5a604b++){var _0x5c3899=_0x83eda3[_0x5a604b];_0x14c446[_0x8fee('0x60')](parseContactItemType(_0x5c3899));}Promise[_0x8fee('0x63')](_0x14c446)[_0x8fee('0x1b')](function(){var _0x324a90={'id':_0x406cca['id'],'items':_0x83eda3};return addAdditionalPhones(_0x324a90)['then'](function(){return addCmHopperPhones(_0x406cca['id']);});})['then'](function(){_0x2508f7(_0x406cca);});});}function parseContactItemType(_0x6a5874){return new Promise(function(_0x5a2559){if(_0x6a5874['hasOwnProperty'](_0x8fee('0x91'))){_0x5a2559(_0x6a5874);}else{return db[_0x8fee('0x6b')][_0x8fee('0x28')]({'where':{'name':_0x6a5874['ItemType']}})[_0x8fee('0x1b')](function(_0x3d6c11){if(_['isNil'](_0x3d6c11))_0x6a5874[_0x8fee('0x91')]=null;else _0x6a5874[_0x8fee('0x91')]=_0x3d6c11['id'];_0x5a2559(_0x6a5874);});}});}exports[_0x8fee('0x99')]=function(_0x3a4890,_0x4dcd14){return db[_0x8fee('0x4b')][_0x8fee('0x31')]({'raw':!![],'where':{'CmContactId':_0x3a4890[_0x8fee('0x65')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x8fee('0x6b')],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x8fee('0x6d')]['literal'](_0x8fee('0x9a'))]]})['then'](function(_0x297f9b){return _0x297f9b;})[_0x8fee('0x1b')](respondWithResult(_0x4dcd14,null))[_0x8fee('0x26')](handleError(_0x4dcd14,null));};exports[_0x8fee('0x9b')]=function(_0x1b7887,_0x44f71f){return db['CmContactHasItem'][_0x8fee('0x31')]({'raw':!![],'where':{'CmContactId':_0x1b7887[_0x8fee('0x36')][_0x8fee('0x9c')]}})[_0x8fee('0x1b')](function(_0x1a46ad){var _0x1a5ff0=_[_0x8fee('0x76')](_0x1a46ad,function(_0x507ec8){_0x507ec8[_0x8fee('0x9d')]=_0x1b7887[_0x8fee('0x36')][_0x8fee('0x9e')];return _0x507ec8;});return db[_0x8fee('0x4b')][_0x8fee('0x5b')](_0x1a5ff0,{});})['then'](function(){return addCmHopperPhones(_0x1b7887[_0x8fee('0x36')][_0x8fee('0x9e')]);})[_0x8fee('0x1b')](function(){return['ok'];})[_0x8fee('0x1b')](respondWithResult(_0x44f71f,null))[_0x8fee('0x26')](handleError(_0x44f71f,null));};exports['rescheduleAdditionalPhones']=function(_0xd9c37d,_0x5ac64e){var _0x1fa767=[];_0x1fa767[_0x8fee('0x60')](createCmHopperPhone(_0xd9c37d[_0x8fee('0x36')]['id'],_0xd9c37d[_0x8fee('0x36')]['hopperId']));Promise[_0x8fee('0x63')](_0x1fa767)['then'](function(){return[0x1];})[_0x8fee('0x1b')](respondWithResult(_0x5ac64e,null));};exports['getHoppers']=function(_0x1c4f1d,_0x2db1ab){var _0x3a5457={'raw':![],'where':{}};var _0x31fa6a={};var _0x2108c2={'count':0x0,'rows':[]};return db[_0x8fee('0x27')][_0x8fee('0x80')]({'where':{'id':_0x1c4f1d[_0x8fee('0x65')]['id']}})[_0x8fee('0x1b')](handleEntityNotFound(_0x2db1ab,null))[_0x8fee('0x1b')](function(_0x3622f5){if(_0x3622f5){_0x31fa6a[_0x8fee('0x83')]=_['keys'](db['CmHopper'][_0x8fee('0x81')]);_0x31fa6a[_0x8fee('0x24')]=_['keys'](_0x1c4f1d[_0x8fee('0x24')]);_0x31fa6a['filters']=_[_0x8fee('0x82')](_0x31fa6a[_0x8fee('0x83')],_0x31fa6a[_0x8fee('0x24')]);_0x3a5457[_0x8fee('0x84')]=_[_0x8fee('0x82')](_0x31fa6a[_0x8fee('0x83')],qs[_0x8fee('0x85')](_0x1c4f1d[_0x8fee('0x24')][_0x8fee('0x85')]));_0x3a5457[_0x8fee('0x84')]=_0x3a5457[_0x8fee('0x84')][_0x8fee('0x2a')]?_0x3a5457['attributes']:_0x31fa6a[_0x8fee('0x83')];if(!_0x1c4f1d['query']['hasOwnProperty'](_0x8fee('0x8b'))){_0x3a5457[_0x8fee('0x16')]=qs[_0x8fee('0x16')](_0x1c4f1d[_0x8fee('0x24')]['limit']);_0x3a5457[_0x8fee('0x15')]=qs['offset'](_0x1c4f1d['query'][_0x8fee('0x15')]);}_0x3a5457[_0x8fee('0x9f')]=qs[_0x8fee('0x86')](_0x1c4f1d[_0x8fee('0x24')]['sort']);_0x3a5457[_0x8fee('0x5e')]=qs['filters'](_[_0x8fee('0x87')](_0x1c4f1d[_0x8fee('0x24')],_0x31fa6a[_0x8fee('0x88')]));_0x3a5457['where'][_0x8fee('0xa0')]=_0x3622f5['id'];if(_0x1c4f1d[_0x8fee('0x24')][_0x8fee('0x89')]){_0x3a5457[_0x8fee('0x5e')]=_['merge'](_0x3a5457[_0x8fee('0x5e')],{'$or':_['map'](_0x3a5457[_0x8fee('0x84')],function(_0x562c03){var _0x1a5ec4={};_0x1a5ec4[_0x562c03]={'$like':'%'+_0x1c4f1d[_0x8fee('0x24')]['filter']+'%'};return _0x1a5ec4;})});}_0x3a5457=_[_0x8fee('0xa1')]({},_0x3a5457,_0x1c4f1d[_0x8fee('0x8a')]);return db[_0x8fee('0x3d')][_0x8fee('0x18')]({'where':_0x3a5457[_0x8fee('0x5e')]})['then'](function(_0x2cbe84){_0x2108c2[_0x8fee('0x18')]=_0x2cbe84;if(_0x1c4f1d[_0x8fee('0x24')]['includeAll']){_0x3a5457[_0x8fee('0xa2')]=[{'all':!![]}];}return db[_0x8fee('0x3d')][_0x8fee('0x31')](_0x3a5457);})[_0x8fee('0x1b')](function(_0x37230d){_0x2108c2[_0x8fee('0xa3')]=_0x37230d;return _0x2108c2;});}})[_0x8fee('0x1b')](respondWithFilteredResult(_0x2db1ab,_0x3a5457))[_0x8fee('0x26')](handleError(_0x2db1ab,null));};exports[_0x8fee('0xa4')]=function(_0x4414cd,_0x1b570c){var _0x20a2fc={'raw':!![],'where':{}};var _0x4e1b8f={};var _0x2a6ea7={'count':0x0,'rows':[]};return db[_0x8fee('0x27')][_0x8fee('0x80')]({'where':{'id':_0x4414cd[_0x8fee('0x65')]['id']}})[_0x8fee('0x1b')](handleEntityNotFound(_0x1b570c,null))[_0x8fee('0x1b')](function(_0x5d0092){if(_0x5d0092){_0x4e1b8f[_0x8fee('0x83')]=_[_0x8fee('0x2b')](db[_0x8fee('0x4d')][_0x8fee('0x81')]);_0x4e1b8f[_0x8fee('0x24')]=_[_0x8fee('0x2b')](_0x4414cd[_0x8fee('0x24')]);_0x4e1b8f[_0x8fee('0x88')]=_[_0x8fee('0x82')](_0x4e1b8f[_0x8fee('0x83')],_0x4e1b8f[_0x8fee('0x24')]);_0x20a2fc[_0x8fee('0x84')]=_[_0x8fee('0x82')](_0x4e1b8f[_0x8fee('0x83')],qs[_0x8fee('0x85')](_0x4414cd[_0x8fee('0x24')][_0x8fee('0x85')]));_0x20a2fc[_0x8fee('0x84')]=_0x20a2fc[_0x8fee('0x84')][_0x8fee('0x2a')]?_0x20a2fc[_0x8fee('0x84')]:_0x4e1b8f[_0x8fee('0x83')];if(!_0x4414cd[_0x8fee('0x24')]['hasOwnProperty'](_0x8fee('0x8b'))){_0x20a2fc[_0x8fee('0x16')]=qs['limit'](_0x4414cd[_0x8fee('0x24')]['limit']);_0x20a2fc[_0x8fee('0x15')]=qs['offset'](_0x4414cd[_0x8fee('0x24')][_0x8fee('0x15')]);}_0x20a2fc['order']=qs['sort'](_0x4414cd['query']['sort']);_0x20a2fc['where']=qs[_0x8fee('0x88')](_[_0x8fee('0x87')](_0x4414cd[_0x8fee('0x24')],_0x4e1b8f['filters']));_0x20a2fc[_0x8fee('0x5e')][_0x8fee('0xa0')]=_0x5d0092['id'];if(_0x4414cd[_0x8fee('0x24')][_0x8fee('0x89')]){_0x20a2fc[_0x8fee('0x5e')]=_[_0x8fee('0xa1')](_0x20a2fc[_0x8fee('0x5e')],{'$or':_[_0x8fee('0x76')](_0x20a2fc[_0x8fee('0x84')],function(_0x3f76d0){var _0xf4aca8={};_0xf4aca8[_0x3f76d0]={'$like':'%'+_0x4414cd[_0x8fee('0x24')][_0x8fee('0x89')]+'%'};return _0xf4aca8;})});}_0x20a2fc=_[_0x8fee('0xa1')]({},_0x20a2fc,_0x4414cd[_0x8fee('0x8a')]);return db[_0x8fee('0x4d')]['count']({'where':_0x20a2fc[_0x8fee('0x5e')]})[_0x8fee('0x1b')](function(_0x242922){_0x2a6ea7[_0x8fee('0x18')]=_0x242922;if(_0x4414cd['query'][_0x8fee('0xa5')]){_0x20a2fc[_0x8fee('0xa2')]=[{'all':!![]}];}return db[_0x8fee('0x4d')][_0x8fee('0x31')](_0x20a2fc);})[_0x8fee('0x1b')](function(_0x35dbe3){_0x2a6ea7[_0x8fee('0xa3')]=_0x35dbe3;return _0x2a6ea7;});}})[_0x8fee('0x1b')](respondWithFilteredResult(_0x1b570c,_0x20a2fc))[_0x8fee('0x26')](handleError(_0x1b570c,null));};exports['getHopperFinals']=function(_0x4d7a27,_0x50e298){var _0x443cd9={'raw':!![],'where':{}};var _0x56627a={};var _0x446a68={'count':0x0,'rows':[]};return db[_0x8fee('0x27')]['findOne']({'where':{'id':_0x4d7a27[_0x8fee('0x65')]['id']}})['then'](handleEntityNotFound(_0x50e298,null))[_0x8fee('0x1b')](function(_0x4e0521){if(_0x4e0521){_0x56627a[_0x8fee('0x83')]=_['keys'](db[_0x8fee('0x4c')][_0x8fee('0x81')]);_0x56627a[_0x8fee('0x24')]=_[_0x8fee('0x2b')](_0x4d7a27[_0x8fee('0x24')]);_0x56627a[_0x8fee('0x88')]=_['intersection'](_0x56627a[_0x8fee('0x83')],_0x56627a[_0x8fee('0x24')]);_0x443cd9[_0x8fee('0x84')]=_['intersection'](_0x56627a[_0x8fee('0x83')],qs[_0x8fee('0x85')](_0x4d7a27[_0x8fee('0x24')][_0x8fee('0x85')]));_0x443cd9['attributes']=_0x443cd9[_0x8fee('0x84')]['length']?_0x443cd9[_0x8fee('0x84')]:_0x56627a['model'];if(!_0x4d7a27[_0x8fee('0x24')]['hasOwnProperty'](_0x8fee('0x8b'))){_0x443cd9['limit']=qs[_0x8fee('0x16')](_0x4d7a27[_0x8fee('0x24')]['limit']);_0x443cd9[_0x8fee('0x15')]=qs[_0x8fee('0x15')](_0x4d7a27['query'][_0x8fee('0x15')]);}_0x443cd9['order']=qs['sort'](_0x4d7a27[_0x8fee('0x24')][_0x8fee('0x86')]);_0x443cd9['where']=qs[_0x8fee('0x88')](_[_0x8fee('0x87')](_0x4d7a27[_0x8fee('0x24')],_0x56627a['filters']));_0x443cd9[_0x8fee('0x5e')][_0x8fee('0xa0')]=_0x4e0521['id'];if(_0x4d7a27[_0x8fee('0x24')]['filter']){_0x443cd9[_0x8fee('0x5e')]=_[_0x8fee('0xa1')](_0x443cd9['where'],{'$or':_[_0x8fee('0x76')](_0x443cd9['attributes'],function(_0x2b3fe0){var _0x361667={};_0x361667[_0x2b3fe0]={'$like':'%'+_0x4d7a27[_0x8fee('0x24')][_0x8fee('0x89')]+'%'};return _0x361667;})});}_0x443cd9=_[_0x8fee('0xa1')]({},_0x443cd9,_0x4d7a27['options']);return db[_0x8fee('0x4c')]['count']({'where':_0x443cd9['where']})[_0x8fee('0x1b')](function(_0x5f530e){_0x446a68['count']=_0x5f530e;if(_0x4d7a27['query'][_0x8fee('0xa5')]){_0x443cd9[_0x8fee('0xa2')]=[{'all':!![]}];}return db[_0x8fee('0x4c')][_0x8fee('0x31')](_0x443cd9);})[_0x8fee('0x1b')](function(_0x190159){_0x446a68[_0x8fee('0xa3')]=_0x190159;return _0x446a68;});}})[_0x8fee('0x1b')](respondWithFilteredResult(_0x50e298,_0x443cd9))['catch'](handleError(_0x50e298,null));};exports[_0x8fee('0xa6')]=function(_0x322772,_0x12b226){var _0x2677b9={'raw':!![],'where':{}};var _0x530164={};var _0x13260f={'count':0x0,'rows':[]};return db[_0x8fee('0x27')][_0x8fee('0x80')]({'where':{'id':_0x322772[_0x8fee('0x65')]['id']}})[_0x8fee('0x1b')](handleEntityNotFound(_0x12b226,null))[_0x8fee('0x1b')](function(_0x20fde3){if(_0x20fde3){_0x530164[_0x8fee('0x83')]=_[_0x8fee('0x2b')](db['JscriptySessionReport'][_0x8fee('0x81')]);_0x530164[_0x8fee('0x24')]=_[_0x8fee('0x2b')](_0x322772[_0x8fee('0x24')]);_0x530164[_0x8fee('0x88')]=_[_0x8fee('0x82')](_0x530164['model'],_0x530164[_0x8fee('0x24')]);_0x2677b9[_0x8fee('0x84')]=_[_0x8fee('0x82')](_0x530164[_0x8fee('0x83')],qs[_0x8fee('0x85')](_0x322772[_0x8fee('0x24')]['fields']));_0x2677b9['attributes']=_0x2677b9[_0x8fee('0x84')]['length']?_0x2677b9[_0x8fee('0x84')]:_0x530164[_0x8fee('0x83')];if(!_0x322772['query'][_0x8fee('0x35')](_0x8fee('0x8b'))){_0x2677b9[_0x8fee('0x16')]=qs[_0x8fee('0x16')](_0x322772[_0x8fee('0x24')][_0x8fee('0x16')]);_0x2677b9[_0x8fee('0x15')]=qs[_0x8fee('0x15')](_0x322772['query']['offset']);}_0x2677b9['order']=qs[_0x8fee('0x86')](_0x322772[_0x8fee('0x24')][_0x8fee('0x86')]);_0x2677b9[_0x8fee('0x5e')]=qs[_0x8fee('0x88')](_['pick'](_0x322772['query'],_0x530164['filters']));_0x2677b9[_0x8fee('0x5e')]['ContactId']=_0x20fde3['id'];if(_0x322772['query'][_0x8fee('0x89')]){_0x2677b9['where']=_[_0x8fee('0xa1')](_0x2677b9[_0x8fee('0x5e')],{'$or':_['map'](_0x2677b9[_0x8fee('0x84')],function(_0x41888c){var _0x1a3eec={};_0x1a3eec[_0x41888c]={'$like':'%'+_0x322772[_0x8fee('0x24')][_0x8fee('0x89')]+'%'};return _0x1a3eec;})});}_0x2677b9=_[_0x8fee('0xa1')]({},_0x2677b9,_0x322772[_0x8fee('0x8a')]);return db[_0x8fee('0x52')][_0x8fee('0x18')]({'where':_0x2677b9[_0x8fee('0x5e')]})['then'](function(_0x1d46bc){_0x13260f[_0x8fee('0x18')]=_0x1d46bc;if(_0x322772[_0x8fee('0x24')][_0x8fee('0xa5')]){_0x2677b9['include']=[{'all':!![]}];}return db[_0x8fee('0x52')][_0x8fee('0x31')](_0x2677b9);})[_0x8fee('0x1b')](function(_0x2f2dad){_0x13260f['rows']=_0x2f2dad;return _0x13260f;});}})['then'](respondWithFilteredResult(_0x12b226,_0x2677b9))[_0x8fee('0x26')](handleError(_0x12b226,null));};exports[_0x8fee('0xa7')]=function(_0x59699c,_0x4f0fb9){try{if(!_0x59699c[_0x8fee('0x36')][_0x8fee('0x61')]){throw new Error(_0x8fee('0xa8'));}if(!_0x59699c[_0x8fee('0x36')]['binding_keys']){throw new Error(_0x8fee('0xa9'));}if(!_0x59699c[_0x8fee('0x36')][_0x8fee('0xaa')]){throw new Error(_0x8fee('0xab'));}if(!_0x59699c[_0x8fee('0x36')]['socket_timestamp']){throw new Error(_0x8fee('0xac'));}var _0x36043c=_0x59699c[_0x8fee('0x36')]['binding_keys']['split'](',');var _0x3fdd00=_0x59699c[_0x8fee('0x36')][_0x8fee('0xaa')]['split'](',');if(!_0x36043c[_0x8fee('0x2a')]||!_0x3fdd00[_0x8fee('0x2a')]||_0x36043c[_0x8fee('0x2a')]!==_0x3fdd00[_0x8fee('0x2a')]){throw new Error(_0x8fee('0xad'));}_0x59699c[_0x8fee('0x36')][_0x8fee('0x85')]=_[_0x8fee('0xae')](_0x36043c,_0x3fdd00);if(!_0x59699c[_0x8fee('0x36')][_0x8fee('0x85')][_0x8fee('0x7e')]){throw new Error(_0x8fee('0xaf'));}if(!_0x59699c[_0x8fee('0x36')][_0x8fee('0x85')][_0x8fee('0xb0')]){throw new Error(_0x8fee('0xb1'));}var _0x5e8f22=path[_0x8fee('0x3b')](config[_0x8fee('0xb2')],_0x8fee('0xb3'),_0x59699c['file']['filename']);fs[_0x8fee('0xb4')](_0x5e8f22,parseInt(_0x8fee('0xb5'),0x8));var _0x3eebb8=require(_0x8fee('0xb6'))['fork'](path[_0x8fee('0x3b')](__dirname,_0x8fee('0xb7')),[_0x5e8f22,_0x59699c[_0x8fee('0x36')][_0x8fee('0xb8')],_0x59699c[_0x8fee('0x36')]['binding_values'],_0x59699c[_0x8fee('0x36')]['ListId'],_0x59699c[_0x8fee('0x36')]['CompanyId'],_0x59699c[_0x8fee('0x36')]['duplicates'],_0x59699c[_0x8fee('0x36')][_0x8fee('0xb9')]]);return _0x4f0fb9[_0x8fee('0x13')](0xc8)['json']({'message':_0x8fee('0xba'),'pid':_0x3eebb8[_0x8fee('0xbb')]});}catch(_0x2a231d){return _0x4f0fb9['status'](0x1f4)[_0x8fee('0x21')](_0x2a231d);}};exports[_0x8fee('0xbc')]=function(_0x30b005,_0x371ca2){var _0x30b057=fs[_0x8fee('0xbd')](_0x30b005[_0x8fee('0xbe')][_0x8fee('0x2')]);Papa[_0x8fee('0xbf')](_0x30b057,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1502ca){return _0x371ca2[_0x8fee('0x13')](0xc8)['json']({'file':_0x30b005['file'],'fields':_0x1502ca[_0x8fee('0xc0')][_0x8fee('0x85')]});}});};exports[_0x8fee('0xc1')]=function(_0x3b8c7f,_0x174886){return db[_0x8fee('0xc2')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x8fee('0xc3')}})[_0x8fee('0x1b')](function(_0x3ca8c2){var _0x21e3de=![];if(!_0x3b8c7f[_0x8fee('0x36')]['ListId']){throw new Error(_0x8fee('0xa8'));}if(!_0x3b8c7f[_0x8fee('0x36')][_0x8fee('0xc4')]['phone']){throw new Error(_0x8fee('0xaf'));}if(!_0x3b8c7f['body'][_0x8fee('0xc4')][_0x8fee('0xb0')]){throw new Error(_0x8fee('0xb1'));}if(!_0x3b8c7f[_0x8fee('0x36')][_0x8fee('0xb9')]){throw new Error(_0x8fee('0xac'));}var _0x45b52a=require('child_process')[_0x8fee('0xc5')](path[_0x8fee('0x3b')](__dirname,'../../components/import/cm/csv2'),[_0x3b8c7f[_0x8fee('0x65')]['id'],JSON[_0x8fee('0xc6')](_0x3b8c7f[_0x8fee('0x36')]),JSON[_0x8fee('0xc6')](_0x3ca8c2)]);_0x45b52a['on'](_0x8fee('0xc7'),function(){_0x21e3de=!![];return _0x174886[_0x8fee('0x13')](0xc8)[_0x8fee('0x14')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x45b52a[_0x8fee('0xbb')]});});_0x45b52a['on'](_0x8fee('0xc8'),function(_0x57a15c){if(_0x57a15c&&!_0x21e3de){return _0x174886[_0x8fee('0x13')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x45b52a[_0x8fee('0xbb')]});}});})['catch'](handleError(_0x174886,null));};exports['importUpdates']=function(_0x527e51,_0x396801){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x8fee('0xc3')}})[_0x8fee('0x1b')](function(_0x2c3a8c){var _0xb808ce=![];if(!_0x527e51[_0x8fee('0x36')][_0x8fee('0x61')]){throw new Error(_0x8fee('0xa8'));}if(!_0x527e51['body'][_0x8fee('0xc4')][_0x8fee('0x7e')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x527e51[_0x8fee('0x36')][_0x8fee('0xc4')][_0x8fee('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x527e51[_0x8fee('0x36')][_0x8fee('0xb9')]){throw new Error(_0x8fee('0xac'));}var _0x5e0c71=require(_0x8fee('0xb6'))[_0x8fee('0xc5')](path[_0x8fee('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x527e51[_0x8fee('0x65')]['id'],JSON[_0x8fee('0xc6')](_0x527e51['body']),JSON['stringify'](_0x2c3a8c)]);_0x5e0c71['on'](_0x8fee('0xc7'),function(){_0xb808ce=!![];return _0x396801[_0x8fee('0x13')](0xc8)[_0x8fee('0x14')]({'message':_0x8fee('0xc9'),'pid':_0x5e0c71[_0x8fee('0xbb')]});});_0x5e0c71['on'](_0x8fee('0xc8'),function(_0x5d9baa){if(_0x5d9baa&&!_0xb808ce){return _0x396801['status'](0x1f4)['json']({'message':_0x8fee('0xca'),'pid':_0x5e0c71['pid']});}});})[_0x8fee('0x26')](handleError(_0x396801,null));};exports[_0x8fee('0xcb')]=function(_0x50bbb9,_0x47712a){var _0x2fe5a1=['mail',_0x8fee('0xcc'),_0x8fee('0xcd'),_0x8fee('0xce'),_0x8fee('0xcf'),_0x8fee('0xd0'),'voice'];var _0x3c00ff={'offset':0x0,'order':qs[_0x8fee('0x86')](_0x8fee('0xd1'))},_0x4fe9d2={'count':0x0,'rows':[]};Promise[_0x8fee('0xd2')]()[_0x8fee('0x1b')](function(){if(_0x50bbb9[_0x8fee('0x24')][_0x8fee('0xd3')]){if(!_[_0x8fee('0xd4')](_0x2fe5a1,_0x50bbb9[_0x8fee('0x24')][_0x8fee('0xd3')][_0x8fee('0xd5')]())){throw new Error('Invalid\x20channel');}_0x2fe5a1=[_0x50bbb9[_0x8fee('0x24')][_0x8fee('0xd3')][_0x8fee('0xd5')]()];}if(_0x50bbb9[_0x8fee('0x24')][_0x8fee('0xd6')]){try{var _0x503f35=JSON['parse'](_0x50bbb9['query'][_0x8fee('0xd6')]);if(!moment(_0x503f35[_0x8fee('0x37')])[_0x8fee('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x503f35['to'])['isValid']()){throw new Error(_0x8fee('0xd8'));}}catch(_0x559bc9){throw new Error(_0x8fee('0xd9'));}}if(!_0x50bbb9[_0x8fee('0x24')][_0x8fee('0x35')](_0x8fee('0x8b'))){_0x3c00ff[_0x8fee('0x16')]=qs[_0x8fee('0x16')](_0x50bbb9[_0x8fee('0x24')][_0x8fee('0x16')]||0xa);_0x3c00ff[_0x8fee('0x15')]=qs[_0x8fee('0x15')](_0x50bbb9[_0x8fee('0x24')][_0x8fee('0x15')]);}var _0x2d8c7e=_0x2fe5a1[_0x8fee('0x76')](function(_0x494e74){if(_0x494e74===_0x8fee('0xda')){var _0x4b995e={'attributes':['id',_0x8fee('0xdb'),_0x8fee('0xdc'),_0x8fee('0xdd'),_0x8fee('0xde'),_0x8fee('0xdf'),_0x8fee('0xe0'),_0x8fee('0xe1'),'duration',_0x8fee('0xe2'),_0x8fee('0xe3'),_0x8fee('0xe4'),_0x8fee('0xe5'),_0x8fee('0xe6'),_0x8fee('0xe7')],'where':{'ContactId':_0x50bbb9['params']['id']},'include':[{'model':db[_0x8fee('0xc2')],'as':_0x8fee('0xc2'),'attributes':['id',_0x8fee('0x20'),'fullname','alias']}],'order':[[_0x8fee('0xe3'),_0x8fee('0xe8')]]};if(_0x50bbb9[_0x8fee('0x24')][_0x8fee('0xd6')]){_0x4b995e[_0x8fee('0x5e')][_0x8fee('0xe3')]={'$gte':_0x503f35['from'],'$lte':_0x503f35['to']};}return db[_0x8fee('0xe9')]['findAndCountAll'](_0x4b995e)[_0x8fee('0x1b')](function(_0x48014b){_0x4fe9d2[_0x8fee('0x18')]+=_0x48014b[_0x8fee('0x18')];return _['map'](_0x48014b[_0x8fee('0xa3')],function(_0x5e0c0d){var _0x3225eb=_0x5e0c0d[_0x8fee('0x38')]({'plain':!![]});_0x3225eb['channel']=_0x494e74;if(_0x3225eb[_0x8fee('0xc2')]){_0x3225eb['User']={'id':_0x3225eb['User']['id'],'name':_0x3225eb[_0x8fee('0xc2')][_0x8fee('0x20')],'fullname':_0x3225eb[_0x8fee('0xc2')][_0x8fee('0xea')],'alias':_0x3225eb[_0x8fee('0xc2')][_0x8fee('0x32')]};}return _0x3225eb;});});}else{var _0x10003d=_['startCase'](_0x494e74)+(_0x494e74===_0x8fee('0xcc')?_0x8fee('0xeb'):'Account');var _0x44ddd2={'attributes':['id',_0x8fee('0xec'),_0x8fee('0xed'),_0x8fee('0xe3'),_0x8fee('0xe2'),_0x8fee('0xee'),_0x8fee('0xef'),_0x8fee('0xf0'),_0x8fee('0xe7'),_0x10003d+'Id'],'where':{'ContactId':_0x50bbb9[_0x8fee('0x65')]['id']},'include':[{'model':db[_0x10003d],'as':_0x8fee('0xf1'),'attributes':['id',_0x8fee('0x20'),_0x8fee('0xf2')]},{'model':db[_0x8fee('0xc2')],'as':'Owner','attributes':['id',_0x8fee('0x20'),_0x8fee('0xea')]},{'model':db[_0x8fee('0x66')],'as':'Tags','attributes':['id',_0x8fee('0x20'),_0x8fee('0x68')],'through':{'attributes':[]}}],'order':[['createdAt',_0x8fee('0xe8')]]};if(_0x50bbb9[_0x8fee('0x24')][_0x8fee('0xd6')]){_0x44ddd2[_0x8fee('0x5e')][_0x8fee('0xe3')]={'$gte':_0x503f35[_0x8fee('0x37')],'$lte':_0x503f35['to']};}switch(_0x494e74){case'chat':_0x44ddd2['attributes']['push'](_0x8fee('0xf3'),_0x8fee('0xf4'),_0x8fee('0xf5'),'deviceModel',_0x8fee('0xf6'),_0x8fee('0xf7'),_0x8fee('0xf8'),_0x8fee('0xf9'),_0x8fee('0xfa'));break;case _0x8fee('0xfb'):_0x44ddd2['attributes']['push'](_0x8fee('0xfc'),_0x8fee('0xfd'));break;case _0x8fee('0xce'):_0x44ddd2[_0x8fee('0x84')]['push'](_0x8fee('0xfe'),_0x8fee('0xff'));break;}return db[_[_0x8fee('0x100')](_0x494e74)+_0x8fee('0x101')][_0x8fee('0x102')](_0x44ddd2)['then'](function(_0x2f4b29){_0x4fe9d2['count']+=_0x2f4b29['count'];return _['map'](_0x2f4b29[_0x8fee('0xa3')],function(_0x333e28){var _0x1d80e5=_0x333e28[_0x8fee('0x38')]({'plain':!![]});_0x1d80e5[_0x8fee('0xd3')]=_0x494e74;if(_0x1d80e5[_0x8fee('0x103')]){_0x1d80e5[_0x8fee('0x103')]={'id':_0x1d80e5[_0x8fee('0x103')]['id'],'name':_0x1d80e5[_0x8fee('0x103')]['name'],'fullname':_0x1d80e5['Owner']['fullname']};}return _0x1d80e5;});});}});return Promise[_0x8fee('0x63')](_0x2d8c7e);})[_0x8fee('0x1b')](function(_0x435b5b){return _(_0x435b5b)['flatten']()[_0x8fee('0x104')](_0x8fee('0xe3'))[_0x8fee('0x105')]()[_0x8fee('0x106')]();})[_0x8fee('0x1b')](function(_0x4937d4){_0x4fe9d2['rows']=_0x3c00ff[_0x8fee('0x16')]?_0x4937d4[_0x8fee('0x107')](_0x3c00ff[_0x8fee('0x15')],_0x3c00ff[_0x8fee('0x15')]+_0x3c00ff['limit']):_0x4937d4;return _0x4fe9d2;})[_0x8fee('0x1b')](respondWithFilteredResult(_0x47712a,_0x3c00ff))['catch'](handleError(_0x47712a,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index ad75704..430114b 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80c3=['events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4b33bf,_0x2654f9){var _0x46fa97=function(_0x44e4f0){while(--_0x44e4f0){_0x4b33bf['push'](_0x4b33bf['shift']());}};_0x46fa97(++_0x2654f9);}(_0x80c3,0x1e6));var _0x380c=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x80c3[_0x336376];return _0x1d2a8e;};'use strict';var EventEmitter=require(_0x380c('0x0'));var CmContact=require(_0x380c('0x1'))['db'][_0x380c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x380c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x380c('0x4'),'afterDestroy':_0x380c('0x5')};function emitEvent(_0xd88c27){return function(_0x29f3b1,_0x24ff82,_0x2f9131){CmContactEvents[_0x380c('0x6')](_0xd88c27+':'+_0x29f3b1['id'],_0x29f3b1);CmContactEvents[_0x380c('0x6')](_0xd88c27,_0x29f3b1);_0x2f9131(null);};}for(var e in events){if(events[_0x380c('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x380c('0x8')]=CmContactEvents; \ No newline at end of file +var _0x6fca=['hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','update','emit'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0x6fca,0xb3));var _0xa6fc=function(_0x196138,_0x49e7eb){_0x196138=_0x196138-0x0;var _0x564081=_0x6fca[_0x196138];return _0x564081;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xa6fc('0x0'))['db'][_0xa6fc('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa6fc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6fc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c308a){return function(_0xcfa3a4,_0x31b32e,_0x5c4c26){CmContactEvents[_0xa6fc('0x4')](_0x3c308a+':'+_0xcfa3a4['id'],_0xcfa3a4);CmContactEvents['emit'](_0x3c308a,_0xcfa3a4);_0x5c4c26(null);};}for(var e in events){if(events[_0xa6fc('0x5')](e)){var event=events[e];CmContact[_0xa6fc('0x6')](e,emitEvent(event));}}module[_0xa6fc('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0238623..ea0ff44 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2174=['CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','findAll','outbound','CmList','Lists','ListId','map','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','email','utf8mb4','utf8mb4_unicode_ci','models','error','catch','message','get','isEmpty','length','destroy','ContactId','[CmContact][afterDestroy][Succesfull]','inspect','lodash','util','api','moment','./cmContact.attributes','Campaign','VoiceQueue','isNil','dialTimezone','findOne','then','resolve','utcOffset','scheduledat','minutes','format','YYYY-MM-DD\x20HH:mm:ss','phone','priority','callbackUniqueid','assign'];(function(_0x517eef,_0x213a63){var _0x2ef919=function(_0x401322){while(--_0x401322){_0x517eef['push'](_0x517eef['shift']());}};_0x2ef919(++_0x213a63);}(_0x2174,0x121));var _0x4217=function(_0x3503c2,_0x43699b){_0x3503c2=_0x3503c2-0x0;var _0x59ec02=_0x2174[_0x3503c2];return _0x59ec02;};'use strict';var _=require(_0x4217('0x0'));var util=require(_0x4217('0x1'));var logger=require('../../config/logger')(_0x4217('0x2'));var moment=require(_0x4217('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x4217('0x4'));function getTimezoneCallbackAt(_0x2fc7a6,_0x28523a,_0x1c7048,_0x4e59c3){var _0x401609=_0x4e59c3?_0x4217('0x5'):_0x4217('0x6');var _0x56bf01=_0x1c7048['scheduledat']?_0x1c7048['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x4217('0x7')](_0x1c7048[_0x4217('0x8')])){return Promise['resolve'](_0x56bf01);}return _0x2fc7a6[_0x401609][_0x4217('0x9')]({'where':{'id':_0x28523a}})[_0x4217('0xa')](function(_0x30d758){if(_[_0x4217('0x7')](_0x30d758)||_[_0x4217('0x7')](_0x30d758['dialTimezone'])){return Promise[_0x4217('0xb')](_0x56bf01);}var _0x75b857=shared['timezones'];var _0x5a2204=_0x75b857[_0x30d758[_0x4217('0x8')]];var _0x2ae12d=_0x75b857[_0x1c7048['dialTimezone']];if(_[_0x4217('0x7')](_0x5a2204)&&_[_0x4217('0x7')](_0x2ae12d)){return Promise[_0x4217('0xb')](_0x56bf01);}var _0x1e64af=_0x5a2204[_0x4217('0xc')]-_0x2ae12d[_0x4217('0xc')];var _0x2fd26a=_0x1c7048[_0x4217('0xd')]?_0x1c7048[_0x4217('0xd')]:moment();_0x56bf01=moment(_0x2fd26a)['add'](_0x1e64af,_0x4217('0xe'))[_0x4217('0xf')](_0x4217('0x10'));return Promise[_0x4217('0xb')](_0x56bf01);});}function getNewHopperPayload(_0x568548){return{'phone':_0x568548[_0x4217('0x11')],'ContactId':_0x568548['id'],'ListId':_0x568548['ListId'],'scheduledat':_0x568548[_0x4217('0xd')]?_0x568548[_0x4217('0xd')]:moment()['format'](_0x4217('0x10')),'priority':_0x568548[_0x4217('0x12')]?_0x568548[_0x4217('0x12')]:0x2,'callback':_0x568548[_0x4217('0x13')]?!![]:![],'callbackuniqueid':_0x568548[_0x4217('0x13')]?_0x568548[_0x4217('0x13')]:undefined,'callbackat':_0x568548[_0x4217('0x13')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x4f3671,_0x5062e1,_0x284357,_0x303d49){var _0x306740={'phone':_0x284357['phone']};var _0x553459={'calleridnum':_0x284357[_0x4217('0x11')]};if(_0x303d49){Object['assign'](_0x306740,{'CampaignId':_0x5062e1['id']});Object[_0x4217('0x14')](_0x553459,{'CampaignId':_0x5062e1['id']});}else{Object[_0x4217('0x14')](_0x306740,{'VoiceQueueId':_0x5062e1['id']});Object[_0x4217('0x14')](_0x553459,{'VoiceQueueId':_0x5062e1['id']});}return _0x4f3671[_0x4217('0x15')][_0x4217('0x9')]({'where':_0x306740})[_0x4217('0xa')](function(_0x2d8b9a){if(_0x2d8b9a){throw new Error(_0x4217('0x16')+_0x284357[_0x4217('0x11')]+_0x4217('0x17')+_0x5062e1['id']);}return _0x4f3671[_0x4217('0x18')][_0x4217('0x9')]({'where':_0x553459});})['then'](function(_0x208cfc){if(_0x208cfc){throw new Error(_0x4217('0x19')+_0x284357[_0x4217('0x11')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5062e1['id']);}var _0xedda27=getNewHopperPayload(_0x284357);if(_0x303d49){_0xedda27[_0x4217('0x1a')]=_0x5062e1['id'];}else{_0xedda27['VoiceQueueId']=_0x5062e1['id'];}return _0x4f3671[_0x4217('0x15')][_0x4217('0x1b')](_0xedda27);});}function handleOnlyIfOpenCheckDuplicate(_0x2a8248,_0x49e60d,_0x36fa2f,_0x14c490){var _0x2592e9={'phone':_0x36fa2f[_0x4217('0x11')]};if(_0x14c490){Object[_0x4217('0x14')](_0x2592e9,{'CampaignId':_0x49e60d['id']});}else{Object[_0x4217('0x14')](_0x2592e9,{'VoiceQueueId':_0x49e60d['id']});}return _0x2a8248[_0x4217('0x15')]['findOne']({'where':_0x2592e9})[_0x4217('0xa')](function(_0x384031){if(_0x384031){throw new Error(_0x4217('0x1c')+_0x36fa2f['phone']+_0x4217('0x17')+_0x49e60d['id']);}var _0x39cd25=getNewHopperPayload(_0x36fa2f);if(_0x14c490){_0x39cd25[_0x4217('0x1a')]=_0x49e60d['id'];}else{_0x39cd25[_0x4217('0x1d')]=_0x49e60d['id'];}return _0x2a8248[_0x4217('0x15')][_0x4217('0x1b')](_0x39cd25);});}function handleNeverCheckDuplicate(_0x323242,_0x6007ea,_0x1360b2){var _0x39c7e0=getNewHopperPayload(_0x1360b2);_0x39c7e0[_0x4217('0x1d')]=_0x6007ea['id'];return _0x323242['CmHopper']['create'](_0x39c7e0);}function handleCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7){return getTimezoneCallbackAt(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7)[_0x4217('0xa')](function(_0x4ec76c){_0x9846af['scheduledat']=_0x4ec76c;switch(_0x29d44d[_0x4217('0x1e')]){case _0x4217('0x1f'):return handleAlwaysCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7);default:return handleNeverCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af);}});}function createHopperForVoiceQueues(_0x50b586,_0xa0ff9f){return _0x50b586[_0x4217('0x6')][_0x4217('0x20')]({'where':{'type':_0x4217('0x21')},'attributes':['id','dialCheckDuplicateType',_0x4217('0x8')],'include':[{'model':_0x50b586[_0x4217('0x22')],'as':_0x4217('0x23'),'where':{'id':_0xa0ff9f[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x20d3fa){var _0x5a5d83=_0x20d3fa[_0x4217('0x25')](function(_0x562f5d){return handleCheckDuplicate(_0x50b586,_0x562f5d,_0xa0ff9f,![]);});return Promise[_0x4217('0x26')](_0x5a5d83);});}function createHopperForCampaigns(_0x24f2ba,_0x5dc7b3){return _0x24f2ba[_0x4217('0x5')]['findAll']({'attributes':['id',_0x4217('0x1e'),_0x4217('0x8')],'include':[{'model':_0x24f2ba[_0x4217('0x22')],'as':_0x4217('0x23'),'where':{'id':_0x5dc7b3[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x5a7984){var _0x5d1a7e=_0x5a7984[_0x4217('0x25')](function(_0x5abda5){return handleCheckDuplicate(_0x24f2ba,_0x5abda5,_0x5dc7b3,!![]);});return Promise[_0x4217('0x26')](_0x5d1a7e);});}function createHopperBlackForVoiceQueues(_0x258ea8,_0x31833f){return _0x258ea8[_0x4217('0x6')][_0x4217('0x20')]({'where':{'type':_0x4217('0x21')},'attributes':['id'],'include':[{'model':_0x258ea8[_0x4217('0x22')],'as':_0x4217('0x27'),'where':{'id':_0x31833f[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x43bd88){var _0xedfbd3=_0x43bd88[_0x4217('0x25')](function(_0x5d088b){return _0x258ea8[_0x4217('0x28')]['create']({'phone':_0x31833f[_0x4217('0x11')],'ContactId':_0x31833f['id'],'ListId':_0x31833f[_0x4217('0x24')],'VoiceQueueId':_0x5d088b['id']});});return Promise[_0x4217('0x26')](_0xedfbd3);});}function createHopperBlackForCampaigns(_0x4d4fa5,_0x3ff089){return _0x4d4fa5['Campaign'][_0x4217('0x20')]({'attributes':['id'],'include':[{'model':_0x4d4fa5['CmList'],'as':'BlackLists','where':{'id':_0x3ff089[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x1950a1){var _0x1ef8e9=_0x1950a1[_0x4217('0x25')](function(_0x1630f0){return _0x4d4fa5[_0x4217('0x28')]['create']({'phone':_0x3ff089['phone'],'ContactId':_0x3ff089['id'],'ListId':_0x3ff089[_0x4217('0x24')],'CampaignId':_0x1630f0['id']});});return Promise[_0x4217('0x26')](_0x1ef8e9);});}module[_0x4217('0x29')]=function(_0xc9a00c){return _0xc9a00c[_0x4217('0x2a')](_0x4217('0x2b'),attributes,{'tableName':_0x4217('0x2c'),'paranoid':!![],'indexes':[{'name':_0x4217('0x11'),'fields':[_0x4217('0x11')]},{'name':_0x4217('0x2d'),'fields':[_0x4217('0x2e'),_0x4217('0x2f'),'phone','mobile','fax',_0x4217('0x30')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x4217('0x31'),'collate':_0x4217('0x32'),'hooks':{'afterCreate':function(_0x5100f8,_0xf785b3,_0x1b0c60){var _0x56a217=_0xc9a00c[_0x4217('0x33')];var _0x20e164=_0x5100f8['get']({'plain':!![]});if(!_0x20e164[_0x4217('0x24')]){logger[_0x4217('0x34')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x20e164['id']);return _0x1b0c60();}if(!_0x20e164[_0x4217('0x11')]){return _0x1b0c60();}return createHopperForVoiceQueues(_0x56a217,_0x20e164)[_0x4217('0xa')](function(){return createHopperBlackForVoiceQueues(_0x56a217,_0x20e164);})['then'](function(){return createHopperForCampaigns(_0x56a217,_0x20e164);})[_0x4217('0xa')](function(){return createHopperBlackForCampaigns(_0x56a217,_0x20e164);})['then'](function(){return _0x1b0c60();})[_0x4217('0x35')](function(_0x492ed8){logger[_0x4217('0x34')]('[cmContact][afterCreate]',_0x492ed8[_0x4217('0x36')]);_0x1b0c60();});},'afterDestroy':function(_0x23bc7b,_0x32bea9,_0x1f9457){var _0x59dfbe=_0xc9a00c['models'];var _0x429680=_0x23bc7b[_0x4217('0x37')]({'plain':!![]});return _0x59dfbe[_0x4217('0x15')][_0x4217('0x20')]({'raw':!![],'where':{'ListId':_0x429680[_0x4217('0x24')],'ContactId':_0x429680['id']}})['then'](function(_0x5b5347){if(!_[_0x4217('0x38')](_0x5b5347)){var _0x412e4e=[];for(var _0xd9acda=0x0;_0xd9acda<_0x5b5347[_0x4217('0x39')];_0xd9acda+=0x1){var _0x495881=_0x59dfbe[_0x4217('0x15')][_0x4217('0x3a')]({'where':{'ListId':_0x5b5347[_0xd9acda][_0x4217('0x24')],'ContactId':_0x5b5347[_0xd9acda][_0x4217('0x3b')],'VoiceQueueId':_0x5b5347[_0xd9acda][_0x4217('0x1d')],'CampaignId':_0x5b5347[_0xd9acda][_0x4217('0x1a')]}});_0x412e4e['push'](_0x495881);}return Promise[_0x4217('0x26')](_0x412e4e);}})[_0x4217('0xa')](function(_0x232e43){logger['info'](_0x4217('0x3c'),util[_0x4217('0x3d')](_0x232e43,{'showHidden':![],'depth':null}));_0x1f9457();})['catch'](function(_0x3db7da){logger[_0x4217('0x34')]('[CmContact][afterDestroy][Error]',util[_0x4217('0x3d')](_0x3db7da,{'showHidden':![],'depth':null}));_0x1f9457(_0x3db7da);});}}});}; \ No newline at end of file +var _0x225d=['findOne','then','utcOffset','add','minutes','ListId','priority','callbackUniqueid','phone','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','onlyIfOpen','outbound','CmList','Lists','map','all','findAll','BlackLists','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','message','models','get','destroy','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','catch','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x225d,0x14f));var _0xd225=function(_0xb86c38,_0x1759d4){_0xb86c38=_0xb86c38-0x0;var _0x26512e=_0x225d[_0xb86c38];return _0x26512e;};'use strict';var _=require(_0xd225('0x0'));var util=require(_0xd225('0x1'));var logger=require(_0xd225('0x2'))(_0xd225('0x3'));var moment=require(_0xd225('0x4'));var shared=require(_0xd225('0x5'));var attributes=require(_0xd225('0x6'));function getTimezoneCallbackAt(_0x576dfe,_0x3dbaa1,_0x1d4d49,_0x40bee1){var _0x48abb8=_0x40bee1?_0xd225('0x7'):_0xd225('0x8');var _0x298791=_0x1d4d49['scheduledat']?_0x1d4d49[_0xd225('0x9')]:moment()[_0xd225('0xa')](_0xd225('0xb'));if(_[_0xd225('0xc')](_0x1d4d49[_0xd225('0xd')])){return Promise[_0xd225('0xe')](_0x298791);}return _0x576dfe[_0x48abb8][_0xd225('0xf')]({'where':{'id':_0x3dbaa1}})[_0xd225('0x10')](function(_0x14f695){if(_[_0xd225('0xc')](_0x14f695)||_[_0xd225('0xc')](_0x14f695[_0xd225('0xd')])){return Promise['resolve'](_0x298791);}var _0x1c687a=shared['timezones'];var _0x332c9f=_0x1c687a[_0x14f695[_0xd225('0xd')]];var _0x9281bc=_0x1c687a[_0x1d4d49[_0xd225('0xd')]];if(_[_0xd225('0xc')](_0x332c9f)&&_['isNil'](_0x9281bc)){return Promise[_0xd225('0xe')](_0x298791);}var _0x349d9d=_0x332c9f[_0xd225('0x11')]-_0x9281bc[_0xd225('0x11')];var _0x3b7567=_0x1d4d49['scheduledat']?_0x1d4d49[_0xd225('0x9')]:moment();_0x298791=moment(_0x3b7567)[_0xd225('0x12')](_0x349d9d,_0xd225('0x13'))['format'](_0xd225('0xb'));return Promise[_0xd225('0xe')](_0x298791);});}function getNewHopperPayload(_0xd46dd4){return{'phone':_0xd46dd4['phone'],'ContactId':_0xd46dd4['id'],'ListId':_0xd46dd4[_0xd225('0x14')],'scheduledat':_0xd46dd4['scheduledat']?_0xd46dd4[_0xd225('0x9')]:moment()[_0xd225('0xa')](_0xd225('0xb')),'priority':_0xd46dd4[_0xd225('0x15')]?_0xd46dd4[_0xd225('0x15')]:0x2,'callback':_0xd46dd4[_0xd225('0x16')]?!![]:![],'callbackuniqueid':_0xd46dd4[_0xd225('0x16')]?_0xd46dd4[_0xd225('0x16')]:undefined,'callbackat':_0xd46dd4[_0xd225('0x16')]?moment()[_0xd225('0xa')](_0xd225('0xb')):undefined};}function handleAlwaysCheckDuplicate(_0x214965,_0x107972,_0x3a194b,_0x28be74){var _0x3b000f={'phone':_0x3a194b[_0xd225('0x17')]};var _0x19d009={'calleridnum':_0x3a194b[_0xd225('0x17')]};if(_0x28be74){Object[_0xd225('0x18')](_0x3b000f,{'CampaignId':_0x107972['id']});Object[_0xd225('0x18')](_0x19d009,{'CampaignId':_0x107972['id']});}else{Object[_0xd225('0x18')](_0x3b000f,{'VoiceQueueId':_0x107972['id']});Object['assign'](_0x19d009,{'VoiceQueueId':_0x107972['id']});}return _0x214965[_0xd225('0x19')][_0xd225('0xf')]({'where':_0x3b000f})['then'](function(_0x33e337){if(_0x33e337){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x3a194b[_0xd225('0x17')]+_0xd225('0x1a')+_0x107972['id']);}return _0x214965[_0xd225('0x1b')]['findOne']({'where':_0x19d009});})['then'](function(_0x1f5f79){if(_0x1f5f79){throw new Error(_0xd225('0x1c')+_0x3a194b[_0xd225('0x17')]+_0xd225('0x1a')+_0x107972['id']);}var _0x404a75=getNewHopperPayload(_0x3a194b);if(_0x28be74){_0x404a75['CampaignId']=_0x107972['id'];}else{_0x404a75['VoiceQueueId']=_0x107972['id'];}return _0x214965[_0xd225('0x19')][_0xd225('0x1d')](_0x404a75);});}function handleOnlyIfOpenCheckDuplicate(_0x23e590,_0x5e2fc3,_0x362842,_0x3b12c9){var _0x4f445d={'phone':_0x362842['phone']};if(_0x3b12c9){Object[_0xd225('0x18')](_0x4f445d,{'CampaignId':_0x5e2fc3['id']});}else{Object['assign'](_0x4f445d,{'VoiceQueueId':_0x5e2fc3['id']});}return _0x23e590[_0xd225('0x19')][_0xd225('0xf')]({'where':_0x4f445d})['then'](function(_0x2d7b97){if(_0x2d7b97){throw new Error(_0xd225('0x1e')+_0x362842[_0xd225('0x17')]+_0xd225('0x1a')+_0x5e2fc3['id']);}var _0x401977=getNewHopperPayload(_0x362842);if(_0x3b12c9){_0x401977['CampaignId']=_0x5e2fc3['id'];}else{_0x401977[_0xd225('0x1f')]=_0x5e2fc3['id'];}return _0x23e590[_0xd225('0x19')][_0xd225('0x1d')](_0x401977);});}function handleNeverCheckDuplicate(_0x152090,_0x143c04,_0x1a0dde){var _0x2ec8a3=getNewHopperPayload(_0x1a0dde);_0x2ec8a3[_0xd225('0x1f')]=_0x143c04['id'];return _0x152090[_0xd225('0x19')][_0xd225('0x1d')](_0x2ec8a3);}function handleCheckDuplicate(_0x179d30,_0x575693,_0x420fe9,_0x35e6dd){return getTimezoneCallbackAt(_0x179d30,_0x575693,_0x420fe9,_0x35e6dd)[_0xd225('0x10')](function(_0x3d04a1){_0x420fe9[_0xd225('0x9')]=_0x3d04a1;switch(_0x575693[_0xd225('0x20')]){case _0xd225('0x21'):return handleAlwaysCheckDuplicate(_0x179d30,_0x575693,_0x420fe9,_0x35e6dd);case _0xd225('0x22'):return handleOnlyIfOpenCheckDuplicate(_0x179d30,_0x575693,_0x420fe9,_0x35e6dd);default:return handleNeverCheckDuplicate(_0x179d30,_0x575693,_0x420fe9);}});}function createHopperForVoiceQueues(_0x75e1f7,_0xe4098b){return _0x75e1f7[_0xd225('0x8')]['findAll']({'where':{'type':_0xd225('0x23')},'attributes':['id',_0xd225('0x20'),_0xd225('0xd')],'include':[{'model':_0x75e1f7[_0xd225('0x24')],'as':_0xd225('0x25'),'where':{'id':_0xe4098b[_0xd225('0x14')]}}],'raw':!![]})[_0xd225('0x10')](function(_0x51ecf9){var _0xc65295=_0x51ecf9[_0xd225('0x26')](function(_0x3edd62){return handleCheckDuplicate(_0x75e1f7,_0x3edd62,_0xe4098b,![]);});return Promise['all'](_0xc65295);});}function createHopperForCampaigns(_0x2b6682,_0x4d9488){return _0x2b6682[_0xd225('0x7')]['findAll']({'attributes':['id','dialCheckDuplicateType',_0xd225('0xd')],'include':[{'model':_0x2b6682['CmList'],'as':_0xd225('0x25'),'where':{'id':_0x4d9488[_0xd225('0x14')]}}],'raw':!![]})['then'](function(_0x13a303){var _0x590710=_0x13a303[_0xd225('0x26')](function(_0x41d5c5){return handleCheckDuplicate(_0x2b6682,_0x41d5c5,_0x4d9488,!![]);});return Promise[_0xd225('0x27')](_0x590710);});}function createHopperBlackForVoiceQueues(_0x370d3f,_0x191e25){return _0x370d3f[_0xd225('0x8')][_0xd225('0x28')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x370d3f['CmList'],'as':_0xd225('0x29'),'where':{'id':_0x191e25[_0xd225('0x14')]}}],'raw':!![]})[_0xd225('0x10')](function(_0x51666a){var _0x5e224b=_0x51666a[_0xd225('0x26')](function(_0x21404d){return _0x370d3f['CmHopperBlack'][_0xd225('0x1d')]({'phone':_0x191e25[_0xd225('0x17')],'ContactId':_0x191e25['id'],'ListId':_0x191e25[_0xd225('0x14')],'VoiceQueueId':_0x21404d['id']});});return Promise['all'](_0x5e224b);});}function createHopperBlackForCampaigns(_0x20c1a4,_0xbe5566){return _0x20c1a4['Campaign'][_0xd225('0x28')]({'attributes':['id'],'include':[{'model':_0x20c1a4[_0xd225('0x24')],'as':_0xd225('0x29'),'where':{'id':_0xbe5566[_0xd225('0x14')]}}],'raw':!![]})[_0xd225('0x10')](function(_0x219eaa){var _0x4ea8c0=_0x219eaa[_0xd225('0x26')](function(_0x4e6c01){return _0x20c1a4['CmHopperBlack']['create']({'phone':_0xbe5566[_0xd225('0x17')],'ContactId':_0xbe5566['id'],'ListId':_0xbe5566['ListId'],'CampaignId':_0x4e6c01['id']});});return Promise[_0xd225('0x27')](_0x4ea8c0);});}module[_0xd225('0x2a')]=function(_0x4d8d2e){return _0x4d8d2e[_0xd225('0x2b')](_0xd225('0x2c'),attributes,{'tableName':_0xd225('0x2d'),'paranoid':!![],'indexes':[{'name':_0xd225('0x17'),'fields':['phone']},{'name':_0xd225('0x2e'),'fields':[_0xd225('0x2f'),_0xd225('0x30'),'phone',_0xd225('0x31'),_0xd225('0x32'),_0xd225('0x33')],'type':_0xd225('0x34')}],'timestamps':!![],'charset':_0xd225('0x35'),'collate':_0xd225('0x36'),'hooks':{'afterCreate':function(_0x597d7c,_0x4d3665,_0x4d30ca){var _0x3a6019=_0x4d8d2e['models'];var _0x2c2cb0=_0x597d7c['get']({'plain':!![]});if(!_0x2c2cb0[_0xd225('0x14')]){logger[_0xd225('0x37')](_0xd225('0x38')+_0x2c2cb0['id']);return _0x4d30ca();}if(!_0x2c2cb0[_0xd225('0x17')]){return _0x4d30ca();}return createHopperForVoiceQueues(_0x3a6019,_0x2c2cb0)[_0xd225('0x10')](function(){return createHopperBlackForVoiceQueues(_0x3a6019,_0x2c2cb0);})[_0xd225('0x10')](function(){return createHopperForCampaigns(_0x3a6019,_0x2c2cb0);})[_0xd225('0x10')](function(){return createHopperBlackForCampaigns(_0x3a6019,_0x2c2cb0);})['then'](function(){return _0x4d30ca();})['catch'](function(_0x2ec74c){logger[_0xd225('0x37')](_0xd225('0x39'),_0x2ec74c[_0xd225('0x3a')]);_0x4d30ca();});},'afterDestroy':function(_0x40fe49,_0x43a9cb,_0x579c2a){var _0xaa78f1=_0x4d8d2e[_0xd225('0x3b')];var _0x20afc7=_0x40fe49[_0xd225('0x3c')]({'plain':!![]});return _0xaa78f1[_0xd225('0x19')][_0xd225('0x28')]({'raw':!![],'where':{'ListId':_0x20afc7[_0xd225('0x14')],'ContactId':_0x20afc7['id']}})[_0xd225('0x10')](function(_0x4e7109){if(!_['isEmpty'](_0x4e7109)){var _0xe991f4=[];for(var _0x15064d=0x0;_0x15064d<_0x4e7109['length'];_0x15064d+=0x1){var _0x1e9e90=_0xaa78f1[_0xd225('0x19')][_0xd225('0x3d')]({'where':{'ListId':_0x4e7109[_0x15064d][_0xd225('0x14')],'ContactId':_0x4e7109[_0x15064d][_0xd225('0x3e')],'VoiceQueueId':_0x4e7109[_0x15064d][_0xd225('0x1f')],'CampaignId':_0x4e7109[_0x15064d][_0xd225('0x3f')]}});_0xe991f4[_0xd225('0x40')](_0x1e9e90);}return Promise[_0xd225('0x27')](_0xe991f4);}})[_0xd225('0x10')](function(_0x22c41c){logger[_0xd225('0x41')](_0xd225('0x42'),util[_0xd225('0x43')](_0x22c41c,{'showHidden':![],'depth':null}));_0x579c2a();})[_0xd225('0x44')](function(_0x160cc0){logger[_0xd225('0x37')](_0xd225('0x45'),util['inspect'](_0x160cc0,{'showHidden':![],'depth':null}));_0x579c2a(_0x160cc0);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 40fd83e..fc3ac14 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0xd54939,_0xa5da1b){var _0x1447fc=function(_0x19c1fe){while(--_0x19c1fe){_0xd54939['push'](_0xd54939['shift']());}};_0x1447fc(++_0xa5da1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index de1fe36..e17f998 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40ca=['PHONE','sequelize','STRING','INTEGER'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x40ca,0x1a1));var _0xa40c=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x40ca[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xa40c('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa40c('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa40c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa40c('0x1')],'defaultValue':_0xa40c('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xa40c('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x37a4=['INTEGER','STRING','PHONE','sequelize'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x37a4,0xcb));var _0x437a=function(_0x4218d7,_0x54a0f7){_0x4218d7=_0x4218d7-0x0;var _0xb38ecb=_0x37a4[_0x4218d7];return _0xb38ecb;};'use strict';var Sequelize=require(_0x437a('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x437a('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x437a('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x437a('0x2')],'defaultValue':_0x437a('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 7cedfc4..3b92f8d 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a68=['get','CmContactHasItems','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a68,0x127));var _0x89a6=function(_0x533db0,_0x5685c5){_0x533db0=_0x533db0-0x0;var _0x5d8e1f=_0x9a68[_0x533db0];return _0x5d8e1f;};'use strict';var emlformat=require(_0x89a6('0x0'));var rimraf=require(_0x89a6('0x1'));var zipdir=require(_0x89a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89a6('0x3'));var moment=require('moment');var BPromise=require(_0x89a6('0x4'));var Mustache=require(_0x89a6('0x5'));var util=require(_0x89a6('0x6'));var path=require('path');var sox=require(_0x89a6('0x7'));var csv=require('to-csv');var ejs=require(_0x89a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89a6('0x9'));var squel=require(_0x89a6('0xa'));var crypto=require(_0x89a6('0xb'));var jsforce=require(_0x89a6('0xc'));var deskjs=require(_0x89a6('0xd'));var toCsv=require(_0x89a6('0xe'));var querystring=require(_0x89a6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89a6('0x10'));var qs=require(_0x89a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89a6('0x12'));var logger=require(_0x89a6('0x13'))('api');var utils=require(_0x89a6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a5a76,_0x26745a){_0x26745a=_0x26745a||0xcc;return function(_0x158c2e){if(_0x158c2e){return _0x5a5a76[_0x89a6('0x15')](_0x26745a);}return _0x5a5a76[_0x89a6('0x16')](_0x26745a)[_0x89a6('0x17')]();};}function respondWithResult(_0x5a0731,_0x5411b6){_0x5411b6=_0x5411b6||0xc8;return function(_0x70e845){if(_0x70e845){return _0x5a0731[_0x89a6('0x16')](_0x5411b6)[_0x89a6('0x18')](_0x70e845);}};}function respondWithFilteredResult(_0x108a95,_0x30429f){return function(_0x387fee){if(_0x387fee){var _0x452cba=typeof _0x30429f['offset']===_0x89a6('0x19')&&typeof _0x30429f[_0x89a6('0x1a')]===_0x89a6('0x19');var _0x4a20b0=_0x387fee[_0x89a6('0x1b')];var _0x588e66=_0x452cba?0x0:_0x30429f['offset'];var _0x20fde7=_0x452cba?_0x387fee[_0x89a6('0x1b')]:_0x30429f[_0x89a6('0x1c')]+_0x30429f[_0x89a6('0x1a')];var _0x3663e6;if(_0x20fde7>=_0x4a20b0){_0x20fde7=_0x4a20b0;_0x3663e6=0xc8;}else{_0x3663e6=0xce;}_0x108a95[_0x89a6('0x16')](_0x3663e6);return _0x108a95[_0x89a6('0x1d')](_0x89a6('0x1e'),_0x588e66+'-'+_0x20fde7+'/'+_0x4a20b0)['json'](_0x387fee);}return null;};}function patchUpdates(_0x45ddc3){return function(_0x2b8b62){try{jsonpatch[_0x89a6('0x1f')](_0x2b8b62,_0x45ddc3,!![]);}catch(_0x3a8a56){return BPromise[_0x89a6('0x20')](_0x3a8a56);}return _0x2b8b62[_0x89a6('0x21')]();};}function saveUpdates(_0x43e125,_0x26d27f){return function(_0x5e76c4){if(_0x5e76c4){return _0x5e76c4[_0x89a6('0x22')](_0x43e125)[_0x89a6('0x23')](function(_0x395bd7){return _0x395bd7;});}return null;};}function removeEntity(_0x168398,_0x3a6f0a){return function(_0x55f1b7){if(_0x55f1b7){return _0x55f1b7[_0x89a6('0x24')]()[_0x89a6('0x23')](function(){var _0x5807ff=_0x55f1b7[_0x89a6('0x25')]({'plain':!![]});var _0x321d4d=_0x89a6('0x26');return db['UserProfileResource'][_0x89a6('0x24')]({'where':{'type':_0x321d4d,'resourceId':_0x5807ff['id']}})['then'](function(){return _0x55f1b7;});})[_0x89a6('0x23')](function(){_0x168398[_0x89a6('0x16')](0xcc)[_0x89a6('0x17')]();});}};}function handleEntityNotFound(_0x7314fb,_0x52f4a9){return function(_0x5e192c){if(!_0x5e192c){_0x7314fb[_0x89a6('0x15')](0x194);}return _0x5e192c;};}function handleError(_0x302d20,_0x49c21e){_0x49c21e=_0x49c21e||0x1f4;return function(_0x3ffb9f){logger[_0x89a6('0x27')](_0x3ffb9f[_0x89a6('0x28')]);if(_0x3ffb9f[_0x89a6('0x29')]){delete _0x3ffb9f[_0x89a6('0x29')];}_0x302d20['status'](_0x49c21e)[_0x89a6('0x2a')](_0x3ffb9f);};}exports['index']=function(_0x3e0df8,_0x977a5c){var _0x193feb={},_0x5ad477={},_0x2c3a9b={'count':0x0,'rows':[]};var _0x3fcd5c=_[_0x89a6('0x2b')](db[_0x89a6('0x2c')][_0x89a6('0x2d')],function(_0x66b6ad){return{'name':_0x66b6ad[_0x89a6('0x2e')],'type':_0x66b6ad[_0x89a6('0x2f')][_0x89a6('0x30')]};});_0x5ad477[_0x89a6('0x31')]=_['map'](_0x3fcd5c,'name');_0x5ad477[_0x89a6('0x32')]=_[_0x89a6('0x33')](_0x3e0df8[_0x89a6('0x32')]);_0x5ad477[_0x89a6('0x34')]=_['intersection'](_0x5ad477[_0x89a6('0x31')],_0x5ad477[_0x89a6('0x32')]);_0x193feb[_0x89a6('0x35')]=_[_0x89a6('0x36')](_0x5ad477[_0x89a6('0x31')],qs['fields'](_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x37')]));_0x193feb['attributes']=_0x193feb['attributes'][_0x89a6('0x38')]?_0x193feb[_0x89a6('0x35')]:_0x5ad477[_0x89a6('0x31')];if(!_0x3e0df8['query'][_0x89a6('0x39')](_0x89a6('0x3a'))){_0x193feb[_0x89a6('0x1a')]=qs[_0x89a6('0x1a')](_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x1a')]);_0x193feb[_0x89a6('0x1c')]=qs[_0x89a6('0x1c')](_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x1c')]);}_0x193feb[_0x89a6('0x3b')]=qs['sort'](_0x3e0df8[_0x89a6('0x32')]['sort']);_0x193feb[_0x89a6('0x3c')]=qs[_0x89a6('0x34')](_[_0x89a6('0x3d')](_0x3e0df8[_0x89a6('0x32')],_0x5ad477[_0x89a6('0x34')]),_0x3fcd5c);if(_0x3e0df8['query'][_0x89a6('0x3e')]){_0x193feb[_0x89a6('0x3c')]=_['merge'](_0x193feb['where'],{'$or':_[_0x89a6('0x2b')](_0x3fcd5c,function(_0x45e007){if(_0x45e007['type']!==_0x89a6('0x3f')){var _0x2f5342={};_0x2f5342[_0x45e007['name']]={'$like':'%'+_0x3e0df8[_0x89a6('0x32')]['filter']+'%'};return _0x2f5342;}})});}_0x193feb=_[_0x89a6('0x40')]({},_0x193feb,_0x3e0df8['options']);var _0x26c557={'where':_0x193feb[_0x89a6('0x3c')]};return db['CmContactHasItem'][_0x89a6('0x1b')](_0x26c557)[_0x89a6('0x23')](function(_0x2567cd){_0x2c3a9b[_0x89a6('0x1b')]=_0x2567cd;if(_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x41')]){_0x193feb[_0x89a6('0x42')]=[{'all':!![]}];}return db[_0x89a6('0x2c')][_0x89a6('0x43')](_0x193feb);})[_0x89a6('0x23')](function(_0x353ad5){_0x2c3a9b[_0x89a6('0x44')]=_0x353ad5;return _0x2c3a9b;})[_0x89a6('0x23')](respondWithFilteredResult(_0x977a5c,_0x193feb))[_0x89a6('0x45')](handleError(_0x977a5c,null));};exports[_0x89a6('0x46')]=function(_0x28ad8a,_0x23a56d){var _0x18ca68={'raw':!![],'where':{'id':_0x28ad8a[_0x89a6('0x47')]['id']}},_0x4e8820={};_0x4e8820[_0x89a6('0x31')]=_[_0x89a6('0x33')](db['CmContactHasItem'][_0x89a6('0x2d')]);_0x4e8820[_0x89a6('0x32')]=_[_0x89a6('0x33')](_0x28ad8a[_0x89a6('0x32')]);_0x4e8820[_0x89a6('0x34')]=_[_0x89a6('0x36')](_0x4e8820['model'],_0x4e8820[_0x89a6('0x32')]);_0x18ca68[_0x89a6('0x35')]=_[_0x89a6('0x36')](_0x4e8820['model'],qs[_0x89a6('0x37')](_0x28ad8a[_0x89a6('0x32')][_0x89a6('0x37')]));_0x18ca68[_0x89a6('0x35')]=_0x18ca68[_0x89a6('0x35')]['length']?_0x18ca68['attributes']:_0x4e8820[_0x89a6('0x31')];if(_0x28ad8a['query'][_0x89a6('0x41')]){_0x18ca68['include']=[{'all':!![]}];}_0x18ca68=_[_0x89a6('0x40')]({},_0x18ca68,_0x28ad8a[_0x89a6('0x48')]);return db['CmContactHasItem'][_0x89a6('0x49')](_0x18ca68)[_0x89a6('0x23')](handleEntityNotFound(_0x23a56d,null))[_0x89a6('0x23')](respondWithResult(_0x23a56d,null))[_0x89a6('0x45')](handleError(_0x23a56d,null));};exports[_0x89a6('0x4a')]=function(_0xbdd893,_0x48a85d){return db['CmContactHasItem'][_0x89a6('0x4a')](_0xbdd893[_0x89a6('0x4b')],{})[_0x89a6('0x23')](function(_0x110b5a){var _0x46a4bf=_0xbdd893[_0x89a6('0x4c')][_0x89a6('0x25')]({'plain':!![]});if(!_0x46a4bf)throw new Error(_0x89a6('0x4d'));if(_0x46a4bf[_0x89a6('0x4e')]===_0x89a6('0x4c')){var _0x355420=_0x110b5a[_0x89a6('0x25')]({'plain':!![]});var _0x2bc0f2=_0x89a6('0x26');return db[_0x89a6('0x4f')][_0x89a6('0x49')]({'where':{'name':_0x2bc0f2,'userProfileId':_0x46a4bf[_0x89a6('0x50')]},'raw':!![]})[_0x89a6('0x23')](function(_0x49628e){if(_0x49628e&&_0x49628e['autoAssociation']===0x0){return db[_0x89a6('0x51')][_0x89a6('0x4a')]({'name':_0x355420[_0x89a6('0x29')],'resourceId':_0x355420['id'],'type':_0x49628e[_0x89a6('0x29')],'sectionId':_0x49628e['id']},{})[_0x89a6('0x23')](function(){return _0x110b5a;});}else{return _0x110b5a;}})[_0x89a6('0x45')](function(_0x187223){logger[_0x89a6('0x27')](_0x89a6('0x52'),_0x187223);throw _0x187223;});}return _0x110b5a;})[_0x89a6('0x23')](respondWithResult(_0x48a85d,0xc9))['catch'](handleError(_0x48a85d,null));};exports[_0x89a6('0x22')]=function(_0x4d43ae,_0x4bae0a){if(_0x4d43ae[_0x89a6('0x4b')]['id']){delete _0x4d43ae[_0x89a6('0x4b')]['id'];}return db[_0x89a6('0x2c')][_0x89a6('0x49')]({'where':{'id':_0x4d43ae[_0x89a6('0x47')]['id']}})[_0x89a6('0x23')](handleEntityNotFound(_0x4bae0a,null))[_0x89a6('0x23')](saveUpdates(_0x4d43ae[_0x89a6('0x4b')],null))[_0x89a6('0x23')](respondWithResult(_0x4bae0a,null))[_0x89a6('0x45')](handleError(_0x4bae0a,null));};exports[_0x89a6('0x24')]=function(_0x2b3e30,_0x1ce68f){return db[_0x89a6('0x2c')]['find']({'where':{'id':_0x2b3e30[_0x89a6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ce68f,null))[_0x89a6('0x23')](removeEntity(_0x1ce68f,null))[_0x89a6('0x45')](handleError(_0x1ce68f,null));}; \ No newline at end of file +var _0x3ad4=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1f8b97,_0x1e98f5){var _0x1e77d2=function(_0x30f412){while(--_0x30f412){_0x1f8b97['push'](_0x1f8b97['shift']());}};_0x1e77d2(++_0x1e98f5);}(_0x3ad4,0x138));var _0x43ad=function(_0x1bb11e,_0x58fd78){_0x1bb11e=_0x1bb11e-0x0;var _0x422492=_0x3ad4[_0x1bb11e];return _0x422492;};'use strict';var emlformat=require(_0x43ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43ad('0x1'));var jsonpatch=require(_0x43ad('0x2'));var rp=require('request-promise');var moment=require(_0x43ad('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x43ad('0x4'));var sox=require(_0x43ad('0x5'));var csv=require('to-csv');var ejs=require(_0x43ad('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43ad('0x7'));var squel=require(_0x43ad('0x8'));var crypto=require(_0x43ad('0x9'));var jsforce=require(_0x43ad('0xa'));var deskjs=require(_0x43ad('0xb'));var toCsv=require(_0x43ad('0xc'));var querystring=require('querystring');var Papa=require(_0x43ad('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43ad('0xe'));var as=require(_0x43ad('0xf'));var hardwareService=require(_0x43ad('0x10'));var logger=require(_0x43ad('0x11'))(_0x43ad('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x43ad('0x13'));var db=require(_0x43ad('0x14'))['db'];function respondWithStatusCode(_0x550e85,_0x57f0db){_0x57f0db=_0x57f0db||0xcc;return function(_0x5dcfb6){if(_0x5dcfb6){return _0x550e85[_0x43ad('0x15')](_0x57f0db);}return _0x550e85[_0x43ad('0x16')](_0x57f0db)[_0x43ad('0x17')]();};}function respondWithResult(_0xd79869,_0x2125fb){_0x2125fb=_0x2125fb||0xc8;return function(_0x3efdc0){if(_0x3efdc0){return _0xd79869[_0x43ad('0x16')](_0x2125fb)['json'](_0x3efdc0);}};}function respondWithFilteredResult(_0x5a85d0,_0x5d2be7){return function(_0x21877f){if(_0x21877f){var _0x21e219=typeof _0x5d2be7[_0x43ad('0x18')]===_0x43ad('0x19')&&typeof _0x5d2be7[_0x43ad('0x1a')]===_0x43ad('0x19');var _0x5762f4=_0x21877f[_0x43ad('0x1b')];var _0x3898ae=_0x21e219?0x0:_0x5d2be7['offset'];var _0x3fce13=_0x21e219?_0x21877f[_0x43ad('0x1b')]:_0x5d2be7[_0x43ad('0x18')]+_0x5d2be7[_0x43ad('0x1a')];var _0x5770f3;if(_0x3fce13>=_0x5762f4){_0x3fce13=_0x5762f4;_0x5770f3=0xc8;}else{_0x5770f3=0xce;}_0x5a85d0[_0x43ad('0x16')](_0x5770f3);return _0x5a85d0[_0x43ad('0x1c')]('Content-Range',_0x3898ae+'-'+_0x3fce13+'/'+_0x5762f4)[_0x43ad('0x1d')](_0x21877f);}return null;};}function patchUpdates(_0x19c7cd){return function(_0x57cf57){try{jsonpatch[_0x43ad('0x1e')](_0x57cf57,_0x19c7cd,!![]);}catch(_0x11bb25){return BPromise[_0x43ad('0x1f')](_0x11bb25);}return _0x57cf57['save']();};}function saveUpdates(_0x366c28,_0x1696a7){return function(_0x4703e7){if(_0x4703e7){return _0x4703e7['update'](_0x366c28)[_0x43ad('0x20')](function(_0xb4180d){return _0xb4180d;});}return null;};}function removeEntity(_0x403278,_0x3c88d0){return function(_0x2561e0){if(_0x2561e0){return _0x2561e0[_0x43ad('0x21')]()[_0x43ad('0x20')](function(){var _0x4bd1ef=_0x2561e0[_0x43ad('0x22')]({'plain':!![]});var _0x4cb33b=_0x43ad('0x23');return db[_0x43ad('0x24')]['destroy']({'where':{'type':_0x4cb33b,'resourceId':_0x4bd1ef['id']}})[_0x43ad('0x20')](function(){return _0x2561e0;});})['then'](function(){_0x403278[_0x43ad('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bcf06,_0xce736){return function(_0x1de583){if(!_0x1de583){_0x2bcf06['sendStatus'](0x194);}return _0x1de583;};}function handleError(_0x3c9b4e,_0x59786d){_0x59786d=_0x59786d||0x1f4;return function(_0x4b0887){logger[_0x43ad('0x25')](_0x4b0887[_0x43ad('0x26')]);if(_0x4b0887[_0x43ad('0x27')]){delete _0x4b0887[_0x43ad('0x27')];}_0x3c9b4e[_0x43ad('0x16')](_0x59786d)[_0x43ad('0x28')](_0x4b0887);};}exports[_0x43ad('0x29')]=function(_0x228b93,_0x4de9da){var _0x246f7b={},_0x36881e={},_0x267a60={'count':0x0,'rows':[]};var _0x37bdb8=_[_0x43ad('0x2a')](db['CmContactHasItem'][_0x43ad('0x2b')],function(_0x2a9dfd){return{'name':_0x2a9dfd[_0x43ad('0x2c')],'type':_0x2a9dfd[_0x43ad('0x2d')][_0x43ad('0x2e')]};});_0x36881e['model']=_['map'](_0x37bdb8,_0x43ad('0x27'));_0x36881e[_0x43ad('0x2f')]=_['keys'](_0x228b93[_0x43ad('0x2f')]);_0x36881e[_0x43ad('0x30')]=_['intersection'](_0x36881e[_0x43ad('0x31')],_0x36881e[_0x43ad('0x2f')]);_0x246f7b[_0x43ad('0x32')]=_['intersection'](_0x36881e[_0x43ad('0x31')],qs[_0x43ad('0x33')](_0x228b93[_0x43ad('0x2f')][_0x43ad('0x33')]));_0x246f7b['attributes']=_0x246f7b[_0x43ad('0x32')][_0x43ad('0x34')]?_0x246f7b['attributes']:_0x36881e[_0x43ad('0x31')];if(!_0x228b93[_0x43ad('0x2f')][_0x43ad('0x35')](_0x43ad('0x36'))){_0x246f7b[_0x43ad('0x1a')]=qs[_0x43ad('0x1a')](_0x228b93[_0x43ad('0x2f')][_0x43ad('0x1a')]);_0x246f7b[_0x43ad('0x18')]=qs[_0x43ad('0x18')](_0x228b93[_0x43ad('0x2f')][_0x43ad('0x18')]);}_0x246f7b[_0x43ad('0x37')]=qs[_0x43ad('0x38')](_0x228b93[_0x43ad('0x2f')][_0x43ad('0x38')]);_0x246f7b[_0x43ad('0x39')]=qs['filters'](_[_0x43ad('0x3a')](_0x228b93[_0x43ad('0x2f')],_0x36881e[_0x43ad('0x30')]),_0x37bdb8);if(_0x228b93['query'][_0x43ad('0x3b')]){_0x246f7b[_0x43ad('0x39')]=_[_0x43ad('0x3c')](_0x246f7b[_0x43ad('0x39')],{'$or':_[_0x43ad('0x2a')](_0x37bdb8,function(_0x4e0094){if(_0x4e0094[_0x43ad('0x2d')]!==_0x43ad('0x3d')){var _0x3368b7={};_0x3368b7[_0x4e0094[_0x43ad('0x27')]]={'$like':'%'+_0x228b93[_0x43ad('0x2f')][_0x43ad('0x3b')]+'%'};return _0x3368b7;}})});}_0x246f7b=_[_0x43ad('0x3c')]({},_0x246f7b,_0x228b93[_0x43ad('0x3e')]);var _0x37b398={'where':_0x246f7b['where']};return db[_0x43ad('0x3f')][_0x43ad('0x1b')](_0x37b398)[_0x43ad('0x20')](function(_0x1491ee){_0x267a60[_0x43ad('0x1b')]=_0x1491ee;if(_0x228b93['query'][_0x43ad('0x40')]){_0x246f7b[_0x43ad('0x41')]=[{'all':!![]}];}return db[_0x43ad('0x3f')][_0x43ad('0x42')](_0x246f7b);})[_0x43ad('0x20')](function(_0x3e9987){_0x267a60[_0x43ad('0x43')]=_0x3e9987;return _0x267a60;})[_0x43ad('0x20')](respondWithFilteredResult(_0x4de9da,_0x246f7b))[_0x43ad('0x44')](handleError(_0x4de9da,null));};exports[_0x43ad('0x45')]=function(_0x21cd07,_0x254ea8){var _0x2ed581={'raw':!![],'where':{'id':_0x21cd07[_0x43ad('0x46')]['id']}},_0x38873a={};_0x38873a[_0x43ad('0x31')]=_[_0x43ad('0x47')](db[_0x43ad('0x3f')][_0x43ad('0x2b')]);_0x38873a[_0x43ad('0x2f')]=_[_0x43ad('0x47')](_0x21cd07[_0x43ad('0x2f')]);_0x38873a[_0x43ad('0x30')]=_[_0x43ad('0x48')](_0x38873a[_0x43ad('0x31')],_0x38873a[_0x43ad('0x2f')]);_0x2ed581['attributes']=_[_0x43ad('0x48')](_0x38873a['model'],qs[_0x43ad('0x33')](_0x21cd07[_0x43ad('0x2f')]['fields']));_0x2ed581[_0x43ad('0x32')]=_0x2ed581[_0x43ad('0x32')][_0x43ad('0x34')]?_0x2ed581[_0x43ad('0x32')]:_0x38873a['model'];if(_0x21cd07[_0x43ad('0x2f')]['includeAll']){_0x2ed581[_0x43ad('0x41')]=[{'all':!![]}];}_0x2ed581=_[_0x43ad('0x3c')]({},_0x2ed581,_0x21cd07[_0x43ad('0x3e')]);return db[_0x43ad('0x3f')][_0x43ad('0x49')](_0x2ed581)[_0x43ad('0x20')](handleEntityNotFound(_0x254ea8,null))['then'](respondWithResult(_0x254ea8,null))[_0x43ad('0x44')](handleError(_0x254ea8,null));};exports[_0x43ad('0x4a')]=function(_0x59cd39,_0x564540){return db[_0x43ad('0x3f')][_0x43ad('0x4a')](_0x59cd39[_0x43ad('0x4b')],{})[_0x43ad('0x20')](function(_0x41bdcb){var _0x3284f6=_0x59cd39[_0x43ad('0x4c')][_0x43ad('0x22')]({'plain':!![]});if(!_0x3284f6)throw new Error(_0x43ad('0x4d'));if(_0x3284f6[_0x43ad('0x4e')]===_0x43ad('0x4c')){var _0xea3d90=_0x41bdcb[_0x43ad('0x22')]({'plain':!![]});var _0x4e7290=_0x43ad('0x23');return db[_0x43ad('0x4f')]['find']({'where':{'name':_0x4e7290,'userProfileId':_0x3284f6['userProfileId']},'raw':!![]})['then'](function(_0x598044){if(_0x598044&&_0x598044['autoAssociation']===0x0){return db['UserProfileResource'][_0x43ad('0x4a')]({'name':_0xea3d90['name'],'resourceId':_0xea3d90['id'],'type':_0x598044[_0x43ad('0x27')],'sectionId':_0x598044['id']},{})['then'](function(){return _0x41bdcb;});}else{return _0x41bdcb;}})['catch'](function(_0x42d2b6){logger[_0x43ad('0x25')](_0x43ad('0x50'),_0x42d2b6);throw _0x42d2b6;});}return _0x41bdcb;})[_0x43ad('0x20')](respondWithResult(_0x564540,0xc9))[_0x43ad('0x44')](handleError(_0x564540,null));};exports[_0x43ad('0x51')]=function(_0x191f30,_0x1aabb4){if(_0x191f30[_0x43ad('0x4b')]['id']){delete _0x191f30[_0x43ad('0x4b')]['id'];}return db[_0x43ad('0x3f')][_0x43ad('0x49')]({'where':{'id':_0x191f30['params']['id']}})['then'](handleEntityNotFound(_0x1aabb4,null))['then'](saveUpdates(_0x191f30[_0x43ad('0x4b')],null))['then'](respondWithResult(_0x1aabb4,null))[_0x43ad('0x44')](handleError(_0x1aabb4,null));};exports[_0x43ad('0x21')]=function(_0x9f09b7,_0xe456fc){return db[_0x43ad('0x3f')]['find']({'where':{'id':_0x9f09b7[_0x43ad('0x46')]['id']}})[_0x43ad('0x20')](handleEntityNotFound(_0xe456fc,null))['then'](removeEntity(_0xe456fc,null))[_0x43ad('0x44')](handleError(_0xe456fc,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 843a134..206fa31 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9f7=['CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x4aeff0,_0x2b74d3){var _0x155e6c=function(_0x46c91f){while(--_0x46c91f){_0x4aeff0['push'](_0x4aeff0['shift']());}};_0x155e6c(++_0x2b74d3);}(_0xc9f7,0x1bb));var _0x7c9f=function(_0x5ad37a,_0x231adc){_0x5ad37a=_0x5ad37a-0x0;var _0x10f0b7=_0xc9f7[_0x5ad37a];return _0x10f0b7;};'use strict';var _=require(_0x7c9f('0x0'));var util=require(_0x7c9f('0x1'));var logger=require(_0x7c9f('0x2'))(_0x7c9f('0x3'));var moment=require(_0x7c9f('0x4'));var BPromise=require(_0x7c9f('0x5'));var rp=require(_0x7c9f('0x6'));var fs=require('fs');var path=require(_0x7c9f('0x7'));var rimraf=require(_0x7c9f('0x8'));var config=require(_0x7c9f('0x9'));var attributes=require(_0x7c9f('0xa'));module[_0x7c9f('0xb')]=function(_0x81509f,_0x6a51e4){return _0x81509f['define'](_0x7c9f('0xc'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf2=['./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5baef6,_0x3ab715){var _0x16cab0=function(_0x1b9d9f){while(--_0x1b9d9f){_0x5baef6['push'](_0x5baef6['shift']());}};_0x16cab0(++_0x3ab715);}(_0xbaf2,0x13c));var _0x2baf=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xbaf2[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x2baf('0x0'));var util=require('util');var logger=require(_0x2baf('0x1'))(_0x2baf('0x2'));var moment=require(_0x2baf('0x3'));var BPromise=require(_0x2baf('0x4'));var rp=require(_0x2baf('0x5'));var fs=require('fs');var path=require(_0x2baf('0x6'));var rimraf=require(_0x2baf('0x7'));var config=require('../../config/environment');var attributes=require(_0x2baf('0x8'));module[_0x2baf('0x9')]=function(_0x2d2dd0,_0x261bcc){return _0x2d2dd0[_0x2baf('0xa')]('CmContactHasItem',attributes,{'tableName':_0x2baf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 327919a..9c561d4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e70=['request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x1d5e03,_0x1320ca){var _0x17be65=function(_0xd5fd8a){while(--_0xd5fd8a){_0x1d5e03['push'](_0x1d5e03['shift']());}};_0x17be65(++_0x1320ca);}(_0x7e70,0x178));var _0x07e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e70[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x07e7('0x0'));var moment=require(_0x07e7('0x1'));var BPromise=require(_0x07e7('0x2'));var rs=require(_0x07e7('0x3'));var fs=require('fs');var Redis=require(_0x07e7('0x4'));var db=require(_0x07e7('0x5'))['db'];var utils=require(_0x07e7('0x6'));var logger=require(_0x07e7('0x7'))(_0x07e7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x07e7('0x9')][_0x07e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574764,_0x122a9f,_0x39ba04){return new BPromise(function(_0x518cfc,_0x2e061a){return client[_0x07e7('0xb')](_0x574764,_0x39ba04)[_0x07e7('0xc')](function(_0x156b67){logger[_0x07e7('0xd')](_0x07e7('0xe'),_0x122a9f,_0x07e7('0xf'));logger['debug'](_0x07e7('0x10'),_0x122a9f,_0x07e7('0xf'),JSON[_0x07e7('0x11')](_0x156b67));if(_0x156b67[_0x07e7('0x12')]){if(_0x156b67['error'][_0x07e7('0x13')]===0x1f4){logger['error'](_0x07e7('0xe'),_0x122a9f,_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);return _0x2e061a(_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);}logger[_0x07e7('0x12')](_0x07e7('0xe'),_0x122a9f,_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);return _0x518cfc(_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);}else{logger[_0x07e7('0xd')](_0x07e7('0xe'),_0x122a9f,_0x07e7('0xf'));_0x518cfc(_0x156b67[_0x07e7('0x15')][_0x07e7('0x14')]);}})[_0x07e7('0x16')](function(_0x482c69){logger[_0x07e7('0x12')](_0x07e7('0xe'),_0x122a9f,_0x482c69);_0x2e061a(_0x482c69);});});} \ No newline at end of file +var _0x9d58=['stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','client','http','request','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0xd93ab7,_0x3c79b1){var _0x41a7b6=function(_0x556d17){while(--_0x556d17){_0xd93ab7['push'](_0xd93ab7['shift']());}};_0x41a7b6(++_0x3c79b1);}(_0x9d58,0x8b));var _0x89d5=function(_0x451d04,_0x999e7d){_0x451d04=_0x451d04-0x0;var _0x32c6fe=_0x9d58[_0x451d04];return _0x32c6fe;};'use strict';var _=require(_0x89d5('0x0'));var util=require(_0x89d5('0x1'));var moment=require(_0x89d5('0x2'));var BPromise=require(_0x89d5('0x3'));var rs=require(_0x89d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x89d5('0x5'))(_0x89d5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x89d5('0x7')][_0x89d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e6a0d,_0xa60058,_0x5d56c5){return new BPromise(function(_0x841344,_0x8e7a1a){return client[_0x89d5('0x9')](_0x1e6a0d,_0x5d56c5)['then'](function(_0x2049dd){logger['info'](_0x89d5('0xa'),_0xa60058,'request\x20sent');logger[_0x89d5('0xb')](_0x89d5('0xc'),_0xa60058,'request\x20sent',JSON[_0x89d5('0xd')](_0x2049dd));if(_0x2049dd[_0x89d5('0xe')]){if(_0x2049dd[_0x89d5('0xe')]['code']===0x1f4){logger[_0x89d5('0xe')](_0x89d5('0xa'),_0xa60058,_0x2049dd[_0x89d5('0xe')]['message']);return _0x8e7a1a(_0x2049dd[_0x89d5('0xe')][_0x89d5('0xf')]);}logger[_0x89d5('0xe')](_0x89d5('0xa'),_0xa60058,_0x2049dd[_0x89d5('0xe')][_0x89d5('0xf')]);return _0x841344(_0x2049dd[_0x89d5('0xe')][_0x89d5('0xf')]);}else{logger['info'](_0x89d5('0xa'),_0xa60058,_0x89d5('0x10'));_0x841344(_0x2049dd[_0x89d5('0x11')][_0x89d5('0xf')]);}})[_0x89d5('0x12')](function(_0x41ad84){logger[_0x89d5('0xe')](_0x89d5('0xa'),_0xa60058,_0x41ad84);_0x8e7a1a(_0x41ad84);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index eeb2c93..8decb5d 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x609a=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1cf6b7,_0x3f6638){var _0x1438a3=function(_0x54754a){while(--_0x54754a){_0x1cf6b7['push'](_0x1cf6b7['shift']());}};_0x1438a3(++_0x3f6638);}(_0x609a,0x11c));var _0xa609=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x609a[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var path=require('path');var timeout=require(_0xa609('0x2'));var express=require(_0xa609('0x3'));var router=express['Router']();var fs_extra=require(_0xa609('0x4'));var auth=require(_0xa609('0x5'));var interaction=require(_0xa609('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0xa609('0x7')]('/',auth[_0xa609('0x8')](),controller[_0xa609('0x9')]);router[_0xa609('0x7')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xb')]);router[_0xa609('0xc')]('/',auth['isAuthenticated'](),controller[_0xa609('0xd')]);router[_0xa609('0xe')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xf')]);router[_0xa609('0x10')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0x11')]);module[_0xa609('0x12')]=router; \ No newline at end of file +var _0x36b7=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x562486,_0xcaf120){var _0x350763=function(_0x4ca53d){while(--_0x4ca53d){_0x562486['push'](_0x562486['shift']());}};_0x350763(++_0xcaf120);}(_0x36b7,0x1bb));var _0x736b=function(_0x469c04,_0x1eb194){_0x469c04=_0x469c04-0x0;var _0x1d297e=_0x36b7[_0x469c04];return _0x1d297e;};'use strict';var multer=require(_0x736b('0x0'));var util=require(_0x736b('0x1'));var path=require(_0x736b('0x2'));var timeout=require(_0x736b('0x3'));var express=require('express');var router=express[_0x736b('0x4')]();var fs_extra=require(_0x736b('0x5'));var auth=require(_0x736b('0x6'));var interaction=require(_0x736b('0x7'));var config=require(_0x736b('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x736b('0x9')]('/',auth[_0x736b('0xa')](),controller[_0x736b('0xb')]);router[_0x736b('0x9')](_0x736b('0xc'),auth[_0x736b('0xa')](),controller[_0x736b('0xd')]);router[_0x736b('0xe')]('/',auth[_0x736b('0xa')](),controller[_0x736b('0xf')]);router[_0x736b('0x10')](_0x736b('0xc'),auth['isAuthenticated'](),controller[_0x736b('0x11')]);router[_0x736b('0x12')]('/:id',auth[_0x736b('0xa')](),controller['destroy']);module[_0x736b('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 703327a..7719fac 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 _0xd33e=['stringify','BOOLEAN','ENUM','voice','exports','getDataValue','alias','setDataValue','STRING','TEXT','type','select','parse','values','isArray'];(function(_0x5ae969,_0x4c3483){var _0x44c4fc=function(_0x4a607b){while(--_0x4a607b){_0x5ae969['push'](_0x5ae969['shift']());}};_0x44c4fc(++_0x4c3483);}(_0xd33e,0x1b7));var _0xed33=function(_0x317722,_0x58fba2){_0x317722=_0x317722-0x0;var _0xa152ad=_0xd33e[_0x317722];return _0xa152ad;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xed33('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x458a78){return this[_0xed33('0x1')](_0xed33('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x900bac){this[_0xed33('0x3')]('alias',_0x900bac?_0x900bac:this[_0xed33('0x1')]('name'));}},'type':{'type':Sequelize[_0xed33('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xed33('0x5')]('long'),'get':function(){if(this[_0xed33('0x1')](_0xed33('0x6'))===_0xed33('0x7')){return JSON[_0xed33('0x8')](this[_0xed33('0x1')](_0xed33('0x9')));}else{return this['getDataValue'](_0xed33('0x9'));}},'set':function(_0x476422){if(Array[_0xed33('0xa')](_0x476422)){this[_0xed33('0x3')](_0xed33('0x9'),JSON[_0xed33('0xb')](_0x476422));}else{this['setDataValue'](_0xed33('0x9'),_0x476422);}}},'required':{'type':Sequelize[_0xed33('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xed33('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xed33('0xd')](_0xed33('0xe'))}}; \ No newline at end of file +var _0x499c=['alias','STRING','setDataValue','name','TEXT','type','select','parse','values','isArray','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x4b0612,_0x3f1930){var _0x113213=function(_0x28f115){while(--_0x28f115){_0x4b0612['push'](_0x4b0612['shift']());}};_0x113213(++_0x3f1930);}(_0x499c,0xbb));var _0xc499=function(_0x5464fa,_0x102b68){_0x5464fa=_0x5464fa-0x0;var _0x23a529=_0x499c[_0x5464fa];return _0x23a529;};'use strict';var Sequelize=require(_0xc499('0x0'));var _=require(_0xc499('0x1'));module[_0xc499('0x2')]={'name':{'type':Sequelize[_0xc499('0x3')],'get':function(_0x59287e){return this[_0xc499('0x4')](_0xc499('0x5'));}},'alias':{'type':Sequelize[_0xc499('0x6')],'allowNull':![],'set':function(_0x1cfbf1){this[_0xc499('0x7')](_0xc499('0x5'),_0x1cfbf1?_0x1cfbf1:this[_0xc499('0x4')](_0xc499('0x8')));}},'type':{'type':Sequelize[_0xc499('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xc499('0x9')]('long'),'get':function(){if(this[_0xc499('0x4')](_0xc499('0xa'))===_0xc499('0xb')){return JSON[_0xc499('0xc')](this['getDataValue'](_0xc499('0xd')));}else{return this[_0xc499('0x4')](_0xc499('0xd'));}},'set':function(_0x48e3c7){if(Array[_0xc499('0xe')](_0x48e3c7)){this[_0xc499('0x7')]('values',JSON['stringify'](_0x48e3c7));}else{this[_0xc499('0x7')](_0xc499('0xd'),_0x48e3c7);}}},'required':{'type':Sequelize[_0xc499('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c63a71b..a746c19 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 _0x5379=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','differenceBy','map','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','CmCustomField','rows','catch','params','keys','intersection','length','find','body','create','sequelize','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5379,0xf3));var _0x9537=function(_0x57d484,_0x28f564){_0x57d484=_0x57d484-0x0;var _0x29937e=_0x5379[_0x57d484];return _0x29937e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9537('0x0'));var zipdir=require(_0x9537('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9537('0x2'));var moment=require(_0x9537('0x3'));var BPromise=require(_0x9537('0x4'));var Mustache=require(_0x9537('0x5'));var util=require(_0x9537('0x6'));var path=require(_0x9537('0x7'));var sox=require(_0x9537('0x8'));var csv=require(_0x9537('0x9'));var ejs=require(_0x9537('0xa'));var fs=require('fs');var fs_extra=require(_0x9537('0xb'));var _=require('lodash');var squel=require(_0x9537('0xc'));var crypto=require(_0x9537('0xd'));var jsforce=require(_0x9537('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9537('0x9'));var querystring=require(_0x9537('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9537('0x10'));var hardwareService=require(_0x9537('0x11'));var logger=require(_0x9537('0x12'))('api');var utils=require(_0x9537('0x13'));var config=require(_0x9537('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9537('0x15'))['db'];function respondWithStatusCode(_0x1b1005,_0x5136d0){_0x5136d0=_0x5136d0||0xcc;return function(_0x58a21c){if(_0x58a21c){return _0x1b1005[_0x9537('0x16')](_0x5136d0);}return _0x1b1005['status'](_0x5136d0)[_0x9537('0x17')]();};}function respondWithResult(_0x268bc4,_0x172c85){_0x172c85=_0x172c85||0xc8;return function(_0x343177){if(_0x343177){return _0x268bc4[_0x9537('0x18')](_0x172c85)[_0x9537('0x19')](_0x343177);}};}function respondWithFilteredResult(_0x5328d7,_0x3da0b2){return function(_0x23d03b){if(_0x23d03b){var _0x1f4a50=typeof _0x3da0b2[_0x9537('0x1a')]===_0x9537('0x1b')&&typeof _0x3da0b2[_0x9537('0x1c')]===_0x9537('0x1b');var _0x5d932a=_0x23d03b[_0x9537('0x1d')];var _0xf48715=_0x1f4a50?0x0:_0x3da0b2[_0x9537('0x1a')];var _0x4fd44f=_0x1f4a50?_0x23d03b[_0x9537('0x1d')]:_0x3da0b2[_0x9537('0x1a')]+_0x3da0b2[_0x9537('0x1c')];var _0x1b37a1;if(_0x4fd44f>=_0x5d932a){_0x4fd44f=_0x5d932a;_0x1b37a1=0xc8;}else{_0x1b37a1=0xce;}_0x5328d7[_0x9537('0x18')](_0x1b37a1);return _0x5328d7['set'](_0x9537('0x1e'),_0xf48715+'-'+_0x4fd44f+'/'+_0x5d932a)[_0x9537('0x19')](_0x23d03b);}return null;};}function patchUpdates(_0x285c16){return function(_0x4e2a65){try{jsonpatch[_0x9537('0x1f')](_0x4e2a65,_0x285c16,!![]);}catch(_0x48d570){return BPromise[_0x9537('0x20')](_0x48d570);}return _0x4e2a65[_0x9537('0x21')]();};}function saveUpdates(_0x310d95,_0x1ea66a){return function(_0x475a7e){if(_0x475a7e){return _0x475a7e[_0x9537('0x22')](_0x310d95)[_0x9537('0x23')](function(_0x51658a){return _0x51658a;});}return null;};}function removeEntity(_0x226b61,_0x583c9f){return function(_0x277469){if(_0x277469){return _0x277469['destroy']()[_0x9537('0x23')](function(){_0x226b61[_0x9537('0x18')](0xcc)[_0x9537('0x17')]();});}};}function handleEntityNotFound(_0x396b69,_0x48f515){return function(_0x1f83ae){if(!_0x1f83ae){_0x396b69[_0x9537('0x16')](0x194);}return _0x1f83ae;};}function handleError(_0x5985a2,_0x14ef11){_0x14ef11=_0x14ef11||0x1f4;return function(_0x4dcbfe){logger[_0x9537('0x24')](_0x4dcbfe[_0x9537('0x25')]);if(_0x4dcbfe[_0x9537('0x26')]){delete _0x4dcbfe[_0x9537('0x26')];}_0x5985a2[_0x9537('0x18')](_0x14ef11)[_0x9537('0x27')](_0x4dcbfe);};}exports[_0x9537('0x28')]=function(_0xb53b59,_0x49f657){var _0x150ae1={},_0x2baee8={},_0xb730f1={'count':0x0,'rows':[]};var _0x48e8f2=_['map'](db['CmCustomField'][_0x9537('0x29')],function(_0x570b00){return{'name':_0x570b00['fieldName'],'type':_0x570b00['type']['key']};});_0x2baee8['model']=_[_0x9537('0x2a')](_[_0x9537('0x2b')](_0x48e8f2,_0x9537('0x26')),[_0x9537('0x26')]);_0x2baee8[_0x9537('0x2c')]=_['keys'](_0xb53b59[_0x9537('0x2c')]);_0x2baee8['filters']=_['intersection'](_0x2baee8['model'],_0x2baee8['query']);_0x150ae1[_0x9537('0x2d')]=_['intersection'](_0x2baee8[_0x9537('0x2e')],qs['fields'](_0xb53b59['query'][_0x9537('0x2f')]));_0x150ae1[_0x9537('0x2d')]=_0x150ae1[_0x9537('0x2d')]['length']?_0x150ae1[_0x9537('0x2d')]:_0x2baee8[_0x9537('0x2e')];if(!_0xb53b59['query'][_0x9537('0x30')](_0x9537('0x31'))){_0x150ae1['limit']=qs[_0x9537('0x1c')](_0xb53b59[_0x9537('0x2c')][_0x9537('0x1c')]);_0x150ae1[_0x9537('0x1a')]=qs[_0x9537('0x1a')](_0xb53b59[_0x9537('0x2c')]['offset']);}_0x150ae1[_0x9537('0x32')]=qs[_0x9537('0x33')](_0xb53b59[_0x9537('0x2c')][_0x9537('0x33')]);_0x150ae1[_0x9537('0x34')]=qs[_0x9537('0x35')](_[_0x9537('0x36')](_0xb53b59[_0x9537('0x2c')],_0x2baee8[_0x9537('0x35')]),_0x48e8f2);if(_0xb53b59[_0x9537('0x2c')][_0x9537('0x37')]){_0x150ae1[_0x9537('0x34')]=_[_0x9537('0x38')](_0x150ae1['where'],{'$or':_[_0x9537('0x2b')](_0x48e8f2,function(_0x5c450f){if(_0x5c450f[_0x9537('0x39')]!==_0x9537('0x3a')){var _0x1581df={};_0x1581df[_0x5c450f[_0x9537('0x26')]]={'$like':'%'+_0xb53b59[_0x9537('0x2c')][_0x9537('0x37')]+'%'};return _0x1581df;}})});}_0x150ae1=_[_0x9537('0x38')]({},_0x150ae1,_0xb53b59[_0x9537('0x3b')]);var _0x2a1c80={'where':_0x150ae1['where']};return db['CmCustomField'][_0x9537('0x1d')](_0x2a1c80)[_0x9537('0x23')](function(_0x5dabbe){_0xb730f1[_0x9537('0x1d')]=_0x5dabbe;if(_0xb53b59['query'][_0x9537('0x3c')]){_0x150ae1[_0x9537('0x3d')]=[{'all':!![]}];}return db[_0x9537('0x3e')]['findAll'](_0x150ae1);})['then'](function(_0xa3f728){_0xb730f1[_0x9537('0x3f')]=_0xa3f728;return _0xb730f1;})['then'](respondWithFilteredResult(_0x49f657,_0x150ae1))[_0x9537('0x40')](handleError(_0x49f657,null));};exports['show']=function(_0xfde682,_0x5b72ad){var _0x412875={'raw':!![],'where':{'id':_0xfde682[_0x9537('0x41')]['id']}},_0x19408f={};_0x19408f[_0x9537('0x2e')]=_[_0x9537('0x42')](db[_0x9537('0x3e')][_0x9537('0x29')]);_0x19408f[_0x9537('0x2c')]=_['keys'](_0xfde682[_0x9537('0x2c')]);_0x19408f[_0x9537('0x35')]=_[_0x9537('0x43')](_0x19408f[_0x9537('0x2e')],_0x19408f[_0x9537('0x2c')]);_0x412875['attributes']=_[_0x9537('0x43')](_0x19408f['model'],qs['fields'](_0xfde682[_0x9537('0x2c')][_0x9537('0x2f')]));_0x412875[_0x9537('0x2d')]=_0x412875[_0x9537('0x2d')][_0x9537('0x44')]?_0x412875[_0x9537('0x2d')]:_0x19408f['model'];if(_0xfde682['query'][_0x9537('0x3c')]){_0x412875[_0x9537('0x3d')]=[{'all':!![]}];}_0x412875=_['merge']({},_0x412875,_0xfde682['options']);return db[_0x9537('0x3e')][_0x9537('0x45')](_0x412875)[_0x9537('0x23')](handleEntityNotFound(_0x5b72ad,null))['then'](respondWithResult(_0x5b72ad,null))[_0x9537('0x40')](handleError(_0x5b72ad,null));};exports['update']=function(_0x1a322a,_0x51c1fe){if(_0x1a322a[_0x9537('0x46')]['id']){delete _0x1a322a['body']['id'];}return db['CmCustomField'][_0x9537('0x45')]({'where':{'id':_0x1a322a['params']['id']}})[_0x9537('0x23')](handleEntityNotFound(_0x51c1fe,null))[_0x9537('0x23')](saveUpdates(_0x1a322a[_0x9537('0x46')],null))[_0x9537('0x23')](respondWithResult(_0x51c1fe,null))[_0x9537('0x40')](handleError(_0x51c1fe,null));};exports['destroy']=function(_0x446b3c,_0x1c9ed5){return db['CmCustomField'][_0x9537('0x45')]({'where':{'id':_0x446b3c['params']['id']}})['then'](handleEntityNotFound(_0x1c9ed5,null))[_0x9537('0x23')](removeEntity(_0x1c9ed5,null))[_0x9537('0x40')](handleError(_0x1c9ed5,null));};exports[_0x9537('0x47')]=function(_0x10ecb4,_0x3d718a){var _0x12f74f;return db[_0x9537('0x48')]['transaction'](function(_0x192173){return db[_0x9537('0x3e')]['create'](_0x10ecb4[_0x9537('0x46')],{'transaction':_0x192173})[_0x9537('0x23')](function(_0x1afa1d){_0x12f74f=_0x1afa1d;var _0x25d688={'type':db[_0x9537('0x49')]['TEXT'],'transaction':_0x192173};switch(_0x10ecb4[_0x9537('0x46')][_0x9537('0x39')]){case'text':_0x25d688['type']=db[_0x9537('0x49')][_0x9537('0x4a')];break;case _0x9537('0x4b'):_0x25d688['type']=db[_0x9537('0x49')][_0x9537('0x4c')];break;case _0x9537('0x4d'):_0x25d688[_0x9537('0x39')]=db[_0x9537('0x49')][_0x9537('0x4e')];_0x25d688['defaultValue']=![];break;default:}return db[_0x9537('0x48')][_0x9537('0x4f')][_0x9537('0x50')]('cm_contacts',util[_0x9537('0x51')](_0x9537('0x52'),_0x12f74f['id']),_0x25d688);})['then'](function(){return _0x12f74f;});})[_0x9537('0x23')](respondWithResult(_0x3d718a,0xc9))[_0x9537('0x40')](handleError(_0x3d718a,null));}; \ No newline at end of file +var _0x7526=['CmCustomField','rows','show','params','find','catch','body','create','sequelize','Sequelize','text','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include'];(function(_0x22808b,_0x329b6a){var _0x42cbd2=function(_0x256a8d){while(--_0x256a8d){_0x22808b['push'](_0x22808b['shift']());}};_0x42cbd2(++_0x329b6a);}(_0x7526,0x167));var _0x6752=function(_0x3fd029,_0x25f272){_0x3fd029=_0x3fd029-0x0;var _0x2d3f33=_0x7526[_0x3fd029];return _0x2d3f33;};'use strict';var emlformat=require(_0x6752('0x0'));var rimraf=require(_0x6752('0x1'));var zipdir=require(_0x6752('0x2'));var jsonpatch=require(_0x6752('0x3'));var rp=require('request-promise');var moment=require(_0x6752('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6752('0x5'));var util=require('util');var path=require(_0x6752('0x6'));var sox=require(_0x6752('0x7'));var csv=require(_0x6752('0x8'));var ejs=require(_0x6752('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6752('0xa'));var squel=require(_0x6752('0xb'));var crypto=require(_0x6752('0xc'));var jsforce=require(_0x6752('0xd'));var deskjs=require(_0x6752('0xe'));var toCsv=require(_0x6752('0x8'));var querystring=require('querystring');var Papa=require(_0x6752('0xf'));var Redis=require('ioredis');var authService=require(_0x6752('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6752('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6752('0x12'))(_0x6752('0x13'));var utils=require(_0x6752('0x14'));var config=require(_0x6752('0x15'));var licenseUtil=require(_0x6752('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c46f,_0x3c70be){_0x3c70be=_0x3c70be||0xcc;return function(_0x258d34){if(_0x258d34){return _0x50c46f[_0x6752('0x17')](_0x3c70be);}return _0x50c46f[_0x6752('0x18')](_0x3c70be)[_0x6752('0x19')]();};}function respondWithResult(_0x3f1c40,_0x285a65){_0x285a65=_0x285a65||0xc8;return function(_0x403e81){if(_0x403e81){return _0x3f1c40[_0x6752('0x18')](_0x285a65)[_0x6752('0x1a')](_0x403e81);}};}function respondWithFilteredResult(_0x478224,_0x5ad82b){return function(_0x529f8d){if(_0x529f8d){var _0x4dfeda=typeof _0x5ad82b[_0x6752('0x1b')]===_0x6752('0x1c')&&typeof _0x5ad82b[_0x6752('0x1d')]===_0x6752('0x1c');var _0x17587=_0x529f8d[_0x6752('0x1e')];var _0x513f56=_0x4dfeda?0x0:_0x5ad82b[_0x6752('0x1b')];var _0x14384f=_0x4dfeda?_0x529f8d['count']:_0x5ad82b[_0x6752('0x1b')]+_0x5ad82b[_0x6752('0x1d')];var _0x90388f;if(_0x14384f>=_0x17587){_0x14384f=_0x17587;_0x90388f=0xc8;}else{_0x90388f=0xce;}_0x478224['status'](_0x90388f);return _0x478224[_0x6752('0x1f')]('Content-Range',_0x513f56+'-'+_0x14384f+'/'+_0x17587)[_0x6752('0x1a')](_0x529f8d);}return null;};}function patchUpdates(_0x28c9a2){return function(_0x474882){try{jsonpatch[_0x6752('0x20')](_0x474882,_0x28c9a2,!![]);}catch(_0x123663){return BPromise[_0x6752('0x21')](_0x123663);}return _0x474882[_0x6752('0x22')]();};}function saveUpdates(_0x433953,_0x19e2f4){return function(_0x33e13f){if(_0x33e13f){return _0x33e13f[_0x6752('0x23')](_0x433953)[_0x6752('0x24')](function(_0x1b913d){return _0x1b913d;});}return null;};}function removeEntity(_0xe4bf48,_0xc03394){return function(_0xde13ee){if(_0xde13ee){return _0xde13ee[_0x6752('0x25')]()['then'](function(){_0xe4bf48[_0x6752('0x18')](0xcc)[_0x6752('0x19')]();});}};}function handleEntityNotFound(_0x4925a2,_0x3b57a0){return function(_0x7f835f){if(!_0x7f835f){_0x4925a2[_0x6752('0x17')](0x194);}return _0x7f835f;};}function handleError(_0x3eebcd,_0xc60359){_0xc60359=_0xc60359||0x1f4;return function(_0x1c4b2c){logger[_0x6752('0x26')](_0x1c4b2c['stack']);if(_0x1c4b2c[_0x6752('0x27')]){delete _0x1c4b2c[_0x6752('0x27')];}_0x3eebcd['status'](_0xc60359)[_0x6752('0x28')](_0x1c4b2c);};}exports['index']=function(_0x2e6f95,_0x15e9b0){var _0x397890={},_0x3ccbe6={},_0x5a359b={'count':0x0,'rows':[]};var _0x2ebfee=_[_0x6752('0x29')](db['CmCustomField'][_0x6752('0x2a')],function(_0x57f6e5){return{'name':_0x57f6e5[_0x6752('0x2b')],'type':_0x57f6e5['type'][_0x6752('0x2c')]};});_0x3ccbe6[_0x6752('0x2d')]=_[_0x6752('0x2e')](_[_0x6752('0x29')](_0x2ebfee,_0x6752('0x27')),['name']);_0x3ccbe6[_0x6752('0x2f')]=_[_0x6752('0x30')](_0x2e6f95[_0x6752('0x2f')]);_0x3ccbe6[_0x6752('0x31')]=_['intersection'](_0x3ccbe6[_0x6752('0x2d')],_0x3ccbe6['query']);_0x397890['attributes']=_[_0x6752('0x32')](_0x3ccbe6[_0x6752('0x2d')],qs[_0x6752('0x33')](_0x2e6f95[_0x6752('0x2f')][_0x6752('0x33')]));_0x397890['attributes']=_0x397890['attributes'][_0x6752('0x34')]?_0x397890[_0x6752('0x35')]:_0x3ccbe6['model'];if(!_0x2e6f95['query'][_0x6752('0x36')](_0x6752('0x37'))){_0x397890[_0x6752('0x1d')]=qs['limit'](_0x2e6f95[_0x6752('0x2f')]['limit']);_0x397890['offset']=qs[_0x6752('0x1b')](_0x2e6f95[_0x6752('0x2f')][_0x6752('0x1b')]);}_0x397890['order']=qs['sort'](_0x2e6f95[_0x6752('0x2f')][_0x6752('0x38')]);_0x397890[_0x6752('0x39')]=qs['filters'](_[_0x6752('0x3a')](_0x2e6f95['query'],_0x3ccbe6['filters']),_0x2ebfee);if(_0x2e6f95[_0x6752('0x2f')]['filter']){_0x397890[_0x6752('0x39')]=_[_0x6752('0x3b')](_0x397890[_0x6752('0x39')],{'$or':_[_0x6752('0x29')](_0x2ebfee,function(_0x34e611){if(_0x34e611[_0x6752('0x3c')]!==_0x6752('0x3d')){var _0x62dbc4={};_0x62dbc4[_0x34e611[_0x6752('0x27')]]={'$like':'%'+_0x2e6f95[_0x6752('0x2f')][_0x6752('0x3e')]+'%'};return _0x62dbc4;}})});}_0x397890=_[_0x6752('0x3b')]({},_0x397890,_0x2e6f95[_0x6752('0x3f')]);var _0x423307={'where':_0x397890[_0x6752('0x39')]};return db['CmCustomField'][_0x6752('0x1e')](_0x423307)[_0x6752('0x24')](function(_0x442e6b){_0x5a359b[_0x6752('0x1e')]=_0x442e6b;if(_0x2e6f95[_0x6752('0x2f')][_0x6752('0x40')]){_0x397890[_0x6752('0x41')]=[{'all':!![]}];}return db[_0x6752('0x42')]['findAll'](_0x397890);})[_0x6752('0x24')](function(_0x1f483a){_0x5a359b[_0x6752('0x43')]=_0x1f483a;return _0x5a359b;})[_0x6752('0x24')](respondWithFilteredResult(_0x15e9b0,_0x397890))['catch'](handleError(_0x15e9b0,null));};exports[_0x6752('0x44')]=function(_0x205622,_0x117f85){var _0x1a1480={'raw':!![],'where':{'id':_0x205622[_0x6752('0x45')]['id']}},_0x3704f5={};_0x3704f5['model']=_[_0x6752('0x30')](db[_0x6752('0x42')][_0x6752('0x2a')]);_0x3704f5[_0x6752('0x2f')]=_['keys'](_0x205622[_0x6752('0x2f')]);_0x3704f5[_0x6752('0x31')]=_[_0x6752('0x32')](_0x3704f5[_0x6752('0x2d')],_0x3704f5[_0x6752('0x2f')]);_0x1a1480[_0x6752('0x35')]=_[_0x6752('0x32')](_0x3704f5['model'],qs[_0x6752('0x33')](_0x205622[_0x6752('0x2f')]['fields']));_0x1a1480[_0x6752('0x35')]=_0x1a1480[_0x6752('0x35')][_0x6752('0x34')]?_0x1a1480[_0x6752('0x35')]:_0x3704f5[_0x6752('0x2d')];if(_0x205622[_0x6752('0x2f')][_0x6752('0x40')]){_0x1a1480[_0x6752('0x41')]=[{'all':!![]}];}_0x1a1480=_['merge']({},_0x1a1480,_0x205622['options']);return db['CmCustomField'][_0x6752('0x46')](_0x1a1480)[_0x6752('0x24')](handleEntityNotFound(_0x117f85,null))[_0x6752('0x24')](respondWithResult(_0x117f85,null))[_0x6752('0x47')](handleError(_0x117f85,null));};exports[_0x6752('0x23')]=function(_0x59c86c,_0x16898f){if(_0x59c86c['body']['id']){delete _0x59c86c[_0x6752('0x48')]['id'];}return db[_0x6752('0x42')][_0x6752('0x46')]({'where':{'id':_0x59c86c['params']['id']}})[_0x6752('0x24')](handleEntityNotFound(_0x16898f,null))[_0x6752('0x24')](saveUpdates(_0x59c86c[_0x6752('0x48')],null))[_0x6752('0x24')](respondWithResult(_0x16898f,null))['catch'](handleError(_0x16898f,null));};exports['destroy']=function(_0x1033e7,_0x21c23a){return db['CmCustomField'][_0x6752('0x46')]({'where':{'id':_0x1033e7[_0x6752('0x45')]['id']}})[_0x6752('0x24')](handleEntityNotFound(_0x21c23a,null))['then'](removeEntity(_0x21c23a,null))[_0x6752('0x47')](handleError(_0x21c23a,null));};exports[_0x6752('0x49')]=function(_0x4d3b9a,_0x54da4e){var _0x5b0c50;return db[_0x6752('0x4a')]['transaction'](function(_0x50506d){return db[_0x6752('0x42')][_0x6752('0x49')](_0x4d3b9a[_0x6752('0x48')],{'transaction':_0x50506d})[_0x6752('0x24')](function(_0x2e2f4d){_0x5b0c50=_0x2e2f4d;var _0x1c083a={'type':db[_0x6752('0x4b')]['TEXT'],'transaction':_0x50506d};switch(_0x4d3b9a['body'][_0x6752('0x3c')]){case _0x6752('0x4c'):_0x1c083a[_0x6752('0x3c')]=db[_0x6752('0x4b')][_0x6752('0x4d')];break;case _0x6752('0x4e'):_0x1c083a[_0x6752('0x3c')]=db[_0x6752('0x4b')][_0x6752('0x4f')];break;case'switch':_0x1c083a[_0x6752('0x3c')]=db[_0x6752('0x4b')]['BOOLEAN'];_0x1c083a[_0x6752('0x50')]=![];break;default:}return db[_0x6752('0x4a')][_0x6752('0x51')][_0x6752('0x52')](_0x6752('0x53'),util[_0x6752('0x54')]('cf_%d',_0x5b0c50['id']),_0x1c083a);})['then'](function(){return _0x5b0c50;});})[_0x6752('0x24')](respondWithResult(_0x54da4e,0xc9))[_0x6752('0x47')](handleError(_0x54da4e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3a9b69e..a88c207 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 _0x6dc0=['api','moment','bluebird','path','rimraf','./cmCustomField.attributes','define','CmCustomField','util','../../config/logger'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6dc0,0x1e8));var _0x06dc=function(_0x2ea59c,_0xc3b86){_0x2ea59c=_0x2ea59c-0x0;var _0x42cbe2=_0x6dc0[_0x2ea59c];return _0x42cbe2;};'use strict';var _=require('lodash');var util=require(_0x06dc('0x0'));var logger=require(_0x06dc('0x1'))(_0x06dc('0x2'));var moment=require(_0x06dc('0x3'));var BPromise=require(_0x06dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06dc('0x5'));var rimraf=require(_0x06dc('0x6'));var config=require('../../config/environment');var attributes=require(_0x06dc('0x7'));module['exports']=function(_0x36a747,_0x322049){return _0x36a747[_0x06dc('0x8')](_0x06dc('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa9=['./cmCustomField.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x379b1d,_0x2b11db){var _0x11bc14=function(_0x55e8b2){while(--_0x55e8b2){_0x379b1d['push'](_0x379b1d['shift']());}};_0x11bc14(++_0x2b11db);}(_0xcfa9,0x1b3));var _0x9cfa=function(_0x1ce607,_0xddfdfd){_0x1ce607=_0x1ce607-0x0;var _0x25e6f8=_0xcfa9[_0x1ce607];return _0x25e6f8;};'use strict';var _=require(_0x9cfa('0x0'));var util=require(_0x9cfa('0x1'));var logger=require(_0x9cfa('0x2'))('api');var moment=require(_0x9cfa('0x3'));var BPromise=require(_0x9cfa('0x4'));var rp=require(_0x9cfa('0x5'));var fs=require('fs');var path=require(_0x9cfa('0x6'));var rimraf=require(_0x9cfa('0x7'));var config=require(_0x9cfa('0x8'));var attributes=require(_0x9cfa('0x9'));module[_0x9cfa('0xa')]=function(_0x33cd53,_0xe41db8){return _0x33cd53[_0x9cfa('0xb')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index d09c74f..0d8b9d9 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 _0xea79=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','moment','bluebird','randomstring'];(function(_0x3a0a7c,_0x4483b7){var _0x52a0a3=function(_0x31e253){while(--_0x31e253){_0x3a0a7c['push'](_0x3a0a7c['shift']());}};_0x52a0a3(++_0x4483b7);}(_0xea79,0x162));var _0x9ea7=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xea79[_0xb0de07];return _0x4633d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ea7('0x0'));var BPromise=require(_0x9ea7('0x1'));var rs=require(_0x9ea7('0x2'));var fs=require('fs');var Redis=require(_0x9ea7('0x3'));var db=require(_0x9ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea7('0x5'))(_0x9ea7('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ea7('0x7'));var client=jayson[_0x9ea7('0x8')][_0x9ea7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26462b,_0x9cd535,_0x527f09){return new BPromise(function(_0x1ef059,_0x9ae1f5){return client[_0x9ea7('0xa')](_0x26462b,_0x527f09)['then'](function(_0x3be103){logger[_0x9ea7('0xb')]('CmCustomField,\x20%s,\x20%s',_0x9cd535,_0x9ea7('0xc'));logger[_0x9ea7('0xd')](_0x9ea7('0xe'),_0x9cd535,_0x9ea7('0xc'),JSON[_0x9ea7('0xf')](_0x3be103));if(_0x3be103[_0x9ea7('0x10')]){if(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x11')]===0x1f4){logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);return _0x9ae1f5(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);}logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3be103[_0x9ea7('0x10')]['message']);return _0x1ef059(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);}else{logger[_0x9ea7('0xb')](_0x9ea7('0x12'),_0x9cd535,'request\x20sent');_0x1ef059(_0x3be103[_0x9ea7('0x14')][_0x9ea7('0x13')]);}})['catch'](function(_0x3e22fc){logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3e22fc);_0x9ae1f5(_0x3e22fc);});});} \ No newline at end of file +var _0xed22=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis'];(function(_0x388653,_0x57c50b){var _0x347f05=function(_0x523b9d){while(--_0x523b9d){_0x388653['push'](_0x388653['shift']());}};_0x347f05(++_0x57c50b);}(_0xed22,0x14b));var _0x2ed2=function(_0x424604,_0x4db329){_0x424604=_0x424604-0x0;var _0x33f801=_0xed22[_0x424604];return _0x33f801;};'use strict';var _=require(_0x2ed2('0x0'));var util=require(_0x2ed2('0x1'));var moment=require(_0x2ed2('0x2'));var BPromise=require(_0x2ed2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ed2('0x4'));var db=require(_0x2ed2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ed2('0x6'))(_0x2ed2('0x7'));var config=require(_0x2ed2('0x8'));var jayson=require(_0x2ed2('0x9'));var client=jayson[_0x2ed2('0xa')][_0x2ed2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5db6e7,_0x2ff1f8,_0xd51cde){return new BPromise(function(_0x6fcb62,_0x599b1a){return client[_0x2ed2('0xc')](_0x5db6e7,_0xd51cde)['then'](function(_0x280b71){logger[_0x2ed2('0xd')](_0x2ed2('0xe'),_0x2ff1f8,_0x2ed2('0xf'));logger['debug'](_0x2ed2('0x10'),_0x2ff1f8,_0x2ed2('0xf'),JSON[_0x2ed2('0x11')](_0x280b71));if(_0x280b71['error']){if(_0x280b71[_0x2ed2('0x12')][_0x2ed2('0x13')]===0x1f4){logger[_0x2ed2('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2ff1f8,_0x280b71[_0x2ed2('0x12')][_0x2ed2('0x14')]);return _0x599b1a(_0x280b71[_0x2ed2('0x12')][_0x2ed2('0x14')]);}logger[_0x2ed2('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2ff1f8,_0x280b71[_0x2ed2('0x12')]['message']);return _0x6fcb62(_0x280b71[_0x2ed2('0x12')][_0x2ed2('0x14')]);}else{logger['info'](_0x2ed2('0xe'),_0x2ff1f8,'request\x20sent');_0x6fcb62(_0x280b71['result'][_0x2ed2('0x14')]);}})['catch'](function(_0x1d878e){logger['error']('CmCustomField,\x20%s,\x20%s',_0x2ff1f8,_0x1d878e);_0x599b1a(_0x1d878e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index dc3b772..84bcb0c 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 _0xa423=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3fa8b4,_0x502307){var _0x30fed7=function(_0x39ff17){while(--_0x39ff17){_0x3fa8b4['push'](_0x3fa8b4['shift']());}};_0x30fed7(++_0x502307);}(_0xa423,0x16c));var _0x3a42=function(_0x1e3128,_0x44f7b6){_0x1e3128=_0x1e3128-0x0;var _0x55755f=_0xa423[_0x1e3128];return _0x55755f;};'use strict';var multer=require(_0x3a42('0x0'));var util=require(_0x3a42('0x1'));var path=require(_0x3a42('0x2'));var timeout=require(_0x3a42('0x3'));var express=require(_0x3a42('0x4'));var router=express['Router']();var fs_extra=require(_0x3a42('0x5'));var auth=require(_0x3a42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3a42('0x7'));var controller=require(_0x3a42('0x8'));router[_0x3a42('0x9')]('/',auth[_0x3a42('0xa')](),controller[_0x3a42('0xb')]);router['get'](_0x3a42('0xc'),auth[_0x3a42('0xa')](),controller[_0x3a42('0xd')]);router[_0x3a42('0xe')]('/',auth[_0x3a42('0xa')](),controller[_0x3a42('0xf')]);router[_0x3a42('0x10')](_0x3a42('0xc'),auth[_0x3a42('0xa')](),controller[_0x3a42('0x11')]);router[_0x3a42('0x12')]('/:id',auth[_0x3a42('0xa')](),controller[_0x3a42('0x13')]);module[_0x3a42('0x14')]=router; \ No newline at end of file +var _0xaccc=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0xb2354f,_0x56d67b){var _0x49def7=function(_0x49e939){while(--_0x49e939){_0xb2354f['push'](_0xb2354f['shift']());}};_0x49def7(++_0x56d67b);}(_0xaccc,0xda));var _0xcacc=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xaccc[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0xcacc('0x0'));var util=require(_0xcacc('0x1'));var path=require(_0xcacc('0x2'));var timeout=require(_0xcacc('0x3'));var express=require(_0xcacc('0x4'));var router=express[_0xcacc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcacc('0x6'));var interaction=require(_0xcacc('0x7'));var config=require(_0xcacc('0x8'));var controller=require(_0xcacc('0x9'));router['get']('/',auth[_0xcacc('0xa')](),controller['index']);router[_0xcacc('0xb')](_0xcacc('0xc'),auth[_0xcacc('0xa')](),controller[_0xcacc('0xd')]);router[_0xcacc('0xe')]('/',auth[_0xcacc('0xa')](),controller[_0xcacc('0xf')]);router[_0xcacc('0x10')](_0xcacc('0xc'),auth[_0xcacc('0xa')](),controller[_0xcacc('0x11')]);router[_0xcacc('0x12')]('/:id',auth[_0xcacc('0xa')](),controller[_0xcacc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0328917..da45870 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 _0xbbe3=['sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x450695,_0x4f9c8a){var _0x36188f=function(_0x2a12e1){while(--_0x2a12e1){_0x450695['push'](_0x450695['shift']());}};_0x36188f(++_0x4f9c8a);}(_0xbbe3,0x132));var _0x3bbe=function(_0xfc4247,_0x2ecea5){_0xfc4247=_0xfc4247-0x0;var _0x1fd11f=_0xbbe3[_0xfc4247];return _0x1fd11f;};'use strict';var moment=require('moment');var Sequelize=require(_0x3bbe('0x0'));module['exports']={'phone':{'type':Sequelize[_0x3bbe('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x3bbe('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3bbe('0x3')],'defaultValue':moment()[_0x3bbe('0x4')](_0x3bbe('0x5'))},'countbusyretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3bbe('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3bbe('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x3bbe('0x6')](0x2)[_0x3bbe('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3bbe('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3bbe('0x6')],'unique':_0x3bbe('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x3bbe('0x6')],'unique':_0x3bbe('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3bbe('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3bbe('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3bbe('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x00e9=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x257b61,_0x16f46c){var _0x1a0f4d=function(_0x29250c){while(--_0x29250c){_0x257b61['push'](_0x257b61['shift']());}};_0x1a0f4d(++_0x16f46c);}(_0x00e9,0x94));var _0x900e=function(_0x201478,_0x169bd5){_0x201478=_0x201478-0x0;var _0x400f93=_0x00e9[_0x201478];return _0x400f93;};'use strict';var moment=require(_0x900e('0x0'));var Sequelize=require(_0x900e('0x1'));module['exports']={'phone':{'type':Sequelize[_0x900e('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x900e('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x900e('0x4')],'defaultValue':moment()[_0x900e('0x5')](_0x900e('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x900e('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x900e('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x900e('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x900e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x900e('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x900e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x900e('0x7')],'unique':_0x900e('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x900e('0x7')],'unique':_0x900e('0x9')},'CampaignId':{'type':Sequelize[_0x900e('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x900e('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x900e('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x900e('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x900e('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4c5e7cb..23b9f04 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 _0x86f4=['$notIn','$like','$notLike','$iLike','$notILike','$any','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','getPreviewRecall','LOCK','CmList','dialActive','getOpenContacts','getVoiceQueues','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','limit','undefined','count','status','set','Content-Range','update','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in'];(function(_0x3e7623,_0x131adc){var _0x29b12a=function(_0x1a4437){while(--_0x1a4437){_0x3e7623['push'](_0x3e7623['shift']());}};_0x29b12a(++_0x131adc);}(_0x86f4,0x18a));var _0x486f=function(_0x47e0d9,_0x193567){_0x47e0d9=_0x47e0d9-0x0;var _0x5ea6e3=_0x86f4[_0x47e0d9];return _0x5ea6e3;};'use strict';var moment=require(_0x486f('0x0'));var _=require(_0x486f('0x1'));var qs=require(_0x486f('0x2'));var logger=require(_0x486f('0x3'))(_0x486f('0x4'));var shared=require(_0x486f('0x5'));var db=require(_0x486f('0x6'))['db'];function respondWithResult(_0x53305d,_0xf8d50f){_0xf8d50f=_0xf8d50f||0xc8;return function(_0x1539b1){if(_0x1539b1){return _0x53305d['status'](_0xf8d50f)[_0x486f('0x7')](_0x1539b1);}};}function respondWithFilteredResult(_0x1adb27,_0x39f767){return function(_0x207201){if(_0x207201){var _0x3c6469=typeof _0x39f767[_0x486f('0x8')]==='undefined'&&typeof _0x39f767[_0x486f('0x9')]===_0x486f('0xa');var _0x37975a=_0x207201[_0x486f('0xb')];var _0x377d09=_0x3c6469?0x0:_0x39f767[_0x486f('0x8')];var _0x19ccdd=_0x3c6469?_0x207201[_0x486f('0xb')]:_0x39f767[_0x486f('0x8')]+_0x39f767[_0x486f('0x9')];var _0xb57b8c;if(_0x19ccdd>=_0x37975a){_0x19ccdd=_0x37975a;_0xb57b8c=0xc8;}else{_0xb57b8c=0xce;}_0x1adb27[_0x486f('0xc')](_0xb57b8c);return _0x1adb27[_0x486f('0xd')](_0x486f('0xe'),_0x377d09+'-'+_0x19ccdd+'/'+_0x37975a)[_0x486f('0x7')](_0x207201);}return null;};}function saveUpdates(_0x4312fb,_0x1c4e55){return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4eb4f9[_0x486f('0xf')](_0x4312fb)['then'](function(_0x46d0a9){return _0x46d0a9;});}return null;};}function handleEntityNotFound(_0x2cc608,_0x1ac871){return function(_0x50bee8){if(!_0x50bee8){_0x2cc608['sendStatus'](0x194);}return _0x50bee8;};}function handleError(_0x11c2af,_0x3a4fef){_0x3a4fef=_0x3a4fef||0x1f4;return function(_0x51334f){logger[_0x486f('0x10')](_0x51334f[_0x486f('0x11')]);if(_0x51334f[_0x486f('0x12')]){delete _0x51334f['name'];}_0x11c2af['status'](_0x3a4fef)[_0x486f('0x13')](_0x51334f);};}exports[_0x486f('0x14')]=function(_0x360cb7,_0x39bfac){var _0x4e68d1={},_0x59deb8={},_0x268eb9={'count':0x0,'rows':[]};var _0x9518=_[_0x486f('0x15')](db[_0x486f('0x16')][_0x486f('0x17')],function(_0x243dbf){return{'name':_0x243dbf[_0x486f('0x18')],'type':_0x243dbf[_0x486f('0x19')][_0x486f('0x1a')]};});_0x59deb8[_0x486f('0x1b')]=_[_0x486f('0x15')](_0x9518,_0x486f('0x12'));_0x59deb8[_0x486f('0x1c')]=_[_0x486f('0x1d')](_0x360cb7[_0x486f('0x1c')]);_0x59deb8[_0x486f('0x1e')]=_['intersection'](_0x59deb8[_0x486f('0x1b')],_0x59deb8[_0x486f('0x1c')]);_0x59deb8[_0x486f('0x1e')]=_[_0x486f('0x1f')](_0x59deb8[_0x486f('0x1e')],[_0x486f('0x20'),_0x486f('0x21'),_0x486f('0x22'),_0x486f('0x23'),_0x486f('0x24'),_0x486f('0x25'),_0x486f('0x26'),_0x486f('0x27'),_0x486f('0x28'),_0x486f('0x29'),_0x486f('0x2a'),_0x486f('0x2b'),_0x486f('0x2c'),_0x486f('0x2d'),_0x486f('0x2e'),_0x486f('0x2f'),_0x486f('0x30'),'$like','$overlap','$contains','$contained',_0x486f('0x31')]);_0x4e68d1['attributes']=_[_0x486f('0x32')](_0x59deb8[_0x486f('0x1b')],qs['fields'](_0x360cb7[_0x486f('0x1c')]['fields']));_0x4e68d1[_0x486f('0x33')]=_0x4e68d1[_0x486f('0x33')][_0x486f('0x34')]?_0x4e68d1[_0x486f('0x33')]:_0x59deb8[_0x486f('0x1b')];if(!_0x360cb7[_0x486f('0x1c')]['hasOwnProperty'](_0x486f('0x35'))){_0x4e68d1[_0x486f('0x9')]=qs[_0x486f('0x9')](_0x360cb7[_0x486f('0x1c')][_0x486f('0x9')]);_0x4e68d1[_0x486f('0x8')]=qs[_0x486f('0x8')](_0x360cb7[_0x486f('0x1c')]['offset']);}_0x4e68d1[_0x486f('0x36')]=qs[_0x486f('0x37')](_0x360cb7['query'][_0x486f('0x37')]);_0x4e68d1[_0x486f('0x38')]=qs[_0x486f('0x1e')](_[_0x486f('0x39')](_0x360cb7[_0x486f('0x1c')],_0x59deb8['filters']),_0x9518);if(_0x360cb7[_0x486f('0x1c')][_0x486f('0x3a')]){_0x4e68d1[_0x486f('0x38')]=_[_0x486f('0x3b')](_0x4e68d1[_0x486f('0x38')],{'$or':_[_0x486f('0x15')](_0x9518,function(_0x2bbcd4){if(_0x2bbcd4['type']!==_0x486f('0x3c')){var _0x219e8a={};_0x219e8a[_0x2bbcd4[_0x486f('0x12')]]={'$like':'%'+_0x360cb7['query']['filter']+'%'};return _0x219e8a;}})});}_0x4e68d1=_[_0x486f('0x3b')]({},_0x4e68d1,_0x360cb7[_0x486f('0x3d')]);var _0x4b80f8={'where':_0x4e68d1[_0x486f('0x38')]};return db['CmHopper'][_0x486f('0xb')](_0x4b80f8)[_0x486f('0x3e')](function(_0x5ca543){_0x268eb9['count']=_0x5ca543;if(_0x360cb7[_0x486f('0x1c')][_0x486f('0x3f')]){_0x4e68d1[_0x486f('0x40')]=[{'all':!![]}];}return db[_0x486f('0x16')][_0x486f('0x41')](_0x4e68d1);})[_0x486f('0x3e')](function(_0x901b9){_0x268eb9[_0x486f('0x42')]=_0x901b9;return _0x268eb9;})[_0x486f('0x3e')](respondWithFilteredResult(_0x39bfac,_0x4e68d1))[_0x486f('0x43')](handleError(_0x39bfac,null));};exports[_0x486f('0x44')]=function(_0x737fee,_0x849116){var _0x43d9be={'raw':!![],'where':{'id':_0x737fee[_0x486f('0x45')]['id']}},_0x4f657e={};_0x4f657e[_0x486f('0x1b')]=_['keys'](db[_0x486f('0x16')][_0x486f('0x17')]);_0x4f657e[_0x486f('0x1c')]=_[_0x486f('0x1d')](_0x737fee[_0x486f('0x1c')]);_0x4f657e[_0x486f('0x1e')]=_[_0x486f('0x32')](_0x4f657e[_0x486f('0x1b')],_0x4f657e[_0x486f('0x1c')]);_0x43d9be['attributes']=_['intersection'](_0x4f657e[_0x486f('0x1b')],qs[_0x486f('0x46')](_0x737fee[_0x486f('0x1c')][_0x486f('0x46')]));_0x43d9be[_0x486f('0x33')]=_0x43d9be[_0x486f('0x33')][_0x486f('0x34')]?_0x43d9be[_0x486f('0x33')]:_0x4f657e[_0x486f('0x1b')];if(_0x737fee['query'][_0x486f('0x3f')]){_0x43d9be[_0x486f('0x40')]=[{'all':!![]}];}_0x43d9be=_[_0x486f('0x3b')]({},_0x43d9be,_0x737fee[_0x486f('0x3d')]);return db['CmHopper'][_0x486f('0x47')](_0x43d9be)['then'](handleEntityNotFound(_0x849116,null))[_0x486f('0x3e')](respondWithResult(_0x849116,null))[_0x486f('0x43')](handleError(_0x849116,null));};exports[_0x486f('0x48')]=function(_0x1fe73f,_0xa57bd6){return db[_0x486f('0x16')]['create'](_0x1fe73f['body'],{})[_0x486f('0x3e')](respondWithResult(_0xa57bd6,0xc9))[_0x486f('0x43')](handleError(_0xa57bd6,null));};exports[_0x486f('0xf')]=function(_0xefe4e4,_0x4dbf30){if(_0xefe4e4[_0x486f('0x49')]['id']){delete _0xefe4e4[_0x486f('0x49')]['id'];}return db[_0x486f('0x16')]['find']({'where':{'id':_0xefe4e4[_0x486f('0x45')]['id']}})[_0x486f('0x3e')](handleEntityNotFound(_0x4dbf30,null))[_0x486f('0x3e')](saveUpdates(_0xefe4e4[_0x486f('0x49')],null))[_0x486f('0x3e')](respondWithResult(_0x4dbf30,null))[_0x486f('0x43')](handleError(_0x4dbf30,null));};exports[_0x486f('0x4a')]=function(_0x21f222,_0x51ca91){return db[_0x486f('0x16')]['describe']()[_0x486f('0x3e')](respondWithResult(_0x51ca91,null))[_0x486f('0x43')](handleError(_0x51ca91,null));};exports[_0x486f('0x4b')]=function(_0x1055cf,_0x34033e){var _0x2e5746;var _0x4d2902=_0x1055cf[_0x486f('0x45')]['id'];return db[_0x486f('0x16')][_0x486f('0x47')]({'where':{'id':_0x1055cf[_0x486f('0x45')]['id']}})[_0x486f('0x3e')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x3e')](function(_0x1bc683){if(_0x1bc683){return _0x1bc683[_0x486f('0x4b')]()[_0x486f('0x3e')](function(_0x5cd989){return _0x5cd989;});}})[_0x486f('0x3e')](function(_0x39f90b){_0x2e5746=_0x39f90b;if(_0x39f90b){if(_0x39f90b[_0x486f('0x4c')]||_0x39f90b['CampaignId']){return db[_0x39f90b[_0x486f('0x4c')]?_0x486f('0x4d'):_0x486f('0x4e')]['find']({'where':{'id':_0x39f90b[_0x486f('0x4c')]?_0x39f90b[_0x486f('0x4c')]:_0x39f90b[_0x486f('0x4f')]},'attributes':['id',_0x486f('0x12')],'raw':!![]});}}})['then'](function(_0x57aac0){var _0x16228a={};if(_0x57aac0){_[_0x486f('0x3b')](_0x16228a,_[_0x486f('0x50')](_0x2e5746[_0x486f('0x51')],[_0x486f('0x52'),_0x486f('0x53'),'id']));_0x16228a[_0x486f('0x54')]=0x15;_0x16228a[_0x486f('0x55')]='deleted';_0x16228a[_0x486f('0x56')]=_0x57aac0['name'];_0x16228a[_0x486f('0x57')]=_0x1055cf[_0x486f('0x58')][_0x486f('0x12')];_0x16228a[_0x486f('0x59')]=_0x1055cf['user']['id'];_0x16228a[_0x486f('0x5a')]=!![];_0x16228a[_0x486f('0x5b')]=moment()[_0x486f('0x5c')](_0x486f('0x5d'));_0x16228a['calleridnum']=_0x2e5746[_0x486f('0x5e')];_0x16228a[_0x486f('0x5f')]=_0x2e5746[_0x486f('0x4c')]?_0x486f('0x60'):_0x486f('0x61');return db[_0x486f('0x62')][_0x486f('0x47')]({'where':{'id':_0x16228a[_0x486f('0x63')]},'attributes':['firstName',_0x486f('0x64')]})[_0x486f('0x3e')](function(_0x5fa282){if(!_[_0x486f('0x65')](_0x34033e)&&!_['isNil'](_0x5fa282[_0x486f('0x66')])){_0x16228a['calleridname']=_0x5fa282[_0x486f('0x66')];if(!_[_0x486f('0x65')](_0x5fa282[_0x486f('0x64')])){_0x16228a[_0x486f('0x67')]+='\x20'+_0x5fa282['lastName'];}}})[_0x486f('0x68')](function(){return db[_0x486f('0x69')][_0x486f('0x48')](_0x16228a);});}})[_0x486f('0x3e')](function(_0x5cf926){return db[_0x486f('0x6a')][_0x486f('0x4b')]({'where':{'CmHopperId':_0x4d2902}});})[_0x486f('0x3e')](function(){return _0x34033e[_0x486f('0xc')](0xcc)[_0x486f('0x6b')]();})[_0x486f('0x43')](handleError(_0x34033e,null));};exports[_0x486f('0x6c')]=function(_0xc78ac9,_0x63c750){var _0x88dbac=[];return db[_0x486f('0x62')][_0x486f('0x4a')]()[_0x486f('0x3e')](function(_0x286141){_0x88dbac=_['keys'](_0x286141);return _0xc78ac9[_0x486f('0x58')]['getVoiceQueues']({'where':{'type':_0x486f('0x6d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x486f('0x6e'),_0x486f('0x6f')],'raw':!![]});})['then'](function(_0x565e9d){if(_0x565e9d&&_0x565e9d[_0x486f('0x34')]){return db['sequelize'][_0x486f('0x70')](function(_0x3648c0){var _0x587fb1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x486f('0x5c')](_0x486f('0x5d'))},'VoiceQueueId':{'$in':_[_0x486f('0x15')](_0x565e9d,'id')},'$or':[{'UserId':null},{'UserId':_0xc78ac9[_0x486f('0x58')]['id']}]};var _0x5118e5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x565e9d)[_0x486f('0x3a')](['dialPreviewAutoRecallMe',0x0])[_0x486f('0x15')]('id')[_0x486f('0x71')]()},'$or':[{'UserId':null},{'UserId':_0xc78ac9[_0x486f('0x58')]['id']}]};var _0x5a1406={'$or':[_0x587fb1,_0x5118e5]};var _0x3c8b40=[];if(_0xc78ac9['body'][_0x486f('0x72')]&&_0xc78ac9['body'][_0x486f('0x72')]===_0x486f('0x73')){if(!_[_0x486f('0x74')](_0xc78ac9[_0x486f('0x49')]['hopperIds'])){_0x5a1406['id']={'$in':_0xc78ac9[_0x486f('0x49')][_0x486f('0x75')]};}_0x3c8b40=[[_0x486f('0x76'),'ASC'],[_0x486f('0x77'),_0x565e9d[0x0][_0x486f('0x6e')]===_0x486f('0x78')?_0x486f('0x79'):'ASC'],db[_0x486f('0x7a')][_0x486f('0x7b')](_0x486f('0x7c')),['id','DESC']];}else{if(!_[_0x486f('0x74')](_0xc78ac9[_0x486f('0x49')][_0x486f('0x75')])){_0x5a1406['id']={'$notIn':_0xc78ac9['body'][_0x486f('0x75')]};}_0x3c8b40=[[_0x486f('0x76'),'DESC'],['scheduledAt',_0x565e9d[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x486f('0x7b')](_0x486f('0x7d')),['id',_0x486f('0x78')]];}return db[_0x486f('0x16')][_0x486f('0x7e')]({'attributes':['id',_0x486f('0x7f'),_0x486f('0x5e'),_0x486f('0x80')],'where':_0x5a1406,'order':_0x3c8b40,'transaction':_0x3648c0,'lock':_0x3648c0['LOCK'][_0x486f('0x81')],'include':[{'model':db[_0x486f('0x62')],'as':_0x486f('0x82'),'attributes':_0x88dbac,'include':[{'model':db[_0x486f('0x83')],'as':_0x486f('0x84'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x486f('0x85'),'attributes':['id',_0x486f('0x12')]},{'model':db['VoiceQueue'],'as':_0x486f('0x86'),'attributes':['id',_0x486f('0x12'),'dialActive']}]})['then'](function(_0x25e5c9){if(_0x25e5c9){return _0x25e5c9[_0x486f('0xf')]({'UserId':_0xc78ac9[_0x486f('0x58')]['id']},{'transaction':_0x3648c0});}});});}})[_0x486f('0x3e')](handleEntityNotFound(_0x63c750,null))[_0x486f('0x3e')](respondWithResult(_0x63c750,null))[_0x486f('0x43')](handleError(_0x63c750,null));};exports[_0x486f('0x87')]=function(_0x5bff5d,_0x4d4b67,_0x63ab8a){var _0x48cb52=[];var _0xdef0af=_0x5bff5d['params']['id'];var _0xcf9385=_0x5bff5d['user']['id'];return db['CmContact'][_0x486f('0x4a')]()['then'](function(_0x4fc8bd){_0x48cb52=_[_0x486f('0x1d')](_0x4fc8bd);return db['sequelize'][_0x486f('0x70')](function(_0x5961c3){const _0x1d1eb4={'id':_0xdef0af};return db[_0x486f('0x16')][_0x486f('0x7e')]({'attributes':['id',_0x486f('0x7f'),'recallme'],'where':_0x1d1eb4,'transaction':_0x5961c3,'lock':_0x5961c3[_0x486f('0x88')][_0x486f('0x81')],'include':[{'model':db['CmContact'],'as':_0x486f('0x82'),'attributes':_0x48cb52,'include':[{'model':db['CmCompany'],'as':_0x486f('0x84'),'attributes':['id','name']}]},{'model':db[_0x486f('0x89')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x486f('0x86'),'attributes':['id',_0x486f('0x12'),_0x486f('0x8a')]}]})[_0x486f('0x3e')](function(_0x22a426){if(_0x22a426){return _0x22a426[_0x486f('0xf')]({'UserId':_0xcf9385},{'transaction':_0x5961c3});}});});})[_0x486f('0x3e')](handleEntityNotFound(_0x4d4b67,null))[_0x486f('0x3e')](respondWithResult(_0x4d4b67,null))[_0x486f('0x43')](handleError(_0x4d4b67,null));};exports[_0x486f('0x8b')]=function(_0x4f2213,_0x1022de){return _0x4f2213[_0x486f('0x58')][_0x486f('0x8c')]({'where':{'type':_0x486f('0x6d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x486f('0x3e')](function(_0x5c2d46){if(_0x5c2d46&&_0x5c2d46[_0x486f('0x34')]){return db[_0x486f('0x16')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x486f('0x15')](_0x5c2d46,'id')},'$or':[{'UserId':null},{'UserId':_0x4f2213[_0x486f('0x58')]['id']}]}});}return 0x0;})[_0x486f('0x3e')](function(_0x4a0510){if(!_['isNil'](_0x4a0510)&&_['isNumber'](_0x4a0510)){return _0x1022de[_0x486f('0xc')](0xc8)['json']({'contacts':_0x4a0510});}else{logger[_0x486f('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x486f('0x8b'),0x194,'entity\x20not\x20found');_0x1022de[_0x486f('0x8d')](0x194);}})[_0x486f('0x43')](handleError(_0x1022de,null));};exports[_0x486f('0x8e')]=function(_0x13832f,_0x196437){var _0x157976=shared[_0x486f('0x8f')];var _0x201541=[];_['map'](_0x157976,function(_0xd42cf4){_0x201541['push']({'id':_0xd42cf4[_0x486f('0x12')],'name':_0xd42cf4['name'],'utcOffset':_0xd42cf4[_0x486f('0x90')]});});return _0x196437[_0x486f('0xc')](0xc8)['json']({'tz':_0x201541});};exports[_0x486f('0x91')]=function(_0x345490,_0x140d8d){var _0x58f864=shared[_0x486f('0x8f')];var _0x294127={};if(!_[_0x486f('0x65')](_0x58f864[_0x345490['body']['id']]))_0x294127=_0x58f864[_0x345490['body']['id']];return _0x140d8d[_0x486f('0xc')](0xc8)[_0x486f('0x7')](_0x294127);}; \ No newline at end of file +var _0xa3e6=['ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','create','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','getPreviewRecall','LOCK','CmList','List','error','getOpenContacts','entity\x20not\x20found','push','utcOffset','timezones','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','stack','name','map','CmHopper','rawAttributes','fieldName','key','query','keys','intersection','model','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','params','fields','find','catch','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','deleted','campaign','membername','user','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype'];(function(_0x443317,_0x482e44){var _0x39dd9c=function(_0x466f04){while(--_0x466f04){_0x443317['push'](_0x443317['shift']());}};_0x39dd9c(++_0x482e44);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x190e4f,_0x334f46){_0x190e4f=_0x190e4f-0x0;var _0x27a170=_0xa3e6[_0x190e4f];return _0x27a170;};'use strict';var moment=require(_0x6a3e('0x0'));var _=require('lodash');var qs=require(_0x6a3e('0x1'));var logger=require('../../config/logger')(_0x6a3e('0x2'));var shared=require(_0x6a3e('0x3'));var db=require(_0x6a3e('0x4'))['db'];function respondWithResult(_0x56e3f4,_0xe03261){_0xe03261=_0xe03261||0xc8;return function(_0x5e9a85){if(_0x5e9a85){return _0x56e3f4[_0x6a3e('0x5')](_0xe03261)[_0x6a3e('0x6')](_0x5e9a85);}};}function respondWithFilteredResult(_0x1c7709,_0x315ed8){return function(_0x19dd88){if(_0x19dd88){var _0x52a2f8=typeof _0x315ed8[_0x6a3e('0x7')]===_0x6a3e('0x8')&&typeof _0x315ed8['limit']==='undefined';var _0x2d2477=_0x19dd88['count'];var _0x54a40c=_0x52a2f8?0x0:_0x315ed8[_0x6a3e('0x7')];var _0x4f5a4a=_0x52a2f8?_0x19dd88[_0x6a3e('0x9')]:_0x315ed8['offset']+_0x315ed8[_0x6a3e('0xa')];var _0x3159db;if(_0x4f5a4a>=_0x2d2477){_0x4f5a4a=_0x2d2477;_0x3159db=0xc8;}else{_0x3159db=0xce;}_0x1c7709[_0x6a3e('0x5')](_0x3159db);return _0x1c7709[_0x6a3e('0xb')](_0x6a3e('0xc'),_0x54a40c+'-'+_0x4f5a4a+'/'+_0x2d2477)[_0x6a3e('0x6')](_0x19dd88);}return null;};}function saveUpdates(_0x4a3a97,_0x27e169){return function(_0x385c29){if(_0x385c29){return _0x385c29[_0x6a3e('0xd')](_0x4a3a97)[_0x6a3e('0xe')](function(_0x1364be){return _0x1364be;});}return null;};}function handleEntityNotFound(_0x31aefa,_0x222f7c){return function(_0x4bd05f){if(!_0x4bd05f){_0x31aefa[_0x6a3e('0xf')](0x194);}return _0x4bd05f;};}function handleError(_0x13b172,_0x8ed74b){_0x8ed74b=_0x8ed74b||0x1f4;return function(_0x2a62a8){logger['error'](_0x2a62a8[_0x6a3e('0x10')]);if(_0x2a62a8[_0x6a3e('0x11')]){delete _0x2a62a8['name'];}_0x13b172['status'](_0x8ed74b)['send'](_0x2a62a8);};}exports['index']=function(_0x48adf6,_0x3693a2){var _0x467e2c={},_0x31a190={},_0x701d04={'count':0x0,'rows':[]};var _0x17fde0=_[_0x6a3e('0x12')](db[_0x6a3e('0x13')][_0x6a3e('0x14')],function(_0x493454){return{'name':_0x493454[_0x6a3e('0x15')],'type':_0x493454['type'][_0x6a3e('0x16')]};});_0x31a190['model']=_[_0x6a3e('0x12')](_0x17fde0,_0x6a3e('0x11'));_0x31a190[_0x6a3e('0x17')]=_[_0x6a3e('0x18')](_0x48adf6['query']);_0x31a190['filters']=_[_0x6a3e('0x19')](_0x31a190[_0x6a3e('0x1a')],_0x31a190[_0x6a3e('0x17')]);_0x31a190[_0x6a3e('0x1b')]=_[_0x6a3e('0x1c')](_0x31a190[_0x6a3e('0x1b')],[_0x6a3e('0x1d'),_0x6a3e('0x1e'),_0x6a3e('0x1f'),_0x6a3e('0x20'),_0x6a3e('0x21'),_0x6a3e('0x22'),_0x6a3e('0x23'),_0x6a3e('0x24'),_0x6a3e('0x25'),'$between','$notBetween',_0x6a3e('0x26'),_0x6a3e('0x27'),_0x6a3e('0x28'),_0x6a3e('0x29'),_0x6a3e('0x2a'),_0x6a3e('0x2b'),_0x6a3e('0x28'),_0x6a3e('0x2c'),_0x6a3e('0x2d'),_0x6a3e('0x2e'),_0x6a3e('0x2f')]);_0x467e2c['attributes']=_['intersection'](_0x31a190[_0x6a3e('0x1a')],qs['fields'](_0x48adf6[_0x6a3e('0x17')]['fields']));_0x467e2c['attributes']=_0x467e2c[_0x6a3e('0x30')][_0x6a3e('0x31')]?_0x467e2c['attributes']:_0x31a190['model'];if(!_0x48adf6[_0x6a3e('0x17')][_0x6a3e('0x32')](_0x6a3e('0x33'))){_0x467e2c[_0x6a3e('0xa')]=qs['limit'](_0x48adf6['query'][_0x6a3e('0xa')]);_0x467e2c[_0x6a3e('0x7')]=qs[_0x6a3e('0x7')](_0x48adf6[_0x6a3e('0x17')]['offset']);}_0x467e2c[_0x6a3e('0x34')]=qs[_0x6a3e('0x35')](_0x48adf6['query']['sort']);_0x467e2c['where']=qs[_0x6a3e('0x1b')](_[_0x6a3e('0x36')](_0x48adf6[_0x6a3e('0x17')],_0x31a190[_0x6a3e('0x1b')]),_0x17fde0);if(_0x48adf6[_0x6a3e('0x17')][_0x6a3e('0x37')]){_0x467e2c[_0x6a3e('0x38')]=_[_0x6a3e('0x39')](_0x467e2c[_0x6a3e('0x38')],{'$or':_[_0x6a3e('0x12')](_0x17fde0,function(_0xe442a9){if(_0xe442a9[_0x6a3e('0x3a')]!==_0x6a3e('0x3b')){var _0x12469a={};_0x12469a[_0xe442a9[_0x6a3e('0x11')]]={'$like':'%'+_0x48adf6['query'][_0x6a3e('0x37')]+'%'};return _0x12469a;}})});}_0x467e2c=_[_0x6a3e('0x39')]({},_0x467e2c,_0x48adf6[_0x6a3e('0x3c')]);var _0x5cf995={'where':_0x467e2c[_0x6a3e('0x38')]};return db[_0x6a3e('0x13')]['count'](_0x5cf995)[_0x6a3e('0xe')](function(_0x3f7e1){_0x701d04[_0x6a3e('0x9')]=_0x3f7e1;if(_0x48adf6['query'][_0x6a3e('0x3d')]){_0x467e2c[_0x6a3e('0x3e')]=[{'all':!![]}];}return db[_0x6a3e('0x13')][_0x6a3e('0x3f')](_0x467e2c);})[_0x6a3e('0xe')](function(_0x1f7d13){_0x701d04['rows']=_0x1f7d13;return _0x701d04;})[_0x6a3e('0xe')](respondWithFilteredResult(_0x3693a2,_0x467e2c))['catch'](handleError(_0x3693a2,null));};exports['show']=function(_0x4bc630,_0xfbbb78){var _0x4bb1ba={'raw':!![],'where':{'id':_0x4bc630[_0x6a3e('0x40')]['id']}},_0x1a6b68={};_0x1a6b68[_0x6a3e('0x1a')]=_[_0x6a3e('0x18')](db[_0x6a3e('0x13')][_0x6a3e('0x14')]);_0x1a6b68['query']=_['keys'](_0x4bc630[_0x6a3e('0x17')]);_0x1a6b68[_0x6a3e('0x1b')]=_[_0x6a3e('0x19')](_0x1a6b68[_0x6a3e('0x1a')],_0x1a6b68[_0x6a3e('0x17')]);_0x4bb1ba['attributes']=_[_0x6a3e('0x19')](_0x1a6b68[_0x6a3e('0x1a')],qs['fields'](_0x4bc630[_0x6a3e('0x17')][_0x6a3e('0x41')]));_0x4bb1ba[_0x6a3e('0x30')]=_0x4bb1ba['attributes'][_0x6a3e('0x31')]?_0x4bb1ba[_0x6a3e('0x30')]:_0x1a6b68[_0x6a3e('0x1a')];if(_0x4bc630[_0x6a3e('0x17')][_0x6a3e('0x3d')]){_0x4bb1ba[_0x6a3e('0x3e')]=[{'all':!![]}];}_0x4bb1ba=_['merge']({},_0x4bb1ba,_0x4bc630[_0x6a3e('0x3c')]);return db[_0x6a3e('0x13')][_0x6a3e('0x42')](_0x4bb1ba)['then'](handleEntityNotFound(_0xfbbb78,null))[_0x6a3e('0xe')](respondWithResult(_0xfbbb78,null))['catch'](handleError(_0xfbbb78,null));};exports['create']=function(_0x1b801e,_0x2788a8){return db[_0x6a3e('0x13')]['create'](_0x1b801e['body'],{})[_0x6a3e('0xe')](respondWithResult(_0x2788a8,0xc9))[_0x6a3e('0x43')](handleError(_0x2788a8,null));};exports[_0x6a3e('0xd')]=function(_0x320530,_0x1c9f75){if(_0x320530[_0x6a3e('0x44')]['id']){delete _0x320530['body']['id'];}return db[_0x6a3e('0x13')][_0x6a3e('0x42')]({'where':{'id':_0x320530[_0x6a3e('0x40')]['id']}})[_0x6a3e('0xe')](handleEntityNotFound(_0x1c9f75,null))[_0x6a3e('0xe')](saveUpdates(_0x320530[_0x6a3e('0x44')],null))[_0x6a3e('0xe')](respondWithResult(_0x1c9f75,null))[_0x6a3e('0x43')](handleError(_0x1c9f75,null));};exports[_0x6a3e('0x45')]=function(_0x4d36e2,_0x40a09d){return db[_0x6a3e('0x13')]['describe']()[_0x6a3e('0xe')](respondWithResult(_0x40a09d,null))['catch'](handleError(_0x40a09d,null));};exports[_0x6a3e('0x46')]=function(_0x10cd8e,_0x28a3e9){var _0x4f288d;var _0x25fa0c=_0x10cd8e[_0x6a3e('0x40')]['id'];return db['CmHopper']['find']({'where':{'id':_0x10cd8e['params']['id']}})[_0x6a3e('0xe')](handleEntityNotFound(_0x28a3e9,null))[_0x6a3e('0xe')](function(_0x32fb36){if(_0x32fb36){return _0x32fb36[_0x6a3e('0x46')]()[_0x6a3e('0xe')](function(_0x448e46){return _0x448e46;});}})[_0x6a3e('0xe')](function(_0x1ce964){_0x4f288d=_0x1ce964;if(_0x1ce964){if(_0x1ce964[_0x6a3e('0x47')]||_0x1ce964[_0x6a3e('0x48')]){return db[_0x1ce964[_0x6a3e('0x47')]?'VoiceQueue':_0x6a3e('0x49')][_0x6a3e('0x42')]({'where':{'id':_0x1ce964[_0x6a3e('0x47')]?_0x1ce964[_0x6a3e('0x47')]:_0x1ce964[_0x6a3e('0x48')]},'attributes':['id','name'],'raw':!![]});}}})[_0x6a3e('0xe')](function(_0x4d1882){var _0x1afa0a={};if(_0x4d1882){_[_0x6a3e('0x39')](_0x1afa0a,_[_0x6a3e('0x4a')](_0x4f288d[_0x6a3e('0x4b')],[_0x6a3e('0x4c'),'updatedAt','id']));_0x1afa0a['state']=0x15;_0x1afa0a['statedesc']=_0x6a3e('0x4d');_0x1afa0a[_0x6a3e('0x4e')]=_0x4d1882[_0x6a3e('0x11')];_0x1afa0a[_0x6a3e('0x4f')]=_0x10cd8e[_0x6a3e('0x50')][_0x6a3e('0x11')];_0x1afa0a['UserId']=_0x10cd8e[_0x6a3e('0x50')]['id'];_0x1afa0a['deleted']=!![];_0x1afa0a['deletedat']=moment()['format'](_0x6a3e('0x51'));_0x1afa0a[_0x6a3e('0x52')]=_0x4f288d['phone'];_0x1afa0a[_0x6a3e('0x53')]=_0x4f288d[_0x6a3e('0x47')]?'queue':_0x6a3e('0x54');return db[_0x6a3e('0x55')][_0x6a3e('0x42')]({'where':{'id':_0x1afa0a[_0x6a3e('0x56')]},'attributes':[_0x6a3e('0x57'),'lastName']})[_0x6a3e('0xe')](function(_0x9128f8){if(!_['isNil'](_0x28a3e9)&&!_[_0x6a3e('0x58')](_0x9128f8[_0x6a3e('0x57')])){_0x1afa0a[_0x6a3e('0x59')]=_0x9128f8[_0x6a3e('0x57')];if(!_[_0x6a3e('0x58')](_0x9128f8[_0x6a3e('0x5a')])){_0x1afa0a[_0x6a3e('0x59')]+='\x20'+_0x9128f8[_0x6a3e('0x5a')];}}})[_0x6a3e('0x5b')](function(){return db[_0x6a3e('0x5c')][_0x6a3e('0x5d')](_0x1afa0a);});}})['then'](function(_0x2870be){return db[_0x6a3e('0x5e')][_0x6a3e('0x46')]({'where':{'CmHopperId':_0x25fa0c}});})['then'](function(){return _0x28a3e9[_0x6a3e('0x5')](0xcc)[_0x6a3e('0x5f')]();})[_0x6a3e('0x43')](handleError(_0x28a3e9,null));};exports[_0x6a3e('0x60')]=function(_0x582ad9,_0x3e29a8){var _0x5ed33d=[];return db[_0x6a3e('0x55')]['describe']()[_0x6a3e('0xe')](function(_0x486d4a){_0x5ed33d=_[_0x6a3e('0x18')](_0x486d4a);return _0x582ad9[_0x6a3e('0x50')][_0x6a3e('0x61')]({'where':{'type':_0x6a3e('0x62'),'dialActive':!![],'dialMethod':_0x6a3e('0x63')},'attributes':['id',_0x6a3e('0x64'),_0x6a3e('0x65')],'raw':!![]});})['then'](function(_0x3a5f9d){if(_0x3a5f9d&&_0x3a5f9d[_0x6a3e('0x31')]){return db[_0x6a3e('0x66')][_0x6a3e('0x67')](function(_0x145655){var _0x3a4a29={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a3e('0x68')](_0x6a3e('0x51'))},'VoiceQueueId':{'$in':_[_0x6a3e('0x12')](_0x3a5f9d,'id')},'$or':[{'UserId':null},{'UserId':_0x582ad9[_0x6a3e('0x50')]['id']}]};var _0x3c7bd0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3a5f9d)[_0x6a3e('0x37')](['dialPreviewAutoRecallMe',0x0])[_0x6a3e('0x12')]('id')[_0x6a3e('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x582ad9[_0x6a3e('0x50')]['id']}]};var _0x5d11f9={'$or':[_0x3a4a29,_0x3c7bd0]};var _0x4420b9=[];if(_0x582ad9['body'][_0x6a3e('0x6a')]&&_0x582ad9[_0x6a3e('0x44')]['direction']===_0x6a3e('0x6b')){if(!_[_0x6a3e('0x6c')](_0x582ad9['body'][_0x6a3e('0x6d')])){_0x5d11f9['id']={'$in':_0x582ad9[_0x6a3e('0x44')][_0x6a3e('0x6d')]};}_0x4420b9=[[_0x6a3e('0x6e'),_0x6a3e('0x6f')],['scheduledAt',_0x3a5f9d[0x0][_0x6a3e('0x64')]==='ASC'?_0x6a3e('0x70'):'ASC'],db[_0x6a3e('0x66')][_0x6a3e('0x71')](_0x6a3e('0x72')),['id',_0x6a3e('0x70')]];}else{if(!_['isEmpty'](_0x582ad9['body'][_0x6a3e('0x6d')])){_0x5d11f9['id']={'$notIn':_0x582ad9[_0x6a3e('0x44')]['hopperIds']};}_0x4420b9=[[_0x6a3e('0x6e'),_0x6a3e('0x70')],[_0x6a3e('0x73'),_0x3a5f9d[0x0][_0x6a3e('0x64')]],db[_0x6a3e('0x66')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6a3e('0x6f')]];}return db[_0x6a3e('0x13')][_0x6a3e('0x74')]({'attributes':['id',_0x6a3e('0x75'),_0x6a3e('0x76'),_0x6a3e('0x77')],'where':_0x5d11f9,'order':_0x4420b9,'transaction':_0x145655,'lock':_0x145655['LOCK'][_0x6a3e('0x78')],'include':[{'model':db[_0x6a3e('0x55')],'as':_0x6a3e('0x79'),'attributes':_0x5ed33d,'include':[{'model':db[_0x6a3e('0x7a')],'as':_0x6a3e('0x7b'),'attributes':['id',_0x6a3e('0x11')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x6a3e('0x11')]},{'model':db[_0x6a3e('0x7c')],'as':_0x6a3e('0x7d'),'attributes':['id',_0x6a3e('0x11'),_0x6a3e('0x7e')]}]})[_0x6a3e('0xe')](function(_0x2208e9){if(_0x2208e9){return _0x2208e9[_0x6a3e('0xd')]({'UserId':_0x582ad9[_0x6a3e('0x50')]['id']},{'transaction':_0x145655});}});});}})['then'](handleEntityNotFound(_0x3e29a8,null))[_0x6a3e('0xe')](respondWithResult(_0x3e29a8,null))[_0x6a3e('0x43')](handleError(_0x3e29a8,null));};exports[_0x6a3e('0x7f')]=function(_0x2e8af7,_0x35bbfe,_0x281fba){var _0x7e983a=[];var _0x687f86=_0x2e8af7['params']['id'];var _0x477bfb=_0x2e8af7['user']['id'];return db['CmContact'][_0x6a3e('0x45')]()[_0x6a3e('0xe')](function(_0x3f68c6){_0x7e983a=_['keys'](_0x3f68c6);return db[_0x6a3e('0x66')][_0x6a3e('0x67')](function(_0x20fdf4){const _0x672d9d={'id':_0x687f86};return db[_0x6a3e('0x13')][_0x6a3e('0x74')]({'attributes':['id',_0x6a3e('0x75'),_0x6a3e('0x77')],'where':_0x672d9d,'transaction':_0x20fdf4,'lock':_0x20fdf4[_0x6a3e('0x80')]['UPDATE'],'include':[{'model':db[_0x6a3e('0x55')],'as':_0x6a3e('0x79'),'attributes':_0x7e983a,'include':[{'model':db[_0x6a3e('0x7a')],'as':_0x6a3e('0x7b'),'attributes':['id',_0x6a3e('0x11')]}]},{'model':db[_0x6a3e('0x81')],'as':_0x6a3e('0x82'),'attributes':['id',_0x6a3e('0x11')]},{'model':db[_0x6a3e('0x7c')],'as':_0x6a3e('0x7d'),'attributes':['id',_0x6a3e('0x11'),'dialActive']}]})['then'](function(_0x5148de){if(_0x5148de){return _0x5148de[_0x6a3e('0xd')]({'UserId':_0x477bfb},{'transaction':_0x20fdf4});}});});})['then'](handleEntityNotFound(_0x35bbfe,null))['then'](respondWithResult(_0x35bbfe,null))[_0x6a3e('0x43')](handleError(_0x35bbfe,null));};exports['getOpenContacts']=function(_0x1029f9,_0x7bf1b2){return _0x1029f9[_0x6a3e('0x50')][_0x6a3e('0x61')]({'where':{'type':_0x6a3e('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6a3e('0xe')](function(_0x5bb624){if(_0x5bb624&&_0x5bb624[_0x6a3e('0x31')]){return db[_0x6a3e('0x13')][_0x6a3e('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a3e('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x5bb624,'id')},'$or':[{'UserId':null},{'UserId':_0x1029f9[_0x6a3e('0x50')]['id']}]}});}return 0x0;})[_0x6a3e('0xe')](function(_0x242f2e){if(!_[_0x6a3e('0x58')](_0x242f2e)&&_['isNumber'](_0x242f2e)){return _0x7bf1b2[_0x6a3e('0x5')](0xc8)[_0x6a3e('0x6')]({'contacts':_0x242f2e});}else{logger[_0x6a3e('0x83')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x6a3e('0x84'),0x194,_0x6a3e('0x85'));_0x7bf1b2[_0x6a3e('0xf')](0x194);}})['catch'](handleError(_0x7bf1b2,null));};exports['getTimezones']=function(_0x242c45,_0xe89e40){var _0x35cefc=shared['timezones'];var _0xb9d497=[];_[_0x6a3e('0x12')](_0x35cefc,function(_0x5bf103){_0xb9d497[_0x6a3e('0x86')]({'id':_0x5bf103[_0x6a3e('0x11')],'name':_0x5bf103[_0x6a3e('0x11')],'utcOffset':_0x5bf103[_0x6a3e('0x87')]});});return _0xe89e40['status'](0xc8)['json']({'tz':_0xb9d497});};exports['getTimezone']=function(_0x4b71f4,_0x515764){var _0x32aefd=shared[_0x6a3e('0x88')];var _0x442eca={};if(!_[_0x6a3e('0x58')](_0x32aefd[_0x4b71f4[_0x6a3e('0x44')]['id']]))_0x442eca=_0x32aefd[_0x4b71f4['body']['id']];return _0x515764[_0x6a3e('0x5')](0xc8)[_0x6a3e('0x6')](_0x442eca);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 286d9fa..8cf3447 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 _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xd117,0x182));var _0x7d11=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xd117[_0x1c3370];return _0xa9b358;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'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(_0x7ddc6c,_0x3bfc86){var _0x230525=function(_0x5d575a){while(--_0x5d575a){_0x7ddc6c['push'](_0x7ddc6c['shift']());}};_0x230525(++_0x3bfc86);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1e4402,_0x32108d){_0x1e4402=_0x1e4402-0x0;var _0x46d98c=_0xc1c6[_0x1e4402];return _0x46d98c;};'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 8196ecc..6a9ac23 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 _0x1179=['GetContactDialer','transaction','order','LOCK','CmContact','Contact','keys','User','Agent','length','UserId','includes','push','all','dataValues','sequelize','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UPDATE','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','voicePause','CmList','List','lodash','util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','limit','map','model','attributes','include','then','catch','error','message','ShowCmHopper','stringify','CreateCmHopper','body','info','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','where','active','debug','DestroyCmHopper'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1179,0x7e));var _0x9117=function(_0x142276,_0x8029bf){_0x142276=_0x142276-0x0;var _0x1ecd95=_0x1179[_0x142276];return _0x1ecd95;};'use strict';var _=require(_0x9117('0x0'));var util=require(_0x9117('0x1'));var moment=require(_0x9117('0x2'));var BPromise=require('bluebird');var db=require(_0x9117('0x3'))['db'];var logger=require(_0x9117('0x4'))(_0x9117('0x5'));exports[_0x9117('0x6')]=function(_0x258c31){var _0x426feb=this;return new Promise(function(_0x425894,_0x212cf5){return db[_0x9117('0x7')][_0x9117('0x8')]({'raw':_0x258c31[_0x9117('0x9')]?_0x258c31['options'][_0x9117('0xa')]===undefined?!![]:![]:!![],'where':_0x258c31[_0x9117('0x9')]?_0x258c31['options']['where']||null:null,'attributes':_0x258c31['options']?_0x258c31[_0x9117('0x9')]['attributes']||null:null,'limit':_0x258c31[_0x9117('0x9')]?_0x258c31[_0x9117('0x9')][_0x9117('0xb')]||null:null,'include':_0x258c31[_0x9117('0x9')]?_0x258c31['options']['include']?_[_0x9117('0xc')](_0x258c31[_0x9117('0x9')]['include'],function(_0x1d36e1){return{'model':db[_0x1d36e1[_0x9117('0xd')]],'as':_0x1d36e1['as'],'attributes':_0x1d36e1[_0x9117('0xe')],'include':_0x1d36e1[_0x9117('0xf')]?_['map'](_0x1d36e1[_0x9117('0xf')],function(_0x4ec3b3){return{'model':db[_0x4ec3b3[_0x9117('0xd')]],'as':_0x4ec3b3['as'],'attributes':_0x4ec3b3[_0x9117('0xe')],'include':_0x4ec3b3[_0x9117('0xf')]?_[_0x9117('0xc')](_0x4ec3b3[_0x9117('0xf')],function(_0x3175e2){return{'model':db[_0x3175e2['model']],'as':_0x3175e2['as'],'attributes':_0x3175e2[_0x9117('0xe')]};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x3f71fd){logger['info']('GetCmHopper',_0x258c31);logger['debug'](_0x9117('0x6'),_0x258c31,JSON['stringify'](_0x3f71fd));_0x425894(_0x3f71fd);})[_0x9117('0x11')](function(_0xc44031){logger[_0x9117('0x12')](_0x9117('0x6'),_0xc44031[_0x9117('0x13')],_0x258c31);_0x212cf5(_0x426feb[_0x9117('0x12')](0x1f4,_0xc44031[_0x9117('0x13')]));});});};exports['ShowCmHopper']=function(_0x3f404c){var _0x47543c=this;return new Promise(function(_0x1436bd,_0x413260){return db[_0x9117('0x7')]['find']({'raw':_0x3f404c[_0x9117('0x9')]?_0x3f404c[_0x9117('0x9')][_0x9117('0xa')]===undefined?!![]:![]:!![],'where':_0x3f404c[_0x9117('0x9')]?_0x3f404c[_0x9117('0x9')]['where']||null:null,'attributes':_0x3f404c[_0x9117('0x9')]?_0x3f404c['options'][_0x9117('0xe')]||null:null,'include':_0x3f404c[_0x9117('0x9')]?_0x3f404c[_0x9117('0x9')][_0x9117('0xf')]?_[_0x9117('0xc')](_0x3f404c[_0x9117('0x9')][_0x9117('0xf')],function(_0x414ed6){return{'model':db[_0x414ed6['model']],'as':_0x414ed6['as'],'attributes':_0x414ed6[_0x9117('0xe')],'include':_0x414ed6[_0x9117('0xf')]?_[_0x9117('0xc')](_0x414ed6['include'],function(_0x26844c){return{'model':db[_0x26844c[_0x9117('0xd')]],'as':_0x26844c['as'],'attributes':_0x26844c[_0x9117('0xe')],'include':_0x26844c['include']?_[_0x9117('0xc')](_0x26844c['include'],function(_0x5bc372){return{'model':db[_0x5bc372[_0x9117('0xd')]],'as':_0x5bc372['as'],'attributes':_0x5bc372[_0x9117('0xe')]};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x4d9367){logger['info']('ShowCmHopper',_0x3f404c);logger['debug'](_0x9117('0x14'),_0x3f404c,JSON[_0x9117('0x15')](_0x4d9367));_0x1436bd(_0x4d9367);})[_0x9117('0x11')](function(_0x16e354){logger[_0x9117('0x12')]('ShowCmHopper',_0x16e354[_0x9117('0x13')],_0x3f404c);_0x413260(_0x47543c[_0x9117('0x12')](0x1f4,_0x16e354['message']));});});};exports[_0x9117('0x16')]=function(_0xdf5025){var _0x1633a9=this;return new Promise(function(_0x51c730,_0x2e7b2b){return db[_0x9117('0x7')]['create'](_0xdf5025[_0x9117('0x17')],{'raw':_0xdf5025['options']?_0xdf5025[_0x9117('0x9')][_0x9117('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x3d6ce5){logger[_0x9117('0x18')](_0x9117('0x16'),_0xdf5025);logger['debug'](_0x9117('0x16'),_0xdf5025,JSON[_0x9117('0x15')](_0x3d6ce5));_0x51c730(_0x3d6ce5);})[_0x9117('0x11')](function(_0x2b5b79){logger['error'](_0x9117('0x16'),_0x2b5b79[_0x9117('0x13')],_0xdf5025);_0x2e7b2b(_0x1633a9[_0x9117('0x12')](0x1f4,_0x2b5b79[_0x9117('0x13')]));});});};exports[_0x9117('0x19')]=function(_0x4c558b){var _0x18ba6d=this;return new Promise(function(_0x5f3b77,_0xd93b5f){return db[_0x9117('0x7')][_0x9117('0x1a')](_0x4c558b[_0x9117('0x17')],{'raw':_0x4c558b[_0x9117('0x9')]?_0x4c558b[_0x9117('0x9')][_0x9117('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c558b[_0x9117('0x9')]?_0x4c558b[_0x9117('0x9')]['where']||null:null,'attributes':_0x4c558b[_0x9117('0x9')]?_0x4c558b[_0x9117('0x9')][_0x9117('0xe')]||null:null,'limit':_0x4c558b['options']?_0x4c558b['options'][_0x9117('0xb')]||null:null})[_0x9117('0x10')](function(_0x4de4d3){logger[_0x9117('0x18')](_0x9117('0x19'),_0x4c558b);logger['info'](_0x9117('0x1b'),JSON[_0x9117('0x15')](_0x4c558b[_0x9117('0x9')][_0x9117('0x1c')]),_0x4c558b[_0x9117('0x17')][_0x9117('0x1d')]);logger[_0x9117('0x1e')]('UpdateCmHopper',_0x4c558b,JSON[_0x9117('0x15')](_0x4de4d3));_0x5f3b77(_0x4de4d3);})[_0x9117('0x11')](function(_0x3ca222){logger[_0x9117('0x12')](_0x9117('0x19'),_0x3ca222[_0x9117('0x13')],_0x4c558b);_0xd93b5f(_0x18ba6d[_0x9117('0x12')](0x1f4,_0x3ca222[_0x9117('0x13')]));});});};exports[_0x9117('0x1f')]=function(_0x49ebde){var _0xf6c18=this;return new Promise(function(_0x44f7c0,_0x24982f){return db[_0x9117('0x7')]['destroy']({'where':_0x49ebde[_0x9117('0x9')]?_0x49ebde[_0x9117('0x9')][_0x9117('0x1c')]||null:null})['then'](function(_0x31b9c8){logger[_0x9117('0x18')]('DestroyCmHopper',_0x49ebde);logger['debug'](_0x9117('0x1f'),_0x49ebde,JSON[_0x9117('0x15')](_0x31b9c8));_0x44f7c0(_0x31b9c8);})['catch'](function(_0x3b4437){logger[_0x9117('0x12')]('DestroyCmHopper',_0x3b4437[_0x9117('0x13')],_0x49ebde);_0x24982f(_0xf6c18[_0x9117('0x12')](0x1f4,_0x3b4437[_0x9117('0x13')]));});});};exports[_0x9117('0x20')]=function(_0x5c0ef6){var _0x4364de=this;return new Promise(function(_0x2bc3f4,_0x44abf2){return db['CmContact']['describe']()['then'](function(_0x4b30cf){return db['sequelize'][_0x9117('0x21')](function(_0x5ef0a3){return db[_0x9117('0x7')][_0x9117('0x8')]({'where':_0x5c0ef6['options']?_0x5c0ef6[_0x9117('0x9')][_0x9117('0x1c')]||null:null,'attributes':_0x5c0ef6[_0x9117('0x9')]?_0x5c0ef6[_0x9117('0x9')][_0x9117('0xe')]||null:null,'limit':_0x5c0ef6[_0x9117('0x9')]?_0x5c0ef6['options'][_0x9117('0xb')]||null:null,'order':_0x5c0ef6[_0x9117('0x9')]?_0x5c0ef6['options'][_0x9117('0x22')]||null:null,'transaction':_0x5ef0a3,'lock':_0x5ef0a3[_0x9117('0x23')]['UPDATE'],'include':[{'model':db[_0x9117('0x24')],'as':_0x9117('0x25'),'attributes':_[_0x9117('0x26')](_0x4b30cf)},{'model':db[_0x9117('0x27')],'as':_0x9117('0x28'),'attributes':['id','name','voicePause']}]})['then'](function(_0x50a7d7){var _0x5dc2c9=[];var _0x46e7de=[];for(var _0x3ddc58=0x0;_0x3ddc58<_0x50a7d7[_0x9117('0x29')];_0x3ddc58+=0x1){var _0x18646b=_0x50a7d7[_0x3ddc58][_0x9117('0x2a')];if(_0x18646b===null){_0x5dc2c9['push'](_0x50a7d7[_0x3ddc58]['update'](_0x5c0ef6['body'],{'transaction':_0x5ef0a3}));}else if(!_0x46e7de[_0x9117('0x2b')](_0x18646b)){_0x46e7de['push'](_0x18646b);_0x5dc2c9[_0x9117('0x2c')](_0x50a7d7[_0x3ddc58]['update'](_0x5c0ef6[_0x9117('0x17')],{'transaction':_0x5ef0a3}));}}return BPromise[_0x9117('0x2d')](_0x5dc2c9);});})['then'](function(_0x53dcee){logger['info'](_0x9117('0x20'),_0x5c0ef6);if(_0x53dcee[_0x9117('0x29')]>0x0){logger[_0x9117('0x18')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x53dcee[0x0][_0x9117('0x2e')]['id'],_0x53dcee[0x0][_0x9117('0x2e')]['ContactId'],_0x53dcee[0x0][_0x9117('0x2e')][_0x9117('0x1d')]);}logger['debug']('GetContactDialer',_0x5c0ef6,JSON[_0x9117('0x15')](_0x53dcee));_0x2bc3f4(_0x53dcee);})[_0x9117('0x11')](function(_0x6fd754){logger[_0x9117('0x12')](_0x9117('0x20'),_0x6fd754[_0x9117('0x13')],_0x5c0ef6);_0x44abf2(_0x4364de[_0x9117('0x12')](0x1f4,_0x6fd754[_0x9117('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x51bd02){var _0x3823c7=this;return new Promise(function(_0x36dd12,_0x16f627){return db[_0x9117('0x2f')][_0x9117('0x21')](function(_0x198182){return db['CmHopperFinal']['create'](_0x51bd02['body'],{'raw':_0x51bd02[_0x9117('0x9')]?_0x51bd02['options'][_0x9117('0xa')]===undefined?!![]:![]:!![],'transaction':_0x198182})['then'](function(){logger[_0x9117('0x18')](_0x9117('0x30'),JSON[_0x9117('0x15')](_0x51bd02[_0x9117('0x9')][_0x9117('0x1c')]),_0x51bd02[_0x9117('0x9')][_0x9117('0x1c')][_0x9117('0x1d')]);return db[_0x9117('0x7')][_0x9117('0x31')]({'where':_0x51bd02[_0x9117('0x9')]?_0x51bd02[_0x9117('0x9')][_0x9117('0x1c')]||null:null,'transaction':_0x198182});});})[_0x9117('0x10')](function(_0x623f29){logger[_0x9117('0x18')](_0x9117('0x32'),_0x51bd02);logger[_0x9117('0x1e')](_0x9117('0x32'),_0x51bd02,JSON['stringify'](_0x623f29));_0x36dd12(_0x623f29);})[_0x9117('0x11')](function(_0x5a080a){logger[_0x9117('0x12')]('MoveContactManagedDialer',_0x5a080a['message'],_0x51bd02);_0x16f627(_0x3823c7['error'](0x1f4,_0x5a080a[_0x9117('0x13')]));});});};exports[_0x9117('0x33')]=function(_0x357e98){var _0x285f18=this;return new Promise(function(_0x150e9c,_0x3b0a6){return db[_0x9117('0x7')][_0x9117('0x8')]({'raw':_0x357e98['options']?_0x357e98[_0x9117('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x357e98[_0x9117('0x9')]?_0x357e98[_0x9117('0x9')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9117('0x34'),db[_0x9117('0x2f')]['fn']('IF',db[_0x9117('0x2f')][_0x9117('0x35')](_0x9117('0x36')+util[_0x9117('0x37')](_0x9117('0x38'),moment()['format'](_0x9117('0x39')))+_0x9117('0x3a')))),_0x9117('0x3b')]]})[_0x9117('0x10')](function(_0x54233c){logger[_0x9117('0x18')](_0x9117('0x33'),_0x357e98);logger[_0x9117('0x1e')](_0x9117('0x33'),_0x357e98,JSON[_0x9117('0x15')](_0x54233c));_0x150e9c(_0x54233c);})['catch'](function(_0x6593b0){logger[_0x9117('0x12')](_0x9117('0x33'),_0x6593b0['message'],_0x357e98);_0x3b0a6(_0x285f18['error'](0x1f4,_0x6593b0[_0x9117('0x13')]));});});};exports[_0x9117('0x3c')]=function(_0x58d2de){var _0x33f762=this;return new Promise(function(_0x5083fe,_0x3ce21f){return db['CmContact'][_0x9117('0x3d')]()[_0x9117('0x10')](function(){return db['sequelize']['transaction'](function(_0x454d30){return db[_0x9117('0x7')][_0x9117('0x8')]({'where':_0x58d2de[_0x9117('0x9')]?_0x58d2de[_0x9117('0x9')]['where']||null:null,'attributes':_0x58d2de['options']?_0x58d2de[_0x9117('0x9')]['attributes']||null:null,'limit':0x1,'order':_0x58d2de[_0x9117('0x9')]?_0x58d2de[_0x9117('0x9')]['order']||null:null,'group':db['CmHopper'][_0x9117('0x2a')],'transaction':_0x454d30,'lock':_0x454d30['LOCK'][_0x9117('0x3e')],'include':_0x58d2de[_0x9117('0x9')]?_0x58d2de[_0x9117('0x9')][_0x9117('0xf')]?_[_0x9117('0xc')](_0x58d2de[_0x9117('0x9')][_0x9117('0xf')],function(_0x5a5f47){return{'model':db[_0x5a5f47[_0x9117('0xd')]],'as':_0x5a5f47['as'],'attributes':_0x5a5f47[_0x9117('0xe')],'include':_0x5a5f47[_0x9117('0xf')]?_[_0x9117('0xc')](_0x5a5f47['include'],function(_0x480c8e){return{'model':db[_0x480c8e[_0x9117('0xd')]],'as':_0x480c8e['as'],'attributes':_0x480c8e[_0x9117('0xe')],'include':_0x480c8e[_0x9117('0xf')]?_[_0x9117('0xc')](_0x480c8e[_0x9117('0xf')],function(_0x38b221){return{'model':db[_0x38b221[_0x9117('0xd')]],'as':_0x38b221['as'],'attributes':_0x38b221[_0x9117('0xe')]};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x469cbf){var _0x5bcb3c=[];for(var _0xe0f84c=0x0;_0xe0f84c<_0x469cbf[_0x9117('0x29')];_0xe0f84c+=0x1){_0x5bcb3c['push'](_0x469cbf[_0xe0f84c][_0x9117('0x1a')](_0x58d2de['body'],{'transaction':_0x454d30}));}return BPromise['all'](_0x5bcb3c);});})[_0x9117('0x10')](function(_0xd308b5){logger['info'](_0x9117('0x3c'),_0x58d2de);logger[_0x9117('0x1e')]('GetContactRecallMe',_0x58d2de,JSON['stringify'](_0xd308b5));_0x5083fe(_0xd308b5);})[_0x9117('0x11')](function(_0x448ad8){logger[_0x9117('0x12')](_0x9117('0x3c'),_0x448ad8[_0x9117('0x13')],_0x58d2de);_0x3ce21f(_0x33f762[_0x9117('0x12')](0x1f4,_0x448ad8[_0x9117('0x13')]));});});});};exports[_0x9117('0x3f')]=function(_0x1aa302){var _0x10e7c8=this;return new Promise(function(_0x79a5d9,_0x35b290){db[_0x9117('0x24')][_0x9117('0x3d')]()[_0x9117('0x10')](function(_0x276320){return db[_0x9117('0x7')][_0x9117('0x8')]({'raw':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')][_0x9117('0x1c')]||null:null,'attributes':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')][_0x9117('0xe')]||null:null,'limit':_0x1aa302['options']?_0x1aa302[_0x9117('0x9')]['limit']||null:null,'include':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')][_0x9117('0xf')]?_[_0x9117('0xc')](_0x1aa302[_0x9117('0x9')][_0x9117('0xf')],function(_0x198530){return{'model':db[_0x198530[_0x9117('0xd')]],'as':_0x198530['as'],'attributes':_0x198530['as']===_0x9117('0x25')?_['keys'](_0x276320):_0x198530[_0x9117('0xe')],'include':_0x198530[_0x9117('0xf')]?_[_0x9117('0xc')](_0x198530[_0x9117('0xf')],function(_0x137d31){return{'model':db[_0x137d31[_0x9117('0xd')]],'as':_0x137d31['as'],'attributes':_0x137d31[_0x9117('0xe')],'include':_0x137d31['include']?_[_0x9117('0xc')](_0x137d31['include'],function(_0x3af284){return{'model':db[_0x3af284[_0x9117('0xd')]],'as':_0x3af284['as'],'attributes':_0x3af284['attributes']};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x22d9e0){logger['info'](_0x9117('0x6'),_0x1aa302);logger['debug'](_0x9117('0x6'),_0x1aa302,JSON[_0x9117('0x15')](_0x22d9e0));_0x79a5d9(_0x22d9e0);})[_0x9117('0x11')](function(_0x417d55){logger[_0x9117('0x12')](_0x9117('0x6'),_0x417d55['message'],_0x1aa302);_0x35b290(_0x10e7c8[_0x9117('0x12')](0x1f4,_0x417d55['message']));});});});};exports[_0x9117('0x40')]=function(_0x54a1e8){var _0x4d3c00=this;return new Promise(function(_0x5aee2d,_0x51dd43){return db[_0x9117('0x24')]['findOne']({'raw':!![],'where':{'phone':_0x54a1e8[_0x9117('0x9')][_0x9117('0x1c')][_0x9117('0x41')]},'attributes':['id','dialTimezone'],'order':[['id',_0x9117('0x42')]]})[_0x9117('0x10')](function(_0x44293c){logger['info']('getContactByPhone',_0x54a1e8);logger[_0x9117('0x1e')]('getContactByPhone',_0x54a1e8,JSON[_0x9117('0x15')](_0x44293c));_0x5aee2d(_0x44293c);})['catch'](function(_0x1b7437){logger[_0x9117('0x12')](_0x9117('0x43'),_0x1b7437[_0x9117('0x13')],_0x54a1e8);_0x51dd43(_0x4d3c00['error'](0x1f4,_0x1b7437[_0x9117('0x13')]));});});};exports['ResetActiveCalls']=function(_0x3bd355){var _0x605085=this;return new Promise(function(_0x10df32,_0x37718e){return db[_0x9117('0x2f')][_0x9117('0x21')](function(_0x2de9c0){var _0x434f15=_0x3bd355[_0x9117('0x9')]&&_0x3bd355[_0x9117('0x9')][_0x9117('0x1c')]?_0x3bd355[_0x9117('0x9')][_0x9117('0x1c')]:{};return db[_0x9117('0x7')][_0x9117('0x1a')](_0x3bd355[_0x9117('0x17')],{'where':_0x434f15,'transaction':_0x2de9c0})[_0x9117('0x10')](function(_0x187403){logger[_0x9117('0x18')]('ResetActiveCalls',_0x3bd355);logger['debug'](_0x9117('0x44'),_0x3bd355,JSON[_0x9117('0x15')](_0x187403));_0x10df32(_0x187403);})['catch'](function(_0x316a10){logger[_0x9117('0x12')](_0x9117('0x44'),_0x316a10[_0x9117('0x13')],_0x3bd355);_0x37718e(_0x605085['error'](0x1f4,_0x316a10[_0x9117('0x13')]));});});});};exports[_0x9117('0x45')]=function(_0x31fd3b){var _0x10862e=this;var _0x9e68cc=_0x31fd3b[_0x9117('0x17')][_0x9117('0x1c')][_0x9117('0x46')];var _0xb26940=_0x31fd3b[_0x9117('0x17')][_0x9117('0x1c')]['interval'];var _0x174780=_0x31fd3b[_0x9117('0x17')]['where'][_0x9117('0x47')];return new Promise(function(_0x4f608e,_0x51b07c){return db[_0x9117('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x9e68cc},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9117('0x2f')][_0x9117('0x35')](_0x9117('0x48')+_0xb26940+_0x9117('0x49')),'$gt':db[_0x9117('0x2f')][_0x9117('0x35')](_0x9117('0x4a'))}},'UserId':{'$in':_0x174780}},'include':[{'model':db['CmContact'],'as':_0x9117('0x25')},{'model':db[_0x9117('0x27')],'as':_0x9117('0x28'),'attributes':['id',_0x9117('0x4b'),_0x9117('0x4c')]},{'model':db[_0x9117('0x4d')],'as':_0x9117('0x4e')}]})['then'](function(_0x20e386){if(_0x20e386['length']>0x0){return db[_0x9117('0x2f')][_0x9117('0x21')](function(_0x13586a){return db[_0x9117('0x7')]['update']({'recallmeNotifiedDate':db[_0x9117('0x2f')]['literal'](_0x9117('0x4a'))},{'where':{'id':{'$in':_['map'](_0x20e386,'id')}},'transaction':_0x13586a})[_0x9117('0x10')](function(){_0x4f608e(_0x20e386);})['catch'](function(_0x2871f1){logger[_0x9117('0x12')](_0x9117('0x45'),_0x2871f1['message'],_0x31fd3b);_0x51b07c(_0x10862e['error'](0x1f4,_0x2871f1[_0x9117('0x13')]));});})[_0x9117('0x11')](function(_0x1df5c8){logger[_0x9117('0x12')](_0x9117('0x45'),_0x1df5c8[_0x9117('0x13')],_0x31fd3b);_0x51b07c(_0x10862e[_0x9117('0x12')](0x1f4,_0x1df5c8['message']));});}else{_0x4f608e(_0x20e386);}});});}; \ No newline at end of file +var _0xb95d=['all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','CmHopperFinal','create','MoveContactManagedDialer','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','Agent','CmList','List','NOW()','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','where','attributes','include','map','model','then','info','stringify','catch','error','GetCmHopper','message','ShowCmHopper','find','raw','CreateCmHopper','debug','UpdateCmHopper','update','body','limit','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','name','length','includes','push'];(function(_0x3e2584,_0x1edd1f){var _0x5043b6=function(_0x38b6b8){while(--_0x38b6b8){_0x3e2584['push'](_0x3e2584['shift']());}};_0x5043b6(++_0x1edd1f);}(_0xb95d,0x15f));var _0xdb95=function(_0x10dc20,_0x53b0ca){_0x10dc20=_0x10dc20-0x0;var _0x45c996=_0xb95d[_0x10dc20];return _0x45c996;};'use strict';var _=require(_0xdb95('0x0'));var util=require(_0xdb95('0x1'));var moment=require('moment');var BPromise=require(_0xdb95('0x2'));var db=require(_0xdb95('0x3'))['db'];var logger=require(_0xdb95('0x4'))(_0xdb95('0x5'));exports['GetCmHopper']=function(_0x23bfde){var _0x5c51ff=this;return new Promise(function(_0x4b4bb6,_0xcedeb8){return db[_0xdb95('0x6')][_0xdb95('0x7')]({'raw':_0x23bfde[_0xdb95('0x8')]?_0x23bfde[_0xdb95('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x23bfde[_0xdb95('0x8')]?_0x23bfde[_0xdb95('0x8')][_0xdb95('0x9')]||null:null,'attributes':_0x23bfde[_0xdb95('0x8')]?_0x23bfde[_0xdb95('0x8')][_0xdb95('0xa')]||null:null,'limit':_0x23bfde[_0xdb95('0x8')]?_0x23bfde[_0xdb95('0x8')]['limit']||null:null,'include':_0x23bfde['options']?_0x23bfde['options'][_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x23bfde[_0xdb95('0x8')][_0xdb95('0xb')],function(_0x42f27b){return{'model':db[_0x42f27b['model']],'as':_0x42f27b['as'],'attributes':_0x42f27b[_0xdb95('0xa')],'include':_0x42f27b[_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x42f27b[_0xdb95('0xb')],function(_0x242e79){return{'model':db[_0x242e79[_0xdb95('0xd')]],'as':_0x242e79['as'],'attributes':_0x242e79['attributes'],'include':_0x242e79[_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x242e79[_0xdb95('0xb')],function(_0x4b4711){return{'model':db[_0x4b4711[_0xdb95('0xd')]],'as':_0x4b4711['as'],'attributes':_0x4b4711[_0xdb95('0xa')]};}):[]};}):[]};}):[]:[]})[_0xdb95('0xe')](function(_0x1513d3){logger[_0xdb95('0xf')]('GetCmHopper',_0x23bfde);logger['debug']('GetCmHopper',_0x23bfde,JSON[_0xdb95('0x10')](_0x1513d3));_0x4b4bb6(_0x1513d3);})[_0xdb95('0x11')](function(_0x149248){logger[_0xdb95('0x12')](_0xdb95('0x13'),_0x149248[_0xdb95('0x14')],_0x23bfde);_0xcedeb8(_0x5c51ff[_0xdb95('0x12')](0x1f4,_0x149248[_0xdb95('0x14')]));});});};exports[_0xdb95('0x15')]=function(_0x1f5c17){var _0x1909cf=this;return new Promise(function(_0x2b6d41,_0x2a43a1){return db[_0xdb95('0x6')][_0xdb95('0x16')]({'raw':_0x1f5c17[_0xdb95('0x8')]?_0x1f5c17['options'][_0xdb95('0x17')]===undefined?!![]:![]:!![],'where':_0x1f5c17[_0xdb95('0x8')]?_0x1f5c17[_0xdb95('0x8')][_0xdb95('0x9')]||null:null,'attributes':_0x1f5c17[_0xdb95('0x8')]?_0x1f5c17[_0xdb95('0x8')][_0xdb95('0xa')]||null:null,'include':_0x1f5c17['options']?_0x1f5c17[_0xdb95('0x8')]['include']?_[_0xdb95('0xc')](_0x1f5c17['options'][_0xdb95('0xb')],function(_0x1ae429){return{'model':db[_0x1ae429[_0xdb95('0xd')]],'as':_0x1ae429['as'],'attributes':_0x1ae429[_0xdb95('0xa')],'include':_0x1ae429[_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x1ae429[_0xdb95('0xb')],function(_0x2d584a){return{'model':db[_0x2d584a[_0xdb95('0xd')]],'as':_0x2d584a['as'],'attributes':_0x2d584a['attributes'],'include':_0x2d584a['include']?_[_0xdb95('0xc')](_0x2d584a[_0xdb95('0xb')],function(_0xa17f39){return{'model':db[_0xa17f39['model']],'as':_0xa17f39['as'],'attributes':_0xa17f39[_0xdb95('0xa')]};}):[]};}):[]};}):[]:[]})[_0xdb95('0xe')](function(_0x5298d2){logger[_0xdb95('0xf')](_0xdb95('0x15'),_0x1f5c17);logger['debug'](_0xdb95('0x15'),_0x1f5c17,JSON[_0xdb95('0x10')](_0x5298d2));_0x2b6d41(_0x5298d2);})[_0xdb95('0x11')](function(_0x27749b){logger['error']('ShowCmHopper',_0x27749b[_0xdb95('0x14')],_0x1f5c17);_0x2a43a1(_0x1909cf[_0xdb95('0x12')](0x1f4,_0x27749b[_0xdb95('0x14')]));});});};exports['CreateCmHopper']=function(_0x5d178b){var _0x3dc7b9=this;return new Promise(function(_0x129bff,_0x3edabc){return db['CmHopper']['create'](_0x5d178b['body'],{'raw':_0x5d178b[_0xdb95('0x8')]?_0x5d178b[_0xdb95('0x8')]['raw']===undefined?!![]:![]:!![]})[_0xdb95('0xe')](function(_0x2a8cb7){logger[_0xdb95('0xf')](_0xdb95('0x18'),_0x5d178b);logger[_0xdb95('0x19')](_0xdb95('0x18'),_0x5d178b,JSON[_0xdb95('0x10')](_0x2a8cb7));_0x129bff(_0x2a8cb7);})[_0xdb95('0x11')](function(_0x159885){logger['error'](_0xdb95('0x18'),_0x159885[_0xdb95('0x14')],_0x5d178b);_0x3edabc(_0x3dc7b9[_0xdb95('0x12')](0x1f4,_0x159885['message']));});});};exports[_0xdb95('0x1a')]=function(_0x9584a6){var _0x332f39=this;return new Promise(function(_0x3dd970,_0x5994fc){return db[_0xdb95('0x6')][_0xdb95('0x1b')](_0x9584a6[_0xdb95('0x1c')],{'raw':_0x9584a6[_0xdb95('0x8')]?_0x9584a6[_0xdb95('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9584a6[_0xdb95('0x8')]?_0x9584a6[_0xdb95('0x8')][_0xdb95('0x9')]||null:null,'attributes':_0x9584a6[_0xdb95('0x8')]?_0x9584a6[_0xdb95('0x8')][_0xdb95('0xa')]||null:null,'limit':_0x9584a6[_0xdb95('0x8')]?_0x9584a6[_0xdb95('0x8')][_0xdb95('0x1d')]||null:null})['then'](function(_0x16806e){logger[_0xdb95('0xf')]('UpdateCmHopper',_0x9584a6);logger[_0xdb95('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdb95('0x10')](_0x9584a6[_0xdb95('0x8')][_0xdb95('0x9')]),_0x9584a6[_0xdb95('0x1c')][_0xdb95('0x1e')]);logger[_0xdb95('0x19')](_0xdb95('0x1a'),_0x9584a6,JSON[_0xdb95('0x10')](_0x16806e));_0x3dd970(_0x16806e);})[_0xdb95('0x11')](function(_0x124738){logger[_0xdb95('0x12')](_0xdb95('0x1a'),_0x124738[_0xdb95('0x14')],_0x9584a6);_0x5994fc(_0x332f39[_0xdb95('0x12')](0x1f4,_0x124738[_0xdb95('0x14')]));});});};exports[_0xdb95('0x1f')]=function(_0x4394fb){var _0x3ca411=this;return new Promise(function(_0x1877d8,_0x4f38b9){return db[_0xdb95('0x6')]['destroy']({'where':_0x4394fb['options']?_0x4394fb[_0xdb95('0x8')][_0xdb95('0x9')]||null:null})['then'](function(_0x2bd129){logger[_0xdb95('0xf')](_0xdb95('0x1f'),_0x4394fb);logger[_0xdb95('0x19')](_0xdb95('0x1f'),_0x4394fb,JSON[_0xdb95('0x10')](_0x2bd129));_0x1877d8(_0x2bd129);})[_0xdb95('0x11')](function(_0x570d8f){logger['error'](_0xdb95('0x1f'),_0x570d8f[_0xdb95('0x14')],_0x4394fb);_0x4f38b9(_0x3ca411[_0xdb95('0x12')](0x1f4,_0x570d8f['message']));});});};exports[_0xdb95('0x20')]=function(_0x86f96e){var _0x373c8f=this;return new Promise(function(_0x32281b,_0x15c1d9){return db[_0xdb95('0x21')][_0xdb95('0x22')]()[_0xdb95('0xe')](function(_0x481c1f){return db['sequelize'][_0xdb95('0x23')](function(_0x354d65){return db['CmHopper'][_0xdb95('0x7')]({'where':_0x86f96e[_0xdb95('0x8')]?_0x86f96e[_0xdb95('0x8')][_0xdb95('0x9')]||null:null,'attributes':_0x86f96e[_0xdb95('0x8')]?_0x86f96e[_0xdb95('0x8')][_0xdb95('0xa')]||null:null,'limit':_0x86f96e[_0xdb95('0x8')]?_0x86f96e[_0xdb95('0x8')][_0xdb95('0x1d')]||null:null,'order':_0x86f96e[_0xdb95('0x8')]?_0x86f96e[_0xdb95('0x8')][_0xdb95('0x24')]||null:null,'transaction':_0x354d65,'lock':_0x354d65[_0xdb95('0x25')][_0xdb95('0x26')],'include':[{'model':db[_0xdb95('0x21')],'as':_0xdb95('0x27'),'attributes':_['keys'](_0x481c1f)},{'model':db['User'],'as':'Agent','attributes':['id',_0xdb95('0x28'),'voicePause']}]})['then'](function(_0x568389){var _0x3bde3a=[];var _0x47c71e=[];for(var _0x52b7d6=0x0;_0x52b7d6<_0x568389[_0xdb95('0x29')];_0x52b7d6+=0x1){var _0x57c77b=_0x568389[_0x52b7d6]['UserId'];if(_0x57c77b===null){_0x3bde3a['push'](_0x568389[_0x52b7d6]['update'](_0x86f96e['body'],{'transaction':_0x354d65}));}else if(!_0x47c71e[_0xdb95('0x2a')](_0x57c77b)){_0x47c71e[_0xdb95('0x2b')](_0x57c77b);_0x3bde3a[_0xdb95('0x2b')](_0x568389[_0x52b7d6][_0xdb95('0x1b')](_0x86f96e[_0xdb95('0x1c')],{'transaction':_0x354d65}));}}return BPromise[_0xdb95('0x2c')](_0x3bde3a);});})[_0xdb95('0xe')](function(_0x4d7f66){logger[_0xdb95('0xf')](_0xdb95('0x20'),_0x86f96e);if(_0x4d7f66[_0xdb95('0x29')]>0x0){logger['info'](_0xdb95('0x2d'),_0x4d7f66[0x0][_0xdb95('0x2e')]['id'],_0x4d7f66[0x0][_0xdb95('0x2e')][_0xdb95('0x2f')],_0x4d7f66[0x0]['dataValues'][_0xdb95('0x1e')]);}logger['debug']('GetContactDialer',_0x86f96e,JSON['stringify'](_0x4d7f66));_0x32281b(_0x4d7f66);})['catch'](function(_0xf8265){logger['error']('GetContactDialer',_0xf8265[_0xdb95('0x14')],_0x86f96e);_0x15c1d9(_0x373c8f[_0xdb95('0x12')](0x1f4,_0xf8265[_0xdb95('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x138141){var _0x2a9c26=this;return new Promise(function(_0x4e27e3,_0x4b5d6c){return db[_0xdb95('0x30')][_0xdb95('0x23')](function(_0x2d4d31){return db[_0xdb95('0x31')][_0xdb95('0x32')](_0x138141[_0xdb95('0x1c')],{'raw':_0x138141[_0xdb95('0x8')]?_0x138141[_0xdb95('0x8')][_0xdb95('0x17')]===undefined?!![]:![]:!![],'transaction':_0x2d4d31})[_0xdb95('0xe')](function(){logger[_0xdb95('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdb95('0x10')](_0x138141['options'][_0xdb95('0x9')]),_0x138141[_0xdb95('0x8')][_0xdb95('0x9')]['active']);return db[_0xdb95('0x6')]['destroy']({'where':_0x138141[_0xdb95('0x8')]?_0x138141[_0xdb95('0x8')][_0xdb95('0x9')]||null:null,'transaction':_0x2d4d31});});})[_0xdb95('0xe')](function(_0x139907){logger[_0xdb95('0xf')](_0xdb95('0x33'),_0x138141);logger[_0xdb95('0x19')](_0xdb95('0x33'),_0x138141,JSON['stringify'](_0x139907));_0x4e27e3(_0x139907);})[_0xdb95('0x11')](function(_0xc07f72){logger['error'](_0xdb95('0x33'),_0xc07f72['message'],_0x138141);_0x4b5d6c(_0x2a9c26['error'](0x1f4,_0xc07f72[_0xdb95('0x14')]));});});};exports['CountReScheduled']=function(_0x1ea285){var _0xfa3a02=this;return new Promise(function(_0x17a2d3,_0x1d788d){return db[_0xdb95('0x6')][_0xdb95('0x7')]({'raw':_0x1ea285[_0xdb95('0x8')]?_0x1ea285[_0xdb95('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1ea285[_0xdb95('0x8')]?_0x1ea285[_0xdb95('0x8')][_0xdb95('0x9')]||null:null,'attributes':[[db[_0xdb95('0x30')]['fn'](_0xdb95('0x34'),db[_0xdb95('0x30')]['fn']('IF',db[_0xdb95('0x30')][_0xdb95('0x35')]('`scheduledat`\x20>=\x20'+util[_0xdb95('0x36')]('\x22%s\x22',moment()[_0xdb95('0x36')](_0xdb95('0x37')))+_0xdb95('0x38')))),_0xdb95('0x39')]]})[_0xdb95('0xe')](function(_0x4f3e84){logger['info']('CountReScheduled',_0x1ea285);logger['debug']('CountReScheduled',_0x1ea285,JSON[_0xdb95('0x10')](_0x4f3e84));_0x17a2d3(_0x4f3e84);})['catch'](function(_0x3543af){logger[_0xdb95('0x12')](_0xdb95('0x3a'),_0x3543af[_0xdb95('0x14')],_0x1ea285);_0x1d788d(_0xfa3a02[_0xdb95('0x12')](0x1f4,_0x3543af['message']));});});};exports[_0xdb95('0x3b')]=function(_0x162fc9){var _0x1fb93d=this;return new Promise(function(_0x1dcfc7,_0x5e0319){return db[_0xdb95('0x21')]['describe']()[_0xdb95('0xe')](function(){return db[_0xdb95('0x30')][_0xdb95('0x23')](function(_0x3a6ea3){return db[_0xdb95('0x6')][_0xdb95('0x7')]({'where':_0x162fc9[_0xdb95('0x8')]?_0x162fc9[_0xdb95('0x8')][_0xdb95('0x9')]||null:null,'attributes':_0x162fc9[_0xdb95('0x8')]?_0x162fc9[_0xdb95('0x8')][_0xdb95('0xa')]||null:null,'limit':0x1,'order':_0x162fc9['options']?_0x162fc9[_0xdb95('0x8')][_0xdb95('0x24')]||null:null,'group':db[_0xdb95('0x6')]['UserId'],'transaction':_0x3a6ea3,'lock':_0x3a6ea3[_0xdb95('0x25')]['UPDATE'],'include':_0x162fc9['options']?_0x162fc9[_0xdb95('0x8')][_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x162fc9[_0xdb95('0x8')]['include'],function(_0x387eb9){return{'model':db[_0x387eb9[_0xdb95('0xd')]],'as':_0x387eb9['as'],'attributes':_0x387eb9[_0xdb95('0xa')],'include':_0x387eb9[_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x387eb9['include'],function(_0x348be3){return{'model':db[_0x348be3['model']],'as':_0x348be3['as'],'attributes':_0x348be3['attributes'],'include':_0x348be3[_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x348be3[_0xdb95('0xb')],function(_0x4bd8d6){return{'model':db[_0x4bd8d6[_0xdb95('0xd')]],'as':_0x4bd8d6['as'],'attributes':_0x4bd8d6[_0xdb95('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x384980){var _0x983f5e=[];for(var _0x86be0e=0x0;_0x86be0e<_0x384980[_0xdb95('0x29')];_0x86be0e+=0x1){_0x983f5e[_0xdb95('0x2b')](_0x384980[_0x86be0e][_0xdb95('0x1b')](_0x162fc9[_0xdb95('0x1c')],{'transaction':_0x3a6ea3}));}return BPromise[_0xdb95('0x2c')](_0x983f5e);});})[_0xdb95('0xe')](function(_0xa4034e){logger[_0xdb95('0xf')](_0xdb95('0x3b'),_0x162fc9);logger[_0xdb95('0x19')](_0xdb95('0x3b'),_0x162fc9,JSON[_0xdb95('0x10')](_0xa4034e));_0x1dcfc7(_0xa4034e);})[_0xdb95('0x11')](function(_0x4196fd){logger[_0xdb95('0x12')]('GetContactRecallMe',_0x4196fd[_0xdb95('0x14')],_0x162fc9);_0x5e0319(_0x1fb93d[_0xdb95('0x12')](0x1f4,_0x4196fd[_0xdb95('0x14')]));});});});};exports[_0xdb95('0x3c')]=function(_0x363f28){var _0x27f7cd=this;return new Promise(function(_0x5cf09e,_0x42b604){db[_0xdb95('0x21')][_0xdb95('0x22')]()[_0xdb95('0xe')](function(_0x2f8b2b){return db[_0xdb95('0x6')][_0xdb95('0x7')]({'raw':_0x363f28['options']?_0x363f28[_0xdb95('0x8')][_0xdb95('0x17')]===undefined?!![]:![]:!![],'where':_0x363f28[_0xdb95('0x8')]?_0x363f28['options'][_0xdb95('0x9')]||null:null,'attributes':_0x363f28[_0xdb95('0x8')]?_0x363f28['options'][_0xdb95('0xa')]||null:null,'limit':_0x363f28[_0xdb95('0x8')]?_0x363f28[_0xdb95('0x8')]['limit']||null:null,'include':_0x363f28[_0xdb95('0x8')]?_0x363f28['options'][_0xdb95('0xb')]?_['map'](_0x363f28[_0xdb95('0x8')][_0xdb95('0xb')],function(_0x13b575){return{'model':db[_0x13b575['model']],'as':_0x13b575['as'],'attributes':_0x13b575['as']===_0xdb95('0x27')?_[_0xdb95('0x3d')](_0x2f8b2b):_0x13b575[_0xdb95('0xa')],'include':_0x13b575[_0xdb95('0xb')]?_[_0xdb95('0xc')](_0x13b575[_0xdb95('0xb')],function(_0x55fb35){return{'model':db[_0x55fb35[_0xdb95('0xd')]],'as':_0x55fb35['as'],'attributes':_0x55fb35[_0xdb95('0xa')],'include':_0x55fb35['include']?_[_0xdb95('0xc')](_0x55fb35[_0xdb95('0xb')],function(_0x111eb8){return{'model':db[_0x111eb8['model']],'as':_0x111eb8['as'],'attributes':_0x111eb8['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb95('0xe')](function(_0x4e6b10){logger[_0xdb95('0xf')](_0xdb95('0x13'),_0x363f28);logger[_0xdb95('0x19')](_0xdb95('0x13'),_0x363f28,JSON[_0xdb95('0x10')](_0x4e6b10));_0x5cf09e(_0x4e6b10);})['catch'](function(_0x43a71b){logger[_0xdb95('0x12')](_0xdb95('0x13'),_0x43a71b['message'],_0x363f28);_0x42b604(_0x27f7cd[_0xdb95('0x12')](0x1f4,_0x43a71b[_0xdb95('0x14')]));});});});};exports[_0xdb95('0x3e')]=function(_0x128aa6){var _0x58d793=this;return new Promise(function(_0x1f303e,_0x14cc49){return db[_0xdb95('0x21')]['findOne']({'raw':!![],'where':{'phone':_0x128aa6[_0xdb95('0x8')][_0xdb95('0x9')][_0xdb95('0x3f')]},'attributes':['id',_0xdb95('0x40')],'order':[['id',_0xdb95('0x41')]]})[_0xdb95('0xe')](function(_0x4b90e2){logger['info'](_0xdb95('0x42'),_0x128aa6);logger[_0xdb95('0x19')](_0xdb95('0x42'),_0x128aa6,JSON[_0xdb95('0x10')](_0x4b90e2));_0x1f303e(_0x4b90e2);})[_0xdb95('0x11')](function(_0x5b94ea){logger['error']('getContactByPhone',_0x5b94ea[_0xdb95('0x14')],_0x128aa6);_0x14cc49(_0x58d793[_0xdb95('0x12')](0x1f4,_0x5b94ea[_0xdb95('0x14')]));});});};exports['ResetActiveCalls']=function(_0x377fd){var _0x4cc811=this;return new Promise(function(_0x3b9317,_0x329829){return db[_0xdb95('0x30')][_0xdb95('0x23')](function(_0x314c37){var _0x27bc60=_0x377fd[_0xdb95('0x8')]&&_0x377fd[_0xdb95('0x8')][_0xdb95('0x9')]?_0x377fd[_0xdb95('0x8')][_0xdb95('0x9')]:{};return db['CmHopper'][_0xdb95('0x1b')](_0x377fd[_0xdb95('0x1c')],{'where':_0x27bc60,'transaction':_0x314c37})[_0xdb95('0xe')](function(_0x5e076e){logger[_0xdb95('0xf')]('ResetActiveCalls',_0x377fd);logger[_0xdb95('0x19')](_0xdb95('0x43'),_0x377fd,JSON[_0xdb95('0x10')](_0x5e076e));_0x3b9317(_0x5e076e);})[_0xdb95('0x11')](function(_0x5f00a2){logger['error'](_0xdb95('0x43'),_0x5f00a2[_0xdb95('0x14')],_0x377fd);_0x329829(_0x4cc811[_0xdb95('0x12')](0x1f4,_0x5f00a2[_0xdb95('0x14')]));});});});};exports[_0xdb95('0x44')]=function(_0x304602){var _0x2e6445=this;var _0x47d28d=_0x304602[_0xdb95('0x1c')]['where'][_0xdb95('0x45')];var _0x3135ff=_0x304602[_0xdb95('0x1c')][_0xdb95('0x9')][_0xdb95('0x46')];var _0x5e3ad5=_0x304602[_0xdb95('0x1c')][_0xdb95('0x9')][_0xdb95('0x47')];return new Promise(function(_0xc96fc2,_0x15e56a){return db[_0xdb95('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x47d28d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xdb95('0x30')][_0xdb95('0x35')](_0xdb95('0x48')+_0x3135ff+_0xdb95('0x49')),'$gt':db[_0xdb95('0x30')][_0xdb95('0x35')]('NOW()')}},'UserId':{'$in':_0x5e3ad5}},'include':[{'model':db[_0xdb95('0x21')],'as':_0xdb95('0x27')},{'model':db[_0xdb95('0x4a')],'as':_0xdb95('0x4b'),'attributes':['id',_0xdb95('0x28'),'voicePause']},{'model':db[_0xdb95('0x4c')],'as':_0xdb95('0x4d')}]})[_0xdb95('0xe')](function(_0x30d9e4){if(_0x30d9e4[_0xdb95('0x29')]>0x0){return db[_0xdb95('0x30')]['transaction'](function(_0x48572c){return db[_0xdb95('0x6')][_0xdb95('0x1b')]({'recallmeNotifiedDate':db[_0xdb95('0x30')][_0xdb95('0x35')](_0xdb95('0x4e'))},{'where':{'id':{'$in':_[_0xdb95('0xc')](_0x30d9e4,'id')}},'transaction':_0x48572c})[_0xdb95('0xe')](function(){_0xc96fc2(_0x30d9e4);})[_0xdb95('0x11')](function(_0x2fe4fb){logger[_0xdb95('0x12')](_0xdb95('0x44'),_0x2fe4fb['message'],_0x304602);_0x15e56a(_0x2e6445[_0xdb95('0x12')](0x1f4,_0x2fe4fb['message']));});})[_0xdb95('0x11')](function(_0x373f18){logger['error'](_0xdb95('0x44'),_0x373f18[_0xdb95('0x14')],_0x304602);_0x15e56a(_0x2e6445[_0xdb95('0x12')](0x1f4,_0x373f18[_0xdb95('0x14')]));});}else{_0xc96fc2(_0x30d9e4);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 914295a..cfacaa4 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 _0xc58e=['describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/preview','post','getTimezone','put','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe'];(function(_0x258fb5,_0x47c7f5){var _0x124437=function(_0x4a0ad1){while(--_0x4a0ad1){_0x258fb5['push'](_0x258fb5['shift']());}};_0x124437(++_0x47c7f5);}(_0xc58e,0x1c1));var _0xec58=function(_0x2d01c5,_0x3fa4ef){_0x2d01c5=_0x2d01c5-0x0;var _0x422634=_0xc58e[_0x2d01c5];return _0x422634;};'use strict';var express=require(_0xec58('0x0'));var router=express[_0xec58('0x1')]();var auth=require(_0xec58('0x2'));var controller=require('./cmHopper.controller');router[_0xec58('0x3')]('/',auth[_0xec58('0x4')](),controller[_0xec58('0x5')]);router[_0xec58('0x3')](_0xec58('0x6'),auth[_0xec58('0x4')](),controller[_0xec58('0x7')]);router['get'](_0xec58('0x8'),auth[_0xec58('0x4')](),controller[_0xec58('0x9')]);router[_0xec58('0x3')]('/timezones',auth[_0xec58('0x4')](),controller[_0xec58('0xa')]);router['get'](_0xec58('0xb'),auth[_0xec58('0x4')](),controller[_0xec58('0xc')]);router[_0xec58('0x3')]('/:id/previewrecall',auth[_0xec58('0x4')](),controller['getPreviewRecall']);router['post']('/',auth[_0xec58('0x4')](),controller['create']);router['post'](_0xec58('0xd'),auth[_0xec58('0x4')](),controller['getPreview']);router[_0xec58('0xe')]('/timezone',auth[_0xec58('0x4')](),controller[_0xec58('0xf')]);router[_0xec58('0x10')](_0xec58('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xec58('0xb'),auth[_0xec58('0x4')](),controller[_0xec58('0x11')]);module[_0xec58('0x12')]=router; \ No newline at end of file +var _0xd388=['getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','exports','express','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall'];(function(_0x236787,_0x56cea6){var _0x468ead=function(_0x5387d7){while(--_0x5387d7){_0x236787['push'](_0x236787['shift']());}};_0x468ead(++_0x56cea6);}(_0xd388,0x153));var _0x8d38=function(_0x2450e6,_0x4eb181){_0x2450e6=_0x2450e6-0x0;var _0x40387a=_0xd388[_0x2450e6];return _0x40387a;};'use strict';var express=require(_0x8d38('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x8d38('0x1'));router[_0x8d38('0x2')]('/',auth[_0x8d38('0x3')](),controller[_0x8d38('0x4')]);router['get'](_0x8d38('0x5'),auth['isAuthenticated'](),controller[_0x8d38('0x6')]);router[_0x8d38('0x2')](_0x8d38('0x7'),auth[_0x8d38('0x3')](),controller['getOpenContacts']);router[_0x8d38('0x2')](_0x8d38('0x8'),auth['isAuthenticated'](),controller[_0x8d38('0x9')]);router[_0x8d38('0x2')](_0x8d38('0xa'),auth[_0x8d38('0x3')](),controller[_0x8d38('0xb')]);router[_0x8d38('0x2')](_0x8d38('0xc'),auth[_0x8d38('0x3')](),controller[_0x8d38('0xd')]);router[_0x8d38('0xe')]('/',auth[_0x8d38('0x3')](),controller[_0x8d38('0xf')]);router[_0x8d38('0xe')](_0x8d38('0x10'),auth[_0x8d38('0x3')](),controller[_0x8d38('0x11')]);router[_0x8d38('0xe')](_0x8d38('0x12'),auth[_0x8d38('0x3')](),controller[_0x8d38('0x13')]);router['put'](_0x8d38('0xa'),auth[_0x8d38('0x3')](),controller[_0x8d38('0x14')]);router['delete'](_0x8d38('0xa'),auth[_0x8d38('0x3')](),controller['destroy']);module[_0x8d38('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 0c81341..4731a78 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85d2=['moment','sequelize','exports','STRING','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x11789a,_0x50facd){var _0x214efd=function(_0x34c0f7){while(--_0x34c0f7){_0x11789a['push'](_0x11789a['shift']());}};_0x214efd(++_0x50facd);}(_0x85d2,0xaf));var _0x285d=function(_0x5d322f,_0x422208){_0x5d322f=_0x5d322f-0x0;var _0x3dd201=_0x85d2[_0x5d322f];return _0x3dd201;};'use strict';var moment=require(_0x285d('0x0'));var Sequelize=require(_0x285d('0x1'));module[_0x285d('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x285d('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x285d('0x5')],'defaultValue':moment()['format'](_0x285d('0x6'))},'countbusyretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c0b=['exports','INTEGER','STRING','DATE','format','moment','sequelize'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0x2c0b,0xf3));var _0xb2c0=function(_0x421dda,_0xa50c8b){_0x421dda=_0x421dda-0x0;var _0x3b884d=_0x2c0b[_0x421dda];return _0x3b884d;};'use strict';var moment=require(_0xb2c0('0x0'));var Sequelize=require(_0xb2c0('0x1'));module[_0xb2c0('0x2')]={'CmHopperId':{'type':Sequelize[_0xb2c0('0x3')]},'phone':{'type':Sequelize[_0xb2c0('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb2c0('0x5')],'defaultValue':moment()[_0xb2c0('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb2c0('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 5637cc5..975864c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77a1=['error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','CmHopperAdditionalPhone','includeAll','include','catch','show','params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','get','CmHopperAdditionalPhones'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x77a1,0x114));var _0x177a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x77a1[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x177a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x177a('0x1'));var rp=require('request-promise');var moment=require(_0x177a('0x2'));var BPromise=require(_0x177a('0x3'));var Mustache=require(_0x177a('0x4'));var util=require(_0x177a('0x5'));var path=require(_0x177a('0x6'));var sox=require(_0x177a('0x7'));var csv=require(_0x177a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x177a('0x9'));var _=require(_0x177a('0xa'));var squel=require('squel');var crypto=require(_0x177a('0xb'));var jsforce=require(_0x177a('0xc'));var deskjs=require(_0x177a('0xd'));var toCsv=require(_0x177a('0x8'));var querystring=require('querystring');var Papa=require(_0x177a('0xe'));var Redis=require(_0x177a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x177a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x177a('0x11'));var utils=require(_0x177a('0x12'));var config=require(_0x177a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x177a('0x14'))['db'];function respondWithStatusCode(_0x164e5d,_0x2d478a){_0x2d478a=_0x2d478a||0xcc;return function(_0x26b70b){if(_0x26b70b){return _0x164e5d[_0x177a('0x15')](_0x2d478a);}return _0x164e5d[_0x177a('0x16')](_0x2d478a)[_0x177a('0x17')]();};}function respondWithResult(_0x4468f6,_0x16ac10){_0x16ac10=_0x16ac10||0xc8;return function(_0x498937){if(_0x498937){return _0x4468f6[_0x177a('0x16')](_0x16ac10)[_0x177a('0x18')](_0x498937);}};}function respondWithFilteredResult(_0x5c066d,_0x2c5d56){return function(_0x57dca0){if(_0x57dca0){var _0x3d62d7=typeof _0x2c5d56[_0x177a('0x19')]===_0x177a('0x1a')&&typeof _0x2c5d56['limit']===_0x177a('0x1a');var _0x263da3=_0x57dca0['count'];var _0x29b418=_0x3d62d7?0x0:_0x2c5d56[_0x177a('0x19')];var _0x217aaa=_0x3d62d7?_0x57dca0[_0x177a('0x1b')]:_0x2c5d56[_0x177a('0x19')]+_0x2c5d56[_0x177a('0x1c')];var _0x404df4;if(_0x217aaa>=_0x263da3){_0x217aaa=_0x263da3;_0x404df4=0xc8;}else{_0x404df4=0xce;}_0x5c066d[_0x177a('0x16')](_0x404df4);return _0x5c066d['set'](_0x177a('0x1d'),_0x29b418+'-'+_0x217aaa+'/'+_0x263da3)[_0x177a('0x18')](_0x57dca0);}return null;};}function patchUpdates(_0x32fa17){return function(_0x2c3e86){try{jsonpatch[_0x177a('0x1e')](_0x2c3e86,_0x32fa17,!![]);}catch(_0x20ac00){return BPromise[_0x177a('0x1f')](_0x20ac00);}return _0x2c3e86['save']();};}function saveUpdates(_0x5bcef9,_0x55d2bc){return function(_0x397abd){if(_0x397abd){return _0x397abd['update'](_0x5bcef9)[_0x177a('0x20')](function(_0xaffc7){return _0xaffc7;});}return null;};}function removeEntity(_0x4bfa80,_0x4ebeaf){return function(_0x56668e){if(_0x56668e){return _0x56668e[_0x177a('0x21')]()['then'](function(){var _0x4df279=_0x56668e[_0x177a('0x22')]({'plain':!![]});var _0x9e672b=_0x177a('0x23');return db['UserProfileResource'][_0x177a('0x21')]({'where':{'type':_0x9e672b,'resourceId':_0x4df279['id']}})[_0x177a('0x20')](function(){return _0x56668e;});})['then'](function(){_0x4bfa80[_0x177a('0x16')](0xcc)[_0x177a('0x17')]();});}};}function handleEntityNotFound(_0x43e721,_0x1d6f9e){return function(_0x27c5aa){if(!_0x27c5aa){_0x43e721[_0x177a('0x15')](0x194);}return _0x27c5aa;};}function handleError(_0x578f83,_0xb0c8ba){_0xb0c8ba=_0xb0c8ba||0x1f4;return function(_0x239b70){logger[_0x177a('0x24')](_0x239b70[_0x177a('0x25')]);if(_0x239b70[_0x177a('0x26')]){delete _0x239b70['name'];}_0x578f83[_0x177a('0x16')](_0xb0c8ba)[_0x177a('0x27')](_0x239b70);};}exports[_0x177a('0x28')]=function(_0x4f4d8e,_0x4b7c15){var _0x2c6f02={},_0x58c3e0={},_0x1ef918={'count':0x0,'rows':[]};var _0x14a0c5=_[_0x177a('0x29')](db['CmHopperAdditionalPhone'][_0x177a('0x2a')],function(_0x11344a){return{'name':_0x11344a[_0x177a('0x2b')],'type':_0x11344a['type'][_0x177a('0x2c')]};});_0x58c3e0[_0x177a('0x2d')]=_[_0x177a('0x29')](_0x14a0c5,_0x177a('0x26'));_0x58c3e0[_0x177a('0x2e')]=_['keys'](_0x4f4d8e[_0x177a('0x2e')]);_0x58c3e0['filters']=_['intersection'](_0x58c3e0[_0x177a('0x2d')],_0x58c3e0[_0x177a('0x2e')]);_0x2c6f02[_0x177a('0x2f')]=_[_0x177a('0x30')](_0x58c3e0[_0x177a('0x2d')],qs['fields'](_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x31')]));_0x2c6f02[_0x177a('0x2f')]=_0x2c6f02[_0x177a('0x2f')][_0x177a('0x32')]?_0x2c6f02['attributes']:_0x58c3e0['model'];if(!_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x33')](_0x177a('0x34'))){_0x2c6f02[_0x177a('0x1c')]=qs[_0x177a('0x1c')](_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x1c')]);_0x2c6f02[_0x177a('0x19')]=qs[_0x177a('0x19')](_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x19')]);}_0x2c6f02[_0x177a('0x35')]=qs[_0x177a('0x36')](_0x4f4d8e['query'][_0x177a('0x36')]);_0x2c6f02[_0x177a('0x37')]=qs[_0x177a('0x38')](_[_0x177a('0x39')](_0x4f4d8e['query'],_0x58c3e0[_0x177a('0x38')]),_0x14a0c5);if(_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x3a')]){_0x2c6f02[_0x177a('0x37')]=_[_0x177a('0x3b')](_0x2c6f02[_0x177a('0x37')],{'$or':_[_0x177a('0x29')](_0x14a0c5,function(_0x58cf1d){if(_0x58cf1d[_0x177a('0x3c')]!=='VIRTUAL'){var _0x563ddd={};_0x563ddd[_0x58cf1d['name']]={'$like':'%'+_0x4f4d8e['query']['filter']+'%'};return _0x563ddd;}})});}_0x2c6f02=_[_0x177a('0x3b')]({},_0x2c6f02,_0x4f4d8e['options']);var _0x435580={'where':_0x2c6f02[_0x177a('0x37')]};return db[_0x177a('0x3d')][_0x177a('0x1b')](_0x435580)['then'](function(_0xc54d9){_0x1ef918[_0x177a('0x1b')]=_0xc54d9;if(_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x3e')]){_0x2c6f02[_0x177a('0x3f')]=[{'all':!![]}];}return db[_0x177a('0x3d')]['findAll'](_0x2c6f02);})['then'](function(_0x4d935c){_0x1ef918['rows']=_0x4d935c;return _0x1ef918;})['then'](respondWithFilteredResult(_0x4b7c15,_0x2c6f02))[_0x177a('0x40')](handleError(_0x4b7c15,null));};exports[_0x177a('0x41')]=function(_0x32baaa,_0x56898d){var _0x234414={'raw':!![],'where':{'id':_0x32baaa[_0x177a('0x42')]['id']}},_0xd2cf38={};_0xd2cf38[_0x177a('0x2d')]=_[_0x177a('0x43')](db['CmHopperAdditionalPhone'][_0x177a('0x2a')]);_0xd2cf38[_0x177a('0x2e')]=_['keys'](_0x32baaa[_0x177a('0x2e')]);_0xd2cf38[_0x177a('0x38')]=_[_0x177a('0x30')](_0xd2cf38[_0x177a('0x2d')],_0xd2cf38[_0x177a('0x2e')]);_0x234414['attributes']=_[_0x177a('0x30')](_0xd2cf38[_0x177a('0x2d')],qs[_0x177a('0x31')](_0x32baaa['query'][_0x177a('0x31')]));_0x234414[_0x177a('0x2f')]=_0x234414[_0x177a('0x2f')][_0x177a('0x32')]?_0x234414[_0x177a('0x2f')]:_0xd2cf38[_0x177a('0x2d')];if(_0x32baaa[_0x177a('0x2e')]['includeAll']){_0x234414['include']=[{'all':!![]}];}_0x234414=_[_0x177a('0x3b')]({},_0x234414,_0x32baaa[_0x177a('0x44')]);return db[_0x177a('0x3d')]['find'](_0x234414)['then'](handleEntityNotFound(_0x56898d,null))['then'](respondWithResult(_0x56898d,null))['catch'](handleError(_0x56898d,null));};exports['create']=function(_0x4a3caf,_0x3ab5d8){return db[_0x177a('0x3d')][_0x177a('0x45')](_0x4a3caf[_0x177a('0x46')],{})['then'](function(_0x3c11e3){var _0x2d6bd2=_0x4a3caf['user'][_0x177a('0x22')]({'plain':!![]});if(!_0x2d6bd2)throw new Error(_0x177a('0x47'));if(_0x2d6bd2['role']===_0x177a('0x48')){var _0x40387c=_0x3c11e3[_0x177a('0x22')]({'plain':!![]});var _0x2315ab=_0x177a('0x23');return db[_0x177a('0x49')][_0x177a('0x4a')]({'where':{'name':_0x2315ab,'userProfileId':_0x2d6bd2[_0x177a('0x4b')]},'raw':!![]})[_0x177a('0x20')](function(_0x249798){if(_0x249798&&_0x249798['autoAssociation']===0x0){return db[_0x177a('0x4c')][_0x177a('0x45')]({'name':_0x40387c[_0x177a('0x26')],'resourceId':_0x40387c['id'],'type':_0x249798[_0x177a('0x26')],'sectionId':_0x249798['id']},{})[_0x177a('0x20')](function(){return _0x3c11e3;});}else{return _0x3c11e3;}})[_0x177a('0x40')](function(_0x955d9c){logger[_0x177a('0x24')](_0x177a('0x4d'),_0x955d9c);throw _0x955d9c;});}return _0x3c11e3;})[_0x177a('0x20')](respondWithResult(_0x3ab5d8,0xc9))[_0x177a('0x40')](handleError(_0x3ab5d8,null));};exports['update']=function(_0x5cde70,_0x211dbb){if(_0x5cde70[_0x177a('0x46')]['id']){delete _0x5cde70['body']['id'];}return db['CmHopperAdditionalPhone'][_0x177a('0x4a')]({'where':{'id':_0x5cde70[_0x177a('0x42')]['id']}})['then'](handleEntityNotFound(_0x211dbb,null))['then'](saveUpdates(_0x5cde70[_0x177a('0x46')],null))[_0x177a('0x20')](respondWithResult(_0x211dbb,null))[_0x177a('0x40')](handleError(_0x211dbb,null));};exports[_0x177a('0x21')]=function(_0x51d0cd,_0x187251){return db['CmHopperAdditionalPhone'][_0x177a('0x4a')]({'where':{'id':_0x51d0cd[_0x177a('0x42')]['id']}})['then'](handleEntityNotFound(_0x187251,null))[_0x177a('0x20')](removeEntity(_0x187251,null))[_0x177a('0x40')](handleError(_0x187251,null));}; \ No newline at end of file +var _0xdc08=['sort','where','pick','VIRTUAL','filter','merge','options','CmHopperAdditionalPhone','includeAll','include','rows','catch','params','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order'];(function(_0x3caeb5,_0x219363){var _0x5eca7e=function(_0x4cae6b){while(--_0x4cae6b){_0x3caeb5['push'](_0x3caeb5['shift']());}};_0x5eca7e(++_0x219363);}(_0xdc08,0x117));var _0x8dc0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdc08[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8dc0('0x0'));var zipdir=require(_0x8dc0('0x1'));var jsonpatch=require(_0x8dc0('0x2'));var rp=require(_0x8dc0('0x3'));var moment=require('moment');var BPromise=require(_0x8dc0('0x4'));var Mustache=require(_0x8dc0('0x5'));var util=require(_0x8dc0('0x6'));var path=require(_0x8dc0('0x7'));var sox=require(_0x8dc0('0x8'));var csv=require(_0x8dc0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8dc0('0xa'));var squel=require(_0x8dc0('0xb'));var crypto=require('crypto');var jsforce=require(_0x8dc0('0xc'));var deskjs=require(_0x8dc0('0xd'));var toCsv=require(_0x8dc0('0x9'));var querystring=require(_0x8dc0('0xe'));var Papa=require(_0x8dc0('0xf'));var Redis=require(_0x8dc0('0x10'));var authService=require(_0x8dc0('0x11'));var qs=require(_0x8dc0('0x12'));var as=require(_0x8dc0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8dc0('0x14'))(_0x8dc0('0x15'));var utils=require(_0x8dc0('0x16'));var config=require(_0x8dc0('0x17'));var licenseUtil=require(_0x8dc0('0x18'));var db=require(_0x8dc0('0x19'))['db'];function respondWithStatusCode(_0x151638,_0x1ec0ee){_0x1ec0ee=_0x1ec0ee||0xcc;return function(_0x4c5801){if(_0x4c5801){return _0x151638[_0x8dc0('0x1a')](_0x1ec0ee);}return _0x151638[_0x8dc0('0x1b')](_0x1ec0ee)[_0x8dc0('0x1c')]();};}function respondWithResult(_0x51ab29,_0x155481){_0x155481=_0x155481||0xc8;return function(_0x823bff){if(_0x823bff){return _0x51ab29[_0x8dc0('0x1b')](_0x155481)[_0x8dc0('0x1d')](_0x823bff);}};}function respondWithFilteredResult(_0x4a2194,_0xeb393e){return function(_0x2cf80c){if(_0x2cf80c){var _0x4885e7=typeof _0xeb393e[_0x8dc0('0x1e')]===_0x8dc0('0x1f')&&typeof _0xeb393e['limit']===_0x8dc0('0x1f');var _0x2d2543=_0x2cf80c[_0x8dc0('0x20')];var _0x54cac9=_0x4885e7?0x0:_0xeb393e['offset'];var _0x41732b=_0x4885e7?_0x2cf80c['count']:_0xeb393e['offset']+_0xeb393e['limit'];var _0x152756;if(_0x41732b>=_0x2d2543){_0x41732b=_0x2d2543;_0x152756=0xc8;}else{_0x152756=0xce;}_0x4a2194[_0x8dc0('0x1b')](_0x152756);return _0x4a2194[_0x8dc0('0x21')](_0x8dc0('0x22'),_0x54cac9+'-'+_0x41732b+'/'+_0x2d2543)[_0x8dc0('0x1d')](_0x2cf80c);}return null;};}function patchUpdates(_0x4aebe3){return function(_0x5c9e95){try{jsonpatch[_0x8dc0('0x23')](_0x5c9e95,_0x4aebe3,!![]);}catch(_0x6bdad9){return BPromise[_0x8dc0('0x24')](_0x6bdad9);}return _0x5c9e95[_0x8dc0('0x25')]();};}function saveUpdates(_0x2b2bf7,_0x41b7c3){return function(_0x8f6a62){if(_0x8f6a62){return _0x8f6a62['update'](_0x2b2bf7)[_0x8dc0('0x26')](function(_0x58ccc4){return _0x58ccc4;});}return null;};}function removeEntity(_0x19ae6b,_0x4f9026){return function(_0x3d95c4){if(_0x3d95c4){return _0x3d95c4[_0x8dc0('0x27')]()[_0x8dc0('0x26')](function(){var _0x704f34=_0x3d95c4[_0x8dc0('0x28')]({'plain':!![]});var _0x5dd99f='CmHopperAdditionalPhones';return db[_0x8dc0('0x29')][_0x8dc0('0x27')]({'where':{'type':_0x5dd99f,'resourceId':_0x704f34['id']}})['then'](function(){return _0x3d95c4;});})['then'](function(){_0x19ae6b['status'](0xcc)[_0x8dc0('0x1c')]();});}};}function handleEntityNotFound(_0x4346b3,_0x302b37){return function(_0x3eb469){if(!_0x3eb469){_0x4346b3[_0x8dc0('0x1a')](0x194);}return _0x3eb469;};}function handleError(_0x1c76a1,_0x56196b){_0x56196b=_0x56196b||0x1f4;return function(_0x5dee1e){logger[_0x8dc0('0x2a')](_0x5dee1e[_0x8dc0('0x2b')]);if(_0x5dee1e[_0x8dc0('0x2c')]){delete _0x5dee1e[_0x8dc0('0x2c')];}_0x1c76a1[_0x8dc0('0x1b')](_0x56196b)['send'](_0x5dee1e);};}exports[_0x8dc0('0x2d')]=function(_0x26825d,_0x128211){var _0x2fcae0={},_0x2ded60={},_0x55218a={'count':0x0,'rows':[]};var _0x5eba01=_[_0x8dc0('0x2e')](db['CmHopperAdditionalPhone'][_0x8dc0('0x2f')],function(_0x372387){return{'name':_0x372387[_0x8dc0('0x30')],'type':_0x372387[_0x8dc0('0x31')][_0x8dc0('0x32')]};});_0x2ded60[_0x8dc0('0x33')]=_[_0x8dc0('0x2e')](_0x5eba01,'name');_0x2ded60[_0x8dc0('0x34')]=_[_0x8dc0('0x35')](_0x26825d['query']);_0x2ded60[_0x8dc0('0x36')]=_['intersection'](_0x2ded60['model'],_0x2ded60[_0x8dc0('0x34')]);_0x2fcae0[_0x8dc0('0x37')]=_['intersection'](_0x2ded60[_0x8dc0('0x33')],qs['fields'](_0x26825d[_0x8dc0('0x34')][_0x8dc0('0x38')]));_0x2fcae0[_0x8dc0('0x37')]=_0x2fcae0[_0x8dc0('0x37')][_0x8dc0('0x39')]?_0x2fcae0[_0x8dc0('0x37')]:_0x2ded60['model'];if(!_0x26825d[_0x8dc0('0x34')][_0x8dc0('0x3a')]('nolimit')){_0x2fcae0[_0x8dc0('0x3b')]=qs['limit'](_0x26825d[_0x8dc0('0x34')][_0x8dc0('0x3b')]);_0x2fcae0[_0x8dc0('0x1e')]=qs[_0x8dc0('0x1e')](_0x26825d['query'][_0x8dc0('0x1e')]);}_0x2fcae0[_0x8dc0('0x3c')]=qs[_0x8dc0('0x3d')](_0x26825d[_0x8dc0('0x34')][_0x8dc0('0x3d')]);_0x2fcae0[_0x8dc0('0x3e')]=qs[_0x8dc0('0x36')](_[_0x8dc0('0x3f')](_0x26825d[_0x8dc0('0x34')],_0x2ded60['filters']),_0x5eba01);if(_0x26825d[_0x8dc0('0x34')]['filter']){_0x2fcae0[_0x8dc0('0x3e')]=_['merge'](_0x2fcae0[_0x8dc0('0x3e')],{'$or':_[_0x8dc0('0x2e')](_0x5eba01,function(_0x40b1eb){if(_0x40b1eb[_0x8dc0('0x31')]!==_0x8dc0('0x40')){var _0x551c1b={};_0x551c1b[_0x40b1eb[_0x8dc0('0x2c')]]={'$like':'%'+_0x26825d[_0x8dc0('0x34')][_0x8dc0('0x41')]+'%'};return _0x551c1b;}})});}_0x2fcae0=_[_0x8dc0('0x42')]({},_0x2fcae0,_0x26825d[_0x8dc0('0x43')]);var _0x4debc9={'where':_0x2fcae0[_0x8dc0('0x3e')]};return db[_0x8dc0('0x44')][_0x8dc0('0x20')](_0x4debc9)['then'](function(_0x5a2da4){_0x55218a[_0x8dc0('0x20')]=_0x5a2da4;if(_0x26825d['query'][_0x8dc0('0x45')]){_0x2fcae0[_0x8dc0('0x46')]=[{'all':!![]}];}return db[_0x8dc0('0x44')]['findAll'](_0x2fcae0);})[_0x8dc0('0x26')](function(_0x425406){_0x55218a[_0x8dc0('0x47')]=_0x425406;return _0x55218a;})[_0x8dc0('0x26')](respondWithFilteredResult(_0x128211,_0x2fcae0))[_0x8dc0('0x48')](handleError(_0x128211,null));};exports['show']=function(_0x3907ef,_0x156966){var _0x3e4adf={'raw':!![],'where':{'id':_0x3907ef[_0x8dc0('0x49')]['id']}},_0x2a5feb={};_0x2a5feb['model']=_[_0x8dc0('0x35')](db['CmHopperAdditionalPhone'][_0x8dc0('0x2f')]);_0x2a5feb['query']=_['keys'](_0x3907ef[_0x8dc0('0x34')]);_0x2a5feb[_0x8dc0('0x36')]=_[_0x8dc0('0x4a')](_0x2a5feb[_0x8dc0('0x33')],_0x2a5feb[_0x8dc0('0x34')]);_0x3e4adf['attributes']=_['intersection'](_0x2a5feb[_0x8dc0('0x33')],qs[_0x8dc0('0x38')](_0x3907ef['query'][_0x8dc0('0x38')]));_0x3e4adf[_0x8dc0('0x37')]=_0x3e4adf['attributes'][_0x8dc0('0x39')]?_0x3e4adf[_0x8dc0('0x37')]:_0x2a5feb[_0x8dc0('0x33')];if(_0x3907ef[_0x8dc0('0x34')][_0x8dc0('0x45')]){_0x3e4adf[_0x8dc0('0x46')]=[{'all':!![]}];}_0x3e4adf=_[_0x8dc0('0x42')]({},_0x3e4adf,_0x3907ef[_0x8dc0('0x43')]);return db[_0x8dc0('0x44')][_0x8dc0('0x4b')](_0x3e4adf)[_0x8dc0('0x26')](handleEntityNotFound(_0x156966,null))[_0x8dc0('0x26')](respondWithResult(_0x156966,null))['catch'](handleError(_0x156966,null));};exports['create']=function(_0x50c340,_0xec3172){return db[_0x8dc0('0x44')]['create'](_0x50c340[_0x8dc0('0x4c')],{})[_0x8dc0('0x26')](function(_0x1e5e9a){var _0x57883e=_0x50c340[_0x8dc0('0x4d')][_0x8dc0('0x28')]({'plain':!![]});if(!_0x57883e)throw new Error(_0x8dc0('0x4e'));if(_0x57883e[_0x8dc0('0x4f')]===_0x8dc0('0x4d')){var _0x2e2647=_0x1e5e9a['get']({'plain':!![]});var _0x498f4e=_0x8dc0('0x50');return db[_0x8dc0('0x51')][_0x8dc0('0x4b')]({'where':{'name':_0x498f4e,'userProfileId':_0x57883e[_0x8dc0('0x52')]},'raw':!![]})['then'](function(_0xd05a39){if(_0xd05a39&&_0xd05a39[_0x8dc0('0x53')]===0x0){return db[_0x8dc0('0x29')]['create']({'name':_0x2e2647[_0x8dc0('0x2c')],'resourceId':_0x2e2647['id'],'type':_0xd05a39[_0x8dc0('0x2c')],'sectionId':_0xd05a39['id']},{})['then'](function(){return _0x1e5e9a;});}else{return _0x1e5e9a;}})['catch'](function(_0x6d9bf7){logger[_0x8dc0('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6d9bf7);throw _0x6d9bf7;});}return _0x1e5e9a;})[_0x8dc0('0x26')](respondWithResult(_0xec3172,0xc9))[_0x8dc0('0x48')](handleError(_0xec3172,null));};exports[_0x8dc0('0x54')]=function(_0x1353db,_0x51f666){if(_0x1353db[_0x8dc0('0x4c')]['id']){delete _0x1353db[_0x8dc0('0x4c')]['id'];}return db[_0x8dc0('0x44')][_0x8dc0('0x4b')]({'where':{'id':_0x1353db[_0x8dc0('0x49')]['id']}})[_0x8dc0('0x26')](handleEntityNotFound(_0x51f666,null))['then'](saveUpdates(_0x1353db[_0x8dc0('0x4c')],null))[_0x8dc0('0x26')](respondWithResult(_0x51f666,null))[_0x8dc0('0x48')](handleError(_0x51f666,null));};exports[_0x8dc0('0x27')]=function(_0x7d4cf1,_0x153719){return db['CmHopperAdditionalPhone'][_0x8dc0('0x4b')]({'where':{'id':_0x7d4cf1[_0x8dc0('0x49')]['id']}})[_0x8dc0('0x26')](handleEntityNotFound(_0x153719,null))[_0x8dc0('0x26')](removeEntity(_0x153719,null))[_0x8dc0('0x48')](handleError(_0x153719,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 107d4c1..df2432c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb757=['../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x342153,_0x5819c6){var _0x4dfa15=function(_0x41a4fb){while(--_0x41a4fb){_0x342153['push'](_0x342153['shift']());}};_0x4dfa15(++_0x5819c6);}(_0xb757,0x1d9));var _0x7b75=function(_0x30f697,_0x3c6248){_0x30f697=_0x30f697-0x0;var _0x46cab7=_0xb757[_0x30f697];return _0x46cab7;};'use strict';var _=require(_0x7b75('0x0'));var util=require(_0x7b75('0x1'));var logger=require(_0x7b75('0x2'))('api');var moment=require(_0x7b75('0x3'));var BPromise=require(_0x7b75('0x4'));var rp=require(_0x7b75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b75('0x6'));var config=require(_0x7b75('0x7'));var attributes=require(_0x7b75('0x8'));module['exports']=function(_0x49a7cd,_0x26665b){return _0x49a7cd[_0x7b75('0x9')](_0x7b75('0xa'),attributes,{'tableName':_0x7b75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0821=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x44ef4c,_0xc97435){var _0x19f8d6=function(_0x16e08a){while(--_0x16e08a){_0x44ef4c['push'](_0x44ef4c['shift']());}};_0x19f8d6(++_0xc97435);}(_0x0821,0xa5));var _0x1082=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x0821[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x1082('0x0'));var util=require(_0x1082('0x1'));var logger=require(_0x1082('0x2'))('api');var moment=require(_0x1082('0x3'));var BPromise=require(_0x1082('0x4'));var rp=require(_0x1082('0x5'));var fs=require('fs');var path=require(_0x1082('0x6'));var rimraf=require(_0x1082('0x7'));var config=require(_0x1082('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x1082('0x9')]=function(_0x1c0d4b,_0xf0839a){return _0x1c0d4b['define'](_0x1082('0xa'),attributes,{'tableName':_0x1082('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index d50fc0f..e95ecd0 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf85a=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countcongestionretry','entity','waitTime','duration','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf85a,0x197));var _0xaf85=function(_0x466718,_0x445cb5){_0x466718=_0x466718-0x0;var _0x38208d=_0xf85a[_0x466718];return _0x38208d;};'use strict';var _=require(_0xaf85('0x0'));var util=require(_0xaf85('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(_0xaf85('0x2'));var logger=require(_0xaf85('0x3'))(_0xaf85('0x4'));var config=require(_0xaf85('0x5'));var jayson=require(_0xaf85('0x6'));var client=jayson[_0xaf85('0x7')][_0xaf85('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x142be6,_0x2e8a44,_0x3da29c){return new BPromise(function(_0x16f2e0,_0x1b416e){return client[_0xaf85('0x9')](_0x142be6,_0x3da29c)[_0xaf85('0xa')](function(_0x4fcf16){logger[_0xaf85('0xb')](_0xaf85('0xc'),_0x2e8a44,_0xaf85('0xd'));logger[_0xaf85('0xe')](_0xaf85('0xf'),_0x2e8a44,_0xaf85('0xd'),JSON[_0xaf85('0x10')](_0x4fcf16));if(_0x4fcf16['error']){if(_0x4fcf16[_0xaf85('0x11')]['code']===0x1f4){logger[_0xaf85('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2e8a44,_0x4fcf16['error'][_0xaf85('0x12')]);return _0x1b416e(_0x4fcf16[_0xaf85('0x11')]['message']);}logger[_0xaf85('0x11')](_0xaf85('0xc'),_0x2e8a44,_0x4fcf16[_0xaf85('0x11')][_0xaf85('0x12')]);return _0x16f2e0(_0x4fcf16[_0xaf85('0x11')][_0xaf85('0x12')]);}else{logger[_0xaf85('0xb')](_0xaf85('0xc'),_0x2e8a44,_0xaf85('0xd'));_0x16f2e0(_0x4fcf16[_0xaf85('0x13')][_0xaf85('0x12')]);}})[_0xaf85('0x14')](function(_0x2b9156){logger[_0xaf85('0x11')](_0xaf85('0xc'),_0x2e8a44,_0x2b9156);_0x1b416e(_0x2b9156);});});}exports[_0xaf85('0x15')]=function(_0x49f0ce){var _0x2e929c=this;return new Promise(function(_0x3026b5,_0x1e8c5b){return db[_0xaf85('0x16')][_0xaf85('0x17')]({'raw':!![],'where':{'ContactId':_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x19')],'ListId':_0x49f0ce['body'][_0xaf85('0x1a')],'VoiceQueueId':_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x1b')]===undefined?null:_0x49f0ce['body'][_0xaf85('0x1b')],'CampaignId':_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x1c')]===undefined?null:_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x1c')]}})[_0xaf85('0xa')](function(_0x1c11df){if(_0x1c11df!=null){return db[_0xaf85('0x1d')][_0xaf85('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1c11df['id'],'OrderBy':{'$gt':_0x1c11df[_0xaf85('0x1e')]}},'order':[[_0xaf85('0x1e'),_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x853046){var _0x1046d2=0x0;if(_0x853046){if(_0x853046[_0xaf85('0x20')]+_0x853046['countcongestionretry']+_0x853046[_0xaf85('0x21')]+_0x853046[_0xaf85('0x22')]+_0x853046[_0xaf85('0x23')]+_0x853046[_0xaf85('0x24')]+_0x853046[_0xaf85('0x25')]+_0x853046[_0xaf85('0x26')]<_0x49f0ce['entity']['dialGlobalMaxRetry'])_0x1046d2=0x1;_0x3026b5({'additional':_0x1046d2});}else{return db[_0xaf85('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1c11df['id']},'order':[['OrderBy',_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x223568){var _0x210f97=0x0;if(_0x223568){if(_0x223568[_0xaf85('0x20')]+_0x223568[_0xaf85('0x27')]+_0x223568[_0xaf85('0x21')]+_0x223568['countnosuchnumberretry']+_0x223568[_0xaf85('0x23')]+_0x223568[_0xaf85('0x24')]+_0x223568[_0xaf85('0x25')]+_0x223568[_0xaf85('0x26')]<_0x49f0ce[_0xaf85('0x28')]['dialGlobalMaxRetry'])_0x210f97=0x1;_0x3026b5({'additional':_0x210f97});}else{_0x3026b5({'additional':0x0});}})['catch'](function(_0xe04900){logger[_0xaf85('0x11')](_0xaf85('0x15'),_0xe04900[_0xaf85('0x12')]);_0x1e8c5b(_0x2e929c[_0xaf85('0x11')](0x1f4,_0xe04900[_0xaf85('0x12')]));});}})[_0xaf85('0x14')](function(_0x2927a6){logger[_0xaf85('0x11')](_0xaf85('0x15'),_0x2927a6[_0xaf85('0x12')]);_0x1e8c5b(_0x2e929c[_0xaf85('0x11')](0x1f4,_0x2927a6[_0xaf85('0x12')]));});}else _0x3026b5({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x172993){var _0xd636c7=this;return new Promise(function(_0xa7f5,_0x33c57f){return db['CmHopper'][_0xaf85('0x17')]({'raw':!![],'where':{'ContactId':_0x172993['body'][_0xaf85('0x19')],'ListId':_0x172993['body'][_0xaf85('0x1a')],'VoiceQueueId':_0x172993['body'][_0xaf85('0x1b')]===undefined?null:_0x172993['body'][_0xaf85('0x1b')],'CampaignId':_0x172993[_0xaf85('0x18')][_0xaf85('0x1c')]===undefined?null:_0x172993[_0xaf85('0x18')][_0xaf85('0x1c')]}})[_0xaf85('0xa')](function(_0x366f90){if(_0x366f90!=null){return db['CmHopperAdditionalPhone'][_0xaf85('0x17')]({'raw':!![],'where':{'CmHopperId':_0x366f90['id'],'OrderBy':{'$gte':_0x366f90['OrderBy']}},'order':[[_0xaf85('0x1e'),_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x524cbf){if(_0x524cbf)return activateAdditionalPhone(_0x366f90,_0x172993[_0xaf85('0x18')],_0x524cbf,_0x172993['duration'],_0x172993[_0xaf85('0x29')])[_0xaf85('0xa')](function(_0x144976){_0xa7f5(_0x144976);});else{return db[_0xaf85('0x1d')][_0xaf85('0x17')]({'raw':!![],'where':{'CmHopperId':_0x366f90['id']},'order':[[_0xaf85('0x1e'),_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x565823){if(_0x565823)return activateAdditionalPhone(_0x366f90,_0x172993[_0xaf85('0x18')],_0x565823,_0x172993[_0xaf85('0x2a')],_0x172993[_0xaf85('0x29')])[_0xaf85('0xa')](function(_0xe9a6c7){_0xa7f5(_0xe9a6c7);});else{_0xa7f5({'id':_0x366f90['id'],'phone':''});}})['catch'](function(_0x224e94){logger['error'](_0xaf85('0x15'),_0x224e94[_0xaf85('0x12')]);_0x33c57f(_0xd636c7['error'](0x1f4,_0x224e94[_0xaf85('0x12')]));});}})['catch'](function(_0x1944a2){logger[_0xaf85('0x11')](_0xaf85('0x15'),_0x1944a2[_0xaf85('0x12')]);_0x33c57f(_0xd636c7[_0xaf85('0x11')](0x1f4,_0x1944a2[_0xaf85('0x12')]));});}else _0xa7f5(0x1);});});};function activateAdditionalPhone(_0x5550f5,_0x4259f3,_0x40cf13,_0x4c3691,_0x436ca5){return new Promise(function(_0x546f90,_0x51923b){var _0x406eef;if(_[_0xaf85('0x2b')](_0x40cf13[_0xaf85('0x2c')])){_0x40cf13[_0xaf85('0x2c')]=moment();}if(moment()>moment(_0x40cf13[_0xaf85('0x2c')])){_0x406eef=moment()['add'](_0x436ca5||0x3,_0xaf85('0x2d'));}else{if(_0x40cf13[_0xaf85('0x1e')]==0x0){_0x406eef=moment(_0x40cf13[_0xaf85('0x2c')]);}else{_0x406eef=moment()[_0xaf85('0x2e')](_0x436ca5||0x3,_0xaf85('0x2d'));}}if(_['isNil'](_0x406eef)){_0x406eef=moment()[_0xaf85('0x2e')](_0x436ca5||0x3,_0xaf85('0x2d'));}var _0xbf70b3={'phone':_0x5550f5[_0xaf85('0x2f')],'active':0x0,'OrderBy':_[_0xaf85('0x2b')](_0x5550f5[_0xaf85('0x1e')])?0x0:_0x5550f5[_0xaf85('0x1e')],'scheduledat':moment()[_0xaf85('0x2e')](_0x4c3691||0x1,'minutes'),'countbusyretry':_0x4259f3[_0xaf85('0x20')],'countcongestionretry':_0x4259f3[_0xaf85('0x27')],'countnoanswerretry':_0x4259f3[_0xaf85('0x21')],'countnosuchnumberretry':_0x4259f3[_0xaf85('0x22')],'countdropretry':_0x4259f3['countdropretry'],'countabandonedretry':_0x4259f3[_0xaf85('0x24')],'countmachineretry':_0x4259f3[_0xaf85('0x25')],'countagentrejectretry':_0x4259f3[_0xaf85('0x26')],'createdAt':_0x4259f3[_0xaf85('0x30')],'updatedAt':_0x4259f3[_0xaf85('0x31')]};var _0x3d7d02={'CmHopperId':_0x5550f5['id'],'phone':_0x40cf13[_0xaf85('0x2f')],'active':0x0,'OrderBy':_[_0xaf85('0x2b')](_0x40cf13[_0xaf85('0x1e')])?0x0:_0x40cf13['OrderBy'],'scheduledat':_0x406eef,'countbusyretry':_0x40cf13[_0xaf85('0x20')],'countcongestionretry':_0x40cf13[_0xaf85('0x27')],'countnoanswerretry':_0x40cf13[_0xaf85('0x21')],'countnosuchnumberretry':_0x40cf13['countnosuchnumberretry'],'countdropretry':_0x40cf13[_0xaf85('0x23')],'countabandonedretry':_0x40cf13['countabandonedretry'],'countmachineretry':_0x40cf13['countmachineretry'],'countagentrejectretry':_0x40cf13[_0xaf85('0x26')],'createdAt':_0x40cf13[_0xaf85('0x30')],'updatedAt':_0x40cf13[_0xaf85('0x31')]};return db['sequelize'][_0xaf85('0x32')](function(_0x13f825){return db[_0xaf85('0x1d')]['update'](_0xbf70b3,{'where':{'id':_0x40cf13['id']}},{'transaction':_0x13f825})[_0xaf85('0xa')](function(){return db[_0xaf85('0x16')][_0xaf85('0x33')](_0x3d7d02,{'where':{'id':_0x5550f5['id']}},{'transaction':_0x13f825});});})[_0xaf85('0xa')](function(_0x2409a7){_0x546f90({'id':_0x5550f5['id'],'phone':_0x40cf13[_0xaf85('0x2f')]});})[_0xaf85('0x14')](function(_0x4cbece){logger['error'](_0xaf85('0x34'),_0x4cbece[_0xaf85('0x12')]);_0x51923b({'error':_0x4cbece[_0xaf85('0x12')]});});});}exports[_0xaf85('0x35')]=function(_0x59dae2){var _0x2efbca=this;return new Promise(function(_0x526ad3,_0x311b0b){return db[_0xaf85('0x16')][_0xaf85('0x33')](_0x59dae2[_0xaf85('0x18')][_0xaf85('0x36')],{'where':{'id':_0x59dae2['body']['id']}})['then'](function(_0x39baba){_0x526ad3(_0x39baba);})[_0xaf85('0x14')](function(_0x22392c){logger[_0xaf85('0x11')](_0xaf85('0x35'),_0x22392c[_0xaf85('0x12')]);_0x311b0b(_0x2efbca[_0xaf85('0x11')](0x1f4,_0x22392c['message']));});});}; \ No newline at end of file +var _0x01bf=['then','findOne','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','OrderBy','countmachineretry','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','isNil','scheduledat','minutes','phone','add','countnosuchnumberretry','updatedAt','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','CampaignId'];(function(_0x32753a,_0x313eff){var _0x5cc638=function(_0x87e14c){while(--_0x87e14c){_0x32753a['push'](_0x32753a['shift']());}};_0x5cc638(++_0x313eff);}(_0x01bf,0x93));var _0xf01b=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x01bf[_0x888385];return _0x22d5c2;};'use strict';var _=require(_0xf01b('0x0'));var util=require(_0xf01b('0x1'));var moment=require(_0xf01b('0x2'));var BPromise=require(_0xf01b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf01b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf01b('0x5'))(_0xf01b('0x6'));var config=require('../../config/environment');var jayson=require(_0xf01b('0x7'));var client=jayson[_0xf01b('0x8')][_0xf01b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b8552,_0x4e827b,_0x5464db){return new BPromise(function(_0x3364d5,_0x4196d1){return client['request'](_0x3b8552,_0x5464db)['then'](function(_0x2aa8b8){logger[_0xf01b('0xa')](_0xf01b('0xb'),_0x4e827b,_0xf01b('0xc'));logger[_0xf01b('0xd')](_0xf01b('0xe'),_0x4e827b,'request\x20sent',JSON[_0xf01b('0xf')](_0x2aa8b8));if(_0x2aa8b8[_0xf01b('0x10')]){if(_0x2aa8b8[_0xf01b('0x10')][_0xf01b('0x11')]===0x1f4){logger['error'](_0xf01b('0xb'),_0x4e827b,_0x2aa8b8[_0xf01b('0x10')][_0xf01b('0x12')]);return _0x4196d1(_0x2aa8b8[_0xf01b('0x10')]['message']);}logger[_0xf01b('0x10')](_0xf01b('0xb'),_0x4e827b,_0x2aa8b8[_0xf01b('0x10')]['message']);return _0x3364d5(_0x2aa8b8[_0xf01b('0x10')][_0xf01b('0x12')]);}else{logger['info'](_0xf01b('0xb'),_0x4e827b,'request\x20sent');_0x3364d5(_0x2aa8b8[_0xf01b('0x13')][_0xf01b('0x12')]);}})[_0xf01b('0x14')](function(_0x80fc77){logger[_0xf01b('0x10')](_0xf01b('0xb'),_0x4e827b,_0x80fc77);_0x4196d1(_0x80fc77);});});}exports[_0xf01b('0x15')]=function(_0x53065b){var _0x4da23a=this;return new Promise(function(_0x59f42a,_0x5176d5){return db[_0xf01b('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x53065b[_0xf01b('0x17')][_0xf01b('0x18')],'ListId':_0x53065b[_0xf01b('0x17')][_0xf01b('0x19')],'VoiceQueueId':_0x53065b['body']['VoiceQueueId']===undefined?null:_0x53065b[_0xf01b('0x17')]['VoiceQueueId'],'CampaignId':_0x53065b[_0xf01b('0x17')]['CampaignId']===undefined?null:_0x53065b[_0xf01b('0x17')][_0xf01b('0x1a')]}})[_0xf01b('0x1b')](function(_0x4707a0){if(_0x4707a0!=null){return db['CmHopperAdditionalPhone'][_0xf01b('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x4707a0['id'],'OrderBy':{'$gt':_0x4707a0['OrderBy']}},'order':[['OrderBy',_0xf01b('0x1d')]]})[_0xf01b('0x1b')](function(_0x591ddc){var _0x4152e7=0x0;if(_0x591ddc){if(_0x591ddc[_0xf01b('0x1e')]+_0x591ddc[_0xf01b('0x1f')]+_0x591ddc[_0xf01b('0x20')]+_0x591ddc['countnosuchnumberretry']+_0x591ddc[_0xf01b('0x21')]+_0x591ddc[_0xf01b('0x22')]+_0x591ddc['countmachineretry']+_0x591ddc[_0xf01b('0x23')]<_0x53065b[_0xf01b('0x24')][_0xf01b('0x25')])_0x4152e7=0x1;_0x59f42a({'additional':_0x4152e7});}else{return db[_0xf01b('0x26')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4707a0['id']},'order':[[_0xf01b('0x27'),'ASC']]})['then'](function(_0x444756){var _0x4a467e=0x0;if(_0x444756){if(_0x444756[_0xf01b('0x1e')]+_0x444756[_0xf01b('0x1f')]+_0x444756[_0xf01b('0x20')]+_0x444756['countnosuchnumberretry']+_0x444756[_0xf01b('0x21')]+_0x444756['countabandonedretry']+_0x444756[_0xf01b('0x28')]+_0x444756[_0xf01b('0x23')]<_0x53065b['entity'][_0xf01b('0x25')])_0x4a467e=0x1;_0x59f42a({'additional':_0x4a467e});}else{_0x59f42a({'additional':0x0});}})[_0xf01b('0x14')](function(_0x519130){logger[_0xf01b('0x10')]('VerifyAdditionalPhones',_0x519130[_0xf01b('0x12')]);_0x5176d5(_0x4da23a[_0xf01b('0x10')](0x1f4,_0x519130[_0xf01b('0x12')]));});}})['catch'](function(_0x2e7b9e){logger[_0xf01b('0x10')](_0xf01b('0x15'),_0x2e7b9e[_0xf01b('0x12')]);_0x5176d5(_0x4da23a[_0xf01b('0x10')](0x1f4,_0x2e7b9e[_0xf01b('0x12')]));});}else _0x59f42a({'additional':0x0});});});};exports[_0xf01b('0x29')]=function(_0x4a4a31){var _0x37d370=this;return new Promise(function(_0x398172,_0x4c990b){return db[_0xf01b('0x16')][_0xf01b('0x1c')]({'raw':!![],'where':{'ContactId':_0x4a4a31[_0xf01b('0x17')]['ContactId'],'ListId':_0x4a4a31[_0xf01b('0x17')][_0xf01b('0x19')],'VoiceQueueId':_0x4a4a31[_0xf01b('0x17')][_0xf01b('0x2a')]===undefined?null:_0x4a4a31[_0xf01b('0x17')][_0xf01b('0x2a')],'CampaignId':_0x4a4a31[_0xf01b('0x17')]['CampaignId']===undefined?null:_0x4a4a31[_0xf01b('0x17')][_0xf01b('0x1a')]}})[_0xf01b('0x1b')](function(_0x365a00){if(_0x365a00!=null){return db[_0xf01b('0x26')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x365a00['id'],'OrderBy':{'$gte':_0x365a00[_0xf01b('0x27')]}},'order':[[_0xf01b('0x27'),_0xf01b('0x1d')]]})['then'](function(_0x1898b0){if(_0x1898b0)return activateAdditionalPhone(_0x365a00,_0x4a4a31[_0xf01b('0x17')],_0x1898b0,_0x4a4a31[_0xf01b('0x2b')],_0x4a4a31[_0xf01b('0x2c')])[_0xf01b('0x1b')](function(_0x4c258a){_0x398172(_0x4c258a);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x365a00['id']},'order':[[_0xf01b('0x27'),_0xf01b('0x1d')]]})['then'](function(_0xde5163){if(_0xde5163)return activateAdditionalPhone(_0x365a00,_0x4a4a31[_0xf01b('0x17')],_0xde5163,_0x4a4a31[_0xf01b('0x2b')],_0x4a4a31[_0xf01b('0x2c')])[_0xf01b('0x1b')](function(_0x4fd268){_0x398172(_0x4fd268);});else{_0x398172({'id':_0x365a00['id'],'phone':''});}})[_0xf01b('0x14')](function(_0xb85dd9){logger[_0xf01b('0x10')]('VerifyAdditionalPhones',_0xb85dd9[_0xf01b('0x12')]);_0x4c990b(_0x37d370['error'](0x1f4,_0xb85dd9[_0xf01b('0x12')]));});}})[_0xf01b('0x14')](function(_0x399572){logger['error'](_0xf01b('0x15'),_0x399572['message']);_0x4c990b(_0x37d370['error'](0x1f4,_0x399572['message']));});}else _0x398172(0x1);});});};function activateAdditionalPhone(_0x238910,_0x499000,_0x6774a0,_0x28bad0,_0x3c7429){return new Promise(function(_0x30e4dc,_0x559ea6){var _0xe32b76;if(_[_0xf01b('0x2d')](_0x6774a0[_0xf01b('0x2e')])){_0x6774a0['scheduledat']=moment();}if(moment()>moment(_0x6774a0['scheduledat'])){_0xe32b76=moment()['add'](_0x3c7429||0x3,_0xf01b('0x2f'));}else{if(_0x6774a0[_0xf01b('0x27')]==0x0){_0xe32b76=moment(_0x6774a0['scheduledat']);}else{_0xe32b76=moment()['add'](_0x3c7429||0x3,_0xf01b('0x2f'));}}if(_[_0xf01b('0x2d')](_0xe32b76)){_0xe32b76=moment()['add'](_0x3c7429||0x3,'minutes');}var _0x3471a9={'phone':_0x238910[_0xf01b('0x30')],'active':0x0,'OrderBy':_[_0xf01b('0x2d')](_0x238910[_0xf01b('0x27')])?0x0:_0x238910['OrderBy'],'scheduledat':moment()[_0xf01b('0x31')](_0x28bad0||0x1,_0xf01b('0x2f')),'countbusyretry':_0x499000['countbusyretry'],'countcongestionretry':_0x499000[_0xf01b('0x1f')],'countnoanswerretry':_0x499000[_0xf01b('0x20')],'countnosuchnumberretry':_0x499000[_0xf01b('0x32')],'countdropretry':_0x499000[_0xf01b('0x21')],'countabandonedretry':_0x499000[_0xf01b('0x22')],'countmachineretry':_0x499000[_0xf01b('0x28')],'countagentrejectretry':_0x499000[_0xf01b('0x23')],'createdAt':_0x499000['createdAt'],'updatedAt':_0x499000[_0xf01b('0x33')]};var _0x4549bc={'CmHopperId':_0x238910['id'],'phone':_0x6774a0['phone'],'active':0x0,'OrderBy':_[_0xf01b('0x2d')](_0x6774a0['OrderBy'])?0x0:_0x6774a0[_0xf01b('0x27')],'scheduledat':_0xe32b76,'countbusyretry':_0x6774a0[_0xf01b('0x1e')],'countcongestionretry':_0x6774a0[_0xf01b('0x1f')],'countnoanswerretry':_0x6774a0[_0xf01b('0x20')],'countnosuchnumberretry':_0x6774a0['countnosuchnumberretry'],'countdropretry':_0x6774a0['countdropretry'],'countabandonedretry':_0x6774a0['countabandonedretry'],'countmachineretry':_0x6774a0['countmachineretry'],'countagentrejectretry':_0x6774a0[_0xf01b('0x23')],'createdAt':_0x6774a0[_0xf01b('0x34')],'updatedAt':_0x6774a0[_0xf01b('0x33')]};return db[_0xf01b('0x35')][_0xf01b('0x36')](function(_0x3a4562){return db['CmHopperAdditionalPhone'][_0xf01b('0x37')](_0x3471a9,{'where':{'id':_0x6774a0['id']}},{'transaction':_0x3a4562})[_0xf01b('0x1b')](function(){return db[_0xf01b('0x16')][_0xf01b('0x37')](_0x4549bc,{'where':{'id':_0x238910['id']}},{'transaction':_0x3a4562});});})[_0xf01b('0x1b')](function(_0x5c6b82){_0x30e4dc({'id':_0x238910['id'],'phone':_0x6774a0[_0xf01b('0x30')]});})[_0xf01b('0x14')](function(_0x2d1b4d){logger['error'](_0xf01b('0x38'),_0x2d1b4d[_0xf01b('0x12')]);_0x559ea6({'error':_0x2d1b4d[_0xf01b('0x12')]});});});}exports[_0xf01b('0x39')]=function(_0x134a11){var _0x1f0172=this;return new Promise(function(_0x270c13,_0x32d629){return db[_0xf01b('0x16')][_0xf01b('0x37')](_0x134a11[_0xf01b('0x17')]['field'],{'where':{'id':_0x134a11['body']['id']}})['then'](function(_0x11a1d1){_0x270c13(_0x11a1d1);})[_0xf01b('0x14')](function(_0x423529){logger['error'](_0xf01b('0x39'),_0x423529['message']);_0x32d629(_0x1f0172[_0xf01b('0x10')](0x1f4,_0x423529[_0xf01b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 94bc350..458764e 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fe8=['index','isAuthenticated','show','create','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','get'];(function(_0x378738,_0x343a3f){var _0x5579a2=function(_0x56a2cf){while(--_0x56a2cf){_0x378738['push'](_0x378738['shift']());}};_0x5579a2(++_0x343a3f);}(_0x0fe8,0x89));var _0x80fe=function(_0x53106a,_0x32e0d8){_0x53106a=_0x53106a-0x0;var _0x554fbb=_0x0fe8[_0x53106a];return _0x554fbb;};'use strict';var multer=require(_0x80fe('0x0'));var util=require(_0x80fe('0x1'));var path=require(_0x80fe('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x80fe('0x3')]();var fs_extra=require(_0x80fe('0x4'));var auth=require(_0x80fe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x80fe('0x6')]('/',auth['isAuthenticated'](),controller[_0x80fe('0x7')]);router['get']('/:id',auth[_0x80fe('0x8')](),controller[_0x80fe('0x9')]);router['post']('/',auth[_0x80fe('0x8')](),controller[_0x80fe('0xa')]);router[_0x80fe('0xb')](_0x80fe('0xc'),auth[_0x80fe('0x8')](),controller[_0x80fe('0xd')]);router[_0x80fe('0xe')]('/:id',auth[_0x80fe('0x8')](),controller['destroy']);module[_0x80fe('0xf')]=router; \ No newline at end of file +var _0x8ee4=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create'];(function(_0x96aef,_0x41d9ae){var _0x3ddeb3=function(_0x5dee2b){while(--_0x5dee2b){_0x96aef['push'](_0x96aef['shift']());}};_0x3ddeb3(++_0x41d9ae);}(_0x8ee4,0x115));var _0x48ee=function(_0x33e522,_0xd6fa75){_0x33e522=_0x33e522-0x0;var _0x3cdd35=_0x8ee4[_0x33e522];return _0x3cdd35;};'use strict';var multer=require(_0x48ee('0x0'));var util=require('util');var path=require(_0x48ee('0x1'));var timeout=require(_0x48ee('0x2'));var express=require('express');var router=express[_0x48ee('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x48ee('0x4'));var interaction=require(_0x48ee('0x5'));var config=require(_0x48ee('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x48ee('0x7')]('/',auth[_0x48ee('0x8')](),controller['index']);router[_0x48ee('0x7')](_0x48ee('0x9'),auth[_0x48ee('0x8')](),controller[_0x48ee('0xa')]);router['post']('/',auth[_0x48ee('0x8')](),controller[_0x48ee('0xb')]);router[_0x48ee('0xc')](_0x48ee('0x9'),auth[_0x48ee('0x8')](),controller[_0x48ee('0xd')]);router[_0x48ee('0xe')]('/:id',auth[_0x48ee('0x8')](),controller[_0x48ee('0xf')]);module[_0x48ee('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2de97d1..bedd242 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 _0xb30f=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x42b87a,_0x40d7b7){var _0xe395b8=function(_0x30080c){while(--_0x30080c){_0x42b87a['push'](_0x42b87a['shift']());}};_0xe395b8(++_0x40d7b7);}(_0xb30f,0x109));var _0xfb30=function(_0x560e76,_0x13c70e){_0x560e76=_0x560e76-0x0;var _0x38c457=_0xb30f[_0x560e76];return _0x38c457;};'use strict';var moment=require(_0xfb30('0x0'));var Sequelize=require(_0xfb30('0x1'));module[_0xfb30('0x2')]={'phone':{'type':Sequelize[_0xfb30('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfb30('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfb30('0x4')],'unique':_0xfb30('0x5')},'VoiceQueueId':{'type':Sequelize[_0xfb30('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xe5bc=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x2398ac,_0x4dc8c2){var _0x31cdd0=function(_0x5d913){while(--_0x5d913){_0x2398ac['push'](_0x2398ac['shift']());}};_0x31cdd0(++_0x4dc8c2);}(_0xe5bc,0x8c));var _0xce5b=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xe5bc[_0x125ff8];return _0x2d9ef;};'use strict';var moment=require(_0xce5b('0x0'));var Sequelize=require(_0xce5b('0x1'));module[_0xce5b('0x2')]={'phone':{'type':Sequelize[_0xce5b('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xce5b('0x4')],'unique':_0xce5b('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xce5b('0x5')},'VoiceQueueId':{'type':Sequelize[_0xce5b('0x4')],'unique':_0xce5b('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index fac06e4..cc4684b 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 _0xf019=['limit','count','set','Content-Range','apply','save','update','destroy','error','stack','send','index','map','CmHopperBlack','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','name','filter','merge','options','then','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf019,0x7b));var _0x9f01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf019[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9f01('0x0'));var rimraf=require(_0x9f01('0x1'));var zipdir=require(_0x9f01('0x2'));var jsonpatch=require(_0x9f01('0x3'));var rp=require('request-promise');var moment=require(_0x9f01('0x4'));var BPromise=require(_0x9f01('0x5'));var Mustache=require(_0x9f01('0x6'));var util=require(_0x9f01('0x7'));var path=require(_0x9f01('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f01('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f01('0xa'));var squel=require(_0x9f01('0xb'));var crypto=require(_0x9f01('0xc'));var jsforce=require(_0x9f01('0xd'));var deskjs=require(_0x9f01('0xe'));var toCsv=require(_0x9f01('0xf'));var querystring=require('querystring');var Papa=require(_0x9f01('0x10'));var Redis=require(_0x9f01('0x11'));var authService=require(_0x9f01('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9f01('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f01('0x14'))(_0x9f01('0x15'));var utils=require(_0x9f01('0x16'));var config=require(_0x9f01('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f01('0x18'))['db'];function respondWithStatusCode(_0x5ab156,_0x59604d){_0x59604d=_0x59604d||0xcc;return function(_0x137f90){if(_0x137f90){return _0x5ab156[_0x9f01('0x19')](_0x59604d);}return _0x5ab156[_0x9f01('0x1a')](_0x59604d)[_0x9f01('0x1b')]();};}function respondWithResult(_0xbf8876,_0x3ef688){_0x3ef688=_0x3ef688||0xc8;return function(_0x315cdb){if(_0x315cdb){return _0xbf8876['status'](_0x3ef688)[_0x9f01('0x1c')](_0x315cdb);}};}function respondWithFilteredResult(_0x4988c8,_0x1e3717){return function(_0x40eb72){if(_0x40eb72){var _0x4eaa70=typeof _0x1e3717[_0x9f01('0x1d')]===_0x9f01('0x1e')&&typeof _0x1e3717[_0x9f01('0x1f')]===_0x9f01('0x1e');var _0xab6dbd=_0x40eb72[_0x9f01('0x20')];var _0x2fdcbf=_0x4eaa70?0x0:_0x1e3717[_0x9f01('0x1d')];var _0x31cfaf=_0x4eaa70?_0x40eb72[_0x9f01('0x20')]:_0x1e3717[_0x9f01('0x1d')]+_0x1e3717['limit'];var _0x284f13;if(_0x31cfaf>=_0xab6dbd){_0x31cfaf=_0xab6dbd;_0x284f13=0xc8;}else{_0x284f13=0xce;}_0x4988c8[_0x9f01('0x1a')](_0x284f13);return _0x4988c8[_0x9f01('0x21')](_0x9f01('0x22'),_0x2fdcbf+'-'+_0x31cfaf+'/'+_0xab6dbd)['json'](_0x40eb72);}return null;};}function patchUpdates(_0x132923){return function(_0x550a6c){try{jsonpatch[_0x9f01('0x23')](_0x550a6c,_0x132923,!![]);}catch(_0x176fc9){return BPromise['reject'](_0x176fc9);}return _0x550a6c[_0x9f01('0x24')]();};}function saveUpdates(_0x3b53dd,_0x565503){return function(_0x2620bc){if(_0x2620bc){return _0x2620bc[_0x9f01('0x25')](_0x3b53dd)['then'](function(_0x27d8b5){return _0x27d8b5;});}return null;};}function removeEntity(_0xd1f7bc,_0x8a9e3e){return function(_0x1fa2af){if(_0x1fa2af){return _0x1fa2af[_0x9f01('0x26')]()['then'](function(){_0xd1f7bc['status'](0xcc)[_0x9f01('0x1b')]();});}};}function handleEntityNotFound(_0x476bbb,_0xe0aca0){return function(_0x1a5e16){if(!_0x1a5e16){_0x476bbb[_0x9f01('0x19')](0x194);}return _0x1a5e16;};}function handleError(_0x336d78,_0x21519e){_0x21519e=_0x21519e||0x1f4;return function(_0x7600e0){logger[_0x9f01('0x27')](_0x7600e0[_0x9f01('0x28')]);if(_0x7600e0['name']){delete _0x7600e0['name'];}_0x336d78['status'](_0x21519e)[_0x9f01('0x29')](_0x7600e0);};}exports[_0x9f01('0x2a')]=function(_0xa44f35,_0x12da06){var _0x24a047={},_0x405eed={},_0x19acfc={'count':0x0,'rows':[]};var _0x4d9c85=_[_0x9f01('0x2b')](db[_0x9f01('0x2c')]['rawAttributes'],function(_0x76dae9){return{'name':_0x76dae9['fieldName'],'type':_0x76dae9[_0x9f01('0x2d')][_0x9f01('0x2e')]};});_0x405eed[_0x9f01('0x2f')]=_['map'](_0x4d9c85,'name');_0x405eed[_0x9f01('0x30')]=_['keys'](_0xa44f35[_0x9f01('0x30')]);_0x405eed[_0x9f01('0x31')]=_[_0x9f01('0x32')](_0x405eed['model'],_0x405eed[_0x9f01('0x30')]);_0x24a047[_0x9f01('0x33')]=_[_0x9f01('0x32')](_0x405eed[_0x9f01('0x2f')],qs['fields'](_0xa44f35['query'][_0x9f01('0x34')]));_0x24a047[_0x9f01('0x33')]=_0x24a047[_0x9f01('0x33')][_0x9f01('0x35')]?_0x24a047[_0x9f01('0x33')]:_0x405eed[_0x9f01('0x2f')];if(!_0xa44f35[_0x9f01('0x30')][_0x9f01('0x36')](_0x9f01('0x37'))){_0x24a047[_0x9f01('0x1f')]=qs[_0x9f01('0x1f')](_0xa44f35[_0x9f01('0x30')][_0x9f01('0x1f')]);_0x24a047['offset']=qs[_0x9f01('0x1d')](_0xa44f35[_0x9f01('0x30')]['offset']);}_0x24a047[_0x9f01('0x38')]=qs['sort'](_0xa44f35[_0x9f01('0x30')][_0x9f01('0x39')]);_0x24a047['where']=qs[_0x9f01('0x31')](_[_0x9f01('0x3a')](_0xa44f35[_0x9f01('0x30')],_0x405eed[_0x9f01('0x31')]),_0x4d9c85);if(_0xa44f35[_0x9f01('0x30')]['filter']){_0x24a047[_0x9f01('0x3b')]=_['merge'](_0x24a047[_0x9f01('0x3b')],{'$or':_[_0x9f01('0x2b')](_0x4d9c85,function(_0xea3d41){if(_0xea3d41[_0x9f01('0x2d')]!==_0x9f01('0x3c')){var _0x11da83={};_0x11da83[_0xea3d41[_0x9f01('0x3d')]]={'$like':'%'+_0xa44f35[_0x9f01('0x30')][_0x9f01('0x3e')]+'%'};return _0x11da83;}})});}_0x24a047=_[_0x9f01('0x3f')]({},_0x24a047,_0xa44f35[_0x9f01('0x40')]);var _0x29a383={'where':_0x24a047[_0x9f01('0x3b')]};return db[_0x9f01('0x2c')][_0x9f01('0x20')](_0x29a383)[_0x9f01('0x41')](function(_0x36e41c){_0x19acfc[_0x9f01('0x20')]=_0x36e41c;if(_0xa44f35[_0x9f01('0x30')][_0x9f01('0x42')]){_0x24a047[_0x9f01('0x43')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9f01('0x44')](_0x24a047);})[_0x9f01('0x41')](function(_0x2566c5){_0x19acfc[_0x9f01('0x45')]=_0x2566c5;return _0x19acfc;})[_0x9f01('0x41')](respondWithFilteredResult(_0x12da06,_0x24a047))['catch'](handleError(_0x12da06,null));};exports['show']=function(_0x502ca2,_0x4ec2db){var _0x50c494={'raw':!![],'where':{'id':_0x502ca2[_0x9f01('0x46')]['id']}},_0x5e87f2={};_0x5e87f2[_0x9f01('0x2f')]=_[_0x9f01('0x47')](db[_0x9f01('0x2c')][_0x9f01('0x48')]);_0x5e87f2[_0x9f01('0x30')]=_[_0x9f01('0x47')](_0x502ca2[_0x9f01('0x30')]);_0x5e87f2[_0x9f01('0x31')]=_['intersection'](_0x5e87f2['model'],_0x5e87f2['query']);_0x50c494['attributes']=_[_0x9f01('0x32')](_0x5e87f2[_0x9f01('0x2f')],qs[_0x9f01('0x34')](_0x502ca2[_0x9f01('0x30')][_0x9f01('0x34')]));_0x50c494[_0x9f01('0x33')]=_0x50c494[_0x9f01('0x33')]['length']?_0x50c494[_0x9f01('0x33')]:_0x5e87f2[_0x9f01('0x2f')];if(_0x502ca2[_0x9f01('0x30')]['includeAll']){_0x50c494['include']=[{'all':!![]}];}_0x50c494=_[_0x9f01('0x3f')]({},_0x50c494,_0x502ca2['options']);return db[_0x9f01('0x2c')][_0x9f01('0x49')](_0x50c494)['then'](handleEntityNotFound(_0x4ec2db,null))[_0x9f01('0x41')](respondWithResult(_0x4ec2db,null))[_0x9f01('0x4a')](handleError(_0x4ec2db,null));};exports[_0x9f01('0x25')]=function(_0x5569ac,_0x4ac3dc){if(_0x5569ac[_0x9f01('0x4b')]['id']){delete _0x5569ac[_0x9f01('0x4b')]['id'];}return db[_0x9f01('0x2c')]['find']({'where':{'id':_0x5569ac[_0x9f01('0x46')]['id']}})[_0x9f01('0x41')](handleEntityNotFound(_0x4ac3dc,null))['then'](saveUpdates(_0x5569ac[_0x9f01('0x4b')],null))[_0x9f01('0x41')](respondWithResult(_0x4ac3dc,null))[_0x9f01('0x4a')](handleError(_0x4ac3dc,null));};exports['destroy']=function(_0x1d0fba,_0x424192){return db[_0x9f01('0x2c')][_0x9f01('0x49')]({'where':{'id':_0x1d0fba[_0x9f01('0x46')]['id']}})[_0x9f01('0x41')](handleEntityNotFound(_0x424192,null))[_0x9f01('0x41')](removeEntity(_0x424192,null))[_0x9f01('0x4a')](handleError(_0x424192,null));};exports[_0x9f01('0x4c')]=function(_0x4c92da,_0x1c43dc){return db['CmHopperBlack'][_0x9f01('0x4c')]()['then'](respondWithResult(_0x1c43dc,null))[_0x9f01('0x4a')](handleError(_0x1c43dc,null));}; \ No newline at end of file +var _0x6309=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','index','map','CmHopperBlack','rawAttributes','type','key','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv'];(function(_0x58eb93,_0x3b8263){var _0xc0d5c0=function(_0x339a73){while(--_0x339a73){_0x58eb93['push'](_0x58eb93['shift']());}};_0xc0d5c0(++_0x3b8263);}(_0x6309,0x86));var _0x9630=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x6309[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x9630('0x0'));var rimraf=require(_0x9630('0x1'));var zipdir=require(_0x9630('0x2'));var jsonpatch=require(_0x9630('0x3'));var rp=require(_0x9630('0x4'));var moment=require(_0x9630('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9630('0x6'));var path=require(_0x9630('0x7'));var sox=require(_0x9630('0x8'));var csv=require(_0x9630('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9630('0xa'));var squel=require(_0x9630('0xb'));var crypto=require(_0x9630('0xc'));var jsforce=require(_0x9630('0xd'));var deskjs=require(_0x9630('0xe'));var toCsv=require(_0x9630('0x9'));var querystring=require(_0x9630('0xf'));var Papa=require(_0x9630('0x10'));var Redis=require(_0x9630('0x11'));var authService=require(_0x9630('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9630('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9630('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9630('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9630('0x16'))['db'];function respondWithStatusCode(_0x37d3f0,_0x33dbc8){_0x33dbc8=_0x33dbc8||0xcc;return function(_0x58d132){if(_0x58d132){return _0x37d3f0['sendStatus'](_0x33dbc8);}return _0x37d3f0['status'](_0x33dbc8)['end']();};}function respondWithResult(_0x3b7d4b,_0x167352){_0x167352=_0x167352||0xc8;return function(_0x33bef6){if(_0x33bef6){return _0x3b7d4b[_0x9630('0x17')](_0x167352)[_0x9630('0x18')](_0x33bef6);}};}function respondWithFilteredResult(_0x31a55c,_0x57ba09){return function(_0x21c5a7){if(_0x21c5a7){var _0x3aef92=typeof _0x57ba09['offset']==='undefined'&&typeof _0x57ba09[_0x9630('0x19')]===_0x9630('0x1a');var _0x191fc8=_0x21c5a7['count'];var _0xa38840=_0x3aef92?0x0:_0x57ba09['offset'];var _0x4b48fd=_0x3aef92?_0x21c5a7[_0x9630('0x1b')]:_0x57ba09[_0x9630('0x1c')]+_0x57ba09[_0x9630('0x19')];var _0x571169;if(_0x4b48fd>=_0x191fc8){_0x4b48fd=_0x191fc8;_0x571169=0xc8;}else{_0x571169=0xce;}_0x31a55c[_0x9630('0x17')](_0x571169);return _0x31a55c[_0x9630('0x1d')](_0x9630('0x1e'),_0xa38840+'-'+_0x4b48fd+'/'+_0x191fc8)['json'](_0x21c5a7);}return null;};}function patchUpdates(_0x3a4e21){return function(_0x3efc54){try{jsonpatch['apply'](_0x3efc54,_0x3a4e21,!![]);}catch(_0x1d9f1d){return BPromise[_0x9630('0x1f')](_0x1d9f1d);}return _0x3efc54[_0x9630('0x20')]();};}function saveUpdates(_0x27a45,_0x6821a8){return function(_0x2eccfe){if(_0x2eccfe){return _0x2eccfe[_0x9630('0x21')](_0x27a45)['then'](function(_0x534bff){return _0x534bff;});}return null;};}function removeEntity(_0x4e22aa,_0xa6873a){return function(_0x1e8bda){if(_0x1e8bda){return _0x1e8bda[_0x9630('0x22')]()[_0x9630('0x23')](function(){_0x4e22aa[_0x9630('0x17')](0xcc)[_0x9630('0x24')]();});}};}function handleEntityNotFound(_0x15e825,_0xee5757){return function(_0x36b2ba){if(!_0x36b2ba){_0x15e825[_0x9630('0x25')](0x194);}return _0x36b2ba;};}function handleError(_0x237336,_0x5edd88){_0x5edd88=_0x5edd88||0x1f4;return function(_0x233c14){logger[_0x9630('0x26')](_0x233c14['stack']);if(_0x233c14['name']){delete _0x233c14['name'];}_0x237336[_0x9630('0x17')](_0x5edd88)['send'](_0x233c14);};}exports[_0x9630('0x27')]=function(_0x285c0d,_0x536428){var _0x2fada4={},_0x1b14b2={},_0x376677={'count':0x0,'rows':[]};var _0x346f49=_[_0x9630('0x28')](db[_0x9630('0x29')][_0x9630('0x2a')],function(_0xa92b17){return{'name':_0xa92b17['fieldName'],'type':_0xa92b17[_0x9630('0x2b')][_0x9630('0x2c')]};});_0x1b14b2[_0x9630('0x2d')]=_[_0x9630('0x28')](_0x346f49,_0x9630('0x2e'));_0x1b14b2['query']=_[_0x9630('0x2f')](_0x285c0d[_0x9630('0x30')]);_0x1b14b2['filters']=_[_0x9630('0x31')](_0x1b14b2[_0x9630('0x2d')],_0x1b14b2[_0x9630('0x30')]);_0x2fada4['attributes']=_[_0x9630('0x31')](_0x1b14b2[_0x9630('0x2d')],qs['fields'](_0x285c0d['query'][_0x9630('0x32')]));_0x2fada4[_0x9630('0x33')]=_0x2fada4[_0x9630('0x33')][_0x9630('0x34')]?_0x2fada4[_0x9630('0x33')]:_0x1b14b2[_0x9630('0x2d')];if(!_0x285c0d['query'][_0x9630('0x35')](_0x9630('0x36'))){_0x2fada4[_0x9630('0x19')]=qs[_0x9630('0x19')](_0x285c0d['query'][_0x9630('0x19')]);_0x2fada4['offset']=qs[_0x9630('0x1c')](_0x285c0d['query'][_0x9630('0x1c')]);}_0x2fada4[_0x9630('0x37')]=qs[_0x9630('0x38')](_0x285c0d[_0x9630('0x30')][_0x9630('0x38')]);_0x2fada4[_0x9630('0x39')]=qs[_0x9630('0x3a')](_[_0x9630('0x3b')](_0x285c0d[_0x9630('0x30')],_0x1b14b2[_0x9630('0x3a')]),_0x346f49);if(_0x285c0d[_0x9630('0x30')][_0x9630('0x3c')]){_0x2fada4['where']=_[_0x9630('0x3d')](_0x2fada4[_0x9630('0x39')],{'$or':_['map'](_0x346f49,function(_0x141443){if(_0x141443[_0x9630('0x2b')]!==_0x9630('0x3e')){var _0x46043e={};_0x46043e[_0x141443[_0x9630('0x2e')]]={'$like':'%'+_0x285c0d[_0x9630('0x30')][_0x9630('0x3c')]+'%'};return _0x46043e;}})});}_0x2fada4=_[_0x9630('0x3d')]({},_0x2fada4,_0x285c0d[_0x9630('0x3f')]);var _0x53261b={'where':_0x2fada4['where']};return db[_0x9630('0x29')][_0x9630('0x1b')](_0x53261b)[_0x9630('0x23')](function(_0x5cd6fa){_0x376677[_0x9630('0x1b')]=_0x5cd6fa;if(_0x285c0d[_0x9630('0x30')][_0x9630('0x40')]){_0x2fada4[_0x9630('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9630('0x42')](_0x2fada4);})['then'](function(_0x24a103){_0x376677[_0x9630('0x43')]=_0x24a103;return _0x376677;})['then'](respondWithFilteredResult(_0x536428,_0x2fada4))['catch'](handleError(_0x536428,null));};exports['show']=function(_0x48e27b,_0x38a327){var _0xe47478={'raw':!![],'where':{'id':_0x48e27b['params']['id']}},_0x53af5c={};_0x53af5c[_0x9630('0x2d')]=_[_0x9630('0x2f')](db['CmHopperBlack'][_0x9630('0x2a')]);_0x53af5c['query']=_['keys'](_0x48e27b[_0x9630('0x30')]);_0x53af5c[_0x9630('0x3a')]=_[_0x9630('0x31')](_0x53af5c[_0x9630('0x2d')],_0x53af5c[_0x9630('0x30')]);_0xe47478[_0x9630('0x33')]=_[_0x9630('0x31')](_0x53af5c['model'],qs[_0x9630('0x32')](_0x48e27b['query'][_0x9630('0x32')]));_0xe47478[_0x9630('0x33')]=_0xe47478[_0x9630('0x33')][_0x9630('0x34')]?_0xe47478[_0x9630('0x33')]:_0x53af5c['model'];if(_0x48e27b[_0x9630('0x30')]['includeAll']){_0xe47478[_0x9630('0x41')]=[{'all':!![]}];}_0xe47478=_[_0x9630('0x3d')]({},_0xe47478,_0x48e27b[_0x9630('0x3f')]);return db['CmHopperBlack']['find'](_0xe47478)[_0x9630('0x23')](handleEntityNotFound(_0x38a327,null))['then'](respondWithResult(_0x38a327,null))[_0x9630('0x44')](handleError(_0x38a327,null));};exports['update']=function(_0x13bd4e,_0x10a60e){if(_0x13bd4e['body']['id']){delete _0x13bd4e[_0x9630('0x45')]['id'];}return db[_0x9630('0x29')]['find']({'where':{'id':_0x13bd4e['params']['id']}})[_0x9630('0x23')](handleEntityNotFound(_0x10a60e,null))['then'](saveUpdates(_0x13bd4e[_0x9630('0x45')],null))[_0x9630('0x23')](respondWithResult(_0x10a60e,null))[_0x9630('0x44')](handleError(_0x10a60e,null));};exports[_0x9630('0x22')]=function(_0x3af099,_0x212b26){return db[_0x9630('0x29')]['find']({'where':{'id':_0x3af099[_0x9630('0x46')]['id']}})['then'](handleEntityNotFound(_0x212b26,null))[_0x9630('0x23')](removeEntity(_0x212b26,null))[_0x9630('0x44')](handleError(_0x212b26,null));};exports[_0x9630('0x47')]=function(_0x2a78b0,_0x45445c){return db[_0x9630('0x29')]['describe']()[_0x9630('0x23')](respondWithResult(_0x45445c,null))[_0x9630('0x44')](handleError(_0x45445c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6d3d5f7..541cfe1 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 _0x10ba=['path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fbf3d,_0x3a80f4){var _0x2ff7a8=function(_0x285f94){while(--_0x285f94){_0x3fbf3d['push'](_0x3fbf3d['shift']());}};_0x2ff7a8(++_0x3a80f4);}(_0x10ba,0x1c0));var _0xa10b=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x10ba[_0x872b02];return _0x1a6b24;};'use strict';var _=require(_0xa10b('0x0'));var util=require(_0xa10b('0x1'));var logger=require(_0xa10b('0x2'))(_0xa10b('0x3'));var moment=require(_0xa10b('0x4'));var BPromise=require(_0xa10b('0x5'));var rp=require(_0xa10b('0x6'));var fs=require('fs');var path=require(_0xa10b('0x7'));var rimraf=require(_0xa10b('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xa10b('0x9')]=function(_0xc13910,_0x3fc7f7){return _0xc13910[_0xa10b('0xa')](_0xa10b('0xb'),attributes,{'tableName':_0xa10b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7105=['path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7105,0x15b));var _0x5710=function(_0x4e5031,_0x5d1b91){_0x4e5031=_0x4e5031-0x0;var _0x28c18f=_0x7105[_0x4e5031];return _0x28c18f;};'use strict';var _=require(_0x5710('0x0'));var util=require('util');var logger=require(_0x5710('0x1'))(_0x5710('0x2'));var moment=require(_0x5710('0x3'));var BPromise=require('bluebird');var rp=require(_0x5710('0x4'));var fs=require('fs');var path=require(_0x5710('0x5'));var rimraf=require(_0x5710('0x6'));var config=require('../../config/environment');var attributes=require(_0x5710('0x7'));module[_0x5710('0x8')]=function(_0x3490b8,_0x2b2095){return _0x3490b8['define'](_0x5710('0x9'),attributes,{'tableName':_0x5710('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 5678a3b..08a3868 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 _0x0674=['debug','DestroyCmHopperBlack','destroy','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopperBlack','options','raw','where','include','map','model','attributes','GetCmHopperBlack','UpdateCmHopperBlack','body','limit'];(function(_0x3c4d17,_0xc90a69){var _0x1eba1b=function(_0x58ec8c){while(--_0x58ec8c){_0x3c4d17['push'](_0x3c4d17['shift']());}};_0x1eba1b(++_0xc90a69);}(_0x0674,0x1a7));var _0x4067=function(_0x9d9b50,_0x2ad89f){_0x9d9b50=_0x9d9b50-0x0;var _0x57191f=_0x0674[_0x9d9b50];return _0x57191f;};'use strict';var _=require(_0x4067('0x0'));var util=require(_0x4067('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4067('0x2'));var fs=require('fs');var Redis=require(_0x4067('0x3'));var db=require(_0x4067('0x4'))['db'];var utils=require(_0x4067('0x5'));var logger=require(_0x4067('0x6'))('rpc');var config=require(_0x4067('0x7'));var jayson=require(_0x4067('0x8'));var client=jayson[_0x4067('0x9')][_0x4067('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x569050,_0x55b318,_0x4541af){return new BPromise(function(_0x45cead,_0xd1f22a){return client[_0x4067('0xb')](_0x569050,_0x4541af)[_0x4067('0xc')](function(_0x24012f){logger[_0x4067('0xd')](_0x4067('0xe'),_0x55b318,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x55b318,'request\x20sent',JSON[_0x4067('0xf')](_0x24012f));if(_0x24012f[_0x4067('0x10')]){if(_0x24012f['error'][_0x4067('0x11')]===0x1f4){logger[_0x4067('0x10')](_0x4067('0xe'),_0x55b318,_0x24012f[_0x4067('0x10')][_0x4067('0x12')]);return _0xd1f22a(_0x24012f[_0x4067('0x10')]['message']);}logger[_0x4067('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x55b318,_0x24012f[_0x4067('0x10')]['message']);return _0x45cead(_0x24012f['error'][_0x4067('0x12')]);}else{logger[_0x4067('0xd')](_0x4067('0xe'),_0x55b318,'request\x20sent');_0x45cead(_0x24012f['result'][_0x4067('0x12')]);}})[_0x4067('0x13')](function(_0x37a7cb){logger[_0x4067('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x55b318,_0x37a7cb);_0xd1f22a(_0x37a7cb);});});}exports['GetCmHopperBlack']=function(_0x5ab9e0){var _0x3d032e=this;return new Promise(function(_0x19c7dd,_0x3498cb){return db[_0x4067('0x14')]['findAll']({'raw':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0[_0x4067('0x15')][_0x4067('0x16')]===undefined?!![]:![]:!![],'where':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0[_0x4067('0x15')][_0x4067('0x17')]||null:null,'attributes':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0['options']['attributes']||null:null,'limit':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0[_0x4067('0x15')]['limit']||null:null,'include':_0x5ab9e0['options']?_0x5ab9e0[_0x4067('0x15')][_0x4067('0x18')]?_[_0x4067('0x19')](_0x5ab9e0['options'][_0x4067('0x18')],function(_0x6fba18){return{'model':db[_0x6fba18[_0x4067('0x1a')]],'as':_0x6fba18['as'],'attributes':_0x6fba18[_0x4067('0x1b')],'include':_0x6fba18[_0x4067('0x18')]?_[_0x4067('0x19')](_0x6fba18[_0x4067('0x18')],function(_0x49ab9c){return{'model':db[_0x49ab9c[_0x4067('0x1a')]],'as':_0x49ab9c['as'],'attributes':_0x49ab9c['attributes'],'include':_0x49ab9c[_0x4067('0x18')]?_['map'](_0x49ab9c[_0x4067('0x18')],function(_0x13c6c1){return{'model':db[_0x13c6c1['model']],'as':_0x13c6c1['as'],'attributes':_0x13c6c1[_0x4067('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4067('0xc')](function(_0x275d87){logger[_0x4067('0xd')](_0x4067('0x1c'),_0x5ab9e0);logger['debug']('GetCmHopperBlack',_0x5ab9e0,JSON['stringify'](_0x275d87));_0x19c7dd(_0x275d87);})[_0x4067('0x13')](function(_0x28b19a){logger[_0x4067('0x10')]('GetCmHopperBlack',_0x28b19a[_0x4067('0x12')],_0x5ab9e0);_0x3498cb(_0x3d032e[_0x4067('0x10')](0x1f4,_0x28b19a[_0x4067('0x12')]));});});};exports[_0x4067('0x1d')]=function(_0x2624bb){var _0x5a34ba=this;return new Promise(function(_0x3eccce,_0x5ba4e0){return db[_0x4067('0x14')]['update'](_0x2624bb[_0x4067('0x1e')],{'raw':_0x2624bb[_0x4067('0x15')]?_0x2624bb['options'][_0x4067('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2624bb[_0x4067('0x15')]?_0x2624bb[_0x4067('0x15')][_0x4067('0x17')]||null:null,'attributes':_0x2624bb[_0x4067('0x15')]?_0x2624bb[_0x4067('0x15')][_0x4067('0x1b')]||null:null,'limit':_0x2624bb[_0x4067('0x15')]?_0x2624bb['options'][_0x4067('0x1f')]||null:null})[_0x4067('0xc')](function(_0x1455fb){logger[_0x4067('0xd')](_0x4067('0x1d'),_0x2624bb);logger[_0x4067('0x20')](_0x4067('0x1d'),_0x2624bb,JSON[_0x4067('0xf')](_0x1455fb));_0x3eccce(_0x1455fb);})[_0x4067('0x13')](function(_0xba66f0){logger[_0x4067('0x10')](_0x4067('0x1d'),_0xba66f0['message'],_0x2624bb);_0x5ba4e0(_0x5a34ba['error'](0x1f4,_0xba66f0['message']));});});};exports[_0x4067('0x21')]=function(_0xeec870){var _0x53d33f=this;return new Promise(function(_0x28a195,_0x129269){return db[_0x4067('0x14')][_0x4067('0x22')]({'where':_0xeec870[_0x4067('0x15')]?_0xeec870[_0x4067('0x15')][_0x4067('0x17')]||null:null})['then'](function(_0x94219f){logger['info']('DestroyCmHopperBlack',_0xeec870);logger[_0x4067('0x20')](_0x4067('0x21'),_0xeec870,JSON[_0x4067('0xf')](_0x94219f));_0x28a195(_0x94219f);})[_0x4067('0x13')](function(_0x424a71){logger[_0x4067('0x10')](_0x4067('0x21'),_0x424a71['message'],_0xeec870);_0x129269(_0x53d33f[_0x4067('0x10')](0x1f4,_0x424a71[_0x4067('0x12')]));});});}; \ No newline at end of file +var _0xedbe=['request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','destroy','DestroyCmHopperBlack','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s'];(function(_0x2a3688,_0x3923aa){var _0x255227=function(_0x5d9443){while(--_0x5d9443){_0x2a3688['push'](_0x2a3688['shift']());}};_0x255227(++_0x3923aa);}(_0xedbe,0x15c));var _0xeedb=function(_0x44e08b,_0x9af188){_0x44e08b=_0x44e08b-0x0;var _0x40db31=_0xedbe[_0x44e08b];return _0x40db31;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeedb('0x0'));var BPromise=require('bluebird');var rs=require(_0xeedb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeedb('0x2'))['db'];var utils=require(_0xeedb('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xeedb('0x4'));var jayson=require(_0xeedb('0x5'));var client=jayson[_0xeedb('0x6')][_0xeedb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2edeaf,_0x5091d1,_0x1c7e89){return new BPromise(function(_0x4be7f2,_0x47762f){return client[_0xeedb('0x8')](_0x2edeaf,_0x1c7e89)[_0xeedb('0x9')](function(_0x11d08e){logger[_0xeedb('0xa')](_0xeedb('0xb'),_0x5091d1,_0xeedb('0xc'));logger[_0xeedb('0xd')](_0xeedb('0xe'),_0x5091d1,_0xeedb('0xc'),JSON[_0xeedb('0xf')](_0x11d08e));if(_0x11d08e[_0xeedb('0x10')]){if(_0x11d08e[_0xeedb('0x10')][_0xeedb('0x11')]===0x1f4){logger[_0xeedb('0x10')](_0xeedb('0xb'),_0x5091d1,_0x11d08e[_0xeedb('0x10')][_0xeedb('0x12')]);return _0x47762f(_0x11d08e['error'][_0xeedb('0x12')]);}logger['error'](_0xeedb('0xb'),_0x5091d1,_0x11d08e['error'][_0xeedb('0x12')]);return _0x4be7f2(_0x11d08e[_0xeedb('0x10')][_0xeedb('0x12')]);}else{logger[_0xeedb('0xa')](_0xeedb('0xb'),_0x5091d1,'request\x20sent');_0x4be7f2(_0x11d08e[_0xeedb('0x13')]['message']);}})[_0xeedb('0x14')](function(_0x3511b3){logger[_0xeedb('0x10')](_0xeedb('0xb'),_0x5091d1,_0x3511b3);_0x47762f(_0x3511b3);});});}exports[_0xeedb('0x15')]=function(_0x143bad){var _0x3a77df=this;return new Promise(function(_0x226081,_0x36ed60){return db[_0xeedb('0x16')][_0xeedb('0x17')]({'raw':_0x143bad[_0xeedb('0x18')]?_0x143bad[_0xeedb('0x18')][_0xeedb('0x19')]===undefined?!![]:![]:!![],'where':_0x143bad['options']?_0x143bad[_0xeedb('0x18')][_0xeedb('0x1a')]||null:null,'attributes':_0x143bad[_0xeedb('0x18')]?_0x143bad[_0xeedb('0x18')][_0xeedb('0x1b')]||null:null,'limit':_0x143bad['options']?_0x143bad[_0xeedb('0x18')][_0xeedb('0x1c')]||null:null,'include':_0x143bad[_0xeedb('0x18')]?_0x143bad[_0xeedb('0x18')][_0xeedb('0x1d')]?_['map'](_0x143bad[_0xeedb('0x18')][_0xeedb('0x1d')],function(_0xe35ba2){return{'model':db[_0xe35ba2['model']],'as':_0xe35ba2['as'],'attributes':_0xe35ba2['attributes'],'include':_0xe35ba2[_0xeedb('0x1d')]?_[_0xeedb('0x1e')](_0xe35ba2[_0xeedb('0x1d')],function(_0x5369ca){return{'model':db[_0x5369ca[_0xeedb('0x1f')]],'as':_0x5369ca['as'],'attributes':_0x5369ca[_0xeedb('0x1b')],'include':_0x5369ca[_0xeedb('0x1d')]?_['map'](_0x5369ca[_0xeedb('0x1d')],function(_0x51cc31){return{'model':db[_0x51cc31[_0xeedb('0x1f')]],'as':_0x51cc31['as'],'attributes':_0x51cc31[_0xeedb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeedb('0x9')](function(_0x31215e){logger['info'](_0xeedb('0x15'),_0x143bad);logger[_0xeedb('0xd')]('GetCmHopperBlack',_0x143bad,JSON[_0xeedb('0xf')](_0x31215e));_0x226081(_0x31215e);})[_0xeedb('0x14')](function(_0x472f55){logger[_0xeedb('0x10')](_0xeedb('0x15'),_0x472f55[_0xeedb('0x12')],_0x143bad);_0x36ed60(_0x3a77df[_0xeedb('0x10')](0x1f4,_0x472f55[_0xeedb('0x12')]));});});};exports[_0xeedb('0x20')]=function(_0x3fe209){var _0x273163=this;return new Promise(function(_0x4afcae,_0x20fab2){return db[_0xeedb('0x16')]['update'](_0x3fe209[_0xeedb('0x21')],{'raw':_0x3fe209[_0xeedb('0x18')]?_0x3fe209[_0xeedb('0x18')][_0xeedb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fe209[_0xeedb('0x18')]?_0x3fe209[_0xeedb('0x18')][_0xeedb('0x1a')]||null:null,'attributes':_0x3fe209[_0xeedb('0x18')]?_0x3fe209[_0xeedb('0x18')][_0xeedb('0x1b')]||null:null,'limit':_0x3fe209['options']?_0x3fe209[_0xeedb('0x18')][_0xeedb('0x1c')]||null:null})[_0xeedb('0x9')](function(_0x53f152){logger[_0xeedb('0xa')](_0xeedb('0x20'),_0x3fe209);logger['debug']('UpdateCmHopperBlack',_0x3fe209,JSON['stringify'](_0x53f152));_0x4afcae(_0x53f152);})[_0xeedb('0x14')](function(_0x3290cd){logger[_0xeedb('0x10')](_0xeedb('0x20'),_0x3290cd['message'],_0x3fe209);_0x20fab2(_0x273163[_0xeedb('0x10')](0x1f4,_0x3290cd[_0xeedb('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x225da0){var _0x57088c=this;return new Promise(function(_0x14854,_0x3230fd){return db[_0xeedb('0x16')][_0xeedb('0x22')]({'where':_0x225da0[_0xeedb('0x18')]?_0x225da0[_0xeedb('0x18')][_0xeedb('0x1a')]||null:null})[_0xeedb('0x9')](function(_0x3851bd){logger['info'](_0xeedb('0x23'),_0x225da0);logger[_0xeedb('0xd')](_0xeedb('0x23'),_0x225da0,JSON[_0xeedb('0xf')](_0x3851bd));_0x14854(_0x3851bd);})[_0xeedb('0x14')](function(_0xd6d8f2){logger[_0xeedb('0x10')]('DestroyCmHopperBlack',_0xd6d8f2['message'],_0x225da0);_0x3230fd(_0x57088c['error'](0x1f4,_0xd6d8f2[_0xeedb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c999e1b..432d089 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 _0x1261=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','/:id','put','delete','destroy'];(function(_0x4b2b9a,_0x44c576){var _0x104cbf=function(_0x157924){while(--_0x157924){_0x4b2b9a['push'](_0x4b2b9a['shift']());}};_0x104cbf(++_0x44c576);}(_0x1261,0x144));var _0x1126=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0x1261[_0x4d770d];return _0x11dc7a;};'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')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['update']);router[_0x1126('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1126('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1db9=['isAuthenticated','describe','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe'];(function(_0x5adb43,_0x874956){var _0x4cdf68=function(_0x577a39){while(--_0x577a39){_0x5adb43['push'](_0x5adb43['shift']());}};_0x4cdf68(++_0x874956);}(_0x1db9,0x176));var _0x91db=function(_0x4b3694,_0x5a7b39){_0x4b3694=_0x4b3694-0x0;var _0x294c0d=_0x1db9[_0x4b3694];return _0x294c0d;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0xc')](_0x91db('0xd'),auth[_0x91db('0xa')](),controller['update']);router[_0x91db('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x91db('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 80fb038..6acff3a 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 _0xeffb=['BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds'];(function(_0x13997b,_0x444387){var _0x159a69=function(_0x3244be){while(--_0x3244be){_0x13997b['push'](_0x13997b['shift']());}};_0x159a69(++_0x444387);}(_0xeffb,0x123));var _0xbeff=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0xeffb[_0x2c5255];return _0x30d0ea;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xbeff('0x0')]={'state':{'type':Sequelize[_0xbeff('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xbeff('0x2')]},'scheduledat':{'type':Sequelize[_0xbeff('0x3')]},'countbusyretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbeff('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbeff('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbeff('0x2')]},'calleridname':{'type':Sequelize[_0xbeff('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbeff('0x3')]},'answertime':{'type':Sequelize[_0xbeff('0x3')]},'droptime':{'type':Sequelize[_0xbeff('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbeff('0x2')]},'campaign':{'type':Sequelize[_0xbeff('0x2')]},'campaigntype':{'type':Sequelize[_0xbeff('0x2')]},'membername':{'type':Sequelize[_0xbeff('0x2')]},'reason':{'type':Sequelize[_0xbeff('0x2')]},'disposition':{'type':Sequelize[_0xbeff('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbeff('0x2')]},'dispositionat':{'type':Sequelize[_0xbeff('0x3')],'set':function(_0x32f9ca){var _0x48c30a=this[_0xbeff('0x4')](_0xbeff('0x5'));if(_0x48c30a&&_0x32f9ca){this['setDataValue'](_0xbeff('0x6'),moment(_0x32f9ca)[_0xbeff('0x7')](moment(_0x48c30a),_0xbeff('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbeff('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbeff('0x3')]},'callback':{'type':Sequelize[_0xbeff('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbeff('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbeff('0x3')]},'recallme':{'type':Sequelize[_0xbeff('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd35a=['seconds','BOOLEAN','moment','exports','DATE','INTEGER','STRING','getDataValue','setDataValue','followuptime','diff'];(function(_0x29b916,_0x520f2b){var _0x3857d2=function(_0x11b496){while(--_0x11b496){_0x29b916['push'](_0x29b916['shift']());}};_0x3857d2(++_0x520f2b);}(_0xd35a,0x157));var _0xad35=function(_0x3220bb,_0x342a03){_0x3220bb=_0x3220bb-0x0;var _0x23415c=_0xd35a[_0x3220bb];return _0x23415c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xad35('0x0'));module[_0xad35('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xad35('0x2')]},'countbusyretry':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xad35('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xad35('0x4')]},'originatecalleridname':{'type':Sequelize[_0xad35('0x4')]},'calleridnum':{'type':Sequelize[_0xad35('0x4')]},'calleridname':{'type':Sequelize[_0xad35('0x4')]},'starttime':{'type':Sequelize[_0xad35('0x2')]},'responsetime':{'type':Sequelize[_0xad35('0x2')]},'answertime':{'type':Sequelize[_0xad35('0x2')]},'droptime':{'type':Sequelize[_0xad35('0x2')]},'endtime':{'type':Sequelize[_0xad35('0x2')]},'ringtime':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xad35('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xad35('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xad35('0x4')]},'secondDisposition':{'type':Sequelize[_0xad35('0x4')]},'thirdDisposition':{'type':Sequelize[_0xad35('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x44b222){var _0x44c9fb=this[_0xad35('0x5')]('endtime');if(_0x44c9fb&&_0x44b222){this[_0xad35('0x6')](_0xad35('0x7'),moment(_0x44b222)[_0xad35('0x8')](moment(_0x44c9fb),_0xad35('0x9')));}}},'amd':{'type':Sequelize[_0xad35('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xad35('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xad35('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xad35('0x2')]},'callback':{'type':Sequelize[_0xad35('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xad35('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xad35('0x2')]},'recallme':{'type':Sequelize[_0xad35('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xad35('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xad35('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index ee51499..02b7263 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 _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(_0x3bbb5c,_0x532333){var _0x1eac9c=function(_0x5ba8aa){while(--_0x5ba8aa){_0x3bbb5c['push'](_0x3bbb5c['shift']());}};_0x1eac9c(++_0x532333);}(_0x1261,0x144));var _0x1126=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x1261[_0x57a9e5];return _0x36d39e;};'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 +var _0xfdbd=['status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','params','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','checkContactHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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'];(function(_0x19f000,_0x39ac54){var _0x81cee0=function(_0x1ea7b8){while(--_0x1ea7b8){_0x19f000['push'](_0x19f000['shift']());}};_0x81cee0(++_0x39ac54);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3e1415,_0x2ad5ee){_0x3e1415=_0x3e1415-0x0;var _0x2e1ec7=_0xfdbd[_0x3e1415];return _0x2e1ec7;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':!![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['CmHopperFinal']['describe']()[_0xdfdb('0x26')](respondWithResult(_0x273477,null))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports[_0xdfdb('0x24')]=function(_0x4bbb88,_0x36149e){if(_0x4bbb88[_0xdfdb('0x4b')][_0xdfdb('0x4c')]){delete _0x4bbb88[_0xdfdb('0x4b')]['uniqueid'];}return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'uniqueid':_0x4bbb88['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x36149e,null))[_0xdfdb('0x26')](saveUpdates(_0x4bbb88[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x36149e,null))[_0xdfdb('0x49')](handleError(_0x36149e,null));};exports[_0xdfdb('0x4d')]=function(_0x17dfdb,_0x1f5b88,_0x1da7af){return db['CmHopperFinal'][_0xdfdb('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x17dfdb['params']['id']},'attributes':[[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x53')))),'noAnswerContacts'],[db[_0xdfdb('0x4e')]['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x54')))),_0xdfdb('0x55')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x56')))),_0xdfdb('0x57')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x58')))),_0xdfdb('0x59')],[db['sequelize']['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5b')))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')]['literal'](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x1f5b88,null))['then'](respondWithResult(_0x1f5b88,null))[_0xdfdb('0x49')](handleError(_0x1f5b88,null));};exports[_0xdfdb('0x5f')]=function(_0x349cf7,_0x2f69a8,_0x424212){return db[_0xdfdb('0x2d')][_0xdfdb('0x44')]({'raw':![],'where':{'CampaignId':_0x349cf7[_0xdfdb('0x60')]['id']},'attributes':[[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xdfdb('0x61')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x54')))),'busyContacts'],[db['sequelize']['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xdfdb('0x57')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdfdb('0x59')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x2f69a8,null))[_0xdfdb('0x26')](respondWithResult(_0x2f69a8,null))['catch'](handleError(_0x2f69a8,null));};exports[_0xdfdb('0x62')]=function(_0x198cfa,_0x2831d6,_0x45bfc0){return db[_0xdfdb('0x63')]['find']({'where':{'id':_0x198cfa[_0xdfdb('0x60')]['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x2831d6,null))[_0xdfdb('0x26')](function(_0x1a31b9){var _0x4999c4;if(_0x1a31b9){_0x4999c4=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')](_0xdfdb('0x66'))[_0xdfdb('0x67')]([_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel['select']()[_0xdfdb('0x6f')](_0xdfdb('0x70'),'phone')[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)','ContactId')[_0xdfdb('0x6f')](_0xdfdb('0x72'),_0xdfdb('0x6b'))[_0xdfdb('0x6f')](_0xdfdb('0x73'),_0xdfdb('0x6c'))[_0xdfdb('0x6f')]('NOW()',_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')]('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id'][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x77'),_0x198cfa[_0xdfdb('0x4b')]['state'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')]('phone')[_0xdfdb('0x74')](_0xdfdb('0x66'))['where']('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id']['toString']()))['where'](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x7c'),_0x198cfa['params']['id'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x7d')))[_0xdfdb('0x7e')](_0xdfdb('0x6a')))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x4999c4);}return[];})[_0xdfdb('0x26')](respondWithResult(_0x2831d6,null))[_0xdfdb('0x49')](handleError(_0x2831d6,null));};exports[_0xdfdb('0x7f')]=function(_0x1b6445,_0x36241c,_0x4c833f){return db['Campaign'][_0xdfdb('0x48')]({'where':{'id':_0x1b6445[_0xdfdb('0x60')]['id']}})['then'](handleEntityNotFound(_0x36241c,null))[_0xdfdb('0x26')](function(_0x50d5d4){var _0x158454;if(_0x50d5d4){_0x158454=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')]('cm_hopper')[_0xdfdb('0x67')](['phone','scheduledAt',_0xdfdb('0x6a'),'ListId',_0xdfdb('0x80'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x70'),_0xdfdb('0x68'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)',_0xdfdb('0x6a'))['field']('ANY_VALUE(ListId)','ListId')['field'](_0xdfdb('0x81'),_0xdfdb('0x80'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x77'),_0x1b6445[_0xdfdb('0x4b')][_0xdfdb('0x83')][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()['field'](_0xdfdb('0x68'))[_0xdfdb('0x74')](_0xdfdb('0x66'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']()))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')]('cm_hopper_final')[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x7d')))['group']('ContactId'))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x158454);}return[];})['then'](respondWithResult(_0x36241c,null))[_0xdfdb('0x49')](handleError(_0x36241c,null));};exports[_0xdfdb('0x84')]=function(_0x1f87d3,_0x1bc293,_0x36b01e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x1f87d3[_0xdfdb('0x4b')]['VoiceQueueId'],'CampaignId':_0x1f87d3[_0xdfdb('0x4b')][_0xdfdb('0x80')],'ContactId':_0x1f87d3[_0xdfdb('0x4b')]['ContactId']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x1bc293,null))[_0xdfdb('0x26')](function(_0x3e0208){if(_0x3e0208){return _0x3e0208;}return null;})[_0xdfdb('0x26')](respondWithResult(_0x1bc293,null))['catch'](handleError(_0x1bc293,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 4d49a37..ff169b6 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 _0x50b5=['api','moment','bluebird','path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','util','../../config/logger'];(function(_0x4c1b52,_0x2a7fdc){var _0x28b9db=function(_0x3de7cd){while(--_0x3de7cd){_0x4c1b52['push'](_0x4c1b52['shift']());}};_0x28b9db(++_0x2a7fdc);}(_0x50b5,0x1a2));var _0x550b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x50b5[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0x550b('0x0'));var logger=require(_0x550b('0x1'))(_0x550b('0x2'));var moment=require(_0x550b('0x3'));var BPromise=require(_0x550b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x550b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x550b('0x6'));module[_0x550b('0x7')]=function(_0x25a20e,_0x3690d8){return _0x25a20e[_0x550b('0x8')](_0x550b('0x9'),attributes,{'tableName':_0x550b('0xa'),'paranoid':![],'indexes':[{'name':_0x550b('0xb'),'fields':[_0x550b('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x982d=['../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x982d,0x96));var _0xd982=function(_0x5b447a,_0x423de0){_0x5b447a=_0x5b447a-0x0;var _0x24c716=_0x982d[_0x5b447a];return _0x24c716;};'use strict';var _=require(_0xd982('0x0'));var util=require('util');var logger=require(_0xd982('0x1'))(_0xd982('0x2'));var moment=require('moment');var BPromise=require(_0xd982('0x3'));var rp=require(_0xd982('0x4'));var fs=require('fs');var path=require(_0xd982('0x5'));var rimraf=require('rimraf');var config=require(_0xd982('0x6'));var attributes=require(_0xd982('0x7'));module[_0xd982('0x8')]=function(_0x1f7b9c,_0x14f1d1){return _0x1f7b9c[_0xd982('0x9')]('CmHopperFinal',attributes,{'tableName':_0xd982('0xa'),'paranoid':![],'indexes':[{'name':_0xd982('0xb'),'fields':[_0xd982('0xb')]},{'name':'uniqueid','fields':[_0xd982('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 61d9477..dfa1d3d 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(_0x130120,_0x28ae1d){var _0x111389=function(_0x4cee3b){while(--_0x4cee3b){_0x130120['push'](_0x130120['shift']());}};_0x111389(++_0x28ae1d);}(_0xb10b,0x12a));var _0xbb10=function(_0x115785,_0x4d16fa){_0x115785=_0x115785-0x0;var _0x35224b=_0xb10b[_0x115785];return _0x35224b;};'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(_0x32b276,_0x5aa318){var _0x119b4b=function(_0x14a821){while(--_0x14a821){_0x32b276['push'](_0x32b276['shift']());}};_0x119b4b(++_0x5aa318);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xb10b[_0x4c4042];return _0xbd10dc;};'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 6f50e26..8dc3b94 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 _0xb784=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','/:id','exports','multer','util','path'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0xb784,0x16d));var _0x4b78=function(_0x2b8c61,_0x58f0ec){_0x2b8c61=_0x2b8c61-0x0;var _0x42f66d=_0xb784[_0x2b8c61];return _0x42f66d;};'use strict';var multer=require(_0x4b78('0x0'));var util=require(_0x4b78('0x1'));var path=require(_0x4b78('0x2'));var timeout=require(_0x4b78('0x3'));var express=require(_0x4b78('0x4'));var router=express[_0x4b78('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4b78('0x6'));var interaction=require(_0x4b78('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x4b78('0x8')]('/',auth[_0x4b78('0x9')](),controller[_0x4b78('0xa')]);router[_0x4b78('0x8')](_0x4b78('0xb'),auth[_0x4b78('0x9')](),controller[_0x4b78('0xc')]);router[_0x4b78('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4b78('0x8')]('/voice/queue/countAttributes/:id',auth[_0x4b78('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x4b78('0xd'),auth[_0x4b78('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x4b78('0xe'),auth['isAuthenticated'](),controller[_0x4b78('0xf')]);router[_0x4b78('0x10')](_0x4b78('0x11'),auth[_0x4b78('0x9')](),controller[_0x4b78('0x12')]);router[_0x4b78('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x4b78('0x13')]);router[_0x4b78('0x14')](_0x4b78('0x15'),auth['isAuthenticated'](),controller['update']);module[_0x4b78('0x16')]=router; \ No newline at end of file +var _0xf866=['/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index'];(function(_0x42c73d,_0x5cafcc){var _0x3d66b0=function(_0x47961b){while(--_0x47961b){_0x42c73d['push'](_0x42c73d['shift']());}};_0x3d66b0(++_0x5cafcc);}(_0xf866,0xb8));var _0x6f86=function(_0x16e15e,_0x213868){_0x16e15e=_0x16e15e-0x0;var _0x429a97=_0xf866[_0x16e15e];return _0x429a97;};'use strict';var multer=require(_0x6f86('0x0'));var util=require('util');var path=require(_0x6f86('0x1'));var timeout=require(_0x6f86('0x2'));var express=require('express');var router=express[_0x6f86('0x3')]();var fs_extra=require(_0x6f86('0x4'));var auth=require(_0x6f86('0x5'));var interaction=require(_0x6f86('0x6'));var config=require(_0x6f86('0x7'));var controller=require(_0x6f86('0x8'));router[_0x6f86('0x9')]('/',auth[_0x6f86('0xa')](),controller[_0x6f86('0xb')]);router[_0x6f86('0x9')](_0x6f86('0xc'),auth[_0x6f86('0xa')](),controller[_0x6f86('0xd')]);router[_0x6f86('0x9')](_0x6f86('0xe'),auth[_0x6f86('0xa')](),controller[_0x6f86('0xf')]);router[_0x6f86('0x9')](_0x6f86('0x10'),auth[_0x6f86('0xa')](),controller[_0x6f86('0x11')]);router[_0x6f86('0x9')](_0x6f86('0x12'),auth['isAuthenticated'](),controller[_0x6f86('0x13')]);router['post'](_0x6f86('0x14'),auth[_0x6f86('0xa')](),controller[_0x6f86('0x15')]);router[_0x6f86('0x16')](_0x6f86('0x17'),auth[_0x6f86('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x6f86('0x16')](_0x6f86('0x18'),auth[_0x6f86('0xa')](),controller[_0x6f86('0x19')]);router[_0x6f86('0x1a')]('/:id',auth[_0x6f86('0xa')](),controller['update']);module[_0x6f86('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 010d711..bd6a769 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 _0x7948=['STRING','DATE','BOOLEAN','INTEGER'];(function(_0x203a1e,_0x45f185){var _0x2a9516=function(_0x44e635){while(--_0x44e635){_0x203a1e['push'](_0x203a1e['shift']());}};_0x2a9516(++_0x45f185);}(_0x7948,0xc7));var _0x8794=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x7948[_0x4709c8];return _0x478cdd;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x8794('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x8794('0x1')]},'scheduledat':{'type':Sequelize[_0x8794('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8794('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8794('0x1')]},'calleridnum':{'type':Sequelize[_0x8794('0x1')]},'calleridname':{'type':Sequelize[_0x8794('0x1')]},'starttime':{'type':Sequelize[_0x8794('0x2')]},'responsetime':{'type':Sequelize[_0x8794('0x2')]},'answertime':{'type':Sequelize[_0x8794('0x2')]},'droptime':{'type':Sequelize[_0x8794('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8794('0x1')]},'campaign':{'type':Sequelize[_0x8794('0x1')]},'campaigntype':{'type':Sequelize[_0x8794('0x1')]},'membername':{'type':Sequelize[_0x8794('0x1')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8794('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8794('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8794('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8794('0x2')]},'edited':{'type':Sequelize[_0x8794('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8794('0x1')]}}; \ No newline at end of file +var _0xdbcd=['DATE','INTEGER','STRING','BOOLEAN','sequelize','exports'];(function(_0x37ca6f,_0x539b98){var _0x446230=function(_0x1ad3ce){while(--_0x1ad3ce){_0x37ca6f['push'](_0x37ca6f['shift']());}};_0x446230(++_0x539b98);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x1b0a56,_0x590497){_0x1b0a56=_0x1b0a56-0x0;var _0x498ffb=_0xdbcd[_0x1b0a56];return _0x498ffb;};'use strict';var Sequelize=require(_0xddbc('0x0'));module[_0xddbc('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xddbc('0x2')]},'countbusyretry':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xddbc('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xddbc('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xddbc('0x2')]},'ringtime':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xddbc('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xddbc('0x4')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xddbc('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xddbc('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xddbc('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xddbc('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xddbc('0x2')]},'recallme':{'type':Sequelize[_0xddbc('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xddbc('0x2')]},'edited':{'type':Sequelize[_0xddbc('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xddbc('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 23849d1..4b26e3e 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 _0x70b9=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','stack','name','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','util','path','to-csv','fs-extra','lodash','squel'];(function(_0x239f93,_0x59d5c6){var _0x449fa8=function(_0x11cef3){while(--_0x11cef3){_0x239f93['push'](_0x239f93['shift']());}};_0x449fa8(++_0x59d5c6);}(_0x70b9,0x11b));var _0x970b=function(_0x2b886a,_0x128eb5){_0x2b886a=_0x2b886a-0x0;var _0x509878=_0x70b9[_0x2b886a];return _0x509878;};'use strict';var emlformat=require(_0x970b('0x0'));var rimraf=require(_0x970b('0x1'));var zipdir=require(_0x970b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x970b('0x3'));var path=require(_0x970b('0x4'));var sox=require('sox');var csv=require(_0x970b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x970b('0x6'));var _=require(_0x970b('0x7'));var squel=require(_0x970b('0x8'));var crypto=require(_0x970b('0x9'));var jsforce=require(_0x970b('0xa'));var deskjs=require(_0x970b('0xb'));var toCsv=require(_0x970b('0x5'));var querystring=require(_0x970b('0xc'));var Papa=require(_0x970b('0xd'));var Redis=require(_0x970b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x970b('0xf'));var as=require(_0x970b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x970b('0x11'))(_0x970b('0x12'));var utils=require(_0x970b('0x13'));var config=require(_0x970b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x970b('0x15'))['db'];function respondWithStatusCode(_0x146474,_0x4e8c0f){_0x4e8c0f=_0x4e8c0f||0xcc;return function(_0x4f2e31){if(_0x4f2e31){return _0x146474['sendStatus'](_0x4e8c0f);}return _0x146474[_0x970b('0x16')](_0x4e8c0f)[_0x970b('0x17')]();};}function respondWithResult(_0x28ef5d,_0x48e54d){_0x48e54d=_0x48e54d||0xc8;return function(_0x2b9efa){if(_0x2b9efa){return _0x28ef5d['status'](_0x48e54d)[_0x970b('0x18')](_0x2b9efa);}};}function respondWithFilteredResult(_0x4fceba,_0x214ce7){return function(_0x1714c2){if(_0x1714c2){var _0x21a4d7=typeof _0x214ce7[_0x970b('0x19')]==='undefined'&&typeof _0x214ce7[_0x970b('0x1a')]===_0x970b('0x1b');var _0x4797c8=_0x1714c2[_0x970b('0x1c')];var _0x536e10=_0x21a4d7?0x0:_0x214ce7[_0x970b('0x19')];var _0x54a947=_0x21a4d7?_0x1714c2[_0x970b('0x1c')]:_0x214ce7['offset']+_0x214ce7[_0x970b('0x1a')];var _0x4efe0e;if(_0x54a947>=_0x4797c8){_0x54a947=_0x4797c8;_0x4efe0e=0xc8;}else{_0x4efe0e=0xce;}_0x4fceba['status'](_0x4efe0e);return _0x4fceba[_0x970b('0x1d')]('Content-Range',_0x536e10+'-'+_0x54a947+'/'+_0x4797c8)[_0x970b('0x18')](_0x1714c2);}return null;};}function patchUpdates(_0x6c277e){return function(_0x1b50ea){try{jsonpatch[_0x970b('0x1e')](_0x1b50ea,_0x6c277e,!![]);}catch(_0x3aca5d){return BPromise[_0x970b('0x1f')](_0x3aca5d);}return _0x1b50ea[_0x970b('0x20')]();};}function saveUpdates(_0xb4652e,_0xadd4ac){return function(_0x21de5f){if(_0x21de5f){return _0x21de5f[_0x970b('0x21')](_0xb4652e)[_0x970b('0x22')](function(_0x53fbf3){return _0x53fbf3;});}return null;};}function removeEntity(_0x22dc9a,_0x1ffac8){return function(_0x397743){if(_0x397743){return _0x397743['destroy']()[_0x970b('0x22')](function(){_0x22dc9a[_0x970b('0x16')](0xcc)[_0x970b('0x17')]();});}};}function handleEntityNotFound(_0x104dc2,_0xe8e08f){return function(_0x3a002d){if(!_0x3a002d){_0x104dc2[_0x970b('0x23')](0x194);}return _0x3a002d;};}function handleError(_0x56f002,_0x196e42){_0x196e42=_0x196e42||0x1f4;return function(_0x513d5e){logger['error'](_0x513d5e[_0x970b('0x24')]);if(_0x513d5e[_0x970b('0x25')]){delete _0x513d5e[_0x970b('0x25')];}_0x56f002[_0x970b('0x16')](_0x196e42)['send'](_0x513d5e);};}exports['index']=function(_0x3fea6d,_0x385a5f){var _0x221a38={},_0x81d71a={},_0x116b4d={'count':0x0,'rows':[]};var _0x4d2f8b=_[_0x970b('0x26')](db[_0x970b('0x27')][_0x970b('0x28')],function(_0x3e7197){return{'name':_0x3e7197[_0x970b('0x29')],'type':_0x3e7197[_0x970b('0x2a')][_0x970b('0x2b')]};});_0x81d71a[_0x970b('0x2c')]=_[_0x970b('0x26')](_0x4d2f8b,_0x970b('0x25'));_0x81d71a[_0x970b('0x2d')]=_['keys'](_0x3fea6d[_0x970b('0x2d')]);_0x81d71a[_0x970b('0x2e')]=_[_0x970b('0x2f')](_0x81d71a[_0x970b('0x2c')],_0x81d71a[_0x970b('0x2d')]);_0x221a38[_0x970b('0x30')]=_[_0x970b('0x2f')](_0x81d71a['model'],qs[_0x970b('0x31')](_0x3fea6d[_0x970b('0x2d')][_0x970b('0x31')]));_0x221a38['attributes']=_0x221a38[_0x970b('0x30')][_0x970b('0x32')]?_0x221a38[_0x970b('0x30')]:_0x81d71a['model'];if(!_0x3fea6d[_0x970b('0x2d')][_0x970b('0x33')](_0x970b('0x34'))){_0x221a38['limit']=qs['limit'](_0x3fea6d[_0x970b('0x2d')][_0x970b('0x1a')]);_0x221a38[_0x970b('0x19')]=qs[_0x970b('0x19')](_0x3fea6d['query']['offset']);}_0x221a38[_0x970b('0x35')]=qs[_0x970b('0x36')](_0x3fea6d[_0x970b('0x2d')]['sort']);_0x221a38[_0x970b('0x37')]=qs[_0x970b('0x2e')](_[_0x970b('0x38')](_0x3fea6d[_0x970b('0x2d')],_0x81d71a['filters']),_0x4d2f8b);if(_0x3fea6d[_0x970b('0x2d')][_0x970b('0x39')]){_0x221a38['where']=_[_0x970b('0x3a')](_0x221a38['where'],{'$or':_['map'](_0x4d2f8b,function(_0x430679){if(_0x430679[_0x970b('0x2a')]!==_0x970b('0x3b')){var _0x5bdd52={};_0x5bdd52[_0x430679[_0x970b('0x25')]]={'$like':'%'+_0x3fea6d[_0x970b('0x2d')][_0x970b('0x39')]+'%'};return _0x5bdd52;}})});}_0x221a38=_[_0x970b('0x3a')]({},_0x221a38,_0x3fea6d[_0x970b('0x3c')]);var _0x497904={'where':_0x221a38[_0x970b('0x37')]};return db[_0x970b('0x27')][_0x970b('0x1c')](_0x497904)['then'](function(_0x57756c){_0x116b4d[_0x970b('0x1c')]=_0x57756c;if(_0x3fea6d[_0x970b('0x2d')][_0x970b('0x3d')]){_0x221a38[_0x970b('0x3e')]=[{'all':!![]}];}return db[_0x970b('0x27')][_0x970b('0x3f')](_0x221a38);})['then'](function(_0x31b9d5){_0x116b4d['rows']=_0x31b9d5;return _0x116b4d;})[_0x970b('0x22')](respondWithFilteredResult(_0x385a5f,_0x221a38))[_0x970b('0x40')](handleError(_0x385a5f,null));};exports[_0x970b('0x41')]=function(_0x416499,_0x53e71a){var _0x1dc5fd={'raw':!![],'where':{'id':_0x416499[_0x970b('0x42')]['id']}},_0x59fde7={};_0x59fde7['model']=_['keys'](db['CmHopperHistory'][_0x970b('0x28')]);_0x59fde7['query']=_[_0x970b('0x43')](_0x416499[_0x970b('0x2d')]);_0x59fde7[_0x970b('0x2e')]=_[_0x970b('0x2f')](_0x59fde7[_0x970b('0x2c')],_0x59fde7['query']);_0x1dc5fd[_0x970b('0x30')]=_[_0x970b('0x2f')](_0x59fde7[_0x970b('0x2c')],qs['fields'](_0x416499[_0x970b('0x2d')][_0x970b('0x31')]));_0x1dc5fd[_0x970b('0x30')]=_0x1dc5fd[_0x970b('0x30')][_0x970b('0x32')]?_0x1dc5fd[_0x970b('0x30')]:_0x59fde7[_0x970b('0x2c')];if(_0x416499[_0x970b('0x2d')][_0x970b('0x3d')]){_0x1dc5fd[_0x970b('0x3e')]=[{'all':!![]}];}_0x1dc5fd=_[_0x970b('0x3a')]({},_0x1dc5fd,_0x416499['options']);return db[_0x970b('0x27')]['find'](_0x1dc5fd)['then'](handleEntityNotFound(_0x53e71a,null))[_0x970b('0x22')](respondWithResult(_0x53e71a,null))[_0x970b('0x40')](handleError(_0x53e71a,null));};exports[_0x970b('0x44')]=function(_0x3a317c,_0x49fd54){return db[_0x970b('0x27')][_0x970b('0x44')](_0x3a317c[_0x970b('0x45')],{})[_0x970b('0x22')](respondWithResult(_0x49fd54,0xc9))[_0x970b('0x40')](handleError(_0x49fd54,null));};exports['describe']=function(_0xbe3cc1,_0x16c764){return db[_0x970b('0x27')][_0x970b('0x46')]()[_0x970b('0x22')](respondWithResult(_0x16c764,null))[_0x970b('0x40')](handleError(_0x16c764,null));};exports['update']=function(_0x1f1e5d,_0x4301c9){if(_0x1f1e5d[_0x970b('0x45')][_0x970b('0x47')]){delete _0x1f1e5d[_0x970b('0x45')][_0x970b('0x47')];}return db[_0x970b('0x27')][_0x970b('0x48')]({'where':{'uniqueid':_0x1f1e5d[_0x970b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4301c9,null))[_0x970b('0x22')](saveUpdates(_0x1f1e5d[_0x970b('0x45')],null))[_0x970b('0x22')](respondWithResult(_0x4301c9,null))[_0x970b('0x40')](handleError(_0x4301c9,null));}; \ No newline at end of file +var _0x5296=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','describe','update','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x1d0fdd,_0x3d4d84){var _0x3e09c1=function(_0x492c3b){while(--_0x492c3b){_0x1d0fdd['push'](_0x1d0fdd['shift']());}};_0x3e09c1(++_0x3d4d84);}(_0x5296,0x68));var _0x6529=function(_0x589c86,_0x62230c){_0x589c86=_0x589c86-0x0;var _0x206aa0=_0x5296[_0x589c86];return _0x206aa0;};'use strict';var emlformat=require(_0x6529('0x0'));var rimraf=require(_0x6529('0x1'));var zipdir=require(_0x6529('0x2'));var jsonpatch=require(_0x6529('0x3'));var rp=require(_0x6529('0x4'));var moment=require('moment');var BPromise=require(_0x6529('0x5'));var Mustache=require(_0x6529('0x6'));var util=require(_0x6529('0x7'));var path=require('path');var sox=require(_0x6529('0x8'));var csv=require('to-csv');var ejs=require(_0x6529('0x9'));var fs=require('fs');var fs_extra=require(_0x6529('0xa'));var _=require(_0x6529('0xb'));var squel=require(_0x6529('0xc'));var crypto=require(_0x6529('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6529('0xe'));var toCsv=require(_0x6529('0xf'));var querystring=require('querystring');var Papa=require(_0x6529('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6529('0x11'));var as=require(_0x6529('0x12'));var hardwareService=require(_0x6529('0x13'));var logger=require(_0x6529('0x14'))(_0x6529('0x15'));var utils=require(_0x6529('0x16'));var config=require(_0x6529('0x17'));var licenseUtil=require(_0x6529('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x398a0d,_0x6adfcf){_0x6adfcf=_0x6adfcf||0xcc;return function(_0x17c284){if(_0x17c284){return _0x398a0d[_0x6529('0x19')](_0x6adfcf);}return _0x398a0d[_0x6529('0x1a')](_0x6adfcf)[_0x6529('0x1b')]();};}function respondWithResult(_0x35866e,_0x2abd6a){_0x2abd6a=_0x2abd6a||0xc8;return function(_0x2cf8b0){if(_0x2cf8b0){return _0x35866e[_0x6529('0x1a')](_0x2abd6a)[_0x6529('0x1c')](_0x2cf8b0);}};}function respondWithFilteredResult(_0x900d84,_0x5412a2){return function(_0x13fae1){if(_0x13fae1){var _0x4a3a19=typeof _0x5412a2[_0x6529('0x1d')]==='undefined'&&typeof _0x5412a2['limit']===_0x6529('0x1e');var _0x5445ae=_0x13fae1[_0x6529('0x1f')];var _0x323894=_0x4a3a19?0x0:_0x5412a2[_0x6529('0x1d')];var _0x483f75=_0x4a3a19?_0x13fae1[_0x6529('0x1f')]:_0x5412a2[_0x6529('0x1d')]+_0x5412a2['limit'];var _0x3316c4;if(_0x483f75>=_0x5445ae){_0x483f75=_0x5445ae;_0x3316c4=0xc8;}else{_0x3316c4=0xce;}_0x900d84[_0x6529('0x1a')](_0x3316c4);return _0x900d84[_0x6529('0x20')](_0x6529('0x21'),_0x323894+'-'+_0x483f75+'/'+_0x5445ae)[_0x6529('0x1c')](_0x13fae1);}return null;};}function patchUpdates(_0x22d3e2){return function(_0x4a13f2){try{jsonpatch[_0x6529('0x22')](_0x4a13f2,_0x22d3e2,!![]);}catch(_0x59d862){return BPromise[_0x6529('0x23')](_0x59d862);}return _0x4a13f2[_0x6529('0x24')]();};}function saveUpdates(_0x495227,_0x46ac36){return function(_0x3746de){if(_0x3746de){return _0x3746de['update'](_0x495227)['then'](function(_0x328a3f){return _0x328a3f;});}return null;};}function removeEntity(_0x29798f,_0xb534d6){return function(_0x28e1a2){if(_0x28e1a2){return _0x28e1a2[_0x6529('0x25')]()[_0x6529('0x26')](function(){_0x29798f[_0x6529('0x1a')](0xcc)[_0x6529('0x1b')]();});}};}function handleEntityNotFound(_0x1dd30d,_0x251aa8){return function(_0x3edfcb){if(!_0x3edfcb){_0x1dd30d[_0x6529('0x19')](0x194);}return _0x3edfcb;};}function handleError(_0x227b00,_0x598d9c){_0x598d9c=_0x598d9c||0x1f4;return function(_0x1fe9a2){logger[_0x6529('0x27')](_0x1fe9a2[_0x6529('0x28')]);if(_0x1fe9a2[_0x6529('0x29')]){delete _0x1fe9a2[_0x6529('0x29')];}_0x227b00[_0x6529('0x1a')](_0x598d9c)[_0x6529('0x2a')](_0x1fe9a2);};}exports[_0x6529('0x2b')]=function(_0x36284f,_0x538dc0){var _0x2a6353={},_0x1a9a5e={},_0x385df4={'count':0x0,'rows':[]};var _0x534177=_[_0x6529('0x2c')](db[_0x6529('0x2d')][_0x6529('0x2e')],function(_0x310b05){return{'name':_0x310b05[_0x6529('0x2f')],'type':_0x310b05['type'][_0x6529('0x30')]};});_0x1a9a5e[_0x6529('0x31')]=_[_0x6529('0x2c')](_0x534177,_0x6529('0x29'));_0x1a9a5e[_0x6529('0x32')]=_[_0x6529('0x33')](_0x36284f[_0x6529('0x32')]);_0x1a9a5e[_0x6529('0x34')]=_[_0x6529('0x35')](_0x1a9a5e[_0x6529('0x31')],_0x1a9a5e['query']);_0x2a6353['attributes']=_[_0x6529('0x35')](_0x1a9a5e[_0x6529('0x31')],qs[_0x6529('0x36')](_0x36284f['query'][_0x6529('0x36')]));_0x2a6353['attributes']=_0x2a6353[_0x6529('0x37')][_0x6529('0x38')]?_0x2a6353['attributes']:_0x1a9a5e[_0x6529('0x31')];if(!_0x36284f[_0x6529('0x32')][_0x6529('0x39')](_0x6529('0x3a'))){_0x2a6353[_0x6529('0x3b')]=qs['limit'](_0x36284f[_0x6529('0x32')][_0x6529('0x3b')]);_0x2a6353['offset']=qs[_0x6529('0x1d')](_0x36284f[_0x6529('0x32')][_0x6529('0x1d')]);}_0x2a6353[_0x6529('0x3c')]=qs[_0x6529('0x3d')](_0x36284f[_0x6529('0x32')][_0x6529('0x3d')]);_0x2a6353[_0x6529('0x3e')]=qs[_0x6529('0x34')](_[_0x6529('0x3f')](_0x36284f[_0x6529('0x32')],_0x1a9a5e[_0x6529('0x34')]),_0x534177);if(_0x36284f[_0x6529('0x32')][_0x6529('0x40')]){_0x2a6353['where']=_[_0x6529('0x41')](_0x2a6353[_0x6529('0x3e')],{'$or':_['map'](_0x534177,function(_0x173b24){if(_0x173b24['type']!==_0x6529('0x42')){var _0x6f1bb1={};_0x6f1bb1[_0x173b24['name']]={'$like':'%'+_0x36284f[_0x6529('0x32')][_0x6529('0x40')]+'%'};return _0x6f1bb1;}})});}_0x2a6353=_[_0x6529('0x41')]({},_0x2a6353,_0x36284f['options']);var _0x5775ae={'where':_0x2a6353[_0x6529('0x3e')]};return db[_0x6529('0x2d')]['count'](_0x5775ae)['then'](function(_0x5906c0){_0x385df4[_0x6529('0x1f')]=_0x5906c0;if(_0x36284f['query'][_0x6529('0x43')]){_0x2a6353[_0x6529('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6529('0x45')](_0x2a6353);})[_0x6529('0x26')](function(_0x281184){_0x385df4[_0x6529('0x46')]=_0x281184;return _0x385df4;})['then'](respondWithFilteredResult(_0x538dc0,_0x2a6353))[_0x6529('0x47')](handleError(_0x538dc0,null));};exports[_0x6529('0x48')]=function(_0x34d8ba,_0x2e6c50){var _0x3d52f5={'raw':!![],'where':{'id':_0x34d8ba['params']['id']}},_0x432b4d={};_0x432b4d[_0x6529('0x31')]=_[_0x6529('0x33')](db[_0x6529('0x2d')][_0x6529('0x2e')]);_0x432b4d[_0x6529('0x32')]=_[_0x6529('0x33')](_0x34d8ba[_0x6529('0x32')]);_0x432b4d[_0x6529('0x34')]=_[_0x6529('0x35')](_0x432b4d[_0x6529('0x31')],_0x432b4d[_0x6529('0x32')]);_0x3d52f5[_0x6529('0x37')]=_[_0x6529('0x35')](_0x432b4d[_0x6529('0x31')],qs[_0x6529('0x36')](_0x34d8ba[_0x6529('0x32')][_0x6529('0x36')]));_0x3d52f5[_0x6529('0x37')]=_0x3d52f5['attributes'][_0x6529('0x38')]?_0x3d52f5[_0x6529('0x37')]:_0x432b4d['model'];if(_0x34d8ba[_0x6529('0x32')][_0x6529('0x43')]){_0x3d52f5[_0x6529('0x44')]=[{'all':!![]}];}_0x3d52f5=_[_0x6529('0x41')]({},_0x3d52f5,_0x34d8ba['options']);return db['CmHopperHistory'][_0x6529('0x49')](_0x3d52f5)[_0x6529('0x26')](handleEntityNotFound(_0x2e6c50,null))['then'](respondWithResult(_0x2e6c50,null))[_0x6529('0x47')](handleError(_0x2e6c50,null));};exports[_0x6529('0x4a')]=function(_0x4a2091,_0x40be76){return db[_0x6529('0x2d')][_0x6529('0x4a')](_0x4a2091[_0x6529('0x4b')],{})['then'](respondWithResult(_0x40be76,0xc9))[_0x6529('0x47')](handleError(_0x40be76,null));};exports[_0x6529('0x4c')]=function(_0x4d7bc1,_0xbdd2a9){return db[_0x6529('0x2d')]['describe']()[_0x6529('0x26')](respondWithResult(_0xbdd2a9,null))[_0x6529('0x47')](handleError(_0xbdd2a9,null));};exports[_0x6529('0x4d')]=function(_0x2b5c69,_0x507a4c){if(_0x2b5c69[_0x6529('0x4b')][_0x6529('0x4e')]){delete _0x2b5c69[_0x6529('0x4b')]['uniqueid'];}return db[_0x6529('0x2d')][_0x6529('0x49')]({'where':{'uniqueid':_0x2b5c69[_0x6529('0x4f')]['id']}})[_0x6529('0x26')](handleEntityNotFound(_0x507a4c,null))[_0x6529('0x26')](saveUpdates(_0x2b5c69[_0x6529('0x4b')],null))[_0x6529('0x26')](respondWithResult(_0x507a4c,null))[_0x6529('0x47')](handleError(_0x507a4c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b5a5ad1..23f7b28 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 _0x8325=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x85f66,_0x413558){var _0x27221c=function(_0x5825f7){while(--_0x5825f7){_0x85f66['push'](_0x85f66['shift']());}};_0x27221c(++_0x413558);}(_0x8325,0x1f1));var _0x5832=function(_0x4b17e4,_0x9f5bd3){_0x4b17e4=_0x4b17e4-0x0;var _0x1dd2a7=_0x8325[_0x4b17e4];return _0x1dd2a7;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var logger=require(_0x5832('0x1'))('api');var moment=require(_0x5832('0x2'));var BPromise=require('bluebird');var rp=require(_0x5832('0x3'));var fs=require('fs');var path=require(_0x5832('0x4'));var rimraf=require(_0x5832('0x5'));var config=require(_0x5832('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x1c40ca,_0x2c7977){return _0x1c40ca[_0x5832('0x7')](_0x5832('0x8'),attributes,{'tableName':_0x5832('0x9'),'paranoid':![],'indexes':[{'name':_0x5832('0xa'),'fields':['endtime']},{'name':_0x5832('0xb'),'fields':[_0x5832('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','util','../../config/logger','api','bluebird'];(function(_0x78f00e,_0x36cd6d){var _0x3c631b=function(_0x49a714){while(--_0x49a714){_0x78f00e['push'](_0x78f00e['shift']());}};_0x3c631b(++_0x36cd6d);}(_0x2032,0xd9));var _0x2203=function(_0x14398f,_0x32a32a){_0x14398f=_0x14398f-0x0;var _0x372f87=_0x2032[_0x14398f];return _0x372f87;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'name':_0x2203('0xc'),'fields':[_0x2203('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 fd22a8c..1e9a075 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 _0x10bd=['`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','request\x20sent','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','catch','AvgHandleTime','sequelize','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','GetVoiceQueueHopperHistory','raw','where','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','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'];(function(_0x147cf7,_0x14dddf){var _0x4aec25=function(_0x1f8fa2){while(--_0x1f8fa2){_0x147cf7['push'](_0x147cf7['shift']());}};_0x4aec25(++_0x14dddf);}(_0x10bd,0x97));var _0xd10b=function(_0x2f6f3c,_0x2144f9){_0x2f6f3c=_0x2f6f3c-0x0;var _0x2565fc=_0x10bd[_0x2f6f3c];return _0x2565fc;};'use strict';var _=require('lodash');var util=require(_0xd10b('0x0'));var moment=require('moment');var BPromise=require(_0xd10b('0x1'));var rs=require(_0xd10b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd10b('0x3'));var logger=require(_0xd10b('0x4'))(_0xd10b('0x5'));var config=require(_0xd10b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd10b('0x7')][_0xd10b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xed7faa,_0x9f3ec1,_0x44c600){return new BPromise(function(_0x27aa3a,_0x18cdba){return client[_0xd10b('0x9')](_0xed7faa,_0x44c600)[_0xd10b('0xa')](function(_0x1fe7ec){logger[_0xd10b('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,'request\x20sent');logger['debug'](_0xd10b('0xc'),_0x9f3ec1,'request\x20sent',JSON[_0xd10b('0xd')](_0x1fe7ec));if(_0x1fe7ec['error']){if(_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0xf')]===0x1f4){logger[_0xd10b('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0x10')]);return _0x18cdba(_0x1fe7ec[_0xd10b('0xe')]['message']);}logger[_0xd10b('0xe')](_0xd10b('0x11'),_0x9f3ec1,_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0x10')]);return _0x27aa3a(_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0x10')]);}else{logger[_0xd10b('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,_0xd10b('0x12'));_0x27aa3a(_0x1fe7ec[_0xd10b('0x13')][_0xd10b('0x10')]);}})['catch'](function(_0x3383f1){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,_0x3383f1);_0x18cdba(_0x3383f1);});});}exports[_0xd10b('0x14')]=function(_0xe0f7da){var _0x263770=this;return new Promise(function(_0x503dce,_0x326fd3){return db[_0xd10b('0x15')][_0xd10b('0x16')](_0xe0f7da[_0xd10b('0x17')],{'raw':_0xe0f7da[_0xd10b('0x18')]?_0xe0f7da['options']['raw']===undefined?!![]:![]:!![]})[_0xd10b('0xa')](function(_0x30768d){logger[_0xd10b('0xb')](_0xd10b('0x14'),_0xe0f7da);logger['debug']('CreateCmHopperHistory',_0xe0f7da,JSON[_0xd10b('0xd')](_0x30768d));_0x503dce(_0x30768d);})[_0xd10b('0x19')](function(_0x234a76){logger[_0xd10b('0xe')](_0xd10b('0x14'),_0x234a76[_0xd10b('0x10')],_0xe0f7da);_0x326fd3(_0x263770[_0xd10b('0xe')](0x1f4,_0x234a76[_0xd10b('0x10')]));});});};exports[_0xd10b('0x1a')]=function(_0x258d5c){var _0x111fd5=this;return new Promise(function(_0x6b6e03,_0x532fd7){return db[_0xd10b('0x15')]['findAll']({'raw':_0x258d5c[_0xd10b('0x18')]?_0x258d5c[_0xd10b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x258d5c[_0xd10b('0x18')]?_0x258d5c[_0xd10b('0x18')]['where']||null:null,'attributes':[[db[_0xd10b('0x1b')]['fn']('COUNT',db['sequelize']['col']('id')),_0xd10b('0x1c')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db['sequelize'][_0xd10b('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xd10b('0x1f')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x20')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')]['literal'](_0xd10b('0x21')))),_0xd10b('0x22')],[db[_0xd10b('0x1b')]['fn']('AVG',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x23')))),_0xd10b('0x24')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x25'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x26')))),_0xd10b('0x27')]]})['then'](function(_0x3515e1){logger[_0xd10b('0xb')]('AvgHandleTime',_0x258d5c);logger[_0xd10b('0x28')]('AvgHandleTime',_0x258d5c,JSON[_0xd10b('0xd')](_0x3515e1));_0x6b6e03(_0x3515e1);})[_0xd10b('0x19')](function(_0x2cab89){logger[_0xd10b('0xe')]('AvgHandleTime',_0x2cab89[_0xd10b('0x10')],_0x258d5c);_0x532fd7(_0x111fd5[_0xd10b('0xe')](0x1f4,_0x2cab89[_0xd10b('0x10')]));});});};exports[_0xd10b('0x29')]=function(_0x3b347f){var _0x113047=this;return new Promise(function(_0x3baea2,_0x3f2c73){return db['CmHopperHistory']['findAll']({'raw':_0x3b347f[_0xd10b('0x18')]?_0x3b347f[_0xd10b('0x18')][_0xd10b('0x2a')]===undefined?!![]:![]:!![],'where':_0x3b347f[_0xd10b('0x18')]?_0x3b347f[_0xd10b('0x18')][_0xd10b('0x2b')]||null:null,'attributes':[[_0xd10b('0x2c'),'name'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xd10b('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db['sequelize']['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x2f')))),_0xd10b('0x30')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x31')))),_0xd10b('0x32')],[db['sequelize']['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x33')))),_0xd10b('0x34')],[db[_0xd10b('0x1b')]['fn']('COUNT',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x35')))),_0xd10b('0x36')],[db['sequelize']['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db['sequelize'][_0xd10b('0x1e')](_0xd10b('0x37')))),_0xd10b('0x38')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x39')))),_0xd10b('0x3a')],[db[_0xd10b('0x1b')]['fn']('COUNT',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x3b')))),_0xd10b('0x3c')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x3d')))),_0xd10b('0x3e')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0xd10b('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xd10b('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x40')))),_0xd10b('0x3f')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db['sequelize']['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xd10b('0x41')]],'group':[_0xd10b('0x2c')]})[_0xd10b('0xa')](function(_0x4f6110){logger['info'](_0xd10b('0x29'),_0x3b347f);logger[_0xd10b('0x28')](_0xd10b('0x29'),_0x3b347f,JSON[_0xd10b('0xd')](_0x4f6110));_0x3baea2(_0x4f6110);})[_0xd10b('0x19')](function(_0x31f685){logger['error'](_0xd10b('0x29'),_0x31f685[_0xd10b('0x10')],_0x3b347f);_0x3f2c73(_0x113047[_0xd10b('0xe')](0x1f4,_0x31f685['message']));});});};exports[_0xd10b('0x42')]=function(_0x1d41b5){var _0x266b1e=this;return new Promise(function(_0x36f95,_0xa8c602){return db[_0xd10b('0x15')][_0xd10b('0x43')]({'raw':_0x1d41b5['options']?_0x1d41b5[_0xd10b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1d41b5['options']?_0x1d41b5[_0xd10b('0x18')]['where']||null:null,'attributes':[[_0xd10b('0x2c'),'name'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db['sequelize']['col']('id')),_0xd10b('0x44')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xd10b('0x45')]],'group':[_0xd10b('0x2c')]})[_0xd10b('0xa')](function(_0x5e83fc){logger[_0xd10b('0xb')](_0xd10b('0x42'),_0x1d41b5);logger['debug'](_0xd10b('0x42'),_0x1d41b5,JSON[_0xd10b('0xd')](_0x5e83fc));_0x36f95(_0x5e83fc);})[_0xd10b('0x19')](function(_0x12154b){logger[_0xd10b('0xe')](_0xd10b('0x42'),_0x12154b[_0xd10b('0x10')],_0x1d41b5);_0xa8c602(_0x266b1e[_0xd10b('0xe')](0x1f4,_0x12154b['message']));});});}; \ No newline at end of file +var _0x47fd=['create','body','options','raw','findAll','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x47fd,0x13c));var _0xd47f=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0x47fd[_0x3132e8];return _0x43eb8c;};'use strict';var _=require(_0xd47f('0x0'));var util=require(_0xd47f('0x1'));var moment=require(_0xd47f('0x2'));var BPromise=require(_0xd47f('0x3'));var rs=require(_0xd47f('0x4'));var fs=require('fs');var Redis=require(_0xd47f('0x5'));var db=require(_0xd47f('0x6'))['db'];var utils=require(_0xd47f('0x7'));var logger=require(_0xd47f('0x8'))(_0xd47f('0x9'));var config=require('../../config/environment');var jayson=require(_0xd47f('0xa'));var client=jayson[_0xd47f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11c1d4,_0x4f4706,_0x55433e){return new BPromise(function(_0x38b07c,_0x56a97a){return client['request'](_0x11c1d4,_0x55433e)[_0xd47f('0xc')](function(_0x2b694d){logger[_0xd47f('0xd')](_0xd47f('0xe'),_0x4f4706,_0xd47f('0xf'));logger[_0xd47f('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4f4706,_0xd47f('0xf'),JSON[_0xd47f('0x11')](_0x2b694d));if(_0x2b694d['error']){if(_0x2b694d[_0xd47f('0x12')][_0xd47f('0x13')]===0x1f4){logger[_0xd47f('0x12')](_0xd47f('0xe'),_0x4f4706,_0x2b694d[_0xd47f('0x12')][_0xd47f('0x14')]);return _0x56a97a(_0x2b694d['error'][_0xd47f('0x14')]);}logger[_0xd47f('0x12')](_0xd47f('0xe'),_0x4f4706,_0x2b694d[_0xd47f('0x12')][_0xd47f('0x14')]);return _0x38b07c(_0x2b694d[_0xd47f('0x12')][_0xd47f('0x14')]);}else{logger[_0xd47f('0xd')](_0xd47f('0xe'),_0x4f4706,'request\x20sent');_0x38b07c(_0x2b694d['result'][_0xd47f('0x14')]);}})[_0xd47f('0x15')](function(_0x4d23b5){logger[_0xd47f('0x12')](_0xd47f('0xe'),_0x4f4706,_0x4d23b5);_0x56a97a(_0x4d23b5);});});}exports[_0xd47f('0x16')]=function(_0x40c533){var _0x2ace45=this;return new Promise(function(_0x5e5cf6,_0x2bde6a){return db[_0xd47f('0x17')][_0xd47f('0x18')](_0x40c533[_0xd47f('0x19')],{'raw':_0x40c533[_0xd47f('0x1a')]?_0x40c533[_0xd47f('0x1a')][_0xd47f('0x1b')]===undefined?!![]:![]:!![]})[_0xd47f('0xc')](function(_0x3663d3){logger[_0xd47f('0xd')](_0xd47f('0x16'),_0x40c533);logger[_0xd47f('0x10')](_0xd47f('0x16'),_0x40c533,JSON['stringify'](_0x3663d3));_0x5e5cf6(_0x3663d3);})['catch'](function(_0x336e1){logger['error'](_0xd47f('0x16'),_0x336e1[_0xd47f('0x14')],_0x40c533);_0x2bde6a(_0x2ace45[_0xd47f('0x12')](0x1f4,_0x336e1['message']));});});};exports['AvgHandleTime']=function(_0x50b1d6){var _0x3efb10=this;return new Promise(function(_0x36c6be,_0x42873c){return db[_0xd47f('0x17')][_0xd47f('0x1c')]({'raw':_0x50b1d6['options']?_0x50b1d6[_0xd47f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x50b1d6['options']?_0x50b1d6['options']['where']||null:null,'attributes':[[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db['sequelize']['col']('id')),_0xd47f('0x1f')],[db[_0xd47f('0x1d')]['fn']('COUNT',db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')][_0xd47f('0x20')](_0xd47f('0x21')))),_0xd47f('0x22')],[db[_0xd47f('0x1d')]['fn']('COUNT',db[_0xd47f('0x1d')]['fn']('IF',db['sequelize'][_0xd47f('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0xd47f('0x23')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xd47f('0x20')](_0xd47f('0x24')))),_0xd47f('0x25')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x26'),db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')][_0xd47f('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xd47f('0x27')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x26'),db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')][_0xd47f('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xd47f('0x28')]]})[_0xd47f('0xc')](function(_0x42f363){logger[_0xd47f('0xd')]('AvgHandleTime',_0x50b1d6);logger[_0xd47f('0x10')](_0xd47f('0x29'),_0x50b1d6,JSON[_0xd47f('0x11')](_0x42f363));_0x36c6be(_0x42f363);})['catch'](function(_0x58b54b){logger[_0xd47f('0x12')](_0xd47f('0x29'),_0x58b54b[_0xd47f('0x14')],_0x50b1d6);_0x42873c(_0x3efb10['error'](0x1f4,_0x58b54b[_0xd47f('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1d9429){var _0x689672=this;return new Promise(function(_0x45cc02,_0x3aa02f){return db[_0xd47f('0x17')]['findAll']({'raw':_0x1d9429['options']?_0x1d9429[_0xd47f('0x1a')][_0xd47f('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d9429[_0xd47f('0x1a')]?_0x1d9429['options'][_0xd47f('0x2a')]||null:null,'attributes':[[_0xd47f('0x2b'),_0xd47f('0x2c')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db['sequelize'][_0xd47f('0x20')](_0xd47f('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0xd47f('0x1e'),db['sequelize']['fn']('IF',db[_0xd47f('0x1d')][_0xd47f('0x20')]('`state`\x20=\x203,\x201,\x20null'))),_0xd47f('0x2e')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')]['literal'](_0xd47f('0x21')))),'outboundAnswerCallsDay'],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xd47f('0x2f')))),_0xd47f('0x30')],[db['sequelize']['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')]['literal'](_0xd47f('0x31')))),_0xd47f('0x32')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db['sequelize']['fn']('IF',db[_0xd47f('0x1d')]['literal'](_0xd47f('0x33')))),_0xd47f('0x34')],[db['sequelize']['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')][_0xd47f('0x20')](_0xd47f('0x35')))),_0xd47f('0x36')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0xd47f('0x37')],[db[_0xd47f('0x1d')]['fn']('COUNT',db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')]['literal'](_0xd47f('0x38')))),_0xd47f('0x39')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')]['literal'](_0xd47f('0x3a')))),_0xd47f('0x3b')],[db['sequelize']['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db['sequelize'][_0xd47f('0x20')](_0xd47f('0x3c')))),_0xd47f('0x3d')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xd47f('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xd47f('0x1d')]['fn']('COUNT',db[_0xd47f('0x1d')]['fn']('IF',db[_0xd47f('0x1d')][_0xd47f('0x20')](_0xd47f('0x3e')))),_0xd47f('0x3d')],[db['sequelize']['fn']('COUNT',db[_0xd47f('0x1d')]['fn']('IF',db['sequelize'][_0xd47f('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xd47f('0x3f')]],'group':['campaign']})[_0xd47f('0xc')](function(_0xaac4f4){logger[_0xd47f('0xd')]('GetVoiceQueueHopperHistory',_0x1d9429);logger[_0xd47f('0x10')](_0xd47f('0x40'),_0x1d9429,JSON[_0xd47f('0x11')](_0xaac4f4));_0x45cc02(_0xaac4f4);})[_0xd47f('0x15')](function(_0x58f343){logger[_0xd47f('0x12')](_0xd47f('0x40'),_0x58f343[_0xd47f('0x14')],_0x1d9429);_0x3aa02f(_0x689672['error'](0x1f4,_0x58f343['message']));});});};exports[_0xd47f('0x41')]=function(_0x420f8e){var _0x5481f4=this;return new Promise(function(_0x46389e,_0x40709b){return db[_0xd47f('0x17')][_0xd47f('0x1c')]({'raw':_0x420f8e['options']?_0x420f8e['options'][_0xd47f('0x1b')]===undefined?!![]:![]:!![],'where':_0x420f8e[_0xd47f('0x1a')]?_0x420f8e[_0xd47f('0x1a')][_0xd47f('0x2a')]||null:null,'attributes':[['campaign',_0xd47f('0x2c')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db['sequelize'][_0xd47f('0x42')]('id')),_0xd47f('0x43')],[db[_0xd47f('0x1d')]['fn'](_0xd47f('0x1e'),db[_0xd47f('0x1d')]['fn']('IF',db['sequelize'][_0xd47f('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xd47f('0xc')](function(_0x2651fe){logger[_0xd47f('0xd')]('GetCampaignHopperHistory',_0x420f8e);logger[_0xd47f('0x10')](_0xd47f('0x41'),_0x420f8e,JSON[_0xd47f('0x11')](_0x2651fe));_0x46389e(_0x2651fe);})[_0xd47f('0x15')](function(_0x318f65){logger['error'](_0xd47f('0x41'),_0x318f65[_0xd47f('0x14')],_0x420f8e);_0x40709b(_0x5481f4[_0xd47f('0x12')](0x1f4,_0x318f65[_0xd47f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 23febf2..f002455 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 _0x30e4=['/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','index','isAuthenticated','describe','show','post','create','put'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x30e4,0x193));var _0x430e=function(_0x473c99,_0x4a3b43){_0x473c99=_0x473c99-0x0;var _0x1e281a=_0x30e4[_0x473c99];return _0x1e281a;};'use strict';var multer=require('multer');var util=require(_0x430e('0x0'));var path=require(_0x430e('0x1'));var timeout=require(_0x430e('0x2'));var express=require(_0x430e('0x3'));var router=express[_0x430e('0x4')]();var fs_extra=require(_0x430e('0x5'));var auth=require(_0x430e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x430e('0x7'));var controller=require(_0x430e('0x8'));router[_0x430e('0x9')]('/',auth['isAuthenticated'](),controller[_0x430e('0xa')]);router[_0x430e('0x9')]('/describe',auth[_0x430e('0xb')](),controller[_0x430e('0xc')]);router[_0x430e('0x9')]('/:id',auth[_0x430e('0xb')](),controller[_0x430e('0xd')]);router[_0x430e('0xe')]('/',auth[_0x430e('0xb')](),controller[_0x430e('0xf')]);router[_0x430e('0x10')](_0x430e('0x11'),auth['isAuthenticated'](),controller[_0x430e('0x12')]);module[_0x430e('0x13')]=router; \ No newline at end of file +var _0xd5cb=['../../config/environment','get','isAuthenticated','describe','show','post','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1257e6,_0x592639){var _0x2cd6b5=function(_0x4a7963){while(--_0x4a7963){_0x1257e6['push'](_0x1257e6['shift']());}};_0x2cd6b5(++_0x592639);}(_0xd5cb,0x68));var _0xbd5c=function(_0x371c7e,_0x577732){_0x371c7e=_0x371c7e-0x0;var _0x169cb9=_0xd5cb[_0x371c7e];return _0x169cb9;};'use strict';var multer=require('multer');var util=require(_0xbd5c('0x0'));var path=require(_0xbd5c('0x1'));var timeout=require(_0xbd5c('0x2'));var express=require(_0xbd5c('0x3'));var router=express[_0xbd5c('0x4')]();var fs_extra=require(_0xbd5c('0x5'));var auth=require(_0xbd5c('0x6'));var interaction=require(_0xbd5c('0x7'));var config=require(_0xbd5c('0x8'));var controller=require('./cmHopperHistory.controller');router[_0xbd5c('0x9')]('/',auth[_0xbd5c('0xa')](),controller['index']);router[_0xbd5c('0x9')]('/describe',auth[_0xbd5c('0xa')](),controller[_0xbd5c('0xb')]);router[_0xbd5c('0x9')]('/:id',auth[_0xbd5c('0xa')](),controller[_0xbd5c('0xc')]);router[_0xbd5c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd5c('0xe')]('/:id',auth[_0xbd5c('0xa')](),controller[_0xbd5c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6a5f99a..e587b9c 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 _0xbfe8=['exports','name','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0xcebd8f,_0x16b439){_0xcebd8f=_0xcebd8f-0x0;var _0x14769a=_0xbfe8[_0xcebd8f];return _0x14769a;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8bfe('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8bfe('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c84=['STRING','name','sequelize','exports'];(function(_0x1b2fe7,_0x3ed769){var _0x383e70=function(_0x35a72b){while(--_0x35a72b){_0x1b2fe7['push'](_0x1b2fe7['shift']());}};_0x383e70(++_0x3ed769);}(_0x6c84,0x112));var _0x46c8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6c84[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x46c8('0x0'));module[_0x46c8('0x1')]={'name':{'type':Sequelize[_0x46c8('0x2')],'unique':_0x46c8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x46c8('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8bdaded..2e53046 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 _0x37e4=['item','from','additionalPhone_','description','cm_contact_has_items','ItemTypeId\x20=\x20?','toString','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','CmCustomField','Sequelize','TEXT','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field'];(function(_0x102001,_0x153c67){var _0x12b3bc=function(_0x5f4b66){while(--_0x5f4b66){_0x102001['push'](_0x102001['shift']());}};_0x12b3bc(++_0x153c67);}(_0x37e4,0x160));var _0x437e=function(_0x215e9b,_0x558396){_0x215e9b=_0x215e9b-0x0;var _0x20f4e7=_0x37e4[_0x215e9b];return _0x20f4e7;};'use strict';var emlformat=require(_0x437e('0x0'));var rimraf=require(_0x437e('0x1'));var zipdir=require(_0x437e('0x2'));var jsonpatch=require(_0x437e('0x3'));var rp=require(_0x437e('0x4'));var moment=require(_0x437e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x437e('0x6'));var util=require(_0x437e('0x7'));var path=require(_0x437e('0x8'));var sox=require(_0x437e('0x9'));var csv=require(_0x437e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x437e('0xb'));var _=require('lodash');var squel=require(_0x437e('0xc'));var crypto=require(_0x437e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x437e('0xe'));var toCsv=require(_0x437e('0xa'));var querystring=require('querystring');var Papa=require(_0x437e('0xf'));var Redis=require('ioredis');var authService=require(_0x437e('0x10'));var qs=require(_0x437e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x437e('0x12'));var logger=require(_0x437e('0x13'))(_0x437e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x437e('0x15'));var db=require(_0x437e('0x16'))['db'];var csv_results;config['redis']=_[_0x437e('0x17')](config[_0x437e('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x437e('0x18')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x21051a,_0x200a43){_0x200a43=_0x200a43||0xcc;return function(_0x358dc9){if(_0x358dc9){return _0x21051a[_0x437e('0x19')](_0x200a43);}return _0x21051a[_0x437e('0x1a')](_0x200a43)[_0x437e('0x1b')]();};}function respondWithResult(_0x1401cc,_0x6ae64c){_0x6ae64c=_0x6ae64c||0xc8;return function(_0x5da0e1){if(_0x5da0e1){return _0x1401cc[_0x437e('0x1a')](_0x6ae64c)[_0x437e('0x1c')](_0x5da0e1);}};}function respondWithFilteredResult(_0x1c8dfe,_0xf3f2da){return function(_0x285d73){if(_0x285d73){var _0x126441=typeof _0xf3f2da[_0x437e('0x1d')]==='undefined'&&typeof _0xf3f2da[_0x437e('0x1e')]===_0x437e('0x1f');var _0x4e608c=_0x285d73[_0x437e('0x20')];var _0x9f2fc5=_0x126441?0x0:_0xf3f2da[_0x437e('0x1d')];var _0x467068=_0x126441?_0x285d73[_0x437e('0x20')]:_0xf3f2da[_0x437e('0x1d')]+_0xf3f2da['limit'];var _0x17d81b;if(_0x467068>=_0x4e608c){_0x467068=_0x4e608c;_0x17d81b=0xc8;}else{_0x17d81b=0xce;}_0x1c8dfe[_0x437e('0x1a')](_0x17d81b);return _0x1c8dfe['set'](_0x437e('0x21'),_0x9f2fc5+'-'+_0x467068+'/'+_0x4e608c)[_0x437e('0x1c')](_0x285d73);}return null;};}function patchUpdates(_0x3b1e58){return function(_0x2e12c8){try{jsonpatch[_0x437e('0x22')](_0x2e12c8,_0x3b1e58,!![]);}catch(_0x4e7710){return BPromise['reject'](_0x4e7710);}return _0x2e12c8[_0x437e('0x23')]();};}function saveUpdates(_0xb0d9d4,_0x393a4a){return function(_0x13009d){if(_0x13009d){return _0x13009d[_0x437e('0x24')](_0xb0d9d4)[_0x437e('0x25')](function(_0x48810e){return _0x48810e;});}return null;};}function removeEntity(_0x43aa8b,_0x184f97){return function(_0x503e22){if(_0x503e22){return _0x503e22['destroy']()['then'](function(){var _0x468d06=_0x503e22['get']({'plain':!![]});var _0x3487d5='Lists';return db['UserProfileResource'][_0x437e('0x26')]({'where':{'type':_0x3487d5,'resourceId':_0x468d06['id']}})['then'](function(){return _0x503e22;});})[_0x437e('0x25')](function(){_0x43aa8b[_0x437e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14cd59,_0x2feff3){return function(_0x39bf58){if(!_0x39bf58){_0x14cd59[_0x437e('0x19')](0x194);}return _0x39bf58;};}function handleError(_0x2c9436,_0xbf1df){_0xbf1df=_0xbf1df||0x1f4;return function(_0x3c8c57){logger[_0x437e('0x27')](_0x3c8c57[_0x437e('0x28')]);if(_0x3c8c57[_0x437e('0x29')]){delete _0x3c8c57[_0x437e('0x29')];}_0x2c9436['status'](_0xbf1df)[_0x437e('0x2a')](_0x3c8c57);};}exports[_0x437e('0x2b')]=function(_0x1499e7,_0xb452ba){var _0x1dfe5f={},_0x6a41b0={},_0x297b13={'count':0x0,'rows':[]};var _0x5c66ca=_[_0x437e('0x2c')](db[_0x437e('0x2d')][_0x437e('0x2e')],function(_0xbb0528){return{'name':_0xbb0528[_0x437e('0x2f')],'type':_0xbb0528[_0x437e('0x30')][_0x437e('0x31')]};});_0x6a41b0[_0x437e('0x32')]=_['map'](_0x5c66ca,_0x437e('0x29'));_0x6a41b0[_0x437e('0x33')]=_['keys'](_0x1499e7[_0x437e('0x33')]);_0x6a41b0[_0x437e('0x34')]=_[_0x437e('0x35')](_0x6a41b0[_0x437e('0x32')],_0x6a41b0['query']);_0x1dfe5f[_0x437e('0x36')]=_[_0x437e('0x35')](_0x6a41b0[_0x437e('0x32')],qs['fields'](_0x1499e7[_0x437e('0x33')][_0x437e('0x37')]));_0x1dfe5f['attributes']=_0x1dfe5f[_0x437e('0x36')][_0x437e('0x38')]?_0x1dfe5f['attributes']:_0x6a41b0[_0x437e('0x32')];if(!_0x1499e7['query'][_0x437e('0x39')](_0x437e('0x3a'))){_0x1dfe5f[_0x437e('0x1e')]=qs[_0x437e('0x1e')](_0x1499e7[_0x437e('0x33')][_0x437e('0x1e')]);_0x1dfe5f[_0x437e('0x1d')]=qs[_0x437e('0x1d')](_0x1499e7[_0x437e('0x33')][_0x437e('0x1d')]);}_0x1dfe5f[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0x1499e7[_0x437e('0x33')]['sort']);_0x1dfe5f[_0x437e('0x3d')]=qs['filters'](_[_0x437e('0x3e')](_0x1499e7[_0x437e('0x33')],_0x6a41b0[_0x437e('0x34')]),_0x5c66ca);if(_0x1499e7['query'][_0x437e('0x3f')]){_0x1dfe5f['where']=_[_0x437e('0x40')](_0x1dfe5f[_0x437e('0x3d')],{'$or':_[_0x437e('0x2c')](_0x5c66ca,function(_0x414a03){if(_0x414a03[_0x437e('0x30')]!==_0x437e('0x41')){var _0x5ac779={};_0x5ac779[_0x414a03[_0x437e('0x29')]]={'$like':'%'+_0x1499e7[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x5ac779;}})});}_0x1dfe5f=_[_0x437e('0x40')]({},_0x1dfe5f,_0x1499e7[_0x437e('0x42')]);var _0x49b627={'where':_0x1dfe5f[_0x437e('0x3d')]};return db['CmList'][_0x437e('0x20')](_0x49b627)[_0x437e('0x25')](function(_0xbe9aae){_0x297b13[_0x437e('0x20')]=_0xbe9aae;if(_0x1499e7['query'][_0x437e('0x43')]){_0x1dfe5f[_0x437e('0x44')]=[{'all':!![]}];}return db[_0x437e('0x2d')][_0x437e('0x45')](_0x1dfe5f);})[_0x437e('0x25')](function(_0x716e7f){_0x297b13[_0x437e('0x46')]=_0x716e7f;return _0x297b13;})[_0x437e('0x25')](respondWithFilteredResult(_0xb452ba,_0x1dfe5f))[_0x437e('0x47')](handleError(_0xb452ba,null));};exports[_0x437e('0x48')]=function(_0x9c4562,_0x3bd0c6){var _0x3d2bda={'raw':![],'where':{'id':_0x9c4562[_0x437e('0x49')]['id']}},_0x467e8b={};_0x467e8b[_0x437e('0x32')]=_[_0x437e('0x4a')](db['CmList'][_0x437e('0x2e')]);_0x467e8b[_0x437e('0x33')]=_[_0x437e('0x4a')](_0x9c4562[_0x437e('0x33')]);_0x467e8b[_0x437e('0x34')]=_[_0x437e('0x35')](_0x467e8b[_0x437e('0x32')],_0x467e8b['query']);_0x3d2bda[_0x437e('0x36')]=_[_0x437e('0x35')](_0x467e8b[_0x437e('0x32')],qs[_0x437e('0x37')](_0x9c4562['query'][_0x437e('0x37')]));_0x3d2bda[_0x437e('0x36')]=_0x3d2bda[_0x437e('0x36')][_0x437e('0x38')]?_0x3d2bda['attributes']:_0x467e8b['model'];if(_0x9c4562[_0x437e('0x33')][_0x437e('0x43')]){_0x3d2bda[_0x437e('0x44')]=[{'all':!![]}];}_0x3d2bda=_['merge']({},_0x3d2bda,_0x9c4562[_0x437e('0x42')]);return db[_0x437e('0x2d')][_0x437e('0x4b')](_0x3d2bda)[_0x437e('0x25')](handleEntityNotFound(_0x3bd0c6,null))[_0x437e('0x25')](respondWithResult(_0x3bd0c6,null))[_0x437e('0x47')](handleError(_0x3bd0c6,null));};exports['create']=function(_0x11142b,_0x4314c4){return db[_0x437e('0x2d')]['create'](_0x11142b['body'],{})['then'](function(_0x562a4f){var _0x5d51bf=_0x11142b[_0x437e('0x4c')][_0x437e('0x4d')]({'plain':!![]});if(!_0x5d51bf)throw new Error(_0x437e('0x4e'));if(_0x5d51bf[_0x437e('0x4f')]===_0x437e('0x4c')){var _0xc066b4=_0x562a4f[_0x437e('0x4d')]({'plain':!![]});var _0x5b738e=_0x437e('0x50');return db[_0x437e('0x51')]['find']({'where':{'name':_0x5b738e,'userProfileId':_0x5d51bf['userProfileId']},'raw':!![]})[_0x437e('0x25')](function(_0x1d11c4){if(_0x1d11c4&&_0x1d11c4['autoAssociation']===0x0){return db['UserProfileResource'][_0x437e('0x52')]({'name':_0xc066b4['name'],'resourceId':_0xc066b4['id'],'type':_0x1d11c4[_0x437e('0x29')],'sectionId':_0x1d11c4['id']},{})[_0x437e('0x25')](function(){return _0x562a4f;});}else{return _0x562a4f;}})[_0x437e('0x47')](function(_0x546122){logger[_0x437e('0x27')](_0x437e('0x53'),_0x546122);throw _0x546122;});}return _0x562a4f;})['then'](respondWithResult(_0x4314c4,0xc9))[_0x437e('0x47')](handleError(_0x4314c4,null));};exports[_0x437e('0x24')]=function(_0x49ef09,_0x30463e){if(_0x49ef09['body']['id']){delete _0x49ef09[_0x437e('0x54')]['id'];}return db['CmList'][_0x437e('0x4b')]({'where':{'id':_0x49ef09['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x30463e,null))[_0x437e('0x25')](saveUpdates(_0x49ef09[_0x437e('0x54')],null))[_0x437e('0x25')](respondWithResult(_0x30463e,null))[_0x437e('0x47')](handleError(_0x30463e,null));};exports[_0x437e('0x26')]=function(_0x4664f6,_0x42a4d){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x4664f6[_0x437e('0x49')]['id']}})['then'](handleEntityNotFound(_0x42a4d,null))['then'](removeEntity(_0x42a4d,null))[_0x437e('0x47')](handleError(_0x42a4d,null));};exports[_0x437e('0x55')]=function(_0x4709c8,_0x9519aa){return db[_0x437e('0x2d')][_0x437e('0x55')]()['then'](respondWithResult(_0x9519aa,null))[_0x437e('0x47')](handleError(_0x9519aa,null));};exports['addDisposition']=function(_0x18ef55,_0x4a5672,_0x1b7f11){if(_0x18ef55['body']['id']){delete _0x18ef55[_0x437e('0x54')]['id'];}return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x18ef55['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x4a5672,null))[_0x437e('0x25')](function(_0x568640){if(_0x568640){_0x18ef55[_0x437e('0x54')][_0x437e('0x56')]=_0x568640['id'];return db[_0x437e('0x57')]['create'](_0x18ef55[_0x437e('0x54')]);}})[_0x437e('0x25')](respondWithResult(_0x4a5672,null))['catch'](handleError(_0x4a5672,null));};exports[_0x437e('0x58')]=function(_0xb5a5f7,_0x459f0f,_0xe7b76f){var _0x3d9311={'raw':![],'where':{}};var _0x3d38ef={};var _0x12f0f5={'count':0x0,'rows':[]};return db[_0x437e('0x2d')][_0x437e('0x59')]({'where':{'id':_0xb5a5f7[_0x437e('0x49')]['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x459f0f,null))['then'](function(_0x4e935e){if(_0x4e935e){_0x3d38ef[_0x437e('0x32')]=_[_0x437e('0x4a')](db['Disposition'][_0x437e('0x2e')]);_0x3d38ef[_0x437e('0x33')]=_['keys'](_0xb5a5f7['query']);_0x3d38ef['filters']=_[_0x437e('0x35')](_0x3d38ef['model'],_0x3d38ef[_0x437e('0x33')]);_0x3d9311[_0x437e('0x36')]=_[_0x437e('0x35')](_0x3d38ef[_0x437e('0x32')],qs[_0x437e('0x37')](_0xb5a5f7[_0x437e('0x33')]['fields']));_0x3d9311[_0x437e('0x36')]=_0x3d9311['attributes'][_0x437e('0x38')]?_0x3d9311[_0x437e('0x36')]:_0x3d38ef[_0x437e('0x32')];if(!_0xb5a5f7[_0x437e('0x33')][_0x437e('0x39')](_0x437e('0x3a'))){_0x3d9311[_0x437e('0x1e')]=qs['limit'](_0xb5a5f7['query'][_0x437e('0x1e')]);_0x3d9311[_0x437e('0x1d')]=qs[_0x437e('0x1d')](_0xb5a5f7[_0x437e('0x33')]['offset']);}_0x3d9311[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0xb5a5f7['query'][_0x437e('0x3c')]);_0x3d9311[_0x437e('0x3d')]=qs[_0x437e('0x34')](_[_0x437e('0x3e')](_0xb5a5f7[_0x437e('0x33')],_0x3d38ef['filters']));_0x3d9311['where']['ListId']=_0x4e935e['id'];if(_0xb5a5f7['query']['filter']){_0x3d9311[_0x437e('0x3d')]=_[_0x437e('0x40')](_0x3d9311[_0x437e('0x3d')],{'$or':_[_0x437e('0x2c')](_0x3d9311[_0x437e('0x36')],function(_0xaf4596){var _0x47de93={};_0x47de93[_0xaf4596]={'$like':'%'+_0xb5a5f7[_0x437e('0x33')]['filter']+'%'};return _0x47de93;})});}_0x3d9311=_[_0x437e('0x40')]({},_0x3d9311,_0xb5a5f7[_0x437e('0x42')]);return db[_0x437e('0x57')][_0x437e('0x20')]({'where':_0x3d9311[_0x437e('0x3d')]})[_0x437e('0x25')](function(_0x1ca7ff){_0x12f0f5[_0x437e('0x20')]=_0x1ca7ff;if(_0xb5a5f7[_0x437e('0x33')][_0x437e('0x43')]){_0x3d9311[_0x437e('0x44')]=[{'all':!![]}];}return db[_0x437e('0x57')][_0x437e('0x45')](_0x3d9311);})['then'](function(_0x3455c9){_0x12f0f5[_0x437e('0x46')]=_0x3455c9;return _0x12f0f5;});}})['then'](respondWithFilteredResult(_0x459f0f,_0x3d9311))[_0x437e('0x47')](handleError(_0x459f0f,null));};exports['removeDispositions']=function(_0x4b9cc3,_0x580870,_0x1281d7){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x4b9cc3['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x580870,null))[_0x437e('0x25')](function(_0x58d0f){if(_0x58d0f){return _0x58d0f[_0x437e('0x5a')](_0x4b9cc3['query'][_0x437e('0x5b')]);}})[_0x437e('0x25')](respondWithStatusCode(_0x580870,null))['catch'](handleError(_0x580870,null));};exports[_0x437e('0x5c')]=function(_0x510a0b,_0x184014,_0x22b6c7){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x510a0b[_0x437e('0x49')]['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x184014,null))[_0x437e('0x25')](function(_0x473af0){if(_0x473af0){var _0x3868a1=[];var _0x60afc4={'success':[],'errors':[]};return db[_0x437e('0x5d')]['describe']()[_0x437e('0x25')](function(_0x4e59a1){if(_0x510a0b[_0x437e('0x54')][_0x437e('0x5e')]&&_[_0x437e('0x5f')](_0x510a0b[_0x437e('0x54')]['tags'])){if(_0x510a0b[_0x437e('0x54')][_0x437e('0x5e')]['length']){_0x510a0b[_0x437e('0x54')]['tags']=_0x510a0b[_0x437e('0x54')][_0x437e('0x5e')][_0x437e('0x60')](';')+';';}else{_0x510a0b[_0x437e('0x54')]['tags']=null;}}else{_0x510a0b['body'][_0x437e('0x5e')]=null;}if(_0x510a0b[_0x437e('0x54')]&&_[_0x437e('0x5f')](_0x510a0b[_0x437e('0x54')])){for(var _0x40d2e0=0x0;_0x40d2e0<_0x510a0b[_0x437e('0x54')]['length'];_0x40d2e0+=0x1){_0x510a0b[_0x437e('0x54')][_0x40d2e0][_0x437e('0x56')]=_0x510a0b[_0x437e('0x49')]['id'];_0x3868a1['push'](_0x510a0b[_0x437e('0x54')][_0x40d2e0]);}return BPromise[_0x437e('0x61')](_0x3868a1,function(_0x541637){return db[_0x437e('0x5d')]['create'](_[_0x437e('0x62')](_0x541637,[_0x437e('0x5b'),'id'])||{},{'fields':_[_0x437e('0x4a')](_0x4e59a1),'raw':!![]})[_0x437e('0x25')](function(_0x11a0c9){_0x60afc4[_0x437e('0x63')]['push'](_0x11a0c9[_0x437e('0x64')]);})[_0x437e('0x47')](function(_0x81b228){_0x60afc4[_0x437e('0x65')][_0x437e('0x66')]({'data':_0x541637,'error':_0x81b228[_0x437e('0x67')]});});})['then'](function(_0x4096f3){return _0x60afc4;})[_0x437e('0x47')](function(_0x1f33cb){return _0x1f33cb;});}else{_0x184014['status'](0x190)['json']({'message':_0x437e('0x68')});}});}})[_0x437e('0x25')](respondWithResult(_0x184014,null))['catch'](handleError(_0x184014,null));};exports[_0x437e('0x69')]=function(_0x38ef20,_0x589ad8,_0x356446){var _0x4a939f;return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x38ef20['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x437e('0x6a')}]})[_0x437e('0x25')](handleEntityNotFound(_0x589ad8,null))[_0x437e('0x25')](function(_0xee6d7){if(_0xee6d7){_0x4a939f=_0xee6d7;return db[_0x437e('0x5d')]['rawAttributes'];}})['then'](function(_0x520293){if(_0x520293){var _0x1255c9={};var _0x1c5024={};_0x1c5024['model']=_[_0x437e('0x6b')](_['keys'](_0x520293),_[_0x437e('0x2c')](_0x4a939f[_0x437e('0x6a')],function(_0x6faf6){return util[_0x437e('0x6c')](_0x437e('0x6d'),_0x6faf6['id']);}));_0x1c5024[_0x437e('0x33')]=_[_0x437e('0x4a')](_0x38ef20[_0x437e('0x33')]);_0x1c5024[_0x437e('0x34')]=_[_0x437e('0x35')](_0x1c5024[_0x437e('0x32')],_0x1c5024['query']);_0x1255c9[_0x437e('0x36')]=_[_0x437e('0x35')](_0x1c5024[_0x437e('0x32')],qs['fields'](_0x38ef20[_0x437e('0x33')][_0x437e('0x37')]));_0x1255c9['attributes']=_0x1255c9[_0x437e('0x36')]['length']?_0x1255c9[_0x437e('0x36')]:_0x1c5024[_0x437e('0x32')];if(!_0x38ef20[_0x437e('0x33')]['hasOwnProperty'](_0x437e('0x3a'))){_0x1255c9[_0x437e('0x1e')]=qs[_0x437e('0x1e')](_0x38ef20[_0x437e('0x33')][_0x437e('0x1e')]);_0x1255c9['offset']=qs[_0x437e('0x1d')](_0x38ef20['query']['offset']);}_0x1255c9[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0x38ef20[_0x437e('0x33')][_0x437e('0x3c')]);_0x1255c9[_0x437e('0x3d')]=qs['filters'](_[_0x437e('0x3e')](_0x38ef20[_0x437e('0x33')],_0x1c5024['filters']));_0x1255c9[_0x437e('0x6e')]=!![];if(_0x38ef20[_0x437e('0x33')][_0x437e('0x3f')]){_0x1255c9['where']=_[_0x437e('0x40')](_0x1255c9[_0x437e('0x3d')],{'$or':_['map'](_0x1255c9[_0x437e('0x36')],function(_0x635405){var _0x43f640={};_0x43f640[_0x635405]={'$like':'%'+_0x38ef20[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x43f640;})});}_0x1255c9=_[_0x437e('0x40')]({},_0x1255c9,_0x38ef20['options']);return _0x4a939f['getContacts'](_0x1255c9);}})[_0x437e('0x25')](respondWithResult(_0x589ad8,null))[_0x437e('0x47')](handleError(_0x589ad8,null));};exports[_0x437e('0x6f')]=function(_0x185ad4,_0x8ac378,_0x33b85b){var _0x43df2a;var _0x28caf3;var _0x2613a9;var _0x2aa66f=_0x185ad4['params']['id'];csv_results=[];return db[_0x437e('0x70')][_0x437e('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0x437e('0x71')]})[_0x437e('0x25')](function(_0x350cb8){_0x43df2a=_0x350cb8;var _0x15cf5=_[_0x437e('0x4a')](db[_0x437e('0x5d')][_0x437e('0x2e')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x437e('0x72')]})[_0x437e('0x25')](function(_0x5c2b14){_0x28caf3=_0x5c2b14;var _0x1c9d86=squel[_0x437e('0x73')]()[_0x437e('0x37')](_0x15cf5)['from'](_0x437e('0x74'),'c')[_0x437e('0x3d')]('c.ListId\x20=\x20?',_0x2aa66f)[_0x437e('0x3d')](_0x437e('0x75'))[_0x437e('0x76')]();for(var _0xde7ddb=0x0;_0xde7ddb<_0x28caf3['length'];_0xde7ddb++){_0x1c9d86['field'](_0x437e('0x77')+_0x28caf3[_0xde7ddb]['id'],_0x437e('0x78')+_0x28caf3[_0xde7ddb][_0x437e('0x72')]);}for(var _0xde7ddb=0x0;_0xde7ddb<_0x43df2a[_0x437e('0x38')];_0xde7ddb++){_0x1c9d86['field'](squel[_0x437e('0x73')]()[_0x437e('0x79')](_0x437e('0x7a'))[_0x437e('0x7b')]('cm_contact_has_items')[_0x437e('0x3d')]('ItemTypeId\x20=\x20?',_0x43df2a[_0xde7ddb]['id'])['where']('CmContactId\x20=\x20c.id'),_0x437e('0x7c')+_0x43df2a[_0xde7ddb][_0x437e('0x29')]);_0x1c9d86[_0x437e('0x79')](squel['select']()[_0x437e('0x79')](_0x437e('0x7d'))[_0x437e('0x7b')](_0x437e('0x7e'))[_0x437e('0x3d')](_0x437e('0x7f'),_0x43df2a[_0xde7ddb]['id'])[_0x437e('0x3d')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x43df2a[_0xde7ddb]['name']);}var _0x1cfbff=[];_0x1cfbff[_0x437e('0x66')](_0x1c9d86[_0x437e('0x80')]());BPromise[_0x437e('0x61')](_0x1cfbff,handleQuery)['then'](function(_0x53078b){handleQuery(_0x1c9d86[_0x437e('0x80')]());var _0x485822=csv_results[0x0];if(!_[_0x437e('0x81')](_0x485822)){var _0x4e128c=toCsv(_0x485822);var _0x13a5b0=Date['now']();fs['writeFileSync'](util['format'](_0x437e('0x82'),_0x2aa66f,_0x13a5b0),_0x4e128c);_0x8ac378[_0x437e('0x83')](_0x437e('0x84'),_0x437e('0x85')+util[_0x437e('0x6c')](_0x437e('0x86'),_0x2aa66f,_0x13a5b0));_0x8ac378[_0x437e('0x83')](_0x437e('0x87'),_0x437e('0x88'));return _0x8ac378['download'](util['format']('/tmp/list_%d_%s.csv',_0x2aa66f,_0x13a5b0));}else{return _0x8ac378[_0x437e('0x19')](0xcc);}});});});};exports[_0x437e('0x89')]=function(_0x12844b,_0x38f8a4,_0x64b4f5){var _0x3fbad4;delete _0x12844b['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x12844b[_0x437e('0x49')]['id']}})['then'](handleEntityNotFound(_0x38f8a4,null))['then'](function(_0x439baa){if(_0x439baa){return db[_0x437e('0x8a')][_0x437e('0x8b')](function(_0x3fa467){return db[_0x437e('0x8c')][_0x437e('0x52')](_0x12844b[_0x437e('0x54')],{'transaction':_0x3fa467})['then'](function(_0x13b4fc){_0x3fbad4=_0x13b4fc;return _0x439baa['addCustomFields'](_0x13b4fc,{'transaction':_0x3fa467});})[_0x437e('0x25')](function(){var _0x5c371a={'type':db[_0x437e('0x8d')][_0x437e('0x8e')],'transaction':_0x3fa467};switch(_0x12844b[_0x437e('0x54')][_0x437e('0x30')]){case'text':_0x5c371a[_0x437e('0x30')]=db[_0x437e('0x8d')][_0x437e('0x8e')];break;case'number':_0x5c371a[_0x437e('0x30')]=db[_0x437e('0x8d')]['INTEGER'];break;case _0x437e('0x8f'):_0x5c371a[_0x437e('0x30')]=db['Sequelize'][_0x437e('0x90')];_0x5c371a[_0x437e('0x91')]=![];break;default:}return db[_0x437e('0x8a')][_0x437e('0x92')][_0x437e('0x93')](_0x437e('0x74'),util['format'](_0x437e('0x94'),_0x3fbad4['id']),_0x5c371a);})['then'](function(){return _0x3fbad4;});});}})[_0x437e('0x25')](respondWithResult(_0x38f8a4,null))[_0x437e('0x47')](handleError(_0x38f8a4,null));};exports['getCustomFields']=function(_0xd22916,_0x7ad062,_0x1e1412){var _0xe85fad={};var _0x5dd69a={};var _0x516bac;var _0x474bf1;return db['CmList'][_0x437e('0x59')]({'where':{'id':_0xd22916['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x7ad062,null))[_0x437e('0x25')](function(_0x3a104d){if(_0x3a104d){_0x516bac=_0x3a104d;_0x5dd69a[_0x437e('0x32')]=_[_0x437e('0x4a')](db['CmCustomField'][_0x437e('0x2e')]);_0x5dd69a['query']=_['keys'](_0xd22916['query']);_0x5dd69a['filters']=_[_0x437e('0x35')](_0x5dd69a[_0x437e('0x32')],_0x5dd69a[_0x437e('0x33')]);_0xe85fad[_0x437e('0x36')]=_[_0x437e('0x35')](_0x5dd69a['model'],qs['fields'](_0xd22916[_0x437e('0x33')][_0x437e('0x37')]));_0xe85fad[_0x437e('0x36')]=_0xe85fad[_0x437e('0x36')]['length']?_0xe85fad[_0x437e('0x36')]:_0x5dd69a[_0x437e('0x32')];_0xe85fad['order']=qs['sort'](_0xd22916[_0x437e('0x33')][_0x437e('0x3c')]);_0xe85fad['where']=qs[_0x437e('0x34')](_[_0x437e('0x3e')](_0xd22916[_0x437e('0x33')],_0x5dd69a[_0x437e('0x34')]));_0xe85fad[_0x437e('0x3d')]=_[_0x437e('0x40')](_0xe85fad[_0x437e('0x3d')],{'$or':[{'ListId':_0x3a104d['id']},{'ListId':null}]});if(_0xd22916[_0x437e('0x33')][_0x437e('0x3f')]){_0xe85fad[_0x437e('0x3d')]=_['merge'](_0xe85fad['where'],{'$or':_[_0x437e('0x2c')](_0xe85fad[_0x437e('0x36')],function(_0x3be94e){var _0x106050={};_0x106050[_0x3be94e]={'$like':'%'+_0xd22916[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x106050;})});}_0xe85fad=_[_0x437e('0x40')]({},_0xe85fad,_0xd22916[_0x437e('0x42')]);return db['CmCustomField'][_0x437e('0x95')](_0xe85fad);}})[_0x437e('0x25')](respondWithResult(_0x7ad062,null))[_0x437e('0x47')](handleError(_0x7ad062,null));};exports[_0x437e('0x96')]=function(_0x39eedd,_0x45583c){return db[_0x437e('0x8c')]['findAndCountAll']({'where':{'ListId':null}})[_0x437e('0x25')](handleEntityNotFound(_0x45583c,null))[_0x437e('0x25')](function(_0x39bfb4){return _0x39bfb4;})['then'](respondWithResult(_0x45583c,null))[_0x437e('0x47')](handleError(_0x45583c,null));};exports['addAgents']=function(_0x4c6094,_0x106184,_0x2b411f){return db[_0x437e('0x2d')]['find']({'where':{'id':_0x4c6094['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x106184,null))[_0x437e('0x25')](function(_0xce2695){if(_0xce2695){return _0xce2695[_0x437e('0x97')](_0x4c6094[_0x437e('0x54')][_0x437e('0x5b')],_[_0x437e('0x62')](_0x4c6094[_0x437e('0x54')],[_0x437e('0x5b'),'id'])||{})[_0x437e('0x98')](function(_0x2e5099){for(var _0x56edd2=0x0;_0x56edd2<_0x4c6094[_0x437e('0x54')]['ids']['length'];_0x56edd2+=0x1){socket[_0x437e('0x99')]('userCmList:save',{'UserId':Number(_0x4c6094['body'][_0x437e('0x5b')][_0x56edd2]),'CmListId':Number(_0x4c6094[_0x437e('0x49')]['id'])});}return _0x2e5099;});}})[_0x437e('0x25')](respondWithResult(_0x106184,null))[_0x437e('0x47')](handleError(_0x106184,null));};exports[_0x437e('0x9a')]=function(_0x17e3fd,_0x176fba,_0x4b66a1){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x17e3fd['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x176fba,null))[_0x437e('0x25')](function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7[_0x437e('0x9a')](_0x17e3fd[_0x437e('0x33')][_0x437e('0x5b')])['then'](function(){if(_[_0x437e('0x5f')](_0x17e3fd[_0x437e('0x33')]['ids'])){for(var _0x238a57=0x0;_0x238a57<_0x17e3fd['query'][_0x437e('0x5b')][_0x437e('0x38')];_0x238a57+=0x1){socket[_0x437e('0x99')](_0x437e('0x9b'),{'UserId':Number(_0x17e3fd['query'][_0x437e('0x5b')][_0x238a57]),'CmListId':Number(_0x17e3fd[_0x437e('0x49')]['id'])});}}else{socket[_0x437e('0x99')](_0x437e('0x9b'),{'UserId':Number(_0x17e3fd[_0x437e('0x33')][_0x437e('0x5b')]),'CmListId':Number(_0x17e3fd[_0x437e('0x49')]['id'])});}});}})[_0x437e('0x25')](respondWithStatusCode(_0x176fba,null))[_0x437e('0x47')](handleError(_0x176fba,null));};exports[_0x437e('0x9c')]=function(_0x5f1816,_0x42d3b8,_0x185c0d){var _0x556b94={};var _0x392dc2={};var _0x3e73c4;var _0x2e971b;return db[_0x437e('0x2d')][_0x437e('0x59')]({'where':{'id':_0x5f1816[_0x437e('0x49')]['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x42d3b8,null))[_0x437e('0x25')](function(_0x1110e3){if(_0x1110e3){_0x3e73c4=_0x1110e3;_0x392dc2[_0x437e('0x32')]=_[_0x437e('0x4a')](db[_0x437e('0x9d')][_0x437e('0x2e')]);_0x392dc2[_0x437e('0x33')]=_[_0x437e('0x4a')](_0x5f1816[_0x437e('0x33')]);_0x392dc2[_0x437e('0x34')]=_[_0x437e('0x35')](_0x392dc2['model'],_0x392dc2['query']);_0x556b94[_0x437e('0x36')]=_[_0x437e('0x35')](_0x392dc2[_0x437e('0x32')],qs[_0x437e('0x37')](_0x5f1816[_0x437e('0x33')][_0x437e('0x37')]));_0x556b94[_0x437e('0x36')]=_0x556b94[_0x437e('0x36')][_0x437e('0x38')]?_0x556b94[_0x437e('0x36')]:_0x392dc2[_0x437e('0x32')];_0x556b94[_0x437e('0x3b')]=qs['sort'](_0x5f1816[_0x437e('0x33')]['sort']);_0x556b94[_0x437e('0x3d')]=qs[_0x437e('0x34')](_['pick'](_0x5f1816[_0x437e('0x33')],_0x392dc2['filters']));if(_0x5f1816[_0x437e('0x33')][_0x437e('0x3f')]){_0x556b94[_0x437e('0x3d')]=_[_0x437e('0x40')](_0x556b94['where'],{'$or':_[_0x437e('0x2c')](_0x556b94[_0x437e('0x36')],function(_0x68098c){var _0x217123={};_0x217123[_0x68098c]={'$like':'%'+_0x5f1816[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x217123;})});}_0x556b94=_['merge']({},_0x556b94,_0x5f1816[_0x437e('0x42')]);return _0x3e73c4[_0x437e('0x9c')](_0x556b94);}})[_0x437e('0x25')](function(_0x104f79){if(_0x104f79){_0x2e971b=_0x104f79[_0x437e('0x38')];if(!_0x5f1816[_0x437e('0x33')][_0x437e('0x39')](_0x437e('0x3a'))){_0x556b94[_0x437e('0x1e')]=qs[_0x437e('0x1e')](_0x5f1816[_0x437e('0x33')]['limit']);_0x556b94[_0x437e('0x1d')]=qs['offset'](_0x5f1816[_0x437e('0x33')][_0x437e('0x1d')]);}return _0x3e73c4[_0x437e('0x9c')](_0x556b94);}})[_0x437e('0x25')](function(_0x2024ec){if(_0x2024ec){return _0x2024ec?{'count':_0x2e971b,'rows':_0x2024ec}:null;}})[_0x437e('0x25')](respondWithResult(_0x42d3b8,null))[_0x437e('0x47')](handleError(_0x42d3b8,null));};function handleQuery(_0x401bff){logger['info'](_0x401bff);return db[_0x437e('0x8a')][_0x437e('0x33')](_0x401bff)[_0x437e('0x98')](function(_0x1c3ac1){csv_results[_0x437e('0x66')](_0x1c3ac1);})['catch'](function(_0x164193){logger[_0x437e('0x27')](_0x164193[_0x437e('0x67')]);});} \ No newline at end of file +var _0xc69a=['Lists','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addContacts','tags','isArray','join','each','CmContact','success','dataValues','errors','push','message','getContacts','CmCustomField','concat','CustomFields','format','raw','getContactsCsv','ContactItemType','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','alias','field','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','emit','removeAgents','userCmList:remove','getAgents','info','spread','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','get','UserProfileResource','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','CmList','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','role','user'];(function(_0x108904,_0x579e8a){var _0x5b0344=function(_0x2b3a33){while(--_0x2b3a33){_0x108904['push'](_0x108904['shift']());}};_0x5b0344(++_0x579e8a);}(_0xc69a,0x196));var _0xac69=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc69a[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xac69('0x0'));var rimraf=require(_0xac69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac69('0x2'));var rp=require(_0xac69('0x3'));var moment=require(_0xac69('0x4'));var BPromise=require(_0xac69('0x5'));var Mustache=require(_0xac69('0x6'));var util=require(_0xac69('0x7'));var path=require(_0xac69('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xac69('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xac69('0xa'));var jsforce=require(_0xac69('0xb'));var deskjs=require(_0xac69('0xc'));var toCsv=require('to-csv');var querystring=require(_0xac69('0xd'));var Papa=require(_0xac69('0xe'));var Redis=require(_0xac69('0xf'));var authService=require(_0xac69('0x10'));var qs=require(_0xac69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac69('0x12'));var logger=require('../../config/logger')(_0xac69('0x13'));var utils=require(_0xac69('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac69('0x15'));var db=require(_0xac69('0x16'))['db'];var csv_results;config[_0xac69('0x17')]=_[_0xac69('0x18')](config[_0xac69('0x17')],{'host':_0xac69('0x19'),'port':0x18eb});var socket=require(_0xac69('0x1a'))(new Redis(config['redis']));require(_0xac69('0x1b'))[_0xac69('0x1c')](socket);function respondWithStatusCode(_0x3404f1,_0x53f3f4){_0x53f3f4=_0x53f3f4||0xcc;return function(_0x4b02fd){if(_0x4b02fd){return _0x3404f1[_0xac69('0x1d')](_0x53f3f4);}return _0x3404f1[_0xac69('0x1e')](_0x53f3f4)[_0xac69('0x1f')]();};}function respondWithResult(_0x3873a2,_0x4b60fc){_0x4b60fc=_0x4b60fc||0xc8;return function(_0x1a2997){if(_0x1a2997){return _0x3873a2[_0xac69('0x1e')](_0x4b60fc)['json'](_0x1a2997);}};}function respondWithFilteredResult(_0x98a916,_0x52d7dd){return function(_0x13be59){if(_0x13be59){var _0x5b5ded=typeof _0x52d7dd[_0xac69('0x20')]==='undefined'&&typeof _0x52d7dd[_0xac69('0x21')]===_0xac69('0x22');var _0x2f2311=_0x13be59[_0xac69('0x23')];var _0x75b7c5=_0x5b5ded?0x0:_0x52d7dd[_0xac69('0x20')];var _0x4f5235=_0x5b5ded?_0x13be59['count']:_0x52d7dd[_0xac69('0x20')]+_0x52d7dd['limit'];var _0x277fea;if(_0x4f5235>=_0x2f2311){_0x4f5235=_0x2f2311;_0x277fea=0xc8;}else{_0x277fea=0xce;}_0x98a916['status'](_0x277fea);return _0x98a916[_0xac69('0x24')]('Content-Range',_0x75b7c5+'-'+_0x4f5235+'/'+_0x2f2311)[_0xac69('0x25')](_0x13be59);}return null;};}function patchUpdates(_0x1780a4){return function(_0x64341){try{jsonpatch[_0xac69('0x26')](_0x64341,_0x1780a4,!![]);}catch(_0x2475bc){return BPromise[_0xac69('0x27')](_0x2475bc);}return _0x64341[_0xac69('0x28')]();};}function saveUpdates(_0x758a9f,_0x1d4234){return function(_0x3690e7){if(_0x3690e7){return _0x3690e7[_0xac69('0x29')](_0x758a9f)['then'](function(_0x41dff3){return _0x41dff3;});}return null;};}function removeEntity(_0x16a2d5,_0x3bf667){return function(_0x152104){if(_0x152104){return _0x152104[_0xac69('0x2a')]()['then'](function(){var _0x40c0da=_0x152104[_0xac69('0x2b')]({'plain':!![]});var _0x3660dd='Lists';return db[_0xac69('0x2c')]['destroy']({'where':{'type':_0x3660dd,'resourceId':_0x40c0da['id']}})[_0xac69('0x2d')](function(){return _0x152104;});})[_0xac69('0x2d')](function(){_0x16a2d5[_0xac69('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd4c221,_0x377c2b){return function(_0x5e6df0){if(!_0x5e6df0){_0xd4c221['sendStatus'](0x194);}return _0x5e6df0;};}function handleError(_0x38eec7,_0x2f4d34){_0x2f4d34=_0x2f4d34||0x1f4;return function(_0xb4d93d){logger['error'](_0xb4d93d['stack']);if(_0xb4d93d[_0xac69('0x2e')]){delete _0xb4d93d[_0xac69('0x2e')];}_0x38eec7[_0xac69('0x1e')](_0x2f4d34)[_0xac69('0x2f')](_0xb4d93d);};}exports[_0xac69('0x30')]=function(_0x469bb8,_0x351a72){var _0x221e6f={},_0x718572={},_0x2fea27={'count':0x0,'rows':[]};var _0x1e7d6f=_[_0xac69('0x31')](db['CmList'][_0xac69('0x32')],function(_0x1ba16a){return{'name':_0x1ba16a[_0xac69('0x33')],'type':_0x1ba16a[_0xac69('0x34')][_0xac69('0x35')]};});_0x718572[_0xac69('0x36')]=_[_0xac69('0x31')](_0x1e7d6f,_0xac69('0x2e'));_0x718572[_0xac69('0x37')]=_['keys'](_0x469bb8[_0xac69('0x37')]);_0x718572[_0xac69('0x38')]=_['intersection'](_0x718572['model'],_0x718572[_0xac69('0x37')]);_0x221e6f[_0xac69('0x39')]=_[_0xac69('0x3a')](_0x718572[_0xac69('0x36')],qs['fields'](_0x469bb8[_0xac69('0x37')][_0xac69('0x3b')]));_0x221e6f[_0xac69('0x39')]=_0x221e6f[_0xac69('0x39')][_0xac69('0x3c')]?_0x221e6f[_0xac69('0x39')]:_0x718572[_0xac69('0x36')];if(!_0x469bb8[_0xac69('0x37')][_0xac69('0x3d')](_0xac69('0x3e'))){_0x221e6f['limit']=qs[_0xac69('0x21')](_0x469bb8['query'][_0xac69('0x21')]);_0x221e6f[_0xac69('0x20')]=qs['offset'](_0x469bb8[_0xac69('0x37')][_0xac69('0x20')]);}_0x221e6f['order']=qs['sort'](_0x469bb8[_0xac69('0x37')][_0xac69('0x3f')]);_0x221e6f[_0xac69('0x40')]=qs['filters'](_[_0xac69('0x41')](_0x469bb8['query'],_0x718572['filters']),_0x1e7d6f);if(_0x469bb8['query'][_0xac69('0x42')]){_0x221e6f['where']=_[_0xac69('0x43')](_0x221e6f[_0xac69('0x40')],{'$or':_[_0xac69('0x31')](_0x1e7d6f,function(_0x9bfdad){if(_0x9bfdad[_0xac69('0x34')]!==_0xac69('0x44')){var _0x35e901={};_0x35e901[_0x9bfdad[_0xac69('0x2e')]]={'$like':'%'+_0x469bb8[_0xac69('0x37')][_0xac69('0x42')]+'%'};return _0x35e901;}})});}_0x221e6f=_[_0xac69('0x43')]({},_0x221e6f,_0x469bb8['options']);var _0x332e6f={'where':_0x221e6f[_0xac69('0x40')]};return db[_0xac69('0x45')]['count'](_0x332e6f)[_0xac69('0x2d')](function(_0x31f2f4){_0x2fea27[_0xac69('0x23')]=_0x31f2f4;if(_0x469bb8[_0xac69('0x37')][_0xac69('0x46')]){_0x221e6f[_0xac69('0x47')]=[{'all':!![]}];}return db[_0xac69('0x45')][_0xac69('0x48')](_0x221e6f);})[_0xac69('0x2d')](function(_0x1a46a4){_0x2fea27[_0xac69('0x49')]=_0x1a46a4;return _0x2fea27;})['then'](respondWithFilteredResult(_0x351a72,_0x221e6f))[_0xac69('0x4a')](handleError(_0x351a72,null));};exports[_0xac69('0x4b')]=function(_0x43068c,_0x39ce4d){var _0x40a1ec={'raw':![],'where':{'id':_0x43068c[_0xac69('0x4c')]['id']}},_0x32e408={};_0x32e408[_0xac69('0x36')]=_[_0xac69('0x4d')](db[_0xac69('0x45')][_0xac69('0x32')]);_0x32e408['query']=_[_0xac69('0x4d')](_0x43068c[_0xac69('0x37')]);_0x32e408[_0xac69('0x38')]=_['intersection'](_0x32e408[_0xac69('0x36')],_0x32e408['query']);_0x40a1ec[_0xac69('0x39')]=_[_0xac69('0x3a')](_0x32e408[_0xac69('0x36')],qs[_0xac69('0x3b')](_0x43068c[_0xac69('0x37')][_0xac69('0x3b')]));_0x40a1ec['attributes']=_0x40a1ec[_0xac69('0x39')][_0xac69('0x3c')]?_0x40a1ec[_0xac69('0x39')]:_0x32e408[_0xac69('0x36')];if(_0x43068c[_0xac69('0x37')]['includeAll']){_0x40a1ec['include']=[{'all':!![]}];}_0x40a1ec=_[_0xac69('0x43')]({},_0x40a1ec,_0x43068c[_0xac69('0x4e')]);return db[_0xac69('0x45')]['find'](_0x40a1ec)[_0xac69('0x2d')](handleEntityNotFound(_0x39ce4d,null))[_0xac69('0x2d')](respondWithResult(_0x39ce4d,null))['catch'](handleError(_0x39ce4d,null));};exports[_0xac69('0x4f')]=function(_0x52c09d,_0x3d7a6a){return db['CmList'][_0xac69('0x4f')](_0x52c09d[_0xac69('0x50')],{})['then'](function(_0x18f29e){var _0x1ff401=_0x52c09d['user'][_0xac69('0x2b')]({'plain':!![]});if(!_0x1ff401)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ff401[_0xac69('0x51')]===_0xac69('0x52')){var _0x26608=_0x18f29e['get']({'plain':!![]});var _0x125958=_0xac69('0x53');return db[_0xac69('0x54')][_0xac69('0x55')]({'where':{'name':_0x125958,'userProfileId':_0x1ff401[_0xac69('0x56')]},'raw':!![]})[_0xac69('0x2d')](function(_0x12d861){if(_0x12d861&&_0x12d861[_0xac69('0x57')]===0x0){return db[_0xac69('0x2c')][_0xac69('0x4f')]({'name':_0x26608['name'],'resourceId':_0x26608['id'],'type':_0x12d861['name'],'sectionId':_0x12d861['id']},{})[_0xac69('0x2d')](function(){return _0x18f29e;});}else{return _0x18f29e;}})['catch'](function(_0x4555a0){logger[_0xac69('0x58')](_0xac69('0x59'),_0x4555a0);throw _0x4555a0;});}return _0x18f29e;})[_0xac69('0x2d')](respondWithResult(_0x3d7a6a,0xc9))[_0xac69('0x4a')](handleError(_0x3d7a6a,null));};exports[_0xac69('0x29')]=function(_0x3faa94,_0x2d747c){if(_0x3faa94[_0xac69('0x50')]['id']){delete _0x3faa94[_0xac69('0x50')]['id'];}return db['CmList'][_0xac69('0x55')]({'where':{'id':_0x3faa94[_0xac69('0x4c')]['id']}})[_0xac69('0x2d')](handleEntityNotFound(_0x2d747c,null))[_0xac69('0x2d')](saveUpdates(_0x3faa94[_0xac69('0x50')],null))[_0xac69('0x2d')](respondWithResult(_0x2d747c,null))['catch'](handleError(_0x2d747c,null));};exports['destroy']=function(_0x50a556,_0x293c3f){return db[_0xac69('0x45')][_0xac69('0x55')]({'where':{'id':_0x50a556[_0xac69('0x4c')]['id']}})['then'](handleEntityNotFound(_0x293c3f,null))[_0xac69('0x2d')](removeEntity(_0x293c3f,null))['catch'](handleError(_0x293c3f,null));};exports['describe']=function(_0x393576,_0x29bf9f){return db[_0xac69('0x45')]['describe']()[_0xac69('0x2d')](respondWithResult(_0x29bf9f,null))[_0xac69('0x4a')](handleError(_0x29bf9f,null));};exports[_0xac69('0x5a')]=function(_0x462e86,_0x4bf0b1,_0x231b58){if(_0x462e86[_0xac69('0x50')]['id']){delete _0x462e86[_0xac69('0x50')]['id'];}return db[_0xac69('0x45')][_0xac69('0x55')]({'where':{'id':_0x462e86['params']['id']}})[_0xac69('0x2d')](handleEntityNotFound(_0x4bf0b1,null))['then'](function(_0x43ad02){if(_0x43ad02){_0x462e86[_0xac69('0x50')][_0xac69('0x5b')]=_0x43ad02['id'];return db[_0xac69('0x5c')][_0xac69('0x4f')](_0x462e86[_0xac69('0x50')]);}})[_0xac69('0x2d')](respondWithResult(_0x4bf0b1,null))['catch'](handleError(_0x4bf0b1,null));};exports[_0xac69('0x5d')]=function(_0x2a2c63,_0x1e3ecc,_0x4f816f){var _0x296dc1={'raw':![],'where':{}};var _0x21637a={};var _0x262430={'count':0x0,'rows':[]};return db[_0xac69('0x45')][_0xac69('0x5e')]({'where':{'id':_0x2a2c63['params']['id']}})[_0xac69('0x2d')](handleEntityNotFound(_0x1e3ecc,null))['then'](function(_0x463b27){if(_0x463b27){_0x21637a[_0xac69('0x36')]=_[_0xac69('0x4d')](db['Disposition'][_0xac69('0x32')]);_0x21637a[_0xac69('0x37')]=_[_0xac69('0x4d')](_0x2a2c63['query']);_0x21637a[_0xac69('0x38')]=_[_0xac69('0x3a')](_0x21637a[_0xac69('0x36')],_0x21637a['query']);_0x296dc1[_0xac69('0x39')]=_[_0xac69('0x3a')](_0x21637a[_0xac69('0x36')],qs['fields'](_0x2a2c63[_0xac69('0x37')][_0xac69('0x3b')]));_0x296dc1[_0xac69('0x39')]=_0x296dc1[_0xac69('0x39')][_0xac69('0x3c')]?_0x296dc1[_0xac69('0x39')]:_0x21637a[_0xac69('0x36')];if(!_0x2a2c63[_0xac69('0x37')]['hasOwnProperty'](_0xac69('0x3e'))){_0x296dc1[_0xac69('0x21')]=qs[_0xac69('0x21')](_0x2a2c63[_0xac69('0x37')][_0xac69('0x21')]);_0x296dc1[_0xac69('0x20')]=qs[_0xac69('0x20')](_0x2a2c63['query']['offset']);}_0x296dc1[_0xac69('0x5f')]=qs[_0xac69('0x3f')](_0x2a2c63['query'][_0xac69('0x3f')]);_0x296dc1[_0xac69('0x40')]=qs[_0xac69('0x38')](_[_0xac69('0x41')](_0x2a2c63[_0xac69('0x37')],_0x21637a[_0xac69('0x38')]));_0x296dc1[_0xac69('0x40')][_0xac69('0x5b')]=_0x463b27['id'];if(_0x2a2c63[_0xac69('0x37')][_0xac69('0x42')]){_0x296dc1['where']=_[_0xac69('0x43')](_0x296dc1[_0xac69('0x40')],{'$or':_[_0xac69('0x31')](_0x296dc1[_0xac69('0x39')],function(_0x363a73){var _0x2cfd3d={};_0x2cfd3d[_0x363a73]={'$like':'%'+_0x2a2c63['query']['filter']+'%'};return _0x2cfd3d;})});}_0x296dc1=_[_0xac69('0x43')]({},_0x296dc1,_0x2a2c63[_0xac69('0x4e')]);return db[_0xac69('0x5c')][_0xac69('0x23')]({'where':_0x296dc1[_0xac69('0x40')]})['then'](function(_0x541bfa){_0x262430[_0xac69('0x23')]=_0x541bfa;if(_0x2a2c63[_0xac69('0x37')][_0xac69('0x46')]){_0x296dc1['include']=[{'all':!![]}];}return db[_0xac69('0x5c')][_0xac69('0x48')](_0x296dc1);})[_0xac69('0x2d')](function(_0x243dbe){_0x262430[_0xac69('0x49')]=_0x243dbe;return _0x262430;});}})[_0xac69('0x2d')](respondWithFilteredResult(_0x1e3ecc,_0x296dc1))[_0xac69('0x4a')](handleError(_0x1e3ecc,null));};exports[_0xac69('0x60')]=function(_0x176473,_0x56c5d3,_0x49d593){return db[_0xac69('0x45')][_0xac69('0x55')]({'where':{'id':_0x176473[_0xac69('0x4c')]['id']}})[_0xac69('0x2d')](handleEntityNotFound(_0x56c5d3,null))[_0xac69('0x2d')](function(_0x249cee){if(_0x249cee){return _0x249cee[_0xac69('0x60')](_0x176473['query'][_0xac69('0x61')]);}})[_0xac69('0x2d')](respondWithStatusCode(_0x56c5d3,null))[_0xac69('0x4a')](handleError(_0x56c5d3,null));};exports[_0xac69('0x62')]=function(_0x1f457f,_0x22ee8a,_0x382a12){return db['CmList'][_0xac69('0x55')]({'where':{'id':_0x1f457f[_0xac69('0x4c')]['id']}})['then'](handleEntityNotFound(_0x22ee8a,null))[_0xac69('0x2d')](function(_0x31e380){if(_0x31e380){var _0x50240f=[];var _0x3d6be1={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xac69('0x2d')](function(_0x1878c4){if(_0x1f457f[_0xac69('0x50')][_0xac69('0x63')]&&_[_0xac69('0x64')](_0x1f457f[_0xac69('0x50')][_0xac69('0x63')])){if(_0x1f457f[_0xac69('0x50')]['tags'][_0xac69('0x3c')]){_0x1f457f[_0xac69('0x50')][_0xac69('0x63')]=_0x1f457f[_0xac69('0x50')][_0xac69('0x63')][_0xac69('0x65')](';')+';';}else{_0x1f457f['body'][_0xac69('0x63')]=null;}}else{_0x1f457f[_0xac69('0x50')][_0xac69('0x63')]=null;}if(_0x1f457f[_0xac69('0x50')]&&_[_0xac69('0x64')](_0x1f457f[_0xac69('0x50')])){for(var _0x1a459b=0x0;_0x1a459b<_0x1f457f['body']['length'];_0x1a459b+=0x1){_0x1f457f[_0xac69('0x50')][_0x1a459b]['ListId']=_0x1f457f[_0xac69('0x4c')]['id'];_0x50240f['push'](_0x1f457f[_0xac69('0x50')][_0x1a459b]);}return BPromise[_0xac69('0x66')](_0x50240f,function(_0x4aa1a3){return db[_0xac69('0x67')][_0xac69('0x4f')](_['omit'](_0x4aa1a3,[_0xac69('0x61'),'id'])||{},{'fields':_[_0xac69('0x4d')](_0x1878c4),'raw':!![]})['then'](function(_0x4336b0){_0x3d6be1[_0xac69('0x68')]['push'](_0x4336b0[_0xac69('0x69')]);})[_0xac69('0x4a')](function(_0x334405){_0x3d6be1[_0xac69('0x6a')][_0xac69('0x6b')]({'data':_0x4aa1a3,'error':_0x334405[_0xac69('0x6c')]});});})[_0xac69('0x2d')](function(_0x4108ef){return _0x3d6be1;})[_0xac69('0x4a')](function(_0x4d82d2){return _0x4d82d2;});}else{_0x22ee8a['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xac69('0x2d')](respondWithResult(_0x22ee8a,null))[_0xac69('0x4a')](handleError(_0x22ee8a,null));};exports[_0xac69('0x6d')]=function(_0x3bb53d,_0x347e15,_0xf6147a){var _0x2a8328;return db[_0xac69('0x45')]['find']({'where':{'id':_0x3bb53d[_0xac69('0x4c')]['id']},'include':[{'model':db[_0xac69('0x6e')],'as':'CustomFields'}]})[_0xac69('0x2d')](handleEntityNotFound(_0x347e15,null))[_0xac69('0x2d')](function(_0x1fb9d1){if(_0x1fb9d1){_0x2a8328=_0x1fb9d1;return db[_0xac69('0x67')][_0xac69('0x32')];}})[_0xac69('0x2d')](function(_0xbbda93){if(_0xbbda93){var _0x247b20={};var _0x169af3={};_0x169af3[_0xac69('0x36')]=_[_0xac69('0x6f')](_[_0xac69('0x4d')](_0xbbda93),_[_0xac69('0x31')](_0x2a8328[_0xac69('0x70')],function(_0x2046e0){return util[_0xac69('0x71')]('cf_%d',_0x2046e0['id']);}));_0x169af3['query']=_[_0xac69('0x4d')](_0x3bb53d[_0xac69('0x37')]);_0x169af3[_0xac69('0x38')]=_['intersection'](_0x169af3[_0xac69('0x36')],_0x169af3[_0xac69('0x37')]);_0x247b20[_0xac69('0x39')]=_[_0xac69('0x3a')](_0x169af3[_0xac69('0x36')],qs[_0xac69('0x3b')](_0x3bb53d['query'][_0xac69('0x3b')]));_0x247b20[_0xac69('0x39')]=_0x247b20[_0xac69('0x39')][_0xac69('0x3c')]?_0x247b20['attributes']:_0x169af3['model'];if(!_0x3bb53d[_0xac69('0x37')][_0xac69('0x3d')](_0xac69('0x3e'))){_0x247b20['limit']=qs[_0xac69('0x21')](_0x3bb53d[_0xac69('0x37')][_0xac69('0x21')]);_0x247b20[_0xac69('0x20')]=qs[_0xac69('0x20')](_0x3bb53d['query'][_0xac69('0x20')]);}_0x247b20[_0xac69('0x5f')]=qs[_0xac69('0x3f')](_0x3bb53d['query']['sort']);_0x247b20[_0xac69('0x40')]=qs['filters'](_['pick'](_0x3bb53d[_0xac69('0x37')],_0x169af3[_0xac69('0x38')]));_0x247b20[_0xac69('0x72')]=!![];if(_0x3bb53d[_0xac69('0x37')][_0xac69('0x42')]){_0x247b20[_0xac69('0x40')]=_[_0xac69('0x43')](_0x247b20[_0xac69('0x40')],{'$or':_['map'](_0x247b20[_0xac69('0x39')],function(_0x41fa09){var _0x3c0f34={};_0x3c0f34[_0x41fa09]={'$like':'%'+_0x3bb53d[_0xac69('0x37')]['filter']+'%'};return _0x3c0f34;})});}_0x247b20=_[_0xac69('0x43')]({},_0x247b20,_0x3bb53d[_0xac69('0x4e')]);return _0x2a8328[_0xac69('0x6d')](_0x247b20);}})[_0xac69('0x2d')](respondWithResult(_0x347e15,null))['catch'](handleError(_0x347e15,null));};exports[_0xac69('0x73')]=function(_0x341f30,_0xddc1e5,_0x20ea63){var _0x5f2870;var _0x48311a;var _0x17f19b;var _0x5d0eca=_0x341f30[_0xac69('0x4c')]['id'];csv_results=[];return db[_0xac69('0x74')][_0xac69('0x48')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0xac69('0x2d')](function(_0x1b4127){_0x5f2870=_0x1b4127;var _0x56b425=_['keys'](db[_0xac69('0x67')][_0xac69('0x32')]);return db[_0xac69('0x6e')][_0xac69('0x48')]({'raw':!![],'attributes':['id','alias']})[_0xac69('0x2d')](function(_0x261e69){_0x48311a=_0x261e69;var _0x54ef8e=squel['select']()[_0xac69('0x3b')](_0x56b425)['from'](_0xac69('0x75'),'c')[_0xac69('0x40')]('c.ListId\x20=\x20?',_0x5d0eca)[_0xac69('0x40')](_0xac69('0x76'))[_0xac69('0x77')]();for(var _0x382bc7=0x0;_0x382bc7<_0x48311a[_0xac69('0x3c')];_0x382bc7++){_0x54ef8e['field'](_0xac69('0x78')+_0x48311a[_0x382bc7]['id'],_0xac69('0x79')+_0x48311a[_0x382bc7][_0xac69('0x7a')]);}for(var _0x382bc7=0x0;_0x382bc7<_0x5f2870[_0xac69('0x3c')];_0x382bc7++){_0x54ef8e[_0xac69('0x7b')](squel[_0xac69('0x7c')]()[_0xac69('0x7b')](_0xac69('0x7d'))['from'](_0xac69('0x7e'))[_0xac69('0x40')](_0xac69('0x7f'),_0x5f2870[_0x382bc7]['id'])[_0xac69('0x40')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x5f2870[_0x382bc7]['name']);_0x54ef8e[_0xac69('0x7b')](squel[_0xac69('0x7c')]()[_0xac69('0x7b')](_0xac69('0x80'))['from']('cm_contact_has_items')[_0xac69('0x40')](_0xac69('0x7f'),_0x5f2870[_0x382bc7]['id'])[_0xac69('0x40')](_0xac69('0x81')),_0xac69('0x82')+_0x5f2870[_0x382bc7][_0xac69('0x2e')]);}var _0x3bdadc=[];_0x3bdadc[_0xac69('0x6b')](_0x54ef8e['toString']());BPromise[_0xac69('0x66')](_0x3bdadc,handleQuery)[_0xac69('0x2d')](function(_0x15d6e3){handleQuery(_0x54ef8e[_0xac69('0x83')]());var _0x379369=csv_results[0x0];if(!_[_0xac69('0x84')](_0x379369)){var _0x3dde78=toCsv(_0x379369);var _0x5c39f0=Date[_0xac69('0x85')]();fs[_0xac69('0x86')](util['format'](_0xac69('0x87'),_0x5d0eca,_0x5c39f0),_0x3dde78);_0xddc1e5['setHeader']('Content-disposition','attachment;\x20filename='+util[_0xac69('0x71')](_0xac69('0x88'),_0x5d0eca,_0x5c39f0));_0xddc1e5[_0xac69('0x89')](_0xac69('0x8a'),_0xac69('0x8b'));return _0xddc1e5['download'](util[_0xac69('0x71')]('/tmp/list_%d_%s.csv',_0x5d0eca,_0x5c39f0));}else{return _0xddc1e5[_0xac69('0x1d')](0xcc);}});});});};exports[_0xac69('0x8c')]=function(_0x53d2af,_0x4e1c1c,_0xf6d30a){var _0x3fa69b;delete _0x53d2af['body']['id'];return db[_0xac69('0x45')][_0xac69('0x5e')]({'where':{'id':_0x53d2af[_0xac69('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e1c1c,null))[_0xac69('0x2d')](function(_0x28e6ca){if(_0x28e6ca){return db[_0xac69('0x8d')][_0xac69('0x8e')](function(_0x3fcd95){return db[_0xac69('0x6e')]['create'](_0x53d2af['body'],{'transaction':_0x3fcd95})[_0xac69('0x2d')](function(_0x372160){_0x3fa69b=_0x372160;return _0x28e6ca[_0xac69('0x8f')](_0x372160,{'transaction':_0x3fcd95});})[_0xac69('0x2d')](function(){var _0x5ab0a4={'type':db[_0xac69('0x90')]['TEXT'],'transaction':_0x3fcd95};switch(_0x53d2af[_0xac69('0x50')][_0xac69('0x34')]){case _0xac69('0x91'):_0x5ab0a4[_0xac69('0x34')]=db[_0xac69('0x90')][_0xac69('0x92')];break;case _0xac69('0x93'):_0x5ab0a4[_0xac69('0x34')]=db[_0xac69('0x90')][_0xac69('0x94')];break;case'switch':_0x5ab0a4[_0xac69('0x34')]=db[_0xac69('0x90')][_0xac69('0x95')];_0x5ab0a4[_0xac69('0x96')]=![];break;default:}return db['sequelize'][_0xac69('0x97')]['addColumn']('cm_contacts',util[_0xac69('0x71')](_0xac69('0x98'),_0x3fa69b['id']),_0x5ab0a4);})[_0xac69('0x2d')](function(){return _0x3fa69b;});});}})[_0xac69('0x2d')](respondWithResult(_0x4e1c1c,null))[_0xac69('0x4a')](handleError(_0x4e1c1c,null));};exports[_0xac69('0x99')]=function(_0x5c3df0,_0x40a0ea,_0x2030e3){var _0x4e8078={};var _0x5ea417={};var _0x52e5cc;var _0x17af77;return db[_0xac69('0x45')][_0xac69('0x5e')]({'where':{'id':_0x5c3df0['params']['id']}})['then'](handleEntityNotFound(_0x40a0ea,null))[_0xac69('0x2d')](function(_0x1e0558){if(_0x1e0558){_0x52e5cc=_0x1e0558;_0x5ea417[_0xac69('0x36')]=_['keys'](db[_0xac69('0x6e')]['rawAttributes']);_0x5ea417[_0xac69('0x37')]=_[_0xac69('0x4d')](_0x5c3df0[_0xac69('0x37')]);_0x5ea417[_0xac69('0x38')]=_['intersection'](_0x5ea417[_0xac69('0x36')],_0x5ea417[_0xac69('0x37')]);_0x4e8078[_0xac69('0x39')]=_[_0xac69('0x3a')](_0x5ea417[_0xac69('0x36')],qs[_0xac69('0x3b')](_0x5c3df0[_0xac69('0x37')]['fields']));_0x4e8078['attributes']=_0x4e8078['attributes'][_0xac69('0x3c')]?_0x4e8078['attributes']:_0x5ea417['model'];_0x4e8078[_0xac69('0x5f')]=qs[_0xac69('0x3f')](_0x5c3df0[_0xac69('0x37')][_0xac69('0x3f')]);_0x4e8078[_0xac69('0x40')]=qs[_0xac69('0x38')](_[_0xac69('0x41')](_0x5c3df0[_0xac69('0x37')],_0x5ea417['filters']));_0x4e8078[_0xac69('0x40')]=_[_0xac69('0x43')](_0x4e8078[_0xac69('0x40')],{'$or':[{'ListId':_0x1e0558['id']},{'ListId':null}]});if(_0x5c3df0[_0xac69('0x37')][_0xac69('0x42')]){_0x4e8078[_0xac69('0x40')]=_[_0xac69('0x43')](_0x4e8078['where'],{'$or':_[_0xac69('0x31')](_0x4e8078['attributes'],function(_0x156b52){var _0x2d1a22={};_0x2d1a22[_0x156b52]={'$like':'%'+_0x5c3df0[_0xac69('0x37')]['filter']+'%'};return _0x2d1a22;})});}_0x4e8078=_[_0xac69('0x43')]({},_0x4e8078,_0x5c3df0[_0xac69('0x4e')]);return db[_0xac69('0x6e')][_0xac69('0x9a')](_0x4e8078);}})[_0xac69('0x2d')](respondWithResult(_0x40a0ea,null))[_0xac69('0x4a')](handleError(_0x40a0ea,null));};exports[_0xac69('0x9b')]=function(_0x1b23f4,_0x422108){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0xac69('0x2d')](handleEntityNotFound(_0x422108,null))[_0xac69('0x2d')](function(_0x21babe){return _0x21babe;})['then'](respondWithResult(_0x422108,null))['catch'](handleError(_0x422108,null));};exports[_0xac69('0x9c')]=function(_0xe04b29,_0x4f8a09,_0x1be87e){return db[_0xac69('0x45')][_0xac69('0x55')]({'where':{'id':_0xe04b29['params']['id']}})['then'](handleEntityNotFound(_0x4f8a09,null))[_0xac69('0x2d')](function(_0xf53321){if(_0xf53321){return _0xf53321['addAgents'](_0xe04b29[_0xac69('0x50')][_0xac69('0x61')],_['omit'](_0xe04b29['body'],['ids','id'])||{})['spread'](function(_0x26d097){for(var _0x1fb1dc=0x0;_0x1fb1dc<_0xe04b29[_0xac69('0x50')][_0xac69('0x61')][_0xac69('0x3c')];_0x1fb1dc+=0x1){socket[_0xac69('0x9d')]('userCmList:save',{'UserId':Number(_0xe04b29[_0xac69('0x50')]['ids'][_0x1fb1dc]),'CmListId':Number(_0xe04b29[_0xac69('0x4c')]['id'])});}return _0x26d097;});}})[_0xac69('0x2d')](respondWithResult(_0x4f8a09,null))[_0xac69('0x4a')](handleError(_0x4f8a09,null));};exports[_0xac69('0x9e')]=function(_0x590d4b,_0x231fec,_0x5ee79c){return db[_0xac69('0x45')][_0xac69('0x55')]({'where':{'id':_0x590d4b[_0xac69('0x4c')]['id']}})[_0xac69('0x2d')](handleEntityNotFound(_0x231fec,null))[_0xac69('0x2d')](function(_0x56aa83){if(_0x56aa83){return _0x56aa83[_0xac69('0x9e')](_0x590d4b[_0xac69('0x37')][_0xac69('0x61')])['then'](function(){if(_['isArray'](_0x590d4b[_0xac69('0x37')]['ids'])){for(var _0x1bc03f=0x0;_0x1bc03f<_0x590d4b['query'][_0xac69('0x61')][_0xac69('0x3c')];_0x1bc03f+=0x1){socket[_0xac69('0x9d')](_0xac69('0x9f'),{'UserId':Number(_0x590d4b[_0xac69('0x37')][_0xac69('0x61')][_0x1bc03f]),'CmListId':Number(_0x590d4b[_0xac69('0x4c')]['id'])});}}else{socket[_0xac69('0x9d')](_0xac69('0x9f'),{'UserId':Number(_0x590d4b[_0xac69('0x37')][_0xac69('0x61')]),'CmListId':Number(_0x590d4b[_0xac69('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x231fec,null))[_0xac69('0x4a')](handleError(_0x231fec,null));};exports[_0xac69('0xa0')]=function(_0x4cb116,_0x374564,_0x43695a){var _0x4f828f={};var _0x268ea5={};var _0xc40aad;var _0x3fc370;return db[_0xac69('0x45')]['findOne']({'where':{'id':_0x4cb116[_0xac69('0x4c')]['id']}})[_0xac69('0x2d')](handleEntityNotFound(_0x374564,null))[_0xac69('0x2d')](function(_0x2aae83){if(_0x2aae83){_0xc40aad=_0x2aae83;_0x268ea5[_0xac69('0x36')]=_[_0xac69('0x4d')](db['User'][_0xac69('0x32')]);_0x268ea5[_0xac69('0x37')]=_[_0xac69('0x4d')](_0x4cb116[_0xac69('0x37')]);_0x268ea5[_0xac69('0x38')]=_['intersection'](_0x268ea5[_0xac69('0x36')],_0x268ea5[_0xac69('0x37')]);_0x4f828f[_0xac69('0x39')]=_[_0xac69('0x3a')](_0x268ea5[_0xac69('0x36')],qs['fields'](_0x4cb116['query'][_0xac69('0x3b')]));_0x4f828f[_0xac69('0x39')]=_0x4f828f[_0xac69('0x39')][_0xac69('0x3c')]?_0x4f828f['attributes']:_0x268ea5[_0xac69('0x36')];_0x4f828f[_0xac69('0x5f')]=qs[_0xac69('0x3f')](_0x4cb116[_0xac69('0x37')][_0xac69('0x3f')]);_0x4f828f['where']=qs[_0xac69('0x38')](_[_0xac69('0x41')](_0x4cb116[_0xac69('0x37')],_0x268ea5[_0xac69('0x38')]));if(_0x4cb116[_0xac69('0x37')]['filter']){_0x4f828f[_0xac69('0x40')]=_[_0xac69('0x43')](_0x4f828f['where'],{'$or':_[_0xac69('0x31')](_0x4f828f[_0xac69('0x39')],function(_0x4cba27){var _0x165e26={};_0x165e26[_0x4cba27]={'$like':'%'+_0x4cb116[_0xac69('0x37')][_0xac69('0x42')]+'%'};return _0x165e26;})});}_0x4f828f=_[_0xac69('0x43')]({},_0x4f828f,_0x4cb116[_0xac69('0x4e')]);return _0xc40aad[_0xac69('0xa0')](_0x4f828f);}})[_0xac69('0x2d')](function(_0x2460b3){if(_0x2460b3){_0x3fc370=_0x2460b3[_0xac69('0x3c')];if(!_0x4cb116['query']['hasOwnProperty']('nolimit')){_0x4f828f['limit']=qs[_0xac69('0x21')](_0x4cb116[_0xac69('0x37')][_0xac69('0x21')]);_0x4f828f[_0xac69('0x20')]=qs['offset'](_0x4cb116['query'][_0xac69('0x20')]);}return _0xc40aad[_0xac69('0xa0')](_0x4f828f);}})[_0xac69('0x2d')](function(_0x43fcc6){if(_0x43fcc6){return _0x43fcc6?{'count':_0x3fc370,'rows':_0x43fcc6}:null;}})['then'](respondWithResult(_0x374564,null))[_0xac69('0x4a')](handleError(_0x374564,null));};function handleQuery(_0x453269){logger[_0xac69('0xa1')](_0x453269);return db[_0xac69('0x8d')][_0xac69('0x37')](_0x453269)[_0xac69('0xa2')](function(_0x776496){csv_results[_0xac69('0x6b')](_0x776496);})[_0xac69('0x4a')](function(_0x1d2cb6){logger[_0xac69('0x58')](_0x1d2cb6[_0xac69('0x6c')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f125b23..7b40135 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x5fc3,0xa8));var _0x35fc=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x5fc3[_0xe896bf];return _0x4c7a8a;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x45b846,_0x15c3c6){_0x45b846=_0x45b846-0x0;var _0x39db99=_0x3e74[_0x45b846];return _0x39db99;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 41cdee0..66e90af 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 _0x4483=['define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x4b3a18,_0x4869e0){var _0x18bdd2=function(_0x22141b){while(--_0x22141b){_0x4b3a18['push'](_0x4b3a18['shift']());}};_0x18bdd2(++_0x4869e0);}(_0x4483,0x1a3));var _0x3448=function(_0xff14d4,_0x1be33b){_0xff14d4=_0xff14d4-0x0;var _0x4a2ecd=_0x4483[_0xff14d4];return _0x4a2ecd;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var fs=require('fs');var path=require(_0x3448('0x6'));var rimraf=require(_0x3448('0x7'));var config=require('../../config/environment');var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x1b05db,_0xd3606d){return _0x1b05db[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x4a2536,_0x217bba){var _0x42f914=function(_0x298657){while(--_0x298657){_0x4a2536['push'](_0x4a2536['shift']());}};_0x42f914(++_0x217bba);}(_0xec56,0x1bd));var _0x6ec5=function(_0x180cd6,_0x323cc1){_0x180cd6=_0x180cd6-0x0;var _0x34cffd=_0xec56[_0x180cd6];return _0x34cffd;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('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 f08c2c8..50ac5e4 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 _0x227c=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x48ce3d,_0x3fbdaf){var _0xff4f24=function(_0x3341b0){while(--_0x3341b0){_0x48ce3d['push'](_0x48ce3d['shift']());}};_0xff4f24(++_0x3fbdaf);}(_0x227c,0x166));var _0xc227=function(_0x526818,_0x30c916){_0x526818=_0x526818-0x0;var _0x44c7e3=_0x227c[_0x526818];return _0x44c7e3;};'use strict';var _=require('lodash');var util=require(_0xc227('0x0'));var moment=require(_0xc227('0x1'));var BPromise=require(_0xc227('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc227('0x3'));var db=require(_0xc227('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc227('0x5'))(_0xc227('0x6'));var config=require('../../config/environment');var jayson=require(_0xc227('0x7'));var client=jayson[_0xc227('0x8')][_0xc227('0x9')]({'port':0x232a});config[_0xc227('0xa')]=_['defaults'](config[_0xc227('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc227('0xb'))(new Redis(config[_0xc227('0xa')]));require(_0xc227('0xc'))[_0xc227('0xd')](socket);function respondWithRpcPromise(_0xa4d954,_0xb6a902,_0x57a568){return new BPromise(function(_0x56b935,_0x41fb2a){return client[_0xc227('0xe')](_0xa4d954,_0x57a568)['then'](function(_0x550d8d){logger['info'](_0xc227('0xf'),_0xb6a902,_0xc227('0x10'));logger['debug'](_0xc227('0x11'),_0xb6a902,'request\x20sent',JSON[_0xc227('0x12')](_0x550d8d));if(_0x550d8d[_0xc227('0x13')]){if(_0x550d8d[_0xc227('0x13')][_0xc227('0x14')]===0x1f4){logger[_0xc227('0x13')](_0xc227('0xf'),_0xb6a902,_0x550d8d[_0xc227('0x13')]['message']);return _0x41fb2a(_0x550d8d[_0xc227('0x13')][_0xc227('0x15')]);}logger[_0xc227('0x13')]('CmList,\x20%s,\x20%s',_0xb6a902,_0x550d8d[_0xc227('0x13')]['message']);return _0x56b935(_0x550d8d[_0xc227('0x13')]['message']);}else{logger[_0xc227('0x16')](_0xc227('0xf'),_0xb6a902,_0xc227('0x10'));_0x56b935(_0x550d8d[_0xc227('0x17')][_0xc227('0x15')]);}})[_0xc227('0x18')](function(_0x1b4b5a){logger[_0xc227('0x13')](_0xc227('0xf'),_0xb6a902,_0x1b4b5a);_0x41fb2a(_0x1b4b5a);});});} \ No newline at end of file +var _0xd48c=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xd48c,0x10f));var _0xcd48=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd48c[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0xcd48('0x0'));var moment=require(_0xcd48('0x1'));var BPromise=require(_0xcd48('0x2'));var rs=require(_0xcd48('0x3'));var fs=require('fs');var Redis=require(_0xcd48('0x4'));var db=require(_0xcd48('0x5'))['db'];var utils=require(_0xcd48('0x6'));var logger=require(_0xcd48('0x7'))(_0xcd48('0x8'));var config=require(_0xcd48('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcd48('0xa')][_0xcd48('0xb')]({'port':0x232a});config['redis']=_[_0xcd48('0xc')](config[_0xcd48('0xd')],{'host':_0xcd48('0xe'),'port':0x18eb});var socket=require(_0xcd48('0xf'))(new Redis(config['redis']));require(_0xcd48('0x10'))[_0xcd48('0x11')](socket);function respondWithRpcPromise(_0x2475c1,_0x4dceec,_0x16cb33){return new BPromise(function(_0x53e362,_0x5ecba7){return client['request'](_0x2475c1,_0x16cb33)[_0xcd48('0x12')](function(_0x2f9732){logger[_0xcd48('0x13')](_0xcd48('0x14'),_0x4dceec,'request\x20sent');logger[_0xcd48('0x15')](_0xcd48('0x16'),_0x4dceec,'request\x20sent',JSON['stringify'](_0x2f9732));if(_0x2f9732[_0xcd48('0x17')]){if(_0x2f9732[_0xcd48('0x17')]['code']===0x1f4){logger[_0xcd48('0x17')]('CmList,\x20%s,\x20%s',_0x4dceec,_0x2f9732[_0xcd48('0x17')][_0xcd48('0x18')]);return _0x5ecba7(_0x2f9732[_0xcd48('0x17')]['message']);}logger[_0xcd48('0x17')](_0xcd48('0x14'),_0x4dceec,_0x2f9732['error'][_0xcd48('0x18')]);return _0x53e362(_0x2f9732[_0xcd48('0x17')][_0xcd48('0x18')]);}else{logger[_0xcd48('0x13')](_0xcd48('0x14'),_0x4dceec,_0xcd48('0x19'));_0x53e362(_0x2f9732[_0xcd48('0x1a')][_0xcd48('0x18')]);}})[_0xcd48('0x1b')](function(_0x1ffa3a){logger[_0xcd48('0x17')]('CmList,\x20%s,\x20%s',_0x4dceec,_0x1ffa3a);_0x5ecba7(_0x1ffa3a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e1cb201..a284ea2 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 _0xba63=['emit','register','cmList:','./cmList.events','save'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0xba63,0xc1));var _0x3ba6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xba63[_0x502c7d];return _0x30b7ed;};'use strict';var CmListEvents=require(_0x3ba6('0x0'));var events=[_0x3ba6('0x1'),'remove','update'];function createListener(_0x378bf0,_0x3be90c){return function(_0x32730f){_0x3be90c[_0x3ba6('0x2')](_0x378bf0,_0x32730f);};}function removeListener(_0x4ba78b,_0x5bb23c){return function(){CmListEvents['removeListener'](_0x4ba78b,_0x5bb23c);};}exports[_0x3ba6('0x3')]=function(_0x31bc61){for(var _0x107102=0x0,_0x575d65=events['length'];_0x107102<_0x575d65;_0x107102++){var _0x4e3493=events[_0x107102];var _0x119bc7=createListener(_0x3ba6('0x4')+_0x4e3493,_0x31bc61);CmListEvents['on'](_0x4e3493,_0x119bc7);}}; \ No newline at end of file +var _0xfdf4=['length','save','remove','update','removeListener','register'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xfdf4,0xfd));var _0x4fdf=function(_0x46f9fc,_0x30b951){_0x46f9fc=_0x46f9fc-0x0;var _0x4eca28=_0xfdf4[_0x46f9fc];return _0x4eca28;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x4fdf('0x0'),_0x4fdf('0x1'),_0x4fdf('0x2')];function createListener(_0x298453,_0x2ea2e7){return function(_0x1d9e07){_0x2ea2e7['emit'](_0x298453,_0x1d9e07);};}function removeListener(_0x2d672c,_0x5be478){return function(){CmListEvents[_0x4fdf('0x3')](_0x2d672c,_0x5be478);};}exports[_0x4fdf('0x4')]=function(_0x11a034){for(var _0x5f5feb=0x0,_0xf67538=events[_0x4fdf('0x5')];_0x5f5feb<_0xf67538;_0x5f5feb++){var _0x2f6ce5=events[_0x5f5feb];var _0x3bfbfc=createListener('cmList:'+_0x2f6ce5,_0x11a034);CmListEvents['on'](_0x2f6ce5,_0x3bfbfc);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index cdb216f..9979cd5 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 _0xd1a6=['index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','delete','removeDispositions','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x213aa8,_0x25a8c4){var _0x344e16=function(_0x6927d9){while(--_0x6927d9){_0x213aa8['push'](_0x213aa8['shift']());}};_0x344e16(++_0x25a8c4);}(_0xd1a6,0x176));var _0x6d1a=function(_0x546f9f,_0xcce640){_0x546f9f=_0x546f9f-0x0;var _0x3513dd=_0xd1a6[_0x546f9f];return _0x3513dd;};'use strict';var multer=require('multer');var util=require(_0x6d1a('0x0'));var path=require(_0x6d1a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d1a('0x2'));var router=express[_0x6d1a('0x3')]();var fs_extra=require(_0x6d1a('0x4'));var auth=require(_0x6d1a('0x5'));var interaction=require(_0x6d1a('0x6'));var config=require(_0x6d1a('0x7'));var controller=require(_0x6d1a('0x8'));router[_0x6d1a('0x9')]('/',auth[_0x6d1a('0xa')](),controller[_0x6d1a('0xb')]);router[_0x6d1a('0x9')](_0x6d1a('0xc'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0xd')]);router[_0x6d1a('0x9')](_0x6d1a('0xe'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0xf')]);router['get'](_0x6d1a('0x10'),auth[_0x6d1a('0xa')](),controller['show']);router[_0x6d1a('0x9')](_0x6d1a('0x11'),auth['isAuthenticated'](),controller[_0x6d1a('0x12')]);router['get'](_0x6d1a('0x13'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x14')]);router['get'](_0x6d1a('0x15'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x16')]);router['get'](_0x6d1a('0x17'),auth[_0x6d1a('0xa')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x18')]);router[_0x6d1a('0x19')]('/',auth['isAuthenticated'](),controller[_0x6d1a('0x1a')]);router[_0x6d1a('0x19')](_0x6d1a('0x11'),auth['isAuthenticated'](),controller[_0x6d1a('0x1b')]);router[_0x6d1a('0x19')](_0x6d1a('0x13'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x1c')]);router[_0x6d1a('0x19')](_0x6d1a('0x17'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x1d')]);router[_0x6d1a('0x19')](_0x6d1a('0x1e'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x1f')]);router['put']('/:id',auth[_0x6d1a('0xa')](),controller['update']);router[_0x6d1a('0x20')](_0x6d1a('0x10'),auth[_0x6d1a('0xa')](),controller['destroy']);router[_0x6d1a('0x20')]('/:id/dispositions',auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x21')]);router[_0x6d1a('0x20')](_0x6d1a('0x1e'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6d1a('0x22')]=router; \ No newline at end of file +var _0x0234=['describe','show','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','/:id/dispositions','addDisposition','addCustomField','/:id/users','addAgents','put','/:id','delete','removeDispositions','removeAgents','exports','util','path','Router','../../components/interaction/service','./cmList.controller','get','/describe','isAuthenticated'];(function(_0x18298d,_0x3fa6f7){var _0x3d1736=function(_0xa8ebe9){while(--_0xa8ebe9){_0x18298d['push'](_0x18298d['shift']());}};_0x3d1736(++_0x3fa6f7);}(_0x0234,0xfd));var _0x4023=function(_0x107132,_0x13f848){_0x107132=_0x107132-0x0;var _0xeb25b1=_0x0234[_0x107132];return _0xeb25b1;};'use strict';var multer=require('multer');var util=require(_0x4023('0x0'));var path=require(_0x4023('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4023('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4023('0x3'));var config=require('../../config/environment');var controller=require(_0x4023('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4023('0x5')](_0x4023('0x6'),auth[_0x4023('0x7')](),controller[_0x4023('0x8')]);router[_0x4023('0x5')]('/global_fields',auth[_0x4023('0x7')](),controller['getGlobalCustomFields']);router[_0x4023('0x5')]('/:id',auth[_0x4023('0x7')](),controller[_0x4023('0x9')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4023('0xa')]);router[_0x4023('0x5')](_0x4023('0xb'),auth['isAuthenticated'](),controller[_0x4023('0xc')]);router[_0x4023('0x5')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x4023('0xd')]);router[_0x4023('0x5')](_0x4023('0xe'),auth['isAuthenticated'](),controller[_0x4023('0xf')]);router['get']('/:id/users',auth[_0x4023('0x7')](),controller[_0x4023('0x10')]);router[_0x4023('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4023('0x11')](_0x4023('0x12'),auth['isAuthenticated'](),controller[_0x4023('0x13')]);router[_0x4023('0x11')](_0x4023('0xb'),auth[_0x4023('0x7')](),controller['addContacts']);router[_0x4023('0x11')](_0x4023('0xe'),auth['isAuthenticated'](),controller[_0x4023('0x14')]);router['post'](_0x4023('0x15'),auth['isAuthenticated'](),controller[_0x4023('0x16')]);router[_0x4023('0x17')](_0x4023('0x18'),auth[_0x4023('0x7')](),controller['update']);router['delete'](_0x4023('0x18'),auth[_0x4023('0x7')](),controller['destroy']);router[_0x4023('0x19')](_0x4023('0x12'),auth['isAuthenticated'](),controller[_0x4023('0x1a')]);router[_0x4023('0x19')](_0x4023('0x15'),auth[_0x4023('0x7')](),controller[_0x4023('0x1b')]);module[_0x4023('0x1c')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7fd436e..7870142 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 _0xe35c=['sequelize','exports','VIRTUAL','STRING'];(function(_0x5cca9f,_0x154684){var _0x55edda=function(_0x115aa2){while(--_0x115aa2){_0x5cca9f['push'](_0x5cca9f['shift']());}};_0x55edda(++_0x154684);}(_0xe35c,0x88));var _0xce35=function(_0x3f5c6f,_0x1ba96b){_0x3f5c6f=_0x3f5c6f-0x0;var _0x359666=_0xe35c[_0x3f5c6f];return _0x359666;};'use strict';var Sequelize=require(_0xce35('0x0'));module[_0xce35('0x1')]={'name':{'type':Sequelize[_0xce35('0x2')],'get':function(_0x420c5b){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xce35('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xce35('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x33f7=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x33f7,0xf0));var _0x733f=function(_0x38af13,_0x3949a1){_0x38af13=_0x38af13-0x0;var _0x56a221=_0x33f7[_0x38af13];return _0x56a221;};'use strict';var Sequelize=require(_0x733f('0x0'));module[_0x733f('0x1')]={'name':{'type':Sequelize[_0x733f('0x2')],'get':function(_0x54d4c3){return this[_0x733f('0x3')](_0x733f('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x733f('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 06793bd..3ade507 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(_0x2f738c,_0x3933b2){var _0x1b5263=function(_0x52738e){while(--_0x52738e){_0x2f738c['push'](_0x2f738c['shift']());}};_0x1b5263(++_0x3933b2);}(_0x7a54,0x106));var _0x47a5=function(_0x18c32c,_0x374d4d){_0x18c32c=_0x18c32c-0x0;var _0x370798=_0x7a54[_0x18c32c];return _0x370798;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x486ddd,_0x1b4def){var _0x4a9fb7=function(_0x47d8be){while(--_0x47d8be){_0x486ddd['push'](_0x486ddd['shift']());}};_0x4a9fb7(++_0x1b4def);}(_0x7a54,0x106));var _0x47a5=function(_0x57e368,_0x77d0a2){_0x57e368=_0x57e368-0x0;var _0x2a7ee7=_0x7a54[_0x57e368];return _0x2a7ee7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 600793f..0189667 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 _0x74da=['define','tools_conditions','lodash','../../config/logger','api','moment','path','rimraf','./condition.attributes','exports'];(function(_0x1d5b0e,_0x186685){var _0x397b16=function(_0x5e9d4e){while(--_0x5e9d4e){_0x1d5b0e['push'](_0x1d5b0e['shift']());}};_0x397b16(++_0x186685);}(_0x74da,0x1c4));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa74d('0x0'));var util=require('util');var logger=require(_0xa74d('0x1'))(_0xa74d('0x2'));var moment=require(_0xa74d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa74d('0x4'));var rimraf=require(_0xa74d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa74d('0x6'));module[_0xa74d('0x7')]=function(_0x1a7116,_0x5118ca){return _0x1a7116[_0xa74d('0x8')]('Condition',attributes,{'tableName':_0xa74d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc020=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util'];(function(_0x1046ba,_0x17699d){var _0x31ae08=function(_0x4c737d){while(--_0x4c737d){_0x1046ba['push'](_0x1046ba['shift']());}};_0x31ae08(++_0x17699d);}(_0xc020,0x6a));var _0x0c02=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0xc020[_0x4706a6];return _0x1bb705;};'use strict';var _=require(_0x0c02('0x0'));var util=require(_0x0c02('0x1'));var logger=require(_0x0c02('0x2'))(_0x0c02('0x3'));var moment=require(_0x0c02('0x4'));var BPromise=require(_0x0c02('0x5'));var rp=require(_0x0c02('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0c02('0x7'));var attributes=require(_0x0c02('0x8'));module[_0x0c02('0x9')]=function(_0x448745,_0x2c1462){return _0x448745[_0x0c02('0xa')]('Condition',attributes,{'tableName':_0x0c02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index ce4dfb3..23ffa01 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 _0x8f0c=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x8f0c,0x199));var _0xc8f0=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x8f0c[_0x4aba15];return _0x1c8122;};'use strict';var _=require(_0xc8f0('0x0'));var util=require(_0xc8f0('0x1'));var moment=require(_0xc8f0('0x2'));var BPromise=require(_0xc8f0('0x3'));var rs=require(_0xc8f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8f0('0x5'))['db'];var utils=require(_0xc8f0('0x6'));var logger=require(_0xc8f0('0x7'))(_0xc8f0('0x8'));var config=require(_0xc8f0('0x9'));var jayson=require(_0xc8f0('0xa'));var client=jayson['client'][_0xc8f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x566b74,_0x2ffe1,_0x3ccf36){return new BPromise(function(_0x532a9a,_0x5501c3){return client[_0xc8f0('0xc')](_0x566b74,_0x3ccf36)[_0xc8f0('0xd')](function(_0x349617){logger[_0xc8f0('0xe')](_0xc8f0('0xf'),_0x2ffe1,_0xc8f0('0x10'));logger[_0xc8f0('0x11')](_0xc8f0('0x12'),_0x2ffe1,_0xc8f0('0x10'),JSON['stringify'](_0x349617));if(_0x349617['error']){if(_0x349617[_0xc8f0('0x13')][_0xc8f0('0x14')]===0x1f4){logger[_0xc8f0('0x13')](_0xc8f0('0xf'),_0x2ffe1,_0x349617[_0xc8f0('0x13')]['message']);return _0x5501c3(_0x349617[_0xc8f0('0x13')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x2ffe1,_0x349617[_0xc8f0('0x13')][_0xc8f0('0x15')]);return _0x532a9a(_0x349617[_0xc8f0('0x13')][_0xc8f0('0x15')]);}else{logger[_0xc8f0('0xe')](_0xc8f0('0xf'),_0x2ffe1,_0xc8f0('0x10'));_0x532a9a(_0x349617[_0xc8f0('0x16')]['message']);}})[_0xc8f0('0x17')](function(_0x4cae0f){logger[_0xc8f0('0x13')]('Condition,\x20%s,\x20%s',_0x2ffe1,_0x4cae0f);_0x5501c3(_0x4cae0f);});});} \ No newline at end of file +var _0xeafd=['jayson/promise','client','http','info','request\x20sent','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x57e34d,_0x5b70d4){var _0x28fe41=function(_0x367f3d){while(--_0x367f3d){_0x57e34d['push'](_0x57e34d['shift']());}};_0x28fe41(++_0x5b70d4);}(_0xeafd,0x97));var _0xdeaf=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xeafd[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xdeaf('0x0'));var util=require(_0xdeaf('0x1'));var moment=require(_0xdeaf('0x2'));var BPromise=require('bluebird');var rs=require(_0xdeaf('0x3'));var fs=require('fs');var Redis=require(_0xdeaf('0x4'));var db=require(_0xdeaf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeaf('0x6'))(_0xdeaf('0x7'));var config=require(_0xdeaf('0x8'));var jayson=require(_0xdeaf('0x9'));var client=jayson[_0xdeaf('0xa')][_0xdeaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535ddf,_0x577200,_0x342dac){return new BPromise(function(_0xa77457,_0x5c52fa){return client['request'](_0x535ddf,_0x342dac)['then'](function(_0x1301d7){logger[_0xdeaf('0xc')]('Condition,\x20%s,\x20%s',_0x577200,_0xdeaf('0xd'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x577200,_0xdeaf('0xd'),JSON['stringify'](_0x1301d7));if(_0x1301d7[_0xdeaf('0xe')]){if(_0x1301d7['error'][_0xdeaf('0xf')]===0x1f4){logger[_0xdeaf('0xe')]('Condition,\x20%s,\x20%s',_0x577200,_0x1301d7[_0xdeaf('0xe')]['message']);return _0x5c52fa(_0x1301d7[_0xdeaf('0xe')][_0xdeaf('0x10')]);}logger[_0xdeaf('0xe')](_0xdeaf('0x11'),_0x577200,_0x1301d7[_0xdeaf('0xe')][_0xdeaf('0x10')]);return _0xa77457(_0x1301d7[_0xdeaf('0xe')][_0xdeaf('0x10')]);}else{logger[_0xdeaf('0xc')](_0xdeaf('0x11'),_0x577200,'request\x20sent');_0xa77457(_0x1301d7[_0xdeaf('0x12')]['message']);}})[_0xdeaf('0x13')](function(_0x5e03ac){logger[_0xdeaf('0xe')](_0xdeaf('0x11'),_0x577200,_0x5e03ac);_0x5c52fa(_0x5e03ac);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index cda79be..1b62c3a 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 _0x6b1d=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x6b1d,0x16b));var _0xd6b1=function(_0x3bcb7c,_0x5af870){_0x3bcb7c=_0x3bcb7c-0x0;var _0x584411=_0x6b1d[_0x3bcb7c];return _0x584411;};'use strict';var multer=require(_0xd6b1('0x0'));var util=require(_0xd6b1('0x1'));var path=require('path');var timeout=require(_0xd6b1('0x2'));var express=require(_0xd6b1('0x3'));var router=express[_0xd6b1('0x4')]();var fs_extra=require(_0xd6b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6b1('0x6'));var config=require('../../config/environment');var controller=require(_0xd6b1('0x7'));router['put'](_0xd6b1('0x8'),auth[_0xd6b1('0x9')](),controller[_0xd6b1('0xa')]);router[_0xd6b1('0xb')](_0xd6b1('0x8'),auth[_0xd6b1('0x9')](),controller[_0xd6b1('0xc')]);module[_0xd6b1('0xd')]=router; \ No newline at end of file +var _0x76a3=['./condition.controller','put','/:id','update','isAuthenticated','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x76a3,0x149));var _0x376a=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0x76a3[_0x55ef8b];return _0x359c84;};'use strict';var multer=require('multer');var util=require(_0x376a('0x0'));var path=require(_0x376a('0x1'));var timeout=require(_0x376a('0x2'));var express=require('express');var router=express[_0x376a('0x3')]();var fs_extra=require(_0x376a('0x4'));var auth=require(_0x376a('0x5'));var interaction=require(_0x376a('0x6'));var config=require('../../config/environment');var controller=require(_0x376a('0x7'));router[_0x376a('0x8')](_0x376a('0x9'),auth['isAuthenticated'](),controller[_0x376a('0xa')]);router['delete'](_0x376a('0x9'),auth[_0x376a('0xb')](),controller[_0x376a('0xc')]);module[_0x376a('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 993e886..b42b6ce 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4af4=['sequelize','exports','STRING','name','INTEGER'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4af4,0xb9));var _0x44af=function(_0x1ff60d,_0x5a661c){_0x1ff60d=_0x1ff60d-0x0;var _0x1cb108=_0x4af4[_0x1ff60d];return _0x1cb108;};'use strict';var Sequelize=require(_0x44af('0x0'));module[_0x44af('0x1')]={'name':{'type':Sequelize[_0x44af('0x2')],'allowNull':![],'unique':_0x44af('0x3')},'OrderBy':{'type':Sequelize[_0x44af('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x44af('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf661=['exports','STRING','name','INTEGER','sequelize'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xf661,0x90));var _0x1f66=function(_0x1ea0fe,_0xfc38e8){_0x1ea0fe=_0x1ea0fe-0x0;var _0x9bfecd=_0xf661[_0x1ea0fe];return _0x9bfecd;};'use strict';var Sequelize=require(_0x1f66('0x0'));module[_0x1f66('0x1')]={'name':{'type':Sequelize[_0x1f66('0x2')],'allowNull':![],'unique':_0x1f66('0x3')},'OrderBy':{'type':Sequelize[_0x1f66('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x1f66('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1100ee3..1b2f6f5 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63a5=['end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x63a5,0x18e));var _0x563a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x63a5[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['ContactItemType'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](db[_0x563a('0x54')][_0x563a('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x22cc91[_0x563a('0x47')]['id']}}))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));}; \ No newline at end of file +var _0x3266=['options','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','get','error','stack','name','send','index','ContactItemType','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x36afd7,_0x1181dc){var _0x2e0da0=function(_0x2254e1){while(--_0x2254e1){_0x36afd7['push'](_0x36afd7['shift']());}};_0x2e0da0(++_0x1181dc);}(_0x3266,0x6a));var _0x6326=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x3266[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){var _0x72d020=_0x2d0d00[_0x6326('0x27')]({'plain':!![]});var _0x575701='ContactItemTypes';return db['UserProfileResource'][_0x6326('0x26')]({'where':{'type':_0x575701,'resourceId':_0x72d020['id']}})['then'](function(){return _0x2d0d00;});})[_0x6326('0x25')](function(){_0x429bb0[_0x6326('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e33d,_0x21ec69){return function(_0xb68fec){if(!_0xb68fec){_0x15e33d[_0x6326('0x1c')](0x194);}return _0xb68fec;};}function handleError(_0x2d2180,_0x45d037){_0x45d037=_0x45d037||0x1f4;return function(_0x40e036){logger[_0x6326('0x28')](_0x40e036[_0x6326('0x29')]);if(_0x40e036[_0x6326('0x2a')]){delete _0x40e036[_0x6326('0x2a')];}_0x2d2180[_0x6326('0x1d')](_0x45d037)[_0x6326('0x2b')](_0x40e036);};}exports[_0x6326('0x2c')]=function(_0x2e0445,_0x20c5ab){var _0x520e57={},_0x2bf5ef={},_0x47303c={'count':0x0,'rows':[]};var _0x1f8982=_['map'](db[_0x6326('0x2d')]['rawAttributes'],function(_0x4e703a){return{'name':_0x4e703a[_0x6326('0x2e')],'type':_0x4e703a[_0x6326('0x2f')][_0x6326('0x30')]};});_0x2bf5ef[_0x6326('0x31')]=_[_0x6326('0x32')](_0x1f8982,_0x6326('0x2a'));_0x2bf5ef[_0x6326('0x33')]=_[_0x6326('0x34')](_0x2e0445[_0x6326('0x33')]);_0x2bf5ef[_0x6326('0x35')]=_[_0x6326('0x36')](_0x2bf5ef[_0x6326('0x31')],_0x2bf5ef['query']);_0x520e57[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2bf5ef['model'],qs[_0x6326('0x38')](_0x2e0445[_0x6326('0x33')][_0x6326('0x38')]));_0x520e57['attributes']=_0x520e57[_0x6326('0x37')]['length']?_0x520e57['attributes']:_0x2bf5ef[_0x6326('0x31')];if(!_0x2e0445[_0x6326('0x33')][_0x6326('0x39')]('nolimit')){_0x520e57[_0x6326('0x3a')]=qs['limit'](_0x2e0445[_0x6326('0x33')]['limit']);_0x520e57[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x2e0445[_0x6326('0x33')][_0x6326('0x1f')]);}_0x520e57[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x2e0445['query'][_0x6326('0x3c')]);_0x520e57[_0x6326('0x3d')]=qs['filters'](_[_0x6326('0x3e')](_0x2e0445['query'],_0x2bf5ef['filters']),_0x1f8982);if(_0x2e0445[_0x6326('0x33')][_0x6326('0x3f')]){_0x520e57[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x520e57[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x1f8982,function(_0x5de1c3){if(_0x5de1c3['type']!==_0x6326('0x41')){var _0x5b68af={};_0x5b68af[_0x5de1c3[_0x6326('0x2a')]]={'$like':'%'+_0x2e0445['query'][_0x6326('0x3f')]+'%'};return _0x5b68af;}})});}_0x520e57=_[_0x6326('0x40')]({},_0x520e57,_0x2e0445[_0x6326('0x42')]);var _0x1da798={'where':_0x520e57[_0x6326('0x3d')]};return db[_0x6326('0x2d')][_0x6326('0x20')](_0x1da798)[_0x6326('0x25')](function(_0x3b089b){_0x47303c[_0x6326('0x20')]=_0x3b089b;if(_0x2e0445[_0x6326('0x33')]['includeAll']){_0x520e57[_0x6326('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0x6326('0x44')](_0x520e57);})[_0x6326('0x25')](function(_0x16fc33){_0x47303c[_0x6326('0x45')]=_0x16fc33;return _0x47303c;})['then'](respondWithFilteredResult(_0x20c5ab,_0x520e57))[_0x6326('0x46')](handleError(_0x20c5ab,null));};exports[_0x6326('0x47')]=function(_0x562d5f,_0x12703d){var _0xe6a992={'raw':!![],'where':{'id':_0x562d5f[_0x6326('0x48')]['id']}},_0x7a5057={};_0x7a5057['model']=_[_0x6326('0x34')](db[_0x6326('0x2d')][_0x6326('0x49')]);_0x7a5057[_0x6326('0x33')]=_[_0x6326('0x34')](_0x562d5f[_0x6326('0x33')]);_0x7a5057[_0x6326('0x35')]=_['intersection'](_0x7a5057[_0x6326('0x31')],_0x7a5057[_0x6326('0x33')]);_0xe6a992[_0x6326('0x37')]=_[_0x6326('0x36')](_0x7a5057['model'],qs[_0x6326('0x38')](_0x562d5f['query'][_0x6326('0x38')]));_0xe6a992[_0x6326('0x37')]=_0xe6a992[_0x6326('0x37')][_0x6326('0x4a')]?_0xe6a992[_0x6326('0x37')]:_0x7a5057['model'];if(_0x562d5f[_0x6326('0x33')]['includeAll']){_0xe6a992['include']=[{'all':!![]}];}_0xe6a992=_[_0x6326('0x40')]({},_0xe6a992,_0x562d5f[_0x6326('0x42')]);return db['ContactItemType'][_0x6326('0x4b')](_0xe6a992)[_0x6326('0x25')](handleEntityNotFound(_0x12703d,null))[_0x6326('0x25')](respondWithResult(_0x12703d,null))[_0x6326('0x46')](handleError(_0x12703d,null));};exports[_0x6326('0x4c')]=function(_0x4f8dc0,_0x4af0ee){return db[_0x6326('0x2d')][_0x6326('0x4c')](_0x4f8dc0[_0x6326('0x4d')],{})[_0x6326('0x25')](function(_0x210a1b){var _0x318d19=_0x4f8dc0[_0x6326('0x4e')]['get']({'plain':!![]});if(!_0x318d19)throw new Error(_0x6326('0x4f'));if(_0x318d19[_0x6326('0x50')]===_0x6326('0x4e')){var _0x3e7674=_0x210a1b[_0x6326('0x27')]({'plain':!![]});var _0x4ff8e6=_0x6326('0x51');return db['UserProfileSection'][_0x6326('0x4b')]({'where':{'name':_0x4ff8e6,'userProfileId':_0x318d19[_0x6326('0x52')]},'raw':!![]})['then'](function(_0x37b045){if(_0x37b045&&_0x37b045['autoAssociation']===0x0){return db[_0x6326('0x53')][_0x6326('0x4c')]({'name':_0x3e7674[_0x6326('0x2a')],'resourceId':_0x3e7674['id'],'type':_0x37b045[_0x6326('0x2a')],'sectionId':_0x37b045['id']},{})['then'](function(){return _0x210a1b;});}else{return _0x210a1b;}})[_0x6326('0x46')](function(_0xbe6b3e){logger['error'](_0x6326('0x54'),_0xbe6b3e);throw _0xbe6b3e;});}return _0x210a1b;})[_0x6326('0x25')](respondWithResult(_0x4af0ee,0xc9))[_0x6326('0x46')](handleError(_0x4af0ee,null));};exports['update']=function(_0x2bece1,_0x2ac64b){if(_0x2bece1['body']['id']){delete _0x2bece1[_0x6326('0x4d')]['id'];}return db['ContactItemType'][_0x6326('0x4b')]({'where':{'id':_0x2bece1[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x2ac64b,null))[_0x6326('0x25')](saveUpdates(_0x2bece1[_0x6326('0x4d')],null))[_0x6326('0x25')](respondWithResult(_0x2ac64b,null))[_0x6326('0x46')](handleError(_0x2ac64b,null));};exports['destroy']=function(_0x51adce,_0x4d4de7){return db[_0x6326('0x2d')]['find']({'where':{'id':_0x51adce[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4d4de7,null))[_0x6326('0x25')](db[_0x6326('0x55')][_0x6326('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x51adce['params']['id']}}))[_0x6326('0x25')](removeEntity(_0x4d4de7,null))[_0x6326('0x46')](handleError(_0x4d4de7,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index ae75119..388a071 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf23c=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','lodash'];(function(_0x4c34de,_0x2deaaa){var _0x258bfb=function(_0x331445){while(--_0x331445){_0x4c34de['push'](_0x4c34de['shift']());}};_0x258bfb(++_0x2deaaa);}(_0xf23c,0xef));var _0xcf23=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xf23c[_0xd22d95];return _0x15d7a3;};'use strict';var _=require(_0xcf23('0x0'));var util=require(_0xcf23('0x1'));var logger=require(_0xcf23('0x2'))(_0xcf23('0x3'));var moment=require(_0xcf23('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf23('0x5'));var rimraf=require(_0xcf23('0x6'));var config=require(_0xcf23('0x7'));var attributes=require(_0xcf23('0x8'));module['exports']=function(_0x2447ca,_0x103388){return _0x2447ca['define'](_0xcf23('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fea=['path','rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6fea,0xdf));var _0xa6fe=function(_0x1e8dd5,_0x571f6d){_0x1e8dd5=_0x1e8dd5-0x0;var _0x9aa844=_0x6fea[_0x1e8dd5];return _0x9aa844;};'use strict';var _=require(_0xa6fe('0x0'));var util=require(_0xa6fe('0x1'));var logger=require(_0xa6fe('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa6fe('0x3'));var rp=require(_0xa6fe('0x4'));var fs=require('fs');var path=require(_0xa6fe('0x5'));var rimraf=require(_0xa6fe('0x6'));var config=require(_0xa6fe('0x7'));var attributes=require('./contactItemType.attributes');module[_0xa6fe('0x8')]=function(_0x41be76,_0x5ac01b){return _0x41be76[_0xa6fe('0x9')](_0xa6fe('0xa'),attributes,{'tableName':_0xa6fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 660a1b3..3a4191b 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bec=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0x4bec,0xdc));var _0xc4be=function(_0xb792f9,_0x332d93){_0xb792f9=_0xb792f9-0x0;var _0x51b025=_0x4bec[_0xb792f9];return _0x51b025;};'use strict';var _=require(_0xc4be('0x0'));var util=require(_0xc4be('0x1'));var moment=require('moment');var BPromise=require(_0xc4be('0x2'));var rs=require(_0xc4be('0x3'));var fs=require('fs');var Redis=require(_0xc4be('0x4'));var db=require(_0xc4be('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4be('0x6'))(_0xc4be('0x7'));var config=require(_0xc4be('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc4be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x429177,_0x53a290,_0x26e86d){return new BPromise(function(_0x294e6c,_0x244d25){return client[_0xc4be('0xa')](_0x429177,_0x26e86d)['then'](function(_0x350ca4){logger[_0xc4be('0xb')](_0xc4be('0xc'),_0x53a290,_0xc4be('0xd'));logger['debug'](_0xc4be('0xe'),_0x53a290,_0xc4be('0xd'),JSON[_0xc4be('0xf')](_0x350ca4));if(_0x350ca4['error']){if(_0x350ca4[_0xc4be('0x10')][_0xc4be('0x11')]===0x1f4){logger[_0xc4be('0x10')](_0xc4be('0xc'),_0x53a290,_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);return _0x244d25(_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x53a290,_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);return _0x294e6c(_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);}else{logger[_0xc4be('0xb')](_0xc4be('0xc'),_0x53a290,'request\x20sent');_0x294e6c(_0x350ca4[_0xc4be('0x13')][_0xc4be('0x12')]);}})[_0xc4be('0x14')](function(_0x1fec0f){logger[_0xc4be('0x10')]('ContactItemType,\x20%s,\x20%s',_0x53a290,_0x1fec0f);_0x244d25(_0x1fec0f);});});} \ No newline at end of file +var _0xb2a6=['rpc','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x45ab4a,_0x40a506){var _0x31a7fa=function(_0xcd11ae){while(--_0xcd11ae){_0x45ab4a['push'](_0x45ab4a['shift']());}};_0x31a7fa(++_0x40a506);}(_0xb2a6,0xf0));var _0x6b2a=function(_0x1e84a9,_0x28286b){_0x1e84a9=_0x1e84a9-0x0;var _0x4bc80c=_0xb2a6[_0x1e84a9];return _0x4bc80c;};'use strict';var _=require(_0x6b2a('0x0'));var util=require(_0x6b2a('0x1'));var moment=require('moment');var BPromise=require(_0x6b2a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b2a('0x3'));var db=require(_0x6b2a('0x4'))['db'];var utils=require(_0x6b2a('0x5'));var logger=require(_0x6b2a('0x6'))(_0x6b2a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6b2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54b0ce,_0x209ab4,_0x2663f2){return new BPromise(function(_0x3ec52a,_0x1c8fa6){return client[_0x6b2a('0x9')](_0x54b0ce,_0x2663f2)[_0x6b2a('0xa')](function(_0x4b145f){logger[_0x6b2a('0xb')](_0x6b2a('0xc'),_0x209ab4,_0x6b2a('0xd'));logger[_0x6b2a('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x209ab4,_0x6b2a('0xd'),JSON[_0x6b2a('0xf')](_0x4b145f));if(_0x4b145f[_0x6b2a('0x10')]){if(_0x4b145f[_0x6b2a('0x10')]['code']===0x1f4){logger[_0x6b2a('0x10')](_0x6b2a('0xc'),_0x209ab4,_0x4b145f['error'][_0x6b2a('0x11')]);return _0x1c8fa6(_0x4b145f[_0x6b2a('0x10')][_0x6b2a('0x11')]);}logger[_0x6b2a('0x10')](_0x6b2a('0xc'),_0x209ab4,_0x4b145f[_0x6b2a('0x10')][_0x6b2a('0x11')]);return _0x3ec52a(_0x4b145f['error'][_0x6b2a('0x11')]);}else{logger[_0x6b2a('0xb')](_0x6b2a('0xc'),_0x209ab4,_0x6b2a('0xd'));_0x3ec52a(_0x4b145f[_0x6b2a('0x12')]['message']);}})['catch'](function(_0x101bd5){logger[_0x6b2a('0x10')](_0x6b2a('0xc'),_0x209ab4,_0x101bd5);_0x1c8fa6(_0x101bd5);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index e4c98f5..5cd5fcb 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d23=['isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x5d4a02,_0x354e94){var _0x3adf97=function(_0x3cb8a7){while(--_0x3cb8a7){_0x5d4a02['push'](_0x5d4a02['shift']());}};_0x3adf97(++_0x354e94);}(_0x7d23,0x74));var _0x37d2=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x7d23[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x37d2('0x0'));var util=require(_0x37d2('0x1'));var path=require(_0x37d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x37d2('0x3'));var router=express[_0x37d2('0x4')]();var fs_extra=require(_0x37d2('0x5'));var auth=require(_0x37d2('0x6'));var interaction=require(_0x37d2('0x7'));var config=require(_0x37d2('0x8'));var controller=require(_0x37d2('0x9'));router['get']('/',auth[_0x37d2('0xa')](),controller[_0x37d2('0xb')]);router['get'](_0x37d2('0xc'),auth[_0x37d2('0xa')](),controller[_0x37d2('0xd')]);router[_0x37d2('0xe')]('/',auth[_0x37d2('0xa')](),controller[_0x37d2('0xf')]);router['put'](_0x37d2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x37d2('0x10')]('/:id',auth[_0x37d2('0xa')](),controller[_0x37d2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2fed=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','update','delete','/:id','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fed,0xbe));var _0xd2fe=function(_0x192126,_0x2e7b8f){_0x192126=_0x192126-0x0;var _0x1052a8=_0x2fed[_0x192126];return _0x1052a8;};'use strict';var multer=require(_0xd2fe('0x0'));var util=require('util');var path=require(_0xd2fe('0x1'));var timeout=require(_0xd2fe('0x2'));var express=require('express');var router=express[_0xd2fe('0x3')]();var fs_extra=require(_0xd2fe('0x4'));var auth=require(_0xd2fe('0x5'));var interaction=require(_0xd2fe('0x6'));var config=require(_0xd2fe('0x7'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x9')]);router[_0xd2fe('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd2fe('0xb')]);router['post']('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xc')]);router[_0xd2fe('0xd')]('/:id',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xe')]);router[_0xd2fe('0xf')](_0xd2fe('0x10'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x11')]);module[_0xd2fe('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f8cea37..7dbcef2 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 8d87397..6a65448 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 _0x1b12=['attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','then','error','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','userProfileId','autoAssociation','iframe','attrUrl','attrs','value','https://','custom'];(function(_0x1eb7bd,_0x2e23e0){var _0x3068e1=function(_0x9eb2c3){while(--_0x9eb2c3){_0x1eb7bd['push'](_0x1eb7bd['shift']());}};_0x3068e1(++_0x2e23e0);}(_0x1b12,0xa3));var _0x21b1=function(_0x25113d,_0x1f3509){_0x25113d=_0x25113d-0x0;var _0x48fd45=_0x1b12[_0x25113d];return _0x48fd45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21b1('0x1'));var rp=require(_0x21b1('0x2'));var moment=require(_0x21b1('0x3'));var BPromise=require(_0x21b1('0x4'));var Mustache=require('mustache');var util=require(_0x21b1('0x5'));var path=require(_0x21b1('0x6'));var sox=require(_0x21b1('0x7'));var csv=require(_0x21b1('0x8'));var ejs=require(_0x21b1('0x9'));var fs=require('fs');var fs_extra=require(_0x21b1('0xa'));var _=require(_0x21b1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21b1('0xc'));var deskjs=require(_0x21b1('0xd'));var toCsv=require(_0x21b1('0x8'));var querystring=require(_0x21b1('0xe'));var Papa=require(_0x21b1('0xf'));var Redis=require(_0x21b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x21b1('0x11'));var as=require(_0x21b1('0x12'));var hardwareService=require(_0x21b1('0x13'));var logger=require('../../config/logger')(_0x21b1('0x14'));var utils=require(_0x21b1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x21b1('0x16'));var db=require('../../mysqldb')['db'];config[_0x21b1('0x17')]=_[_0x21b1('0x18')](config[_0x21b1('0x17')],{'host':_0x21b1('0x19'),'port':0x18eb});var socket=require(_0x21b1('0x1a'))(new Redis(config[_0x21b1('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x42a600,_0x2dd43d){_0x2dd43d=_0x2dd43d||0xcc;return function(_0x4b7036){if(_0x4b7036){return _0x42a600[_0x21b1('0x1b')](_0x2dd43d);}return _0x42a600[_0x21b1('0x1c')](_0x2dd43d)[_0x21b1('0x1d')]();};}function respondWithResult(_0x4c50c4,_0x51e919){_0x51e919=_0x51e919||0xc8;return function(_0x398d40){if(_0x398d40){return _0x4c50c4[_0x21b1('0x1c')](_0x51e919)[_0x21b1('0x1e')](_0x398d40);}};}function respondWithFilteredResult(_0x25b612,_0x49d90c){return function(_0x2891d4){if(_0x2891d4){var _0x3a658e=typeof _0x49d90c[_0x21b1('0x1f')]===_0x21b1('0x20')&&typeof _0x49d90c[_0x21b1('0x21')]===_0x21b1('0x20');var _0x42cb4a=_0x2891d4['count'];var _0x31d0fc=_0x3a658e?0x0:_0x49d90c[_0x21b1('0x1f')];var _0x342fc8=_0x3a658e?_0x2891d4[_0x21b1('0x22')]:_0x49d90c[_0x21b1('0x1f')]+_0x49d90c[_0x21b1('0x21')];var _0x347e05;if(_0x342fc8>=_0x42cb4a){_0x342fc8=_0x42cb4a;_0x347e05=0xc8;}else{_0x347e05=0xce;}_0x25b612['status'](_0x347e05);return _0x25b612[_0x21b1('0x23')](_0x21b1('0x24'),_0x31d0fc+'-'+_0x342fc8+'/'+_0x42cb4a)['json'](_0x2891d4);}return null;};}function patchUpdates(_0x4bdad1){return function(_0x6d7959){try{jsonpatch[_0x21b1('0x25')](_0x6d7959,_0x4bdad1,!![]);}catch(_0x466eb9){return BPromise[_0x21b1('0x26')](_0x466eb9);}return _0x6d7959[_0x21b1('0x27')]();};}function saveUpdates(_0x5c4156,_0x1bf7d6){return function(_0x577f71){if(_0x577f71){return _0x577f71[_0x21b1('0x28')](_0x5c4156)['then'](function(_0x5578aa){return _0x5578aa;});}return null;};}function removeEntity(_0x2dbfdd,_0x2b2aeb){return function(_0xd497f1){if(_0xd497f1){return _0xd497f1[_0x21b1('0x29')]()['then'](function(){var _0x49df07=_0xd497f1[_0x21b1('0x2a')]({'plain':!![]});var _0x5cddb2='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x5cddb2,'resourceId':_0x49df07['id']}})[_0x21b1('0x2b')](function(){return _0xd497f1;});})[_0x21b1('0x2b')](function(){_0x2dbfdd[_0x21b1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5c28,_0x1c16b5){return function(_0x4cd122){if(!_0x4cd122){_0x3a5c28['sendStatus'](0x194);}return _0x4cd122;};}function handleError(_0xdaa036,_0x515b97){_0x515b97=_0x515b97||0x1f4;return function(_0xb7b6d3){logger[_0x21b1('0x2c')](_0xb7b6d3['stack']);if(_0xb7b6d3['name']){delete _0xb7b6d3[_0x21b1('0x2d')];}_0xdaa036[_0x21b1('0x1c')](_0x515b97)[_0x21b1('0x2e')](_0xb7b6d3);};}exports[_0x21b1('0x2f')]=function(_0x2d3f9b,_0x242d68){var _0x110d48={},_0x1074f8={},_0x3f8014={'count':0x0,'rows':[]};var _0x41563e=_[_0x21b1('0x30')](db[_0x21b1('0x31')]['rawAttributes'],function(_0x32b985){return{'name':_0x32b985[_0x21b1('0x32')],'type':_0x32b985[_0x21b1('0x33')][_0x21b1('0x34')]};});_0x1074f8[_0x21b1('0x35')]=_['map'](_0x41563e,_0x21b1('0x2d'));_0x1074f8[_0x21b1('0x36')]=_[_0x21b1('0x37')](_0x2d3f9b[_0x21b1('0x36')]);_0x1074f8[_0x21b1('0x38')]=_[_0x21b1('0x39')](_0x1074f8['model'],_0x1074f8[_0x21b1('0x36')]);_0x110d48['attributes']=_[_0x21b1('0x39')](_0x1074f8[_0x21b1('0x35')],qs[_0x21b1('0x3a')](_0x2d3f9b[_0x21b1('0x36')]['fields']));_0x110d48[_0x21b1('0x3b')]=_0x110d48[_0x21b1('0x3b')][_0x21b1('0x3c')]?_0x110d48[_0x21b1('0x3b')]:_0x1074f8[_0x21b1('0x35')];if(!_0x2d3f9b['query']['hasOwnProperty'](_0x21b1('0x3d'))){_0x110d48['limit']=qs[_0x21b1('0x21')](_0x2d3f9b[_0x21b1('0x36')][_0x21b1('0x21')]);_0x110d48[_0x21b1('0x1f')]=qs[_0x21b1('0x1f')](_0x2d3f9b[_0x21b1('0x36')][_0x21b1('0x1f')]);}_0x110d48[_0x21b1('0x3e')]=qs[_0x21b1('0x3f')](_0x2d3f9b[_0x21b1('0x36')]['sort']);_0x110d48[_0x21b1('0x40')]=qs[_0x21b1('0x38')](_[_0x21b1('0x41')](_0x2d3f9b[_0x21b1('0x36')],_0x1074f8['filters']),_0x41563e);if(_0x2d3f9b['query'][_0x21b1('0x42')]){_0x110d48['where']=_[_0x21b1('0x43')](_0x110d48[_0x21b1('0x40')],{'$or':_[_0x21b1('0x30')](_0x41563e,function(_0xac77f5){if(_0xac77f5['type']!==_0x21b1('0x44')){var _0x2e7946={};_0x2e7946[_0xac77f5['name']]={'$like':'%'+_0x2d3f9b[_0x21b1('0x36')]['filter']+'%'};return _0x2e7946;}})});}_0x110d48=_['merge']({},_0x110d48,_0x2d3f9b[_0x21b1('0x45')]);var _0x5af826={'where':_0x110d48['where']};return db[_0x21b1('0x31')][_0x21b1('0x22')](_0x5af826)[_0x21b1('0x2b')](function(_0x41143e){_0x3f8014[_0x21b1('0x22')]=_0x41143e;if(_0x2d3f9b[_0x21b1('0x36')][_0x21b1('0x46')]){_0x110d48[_0x21b1('0x47')]=[{'all':!![]}];}return db[_0x21b1('0x31')][_0x21b1('0x48')](_0x110d48);})[_0x21b1('0x2b')](function(_0x5a0771){_0x3f8014[_0x21b1('0x49')]=_0x5a0771;return _0x3f8014;})[_0x21b1('0x2b')](respondWithFilteredResult(_0x242d68,_0x110d48))[_0x21b1('0x4a')](handleError(_0x242d68,null));};exports['show']=function(_0x23e5ae,_0x5d69eb){var _0x3868d4={'raw':![],'where':{'id':_0x23e5ae[_0x21b1('0x4b')]['id']}},_0x3559a8={};_0x3559a8[_0x21b1('0x35')]=_[_0x21b1('0x37')](db[_0x21b1('0x31')][_0x21b1('0x4c')]);_0x3559a8[_0x21b1('0x36')]=_[_0x21b1('0x37')](_0x23e5ae['query']);_0x3559a8['filters']=_[_0x21b1('0x39')](_0x3559a8['model'],_0x3559a8[_0x21b1('0x36')]);_0x3868d4['attributes']=_[_0x21b1('0x39')](_0x3559a8['model'],qs['fields'](_0x23e5ae[_0x21b1('0x36')][_0x21b1('0x3a')]));_0x3868d4['attributes']=_0x3868d4[_0x21b1('0x3b')][_0x21b1('0x3c')]?_0x3868d4['attributes']:_0x3559a8[_0x21b1('0x35')];if(_0x23e5ae[_0x21b1('0x36')][_0x21b1('0x46')]){_0x3868d4['include']=[{'all':!![]}];}_0x3868d4=_['merge']({},_0x3868d4,_0x23e5ae[_0x21b1('0x45')]);return db[_0x21b1('0x31')][_0x21b1('0x4d')](_0x3868d4)['then'](handleEntityNotFound(_0x5d69eb,null))['then'](respondWithResult(_0x5d69eb,null))[_0x21b1('0x4a')](handleError(_0x5d69eb,null));};exports[_0x21b1('0x4e')]=function(_0x43a9d7,_0x3702d2){return db[_0x21b1('0x31')][_0x21b1('0x4e')](_0x43a9d7[_0x21b1('0x4f')],{})[_0x21b1('0x2b')](function(_0x23c2e2){var _0x36856e=_0x43a9d7[_0x21b1('0x50')][_0x21b1('0x2a')]({'plain':!![]});if(!_0x36856e)throw new Error(_0x21b1('0x51'));if(_0x36856e[_0x21b1('0x52')]===_0x21b1('0x50')){var _0x2da509=_0x23c2e2[_0x21b1('0x2a')]({'plain':!![]});var _0x5083b4=_0x21b1('0x53');return db['UserProfileSection'][_0x21b1('0x4d')]({'where':{'name':_0x5083b4,'userProfileId':_0x36856e['userProfileId']},'raw':!![]})[_0x21b1('0x2b')](function(_0x3f7a6f){if(_0x3f7a6f&&_0x3f7a6f['autoAssociation']===0x0){return db[_0x21b1('0x54')][_0x21b1('0x4e')]({'name':_0x2da509['name'],'resourceId':_0x2da509['id'],'type':_0x3f7a6f['name'],'sectionId':_0x3f7a6f['id']},{})[_0x21b1('0x2b')](function(){return _0x23c2e2;});}else{return _0x23c2e2;}})[_0x21b1('0x4a')](function(_0x7ba88d){logger[_0x21b1('0x2c')](_0x21b1('0x55'),_0x7ba88d);throw _0x7ba88d;});}return _0x23c2e2;})[_0x21b1('0x2b')](respondWithResult(_0x3702d2,0xc9))[_0x21b1('0x4a')](handleError(_0x3702d2,null));};exports[_0x21b1('0x56')]=function(_0x180291,_0x397b57){var _0x2db53a={'where':{'id':_0x180291[_0x21b1('0x4b')]['id']}},_0x1b8a88={};_0x1b8a88['model']=_['keys'](db[_0x21b1('0x31')][_0x21b1('0x4c')]);_0x2db53a[_0x21b1('0x3b')]=_[_0x21b1('0x39')](_0x1b8a88[_0x21b1('0x35')],qs[_0x21b1('0x3a')](_0x180291[_0x21b1('0x36')][_0x21b1('0x3a')]));_0x2db53a['attributes']=_0x2db53a['attributes'][_0x21b1('0x3c')]?_0x2db53a['attributes']:_0x1b8a88[_0x21b1('0x35')];if(_0x180291[_0x21b1('0x36')][_0x21b1('0x46')]){_0x2db53a[_0x21b1('0x47')]=[{'all':!![]}];}_0x2db53a=_[_0x21b1('0x43')]({},_0x2db53a,_0x180291[_0x21b1('0x45')]);return db[_0x21b1('0x31')][_0x21b1('0x4d')](_0x2db53a)[_0x21b1('0x2b')](handleEntityNotFound(_0x397b57,null))[_0x21b1('0x2b')](function(_0x463bfb){if(_0x463bfb){var _0x3f1a8b=_0x463bfb[_0x21b1('0x2a')]({'plain':!![]});_0x3f1a8b=qs[_0x21b1('0x57')](_0x3f1a8b,['id',_0x21b1('0x58'),_0x21b1('0x59')]);_0x180291[_0x21b1('0x4f')]=_[_0x21b1('0x57')](_0x180291[_0x21b1('0x4f')],['id',_0x21b1('0x58'),_0x21b1('0x59')]);return db['Dashboard'][_0x21b1('0x4e')](_['merge'](_0x3f1a8b,_0x180291[_0x21b1('0x4f')]),{'include':_0x180291[_0x21b1('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x21b1('0x2b')](function(_0x9ab9fa){var _0x2e438d=_0x180291['user'][_0x21b1('0x2a')]({'plain':!![]});if(!_0x2e438d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e438d[_0x21b1('0x52')]===_0x21b1('0x50')){var _0x88f6f9=_0x9ab9fa['get']({'plain':!![]});var _0x300a15='CustomDashboards';return db[_0x21b1('0x5a')][_0x21b1('0x4d')]({'where':{'name':_0x300a15,'userProfileId':_0x2e438d[_0x21b1('0x5b')]},'raw':!![]})[_0x21b1('0x2b')](function(_0x12a964){if(_0x12a964&&_0x12a964[_0x21b1('0x5c')]===0x0){return db[_0x21b1('0x54')][_0x21b1('0x4e')]({'name':_0x88f6f9['name'],'resourceId':_0x88f6f9['id'],'type':_0x12a964[_0x21b1('0x2d')],'sectionId':_0x12a964['id']},{})[_0x21b1('0x2b')](function(){return _0x9ab9fa;});}else{return _0x9ab9fa;}})[_0x21b1('0x4a')](function(_0x50ec05){logger['error'](_0x21b1('0x55'),_0x50ec05);throw _0x50ec05;});}return _0x9ab9fa;});}})['then'](respondWithResult(_0x397b57,0xc9))['catch'](handleError(_0x397b57,null));};exports[_0x21b1('0x28')]=function(_0x9cd71f,_0x188299){if(_0x9cd71f['body']['id']){delete _0x9cd71f['body']['id'];}return db[_0x21b1('0x31')]['find']({'where':{'id':_0x9cd71f[_0x21b1('0x4b')]['id']}})[_0x21b1('0x2b')](handleEntityNotFound(_0x188299,null))[_0x21b1('0x2b')](saveUpdates(_0x9cd71f[_0x21b1('0x4f')],null))[_0x21b1('0x2b')](respondWithResult(_0x188299,null))['catch'](handleError(_0x188299,null));};exports['destroy']=function(_0x42882b,_0x537295){return db[_0x21b1('0x31')][_0x21b1('0x4d')]({'where':{'id':_0x42882b[_0x21b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x537295,null))['then'](removeEntity(_0x537295,null))[_0x21b1('0x4a')](handleError(_0x537295,null));};function widgetAttributes(_0x9b14b8){try{switch(_0x9b14b8[_0x21b1('0x33')]){case _0x21b1('0x5d'):return[{'name':_0x21b1('0x5e'),'value':_0x9b14b8['attrUrl']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x61')}];case _0x21b1('0x62'):return[{'name':_0x21b1('0x63'),'value':_0x9b14b8['attrPath']||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||''}];case _0x21b1('0x64'):return[{'name':_0x21b1('0x65'),'value':_0x9b14b8[_0x21b1('0x65')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8['attrs'][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x66')},{'name':_0x21b1('0x67'),'value':_0x9b14b8['attrTimezone']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x1]?_0x9b14b8['attrs'][0x1]['value']:undefined)||_0x21b1('0x68')},{'name':_0x21b1('0x69'),'value':_0x9b14b8[_0x21b1('0x69')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x2]?_0x9b14b8[_0x21b1('0x5f')][0x2][_0x21b1('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0x21b1('0x6a'),'value':_0x9b14b8[_0x21b1('0x6a')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x6b')},{'name':_0x21b1('0x6c'),'value':_0x9b14b8[_0x21b1('0x6c')]||(_0x9b14b8['attrs']&&_0x9b14b8['attrs'][0x1]?_0x9b14b8['attrs'][0x1][_0x21b1('0x60')]:undefined)||[]},{'name':_0x21b1('0x69'),'value':_0x9b14b8[_0x21b1('0x69')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x2]?_0x9b14b8[_0x21b1('0x5f')][0x2][_0x21b1('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x9b14b8[_0x21b1('0x6d')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x3]?_0x9b14b8[_0x21b1('0x5f')][0x3]['value']:undefined)||'voice'},{'name':_0x21b1('0x6e'),'value':_0x9b14b8[_0x21b1('0x6e')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x4]?_0x9b14b8['attrs'][0x4][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x6f'),'value':_0x9b14b8[_0x21b1('0x6f')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x5]?_0x9b14b8[_0x21b1('0x5f')][0x5][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x70'),'value':_0x9b14b8['attrSmsAccounts']||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x6]?_0x9b14b8['attrs'][0x6][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x71'),'value':_0x9b14b8['attrOpenchannelAccounts']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x7]?_0x9b14b8['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x9b14b8[_0x21b1('0x72')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x8]?_0x9b14b8[_0x21b1('0x5f')][0x8][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x73'),'value':_0x9b14b8[_0x21b1('0x73')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x9]?_0x9b14b8[_0x21b1('0x5f')][0x9]['value']:undefined)||''}];case _0x21b1('0x74'):case _0x21b1('0x75'):return[{'name':_0x21b1('0x76'),'value':_0x9b14b8[_0x21b1('0x76')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x6b')},{'name':_0x21b1('0x77'),'value':_0x9b14b8[_0x21b1('0x77')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x1]?_0x9b14b8[_0x21b1('0x5f')][0x1][_0x21b1('0x60')]:undefined)||null},{'name':_0x21b1('0x78'),'value':_0x9b14b8[_0x21b1('0x78')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x2]?_0x9b14b8[_0x21b1('0x5f')][0x2][_0x21b1('0x60')]:undefined)||null},{'name':_0x21b1('0x6c'),'value':_0x9b14b8['attrVoiceQueues']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x3]?_0x9b14b8[_0x21b1('0x5f')][0x3][_0x21b1('0x60')]:undefined)||[]},{'name':_0x21b1('0x6d'),'value':_0x9b14b8[_0x21b1('0x6d')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x4]?_0x9b14b8['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0x21b1('0x6e'),'value':_0x9b14b8[_0x21b1('0x6e')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x5]?_0x9b14b8[_0x21b1('0x5f')][0x5]['value']:undefined)||''},{'name':_0x21b1('0x6f'),'value':_0x9b14b8['attrFaxAccounts']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x6]?_0x9b14b8['attrs'][0x6][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x70'),'value':_0x9b14b8[_0x21b1('0x70')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x7]?_0x9b14b8[_0x21b1('0x5f')][0x7]['value']:undefined)||''},{'name':_0x21b1('0x71'),'value':_0x9b14b8[_0x21b1('0x71')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x8]?_0x9b14b8[_0x21b1('0x5f')][0x8][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x72'),'value':_0x9b14b8['attrWhatsappAccounts']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x9]?_0x9b14b8[_0x21b1('0x5f')][0x9][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x73'),'value':_0x9b14b8[_0x21b1('0x73')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0xa]?_0x9b14b8['attrs'][0xa][_0x21b1('0x60')]:undefined)||''}];case'web-report':return[{'name':_0x21b1('0x79'),'type':_0x9b14b8[_0x21b1('0x7a')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8['attrs'][0x0]['type']:undefined)||null,'value':_0x9b14b8[_0x21b1('0x79')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||null},{'name':_0x21b1('0x7b'),'value':_0x9b14b8[_0x21b1('0x7b')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x1]?_0x9b14b8[_0x21b1('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x56dfcc){logger['error'](_0x21b1('0x7c'),JSON[_0x21b1('0x7d')](_0x56dfcc));return[];}}exports['addItem']=function(_0x2f356c,_0x467dde,_0x402397){if(_0x2f356c[_0x21b1('0x4f')]['id']){delete _0x2f356c[_0x21b1('0x4f')]['id'];}return db[_0x21b1('0x31')][_0x21b1('0x4d')]({'where':{'id':_0x2f356c[_0x21b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x467dde,null))[_0x21b1('0x2b')](function(_0x175e03){if(_0x175e03){_0x2f356c[_0x21b1('0x4f')][_0x21b1('0x7e')]=_0x175e03['id'];_0x2f356c['body']['attrs']=widgetAttributes(_0x2f356c[_0x21b1('0x4f')]);return db[_0x21b1('0x7f')][_0x21b1('0x4e')](_0x2f356c[_0x21b1('0x4f')]);}})['then'](respondWithResult(_0x467dde,null))[_0x21b1('0x4a')](handleError(_0x467dde,null));};exports[_0x21b1('0x80')]=function(_0x426ccb,_0x5aab28,_0x2ee81f){var _0x202608={};var _0x535220={};var _0x1e0c08;var _0x1de094;return db[_0x21b1('0x31')][_0x21b1('0x81')]({'where':{'id':_0x426ccb['params']['id']}})['then'](handleEntityNotFound(_0x5aab28,null))[_0x21b1('0x2b')](function(_0x399c53){if(_0x399c53){_0x1e0c08=_0x399c53;_0x535220['model']=_[_0x21b1('0x37')](db[_0x21b1('0x7f')][_0x21b1('0x4c')]);_0x535220[_0x21b1('0x36')]=_[_0x21b1('0x37')](_0x426ccb['query']);_0x535220[_0x21b1('0x38')]=_[_0x21b1('0x39')](_0x535220['model'],_0x535220['query']);_0x202608[_0x21b1('0x3b')]=_[_0x21b1('0x39')](_0x535220[_0x21b1('0x35')],qs[_0x21b1('0x3a')](_0x426ccb['query'][_0x21b1('0x3a')]));_0x202608[_0x21b1('0x3b')]=_0x202608[_0x21b1('0x3b')]['length']?_0x202608[_0x21b1('0x3b')]:_0x535220['model'];_0x202608[_0x21b1('0x3e')]=qs[_0x21b1('0x3f')](_0x426ccb['query']['sort']);_0x202608[_0x21b1('0x40')]=qs[_0x21b1('0x38')](_[_0x21b1('0x41')](_0x426ccb[_0x21b1('0x36')],_0x535220[_0x21b1('0x38')]));if(_0x426ccb['query'][_0x21b1('0x42')]){_0x202608[_0x21b1('0x40')]=_[_0x21b1('0x43')](_0x202608['where'],{'$or':_[_0x21b1('0x30')](_0x202608[_0x21b1('0x3b')],function(_0x2dc020){var _0x565709={};_0x565709[_0x2dc020]={'$like':'%'+_0x426ccb[_0x21b1('0x36')][_0x21b1('0x42')]+'%'};return _0x565709;})});}_0x202608=_[_0x21b1('0x43')]({},_0x202608,_0x426ccb['options']);return _0x1e0c08[_0x21b1('0x80')](_0x202608);}})[_0x21b1('0x2b')](function(_0x17d781){if(_0x17d781){_0x1de094=_0x17d781[_0x21b1('0x3c')];if(!_0x426ccb[_0x21b1('0x36')][_0x21b1('0x82')]('nolimit')){_0x202608['limit']=qs[_0x21b1('0x21')](_0x426ccb['query']['limit']);_0x202608[_0x21b1('0x1f')]=qs[_0x21b1('0x1f')](_0x426ccb[_0x21b1('0x36')][_0x21b1('0x1f')]);}return _0x1e0c08[_0x21b1('0x80')](_0x202608);}})[_0x21b1('0x2b')](function(_0x3576c3){if(_0x3576c3){return _0x3576c3?{'count':_0x1de094,'rows':_0x3576c3}:null;}})[_0x21b1('0x2b')](respondWithResult(_0x5aab28,null))[_0x21b1('0x4a')](handleError(_0x5aab28,null));}; \ No newline at end of file +var _0xce6c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','nolimit','order','where','pick','filter','type','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','autoAssociation','update','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0xce6c,0xf9));var _0xcce6=function(_0x26d25e,_0x1b691b){_0x26d25e=_0x26d25e-0x0;var _0x1b9b13=_0xce6c[_0x26d25e];return _0x1b9b13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcce6('0x0'));var jsonpatch=require(_0xcce6('0x1'));var rp=require(_0xcce6('0x2'));var moment=require(_0xcce6('0x3'));var BPromise=require(_0xcce6('0x4'));var Mustache=require(_0xcce6('0x5'));var util=require(_0xcce6('0x6'));var path=require(_0xcce6('0x7'));var sox=require('sox');var csv=require(_0xcce6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcce6('0x9'));var _=require(_0xcce6('0xa'));var squel=require('squel');var crypto=require(_0xcce6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcce6('0xc'));var Papa=require(_0xcce6('0xd'));var Redis=require(_0xcce6('0xe'));var authService=require(_0xcce6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcce6('0x10'));var hardwareService=require(_0xcce6('0x11'));var logger=require(_0xcce6('0x12'))(_0xcce6('0x13'));var utils=require(_0xcce6('0x14'));var config=require(_0xcce6('0x15'));var licenseUtil=require(_0xcce6('0x16'));var db=require(_0xcce6('0x17'))['db'];config[_0xcce6('0x18')]=_['defaults'](config[_0xcce6('0x18')],{'host':_0xcce6('0x19'),'port':0x18eb});var socket=require(_0xcce6('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')[_0xcce6('0x1b')](socket);function respondWithStatusCode(_0x3cc296,_0x3a730c){_0x3a730c=_0x3a730c||0xcc;return function(_0x5f1419){if(_0x5f1419){return _0x3cc296[_0xcce6('0x1c')](_0x3a730c);}return _0x3cc296['status'](_0x3a730c)['end']();};}function respondWithResult(_0x42d139,_0x315383){_0x315383=_0x315383||0xc8;return function(_0x23db88){if(_0x23db88){return _0x42d139[_0xcce6('0x1d')](_0x315383)[_0xcce6('0x1e')](_0x23db88);}};}function respondWithFilteredResult(_0x565405,_0x22209f){return function(_0x55743d){if(_0x55743d){var _0x35ea73=typeof _0x22209f[_0xcce6('0x1f')]===_0xcce6('0x20')&&typeof _0x22209f[_0xcce6('0x21')]===_0xcce6('0x20');var _0x7afdbc=_0x55743d['count'];var _0x1240d9=_0x35ea73?0x0:_0x22209f['offset'];var _0x31c0bd=_0x35ea73?_0x55743d[_0xcce6('0x22')]:_0x22209f[_0xcce6('0x1f')]+_0x22209f[_0xcce6('0x21')];var _0x34bd20;if(_0x31c0bd>=_0x7afdbc){_0x31c0bd=_0x7afdbc;_0x34bd20=0xc8;}else{_0x34bd20=0xce;}_0x565405[_0xcce6('0x1d')](_0x34bd20);return _0x565405[_0xcce6('0x23')](_0xcce6('0x24'),_0x1240d9+'-'+_0x31c0bd+'/'+_0x7afdbc)['json'](_0x55743d);}return null;};}function patchUpdates(_0x1e3309){return function(_0xfe1407){try{jsonpatch[_0xcce6('0x25')](_0xfe1407,_0x1e3309,!![]);}catch(_0x7b08d6){return BPromise[_0xcce6('0x26')](_0x7b08d6);}return _0xfe1407[_0xcce6('0x27')]();};}function saveUpdates(_0x5e9aeb,_0x5f2102){return function(_0x2fae90){if(_0x2fae90){return _0x2fae90['update'](_0x5e9aeb)[_0xcce6('0x28')](function(_0x26e4b7){return _0x26e4b7;});}return null;};}function removeEntity(_0x526ab6,_0x46153f){return function(_0x1c12cd){if(_0x1c12cd){return _0x1c12cd[_0xcce6('0x29')]()[_0xcce6('0x28')](function(){var _0x76b7bc=_0x1c12cd[_0xcce6('0x2a')]({'plain':!![]});var _0x4a554f='CustomDashboards';return db[_0xcce6('0x2b')][_0xcce6('0x29')]({'where':{'type':_0x4a554f,'resourceId':_0x76b7bc['id']}})[_0xcce6('0x28')](function(){return _0x1c12cd;});})[_0xcce6('0x28')](function(){_0x526ab6['status'](0xcc)[_0xcce6('0x2c')]();});}};}function handleEntityNotFound(_0x11bc0d,_0x36b4f3){return function(_0x563ce7){if(!_0x563ce7){_0x11bc0d[_0xcce6('0x1c')](0x194);}return _0x563ce7;};}function handleError(_0x5bb091,_0x1b534c){_0x1b534c=_0x1b534c||0x1f4;return function(_0x738614){logger[_0xcce6('0x2d')](_0x738614[_0xcce6('0x2e')]);if(_0x738614[_0xcce6('0x2f')]){delete _0x738614[_0xcce6('0x2f')];}_0x5bb091[_0xcce6('0x1d')](_0x1b534c)['send'](_0x738614);};}exports[_0xcce6('0x30')]=function(_0x2d13db,_0x300238){var _0x161e3c={},_0x1e6804={},_0x5d9c24={'count':0x0,'rows':[]};var _0x4e2b86=_[_0xcce6('0x31')](db[_0xcce6('0x32')][_0xcce6('0x33')],function(_0x56a4d8){return{'name':_0x56a4d8[_0xcce6('0x34')],'type':_0x56a4d8['type'][_0xcce6('0x35')]};});_0x1e6804[_0xcce6('0x36')]=_[_0xcce6('0x31')](_0x4e2b86,_0xcce6('0x2f'));_0x1e6804['query']=_[_0xcce6('0x37')](_0x2d13db[_0xcce6('0x38')]);_0x1e6804[_0xcce6('0x39')]=_['intersection'](_0x1e6804[_0xcce6('0x36')],_0x1e6804['query']);_0x161e3c[_0xcce6('0x3a')]=_['intersection'](_0x1e6804[_0xcce6('0x36')],qs[_0xcce6('0x3b')](_0x2d13db[_0xcce6('0x38')][_0xcce6('0x3b')]));_0x161e3c[_0xcce6('0x3a')]=_0x161e3c[_0xcce6('0x3a')]['length']?_0x161e3c[_0xcce6('0x3a')]:_0x1e6804['model'];if(!_0x2d13db[_0xcce6('0x38')]['hasOwnProperty'](_0xcce6('0x3c'))){_0x161e3c[_0xcce6('0x21')]=qs[_0xcce6('0x21')](_0x2d13db[_0xcce6('0x38')]['limit']);_0x161e3c[_0xcce6('0x1f')]=qs['offset'](_0x2d13db[_0xcce6('0x38')][_0xcce6('0x1f')]);}_0x161e3c[_0xcce6('0x3d')]=qs['sort'](_0x2d13db[_0xcce6('0x38')]['sort']);_0x161e3c[_0xcce6('0x3e')]=qs[_0xcce6('0x39')](_[_0xcce6('0x3f')](_0x2d13db[_0xcce6('0x38')],_0x1e6804[_0xcce6('0x39')]),_0x4e2b86);if(_0x2d13db[_0xcce6('0x38')][_0xcce6('0x40')]){_0x161e3c['where']=_['merge'](_0x161e3c[_0xcce6('0x3e')],{'$or':_[_0xcce6('0x31')](_0x4e2b86,function(_0x30f63d){if(_0x30f63d[_0xcce6('0x41')]!=='VIRTUAL'){var _0x1c440a={};_0x1c440a[_0x30f63d[_0xcce6('0x2f')]]={'$like':'%'+_0x2d13db[_0xcce6('0x38')]['filter']+'%'};return _0x1c440a;}})});}_0x161e3c=_[_0xcce6('0x42')]({},_0x161e3c,_0x2d13db[_0xcce6('0x43')]);var _0x5811fa={'where':_0x161e3c[_0xcce6('0x3e')]};return db[_0xcce6('0x32')][_0xcce6('0x22')](_0x5811fa)[_0xcce6('0x28')](function(_0x49a743){_0x5d9c24[_0xcce6('0x22')]=_0x49a743;if(_0x2d13db['query']['includeAll']){_0x161e3c[_0xcce6('0x44')]=[{'all':!![]}];}return db['Dashboard'][_0xcce6('0x45')](_0x161e3c);})[_0xcce6('0x28')](function(_0x4a3ccb){_0x5d9c24[_0xcce6('0x46')]=_0x4a3ccb;return _0x5d9c24;})[_0xcce6('0x28')](respondWithFilteredResult(_0x300238,_0x161e3c))[_0xcce6('0x47')](handleError(_0x300238,null));};exports[_0xcce6('0x48')]=function(_0xe09156,_0x772b13){var _0x2652e6={'raw':![],'where':{'id':_0xe09156[_0xcce6('0x49')]['id']}},_0x4a7617={};_0x4a7617[_0xcce6('0x36')]=_[_0xcce6('0x37')](db['Dashboard'][_0xcce6('0x33')]);_0x4a7617[_0xcce6('0x38')]=_[_0xcce6('0x37')](_0xe09156['query']);_0x4a7617[_0xcce6('0x39')]=_[_0xcce6('0x4a')](_0x4a7617[_0xcce6('0x36')],_0x4a7617[_0xcce6('0x38')]);_0x2652e6[_0xcce6('0x3a')]=_['intersection'](_0x4a7617[_0xcce6('0x36')],qs[_0xcce6('0x3b')](_0xe09156[_0xcce6('0x38')]['fields']));_0x2652e6[_0xcce6('0x3a')]=_0x2652e6[_0xcce6('0x3a')][_0xcce6('0x4b')]?_0x2652e6[_0xcce6('0x3a')]:_0x4a7617['model'];if(_0xe09156[_0xcce6('0x38')][_0xcce6('0x4c')]){_0x2652e6['include']=[{'all':!![]}];}_0x2652e6=_['merge']({},_0x2652e6,_0xe09156['options']);return db[_0xcce6('0x32')][_0xcce6('0x4d')](_0x2652e6)[_0xcce6('0x28')](handleEntityNotFound(_0x772b13,null))['then'](respondWithResult(_0x772b13,null))[_0xcce6('0x47')](handleError(_0x772b13,null));};exports[_0xcce6('0x4e')]=function(_0x1f10ae,_0x31a9be){return db['Dashboard'][_0xcce6('0x4e')](_0x1f10ae['body'],{})[_0xcce6('0x28')](function(_0x223522){var _0x546200=_0x1f10ae[_0xcce6('0x4f')][_0xcce6('0x2a')]({'plain':!![]});if(!_0x546200)throw new Error(_0xcce6('0x50'));if(_0x546200[_0xcce6('0x51')]===_0xcce6('0x4f')){var _0x4dbbbb=_0x223522['get']({'plain':!![]});var _0x519051=_0xcce6('0x52');return db[_0xcce6('0x53')][_0xcce6('0x4d')]({'where':{'name':_0x519051,'userProfileId':_0x546200[_0xcce6('0x54')]},'raw':!![]})[_0xcce6('0x28')](function(_0x183f96){if(_0x183f96&&_0x183f96['autoAssociation']===0x0){return db['UserProfileResource'][_0xcce6('0x4e')]({'name':_0x4dbbbb[_0xcce6('0x2f')],'resourceId':_0x4dbbbb['id'],'type':_0x183f96[_0xcce6('0x2f')],'sectionId':_0x183f96['id']},{})[_0xcce6('0x28')](function(){return _0x223522;});}else{return _0x223522;}})[_0xcce6('0x47')](function(_0x91e687){logger[_0xcce6('0x2d')](_0xcce6('0x55'),_0x91e687);throw _0x91e687;});}return _0x223522;})[_0xcce6('0x28')](respondWithResult(_0x31a9be,0xc9))[_0xcce6('0x47')](handleError(_0x31a9be,null));};exports[_0xcce6('0x56')]=function(_0x16d8f0,_0x3452f8){var _0x3f7696={'where':{'id':_0x16d8f0[_0xcce6('0x49')]['id']}},_0x1a871a={};_0x1a871a[_0xcce6('0x36')]=_[_0xcce6('0x37')](db[_0xcce6('0x32')]['rawAttributes']);_0x3f7696[_0xcce6('0x3a')]=_[_0xcce6('0x4a')](_0x1a871a[_0xcce6('0x36')],qs[_0xcce6('0x3b')](_0x16d8f0[_0xcce6('0x38')][_0xcce6('0x3b')]));_0x3f7696[_0xcce6('0x3a')]=_0x3f7696[_0xcce6('0x3a')]['length']?_0x3f7696[_0xcce6('0x3a')]:_0x1a871a['model'];if(_0x16d8f0[_0xcce6('0x38')][_0xcce6('0x4c')]){_0x3f7696['include']=[{'all':!![]}];}_0x3f7696=_[_0xcce6('0x42')]({},_0x3f7696,_0x16d8f0[_0xcce6('0x43')]);return db[_0xcce6('0x32')]['find'](_0x3f7696)[_0xcce6('0x28')](handleEntityNotFound(_0x3452f8,null))[_0xcce6('0x28')](function(_0x213d5b){if(_0x213d5b){var _0x38501d=_0x213d5b['get']({'plain':!![]});_0x38501d=qs[_0xcce6('0x57')](_0x38501d,['id',_0xcce6('0x58'),_0xcce6('0x59')]);_0x16d8f0['body']=_[_0xcce6('0x57')](_0x16d8f0[_0xcce6('0x5a')],['id',_0xcce6('0x58'),_0xcce6('0x59')]);return db[_0xcce6('0x32')]['create'](_[_0xcce6('0x42')](_0x38501d,_0x16d8f0[_0xcce6('0x5a')]),{'include':_0x16d8f0[_0xcce6('0x38')][_0xcce6('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x3aa546){var _0x5140d3=_0x16d8f0['user']['get']({'plain':!![]});if(!_0x5140d3)throw new Error(_0xcce6('0x50'));if(_0x5140d3[_0xcce6('0x51')]===_0xcce6('0x4f')){var _0x93b82e=_0x3aa546[_0xcce6('0x2a')]({'plain':!![]});var _0x10d222=_0xcce6('0x52');return db[_0xcce6('0x53')][_0xcce6('0x4d')]({'where':{'name':_0x10d222,'userProfileId':_0x5140d3['userProfileId']},'raw':!![]})[_0xcce6('0x28')](function(_0x3c6067){if(_0x3c6067&&_0x3c6067[_0xcce6('0x5b')]===0x0){return db[_0xcce6('0x2b')][_0xcce6('0x4e')]({'name':_0x93b82e[_0xcce6('0x2f')],'resourceId':_0x93b82e['id'],'type':_0x3c6067[_0xcce6('0x2f')],'sectionId':_0x3c6067['id']},{})[_0xcce6('0x28')](function(){return _0x3aa546;});}else{return _0x3aa546;}})[_0xcce6('0x47')](function(_0x2e46c9){logger['error'](_0xcce6('0x55'),_0x2e46c9);throw _0x2e46c9;});}return _0x3aa546;});}})[_0xcce6('0x28')](respondWithResult(_0x3452f8,0xc9))[_0xcce6('0x47')](handleError(_0x3452f8,null));};exports[_0xcce6('0x5c')]=function(_0x537b1e,_0x32e70a){if(_0x537b1e[_0xcce6('0x5a')]['id']){delete _0x537b1e[_0xcce6('0x5a')]['id'];}return db[_0xcce6('0x32')]['find']({'where':{'id':_0x537b1e['params']['id']}})['then'](handleEntityNotFound(_0x32e70a,null))[_0xcce6('0x28')](saveUpdates(_0x537b1e['body'],null))[_0xcce6('0x28')](respondWithResult(_0x32e70a,null))['catch'](handleError(_0x32e70a,null));};exports[_0xcce6('0x29')]=function(_0x3cc214,_0x474ec8){return db[_0xcce6('0x32')][_0xcce6('0x4d')]({'where':{'id':_0x3cc214['params']['id']}})['then'](handleEntityNotFound(_0x474ec8,null))['then'](removeEntity(_0x474ec8,null))[_0xcce6('0x47')](handleError(_0x474ec8,null));};function widgetAttributes(_0x4253bb){try{switch(_0x4253bb[_0xcce6('0x41')]){case _0xcce6('0x5d'):return[{'name':_0xcce6('0x5e'),'value':_0x4253bb[_0xcce6('0x5e')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0x0]?_0x4253bb[_0xcce6('0x5f')][0x0][_0xcce6('0x60')]:undefined)||'https://'}];case _0xcce6('0x61'):return[{'name':_0xcce6('0x62'),'value':_0x4253bb[_0xcce6('0x62')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x0]?_0x4253bb[_0xcce6('0x5f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4253bb[_0xcce6('0x63')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x0]?_0x4253bb[_0xcce6('0x5f')][0x0][_0xcce6('0x60')]:undefined)||_0xcce6('0x64')},{'name':_0xcce6('0x65'),'value':_0x4253bb['attrTimezone']||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x1]?_0x4253bb[_0xcce6('0x5f')][0x1][_0xcce6('0x60')]:undefined)||_0xcce6('0x66')},{'name':_0xcce6('0x67'),'value':_0x4253bb[_0xcce6('0x67')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0x2]?_0x4253bb[_0xcce6('0x5f')][0x2][_0xcce6('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0xcce6('0x68'),'value':_0x4253bb[_0xcce6('0x68')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x0]?_0x4253bb[_0xcce6('0x5f')][0x0]['value']:undefined)||_0xcce6('0x69')},{'name':_0xcce6('0x6a'),'value':_0x4253bb[_0xcce6('0x6a')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0x1]?_0x4253bb[_0xcce6('0x5f')][0x1][_0xcce6('0x60')]:undefined)||[]},{'name':_0xcce6('0x67'),'value':_0x4253bb[_0xcce6('0x67')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb['attrs'][0x2]?_0x4253bb['attrs'][0x2][_0xcce6('0x60')]:undefined)||0x14},{'name':_0xcce6('0x6b'),'value':_0x4253bb[_0xcce6('0x6b')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x3]?_0x4253bb[_0xcce6('0x5f')][0x3][_0xcce6('0x60')]:undefined)||_0xcce6('0x6c')},{'name':_0xcce6('0x6d'),'value':_0x4253bb[_0xcce6('0x6d')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x4]?_0x4253bb['attrs'][0x4]['value']:undefined)||''},{'name':_0xcce6('0x6e'),'value':_0x4253bb[_0xcce6('0x6e')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x5]?_0x4253bb[_0xcce6('0x5f')][0x5][_0xcce6('0x60')]:undefined)||''},{'name':_0xcce6('0x6f'),'value':_0x4253bb['attrSmsAccounts']||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x6]?_0x4253bb[_0xcce6('0x5f')][0x6]['value']:undefined)||''},{'name':_0xcce6('0x70'),'value':_0x4253bb[_0xcce6('0x70')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x7]?_0x4253bb[_0xcce6('0x5f')][0x7][_0xcce6('0x60')]:undefined)||''},{'name':_0xcce6('0x71'),'value':_0x4253bb[_0xcce6('0x71')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0x8]?_0x4253bb[_0xcce6('0x5f')][0x8][_0xcce6('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4253bb['attrChatWebsites']||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x9]?_0x4253bb[_0xcce6('0x5f')][0x9][_0xcce6('0x60')]:undefined)||''}];case _0xcce6('0x72'):case _0xcce6('0x73'):return[{'name':_0xcce6('0x74'),'value':_0x4253bb[_0xcce6('0x74')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb['attrs'][0x0]?_0x4253bb[_0xcce6('0x5f')][0x0]['value']:undefined)||_0xcce6('0x69')},{'name':_0xcce6('0x75'),'value':_0x4253bb[_0xcce6('0x75')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x1]?_0x4253bb['attrs'][0x1][_0xcce6('0x60')]:undefined)||null},{'name':_0xcce6('0x76'),'value':_0x4253bb['attrSerie3']||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb['attrs'][0x2]?_0x4253bb[_0xcce6('0x5f')][0x2][_0xcce6('0x60')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4253bb[_0xcce6('0x6a')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb['attrs'][0x3]?_0x4253bb[_0xcce6('0x5f')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x4253bb[_0xcce6('0x6b')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0x4]?_0x4253bb[_0xcce6('0x5f')][0x4][_0xcce6('0x60')]:undefined)||_0xcce6('0x6c')},{'name':_0xcce6('0x6d'),'value':_0x4253bb[_0xcce6('0x6d')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x5]?_0x4253bb['attrs'][0x5][_0xcce6('0x60')]:undefined)||''},{'name':_0xcce6('0x6e'),'value':_0x4253bb[_0xcce6('0x6e')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb['attrs'][0x6]?_0x4253bb[_0xcce6('0x5f')][0x6][_0xcce6('0x60')]:undefined)||''},{'name':_0xcce6('0x6f'),'value':_0x4253bb[_0xcce6('0x6f')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb['attrs'][0x7]?_0x4253bb[_0xcce6('0x5f')][0x7][_0xcce6('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4253bb[_0xcce6('0x70')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0x8]?_0x4253bb[_0xcce6('0x5f')][0x8]['value']:undefined)||''},{'name':_0xcce6('0x71'),'value':_0x4253bb[_0xcce6('0x71')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0x9]?_0x4253bb['attrs'][0x9][_0xcce6('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4253bb[_0xcce6('0x77')]||(_0x4253bb['attrs']&&_0x4253bb[_0xcce6('0x5f')][0xa]?_0x4253bb['attrs'][0xa]['value']:undefined)||''}];case _0xcce6('0x78'):return[{'name':_0xcce6('0x79'),'type':_0x4253bb[_0xcce6('0x7a')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x0]?_0x4253bb['attrs'][0x0][_0xcce6('0x41')]:undefined)||null,'value':_0x4253bb[_0xcce6('0x79')]||(_0x4253bb[_0xcce6('0x5f')]&&_0x4253bb[_0xcce6('0x5f')][0x0]?_0x4253bb['attrs'][0x0][_0xcce6('0x60')]:undefined)||null},{'name':_0xcce6('0x7b'),'value':_0x4253bb[_0xcce6('0x7b')]||(_0x4253bb['attrs']&&_0x4253bb['attrs'][0x1]?_0x4253bb[_0xcce6('0x5f')][0x1][_0xcce6('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x5a5206){logger['error'](_0xcce6('0x7c'),JSON[_0xcce6('0x7d')](_0x5a5206));return[];}}exports[_0xcce6('0x7e')]=function(_0xc5cf42,_0x1f48a1,_0x2bf0a1){if(_0xc5cf42[_0xcce6('0x5a')]['id']){delete _0xc5cf42[_0xcce6('0x5a')]['id'];}return db[_0xcce6('0x32')][_0xcce6('0x4d')]({'where':{'id':_0xc5cf42['params']['id']}})['then'](handleEntityNotFound(_0x1f48a1,null))[_0xcce6('0x28')](function(_0x42afa0){if(_0x42afa0){_0xc5cf42[_0xcce6('0x5a')][_0xcce6('0x7f')]=_0x42afa0['id'];_0xc5cf42[_0xcce6('0x5a')][_0xcce6('0x5f')]=widgetAttributes(_0xc5cf42[_0xcce6('0x5a')]);return db[_0xcce6('0x80')][_0xcce6('0x4e')](_0xc5cf42['body']);}})[_0xcce6('0x28')](respondWithResult(_0x1f48a1,null))[_0xcce6('0x47')](handleError(_0x1f48a1,null));};exports[_0xcce6('0x81')]=function(_0x269ad4,_0x3d7260,_0x2504d5){var _0x3af784={};var _0x3c978e={};var _0x981972;var _0x2b7926;return db[_0xcce6('0x32')][_0xcce6('0x82')]({'where':{'id':_0x269ad4[_0xcce6('0x49')]['id']}})[_0xcce6('0x28')](handleEntityNotFound(_0x3d7260,null))['then'](function(_0x532259){if(_0x532259){_0x981972=_0x532259;_0x3c978e['model']=_[_0xcce6('0x37')](db[_0xcce6('0x80')]['rawAttributes']);_0x3c978e[_0xcce6('0x38')]=_[_0xcce6('0x37')](_0x269ad4[_0xcce6('0x38')]);_0x3c978e[_0xcce6('0x39')]=_[_0xcce6('0x4a')](_0x3c978e[_0xcce6('0x36')],_0x3c978e['query']);_0x3af784['attributes']=_[_0xcce6('0x4a')](_0x3c978e[_0xcce6('0x36')],qs[_0xcce6('0x3b')](_0x269ad4[_0xcce6('0x38')][_0xcce6('0x3b')]));_0x3af784[_0xcce6('0x3a')]=_0x3af784['attributes'][_0xcce6('0x4b')]?_0x3af784[_0xcce6('0x3a')]:_0x3c978e[_0xcce6('0x36')];_0x3af784[_0xcce6('0x3d')]=qs[_0xcce6('0x83')](_0x269ad4['query']['sort']);_0x3af784[_0xcce6('0x3e')]=qs[_0xcce6('0x39')](_[_0xcce6('0x3f')](_0x269ad4['query'],_0x3c978e[_0xcce6('0x39')]));if(_0x269ad4[_0xcce6('0x38')][_0xcce6('0x40')]){_0x3af784[_0xcce6('0x3e')]=_[_0xcce6('0x42')](_0x3af784[_0xcce6('0x3e')],{'$or':_[_0xcce6('0x31')](_0x3af784['attributes'],function(_0x217e42){var _0x2a3fb4={};_0x2a3fb4[_0x217e42]={'$like':'%'+_0x269ad4[_0xcce6('0x38')][_0xcce6('0x40')]+'%'};return _0x2a3fb4;})});}_0x3af784=_[_0xcce6('0x42')]({},_0x3af784,_0x269ad4['options']);return _0x981972[_0xcce6('0x81')](_0x3af784);}})['then'](function(_0x57fecc){if(_0x57fecc){_0x2b7926=_0x57fecc['length'];if(!_0x269ad4[_0xcce6('0x38')][_0xcce6('0x84')](_0xcce6('0x3c'))){_0x3af784[_0xcce6('0x21')]=qs[_0xcce6('0x21')](_0x269ad4[_0xcce6('0x38')][_0xcce6('0x21')]);_0x3af784[_0xcce6('0x1f')]=qs['offset'](_0x269ad4['query'][_0xcce6('0x1f')]);}return _0x981972['getItems'](_0x3af784);}})[_0xcce6('0x28')](function(_0x3f8488){if(_0x3f8488){return _0x3f8488?{'count':_0x2b7926,'rows':_0x3f8488}:null;}})[_0xcce6('0x28')](respondWithResult(_0x3d7260,null))[_0xcce6('0x47')](handleError(_0x3d7260,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 640aaf7..5887a1e 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 _0x9e71=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1b26c7,_0x351a99){var _0x3b2671=function(_0x384bcd){while(--_0x384bcd){_0x1b26c7['push'](_0x1b26c7['shift']());}};_0x3b2671(++_0x351a99);}(_0x9e71,0x1a8));var _0x19e7=function(_0x5ca83d,_0x193509){_0x5ca83d=_0x5ca83d-0x0;var _0x189f6a=_0x9e71[_0x5ca83d];return _0x189f6a;};'use strict';var EventEmitter=require(_0x19e7('0x0'));var Dashboard=require(_0x19e7('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x19e7('0x2')](0x0);var events={'afterCreate':_0x19e7('0x3'),'afterUpdate':_0x19e7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2677e5){return function(_0x59fb78,_0x23c87f,_0x32a957){DashboardEvents[_0x19e7('0x5')](_0x2677e5+':'+_0x59fb78['id'],_0x59fb78);DashboardEvents['emit'](_0x2677e5,_0x59fb78);_0x32a957(null);};}for(var e in events){if(events[_0x19e7('0x6')](e)){var event=events[e];Dashboard[_0x19e7('0x7')](e,emitEvent(event));}}module[_0x19e7('0x8')]=DashboardEvents; \ No newline at end of file +var _0x554e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x356c68,_0x1b0d43){var _0x601463=function(_0x47aff4){while(--_0x47aff4){_0x356c68['push'](_0x356c68['shift']());}};_0x601463(++_0x1b0d43);}(_0x554e,0x9e));var _0xe554=function(_0x2cb984,_0x365f50){_0x2cb984=_0x2cb984-0x0;var _0x2f73e6=_0x554e[_0x2cb984];return _0x2f73e6;};'use strict';var EventEmitter=require(_0xe554('0x0'));var Dashboard=require(_0xe554('0x1'))['db'][_0xe554('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe554('0x3')](0x0);var events={'afterCreate':_0xe554('0x4'),'afterUpdate':_0xe554('0x5'),'afterDestroy':_0xe554('0x6')};function emitEvent(_0x33febd){return function(_0x36f57c,_0x493b1d,_0x3f38e3){DashboardEvents[_0xe554('0x7')](_0x33febd+':'+_0x36f57c['id'],_0x36f57c);DashboardEvents[_0xe554('0x7')](_0x33febd,_0x36f57c);_0x3f38e3(null);};}for(var e in events){if(events[_0xe554('0x8')](e)){var event=events[e];Dashboard[_0xe554('0x9')](e,emitEvent(event));}}module[_0xe554('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 1684ac1..fa601d6 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 _0x3c7c=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','Dashboard'];(function(_0x4e4623,_0x361b8b){var _0x12ef4f=function(_0x39d171){while(--_0x39d171){_0x4e4623['push'](_0x4e4623['shift']());}};_0x12ef4f(++_0x361b8b);}(_0x3c7c,0xd8));var _0xc3c7=function(_0x27314d,_0x33c0f2){_0x27314d=_0x27314d-0x0;var _0x30a648=_0x3c7c[_0x27314d];return _0x30a648;};'use strict';var _=require('lodash');var util=require(_0xc3c7('0x0'));var logger=require(_0xc3c7('0x1'))(_0xc3c7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3c7('0x3'));var fs=require('fs');var path=require(_0xc3c7('0x4'));var rimraf=require(_0xc3c7('0x5'));var config=require(_0xc3c7('0x6'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x4e097e,_0x298ede){return _0x4e097e[_0xc3c7('0x7')](_0xc3c7('0x8'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ba=['define','dashboards','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x12c934,_0x4c8e54){var _0x56275f=function(_0xad9e4c){while(--_0xad9e4c){_0x12c934['push'](_0x12c934['shift']());}};_0x56275f(++_0x4c8e54);}(_0xd0ba,0x178));var _0xad0b=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xd0ba[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xad0b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad0b('0x1'));var moment=require(_0xad0b('0x2'));var BPromise=require(_0xad0b('0x3'));var rp=require(_0xad0b('0x4'));var fs=require('fs');var path=require(_0xad0b('0x5'));var rimraf=require(_0xad0b('0x6'));var config=require(_0xad0b('0x7'));var attributes=require('./dashboard.attributes');module[_0xad0b('0x8')]=function(_0x2049b7,_0x339e38){return _0x2049b7[_0xad0b('0x9')]('Dashboard',attributes,{'tableName':_0xad0b('0xa'),'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 05c898e..ec170e8 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 _0x2f6f=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x38cb17,_0x2e2929){var _0x36f2a2=function(_0x5ccacd){while(--_0x5ccacd){_0x38cb17['push'](_0x38cb17['shift']());}};_0x36f2a2(++_0x2e2929);}(_0x2f6f,0x102));var _0xf2f6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2f6f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xf2f6('0x0'));var util=require('util');var moment=require(_0xf2f6('0x1'));var BPromise=require('bluebird');var rs=require(_0xf2f6('0x2'));var fs=require('fs');var Redis=require(_0xf2f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2f6('0x4'));var logger=require(_0xf2f6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf2f6('0x6'));var client=jayson['client'][_0xf2f6('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf2f6('0x8')],{'host':_0xf2f6('0x9'),'port':0x18eb});var socket=require(_0xf2f6('0xa'))(new Redis(config[_0xf2f6('0x8')]));require(_0xf2f6('0xb'))[_0xf2f6('0xc')](socket);function respondWithRpcPromise(_0x5e2459,_0x33bfe7,_0x3bc54f){return new BPromise(function(_0x339078,_0x17106b){return client[_0xf2f6('0xd')](_0x5e2459,_0x3bc54f)[_0xf2f6('0xe')](function(_0x222927){logger[_0xf2f6('0xf')](_0xf2f6('0x10'),_0x33bfe7,_0xf2f6('0x11'));logger[_0xf2f6('0x12')](_0xf2f6('0x13'),_0x33bfe7,'request\x20sent',JSON[_0xf2f6('0x14')](_0x222927));if(_0x222927[_0xf2f6('0x15')]){if(_0x222927[_0xf2f6('0x15')][_0xf2f6('0x16')]===0x1f4){logger[_0xf2f6('0x15')](_0xf2f6('0x10'),_0x33bfe7,_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);return _0x17106b(_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);}logger[_0xf2f6('0x15')]('Dashboard,\x20%s,\x20%s',_0x33bfe7,_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);return _0x339078(_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);}else{logger['info'](_0xf2f6('0x10'),_0x33bfe7,_0xf2f6('0x11'));_0x339078(_0x222927['result']['message']);}})[_0xf2f6('0x18')](function(_0x17b795){logger[_0xf2f6('0x15')](_0xf2f6('0x10'),_0x33bfe7,_0x17b795);_0x17106b(_0x17b795);});});} \ No newline at end of file +var _0x3e3c=['rpc','../../config/environment','client','http','redis','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x3e3c,0x10f));var _0xc3e3=function(_0x5802bf,_0x4bbf11){_0x5802bf=_0x5802bf-0x0;var _0x30d3a8=_0x3e3c[_0x5802bf];return _0x30d3a8;};'use strict';var _=require('lodash');var util=require(_0xc3e3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc3e3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3e3('0x2'))['db'];var utils=require(_0xc3e3('0x3'));var logger=require(_0xc3e3('0x4'))(_0xc3e3('0x5'));var config=require(_0xc3e3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc3e3('0x7')][_0xc3e3('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc3e3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3e3('0xa'))(new Redis(config[_0xc3e3('0x9')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x5380ed,_0x30e608,_0x2d17dd){return new BPromise(function(_0x2e9a64,_0x4ddb68){return client[_0xc3e3('0xb')](_0x5380ed,_0x2d17dd)[_0xc3e3('0xc')](function(_0x79dbad){logger[_0xc3e3('0xd')](_0xc3e3('0xe'),_0x30e608,_0xc3e3('0xf'));logger[_0xc3e3('0x10')](_0xc3e3('0x11'),_0x30e608,_0xc3e3('0xf'),JSON[_0xc3e3('0x12')](_0x79dbad));if(_0x79dbad[_0xc3e3('0x13')]){if(_0x79dbad[_0xc3e3('0x13')][_0xc3e3('0x14')]===0x1f4){logger[_0xc3e3('0x13')](_0xc3e3('0xe'),_0x30e608,_0x79dbad[_0xc3e3('0x13')]['message']);return _0x4ddb68(_0x79dbad[_0xc3e3('0x13')]['message']);}logger[_0xc3e3('0x13')](_0xc3e3('0xe'),_0x30e608,_0x79dbad['error']['message']);return _0x2e9a64(_0x79dbad[_0xc3e3('0x13')][_0xc3e3('0x15')]);}else{logger[_0xc3e3('0xd')]('Dashboard,\x20%s,\x20%s',_0x30e608,_0xc3e3('0xf'));_0x2e9a64(_0x79dbad['result']['message']);}})[_0xc3e3('0x16')](function(_0x426e63){logger[_0xc3e3('0x13')](_0xc3e3('0xe'),_0x30e608,_0x426e63);_0x4ddb68(_0x426e63);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index d9f2308..26ec077 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 _0x62c9=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x62c9,0xac));var _0x962c=function(_0x3e8ba5,_0x41c00a){_0x3e8ba5=_0x3e8ba5-0x0;var _0x210621=_0x62c9[_0x3e8ba5];return _0x210621;};'use strict';var DashboardEvents=require(_0x962c('0x0'));var events=[_0x962c('0x1'),_0x962c('0x2'),_0x962c('0x3')];function createListener(_0xb9228,_0x95f2d4){return function(_0x1a8b2a){_0x95f2d4['emit'](_0xb9228,_0x1a8b2a);};}function removeListener(_0x11fdfd,_0x23f62c){return function(){DashboardEvents[_0x962c('0x4')](_0x11fdfd,_0x23f62c);};}exports[_0x962c('0x5')]=function(_0x90274d){for(var _0x259836=0x0,_0x13a2a8=events[_0x962c('0x6')];_0x259836<_0x13a2a8;_0x259836++){var _0x306649=events[_0x259836];var _0x5643a0=createListener(_0x962c('0x7')+_0x306649,_0x90274d);DashboardEvents['on'](_0x306649,_0x5643a0);}}; \ No newline at end of file +var _0xfed3=['emit','removeListener','register','dashboard:','./dashboard.events','save','update'];(function(_0x2ec4ca,_0x1e37b8){var _0x5ade99=function(_0x3ae228){while(--_0x3ae228){_0x2ec4ca['push'](_0x2ec4ca['shift']());}};_0x5ade99(++_0x1e37b8);}(_0xfed3,0xc1));var _0x3fed=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xfed3[_0x4ea413];return _0x51cf25;};'use strict';var DashboardEvents=require(_0x3fed('0x0'));var events=[_0x3fed('0x1'),'remove',_0x3fed('0x2')];function createListener(_0x37a487,_0x198f9f){return function(_0x2f7b1d){_0x198f9f[_0x3fed('0x3')](_0x37a487,_0x2f7b1d);};}function removeListener(_0x77380f,_0x589b76){return function(){DashboardEvents[_0x3fed('0x4')](_0x77380f,_0x589b76);};}exports[_0x3fed('0x5')]=function(_0x12ccf9){for(var _0x1b8f48=0x0,_0x12a909=events['length'];_0x1b8f48<_0x12a909;_0x1b8f48++){var _0xbda0d6=events[_0x1b8f48];var _0x2e34cb=createListener(_0x3fed('0x6')+_0xbda0d6,_0x12ccf9);DashboardEvents['on'](_0xbda0d6,_0x2e34cb);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 08df76d..27afe6f 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 _0xf9b5=['put','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem'];(function(_0xc2b8c9,_0x2d42c1){var _0x185e7e=function(_0x8b3340){while(--_0x8b3340){_0xc2b8c9['push'](_0xc2b8c9['shift']());}};_0x185e7e(++_0x2d42c1);}(_0xf9b5,0x81));var _0x5f9b=function(_0x3ba748,_0x4b8fb9){_0x3ba748=_0x3ba748-0x0;var _0x5b04e2=_0xf9b5[_0x3ba748];return _0x5b04e2;};'use strict';var multer=require(_0x5f9b('0x0'));var util=require(_0x5f9b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5f9b('0x2'));var router=express['Router']();var fs_extra=require(_0x5f9b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5f9b('0x4'));var config=require('../../config/environment');var controller=require(_0x5f9b('0x5'));router[_0x5f9b('0x6')]('/',auth[_0x5f9b('0x7')](),controller[_0x5f9b('0x8')]);router['get'](_0x5f9b('0x9'),auth[_0x5f9b('0x7')](),controller[_0x5f9b('0xa')]);router[_0x5f9b('0x6')](_0x5f9b('0xb'),auth[_0x5f9b('0x7')](),controller[_0x5f9b('0xc')]);router[_0x5f9b('0xd')]('/',auth['isAuthenticated'](),controller[_0x5f9b('0xe')]);router['post'](_0x5f9b('0xf'),auth[_0x5f9b('0x7')](),controller[_0x5f9b('0x10')]);router[_0x5f9b('0xd')](_0x5f9b('0xb'),auth['isAuthenticated'](),controller[_0x5f9b('0x11')]);router[_0x5f9b('0x12')](_0x5f9b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5f9b('0x13')]('/:id',auth[_0x5f9b('0x7')](),controller[_0x5f9b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8941=['connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','/:id/items','post','clone','addItem','destroy','exports','multer','util','path'];(function(_0x17a59d,_0x3df89e){var _0x503ffc=function(_0x2ee8b8){while(--_0x2ee8b8){_0x17a59d['push'](_0x17a59d['shift']());}};_0x503ffc(++_0x3df89e);}(_0x8941,0x12f));var _0x1894=function(_0x5d9258,_0x621516){_0x5d9258=_0x5d9258-0x0;var _0x24c365=_0x8941[_0x5d9258];return _0x24c365;};'use strict';var multer=require(_0x1894('0x0'));var util=require(_0x1894('0x1'));var path=require(_0x1894('0x2'));var timeout=require(_0x1894('0x3'));var express=require(_0x1894('0x4'));var router=express[_0x1894('0x5')]();var fs_extra=require(_0x1894('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1894('0x7'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x1894('0x8')](),controller[_0x1894('0x9')]);router[_0x1894('0xa')](_0x1894('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1894('0xa')](_0x1894('0xc'),auth[_0x1894('0x8')](),controller['getItems']);router[_0x1894('0xd')]('/',auth[_0x1894('0x8')](),controller['create']);router[_0x1894('0xd')]('/:id/clone',auth[_0x1894('0x8')](),controller[_0x1894('0xe')]);router[_0x1894('0xd')](_0x1894('0xc'),auth[_0x1894('0x8')](),controller[_0x1894('0xf')]);router['put'](_0x1894('0xb'),auth[_0x1894('0x8')](),controller['update']);router['delete'](_0x1894('0xb'),auth[_0x1894('0x8')](),controller[_0x1894('0x10')]);module[_0x1894('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6ffb87e..1cf7ea2 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 _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x1261,0x144));var _0x1126=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x1261[_0x3b2369];return _0x5a1367;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1623=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','exports','STRING','TEXT','long'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x1623,0xab));var _0x3162=function(_0x46eb63,_0x3f359f){_0x46eb63=_0x46eb63-0x0;var _0x56560a=_0x1623[_0x46eb63];return _0x56560a;};'use strict';var Sequelize=require(_0x3162('0x0'));var squel=require('squel');var _=require('lodash');module[_0x3162('0x1')]={'title':{'type':Sequelize[_0x3162('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x3162('0x5')));}catch(_0x4b77c4){return[];}},'set':function(_0x1b55f2){try{this[_0x3162('0x6')]('attrs',JSON[_0x3162('0x7')](_0x1b55f2));}catch(_0x2dc07e){this[_0x3162('0x6')](_0x3162('0x5'),JSON[_0x3162('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3162('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3162('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3162('0x2')],'allowNull':![],'defaultValue':_0x3162('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3162('0x2')]},'titleFontSize':{'type':Sequelize[_0x3162('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 262bd11..92c5940 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 _0x5334=['type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','DashboardItem','find','catch'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x5334,0x84));var _0x4533=function(_0x24ea15,_0x2c9d09){_0x24ea15=_0x24ea15-0x0;var _0x263466=_0x5334[_0x24ea15];return _0x263466;};'use strict';var emlformat=require(_0x4533('0x0'));var rimraf=require(_0x4533('0x1'));var zipdir=require(_0x4533('0x2'));var jsonpatch=require(_0x4533('0x3'));var rp=require(_0x4533('0x4'));var moment=require('moment');var BPromise=require(_0x4533('0x5'));var Mustache=require('mustache');var util=require(_0x4533('0x6'));var path=require(_0x4533('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4533('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4533('0x9'));var deskjs=require(_0x4533('0xa'));var toCsv=require(_0x4533('0xb'));var querystring=require(_0x4533('0xc'));var Papa=require(_0x4533('0xd'));var Redis=require(_0x4533('0xe'));var authService=require(_0x4533('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4533('0x10'));var hardwareService=require(_0x4533('0x11'));var logger=require(_0x4533('0x12'))(_0x4533('0x13'));var utils=require('../../config/utils');var config=require(_0x4533('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4533('0x15'))['db'];config[_0x4533('0x16')]=_[_0x4533('0x17')](config[_0x4533('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x4533('0x18'))(new Redis(config[_0x4533('0x16')]));require(_0x4533('0x19'))[_0x4533('0x1a')](socket);function respondWithStatusCode(_0x533a26,_0xe47213){_0xe47213=_0xe47213||0xcc;return function(_0x573d84){if(_0x573d84){return _0x533a26['sendStatus'](_0xe47213);}return _0x533a26[_0x4533('0x1b')](_0xe47213)[_0x4533('0x1c')]();};}function respondWithResult(_0x5da8b8,_0x30c68c){_0x30c68c=_0x30c68c||0xc8;return function(_0x1e6a1a){if(_0x1e6a1a){return _0x5da8b8[_0x4533('0x1b')](_0x30c68c)['json'](_0x1e6a1a);}};}function respondWithFilteredResult(_0x3ed873,_0x4f732e){return function(_0x3ddb36){if(_0x3ddb36){var _0x3d16a2=typeof _0x4f732e['offset']===_0x4533('0x1d')&&typeof _0x4f732e['limit']==='undefined';var _0x1c5cdd=_0x3ddb36[_0x4533('0x1e')];var _0x49fb91=_0x3d16a2?0x0:_0x4f732e['offset'];var _0x1abe1d=_0x3d16a2?_0x3ddb36[_0x4533('0x1e')]:_0x4f732e[_0x4533('0x1f')]+_0x4f732e[_0x4533('0x20')];var _0x6766eb;if(_0x1abe1d>=_0x1c5cdd){_0x1abe1d=_0x1c5cdd;_0x6766eb=0xc8;}else{_0x6766eb=0xce;}_0x3ed873[_0x4533('0x1b')](_0x6766eb);return _0x3ed873[_0x4533('0x21')]('Content-Range',_0x49fb91+'-'+_0x1abe1d+'/'+_0x1c5cdd)[_0x4533('0x22')](_0x3ddb36);}return null;};}function patchUpdates(_0xd55c04){return function(_0x2901f1){try{jsonpatch['apply'](_0x2901f1,_0xd55c04,!![]);}catch(_0x513011){return BPromise[_0x4533('0x23')](_0x513011);}return _0x2901f1[_0x4533('0x24')]();};}function saveUpdates(_0x4c640c,_0x5dcfd2){return function(_0x307bdd){if(_0x307bdd){return _0x307bdd[_0x4533('0x25')](_0x4c640c)[_0x4533('0x26')](function(_0x4d8189){return _0x4d8189;});}return null;};}function removeEntity(_0x44786f,_0x39b261){return function(_0x43eaa8){if(_0x43eaa8){return _0x43eaa8[_0x4533('0x27')]()[_0x4533('0x26')](function(){_0x44786f[_0x4533('0x1b')](0xcc)[_0x4533('0x1c')]();});}};}function handleEntityNotFound(_0x27b653,_0x45ad98){return function(_0x5f16bb){if(!_0x5f16bb){_0x27b653['sendStatus'](0x194);}return _0x5f16bb;};}function handleError(_0xa2e602,_0x5aaf2d){_0x5aaf2d=_0x5aaf2d||0x1f4;return function(_0x3fd76a){logger['error'](_0x3fd76a[_0x4533('0x28')]);if(_0x3fd76a[_0x4533('0x29')]){delete _0x3fd76a[_0x4533('0x29')];}_0xa2e602[_0x4533('0x1b')](_0x5aaf2d)[_0x4533('0x2a')](_0x3fd76a);};}exports[_0x4533('0x2b')]=function(_0xe584a2,_0xa58dd1){var _0x130566={'raw':![],'where':{'id':_0xe584a2[_0x4533('0x2c')]['id']}},_0x43682f={};_0x43682f[_0x4533('0x2d')]=_[_0x4533('0x2e')](db['DashboardItem'][_0x4533('0x2f')]);_0x43682f['query']=_[_0x4533('0x2e')](_0xe584a2[_0x4533('0x30')]);_0x43682f[_0x4533('0x31')]=_[_0x4533('0x32')](_0x43682f[_0x4533('0x2d')],_0x43682f[_0x4533('0x30')]);_0x130566[_0x4533('0x33')]=_[_0x4533('0x32')](_0x43682f[_0x4533('0x2d')],qs[_0x4533('0x34')](_0xe584a2[_0x4533('0x30')][_0x4533('0x34')]));_0x130566['attributes']=_0x130566[_0x4533('0x33')][_0x4533('0x35')]?_0x130566[_0x4533('0x33')]:_0x43682f[_0x4533('0x2d')];if(_0xe584a2[_0x4533('0x30')]['includeAll']){_0x130566[_0x4533('0x36')]=[{'all':!![]}];}_0x130566=_[_0x4533('0x37')]({},_0x130566,_0xe584a2[_0x4533('0x38')]);return db[_0x4533('0x39')][_0x4533('0x3a')](_0x130566)[_0x4533('0x26')](handleEntityNotFound(_0xa58dd1,null))['then'](respondWithResult(_0xa58dd1,null))[_0x4533('0x3b')](handleError(_0xa58dd1,null));};exports[_0x4533('0x27')]=function(_0x5d21f2,_0x3b6f10){return db[_0x4533('0x39')][_0x4533('0x3a')]({'where':{'id':_0x5d21f2[_0x4533('0x2c')]['id']}})[_0x4533('0x26')](handleEntityNotFound(_0x3b6f10,null))[_0x4533('0x26')](removeEntity(_0x3b6f10,null))[_0x4533('0x3b')](handleError(_0x3b6f10,null));};function widgetAttributes(_0x603753){try{switch(_0x603753[_0x4533('0x3c')]){case _0x4533('0x3d'):return[{'name':'attrUrl','value':_0x603753[_0x4533('0x3e')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x41')}];case _0x4533('0x42'):return[{'name':_0x4533('0x43'),'value':_0x603753[_0x4533('0x43')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x4533('0x44'),'value':_0x603753['attrHourFormat']||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x45')},{'name':_0x4533('0x46'),'value':_0x603753[_0x4533('0x46')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||_0x4533('0x47')},{'name':_0x4533('0x48'),'value':_0x603753['attrFontSize']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x2]?_0x603753['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x4533('0x49'),'value':_0x603753[_0x4533('0x49')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753['attrs'][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x4a')},{'name':_0x4533('0x4b'),'value':_0x603753[_0x4533('0x4b')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1]['value']:undefined)||[]},{'name':_0x4533('0x48'),'value':_0x603753['attrFontSize']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x2]?_0x603753[_0x4533('0x3f')][0x2][_0x4533('0x40')]:undefined)||0x14},{'name':_0x4533('0x4c'),'value':_0x603753['attrChannel']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x3]?_0x603753['attrs'][0x3][_0x4533('0x40')]:undefined)||_0x4533('0x4d')},{'name':'attrEmailAccounts','value':_0x603753['attrEmailAccounts']||(_0x603753['attrs']&&_0x603753['attrs'][0x4]?_0x603753['attrs'][0x4][_0x4533('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x603753[_0x4533('0x4e')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x5]?_0x603753['attrs'][0x5]['value']:undefined)||''},{'name':_0x4533('0x4f'),'value':_0x603753['attrSmsAccounts']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x6]?_0x603753[_0x4533('0x3f')][0x6][_0x4533('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x603753[_0x4533('0x50')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x7]?_0x603753[_0x4533('0x3f')][0x7][_0x4533('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x603753[_0x4533('0x51')]||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x8]?_0x603753[_0x4533('0x3f')][0x8][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x52'),'value':_0x603753[_0x4533('0x52')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x9]?_0x603753[_0x4533('0x3f')][0x9][_0x4533('0x40')]:undefined)||''}];case _0x4533('0x53'):case _0x4533('0x54'):return[{'name':_0x4533('0x55'),'value':_0x603753[_0x4533('0x55')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||'total'},{'name':_0x4533('0x56'),'value':_0x603753['attrSerie2']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||null},{'name':_0x4533('0x57'),'value':_0x603753['attrSerie3']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x2]?_0x603753['attrs'][0x2][_0x4533('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x603753[_0x4533('0x4b')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x3]?_0x603753[_0x4533('0x3f')][0x3][_0x4533('0x40')]:undefined)||[]},{'name':_0x4533('0x4c'),'value':_0x603753[_0x4533('0x4c')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x4]?_0x603753[_0x4533('0x3f')][0x4][_0x4533('0x40')]:undefined)||'voice'},{'name':_0x4533('0x58'),'value':_0x603753[_0x4533('0x58')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x5]?_0x603753[_0x4533('0x3f')][0x5][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x4e'),'value':_0x603753[_0x4533('0x4e')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x6]?_0x603753['attrs'][0x6]['value']:undefined)||''},{'name':_0x4533('0x4f'),'value':_0x603753[_0x4533('0x4f')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x7]?_0x603753[_0x4533('0x3f')][0x7][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x50'),'value':_0x603753[_0x4533('0x50')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x8]?_0x603753[_0x4533('0x3f')][0x8]['value']:undefined)||''},{'name':_0x4533('0x51'),'value':_0x603753['attrWhatsappAccounts']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x9]?_0x603753[_0x4533('0x3f')][0x9]['value']:undefined)||''},{'name':_0x4533('0x52'),'value':_0x603753[_0x4533('0x52')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0xa]?_0x603753[_0x4533('0x3f')][0xa][_0x4533('0x40')]:undefined)||''}];case _0x4533('0x59'):return[{'name':_0x4533('0x5a'),'type':_0x603753['reportType']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0]['type']:undefined)||null,'value':_0x603753[_0x4533('0x5a')]||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x0]?_0x603753['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x603753[_0x4533('0x5b')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||0x0}];default:return[];}}catch(_0xbf35f7){logger[_0x4533('0x5c')](_0x4533('0x5d'),JSON['stringify'](_0xbf35f7));return[];}}exports[_0x4533('0x5e')]=function(_0x1bd2da,_0x1b0414){if(_0x1bd2da[_0x4533('0x5f')]){_0x1bd2da['body']['attrs']=widgetAttributes(_0x1bd2da['body']);}return db[_0x4533('0x39')]['create'](_0x1bd2da[_0x4533('0x5f')],{})[_0x4533('0x26')](respondWithResult(_0x1b0414,0xc9))[_0x4533('0x3b')](handleError(_0x1b0414,null));};exports['update']=function(_0x31b10f,_0x50497f){if(_0x31b10f[_0x4533('0x5f')]['id']){delete _0x31b10f['body']['id'];}_0x31b10f[_0x4533('0x5f')][_0x4533('0x3f')]=widgetAttributes(_0x31b10f[_0x4533('0x5f')]);return db[_0x4533('0x39')][_0x4533('0x3a')]({'where':{'id':_0x31b10f['params']['id']}})[_0x4533('0x26')](handleEntityNotFound(_0x50497f,null))['then'](saveUpdates(_0x31b10f[_0x4533('0x5f')],null))[_0x4533('0x26')](respondWithResult(_0x50497f,null))['catch'](handleError(_0x50497f,null));}; \ No newline at end of file +var _0xe08b=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','DashboardItem','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrEmailAccounts','attrChatWebsites','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined'];(function(_0x195d6d,_0x4dcf97){var _0x148a0c=function(_0x376c36){while(--_0x376c36){_0x195d6d['push'](_0x195d6d['shift']());}};_0x148a0c(++_0x4dcf97);}(_0xe08b,0x10e));var _0xbe08=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe08b[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0xbe08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe08('0x1'));var jsonpatch=require(_0xbe08('0x2'));var rp=require('request-promise');var moment=require(_0xbe08('0x3'));var BPromise=require(_0xbe08('0x4'));var Mustache=require(_0xbe08('0x5'));var util=require(_0xbe08('0x6'));var path=require(_0xbe08('0x7'));var sox=require(_0xbe08('0x8'));var csv=require(_0xbe08('0x9'));var ejs=require(_0xbe08('0xa'));var fs=require('fs');var fs_extra=require(_0xbe08('0xb'));var _=require(_0xbe08('0xc'));var squel=require(_0xbe08('0xd'));var crypto=require(_0xbe08('0xe'));var jsforce=require(_0xbe08('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbe08('0x9'));var querystring=require(_0xbe08('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe08('0x11'));var authService=require(_0xbe08('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe08('0x13'));var hardwareService=require(_0xbe08('0x14'));var logger=require('../../config/logger')(_0xbe08('0x15'));var utils=require(_0xbe08('0x16'));var config=require(_0xbe08('0x17'));var licenseUtil=require(_0xbe08('0x18'));var db=require('../../mysqldb')['db'];config[_0xbe08('0x19')]=_['defaults'](config[_0xbe08('0x19')],{'host':_0xbe08('0x1a'),'port':0x18eb});var socket=require(_0xbe08('0x1b'))(new Redis(config[_0xbe08('0x19')]));require(_0xbe08('0x1c'))[_0xbe08('0x1d')](socket);function respondWithStatusCode(_0x434646,_0x58bd58){_0x58bd58=_0x58bd58||0xcc;return function(_0x20ab21){if(_0x20ab21){return _0x434646[_0xbe08('0x1e')](_0x58bd58);}return _0x434646[_0xbe08('0x1f')](_0x58bd58)[_0xbe08('0x20')]();};}function respondWithResult(_0x122f44,_0x1f4269){_0x1f4269=_0x1f4269||0xc8;return function(_0x337787){if(_0x337787){return _0x122f44[_0xbe08('0x1f')](_0x1f4269)[_0xbe08('0x21')](_0x337787);}};}function respondWithFilteredResult(_0x344019,_0x5e5037){return function(_0x2fa9b3){if(_0x2fa9b3){var _0xa1ebbd=typeof _0x5e5037[_0xbe08('0x22')]===_0xbe08('0x23')&&typeof _0x5e5037[_0xbe08('0x24')]===_0xbe08('0x23');var _0x1f9808=_0x2fa9b3['count'];var _0x16e8b4=_0xa1ebbd?0x0:_0x5e5037[_0xbe08('0x22')];var _0x5ca59b=_0xa1ebbd?_0x2fa9b3['count']:_0x5e5037[_0xbe08('0x22')]+_0x5e5037[_0xbe08('0x24')];var _0x3785e4;if(_0x5ca59b>=_0x1f9808){_0x5ca59b=_0x1f9808;_0x3785e4=0xc8;}else{_0x3785e4=0xce;}_0x344019['status'](_0x3785e4);return _0x344019[_0xbe08('0x25')](_0xbe08('0x26'),_0x16e8b4+'-'+_0x5ca59b+'/'+_0x1f9808)[_0xbe08('0x21')](_0x2fa9b3);}return null;};}function patchUpdates(_0x45697b){return function(_0x6d5ad1){try{jsonpatch[_0xbe08('0x27')](_0x6d5ad1,_0x45697b,!![]);}catch(_0xf1c94a){return BPromise[_0xbe08('0x28')](_0xf1c94a);}return _0x6d5ad1[_0xbe08('0x29')]();};}function saveUpdates(_0x493d13,_0x34421d){return function(_0x24acf0){if(_0x24acf0){return _0x24acf0[_0xbe08('0x2a')](_0x493d13)[_0xbe08('0x2b')](function(_0x3310be){return _0x3310be;});}return null;};}function removeEntity(_0x28d47b,_0x368122){return function(_0x32fb53){if(_0x32fb53){return _0x32fb53[_0xbe08('0x2c')]()[_0xbe08('0x2b')](function(){_0x28d47b['status'](0xcc)[_0xbe08('0x20')]();});}};}function handleEntityNotFound(_0x23100b,_0x27ed43){return function(_0x3aaf53){if(!_0x3aaf53){_0x23100b[_0xbe08('0x1e')](0x194);}return _0x3aaf53;};}function handleError(_0x1a6324,_0x59b445){_0x59b445=_0x59b445||0x1f4;return function(_0x415da3){logger[_0xbe08('0x2d')](_0x415da3[_0xbe08('0x2e')]);if(_0x415da3[_0xbe08('0x2f')]){delete _0x415da3[_0xbe08('0x2f')];}_0x1a6324['status'](_0x59b445)[_0xbe08('0x30')](_0x415da3);};}exports[_0xbe08('0x31')]=function(_0x43a7fc,_0x54c913){var _0x40ed27={'raw':![],'where':{'id':_0x43a7fc['params']['id']}},_0x31b820={};_0x31b820[_0xbe08('0x32')]=_[_0xbe08('0x33')](db['DashboardItem'][_0xbe08('0x34')]);_0x31b820[_0xbe08('0x35')]=_[_0xbe08('0x33')](_0x43a7fc[_0xbe08('0x35')]);_0x31b820[_0xbe08('0x36')]=_[_0xbe08('0x37')](_0x31b820[_0xbe08('0x32')],_0x31b820[_0xbe08('0x35')]);_0x40ed27[_0xbe08('0x38')]=_[_0xbe08('0x37')](_0x31b820[_0xbe08('0x32')],qs[_0xbe08('0x39')](_0x43a7fc[_0xbe08('0x35')][_0xbe08('0x39')]));_0x40ed27[_0xbe08('0x38')]=_0x40ed27['attributes']['length']?_0x40ed27[_0xbe08('0x38')]:_0x31b820[_0xbe08('0x32')];if(_0x43a7fc['query'][_0xbe08('0x3a')]){_0x40ed27[_0xbe08('0x3b')]=[{'all':!![]}];}_0x40ed27=_[_0xbe08('0x3c')]({},_0x40ed27,_0x43a7fc[_0xbe08('0x3d')]);return db['DashboardItem'][_0xbe08('0x3e')](_0x40ed27)[_0xbe08('0x2b')](handleEntityNotFound(_0x54c913,null))['then'](respondWithResult(_0x54c913,null))['catch'](handleError(_0x54c913,null));};exports[_0xbe08('0x2c')]=function(_0x30566a,_0x2d6ccc){return db[_0xbe08('0x3f')]['find']({'where':{'id':_0x30566a[_0xbe08('0x40')]['id']}})['then'](handleEntityNotFound(_0x2d6ccc,null))[_0xbe08('0x2b')](removeEntity(_0x2d6ccc,null))[_0xbe08('0x41')](handleError(_0x2d6ccc,null));};function widgetAttributes(_0x587769){try{switch(_0x587769[_0xbe08('0x42')]){case _0xbe08('0x43'):return[{'name':_0xbe08('0x44'),'value':_0x587769[_0xbe08('0x44')]||(_0x587769[_0xbe08('0x45')]&&_0x587769['attrs'][0x0]?_0x587769[_0xbe08('0x45')][0x0][_0xbe08('0x46')]:undefined)||_0xbe08('0x47')}];case _0xbe08('0x48'):return[{'name':_0xbe08('0x49'),'value':_0x587769[_0xbe08('0x49')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x0]?_0x587769[_0xbe08('0x45')][0x0]['value']:undefined)||''}];case _0xbe08('0x4a'):return[{'name':_0xbe08('0x4b'),'value':_0x587769['attrHourFormat']||(_0x587769['attrs']&&_0x587769[_0xbe08('0x45')][0x0]?_0x587769['attrs'][0x0][_0xbe08('0x46')]:undefined)||'HH:mm:ss'},{'name':_0xbe08('0x4c'),'value':_0x587769[_0xbe08('0x4c')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x1]?_0x587769[_0xbe08('0x45')][0x1][_0xbe08('0x46')]:undefined)||_0xbe08('0x4d')},{'name':'attrFontSize','value':_0x587769[_0xbe08('0x4e')]||(_0x587769[_0xbe08('0x45')]&&_0x587769['attrs'][0x2]?_0x587769['attrs'][0x2]['value']:undefined)||0xc}];case _0xbe08('0x4f'):return[{'name':_0xbe08('0x50'),'value':_0x587769['attrMetric']||(_0x587769['attrs']&&_0x587769[_0xbe08('0x45')][0x0]?_0x587769[_0xbe08('0x45')][0x0][_0xbe08('0x46')]:undefined)||_0xbe08('0x51')},{'name':_0xbe08('0x52'),'value':_0x587769[_0xbe08('0x52')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x1]?_0x587769['attrs'][0x1][_0xbe08('0x46')]:undefined)||[]},{'name':_0xbe08('0x4e'),'value':_0x587769[_0xbe08('0x4e')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x2]?_0x587769[_0xbe08('0x45')][0x2][_0xbe08('0x46')]:undefined)||0x14},{'name':'attrChannel','value':_0x587769['attrChannel']||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x3]?_0x587769[_0xbe08('0x45')][0x3][_0xbe08('0x46')]:undefined)||_0xbe08('0x53')},{'name':'attrEmailAccounts','value':_0x587769['attrEmailAccounts']||(_0x587769['attrs']&&_0x587769[_0xbe08('0x45')][0x4]?_0x587769['attrs'][0x4]['value']:undefined)||''},{'name':_0xbe08('0x54'),'value':_0x587769[_0xbe08('0x54')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x5]?_0x587769[_0xbe08('0x45')][0x5][_0xbe08('0x46')]:undefined)||''},{'name':_0xbe08('0x55'),'value':_0x587769[_0xbe08('0x55')]||(_0x587769['attrs']&&_0x587769[_0xbe08('0x45')][0x6]?_0x587769[_0xbe08('0x45')][0x6][_0xbe08('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x587769[_0xbe08('0x56')]||(_0x587769[_0xbe08('0x45')]&&_0x587769['attrs'][0x7]?_0x587769[_0xbe08('0x45')][0x7][_0xbe08('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x587769[_0xbe08('0x57')]||(_0x587769[_0xbe08('0x45')]&&_0x587769['attrs'][0x8]?_0x587769['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x587769['attrChatWebsites']||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x9]?_0x587769['attrs'][0x9]['value']:undefined)||''}];case _0xbe08('0x58'):case _0xbe08('0x59'):return[{'name':_0xbe08('0x5a'),'value':_0x587769[_0xbe08('0x5a')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x0]?_0x587769[_0xbe08('0x45')][0x0][_0xbe08('0x46')]:undefined)||_0xbe08('0x51')},{'name':'attrSerie2','value':_0x587769[_0xbe08('0x5b')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x1]?_0x587769[_0xbe08('0x45')][0x1][_0xbe08('0x46')]:undefined)||null},{'name':'attrSerie3','value':_0x587769[_0xbe08('0x5c')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x2]?_0x587769[_0xbe08('0x45')][0x2][_0xbe08('0x46')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x587769[_0xbe08('0x52')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x3]?_0x587769[_0xbe08('0x45')][0x3][_0xbe08('0x46')]:undefined)||[]},{'name':_0xbe08('0x5d'),'value':_0x587769['attrChannel']||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x4]?_0x587769[_0xbe08('0x45')][0x4][_0xbe08('0x46')]:undefined)||_0xbe08('0x53')},{'name':'attrEmailAccounts','value':_0x587769[_0xbe08('0x5e')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x5]?_0x587769['attrs'][0x5]['value']:undefined)||''},{'name':_0xbe08('0x54'),'value':_0x587769[_0xbe08('0x54')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x6]?_0x587769[_0xbe08('0x45')][0x6][_0xbe08('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x587769[_0xbe08('0x55')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x7]?_0x587769['attrs'][0x7][_0xbe08('0x46')]:undefined)||''},{'name':_0xbe08('0x56'),'value':_0x587769[_0xbe08('0x56')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x8]?_0x587769[_0xbe08('0x45')][0x8][_0xbe08('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x587769[_0xbe08('0x57')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x9]?_0x587769[_0xbe08('0x45')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x587769[_0xbe08('0x5f')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0xa]?_0x587769[_0xbe08('0x45')][0xa][_0xbe08('0x46')]:undefined)||''}];case'web-report':return[{'name':_0xbe08('0x60'),'type':_0x587769[_0xbe08('0x61')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x0]?_0x587769[_0xbe08('0x45')][0x0][_0xbe08('0x42')]:undefined)||null,'value':_0x587769['attrReport']||(_0x587769[_0xbe08('0x45')]&&_0x587769['attrs'][0x0]?_0x587769[_0xbe08('0x45')][0x0][_0xbe08('0x46')]:undefined)||null},{'name':_0xbe08('0x62'),'value':_0x587769[_0xbe08('0x62')]||(_0x587769[_0xbe08('0x45')]&&_0x587769[_0xbe08('0x45')][0x1]?_0x587769[_0xbe08('0x45')][0x1][_0xbe08('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x34cdba){logger[_0xbe08('0x2d')]('widgetAttributes:\x20%s',JSON[_0xbe08('0x63')](_0x34cdba));return[];}}exports[_0xbe08('0x64')]=function(_0x236659,_0x289ab6){if(_0x236659['body']){_0x236659['body'][_0xbe08('0x45')]=widgetAttributes(_0x236659[_0xbe08('0x65')]);}return db[_0xbe08('0x3f')][_0xbe08('0x64')](_0x236659[_0xbe08('0x65')],{})[_0xbe08('0x2b')](respondWithResult(_0x289ab6,0xc9))[_0xbe08('0x41')](handleError(_0x289ab6,null));};exports[_0xbe08('0x2a')]=function(_0x25df50,_0x462aaf){if(_0x25df50[_0xbe08('0x65')]['id']){delete _0x25df50['body']['id'];}_0x25df50['body']['attrs']=widgetAttributes(_0x25df50['body']);return db[_0xbe08('0x3f')][_0xbe08('0x3e')]({'where':{'id':_0x25df50[_0xbe08('0x40')]['id']}})[_0xbe08('0x2b')](handleEntityNotFound(_0x462aaf,null))[_0xbe08('0x2b')](saveUpdates(_0x25df50[_0xbe08('0x65')],null))[_0xbe08('0x2b')](respondWithResult(_0x462aaf,null))[_0xbe08('0x41')](handleError(_0x462aaf,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 2ce0ea6..e9bf058 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 _0x1328=['setMaxListeners','save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1328,0x11d));var _0x8132=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x1328[_0x33032e];return _0x13316b;};'use strict';var EventEmitter=require(_0x8132('0x0'));var DashboardItem=require(_0x8132('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8132('0x2')](0x0);var events={'afterCreate':_0x8132('0x3'),'afterUpdate':_0x8132('0x4'),'afterDestroy':_0x8132('0x5')};function emitEvent(_0x20b1d7){return function(_0x438566,_0x52c498,_0x1b9957){DashboardItemEvents['emit'](_0x20b1d7+':'+_0x438566['id'],_0x438566);DashboardItemEvents['emit'](_0x20b1d7,_0x438566);_0x1b9957(null);};}for(var e in events){if(events[_0x8132('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x75dd=['DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x585e82,_0xda55e8){var _0x3a8899=function(_0xe1874f){while(--_0xe1874f){_0x585e82['push'](_0x585e82['shift']());}};_0x3a8899(++_0xda55e8);}(_0x75dd,0x1c9));var _0xd75d=function(_0x4b89a8,_0x491d0a){_0x4b89a8=_0x4b89a8-0x0;var _0x4bb62c=_0x75dd[_0x4b89a8];return _0x4bb62c;};'use strict';var EventEmitter=require(_0xd75d('0x0'));var DashboardItem=require(_0xd75d('0x1'))['db'][_0xd75d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd75d('0x3')](0x0);var events={'afterCreate':_0xd75d('0x4'),'afterUpdate':_0xd75d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x8515ac){return function(_0x1db51b,_0x468082,_0xcb99e){DashboardItemEvents[_0xd75d('0x6')](_0x8515ac+':'+_0x1db51b['id'],_0x1db51b);DashboardItemEvents[_0xd75d('0x6')](_0x8515ac,_0x1db51b);_0xcb99e(null);};}for(var e in events){if(events[_0xd75d('0x7')](e)){var event=events[e];DashboardItem[_0xd75d('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 24debc4..a054d6c 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 _0x6523=['DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define'];(function(_0x303fed,_0x5eecd3){var _0x1d9585=function(_0x5ab3b5){while(--_0x5ab3b5){_0x303fed['push'](_0x303fed['shift']());}};_0x1d9585(++_0x5eecd3);}(_0x6523,0x1a6));var _0x3652=function(_0x482e30,_0x11c205){_0x482e30=_0x482e30-0x0;var _0x59bf70=_0x6523[_0x482e30];return _0x59bf70;};'use strict';var _=require(_0x3652('0x0'));var util=require(_0x3652('0x1'));var logger=require('../../config/logger')(_0x3652('0x2'));var moment=require(_0x3652('0x3'));var BPromise=require(_0x3652('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3652('0x5'));var rimraf=require(_0x3652('0x6'));var config=require(_0x3652('0x7'));var attributes=require(_0x3652('0x8'));module['exports']=function(_0x204f81,_0x18f1c3){return _0x204f81[_0x3652('0x9')](_0x3652('0xa'),attributes,{'tableName':_0x3652('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x269f=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util'];(function(_0xec9d4c,_0xba0215){var _0x312109=function(_0x592bee){while(--_0x592bee){_0xec9d4c['push'](_0xec9d4c['shift']());}};_0x312109(++_0xba0215);}(_0x269f,0xee));var _0xf269=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x269f[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xf269('0x0'));var util=require(_0xf269('0x1'));var logger=require(_0xf269('0x2'))('api');var moment=require(_0xf269('0x3'));var BPromise=require('bluebird');var rp=require(_0xf269('0x4'));var fs=require('fs');var path=require(_0xf269('0x5'));var rimraf=require(_0xf269('0x6'));var config=require(_0xf269('0x7'));var attributes=require(_0xf269('0x8'));module['exports']=function(_0x2969ef,_0x32066d){return _0x2969ef[_0xf269('0x9')](_0xf269('0xa'),attributes,{'tableName':_0xf269('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 4bfc5c7..a1ee24b 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 _0xf1ce=['request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','DashboardItem,\x20%s,\x20%s'];(function(_0x50ec3e,_0x47bf99){var _0x41c2bc=function(_0x79e4ec){while(--_0x79e4ec){_0x50ec3e['push'](_0x50ec3e['shift']());}};_0x41c2bc(++_0x47bf99);}(_0xf1ce,0x166));var _0xef1c=function(_0x767c9c,_0x38a982){_0x767c9c=_0x767c9c-0x0;var _0x175a73=_0xf1ce[_0x767c9c];return _0x175a73;};'use strict';var _=require(_0xef1c('0x0'));var util=require(_0xef1c('0x1'));var moment=require(_0xef1c('0x2'));var BPromise=require(_0xef1c('0x3'));var rs=require(_0xef1c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef1c('0x5'))['db'];var utils=require(_0xef1c('0x6'));var logger=require('../../config/logger')(_0xef1c('0x7'));var config=require(_0xef1c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef1c('0x9')][_0xef1c('0xa')]({'port':0x232a});config[_0xef1c('0xb')]=_['defaults'](config[_0xef1c('0xb')],{'host':_0xef1c('0xc'),'port':0x18eb});var socket=require(_0xef1c('0xd'))(new Redis(config[_0xef1c('0xb')]));require(_0xef1c('0xe'))['register'](socket);function respondWithRpcPromise(_0x2956a4,_0x337bd2,_0xab0185){return new BPromise(function(_0x1c9a7f,_0x192368){return client[_0xef1c('0xf')](_0x2956a4,_0xab0185)['then'](function(_0x415062){logger['info'](_0xef1c('0x10'),_0x337bd2,_0xef1c('0x11'));logger['debug'](_0xef1c('0x12'),_0x337bd2,_0xef1c('0x11'),JSON[_0xef1c('0x13')](_0x415062));if(_0x415062[_0xef1c('0x14')]){if(_0x415062[_0xef1c('0x14')][_0xef1c('0x15')]===0x1f4){logger[_0xef1c('0x14')](_0xef1c('0x10'),_0x337bd2,_0x415062[_0xef1c('0x14')][_0xef1c('0x16')]);return _0x192368(_0x415062[_0xef1c('0x14')][_0xef1c('0x16')]);}logger[_0xef1c('0x14')](_0xef1c('0x10'),_0x337bd2,_0x415062[_0xef1c('0x14')][_0xef1c('0x16')]);return _0x1c9a7f(_0x415062['error'][_0xef1c('0x16')]);}else{logger[_0xef1c('0x17')](_0xef1c('0x10'),_0x337bd2,_0xef1c('0x11'));_0x1c9a7f(_0x415062['result']['message']);}})[_0xef1c('0x18')](function(_0xcfb95e){logger[_0xef1c('0x14')](_0xef1c('0x10'),_0x337bd2,_0xcfb95e);_0x192368(_0xcfb95e);});});} \ No newline at end of file +var _0x82e1=['../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','lodash','moment','bluebird','randomstring'];(function(_0x20e071,_0x1fd0e9){var _0x471ec4=function(_0x59ada2){while(--_0x59ada2){_0x20e071['push'](_0x20e071['shift']());}};_0x471ec4(++_0x1fd0e9);}(_0x82e1,0x1d0));var _0x182e=function(_0x486f1d,_0x90c2b5){_0x486f1d=_0x486f1d-0x0;var _0x5a2c2d=_0x82e1[_0x486f1d];return _0x5a2c2d;};'use strict';var _=require(_0x182e('0x0'));var util=require('util');var moment=require(_0x182e('0x1'));var BPromise=require(_0x182e('0x2'));var rs=require(_0x182e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x182e('0x4'));var logger=require(_0x182e('0x5'))('rpc');var config=require(_0x182e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x182e('0x7')][_0x182e('0x8')]({'port':0x232a});config['redis']=_[_0x182e('0x9')](config[_0x182e('0xa')],{'host':_0x182e('0xb'),'port':0x18eb});var socket=require(_0x182e('0xc'))(new Redis(config['redis']));require(_0x182e('0xd'))[_0x182e('0xe')](socket);function respondWithRpcPromise(_0x166410,_0x6cd4dc,_0x25c7ce){return new BPromise(function(_0x394daf,_0x44ca6b){return client[_0x182e('0xf')](_0x166410,_0x25c7ce)[_0x182e('0x10')](function(_0x264d7b){logger[_0x182e('0x11')](_0x182e('0x12'),_0x6cd4dc,'request\x20sent');logger[_0x182e('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x6cd4dc,'request\x20sent',JSON[_0x182e('0x14')](_0x264d7b));if(_0x264d7b['error']){if(_0x264d7b['error'][_0x182e('0x15')]===0x1f4){logger[_0x182e('0x16')](_0x182e('0x12'),_0x6cd4dc,_0x264d7b[_0x182e('0x16')][_0x182e('0x17')]);return _0x44ca6b(_0x264d7b[_0x182e('0x16')]['message']);}logger[_0x182e('0x16')](_0x182e('0x12'),_0x6cd4dc,_0x264d7b[_0x182e('0x16')][_0x182e('0x17')]);return _0x394daf(_0x264d7b[_0x182e('0x16')][_0x182e('0x17')]);}else{logger[_0x182e('0x11')]('DashboardItem,\x20%s,\x20%s',_0x6cd4dc,_0x182e('0x18'));_0x394daf(_0x264d7b[_0x182e('0x19')][_0x182e('0x17')]);}})['catch'](function(_0x1baeb3){logger[_0x182e('0x16')](_0x182e('0x12'),_0x6cd4dc,_0x1baeb3);_0x44ca6b(_0x1baeb3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d41738b..2e981d0 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 _0xd31e=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x1532b3,_0x119091){var _0x496061=function(_0x4c3fa3){while(--_0x4c3fa3){_0x1532b3['push'](_0x1532b3['shift']());}};_0x496061(++_0x119091);}(_0xd31e,0x9e));var _0xed31=function(_0x1c999a,_0xf8663a){_0x1c999a=_0x1c999a-0x0;var _0x7b159=_0xd31e[_0x1c999a];return _0x7b159;};'use strict';var DashboardItemEvents=require(_0xed31('0x0'));var events=[_0xed31('0x1'),'remove',_0xed31('0x2')];function createListener(_0x4e35cc,_0x10c2bd){return function(_0x503d67){_0x10c2bd[_0xed31('0x3')](_0x4e35cc,_0x503d67);};}function removeListener(_0x1e6c82,_0x4576a8){return function(){DashboardItemEvents[_0xed31('0x4')](_0x1e6c82,_0x4576a8);};}exports[_0xed31('0x5')]=function(_0x46ee0b){for(var _0x31ebbe=0x0,_0x309747=events[_0xed31('0x6')];_0x31ebbe<_0x309747;_0x31ebbe++){var _0x16c213=events[_0x31ebbe];var _0xac5d9a=createListener(_0xed31('0x7')+_0x16c213,_0x46ee0b);DashboardItemEvents['on'](_0x16c213,_0xac5d9a);}}; \ No newline at end of file +var _0xc82f=['dashboardItem:','./dashboardItem.events','remove','update','removeListener','register','length'];(function(_0x17e21e,_0x1b0042){var _0x397727=function(_0x3e9310){while(--_0x3e9310){_0x17e21e['push'](_0x17e21e['shift']());}};_0x397727(++_0x1b0042);}(_0xc82f,0xda));var _0xfc82=function(_0xc0a532,_0x3f7e76){_0xc0a532=_0xc0a532-0x0;var _0x1bf3f5=_0xc82f[_0xc0a532];return _0x1bf3f5;};'use strict';var DashboardItemEvents=require(_0xfc82('0x0'));var events=['save',_0xfc82('0x1'),_0xfc82('0x2')];function createListener(_0x2438ac,_0x24af14){return function(_0xdeced0){_0x24af14['emit'](_0x2438ac,_0xdeced0);};}function removeListener(_0xeedaf,_0x263d05){return function(){DashboardItemEvents[_0xfc82('0x3')](_0xeedaf,_0x263d05);};}exports[_0xfc82('0x4')]=function(_0x21f814){for(var _0x1d9b2b=0x0,_0x369aaa=events[_0xfc82('0x5')];_0x1d9b2b<_0x369aaa;_0x1d9b2b++){var _0xd44343=events[_0x1d9b2b];var _0x429efd=createListener(_0xfc82('0x6')+_0xd44343,_0x21f814);DashboardItemEvents['on'](_0xd44343,_0x429efd);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c27e5b5..36524d0 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 _0xc44c=['multer','express','fs-extra','../../config/environment','get','/:id','isAuthenticated','show','create','put','update','delete','exports'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xc44c,0x82));var _0xcc44=function(_0xe5324f,_0x4d3030){_0xe5324f=_0xe5324f-0x0;var _0x4ad17d=_0xc44c[_0xe5324f];return _0x4ad17d;};'use strict';var multer=require(_0xcc44('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc44('0x1'));var router=express['Router']();var fs_extra=require(_0xcc44('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc44('0x3'));var controller=require('./dashboardItem.controller');router[_0xcc44('0x4')](_0xcc44('0x5'),auth[_0xcc44('0x6')](),controller[_0xcc44('0x7')]);router['post']('/',auth[_0xcc44('0x6')](),controller[_0xcc44('0x8')]);router[_0xcc44('0x9')]('/:id',auth[_0xcc44('0x6')](),controller[_0xcc44('0xa')]);router[_0xcc44('0xb')](_0xcc44('0x5'),auth[_0xcc44('0x6')](),controller['destroy']);module[_0xcc44('0xc')]=router; \ No newline at end of file +var _0x511c=['fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x511c,0x1bc));var _0xc511=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0x511c[_0xc753c8];return _0xd02f5c;};'use strict';var multer=require('multer');var util=require(_0xc511('0x0'));var path=require(_0xc511('0x1'));var timeout=require(_0xc511('0x2'));var express=require(_0xc511('0x3'));var router=express['Router']();var fs_extra=require(_0xc511('0x4'));var auth=require(_0xc511('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc511('0x6'));var controller=require(_0xc511('0x7'));router[_0xc511('0x8')](_0xc511('0x9'),auth[_0xc511('0xa')](),controller['show']);router[_0xc511('0xb')]('/',auth[_0xc511('0xa')](),controller[_0xc511('0xc')]);router['put'](_0xc511('0x9'),auth[_0xc511('0xa')](),controller['update']);router[_0xc511('0xd')]('/:id',auth[_0xc511('0xa')](),controller[_0xc511('0xe')]);module[_0xc511('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a534605..a5a7eb8 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 _0x99e1=['ENUM','first','second','third','STRING'];(function(_0x395fea,_0x40a421){var _0x54b58c=function(_0xd48750){while(--_0xd48750){_0x395fea['push'](_0x395fea['shift']());}};_0x54b58c(++_0x40a421);}(_0x99e1,0x1df));var _0x199e=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x99e1[_0x238671];return _0x474844;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x199e('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x199e('0x1')](_0x199e('0x2'),_0x199e('0x3'),_0x199e('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x199e('0x0')]}}; \ No newline at end of file +var _0x4fd6=['exports','STRING','ENUM','first','second'];(function(_0x35e06d,_0xad434c){var _0x1b7a39=function(_0x40efcb){while(--_0x40efcb){_0x35e06d['push'](_0x35e06d['shift']());}};_0x1b7a39(++_0xad434c);}(_0x4fd6,0x113));var _0x64fd=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x4fd6[_0x104e21];return _0x605b37;};'use strict';var Sequelize=require('sequelize');module[_0x64fd('0x0')]={'name':{'type':Sequelize[_0x64fd('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x64fd('0x2')](_0x64fd('0x3'),_0x64fd('0x4'),'third'),'allowNull':![],'defaultValue':_0x64fd('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e99ed6b..368f017 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 _0x46aa=['type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','rimraf','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Dispositions','UserProfileResource','error','name','index','Disposition','rawAttributes','fieldName'];(function(_0x48ba18,_0xef974d){var _0x2b104f=function(_0x11c675){while(--_0x11c675){_0x48ba18['push'](_0x48ba18['shift']());}};_0x2b104f(++_0xef974d);}(_0x46aa,0xcb));var _0xa46a=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x46aa[_0x11c573];return _0x6b72de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa46a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa46a('0x1'));var rp=require(_0xa46a('0x2'));var moment=require(_0xa46a('0x3'));var BPromise=require(_0xa46a('0x4'));var Mustache=require(_0xa46a('0x5'));var util=require(_0xa46a('0x6'));var path=require(_0xa46a('0x7'));var sox=require(_0xa46a('0x8'));var csv=require(_0xa46a('0x9'));var ejs=require(_0xa46a('0xa'));var fs=require('fs');var fs_extra=require(_0xa46a('0xb'));var _=require(_0xa46a('0xc'));var squel=require('squel');var crypto=require(_0xa46a('0xd'));var jsforce=require(_0xa46a('0xe'));var deskjs=require(_0xa46a('0xf'));var toCsv=require(_0xa46a('0x9'));var querystring=require('querystring');var Papa=require(_0xa46a('0x10'));var Redis=require(_0xa46a('0x11'));var authService=require(_0xa46a('0x12'));var qs=require(_0xa46a('0x13'));var as=require(_0xa46a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa46a('0x15'))(_0xa46a('0x16'));var utils=require('../../config/utils');var config=require(_0xa46a('0x17'));var licenseUtil=require(_0xa46a('0x18'));var db=require(_0xa46a('0x19'))['db'];function respondWithStatusCode(_0x3f9fe1,_0x2720c4){_0x2720c4=_0x2720c4||0xcc;return function(_0x2eda0b){if(_0x2eda0b){return _0x3f9fe1[_0xa46a('0x1a')](_0x2720c4);}return _0x3f9fe1[_0xa46a('0x1b')](_0x2720c4)[_0xa46a('0x1c')]();};}function respondWithResult(_0x35d9ef,_0x447e77){_0x447e77=_0x447e77||0xc8;return function(_0x29577b){if(_0x29577b){return _0x35d9ef[_0xa46a('0x1b')](_0x447e77)[_0xa46a('0x1d')](_0x29577b);}};}function respondWithFilteredResult(_0x43626e,_0x16bff4){return function(_0x362b80){if(_0x362b80){var _0x1bdd55=typeof _0x16bff4[_0xa46a('0x1e')]===_0xa46a('0x1f')&&typeof _0x16bff4[_0xa46a('0x20')]===_0xa46a('0x1f');var _0x4867c1=_0x362b80[_0xa46a('0x21')];var _0x4fdc40=_0x1bdd55?0x0:_0x16bff4[_0xa46a('0x1e')];var _0x529921=_0x1bdd55?_0x362b80[_0xa46a('0x21')]:_0x16bff4['offset']+_0x16bff4[_0xa46a('0x20')];var _0x56bd73;if(_0x529921>=_0x4867c1){_0x529921=_0x4867c1;_0x56bd73=0xc8;}else{_0x56bd73=0xce;}_0x43626e[_0xa46a('0x1b')](_0x56bd73);return _0x43626e[_0xa46a('0x22')]('Content-Range',_0x4fdc40+'-'+_0x529921+'/'+_0x4867c1)[_0xa46a('0x1d')](_0x362b80);}return null;};}function patchUpdates(_0x379a08){return function(_0x5d1dfc){try{jsonpatch[_0xa46a('0x23')](_0x5d1dfc,_0x379a08,!![]);}catch(_0x1c6c8f){return BPromise[_0xa46a('0x24')](_0x1c6c8f);}return _0x5d1dfc[_0xa46a('0x25')]();};}function saveUpdates(_0x441837,_0x3d491e){return function(_0x24bc6a){if(_0x24bc6a){return _0x24bc6a['update'](_0x441837)['then'](function(_0x4c0500){return _0x4c0500;});}return null;};}function removeEntity(_0x668e0f,_0xe2f0b5){return function(_0x437dee){if(_0x437dee){return _0x437dee[_0xa46a('0x26')]()[_0xa46a('0x27')](function(){var _0x3eaa47=_0x437dee[_0xa46a('0x28')]({'plain':!![]});var _0x202f91=_0xa46a('0x29');return db[_0xa46a('0x2a')][_0xa46a('0x26')]({'where':{'type':_0x202f91,'resourceId':_0x3eaa47['id']}})['then'](function(){return _0x437dee;});})[_0xa46a('0x27')](function(){_0x668e0f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec51a,_0x344924){return function(_0x1c3c04){if(!_0x1c3c04){_0x2ec51a[_0xa46a('0x1a')](0x194);}return _0x1c3c04;};}function handleError(_0x375f1e,_0x4079aa){_0x4079aa=_0x4079aa||0x1f4;return function(_0xfeb33d){logger[_0xa46a('0x2b')](_0xfeb33d['stack']);if(_0xfeb33d['name']){delete _0xfeb33d[_0xa46a('0x2c')];}_0x375f1e[_0xa46a('0x1b')](_0x4079aa)['send'](_0xfeb33d);};}exports[_0xa46a('0x2d')]=function(_0x4f7ba5,_0x28780c){var _0x5a4219={},_0xe807b6={},_0x350fec={'count':0x0,'rows':[]};var _0x9235cb=_['map'](db[_0xa46a('0x2e')][_0xa46a('0x2f')],function(_0x313f62){return{'name':_0x313f62[_0xa46a('0x30')],'type':_0x313f62[_0xa46a('0x31')]['key']};});_0xe807b6['model']=_['map'](_0x9235cb,_0xa46a('0x2c'));_0xe807b6[_0xa46a('0x32')]=_[_0xa46a('0x33')](_0x4f7ba5[_0xa46a('0x32')]);_0xe807b6[_0xa46a('0x34')]=_[_0xa46a('0x35')](_0xe807b6[_0xa46a('0x36')],_0xe807b6[_0xa46a('0x32')]);_0x5a4219[_0xa46a('0x37')]=_[_0xa46a('0x35')](_0xe807b6[_0xa46a('0x36')],qs[_0xa46a('0x38')](_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x38')]));_0x5a4219[_0xa46a('0x37')]=_0x5a4219[_0xa46a('0x37')]['length']?_0x5a4219[_0xa46a('0x37')]:_0xe807b6['model'];if(!_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x39')](_0xa46a('0x3a'))){_0x5a4219[_0xa46a('0x20')]=qs[_0xa46a('0x20')](_0x4f7ba5['query'][_0xa46a('0x20')]);_0x5a4219['offset']=qs[_0xa46a('0x1e')](_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x1e')]);}_0x5a4219['order']=qs[_0xa46a('0x3b')](_0x4f7ba5[_0xa46a('0x32')]['sort']);_0x5a4219[_0xa46a('0x3c')]=qs['filters'](_[_0xa46a('0x3d')](_0x4f7ba5['query'],_0xe807b6[_0xa46a('0x34')]),_0x9235cb);if(_0x4f7ba5[_0xa46a('0x32')]['filter']){_0x5a4219[_0xa46a('0x3c')]=_[_0xa46a('0x3e')](_0x5a4219['where'],{'$or':_[_0xa46a('0x3f')](_0x9235cb,function(_0x3f48ba){if(_0x3f48ba[_0xa46a('0x31')]!==_0xa46a('0x40')){var _0x518732={};_0x518732[_0x3f48ba[_0xa46a('0x2c')]]={'$like':'%'+_0x4f7ba5[_0xa46a('0x32')]['filter']+'%'};return _0x518732;}})});}_0x5a4219=_[_0xa46a('0x3e')]({},_0x5a4219,_0x4f7ba5[_0xa46a('0x41')]);var _0x1bd8f2={'where':_0x5a4219[_0xa46a('0x3c')]};return db['Disposition'][_0xa46a('0x21')](_0x1bd8f2)['then'](function(_0x2ef5ef){_0x350fec[_0xa46a('0x21')]=_0x2ef5ef;if(_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x42')]){_0x5a4219[_0xa46a('0x43')]=[{'all':!![]}];}return db[_0xa46a('0x2e')][_0xa46a('0x44')](_0x5a4219);})[_0xa46a('0x27')](function(_0x27aca7){_0x350fec[_0xa46a('0x45')]=_0x27aca7;return _0x350fec;})[_0xa46a('0x27')](respondWithFilteredResult(_0x28780c,_0x5a4219))[_0xa46a('0x46')](handleError(_0x28780c,null));};exports[_0xa46a('0x47')]=function(_0x54bbfb,_0x1d5811){var _0x329015={'raw':!![],'where':{'id':_0x54bbfb['params']['id']}},_0x3cd4d1={};_0x3cd4d1[_0xa46a('0x36')]=_[_0xa46a('0x33')](db[_0xa46a('0x2e')]['rawAttributes']);_0x3cd4d1[_0xa46a('0x32')]=_['keys'](_0x54bbfb[_0xa46a('0x32')]);_0x3cd4d1[_0xa46a('0x34')]=_[_0xa46a('0x35')](_0x3cd4d1[_0xa46a('0x36')],_0x3cd4d1['query']);_0x329015['attributes']=_[_0xa46a('0x35')](_0x3cd4d1['model'],qs[_0xa46a('0x38')](_0x54bbfb[_0xa46a('0x32')][_0xa46a('0x38')]));_0x329015[_0xa46a('0x37')]=_0x329015['attributes'][_0xa46a('0x48')]?_0x329015[_0xa46a('0x37')]:_0x3cd4d1[_0xa46a('0x36')];if(_0x54bbfb['query'][_0xa46a('0x42')]){_0x329015[_0xa46a('0x43')]=[{'all':!![]}];}_0x329015=_[_0xa46a('0x3e')]({},_0x329015,_0x54bbfb['options']);return db[_0xa46a('0x2e')][_0xa46a('0x49')](_0x329015)['then'](handleEntityNotFound(_0x1d5811,null))[_0xa46a('0x27')](respondWithResult(_0x1d5811,null))[_0xa46a('0x46')](handleError(_0x1d5811,null));};exports[_0xa46a('0x4a')]=function(_0x1d0265,_0x2ba18a){return db[_0xa46a('0x2e')][_0xa46a('0x4a')](_0x1d0265['body'],{})[_0xa46a('0x27')](function(_0x1b28ad){var _0x25f44c=_0x1d0265[_0xa46a('0x4b')][_0xa46a('0x28')]({'plain':!![]});if(!_0x25f44c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25f44c[_0xa46a('0x4c')]===_0xa46a('0x4b')){var _0x2688b8=_0x1b28ad[_0xa46a('0x28')]({'plain':!![]});var _0x2609be=_0xa46a('0x29');return db[_0xa46a('0x4d')][_0xa46a('0x49')]({'where':{'name':_0x2609be,'userProfileId':_0x25f44c[_0xa46a('0x4e')]},'raw':!![]})[_0xa46a('0x27')](function(_0x2f1530){if(_0x2f1530&&_0x2f1530[_0xa46a('0x4f')]===0x0){return db[_0xa46a('0x2a')]['create']({'name':_0x2688b8[_0xa46a('0x2c')],'resourceId':_0x2688b8['id'],'type':_0x2f1530[_0xa46a('0x2c')],'sectionId':_0x2f1530['id']},{})['then'](function(){return _0x1b28ad;});}else{return _0x1b28ad;}})[_0xa46a('0x46')](function(_0x405b40){logger['error'](_0xa46a('0x50'),_0x405b40);throw _0x405b40;});}return _0x1b28ad;})[_0xa46a('0x27')](respondWithResult(_0x2ba18a,0xc9))[_0xa46a('0x46')](handleError(_0x2ba18a,null));};exports[_0xa46a('0x51')]=function(_0x1532d4,_0x223acd){if(_0x1532d4[_0xa46a('0x52')]['id']){delete _0x1532d4[_0xa46a('0x52')]['id'];}return db['Disposition']['find']({'where':{'id':_0x1532d4[_0xa46a('0x53')]['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x223acd,null))['then'](saveUpdates(_0x1532d4[_0xa46a('0x52')],null))[_0xa46a('0x27')](respondWithResult(_0x223acd,null))[_0xa46a('0x46')](handleError(_0x223acd,null));};exports[_0xa46a('0x26')]=function(_0x52971f,_0x33a255){return db['Disposition']['find']({'where':{'id':_0x52971f['params']['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x33a255,null))[_0xa46a('0x27')](removeEntity(_0x33a255,null))[_0xa46a('0x46')](handleError(_0x33a255,null));}; \ No newline at end of file +var _0x2af5=['catch','show','params','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows'];(function(_0x495c18,_0x2d513c){var _0x2646ac=function(_0x417691){while(--_0x417691){_0x495c18['push'](_0x495c18['shift']());}};_0x2646ac(++_0x2d513c);}(_0x2af5,0xba));var _0x52af=function(_0x4de9af,_0x41941c){_0x4de9af=_0x4de9af-0x0;var _0x20bd1c=_0x2af5[_0x4de9af];return _0x20bd1c;};'use strict';var emlformat=require(_0x52af('0x0'));var rimraf=require(_0x52af('0x1'));var zipdir=require(_0x52af('0x2'));var jsonpatch=require(_0x52af('0x3'));var rp=require(_0x52af('0x4'));var moment=require(_0x52af('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x52af('0x6'));var path=require(_0x52af('0x7'));var sox=require(_0x52af('0x8'));var csv=require(_0x52af('0x9'));var ejs=require(_0x52af('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52af('0xb'));var squel=require('squel');var crypto=require(_0x52af('0xc'));var jsforce=require(_0x52af('0xd'));var deskjs=require(_0x52af('0xe'));var toCsv=require(_0x52af('0x9'));var querystring=require('querystring');var Papa=require(_0x52af('0xf'));var Redis=require(_0x52af('0x10'));var authService=require(_0x52af('0x11'));var qs=require(_0x52af('0x12'));var as=require(_0x52af('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52af('0x14'))(_0x52af('0x15'));var utils=require(_0x52af('0x16'));var config=require(_0x52af('0x17'));var licenseUtil=require(_0x52af('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24904e,_0x30c3e5){_0x30c3e5=_0x30c3e5||0xcc;return function(_0x5eb39e){if(_0x5eb39e){return _0x24904e['sendStatus'](_0x30c3e5);}return _0x24904e[_0x52af('0x19')](_0x30c3e5)[_0x52af('0x1a')]();};}function respondWithResult(_0x1b6f71,_0x98febb){_0x98febb=_0x98febb||0xc8;return function(_0x3f13e1){if(_0x3f13e1){return _0x1b6f71[_0x52af('0x19')](_0x98febb)['json'](_0x3f13e1);}};}function respondWithFilteredResult(_0x1f1650,_0x358f19){return function(_0x5f27e6){if(_0x5f27e6){var _0x4cac25=typeof _0x358f19['offset']===_0x52af('0x1b')&&typeof _0x358f19[_0x52af('0x1c')]===_0x52af('0x1b');var _0x51da9d=_0x5f27e6[_0x52af('0x1d')];var _0xc1b3d=_0x4cac25?0x0:_0x358f19[_0x52af('0x1e')];var _0x399b40=_0x4cac25?_0x5f27e6[_0x52af('0x1d')]:_0x358f19[_0x52af('0x1e')]+_0x358f19['limit'];var _0x13aec9;if(_0x399b40>=_0x51da9d){_0x399b40=_0x51da9d;_0x13aec9=0xc8;}else{_0x13aec9=0xce;}_0x1f1650['status'](_0x13aec9);return _0x1f1650[_0x52af('0x1f')](_0x52af('0x20'),_0xc1b3d+'-'+_0x399b40+'/'+_0x51da9d)['json'](_0x5f27e6);}return null;};}function patchUpdates(_0x417f33){return function(_0x5eca38){try{jsonpatch[_0x52af('0x21')](_0x5eca38,_0x417f33,!![]);}catch(_0x4dc339){return BPromise['reject'](_0x4dc339);}return _0x5eca38[_0x52af('0x22')]();};}function saveUpdates(_0x535a8c,_0x358679){return function(_0x3b46f3){if(_0x3b46f3){return _0x3b46f3['update'](_0x535a8c)[_0x52af('0x23')](function(_0x54cbec){return _0x54cbec;});}return null;};}function removeEntity(_0x100023,_0x27ba33){return function(_0x39a86c){if(_0x39a86c){return _0x39a86c[_0x52af('0x24')]()[_0x52af('0x23')](function(){var _0x36860c=_0x39a86c[_0x52af('0x25')]({'plain':!![]});var _0x2a2dcc='Dispositions';return db[_0x52af('0x26')][_0x52af('0x24')]({'where':{'type':_0x2a2dcc,'resourceId':_0x36860c['id']}})['then'](function(){return _0x39a86c;});})[_0x52af('0x23')](function(){_0x100023['status'](0xcc)[_0x52af('0x1a')]();});}};}function handleEntityNotFound(_0x2c6864,_0x3ab87e){return function(_0x351a70){if(!_0x351a70){_0x2c6864[_0x52af('0x27')](0x194);}return _0x351a70;};}function handleError(_0x300326,_0x1a52dc){_0x1a52dc=_0x1a52dc||0x1f4;return function(_0x50a313){logger[_0x52af('0x28')](_0x50a313[_0x52af('0x29')]);if(_0x50a313[_0x52af('0x2a')]){delete _0x50a313['name'];}_0x300326['status'](_0x1a52dc)[_0x52af('0x2b')](_0x50a313);};}exports[_0x52af('0x2c')]=function(_0x45b24b,_0xaaa0f9){var _0x23b361={},_0x4cfcc6={},_0x494d8f={'count':0x0,'rows':[]};var _0x4c7463=_[_0x52af('0x2d')](db[_0x52af('0x2e')][_0x52af('0x2f')],function(_0x3c5acd){return{'name':_0x3c5acd[_0x52af('0x30')],'type':_0x3c5acd[_0x52af('0x31')][_0x52af('0x32')]};});_0x4cfcc6['model']=_[_0x52af('0x2d')](_0x4c7463,'name');_0x4cfcc6[_0x52af('0x33')]=_[_0x52af('0x34')](_0x45b24b[_0x52af('0x33')]);_0x4cfcc6['filters']=_[_0x52af('0x35')](_0x4cfcc6[_0x52af('0x36')],_0x4cfcc6[_0x52af('0x33')]);_0x23b361[_0x52af('0x37')]=_[_0x52af('0x35')](_0x4cfcc6[_0x52af('0x36')],qs[_0x52af('0x38')](_0x45b24b['query'][_0x52af('0x38')]));_0x23b361[_0x52af('0x37')]=_0x23b361[_0x52af('0x37')]['length']?_0x23b361[_0x52af('0x37')]:_0x4cfcc6[_0x52af('0x36')];if(!_0x45b24b[_0x52af('0x33')][_0x52af('0x39')](_0x52af('0x3a'))){_0x23b361[_0x52af('0x1c')]=qs[_0x52af('0x1c')](_0x45b24b[_0x52af('0x33')][_0x52af('0x1c')]);_0x23b361[_0x52af('0x1e')]=qs[_0x52af('0x1e')](_0x45b24b['query'][_0x52af('0x1e')]);}_0x23b361['order']=qs['sort'](_0x45b24b[_0x52af('0x33')][_0x52af('0x3b')]);_0x23b361['where']=qs[_0x52af('0x3c')](_[_0x52af('0x3d')](_0x45b24b[_0x52af('0x33')],_0x4cfcc6[_0x52af('0x3c')]),_0x4c7463);if(_0x45b24b[_0x52af('0x33')][_0x52af('0x3e')]){_0x23b361[_0x52af('0x3f')]=_[_0x52af('0x40')](_0x23b361[_0x52af('0x3f')],{'$or':_[_0x52af('0x2d')](_0x4c7463,function(_0x3d9e15){if(_0x3d9e15[_0x52af('0x31')]!==_0x52af('0x41')){var _0x5f1098={};_0x5f1098[_0x3d9e15[_0x52af('0x2a')]]={'$like':'%'+_0x45b24b[_0x52af('0x33')][_0x52af('0x3e')]+'%'};return _0x5f1098;}})});}_0x23b361=_[_0x52af('0x40')]({},_0x23b361,_0x45b24b[_0x52af('0x42')]);var _0x3600b3={'where':_0x23b361[_0x52af('0x3f')]};return db[_0x52af('0x2e')]['count'](_0x3600b3)[_0x52af('0x23')](function(_0x37ca67){_0x494d8f['count']=_0x37ca67;if(_0x45b24b[_0x52af('0x33')]['includeAll']){_0x23b361['include']=[{'all':!![]}];}return db[_0x52af('0x2e')][_0x52af('0x43')](_0x23b361);})[_0x52af('0x23')](function(_0x4727b6){_0x494d8f[_0x52af('0x44')]=_0x4727b6;return _0x494d8f;})[_0x52af('0x23')](respondWithFilteredResult(_0xaaa0f9,_0x23b361))[_0x52af('0x45')](handleError(_0xaaa0f9,null));};exports[_0x52af('0x46')]=function(_0x28bb59,_0x59422f){var _0x40e59b={'raw':!![],'where':{'id':_0x28bb59[_0x52af('0x47')]['id']}},_0x3ecf56={};_0x3ecf56[_0x52af('0x36')]=_[_0x52af('0x34')](db[_0x52af('0x2e')][_0x52af('0x2f')]);_0x3ecf56[_0x52af('0x33')]=_[_0x52af('0x34')](_0x28bb59['query']);_0x3ecf56[_0x52af('0x3c')]=_[_0x52af('0x35')](_0x3ecf56['model'],_0x3ecf56[_0x52af('0x33')]);_0x40e59b[_0x52af('0x37')]=_[_0x52af('0x35')](_0x3ecf56[_0x52af('0x36')],qs[_0x52af('0x38')](_0x28bb59[_0x52af('0x33')]['fields']));_0x40e59b[_0x52af('0x37')]=_0x40e59b[_0x52af('0x37')][_0x52af('0x48')]?_0x40e59b[_0x52af('0x37')]:_0x3ecf56[_0x52af('0x36')];if(_0x28bb59[_0x52af('0x33')][_0x52af('0x49')]){_0x40e59b[_0x52af('0x4a')]=[{'all':!![]}];}_0x40e59b=_[_0x52af('0x40')]({},_0x40e59b,_0x28bb59[_0x52af('0x42')]);return db[_0x52af('0x2e')][_0x52af('0x4b')](_0x40e59b)[_0x52af('0x23')](handleEntityNotFound(_0x59422f,null))[_0x52af('0x23')](respondWithResult(_0x59422f,null))[_0x52af('0x45')](handleError(_0x59422f,null));};exports['create']=function(_0x468dbb,_0xa247d9){return db['Disposition'][_0x52af('0x4c')](_0x468dbb[_0x52af('0x4d')],{})[_0x52af('0x23')](function(_0x109ed0){var _0xd311af=_0x468dbb[_0x52af('0x4e')]['get']({'plain':!![]});if(!_0xd311af)throw new Error(_0x52af('0x4f'));if(_0xd311af[_0x52af('0x50')]===_0x52af('0x4e')){var _0x346ba0=_0x109ed0[_0x52af('0x25')]({'plain':!![]});var _0x470e08=_0x52af('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x470e08,'userProfileId':_0xd311af[_0x52af('0x52')]},'raw':!![]})['then'](function(_0x95cf99){if(_0x95cf99&&_0x95cf99['autoAssociation']===0x0){return db[_0x52af('0x26')]['create']({'name':_0x346ba0[_0x52af('0x2a')],'resourceId':_0x346ba0['id'],'type':_0x95cf99[_0x52af('0x2a')],'sectionId':_0x95cf99['id']},{})[_0x52af('0x23')](function(){return _0x109ed0;});}else{return _0x109ed0;}})[_0x52af('0x45')](function(_0x1cba2c){logger[_0x52af('0x28')](_0x52af('0x53'),_0x1cba2c);throw _0x1cba2c;});}return _0x109ed0;})[_0x52af('0x23')](respondWithResult(_0xa247d9,0xc9))['catch'](handleError(_0xa247d9,null));};exports[_0x52af('0x54')]=function(_0x4a586b,_0x5623e8){if(_0x4a586b[_0x52af('0x4d')]['id']){delete _0x4a586b[_0x52af('0x4d')]['id'];}return db[_0x52af('0x2e')][_0x52af('0x4b')]({'where':{'id':_0x4a586b[_0x52af('0x47')]['id']}})['then'](handleEntityNotFound(_0x5623e8,null))[_0x52af('0x23')](saveUpdates(_0x4a586b[_0x52af('0x4d')],null))['then'](respondWithResult(_0x5623e8,null))[_0x52af('0x45')](handleError(_0x5623e8,null));};exports[_0x52af('0x24')]=function(_0x4c9f5a,_0x4a8bfb){return db['Disposition'][_0x52af('0x4b')]({'where':{'id':_0x4c9f5a['params']['id']}})['then'](handleEntityNotFound(_0x4a8bfb,null))[_0x52af('0x23')](removeEntity(_0x4a8bfb,null))[_0x52af('0x45')](handleError(_0x4a8bfb,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 8c1a136..9094613 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 _0x2b95=['./disposition.attributes','exports','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x2b95,0xa9));var _0x52b9=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0x2b95[_0xae1a83];return _0xdb9da8;};'use strict';var _=require(_0x52b9('0x0'));var util=require(_0x52b9('0x1'));var logger=require(_0x52b9('0x2'))('api');var moment=require(_0x52b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x52b9('0x4'));var fs=require('fs');var path=require(_0x52b9('0x5'));var rimraf=require(_0x52b9('0x6'));var config=require('../../config/environment');var attributes=require(_0x52b9('0x7'));module[_0x52b9('0x8')]=function(_0x20694d,_0xab50d5){return _0x20694d['define']('Disposition',attributes,{'tableName':_0x52b9('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x52b9('0xa'),_0x52b9('0xb')]},{'unique':!![],'name':_0x52b9('0xc'),'fields':[_0x52b9('0xa'),_0x52b9('0xd')]},{'unique':!![],'name':_0x52b9('0xe'),'fields':['name',_0x52b9('0xf')]},{'unique':!![],'name':_0x52b9('0x10'),'fields':[_0x52b9('0xa'),'SmsAccountId']},{'unique':!![],'name':_0x52b9('0x11'),'fields':['name',_0x52b9('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x52b9('0xa'),_0x52b9('0x13')]},{'unique':!![],'name':_0x52b9('0x14'),'fields':[_0x52b9('0xa'),_0x52b9('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf500=['name_whatsapp','WhatsappAccountId','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xf500,0x12d));var _0x0f50=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xf500[_0x56916d];return _0x2b7f1f;};'use strict';var _=require('lodash');var util=require(_0x0f50('0x0'));var logger=require(_0x0f50('0x1'))(_0x0f50('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0f50('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f50('0x4'));var config=require(_0x0f50('0x5'));var attributes=require(_0x0f50('0x6'));module[_0x0f50('0x7')]=function(_0x2b183b,_0x4fdece){return _0x2b183b[_0x0f50('0x8')](_0x0f50('0x9'),attributes,{'tableName':_0x0f50('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x0f50('0xb'),_0x0f50('0xc')]},{'unique':!![],'name':_0x0f50('0xd'),'fields':[_0x0f50('0xb'),_0x0f50('0xe')]},{'unique':!![],'name':_0x0f50('0xf'),'fields':[_0x0f50('0xb'),_0x0f50('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x0f50('0xb'),_0x0f50('0x11')]},{'unique':!![],'name':_0x0f50('0x12'),'fields':['name',_0x0f50('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0x0f50('0xb'),_0x0f50('0x14')]},{'unique':!![],'name':_0x0f50('0x15'),'fields':[_0x0f50('0xb'),_0x0f50('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 02987b5..ee5b016 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(_0x56e0cf,_0x35e8c9){var _0x57ab04=function(_0x2f8bcf){while(--_0x2f8bcf){_0x56e0cf['push'](_0x56e0cf['shift']());}};_0x57ab04(++_0x35e8c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x311277,_0x387e31){var _0x3ff0b3=function(_0x503ba9){while(--_0x503ba9){_0x311277['push'](_0x311277['shift']());}};_0x3ff0b3(++_0x387e31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ed3fe3e..c1e31c9 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 _0x4db8=['./disposition.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1b02ff,_0x3c0609){var _0x48f92d=function(_0x1fa867){while(--_0x1fa867){_0x1b02ff['push'](_0x1b02ff['shift']());}};_0x48f92d(++_0x3c0609);}(_0x4db8,0x10f));var _0x84db=function(_0x5230b4,_0x22faa4){_0x5230b4=_0x5230b4-0x0;var _0x286949=_0x4db8[_0x5230b4];return _0x286949;};'use strict';var multer=require(_0x84db('0x0'));var util=require(_0x84db('0x1'));var path=require(_0x84db('0x2'));var timeout=require(_0x84db('0x3'));var express=require(_0x84db('0x4'));var router=express[_0x84db('0x5')]();var fs_extra=require(_0x84db('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x84db('0x7'));var config=require(_0x84db('0x8'));var controller=require(_0x84db('0x9'));router[_0x84db('0xa')]('/',auth[_0x84db('0xb')](),controller[_0x84db('0xc')]);router[_0x84db('0xa')]('/:id',auth[_0x84db('0xb')](),controller[_0x84db('0xd')]);router[_0x84db('0xe')]('/',auth[_0x84db('0xb')](),controller[_0x84db('0xf')]);router[_0x84db('0x10')](_0x84db('0x11'),auth[_0x84db('0xb')](),controller[_0x84db('0x12')]);router[_0x84db('0x13')](_0x84db('0x11'),auth[_0x84db('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb32e=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x320e19,_0x5cfe93){var _0x582b5a=function(_0x10b8ad){while(--_0x10b8ad){_0x320e19['push'](_0x320e19['shift']());}};_0x582b5a(++_0x5cfe93);}(_0xb32e,0x14f));var _0xeb32=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb32e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xeb32('0x0'));var util=require('util');var path=require(_0xeb32('0x1'));var timeout=require(_0xeb32('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb32('0x3'));var interaction=require(_0xeb32('0x4'));var config=require(_0xeb32('0x5'));var controller=require(_0xeb32('0x6'));router[_0xeb32('0x7')]('/',auth[_0xeb32('0x8')](),controller[_0xeb32('0x9')]);router[_0xeb32('0x7')](_0xeb32('0xa'),auth[_0xeb32('0x8')](),controller[_0xeb32('0xb')]);router[_0xeb32('0xc')]('/',auth[_0xeb32('0x8')](),controller['create']);router[_0xeb32('0xd')](_0xeb32('0xa'),auth['isAuthenticated'](),controller[_0xeb32('0xe')]);router[_0xeb32('0xf')]('/:id',auth[_0xeb32('0x8')](),controller['destroy']);module[_0xeb32('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 62a3994..5b473c9 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 _0x4300=['SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','yes','STRING','xCALLY\x20Motion\x20Fax','ENUM','4800','9600','12000','14400','2400','7200','v17,v27,v29','INTEGER','DADHI','KHOMP'];(function(_0x470a8d,_0x1cacb6){var _0x4ee204=function(_0x3696b0){while(--_0x3696b0){_0x470a8d['push'](_0x470a8d['shift']());}};_0x4ee204(++_0x1cacb6);}(_0x4300,0x1a6));var _0x0430=function(_0x5b31cf,_0x464038){_0x5b31cf=_0x5b31cf-0x0;var _0x3647a4=_0x4300[_0x5b31cf];return _0x3647a4;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x0430('0x1'),'no'),'defaultValue':_0x0430('0x1')},'headerinfo':{'type':Sequelize[_0x0430('0x2')],'defaultValue':_0x0430('0x3')},'localstationid':{'type':Sequelize[_0x0430('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x0430('0x4')]('2400',_0x0430('0x5'),'7200',_0x0430('0x6'),_0x0430('0x7'),_0x0430('0x8')),'defaultValue':_0x0430('0x5')},'maxrate':{'type':Sequelize[_0x0430('0x4')](_0x0430('0x9'),_0x0430('0x5'),_0x0430('0xa'),_0x0430('0x6'),'12000',_0x0430('0x8')),'defaultValue':_0x0430('0x8')},'modem':{'type':Sequelize[_0x0430('0x2')],'defaultValue':_0x0430('0xb')},'gateway':{'type':Sequelize[_0x0430('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0430('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0430('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0430('0x4')]('SIP','IAX',_0x0430('0xd'),_0x0430('0xe')),'defaultValue':_0x0430('0xf')},'key':{'type':Sequelize[_0x0430('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0430('0x10')],'defaultValue':function(){return _0x0430('0x11');}},'notificationSound':{'type':Sequelize[_0x0430('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0430('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0430('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a3239){if(!_0x1a3239)this[_0x0430('0x14')](_0x0430('0x15'),null);this[_0x0430('0x14')](_0x0430('0x16'),_0x1a3239);}}}; \ No newline at end of file +var _0x3c6c=['ENUM','yes','xCALLY\x20Motion\x20Fax','4800','2400','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING'];(function(_0x544449,_0x24c43d){var _0x13185f=function(_0x4ac245){while(--_0x4ac245){_0x544449['push'](_0x544449['shift']());}};_0x13185f(++_0x24c43d);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x12416d,_0x136e9a){_0x12416d=_0x12416d-0x0;var _0x44d1b3=_0x3c6c[_0x12416d];return _0x44d1b3;};'use strict';var Sequelize=require(_0xc3c6('0x0'));module['exports']={'name':{'type':Sequelize[_0xc3c6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc3c6('0x1')]},'ecm':{'type':Sequelize[_0xc3c6('0x2')](_0xc3c6('0x3'),'no'),'defaultValue':_0xc3c6('0x3')},'headerinfo':{'type':Sequelize[_0xc3c6('0x1')],'defaultValue':_0xc3c6('0x4')},'localstationid':{'type':Sequelize[_0xc3c6('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xc3c6('0x2')]('2400',_0xc3c6('0x5'),'7200','9600','12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc3c6('0x2')](_0xc3c6('0x6'),'4800',_0xc3c6('0x7'),_0xc3c6('0x8'),_0xc3c6('0x9'),_0xc3c6('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xc3c6('0x1')],'defaultValue':_0xc3c6('0xb')},'gateway':{'type':Sequelize[_0xc3c6('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc3c6('0x2')](_0xc3c6('0xc'),_0xc3c6('0xd'),_0xc3c6('0xe'),_0xc3c6('0xf')),'defaultValue':_0xc3c6('0xc')},'key':{'type':Sequelize[_0xc3c6('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc3c6('0x10')],'defaultValue':function(){return _0xc3c6('0x11');}},'notificationSound':{'type':Sequelize[_0xc3c6('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc3c6('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc3c6('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc3c6('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc3c6('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc3c6('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc3c6('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc3c6('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc3c6('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0xc3c6('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xc3c6('0x12')],'defaultValue':![],'comment':_0xc3c6('0x15'),'set':function(_0x15ebec){if(!_0x15ebec)this[_0xc3c6('0x16')](_0xc3c6('0x17'),null);this[_0xc3c6('0x16')](_0xc3c6('0x18'),_0x15ebec);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 478f941..68dab05 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 _0xf00d=['debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','destroy','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','find','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','rows','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','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','transaction','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','register','client','http','request','then','request\x20sent'];(function(_0x29626e,_0x5c06c4){var _0xa446d5=function(_0x310d7c){while(--_0x310d7c){_0x29626e['push'](_0x29626e['shift']());}};_0xa446d5(++_0x5c06c4);}(_0xf00d,0xa6));var _0xdf00=function(_0xecd8a2,_0x1fb96b){_0xecd8a2=_0xecd8a2-0x0;var _0x1c9756=_0xf00d[_0xecd8a2];return _0x1c9756;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf00('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf00('0x1'));var moment=require('moment');var BPromise=require(_0xdf00('0x2'));var Mustache=require(_0xdf00('0x3'));var util=require(_0xdf00('0x4'));var path=require('path');var sox=require(_0xdf00('0x5'));var csv=require(_0xdf00('0x6'));var ejs=require(_0xdf00('0x7'));var fs=require('fs');var fs_extra=require(_0xdf00('0x8'));var _=require('lodash');var squel=require(_0xdf00('0x9'));var crypto=require(_0xdf00('0xa'));var jsforce=require(_0xdf00('0xb'));var deskjs=require(_0xdf00('0xc'));var toCsv=require(_0xdf00('0x6'));var querystring=require(_0xdf00('0xd'));var Papa=require(_0xdf00('0xe'));var Redis=require('ioredis');var authService=require(_0xdf00('0xf'));var qs=require(_0xdf00('0x10'));var as=require(_0xdf00('0x11'));var hardwareService=require(_0xdf00('0x12'));var logger=require('../../config/logger')(_0xdf00('0x13'));var utils=require('../../config/utils');var config=require(_0xdf00('0x14'));var licenseUtil=require(_0xdf00('0x15'));var db=require(_0xdf00('0x16'))['db'];config[_0xdf00('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xdf00('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf00('0x19')][_0xdf00('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7962,_0x2f9ad2,_0x3e8173,_0x482be6){return new BPromise(function(_0x15dc73,_0x292997){var _0x551d55=_0x482be6||client;return _0x551d55[_0xdf00('0x1b')](_0x4d7962,_0x3e8173)[_0xdf00('0x1c')](function(_0x41a80d){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2f9ad2,_0xdf00('0x1d'));logger[_0xdf00('0x1e')](_0xdf00('0x1f'),_0x2f9ad2,_0xdf00('0x1d'),JSON[_0xdf00('0x20')](_0x41a80d));if(_0x41a80d[_0xdf00('0x21')]){if(_0x41a80d['error']['code']===0x1f4){logger[_0xdf00('0x21')](_0xdf00('0x22'),_0x2f9ad2,_0x41a80d[_0xdf00('0x21')]['message']);return _0x292997(_0x41a80d[_0xdf00('0x21')][_0xdf00('0x23')]);}logger['error'](_0xdf00('0x22'),_0x2f9ad2,_0x41a80d[_0xdf00('0x21')][_0xdf00('0x23')]);return _0x15dc73(_0x41a80d[_0xdf00('0x21')][_0xdf00('0x23')]);}else{logger[_0xdf00('0x24')](_0xdf00('0x22'),_0x2f9ad2,_0xdf00('0x1d'));_0x15dc73(_0x41a80d[_0xdf00('0x25')][_0xdf00('0x23')]);}})[_0xdf00('0x26')](function(_0x29a0b2){logger['error'](_0xdf00('0x22'),_0x2f9ad2,_0x29a0b2);_0x292997(_0x29a0b2);});});}function respondWithStatusCode(_0x3f4692,_0x519e28){_0x519e28=_0x519e28||0xcc;return function(_0x2f4255){if(_0x2f4255){return _0x3f4692[_0xdf00('0x27')](_0x519e28);}return _0x3f4692[_0xdf00('0x28')](_0x519e28)['end']();};}function respondWithResult(_0x8b21a2,_0x3917b0){_0x3917b0=_0x3917b0||0xc8;return function(_0x3c9f3a){if(_0x3c9f3a){return _0x8b21a2[_0xdf00('0x28')](_0x3917b0)[_0xdf00('0x29')](_0x3c9f3a);}};}function respondWithFilteredResult(_0x4209b6,_0x4f3cb6){return function(_0x3ab4aa){if(_0x3ab4aa){var _0x1a9696=typeof _0x4f3cb6[_0xdf00('0x2a')]===_0xdf00('0x2b')&&typeof _0x4f3cb6[_0xdf00('0x2c')]===_0xdf00('0x2b');var _0x29bf88=_0x3ab4aa[_0xdf00('0x2d')];var _0x456fcd=_0x1a9696?0x0:_0x4f3cb6[_0xdf00('0x2a')];var _0x283293=_0x1a9696?_0x3ab4aa[_0xdf00('0x2d')]:_0x4f3cb6[_0xdf00('0x2a')]+_0x4f3cb6[_0xdf00('0x2c')];var _0x4b207b;if(_0x283293>=_0x29bf88){_0x283293=_0x29bf88;_0x4b207b=0xc8;}else{_0x4b207b=0xce;}_0x4209b6[_0xdf00('0x28')](_0x4b207b);return _0x4209b6['set']('Content-Range',_0x456fcd+'-'+_0x283293+'/'+_0x29bf88)['json'](_0x3ab4aa);}return null;};}function patchUpdates(_0x423cd5){return function(_0x38cd26){try{jsonpatch[_0xdf00('0x2e')](_0x38cd26,_0x423cd5,!![]);}catch(_0x49e884){return BPromise[_0xdf00('0x2f')](_0x49e884);}return _0x38cd26['save']();};}function saveUpdates(_0xe270d3,_0x59477d){return function(_0x2686c2){if(_0x2686c2){return _0x2686c2[_0xdf00('0x30')](_0xe270d3)[_0xdf00('0x1c')](function(_0x5e17b6){return _0x5e17b6;});}return null;};}function removeEntity(_0x5f0b6e,_0x50c375){return function(_0x2a8f86){if(_0x2a8f86){return _0x2a8f86[_0xdf00('0x31')]()[_0xdf00('0x1c')](function(){var _0x1b03c2=_0x2a8f86['get']({'plain':!![]});var _0x3ecc60='FaxAccounts';return db[_0xdf00('0x32')][_0xdf00('0x31')]({'where':{'type':_0x3ecc60,'resourceId':_0x1b03c2['id']}})[_0xdf00('0x1c')](function(){return _0x2a8f86;});})['then'](function(){_0x5f0b6e[_0xdf00('0x28')](0xcc)[_0xdf00('0x33')]();});}};}function handleEntityNotFound(_0x5364ee,_0x450675){return function(_0x2981aa){if(!_0x2981aa){_0x5364ee['sendStatus'](0x194);}return _0x2981aa;};}function handleError(_0x206af2,_0x5358db){_0x5358db=_0x5358db||0x1f4;return function(_0x484078){logger[_0xdf00('0x21')](_0x484078[_0xdf00('0x34')]);if(_0x484078[_0xdf00('0x35')]){delete _0x484078['name'];}_0x206af2['status'](_0x5358db)[_0xdf00('0x36')](_0x484078);};}exports[_0xdf00('0x37')]=function(_0x15d225,_0x3e36ea){var _0x4bcdc1={'include':[{'model':db['Pause'],'as':_0xdf00('0x38')}]},_0x536a30={},_0x32b7cd={'count':0x0,'rows':[]};var _0x2144f0=_[_0xdf00('0x39')](db[_0xdf00('0x3a')][_0xdf00('0x3b')],function(_0xc27352){return{'name':_0xc27352[_0xdf00('0x3c')],'type':_0xc27352[_0xdf00('0x3d')][_0xdf00('0x3e')]};});_0x536a30['model']=_[_0xdf00('0x39')](_0x2144f0,'name');_0x536a30[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x15d225[_0xdf00('0x3f')]);_0x536a30[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x536a30[_0xdf00('0x43')],_0x536a30[_0xdf00('0x3f')]);_0x4bcdc1[_0xdf00('0x44')]=_['intersection'](_0x536a30[_0xdf00('0x43')],qs['fields'](_0x15d225['query'][_0xdf00('0x45')]));_0x4bcdc1['attributes']=_0x4bcdc1['attributes'][_0xdf00('0x46')]?_0x4bcdc1[_0xdf00('0x44')]:_0x536a30[_0xdf00('0x43')];if(!_0x15d225[_0xdf00('0x3f')]['hasOwnProperty'](_0xdf00('0x47'))){_0x4bcdc1[_0xdf00('0x2c')]=qs[_0xdf00('0x2c')](_0x15d225[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x4bcdc1['offset']=qs['offset'](_0x15d225[_0xdf00('0x3f')][_0xdf00('0x2a')]);}_0x4bcdc1[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x15d225['query'][_0xdf00('0x49')]);_0x4bcdc1[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x15d225['query'],_0x536a30[_0xdf00('0x41')]),_0x2144f0);if(_0x15d225[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x4bcdc1[_0xdf00('0x4a')]=_['merge'](_0x4bcdc1['where'],{'$or':_['map'](_0x2144f0,function(_0x31226b){if(_0x31226b[_0xdf00('0x3d')]!=='VIRTUAL'){var _0x1b31fc={};_0x1b31fc[_0x31226b['name']]={'$like':'%'+_0x15d225[_0xdf00('0x3f')][_0xdf00('0x4c')]+'%'};return _0x1b31fc;}})});}_0x4bcdc1=_[_0xdf00('0x4d')]({},_0x4bcdc1,_0x15d225[_0xdf00('0x4e')]);var _0x467b94={'where':_0x4bcdc1[_0xdf00('0x4a')]};return db[_0xdf00('0x3a')][_0xdf00('0x2d')](_0x467b94)['then'](function(_0x52bd3f){_0x32b7cd[_0xdf00('0x2d')]=_0x52bd3f;if(_0x15d225[_0xdf00('0x3f')]['includeAll']){_0x4bcdc1[_0xdf00('0x4f')]=[{'all':!![]}];}return db[_0xdf00('0x3a')][_0xdf00('0x50')](_0x4bcdc1);})['then'](function(_0x3fa555){_0x32b7cd['rows']=_0x3fa555;return _0x32b7cd;})[_0xdf00('0x1c')](respondWithFilteredResult(_0x3e36ea,_0x4bcdc1))[_0xdf00('0x26')](handleError(_0x3e36ea,null));};exports[_0xdf00('0x51')]=function(_0x40cc68,_0x39c7af){var _0x3d1d93={'raw':![],'where':{'id':_0x40cc68[_0xdf00('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xdf00('0x38')}]},_0x1ea156={};_0x1ea156[_0xdf00('0x43')]=_[_0xdf00('0x40')](db[_0xdf00('0x3a')][_0xdf00('0x3b')]);_0x1ea156[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x40cc68[_0xdf00('0x3f')]);_0x1ea156['filters']=_[_0xdf00('0x42')](_0x1ea156[_0xdf00('0x43')],_0x1ea156['query']);_0x3d1d93[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0x1ea156[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x40cc68['query']['fields']));_0x3d1d93[_0xdf00('0x44')]=_0x3d1d93[_0xdf00('0x44')][_0xdf00('0x46')]?_0x3d1d93[_0xdf00('0x44')]:_0x1ea156[_0xdf00('0x43')];if(_0x40cc68[_0xdf00('0x3f')][_0xdf00('0x53')]){_0x3d1d93[_0xdf00('0x4f')]=[{'all':!![]}];}_0x3d1d93=_[_0xdf00('0x4d')]({},_0x3d1d93,_0x40cc68[_0xdf00('0x4e')]);return db[_0xdf00('0x3a')]['find'](_0x3d1d93)[_0xdf00('0x1c')](handleEntityNotFound(_0x39c7af,null))[_0xdf00('0x1c')](respondWithResult(_0x39c7af,null))[_0xdf00('0x26')](handleError(_0x39c7af,null));};exports[_0xdf00('0x54')]=function(_0x1b2120,_0x4fa0ad){return db[_0xdf00('0x3a')][_0xdf00('0x54')](_0x1b2120[_0xdf00('0x55')],{})['then'](function(_0x5a5603){var _0x519188=_0x1b2120[_0xdf00('0x56')]['get']({'plain':!![]});if(!_0x519188)throw new Error(_0xdf00('0x57'));if(_0x519188['role']===_0xdf00('0x56')){var _0x25fdbd=_0x5a5603[_0xdf00('0x58')]({'plain':!![]});var _0x3feab5=_0xdf00('0x59');return db[_0xdf00('0x5a')]['find']({'where':{'name':_0x3feab5,'userProfileId':_0x519188[_0xdf00('0x5b')]},'raw':!![]})['then'](function(_0x5be972){if(_0x5be972&&_0x5be972['autoAssociation']===0x0){return db[_0xdf00('0x32')]['create']({'name':_0x25fdbd[_0xdf00('0x35')],'resourceId':_0x25fdbd['id'],'type':_0x5be972[_0xdf00('0x35')],'sectionId':_0x5be972['id']},{})[_0xdf00('0x1c')](function(){return _0x5a5603;});}else{return _0x5a5603;}})[_0xdf00('0x26')](function(_0x1b57b3){logger[_0xdf00('0x21')](_0xdf00('0x5c'),_0x1b57b3);throw _0x1b57b3;});}return _0x5a5603;})[_0xdf00('0x1c')](respondWithResult(_0x4fa0ad,0xc9))[_0xdf00('0x26')](handleError(_0x4fa0ad,null));};exports[_0xdf00('0x30')]=function(_0x44bc15,_0x5bb0f4){if(_0x44bc15[_0xdf00('0x55')]['id']){delete _0x44bc15[_0xdf00('0x55')]['id'];}return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x44bc15[_0xdf00('0x52')]['id']},'include':[{'model':db[_0xdf00('0x5d')],'as':'mandatoryDispositionPause'}]})[_0xdf00('0x1c')](handleEntityNotFound(_0x5bb0f4,null))[_0xdf00('0x1c')](saveUpdates(_0x44bc15[_0xdf00('0x55')],null))[_0xdf00('0x1c')](respondWithResult(_0x5bb0f4,null))[_0xdf00('0x26')](handleError(_0x5bb0f4,null));};exports['destroy']=function(_0x3d7da0,_0x217079){return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x3d7da0[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x217079,null))[_0xdf00('0x1c')](removeEntity(_0x217079,null))[_0xdf00('0x26')](handleError(_0x217079,null));};exports[_0xdf00('0x5e')]=function(_0x5015c9,_0x3fff4d){return db[_0xdf00('0x3a')][_0xdf00('0x5e')]()[_0xdf00('0x1c')](respondWithResult(_0x3fff4d,null))[_0xdf00('0x26')](handleError(_0x3fff4d,null));};exports[_0xdf00('0x5f')]=function(_0x222336,_0x21435e,_0x581599){if(_0x222336[_0xdf00('0x55')]['id']){delete _0x222336['body']['id'];}return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x222336[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x21435e,null))[_0xdf00('0x1c')](function(_0xb7c125){if(_0xb7c125){_0x222336[_0xdf00('0x55')][_0xdf00('0x61')]=_0xb7c125['id'];return db[_0xdf00('0x62')][_0xdf00('0x54')](_0x222336[_0xdf00('0x55')]);}})[_0xdf00('0x1c')](respondWithResult(_0x21435e,null))['catch'](handleError(_0x21435e,null));};exports[_0xdf00('0x63')]=function(_0x37c0bf,_0xeb3b8b,_0x2538d5){var _0x1454b2={'raw':![],'where':{}};var _0x4a0a22={};var _0x13e35e={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x37c0bf['params']['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xeb3b8b,null))[_0xdf00('0x1c')](function(_0x41f2b0){if(_0x41f2b0){_0x4a0a22[_0xdf00('0x43')]=_[_0xdf00('0x40')](db[_0xdf00('0x62')]['rawAttributes']);_0x4a0a22[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x37c0bf[_0xdf00('0x3f')]);_0x4a0a22['filters']=_[_0xdf00('0x42')](_0x4a0a22[_0xdf00('0x43')],_0x4a0a22['query']);_0x1454b2['attributes']=_[_0xdf00('0x42')](_0x4a0a22['model'],qs[_0xdf00('0x45')](_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x1454b2['attributes']=_0x1454b2['attributes']['length']?_0x1454b2['attributes']:_0x4a0a22['model'];if(!_0x37c0bf[_0xdf00('0x3f')]['hasOwnProperty']('nolimit')){_0x1454b2[_0xdf00('0x2c')]=qs[_0xdf00('0x2c')](_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x1454b2['offset']=qs['offset'](_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x2a')]);}_0x1454b2[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x37c0bf['query'][_0xdf00('0x49')]);_0x1454b2[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x37c0bf[_0xdf00('0x3f')],_0x4a0a22[_0xdf00('0x41')]));_0x1454b2[_0xdf00('0x4a')][_0xdf00('0x61')]=_0x41f2b0['id'];if(_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x1454b2[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0x1454b2['where'],{'$or':_[_0xdf00('0x39')](_0x1454b2[_0xdf00('0x44')],function(_0x1e8561){var _0x285d2f={};_0x285d2f[_0x1e8561]={'$like':'%'+_0x37c0bf['query'][_0xdf00('0x4c')]+'%'};return _0x285d2f;})});}_0x1454b2=_[_0xdf00('0x4d')]({},_0x1454b2,_0x37c0bf[_0xdf00('0x4e')]);return db[_0xdf00('0x62')][_0xdf00('0x2d')]({'where':_0x1454b2['where']})[_0xdf00('0x1c')](function(_0x540feb){_0x13e35e[_0xdf00('0x2d')]=_0x540feb;if(_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x53')]){_0x1454b2['include']=[{'all':!![]}];}return db['Disposition'][_0xdf00('0x50')](_0x1454b2);})[_0xdf00('0x1c')](function(_0x4650de){_0x13e35e['rows']=_0x4650de;return _0x13e35e;});}})[_0xdf00('0x1c')](respondWithFilteredResult(_0xeb3b8b,_0x1454b2))[_0xdf00('0x26')](handleError(_0xeb3b8b,null));};exports['removeDispositions']=function(_0xbd161e,_0x572c67,_0x42da6d){return db['FaxAccount'][_0xdf00('0x60')]({'where':{'id':_0xbd161e[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x572c67,null))[_0xdf00('0x1c')](function(_0x186158){if(_0x186158){return _0x186158[_0xdf00('0x65')](_0xbd161e[_0xdf00('0x3f')]['ids']);}})[_0xdf00('0x1c')](respondWithStatusCode(_0x572c67,null))['catch'](handleError(_0x572c67,null));};exports[_0xdf00('0x66')]=function(_0x586904,_0xa1db02,_0x53b950){if(_0x586904['body']['id']){delete _0x586904['body']['id'];}return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x586904[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xa1db02,null))['then'](function(_0x2c5d53){if(_0x2c5d53){_0x586904[_0xdf00('0x55')][_0xdf00('0x61')]=_0x2c5d53['id'];return db[_0xdf00('0x67')][_0xdf00('0x54')](_0x586904['body']);}})[_0xdf00('0x1c')](respondWithResult(_0xa1db02,null))[_0xdf00('0x26')](handleError(_0xa1db02,null));};exports[_0xdf00('0x68')]=function(_0x253f5f,_0x414bea,_0x2a1ae3){var _0x486273={'raw':![],'where':{}};var _0x3c6e01={};var _0x32d749={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x253f5f[_0xdf00('0x52')]['id']}})['then'](handleEntityNotFound(_0x414bea,null))['then'](function(_0x47e1b9){if(_0x47e1b9){_0x3c6e01['model']=_[_0xdf00('0x40')](db[_0xdf00('0x67')][_0xdf00('0x3b')]);_0x3c6e01[_0xdf00('0x3f')]=_['keys'](_0x253f5f[_0xdf00('0x3f')]);_0x3c6e01[_0xdf00('0x41')]=_['intersection'](_0x3c6e01[_0xdf00('0x43')],_0x3c6e01[_0xdf00('0x3f')]);_0x486273[_0xdf00('0x44')]=_['intersection'](_0x3c6e01[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x253f5f[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x486273[_0xdf00('0x44')]=_0x486273[_0xdf00('0x44')][_0xdf00('0x46')]?_0x486273[_0xdf00('0x44')]:_0x3c6e01[_0xdf00('0x43')];if(!_0x253f5f[_0xdf00('0x3f')][_0xdf00('0x69')]('nolimit')){_0x486273['limit']=qs[_0xdf00('0x2c')](_0x253f5f['query'][_0xdf00('0x2c')]);_0x486273[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x253f5f[_0xdf00('0x3f')]['offset']);}_0x486273[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x253f5f[_0xdf00('0x3f')]['sort']);_0x486273[_0xdf00('0x4a')]=qs['filters'](_[_0xdf00('0x4b')](_0x253f5f[_0xdf00('0x3f')],_0x3c6e01[_0xdf00('0x41')]));_0x486273['where']['FaxAccountId']=_0x47e1b9['id'];if(_0x253f5f[_0xdf00('0x3f')]['filter']){_0x486273[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0x486273[_0xdf00('0x4a')],{'$or':_[_0xdf00('0x39')](_0x486273[_0xdf00('0x44')],function(_0x23f687){var _0x36d38b={};_0x36d38b[_0x23f687]={'$like':'%'+_0x253f5f[_0xdf00('0x3f')][_0xdf00('0x4c')]+'%'};return _0x36d38b;})});}_0x486273=_['merge']({},_0x486273,_0x253f5f[_0xdf00('0x4e')]);return db[_0xdf00('0x67')]['count']({'where':_0x486273['where']})[_0xdf00('0x1c')](function(_0x2becf2){_0x32d749[_0xdf00('0x2d')]=_0x2becf2;if(_0x253f5f[_0xdf00('0x3f')]['includeAll']){_0x486273[_0xdf00('0x4f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdf00('0x50')](_0x486273);})[_0xdf00('0x1c')](function(_0x50bf91){_0x32d749[_0xdf00('0x6a')]=_0x50bf91;return _0x32d749;});}})[_0xdf00('0x1c')](respondWithFilteredResult(_0x414bea,_0x486273))[_0xdf00('0x26')](handleError(_0x414bea,null));};exports['removeAnswers']=function(_0x53314d,_0x75696c,_0xb39e8c){return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x53314d[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x75696c,null))['then'](function(_0x469f4b){if(_0x469f4b){return _0x469f4b[_0xdf00('0x6b')](_0x53314d['query']['ids']);}})[_0xdf00('0x1c')](respondWithStatusCode(_0x75696c,null))[_0xdf00('0x26')](handleError(_0x75696c,null));};exports[_0xdf00('0x6c')]=function(_0x100989,_0xc64b3,_0x3603a1){return db[_0xdf00('0x6d')][_0xdf00('0x60')]({'where':{'id':_0x100989['params']['id']}})['then'](handleEntityNotFound(_0xc64b3,null))[_0xdf00('0x1c')](function(_0x2256b7){if(_0x2256b7){return _0x2256b7[_0xdf00('0x6c')](_0x100989['body'][_0xdf00('0x6e')],_[_0xdf00('0x6f')](_0x100989[_0xdf00('0x55')],['ids','id'])||{});}})[_0xdf00('0x1c')](respondWithResult(_0xc64b3,null))[_0xdf00('0x26')](handleError(_0xc64b3,null));};exports[_0xdf00('0x70')]=function(_0x2fa2bd,_0xd0a470,_0x1e31ae){var _0x2c5dee={'raw':![],'where':{}};var _0x20a25e={};var _0x2d207c={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')]['findOne']({'where':{'id':_0x2fa2bd['params']['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xd0a470,null))[_0xdf00('0x1c')](function(_0x359466){if(_0x359466){_0x20a25e[_0xdf00('0x43')]=_[_0xdf00('0x40')](db[_0xdf00('0x6d')]['rawAttributes']);_0x20a25e[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x2fa2bd['query']);_0x20a25e[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x20a25e[_0xdf00('0x43')],_0x20a25e[_0xdf00('0x3f')]);_0x2c5dee['attributes']=_[_0xdf00('0x42')](_0x20a25e[_0xdf00('0x43')],qs['fields'](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x2c5dee[_0xdf00('0x44')]=_0x2c5dee[_0xdf00('0x44')]['length']?_0x2c5dee[_0xdf00('0x44')]:_0x20a25e[_0xdf00('0x43')];if(!_0x2fa2bd[_0xdf00('0x3f')]['hasOwnProperty'](_0xdf00('0x47'))){_0x2c5dee[_0xdf00('0x2c')]=qs[_0xdf00('0x2c')](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x2c5dee[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x2a')]);}_0x2c5dee[_0xdf00('0x48')]=qs['sort'](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x49')]);_0x2c5dee[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_['pick'](_0x2fa2bd[_0xdf00('0x3f')],_0x20a25e[_0xdf00('0x41')]));_0x2c5dee[_0xdf00('0x4a')][_0xdf00('0x61')]=_0x359466['id'];if(_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x2c5dee[_0xdf00('0x4a')]=_['merge'](_0x2c5dee[_0xdf00('0x4a')],{'$or':_[_0xdf00('0x39')](_0x2c5dee[_0xdf00('0x44')],function(_0x46c36a){var _0x42deca={};_0x42deca[_0x46c36a]={'$like':'%'+_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x4c')]+'%'};return _0x42deca;})});}_0x2c5dee=_[_0xdf00('0x4d')]({},_0x2c5dee,_0x2fa2bd[_0xdf00('0x4e')]);return db['FaxInteraction']['count']({'where':_0x2c5dee['where']})[_0xdf00('0x1c')](function(_0xdab503){_0x2d207c[_0xdf00('0x2d')]=_0xdab503;if(_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x53')]){_0x2c5dee[_0xdf00('0x4f')]=[{'model':db['CmContact'],'as':_0xdf00('0x71'),'required':![]},{'model':db[_0xdf00('0x72')],'as':_0xdf00('0x73'),'attributes':[_0xdf00('0x35'),_0xdf00('0x74'),'internal'],'required':![]},{'model':db[_0xdf00('0x75')],'as':_0xdf00('0x76'),'attributes':['id',_0xdf00('0x35'),_0xdf00('0x77')],'where':_0x2fa2bd[_0xdf00('0x3f')]['tag']?{'id':_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x78')]}:undefined,'required':_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x78')]?!![]:![]}];}return db[_0xdf00('0x6d')][_0xdf00('0x50')](_0x2c5dee);})[_0xdf00('0x1c')](function(_0x241cd7){_0x2d207c[_0xdf00('0x6a')]=_0x241cd7;return _0x2d207c;});}})[_0xdf00('0x1c')](respondWithFilteredResult(_0xd0a470,_0x2c5dee))[_0xdf00('0x26')](handleError(_0xd0a470,null));};exports['addApplications']=function(_0x11a481,_0x40df2b){var _0x409c84=_0x11a481[_0xdf00('0x52')]['id'];var _0x4202b6=_0x11a481['body'];var _0x174435=0xc8;var _0x31a13d=null;return db[_0xdf00('0x79')]['transaction']({'isolationLevel':db[_0xdf00('0x79')][_0xdf00('0x7a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x42faee){return db['FaxAccount'][_0xdf00('0x64')]({'where':{'id':_0x409c84},'transaction':_0x42faee})[_0xdf00('0x1c')](function(_0x51f7fa){if(_0x51f7fa){return db[_0xdf00('0x7b')][_0xdf00('0x31')]({'where':{'FaxAccountId':_0x409c84},'transaction':_0x42faee})[_0xdf00('0x1c')](function(){var _0x47f99d=_[_0xdf00('0x39')](_0x4202b6,function(_0x218f2c){_0x218f2c['FaxAccountId']=_0x409c84;return _0x218f2c;});return db['FaxApplication'][_0xdf00('0x7c')](_0x47f99d,{'transaction':_0x42faee});});}else{_0x174435=0x194;_0x31a13d=[];}});})[_0xdf00('0x1c')](function(){if(_0x174435!==0x194){return db['FaxApplication'][_0xdf00('0x7d')]({'where':{'FaxAccountId':_0x409c84},'order':_0xdf00('0x7e')})[_0xdf00('0x1c')](function(_0x321127){_0x31a13d=_0x321127;});}})[_0xdf00('0x26')](function(_0x34df8f){_0x174435=0x1f4;logger[_0xdf00('0x21')](_0x34df8f['stack']);if(_0x34df8f[_0xdf00('0x35')]){delete _0x34df8f[_0xdf00('0x35')];}_0x31a13d=_0x34df8f;})[_0xdf00('0x7f')](function(){if(_0x31a13d===null){_0x40df2b[_0xdf00('0x27')](_0x174435);}else{if(_0x174435===0x1f4){_0x40df2b[_0xdf00('0x28')](_0x174435)[_0xdf00('0x36')](_0x31a13d);}else{_0x40df2b[_0xdf00('0x28')](_0x174435)[_0xdf00('0x29')](_0x31a13d);}}});};exports[_0xdf00('0x80')]=function(_0x2b6fe4,_0xb33f53,_0xb9712){var _0xa6917e={};var _0x275a11={};var _0x119569;var _0x56c4ac;return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x2b6fe4[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xb33f53,null))[_0xdf00('0x1c')](function(_0xb3a675){if(_0xb3a675){_0x119569=_0xb3a675;_0x275a11[_0xdf00('0x43')]=_['keys'](db[_0xdf00('0x7b')]['rawAttributes']);_0x275a11['query']=_[_0xdf00('0x40')](_0x2b6fe4['query']);_0x275a11[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x275a11[_0xdf00('0x43')],_0x275a11[_0xdf00('0x3f')]);_0xa6917e[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0x275a11[_0xdf00('0x43')],qs['fields'](_0x2b6fe4['query'][_0xdf00('0x45')]));_0xa6917e['attributes']=_0xa6917e[_0xdf00('0x44')]['length']?_0xa6917e['attributes']:_0x275a11[_0xdf00('0x43')];_0xa6917e['order']=qs[_0xdf00('0x49')](_0x2b6fe4[_0xdf00('0x3f')]['sort']);_0xa6917e[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x2b6fe4[_0xdf00('0x3f')],_0x275a11[_0xdf00('0x41')]));if(_0x2b6fe4[_0xdf00('0x3f')]['filter']){_0xa6917e[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0xa6917e['where'],{'$or':_['map'](_0xa6917e['attributes'],function(_0x17eaf5){var _0x3f1594={};_0x3f1594[_0x17eaf5]={'$like':'%'+_0x2b6fe4[_0xdf00('0x3f')]['filter']+'%'};return _0x3f1594;})});}_0xa6917e=_[_0xdf00('0x4d')]({},_0xa6917e,_0x2b6fe4[_0xdf00('0x4e')]);return _0x119569[_0xdf00('0x80')](_0xa6917e);}})[_0xdf00('0x1c')](function(_0x18c613){if(_0x18c613){_0x56c4ac=_0x18c613[_0xdf00('0x46')];if(!_0x2b6fe4[_0xdf00('0x3f')][_0xdf00('0x69')](_0xdf00('0x47'))){_0xa6917e[_0xdf00('0x2c')]=qs['limit'](_0x2b6fe4[_0xdf00('0x3f')]['limit']);_0xa6917e[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x2b6fe4['query'][_0xdf00('0x2a')]);}return _0x119569[_0xdf00('0x80')](_0xa6917e);}})[_0xdf00('0x1c')](function(_0x4c3973){if(_0x4c3973){return _0x4c3973?{'count':_0x56c4ac,'rows':_0x4c3973}:null;}})[_0xdf00('0x1c')](respondWithResult(_0xb33f53,null))[_0xdf00('0x26')](handleError(_0xb33f53,null));};function Extension(_0xf2f8a0,_0xb319df,_0xdde7f9,_0x4ceaba){this['context']=_0xdf00('0x81');this[_0xdf00('0x82')]=_0xf2f8a0[_0xdf00('0x83')];this[_0xdf00('0x84')]=_0x4ceaba;this['type']=_0xdf00('0x85');this[_0xdf00('0x86')]=_0xdf00('0x87');this[_0xdf00('0x61')]=_0xf2f8a0['id'];this['priority']=_0xb319df;this[_0xdf00('0x88')]=_0xdde7f9;}function createExtensionsReciveFax(_0x1ecd27){var _0x168651=0x1;var _0xa2d6c8=[];_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,'',_0xdf00('0x8a')));_0x168651+=0x1;_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,_0xdf00('0x8b'),_0xdf00('0x8c')));_0x168651+=0x1;for(var _0x24365e in _0x1ecd27){if(_0x1ecd27[_0xdf00('0x69')](_0x24365e)&&(_0x24365e==='ecm'||_0x24365e===_0xdf00('0x83')||_0x24365e===_0xdf00('0x8d')||_0x24365e===_0xdf00('0x8e')||_0x24365e===_0xdf00('0x8f')||_0x24365e===_0xdf00('0x90')||_0x24365e==='minrate'||_0x24365e==='modem'||_0x24365e==='t38timeout')){_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,_0xdf00('0x91')+_0x24365e+')='+_0x1ecd27[_0x24365e],_0xdf00('0x8c')));_0x168651+=0x1;}}_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,'6',_0xdf00('0x92')));_0x168651+=0x1;_0xa2d6c8['push'](new Extension(_0x1ecd27,_0x168651,_0xdf00('0x93'),_0xdf00('0x94')));_0x168651=0x0;return _0xa2d6c8;}exports[_0xdf00('0x95')]=function(_0x22b399,_0x14c985,_0x2e8479){var _0x4b04c7;return db[_0xdf00('0x79')][_0xdf00('0x96')](function(_0x28171e){return db[_0xdf00('0x3a')][_0xdf00('0x54')](_0x22b399[_0xdf00('0x55')],{'transaction':_0x28171e})['then'](function(_0x4fff8b){_0x4b04c7=_0x4fff8b[_0xdf00('0x58')]({'plain':!![]});return db[_0xdf00('0x97')][_0xdf00('0x7c')](createExtensionsReciveFax(_0x4b04c7),{'transaction':_0x28171e});});})[_0xdf00('0x1c')](function(){return _0x4b04c7;})[_0xdf00('0x1c')](respondWithResult(_0x14c985,null))['catch'](handleError(_0x14c985,null));};exports[_0xdf00('0x98')]=function(_0x473bfd,_0x54ccb6,_0x56bdfa){var _0x4a0746;return db['sequelize'][_0xdf00('0x96')](function(_0x6d6806){return db[_0xdf00('0x3a')]['update'](_0x473bfd[_0xdf00('0x55')],{'where':{'id':_0x473bfd[_0xdf00('0x55')]['id']},'transaction':_0x6d6806})[_0xdf00('0x1c')](function(_0x19250a){return db[_0xdf00('0x97')][_0xdf00('0x31')]({'where':{'FaxAccountId':_0x473bfd[_0xdf00('0x55')]['id']},'transaction':_0x6d6806})[_0xdf00('0x1c')](function(_0x968d80){return db['VoiceExtension'][_0xdf00('0x7c')](createExtensionsReciveFax(_[_0xdf00('0x6f')](_0x473bfd[_0xdf00('0x55')],['tech','key',_0xdf00('0x99'),_0xdf00('0x9a'),_0xdf00('0x9b'),_0xdf00('0x9c')])),{'transaction':_0x6d6806});});});})[_0xdf00('0x1c')](function(){return db[_0xdf00('0x3a')][_0xdf00('0x9d')](_0x473bfd['body']['id']);})[_0xdf00('0x1c')](respondWithResult(_0x54ccb6,null))[_0xdf00('0x26')](handleError(_0x54ccb6,null));};exports[_0xdf00('0x9e')]=function(_0x2717a6,_0x2369a8,_0xf38055){var _0x228783={'raw':!![],'where':{}};var _0x107230={};var _0x23f93c={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x2717a6['params']['id']}})['then'](handleEntityNotFound(_0x2369a8,null))['then'](function(_0x47da89){if(_0x47da89){_0x107230['model']=_[_0xdf00('0x40')](db[_0xdf00('0x9f')][_0xdf00('0x3b')]);_0x107230[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x2717a6[_0xdf00('0x3f')]);_0x107230[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x107230[_0xdf00('0x43')],_0x107230['query']);_0x228783[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0x107230[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x2717a6[_0xdf00('0x3f')]['fields']));_0x228783['attributes']=_0x228783[_0xdf00('0x44')]['length']?_0x228783[_0xdf00('0x44')]:_0x107230[_0xdf00('0x43')];if(!_0x2717a6['query']['hasOwnProperty'](_0xdf00('0x47'))){_0x228783['limit']=qs[_0xdf00('0x2c')](_0x2717a6[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x228783[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x2717a6['query']['offset']);}_0x228783['order']=qs['sort'](_0x2717a6[_0xdf00('0x3f')][_0xdf00('0x49')]);_0x228783[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x2717a6['query'],_0x107230[_0xdf00('0x41')]));_0x228783['where'][_0xdf00('0x61')]=_0x47da89['id'];if(_0x2717a6[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x228783['where']=_['merge'](_0x228783[_0xdf00('0x4a')],{'$or':_[_0xdf00('0x39')](_0x228783[_0xdf00('0x44')],function(_0xf0ab60){var _0x3ccf73={};_0x3ccf73[_0xf0ab60]={'$like':'%'+_0x2717a6['query'][_0xdf00('0x4c')]+'%'};return _0x3ccf73;})});}if(_0x2717a6[_0xdf00('0x3f')][_0xdf00('0xa0')]){var _0x47a24d=_0x2717a6[_0xdf00('0x3f')][_0xdf00('0xa0')]['split'](',');var _0x574f41={};_0x574f41[_0x47a24d[0x0]]={'$gte':moment(_0x47a24d[0x1])[_0xdf00('0xa1')](_0xdf00('0xa2'))};_0x228783['where']=_['merge'](_0x228783[_0xdf00('0x4a')],_0x574f41);}_0x228783=_[_0xdf00('0x4d')]({},_0x228783,_0x2717a6[_0xdf00('0x4e')]);return db['FaxMessage'][_0xdf00('0x2d')]({'where':_0x228783['where']})['then'](function(_0x21a5a8){_0x23f93c['count']=_0x21a5a8;if(_0x2717a6['query'][_0xdf00('0x53')]){_0x228783[_0xdf00('0x4f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x228783);})[_0xdf00('0x1c')](function(_0x1a5af1){_0x23f93c[_0xdf00('0x6a')]=_0x1a5af1;return _0x23f93c;});}})['then'](respondWithFilteredResult(_0x2369a8,_0x228783))[_0xdf00('0x26')](handleError(_0x2369a8,null));};exports[_0xdf00('0x36')]=function(_0x1945f7,_0x20a852,_0x5da303){var _0x24e7b5,_0xddc0da={},_0x12aac5;if(_0x1945f7[_0xdf00('0x55')]['to']){_0x12aac5=_0x1945f7['body']['to'][0x0];}return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x1945f7[_0xdf00('0x52')]['id']},'include':[{'model':db[_0xdf00('0xa3')],'as':_0xdf00('0xa4'),'include':[{'model':db[_0xdf00('0xa5')],'as':'Contacts','where':{'fax':_0x12aac5},'limit':0x1,'order':[[_0xdf00('0x9a'),_0xdf00('0xa6')]]}]}]})[_0xdf00('0x1c')](handleEntityNotFound(_0x20a852,null))[_0xdf00('0x1c')](function(_0x257cfc){_0x24e7b5=_0x257cfc;if(_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')]&&_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][_0xdf00('0x46')]){for(var _0x543d44=0x0;_0x543d44<_0x1945f7[_0xdf00('0x55')]['attachments'][_0xdf00('0x46')];_0x543d44+=0x1){_0x1945f7['body'][_0xdf00('0xa7')][_0x543d44]={'filename':_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][_0x543d44][_0xdf00('0x35')],'id':_0x1945f7['body']['attachments'][_0x543d44]['id'],'path':path[_0xdf00('0xa8')](config[_0xdf00('0xa9')],_0xdf00('0xaa'),_0x1945f7['body'][_0xdf00('0xa7')][_0x543d44][_0xdf00('0xab')])};}}return respondWithRpcPromise(_0xdf00('0xac'),_0xdf00('0xac'),{'FaxAccountId':_[_0xdf00('0xad')](_0x1945f7['params']['id'])?undefined:_0x1945f7[_0xdf00('0x52')]['id'],'path':_['isNil'](_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0][_0xdf00('0xae')])?undefined:_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0]['path'],'fax':_[_0xdf00('0xad')](_0x1945f7[_0xdf00('0x55')]['to'][0x0])?undefined:_0x1945f7[_0xdf00('0x55')]['to'][0x0]},client9002);})[_0xdf00('0x1c')](function(){if(_0x24e7b5){if(_['isNil'](_0x1945f7['body'][_0xdf00('0xaf')])){_0x1945f7[_0xdf00('0x55')]['from']=util[_0xdf00('0xa1')](_0xdf00('0xb0'),_0x24e7b5[_0xdf00('0x35')],_0x24e7b5[_0xdf00('0xb1')]);}if(_0x24e7b5[_0xdf00('0xa4')]){if(_0x24e7b5[_0xdf00('0xa4')]['Contacts'][_0xdf00('0x46')]){return _0x24e7b5[_0xdf00('0xa4')][_0xdf00('0xb2')][0x0];}else{return db[_0xdf00('0xa5')][_0xdf00('0x54')](_[_0xdf00('0xb3')](_0x1945f7[_0xdf00('0x55')],{'firstName':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'phone':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'fax':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'ListId':_0x24e7b5['ListId']}));}}else{throw new Error(_0xdf00('0xb4'));}}else{throw new Error(_0xdf00('0xb5'));}})[_0xdf00('0x1c')](function(_0xe22fdc){if(_0xe22fdc){return db[_0xdf00('0x6d')][_0xdf00('0x60')]({'where':{'ContactId':_0xe22fdc['id'],'closed':![],'FaxAccountId':_0x24e7b5['id']}})[_0xdf00('0x1c')](function(_0x1faf96){if(_0x1faf96){return[_0x1faf96,![]];}return db[_0xdf00('0x6d')][_0xdf00('0x54')]({'UserId':_0x1945f7[_0xdf00('0x56')]['id'],'ContactId':_0xe22fdc['id'],'FaxAccountId':_0x24e7b5['id'],'fax':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'firstMsgDirection':_0xdf00('0xb6'),'Messages':[_[_0xdf00('0x4d')](_0x1945f7['body'],{'read':![],'body':_0x1945f7[_0xdf00('0x55')]['attachments'][0x0][_0xdf00('0xb7')],'FaxAccountId':_0x24e7b5['id'],'UserId':_0x1945f7[_0xdf00('0x56')]['id'],'ContactId':_0xe22fdc['id'],'AttachmentId':_0x1945f7[_0xdf00('0x55')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xdf00('0xb8')}]})['then'](function(_0x277e4b){return[_0x277e4b,!![]];});});}else{throw new Error(_0xdf00('0xb9'));}})[_0xdf00('0xba')](function(_0x404bd3,_0x11d751){if(_0x11d751){return _0x404bd3;}return db[_0xdf00('0x9f')][_0xdf00('0x54')]({'direction':'out','read':![],'body':_0x1945f7['body'][_0xdf00('0xa7')][0x0][_0xdf00('0xb7')],'FaxAccountId':_0x24e7b5['id'],'FaxInteractionId':_0x404bd3['id'],'UserId':_0x1945f7[_0xdf00('0x56')]['id'],'ContactId':_0x404bd3[_0xdf00('0xbb')],'AttachmentId':_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0]['id']})['then'](function(_0x1006d2){_0x404bd3[_0xdf00('0xbc')][_0xdf00('0xb8')]=[];_0x404bd3[_0xdf00('0xbc')][_0xdf00('0xb8')][_0xdf00('0x89')](_0x1006d2[_0xdf00('0xbc')]);return _0x404bd3;});})[_0xdf00('0x1c')](function(_0xf9b042){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xdf00('0xad')](_0x1945f7[_0xdf00('0x52')]['id'])?undefined:_0x1945f7[_0xdf00('0x52')]['id'],'path':_['isNil'](_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0][_0xdf00('0xae')])?undefined:_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0][_0xdf00('0xae')],'fax':_[_0xdf00('0xad')](_0x1945f7[_0xdf00('0x55')]['to'][0x0])?undefined:_0x1945f7[_0xdf00('0x55')]['to'][0x0],'AttachmentId':_0x1945f7['body'][_0xdf00('0xa7')][0x0]['id']},client9002)['then'](function(_0x1d52d3){logger[_0xdf00('0x24')](_0xdf00('0xbd'),_0x1d52d3);})['catch'](function(_0xb29714){logger[_0xdf00('0x24')]('SendFaxRpc,\x20%s',_0xb29714);});return _0xf9b042;})['then'](respondWithResult(_0x20a852,null))[_0xdf00('0x26')](handleError(_0x20a852,null));};exports['addAgents']=function(_0x23d409,_0x1c2e56,_0x3c958b){return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x23d409[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x1c2e56,null))[_0xdf00('0x1c')](function(_0x1cde32){if(_0x1cde32){return _0x1cde32['addAgents'](_0x23d409[_0xdf00('0x55')][_0xdf00('0x6e')],_['omit'](_0x23d409[_0xdf00('0x55')],['ids','id'])||{})['spread'](function(_0x2a8b90){for(var _0x1d3809=0x0;_0x1d3809<_0x23d409['body'][_0xdf00('0x6e')]['length'];_0x1d3809+=0x1){socket[_0xdf00('0xbe')](_0xdf00('0xbf'),{'UserId':Number(_0x23d409[_0xdf00('0x55')]['ids'][_0x1d3809]),'FaxAccountId':Number(_0x23d409[_0xdf00('0x52')]['id'])});}return _0x2a8b90;});}})[_0xdf00('0x1c')](respondWithResult(_0x1c2e56,null))[_0xdf00('0x26')](handleError(_0x1c2e56,null));};exports[_0xdf00('0xc0')]=function(_0x168f6f,_0x4bf988,_0x40ebed){return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x168f6f['params']['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x4bf988,null))[_0xdf00('0x1c')](function(_0xbdbec9){if(_0xbdbec9){return _0xbdbec9[_0xdf00('0xc0')](_0x168f6f[_0xdf00('0x3f')][_0xdf00('0x6e')])['then'](function(){if(_[_0xdf00('0xc1')](_0x168f6f[_0xdf00('0x3f')][_0xdf00('0x6e')])){for(var _0x1e2b01=0x0;_0x1e2b01<_0x168f6f[_0xdf00('0x3f')]['ids']['length'];_0x1e2b01+=0x1){socket[_0xdf00('0xbe')](_0xdf00('0xc2'),{'UserId':Number(_0x168f6f[_0xdf00('0x3f')][_0xdf00('0x6e')][_0x1e2b01]),'FaxAccountId':Number(_0x168f6f[_0xdf00('0x52')]['id'])});}}else{socket[_0xdf00('0xbe')](_0xdf00('0xc2'),{'UserId':Number(_0x168f6f['query']['ids']),'FaxAccountId':Number(_0x168f6f[_0xdf00('0x52')]['id'])});}});}})[_0xdf00('0x1c')](respondWithStatusCode(_0x4bf988,null))['catch'](handleError(_0x4bf988,null));};exports[_0xdf00('0xc3')]=function(_0x3fba8a,_0x2e82ce,_0x4eedf0){var _0x1251f2={};var _0xc0def4={};var _0x4ac160;var _0x3d6daa;return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x3fba8a[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x2e82ce,null))[_0xdf00('0x1c')](function(_0x7de4fc){if(_0x7de4fc){_0x4ac160=_0x7de4fc;_0xc0def4['model']=_[_0xdf00('0x40')](db[_0xdf00('0x72')][_0xdf00('0x3b')]);_0xc0def4['query']=_[_0xdf00('0x40')](_0x3fba8a[_0xdf00('0x3f')]);_0xc0def4[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0xc0def4[_0xdf00('0x43')],_0xc0def4[_0xdf00('0x3f')]);_0x1251f2[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0xc0def4[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x3fba8a[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x1251f2['attributes']=_0x1251f2[_0xdf00('0x44')][_0xdf00('0x46')]?_0x1251f2[_0xdf00('0x44')]:_0xc0def4[_0xdf00('0x43')];_0x1251f2[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x3fba8a['query'][_0xdf00('0x49')]);_0x1251f2[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x3fba8a[_0xdf00('0x3f')],_0xc0def4[_0xdf00('0x41')]));if(_0x3fba8a[_0xdf00('0x3f')]['filter']){_0x1251f2[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0x1251f2[_0xdf00('0x4a')],{'$or':_['map'](_0x1251f2[_0xdf00('0x44')],function(_0x36ada3){var _0x446c0a={};_0x446c0a[_0x36ada3]={'$like':'%'+_0x3fba8a[_0xdf00('0x3f')]['filter']+'%'};return _0x446c0a;})});}_0x1251f2=_[_0xdf00('0x4d')]({},_0x1251f2,_0x3fba8a[_0xdf00('0x4e')]);return _0x4ac160[_0xdf00('0xc3')](_0x1251f2);}})[_0xdf00('0x1c')](function(_0x55ca83){if(_0x55ca83){_0x3d6daa=_0x55ca83[_0xdf00('0x46')];if(!_0x3fba8a[_0xdf00('0x3f')][_0xdf00('0x69')](_0xdf00('0x47'))){_0x1251f2[_0xdf00('0x2c')]=qs['limit'](_0x3fba8a[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x1251f2[_0xdf00('0x2a')]=qs['offset'](_0x3fba8a[_0xdf00('0x3f')]['offset']);}return _0x4ac160['getAgents'](_0x1251f2);}})[_0xdf00('0x1c')](function(_0x5e0d4a){if(_0x5e0d4a){return _0x5e0d4a?{'count':_0x3d6daa,'rows':_0x5e0d4a}:null;}})[_0xdf00('0x1c')](respondWithResult(_0x2e82ce,null))[_0xdf00('0x26')](handleError(_0x2e82ce,null));}; \ No newline at end of file +var _0xb73e=['addAccountApplications','updateAccountApplications','tech','key','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','end','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','findAll','show','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','findOne','Disposition','hasOwnProperty','pick','FaxAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','options','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','localstationid','app','system','description','Fax\x20Extension','appdata','push','ecm','faxdetect','headerinfo','maxrate','minrate','modem','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0xb73e,0xf4));var _0xeb73=function(_0x2323eb,_0x2c15b4){_0x2323eb=_0x2323eb-0x0;var _0x3271ce=_0xb73e[_0x2323eb];return _0x3271ce;};'use strict';var emlformat=require(_0xeb73('0x0'));var rimraf=require(_0xeb73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb73('0x2'));var rp=require('request-promise');var moment=require(_0xeb73('0x3'));var BPromise=require(_0xeb73('0x4'));var Mustache=require(_0xeb73('0x5'));var util=require(_0xeb73('0x6'));var path=require(_0xeb73('0x7'));var sox=require('sox');var csv=require(_0xeb73('0x8'));var ejs=require(_0xeb73('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb73('0xa'));var crypto=require(_0xeb73('0xb'));var jsforce=require(_0xeb73('0xc'));var deskjs=require(_0xeb73('0xd'));var toCsv=require(_0xeb73('0x8'));var querystring=require('querystring');var Papa=require(_0xeb73('0xe'));var Redis=require(_0xeb73('0xf'));var authService=require(_0xeb73('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeb73('0x11'));var hardwareService=require(_0xeb73('0x12'));var logger=require(_0xeb73('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xeb73('0x14'));var licenseUtil=require(_0xeb73('0x15'));var db=require('../../mysqldb')['db'];config[_0xeb73('0x16')]=_[_0xeb73('0x17')](config['redis'],{'host':_0xeb73('0x18'),'port':0x18eb});var socket=require(_0xeb73('0x19'))(new Redis(config[_0xeb73('0x16')]));require('./faxAccount.socket')[_0xeb73('0x1a')](socket);var jayson=require(_0xeb73('0x1b'));var client=jayson[_0xeb73('0x1c')][_0xeb73('0x1d')]({'port':0x232c});var client9002=jayson[_0xeb73('0x1c')][_0xeb73('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x21c5df,_0x5843f5,_0x1295ea,_0x4bd361){return new BPromise(function(_0x14ead,_0x578e72){var _0x2215ab=_0x4bd361||client;return _0x2215ab[_0xeb73('0x1e')](_0x21c5df,_0x1295ea)[_0xeb73('0x1f')](function(_0x2a4a99){logger[_0xeb73('0x20')](_0xeb73('0x21'),_0x5843f5,'request\x20sent');logger['debug'](_0xeb73('0x22'),_0x5843f5,_0xeb73('0x23'),JSON[_0xeb73('0x24')](_0x2a4a99));if(_0x2a4a99[_0xeb73('0x25')]){if(_0x2a4a99[_0xeb73('0x25')][_0xeb73('0x26')]===0x1f4){logger['error'](_0xeb73('0x21'),_0x5843f5,_0x2a4a99[_0xeb73('0x25')][_0xeb73('0x27')]);return _0x578e72(_0x2a4a99[_0xeb73('0x25')][_0xeb73('0x27')]);}logger[_0xeb73('0x25')](_0xeb73('0x21'),_0x5843f5,_0x2a4a99[_0xeb73('0x25')]['message']);return _0x14ead(_0x2a4a99['error'][_0xeb73('0x27')]);}else{logger[_0xeb73('0x20')](_0xeb73('0x21'),_0x5843f5,'request\x20sent');_0x14ead(_0x2a4a99[_0xeb73('0x28')][_0xeb73('0x27')]);}})[_0xeb73('0x29')](function(_0x161b7d){logger[_0xeb73('0x25')](_0xeb73('0x21'),_0x5843f5,_0x161b7d);_0x578e72(_0x161b7d);});});}function respondWithStatusCode(_0x4a887d,_0x5d0449){_0x5d0449=_0x5d0449||0xcc;return function(_0x4c04ef){if(_0x4c04ef){return _0x4a887d[_0xeb73('0x2a')](_0x5d0449);}return _0x4a887d[_0xeb73('0x2b')](_0x5d0449)['end']();};}function respondWithResult(_0x524eb1,_0x57675e){_0x57675e=_0x57675e||0xc8;return function(_0x4c3a20){if(_0x4c3a20){return _0x524eb1['status'](_0x57675e)[_0xeb73('0x2c')](_0x4c3a20);}};}function respondWithFilteredResult(_0x15c2e2,_0x2e0263){return function(_0x2ad60b){if(_0x2ad60b){var _0x59738b=typeof _0x2e0263[_0xeb73('0x2d')]===_0xeb73('0x2e')&&typeof _0x2e0263[_0xeb73('0x2f')]===_0xeb73('0x2e');var _0x3edcd2=_0x2ad60b[_0xeb73('0x30')];var _0x49b635=_0x59738b?0x0:_0x2e0263[_0xeb73('0x2d')];var _0x1989a=_0x59738b?_0x2ad60b[_0xeb73('0x30')]:_0x2e0263[_0xeb73('0x2d')]+_0x2e0263[_0xeb73('0x2f')];var _0x210d22;if(_0x1989a>=_0x3edcd2){_0x1989a=_0x3edcd2;_0x210d22=0xc8;}else{_0x210d22=0xce;}_0x15c2e2[_0xeb73('0x2b')](_0x210d22);return _0x15c2e2[_0xeb73('0x31')](_0xeb73('0x32'),_0x49b635+'-'+_0x1989a+'/'+_0x3edcd2)[_0xeb73('0x2c')](_0x2ad60b);}return null;};}function patchUpdates(_0x16daaa){return function(_0x270365){try{jsonpatch[_0xeb73('0x33')](_0x270365,_0x16daaa,!![]);}catch(_0x27f497){return BPromise[_0xeb73('0x34')](_0x27f497);}return _0x270365[_0xeb73('0x35')]();};}function saveUpdates(_0x6540c6,_0x4a26eb){return function(_0x1ab2ec){if(_0x1ab2ec){return _0x1ab2ec[_0xeb73('0x36')](_0x6540c6)[_0xeb73('0x1f')](function(_0x439e98){return _0x439e98;});}return null;};}function removeEntity(_0x101a95,_0x5c09d8){return function(_0x13fc2c){if(_0x13fc2c){return _0x13fc2c['destroy']()[_0xeb73('0x1f')](function(){var _0x19c98f=_0x13fc2c[_0xeb73('0x37')]({'plain':!![]});var _0x3771a7=_0xeb73('0x38');return db[_0xeb73('0x39')][_0xeb73('0x3a')]({'where':{'type':_0x3771a7,'resourceId':_0x19c98f['id']}})[_0xeb73('0x1f')](function(){return _0x13fc2c;});})['then'](function(){_0x101a95[_0xeb73('0x2b')](0xcc)[_0xeb73('0x3b')]();});}};}function handleEntityNotFound(_0x32bb31,_0x1f5ff8){return function(_0x4dab4d){if(!_0x4dab4d){_0x32bb31['sendStatus'](0x194);}return _0x4dab4d;};}function handleError(_0x39f73f,_0x3a3d38){_0x3a3d38=_0x3a3d38||0x1f4;return function(_0x1e28bc){logger[_0xeb73('0x25')](_0x1e28bc['stack']);if(_0x1e28bc[_0xeb73('0x3c')]){delete _0x1e28bc['name'];}_0x39f73f[_0xeb73('0x2b')](_0x3a3d38)['send'](_0x1e28bc);};}exports[_0xeb73('0x3d')]=function(_0x171869,_0x2eb5d7){var _0x32dfb2={'include':[{'model':db[_0xeb73('0x3e')],'as':_0xeb73('0x3f')}]},_0x24d6fd={},_0x554284={'count':0x0,'rows':[]};var _0x23e9dd=_[_0xeb73('0x40')](db[_0xeb73('0x41')]['rawAttributes'],function(_0x303012){return{'name':_0x303012[_0xeb73('0x42')],'type':_0x303012['type']['key']};});_0x24d6fd[_0xeb73('0x43')]=_['map'](_0x23e9dd,'name');_0x24d6fd[_0xeb73('0x44')]=_[_0xeb73('0x45')](_0x171869[_0xeb73('0x44')]);_0x24d6fd['filters']=_['intersection'](_0x24d6fd['model'],_0x24d6fd[_0xeb73('0x44')]);_0x32dfb2[_0xeb73('0x46')]=_[_0xeb73('0x47')](_0x24d6fd[_0xeb73('0x43')],qs[_0xeb73('0x48')](_0x171869[_0xeb73('0x44')][_0xeb73('0x48')]));_0x32dfb2[_0xeb73('0x46')]=_0x32dfb2['attributes'][_0xeb73('0x49')]?_0x32dfb2['attributes']:_0x24d6fd[_0xeb73('0x43')];if(!_0x171869[_0xeb73('0x44')]['hasOwnProperty'](_0xeb73('0x4a'))){_0x32dfb2[_0xeb73('0x2f')]=qs[_0xeb73('0x2f')](_0x171869['query']['limit']);_0x32dfb2[_0xeb73('0x2d')]=qs[_0xeb73('0x2d')](_0x171869[_0xeb73('0x44')][_0xeb73('0x2d')]);}_0x32dfb2[_0xeb73('0x4b')]=qs[_0xeb73('0x4c')](_0x171869[_0xeb73('0x44')][_0xeb73('0x4c')]);_0x32dfb2[_0xeb73('0x4d')]=qs['filters'](_['pick'](_0x171869[_0xeb73('0x44')],_0x24d6fd[_0xeb73('0x4e')]),_0x23e9dd);if(_0x171869[_0xeb73('0x44')][_0xeb73('0x4f')]){_0x32dfb2[_0xeb73('0x4d')]=_[_0xeb73('0x50')](_0x32dfb2['where'],{'$or':_[_0xeb73('0x40')](_0x23e9dd,function(_0x45b2b0){if(_0x45b2b0[_0xeb73('0x51')]!==_0xeb73('0x52')){var _0x54ee69={};_0x54ee69[_0x45b2b0[_0xeb73('0x3c')]]={'$like':'%'+_0x171869['query'][_0xeb73('0x4f')]+'%'};return _0x54ee69;}})});}_0x32dfb2=_[_0xeb73('0x50')]({},_0x32dfb2,_0x171869['options']);var _0x5e2270={'where':_0x32dfb2[_0xeb73('0x4d')]};return db[_0xeb73('0x41')][_0xeb73('0x30')](_0x5e2270)[_0xeb73('0x1f')](function(_0x4e62ed){_0x554284[_0xeb73('0x30')]=_0x4e62ed;if(_0x171869[_0xeb73('0x44')][_0xeb73('0x53')]){_0x32dfb2['include']=[{'all':!![]}];}return db[_0xeb73('0x41')][_0xeb73('0x54')](_0x32dfb2);})[_0xeb73('0x1f')](function(_0x496385){_0x554284['rows']=_0x496385;return _0x554284;})[_0xeb73('0x1f')](respondWithFilteredResult(_0x2eb5d7,_0x32dfb2))[_0xeb73('0x29')](handleError(_0x2eb5d7,null));};exports[_0xeb73('0x55')]=function(_0x36f5be,_0x57ff67){var _0x1b6e64={'raw':![],'where':{'id':_0x36f5be['params']['id']},'include':[{'model':db[_0xeb73('0x3e')],'as':'mandatoryDispositionPause'}]},_0x2cfce0={};_0x2cfce0[_0xeb73('0x43')]=_[_0xeb73('0x45')](db[_0xeb73('0x41')][_0xeb73('0x56')]);_0x2cfce0['query']=_[_0xeb73('0x45')](_0x36f5be['query']);_0x2cfce0['filters']=_['intersection'](_0x2cfce0[_0xeb73('0x43')],_0x2cfce0[_0xeb73('0x44')]);_0x1b6e64[_0xeb73('0x46')]=_[_0xeb73('0x47')](_0x2cfce0[_0xeb73('0x43')],qs[_0xeb73('0x48')](_0x36f5be[_0xeb73('0x44')][_0xeb73('0x48')]));_0x1b6e64[_0xeb73('0x46')]=_0x1b6e64[_0xeb73('0x46')][_0xeb73('0x49')]?_0x1b6e64[_0xeb73('0x46')]:_0x2cfce0['model'];if(_0x36f5be[_0xeb73('0x44')][_0xeb73('0x53')]){_0x1b6e64[_0xeb73('0x57')]=[{'all':!![]}];}_0x1b6e64=_[_0xeb73('0x50')]({},_0x1b6e64,_0x36f5be['options']);return db['FaxAccount'][_0xeb73('0x58')](_0x1b6e64)['then'](handleEntityNotFound(_0x57ff67,null))[_0xeb73('0x1f')](respondWithResult(_0x57ff67,null))[_0xeb73('0x29')](handleError(_0x57ff67,null));};exports[_0xeb73('0x59')]=function(_0x17424c,_0x1fbc77){return db[_0xeb73('0x41')][_0xeb73('0x59')](_0x17424c[_0xeb73('0x5a')],{})[_0xeb73('0x1f')](function(_0x1a2258){var _0x2d2b60=_0x17424c[_0xeb73('0x5b')][_0xeb73('0x37')]({'plain':!![]});if(!_0x2d2b60)throw new Error(_0xeb73('0x5c'));if(_0x2d2b60[_0xeb73('0x5d')]==='user'){var _0x108b8c=_0x1a2258[_0xeb73('0x37')]({'plain':!![]});var _0x10408a=_0xeb73('0x38');return db[_0xeb73('0x5e')][_0xeb73('0x58')]({'where':{'name':_0x10408a,'userProfileId':_0x2d2b60[_0xeb73('0x5f')]},'raw':!![]})[_0xeb73('0x1f')](function(_0x3783fd){if(_0x3783fd&&_0x3783fd[_0xeb73('0x60')]===0x0){return db[_0xeb73('0x39')]['create']({'name':_0x108b8c[_0xeb73('0x3c')],'resourceId':_0x108b8c['id'],'type':_0x3783fd[_0xeb73('0x3c')],'sectionId':_0x3783fd['id']},{})['then'](function(){return _0x1a2258;});}else{return _0x1a2258;}})[_0xeb73('0x29')](function(_0xe19844){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe19844);throw _0xe19844;});}return _0x1a2258;})[_0xeb73('0x1f')](respondWithResult(_0x1fbc77,0xc9))[_0xeb73('0x29')](handleError(_0x1fbc77,null));};exports['update']=function(_0x254a09,_0x3a499e){if(_0x254a09['body']['id']){delete _0x254a09[_0xeb73('0x5a')]['id'];}return db[_0xeb73('0x41')]['find']({'where':{'id':_0x254a09['params']['id']},'include':[{'model':db[_0xeb73('0x3e')],'as':_0xeb73('0x3f')}]})[_0xeb73('0x1f')](handleEntityNotFound(_0x3a499e,null))[_0xeb73('0x1f')](saveUpdates(_0x254a09[_0xeb73('0x5a')],null))[_0xeb73('0x1f')](respondWithResult(_0x3a499e,null))[_0xeb73('0x29')](handleError(_0x3a499e,null));};exports[_0xeb73('0x3a')]=function(_0x10ac7f,_0x951b59){return db['FaxAccount'][_0xeb73('0x58')]({'where':{'id':_0x10ac7f[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x951b59,null))['then'](removeEntity(_0x951b59,null))['catch'](handleError(_0x951b59,null));};exports[_0xeb73('0x62')]=function(_0x324ce0,_0x56fef8){return db[_0xeb73('0x41')][_0xeb73('0x62')]()[_0xeb73('0x1f')](respondWithResult(_0x56fef8,null))[_0xeb73('0x29')](handleError(_0x56fef8,null));};exports[_0xeb73('0x63')]=function(_0x3b5139,_0x372a12,_0x58bf81){if(_0x3b5139[_0xeb73('0x5a')]['id']){delete _0x3b5139[_0xeb73('0x5a')]['id'];}return db[_0xeb73('0x41')][_0xeb73('0x58')]({'where':{'id':_0x3b5139[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x372a12,null))[_0xeb73('0x1f')](function(_0x7a6895){if(_0x7a6895){_0x3b5139[_0xeb73('0x5a')]['FaxAccountId']=_0x7a6895['id'];return db['Disposition']['create'](_0x3b5139[_0xeb73('0x5a')]);}})['then'](respondWithResult(_0x372a12,null))[_0xeb73('0x29')](handleError(_0x372a12,null));};exports['getDispositions']=function(_0x2ba561,_0x250f76,_0x5aeed1){var _0x307896={'raw':![],'where':{}};var _0x5269e9={};var _0x229172={'count':0x0,'rows':[]};return db[_0xeb73('0x41')][_0xeb73('0x64')]({'where':{'id':_0x2ba561[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x250f76,null))['then'](function(_0x29e389){if(_0x29e389){_0x5269e9[_0xeb73('0x43')]=_[_0xeb73('0x45')](db[_0xeb73('0x65')][_0xeb73('0x56')]);_0x5269e9[_0xeb73('0x44')]=_[_0xeb73('0x45')](_0x2ba561[_0xeb73('0x44')]);_0x5269e9[_0xeb73('0x4e')]=_[_0xeb73('0x47')](_0x5269e9[_0xeb73('0x43')],_0x5269e9[_0xeb73('0x44')]);_0x307896['attributes']=_[_0xeb73('0x47')](_0x5269e9[_0xeb73('0x43')],qs['fields'](_0x2ba561[_0xeb73('0x44')][_0xeb73('0x48')]));_0x307896[_0xeb73('0x46')]=_0x307896[_0xeb73('0x46')][_0xeb73('0x49')]?_0x307896[_0xeb73('0x46')]:_0x5269e9['model'];if(!_0x2ba561[_0xeb73('0x44')][_0xeb73('0x66')](_0xeb73('0x4a'))){_0x307896[_0xeb73('0x2f')]=qs[_0xeb73('0x2f')](_0x2ba561[_0xeb73('0x44')][_0xeb73('0x2f')]);_0x307896[_0xeb73('0x2d')]=qs[_0xeb73('0x2d')](_0x2ba561[_0xeb73('0x44')][_0xeb73('0x2d')]);}_0x307896[_0xeb73('0x4b')]=qs[_0xeb73('0x4c')](_0x2ba561[_0xeb73('0x44')][_0xeb73('0x4c')]);_0x307896['where']=qs[_0xeb73('0x4e')](_[_0xeb73('0x67')](_0x2ba561['query'],_0x5269e9[_0xeb73('0x4e')]));_0x307896[_0xeb73('0x4d')][_0xeb73('0x68')]=_0x29e389['id'];if(_0x2ba561[_0xeb73('0x44')][_0xeb73('0x4f')]){_0x307896['where']=_[_0xeb73('0x50')](_0x307896['where'],{'$or':_[_0xeb73('0x40')](_0x307896['attributes'],function(_0x67f1ad){var _0x1b15f3={};_0x1b15f3[_0x67f1ad]={'$like':'%'+_0x2ba561[_0xeb73('0x44')][_0xeb73('0x4f')]+'%'};return _0x1b15f3;})});}_0x307896=_['merge']({},_0x307896,_0x2ba561['options']);return db[_0xeb73('0x65')][_0xeb73('0x30')]({'where':_0x307896[_0xeb73('0x4d')]})[_0xeb73('0x1f')](function(_0x57e5ba){_0x229172[_0xeb73('0x30')]=_0x57e5ba;if(_0x2ba561[_0xeb73('0x44')][_0xeb73('0x53')]){_0x307896['include']=[{'all':!![]}];}return db['Disposition'][_0xeb73('0x54')](_0x307896);})['then'](function(_0x11f77f){_0x229172[_0xeb73('0x69')]=_0x11f77f;return _0x229172;});}})[_0xeb73('0x1f')](respondWithFilteredResult(_0x250f76,_0x307896))[_0xeb73('0x29')](handleError(_0x250f76,null));};exports[_0xeb73('0x6a')]=function(_0x53819a,_0x249a17,_0x26638c){return db[_0xeb73('0x41')][_0xeb73('0x58')]({'where':{'id':_0x53819a[_0xeb73('0x61')]['id']}})['then'](handleEntityNotFound(_0x249a17,null))[_0xeb73('0x1f')](function(_0xbbd6e5){if(_0xbbd6e5){return _0xbbd6e5[_0xeb73('0x6a')](_0x53819a['query'][_0xeb73('0x6b')]);}})[_0xeb73('0x1f')](respondWithStatusCode(_0x249a17,null))[_0xeb73('0x29')](handleError(_0x249a17,null));};exports[_0xeb73('0x6c')]=function(_0x5b5953,_0x1cefc3,_0xf0dc1a){if(_0x5b5953['body']['id']){delete _0x5b5953[_0xeb73('0x5a')]['id'];}return db[_0xeb73('0x41')][_0xeb73('0x58')]({'where':{'id':_0x5b5953[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x1cefc3,null))[_0xeb73('0x1f')](function(_0x3aa686){if(_0x3aa686){_0x5b5953[_0xeb73('0x5a')][_0xeb73('0x68')]=_0x3aa686['id'];return db[_0xeb73('0x6d')]['create'](_0x5b5953[_0xeb73('0x5a')]);}})[_0xeb73('0x1f')](respondWithResult(_0x1cefc3,null))[_0xeb73('0x29')](handleError(_0x1cefc3,null));};exports['getAnswers']=function(_0x5db95d,_0x3b844a,_0x9632c2){var _0x283fae={'raw':![],'where':{}};var _0xfcccd5={};var _0x21b1f4={'count':0x0,'rows':[]};return db[_0xeb73('0x41')][_0xeb73('0x64')]({'where':{'id':_0x5db95d['params']['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x3b844a,null))[_0xeb73('0x1f')](function(_0x13319e){if(_0x13319e){_0xfcccd5[_0xeb73('0x43')]=_[_0xeb73('0x45')](db['CannedAnswer']['rawAttributes']);_0xfcccd5[_0xeb73('0x44')]=_[_0xeb73('0x45')](_0x5db95d['query']);_0xfcccd5['filters']=_[_0xeb73('0x47')](_0xfcccd5[_0xeb73('0x43')],_0xfcccd5[_0xeb73('0x44')]);_0x283fae[_0xeb73('0x46')]=_[_0xeb73('0x47')](_0xfcccd5[_0xeb73('0x43')],qs[_0xeb73('0x48')](_0x5db95d[_0xeb73('0x44')][_0xeb73('0x48')]));_0x283fae[_0xeb73('0x46')]=_0x283fae[_0xeb73('0x46')][_0xeb73('0x49')]?_0x283fae['attributes']:_0xfcccd5[_0xeb73('0x43')];if(!_0x5db95d['query']['hasOwnProperty'](_0xeb73('0x4a'))){_0x283fae[_0xeb73('0x2f')]=qs[_0xeb73('0x2f')](_0x5db95d['query'][_0xeb73('0x2f')]);_0x283fae[_0xeb73('0x2d')]=qs[_0xeb73('0x2d')](_0x5db95d[_0xeb73('0x44')][_0xeb73('0x2d')]);}_0x283fae['order']=qs[_0xeb73('0x4c')](_0x5db95d[_0xeb73('0x44')][_0xeb73('0x4c')]);_0x283fae[_0xeb73('0x4d')]=qs[_0xeb73('0x4e')](_[_0xeb73('0x67')](_0x5db95d[_0xeb73('0x44')],_0xfcccd5[_0xeb73('0x4e')]));_0x283fae[_0xeb73('0x4d')][_0xeb73('0x68')]=_0x13319e['id'];if(_0x5db95d[_0xeb73('0x44')][_0xeb73('0x4f')]){_0x283fae['where']=_[_0xeb73('0x50')](_0x283fae[_0xeb73('0x4d')],{'$or':_[_0xeb73('0x40')](_0x283fae['attributes'],function(_0x44b049){var _0x44f9b2={};_0x44f9b2[_0x44b049]={'$like':'%'+_0x5db95d[_0xeb73('0x44')][_0xeb73('0x4f')]+'%'};return _0x44f9b2;})});}_0x283fae=_[_0xeb73('0x50')]({},_0x283fae,_0x5db95d['options']);return db[_0xeb73('0x6d')][_0xeb73('0x30')]({'where':_0x283fae['where']})[_0xeb73('0x1f')](function(_0x559809){_0x21b1f4[_0xeb73('0x30')]=_0x559809;if(_0x5db95d['query']['includeAll']){_0x283fae[_0xeb73('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xeb73('0x54')](_0x283fae);})['then'](function(_0x237aa1){_0x21b1f4[_0xeb73('0x69')]=_0x237aa1;return _0x21b1f4;});}})[_0xeb73('0x1f')](respondWithFilteredResult(_0x3b844a,_0x283fae))[_0xeb73('0x29')](handleError(_0x3b844a,null));};exports[_0xeb73('0x6e')]=function(_0xa642a0,_0x49c4f4,_0x401e67){return db[_0xeb73('0x41')][_0xeb73('0x58')]({'where':{'id':_0xa642a0[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x49c4f4,null))['then'](function(_0x2f86e6){if(_0x2f86e6){return _0x2f86e6[_0xeb73('0x6e')](_0xa642a0['query'][_0xeb73('0x6b')]);}})['then'](respondWithStatusCode(_0x49c4f4,null))[_0xeb73('0x29')](handleError(_0x49c4f4,null));};exports[_0xeb73('0x6f')]=function(_0x468115,_0x103fe1,_0x76d20b){return db[_0xeb73('0x70')][_0xeb73('0x58')]({'where':{'id':_0x468115['params']['id']}})['then'](handleEntityNotFound(_0x103fe1,null))[_0xeb73('0x1f')](function(_0x52bd05){if(_0x52bd05){return _0x52bd05[_0xeb73('0x6f')](_0x468115[_0xeb73('0x5a')]['ids'],_['omit'](_0x468115[_0xeb73('0x5a')],['ids','id'])||{});}})[_0xeb73('0x1f')](respondWithResult(_0x103fe1,null))['catch'](handleError(_0x103fe1,null));};exports[_0xeb73('0x71')]=function(_0x115636,_0x54c0ab,_0xd57b6d){var _0x1faa74={'raw':![],'where':{}};var _0x2f6a5f={};var _0x1a5d41={'count':0x0,'rows':[]};return db['FaxAccount'][_0xeb73('0x64')]({'where':{'id':_0x115636[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x54c0ab,null))[_0xeb73('0x1f')](function(_0xbf7f47){if(_0xbf7f47){_0x2f6a5f[_0xeb73('0x43')]=_[_0xeb73('0x45')](db['FaxInteraction'][_0xeb73('0x56')]);_0x2f6a5f[_0xeb73('0x44')]=_[_0xeb73('0x45')](_0x115636[_0xeb73('0x44')]);_0x2f6a5f['filters']=_[_0xeb73('0x47')](_0x2f6a5f[_0xeb73('0x43')],_0x2f6a5f[_0xeb73('0x44')]);_0x1faa74['attributes']=_['intersection'](_0x2f6a5f[_0xeb73('0x43')],qs[_0xeb73('0x48')](_0x115636['query'][_0xeb73('0x48')]));_0x1faa74[_0xeb73('0x46')]=_0x1faa74[_0xeb73('0x46')]['length']?_0x1faa74[_0xeb73('0x46')]:_0x2f6a5f[_0xeb73('0x43')];if(!_0x115636[_0xeb73('0x44')]['hasOwnProperty'](_0xeb73('0x4a'))){_0x1faa74['limit']=qs[_0xeb73('0x2f')](_0x115636['query'][_0xeb73('0x2f')]);_0x1faa74[_0xeb73('0x2d')]=qs[_0xeb73('0x2d')](_0x115636['query']['offset']);}_0x1faa74['order']=qs[_0xeb73('0x4c')](_0x115636['query'][_0xeb73('0x4c')]);_0x1faa74[_0xeb73('0x4d')]=qs[_0xeb73('0x4e')](_[_0xeb73('0x67')](_0x115636[_0xeb73('0x44')],_0x2f6a5f['filters']));_0x1faa74[_0xeb73('0x4d')][_0xeb73('0x68')]=_0xbf7f47['id'];if(_0x115636[_0xeb73('0x44')]['filter']){_0x1faa74[_0xeb73('0x4d')]=_[_0xeb73('0x50')](_0x1faa74[_0xeb73('0x4d')],{'$or':_['map'](_0x1faa74['attributes'],function(_0x30bde7){var _0xc6e0ab={};_0xc6e0ab[_0x30bde7]={'$like':'%'+_0x115636[_0xeb73('0x44')][_0xeb73('0x4f')]+'%'};return _0xc6e0ab;})});}_0x1faa74=_[_0xeb73('0x50')]({},_0x1faa74,_0x115636[_0xeb73('0x72')]);return db[_0xeb73('0x70')]['count']({'where':_0x1faa74[_0xeb73('0x4d')]})['then'](function(_0x3fc7a2){_0x1a5d41['count']=_0x3fc7a2;if(_0x115636[_0xeb73('0x44')]['includeAll']){_0x1faa74[_0xeb73('0x57')]=[{'model':db[_0xeb73('0x73')],'as':_0xeb73('0x74'),'required':![]},{'model':db[_0xeb73('0x75')],'as':_0xeb73('0x76'),'attributes':[_0xeb73('0x3c'),_0xeb73('0x77'),_0xeb73('0x78')],'required':![]},{'model':db[_0xeb73('0x79')],'as':'Tags','attributes':['id',_0xeb73('0x3c'),_0xeb73('0x7a')],'where':_0x115636[_0xeb73('0x44')][_0xeb73('0x7b')]?{'id':_0x115636[_0xeb73('0x44')][_0xeb73('0x7b')]}:undefined,'required':_0x115636[_0xeb73('0x44')][_0xeb73('0x7b')]?!![]:![]}];}return db[_0xeb73('0x70')]['findAll'](_0x1faa74);})[_0xeb73('0x1f')](function(_0x4e91f0){_0x1a5d41[_0xeb73('0x69')]=_0x4e91f0;return _0x1a5d41;});}})[_0xeb73('0x1f')](respondWithFilteredResult(_0x54c0ab,_0x1faa74))['catch'](handleError(_0x54c0ab,null));};exports[_0xeb73('0x7c')]=function(_0x193a03,_0x56e9d0){var _0x47ce9f=_0x193a03[_0xeb73('0x61')]['id'];var _0x18cd6c=_0x193a03[_0xeb73('0x5a')];var _0x3493b6=0xc8;var _0x525bf1=null;return db[_0xeb73('0x7d')][_0xeb73('0x7e')]({'isolationLevel':db[_0xeb73('0x7d')][_0xeb73('0x7f')][_0xeb73('0x80')]['READ_COMMITTED']},function(_0x55a11a){return db[_0xeb73('0x41')][_0xeb73('0x64')]({'where':{'id':_0x47ce9f},'transaction':_0x55a11a})[_0xeb73('0x1f')](function(_0x3ce95d){if(_0x3ce95d){return db[_0xeb73('0x81')]['destroy']({'where':{'FaxAccountId':_0x47ce9f},'transaction':_0x55a11a})['then'](function(){var _0x941b8=_[_0xeb73('0x40')](_0x18cd6c,function(_0x958a8){_0x958a8['FaxAccountId']=_0x47ce9f;return _0x958a8;});return db[_0xeb73('0x81')][_0xeb73('0x82')](_0x941b8,{'transaction':_0x55a11a});});}else{_0x3493b6=0x194;_0x525bf1=[];}});})['then'](function(){if(_0x3493b6!==0x194){return db[_0xeb73('0x81')][_0xeb73('0x83')]({'where':{'FaxAccountId':_0x47ce9f},'order':_0xeb73('0x84')})['then'](function(_0x29df44){_0x525bf1=_0x29df44;});}})[_0xeb73('0x29')](function(_0x56b01e){_0x3493b6=0x1f4;logger[_0xeb73('0x25')](_0x56b01e['stack']);if(_0x56b01e[_0xeb73('0x3c')]){delete _0x56b01e[_0xeb73('0x3c')];}_0x525bf1=_0x56b01e;})[_0xeb73('0x85')](function(){if(_0x525bf1===null){_0x56e9d0[_0xeb73('0x2a')](_0x3493b6);}else{if(_0x3493b6===0x1f4){_0x56e9d0[_0xeb73('0x2b')](_0x3493b6)[_0xeb73('0x86')](_0x525bf1);}else{_0x56e9d0['status'](_0x3493b6)[_0xeb73('0x2c')](_0x525bf1);}}});};exports[_0xeb73('0x87')]=function(_0x2e5168,_0x3dd117,_0x26794a){var _0x45bddb={};var _0x278e76={};var _0x895448;var _0x3321c5;return db[_0xeb73('0x41')][_0xeb73('0x64')]({'where':{'id':_0x2e5168['params']['id']}})['then'](handleEntityNotFound(_0x3dd117,null))[_0xeb73('0x1f')](function(_0x90661e){if(_0x90661e){_0x895448=_0x90661e;_0x278e76['model']=_[_0xeb73('0x45')](db[_0xeb73('0x81')]['rawAttributes']);_0x278e76[_0xeb73('0x44')]=_['keys'](_0x2e5168[_0xeb73('0x44')]);_0x278e76[_0xeb73('0x4e')]=_[_0xeb73('0x47')](_0x278e76[_0xeb73('0x43')],_0x278e76[_0xeb73('0x44')]);_0x45bddb['attributes']=_['intersection'](_0x278e76[_0xeb73('0x43')],qs[_0xeb73('0x48')](_0x2e5168[_0xeb73('0x44')][_0xeb73('0x48')]));_0x45bddb['attributes']=_0x45bddb[_0xeb73('0x46')][_0xeb73('0x49')]?_0x45bddb[_0xeb73('0x46')]:_0x278e76[_0xeb73('0x43')];_0x45bddb['order']=qs[_0xeb73('0x4c')](_0x2e5168['query'][_0xeb73('0x4c')]);_0x45bddb[_0xeb73('0x4d')]=qs[_0xeb73('0x4e')](_[_0xeb73('0x67')](_0x2e5168['query'],_0x278e76[_0xeb73('0x4e')]));if(_0x2e5168[_0xeb73('0x44')]['filter']){_0x45bddb[_0xeb73('0x4d')]=_['merge'](_0x45bddb[_0xeb73('0x4d')],{'$or':_[_0xeb73('0x40')](_0x45bddb[_0xeb73('0x46')],function(_0x13bc10){var _0x1b44fd={};_0x1b44fd[_0x13bc10]={'$like':'%'+_0x2e5168[_0xeb73('0x44')][_0xeb73('0x4f')]+'%'};return _0x1b44fd;})});}_0x45bddb=_['merge']({},_0x45bddb,_0x2e5168['options']);return _0x895448['getApplications'](_0x45bddb);}})[_0xeb73('0x1f')](function(_0x901cb5){if(_0x901cb5){_0x3321c5=_0x901cb5[_0xeb73('0x49')];if(!_0x2e5168['query'][_0xeb73('0x66')](_0xeb73('0x4a'))){_0x45bddb[_0xeb73('0x2f')]=qs[_0xeb73('0x2f')](_0x2e5168['query'][_0xeb73('0x2f')]);_0x45bddb[_0xeb73('0x2d')]=qs[_0xeb73('0x2d')](_0x2e5168['query'][_0xeb73('0x2d')]);}return _0x895448['getApplications'](_0x45bddb);}})[_0xeb73('0x1f')](function(_0x571ec8){if(_0x571ec8){return _0x571ec8?{'count':_0x3321c5,'rows':_0x571ec8}:null;}})['then'](respondWithResult(_0x3dd117,null))[_0xeb73('0x29')](handleError(_0x3dd117,null));};function Extension(_0x212478,_0x4cb592,_0xcafba0,_0x48d430){this[_0xeb73('0x88')]='from-voip-provider';this['exten']=_0x212478[_0xeb73('0x89')];this[_0xeb73('0x8a')]=_0x48d430;this[_0xeb73('0x51')]=_0xeb73('0x8b');this[_0xeb73('0x8c')]=_0xeb73('0x8d');this[_0xeb73('0x68')]=_0x212478['id'];this[_0xeb73('0x84')]=_0x4cb592;this[_0xeb73('0x8e')]=_0xcafba0;}function createExtensionsReciveFax(_0x2ad096){var _0x290f87=0x1;var _0x5484d2=[];_0x5484d2[_0xeb73('0x8f')](new Extension(_0x2ad096,_0x290f87,'','Answer'));_0x290f87+=0x1;_0x5484d2[_0xeb73('0x8f')](new Extension(_0x2ad096,_0x290f87,'CDR(type)=inbound-fax','Set'));_0x290f87+=0x1;for(var _0x180a73 in _0x2ad096){if(_0x2ad096['hasOwnProperty'](_0x180a73)&&(_0x180a73===_0xeb73('0x90')||_0x180a73===_0xeb73('0x89')||_0x180a73==='gateway'||_0x180a73===_0xeb73('0x91')||_0x180a73===_0xeb73('0x92')||_0x180a73===_0xeb73('0x93')||_0x180a73===_0xeb73('0x94')||_0x180a73===_0xeb73('0x95')||_0x180a73==='t38timeout')){_0x5484d2[_0xeb73('0x8f')](new Extension(_0x2ad096,_0x290f87,'FAXOPT('+_0x180a73+')='+_0x2ad096[_0x180a73],_0xeb73('0x96')));_0x290f87+=0x1;}}_0x5484d2[_0xeb73('0x8f')](new Extension(_0x2ad096,_0x290f87,'6',_0xeb73('0x97')));_0x290f87+=0x1;_0x5484d2[_0xeb73('0x8f')](new Extension(_0x2ad096,_0x290f87,_0xeb73('0x98'),_0xeb73('0x99')));_0x290f87=0x0;return _0x5484d2;}exports[_0xeb73('0x9a')]=function(_0x5d24e3,_0x581f08,_0x34052c){var _0x587f11;return db[_0xeb73('0x7d')][_0xeb73('0x7e')](function(_0x497fe1){return db[_0xeb73('0x41')]['create'](_0x5d24e3[_0xeb73('0x5a')],{'transaction':_0x497fe1})[_0xeb73('0x1f')](function(_0x43a8c5){_0x587f11=_0x43a8c5['get']({'plain':!![]});return db['VoiceExtension'][_0xeb73('0x82')](createExtensionsReciveFax(_0x587f11),{'transaction':_0x497fe1});});})[_0xeb73('0x1f')](function(){return _0x587f11;})['then'](respondWithResult(_0x581f08,null))[_0xeb73('0x29')](handleError(_0x581f08,null));};exports[_0xeb73('0x9b')]=function(_0xd0845f,_0x23f0e6,_0x88984a){var _0x18c84c;return db['sequelize'][_0xeb73('0x7e')](function(_0x4c31cc){return db[_0xeb73('0x41')][_0xeb73('0x36')](_0xd0845f[_0xeb73('0x5a')],{'where':{'id':_0xd0845f['body']['id']},'transaction':_0x4c31cc})[_0xeb73('0x1f')](function(_0x3ae3ca){return db['VoiceExtension'][_0xeb73('0x3a')]({'where':{'FaxAccountId':_0xd0845f[_0xeb73('0x5a')]['id']},'transaction':_0x4c31cc})[_0xeb73('0x1f')](function(_0x13b48a){return db['VoiceExtension'][_0xeb73('0x82')](createExtensionsReciveFax(_['omit'](_0xd0845f[_0xeb73('0x5a')],[_0xeb73('0x9c'),_0xeb73('0x9d'),_0xeb73('0x9e'),_0xeb73('0x9f'),'TrunkId',_0xeb73('0xa0')])),{'transaction':_0x4c31cc});});});})[_0xeb73('0x1f')](function(){return db[_0xeb73('0x41')][_0xeb73('0xa1')](_0xd0845f[_0xeb73('0x5a')]['id']);})[_0xeb73('0x1f')](respondWithResult(_0x23f0e6,null))[_0xeb73('0x29')](handleError(_0x23f0e6,null));};exports[_0xeb73('0xa2')]=function(_0x81b3c,_0x5ce6d4,_0x50ffde){var _0xff3529={'raw':!![],'where':{}};var _0x27c340={};var _0x282922={'count':0x0,'rows':[]};return db['FaxAccount'][_0xeb73('0x64')]({'where':{'id':_0x81b3c[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x5ce6d4,null))[_0xeb73('0x1f')](function(_0x1adfcf){if(_0x1adfcf){_0x27c340[_0xeb73('0x43')]=_[_0xeb73('0x45')](db[_0xeb73('0xa3')]['rawAttributes']);_0x27c340[_0xeb73('0x44')]=_[_0xeb73('0x45')](_0x81b3c[_0xeb73('0x44')]);_0x27c340['filters']=_[_0xeb73('0x47')](_0x27c340[_0xeb73('0x43')],_0x27c340[_0xeb73('0x44')]);_0xff3529['attributes']=_[_0xeb73('0x47')](_0x27c340['model'],qs[_0xeb73('0x48')](_0x81b3c[_0xeb73('0x44')][_0xeb73('0x48')]));_0xff3529['attributes']=_0xff3529[_0xeb73('0x46')][_0xeb73('0x49')]?_0xff3529[_0xeb73('0x46')]:_0x27c340[_0xeb73('0x43')];if(!_0x81b3c[_0xeb73('0x44')][_0xeb73('0x66')](_0xeb73('0x4a'))){_0xff3529[_0xeb73('0x2f')]=qs[_0xeb73('0x2f')](_0x81b3c[_0xeb73('0x44')][_0xeb73('0x2f')]);_0xff3529[_0xeb73('0x2d')]=qs[_0xeb73('0x2d')](_0x81b3c[_0xeb73('0x44')][_0xeb73('0x2d')]);}_0xff3529[_0xeb73('0x4b')]=qs[_0xeb73('0x4c')](_0x81b3c[_0xeb73('0x44')]['sort']);_0xff3529[_0xeb73('0x4d')]=qs[_0xeb73('0x4e')](_[_0xeb73('0x67')](_0x81b3c[_0xeb73('0x44')],_0x27c340['filters']));_0xff3529['where'][_0xeb73('0x68')]=_0x1adfcf['id'];if(_0x81b3c[_0xeb73('0x44')][_0xeb73('0x4f')]){_0xff3529[_0xeb73('0x4d')]=_[_0xeb73('0x50')](_0xff3529[_0xeb73('0x4d')],{'$or':_['map'](_0xff3529[_0xeb73('0x46')],function(_0x22c458){var _0x2e398d={};_0x2e398d[_0x22c458]={'$like':'%'+_0x81b3c[_0xeb73('0x44')][_0xeb73('0x4f')]+'%'};return _0x2e398d;})});}if(_0x81b3c[_0xeb73('0x44')][_0xeb73('0xa4')]){var _0x12b4e6=_0x81b3c[_0xeb73('0x44')][_0xeb73('0xa4')][_0xeb73('0xa5')](',');var _0x28d92a={};_0x28d92a[_0x12b4e6[0x0]]={'$gte':moment(_0x12b4e6[0x1])['format'](_0xeb73('0xa6'))};_0xff3529[_0xeb73('0x4d')]=_['merge'](_0xff3529[_0xeb73('0x4d')],_0x28d92a);}_0xff3529=_[_0xeb73('0x50')]({},_0xff3529,_0x81b3c[_0xeb73('0x72')]);return db[_0xeb73('0xa3')]['count']({'where':_0xff3529[_0xeb73('0x4d')]})[_0xeb73('0x1f')](function(_0x11faa1){_0x282922['count']=_0x11faa1;if(_0x81b3c[_0xeb73('0x44')][_0xeb73('0x53')]){_0xff3529[_0xeb73('0x57')]=[{'all':!![]}];}return db[_0xeb73('0xa3')][_0xeb73('0x54')](_0xff3529);})['then'](function(_0x2ac3b5){_0x282922[_0xeb73('0x69')]=_0x2ac3b5;return _0x282922;});}})[_0xeb73('0x1f')](respondWithFilteredResult(_0x5ce6d4,_0xff3529))[_0xeb73('0x29')](handleError(_0x5ce6d4,null));};exports['send']=function(_0x31382a,_0x415ccb,_0x43e4c7){var _0x3ae615,_0x35b53b={},_0x2338fa;if(_0x31382a['body']['to']){_0x2338fa=_0x31382a[_0xeb73('0x5a')]['to'][0x0];}return db[_0xeb73('0x41')]['find']({'where':{'id':_0x31382a['params']['id']},'include':[{'model':db[_0xeb73('0xa7')],'as':_0xeb73('0xa8'),'include':[{'model':db[_0xeb73('0x73')],'as':_0xeb73('0xa9'),'where':{'fax':_0x2338fa},'limit':0x1,'order':[['updatedAt',_0xeb73('0xaa')]]}]}]})[_0xeb73('0x1f')](handleEntityNotFound(_0x415ccb,null))['then'](function(_0x20190a){_0x3ae615=_0x20190a;if(_0x31382a[_0xeb73('0x5a')]['attachments']&&_0x31382a['body'][_0xeb73('0xab')][_0xeb73('0x49')]){for(var _0x305011=0x0;_0x305011<_0x31382a[_0xeb73('0x5a')]['attachments'][_0xeb73('0x49')];_0x305011+=0x1){_0x31382a[_0xeb73('0x5a')][_0xeb73('0xab')][_0x305011]={'filename':_0x31382a[_0xeb73('0x5a')]['attachments'][_0x305011][_0xeb73('0x3c')],'id':_0x31382a[_0xeb73('0x5a')]['attachments'][_0x305011]['id'],'path':path[_0xeb73('0xac')](config['root'],'server/files/attachments',_0x31382a[_0xeb73('0x5a')]['attachments'][_0x305011][_0xeb73('0xad')])};}}return respondWithRpcPromise('CheckAfterSend',_0xeb73('0xae'),{'FaxAccountId':_[_0xeb73('0xaf')](_0x31382a[_0xeb73('0x61')]['id'])?undefined:_0x31382a[_0xeb73('0x61')]['id'],'path':_[_0xeb73('0xaf')](_0x31382a[_0xeb73('0x5a')][_0xeb73('0xab')][0x0][_0xeb73('0x7')])?undefined:_0x31382a['body'][_0xeb73('0xab')][0x0][_0xeb73('0x7')],'fax':_[_0xeb73('0xaf')](_0x31382a[_0xeb73('0x5a')]['to'][0x0])?undefined:_0x31382a[_0xeb73('0x5a')]['to'][0x0]},client9002);})[_0xeb73('0x1f')](function(){if(_0x3ae615){if(_[_0xeb73('0xaf')](_0x31382a[_0xeb73('0x5a')][_0xeb73('0xb0')])){_0x31382a[_0xeb73('0x5a')][_0xeb73('0xb0')]=util[_0xeb73('0xb1')](_0xeb73('0xb2'),_0x3ae615['name'],_0x3ae615[_0xeb73('0xb3')]);}if(_0x3ae615[_0xeb73('0xa8')]){if(_0x3ae615[_0xeb73('0xa8')][_0xeb73('0xa9')][_0xeb73('0x49')]){return _0x3ae615[_0xeb73('0xa8')][_0xeb73('0xa9')][0x0];}else{return db[_0xeb73('0x73')][_0xeb73('0x59')](_[_0xeb73('0x17')](_0x31382a[_0xeb73('0x5a')],{'firstName':_0x31382a[_0xeb73('0x5a')]['to'][0x0],'phone':_0x31382a[_0xeb73('0x5a')]['to'][0x0],'fax':_0x31382a[_0xeb73('0x5a')]['to'][0x0],'ListId':_0x3ae615[_0xeb73('0xa0')]}));}}else{throw new Error(_0xeb73('0xb4'));}}else{throw new Error(_0xeb73('0xb5'));}})[_0xeb73('0x1f')](function(_0x3149f4){if(_0x3149f4){return db[_0xeb73('0x70')][_0xeb73('0x58')]({'where':{'ContactId':_0x3149f4['id'],'closed':![],'FaxAccountId':_0x3ae615['id']}})[_0xeb73('0x1f')](function(_0x2bfd01){if(_0x2bfd01){return[_0x2bfd01,![]];}return db[_0xeb73('0x70')][_0xeb73('0x59')]({'UserId':_0x31382a['user']['id'],'ContactId':_0x3149f4['id'],'FaxAccountId':_0x3ae615['id'],'fax':_0x31382a[_0xeb73('0x5a')]['to'][0x0],'firstMsgDirection':_0xeb73('0xb6'),'Messages':[_[_0xeb73('0x50')](_0x31382a['body'],{'read':![],'body':_0x31382a[_0xeb73('0x5a')][_0xeb73('0xab')][0x0][_0xeb73('0xb7')],'FaxAccountId':_0x3ae615['id'],'UserId':_0x31382a['user']['id'],'ContactId':_0x3149f4['id'],'AttachmentId':_0x31382a[_0xeb73('0x5a')][_0xeb73('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xeb73('0xa3')],'as':_0xeb73('0xb8')}]})[_0xeb73('0x1f')](function(_0x29fd16){return[_0x29fd16,!![]];});});}else{throw new Error(_0xeb73('0xb9'));}})[_0xeb73('0xba')](function(_0x3764ef,_0x35ebd2){if(_0x35ebd2){return _0x3764ef;}return db[_0xeb73('0xa3')]['create']({'direction':'out','read':![],'body':_0x31382a[_0xeb73('0x5a')]['attachments'][0x0][_0xeb73('0xb7')],'FaxAccountId':_0x3ae615['id'],'FaxInteractionId':_0x3764ef['id'],'UserId':_0x31382a[_0xeb73('0x5b')]['id'],'ContactId':_0x3764ef[_0xeb73('0xbb')],'AttachmentId':_0x31382a[_0xeb73('0x5a')][_0xeb73('0xab')][0x0]['id']})['then'](function(_0xde9785){_0x3764ef[_0xeb73('0xbc')][_0xeb73('0xb8')]=[];_0x3764ef[_0xeb73('0xbc')][_0xeb73('0xb8')][_0xeb73('0x8f')](_0xde9785['dataValues']);return _0x3764ef;});})['then'](function(_0x51ffca){respondWithRpcPromise(_0xeb73('0xbd'),_0xeb73('0xbd'),{'FaxAccountId':_[_0xeb73('0xaf')](_0x31382a['params']['id'])?undefined:_0x31382a['params']['id'],'path':_[_0xeb73('0xaf')](_0x31382a['body']['attachments'][0x0][_0xeb73('0x7')])?undefined:_0x31382a[_0xeb73('0x5a')][_0xeb73('0xab')][0x0][_0xeb73('0x7')],'fax':_[_0xeb73('0xaf')](_0x31382a['body']['to'][0x0])?undefined:_0x31382a[_0xeb73('0x5a')]['to'][0x0],'AttachmentId':_0x31382a[_0xeb73('0x5a')][_0xeb73('0xab')][0x0]['id']},client9002)[_0xeb73('0x1f')](function(_0x170aa2){logger[_0xeb73('0x20')](_0xeb73('0xbe'),_0x170aa2);})[_0xeb73('0x29')](function(_0x10140d){logger[_0xeb73('0x20')](_0xeb73('0xbe'),_0x10140d);});return _0x51ffca;})['then'](respondWithResult(_0x415ccb,null))['catch'](handleError(_0x415ccb,null));};exports[_0xeb73('0xbf')]=function(_0x35d3bb,_0x100021,_0x554403){return db[_0xeb73('0x41')][_0xeb73('0x58')]({'where':{'id':_0x35d3bb[_0xeb73('0x61')]['id']}})['then'](handleEntityNotFound(_0x100021,null))[_0xeb73('0x1f')](function(_0x3e6fbc){if(_0x3e6fbc){return _0x3e6fbc[_0xeb73('0xbf')](_0x35d3bb[_0xeb73('0x5a')][_0xeb73('0x6b')],_[_0xeb73('0xc0')](_0x35d3bb['body'],[_0xeb73('0x6b'),'id'])||{})[_0xeb73('0xba')](function(_0x543227){for(var _0xa49450=0x0;_0xa49450<_0x35d3bb['body'][_0xeb73('0x6b')]['length'];_0xa49450+=0x1){socket[_0xeb73('0xc1')](_0xeb73('0xc2'),{'UserId':Number(_0x35d3bb[_0xeb73('0x5a')][_0xeb73('0x6b')][_0xa49450]),'FaxAccountId':Number(_0x35d3bb[_0xeb73('0x61')]['id'])});}return _0x543227;});}})[_0xeb73('0x1f')](respondWithResult(_0x100021,null))[_0xeb73('0x29')](handleError(_0x100021,null));};exports[_0xeb73('0xc3')]=function(_0x3eca89,_0x1d239e,_0x325dcd){return db[_0xeb73('0x41')]['find']({'where':{'id':_0x3eca89[_0xeb73('0x61')]['id']}})[_0xeb73('0x1f')](handleEntityNotFound(_0x1d239e,null))[_0xeb73('0x1f')](function(_0x36ae70){if(_0x36ae70){return _0x36ae70[_0xeb73('0xc3')](_0x3eca89[_0xeb73('0x44')][_0xeb73('0x6b')])[_0xeb73('0x1f')](function(){if(_[_0xeb73('0xc4')](_0x3eca89['query'][_0xeb73('0x6b')])){for(var _0x302f07=0x0;_0x302f07<_0x3eca89['query'][_0xeb73('0x6b')][_0xeb73('0x49')];_0x302f07+=0x1){socket[_0xeb73('0xc1')](_0xeb73('0xc5'),{'UserId':Number(_0x3eca89[_0xeb73('0x44')]['ids'][_0x302f07]),'FaxAccountId':Number(_0x3eca89[_0xeb73('0x61')]['id'])});}}else{socket[_0xeb73('0xc1')](_0xeb73('0xc5'),{'UserId':Number(_0x3eca89[_0xeb73('0x44')][_0xeb73('0x6b')]),'FaxAccountId':Number(_0x3eca89[_0xeb73('0x61')]['id'])});}});}})[_0xeb73('0x1f')](respondWithStatusCode(_0x1d239e,null))[_0xeb73('0x29')](handleError(_0x1d239e,null));};exports[_0xeb73('0xc6')]=function(_0x1cd378,_0x1aa205,_0x222a3a){var _0x2623e4={};var _0x294281={};var _0x228f61;var _0x51db62;return db[_0xeb73('0x41')][_0xeb73('0x64')]({'where':{'id':_0x1cd378[_0xeb73('0x61')]['id']}})['then'](handleEntityNotFound(_0x1aa205,null))[_0xeb73('0x1f')](function(_0x4f117d){if(_0x4f117d){_0x228f61=_0x4f117d;_0x294281[_0xeb73('0x43')]=_[_0xeb73('0x45')](db[_0xeb73('0x75')][_0xeb73('0x56')]);_0x294281[_0xeb73('0x44')]=_[_0xeb73('0x45')](_0x1cd378[_0xeb73('0x44')]);_0x294281[_0xeb73('0x4e')]=_['intersection'](_0x294281[_0xeb73('0x43')],_0x294281[_0xeb73('0x44')]);_0x2623e4[_0xeb73('0x46')]=_[_0xeb73('0x47')](_0x294281[_0xeb73('0x43')],qs[_0xeb73('0x48')](_0x1cd378[_0xeb73('0x44')][_0xeb73('0x48')]));_0x2623e4[_0xeb73('0x46')]=_0x2623e4[_0xeb73('0x46')][_0xeb73('0x49')]?_0x2623e4[_0xeb73('0x46')]:_0x294281[_0xeb73('0x43')];_0x2623e4[_0xeb73('0x4b')]=qs[_0xeb73('0x4c')](_0x1cd378[_0xeb73('0x44')][_0xeb73('0x4c')]);_0x2623e4[_0xeb73('0x4d')]=qs[_0xeb73('0x4e')](_[_0xeb73('0x67')](_0x1cd378[_0xeb73('0x44')],_0x294281[_0xeb73('0x4e')]));if(_0x1cd378['query']['filter']){_0x2623e4['where']=_['merge'](_0x2623e4[_0xeb73('0x4d')],{'$or':_[_0xeb73('0x40')](_0x2623e4['attributes'],function(_0x610b33){var _0x4b78ed={};_0x4b78ed[_0x610b33]={'$like':'%'+_0x1cd378[_0xeb73('0x44')]['filter']+'%'};return _0x4b78ed;})});}_0x2623e4=_[_0xeb73('0x50')]({},_0x2623e4,_0x1cd378[_0xeb73('0x72')]);return _0x228f61[_0xeb73('0xc6')](_0x2623e4);}})[_0xeb73('0x1f')](function(_0x3319ac){if(_0x3319ac){_0x51db62=_0x3319ac[_0xeb73('0x49')];if(!_0x1cd378[_0xeb73('0x44')][_0xeb73('0x66')]('nolimit')){_0x2623e4[_0xeb73('0x2f')]=qs[_0xeb73('0x2f')](_0x1cd378[_0xeb73('0x44')][_0xeb73('0x2f')]);_0x2623e4['offset']=qs[_0xeb73('0x2d')](_0x1cd378[_0xeb73('0x44')]['offset']);}return _0x228f61['getAgents'](_0x2623e4);}})['then'](function(_0x43bf99){if(_0x43bf99){return _0x43bf99?{'count':_0x51db62,'rows':_0x43bf99}:null;}})['then'](respondWithResult(_0x1aa205,null))[_0xeb73('0x29')](handleError(_0x1aa205,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3b69be7..712fd35 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 _0xa9fc=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','hasOwnProperty','exports','events'];(function(_0x425e87,_0xcebe07){var _0x3ffa86=function(_0x5beafb){while(--_0x5beafb){_0x425e87['push'](_0x425e87['shift']());}};_0x3ffa86(++_0xcebe07);}(_0xa9fc,0x19f));var _0xca9f=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xa9fc[_0x3de873];return _0x380b8c;};'use strict';var EventEmitter=require(_0xca9f('0x0'));var FaxAccount=require(_0xca9f('0x1'))['db'][_0xca9f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xca9f('0x3')](0x0);var events={'afterCreate':_0xca9f('0x4'),'afterUpdate':'update','afterDestroy':_0xca9f('0x5')};function emitEvent(_0x4dc099){return function(_0xe81cd,_0x32709b,_0x5d2ddf){FaxAccountEvents['emit'](_0x4dc099+':'+_0xe81cd['id'],_0xe81cd);FaxAccountEvents['emit'](_0x4dc099,_0xe81cd);_0x5d2ddf(null);};}for(var e in events){if(events[_0xca9f('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xca9f('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x7ea4=['events','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x58b1ab,_0x4bf01b){var _0x471bc8=function(_0x2fbfd0){while(--_0x2fbfd0){_0x58b1ab['push'](_0x58b1ab['shift']());}};_0x471bc8(++_0x4bf01b);}(_0x7ea4,0x178));var _0x47ea=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x7ea4[_0x2dbcef];return _0x5a90ea;};'use strict';var EventEmitter=require(_0x47ea('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x47ea('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x47ea('0x2')](0x0);var events={'afterCreate':_0x47ea('0x3'),'afterUpdate':'update','afterDestroy':_0x47ea('0x4')};function emitEvent(_0x506a31){return function(_0x21261f,_0x4ce258,_0x50212b){FaxAccountEvents[_0x47ea('0x5')](_0x506a31+':'+_0x21261f['id'],_0x21261f);FaxAccountEvents['emit'](_0x506a31,_0x21261f);_0x50212b(null);};}for(var e in events){if(events[_0x47ea('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x47ea('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 531772b..7cf0b0f 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 _0xe3ab=['path','exports','define','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x238310,_0x50baad){var _0x95df5a=function(_0x1a6b3d){while(--_0x1a6b3d){_0x238310['push'](_0x238310['shift']());}};_0x95df5a(++_0x50baad);}(_0xe3ab,0xc2));var _0xbe3a=function(_0x3cbe0c,_0x4fe5ce){_0x3cbe0c=_0x3cbe0c-0x0;var _0x29294b=_0xe3ab[_0x3cbe0c];return _0x29294b;};'use strict';var _=require(_0xbe3a('0x0'));var util=require(_0xbe3a('0x1'));var logger=require(_0xbe3a('0x2'))('api');var moment=require(_0xbe3a('0x3'));var BPromise=require(_0xbe3a('0x4'));var rp=require(_0xbe3a('0x5'));var fs=require('fs');var path=require(_0xbe3a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xbe3a('0x7')]=function(_0x2fdb9a,_0x45d6c8){return _0x2fdb9a[_0xbe3a('0x8')]('FaxAccount',attributes,{'tableName':_0xbe3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cef=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0cef,0xf6));var _0xf0ce=function(_0x416a0a,_0x24f91f){_0x416a0a=_0x416a0a-0x0;var _0x574c9f=_0x0cef[_0x416a0a];return _0x574c9f;};'use strict';var _=require(_0xf0ce('0x0'));var util=require(_0xf0ce('0x1'));var logger=require(_0xf0ce('0x2'))(_0xf0ce('0x3'));var moment=require(_0xf0ce('0x4'));var BPromise=require(_0xf0ce('0x5'));var rp=require(_0xf0ce('0x6'));var fs=require('fs');var path=require(_0xf0ce('0x7'));var rimraf=require(_0xf0ce('0x8'));var config=require(_0xf0ce('0x9'));var attributes=require(_0xf0ce('0xa'));module['exports']=function(_0x1a465a,_0x5bf6d8){return _0x1a465a[_0xf0ce('0xb')](_0xf0ce('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 6156de1..6a78608 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 _0xfe2d=['result','FaxAccount','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','interaction','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xfe2d,0x1eb));var _0xdfe2=function(_0x53e800,_0x11621d){_0x53e800=_0x53e800-0x0;var _0x538d29=_0xfe2d[_0x53e800];return _0x538d29;};'use strict';var _=require(_0xdfe2('0x0'));var util=require('util');var moment=require(_0xdfe2('0x1'));var BPromise=require(_0xdfe2('0x2'));var rs=require(_0xdfe2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdfe2('0x4'));var logger=require(_0xdfe2('0x5'))('rpc');var config=require(_0xdfe2('0x6'));var jayson=require(_0xdfe2('0x7'));var client=jayson[_0xdfe2('0x8')]['http']({'port':0x232c});config[_0xdfe2('0x9')]=_[_0xdfe2('0xa')](config['redis'],{'host':_0xdfe2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfe2('0x9')]));require(_0xdfe2('0xc'))[_0xdfe2('0xd')](socket);function respondWithRpcPromise(_0x82815f,_0x1796a2,_0x25140a){return new BPromise(function(_0x441a1f,_0x2cc27c){return client[_0xdfe2('0xe')](_0x82815f,_0x25140a)[_0xdfe2('0xf')](function(_0x173034){logger[_0xdfe2('0x10')](_0xdfe2('0x11'),_0x1796a2,_0xdfe2('0x12'));logger[_0xdfe2('0x13')](_0xdfe2('0x14'),_0x1796a2,_0xdfe2('0x12'),JSON[_0xdfe2('0x15')](_0x173034));if(_0x173034[_0xdfe2('0x16')]){if(_0x173034['error'][_0xdfe2('0x17')]===0x1f4){logger['error'](_0xdfe2('0x11'),_0x1796a2,_0x173034[_0xdfe2('0x16')][_0xdfe2('0x18')]);return _0x2cc27c(_0x173034['error'][_0xdfe2('0x18')]);}logger[_0xdfe2('0x16')](_0xdfe2('0x11'),_0x1796a2,_0x173034[_0xdfe2('0x16')][_0xdfe2('0x18')]);return _0x441a1f(_0x173034[_0xdfe2('0x16')][_0xdfe2('0x18')]);}else{logger[_0xdfe2('0x10')](_0xdfe2('0x11'),_0x1796a2,_0xdfe2('0x12'));_0x441a1f(_0x173034[_0xdfe2('0x19')]['message']);}})['catch'](function(_0x50ef9d){logger[_0xdfe2('0x16')](_0xdfe2('0x11'),_0x1796a2,_0x50ef9d);_0x2cc27c(_0x50ef9d);});});}exports['GetFaxAccount']=function(_0xbd78d8){var _0x4282ba=this;return new Promise(function(_0x1e78b4,_0x1dee0a){return db[_0xdfe2('0x1a')][_0xdfe2('0x1b')]({'raw':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8['options'][_0xdfe2('0x1d')]===undefined?!![]:![]:!![],'where':_0xbd78d8['options']?_0xbd78d8['options'][_0xdfe2('0x1e')]||null:null,'attributes':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8[_0xdfe2('0x1c')][_0xdfe2('0x1f')]||null:null,'limit':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8[_0xdfe2('0x1c')]['limit']||null:null,'include':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8[_0xdfe2('0x1c')][_0xdfe2('0x20')]?_[_0xdfe2('0x21')](_0xbd78d8[_0xdfe2('0x1c')][_0xdfe2('0x20')],function(_0x38331c){return{'model':db[_0x38331c[_0xdfe2('0x22')]],'as':_0x38331c['as'],'attributes':_0x38331c['attributes'],'include':_0x38331c[_0xdfe2('0x20')]?_['map'](_0x38331c['include'],function(_0x1bfcd1){return{'model':db[_0x1bfcd1[_0xdfe2('0x22')]],'as':_0x1bfcd1['as'],'attributes':_0x1bfcd1['attributes'],'include':_0x1bfcd1[_0xdfe2('0x20')]?_[_0xdfe2('0x21')](_0x1bfcd1[_0xdfe2('0x20')],function(_0x254560){return{'model':db[_0x254560[_0xdfe2('0x22')]],'as':_0x254560['as'],'attributes':_0x254560[_0xdfe2('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e2e8){logger['info'](_0xdfe2('0x23'),_0xbd78d8);logger[_0xdfe2('0x13')](_0xdfe2('0x23'),_0xbd78d8,JSON[_0xdfe2('0x15')](_0x17e2e8));_0x1e78b4(_0x17e2e8);})[_0xdfe2('0x24')](function(_0x1350a1){logger[_0xdfe2('0x16')](_0xdfe2('0x23'),_0x1350a1[_0xdfe2('0x18')],_0xbd78d8);_0x1dee0a(_0x4282ba['error'](0x1f4,_0x1350a1['message']));});});};exports[_0xdfe2('0x25')]=function(_0x5044e0,_0x495eae,_0x39c3d7){var _0x5d5681=this;return new Promise(function(_0x45a2cc,_0x3f4d87){var _0x384b38={'body':_0x5044e0[_0xdfe2('0x26')],'channel':_0xdfe2('0x27')};var _0x317da7=[];var _0x309a0a=[];var _0x2f1963={};return db[_0xdfe2('0x28')][_0xdfe2('0x29')]()[_0xdfe2('0xf')](function(_0x50dc0c){if(!_0x50dc0c){throw new db['Sequelize'][(_0xdfe2('0x2a'))](_0xdfe2('0x2b'));}_0x317da7=_[_0xdfe2('0x2c')](_['keys'](_0x50dc0c),['createdAt','updatedAt']);_0x309a0a=_[_0xdfe2('0x2c')](_['keys'](_0x50dc0c),['createdAt',_0xdfe2('0x2d'),_0xdfe2('0x2e'),_0xdfe2('0x2f')]);if(_0x5044e0[_0xdfe2('0x26')]['id']){delete _0x5044e0[_0xdfe2('0x26')]['id'];}if(_[_0xdfe2('0x30')](_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x31')])){throw new db[(_0xdfe2('0x32'))][(_0xdfe2('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x26')])||_0x5044e0['body'][_0xdfe2('0x26')]===''){throw new db[(_0xdfe2('0x32'))][(_0xdfe2('0x2a'))](_0xdfe2('0x33'));}if(_[_0xdfe2('0x30')](_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x34')])){throw new db['Sequelize'][(_0xdfe2('0x2a'))](_0xdfe2('0x35')+_0x309a0a);}if(!_[_0xdfe2('0x36')](_0x309a0a,_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x34')])){throw new db[(_0xdfe2('0x32'))][(_0xdfe2('0x2a'))](_0xdfe2('0x37')+_0x309a0a);}_0x2f1963[_0x5044e0['body'][_0xdfe2('0x34')]]=_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x31')];})['then'](function(){return db[_0xdfe2('0x1a')][_0xdfe2('0x38')]({'where':{'id':_0x5044e0[_0xdfe2('0x39')]['id']},'include':[{'model':db[_0xdfe2('0x3a')],'as':_0xdfe2('0x3b'),'include':[{'model':db['CmContact'],'as':_0xdfe2('0x3c'),'where':_0x2f1963,'limit':0x1,'order':[['updatedAt',_0xdfe2('0x3d')]]}]},{'model':db[_0xdfe2('0x3e')],'as':_0xdfe2('0x3f')}]});})[_0xdfe2('0xf')](function(_0xe3ccce){if(_0xe3ccce&&_0xe3ccce[_0xdfe2('0x3b')]){var _0x47616f=_0xe3ccce[_0xdfe2('0x40')]({'plain':!![]});_0x384b38['account']=_0x47616f;_0x384b38['applications']=_0x47616f['Applications'];_0x384b38[_0xdfe2('0x41')]=_0x47616f[_0xdfe2('0x3b')];_0x384b38[_0xdfe2('0x42')]=_[_0xdfe2('0x43')](_0x384b38['applications'],['priority'],['asc']);if(_0x384b38['account'][_0xdfe2('0x3f')]){delete _0x384b38[_0xdfe2('0x39')][_0xdfe2('0x3f')];}if(_0x384b38[_0xdfe2('0x39')]['List']&&_0x384b38[_0xdfe2('0x39')][_0xdfe2('0x3b')]['Contacts']['length']){return _0x384b38[_0xdfe2('0x39')][_0xdfe2('0x3b')]['Contacts'][0x0];}var _0x29f7e0=_[_0xdfe2('0xa')](_0x5044e0[_0xdfe2('0x26')],{'firstName':_0x5044e0[_0xdfe2('0x26')]['from'],'ListId':_0x47616f['ListId']});_0x29f7e0[_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x34')]]=_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x31')];return db[_0xdfe2('0x28')][_0xdfe2('0x44')](_0x29f7e0,{'fields':_0x317da7,'raw':!![]});}})[_0xdfe2('0xf')](function(_0x4aff50){_0x384b38[_0xdfe2('0x45')]=_0x4aff50;if(_0x4aff50){var _0x2b5472={'ContactId':_0x4aff50['id'],'FaxAccountId':_0x5044e0[_0xdfe2('0x39')]['id'],'fax':_0x4aff50[_0xdfe2('0x27')]};return db[_0xdfe2('0x46')][_0xdfe2('0x38')]({'where':{'ContactId':_0x4aff50['id'],'closed':![],'FaxAccountId':_0x5044e0[_0xdfe2('0x39')]['id']}})['then'](function(_0x38797c){if(_0x38797c){return[_0x38797c,![]];}return db[_0xdfe2('0x46')][_0xdfe2('0x44')](_0x2b5472)[_0xdfe2('0xf')](function(_0x104d1a){return[_0x104d1a,!![]];});});}else{throw new Error(_0xdfe2('0x47'));}})[_0xdfe2('0x48')](function(_0x2f9262,_0x47953d){var _0x4c33d7=_0x2f9262[_0xdfe2('0x40')]({'plain':!![]});if(_0x47953d){if(_0x384b38[_0xdfe2('0x39')][_0xdfe2('0x49')]){_0x384b38[_0xdfe2('0x42')][_0xdfe2('0x4a')]({'id':0x0,'priority':_0x384b38[_0xdfe2('0x42')]['length']+0x1,'app':_0xdfe2('0x4b'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x4c33d7['created']=!![];}else{_0x4c33d7['created']=![];}_0x384b38[_0xdfe2('0x4c')]=_0x4c33d7;return db['FaxMessage'][_0xdfe2('0x44')]({'body':_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x26')],'FaxAccountId':_0x5044e0[_0xdfe2('0x39')]['id'],'FaxInteractionId':_0x2f9262['id'],'direction':'in','ContactId':_0x2f9262[_0xdfe2('0x4d')],'AttachmentId':_0x5044e0['body'][_0xdfe2('0x4e')]});})[_0xdfe2('0xf')](function(_0x32ce47){_0x384b38[_0xdfe2('0x18')]=_0x32ce47;if(!_0x384b38[_0xdfe2('0x4c')][_0xdfe2('0x4f')])return;return db[_0xdfe2('0x50')][_0xdfe2('0x38')]({'attributes':['id',_0xdfe2('0x51')],'where':{'id':_0x384b38[_0xdfe2('0x4c')][_0xdfe2('0x4f')]}});})[_0xdfe2('0xf')](function(_0x53092e){if(_0x53092e){_0x384b38[_0xdfe2('0x42')][_0xdfe2('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x53092e['name']+','+(_0x384b38['account'][_0xdfe2('0x53')]||0xa),'interval':'*,*,*,*'});}if(!_0x384b38['interaction']['queueId'])return;return db['FaxQueue'][_0xdfe2('0x38')]({'attributes':['id',_0xdfe2('0x51')],'where':{'id':_0x384b38['interaction']['queueId']}});})['then'](function(_0x29c0d0){if(_0x29c0d0){_0x384b38[_0xdfe2('0x42')][_0xdfe2('0x52')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x29c0d0['name']+','+(_0x384b38[_0xdfe2('0x39')][_0xdfe2('0x54')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xdfe2('0x55'),_0x384b38);})[_0xdfe2('0xf')](function(_0x3f4059){_0x45a2cc(_0x3f4059);})[_0xdfe2('0x24')](function(_0x250189){_0x3f4d87(_0x5d5681['error'](0x1f4,_0x250189['message']));});});}; \ No newline at end of file +var _0xf282=['account','CmList','List','Contacts','FaxApplication','Applications','list','applications','priority','asc','length','fax','create','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','FaxQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','map','include','model','attributes','debug','stringify','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find'];(function(_0x3b57da,_0x47c5d5){var _0x126ae2=function(_0x393b6e){while(--_0x393b6e){_0x3b57da['push'](_0x3b57da['shift']());}};_0x126ae2(++_0x47c5d5);}(_0xf282,0x7f));var _0x2f28=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xf282[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x2f28('0x0'));var util=require(_0x2f28('0x1'));var moment=require(_0x2f28('0x2'));var BPromise=require(_0x2f28('0x3'));var rs=require(_0x2f28('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f28('0x5'))['db'];var utils=require(_0x2f28('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f28('0x7'));var jayson=require(_0x2f28('0x8'));var client=jayson['client'][_0x2f28('0x9')]({'port':0x232c});config['redis']=_[_0x2f28('0xa')](config[_0x2f28('0xb')],{'host':_0x2f28('0xc'),'port':0x18eb});var socket=require(_0x2f28('0xd'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x2f28('0xe')](socket);function respondWithRpcPromise(_0x5866f7,_0x2b6e6e,_0x141b22){return new BPromise(function(_0x56f557,_0x149b74){return client[_0x2f28('0xf')](_0x5866f7,_0x141b22)[_0x2f28('0x10')](function(_0x4d796d){logger['info'](_0x2f28('0x11'),_0x2b6e6e,_0x2f28('0x12'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2b6e6e,_0x2f28('0x12'),JSON['stringify'](_0x4d796d));if(_0x4d796d[_0x2f28('0x13')]){if(_0x4d796d[_0x2f28('0x13')][_0x2f28('0x14')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2b6e6e,_0x4d796d['error']['message']);return _0x149b74(_0x4d796d['error']['message']);}logger[_0x2f28('0x13')](_0x2f28('0x11'),_0x2b6e6e,_0x4d796d[_0x2f28('0x13')][_0x2f28('0x15')]);return _0x56f557(_0x4d796d[_0x2f28('0x13')][_0x2f28('0x15')]);}else{logger[_0x2f28('0x16')](_0x2f28('0x11'),_0x2b6e6e,'request\x20sent');_0x56f557(_0x4d796d[_0x2f28('0x17')][_0x2f28('0x15')]);}})[_0x2f28('0x18')](function(_0x18a01c){logger[_0x2f28('0x13')]('FaxAccount,\x20%s,\x20%s',_0x2b6e6e,_0x18a01c);_0x149b74(_0x18a01c);});});}exports[_0x2f28('0x19')]=function(_0x5690cd){var _0x4d5d40=this;return new Promise(function(_0x1e51cd,_0x53a141){return db[_0x2f28('0x1a')][_0x2f28('0x1b')]({'raw':_0x5690cd[_0x2f28('0x1c')]?_0x5690cd[_0x2f28('0x1c')][_0x2f28('0x1d')]===undefined?!![]:![]:!![],'where':_0x5690cd[_0x2f28('0x1c')]?_0x5690cd[_0x2f28('0x1c')][_0x2f28('0x1e')]||null:null,'attributes':_0x5690cd[_0x2f28('0x1c')]?_0x5690cd[_0x2f28('0x1c')]['attributes']||null:null,'limit':_0x5690cd['options']?_0x5690cd[_0x2f28('0x1c')][_0x2f28('0x1f')]||null:null,'include':_0x5690cd['options']?_0x5690cd[_0x2f28('0x1c')]['include']?_[_0x2f28('0x20')](_0x5690cd[_0x2f28('0x1c')][_0x2f28('0x21')],function(_0x2431f3){return{'model':db[_0x2431f3[_0x2f28('0x22')]],'as':_0x2431f3['as'],'attributes':_0x2431f3['attributes'],'include':_0x2431f3[_0x2f28('0x21')]?_[_0x2f28('0x20')](_0x2431f3[_0x2f28('0x21')],function(_0x5652b8){return{'model':db[_0x5652b8[_0x2f28('0x22')]],'as':_0x5652b8['as'],'attributes':_0x5652b8[_0x2f28('0x23')],'include':_0x5652b8['include']?_['map'](_0x5652b8[_0x2f28('0x21')],function(_0x16a189){return{'model':db[_0x16a189[_0x2f28('0x22')]],'as':_0x16a189['as'],'attributes':_0x16a189[_0x2f28('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2f28('0x10')](function(_0x2c9069){logger[_0x2f28('0x16')](_0x2f28('0x19'),_0x5690cd);logger[_0x2f28('0x24')](_0x2f28('0x19'),_0x5690cd,JSON[_0x2f28('0x25')](_0x2c9069));_0x1e51cd(_0x2c9069);})[_0x2f28('0x18')](function(_0x3ce732){logger[_0x2f28('0x13')](_0x2f28('0x19'),_0x3ce732[_0x2f28('0x15')],_0x5690cd);_0x53a141(_0x4d5d40[_0x2f28('0x13')](0x1f4,_0x3ce732[_0x2f28('0x15')]));});});};exports[_0x2f28('0x26')]=function(_0xe49563,_0x61b3fa,_0xfc5d5a){var _0x5d99df=this;return new Promise(function(_0x48cdd0,_0xb5d10f){var _0x242e25={'body':_0xe49563[_0x2f28('0x27')],'channel':'fax'};var _0x411867=[];var _0xa5c8b9=[];var _0x3d38f3={};return db[_0x2f28('0x28')][_0x2f28('0x29')]()[_0x2f28('0x10')](function(_0x49eab8){if(!_0x49eab8){throw new db[(_0x2f28('0x2a'))][(_0x2f28('0x2b'))](_0x2f28('0x2c'));}_0x411867=_[_0x2f28('0x2d')](_[_0x2f28('0x2e')](_0x49eab8),[_0x2f28('0x2f'),_0x2f28('0x30')]);_0xa5c8b9=_[_0x2f28('0x2d')](_[_0x2f28('0x2e')](_0x49eab8),[_0x2f28('0x2f'),_0x2f28('0x30'),_0x2f28('0x31'),_0x2f28('0x32')]);if(_0xe49563[_0x2f28('0x27')]['id']){delete _0xe49563[_0x2f28('0x27')]['id'];}if(_['isNil'](_0xe49563['body'][_0x2f28('0x33')])){throw new db[(_0x2f28('0x2a'))][(_0x2f28('0x2b'))](_0x2f28('0x34'));}if(_[_0x2f28('0x35')](_0xe49563[_0x2f28('0x27')]['body'])||_0xe49563[_0x2f28('0x27')][_0x2f28('0x27')]===''){throw new db[(_0x2f28('0x2a'))][(_0x2f28('0x2b'))](_0x2f28('0x36'));}if(_[_0x2f28('0x35')](_0xe49563[_0x2f28('0x27')]['mapKey'])){throw new db['Sequelize'][(_0x2f28('0x2b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa5c8b9);}if(!_[_0x2f28('0x37')](_0xa5c8b9,_0xe49563[_0x2f28('0x27')][_0x2f28('0x38')])){throw new db[(_0x2f28('0x2a'))]['ValidationError'](_0x2f28('0x39')+_0xa5c8b9);}_0x3d38f3[_0xe49563[_0x2f28('0x27')]['mapKey']]=_0xe49563[_0x2f28('0x27')]['from'];})[_0x2f28('0x10')](function(){return db[_0x2f28('0x1a')][_0x2f28('0x3a')]({'where':{'id':_0xe49563[_0x2f28('0x3b')]['id']},'include':[{'model':db[_0x2f28('0x3c')],'as':_0x2f28('0x3d'),'include':[{'model':db[_0x2f28('0x28')],'as':_0x2f28('0x3e'),'where':_0x3d38f3,'limit':0x1,'order':[[_0x2f28('0x30'),'DESC']]}]},{'model':db[_0x2f28('0x3f')],'as':_0x2f28('0x40')}]});})[_0x2f28('0x10')](function(_0x9960ae){if(_0x9960ae&&_0x9960ae['List']){var _0x1520ff=_0x9960ae['get']({'plain':!![]});_0x242e25[_0x2f28('0x3b')]=_0x1520ff;_0x242e25['applications']=_0x1520ff['Applications'];_0x242e25[_0x2f28('0x41')]=_0x1520ff[_0x2f28('0x3d')];_0x242e25[_0x2f28('0x42')]=_['orderBy'](_0x242e25[_0x2f28('0x42')],[_0x2f28('0x43')],[_0x2f28('0x44')]);if(_0x242e25[_0x2f28('0x3b')][_0x2f28('0x40')]){delete _0x242e25['account'][_0x2f28('0x40')];}if(_0x242e25['account'][_0x2f28('0x3d')]&&_0x242e25[_0x2f28('0x3b')][_0x2f28('0x3d')][_0x2f28('0x3e')][_0x2f28('0x45')]){return _0x242e25[_0x2f28('0x3b')][_0x2f28('0x3d')]['Contacts'][0x0];}var _0x4f6197=_['defaults'](_0xe49563[_0x2f28('0x27')],{'firstName':_0xe49563['body'][_0x2f28('0x33')],'ListId':_0x1520ff[_0x2f28('0x32')]});_0x4f6197[_0xe49563[_0x2f28('0x27')][_0x2f28('0x38')]]=_0xe49563[_0x2f28('0x27')][_0x2f28('0x33')];return db['CmContact']['create'](_0x4f6197,{'fields':_0x411867,'raw':!![]});}})[_0x2f28('0x10')](function(_0x5238d1){_0x242e25['contact']=_0x5238d1;if(_0x5238d1){var _0x18226e={'ContactId':_0x5238d1['id'],'FaxAccountId':_0xe49563['account']['id'],'fax':_0x5238d1[_0x2f28('0x46')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x5238d1['id'],'closed':![],'FaxAccountId':_0xe49563[_0x2f28('0x3b')]['id']}})[_0x2f28('0x10')](function(_0x44e6a7){if(_0x44e6a7){return[_0x44e6a7,![]];}return db['FaxInteraction'][_0x2f28('0x47')](_0x18226e)['then'](function(_0x193321){return[_0x193321,!![]];});});}else{throw new Error(_0x2f28('0x48'));}})['spread'](function(_0x3cacec,_0x16b753){var _0x170e4d=_0x3cacec['get']({'plain':!![]});if(_0x16b753){if(_0x242e25[_0x2f28('0x3b')]['autoclose']){_0x242e25[_0x2f28('0x42')][_0x2f28('0x49')]({'id':0x0,'priority':_0x242e25[_0x2f28('0x42')][_0x2f28('0x45')]+0x1,'app':_0x2f28('0x4a'),'appdata':_0x2f28('0x4b'),'interval':_0x2f28('0x4c')});}_0x170e4d[_0x2f28('0x4d')]=!![];}else{_0x170e4d[_0x2f28('0x4d')]=![];}_0x242e25[_0x2f28('0x4e')]=_0x170e4d;return db[_0x2f28('0x4f')][_0x2f28('0x47')]({'body':_0xe49563[_0x2f28('0x27')][_0x2f28('0x27')],'FaxAccountId':_0xe49563['account']['id'],'FaxInteractionId':_0x3cacec['id'],'direction':'in','ContactId':_0x3cacec['ContactId'],'AttachmentId':_0xe49563[_0x2f28('0x27')][_0x2f28('0x50')]});})[_0x2f28('0x10')](function(_0xf09542){_0x242e25[_0x2f28('0x15')]=_0xf09542;if(!_0x242e25[_0x2f28('0x4e')][_0x2f28('0x51')])return;return db[_0x2f28('0x52')][_0x2f28('0x3a')]({'attributes':['id','name'],'where':{'id':_0x242e25['interaction']['UserId']}});})[_0x2f28('0x10')](function(_0x2787e0){if(_0x2787e0){_0x242e25[_0x2f28('0x42')][_0x2f28('0x53')]({'id':0x0,'priority':0x0,'app':_0x2f28('0x54'),'appdata':_0x2787e0[_0x2f28('0x55')]+','+(_0x242e25[_0x2f28('0x3b')][_0x2f28('0x56')]||0xa),'interval':'*,*,*,*'});}if(!_0x242e25['interaction']['queueId'])return;return db[_0x2f28('0x57')][_0x2f28('0x3a')]({'attributes':['id',_0x2f28('0x55')],'where':{'id':_0x242e25[_0x2f28('0x4e')][_0x2f28('0x58')]}});})[_0x2f28('0x10')](function(_0x37c24c){if(_0x37c24c){_0x242e25[_0x2f28('0x42')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2f28('0x59'),'appdata':_0x37c24c[_0x2f28('0x55')]+','+(_0x242e25[_0x2f28('0x3b')][_0x2f28('0x5a')]||0x12c),'interval':_0x2f28('0x4c')});}return respondWithRpcPromise(_0x2f28('0x5b'),_0x2f28('0x5c'),_0x242e25);})[_0x2f28('0x10')](function(_0x5ca503){_0x48cdd0(_0x5ca503);})[_0x2f28('0x18')](function(_0x3b6d67){_0xb5d10f(_0x5d99df['error'](0x1f4,_0x3b6d67[_0x2f28('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ea9bf18..203a9d4 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 _0xf8f8=['register','length','faxAccount:','./faxAccount.events','save','update','removeListener'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xf8f8,0x7a));var _0x8f8f=function(_0x346822,_0x3ba342){_0x346822=_0x346822-0x0;var _0x43c594=_0xf8f8[_0x346822];return _0x43c594;};'use strict';var FaxAccountEvents=require(_0x8f8f('0x0'));var events=[_0x8f8f('0x1'),'remove',_0x8f8f('0x2')];function createListener(_0xd4a4a5,_0x4d5ccc){return function(_0xe72bce){_0x4d5ccc['emit'](_0xd4a4a5,_0xe72bce);};}function removeListener(_0x2b3da4,_0x5322dd){return function(){FaxAccountEvents[_0x8f8f('0x3')](_0x2b3da4,_0x5322dd);};}exports[_0x8f8f('0x4')]=function(_0x22685c){for(var _0x21147f=0x0,_0x4753e0=events[_0x8f8f('0x5')];_0x21147f<_0x4753e0;_0x21147f++){var _0x3b4b08=events[_0x21147f];var _0x852d57=createListener(_0x8f8f('0x6')+_0x3b4b08,_0x22685c);FaxAccountEvents['on'](_0x3b4b08,_0x852d57);}}; \ No newline at end of file +var _0xa6a7=['save','remove','emit','removeListener','register','length','faxAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6a7,0xd2));var _0x7a6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa6a7[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7a6a('0x0'),_0x7a6a('0x1'),'update'];function createListener(_0x7268ad,_0x57813a){return function(_0x20bed6){_0x57813a[_0x7a6a('0x2')](_0x7268ad,_0x20bed6);};}function removeListener(_0x5b8bbc,_0x2a2e73){return function(){FaxAccountEvents[_0x7a6a('0x3')](_0x5b8bbc,_0x2a2e73);};}exports[_0x7a6a('0x4')]=function(_0x3a607c){for(var _0xad566d=0x0,_0x314181=events[_0x7a6a('0x5')];_0xad566d<_0x314181;_0xad566d++){var _0x4a2065=events[_0xad566d];var _0x34cd9e=createListener(_0x7a6a('0x6')+_0x4a2065,_0x3a607c);FaxAccountEvents['on'](_0x4a2065,_0x34cd9e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 470c1ba..e58cdba 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 _0x55f8=['addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','getDispositions','/:id/canned_answers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','addInteraction','addApplications','/addaccountapplications'];(function(_0x5b2094,_0xe7e1ec){var _0x54af16=function(_0x5a13a0){while(--_0x5a13a0){_0x5b2094['push'](_0x5b2094['shift']());}};_0x54af16(++_0xe7e1ec);}(_0x55f8,0x12a));var _0x855f=function(_0x10d394,_0x1e6d40){_0x10d394=_0x10d394-0x0;var _0xb75305=_0x55f8[_0x10d394];return _0xb75305;};'use strict';var multer=require(_0x855f('0x0'));var util=require('util');var path=require(_0x855f('0x1'));var timeout=require(_0x855f('0x2'));var express=require(_0x855f('0x3'));var router=express[_0x855f('0x4')]();var fs_extra=require(_0x855f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x855f('0x6'));var config=require(_0x855f('0x7'));var controller=require(_0x855f('0x8'));router[_0x855f('0x9')]('/',auth[_0x855f('0xa')](),controller[_0x855f('0xb')]);router['get']('/describe',auth[_0x855f('0xa')](),controller[_0x855f('0xc')]);router[_0x855f('0x9')](_0x855f('0xd'),auth[_0x855f('0xa')](),controller['show']);router['get']('/:id/dispositions',auth[_0x855f('0xa')](),controller[_0x855f('0xe')]);router['get'](_0x855f('0xf'),auth[_0x855f('0xa')](),controller['getAnswers']);router[_0x855f('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x855f('0x10')]);router['get'](_0x855f('0x11'),auth[_0x855f('0xa')](),controller[_0x855f('0x12')]);router[_0x855f('0x9')](_0x855f('0x13'),auth[_0x855f('0xa')](),controller[_0x855f('0x14')]);router[_0x855f('0x9')](_0x855f('0x15'),auth['isAuthenticated'](),controller[_0x855f('0x16')]);router[_0x855f('0x17')]('/',auth['isAuthenticated'](),controller[_0x855f('0x18')]);router[_0x855f('0x17')](_0x855f('0x19'),auth[_0x855f('0xa')](),controller['addDisposition']);router[_0x855f('0x17')](_0x855f('0xf'),auth['isAuthenticated'](),controller[_0x855f('0x1a')]);router[_0x855f('0x17')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x855f('0x1b')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x855f('0x1c')]);router[_0x855f('0x17')](_0x855f('0x1d'),auth[_0x855f('0xa')](),controller[_0x855f('0x1e')]);router[_0x855f('0x17')](_0x855f('0x1f'),auth[_0x855f('0xa')](),controller[_0x855f('0x20')]);router['post']('/:id/send',auth[_0x855f('0xa')](),controller[_0x855f('0x21')]);router[_0x855f('0x17')](_0x855f('0x15'),auth[_0x855f('0xa')](),controller[_0x855f('0x22')]);router[_0x855f('0x23')](_0x855f('0xd'),auth[_0x855f('0xa')](),controller[_0x855f('0x24')]);router[_0x855f('0x25')](_0x855f('0xd'),auth[_0x855f('0xa')](),controller[_0x855f('0x26')]);router[_0x855f('0x25')](_0x855f('0x19'),auth[_0x855f('0xa')](),controller[_0x855f('0x27')]);router[_0x855f('0x25')](_0x855f('0xf'),auth[_0x855f('0xa')](),controller['removeAnswers']);router[_0x855f('0x25')]('/:id/users',auth[_0x855f('0xa')](),controller['removeAgents']);module[_0x855f('0x28')]=router; \ No newline at end of file +var _0x6bf4=['/:id/applications','getApplications','getMessages','post','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','put','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions'];(function(_0x3f105b,_0x1f2a0c){var _0x59a2a7=function(_0x399f40){while(--_0x399f40){_0x3f105b['push'](_0x3f105b['shift']());}};_0x59a2a7(++_0x1f2a0c);}(_0x6bf4,0x168));var _0x46bf=function(_0x2ee679,_0x13f469){_0x2ee679=_0x2ee679-0x0;var _0x559b9d=_0x6bf4[_0x2ee679];return _0x559b9d;};'use strict';var multer=require(_0x46bf('0x0'));var util=require(_0x46bf('0x1'));var path=require(_0x46bf('0x2'));var timeout=require(_0x46bf('0x3'));var express=require(_0x46bf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x46bf('0x5'));var interaction=require(_0x46bf('0x6'));var config=require('../../config/environment');var controller=require(_0x46bf('0x7'));router[_0x46bf('0x8')]('/',auth['isAuthenticated'](),controller[_0x46bf('0x9')]);router['get']('/describe',auth[_0x46bf('0xa')](),controller[_0x46bf('0xb')]);router[_0x46bf('0x8')](_0x46bf('0xc'),auth['isAuthenticated'](),controller[_0x46bf('0xd')]);router[_0x46bf('0x8')](_0x46bf('0xe'),auth['isAuthenticated'](),controller[_0x46bf('0xf')]);router[_0x46bf('0x8')](_0x46bf('0x10'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x11')]);router[_0x46bf('0x8')](_0x46bf('0x12'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x13')]);router[_0x46bf('0x8')](_0x46bf('0x14'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x15')]);router[_0x46bf('0x8')]('/:id/messages',auth[_0x46bf('0xa')](),controller[_0x46bf('0x16')]);router[_0x46bf('0x8')]('/:id/users',auth[_0x46bf('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x46bf('0x17')](_0x46bf('0xe'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x18')]);router[_0x46bf('0x17')]('/:id/canned_answers',auth[_0x46bf('0xa')](),controller[_0x46bf('0x19')]);router[_0x46bf('0x17')](_0x46bf('0x12'),auth[_0x46bf('0xa')](),controller['addInteraction']);router[_0x46bf('0x17')](_0x46bf('0x14'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x1a')]);router[_0x46bf('0x17')](_0x46bf('0x1b'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x1c')]);router[_0x46bf('0x17')](_0x46bf('0x1d'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x1e')]);router['post'](_0x46bf('0x1f'),auth[_0x46bf('0xa')](),controller['send']);router['post'](_0x46bf('0x20'),auth[_0x46bf('0xa')](),controller['addAgents']);router[_0x46bf('0x21')](_0x46bf('0xc'),auth[_0x46bf('0xa')](),controller[_0x46bf('0x22')]);router[_0x46bf('0x23')](_0x46bf('0xc'),auth[_0x46bf('0xa')](),controller['destroy']);router[_0x46bf('0x23')](_0x46bf('0xe'),auth['isAuthenticated'](),controller[_0x46bf('0x24')]);router['delete']('/:id/canned_answers',auth[_0x46bf('0xa')](),controller['removeAnswers']);router[_0x46bf('0x23')](_0x46bf('0x20'),auth[_0x46bf('0xa')](),controller['removeAgents']);module[_0x46bf('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index a62cde4..374b96e 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 _0x3b10=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xf63cbd,_0x358aff){var _0x1fc9f2=function(_0x10368b){while(--_0x10368b){_0xf63cbd['push'](_0xf63cbd['shift']());}};_0x1fc9f2(++_0x358aff);}(_0x3b10,0x181));var _0x03b1=function(_0xffd797,_0x30fc14){_0xffd797=_0xffd797-0x0;var _0x3a39f5=_0x3b10[_0xffd797];return _0x3a39f5;};'use strict';var Sequelize=require(_0x03b1('0x0'));module[_0x03b1('0x1')]={'priority':{'type':Sequelize[_0x03b1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x03b1('0x3')],'allowNull':![],'defaultValue':_0x03b1('0x4')},'appdata':{'type':Sequelize[_0x03b1('0x5')]()},'description':{'type':Sequelize[_0x03b1('0x3')]},'interval':{'type':Sequelize[_0x03b1('0x3')],'defaultValue':_0x03b1('0x6')}}; \ No newline at end of file +var _0xe459=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x494fa2,_0x84b5d8){var _0xf013c7=function(_0x348859){while(--_0x348859){_0x494fa2['push'](_0x494fa2['shift']());}};_0xf013c7(++_0x84b5d8);}(_0xe459,0x1cf));var _0x9e45=function(_0x17cd3d,_0x49b60d){_0x17cd3d=_0x17cd3d-0x0;var _0x12c8c5=_0xe459[_0x17cd3d];return _0x12c8c5;};'use strict';var Sequelize=require(_0x9e45('0x0'));module[_0x9e45('0x1')]={'priority':{'type':Sequelize[_0x9e45('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9e45('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9e45('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9e45('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f5c2ef5..7e64825 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 _0xfe27=['status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','FaxApplication','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','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','../../mysqldb'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xfe27,0xbf));var _0x7fe2=function(_0x427bae,_0x3a3fb0){_0x427bae=_0x427bae-0x0;var _0x4a38d4=_0xfe27[_0x427bae];return _0x4a38d4;};'use strict';var emlformat=require(_0x7fe2('0x0'));var rimraf=require(_0x7fe2('0x1'));var zipdir=require(_0x7fe2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7fe2('0x4'));var util=require(_0x7fe2('0x5'));var path=require(_0x7fe2('0x6'));var sox=require(_0x7fe2('0x7'));var csv=require(_0x7fe2('0x8'));var ejs=require(_0x7fe2('0x9'));var fs=require('fs');var fs_extra=require(_0x7fe2('0xa'));var _=require(_0x7fe2('0xb'));var squel=require(_0x7fe2('0xc'));var crypto=require(_0x7fe2('0xd'));var jsforce=require(_0x7fe2('0xe'));var deskjs=require(_0x7fe2('0xf'));var toCsv=require(_0x7fe2('0x8'));var querystring=require(_0x7fe2('0x10'));var Papa=require(_0x7fe2('0x11'));var Redis=require('ioredis');var authService=require(_0x7fe2('0x12'));var qs=require(_0x7fe2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fe2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7fe2('0x15'))['db'];function respondWithStatusCode(_0xbc67f3,_0x369f9e){_0x369f9e=_0x369f9e||0xcc;return function(_0x38713e){if(_0x38713e){return _0xbc67f3['sendStatus'](_0x369f9e);}return _0xbc67f3[_0x7fe2('0x16')](_0x369f9e)['end']();};}function respondWithResult(_0x3ef928,_0x292020){_0x292020=_0x292020||0xc8;return function(_0x473a83){if(_0x473a83){return _0x3ef928['status'](_0x292020)[_0x7fe2('0x17')](_0x473a83);}};}function respondWithFilteredResult(_0x8bda6d,_0x390d49){return function(_0x901422){if(_0x901422){var _0x3f9918=typeof _0x390d49[_0x7fe2('0x18')]==='undefined'&&typeof _0x390d49[_0x7fe2('0x19')]===_0x7fe2('0x1a');var _0x5bc318=_0x901422['count'];var _0x589260=_0x3f9918?0x0:_0x390d49[_0x7fe2('0x18')];var _0x3f7f32=_0x3f9918?_0x901422[_0x7fe2('0x1b')]:_0x390d49['offset']+_0x390d49[_0x7fe2('0x19')];var _0x4a3bec;if(_0x3f7f32>=_0x5bc318){_0x3f7f32=_0x5bc318;_0x4a3bec=0xc8;}else{_0x4a3bec=0xce;}_0x8bda6d[_0x7fe2('0x16')](_0x4a3bec);return _0x8bda6d[_0x7fe2('0x1c')]('Content-Range',_0x589260+'-'+_0x3f7f32+'/'+_0x5bc318)['json'](_0x901422);}return null;};}function patchUpdates(_0x306789){return function(_0x15cccf){try{jsonpatch[_0x7fe2('0x1d')](_0x15cccf,_0x306789,!![]);}catch(_0x42b32a){return BPromise[_0x7fe2('0x1e')](_0x42b32a);}return _0x15cccf[_0x7fe2('0x1f')]();};}function saveUpdates(_0x38bf34,_0x203b8a){return function(_0x36d9c3){if(_0x36d9c3){return _0x36d9c3[_0x7fe2('0x20')](_0x38bf34)[_0x7fe2('0x21')](function(_0x4bb775){return _0x4bb775;});}return null;};}function removeEntity(_0x1b380f,_0x46eec0){return function(_0x361a95){if(_0x361a95){return _0x361a95[_0x7fe2('0x22')]()['then'](function(){_0x1b380f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3f184,_0x4314db){return function(_0x451c8b){if(!_0x451c8b){_0xf3f184[_0x7fe2('0x23')](0x194);}return _0x451c8b;};}function handleError(_0x590983,_0x1e9cc2){_0x1e9cc2=_0x1e9cc2||0x1f4;return function(_0x4135fd){logger[_0x7fe2('0x24')](_0x4135fd[_0x7fe2('0x25')]);if(_0x4135fd[_0x7fe2('0x26')]){delete _0x4135fd[_0x7fe2('0x26')];}_0x590983[_0x7fe2('0x16')](_0x1e9cc2)['send'](_0x4135fd);};}exports['index']=function(_0x1c228b,_0xd166cf){var _0x1da23b={},_0xc31084={},_0x20cb87={'count':0x0,'rows':[]};var _0x200ea6=_[_0x7fe2('0x27')](db[_0x7fe2('0x28')]['rawAttributes'],function(_0x337b73){return{'name':_0x337b73[_0x7fe2('0x29')],'type':_0x337b73['type'][_0x7fe2('0x2a')]};});_0xc31084[_0x7fe2('0x2b')]=_['map'](_0x200ea6,_0x7fe2('0x26'));_0xc31084[_0x7fe2('0x2c')]=_[_0x7fe2('0x2d')](_0x1c228b[_0x7fe2('0x2c')]);_0xc31084['filters']=_[_0x7fe2('0x2e')](_0xc31084[_0x7fe2('0x2b')],_0xc31084[_0x7fe2('0x2c')]);_0x1da23b[_0x7fe2('0x2f')]=_[_0x7fe2('0x2e')](_0xc31084[_0x7fe2('0x2b')],qs[_0x7fe2('0x30')](_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x30')]));_0x1da23b[_0x7fe2('0x2f')]=_0x1da23b[_0x7fe2('0x2f')][_0x7fe2('0x31')]?_0x1da23b[_0x7fe2('0x2f')]:_0xc31084['model'];if(!_0x1c228b['query'][_0x7fe2('0x32')](_0x7fe2('0x33'))){_0x1da23b['limit']=qs['limit'](_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x19')]);_0x1da23b['offset']=qs[_0x7fe2('0x18')](_0x1c228b['query']['offset']);}_0x1da23b[_0x7fe2('0x34')]=qs[_0x7fe2('0x35')](_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x35')]);_0x1da23b[_0x7fe2('0x36')]=qs[_0x7fe2('0x37')](_[_0x7fe2('0x38')](_0x1c228b[_0x7fe2('0x2c')],_0xc31084[_0x7fe2('0x37')]),_0x200ea6);if(_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x39')]){_0x1da23b[_0x7fe2('0x36')]=_[_0x7fe2('0x3a')](_0x1da23b['where'],{'$or':_[_0x7fe2('0x27')](_0x200ea6,function(_0x4e149a){if(_0x4e149a[_0x7fe2('0x3b')]!==_0x7fe2('0x3c')){var _0x4ba8b9={};_0x4ba8b9[_0x4e149a[_0x7fe2('0x26')]]={'$like':'%'+_0x1c228b['query']['filter']+'%'};return _0x4ba8b9;}})});}_0x1da23b=_[_0x7fe2('0x3a')]({},_0x1da23b,_0x1c228b[_0x7fe2('0x3d')]);var _0x7e8850={'where':_0x1da23b['where']};return db[_0x7fe2('0x28')]['count'](_0x7e8850)[_0x7fe2('0x21')](function(_0x27baa6){_0x20cb87[_0x7fe2('0x1b')]=_0x27baa6;if(_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x3e')]){_0x1da23b['include']=[{'all':!![]}];}return db[_0x7fe2('0x28')]['findAll'](_0x1da23b);})[_0x7fe2('0x21')](function(_0x26b8d3){_0x20cb87['rows']=_0x26b8d3;return _0x20cb87;})[_0x7fe2('0x21')](respondWithFilteredResult(_0xd166cf,_0x1da23b))[_0x7fe2('0x3f')](handleError(_0xd166cf,null));};exports[_0x7fe2('0x40')]=function(_0x45fbd9,_0x1e5a95){var _0x12386d={'raw':!![],'where':{'id':_0x45fbd9[_0x7fe2('0x41')]['id']}},_0x391f75={};_0x391f75[_0x7fe2('0x2b')]=_[_0x7fe2('0x2d')](db[_0x7fe2('0x28')][_0x7fe2('0x42')]);_0x391f75[_0x7fe2('0x2c')]=_[_0x7fe2('0x2d')](_0x45fbd9['query']);_0x391f75[_0x7fe2('0x37')]=_[_0x7fe2('0x2e')](_0x391f75[_0x7fe2('0x2b')],_0x391f75['query']);_0x12386d[_0x7fe2('0x2f')]=_[_0x7fe2('0x2e')](_0x391f75[_0x7fe2('0x2b')],qs['fields'](_0x45fbd9['query']['fields']));_0x12386d[_0x7fe2('0x2f')]=_0x12386d[_0x7fe2('0x2f')][_0x7fe2('0x31')]?_0x12386d[_0x7fe2('0x2f')]:_0x391f75[_0x7fe2('0x2b')];if(_0x45fbd9[_0x7fe2('0x2c')][_0x7fe2('0x3e')]){_0x12386d[_0x7fe2('0x43')]=[{'all':!![]}];}_0x12386d=_[_0x7fe2('0x3a')]({},_0x12386d,_0x45fbd9[_0x7fe2('0x3d')]);return db[_0x7fe2('0x28')]['find'](_0x12386d)[_0x7fe2('0x21')](handleEntityNotFound(_0x1e5a95,null))[_0x7fe2('0x21')](respondWithResult(_0x1e5a95,null))[_0x7fe2('0x3f')](handleError(_0x1e5a95,null));};exports[_0x7fe2('0x44')]=function(_0xf447c0,_0x545c3d){return db['FaxApplication'][_0x7fe2('0x44')](_0xf447c0[_0x7fe2('0x45')],{})['then'](respondWithResult(_0x545c3d,0xc9))[_0x7fe2('0x3f')](handleError(_0x545c3d,null));};exports['update']=function(_0x1f25c0,_0xaf6710){if(_0x1f25c0['body']['id']){delete _0x1f25c0['body']['id'];}return db[_0x7fe2('0x28')][_0x7fe2('0x46')]({'where':{'id':_0x1f25c0['params']['id']}})[_0x7fe2('0x21')](handleEntityNotFound(_0xaf6710,null))[_0x7fe2('0x21')](saveUpdates(_0x1f25c0[_0x7fe2('0x45')],null))[_0x7fe2('0x21')](respondWithResult(_0xaf6710,null))[_0x7fe2('0x3f')](handleError(_0xaf6710,null));};exports['destroy']=function(_0x194ccf,_0x1c8ae5){return db['FaxApplication'][_0x7fe2('0x46')]({'where':{'id':_0x194ccf[_0x7fe2('0x41')]['id']}})[_0x7fe2('0x21')](handleEntityNotFound(_0x1c8ae5,null))['then'](removeEntity(_0x1c8ae5,null))[_0x7fe2('0x3f')](handleError(_0x1c8ae5,null));}; \ No newline at end of file +var _0x8ddc=['query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FaxApplication','rawAttributes','type'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x8ddc,0x13e));var _0xc8dd=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8ddc[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xc8dd('0x0'));var rimraf=require(_0xc8dd('0x1'));var zipdir=require(_0xc8dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8dd('0x3'));var moment=require(_0xc8dd('0x4'));var BPromise=require(_0xc8dd('0x5'));var Mustache=require(_0xc8dd('0x6'));var util=require('util');var path=require(_0xc8dd('0x7'));var sox=require(_0xc8dd('0x8'));var csv=require('to-csv');var ejs=require(_0xc8dd('0x9'));var fs=require('fs');var fs_extra=require(_0xc8dd('0xa'));var _=require(_0xc8dd('0xb'));var squel=require('squel');var crypto=require(_0xc8dd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc8dd('0xd'));var querystring=require('querystring');var Papa=require(_0xc8dd('0xe'));var Redis=require(_0xc8dd('0xf'));var authService=require(_0xc8dd('0x10'));var qs=require(_0xc8dd('0x11'));var as=require(_0xc8dd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc8dd('0x13'));var utils=require(_0xc8dd('0x14'));var config=require(_0xc8dd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8dd('0x16'))['db'];function respondWithStatusCode(_0x512989,_0x17d6b6){_0x17d6b6=_0x17d6b6||0xcc;return function(_0x554737){if(_0x554737){return _0x512989['sendStatus'](_0x17d6b6);}return _0x512989['status'](_0x17d6b6)[_0xc8dd('0x17')]();};}function respondWithResult(_0x39cb45,_0x5328c5){_0x5328c5=_0x5328c5||0xc8;return function(_0xa8a1a7){if(_0xa8a1a7){return _0x39cb45[_0xc8dd('0x18')](_0x5328c5)[_0xc8dd('0x19')](_0xa8a1a7);}};}function respondWithFilteredResult(_0x3b3bed,_0x352684){return function(_0x5df9ad){if(_0x5df9ad){var _0x813ba2=typeof _0x352684[_0xc8dd('0x1a')]==='undefined'&&typeof _0x352684[_0xc8dd('0x1b')]===_0xc8dd('0x1c');var _0x388192=_0x5df9ad[_0xc8dd('0x1d')];var _0x4fd1cf=_0x813ba2?0x0:_0x352684[_0xc8dd('0x1a')];var _0x1c46b2=_0x813ba2?_0x5df9ad['count']:_0x352684[_0xc8dd('0x1a')]+_0x352684[_0xc8dd('0x1b')];var _0xa3d2f9;if(_0x1c46b2>=_0x388192){_0x1c46b2=_0x388192;_0xa3d2f9=0xc8;}else{_0xa3d2f9=0xce;}_0x3b3bed[_0xc8dd('0x18')](_0xa3d2f9);return _0x3b3bed[_0xc8dd('0x1e')](_0xc8dd('0x1f'),_0x4fd1cf+'-'+_0x1c46b2+'/'+_0x388192)[_0xc8dd('0x19')](_0x5df9ad);}return null;};}function patchUpdates(_0x17be7d){return function(_0x4296d3){try{jsonpatch[_0xc8dd('0x20')](_0x4296d3,_0x17be7d,!![]);}catch(_0x3885da){return BPromise[_0xc8dd('0x21')](_0x3885da);}return _0x4296d3[_0xc8dd('0x22')]();};}function saveUpdates(_0x1e4d3e,_0x3f9df8){return function(_0xb484e7){if(_0xb484e7){return _0xb484e7[_0xc8dd('0x23')](_0x1e4d3e)[_0xc8dd('0x24')](function(_0x55697e){return _0x55697e;});}return null;};}function removeEntity(_0x43197b,_0x336067){return function(_0x46fe49){if(_0x46fe49){return _0x46fe49[_0xc8dd('0x25')]()[_0xc8dd('0x24')](function(){_0x43197b[_0xc8dd('0x18')](0xcc)[_0xc8dd('0x17')]();});}};}function handleEntityNotFound(_0x1274d6,_0x2a133c){return function(_0x3c097b){if(!_0x3c097b){_0x1274d6[_0xc8dd('0x26')](0x194);}return _0x3c097b;};}function handleError(_0x369be7,_0x38d95f){_0x38d95f=_0x38d95f||0x1f4;return function(_0x1678a5){logger[_0xc8dd('0x27')](_0x1678a5['stack']);if(_0x1678a5[_0xc8dd('0x28')]){delete _0x1678a5[_0xc8dd('0x28')];}_0x369be7[_0xc8dd('0x18')](_0x38d95f)[_0xc8dd('0x29')](_0x1678a5);};}exports[_0xc8dd('0x2a')]=function(_0x59d68b,_0x2c8097){var _0x406a30={},_0x1644f7={},_0x3cd0bd={'count':0x0,'rows':[]};var _0x15cd6f=_[_0xc8dd('0x2b')](db[_0xc8dd('0x2c')][_0xc8dd('0x2d')],function(_0x3b386d){return{'name':_0x3b386d['fieldName'],'type':_0x3b386d[_0xc8dd('0x2e')]['key']};});_0x1644f7['model']=_[_0xc8dd('0x2b')](_0x15cd6f,'name');_0x1644f7[_0xc8dd('0x2f')]=_[_0xc8dd('0x30')](_0x59d68b[_0xc8dd('0x2f')]);_0x1644f7['filters']=_[_0xc8dd('0x31')](_0x1644f7['model'],_0x1644f7[_0xc8dd('0x2f')]);_0x406a30[_0xc8dd('0x32')]=_[_0xc8dd('0x31')](_0x1644f7[_0xc8dd('0x33')],qs[_0xc8dd('0x34')](_0x59d68b[_0xc8dd('0x2f')][_0xc8dd('0x34')]));_0x406a30[_0xc8dd('0x32')]=_0x406a30[_0xc8dd('0x32')][_0xc8dd('0x35')]?_0x406a30['attributes']:_0x1644f7[_0xc8dd('0x33')];if(!_0x59d68b[_0xc8dd('0x2f')][_0xc8dd('0x36')](_0xc8dd('0x37'))){_0x406a30['limit']=qs[_0xc8dd('0x1b')](_0x59d68b['query'][_0xc8dd('0x1b')]);_0x406a30['offset']=qs[_0xc8dd('0x1a')](_0x59d68b[_0xc8dd('0x2f')]['offset']);}_0x406a30['order']=qs[_0xc8dd('0x38')](_0x59d68b[_0xc8dd('0x2f')][_0xc8dd('0x38')]);_0x406a30[_0xc8dd('0x39')]=qs['filters'](_[_0xc8dd('0x3a')](_0x59d68b[_0xc8dd('0x2f')],_0x1644f7[_0xc8dd('0x3b')]),_0x15cd6f);if(_0x59d68b[_0xc8dd('0x2f')][_0xc8dd('0x3c')]){_0x406a30[_0xc8dd('0x39')]=_[_0xc8dd('0x3d')](_0x406a30['where'],{'$or':_[_0xc8dd('0x2b')](_0x15cd6f,function(_0x221235){if(_0x221235[_0xc8dd('0x2e')]!==_0xc8dd('0x3e')){var _0x2ccca1={};_0x2ccca1[_0x221235[_0xc8dd('0x28')]]={'$like':'%'+_0x59d68b['query'][_0xc8dd('0x3c')]+'%'};return _0x2ccca1;}})});}_0x406a30=_['merge']({},_0x406a30,_0x59d68b[_0xc8dd('0x3f')]);var _0x239e98={'where':_0x406a30['where']};return db[_0xc8dd('0x2c')][_0xc8dd('0x1d')](_0x239e98)[_0xc8dd('0x24')](function(_0x5dc4ec){_0x3cd0bd['count']=_0x5dc4ec;if(_0x59d68b[_0xc8dd('0x2f')][_0xc8dd('0x40')]){_0x406a30[_0xc8dd('0x41')]=[{'all':!![]}];}return db[_0xc8dd('0x2c')][_0xc8dd('0x42')](_0x406a30);})[_0xc8dd('0x24')](function(_0x22aea8){_0x3cd0bd[_0xc8dd('0x43')]=_0x22aea8;return _0x3cd0bd;})[_0xc8dd('0x24')](respondWithFilteredResult(_0x2c8097,_0x406a30))[_0xc8dd('0x44')](handleError(_0x2c8097,null));};exports['show']=function(_0x3a34b1,_0x7bf132){var _0x25f10f={'raw':!![],'where':{'id':_0x3a34b1[_0xc8dd('0x45')]['id']}},_0x50fdc0={};_0x50fdc0[_0xc8dd('0x33')]=_[_0xc8dd('0x30')](db['FaxApplication'][_0xc8dd('0x2d')]);_0x50fdc0[_0xc8dd('0x2f')]=_[_0xc8dd('0x30')](_0x3a34b1[_0xc8dd('0x2f')]);_0x50fdc0[_0xc8dd('0x3b')]=_[_0xc8dd('0x31')](_0x50fdc0['model'],_0x50fdc0[_0xc8dd('0x2f')]);_0x25f10f['attributes']=_['intersection'](_0x50fdc0['model'],qs[_0xc8dd('0x34')](_0x3a34b1[_0xc8dd('0x2f')][_0xc8dd('0x34')]));_0x25f10f[_0xc8dd('0x32')]=_0x25f10f[_0xc8dd('0x32')]['length']?_0x25f10f[_0xc8dd('0x32')]:_0x50fdc0[_0xc8dd('0x33')];if(_0x3a34b1[_0xc8dd('0x2f')][_0xc8dd('0x40')]){_0x25f10f[_0xc8dd('0x41')]=[{'all':!![]}];}_0x25f10f=_['merge']({},_0x25f10f,_0x3a34b1[_0xc8dd('0x3f')]);return db[_0xc8dd('0x2c')]['find'](_0x25f10f)[_0xc8dd('0x24')](handleEntityNotFound(_0x7bf132,null))['then'](respondWithResult(_0x7bf132,null))['catch'](handleError(_0x7bf132,null));};exports[_0xc8dd('0x46')]=function(_0x341eb4,_0x1e84b2){return db[_0xc8dd('0x2c')][_0xc8dd('0x46')](_0x341eb4[_0xc8dd('0x47')],{})[_0xc8dd('0x24')](respondWithResult(_0x1e84b2,0xc9))[_0xc8dd('0x44')](handleError(_0x1e84b2,null));};exports[_0xc8dd('0x23')]=function(_0x2a5f65,_0x16e2cf){if(_0x2a5f65[_0xc8dd('0x47')]['id']){delete _0x2a5f65[_0xc8dd('0x47')]['id'];}return db[_0xc8dd('0x2c')][_0xc8dd('0x48')]({'where':{'id':_0x2a5f65[_0xc8dd('0x45')]['id']}})[_0xc8dd('0x24')](handleEntityNotFound(_0x16e2cf,null))['then'](saveUpdates(_0x2a5f65[_0xc8dd('0x47')],null))[_0xc8dd('0x24')](respondWithResult(_0x16e2cf,null))[_0xc8dd('0x44')](handleError(_0x16e2cf,null));};exports['destroy']=function(_0x2cbbb5,_0x690a97){return db['FaxApplication'][_0xc8dd('0x48')]({'where':{'id':_0x2cbbb5[_0xc8dd('0x45')]['id']}})[_0xc8dd('0x24')](handleEntityNotFound(_0x690a97,null))[_0xc8dd('0x24')](removeEntity(_0x690a97,null))[_0xc8dd('0x44')](handleError(_0x690a97,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bd9eff0..aeb9d67 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 _0xc5ed=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','fax_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x2f1e01,_0x425231){var _0x45df55=function(_0x57a661){while(--_0x57a661){_0x2f1e01['push'](_0x2f1e01['shift']());}};_0x45df55(++_0x425231);}(_0xc5ed,0x8a));var _0xdc5e=function(_0x46b1b2,_0x3ec40c){_0x46b1b2=_0x46b1b2-0x0;var _0x56c41b=_0xc5ed[_0x46b1b2];return _0x56c41b;};'use strict';var _=require(_0xdc5e('0x0'));var util=require(_0xdc5e('0x1'));var logger=require(_0xdc5e('0x2'))(_0xdc5e('0x3'));var moment=require(_0xdc5e('0x4'));var BPromise=require(_0xdc5e('0x5'));var rp=require(_0xdc5e('0x6'));var fs=require('fs');var path=require(_0xdc5e('0x7'));var rimraf=require(_0xdc5e('0x8'));var config=require(_0xdc5e('0x9'));var attributes=require(_0xdc5e('0xa'));module['exports']=function(_0x2c2f09,_0x56fc9d){return _0x2c2f09[_0xdc5e('0xb')]('FaxApplication',attributes,{'tableName':_0xdc5e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdc5e('0xd')});}; \ No newline at end of file +var _0x2f4f=['rimraf','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','path'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0x2f4f,0x67));var _0xf2f4=function(_0x3cd919,_0x356b19){_0x3cd919=_0x3cd919-0x0;var _0x1aa67a=_0x2f4f[_0x3cd919];return _0x1aa67a;};'use strict';var _=require(_0xf2f4('0x0'));var util=require('util');var logger=require(_0xf2f4('0x1'))(_0xf2f4('0x2'));var moment=require('moment');var BPromise=require(_0xf2f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2f4('0x4'));var rimraf=require(_0xf2f4('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2f4('0x6'));module[_0xf2f4('0x7')]=function(_0x32ad76,_0x697a04){return _0x32ad76[_0xf2f4('0x8')]('FaxApplication',attributes,{'tableName':_0xf2f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2f4('0xa'),'collate':_0xf2f4('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 166ff89..7fbb6d6 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 _0xe8bc=['body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxApplication,\x20%s,\x20%s','message','catch','update'];(function(_0x2539c6,_0x5a0687){var _0x3bad35=function(_0xbc9a1e){while(--_0xbc9a1e){_0x2539c6['push'](_0x2539c6['shift']());}};_0x3bad35(++_0x5a0687);}(_0xe8bc,0x15c));var _0xce8b=function(_0x43fb7f,_0xed547a){_0x43fb7f=_0x43fb7f-0x0;var _0x29ce4c=_0xe8bc[_0x43fb7f];return _0x29ce4c;};'use strict';var _=require(_0xce8b('0x0'));var util=require(_0xce8b('0x1'));var moment=require('moment');var BPromise=require(_0xce8b('0x2'));var rs=require(_0xce8b('0x3'));var fs=require('fs');var Redis=require(_0xce8b('0x4'));var db=require(_0xce8b('0x5'))['db'];var utils=require(_0xce8b('0x6'));var logger=require(_0xce8b('0x7'))(_0xce8b('0x8'));var config=require('../../config/environment');var jayson=require(_0xce8b('0x9'));var client=jayson[_0xce8b('0xa')][_0xce8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f4348,_0x3c8fcc,_0x29975e){return new BPromise(function(_0xca742f,_0x37e633){return client['request'](_0x4f4348,_0x29975e)[_0xce8b('0xc')](function(_0x5f03a2){logger[_0xce8b('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3c8fcc,_0xce8b('0xe'));logger[_0xce8b('0xf')](_0xce8b('0x10'),_0x3c8fcc,_0xce8b('0xe'),JSON[_0xce8b('0x11')](_0x5f03a2));if(_0x5f03a2['error']){if(_0x5f03a2['error'][_0xce8b('0x12')]===0x1f4){logger[_0xce8b('0x13')](_0xce8b('0x14'),_0x3c8fcc,_0x5f03a2[_0xce8b('0x13')]['message']);return _0x37e633(_0x5f03a2['error'][_0xce8b('0x15')]);}logger[_0xce8b('0x13')](_0xce8b('0x14'),_0x3c8fcc,_0x5f03a2['error'][_0xce8b('0x15')]);return _0xca742f(_0x5f03a2[_0xce8b('0x13')][_0xce8b('0x15')]);}else{logger['info'](_0xce8b('0x14'),_0x3c8fcc,_0xce8b('0xe'));_0xca742f(_0x5f03a2['result'][_0xce8b('0x15')]);}})[_0xce8b('0x16')](function(_0x5d4453){logger[_0xce8b('0x13')](_0xce8b('0x14'),_0x3c8fcc,_0x5d4453);_0x37e633(_0x5d4453);});});}exports['UpdateFaxApplication']=function(_0x1f16f2){var _0x108e98=this;return new Promise(function(_0x2bf603,_0x32385a){return db['FaxApplication'][_0xce8b('0x17')](_0x1f16f2[_0xce8b('0x18')],{'raw':_0x1f16f2['options']?_0x1f16f2[_0xce8b('0x19')][_0xce8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f16f2[_0xce8b('0x19')]?_0x1f16f2[_0xce8b('0x19')][_0xce8b('0x1b')]||null:null,'attributes':_0x1f16f2[_0xce8b('0x19')]?_0x1f16f2['options'][_0xce8b('0x1c')]||null:null,'limit':_0x1f16f2[_0xce8b('0x19')]?_0x1f16f2['options'][_0xce8b('0x1d')]||null:null})[_0xce8b('0xc')](function(_0x49e932){logger[_0xce8b('0xd')]('UpdateFaxApplication',_0x1f16f2);logger['debug'](_0xce8b('0x1e'),_0x1f16f2,JSON['stringify'](_0x49e932));_0x2bf603(_0x49e932);})[_0xce8b('0x16')](function(_0x310df0){logger[_0xce8b('0x13')](_0xce8b('0x1e'),_0x310df0[_0xce8b('0x15')],_0x1f16f2);_0x32385a(_0x108e98['error'](0x1f4,_0x310df0[_0xce8b('0x15')]));});});}; \ No newline at end of file +var _0x7146=['where','attributes','info','UpdateFaxApplication','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxApplication','update','body','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7146,0x185));var _0x6714=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7146[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6714('0x0'));var util=require(_0x6714('0x1'));var moment=require(_0x6714('0x2'));var BPromise=require('bluebird');var rs=require(_0x6714('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6714('0x4'))['db'];var utils=require(_0x6714('0x5'));var logger=require(_0x6714('0x6'))(_0x6714('0x7'));var config=require(_0x6714('0x8'));var jayson=require(_0x6714('0x9'));var client=jayson['client'][_0x6714('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11063,_0x42f9ba,_0x4e6ee6){return new BPromise(function(_0x25cd8c,_0x238fd9){return client[_0x6714('0xb')](_0x11063,_0x4e6ee6)[_0x6714('0xc')](function(_0x230f8b){logger['info'](_0x6714('0xd'),_0x42f9ba,_0x6714('0xe'));logger[_0x6714('0xf')](_0x6714('0x10'),_0x42f9ba,_0x6714('0xe'),JSON[_0x6714('0x11')](_0x230f8b));if(_0x230f8b['error']){if(_0x230f8b[_0x6714('0x12')][_0x6714('0x13')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x42f9ba,_0x230f8b[_0x6714('0x12')][_0x6714('0x14')]);return _0x238fd9(_0x230f8b[_0x6714('0x12')][_0x6714('0x14')]);}logger[_0x6714('0x12')](_0x6714('0xd'),_0x42f9ba,_0x230f8b[_0x6714('0x12')]['message']);return _0x25cd8c(_0x230f8b['error']['message']);}else{logger['info'](_0x6714('0xd'),_0x42f9ba,_0x6714('0xe'));_0x25cd8c(_0x230f8b[_0x6714('0x15')][_0x6714('0x14')]);}})['catch'](function(_0x4438b7){logger[_0x6714('0x12')](_0x6714('0xd'),_0x42f9ba,_0x4438b7);_0x238fd9(_0x4438b7);});});}exports['UpdateFaxApplication']=function(_0x1a221e){var _0x1539da=this;return new Promise(function(_0x4c527e,_0x5a767c){return db[_0x6714('0x16')][_0x6714('0x17')](_0x1a221e[_0x6714('0x18')],{'raw':_0x1a221e[_0x6714('0x19')]?_0x1a221e['options'][_0x6714('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a221e[_0x6714('0x19')]?_0x1a221e[_0x6714('0x19')][_0x6714('0x1b')]||null:null,'attributes':_0x1a221e[_0x6714('0x19')]?_0x1a221e[_0x6714('0x19')][_0x6714('0x1c')]||null:null,'limit':_0x1a221e[_0x6714('0x19')]?_0x1a221e[_0x6714('0x19')]['limit']||null:null})[_0x6714('0xc')](function(_0x5b4d09){logger[_0x6714('0x1d')](_0x6714('0x1e'),_0x1a221e);logger[_0x6714('0xf')](_0x6714('0x1e'),_0x1a221e,JSON[_0x6714('0x11')](_0x5b4d09));_0x4c527e(_0x5b4d09);})[_0x6714('0x1f')](function(_0x35a0a6){logger[_0x6714('0x12')](_0x6714('0x1e'),_0x35a0a6['message'],_0x1a221e);_0x5a767c(_0x1539da[_0x6714('0x12')](0x1f4,_0x35a0a6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 6114670..995d92b 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0xe9d46,_0x2424ab){var _0x22648c=function(_0x68c2f7){while(--_0x68c2f7){_0xe9d46['push'](_0xe9d46['shift']());}};_0x22648c(++_0x2424ab);}(_0x5eb8,0xb0));var _0x85eb=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x5eb8[_0x34c4e1];return _0x5a11ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x2ba51b,_0x54d5f3){var _0x34a5da=function(_0x33c3b9){while(--_0x33c3b9){_0x2ba51b['push'](_0x2ba51b['shift']());}};_0x34a5da(++_0x54d5f3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 71e7cee..ac02b3c 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 _0xef0f=['ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xef0f,0x168));var _0xfef0=function(_0x4afde6,_0x28699a){_0x4afde6=_0x4afde6-0x0;var _0xc959cf=_0xef0f[_0x4afde6];return _0xc959cf;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'closed':{'type':Sequelize[_0xfef0('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfef0('0x2')]},'disposition':{'type':Sequelize[_0xfef0('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfef0('0x3')]},'note':{'type':Sequelize[_0xfef0('0x3')]},'read1stAt':{'type':Sequelize[_0xfef0('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xfef0('0x4')]('in',_0xfef0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfef0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfef0('0x4')]('in',_0xfef0('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xfef0('0x6')]}}; \ No newline at end of file +var _0xc2c7=['out','ENUM','exports','BOOLEAN','DATE','STRING'];(function(_0xfe8cca,_0x58c9f8){var _0x583aa3=function(_0xb65f56){while(--_0xb65f56){_0xfe8cca['push'](_0xfe8cca['shift']());}};_0x583aa3(++_0x58c9f8);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3d48c9,_0x4b3504){_0x3d48c9=_0x3d48c9-0x0;var _0x87657=_0xc2c7[_0x3d48c9];return _0x87657;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'closed':{'type':Sequelize[_0x7c2c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7c2c('0x2')]},'disposition':{'type':Sequelize[_0x7c2c('0x3')]},'secondDisposition':{'type':Sequelize[_0x7c2c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7c2c('0x3')]},'note':{'type':Sequelize[_0x7c2c('0x3')]},'read1stAt':{'type':Sequelize[_0x7c2c('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7c2c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7c2c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x7c2c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 0d69a08..1bcd9c9 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 _0x63c4=['download','toString','root','server','files','tmp','attachments','join','push','Attachment','createdAt','get','mkdirSync','Messages','basename','createReadStream','pipe','createWriteStream','resolve','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','error','stack','name','map','FaxInteraction','rawAttributes','fieldName','type','key','findAll','fax','query','user','then','show','params','keys','filters','intersection','model','attributes','fields','includeAll','include','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save'];(function(_0x2bf947,_0x1cbfe4){var _0x146738=function(_0x2cd6c9){while(--_0x2cd6c9){_0x2bf947['push'](_0x2bf947['shift']());}};_0x146738(++_0x1cbfe4);}(_0x63c4,0x76));var _0x463c=function(_0x1f22a0,_0x548697){_0x1f22a0=_0x1f22a0-0x0;var _0xa640d7=_0x63c4[_0x1f22a0];return _0xa640d7;};'use strict';var rimraf=require(_0x463c('0x0'));var zipdir=require(_0x463c('0x1'));var moment=require(_0x463c('0x2'));var BPromise=require(_0x463c('0x3'));var util=require(_0x463c('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x463c('0x5'));var Redis=require('ioredis');var interaction=require(_0x463c('0x6'));var qs=require(_0x463c('0x7'));var logger=require(_0x463c('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x463c('0x9')]=_['defaults'](config[_0x463c('0x9')],{'host':_0x463c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x463c('0x9')]));require(_0x463c('0xb'))[_0x463c('0xc')](socket);function respondWithStatusCode(_0x39e280,_0xbe90ec){_0xbe90ec=_0xbe90ec||0xcc;return function(_0x4d1fee){if(_0x4d1fee){return _0x39e280[_0x463c('0xd')](_0xbe90ec);}return _0x39e280[_0x463c('0xe')](_0xbe90ec)[_0x463c('0xf')]();};}function respondWithResult(_0x56b1d8,_0x7173f9){_0x7173f9=_0x7173f9||0xc8;return function(_0x380541){if(_0x380541){return _0x56b1d8[_0x463c('0xe')](_0x7173f9)[_0x463c('0x10')](_0x380541);}};}function respondWithFilteredResult(_0x55c3bb,_0x28191b){return function(_0xf5975b){if(_0xf5975b){var _0x61ccca=typeof _0x28191b[_0x463c('0x11')]===_0x463c('0x12')&&typeof _0x28191b[_0x463c('0x13')]===_0x463c('0x12');var _0x5d5fa1=_0xf5975b['count'];var _0x411dc6=_0x61ccca?0x0:_0x28191b[_0x463c('0x11')];var _0x21d5c2=_0x61ccca?_0xf5975b[_0x463c('0x14')]:_0x28191b[_0x463c('0x11')]+_0x28191b[_0x463c('0x13')];var _0x18da07;if(_0x21d5c2>=_0x5d5fa1){_0x21d5c2=_0x5d5fa1;_0x18da07=0xc8;}else{_0x18da07=0xce;}_0x55c3bb[_0x463c('0xe')](_0x18da07);return _0x55c3bb['set'](_0x463c('0x15'),_0x411dc6+'-'+_0x21d5c2+'/'+_0x5d5fa1)[_0x463c('0x10')](_0xf5975b);}return null;};}function saveUpdates(_0x5d590a){return function(_0x35a615){if(_0x35a615){return _0x35a615[_0x463c('0x16')](_0x5d590a)['then'](function(_0x460650){return _0x460650;});}return null;};}function removeEntity(_0x565536){return function(_0x86141a){if(_0x86141a){return _0x86141a[_0x463c('0x17')]()['then'](function(){_0x565536[_0x463c('0xe')](0xcc)[_0x463c('0xf')]();});}};}function handleEntityNotFound(_0x2361f8){return function(_0x62cc2d){if(!_0x62cc2d){_0x2361f8[_0x463c('0xd')](0x194);}return _0x62cc2d;};}function handleError(_0x1e0385,_0x659a48){_0x659a48=_0x659a48||0x1f4;return function(_0x4639a7){logger[_0x463c('0x18')](_0x4639a7[_0x463c('0x19')]);if(_0x4639a7[_0x463c('0x1a')]){delete _0x4639a7['name'];}_0x1e0385[_0x463c('0xe')](_0x659a48)['send'](_0x4639a7);};}exports['index']=function(_0x3c73e4,_0x2e27ca){var _0x80f730={};var _0x51eae7=_[_0x463c('0x1b')](db[_0x463c('0x1c')][_0x463c('0x1d')],function(_0x42ac83){return{'name':_0x42ac83[_0x463c('0x1e')],'type':_0x42ac83[_0x463c('0x1f')][_0x463c('0x20')]};});_0x80f730=qs['getOptions'](_0x51eae7,_0x3c73e4);return interaction[_0x463c('0x21')](_0x463c('0x22'),_0x3c73e4[_0x463c('0x23')],_0x3c73e4[_0x463c('0x24')],_0x80f730,_0x51eae7)[_0x463c('0x25')](respondWithFilteredResult(_0x2e27ca,_0x80f730))['catch'](handleError(_0x2e27ca,null));};exports[_0x463c('0x26')]=function(_0x5b57a4,_0x1894ef){var _0x393a61={'raw':![],'where':{'id':_0x5b57a4[_0x463c('0x27')]['id']}},_0x3ee1f9={};_0x3ee1f9['model']=_[_0x463c('0x28')](db['FaxInteraction'][_0x463c('0x1d')]);_0x3ee1f9[_0x463c('0x23')]=_[_0x463c('0x28')](_0x5b57a4[_0x463c('0x23')]);_0x3ee1f9[_0x463c('0x29')]=_[_0x463c('0x2a')](_0x3ee1f9[_0x463c('0x2b')],_0x3ee1f9[_0x463c('0x23')]);_0x393a61[_0x463c('0x2c')]=_[_0x463c('0x2a')](_0x3ee1f9[_0x463c('0x2b')],qs[_0x463c('0x2d')](_0x5b57a4[_0x463c('0x23')]['fields']));_0x393a61[_0x463c('0x2c')]=_0x393a61[_0x463c('0x2c')]['length']?_0x393a61[_0x463c('0x2c')]:_0x3ee1f9[_0x463c('0x2b')];if(_0x5b57a4[_0x463c('0x23')][_0x463c('0x2e')]){_0x393a61[_0x463c('0x2f')]=[{'all':!![]}];}_0x393a61=_['merge']({},_0x393a61,_0x5b57a4[_0x463c('0x30')]);return db[_0x463c('0x1c')][_0x463c('0x31')](_0x393a61)[_0x463c('0x25')](handleEntityNotFound(_0x1894ef,null))[_0x463c('0x25')](respondWithResult(_0x1894ef,null))[_0x463c('0x32')](handleError(_0x1894ef,null));};exports[_0x463c('0x33')]=function(_0x2d4782,_0x4531dd){return db[_0x463c('0x1c')][_0x463c('0x33')](_0x2d4782[_0x463c('0x34')],{})[_0x463c('0x25')](respondWithResult(_0x4531dd,0xc9))[_0x463c('0x32')](handleError(_0x4531dd,null));};exports[_0x463c('0x16')]=function(_0x440608,_0x3fb858){if(_0x440608[_0x463c('0x34')]['id']){delete _0x440608['body']['id'];}return db[_0x463c('0x1c')][_0x463c('0x31')]({'where':{'id':_0x440608['params']['id']}})['then'](handleEntityNotFound(_0x3fb858,null))['then'](saveUpdates(_0x440608[_0x463c('0x34')],null))[_0x463c('0x25')](respondWithResult(_0x3fb858,null))[_0x463c('0x32')](handleError(_0x3fb858,null));};exports[_0x463c('0x17')]=function(_0x2e2bee,_0x19569f){return db[_0x463c('0x1c')][_0x463c('0x31')]({'where':{'id':_0x2e2bee[_0x463c('0x27')]['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x19569f,null))[_0x463c('0x25')](removeEntity(_0x19569f,null))[_0x463c('0x32')](handleError(_0x19569f,null));};exports[_0x463c('0x35')]=function(_0x35cf8e,_0x2842b7){return db[_0x463c('0x1c')][_0x463c('0x35')]()['then'](respondWithResult(_0x2842b7,null))[_0x463c('0x32')](handleError(_0x2842b7,null));};exports[_0x463c('0x36')]=function(_0x559bb1,_0x481b13){return db['FaxMessage']['find']({'where':{'id':_0x559bb1[_0x463c('0x27')]['id']}})['then'](handleEntityNotFound(_0x481b13,null))[_0x463c('0x25')](function(_0x2fc7ce){if(_0x2fc7ce){return _0x2fc7ce['addMessage'](_0x559bb1[_0x463c('0x34')][_0x463c('0x37')],_[_0x463c('0x38')](_0x559bb1[_0x463c('0x34')],[_0x463c('0x37'),'id'])||{});}})[_0x463c('0x25')](respondWithResult(_0x481b13,null))[_0x463c('0x32')](handleError(_0x481b13,null));};exports[_0x463c('0x39')]=function(_0x45dae1,_0x27b609){var _0x2b9cbb={'raw':![],'where':{}};var _0x8e3b48={};var _0xb9ed66={'count':0x0,'rows':[]};return db[_0x463c('0x1c')]['findOne']({'where':{'id':_0x45dae1['params']['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x27b609,null))[_0x463c('0x25')](function(_0x5020d2){if(_0x5020d2){_0x8e3b48['model']=_[_0x463c('0x28')](db['FaxMessage'][_0x463c('0x1d')]);_0x8e3b48[_0x463c('0x23')]=_[_0x463c('0x28')](_0x45dae1[_0x463c('0x23')]);_0x8e3b48[_0x463c('0x29')]=_['intersection'](_0x8e3b48['model'],_0x8e3b48[_0x463c('0x23')]);_0x2b9cbb[_0x463c('0x2c')]=_[_0x463c('0x2a')](_0x8e3b48[_0x463c('0x2b')],qs[_0x463c('0x2d')](_0x45dae1['query'][_0x463c('0x2d')]));_0x2b9cbb[_0x463c('0x2c')]=_0x2b9cbb[_0x463c('0x2c')][_0x463c('0x3a')]?_0x2b9cbb[_0x463c('0x2c')]:_0x8e3b48[_0x463c('0x2b')];if(!_0x45dae1[_0x463c('0x23')][_0x463c('0x3b')](_0x463c('0x3c'))){_0x2b9cbb[_0x463c('0x13')]=qs[_0x463c('0x13')](_0x45dae1[_0x463c('0x23')][_0x463c('0x13')]);_0x2b9cbb['offset']=qs[_0x463c('0x11')](_0x45dae1[_0x463c('0x23')]['offset']);}_0x2b9cbb['order']=qs['sort'](_0x45dae1[_0x463c('0x23')][_0x463c('0x3d')]);_0x2b9cbb[_0x463c('0x3e')]=qs['filters'](_[_0x463c('0x3f')](_0x45dae1[_0x463c('0x23')],_0x8e3b48['filters']));_0x2b9cbb[_0x463c('0x3e')]['FaxInteractionId']=_0x5020d2['id'];if(_0x45dae1[_0x463c('0x23')][_0x463c('0x40')]){_0x2b9cbb[_0x463c('0x3e')]=_[_0x463c('0x41')](_0x2b9cbb[_0x463c('0x3e')],{'$or':_[_0x463c('0x1b')](_0x2b9cbb[_0x463c('0x2c')],function(_0x5349bd){var _0x1dc8cd={};_0x1dc8cd[_0x5349bd]={'$like':'%'+_0x45dae1[_0x463c('0x23')][_0x463c('0x40')]+'%'};return _0x1dc8cd;})});}if(_0x45dae1['query'][_0x463c('0x42')]){var _0x1e2834=_0x45dae1['query'][_0x463c('0x42')]['split'](',');var _0xb5fe7f={};_0xb5fe7f[_0x1e2834[0x0]]={'$gte':moment(_0x1e2834[0x1])[_0x463c('0x43')](_0x463c('0x44'))};_0x2b9cbb['where']=_[_0x463c('0x41')](_0x2b9cbb[_0x463c('0x3e')],_0xb5fe7f);}_0x2b9cbb=_[_0x463c('0x41')]({},_0x2b9cbb,_0x45dae1['options']);return db[_0x463c('0x45')]['count']({'where':_0x2b9cbb['where']})[_0x463c('0x25')](function(_0x27a58d){_0xb9ed66['count']=_0x27a58d;if(_0x45dae1[_0x463c('0x23')]['includeAll']){_0x2b9cbb[_0x463c('0x2f')]=[{'all':!![]}];}return db[_0x463c('0x45')][_0x463c('0x21')](_0x2b9cbb);})[_0x463c('0x25')](function(_0x1e9deb){_0xb9ed66[_0x463c('0x46')]=_0x1e9deb;return _0xb9ed66;});}})[_0x463c('0x25')](respondWithFilteredResult(_0x27b609,_0x2b9cbb))[_0x463c('0x32')](handleError(_0x27b609,null));};exports[_0x463c('0x47')]=function(_0x14e5c7,_0x3e66c5){return db['FaxInteraction'][_0x463c('0x31')]({'where':{'id':_0x14e5c7[_0x463c('0x27')]['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x3e66c5,null))[_0x463c('0x25')](function(_0xc81f66){if(_0xc81f66){return _0xc81f66[_0x463c('0x48')](_0x14e5c7[_0x463c('0x34')]['ids'],_[_0x463c('0x38')](_0x14e5c7[_0x463c('0x34')],['ids','id'])||{})[_0x463c('0x49')](function(){return db[_0x463c('0x4a')][_0x463c('0x21')]({'attributes':['id','name',_0x463c('0x4b')],'where':{'id':_0x14e5c7['body'][_0x463c('0x37')]}});})['then'](function(_0x10fead){socket[_0x463c('0x4c')](_0x463c('0x4d'),{'id':Number(_0x14e5c7['params']['id']),'tags':_0x10fead||[]});return{'id':Number(_0x14e5c7[_0x463c('0x27')]['id']),'tags':_0x10fead||[]};});}})[_0x463c('0x25')](respondWithResult(_0x3e66c5,null))[_0x463c('0x32')](handleError(_0x3e66c5,null));};exports['removeTags']=function(_0x133aae,_0x30b274){return db['FaxInteraction'][_0x463c('0x31')]({'where':{'id':_0x133aae[_0x463c('0x27')]['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x30b274,null))[_0x463c('0x25')](function(_0x33825f){if(_0x33825f){return _0x33825f['removeTags'](_0x133aae[_0x463c('0x23')]['ids']);}})['then'](respondWithStatusCode(_0x30b274,null))[_0x463c('0x32')](handleError(_0x30b274,null));};exports[_0x463c('0x4e')]=function(_0x482d9b,_0x2e88dc){var _0xfcfa22=moment()['unix']()[_0x463c('0x4f')]();var _0x391f5b=path['join'](config[_0x463c('0x50')],_0x463c('0x51'),_0x463c('0x52'),_0x463c('0x53'));var _0x1729a7=path['join'](config[_0x463c('0x50')],_0x463c('0x51'),_0x463c('0x52'),_0x463c('0x54'));var _0x57f023=path[_0x463c('0x55')](_0x391f5b,_0xfcfa22);var _0xb4de34=util[_0x463c('0x43')]('transcript-%d-%s.zip',_0x482d9b[_0x463c('0x27')]['id'],_0xfcfa22);var _0x5bb7b4=path['join'](_0x391f5b,_0xb4de34);var _0x21abb3=[];_0x21abb3[_0x463c('0x56')]({'model':db[_0x463c('0x57')],'as':_0x463c('0x57'),'raw':!![]});var _0x2e1266=[{'model':db[_0x463c('0x45')],'as':'Messages','attributes':['id',_0x463c('0x34'),_0x463c('0x58')],'include':_0x21abb3}];return db[_0x463c('0x1c')][_0x463c('0x31')]({'where':{'id':_0x482d9b[_0x463c('0x27')]['id']},'include':_0x2e1266})[_0x463c('0x25')](handleEntityNotFound(_0x2e88dc,null))[_0x463c('0x25')](function(_0x52bac5){if(_0x52bac5&&_0x52bac5['Messages']){var _0x3b673c=_0x52bac5[_0x463c('0x59')]({'plain':!![]});fs[_0x463c('0x5a')](_0x57f023);for(var _0x390d81=0x0;_0x390d81<_0x3b673c[_0x463c('0x5b')]['length'];_0x390d81++){var _0x52dab3=_0x3b673c['Messages'][_0x390d81][_0x463c('0x57')];if(_0x52dab3){var _0x20c0b5=path[_0x463c('0x55')](_0x1729a7,_0x52dab3[_0x463c('0x5c')]);if(fs['existsSync'](_0x20c0b5)){fs[_0x463c('0x5d')](_0x20c0b5)[_0x463c('0x5e')](fs[_0x463c('0x5f')](path[_0x463c('0x55')](_0x57f023,_0x52dab3[_0x463c('0x5c')])));}}}return BPromise[_0x463c('0x60')]()[_0x463c('0x25')](function(){return new BPromise(function(_0x275475,_0x230270){zipdir(_0x57f023,{'saveTo':_0x5bb7b4},function(_0x4ff803,_0x3c795c){if(_0x4ff803)return _0x230270(_0x4ff803);return _0x275475(_0x3c795c);});})[_0x463c('0x25')](function(){return new BPromise(function(_0x228878,_0x472132){rimraf(_0x57f023,function(_0x11708d){if(_0x11708d)_0x472132(_0x11708d);return _0x228878();});});})[_0x463c('0x25')](function(){return _0x2e88dc[_0x463c('0x4e')](_0x5bb7b4,_0xb4de34,function(_0x3608cc){if(_0x3608cc){console['log']('err',_0x3608cc);}else{fs[_0x463c('0x61')](_0x5bb7b4);}});});});}else{return _0x2e88dc[_0x463c('0xd')](0xc8);}})['catch'](handleError(_0x2e88dc,null));}; \ No newline at end of file +var _0x3f7b=['util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','status','end','offset','undefined','limit','count','set','json','update','then','sendStatus','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','FaxMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','FaxInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','root','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','moment','bluebird'];(function(_0x5c011b,_0x3098f7){var _0x1cc969=function(_0x442e90){while(--_0x442e90){_0x5c011b['push'](_0x5c011b['shift']());}};_0x1cc969(++_0x3098f7);}(_0x3f7b,0xc9));var _0xb3f7=function(_0x2deb2b,_0x35f4e5){_0x2deb2b=_0x2deb2b-0x0;var _0x5836a0=_0x3f7b[_0x2deb2b];return _0x5836a0;};'use strict';var rimraf=require(_0xb3f7('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb3f7('0x1'));var BPromise=require(_0xb3f7('0x2'));var util=require(_0xb3f7('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xb3f7('0x4'));var Redis=require(_0xb3f7('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xb3f7('0x6'));var logger=require(_0xb3f7('0x7'))(_0xb3f7('0x8'));var config=require(_0xb3f7('0x9'));var db=require(_0xb3f7('0xa'))['db'];config[_0xb3f7('0xb')]=_[_0xb3f7('0xc')](config[_0xb3f7('0xb')],{'host':_0xb3f7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3f7('0xb')]));require(_0xb3f7('0xe'))[_0xb3f7('0xf')](socket);function respondWithStatusCode(_0x2eb790,_0x81fbb7){_0x81fbb7=_0x81fbb7||0xcc;return function(_0x3d512b){if(_0x3d512b){return _0x2eb790['sendStatus'](_0x81fbb7);}return _0x2eb790[_0xb3f7('0x10')](_0x81fbb7)[_0xb3f7('0x11')]();};}function respondWithResult(_0x52e8cb,_0x1a4385){_0x1a4385=_0x1a4385||0xc8;return function(_0x5449a3){if(_0x5449a3){return _0x52e8cb['status'](_0x1a4385)['json'](_0x5449a3);}};}function respondWithFilteredResult(_0x49be36,_0x39ac84){return function(_0x269a04){if(_0x269a04){var _0x38c4ba=typeof _0x39ac84[_0xb3f7('0x12')]===_0xb3f7('0x13')&&typeof _0x39ac84[_0xb3f7('0x14')]===_0xb3f7('0x13');var _0x1611c0=_0x269a04[_0xb3f7('0x15')];var _0x2c3544=_0x38c4ba?0x0:_0x39ac84[_0xb3f7('0x12')];var _0x589b28=_0x38c4ba?_0x269a04[_0xb3f7('0x15')]:_0x39ac84['offset']+_0x39ac84[_0xb3f7('0x14')];var _0x5c3acd;if(_0x589b28>=_0x1611c0){_0x589b28=_0x1611c0;_0x5c3acd=0xc8;}else{_0x5c3acd=0xce;}_0x49be36['status'](_0x5c3acd);return _0x49be36[_0xb3f7('0x16')]('Content-Range',_0x2c3544+'-'+_0x589b28+'/'+_0x1611c0)[_0xb3f7('0x17')](_0x269a04);}return null;};}function saveUpdates(_0x138e47){return function(_0x282c0d){if(_0x282c0d){return _0x282c0d[_0xb3f7('0x18')](_0x138e47)[_0xb3f7('0x19')](function(_0x343088){return _0x343088;});}return null;};}function removeEntity(_0x629bf2){return function(_0x55b984){if(_0x55b984){return _0x55b984['destroy']()['then'](function(){_0x629bf2['status'](0xcc)[_0xb3f7('0x11')]();});}};}function handleEntityNotFound(_0x4bc72a){return function(_0x56a483){if(!_0x56a483){_0x4bc72a[_0xb3f7('0x1a')](0x194);}return _0x56a483;};}function handleError(_0x1b61a4,_0x5e1aa9){_0x5e1aa9=_0x5e1aa9||0x1f4;return function(_0x3d45a7){logger[_0xb3f7('0x1b')](_0x3d45a7[_0xb3f7('0x1c')]);if(_0x3d45a7[_0xb3f7('0x1d')]){delete _0x3d45a7[_0xb3f7('0x1d')];}_0x1b61a4[_0xb3f7('0x10')](_0x5e1aa9)['send'](_0x3d45a7);};}exports[_0xb3f7('0x1e')]=function(_0x24f509,_0x52678d){var _0x5c46df={};var _0x559364=_[_0xb3f7('0x1f')](db[_0xb3f7('0x20')][_0xb3f7('0x21')],function(_0x374c75){return{'name':_0x374c75[_0xb3f7('0x22')],'type':_0x374c75[_0xb3f7('0x23')][_0xb3f7('0x24')]};});_0x5c46df=qs[_0xb3f7('0x25')](_0x559364,_0x24f509);return interaction['findAll']('fax',_0x24f509[_0xb3f7('0x26')],_0x24f509['user'],_0x5c46df,_0x559364)[_0xb3f7('0x19')](respondWithFilteredResult(_0x52678d,_0x5c46df))[_0xb3f7('0x27')](handleError(_0x52678d,null));};exports[_0xb3f7('0x28')]=function(_0x544584,_0x16ccff){var _0x245d43={'raw':![],'where':{'id':_0x544584[_0xb3f7('0x29')]['id']}},_0xc4d029={};_0xc4d029[_0xb3f7('0x2a')]=_[_0xb3f7('0x2b')](db[_0xb3f7('0x20')][_0xb3f7('0x21')]);_0xc4d029[_0xb3f7('0x26')]=_[_0xb3f7('0x2b')](_0x544584[_0xb3f7('0x26')]);_0xc4d029[_0xb3f7('0x2c')]=_[_0xb3f7('0x2d')](_0xc4d029[_0xb3f7('0x2a')],_0xc4d029[_0xb3f7('0x26')]);_0x245d43[_0xb3f7('0x2e')]=_[_0xb3f7('0x2d')](_0xc4d029[_0xb3f7('0x2a')],qs[_0xb3f7('0x2f')](_0x544584[_0xb3f7('0x26')][_0xb3f7('0x2f')]));_0x245d43[_0xb3f7('0x2e')]=_0x245d43[_0xb3f7('0x2e')][_0xb3f7('0x30')]?_0x245d43['attributes']:_0xc4d029[_0xb3f7('0x2a')];if(_0x544584[_0xb3f7('0x26')][_0xb3f7('0x31')]){_0x245d43[_0xb3f7('0x32')]=[{'all':!![]}];}_0x245d43=_[_0xb3f7('0x33')]({},_0x245d43,_0x544584[_0xb3f7('0x34')]);return db[_0xb3f7('0x20')][_0xb3f7('0x35')](_0x245d43)[_0xb3f7('0x19')](handleEntityNotFound(_0x16ccff,null))[_0xb3f7('0x19')](respondWithResult(_0x16ccff,null))[_0xb3f7('0x27')](handleError(_0x16ccff,null));};exports[_0xb3f7('0x36')]=function(_0x51d28c,_0x2227e3){return db['FaxInteraction'][_0xb3f7('0x36')](_0x51d28c[_0xb3f7('0x37')],{})[_0xb3f7('0x19')](respondWithResult(_0x2227e3,0xc9))['catch'](handleError(_0x2227e3,null));};exports[_0xb3f7('0x18')]=function(_0x2741bc,_0x4e6df9){if(_0x2741bc[_0xb3f7('0x37')]['id']){delete _0x2741bc[_0xb3f7('0x37')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x2741bc[_0xb3f7('0x29')]['id']}})[_0xb3f7('0x19')](handleEntityNotFound(_0x4e6df9,null))[_0xb3f7('0x19')](saveUpdates(_0x2741bc[_0xb3f7('0x37')],null))[_0xb3f7('0x19')](respondWithResult(_0x4e6df9,null))[_0xb3f7('0x27')](handleError(_0x4e6df9,null));};exports[_0xb3f7('0x38')]=function(_0x49253a,_0x4aa92a){return db[_0xb3f7('0x20')]['find']({'where':{'id':_0x49253a[_0xb3f7('0x29')]['id']}})['then'](handleEntityNotFound(_0x4aa92a,null))[_0xb3f7('0x19')](removeEntity(_0x4aa92a,null))['catch'](handleError(_0x4aa92a,null));};exports[_0xb3f7('0x39')]=function(_0x103719,_0x2ea149){return db[_0xb3f7('0x20')][_0xb3f7('0x39')]()['then'](respondWithResult(_0x2ea149,null))[_0xb3f7('0x27')](handleError(_0x2ea149,null));};exports[_0xb3f7('0x3a')]=function(_0x195dca,_0x5c43fd){return db[_0xb3f7('0x3b')][_0xb3f7('0x35')]({'where':{'id':_0x195dca['params']['id']}})[_0xb3f7('0x19')](handleEntityNotFound(_0x5c43fd,null))[_0xb3f7('0x19')](function(_0x376767){if(_0x376767){return _0x376767[_0xb3f7('0x3a')](_0x195dca[_0xb3f7('0x37')][_0xb3f7('0x3c')],_['omit'](_0x195dca['body'],[_0xb3f7('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x5c43fd,null))[_0xb3f7('0x27')](handleError(_0x5c43fd,null));};exports[_0xb3f7('0x3d')]=function(_0x3f886a,_0x369ba6){var _0x4b5f9d={'raw':![],'where':{}};var _0x1c0384={};var _0x4007fe={'count':0x0,'rows':[]};return db[_0xb3f7('0x20')]['findOne']({'where':{'id':_0x3f886a[_0xb3f7('0x29')]['id']}})[_0xb3f7('0x19')](handleEntityNotFound(_0x369ba6,null))[_0xb3f7('0x19')](function(_0x8c98ee){if(_0x8c98ee){_0x1c0384['model']=_[_0xb3f7('0x2b')](db[_0xb3f7('0x3b')]['rawAttributes']);_0x1c0384[_0xb3f7('0x26')]=_[_0xb3f7('0x2b')](_0x3f886a[_0xb3f7('0x26')]);_0x1c0384[_0xb3f7('0x2c')]=_[_0xb3f7('0x2d')](_0x1c0384[_0xb3f7('0x2a')],_0x1c0384[_0xb3f7('0x26')]);_0x4b5f9d['attributes']=_[_0xb3f7('0x2d')](_0x1c0384[_0xb3f7('0x2a')],qs[_0xb3f7('0x2f')](_0x3f886a[_0xb3f7('0x26')][_0xb3f7('0x2f')]));_0x4b5f9d[_0xb3f7('0x2e')]=_0x4b5f9d[_0xb3f7('0x2e')][_0xb3f7('0x30')]?_0x4b5f9d[_0xb3f7('0x2e')]:_0x1c0384['model'];if(!_0x3f886a['query'][_0xb3f7('0x3e')](_0xb3f7('0x3f'))){_0x4b5f9d[_0xb3f7('0x14')]=qs[_0xb3f7('0x14')](_0x3f886a['query'][_0xb3f7('0x14')]);_0x4b5f9d[_0xb3f7('0x12')]=qs[_0xb3f7('0x12')](_0x3f886a[_0xb3f7('0x26')][_0xb3f7('0x12')]);}_0x4b5f9d[_0xb3f7('0x40')]=qs[_0xb3f7('0x41')](_0x3f886a[_0xb3f7('0x26')]['sort']);_0x4b5f9d['where']=qs['filters'](_['pick'](_0x3f886a[_0xb3f7('0x26')],_0x1c0384[_0xb3f7('0x2c')]));_0x4b5f9d['where'][_0xb3f7('0x42')]=_0x8c98ee['id'];if(_0x3f886a[_0xb3f7('0x26')][_0xb3f7('0x43')]){_0x4b5f9d[_0xb3f7('0x44')]=_[_0xb3f7('0x33')](_0x4b5f9d['where'],{'$or':_[_0xb3f7('0x1f')](_0x4b5f9d['attributes'],function(_0xe5166c){var _0x124f9d={};_0x124f9d[_0xe5166c]={'$like':'%'+_0x3f886a[_0xb3f7('0x26')][_0xb3f7('0x43')]+'%'};return _0x124f9d;})});}if(_0x3f886a['query'][_0xb3f7('0x45')]){var _0x477112=_0x3f886a[_0xb3f7('0x26')][_0xb3f7('0x45')][_0xb3f7('0x46')](',');var _0x4b59a4={};_0x4b59a4[_0x477112[0x0]]={'$gte':moment(_0x477112[0x1])[_0xb3f7('0x47')](_0xb3f7('0x48'))};_0x4b5f9d[_0xb3f7('0x44')]=_[_0xb3f7('0x33')](_0x4b5f9d[_0xb3f7('0x44')],_0x4b59a4);}_0x4b5f9d=_[_0xb3f7('0x33')]({},_0x4b5f9d,_0x3f886a[_0xb3f7('0x34')]);return db['FaxMessage'][_0xb3f7('0x15')]({'where':_0x4b5f9d[_0xb3f7('0x44')]})[_0xb3f7('0x19')](function(_0x28da16){_0x4007fe[_0xb3f7('0x15')]=_0x28da16;if(_0x3f886a[_0xb3f7('0x26')][_0xb3f7('0x31')]){_0x4b5f9d[_0xb3f7('0x32')]=[{'all':!![]}];}return db[_0xb3f7('0x3b')]['findAll'](_0x4b5f9d);})[_0xb3f7('0x19')](function(_0x167685){_0x4007fe['rows']=_0x167685;return _0x4007fe;});}})[_0xb3f7('0x19')](respondWithFilteredResult(_0x369ba6,_0x4b5f9d))['catch'](handleError(_0x369ba6,null));};exports[_0xb3f7('0x49')]=function(_0x15d81a,_0x454162){return db[_0xb3f7('0x20')]['find']({'where':{'id':_0x15d81a[_0xb3f7('0x29')]['id']}})[_0xb3f7('0x19')](handleEntityNotFound(_0x454162,null))[_0xb3f7('0x19')](function(_0xb4a20b){if(_0xb4a20b){return _0xb4a20b[_0xb3f7('0x4a')](_0x15d81a[_0xb3f7('0x37')][_0xb3f7('0x3c')],_[_0xb3f7('0x4b')](_0x15d81a[_0xb3f7('0x37')],[_0xb3f7('0x3c'),'id'])||{})[_0xb3f7('0x4c')](function(){return db[_0xb3f7('0x4d')]['findAll']({'attributes':['id',_0xb3f7('0x1d'),_0xb3f7('0x4e')],'where':{'id':_0x15d81a['body'][_0xb3f7('0x3c')]}});})[_0xb3f7('0x19')](function(_0x11e96d){socket[_0xb3f7('0x4f')](_0xb3f7('0x50'),{'id':Number(_0x15d81a[_0xb3f7('0x29')]['id']),'tags':_0x11e96d||[]});return{'id':Number(_0x15d81a[_0xb3f7('0x29')]['id']),'tags':_0x11e96d||[]};});}})[_0xb3f7('0x19')](respondWithResult(_0x454162,null))[_0xb3f7('0x27')](handleError(_0x454162,null));};exports[_0xb3f7('0x51')]=function(_0x11559e,_0x4162e3){return db['FaxInteraction'][_0xb3f7('0x35')]({'where':{'id':_0x11559e[_0xb3f7('0x29')]['id']}})[_0xb3f7('0x19')](handleEntityNotFound(_0x4162e3,null))[_0xb3f7('0x19')](function(_0xe83cd2){if(_0xe83cd2){return _0xe83cd2[_0xb3f7('0x51')](_0x11559e['query']['ids']);}})[_0xb3f7('0x19')](respondWithStatusCode(_0x4162e3,null))[_0xb3f7('0x27')](handleError(_0x4162e3,null));};exports[_0xb3f7('0x52')]=function(_0x2aabcc,_0x196e55){var _0x481b34=moment()[_0xb3f7('0x53')]()[_0xb3f7('0x54')]();var _0x56b4b3=path[_0xb3f7('0x55')](config['root'],_0xb3f7('0x56'),_0xb3f7('0x57'),'tmp');var _0x108663=path['join'](config[_0xb3f7('0x58')],'server',_0xb3f7('0x57'),'attachments');var _0x22853b=path[_0xb3f7('0x55')](_0x56b4b3,_0x481b34);var _0x14620a=util[_0xb3f7('0x47')]('transcript-%d-%s.zip',_0x2aabcc[_0xb3f7('0x29')]['id'],_0x481b34);var _0x4a1e53=path['join'](_0x56b4b3,_0x14620a);var _0x6c80e7=[];_0x6c80e7[_0xb3f7('0x59')]({'model':db[_0xb3f7('0x5a')],'as':_0xb3f7('0x5a'),'raw':!![]});var _0x2c1313=[{'model':db['FaxMessage'],'as':_0xb3f7('0x5b'),'attributes':['id',_0xb3f7('0x37'),_0xb3f7('0x5c')],'include':_0x6c80e7}];return db[_0xb3f7('0x20')][_0xb3f7('0x35')]({'where':{'id':_0x2aabcc[_0xb3f7('0x29')]['id']},'include':_0x2c1313})[_0xb3f7('0x19')](handleEntityNotFound(_0x196e55,null))['then'](function(_0x48301e){if(_0x48301e&&_0x48301e[_0xb3f7('0x5b')]){var _0x207b06=_0x48301e['get']({'plain':!![]});fs[_0xb3f7('0x5d')](_0x22853b);for(var _0x4b4f05=0x0;_0x4b4f05<_0x207b06[_0xb3f7('0x5b')][_0xb3f7('0x30')];_0x4b4f05++){var _0x3fee61=_0x207b06[_0xb3f7('0x5b')][_0x4b4f05][_0xb3f7('0x5a')];if(_0x3fee61){var _0x58051e=path['join'](_0x108663,_0x3fee61[_0xb3f7('0x5e')]);if(fs[_0xb3f7('0x5f')](_0x58051e)){fs[_0xb3f7('0x60')](_0x58051e)[_0xb3f7('0x61')](fs[_0xb3f7('0x62')](path[_0xb3f7('0x55')](_0x22853b,_0x3fee61[_0xb3f7('0x5e')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x4f5d5f,_0x56016a){zipdir(_0x22853b,{'saveTo':_0x4a1e53},function(_0x382265,_0x31998a){if(_0x382265)return _0x56016a(_0x382265);return _0x4f5d5f(_0x31998a);});})[_0xb3f7('0x19')](function(){return new BPromise(function(_0x5f1feb,_0x15873b){rimraf(_0x22853b,function(_0x1e5e4e){if(_0x1e5e4e)_0x15873b(_0x1e5e4e);return _0x5f1feb();});});})[_0xb3f7('0x19')](function(){return _0x196e55[_0xb3f7('0x52')](_0x4a1e53,_0x14620a,function(_0x2037ae){if(_0x2037ae){console[_0xb3f7('0x63')](_0xb3f7('0x64'),_0x2037ae);}else{fs[_0xb3f7('0x65')](_0x4a1e53);}});});});}else{return _0x196e55['sendStatus'](0xc8);}})['catch'](handleError(_0x196e55,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c756e55..c5698d8 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 _0x20c3=['unreadMessages','length','emit','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x4af0fc,_0x442dc4){var _0x44928c=function(_0x4ef937){while(--_0x4ef937){_0x4af0fc['push'](_0x4af0fc['shift']());}};_0x44928c(++_0x442dc4);}(_0x20c3,0x137));var _0x320c=function(_0x12c777,_0x5dfefb){_0x12c777=_0x12c777-0x0;var _0x38855f=_0x20c3[_0x12c777];return _0x38855f;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x320c('0x0'))['db'][_0x320c('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x320c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x320c('0x3'),'afterUpdate':_0x320c('0x4'),'afterDestroy':_0x320c('0x5')};function emitEvent(_0x4dc889){return function(_0xcc93d8,_0x726586,_0x24a66d){_0xcc93d8[_0x320c('0x6')]({'attributes':['id'],'raw':!![]})[_0x320c('0x7')](function(_0x1702d2){_0xcc93d8[_0x320c('0x8')](_0x320c('0x9'),_0x1702d2[_0x320c('0xa')](function(_0x5bd3b8){return{'id':_0x5bd3b8['id']};}));return FaxMessage[_0x320c('0xb')]({'where':{'FaxInteractionId':_0xcc93d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x320c('0x7')](function(_0x1db9a8){_0xcc93d8[_0x320c('0x8')](_0x320c('0xc'),_0x1db9a8[_0x320c('0xd')]);FaxInteractionEvents[_0x320c('0xe')](_0x4dc889+':'+_0xcc93d8['id'],_0xcc93d8);FaxInteractionEvents[_0x320c('0xe')](_0x4dc889,_0xcc93d8);_0x24a66d(null);})['catch'](_0x24a66d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x320c('0xf')](e,emitEvent(event));}}module[_0x320c('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x43e9=['update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','FaxInteraction','../../mysqldb','setMaxListeners','save'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x43e9,0x12c));var _0x943e=function(_0x5d351e,_0x55fbc2){_0x5d351e=_0x5d351e-0x0;var _0x2b4807=_0x43e9[_0x5d351e];return _0x2b4807;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x943e('0x0')];var FaxMessage=require(_0x943e('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x943e('0x2')](0x0);var events={'afterCreate':_0x943e('0x3'),'afterUpdate':_0x943e('0x4'),'afterDestroy':_0x943e('0x5')};function emitEvent(_0x39714b){return function(_0x2d419c,_0x36f084,_0xd57a76){_0x2d419c[_0x943e('0x6')]({'attributes':['id'],'raw':!![]})[_0x943e('0x7')](function(_0x3f4418){_0x2d419c['setDataValue'](_0x943e('0x8'),_0x3f4418['map'](function(_0x5cfdd8){return{'id':_0x5cfdd8['id']};}));return FaxMessage[_0x943e('0x9')]({'where':{'FaxInteractionId':_0x2d419c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x16622d){_0x2d419c[_0x943e('0xa')](_0x943e('0xb'),_0x16622d[_0x943e('0xc')]);FaxInteractionEvents[_0x943e('0xd')](_0x39714b+':'+_0x2d419c['id'],_0x2d419c);FaxInteractionEvents[_0x943e('0xd')](_0x39714b,_0x2d419c);_0xd57a76(null);})['catch'](_0xd57a76(null));};}for(var e in events){if(events[_0x943e('0xe')](e)){var event=events[e];FaxInteraction[_0x943e('0xf')](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 b6b396b..8b9417e 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 _0x2c49=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','FaxInteraction','fax_interactions','closed','closedAt','format'];(function(_0x39c999,_0x1968b8){var _0x2044f=function(_0x5dc77b){while(--_0x5dc77b){_0x39c999['push'](_0x39c999['shift']());}};_0x2044f(++_0x1968b8);}(_0x2c49,0xc3));var _0x92c4=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x2c49[_0x5db99b];return _0x4b2d0e;};'use strict';var _=require(_0x92c4('0x0'));var util=require(_0x92c4('0x1'));var logger=require(_0x92c4('0x2'))(_0x92c4('0x3'));var moment=require(_0x92c4('0x4'));var BPromise=require('bluebird');var rp=require(_0x92c4('0x5'));var fs=require('fs');var path=require(_0x92c4('0x6'));var rimraf=require('rimraf');var config=require(_0x92c4('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x92c4('0x8')]=function(_0x2ec56a,_0x356a2e){return _0x2ec56a[_0x92c4('0x9')](_0x92c4('0xa'),attributes,{'tableName':_0x92c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1de6b9,_0x171906,_0x58c098){if(_0x1de6b9['changed'](_0x92c4('0xc'))){_0x1de6b9[_0x92c4('0xd')]=moment()[_0x92c4('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x58c098(null,_0x1de6b9);}}});}; \ No newline at end of file +var _0xdadc=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','fax_interactions','changed','closed','closedAt'];(function(_0x2c8448,_0x28ae68){var _0x385b3a=function(_0x24bd91){while(--_0x24bd91){_0x2c8448['push'](_0x2c8448['shift']());}};_0x385b3a(++_0x28ae68);}(_0xdadc,0x75));var _0xcdad=function(_0x3f8e04,_0x13ccdc){_0x3f8e04=_0x3f8e04-0x0;var _0x590069=_0xdadc[_0x3f8e04];return _0x590069;};'use strict';var _=require(_0xcdad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcdad('0x1'));var moment=require(_0xcdad('0x2'));var BPromise=require(_0xcdad('0x3'));var rp=require(_0xcdad('0x4'));var fs=require('fs');var path=require(_0xcdad('0x5'));var rimraf=require(_0xcdad('0x6'));var config=require(_0xcdad('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xcdad('0x8')]=function(_0xd065c2,_0x84e574){return _0xd065c2['define']('FaxInteraction',attributes,{'tableName':_0xcdad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12f7f7,_0x1e5607,_0x558169){if(_0x12f7f7[_0xcdad('0xa')](_0xcdad('0xb'))){_0x12f7f7[_0xcdad('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x558169(null,_0x12f7f7);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0d261e8..fc87699 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 _0x9746=['moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','limit','stringify','AddTagsToFaxInteraction','find','ids','spread','AddTags','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9746,0x74));var _0x6974=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x9746[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0x6974('0x0'));var moment=require(_0x6974('0x1'));var BPromise=require(_0x6974('0x2'));var rs=require(_0x6974('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6974('0x4'))(_0x6974('0x5'));var config=require(_0x6974('0x6'));var jayson=require(_0x6974('0x7'));var client=jayson[_0x6974('0x8')]['http']({'port':0x232a});config[_0x6974('0x9')]=_['defaults'](config[_0x6974('0x9')],{'host':_0x6974('0xa'),'port':0x18eb});var socket=require(_0x6974('0xb'))(new Redis(config['redis']));require(_0x6974('0xc'))[_0x6974('0xd')](socket);function respondWithRpcPromise(_0x5b7992,_0x28b9cb,_0x3010eb){return new BPromise(function(_0x226fd3,_0x4fc313){return client[_0x6974('0xe')](_0x5b7992,_0x3010eb)[_0x6974('0xf')](function(_0x270c9e){logger[_0x6974('0x10')](_0x6974('0x11'),_0x28b9cb,'request\x20sent');logger[_0x6974('0x12')](_0x6974('0x13'),_0x28b9cb,'request\x20sent',JSON['stringify'](_0x270c9e));if(_0x270c9e['error']){if(_0x270c9e[_0x6974('0x14')][_0x6974('0x15')]===0x1f4){logger[_0x6974('0x14')](_0x6974('0x11'),_0x28b9cb,_0x270c9e['error']['message']);return _0x4fc313(_0x270c9e[_0x6974('0x14')][_0x6974('0x16')]);}logger['error'](_0x6974('0x11'),_0x28b9cb,_0x270c9e[_0x6974('0x14')]['message']);return _0x226fd3(_0x270c9e['error'][_0x6974('0x16')]);}else{logger[_0x6974('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x28b9cb,_0x6974('0x17'));_0x226fd3(_0x270c9e[_0x6974('0x18')][_0x6974('0x16')]);}})[_0x6974('0x19')](function(_0x494b62){logger[_0x6974('0x14')](_0x6974('0x11'),_0x28b9cb,_0x494b62);_0x4fc313(_0x494b62);});});}exports[_0x6974('0x1a')]=function(_0x2eea0e){var _0x4fdd7c=this;return new Promise(function(_0x3c65fe,_0x5f0a51){return db[_0x6974('0x1b')]['update'](_0x2eea0e[_0x6974('0x1c')],{'raw':_0x2eea0e[_0x6974('0x1d')]?_0x2eea0e[_0x6974('0x1d')][_0x6974('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eea0e[_0x6974('0x1d')]?_0x2eea0e[_0x6974('0x1d')][_0x6974('0x1f')]||null:null,'attributes':_0x2eea0e[_0x6974('0x1d')]?_0x2eea0e['options']['attributes']||null:null,'limit':_0x2eea0e['options']?_0x2eea0e[_0x6974('0x1d')][_0x6974('0x20')]||null:null})[_0x6974('0xf')](function(_0x97eec){logger[_0x6974('0x10')](_0x6974('0x1a'),_0x2eea0e);logger['debug']('UpdateFaxInteraction',_0x2eea0e,JSON[_0x6974('0x21')](_0x97eec));_0x3c65fe(_0x97eec);})[_0x6974('0x19')](function(_0x172363){logger['error'](_0x6974('0x1a'),_0x172363[_0x6974('0x16')],_0x2eea0e);_0x5f0a51(_0x4fdd7c[_0x6974('0x14')](0x1f4,_0x172363['message']));});});};exports[_0x6974('0x22')]=function(_0x418133){return new Promise(function(_0x365819,_0xf0b84){return db['FaxInteraction'][_0x6974('0x23')]({'where':_0x418133[_0x6974('0x1d')]?_0x418133[_0x6974('0x1d')][_0x6974('0x1f')]||null:null})[_0x6974('0xf')](function(_0x41ff3e){if(_0x41ff3e){return _0x41ff3e['addTags'](_0x418133[_0x6974('0x1c')][_0x6974('0x24')],_['omit'](_0x418133[_0x6974('0x1c')],[_0x6974('0x24'),'id'])||{});}})[_0x6974('0x25')](function(_0x10fafe){logger[_0x6974('0x10')](_0x6974('0x26'),_0x418133);logger['debug'](_0x6974('0x26'),_0x418133,JSON[_0x6974('0x21')](_0x10fafe));_0x365819(_0x10fafe);})[_0x6974('0x19')](function(_0x94c88d){logger[_0x6974('0x14')]('AddTags',_0x94c88d[_0x6974('0x16')],_0x418133);_0xf0b84(_this[_0x6974('0x14')](0x1f4,_0x94c88d[_0x6974('0x16')]));});});}; \ No newline at end of file +var _0xbba2=['client','redis','localhost','socket.io-emitter','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','AddTagsToFaxInteraction','where','then','addTags','ids','omit','spread','AddTags','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c22a2,_0x26682a){var _0x40bc1d=function(_0x1099c0){while(--_0x1099c0){_0x1c22a2['push'](_0x1c22a2['shift']());}};_0x40bc1d(++_0x26682a);}(_0xbba2,0x99));var _0x2bba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2bba('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bba('0x1'))['db'];var utils=require(_0x2bba('0x2'));var logger=require(_0x2bba('0x3'))(_0x2bba('0x4'));var config=require(_0x2bba('0x5'));var jayson=require(_0x2bba('0x6'));var client=jayson[_0x2bba('0x7')]['http']({'port':0x232a});config[_0x2bba('0x8')]=_['defaults'](config[_0x2bba('0x8')],{'host':_0x2bba('0x9'),'port':0x18eb});var socket=require(_0x2bba('0xa'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x2bba('0xb')](socket);function respondWithRpcPromise(_0x370a31,_0x542ff1,_0x835048){return new BPromise(function(_0x4e8574,_0x444777){return client[_0x2bba('0xc')](_0x370a31,_0x835048)['then'](function(_0x2c546f){logger[_0x2bba('0xd')](_0x2bba('0xe'),_0x542ff1,_0x2bba('0xf'));logger[_0x2bba('0x10')](_0x2bba('0x11'),_0x542ff1,_0x2bba('0xf'),JSON[_0x2bba('0x12')](_0x2c546f));if(_0x2c546f[_0x2bba('0x13')]){if(_0x2c546f[_0x2bba('0x13')][_0x2bba('0x14')]===0x1f4){logger[_0x2bba('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x542ff1,_0x2c546f[_0x2bba('0x13')]['message']);return _0x444777(_0x2c546f[_0x2bba('0x13')][_0x2bba('0x15')]);}logger[_0x2bba('0x13')](_0x2bba('0xe'),_0x542ff1,_0x2c546f[_0x2bba('0x13')][_0x2bba('0x15')]);return _0x4e8574(_0x2c546f[_0x2bba('0x13')]['message']);}else{logger['info'](_0x2bba('0xe'),_0x542ff1,_0x2bba('0xf'));_0x4e8574(_0x2c546f[_0x2bba('0x16')][_0x2bba('0x15')]);}})[_0x2bba('0x17')](function(_0x43af76){logger[_0x2bba('0x13')](_0x2bba('0xe'),_0x542ff1,_0x43af76);_0x444777(_0x43af76);});});}exports[_0x2bba('0x18')]=function(_0x152db2){var _0x27fc0c=this;return new Promise(function(_0x422e63,_0x4829a2){return db[_0x2bba('0x19')][_0x2bba('0x1a')](_0x152db2[_0x2bba('0x1b')],{'raw':_0x152db2[_0x2bba('0x1c')]?_0x152db2[_0x2bba('0x1c')][_0x2bba('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152db2['options']?_0x152db2[_0x2bba('0x1c')]['where']||null:null,'attributes':_0x152db2[_0x2bba('0x1c')]?_0x152db2[_0x2bba('0x1c')][_0x2bba('0x1e')]||null:null,'limit':_0x152db2[_0x2bba('0x1c')]?_0x152db2[_0x2bba('0x1c')][_0x2bba('0x1f')]||null:null})['then'](function(_0x1dc61f){logger[_0x2bba('0xd')](_0x2bba('0x18'),_0x152db2);logger[_0x2bba('0x10')](_0x2bba('0x18'),_0x152db2,JSON[_0x2bba('0x12')](_0x1dc61f));_0x422e63(_0x1dc61f);})[_0x2bba('0x17')](function(_0x307c49){logger[_0x2bba('0x13')](_0x2bba('0x18'),_0x307c49['message'],_0x152db2);_0x4829a2(_0x27fc0c[_0x2bba('0x13')](0x1f4,_0x307c49[_0x2bba('0x15')]));});});};exports[_0x2bba('0x20')]=function(_0xbe9b24){return new Promise(function(_0x6f3dc2,_0x513089){return db[_0x2bba('0x19')]['find']({'where':_0xbe9b24[_0x2bba('0x1c')]?_0xbe9b24['options'][_0x2bba('0x21')]||null:null})[_0x2bba('0x22')](function(_0x266178){if(_0x266178){return _0x266178[_0x2bba('0x23')](_0xbe9b24[_0x2bba('0x1b')][_0x2bba('0x24')],_[_0x2bba('0x25')](_0xbe9b24[_0x2bba('0x1b')],[_0x2bba('0x24'),'id'])||{});}})[_0x2bba('0x26')](function(_0x421c7c){logger['info'](_0x2bba('0x27'),_0xbe9b24);logger[_0x2bba('0x10')](_0x2bba('0x27'),_0xbe9b24,JSON[_0x2bba('0x12')](_0x421c7c));_0x6f3dc2(_0x421c7c);})['catch'](function(_0x5143fe){logger[_0x2bba('0x13')](_0x2bba('0x27'),_0x5143fe[_0x2bba('0x15')],_0xbe9b24);_0x513089(_this['error'](0x1f4,_0x5143fe[_0x2bba('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index a1d98ef..58b8989 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 _0x4047=['register','length','faxInteraction:','save','remove','update','emit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4047,0xe3));var _0x7404=function(_0x4c407d,_0x185b57){_0x4c407d=_0x4c407d-0x0;var _0xe3ca25=_0x4047[_0x4c407d];return _0xe3ca25;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x7404('0x0'),_0x7404('0x1'),_0x7404('0x2')];function createListener(_0x4ce713,_0x2c4024){return function(_0x5a7744){_0x2c4024[_0x7404('0x3')](_0x4ce713,_0x5a7744);};}function removeListener(_0x369034,_0x59849){return function(){FaxInteractionEvents['removeListener'](_0x369034,_0x59849);};}exports[_0x7404('0x4')]=function(_0xf4ff3e){for(var _0x8fc8ef=0x0,_0x35539b=events[_0x7404('0x5')];_0x8fc8ef<_0x35539b;_0x8fc8ef++){var _0x52360c=events[_0x8fc8ef];var _0x34d170=createListener(_0x7404('0x6')+_0x52360c,_0xf4ff3e);FaxInteractionEvents['on'](_0x52360c,_0x34d170);}}; \ No newline at end of file +var _0xe112=['./faxInteraction.events','remove','emit','length'];(function(_0x34c2f0,_0x592a1a){var _0x107bf1=function(_0xb9eeab){while(--_0xb9eeab){_0x34c2f0['push'](_0x34c2f0['shift']());}};_0x107bf1(++_0x592a1a);}(_0xe112,0x17c));var _0x2e11=function(_0xa100ab,_0x10553e){_0xa100ab=_0xa100ab-0x0;var _0x302ba0=_0xe112[_0xa100ab];return _0x302ba0;};'use strict';var FaxInteractionEvents=require(_0x2e11('0x0'));var events=['save',_0x2e11('0x1'),'update'];function createListener(_0x5b3924,_0x277a09){return function(_0x56dc25){_0x277a09[_0x2e11('0x2')](_0x5b3924,_0x56dc25);};}function removeListener(_0x5e1870,_0x40372c){return function(){FaxInteractionEvents['removeListener'](_0x5e1870,_0x40372c);};}exports['register']=function(_0x16bcb4){for(var _0x2027d5=0x0,_0x2fe3dd=events[_0x2e11('0x3')];_0x2027d5<_0x2fe3dd;_0x2027d5++){var _0x4318a2=events[_0x2027d5];var _0x360672=createListener('faxInteraction:'+_0x4318a2,_0x16bcb4);FaxInteractionEvents['on'](_0x4318a2,_0x360672);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9d3be6c..663aa6d 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 _0xf23b=['faxinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','fax','put','faxinteraction:update','update'];(function(_0x362000,_0x463b23){var _0x38510d=function(_0x5a8319){while(--_0x5a8319){_0x362000['push'](_0x362000['shift']());}};_0x38510d(++_0x463b23);}(_0xf23b,0x1d6));var _0xbf23=function(_0x20eebf,_0xed0412){_0x20eebf=_0x20eebf-0x0;var _0x561a5c=_0xf23b[_0x20eebf];return _0x561a5c;};'use strict';var multer=require('multer');var util=require(_0xbf23('0x0'));var path=require(_0xbf23('0x1'));var timeout=require(_0xbf23('0x2'));var express=require(_0xbf23('0x3'));var router=express[_0xbf23('0x4')]();var fs_extra=require(_0xbf23('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf23('0x6'));var controller=require('./faxInteraction.controller');router[_0xbf23('0x7')]('/',auth[_0xbf23('0x8')](),controller[_0xbf23('0x9')]);router[_0xbf23('0x7')](_0xbf23('0xa'),auth[_0xbf23('0x8')](),controller['describe']);router[_0xbf23('0x7')](_0xbf23('0xb'),auth[_0xbf23('0x8')](),controller['show']);router[_0xbf23('0x7')](_0xbf23('0xc'),auth[_0xbf23('0x8')](),controller[_0xbf23('0xd')]);router[_0xbf23('0x7')]('/:id/download',auth[_0xbf23('0x8')](),controller[_0xbf23('0xe')]);router['post']('/',auth[_0xbf23('0x8')](),controller[_0xbf23('0xf')]);router[_0xbf23('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbf23('0x11')]);router[_0xbf23('0x10')](_0xbf23('0x12'),auth[_0xbf23('0x8')](),interaction[_0xbf23('0x13')](_0xbf23('0x14'),'faxinteraction:addtags'),controller['addTags']);router[_0xbf23('0x15')](_0xbf23('0xb'),auth[_0xbf23('0x8')](),interaction[_0xbf23('0x13')](_0xbf23('0x14'),_0xbf23('0x16')),controller[_0xbf23('0x17')]);router['delete'](_0xbf23('0xb'),auth[_0xbf23('0x8')](),interaction[_0xbf23('0x13')](_0xbf23('0x14'),_0xbf23('0x18')),controller['destroy']);router['delete'](_0xbf23('0x12'),auth['isAuthenticated'](),controller[_0xbf23('0x19')]);module['exports']=router; \ No newline at end of file +var _0x69a0=['/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage'];(function(_0x1690f2,_0x1497a2){var _0x1f806b=function(_0x12e9fb){while(--_0x12e9fb){_0x1690f2['push'](_0x1690f2['shift']());}};_0x1f806b(++_0x1497a2);}(_0x69a0,0x119));var _0x069a=function(_0x1f825c,_0x1c736d){_0x1f825c=_0x1f825c-0x0;var _0x968ffe=_0x69a0[_0x1f825c];return _0x968ffe;};'use strict';var multer=require(_0x069a('0x0'));var util=require(_0x069a('0x1'));var path=require(_0x069a('0x2'));var timeout=require(_0x069a('0x3'));var express=require(_0x069a('0x4'));var router=express['Router']();var fs_extra=require(_0x069a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x069a('0x6'));var controller=require('./faxInteraction.controller');router[_0x069a('0x7')]('/',auth[_0x069a('0x8')](),controller['index']);router[_0x069a('0x7')](_0x069a('0x9'),auth[_0x069a('0x8')](),controller[_0x069a('0xa')]);router['get'](_0x069a('0xb'),auth[_0x069a('0x8')](),controller[_0x069a('0xc')]);router['get'](_0x069a('0xd'),auth[_0x069a('0x8')](),controller[_0x069a('0xe')]);router[_0x069a('0x7')](_0x069a('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x069a('0x10')]('/',auth[_0x069a('0x8')](),controller[_0x069a('0x11')]);router[_0x069a('0x10')](_0x069a('0xd'),auth[_0x069a('0x8')](),controller[_0x069a('0x12')]);router['post'](_0x069a('0x13'),auth[_0x069a('0x8')](),interaction[_0x069a('0x14')](_0x069a('0x15'),_0x069a('0x16')),controller[_0x069a('0x17')]);router[_0x069a('0x18')]('/:id',auth[_0x069a('0x8')](),interaction[_0x069a('0x14')](_0x069a('0x15'),'faxinteraction:update'),controller[_0x069a('0x19')]);router[_0x069a('0x1a')](_0x069a('0xb'),auth[_0x069a('0x8')](),interaction[_0x069a('0x14')]('fax',_0x069a('0x1b')),controller['destroy']);router[_0x069a('0x1a')]('/:id/tags',auth[_0x069a('0x8')](),controller[_0x069a('0x1c')]);module[_0x069a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0c8811a..f62fc1e 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 _0xb7cf=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0xb7cf,0xca));var _0xfb7c=function(_0x26c643,_0x2c784a){_0x26c643=_0x26c643-0x0;var _0xb49398=_0xb7cf[_0x26c643];return _0xb49398;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'body':{'type':Sequelize[_0xfb7c('0x2')](_0xfb7c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfb7c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfb7c('0x5')),'defaultValue':_0xfb7c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfb7c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfb7c('0x6')]}}; \ No newline at end of file +var _0xd2ea=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2a1349,_0x50602d){_0x2a1349=_0x2a1349-0x0;var _0x2dd607=_0xd2ea[_0x2a1349];return _0x2dd607;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'body':{'type':Sequelize[_0xad2e('0x2')](_0xad2e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xad2e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad2e('0x5')),'defaultValue':_0xad2e('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xad2e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xad2e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 97f5199..a7795ae 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 _0xc235=['../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','fax-interactions','request','info','request\x20sent','error','FaxMessage,\x20%s,\x20%s','message','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','then','end','sendStatus','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','find','body','params','describe','accept','acceptMessage','fax','UserId','user','agent','FaxInteraction','interaction','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','sequelize','contact','email','internal','interface','format','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','basename','root','server','files','attachments','download','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc235,0xcf));var _0x5c23=function(_0x151188,_0x2e00b5){_0x151188=_0x151188-0x0;var _0xf86c2b=_0xc235[_0x151188];return _0xf86c2b;};'use strict';var util=require(_0x5c23('0x0'));var path=require(_0x5c23('0x1'));var _=require('lodash');var Redis=require(_0x5c23('0x2'));var interactionService=require(_0x5c23('0x3'));var qs=require(_0x5c23('0x4'));var logger=require(_0x5c23('0x5'))('api');var config=require(_0x5c23('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5c23('0x7')](config[_0x5c23('0x8')],{'host':_0x5c23('0x9'),'port':0x18eb});var socket=require(_0x5c23('0xa'))(new Redis(config[_0x5c23('0x8')]));require(_0x5c23('0xb'))[_0x5c23('0xc')](socket);var jayson=require(_0x5c23('0xd'));var client=jayson['client'][_0x5c23('0xe')]({'port':0x232c});var client9002=jayson['client'][_0x5c23('0xe')]({'port':0x232a});var interaction_log=require(_0x5c23('0x5'))(_0x5c23('0xf'));function respondWithRpcPromise(_0x10af18,_0x2c0466,_0x10b953,_0x10e85b){return new Promise(function(_0x55a832,_0x208c38){var _0x51acaf=_0x10e85b||client;return _0x51acaf[_0x5c23('0x10')](_0x10af18,_0x10b953)['then'](function(_0x4381be){logger[_0x5c23('0x11')]('FaxMessage,\x20%s,\x20%s',_0x2c0466,_0x5c23('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2c0466,'request\x20sent',JSON['stringify'](_0x4381be));if(_0x4381be[_0x5c23('0x13')]){if(_0x4381be[_0x5c23('0x13')]['code']===0x1f4){logger['error'](_0x5c23('0x14'),_0x2c0466,_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);return _0x208c38(_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x2c0466,_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);return _0x55a832(_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);}else{logger[_0x5c23('0x11')](_0x5c23('0x14'),_0x2c0466,_0x5c23('0x12'));_0x55a832(_0x4381be['result']['message']);}})[_0x5c23('0x16')](function(_0x183120){logger['error'](_0x5c23('0x14'),_0x2c0466,_0x183120);_0x208c38(_0x183120);});});}function respondWithResult(_0x1d61f3,_0x1b87c6){_0x1b87c6=_0x1b87c6||0xc8;return function(_0x1f5fd3){if(_0x1f5fd3){return _0x1d61f3['status'](_0x1b87c6)[_0x5c23('0x17')](_0x1f5fd3);}};}function respondWithFilteredResult(_0x24cffc,_0x55a7ed){return function(_0x1b7b7c){if(_0x1b7b7c){var _0x12d53c=typeof _0x55a7ed[_0x5c23('0x18')]===_0x5c23('0x19')&&typeof _0x55a7ed[_0x5c23('0x1a')]==='undefined';var _0x2ef657=_0x1b7b7c['count'];var _0x3abcc3=_0x12d53c?0x0:_0x55a7ed[_0x5c23('0x18')];var _0x390618=_0x12d53c?_0x1b7b7c[_0x5c23('0x1b')]:_0x55a7ed[_0x5c23('0x18')]+_0x55a7ed[_0x5c23('0x1a')];var _0x291263;if(_0x390618>=_0x2ef657){_0x390618=_0x2ef657;_0x291263=0xc8;}else{_0x291263=0xce;}_0x24cffc[_0x5c23('0x1c')](_0x291263);return _0x24cffc[_0x5c23('0x1d')](_0x5c23('0x1e'),_0x3abcc3+'-'+_0x390618+'/'+_0x2ef657)[_0x5c23('0x17')](_0x1b7b7c);}return null;};}function saveUpdates(_0xf32d9d){return function(_0x4a3021){if(_0x4a3021){return _0x4a3021[_0x5c23('0x1f')](_0xf32d9d)[_0x5c23('0x20')](function(_0x10770e){return _0x10770e;});}return null;};}function removeEntity(_0x45d9c5){return function(_0x542be8){if(_0x542be8){return _0x542be8['destroy']()['then'](function(){_0x45d9c5[_0x5c23('0x1c')](0xcc)[_0x5c23('0x21')]();});}};}function handleEntityNotFound(_0x46c4ff){return function(_0x2b7d8b){if(!_0x2b7d8b){_0x46c4ff[_0x5c23('0x22')](0x194);}return _0x2b7d8b;};}function handleError(_0x1057ce,_0x4049dd){_0x4049dd=_0x4049dd||0x1f4;return function(_0x535781){logger[_0x5c23('0x13')](_0x535781['stack']);if(_0x535781[_0x5c23('0x23')]){delete _0x535781['name'];}_0x1057ce[_0x5c23('0x1c')](_0x4049dd)['send'](_0x535781);};}exports[_0x5c23('0x24')]=function(_0x3953ef,_0x376169){var _0x46aba1={},_0x3d7856={},_0x23a706={'count':0x0,'rows':[]};var _0x49a0b7=_[_0x5c23('0x25')](db['FaxMessage'][_0x5c23('0x26')],function(_0x21a855){return{'name':_0x21a855[_0x5c23('0x27')],'type':_0x21a855[_0x5c23('0x28')][_0x5c23('0x29')]};});_0x3d7856[_0x5c23('0x2a')]=_[_0x5c23('0x25')](_0x49a0b7,_0x5c23('0x23'));_0x3d7856[_0x5c23('0x2b')]=_[_0x5c23('0x2c')](_0x3953ef[_0x5c23('0x2b')]);_0x3d7856[_0x5c23('0x2d')]=_[_0x5c23('0x2e')](_0x3d7856[_0x5c23('0x2a')],_0x3d7856['query']);_0x46aba1[_0x5c23('0x2f')]=_['intersection'](_0x3d7856[_0x5c23('0x2a')],qs[_0x5c23('0x30')](_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x30')]));_0x46aba1['attributes']=_0x46aba1[_0x5c23('0x2f')][_0x5c23('0x31')]?_0x46aba1[_0x5c23('0x2f')]:_0x3d7856[_0x5c23('0x2a')];if(!_0x3953ef['query'][_0x5c23('0x32')]('nolimit')){_0x46aba1['limit']=qs[_0x5c23('0x1a')](_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x1a')]);_0x46aba1[_0x5c23('0x18')]=qs[_0x5c23('0x18')](_0x3953ef['query'][_0x5c23('0x18')]);}_0x46aba1[_0x5c23('0x33')]=qs[_0x5c23('0x34')](_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x34')]);_0x46aba1[_0x5c23('0x35')]=qs[_0x5c23('0x2d')](_[_0x5c23('0x36')](_0x3953ef[_0x5c23('0x2b')],_0x3d7856[_0x5c23('0x2d')]),_0x49a0b7);if(_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x37')]){_0x46aba1[_0x5c23('0x35')]=_[_0x5c23('0x38')](_0x46aba1[_0x5c23('0x35')],{'$or':_[_0x5c23('0x25')](_0x49a0b7,function(_0x1c72a6){if(_0x1c72a6[_0x5c23('0x28')]!==_0x5c23('0x39')){var _0x10c0ad={};_0x10c0ad[_0x1c72a6[_0x5c23('0x23')]]={'$like':'%'+_0x3953ef[_0x5c23('0x2b')]['filter']+'%'};return _0x10c0ad;}})});}_0x46aba1=_[_0x5c23('0x38')]({},_0x46aba1,_0x3953ef[_0x5c23('0x3a')]);var _0x28f94a={'where':_0x46aba1[_0x5c23('0x35')]};return db[_0x5c23('0x3b')][_0x5c23('0x1b')](_0x28f94a)[_0x5c23('0x20')](function(_0x193438){_0x23a706[_0x5c23('0x1b')]=_0x193438;if(_0x3953ef['query'][_0x5c23('0x3c')]){_0x46aba1[_0x5c23('0x3d')]=[{'all':!![]}];}return db[_0x5c23('0x3b')]['findAll'](_0x46aba1);})[_0x5c23('0x20')](function(_0x19f2b3){_0x23a706['rows']=_0x19f2b3;return _0x23a706;})['then'](respondWithFilteredResult(_0x376169,_0x46aba1))[_0x5c23('0x16')](handleError(_0x376169,null));};exports['show']=function(_0x5875d9,_0x358a2d){var _0x2363bb={'raw':!![],'where':{'id':_0x5875d9['params']['id']}},_0x355225={};_0x355225[_0x5c23('0x2a')]=_[_0x5c23('0x2c')](db[_0x5c23('0x3b')]['rawAttributes']);_0x355225['query']=_[_0x5c23('0x2c')](_0x5875d9[_0x5c23('0x2b')]);_0x355225[_0x5c23('0x2d')]=_[_0x5c23('0x2e')](_0x355225[_0x5c23('0x2a')],_0x355225[_0x5c23('0x2b')]);_0x2363bb['attributes']=_[_0x5c23('0x2e')](_0x355225[_0x5c23('0x2a')],qs[_0x5c23('0x30')](_0x5875d9['query'][_0x5c23('0x30')]));_0x2363bb[_0x5c23('0x2f')]=_0x2363bb['attributes'][_0x5c23('0x31')]?_0x2363bb[_0x5c23('0x2f')]:_0x355225[_0x5c23('0x2a')];if(_0x5875d9[_0x5c23('0x2b')][_0x5c23('0x3c')]){_0x2363bb[_0x5c23('0x3d')]=[{'all':!![]}];}_0x2363bb=_[_0x5c23('0x38')]({},_0x2363bb,_0x5875d9[_0x5c23('0x3a')]);return db[_0x5c23('0x3b')][_0x5c23('0x3e')](_0x2363bb)[_0x5c23('0x20')](handleEntityNotFound(_0x358a2d,null))['then'](respondWithResult(_0x358a2d,null))[_0x5c23('0x16')](handleError(_0x358a2d,null));};exports[_0x5c23('0x1f')]=function(_0x2b5a75,_0x384731){if(_0x2b5a75[_0x5c23('0x3f')]['id']){delete _0x2b5a75['body']['id'];}return db[_0x5c23('0x3b')]['find']({'where':{'id':_0x2b5a75[_0x5c23('0x40')]['id']}})['then'](handleEntityNotFound(_0x384731,null))[_0x5c23('0x20')](saveUpdates(_0x2b5a75[_0x5c23('0x3f')],null))[_0x5c23('0x20')](respondWithResult(_0x384731,null))[_0x5c23('0x16')](handleError(_0x384731,null));};exports['destroy']=function(_0x831afd,_0x231b6c){return db[_0x5c23('0x3b')][_0x5c23('0x3e')]({'where':{'id':_0x831afd[_0x5c23('0x40')]['id']}})['then'](handleEntityNotFound(_0x231b6c,null))[_0x5c23('0x20')](removeEntity(_0x231b6c,null))[_0x5c23('0x16')](handleError(_0x231b6c,null));};exports[_0x5c23('0x41')]=function(_0x2650de,_0x1afd72){return db[_0x5c23('0x3b')][_0x5c23('0x41')]()[_0x5c23('0x20')](respondWithResult(_0x1afd72,null))[_0x5c23('0x16')](handleError(_0x1afd72,null));};exports[_0x5c23('0x42')]=function(_0x1b941e,_0x30df09){var _0x12fd19='sms';return interactionService[_0x5c23('0x43')](_0x1b941e,_0x12fd19)[_0x5c23('0x20')](respondWithResult(_0x30df09,null))[_0x5c23('0x16')](handleError(_0x30df09,null));};exports[_0x5c23('0x42')]=function(_0x40ce2a,_0x4343f7){var _0x48bfae=_0x5c23('0x44');return interactionService[_0x5c23('0x43')](_0x40ce2a,_0x48bfae)[_0x5c23('0x20')](respondWithResult(_0x4343f7,null))[_0x5c23('0x16')](handleError(_0x4343f7,null));};exports['reject']=function(_0x503559,_0x1e3baf){var _0x2a0353={'agent':{},'channel':_0x5c23('0x44')};if(_0x503559[_0x5c23('0x3f')]['id']){delete _0x503559['body']['id'];}_0x503559[_0x5c23('0x3f')][_0x5c23('0x45')]=_0x503559['body']['UserId']||_0x503559[_0x5c23('0x46')]['id'];_0x2a0353[_0x5c23('0x47')]['id']=_0x503559['body']['UserId'];return db['FaxMessage'][_0x5c23('0x3e')]({'where':{'id':_0x503559['params']['id'],'UserId':null}})[_0x5c23('0x20')](handleEntityNotFound(_0x1e3baf,null))[_0x5c23('0x20')](function(_0x546ac7){if(_0x546ac7){_0x2a0353['message']=_0x546ac7['get']({'plain':!![]});return db[_0x5c23('0x48')][_0x5c23('0x3e')]({'where':{'id':_0x546ac7['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1e3baf,null))[_0x5c23('0x20')](function(_0x46ba4f){if(_0x46ba4f){_0x2a0353[_0x5c23('0x49')]=_0x46ba4f[_0x5c23('0x4a')]({'plain':!![]});interaction_log[_0x5c23('0x11')](_0x5c23('0x4b'),_0x503559['user']['id'],_0x503559[_0x5c23('0x46')][_0x5c23('0x23')],_0x503559['user'][_0x5c23('0x4c')],_0x2a0353[_0x5c23('0x49')]['id'],_0x503559[_0x5c23('0x3f')]?JSON['stringify'](_0x503559[_0x5c23('0x3f')]):'null');return respondWithRpcPromise('RejectMessage',_0x5c23('0x4d'),_0x2a0353);}return null;})[_0x5c23('0x20')](function(_0x592e07){var _0x598cea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x592e07[_0x5c23('0x15')][_0x5c23('0x4e')];return db[_0x5c23('0x4f')][_0x5c23('0x2b')](_0x598cea,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x5c23('0x20')](function(_0x4bcb69){return _0x4bcb69;});})['then'](function(_0x266480){if(_0x266480){_0x2a0353['message'][_0x5c23('0x50')]=_0x266480[0x0];if(!_0x503559[_0x5c23('0x3f')][_0x5c23('0x45')])return;return db['User'][_0x5c23('0x3e')]({'where':{'id':_0x503559[_0x5c23('0x3f')][_0x5c23('0x45')],'role':_0x5c23('0x47')},'attributes':['id',_0x5c23('0x23'),'fullname',_0x5c23('0x51'),_0x5c23('0x52')],'raw':!![]});}return null;})[_0x5c23('0x20')](function(_0x5dc7d5){if(!_0x5dc7d5)return null;_0x2a0353[_0x5c23('0x15')][_0x5c23('0x47')]=_0x5dc7d5;return _0x2a0353;})[_0x5c23('0x20')](function(_0x3d6a5a){if(_0x3d6a5a){_0x3d6a5a[_0x5c23('0x15')][_0x5c23('0x53')]=util[_0x5c23('0x54')](_0x5c23('0x55'),_0x503559['user'][_0x5c23('0x23')]);_0x3d6a5a[_0x5c23('0x15')][_0x5c23('0x56')]=_0x2a0353[_0x5c23('0x56')];_0x3d6a5a[_0x5c23('0x15')][_0x5c23('0x57')]=_0x2a0353[_0x5c23('0x56')];_0x3d6a5a['message'][_0x5c23('0x58')]=_0x5c23('0x59');respondWithRpcPromise(_0x5c23('0x5a'),_0x5c23('0x5a'),{'event':_0x5c23('0x5b'),'message':_0x3d6a5a[_0x5c23('0x15')]},client9002);return _0x2a0353;}return null;})[_0x5c23('0x20')](respondWithResult(_0x1e3baf,null))[_0x5c23('0x16')](handleError(_0x1e3baf,null));};exports[_0x5c23('0x5c')]=function(_0x153466,_0x1831f1){var _0x3687eb;return db['FaxMessage'][_0x5c23('0x5c')](_0x153466[_0x5c23('0x3f')],{})['then'](function(_0x396196){_0x3687eb=_0x396196;return db[_0x5c23('0x5d')][_0x5c23('0x5e')]({'where':{'id':_0x3687eb[_0x5c23('0x4e')]}});})[_0x5c23('0x20')](function(_0x489609){if(_['isNil'](_0x489609)){return;}else{_0x3687eb[_0x5c23('0x44')]=_0x489609[_0x5c23('0x44')];return db[_0x5c23('0x5f')]['findOne']({'where':{'id':_0x3687eb[_0x5c23('0x60')]}});}})[_0x5c23('0x20')](function(_0x521320){return respondWithRpcPromise(_0x5c23('0x61'),_0x5c23('0x61'),{'FaxAccountId':_['isNil'](_0x153466[_0x5c23('0x3f')])?undefined:_0x153466[_0x5c23('0x3f')][_0x5c23('0x62')],'path':_[_0x5c23('0x63')](_0x521320)?undefined:util[_0x5c23('0x54')]('/var/opt/motion2/server/files/attachments/%s',_0x521320[_0x5c23('0x64')]),'fax':_[_0x5c23('0x63')](_0x3687eb[_0x5c23('0x44')])?undefined:_0x3687eb[_0x5c23('0x44')],'AttachmentId':_0x3687eb['AttachmentId']},client9002);})[_0x5c23('0x20')](respondWithResult(_0x1831f1,0xc9))[_0x5c23('0x16')](handleError(_0x1831f1,null));};exports['download']=function(_0x2d1170,_0x39d1cd){var _0x3462c6=path['join'](config[_0x5c23('0x65')],_0x5c23('0x66'),_0x5c23('0x67'),_0x5c23('0x68'));return db['FaxMessage'][_0x5c23('0x3e')]({'where':{'id':_0x2d1170[_0x5c23('0x40')]['id']},'include':[{'model':db['Attachment'],'as':_0x5c23('0x5f')}]})[_0x5c23('0x20')](handleEntityNotFound(_0x39d1cd,null))[_0x5c23('0x20')](function(_0x72177a){if(_0x72177a){return _0x39d1cd[_0x5c23('0x69')](path['join'](_0x3462c6,_0x72177a[_0x5c23('0x5f')][_0x5c23('0x64')]));}})[_0x5c23('0x16')](handleError(_0x39d1cd,null));}; \ No newline at end of file +var _0x3277=['reject','UserId','user','FaxInteraction','FaxInteractionId','interaction','get','role','stringify','null','RejectMessage','rejectMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','channel','motionChannel','event','EventManager','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','format','basename','download','join','root','server','attachments','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','client','http','../../config/logger','fax-interactions','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','limit','undefined','offset','set','Content-Range','destroy','status','sendStatus','stack','name','send','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','params','include','find','update','body','describe','accept','sms','acceptMessage','fax'];(function(_0x20dd4,_0x296a3a){var _0x301304=function(_0x3daea3){while(--_0x3daea3){_0x20dd4['push'](_0x20dd4['shift']());}};_0x301304(++_0x296a3a);}(_0x3277,0x173));var _0x7327=function(_0x38893f,_0x51e869){_0x38893f=_0x38893f-0x0;var _0x2febdb=_0x3277[_0x38893f];return _0x2febdb;};'use strict';var util=require(_0x7327('0x0'));var path=require(_0x7327('0x1'));var _=require(_0x7327('0x2'));var Redis=require('ioredis');var interactionService=require(_0x7327('0x3'));var qs=require(_0x7327('0x4'));var logger=require('../../config/logger')(_0x7327('0x5'));var config=require('../../config/environment');var db=require(_0x7327('0x6'))['db'];config[_0x7327('0x7')]=_['defaults'](config[_0x7327('0x7')],{'host':_0x7327('0x8'),'port':0x18eb});var socket=require(_0x7327('0x9'))(new Redis(config['redis']));require(_0x7327('0xa'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7327('0xb')][_0x7327('0xc')]({'port':0x232c});var client9002=jayson[_0x7327('0xb')][_0x7327('0xc')]({'port':0x232a});var interaction_log=require(_0x7327('0xd'))(_0x7327('0xe'));function respondWithRpcPromise(_0x29455d,_0x38404e,_0xdd07f6,_0x56bd12){return new Promise(function(_0x414e16,_0x19334b){var _0x5b4860=_0x56bd12||client;return _0x5b4860[_0x7327('0xf')](_0x29455d,_0xdd07f6)[_0x7327('0x10')](function(_0x25d648){logger[_0x7327('0x11')](_0x7327('0x12'),_0x38404e,_0x7327('0x13'));logger['debug'](_0x7327('0x14'),_0x38404e,_0x7327('0x13'),JSON['stringify'](_0x25d648));if(_0x25d648[_0x7327('0x15')]){if(_0x25d648[_0x7327('0x15')][_0x7327('0x16')]===0x1f4){logger[_0x7327('0x15')](_0x7327('0x12'),_0x38404e,_0x25d648[_0x7327('0x15')]['message']);return _0x19334b(_0x25d648[_0x7327('0x15')][_0x7327('0x17')]);}logger[_0x7327('0x15')](_0x7327('0x12'),_0x38404e,_0x25d648[_0x7327('0x15')][_0x7327('0x17')]);return _0x414e16(_0x25d648[_0x7327('0x15')][_0x7327('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x38404e,_0x7327('0x13'));_0x414e16(_0x25d648[_0x7327('0x18')][_0x7327('0x17')]);}})[_0x7327('0x19')](function(_0x107dd0){logger[_0x7327('0x15')](_0x7327('0x12'),_0x38404e,_0x107dd0);_0x19334b(_0x107dd0);});});}function respondWithResult(_0x5cd44c,_0x9ae1fe){_0x9ae1fe=_0x9ae1fe||0xc8;return function(_0x7c859c){if(_0x7c859c){return _0x5cd44c['status'](_0x9ae1fe)[_0x7327('0x1a')](_0x7c859c);}};}function respondWithFilteredResult(_0x433f00,_0x491808){return function(_0xb432e6){if(_0xb432e6){var _0x4d6555=typeof _0x491808['offset']==='undefined'&&typeof _0x491808[_0x7327('0x1b')]===_0x7327('0x1c');var _0x15b4b5=_0xb432e6['count'];var _0x1043b5=_0x4d6555?0x0:_0x491808[_0x7327('0x1d')];var _0x30d81d=_0x4d6555?_0xb432e6['count']:_0x491808[_0x7327('0x1d')]+_0x491808[_0x7327('0x1b')];var _0x5360f4;if(_0x30d81d>=_0x15b4b5){_0x30d81d=_0x15b4b5;_0x5360f4=0xc8;}else{_0x5360f4=0xce;}_0x433f00['status'](_0x5360f4);return _0x433f00[_0x7327('0x1e')](_0x7327('0x1f'),_0x1043b5+'-'+_0x30d81d+'/'+_0x15b4b5)[_0x7327('0x1a')](_0xb432e6);}return null;};}function saveUpdates(_0x283e4e){return function(_0x2da27a){if(_0x2da27a){return _0x2da27a['update'](_0x283e4e)[_0x7327('0x10')](function(_0xc9e5bf){return _0xc9e5bf;});}return null;};}function removeEntity(_0x3b9021){return function(_0x558e0b){if(_0x558e0b){return _0x558e0b[_0x7327('0x20')]()[_0x7327('0x10')](function(){_0x3b9021[_0x7327('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b8a6){return function(_0x5a55d4){if(!_0x5a55d4){_0x49b8a6[_0x7327('0x22')](0x194);}return _0x5a55d4;};}function handleError(_0x34516d,_0x44717a){_0x44717a=_0x44717a||0x1f4;return function(_0x20c9f5){logger['error'](_0x20c9f5[_0x7327('0x23')]);if(_0x20c9f5[_0x7327('0x24')]){delete _0x20c9f5[_0x7327('0x24')];}_0x34516d[_0x7327('0x21')](_0x44717a)[_0x7327('0x25')](_0x20c9f5);};}exports['index']=function(_0x1c6e09,_0x5e8f61){var _0x3ccefc={},_0x4b631e={},_0x2a014c={'count':0x0,'rows':[]};var _0x2b1136=_[_0x7327('0x26')](db[_0x7327('0x27')][_0x7327('0x28')],function(_0x6ad893){return{'name':_0x6ad893[_0x7327('0x29')],'type':_0x6ad893['type'][_0x7327('0x2a')]};});_0x4b631e[_0x7327('0x2b')]=_[_0x7327('0x26')](_0x2b1136,_0x7327('0x24'));_0x4b631e[_0x7327('0x2c')]=_[_0x7327('0x2d')](_0x1c6e09['query']);_0x4b631e[_0x7327('0x2e')]=_[_0x7327('0x2f')](_0x4b631e[_0x7327('0x2b')],_0x4b631e[_0x7327('0x2c')]);_0x3ccefc[_0x7327('0x30')]=_['intersection'](_0x4b631e[_0x7327('0x2b')],qs[_0x7327('0x31')](_0x1c6e09[_0x7327('0x2c')][_0x7327('0x31')]));_0x3ccefc[_0x7327('0x30')]=_0x3ccefc[_0x7327('0x30')][_0x7327('0x32')]?_0x3ccefc[_0x7327('0x30')]:_0x4b631e['model'];if(!_0x1c6e09['query'][_0x7327('0x33')](_0x7327('0x34'))){_0x3ccefc[_0x7327('0x1b')]=qs[_0x7327('0x1b')](_0x1c6e09[_0x7327('0x2c')][_0x7327('0x1b')]);_0x3ccefc[_0x7327('0x1d')]=qs[_0x7327('0x1d')](_0x1c6e09[_0x7327('0x2c')]['offset']);}_0x3ccefc[_0x7327('0x35')]=qs[_0x7327('0x36')](_0x1c6e09[_0x7327('0x2c')][_0x7327('0x36')]);_0x3ccefc[_0x7327('0x37')]=qs['filters'](_[_0x7327('0x38')](_0x1c6e09[_0x7327('0x2c')],_0x4b631e[_0x7327('0x2e')]),_0x2b1136);if(_0x1c6e09['query'][_0x7327('0x39')]){_0x3ccefc['where']=_[_0x7327('0x3a')](_0x3ccefc[_0x7327('0x37')],{'$or':_[_0x7327('0x26')](_0x2b1136,function(_0x2c1718){if(_0x2c1718[_0x7327('0x3b')]!==_0x7327('0x3c')){var _0x3dfcd3={};_0x3dfcd3[_0x2c1718[_0x7327('0x24')]]={'$like':'%'+_0x1c6e09[_0x7327('0x2c')]['filter']+'%'};return _0x3dfcd3;}})});}_0x3ccefc=_[_0x7327('0x3a')]({},_0x3ccefc,_0x1c6e09[_0x7327('0x3d')]);var _0x263612={'where':_0x3ccefc['where']};return db['FaxMessage'][_0x7327('0x3e')](_0x263612)[_0x7327('0x10')](function(_0x2258b5){_0x2a014c[_0x7327('0x3e')]=_0x2258b5;if(_0x1c6e09['query']['includeAll']){_0x3ccefc['include']=[{'all':!![]}];}return db[_0x7327('0x27')]['findAll'](_0x3ccefc);})[_0x7327('0x10')](function(_0x393dd4){_0x2a014c['rows']=_0x393dd4;return _0x2a014c;})[_0x7327('0x10')](respondWithFilteredResult(_0x5e8f61,_0x3ccefc))[_0x7327('0x19')](handleError(_0x5e8f61,null));};exports['show']=function(_0x4665d9,_0x263a59){var _0x21977e={'raw':!![],'where':{'id':_0x4665d9[_0x7327('0x3f')]['id']}},_0x46d834={};_0x46d834[_0x7327('0x2b')]=_[_0x7327('0x2d')](db[_0x7327('0x27')][_0x7327('0x28')]);_0x46d834[_0x7327('0x2c')]=_[_0x7327('0x2d')](_0x4665d9['query']);_0x46d834[_0x7327('0x2e')]=_[_0x7327('0x2f')](_0x46d834[_0x7327('0x2b')],_0x46d834[_0x7327('0x2c')]);_0x21977e[_0x7327('0x30')]=_[_0x7327('0x2f')](_0x46d834[_0x7327('0x2b')],qs['fields'](_0x4665d9[_0x7327('0x2c')][_0x7327('0x31')]));_0x21977e[_0x7327('0x30')]=_0x21977e[_0x7327('0x30')]['length']?_0x21977e['attributes']:_0x46d834[_0x7327('0x2b')];if(_0x4665d9['query']['includeAll']){_0x21977e[_0x7327('0x40')]=[{'all':!![]}];}_0x21977e=_[_0x7327('0x3a')]({},_0x21977e,_0x4665d9[_0x7327('0x3d')]);return db[_0x7327('0x27')][_0x7327('0x41')](_0x21977e)[_0x7327('0x10')](handleEntityNotFound(_0x263a59,null))[_0x7327('0x10')](respondWithResult(_0x263a59,null))[_0x7327('0x19')](handleError(_0x263a59,null));};exports[_0x7327('0x42')]=function(_0xf357d7,_0x4ffecc){if(_0xf357d7['body']['id']){delete _0xf357d7[_0x7327('0x43')]['id'];}return db[_0x7327('0x27')]['find']({'where':{'id':_0xf357d7[_0x7327('0x3f')]['id']}})[_0x7327('0x10')](handleEntityNotFound(_0x4ffecc,null))[_0x7327('0x10')](saveUpdates(_0xf357d7[_0x7327('0x43')],null))[_0x7327('0x10')](respondWithResult(_0x4ffecc,null))[_0x7327('0x19')](handleError(_0x4ffecc,null));};exports[_0x7327('0x20')]=function(_0x21d758,_0x34a4f4){return db['FaxMessage'][_0x7327('0x41')]({'where':{'id':_0x21d758[_0x7327('0x3f')]['id']}})['then'](handleEntityNotFound(_0x34a4f4,null))[_0x7327('0x10')](removeEntity(_0x34a4f4,null))['catch'](handleError(_0x34a4f4,null));};exports[_0x7327('0x44')]=function(_0x306df8,_0x194224){return db[_0x7327('0x27')]['describe']()[_0x7327('0x10')](respondWithResult(_0x194224,null))[_0x7327('0x19')](handleError(_0x194224,null));};exports[_0x7327('0x45')]=function(_0x5df7a2,_0xf23cc4){var _0x3681af=_0x7327('0x46');return interactionService[_0x7327('0x47')](_0x5df7a2,_0x3681af)[_0x7327('0x10')](respondWithResult(_0xf23cc4,null))[_0x7327('0x19')](handleError(_0xf23cc4,null));};exports[_0x7327('0x45')]=function(_0x3e1e9a,_0x23edd5){var _0x292676=_0x7327('0x48');return interactionService[_0x7327('0x47')](_0x3e1e9a,_0x292676)[_0x7327('0x10')](respondWithResult(_0x23edd5,null))['catch'](handleError(_0x23edd5,null));};exports[_0x7327('0x49')]=function(_0x3ea7aa,_0x2c2e1e){var _0x83aed={'agent':{},'channel':_0x7327('0x48')};if(_0x3ea7aa[_0x7327('0x43')]['id']){delete _0x3ea7aa[_0x7327('0x43')]['id'];}_0x3ea7aa['body'][_0x7327('0x4a')]=_0x3ea7aa[_0x7327('0x43')][_0x7327('0x4a')]||_0x3ea7aa[_0x7327('0x4b')]['id'];_0x83aed['agent']['id']=_0x3ea7aa['body'][_0x7327('0x4a')];return db['FaxMessage'][_0x7327('0x41')]({'where':{'id':_0x3ea7aa[_0x7327('0x3f')]['id'],'UserId':null}})[_0x7327('0x10')](handleEntityNotFound(_0x2c2e1e,null))[_0x7327('0x10')](function(_0x2158c0){if(_0x2158c0){_0x83aed['message']=_0x2158c0['get']({'plain':!![]});return db[_0x7327('0x4c')][_0x7327('0x41')]({'where':{'id':_0x2158c0[_0x7327('0x4d')]}});}return null;})[_0x7327('0x10')](handleEntityNotFound(_0x2c2e1e,null))[_0x7327('0x10')](function(_0x54f7db){if(_0x54f7db){_0x83aed[_0x7327('0x4e')]=_0x54f7db[_0x7327('0x4f')]({'plain':!![]});interaction_log[_0x7327('0x11')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ea7aa[_0x7327('0x4b')]['id'],_0x3ea7aa[_0x7327('0x4b')]['name'],_0x3ea7aa[_0x7327('0x4b')][_0x7327('0x50')],_0x83aed[_0x7327('0x4e')]['id'],_0x3ea7aa['body']?JSON[_0x7327('0x51')](_0x3ea7aa['body']):_0x7327('0x52'));return respondWithRpcPromise(_0x7327('0x53'),_0x7327('0x54'),_0x83aed);}return null;})[_0x7327('0x10')](function(_0x30f92f){var _0x202c42='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30f92f[_0x7327('0x17')][_0x7327('0x55')];return db[_0x7327('0x56')][_0x7327('0x2c')](_0x202c42,{'type':db['Sequelize'][_0x7327('0x57')][_0x7327('0x58')],'raw':!![]})[_0x7327('0x10')](function(_0x44eb9f){return _0x44eb9f;});})[_0x7327('0x10')](function(_0xb4ad35){if(_0xb4ad35){_0x83aed[_0x7327('0x17')][_0x7327('0x59')]=_0xb4ad35[0x0];if(!_0x3ea7aa[_0x7327('0x43')][_0x7327('0x4a')])return;return db[_0x7327('0x5a')][_0x7327('0x41')]({'where':{'id':_0x3ea7aa['body'][_0x7327('0x4a')],'role':_0x7327('0x5b')},'attributes':['id',_0x7327('0x24'),_0x7327('0x5c'),'email','internal'],'raw':!![]});}return null;})[_0x7327('0x10')](function(_0x843356){if(!_0x843356)return null;_0x83aed[_0x7327('0x17')][_0x7327('0x5b')]=_0x843356;return _0x83aed;})['then'](function(_0x4b04b8){if(_0x4b04b8){_0x4b04b8[_0x7327('0x17')]['interface']=util['format']('SIP/%s',_0x3ea7aa[_0x7327('0x4b')][_0x7327('0x24')]);_0x4b04b8['message'][_0x7327('0x5d')]=_0x83aed[_0x7327('0x5d')];_0x4b04b8[_0x7327('0x17')][_0x7327('0x5e')]=_0x83aed['channel'];_0x4b04b8['message'][_0x7327('0x5f')]=_0x7327('0x49');respondWithRpcPromise(_0x7327('0x60'),'EventManager',{'event':'rejectmessage','message':_0x4b04b8[_0x7327('0x17')]},client9002);return _0x83aed;}return null;})[_0x7327('0x10')](respondWithResult(_0x2c2e1e,null))[_0x7327('0x19')](handleError(_0x2c2e1e,null));};exports[_0x7327('0x61')]=function(_0x2222c6,_0x29071a){var _0x53f448;return db[_0x7327('0x27')]['create'](_0x2222c6['body'],{})['then'](function(_0x50b8bf){_0x53f448=_0x50b8bf;return db[_0x7327('0x62')][_0x7327('0x63')]({'where':{'id':_0x53f448[_0x7327('0x55')]}});})[_0x7327('0x10')](function(_0x1ff2a4){if(_[_0x7327('0x64')](_0x1ff2a4)){return;}else{_0x53f448['fax']=_0x1ff2a4[_0x7327('0x48')];return db[_0x7327('0x65')][_0x7327('0x63')]({'where':{'id':_0x53f448[_0x7327('0x66')]}});}})[_0x7327('0x10')](function(_0x1e03ac){return respondWithRpcPromise(_0x7327('0x67'),_0x7327('0x67'),{'FaxAccountId':_[_0x7327('0x64')](_0x2222c6[_0x7327('0x43')])?undefined:_0x2222c6['body']['FaxAccountId'],'path':_[_0x7327('0x64')](_0x1e03ac)?undefined:util[_0x7327('0x68')]('/var/opt/motion2/server/files/attachments/%s',_0x1e03ac[_0x7327('0x69')]),'fax':_[_0x7327('0x64')](_0x53f448['fax'])?undefined:_0x53f448['fax'],'AttachmentId':_0x53f448['AttachmentId']},client9002);})[_0x7327('0x10')](respondWithResult(_0x29071a,0xc9))['catch'](handleError(_0x29071a,null));};exports[_0x7327('0x6a')]=function(_0x3c9313,_0x1b519e){var _0x20b9d3=path[_0x7327('0x6b')](config[_0x7327('0x6c')],_0x7327('0x6d'),'files',_0x7327('0x6e'));return db[_0x7327('0x27')][_0x7327('0x41')]({'where':{'id':_0x3c9313[_0x7327('0x3f')]['id']},'include':[{'model':db[_0x7327('0x65')],'as':_0x7327('0x65')}]})[_0x7327('0x10')](handleEntityNotFound(_0x1b519e,null))[_0x7327('0x10')](function(_0x190565){if(_0x190565){return _0x1b519e['download'](path['join'](_0x20b9d3,_0x190565[_0x7327('0x65')][_0x7327('0x69')]));}})[_0x7327('0x19')](handleError(_0x1b519e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 06d193d..e900d90 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 _0x2eba=['FaxMessage','setMaxListeners','save','emit','../../mysqldb'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x2eba,0xc7));var _0xa2eb=function(_0x36ef2c,_0x378575){_0x36ef2c=_0x36ef2c-0x0;var _0x345b23=_0x2eba[_0x36ef2c];return _0x345b23;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xa2eb('0x0'))['db'][_0xa2eb('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa2eb('0x2')](0x0);var events={'afterCreate':_0xa2eb('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45ff67){return function(_0x51ebed,_0x1544ff,_0x3174a0){FaxMessageEvents[_0xa2eb('0x4')](_0x45ff67+':'+_0x51ebed['id'],_0x51ebed);FaxMessageEvents[_0xa2eb('0x4')](_0x45ff67,_0x51ebed);_0x3174a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xaf1b=['hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit'];(function(_0x51d3ac,_0x2cdcfc){var _0x29b333=function(_0xd4e32){while(--_0xd4e32){_0x51d3ac['push'](_0x51d3ac['shift']());}};_0x29b333(++_0x2cdcfc);}(_0xaf1b,0x11a));var _0xbaf1=function(_0xc1ece6,_0x27e896){_0xc1ece6=_0xc1ece6-0x0;var _0x5f3a40=_0xaf1b[_0xc1ece6];return _0x5f3a40;};'use strict';var EventEmitter=require(_0xbaf1('0x0'));var FaxMessage=require(_0xbaf1('0x1'))['db'][_0xbaf1('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbaf1('0x3')](0x0);var events={'afterCreate':_0xbaf1('0x4'),'afterUpdate':_0xbaf1('0x5'),'afterDestroy':_0xbaf1('0x6')};function emitEvent(_0xdf4a1b){return function(_0x461ffb,_0x3fe8f0,_0x156a67){FaxMessageEvents[_0xbaf1('0x7')](_0xdf4a1b+':'+_0x461ffb['id'],_0x461ffb);FaxMessageEvents[_0xbaf1('0x7')](_0xdf4a1b,_0x461ffb);_0x156a67(null);};}for(var e in events){if(events[_0xbaf1('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xbaf1('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 7e21df5..54221d2 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 _0xe3b9=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxMessage.attributes','exports','define'];(function(_0x3d3bd4,_0x3959a7){var _0x3062b7=function(_0x3c5ab8){while(--_0x3c5ab8){_0x3d3bd4['push'](_0x3d3bd4['shift']());}};_0x3062b7(++_0x3959a7);}(_0xe3b9,0x1c1));var _0x9e3b=function(_0x1edf7a,_0x53f918){_0x1edf7a=_0x1edf7a-0x0;var _0x20bc81=_0xe3b9[_0x1edf7a];return _0x20bc81;};'use strict';var _=require('lodash');var util=require(_0x9e3b('0x0'));var logger=require(_0x9e3b('0x1'))(_0x9e3b('0x2'));var moment=require(_0x9e3b('0x3'));var BPromise=require(_0x9e3b('0x4'));var rp=require(_0x9e3b('0x5'));var fs=require('fs');var path=require(_0x9e3b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e3b('0x7'));module[_0x9e3b('0x8')]=function(_0x1ef74b,_0x458a1c){return _0x1ef74b[_0x9e3b('0x9')](_0x9e3b('0xa'),attributes,{'tableName':_0x9e3b('0xb'),'paranoid':![],'indexes':[{'name':_0x9e3b('0xc'),'fields':[_0x9e3b('0xd')],'type':_0x9e3b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a919d,_0x2c84d3,_0x3f1eaf){var _0x183471=_0x1ef74b['models'];var _0x51a5ed=_0x3a919d[_0x9e3b('0xf')]({'plain':!![]});if(_0x51a5ed[_0x9e3b('0x10')][_0x9e3b('0x11')]()==='in'||_0x51a5ed[_0x9e3b('0x10')]['toLowerCase']()==='out'&&!_0x51a5ed['secret']&&!_[_0x9e3b('0x12')](_0x51a5ed[_0x9e3b('0x13')])){_0x183471['FaxInteraction'][_0x9e3b('0x14')]({'where':{'id':_0x51a5ed[_0x9e3b('0x15')]}})['then'](function(_0x3da5b6){if(_0x3da5b6){_0x3da5b6[_0x9e3b('0x16')]({'lastMsgAt':_0x51a5ed[_0x9e3b('0x17')],'lastMsgDirection':_0x51a5ed[_0x9e3b('0x10')][_0x9e3b('0x11')]()});}})[_0x9e3b('0x18')](function(_0x469549){console[_0x9e3b('0x19')](_0x469549);});}_0x3f1eaf();}},'charset':'utf8mb4','collate':_0x9e3b('0x1a')});}; \ No newline at end of file +var _0x239a=['rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0xe1d37b,_0x568a45){var _0xf4928f=function(_0x28572b){while(--_0x28572b){_0xe1d37b['push'](_0xe1d37b['shift']());}};_0xf4928f(++_0x568a45);}(_0x239a,0x1bd));var _0xa239=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x239a[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xa239('0x0'));var logger=require('../../config/logger')(_0xa239('0x1'));var moment=require(_0xa239('0x2'));var BPromise=require(_0xa239('0x3'));var rp=require(_0xa239('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa239('0x5'));var config=require(_0xa239('0x6'));var attributes=require(_0xa239('0x7'));module[_0xa239('0x8')]=function(_0x591c76,_0x2777d7){return _0x591c76[_0xa239('0x9')](_0xa239('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xa239('0xb'),'fields':['body'],'type':_0xa239('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x196c4b,_0x35cdc3,_0x20322d){var _0x136a3e=_0x591c76[_0xa239('0xd')];var _0x2c1e79=_0x196c4b[_0xa239('0xe')]({'plain':!![]});if(_0x2c1e79[_0xa239('0xf')][_0xa239('0x10')]()==='in'||_0x2c1e79['direction'][_0xa239('0x10')]()==='out'&&!_0x2c1e79['secret']&&!_[_0xa239('0x11')](_0x2c1e79['UserId'])){_0x136a3e[_0xa239('0x12')][_0xa239('0x13')]({'where':{'id':_0x2c1e79[_0xa239('0x14')]}})['then'](function(_0x1df2e6){if(_0x1df2e6){_0x1df2e6[_0xa239('0x15')]({'lastMsgAt':_0x2c1e79[_0xa239('0x16')],'lastMsgDirection':_0x2c1e79['direction'][_0xa239('0x10')]()});}})[_0xa239('0x17')](function(_0x3dc1f6){console['error'](_0x3dc1f6);});}_0x20322d();}},'charset':'utf8mb4','collate':_0xa239('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 33ea948..c58fc01 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 _0xd0bb=['CreateFaxMessage','FaxMessage','create','body','options','update','raw','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x310ca4,_0x195e91){var _0x303c6f=function(_0x53dbf2){while(--_0x53dbf2){_0x310ca4['push'](_0x310ca4['shift']());}};_0x303c6f(++_0x195e91);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3517e5,_0x2c3608){_0x3517e5=_0x3517e5-0x0;var _0x15ba05=_0xd0bb[_0x3517e5];return _0x15ba05;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});config[_0xbd0b('0xa')]=_[_0xbd0b('0xb')](config['redis'],{'host':_0xbd0b('0xc'),'port':0x18eb});var socket=require(_0xbd0b('0xd'))(new Redis(config[_0xbd0b('0xa')]));require(_0xbd0b('0xe'))[_0xbd0b('0xf')](socket);function respondWithRpcPromise(_0x53d5e8,_0x51cf98,_0x14bc5b){return new BPromise(function(_0x110cf1,_0x4a69ff){return client[_0xbd0b('0x10')](_0x53d5e8,_0x14bc5b)[_0xbd0b('0x11')](function(_0x526258){logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));logger[_0xbd0b('0x15')](_0xbd0b('0x16'),_0x51cf98,_0xbd0b('0x14'),JSON[_0xbd0b('0x17')](_0x526258));if(_0x526258[_0xbd0b('0x18')]){if(_0x526258[_0xbd0b('0x18')][_0xbd0b('0x19')]===0x1f4){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x526258[_0xbd0b('0x18')]['message']);return _0x4a69ff(_0x526258['error'][_0xbd0b('0x1a')]);}logger[_0xbd0b('0x18')](_0xbd0b('0x13'),_0x51cf98,_0x526258[_0xbd0b('0x18')][_0xbd0b('0x1a')]);return _0x110cf1(_0x526258['error']['message']);}else{logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));_0x110cf1(_0x526258[_0xbd0b('0x1b')][_0xbd0b('0x1a')]);}})[_0xbd0b('0x1c')](function(_0x5aeb79){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x5aeb79);_0x4a69ff(_0x5aeb79);});});}exports[_0xbd0b('0x1d')]=function(_0x475801){var _0x2d02d0=this;return new Promise(function(_0x3053bb,_0x4b312d){return db[_0xbd0b('0x1e')][_0xbd0b('0x1f')](_0x475801[_0xbd0b('0x20')],{'raw':_0x475801['options']?_0x475801[_0xbd0b('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xbd0b('0x11')](function(_0x3c4938){logger[_0xbd0b('0x12')](_0xbd0b('0x1d'),_0x475801);logger[_0xbd0b('0x15')]('CreateFaxMessage',_0x475801,JSON[_0xbd0b('0x17')](_0x3c4938));_0x3053bb(_0x3c4938);})['catch'](function(_0x3e7e9c){logger[_0xbd0b('0x18')](_0xbd0b('0x1d'),_0x3e7e9c[_0xbd0b('0x1a')],_0x475801);_0x4b312d(_0x2d02d0[_0xbd0b('0x18')](0x1f4,_0x3e7e9c[_0xbd0b('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0x382f76){var _0x1b46a3=this;return new Promise(function(_0x33b752,_0x1b5a00){return db[_0xbd0b('0x1e')][_0xbd0b('0x22')](_0x382f76['body'],{'raw':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x382f76['options']?_0x382f76['options'][_0xbd0b('0x24')]||null:null,'attributes':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x25')]||null:null,'limit':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x26')]||null:null})['then'](function(_0x45f7d6){logger[_0xbd0b('0x12')]('UpdateFaxMessage',_0x382f76);logger['debug'](_0xbd0b('0x27'),_0x382f76,JSON[_0xbd0b('0x17')](_0x45f7d6));_0x33b752(_0x45f7d6);})['catch'](function(_0x31bdd3){logger[_0xbd0b('0x18')](_0xbd0b('0x27'),_0x31bdd3[_0xbd0b('0x1a')],_0x382f76);_0x1b5a00(_0x1b46a3[_0xbd0b('0x18')](0x1f4,_0x31bdd3[_0xbd0b('0x1a')]));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x46c77e,_0x2bded9){var _0xbec284=function(_0x169568){while(--_0x169568){_0x46c77e['push'](_0x46c77e['shift']());}};_0xbec284(++_0x2bded9);}(_0x54ef,0x112));var _0xf54e=function(_0x142ea6,_0xeb0f69){_0x142ea6=_0x142ea6-0x0;var _0x58319c=_0x54ef[_0x142ea6];return _0x58319c;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index db50384..ace593e 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 _0x20db=['faxMessage:','save','emit','removeListener','register'];(function(_0x353394,_0xc7c6c4){var _0x4b3a65=function(_0x32f09d){while(--_0x32f09d){_0x353394['push'](_0x353394['shift']());}};_0x4b3a65(++_0xc7c6c4);}(_0x20db,0x1dc));var _0xb20d=function(_0x4577e4,_0x34bc9d){_0x4577e4=_0x4577e4-0x0;var _0x1c7f34=_0x20db[_0x4577e4];return _0x1c7f34;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb20d('0x0'),'remove','update'];function createListener(_0x3adfc5,_0x353cf9){return function(_0x1d4ea3){_0x353cf9[_0xb20d('0x1')](_0x3adfc5,_0x1d4ea3);};}function removeListener(_0x2d5725,_0x1457ed){return function(){FaxMessageEvents[_0xb20d('0x2')](_0x2d5725,_0x1457ed);};}exports[_0xb20d('0x3')]=function(_0x3b3d70){for(var _0x19184f=0x0,_0x2ce0fb=events['length'];_0x19184f<_0x2ce0fb;_0x19184f++){var _0x2e0fdd=events[_0x19184f];var _0xa16811=createListener(_0xb20d('0x4')+_0x2e0fdd,_0x3b3d70);FaxMessageEvents['on'](_0x2e0fdd,_0xa16811);}}; \ No newline at end of file +var _0x5ea6=['./faxMessage.events','remove','update','removeListener','register','length','faxMessage:'];(function(_0xdd33db,_0x2e3c03){var _0x3c845a=function(_0x31ec22){while(--_0x31ec22){_0xdd33db['push'](_0xdd33db['shift']());}};_0x3c845a(++_0x2e3c03);}(_0x5ea6,0x173));var _0x65ea=function(_0x22205c,_0x473493){_0x22205c=_0x22205c-0x0;var _0x3f5efe=_0x5ea6[_0x22205c];return _0x3f5efe;};'use strict';var FaxMessageEvents=require(_0x65ea('0x0'));var events=['save',_0x65ea('0x1'),_0x65ea('0x2')];function createListener(_0x2b6160,_0x2cadce){return function(_0x312e6e){_0x2cadce['emit'](_0x2b6160,_0x312e6e);};}function removeListener(_0x2278d5,_0x4b36cb){return function(){FaxMessageEvents[_0x65ea('0x3')](_0x2278d5,_0x4b36cb);};}exports[_0x65ea('0x4')]=function(_0x2fae92){for(var _0x4ab14f=0x0,_0x354122=events[_0x65ea('0x5')];_0x4ab14f<_0x354122;_0x4ab14f++){var _0x3a1c34=events[_0x4ab14f];var _0x570937=createListener(_0x65ea('0x6')+_0x3a1c34,_0x2fae92);FaxMessageEvents['on'](_0x3a1c34,_0x570937);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 402da27..055375d 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 _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0x5860a3,_0x33b78a){var _0x1b193b=function(_0x4fe13e){while(--_0x4fe13e){_0x5860a3['push'](_0x5860a3['shift']());}};_0x1b193b(++_0x33b78a);}(_0xee5b,0x1f4));var _0xbee5=function(_0x21ff62,_0x968e44){_0x21ff62=_0x21ff62-0x0;var _0xf1ff06=_0xee5b[_0x21ff62];return _0xf1ff06;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('0x19')]=router; \ No newline at end of file +var _0x3c81=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x163404,_0x1d8144){var _0x540ec3=function(_0x56daf1){while(--_0x56daf1){_0x163404['push'](_0x163404['shift']());}};_0x540ec3(++_0x1d8144);}(_0x3c81,0x102));var _0x13c8=function(_0x26e171,_0x23000c){_0x26e171=_0x26e171-0x0;var _0x5571af=_0x3c81[_0x26e171];return _0x5571af;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('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(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),interaction[_0x13c8('0x10')](_0x13c8('0x11'),_0x13c8('0x12')),controller[_0x13c8('0x13')]);router[_0x13c8('0x14')]('/:id',auth[_0x13c8('0x7')](),controller[_0x13c8('0x15')]);router[_0x13c8('0x14')](_0x13c8('0x16'),auth['isAuthenticated'](),controller[_0x13c8('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x13c8('0x18')]);router['delete'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x19')]);module[_0x13c8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 554baab..8359897 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 _0xd01d=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','name'];(function(_0x416ff8,_0x39855b){var _0x461acd=function(_0x59c23f){while(--_0x59c23f){_0x416ff8['push'](_0x416ff8['shift']());}};_0x461acd(++_0x39855b);}(_0xd01d,0xbe));var _0xdd01=function(_0x3e29f9,_0xaba63){_0x3e29f9=_0x3e29f9-0x0;var _0x47afcc=_0xd01d[_0x3e29f9];return _0x47afcc;};'use strict';var Sequelize=require('sequelize');module[_0xdd01('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xdd01('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdd01('0x2')]},'timeout':{'type':Sequelize[_0xdd01('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdd01('0x4')](_0xdd01('0x5'),_0xdd01('0x6'),_0xdd01('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdd01('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ba4=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x20360f,_0x1b27c9){var _0x3aac89=function(_0x14b020){while(--_0x14b020){_0x20360f['push'](_0x20360f['shift']());}};_0x3aac89(++_0x1b27c9);}(_0x8ba4,0x1ec));var _0x48ba=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x8ba4[_0x4dbdda];return _0x1acbf1;};'use strict';var Sequelize=require(_0x48ba('0x0'));module[_0x48ba('0x1')]={'name':{'type':Sequelize[_0x48ba('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x48ba('0x2')]},'timeout':{'type':Sequelize[_0x48ba('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48ba('0x4')](_0x48ba('0x5'),_0x48ba('0x6'),_0x48ba('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ec34bc9..8dfd6ba 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 _0x4ccb=['createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','options','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','Team','select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','error','stack','send','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','rows','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','getMembers','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','filter','map','findAll','User','agent','faxPause'];(function(_0x57d9d9,_0x40b94c){var _0xa4a00c=function(_0x435b6e){while(--_0x435b6e){_0x57d9d9['push'](_0x57d9d9['shift']());}};_0xa4a00c(++_0x40b94c);}(_0x4ccb,0x196));var _0xb4cc=function(_0x10bc30,_0x2c5ff1){_0x10bc30=_0x10bc30-0x0;var _0x19f32b=_0x4ccb[_0x10bc30];return _0x19f32b;};'use strict';var BPromise=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var _=require(_0xb4cc('0x2'));var squel=require('squel');var Redis=require(_0xb4cc('0x3'));var qs=require(_0xb4cc('0x4'));var logger=require('../../config/logger')(_0xb4cc('0x5'));var config=require(_0xb4cc('0x6'));var db=require(_0xb4cc('0x7'))['db'];config['redis']=_[_0xb4cc('0x8')](config[_0xb4cc('0x9')],{'host':_0xb4cc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4cc('0x9')]));require(_0xb4cc('0xb'))[_0xb4cc('0xc')](socket);function respondWithStatusCode(_0x5327a4,_0x7e4460){_0x7e4460=_0x7e4460||0xcc;return function(_0x475478){if(_0x475478){return _0x5327a4[_0xb4cc('0xd')](_0x7e4460);}return _0x5327a4[_0xb4cc('0xe')](_0x7e4460)[_0xb4cc('0xf')]();};}function respondWithResult(_0x55224b,_0x507d38){_0x507d38=_0x507d38||0xc8;return function(_0x19d43e){if(_0x19d43e){return _0x55224b['status'](_0x507d38)[_0xb4cc('0x10')](_0x19d43e);}};}function respondWithFilteredResult(_0x4a54a5,_0x1d7063){return function(_0x1e5a83){if(_0x1e5a83){var _0x277c2a=typeof _0x1d7063['offset']==='undefined'&&typeof _0x1d7063[_0xb4cc('0x11')]==='undefined';var _0x5cf92a=_0x1e5a83[_0xb4cc('0x12')];var _0x58b1c2=_0x277c2a?0x0:_0x1d7063['offset'];var _0xcfdeb9=_0x277c2a?_0x1e5a83[_0xb4cc('0x12')]:_0x1d7063[_0xb4cc('0x13')]+_0x1d7063['limit'];var _0x4096db;if(_0xcfdeb9>=_0x5cf92a){_0xcfdeb9=_0x5cf92a;_0x4096db=0xc8;}else{_0x4096db=0xce;}_0x4a54a5[_0xb4cc('0xe')](_0x4096db);return _0x4a54a5[_0xb4cc('0x14')](_0xb4cc('0x15'),_0x58b1c2+'-'+_0xcfdeb9+'/'+_0x5cf92a)[_0xb4cc('0x10')](_0x1e5a83);}return null;};}function saveUpdates(_0x506ef9){return function(_0x4d4546){if(_0x4d4546){return _0x4d4546[_0xb4cc('0x16')](_0x506ef9)[_0xb4cc('0x17')](function(_0x5b56b2){return _0x5b56b2;});}return null;};}function removeEntity(_0x490b1a){return function(_0x14d8b6){if(_0x14d8b6){return _0x14d8b6[_0xb4cc('0x18')]()[_0xb4cc('0x17')](function(){var _0xa99916=_0x14d8b6['get']({'plain':!![]});var _0x242272=_0xb4cc('0x19');return db[_0xb4cc('0x1a')][_0xb4cc('0x18')]({'where':{'type':_0x242272,'resourceId':_0xa99916['id']}})[_0xb4cc('0x17')](function(){return _0x14d8b6;});})['then'](function(){_0x490b1a[_0xb4cc('0xe')](0xcc)[_0xb4cc('0xf')]();});}};}function handleEntityNotFound(_0x442d86){return function(_0x1a9c91){if(!_0x1a9c91){_0x442d86[_0xb4cc('0xd')](0x194);}return _0x1a9c91;};}function handleError(_0x571793,_0xc9d835){_0xc9d835=_0xc9d835||0x1f4;return function(_0x2289f6){logger[_0xb4cc('0x1b')](_0x2289f6[_0xb4cc('0x1c')]);if(_0x2289f6['name']){delete _0x2289f6['name'];}_0x571793[_0xb4cc('0xe')](_0xc9d835)[_0xb4cc('0x1d')](_0x2289f6);};}exports['index']=function(_0x5b4a17,_0x1f1809){var _0xeb25e1={};var _0x2ee2d3={'count':0x0,'rows':[]};var _0x154002=_['map'](db['FaxQueue'][_0xb4cc('0x1e')],function(_0x4f47ed){return{'name':_0x4f47ed[_0xb4cc('0x1f')],'type':_0x4f47ed[_0xb4cc('0x20')][_0xb4cc('0x21')]};});_0xeb25e1=qs[_0xb4cc('0x22')](_0x154002,_0x5b4a17);var _0x6fb0fb={'where':_0xeb25e1[_0xb4cc('0x23')]};return db[_0xb4cc('0x24')][_0xb4cc('0x12')](_0x6fb0fb)[_0xb4cc('0x17')](function(_0x5baab6){_0x2ee2d3[_0xb4cc('0x12')]=_0x5baab6;_0xeb25e1[_0xb4cc('0x25')]=qs[_0xb4cc('0x25')](_0x5b4a17[_0xb4cc('0x26')]);return db[_0xb4cc('0x24')]['findAll'](_0xeb25e1);})[_0xb4cc('0x17')](function(_0x2957ee){_0x2ee2d3[_0xb4cc('0x27')]=_0x2957ee;return _0x2ee2d3;})[_0xb4cc('0x17')](respondWithFilteredResult(_0x1f1809,_0xeb25e1))['catch'](handleError(_0x1f1809,null));};exports[_0xb4cc('0x28')]=function(_0x3641d5,_0x4e8e5f){var _0x3a78ef={'raw':!![],'where':{'id':_0x3641d5['params']['id']}},_0x418c2d={};_0x418c2d[_0xb4cc('0x29')]=_[_0xb4cc('0x2a')](db[_0xb4cc('0x24')][_0xb4cc('0x1e')]);_0x418c2d[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x3641d5[_0xb4cc('0x26')]);_0x418c2d[_0xb4cc('0x2b')]=_[_0xb4cc('0x2c')](_0x418c2d['model'],_0x418c2d['query']);_0x3a78ef[_0xb4cc('0x2d')]=_[_0xb4cc('0x2c')](_0x418c2d[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x3641d5[_0xb4cc('0x26')]['fields']));_0x3a78ef[_0xb4cc('0x2d')]=_0x3a78ef[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x3a78ef['attributes']:_0x418c2d[_0xb4cc('0x29')];if(_0x3641d5[_0xb4cc('0x26')][_0xb4cc('0x30')]){_0x3a78ef['include']=[{'all':!![]}];}_0x3a78ef=_[_0xb4cc('0x31')]({},_0x3a78ef,_0x3641d5['options']);return db[_0xb4cc('0x24')][_0xb4cc('0x32')](_0x3a78ef)[_0xb4cc('0x17')](handleEntityNotFound(_0x4e8e5f,null))[_0xb4cc('0x17')](respondWithResult(_0x4e8e5f,null))['catch'](handleError(_0x4e8e5f,null));};exports[_0xb4cc('0x33')]=function(_0x5e7fd1,_0x8d6f09){return db[_0xb4cc('0x24')][_0xb4cc('0x33')](_0x5e7fd1[_0xb4cc('0x34')],{})[_0xb4cc('0x17')](function(_0x3f9b37){var _0x4214e5=_0x5e7fd1['user'][_0xb4cc('0x35')]({'plain':!![]});if(!_0x4214e5)throw new Error(_0xb4cc('0x36'));if(_0x4214e5[_0xb4cc('0x37')]==='user'){var _0x5f05fa=_0x3f9b37[_0xb4cc('0x35')]({'plain':!![]});var _0xc257a=_0xb4cc('0x19');return db[_0xb4cc('0x38')][_0xb4cc('0x32')]({'where':{'name':_0xc257a,'userProfileId':_0x4214e5['userProfileId']},'raw':!![]})[_0xb4cc('0x17')](function(_0x5d55fe){if(_0x5d55fe&&_0x5d55fe['autoAssociation']===0x0){return db[_0xb4cc('0x1a')][_0xb4cc('0x33')]({'name':_0x5f05fa[_0xb4cc('0x39')],'resourceId':_0x5f05fa['id'],'type':_0x5d55fe[_0xb4cc('0x39')],'sectionId':_0x5d55fe['id']},{})[_0xb4cc('0x17')](function(){return _0x3f9b37;});}else{return _0x3f9b37;}})['catch'](function(_0xda87d5){logger['error'](_0xb4cc('0x3a'),_0xda87d5);throw _0xda87d5;});}return _0x3f9b37;})[_0xb4cc('0x17')](respondWithResult(_0x8d6f09,0xc9))[_0xb4cc('0x3b')](handleError(_0x8d6f09,null));};exports[_0xb4cc('0x16')]=function(_0x428ef1,_0x35a6c8){if(_0x428ef1[_0xb4cc('0x34')]['id']){delete _0x428ef1[_0xb4cc('0x34')]['id'];}return db[_0xb4cc('0x24')][_0xb4cc('0x32')]({'where':{'id':_0x428ef1[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x35a6c8,null))[_0xb4cc('0x17')](saveUpdates(_0x428ef1[_0xb4cc('0x34')],null))[_0xb4cc('0x17')](respondWithResult(_0x35a6c8,null))[_0xb4cc('0x3b')](handleError(_0x35a6c8,null));};exports['destroy']=function(_0x5be726,_0x2fe47b){return db[_0xb4cc('0x24')]['find']({'where':{'id':_0x5be726[_0xb4cc('0x3c')]['id']}})[_0xb4cc('0x17')](handleEntityNotFound(_0x2fe47b,null))[_0xb4cc('0x17')](removeEntity(_0x2fe47b,null))[_0xb4cc('0x3b')](handleError(_0x2fe47b,null));};exports['describe']=function(_0x1093bc,_0x94476f){return db[_0xb4cc('0x24')]['describe']()[_0xb4cc('0x17')](respondWithResult(_0x94476f,null))[_0xb4cc('0x3b')](handleError(_0x94476f,null));};exports[_0xb4cc('0x3d')]=function(_0x1490b6,_0xdbba1){var _0x439aa6={'raw':!![],'where':{}},_0x26caae={},_0x303efa;return db[_0xb4cc('0x24')]['findOne']({'where':{'id':_0x1490b6[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0xdbba1,null))[_0xb4cc('0x17')](function(_0x31a76a){if(_0x31a76a){_0x303efa=_0x31a76a[_0xb4cc('0x35')]({'plain':!![]});_0x26caae['model']=_[_0xb4cc('0x2a')](db[_0xb4cc('0x3e')][_0xb4cc('0x1e')]);_0x26caae[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x1490b6[_0xb4cc('0x26')]);_0x26caae[_0xb4cc('0x2b')]=_[_0xb4cc('0x2c')](_0x26caae['model'],_0x26caae[_0xb4cc('0x26')]);_0x439aa6[_0xb4cc('0x2d')]=_[_0xb4cc('0x2c')](_0x26caae[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x2e')]));_0x439aa6['attributes']=_0x439aa6[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x439aa6['attributes']:_0x26caae[_0xb4cc('0x29')];if(!_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x3f')](_0xb4cc('0x40'))){_0x439aa6['limit']=qs[_0xb4cc('0x11')](_0x1490b6['query'][_0xb4cc('0x11')]);_0x439aa6['offset']=qs['offset'](_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x13')]);}_0x439aa6[_0xb4cc('0x41')]=qs['sort'](_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x42')]);_0x439aa6[_0xb4cc('0x23')]=qs[_0xb4cc('0x2b')](_[_0xb4cc('0x43')](_0x1490b6['query'],_0x26caae[_0xb4cc('0x2b')]));_0x439aa6[_0xb4cc('0x23')]['FaxQueueId']=_0x31a76a['id'];if(_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x44')]){_0x439aa6[_0xb4cc('0x23')]=_['merge'](_0x439aa6[_0xb4cc('0x23')],{'$or':_[_0xb4cc('0x45')](_0x439aa6['attributes'],function(_0x5c5a3e){var _0x6c1e81={};_0x6c1e81[_0x5c5a3e]={'$like':'%'+_0x1490b6['query'][_0xb4cc('0x44')]+'%'};return _0x6c1e81;})});}_0x439aa6=_[_0xb4cc('0x31')]({},_0x439aa6,_0x1490b6['options']);return db[_0xb4cc('0x3e')][_0xb4cc('0x46')](_0x439aa6);}})[_0xb4cc('0x17')](function(_0x191ca4){if(_0x191ca4){return db[_0xb4cc('0x47')]['findAndCountAll']({'where':{'id':_[_0xb4cc('0x45')](_0x191ca4,'UserId'),'role':_0xb4cc('0x48')},'attributes':['id',_0xb4cc('0x39'),_0xb4cc('0x49'),'updatedAt',_0xb4cc('0x4a')]});}})[_0xb4cc('0x17')](function(_0x3b4f28){if(_0x3b4f28){return{'count':_0x3b4f28['count'],'rows':_[_0xb4cc('0x45')](_0x3b4f28[_0xb4cc('0x27')],function(_0x290b4f){return{'membername':_0x290b4f['name'],'UserId':_0x290b4f['id'],'queue_name':_0x303efa[_0xb4cc('0x39')],'FaxQueueId':_0x303efa['id'],'interface':util[_0xb4cc('0x4b')](_0xb4cc('0x4c'),_0xb4cc('0x4d'),_0x290b4f[_0xb4cc('0x39')]),'penalty':0x0,'paused':_0x290b4f['faxPause'],'createdAt':_0x290b4f[_0xb4cc('0x4a')],'updatedAt':_0x290b4f[_0xb4cc('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb4cc('0x17')](respondWithFilteredResult(_0xdbba1,_0x439aa6))[_0xb4cc('0x3b')](handleError(_0xdbba1,null));};exports[_0xb4cc('0x4f')]=function(_0x1e7798,_0xc2a99c){var _0x31d28c={};var _0x36537a={};var _0x491aaa;var _0x23bb10;return db['FaxQueue'][_0xb4cc('0x50')]({'where':{'id':_0x1e7798[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0xc2a99c,null))[_0xb4cc('0x17')](function(_0x4c02ba){if(_0x4c02ba){_0x491aaa=_0x4c02ba;_0x36537a[_0xb4cc('0x29')]=_[_0xb4cc('0x2a')](db['Team'][_0xb4cc('0x1e')]);_0x36537a[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x1e7798[_0xb4cc('0x26')]);_0x36537a[_0xb4cc('0x2b')]=_['intersection'](_0x36537a[_0xb4cc('0x29')],_0x36537a['query']);_0x31d28c[_0xb4cc('0x2d')]=_[_0xb4cc('0x2c')](_0x36537a[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x2e')]));_0x31d28c[_0xb4cc('0x2d')]=_0x31d28c[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x31d28c[_0xb4cc('0x2d')]:_0x36537a['model'];_0x31d28c['order']=qs[_0xb4cc('0x42')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x42')]);_0x31d28c['where']=qs[_0xb4cc('0x2b')](_[_0xb4cc('0x43')](_0x1e7798[_0xb4cc('0x26')],_0x36537a[_0xb4cc('0x2b')]));if(_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x44')]){_0x31d28c[_0xb4cc('0x23')]=_[_0xb4cc('0x31')](_0x31d28c[_0xb4cc('0x23')],{'$or':_['map'](_0x31d28c[_0xb4cc('0x2d')],function(_0x5c1d89){var _0xd335f={};_0xd335f[_0x5c1d89]={'$like':'%'+_0x1e7798[_0xb4cc('0x26')]['filter']+'%'};return _0xd335f;})});}_0x31d28c=_[_0xb4cc('0x31')]({},_0x31d28c,_0x1e7798[_0xb4cc('0x51')]);return _0x491aaa['getTeams'](_0x31d28c);}})[_0xb4cc('0x17')](function(_0x196409){if(_0x196409){_0x23bb10=_0x196409['length'];if(!_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x3f')](_0xb4cc('0x40'))){_0x31d28c[_0xb4cc('0x11')]=qs[_0xb4cc('0x11')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x11')]);_0x31d28c[_0xb4cc('0x13')]=qs[_0xb4cc('0x13')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x13')]);}return _0x491aaa[_0xb4cc('0x4f')](_0x31d28c);}})[_0xb4cc('0x17')](function(_0x1ba8c0){if(_0x1ba8c0){return _0x1ba8c0?{'count':_0x23bb10,'rows':_0x1ba8c0}:null;}})[_0xb4cc('0x17')](respondWithResult(_0xc2a99c,null))['catch'](handleError(_0xc2a99c,null));};exports[_0xb4cc('0x52')]=function(_0x15fb52,_0x3632f3){var _0x17ea2e=_0x15fb52[_0xb4cc('0x34')][_0xb4cc('0x53')];return db['Team'][_0xb4cc('0x46')]({'where':{'id':_0x17ea2e},'attributes':['id'],'include':[{'model':db[_0xb4cc('0x47')],'as':'Agents','attributes':['id',_0xb4cc('0x39'),_0xb4cc('0x54'),_0xb4cc('0x55'),_0xb4cc('0x56')],'raw':!![]}]})[_0xb4cc('0x17')](function(_0x35fcca){if(_0x35fcca){var _0x405dd2=_[_0xb4cc('0x57')](_0x35fcca,function(_0x5592d3){var _0xfa6816=_0x5592d3[_0xb4cc('0x35')]({'plain':!![]});return _0xfa6816[_0xb4cc('0x58')];});return db[_0xb4cc('0x24')][_0xb4cc('0x32')]({'where':{'id':_0x15fb52['params']['id']}})[_0xb4cc('0x17')](function(_0x27b9b){return db[_0xb4cc('0x59')][_0xb4cc('0x5a')](function(_0x46fd76){return _0x27b9b[_0xb4cc('0x52')](_0x17ea2e,{'transaction':_0x46fd76})[_0xb4cc('0x17')](function(){return BPromise[_0xb4cc('0x5b')](_0x405dd2,function(_0x51a63f){return db['UserFaxQueue'][_0xb4cc('0x5c')]({'where':{'UserId':_0x51a63f['id'],'FaxQueueId':_0x15fb52['params']['id']},'transaction':_0x46fd76});});})[_0xb4cc('0x17')](function(){_0x405dd2[_0xb4cc('0x5d')](function(_0x5e47a2){socket[_0xb4cc('0x5e')]('userFaxQueue:save',{'UserId':_0x5e47a2['id'],'FaxQueueId':_0x27b9b['id']});});});});});}})[_0xb4cc('0x17')](respondWithStatusCode(_0x3632f3,null))['catch'](handleError(_0x3632f3,null));};exports[_0xb4cc('0x5f')]=function(_0x5138c2,_0x1ce412){return db[_0xb4cc('0x60')][_0xb4cc('0x46')]({'where':{'id':_0x5138c2[_0xb4cc('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb4cc('0x47')],'as':_0xb4cc('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ce412,null))[_0xb4cc('0x17')](function(_0x3edef8){var _0x4d5531=_['map'](_0x3edef8,'id');var _0x5bdbab=[];var _0x5c6323=[];var _0x42b62d=squel[_0xb4cc('0x61')]();_0x42b62d['field'](_0xb4cc('0x62'))[_0xb4cc('0x63')](_0xb4cc('0x64'),'tq')[_0xb4cc('0x65')]('user_has_teams','ut',_0xb4cc('0x66'))[_0xb4cc('0x23')]('FaxQueueId\x20=\x20?',_0x5138c2[_0xb4cc('0x3c')]['id']);for(var _0x154f7a=0x0;_0x154f7a<_0x3edef8[_0xb4cc('0x2f')];_0x154f7a+=0x1){let _0x482de7=_0x3edef8[_0x154f7a];for(var _0x19f329=0x0;_0x19f329<_0x482de7[_0xb4cc('0x58')][_0xb4cc('0x2f')];_0x19f329+=0x1){let _0x403716=_0x482de7['Agents'][_0x19f329];var _0x44e9d0=_0x42b62d['clone']();_0x44e9d0[_0xb4cc('0x23')](_0xb4cc('0x67'),_0x403716['id']);_0x5c6323[_0xb4cc('0x68')](db[_0xb4cc('0x59')][_0xb4cc('0x26')](_0x44e9d0[_0xb4cc('0x69')](),{'type':db[_0xb4cc('0x59')]['QueryTypes'][_0xb4cc('0x6a')]})['then'](function(_0x23e30c){if(_0x23e30c[_0xb4cc('0x2f')]===0x1){return _0x403716['id'];}else{var _0x402743=_[_0xb4cc('0x6b')](_[_0xb4cc('0x45')](_0x23e30c,_0xb4cc('0x6c')),function(_0x3d2326){return _[_0xb4cc('0x6d')](_0x4d5531,_0x3d2326);});if(_0x402743){return _0x403716['id'];}}}));}}return BPromise[_0xb4cc('0x6e')](_0x5c6323)[_0xb4cc('0x17')](function(_0x4f2bc6){_0x5bdbab=_(_0x5bdbab)[_0xb4cc('0x6f')](_0x4f2bc6)[_0xb4cc('0x70')]()['value']();return db['FaxQueue'][_0xb4cc('0x32')]({'where':{'id':_0x5138c2[_0xb4cc('0x3c')]['id']}})[_0xb4cc('0x17')](function(_0x363e75){return db[_0xb4cc('0x59')][_0xb4cc('0x5a')](function(_0x221307){return _0x363e75[_0xb4cc('0x5f')](_0x5138c2[_0xb4cc('0x26')][_0xb4cc('0x53')],{'transaction':_0x221307})[_0xb4cc('0x17')](function(){if(!_[_0xb4cc('0x71')](_0x5bdbab)){return _0x363e75['removeAgents'](_0x5bdbab,{'transaction':_0x221307});}})['then'](function(){_0x5bdbab[_0xb4cc('0x5d')](function(_0x31eda6){socket['emit'](_0xb4cc('0x72'),{'UserId':_0x31eda6,'FaxQueueId':_0x363e75['id']});});});});});});})['then'](respondWithStatusCode(_0x1ce412,null))[_0xb4cc('0x3b')](handleError(_0x1ce412,null));};exports[_0xb4cc('0x73')]=function(_0x1a211e,_0x3fadaf){return db[_0xb4cc('0x24')][_0xb4cc('0x32')]({'where':{'id':_0x1a211e[_0xb4cc('0x3c')]['id']}})[_0xb4cc('0x17')](handleEntityNotFound(_0x3fadaf,null))[_0xb4cc('0x17')](function(_0x281118){if(_0x281118){return _0x281118[_0xb4cc('0x73')](_0x1a211e['body'][_0xb4cc('0x53')],_[_0xb4cc('0x74')](_0x1a211e[_0xb4cc('0x34')],[_0xb4cc('0x53'),'id'])||{})[_0xb4cc('0x75')](function(_0xa4abb8){for(var _0x36863e=0x0;_0x36863e<_0x1a211e[_0xb4cc('0x34')][_0xb4cc('0x53')][_0xb4cc('0x2f')];_0x36863e+=0x1){socket[_0xb4cc('0x5e')]('userFaxQueue:save',{'UserId':Number(_0x1a211e[_0xb4cc('0x34')][_0xb4cc('0x53')][_0x36863e]),'FaxQueueId':Number(_0x1a211e[_0xb4cc('0x3c')]['id'])});}return _0xa4abb8;});}})[_0xb4cc('0x17')](respondWithResult(_0x3fadaf,null))[_0xb4cc('0x3b')](handleError(_0x3fadaf,null));};exports[_0xb4cc('0x76')]=function(_0x598ac6,_0x236bc3){return db['FaxQueue']['find']({'where':{'id':_0x598ac6[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x236bc3,null))['then'](function(_0x486a1d){if(_0x486a1d){return _0x486a1d['removeAgents'](_0x598ac6[_0xb4cc('0x26')][_0xb4cc('0x53')])[_0xb4cc('0x17')](function(){if(_['isArray'](_0x598ac6[_0xb4cc('0x26')]['ids'])){for(var _0x4d6c67=0x0;_0x4d6c67<_0x598ac6[_0xb4cc('0x26')]['ids'][_0xb4cc('0x2f')];_0x4d6c67+=0x1){socket[_0xb4cc('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x598ac6[_0xb4cc('0x26')][_0xb4cc('0x53')][_0x4d6c67]),'FaxQueueId':Number(_0x598ac6[_0xb4cc('0x3c')]['id'])});}}else{socket[_0xb4cc('0x5e')](_0xb4cc('0x72'),{'UserId':Number(_0x598ac6[_0xb4cc('0x26')][_0xb4cc('0x53')]),'FaxQueueId':Number(_0x598ac6[_0xb4cc('0x3c')]['id'])});}});}})[_0xb4cc('0x17')](respondWithStatusCode(_0x236bc3,null))['catch'](handleError(_0x236bc3,null));};exports[_0xb4cc('0x77')]=function(_0x11c9dc,_0x11e57b){var _0x2092b3={};var _0x5cbdf8={};var _0x51061b;var _0x2c49f3;return db[_0xb4cc('0x24')]['findOne']({'where':{'id':_0x11c9dc['params']['id']}})[_0xb4cc('0x17')](handleEntityNotFound(_0x11e57b,null))[_0xb4cc('0x17')](function(_0x2894e1){if(_0x2894e1){_0x51061b=_0x2894e1;_0x5cbdf8[_0xb4cc('0x29')]=_['keys'](db[_0xb4cc('0x47')]['rawAttributes']);_0x5cbdf8[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x11c9dc[_0xb4cc('0x26')]);_0x5cbdf8[_0xb4cc('0x2b')]=_['intersection'](_0x5cbdf8[_0xb4cc('0x29')],_0x5cbdf8[_0xb4cc('0x26')]);_0x2092b3['attributes']=_['intersection'](_0x5cbdf8[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x11c9dc['query'][_0xb4cc('0x2e')]));_0x2092b3[_0xb4cc('0x2d')]=_0x2092b3[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x2092b3[_0xb4cc('0x2d')]:_0x5cbdf8[_0xb4cc('0x29')];_0x2092b3[_0xb4cc('0x41')]=qs[_0xb4cc('0x42')](_0x11c9dc[_0xb4cc('0x26')][_0xb4cc('0x42')]);_0x2092b3[_0xb4cc('0x23')]=qs[_0xb4cc('0x2b')](_[_0xb4cc('0x43')](_0x11c9dc[_0xb4cc('0x26')],_0x5cbdf8[_0xb4cc('0x2b')]));if(_0x11c9dc[_0xb4cc('0x26')][_0xb4cc('0x44')]){_0x2092b3['where']=_[_0xb4cc('0x31')](_0x2092b3[_0xb4cc('0x23')],{'$or':_['map'](_0x2092b3[_0xb4cc('0x2d')],function(_0x1fb015){var _0x55ee58={};_0x55ee58[_0x1fb015]={'$like':'%'+_0x11c9dc[_0xb4cc('0x26')]['filter']+'%'};return _0x55ee58;})});}_0x2092b3=_[_0xb4cc('0x31')]({},_0x2092b3,_0x11c9dc[_0xb4cc('0x51')]);return _0x51061b['getAgents'](_0x2092b3);}})[_0xb4cc('0x17')](function(_0x4121da){if(_0x4121da){_0x2c49f3=_0x4121da[_0xb4cc('0x2f')];if(!_0x11c9dc['query'][_0xb4cc('0x3f')]('nolimit')){_0x2092b3['limit']=qs['limit'](_0x11c9dc[_0xb4cc('0x26')]['limit']);_0x2092b3['offset']=qs['offset'](_0x11c9dc[_0xb4cc('0x26')][_0xb4cc('0x13')]);}return _0x51061b['getAgents'](_0x2092b3);}})['then'](function(_0x1ab8c2){if(_0x1ab8c2){return _0x1ab8c2?{'count':_0x2c49f3,'rows':_0x1ab8c2}:null;}})[_0xb4cc('0x17')](respondWithResult(_0x11e57b,null))['catch'](handleError(_0x11e57b,null));}; \ No newline at end of file +var _0x90b5=['user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','hasOwnProperty','order','sort','FaxQueueId','filter','merge','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','pick','nolimit','ids','Agents','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','compact','value','transaction','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','get','FaxQueues','destroy','error','stack','name','map','FaxQueue','fieldName','type','key','getOptions','where','include','findAll','show','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','options','find','create','role'];(function(_0x94b286,_0x47f8c2){var _0x49148b=function(_0x1c2766){while(--_0x1c2766){_0x94b286['push'](_0x94b286['shift']());}};_0x49148b(++_0x47f8c2);}(_0x90b5,0x139));var _0x590b=function(_0xf9e6c1,_0x350daa){_0xf9e6c1=_0xf9e6c1-0x0;var _0x20ba02=_0x90b5[_0xf9e6c1];return _0x20ba02;};'use strict';var BPromise=require(_0x590b('0x0'));var util=require('util');var _=require(_0x590b('0x1'));var squel=require(_0x590b('0x2'));var Redis=require(_0x590b('0x3'));var qs=require(_0x590b('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x590b('0x5'));var db=require(_0x590b('0x6'))['db'];config['redis']=_[_0x590b('0x7')](config[_0x590b('0x8')],{'host':_0x590b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x590b('0x8')]));require(_0x590b('0xa'))[_0x590b('0xb')](socket);function respondWithStatusCode(_0x9c408b,_0x450969){_0x450969=_0x450969||0xcc;return function(_0x268b0a){if(_0x268b0a){return _0x9c408b[_0x590b('0xc')](_0x450969);}return _0x9c408b[_0x590b('0xd')](_0x450969)[_0x590b('0xe')]();};}function respondWithResult(_0x50a7b8,_0x5e567){_0x5e567=_0x5e567||0xc8;return function(_0x381bfe){if(_0x381bfe){return _0x50a7b8['status'](_0x5e567)[_0x590b('0xf')](_0x381bfe);}};}function respondWithFilteredResult(_0x4a5939,_0x392467){return function(_0x311c9d){if(_0x311c9d){var _0x8173c2=typeof _0x392467[_0x590b('0x10')]==='undefined'&&typeof _0x392467[_0x590b('0x11')]===_0x590b('0x12');var _0x88865c=_0x311c9d[_0x590b('0x13')];var _0x2e85b1=_0x8173c2?0x0:_0x392467[_0x590b('0x10')];var _0x45ac04=_0x8173c2?_0x311c9d[_0x590b('0x13')]:_0x392467[_0x590b('0x10')]+_0x392467[_0x590b('0x11')];var _0x3fc5ca;if(_0x45ac04>=_0x88865c){_0x45ac04=_0x88865c;_0x3fc5ca=0xc8;}else{_0x3fc5ca=0xce;}_0x4a5939[_0x590b('0xd')](_0x3fc5ca);return _0x4a5939[_0x590b('0x14')](_0x590b('0x15'),_0x2e85b1+'-'+_0x45ac04+'/'+_0x88865c)[_0x590b('0xf')](_0x311c9d);}return null;};}function saveUpdates(_0x4f2512){return function(_0x1ec65a){if(_0x1ec65a){return _0x1ec65a['update'](_0x4f2512)[_0x590b('0x16')](function(_0x115309){return _0x115309;});}return null;};}function removeEntity(_0xf05b00){return function(_0x53337c){if(_0x53337c){return _0x53337c['destroy']()[_0x590b('0x16')](function(){var _0x4f39e8=_0x53337c[_0x590b('0x17')]({'plain':!![]});var _0x4e4cc6=_0x590b('0x18');return db['UserProfileResource'][_0x590b('0x19')]({'where':{'type':_0x4e4cc6,'resourceId':_0x4f39e8['id']}})[_0x590b('0x16')](function(){return _0x53337c;});})[_0x590b('0x16')](function(){_0xf05b00[_0x590b('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7c94ee){return function(_0x5839b7){if(!_0x5839b7){_0x7c94ee[_0x590b('0xc')](0x194);}return _0x5839b7;};}function handleError(_0x30dc9f,_0x5bdaba){_0x5bdaba=_0x5bdaba||0x1f4;return function(_0x5d47a6){logger[_0x590b('0x1a')](_0x5d47a6[_0x590b('0x1b')]);if(_0x5d47a6['name']){delete _0x5d47a6[_0x590b('0x1c')];}_0x30dc9f[_0x590b('0xd')](_0x5bdaba)['send'](_0x5d47a6);};}exports['index']=function(_0x26f073,_0x49c3f5){var _0x39fead={};var _0x520095={'count':0x0,'rows':[]};var _0x4d3ff9=_[_0x590b('0x1d')](db[_0x590b('0x1e')]['rawAttributes'],function(_0x1febcd){return{'name':_0x1febcd[_0x590b('0x1f')],'type':_0x1febcd[_0x590b('0x20')][_0x590b('0x21')]};});_0x39fead=qs[_0x590b('0x22')](_0x4d3ff9,_0x26f073);var _0x5c5903={'where':_0x39fead[_0x590b('0x23')]};return db[_0x590b('0x1e')][_0x590b('0x13')](_0x5c5903)[_0x590b('0x16')](function(_0x1ee769){_0x520095[_0x590b('0x13')]=_0x1ee769;_0x39fead['include']=qs[_0x590b('0x24')](_0x26f073['query']);return db[_0x590b('0x1e')][_0x590b('0x25')](_0x39fead);})[_0x590b('0x16')](function(_0x33931e){_0x520095['rows']=_0x33931e;return _0x520095;})[_0x590b('0x16')](respondWithFilteredResult(_0x49c3f5,_0x39fead))['catch'](handleError(_0x49c3f5,null));};exports[_0x590b('0x26')]=function(_0x369e63,_0x2ea853){var _0x1da455={'raw':!![],'where':{'id':_0x369e63['params']['id']}},_0x46aebb={};_0x46aebb[_0x590b('0x27')]=_[_0x590b('0x28')](db[_0x590b('0x1e')][_0x590b('0x29')]);_0x46aebb['query']=_['keys'](_0x369e63[_0x590b('0x2a')]);_0x46aebb[_0x590b('0x2b')]=_[_0x590b('0x2c')](_0x46aebb[_0x590b('0x27')],_0x46aebb['query']);_0x1da455['attributes']=_[_0x590b('0x2c')](_0x46aebb['model'],qs[_0x590b('0x2d')](_0x369e63[_0x590b('0x2a')][_0x590b('0x2d')]));_0x1da455[_0x590b('0x2e')]=_0x1da455[_0x590b('0x2e')][_0x590b('0x2f')]?_0x1da455[_0x590b('0x2e')]:_0x46aebb[_0x590b('0x27')];if(_0x369e63[_0x590b('0x2a')][_0x590b('0x30')]){_0x1da455['include']=[{'all':!![]}];}_0x1da455=_['merge']({},_0x1da455,_0x369e63[_0x590b('0x31')]);return db[_0x590b('0x1e')][_0x590b('0x32')](_0x1da455)[_0x590b('0x16')](handleEntityNotFound(_0x2ea853,null))[_0x590b('0x16')](respondWithResult(_0x2ea853,null))['catch'](handleError(_0x2ea853,null));};exports[_0x590b('0x33')]=function(_0x69be0a,_0x3e5ca5){return db[_0x590b('0x1e')][_0x590b('0x33')](_0x69be0a['body'],{})[_0x590b('0x16')](function(_0x2fd86b){var _0x4e3f84=_0x69be0a['user'][_0x590b('0x17')]({'plain':!![]});if(!_0x4e3f84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e3f84[_0x590b('0x34')]===_0x590b('0x35')){var _0x3e83da=_0x2fd86b[_0x590b('0x17')]({'plain':!![]});var _0x210af8=_0x590b('0x18');return db[_0x590b('0x36')][_0x590b('0x32')]({'where':{'name':_0x210af8,'userProfileId':_0x4e3f84[_0x590b('0x37')]},'raw':!![]})[_0x590b('0x16')](function(_0x593b35){if(_0x593b35&&_0x593b35[_0x590b('0x38')]===0x0){return db[_0x590b('0x39')][_0x590b('0x33')]({'name':_0x3e83da['name'],'resourceId':_0x3e83da['id'],'type':_0x593b35[_0x590b('0x1c')],'sectionId':_0x593b35['id']},{})[_0x590b('0x16')](function(){return _0x2fd86b;});}else{return _0x2fd86b;}})[_0x590b('0x3a')](function(_0x114bbe){logger[_0x590b('0x1a')](_0x590b('0x3b'),_0x114bbe);throw _0x114bbe;});}return _0x2fd86b;})[_0x590b('0x16')](respondWithResult(_0x3e5ca5,0xc9))[_0x590b('0x3a')](handleError(_0x3e5ca5,null));};exports['update']=function(_0x7da2e3,_0x5984c0){if(_0x7da2e3[_0x590b('0x3c')]['id']){delete _0x7da2e3[_0x590b('0x3c')]['id'];}return db[_0x590b('0x1e')]['find']({'where':{'id':_0x7da2e3[_0x590b('0x3d')]['id']}})[_0x590b('0x16')](handleEntityNotFound(_0x5984c0,null))[_0x590b('0x16')](saveUpdates(_0x7da2e3[_0x590b('0x3c')],null))['then'](respondWithResult(_0x5984c0,null))[_0x590b('0x3a')](handleError(_0x5984c0,null));};exports[_0x590b('0x19')]=function(_0x4f9d8e,_0x48c7da){return db['FaxQueue'][_0x590b('0x32')]({'where':{'id':_0x4f9d8e[_0x590b('0x3d')]['id']}})[_0x590b('0x16')](handleEntityNotFound(_0x48c7da,null))['then'](removeEntity(_0x48c7da,null))['catch'](handleError(_0x48c7da,null));};exports[_0x590b('0x3e')]=function(_0x187db5,_0x53a19b){return db[_0x590b('0x1e')][_0x590b('0x3e')]()[_0x590b('0x16')](respondWithResult(_0x53a19b,null))[_0x590b('0x3a')](handleError(_0x53a19b,null));};exports[_0x590b('0x3f')]=function(_0x25ae14,_0x2050f3){var _0x67f695={'raw':!![],'where':{}},_0x2e92e7={},_0x30570;return db[_0x590b('0x1e')][_0x590b('0x40')]({'where':{'id':_0x25ae14[_0x590b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2050f3,null))['then'](function(_0x1a92fb){if(_0x1a92fb){_0x30570=_0x1a92fb[_0x590b('0x17')]({'plain':!![]});_0x2e92e7[_0x590b('0x27')]=_[_0x590b('0x28')](db['UserFaxQueue'][_0x590b('0x29')]);_0x2e92e7[_0x590b('0x2a')]=_[_0x590b('0x28')](_0x25ae14['query']);_0x2e92e7[_0x590b('0x2b')]=_[_0x590b('0x2c')](_0x2e92e7['model'],_0x2e92e7['query']);_0x67f695[_0x590b('0x2e')]=_[_0x590b('0x2c')](_0x2e92e7['model'],qs[_0x590b('0x2d')](_0x25ae14[_0x590b('0x2a')]['fields']));_0x67f695[_0x590b('0x2e')]=_0x67f695[_0x590b('0x2e')][_0x590b('0x2f')]?_0x67f695['attributes']:_0x2e92e7['model'];if(!_0x25ae14[_0x590b('0x2a')][_0x590b('0x41')]('nolimit')){_0x67f695[_0x590b('0x11')]=qs[_0x590b('0x11')](_0x25ae14[_0x590b('0x2a')][_0x590b('0x11')]);_0x67f695[_0x590b('0x10')]=qs[_0x590b('0x10')](_0x25ae14[_0x590b('0x2a')]['offset']);}_0x67f695[_0x590b('0x42')]=qs['sort'](_0x25ae14[_0x590b('0x2a')][_0x590b('0x43')]);_0x67f695[_0x590b('0x23')]=qs['filters'](_['pick'](_0x25ae14[_0x590b('0x2a')],_0x2e92e7[_0x590b('0x2b')]));_0x67f695[_0x590b('0x23')][_0x590b('0x44')]=_0x1a92fb['id'];if(_0x25ae14['query'][_0x590b('0x45')]){_0x67f695['where']=_['merge'](_0x67f695[_0x590b('0x23')],{'$or':_['map'](_0x67f695[_0x590b('0x2e')],function(_0x5663ef){var _0x153aca={};_0x153aca[_0x5663ef]={'$like':'%'+_0x25ae14['query'][_0x590b('0x45')]+'%'};return _0x153aca;})});}_0x67f695=_[_0x590b('0x46')]({},_0x67f695,_0x25ae14[_0x590b('0x31')]);return db[_0x590b('0x47')][_0x590b('0x25')](_0x67f695);}})[_0x590b('0x16')](function(_0x2d9f0d){if(_0x2d9f0d){return db[_0x590b('0x48')][_0x590b('0x49')]({'where':{'id':_['map'](_0x2d9f0d,_0x590b('0x4a')),'role':_0x590b('0x4b')},'attributes':['id','name',_0x590b('0x4c'),_0x590b('0x4d'),_0x590b('0x4e')]});}})[_0x590b('0x16')](function(_0x57e442){if(_0x57e442){return{'count':_0x57e442[_0x590b('0x13')],'rows':_[_0x590b('0x1d')](_0x57e442[_0x590b('0x4f')],function(_0x20eaf6){return{'membername':_0x20eaf6['name'],'UserId':_0x20eaf6['id'],'queue_name':_0x30570[_0x590b('0x1c')],'FaxQueueId':_0x30570['id'],'interface':util['format'](_0x590b('0x50'),_0x590b('0x51'),_0x20eaf6[_0x590b('0x1c')]),'penalty':0x0,'paused':_0x20eaf6[_0x590b('0x4c')],'createdAt':_0x20eaf6['createdAt'],'updatedAt':_0x20eaf6[_0x590b('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2050f3,_0x67f695))[_0x590b('0x3a')](handleError(_0x2050f3,null));};exports[_0x590b('0x52')]=function(_0x3ef6d3,_0x556276){var _0x2dff4f={};var _0x48f49a={};var _0x1b0cbb;var _0x4f22da;return db[_0x590b('0x1e')][_0x590b('0x40')]({'where':{'id':_0x3ef6d3[_0x590b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x556276,null))['then'](function(_0x38bdde){if(_0x38bdde){_0x1b0cbb=_0x38bdde;_0x48f49a[_0x590b('0x27')]=_[_0x590b('0x28')](db[_0x590b('0x53')]['rawAttributes']);_0x48f49a[_0x590b('0x2a')]=_['keys'](_0x3ef6d3[_0x590b('0x2a')]);_0x48f49a[_0x590b('0x2b')]=_[_0x590b('0x2c')](_0x48f49a[_0x590b('0x27')],_0x48f49a[_0x590b('0x2a')]);_0x2dff4f['attributes']=_['intersection'](_0x48f49a[_0x590b('0x27')],qs['fields'](_0x3ef6d3['query'][_0x590b('0x2d')]));_0x2dff4f[_0x590b('0x2e')]=_0x2dff4f['attributes'][_0x590b('0x2f')]?_0x2dff4f[_0x590b('0x2e')]:_0x48f49a['model'];_0x2dff4f[_0x590b('0x42')]=qs[_0x590b('0x43')](_0x3ef6d3['query'][_0x590b('0x43')]);_0x2dff4f['where']=qs[_0x590b('0x2b')](_[_0x590b('0x54')](_0x3ef6d3[_0x590b('0x2a')],_0x48f49a['filters']));if(_0x3ef6d3[_0x590b('0x2a')][_0x590b('0x45')]){_0x2dff4f[_0x590b('0x23')]=_[_0x590b('0x46')](_0x2dff4f['where'],{'$or':_[_0x590b('0x1d')](_0x2dff4f[_0x590b('0x2e')],function(_0x4aa511){var _0x151e6={};_0x151e6[_0x4aa511]={'$like':'%'+_0x3ef6d3['query'][_0x590b('0x45')]+'%'};return _0x151e6;})});}_0x2dff4f=_[_0x590b('0x46')]({},_0x2dff4f,_0x3ef6d3[_0x590b('0x31')]);return _0x1b0cbb[_0x590b('0x52')](_0x2dff4f);}})[_0x590b('0x16')](function(_0x2fc424){if(_0x2fc424){_0x4f22da=_0x2fc424[_0x590b('0x2f')];if(!_0x3ef6d3[_0x590b('0x2a')]['hasOwnProperty'](_0x590b('0x55'))){_0x2dff4f[_0x590b('0x11')]=qs[_0x590b('0x11')](_0x3ef6d3[_0x590b('0x2a')]['limit']);_0x2dff4f['offset']=qs[_0x590b('0x10')](_0x3ef6d3[_0x590b('0x2a')]['offset']);}return _0x1b0cbb[_0x590b('0x52')](_0x2dff4f);}})[_0x590b('0x16')](function(_0x2bbfff){if(_0x2bbfff){return _0x2bbfff?{'count':_0x4f22da,'rows':_0x2bbfff}:null;}})['then'](respondWithResult(_0x556276,null))[_0x590b('0x3a')](handleError(_0x556276,null));};exports['addTeams']=function(_0x43dedf,_0x4b7d4b){var _0x4a46fc=_0x43dedf[_0x590b('0x3c')][_0x590b('0x56')];return db['Team'][_0x590b('0x25')]({'where':{'id':_0x4a46fc},'attributes':['id'],'include':[{'model':db[_0x590b('0x48')],'as':_0x590b('0x57'),'attributes':['id',_0x590b('0x1c'),'online',_0x590b('0x58'),_0x590b('0x59')],'raw':!![]}]})[_0x590b('0x16')](function(_0x5e158b){if(_0x5e158b){var _0x1be3fc=_[_0x590b('0x5a')](_0x5e158b,function(_0x251272){var _0xfa8e7d=_0x251272[_0x590b('0x17')]({'plain':!![]});return _0xfa8e7d['Agents'];});return db[_0x590b('0x1e')]['find']({'where':{'id':_0x43dedf[_0x590b('0x3d')]['id']}})[_0x590b('0x16')](function(_0x24b0cd){return db[_0x590b('0x5b')]['transaction'](function(_0x2d1709){return _0x24b0cd[_0x590b('0x5c')](_0x4a46fc,{'transaction':_0x2d1709})[_0x590b('0x16')](function(){return BPromise['each'](_0x1be3fc,function(_0x384382){return db[_0x590b('0x47')][_0x590b('0x5d')]({'where':{'UserId':_0x384382['id'],'FaxQueueId':_0x43dedf[_0x590b('0x3d')]['id']},'transaction':_0x2d1709});});})[_0x590b('0x16')](function(){_0x1be3fc['forEach'](function(_0x31db81){socket[_0x590b('0x5e')]('userFaxQueue:save',{'UserId':_0x31db81['id'],'FaxQueueId':_0x24b0cd['id']});});});});});}})['then'](respondWithStatusCode(_0x4b7d4b,null))['catch'](handleError(_0x4b7d4b,null));};exports[_0x590b('0x5f')]=function(_0x1e6e11,_0x5dfe32){return db['Team'][_0x590b('0x25')]({'where':{'id':_0x1e6e11['query'][_0x590b('0x56')]},'attributes':['id'],'include':[{'model':db[_0x590b('0x48')],'as':_0x590b('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5dfe32,null))[_0x590b('0x16')](function(_0x19c313){var _0x2b84e3=_['map'](_0x19c313,'id');var _0x18b10f=[];var _0x3d1617=[];var _0x437755=squel['select']();_0x437755[_0x590b('0x60')](_0x590b('0x61'))[_0x590b('0x62')](_0x590b('0x63'),'tq')['join'](_0x590b('0x64'),'ut',_0x590b('0x65'))[_0x590b('0x23')](_0x590b('0x66'),_0x1e6e11[_0x590b('0x3d')]['id']);for(var _0x6519b=0x0;_0x6519b<_0x19c313['length'];_0x6519b+=0x1){let _0x20baa9=_0x19c313[_0x6519b];for(var _0x44f649=0x0;_0x44f649<_0x20baa9[_0x590b('0x57')][_0x590b('0x2f')];_0x44f649+=0x1){let _0x15b162=_0x20baa9['Agents'][_0x44f649];var _0x1da0af=_0x437755[_0x590b('0x67')]();_0x1da0af[_0x590b('0x23')]('ut.UserId\x20=\x20?',_0x15b162['id']);_0x3d1617['push'](db[_0x590b('0x5b')][_0x590b('0x2a')](_0x1da0af[_0x590b('0x68')](),{'type':db[_0x590b('0x5b')][_0x590b('0x69')]['SELECT']})[_0x590b('0x16')](function(_0x616cdf){if(_0x616cdf['length']===0x1){return _0x15b162['id'];}else{var _0xa3f06f=_[_0x590b('0x6a')](_['map'](_0x616cdf,_0x590b('0x6b')),function(_0x2cf317){return _[_0x590b('0x6c')](_0x2b84e3,_0x2cf317);});if(_0xa3f06f){return _0x15b162['id'];}}}));}}return BPromise[_0x590b('0x6d')](_0x3d1617)[_0x590b('0x16')](function(_0x6281dc){_0x18b10f=_(_0x18b10f)['union'](_0x6281dc)[_0x590b('0x6e')]()[_0x590b('0x6f')]();return db['FaxQueue'][_0x590b('0x32')]({'where':{'id':_0x1e6e11[_0x590b('0x3d')]['id']}})[_0x590b('0x16')](function(_0x5357f1){return db[_0x590b('0x5b')][_0x590b('0x70')](function(_0x524a65){return _0x5357f1['removeTeams'](_0x1e6e11['query'][_0x590b('0x56')],{'transaction':_0x524a65})[_0x590b('0x16')](function(){if(!_['isEmpty'](_0x18b10f)){return _0x5357f1[_0x590b('0x71')](_0x18b10f,{'transaction':_0x524a65});}})[_0x590b('0x16')](function(){_0x18b10f[_0x590b('0x72')](function(_0x1ef93c){socket[_0x590b('0x5e')](_0x590b('0x73'),{'UserId':_0x1ef93c,'FaxQueueId':_0x5357f1['id']});});});});});});})[_0x590b('0x16')](respondWithStatusCode(_0x5dfe32,null))[_0x590b('0x3a')](handleError(_0x5dfe32,null));};exports[_0x590b('0x74')]=function(_0x303f7c,_0x5efc21){return db[_0x590b('0x1e')][_0x590b('0x32')]({'where':{'id':_0x303f7c[_0x590b('0x3d')]['id']}})[_0x590b('0x16')](handleEntityNotFound(_0x5efc21,null))[_0x590b('0x16')](function(_0x2a01ec){if(_0x2a01ec){return _0x2a01ec[_0x590b('0x74')](_0x303f7c[_0x590b('0x3c')][_0x590b('0x56')],_[_0x590b('0x75')](_0x303f7c[_0x590b('0x3c')],['ids','id'])||{})[_0x590b('0x76')](function(_0x2981bf){for(var _0x265b75=0x0;_0x265b75<_0x303f7c[_0x590b('0x3c')][_0x590b('0x56')][_0x590b('0x2f')];_0x265b75+=0x1){socket[_0x590b('0x5e')](_0x590b('0x77'),{'UserId':Number(_0x303f7c[_0x590b('0x3c')]['ids'][_0x265b75]),'FaxQueueId':Number(_0x303f7c[_0x590b('0x3d')]['id'])});}return _0x2981bf;});}})[_0x590b('0x16')](respondWithResult(_0x5efc21,null))[_0x590b('0x3a')](handleError(_0x5efc21,null));};exports[_0x590b('0x71')]=function(_0x388b80,_0x54f273){return db[_0x590b('0x1e')][_0x590b('0x32')]({'where':{'id':_0x388b80[_0x590b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x54f273,null))['then'](function(_0x3c1365){if(_0x3c1365){return _0x3c1365[_0x590b('0x71')](_0x388b80[_0x590b('0x2a')][_0x590b('0x56')])[_0x590b('0x16')](function(){if(_[_0x590b('0x78')](_0x388b80[_0x590b('0x2a')][_0x590b('0x56')])){for(var _0x3baa48=0x0;_0x3baa48<_0x388b80['query']['ids'][_0x590b('0x2f')];_0x3baa48+=0x1){socket['emit'](_0x590b('0x73'),{'UserId':Number(_0x388b80[_0x590b('0x2a')][_0x590b('0x56')][_0x3baa48]),'FaxQueueId':Number(_0x388b80['params']['id'])});}}else{socket[_0x590b('0x5e')](_0x590b('0x73'),{'UserId':Number(_0x388b80[_0x590b('0x2a')]['ids']),'FaxQueueId':Number(_0x388b80[_0x590b('0x3d')]['id'])});}});}})[_0x590b('0x16')](respondWithStatusCode(_0x54f273,null))[_0x590b('0x3a')](handleError(_0x54f273,null));};exports['getAgents']=function(_0x182ab4,_0x316ca2){var _0x608ff6={};var _0x253e8e={};var _0x373582;var _0x567f33;return db['FaxQueue'][_0x590b('0x40')]({'where':{'id':_0x182ab4[_0x590b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x316ca2,null))[_0x590b('0x16')](function(_0x36562e){if(_0x36562e){_0x373582=_0x36562e;_0x253e8e[_0x590b('0x27')]=_[_0x590b('0x28')](db[_0x590b('0x48')][_0x590b('0x29')]);_0x253e8e[_0x590b('0x2a')]=_[_0x590b('0x28')](_0x182ab4[_0x590b('0x2a')]);_0x253e8e[_0x590b('0x2b')]=_[_0x590b('0x2c')](_0x253e8e[_0x590b('0x27')],_0x253e8e[_0x590b('0x2a')]);_0x608ff6[_0x590b('0x2e')]=_[_0x590b('0x2c')](_0x253e8e[_0x590b('0x27')],qs['fields'](_0x182ab4['query'][_0x590b('0x2d')]));_0x608ff6['attributes']=_0x608ff6[_0x590b('0x2e')][_0x590b('0x2f')]?_0x608ff6[_0x590b('0x2e')]:_0x253e8e[_0x590b('0x27')];_0x608ff6[_0x590b('0x42')]=qs['sort'](_0x182ab4[_0x590b('0x2a')][_0x590b('0x43')]);_0x608ff6[_0x590b('0x23')]=qs[_0x590b('0x2b')](_[_0x590b('0x54')](_0x182ab4[_0x590b('0x2a')],_0x253e8e[_0x590b('0x2b')]));if(_0x182ab4[_0x590b('0x2a')][_0x590b('0x45')]){_0x608ff6[_0x590b('0x23')]=_[_0x590b('0x46')](_0x608ff6['where'],{'$or':_[_0x590b('0x1d')](_0x608ff6[_0x590b('0x2e')],function(_0xc3374c){var _0x4d8d39={};_0x4d8d39[_0xc3374c]={'$like':'%'+_0x182ab4[_0x590b('0x2a')][_0x590b('0x45')]+'%'};return _0x4d8d39;})});}_0x608ff6=_[_0x590b('0x46')]({},_0x608ff6,_0x182ab4[_0x590b('0x31')]);return _0x373582[_0x590b('0x79')](_0x608ff6);}})[_0x590b('0x16')](function(_0x196ce6){if(_0x196ce6){_0x567f33=_0x196ce6[_0x590b('0x2f')];if(!_0x182ab4[_0x590b('0x2a')]['hasOwnProperty'](_0x590b('0x55'))){_0x608ff6[_0x590b('0x11')]=qs[_0x590b('0x11')](_0x182ab4[_0x590b('0x2a')][_0x590b('0x11')]);_0x608ff6[_0x590b('0x10')]=qs[_0x590b('0x10')](_0x182ab4[_0x590b('0x2a')]['offset']);}return _0x373582['getAgents'](_0x608ff6);}})[_0x590b('0x16')](function(_0x49a273){if(_0x49a273){return _0x49a273?{'count':_0x567f33,'rows':_0x49a273}:null;}})[_0x590b('0x16')](respondWithResult(_0x316ca2,null))[_0x590b('0x3a')](handleError(_0x316ca2,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6ce3dc9..fa1ee8a 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 _0x408e=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','update'];(function(_0xb0e324,_0x16fb9){var _0xdf2335=function(_0x1cbbf7){while(--_0x1cbbf7){_0xb0e324['push'](_0xb0e324['shift']());}};_0xdf2335(++_0x16fb9);}(_0x408e,0xec));var _0xe408=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x408e[_0x2543d6];return _0x55213c;};'use strict';var EventEmitter=require(_0xe408('0x0'));var FaxQueue=require(_0xe408('0x1'))['db'][_0xe408('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe408('0x3'),'afterDestroy':_0xe408('0x4')};function emitEvent(_0x1b77a1){return function(_0x479d24,_0x5baf12,_0x268cd5){FaxQueueEvents['emit'](_0x1b77a1+':'+_0x479d24['id'],_0x479d24);FaxQueueEvents[_0xe408('0x5')](_0x1b77a1,_0x479d24);_0x268cd5(null);};}for(var e in events){if(events[_0xe408('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xe408('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xce40=['setMaxListeners','save','update','remove','hook','exports','events','../../mysqldb'];(function(_0x89d37a,_0x3116f5){var _0x51243c=function(_0x12f455){while(--_0x12f455){_0x89d37a['push'](_0x89d37a['shift']());}};_0x51243c(++_0x3116f5);}(_0xce40,0x16e));var _0x0ce4=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xce40[_0x45fc6a];return _0x14bcfd;};'use strict';var EventEmitter=require(_0x0ce4('0x0'));var FaxQueue=require(_0x0ce4('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0ce4('0x2')](0x0);var events={'afterCreate':_0x0ce4('0x3'),'afterUpdate':_0x0ce4('0x4'),'afterDestroy':_0x0ce4('0x5')};function emitEvent(_0x290d9a){return function(_0x987f37,_0x7ffc5d,_0x487718){FaxQueueEvents['emit'](_0x290d9a+':'+_0x987f37['id'],_0x987f37);FaxQueueEvents['emit'](_0x290d9a,_0x987f37);_0x487718(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x0ce4('0x6')](e,emitEvent(event));}}module[_0x0ce4('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 545055c..52fe306 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 _0x0984=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util'];(function(_0x3c9864,_0x488a3c){var _0x416dcd=function(_0x3f03d6){while(--_0x3f03d6){_0x3c9864['push'](_0x3c9864['shift']());}};_0x416dcd(++_0x488a3c);}(_0x0984,0x136));var _0x4098=function(_0x4b6314,_0x960a41){_0x4b6314=_0x4b6314-0x0;var _0x512faa=_0x0984[_0x4b6314];return _0x512faa;};'use strict';var _=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var logger=require(_0x4098('0x2'))('api');var moment=require(_0x4098('0x3'));var BPromise=require(_0x4098('0x4'));var rp=require(_0x4098('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4098('0x6'));var config=require(_0x4098('0x7'));var attributes=require(_0x4098('0x8'));module[_0x4098('0x9')]=function(_0x1206b1,_0x1ce6a2){return _0x1206b1[_0x4098('0xa')]('FaxQueue',attributes,{'tableName':_0x4098('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4c0=['../../config/logger','api','moment','request-promise','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x25e934,_0x4757dd){var _0x162c25=function(_0x5c8c4e){while(--_0x5c8c4e){_0x25e934['push'](_0x25e934['shift']());}};_0x162c25(++_0x4757dd);}(_0xf4c0,0x18b));var _0x0f4c=function(_0x56f958,_0x5ab381){_0x56f958=_0x56f958-0x0;var _0x3afefe=_0xf4c0[_0x56f958];return _0x3afefe;};'use strict';var _=require(_0x0f4c('0x0'));var util=require('util');var logger=require(_0x0f4c('0x1'))(_0x0f4c('0x2'));var moment=require(_0x0f4c('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f4c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0f4c('0x5'));var attributes=require(_0x0f4c('0x6'));module[_0x0f4c('0x7')]=function(_0x4e45c3,_0x74e678){return _0x4e45c3[_0x0f4c('0x8')](_0x0f4c('0x9'),attributes,{'tableName':_0x0f4c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index a3b4d30..1630e48 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 _0x668c=['FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowFaxQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue'];(function(_0x89862e,_0x56c579){var _0x145f25=function(_0x285679){while(--_0x285679){_0x89862e['push'](_0x89862e['shift']());}};_0x145f25(++_0x56c579);}(_0x668c,0x163));var _0xc668=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x668c[_0x26393b];return _0x57230a;};'use strict';var _=require('lodash');var util=require(_0xc668('0x0'));var moment=require(_0xc668('0x1'));var BPromise=require(_0xc668('0x2'));var rs=require(_0xc668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc668('0x5'))('rpc');var config=require(_0xc668('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc668('0x7')][_0xc668('0x8')]({'port':0x232a});config[_0xc668('0x9')]=_['defaults'](config[_0xc668('0x9')],{'host':_0xc668('0xa'),'port':0x18eb});var socket=require(_0xc668('0xb'))(new Redis(config[_0xc668('0x9')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x342ca4,_0x5f2074,_0x1cf446){return new BPromise(function(_0x4318f8,_0x41f815){return client[_0xc668('0xc')](_0x342ca4,_0x1cf446)['then'](function(_0x122cec){logger[_0xc668('0xd')]('FaxQueue,\x20%s,\x20%s',_0x5f2074,_0xc668('0xe'));logger[_0xc668('0xf')](_0xc668('0x10'),_0x5f2074,_0xc668('0xe'),JSON[_0xc668('0x11')](_0x122cec));if(_0x122cec[_0xc668('0x12')]){if(_0x122cec['error'][_0xc668('0x13')]===0x1f4){logger[_0xc668('0x12')](_0xc668('0x14'),_0x5f2074,_0x122cec[_0xc668('0x12')][_0xc668('0x15')]);return _0x41f815(_0x122cec['error'][_0xc668('0x15')]);}logger[_0xc668('0x12')](_0xc668('0x14'),_0x5f2074,_0x122cec[_0xc668('0x12')][_0xc668('0x15')]);return _0x4318f8(_0x122cec[_0xc668('0x12')]['message']);}else{logger[_0xc668('0xd')]('FaxQueue,\x20%s,\x20%s',_0x5f2074,_0xc668('0xe'));_0x4318f8(_0x122cec[_0xc668('0x16')][_0xc668('0x15')]);}})[_0xc668('0x17')](function(_0x211a63){logger[_0xc668('0x12')](_0xc668('0x14'),_0x5f2074,_0x211a63);_0x41f815(_0x211a63);});});}exports[_0xc668('0x18')]=function(_0x197795){var _0x149811=this;return new Promise(function(_0x4905fc,_0x439546){return db[_0xc668('0x19')][_0xc668('0x1a')]({'raw':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1c')]===undefined?!![]:![]:!![],'where':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1d')]||null:null,'attributes':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1e')]||null:null,'limit':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1f')]||null:null,'include':_0x197795['options']?_0x197795[_0xc668('0x1b')][_0xc668('0x20')]?_['map'](_0x197795['options'][_0xc668('0x20')],function(_0x30f946){return{'model':db[_0x30f946[_0xc668('0x21')]],'as':_0x30f946['as'],'attributes':_0x30f946[_0xc668('0x1e')],'include':_0x30f946[_0xc668('0x20')]?_[_0xc668('0x22')](_0x30f946[_0xc668('0x20')],function(_0x18cf94){return{'model':db[_0x18cf94[_0xc668('0x21')]],'as':_0x18cf94['as'],'attributes':_0x18cf94[_0xc668('0x1e')],'include':_0x18cf94[_0xc668('0x20')]?_[_0xc668('0x22')](_0x18cf94['include'],function(_0x16467d){return{'model':db[_0x16467d[_0xc668('0x21')]],'as':_0x16467d['as'],'attributes':_0x16467d[_0xc668('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc668('0x23')](function(_0x56beda){logger[_0xc668('0xd')](_0xc668('0x18'),_0x197795);logger['debug'](_0xc668('0x18'),_0x197795,JSON[_0xc668('0x11')](_0x56beda));_0x4905fc(_0x56beda);})[_0xc668('0x17')](function(_0x304b92){logger[_0xc668('0x12')](_0xc668('0x18'),_0x304b92[_0xc668('0x15')],_0x197795);_0x439546(_0x149811['error'](0x1f4,_0x304b92[_0xc668('0x15')]));});});};exports[_0xc668('0x24')]=function(_0x4bee75){var _0x25ef70=this;return new Promise(function(_0x2571a4,_0x342bca){return db['FaxQueue'][_0xc668('0x25')]({'raw':_0x4bee75[_0xc668('0x1b')]?_0x4bee75[_0xc668('0x1b')][_0xc668('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bee75[_0xc668('0x1b')]?_0x4bee75[_0xc668('0x1b')][_0xc668('0x1d')]||null:null,'attributes':_0x4bee75[_0xc668('0x1b')]?_0x4bee75['options'][_0xc668('0x1e')]||null:null,'include':_0x4bee75['options']?_0x4bee75[_0xc668('0x1b')]['include']?_[_0xc668('0x22')](_0x4bee75[_0xc668('0x1b')][_0xc668('0x20')],function(_0x474548){return{'model':db[_0x474548[_0xc668('0x21')]],'as':_0x474548['as'],'attributes':_0x474548[_0xc668('0x1e')],'include':_0x474548[_0xc668('0x20')]?_[_0xc668('0x22')](_0x474548[_0xc668('0x20')],function(_0x49f9b5){return{'model':db[_0x49f9b5['model']],'as':_0x49f9b5['as'],'attributes':_0x49f9b5[_0xc668('0x1e')],'include':_0x49f9b5[_0xc668('0x20')]?_[_0xc668('0x22')](_0x49f9b5['include'],function(_0x13d740){return{'model':db[_0x13d740['model']],'as':_0x13d740['as'],'attributes':_0x13d740[_0xc668('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc668('0x23')](function(_0x41bfc3){logger[_0xc668('0xd')]('ShowFaxQueue',_0x4bee75);logger[_0xc668('0xf')](_0xc668('0x24'),_0x4bee75,JSON['stringify'](_0x41bfc3));_0x2571a4(_0x41bfc3);})[_0xc668('0x17')](function(_0x54d0ac){logger['error'](_0xc668('0x24'),_0x54d0ac[_0xc668('0x15')],_0x4bee75);_0x342bca(_0x25ef70['error'](0x1f4,_0x54d0ac[_0xc668('0x15')]));});});}; \ No newline at end of file +var _0x3076=['http','redis','defaults','localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxQueue,\x20%s,\x20%s','message','result','FaxQueue','findAll','options','raw','where','attributes','include','model','map','GetFaxQueue','stringify','catch','ShowFaxQueue','debug','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x3076,0x184));var _0x6307=function(_0x4d78fb,_0x280202){_0x4d78fb=_0x4d78fb-0x0;var _0x2898bf=_0x3076[_0x4d78fb];return _0x2898bf;};'use strict';var _=require('lodash');var util=require(_0x6307('0x0'));var moment=require(_0x6307('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6307('0x2'));var db=require(_0x6307('0x3'))['db'];var utils=require(_0x6307('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6307('0x5'));var jayson=require(_0x6307('0x6'));var client=jayson[_0x6307('0x7')][_0x6307('0x8')]({'port':0x232a});config[_0x6307('0x9')]=_[_0x6307('0xa')](config[_0x6307('0x9')],{'host':_0x6307('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6307('0x9')]));require(_0x6307('0xc'))['register'](socket);function respondWithRpcPromise(_0x1f874e,_0x1f2999,_0x5f0661){return new BPromise(function(_0x18e2d6,_0x48dbe1){return client[_0x6307('0xd')](_0x1f874e,_0x5f0661)[_0x6307('0xe')](function(_0x2b2b20){logger[_0x6307('0xf')]('FaxQueue,\x20%s,\x20%s',_0x1f2999,'request\x20sent');logger['debug'](_0x6307('0x10'),_0x1f2999,_0x6307('0x11'),JSON['stringify'](_0x2b2b20));if(_0x2b2b20[_0x6307('0x12')]){if(_0x2b2b20['error']['code']===0x1f4){logger[_0x6307('0x12')](_0x6307('0x13'),_0x1f2999,_0x2b2b20[_0x6307('0x12')][_0x6307('0x14')]);return _0x48dbe1(_0x2b2b20[_0x6307('0x12')]['message']);}logger[_0x6307('0x12')](_0x6307('0x13'),_0x1f2999,_0x2b2b20[_0x6307('0x12')][_0x6307('0x14')]);return _0x18e2d6(_0x2b2b20[_0x6307('0x12')][_0x6307('0x14')]);}else{logger[_0x6307('0xf')](_0x6307('0x13'),_0x1f2999,'request\x20sent');_0x18e2d6(_0x2b2b20[_0x6307('0x15')][_0x6307('0x14')]);}})['catch'](function(_0x3d3da3){logger[_0x6307('0x12')](_0x6307('0x13'),_0x1f2999,_0x3d3da3);_0x48dbe1(_0x3d3da3);});});}exports['GetFaxQueue']=function(_0x3466f3){var _0x12bb88=this;return new Promise(function(_0x272a36,_0x4c7a24){return db[_0x6307('0x16')][_0x6307('0x17')]({'raw':_0x3466f3[_0x6307('0x18')]?_0x3466f3[_0x6307('0x18')][_0x6307('0x19')]===undefined?!![]:![]:!![],'where':_0x3466f3[_0x6307('0x18')]?_0x3466f3[_0x6307('0x18')][_0x6307('0x1a')]||null:null,'attributes':_0x3466f3[_0x6307('0x18')]?_0x3466f3[_0x6307('0x18')][_0x6307('0x1b')]||null:null,'limit':_0x3466f3[_0x6307('0x18')]?_0x3466f3[_0x6307('0x18')]['limit']||null:null,'include':_0x3466f3[_0x6307('0x18')]?_0x3466f3[_0x6307('0x18')]['include']?_['map'](_0x3466f3[_0x6307('0x18')][_0x6307('0x1c')],function(_0x168e08){return{'model':db[_0x168e08[_0x6307('0x1d')]],'as':_0x168e08['as'],'attributes':_0x168e08['attributes'],'include':_0x168e08[_0x6307('0x1c')]?_[_0x6307('0x1e')](_0x168e08['include'],function(_0x3f5103){return{'model':db[_0x3f5103[_0x6307('0x1d')]],'as':_0x3f5103['as'],'attributes':_0x3f5103[_0x6307('0x1b')],'include':_0x3f5103[_0x6307('0x1c')]?_[_0x6307('0x1e')](_0x3f5103[_0x6307('0x1c')],function(_0x261f96){return{'model':db[_0x261f96[_0x6307('0x1d')]],'as':_0x261f96['as'],'attributes':_0x261f96[_0x6307('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6307('0xe')](function(_0x5e5230){logger[_0x6307('0xf')](_0x6307('0x1f'),_0x3466f3);logger['debug'](_0x6307('0x1f'),_0x3466f3,JSON[_0x6307('0x20')](_0x5e5230));_0x272a36(_0x5e5230);})[_0x6307('0x21')](function(_0x4ac83a){logger[_0x6307('0x12')](_0x6307('0x1f'),_0x4ac83a[_0x6307('0x14')],_0x3466f3);_0x4c7a24(_0x12bb88[_0x6307('0x12')](0x1f4,_0x4ac83a['message']));});});};exports[_0x6307('0x22')]=function(_0x4fa41c){var _0x3b6972=this;return new Promise(function(_0x3062e3,_0x4b8537){return db[_0x6307('0x16')]['find']({'raw':_0x4fa41c[_0x6307('0x18')]?_0x4fa41c['options'][_0x6307('0x19')]===undefined?!![]:![]:!![],'where':_0x4fa41c[_0x6307('0x18')]?_0x4fa41c[_0x6307('0x18')]['where']||null:null,'attributes':_0x4fa41c['options']?_0x4fa41c['options'][_0x6307('0x1b')]||null:null,'include':_0x4fa41c[_0x6307('0x18')]?_0x4fa41c[_0x6307('0x18')]['include']?_[_0x6307('0x1e')](_0x4fa41c[_0x6307('0x18')][_0x6307('0x1c')],function(_0x56822e){return{'model':db[_0x56822e[_0x6307('0x1d')]],'as':_0x56822e['as'],'attributes':_0x56822e['attributes'],'include':_0x56822e[_0x6307('0x1c')]?_[_0x6307('0x1e')](_0x56822e['include'],function(_0x594aad){return{'model':db[_0x594aad[_0x6307('0x1d')]],'as':_0x594aad['as'],'attributes':_0x594aad['attributes'],'include':_0x594aad[_0x6307('0x1c')]?_[_0x6307('0x1e')](_0x594aad[_0x6307('0x1c')],function(_0x383c64){return{'model':db[_0x383c64[_0x6307('0x1d')]],'as':_0x383c64['as'],'attributes':_0x383c64[_0x6307('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3808c9){logger['info'](_0x6307('0x22'),_0x4fa41c);logger[_0x6307('0x23')]('ShowFaxQueue',_0x4fa41c,JSON[_0x6307('0x20')](_0x3808c9));_0x3062e3(_0x3808c9);})[_0x6307('0x21')](function(_0x46e44b){logger['error']('ShowFaxQueue',_0x46e44b[_0x6307('0x14')],_0x4fa41c);_0x4b8537(_0x3b6972['error'](0x1f4,_0x46e44b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 761dca0..004f74f 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 _0x3568=['removeListener','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x2e4a30,_0x860b8f){var _0x183e66=function(_0x2c463a){while(--_0x2c463a){_0x2e4a30['push'](_0x2e4a30['shift']());}};_0x183e66(++_0x860b8f);}(_0x3568,0xc2));var _0x8356=function(_0x4452e,_0x308b80){_0x4452e=_0x4452e-0x0;var _0x1c685b=_0x3568[_0x4452e];return _0x1c685b;};'use strict';var FaxQueueEvents=require(_0x8356('0x0'));var events=[_0x8356('0x1'),'remove',_0x8356('0x2')];function createListener(_0xe25c72,_0x5d2807){return function(_0x2fa289){_0x5d2807[_0x8356('0x3')](_0xe25c72,_0x2fa289);};}function removeListener(_0x478eb1,_0x36c20f){return function(){FaxQueueEvents[_0x8356('0x4')](_0x478eb1,_0x36c20f);};}exports['register']=function(_0xa8c6c0){for(var _0x4abfe0=0x0,_0x40b996=events['length'];_0x4abfe0<_0x40b996;_0x4abfe0++){var _0x24494c=events[_0x4abfe0];var _0x4ec2f1=createListener(_0x8356('0x5')+_0x24494c,_0xa8c6c0);FaxQueueEvents['on'](_0x24494c,_0x4ec2f1);}}; \ No newline at end of file +var _0x9abf=['remove','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x477e25,_0x259391){var _0x4ce1be=function(_0x330cf2){while(--_0x330cf2){_0x477e25['push'](_0x477e25['shift']());}};_0x4ce1be(++_0x259391);}(_0x9abf,0xd7));var _0xf9ab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9abf[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require(_0xf9ab('0x0'));var events=[_0xf9ab('0x1'),_0xf9ab('0x2'),'update'];function createListener(_0x4b9d7e,_0x4a56d0){return function(_0x38bd4a){_0x4a56d0['emit'](_0x4b9d7e,_0x38bd4a);};}function removeListener(_0x443bc0,_0x11e54e){return function(){FaxQueueEvents[_0xf9ab('0x3')](_0x443bc0,_0x11e54e);};}exports[_0xf9ab('0x4')]=function(_0x4ee567){for(var _0x415cc5=0x0,_0x5671cb=events[_0xf9ab('0x5')];_0x415cc5<_0x5671cb;_0x415cc5++){var _0x5388b3=events[_0x415cc5];var _0x1f9aef=createListener(_0xf9ab('0x6')+_0x5388b3,_0x4ee567);FaxQueueEvents['on'](_0x5388b3,_0x1f9aef);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ed49972..ace2798 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 _0x9206=['getTeams','/:id/users','create','addTeams','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/members','getMembers','/:id/teams'];(function(_0xc4f7c0,_0x3d731b){var _0x479501=function(_0x36a2cd){while(--_0x36a2cd){_0xc4f7c0['push'](_0xc4f7c0['shift']());}};_0x479501(++_0x3d731b);}(_0x9206,0x176));var _0x6920=function(_0x590f81,_0x4c610c){_0x590f81=_0x590f81-0x0;var _0x55f060=_0x9206[_0x590f81];return _0x55f060;};'use strict';var multer=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var path=require(_0x6920('0x2'));var timeout=require(_0x6920('0x3'));var express=require(_0x6920('0x4'));var router=express[_0x6920('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x6920('0x8')](),controller['index']);router[_0x6920('0x9')](_0x6920('0xa'),auth[_0x6920('0x8')](),controller[_0x6920('0xb')]);router['get']('/:id',auth[_0x6920('0x8')](),controller[_0x6920('0xc')]);router[_0x6920('0x9')](_0x6920('0xd'),auth[_0x6920('0x8')](),controller[_0x6920('0xe')]);router[_0x6920('0x9')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x10')]);router[_0x6920('0x9')](_0x6920('0x11'),auth[_0x6920('0x8')](),controller['getAgents']);router['post']('/',auth[_0x6920('0x8')](),controller[_0x6920('0x12')]);router['post'](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x13')]);router[_0x6920('0x14')](_0x6920('0x11'),auth['isAuthenticated'](),controller[_0x6920('0x15')]);router[_0x6920('0x16')](_0x6920('0x17'),auth[_0x6920('0x8')](),controller[_0x6920('0x18')]);router[_0x6920('0x19')](_0x6920('0x17'),auth[_0x6920('0x8')](),controller[_0x6920('0x1a')]);router[_0x6920('0x19')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x1b')]);router[_0x6920('0x19')](_0x6920('0x11'),auth['isAuthenticated'](),controller[_0x6920('0x1c')]);module[_0x6920('0x1d')]=router; \ No newline at end of file +var _0x8ace=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','/:id/users','addAgents','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5038e3,_0x29855b){var _0x593c8d=function(_0x41c341){while(--_0x41c341){_0x5038e3['push'](_0x5038e3['shift']());}};_0x593c8d(++_0x29855b);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x4684af,_0x34880f){_0x4684af=_0x4684af-0x0;var _0x3bb413=_0x8ace[_0x4684af];return _0x3bb413;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['describe']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0xb')](_0xe8ac('0x11'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0xb')]('/:id/teams',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x13')]);router[_0xe8ac('0xb')]('/:id/users',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x14')]);router['post']('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x15')]);router[_0xe8ac('0x16')](_0xe8ac('0x17'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x18')]);router[_0xe8ac('0x16')](_0xe8ac('0x19'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x1a')]);router['put'](_0xe8ac('0xf'),auth[_0xe8ac('0xc')](),controller['update']);router[_0xe8ac('0x1b')](_0xe8ac('0xf'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x1c')]);router[_0xe8ac('0x1b')](_0xe8ac('0x17'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xe8ac('0x19'),auth[_0xe8ac('0xc')](),controller['removeAgents']);module[_0xe8ac('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index dba1615..5f12e72 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 _0xe86f=['moment','exports','STRING','DATE'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xe86f,0x78));var _0xfe86=function(_0x2ce11b,_0x1855a4){_0x2ce11b=_0x2ce11b-0x0;var _0x32fdf7=_0xe86f[_0x2ce11b];return _0x32fdf7;};'use strict';var moment=require(_0xfe86('0x0'));var Sequelize=require('sequelize');module[_0xfe86('0x1')]={'uniqueid':{'type':Sequelize[_0xfe86('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfe86('0x2')]},'joinAt':{'type':Sequelize[_0xfe86('0x3')]},'leaveAt':{'type':Sequelize[_0xfe86('0x3')]},'acceptAt':{'type':Sequelize[_0xfe86('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfe86('0x2')]}}; \ No newline at end of file +var _0x5bad=['STRING','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bad,0xee));var _0xd5ba=function(_0x501a76,_0x56b13d){_0x501a76=_0x501a76-0x0;var _0x20b06a=_0x5bad[_0x501a76];return _0x20b06a;};'use strict';var moment=require('moment');var Sequelize=require(_0xd5ba('0x0'));module[_0xd5ba('0x1')]={'uniqueid':{'type':Sequelize[_0xd5ba('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd5ba('0x3')]},'leaveAt':{'type':Sequelize[_0xd5ba('0x3')]},'acceptAt':{'type':Sequelize[_0xd5ba('0x3')]},'exitAt':{'type':Sequelize[_0xd5ba('0x3')]},'reason':{'type':Sequelize[_0xd5ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8b1f078..5273f0d 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 _0x32c0=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x32c0,0x1f3));var _0x032c=function(_0x177acc,_0x22a677){_0x177acc=_0x177acc-0x0;var _0x4d3a4e=_0x32c0[_0x177acc];return _0x4d3a4e;};'use strict';var emlformat=require(_0x032c('0x0'));var rimraf=require(_0x032c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x032c('0x2'));var rp=require(_0x032c('0x3'));var moment=require('moment');var BPromise=require(_0x032c('0x4'));var Mustache=require(_0x032c('0x5'));var util=require(_0x032c('0x6'));var path=require(_0x032c('0x7'));var sox=require('sox');var csv=require(_0x032c('0x8'));var ejs=require(_0x032c('0x9'));var fs=require('fs');var fs_extra=require(_0x032c('0xa'));var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var licenseUtil=require(_0x032c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25af77,_0xc88e78){_0xc88e78=_0xc88e78||0xcc;return function(_0x364605){if(_0x364605){return _0x25af77[_0x032c('0x16')](_0xc88e78);}return _0x25af77['status'](_0xc88e78)[_0x032c('0x17')]();};}function respondWithResult(_0x2650d6,_0x1ec9d8){_0x1ec9d8=_0x1ec9d8||0xc8;return function(_0x216984){if(_0x216984){return _0x2650d6[_0x032c('0x18')](_0x1ec9d8)[_0x032c('0x19')](_0x216984);}};}function respondWithFilteredResult(_0x51266f,_0xb678d5){return function(_0x15ddb8){if(_0x15ddb8){var _0x3ebda8=typeof _0xb678d5[_0x032c('0x1a')]===_0x032c('0x1b')&&typeof _0xb678d5[_0x032c('0x1c')]==='undefined';var _0x1444bb=_0x15ddb8[_0x032c('0x1d')];var _0x4435ad=_0x3ebda8?0x0:_0xb678d5[_0x032c('0x1a')];var _0x2b2693=_0x3ebda8?_0x15ddb8[_0x032c('0x1d')]:_0xb678d5[_0x032c('0x1a')]+_0xb678d5[_0x032c('0x1c')];var _0x3a6f71;if(_0x2b2693>=_0x1444bb){_0x2b2693=_0x1444bb;_0x3a6f71=0xc8;}else{_0x3a6f71=0xce;}_0x51266f[_0x032c('0x18')](_0x3a6f71);return _0x51266f[_0x032c('0x1e')](_0x032c('0x1f'),_0x4435ad+'-'+_0x2b2693+'/'+_0x1444bb)[_0x032c('0x19')](_0x15ddb8);}return null;};}function patchUpdates(_0x515409){return function(_0x8a8f30){try{jsonpatch['apply'](_0x8a8f30,_0x515409,!![]);}catch(_0x5341e6){return BPromise['reject'](_0x5341e6);}return _0x8a8f30['save']();};}function saveUpdates(_0x2a24f7,_0x4c0c4b){return function(_0x2ce758){if(_0x2ce758){return _0x2ce758[_0x032c('0x20')](_0x2a24f7)[_0x032c('0x21')](function(_0x51ad8c){return _0x51ad8c;});}return null;};}function removeEntity(_0x135612,_0x16d40f){return function(_0x28ae24){if(_0x28ae24){return _0x28ae24[_0x032c('0x22')]()[_0x032c('0x21')](function(){_0x135612[_0x032c('0x18')](0xcc)[_0x032c('0x17')]();});}};}function handleEntityNotFound(_0x58894b,_0x16ed08){return function(_0x1a0881){if(!_0x1a0881){_0x58894b[_0x032c('0x16')](0x194);}return _0x1a0881;};}function handleError(_0x56d20d,_0x1350d1){_0x1350d1=_0x1350d1||0x1f4;return function(_0x19ed06){logger[_0x032c('0x23')](_0x19ed06[_0x032c('0x24')]);if(_0x19ed06['name']){delete _0x19ed06[_0x032c('0x25')];}_0x56d20d[_0x032c('0x18')](_0x1350d1)[_0x032c('0x26')](_0x19ed06);};}exports[_0x032c('0x27')]=function(_0x51d679,_0x119d8f){var _0x1de595={},_0x5cdd90={},_0x659bbf={'count':0x0,'rows':[]};var _0x306935=_[_0x032c('0x28')](db[_0x032c('0x29')]['rawAttributes'],function(_0x50a3f8){return{'name':_0x50a3f8[_0x032c('0x2a')],'type':_0x50a3f8['type'][_0x032c('0x2b')]};});_0x5cdd90[_0x032c('0x2c')]=_['map'](_0x306935,_0x032c('0x25'));_0x5cdd90[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x51d679[_0x032c('0x2d')]);_0x5cdd90['filters']=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],_0x5cdd90['query']);_0x1de595[_0x032c('0x30')]=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],qs[_0x032c('0x31')](_0x51d679[_0x032c('0x2d')]['fields']));_0x1de595[_0x032c('0x30')]=_0x1de595['attributes'][_0x032c('0x32')]?_0x1de595['attributes']:_0x5cdd90[_0x032c('0x2c')];if(!_0x51d679[_0x032c('0x2d')][_0x032c('0x33')](_0x032c('0x34'))){_0x1de595[_0x032c('0x1c')]=qs[_0x032c('0x1c')](_0x51d679['query'][_0x032c('0x1c')]);_0x1de595[_0x032c('0x1a')]=qs['offset'](_0x51d679[_0x032c('0x2d')][_0x032c('0x1a')]);}_0x1de595[_0x032c('0x35')]=qs['sort'](_0x51d679[_0x032c('0x2d')][_0x032c('0x36')]);_0x1de595[_0x032c('0x37')]=qs[_0x032c('0x38')](_[_0x032c('0x39')](_0x51d679[_0x032c('0x2d')],_0x5cdd90[_0x032c('0x38')]),_0x306935);if(_0x51d679['query'][_0x032c('0x3a')]){_0x1de595[_0x032c('0x37')]=_[_0x032c('0x3b')](_0x1de595[_0x032c('0x37')],{'$or':_[_0x032c('0x28')](_0x306935,function(_0xf27830){if(_0xf27830[_0x032c('0x3c')]!==_0x032c('0x3d')){var _0x4bba77={};_0x4bba77[_0xf27830[_0x032c('0x25')]]={'$like':'%'+_0x51d679['query'][_0x032c('0x3a')]+'%'};return _0x4bba77;}})});}_0x1de595=_['merge']({},_0x1de595,_0x51d679['options']);var _0x238291={'where':_0x1de595[_0x032c('0x37')]};return db['FaxQueueReport']['count'](_0x238291)[_0x032c('0x21')](function(_0x4c6c2b){_0x659bbf['count']=_0x4c6c2b;if(_0x51d679[_0x032c('0x2d')][_0x032c('0x3e')]){_0x1de595[_0x032c('0x3f')]=[{'all':!![]}];}return db[_0x032c('0x29')][_0x032c('0x40')](_0x1de595);})[_0x032c('0x21')](function(_0x49b83a){_0x659bbf[_0x032c('0x41')]=_0x49b83a;return _0x659bbf;})['then'](respondWithFilteredResult(_0x119d8f,_0x1de595))['catch'](handleError(_0x119d8f,null));};exports[_0x032c('0x42')]=function(_0x15ebeb,_0x2035d5){var _0x235ad6={'raw':!![],'where':{'id':_0x15ebeb['params']['id']}},_0x47360a={};_0x47360a['model']=_[_0x032c('0x2e')](db['FaxQueueReport'][_0x032c('0x43')]);_0x47360a[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x15ebeb[_0x032c('0x2d')]);_0x47360a[_0x032c('0x38')]=_[_0x032c('0x2f')](_0x47360a[_0x032c('0x2c')],_0x47360a[_0x032c('0x2d')]);_0x235ad6[_0x032c('0x30')]=_['intersection'](_0x47360a[_0x032c('0x2c')],qs['fields'](_0x15ebeb['query'][_0x032c('0x31')]));_0x235ad6[_0x032c('0x30')]=_0x235ad6[_0x032c('0x30')][_0x032c('0x32')]?_0x235ad6[_0x032c('0x30')]:_0x47360a['model'];if(_0x15ebeb['query']['includeAll']){_0x235ad6[_0x032c('0x3f')]=[{'all':!![]}];}_0x235ad6=_['merge']({},_0x235ad6,_0x15ebeb[_0x032c('0x44')]);return db[_0x032c('0x29')]['find'](_0x235ad6)[_0x032c('0x21')](handleEntityNotFound(_0x2035d5,null))[_0x032c('0x21')](respondWithResult(_0x2035d5,null))[_0x032c('0x45')](handleError(_0x2035d5,null));};exports[_0x032c('0x46')]=function(_0x3a877a,_0x26e988){return db[_0x032c('0x29')][_0x032c('0x46')](_0x3a877a[_0x032c('0x47')],{})['then'](respondWithResult(_0x26e988,0xc9))[_0x032c('0x45')](handleError(_0x26e988,null));};exports['update']=function(_0x367638,_0x13f1a7){if(_0x367638[_0x032c('0x47')]['id']){delete _0x367638[_0x032c('0x47')]['id'];}return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x367638[_0x032c('0x49')]['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x13f1a7,null))[_0x032c('0x21')](saveUpdates(_0x367638['body'],null))[_0x032c('0x21')](respondWithResult(_0x13f1a7,null))['catch'](handleError(_0x13f1a7,null));};exports[_0x032c('0x22')]=function(_0x2f1032,_0x4e8fd6){return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x2f1032['params']['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x4e8fd6,null))[_0x032c('0x21')](removeEntity(_0x4e8fd6,null))[_0x032c('0x45')](handleError(_0x4e8fd6,null));};exports['describe']=function(_0x43efaa,_0xf7d545){return db[_0x032c('0x29')][_0x032c('0x4a')]()[_0x032c('0x21')](respondWithResult(_0xf7d545,null))[_0x032c('0x45')](handleError(_0xf7d545,null));}; \ No newline at end of file +var _0x9532=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxQueueReport','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','to-csv','papaparse'];(function(_0xa115c0,_0x50ce1b){var _0x4bc842=function(_0x348250){while(--_0x348250){_0xa115c0['push'](_0xa115c0['shift']());}};_0x4bc842(++_0x50ce1b);}(_0x9532,0x8c));var _0x2953=function(_0x292959,_0x3c66c1){_0x292959=_0x292959-0x0;var _0x424d11=_0x9532[_0x292959];return _0x424d11;};'use strict';var emlformat=require(_0x2953('0x0'));var rimraf=require(_0x2953('0x1'));var zipdir=require(_0x2953('0x2'));var jsonpatch=require(_0x2953('0x3'));var rp=require(_0x2953('0x4'));var moment=require(_0x2953('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2953('0x6'));var util=require(_0x2953('0x7'));var path=require('path');var sox=require(_0x2953('0x8'));var csv=require('to-csv');var ejs=require(_0x2953('0x9'));var fs=require('fs');var fs_extra=require(_0x2953('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2953('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2953('0xc'));var querystring=require('querystring');var Papa=require(_0x2953('0xd'));var Redis=require(_0x2953('0xe'));var authService=require(_0x2953('0xf'));var qs=require(_0x2953('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2953('0x11'));var logger=require(_0x2953('0x12'))(_0x2953('0x13'));var utils=require(_0x2953('0x14'));var config=require(_0x2953('0x15'));var licenseUtil=require(_0x2953('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x480cae,_0x41f2be){_0x41f2be=_0x41f2be||0xcc;return function(_0x13c8a8){if(_0x13c8a8){return _0x480cae['sendStatus'](_0x41f2be);}return _0x480cae[_0x2953('0x17')](_0x41f2be)['end']();};}function respondWithResult(_0x4f15fc,_0x58f5ca){_0x58f5ca=_0x58f5ca||0xc8;return function(_0x4e1e86){if(_0x4e1e86){return _0x4f15fc[_0x2953('0x17')](_0x58f5ca)[_0x2953('0x18')](_0x4e1e86);}};}function respondWithFilteredResult(_0x2ca196,_0x16dbf5){return function(_0x1305c8){if(_0x1305c8){var _0x4b9da7=typeof _0x16dbf5[_0x2953('0x19')]===_0x2953('0x1a')&&typeof _0x16dbf5[_0x2953('0x1b')]===_0x2953('0x1a');var _0x25dad2=_0x1305c8[_0x2953('0x1c')];var _0x359e81=_0x4b9da7?0x0:_0x16dbf5[_0x2953('0x19')];var _0x52e292=_0x4b9da7?_0x1305c8[_0x2953('0x1c')]:_0x16dbf5[_0x2953('0x19')]+_0x16dbf5[_0x2953('0x1b')];var _0x288d6c;if(_0x52e292>=_0x25dad2){_0x52e292=_0x25dad2;_0x288d6c=0xc8;}else{_0x288d6c=0xce;}_0x2ca196[_0x2953('0x17')](_0x288d6c);return _0x2ca196[_0x2953('0x1d')](_0x2953('0x1e'),_0x359e81+'-'+_0x52e292+'/'+_0x25dad2)[_0x2953('0x18')](_0x1305c8);}return null;};}function patchUpdates(_0x435d94){return function(_0x68d656){try{jsonpatch[_0x2953('0x1f')](_0x68d656,_0x435d94,!![]);}catch(_0x236a10){return BPromise[_0x2953('0x20')](_0x236a10);}return _0x68d656[_0x2953('0x21')]();};}function saveUpdates(_0x142beb,_0x563d81){return function(_0x1a1240){if(_0x1a1240){return _0x1a1240[_0x2953('0x22')](_0x142beb)['then'](function(_0x4f3118){return _0x4f3118;});}return null;};}function removeEntity(_0x301c35,_0x236694){return function(_0x25857e){if(_0x25857e){return _0x25857e[_0x2953('0x23')]()[_0x2953('0x24')](function(){_0x301c35[_0x2953('0x17')](0xcc)[_0x2953('0x25')]();});}};}function handleEntityNotFound(_0x3a7ae5,_0x419192){return function(_0x234b78){if(!_0x234b78){_0x3a7ae5['sendStatus'](0x194);}return _0x234b78;};}function handleError(_0x25223e,_0x550ad8){_0x550ad8=_0x550ad8||0x1f4;return function(_0x21e221){logger[_0x2953('0x26')](_0x21e221[_0x2953('0x27')]);if(_0x21e221[_0x2953('0x28')]){delete _0x21e221['name'];}_0x25223e['status'](_0x550ad8)[_0x2953('0x29')](_0x21e221);};}exports[_0x2953('0x2a')]=function(_0x2309c6,_0x12c7ea){var _0x35040d={},_0xbbcead={},_0x290735={'count':0x0,'rows':[]};var _0x497056=_['map'](db['FaxQueueReport'][_0x2953('0x2b')],function(_0x2bfce7){return{'name':_0x2bfce7[_0x2953('0x2c')],'type':_0x2bfce7[_0x2953('0x2d')]['key']};});_0xbbcead[_0x2953('0x2e')]=_[_0x2953('0x2f')](_0x497056,_0x2953('0x28'));_0xbbcead[_0x2953('0x30')]=_['keys'](_0x2309c6[_0x2953('0x30')]);_0xbbcead[_0x2953('0x31')]=_[_0x2953('0x32')](_0xbbcead[_0x2953('0x2e')],_0xbbcead[_0x2953('0x30')]);_0x35040d[_0x2953('0x33')]=_['intersection'](_0xbbcead[_0x2953('0x2e')],qs[_0x2953('0x34')](_0x2309c6[_0x2953('0x30')][_0x2953('0x34')]));_0x35040d[_0x2953('0x33')]=_0x35040d[_0x2953('0x33')][_0x2953('0x35')]?_0x35040d[_0x2953('0x33')]:_0xbbcead[_0x2953('0x2e')];if(!_0x2309c6['query'][_0x2953('0x36')](_0x2953('0x37'))){_0x35040d['limit']=qs[_0x2953('0x1b')](_0x2309c6[_0x2953('0x30')][_0x2953('0x1b')]);_0x35040d['offset']=qs[_0x2953('0x19')](_0x2309c6[_0x2953('0x30')][_0x2953('0x19')]);}_0x35040d[_0x2953('0x38')]=qs['sort'](_0x2309c6[_0x2953('0x30')][_0x2953('0x39')]);_0x35040d[_0x2953('0x3a')]=qs[_0x2953('0x31')](_[_0x2953('0x3b')](_0x2309c6[_0x2953('0x30')],_0xbbcead[_0x2953('0x31')]),_0x497056);if(_0x2309c6[_0x2953('0x30')][_0x2953('0x3c')]){_0x35040d[_0x2953('0x3a')]=_[_0x2953('0x3d')](_0x35040d['where'],{'$or':_[_0x2953('0x2f')](_0x497056,function(_0x455fe4){if(_0x455fe4[_0x2953('0x2d')]!==_0x2953('0x3e')){var _0x31c61f={};_0x31c61f[_0x455fe4[_0x2953('0x28')]]={'$like':'%'+_0x2309c6['query'][_0x2953('0x3c')]+'%'};return _0x31c61f;}})});}_0x35040d=_[_0x2953('0x3d')]({},_0x35040d,_0x2309c6[_0x2953('0x3f')]);var _0x59b780={'where':_0x35040d[_0x2953('0x3a')]};return db['FaxQueueReport'][_0x2953('0x1c')](_0x59b780)[_0x2953('0x24')](function(_0x40e019){_0x290735['count']=_0x40e019;if(_0x2309c6['query'][_0x2953('0x40')]){_0x35040d[_0x2953('0x41')]=[{'all':!![]}];}return db[_0x2953('0x42')][_0x2953('0x43')](_0x35040d);})[_0x2953('0x24')](function(_0x5cd3c8){_0x290735[_0x2953('0x44')]=_0x5cd3c8;return _0x290735;})[_0x2953('0x24')](respondWithFilteredResult(_0x12c7ea,_0x35040d))[_0x2953('0x45')](handleError(_0x12c7ea,null));};exports[_0x2953('0x46')]=function(_0x3e85fd,_0x14c40a){var _0xcf0f2a={'raw':!![],'where':{'id':_0x3e85fd[_0x2953('0x47')]['id']}},_0x574564={};_0x574564[_0x2953('0x2e')]=_['keys'](db[_0x2953('0x42')]['rawAttributes']);_0x574564[_0x2953('0x30')]=_[_0x2953('0x48')](_0x3e85fd['query']);_0x574564[_0x2953('0x31')]=_[_0x2953('0x32')](_0x574564[_0x2953('0x2e')],_0x574564[_0x2953('0x30')]);_0xcf0f2a[_0x2953('0x33')]=_[_0x2953('0x32')](_0x574564[_0x2953('0x2e')],qs[_0x2953('0x34')](_0x3e85fd[_0x2953('0x30')][_0x2953('0x34')]));_0xcf0f2a['attributes']=_0xcf0f2a[_0x2953('0x33')]['length']?_0xcf0f2a['attributes']:_0x574564[_0x2953('0x2e')];if(_0x3e85fd['query'][_0x2953('0x40')]){_0xcf0f2a[_0x2953('0x41')]=[{'all':!![]}];}_0xcf0f2a=_[_0x2953('0x3d')]({},_0xcf0f2a,_0x3e85fd[_0x2953('0x3f')]);return db[_0x2953('0x42')][_0x2953('0x49')](_0xcf0f2a)[_0x2953('0x24')](handleEntityNotFound(_0x14c40a,null))['then'](respondWithResult(_0x14c40a,null))[_0x2953('0x45')](handleError(_0x14c40a,null));};exports[_0x2953('0x4a')]=function(_0x3388cf,_0x31e39a){return db[_0x2953('0x42')][_0x2953('0x4a')](_0x3388cf[_0x2953('0x4b')],{})[_0x2953('0x24')](respondWithResult(_0x31e39a,0xc9))[_0x2953('0x45')](handleError(_0x31e39a,null));};exports[_0x2953('0x22')]=function(_0x2995b1,_0x151b32){if(_0x2995b1['body']['id']){delete _0x2995b1['body']['id'];}return db[_0x2953('0x42')][_0x2953('0x49')]({'where':{'id':_0x2995b1[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x151b32,null))['then'](saveUpdates(_0x2995b1['body'],null))['then'](respondWithResult(_0x151b32,null))['catch'](handleError(_0x151b32,null));};exports[_0x2953('0x23')]=function(_0x3e8b37,_0x4e59ee){return db[_0x2953('0x42')][_0x2953('0x49')]({'where':{'id':_0x3e8b37[_0x2953('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e59ee,null))['then'](removeEntity(_0x4e59ee,null))[_0x2953('0x45')](handleError(_0x4e59ee,null));};exports[_0x2953('0x4c')]=function(_0x322f5b,_0x3ba187){return db[_0x2953('0x42')][_0x2953('0x4c')]()[_0x2953('0x24')](respondWithResult(_0x3ba187,null))[_0x2953('0x45')](handleError(_0x3ba187,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f5a5637..711c6f9 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x4488dc,_0x1a9033){var _0x37f653=function(_0x205972){while(--_0x205972){_0x4488dc['push'](_0x4488dc['shift']());}};_0x37f653(++_0x1a9033);}(_0xf494,0x1c6));var _0x4f49=function(_0x4f9610,_0x3fcaa4){_0x4f9610=_0x4f9610-0x0;var _0x24c209=_0xf494[_0x4f9610];return _0x24c209;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x2f24cb,_0x3f69bf){var _0x216296=function(_0x47e6be){while(--_0x47e6be){_0x2f24cb['push'](_0x2f24cb['shift']());}};_0x216296(++_0x3f69bf);}(_0x1261,0x144));var _0x1126=function(_0x332c1b,_0x28d711){_0x332c1b=_0x332c1b-0x0;var _0x21b49b=_0x1261[_0x332c1b];return _0x21b49b;};'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')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 96b88cc..7664cf1 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 _0x7335=['limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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'];(function(_0x3c08f0,_0x1d75cf){var _0x580c0d=function(_0x2525ef){while(--_0x2525ef){_0x3c08f0['push'](_0x3c08f0['shift']());}};_0x580c0d(++_0x1d75cf);}(_0x7335,0x111));var _0x5733=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x7335[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require(_0x5733('0x0'));var moment=require(_0x5733('0x1'));var BPromise=require('bluebird');var rs=require(_0x5733('0x2'));var fs=require('fs');var Redis=require(_0x5733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5733('0x4'));var logger=require(_0x5733('0x5'))(_0x5733('0x6'));var config=require(_0x5733('0x7'));var jayson=require(_0x5733('0x8'));var client=jayson[_0x5733('0x9')][_0x5733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32f873,_0x4e1855,_0x5d8cf5){return new BPromise(function(_0x4396a1,_0x5bd6d6){return client['request'](_0x32f873,_0x5d8cf5)[_0x5733('0xb')](function(_0x2df540){logger[_0x5733('0xc')](_0x5733('0xd'),_0x4e1855,_0x5733('0xe'));logger[_0x5733('0xf')](_0x5733('0x10'),_0x4e1855,_0x5733('0xe'),JSON[_0x5733('0x11')](_0x2df540));if(_0x2df540[_0x5733('0x12')]){if(_0x2df540[_0x5733('0x12')][_0x5733('0x13')]===0x1f4){logger[_0x5733('0x12')](_0x5733('0xd'),_0x4e1855,_0x2df540['error']['message']);return _0x5bd6d6(_0x2df540[_0x5733('0x12')][_0x5733('0x14')]);}logger[_0x5733('0x12')](_0x5733('0xd'),_0x4e1855,_0x2df540[_0x5733('0x12')][_0x5733('0x14')]);return _0x4396a1(_0x2df540[_0x5733('0x12')][_0x5733('0x14')]);}else{logger[_0x5733('0xc')](_0x5733('0xd'),_0x4e1855,_0x5733('0xe'));_0x4396a1(_0x2df540[_0x5733('0x15')][_0x5733('0x14')]);}})[_0x5733('0x16')](function(_0x46e924){logger['error'](_0x5733('0xd'),_0x4e1855,_0x46e924);_0x5bd6d6(_0x46e924);});});}exports[_0x5733('0x17')]=function(_0x1449f6){var _0x43ac73=this;return new Promise(function(_0x2d8364,_0xedfaeb){return db[_0x5733('0x18')][_0x5733('0x19')](_0x1449f6['body'],{'raw':_0x1449f6[_0x5733('0x1a')]?_0x1449f6[_0x5733('0x1a')][_0x5733('0x1b')]===undefined?!![]:![]:!![]})[_0x5733('0xb')](function(_0x318664){logger['info'](_0x5733('0x17'),_0x1449f6);logger[_0x5733('0xf')]('CreateFaxQueueReport',_0x1449f6,JSON[_0x5733('0x11')](_0x318664));_0x2d8364(_0x318664);})[_0x5733('0x16')](function(_0xa17378){logger[_0x5733('0x12')](_0x5733('0x17'),_0xa17378[_0x5733('0x14')],_0x1449f6);_0xedfaeb(_0x43ac73[_0x5733('0x12')](0x1f4,_0xa17378[_0x5733('0x14')]));});});};exports[_0x5733('0x1c')]=function(_0x37dc8a){var _0x27c541=this;return new Promise(function(_0x1077c3,_0x1b1d91){return db[_0x5733('0x18')][_0x5733('0x1d')](_0x37dc8a[_0x5733('0x1e')],{'raw':_0x37dc8a[_0x5733('0x1a')]?_0x37dc8a['options'][_0x5733('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37dc8a['options']?_0x37dc8a['options'][_0x5733('0x1f')]||null:null,'attributes':_0x37dc8a[_0x5733('0x1a')]?_0x37dc8a[_0x5733('0x1a')][_0x5733('0x20')]||null:null,'limit':_0x37dc8a[_0x5733('0x1a')]?_0x37dc8a[_0x5733('0x1a')][_0x5733('0x21')]||null:null})[_0x5733('0xb')](function(_0x214541){logger[_0x5733('0xc')]('UpdateFaxQueueReport',_0x37dc8a);logger[_0x5733('0xf')](_0x5733('0x1c'),_0x37dc8a,JSON[_0x5733('0x11')](_0x214541));_0x1077c3(_0x214541);})[_0x5733('0x16')](function(_0x5739d9){logger[_0x5733('0x12')]('UpdateFaxQueueReport',_0x5739d9[_0x5733('0x14')],_0x37dc8a);_0x1b1d91(_0x27c541[_0x5733('0x12')](0x1f4,_0x5739d9[_0x5733('0x14')]));});});}; \ No newline at end of file +var _0x32ad=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where'];(function(_0x4f1b87,_0x260834){var _0x74718e=function(_0x24c7c2){while(--_0x24c7c2){_0x4f1b87['push'](_0x4f1b87['shift']());}};_0x74718e(++_0x260834);}(_0x32ad,0x129));var _0xd32a=function(_0x3de5e2,_0x2ca359){_0x3de5e2=_0x3de5e2-0x0;var _0x325d31=_0x32ad[_0x3de5e2];return _0x325d31;};'use strict';var _=require('lodash');var util=require(_0xd32a('0x0'));var moment=require(_0xd32a('0x1'));var BPromise=require(_0xd32a('0x2'));var rs=require(_0xd32a('0x3'));var fs=require('fs');var Redis=require(_0xd32a('0x4'));var db=require(_0xd32a('0x5'))['db'];var utils=require(_0xd32a('0x6'));var logger=require('../../config/logger')(_0xd32a('0x7'));var config=require(_0xd32a('0x8'));var jayson=require(_0xd32a('0x9'));var client=jayson[_0xd32a('0xa')][_0xd32a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x191c2c,_0x5a5fb2,_0x2c45bf){return new BPromise(function(_0x5181a6,_0x49941d){return client[_0xd32a('0xc')](_0x191c2c,_0x2c45bf)[_0xd32a('0xd')](function(_0x17b7c4){logger[_0xd32a('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x5a5fb2,_0xd32a('0xf'));logger[_0xd32a('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5a5fb2,_0xd32a('0xf'),JSON[_0xd32a('0x11')](_0x17b7c4));if(_0x17b7c4[_0xd32a('0x12')]){if(_0x17b7c4[_0xd32a('0x12')][_0xd32a('0x13')]===0x1f4){logger[_0xd32a('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x5a5fb2,_0x17b7c4[_0xd32a('0x12')]['message']);return _0x49941d(_0x17b7c4[_0xd32a('0x12')]['message']);}logger[_0xd32a('0x12')](_0xd32a('0x14'),_0x5a5fb2,_0x17b7c4[_0xd32a('0x12')][_0xd32a('0x15')]);return _0x5181a6(_0x17b7c4[_0xd32a('0x12')][_0xd32a('0x15')]);}else{logger[_0xd32a('0xe')](_0xd32a('0x14'),_0x5a5fb2,'request\x20sent');_0x5181a6(_0x17b7c4[_0xd32a('0x16')][_0xd32a('0x15')]);}})[_0xd32a('0x17')](function(_0xc9ed38){logger[_0xd32a('0x12')](_0xd32a('0x14'),_0x5a5fb2,_0xc9ed38);_0x49941d(_0xc9ed38);});});}exports[_0xd32a('0x18')]=function(_0x381bb0){var _0x1d1cc0=this;return new Promise(function(_0x3956f0,_0x2d2e8e){return db[_0xd32a('0x19')][_0xd32a('0x1a')](_0x381bb0[_0xd32a('0x1b')],{'raw':_0x381bb0['options']?_0x381bb0[_0xd32a('0x1c')][_0xd32a('0x1d')]===undefined?!![]:![]:!![]})[_0xd32a('0xd')](function(_0x57aaec){logger[_0xd32a('0xe')](_0xd32a('0x18'),_0x381bb0);logger[_0xd32a('0x10')](_0xd32a('0x18'),_0x381bb0,JSON[_0xd32a('0x11')](_0x57aaec));_0x3956f0(_0x57aaec);})['catch'](function(_0xb8e2a3){logger['error'](_0xd32a('0x18'),_0xb8e2a3['message'],_0x381bb0);_0x2d2e8e(_0x1d1cc0['error'](0x1f4,_0xb8e2a3[_0xd32a('0x15')]));});});};exports[_0xd32a('0x1e')]=function(_0x2163d0){var _0x582d1e=this;return new Promise(function(_0x40b40a,_0x2a468b){return db[_0xd32a('0x19')][_0xd32a('0x1f')](_0x2163d0['body'],{'raw':_0x2163d0[_0xd32a('0x1c')]?_0x2163d0[_0xd32a('0x1c')][_0xd32a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2163d0[_0xd32a('0x1c')]?_0x2163d0[_0xd32a('0x1c')][_0xd32a('0x20')]||null:null,'attributes':_0x2163d0[_0xd32a('0x1c')]?_0x2163d0[_0xd32a('0x1c')]['attributes']||null:null,'limit':_0x2163d0[_0xd32a('0x1c')]?_0x2163d0[_0xd32a('0x1c')]['limit']||null:null})['then'](function(_0x2fd5f1){logger[_0xd32a('0xe')](_0xd32a('0x1e'),_0x2163d0);logger[_0xd32a('0x10')](_0xd32a('0x1e'),_0x2163d0,JSON[_0xd32a('0x11')](_0x2fd5f1));_0x40b40a(_0x2fd5f1);})[_0xd32a('0x17')](function(_0x12bc6f){logger[_0xd32a('0x12')](_0xd32a('0x1e'),_0x12bc6f[_0xd32a('0x15')],_0x2163d0);_0x2a468b(_0x582d1e[_0xd32a('0x12')](0x1f4,_0x12bc6f[_0xd32a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2186bf2..a8553f8 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 _0xdcf8=['../../components/auth/service','../../config/environment','/describe','isAuthenticated','describe','get','/:id','show','post','create','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x3c4d82,_0x456bf3){var _0x3e69d5=function(_0x3d7c67){while(--_0x3d7c67){_0x3c4d82['push'](_0x3c4d82['shift']());}};_0x3e69d5(++_0x456bf3);}(_0xdcf8,0x1ab));var _0x8dcf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdcf8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8dcf('0x0'));var util=require(_0x8dcf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8dcf('0x2'));var router=express[_0x8dcf('0x3')]();var fs_extra=require(_0x8dcf('0x4'));var auth=require(_0x8dcf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8dcf('0x6'));var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8dcf('0x7'),auth[_0x8dcf('0x8')](),controller[_0x8dcf('0x9')]);router[_0x8dcf('0xa')](_0x8dcf('0xb'),auth[_0x8dcf('0x8')](),controller[_0x8dcf('0xc')]);router[_0x8dcf('0xd')]('/',auth[_0x8dcf('0x8')](),controller[_0x8dcf('0xe')]);router['put'](_0x8dcf('0xb'),auth[_0x8dcf('0x8')](),controller[_0x8dcf('0xf')]);router[_0x8dcf('0x10')](_0x8dcf('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8dcf('0x11')]=router; \ No newline at end of file +var _0xa888=['create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa888,0x16d));var _0x8a88=function(_0x38c058,_0xb15a7d){_0x38c058=_0x38c058-0x0;var _0x495d22=_0xa888[_0x38c058];return _0x495d22;};'use strict';var multer=require(_0x8a88('0x0'));var util=require(_0x8a88('0x1'));var path=require(_0x8a88('0x2'));var timeout=require(_0x8a88('0x3'));var express=require('express');var router=express[_0x8a88('0x4')]();var fs_extra=require(_0x8a88('0x5'));var auth=require(_0x8a88('0x6'));var interaction=require(_0x8a88('0x7'));var config=require('../../config/environment');var controller=require(_0x8a88('0x8'));router['get']('/',auth[_0x8a88('0x9')](),controller[_0x8a88('0xa')]);router[_0x8a88('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x8a88('0xc')]);router[_0x8a88('0xb')](_0x8a88('0xd'),auth[_0x8a88('0x9')](),controller[_0x8a88('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a88('0xf')]);router[_0x8a88('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8a88('0x11')]);router['delete'](_0x8a88('0xd'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x12')]);module[_0x8a88('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7537529..48f95b3 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(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5d9cb7,_0x221b75){_0x5d9cb7=_0x5d9cb7-0x0;var _0xb6449=_0xb43b[_0x5d9cb7];return _0xb6449;};'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(_0x3ec2a1,_0x4cd6b1){var _0x15c471=function(_0x5537e){while(--_0x5537e){_0x3ec2a1['push'](_0x3ec2a1['shift']());}};_0x15c471(++_0x4cd6b1);}(_0x70e0,0x17b));var _0x070e=function(_0x32615b,_0x4013c8){_0x32615b=_0x32615b-0x0;var _0x3846ae=_0x70e0[_0x32615b];return _0x3846ae;};'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 e354240..64c88d6 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 _0xb295=['where','filters','filter','merge','VIRTUAL','options','FaxTransferReport','count','include','rows','catch','params','model','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2c50a6,_0x2a9854){var _0x3e6556=function(_0x3ad784){while(--_0x3ad784){_0x2c50a6['push'](_0x2c50a6['shift']());}};_0x3e6556(++_0x2a9854);}(_0xb295,0x1c1));var _0x5b29=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb295[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x5b29('0x0'));var rimraf=require(_0x5b29('0x1'));var zipdir=require(_0x5b29('0x2'));var jsonpatch=require(_0x5b29('0x3'));var rp=require('request-promise');var moment=require(_0x5b29('0x4'));var BPromise=require(_0x5b29('0x5'));var Mustache=require(_0x5b29('0x6'));var util=require(_0x5b29('0x7'));var path=require(_0x5b29('0x8'));var sox=require(_0x5b29('0x9'));var csv=require(_0x5b29('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b29('0xb'));var _=require(_0x5b29('0xc'));var squel=require(_0x5b29('0xd'));var crypto=require('crypto');var jsforce=require(_0x5b29('0xe'));var deskjs=require(_0x5b29('0xf'));var toCsv=require(_0x5b29('0xa'));var querystring=require('querystring');var Papa=require(_0x5b29('0x10'));var Redis=require('ioredis');var authService=require(_0x5b29('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5b29('0x12'));var hardwareService=require(_0x5b29('0x13'));var logger=require(_0x5b29('0x14'))(_0x5b29('0x15'));var utils=require(_0x5b29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5b29('0x17'));var db=require(_0x5b29('0x18'))['db'];function respondWithStatusCode(_0x598192,_0xd39518){_0xd39518=_0xd39518||0xcc;return function(_0x529330){if(_0x529330){return _0x598192[_0x5b29('0x19')](_0xd39518);}return _0x598192[_0x5b29('0x1a')](_0xd39518)[_0x5b29('0x1b')]();};}function respondWithResult(_0xa1114a,_0xb41100){_0xb41100=_0xb41100||0xc8;return function(_0x5aed1c){if(_0x5aed1c){return _0xa1114a[_0x5b29('0x1a')](_0xb41100)['json'](_0x5aed1c);}};}function respondWithFilteredResult(_0x1c1689,_0xac9243){return function(_0x501d35){if(_0x501d35){var _0x739e5b=typeof _0xac9243['offset']===_0x5b29('0x1c')&&typeof _0xac9243[_0x5b29('0x1d')]==='undefined';var _0x5eb065=_0x501d35['count'];var _0x2059ad=_0x739e5b?0x0:_0xac9243[_0x5b29('0x1e')];var _0x1fd5c3=_0x739e5b?_0x501d35['count']:_0xac9243['offset']+_0xac9243[_0x5b29('0x1d')];var _0x1111b6;if(_0x1fd5c3>=_0x5eb065){_0x1fd5c3=_0x5eb065;_0x1111b6=0xc8;}else{_0x1111b6=0xce;}_0x1c1689[_0x5b29('0x1a')](_0x1111b6);return _0x1c1689['set']('Content-Range',_0x2059ad+'-'+_0x1fd5c3+'/'+_0x5eb065)['json'](_0x501d35);}return null;};}function patchUpdates(_0x11c9d7){return function(_0xf91707){try{jsonpatch[_0x5b29('0x1f')](_0xf91707,_0x11c9d7,!![]);}catch(_0x21a3b1){return BPromise[_0x5b29('0x20')](_0x21a3b1);}return _0xf91707[_0x5b29('0x21')]();};}function saveUpdates(_0x477aa6,_0xfe38fe){return function(_0x4adc27){if(_0x4adc27){return _0x4adc27[_0x5b29('0x22')](_0x477aa6)[_0x5b29('0x23')](function(_0x42aa3c){return _0x42aa3c;});}return null;};}function removeEntity(_0x5ed892,_0x2768ed){return function(_0x46417c){if(_0x46417c){return _0x46417c['destroy']()[_0x5b29('0x23')](function(){_0x5ed892[_0x5b29('0x1a')](0xcc)[_0x5b29('0x1b')]();});}};}function handleEntityNotFound(_0x232269,_0x4afedc){return function(_0x43a95d){if(!_0x43a95d){_0x232269['sendStatus'](0x194);}return _0x43a95d;};}function handleError(_0x4356c0,_0x4d1edf){_0x4d1edf=_0x4d1edf||0x1f4;return function(_0x47cc48){logger[_0x5b29('0x24')](_0x47cc48[_0x5b29('0x25')]);if(_0x47cc48[_0x5b29('0x26')]){delete _0x47cc48[_0x5b29('0x26')];}_0x4356c0[_0x5b29('0x1a')](_0x4d1edf)[_0x5b29('0x27')](_0x47cc48);};}exports[_0x5b29('0x28')]=function(_0x200795,_0x12f4bf){var _0x4c6754={},_0x2fa3b6={},_0x2a43ef={'count':0x0,'rows':[]};var _0xafaa=_['map'](db['FaxTransferReport'][_0x5b29('0x29')],function(_0x4bc0a7){return{'name':_0x4bc0a7[_0x5b29('0x2a')],'type':_0x4bc0a7[_0x5b29('0x2b')]['key']};});_0x2fa3b6['model']=_[_0x5b29('0x2c')](_0xafaa,_0x5b29('0x26'));_0x2fa3b6[_0x5b29('0x2d')]=_[_0x5b29('0x2e')](_0x200795['query']);_0x2fa3b6['filters']=_['intersection'](_0x2fa3b6['model'],_0x2fa3b6['query']);_0x4c6754[_0x5b29('0x2f')]=_[_0x5b29('0x30')](_0x2fa3b6['model'],qs[_0x5b29('0x31')](_0x200795[_0x5b29('0x2d')][_0x5b29('0x31')]));_0x4c6754[_0x5b29('0x2f')]=_0x4c6754[_0x5b29('0x2f')][_0x5b29('0x32')]?_0x4c6754[_0x5b29('0x2f')]:_0x2fa3b6['model'];if(!_0x200795['query'][_0x5b29('0x33')](_0x5b29('0x34'))){_0x4c6754[_0x5b29('0x1d')]=qs[_0x5b29('0x1d')](_0x200795[_0x5b29('0x2d')][_0x5b29('0x1d')]);_0x4c6754['offset']=qs[_0x5b29('0x1e')](_0x200795[_0x5b29('0x2d')]['offset']);}_0x4c6754[_0x5b29('0x35')]=qs[_0x5b29('0x36')](_0x200795[_0x5b29('0x2d')][_0x5b29('0x36')]);_0x4c6754[_0x5b29('0x37')]=qs['filters'](_['pick'](_0x200795[_0x5b29('0x2d')],_0x2fa3b6[_0x5b29('0x38')]),_0xafaa);if(_0x200795[_0x5b29('0x2d')][_0x5b29('0x39')]){_0x4c6754['where']=_[_0x5b29('0x3a')](_0x4c6754[_0x5b29('0x37')],{'$or':_['map'](_0xafaa,function(_0x33238a){if(_0x33238a[_0x5b29('0x2b')]!==_0x5b29('0x3b')){var _0xafbb20={};_0xafbb20[_0x33238a['name']]={'$like':'%'+_0x200795['query'][_0x5b29('0x39')]+'%'};return _0xafbb20;}})});}_0x4c6754=_[_0x5b29('0x3a')]({},_0x4c6754,_0x200795[_0x5b29('0x3c')]);var _0x41cc5b={'where':_0x4c6754['where']};return db[_0x5b29('0x3d')][_0x5b29('0x3e')](_0x41cc5b)['then'](function(_0x1ecda4){_0x2a43ef[_0x5b29('0x3e')]=_0x1ecda4;if(_0x200795[_0x5b29('0x2d')]['includeAll']){_0x4c6754[_0x5b29('0x3f')]=[{'all':!![]}];}return db[_0x5b29('0x3d')]['findAll'](_0x4c6754);})[_0x5b29('0x23')](function(_0x2c8611){_0x2a43ef[_0x5b29('0x40')]=_0x2c8611;return _0x2a43ef;})[_0x5b29('0x23')](respondWithFilteredResult(_0x12f4bf,_0x4c6754))[_0x5b29('0x41')](handleError(_0x12f4bf,null));};exports['show']=function(_0x5cfa9a,_0x92fc5a){var _0x1af81c={'raw':!![],'where':{'id':_0x5cfa9a[_0x5b29('0x42')]['id']}},_0x4c97e3={};_0x4c97e3[_0x5b29('0x43')]=_[_0x5b29('0x2e')](db['FaxTransferReport'][_0x5b29('0x29')]);_0x4c97e3[_0x5b29('0x2d')]=_[_0x5b29('0x2e')](_0x5cfa9a['query']);_0x4c97e3[_0x5b29('0x38')]=_[_0x5b29('0x30')](_0x4c97e3[_0x5b29('0x43')],_0x4c97e3[_0x5b29('0x2d')]);_0x1af81c[_0x5b29('0x2f')]=_['intersection'](_0x4c97e3[_0x5b29('0x43')],qs[_0x5b29('0x31')](_0x5cfa9a[_0x5b29('0x2d')]['fields']));_0x1af81c[_0x5b29('0x2f')]=_0x1af81c[_0x5b29('0x2f')][_0x5b29('0x32')]?_0x1af81c[_0x5b29('0x2f')]:_0x4c97e3['model'];if(_0x5cfa9a[_0x5b29('0x2d')]['includeAll']){_0x1af81c[_0x5b29('0x3f')]=[{'all':!![]}];}_0x1af81c=_[_0x5b29('0x3a')]({},_0x1af81c,_0x5cfa9a[_0x5b29('0x3c')]);return db[_0x5b29('0x3d')][_0x5b29('0x44')](_0x1af81c)[_0x5b29('0x23')](handleEntityNotFound(_0x92fc5a,null))[_0x5b29('0x23')](respondWithResult(_0x92fc5a,null))['catch'](handleError(_0x92fc5a,null));};exports[_0x5b29('0x45')]=function(_0x2418ea,_0x2eb123){return db[_0x5b29('0x3d')][_0x5b29('0x45')](_0x2418ea[_0x5b29('0x46')],{})[_0x5b29('0x23')](respondWithResult(_0x2eb123,0xc9))[_0x5b29('0x41')](handleError(_0x2eb123,null));};exports[_0x5b29('0x22')]=function(_0x175854,_0x100398){if(_0x175854[_0x5b29('0x46')]['id']){delete _0x175854[_0x5b29('0x46')]['id'];}return db[_0x5b29('0x3d')][_0x5b29('0x44')]({'where':{'id':_0x175854[_0x5b29('0x42')]['id']}})['then'](handleEntityNotFound(_0x100398,null))[_0x5b29('0x23')](saveUpdates(_0x175854[_0x5b29('0x46')],null))[_0x5b29('0x23')](respondWithResult(_0x100398,null))['catch'](handleError(_0x100398,null));};exports['destroy']=function(_0xb262dd,_0x44ce34){return db['FaxTransferReport']['find']({'where':{'id':_0xb262dd[_0x5b29('0x42')]['id']}})['then'](handleEntityNotFound(_0x44ce34,null))[_0x5b29('0x23')](removeEntity(_0x44ce34,null))['catch'](handleError(_0x44ce34,null));};exports[_0x5b29('0x47')]=function(_0xf9f5b3,_0x5802f2){return db[_0x5b29('0x3d')]['describe']()[_0x5b29('0x23')](respondWithResult(_0x5802f2,null))[_0x5b29('0x41')](handleError(_0x5802f2,null));}; \ No newline at end of file +var _0xcab5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','set','Content-Range','apply','reject','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x3c5240,_0x224c4f){var _0x1cb5da=function(_0x3d50a9){while(--_0x3d50a9){_0x3c5240['push'](_0x3c5240['shift']());}};_0x1cb5da(++_0x224c4f);}(_0xcab5,0x1ac));var _0x5cab=function(_0x339c04,_0x260810){_0x339c04=_0x339c04-0x0;var _0x4c14c2=_0xcab5[_0x339c04];return _0x4c14c2;};'use strict';var emlformat=require(_0x5cab('0x0'));var rimraf=require(_0x5cab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cab('0x2'));var rp=require('request-promise');var moment=require(_0x5cab('0x3'));var BPromise=require(_0x5cab('0x4'));var Mustache=require('mustache');var util=require(_0x5cab('0x5'));var path=require(_0x5cab('0x6'));var sox=require(_0x5cab('0x7'));var csv=require('to-csv');var ejs=require(_0x5cab('0x8'));var fs=require('fs');var fs_extra=require(_0x5cab('0x9'));var _=require(_0x5cab('0xa'));var squel=require(_0x5cab('0xb'));var crypto=require('crypto');var jsforce=require(_0x5cab('0xc'));var deskjs=require(_0x5cab('0xd'));var toCsv=require(_0x5cab('0xe'));var querystring=require(_0x5cab('0xf'));var Papa=require(_0x5cab('0x10'));var Redis=require(_0x5cab('0x11'));var authService=require(_0x5cab('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5cab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cab('0x14'))('api');var utils=require(_0x5cab('0x15'));var config=require(_0x5cab('0x16'));var licenseUtil=require(_0x5cab('0x17'));var db=require(_0x5cab('0x18'))['db'];function respondWithStatusCode(_0x4acb29,_0xd73d05){_0xd73d05=_0xd73d05||0xcc;return function(_0x2517e3){if(_0x2517e3){return _0x4acb29['sendStatus'](_0xd73d05);}return _0x4acb29[_0x5cab('0x19')](_0xd73d05)[_0x5cab('0x1a')]();};}function respondWithResult(_0x3dc86e,_0x3b6432){_0x3b6432=_0x3b6432||0xc8;return function(_0x10377a){if(_0x10377a){return _0x3dc86e[_0x5cab('0x19')](_0x3b6432)[_0x5cab('0x1b')](_0x10377a);}};}function respondWithFilteredResult(_0x35b521,_0x1f075b){return function(_0x45664f){if(_0x45664f){var _0x24e6eb=typeof _0x1f075b[_0x5cab('0x1c')]===_0x5cab('0x1d')&&typeof _0x1f075b['limit']===_0x5cab('0x1d');var _0x5e408b=_0x45664f['count'];var _0x3dc8eb=_0x24e6eb?0x0:_0x1f075b[_0x5cab('0x1c')];var _0x777aae=_0x24e6eb?_0x45664f['count']:_0x1f075b[_0x5cab('0x1c')]+_0x1f075b['limit'];var _0x2d205b;if(_0x777aae>=_0x5e408b){_0x777aae=_0x5e408b;_0x2d205b=0xc8;}else{_0x2d205b=0xce;}_0x35b521[_0x5cab('0x19')](_0x2d205b);return _0x35b521[_0x5cab('0x1e')](_0x5cab('0x1f'),_0x3dc8eb+'-'+_0x777aae+'/'+_0x5e408b)[_0x5cab('0x1b')](_0x45664f);}return null;};}function patchUpdates(_0x34a7fe){return function(_0x3d7b22){try{jsonpatch[_0x5cab('0x20')](_0x3d7b22,_0x34a7fe,!![]);}catch(_0x3239b7){return BPromise[_0x5cab('0x21')](_0x3239b7);}return _0x3d7b22['save']();};}function saveUpdates(_0xd7bbed,_0x54a34a){return function(_0x22a003){if(_0x22a003){return _0x22a003['update'](_0xd7bbed)[_0x5cab('0x22')](function(_0xcd00c7){return _0xcd00c7;});}return null;};}function removeEntity(_0x2859d5,_0x5ec7a2){return function(_0x2c41e0){if(_0x2c41e0){return _0x2c41e0['destroy']()[_0x5cab('0x22')](function(){_0x2859d5[_0x5cab('0x19')](0xcc)[_0x5cab('0x1a')]();});}};}function handleEntityNotFound(_0x3d04da,_0x5488bb){return function(_0x28d46c){if(!_0x28d46c){_0x3d04da['sendStatus'](0x194);}return _0x28d46c;};}function handleError(_0x84a2b,_0x91e26b){_0x91e26b=_0x91e26b||0x1f4;return function(_0x2ff30e){logger[_0x5cab('0x23')](_0x2ff30e[_0x5cab('0x24')]);if(_0x2ff30e[_0x5cab('0x25')]){delete _0x2ff30e[_0x5cab('0x25')];}_0x84a2b[_0x5cab('0x19')](_0x91e26b)['send'](_0x2ff30e);};}exports[_0x5cab('0x26')]=function(_0x2657c7,_0x3f7391){var _0x20c416={},_0x54f1a0={},_0x349890={'count':0x0,'rows':[]};var _0x2c1673=_[_0x5cab('0x27')](db[_0x5cab('0x28')][_0x5cab('0x29')],function(_0x3f6ff9){return{'name':_0x3f6ff9[_0x5cab('0x2a')],'type':_0x3f6ff9[_0x5cab('0x2b')][_0x5cab('0x2c')]};});_0x54f1a0[_0x5cab('0x2d')]=_[_0x5cab('0x27')](_0x2c1673,_0x5cab('0x25'));_0x54f1a0[_0x5cab('0x2e')]=_[_0x5cab('0x2f')](_0x2657c7[_0x5cab('0x2e')]);_0x54f1a0[_0x5cab('0x30')]=_[_0x5cab('0x31')](_0x54f1a0['model'],_0x54f1a0['query']);_0x20c416['attributes']=_[_0x5cab('0x31')](_0x54f1a0[_0x5cab('0x2d')],qs[_0x5cab('0x32')](_0x2657c7[_0x5cab('0x2e')][_0x5cab('0x32')]));_0x20c416['attributes']=_0x20c416['attributes'][_0x5cab('0x33')]?_0x20c416[_0x5cab('0x34')]:_0x54f1a0[_0x5cab('0x2d')];if(!_0x2657c7['query'][_0x5cab('0x35')](_0x5cab('0x36'))){_0x20c416[_0x5cab('0x37')]=qs[_0x5cab('0x37')](_0x2657c7[_0x5cab('0x2e')][_0x5cab('0x37')]);_0x20c416[_0x5cab('0x1c')]=qs[_0x5cab('0x1c')](_0x2657c7[_0x5cab('0x2e')][_0x5cab('0x1c')]);}_0x20c416['order']=qs[_0x5cab('0x38')](_0x2657c7['query'][_0x5cab('0x38')]);_0x20c416[_0x5cab('0x39')]=qs[_0x5cab('0x30')](_[_0x5cab('0x3a')](_0x2657c7['query'],_0x54f1a0[_0x5cab('0x30')]),_0x2c1673);if(_0x2657c7[_0x5cab('0x2e')][_0x5cab('0x3b')]){_0x20c416['where']=_[_0x5cab('0x3c')](_0x20c416[_0x5cab('0x39')],{'$or':_[_0x5cab('0x27')](_0x2c1673,function(_0x4e23d3){if(_0x4e23d3['type']!=='VIRTUAL'){var _0x15c93e={};_0x15c93e[_0x4e23d3[_0x5cab('0x25')]]={'$like':'%'+_0x2657c7[_0x5cab('0x2e')]['filter']+'%'};return _0x15c93e;}})});}_0x20c416=_[_0x5cab('0x3c')]({},_0x20c416,_0x2657c7[_0x5cab('0x3d')]);var _0x47436e={'where':_0x20c416[_0x5cab('0x39')]};return db[_0x5cab('0x28')][_0x5cab('0x3e')](_0x47436e)[_0x5cab('0x22')](function(_0x939d88){_0x349890[_0x5cab('0x3e')]=_0x939d88;if(_0x2657c7[_0x5cab('0x2e')][_0x5cab('0x3f')]){_0x20c416[_0x5cab('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x5cab('0x41')](_0x20c416);})['then'](function(_0x534cd0){_0x349890['rows']=_0x534cd0;return _0x349890;})[_0x5cab('0x22')](respondWithFilteredResult(_0x3f7391,_0x20c416))[_0x5cab('0x42')](handleError(_0x3f7391,null));};exports[_0x5cab('0x43')]=function(_0x5840ef,_0x317f09){var _0x8796c={'raw':!![],'where':{'id':_0x5840ef[_0x5cab('0x44')]['id']}},_0x2e7372={};_0x2e7372[_0x5cab('0x2d')]=_[_0x5cab('0x2f')](db['FaxTransferReport'][_0x5cab('0x29')]);_0x2e7372['query']=_[_0x5cab('0x2f')](_0x5840ef[_0x5cab('0x2e')]);_0x2e7372[_0x5cab('0x30')]=_[_0x5cab('0x31')](_0x2e7372[_0x5cab('0x2d')],_0x2e7372[_0x5cab('0x2e')]);_0x8796c[_0x5cab('0x34')]=_[_0x5cab('0x31')](_0x2e7372[_0x5cab('0x2d')],qs['fields'](_0x5840ef['query'][_0x5cab('0x32')]));_0x8796c[_0x5cab('0x34')]=_0x8796c[_0x5cab('0x34')]['length']?_0x8796c[_0x5cab('0x34')]:_0x2e7372[_0x5cab('0x2d')];if(_0x5840ef['query'][_0x5cab('0x3f')]){_0x8796c[_0x5cab('0x40')]=[{'all':!![]}];}_0x8796c=_[_0x5cab('0x3c')]({},_0x8796c,_0x5840ef[_0x5cab('0x3d')]);return db[_0x5cab('0x28')]['find'](_0x8796c)[_0x5cab('0x22')](handleEntityNotFound(_0x317f09,null))['then'](respondWithResult(_0x317f09,null))['catch'](handleError(_0x317f09,null));};exports[_0x5cab('0x45')]=function(_0x5efefa,_0x2ea56d){return db['FaxTransferReport'][_0x5cab('0x45')](_0x5efefa[_0x5cab('0x46')],{})[_0x5cab('0x22')](respondWithResult(_0x2ea56d,0xc9))[_0x5cab('0x42')](handleError(_0x2ea56d,null));};exports[_0x5cab('0x47')]=function(_0x5ddc29,_0x2425fb){if(_0x5ddc29[_0x5cab('0x46')]['id']){delete _0x5ddc29[_0x5cab('0x46')]['id'];}return db[_0x5cab('0x28')][_0x5cab('0x48')]({'where':{'id':_0x5ddc29[_0x5cab('0x44')]['id']}})['then'](handleEntityNotFound(_0x2425fb,null))[_0x5cab('0x22')](saveUpdates(_0x5ddc29[_0x5cab('0x46')],null))['then'](respondWithResult(_0x2425fb,null))[_0x5cab('0x42')](handleError(_0x2425fb,null));};exports['destroy']=function(_0x4e19d1,_0x4f31c9){return db[_0x5cab('0x28')]['find']({'where':{'id':_0x4e19d1[_0x5cab('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f31c9,null))['then'](removeEntity(_0x4f31c9,null))['catch'](handleError(_0x4f31c9,null));};exports['describe']=function(_0x3b4cc5,_0x12a39f){return db[_0x5cab('0x28')][_0x5cab('0x49')]()['then'](respondWithResult(_0x12a39f,null))[_0x5cab('0x42')](handleError(_0x12a39f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 797eb7d..ad8a34f 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 _0x00f4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x17bf64,_0x2b0e29){var _0x1c7d7e=function(_0xef10f8){while(--_0xef10f8){_0x17bf64['push'](_0x17bf64['shift']());}};_0x1c7d7e(++_0x2b0e29);}(_0x00f4,0x137));var _0x400f=function(_0x3d056e,_0x2a2402){_0x3d056e=_0x3d056e-0x0;var _0x4f908d=_0x00f4[_0x3d056e];return _0x4f908d;};'use strict';var _=require(_0x400f('0x0'));var util=require('util');var logger=require(_0x400f('0x1'))(_0x400f('0x2'));var moment=require(_0x400f('0x3'));var BPromise=require(_0x400f('0x4'));var rp=require(_0x400f('0x5'));var fs=require('fs');var path=require(_0x400f('0x6'));var rimraf=require(_0x400f('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x400f('0x8')]=function(_0x4b5171,_0x119326){return _0x4b5171[_0x400f('0x9')](_0x400f('0xa'),attributes,{'tableName':_0x400f('0xb'),'paranoid':![],'indexes':[{'name':_0x400f('0xc'),'fields':[_0x400f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa1b=['uniqueid','lodash','util','../../config/logger','moment','request-promise','path','exports','define','report_fax_transfer'];(function(_0x1cdfac,_0x175366){var _0x31235f=function(_0x6a2840){while(--_0x6a2840){_0x1cdfac['push'](_0x1cdfac['shift']());}};_0x31235f(++_0x175366);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var logger=require(_0xbaa1('0x2'))('api');var moment=require(_0xbaa1('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaa1('0x4'));var fs=require('fs');var path=require(_0xbaa1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xbaa1('0x6')]=function(_0x27b99c,_0x4a5735){return _0x27b99c[_0xbaa1('0x7')]('FaxTransferReport',attributes,{'tableName':_0xbaa1('0x8'),'paranoid':![],'indexes':[{'name':_0xbaa1('0x9'),'fields':[_0xbaa1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4948c67..fade1e2 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 _0xd228=['../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x49a97e,_0xd100c){var _0x10c37f=function(_0x4664bd){while(--_0x4664bd){_0x49a97e['push'](_0x49a97e['shift']());}};_0x10c37f(++_0xd100c);}(_0xd228,0x151));var _0x8d22=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0xd228[_0x577077];return _0x370769;};'use strict';var _=require(_0x8d22('0x0'));var util=require(_0x8d22('0x1'));var moment=require(_0x8d22('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d22('0x3'));var db=require(_0x8d22('0x4'))['db'];var utils=require(_0x8d22('0x5'));var logger=require(_0x8d22('0x6'))(_0x8d22('0x7'));var config=require(_0x8d22('0x8'));var jayson=require(_0x8d22('0x9'));var client=jayson[_0x8d22('0xa')][_0x8d22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f3f56,_0x210bac,_0x14e66e){return new BPromise(function(_0x368df0,_0x3f01f0){return client[_0x8d22('0xc')](_0x4f3f56,_0x14e66e)[_0x8d22('0xd')](function(_0x1b77bf){logger['info'](_0x8d22('0xe'),_0x210bac,_0x8d22('0xf'));logger['debug'](_0x8d22('0x10'),_0x210bac,_0x8d22('0xf'),JSON[_0x8d22('0x11')](_0x1b77bf));if(_0x1b77bf['error']){if(_0x1b77bf['error'][_0x8d22('0x12')]===0x1f4){logger[_0x8d22('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x210bac,_0x1b77bf['error'][_0x8d22('0x14')]);return _0x3f01f0(_0x1b77bf[_0x8d22('0x13')][_0x8d22('0x14')]);}logger[_0x8d22('0x13')](_0x8d22('0xe'),_0x210bac,_0x1b77bf[_0x8d22('0x13')]['message']);return _0x368df0(_0x1b77bf['error'][_0x8d22('0x14')]);}else{logger['info'](_0x8d22('0xe'),_0x210bac,_0x8d22('0xf'));_0x368df0(_0x1b77bf[_0x8d22('0x15')][_0x8d22('0x14')]);}})[_0x8d22('0x16')](function(_0x50b0aa){logger['error'](_0x8d22('0xe'),_0x210bac,_0x50b0aa);_0x3f01f0(_0x50b0aa);});});} \ No newline at end of file +var _0xf112=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf112,0x1d8));var _0x2f11=function(_0x12c263,_0x2d9bce){_0x12c263=_0x12c263-0x0;var _0x192cd7=_0xf112[_0x12c263];return _0x192cd7;};'use strict';var _=require(_0x2f11('0x0'));var util=require(_0x2f11('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f11('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f11('0x3'));var logger=require(_0x2f11('0x4'))(_0x2f11('0x5'));var config=require(_0x2f11('0x6'));var jayson=require(_0x2f11('0x7'));var client=jayson[_0x2f11('0x8')][_0x2f11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf533db,_0x52c2c4,_0xfa76cc){return new BPromise(function(_0x481fbb,_0x30aa02){return client['request'](_0xf533db,_0xfa76cc)[_0x2f11('0xa')](function(_0x491e8c){logger[_0x2f11('0xb')](_0x2f11('0xc'),_0x52c2c4,_0x2f11('0xd'));logger[_0x2f11('0xe')](_0x2f11('0xf'),_0x52c2c4,_0x2f11('0xd'),JSON[_0x2f11('0x10')](_0x491e8c));if(_0x491e8c[_0x2f11('0x11')]){if(_0x491e8c[_0x2f11('0x11')][_0x2f11('0x12')]===0x1f4){logger[_0x2f11('0x11')](_0x2f11('0xc'),_0x52c2c4,_0x491e8c[_0x2f11('0x11')]['message']);return _0x30aa02(_0x491e8c['error'][_0x2f11('0x13')]);}logger[_0x2f11('0x11')](_0x2f11('0xc'),_0x52c2c4,_0x491e8c[_0x2f11('0x11')][_0x2f11('0x13')]);return _0x481fbb(_0x491e8c[_0x2f11('0x11')][_0x2f11('0x13')]);}else{logger[_0x2f11('0xb')](_0x2f11('0xc'),_0x52c2c4,_0x2f11('0xd'));_0x481fbb(_0x491e8c[_0x2f11('0x14')][_0x2f11('0x13')]);}})[_0x2f11('0x15')](function(_0x40c5ac){logger['error'](_0x2f11('0xc'),_0x52c2c4,_0x40c5ac);_0x30aa02(_0x40c5ac);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3573ec3..e458339 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 _0xc68b=['get','isAuthenticated','/describe','describe','/:id','post','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x2d0086,_0x17dd17){var _0x5b1115=function(_0x256d59){while(--_0x256d59){_0x2d0086['push'](_0x2d0086['shift']());}};_0x5b1115(++_0x17dd17);}(_0xc68b,0x14e));var _0xbc68=function(_0x24f6f8,_0x3e51b6){_0x24f6f8=_0x24f6f8-0x0;var _0x16f779=_0xc68b[_0x24f6f8];return _0x16f779;};'use strict';var multer=require('multer');var util=require(_0xbc68('0x0'));var path=require(_0xbc68('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc68('0x2'));var router=express[_0xbc68('0x3')]();var fs_extra=require(_0xbc68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc68('0x5'));var config=require(_0xbc68('0x6'));var controller=require(_0xbc68('0x7'));router[_0xbc68('0x8')]('/',auth[_0xbc68('0x9')](),controller['index']);router['get'](_0xbc68('0xa'),auth[_0xbc68('0x9')](),controller[_0xbc68('0xb')]);router['get'](_0xbc68('0xc'),auth[_0xbc68('0x9')](),controller['show']);router[_0xbc68('0xd')]('/',auth[_0xbc68('0x9')](),controller['create']);router[_0xbc68('0xe')](_0xbc68('0xc'),auth[_0xbc68('0x9')](),controller['update']);router[_0xbc68('0xf')](_0xbc68('0xc'),auth[_0xbc68('0x9')](),controller[_0xbc68('0x10')]);module[_0xbc68('0x11')]=router; \ No newline at end of file +var _0xd28b=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd28b,0x68));var _0xbd28=function(_0x13af04,_0x34696c){_0x13af04=_0x13af04-0x0;var _0xd04e49=_0xd28b[_0x13af04];return _0xd04e49;};'use strict';var multer=require(_0xbd28('0x0'));var util=require(_0xbd28('0x1'));var path=require(_0xbd28('0x2'));var timeout=require(_0xbd28('0x3'));var express=require('express');var router=express[_0xbd28('0x4')]();var fs_extra=require(_0xbd28('0x5'));var auth=require(_0xbd28('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd28('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xbd28('0x8')](),controller[_0xbd28('0x9')]);router['get']('/describe',auth[_0xbd28('0x8')](),controller['describe']);router['get'](_0xbd28('0xa'),auth[_0xbd28('0x8')](),controller['show']);router[_0xbd28('0xb')]('/',auth['isAuthenticated'](),controller[_0xbd28('0xc')]);router[_0xbd28('0xd')](_0xbd28('0xa'),auth[_0xbd28('0x8')](),controller[_0xbd28('0xe')]);router[_0xbd28('0xf')](_0xbd28('0xa'),auth[_0xbd28('0x8')](),controller[_0xbd28('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a026203..844ca9a 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 _0x60f3=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x60f3,0x162));var _0x360f=function(_0x259c7e,_0x96223a){_0x259c7e=_0x259c7e-0x0;var _0x15d791=_0x60f3[_0x259c7e];return _0x15d791;};'use strict';var multer=require(_0x360f('0x0'));var util=require(_0x360f('0x1'));var path=require(_0x360f('0x2'));var timeout=require('connect-timeout');var express=require(_0x360f('0x3'));var router=express[_0x360f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x360f('0x5'));var interaction=require(_0x360f('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x360f('0x7')]('/',auth[_0x360f('0x8')](),controller['index']);router[_0x360f('0x7')](_0x360f('0x9'),auth['isAuthenticated'](),controller[_0x360f('0xa')]);router['get'](_0x360f('0xb'),auth[_0x360f('0x8')](),controller[_0x360f('0xc')]);router[_0x360f('0x7')]('/:id/fields',auth[_0x360f('0x8')](),controller[_0x360f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x360f('0xe')]);router[_0x360f('0xf')](_0x360f('0xb'),auth[_0x360f('0x8')](),controller[_0x360f('0x10')]);router[_0x360f('0x11')]('/:id',auth[_0x360f('0x8')](),controller[_0x360f('0x12')]);router[_0x360f('0x13')](_0x360f('0x9'),auth['isAuthenticated'](),controller[_0x360f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9b39=['./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x5dbbbf,_0x5627aa){var _0x1d053b=function(_0x4aca99){while(--_0x4aca99){_0x5dbbbf['push'](_0x5dbbbf['shift']());}};_0x1d053b(++_0x5627aa);}(_0x9b39,0xd8));var _0x99b3=function(_0x10e9cc,_0x81a27f){_0x10e9cc=_0x10e9cc-0x0;var _0x68de49=_0x9b39[_0x10e9cc];return _0x68de49;};'use strict';var multer=require(_0x99b3('0x0'));var util=require(_0x99b3('0x1'));var path=require('path');var timeout=require(_0x99b3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x99b3('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x99b3('0x4'));router[_0x99b3('0x5')]('/',auth[_0x99b3('0x6')](),controller[_0x99b3('0x7')]);router[_0x99b3('0x5')]('/:id',auth[_0x99b3('0x6')](),controller[_0x99b3('0x8')]);router[_0x99b3('0x5')](_0x99b3('0x9'),auth[_0x99b3('0x6')](),controller['getConfigurations']);router[_0x99b3('0x5')](_0x99b3('0xa'),auth[_0x99b3('0x6')](),controller[_0x99b3('0xb')]);router[_0x99b3('0xc')]('/',auth[_0x99b3('0x6')](),controller['create']);router[_0x99b3('0xc')](_0x99b3('0x9'),auth['isAuthenticated'](),controller[_0x99b3('0xd')]);router[_0x99b3('0xe')]('/:id',auth[_0x99b3('0x6')](),controller[_0x99b3('0xf')]);router[_0x99b3('0x10')](_0x99b3('0x11'),auth[_0x99b3('0x6')](),controller[_0x99b3('0x12')]);module[_0x99b3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 02901c3..4c11b99 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 _0xd9ac=['basic','integrationTab','newTab','STRING','ENUM'];(function(_0x332be2,_0x30b2c1){var _0x31f25a=function(_0x528900){while(--_0x528900){_0x332be2['push'](_0x332be2['shift']());}};_0x31f25a(++_0x30b2c1);}(_0xd9ac,0x12f));var _0xcd9a=function(_0x4623ad,_0x30f369){_0x4623ad=_0x4623ad-0x0;var _0x3a9ba5=_0xd9ac[_0x4623ad];return _0x3a9ba5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcd9a('0x0')]},'username':{'type':Sequelize[_0xcd9a('0x0')]},'remoteUri':{'type':Sequelize[_0xcd9a('0x0')]},'authType':{'type':Sequelize[_0xcd9a('0x1')]('basic'),'defaultValue':_0xcd9a('0x2')},'password':{'type':Sequelize[_0xcd9a('0x0')]},'consumerKey':{'type':Sequelize[_0xcd9a('0x0')]},'consumerSecret':{'type':Sequelize[_0xcd9a('0x0')]},'token':{'type':Sequelize[_0xcd9a('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xcd9a('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xcd9a('0x1')](_0xcd9a('0x3'),_0xcd9a('0x4')),'defaultValue':_0xcd9a('0x3')}}; \ No newline at end of file +var _0x08e9=['sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x08e9,0x154));var _0x908e=function(_0x2cc259,_0x3d207a){_0x2cc259=_0x2cc259-0x0;var _0x363640=_0x08e9[_0x2cc259];return _0x363640;};'use strict';var Sequelize=require(_0x908e('0x0'));module['exports']={'name':{'type':Sequelize[_0x908e('0x1')]},'description':{'type':Sequelize[_0x908e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x908e('0x1')]},'authType':{'type':Sequelize[_0x908e('0x2')](_0x908e('0x3')),'defaultValue':_0x908e('0x3')},'password':{'type':Sequelize[_0x908e('0x1')]},'consumerKey':{'type':Sequelize[_0x908e('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x908e('0x1')]},'tokenSecret':{'type':Sequelize[_0x908e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x908e('0x2')](_0x908e('0x4'),'newTab'),'defaultValue':_0x908e('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1cc8ef0..8a8c926 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 _0x1f1d=['Descriptions','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','basic','format','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','undefined','limit','count','offset','status','set','save','update','then','destroy','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','getConfigurations','findOne','DeskConfiguration','Subjects','channel','getDescriptions'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x1f1d,0xe9));var _0xd1f1=function(_0x527be8,_0x58d688){_0x527be8=_0x527be8-0x0;var _0x1c7a3f=_0x1f1d[_0x527be8];return _0x1c7a3f;};'use strict';var emlformat=require(_0xd1f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1f1('0x1'));var jsonpatch=require(_0xd1f1('0x2'));var rp=require(_0xd1f1('0x3'));var moment=require('moment');var BPromise=require(_0xd1f1('0x4'));var Mustache=require(_0xd1f1('0x5'));var util=require(_0xd1f1('0x6'));var path=require('path');var sox=require(_0xd1f1('0x7'));var csv=require(_0xd1f1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1f1('0x9'));var _=require('lodash');var squel=require(_0xd1f1('0xa'));var crypto=require(_0xd1f1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd1f1('0xc'));var toCsv=require(_0xd1f1('0x8'));var querystring=require('querystring');var Papa=require(_0xd1f1('0xd'));var Redis=require(_0xd1f1('0xe'));var authService=require(_0xd1f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd1f1('0x10'));var hardwareService=require(_0xd1f1('0x11'));var logger=require(_0xd1f1('0x12'))('api');var utils=require(_0xd1f1('0x13'));var config=require(_0xd1f1('0x14'));var licenseUtil=require(_0xd1f1('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd1f1('0x16'));function respondWithStatusCode(_0x35c522,_0x1f8b2f){_0x1f8b2f=_0x1f8b2f||0xcc;return function(_0x3aea28){if(_0x3aea28){return _0x35c522[_0xd1f1('0x17')](_0x1f8b2f);}return _0x35c522['status'](_0x1f8b2f)['end']();};}function respondWithResult(_0x8bafaf,_0x3c1ccb){_0x3c1ccb=_0x3c1ccb||0xc8;return function(_0x30d637){if(_0x30d637){return _0x8bafaf['status'](_0x3c1ccb)[_0xd1f1('0x18')](_0x30d637);}};}function respondWithFilteredResult(_0x3698be,_0x5b42e1){return function(_0x4b3b47){if(_0x4b3b47){var _0x56f60c=typeof _0x5b42e1['offset']===_0xd1f1('0x19')&&typeof _0x5b42e1[_0xd1f1('0x1a')]===_0xd1f1('0x19');var _0x12ce4b=_0x4b3b47[_0xd1f1('0x1b')];var _0x4db5f8=_0x56f60c?0x0:_0x5b42e1[_0xd1f1('0x1c')];var _0x4a374b=_0x56f60c?_0x4b3b47[_0xd1f1('0x1b')]:_0x5b42e1[_0xd1f1('0x1c')]+_0x5b42e1[_0xd1f1('0x1a')];var _0x3b8a78;if(_0x4a374b>=_0x12ce4b){_0x4a374b=_0x12ce4b;_0x3b8a78=0xc8;}else{_0x3b8a78=0xce;}_0x3698be[_0xd1f1('0x1d')](_0x3b8a78);return _0x3698be[_0xd1f1('0x1e')]('Content-Range',_0x4db5f8+'-'+_0x4a374b+'/'+_0x12ce4b)[_0xd1f1('0x18')](_0x4b3b47);}return null;};}function patchUpdates(_0x28b6bf){return function(_0x54e126){try{jsonpatch['apply'](_0x54e126,_0x28b6bf,!![]);}catch(_0x390d8d){return BPromise['reject'](_0x390d8d);}return _0x54e126[_0xd1f1('0x1f')]();};}function saveUpdates(_0x1b0741,_0x1d7c18){return function(_0x46f55e){if(_0x46f55e){return _0x46f55e[_0xd1f1('0x20')](_0x1b0741)[_0xd1f1('0x21')](function(_0x42af0e){return _0x42af0e;});}return null;};}function removeEntity(_0x423f7b,_0x513978){return function(_0x5e54e9){if(_0x5e54e9){return _0x5e54e9[_0xd1f1('0x22')]()[_0xd1f1('0x21')](function(){_0x423f7b[_0xd1f1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f026,_0x8a3dbc){return function(_0x18cdc8){if(!_0x18cdc8){_0x58f026['sendStatus'](0x194);}return _0x18cdc8;};}function handleError(_0xfe281f,_0x13ac23){_0x13ac23=_0x13ac23||0x1f4;return function(_0xc75b8f){logger['error'](_0xc75b8f['stack']);if(_0xc75b8f[_0xd1f1('0x23')]){delete _0xc75b8f['name'];}_0xfe281f[_0xd1f1('0x1d')](_0x13ac23)[_0xd1f1('0x24')](_0xc75b8f);};}exports['index']=function(_0x3a8d0a,_0x324a9e){var _0x30218c={},_0x89be52={},_0x27d20c={'count':0x0,'rows':[]};var _0x197c78=_[_0xd1f1('0x25')](db[_0xd1f1('0x26')][_0xd1f1('0x27')],function(_0x5b13f6){return{'name':_0x5b13f6[_0xd1f1('0x28')],'type':_0x5b13f6[_0xd1f1('0x29')][_0xd1f1('0x2a')]};});_0x89be52[_0xd1f1('0x2b')]=_[_0xd1f1('0x25')](_0x197c78,_0xd1f1('0x23'));_0x89be52['query']=_['keys'](_0x3a8d0a[_0xd1f1('0x2c')]);_0x89be52[_0xd1f1('0x2d')]=_['intersection'](_0x89be52[_0xd1f1('0x2b')],_0x89be52[_0xd1f1('0x2c')]);_0x30218c[_0xd1f1('0x2e')]=_[_0xd1f1('0x2f')](_0x89be52[_0xd1f1('0x2b')],qs[_0xd1f1('0x30')](_0x3a8d0a[_0xd1f1('0x2c')]['fields']));_0x30218c['attributes']=_0x30218c[_0xd1f1('0x2e')]['length']?_0x30218c[_0xd1f1('0x2e')]:_0x89be52['model'];if(!_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x31')](_0xd1f1('0x32'))){_0x30218c['limit']=qs[_0xd1f1('0x1a')](_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x1a')]);_0x30218c[_0xd1f1('0x1c')]=qs[_0xd1f1('0x1c')](_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x1c')]);}_0x30218c[_0xd1f1('0x33')]=qs[_0xd1f1('0x34')](_0x3a8d0a['query'][_0xd1f1('0x34')]);_0x30218c[_0xd1f1('0x35')]=qs[_0xd1f1('0x2d')](_[_0xd1f1('0x36')](_0x3a8d0a[_0xd1f1('0x2c')],_0x89be52[_0xd1f1('0x2d')]),_0x197c78);if(_0x3a8d0a['query']['filter']){_0x30218c[_0xd1f1('0x35')]=_[_0xd1f1('0x37')](_0x30218c[_0xd1f1('0x35')],{'$or':_['map'](_0x197c78,function(_0x8f6269){if(_0x8f6269[_0xd1f1('0x29')]!==_0xd1f1('0x38')){var _0x35b29d={};_0x35b29d[_0x8f6269['name']]={'$like':'%'+_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x39')]+'%'};return _0x35b29d;}})});}_0x30218c=_[_0xd1f1('0x37')]({},_0x30218c,_0x3a8d0a[_0xd1f1('0x3a')]);var _0x47cb21={'where':_0x30218c['where']};return db['DeskAccount']['count'](_0x47cb21)[_0xd1f1('0x21')](function(_0x554e23){_0x27d20c[_0xd1f1('0x1b')]=_0x554e23;if(_0x3a8d0a['query'][_0xd1f1('0x3b')]){_0x30218c['include']=[{'all':!![]}];}return db[_0xd1f1('0x26')][_0xd1f1('0x3c')](_0x30218c);})[_0xd1f1('0x21')](function(_0x32978b){_0x27d20c['rows']=_0x32978b;return _0x27d20c;})['then'](respondWithFilteredResult(_0x324a9e,_0x30218c))[_0xd1f1('0x3d')](handleError(_0x324a9e,null));};exports[_0xd1f1('0x3e')]=function(_0x3fd4af,_0x13ec7d){var _0x1d375d={'raw':![],'where':{'id':_0x3fd4af[_0xd1f1('0x3f')]['id']}},_0x230a02={};_0x230a02['model']=_[_0xd1f1('0x40')](db[_0xd1f1('0x26')]['rawAttributes']);_0x230a02[_0xd1f1('0x2c')]=_['keys'](_0x3fd4af[_0xd1f1('0x2c')]);_0x230a02[_0xd1f1('0x2d')]=_['intersection'](_0x230a02[_0xd1f1('0x2b')],_0x230a02[_0xd1f1('0x2c')]);_0x1d375d[_0xd1f1('0x2e')]=_['intersection'](_0x230a02[_0xd1f1('0x2b')],qs['fields'](_0x3fd4af[_0xd1f1('0x2c')][_0xd1f1('0x30')]));_0x1d375d[_0xd1f1('0x2e')]=_0x1d375d[_0xd1f1('0x2e')][_0xd1f1('0x41')]?_0x1d375d[_0xd1f1('0x2e')]:_0x230a02[_0xd1f1('0x2b')];if(_0x3fd4af[_0xd1f1('0x2c')][_0xd1f1('0x3b')]){_0x1d375d[_0xd1f1('0x42')]=[{'all':!![]}];}_0x1d375d=_[_0xd1f1('0x37')]({},_0x1d375d,_0x3fd4af[_0xd1f1('0x3a')]);return db['DeskAccount'][_0xd1f1('0x43')](_0x1d375d)[_0xd1f1('0x21')](handleEntityNotFound(_0x13ec7d,null))[_0xd1f1('0x21')](respondWithResult(_0x13ec7d,null))[_0xd1f1('0x3d')](handleError(_0x13ec7d,null));};exports[_0xd1f1('0x44')]=function(_0x16cab8,_0x5a5b41){return db['DeskAccount'][_0xd1f1('0x44')](_0x16cab8[_0xd1f1('0x45')],{})[_0xd1f1('0x21')](respondWithResult(_0x5a5b41,0xc9))[_0xd1f1('0x3d')](handleError(_0x5a5b41,null));};exports[_0xd1f1('0x20')]=function(_0x1c3be2,_0x164dbf){if(_0x1c3be2[_0xd1f1('0x45')]['id']){delete _0x1c3be2['body']['id'];}return db['DeskAccount'][_0xd1f1('0x43')]({'where':{'id':_0x1c3be2['params']['id']}})[_0xd1f1('0x21')](handleEntityNotFound(_0x164dbf,null))[_0xd1f1('0x21')](saveUpdates(_0x1c3be2[_0xd1f1('0x45')],null))['then'](respondWithResult(_0x164dbf,null))[_0xd1f1('0x3d')](handleError(_0x164dbf,null));};exports[_0xd1f1('0x22')]=function(_0x16ce7b,_0xcedbe9){return db['DeskAccount'][_0xd1f1('0x43')]({'where':{'id':_0x16ce7b['params']['id']}})[_0xd1f1('0x21')](handleEntityNotFound(_0xcedbe9,null))['then'](removeEntity(_0xcedbe9,null))[_0xd1f1('0x3d')](handleError(_0xcedbe9,null));};exports[_0xd1f1('0x46')]=function(_0x41e17f,_0x582d7a,_0x25294e){var _0x1c58f3={};var _0x144064={};var _0x4b0fbd;var _0x18238d;return db[_0xd1f1('0x26')][_0xd1f1('0x47')]({'where':{'id':_0x41e17f[_0xd1f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x582d7a,null))['then'](function(_0x5396ed){if(_0x5396ed){_0x4b0fbd=_0x5396ed;_0x144064[_0xd1f1('0x2b')]=_['keys'](db[_0xd1f1('0x48')][_0xd1f1('0x27')]);_0x144064['query']=_[_0xd1f1('0x40')](_0x41e17f[_0xd1f1('0x2c')]);_0x144064['filters']=_[_0xd1f1('0x2f')](_0x144064[_0xd1f1('0x2b')],_0x144064[_0xd1f1('0x2c')]);_0x1c58f3[_0xd1f1('0x2e')]=_[_0xd1f1('0x2f')](_0x144064[_0xd1f1('0x2b')],qs[_0xd1f1('0x30')](_0x41e17f[_0xd1f1('0x2c')]['fields']));_0x1c58f3[_0xd1f1('0x2e')]=_0x1c58f3[_0xd1f1('0x2e')]['length']?_0x1c58f3['attributes']:_0x144064[_0xd1f1('0x2b')];_0x1c58f3['order']=qs[_0xd1f1('0x34')](_0x41e17f['query'][_0xd1f1('0x34')]);_0x1c58f3['where']=qs[_0xd1f1('0x2d')](_[_0xd1f1('0x36')](_0x41e17f[_0xd1f1('0x2c')],_0x144064['filters']));if(_0x41e17f[_0xd1f1('0x2c')]['filter']){_0x1c58f3[_0xd1f1('0x35')]=_['merge'](_0x1c58f3[_0xd1f1('0x35')],{'$or':_['map'](_0x1c58f3[_0xd1f1('0x2e')],function(_0x5be045){var _0x4bf945={};_0x4bf945[_0x5be045]={'$like':'%'+_0x41e17f[_0xd1f1('0x2c')]['filter']+'%'};return _0x4bf945;})});}_0x1c58f3=_[_0xd1f1('0x37')]({},_0x1c58f3,_0x41e17f[_0xd1f1('0x3a')]);return _0x4b0fbd[_0xd1f1('0x46')](_0x1c58f3);}})[_0xd1f1('0x21')](function(_0x33d12c){if(_0x33d12c){_0x18238d=_0x33d12c[_0xd1f1('0x41')];if(!_0x41e17f['query'][_0xd1f1('0x31')]('nolimit')){_0x1c58f3[_0xd1f1('0x1a')]=qs[_0xd1f1('0x1a')](_0x41e17f[_0xd1f1('0x2c')][_0xd1f1('0x1a')]);_0x1c58f3[_0xd1f1('0x1c')]=qs[_0xd1f1('0x1c')](_0x41e17f[_0xd1f1('0x2c')][_0xd1f1('0x1c')]);}return _0x4b0fbd[_0xd1f1('0x46')](_0x1c58f3);}})['then'](function(_0x1bbc5){if(_0x1bbc5){return _0x1bbc5?{'count':_0x18238d,'rows':_0x1bbc5}:null;}})[_0xd1f1('0x21')](respondWithResult(_0x582d7a,null))['catch'](handleError(_0x582d7a,null));};exports['addConfiguration']=function(_0x2806b9,_0x2ee0f4,_0x54a769){if(_0x2806b9[_0xd1f1('0x45')]['id']){delete _0x2806b9[_0xd1f1('0x45')]['id'];}return db[_0xd1f1('0x26')][_0xd1f1('0x47')]({'where':{'id':_0x2806b9['params']['id']}})[_0xd1f1('0x21')](handleEntityNotFound(_0x2ee0f4,null))[_0xd1f1('0x21')](function(_0x2344b9){if(_0x2344b9){_0x2806b9[_0xd1f1('0x45')]['AccountId']=_0x2344b9['id'];_0x2806b9['body'][_0xd1f1('0x49')]=integrations['getSubjects'](_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x4a')],_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x29')]);_0x2806b9[_0xd1f1('0x45')]['Descriptions']=integrations[_0xd1f1('0x4b')](_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x4a')],_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x29')]);return db[_0xd1f1('0x48')]['create'](_0x2806b9[_0xd1f1('0x45')],{'include':[{'model':db['DeskField'],'as':_0xd1f1('0x49')},{'model':db['DeskField'],'as':_0xd1f1('0x4c')}]});}return null;})[_0xd1f1('0x21')](respondWithResult(_0x2ee0f4,null))[_0xd1f1('0x3d')](handleError(_0x2ee0f4,null));};exports['getFields']=function(_0x480f0c,_0xed52d7,_0x138ca6){var _0x54d87c=[{'name':_0xd1f1('0x4d'),'label':_0xd1f1('0x4d'),'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 _0x5202b8='';return db['DeskAccount'][_0xd1f1('0x47')]({'where':{'id':_0x480f0c['params']['id']},'attributes':['id',_0xd1f1('0x4e'),_0xd1f1('0x4f'),_0xd1f1('0x50'),'password','consumerKey',_0xd1f1('0x51'),_0xd1f1('0x52'),_0xd1f1('0x53')]})['then'](handleEntityNotFound(_0xed52d7,null))[_0xd1f1('0x21')](function(_0x19a2ba){if(_0x19a2ba){_0x5202b8=_0x19a2ba[_0xd1f1('0x4e')];var _0x1aeff2=_0x5202b8[_0xd1f1('0x54')](-0x1);if(_0x1aeff2==='/'){_0x5202b8=_0x5202b8[_0xd1f1('0x55')](0x0,_0x5202b8[_0xd1f1('0x56')](_0x1aeff2));}var _0x4f8ef5={'method':_0xd1f1('0x57'),'uri':util['format']('%s/custom_fields',_0x5202b8),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x19a2ba[_0xd1f1('0x4f')]===_0xd1f1('0x58')){_0x4f8ef5['headers']['Authorization']=util[_0xd1f1('0x59')]('Basic\x20%s',new Buffer(util['format'](_0xd1f1('0x5a'),_0x19a2ba[_0xd1f1('0x50')],_0x19a2ba[_0xd1f1('0x5b')]))[_0xd1f1('0x5c')](_0xd1f1('0x5d')));}return rp(_0x4f8ef5)[_0xd1f1('0x21')](function(_0x597d0e){return _0x54d87c[_0xd1f1('0x5e')](_[_0xd1f1('0x25')](_0x597d0e[_0xd1f1('0x5f')][_0xd1f1('0x60')],function(_0x385b64){return{'id':_0x385b64[_0xd1f1('0x23')],'name':_0x385b64[_0xd1f1('0x23')],'type':_0x385b64[_0xd1f1('0x29')],'active':_0x385b64[_0xd1f1('0x61')],'label':_0x385b64[_0xd1f1('0x62')],'custom':!![]};}));});}})[_0xd1f1('0x21')](function(_0x291402){return{'count':_0x291402[_0xd1f1('0x41')],'rows':_0x291402};})[_0xd1f1('0x21')](respondWithResult(_0xed52d7,null))[_0xd1f1('0x3d')](function(_0x1cad1b){var _0x12088b=_0x480f0c[_0xd1f1('0x2c')][_0xd1f1('0x63')]?0x1f4:_0x1cad1b[_0xd1f1('0x64')]||0x1f4;logger['error'](_0xd1f1('0x65'),_0xd1f1('0x66'),_0x12088b,JSON['stringify'](_0x1cad1b));delete _0x1cad1b[_0xd1f1('0x23')];if(_0x12088b===0x191){_0x12088b=0x190;}_0xed52d7['status'](_0x12088b)[_0xd1f1('0x24')](_0x480f0c[_0xd1f1('0x2c')][_0xd1f1('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x1cad1b[_0xd1f1('0x64')]}:_0x1cad1b);});}; \ No newline at end of file +var _0x3318=['consumerSecret','remoteUri','slice','lastIndexOf','GET','format','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','DeskAccount','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','DeskConfiguration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','DeskField','getFields','priority','username','consumerKey'];(function(_0x4018b2,_0x1caa31){var _0x5aa84c=function(_0x275d8f){while(--_0x275d8f){_0x4018b2['push'](_0x4018b2['shift']());}};_0x5aa84c(++_0x1caa31);}(_0x3318,0xec));var _0x8331=function(_0x17c84b,_0x209fb2){_0x17c84b=_0x17c84b-0x0;var _0x168720=_0x3318[_0x17c84b];return _0x168720;};'use strict';var emlformat=require(_0x8331('0x0'));var rimraf=require(_0x8331('0x1'));var zipdir=require(_0x8331('0x2'));var jsonpatch=require(_0x8331('0x3'));var rp=require(_0x8331('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8331('0x5'));var util=require(_0x8331('0x6'));var path=require('path');var sox=require(_0x8331('0x7'));var csv=require('to-csv');var ejs=require(_0x8331('0x8'));var fs=require('fs');var fs_extra=require(_0x8331('0x9'));var _=require('lodash');var squel=require(_0x8331('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8331('0xb'));var toCsv=require(_0x8331('0xc'));var querystring=require('querystring');var Papa=require(_0x8331('0xd'));var Redis=require(_0x8331('0xe'));var authService=require(_0x8331('0xf'));var qs=require(_0x8331('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8331('0x11'));var logger=require('../../config/logger')(_0x8331('0x12'));var utils=require(_0x8331('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8331('0x14'));var db=require(_0x8331('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2430bd,_0x371105){_0x371105=_0x371105||0xcc;return function(_0x25d6ff){if(_0x25d6ff){return _0x2430bd['sendStatus'](_0x371105);}return _0x2430bd['status'](_0x371105)[_0x8331('0x16')]();};}function respondWithResult(_0x5a2069,_0x4525c3){_0x4525c3=_0x4525c3||0xc8;return function(_0xab03be){if(_0xab03be){return _0x5a2069[_0x8331('0x17')](_0x4525c3)[_0x8331('0x18')](_0xab03be);}};}function respondWithFilteredResult(_0x5adf02,_0x587314){return function(_0x7adb0c){if(_0x7adb0c){var _0x2741f3=typeof _0x587314[_0x8331('0x19')]===_0x8331('0x1a')&&typeof _0x587314[_0x8331('0x1b')]===_0x8331('0x1a');var _0x56f6be=_0x7adb0c[_0x8331('0x1c')];var _0x3ba6cd=_0x2741f3?0x0:_0x587314[_0x8331('0x19')];var _0x2303cb=_0x2741f3?_0x7adb0c['count']:_0x587314[_0x8331('0x19')]+_0x587314[_0x8331('0x1b')];var _0x552772;if(_0x2303cb>=_0x56f6be){_0x2303cb=_0x56f6be;_0x552772=0xc8;}else{_0x552772=0xce;}_0x5adf02[_0x8331('0x17')](_0x552772);return _0x5adf02[_0x8331('0x1d')](_0x8331('0x1e'),_0x3ba6cd+'-'+_0x2303cb+'/'+_0x56f6be)['json'](_0x7adb0c);}return null;};}function patchUpdates(_0x2e0e72){return function(_0x4abc0b){try{jsonpatch[_0x8331('0x1f')](_0x4abc0b,_0x2e0e72,!![]);}catch(_0xcd331f){return BPromise[_0x8331('0x20')](_0xcd331f);}return _0x4abc0b['save']();};}function saveUpdates(_0x875551,_0x5cb812){return function(_0x526f95){if(_0x526f95){return _0x526f95['update'](_0x875551)[_0x8331('0x21')](function(_0x2dfb39){return _0x2dfb39;});}return null;};}function removeEntity(_0x1e2f13,_0x2e503a){return function(_0x1f6e47){if(_0x1f6e47){return _0x1f6e47[_0x8331('0x22')]()['then'](function(){_0x1e2f13['status'](0xcc)[_0x8331('0x16')]();});}};}function handleEntityNotFound(_0x3f39b0,_0x316601){return function(_0x15b00d){if(!_0x15b00d){_0x3f39b0['sendStatus'](0x194);}return _0x15b00d;};}function handleError(_0x2d09e6,_0x20d109){_0x20d109=_0x20d109||0x1f4;return function(_0x2d9274){logger[_0x8331('0x23')](_0x2d9274['stack']);if(_0x2d9274[_0x8331('0x24')]){delete _0x2d9274[_0x8331('0x24')];}_0x2d09e6['status'](_0x20d109)[_0x8331('0x25')](_0x2d9274);};}exports[_0x8331('0x26')]=function(_0x2c9238,_0x511f23){var _0x251959={},_0x44b859={},_0x2d3ff3={'count':0x0,'rows':[]};var _0x519c2a=_['map'](db[_0x8331('0x27')][_0x8331('0x28')],function(_0x2bc6c8){return{'name':_0x2bc6c8['fieldName'],'type':_0x2bc6c8[_0x8331('0x29')]['key']};});_0x44b859['model']=_[_0x8331('0x2a')](_0x519c2a,_0x8331('0x24'));_0x44b859[_0x8331('0x2b')]=_[_0x8331('0x2c')](_0x2c9238[_0x8331('0x2b')]);_0x44b859[_0x8331('0x2d')]=_[_0x8331('0x2e')](_0x44b859[_0x8331('0x2f')],_0x44b859[_0x8331('0x2b')]);_0x251959[_0x8331('0x30')]=_[_0x8331('0x2e')](_0x44b859[_0x8331('0x2f')],qs[_0x8331('0x31')](_0x2c9238['query']['fields']));_0x251959[_0x8331('0x30')]=_0x251959[_0x8331('0x30')][_0x8331('0x32')]?_0x251959[_0x8331('0x30')]:_0x44b859['model'];if(!_0x2c9238['query'][_0x8331('0x33')](_0x8331('0x34'))){_0x251959[_0x8331('0x1b')]=qs['limit'](_0x2c9238[_0x8331('0x2b')][_0x8331('0x1b')]);_0x251959[_0x8331('0x19')]=qs[_0x8331('0x19')](_0x2c9238[_0x8331('0x2b')]['offset']);}_0x251959['order']=qs[_0x8331('0x35')](_0x2c9238['query'][_0x8331('0x35')]);_0x251959[_0x8331('0x36')]=qs[_0x8331('0x2d')](_[_0x8331('0x37')](_0x2c9238[_0x8331('0x2b')],_0x44b859[_0x8331('0x2d')]),_0x519c2a);if(_0x2c9238[_0x8331('0x2b')][_0x8331('0x38')]){_0x251959[_0x8331('0x36')]=_['merge'](_0x251959[_0x8331('0x36')],{'$or':_[_0x8331('0x2a')](_0x519c2a,function(_0x4938ce){if(_0x4938ce[_0x8331('0x29')]!=='VIRTUAL'){var _0x3626a0={};_0x3626a0[_0x4938ce['name']]={'$like':'%'+_0x2c9238[_0x8331('0x2b')]['filter']+'%'};return _0x3626a0;}})});}_0x251959=_[_0x8331('0x39')]({},_0x251959,_0x2c9238[_0x8331('0x3a')]);var _0x2b2597={'where':_0x251959['where']};return db[_0x8331('0x27')]['count'](_0x2b2597)[_0x8331('0x21')](function(_0x1296ec){_0x2d3ff3['count']=_0x1296ec;if(_0x2c9238['query'][_0x8331('0x3b')]){_0x251959[_0x8331('0x3c')]=[{'all':!![]}];}return db[_0x8331('0x27')][_0x8331('0x3d')](_0x251959);})[_0x8331('0x21')](function(_0x34aa44){_0x2d3ff3[_0x8331('0x3e')]=_0x34aa44;return _0x2d3ff3;})[_0x8331('0x21')](respondWithFilteredResult(_0x511f23,_0x251959))[_0x8331('0x3f')](handleError(_0x511f23,null));};exports[_0x8331('0x40')]=function(_0x1b5bf7,_0x2fe256){var _0x4e2b55={'raw':![],'where':{'id':_0x1b5bf7[_0x8331('0x41')]['id']}},_0x1f0640={};_0x1f0640[_0x8331('0x2f')]=_[_0x8331('0x2c')](db['DeskAccount'][_0x8331('0x28')]);_0x1f0640[_0x8331('0x2b')]=_['keys'](_0x1b5bf7[_0x8331('0x2b')]);_0x1f0640[_0x8331('0x2d')]=_['intersection'](_0x1f0640[_0x8331('0x2f')],_0x1f0640['query']);_0x4e2b55[_0x8331('0x30')]=_[_0x8331('0x2e')](_0x1f0640[_0x8331('0x2f')],qs['fields'](_0x1b5bf7[_0x8331('0x2b')][_0x8331('0x31')]));_0x4e2b55[_0x8331('0x30')]=_0x4e2b55['attributes'][_0x8331('0x32')]?_0x4e2b55[_0x8331('0x30')]:_0x1f0640[_0x8331('0x2f')];if(_0x1b5bf7[_0x8331('0x2b')][_0x8331('0x3b')]){_0x4e2b55[_0x8331('0x3c')]=[{'all':!![]}];}_0x4e2b55=_[_0x8331('0x39')]({},_0x4e2b55,_0x1b5bf7['options']);return db[_0x8331('0x27')][_0x8331('0x42')](_0x4e2b55)[_0x8331('0x21')](handleEntityNotFound(_0x2fe256,null))[_0x8331('0x21')](respondWithResult(_0x2fe256,null))['catch'](handleError(_0x2fe256,null));};exports[_0x8331('0x43')]=function(_0x4a1d9,_0x16e5f9){return db[_0x8331('0x27')][_0x8331('0x43')](_0x4a1d9[_0x8331('0x44')],{})['then'](respondWithResult(_0x16e5f9,0xc9))[_0x8331('0x3f')](handleError(_0x16e5f9,null));};exports[_0x8331('0x45')]=function(_0x5dc931,_0x179357){if(_0x5dc931[_0x8331('0x44')]['id']){delete _0x5dc931[_0x8331('0x44')]['id'];}return db[_0x8331('0x27')][_0x8331('0x42')]({'where':{'id':_0x5dc931['params']['id']}})[_0x8331('0x21')](handleEntityNotFound(_0x179357,null))[_0x8331('0x21')](saveUpdates(_0x5dc931[_0x8331('0x44')],null))['then'](respondWithResult(_0x179357,null))[_0x8331('0x3f')](handleError(_0x179357,null));};exports['destroy']=function(_0x40ed6d,_0xf16c79){return db[_0x8331('0x27')][_0x8331('0x42')]({'where':{'id':_0x40ed6d['params']['id']}})[_0x8331('0x21')](handleEntityNotFound(_0xf16c79,null))[_0x8331('0x21')](removeEntity(_0xf16c79,null))[_0x8331('0x3f')](handleError(_0xf16c79,null));};exports[_0x8331('0x46')]=function(_0x2051af,_0x37f087,_0x3945aa){var _0x268243={};var _0x19da29={};var _0x20e70f;var _0x3e00cc;return db[_0x8331('0x27')][_0x8331('0x47')]({'where':{'id':_0x2051af['params']['id']}})['then'](handleEntityNotFound(_0x37f087,null))['then'](function(_0x2cbffd){if(_0x2cbffd){_0x20e70f=_0x2cbffd;_0x19da29['model']=_[_0x8331('0x2c')](db[_0x8331('0x48')][_0x8331('0x28')]);_0x19da29[_0x8331('0x2b')]=_[_0x8331('0x2c')](_0x2051af[_0x8331('0x2b')]);_0x19da29[_0x8331('0x2d')]=_[_0x8331('0x2e')](_0x19da29[_0x8331('0x2f')],_0x19da29[_0x8331('0x2b')]);_0x268243['attributes']=_[_0x8331('0x2e')](_0x19da29[_0x8331('0x2f')],qs['fields'](_0x2051af[_0x8331('0x2b')][_0x8331('0x31')]));_0x268243[_0x8331('0x30')]=_0x268243['attributes'][_0x8331('0x32')]?_0x268243[_0x8331('0x30')]:_0x19da29['model'];_0x268243[_0x8331('0x49')]=qs[_0x8331('0x35')](_0x2051af[_0x8331('0x2b')][_0x8331('0x35')]);_0x268243[_0x8331('0x36')]=qs[_0x8331('0x2d')](_['pick'](_0x2051af[_0x8331('0x2b')],_0x19da29['filters']));if(_0x2051af[_0x8331('0x2b')][_0x8331('0x38')]){_0x268243[_0x8331('0x36')]=_['merge'](_0x268243[_0x8331('0x36')],{'$or':_['map'](_0x268243[_0x8331('0x30')],function(_0x4347a9){var _0x18440a={};_0x18440a[_0x4347a9]={'$like':'%'+_0x2051af[_0x8331('0x2b')][_0x8331('0x38')]+'%'};return _0x18440a;})});}_0x268243=_[_0x8331('0x39')]({},_0x268243,_0x2051af[_0x8331('0x3a')]);return _0x20e70f['getConfigurations'](_0x268243);}})[_0x8331('0x21')](function(_0x2516bd){if(_0x2516bd){_0x3e00cc=_0x2516bd['length'];if(!_0x2051af[_0x8331('0x2b')][_0x8331('0x33')](_0x8331('0x34'))){_0x268243[_0x8331('0x1b')]=qs[_0x8331('0x1b')](_0x2051af[_0x8331('0x2b')]['limit']);_0x268243[_0x8331('0x19')]=qs[_0x8331('0x19')](_0x2051af[_0x8331('0x2b')][_0x8331('0x19')]);}return _0x20e70f[_0x8331('0x46')](_0x268243);}})[_0x8331('0x21')](function(_0x5ad38e){if(_0x5ad38e){return _0x5ad38e?{'count':_0x3e00cc,'rows':_0x5ad38e}:null;}})['then'](respondWithResult(_0x37f087,null))[_0x8331('0x3f')](handleError(_0x37f087,null));};exports[_0x8331('0x4a')]=function(_0x5123df,_0x4eb85c,_0x5c8eb8){if(_0x5123df['body']['id']){delete _0x5123df['body']['id'];}return db[_0x8331('0x27')]['findOne']({'where':{'id':_0x5123df['params']['id']}})[_0x8331('0x21')](handleEntityNotFound(_0x4eb85c,null))[_0x8331('0x21')](function(_0x536f94){if(_0x536f94){_0x5123df['body'][_0x8331('0x4b')]=_0x536f94['id'];_0x5123df[_0x8331('0x44')]['Subjects']=integrations[_0x8331('0x4c')](_0x5123df[_0x8331('0x44')][_0x8331('0x4d')],_0x5123df['body'][_0x8331('0x29')]);_0x5123df[_0x8331('0x44')][_0x8331('0x4e')]=integrations['getDescriptions'](_0x5123df[_0x8331('0x44')]['channel'],_0x5123df['body'][_0x8331('0x29')]);return db[_0x8331('0x48')]['create'](_0x5123df[_0x8331('0x44')],{'include':[{'model':db['DeskField'],'as':_0x8331('0x4f')},{'model':db[_0x8331('0x50')],'as':_0x8331('0x4e')}]});}return null;})['then'](respondWithResult(_0x4eb85c,null))[_0x8331('0x3f')](handleError(_0x4eb85c,null));};exports[_0x8331('0x51')]=function(_0x25153a,_0xe97ca7,_0x620c98){var _0xf796b6=[{'name':_0x8331('0x52'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2c32a3='';return db[_0x8331('0x27')][_0x8331('0x47')]({'where':{'id':_0x25153a['params']['id']},'attributes':['id','remoteUri','authType',_0x8331('0x53'),'password',_0x8331('0x54'),_0x8331('0x55'),'token','tokenSecret']})[_0x8331('0x21')](handleEntityNotFound(_0xe97ca7,null))['then'](function(_0x20a6d7){if(_0x20a6d7){_0x2c32a3=_0x20a6d7[_0x8331('0x56')];var _0x50db8d=_0x2c32a3[_0x8331('0x57')](-0x1);if(_0x50db8d==='/'){_0x2c32a3=_0x2c32a3['substring'](0x0,_0x2c32a3[_0x8331('0x58')](_0x50db8d));}var _0x181427={'method':_0x8331('0x59'),'uri':util[_0x8331('0x5a')]('%s/custom_fields',_0x2c32a3),'headers':{'Content-Type':_0x8331('0x5b'),'Accept':_0x8331('0x5b')},'json':!![]};if(_0x20a6d7[_0x8331('0x5c')]===_0x8331('0x5d')){_0x181427[_0x8331('0x5e')][_0x8331('0x5f')]=util[_0x8331('0x5a')](_0x8331('0x60'),new Buffer(util[_0x8331('0x5a')](_0x8331('0x61'),_0x20a6d7[_0x8331('0x53')],_0x20a6d7['password']))['toString'](_0x8331('0x62')));}return rp(_0x181427)[_0x8331('0x21')](function(_0x3bd4ae){return _0xf796b6['concat'](_[_0x8331('0x2a')](_0x3bd4ae[_0x8331('0x63')][_0x8331('0x64')],function(_0x3e1c42){return{'id':_0x3e1c42[_0x8331('0x24')],'name':_0x3e1c42['name'],'type':_0x3e1c42['type'],'active':_0x3e1c42[_0x8331('0x65')],'label':_0x3e1c42[_0x8331('0x66')],'custom':!![]};}));});}})['then'](function(_0x49ee90){return{'count':_0x49ee90[_0x8331('0x32')],'rows':_0x49ee90};})[_0x8331('0x21')](respondWithResult(_0xe97ca7,null))[_0x8331('0x3f')](function(_0x520bad){var _0x347c2d=_0x25153a['query'][_0x8331('0x67')]?0x1f4:_0x520bad[_0x8331('0x68')]||0x1f4;logger['error'](_0x8331('0x69'),_0x8331('0x51'),_0x347c2d,JSON['stringify'](_0x520bad));delete _0x520bad[_0x8331('0x24')];if(_0x347c2d===0x191){_0x347c2d=0x190;}_0xe97ca7[_0x8331('0x17')](_0x347c2d)[_0x8331('0x25')](_0x25153a[_0x8331('0x2b')][_0x8331('0x67')]?{'message':_0x8331('0x6a'),'statusCode':_0x520bad[_0x8331('0x68')]}:_0x520bad);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ab7d74c..3d830e5 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 _0x5b66=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes'];(function(_0x376d5e,_0x10f273){var _0x259ae9=function(_0x5655b8){while(--_0x5655b8){_0x376d5e['push'](_0x376d5e['shift']());}};_0x259ae9(++_0x10f273);}(_0x5b66,0x1e1));var _0x65b6=function(_0xd123d8,_0x5a20be){_0xd123d8=_0xd123d8-0x0;var _0x3a48f8=_0x5b66[_0xd123d8];return _0x3a48f8;};'use strict';var _=require(_0x65b6('0x0'));var util=require(_0x65b6('0x1'));var logger=require('../../config/logger')(_0x65b6('0x2'));var moment=require(_0x65b6('0x3'));var BPromise=require(_0x65b6('0x4'));var rp=require(_0x65b6('0x5'));var fs=require('fs');var path=require(_0x65b6('0x6'));var rimraf=require('rimraf');var config=require(_0x65b6('0x7'));var attributes=require(_0x65b6('0x8'));var integrations=require(_0x65b6('0x9'));module[_0x65b6('0xa')]=function(_0x274913,_0x3c31ef){return _0x274913[_0x65b6('0xb')](_0x65b6('0xc'),attributes,{'tableName':_0x65b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae2=['exports','define','DeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8ae2,0x73));var _0x28ae=function(_0x528677,_0x2d92fe){_0x528677=_0x528677-0x0;var _0x3c6bde=_0x8ae2[_0x528677];return _0x3c6bde;};'use strict';var _=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var logger=require(_0x28ae('0x2'))(_0x28ae('0x3'));var moment=require(_0x28ae('0x4'));var BPromise=require(_0x28ae('0x5'));var rp=require(_0x28ae('0x6'));var fs=require('fs');var path=require(_0x28ae('0x7'));var rimraf=require('rimraf');var config=require(_0x28ae('0x8'));var attributes=require(_0x28ae('0x9'));var integrations=require(_0x28ae('0xa'));module[_0x28ae('0xb')]=function(_0x789d65,_0x598166){return _0x789d65[_0x28ae('0xc')](_0x28ae('0xd'),attributes,{'tableName':'int_desk_accounts','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 3d4638d..225b8f0 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 _0xffaa=['rpc','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetDeskAccount','stringify','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x33928f,_0x147a47){var _0x470f03=function(_0x49234a){while(--_0x49234a){_0x33928f['push'](_0x33928f['shift']());}};_0x470f03(++_0x147a47);}(_0xffaa,0x1b4));var _0xaffa=function(_0xf89f09,_0x3dcc55){_0xf89f09=_0xf89f09-0x0;var _0x4c74c2=_0xffaa[_0xf89f09];return _0x4c74c2;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var moment=require(_0xaffa('0x2'));var BPromise=require(_0xaffa('0x3'));var rs=require(_0xaffa('0x4'));var fs=require('fs');var Redis=require(_0xaffa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaffa('0x6'));var logger=require(_0xaffa('0x7'))(_0xaffa('0x8'));var config=require('../../config/environment');var jayson=require(_0xaffa('0x9'));var client=jayson['client'][_0xaffa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5069de,_0xc461ac,_0x3e3872){return new BPromise(function(_0x316cec,_0x28ecbf){return client[_0xaffa('0xb')](_0x5069de,_0x3e3872)[_0xaffa('0xc')](function(_0x12fa16){logger[_0xaffa('0xd')](_0xaffa('0xe'),_0xc461ac,_0xaffa('0xf'));logger[_0xaffa('0x10')](_0xaffa('0x11'),_0xc461ac,_0xaffa('0xf'),JSON['stringify'](_0x12fa16));if(_0x12fa16[_0xaffa('0x12')]){if(_0x12fa16[_0xaffa('0x12')][_0xaffa('0x13')]===0x1f4){logger[_0xaffa('0x12')](_0xaffa('0xe'),_0xc461ac,_0x12fa16['error'][_0xaffa('0x14')]);return _0x28ecbf(_0x12fa16[_0xaffa('0x12')]['message']);}logger[_0xaffa('0x12')](_0xaffa('0xe'),_0xc461ac,_0x12fa16[_0xaffa('0x12')][_0xaffa('0x14')]);return _0x316cec(_0x12fa16[_0xaffa('0x12')][_0xaffa('0x14')]);}else{logger['info'](_0xaffa('0xe'),_0xc461ac,_0xaffa('0xf'));_0x316cec(_0x12fa16[_0xaffa('0x15')][_0xaffa('0x14')]);}})[_0xaffa('0x16')](function(_0x4a4528){logger[_0xaffa('0x12')](_0xaffa('0xe'),_0xc461ac,_0x4a4528);_0x28ecbf(_0x4a4528);});});}exports['GetDeskAccount']=function(_0x3e6cc5){var _0x524538=this;return new Promise(function(_0x402d43,_0x3d17fa){return db['DeskAccount'][_0xaffa('0x17')]({'raw':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')][_0xaffa('0x19')]===undefined?!![]:![]:!![],'where':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')][_0xaffa('0x1a')]||null:null,'attributes':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5['options'][_0xaffa('0x1b')]||null:null,'limit':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')][_0xaffa('0x1c')]||null:null,'include':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')]['include']?_['map'](_0x3e6cc5['options'][_0xaffa('0x1d')],function(_0x19734c){return{'model':db[_0x19734c[_0xaffa('0x1e')]],'as':_0x19734c['as'],'attributes':_0x19734c[_0xaffa('0x1b')],'include':_0x19734c[_0xaffa('0x1d')]?_['map'](_0x19734c['include'],function(_0x2e0356){return{'model':db[_0x2e0356[_0xaffa('0x1e')]],'as':_0x2e0356['as'],'attributes':_0x2e0356[_0xaffa('0x1b')],'include':_0x2e0356['include']?_[_0xaffa('0x1f')](_0x2e0356[_0xaffa('0x1d')],function(_0x5b1169){return{'model':db[_0x5b1169[_0xaffa('0x1e')]],'as':_0x5b1169['as'],'attributes':_0x5b1169['attributes']};}):[]};}):[]};}):[]:[]})[_0xaffa('0xc')](function(_0x395399){logger[_0xaffa('0xd')](_0xaffa('0x20'),_0x3e6cc5);logger['debug'](_0xaffa('0x20'),_0x3e6cc5,JSON[_0xaffa('0x21')](_0x395399));_0x402d43(_0x395399);})[_0xaffa('0x16')](function(_0x488231){logger[_0xaffa('0x12')](_0xaffa('0x20'),_0x488231[_0xaffa('0x14')],_0x3e6cc5);_0x3d17fa(_0x524538[_0xaffa('0x12')](0x1f4,_0x488231[_0xaffa('0x14')]));});});};exports[_0xaffa('0x22')]=function(_0x3c005d){var _0x3d49f6=this;return new Promise(function(_0x4bec50,_0x398f93){return db[_0xaffa('0x23')][_0xaffa('0x24')]({'raw':_0x3c005d[_0xaffa('0x18')]?_0x3c005d[_0xaffa('0x18')][_0xaffa('0x19')]===undefined?!![]:![]:!![],'where':_0x3c005d['options']?_0x3c005d['options'][_0xaffa('0x1a')]||null:null,'attributes':_0x3c005d['options']?_0x3c005d['options'][_0xaffa('0x1b')]||null:null,'include':_0x3c005d[_0xaffa('0x18')]?_0x3c005d[_0xaffa('0x18')]['include']?_[_0xaffa('0x1f')](_0x3c005d[_0xaffa('0x18')][_0xaffa('0x1d')],function(_0x1cdaae){return{'model':db[_0x1cdaae[_0xaffa('0x1e')]],'as':_0x1cdaae['as'],'attributes':_0x1cdaae['attributes'],'include':_0x1cdaae[_0xaffa('0x1d')]?_['map'](_0x1cdaae[_0xaffa('0x1d')],function(_0x4c761a){return{'model':db[_0x4c761a['model']],'as':_0x4c761a['as'],'attributes':_0x4c761a['attributes'],'include':_0x4c761a['include']?_[_0xaffa('0x1f')](_0x4c761a['include'],function(_0x3fa1ce){return{'model':db[_0x3fa1ce[_0xaffa('0x1e')]],'as':_0x3fa1ce['as'],'attributes':_0x3fa1ce[_0xaffa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaffa('0xc')](function(_0x1c8139){logger[_0xaffa('0xd')](_0xaffa('0x22'),_0x3c005d);logger[_0xaffa('0x10')](_0xaffa('0x22'),_0x3c005d,JSON[_0xaffa('0x21')](_0x1c8139));_0x4bec50(_0x1c8139);})[_0xaffa('0x16')](function(_0x2e2c57){logger[_0xaffa('0x12')](_0xaffa('0x22'),_0x2e2c57[_0xaffa('0x14')],_0x3c005d);_0x398f93(_0x3d49f6[_0xaffa('0x12')](0x1f4,_0x2e2c57[_0xaffa('0x14')]));});});}; \ No newline at end of file +var _0xf5fb=['map','include','model','ShowDeskAccount','find','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes'];(function(_0x3ef8f7,_0x35359a){var _0x3b097e=function(_0x189c92){while(--_0x189c92){_0x3ef8f7['push'](_0x3ef8f7['shift']());}};_0x3b097e(++_0x35359a);}(_0xf5fb,0xb5));var _0xbf5f=function(_0x308ab2,_0x21c720){_0x308ab2=_0x308ab2-0x0;var _0x4d76ef=_0xf5fb[_0x308ab2];return _0x4d76ef;};'use strict';var _=require(_0xbf5f('0x0'));var util=require(_0xbf5f('0x1'));var moment=require(_0xbf5f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf5f('0x3'));var db=require(_0xbf5f('0x4'))['db'];var utils=require(_0xbf5f('0x5'));var logger=require(_0xbf5f('0x6'))(_0xbf5f('0x7'));var config=require(_0xbf5f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf5f('0x9')][_0xbf5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ae7ed,_0x10ab7d,_0x33a509){return new BPromise(function(_0x42cf21,_0xfd4b8b){return client[_0xbf5f('0xb')](_0x5ae7ed,_0x33a509)[_0xbf5f('0xc')](function(_0x268308){logger[_0xbf5f('0xd')](_0xbf5f('0xe'),_0x10ab7d,_0xbf5f('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x10ab7d,_0xbf5f('0xf'),JSON[_0xbf5f('0x10')](_0x268308));if(_0x268308[_0xbf5f('0x11')]){if(_0x268308[_0xbf5f('0x11')][_0xbf5f('0x12')]===0x1f4){logger['error'](_0xbf5f('0xe'),_0x10ab7d,_0x268308[_0xbf5f('0x11')][_0xbf5f('0x13')]);return _0xfd4b8b(_0x268308[_0xbf5f('0x11')][_0xbf5f('0x13')]);}logger['error'](_0xbf5f('0xe'),_0x10ab7d,_0x268308['error']['message']);return _0x42cf21(_0x268308['error'][_0xbf5f('0x13')]);}else{logger['info'](_0xbf5f('0xe'),_0x10ab7d,'request\x20sent');_0x42cf21(_0x268308[_0xbf5f('0x14')]['message']);}})[_0xbf5f('0x15')](function(_0x457893){logger[_0xbf5f('0x11')](_0xbf5f('0xe'),_0x10ab7d,_0x457893);_0xfd4b8b(_0x457893);});});}exports[_0xbf5f('0x16')]=function(_0x33497d){var _0x436ca2=this;return new Promise(function(_0x15c21b,_0x425710){return db[_0xbf5f('0x17')][_0xbf5f('0x18')]({'raw':_0x33497d['options']?_0x33497d[_0xbf5f('0x19')][_0xbf5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x33497d['options']?_0x33497d[_0xbf5f('0x19')][_0xbf5f('0x1b')]||null:null,'attributes':_0x33497d[_0xbf5f('0x19')]?_0x33497d[_0xbf5f('0x19')][_0xbf5f('0x1c')]||null:null,'limit':_0x33497d['options']?_0x33497d['options']['limit']||null:null,'include':_0x33497d[_0xbf5f('0x19')]?_0x33497d[_0xbf5f('0x19')]['include']?_[_0xbf5f('0x1d')](_0x33497d[_0xbf5f('0x19')][_0xbf5f('0x1e')],function(_0x12d0bd){return{'model':db[_0x12d0bd[_0xbf5f('0x1f')]],'as':_0x12d0bd['as'],'attributes':_0x12d0bd[_0xbf5f('0x1c')],'include':_0x12d0bd[_0xbf5f('0x1e')]?_[_0xbf5f('0x1d')](_0x12d0bd['include'],function(_0xf06fde){return{'model':db[_0xf06fde[_0xbf5f('0x1f')]],'as':_0xf06fde['as'],'attributes':_0xf06fde[_0xbf5f('0x1c')],'include':_0xf06fde[_0xbf5f('0x1e')]?_[_0xbf5f('0x1d')](_0xf06fde['include'],function(_0xd3e466){return{'model':db[_0xd3e466['model']],'as':_0xd3e466['as'],'attributes':_0xd3e466[_0xbf5f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16b620){logger[_0xbf5f('0xd')]('GetDeskAccount',_0x33497d);logger['debug']('GetDeskAccount',_0x33497d,JSON['stringify'](_0x16b620));_0x15c21b(_0x16b620);})[_0xbf5f('0x15')](function(_0x793a7a){logger[_0xbf5f('0x11')](_0xbf5f('0x16'),_0x793a7a[_0xbf5f('0x13')],_0x33497d);_0x425710(_0x436ca2[_0xbf5f('0x11')](0x1f4,_0x793a7a[_0xbf5f('0x13')]));});});};exports[_0xbf5f('0x20')]=function(_0x184d48){var _0x55098d=this;return new Promise(function(_0x5d8ea8,_0x4413d5){return db[_0xbf5f('0x17')][_0xbf5f('0x21')]({'raw':_0x184d48[_0xbf5f('0x19')]?_0x184d48[_0xbf5f('0x19')][_0xbf5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x184d48[_0xbf5f('0x19')]?_0x184d48['options'][_0xbf5f('0x1b')]||null:null,'attributes':_0x184d48['options']?_0x184d48[_0xbf5f('0x19')][_0xbf5f('0x1c')]||null:null,'include':_0x184d48['options']?_0x184d48[_0xbf5f('0x19')][_0xbf5f('0x1e')]?_['map'](_0x184d48[_0xbf5f('0x19')][_0xbf5f('0x1e')],function(_0x3d6821){return{'model':db[_0x3d6821['model']],'as':_0x3d6821['as'],'attributes':_0x3d6821['attributes'],'include':_0x3d6821[_0xbf5f('0x1e')]?_['map'](_0x3d6821['include'],function(_0x45c683){return{'model':db[_0x45c683[_0xbf5f('0x1f')]],'as':_0x45c683['as'],'attributes':_0x45c683[_0xbf5f('0x1c')],'include':_0x45c683[_0xbf5f('0x1e')]?_[_0xbf5f('0x1d')](_0x45c683['include'],function(_0x2d6655){return{'model':db[_0x2d6655['model']],'as':_0x2d6655['as'],'attributes':_0x2d6655[_0xbf5f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53539d){logger[_0xbf5f('0xd')](_0xbf5f('0x20'),_0x184d48);logger[_0xbf5f('0x22')](_0xbf5f('0x20'),_0x184d48,JSON[_0xbf5f('0x10')](_0x53539d));_0x5d8ea8(_0x53539d);})[_0xbf5f('0x15')](function(_0xb421b6){logger[_0xbf5f('0x11')](_0xbf5f('0x20'),_0xb421b6[_0xbf5f('0x13')],_0x184d48);_0x4413d5(_0x55098d[_0xbf5f('0x11')](0x1f4,_0xb421b6[_0xbf5f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ce57b22..a51a46d 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x5bee08,_0x2c0d63){var _0x39054b=function(_0x32bd07){while(--_0x32bd07){_0x5bee08['push'](_0x5bee08['shift']());}};_0x39054b(++_0x2c0d63);}(_0xedd9,0xfc));var _0x9edd=function(_0x178e67,_0x14fa99){_0x178e67=_0x178e67-0x0;var _0x44aef8=_0xedd9[_0x178e67];return _0x44aef8;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x529d18,_0x17dcc3){var _0x5cc40b=function(_0x289bdd){while(--_0x289bdd){_0x529d18['push'](_0x529d18['shift']());}};_0x5cc40b(++_0x17dcc3);}(_0xedd9,0xfc));var _0x9edd=function(_0x3809e3,_0x132e51){_0x3809e3=_0x3809e3-0x0;var _0x334579=_0xedd9[_0x3809e3];return _0x334579;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 03743c6..c2fa701 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 _0xa6fd=['STRING','sequelize'];(function(_0x2f800b,_0x54303d){var _0x55ca60=function(_0x5dd143){while(--_0x5dd143){_0x2f800b['push'](_0x2f800b['shift']());}};_0x55ca60(++_0x54303d);}(_0xa6fd,0x189));var _0xda6f=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0xa6fd[_0x2e68db];return _0x12df4c;};'use strict';var Sequelize=require(_0xda6f('0x0'));module['exports']={'name':{'type':Sequelize[_0xda6f('0x1')]},'description':{'type':Sequelize[_0xda6f('0x1')]}}; \ No newline at end of file +var _0xddb1=['exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xddb1,0x17e));var _0x1ddb=function(_0x4b0e01,_0x2f8564){_0x4b0e01=_0x4b0e01-0x0;var _0x56aee0=_0xddb1[_0x4b0e01];return _0x56aee0;};'use strict';var Sequelize=require('sequelize');module[_0x1ddb('0x0')]={'name':{'type':Sequelize[_0x1ddb('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c7862d6..afe9d87 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 _0x516d=['length','find','create','body','destroy','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','error','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x58c687,_0x3fec26){var _0x5e9c26=function(_0x25dac7){while(--_0x25dac7){_0x58c687['push'](_0x58c687['shift']());}};_0x5e9c26(++_0x3fec26);}(_0x516d,0x15e));var _0xd516=function(_0x29cb4f,_0x26a21d){_0x29cb4f=_0x29cb4f-0x0;var _0x51e06d=_0x516d[_0x29cb4f];return _0x51e06d;};'use strict';var emlformat=require(_0xd516('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd516('0x1'));var jsonpatch=require(_0xd516('0x2'));var rp=require('request-promise');var moment=require(_0xd516('0x3'));var BPromise=require(_0xd516('0x4'));var Mustache=require(_0xd516('0x5'));var util=require(_0xd516('0x6'));var path=require(_0xd516('0x7'));var sox=require(_0xd516('0x8'));var csv=require(_0xd516('0x9'));var ejs=require(_0xd516('0xa'));var fs=require('fs');var fs_extra=require(_0xd516('0xb'));var _=require(_0xd516('0xc'));var squel=require(_0xd516('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd516('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd516('0xf'));var Papa=require('papaparse');var Redis=require(_0xd516('0x10'));var authService=require(_0xd516('0x11'));var qs=require(_0xd516('0x12'));var as=require(_0xd516('0x13'));var hardwareService=require(_0xd516('0x14'));var logger=require(_0xd516('0x15'))('api');var utils=require(_0xd516('0x16'));var config=require(_0xd516('0x17'));var licenseUtil=require(_0xd516('0x18'));var db=require(_0xd516('0x19'))['db'];function respondWithStatusCode(_0x218469,_0x417ccf){_0x417ccf=_0x417ccf||0xcc;return function(_0x576f5a){if(_0x576f5a){return _0x218469[_0xd516('0x1a')](_0x417ccf);}return _0x218469[_0xd516('0x1b')](_0x417ccf)[_0xd516('0x1c')]();};}function respondWithResult(_0x5f568f,_0x249c0b){_0x249c0b=_0x249c0b||0xc8;return function(_0x180241){if(_0x180241){return _0x5f568f['status'](_0x249c0b)[_0xd516('0x1d')](_0x180241);}};}function respondWithFilteredResult(_0x35fa0,_0x2bc614){return function(_0x2dc7d3){if(_0x2dc7d3){var _0x52f320=typeof _0x2bc614['offset']===_0xd516('0x1e')&&typeof _0x2bc614[_0xd516('0x1f')]==='undefined';var _0x300950=_0x2dc7d3[_0xd516('0x20')];var _0x3838bb=_0x52f320?0x0:_0x2bc614['offset'];var _0xdf2179=_0x52f320?_0x2dc7d3[_0xd516('0x20')]:_0x2bc614['offset']+_0x2bc614[_0xd516('0x1f')];var _0x48e663;if(_0xdf2179>=_0x300950){_0xdf2179=_0x300950;_0x48e663=0xc8;}else{_0x48e663=0xce;}_0x35fa0[_0xd516('0x1b')](_0x48e663);return _0x35fa0['set']('Content-Range',_0x3838bb+'-'+_0xdf2179+'/'+_0x300950)[_0xd516('0x1d')](_0x2dc7d3);}return null;};}function patchUpdates(_0x2b7783){return function(_0x281689){try{jsonpatch[_0xd516('0x21')](_0x281689,_0x2b7783,!![]);}catch(_0x2f4d59){return BPromise[_0xd516('0x22')](_0x2f4d59);}return _0x281689[_0xd516('0x23')]();};}function saveUpdates(_0x2a52b1,_0x341da3){return function(_0x244121){if(_0x244121){return _0x244121[_0xd516('0x24')](_0x2a52b1)['then'](function(_0x438181){return _0x438181;});}return null;};}function removeEntity(_0x2cdb19,_0x172595){return function(_0x1c5ae6){if(_0x1c5ae6){return _0x1c5ae6['destroy']()[_0xd516('0x25')](function(){_0x2cdb19[_0xd516('0x1b')](0xcc)[_0xd516('0x1c')]();});}};}function handleEntityNotFound(_0x5771c1,_0x775a99){return function(_0x3c970f){if(!_0x3c970f){_0x5771c1[_0xd516('0x1a')](0x194);}return _0x3c970f;};}function handleError(_0x14029a,_0x134d76){_0x134d76=_0x134d76||0x1f4;return function(_0x4970b7){logger[_0xd516('0x26')](_0x4970b7['stack']);if(_0x4970b7[_0xd516('0x27')]){delete _0x4970b7['name'];}_0x14029a[_0xd516('0x1b')](_0x134d76)[_0xd516('0x28')](_0x4970b7);};}exports[_0xd516('0x29')]=function(_0x5e274d,_0x2da6c2){var _0x3d334b={},_0x83dc60={},_0x527c70={'count':0x0,'rows':[]};var _0x3826b1=_['map'](db[_0xd516('0x2a')][_0xd516('0x2b')],function(_0x420989){return{'name':_0x420989[_0xd516('0x2c')],'type':_0x420989['type'][_0xd516('0x2d')]};});_0x83dc60[_0xd516('0x2e')]=_[_0xd516('0x2f')](_0x3826b1,_0xd516('0x27'));_0x83dc60[_0xd516('0x30')]=_[_0xd516('0x31')](_0x5e274d[_0xd516('0x30')]);_0x83dc60[_0xd516('0x32')]=_[_0xd516('0x33')](_0x83dc60['model'],_0x83dc60[_0xd516('0x30')]);_0x3d334b[_0xd516('0x34')]=_[_0xd516('0x33')](_0x83dc60[_0xd516('0x2e')],qs[_0xd516('0x35')](_0x5e274d[_0xd516('0x30')][_0xd516('0x35')]));_0x3d334b[_0xd516('0x34')]=_0x3d334b[_0xd516('0x34')]['length']?_0x3d334b[_0xd516('0x34')]:_0x83dc60['model'];if(!_0x5e274d['query']['hasOwnProperty'](_0xd516('0x36'))){_0x3d334b[_0xd516('0x1f')]=qs['limit'](_0x5e274d[_0xd516('0x30')][_0xd516('0x1f')]);_0x3d334b[_0xd516('0x37')]=qs[_0xd516('0x37')](_0x5e274d[_0xd516('0x30')]['offset']);}_0x3d334b[_0xd516('0x38')]=qs['sort'](_0x5e274d[_0xd516('0x30')][_0xd516('0x39')]);_0x3d334b[_0xd516('0x3a')]=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0x5e274d[_0xd516('0x30')],_0x83dc60['filters']),_0x3826b1);if(_0x5e274d[_0xd516('0x30')][_0xd516('0x3c')]){_0x3d334b[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x3d334b['where'],{'$or':_[_0xd516('0x2f')](_0x3826b1,function(_0xdf739b){if(_0xdf739b['type']!==_0xd516('0x3e')){var _0xa0f938={};_0xa0f938[_0xdf739b[_0xd516('0x27')]]={'$like':'%'+_0x5e274d[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0xa0f938;}})});}_0x3d334b=_['merge']({},_0x3d334b,_0x5e274d[_0xd516('0x3f')]);var _0x4419d8={'where':_0x3d334b['where']};return db[_0xd516('0x2a')][_0xd516('0x20')](_0x4419d8)['then'](function(_0x1e722a){_0x527c70[_0xd516('0x20')]=_0x1e722a;if(_0x5e274d[_0xd516('0x30')][_0xd516('0x40')]){_0x3d334b[_0xd516('0x41')]=[{'all':!![]}];}return db[_0xd516('0x2a')][_0xd516('0x42')](_0x3d334b);})[_0xd516('0x25')](function(_0x43da71){_0x527c70[_0xd516('0x43')]=_0x43da71;return _0x527c70;})[_0xd516('0x25')](respondWithFilteredResult(_0x2da6c2,_0x3d334b))[_0xd516('0x44')](handleError(_0x2da6c2,null));};exports['show']=function(_0x293c50,_0x389407){var _0x352cd2={'raw':![],'where':{'id':_0x293c50[_0xd516('0x45')]['id']}},_0x48c34a={};_0x48c34a[_0xd516('0x2e')]=_[_0xd516('0x31')](db[_0xd516('0x2a')]['rawAttributes']);_0x48c34a[_0xd516('0x30')]=_[_0xd516('0x31')](_0x293c50[_0xd516('0x30')]);_0x48c34a['filters']=_[_0xd516('0x33')](_0x48c34a[_0xd516('0x2e')],_0x48c34a[_0xd516('0x30')]);_0x352cd2[_0xd516('0x34')]=_[_0xd516('0x33')](_0x48c34a['model'],qs['fields'](_0x293c50[_0xd516('0x30')]['fields']));_0x352cd2[_0xd516('0x34')]=_0x352cd2['attributes'][_0xd516('0x46')]?_0x352cd2['attributes']:_0x48c34a['model'];if(_0x293c50[_0xd516('0x30')][_0xd516('0x40')]){_0x352cd2[_0xd516('0x41')]=[{'all':!![]}];}_0x352cd2=_['merge']({},_0x352cd2,_0x293c50['options']);return db[_0xd516('0x2a')][_0xd516('0x47')](_0x352cd2)['then'](handleEntityNotFound(_0x389407,null))[_0xd516('0x25')](respondWithResult(_0x389407,null))[_0xd516('0x44')](handleError(_0x389407,null));};exports['create']=function(_0x140215,_0x1329cd){return db[_0xd516('0x2a')][_0xd516('0x48')](_0x140215[_0xd516('0x49')],{})[_0xd516('0x25')](respondWithResult(_0x1329cd,0xc9))['catch'](handleError(_0x1329cd,null));};exports[_0xd516('0x24')]=function(_0x1eb178,_0x29b02b){if(_0x1eb178[_0xd516('0x49')]['id']){delete _0x1eb178['body']['id'];}return db[_0xd516('0x2a')][_0xd516('0x47')]({'where':{'id':_0x1eb178['params']['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x29b02b,null))[_0xd516('0x25')](saveUpdates(_0x1eb178[_0xd516('0x49')],null))[_0xd516('0x25')](respondWithResult(_0x29b02b,null))[_0xd516('0x44')](handleError(_0x29b02b,null));};exports[_0xd516('0x4a')]=function(_0x5ee760,_0xbb69ac){return db[_0xd516('0x2a')][_0xd516('0x47')]({'where':{'id':_0x5ee760['params']['id']}})[_0xd516('0x25')](handleEntityNotFound(_0xbb69ac,null))['then'](removeEntity(_0xbb69ac,null))[_0xd516('0x44')](handleError(_0xbb69ac,null));};exports[_0xd516('0x4b')]=function(_0x4fea9b,_0x1b4360,_0x8273b9){var _0x75de9e={};var _0x277289={};var _0xa4d08a;var _0x1f7dee;return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0x4fea9b[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x1b4360,null))[_0xd516('0x25')](function(_0x54cd3a){if(_0x54cd3a){_0xa4d08a=_0x54cd3a;_0x277289['model']=_[_0xd516('0x31')](db[_0xd516('0x4d')][_0xd516('0x2b')]);_0x277289[_0xd516('0x30')]=_[_0xd516('0x31')](_0x4fea9b['query']);_0x277289[_0xd516('0x32')]=_['intersection'](_0x277289['model'],_0x277289[_0xd516('0x30')]);_0x75de9e[_0xd516('0x34')]=_[_0xd516('0x33')](_0x277289['model'],qs['fields'](_0x4fea9b['query']['fields']));_0x75de9e[_0xd516('0x34')]=_0x75de9e[_0xd516('0x34')][_0xd516('0x46')]?_0x75de9e[_0xd516('0x34')]:_0x277289[_0xd516('0x2e')];_0x75de9e[_0xd516('0x38')]=qs[_0xd516('0x39')](_0x4fea9b['query'][_0xd516('0x39')]);_0x75de9e[_0xd516('0x3a')]=qs['filters'](_[_0xd516('0x3b')](_0x4fea9b[_0xd516('0x30')],_0x277289[_0xd516('0x32')]));if(_0x4fea9b[_0xd516('0x30')]['filter']){_0x75de9e[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x75de9e[_0xd516('0x3a')],{'$or':_[_0xd516('0x2f')](_0x75de9e[_0xd516('0x34')],function(_0x1ac66d){var _0x3331ef={};_0x3331ef[_0x1ac66d]={'$like':'%'+_0x4fea9b[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0x3331ef;})});}_0x75de9e=_[_0xd516('0x3d')]({},_0x75de9e,_0x4fea9b['options']);return _0xa4d08a[_0xd516('0x4b')](_0x75de9e);}})[_0xd516('0x25')](function(_0x5e8e88){if(_0x5e8e88){_0x1f7dee=_0x5e8e88['length'];if(!_0x4fea9b['query'][_0xd516('0x4e')](_0xd516('0x36'))){_0x75de9e[_0xd516('0x1f')]=qs[_0xd516('0x1f')](_0x4fea9b[_0xd516('0x30')][_0xd516('0x1f')]);_0x75de9e['offset']=qs[_0xd516('0x37')](_0x4fea9b[_0xd516('0x30')][_0xd516('0x37')]);}return _0xa4d08a[_0xd516('0x4b')](_0x75de9e);}})[_0xd516('0x25')](function(_0xec40ef){if(_0xec40ef){return _0xec40ef?{'count':_0x1f7dee,'rows':_0xec40ef}:null;}})[_0xd516('0x25')](respondWithResult(_0x1b4360,null))['catch'](handleError(_0x1b4360,null));};exports[_0xd516('0x4f')]=function(_0x5583b6,_0x14fe90,_0x140aa5){var _0x7d743e={};var _0x1c8a6f={};var _0x10b3bd;var _0x12b358;return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0x5583b6[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x14fe90,null))[_0xd516('0x25')](function(_0x2b9e1a){if(_0x2b9e1a){_0x10b3bd=_0x2b9e1a;_0x1c8a6f[_0xd516('0x2e')]=_[_0xd516('0x31')](db[_0xd516('0x4d')][_0xd516('0x2b')]);_0x1c8a6f['query']=_[_0xd516('0x31')](_0x5583b6[_0xd516('0x30')]);_0x1c8a6f[_0xd516('0x32')]=_[_0xd516('0x33')](_0x1c8a6f[_0xd516('0x2e')],_0x1c8a6f[_0xd516('0x30')]);_0x7d743e[_0xd516('0x34')]=_['intersection'](_0x1c8a6f[_0xd516('0x2e')],qs[_0xd516('0x35')](_0x5583b6[_0xd516('0x30')][_0xd516('0x35')]));_0x7d743e[_0xd516('0x34')]=_0x7d743e[_0xd516('0x34')][_0xd516('0x46')]?_0x7d743e[_0xd516('0x34')]:_0x1c8a6f[_0xd516('0x2e')];_0x7d743e[_0xd516('0x38')]=qs['sort'](_0x5583b6['query']['sort']);_0x7d743e[_0xd516('0x3a')]=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0x5583b6[_0xd516('0x30')],_0x1c8a6f[_0xd516('0x32')]));if(_0x5583b6[_0xd516('0x30')][_0xd516('0x3c')]){_0x7d743e[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x7d743e['where'],{'$or':_[_0xd516('0x2f')](_0x7d743e['attributes'],function(_0x158dc2){var _0x4a6d40={};_0x4a6d40[_0x158dc2]={'$like':'%'+_0x5583b6[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0x4a6d40;})});}_0x7d743e=_[_0xd516('0x3d')]({},_0x7d743e,_0x5583b6[_0xd516('0x3f')]);return _0x10b3bd[_0xd516('0x4f')](_0x7d743e);}})[_0xd516('0x25')](function(_0x46d9a0){if(_0x46d9a0){_0x12b358=_0x46d9a0[_0xd516('0x46')];if(!_0x5583b6[_0xd516('0x30')][_0xd516('0x4e')]('nolimit')){_0x7d743e[_0xd516('0x1f')]=qs['limit'](_0x5583b6[_0xd516('0x30')][_0xd516('0x1f')]);_0x7d743e['offset']=qs[_0xd516('0x37')](_0x5583b6[_0xd516('0x30')][_0xd516('0x37')]);}return _0x10b3bd[_0xd516('0x4f')](_0x7d743e);}})['then'](function(_0x393a79){if(_0x393a79){return _0x393a79?{'count':_0x12b358,'rows':_0x393a79}:null;}})['then'](respondWithResult(_0x14fe90,null))[_0xd516('0x44')](handleError(_0x14fe90,null));};exports['getDescriptions']=function(_0xf0a691,_0x4778aa,_0x366af3){var _0x44cec6={};var _0x5224aa={};var _0x5af6b6;var _0x4996b8;return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0xf0a691[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x4778aa,null))[_0xd516('0x25')](function(_0x2b87bc){if(_0x2b87bc){_0x5af6b6=_0x2b87bc;_0x5224aa[_0xd516('0x2e')]=_[_0xd516('0x31')](db[_0xd516('0x4d')]['rawAttributes']);_0x5224aa['query']=_[_0xd516('0x31')](_0xf0a691['query']);_0x5224aa['filters']=_[_0xd516('0x33')](_0x5224aa[_0xd516('0x2e')],_0x5224aa['query']);_0x44cec6[_0xd516('0x34')]=_['intersection'](_0x5224aa[_0xd516('0x2e')],qs[_0xd516('0x35')](_0xf0a691[_0xd516('0x30')][_0xd516('0x35')]));_0x44cec6['attributes']=_0x44cec6[_0xd516('0x34')][_0xd516('0x46')]?_0x44cec6[_0xd516('0x34')]:_0x5224aa['model'];_0x44cec6[_0xd516('0x38')]=qs[_0xd516('0x39')](_0xf0a691[_0xd516('0x30')][_0xd516('0x39')]);_0x44cec6[_0xd516('0x3a')]=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0xf0a691[_0xd516('0x30')],_0x5224aa[_0xd516('0x32')]));if(_0xf0a691['query'][_0xd516('0x3c')]){_0x44cec6['where']=_[_0xd516('0x3d')](_0x44cec6[_0xd516('0x3a')],{'$or':_['map'](_0x44cec6[_0xd516('0x34')],function(_0x37a713){var _0x24d7c7={};_0x24d7c7[_0x37a713]={'$like':'%'+_0xf0a691[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0x24d7c7;})});}_0x44cec6=_[_0xd516('0x3d')]({},_0x44cec6,_0xf0a691['options']);return _0x5af6b6['getDescriptions'](_0x44cec6);}})['then'](function(_0x3f7744){if(_0x3f7744){_0x4996b8=_0x3f7744[_0xd516('0x46')];if(!_0xf0a691[_0xd516('0x30')][_0xd516('0x4e')](_0xd516('0x36'))){_0x44cec6[_0xd516('0x1f')]=qs[_0xd516('0x1f')](_0xf0a691[_0xd516('0x30')][_0xd516('0x1f')]);_0x44cec6[_0xd516('0x37')]=qs[_0xd516('0x37')](_0xf0a691['query'][_0xd516('0x37')]);}return _0x5af6b6['getDescriptions'](_0x44cec6);}})['then'](function(_0x3c92c8){if(_0x3c92c8){return _0x3c92c8?{'count':_0x4996b8,'rows':_0x3c92c8}:null;}})[_0xd516('0x25')](respondWithResult(_0x4778aa,null))['catch'](handleError(_0x4778aa,null));};exports[_0xd516('0x50')]=function(_0x1f5e0e,_0x400d63,_0x5ae530){var _0x2c574a={};var _0x4e31ec={};var _0xb1237f;var _0xf66cc4;return db['DeskConfiguration'][_0xd516('0x4c')]({'where':{'id':_0x1f5e0e[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x400d63,null))[_0xd516('0x25')](function(_0x197653){if(_0x197653){_0xb1237f=_0x197653;_0x4e31ec[_0xd516('0x2e')]=_['keys'](db[_0xd516('0x51')][_0xd516('0x2b')]);_0x4e31ec[_0xd516('0x30')]=_['keys'](_0x1f5e0e['query']);_0x4e31ec[_0xd516('0x32')]=_[_0xd516('0x33')](_0x4e31ec[_0xd516('0x2e')],_0x4e31ec[_0xd516('0x30')]);_0x2c574a['attributes']=_[_0xd516('0x33')](_0x4e31ec[_0xd516('0x2e')],qs['fields'](_0x1f5e0e[_0xd516('0x30')][_0xd516('0x35')]));_0x2c574a['attributes']=_0x2c574a[_0xd516('0x34')][_0xd516('0x46')]?_0x2c574a['attributes']:_0x4e31ec['model'];_0x2c574a[_0xd516('0x38')]=qs[_0xd516('0x39')](_0x1f5e0e['query'][_0xd516('0x39')]);_0x2c574a['where']=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0x1f5e0e['query'],_0x4e31ec[_0xd516('0x32')]));if(_0x1f5e0e['query'][_0xd516('0x3c')]){_0x2c574a[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x2c574a[_0xd516('0x3a')],{'$or':_[_0xd516('0x2f')](_0x2c574a['attributes'],function(_0x10b83a){var _0x40294c={};_0x40294c[_0x10b83a]={'$like':'%'+_0x1f5e0e['query'][_0xd516('0x3c')]+'%'};return _0x40294c;})});}_0x2c574a=_[_0xd516('0x3d')]({},_0x2c574a,_0x1f5e0e[_0xd516('0x3f')]);return _0xb1237f[_0xd516('0x50')](_0x2c574a);}})['then'](function(_0x387013){if(_0x387013){_0xf66cc4=_0x387013[_0xd516('0x46')];if(!_0x1f5e0e[_0xd516('0x30')][_0xd516('0x4e')](_0xd516('0x36'))){_0x2c574a[_0xd516('0x1f')]=qs[_0xd516('0x1f')](_0x1f5e0e[_0xd516('0x30')][_0xd516('0x1f')]);_0x2c574a[_0xd516('0x37')]=qs[_0xd516('0x37')](_0x1f5e0e[_0xd516('0x30')]['offset']);}return _0xb1237f[_0xd516('0x50')](_0x2c574a);}})[_0xd516('0x25')](function(_0x331083){if(_0x331083){return _0x331083?{'count':_0xf66cc4,'rows':_0x331083}:null;}})[_0xd516('0x25')](respondWithResult(_0x400d63,null))['catch'](handleError(_0x400d63,null));};exports[_0xd516('0x52')]=function(_0x5386ad,_0x1e221e,_0x367d52){if(_0x5386ad[_0xd516('0x49')]['id']){delete _0x5386ad[_0xd516('0x49')]['id'];}return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0x5386ad[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x1e221e,null))[_0xd516('0x25')](function(_0x2a603a){if(_0x2a603a){return _0x2a603a[_0xd516('0x52')](_0x5386ad[_0xd516('0x49')][_0xd516('0x53')]||[]);}return null;})[_0xd516('0x25')](respondWithResult(_0x1e221e,null))[_0xd516('0x44')](handleError(_0x1e221e,null));}; \ No newline at end of file +var _0xd1c9=['order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','find','catch','create','DeskConfiguration','body','getFields','findOne','DeskField','rawAttributes'];(function(_0x3ab8a6,_0x12b671){var _0x2c3c50=function(_0xd77347){while(--_0xd77347){_0x3ab8a6['push'](_0x3ab8a6['shift']());}};_0x2c3c50(++_0x12b671);}(_0xd1c9,0x104));var _0x9d1c=function(_0x4a5d53,_0x49c54c){_0x4a5d53=_0x4a5d53-0x0;var _0x528677=_0xd1c9[_0x4a5d53];return _0x528677;};'use strict';var emlformat=require(_0x9d1c('0x0'));var rimraf=require(_0x9d1c('0x1'));var zipdir=require(_0x9d1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d1c('0x3'));var moment=require(_0x9d1c('0x4'));var BPromise=require(_0x9d1c('0x5'));var Mustache=require('mustache');var util=require(_0x9d1c('0x6'));var path=require('path');var sox=require(_0x9d1c('0x7'));var csv=require('to-csv');var ejs=require(_0x9d1c('0x8'));var fs=require('fs');var fs_extra=require(_0x9d1c('0x9'));var _=require(_0x9d1c('0xa'));var squel=require('squel');var crypto=require(_0x9d1c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9d1c('0xc'));var querystring=require(_0x9d1c('0xd'));var Papa=require('papaparse');var Redis=require(_0x9d1c('0xe'));var authService=require(_0x9d1c('0xf'));var qs=require(_0x9d1c('0x10'));var as=require(_0x9d1c('0x11'));var hardwareService=require(_0x9d1c('0x12'));var logger=require(_0x9d1c('0x13'))(_0x9d1c('0x14'));var utils=require(_0x9d1c('0x15'));var config=require(_0x9d1c('0x16'));var licenseUtil=require(_0x9d1c('0x17'));var db=require(_0x9d1c('0x18'))['db'];function respondWithStatusCode(_0x15ce57,_0x37f0fb){_0x37f0fb=_0x37f0fb||0xcc;return function(_0x260666){if(_0x260666){return _0x15ce57['sendStatus'](_0x37f0fb);}return _0x15ce57[_0x9d1c('0x19')](_0x37f0fb)[_0x9d1c('0x1a')]();};}function respondWithResult(_0x28de89,_0x5c45ac){_0x5c45ac=_0x5c45ac||0xc8;return function(_0x119862){if(_0x119862){return _0x28de89['status'](_0x5c45ac)[_0x9d1c('0x1b')](_0x119862);}};}function respondWithFilteredResult(_0x5f2e5e,_0x5d8b5a){return function(_0x45f185){if(_0x45f185){var _0x4e3016=typeof _0x5d8b5a[_0x9d1c('0x1c')]==='undefined'&&typeof _0x5d8b5a[_0x9d1c('0x1d')]===_0x9d1c('0x1e');var _0x349012=_0x45f185['count'];var _0x4cbfc0=_0x4e3016?0x0:_0x5d8b5a[_0x9d1c('0x1c')];var _0x1a8407=_0x4e3016?_0x45f185[_0x9d1c('0x1f')]:_0x5d8b5a[_0x9d1c('0x1c')]+_0x5d8b5a[_0x9d1c('0x1d')];var _0x4045db;if(_0x1a8407>=_0x349012){_0x1a8407=_0x349012;_0x4045db=0xc8;}else{_0x4045db=0xce;}_0x5f2e5e[_0x9d1c('0x19')](_0x4045db);return _0x5f2e5e[_0x9d1c('0x20')]('Content-Range',_0x4cbfc0+'-'+_0x1a8407+'/'+_0x349012)[_0x9d1c('0x1b')](_0x45f185);}return null;};}function patchUpdates(_0x484db2){return function(_0x525714){try{jsonpatch[_0x9d1c('0x21')](_0x525714,_0x484db2,!![]);}catch(_0x2d1bb2){return BPromise[_0x9d1c('0x22')](_0x2d1bb2);}return _0x525714[_0x9d1c('0x23')]();};}function saveUpdates(_0x10d4b3,_0x4117e){return function(_0x4ed9f4){if(_0x4ed9f4){return _0x4ed9f4[_0x9d1c('0x24')](_0x10d4b3)[_0x9d1c('0x25')](function(_0x58626e){return _0x58626e;});}return null;};}function removeEntity(_0x4987c8,_0x400c84){return function(_0x352cf9){if(_0x352cf9){return _0x352cf9[_0x9d1c('0x26')]()[_0x9d1c('0x25')](function(){_0x4987c8[_0x9d1c('0x19')](0xcc)[_0x9d1c('0x1a')]();});}};}function handleEntityNotFound(_0x417a09,_0x5e6595){return function(_0x30e583){if(!_0x30e583){_0x417a09['sendStatus'](0x194);}return _0x30e583;};}function handleError(_0x168cd2,_0x25f771){_0x25f771=_0x25f771||0x1f4;return function(_0x215fc6){logger[_0x9d1c('0x27')](_0x215fc6[_0x9d1c('0x28')]);if(_0x215fc6['name']){delete _0x215fc6[_0x9d1c('0x29')];}_0x168cd2[_0x9d1c('0x19')](_0x25f771)['send'](_0x215fc6);};}exports[_0x9d1c('0x2a')]=function(_0xee41bc,_0x19a936){var _0x29bd4c={},_0x38bcad={},_0x57950c={'count':0x0,'rows':[]};var _0x37ce4a=_[_0x9d1c('0x2b')](db['DeskConfiguration']['rawAttributes'],function(_0x188f00){return{'name':_0x188f00[_0x9d1c('0x2c')],'type':_0x188f00[_0x9d1c('0x2d')]['key']};});_0x38bcad[_0x9d1c('0x2e')]=_['map'](_0x37ce4a,_0x9d1c('0x29'));_0x38bcad[_0x9d1c('0x2f')]=_[_0x9d1c('0x30')](_0xee41bc[_0x9d1c('0x2f')]);_0x38bcad['filters']=_['intersection'](_0x38bcad[_0x9d1c('0x2e')],_0x38bcad['query']);_0x29bd4c[_0x9d1c('0x31')]=_['intersection'](_0x38bcad[_0x9d1c('0x2e')],qs[_0x9d1c('0x32')](_0xee41bc[_0x9d1c('0x2f')][_0x9d1c('0x32')]));_0x29bd4c[_0x9d1c('0x31')]=_0x29bd4c[_0x9d1c('0x31')][_0x9d1c('0x33')]?_0x29bd4c['attributes']:_0x38bcad[_0x9d1c('0x2e')];if(!_0xee41bc[_0x9d1c('0x2f')][_0x9d1c('0x34')]('nolimit')){_0x29bd4c['limit']=qs[_0x9d1c('0x1d')](_0xee41bc[_0x9d1c('0x2f')]['limit']);_0x29bd4c['offset']=qs[_0x9d1c('0x1c')](_0xee41bc['query']['offset']);}_0x29bd4c['order']=qs[_0x9d1c('0x35')](_0xee41bc['query'][_0x9d1c('0x35')]);_0x29bd4c[_0x9d1c('0x36')]=qs[_0x9d1c('0x37')](_[_0x9d1c('0x38')](_0xee41bc[_0x9d1c('0x2f')],_0x38bcad[_0x9d1c('0x37')]),_0x37ce4a);if(_0xee41bc['query'][_0x9d1c('0x39')]){_0x29bd4c['where']=_[_0x9d1c('0x3a')](_0x29bd4c[_0x9d1c('0x36')],{'$or':_[_0x9d1c('0x2b')](_0x37ce4a,function(_0x266d4e){if(_0x266d4e[_0x9d1c('0x2d')]!==_0x9d1c('0x3b')){var _0x275233={};_0x275233[_0x266d4e[_0x9d1c('0x29')]]={'$like':'%'+_0xee41bc[_0x9d1c('0x2f')][_0x9d1c('0x39')]+'%'};return _0x275233;}})});}_0x29bd4c=_[_0x9d1c('0x3a')]({},_0x29bd4c,_0xee41bc[_0x9d1c('0x3c')]);var _0x51c628={'where':_0x29bd4c[_0x9d1c('0x36')]};return db['DeskConfiguration']['count'](_0x51c628)[_0x9d1c('0x25')](function(_0x151a3d){_0x57950c[_0x9d1c('0x1f')]=_0x151a3d;if(_0xee41bc[_0x9d1c('0x2f')][_0x9d1c('0x3d')]){_0x29bd4c['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x9d1c('0x3e')](_0x29bd4c);})[_0x9d1c('0x25')](function(_0x5ca741){_0x57950c[_0x9d1c('0x3f')]=_0x5ca741;return _0x57950c;})[_0x9d1c('0x25')](respondWithFilteredResult(_0x19a936,_0x29bd4c))['catch'](handleError(_0x19a936,null));};exports[_0x9d1c('0x40')]=function(_0x58155e,_0x552547){var _0x718121={'raw':![],'where':{'id':_0x58155e[_0x9d1c('0x41')]['id']}},_0x31dd33={};_0x31dd33['model']=_[_0x9d1c('0x30')](db['DeskConfiguration']['rawAttributes']);_0x31dd33['query']=_['keys'](_0x58155e[_0x9d1c('0x2f')]);_0x31dd33['filters']=_['intersection'](_0x31dd33['model'],_0x31dd33[_0x9d1c('0x2f')]);_0x718121[_0x9d1c('0x31')]=_[_0x9d1c('0x42')](_0x31dd33['model'],qs[_0x9d1c('0x32')](_0x58155e[_0x9d1c('0x2f')][_0x9d1c('0x32')]));_0x718121['attributes']=_0x718121['attributes'][_0x9d1c('0x33')]?_0x718121[_0x9d1c('0x31')]:_0x31dd33['model'];if(_0x58155e[_0x9d1c('0x2f')]['includeAll']){_0x718121['include']=[{'all':!![]}];}_0x718121=_[_0x9d1c('0x3a')]({},_0x718121,_0x58155e[_0x9d1c('0x3c')]);return db['DeskConfiguration'][_0x9d1c('0x43')](_0x718121)['then'](handleEntityNotFound(_0x552547,null))['then'](respondWithResult(_0x552547,null))[_0x9d1c('0x44')](handleError(_0x552547,null));};exports[_0x9d1c('0x45')]=function(_0x55ac65,_0x4c0d43){return db[_0x9d1c('0x46')][_0x9d1c('0x45')](_0x55ac65[_0x9d1c('0x47')],{})[_0x9d1c('0x25')](respondWithResult(_0x4c0d43,0xc9))[_0x9d1c('0x44')](handleError(_0x4c0d43,null));};exports[_0x9d1c('0x24')]=function(_0x43ac17,_0xed3832){if(_0x43ac17[_0x9d1c('0x47')]['id']){delete _0x43ac17[_0x9d1c('0x47')]['id'];}return db[_0x9d1c('0x46')][_0x9d1c('0x43')]({'where':{'id':_0x43ac17[_0x9d1c('0x41')]['id']}})['then'](handleEntityNotFound(_0xed3832,null))[_0x9d1c('0x25')](saveUpdates(_0x43ac17[_0x9d1c('0x47')],null))[_0x9d1c('0x25')](respondWithResult(_0xed3832,null))[_0x9d1c('0x44')](handleError(_0xed3832,null));};exports['destroy']=function(_0x2bf581,_0x368b21){return db[_0x9d1c('0x46')]['find']({'where':{'id':_0x2bf581['params']['id']}})[_0x9d1c('0x25')](handleEntityNotFound(_0x368b21,null))[_0x9d1c('0x25')](removeEntity(_0x368b21,null))[_0x9d1c('0x44')](handleError(_0x368b21,null));};exports[_0x9d1c('0x48')]=function(_0xb42b9a,_0x37cb67,_0x172818){var _0xb18bd2={};var _0xc47cec={};var _0x47a100;var _0x74e66b;return db['DeskConfiguration'][_0x9d1c('0x49')]({'where':{'id':_0xb42b9a[_0x9d1c('0x41')]['id']}})[_0x9d1c('0x25')](handleEntityNotFound(_0x37cb67,null))['then'](function(_0x7d5c26){if(_0x7d5c26){_0x47a100=_0x7d5c26;_0xc47cec[_0x9d1c('0x2e')]=_[_0x9d1c('0x30')](db[_0x9d1c('0x4a')][_0x9d1c('0x4b')]);_0xc47cec[_0x9d1c('0x2f')]=_[_0x9d1c('0x30')](_0xb42b9a[_0x9d1c('0x2f')]);_0xc47cec[_0x9d1c('0x37')]=_['intersection'](_0xc47cec[_0x9d1c('0x2e')],_0xc47cec[_0x9d1c('0x2f')]);_0xb18bd2[_0x9d1c('0x31')]=_[_0x9d1c('0x42')](_0xc47cec['model'],qs[_0x9d1c('0x32')](_0xb42b9a[_0x9d1c('0x2f')][_0x9d1c('0x32')]));_0xb18bd2[_0x9d1c('0x31')]=_0xb18bd2[_0x9d1c('0x31')]['length']?_0xb18bd2[_0x9d1c('0x31')]:_0xc47cec[_0x9d1c('0x2e')];_0xb18bd2[_0x9d1c('0x4c')]=qs['sort'](_0xb42b9a['query']['sort']);_0xb18bd2[_0x9d1c('0x36')]=qs['filters'](_[_0x9d1c('0x38')](_0xb42b9a[_0x9d1c('0x2f')],_0xc47cec['filters']));if(_0xb42b9a[_0x9d1c('0x2f')][_0x9d1c('0x39')]){_0xb18bd2[_0x9d1c('0x36')]=_[_0x9d1c('0x3a')](_0xb18bd2[_0x9d1c('0x36')],{'$or':_['map'](_0xb18bd2['attributes'],function(_0x2c9b2e){var _0x586474={};_0x586474[_0x2c9b2e]={'$like':'%'+_0xb42b9a[_0x9d1c('0x2f')][_0x9d1c('0x39')]+'%'};return _0x586474;})});}_0xb18bd2=_[_0x9d1c('0x3a')]({},_0xb18bd2,_0xb42b9a[_0x9d1c('0x3c')]);return _0x47a100[_0x9d1c('0x48')](_0xb18bd2);}})[_0x9d1c('0x25')](function(_0x28ce74){if(_0x28ce74){_0x74e66b=_0x28ce74[_0x9d1c('0x33')];if(!_0xb42b9a[_0x9d1c('0x2f')]['hasOwnProperty'](_0x9d1c('0x4d'))){_0xb18bd2['limit']=qs[_0x9d1c('0x1d')](_0xb42b9a[_0x9d1c('0x2f')][_0x9d1c('0x1d')]);_0xb18bd2[_0x9d1c('0x1c')]=qs['offset'](_0xb42b9a[_0x9d1c('0x2f')][_0x9d1c('0x1c')]);}return _0x47a100[_0x9d1c('0x48')](_0xb18bd2);}})[_0x9d1c('0x25')](function(_0x53ed15){if(_0x53ed15){return _0x53ed15?{'count':_0x74e66b,'rows':_0x53ed15}:null;}})[_0x9d1c('0x25')](respondWithResult(_0x37cb67,null))[_0x9d1c('0x44')](handleError(_0x37cb67,null));};exports[_0x9d1c('0x4e')]=function(_0x15ba31,_0x3c8b61,_0x4b7e46){var _0x525a23={};var _0x2cafcf={};var _0x5ac1fa;var _0x3b457a;return db[_0x9d1c('0x46')]['findOne']({'where':{'id':_0x15ba31['params']['id']}})[_0x9d1c('0x25')](handleEntityNotFound(_0x3c8b61,null))[_0x9d1c('0x25')](function(_0x58ab58){if(_0x58ab58){_0x5ac1fa=_0x58ab58;_0x2cafcf['model']=_[_0x9d1c('0x30')](db[_0x9d1c('0x4a')][_0x9d1c('0x4b')]);_0x2cafcf[_0x9d1c('0x2f')]=_[_0x9d1c('0x30')](_0x15ba31[_0x9d1c('0x2f')]);_0x2cafcf[_0x9d1c('0x37')]=_['intersection'](_0x2cafcf[_0x9d1c('0x2e')],_0x2cafcf[_0x9d1c('0x2f')]);_0x525a23[_0x9d1c('0x31')]=_['intersection'](_0x2cafcf[_0x9d1c('0x2e')],qs[_0x9d1c('0x32')](_0x15ba31[_0x9d1c('0x2f')][_0x9d1c('0x32')]));_0x525a23[_0x9d1c('0x31')]=_0x525a23[_0x9d1c('0x31')][_0x9d1c('0x33')]?_0x525a23[_0x9d1c('0x31')]:_0x2cafcf[_0x9d1c('0x2e')];_0x525a23[_0x9d1c('0x4c')]=qs['sort'](_0x15ba31['query'][_0x9d1c('0x35')]);_0x525a23[_0x9d1c('0x36')]=qs[_0x9d1c('0x37')](_[_0x9d1c('0x38')](_0x15ba31[_0x9d1c('0x2f')],_0x2cafcf[_0x9d1c('0x37')]));if(_0x15ba31[_0x9d1c('0x2f')][_0x9d1c('0x39')]){_0x525a23['where']=_['merge'](_0x525a23[_0x9d1c('0x36')],{'$or':_[_0x9d1c('0x2b')](_0x525a23[_0x9d1c('0x31')],function(_0x2d7707){var _0x31f3e9={};_0x31f3e9[_0x2d7707]={'$like':'%'+_0x15ba31[_0x9d1c('0x2f')][_0x9d1c('0x39')]+'%'};return _0x31f3e9;})});}_0x525a23=_[_0x9d1c('0x3a')]({},_0x525a23,_0x15ba31[_0x9d1c('0x3c')]);return _0x5ac1fa[_0x9d1c('0x4e')](_0x525a23);}})[_0x9d1c('0x25')](function(_0x49692d){if(_0x49692d){_0x3b457a=_0x49692d[_0x9d1c('0x33')];if(!_0x15ba31[_0x9d1c('0x2f')][_0x9d1c('0x34')]('nolimit')){_0x525a23[_0x9d1c('0x1d')]=qs['limit'](_0x15ba31[_0x9d1c('0x2f')][_0x9d1c('0x1d')]);_0x525a23['offset']=qs['offset'](_0x15ba31[_0x9d1c('0x2f')][_0x9d1c('0x1c')]);}return _0x5ac1fa[_0x9d1c('0x4e')](_0x525a23);}})['then'](function(_0x359541){if(_0x359541){return _0x359541?{'count':_0x3b457a,'rows':_0x359541}:null;}})['then'](respondWithResult(_0x3c8b61,null))[_0x9d1c('0x44')](handleError(_0x3c8b61,null));};exports[_0x9d1c('0x4f')]=function(_0xca69da,_0x1ead52,_0x1b34f9){var _0x3238af={};var _0x57b2ae={};var _0x5afd1f;var _0x4243fa;return db[_0x9d1c('0x46')][_0x9d1c('0x49')]({'where':{'id':_0xca69da[_0x9d1c('0x41')]['id']}})[_0x9d1c('0x25')](handleEntityNotFound(_0x1ead52,null))[_0x9d1c('0x25')](function(_0x3d5ba0){if(_0x3d5ba0){_0x5afd1f=_0x3d5ba0;_0x57b2ae['model']=_[_0x9d1c('0x30')](db[_0x9d1c('0x4a')][_0x9d1c('0x4b')]);_0x57b2ae[_0x9d1c('0x2f')]=_[_0x9d1c('0x30')](_0xca69da[_0x9d1c('0x2f')]);_0x57b2ae[_0x9d1c('0x37')]=_[_0x9d1c('0x42')](_0x57b2ae[_0x9d1c('0x2e')],_0x57b2ae[_0x9d1c('0x2f')]);_0x3238af[_0x9d1c('0x31')]=_['intersection'](_0x57b2ae[_0x9d1c('0x2e')],qs['fields'](_0xca69da['query'][_0x9d1c('0x32')]));_0x3238af[_0x9d1c('0x31')]=_0x3238af[_0x9d1c('0x31')][_0x9d1c('0x33')]?_0x3238af[_0x9d1c('0x31')]:_0x57b2ae[_0x9d1c('0x2e')];_0x3238af[_0x9d1c('0x4c')]=qs[_0x9d1c('0x35')](_0xca69da[_0x9d1c('0x2f')][_0x9d1c('0x35')]);_0x3238af[_0x9d1c('0x36')]=qs[_0x9d1c('0x37')](_[_0x9d1c('0x38')](_0xca69da[_0x9d1c('0x2f')],_0x57b2ae[_0x9d1c('0x37')]));if(_0xca69da[_0x9d1c('0x2f')][_0x9d1c('0x39')]){_0x3238af[_0x9d1c('0x36')]=_['merge'](_0x3238af[_0x9d1c('0x36')],{'$or':_[_0x9d1c('0x2b')](_0x3238af['attributes'],function(_0xf71fae){var _0x576bdc={};_0x576bdc[_0xf71fae]={'$like':'%'+_0xca69da[_0x9d1c('0x2f')][_0x9d1c('0x39')]+'%'};return _0x576bdc;})});}_0x3238af=_[_0x9d1c('0x3a')]({},_0x3238af,_0xca69da[_0x9d1c('0x3c')]);return _0x5afd1f[_0x9d1c('0x4f')](_0x3238af);}})['then'](function(_0x522d75){if(_0x522d75){_0x4243fa=_0x522d75[_0x9d1c('0x33')];if(!_0xca69da[_0x9d1c('0x2f')][_0x9d1c('0x34')](_0x9d1c('0x4d'))){_0x3238af[_0x9d1c('0x1d')]=qs['limit'](_0xca69da['query'][_0x9d1c('0x1d')]);_0x3238af[_0x9d1c('0x1c')]=qs[_0x9d1c('0x1c')](_0xca69da[_0x9d1c('0x2f')][_0x9d1c('0x1c')]);}return _0x5afd1f[_0x9d1c('0x4f')](_0x3238af);}})['then'](function(_0x11a7e7){if(_0x11a7e7){return _0x11a7e7?{'count':_0x4243fa,'rows':_0x11a7e7}:null;}})[_0x9d1c('0x25')](respondWithResult(_0x1ead52,null))[_0x9d1c('0x44')](handleError(_0x1ead52,null));};exports[_0x9d1c('0x50')]=function(_0x54800e,_0x136278,_0x5f2f97){var _0x12b280={};var _0x54dba9={};var _0x364b11;var _0x1c4f29;return db[_0x9d1c('0x46')]['findOne']({'where':{'id':_0x54800e[_0x9d1c('0x41')]['id']}})[_0x9d1c('0x25')](handleEntityNotFound(_0x136278,null))['then'](function(_0xfe6ca8){if(_0xfe6ca8){_0x364b11=_0xfe6ca8;_0x54dba9[_0x9d1c('0x2e')]=_[_0x9d1c('0x30')](db[_0x9d1c('0x51')]['rawAttributes']);_0x54dba9[_0x9d1c('0x2f')]=_[_0x9d1c('0x30')](_0x54800e['query']);_0x54dba9[_0x9d1c('0x37')]=_[_0x9d1c('0x42')](_0x54dba9[_0x9d1c('0x2e')],_0x54dba9['query']);_0x12b280[_0x9d1c('0x31')]=_['intersection'](_0x54dba9['model'],qs['fields'](_0x54800e['query'][_0x9d1c('0x32')]));_0x12b280[_0x9d1c('0x31')]=_0x12b280[_0x9d1c('0x31')]['length']?_0x12b280[_0x9d1c('0x31')]:_0x54dba9[_0x9d1c('0x2e')];_0x12b280[_0x9d1c('0x4c')]=qs[_0x9d1c('0x35')](_0x54800e[_0x9d1c('0x2f')][_0x9d1c('0x35')]);_0x12b280[_0x9d1c('0x36')]=qs[_0x9d1c('0x37')](_[_0x9d1c('0x38')](_0x54800e['query'],_0x54dba9[_0x9d1c('0x37')]));if(_0x54800e[_0x9d1c('0x2f')][_0x9d1c('0x39')]){_0x12b280[_0x9d1c('0x36')]=_[_0x9d1c('0x3a')](_0x12b280[_0x9d1c('0x36')],{'$or':_[_0x9d1c('0x2b')](_0x12b280[_0x9d1c('0x31')],function(_0xcff8ec){var _0x5defc4={};_0x5defc4[_0xcff8ec]={'$like':'%'+_0x54800e[_0x9d1c('0x2f')][_0x9d1c('0x39')]+'%'};return _0x5defc4;})});}_0x12b280=_['merge']({},_0x12b280,_0x54800e['options']);return _0x364b11[_0x9d1c('0x50')](_0x12b280);}})[_0x9d1c('0x25')](function(_0x1775fa){if(_0x1775fa){_0x1c4f29=_0x1775fa[_0x9d1c('0x33')];if(!_0x54800e[_0x9d1c('0x2f')][_0x9d1c('0x34')]('nolimit')){_0x12b280[_0x9d1c('0x1d')]=qs[_0x9d1c('0x1d')](_0x54800e[_0x9d1c('0x2f')]['limit']);_0x12b280['offset']=qs[_0x9d1c('0x1c')](_0x54800e[_0x9d1c('0x2f')]['offset']);}return _0x364b11[_0x9d1c('0x50')](_0x12b280);}})[_0x9d1c('0x25')](function(_0x155cc9){if(_0x155cc9){return _0x155cc9?{'count':_0x1c4f29,'rows':_0x155cc9}:null;}})[_0x9d1c('0x25')](respondWithResult(_0x136278,null))[_0x9d1c('0x44')](handleError(_0x136278,null));};exports[_0x9d1c('0x52')]=function(_0x4b6279,_0x45e3f0,_0x1ca246){if(_0x4b6279[_0x9d1c('0x47')]['id']){delete _0x4b6279[_0x9d1c('0x47')]['id'];}return db['DeskConfiguration'][_0x9d1c('0x49')]({'where':{'id':_0x4b6279[_0x9d1c('0x41')]['id']}})[_0x9d1c('0x25')](handleEntityNotFound(_0x45e3f0,null))[_0x9d1c('0x25')](function(_0x20334e){if(_0x20334e){return _0x20334e[_0x9d1c('0x52')](_0x4b6279['body'][_0x9d1c('0x53')]||[]);}return null;})[_0x9d1c('0x25')](respondWithResult(_0x45e3f0,null))[_0x9d1c('0x44')](handleError(_0x45e3f0,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 6fd6032..7e78191 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 _0x5127=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash'];(function(_0x15a6c4,_0x3d40ea){var _0x37f251=function(_0x258b93){while(--_0x258b93){_0x15a6c4['push'](_0x15a6c4['shift']());}};_0x37f251(++_0x3d40ea);}(_0x5127,0x18f));var _0x7512=function(_0x3de0d9,_0x2ccb8f){_0x3de0d9=_0x3de0d9-0x0;var _0x161cd9=_0x5127[_0x3de0d9];return _0x161cd9;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7512('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7512('0x5'));var config=require(_0x7512('0x6'));var attributes=require(_0x7512('0x7'));module[_0x7512('0x8')]=function(_0x35a3e5,_0x1a7239){return _0x35a3e5['define']('DeskConfiguration',attributes,{'tableName':_0x7512('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa62c=['bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x3f05e4,_0x4c347c){var _0x8f20fb=function(_0x3f65fd){while(--_0x3f65fd){_0x3f05e4['push'](_0x3f05e4['shift']());}};_0x8f20fb(++_0x4c347c);}(_0xa62c,0x70));var _0xca62=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa62c[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var logger=require(_0xca62('0x2'))(_0xca62('0x3'));var moment=require(_0xca62('0x4'));var BPromise=require(_0xca62('0x5'));var rp=require(_0xca62('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca62('0x7'));var config=require(_0xca62('0x8'));var attributes=require(_0xca62('0x9'));module[_0xca62('0xa')]=function(_0x1e51ba,_0x31d267){return _0x1e51ba[_0xca62('0xb')](_0xca62('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index d407241..aa96ef4 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 _0xcd2f=['stringify','error','message','DeskConfiguration,\x20%s,\x20%s','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x124578,_0x21ad88){var _0x230bc0=function(_0x507f16){while(--_0x507f16){_0x124578['push'](_0x124578['shift']());}};_0x230bc0(++_0x21ad88);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xcd2f[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd2('0x0'));var rs=require(_0xfcd2('0x1'));var fs=require('fs');var Redis=require(_0xfcd2('0x2'));var db=require(_0xfcd2('0x3'))['db'];var utils=require(_0xfcd2('0x4'));var logger=require(_0xfcd2('0x5'))(_0xfcd2('0x6'));var config=require(_0xfcd2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcd2('0x8')][_0xfcd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41e836,_0x20ac59,_0x467e4f){return new BPromise(function(_0x13d9fa,_0xae2219){return client[_0xfcd2('0xa')](_0x41e836,_0x467e4f)[_0xfcd2('0xb')](function(_0x358fb4){logger[_0xfcd2('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x20ac59,_0xfcd2('0xd'));logger[_0xfcd2('0xe')](_0xfcd2('0xf'),_0x20ac59,_0xfcd2('0xd'),JSON[_0xfcd2('0x10')](_0x358fb4));if(_0x358fb4['error']){if(_0x358fb4['error']['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x20ac59,_0x358fb4[_0xfcd2('0x11')][_0xfcd2('0x12')]);return _0xae2219(_0x358fb4['error'][_0xfcd2('0x12')]);}logger[_0xfcd2('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x20ac59,_0x358fb4['error'][_0xfcd2('0x12')]);return _0x13d9fa(_0x358fb4[_0xfcd2('0x11')][_0xfcd2('0x12')]);}else{logger[_0xfcd2('0xc')](_0xfcd2('0x13'),_0x20ac59,'request\x20sent');_0x13d9fa(_0x358fb4[_0xfcd2('0x14')][_0xfcd2('0x12')]);}})[_0xfcd2('0x15')](function(_0x34aa38){logger[_0xfcd2('0x11')](_0xfcd2('0x13'),_0x20ac59,_0x34aa38);_0xae2219(_0x34aa38);});});} \ No newline at end of file +var _0x3025=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x3025,0x1c7));var _0x5302=function(_0x50b063,_0x2bde06){_0x50b063=_0x50b063-0x0;var _0x135747=_0x3025[_0x50b063];return _0x135747;};'use strict';var _=require(_0x5302('0x0'));var util=require(_0x5302('0x1'));var moment=require(_0x5302('0x2'));var BPromise=require(_0x5302('0x3'));var rs=require(_0x5302('0x4'));var fs=require('fs');var Redis=require(_0x5302('0x5'));var db=require(_0x5302('0x6'))['db'];var utils=require(_0x5302('0x7'));var logger=require(_0x5302('0x8'))('rpc');var config=require(_0x5302('0x9'));var jayson=require(_0x5302('0xa'));var client=jayson['client'][_0x5302('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d93ea,_0x41c3d6,_0x2e9c66){return new BPromise(function(_0x54884e,_0x40505e){return client[_0x5302('0xc')](_0x4d93ea,_0x2e9c66)['then'](function(_0xf1b697){logger[_0x5302('0xd')](_0x5302('0xe'),_0x41c3d6,_0x5302('0xf'));logger['debug'](_0x5302('0x10'),_0x41c3d6,_0x5302('0xf'),JSON[_0x5302('0x11')](_0xf1b697));if(_0xf1b697[_0x5302('0x12')]){if(_0xf1b697['error'][_0x5302('0x13')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x41c3d6,_0xf1b697[_0x5302('0x12')][_0x5302('0x14')]);return _0x40505e(_0xf1b697[_0x5302('0x12')][_0x5302('0x14')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x41c3d6,_0xf1b697['error'][_0x5302('0x14')]);return _0x54884e(_0xf1b697[_0x5302('0x12')]['message']);}else{logger[_0x5302('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x41c3d6,'request\x20sent');_0x54884e(_0xf1b697[_0x5302('0x15')]['message']);}})[_0x5302('0x16')](function(_0x47b4a2){logger[_0x5302('0x12')](_0x5302('0xe'),_0x41c3d6,_0x47b4a2);_0x40505e(_0x47b4a2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index d5ee4e7..d971051 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 _0x1612=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer'];(function(_0x310736,_0x3eeed5){var _0x157784=function(_0x35b6b5){while(--_0x35b6b5){_0x310736['push'](_0x310736['shift']());}};_0x157784(++_0x3eeed5);}(_0x1612,0xcf));var _0x2161=function(_0x4d560a,_0x48d9dd){_0x4d560a=_0x4d560a-0x0;var _0x368b51=_0x1612[_0x4d560a];return _0x368b51;};'use strict';var multer=require(_0x2161('0x0'));var util=require(_0x2161('0x1'));var path=require(_0x2161('0x2'));var timeout=require(_0x2161('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2161('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2161('0x5'));var config=require(_0x2161('0x6'));var controller=require('./intDeskField.controller');router[_0x2161('0x7')]('/',auth[_0x2161('0x8')](),controller[_0x2161('0x9')]);router[_0x2161('0x7')](_0x2161('0xa'),auth[_0x2161('0x8')](),controller[_0x2161('0xb')]);router[_0x2161('0xc')]('/',auth[_0x2161('0x8')](),controller[_0x2161('0xd')]);router['put'](_0x2161('0xa'),auth[_0x2161('0x8')](),controller['update']);router[_0x2161('0xe')]('/:id',auth[_0x2161('0x8')](),controller[_0x2161('0xf')]);module['exports']=router; \ No newline at end of file +var _0x76a7=['/:id','show','create','put','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index'];(function(_0x25c6ac,_0x3dbf5a){var _0x4f472a=function(_0x26d127){while(--_0x26d127){_0x25c6ac['push'](_0x25c6ac['shift']());}};_0x4f472a(++_0x3dbf5a);}(_0x76a7,0x14b));var _0x776a=function(_0x45172c,_0x29da0f){_0x45172c=_0x45172c-0x0;var _0x586102=_0x76a7[_0x45172c];return _0x586102;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x776a('0x0'));var timeout=require('connect-timeout');var express=require(_0x776a('0x1'));var router=express[_0x776a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x776a('0x3'));var interaction=require(_0x776a('0x4'));var config=require('../../config/environment');var controller=require(_0x776a('0x5'));router[_0x776a('0x6')]('/',auth[_0x776a('0x7')](),controller[_0x776a('0x8')]);router[_0x776a('0x6')](_0x776a('0x9'),auth[_0x776a('0x7')](),controller[_0x776a('0xa')]);router['post']('/',auth[_0x776a('0x7')](),controller[_0x776a('0xb')]);router[_0x776a('0xc')]('/:id',auth[_0x776a('0x7')](),controller[_0x776a('0xd')]);router[_0x776a('0xe')](_0x776a('0x9'),auth[_0x776a('0x7')](),controller[_0x776a('0xf')]);module[_0x776a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 14faf08..d406e5e 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 _0x329b=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x54ed00,_0x253ac2){var _0x2f9a44=function(_0x38bfb4){while(--_0x38bfb4){_0x54ed00['push'](_0x54ed00['shift']());}};_0x2f9a44(++_0x253ac2);}(_0x329b,0x9e));var _0xb329=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0x329b[_0x4849f6];return _0x1a3dcd;};'use strict';var Sequelize=require(_0xb329('0x0'));module[_0xb329('0x1')]={'type':{'type':Sequelize[_0xb329('0x2')](_0xb329('0x3'),_0xb329('0x4'),_0xb329('0x5'),_0xb329('0x6'),_0xb329('0x7')),'defaultValue':_0xb329('0x3')},'content':{'type':Sequelize[_0xb329('0x8')]},'key':{'type':Sequelize[_0xb329('0x8')]},'keyType':{'type':Sequelize[_0xb329('0x2')]('string',_0xb329('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb329('0x8')]},'idField':{'type':Sequelize[_0xb329('0x8')]},'nameField':{'type':Sequelize[_0xb329('0x8')]},'customField':{'type':Sequelize[_0xb329('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb329('0x8')]}}; \ No newline at end of file +var _0xed48=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize'];(function(_0x3211f1,_0x4043da){var _0x49a993=function(_0x3b7b15){while(--_0x3b7b15){_0x3211f1['push'](_0x3211f1['shift']());}};_0x49a993(++_0x4043da);}(_0xed48,0x17f));var _0x8ed4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xed48[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8ed4('0x0'));module['exports']={'type':{'type':Sequelize[_0x8ed4('0x1')](_0x8ed4('0x2'),_0x8ed4('0x3'),'customVariable',_0x8ed4('0x4'),_0x8ed4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8ed4('0x6')]},'key':{'type':Sequelize[_0x8ed4('0x6')]},'keyType':{'type':Sequelize[_0x8ed4('0x1')](_0x8ed4('0x2'),'variable',_0x8ed4('0x7'))},'keyContent':{'type':Sequelize[_0x8ed4('0x6')]},'idField':{'type':Sequelize[_0x8ed4('0x6')]},'nameField':{'type':Sequelize[_0x8ed4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ed4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 468eb51..c6ef1b9 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 _0xbea5=['rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','update','then','error','name','index','map','DeskField'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xbea5,0x177));var _0x5bea=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xbea5[_0x650e11];return _0x1a9b47;};'use strict';var emlformat=require(_0x5bea('0x0'));var rimraf=require(_0x5bea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bea('0x2'));var rp=require(_0x5bea('0x3'));var moment=require(_0x5bea('0x4'));var BPromise=require(_0x5bea('0x5'));var Mustache=require(_0x5bea('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5bea('0x7'));var csv=require('to-csv');var ejs=require(_0x5bea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5bea('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5bea('0xa'));var toCsv=require(_0x5bea('0xb'));var querystring=require(_0x5bea('0xc'));var Papa=require('papaparse');var Redis=require(_0x5bea('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5bea('0xe'));var hardwareService=require(_0x5bea('0xf'));var logger=require(_0x5bea('0x10'))(_0x5bea('0x11'));var utils=require(_0x5bea('0x12'));var config=require(_0x5bea('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bea('0x14'))['db'];function respondWithStatusCode(_0x1f49a0,_0x5aef2d){_0x5aef2d=_0x5aef2d||0xcc;return function(_0x289d99){if(_0x289d99){return _0x1f49a0[_0x5bea('0x15')](_0x5aef2d);}return _0x1f49a0['status'](_0x5aef2d)[_0x5bea('0x16')]();};}function respondWithResult(_0x229e09,_0x26cfca){_0x26cfca=_0x26cfca||0xc8;return function(_0xda336a){if(_0xda336a){return _0x229e09[_0x5bea('0x17')](_0x26cfca)[_0x5bea('0x18')](_0xda336a);}};}function respondWithFilteredResult(_0x14d46c,_0x5e0518){return function(_0x492190){if(_0x492190){var _0x1ad017=typeof _0x5e0518[_0x5bea('0x19')]===_0x5bea('0x1a')&&typeof _0x5e0518['limit']===_0x5bea('0x1a');var _0x18d13f=_0x492190[_0x5bea('0x1b')];var _0x49ba83=_0x1ad017?0x0:_0x5e0518[_0x5bea('0x19')];var _0x23fa96=_0x1ad017?_0x492190['count']:_0x5e0518[_0x5bea('0x19')]+_0x5e0518['limit'];var _0xd0f100;if(_0x23fa96>=_0x18d13f){_0x23fa96=_0x18d13f;_0xd0f100=0xc8;}else{_0xd0f100=0xce;}_0x14d46c[_0x5bea('0x17')](_0xd0f100);return _0x14d46c[_0x5bea('0x1c')]('Content-Range',_0x49ba83+'-'+_0x23fa96+'/'+_0x18d13f)['json'](_0x492190);}return null;};}function patchUpdates(_0x4169e5){return function(_0x2bf974){try{jsonpatch[_0x5bea('0x1d')](_0x2bf974,_0x4169e5,!![]);}catch(_0x52f12e){return BPromise[_0x5bea('0x1e')](_0x52f12e);}return _0x2bf974[_0x5bea('0x1f')]();};}function saveUpdates(_0x146177,_0xda92cf){return function(_0x595ee1){if(_0x595ee1){return _0x595ee1[_0x5bea('0x20')](_0x146177)[_0x5bea('0x21')](function(_0xcc0685){return _0xcc0685;});}return null;};}function removeEntity(_0x245c81,_0x5984f8){return function(_0x406ac8){if(_0x406ac8){return _0x406ac8['destroy']()[_0x5bea('0x21')](function(){_0x245c81['status'](0xcc)[_0x5bea('0x16')]();});}};}function handleEntityNotFound(_0x10282f,_0x37b196){return function(_0x5a8361){if(!_0x5a8361){_0x10282f['sendStatus'](0x194);}return _0x5a8361;};}function handleError(_0x4de13e,_0x57cde3){_0x57cde3=_0x57cde3||0x1f4;return function(_0x4c0821){logger[_0x5bea('0x22')](_0x4c0821['stack']);if(_0x4c0821['name']){delete _0x4c0821[_0x5bea('0x23')];}_0x4de13e[_0x5bea('0x17')](_0x57cde3)['send'](_0x4c0821);};}exports[_0x5bea('0x24')]=function(_0x5db06b,_0x577cf3){var _0x1a784b={},_0x2e773a={},_0x10b5e6={'count':0x0,'rows':[]};var _0x102ffb=_[_0x5bea('0x25')](db[_0x5bea('0x26')][_0x5bea('0x27')],function(_0x2d2308){return{'name':_0x2d2308[_0x5bea('0x28')],'type':_0x2d2308['type']['key']};});_0x2e773a[_0x5bea('0x29')]=_[_0x5bea('0x25')](_0x102ffb,_0x5bea('0x23'));_0x2e773a[_0x5bea('0x2a')]=_['keys'](_0x5db06b[_0x5bea('0x2a')]);_0x2e773a[_0x5bea('0x2b')]=_[_0x5bea('0x2c')](_0x2e773a[_0x5bea('0x29')],_0x2e773a['query']);_0x1a784b[_0x5bea('0x2d')]=_[_0x5bea('0x2c')](_0x2e773a[_0x5bea('0x29')],qs['fields'](_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x2e')]));_0x1a784b[_0x5bea('0x2d')]=_0x1a784b[_0x5bea('0x2d')][_0x5bea('0x2f')]?_0x1a784b[_0x5bea('0x2d')]:_0x2e773a['model'];if(!_0x5db06b['query'][_0x5bea('0x30')](_0x5bea('0x31'))){_0x1a784b['limit']=qs[_0x5bea('0x32')](_0x5db06b['query'][_0x5bea('0x32')]);_0x1a784b[_0x5bea('0x19')]=qs['offset'](_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x19')]);}_0x1a784b[_0x5bea('0x33')]=qs['sort'](_0x5db06b['query'][_0x5bea('0x34')]);_0x1a784b[_0x5bea('0x35')]=qs[_0x5bea('0x2b')](_[_0x5bea('0x36')](_0x5db06b[_0x5bea('0x2a')],_0x2e773a['filters']),_0x102ffb);if(_0x5db06b[_0x5bea('0x2a')]['filter']){_0x1a784b[_0x5bea('0x35')]=_[_0x5bea('0x37')](_0x1a784b[_0x5bea('0x35')],{'$or':_[_0x5bea('0x25')](_0x102ffb,function(_0x475307){if(_0x475307['type']!==_0x5bea('0x38')){var _0x439e27={};_0x439e27[_0x475307[_0x5bea('0x23')]]={'$like':'%'+_0x5db06b[_0x5bea('0x2a')]['filter']+'%'};return _0x439e27;}})});}_0x1a784b=_[_0x5bea('0x37')]({},_0x1a784b,_0x5db06b[_0x5bea('0x39')]);var _0x291d60={'where':_0x1a784b[_0x5bea('0x35')]};return db[_0x5bea('0x26')]['count'](_0x291d60)[_0x5bea('0x21')](function(_0x35e9f4){_0x10b5e6['count']=_0x35e9f4;if(_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x3a')]){_0x1a784b[_0x5bea('0x3b')]=[{'all':!![]}];}return db[_0x5bea('0x26')]['findAll'](_0x1a784b);})[_0x5bea('0x21')](function(_0x2e1976){_0x10b5e6[_0x5bea('0x3c')]=_0x2e1976;return _0x10b5e6;})[_0x5bea('0x21')](respondWithFilteredResult(_0x577cf3,_0x1a784b))[_0x5bea('0x3d')](handleError(_0x577cf3,null));};exports[_0x5bea('0x3e')]=function(_0x5610b2,_0x378bfb){var _0x52ce37={'raw':!![],'where':{'id':_0x5610b2[_0x5bea('0x3f')]['id']}},_0x1b6332={};_0x1b6332[_0x5bea('0x29')]=_[_0x5bea('0x40')](db['DeskField']['rawAttributes']);_0x1b6332['query']=_[_0x5bea('0x40')](_0x5610b2[_0x5bea('0x2a')]);_0x1b6332[_0x5bea('0x2b')]=_['intersection'](_0x1b6332[_0x5bea('0x29')],_0x1b6332[_0x5bea('0x2a')]);_0x52ce37[_0x5bea('0x2d')]=_['intersection'](_0x1b6332['model'],qs[_0x5bea('0x2e')](_0x5610b2['query'][_0x5bea('0x2e')]));_0x52ce37[_0x5bea('0x2d')]=_0x52ce37[_0x5bea('0x2d')][_0x5bea('0x2f')]?_0x52ce37['attributes']:_0x1b6332[_0x5bea('0x29')];if(_0x5610b2[_0x5bea('0x2a')][_0x5bea('0x3a')]){_0x52ce37[_0x5bea('0x3b')]=[{'all':!![]}];}_0x52ce37=_[_0x5bea('0x37')]({},_0x52ce37,_0x5610b2['options']);return db['DeskField'][_0x5bea('0x41')](_0x52ce37)[_0x5bea('0x21')](handleEntityNotFound(_0x378bfb,null))['then'](respondWithResult(_0x378bfb,null))[_0x5bea('0x3d')](handleError(_0x378bfb,null));};exports['create']=function(_0x2a6695,_0x455bcb){return db[_0x5bea('0x26')][_0x5bea('0x42')](_0x2a6695[_0x5bea('0x43')],{})[_0x5bea('0x21')](respondWithResult(_0x455bcb,0xc9))[_0x5bea('0x3d')](handleError(_0x455bcb,null));};exports[_0x5bea('0x20')]=function(_0x52af41,_0x4b6783){if(_0x52af41['body']['id']){delete _0x52af41[_0x5bea('0x43')]['id'];}return db[_0x5bea('0x26')]['find']({'where':{'id':_0x52af41[_0x5bea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4b6783,null))[_0x5bea('0x21')](saveUpdates(_0x52af41[_0x5bea('0x43')],null))['then'](respondWithResult(_0x4b6783,null))[_0x5bea('0x3d')](handleError(_0x4b6783,null));};exports[_0x5bea('0x44')]=function(_0xaa37af,_0x11f275){return db[_0x5bea('0x26')][_0x5bea('0x41')]({'where':{'id':_0xaa37af[_0x5bea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x11f275,null))[_0x5bea('0x21')](removeEntity(_0x11f275,null))[_0x5bea('0x3d')](handleError(_0x11f275,null));}; \ No newline at end of file +var _0x8375=['model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','length','includeAll','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','destroy','then','error','stack','name','send','map','DeskField','fieldName','type'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x8375,0xa8));var _0x5837=function(_0x49175c,_0x41dcf9){_0x49175c=_0x49175c-0x0;var _0x413bc0=_0x8375[_0x49175c];return _0x413bc0;};'use strict';var emlformat=require(_0x5837('0x0'));var rimraf=require(_0x5837('0x1'));var zipdir=require(_0x5837('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require(_0x5837('0x6'));var util=require(_0x5837('0x7'));var path=require(_0x5837('0x8'));var sox=require('sox');var csv=require(_0x5837('0x9'));var ejs=require(_0x5837('0xa'));var fs=require('fs');var fs_extra=require(_0x5837('0xb'));var _=require(_0x5837('0xc'));var squel=require(_0x5837('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x9'));var querystring=require('querystring');var Papa=require(_0x5837('0xf'));var Redis=require('ioredis');var authService=require(_0x5837('0x10'));var qs=require(_0x5837('0x11'));var as=require(_0x5837('0x12'));var hardwareService=require(_0x5837('0x13'));var logger=require(_0x5837('0x14'))(_0x5837('0x15'));var utils=require('../../config/utils');var config=require(_0x5837('0x16'));var licenseUtil=require(_0x5837('0x17'));var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x10c1a1,_0x143210){_0x143210=_0x143210||0xcc;return function(_0x485366){if(_0x485366){return _0x10c1a1['sendStatus'](_0x143210);}return _0x10c1a1['status'](_0x143210)[_0x5837('0x19')]();};}function respondWithResult(_0x111dbf,_0x469903){_0x469903=_0x469903||0xc8;return function(_0xa5718d){if(_0xa5718d){return _0x111dbf[_0x5837('0x1a')](_0x469903)[_0x5837('0x1b')](_0xa5718d);}};}function respondWithFilteredResult(_0x206f02,_0x754f39){return function(_0x10d882){if(_0x10d882){var _0x59a378=typeof _0x754f39[_0x5837('0x1c')]===_0x5837('0x1d')&&typeof _0x754f39['limit']===_0x5837('0x1d');var _0x2297b4=_0x10d882[_0x5837('0x1e')];var _0x49279d=_0x59a378?0x0:_0x754f39['offset'];var _0x4bee08=_0x59a378?_0x10d882[_0x5837('0x1e')]:_0x754f39[_0x5837('0x1c')]+_0x754f39[_0x5837('0x1f')];var _0x58e7f7;if(_0x4bee08>=_0x2297b4){_0x4bee08=_0x2297b4;_0x58e7f7=0xc8;}else{_0x58e7f7=0xce;}_0x206f02[_0x5837('0x1a')](_0x58e7f7);return _0x206f02[_0x5837('0x20')](_0x5837('0x21'),_0x49279d+'-'+_0x4bee08+'/'+_0x2297b4)[_0x5837('0x1b')](_0x10d882);}return null;};}function patchUpdates(_0x5881ff){return function(_0x4908c2){try{jsonpatch['apply'](_0x4908c2,_0x5881ff,!![]);}catch(_0x3d352f){return BPromise['reject'](_0x3d352f);}return _0x4908c2[_0x5837('0x22')]();};}function saveUpdates(_0x2bd103,_0x32733a){return function(_0x3a7efe){if(_0x3a7efe){return _0x3a7efe['update'](_0x2bd103)['then'](function(_0x1b80db){return _0x1b80db;});}return null;};}function removeEntity(_0x2262b9,_0x406506){return function(_0x5e8089){if(_0x5e8089){return _0x5e8089[_0x5837('0x23')]()[_0x5837('0x24')](function(){_0x2262b9[_0x5837('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f86a,_0x2646ed){return function(_0x39babd){if(!_0x39babd){_0x41f86a['sendStatus'](0x194);}return _0x39babd;};}function handleError(_0x57baed,_0x1d545c){_0x1d545c=_0x1d545c||0x1f4;return function(_0x15655e){logger[_0x5837('0x25')](_0x15655e[_0x5837('0x26')]);if(_0x15655e[_0x5837('0x27')]){delete _0x15655e[_0x5837('0x27')];}_0x57baed[_0x5837('0x1a')](_0x1d545c)[_0x5837('0x28')](_0x15655e);};}exports['index']=function(_0x2f0c8d,_0x13830f){var _0x3cbd3f={},_0x3918ee={},_0x1c9f32={'count':0x0,'rows':[]};var _0x228f1=_[_0x5837('0x29')](db[_0x5837('0x2a')]['rawAttributes'],function(_0x4f7502){return{'name':_0x4f7502[_0x5837('0x2b')],'type':_0x4f7502[_0x5837('0x2c')]['key']};});_0x3918ee[_0x5837('0x2d')]=_[_0x5837('0x29')](_0x228f1,'name');_0x3918ee[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x2f0c8d[_0x5837('0x2e')]);_0x3918ee['filters']=_['intersection'](_0x3918ee['model'],_0x3918ee[_0x5837('0x2e')]);_0x3cbd3f[_0x5837('0x30')]=_[_0x5837('0x31')](_0x3918ee[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x2f0c8d['query']['fields']));_0x3cbd3f[_0x5837('0x30')]=_0x3cbd3f[_0x5837('0x30')]['length']?_0x3cbd3f['attributes']:_0x3918ee[_0x5837('0x2d')];if(!_0x2f0c8d['query']['hasOwnProperty'](_0x5837('0x33'))){_0x3cbd3f[_0x5837('0x1f')]=qs['limit'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1f')]);_0x3cbd3f[_0x5837('0x1c')]=qs['offset'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1c')]);}_0x3cbd3f[_0x5837('0x34')]=qs[_0x5837('0x35')](_0x2f0c8d[_0x5837('0x2e')]['sort']);_0x3cbd3f[_0x5837('0x36')]=qs['filters'](_['pick'](_0x2f0c8d[_0x5837('0x2e')],_0x3918ee[_0x5837('0x37')]),_0x228f1);if(_0x2f0c8d['query'][_0x5837('0x38')]){_0x3cbd3f[_0x5837('0x36')]=_[_0x5837('0x39')](_0x3cbd3f[_0x5837('0x36')],{'$or':_['map'](_0x228f1,function(_0x2ed688){if(_0x2ed688[_0x5837('0x2c')]!==_0x5837('0x3a')){var _0x5dcd18={};_0x5dcd18[_0x2ed688[_0x5837('0x27')]]={'$like':'%'+_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x38')]+'%'};return _0x5dcd18;}})});}_0x3cbd3f=_[_0x5837('0x39')]({},_0x3cbd3f,_0x2f0c8d[_0x5837('0x3b')]);var _0x76f00d={'where':_0x3cbd3f[_0x5837('0x36')]};return db[_0x5837('0x2a')][_0x5837('0x1e')](_0x76f00d)[_0x5837('0x24')](function(_0x1a5e2d){_0x1c9f32[_0x5837('0x1e')]=_0x1a5e2d;if(_0x2f0c8d['query']['includeAll']){_0x3cbd3f[_0x5837('0x3c')]=[{'all':!![]}];}return db[_0x5837('0x2a')]['findAll'](_0x3cbd3f);})[_0x5837('0x24')](function(_0x1ae168){_0x1c9f32[_0x5837('0x3d')]=_0x1ae168;return _0x1c9f32;})['then'](respondWithFilteredResult(_0x13830f,_0x3cbd3f))[_0x5837('0x3e')](handleError(_0x13830f,null));};exports[_0x5837('0x3f')]=function(_0x1c81ed,_0x3acdf5){var _0x4643e3={'raw':!![],'where':{'id':_0x1c81ed[_0x5837('0x40')]['id']}},_0xd443be={};_0xd443be[_0x5837('0x2d')]=_[_0x5837('0x2f')](db['DeskField'][_0x5837('0x41')]);_0xd443be[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x1c81ed['query']);_0xd443be['filters']=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],_0xd443be[_0x5837('0x2e')]);_0x4643e3[_0x5837('0x30')]=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x1c81ed[_0x5837('0x2e')][_0x5837('0x32')]));_0x4643e3[_0x5837('0x30')]=_0x4643e3[_0x5837('0x30')][_0x5837('0x42')]?_0x4643e3['attributes']:_0xd443be[_0x5837('0x2d')];if(_0x1c81ed['query'][_0x5837('0x43')]){_0x4643e3[_0x5837('0x3c')]=[{'all':!![]}];}_0x4643e3=_['merge']({},_0x4643e3,_0x1c81ed[_0x5837('0x3b')]);return db[_0x5837('0x2a')]['find'](_0x4643e3)[_0x5837('0x24')](handleEntityNotFound(_0x3acdf5,null))[_0x5837('0x24')](respondWithResult(_0x3acdf5,null))[_0x5837('0x3e')](handleError(_0x3acdf5,null));};exports[_0x5837('0x44')]=function(_0x54a23b,_0x55cf2b){return db[_0x5837('0x2a')][_0x5837('0x44')](_0x54a23b['body'],{})['then'](respondWithResult(_0x55cf2b,0xc9))['catch'](handleError(_0x55cf2b,null));};exports['update']=function(_0x38e987,_0x6423f2){if(_0x38e987[_0x5837('0x45')]['id']){delete _0x38e987['body']['id'];}return db['DeskField'][_0x5837('0x46')]({'where':{'id':_0x38e987[_0x5837('0x40')]['id']}})[_0x5837('0x24')](handleEntityNotFound(_0x6423f2,null))[_0x5837('0x24')](saveUpdates(_0x38e987[_0x5837('0x45')],null))[_0x5837('0x24')](respondWithResult(_0x6423f2,null))[_0x5837('0x3e')](handleError(_0x6423f2,null));};exports[_0x5837('0x23')]=function(_0x27f7b9,_0x38743a){return db['DeskField'][_0x5837('0x46')]({'where':{'id':_0x27f7b9[_0x5837('0x40')]['id']}})['then'](handleEntityNotFound(_0x38743a,null))[_0x5837('0x24')](removeEntity(_0x38743a,null))[_0x5837('0x3e')](handleError(_0x38743a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 9ab86f1..e7d4f35 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 _0x1006=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','moment'];(function(_0x2367db,_0x214b5a){var _0x3a1fc3=function(_0x2544a1){while(--_0x2544a1){_0x2367db['push'](_0x2367db['shift']());}};_0x3a1fc3(++_0x214b5a);}(_0x1006,0x147));var _0x6100=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x1006[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x6100('0x0'));var util=require(_0x6100('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6100('0x2'));var BPromise=require(_0x6100('0x3'));var rp=require(_0x6100('0x4'));var fs=require('fs');var path=require(_0x6100('0x5'));var rimraf=require(_0x6100('0x6'));var config=require(_0x6100('0x7'));var attributes=require(_0x6100('0x8'));module[_0x6100('0x9')]=function(_0x548daa,_0x388577){return _0x548daa[_0x6100('0xa')](_0x6100('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x6100('0xc'),'fields':[_0x6100('0xd'),_0x6100('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3841=['FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','int_desk_fields','desk_unique_index','idField'];(function(_0x308c13,_0x5be630){var _0x2aa4e1=function(_0x506431){while(--_0x506431){_0x308c13['push'](_0x308c13['shift']());}};_0x2aa4e1(++_0x5be630);}(_0x3841,0xf8));var _0x1384=function(_0x1ed46f,_0x7691d7){_0x1ed46f=_0x1ed46f-0x0;var _0x43b931=_0x3841[_0x1ed46f];return _0x43b931;};'use strict';var _=require(_0x1384('0x0'));var util=require('util');var logger=require(_0x1384('0x1'))(_0x1384('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1384('0x3'));var fs=require('fs');var path=require(_0x1384('0x4'));var rimraf=require(_0x1384('0x5'));var config=require(_0x1384('0x6'));var attributes=require('./intDeskField.attributes');module[_0x1384('0x7')]=function(_0x304a56,_0x515497){return _0x304a56[_0x1384('0x8')]('DeskField',attributes,{'tableName':_0x1384('0x9'),'paranoid':![],'indexes':[{'name':_0x1384('0xa'),'fields':[_0x1384('0xb'),_0x1384('0xc')],'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 a2d9a28..a17f264 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 _0x2116=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x2116,0x1ce));var _0x6211=function(_0x317c00,_0x47ef74){_0x317c00=_0x317c00-0x0;var _0x5e15ff=_0x2116[_0x317c00];return _0x5e15ff;};'use strict';var _=require('lodash');var util=require(_0x6211('0x0'));var moment=require(_0x6211('0x1'));var BPromise=require(_0x6211('0x2'));var rs=require(_0x6211('0x3'));var fs=require('fs');var Redis=require(_0x6211('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6211('0x5'))(_0x6211('0x6'));var config=require(_0x6211('0x7'));var jayson=require(_0x6211('0x8'));var client=jayson['client'][_0x6211('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7d89,_0xdde17d,_0x262fe0){return new BPromise(function(_0x5cfb24,_0x3cd1d3){return client[_0x6211('0xa')](_0x3b7d89,_0x262fe0)[_0x6211('0xb')](function(_0x57c55f){logger[_0x6211('0xc')](_0x6211('0xd'),_0xdde17d,'request\x20sent');logger[_0x6211('0xe')](_0x6211('0xf'),_0xdde17d,_0x6211('0x10'),JSON[_0x6211('0x11')](_0x57c55f));if(_0x57c55f[_0x6211('0x12')]){if(_0x57c55f[_0x6211('0x12')][_0x6211('0x13')]===0x1f4){logger[_0x6211('0x12')]('DeskField,\x20%s,\x20%s',_0xdde17d,_0x57c55f[_0x6211('0x12')][_0x6211('0x14')]);return _0x3cd1d3(_0x57c55f['error']['message']);}logger[_0x6211('0x12')](_0x6211('0xd'),_0xdde17d,_0x57c55f['error'][_0x6211('0x14')]);return _0x5cfb24(_0x57c55f[_0x6211('0x12')][_0x6211('0x14')]);}else{logger[_0x6211('0xc')](_0x6211('0xd'),_0xdde17d,_0x6211('0x10'));_0x5cfb24(_0x57c55f[_0x6211('0x15')][_0x6211('0x14')]);}})[_0x6211('0x16')](function(_0x3dba03){logger[_0x6211('0x12')](_0x6211('0xd'),_0xdde17d,_0x3dba03);_0x3cd1d3(_0x3dba03);});});} \ No newline at end of file +var _0x5196=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5196,0x194));var _0x6519=function(_0x3e2b09,_0x29aff1){_0x3e2b09=_0x3e2b09-0x0;var _0x346e49=_0x5196[_0x3e2b09];return _0x346e49;};'use strict';var _=require(_0x6519('0x0'));var util=require(_0x6519('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6519('0x2'));var fs=require('fs');var Redis=require(_0x6519('0x3'));var db=require(_0x6519('0x4'))['db'];var utils=require(_0x6519('0x5'));var logger=require(_0x6519('0x6'))('rpc');var config=require(_0x6519('0x7'));var jayson=require(_0x6519('0x8'));var client=jayson[_0x6519('0x9')][_0x6519('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ee424,_0x34f1c1,_0x63ba1a){return new BPromise(function(_0x76166d,_0x5b3821){return client[_0x6519('0xb')](_0x3ee424,_0x63ba1a)[_0x6519('0xc')](function(_0x2cc5ea){logger[_0x6519('0xd')](_0x6519('0xe'),_0x34f1c1,_0x6519('0xf'));logger[_0x6519('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x34f1c1,_0x6519('0xf'),JSON[_0x6519('0x11')](_0x2cc5ea));if(_0x2cc5ea['error']){if(_0x2cc5ea[_0x6519('0x12')][_0x6519('0x13')]===0x1f4){logger[_0x6519('0x12')]('DeskField,\x20%s,\x20%s',_0x34f1c1,_0x2cc5ea['error'][_0x6519('0x14')]);return _0x5b3821(_0x2cc5ea[_0x6519('0x12')][_0x6519('0x14')]);}logger[_0x6519('0x12')](_0x6519('0xe'),_0x34f1c1,_0x2cc5ea[_0x6519('0x12')][_0x6519('0x14')]);return _0x76166d(_0x2cc5ea[_0x6519('0x12')][_0x6519('0x14')]);}else{logger[_0x6519('0xd')](_0x6519('0xe'),_0x34f1c1,_0x6519('0xf'));_0x76166d(_0x2cc5ea[_0x6519('0x15')][_0x6519('0x14')]);}})[_0x6519('0x16')](function(_0x460c04){logger['error'](_0x6519('0xe'),_0x34f1c1,_0x460c04);_0x5b3821(_0x460c04);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 191f790..c88bb3c 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 _0xec3e=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xec3e,0xdd));var _0xeec3=function(_0x569cc2,_0x348bf9){_0x569cc2=_0x569cc2-0x0;var _0x27af59=_0xec3e[_0x569cc2];return _0x27af59;};'use strict';var multer=require('multer');var util=require(_0xeec3('0x0'));var path=require(_0xeec3('0x1'));var timeout=require(_0xeec3('0x2'));var express=require(_0xeec3('0x3'));var router=express['Router']();var fs_extra=require(_0xeec3('0x4'));var auth=require(_0xeec3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeec3('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xeec3('0x7')]('/',auth[_0xeec3('0x8')](),controller['index']);router[_0xeec3('0x7')](_0xeec3('0x9'),auth['isAuthenticated'](),controller[_0xeec3('0xa')]);router[_0xeec3('0x7')](_0xeec3('0xb'),auth[_0xeec3('0x8')](),controller[_0xeec3('0xc')]);router['get'](_0xeec3('0xd'),auth[_0xeec3('0x8')](),controller[_0xeec3('0xe')]);router[_0xeec3('0xf')]('/',auth['isAuthenticated'](),controller[_0xeec3('0x10')]);router[_0xeec3('0xf')]('/:id/configurations',auth[_0xeec3('0x8')](),controller['addConfiguration']);router[_0xeec3('0x11')](_0xeec3('0x9'),auth['isAuthenticated'](),controller[_0xeec3('0x12')]);router[_0xeec3('0x13')](_0xeec3('0x9'),auth['isAuthenticated'](),controller[_0xeec3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9f93=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','util','path','connect-timeout'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9f93,0xfa));var _0x39f9=function(_0x72d4e8,_0x54baad){_0x72d4e8=_0x72d4e8-0x0;var _0x18b0e2=_0x9f93[_0x72d4e8];return _0x18b0e2;};'use strict';var multer=require('multer');var util=require(_0x39f9('0x0'));var path=require(_0x39f9('0x1'));var timeout=require(_0x39f9('0x2'));var express=require(_0x39f9('0x3'));var router=express[_0x39f9('0x4')]();var fs_extra=require(_0x39f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x39f9('0x6'));var config=require(_0x39f9('0x7'));var controller=require(_0x39f9('0x8'));router[_0x39f9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x39f9('0x9')](_0x39f9('0xa'),auth[_0x39f9('0xb')](),controller[_0x39f9('0xc')]);router[_0x39f9('0x9')](_0x39f9('0xd'),auth[_0x39f9('0xb')](),controller[_0x39f9('0xe')]);router[_0x39f9('0x9')](_0x39f9('0xf'),auth[_0x39f9('0xb')](),controller[_0x39f9('0x10')]);router[_0x39f9('0x11')]('/',auth['isAuthenticated'](),controller[_0x39f9('0x12')]);router[_0x39f9('0x11')](_0x39f9('0xd'),auth[_0x39f9('0xb')](),controller[_0x39f9('0x13')]);router[_0x39f9('0x14')](_0x39f9('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x39f9('0xb')](),controller[_0x39f9('0x15')]);module[_0x39f9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 271aafa..e63ce90 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 _0x1224=['BOOLEAN','sequelize','exports','STRING'];(function(_0x310480,_0x189c0b){var _0x160f33=function(_0x805e0d){while(--_0x805e0d){_0x310480['push'](_0x310480['shift']());}};_0x160f33(++_0x189c0b);}(_0x1224,0x10d));var _0x4122=function(_0x55418e,_0x3fe1fc){_0x55418e=_0x55418e-0x0;var _0x634190=_0x1224[_0x55418e];return _0x634190;};'use strict';var Sequelize=require(_0x4122('0x0'));module[_0x4122('0x1')]={'name':{'type':Sequelize[_0x4122('0x2')]},'username':{'type':Sequelize[_0x4122('0x2')]},'password':{'type':Sequelize[_0x4122('0x2')]},'remoteUri':{'type':Sequelize[_0x4122('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4122('0x2')]},'clientSecret':{'type':Sequelize[_0x4122('0x2')]},'serverUrl':{'type':Sequelize[_0x4122('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x4122('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x56da=['STRING','BOOLEAN','sequelize'];(function(_0x292a0b,_0x3b2a29){var _0x2f3ccc=function(_0x337cff){while(--_0x337cff){_0x292a0b['push'](_0x292a0b['shift']());}};_0x2f3ccc(++_0x3b2a29);}(_0x56da,0x119));var _0xa56d=function(_0x15ed84,_0x589521){_0x15ed84=_0x15ed84-0x0;var _0x426d2b=_0x56da[_0x15ed84];return _0x426d2b;};'use strict';var Sequelize=require(_0xa56d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa56d('0x1')]},'username':{'type':Sequelize[_0xa56d('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa56d('0x1')]},'tenantId':{'type':Sequelize[_0xa56d('0x1')]},'clientId':{'type':Sequelize[_0xa56d('0x1')]},'clientSecret':{'type':Sequelize[_0xa56d('0x1')]},'serverUrl':{'type':Sequelize[_0xa56d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa56d('0x1')]},'modernAuthentication':{'type':Sequelize[_0xa56d('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index eceec75..f3da7fa 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 _0x4134=['followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','/oauth2/token','clientId','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','push','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','util','../../config/logger','api','../../components/integrations/configuration','json','undefined','limit','count','offset','status','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Dynamics365Account','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','Dynamics365Configuration','length','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname'];(function(_0x4a21d5,_0x3fb9fd){var _0x178480=function(_0x2ef053){while(--_0x2ef053){_0x4a21d5['push'](_0x4a21d5['shift']());}};_0x178480(++_0x3fb9fd);}(_0x4134,0x1c6));var _0x4413=function(_0x11bc4e,_0x2d67ab){_0x11bc4e=_0x11bc4e-0x0;var _0x4cbbe7=_0x4134[_0x11bc4e];return _0x4cbbe7;};'use strict';var rp=require('request-promise');var util=require(_0x4413('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x4413('0x1'))(_0x4413('0x2'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4413('0x3'));function respondWithResult(_0x28fd1c,_0x494668){_0x494668=_0x494668||0xc8;return function(_0x542fde){if(_0x542fde){return _0x28fd1c['status'](_0x494668)[_0x4413('0x4')](_0x542fde);}};}function respondWithFilteredResult(_0x5e240d,_0x104165){return function(_0x11cbec){if(_0x11cbec){var _0x5653fc=typeof _0x104165['offset']===_0x4413('0x5')&&typeof _0x104165[_0x4413('0x6')]===_0x4413('0x5');var _0x487741=_0x11cbec[_0x4413('0x7')];var _0x2e5bc2=_0x5653fc?0x0:_0x104165[_0x4413('0x8')];var _0x2512a4=_0x5653fc?_0x11cbec[_0x4413('0x7')]:_0x104165['offset']+_0x104165['limit'];var _0x1ad946;if(_0x2512a4>=_0x487741){_0x2512a4=_0x487741;_0x1ad946=0xc8;}else{_0x1ad946=0xce;}_0x5e240d[_0x4413('0x9')](_0x1ad946);return _0x5e240d[_0x4413('0xa')](_0x4413('0xb'),_0x2e5bc2+'-'+_0x2512a4+'/'+_0x487741)[_0x4413('0x4')](_0x11cbec);}return null;};}function saveUpdates(_0x3d24a5){return function(_0x4294ba){if(_0x4294ba){return _0x4294ba[_0x4413('0xc')](_0x3d24a5)[_0x4413('0xd')](function(_0x158922){return _0x158922;});}return null;};}function removeEntity(_0x16d819){return function(_0x3fc8fa){if(_0x3fc8fa){return _0x3fc8fa['destroy']()['then'](function(){_0x16d819[_0x4413('0x9')](0xcc)[_0x4413('0xe')]();});}};}function handleEntityNotFound(_0x2d71fd){return function(_0x5ea64c){if(!_0x5ea64c){_0x2d71fd[_0x4413('0xf')](0x194);}return _0x5ea64c;};}function handleError(_0x3d5676,_0x42aa36){_0x42aa36=_0x42aa36||0x1f4;return function(_0x92eec1){logger[_0x4413('0x10')](_0x92eec1[_0x4413('0x11')]);if(_0x92eec1[_0x4413('0x12')]){delete _0x92eec1[_0x4413('0x12')];}_0x3d5676[_0x4413('0x9')](_0x42aa36)[_0x4413('0x13')](_0x92eec1);};}exports[_0x4413('0x14')]=function(_0x39fcdb,_0x55dc83){var _0x3de4a2={},_0xfd4167={},_0x197b65={'count':0x0,'rows':[]};var _0x43a9cd=_[_0x4413('0x15')](db['Dynamics365Account'][_0x4413('0x16')],function(_0x167ae9){return{'name':_0x167ae9[_0x4413('0x17')],'type':_0x167ae9[_0x4413('0x18')][_0x4413('0x19')]};});_0xfd4167[_0x4413('0x1a')]=_['map'](_0x43a9cd,_0x4413('0x12'));_0xfd4167[_0x4413('0x1b')]=_[_0x4413('0x1c')](_0x39fcdb['query']);_0xfd4167['filters']=_['intersection'](_0xfd4167[_0x4413('0x1a')],_0xfd4167[_0x4413('0x1b')]);_0x3de4a2['attributes']=_[_0x4413('0x1d')](_0xfd4167[_0x4413('0x1a')],qs[_0x4413('0x1e')](_0x39fcdb['query'][_0x4413('0x1e')]));_0x3de4a2[_0x4413('0x1f')]=_0x3de4a2[_0x4413('0x1f')]['length']?_0x3de4a2[_0x4413('0x1f')]:_0xfd4167[_0x4413('0x1a')];if(!_0x39fcdb[_0x4413('0x1b')][_0x4413('0x20')](_0x4413('0x21'))){_0x3de4a2['limit']=qs[_0x4413('0x6')](_0x39fcdb[_0x4413('0x1b')][_0x4413('0x6')]);_0x3de4a2[_0x4413('0x8')]=qs[_0x4413('0x8')](_0x39fcdb[_0x4413('0x1b')]['offset']);}_0x3de4a2[_0x4413('0x22')]=qs[_0x4413('0x23')](_0x39fcdb[_0x4413('0x1b')][_0x4413('0x23')]);_0x3de4a2[_0x4413('0x24')]=qs[_0x4413('0x25')](_[_0x4413('0x26')](_0x39fcdb[_0x4413('0x1b')],_0xfd4167['filters']),_0x43a9cd);if(_0x39fcdb[_0x4413('0x1b')][_0x4413('0x27')]){_0x3de4a2[_0x4413('0x24')]=_[_0x4413('0x28')](_0x3de4a2['where'],{'$or':_['map'](_0x43a9cd,function(_0x22a10d){if(_0x22a10d[_0x4413('0x18')]!==_0x4413('0x29')){var _0x17b1f6={};_0x17b1f6[_0x22a10d[_0x4413('0x12')]]={'$like':'%'+_0x39fcdb[_0x4413('0x1b')][_0x4413('0x27')]+'%'};return _0x17b1f6;}})});}_0x3de4a2=_[_0x4413('0x28')]({},_0x3de4a2,_0x39fcdb['options']);var _0x2e40ff={'where':_0x3de4a2[_0x4413('0x24')]};return db[_0x4413('0x2a')]['count'](_0x2e40ff)[_0x4413('0xd')](function(_0x346c3a){_0x197b65[_0x4413('0x7')]=_0x346c3a;if(_0x39fcdb[_0x4413('0x1b')][_0x4413('0x2b')]){_0x3de4a2[_0x4413('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x4413('0x2d')](_0x3de4a2);})[_0x4413('0xd')](function(_0x140004){_0x197b65[_0x4413('0x2e')]=_0x140004;return _0x197b65;})[_0x4413('0xd')](respondWithFilteredResult(_0x55dc83,_0x3de4a2))['catch'](handleError(_0x55dc83,null));};exports['show']=function(_0x31ffba,_0x43caf9){var _0x10c01b={'raw':![],'where':{'id':_0x31ffba[_0x4413('0x2f')]['id']}},_0x3d72c1={};_0x3d72c1[_0x4413('0x1a')]=_['keys'](db[_0x4413('0x2a')][_0x4413('0x16')]);_0x3d72c1[_0x4413('0x1b')]=_[_0x4413('0x1c')](_0x31ffba[_0x4413('0x1b')]);_0x3d72c1[_0x4413('0x25')]=_['intersection'](_0x3d72c1[_0x4413('0x1a')],_0x3d72c1[_0x4413('0x1b')]);_0x10c01b[_0x4413('0x1f')]=_['intersection'](_0x3d72c1[_0x4413('0x1a')],qs['fields'](_0x31ffba['query'][_0x4413('0x1e')]));_0x10c01b[_0x4413('0x1f')]=_0x10c01b[_0x4413('0x1f')]['length']?_0x10c01b[_0x4413('0x1f')]:_0x3d72c1[_0x4413('0x1a')];if(_0x31ffba[_0x4413('0x1b')][_0x4413('0x2b')]){_0x10c01b[_0x4413('0x2c')]=[{'all':!![]}];}_0x10c01b=_[_0x4413('0x28')]({},_0x10c01b,_0x31ffba['options']);return db[_0x4413('0x2a')][_0x4413('0x30')](_0x10c01b)['then'](handleEntityNotFound(_0x43caf9,null))[_0x4413('0xd')](respondWithResult(_0x43caf9,null))[_0x4413('0x31')](handleError(_0x43caf9,null));};exports[_0x4413('0x32')]=function(_0x52daf9,_0x13c373){return db[_0x4413('0x2a')]['create'](_0x52daf9[_0x4413('0x33')],{})[_0x4413('0xd')](respondWithResult(_0x13c373,0xc9))[_0x4413('0x31')](handleError(_0x13c373,null));};exports['update']=function(_0x37715,_0x29580e){if(_0x37715[_0x4413('0x33')]['id']){delete _0x37715[_0x4413('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x37715[_0x4413('0x2f')]['id']}})['then'](handleEntityNotFound(_0x29580e,null))[_0x4413('0xd')](saveUpdates(_0x37715[_0x4413('0x33')],null))[_0x4413('0xd')](respondWithResult(_0x29580e,null))[_0x4413('0x31')](handleError(_0x29580e,null));};exports['destroy']=function(_0x16a54a,_0x213eb1){return db[_0x4413('0x2a')][_0x4413('0x30')]({'where':{'id':_0x16a54a[_0x4413('0x2f')]['id']}})[_0x4413('0xd')](handleEntityNotFound(_0x213eb1,null))[_0x4413('0xd')](removeEntity(_0x213eb1,null))[_0x4413('0x31')](handleError(_0x213eb1,null));};exports[_0x4413('0x34')]=function(_0x1d8ad3,_0x2ef44d){var _0x33beeb={};var _0x24cb6c={};var _0x120fc1;var _0x194bcd;return db[_0x4413('0x2a')][_0x4413('0x35')]({'where':{'id':_0x1d8ad3[_0x4413('0x2f')]['id']}})[_0x4413('0xd')](handleEntityNotFound(_0x2ef44d,null))[_0x4413('0xd')](function(_0x2e8d6b){if(_0x2e8d6b){_0x120fc1=_0x2e8d6b;_0x24cb6c['model']=_[_0x4413('0x1c')](db[_0x4413('0x36')][_0x4413('0x16')]);_0x24cb6c[_0x4413('0x1b')]=_['keys'](_0x1d8ad3[_0x4413('0x1b')]);_0x24cb6c[_0x4413('0x25')]=_[_0x4413('0x1d')](_0x24cb6c[_0x4413('0x1a')],_0x24cb6c[_0x4413('0x1b')]);_0x33beeb[_0x4413('0x1f')]=_['intersection'](_0x24cb6c[_0x4413('0x1a')],qs[_0x4413('0x1e')](_0x1d8ad3['query'][_0x4413('0x1e')]));_0x33beeb['attributes']=_0x33beeb['attributes']['length']?_0x33beeb[_0x4413('0x1f')]:_0x24cb6c[_0x4413('0x1a')];_0x33beeb[_0x4413('0x22')]=qs[_0x4413('0x23')](_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x23')]);_0x33beeb[_0x4413('0x24')]=qs[_0x4413('0x25')](_[_0x4413('0x26')](_0x1d8ad3[_0x4413('0x1b')],_0x24cb6c['filters']));if(_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x27')]){_0x33beeb[_0x4413('0x24')]=_['merge'](_0x33beeb['where'],{'$or':_[_0x4413('0x15')](_0x33beeb['attributes'],function(_0xed39fd){var _0x206b4b={};_0x206b4b[_0xed39fd]={'$like':'%'+_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x27')]+'%'};return _0x206b4b;})});}_0x33beeb=_[_0x4413('0x28')]({},_0x33beeb,_0x1d8ad3['options']);return _0x120fc1[_0x4413('0x34')](_0x33beeb);}})[_0x4413('0xd')](function(_0x3f1318){if(_0x3f1318){_0x194bcd=_0x3f1318[_0x4413('0x37')];if(!_0x1d8ad3['query']['hasOwnProperty'](_0x4413('0x21'))){_0x33beeb['limit']=qs['limit'](_0x1d8ad3[_0x4413('0x1b')]['limit']);_0x33beeb[_0x4413('0x8')]=qs[_0x4413('0x8')](_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x8')]);}return _0x120fc1['getConfigurations'](_0x33beeb);}})[_0x4413('0xd')](function(_0x3964f1){if(_0x3964f1){return _0x3964f1?{'count':_0x194bcd,'rows':_0x3964f1}:null;}})[_0x4413('0xd')](respondWithResult(_0x2ef44d,null))[_0x4413('0x31')](handleError(_0x2ef44d,null));};exports['addConfiguration']=function(_0x3f8510,_0xb48e04){if(_0x3f8510['body']['id']){delete _0x3f8510[_0x4413('0x33')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x3f8510[_0x4413('0x2f')]['id']}})[_0x4413('0xd')](handleEntityNotFound(_0xb48e04,null))[_0x4413('0xd')](function(_0x1c92b5){if(_0x1c92b5){_0x3f8510[_0x4413('0x33')]['AccountId']=_0x1c92b5['id'];_0x3f8510[_0x4413('0x33')][_0x4413('0x38')]=integrations['getSubjects'](_0x3f8510[_0x4413('0x33')][_0x4413('0x39')],_0x3f8510[_0x4413('0x33')][_0x4413('0x18')]);_0x3f8510['body'][_0x4413('0x3a')]=integrations[_0x4413('0x3b')](_0x3f8510['body'][_0x4413('0x39')],_0x3f8510['body'][_0x4413('0x18')]);return db['Dynamics365Configuration']['create'](_0x3f8510['body'],{'include':[{'model':db[_0x4413('0x3c')],'as':'Subjects'},{'model':db[_0x4413('0x3c')],'as':'Descriptions'}]});}return null;})[_0x4413('0xd')](respondWithResult(_0xb48e04,null))['catch'](handleError(_0xb48e04,null));};function sanitizeRemoteUri(_0x1b2e29){var _0x272f2d=_0x1b2e29['slice'](-0x1);if(_0x272f2d==='/')return _0x1b2e29[_0x4413('0x3d')](0x0,_0x1b2e29[_0x4413('0x3e')](_0x272f2d));return _0x1b2e29;}function getWebApiUrl(_0xafd236){return util[_0x4413('0x3f')]('%s/api/data/v9.0/',_0xafd236);}exports[_0x4413('0x40')]=function(_0x23c099,_0x44a8c1){var _0x5e6742=_0x23c099[_0x4413('0x1b')][_0x4413('0x41')];var _0x85fbcb=_0x5e6742===_0x4413('0x42')?_0x4413('0x43'):_0x4413('0x44');var _0x50c8b9='';var _0xa25aa='';var _0x4e0fda='';var _0x25e2e8='';var _0x1ad634='';var _0x4d8d71='';var _0x3683f1='';var _0x5d9533='';var _0x14541f=[_0x4413('0x45'),'description','customerid',_0x4413('0x46'),_0x4413('0x47'),_0x4413('0x48'),_0x4413('0x49'),_0x4413('0x4a'),_0x4413('0x4b'),_0x4413('0x4c')];var _0x1abff1=[_0x4413('0x4d'),_0x4413('0x4e'),_0x4413('0x4f'),'billedserviceunits',_0x4413('0x50'),_0x4413('0x51'),_0x4413('0x52'),'contractidname',_0x4413('0x53'),_0x4413('0x54'),'createdbyname',_0x4413('0x55'),_0x4413('0x56'),_0x4413('0x57'),_0x4413('0x58'),'customeridname',_0x4413('0x59'),_0x4413('0x5a'),_0x4413('0x5b'),_0x4413('0x5c'),_0x4413('0x5d'),_0x4413('0x5e'),_0x4413('0x5f'),_0x4413('0x60'),_0x4413('0x61'),_0x4413('0x62'),'importsequencenumber',_0x4413('0x63'),_0x4413('0x64'),'lastonholdtime',_0x4413('0x65'),'modifiedbyexternalpartyname',_0x4413('0x66'),_0x4413('0x67'),_0x4413('0x68'),_0x4413('0x69'),_0x4413('0x6a'),_0x4413('0x6b'),_0x4413('0x6c'),_0x4413('0x6d'),_0x4413('0x6e'),'onholdtime',_0x4413('0x6f'),_0x4413('0x70'),_0x4413('0x71'),'owneridyominame','parentcaseidname',_0x4413('0x72'),_0x4413('0x73'),_0x4413('0x74'),_0x4413('0x75'),_0x4413('0x76'),_0x4413('0x77'),'resolvebykpiidname','responseby','responsiblecontactidname',_0x4413('0x78'),'sentimentvalue',_0x4413('0x79'),_0x4413('0x7a'),_0x4413('0x7b'),_0x4413('0x7c'),_0x4413('0x7d'),_0x4413('0x7e'),'ticketnumber',_0x4413('0x7f'),_0x4413('0x80'),_0x4413('0x81'),'utcconversiontimezonecode',_0x4413('0x82')];var _0x504067=_0x14541f[_0x4413('0x83')](_0x1abff1);return db[_0x4413('0x2a')][_0x4413('0x35')]({'where':{'id':_0x23c099[_0x4413('0x2f')]['id']},'attributes':['id',_0x4413('0x84'),'password',_0x4413('0x85'),_0x4413('0x86'),'clientId',_0x4413('0x87'),_0x4413('0x88')],'include':[{'model':db[_0x4413('0x89')],'as':_0x4413('0x89'),'attributes':['id','data5',_0x4413('0x8a')]}]})['then'](handleEntityNotFound(_0x44a8c1,null))['then'](function(_0x31e0d3){if(_0x31e0d3){if(_0x31e0d3[_0x4413('0x88')]){_0x31e0d3[_0x4413('0x8b')]=_0x31e0d3[_0x4413('0x89')]['data5'];_0x5d9533=sanitizeRemoteUri(_0x31e0d3[_0x4413('0x89')][_0x4413('0x8a')]);_0x3683f1=getWebApiUrl(_0x5d9533);return _0x31e0d3;}_0x5d9533=sanitizeRemoteUri(_0x31e0d3['remoteUri']);_0x3683f1=getWebApiUrl(_0x5d9533);var _0x3b81aa={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x31e0d3[_0x4413('0x86')]+_0x4413('0x8c'),'form':{'client_id':_0x31e0d3[_0x4413('0x8d')],'resource':_0x5d9533,'username':_0x31e0d3[_0x4413('0x84')],'password':_0x31e0d3['password'],'grant_type':_0x4413('0x8e'),'client_secret':_0x31e0d3['clientSecret']},'json':!![]};return rp(_0x3b81aa);}})[_0x4413('0xd')](function(_0x2a2ce6){_0x4d8d71=_0x2a2ce6[_0x4413('0x8b')];var _0x1b9e29={'method':_0x4413('0x8f'),'uri':encodeURI(_0x3683f1+_0x4413('0x90')+_0x85fbcb+'\x27'),'headers':{'Authorization':_0x4413('0x91')+_0x4d8d71,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x1b9e29);})[_0x4413('0xd')](function(_0x1fe3ce){var _0xf8dfc=_0x1fe3ce[_0x4413('0x93')][0x0];var _0x7ecedb=_0xf8dfc[_0x4413('0x94')];var _0x486304={'method':_0x4413('0x8f'),'uri':_0x3683f1+_0x4413('0x95')+_0x7ecedb+_0x4413('0x96'),'headers':{'Authorization':_0x4413('0x91')+_0x4d8d71,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x486304);})[_0x4413('0xd')](function(_0xcdba08){_0x50c8b9=_0xcdba08;_0xa25aa=_0x50c8b9[_0x4413('0x97')];_0xa25aa=_[_0x4413('0x98')](_0xa25aa,function(_0x21e02f){return!_0x504067[_0x4413('0x99')](_0x21e02f['LogicalName']);});var _0x1a52ac=[];var _0x1782b2=[];_0xa25aa[_0x4413('0x9a')](function(_0xc30535){if(_0xc30535['@odata.type']){var _0x4347bc=_0xc30535[_0x4413('0x9b')][_0x4413('0x3d')](_0xc30535[_0x4413('0x9b')][_0x4413('0x3e')]('.')+0x1);if(_0x4347bc===_0x4413('0x9c')){_0x1a52ac['push'](getSelectList(_0x3683f1,_0x5e6742,_0x1782b2,_0x50c8b9['MetadataId'],_0xc30535[_0x4413('0x94')],_0x4d8d71));}}});return Promise[_0x4413('0x9d')](_0x1a52ac);})[_0x4413('0xd')](function(_0x43aa85){_0x4e0fda=_0x43aa85[0x0];var _0x2ab0e2=[];var _0x82fa79=[];_0xa25aa['forEach'](function(_0x409dec){if(!_['isNil'](_0x409dec[_0x4413('0x9b')])){var _0x4f364e=_0x409dec[_0x4413('0x9b')]['substring'](_0x409dec[_0x4413('0x9b')]['lastIndexOf']('.')+0x1);if(_0x4f364e===_0x4413('0x9e')){_0x2ab0e2[_0x4413('0x9f')](getBooleanList(_0x3683f1,_0x5e6742,_0x82fa79,_0x50c8b9[_0x4413('0x94')],_0x409dec[_0x4413('0x94')],_0x4d8d71));}}});return Promise[_0x4413('0x9d')](_0x2ab0e2);})[_0x4413('0xd')](function(_0xed5298){_0x25e2e8=_0xed5298[0x0];var _0x257f37=[];var _0x1153b5=[];_0xa25aa[_0x4413('0x9a')](function(_0x40b524){if(_0x40b524[_0x4413('0x9b')]){var _0x4d3ed4=_0x40b524['@odata.type']['substring'](_0x40b524[_0x4413('0x9b')][_0x4413('0x3e')]('.')+0x1);if(_0x4d3ed4==='StringAttributeMetadata'||_0x4d3ed4==='DoubleAttributeMetadata'||_0x4d3ed4===_0x4413('0xa0')||_0x4d3ed4===_0x4413('0xa1')||_0x4d3ed4===_0x4413('0xa2')||_0x4d3ed4===_0x4413('0xa3')||_0x4d3ed4===_0x4413('0xa4')||_0x4d3ed4===_0x4413('0xa5')||_0x4d3ed4===_0x4413('0xa6')||_0x4d3ed4==='DecimalAttributeMetadata'){_0x257f37['push'](getInputList(_0x3683f1,_0x5e6742,_0x4d3ed4,_0x1153b5,_0x50c8b9[_0x4413('0x94')],_0x40b524[_0x4413('0x94')],_0x4d8d71));}}});return Promise[_0x4413('0x9d')](_0x257f37);})[_0x4413('0xd')](function(_0x1a0258){_0x1ad634=_0x1a0258[0x0];var _0x4f6be3=_0x4e0fda['concat'](_0x25e2e8)[_0x4413('0x83')](_0x1ad634);var _0xc296a4={'count':_0x4f6be3[_0x4413('0x37')],'rows':_0x4f6be3};return _0xc296a4;})[_0x4413('0xd')](respondWithResult(_0x44a8c1,null))['catch'](function(_0x27d6d1){var _0xf82cfa=_0x23c099[_0x4413('0x1b')][_0x4413('0xa7')]?0x1f4:_0x27d6d1[_0x4413('0xa8')]||0x1f4;logger[_0x4413('0x10')](_0x27d6d1[_0x4413('0x11')]);delete _0x27d6d1[_0x4413('0x12')];if(_0xf82cfa===0x191){_0xf82cfa=0x190;}_0x44a8c1[_0x4413('0x9')](_0xf82cfa)['send'](_0x23c099['query']['test']?{'message':_0x4413('0xa9'),'statusCode':_0x27d6d1[_0x4413('0xa8')]}:_0x27d6d1);});};function getSelectList(_0x2fa415,_0x4c5ea0,_0x79b9b3,_0x47a07b,_0x44b7d5,_0x57872d){var _0x369f10={'method':'GET','uri':_0x2fa415+_0x4413('0x95')+_0x47a07b+')/Attributes('+_0x44b7d5+_0x4413('0xaa')+_0x4413('0xab'),'headers':{'Authorization':_0x4413('0x91')+_0x57872d,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x369f10)[_0x4413('0xd')](function(_0x33425a){var _0x29c489=[];var _0x2163bb=_0x33425a[_0x4413('0xac')][_0x4413('0xad')];_0x2163bb[_0x4413('0x9a')](function(_0x22222a){_0x29c489['push']({'name':_0x22222a['Label'][_0x4413('0xae')][_0x4413('0xaf')],'value':String(_0x22222a[_0x4413('0xb0')])});});var _0x5952bc={'id':_0x4c5ea0+'_'+_0x33425a[_0x4413('0xb1')],'name':_0x33425a['DisplayName']['UserLocalizedLabel'][_0x4413('0xaf')],'custom':![],'options':_0x29c489};_0x79b9b3['push'](_0x5952bc);return _0x79b9b3;});}function getBooleanList(_0x3065e4,_0x2d527a,_0x31368e,_0x231faa,_0x5d171d,_0x15547a){var _0x380ca5={'method':'GET','uri':_0x3065e4+_0x4413('0x95')+_0x231faa+')/Attributes('+_0x5d171d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x4413('0x91')+_0x15547a,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x380ca5)['then'](function(_0x253e8d){var _0x46c0a2=[];_0x46c0a2['push']({'name':_0x253e8d[_0x4413('0xac')][_0x4413('0xb2')][_0x4413('0xaf')][_0x4413('0xae')][_0x4413('0xaf')],'value':_0x4413('0xb3')},{'name':_0x253e8d[_0x4413('0xac')][_0x4413('0xb4')][_0x4413('0xaf')][_0x4413('0xae')][_0x4413('0xaf')],'value':_0x4413('0xb5')});var _0x46ac74={'id':_0x2d527a+'_'+_0x253e8d[_0x4413('0xb1')],'name':_0x253e8d[_0x4413('0xb6')][_0x4413('0xae')][_0x4413('0xaf')],'custom':![],'options':_0x46c0a2};_0x31368e[_0x4413('0x9f')](_0x46ac74);return _0x31368e;});}function getInputList(_0x490c01,_0x57a5b7,_0x1c5029,_0x4a3c01,_0x3d36e0,_0x4987c3,_0x384fdb){var _0xc054ac={'method':'GET','uri':_0x490c01+_0x4413('0x95')+_0x3d36e0+')/Attributes('+_0x4987c3+_0x4413('0xb7')+_0x1c5029+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x384fdb,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0xc054ac)[_0x4413('0xd')](function(_0xb233eb){var _0x5dd18f={'id':_0x57a5b7+'_'+_0xb233eb[_0x4413('0xb1')],'name':_0xb233eb[_0x4413('0xb6')][_0x4413('0xae')]?_0xb233eb[_0x4413('0xb6')][_0x4413('0xae')][_0x4413('0xaf')]:_0xb233eb['LogicalName'],'custom':![],'options':[]};_0x4a3c01['push'](_0x5dd18f);return _0x4a3c01;});} \ No newline at end of file +var _0x3e70=[')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','then','destroy','sendStatus','error','name','send','Dynamics365Account','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','keys','include','create','body','catch','update','find','getConfigurations','order','findOne','Subjects','getSubjects','Descriptions','channel','Dynamics365Configuration','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','POST','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','forEach','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions('];(function(_0x11a03f,_0x5b3fb5){var _0x30e0d8=function(_0x202173){while(--_0x202173){_0x11a03f['push'](_0x11a03f['shift']());}};_0x30e0d8(++_0x5b3fb5);}(_0x3e70,0x17a));var _0x03e7=function(_0x5c7b9d,_0x2be8aa){_0x5c7b9d=_0x5c7b9d-0x0;var _0x537f09=_0x3e70[_0x5c7b9d];return _0x537f09;};'use strict';var rp=require('request-promise');var util=require(_0x03e7('0x0'));var _=require(_0x03e7('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x03e7('0x2'))(_0x03e7('0x3'));var db=require(_0x03e7('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x3dab9e,_0x25ec9f){_0x25ec9f=_0x25ec9f||0xc8;return function(_0x4a6c80){if(_0x4a6c80){return _0x3dab9e[_0x03e7('0x5')](_0x25ec9f)[_0x03e7('0x6')](_0x4a6c80);}};}function respondWithFilteredResult(_0x492411,_0x37700f){return function(_0x1fb196){if(_0x1fb196){var _0x2c00b7=typeof _0x37700f[_0x03e7('0x7')]===_0x03e7('0x8')&&typeof _0x37700f[_0x03e7('0x9')]===_0x03e7('0x8');var _0x4ff520=_0x1fb196[_0x03e7('0xa')];var _0x52f7c3=_0x2c00b7?0x0:_0x37700f[_0x03e7('0x7')];var _0x89ac8b=_0x2c00b7?_0x1fb196[_0x03e7('0xa')]:_0x37700f[_0x03e7('0x7')]+_0x37700f['limit'];var _0x142212;if(_0x89ac8b>=_0x4ff520){_0x89ac8b=_0x4ff520;_0x142212=0xc8;}else{_0x142212=0xce;}_0x492411[_0x03e7('0x5')](_0x142212);return _0x492411['set'](_0x03e7('0xb'),_0x52f7c3+'-'+_0x89ac8b+'/'+_0x4ff520)[_0x03e7('0x6')](_0x1fb196);}return null;};}function saveUpdates(_0x4d5d49){return function(_0x3b8688){if(_0x3b8688){return _0x3b8688['update'](_0x4d5d49)[_0x03e7('0xc')](function(_0x1f0260){return _0x1f0260;});}return null;};}function removeEntity(_0x156c40){return function(_0x573d4d){if(_0x573d4d){return _0x573d4d[_0x03e7('0xd')]()['then'](function(){_0x156c40[_0x03e7('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8f44){return function(_0x2088f4){if(!_0x2088f4){_0x3a8f44[_0x03e7('0xe')](0x194);}return _0x2088f4;};}function handleError(_0x28ffb7,_0x14bf54){_0x14bf54=_0x14bf54||0x1f4;return function(_0x45f8e8){logger[_0x03e7('0xf')](_0x45f8e8['stack']);if(_0x45f8e8[_0x03e7('0x10')]){delete _0x45f8e8[_0x03e7('0x10')];}_0x28ffb7[_0x03e7('0x5')](_0x14bf54)[_0x03e7('0x11')](_0x45f8e8);};}exports['index']=function(_0x577033,_0x3e0935){var _0x184f81={},_0x47dafd={},_0x2cd058={'count':0x0,'rows':[]};var _0x392327=_['map'](db[_0x03e7('0x12')][_0x03e7('0x13')],function(_0x1aeeee){return{'name':_0x1aeeee[_0x03e7('0x14')],'type':_0x1aeeee[_0x03e7('0x15')][_0x03e7('0x16')]};});_0x47dafd['model']=_[_0x03e7('0x17')](_0x392327,_0x03e7('0x10'));_0x47dafd['query']=_['keys'](_0x577033[_0x03e7('0x18')]);_0x47dafd[_0x03e7('0x19')]=_['intersection'](_0x47dafd[_0x03e7('0x1a')],_0x47dafd['query']);_0x184f81[_0x03e7('0x1b')]=_[_0x03e7('0x1c')](_0x47dafd[_0x03e7('0x1a')],qs[_0x03e7('0x1d')](_0x577033[_0x03e7('0x18')][_0x03e7('0x1d')]));_0x184f81['attributes']=_0x184f81[_0x03e7('0x1b')][_0x03e7('0x1e')]?_0x184f81[_0x03e7('0x1b')]:_0x47dafd[_0x03e7('0x1a')];if(!_0x577033[_0x03e7('0x18')]['hasOwnProperty'](_0x03e7('0x1f'))){_0x184f81['limit']=qs[_0x03e7('0x9')](_0x577033[_0x03e7('0x18')][_0x03e7('0x9')]);_0x184f81[_0x03e7('0x7')]=qs[_0x03e7('0x7')](_0x577033[_0x03e7('0x18')][_0x03e7('0x7')]);}_0x184f81['order']=qs['sort'](_0x577033[_0x03e7('0x18')][_0x03e7('0x20')]);_0x184f81[_0x03e7('0x21')]=qs[_0x03e7('0x19')](_[_0x03e7('0x22')](_0x577033[_0x03e7('0x18')],_0x47dafd[_0x03e7('0x19')]),_0x392327);if(_0x577033[_0x03e7('0x18')][_0x03e7('0x23')]){_0x184f81[_0x03e7('0x21')]=_[_0x03e7('0x24')](_0x184f81[_0x03e7('0x21')],{'$or':_['map'](_0x392327,function(_0x149a5b){if(_0x149a5b[_0x03e7('0x15')]!==_0x03e7('0x25')){var _0x10c772={};_0x10c772[_0x149a5b['name']]={'$like':'%'+_0x577033[_0x03e7('0x18')][_0x03e7('0x23')]+'%'};return _0x10c772;}})});}_0x184f81=_[_0x03e7('0x24')]({},_0x184f81,_0x577033[_0x03e7('0x26')]);var _0x4268f8={'where':_0x184f81[_0x03e7('0x21')]};return db[_0x03e7('0x12')]['count'](_0x4268f8)[_0x03e7('0xc')](function(_0x5db716){_0x2cd058[_0x03e7('0xa')]=_0x5db716;if(_0x577033[_0x03e7('0x18')][_0x03e7('0x27')]){_0x184f81['include']=[{'all':!![]}];}return db[_0x03e7('0x12')][_0x03e7('0x28')](_0x184f81);})['then'](function(_0x5ac32a){_0x2cd058['rows']=_0x5ac32a;return _0x2cd058;})[_0x03e7('0xc')](respondWithFilteredResult(_0x3e0935,_0x184f81))['catch'](handleError(_0x3e0935,null));};exports['show']=function(_0x56fa7a,_0x47efe6){var _0x519f09={'raw':![],'where':{'id':_0x56fa7a[_0x03e7('0x29')]['id']}},_0x1c2a68={};_0x1c2a68[_0x03e7('0x1a')]=_[_0x03e7('0x2a')](db['Dynamics365Account'][_0x03e7('0x13')]);_0x1c2a68[_0x03e7('0x18')]=_[_0x03e7('0x2a')](_0x56fa7a[_0x03e7('0x18')]);_0x1c2a68[_0x03e7('0x19')]=_[_0x03e7('0x1c')](_0x1c2a68[_0x03e7('0x1a')],_0x1c2a68[_0x03e7('0x18')]);_0x519f09[_0x03e7('0x1b')]=_[_0x03e7('0x1c')](_0x1c2a68[_0x03e7('0x1a')],qs[_0x03e7('0x1d')](_0x56fa7a[_0x03e7('0x18')]['fields']));_0x519f09[_0x03e7('0x1b')]=_0x519f09['attributes']['length']?_0x519f09[_0x03e7('0x1b')]:_0x1c2a68[_0x03e7('0x1a')];if(_0x56fa7a[_0x03e7('0x18')]['includeAll']){_0x519f09[_0x03e7('0x2b')]=[{'all':!![]}];}_0x519f09=_[_0x03e7('0x24')]({},_0x519f09,_0x56fa7a[_0x03e7('0x26')]);return db[_0x03e7('0x12')]['find'](_0x519f09)[_0x03e7('0xc')](handleEntityNotFound(_0x47efe6,null))['then'](respondWithResult(_0x47efe6,null))['catch'](handleError(_0x47efe6,null));};exports[_0x03e7('0x2c')]=function(_0xc80a65,_0xfa89d7){return db[_0x03e7('0x12')][_0x03e7('0x2c')](_0xc80a65[_0x03e7('0x2d')],{})['then'](respondWithResult(_0xfa89d7,0xc9))[_0x03e7('0x2e')](handleError(_0xfa89d7,null));};exports[_0x03e7('0x2f')]=function(_0x1b39bc,_0x50fbc5){if(_0x1b39bc[_0x03e7('0x2d')]['id']){delete _0x1b39bc[_0x03e7('0x2d')]['id'];}return db[_0x03e7('0x12')][_0x03e7('0x30')]({'where':{'id':_0x1b39bc[_0x03e7('0x29')]['id']}})[_0x03e7('0xc')](handleEntityNotFound(_0x50fbc5,null))[_0x03e7('0xc')](saveUpdates(_0x1b39bc[_0x03e7('0x2d')],null))[_0x03e7('0xc')](respondWithResult(_0x50fbc5,null))[_0x03e7('0x2e')](handleError(_0x50fbc5,null));};exports[_0x03e7('0xd')]=function(_0x17ead1,_0x38dc92){return db['Dynamics365Account'][_0x03e7('0x30')]({'where':{'id':_0x17ead1[_0x03e7('0x29')]['id']}})[_0x03e7('0xc')](handleEntityNotFound(_0x38dc92,null))[_0x03e7('0xc')](removeEntity(_0x38dc92,null))[_0x03e7('0x2e')](handleError(_0x38dc92,null));};exports[_0x03e7('0x31')]=function(_0x3c0a64,_0x5747a5){var _0x19e873={};var _0x5de297={};var _0x5140c1;var _0x388b0d;return db[_0x03e7('0x12')]['findOne']({'where':{'id':_0x3c0a64[_0x03e7('0x29')]['id']}})[_0x03e7('0xc')](handleEntityNotFound(_0x5747a5,null))['then'](function(_0x5c344f){if(_0x5c344f){_0x5140c1=_0x5c344f;_0x5de297[_0x03e7('0x1a')]=_[_0x03e7('0x2a')](db['Dynamics365Configuration'][_0x03e7('0x13')]);_0x5de297[_0x03e7('0x18')]=_[_0x03e7('0x2a')](_0x3c0a64['query']);_0x5de297[_0x03e7('0x19')]=_[_0x03e7('0x1c')](_0x5de297['model'],_0x5de297[_0x03e7('0x18')]);_0x19e873[_0x03e7('0x1b')]=_[_0x03e7('0x1c')](_0x5de297['model'],qs[_0x03e7('0x1d')](_0x3c0a64[_0x03e7('0x18')][_0x03e7('0x1d')]));_0x19e873[_0x03e7('0x1b')]=_0x19e873[_0x03e7('0x1b')]['length']?_0x19e873[_0x03e7('0x1b')]:_0x5de297[_0x03e7('0x1a')];_0x19e873[_0x03e7('0x32')]=qs[_0x03e7('0x20')](_0x3c0a64['query'][_0x03e7('0x20')]);_0x19e873[_0x03e7('0x21')]=qs[_0x03e7('0x19')](_[_0x03e7('0x22')](_0x3c0a64[_0x03e7('0x18')],_0x5de297['filters']));if(_0x3c0a64[_0x03e7('0x18')]['filter']){_0x19e873['where']=_['merge'](_0x19e873[_0x03e7('0x21')],{'$or':_[_0x03e7('0x17')](_0x19e873[_0x03e7('0x1b')],function(_0x5daa50){var _0x303d95={};_0x303d95[_0x5daa50]={'$like':'%'+_0x3c0a64['query'][_0x03e7('0x23')]+'%'};return _0x303d95;})});}_0x19e873=_['merge']({},_0x19e873,_0x3c0a64[_0x03e7('0x26')]);return _0x5140c1[_0x03e7('0x31')](_0x19e873);}})['then'](function(_0x1fc359){if(_0x1fc359){_0x388b0d=_0x1fc359['length'];if(!_0x3c0a64[_0x03e7('0x18')]['hasOwnProperty']('nolimit')){_0x19e873['limit']=qs[_0x03e7('0x9')](_0x3c0a64[_0x03e7('0x18')]['limit']);_0x19e873[_0x03e7('0x7')]=qs[_0x03e7('0x7')](_0x3c0a64['query'][_0x03e7('0x7')]);}return _0x5140c1[_0x03e7('0x31')](_0x19e873);}})[_0x03e7('0xc')](function(_0x4c3a2e){if(_0x4c3a2e){return _0x4c3a2e?{'count':_0x388b0d,'rows':_0x4c3a2e}:null;}})[_0x03e7('0xc')](respondWithResult(_0x5747a5,null))['catch'](handleError(_0x5747a5,null));};exports['addConfiguration']=function(_0x5a70b7,_0x312192){if(_0x5a70b7['body']['id']){delete _0x5a70b7[_0x03e7('0x2d')]['id'];}return db[_0x03e7('0x12')][_0x03e7('0x33')]({'where':{'id':_0x5a70b7[_0x03e7('0x29')]['id']}})[_0x03e7('0xc')](handleEntityNotFound(_0x312192,null))[_0x03e7('0xc')](function(_0x205c18){if(_0x205c18){_0x5a70b7[_0x03e7('0x2d')]['AccountId']=_0x205c18['id'];_0x5a70b7['body'][_0x03e7('0x34')]=integrations[_0x03e7('0x35')](_0x5a70b7[_0x03e7('0x2d')]['channel'],_0x5a70b7[_0x03e7('0x2d')][_0x03e7('0x15')]);_0x5a70b7[_0x03e7('0x2d')][_0x03e7('0x36')]=integrations['getDescriptions'](_0x5a70b7['body'][_0x03e7('0x37')],_0x5a70b7[_0x03e7('0x2d')]['type']);return db[_0x03e7('0x38')]['create'](_0x5a70b7[_0x03e7('0x2d')],{'include':[{'model':db[_0x03e7('0x39')],'as':'Subjects'},{'model':db[_0x03e7('0x39')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x312192,null))[_0x03e7('0x2e')](handleError(_0x312192,null));};function sanitizeRemoteUri(_0x3c3682){var _0x377696=_0x3c3682[_0x03e7('0x3a')](-0x1);if(_0x377696==='/')return _0x3c3682[_0x03e7('0x3b')](0x0,_0x3c3682['lastIndexOf'](_0x377696));return _0x3c3682;}function getWebApiUrl(_0x4fea9f){return util[_0x03e7('0x3c')](_0x03e7('0x3d'),_0x4fea9f);}exports[_0x03e7('0x3e')]=function(_0x114e94,_0x5ec9a8){var _0x2d4755=_0x114e94['query'][_0x03e7('0x3f')];var _0x298780=_0x2d4755===_0x03e7('0x40')?_0x03e7('0x41'):_0x03e7('0x42');var _0xbc0027='';var _0x5ccfc1='';var _0x548e4c='';var _0x20c7c3='';var _0x50b88c='';var _0x20e9ce='';var _0x507a9d='';var _0x3a7e13='';var _0x34f55f=[_0x03e7('0x43'),'description','customerid','ownerid','caseorigincode',_0x03e7('0x44'),_0x03e7('0x45'),'regardingobjectid',_0x03e7('0x46'),_0x03e7('0x47')];var _0x48e5d3=[_0x03e7('0x48'),'accountidyominame',_0x03e7('0x49'),_0x03e7('0x4a'),_0x03e7('0x4b'),'contactidyominame',_0x03e7('0x4c'),_0x03e7('0x4d'),'createdbyexternalpartyname',_0x03e7('0x4e'),'createdbyname','createdbyyominame',_0x03e7('0x4f'),'createdonbehalfbyname',_0x03e7('0x50'),_0x03e7('0x51'),_0x03e7('0x52'),_0x03e7('0x53'),_0x03e7('0x54'),_0x03e7('0x55'),_0x03e7('0x56'),_0x03e7('0x57'),_0x03e7('0x58'),'exchangerate','firstresponsebykpiidname','followupby',_0x03e7('0x59'),_0x03e7('0x5a'),_0x03e7('0x5b'),'lastonholdtime',_0x03e7('0x5c'),'modifiedbyexternalpartyname',_0x03e7('0x5d'),_0x03e7('0x5e'),'modifiedbyyominame','modifiedon',_0x03e7('0x5f'),_0x03e7('0x60'),_0x03e7('0x61'),_0x03e7('0x62'),_0x03e7('0x63'),_0x03e7('0x64'),_0x03e7('0x65'),_0x03e7('0x66'),_0x03e7('0x67'),'owneridyominame',_0x03e7('0x68'),_0x03e7('0x69'),_0x03e7('0x6a'),_0x03e7('0x6b'),_0x03e7('0x6c'),_0x03e7('0x6d'),_0x03e7('0x6e'),_0x03e7('0x6f'),_0x03e7('0x70'),_0x03e7('0x71'),_0x03e7('0x72'),_0x03e7('0x73'),_0x03e7('0x74'),_0x03e7('0x75'),'socialprofileidname',_0x03e7('0x76'),_0x03e7('0x77'),_0x03e7('0x78'),_0x03e7('0x79'),'timezoneruleversionnumber',_0x03e7('0x7a'),_0x03e7('0x7b'),'utcconversiontimezonecode',_0x03e7('0x7c')];var _0x346b7f=_0x34f55f[_0x03e7('0x7d')](_0x48e5d3);return db[_0x03e7('0x12')]['findOne']({'where':{'id':_0x114e94[_0x03e7('0x29')]['id']},'attributes':['id',_0x03e7('0x7e'),_0x03e7('0x7f'),_0x03e7('0x80'),_0x03e7('0x81'),_0x03e7('0x82'),_0x03e7('0x83'),'modernAuthentication'],'include':[{'model':db[_0x03e7('0x84')],'as':_0x03e7('0x84'),'attributes':['id',_0x03e7('0x85'),_0x03e7('0x86')]}]})[_0x03e7('0xc')](handleEntityNotFound(_0x5ec9a8,null))[_0x03e7('0xc')](function(_0x38fd33){if(_0x38fd33){if(_0x38fd33['modernAuthentication']){_0x38fd33['access_token']=_0x38fd33[_0x03e7('0x84')]['data5'];_0x3a7e13=sanitizeRemoteUri(_0x38fd33['CloudProvider'][_0x03e7('0x86')]);_0x507a9d=getWebApiUrl(_0x3a7e13);return _0x38fd33;}_0x3a7e13=sanitizeRemoteUri(_0x38fd33[_0x03e7('0x80')]);_0x507a9d=getWebApiUrl(_0x3a7e13);var _0xee3354={'method':_0x03e7('0x87'),'uri':'https://login.microsoftonline.com/'+_0x38fd33[_0x03e7('0x81')]+_0x03e7('0x88'),'form':{'client_id':_0x38fd33[_0x03e7('0x82')],'resource':_0x3a7e13,'username':_0x38fd33[_0x03e7('0x7e')],'password':_0x38fd33['password'],'grant_type':'password','client_secret':_0x38fd33[_0x03e7('0x83')]},'json':!![]};return rp(_0xee3354);}})[_0x03e7('0xc')](function(_0x4993df){_0x20e9ce=_0x4993df[_0x03e7('0x89')];var _0xf1826e={'method':_0x03e7('0x8a'),'uri':encodeURI(_0x507a9d+_0x03e7('0x8b')+_0x298780+'\x27'),'headers':{'Authorization':_0x03e7('0x8c')+_0x20e9ce,'If-None-Match':null,'OData-Version':_0x03e7('0x8d')},'json':!![]};return rp(_0xf1826e);})[_0x03e7('0xc')](function(_0x1828a4){var _0x378056=_0x1828a4[_0x03e7('0x8e')][0x0];var _0x411c8c=_0x378056[_0x03e7('0x8f')];var _0x1919cb={'method':_0x03e7('0x8a'),'uri':_0x507a9d+'EntityDefinitions('+_0x411c8c+_0x03e7('0x90'),'headers':{'Authorization':_0x03e7('0x8c')+_0x20e9ce,'If-None-Match':null,'OData-Version':_0x03e7('0x8d')},'json':!![]};return rp(_0x1919cb);})[_0x03e7('0xc')](function(_0x5cb82f){_0xbc0027=_0x5cb82f;_0x5ccfc1=_0xbc0027[_0x03e7('0x91')];_0x5ccfc1=_[_0x03e7('0x92')](_0x5ccfc1,function(_0x56d1f9){return!_0x346b7f[_0x03e7('0x93')](_0x56d1f9[_0x03e7('0x94')]);});var _0x33531d=[];var _0xda00c=[];_0x5ccfc1['forEach'](function(_0x33a01c){if(_0x33a01c[_0x03e7('0x95')]){var _0x13ad3c=_0x33a01c[_0x03e7('0x95')][_0x03e7('0x3b')](_0x33a01c[_0x03e7('0x95')][_0x03e7('0x96')]('.')+0x1);if(_0x13ad3c===_0x03e7('0x97')){_0x33531d['push'](getSelectList(_0x507a9d,_0x2d4755,_0xda00c,_0xbc0027[_0x03e7('0x8f')],_0x33a01c[_0x03e7('0x8f')],_0x20e9ce));}}});return Promise[_0x03e7('0x98')](_0x33531d);})[_0x03e7('0xc')](function(_0xdef25b){_0x548e4c=_0xdef25b[0x0];var _0x4f6228=[];var _0x517fb3=[];_0x5ccfc1['forEach'](function(_0x20be5c){if(!_[_0x03e7('0x99')](_0x20be5c[_0x03e7('0x95')])){var _0x55b924=_0x20be5c[_0x03e7('0x95')][_0x03e7('0x3b')](_0x20be5c[_0x03e7('0x95')]['lastIndexOf']('.')+0x1);if(_0x55b924===_0x03e7('0x9a')){_0x4f6228[_0x03e7('0x9b')](getBooleanList(_0x507a9d,_0x2d4755,_0x517fb3,_0xbc0027[_0x03e7('0x8f')],_0x20be5c[_0x03e7('0x8f')],_0x20e9ce));}}});return Promise[_0x03e7('0x98')](_0x4f6228);})['then'](function(_0x595962){_0x20c7c3=_0x595962[0x0];var _0x13464a=[];var _0x23eeac=[];_0x5ccfc1[_0x03e7('0x9c')](function(_0x39f2ea){if(_0x39f2ea['@odata.type']){var _0x521637=_0x39f2ea['@odata.type'][_0x03e7('0x3b')](_0x39f2ea['@odata.type'][_0x03e7('0x96')]('.')+0x1);if(_0x521637===_0x03e7('0x9d')||_0x521637==='DoubleAttributeMetadata'||_0x521637===_0x03e7('0x9e')||_0x521637===_0x03e7('0x9f')||_0x521637===_0x03e7('0xa0')||_0x521637==='DateTimeAttributeMetadata'||_0x521637===_0x03e7('0xa1')||_0x521637===_0x03e7('0xa2')||_0x521637===_0x03e7('0xa3')||_0x521637===_0x03e7('0xa4')){_0x13464a['push'](getInputList(_0x507a9d,_0x2d4755,_0x521637,_0x23eeac,_0xbc0027[_0x03e7('0x8f')],_0x39f2ea[_0x03e7('0x8f')],_0x20e9ce));}}});return Promise[_0x03e7('0x98')](_0x13464a);})[_0x03e7('0xc')](function(_0x5890d2){_0x50b88c=_0x5890d2[0x0];var _0x263951=_0x548e4c['concat'](_0x20c7c3)['concat'](_0x50b88c);var _0x1efb0b={'count':_0x263951['length'],'rows':_0x263951};return _0x1efb0b;})[_0x03e7('0xc')](respondWithResult(_0x5ec9a8,null))[_0x03e7('0x2e')](function(_0x534320){var _0x428952=_0x114e94[_0x03e7('0x18')][_0x03e7('0xa5')]?0x1f4:_0x534320[_0x03e7('0xa6')]||0x1f4;logger[_0x03e7('0xf')](_0x534320['stack']);delete _0x534320['name'];if(_0x428952===0x191){_0x428952=0x190;}_0x5ec9a8[_0x03e7('0x5')](_0x428952)['send'](_0x114e94[_0x03e7('0x18')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x534320[_0x03e7('0xa6')]}:_0x534320);});};function getSelectList(_0x137d32,_0x31e4d6,_0x400947,_0x3b2bbd,_0x428188,_0x59537c){var _0x4b67fb={'method':_0x03e7('0x8a'),'uri':_0x137d32+_0x03e7('0xa7')+_0x3b2bbd+_0x03e7('0xa8')+_0x428188+_0x03e7('0xa9')+_0x03e7('0xaa'),'headers':{'Authorization':_0x03e7('0x8c')+_0x59537c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b67fb)['then'](function(_0x1c5c70){var _0x988f8c=[];var _0x46cebb=_0x1c5c70[_0x03e7('0xab')][_0x03e7('0xac')];_0x46cebb[_0x03e7('0x9c')](function(_0x239b56){_0x988f8c[_0x03e7('0x9b')]({'name':_0x239b56['Label'][_0x03e7('0xad')][_0x03e7('0xae')],'value':String(_0x239b56[_0x03e7('0xaf')])});});var _0x23b320={'id':_0x31e4d6+'_'+_0x1c5c70[_0x03e7('0x94')],'name':_0x1c5c70['DisplayName'][_0x03e7('0xad')][_0x03e7('0xae')],'custom':![],'options':_0x988f8c};_0x400947[_0x03e7('0x9b')](_0x23b320);return _0x400947;});}function getBooleanList(_0x45da59,_0x1bda04,_0xb3f726,_0x287f8a,_0x25a5c8,_0x2e7f30){var _0x3d3014={'method':_0x03e7('0x8a'),'uri':_0x45da59+_0x03e7('0xa7')+_0x287f8a+_0x03e7('0xa8')+_0x25a5c8+_0x03e7('0xb0'),'headers':{'Authorization':_0x03e7('0x8c')+_0x2e7f30,'If-None-Match':null,'OData-Version':_0x03e7('0x8d')},'json':!![]};return rp(_0x3d3014)[_0x03e7('0xc')](function(_0x21ef39){var _0x235ada=[];_0x235ada[_0x03e7('0x9b')]({'name':_0x21ef39[_0x03e7('0xab')]['TrueOption'][_0x03e7('0xae')][_0x03e7('0xad')][_0x03e7('0xae')],'value':'true'},{'name':_0x21ef39[_0x03e7('0xab')][_0x03e7('0xb1')][_0x03e7('0xae')][_0x03e7('0xad')][_0x03e7('0xae')],'value':_0x03e7('0xb2')});var _0x26b958={'id':_0x1bda04+'_'+_0x21ef39['LogicalName'],'name':_0x21ef39[_0x03e7('0xb3')][_0x03e7('0xad')][_0x03e7('0xae')],'custom':![],'options':_0x235ada};_0xb3f726[_0x03e7('0x9b')](_0x26b958);return _0xb3f726;});}function getInputList(_0x2b9c0d,_0x418587,_0x11e68b,_0x1dc113,_0x55bdfe,_0xb5cdc8,_0x4c74bb){var _0x4c174e={'method':'GET','uri':_0x2b9c0d+_0x03e7('0xa7')+_0x55bdfe+_0x03e7('0xa8')+_0xb5cdc8+_0x03e7('0xb4')+_0x11e68b+_0x03e7('0xb5'),'headers':{'Authorization':_0x03e7('0x8c')+_0x4c74bb,'If-None-Match':null,'OData-Version':_0x03e7('0x8d')},'json':!![]};return rp(_0x4c174e)['then'](function(_0x214cf9){var _0x319f71={'id':_0x418587+'_'+_0x214cf9[_0x03e7('0x94')],'name':_0x214cf9[_0x03e7('0xb3')][_0x03e7('0xad')]?_0x214cf9[_0x03e7('0xb3')][_0x03e7('0xad')][_0x03e7('0xae')]:_0x214cf9['LogicalName'],'custom':![],'options':[]};_0x1dc113[_0x03e7('0x9b')](_0x319f71);return _0x1dc113;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5325faa..6c783e2 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_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 +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x1f17a0,_0xaa1f0e){var _0x2233ab=function(_0x496c03){while(--_0x496c03){_0x1f17a0['push'](_0x1f17a0['shift']());}};_0x2233ab(++_0xaa1f0e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b1e6800..7ad143c 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 _0x6844=['Dynamics365Account','find','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','raw','options','where','attributes','include','map','model','stringify','ShowDynamics365Account'];(function(_0x483567,_0x5f049c){var _0x493b04=function(_0x30f0b8){while(--_0x30f0b8){_0x483567['push'](_0x483567['shift']());}};_0x493b04(++_0x5f049c);}(_0x6844,0x1d0));var _0x4684=function(_0x560620,_0x308b4d){_0x560620=_0x560620-0x0;var _0x4bc7c0=_0x6844[_0x560620];return _0x4bc7c0;};'use strict';var _=require(_0x4684('0x0'));var util=require('util');var moment=require(_0x4684('0x1'));var BPromise=require(_0x4684('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4684('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4684('0x4'));var logger=require(_0x4684('0x5'))(_0x4684('0x6'));var config=require('../../config/environment');var jayson=require(_0x4684('0x7'));var client=jayson[_0x4684('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289a97,_0x119f89,_0x1fc0ea){return new BPromise(function(_0x2cfe40,_0x443359){return client[_0x4684('0x9')](_0x289a97,_0x1fc0ea)[_0x4684('0xa')](function(_0x69ab2e){logger[_0x4684('0xb')](_0x4684('0xc'),_0x119f89,_0x4684('0xd'));logger[_0x4684('0xe')](_0x4684('0xf'),_0x119f89,'request\x20sent',JSON['stringify'](_0x69ab2e));if(_0x69ab2e[_0x4684('0x10')]){if(_0x69ab2e[_0x4684('0x10')][_0x4684('0x11')]===0x1f4){logger[_0x4684('0x10')](_0x4684('0xc'),_0x119f89,_0x69ab2e['error'][_0x4684('0x12')]);return _0x443359(_0x69ab2e['error']['message']);}logger[_0x4684('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x119f89,_0x69ab2e[_0x4684('0x10')][_0x4684('0x12')]);return _0x2cfe40(_0x69ab2e[_0x4684('0x10')]['message']);}else{logger['info'](_0x4684('0xc'),_0x119f89,_0x4684('0xd'));_0x2cfe40(_0x69ab2e[_0x4684('0x13')][_0x4684('0x12')]);}})[_0x4684('0x14')](function(_0x4e0a46){logger[_0x4684('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x119f89,_0x4e0a46);_0x443359(_0x4e0a46);});});}exports[_0x4684('0x15')]=function(_0x26e587){var _0x512c6a=this;return new Promise(function(_0x20a47f,_0x308a84){return db['Dynamics365Account']['findAll']({'raw':_0x26e587['options']?_0x26e587['options'][_0x4684('0x16')]===undefined?!![]:![]:!![],'where':_0x26e587[_0x4684('0x17')]?_0x26e587['options'][_0x4684('0x18')]||null:null,'attributes':_0x26e587[_0x4684('0x17')]?_0x26e587['options'][_0x4684('0x19')]||null:null,'limit':_0x26e587[_0x4684('0x17')]?_0x26e587[_0x4684('0x17')]['limit']||null:null,'include':_0x26e587[_0x4684('0x17')]?_0x26e587[_0x4684('0x17')][_0x4684('0x1a')]?_['map'](_0x26e587[_0x4684('0x17')][_0x4684('0x1a')],function(_0x42f300){return{'model':db[_0x42f300['model']],'as':_0x42f300['as'],'attributes':_0x42f300[_0x4684('0x19')],'include':_0x42f300[_0x4684('0x1a')]?_[_0x4684('0x1b')](_0x42f300[_0x4684('0x1a')],function(_0x7d9131){return{'model':db[_0x7d9131[_0x4684('0x1c')]],'as':_0x7d9131['as'],'attributes':_0x7d9131['attributes'],'include':_0x7d9131['include']?_[_0x4684('0x1b')](_0x7d9131['include'],function(_0x3002dd){return{'model':db[_0x3002dd[_0x4684('0x1c')]],'as':_0x3002dd['as'],'attributes':_0x3002dd[_0x4684('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4684('0xa')](function(_0x3cf73f){logger[_0x4684('0xb')]('GetDynamics365Account',_0x26e587);logger[_0x4684('0xe')](_0x4684('0x15'),_0x26e587,JSON[_0x4684('0x1d')](_0x3cf73f));_0x20a47f(_0x3cf73f);})[_0x4684('0x14')](function(_0x4d5021){logger[_0x4684('0x10')](_0x4684('0x15'),_0x4d5021[_0x4684('0x12')],_0x26e587);_0x308a84(_0x512c6a[_0x4684('0x10')](0x1f4,_0x4d5021[_0x4684('0x12')]));});});};exports[_0x4684('0x1e')]=function(_0x24f880){var _0x3bd721=this;return new Promise(function(_0x1b57ab,_0x5cd3ae){return db[_0x4684('0x1f')][_0x4684('0x20')]({'raw':_0x24f880['options']?_0x24f880['options']['raw']===undefined?!![]:![]:!![],'where':_0x24f880[_0x4684('0x17')]?_0x24f880['options'][_0x4684('0x18')]||null:null,'attributes':_0x24f880[_0x4684('0x17')]?_0x24f880[_0x4684('0x17')][_0x4684('0x19')]||null:null,'include':_0x24f880[_0x4684('0x17')]?_0x24f880['options']['include']?_[_0x4684('0x1b')](_0x24f880[_0x4684('0x17')]['include'],function(_0x36ced1){return{'model':db[_0x36ced1[_0x4684('0x1c')]],'as':_0x36ced1['as'],'attributes':_0x36ced1[_0x4684('0x19')],'include':_0x36ced1[_0x4684('0x1a')]?_[_0x4684('0x1b')](_0x36ced1[_0x4684('0x1a')],function(_0x330dd7){return{'model':db[_0x330dd7[_0x4684('0x1c')]],'as':_0x330dd7['as'],'attributes':_0x330dd7[_0x4684('0x19')],'include':_0x330dd7['include']?_[_0x4684('0x1b')](_0x330dd7[_0x4684('0x1a')],function(_0xab0eaf){return{'model':db[_0xab0eaf['model']],'as':_0xab0eaf['as'],'attributes':_0xab0eaf[_0x4684('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4684('0xa')](function(_0x5138cc){logger[_0x4684('0xb')](_0x4684('0x1e'),_0x24f880);logger[_0x4684('0xe')]('ShowDynamics365Account',_0x24f880,JSON[_0x4684('0x1d')](_0x5138cc));_0x1b57ab(_0x5138cc);})[_0x4684('0x14')](function(_0x2de25f){logger[_0x4684('0x10')]('ShowDynamics365Account',_0x2de25f[_0x4684('0x12')],_0x24f880);_0x5cd3ae(_0x3bd721[_0x4684('0x10')](0x1f4,_0x2de25f[_0x4684('0x12')]));});});}; \ No newline at end of file +var _0xc025=['http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','map','include','model','ShowDynamics365Account','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31860f,_0x423637){var _0x477a45=function(_0x3597f7){while(--_0x3597f7){_0x31860f['push'](_0x31860f['shift']());}};_0x477a45(++_0x423637);}(_0xc025,0x1be));var _0x5c02=function(_0x264af8,_0x128706){_0x264af8=_0x264af8-0x0;var _0x2c09d1=_0xc025[_0x264af8];return _0x2c09d1;};'use strict';var _=require(_0x5c02('0x0'));var util=require('util');var moment=require(_0x5c02('0x1'));var BPromise=require(_0x5c02('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c02('0x3'));var db=require(_0x5c02('0x4'))['db'];var utils=require(_0x5c02('0x5'));var logger=require(_0x5c02('0x6'))(_0x5c02('0x7'));var config=require(_0x5c02('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x497f4b,_0x593a2d,_0x4a30b7){return new BPromise(function(_0x37f78a,_0x464cdd){return client[_0x5c02('0xa')](_0x497f4b,_0x4a30b7)[_0x5c02('0xb')](function(_0x26e9c7){logger[_0x5c02('0xc')](_0x5c02('0xd'),_0x593a2d,_0x5c02('0xe'));logger[_0x5c02('0xf')](_0x5c02('0x10'),_0x593a2d,_0x5c02('0xe'),JSON[_0x5c02('0x11')](_0x26e9c7));if(_0x26e9c7[_0x5c02('0x12')]){if(_0x26e9c7[_0x5c02('0x12')]['code']===0x1f4){logger[_0x5c02('0x12')](_0x5c02('0xd'),_0x593a2d,_0x26e9c7['error'][_0x5c02('0x13')]);return _0x464cdd(_0x26e9c7['error'][_0x5c02('0x13')]);}logger[_0x5c02('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x593a2d,_0x26e9c7['error']['message']);return _0x37f78a(_0x26e9c7[_0x5c02('0x12')][_0x5c02('0x13')]);}else{logger[_0x5c02('0xc')](_0x5c02('0xd'),_0x593a2d,_0x5c02('0xe'));_0x37f78a(_0x26e9c7[_0x5c02('0x14')]['message']);}})[_0x5c02('0x15')](function(_0x1650d6){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x593a2d,_0x1650d6);_0x464cdd(_0x1650d6);});});}exports[_0x5c02('0x16')]=function(_0x18f22a){var _0x3585da=this;return new Promise(function(_0x2530fc,_0x2b6cdc){return db[_0x5c02('0x17')][_0x5c02('0x18')]({'raw':_0x18f22a[_0x5c02('0x19')]?_0x18f22a[_0x5c02('0x19')][_0x5c02('0x1a')]===undefined?!![]:![]:!![],'where':_0x18f22a[_0x5c02('0x19')]?_0x18f22a['options']['where']||null:null,'attributes':_0x18f22a['options']?_0x18f22a[_0x5c02('0x19')][_0x5c02('0x1b')]||null:null,'limit':_0x18f22a['options']?_0x18f22a[_0x5c02('0x19')][_0x5c02('0x1c')]||null:null,'include':_0x18f22a[_0x5c02('0x19')]?_0x18f22a[_0x5c02('0x19')]['include']?_[_0x5c02('0x1d')](_0x18f22a[_0x5c02('0x19')][_0x5c02('0x1e')],function(_0x1172b6){return{'model':db[_0x1172b6[_0x5c02('0x1f')]],'as':_0x1172b6['as'],'attributes':_0x1172b6[_0x5c02('0x1b')],'include':_0x1172b6[_0x5c02('0x1e')]?_['map'](_0x1172b6['include'],function(_0x5deb33){return{'model':db[_0x5deb33[_0x5c02('0x1f')]],'as':_0x5deb33['as'],'attributes':_0x5deb33[_0x5c02('0x1b')],'include':_0x5deb33[_0x5c02('0x1e')]?_[_0x5c02('0x1d')](_0x5deb33[_0x5c02('0x1e')],function(_0x331bb1){return{'model':db[_0x331bb1[_0x5c02('0x1f')]],'as':_0x331bb1['as'],'attributes':_0x331bb1[_0x5c02('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5c02('0xb')](function(_0x371e3d){logger['info'](_0x5c02('0x16'),_0x18f22a);logger['debug'](_0x5c02('0x16'),_0x18f22a,JSON[_0x5c02('0x11')](_0x371e3d));_0x2530fc(_0x371e3d);})[_0x5c02('0x15')](function(_0x1667c9){logger[_0x5c02('0x12')]('GetDynamics365Account',_0x1667c9[_0x5c02('0x13')],_0x18f22a);_0x2b6cdc(_0x3585da[_0x5c02('0x12')](0x1f4,_0x1667c9[_0x5c02('0x13')]));});});};exports[_0x5c02('0x20')]=function(_0x4d6405){var _0x351616=this;return new Promise(function(_0x3f5bea,_0x350e69){return db[_0x5c02('0x17')][_0x5c02('0x21')]({'raw':_0x4d6405[_0x5c02('0x19')]?_0x4d6405[_0x5c02('0x19')][_0x5c02('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d6405['options']?_0x4d6405['options'][_0x5c02('0x22')]||null:null,'attributes':_0x4d6405[_0x5c02('0x19')]?_0x4d6405[_0x5c02('0x19')][_0x5c02('0x1b')]||null:null,'include':_0x4d6405[_0x5c02('0x19')]?_0x4d6405[_0x5c02('0x19')][_0x5c02('0x1e')]?_[_0x5c02('0x1d')](_0x4d6405[_0x5c02('0x19')]['include'],function(_0xd51df9){return{'model':db[_0xd51df9[_0x5c02('0x1f')]],'as':_0xd51df9['as'],'attributes':_0xd51df9[_0x5c02('0x1b')],'include':_0xd51df9[_0x5c02('0x1e')]?_[_0x5c02('0x1d')](_0xd51df9[_0x5c02('0x1e')],function(_0x4164da){return{'model':db[_0x4164da[_0x5c02('0x1f')]],'as':_0x4164da['as'],'attributes':_0x4164da[_0x5c02('0x1b')],'include':_0x4164da['include']?_[_0x5c02('0x1d')](_0x4164da['include'],function(_0x16d177){return{'model':db[_0x16d177[_0x5c02('0x1f')]],'as':_0x16d177['as'],'attributes':_0x16d177['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c02('0xb')](function(_0x492c0c){logger[_0x5c02('0xc')](_0x5c02('0x20'),_0x4d6405);logger[_0x5c02('0xf')](_0x5c02('0x20'),_0x4d6405,JSON[_0x5c02('0x11')](_0x492c0c));_0x3f5bea(_0x492c0c);})[_0x5c02('0x15')](function(_0x330a79){logger[_0x5c02('0x12')](_0x5c02('0x20'),_0x330a79['message'],_0x4d6405);_0x350e69(_0x351616['error'](0x1f4,_0x330a79[_0x5c02('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 09b6720..c1ba027 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 _0x7833=['/:id/fields','getFields','/:id/subjects','getSubjects','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x555569,_0x15669b){var _0x2541ff=function(_0x5aef2b){while(--_0x5aef2b){_0x555569['push'](_0x555569['shift']());}};_0x2541ff(++_0x15669b);}(_0x7833,0x1d6));var _0x3783=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x7833[_0x5eaa0b];return _0x28b295;};'use strict';var multer=require(_0x3783('0x0'));var util=require(_0x3783('0x1'));var path=require('path');var timeout=require(_0x3783('0x2'));var express=require('express');var router=express[_0x3783('0x3')]();var fs_extra=require(_0x3783('0x4'));var auth=require(_0x3783('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3783('0x6'));var controller=require(_0x3783('0x7'));router[_0x3783('0x8')]('/',auth[_0x3783('0x9')](),controller[_0x3783('0xa')]);router[_0x3783('0x8')](_0x3783('0xb'),auth[_0x3783('0x9')](),controller[_0x3783('0xc')]);router[_0x3783('0x8')](_0x3783('0xd'),auth[_0x3783('0x9')](),controller[_0x3783('0xe')]);router[_0x3783('0x8')](_0x3783('0xf'),auth[_0x3783('0x9')](),controller[_0x3783('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3783('0x11')]('/',auth['isAuthenticated'](),controller[_0x3783('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3783('0x13')]);router[_0x3783('0x14')](_0x3783('0xb'),auth['isAuthenticated'](),controller[_0x3783('0x15')]);module[_0x3783('0x16')]=router; \ No newline at end of file +var _0x225b=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x225b,0xb1));var _0xb225=function(_0x3d527b,_0x55f782){_0x3d527b=_0x3d527b-0x0;var _0x2224b3=_0x225b[_0x3d527b];return _0x2224b3;};'use strict';var multer=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var path=require('path');var timeout=require(_0xb225('0x2'));var express=require(_0xb225('0x3'));var router=express['Router']();var fs_extra=require(_0xb225('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb225('0x5'));var config=require('../../config/environment');var controller=require(_0xb225('0x6'));router[_0xb225('0x7')]('/',auth[_0xb225('0x8')](),controller[_0xb225('0x9')]);router[_0xb225('0x7')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller['show']);router[_0xb225('0x7')](_0xb225('0xb'),auth[_0xb225('0x8')](),controller[_0xb225('0xc')]);router['get'](_0xb225('0xd'),auth[_0xb225('0x8')](),controller[_0xb225('0xe')]);router['get'](_0xb225('0xf'),auth[_0xb225('0x8')](),controller[_0xb225('0x10')]);router[_0xb225('0x11')]('/',auth[_0xb225('0x8')](),controller['create']);router[_0xb225('0x12')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller[_0xb225('0x13')]);router[_0xb225('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb225('0x15')]);module[_0xb225('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 cf8ceec..0a27a3a 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 _0xb6c4=['exports','STRING','incident','ENUM','contact','BOOLEAN','sequelize'];(function(_0x5151b1,_0x2fb2af){var _0x3805e5=function(_0x556fde){while(--_0x556fde){_0x5151b1['push'](_0x5151b1['shift']());}};_0x3805e5(++_0x2fb2af);}(_0xb6c4,0xed));var _0x4b6c=function(_0x2459e8,_0x4924e7){_0x2459e8=_0x2459e8-0x0;var _0x2888d9=_0xb6c4[_0x2459e8];return _0x2888d9;};'use strict';var Sequelize=require(_0x4b6c('0x0'));module[_0x4b6c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b6c('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident','phonecall'),'defaultValue':_0x4b6c('0x3')},'moduleCreate':{'type':Sequelize[_0x4b6c('0x4')]('contact','nothing'),'defaultValue':_0x4b6c('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x4b6c('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x4b6c('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1723=['sequelize','exports','STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN'];(function(_0x498843,_0x48ce6f){var _0xf0c0b5=function(_0x18ed0a){while(--_0x18ed0a){_0x498843['push'](_0x498843['shift']());}};_0xf0c0b5(++_0x48ce6f);}(_0x1723,0xf3));var _0x3172=function(_0xa90dde,_0x54deef){_0xa90dde=_0xa90dde-0x0;var _0x2863b0=_0x1723[_0xa90dde];return _0x2863b0;};'use strict';var Sequelize=require(_0x3172('0x0'));module[_0x3172('0x1')]={'name':{'type':Sequelize[_0x3172('0x2')]},'description':{'type':Sequelize[_0x3172('0x2')]},'ticketType':{'type':Sequelize[_0x3172('0x3')](_0x3172('0x4'),_0x3172('0x5')),'defaultValue':_0x3172('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x3172('0x6'),_0x3172('0x7')),'defaultValue':_0x3172('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x3172('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3172('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index f89291b..5c54687 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 _0x1c25=['count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','Dynamics365Configuration','findAll','rows','rawAttributes','length','includeAll','find','create','catch','body','params','findOne','Dynamics365Field','nolimit','getFields','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c25,0xcd));var _0x51c2=function(_0x856ada,_0x1864e4){_0x856ada=_0x856ada-0x0;var _0x228cc2=_0x1c25[_0x856ada];return _0x228cc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51c2('0x0'));var zipdir=require(_0x51c2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51c2('0x2'));var moment=require('moment');var BPromise=require(_0x51c2('0x3'));var Mustache=require(_0x51c2('0x4'));var util=require(_0x51c2('0x5'));var path=require(_0x51c2('0x6'));var sox=require(_0x51c2('0x7'));var csv=require(_0x51c2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51c2('0x9'));var _=require(_0x51c2('0xa'));var squel=require(_0x51c2('0xb'));var crypto=require(_0x51c2('0xc'));var jsforce=require(_0x51c2('0xd'));var deskjs=require(_0x51c2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x51c2('0xf'));var Papa=require('papaparse');var Redis=require(_0x51c2('0x10'));var authService=require(_0x51c2('0x11'));var qs=require(_0x51c2('0x12'));var as=require(_0x51c2('0x13'));var hardwareService=require(_0x51c2('0x14'));var logger=require('../../config/logger')(_0x51c2('0x15'));var utils=require(_0x51c2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b4745,_0x234d41){_0x234d41=_0x234d41||0xcc;return function(_0x42d04a){if(_0x42d04a){return _0x3b4745[_0x51c2('0x17')](_0x234d41);}return _0x3b4745['status'](_0x234d41)['end']();};}function respondWithResult(_0x62c34c,_0x1c7dc3){_0x1c7dc3=_0x1c7dc3||0xc8;return function(_0x23499c){if(_0x23499c){return _0x62c34c[_0x51c2('0x18')](_0x1c7dc3)[_0x51c2('0x19')](_0x23499c);}};}function respondWithFilteredResult(_0x442884,_0x587b40){return function(_0x46c6f4){if(_0x46c6f4){var _0x58ac57=typeof _0x587b40[_0x51c2('0x1a')]==='undefined'&&typeof _0x587b40[_0x51c2('0x1b')]===_0x51c2('0x1c');var _0x45125c=_0x46c6f4[_0x51c2('0x1d')];var _0x10e996=_0x58ac57?0x0:_0x587b40['offset'];var _0x486e0d=_0x58ac57?_0x46c6f4[_0x51c2('0x1d')]:_0x587b40[_0x51c2('0x1a')]+_0x587b40['limit'];var _0x892009;if(_0x486e0d>=_0x45125c){_0x486e0d=_0x45125c;_0x892009=0xc8;}else{_0x892009=0xce;}_0x442884[_0x51c2('0x18')](_0x892009);return _0x442884[_0x51c2('0x1e')](_0x51c2('0x1f'),_0x10e996+'-'+_0x486e0d+'/'+_0x45125c)[_0x51c2('0x19')](_0x46c6f4);}return null;};}function patchUpdates(_0x1386b2){return function(_0x2b2383){try{jsonpatch[_0x51c2('0x20')](_0x2b2383,_0x1386b2,!![]);}catch(_0x3644cb){return BPromise[_0x51c2('0x21')](_0x3644cb);}return _0x2b2383[_0x51c2('0x22')]();};}function saveUpdates(_0x1e7026,_0x1ae272){return function(_0x3ce085){if(_0x3ce085){return _0x3ce085[_0x51c2('0x23')](_0x1e7026)[_0x51c2('0x24')](function(_0x5eeb49){return _0x5eeb49;});}return null;};}function removeEntity(_0x366be3,_0x34c721){return function(_0x6573f8){if(_0x6573f8){return _0x6573f8[_0x51c2('0x25')]()[_0x51c2('0x24')](function(){_0x366be3[_0x51c2('0x18')](0xcc)[_0x51c2('0x26')]();});}};}function handleEntityNotFound(_0x430194,_0x57dd3d){return function(_0x1dbd35){if(!_0x1dbd35){_0x430194[_0x51c2('0x17')](0x194);}return _0x1dbd35;};}function handleError(_0x4c8389,_0x12c9f6){_0x12c9f6=_0x12c9f6||0x1f4;return function(_0x2be973){logger[_0x51c2('0x27')](_0x2be973[_0x51c2('0x28')]);if(_0x2be973['name']){delete _0x2be973[_0x51c2('0x29')];}_0x4c8389[_0x51c2('0x18')](_0x12c9f6)['send'](_0x2be973);};}exports[_0x51c2('0x2a')]=function(_0x3e1907,_0x100b79){var _0x338666={},_0x3f6e11={},_0x5b9ccd={'count':0x0,'rows':[]};var _0x36b804=_[_0x51c2('0x2b')](db['Dynamics365Configuration']['rawAttributes'],function(_0x4c1550){return{'name':_0x4c1550[_0x51c2('0x2c')],'type':_0x4c1550[_0x51c2('0x2d')]['key']};});_0x3f6e11['model']=_[_0x51c2('0x2b')](_0x36b804,_0x51c2('0x29'));_0x3f6e11[_0x51c2('0x2e')]=_[_0x51c2('0x2f')](_0x3e1907[_0x51c2('0x2e')]);_0x3f6e11[_0x51c2('0x30')]=_[_0x51c2('0x31')](_0x3f6e11[_0x51c2('0x32')],_0x3f6e11[_0x51c2('0x2e')]);_0x338666['attributes']=_[_0x51c2('0x31')](_0x3f6e11[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x3e1907['query'][_0x51c2('0x33')]));_0x338666['attributes']=_0x338666[_0x51c2('0x34')]['length']?_0x338666['attributes']:_0x3f6e11[_0x51c2('0x32')];if(!_0x3e1907['query'][_0x51c2('0x35')]('nolimit')){_0x338666[_0x51c2('0x1b')]=qs['limit'](_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x1b')]);_0x338666['offset']=qs[_0x51c2('0x1a')](_0x3e1907[_0x51c2('0x2e')]['offset']);}_0x338666[_0x51c2('0x36')]=qs['sort'](_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x37')]);_0x338666[_0x51c2('0x38')]=qs['filters'](_[_0x51c2('0x39')](_0x3e1907[_0x51c2('0x2e')],_0x3f6e11[_0x51c2('0x30')]),_0x36b804);if(_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x3a')]){_0x338666[_0x51c2('0x38')]=_[_0x51c2('0x3b')](_0x338666[_0x51c2('0x38')],{'$or':_['map'](_0x36b804,function(_0x3f25e4){if(_0x3f25e4[_0x51c2('0x2d')]!=='VIRTUAL'){var _0x3c1338={};_0x3c1338[_0x3f25e4[_0x51c2('0x29')]]={'$like':'%'+_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x3a')]+'%'};return _0x3c1338;}})});}_0x338666=_[_0x51c2('0x3b')]({},_0x338666,_0x3e1907[_0x51c2('0x3c')]);var _0x1305c5={'where':_0x338666['where']};return db[_0x51c2('0x3d')][_0x51c2('0x1d')](_0x1305c5)[_0x51c2('0x24')](function(_0xd06596){_0x5b9ccd['count']=_0xd06596;if(_0x3e1907['query']['includeAll']){_0x338666['include']=[{'all':!![]}];}return db[_0x51c2('0x3d')][_0x51c2('0x3e')](_0x338666);})[_0x51c2('0x24')](function(_0x3be559){_0x5b9ccd[_0x51c2('0x3f')]=_0x3be559;return _0x5b9ccd;})[_0x51c2('0x24')](respondWithFilteredResult(_0x100b79,_0x338666))['catch'](handleError(_0x100b79,null));};exports['show']=function(_0x3943d7,_0x55e489){var _0x320c11={'raw':![],'where':{'id':_0x3943d7['params']['id']}},_0x1c7cc1={};_0x1c7cc1['model']=_['keys'](db[_0x51c2('0x3d')][_0x51c2('0x40')]);_0x1c7cc1[_0x51c2('0x2e')]=_['keys'](_0x3943d7[_0x51c2('0x2e')]);_0x1c7cc1[_0x51c2('0x30')]=_[_0x51c2('0x31')](_0x1c7cc1['model'],_0x1c7cc1[_0x51c2('0x2e')]);_0x320c11[_0x51c2('0x34')]=_[_0x51c2('0x31')](_0x1c7cc1[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x3943d7[_0x51c2('0x2e')][_0x51c2('0x33')]));_0x320c11[_0x51c2('0x34')]=_0x320c11[_0x51c2('0x34')][_0x51c2('0x41')]?_0x320c11[_0x51c2('0x34')]:_0x1c7cc1[_0x51c2('0x32')];if(_0x3943d7['query'][_0x51c2('0x42')]){_0x320c11['include']=[{'all':!![]}];}_0x320c11=_[_0x51c2('0x3b')]({},_0x320c11,_0x3943d7[_0x51c2('0x3c')]);return db[_0x51c2('0x3d')][_0x51c2('0x43')](_0x320c11)['then'](handleEntityNotFound(_0x55e489,null))[_0x51c2('0x24')](respondWithResult(_0x55e489,null))['catch'](handleError(_0x55e489,null));};exports[_0x51c2('0x44')]=function(_0x52fb05,_0x3a4c4a){return db['Dynamics365Configuration'][_0x51c2('0x44')](_0x52fb05['body'],{})[_0x51c2('0x24')](respondWithResult(_0x3a4c4a,0xc9))[_0x51c2('0x45')](handleError(_0x3a4c4a,null));};exports['update']=function(_0x396612,_0x21d6b2){if(_0x396612['body']['id']){delete _0x396612[_0x51c2('0x46')]['id'];}return db[_0x51c2('0x3d')][_0x51c2('0x43')]({'where':{'id':_0x396612[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x21d6b2,null))[_0x51c2('0x24')](saveUpdates(_0x396612[_0x51c2('0x46')],null))[_0x51c2('0x24')](respondWithResult(_0x21d6b2,null))['catch'](handleError(_0x21d6b2,null));};exports[_0x51c2('0x25')]=function(_0xc705db,_0x1a2b0b){return db[_0x51c2('0x3d')][_0x51c2('0x43')]({'where':{'id':_0xc705db[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x1a2b0b,null))[_0x51c2('0x24')](removeEntity(_0x1a2b0b,null))['catch'](handleError(_0x1a2b0b,null));};exports['getFields']=function(_0x252c44,_0x47e914,_0x217625){var _0x300ea9={};var _0x252f88={};var _0x8efc1d;var _0x2ad2f1;return db[_0x51c2('0x3d')][_0x51c2('0x48')]({'where':{'id':_0x252c44[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x47e914,null))[_0x51c2('0x24')](function(_0x22aebe){if(_0x22aebe){_0x8efc1d=_0x22aebe;_0x252f88[_0x51c2('0x32')]=_[_0x51c2('0x2f')](db[_0x51c2('0x49')]['rawAttributes']);_0x252f88[_0x51c2('0x2e')]=_['keys'](_0x252c44['query']);_0x252f88[_0x51c2('0x30')]=_[_0x51c2('0x31')](_0x252f88[_0x51c2('0x32')],_0x252f88[_0x51c2('0x2e')]);_0x300ea9[_0x51c2('0x34')]=_[_0x51c2('0x31')](_0x252f88[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x252c44['query']['fields']));_0x300ea9[_0x51c2('0x34')]=_0x300ea9[_0x51c2('0x34')]['length']?_0x300ea9[_0x51c2('0x34')]:_0x252f88[_0x51c2('0x32')];_0x300ea9[_0x51c2('0x36')]=qs[_0x51c2('0x37')](_0x252c44['query']['sort']);_0x300ea9[_0x51c2('0x38')]=qs['filters'](_[_0x51c2('0x39')](_0x252c44[_0x51c2('0x2e')],_0x252f88['filters']));if(_0x252c44[_0x51c2('0x2e')][_0x51c2('0x3a')]){_0x300ea9[_0x51c2('0x38')]=_[_0x51c2('0x3b')](_0x300ea9[_0x51c2('0x38')],{'$or':_[_0x51c2('0x2b')](_0x300ea9['attributes'],function(_0x47b4af){var _0x22d146={};_0x22d146[_0x47b4af]={'$like':'%'+_0x252c44[_0x51c2('0x2e')]['filter']+'%'};return _0x22d146;})});}_0x300ea9=_[_0x51c2('0x3b')]({},_0x300ea9,_0x252c44['options']);return _0x8efc1d['getFields'](_0x300ea9);}})[_0x51c2('0x24')](function(_0x3ba5b6){if(_0x3ba5b6){_0x2ad2f1=_0x3ba5b6[_0x51c2('0x41')];if(!_0x252c44['query'][_0x51c2('0x35')](_0x51c2('0x4a'))){_0x300ea9[_0x51c2('0x1b')]=qs[_0x51c2('0x1b')](_0x252c44['query']['limit']);_0x300ea9[_0x51c2('0x1a')]=qs[_0x51c2('0x1a')](_0x252c44[_0x51c2('0x2e')][_0x51c2('0x1a')]);}return _0x8efc1d[_0x51c2('0x4b')](_0x300ea9);}})[_0x51c2('0x24')](function(_0x8e18c2){if(_0x8e18c2){return _0x8e18c2?{'count':_0x2ad2f1,'rows':_0x8e18c2}:null;}})[_0x51c2('0x24')](respondWithResult(_0x47e914,null))['catch'](handleError(_0x47e914,null));};exports[_0x51c2('0x4c')]=function(_0x2841e9,_0x270acd,_0x1e0ef4){var _0x226641={};var _0x30433b={};var _0x106918;var _0xc2c106;return db[_0x51c2('0x3d')][_0x51c2('0x48')]({'where':{'id':_0x2841e9[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x270acd,null))[_0x51c2('0x24')](function(_0x56066a){if(_0x56066a){_0x106918=_0x56066a;_0x30433b[_0x51c2('0x32')]=_[_0x51c2('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x30433b[_0x51c2('0x2e')]=_[_0x51c2('0x2f')](_0x2841e9[_0x51c2('0x2e')]);_0x30433b['filters']=_[_0x51c2('0x31')](_0x30433b['model'],_0x30433b[_0x51c2('0x2e')]);_0x226641[_0x51c2('0x34')]=_[_0x51c2('0x31')](_0x30433b['model'],qs[_0x51c2('0x33')](_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x33')]));_0x226641['attributes']=_0x226641[_0x51c2('0x34')][_0x51c2('0x41')]?_0x226641[_0x51c2('0x34')]:_0x30433b[_0x51c2('0x32')];_0x226641[_0x51c2('0x36')]=qs[_0x51c2('0x37')](_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x37')]);_0x226641[_0x51c2('0x38')]=qs['filters'](_[_0x51c2('0x39')](_0x2841e9['query'],_0x30433b['filters']));if(_0x2841e9[_0x51c2('0x2e')]['filter']){_0x226641[_0x51c2('0x38')]=_['merge'](_0x226641[_0x51c2('0x38')],{'$or':_[_0x51c2('0x2b')](_0x226641[_0x51c2('0x34')],function(_0x5b990){var _0x44d200={};_0x44d200[_0x5b990]={'$like':'%'+_0x2841e9['query'][_0x51c2('0x3a')]+'%'};return _0x44d200;})});}_0x226641=_[_0x51c2('0x3b')]({},_0x226641,_0x2841e9[_0x51c2('0x3c')]);return _0x106918[_0x51c2('0x4c')](_0x226641);}})[_0x51c2('0x24')](function(_0x1a1a11){if(_0x1a1a11){_0xc2c106=_0x1a1a11[_0x51c2('0x41')];if(!_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x35')](_0x51c2('0x4a'))){_0x226641[_0x51c2('0x1b')]=qs[_0x51c2('0x1b')](_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x1b')]);_0x226641['offset']=qs[_0x51c2('0x1a')](_0x2841e9[_0x51c2('0x2e')]['offset']);}return _0x106918[_0x51c2('0x4c')](_0x226641);}})[_0x51c2('0x24')](function(_0x184caa){if(_0x184caa){return _0x184caa?{'count':_0xc2c106,'rows':_0x184caa}:null;}})[_0x51c2('0x24')](respondWithResult(_0x270acd,null))[_0x51c2('0x45')](handleError(_0x270acd,null));};exports[_0x51c2('0x4d')]=function(_0x243bef,_0x43db23,_0x5e7de4){var _0x5c28dc={};var _0x55f6cb={};var _0x5a65ac;var _0x2c74e1;return db[_0x51c2('0x3d')][_0x51c2('0x48')]({'where':{'id':_0x243bef[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x43db23,null))[_0x51c2('0x24')](function(_0x404cce){if(_0x404cce){_0x5a65ac=_0x404cce;_0x55f6cb[_0x51c2('0x32')]=_[_0x51c2('0x2f')](db[_0x51c2('0x49')][_0x51c2('0x40')]);_0x55f6cb[_0x51c2('0x2e')]=_[_0x51c2('0x2f')](_0x243bef[_0x51c2('0x2e')]);_0x55f6cb[_0x51c2('0x30')]=_['intersection'](_0x55f6cb[_0x51c2('0x32')],_0x55f6cb[_0x51c2('0x2e')]);_0x5c28dc[_0x51c2('0x34')]=_['intersection'](_0x55f6cb[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x243bef['query'][_0x51c2('0x33')]));_0x5c28dc[_0x51c2('0x34')]=_0x5c28dc[_0x51c2('0x34')][_0x51c2('0x41')]?_0x5c28dc[_0x51c2('0x34')]:_0x55f6cb['model'];_0x5c28dc[_0x51c2('0x36')]=qs['sort'](_0x243bef[_0x51c2('0x2e')][_0x51c2('0x37')]);_0x5c28dc[_0x51c2('0x38')]=qs[_0x51c2('0x30')](_['pick'](_0x243bef[_0x51c2('0x2e')],_0x55f6cb[_0x51c2('0x30')]));if(_0x243bef['query']['filter']){_0x5c28dc['where']=_[_0x51c2('0x3b')](_0x5c28dc['where'],{'$or':_[_0x51c2('0x2b')](_0x5c28dc['attributes'],function(_0x317775){var _0x568731={};_0x568731[_0x317775]={'$like':'%'+_0x243bef[_0x51c2('0x2e')][_0x51c2('0x3a')]+'%'};return _0x568731;})});}_0x5c28dc=_['merge']({},_0x5c28dc,_0x243bef[_0x51c2('0x3c')]);return _0x5a65ac[_0x51c2('0x4d')](_0x5c28dc);}})['then'](function(_0x239da6){if(_0x239da6){_0x2c74e1=_0x239da6['length'];if(!_0x243bef['query'][_0x51c2('0x35')](_0x51c2('0x4a'))){_0x5c28dc[_0x51c2('0x1b')]=qs[_0x51c2('0x1b')](_0x243bef[_0x51c2('0x2e')][_0x51c2('0x1b')]);_0x5c28dc[_0x51c2('0x1a')]=qs[_0x51c2('0x1a')](_0x243bef['query'][_0x51c2('0x1a')]);}return _0x5a65ac['getDescriptions'](_0x5c28dc);}})[_0x51c2('0x24')](function(_0x10725b){if(_0x10725b){return _0x10725b?{'count':_0x2c74e1,'rows':_0x10725b}:null;}})[_0x51c2('0x24')](respondWithResult(_0x43db23,null))[_0x51c2('0x45')](handleError(_0x43db23,null));}; \ No newline at end of file +var _0x0f08=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','update','body','params','destroy','getFields','findOne','Dynamics365Field','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','json','apply','then','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x25292e,_0x44f47f){var _0x48de57=function(_0x5c199d){while(--_0x5c199d){_0x25292e['push'](_0x25292e['shift']());}};_0x48de57(++_0x44f47f);}(_0x0f08,0x19c));var _0x80f0=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x0f08[_0x54edc9];return _0x2ae7a9;};'use strict';var emlformat=require(_0x80f0('0x0'));var rimraf=require(_0x80f0('0x1'));var zipdir=require(_0x80f0('0x2'));var jsonpatch=require(_0x80f0('0x3'));var rp=require(_0x80f0('0x4'));var moment=require(_0x80f0('0x5'));var BPromise=require(_0x80f0('0x6'));var Mustache=require(_0x80f0('0x7'));var util=require(_0x80f0('0x8'));var path=require(_0x80f0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x80f0('0xa'));var fs=require('fs');var fs_extra=require(_0x80f0('0xb'));var _=require(_0x80f0('0xc'));var squel=require('squel');var crypto=require(_0x80f0('0xd'));var jsforce=require(_0x80f0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x80f0('0xf'));var querystring=require(_0x80f0('0x10'));var Papa=require('papaparse');var Redis=require(_0x80f0('0x11'));var authService=require(_0x80f0('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80f0('0x13'));var logger=require(_0x80f0('0x14'))(_0x80f0('0x15'));var utils=require(_0x80f0('0x16'));var config=require(_0x80f0('0x17'));var licenseUtil=require(_0x80f0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd8de,_0x5052c4){_0x5052c4=_0x5052c4||0xcc;return function(_0x5ba0bb){if(_0x5ba0bb){return _0x3cd8de['sendStatus'](_0x5052c4);}return _0x3cd8de['status'](_0x5052c4)['end']();};}function respondWithResult(_0x1cfdd9,_0x1f2ced){_0x1f2ced=_0x1f2ced||0xc8;return function(_0x882b32){if(_0x882b32){return _0x1cfdd9[_0x80f0('0x19')](_0x1f2ced)['json'](_0x882b32);}};}function respondWithFilteredResult(_0x12f6cb,_0xe100c6){return function(_0x4f12e4){if(_0x4f12e4){var _0xb5048a=typeof _0xe100c6[_0x80f0('0x1a')]===_0x80f0('0x1b')&&typeof _0xe100c6[_0x80f0('0x1c')]==='undefined';var _0x2b8b7d=_0x4f12e4[_0x80f0('0x1d')];var _0x46a4f0=_0xb5048a?0x0:_0xe100c6['offset'];var _0x2d66e2=_0xb5048a?_0x4f12e4[_0x80f0('0x1d')]:_0xe100c6[_0x80f0('0x1a')]+_0xe100c6[_0x80f0('0x1c')];var _0x1cd461;if(_0x2d66e2>=_0x2b8b7d){_0x2d66e2=_0x2b8b7d;_0x1cd461=0xc8;}else{_0x1cd461=0xce;}_0x12f6cb[_0x80f0('0x19')](_0x1cd461);return _0x12f6cb[_0x80f0('0x1e')]('Content-Range',_0x46a4f0+'-'+_0x2d66e2+'/'+_0x2b8b7d)[_0x80f0('0x1f')](_0x4f12e4);}return null;};}function patchUpdates(_0x18f3e4){return function(_0x248a1a){try{jsonpatch[_0x80f0('0x20')](_0x248a1a,_0x18f3e4,!![]);}catch(_0x586422){return BPromise['reject'](_0x586422);}return _0x248a1a['save']();};}function saveUpdates(_0x26cdac,_0x5526e9){return function(_0x16284e){if(_0x16284e){return _0x16284e['update'](_0x26cdac)[_0x80f0('0x21')](function(_0x1a4661){return _0x1a4661;});}return null;};}function removeEntity(_0xceb4e5,_0x1fca19){return function(_0xf8eba){if(_0xf8eba){return _0xf8eba['destroy']()['then'](function(){_0xceb4e5[_0x80f0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefa4d1,_0x156677){return function(_0x2150f4){if(!_0x2150f4){_0xefa4d1['sendStatus'](0x194);}return _0x2150f4;};}function handleError(_0x3cb6a6,_0x19f475){_0x19f475=_0x19f475||0x1f4;return function(_0x25af46){logger[_0x80f0('0x22')](_0x25af46[_0x80f0('0x23')]);if(_0x25af46[_0x80f0('0x24')]){delete _0x25af46[_0x80f0('0x24')];}_0x3cb6a6['status'](_0x19f475)[_0x80f0('0x25')](_0x25af46);};}exports[_0x80f0('0x26')]=function(_0x5c106a,_0x7895b4){var _0x3c5126={},_0x4caec4={},_0x28fc2e={'count':0x0,'rows':[]};var _0x22c66b=_[_0x80f0('0x27')](db[_0x80f0('0x28')]['rawAttributes'],function(_0x3684ad){return{'name':_0x3684ad[_0x80f0('0x29')],'type':_0x3684ad[_0x80f0('0x2a')][_0x80f0('0x2b')]};});_0x4caec4[_0x80f0('0x2c')]=_[_0x80f0('0x27')](_0x22c66b,'name');_0x4caec4[_0x80f0('0x2d')]=_[_0x80f0('0x2e')](_0x5c106a[_0x80f0('0x2d')]);_0x4caec4[_0x80f0('0x2f')]=_[_0x80f0('0x30')](_0x4caec4[_0x80f0('0x2c')],_0x4caec4[_0x80f0('0x2d')]);_0x3c5126[_0x80f0('0x31')]=_['intersection'](_0x4caec4[_0x80f0('0x2c')],qs[_0x80f0('0x32')](_0x5c106a[_0x80f0('0x2d')]['fields']));_0x3c5126[_0x80f0('0x31')]=_0x3c5126[_0x80f0('0x31')][_0x80f0('0x33')]?_0x3c5126[_0x80f0('0x31')]:_0x4caec4[_0x80f0('0x2c')];if(!_0x5c106a[_0x80f0('0x2d')][_0x80f0('0x34')](_0x80f0('0x35'))){_0x3c5126['limit']=qs[_0x80f0('0x1c')](_0x5c106a['query'][_0x80f0('0x1c')]);_0x3c5126[_0x80f0('0x1a')]=qs[_0x80f0('0x1a')](_0x5c106a[_0x80f0('0x2d')][_0x80f0('0x1a')]);}_0x3c5126[_0x80f0('0x36')]=qs[_0x80f0('0x37')](_0x5c106a[_0x80f0('0x2d')][_0x80f0('0x37')]);_0x3c5126[_0x80f0('0x38')]=qs[_0x80f0('0x2f')](_[_0x80f0('0x39')](_0x5c106a[_0x80f0('0x2d')],_0x4caec4[_0x80f0('0x2f')]),_0x22c66b);if(_0x5c106a['query'][_0x80f0('0x3a')]){_0x3c5126[_0x80f0('0x38')]=_[_0x80f0('0x3b')](_0x3c5126[_0x80f0('0x38')],{'$or':_['map'](_0x22c66b,function(_0x139d27){if(_0x139d27[_0x80f0('0x2a')]!==_0x80f0('0x3c')){var _0x1dd35c={};_0x1dd35c[_0x139d27[_0x80f0('0x24')]]={'$like':'%'+_0x5c106a['query'][_0x80f0('0x3a')]+'%'};return _0x1dd35c;}})});}_0x3c5126=_[_0x80f0('0x3b')]({},_0x3c5126,_0x5c106a[_0x80f0('0x3d')]);var _0x5b4f02={'where':_0x3c5126[_0x80f0('0x38')]};return db[_0x80f0('0x28')][_0x80f0('0x1d')](_0x5b4f02)[_0x80f0('0x21')](function(_0x56a58c){_0x28fc2e[_0x80f0('0x1d')]=_0x56a58c;if(_0x5c106a['query']['includeAll']){_0x3c5126[_0x80f0('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x80f0('0x3f')](_0x3c5126);})['then'](function(_0x9d0a9c){_0x28fc2e[_0x80f0('0x40')]=_0x9d0a9c;return _0x28fc2e;})[_0x80f0('0x21')](respondWithFilteredResult(_0x7895b4,_0x3c5126))[_0x80f0('0x41')](handleError(_0x7895b4,null));};exports[_0x80f0('0x42')]=function(_0x224a39,_0x511e57){var _0x52f7c7={'raw':![],'where':{'id':_0x224a39['params']['id']}},_0x256603={};_0x256603[_0x80f0('0x2c')]=_[_0x80f0('0x2e')](db[_0x80f0('0x28')][_0x80f0('0x43')]);_0x256603[_0x80f0('0x2d')]=_[_0x80f0('0x2e')](_0x224a39['query']);_0x256603[_0x80f0('0x2f')]=_[_0x80f0('0x30')](_0x256603[_0x80f0('0x2c')],_0x256603[_0x80f0('0x2d')]);_0x52f7c7[_0x80f0('0x31')]=_[_0x80f0('0x30')](_0x256603[_0x80f0('0x2c')],qs['fields'](_0x224a39['query'][_0x80f0('0x32')]));_0x52f7c7[_0x80f0('0x31')]=_0x52f7c7[_0x80f0('0x31')][_0x80f0('0x33')]?_0x52f7c7['attributes']:_0x256603[_0x80f0('0x2c')];if(_0x224a39[_0x80f0('0x2d')]['includeAll']){_0x52f7c7[_0x80f0('0x3e')]=[{'all':!![]}];}_0x52f7c7=_[_0x80f0('0x3b')]({},_0x52f7c7,_0x224a39[_0x80f0('0x3d')]);return db[_0x80f0('0x28')][_0x80f0('0x44')](_0x52f7c7)[_0x80f0('0x21')](handleEntityNotFound(_0x511e57,null))[_0x80f0('0x21')](respondWithResult(_0x511e57,null))[_0x80f0('0x41')](handleError(_0x511e57,null));};exports[_0x80f0('0x45')]=function(_0x10c17f,_0x45e4fb){return db[_0x80f0('0x28')][_0x80f0('0x45')](_0x10c17f['body'],{})['then'](respondWithResult(_0x45e4fb,0xc9))[_0x80f0('0x41')](handleError(_0x45e4fb,null));};exports[_0x80f0('0x46')]=function(_0x3ebc0c,_0x4b5375){if(_0x3ebc0c[_0x80f0('0x47')]['id']){delete _0x3ebc0c['body']['id'];}return db[_0x80f0('0x28')][_0x80f0('0x44')]({'where':{'id':_0x3ebc0c[_0x80f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b5375,null))[_0x80f0('0x21')](saveUpdates(_0x3ebc0c[_0x80f0('0x47')],null))['then'](respondWithResult(_0x4b5375,null))['catch'](handleError(_0x4b5375,null));};exports[_0x80f0('0x49')]=function(_0x463e39,_0x4213c6){return db[_0x80f0('0x28')][_0x80f0('0x44')]({'where':{'id':_0x463e39['params']['id']}})[_0x80f0('0x21')](handleEntityNotFound(_0x4213c6,null))[_0x80f0('0x21')](removeEntity(_0x4213c6,null))[_0x80f0('0x41')](handleError(_0x4213c6,null));};exports[_0x80f0('0x4a')]=function(_0x3d0c37,_0x48accf,_0xc7da5d){var _0x3fa1f1={};var _0xf30235={};var _0x4b1fe5;var _0x522304;return db[_0x80f0('0x28')][_0x80f0('0x4b')]({'where':{'id':_0x3d0c37[_0x80f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x48accf,null))['then'](function(_0x1fa078){if(_0x1fa078){_0x4b1fe5=_0x1fa078;_0xf30235[_0x80f0('0x2c')]=_[_0x80f0('0x2e')](db[_0x80f0('0x4c')][_0x80f0('0x43')]);_0xf30235[_0x80f0('0x2d')]=_[_0x80f0('0x2e')](_0x3d0c37[_0x80f0('0x2d')]);_0xf30235['filters']=_[_0x80f0('0x30')](_0xf30235[_0x80f0('0x2c')],_0xf30235[_0x80f0('0x2d')]);_0x3fa1f1[_0x80f0('0x31')]=_[_0x80f0('0x30')](_0xf30235['model'],qs['fields'](_0x3d0c37['query'][_0x80f0('0x32')]));_0x3fa1f1[_0x80f0('0x31')]=_0x3fa1f1[_0x80f0('0x31')]['length']?_0x3fa1f1['attributes']:_0xf30235[_0x80f0('0x2c')];_0x3fa1f1['order']=qs[_0x80f0('0x37')](_0x3d0c37['query'][_0x80f0('0x37')]);_0x3fa1f1['where']=qs[_0x80f0('0x2f')](_['pick'](_0x3d0c37[_0x80f0('0x2d')],_0xf30235[_0x80f0('0x2f')]));if(_0x3d0c37[_0x80f0('0x2d')][_0x80f0('0x3a')]){_0x3fa1f1[_0x80f0('0x38')]=_[_0x80f0('0x3b')](_0x3fa1f1[_0x80f0('0x38')],{'$or':_['map'](_0x3fa1f1['attributes'],function(_0x431bb7){var _0x1701d2={};_0x1701d2[_0x431bb7]={'$like':'%'+_0x3d0c37[_0x80f0('0x2d')][_0x80f0('0x3a')]+'%'};return _0x1701d2;})});}_0x3fa1f1=_[_0x80f0('0x3b')]({},_0x3fa1f1,_0x3d0c37[_0x80f0('0x3d')]);return _0x4b1fe5[_0x80f0('0x4a')](_0x3fa1f1);}})['then'](function(_0x35efbe){if(_0x35efbe){_0x522304=_0x35efbe[_0x80f0('0x33')];if(!_0x3d0c37[_0x80f0('0x2d')][_0x80f0('0x34')](_0x80f0('0x35'))){_0x3fa1f1[_0x80f0('0x1c')]=qs[_0x80f0('0x1c')](_0x3d0c37['query'][_0x80f0('0x1c')]);_0x3fa1f1['offset']=qs['offset'](_0x3d0c37[_0x80f0('0x2d')][_0x80f0('0x1a')]);}return _0x4b1fe5[_0x80f0('0x4a')](_0x3fa1f1);}})['then'](function(_0x40a1bc){if(_0x40a1bc){return _0x40a1bc?{'count':_0x522304,'rows':_0x40a1bc}:null;}})['then'](respondWithResult(_0x48accf,null))['catch'](handleError(_0x48accf,null));};exports[_0x80f0('0x4d')]=function(_0x2f8117,_0xdce709,_0x4d69c9){var _0x9794c9={};var _0xa2b035={};var _0x40e422;var _0x1a07ce;return db[_0x80f0('0x28')][_0x80f0('0x4b')]({'where':{'id':_0x2f8117[_0x80f0('0x48')]['id']}})['then'](handleEntityNotFound(_0xdce709,null))['then'](function(_0x3a51a0){if(_0x3a51a0){_0x40e422=_0x3a51a0;_0xa2b035[_0x80f0('0x2c')]=_[_0x80f0('0x2e')](db[_0x80f0('0x4c')][_0x80f0('0x43')]);_0xa2b035[_0x80f0('0x2d')]=_['keys'](_0x2f8117[_0x80f0('0x2d')]);_0xa2b035[_0x80f0('0x2f')]=_['intersection'](_0xa2b035[_0x80f0('0x2c')],_0xa2b035[_0x80f0('0x2d')]);_0x9794c9[_0x80f0('0x31')]=_[_0x80f0('0x30')](_0xa2b035[_0x80f0('0x2c')],qs['fields'](_0x2f8117[_0x80f0('0x2d')][_0x80f0('0x32')]));_0x9794c9[_0x80f0('0x31')]=_0x9794c9[_0x80f0('0x31')][_0x80f0('0x33')]?_0x9794c9['attributes']:_0xa2b035['model'];_0x9794c9['order']=qs[_0x80f0('0x37')](_0x2f8117['query'][_0x80f0('0x37')]);_0x9794c9['where']=qs[_0x80f0('0x2f')](_[_0x80f0('0x39')](_0x2f8117[_0x80f0('0x2d')],_0xa2b035[_0x80f0('0x2f')]));if(_0x2f8117['query'][_0x80f0('0x3a')]){_0x9794c9['where']=_[_0x80f0('0x3b')](_0x9794c9[_0x80f0('0x38')],{'$or':_[_0x80f0('0x27')](_0x9794c9[_0x80f0('0x31')],function(_0x4319a1){var _0x244215={};_0x244215[_0x4319a1]={'$like':'%'+_0x2f8117[_0x80f0('0x2d')][_0x80f0('0x3a')]+'%'};return _0x244215;})});}_0x9794c9=_[_0x80f0('0x3b')]({},_0x9794c9,_0x2f8117[_0x80f0('0x3d')]);return _0x40e422[_0x80f0('0x4d')](_0x9794c9);}})[_0x80f0('0x21')](function(_0x3cb828){if(_0x3cb828){_0x1a07ce=_0x3cb828[_0x80f0('0x33')];if(!_0x2f8117[_0x80f0('0x2d')]['hasOwnProperty'](_0x80f0('0x35'))){_0x9794c9[_0x80f0('0x1c')]=qs[_0x80f0('0x1c')](_0x2f8117[_0x80f0('0x2d')][_0x80f0('0x1c')]);_0x9794c9['offset']=qs[_0x80f0('0x1a')](_0x2f8117[_0x80f0('0x2d')]['offset']);}return _0x40e422[_0x80f0('0x4d')](_0x9794c9);}})['then'](function(_0x55a467){if(_0x55a467){return _0x55a467?{'count':_0x1a07ce,'rows':_0x55a467}:null;}})[_0x80f0('0x21')](respondWithResult(_0xdce709,null))['catch'](handleError(_0xdce709,null));};exports['getDescriptions']=function(_0x4c5c95,_0x29e872,_0x5a3f57){var _0x1b530f={};var _0x42e548={};var _0x1c7cf2;var _0x435feb;return db[_0x80f0('0x28')]['findOne']({'where':{'id':_0x4c5c95[_0x80f0('0x48')]['id']}})[_0x80f0('0x21')](handleEntityNotFound(_0x29e872,null))[_0x80f0('0x21')](function(_0x29a241){if(_0x29a241){_0x1c7cf2=_0x29a241;_0x42e548[_0x80f0('0x2c')]=_[_0x80f0('0x2e')](db[_0x80f0('0x4c')]['rawAttributes']);_0x42e548[_0x80f0('0x2d')]=_[_0x80f0('0x2e')](_0x4c5c95[_0x80f0('0x2d')]);_0x42e548[_0x80f0('0x2f')]=_[_0x80f0('0x30')](_0x42e548[_0x80f0('0x2c')],_0x42e548[_0x80f0('0x2d')]);_0x1b530f['attributes']=_[_0x80f0('0x30')](_0x42e548[_0x80f0('0x2c')],qs['fields'](_0x4c5c95[_0x80f0('0x2d')][_0x80f0('0x32')]));_0x1b530f['attributes']=_0x1b530f['attributes'][_0x80f0('0x33')]?_0x1b530f['attributes']:_0x42e548[_0x80f0('0x2c')];_0x1b530f[_0x80f0('0x36')]=qs[_0x80f0('0x37')](_0x4c5c95[_0x80f0('0x2d')][_0x80f0('0x37')]);_0x1b530f['where']=qs['filters'](_[_0x80f0('0x39')](_0x4c5c95[_0x80f0('0x2d')],_0x42e548['filters']));if(_0x4c5c95[_0x80f0('0x2d')][_0x80f0('0x3a')]){_0x1b530f[_0x80f0('0x38')]=_['merge'](_0x1b530f[_0x80f0('0x38')],{'$or':_[_0x80f0('0x27')](_0x1b530f[_0x80f0('0x31')],function(_0x49a8e1){var _0x17a330={};_0x17a330[_0x49a8e1]={'$like':'%'+_0x4c5c95[_0x80f0('0x2d')][_0x80f0('0x3a')]+'%'};return _0x17a330;})});}_0x1b530f=_[_0x80f0('0x3b')]({},_0x1b530f,_0x4c5c95[_0x80f0('0x3d')]);return _0x1c7cf2['getDescriptions'](_0x1b530f);}})[_0x80f0('0x21')](function(_0xe002b9){if(_0xe002b9){_0x435feb=_0xe002b9['length'];if(!_0x4c5c95[_0x80f0('0x2d')][_0x80f0('0x34')](_0x80f0('0x35'))){_0x1b530f[_0x80f0('0x1c')]=qs['limit'](_0x4c5c95[_0x80f0('0x2d')][_0x80f0('0x1c')]);_0x1b530f['offset']=qs[_0x80f0('0x1a')](_0x4c5c95[_0x80f0('0x2d')][_0x80f0('0x1a')]);}return _0x1c7cf2['getDescriptions'](_0x1b530f);}})[_0x80f0('0x21')](function(_0x4ca7fc){if(_0x4ca7fc){return _0x4ca7fc?{'count':_0x435feb,'rows':_0x4ca7fc}:null;}})[_0x80f0('0x21')](respondWithResult(_0x29e872,null))[_0x80f0('0x41')](handleError(_0x29e872,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a7910c1..cef3823 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x524357,_0x5e279b){var _0x6cbdd7=function(_0x232947){while(--_0x232947){_0x524357['push'](_0x524357['shift']());}};_0x6cbdd7(++_0x5e279b);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xb4e6[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x426133,_0x296d3f){var _0x3e010c=function(_0x32d681){while(--_0x32d681){_0x426133['push'](_0x426133['shift']());}};_0x3e010c(++_0x296d3f);}(_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':'int_dynamics365_configurations','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 6fd4f9c..7d5a8a3 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 _0x03d3=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x5f3f60,_0x5623b3){var _0x3f0e96=function(_0x2cd826){while(--_0x2cd826){_0x5f3f60['push'](_0x5f3f60['shift']());}};_0x3f0e96(++_0x5623b3);}(_0x03d3,0x75));var _0x303d=function(_0x5a0677,_0x387ee5){_0x5a0677=_0x5a0677-0x0;var _0x2dad4d=_0x03d3[_0x5a0677];return _0x2dad4d;};'use strict';var _=require(_0x303d('0x0'));var util=require(_0x303d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x303d('0x2'));var fs=require('fs');var Redis=require(_0x303d('0x3'));var db=require(_0x303d('0x4'))['db'];var utils=require(_0x303d('0x5'));var logger=require(_0x303d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x303d('0x7'));var client=jayson[_0x303d('0x8')][_0x303d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43cf37,_0x230785,_0x3c2f91){return new BPromise(function(_0x174858,_0x5312ce){return client[_0x303d('0xa')](_0x43cf37,_0x3c2f91)[_0x303d('0xb')](function(_0x51efb7){logger[_0x303d('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x230785,_0x303d('0xd'));logger[_0x303d('0xe')](_0x303d('0xf'),_0x230785,_0x303d('0xd'),JSON[_0x303d('0x10')](_0x51efb7));if(_0x51efb7[_0x303d('0x11')]){if(_0x51efb7[_0x303d('0x11')]['code']===0x1f4){logger[_0x303d('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x230785,_0x51efb7[_0x303d('0x11')][_0x303d('0x12')]);return _0x5312ce(_0x51efb7['error'][_0x303d('0x12')]);}logger[_0x303d('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x230785,_0x51efb7['error'][_0x303d('0x12')]);return _0x174858(_0x51efb7[_0x303d('0x11')][_0x303d('0x12')]);}else{logger[_0x303d('0xc')](_0x303d('0x13'),_0x230785,_0x303d('0xd'));_0x174858(_0x51efb7[_0x303d('0x14')][_0x303d('0x12')]);}})[_0x303d('0x15')](function(_0x432c5a){logger[_0x303d('0x11')](_0x303d('0x13'),_0x230785,_0x432c5a);_0x5312ce(_0x432c5a);});});} \ No newline at end of file +var _0xe339=['stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x3dc485,_0x358065){var _0x163fd0=function(_0x5bfb36){while(--_0x5bfb36){_0x3dc485['push'](_0x3dc485['shift']());}};_0x163fd0(++_0x358065);}(_0xe339,0x1ba));var _0x9e33=function(_0x5d31ee,_0x183e43){_0x5d31ee=_0x5d31ee-0x0;var _0x21c2e6=_0xe339[_0x5d31ee];return _0x21c2e6;};'use strict';var _=require(_0x9e33('0x0'));var util=require(_0x9e33('0x1'));var moment=require(_0x9e33('0x2'));var BPromise=require(_0x9e33('0x3'));var rs=require(_0x9e33('0x4'));var fs=require('fs');var Redis=require(_0x9e33('0x5'));var db=require(_0x9e33('0x6'))['db'];var utils=require(_0x9e33('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e33('0x8'));var jayson=require(_0x9e33('0x9'));var client=jayson[_0x9e33('0xa')][_0x9e33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34ea16,_0x3b8942,_0x2c8626){return new BPromise(function(_0x27c0f1,_0xb18077){return client[_0x9e33('0xc')](_0x34ea16,_0x2c8626)[_0x9e33('0xd')](function(_0x107635){logger[_0x9e33('0xe')](_0x9e33('0xf'),_0x3b8942,'request\x20sent');logger[_0x9e33('0x10')](_0x9e33('0x11'),_0x3b8942,'request\x20sent',JSON[_0x9e33('0x12')](_0x107635));if(_0x107635[_0x9e33('0x13')]){if(_0x107635[_0x9e33('0x13')]['code']===0x1f4){logger[_0x9e33('0x13')](_0x9e33('0xf'),_0x3b8942,_0x107635[_0x9e33('0x13')][_0x9e33('0x14')]);return _0xb18077(_0x107635[_0x9e33('0x13')][_0x9e33('0x14')]);}logger[_0x9e33('0x13')](_0x9e33('0xf'),_0x3b8942,_0x107635[_0x9e33('0x13')]['message']);return _0x27c0f1(_0x107635[_0x9e33('0x13')][_0x9e33('0x14')]);}else{logger[_0x9e33('0xe')](_0x9e33('0xf'),_0x3b8942,_0x9e33('0x15'));_0x27c0f1(_0x107635['result'][_0x9e33('0x14')]);}})[_0x9e33('0x16')](function(_0x53801b){logger[_0x9e33('0x13')](_0x9e33('0xf'),_0x3b8942,_0x53801b);_0xb18077(_0x53801b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index dbe471a..3e47559 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 _0x092f=['express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','create','delete','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x092f,0x131));var _0xf092=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x092f[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var path=require(_0xf092('0x2'));var timeout=require('connect-timeout');var express=require(_0xf092('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf092('0x4'));var interaction=require(_0xf092('0x5'));var config=require('../../config/environment');var controller=require(_0xf092('0x6'));router[_0xf092('0x7')]('/',auth[_0xf092('0x8')](),controller[_0xf092('0x9')]);router[_0xf092('0x7')](_0xf092('0xa'),auth[_0xf092('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf092('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf092('0xc')](_0xf092('0xa'),auth[_0xf092('0x8')](),controller[_0xf092('0xd')]);module['exports']=router; \ No newline at end of file +var _0x8e2e=['get','/:id','isAuthenticated','show','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x8e2e,0x1ee));var _0xe8e2=function(_0x2b338b,_0x4a06ba){_0x2b338b=_0x2b338b-0x0;var _0x256f66=_0x8e2e[_0x2b338b];return _0x256f66;};'use strict';var multer=require('multer');var util=require(_0xe8e2('0x0'));var path=require(_0xe8e2('0x1'));var timeout=require(_0xe8e2('0x2'));var express=require(_0xe8e2('0x3'));var router=express[_0xe8e2('0x4')]();var fs_extra=require(_0xe8e2('0x5'));var auth=require(_0xe8e2('0x6'));var interaction=require(_0xe8e2('0x7'));var config=require(_0xe8e2('0x8'));var controller=require(_0xe8e2('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe8e2('0xa')](_0xe8e2('0xb'),auth[_0xe8e2('0xc')](),controller[_0xe8e2('0xd')]);router['post']('/',auth[_0xe8e2('0xc')](),controller['create']);router[_0xe8e2('0xe')](_0xe8e2('0xb'),auth[_0xe8e2('0xc')](),controller[_0xe8e2('0xf')]);router['delete']('/:id',auth[_0xe8e2('0xc')](),controller[_0xe8e2('0x10')]);module[_0xe8e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 83e8b0c..846c1c6 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 _0x792a=['variable','customVariable','keyValue','STRING','BOOLEAN','ENUM','string'];(function(_0x54eec5,_0x436b7c){var _0x28f2b7=function(_0x2f2790){while(--_0x2f2790){_0x54eec5['push'](_0x54eec5['shift']());}};_0x28f2b7(++_0x436b7c);}(_0x792a,0xd0));var _0xa792=function(_0x3afa45,_0x35499b){_0x3afa45=_0x3afa45-0x0;var _0x236db5=_0x792a[_0x3afa45];return _0x236db5;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa792('0x0')](_0xa792('0x1'),_0xa792('0x2'),_0xa792('0x3'),_0xa792('0x4'),'picklist'),'defaultValue':_0xa792('0x1')},'content':{'type':Sequelize[_0xa792('0x5')]},'key':{'type':Sequelize[_0xa792('0x5')]},'keyType':{'type':Sequelize[_0xa792('0x0')](_0xa792('0x1'),_0xa792('0x2'),_0xa792('0x3'))},'keyContent':{'type':Sequelize[_0xa792('0x5')]},'idField':{'type':Sequelize[_0xa792('0x5')]},'nameField':{'type':Sequelize[_0xa792('0x5')]},'customField':{'type':Sequelize[_0xa792('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa792('0x5')]}}; \ No newline at end of file +var _0xc344=['picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable'];(function(_0x4ed735,_0x53957a){var _0x4bd2b9=function(_0x28c824){while(--_0x28c824){_0x4ed735['push'](_0x4ed735['shift']());}};_0x4bd2b9(++_0x53957a);}(_0xc344,0x7a));var _0x4c34=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc344[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4c34('0x0'));module[_0x4c34('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x4c34('0x2'),_0x4c34('0x3'),'keyValue',_0x4c34('0x4')),'defaultValue':_0x4c34('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4c34('0x6')]},'keyType':{'type':Sequelize[_0x4c34('0x7')](_0x4c34('0x5'),_0x4c34('0x2'),_0x4c34('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4c34('0x6')]},'customField':{'type':Sequelize[_0x4c34('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4c34('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 274974c..af9cf07 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 _0x76bb=['set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x133a58,_0x2881b5){var _0x3af81b=function(_0x551ccc){while(--_0x551ccc){_0x133a58['push'](_0x133a58['shift']());}};_0x3af81b(++_0x2881b5);}(_0x76bb,0x1d9));var _0xb76b=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x76bb[_0x580b15];return _0x1adb1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb76b('0x0'));var zipdir=require(_0xb76b('0x1'));var jsonpatch=require(_0xb76b('0x2'));var rp=require(_0xb76b('0x3'));var moment=require('moment');var BPromise=require(_0xb76b('0x4'));var Mustache=require('mustache');var util=require(_0xb76b('0x5'));var path=require(_0xb76b('0x6'));var sox=require('sox');var csv=require(_0xb76b('0x7'));var ejs=require(_0xb76b('0x8'));var fs=require('fs');var fs_extra=require(_0xb76b('0x9'));var _=require(_0xb76b('0xa'));var squel=require(_0xb76b('0xb'));var crypto=require(_0xb76b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb76b('0xd'));var Papa=require(_0xb76b('0xe'));var Redis=require(_0xb76b('0xf'));var authService=require(_0xb76b('0x10'));var qs=require(_0xb76b('0x11'));var as=require(_0xb76b('0x12'));var hardwareService=require(_0xb76b('0x13'));var logger=require(_0xb76b('0x14'))('api');var utils=require(_0xb76b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb76b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de7de,_0x2a84c3){_0x2a84c3=_0x2a84c3||0xcc;return function(_0x5b577f){if(_0x5b577f){return _0x4de7de[_0xb76b('0x17')](_0x2a84c3);}return _0x4de7de[_0xb76b('0x18')](_0x2a84c3)[_0xb76b('0x19')]();};}function respondWithResult(_0x351b17,_0xa12561){_0xa12561=_0xa12561||0xc8;return function(_0x5dcf68){if(_0x5dcf68){return _0x351b17[_0xb76b('0x18')](_0xa12561)[_0xb76b('0x1a')](_0x5dcf68);}};}function respondWithFilteredResult(_0x4a91e8,_0x58406e){return function(_0x2a660e){if(_0x2a660e){var _0x347d50=typeof _0x58406e[_0xb76b('0x1b')]===_0xb76b('0x1c')&&typeof _0x58406e[_0xb76b('0x1d')]==='undefined';var _0x255b71=_0x2a660e[_0xb76b('0x1e')];var _0x4f6e05=_0x347d50?0x0:_0x58406e[_0xb76b('0x1b')];var _0x35380d=_0x347d50?_0x2a660e[_0xb76b('0x1e')]:_0x58406e['offset']+_0x58406e['limit'];var _0x1f95d4;if(_0x35380d>=_0x255b71){_0x35380d=_0x255b71;_0x1f95d4=0xc8;}else{_0x1f95d4=0xce;}_0x4a91e8[_0xb76b('0x18')](_0x1f95d4);return _0x4a91e8[_0xb76b('0x1f')](_0xb76b('0x20'),_0x4f6e05+'-'+_0x35380d+'/'+_0x255b71)[_0xb76b('0x1a')](_0x2a660e);}return null;};}function patchUpdates(_0x3349f8){return function(_0x4def43){try{jsonpatch[_0xb76b('0x21')](_0x4def43,_0x3349f8,!![]);}catch(_0x3bb259){return BPromise[_0xb76b('0x22')](_0x3bb259);}return _0x4def43['save']();};}function saveUpdates(_0x3c9ec1,_0x5d7795){return function(_0x284492){if(_0x284492){return _0x284492[_0xb76b('0x23')](_0x3c9ec1)['then'](function(_0x1f7e57){return _0x1f7e57;});}return null;};}function removeEntity(_0x346056,_0x3ae9e9){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b['destroy']()[_0xb76b('0x24')](function(){_0x346056[_0xb76b('0x18')](0xcc)[_0xb76b('0x19')]();});}};}function handleEntityNotFound(_0x4afd66,_0x11bcaf){return function(_0x20840f){if(!_0x20840f){_0x4afd66[_0xb76b('0x17')](0x194);}return _0x20840f;};}function handleError(_0x234c02,_0x40f2a1){_0x40f2a1=_0x40f2a1||0x1f4;return function(_0x2620e4){logger[_0xb76b('0x25')](_0x2620e4[_0xb76b('0x26')]);if(_0x2620e4[_0xb76b('0x27')]){delete _0x2620e4[_0xb76b('0x27')];}_0x234c02[_0xb76b('0x18')](_0x40f2a1)[_0xb76b('0x28')](_0x2620e4);};}exports[_0xb76b('0x29')]=function(_0x5cd37a,_0x5c233d){var _0xca5e0={},_0x3019fc={},_0xde625={'count':0x0,'rows':[]};var _0x4f9e05=_[_0xb76b('0x2a')](db[_0xb76b('0x2b')][_0xb76b('0x2c')],function(_0x5dc77c){return{'name':_0x5dc77c['fieldName'],'type':_0x5dc77c[_0xb76b('0x2d')][_0xb76b('0x2e')]};});_0x3019fc[_0xb76b('0x2f')]=_[_0xb76b('0x2a')](_0x4f9e05,_0xb76b('0x27'));_0x3019fc[_0xb76b('0x30')]=_[_0xb76b('0x31')](_0x5cd37a[_0xb76b('0x30')]);_0x3019fc[_0xb76b('0x32')]=_[_0xb76b('0x33')](_0x3019fc[_0xb76b('0x2f')],_0x3019fc[_0xb76b('0x30')]);_0xca5e0[_0xb76b('0x34')]=_[_0xb76b('0x33')](_0x3019fc[_0xb76b('0x2f')],qs[_0xb76b('0x35')](_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x35')]));_0xca5e0[_0xb76b('0x34')]=_0xca5e0[_0xb76b('0x34')][_0xb76b('0x36')]?_0xca5e0['attributes']:_0x3019fc[_0xb76b('0x2f')];if(!_0x5cd37a[_0xb76b('0x30')]['hasOwnProperty'](_0xb76b('0x37'))){_0xca5e0[_0xb76b('0x1d')]=qs[_0xb76b('0x1d')](_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x1d')]);_0xca5e0['offset']=qs['offset'](_0x5cd37a['query'][_0xb76b('0x1b')]);}_0xca5e0[_0xb76b('0x38')]=qs[_0xb76b('0x39')](_0x5cd37a['query'][_0xb76b('0x39')]);_0xca5e0['where']=qs[_0xb76b('0x32')](_['pick'](_0x5cd37a[_0xb76b('0x30')],_0x3019fc['filters']),_0x4f9e05);if(_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x3a')]){_0xca5e0[_0xb76b('0x3b')]=_['merge'](_0xca5e0[_0xb76b('0x3b')],{'$or':_['map'](_0x4f9e05,function(_0x53ebaa){if(_0x53ebaa[_0xb76b('0x2d')]!==_0xb76b('0x3c')){var _0x2c59f3={};_0x2c59f3[_0x53ebaa[_0xb76b('0x27')]]={'$like':'%'+_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x3a')]+'%'};return _0x2c59f3;}})});}_0xca5e0=_[_0xb76b('0x3d')]({},_0xca5e0,_0x5cd37a[_0xb76b('0x3e')]);var _0x149f0b={'where':_0xca5e0[_0xb76b('0x3b')]};return db[_0xb76b('0x2b')][_0xb76b('0x1e')](_0x149f0b)[_0xb76b('0x24')](function(_0x3aa834){_0xde625[_0xb76b('0x1e')]=_0x3aa834;if(_0x5cd37a['query'][_0xb76b('0x3f')]){_0xca5e0['include']=[{'all':!![]}];}return db[_0xb76b('0x2b')][_0xb76b('0x40')](_0xca5e0);})[_0xb76b('0x24')](function(_0x59a31d){_0xde625[_0xb76b('0x41')]=_0x59a31d;return _0xde625;})[_0xb76b('0x24')](respondWithFilteredResult(_0x5c233d,_0xca5e0))[_0xb76b('0x42')](handleError(_0x5c233d,null));};exports[_0xb76b('0x43')]=function(_0x30b532,_0x2b9758){var _0x43f5d1={'raw':!![],'where':{'id':_0x30b532[_0xb76b('0x44')]['id']}},_0x13065d={};_0x13065d[_0xb76b('0x2f')]=_[_0xb76b('0x31')](db['Dynamics365Field'][_0xb76b('0x2c')]);_0x13065d[_0xb76b('0x30')]=_[_0xb76b('0x31')](_0x30b532[_0xb76b('0x30')]);_0x13065d['filters']=_[_0xb76b('0x33')](_0x13065d[_0xb76b('0x2f')],_0x13065d[_0xb76b('0x30')]);_0x43f5d1[_0xb76b('0x34')]=_['intersection'](_0x13065d[_0xb76b('0x2f')],qs[_0xb76b('0x35')](_0x30b532[_0xb76b('0x30')][_0xb76b('0x35')]));_0x43f5d1[_0xb76b('0x34')]=_0x43f5d1[_0xb76b('0x34')][_0xb76b('0x36')]?_0x43f5d1['attributes']:_0x13065d[_0xb76b('0x2f')];if(_0x30b532[_0xb76b('0x30')][_0xb76b('0x3f')]){_0x43f5d1['include']=[{'all':!![]}];}_0x43f5d1=_['merge']({},_0x43f5d1,_0x30b532['options']);return db[_0xb76b('0x2b')][_0xb76b('0x45')](_0x43f5d1)[_0xb76b('0x24')](handleEntityNotFound(_0x2b9758,null))[_0xb76b('0x24')](respondWithResult(_0x2b9758,null))[_0xb76b('0x42')](handleError(_0x2b9758,null));};exports['create']=function(_0x355e14,_0x5091ad){return db[_0xb76b('0x2b')][_0xb76b('0x46')](_0x355e14[_0xb76b('0x47')],{})[_0xb76b('0x24')](respondWithResult(_0x5091ad,0xc9))[_0xb76b('0x42')](handleError(_0x5091ad,null));};exports['update']=function(_0x383b82,_0xc95c9){if(_0x383b82['body']['id']){delete _0x383b82[_0xb76b('0x47')]['id'];}return db[_0xb76b('0x2b')][_0xb76b('0x45')]({'where':{'id':_0x383b82[_0xb76b('0x44')]['id']}})[_0xb76b('0x24')](handleEntityNotFound(_0xc95c9,null))[_0xb76b('0x24')](saveUpdates(_0x383b82[_0xb76b('0x47')],null))[_0xb76b('0x24')](respondWithResult(_0xc95c9,null))[_0xb76b('0x42')](handleError(_0xc95c9,null));};exports['destroy']=function(_0x222d0c,_0x4a00fd){return db['Dynamics365Field'][_0xb76b('0x45')]({'where':{'id':_0x222d0c[_0xb76b('0x44')]['id']}})[_0xb76b('0x24')](handleEntityNotFound(_0x4a00fd,null))[_0xb76b('0x24')](removeEntity(_0x4a00fd,null))[_0xb76b('0x42')](handleError(_0x4a00fd,null));}; \ No newline at end of file +var _0xc52d=['destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','Dynamics365Field','include','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x33e55a,_0x3d5690){var _0x542283=function(_0x4eba1d){while(--_0x4eba1d){_0x33e55a['push'](_0x33e55a['shift']());}};_0x542283(++_0x3d5690);}(_0xc52d,0xff));var _0xdc52=function(_0x5b8ade,_0x25f49c){_0x5b8ade=_0x5b8ade-0x0;var _0x190ff1=_0xc52d[_0x5b8ade];return _0x190ff1;};'use strict';var emlformat=require(_0xdc52('0x0'));var rimraf=require(_0xdc52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc52('0x2'));var rp=require(_0xdc52('0x3'));var moment=require('moment');var BPromise=require(_0xdc52('0x4'));var Mustache=require(_0xdc52('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdc52('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc52('0x7'));var squel=require(_0xdc52('0x8'));var crypto=require('crypto');var jsforce=require(_0xdc52('0x9'));var deskjs=require(_0xdc52('0xa'));var toCsv=require(_0xdc52('0xb'));var querystring=require(_0xdc52('0xc'));var Papa=require(_0xdc52('0xd'));var Redis=require('ioredis');var authService=require(_0xdc52('0xe'));var qs=require(_0xdc52('0xf'));var as=require(_0xdc52('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc52('0x11'))(_0xdc52('0x12'));var utils=require(_0xdc52('0x13'));var config=require(_0xdc52('0x14'));var licenseUtil=require(_0xdc52('0x15'));var db=require(_0xdc52('0x16'))['db'];function respondWithStatusCode(_0x570800,_0x4c7f16){_0x4c7f16=_0x4c7f16||0xcc;return function(_0xfc26e9){if(_0xfc26e9){return _0x570800['sendStatus'](_0x4c7f16);}return _0x570800[_0xdc52('0x17')](_0x4c7f16)[_0xdc52('0x18')]();};}function respondWithResult(_0x3ec498,_0x35f58f){_0x35f58f=_0x35f58f||0xc8;return function(_0xcec266){if(_0xcec266){return _0x3ec498[_0xdc52('0x17')](_0x35f58f)[_0xdc52('0x19')](_0xcec266);}};}function respondWithFilteredResult(_0x3375e8,_0x38c3b8){return function(_0x1d77b4){if(_0x1d77b4){var _0x173b7d=typeof _0x38c3b8['offset']===_0xdc52('0x1a')&&typeof _0x38c3b8['limit']==='undefined';var _0x2c49fb=_0x1d77b4[_0xdc52('0x1b')];var _0x28a287=_0x173b7d?0x0:_0x38c3b8[_0xdc52('0x1c')];var _0x44c7ab=_0x173b7d?_0x1d77b4['count']:_0x38c3b8[_0xdc52('0x1c')]+_0x38c3b8[_0xdc52('0x1d')];var _0x282cae;if(_0x44c7ab>=_0x2c49fb){_0x44c7ab=_0x2c49fb;_0x282cae=0xc8;}else{_0x282cae=0xce;}_0x3375e8[_0xdc52('0x17')](_0x282cae);return _0x3375e8[_0xdc52('0x1e')](_0xdc52('0x1f'),_0x28a287+'-'+_0x44c7ab+'/'+_0x2c49fb)[_0xdc52('0x19')](_0x1d77b4);}return null;};}function patchUpdates(_0x42399f){return function(_0x3e950e){try{jsonpatch[_0xdc52('0x20')](_0x3e950e,_0x42399f,!![]);}catch(_0x3140b6){return BPromise[_0xdc52('0x21')](_0x3140b6);}return _0x3e950e[_0xdc52('0x22')]();};}function saveUpdates(_0x4978c7,_0x2bb990){return function(_0x5020b2){if(_0x5020b2){return _0x5020b2[_0xdc52('0x23')](_0x4978c7)[_0xdc52('0x24')](function(_0x55af0c){return _0x55af0c;});}return null;};}function removeEntity(_0x6df8f1,_0x1473d2){return function(_0x400bd8){if(_0x400bd8){return _0x400bd8[_0xdc52('0x25')]()[_0xdc52('0x24')](function(){_0x6df8f1[_0xdc52('0x17')](0xcc)[_0xdc52('0x18')]();});}};}function handleEntityNotFound(_0x84f8d4,_0x45e925){return function(_0x17d1f){if(!_0x17d1f){_0x84f8d4[_0xdc52('0x26')](0x194);}return _0x17d1f;};}function handleError(_0x3de839,_0x250c86){_0x250c86=_0x250c86||0x1f4;return function(_0xc4d126){logger[_0xdc52('0x27')](_0xc4d126['stack']);if(_0xc4d126[_0xdc52('0x28')]){delete _0xc4d126[_0xdc52('0x28')];}_0x3de839['status'](_0x250c86)[_0xdc52('0x29')](_0xc4d126);};}exports['index']=function(_0x253b5e,_0x54a2e7){var _0x484f6e={},_0x2e7682={},_0x4ee2ff={'count':0x0,'rows':[]};var _0x39a07d=_[_0xdc52('0x2a')](db['Dynamics365Field'][_0xdc52('0x2b')],function(_0xbece86){return{'name':_0xbece86[_0xdc52('0x2c')],'type':_0xbece86[_0xdc52('0x2d')]['key']};});_0x2e7682[_0xdc52('0x2e')]=_['map'](_0x39a07d,_0xdc52('0x28'));_0x2e7682[_0xdc52('0x2f')]=_[_0xdc52('0x30')](_0x253b5e[_0xdc52('0x2f')]);_0x2e7682[_0xdc52('0x31')]=_[_0xdc52('0x32')](_0x2e7682[_0xdc52('0x2e')],_0x2e7682[_0xdc52('0x2f')]);_0x484f6e[_0xdc52('0x33')]=_['intersection'](_0x2e7682[_0xdc52('0x2e')],qs[_0xdc52('0x34')](_0x253b5e[_0xdc52('0x2f')]['fields']));_0x484f6e['attributes']=_0x484f6e['attributes'][_0xdc52('0x35')]?_0x484f6e[_0xdc52('0x33')]:_0x2e7682['model'];if(!_0x253b5e['query'][_0xdc52('0x36')](_0xdc52('0x37'))){_0x484f6e['limit']=qs[_0xdc52('0x1d')](_0x253b5e[_0xdc52('0x2f')][_0xdc52('0x1d')]);_0x484f6e[_0xdc52('0x1c')]=qs[_0xdc52('0x1c')](_0x253b5e[_0xdc52('0x2f')][_0xdc52('0x1c')]);}_0x484f6e[_0xdc52('0x38')]=qs['sort'](_0x253b5e['query'][_0xdc52('0x39')]);_0x484f6e['where']=qs[_0xdc52('0x31')](_['pick'](_0x253b5e[_0xdc52('0x2f')],_0x2e7682[_0xdc52('0x31')]),_0x39a07d);if(_0x253b5e[_0xdc52('0x2f')][_0xdc52('0x3a')]){_0x484f6e[_0xdc52('0x3b')]=_['merge'](_0x484f6e['where'],{'$or':_[_0xdc52('0x2a')](_0x39a07d,function(_0x4229e6){if(_0x4229e6[_0xdc52('0x2d')]!=='VIRTUAL'){var _0x3bf736={};_0x3bf736[_0x4229e6[_0xdc52('0x28')]]={'$like':'%'+_0x253b5e[_0xdc52('0x2f')]['filter']+'%'};return _0x3bf736;}})});}_0x484f6e=_[_0xdc52('0x3c')]({},_0x484f6e,_0x253b5e[_0xdc52('0x3d')]);var _0x1d3d30={'where':_0x484f6e[_0xdc52('0x3b')]};return db[_0xdc52('0x3e')]['count'](_0x1d3d30)[_0xdc52('0x24')](function(_0x16e16c){_0x4ee2ff['count']=_0x16e16c;if(_0x253b5e[_0xdc52('0x2f')]['includeAll']){_0x484f6e[_0xdc52('0x3f')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xdc52('0x40')](_0x484f6e);})['then'](function(_0x270192){_0x4ee2ff[_0xdc52('0x41')]=_0x270192;return _0x4ee2ff;})[_0xdc52('0x24')](respondWithFilteredResult(_0x54a2e7,_0x484f6e))[_0xdc52('0x42')](handleError(_0x54a2e7,null));};exports[_0xdc52('0x43')]=function(_0x326b67,_0x328449){var _0x3701f9={'raw':!![],'where':{'id':_0x326b67[_0xdc52('0x44')]['id']}},_0x2ab410={};_0x2ab410[_0xdc52('0x2e')]=_[_0xdc52('0x30')](db[_0xdc52('0x3e')][_0xdc52('0x2b')]);_0x2ab410[_0xdc52('0x2f')]=_[_0xdc52('0x30')](_0x326b67['query']);_0x2ab410[_0xdc52('0x31')]=_[_0xdc52('0x32')](_0x2ab410[_0xdc52('0x2e')],_0x2ab410[_0xdc52('0x2f')]);_0x3701f9[_0xdc52('0x33')]=_[_0xdc52('0x32')](_0x2ab410[_0xdc52('0x2e')],qs[_0xdc52('0x34')](_0x326b67[_0xdc52('0x2f')][_0xdc52('0x34')]));_0x3701f9['attributes']=_0x3701f9[_0xdc52('0x33')]['length']?_0x3701f9['attributes']:_0x2ab410[_0xdc52('0x2e')];if(_0x326b67[_0xdc52('0x2f')][_0xdc52('0x45')]){_0x3701f9[_0xdc52('0x3f')]=[{'all':!![]}];}_0x3701f9=_[_0xdc52('0x3c')]({},_0x3701f9,_0x326b67['options']);return db[_0xdc52('0x3e')]['find'](_0x3701f9)[_0xdc52('0x24')](handleEntityNotFound(_0x328449,null))[_0xdc52('0x24')](respondWithResult(_0x328449,null))[_0xdc52('0x42')](handleError(_0x328449,null));};exports['create']=function(_0x52a9eb,_0x3781be){return db[_0xdc52('0x3e')][_0xdc52('0x46')](_0x52a9eb[_0xdc52('0x47')],{})[_0xdc52('0x24')](respondWithResult(_0x3781be,0xc9))[_0xdc52('0x42')](handleError(_0x3781be,null));};exports[_0xdc52('0x23')]=function(_0x4e9d03,_0x4189a2){if(_0x4e9d03[_0xdc52('0x47')]['id']){delete _0x4e9d03[_0xdc52('0x47')]['id'];}return db[_0xdc52('0x3e')]['find']({'where':{'id':_0x4e9d03[_0xdc52('0x44')]['id']}})[_0xdc52('0x24')](handleEntityNotFound(_0x4189a2,null))[_0xdc52('0x24')](saveUpdates(_0x4e9d03[_0xdc52('0x47')],null))['then'](respondWithResult(_0x4189a2,null))[_0xdc52('0x42')](handleError(_0x4189a2,null));};exports['destroy']=function(_0x52811f,_0x1a23df){return db[_0xdc52('0x3e')][_0xdc52('0x48')]({'where':{'id':_0x52811f['params']['id']}})[_0xdc52('0x24')](handleEntityNotFound(_0x1a23df,null))['then'](removeEntity(_0x1a23df,null))[_0xdc52('0x42')](handleError(_0x1a23df,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index dcddde0..03358ac 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 _0x810b=['moment','bluebird','request-promise','path','rimraf','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x4ac036,_0x10b4d5){var _0x271653=function(_0x573a06){while(--_0x573a06){_0x4ac036['push'](_0x4ac036['shift']());}};_0x271653(++_0x10b4d5);}(_0x810b,0x128));var _0xb810=function(_0xaa16c4,_0x1e6242){_0xaa16c4=_0xaa16c4-0x0;var _0x552433=_0x810b[_0xaa16c4];return _0x552433;};'use strict';var _=require(_0xb810('0x0'));var util=require(_0xb810('0x1'));var logger=require(_0xb810('0x2'))(_0xb810('0x3'));var moment=require(_0xb810('0x4'));var BPromise=require(_0xb810('0x5'));var rp=require(_0xb810('0x6'));var fs=require('fs');var path=require(_0xb810('0x7'));var rimraf=require(_0xb810('0x8'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xb810('0x9')]=function(_0x495c92,_0x28c830){return _0x495c92[_0xb810('0xa')](_0xb810('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xb810('0xc'),'fields':[_0xb810('0xd'),_0xb810('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x216b=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x216b,0x1d1));var _0xb216=function(_0x3b844a,_0x43e116){_0x3b844a=_0x3b844a-0x0;var _0x448623=_0x216b[_0x3b844a];return _0x448623;};'use strict';var _=require(_0xb216('0x0'));var util=require('util');var logger=require(_0xb216('0x1'))(_0xb216('0x2'));var moment=require(_0xb216('0x3'));var BPromise=require(_0xb216('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb216('0x5'));var rimraf=require(_0xb216('0x6'));var config=require(_0xb216('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0xb216('0x8')]=function(_0xf8431,_0x1a71ce){return _0xf8431[_0xb216('0x9')](_0xb216('0xa'),attributes,{'tableName':_0xb216('0xb'),'paranoid':![],'indexes':[{'name':_0xb216('0xc'),'fields':[_0xb216('0xd'),_0xb216('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 5ae9788..e888114 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 _0xb08e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xb08e,0x107));var _0xeb08=function(_0x439e69,_0x15658e){_0x439e69=_0x439e69-0x0;var _0x5e2da4=_0xb08e[_0x439e69];return _0x5e2da4;};'use strict';var _=require(_0xeb08('0x0'));var util=require(_0xeb08('0x1'));var moment=require(_0xeb08('0x2'));var BPromise=require(_0xeb08('0x3'));var rs=require(_0xeb08('0x4'));var fs=require('fs');var Redis=require(_0xeb08('0x5'));var db=require(_0xeb08('0x6'))['db'];var utils=require(_0xeb08('0x7'));var logger=require('../../config/logger')(_0xeb08('0x8'));var config=require(_0xeb08('0x9'));var jayson=require(_0xeb08('0xa'));var client=jayson[_0xeb08('0xb')][_0xeb08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4836bf,_0x1f95e7,_0x45479d){return new BPromise(function(_0x365a0a,_0x2f1372){return client['request'](_0x4836bf,_0x45479d)[_0xeb08('0xd')](function(_0x30483a){logger[_0xeb08('0xe')](_0xeb08('0xf'),_0x1f95e7,_0xeb08('0x10'));logger[_0xeb08('0x11')](_0xeb08('0x12'),_0x1f95e7,_0xeb08('0x10'),JSON[_0xeb08('0x13')](_0x30483a));if(_0x30483a[_0xeb08('0x14')]){if(_0x30483a[_0xeb08('0x14')][_0xeb08('0x15')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1f95e7,_0x30483a[_0xeb08('0x14')][_0xeb08('0x16')]);return _0x2f1372(_0x30483a[_0xeb08('0x14')][_0xeb08('0x16')]);}logger[_0xeb08('0x14')](_0xeb08('0xf'),_0x1f95e7,_0x30483a['error'][_0xeb08('0x16')]);return _0x365a0a(_0x30483a['error']['message']);}else{logger[_0xeb08('0xe')](_0xeb08('0xf'),_0x1f95e7,_0xeb08('0x10'));_0x365a0a(_0x30483a['result'][_0xeb08('0x16')]);}})[_0xeb08('0x17')](function(_0x5892c0){logger[_0xeb08('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x1f95e7,_0x5892c0);_0x2f1372(_0x5892c0);});});} \ No newline at end of file +var _0xd791=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xd791,0xc0));var _0x1d79=function(_0x519380,_0x7f196){_0x519380=_0x519380-0x0;var _0x60ba2c=_0xd791[_0x519380];return _0x60ba2c;};'use strict';var _=require(_0x1d79('0x0'));var util=require(_0x1d79('0x1'));var moment=require(_0x1d79('0x2'));var BPromise=require(_0x1d79('0x3'));var rs=require(_0x1d79('0x4'));var fs=require('fs');var Redis=require(_0x1d79('0x5'));var db=require(_0x1d79('0x6'))['db'];var utils=require(_0x1d79('0x7'));var logger=require(_0x1d79('0x8'))(_0x1d79('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37ad83,_0xdcd395,_0x4b4b4b){return new BPromise(function(_0x1a912e,_0x590ace){return client[_0x1d79('0xb')](_0x37ad83,_0x4b4b4b)[_0x1d79('0xc')](function(_0x1ec0bc){logger[_0x1d79('0xd')](_0x1d79('0xe'),_0xdcd395,_0x1d79('0xf'));logger[_0x1d79('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xdcd395,_0x1d79('0xf'),JSON[_0x1d79('0x11')](_0x1ec0bc));if(_0x1ec0bc[_0x1d79('0x12')]){if(_0x1ec0bc['error'][_0x1d79('0x13')]===0x1f4){logger['error'](_0x1d79('0xe'),_0xdcd395,_0x1ec0bc[_0x1d79('0x12')][_0x1d79('0x14')]);return _0x590ace(_0x1ec0bc[_0x1d79('0x12')][_0x1d79('0x14')]);}logger[_0x1d79('0x12')](_0x1d79('0xe'),_0xdcd395,_0x1ec0bc[_0x1d79('0x12')][_0x1d79('0x14')]);return _0x1a912e(_0x1ec0bc[_0x1d79('0x12')][_0x1d79('0x14')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0xdcd395,'request\x20sent');_0x1a912e(_0x1ec0bc['result'][_0x1d79('0x14')]);}})[_0x1d79('0x15')](function(_0x76f730){logger[_0x1d79('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0xdcd395,_0x76f730);_0x590ace(_0x76f730);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 0bdf7b7..d220c25 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 _0xcf55=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x147116,_0x6abac9){var _0x246711=function(_0x578e81){while(--_0x578e81){_0x147116['push'](_0x147116['shift']());}};_0x246711(++_0x6abac9);}(_0xcf55,0xfa));var _0x5cf5=function(_0x2b5584,_0x2c1bab){_0x2b5584=_0x2b5584-0x0;var _0x3f8885=_0xcf55[_0x2b5584];return _0x3f8885;};'use strict';var multer=require(_0x5cf5('0x0'));var util=require(_0x5cf5('0x1'));var path=require(_0x5cf5('0x2'));var timeout=require(_0x5cf5('0x3'));var express=require('express');var router=express[_0x5cf5('0x4')]();var fs_extra=require(_0x5cf5('0x5'));var auth=require(_0x5cf5('0x6'));var interaction=require(_0x5cf5('0x7'));var config=require(_0x5cf5('0x8'));var controller=require(_0x5cf5('0x9'));router[_0x5cf5('0xa')]('/',auth[_0x5cf5('0xb')](),controller[_0x5cf5('0xc')]);router['get'](_0x5cf5('0xd'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0xe')]);router[_0x5cf5('0xa')](_0x5cf5('0xf'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x10')]);router['get'](_0x5cf5('0x11'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x12')]);router['post']('/',auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x13')]);router[_0x5cf5('0x14')](_0x5cf5('0xf'),auth[_0x5cf5('0xb')](),controller['addConfiguration']);router[_0x5cf5('0x15')](_0x5cf5('0xd'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x16')]);router[_0x5cf5('0x17')](_0x5cf5('0xd'),auth['isAuthenticated'](),controller[_0x5cf5('0x18')]);module[_0x5cf5('0x19')]=router; \ No newline at end of file +var _0xe987=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy'];(function(_0x214019,_0xf752f2){var _0x4f8cc8=function(_0x259466){while(--_0x259466){_0x214019['push'](_0x214019['shift']());}};_0x4f8cc8(++_0xf752f2);}(_0xe987,0x1b6));var _0x7e98=function(_0x2af808,_0x56a864){_0x2af808=_0x2af808-0x0;var _0xda8537=_0xe987[_0x2af808];return _0xda8537;};'use strict';var multer=require(_0x7e98('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7e98('0x1'));var express=require(_0x7e98('0x2'));var router=express[_0x7e98('0x3')]();var fs_extra=require(_0x7e98('0x4'));var auth=require(_0x7e98('0x5'));var interaction=require(_0x7e98('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x7e98('0x7')]('/',auth[_0x7e98('0x8')](),controller[_0x7e98('0x9')]);router['get'](_0x7e98('0xa'),auth['isAuthenticated'](),controller[_0x7e98('0xb')]);router[_0x7e98('0x7')](_0x7e98('0xc'),auth[_0x7e98('0x8')](),controller[_0x7e98('0xd')]);router[_0x7e98('0x7')](_0x7e98('0xe'),auth[_0x7e98('0x8')](),controller[_0x7e98('0xf')]);router[_0x7e98('0x10')]('/',auth[_0x7e98('0x8')](),controller[_0x7e98('0x11')]);router[_0x7e98('0x10')](_0x7e98('0xc'),auth[_0x7e98('0x8')](),controller[_0x7e98('0x12')]);router[_0x7e98('0x13')](_0x7e98('0xa'),auth[_0x7e98('0x8')](),controller[_0x7e98('0x14')]);router['delete'](_0x7e98('0xa'),auth[_0x7e98('0x8')](),controller[_0x7e98('0x15')]);module[_0x7e98('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a1d876b..fc5d244 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 _0xef0f=['sequelize','STRING','remoteUri'];(function(_0xefdff1,_0x42aa31){var _0x1cc0fb=function(_0x1831b6){while(--_0x1831b6){_0xefdff1['push'](_0xefdff1['shift']());}};_0x1cc0fb(++_0x42aa31);}(_0xef0f,0x168));var _0xfef0=function(_0x306cce,_0x18afa5){_0x306cce=_0x306cce-0x0;var _0x49881a=_0xef0f[_0x306cce];return _0x49881a;};'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 +var _0x6a95=['exports','STRING','username','sequelize'];(function(_0x44db60,_0x4ec8ca){var _0x3fa929=function(_0x5800a6){while(--_0x5800a6){_0x44db60['push'](_0x44db60['shift']());}};_0x3fa929(++_0x4ec8ca);}(_0x6a95,0x1db));var _0x56a9=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x6a95[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index bec5e40..9c648d1 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 _0x69e6=['custom_text','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','FreshdeskAccount','rows','catch','keys','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','subject','agent','priority','group','source','ticket_type','remove','includes','default'];(function(_0xdfd978,_0x457bba){var _0x108b04=function(_0x421c98){while(--_0x421c98){_0xdfd978['push'](_0xdfd978['shift']());}};_0x108b04(++_0x457bba);}(_0x69e6,0x1e0));var _0x669e=function(_0x2b8a7a,_0x3c76f1){_0x2b8a7a=_0x2b8a7a-0x0;var _0x141456=_0x69e6[_0x2b8a7a];return _0x141456;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x669e('0x0'));var zipdir=require(_0x669e('0x1'));var jsonpatch=require(_0x669e('0x2'));var rp=require(_0x669e('0x3'));var moment=require(_0x669e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x669e('0x5'));var util=require(_0x669e('0x6'));var path=require(_0x669e('0x7'));var sox=require(_0x669e('0x8'));var csv=require(_0x669e('0x9'));var ejs=require(_0x669e('0xa'));var fs=require('fs');var fs_extra=require(_0x669e('0xb'));var _=require(_0x669e('0xc'));var squel=require(_0x669e('0xd'));var crypto=require(_0x669e('0xe'));var jsforce=require(_0x669e('0xf'));var deskjs=require(_0x669e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x669e('0x11'));var Papa=require(_0x669e('0x12'));var Redis=require(_0x669e('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x669e('0x14'));var logger=require(_0x669e('0x15'))(_0x669e('0x16'));var utils=require(_0x669e('0x17'));var config=require(_0x669e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x669e('0x19'));function respondWithStatusCode(_0x1a7ea7,_0x344b70){_0x344b70=_0x344b70||0xcc;return function(_0x12e4aa){if(_0x12e4aa){return _0x1a7ea7['sendStatus'](_0x344b70);}return _0x1a7ea7['status'](_0x344b70)[_0x669e('0x1a')]();};}function respondWithResult(_0x557e55,_0x2e53db){_0x2e53db=_0x2e53db||0xc8;return function(_0x409754){if(_0x409754){return _0x557e55[_0x669e('0x1b')](_0x2e53db)['json'](_0x409754);}};}function respondWithFilteredResult(_0x648035,_0x255d4e){return function(_0x150993){if(_0x150993){var _0x151f76=typeof _0x255d4e['offset']===_0x669e('0x1c')&&typeof _0x255d4e['limit']===_0x669e('0x1c');var _0x370a82=_0x150993[_0x669e('0x1d')];var _0x81cb19=_0x151f76?0x0:_0x255d4e[_0x669e('0x1e')];var _0x47b558=_0x151f76?_0x150993['count']:_0x255d4e[_0x669e('0x1e')]+_0x255d4e[_0x669e('0x1f')];var _0x498f9d;if(_0x47b558>=_0x370a82){_0x47b558=_0x370a82;_0x498f9d=0xc8;}else{_0x498f9d=0xce;}_0x648035[_0x669e('0x1b')](_0x498f9d);return _0x648035[_0x669e('0x20')](_0x669e('0x21'),_0x81cb19+'-'+_0x47b558+'/'+_0x370a82)[_0x669e('0x22')](_0x150993);}return null;};}function patchUpdates(_0x52d60e){return function(_0x30f7b5){try{jsonpatch[_0x669e('0x23')](_0x30f7b5,_0x52d60e,!![]);}catch(_0x5ca591){return BPromise[_0x669e('0x24')](_0x5ca591);}return _0x30f7b5[_0x669e('0x25')]();};}function saveUpdates(_0x40a590,_0x58c08f){return function(_0x145f8d){if(_0x145f8d){return _0x145f8d[_0x669e('0x26')](_0x40a590)[_0x669e('0x27')](function(_0xbe2acd){return _0xbe2acd;});}return null;};}function removeEntity(_0x2eab78,_0x2f8d20){return function(_0x1cd3f4){if(_0x1cd3f4){return _0x1cd3f4[_0x669e('0x28')]()['then'](function(){_0x2eab78['status'](0xcc)[_0x669e('0x1a')]();});}};}function handleEntityNotFound(_0x4e4500,_0x343c0a){return function(_0x5dad02){if(!_0x5dad02){_0x4e4500[_0x669e('0x29')](0x194);}return _0x5dad02;};}function handleError(_0x372ea3,_0x27fa45){_0x27fa45=_0x27fa45||0x1f4;return function(_0x3b25a5){logger[_0x669e('0x2a')](_0x3b25a5[_0x669e('0x2b')]);if(_0x3b25a5['name']){delete _0x3b25a5[_0x669e('0x2c')];}_0x372ea3[_0x669e('0x1b')](_0x27fa45)[_0x669e('0x2d')](_0x3b25a5);};}exports[_0x669e('0x2e')]=function(_0x5bf9b2,_0xe3281e){var _0x283651={},_0x20142d={},_0x295859={'count':0x0,'rows':[]};var _0x5e1980=_[_0x669e('0x2f')](db['FreshdeskAccount'][_0x669e('0x30')],function(_0x400d8f){return{'name':_0x400d8f[_0x669e('0x31')],'type':_0x400d8f[_0x669e('0x32')][_0x669e('0x33')]};});_0x20142d['model']=_[_0x669e('0x2f')](_0x5e1980,_0x669e('0x2c'));_0x20142d[_0x669e('0x34')]=_['keys'](_0x5bf9b2[_0x669e('0x34')]);_0x20142d[_0x669e('0x35')]=_[_0x669e('0x36')](_0x20142d[_0x669e('0x37')],_0x20142d['query']);_0x283651[_0x669e('0x38')]=_['intersection'](_0x20142d['model'],qs[_0x669e('0x39')](_0x5bf9b2[_0x669e('0x34')][_0x669e('0x39')]));_0x283651[_0x669e('0x38')]=_0x283651[_0x669e('0x38')][_0x669e('0x3a')]?_0x283651[_0x669e('0x38')]:_0x20142d[_0x669e('0x37')];if(!_0x5bf9b2['query']['hasOwnProperty']('nolimit')){_0x283651['limit']=qs[_0x669e('0x1f')](_0x5bf9b2[_0x669e('0x34')][_0x669e('0x1f')]);_0x283651[_0x669e('0x1e')]=qs[_0x669e('0x1e')](_0x5bf9b2[_0x669e('0x34')][_0x669e('0x1e')]);}_0x283651[_0x669e('0x3b')]=qs[_0x669e('0x3c')](_0x5bf9b2['query']['sort']);_0x283651['where']=qs[_0x669e('0x35')](_[_0x669e('0x3d')](_0x5bf9b2[_0x669e('0x34')],_0x20142d['filters']),_0x5e1980);if(_0x5bf9b2[_0x669e('0x34')][_0x669e('0x3e')]){_0x283651[_0x669e('0x3f')]=_['merge'](_0x283651['where'],{'$or':_['map'](_0x5e1980,function(_0x4a7549){if(_0x4a7549[_0x669e('0x32')]!==_0x669e('0x40')){var _0x4a349c={};_0x4a349c[_0x4a7549[_0x669e('0x2c')]]={'$like':'%'+_0x5bf9b2[_0x669e('0x34')]['filter']+'%'};return _0x4a349c;}})});}_0x283651=_[_0x669e('0x41')]({},_0x283651,_0x5bf9b2[_0x669e('0x42')]);var _0x102da5={'where':_0x283651[_0x669e('0x3f')]};return db['FreshdeskAccount'][_0x669e('0x1d')](_0x102da5)['then'](function(_0x112acf){_0x295859[_0x669e('0x1d')]=_0x112acf;if(_0x5bf9b2[_0x669e('0x34')][_0x669e('0x43')]){_0x283651[_0x669e('0x44')]=[{'all':!![]}];}return db[_0x669e('0x45')]['findAll'](_0x283651);})[_0x669e('0x27')](function(_0x2711bc){_0x295859[_0x669e('0x46')]=_0x2711bc;return _0x295859;})[_0x669e('0x27')](respondWithFilteredResult(_0xe3281e,_0x283651))[_0x669e('0x47')](handleError(_0xe3281e,null));};exports['show']=function(_0x46783f,_0x4eb087){var _0x54e2a9={'raw':![],'where':{'id':_0x46783f['params']['id']}},_0x4d4a42={};_0x4d4a42[_0x669e('0x37')]=_['keys'](db[_0x669e('0x45')][_0x669e('0x30')]);_0x4d4a42['query']=_[_0x669e('0x48')](_0x46783f['query']);_0x4d4a42[_0x669e('0x35')]=_[_0x669e('0x36')](_0x4d4a42['model'],_0x4d4a42['query']);_0x54e2a9[_0x669e('0x38')]=_[_0x669e('0x36')](_0x4d4a42[_0x669e('0x37')],qs[_0x669e('0x39')](_0x46783f['query'][_0x669e('0x39')]));_0x54e2a9[_0x669e('0x38')]=_0x54e2a9[_0x669e('0x38')][_0x669e('0x3a')]?_0x54e2a9[_0x669e('0x38')]:_0x4d4a42[_0x669e('0x37')];if(_0x46783f['query']['includeAll']){_0x54e2a9['include']=[{'all':!![]}];}_0x54e2a9=_['merge']({},_0x54e2a9,_0x46783f[_0x669e('0x42')]);return db[_0x669e('0x45')][_0x669e('0x49')](_0x54e2a9)['then'](handleEntityNotFound(_0x4eb087,null))['then'](respondWithResult(_0x4eb087,null))[_0x669e('0x47')](handleError(_0x4eb087,null));};exports[_0x669e('0x4a')]=function(_0xe23432,_0x28507e){return db[_0x669e('0x45')][_0x669e('0x4a')](_0xe23432['body'],{})[_0x669e('0x27')](respondWithResult(_0x28507e,0xc9))[_0x669e('0x47')](handleError(_0x28507e,null));};exports['update']=function(_0x11d2c8,_0x1eaf9f){if(_0x11d2c8[_0x669e('0x4b')]['id']){delete _0x11d2c8['body']['id'];}return db[_0x669e('0x45')][_0x669e('0x49')]({'where':{'id':_0x11d2c8[_0x669e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1eaf9f,null))[_0x669e('0x27')](saveUpdates(_0x11d2c8[_0x669e('0x4b')],null))[_0x669e('0x27')](respondWithResult(_0x1eaf9f,null))[_0x669e('0x47')](handleError(_0x1eaf9f,null));};exports['destroy']=function(_0x4e79c0,_0x1ec48d){return db['FreshdeskAccount']['find']({'where':{'id':_0x4e79c0[_0x669e('0x4c')]['id']}})[_0x669e('0x27')](handleEntityNotFound(_0x1ec48d,null))[_0x669e('0x27')](removeEntity(_0x1ec48d,null))[_0x669e('0x47')](handleError(_0x1ec48d,null));};exports[_0x669e('0x4d')]=function(_0x43921f,_0xdd2acf,_0x2c86d4){var _0x4225d6={};var _0xa71174={};var _0x5b9c4d;var _0x3169e7;return db[_0x669e('0x45')][_0x669e('0x4e')]({'where':{'id':_0x43921f[_0x669e('0x4c')]['id']}})[_0x669e('0x27')](handleEntityNotFound(_0xdd2acf,null))[_0x669e('0x27')](function(_0x29f05a){if(_0x29f05a){_0x5b9c4d=_0x29f05a;_0xa71174[_0x669e('0x37')]=_[_0x669e('0x48')](db[_0x669e('0x4f')][_0x669e('0x30')]);_0xa71174[_0x669e('0x34')]=_[_0x669e('0x48')](_0x43921f['query']);_0xa71174[_0x669e('0x35')]=_['intersection'](_0xa71174['model'],_0xa71174[_0x669e('0x34')]);_0x4225d6[_0x669e('0x38')]=_[_0x669e('0x36')](_0xa71174[_0x669e('0x37')],qs['fields'](_0x43921f[_0x669e('0x34')][_0x669e('0x39')]));_0x4225d6['attributes']=_0x4225d6[_0x669e('0x38')][_0x669e('0x3a')]?_0x4225d6[_0x669e('0x38')]:_0xa71174[_0x669e('0x37')];_0x4225d6[_0x669e('0x3b')]=qs['sort'](_0x43921f[_0x669e('0x34')][_0x669e('0x3c')]);_0x4225d6[_0x669e('0x3f')]=qs['filters'](_[_0x669e('0x3d')](_0x43921f[_0x669e('0x34')],_0xa71174[_0x669e('0x35')]));if(_0x43921f[_0x669e('0x34')][_0x669e('0x3e')]){_0x4225d6[_0x669e('0x3f')]=_[_0x669e('0x41')](_0x4225d6['where'],{'$or':_[_0x669e('0x2f')](_0x4225d6[_0x669e('0x38')],function(_0x4e9128){var _0x4f3306={};_0x4f3306[_0x4e9128]={'$like':'%'+_0x43921f[_0x669e('0x34')][_0x669e('0x3e')]+'%'};return _0x4f3306;})});}_0x4225d6=_[_0x669e('0x41')]({},_0x4225d6,_0x43921f[_0x669e('0x42')]);return _0x5b9c4d[_0x669e('0x4d')](_0x4225d6);}})[_0x669e('0x27')](function(_0x2162ba){if(_0x2162ba){_0x3169e7=_0x2162ba[_0x669e('0x3a')];if(!_0x43921f['query'][_0x669e('0x50')](_0x669e('0x51'))){_0x4225d6[_0x669e('0x1f')]=qs[_0x669e('0x1f')](_0x43921f[_0x669e('0x34')][_0x669e('0x1f')]);_0x4225d6[_0x669e('0x1e')]=qs['offset'](_0x43921f[_0x669e('0x34')][_0x669e('0x1e')]);}return _0x5b9c4d[_0x669e('0x4d')](_0x4225d6);}})[_0x669e('0x27')](function(_0x220e0d){if(_0x220e0d){return _0x220e0d?{'count':_0x3169e7,'rows':_0x220e0d}:null;}})['then'](respondWithResult(_0xdd2acf,null))['catch'](handleError(_0xdd2acf,null));};exports[_0x669e('0x52')]=function(_0x304332,_0x233942,_0x526212){if(_0x304332[_0x669e('0x4b')]['id']){delete _0x304332[_0x669e('0x4b')]['id'];}return db[_0x669e('0x45')][_0x669e('0x4e')]({'where':{'id':_0x304332['params']['id']}})[_0x669e('0x27')](handleEntityNotFound(_0x233942,null))['then'](function(_0x31b146){if(_0x31b146){_0x304332[_0x669e('0x4b')][_0x669e('0x53')]=_0x31b146['id'];_0x304332[_0x669e('0x4b')][_0x669e('0x54')]=integrations[_0x669e('0x55')](_0x304332['body'][_0x669e('0x56')],_0x304332['body'][_0x669e('0x32')]);_0x304332[_0x669e('0x4b')]['Descriptions']=integrations[_0x669e('0x57')](_0x304332[_0x669e('0x4b')][_0x669e('0x56')],_0x304332['body']['type']);return db[_0x669e('0x4f')][_0x669e('0x4a')](_0x304332[_0x669e('0x4b')],{'include':[{'model':db[_0x669e('0x58')],'as':_0x669e('0x54')},{'model':db['FreshdeskField'],'as':_0x669e('0x59')}]});}return null;})[_0x669e('0x27')](respondWithResult(_0x233942,null))[_0x669e('0x47')](handleError(_0x233942,null));};exports[_0x669e('0x5a')]=function(_0x417cdf,_0x26fb61,_0x228241){var _0x5b6336='';return db[_0x669e('0x45')][_0x669e('0x4e')]({'where':{'id':_0x417cdf[_0x669e('0x4c')]['id']},'attributes':['id',_0x669e('0x5b'),_0x669e('0x5c')]})[_0x669e('0x27')](handleEntityNotFound(_0x26fb61,null))[_0x669e('0x27')](function(_0x541148){if(_0x541148){_0x5b6336=_0x541148[_0x669e('0x5b')];var _0x482e2f=_0x5b6336[_0x669e('0x5d')](-0x1);if(_0x482e2f==='/'){_0x5b6336=_0x5b6336[_0x669e('0x5e')](0x0,_0x5b6336[_0x669e('0x5f')](_0x482e2f));}return rp({'method':_0x669e('0x60'),'uri':util['format'](_0x669e('0x61'),_0x5b6336,_0x669e('0x62')),'headers':{'Authorization':util[_0x669e('0x63')](_0x669e('0x64'),new Buffer(util[_0x669e('0x63')]('%s:X',_0x541148[_0x669e('0x5c')]))['toString']('base64'))},'json':!![]});}})[_0x669e('0x27')](function(_0x3f89ab){if(_0x3f89ab){var _0x2b2df9=['requester',_0x669e('0x65'),_0x669e('0x66'),'description',_0x669e('0x1b'),_0x669e('0x67'),_0x669e('0x68'),_0x669e('0x69'),_0x669e('0x6a'),_0x669e('0x68'),'company'];_[_0x669e('0x6b')](_0x3f89ab,function(_0x2dffdf){return _0x2b2df9[_0x669e('0x6c')](_0x2dffdf[_0x669e('0x2c')])||!_0x2dffdf[_0x669e('0x6d')]&&_0x2dffdf[_0x669e('0x32')]!==_0x669e('0x6e')&&_0x2dffdf[_0x669e('0x32')]!=='custom_dropdown';});return{'count':_0x3f89ab[_0x669e('0x3a')],'rows':_[_0x669e('0x2f')](_0x3f89ab,function(_0x4dadce){return{'id':_0x4dadce['name'],'name':_0x4dadce['label'],'custom':!_0x4dadce[_0x669e('0x6d')],'options':_0x4dadce[_0x669e('0x6f')]?_['map'](_0x4dadce[_0x669e('0x6f')],function(_0x55a4d9){return{'name':_[_0x669e('0x70')](_0x55a4d9),'value':_0x55a4d9};}):[]};})};}})[_0x669e('0x27')](respondWithResult(_0x26fb61,null))[_0x669e('0x47')](function(_0x3318b9){var _0x3442cc=_0x417cdf[_0x669e('0x34')]['test']?0x1f4:_0x3318b9[_0x669e('0x71')]||0x1f4;logger[_0x669e('0x2a')](_0x669e('0x72'),_0x669e('0x5a'),_0x3442cc,JSON[_0x669e('0x73')](_0x3318b9));delete _0x3318b9[_0x669e('0x2c')];if(_0x3442cc===0x191){_0x3442cc=0x190;}_0x26fb61[_0x669e('0x1b')](_0x3442cc)[_0x669e('0x2d')](_0x417cdf['query'][_0x669e('0x74')]?{'message':_0x669e('0x75'),'statusCode':_0x3318b9[_0x669e('0x71')]}:_0x3318b9);});}; \ No newline at end of file +var _0xfecd=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','include','findAll','catch','params','includeAll','options','create','body','find','findOne','FreshdeskConfiguration','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','base64','agent','description','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','reject','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query'];(function(_0x54d563,_0x3bcd21){var _0x286af8=function(_0x202979){while(--_0x202979){_0x54d563['push'](_0x54d563['shift']());}};_0x286af8(++_0x3bcd21);}(_0xfecd,0x107));var _0xdfec=function(_0x5d0a9e,_0xc78b27){_0x5d0a9e=_0x5d0a9e-0x0;var _0x5cb880=_0xfecd[_0x5d0a9e];return _0x5cb880;};'use strict';var emlformat=require(_0xdfec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfec('0x1'));var jsonpatch=require(_0xdfec('0x2'));var rp=require('request-promise');var moment=require(_0xdfec('0x3'));var BPromise=require(_0xdfec('0x4'));var Mustache=require('mustache');var util=require(_0xdfec('0x5'));var path=require('path');var sox=require(_0xdfec('0x6'));var csv=require(_0xdfec('0x7'));var ejs=require(_0xdfec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfec('0x9'));var squel=require(_0xdfec('0xa'));var crypto=require(_0xdfec('0xb'));var jsforce=require(_0xdfec('0xc'));var deskjs=require(_0xdfec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfec('0xe'));var Papa=require(_0xdfec('0xf'));var Redis=require(_0xdfec('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdfec('0x11'));var hardwareService=require(_0xdfec('0x12'));var logger=require('../../config/logger')(_0xdfec('0x13'));var utils=require(_0xdfec('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdfec('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdfec('0x16'));function respondWithStatusCode(_0x367a3c,_0x2384f5){_0x2384f5=_0x2384f5||0xcc;return function(_0x40bba3){if(_0x40bba3){return _0x367a3c[_0xdfec('0x17')](_0x2384f5);}return _0x367a3c[_0xdfec('0x18')](_0x2384f5)[_0xdfec('0x19')]();};}function respondWithResult(_0x2ccc89,_0x4d7c6e){_0x4d7c6e=_0x4d7c6e||0xc8;return function(_0x299e43){if(_0x299e43){return _0x2ccc89[_0xdfec('0x18')](_0x4d7c6e)['json'](_0x299e43);}};}function respondWithFilteredResult(_0x420e3b,_0x53ef23){return function(_0x2fbbbb){if(_0x2fbbbb){var _0x101342=typeof _0x53ef23[_0xdfec('0x1a')]===_0xdfec('0x1b')&&typeof _0x53ef23['limit']===_0xdfec('0x1b');var _0x39a908=_0x2fbbbb[_0xdfec('0x1c')];var _0x144890=_0x101342?0x0:_0x53ef23[_0xdfec('0x1a')];var _0x5deea6=_0x101342?_0x2fbbbb['count']:_0x53ef23[_0xdfec('0x1a')]+_0x53ef23[_0xdfec('0x1d')];var _0x1d6def;if(_0x5deea6>=_0x39a908){_0x5deea6=_0x39a908;_0x1d6def=0xc8;}else{_0x1d6def=0xce;}_0x420e3b['status'](_0x1d6def);return _0x420e3b['set']('Content-Range',_0x144890+'-'+_0x5deea6+'/'+_0x39a908)['json'](_0x2fbbbb);}return null;};}function patchUpdates(_0xce9faf){return function(_0x42858f){try{jsonpatch['apply'](_0x42858f,_0xce9faf,!![]);}catch(_0xfd3f31){return BPromise[_0xdfec('0x1e')](_0xfd3f31);}return _0x42858f['save']();};}function saveUpdates(_0x23c8fd,_0x4fb633){return function(_0x2ede23){if(_0x2ede23){return _0x2ede23[_0xdfec('0x1f')](_0x23c8fd)[_0xdfec('0x20')](function(_0x1e1c81){return _0x1e1c81;});}return null;};}function removeEntity(_0x405aae,_0x3e29aa){return function(_0x412b26){if(_0x412b26){return _0x412b26[_0xdfec('0x21')]()[_0xdfec('0x20')](function(){_0x405aae[_0xdfec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c6a7,_0x511574){return function(_0x3500c6){if(!_0x3500c6){_0x16c6a7[_0xdfec('0x17')](0x194);}return _0x3500c6;};}function handleError(_0x314f98,_0x3b96f1){_0x3b96f1=_0x3b96f1||0x1f4;return function(_0xcf870a){logger[_0xdfec('0x22')](_0xcf870a[_0xdfec('0x23')]);if(_0xcf870a['name']){delete _0xcf870a[_0xdfec('0x24')];}_0x314f98[_0xdfec('0x18')](_0x3b96f1)['send'](_0xcf870a);};}exports[_0xdfec('0x25')]=function(_0x58c46b,_0x5051bd){var _0x71aeae={},_0x289b42={},_0x39b113={'count':0x0,'rows':[]};var _0x173e9b=_[_0xdfec('0x26')](db[_0xdfec('0x27')][_0xdfec('0x28')],function(_0x140bb7){return{'name':_0x140bb7[_0xdfec('0x29')],'type':_0x140bb7[_0xdfec('0x2a')][_0xdfec('0x2b')]};});_0x289b42[_0xdfec('0x2c')]=_['map'](_0x173e9b,_0xdfec('0x24'));_0x289b42[_0xdfec('0x2d')]=_[_0xdfec('0x2e')](_0x58c46b[_0xdfec('0x2d')]);_0x289b42[_0xdfec('0x2f')]=_[_0xdfec('0x30')](_0x289b42[_0xdfec('0x2c')],_0x289b42[_0xdfec('0x2d')]);_0x71aeae[_0xdfec('0x31')]=_['intersection'](_0x289b42['model'],qs[_0xdfec('0x32')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x32')]));_0x71aeae[_0xdfec('0x31')]=_0x71aeae[_0xdfec('0x31')][_0xdfec('0x33')]?_0x71aeae['attributes']:_0x289b42['model'];if(!_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x34')](_0xdfec('0x35'))){_0x71aeae[_0xdfec('0x1d')]=qs[_0xdfec('0x1d')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x1d')]);_0x71aeae[_0xdfec('0x1a')]=qs[_0xdfec('0x1a')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x1a')]);}_0x71aeae['order']=qs[_0xdfec('0x36')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x36')]);_0x71aeae['where']=qs[_0xdfec('0x2f')](_['pick'](_0x58c46b[_0xdfec('0x2d')],_0x289b42[_0xdfec('0x2f')]),_0x173e9b);if(_0x58c46b['query'][_0xdfec('0x37')]){_0x71aeae[_0xdfec('0x38')]=_[_0xdfec('0x39')](_0x71aeae[_0xdfec('0x38')],{'$or':_[_0xdfec('0x26')](_0x173e9b,function(_0x2e33b4){if(_0x2e33b4[_0xdfec('0x2a')]!==_0xdfec('0x3a')){var _0x3a033f={};_0x3a033f[_0x2e33b4[_0xdfec('0x24')]]={'$like':'%'+_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x37')]+'%'};return _0x3a033f;}})});}_0x71aeae=_[_0xdfec('0x39')]({},_0x71aeae,_0x58c46b['options']);var _0xd65b6b={'where':_0x71aeae[_0xdfec('0x38')]};return db[_0xdfec('0x27')]['count'](_0xd65b6b)[_0xdfec('0x20')](function(_0x1888d9){_0x39b113[_0xdfec('0x1c')]=_0x1888d9;if(_0x58c46b['query']['includeAll']){_0x71aeae[_0xdfec('0x3b')]=[{'all':!![]}];}return db[_0xdfec('0x27')][_0xdfec('0x3c')](_0x71aeae);})['then'](function(_0x76369b){_0x39b113['rows']=_0x76369b;return _0x39b113;})[_0xdfec('0x20')](respondWithFilteredResult(_0x5051bd,_0x71aeae))[_0xdfec('0x3d')](handleError(_0x5051bd,null));};exports['show']=function(_0x3b7dea,_0x3623bf){var _0x4bf045={'raw':![],'where':{'id':_0x3b7dea[_0xdfec('0x3e')]['id']}},_0x193a18={};_0x193a18[_0xdfec('0x2c')]=_[_0xdfec('0x2e')](db[_0xdfec('0x27')][_0xdfec('0x28')]);_0x193a18['query']=_[_0xdfec('0x2e')](_0x3b7dea[_0xdfec('0x2d')]);_0x193a18[_0xdfec('0x2f')]=_[_0xdfec('0x30')](_0x193a18[_0xdfec('0x2c')],_0x193a18[_0xdfec('0x2d')]);_0x4bf045[_0xdfec('0x31')]=_[_0xdfec('0x30')](_0x193a18[_0xdfec('0x2c')],qs[_0xdfec('0x32')](_0x3b7dea[_0xdfec('0x2d')][_0xdfec('0x32')]));_0x4bf045[_0xdfec('0x31')]=_0x4bf045[_0xdfec('0x31')]['length']?_0x4bf045[_0xdfec('0x31')]:_0x193a18[_0xdfec('0x2c')];if(_0x3b7dea['query'][_0xdfec('0x3f')]){_0x4bf045[_0xdfec('0x3b')]=[{'all':!![]}];}_0x4bf045=_[_0xdfec('0x39')]({},_0x4bf045,_0x3b7dea[_0xdfec('0x40')]);return db[_0xdfec('0x27')]['find'](_0x4bf045)[_0xdfec('0x20')](handleEntityNotFound(_0x3623bf,null))['then'](respondWithResult(_0x3623bf,null))[_0xdfec('0x3d')](handleError(_0x3623bf,null));};exports['create']=function(_0x44dfd,_0x1b6a5b){return db[_0xdfec('0x27')][_0xdfec('0x41')](_0x44dfd['body'],{})[_0xdfec('0x20')](respondWithResult(_0x1b6a5b,0xc9))[_0xdfec('0x3d')](handleError(_0x1b6a5b,null));};exports[_0xdfec('0x1f')]=function(_0x3eed23,_0x459372){if(_0x3eed23[_0xdfec('0x42')]['id']){delete _0x3eed23[_0xdfec('0x42')]['id'];}return db[_0xdfec('0x27')][_0xdfec('0x43')]({'where':{'id':_0x3eed23[_0xdfec('0x3e')]['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0x459372,null))[_0xdfec('0x20')](saveUpdates(_0x3eed23[_0xdfec('0x42')],null))[_0xdfec('0x20')](respondWithResult(_0x459372,null))[_0xdfec('0x3d')](handleError(_0x459372,null));};exports['destroy']=function(_0x339330,_0x1988d3){return db[_0xdfec('0x27')][_0xdfec('0x43')]({'where':{'id':_0x339330['params']['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0x1988d3,null))[_0xdfec('0x20')](removeEntity(_0x1988d3,null))[_0xdfec('0x3d')](handleError(_0x1988d3,null));};exports['getConfigurations']=function(_0x23c1f4,_0xd8543,_0x23679a){var _0x1c120d={};var _0x101695={};var _0xbee556;var _0x4ff22e;return db['FreshdeskAccount'][_0xdfec('0x44')]({'where':{'id':_0x23c1f4[_0xdfec('0x3e')]['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0xd8543,null))['then'](function(_0x1e815e){if(_0x1e815e){_0xbee556=_0x1e815e;_0x101695[_0xdfec('0x2c')]=_[_0xdfec('0x2e')](db[_0xdfec('0x45')][_0xdfec('0x28')]);_0x101695[_0xdfec('0x2d')]=_['keys'](_0x23c1f4['query']);_0x101695[_0xdfec('0x2f')]=_[_0xdfec('0x30')](_0x101695['model'],_0x101695[_0xdfec('0x2d')]);_0x1c120d[_0xdfec('0x31')]=_[_0xdfec('0x30')](_0x101695[_0xdfec('0x2c')],qs[_0xdfec('0x32')](_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x32')]));_0x1c120d['attributes']=_0x1c120d[_0xdfec('0x31')][_0xdfec('0x33')]?_0x1c120d[_0xdfec('0x31')]:_0x101695['model'];_0x1c120d['order']=qs[_0xdfec('0x36')](_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x36')]);_0x1c120d[_0xdfec('0x38')]=qs['filters'](_[_0xdfec('0x46')](_0x23c1f4[_0xdfec('0x2d')],_0x101695['filters']));if(_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x37')]){_0x1c120d[_0xdfec('0x38')]=_['merge'](_0x1c120d[_0xdfec('0x38')],{'$or':_[_0xdfec('0x26')](_0x1c120d['attributes'],function(_0x8f4068){var _0x4c0c0e={};_0x4c0c0e[_0x8f4068]={'$like':'%'+_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x37')]+'%'};return _0x4c0c0e;})});}_0x1c120d=_[_0xdfec('0x39')]({},_0x1c120d,_0x23c1f4[_0xdfec('0x40')]);return _0xbee556['getConfigurations'](_0x1c120d);}})[_0xdfec('0x20')](function(_0x14f67e){if(_0x14f67e){_0x4ff22e=_0x14f67e[_0xdfec('0x33')];if(!_0x23c1f4[_0xdfec('0x2d')]['hasOwnProperty'](_0xdfec('0x35'))){_0x1c120d[_0xdfec('0x1d')]=qs[_0xdfec('0x1d')](_0x23c1f4[_0xdfec('0x2d')]['limit']);_0x1c120d[_0xdfec('0x1a')]=qs[_0xdfec('0x1a')](_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x1a')]);}return _0xbee556[_0xdfec('0x47')](_0x1c120d);}})['then'](function(_0x561e6a){if(_0x561e6a){return _0x561e6a?{'count':_0x4ff22e,'rows':_0x561e6a}:null;}})['then'](respondWithResult(_0xd8543,null))['catch'](handleError(_0xd8543,null));};exports['addConfiguration']=function(_0x1fcb5b,_0x1e035a,_0x185780){if(_0x1fcb5b[_0xdfec('0x42')]['id']){delete _0x1fcb5b['body']['id'];}return db['FreshdeskAccount'][_0xdfec('0x44')]({'where':{'id':_0x1fcb5b[_0xdfec('0x3e')]['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0x1e035a,null))[_0xdfec('0x20')](function(_0x275380){if(_0x275380){_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x48')]=_0x275380['id'];_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x49')]=integrations[_0xdfec('0x4a')](_0x1fcb5b['body'][_0xdfec('0x4b')],_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x2a')]);_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x4c')]=integrations[_0xdfec('0x4d')](_0x1fcb5b['body']['channel'],_0x1fcb5b['body'][_0xdfec('0x2a')]);return db[_0xdfec('0x45')]['create'](_0x1fcb5b[_0xdfec('0x42')],{'include':[{'model':db['FreshdeskField'],'as':_0xdfec('0x49')},{'model':db['FreshdeskField'],'as':_0xdfec('0x4c')}]});}return null;})[_0xdfec('0x20')](respondWithResult(_0x1e035a,null))[_0xdfec('0x3d')](handleError(_0x1e035a,null));};exports[_0xdfec('0x4e')]=function(_0x442708,_0x58765f,_0x2fd12b){var _0x279e5d='';return db['FreshdeskAccount'][_0xdfec('0x44')]({'where':{'id':_0x442708['params']['id']},'attributes':['id',_0xdfec('0x4f'),_0xdfec('0x50')]})[_0xdfec('0x20')](handleEntityNotFound(_0x58765f,null))[_0xdfec('0x20')](function(_0x3cb925){if(_0x3cb925){_0x279e5d=_0x3cb925['remoteUri'];var _0x3aded3=_0x279e5d[_0xdfec('0x51')](-0x1);if(_0x3aded3==='/'){_0x279e5d=_0x279e5d[_0xdfec('0x52')](0x0,_0x279e5d['lastIndexOf'](_0x3aded3));}return rp({'method':_0xdfec('0x53'),'uri':util[_0xdfec('0x54')]('%s/%s',_0x279e5d,_0xdfec('0x55')),'headers':{'Authorization':util[_0xdfec('0x54')](_0xdfec('0x56'),new Buffer(util[_0xdfec('0x54')]('%s:X',_0x3cb925['apiKey']))['toString'](_0xdfec('0x57')))},'json':!![]});}})[_0xdfec('0x20')](function(_0x18ef90){if(_0x18ef90){var _0x5c76b7=['requester','subject',_0xdfec('0x58'),_0xdfec('0x59'),_0xdfec('0x18'),'priority',_0xdfec('0x5a'),_0xdfec('0x5b'),'ticket_type',_0xdfec('0x5a'),_0xdfec('0x5c')];_[_0xdfec('0x5d')](_0x18ef90,function(_0x1baa22){return _0x5c76b7[_0xdfec('0x5e')](_0x1baa22[_0xdfec('0x24')])||!_0x1baa22[_0xdfec('0x5f')]&&_0x1baa22[_0xdfec('0x2a')]!==_0xdfec('0x60')&&_0x1baa22[_0xdfec('0x2a')]!==_0xdfec('0x61');});return{'count':_0x18ef90[_0xdfec('0x33')],'rows':_[_0xdfec('0x26')](_0x18ef90,function(_0x50568d){return{'id':_0x50568d[_0xdfec('0x24')],'name':_0x50568d[_0xdfec('0x62')],'custom':!_0x50568d['default'],'options':_0x50568d['choices']?_[_0xdfec('0x26')](_0x50568d[_0xdfec('0x63')],function(_0xcbdf51){return{'name':_[_0xdfec('0x64')](_0xcbdf51),'value':_0xcbdf51};}):[]};})};}})[_0xdfec('0x20')](respondWithResult(_0x58765f,null))[_0xdfec('0x3d')](function(_0x2f0195){var _0x2b5397=_0x442708[_0xdfec('0x2d')]['test']?0x1f4:_0x2f0195[_0xdfec('0x65')]||0x1f4;logger[_0xdfec('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2b5397,JSON['stringify'](_0x2f0195));delete _0x2f0195[_0xdfec('0x24')];if(_0x2b5397===0x191){_0x2b5397=0x190;}_0x58765f[_0xdfec('0x18')](_0x2b5397)['send'](_0x442708[_0xdfec('0x2d')][_0xdfec('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x2f0195['statusCode']}:_0x2f0195);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ef57928..fff1840 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 _0x63de=['int_freshdesk_accounts','lodash','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x63de,0x1e1));var _0xe63d=function(_0x5d1bb0,_0x1791c8){_0x5d1bb0=_0x5d1bb0-0x0;var _0x49163b=_0x63de[_0x5d1bb0];return _0x49163b;};'use strict';var _=require(_0xe63d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe63d('0x1'));var BPromise=require(_0xe63d('0x2'));var rp=require(_0xe63d('0x3'));var fs=require('fs');var path=require(_0xe63d('0x4'));var rimraf=require(_0xe63d('0x5'));var config=require('../../config/environment');var attributes=require(_0xe63d('0x6'));var integrations=require(_0xe63d('0x7'));module[_0xe63d('0x8')]=function(_0x2e3762,_0x23df4b){return _0x2e3762[_0xe63d('0x9')](_0xe63d('0xa'),attributes,{'tableName':_0xe63d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70f6=['../../config/environment','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','request-promise','path','rimraf'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x70f6,0x15a));var _0x670f=function(_0x372189,_0x718c8e){_0x372189=_0x372189-0x0;var _0x8b9904=_0x70f6[_0x372189];return _0x8b9904;};'use strict';var _=require(_0x670f('0x0'));var util=require(_0x670f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x670f('0x2'));var BPromise=require('bluebird');var rp=require(_0x670f('0x3'));var fs=require('fs');var path=require(_0x670f('0x4'));var rimraf=require(_0x670f('0x5'));var config=require(_0x670f('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x670f('0x7')]=function(_0x3a0bd5,_0x71f913){return _0x3a0bd5[_0x670f('0x8')](_0x670f('0x9'),attributes,{'tableName':_0x670f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index b645e97..c4e687a 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 _0xcf8e=['../../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','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','limit','include','map','model','ShowFreshdeskAccount','find','raw','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf8e,0x160));var _0xecf8=function(_0x4f9094,_0x7fde8a){_0x4f9094=_0x4f9094-0x0;var _0x5b9cae=_0xcf8e[_0x4f9094];return _0x5b9cae;};'use strict';var _=require(_0xecf8('0x0'));var util=require(_0xecf8('0x1'));var moment=require(_0xecf8('0x2'));var BPromise=require(_0xecf8('0x3'));var rs=require(_0xecf8('0x4'));var fs=require('fs');var Redis=require(_0xecf8('0x5'));var db=require(_0xecf8('0x6'))['db'];var utils=require(_0xecf8('0x7'));var logger=require(_0xecf8('0x8'))(_0xecf8('0x9'));var config=require(_0xecf8('0xa'));var jayson=require(_0xecf8('0xb'));var client=jayson[_0xecf8('0xc')][_0xecf8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4628f7,_0xcfa053,_0x60d3ed){return new BPromise(function(_0x459a07,_0x43eb1f){return client[_0xecf8('0xe')](_0x4628f7,_0x60d3ed)[_0xecf8('0xf')](function(_0x47400c){logger[_0xecf8('0x10')](_0xecf8('0x11'),_0xcfa053,_0xecf8('0x12'));logger[_0xecf8('0x13')](_0xecf8('0x14'),_0xcfa053,_0xecf8('0x12'),JSON[_0xecf8('0x15')](_0x47400c));if(_0x47400c[_0xecf8('0x16')]){if(_0x47400c[_0xecf8('0x16')][_0xecf8('0x17')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0xcfa053,_0x47400c[_0xecf8('0x16')][_0xecf8('0x18')]);return _0x43eb1f(_0x47400c[_0xecf8('0x16')][_0xecf8('0x18')]);}logger[_0xecf8('0x16')](_0xecf8('0x11'),_0xcfa053,_0x47400c['error']['message']);return _0x459a07(_0x47400c['error']['message']);}else{logger[_0xecf8('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xcfa053,_0xecf8('0x12'));_0x459a07(_0x47400c[_0xecf8('0x19')][_0xecf8('0x18')]);}})['catch'](function(_0x1a00e4){logger[_0xecf8('0x16')](_0xecf8('0x11'),_0xcfa053,_0x1a00e4);_0x43eb1f(_0x1a00e4);});});}exports[_0xecf8('0x1a')]=function(_0x1e3c9e){var _0x4a1d03=this;return new Promise(function(_0x381a09,_0x934291){return db[_0xecf8('0x1b')][_0xecf8('0x1c')]({'raw':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e[_0xecf8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e[_0xecf8('0x1d')]['where']||null:null,'attributes':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e['options'][_0xecf8('0x1e')]||null:null,'limit':_0x1e3c9e['options']?_0x1e3c9e[_0xecf8('0x1d')][_0xecf8('0x1f')]||null:null,'include':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e[_0xecf8('0x1d')][_0xecf8('0x20')]?_[_0xecf8('0x21')](_0x1e3c9e[_0xecf8('0x1d')][_0xecf8('0x20')],function(_0x1d140c){return{'model':db[_0x1d140c[_0xecf8('0x22')]],'as':_0x1d140c['as'],'attributes':_0x1d140c[_0xecf8('0x1e')],'include':_0x1d140c[_0xecf8('0x20')]?_[_0xecf8('0x21')](_0x1d140c['include'],function(_0x57b5ab){return{'model':db[_0x57b5ab[_0xecf8('0x22')]],'as':_0x57b5ab['as'],'attributes':_0x57b5ab[_0xecf8('0x1e')],'include':_0x57b5ab['include']?_[_0xecf8('0x21')](_0x57b5ab[_0xecf8('0x20')],function(_0x325a40){return{'model':db[_0x325a40[_0xecf8('0x22')]],'as':_0x325a40['as'],'attributes':_0x325a40[_0xecf8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13f4b1){logger[_0xecf8('0x10')](_0xecf8('0x1a'),_0x1e3c9e);logger['debug'](_0xecf8('0x1a'),_0x1e3c9e,JSON['stringify'](_0x13f4b1));_0x381a09(_0x13f4b1);})['catch'](function(_0x4731b6){logger[_0xecf8('0x16')](_0xecf8('0x1a'),_0x4731b6['message'],_0x1e3c9e);_0x934291(_0x4a1d03[_0xecf8('0x16')](0x1f4,_0x4731b6[_0xecf8('0x18')]));});});};exports[_0xecf8('0x23')]=function(_0x7d60f){var _0x5662b1=this;return new Promise(function(_0x1ed780,_0x204a6c){return db['FreshdeskAccount'][_0xecf8('0x24')]({'raw':_0x7d60f['options']?_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x25')]===undefined?!![]:![]:!![],'where':_0x7d60f[_0xecf8('0x1d')]?_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x26')]||null:null,'attributes':_0x7d60f['options']?_0x7d60f[_0xecf8('0x1d')]['attributes']||null:null,'include':_0x7d60f[_0xecf8('0x1d')]?_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x20')]?_['map'](_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x20')],function(_0x4bab6e){return{'model':db[_0x4bab6e[_0xecf8('0x22')]],'as':_0x4bab6e['as'],'attributes':_0x4bab6e[_0xecf8('0x1e')],'include':_0x4bab6e[_0xecf8('0x20')]?_[_0xecf8('0x21')](_0x4bab6e[_0xecf8('0x20')],function(_0x46938e){return{'model':db[_0x46938e[_0xecf8('0x22')]],'as':_0x46938e['as'],'attributes':_0x46938e[_0xecf8('0x1e')],'include':_0x46938e[_0xecf8('0x20')]?_['map'](_0x46938e[_0xecf8('0x20')],function(_0x320fab){return{'model':db[_0x320fab[_0xecf8('0x22')]],'as':_0x320fab['as'],'attributes':_0x320fab[_0xecf8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xecf8('0xf')](function(_0x1faa15){logger[_0xecf8('0x10')](_0xecf8('0x23'),_0x7d60f);logger[_0xecf8('0x13')](_0xecf8('0x23'),_0x7d60f,JSON['stringify'](_0x1faa15));_0x1ed780(_0x1faa15);})[_0xecf8('0x27')](function(_0x5b6c8a){logger[_0xecf8('0x16')](_0xecf8('0x23'),_0x5b6c8a[_0xecf8('0x18')],_0x7d60f);_0x204a6c(_0x5662b1[_0xecf8('0x16')](0x1f4,_0x5b6c8a[_0xecf8('0x18')]));});});}; \ No newline at end of file +var _0x1301=['options','raw','where','attributes','limit','include','map','model','info','ShowFreshdeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x468c3d,_0x4cb0c8){var _0x461549=function(_0x5a16a8){while(--_0x5a16a8){_0x468c3d['push'](_0x468c3d['shift']());}};_0x461549(++_0x4cb0c8);}(_0x1301,0x70));var _0x1130=function(_0x4c1e34,_0x1f0407){_0x4c1e34=_0x4c1e34-0x0;var _0x1329e2=_0x1301[_0x4c1e34];return _0x1329e2;};'use strict';var _=require(_0x1130('0x0'));var util=require(_0x1130('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1130('0x2'));var fs=require('fs');var Redis=require(_0x1130('0x3'));var db=require(_0x1130('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1130('0x5'));var config=require(_0x1130('0x6'));var jayson=require(_0x1130('0x7'));var client=jayson[_0x1130('0x8')][_0x1130('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x162abb,_0x9ec7ae,_0x4e02bb){return new BPromise(function(_0x52bdfd,_0x46c21e){return client[_0x1130('0xa')](_0x162abb,_0x4e02bb)[_0x1130('0xb')](function(_0x4ea84e){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x9ec7ae,'request\x20sent');logger[_0x1130('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x9ec7ae,'request\x20sent',JSON[_0x1130('0xd')](_0x4ea84e));if(_0x4ea84e[_0x1130('0xe')]){if(_0x4ea84e[_0x1130('0xe')][_0x1130('0xf')]===0x1f4){logger[_0x1130('0xe')](_0x1130('0x10'),_0x9ec7ae,_0x4ea84e[_0x1130('0xe')][_0x1130('0x11')]);return _0x46c21e(_0x4ea84e[_0x1130('0xe')][_0x1130('0x11')]);}logger['error'](_0x1130('0x10'),_0x9ec7ae,_0x4ea84e['error']['message']);return _0x52bdfd(_0x4ea84e[_0x1130('0xe')]['message']);}else{logger['info'](_0x1130('0x10'),_0x9ec7ae,_0x1130('0x12'));_0x52bdfd(_0x4ea84e[_0x1130('0x13')][_0x1130('0x11')]);}})[_0x1130('0x14')](function(_0x28b4a9){logger[_0x1130('0xe')](_0x1130('0x10'),_0x9ec7ae,_0x28b4a9);_0x46c21e(_0x28b4a9);});});}exports[_0x1130('0x15')]=function(_0xb87101){var _0x59fa07=this;return new Promise(function(_0x52567e,_0x1ef6dd){return db[_0x1130('0x16')][_0x1130('0x17')]({'raw':_0xb87101[_0x1130('0x18')]?_0xb87101['options'][_0x1130('0x19')]===undefined?!![]:![]:!![],'where':_0xb87101[_0x1130('0x18')]?_0xb87101[_0x1130('0x18')][_0x1130('0x1a')]||null:null,'attributes':_0xb87101[_0x1130('0x18')]?_0xb87101[_0x1130('0x18')][_0x1130('0x1b')]||null:null,'limit':_0xb87101[_0x1130('0x18')]?_0xb87101[_0x1130('0x18')][_0x1130('0x1c')]||null:null,'include':_0xb87101['options']?_0xb87101['options'][_0x1130('0x1d')]?_['map'](_0xb87101[_0x1130('0x18')][_0x1130('0x1d')],function(_0x4b75be){return{'model':db[_0x4b75be['model']],'as':_0x4b75be['as'],'attributes':_0x4b75be['attributes'],'include':_0x4b75be[_0x1130('0x1d')]?_[_0x1130('0x1e')](_0x4b75be[_0x1130('0x1d')],function(_0x80850b){return{'model':db[_0x80850b[_0x1130('0x1f')]],'as':_0x80850b['as'],'attributes':_0x80850b[_0x1130('0x1b')],'include':_0x80850b[_0x1130('0x1d')]?_[_0x1130('0x1e')](_0x80850b[_0x1130('0x1d')],function(_0x5e3060){return{'model':db[_0x5e3060[_0x1130('0x1f')]],'as':_0x5e3060['as'],'attributes':_0x5e3060[_0x1130('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e139){logger[_0x1130('0x20')](_0x1130('0x15'),_0xb87101);logger['debug'](_0x1130('0x15'),_0xb87101,JSON[_0x1130('0xd')](_0x10e139));_0x52567e(_0x10e139);})[_0x1130('0x14')](function(_0x50f07f){logger[_0x1130('0xe')]('GetFreshdeskAccount',_0x50f07f[_0x1130('0x11')],_0xb87101);_0x1ef6dd(_0x59fa07['error'](0x1f4,_0x50f07f[_0x1130('0x11')]));});});};exports[_0x1130('0x21')]=function(_0x57d562){var _0x8981c9=this;return new Promise(function(_0x3d560a,_0x23513c){return db['FreshdeskAccount']['find']({'raw':_0x57d562['options']?_0x57d562[_0x1130('0x18')][_0x1130('0x19')]===undefined?!![]:![]:!![],'where':_0x57d562[_0x1130('0x18')]?_0x57d562[_0x1130('0x18')][_0x1130('0x1a')]||null:null,'attributes':_0x57d562[_0x1130('0x18')]?_0x57d562[_0x1130('0x18')][_0x1130('0x1b')]||null:null,'include':_0x57d562['options']?_0x57d562[_0x1130('0x18')][_0x1130('0x1d')]?_[_0x1130('0x1e')](_0x57d562[_0x1130('0x18')][_0x1130('0x1d')],function(_0x3c029b){return{'model':db[_0x3c029b[_0x1130('0x1f')]],'as':_0x3c029b['as'],'attributes':_0x3c029b[_0x1130('0x1b')],'include':_0x3c029b[_0x1130('0x1d')]?_['map'](_0x3c029b[_0x1130('0x1d')],function(_0x62fbb3){return{'model':db[_0x62fbb3[_0x1130('0x1f')]],'as':_0x62fbb3['as'],'attributes':_0x62fbb3[_0x1130('0x1b')],'include':_0x62fbb3[_0x1130('0x1d')]?_['map'](_0x62fbb3[_0x1130('0x1d')],function(_0x18ae1a){return{'model':db[_0x18ae1a['model']],'as':_0x18ae1a['as'],'attributes':_0x18ae1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1130('0xb')](function(_0x3196d0){logger[_0x1130('0x20')]('ShowFreshdeskAccount',_0x57d562);logger[_0x1130('0xc')](_0x1130('0x21'),_0x57d562,JSON['stringify'](_0x3196d0));_0x3d560a(_0x3196d0);})[_0x1130('0x14')](function(_0x2b5faf){logger[_0x1130('0xe')]('ShowFreshdeskAccount',_0x2b5faf[_0x1130('0x11')],_0x57d562);_0x23513c(_0x8981c9[_0x1130('0xe')](0x1f4,_0x2b5faf[_0x1130('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 76450d5..f469838 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 _0xd01c=['../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x53d99f,_0x4caba7){var _0x1ee367=function(_0x30d961){while(--_0x30d961){_0x53d99f['push'](_0x53d99f['shift']());}};_0x1ee367(++_0x4caba7);}(_0xd01c,0xf3));var _0xcd01=function(_0x21e714,_0x1e9068){_0x21e714=_0x21e714-0x0;var _0x784844=_0xd01c[_0x21e714];return _0x784844;};'use strict';var multer=require(_0xcd01('0x0'));var util=require(_0xcd01('0x1'));var path=require(_0xcd01('0x2'));var timeout=require(_0xcd01('0x3'));var express=require(_0xcd01('0x4'));var router=express[_0xcd01('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcd01('0x6'));var interaction=require(_0xcd01('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xcd01('0x8')]('/',auth[_0xcd01('0x9')](),controller[_0xcd01('0xa')]);router['get'](_0xcd01('0xb'),auth[_0xcd01('0x9')](),controller['show']);router[_0xcd01('0x8')](_0xcd01('0xc'),auth[_0xcd01('0x9')](),controller[_0xcd01('0xd')]);router[_0xcd01('0x8')](_0xcd01('0xe'),auth[_0xcd01('0x9')](),controller[_0xcd01('0xf')]);router['get']('/:id/descriptions',auth[_0xcd01('0x9')](),controller[_0xcd01('0x10')]);router[_0xcd01('0x8')](_0xcd01('0x11'),auth['isAuthenticated'](),controller[_0xcd01('0x12')]);router[_0xcd01('0x13')]('/',auth[_0xcd01('0x9')](),controller[_0xcd01('0x14')]);router[_0xcd01('0x13')](_0xcd01('0x11'),auth[_0xcd01('0x9')](),controller[_0xcd01('0x15')]);router[_0xcd01('0x16')](_0xcd01('0xb'),auth['isAuthenticated'](),controller[_0xcd01('0x17')]);router['delete'](_0xcd01('0xb'),auth[_0xcd01('0x9')](),controller['destroy']);module[_0xcd01('0x18')]=router; \ No newline at end of file +var _0x75ba=['connect-timeout','express','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','multer','util'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x75ba,0xb4));var _0xa75b=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0x75ba[_0x3d9b04];return _0x557936;};'use strict';var multer=require(_0xa75b('0x0'));var util=require(_0xa75b('0x1'));var path=require('path');var timeout=require(_0xa75b('0x2'));var express=require(_0xa75b('0x3'));var router=express['Router']();var fs_extra=require(_0xa75b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa75b('0x5'));var controller=require(_0xa75b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa75b('0x7')]);router[_0xa75b('0x8')](_0xa75b('0x9'),auth[_0xa75b('0xa')](),controller[_0xa75b('0xb')]);router[_0xa75b('0x8')](_0xa75b('0xc'),auth['isAuthenticated'](),controller[_0xa75b('0xd')]);router['get'](_0xa75b('0xe'),auth['isAuthenticated'](),controller[_0xa75b('0xf')]);router['get'](_0xa75b('0x10'),auth['isAuthenticated'](),controller[_0xa75b('0x11')]);router[_0xa75b('0x8')](_0xa75b('0x12'),auth[_0xa75b('0xa')](),controller[_0xa75b('0x13')]);router[_0xa75b('0x14')]('/',auth[_0xa75b('0xa')](),controller['create']);router[_0xa75b('0x14')](_0xa75b('0x12'),auth[_0xa75b('0xa')](),controller[_0xa75b('0x15')]);router['put']('/:id',auth[_0xa75b('0xa')](),controller[_0xa75b('0x16')]);router[_0xa75b('0x17')]('/:id',auth[_0xa75b('0xa')](),controller[_0xa75b('0x18')]);module[_0xa75b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 76f23d7..3905a93 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 _0x9fc5=['sequelize','exports','STRING'];(function(_0x4631eb,_0x55649e){var _0x562eca=function(_0x25a436){while(--_0x25a436){_0x4631eb['push'](_0x4631eb['shift']());}};_0x562eca(++_0x55649e);}(_0x9fc5,0x129));var _0x59fc=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0x9fc5[_0x5400a1];return _0x4006c7;};'use strict';var Sequelize=require(_0x59fc('0x0'));module[_0x59fc('0x1')]={'name':{'type':Sequelize[_0x59fc('0x2')]},'description':{'type':Sequelize[_0x59fc('0x2')]}}; \ No newline at end of file +var _0xf1a1=['sequelize','exports','STRING'];(function(_0xbb629c,_0x36b5fe){var _0x27e55b=function(_0x7187f6){while(--_0x7187f6){_0xbb629c['push'](_0xbb629c['shift']());}};_0x27e55b(++_0x36b5fe);}(_0xf1a1,0x96));var _0x1f1a=function(_0x2c1518,_0x4f4129){_0x2c1518=_0x2c1518-0x0;var _0x2b7a3a=_0xf1a1[_0x2c1518];return _0x2b7a3a;};'use strict';var Sequelize=require(_0x1f1a('0x0'));module[_0x1f1a('0x1')]={'name':{'type':Sequelize[_0x1f1a('0x2')]},'description':{'type':Sequelize[_0x1f1a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 0d8b7b4..9aef6a0 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 _0x6521=['model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','type','merge','options','FreshdeskConfiguration','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','FreshdeskField','length','getSubjects','order','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x401a6a,_0xc31476){var _0x4176a8=function(_0x370f90){while(--_0x370f90){_0x401a6a['push'](_0x401a6a['shift']());}};_0x4176a8(++_0xc31476);}(_0x6521,0x1ba));var _0x1652=function(_0x2e0720,_0x2c3ea2){_0x2e0720=_0x2e0720-0x0;var _0xf36159=_0x6521[_0x2e0720];return _0xf36159;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1652('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1652('0x1'));var rp=require(_0x1652('0x2'));var moment=require(_0x1652('0x3'));var BPromise=require(_0x1652('0x4'));var Mustache=require(_0x1652('0x5'));var util=require(_0x1652('0x6'));var path=require(_0x1652('0x7'));var sox=require(_0x1652('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1652('0x9'));var _=require(_0x1652('0xa'));var squel=require(_0x1652('0xb'));var crypto=require(_0x1652('0xc'));var jsforce=require(_0x1652('0xd'));var deskjs=require(_0x1652('0xe'));var toCsv=require(_0x1652('0xf'));var querystring=require(_0x1652('0x10'));var Papa=require('papaparse');var Redis=require(_0x1652('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1652('0x12'));var as=require(_0x1652('0x13'));var hardwareService=require(_0x1652('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1652('0x15'));var db=require(_0x1652('0x16'))['db'];function respondWithStatusCode(_0x1d40db,_0x46da5d){_0x46da5d=_0x46da5d||0xcc;return function(_0x48bf42){if(_0x48bf42){return _0x1d40db[_0x1652('0x17')](_0x46da5d);}return _0x1d40db[_0x1652('0x18')](_0x46da5d)['end']();};}function respondWithResult(_0x2f700f,_0xa965d9){_0xa965d9=_0xa965d9||0xc8;return function(_0x3363a4){if(_0x3363a4){return _0x2f700f[_0x1652('0x18')](_0xa965d9)[_0x1652('0x19')](_0x3363a4);}};}function respondWithFilteredResult(_0x1c9bd7,_0x19bf6b){return function(_0x289771){if(_0x289771){var _0xb2be3c=typeof _0x19bf6b[_0x1652('0x1a')]===_0x1652('0x1b')&&typeof _0x19bf6b[_0x1652('0x1c')]==='undefined';var _0x28df1f=_0x289771['count'];var _0x51876c=_0xb2be3c?0x0:_0x19bf6b[_0x1652('0x1a')];var _0x1e7614=_0xb2be3c?_0x289771['count']:_0x19bf6b['offset']+_0x19bf6b[_0x1652('0x1c')];var _0x48cec1;if(_0x1e7614>=_0x28df1f){_0x1e7614=_0x28df1f;_0x48cec1=0xc8;}else{_0x48cec1=0xce;}_0x1c9bd7[_0x1652('0x18')](_0x48cec1);return _0x1c9bd7[_0x1652('0x1d')]('Content-Range',_0x51876c+'-'+_0x1e7614+'/'+_0x28df1f)[_0x1652('0x19')](_0x289771);}return null;};}function patchUpdates(_0x58ea9b){return function(_0x159a03){try{jsonpatch['apply'](_0x159a03,_0x58ea9b,!![]);}catch(_0x462cfe){return BPromise[_0x1652('0x1e')](_0x462cfe);}return _0x159a03[_0x1652('0x1f')]();};}function saveUpdates(_0x510fdb,_0x325cdd){return function(_0x384476){if(_0x384476){return _0x384476[_0x1652('0x20')](_0x510fdb)[_0x1652('0x21')](function(_0x1d9ca0){return _0x1d9ca0;});}return null;};}function removeEntity(_0x29adf2,_0x3af64b){return function(_0x532350){if(_0x532350){return _0x532350[_0x1652('0x22')]()[_0x1652('0x21')](function(){_0x29adf2['status'](0xcc)[_0x1652('0x23')]();});}};}function handleEntityNotFound(_0x1c048e,_0x56cdbf){return function(_0x363605){if(!_0x363605){_0x1c048e[_0x1652('0x17')](0x194);}return _0x363605;};}function handleError(_0x420a8d,_0x476716){_0x476716=_0x476716||0x1f4;return function(_0x4a3325){logger['error'](_0x4a3325[_0x1652('0x24')]);if(_0x4a3325[_0x1652('0x25')]){delete _0x4a3325[_0x1652('0x25')];}_0x420a8d[_0x1652('0x18')](_0x476716)[_0x1652('0x26')](_0x4a3325);};}exports[_0x1652('0x27')]=function(_0x371993,_0x4dc067){var _0x587327={},_0x58331b={},_0x31a0e9={'count':0x0,'rows':[]};var _0x36e764=_[_0x1652('0x28')](db['FreshdeskConfiguration'][_0x1652('0x29')],function(_0x2e1a7b){return{'name':_0x2e1a7b[_0x1652('0x2a')],'type':_0x2e1a7b['type'][_0x1652('0x2b')]};});_0x58331b[_0x1652('0x2c')]=_[_0x1652('0x28')](_0x36e764,_0x1652('0x25'));_0x58331b[_0x1652('0x2d')]=_[_0x1652('0x2e')](_0x371993[_0x1652('0x2d')]);_0x58331b['filters']=_[_0x1652('0x2f')](_0x58331b['model'],_0x58331b[_0x1652('0x2d')]);_0x587327['attributes']=_['intersection'](_0x58331b[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x371993[_0x1652('0x2d')][_0x1652('0x30')]));_0x587327['attributes']=_0x587327[_0x1652('0x31')]['length']?_0x587327[_0x1652('0x31')]:_0x58331b['model'];if(!_0x371993[_0x1652('0x2d')][_0x1652('0x32')](_0x1652('0x33'))){_0x587327[_0x1652('0x1c')]=qs['limit'](_0x371993[_0x1652('0x2d')]['limit']);_0x587327[_0x1652('0x1a')]=qs[_0x1652('0x1a')](_0x371993[_0x1652('0x2d')][_0x1652('0x1a')]);}_0x587327['order']=qs[_0x1652('0x34')](_0x371993['query'][_0x1652('0x34')]);_0x587327[_0x1652('0x35')]=qs['filters'](_['pick'](_0x371993[_0x1652('0x2d')],_0x58331b[_0x1652('0x36')]),_0x36e764);if(_0x371993[_0x1652('0x2d')][_0x1652('0x37')]){_0x587327['where']=_['merge'](_0x587327[_0x1652('0x35')],{'$or':_[_0x1652('0x28')](_0x36e764,function(_0x12cb32){if(_0x12cb32[_0x1652('0x38')]!=='VIRTUAL'){var _0x50bba2={};_0x50bba2[_0x12cb32[_0x1652('0x25')]]={'$like':'%'+_0x371993[_0x1652('0x2d')]['filter']+'%'};return _0x50bba2;}})});}_0x587327=_[_0x1652('0x39')]({},_0x587327,_0x371993[_0x1652('0x3a')]);var _0x273766={'where':_0x587327[_0x1652('0x35')]};return db[_0x1652('0x3b')][_0x1652('0x3c')](_0x273766)[_0x1652('0x21')](function(_0x265956){_0x31a0e9['count']=_0x265956;if(_0x371993['query'][_0x1652('0x3d')]){_0x587327[_0x1652('0x3e')]=[{'all':!![]}];}return db[_0x1652('0x3b')][_0x1652('0x3f')](_0x587327);})[_0x1652('0x21')](function(_0x3649e9){_0x31a0e9[_0x1652('0x40')]=_0x3649e9;return _0x31a0e9;})[_0x1652('0x21')](respondWithFilteredResult(_0x4dc067,_0x587327))[_0x1652('0x41')](handleError(_0x4dc067,null));};exports[_0x1652('0x42')]=function(_0x5072b5,_0x284b7b){var _0x50dafc={'raw':![],'where':{'id':_0x5072b5[_0x1652('0x43')]['id']}},_0x57192f={};_0x57192f[_0x1652('0x2c')]=_[_0x1652('0x2e')](db[_0x1652('0x3b')][_0x1652('0x29')]);_0x57192f[_0x1652('0x2d')]=_['keys'](_0x5072b5[_0x1652('0x2d')]);_0x57192f[_0x1652('0x36')]=_['intersection'](_0x57192f['model'],_0x57192f['query']);_0x50dafc[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x57192f[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x5072b5[_0x1652('0x2d')]['fields']));_0x50dafc[_0x1652('0x31')]=_0x50dafc[_0x1652('0x31')]['length']?_0x50dafc['attributes']:_0x57192f['model'];if(_0x5072b5['query'][_0x1652('0x3d')]){_0x50dafc['include']=[{'all':!![]}];}_0x50dafc=_['merge']({},_0x50dafc,_0x5072b5['options']);return db[_0x1652('0x3b')][_0x1652('0x44')](_0x50dafc)[_0x1652('0x21')](handleEntityNotFound(_0x284b7b,null))[_0x1652('0x21')](respondWithResult(_0x284b7b,null))[_0x1652('0x41')](handleError(_0x284b7b,null));};exports[_0x1652('0x45')]=function(_0x3e26d6,_0xdd6cd5){return db[_0x1652('0x3b')][_0x1652('0x45')](_0x3e26d6[_0x1652('0x46')],{})[_0x1652('0x21')](respondWithResult(_0xdd6cd5,0xc9))[_0x1652('0x41')](handleError(_0xdd6cd5,null));};exports['update']=function(_0x3e8cb7,_0x126e6b){if(_0x3e8cb7['body']['id']){delete _0x3e8cb7['body']['id'];}return db[_0x1652('0x3b')]['find']({'where':{'id':_0x3e8cb7['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x126e6b,null))['then'](saveUpdates(_0x3e8cb7['body'],null))[_0x1652('0x21')](respondWithResult(_0x126e6b,null))['catch'](handleError(_0x126e6b,null));};exports[_0x1652('0x22')]=function(_0x1cdcfb,_0x5710fa){return db['FreshdeskConfiguration'][_0x1652('0x44')]({'where':{'id':_0x1cdcfb[_0x1652('0x43')]['id']}})['then'](handleEntityNotFound(_0x5710fa,null))[_0x1652('0x21')](removeEntity(_0x5710fa,null))[_0x1652('0x41')](handleError(_0x5710fa,null));};exports[_0x1652('0x47')]=function(_0x5c6937,_0x48e70b,_0x2e7faa){var _0x36d4b3={};var _0x3e84b9={};var _0x5ac3a4;var _0x204882;return db[_0x1652('0x3b')][_0x1652('0x48')]({'where':{'id':_0x5c6937['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x48e70b,null))[_0x1652('0x21')](function(_0x4af405){if(_0x4af405){_0x5ac3a4=_0x4af405;_0x3e84b9['model']=_[_0x1652('0x2e')](db[_0x1652('0x49')][_0x1652('0x29')]);_0x3e84b9['query']=_[_0x1652('0x2e')](_0x5c6937[_0x1652('0x2d')]);_0x3e84b9['filters']=_[_0x1652('0x2f')](_0x3e84b9[_0x1652('0x2c')],_0x3e84b9['query']);_0x36d4b3['attributes']=_[_0x1652('0x2f')](_0x3e84b9[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x5c6937[_0x1652('0x2d')]['fields']));_0x36d4b3[_0x1652('0x31')]=_0x36d4b3[_0x1652('0x31')][_0x1652('0x4a')]?_0x36d4b3[_0x1652('0x31')]:_0x3e84b9[_0x1652('0x2c')];_0x36d4b3['order']=qs['sort'](_0x5c6937[_0x1652('0x2d')][_0x1652('0x34')]);_0x36d4b3[_0x1652('0x35')]=qs[_0x1652('0x36')](_['pick'](_0x5c6937['query'],_0x3e84b9[_0x1652('0x36')]));if(_0x5c6937[_0x1652('0x2d')]['filter']){_0x36d4b3['where']=_['merge'](_0x36d4b3[_0x1652('0x35')],{'$or':_['map'](_0x36d4b3['attributes'],function(_0x32ef6f){var _0x135969={};_0x135969[_0x32ef6f]={'$like':'%'+_0x5c6937[_0x1652('0x2d')][_0x1652('0x37')]+'%'};return _0x135969;})});}_0x36d4b3=_[_0x1652('0x39')]({},_0x36d4b3,_0x5c6937['options']);return _0x5ac3a4[_0x1652('0x47')](_0x36d4b3);}})['then'](function(_0x3f9854){if(_0x3f9854){_0x204882=_0x3f9854[_0x1652('0x4a')];if(!_0x5c6937[_0x1652('0x2d')][_0x1652('0x32')](_0x1652('0x33'))){_0x36d4b3['limit']=qs[_0x1652('0x1c')](_0x5c6937[_0x1652('0x2d')]['limit']);_0x36d4b3[_0x1652('0x1a')]=qs[_0x1652('0x1a')](_0x5c6937[_0x1652('0x2d')][_0x1652('0x1a')]);}return _0x5ac3a4['getFields'](_0x36d4b3);}})[_0x1652('0x21')](function(_0x4f93a5){if(_0x4f93a5){return _0x4f93a5?{'count':_0x204882,'rows':_0x4f93a5}:null;}})[_0x1652('0x21')](respondWithResult(_0x48e70b,null))[_0x1652('0x41')](handleError(_0x48e70b,null));};exports[_0x1652('0x4b')]=function(_0x4159f9,_0x330599,_0x50c1c1){var _0x101c17={};var _0x3a350e={};var _0xc7e182;var _0x3411f0;return db[_0x1652('0x3b')]['findOne']({'where':{'id':_0x4159f9[_0x1652('0x43')]['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x330599,null))[_0x1652('0x21')](function(_0x4d91ab){if(_0x4d91ab){_0xc7e182=_0x4d91ab;_0x3a350e[_0x1652('0x2c')]=_[_0x1652('0x2e')](db[_0x1652('0x49')]['rawAttributes']);_0x3a350e[_0x1652('0x2d')]=_[_0x1652('0x2e')](_0x4159f9[_0x1652('0x2d')]);_0x3a350e[_0x1652('0x36')]=_[_0x1652('0x2f')](_0x3a350e['model'],_0x3a350e['query']);_0x101c17[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x3a350e[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x4159f9['query'][_0x1652('0x30')]));_0x101c17[_0x1652('0x31')]=_0x101c17[_0x1652('0x31')][_0x1652('0x4a')]?_0x101c17[_0x1652('0x31')]:_0x3a350e[_0x1652('0x2c')];_0x101c17[_0x1652('0x4c')]=qs['sort'](_0x4159f9[_0x1652('0x2d')][_0x1652('0x34')]);_0x101c17[_0x1652('0x35')]=qs[_0x1652('0x36')](_['pick'](_0x4159f9[_0x1652('0x2d')],_0x3a350e['filters']));if(_0x4159f9[_0x1652('0x2d')]['filter']){_0x101c17[_0x1652('0x35')]=_[_0x1652('0x39')](_0x101c17[_0x1652('0x35')],{'$or':_[_0x1652('0x28')](_0x101c17[_0x1652('0x31')],function(_0x7263f8){var _0x3bbbe9={};_0x3bbbe9[_0x7263f8]={'$like':'%'+_0x4159f9[_0x1652('0x2d')]['filter']+'%'};return _0x3bbbe9;})});}_0x101c17=_[_0x1652('0x39')]({},_0x101c17,_0x4159f9['options']);return _0xc7e182[_0x1652('0x4b')](_0x101c17);}})['then'](function(_0x155246){if(_0x155246){_0x3411f0=_0x155246['length'];if(!_0x4159f9['query']['hasOwnProperty'](_0x1652('0x33'))){_0x101c17['limit']=qs[_0x1652('0x1c')](_0x4159f9[_0x1652('0x2d')][_0x1652('0x1c')]);_0x101c17[_0x1652('0x1a')]=qs[_0x1652('0x1a')](_0x4159f9[_0x1652('0x2d')][_0x1652('0x1a')]);}return _0xc7e182[_0x1652('0x4b')](_0x101c17);}})[_0x1652('0x21')](function(_0x201cd7){if(_0x201cd7){return _0x201cd7?{'count':_0x3411f0,'rows':_0x201cd7}:null;}})['then'](respondWithResult(_0x330599,null))['catch'](handleError(_0x330599,null));};exports[_0x1652('0x4d')]=function(_0x199159,_0x4cb8f0,_0x845ae){var _0x2a160a={};var _0x35b310={};var _0x16d356;var _0x4bd39f;return db[_0x1652('0x3b')]['findOne']({'where':{'id':_0x199159['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x4cb8f0,null))[_0x1652('0x21')](function(_0x2c413e){if(_0x2c413e){_0x16d356=_0x2c413e;_0x35b310[_0x1652('0x2c')]=_[_0x1652('0x2e')](db['FreshdeskField']['rawAttributes']);_0x35b310[_0x1652('0x2d')]=_[_0x1652('0x2e')](_0x199159[_0x1652('0x2d')]);_0x35b310[_0x1652('0x36')]=_[_0x1652('0x2f')](_0x35b310[_0x1652('0x2c')],_0x35b310[_0x1652('0x2d')]);_0x2a160a[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x35b310[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x199159['query'][_0x1652('0x30')]));_0x2a160a[_0x1652('0x31')]=_0x2a160a['attributes'][_0x1652('0x4a')]?_0x2a160a[_0x1652('0x31')]:_0x35b310[_0x1652('0x2c')];_0x2a160a[_0x1652('0x4c')]=qs['sort'](_0x199159[_0x1652('0x2d')][_0x1652('0x34')]);_0x2a160a['where']=qs[_0x1652('0x36')](_['pick'](_0x199159[_0x1652('0x2d')],_0x35b310['filters']));if(_0x199159['query']['filter']){_0x2a160a[_0x1652('0x35')]=_['merge'](_0x2a160a[_0x1652('0x35')],{'$or':_['map'](_0x2a160a[_0x1652('0x31')],function(_0x17137b){var _0x764a82={};_0x764a82[_0x17137b]={'$like':'%'+_0x199159[_0x1652('0x2d')][_0x1652('0x37')]+'%'};return _0x764a82;})});}_0x2a160a=_['merge']({},_0x2a160a,_0x199159[_0x1652('0x3a')]);return _0x16d356[_0x1652('0x4d')](_0x2a160a);}})[_0x1652('0x21')](function(_0x5dcf1d){if(_0x5dcf1d){_0x4bd39f=_0x5dcf1d['length'];if(!_0x199159[_0x1652('0x2d')][_0x1652('0x32')](_0x1652('0x33'))){_0x2a160a[_0x1652('0x1c')]=qs[_0x1652('0x1c')](_0x199159[_0x1652('0x2d')]['limit']);_0x2a160a[_0x1652('0x1a')]=qs['offset'](_0x199159[_0x1652('0x2d')]['offset']);}return _0x16d356[_0x1652('0x4d')](_0x2a160a);}})[_0x1652('0x21')](function(_0xfda438){if(_0xfda438){return _0xfda438?{'count':_0x4bd39f,'rows':_0xfda438}:null;}})[_0x1652('0x21')](respondWithResult(_0x4cb8f0,null))[_0x1652('0x41')](handleError(_0x4cb8f0,null));};exports[_0x1652('0x4e')]=function(_0x254b6c,_0x2cb185,_0x2c8bea){var _0x4af9e9={};var _0x42a637={};var _0x52fc66;var _0x3d2389;return db[_0x1652('0x3b')][_0x1652('0x48')]({'where':{'id':_0x254b6c['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x2cb185,null))[_0x1652('0x21')](function(_0x932e35){if(_0x932e35){_0x52fc66=_0x932e35;_0x42a637['model']=_['keys'](db['Tag'][_0x1652('0x29')]);_0x42a637['query']=_['keys'](_0x254b6c[_0x1652('0x2d')]);_0x42a637['filters']=_['intersection'](_0x42a637[_0x1652('0x2c')],_0x42a637[_0x1652('0x2d')]);_0x4af9e9[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x42a637[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x254b6c[_0x1652('0x2d')][_0x1652('0x30')]));_0x4af9e9['attributes']=_0x4af9e9[_0x1652('0x31')][_0x1652('0x4a')]?_0x4af9e9[_0x1652('0x31')]:_0x42a637['model'];_0x4af9e9['order']=qs[_0x1652('0x34')](_0x254b6c['query'][_0x1652('0x34')]);_0x4af9e9[_0x1652('0x35')]=qs['filters'](_['pick'](_0x254b6c[_0x1652('0x2d')],_0x42a637[_0x1652('0x36')]));if(_0x254b6c[_0x1652('0x2d')][_0x1652('0x37')]){_0x4af9e9[_0x1652('0x35')]=_[_0x1652('0x39')](_0x4af9e9[_0x1652('0x35')],{'$or':_[_0x1652('0x28')](_0x4af9e9['attributes'],function(_0x3389ef){var _0x2e0be9={};_0x2e0be9[_0x3389ef]={'$like':'%'+_0x254b6c['query'][_0x1652('0x37')]+'%'};return _0x2e0be9;})});}_0x4af9e9=_[_0x1652('0x39')]({},_0x4af9e9,_0x254b6c['options']);return _0x52fc66[_0x1652('0x4e')](_0x4af9e9);}})[_0x1652('0x21')](function(_0x5a196a){if(_0x5a196a){_0x3d2389=_0x5a196a['length'];if(!_0x254b6c[_0x1652('0x2d')][_0x1652('0x32')]('nolimit')){_0x4af9e9[_0x1652('0x1c')]=qs[_0x1652('0x1c')](_0x254b6c[_0x1652('0x2d')][_0x1652('0x1c')]);_0x4af9e9['offset']=qs[_0x1652('0x1a')](_0x254b6c[_0x1652('0x2d')][_0x1652('0x1a')]);}return _0x52fc66[_0x1652('0x4e')](_0x4af9e9);}})[_0x1652('0x21')](function(_0x1337e6){if(_0x1337e6){return _0x1337e6?{'count':_0x3d2389,'rows':_0x1337e6}:null;}})[_0x1652('0x21')](respondWithResult(_0x2cb185,null))[_0x1652('0x41')](handleError(_0x2cb185,null));};exports[_0x1652('0x4f')]=function(_0x431979,_0x3c236d,_0x2769be){if(_0x431979[_0x1652('0x46')]['id']){delete _0x431979[_0x1652('0x46')]['id'];}return db[_0x1652('0x3b')]['findOne']({'where':{'id':_0x431979['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x3c236d,null))[_0x1652('0x21')](function(_0x19508c){if(_0x19508c){return _0x19508c[_0x1652('0x4f')](_0x431979[_0x1652('0x46')][_0x1652('0x50')]||[]);}return null;})['then'](respondWithResult(_0x3c236d,null))['catch'](handleError(_0x3c236d,null));}; \ No newline at end of file +var _0x2ed6=['moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getFields','findOne','pick','filter','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x311c5a,_0x2eee56){var _0x5244fe=function(_0x37f649){while(--_0x37f649){_0x311c5a['push'](_0x311c5a['shift']());}};_0x5244fe(++_0x2eee56);}(_0x2ed6,0x157));var _0x62ed=function(_0x23f4b1,_0x242ba6){_0x23f4b1=_0x23f4b1-0x0;var _0x2cc25f=_0x2ed6[_0x23f4b1];return _0x2cc25f;};'use strict';var emlformat=require(_0x62ed('0x0'));var rimraf=require(_0x62ed('0x1'));var zipdir=require(_0x62ed('0x2'));var jsonpatch=require(_0x62ed('0x3'));var rp=require(_0x62ed('0x4'));var moment=require(_0x62ed('0x5'));var BPromise=require(_0x62ed('0x6'));var Mustache=require(_0x62ed('0x7'));var util=require(_0x62ed('0x8'));var path=require('path');var sox=require(_0x62ed('0x9'));var csv=require(_0x62ed('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62ed('0xb'));var squel=require(_0x62ed('0xc'));var crypto=require(_0x62ed('0xd'));var jsforce=require(_0x62ed('0xe'));var deskjs=require(_0x62ed('0xf'));var toCsv=require(_0x62ed('0xa'));var querystring=require(_0x62ed('0x10'));var Papa=require(_0x62ed('0x11'));var Redis=require(_0x62ed('0x12'));var authService=require(_0x62ed('0x13'));var qs=require(_0x62ed('0x14'));var as=require(_0x62ed('0x15'));var hardwareService=require(_0x62ed('0x16'));var logger=require(_0x62ed('0x17'))(_0x62ed('0x18'));var utils=require(_0x62ed('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x62ed('0x1a'));var db=require(_0x62ed('0x1b'))['db'];function respondWithStatusCode(_0x308096,_0x37fb85){_0x37fb85=_0x37fb85||0xcc;return function(_0x18b3e6){if(_0x18b3e6){return _0x308096['sendStatus'](_0x37fb85);}return _0x308096['status'](_0x37fb85)[_0x62ed('0x1c')]();};}function respondWithResult(_0x28b9c2,_0x477718){_0x477718=_0x477718||0xc8;return function(_0x5f1b29){if(_0x5f1b29){return _0x28b9c2[_0x62ed('0x1d')](_0x477718)[_0x62ed('0x1e')](_0x5f1b29);}};}function respondWithFilteredResult(_0x3a706a,_0x523834){return function(_0x26863b){if(_0x26863b){var _0x201377=typeof _0x523834[_0x62ed('0x1f')]===_0x62ed('0x20')&&typeof _0x523834[_0x62ed('0x21')]==='undefined';var _0x5870f3=_0x26863b[_0x62ed('0x22')];var _0x230ec2=_0x201377?0x0:_0x523834[_0x62ed('0x1f')];var _0x1398ad=_0x201377?_0x26863b[_0x62ed('0x22')]:_0x523834[_0x62ed('0x1f')]+_0x523834['limit'];var _0x43695f;if(_0x1398ad>=_0x5870f3){_0x1398ad=_0x5870f3;_0x43695f=0xc8;}else{_0x43695f=0xce;}_0x3a706a[_0x62ed('0x1d')](_0x43695f);return _0x3a706a[_0x62ed('0x23')](_0x62ed('0x24'),_0x230ec2+'-'+_0x1398ad+'/'+_0x5870f3)[_0x62ed('0x1e')](_0x26863b);}return null;};}function patchUpdates(_0xba97f1){return function(_0x25f148){try{jsonpatch[_0x62ed('0x25')](_0x25f148,_0xba97f1,!![]);}catch(_0xe7b23f){return BPromise['reject'](_0xe7b23f);}return _0x25f148[_0x62ed('0x26')]();};}function saveUpdates(_0x43e79c,_0x574e06){return function(_0x56590d){if(_0x56590d){return _0x56590d[_0x62ed('0x27')](_0x43e79c)[_0x62ed('0x28')](function(_0x243cc9){return _0x243cc9;});}return null;};}function removeEntity(_0x560924,_0x18d058){return function(_0x232d1a){if(_0x232d1a){return _0x232d1a['destroy']()[_0x62ed('0x28')](function(){_0x560924[_0x62ed('0x1d')](0xcc)[_0x62ed('0x1c')]();});}};}function handleEntityNotFound(_0x33689f,_0x58aed1){return function(_0x5cef32){if(!_0x5cef32){_0x33689f['sendStatus'](0x194);}return _0x5cef32;};}function handleError(_0x555fe6,_0x13cd9d){_0x13cd9d=_0x13cd9d||0x1f4;return function(_0x7ffba1){logger[_0x62ed('0x29')](_0x7ffba1[_0x62ed('0x2a')]);if(_0x7ffba1[_0x62ed('0x2b')]){delete _0x7ffba1[_0x62ed('0x2b')];}_0x555fe6['status'](_0x13cd9d)['send'](_0x7ffba1);};}exports[_0x62ed('0x2c')]=function(_0x5a1805,_0x2cb2c5){var _0x20069b={},_0x1ea6f4={},_0x2d00e9={'count':0x0,'rows':[]};var _0x679166=_[_0x62ed('0x2d')](db[_0x62ed('0x2e')][_0x62ed('0x2f')],function(_0x4e5c13){return{'name':_0x4e5c13[_0x62ed('0x30')],'type':_0x4e5c13[_0x62ed('0x31')][_0x62ed('0x32')]};});_0x1ea6f4['model']=_['map'](_0x679166,_0x62ed('0x2b'));_0x1ea6f4['query']=_[_0x62ed('0x33')](_0x5a1805[_0x62ed('0x34')]);_0x1ea6f4[_0x62ed('0x35')]=_[_0x62ed('0x36')](_0x1ea6f4[_0x62ed('0x37')],_0x1ea6f4[_0x62ed('0x34')]);_0x20069b[_0x62ed('0x38')]=_['intersection'](_0x1ea6f4[_0x62ed('0x37')],qs[_0x62ed('0x39')](_0x5a1805['query'][_0x62ed('0x39')]));_0x20069b[_0x62ed('0x38')]=_0x20069b[_0x62ed('0x38')][_0x62ed('0x3a')]?_0x20069b['attributes']:_0x1ea6f4[_0x62ed('0x37')];if(!_0x5a1805[_0x62ed('0x34')]['hasOwnProperty']('nolimit')){_0x20069b[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x5a1805['query'][_0x62ed('0x21')]);_0x20069b[_0x62ed('0x1f')]=qs[_0x62ed('0x1f')](_0x5a1805[_0x62ed('0x34')][_0x62ed('0x1f')]);}_0x20069b[_0x62ed('0x3b')]=qs[_0x62ed('0x3c')](_0x5a1805['query'][_0x62ed('0x3c')]);_0x20069b[_0x62ed('0x3d')]=qs['filters'](_['pick'](_0x5a1805[_0x62ed('0x34')],_0x1ea6f4[_0x62ed('0x35')]),_0x679166);if(_0x5a1805[_0x62ed('0x34')]['filter']){_0x20069b[_0x62ed('0x3d')]=_[_0x62ed('0x3e')](_0x20069b[_0x62ed('0x3d')],{'$or':_['map'](_0x679166,function(_0x237571){if(_0x237571['type']!==_0x62ed('0x3f')){var _0xc4c56f={};_0xc4c56f[_0x237571[_0x62ed('0x2b')]]={'$like':'%'+_0x5a1805[_0x62ed('0x34')]['filter']+'%'};return _0xc4c56f;}})});}_0x20069b=_[_0x62ed('0x3e')]({},_0x20069b,_0x5a1805[_0x62ed('0x40')]);var _0x2308c5={'where':_0x20069b[_0x62ed('0x3d')]};return db[_0x62ed('0x2e')][_0x62ed('0x22')](_0x2308c5)[_0x62ed('0x28')](function(_0x1faeb2){_0x2d00e9[_0x62ed('0x22')]=_0x1faeb2;if(_0x5a1805[_0x62ed('0x34')][_0x62ed('0x41')]){_0x20069b[_0x62ed('0x42')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x62ed('0x43')](_0x20069b);})[_0x62ed('0x28')](function(_0x40a7ac){_0x2d00e9[_0x62ed('0x44')]=_0x40a7ac;return _0x2d00e9;})[_0x62ed('0x28')](respondWithFilteredResult(_0x2cb2c5,_0x20069b))['catch'](handleError(_0x2cb2c5,null));};exports[_0x62ed('0x45')]=function(_0x1d6278,_0x3b5ba4){var _0x4b7058={'raw':![],'where':{'id':_0x1d6278[_0x62ed('0x46')]['id']}},_0x1c0f69={};_0x1c0f69[_0x62ed('0x37')]=_[_0x62ed('0x33')](db[_0x62ed('0x2e')]['rawAttributes']);_0x1c0f69[_0x62ed('0x34')]=_['keys'](_0x1d6278[_0x62ed('0x34')]);_0x1c0f69[_0x62ed('0x35')]=_[_0x62ed('0x36')](_0x1c0f69['model'],_0x1c0f69[_0x62ed('0x34')]);_0x4b7058[_0x62ed('0x38')]=_['intersection'](_0x1c0f69[_0x62ed('0x37')],qs[_0x62ed('0x39')](_0x1d6278[_0x62ed('0x34')][_0x62ed('0x39')]));_0x4b7058[_0x62ed('0x38')]=_0x4b7058[_0x62ed('0x38')][_0x62ed('0x3a')]?_0x4b7058[_0x62ed('0x38')]:_0x1c0f69[_0x62ed('0x37')];if(_0x1d6278[_0x62ed('0x34')][_0x62ed('0x41')]){_0x4b7058[_0x62ed('0x42')]=[{'all':!![]}];}_0x4b7058=_['merge']({},_0x4b7058,_0x1d6278[_0x62ed('0x40')]);return db[_0x62ed('0x2e')][_0x62ed('0x47')](_0x4b7058)[_0x62ed('0x28')](handleEntityNotFound(_0x3b5ba4,null))[_0x62ed('0x28')](respondWithResult(_0x3b5ba4,null))[_0x62ed('0x48')](handleError(_0x3b5ba4,null));};exports[_0x62ed('0x49')]=function(_0x4ebc28,_0x3c0c19){return db[_0x62ed('0x2e')]['create'](_0x4ebc28[_0x62ed('0x4a')],{})[_0x62ed('0x28')](respondWithResult(_0x3c0c19,0xc9))[_0x62ed('0x48')](handleError(_0x3c0c19,null));};exports['update']=function(_0x182bd7,_0x476481){if(_0x182bd7['body']['id']){delete _0x182bd7[_0x62ed('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0x62ed('0x47')]({'where':{'id':_0x182bd7[_0x62ed('0x46')]['id']}})[_0x62ed('0x28')](handleEntityNotFound(_0x476481,null))['then'](saveUpdates(_0x182bd7[_0x62ed('0x4a')],null))['then'](respondWithResult(_0x476481,null))['catch'](handleError(_0x476481,null));};exports[_0x62ed('0x4b')]=function(_0x319e5e,_0x4af035){return db['FreshdeskConfiguration'][_0x62ed('0x47')]({'where':{'id':_0x319e5e[_0x62ed('0x46')]['id']}})[_0x62ed('0x28')](handleEntityNotFound(_0x4af035,null))['then'](removeEntity(_0x4af035,null))[_0x62ed('0x48')](handleError(_0x4af035,null));};exports[_0x62ed('0x4c')]=function(_0x14d290,_0x49a8ca,_0x24345c){var _0x1652cd={};var _0x5c195c={};var _0x482a1b;var _0x4df618;return db[_0x62ed('0x2e')][_0x62ed('0x4d')]({'where':{'id':_0x14d290[_0x62ed('0x46')]['id']}})[_0x62ed('0x28')](handleEntityNotFound(_0x49a8ca,null))['then'](function(_0x17ee48){if(_0x17ee48){_0x482a1b=_0x17ee48;_0x5c195c[_0x62ed('0x37')]=_[_0x62ed('0x33')](db['FreshdeskField'][_0x62ed('0x2f')]);_0x5c195c[_0x62ed('0x34')]=_['keys'](_0x14d290[_0x62ed('0x34')]);_0x5c195c['filters']=_[_0x62ed('0x36')](_0x5c195c['model'],_0x5c195c[_0x62ed('0x34')]);_0x1652cd[_0x62ed('0x38')]=_[_0x62ed('0x36')](_0x5c195c['model'],qs[_0x62ed('0x39')](_0x14d290[_0x62ed('0x34')]['fields']));_0x1652cd[_0x62ed('0x38')]=_0x1652cd['attributes']['length']?_0x1652cd[_0x62ed('0x38')]:_0x5c195c['model'];_0x1652cd['order']=qs[_0x62ed('0x3c')](_0x14d290[_0x62ed('0x34')][_0x62ed('0x3c')]);_0x1652cd[_0x62ed('0x3d')]=qs[_0x62ed('0x35')](_[_0x62ed('0x4e')](_0x14d290[_0x62ed('0x34')],_0x5c195c[_0x62ed('0x35')]));if(_0x14d290[_0x62ed('0x34')][_0x62ed('0x4f')]){_0x1652cd['where']=_['merge'](_0x1652cd[_0x62ed('0x3d')],{'$or':_[_0x62ed('0x2d')](_0x1652cd[_0x62ed('0x38')],function(_0x19c019){var _0x316bad={};_0x316bad[_0x19c019]={'$like':'%'+_0x14d290[_0x62ed('0x34')]['filter']+'%'};return _0x316bad;})});}_0x1652cd=_['merge']({},_0x1652cd,_0x14d290[_0x62ed('0x40')]);return _0x482a1b['getFields'](_0x1652cd);}})[_0x62ed('0x28')](function(_0x5c8e47){if(_0x5c8e47){_0x4df618=_0x5c8e47[_0x62ed('0x3a')];if(!_0x14d290[_0x62ed('0x34')][_0x62ed('0x50')](_0x62ed('0x51'))){_0x1652cd[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x14d290[_0x62ed('0x34')]['limit']);_0x1652cd[_0x62ed('0x1f')]=qs[_0x62ed('0x1f')](_0x14d290[_0x62ed('0x34')][_0x62ed('0x1f')]);}return _0x482a1b[_0x62ed('0x4c')](_0x1652cd);}})[_0x62ed('0x28')](function(_0x426199){if(_0x426199){return _0x426199?{'count':_0x4df618,'rows':_0x426199}:null;}})['then'](respondWithResult(_0x49a8ca,null))['catch'](handleError(_0x49a8ca,null));};exports['getSubjects']=function(_0x5ab4c5,_0x22280f,_0x17c235){var _0x175d76={};var _0x55bf19={};var _0x5e7252;var _0x408751;return db[_0x62ed('0x2e')]['findOne']({'where':{'id':_0x5ab4c5[_0x62ed('0x46')]['id']}})['then'](handleEntityNotFound(_0x22280f,null))[_0x62ed('0x28')](function(_0x38a44a){if(_0x38a44a){_0x5e7252=_0x38a44a;_0x55bf19['model']=_[_0x62ed('0x33')](db['FreshdeskField'][_0x62ed('0x2f')]);_0x55bf19['query']=_[_0x62ed('0x33')](_0x5ab4c5[_0x62ed('0x34')]);_0x55bf19[_0x62ed('0x35')]=_[_0x62ed('0x36')](_0x55bf19[_0x62ed('0x37')],_0x55bf19[_0x62ed('0x34')]);_0x175d76[_0x62ed('0x38')]=_[_0x62ed('0x36')](_0x55bf19[_0x62ed('0x37')],qs[_0x62ed('0x39')](_0x5ab4c5[_0x62ed('0x34')]['fields']));_0x175d76['attributes']=_0x175d76[_0x62ed('0x38')][_0x62ed('0x3a')]?_0x175d76[_0x62ed('0x38')]:_0x55bf19[_0x62ed('0x37')];_0x175d76[_0x62ed('0x3b')]=qs[_0x62ed('0x3c')](_0x5ab4c5[_0x62ed('0x34')][_0x62ed('0x3c')]);_0x175d76[_0x62ed('0x3d')]=qs[_0x62ed('0x35')](_['pick'](_0x5ab4c5[_0x62ed('0x34')],_0x55bf19[_0x62ed('0x35')]));if(_0x5ab4c5[_0x62ed('0x34')][_0x62ed('0x4f')]){_0x175d76[_0x62ed('0x3d')]=_['merge'](_0x175d76[_0x62ed('0x3d')],{'$or':_[_0x62ed('0x2d')](_0x175d76[_0x62ed('0x38')],function(_0x91f0fe){var _0x5768bd={};_0x5768bd[_0x91f0fe]={'$like':'%'+_0x5ab4c5[_0x62ed('0x34')][_0x62ed('0x4f')]+'%'};return _0x5768bd;})});}_0x175d76=_[_0x62ed('0x3e')]({},_0x175d76,_0x5ab4c5[_0x62ed('0x40')]);return _0x5e7252[_0x62ed('0x52')](_0x175d76);}})[_0x62ed('0x28')](function(_0x5c0149){if(_0x5c0149){_0x408751=_0x5c0149[_0x62ed('0x3a')];if(!_0x5ab4c5[_0x62ed('0x34')][_0x62ed('0x50')]('nolimit')){_0x175d76[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x5ab4c5[_0x62ed('0x34')][_0x62ed('0x21')]);_0x175d76['offset']=qs[_0x62ed('0x1f')](_0x5ab4c5[_0x62ed('0x34')][_0x62ed('0x1f')]);}return _0x5e7252[_0x62ed('0x52')](_0x175d76);}})['then'](function(_0x585036){if(_0x585036){return _0x585036?{'count':_0x408751,'rows':_0x585036}:null;}})[_0x62ed('0x28')](respondWithResult(_0x22280f,null))['catch'](handleError(_0x22280f,null));};exports[_0x62ed('0x53')]=function(_0x4a667d,_0x1df768,_0x26cb14){var _0x20b1d5={};var _0x261059={};var _0x2fbc88;var _0x2c50a7;return db['FreshdeskConfiguration'][_0x62ed('0x4d')]({'where':{'id':_0x4a667d[_0x62ed('0x46')]['id']}})['then'](handleEntityNotFound(_0x1df768,null))[_0x62ed('0x28')](function(_0x442ee8){if(_0x442ee8){_0x2fbc88=_0x442ee8;_0x261059['model']=_['keys'](db['FreshdeskField'][_0x62ed('0x2f')]);_0x261059[_0x62ed('0x34')]=_['keys'](_0x4a667d[_0x62ed('0x34')]);_0x261059[_0x62ed('0x35')]=_[_0x62ed('0x36')](_0x261059['model'],_0x261059[_0x62ed('0x34')]);_0x20b1d5['attributes']=_[_0x62ed('0x36')](_0x261059[_0x62ed('0x37')],qs[_0x62ed('0x39')](_0x4a667d['query'][_0x62ed('0x39')]));_0x20b1d5[_0x62ed('0x38')]=_0x20b1d5['attributes'][_0x62ed('0x3a')]?_0x20b1d5[_0x62ed('0x38')]:_0x261059[_0x62ed('0x37')];_0x20b1d5[_0x62ed('0x3b')]=qs['sort'](_0x4a667d['query'][_0x62ed('0x3c')]);_0x20b1d5[_0x62ed('0x3d')]=qs[_0x62ed('0x35')](_[_0x62ed('0x4e')](_0x4a667d[_0x62ed('0x34')],_0x261059[_0x62ed('0x35')]));if(_0x4a667d['query']['filter']){_0x20b1d5['where']=_[_0x62ed('0x3e')](_0x20b1d5[_0x62ed('0x3d')],{'$or':_[_0x62ed('0x2d')](_0x20b1d5['attributes'],function(_0x5a4124){var _0x32d698={};_0x32d698[_0x5a4124]={'$like':'%'+_0x4a667d[_0x62ed('0x34')]['filter']+'%'};return _0x32d698;})});}_0x20b1d5=_['merge']({},_0x20b1d5,_0x4a667d['options']);return _0x2fbc88['getDescriptions'](_0x20b1d5);}})[_0x62ed('0x28')](function(_0x55e575){if(_0x55e575){_0x2c50a7=_0x55e575[_0x62ed('0x3a')];if(!_0x4a667d['query'][_0x62ed('0x50')]('nolimit')){_0x20b1d5[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x4a667d[_0x62ed('0x34')][_0x62ed('0x21')]);_0x20b1d5[_0x62ed('0x1f')]=qs['offset'](_0x4a667d[_0x62ed('0x34')][_0x62ed('0x1f')]);}return _0x2fbc88[_0x62ed('0x53')](_0x20b1d5);}})['then'](function(_0x368620){if(_0x368620){return _0x368620?{'count':_0x2c50a7,'rows':_0x368620}:null;}})['then'](respondWithResult(_0x1df768,null))['catch'](handleError(_0x1df768,null));};exports[_0x62ed('0x54')]=function(_0x4208bc,_0xa47cc8,_0x4cfdf6){var _0x43266b={};var _0x77f6b9={};var _0x558061;var _0x48d699;return db[_0x62ed('0x2e')]['findOne']({'where':{'id':_0x4208bc[_0x62ed('0x46')]['id']}})['then'](handleEntityNotFound(_0xa47cc8,null))[_0x62ed('0x28')](function(_0x46ae8c){if(_0x46ae8c){_0x558061=_0x46ae8c;_0x77f6b9[_0x62ed('0x37')]=_[_0x62ed('0x33')](db['Tag']['rawAttributes']);_0x77f6b9[_0x62ed('0x34')]=_[_0x62ed('0x33')](_0x4208bc[_0x62ed('0x34')]);_0x77f6b9[_0x62ed('0x35')]=_['intersection'](_0x77f6b9[_0x62ed('0x37')],_0x77f6b9[_0x62ed('0x34')]);_0x43266b[_0x62ed('0x38')]=_[_0x62ed('0x36')](_0x77f6b9[_0x62ed('0x37')],qs[_0x62ed('0x39')](_0x4208bc[_0x62ed('0x34')][_0x62ed('0x39')]));_0x43266b[_0x62ed('0x38')]=_0x43266b[_0x62ed('0x38')][_0x62ed('0x3a')]?_0x43266b[_0x62ed('0x38')]:_0x77f6b9[_0x62ed('0x37')];_0x43266b[_0x62ed('0x3b')]=qs[_0x62ed('0x3c')](_0x4208bc[_0x62ed('0x34')][_0x62ed('0x3c')]);_0x43266b[_0x62ed('0x3d')]=qs[_0x62ed('0x35')](_[_0x62ed('0x4e')](_0x4208bc[_0x62ed('0x34')],_0x77f6b9[_0x62ed('0x35')]));if(_0x4208bc[_0x62ed('0x34')][_0x62ed('0x4f')]){_0x43266b[_0x62ed('0x3d')]=_[_0x62ed('0x3e')](_0x43266b[_0x62ed('0x3d')],{'$or':_[_0x62ed('0x2d')](_0x43266b[_0x62ed('0x38')],function(_0x505b9a){var _0x13f9ca={};_0x13f9ca[_0x505b9a]={'$like':'%'+_0x4208bc['query'][_0x62ed('0x4f')]+'%'};return _0x13f9ca;})});}_0x43266b=_[_0x62ed('0x3e')]({},_0x43266b,_0x4208bc[_0x62ed('0x40')]);return _0x558061[_0x62ed('0x54')](_0x43266b);}})['then'](function(_0x34a139){if(_0x34a139){_0x48d699=_0x34a139['length'];if(!_0x4208bc[_0x62ed('0x34')][_0x62ed('0x50')](_0x62ed('0x51'))){_0x43266b['limit']=qs[_0x62ed('0x21')](_0x4208bc[_0x62ed('0x34')]['limit']);_0x43266b[_0x62ed('0x1f')]=qs[_0x62ed('0x1f')](_0x4208bc['query'][_0x62ed('0x1f')]);}return _0x558061[_0x62ed('0x54')](_0x43266b);}})['then'](function(_0x5e4f5c){if(_0x5e4f5c){return _0x5e4f5c?{'count':_0x48d699,'rows':_0x5e4f5c}:null;}})[_0x62ed('0x28')](respondWithResult(_0xa47cc8,null))[_0x62ed('0x48')](handleError(_0xa47cc8,null));};exports[_0x62ed('0x55')]=function(_0x3c2928,_0x13346f,_0x426ab2){if(_0x3c2928['body']['id']){delete _0x3c2928[_0x62ed('0x4a')]['id'];}return db[_0x62ed('0x2e')][_0x62ed('0x4d')]({'where':{'id':_0x3c2928[_0x62ed('0x46')]['id']}})[_0x62ed('0x28')](handleEntityNotFound(_0x13346f,null))[_0x62ed('0x28')](function(_0x5e48e8){if(_0x5e48e8){return _0x5e48e8[_0x62ed('0x55')](_0x3c2928[_0x62ed('0x4a')][_0x62ed('0x56')]||[]);}return null;})[_0x62ed('0x28')](respondWithResult(_0x13346f,null))[_0x62ed('0x48')](handleError(_0x13346f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e2a57e7..6c8e671 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 _0xd6a6=['../../config/logger','api','moment','request-promise','path','rimraf','exports','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd6a6,0x121));var _0x6d6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6a6[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6d6a('0x0'));var logger=require(_0x6d6a('0x1'))(_0x6d6a('0x2'));var moment=require(_0x6d6a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d6a('0x4'));var fs=require('fs');var path=require(_0x6d6a('0x5'));var rimraf=require(_0x6d6a('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x6d6a('0x7')]=function(_0x24385d,_0x52852a){return _0x24385d['define'](_0x6d6a('0x8'),attributes,{'tableName':_0x6d6a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc84e=['../../config/logger','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','lodash'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xc84e,0x128));var _0xec84=function(_0xb6aec1,_0x2d1c7d){_0xb6aec1=_0xb6aec1-0x0;var _0x119929=_0xc84e[_0xb6aec1];return _0x119929;};'use strict';var _=require(_0xec84('0x0'));var util=require('util');var logger=require(_0xec84('0x1'))('api');var moment=require('moment');var BPromise=require(_0xec84('0x2'));var rp=require(_0xec84('0x3'));var fs=require('fs');var path=require(_0xec84('0x4'));var rimraf=require(_0xec84('0x5'));var config=require('../../config/environment');var attributes=require(_0xec84('0x6'));module[_0xec84('0x7')]=function(_0x11f6ba,_0x1a2962){return _0x11f6ba['define'](_0xec84('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 606aaf0..a0caff7 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 _0x1ea1=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d6696,_0x2cc5f0){var _0x4a3342=function(_0x56a53c){while(--_0x56a53c){_0x1d6696['push'](_0x1d6696['shift']());}};_0x4a3342(++_0x2cc5f0);}(_0x1ea1,0x19c));var _0x11ea=function(_0x2161a6,_0x481f8a){_0x2161a6=_0x2161a6-0x0;var _0x4c1ed6=_0x1ea1[_0x2161a6];return _0x4c1ed6;};'use strict';var _=require(_0x11ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x11ea('0x1'));var rs=require(_0x11ea('0x2'));var fs=require('fs');var Redis=require(_0x11ea('0x3'));var db=require(_0x11ea('0x4'))['db'];var utils=require(_0x11ea('0x5'));var logger=require(_0x11ea('0x6'))('rpc');var config=require(_0x11ea('0x7'));var jayson=require(_0x11ea('0x8'));var client=jayson[_0x11ea('0x9')][_0x11ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35ba07,_0x3fb4c8,_0x46df86){return new BPromise(function(_0x46428a,_0x59d5c6){return client[_0x11ea('0xb')](_0x35ba07,_0x46df86)[_0x11ea('0xc')](function(_0x2fb2eb){logger[_0x11ea('0xd')](_0x11ea('0xe'),_0x3fb4c8,'request\x20sent');logger[_0x11ea('0xf')](_0x11ea('0x10'),_0x3fb4c8,_0x11ea('0x11'),JSON['stringify'](_0x2fb2eb));if(_0x2fb2eb[_0x11ea('0x12')]){if(_0x2fb2eb[_0x11ea('0x12')][_0x11ea('0x13')]===0x1f4){logger[_0x11ea('0x12')](_0x11ea('0xe'),_0x3fb4c8,_0x2fb2eb['error'][_0x11ea('0x14')]);return _0x59d5c6(_0x2fb2eb[_0x11ea('0x12')][_0x11ea('0x14')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3fb4c8,_0x2fb2eb[_0x11ea('0x12')]['message']);return _0x46428a(_0x2fb2eb[_0x11ea('0x12')]['message']);}else{logger[_0x11ea('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3fb4c8,_0x11ea('0x11'));_0x46428a(_0x2fb2eb[_0x11ea('0x15')][_0x11ea('0x14')]);}})['catch'](function(_0x4cecbd){logger[_0x11ea('0x12')](_0x11ea('0xe'),_0x3fb4c8,_0x4cecbd);_0x59d5c6(_0x4cecbd);});});} \ No newline at end of file +var _0xb48c=['then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4d2531,_0x157e31){var _0x1637bf=function(_0x20b27a){while(--_0x20b27a){_0x4d2531['push'](_0x4d2531['shift']());}};_0x1637bf(++_0x157e31);}(_0xb48c,0x154));var _0xcb48=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb48c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var moment=require('moment');var BPromise=require(_0xcb48('0x2'));var rs=require(_0xcb48('0x3'));var fs=require('fs');var Redis=require(_0xcb48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb48('0x5'));var logger=require(_0xcb48('0x6'))(_0xcb48('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb48('0x8'));var client=jayson[_0xcb48('0x9')][_0xcb48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22f1e1,_0x71bbb0,_0x1522d2){return new BPromise(function(_0x18ea28,_0x5c644a){return client[_0xcb48('0xb')](_0x22f1e1,_0x1522d2)[_0xcb48('0xc')](function(_0x1f03f4){logger['info'](_0xcb48('0xd'),_0x71bbb0,_0xcb48('0xe'));logger[_0xcb48('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x71bbb0,'request\x20sent',JSON[_0xcb48('0x10')](_0x1f03f4));if(_0x1f03f4[_0xcb48('0x11')]){if(_0x1f03f4[_0xcb48('0x11')][_0xcb48('0x12')]===0x1f4){logger[_0xcb48('0x11')](_0xcb48('0xd'),_0x71bbb0,_0x1f03f4[_0xcb48('0x11')][_0xcb48('0x13')]);return _0x5c644a(_0x1f03f4['error']['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x71bbb0,_0x1f03f4[_0xcb48('0x11')][_0xcb48('0x13')]);return _0x18ea28(_0x1f03f4[_0xcb48('0x11')][_0xcb48('0x13')]);}else{logger[_0xcb48('0x14')](_0xcb48('0xd'),_0x71bbb0,_0xcb48('0xe'));_0x18ea28(_0x1f03f4[_0xcb48('0x15')][_0xcb48('0x13')]);}})['catch'](function(_0x1098ce){logger[_0xcb48('0x11')](_0xcb48('0xd'),_0x71bbb0,_0x1098ce);_0x5c644a(_0x1098ce);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 87df22f..262a0a4 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 _0x271d=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x271d,0x84));var _0xd271=function(_0x277203,_0x29280b){_0x277203=_0x277203-0x0;var _0x1b3ed7=_0x271d[_0x277203];return _0x1b3ed7;};'use strict';var multer=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var path=require(_0xd271('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd271('0x3')]();var fs_extra=require(_0xd271('0x4'));var auth=require(_0xd271('0x5'));var interaction=require(_0xd271('0x6'));var config=require('../../config/environment');var controller=require(_0xd271('0x7'));router['get']('/',auth[_0xd271('0x8')](),controller[_0xd271('0x9')]);router[_0xd271('0xa')](_0xd271('0xb'),auth[_0xd271('0x8')](),controller[_0xd271('0xc')]);router[_0xd271('0xd')]('/',auth[_0xd271('0x8')](),controller[_0xd271('0xe')]);router[_0xd271('0xf')](_0xd271('0xb'),auth[_0xd271('0x8')](),controller[_0xd271('0x10')]);router['delete'](_0xd271('0xb'),auth[_0xd271('0x8')](),controller[_0xd271('0x11')]);module[_0xd271('0x12')]=router; \ No newline at end of file +var _0xba3a=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x48478f,_0x537acd){var _0x10af50=function(_0x4cf0ac){while(--_0x4cf0ac){_0x48478f['push'](_0x48478f['shift']());}};_0x10af50(++_0x537acd);}(_0xba3a,0x17a));var _0xaba3=function(_0x347884,_0xd8ef37){_0x347884=_0x347884-0x0;var _0x2cd3fa=_0xba3a[_0x347884];return _0x2cd3fa;};'use strict';var multer=require(_0xaba3('0x0'));var util=require(_0xaba3('0x1'));var path=require(_0xaba3('0x2'));var timeout=require(_0xaba3('0x3'));var express=require(_0xaba3('0x4'));var router=express[_0xaba3('0x5')]();var fs_extra=require(_0xaba3('0x6'));var auth=require(_0xaba3('0x7'));var interaction=require(_0xaba3('0x8'));var config=require(_0xaba3('0x9'));var controller=require(_0xaba3('0xa'));router[_0xaba3('0xb')]('/',auth[_0xaba3('0xc')](),controller[_0xaba3('0xd')]);router[_0xaba3('0xb')](_0xaba3('0xe'),auth[_0xaba3('0xc')](),controller[_0xaba3('0xf')]);router[_0xaba3('0x10')]('/',auth[_0xaba3('0xc')](),controller[_0xaba3('0x11')]);router[_0xaba3('0x12')](_0xaba3('0xe'),auth[_0xaba3('0xc')](),controller[_0xaba3('0x13')]);router[_0xaba3('0x14')](_0xaba3('0xe'),auth[_0xaba3('0xc')](),controller[_0xaba3('0x15')]);module[_0xaba3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ddbe3f7..eee3430 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 _0xb005=['keyValue','picklist','ENUM','STRING','sequelize','exports','string','variable','customVariable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb005,0x1e1));var _0x5b00=function(_0x378898,_0x29791c){_0x378898=_0x378898-0x0;var _0x32e1a6=_0xb005[_0x378898];return _0x32e1a6;};'use strict';var Sequelize=require(_0x5b00('0x0'));module[_0x5b00('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5b00('0x2'),_0x5b00('0x3'),_0x5b00('0x4'),_0x5b00('0x5'),_0x5b00('0x6')),'defaultValue':_0x5b00('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5b00('0x7')](_0x5b00('0x2'),_0x5b00('0x3'),_0x5b00('0x4'))},'keyContent':{'type':Sequelize[_0x5b00('0x8')]},'idField':{'type':Sequelize[_0x5b00('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f16=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x480a1a,_0x83f2ad){var _0x322a57=function(_0x21eba1){while(--_0x21eba1){_0x480a1a['push'](_0x480a1a['shift']());}};_0x322a57(++_0x83f2ad);}(_0x2f16,0xec));var _0x62f1=function(_0x49011b,_0x4ff958){_0x49011b=_0x49011b-0x0;var _0x33ce53=_0x2f16[_0x49011b];return _0x33ce53;};'use strict';var Sequelize=require(_0x62f1('0x0'));module[_0x62f1('0x1')]={'type':{'type':Sequelize[_0x62f1('0x2')](_0x62f1('0x3'),_0x62f1('0x4'),_0x62f1('0x5'),_0x62f1('0x6'),_0x62f1('0x7')),'defaultValue':_0x62f1('0x3')},'content':{'type':Sequelize[_0x62f1('0x8')]},'key':{'type':Sequelize[_0x62f1('0x8')]},'keyType':{'type':Sequelize[_0x62f1('0x2')](_0x62f1('0x3'),_0x62f1('0x4'),_0x62f1('0x5'))},'keyContent':{'type':Sequelize[_0x62f1('0x8')]},'idField':{'type':Sequelize[_0x62f1('0x8')]},'nameField':{'type':Sequelize[_0x62f1('0x8')]},'customField':{'type':Sequelize[_0x62f1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x62f1('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f104e91..dac4188 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 _0x2f3a=['status','end','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','name','index','FreshdeskField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x3f0b9c,_0x39f258){_0x3f0b9c=_0x3f0b9c-0x0;var _0x48a63f=_0x2f3a[_0x3f0b9c];return _0x48a63f;};'use strict';var emlformat=require(_0xa2f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa2f3('0x1'));var rp=require(_0xa2f3('0x2'));var moment=require(_0xa2f3('0x3'));var BPromise=require(_0xa2f3('0x4'));var Mustache=require(_0xa2f3('0x5'));var util=require(_0xa2f3('0x6'));var path=require('path');var sox=require(_0xa2f3('0x7'));var csv=require('to-csv');var ejs=require(_0xa2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xa2f3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2f3('0xa'));var jsforce=require(_0xa2f3('0xb'));var deskjs=require(_0xa2f3('0xc'));var toCsv=require(_0xa2f3('0xd'));var querystring=require('querystring');var Papa=require(_0xa2f3('0xe'));var Redis=require(_0xa2f3('0xf'));var authService=require(_0xa2f3('0x10'));var qs=require(_0xa2f3('0x11'));var as=require(_0xa2f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2f3('0x13'))(_0xa2f3('0x14'));var utils=require('../../config/utils');var config=require(_0xa2f3('0x15'));var licenseUtil=require(_0xa2f3('0x16'));var db=require(_0xa2f3('0x17'))['db'];function respondWithStatusCode(_0x58f6df,_0x6aa8f2){_0x6aa8f2=_0x6aa8f2||0xcc;return function(_0x194281){if(_0x194281){return _0x58f6df[_0xa2f3('0x18')](_0x6aa8f2);}return _0x58f6df[_0xa2f3('0x19')](_0x6aa8f2)[_0xa2f3('0x1a')]();};}function respondWithResult(_0xd4f9db,_0x3907fe){_0x3907fe=_0x3907fe||0xc8;return function(_0x4544d4){if(_0x4544d4){return _0xd4f9db[_0xa2f3('0x19')](_0x3907fe)['json'](_0x4544d4);}};}function respondWithFilteredResult(_0xdc3967,_0x33bf10){return function(_0x74fb58){if(_0x74fb58){var _0x51d297=typeof _0x33bf10[_0xa2f3('0x1b')]===_0xa2f3('0x1c')&&typeof _0x33bf10['limit']==='undefined';var _0xb1fe06=_0x74fb58[_0xa2f3('0x1d')];var _0x2db0d2=_0x51d297?0x0:_0x33bf10[_0xa2f3('0x1b')];var _0x205578=_0x51d297?_0x74fb58[_0xa2f3('0x1d')]:_0x33bf10[_0xa2f3('0x1b')]+_0x33bf10[_0xa2f3('0x1e')];var _0x550d68;if(_0x205578>=_0xb1fe06){_0x205578=_0xb1fe06;_0x550d68=0xc8;}else{_0x550d68=0xce;}_0xdc3967[_0xa2f3('0x19')](_0x550d68);return _0xdc3967[_0xa2f3('0x1f')]('Content-Range',_0x2db0d2+'-'+_0x205578+'/'+_0xb1fe06)['json'](_0x74fb58);}return null;};}function patchUpdates(_0x2f74a0){return function(_0x53af81){try{jsonpatch[_0xa2f3('0x20')](_0x53af81,_0x2f74a0,!![]);}catch(_0x147fb7){return BPromise['reject'](_0x147fb7);}return _0x53af81[_0xa2f3('0x21')]();};}function saveUpdates(_0x3e055d,_0x14d989){return function(_0x2685bb){if(_0x2685bb){return _0x2685bb[_0xa2f3('0x22')](_0x3e055d)[_0xa2f3('0x23')](function(_0x37f8c2){return _0x37f8c2;});}return null;};}function removeEntity(_0xa02908,_0x49a589){return function(_0x81af9b){if(_0x81af9b){return _0x81af9b[_0xa2f3('0x24')]()[_0xa2f3('0x23')](function(){_0xa02908[_0xa2f3('0x19')](0xcc)[_0xa2f3('0x1a')]();});}};}function handleEntityNotFound(_0x2e6332,_0x1be0c1){return function(_0x5347de){if(!_0x5347de){_0x2e6332['sendStatus'](0x194);}return _0x5347de;};}function handleError(_0x2f4248,_0x4319f3){_0x4319f3=_0x4319f3||0x1f4;return function(_0x1dd4ec){logger[_0xa2f3('0x25')](_0x1dd4ec['stack']);if(_0x1dd4ec[_0xa2f3('0x26')]){delete _0x1dd4ec[_0xa2f3('0x26')];}_0x2f4248[_0xa2f3('0x19')](_0x4319f3)['send'](_0x1dd4ec);};}exports[_0xa2f3('0x27')]=function(_0x4ec4ab,_0x1ceea4){var _0x5b868c={},_0x452142={},_0x52f211={'count':0x0,'rows':[]};var _0x46f5c4=_['map'](db[_0xa2f3('0x28')][_0xa2f3('0x29')],function(_0x2e8291){return{'name':_0x2e8291[_0xa2f3('0x2a')],'type':_0x2e8291[_0xa2f3('0x2b')]['key']};});_0x452142[_0xa2f3('0x2c')]=_[_0xa2f3('0x2d')](_0x46f5c4,_0xa2f3('0x26'));_0x452142[_0xa2f3('0x2e')]=_[_0xa2f3('0x2f')](_0x4ec4ab[_0xa2f3('0x2e')]);_0x452142[_0xa2f3('0x30')]=_[_0xa2f3('0x31')](_0x452142[_0xa2f3('0x2c')],_0x452142['query']);_0x5b868c[_0xa2f3('0x32')]=_[_0xa2f3('0x31')](_0x452142[_0xa2f3('0x2c')],qs[_0xa2f3('0x33')](_0x4ec4ab[_0xa2f3('0x2e')]['fields']));_0x5b868c[_0xa2f3('0x32')]=_0x5b868c['attributes']['length']?_0x5b868c[_0xa2f3('0x32')]:_0x452142[_0xa2f3('0x2c')];if(!_0x4ec4ab['query'][_0xa2f3('0x34')](_0xa2f3('0x35'))){_0x5b868c['limit']=qs[_0xa2f3('0x1e')](_0x4ec4ab[_0xa2f3('0x2e')]['limit']);_0x5b868c['offset']=qs[_0xa2f3('0x1b')](_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x1b')]);}_0x5b868c[_0xa2f3('0x36')]=qs['sort'](_0x4ec4ab[_0xa2f3('0x2e')]['sort']);_0x5b868c[_0xa2f3('0x37')]=qs['filters'](_['pick'](_0x4ec4ab[_0xa2f3('0x2e')],_0x452142[_0xa2f3('0x30')]),_0x46f5c4);if(_0x4ec4ab['query'][_0xa2f3('0x38')]){_0x5b868c['where']=_[_0xa2f3('0x39')](_0x5b868c[_0xa2f3('0x37')],{'$or':_[_0xa2f3('0x2d')](_0x46f5c4,function(_0x11dade){if(_0x11dade[_0xa2f3('0x2b')]!==_0xa2f3('0x3a')){var _0x55d45f={};_0x55d45f[_0x11dade[_0xa2f3('0x26')]]={'$like':'%'+_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x38')]+'%'};return _0x55d45f;}})});}_0x5b868c=_[_0xa2f3('0x39')]({},_0x5b868c,_0x4ec4ab[_0xa2f3('0x3b')]);var _0x3a7010={'where':_0x5b868c[_0xa2f3('0x37')]};return db[_0xa2f3('0x28')]['count'](_0x3a7010)[_0xa2f3('0x23')](function(_0x1ce533){_0x52f211[_0xa2f3('0x1d')]=_0x1ce533;if(_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x3c')]){_0x5b868c['include']=[{'all':!![]}];}return db[_0xa2f3('0x28')][_0xa2f3('0x3d')](_0x5b868c);})['then'](function(_0x3c5b86){_0x52f211[_0xa2f3('0x3e')]=_0x3c5b86;return _0x52f211;})[_0xa2f3('0x23')](respondWithFilteredResult(_0x1ceea4,_0x5b868c))[_0xa2f3('0x3f')](handleError(_0x1ceea4,null));};exports['show']=function(_0x3d3458,_0x266a68){var _0x10e6e0={'raw':!![],'where':{'id':_0x3d3458[_0xa2f3('0x40')]['id']}},_0x2edc0b={};_0x2edc0b[_0xa2f3('0x2c')]=_[_0xa2f3('0x2f')](db[_0xa2f3('0x28')][_0xa2f3('0x29')]);_0x2edc0b[_0xa2f3('0x2e')]=_[_0xa2f3('0x2f')](_0x3d3458[_0xa2f3('0x2e')]);_0x2edc0b['filters']=_[_0xa2f3('0x31')](_0x2edc0b['model'],_0x2edc0b[_0xa2f3('0x2e')]);_0x10e6e0[_0xa2f3('0x32')]=_[_0xa2f3('0x31')](_0x2edc0b[_0xa2f3('0x2c')],qs['fields'](_0x3d3458[_0xa2f3('0x2e')][_0xa2f3('0x33')]));_0x10e6e0['attributes']=_0x10e6e0['attributes'][_0xa2f3('0x41')]?_0x10e6e0[_0xa2f3('0x32')]:_0x2edc0b[_0xa2f3('0x2c')];if(_0x3d3458[_0xa2f3('0x2e')][_0xa2f3('0x3c')]){_0x10e6e0['include']=[{'all':!![]}];}_0x10e6e0=_['merge']({},_0x10e6e0,_0x3d3458['options']);return db[_0xa2f3('0x28')][_0xa2f3('0x42')](_0x10e6e0)[_0xa2f3('0x23')](handleEntityNotFound(_0x266a68,null))[_0xa2f3('0x23')](respondWithResult(_0x266a68,null))['catch'](handleError(_0x266a68,null));};exports[_0xa2f3('0x43')]=function(_0x4d5ed0,_0x2c275a){return db[_0xa2f3('0x28')]['create'](_0x4d5ed0['body'],{})[_0xa2f3('0x23')](respondWithResult(_0x2c275a,0xc9))[_0xa2f3('0x3f')](handleError(_0x2c275a,null));};exports[_0xa2f3('0x22')]=function(_0x5b8403,_0xe2ad3){if(_0x5b8403['body']['id']){delete _0x5b8403[_0xa2f3('0x44')]['id'];}return db['FreshdeskField'][_0xa2f3('0x42')]({'where':{'id':_0x5b8403[_0xa2f3('0x40')]['id']}})[_0xa2f3('0x23')](handleEntityNotFound(_0xe2ad3,null))[_0xa2f3('0x23')](saveUpdates(_0x5b8403[_0xa2f3('0x44')],null))[_0xa2f3('0x23')](respondWithResult(_0xe2ad3,null))[_0xa2f3('0x3f')](handleError(_0xe2ad3,null));};exports['destroy']=function(_0x5c634c,_0x11b2e4){return db[_0xa2f3('0x28')][_0xa2f3('0x42')]({'where':{'id':_0x5c634c[_0xa2f3('0x40')]['id']}})[_0xa2f3('0x23')](handleEntityNotFound(_0x11b2e4,null))[_0xa2f3('0x23')](removeEntity(_0x11b2e4,null))['catch'](handleError(_0x11b2e4,null));}; \ No newline at end of file +var _0xa0bc=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','findAll','rows','show','create','catch','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x5edd9b,_0x4ef6eb){var _0x36e1bc=function(_0x17dcb6){while(--_0x17dcb6){_0x5edd9b['push'](_0x5edd9b['shift']());}};_0x36e1bc(++_0x4ef6eb);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca0b('0x0'));var zipdir=require(_0xca0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0b('0x2'));var moment=require(_0xca0b('0x3'));var BPromise=require(_0xca0b('0x4'));var Mustache=require(_0xca0b('0x5'));var util=require(_0xca0b('0x6'));var path=require(_0xca0b('0x7'));var sox=require(_0xca0b('0x8'));var csv=require(_0xca0b('0x9'));var ejs=require(_0xca0b('0xa'));var fs=require('fs');var fs_extra=require(_0xca0b('0xb'));var _=require(_0xca0b('0xc'));var squel=require(_0xca0b('0xd'));var crypto=require(_0xca0b('0xe'));var jsforce=require(_0xca0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca0b('0x9'));var querystring=require(_0xca0b('0x10'));var Papa=require(_0xca0b('0x11'));var Redis=require(_0xca0b('0x12'));var authService=require(_0xca0b('0x13'));var qs=require(_0xca0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca0b('0x15'));var logger=require(_0xca0b('0x16'))(_0xca0b('0x17'));var utils=require(_0xca0b('0x18'));var config=require(_0xca0b('0x19'));var licenseUtil=require(_0xca0b('0x1a'));var db=require(_0xca0b('0x1b'))['db'];function respondWithStatusCode(_0x3a2e25,_0x22ca9d){_0x22ca9d=_0x22ca9d||0xcc;return function(_0x2ce366){if(_0x2ce366){return _0x3a2e25['sendStatus'](_0x22ca9d);}return _0x3a2e25[_0xca0b('0x1c')](_0x22ca9d)[_0xca0b('0x1d')]();};}function respondWithResult(_0x358972,_0x5da205){_0x5da205=_0x5da205||0xc8;return function(_0x106ed6){if(_0x106ed6){return _0x358972[_0xca0b('0x1c')](_0x5da205)[_0xca0b('0x1e')](_0x106ed6);}};}function respondWithFilteredResult(_0x2beba9,_0x42b68e){return function(_0x404c6d){if(_0x404c6d){var _0x4d7620=typeof _0x42b68e[_0xca0b('0x1f')]===_0xca0b('0x20')&&typeof _0x42b68e['limit']===_0xca0b('0x20');var _0x5db810=_0x404c6d[_0xca0b('0x21')];var _0x5050b7=_0x4d7620?0x0:_0x42b68e[_0xca0b('0x1f')];var _0x32eff7=_0x4d7620?_0x404c6d[_0xca0b('0x21')]:_0x42b68e['offset']+_0x42b68e[_0xca0b('0x22')];var _0x2c0c53;if(_0x32eff7>=_0x5db810){_0x32eff7=_0x5db810;_0x2c0c53=0xc8;}else{_0x2c0c53=0xce;}_0x2beba9['status'](_0x2c0c53);return _0x2beba9[_0xca0b('0x23')](_0xca0b('0x24'),_0x5050b7+'-'+_0x32eff7+'/'+_0x5db810)[_0xca0b('0x1e')](_0x404c6d);}return null;};}function patchUpdates(_0x59bda9){return function(_0x865393){try{jsonpatch[_0xca0b('0x25')](_0x865393,_0x59bda9,!![]);}catch(_0x484e26){return BPromise[_0xca0b('0x26')](_0x484e26);}return _0x865393[_0xca0b('0x27')]();};}function saveUpdates(_0x2ae93b,_0x49e695){return function(_0x119589){if(_0x119589){return _0x119589[_0xca0b('0x28')](_0x2ae93b)[_0xca0b('0x29')](function(_0x504d91){return _0x504d91;});}return null;};}function removeEntity(_0x54fb03,_0x11f5c3){return function(_0x428459){if(_0x428459){return _0x428459[_0xca0b('0x2a')]()[_0xca0b('0x29')](function(){_0x54fb03[_0xca0b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe122e8,_0x10b5f3){return function(_0x131c0e){if(!_0x131c0e){_0xe122e8[_0xca0b('0x2b')](0x194);}return _0x131c0e;};}function handleError(_0x15478d,_0x48e172){_0x48e172=_0x48e172||0x1f4;return function(_0x4d2d1a){logger['error'](_0x4d2d1a[_0xca0b('0x2c')]);if(_0x4d2d1a[_0xca0b('0x2d')]){delete _0x4d2d1a[_0xca0b('0x2d')];}_0x15478d[_0xca0b('0x1c')](_0x48e172)[_0xca0b('0x2e')](_0x4d2d1a);};}exports['index']=function(_0x23af62,_0xbfcb5f){var _0x3b73ff={},_0x20f0d5={},_0x227cdc={'count':0x0,'rows':[]};var _0x449a3a=_[_0xca0b('0x2f')](db['FreshdeskField'][_0xca0b('0x30')],function(_0x17a365){return{'name':_0x17a365[_0xca0b('0x31')],'type':_0x17a365[_0xca0b('0x32')]['key']};});_0x20f0d5[_0xca0b('0x33')]=_[_0xca0b('0x2f')](_0x449a3a,_0xca0b('0x2d'));_0x20f0d5[_0xca0b('0x34')]=_[_0xca0b('0x35')](_0x23af62[_0xca0b('0x34')]);_0x20f0d5[_0xca0b('0x36')]=_[_0xca0b('0x37')](_0x20f0d5[_0xca0b('0x33')],_0x20f0d5[_0xca0b('0x34')]);_0x3b73ff[_0xca0b('0x38')]=_[_0xca0b('0x37')](_0x20f0d5[_0xca0b('0x33')],qs[_0xca0b('0x39')](_0x23af62[_0xca0b('0x34')]['fields']));_0x3b73ff[_0xca0b('0x38')]=_0x3b73ff[_0xca0b('0x38')][_0xca0b('0x3a')]?_0x3b73ff[_0xca0b('0x38')]:_0x20f0d5['model'];if(!_0x23af62[_0xca0b('0x34')][_0xca0b('0x3b')]('nolimit')){_0x3b73ff[_0xca0b('0x22')]=qs[_0xca0b('0x22')](_0x23af62[_0xca0b('0x34')][_0xca0b('0x22')]);_0x3b73ff[_0xca0b('0x1f')]=qs[_0xca0b('0x1f')](_0x23af62[_0xca0b('0x34')][_0xca0b('0x1f')]);}_0x3b73ff['order']=qs['sort'](_0x23af62[_0xca0b('0x34')][_0xca0b('0x3c')]);_0x3b73ff[_0xca0b('0x3d')]=qs[_0xca0b('0x36')](_[_0xca0b('0x3e')](_0x23af62[_0xca0b('0x34')],_0x20f0d5[_0xca0b('0x36')]),_0x449a3a);if(_0x23af62[_0xca0b('0x34')][_0xca0b('0x3f')]){_0x3b73ff[_0xca0b('0x3d')]=_[_0xca0b('0x40')](_0x3b73ff[_0xca0b('0x3d')],{'$or':_[_0xca0b('0x2f')](_0x449a3a,function(_0x236edc){if(_0x236edc[_0xca0b('0x32')]!==_0xca0b('0x41')){var _0xdce72f={};_0xdce72f[_0x236edc[_0xca0b('0x2d')]]={'$like':'%'+_0x23af62[_0xca0b('0x34')][_0xca0b('0x3f')]+'%'};return _0xdce72f;}})});}_0x3b73ff=_[_0xca0b('0x40')]({},_0x3b73ff,_0x23af62[_0xca0b('0x42')]);var _0x1757f0={'where':_0x3b73ff[_0xca0b('0x3d')]};return db[_0xca0b('0x43')]['count'](_0x1757f0)['then'](function(_0x1e62f5){_0x227cdc[_0xca0b('0x21')]=_0x1e62f5;if(_0x23af62['query']['includeAll']){_0x3b73ff['include']=[{'all':!![]}];}return db[_0xca0b('0x43')][_0xca0b('0x44')](_0x3b73ff);})[_0xca0b('0x29')](function(_0xf9e175){_0x227cdc[_0xca0b('0x45')]=_0xf9e175;return _0x227cdc;})['then'](respondWithFilteredResult(_0xbfcb5f,_0x3b73ff))['catch'](handleError(_0xbfcb5f,null));};exports[_0xca0b('0x46')]=function(_0x543bf8,_0x170d76){var _0x4eca5d={'raw':!![],'where':{'id':_0x543bf8['params']['id']}},_0x57bab3={};_0x57bab3[_0xca0b('0x33')]=_[_0xca0b('0x35')](db[_0xca0b('0x43')][_0xca0b('0x30')]);_0x57bab3[_0xca0b('0x34')]=_[_0xca0b('0x35')](_0x543bf8['query']);_0x57bab3[_0xca0b('0x36')]=_[_0xca0b('0x37')](_0x57bab3[_0xca0b('0x33')],_0x57bab3[_0xca0b('0x34')]);_0x4eca5d[_0xca0b('0x38')]=_['intersection'](_0x57bab3['model'],qs[_0xca0b('0x39')](_0x543bf8[_0xca0b('0x34')][_0xca0b('0x39')]));_0x4eca5d[_0xca0b('0x38')]=_0x4eca5d['attributes'][_0xca0b('0x3a')]?_0x4eca5d[_0xca0b('0x38')]:_0x57bab3[_0xca0b('0x33')];if(_0x543bf8[_0xca0b('0x34')]['includeAll']){_0x4eca5d['include']=[{'all':!![]}];}_0x4eca5d=_[_0xca0b('0x40')]({},_0x4eca5d,_0x543bf8[_0xca0b('0x42')]);return db[_0xca0b('0x43')]['find'](_0x4eca5d)[_0xca0b('0x29')](handleEntityNotFound(_0x170d76,null))[_0xca0b('0x29')](respondWithResult(_0x170d76,null))['catch'](handleError(_0x170d76,null));};exports['create']=function(_0x4f531c,_0x379a06){return db[_0xca0b('0x43')][_0xca0b('0x47')](_0x4f531c['body'],{})['then'](respondWithResult(_0x379a06,0xc9))[_0xca0b('0x48')](handleError(_0x379a06,null));};exports[_0xca0b('0x28')]=function(_0x250288,_0x174e81){if(_0x250288[_0xca0b('0x49')]['id']){delete _0x250288[_0xca0b('0x49')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x250288['params']['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x174e81,null))[_0xca0b('0x29')](saveUpdates(_0x250288['body'],null))[_0xca0b('0x29')](respondWithResult(_0x174e81,null))[_0xca0b('0x48')](handleError(_0x174e81,null));};exports[_0xca0b('0x2a')]=function(_0x535cce,_0x251820){return db['FreshdeskField'][_0xca0b('0x4a')]({'where':{'id':_0x535cce[_0xca0b('0x4b')]['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x251820,null))[_0xca0b('0x29')](removeEntity(_0x251820,null))[_0xca0b('0x48')](handleError(_0x251820,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d4a3a62..8889ae1 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 _0x2f42=['FieldId','lodash','util','../../config/logger','moment','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x2f42,0x90));var _0x22f4=function(_0x1b387d,_0x161939){_0x1b387d=_0x1b387d-0x0;var _0x1e5a06=_0x2f42[_0x1b387d];return _0x1e5a06;};'use strict';var _=require(_0x22f4('0x0'));var util=require(_0x22f4('0x1'));var logger=require(_0x22f4('0x2'))('api');var moment=require(_0x22f4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22f4('0x4'));var rimraf=require('rimraf');var config=require(_0x22f4('0x5'));var attributes=require(_0x22f4('0x6'));module[_0x22f4('0x7')]=function(_0x386042,_0x1a9596){return _0x386042[_0x22f4('0x8')](_0x22f4('0x9'),attributes,{'tableName':_0x22f4('0xa'),'paranoid':![],'indexes':[{'name':_0x22f4('0xb'),'fields':['idField',_0x22f4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad26=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x421e3a,_0xd69d11){var _0x3f9abd=function(_0x4b9bb4){while(--_0x4b9bb4){_0x421e3a['push'](_0x421e3a['shift']());}};_0x3f9abd(++_0xd69d11);}(_0xad26,0x1ab));var _0x6ad2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xad26[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x6ad2('0x0'));var util=require('util');var logger=require(_0x6ad2('0x1'))(_0x6ad2('0x2'));var moment=require(_0x6ad2('0x3'));var BPromise=require(_0x6ad2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ad2('0x5'));var rimraf=require(_0x6ad2('0x6'));var config=require(_0x6ad2('0x7'));var attributes=require(_0x6ad2('0x8'));module[_0x6ad2('0x9')]=function(_0x4ca015,_0x1eb4d7){return _0x4ca015[_0x6ad2('0xa')](_0x6ad2('0xb'),attributes,{'tableName':_0x6ad2('0xc'),'paranoid':![],'indexes':[{'name':_0x6ad2('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 53b19cc..17abe4b 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 _0xc075=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xc075,0x199));var _0x5c07=function(_0x578c23,_0x1ce327){_0x578c23=_0x578c23-0x0;var _0x83b5c6=_0xc075[_0x578c23];return _0x83b5c6;};'use strict';var _=require('lodash');var util=require(_0x5c07('0x0'));var moment=require(_0x5c07('0x1'));var BPromise=require(_0x5c07('0x2'));var rs=require(_0x5c07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c07('0x4'));var logger=require(_0x5c07('0x5'))(_0x5c07('0x6'));var config=require(_0x5c07('0x7'));var jayson=require(_0x5c07('0x8'));var client=jayson[_0x5c07('0x9')][_0x5c07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x228d3d,_0x5dd68f,_0x3457a2){return new BPromise(function(_0xf838f9,_0x25b241){return client[_0x5c07('0xb')](_0x228d3d,_0x3457a2)[_0x5c07('0xc')](function(_0x16f312){logger['info'](_0x5c07('0xd'),_0x5dd68f,_0x5c07('0xe'));logger['debug'](_0x5c07('0xf'),_0x5dd68f,_0x5c07('0xe'),JSON[_0x5c07('0x10')](_0x16f312));if(_0x16f312['error']){if(_0x16f312[_0x5c07('0x11')][_0x5c07('0x12')]===0x1f4){logger[_0x5c07('0x11')](_0x5c07('0xd'),_0x5dd68f,_0x16f312[_0x5c07('0x11')][_0x5c07('0x13')]);return _0x25b241(_0x16f312['error']['message']);}logger[_0x5c07('0x11')](_0x5c07('0xd'),_0x5dd68f,_0x16f312[_0x5c07('0x11')][_0x5c07('0x13')]);return _0xf838f9(_0x16f312[_0x5c07('0x11')][_0x5c07('0x13')]);}else{logger[_0x5c07('0x14')](_0x5c07('0xd'),_0x5dd68f,_0x5c07('0xe'));_0xf838f9(_0x16f312[_0x5c07('0x15')]['message']);}})[_0x5c07('0x16')](function(_0x212d82){logger[_0x5c07('0x11')](_0x5c07('0xd'),_0x5dd68f,_0x212d82);_0x25b241(_0x212d82);});});} \ No newline at end of file +var _0xe6aa=['../../config/environment','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x23159f,_0x31708b){var _0x1d72da=function(_0x13411b){while(--_0x13411b){_0x23159f['push'](_0x23159f['shift']());}};_0x1d72da(++_0x31708b);}(_0xe6aa,0x188));var _0xae6a=function(_0x100ecd,_0x25bf74){_0x100ecd=_0x100ecd-0x0;var _0x23f5e5=_0xe6aa[_0x100ecd];return _0x23f5e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xae6a('0x0'));var BPromise=require(_0xae6a('0x1'));var rs=require(_0xae6a('0x2'));var fs=require('fs');var Redis=require(_0xae6a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xae6a('0x4'));var logger=require(_0xae6a('0x5'))(_0xae6a('0x6'));var config=require(_0xae6a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xae6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf92e7c,_0x1db950,_0x1042d7){return new BPromise(function(_0x573351,_0x44a506){return client['request'](_0xf92e7c,_0x1042d7)[_0xae6a('0x9')](function(_0x54b6a7){logger[_0xae6a('0xa')](_0xae6a('0xb'),_0x1db950,_0xae6a('0xc'));logger[_0xae6a('0xd')](_0xae6a('0xe'),_0x1db950,_0xae6a('0xc'),JSON['stringify'](_0x54b6a7));if(_0x54b6a7[_0xae6a('0xf')]){if(_0x54b6a7[_0xae6a('0xf')][_0xae6a('0x10')]===0x1f4){logger['error'](_0xae6a('0xb'),_0x1db950,_0x54b6a7[_0xae6a('0xf')][_0xae6a('0x11')]);return _0x44a506(_0x54b6a7[_0xae6a('0xf')][_0xae6a('0x11')]);}logger['error'](_0xae6a('0xb'),_0x1db950,_0x54b6a7['error']['message']);return _0x573351(_0x54b6a7[_0xae6a('0xf')]['message']);}else{logger[_0xae6a('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x1db950,_0xae6a('0xc'));_0x573351(_0x54b6a7[_0xae6a('0x12')][_0xae6a('0x11')]);}})['catch'](function(_0xd03f33){logger[_0xae6a('0xf')](_0xae6a('0xb'),_0x1db950,_0xd03f33);_0x44a506(_0xd03f33);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index fec87ce..e1c8578 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 _0xb62e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x53a1b1,_0x4e384e){var _0x20e349=function(_0x304721){while(--_0x304721){_0x53a1b1['push'](_0x53a1b1['shift']());}};_0x20e349(++_0x4e384e);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x11')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller['addConfiguration']);router[_0xeb62('0x13')](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x15')]);router['delete'](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1c7c=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28836b,_0x389433){var _0x51f3f8=function(_0x503226){while(--_0x503226){_0x28836b['push'](_0x28836b['shift']());}};_0x51f3f8(++_0x389433);}(_0x1c7c,0x164));var _0xc1c7=function(_0xfa28d8,_0x3cd5e3){_0xfa28d8=_0xfa28d8-0x0;var _0x48da3f=_0x1c7c[_0xfa28d8];return _0x48da3f;};'use strict';var multer=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var path=require(_0xc1c7('0x2'));var timeout=require(_0xc1c7('0x3'));var express=require('express');var router=express[_0xc1c7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1c7('0x5'));var interaction=require(_0xc1c7('0x6'));var config=require(_0xc1c7('0x7'));var controller=require(_0xc1c7('0x8'));router[_0xc1c7('0x9')]('/',auth[_0xc1c7('0xa')](),controller[_0xc1c7('0xb')]);router[_0xc1c7('0x9')](_0xc1c7('0xc'),auth[_0xc1c7('0xa')](),controller[_0xc1c7('0xd')]);router[_0xc1c7('0x9')](_0xc1c7('0xe'),auth[_0xc1c7('0xa')](),controller[_0xc1c7('0xf')]);router[_0xc1c7('0x9')](_0xc1c7('0x10'),auth['isAuthenticated'](),controller[_0xc1c7('0x11')]);router[_0xc1c7('0x12')]('/',auth['isAuthenticated'](),controller[_0xc1c7('0x13')]);router[_0xc1c7('0x12')](_0xc1c7('0xe'),auth['isAuthenticated'](),controller[_0xc1c7('0x14')]);router[_0xc1c7('0x15')](_0xc1c7('0xc'),auth[_0xc1c7('0xa')](),controller[_0xc1c7('0x16')]);router[_0xc1c7('0x17')](_0xc1c7('0xc'),auth[_0xc1c7('0xa')](),controller[_0xc1c7('0x18')]);module[_0xc1c7('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 86c008f..1104a4e 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 _0x5b12=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5b12,0xa3));var _0x25b1=function(_0x3d887d,_0x2f4f61){_0x3d887d=_0x3d887d-0x0;var _0x323a73=_0x5b12[_0x3d887d];return _0x323a73;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x5b12,0xa3));var _0x25b1=function(_0x3d8188,_0x3a659b){_0x3d8188=_0x3d8188-0x0;var _0x5a35f6=_0x5b12[_0x3d8188];return _0x5a35f6;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b7b82e4..bf33674 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 _0x9591=['where','filters','pick','filter','merge','type','VIRTUAL','options','FreshsalesAccount','rows','catch','show','params','keys','includeAll','include','body','update','find','FreshsalesConfiguration','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','create','FreshsalesField','Descriptions','getFields','remoteUri','apiKey','username','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x40d24a,_0x2e7761){var _0x272a3e=function(_0x34678d){while(--_0x34678d){_0x40d24a['push'](_0x40d24a['shift']());}};_0x272a3e(++_0x2e7761);}(_0x9591,0x162));var _0x1959=function(_0x56c809,_0x28dd9a){_0x56c809=_0x56c809-0x0;var _0x14b0a7=_0x9591[_0x56c809];return _0x14b0a7;};'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(_0x1959('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1959('0x1'));var util=require(_0x1959('0x2'));var path=require(_0x1959('0x3'));var sox=require('sox');var csv=require(_0x1959('0x4'));var ejs=require(_0x1959('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1959('0x6'));var squel=require(_0x1959('0x7'));var crypto=require('crypto');var jsforce=require(_0x1959('0x8'));var deskjs=require(_0x1959('0x9'));var toCsv=require(_0x1959('0x4'));var querystring=require(_0x1959('0xa'));var Papa=require(_0x1959('0xb'));var Redis=require(_0x1959('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1959('0xd'));var as=require(_0x1959('0xe'));var hardwareService=require(_0x1959('0xf'));var logger=require(_0x1959('0x10'))(_0x1959('0x11'));var utils=require(_0x1959('0x12'));var config=require(_0x1959('0x13'));var licenseUtil=require(_0x1959('0x14'));var db=require(_0x1959('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2f2bf1,_0x57895a){_0x57895a=_0x57895a||0xcc;return function(_0x39b7bf){if(_0x39b7bf){return _0x2f2bf1[_0x1959('0x16')](_0x57895a);}return _0x2f2bf1[_0x1959('0x17')](_0x57895a)[_0x1959('0x18')]();};}function respondWithResult(_0xa9c1ed,_0xf6f766){_0xf6f766=_0xf6f766||0xc8;return function(_0x54c794){if(_0x54c794){return _0xa9c1ed[_0x1959('0x17')](_0xf6f766)[_0x1959('0x19')](_0x54c794);}};}function respondWithFilteredResult(_0x536b69,_0x24035d){return function(_0x116b34){if(_0x116b34){var _0x926540=typeof _0x24035d[_0x1959('0x1a')]===_0x1959('0x1b')&&typeof _0x24035d[_0x1959('0x1c')]===_0x1959('0x1b');var _0x399b36=_0x116b34[_0x1959('0x1d')];var _0x44440b=_0x926540?0x0:_0x24035d[_0x1959('0x1a')];var _0x2c114d=_0x926540?_0x116b34[_0x1959('0x1d')]:_0x24035d['offset']+_0x24035d[_0x1959('0x1c')];var _0xd37fa3;if(_0x2c114d>=_0x399b36){_0x2c114d=_0x399b36;_0xd37fa3=0xc8;}else{_0xd37fa3=0xce;}_0x536b69['status'](_0xd37fa3);return _0x536b69[_0x1959('0x1e')](_0x1959('0x1f'),_0x44440b+'-'+_0x2c114d+'/'+_0x399b36)['json'](_0x116b34);}return null;};}function patchUpdates(_0xb53301){return function(_0x392c92){try{jsonpatch[_0x1959('0x20')](_0x392c92,_0xb53301,!![]);}catch(_0x34e15e){return BPromise[_0x1959('0x21')](_0x34e15e);}return _0x392c92['save']();};}function saveUpdates(_0x951cbb,_0xb28478){return function(_0x47f75b){if(_0x47f75b){return _0x47f75b['update'](_0x951cbb)['then'](function(_0x1746b3){return _0x1746b3;});}return null;};}function removeEntity(_0x424c8f,_0x5524d4){return function(_0x2f2604){if(_0x2f2604){return _0x2f2604['destroy']()[_0x1959('0x22')](function(){_0x424c8f[_0x1959('0x17')](0xcc)[_0x1959('0x18')]();});}};}function handleEntityNotFound(_0x28517f,_0xe6f9ae){return function(_0x10fa09){if(!_0x10fa09){_0x28517f[_0x1959('0x16')](0x194);}return _0x10fa09;};}function handleError(_0x362914,_0x3def2d){_0x3def2d=_0x3def2d||0x1f4;return function(_0x5048bf){logger[_0x1959('0x23')](_0x5048bf[_0x1959('0x24')]);if(_0x5048bf[_0x1959('0x25')]){delete _0x5048bf[_0x1959('0x25')];}_0x362914[_0x1959('0x17')](_0x3def2d)[_0x1959('0x26')](_0x5048bf);};}exports[_0x1959('0x27')]=function(_0x20ef02,_0x4cf893){var _0x10f8a4={},_0x5cb9f0={},_0x47bbeb={'count':0x0,'rows':[]};var _0x1cee00=_[_0x1959('0x28')](db['FreshsalesAccount'][_0x1959('0x29')],function(_0xb16bed){return{'name':_0xb16bed[_0x1959('0x2a')],'type':_0xb16bed['type'][_0x1959('0x2b')]};});_0x5cb9f0[_0x1959('0x2c')]=_['map'](_0x1cee00,_0x1959('0x25'));_0x5cb9f0['query']=_['keys'](_0x20ef02[_0x1959('0x2d')]);_0x5cb9f0['filters']=_['intersection'](_0x5cb9f0['model'],_0x5cb9f0[_0x1959('0x2d')]);_0x10f8a4['attributes']=_[_0x1959('0x2e')](_0x5cb9f0[_0x1959('0x2c')],qs[_0x1959('0x2f')](_0x20ef02[_0x1959('0x2d')]['fields']));_0x10f8a4[_0x1959('0x30')]=_0x10f8a4[_0x1959('0x30')][_0x1959('0x31')]?_0x10f8a4[_0x1959('0x30')]:_0x5cb9f0[_0x1959('0x2c')];if(!_0x20ef02[_0x1959('0x2d')][_0x1959('0x32')](_0x1959('0x33'))){_0x10f8a4[_0x1959('0x1c')]=qs['limit'](_0x20ef02[_0x1959('0x2d')]['limit']);_0x10f8a4[_0x1959('0x1a')]=qs[_0x1959('0x1a')](_0x20ef02[_0x1959('0x2d')]['offset']);}_0x10f8a4[_0x1959('0x34')]=qs['sort'](_0x20ef02['query'][_0x1959('0x35')]);_0x10f8a4[_0x1959('0x36')]=qs[_0x1959('0x37')](_[_0x1959('0x38')](_0x20ef02[_0x1959('0x2d')],_0x5cb9f0[_0x1959('0x37')]),_0x1cee00);if(_0x20ef02[_0x1959('0x2d')][_0x1959('0x39')]){_0x10f8a4[_0x1959('0x36')]=_[_0x1959('0x3a')](_0x10f8a4['where'],{'$or':_[_0x1959('0x28')](_0x1cee00,function(_0x29ad99){if(_0x29ad99[_0x1959('0x3b')]!==_0x1959('0x3c')){var _0x3de979={};_0x3de979[_0x29ad99[_0x1959('0x25')]]={'$like':'%'+_0x20ef02[_0x1959('0x2d')][_0x1959('0x39')]+'%'};return _0x3de979;}})});}_0x10f8a4=_[_0x1959('0x3a')]({},_0x10f8a4,_0x20ef02[_0x1959('0x3d')]);var _0x48b342={'where':_0x10f8a4[_0x1959('0x36')]};return db[_0x1959('0x3e')][_0x1959('0x1d')](_0x48b342)[_0x1959('0x22')](function(_0x51e1cf){_0x47bbeb[_0x1959('0x1d')]=_0x51e1cf;if(_0x20ef02['query']['includeAll']){_0x10f8a4['include']=[{'all':!![]}];}return db[_0x1959('0x3e')]['findAll'](_0x10f8a4);})[_0x1959('0x22')](function(_0x574dd0){_0x47bbeb[_0x1959('0x3f')]=_0x574dd0;return _0x47bbeb;})[_0x1959('0x22')](respondWithFilteredResult(_0x4cf893,_0x10f8a4))[_0x1959('0x40')](handleError(_0x4cf893,null));};exports[_0x1959('0x41')]=function(_0x235bc8,_0x32f4f5){var _0x50124e={'raw':![],'where':{'id':_0x235bc8[_0x1959('0x42')]['id']}},_0x3c606e={};_0x3c606e[_0x1959('0x2c')]=_[_0x1959('0x43')](db[_0x1959('0x3e')][_0x1959('0x29')]);_0x3c606e[_0x1959('0x2d')]=_[_0x1959('0x43')](_0x235bc8[_0x1959('0x2d')]);_0x3c606e[_0x1959('0x37')]=_[_0x1959('0x2e')](_0x3c606e[_0x1959('0x2c')],_0x3c606e[_0x1959('0x2d')]);_0x50124e[_0x1959('0x30')]=_[_0x1959('0x2e')](_0x3c606e['model'],qs['fields'](_0x235bc8[_0x1959('0x2d')]['fields']));_0x50124e[_0x1959('0x30')]=_0x50124e[_0x1959('0x30')][_0x1959('0x31')]?_0x50124e[_0x1959('0x30')]:_0x3c606e[_0x1959('0x2c')];if(_0x235bc8[_0x1959('0x2d')][_0x1959('0x44')]){_0x50124e[_0x1959('0x45')]=[{'all':!![]}];}_0x50124e=_[_0x1959('0x3a')]({},_0x50124e,_0x235bc8[_0x1959('0x3d')]);return db[_0x1959('0x3e')]['find'](_0x50124e)['then'](handleEntityNotFound(_0x32f4f5,null))['then'](respondWithResult(_0x32f4f5,null))[_0x1959('0x40')](handleError(_0x32f4f5,null));};exports['create']=function(_0x21bc85,_0x4688f8){return db[_0x1959('0x3e')]['create'](_0x21bc85[_0x1959('0x46')],{})[_0x1959('0x22')](respondWithResult(_0x4688f8,0xc9))[_0x1959('0x40')](handleError(_0x4688f8,null));};exports[_0x1959('0x47')]=function(_0x2e3d7f,_0x494755){if(_0x2e3d7f[_0x1959('0x46')]['id']){delete _0x2e3d7f[_0x1959('0x46')]['id'];}return db[_0x1959('0x3e')][_0x1959('0x48')]({'where':{'id':_0x2e3d7f['params']['id']}})[_0x1959('0x22')](handleEntityNotFound(_0x494755,null))[_0x1959('0x22')](saveUpdates(_0x2e3d7f[_0x1959('0x46')],null))[_0x1959('0x22')](respondWithResult(_0x494755,null))[_0x1959('0x40')](handleError(_0x494755,null));};exports['destroy']=function(_0x5ea361,_0x308ed4){return db[_0x1959('0x3e')][_0x1959('0x48')]({'where':{'id':_0x5ea361[_0x1959('0x42')]['id']}})[_0x1959('0x22')](handleEntityNotFound(_0x308ed4,null))[_0x1959('0x22')](removeEntity(_0x308ed4,null))[_0x1959('0x40')](handleError(_0x308ed4,null));};exports['getConfigurations']=function(_0x172355,_0x54a56f,_0x33df2b){var _0x37177f={};var _0x36d311={};var _0x2b5980;var _0x928b07;return db[_0x1959('0x3e')]['findOne']({'where':{'id':_0x172355[_0x1959('0x42')]['id']}})['then'](handleEntityNotFound(_0x54a56f,null))[_0x1959('0x22')](function(_0x584fa9){if(_0x584fa9){_0x2b5980=_0x584fa9;_0x36d311[_0x1959('0x2c')]=_[_0x1959('0x43')](db[_0x1959('0x49')]['rawAttributes']);_0x36d311['query']=_['keys'](_0x172355['query']);_0x36d311[_0x1959('0x37')]=_['intersection'](_0x36d311['model'],_0x36d311[_0x1959('0x2d')]);_0x37177f[_0x1959('0x30')]=_['intersection'](_0x36d311['model'],qs[_0x1959('0x2f')](_0x172355[_0x1959('0x2d')]['fields']));_0x37177f[_0x1959('0x30')]=_0x37177f[_0x1959('0x30')][_0x1959('0x31')]?_0x37177f[_0x1959('0x30')]:_0x36d311[_0x1959('0x2c')];_0x37177f[_0x1959('0x34')]=qs[_0x1959('0x35')](_0x172355[_0x1959('0x2d')][_0x1959('0x35')]);_0x37177f[_0x1959('0x36')]=qs[_0x1959('0x37')](_[_0x1959('0x38')](_0x172355[_0x1959('0x2d')],_0x36d311[_0x1959('0x37')]));if(_0x172355[_0x1959('0x2d')][_0x1959('0x39')]){_0x37177f[_0x1959('0x36')]=_['merge'](_0x37177f[_0x1959('0x36')],{'$or':_[_0x1959('0x28')](_0x37177f[_0x1959('0x30')],function(_0xd0dcc3){var _0x56db18={};_0x56db18[_0xd0dcc3]={'$like':'%'+_0x172355[_0x1959('0x2d')][_0x1959('0x39')]+'%'};return _0x56db18;})});}_0x37177f=_[_0x1959('0x3a')]({},_0x37177f,_0x172355[_0x1959('0x3d')]);return _0x2b5980[_0x1959('0x4a')](_0x37177f);}})['then'](function(_0x5a5351){if(_0x5a5351){_0x928b07=_0x5a5351[_0x1959('0x31')];if(!_0x172355['query'][_0x1959('0x32')](_0x1959('0x33'))){_0x37177f['limit']=qs[_0x1959('0x1c')](_0x172355[_0x1959('0x2d')][_0x1959('0x1c')]);_0x37177f[_0x1959('0x1a')]=qs[_0x1959('0x1a')](_0x172355[_0x1959('0x2d')]['offset']);}return _0x2b5980['getConfigurations'](_0x37177f);}})[_0x1959('0x22')](function(_0x5e52f1){if(_0x5e52f1){return _0x5e52f1?{'count':_0x928b07,'rows':_0x5e52f1}:null;}})[_0x1959('0x22')](respondWithResult(_0x54a56f,null))[_0x1959('0x40')](handleError(_0x54a56f,null));};exports['addConfiguration']=function(_0x58e127,_0x335995,_0x1f4c6f){if(_0x58e127['body']['id']){delete _0x58e127[_0x1959('0x46')]['id'];}return db[_0x1959('0x3e')][_0x1959('0x4b')]({'where':{'id':_0x58e127[_0x1959('0x42')]['id']}})[_0x1959('0x22')](handleEntityNotFound(_0x335995,null))[_0x1959('0x22')](function(_0x18bd73){if(_0x18bd73){_0x58e127[_0x1959('0x46')][_0x1959('0x4c')]=_0x18bd73['id'];_0x58e127[_0x1959('0x46')][_0x1959('0x4d')]=integrations[_0x1959('0x4e')](_0x58e127['body'][_0x1959('0x4f')],_0x58e127[_0x1959('0x46')][_0x1959('0x3b')]);_0x58e127[_0x1959('0x46')]['Descriptions']=integrations[_0x1959('0x50')](_0x58e127[_0x1959('0x46')]['channel'],_0x58e127[_0x1959('0x46')][_0x1959('0x3b')]);return db[_0x1959('0x49')][_0x1959('0x51')](_0x58e127['body'],{'include':[{'model':db[_0x1959('0x52')],'as':_0x1959('0x4d')},{'model':db[_0x1959('0x52')],'as':_0x1959('0x53')}]});}return null;})['then'](respondWithResult(_0x335995,null))[_0x1959('0x40')](handleError(_0x335995,null));};exports[_0x1959('0x54')]=function(_0x3748ed,_0x554ab5,_0x164475){var _0xa088aa='';var _0x409420='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3748ed[_0x1959('0x42')]['id']},'attributes':['id','username',_0x1959('0x55'),_0x1959('0x56')]})['then'](handleEntityNotFound(_0x554ab5,null))[_0x1959('0x22')](function(_0x5bf4b5){if(_0x5bf4b5){_0x409420=_0x5bf4b5[_0x1959('0x57')];_0xa088aa=_0x5bf4b5['remoteUri'];var _0x164492=_0x5bf4b5[_0x1959('0x55')][_0x1959('0x58')](-0x1);if(_0x164492==='/'){_0xa088aa=_0xa088aa['substring'](0x0,_0xa088aa[_0x1959('0x59')](_0x164492));}return rp({'method':_0x1959('0x5a'),'uri':util[_0x1959('0x5b')](_0x1959('0x5c'),_0xa088aa,_0x1959('0x5d')),'headers':{'Authorization':_0x1959('0x5e')+_0x5bf4b5[_0x1959('0x56')]},'json':!![]});}})['then'](function(_0x17faea){if(_0x17faea){var _0x1586f1=_0x17faea[_0x1959('0x5f')];var _0x332106=![];var _0x334a76=null;for(_0x334a76=0x0;_0x334a76<_0x1586f1['length'];_0x334a76++){if(_0x1586f1[_0x334a76]['email']===_0x409420){_0x332106=!![];}}if(_0x332106){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1959('0x60')});}}})[_0x1959('0x22')](respondWithResult(_0x554ab5,null))['catch'](function(_0x125dd1){var _0x23a8f9=_0x3748ed[_0x1959('0x2d')][_0x1959('0x61')]?0x1f4:_0x125dd1[_0x1959('0x62')]||0x1f4;logger[_0x1959('0x23')](_0x1959('0x63'),_0x1959('0x54'),_0x23a8f9,JSON[_0x1959('0x64')](_0x125dd1));delete _0x125dd1[_0x1959('0x25')];if(_0x23a8f9===0x191){_0x23a8f9=0x190;}_0x554ab5[_0x1959('0x17')](_0x23a8f9)[_0x1959('0x26')](_0x3748ed[_0x1959('0x2d')]['test']?{'message':_0x1959('0x65'),'statusCode':_0x125dd1[_0x1959('0x62')]}:_0x125dd1);});}; \ No newline at end of file +var _0x96ff=['include','findAll','rows','catch','keys','find','create','body','update','params','destroy','getConfigurations','FreshsalesConfiguration','sort','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','findOne','username','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0xa46fcf,_0x21316a){var _0x10a143=function(_0x3136ed){while(--_0x3136ed){_0xa46fcf['push'](_0xa46fcf['shift']());}};_0x10a143(++_0x21316a);}(_0x96ff,0xf1));var _0xf96f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x96ff[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xf96f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf96f('0x1'));var jsonpatch=require(_0xf96f('0x2'));var rp=require(_0xf96f('0x3'));var moment=require(_0xf96f('0x4'));var BPromise=require(_0xf96f('0x5'));var Mustache=require('mustache');var util=require(_0xf96f('0x6'));var path=require(_0xf96f('0x7'));var sox=require(_0xf96f('0x8'));var csv=require(_0xf96f('0x9'));var ejs=require(_0xf96f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf96f('0xb'));var crypto=require('crypto');var jsforce=require(_0xf96f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf96f('0x9'));var querystring=require(_0xf96f('0xd'));var Papa=require('papaparse');var Redis=require(_0xf96f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf96f('0xf'));var as=require(_0xf96f('0x10'));var hardwareService=require(_0xf96f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf96f('0x12'));var config=require(_0xf96f('0x13'));var licenseUtil=require(_0xf96f('0x14'));var db=require(_0xf96f('0x15'))['db'];var integrations=require(_0xf96f('0x16'));function respondWithStatusCode(_0x13edba,_0x35ae8c){_0x35ae8c=_0x35ae8c||0xcc;return function(_0xcaeac1){if(_0xcaeac1){return _0x13edba['sendStatus'](_0x35ae8c);}return _0x13edba[_0xf96f('0x17')](_0x35ae8c)['end']();};}function respondWithResult(_0x35d520,_0x19a489){_0x19a489=_0x19a489||0xc8;return function(_0x5d50c1){if(_0x5d50c1){return _0x35d520[_0xf96f('0x17')](_0x19a489)['json'](_0x5d50c1);}};}function respondWithFilteredResult(_0x22919e,_0x269398){return function(_0x4e9888){if(_0x4e9888){var _0x1ab060=typeof _0x269398['offset']===_0xf96f('0x18')&&typeof _0x269398[_0xf96f('0x19')]===_0xf96f('0x18');var _0x5bf931=_0x4e9888['count'];var _0x45705b=_0x1ab060?0x0:_0x269398['offset'];var _0x391fc9=_0x1ab060?_0x4e9888[_0xf96f('0x1a')]:_0x269398[_0xf96f('0x1b')]+_0x269398[_0xf96f('0x19')];var _0x5d7c68;if(_0x391fc9>=_0x5bf931){_0x391fc9=_0x5bf931;_0x5d7c68=0xc8;}else{_0x5d7c68=0xce;}_0x22919e[_0xf96f('0x17')](_0x5d7c68);return _0x22919e[_0xf96f('0x1c')](_0xf96f('0x1d'),_0x45705b+'-'+_0x391fc9+'/'+_0x5bf931)['json'](_0x4e9888);}return null;};}function patchUpdates(_0x1bc69e){return function(_0xde1ee2){try{jsonpatch[_0xf96f('0x1e')](_0xde1ee2,_0x1bc69e,!![]);}catch(_0x304be2){return BPromise['reject'](_0x304be2);}return _0xde1ee2[_0xf96f('0x1f')]();};}function saveUpdates(_0x1f3ea2,_0x1a38e6){return function(_0x1b78fc){if(_0x1b78fc){return _0x1b78fc['update'](_0x1f3ea2)[_0xf96f('0x20')](function(_0x3fa9d4){return _0x3fa9d4;});}return null;};}function removeEntity(_0x208856,_0x1109fb){return function(_0x364692){if(_0x364692){return _0x364692['destroy']()[_0xf96f('0x20')](function(){_0x208856['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0559,_0x15df05){return function(_0x28d7ce){if(!_0x28d7ce){_0xe0559[_0xf96f('0x21')](0x194);}return _0x28d7ce;};}function handleError(_0x2da0b5,_0x62a418){_0x62a418=_0x62a418||0x1f4;return function(_0x47ea78){logger[_0xf96f('0x22')](_0x47ea78[_0xf96f('0x23')]);if(_0x47ea78[_0xf96f('0x24')]){delete _0x47ea78[_0xf96f('0x24')];}_0x2da0b5[_0xf96f('0x17')](_0x62a418)[_0xf96f('0x25')](_0x47ea78);};}exports[_0xf96f('0x26')]=function(_0x2e3220,_0x42f234){var _0x3b3b7d={},_0xe270dd={},_0x20001f={'count':0x0,'rows':[]};var _0x4437c1=_[_0xf96f('0x27')](db[_0xf96f('0x28')][_0xf96f('0x29')],function(_0x141ebd){return{'name':_0x141ebd[_0xf96f('0x2a')],'type':_0x141ebd[_0xf96f('0x2b')][_0xf96f('0x2c')]};});_0xe270dd[_0xf96f('0x2d')]=_['map'](_0x4437c1,_0xf96f('0x24'));_0xe270dd[_0xf96f('0x2e')]=_['keys'](_0x2e3220[_0xf96f('0x2e')]);_0xe270dd[_0xf96f('0x2f')]=_[_0xf96f('0x30')](_0xe270dd[_0xf96f('0x2d')],_0xe270dd[_0xf96f('0x2e')]);_0x3b3b7d[_0xf96f('0x31')]=_['intersection'](_0xe270dd[_0xf96f('0x2d')],qs[_0xf96f('0x32')](_0x2e3220[_0xf96f('0x2e')][_0xf96f('0x32')]));_0x3b3b7d['attributes']=_0x3b3b7d['attributes'][_0xf96f('0x33')]?_0x3b3b7d[_0xf96f('0x31')]:_0xe270dd[_0xf96f('0x2d')];if(!_0x2e3220[_0xf96f('0x2e')]['hasOwnProperty']('nolimit')){_0x3b3b7d['limit']=qs[_0xf96f('0x19')](_0x2e3220['query'][_0xf96f('0x19')]);_0x3b3b7d['offset']=qs[_0xf96f('0x1b')](_0x2e3220[_0xf96f('0x2e')][_0xf96f('0x1b')]);}_0x3b3b7d[_0xf96f('0x34')]=qs['sort'](_0x2e3220[_0xf96f('0x2e')]['sort']);_0x3b3b7d[_0xf96f('0x35')]=qs['filters'](_[_0xf96f('0x36')](_0x2e3220[_0xf96f('0x2e')],_0xe270dd['filters']),_0x4437c1);if(_0x2e3220[_0xf96f('0x2e')][_0xf96f('0x37')]){_0x3b3b7d[_0xf96f('0x35')]=_[_0xf96f('0x38')](_0x3b3b7d[_0xf96f('0x35')],{'$or':_[_0xf96f('0x27')](_0x4437c1,function(_0x2d6eb8){if(_0x2d6eb8[_0xf96f('0x2b')]!==_0xf96f('0x39')){var _0x510f65={};_0x510f65[_0x2d6eb8[_0xf96f('0x24')]]={'$like':'%'+_0x2e3220[_0xf96f('0x2e')][_0xf96f('0x37')]+'%'};return _0x510f65;}})});}_0x3b3b7d=_[_0xf96f('0x38')]({},_0x3b3b7d,_0x2e3220['options']);var _0x42c79d={'where':_0x3b3b7d[_0xf96f('0x35')]};return db[_0xf96f('0x28')]['count'](_0x42c79d)[_0xf96f('0x20')](function(_0x282171){_0x20001f['count']=_0x282171;if(_0x2e3220[_0xf96f('0x2e')][_0xf96f('0x3a')]){_0x3b3b7d[_0xf96f('0x3b')]=[{'all':!![]}];}return db[_0xf96f('0x28')][_0xf96f('0x3c')](_0x3b3b7d);})['then'](function(_0x5aae93){_0x20001f[_0xf96f('0x3d')]=_0x5aae93;return _0x20001f;})[_0xf96f('0x20')](respondWithFilteredResult(_0x42f234,_0x3b3b7d))[_0xf96f('0x3e')](handleError(_0x42f234,null));};exports['show']=function(_0x10a0f2,_0x2e37f9){var _0x10c039={'raw':![],'where':{'id':_0x10a0f2['params']['id']}},_0x49a285={};_0x49a285['model']=_[_0xf96f('0x3f')](db[_0xf96f('0x28')][_0xf96f('0x29')]);_0x49a285[_0xf96f('0x2e')]=_['keys'](_0x10a0f2[_0xf96f('0x2e')]);_0x49a285[_0xf96f('0x2f')]=_[_0xf96f('0x30')](_0x49a285[_0xf96f('0x2d')],_0x49a285[_0xf96f('0x2e')]);_0x10c039[_0xf96f('0x31')]=_[_0xf96f('0x30')](_0x49a285['model'],qs[_0xf96f('0x32')](_0x10a0f2['query'][_0xf96f('0x32')]));_0x10c039[_0xf96f('0x31')]=_0x10c039[_0xf96f('0x31')][_0xf96f('0x33')]?_0x10c039[_0xf96f('0x31')]:_0x49a285[_0xf96f('0x2d')];if(_0x10a0f2[_0xf96f('0x2e')][_0xf96f('0x3a')]){_0x10c039[_0xf96f('0x3b')]=[{'all':!![]}];}_0x10c039=_['merge']({},_0x10c039,_0x10a0f2['options']);return db[_0xf96f('0x28')][_0xf96f('0x40')](_0x10c039)['then'](handleEntityNotFound(_0x2e37f9,null))[_0xf96f('0x20')](respondWithResult(_0x2e37f9,null))[_0xf96f('0x3e')](handleError(_0x2e37f9,null));};exports[_0xf96f('0x41')]=function(_0x461667,_0x2aaa06){return db[_0xf96f('0x28')]['create'](_0x461667[_0xf96f('0x42')],{})['then'](respondWithResult(_0x2aaa06,0xc9))[_0xf96f('0x3e')](handleError(_0x2aaa06,null));};exports[_0xf96f('0x43')]=function(_0x5cd032,_0x5b425d){if(_0x5cd032[_0xf96f('0x42')]['id']){delete _0x5cd032['body']['id'];}return db['FreshsalesAccount'][_0xf96f('0x40')]({'where':{'id':_0x5cd032[_0xf96f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b425d,null))[_0xf96f('0x20')](saveUpdates(_0x5cd032[_0xf96f('0x42')],null))[_0xf96f('0x20')](respondWithResult(_0x5b425d,null))['catch'](handleError(_0x5b425d,null));};exports[_0xf96f('0x45')]=function(_0x5997f5,_0x3b6d12){return db[_0xf96f('0x28')]['find']({'where':{'id':_0x5997f5[_0xf96f('0x44')]['id']}})[_0xf96f('0x20')](handleEntityNotFound(_0x3b6d12,null))[_0xf96f('0x20')](removeEntity(_0x3b6d12,null))[_0xf96f('0x3e')](handleError(_0x3b6d12,null));};exports[_0xf96f('0x46')]=function(_0x59cb44,_0x400499,_0x3b0be5){var _0x5f0ad4={};var _0x3daf4d={};var _0x25346f;var _0x1ad1e7;return db[_0xf96f('0x28')]['findOne']({'where':{'id':_0x59cb44[_0xf96f('0x44')]['id']}})[_0xf96f('0x20')](handleEntityNotFound(_0x400499,null))[_0xf96f('0x20')](function(_0x1e4740){if(_0x1e4740){_0x25346f=_0x1e4740;_0x3daf4d[_0xf96f('0x2d')]=_[_0xf96f('0x3f')](db[_0xf96f('0x47')][_0xf96f('0x29')]);_0x3daf4d[_0xf96f('0x2e')]=_[_0xf96f('0x3f')](_0x59cb44[_0xf96f('0x2e')]);_0x3daf4d[_0xf96f('0x2f')]=_[_0xf96f('0x30')](_0x3daf4d['model'],_0x3daf4d[_0xf96f('0x2e')]);_0x5f0ad4[_0xf96f('0x31')]=_[_0xf96f('0x30')](_0x3daf4d[_0xf96f('0x2d')],qs[_0xf96f('0x32')](_0x59cb44['query'][_0xf96f('0x32')]));_0x5f0ad4[_0xf96f('0x31')]=_0x5f0ad4['attributes'][_0xf96f('0x33')]?_0x5f0ad4['attributes']:_0x3daf4d[_0xf96f('0x2d')];_0x5f0ad4[_0xf96f('0x34')]=qs['sort'](_0x59cb44[_0xf96f('0x2e')][_0xf96f('0x48')]);_0x5f0ad4['where']=qs[_0xf96f('0x2f')](_[_0xf96f('0x36')](_0x59cb44[_0xf96f('0x2e')],_0x3daf4d[_0xf96f('0x2f')]));if(_0x59cb44[_0xf96f('0x2e')][_0xf96f('0x37')]){_0x5f0ad4[_0xf96f('0x35')]=_[_0xf96f('0x38')](_0x5f0ad4[_0xf96f('0x35')],{'$or':_['map'](_0x5f0ad4[_0xf96f('0x31')],function(_0x320704){var _0x5dc870={};_0x5dc870[_0x320704]={'$like':'%'+_0x59cb44['query']['filter']+'%'};return _0x5dc870;})});}_0x5f0ad4=_[_0xf96f('0x38')]({},_0x5f0ad4,_0x59cb44[_0xf96f('0x49')]);return _0x25346f['getConfigurations'](_0x5f0ad4);}})['then'](function(_0x2e6bce){if(_0x2e6bce){_0x1ad1e7=_0x2e6bce[_0xf96f('0x33')];if(!_0x59cb44['query']['hasOwnProperty'](_0xf96f('0x4a'))){_0x5f0ad4['limit']=qs[_0xf96f('0x19')](_0x59cb44[_0xf96f('0x2e')][_0xf96f('0x19')]);_0x5f0ad4['offset']=qs[_0xf96f('0x1b')](_0x59cb44[_0xf96f('0x2e')][_0xf96f('0x1b')]);}return _0x25346f['getConfigurations'](_0x5f0ad4);}})[_0xf96f('0x20')](function(_0x3ab50d){if(_0x3ab50d){return _0x3ab50d?{'count':_0x1ad1e7,'rows':_0x3ab50d}:null;}})[_0xf96f('0x20')](respondWithResult(_0x400499,null))[_0xf96f('0x3e')](handleError(_0x400499,null));};exports[_0xf96f('0x4b')]=function(_0x9f28f5,_0x301104,_0x5484f6){if(_0x9f28f5[_0xf96f('0x42')]['id']){delete _0x9f28f5[_0xf96f('0x42')]['id'];}return db[_0xf96f('0x28')]['findOne']({'where':{'id':_0x9f28f5[_0xf96f('0x44')]['id']}})[_0xf96f('0x20')](handleEntityNotFound(_0x301104,null))[_0xf96f('0x20')](function(_0x4f1586){if(_0x4f1586){_0x9f28f5[_0xf96f('0x42')][_0xf96f('0x4c')]=_0x4f1586['id'];_0x9f28f5[_0xf96f('0x42')][_0xf96f('0x4d')]=integrations[_0xf96f('0x4e')](_0x9f28f5[_0xf96f('0x42')][_0xf96f('0x4f')],_0x9f28f5['body'][_0xf96f('0x2b')]);_0x9f28f5[_0xf96f('0x42')][_0xf96f('0x50')]=integrations[_0xf96f('0x51')](_0x9f28f5[_0xf96f('0x42')][_0xf96f('0x4f')],_0x9f28f5[_0xf96f('0x42')]['type']);return db['FreshsalesConfiguration'][_0xf96f('0x41')](_0x9f28f5[_0xf96f('0x42')],{'include':[{'model':db[_0xf96f('0x52')],'as':_0xf96f('0x4d')},{'model':db[_0xf96f('0x52')],'as':_0xf96f('0x50')}]});}return null;})['then'](respondWithResult(_0x301104,null))['catch'](handleError(_0x301104,null));};exports[_0xf96f('0x53')]=function(_0x4ccadc,_0x28e1bb,_0x418052){var _0x5024a1='';var _0x2aa04e='';return db[_0xf96f('0x28')][_0xf96f('0x54')]({'where':{'id':_0x4ccadc[_0xf96f('0x44')]['id']},'attributes':['id',_0xf96f('0x55'),_0xf96f('0x56'),'apiKey']})['then'](handleEntityNotFound(_0x28e1bb,null))[_0xf96f('0x20')](function(_0x52cf30){if(_0x52cf30){_0x2aa04e=_0x52cf30[_0xf96f('0x55')];_0x5024a1=_0x52cf30[_0xf96f('0x56')];var _0xf0dea3=_0x52cf30[_0xf96f('0x56')][_0xf96f('0x57')](-0x1);if(_0xf0dea3==='/'){_0x5024a1=_0x5024a1[_0xf96f('0x58')](0x0,_0x5024a1[_0xf96f('0x59')](_0xf0dea3));}return rp({'method':_0xf96f('0x5a'),'uri':util['format'](_0xf96f('0x5b'),_0x5024a1,_0xf96f('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x52cf30['apiKey']},'json':!![]});}})[_0xf96f('0x20')](function(_0x1c1e7a){if(_0x1c1e7a){var _0x3c5343=_0x1c1e7a[_0xf96f('0x5d')];var _0x3c871d=![];var _0x7919a4=null;for(_0x7919a4=0x0;_0x7919a4<_0x3c5343[_0xf96f('0x33')];_0x7919a4++){if(_0x3c5343[_0x7919a4][_0xf96f('0x5e')]===_0x2aa04e){_0x3c871d=!![];}}if(_0x3c871d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf96f('0x5f')});}}})[_0xf96f('0x20')](respondWithResult(_0x28e1bb,null))[_0xf96f('0x3e')](function(_0x299563){var _0x343c5c=_0x4ccadc['query'][_0xf96f('0x60')]?0x1f4:_0x299563[_0xf96f('0x61')]||0x1f4;logger[_0xf96f('0x22')](_0xf96f('0x62'),_0xf96f('0x53'),_0x343c5c,JSON['stringify'](_0x299563));delete _0x299563[_0xf96f('0x24')];if(_0x343c5c===0x191){_0x343c5c=0x190;}_0x28e1bb[_0xf96f('0x17')](_0x343c5c)['send'](_0x4ccadc[_0xf96f('0x2e')]['test']?{'message':_0xf96f('0x63'),'statusCode':_0x299563[_0xf96f('0x61')]}:_0x299563);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b913cdb..6308341 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 _0x1967=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x1967,0x173));var _0x7196=function(_0x4d125a,_0x47b8a9){_0x4d125a=_0x4d125a-0x0;var _0x61ca0d=_0x1967[_0x4d125a];return _0x61ca0d;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7196('0xa')]=function(_0x186175,_0x194746){return _0x186175[_0x7196('0xb')](_0x7196('0xc'),attributes,{'tableName':_0x7196('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2272=['request-promise','path','rimraf','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x58a0bb,_0x3464b8){var _0x1f1146=function(_0x1178ed){while(--_0x1178ed){_0x58a0bb['push'](_0x58a0bb['shift']());}};_0x1f1146(++_0x3464b8);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var logger=require(_0x2227('0x2'))(_0x2227('0x3'));var moment=require(_0x2227('0x4'));var BPromise=require('bluebird');var rp=require(_0x2227('0x5'));var fs=require('fs');var path=require(_0x2227('0x6'));var rimraf=require(_0x2227('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x2227('0x8'));module[_0x2227('0x9')]=function(_0xb33647,_0x2591db){return _0xb33647[_0x2227('0xa')](_0x2227('0xb'),attributes,{'tableName':_0x2227('0xc'),'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 e681599..399649d 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x54e0cc,_0x559c79){var _0xfd954c=function(_0xa2f897){while(--_0xa2f897){_0x54e0cc['push'](_0x54e0cc['shift']());}};_0xfd954c(++_0x559c79);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['FreshsalesAccount'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowFreshsalesAccount',_0x144e55);logger[_0x65f6('0xd')]('ShowFreshsalesAccount',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowFreshsalesAccount',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x524e=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshsalesAccount','catch','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x405531,_0x1c6e9b){var _0x2784f6=function(_0x37d1f3){while(--_0x37d1f3){_0x405531['push'](_0x405531['shift']());}};_0x2784f6(++_0x1c6e9b);}(_0x524e,0x15e));var _0xe524=function(_0x15329f,_0x1fe315){_0x15329f=_0x15329f-0x0;var _0x417ae0=_0x524e[_0x15329f];return _0x417ae0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['GetFreshsalesAccount']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')]({'raw':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]===undefined?!![]:![]:!![],'where':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1c')]||null:null,'include':_0x3a4027[_0xe524('0x18')]?_0x3a4027['options'][_0xe524('0x1d')]?_['map'](_0x3a4027['options'][_0xe524('0x1d')],function(_0x23df5e){return{'model':db[_0x23df5e[_0xe524('0x1e')]],'as':_0x23df5e['as'],'attributes':_0x23df5e[_0xe524('0x1b')],'include':_0x23df5e['include']?_[_0xe524('0x1f')](_0x23df5e['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x1e')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1b')],'include':_0x17e245[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x17e245[_0xe524('0x1d')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x45abad){logger[_0xe524('0xd')](_0xe524('0x20'),_0x3a4027);logger[_0xe524('0x10')]('GetFreshsalesAccount',_0x3a4027,JSON['stringify'](_0x45abad));_0x11b2a1(_0x45abad);})[_0xe524('0x21')](function(_0x25e7a7){logger[_0xe524('0x13')](_0xe524('0x20'),_0x25e7a7[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb['error'](0x1f4,_0x25e7a7[_0xe524('0x15')]));});});};exports[_0xe524('0x22')]=function(_0x4a4e15){var _0x5b7ded=this;return new Promise(function(_0x20688e,_0x376324){return db['FreshsalesAccount'][_0xe524('0x23')]({'raw':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['attributes']||null:null,'include':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')]?_['map'](_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')],function(_0x49c43e){return{'model':db[_0x49c43e[_0xe524('0x1e')]],'as':_0x49c43e['as'],'attributes':_0x49c43e[_0xe524('0x1b')],'include':_0x49c43e[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x49c43e['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x1e')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1b')],'include':_0x415450[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x415450[_0xe524('0x1d')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x1e')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x56f371){logger[_0xe524('0xd')](_0xe524('0x22'),_0x4a4e15);logger['debug'](_0xe524('0x22'),_0x4a4e15,JSON['stringify'](_0x56f371));_0x20688e(_0x56f371);})[_0xe524('0x21')](function(_0x41af26){logger[_0xe524('0x13')](_0xe524('0x22'),_0x41af26[_0xe524('0x15')],_0x4a4e15);_0x376324(_0x5b7ded[_0xe524('0x13')](0x1f4,_0x41af26[_0xe524('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 28096fa..00d72d1 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 _0x7dcf=['show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x158057,_0x242072){var _0x237a4a=function(_0x58edce){while(--_0x58edce){_0x158057['push'](_0x158057['shift']());}};_0x237a4a(++_0x242072);}(_0x7dcf,0xb2));var _0xf7dc=function(_0x44a9c8,_0x19facb){_0x44a9c8=_0x44a9c8-0x0;var _0x3a3d70=_0x7dcf[_0x44a9c8];return _0x3a3d70;};'use strict';var multer=require(_0xf7dc('0x0'));var util=require(_0xf7dc('0x1'));var path=require(_0xf7dc('0x2'));var timeout=require(_0xf7dc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7dc('0x4'));var auth=require(_0xf7dc('0x5'));var interaction=require(_0xf7dc('0x6'));var config=require(_0xf7dc('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xf7dc('0x8')](),controller['index']);router[_0xf7dc('0x9')](_0xf7dc('0xa'),auth[_0xf7dc('0x8')](),controller[_0xf7dc('0xb')]);router[_0xf7dc('0x9')](_0xf7dc('0xc'),auth[_0xf7dc('0x8')](),controller['getSubjects']);router['get'](_0xf7dc('0xd'),auth[_0xf7dc('0x8')](),controller[_0xf7dc('0xe')]);router['get'](_0xf7dc('0xf'),auth[_0xf7dc('0x8')](),controller[_0xf7dc('0x10')]);router[_0xf7dc('0x11')]('/',auth[_0xf7dc('0x8')](),controller[_0xf7dc('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf7dc('0x13')](_0xf7dc('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf7dc('0x14')]=router; \ No newline at end of file +var _0x5a7d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','/:id','update','delete','exports','util','path'];(function(_0x3a5af0,_0x260aaf){var _0x2914bc=function(_0x15660a){while(--_0x15660a){_0x3a5af0['push'](_0x3a5af0['shift']());}};_0x2914bc(++_0x260aaf);}(_0x5a7d,0x14e));var _0xd5a7=function(_0x1e5c8d,_0x1bd355){_0x1e5c8d=_0x1e5c8d-0x0;var _0x17f720=_0x5a7d[_0x1e5c8d];return _0x17f720;};'use strict';var multer=require('multer');var util=require(_0xd5a7('0x0'));var path=require(_0xd5a7('0x1'));var timeout=require(_0xd5a7('0x2'));var express=require(_0xd5a7('0x3'));var router=express[_0xd5a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5a7('0x5'));var interaction=require(_0xd5a7('0x6'));var config=require('../../config/environment');var controller=require(_0xd5a7('0x7'));router[_0xd5a7('0x8')]('/',auth[_0xd5a7('0x9')](),controller[_0xd5a7('0xa')]);router[_0xd5a7('0x8')]('/:id',auth[_0xd5a7('0x9')](),controller[_0xd5a7('0xb')]);router[_0xd5a7('0x8')]('/:id/subjects',auth[_0xd5a7('0x9')](),controller[_0xd5a7('0xc')]);router['get'](_0xd5a7('0xd'),auth['isAuthenticated'](),controller[_0xd5a7('0xe')]);router[_0xd5a7('0x8')](_0xd5a7('0xf'),auth[_0xd5a7('0x9')](),controller[_0xd5a7('0x10')]);router[_0xd5a7('0x11')]('/',auth[_0xd5a7('0x9')](),controller[_0xd5a7('0x12')]);router[_0xd5a7('0x13')](_0xd5a7('0x14'),auth['isAuthenticated'](),controller[_0xd5a7('0x15')]);router[_0xd5a7('0x16')]('/:id',auth[_0xd5a7('0x9')](),controller['destroy']);module[_0xd5a7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 664129b..7ec688c 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 _0x264b=['sequelize','exports','STRING'];(function(_0x4ac7b4,_0xdbd931){var _0x478310=function(_0x5b70fa){while(--_0x5b70fa){_0x4ac7b4['push'](_0x4ac7b4['shift']());}};_0x478310(++_0xdbd931);}(_0x264b,0x183));var _0xb264=function(_0x250d57,_0x3e911b){_0x250d57=_0x250d57-0x0;var _0x17384e=_0x264b[_0x250d57];return _0x17384e;};'use strict';var Sequelize=require(_0xb264('0x0'));module[_0xb264('0x1')]={'name':{'type':Sequelize[_0xb264('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1435=['sequelize','STRING'];(function(_0x5bb38b,_0x3dd621){var _0x37bc41=function(_0x13b069){while(--_0x13b069){_0x5bb38b['push'](_0x5bb38b['shift']());}};_0x37bc41(++_0x3dd621);}(_0x1435,0x1c2));var _0x5143=function(_0x5571df,_0x18d467){_0x5571df=_0x5571df-0x0;var _0x4a6302=_0x1435[_0x5571df];return _0x4a6302;};'use strict';var Sequelize=require(_0x5143('0x0'));module['exports']={'name':{'type':Sequelize[_0x5143('0x1')]},'description':{'type':Sequelize[_0x5143('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 4facbc0..7a8a87f 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 _0xb83c=['../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','getSubjects','getDescriptions','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xaea441,_0x3de85b){var _0x4332c1=function(_0xa76ba8){while(--_0xa76ba8){_0xaea441['push'](_0xaea441['shift']());}};_0x4332c1(++_0x3de85b);}(_0xb83c,0x12f));var _0xcb83=function(_0x59868e,_0x3072ac){_0x59868e=_0x59868e-0x0;var _0x2098d5=_0xb83c[_0x59868e];return _0x2098d5;};'use strict';var emlformat=require(_0xcb83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb83('0x1'));var jsonpatch=require(_0xcb83('0x2'));var rp=require(_0xcb83('0x3'));var moment=require(_0xcb83('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb83('0x5'));var util=require('util');var path=require(_0xcb83('0x6'));var sox=require(_0xcb83('0x7'));var csv=require(_0xcb83('0x8'));var ejs=require(_0xcb83('0x9'));var fs=require('fs');var fs_extra=require(_0xcb83('0xa'));var _=require('lodash');var squel=require(_0xcb83('0xb'));var crypto=require(_0xcb83('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcb83('0xd'));var toCsv=require(_0xcb83('0x8'));var querystring=require(_0xcb83('0xe'));var Papa=require(_0xcb83('0xf'));var Redis=require(_0xcb83('0x10'));var authService=require(_0xcb83('0x11'));var qs=require(_0xcb83('0x12'));var as=require(_0xcb83('0x13'));var hardwareService=require(_0xcb83('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcb83('0x15'));var licenseUtil=require(_0xcb83('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x169021,_0x3ddf69){_0x3ddf69=_0x3ddf69||0xcc;return function(_0x5ae190){if(_0x5ae190){return _0x169021['sendStatus'](_0x3ddf69);}return _0x169021['status'](_0x3ddf69)[_0xcb83('0x17')]();};}function respondWithResult(_0x9c1561,_0x55809b){_0x55809b=_0x55809b||0xc8;return function(_0x667ae5){if(_0x667ae5){return _0x9c1561[_0xcb83('0x18')](_0x55809b)['json'](_0x667ae5);}};}function respondWithFilteredResult(_0x2c543c,_0x1501ea){return function(_0x15f505){if(_0x15f505){var _0x2c34a4=typeof _0x1501ea[_0xcb83('0x19')]===_0xcb83('0x1a')&&typeof _0x1501ea[_0xcb83('0x1b')]==='undefined';var _0x3453cb=_0x15f505[_0xcb83('0x1c')];var _0x125543=_0x2c34a4?0x0:_0x1501ea[_0xcb83('0x19')];var _0x90107b=_0x2c34a4?_0x15f505[_0xcb83('0x1c')]:_0x1501ea['offset']+_0x1501ea[_0xcb83('0x1b')];var _0x541012;if(_0x90107b>=_0x3453cb){_0x90107b=_0x3453cb;_0x541012=0xc8;}else{_0x541012=0xce;}_0x2c543c[_0xcb83('0x18')](_0x541012);return _0x2c543c[_0xcb83('0x1d')]('Content-Range',_0x125543+'-'+_0x90107b+'/'+_0x3453cb)[_0xcb83('0x1e')](_0x15f505);}return null;};}function patchUpdates(_0x2ba1dc){return function(_0x2c0c4f){try{jsonpatch[_0xcb83('0x1f')](_0x2c0c4f,_0x2ba1dc,!![]);}catch(_0x447645){return BPromise[_0xcb83('0x20')](_0x447645);}return _0x2c0c4f[_0xcb83('0x21')]();};}function saveUpdates(_0x46e146,_0xcd5ea){return function(_0x34afc6){if(_0x34afc6){return _0x34afc6[_0xcb83('0x22')](_0x46e146)[_0xcb83('0x23')](function(_0x4cab2f){return _0x4cab2f;});}return null;};}function removeEntity(_0x518e7e,_0xb02e77){return function(_0x215f48){if(_0x215f48){return _0x215f48[_0xcb83('0x24')]()[_0xcb83('0x23')](function(){_0x518e7e[_0xcb83('0x18')](0xcc)[_0xcb83('0x17')]();});}};}function handleEntityNotFound(_0x465eb7,_0x3ffb08){return function(_0x1a449b){if(!_0x1a449b){_0x465eb7[_0xcb83('0x25')](0x194);}return _0x1a449b;};}function handleError(_0x34143c,_0x3df9b0){_0x3df9b0=_0x3df9b0||0x1f4;return function(_0x1bede1){logger[_0xcb83('0x26')](_0x1bede1[_0xcb83('0x27')]);if(_0x1bede1[_0xcb83('0x28')]){delete _0x1bede1[_0xcb83('0x28')];}_0x34143c['status'](_0x3df9b0)[_0xcb83('0x29')](_0x1bede1);};}exports[_0xcb83('0x2a')]=function(_0xfcdff5,_0x3f1540){var _0x3ac4fe={},_0x50c06c={},_0x21e82b={'count':0x0,'rows':[]};var _0x53db8f=_['map'](db[_0xcb83('0x2b')][_0xcb83('0x2c')],function(_0x1e9c8){return{'name':_0x1e9c8[_0xcb83('0x2d')],'type':_0x1e9c8[_0xcb83('0x2e')]['key']};});_0x50c06c[_0xcb83('0x2f')]=_[_0xcb83('0x30')](_0x53db8f,_0xcb83('0x28'));_0x50c06c[_0xcb83('0x31')]=_[_0xcb83('0x32')](_0xfcdff5['query']);_0x50c06c[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x50c06c['model'],_0x50c06c[_0xcb83('0x31')]);_0x3ac4fe[_0xcb83('0x35')]=_[_0xcb83('0x34')](_0x50c06c[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0xfcdff5[_0xcb83('0x31')]['fields']));_0x3ac4fe[_0xcb83('0x35')]=_0x3ac4fe['attributes'][_0xcb83('0x37')]?_0x3ac4fe[_0xcb83('0x35')]:_0x50c06c[_0xcb83('0x2f')];if(!_0xfcdff5['query'][_0xcb83('0x38')](_0xcb83('0x39'))){_0x3ac4fe['limit']=qs[_0xcb83('0x1b')](_0xfcdff5[_0xcb83('0x31')][_0xcb83('0x1b')]);_0x3ac4fe['offset']=qs[_0xcb83('0x19')](_0xfcdff5['query']['offset']);}_0x3ac4fe[_0xcb83('0x3a')]=qs['sort'](_0xfcdff5['query'][_0xcb83('0x3b')]);_0x3ac4fe[_0xcb83('0x3c')]=qs[_0xcb83('0x33')](_[_0xcb83('0x3d')](_0xfcdff5[_0xcb83('0x31')],_0x50c06c[_0xcb83('0x33')]),_0x53db8f);if(_0xfcdff5[_0xcb83('0x31')]['filter']){_0x3ac4fe[_0xcb83('0x3c')]=_['merge'](_0x3ac4fe['where'],{'$or':_[_0xcb83('0x30')](_0x53db8f,function(_0x5a381a){if(_0x5a381a[_0xcb83('0x2e')]!==_0xcb83('0x3e')){var _0xa7e795={};_0xa7e795[_0x5a381a[_0xcb83('0x28')]]={'$like':'%'+_0xfcdff5['query'][_0xcb83('0x3f')]+'%'};return _0xa7e795;}})});}_0x3ac4fe=_[_0xcb83('0x40')]({},_0x3ac4fe,_0xfcdff5[_0xcb83('0x41')]);var _0x56379b={'where':_0x3ac4fe[_0xcb83('0x3c')]};return db[_0xcb83('0x2b')][_0xcb83('0x1c')](_0x56379b)[_0xcb83('0x23')](function(_0x4b6e0a){_0x21e82b['count']=_0x4b6e0a;if(_0xfcdff5[_0xcb83('0x31')][_0xcb83('0x42')]){_0x3ac4fe[_0xcb83('0x43')]=[{'all':!![]}];}return db[_0xcb83('0x2b')][_0xcb83('0x44')](_0x3ac4fe);})[_0xcb83('0x23')](function(_0x575727){_0x21e82b[_0xcb83('0x45')]=_0x575727;return _0x21e82b;})['then'](respondWithFilteredResult(_0x3f1540,_0x3ac4fe))[_0xcb83('0x46')](handleError(_0x3f1540,null));};exports[_0xcb83('0x47')]=function(_0x510ab3,_0x29c96a){var _0xb279c2={'raw':![],'where':{'id':_0x510ab3[_0xcb83('0x48')]['id']}},_0x2bd08f={};_0x2bd08f[_0xcb83('0x2f')]=_[_0xcb83('0x32')](db[_0xcb83('0x2b')][_0xcb83('0x2c')]);_0x2bd08f[_0xcb83('0x31')]=_[_0xcb83('0x32')](_0x510ab3[_0xcb83('0x31')]);_0x2bd08f[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x2bd08f['model'],_0x2bd08f['query']);_0xb279c2[_0xcb83('0x35')]=_[_0xcb83('0x34')](_0x2bd08f[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x510ab3[_0xcb83('0x31')][_0xcb83('0x36')]));_0xb279c2[_0xcb83('0x35')]=_0xb279c2[_0xcb83('0x35')]['length']?_0xb279c2[_0xcb83('0x35')]:_0x2bd08f[_0xcb83('0x2f')];if(_0x510ab3['query']['includeAll']){_0xb279c2[_0xcb83('0x43')]=[{'all':!![]}];}_0xb279c2=_[_0xcb83('0x40')]({},_0xb279c2,_0x510ab3[_0xcb83('0x41')]);return db[_0xcb83('0x2b')][_0xcb83('0x49')](_0xb279c2)[_0xcb83('0x23')](handleEntityNotFound(_0x29c96a,null))[_0xcb83('0x23')](respondWithResult(_0x29c96a,null))[_0xcb83('0x46')](handleError(_0x29c96a,null));};exports[_0xcb83('0x4a')]=function(_0x225f2d,_0xecd54a){return db[_0xcb83('0x2b')][_0xcb83('0x4a')](_0x225f2d[_0xcb83('0x4b')],{})[_0xcb83('0x23')](respondWithResult(_0xecd54a,0xc9))[_0xcb83('0x46')](handleError(_0xecd54a,null));};exports[_0xcb83('0x22')]=function(_0x3c7c7d,_0x1bfe3d){if(_0x3c7c7d['body']['id']){delete _0x3c7c7d[_0xcb83('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0xcb83('0x49')]({'where':{'id':_0x3c7c7d[_0xcb83('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bfe3d,null))[_0xcb83('0x23')](saveUpdates(_0x3c7c7d[_0xcb83('0x4b')],null))['then'](respondWithResult(_0x1bfe3d,null))[_0xcb83('0x46')](handleError(_0x1bfe3d,null));};exports[_0xcb83('0x24')]=function(_0x59cc2e,_0x3f2740){return db[_0xcb83('0x2b')]['find']({'where':{'id':_0x59cc2e[_0xcb83('0x48')]['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x3f2740,null))[_0xcb83('0x23')](removeEntity(_0x3f2740,null))['catch'](handleError(_0x3f2740,null));};exports['getSubjects']=function(_0x1a6700,_0x37e1da,_0x104063){var _0x18c91e={};var _0x4c155e={};var _0x5ebc94;var _0x35ae89;return db['FreshsalesConfiguration'][_0xcb83('0x4c')]({'where':{'id':_0x1a6700[_0xcb83('0x48')]['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x37e1da,null))[_0xcb83('0x23')](function(_0x4ca3e7){if(_0x4ca3e7){_0x5ebc94=_0x4ca3e7;_0x4c155e[_0xcb83('0x2f')]=_[_0xcb83('0x32')](db['FreshsalesField'][_0xcb83('0x2c')]);_0x4c155e['query']=_[_0xcb83('0x32')](_0x1a6700[_0xcb83('0x31')]);_0x4c155e[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x4c155e['model'],_0x4c155e[_0xcb83('0x31')]);_0x18c91e['attributes']=_[_0xcb83('0x34')](_0x4c155e[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x1a6700[_0xcb83('0x31')][_0xcb83('0x36')]));_0x18c91e[_0xcb83('0x35')]=_0x18c91e[_0xcb83('0x35')]['length']?_0x18c91e[_0xcb83('0x35')]:_0x4c155e[_0xcb83('0x2f')];_0x18c91e[_0xcb83('0x3a')]=qs[_0xcb83('0x3b')](_0x1a6700[_0xcb83('0x31')][_0xcb83('0x3b')]);_0x18c91e['where']=qs[_0xcb83('0x33')](_['pick'](_0x1a6700[_0xcb83('0x31')],_0x4c155e[_0xcb83('0x33')]));if(_0x1a6700['query'][_0xcb83('0x3f')]){_0x18c91e[_0xcb83('0x3c')]=_[_0xcb83('0x40')](_0x18c91e[_0xcb83('0x3c')],{'$or':_[_0xcb83('0x30')](_0x18c91e['attributes'],function(_0xdb109b){var _0x16d674={};_0x16d674[_0xdb109b]={'$like':'%'+_0x1a6700[_0xcb83('0x31')][_0xcb83('0x3f')]+'%'};return _0x16d674;})});}_0x18c91e=_[_0xcb83('0x40')]({},_0x18c91e,_0x1a6700['options']);return _0x5ebc94[_0xcb83('0x4d')](_0x18c91e);}})[_0xcb83('0x23')](function(_0x2915e9){if(_0x2915e9){_0x35ae89=_0x2915e9[_0xcb83('0x37')];if(!_0x1a6700[_0xcb83('0x31')][_0xcb83('0x38')]('nolimit')){_0x18c91e[_0xcb83('0x1b')]=qs[_0xcb83('0x1b')](_0x1a6700[_0xcb83('0x31')]['limit']);_0x18c91e[_0xcb83('0x19')]=qs['offset'](_0x1a6700[_0xcb83('0x31')][_0xcb83('0x19')]);}return _0x5ebc94[_0xcb83('0x4d')](_0x18c91e);}})['then'](function(_0x1037f2){if(_0x1037f2){return _0x1037f2?{'count':_0x35ae89,'rows':_0x1037f2}:null;}})[_0xcb83('0x23')](respondWithResult(_0x37e1da,null))['catch'](handleError(_0x37e1da,null));};exports[_0xcb83('0x4e')]=function(_0x27dedb,_0x484100,_0x1dfbbe){var _0x4a675f={};var _0x527c2b={};var _0x549f90;var _0x3eebe4;return db[_0xcb83('0x2b')][_0xcb83('0x4c')]({'where':{'id':_0x27dedb[_0xcb83('0x48')]['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x484100,null))['then'](function(_0x2f410e){if(_0x2f410e){_0x549f90=_0x2f410e;_0x527c2b[_0xcb83('0x2f')]=_[_0xcb83('0x32')](db[_0xcb83('0x4f')][_0xcb83('0x2c')]);_0x527c2b[_0xcb83('0x31')]=_['keys'](_0x27dedb[_0xcb83('0x31')]);_0x527c2b[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x527c2b[_0xcb83('0x2f')],_0x527c2b[_0xcb83('0x31')]);_0x4a675f[_0xcb83('0x35')]=_[_0xcb83('0x34')](_0x527c2b[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x27dedb[_0xcb83('0x31')][_0xcb83('0x36')]));_0x4a675f[_0xcb83('0x35')]=_0x4a675f[_0xcb83('0x35')][_0xcb83('0x37')]?_0x4a675f[_0xcb83('0x35')]:_0x527c2b[_0xcb83('0x2f')];_0x4a675f[_0xcb83('0x3a')]=qs[_0xcb83('0x3b')](_0x27dedb['query'][_0xcb83('0x3b')]);_0x4a675f[_0xcb83('0x3c')]=qs[_0xcb83('0x33')](_[_0xcb83('0x3d')](_0x27dedb['query'],_0x527c2b[_0xcb83('0x33')]));if(_0x27dedb[_0xcb83('0x31')][_0xcb83('0x3f')]){_0x4a675f[_0xcb83('0x3c')]=_['merge'](_0x4a675f[_0xcb83('0x3c')],{'$or':_[_0xcb83('0x30')](_0x4a675f[_0xcb83('0x35')],function(_0xd49ffc){var _0x13c642={};_0x13c642[_0xd49ffc]={'$like':'%'+_0x27dedb['query'][_0xcb83('0x3f')]+'%'};return _0x13c642;})});}_0x4a675f=_[_0xcb83('0x40')]({},_0x4a675f,_0x27dedb[_0xcb83('0x41')]);return _0x549f90[_0xcb83('0x4e')](_0x4a675f);}})[_0xcb83('0x23')](function(_0x14764c){if(_0x14764c){_0x3eebe4=_0x14764c['length'];if(!_0x27dedb[_0xcb83('0x31')]['hasOwnProperty'](_0xcb83('0x39'))){_0x4a675f[_0xcb83('0x1b')]=qs[_0xcb83('0x1b')](_0x27dedb['query'][_0xcb83('0x1b')]);_0x4a675f[_0xcb83('0x19')]=qs[_0xcb83('0x19')](_0x27dedb[_0xcb83('0x31')][_0xcb83('0x19')]);}return _0x549f90[_0xcb83('0x4e')](_0x4a675f);}})['then'](function(_0x37e2e9){if(_0x37e2e9){return _0x37e2e9?{'count':_0x3eebe4,'rows':_0x37e2e9}:null;}})['then'](respondWithResult(_0x484100,null))[_0xcb83('0x46')](handleError(_0x484100,null));};exports[_0xcb83('0x50')]=function(_0x32c35b,_0x28e276,_0x1cf080){var _0x439217={};var _0x4e43e1={};var _0x1a5fc2;var _0x2547dc;return db[_0xcb83('0x2b')][_0xcb83('0x4c')]({'where':{'id':_0x32c35b['params']['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x28e276,null))[_0xcb83('0x23')](function(_0x5afbe2){if(_0x5afbe2){_0x1a5fc2=_0x5afbe2;_0x4e43e1['model']=_[_0xcb83('0x32')](db['FreshsalesField']['rawAttributes']);_0x4e43e1['query']=_[_0xcb83('0x32')](_0x32c35b['query']);_0x4e43e1[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x4e43e1[_0xcb83('0x2f')],_0x4e43e1[_0xcb83('0x31')]);_0x439217['attributes']=_[_0xcb83('0x34')](_0x4e43e1[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x32c35b[_0xcb83('0x31')]['fields']));_0x439217[_0xcb83('0x35')]=_0x439217[_0xcb83('0x35')][_0xcb83('0x37')]?_0x439217[_0xcb83('0x35')]:_0x4e43e1['model'];_0x439217[_0xcb83('0x3a')]=qs[_0xcb83('0x3b')](_0x32c35b[_0xcb83('0x31')][_0xcb83('0x3b')]);_0x439217['where']=qs[_0xcb83('0x33')](_[_0xcb83('0x3d')](_0x32c35b['query'],_0x4e43e1[_0xcb83('0x33')]));if(_0x32c35b['query'][_0xcb83('0x3f')]){_0x439217[_0xcb83('0x3c')]=_[_0xcb83('0x40')](_0x439217[_0xcb83('0x3c')],{'$or':_['map'](_0x439217[_0xcb83('0x35')],function(_0x3cc4a3){var _0x23c5c4={};_0x23c5c4[_0x3cc4a3]={'$like':'%'+_0x32c35b['query'][_0xcb83('0x3f')]+'%'};return _0x23c5c4;})});}_0x439217=_['merge']({},_0x439217,_0x32c35b[_0xcb83('0x41')]);return _0x1a5fc2[_0xcb83('0x50')](_0x439217);}})[_0xcb83('0x23')](function(_0x15b1c9){if(_0x15b1c9){_0x2547dc=_0x15b1c9['length'];if(!_0x32c35b[_0xcb83('0x31')][_0xcb83('0x38')](_0xcb83('0x39'))){_0x439217[_0xcb83('0x1b')]=qs[_0xcb83('0x1b')](_0x32c35b[_0xcb83('0x31')][_0xcb83('0x1b')]);_0x439217['offset']=qs[_0xcb83('0x19')](_0x32c35b[_0xcb83('0x31')][_0xcb83('0x19')]);}return _0x1a5fc2[_0xcb83('0x50')](_0x439217);}})[_0xcb83('0x23')](function(_0x5b7502){if(_0x5b7502){return _0x5b7502?{'count':_0x2547dc,'rows':_0x5b7502}:null;}})['then'](respondWithResult(_0x28e276,null))['catch'](handleError(_0x28e276,null));}; \ No newline at end of file +var _0xd69d=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','find','catch','body','params','getSubjects','findOne','FreshsalesField','filter','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x4abcf4,_0x4d80bc){var _0x24c066=function(_0x52ef99){while(--_0x52ef99){_0x4abcf4['push'](_0x4abcf4['shift']());}};_0x24c066(++_0x4d80bc);}(_0xd69d,0x1de));var _0xdd69=function(_0x13862e,_0x473273){_0x13862e=_0x13862e-0x0;var _0x5390b2=_0xd69d[_0x13862e];return _0x5390b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd69('0x0'));var zipdir=require(_0xdd69('0x1'));var jsonpatch=require(_0xdd69('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd69('0x3'));var Mustache=require(_0xdd69('0x4'));var util=require(_0xdd69('0x5'));var path=require(_0xdd69('0x6'));var sox=require(_0xdd69('0x7'));var csv=require('to-csv');var ejs=require(_0xdd69('0x8'));var fs=require('fs');var fs_extra=require(_0xdd69('0x9'));var _=require(_0xdd69('0xa'));var squel=require(_0xdd69('0xb'));var crypto=require(_0xdd69('0xc'));var jsforce=require(_0xdd69('0xd'));var deskjs=require(_0xdd69('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdd69('0xf'));var Redis=require(_0xdd69('0x10'));var authService=require(_0xdd69('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdd69('0x12'));var hardwareService=require(_0xdd69('0x13'));var logger=require(_0xdd69('0x14'))(_0xdd69('0x15'));var utils=require('../../config/utils');var config=require(_0xdd69('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd69('0x17'))['db'];function respondWithStatusCode(_0x4cb5f0,_0x385eca){_0x385eca=_0x385eca||0xcc;return function(_0x2d7ce7){if(_0x2d7ce7){return _0x4cb5f0[_0xdd69('0x18')](_0x385eca);}return _0x4cb5f0[_0xdd69('0x19')](_0x385eca)[_0xdd69('0x1a')]();};}function respondWithResult(_0x38a213,_0x5508e2){_0x5508e2=_0x5508e2||0xc8;return function(_0x16b470){if(_0x16b470){return _0x38a213[_0xdd69('0x19')](_0x5508e2)[_0xdd69('0x1b')](_0x16b470);}};}function respondWithFilteredResult(_0x11525e,_0x1b4345){return function(_0x80c38e){if(_0x80c38e){var _0x4151b3=typeof _0x1b4345[_0xdd69('0x1c')]===_0xdd69('0x1d')&&typeof _0x1b4345[_0xdd69('0x1e')]==='undefined';var _0x4faa75=_0x80c38e[_0xdd69('0x1f')];var _0x53e6e5=_0x4151b3?0x0:_0x1b4345['offset'];var _0x47e85c=_0x4151b3?_0x80c38e[_0xdd69('0x1f')]:_0x1b4345[_0xdd69('0x1c')]+_0x1b4345[_0xdd69('0x1e')];var _0x36e983;if(_0x47e85c>=_0x4faa75){_0x47e85c=_0x4faa75;_0x36e983=0xc8;}else{_0x36e983=0xce;}_0x11525e[_0xdd69('0x19')](_0x36e983);return _0x11525e[_0xdd69('0x20')](_0xdd69('0x21'),_0x53e6e5+'-'+_0x47e85c+'/'+_0x4faa75)[_0xdd69('0x1b')](_0x80c38e);}return null;};}function patchUpdates(_0x1a4196){return function(_0xd02378){try{jsonpatch[_0xdd69('0x22')](_0xd02378,_0x1a4196,!![]);}catch(_0x4257dc){return BPromise[_0xdd69('0x23')](_0x4257dc);}return _0xd02378[_0xdd69('0x24')]();};}function saveUpdates(_0x769779,_0x3fba0b){return function(_0x3e3e45){if(_0x3e3e45){return _0x3e3e45[_0xdd69('0x25')](_0x769779)[_0xdd69('0x26')](function(_0x273e8a){return _0x273e8a;});}return null;};}function removeEntity(_0x3d956e,_0x2b0779){return function(_0x176d0d){if(_0x176d0d){return _0x176d0d[_0xdd69('0x27')]()[_0xdd69('0x26')](function(){_0x3d956e[_0xdd69('0x19')](0xcc)[_0xdd69('0x1a')]();});}};}function handleEntityNotFound(_0x45c07f,_0x489eab){return function(_0x24089c){if(!_0x24089c){_0x45c07f[_0xdd69('0x18')](0x194);}return _0x24089c;};}function handleError(_0x19e5af,_0x3b2a2b){_0x3b2a2b=_0x3b2a2b||0x1f4;return function(_0x4ae4c0){logger[_0xdd69('0x28')](_0x4ae4c0['stack']);if(_0x4ae4c0[_0xdd69('0x29')]){delete _0x4ae4c0[_0xdd69('0x29')];}_0x19e5af[_0xdd69('0x19')](_0x3b2a2b)[_0xdd69('0x2a')](_0x4ae4c0);};}exports[_0xdd69('0x2b')]=function(_0xbbfa95,_0x53f761){var _0x560dc1={},_0x1ddbc3={},_0x428ce2={'count':0x0,'rows':[]};var _0x3d342b=_[_0xdd69('0x2c')](db[_0xdd69('0x2d')][_0xdd69('0x2e')],function(_0x15852f){return{'name':_0x15852f[_0xdd69('0x2f')],'type':_0x15852f[_0xdd69('0x30')][_0xdd69('0x31')]};});_0x1ddbc3['model']=_[_0xdd69('0x2c')](_0x3d342b,_0xdd69('0x29'));_0x1ddbc3['query']=_['keys'](_0xbbfa95[_0xdd69('0x32')]);_0x1ddbc3['filters']=_[_0xdd69('0x33')](_0x1ddbc3[_0xdd69('0x34')],_0x1ddbc3[_0xdd69('0x32')]);_0x560dc1[_0xdd69('0x35')]=_[_0xdd69('0x33')](_0x1ddbc3['model'],qs[_0xdd69('0x36')](_0xbbfa95[_0xdd69('0x32')][_0xdd69('0x36')]));_0x560dc1[_0xdd69('0x35')]=_0x560dc1[_0xdd69('0x35')][_0xdd69('0x37')]?_0x560dc1['attributes']:_0x1ddbc3[_0xdd69('0x34')];if(!_0xbbfa95['query'][_0xdd69('0x38')](_0xdd69('0x39'))){_0x560dc1[_0xdd69('0x1e')]=qs[_0xdd69('0x1e')](_0xbbfa95[_0xdd69('0x32')][_0xdd69('0x1e')]);_0x560dc1[_0xdd69('0x1c')]=qs[_0xdd69('0x1c')](_0xbbfa95[_0xdd69('0x32')]['offset']);}_0x560dc1[_0xdd69('0x3a')]=qs[_0xdd69('0x3b')](_0xbbfa95['query'][_0xdd69('0x3b')]);_0x560dc1[_0xdd69('0x3c')]=qs[_0xdd69('0x3d')](_[_0xdd69('0x3e')](_0xbbfa95[_0xdd69('0x32')],_0x1ddbc3[_0xdd69('0x3d')]),_0x3d342b);if(_0xbbfa95[_0xdd69('0x32')]['filter']){_0x560dc1[_0xdd69('0x3c')]=_[_0xdd69('0x3f')](_0x560dc1[_0xdd69('0x3c')],{'$or':_[_0xdd69('0x2c')](_0x3d342b,function(_0x2d6b42){if(_0x2d6b42[_0xdd69('0x30')]!==_0xdd69('0x40')){var _0x149a18={};_0x149a18[_0x2d6b42[_0xdd69('0x29')]]={'$like':'%'+_0xbbfa95[_0xdd69('0x32')]['filter']+'%'};return _0x149a18;}})});}_0x560dc1=_['merge']({},_0x560dc1,_0xbbfa95[_0xdd69('0x41')]);var _0x26616e={'where':_0x560dc1[_0xdd69('0x3c')]};return db['FreshsalesConfiguration']['count'](_0x26616e)[_0xdd69('0x26')](function(_0x2ad30c){_0x428ce2[_0xdd69('0x1f')]=_0x2ad30c;if(_0xbbfa95['query'][_0xdd69('0x42')]){_0x560dc1[_0xdd69('0x43')]=[{'all':!![]}];}return db[_0xdd69('0x2d')][_0xdd69('0x44')](_0x560dc1);})[_0xdd69('0x26')](function(_0x5a3fd3){_0x428ce2['rows']=_0x5a3fd3;return _0x428ce2;})[_0xdd69('0x26')](respondWithFilteredResult(_0x53f761,_0x560dc1))['catch'](handleError(_0x53f761,null));};exports[_0xdd69('0x45')]=function(_0x1ae90b,_0x2aad93){var _0x30c59c={'raw':![],'where':{'id':_0x1ae90b['params']['id']}},_0x33aae6={};_0x33aae6[_0xdd69('0x34')]=_[_0xdd69('0x46')](db[_0xdd69('0x2d')][_0xdd69('0x2e')]);_0x33aae6[_0xdd69('0x32')]=_['keys'](_0x1ae90b[_0xdd69('0x32')]);_0x33aae6[_0xdd69('0x3d')]=_[_0xdd69('0x33')](_0x33aae6[_0xdd69('0x34')],_0x33aae6[_0xdd69('0x32')]);_0x30c59c[_0xdd69('0x35')]=_['intersection'](_0x33aae6[_0xdd69('0x34')],qs[_0xdd69('0x36')](_0x1ae90b['query'][_0xdd69('0x36')]));_0x30c59c[_0xdd69('0x35')]=_0x30c59c[_0xdd69('0x35')]['length']?_0x30c59c[_0xdd69('0x35')]:_0x33aae6[_0xdd69('0x34')];if(_0x1ae90b[_0xdd69('0x32')][_0xdd69('0x42')]){_0x30c59c[_0xdd69('0x43')]=[{'all':!![]}];}_0x30c59c=_[_0xdd69('0x3f')]({},_0x30c59c,_0x1ae90b[_0xdd69('0x41')]);return db[_0xdd69('0x2d')][_0xdd69('0x47')](_0x30c59c)[_0xdd69('0x26')](handleEntityNotFound(_0x2aad93,null))[_0xdd69('0x26')](respondWithResult(_0x2aad93,null))[_0xdd69('0x48')](handleError(_0x2aad93,null));};exports['create']=function(_0x404211,_0x52ced7){return db[_0xdd69('0x2d')]['create'](_0x404211[_0xdd69('0x49')],{})[_0xdd69('0x26')](respondWithResult(_0x52ced7,0xc9))['catch'](handleError(_0x52ced7,null));};exports[_0xdd69('0x25')]=function(_0x52e6dd,_0xe81a87){if(_0x52e6dd[_0xdd69('0x49')]['id']){delete _0x52e6dd[_0xdd69('0x49')]['id'];}return db[_0xdd69('0x2d')]['find']({'where':{'id':_0x52e6dd['params']['id']}})['then'](handleEntityNotFound(_0xe81a87,null))[_0xdd69('0x26')](saveUpdates(_0x52e6dd['body'],null))[_0xdd69('0x26')](respondWithResult(_0xe81a87,null))[_0xdd69('0x48')](handleError(_0xe81a87,null));};exports[_0xdd69('0x27')]=function(_0xcd78fc,_0x351877){return db[_0xdd69('0x2d')][_0xdd69('0x47')]({'where':{'id':_0xcd78fc[_0xdd69('0x4a')]['id']}})['then'](handleEntityNotFound(_0x351877,null))['then'](removeEntity(_0x351877,null))[_0xdd69('0x48')](handleError(_0x351877,null));};exports[_0xdd69('0x4b')]=function(_0xcb2448,_0x393285,_0x6f2849){var _0x322a22={};var _0x4a9054={};var _0x2b0225;var _0x214176;return db[_0xdd69('0x2d')][_0xdd69('0x4c')]({'where':{'id':_0xcb2448['params']['id']}})['then'](handleEntityNotFound(_0x393285,null))[_0xdd69('0x26')](function(_0x3d0b4c){if(_0x3d0b4c){_0x2b0225=_0x3d0b4c;_0x4a9054[_0xdd69('0x34')]=_['keys'](db[_0xdd69('0x4d')][_0xdd69('0x2e')]);_0x4a9054[_0xdd69('0x32')]=_['keys'](_0xcb2448[_0xdd69('0x32')]);_0x4a9054[_0xdd69('0x3d')]=_[_0xdd69('0x33')](_0x4a9054['model'],_0x4a9054[_0xdd69('0x32')]);_0x322a22['attributes']=_[_0xdd69('0x33')](_0x4a9054[_0xdd69('0x34')],qs['fields'](_0xcb2448['query'][_0xdd69('0x36')]));_0x322a22[_0xdd69('0x35')]=_0x322a22[_0xdd69('0x35')][_0xdd69('0x37')]?_0x322a22[_0xdd69('0x35')]:_0x4a9054[_0xdd69('0x34')];_0x322a22['order']=qs[_0xdd69('0x3b')](_0xcb2448[_0xdd69('0x32')][_0xdd69('0x3b')]);_0x322a22['where']=qs[_0xdd69('0x3d')](_[_0xdd69('0x3e')](_0xcb2448[_0xdd69('0x32')],_0x4a9054[_0xdd69('0x3d')]));if(_0xcb2448[_0xdd69('0x32')][_0xdd69('0x4e')]){_0x322a22[_0xdd69('0x3c')]=_[_0xdd69('0x3f')](_0x322a22[_0xdd69('0x3c')],{'$or':_['map'](_0x322a22['attributes'],function(_0x5e80bf){var _0x38461c={};_0x38461c[_0x5e80bf]={'$like':'%'+_0xcb2448[_0xdd69('0x32')]['filter']+'%'};return _0x38461c;})});}_0x322a22=_['merge']({},_0x322a22,_0xcb2448['options']);return _0x2b0225[_0xdd69('0x4b')](_0x322a22);}})[_0xdd69('0x26')](function(_0x26ec91){if(_0x26ec91){_0x214176=_0x26ec91[_0xdd69('0x37')];if(!_0xcb2448[_0xdd69('0x32')][_0xdd69('0x38')](_0xdd69('0x39'))){_0x322a22[_0xdd69('0x1e')]=qs[_0xdd69('0x1e')](_0xcb2448[_0xdd69('0x32')][_0xdd69('0x1e')]);_0x322a22[_0xdd69('0x1c')]=qs[_0xdd69('0x1c')](_0xcb2448[_0xdd69('0x32')]['offset']);}return _0x2b0225['getSubjects'](_0x322a22);}})['then'](function(_0x246d56){if(_0x246d56){return _0x246d56?{'count':_0x214176,'rows':_0x246d56}:null;}})[_0xdd69('0x26')](respondWithResult(_0x393285,null))[_0xdd69('0x48')](handleError(_0x393285,null));};exports[_0xdd69('0x4f')]=function(_0x3e102b,_0x20cf58,_0x73782c){var _0x45351e={};var _0x2e8088={};var _0x3f0717;var _0x2ae41b;return db['FreshsalesConfiguration'][_0xdd69('0x4c')]({'where':{'id':_0x3e102b[_0xdd69('0x4a')]['id']}})[_0xdd69('0x26')](handleEntityNotFound(_0x20cf58,null))[_0xdd69('0x26')](function(_0x3203b8){if(_0x3203b8){_0x3f0717=_0x3203b8;_0x2e8088[_0xdd69('0x34')]=_[_0xdd69('0x46')](db['FreshsalesField'][_0xdd69('0x2e')]);_0x2e8088[_0xdd69('0x32')]=_[_0xdd69('0x46')](_0x3e102b[_0xdd69('0x32')]);_0x2e8088[_0xdd69('0x3d')]=_[_0xdd69('0x33')](_0x2e8088[_0xdd69('0x34')],_0x2e8088[_0xdd69('0x32')]);_0x45351e[_0xdd69('0x35')]=_[_0xdd69('0x33')](_0x2e8088[_0xdd69('0x34')],qs[_0xdd69('0x36')](_0x3e102b['query'][_0xdd69('0x36')]));_0x45351e[_0xdd69('0x35')]=_0x45351e[_0xdd69('0x35')][_0xdd69('0x37')]?_0x45351e[_0xdd69('0x35')]:_0x2e8088[_0xdd69('0x34')];_0x45351e[_0xdd69('0x3a')]=qs[_0xdd69('0x3b')](_0x3e102b[_0xdd69('0x32')][_0xdd69('0x3b')]);_0x45351e[_0xdd69('0x3c')]=qs[_0xdd69('0x3d')](_[_0xdd69('0x3e')](_0x3e102b[_0xdd69('0x32')],_0x2e8088[_0xdd69('0x3d')]));if(_0x3e102b[_0xdd69('0x32')][_0xdd69('0x4e')]){_0x45351e['where']=_[_0xdd69('0x3f')](_0x45351e[_0xdd69('0x3c')],{'$or':_['map'](_0x45351e[_0xdd69('0x35')],function(_0x2f1e7b){var _0xacabc2={};_0xacabc2[_0x2f1e7b]={'$like':'%'+_0x3e102b[_0xdd69('0x32')][_0xdd69('0x4e')]+'%'};return _0xacabc2;})});}_0x45351e=_[_0xdd69('0x3f')]({},_0x45351e,_0x3e102b[_0xdd69('0x41')]);return _0x3f0717[_0xdd69('0x4f')](_0x45351e);}})['then'](function(_0x496ded){if(_0x496ded){_0x2ae41b=_0x496ded['length'];if(!_0x3e102b[_0xdd69('0x32')][_0xdd69('0x38')](_0xdd69('0x39'))){_0x45351e[_0xdd69('0x1e')]=qs[_0xdd69('0x1e')](_0x3e102b[_0xdd69('0x32')][_0xdd69('0x1e')]);_0x45351e['offset']=qs[_0xdd69('0x1c')](_0x3e102b['query']['offset']);}return _0x3f0717[_0xdd69('0x4f')](_0x45351e);}})[_0xdd69('0x26')](function(_0x52531a){if(_0x52531a){return _0x52531a?{'count':_0x2ae41b,'rows':_0x52531a}:null;}})[_0xdd69('0x26')](respondWithResult(_0x20cf58,null))[_0xdd69('0x48')](handleError(_0x20cf58,null));};exports[_0xdd69('0x50')]=function(_0x33ecec,_0x3dcce8,_0x2bd7a7){var _0x2fecd6={};var _0x24fabb={};var _0x4b8f85;var _0x5a2795;return db['FreshsalesConfiguration'][_0xdd69('0x4c')]({'where':{'id':_0x33ecec['params']['id']}})[_0xdd69('0x26')](handleEntityNotFound(_0x3dcce8,null))[_0xdd69('0x26')](function(_0x25f5e8){if(_0x25f5e8){_0x4b8f85=_0x25f5e8;_0x24fabb[_0xdd69('0x34')]=_[_0xdd69('0x46')](db[_0xdd69('0x4d')][_0xdd69('0x2e')]);_0x24fabb[_0xdd69('0x32')]=_[_0xdd69('0x46')](_0x33ecec[_0xdd69('0x32')]);_0x24fabb[_0xdd69('0x3d')]=_[_0xdd69('0x33')](_0x24fabb[_0xdd69('0x34')],_0x24fabb[_0xdd69('0x32')]);_0x2fecd6[_0xdd69('0x35')]=_['intersection'](_0x24fabb[_0xdd69('0x34')],qs[_0xdd69('0x36')](_0x33ecec[_0xdd69('0x32')][_0xdd69('0x36')]));_0x2fecd6['attributes']=_0x2fecd6[_0xdd69('0x35')][_0xdd69('0x37')]?_0x2fecd6[_0xdd69('0x35')]:_0x24fabb[_0xdd69('0x34')];_0x2fecd6[_0xdd69('0x3a')]=qs[_0xdd69('0x3b')](_0x33ecec[_0xdd69('0x32')][_0xdd69('0x3b')]);_0x2fecd6['where']=qs['filters'](_[_0xdd69('0x3e')](_0x33ecec[_0xdd69('0x32')],_0x24fabb[_0xdd69('0x3d')]));if(_0x33ecec['query'][_0xdd69('0x4e')]){_0x2fecd6[_0xdd69('0x3c')]=_[_0xdd69('0x3f')](_0x2fecd6[_0xdd69('0x3c')],{'$or':_[_0xdd69('0x2c')](_0x2fecd6[_0xdd69('0x35')],function(_0x4c0119){var _0x240832={};_0x240832[_0x4c0119]={'$like':'%'+_0x33ecec['query']['filter']+'%'};return _0x240832;})});}_0x2fecd6=_[_0xdd69('0x3f')]({},_0x2fecd6,_0x33ecec[_0xdd69('0x41')]);return _0x4b8f85[_0xdd69('0x50')](_0x2fecd6);}})[_0xdd69('0x26')](function(_0x34ff5a){if(_0x34ff5a){_0x5a2795=_0x34ff5a[_0xdd69('0x37')];if(!_0x33ecec['query'][_0xdd69('0x38')]('nolimit')){_0x2fecd6[_0xdd69('0x1e')]=qs[_0xdd69('0x1e')](_0x33ecec['query'][_0xdd69('0x1e')]);_0x2fecd6[_0xdd69('0x1c')]=qs[_0xdd69('0x1c')](_0x33ecec[_0xdd69('0x32')]['offset']);}return _0x4b8f85[_0xdd69('0x50')](_0x2fecd6);}})['then'](function(_0x96d4b){if(_0x96d4b){return _0x96d4b?{'count':_0x5a2795,'rows':_0x96d4b}:null;}})[_0xdd69('0x26')](respondWithResult(_0x3dcce8,null))[_0xdd69('0x48')](handleError(_0x3dcce8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9d6257a..1dbd827 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 _0x7bc4=['request-promise','path','rimraf','../../config/environment','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7bc4,0x150));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x47bc('0x0'));var util=require(_0x47bc('0x1'));var logger=require(_0x47bc('0x2'))(_0x47bc('0x3'));var moment=require('moment');var BPromise=require(_0x47bc('0x4'));var rp=require(_0x47bc('0x5'));var fs=require('fs');var path=require(_0x47bc('0x6'));var rimraf=require(_0x47bc('0x7'));var config=require(_0x47bc('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x3d1e45,_0x2cc3f0){return _0x3d1e45[_0x47bc('0x9')](_0x47bc('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdef4=['bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdef4,0x1d1));var _0x4def=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xdef4[_0x519756];return _0x37047e;};'use strict';var _=require('lodash');var util=require(_0x4def('0x0'));var logger=require(_0x4def('0x1'))('api');var moment=require(_0x4def('0x2'));var BPromise=require(_0x4def('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4def('0x4'));var rimraf=require(_0x4def('0x5'));var config=require(_0x4def('0x6'));var attributes=require(_0x4def('0x7'));module[_0x4def('0x8')]=function(_0x2e83a4,_0x4c5fe7){return _0x2e83a4[_0x4def('0x9')](_0x4def('0xa'),attributes,{'tableName':_0x4def('0xb'),'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 ac61faf..39a7886 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 _0x384d=['stringify','error','code','message','result','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5944af,_0x47a19b){var _0x1d01b0=function(_0x2c5c7e){while(--_0x2c5c7e){_0x5944af['push'](_0x5944af['shift']());}};_0x1d01b0(++_0x47a19b);}(_0x384d,0x98));var _0xd384=function(_0x1c8297,_0x4a93a1){_0x1c8297=_0x1c8297-0x0;var _0x450a26=_0x384d[_0x1c8297];return _0x450a26;};'use strict';var _=require('lodash');var util=require(_0xd384('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd384('0x1'));var db=require(_0xd384('0x2'))['db'];var utils=require(_0xd384('0x3'));var logger=require('../../config/logger')(_0xd384('0x4'));var config=require(_0xd384('0x5'));var jayson=require(_0xd384('0x6'));var client=jayson[_0xd384('0x7')][_0xd384('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41e05d,_0x2e1799,_0x41f9a7){return new BPromise(function(_0x29e045,_0x44b5eb){return client[_0xd384('0x9')](_0x41e05d,_0x41f9a7)[_0xd384('0xa')](function(_0x4399e5){logger[_0xd384('0xb')](_0xd384('0xc'),_0x2e1799,_0xd384('0xd'));logger[_0xd384('0xe')](_0xd384('0xf'),_0x2e1799,_0xd384('0xd'),JSON[_0xd384('0x10')](_0x4399e5));if(_0x4399e5['error']){if(_0x4399e5[_0xd384('0x11')][_0xd384('0x12')]===0x1f4){logger[_0xd384('0x11')](_0xd384('0xc'),_0x2e1799,_0x4399e5['error']['message']);return _0x44b5eb(_0x4399e5['error'][_0xd384('0x13')]);}logger[_0xd384('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2e1799,_0x4399e5['error'][_0xd384('0x13')]);return _0x29e045(_0x4399e5['error']['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2e1799,_0xd384('0xd'));_0x29e045(_0x4399e5[_0xd384('0x14')][_0xd384('0x13')]);}})['catch'](function(_0x37afd6){logger[_0xd384('0x11')](_0xd384('0xc'),_0x2e1799,_0x37afd6);_0x44b5eb(_0x37afd6);});});} \ No newline at end of file +var _0xbabd=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x395933,_0x24c5d5){var _0xbc97ae=function(_0x3db920){while(--_0x3db920){_0x395933['push'](_0x395933['shift']());}};_0xbc97ae(++_0x24c5d5);}(_0xbabd,0xbe));var _0xdbab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbabd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbab('0x0'));var util=require('util');var moment=require(_0xdbab('0x1'));var BPromise=require('bluebird');var rs=require(_0xdbab('0x2'));var fs=require('fs');var Redis=require(_0xdbab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbab('0x4'));var logger=require(_0xdbab('0x5'))(_0xdbab('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdbab('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21138f,_0x4f23cf,_0x5a2c34){return new BPromise(function(_0x4d402c,_0x426406){return client['request'](_0x21138f,_0x5a2c34)[_0xdbab('0x8')](function(_0x165ada){logger[_0xdbab('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f23cf,_0xdbab('0xa'));logger[_0xdbab('0xb')](_0xdbab('0xc'),_0x4f23cf,'request\x20sent',JSON[_0xdbab('0xd')](_0x165ada));if(_0x165ada['error']){if(_0x165ada[_0xdbab('0xe')][_0xdbab('0xf')]===0x1f4){logger[_0xdbab('0xe')](_0xdbab('0x10'),_0x4f23cf,_0x165ada[_0xdbab('0xe')][_0xdbab('0x11')]);return _0x426406(_0x165ada[_0xdbab('0xe')][_0xdbab('0x11')]);}logger[_0xdbab('0xe')](_0xdbab('0x10'),_0x4f23cf,_0x165ada[_0xdbab('0xe')][_0xdbab('0x11')]);return _0x4d402c(_0x165ada[_0xdbab('0xe')][_0xdbab('0x11')]);}else{logger['info'](_0xdbab('0x10'),_0x4f23cf,_0xdbab('0xa'));_0x4d402c(_0x165ada['result'][_0xdbab('0x11')]);}})[_0xdbab('0x12')](function(_0x4c7450){logger['error'](_0xdbab('0x10'),_0x4f23cf,_0x4c7450);_0x426406(_0x4c7450);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3484c4c..c973695 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 _0xdb76=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x313213,_0x4467df){var _0x244466=function(_0x25118b){while(--_0x25118b){_0x313213['push'](_0x313213['shift']());}};_0x244466(++_0x4467df);}(_0xdb76,0x1be));var _0x6db7=function(_0x13b028,_0x54dc4b){_0x13b028=_0x13b028-0x0;var _0x7ead62=_0xdb76[_0x13b028];return _0x7ead62;};'use strict';var multer=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var path=require(_0x6db7('0x2'));var timeout=require(_0x6db7('0x3'));var express=require(_0x6db7('0x4'));var router=express['Router']();var fs_extra=require(_0x6db7('0x5'));var auth=require(_0x6db7('0x6'));var interaction=require(_0x6db7('0x7'));var config=require(_0x6db7('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x6db7('0x9')]('/',auth[_0x6db7('0xa')](),controller[_0x6db7('0xb')]);router[_0x6db7('0x9')](_0x6db7('0xc'),auth['isAuthenticated'](),controller[_0x6db7('0xd')]);router[_0x6db7('0xe')]('/',auth['isAuthenticated'](),controller[_0x6db7('0xf')]);router[_0x6db7('0x10')](_0x6db7('0xc'),auth[_0x6db7('0xa')](),controller[_0x6db7('0x11')]);router[_0x6db7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6db7('0x13')]);module[_0x6db7('0x14')]=router; \ No newline at end of file +var _0x6c96=['index','/:id','post','isAuthenticated','create','put','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x2c1a27,_0x4cd2d9){var _0x58a7f7=function(_0x57742b){while(--_0x57742b){_0x2c1a27['push'](_0x2c1a27['shift']());}};_0x58a7f7(++_0x4cd2d9);}(_0x6c96,0x1c1));var _0x66c9=function(_0x13297d,_0x51150a){_0x13297d=_0x13297d-0x0;var _0x26b594=_0x6c96[_0x13297d];return _0x26b594;};'use strict';var multer=require(_0x66c9('0x0'));var util=require('util');var path=require(_0x66c9('0x1'));var timeout=require(_0x66c9('0x2'));var express=require('express');var router=express[_0x66c9('0x3')]();var fs_extra=require(_0x66c9('0x4'));var auth=require(_0x66c9('0x5'));var interaction=require(_0x66c9('0x6'));var config=require(_0x66c9('0x7'));var controller=require(_0x66c9('0x8'));router[_0x66c9('0x9')]('/',auth['isAuthenticated'](),controller[_0x66c9('0xa')]);router['get'](_0x66c9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x66c9('0xc')]('/',auth[_0x66c9('0xd')](),controller[_0x66c9('0xe')]);router[_0x66c9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x66c9('0xb'),auth[_0x66c9('0xd')](),controller[_0x66c9('0x10')]);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 0d56bce..a555db2 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 _0x2a47=['picklist','variable','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x1ebe53,_0x35cc29){var _0x56cb47=function(_0x1fc9fc){while(--_0x1fc9fc){_0x1ebe53['push'](_0x1ebe53['shift']());}};_0x56cb47(++_0x35cc29);}(_0x2a47,0xf4));var _0x72a4=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x2a47[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require(_0x72a4('0x0'));module[_0x72a4('0x1')]={'type':{'type':Sequelize[_0x72a4('0x2')](_0x72a4('0x3'),'variable',_0x72a4('0x4'),_0x72a4('0x5'),_0x72a4('0x6')),'defaultValue':_0x72a4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x72a4('0x2')]('string',_0x72a4('0x7'),_0x72a4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x72a4('0x8')]},'nameField':{'type':Sequelize[_0x72a4('0x8')]},'customField':{'type':Sequelize[_0x72a4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72a4('0x8')]}}; \ No newline at end of file +var _0x47cc=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x3cbbe7,_0x14df5e){var _0x11503d=function(_0x508098){while(--_0x508098){_0x3cbbe7['push'](_0x3cbbe7['shift']());}};_0x11503d(++_0x14df5e);}(_0x47cc,0x79));var _0xc47c=function(_0xe5c5f0,_0x47c0da){_0xe5c5f0=_0xe5c5f0-0x0;var _0x51222b=_0x47cc[_0xe5c5f0];return _0x51222b;};'use strict';var Sequelize=require(_0xc47c('0x0'));module[_0xc47c('0x1')]={'type':{'type':Sequelize[_0xc47c('0x2')](_0xc47c('0x3'),_0xc47c('0x4'),_0xc47c('0x5'),'keyValue',_0xc47c('0x6')),'defaultValue':_0xc47c('0x3')},'content':{'type':Sequelize[_0xc47c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc47c('0x2')](_0xc47c('0x3'),_0xc47c('0x4'),_0xc47c('0x5'))},'keyContent':{'type':Sequelize[_0xc47c('0x7')]},'idField':{'type':Sequelize[_0xc47c('0x7')]},'nameField':{'type':Sequelize[_0xc47c('0x7')]},'customField':{'type':Sequelize[_0xc47c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc47c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index dc477d2..f549a7d 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 _0x8315=['reject','save','then','destroy','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','include','findAll','rows','catch','show','params','fields','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count','offset','status','set','Content-Range'];(function(_0x50f430,_0x525873){var _0x49040e=function(_0x223c9d){while(--_0x223c9d){_0x50f430['push'](_0x50f430['shift']());}};_0x49040e(++_0x525873);}(_0x8315,0xf0));var _0x5831=function(_0x1e6cf9,_0x472dd9){_0x1e6cf9=_0x1e6cf9-0x0;var _0x32dc43=_0x8315[_0x1e6cf9];return _0x32dc43;};'use strict';var emlformat=require(_0x5831('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5831('0x1'));var jsonpatch=require(_0x5831('0x2'));var rp=require(_0x5831('0x3'));var moment=require('moment');var BPromise=require(_0x5831('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5831('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5831('0x6'));var fs=require('fs');var fs_extra=require(_0x5831('0x7'));var _=require(_0x5831('0x8'));var squel=require(_0x5831('0x9'));var crypto=require(_0x5831('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5831('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5831('0xc'));var Papa=require(_0x5831('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5831('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5831('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x5831('0x10'));var licenseUtil=require(_0x5831('0x11'));var db=require(_0x5831('0x12'))['db'];function respondWithStatusCode(_0x3a8e5f,_0x11d6cf){_0x11d6cf=_0x11d6cf||0xcc;return function(_0x144ebe){if(_0x144ebe){return _0x3a8e5f[_0x5831('0x13')](_0x11d6cf);}return _0x3a8e5f['status'](_0x11d6cf)[_0x5831('0x14')]();};}function respondWithResult(_0x20e82a,_0x5aca1c){_0x5aca1c=_0x5aca1c||0xc8;return function(_0x32c9f2){if(_0x32c9f2){return _0x20e82a['status'](_0x5aca1c)[_0x5831('0x15')](_0x32c9f2);}};}function respondWithFilteredResult(_0x4dd5e5,_0x26b2fd){return function(_0xc26b26){if(_0xc26b26){var _0x1754d3=typeof _0x26b2fd['offset']==='undefined'&&typeof _0x26b2fd[_0x5831('0x16')]==='undefined';var _0x118d05=_0xc26b26[_0x5831('0x17')];var _0x50007b=_0x1754d3?0x0:_0x26b2fd[_0x5831('0x18')];var _0x23b3e4=_0x1754d3?_0xc26b26[_0x5831('0x17')]:_0x26b2fd[_0x5831('0x18')]+_0x26b2fd[_0x5831('0x16')];var _0x46516c;if(_0x23b3e4>=_0x118d05){_0x23b3e4=_0x118d05;_0x46516c=0xc8;}else{_0x46516c=0xce;}_0x4dd5e5[_0x5831('0x19')](_0x46516c);return _0x4dd5e5[_0x5831('0x1a')](_0x5831('0x1b'),_0x50007b+'-'+_0x23b3e4+'/'+_0x118d05)[_0x5831('0x15')](_0xc26b26);}return null;};}function patchUpdates(_0x2bf1bb){return function(_0x3dbf4b){try{jsonpatch['apply'](_0x3dbf4b,_0x2bf1bb,!![]);}catch(_0x17783c){return BPromise[_0x5831('0x1c')](_0x17783c);}return _0x3dbf4b[_0x5831('0x1d')]();};}function saveUpdates(_0x53b6c5,_0x2a2950){return function(_0x1339bf){if(_0x1339bf){return _0x1339bf['update'](_0x53b6c5)[_0x5831('0x1e')](function(_0x126b27){return _0x126b27;});}return null;};}function removeEntity(_0x7e4517,_0x1b794b){return function(_0x24434a){if(_0x24434a){return _0x24434a[_0x5831('0x1f')]()[_0x5831('0x1e')](function(){_0x7e4517[_0x5831('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4386ca,_0x59e152){return function(_0x366d26){if(!_0x366d26){_0x4386ca[_0x5831('0x13')](0x194);}return _0x366d26;};}function handleError(_0x422ec9,_0x2f446f){_0x2f446f=_0x2f446f||0x1f4;return function(_0xc020b5){logger[_0x5831('0x20')](_0xc020b5[_0x5831('0x21')]);if(_0xc020b5['name']){delete _0xc020b5[_0x5831('0x22')];}_0x422ec9[_0x5831('0x19')](_0x2f446f)['send'](_0xc020b5);};}exports['index']=function(_0x2a15b6,_0x2c9f89){var _0x1e5885={},_0x463e0f={},_0x23cba6={'count':0x0,'rows':[]};var _0x24e55b=_[_0x5831('0x23')](db[_0x5831('0x24')][_0x5831('0x25')],function(_0xee56fb){return{'name':_0xee56fb[_0x5831('0x26')],'type':_0xee56fb['type'][_0x5831('0x27')]};});_0x463e0f[_0x5831('0x28')]=_[_0x5831('0x23')](_0x24e55b,_0x5831('0x22'));_0x463e0f[_0x5831('0x29')]=_[_0x5831('0x2a')](_0x2a15b6[_0x5831('0x29')]);_0x463e0f[_0x5831('0x2b')]=_[_0x5831('0x2c')](_0x463e0f[_0x5831('0x28')],_0x463e0f[_0x5831('0x29')]);_0x1e5885[_0x5831('0x2d')]=_[_0x5831('0x2c')](_0x463e0f['model'],qs['fields'](_0x2a15b6[_0x5831('0x29')]['fields']));_0x1e5885['attributes']=_0x1e5885[_0x5831('0x2d')][_0x5831('0x2e')]?_0x1e5885[_0x5831('0x2d')]:_0x463e0f['model'];if(!_0x2a15b6[_0x5831('0x29')]['hasOwnProperty'](_0x5831('0x2f'))){_0x1e5885[_0x5831('0x16')]=qs[_0x5831('0x16')](_0x2a15b6['query']['limit']);_0x1e5885['offset']=qs[_0x5831('0x18')](_0x2a15b6[_0x5831('0x29')]['offset']);}_0x1e5885[_0x5831('0x30')]=qs[_0x5831('0x31')](_0x2a15b6[_0x5831('0x29')][_0x5831('0x31')]);_0x1e5885['where']=qs['filters'](_[_0x5831('0x32')](_0x2a15b6[_0x5831('0x29')],_0x463e0f[_0x5831('0x2b')]),_0x24e55b);if(_0x2a15b6[_0x5831('0x29')][_0x5831('0x33')]){_0x1e5885['where']=_[_0x5831('0x34')](_0x1e5885['where'],{'$or':_[_0x5831('0x23')](_0x24e55b,function(_0x1b468e){if(_0x1b468e['type']!==_0x5831('0x35')){var _0x250030={};_0x250030[_0x1b468e[_0x5831('0x22')]]={'$like':'%'+_0x2a15b6[_0x5831('0x29')][_0x5831('0x33')]+'%'};return _0x250030;}})});}_0x1e5885=_['merge']({},_0x1e5885,_0x2a15b6['options']);var _0x379142={'where':_0x1e5885[_0x5831('0x36')]};return db[_0x5831('0x24')]['count'](_0x379142)[_0x5831('0x1e')](function(_0x2aac5a){_0x23cba6[_0x5831('0x17')]=_0x2aac5a;if(_0x2a15b6[_0x5831('0x29')]['includeAll']){_0x1e5885[_0x5831('0x37')]=[{'all':!![]}];}return db[_0x5831('0x24')][_0x5831('0x38')](_0x1e5885);})['then'](function(_0x2dac53){_0x23cba6[_0x5831('0x39')]=_0x2dac53;return _0x23cba6;})[_0x5831('0x1e')](respondWithFilteredResult(_0x2c9f89,_0x1e5885))[_0x5831('0x3a')](handleError(_0x2c9f89,null));};exports[_0x5831('0x3b')]=function(_0x4b40c4,_0x480e4f){var _0x1d50dd={'raw':!![],'where':{'id':_0x4b40c4[_0x5831('0x3c')]['id']}},_0xc3ccbd={};_0xc3ccbd[_0x5831('0x28')]=_[_0x5831('0x2a')](db[_0x5831('0x24')][_0x5831('0x25')]);_0xc3ccbd[_0x5831('0x29')]=_['keys'](_0x4b40c4['query']);_0xc3ccbd['filters']=_[_0x5831('0x2c')](_0xc3ccbd[_0x5831('0x28')],_0xc3ccbd['query']);_0x1d50dd[_0x5831('0x2d')]=_[_0x5831('0x2c')](_0xc3ccbd[_0x5831('0x28')],qs[_0x5831('0x3d')](_0x4b40c4['query']['fields']));_0x1d50dd['attributes']=_0x1d50dd[_0x5831('0x2d')][_0x5831('0x2e')]?_0x1d50dd[_0x5831('0x2d')]:_0xc3ccbd['model'];if(_0x4b40c4[_0x5831('0x29')][_0x5831('0x3e')]){_0x1d50dd[_0x5831('0x37')]=[{'all':!![]}];}_0x1d50dd=_[_0x5831('0x34')]({},_0x1d50dd,_0x4b40c4[_0x5831('0x3f')]);return db[_0x5831('0x24')][_0x5831('0x40')](_0x1d50dd)[_0x5831('0x1e')](handleEntityNotFound(_0x480e4f,null))['then'](respondWithResult(_0x480e4f,null))[_0x5831('0x3a')](handleError(_0x480e4f,null));};exports[_0x5831('0x41')]=function(_0x1cb3b1,_0x599410){return db[_0x5831('0x24')][_0x5831('0x41')](_0x1cb3b1['body'],{})[_0x5831('0x1e')](respondWithResult(_0x599410,0xc9))['catch'](handleError(_0x599410,null));};exports['update']=function(_0x418e64,_0x5761d3){if(_0x418e64[_0x5831('0x42')]['id']){delete _0x418e64['body']['id'];}return db['FreshsalesField'][_0x5831('0x40')]({'where':{'id':_0x418e64['params']['id']}})[_0x5831('0x1e')](handleEntityNotFound(_0x5761d3,null))[_0x5831('0x1e')](saveUpdates(_0x418e64[_0x5831('0x42')],null))[_0x5831('0x1e')](respondWithResult(_0x5761d3,null))[_0x5831('0x3a')](handleError(_0x5761d3,null));};exports[_0x5831('0x1f')]=function(_0x554d3e,_0x1cb37c){return db[_0x5831('0x24')][_0x5831('0x40')]({'where':{'id':_0x554d3e['params']['id']}})['then'](handleEntityNotFound(_0x1cb37c,null))[_0x5831('0x1e')](removeEntity(_0x1cb37c,null))[_0x5831('0x3a')](handleError(_0x1cb37c,null));}; \ No newline at end of file +var _0x4bcd=['end','error','stack','name','send','index','map','FreshsalesField','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','include','find','create','update','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x4bcd,0xfa));var _0xd4bc=function(_0x26e0ce,_0xf148c){_0x26e0ce=_0x26e0ce-0x0;var _0x3c5ad5=_0x4bcd[_0x26e0ce];return _0x3c5ad5;};'use strict';var emlformat=require(_0xd4bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4bc('0x1'));var jsonpatch=require(_0xd4bc('0x2'));var rp=require(_0xd4bc('0x3'));var moment=require('moment');var BPromise=require(_0xd4bc('0x4'));var Mustache=require('mustache');var util=require(_0xd4bc('0x5'));var path=require(_0xd4bc('0x6'));var sox=require(_0xd4bc('0x7'));var csv=require(_0xd4bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4bc('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd4bc('0xa'));var deskjs=require(_0xd4bc('0xb'));var toCsv=require(_0xd4bc('0x8'));var querystring=require(_0xd4bc('0xc'));var Papa=require('papaparse');var Redis=require(_0xd4bc('0xd'));var authService=require(_0xd4bc('0xe'));var qs=require(_0xd4bc('0xf'));var as=require(_0xd4bc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4bc('0x11'))(_0xd4bc('0x12'));var utils=require('../../config/utils');var config=require(_0xd4bc('0x13'));var licenseUtil=require(_0xd4bc('0x14'));var db=require(_0xd4bc('0x15'))['db'];function respondWithStatusCode(_0x136ba,_0x1a9f43){_0x1a9f43=_0x1a9f43||0xcc;return function(_0x222adc){if(_0x222adc){return _0x136ba[_0xd4bc('0x16')](_0x1a9f43);}return _0x136ba[_0xd4bc('0x17')](_0x1a9f43)['end']();};}function respondWithResult(_0x140f03,_0x4d94d5){_0x4d94d5=_0x4d94d5||0xc8;return function(_0x5eacf2){if(_0x5eacf2){return _0x140f03[_0xd4bc('0x17')](_0x4d94d5)[_0xd4bc('0x18')](_0x5eacf2);}};}function respondWithFilteredResult(_0x2ed777,_0x235bf2){return function(_0x26986d){if(_0x26986d){var _0x4711ad=typeof _0x235bf2[_0xd4bc('0x19')]===_0xd4bc('0x1a')&&typeof _0x235bf2[_0xd4bc('0x1b')]===_0xd4bc('0x1a');var _0x24d71d=_0x26986d[_0xd4bc('0x1c')];var _0x5c6558=_0x4711ad?0x0:_0x235bf2[_0xd4bc('0x19')];var _0x9ea2f2=_0x4711ad?_0x26986d[_0xd4bc('0x1c')]:_0x235bf2[_0xd4bc('0x19')]+_0x235bf2['limit'];var _0x544bca;if(_0x9ea2f2>=_0x24d71d){_0x9ea2f2=_0x24d71d;_0x544bca=0xc8;}else{_0x544bca=0xce;}_0x2ed777[_0xd4bc('0x17')](_0x544bca);return _0x2ed777['set'](_0xd4bc('0x1d'),_0x5c6558+'-'+_0x9ea2f2+'/'+_0x24d71d)['json'](_0x26986d);}return null;};}function patchUpdates(_0x2db3e1){return function(_0x378703){try{jsonpatch[_0xd4bc('0x1e')](_0x378703,_0x2db3e1,!![]);}catch(_0x5b06ef){return BPromise['reject'](_0x5b06ef);}return _0x378703[_0xd4bc('0x1f')]();};}function saveUpdates(_0x1d254a,_0x1ae2d4){return function(_0x5b2ab4){if(_0x5b2ab4){return _0x5b2ab4['update'](_0x1d254a)[_0xd4bc('0x20')](function(_0x908d57){return _0x908d57;});}return null;};}function removeEntity(_0xc6c4,_0x22eb24){return function(_0x2cf6b7){if(_0x2cf6b7){return _0x2cf6b7[_0xd4bc('0x21')]()[_0xd4bc('0x20')](function(){_0xc6c4['status'](0xcc)[_0xd4bc('0x22')]();});}};}function handleEntityNotFound(_0x45528a,_0x4e42e2){return function(_0x5eab60){if(!_0x5eab60){_0x45528a['sendStatus'](0x194);}return _0x5eab60;};}function handleError(_0x1bf024,_0x12c831){_0x12c831=_0x12c831||0x1f4;return function(_0x31cef1){logger[_0xd4bc('0x23')](_0x31cef1[_0xd4bc('0x24')]);if(_0x31cef1['name']){delete _0x31cef1[_0xd4bc('0x25')];}_0x1bf024['status'](_0x12c831)[_0xd4bc('0x26')](_0x31cef1);};}exports[_0xd4bc('0x27')]=function(_0x6c025b,_0x6c9ea3){var _0xec3c2={},_0x360b54={},_0x1ff5b4={'count':0x0,'rows':[]};var _0x23ca43=_[_0xd4bc('0x28')](db[_0xd4bc('0x29')]['rawAttributes'],function(_0x4590a1){return{'name':_0x4590a1['fieldName'],'type':_0x4590a1[_0xd4bc('0x2a')][_0xd4bc('0x2b')]};});_0x360b54['model']=_[_0xd4bc('0x28')](_0x23ca43,_0xd4bc('0x25'));_0x360b54[_0xd4bc('0x2c')]=_[_0xd4bc('0x2d')](_0x6c025b['query']);_0x360b54[_0xd4bc('0x2e')]=_[_0xd4bc('0x2f')](_0x360b54[_0xd4bc('0x30')],_0x360b54[_0xd4bc('0x2c')]);_0xec3c2[_0xd4bc('0x31')]=_['intersection'](_0x360b54[_0xd4bc('0x30')],qs[_0xd4bc('0x32')](_0x6c025b[_0xd4bc('0x2c')]['fields']));_0xec3c2[_0xd4bc('0x31')]=_0xec3c2[_0xd4bc('0x31')][_0xd4bc('0x33')]?_0xec3c2[_0xd4bc('0x31')]:_0x360b54[_0xd4bc('0x30')];if(!_0x6c025b[_0xd4bc('0x2c')][_0xd4bc('0x34')](_0xd4bc('0x35'))){_0xec3c2[_0xd4bc('0x1b')]=qs['limit'](_0x6c025b[_0xd4bc('0x2c')][_0xd4bc('0x1b')]);_0xec3c2[_0xd4bc('0x19')]=qs[_0xd4bc('0x19')](_0x6c025b['query'][_0xd4bc('0x19')]);}_0xec3c2['order']=qs[_0xd4bc('0x36')](_0x6c025b[_0xd4bc('0x2c')][_0xd4bc('0x36')]);_0xec3c2[_0xd4bc('0x37')]=qs[_0xd4bc('0x2e')](_[_0xd4bc('0x38')](_0x6c025b[_0xd4bc('0x2c')],_0x360b54['filters']),_0x23ca43);if(_0x6c025b[_0xd4bc('0x2c')][_0xd4bc('0x39')]){_0xec3c2[_0xd4bc('0x37')]=_[_0xd4bc('0x3a')](_0xec3c2[_0xd4bc('0x37')],{'$or':_[_0xd4bc('0x28')](_0x23ca43,function(_0x3d9800){if(_0x3d9800[_0xd4bc('0x2a')]!==_0xd4bc('0x3b')){var _0x678300={};_0x678300[_0x3d9800[_0xd4bc('0x25')]]={'$like':'%'+_0x6c025b[_0xd4bc('0x2c')][_0xd4bc('0x39')]+'%'};return _0x678300;}})});}_0xec3c2=_[_0xd4bc('0x3a')]({},_0xec3c2,_0x6c025b[_0xd4bc('0x3c')]);var _0x3387e3={'where':_0xec3c2[_0xd4bc('0x37')]};return db[_0xd4bc('0x29')][_0xd4bc('0x1c')](_0x3387e3)[_0xd4bc('0x20')](function(_0x2f1ebd){_0x1ff5b4[_0xd4bc('0x1c')]=_0x2f1ebd;if(_0x6c025b[_0xd4bc('0x2c')][_0xd4bc('0x3d')]){_0xec3c2['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xd4bc('0x3e')](_0xec3c2);})[_0xd4bc('0x20')](function(_0xdb5806){_0x1ff5b4[_0xd4bc('0x3f')]=_0xdb5806;return _0x1ff5b4;})['then'](respondWithFilteredResult(_0x6c9ea3,_0xec3c2))[_0xd4bc('0x40')](handleError(_0x6c9ea3,null));};exports['show']=function(_0x114a09,_0x322361){var _0x3f0ec0={'raw':!![],'where':{'id':_0x114a09['params']['id']}},_0x2dfb00={};_0x2dfb00[_0xd4bc('0x30')]=_['keys'](db[_0xd4bc('0x29')]['rawAttributes']);_0x2dfb00[_0xd4bc('0x2c')]=_[_0xd4bc('0x2d')](_0x114a09[_0xd4bc('0x2c')]);_0x2dfb00[_0xd4bc('0x2e')]=_[_0xd4bc('0x2f')](_0x2dfb00[_0xd4bc('0x30')],_0x2dfb00[_0xd4bc('0x2c')]);_0x3f0ec0[_0xd4bc('0x31')]=_[_0xd4bc('0x2f')](_0x2dfb00['model'],qs[_0xd4bc('0x32')](_0x114a09[_0xd4bc('0x2c')][_0xd4bc('0x32')]));_0x3f0ec0[_0xd4bc('0x31')]=_0x3f0ec0[_0xd4bc('0x31')][_0xd4bc('0x33')]?_0x3f0ec0[_0xd4bc('0x31')]:_0x2dfb00[_0xd4bc('0x30')];if(_0x114a09[_0xd4bc('0x2c')][_0xd4bc('0x3d')]){_0x3f0ec0[_0xd4bc('0x41')]=[{'all':!![]}];}_0x3f0ec0=_['merge']({},_0x3f0ec0,_0x114a09[_0xd4bc('0x3c')]);return db[_0xd4bc('0x29')][_0xd4bc('0x42')](_0x3f0ec0)['then'](handleEntityNotFound(_0x322361,null))[_0xd4bc('0x20')](respondWithResult(_0x322361,null))[_0xd4bc('0x40')](handleError(_0x322361,null));};exports[_0xd4bc('0x43')]=function(_0x28355d,_0x414b32){return db[_0xd4bc('0x29')][_0xd4bc('0x43')](_0x28355d['body'],{})['then'](respondWithResult(_0x414b32,0xc9))[_0xd4bc('0x40')](handleError(_0x414b32,null));};exports[_0xd4bc('0x44')]=function(_0x246e5b,_0x56a65d){if(_0x246e5b[_0xd4bc('0x45')]['id']){delete _0x246e5b[_0xd4bc('0x45')]['id'];}return db[_0xd4bc('0x29')][_0xd4bc('0x42')]({'where':{'id':_0x246e5b[_0xd4bc('0x46')]['id']}})['then'](handleEntityNotFound(_0x56a65d,null))[_0xd4bc('0x20')](saveUpdates(_0x246e5b['body'],null))[_0xd4bc('0x20')](respondWithResult(_0x56a65d,null))['catch'](handleError(_0x56a65d,null));};exports[_0xd4bc('0x21')]=function(_0x2db38d,_0xa646e8){return db[_0xd4bc('0x29')][_0xd4bc('0x42')]({'where':{'id':_0x2db38d[_0xd4bc('0x46')]['id']}})[_0xd4bc('0x20')](handleEntityNotFound(_0xa646e8,null))['then'](removeEntity(_0xa646e8,null))[_0xd4bc('0x40')](handleError(_0xa646e8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c656785..2163923 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 _0x3445=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesField.attributes','exports','freshsales_unique_index','lodash'];(function(_0x3b6993,_0x1c4b29){var _0x3ea51a=function(_0x3100ef){while(--_0x3100ef){_0x3b6993['push'](_0x3b6993['shift']());}};_0x3ea51a(++_0x1c4b29);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var logger=require(_0x5344('0x2'))(_0x5344('0x3'));var moment=require(_0x5344('0x4'));var BPromise=require(_0x5344('0x5'));var rp=require(_0x5344('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5344('0x7'));var attributes=require(_0x5344('0x8'));module[_0x5344('0x9')]=function(_0x1f654a,_0x5c1b4e){return _0x1f654a['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x5344('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc2=['../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x16d5df,_0x2e292b){var _0x160092=function(_0x18a32b){while(--_0x18a32b){_0x16d5df['push'](_0x16d5df['shift']());}};_0x160092(++_0x2e292b);}(_0x4fc2,0x111));var _0x24fc=function(_0x4584f1,_0x566d68){_0x4584f1=_0x4584f1-0x0;var _0x34fe53=_0x4fc2[_0x4584f1];return _0x34fe53;};'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'),_0x24fc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index eb63529..faf3d94 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 _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x5a8390,_0x4d4f65){var _0x584a6c=function(_0x695d12){while(--_0x695d12){_0x5a8390['push'](_0x5a8390['shift']());}};_0x584a6c(++_0x4d4f65);}(_0x9536,0x179));var _0x6953=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x9536[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30a3f1,_0x583784){var _0x5d4069=function(_0x174e9e){while(--_0x174e9e){_0x30a3f1['push'](_0x30a3f1['shift']());}};_0x5d4069(++_0x583784);}(_0x326f,0xd1));var _0xf326=function(_0x43db5c,_0x5cc48b){_0x43db5c=_0x43db5c-0x0;var _0x1f794d=_0x326f[_0x43db5c];return _0x1f794d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index be659ff..7986f89 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x494ea5,_0x234211){var _0x3e6800=function(_0x32ae92){while(--_0x32ae92){_0x494ea5['push'](_0x494ea5['shift']());}};_0x3e6800(++_0x234211);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3508e4,_0x156ab2){var _0xe84b39=function(_0x29a9af){while(--_0x29a9af){_0x3508e4['push'](_0x3508e4['shift']());}};_0xe84b39(++_0x156ab2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e1b91f2..db7e110 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 _0xccde=['integrationTab','sequelize','STRING','username','ENUM','newTab'];(function(_0x5e6971,_0x17ed4d){var _0x4dcb94=function(_0x3b8079){while(--_0x3b8079){_0x5e6971['push'](_0x5e6971['shift']());}};_0x4dcb94(++_0x17ed4d);}(_0xccde,0x1e1));var _0xeccd=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0xccde[_0x4df6f9];return _0x4b1a73;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'name':{'type':Sequelize[_0xeccd('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeccd('0x1')],'unique':_0xeccd('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xeccd('0x1')]},'clientSecret':{'type':Sequelize[_0xeccd('0x1')]},'securityToken':{'type':Sequelize[_0xeccd('0x1')]},'serverUrl':{'type':Sequelize[_0xeccd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeccd('0x3')]('integrationTab',_0xeccd('0x4')),'defaultValue':_0xeccd('0x5')}}; \ No newline at end of file +var _0xb2b0=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x2bbd84,_0x5528b8){var _0x173855=function(_0x5216b9){while(--_0x5216b9){_0x2bbd84['push'](_0x2bbd84['shift']());}};_0x173855(++_0x5528b8);}(_0xb2b0,0x72));var _0x0b2b=function(_0xf65428,_0x216aea){_0xf65428=_0xf65428-0x0;var _0x510b60=_0xb2b0[_0xf65428];return _0x510b60;};'use strict';var Sequelize=require(_0x0b2b('0x0'));module[_0x0b2b('0x1')]={'name':{'type':Sequelize[_0x0b2b('0x2')]},'description':{'type':Sequelize[_0x0b2b('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x0b2b('0x2')]},'password':{'type':Sequelize[_0x0b2b('0x2')]},'clientId':{'type':Sequelize[_0x0b2b('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x0b2b('0x2')]},'serverUrl':{'type':Sequelize[_0x0b2b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0b2b('0x3')](_0x0b2b('0x4'),_0x0b2b('0x5')),'defaultValue':_0x0b2b('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 64a1783..cde97c5 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 _0xbdfa=['concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','False','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','then','sendStatus','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','find','catch','create','body','getConfigurations','findOne','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','Subjects','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','substring','lastIndexOf','Connection','login','password'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0xbdfa,0x95));var _0xabdf=function(_0x30dd9c,_0x320110){_0x30dd9c=_0x30dd9c-0x0;var _0x38147d=_0xbdfa[_0x30dd9c];return _0x38147d;};'use strict';var emlformat=require(_0xabdf('0x0'));var rimraf=require(_0xabdf('0x1'));var zipdir=require(_0xabdf('0x2'));var jsonpatch=require(_0xabdf('0x3'));var rp=require(_0xabdf('0x4'));var moment=require(_0xabdf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xabdf('0x6'));var util=require(_0xabdf('0x7'));var path=require(_0xabdf('0x8'));var sox=require(_0xabdf('0x9'));var csv=require(_0xabdf('0xa'));var ejs=require(_0xabdf('0xb'));var fs=require('fs');var fs_extra=require(_0xabdf('0xc'));var _=require(_0xabdf('0xd'));var squel=require('squel');var crypto=require(_0xabdf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xabdf('0xf'));var toCsv=require(_0xabdf('0xa'));var querystring=require(_0xabdf('0x10'));var Papa=require('papaparse');var Redis=require(_0xabdf('0x11'));var authService=require(_0xabdf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabdf('0x13'));var logger=require(_0xabdf('0x14'))(_0xabdf('0x15'));var utils=require('../../config/utils');var config=require(_0xabdf('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5d2a77,_0x3dc6e0){_0x3dc6e0=_0x3dc6e0||0xcc;return function(_0x2b3ff7){if(_0x2b3ff7){return _0x5d2a77['sendStatus'](_0x3dc6e0);}return _0x5d2a77[_0xabdf('0x17')](_0x3dc6e0)[_0xabdf('0x18')]();};}function respondWithResult(_0x52a534,_0x108b98){_0x108b98=_0x108b98||0xc8;return function(_0x4d6924){if(_0x4d6924){return _0x52a534[_0xabdf('0x17')](_0x108b98)[_0xabdf('0x19')](_0x4d6924);}};}function respondWithFilteredResult(_0x1aa07e,_0x2b0e7a){return function(_0xf04844){if(_0xf04844){var _0x381ef5=typeof _0x2b0e7a[_0xabdf('0x1a')]==='undefined'&&typeof _0x2b0e7a[_0xabdf('0x1b')]===_0xabdf('0x1c');var _0x4e2eb7=_0xf04844[_0xabdf('0x1d')];var _0x4b81a9=_0x381ef5?0x0:_0x2b0e7a[_0xabdf('0x1a')];var _0x568175=_0x381ef5?_0xf04844[_0xabdf('0x1d')]:_0x2b0e7a[_0xabdf('0x1a')]+_0x2b0e7a[_0xabdf('0x1b')];var _0xfccdf;if(_0x568175>=_0x4e2eb7){_0x568175=_0x4e2eb7;_0xfccdf=0xc8;}else{_0xfccdf=0xce;}_0x1aa07e['status'](_0xfccdf);return _0x1aa07e['set'](_0xabdf('0x1e'),_0x4b81a9+'-'+_0x568175+'/'+_0x4e2eb7)[_0xabdf('0x19')](_0xf04844);}return null;};}function patchUpdates(_0x347949){return function(_0xbd3ab5){try{jsonpatch[_0xabdf('0x1f')](_0xbd3ab5,_0x347949,!![]);}catch(_0x19bfc3){return BPromise['reject'](_0x19bfc3);}return _0xbd3ab5['save']();};}function saveUpdates(_0x311487,_0x25ba76){return function(_0x20a4ea){if(_0x20a4ea){return _0x20a4ea[_0xabdf('0x20')](_0x311487)[_0xabdf('0x21')](function(_0xd67549){return _0xd67549;});}return null;};}function removeEntity(_0x4ed90d,_0x1a3ef6){return function(_0x5f424d){if(_0x5f424d){return _0x5f424d['destroy']()[_0xabdf('0x21')](function(){_0x4ed90d[_0xabdf('0x17')](0xcc)[_0xabdf('0x18')]();});}};}function handleEntityNotFound(_0x31ebbf,_0xed7f5f){return function(_0x4c83d1){if(!_0x4c83d1){_0x31ebbf[_0xabdf('0x22')](0x194);}return _0x4c83d1;};}function handleError(_0x23d6ad,_0x4fede7){_0x4fede7=_0x4fede7||0x1f4;return function(_0x4ca81e){logger[_0xabdf('0x23')](_0x4ca81e[_0xabdf('0x24')]);if(_0x4ca81e[_0xabdf('0x25')]){delete _0x4ca81e[_0xabdf('0x25')];}_0x23d6ad['status'](_0x4fede7)['send'](_0x4ca81e);};}exports[_0xabdf('0x26')]=function(_0x13080c,_0x4317c3){var _0x150705={},_0x1f04a8={},_0x21bc55={'count':0x0,'rows':[]};var _0x59d730=_[_0xabdf('0x27')](db[_0xabdf('0x28')][_0xabdf('0x29')],function(_0x1c47e9){return{'name':_0x1c47e9[_0xabdf('0x2a')],'type':_0x1c47e9['type']['key']};});_0x1f04a8[_0xabdf('0x2b')]=_[_0xabdf('0x27')](_0x59d730,'name');_0x1f04a8[_0xabdf('0x2c')]=_[_0xabdf('0x2d')](_0x13080c[_0xabdf('0x2c')]);_0x1f04a8['filters']=_[_0xabdf('0x2e')](_0x1f04a8[_0xabdf('0x2b')],_0x1f04a8['query']);_0x150705['attributes']=_[_0xabdf('0x2e')](_0x1f04a8['model'],qs[_0xabdf('0x2f')](_0x13080c[_0xabdf('0x2c')]['fields']));_0x150705[_0xabdf('0x30')]=_0x150705[_0xabdf('0x30')][_0xabdf('0x31')]?_0x150705['attributes']:_0x1f04a8[_0xabdf('0x2b')];if(!_0x13080c[_0xabdf('0x2c')][_0xabdf('0x32')]('nolimit')){_0x150705[_0xabdf('0x1b')]=qs['limit'](_0x13080c[_0xabdf('0x2c')][_0xabdf('0x1b')]);_0x150705[_0xabdf('0x1a')]=qs[_0xabdf('0x1a')](_0x13080c['query'][_0xabdf('0x1a')]);}_0x150705[_0xabdf('0x33')]=qs[_0xabdf('0x34')](_0x13080c[_0xabdf('0x2c')][_0xabdf('0x34')]);_0x150705[_0xabdf('0x35')]=qs[_0xabdf('0x36')](_[_0xabdf('0x37')](_0x13080c[_0xabdf('0x2c')],_0x1f04a8[_0xabdf('0x36')]),_0x59d730);if(_0x13080c[_0xabdf('0x2c')][_0xabdf('0x38')]){_0x150705['where']=_[_0xabdf('0x39')](_0x150705[_0xabdf('0x35')],{'$or':_[_0xabdf('0x27')](_0x59d730,function(_0x40e1cb){if(_0x40e1cb[_0xabdf('0x3a')]!==_0xabdf('0x3b')){var _0x3c383f={};_0x3c383f[_0x40e1cb[_0xabdf('0x25')]]={'$like':'%'+_0x13080c[_0xabdf('0x2c')][_0xabdf('0x38')]+'%'};return _0x3c383f;}})});}_0x150705=_[_0xabdf('0x39')]({},_0x150705,_0x13080c[_0xabdf('0x3c')]);var _0x46a87f={'where':_0x150705[_0xabdf('0x35')]};return db[_0xabdf('0x28')][_0xabdf('0x1d')](_0x46a87f)[_0xabdf('0x21')](function(_0x22dbef){_0x21bc55['count']=_0x22dbef;if(_0x13080c[_0xabdf('0x2c')][_0xabdf('0x3d')]){_0x150705[_0xabdf('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x150705);})[_0xabdf('0x21')](function(_0x1f3718){_0x21bc55['rows']=_0x1f3718;return _0x21bc55;})['then'](respondWithFilteredResult(_0x4317c3,_0x150705))['catch'](handleError(_0x4317c3,null));};exports[_0xabdf('0x3f')]=function(_0x21b3de,_0x3d7193){var _0x3a9a0f={'raw':![],'where':{'id':_0x21b3de[_0xabdf('0x40')]['id']}},_0x30e746={};_0x30e746[_0xabdf('0x2b')]=_[_0xabdf('0x2d')](db['SalesforceAccount']['rawAttributes']);_0x30e746[_0xabdf('0x2c')]=_[_0xabdf('0x2d')](_0x21b3de[_0xabdf('0x2c')]);_0x30e746[_0xabdf('0x36')]=_[_0xabdf('0x2e')](_0x30e746[_0xabdf('0x2b')],_0x30e746[_0xabdf('0x2c')]);_0x3a9a0f[_0xabdf('0x30')]=_[_0xabdf('0x2e')](_0x30e746[_0xabdf('0x2b')],qs[_0xabdf('0x2f')](_0x21b3de['query'][_0xabdf('0x2f')]));_0x3a9a0f[_0xabdf('0x30')]=_0x3a9a0f[_0xabdf('0x30')][_0xabdf('0x31')]?_0x3a9a0f[_0xabdf('0x30')]:_0x30e746[_0xabdf('0x2b')];if(_0x21b3de[_0xabdf('0x2c')]['includeAll']){_0x3a9a0f[_0xabdf('0x3e')]=[{'all':!![]}];}_0x3a9a0f=_[_0xabdf('0x39')]({},_0x3a9a0f,_0x21b3de[_0xabdf('0x3c')]);return db['SalesforceAccount'][_0xabdf('0x41')](_0x3a9a0f)[_0xabdf('0x21')](handleEntityNotFound(_0x3d7193,null))['then'](respondWithResult(_0x3d7193,null))[_0xabdf('0x42')](handleError(_0x3d7193,null));};exports[_0xabdf('0x43')]=function(_0x4df621,_0x151ec5){return db[_0xabdf('0x28')][_0xabdf('0x43')](_0x4df621['body'],{})[_0xabdf('0x21')](respondWithResult(_0x151ec5,0xc9))[_0xabdf('0x42')](handleError(_0x151ec5,null));};exports[_0xabdf('0x20')]=function(_0x51480a,_0x106a8a){if(_0x51480a[_0xabdf('0x44')]['id']){delete _0x51480a[_0xabdf('0x44')]['id'];}return db[_0xabdf('0x28')]['find']({'where':{'id':_0x51480a[_0xabdf('0x40')]['id']}})['then'](handleEntityNotFound(_0x106a8a,null))['then'](saveUpdates(_0x51480a['body'],null))[_0xabdf('0x21')](respondWithResult(_0x106a8a,null))[_0xabdf('0x42')](handleError(_0x106a8a,null));};exports['destroy']=function(_0x4aa367,_0x7d4d1c){return db['SalesforceAccount'][_0xabdf('0x41')]({'where':{'id':_0x4aa367[_0xabdf('0x40')]['id']}})['then'](handleEntityNotFound(_0x7d4d1c,null))['then'](removeEntity(_0x7d4d1c,null))[_0xabdf('0x42')](handleError(_0x7d4d1c,null));};exports[_0xabdf('0x45')]=function(_0x5f4b68,_0x12a408,_0x5193ff){var _0x5db05f={};var _0x44e752={};var _0x59d710;var _0x3adbc3;return db[_0xabdf('0x28')][_0xabdf('0x46')]({'where':{'id':_0x5f4b68[_0xabdf('0x40')]['id']}})[_0xabdf('0x21')](handleEntityNotFound(_0x12a408,null))[_0xabdf('0x21')](function(_0x2d0ebd){if(_0x2d0ebd){_0x59d710=_0x2d0ebd;_0x44e752[_0xabdf('0x2b')]=_[_0xabdf('0x2d')](db['SalesforceConfiguration'][_0xabdf('0x29')]);_0x44e752[_0xabdf('0x2c')]=_[_0xabdf('0x2d')](_0x5f4b68['query']);_0x44e752[_0xabdf('0x36')]=_[_0xabdf('0x2e')](_0x44e752[_0xabdf('0x2b')],_0x44e752[_0xabdf('0x2c')]);_0x5db05f[_0xabdf('0x30')]=_['intersection'](_0x44e752[_0xabdf('0x2b')],qs[_0xabdf('0x2f')](_0x5f4b68['query'][_0xabdf('0x2f')]));_0x5db05f[_0xabdf('0x30')]=_0x5db05f[_0xabdf('0x30')]['length']?_0x5db05f[_0xabdf('0x30')]:_0x44e752['model'];_0x5db05f[_0xabdf('0x33')]=qs[_0xabdf('0x34')](_0x5f4b68['query'][_0xabdf('0x34')]);_0x5db05f[_0xabdf('0x35')]=qs[_0xabdf('0x36')](_['pick'](_0x5f4b68[_0xabdf('0x2c')],_0x44e752['filters']));if(_0x5f4b68['query'][_0xabdf('0x38')]){_0x5db05f[_0xabdf('0x35')]=_[_0xabdf('0x39')](_0x5db05f[_0xabdf('0x35')],{'$or':_[_0xabdf('0x27')](_0x5db05f[_0xabdf('0x30')],function(_0x45dd2b){var _0x19d7ae={};_0x19d7ae[_0x45dd2b]={'$like':'%'+_0x5f4b68[_0xabdf('0x2c')][_0xabdf('0x38')]+'%'};return _0x19d7ae;})});}_0x5db05f=_[_0xabdf('0x39')]({},_0x5db05f,_0x5f4b68[_0xabdf('0x3c')]);return _0x59d710['getConfigurations'](_0x5db05f);}})[_0xabdf('0x21')](function(_0x5f3c6d){if(_0x5f3c6d){_0x3adbc3=_0x5f3c6d[_0xabdf('0x31')];if(!_0x5f4b68['query']['hasOwnProperty'](_0xabdf('0x47'))){_0x5db05f[_0xabdf('0x1b')]=qs[_0xabdf('0x1b')](_0x5f4b68[_0xabdf('0x2c')]['limit']);_0x5db05f[_0xabdf('0x1a')]=qs[_0xabdf('0x1a')](_0x5f4b68['query'][_0xabdf('0x1a')]);}return _0x59d710['getConfigurations'](_0x5db05f);}})[_0xabdf('0x21')](function(_0x305a45){if(_0x305a45){return _0x305a45?{'count':_0x3adbc3,'rows':_0x305a45}:null;}})[_0xabdf('0x21')](respondWithResult(_0x12a408,null))[_0xabdf('0x42')](handleError(_0x12a408,null));};exports['addConfiguration']=function(_0x4aa6a7,_0x42c282,_0x259de3){if(_0x4aa6a7[_0xabdf('0x44')]['id']){delete _0x4aa6a7[_0xabdf('0x44')]['id'];}return db[_0xabdf('0x28')][_0xabdf('0x46')]({'where':{'id':_0x4aa6a7['params']['id']}})[_0xabdf('0x21')](handleEntityNotFound(_0x42c282,null))['then'](function(_0x2e1239){if(_0x2e1239){_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x48')]=_0x2e1239['id'];_0x4aa6a7['body']['Subjects']=integrations[_0xabdf('0x49')](_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x4a')],_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x3a')]);_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x4b')]=integrations[_0xabdf('0x4c')](_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x4a')],_0x4aa6a7[_0xabdf('0x44')]['type']);return db[_0xabdf('0x4d')][_0xabdf('0x43')](_0x4aa6a7['body'],{'include':[{'model':db['SalesforceField'],'as':_0xabdf('0x4e')},{'model':db[_0xabdf('0x4f')],'as':_0xabdf('0x4b')}]});}return null;})['then'](respondWithResult(_0x42c282,null))[_0xabdf('0x42')](handleError(_0x42c282,null));};exports[_0xabdf('0x50')]=function(_0x42933b,_0xbae4f5,_0x411b8c){var _0x150bad;var _0x4503b4='';var _0x46374a='Task';return db[_0xabdf('0x28')][_0xabdf('0x46')]({'where':{'id':_0x42933b[_0xabdf('0x40')]['id']},'attributes':['id',_0xabdf('0x51'),_0xabdf('0x52'),_0xabdf('0x53'),_0xabdf('0x54'),'password',_0xabdf('0x55')]})[_0xabdf('0x21')](handleEntityNotFound(_0xbae4f5,null))[_0xabdf('0x21')](function(_0xbf6da9){if(_0xbf6da9){_0x4503b4=_0xbf6da9[_0xabdf('0x51')];var _0x2d550f=_0x4503b4['slice'](-0x1);if(_0x2d550f==='/'){_0x4503b4=_0x4503b4[_0xabdf('0x56')](0x0,_0x4503b4[_0xabdf('0x57')](_0x2d550f));}_0x150bad=new jsforce[(_0xabdf('0x58'))]({'oauth2':{'loginUrl':_0x4503b4,'clientId':_0xbf6da9['clientId'],'clientSecret':_0xbf6da9['clientSecret']}});return _0x150bad[_0xabdf('0x59')](_0xbf6da9[_0xabdf('0x54')],_0xbf6da9[_0xabdf('0x5a')][_0xabdf('0x5b')](_0xbf6da9[_0xabdf('0x55')]));}})['then'](function(_0x25477e){if(_0x25477e){if(!_[_0xabdf('0x5c')](_0x42933b['query'][_0xabdf('0x5d')])){_0x46374a=_0x42933b[_0xabdf('0x2c')][_0xabdf('0x5d')];}return _0x150bad[_0xabdf('0x5e')](_0x46374a)[_0xabdf('0x5f')]();}})[_0xabdf('0x21')](function(_0x59aab9){var _0x4af849=['OwnerId',_0xabdf('0x60'),_0xabdf('0x61'),_0xabdf('0x62'),_0xabdf('0x63'),_0xabdf('0x64')];var _0x25187e=[_0xabdf('0x65'),_0xabdf('0x66'),_0xabdf('0x67'),_0xabdf('0x68'),_0xabdf('0x69'),_0xabdf('0x6a'),_0xabdf('0x6b')];if(_0x59aab9){_[_0xabdf('0x6c')](_0x59aab9[_0xabdf('0x2f')],function(_0x15c866){return _0x4af849[_0xabdf('0x6d')](_0x15c866['name'])||!_0x25187e[_0xabdf('0x6d')](_0x15c866[_0xabdf('0x3a')]);});return{'count':_0x59aab9['fields'][_0xabdf('0x31')],'rows':_['map'](_0x59aab9[_0xabdf('0x2f')],function(_0x297370){return{'id':_0x297370[_0xabdf('0x25')],'name':_0x297370[_0xabdf('0x6e')],'custom':_0x297370[_0xabdf('0x6f')],'options':_0x297370['picklistValues'][_0xabdf('0x31')]>0x0?_[_0xabdf('0x27')](_0x297370[_0xabdf('0x70')],function(_0x3d2601){return{'name':_0x3d2601[_0xabdf('0x6e')],'value':_0x3d2601['value']};}):_0x297370[_0xabdf('0x3a')]==_0xabdf('0x68')?[{'name':_0xabdf('0x71'),'value':'true'},{'name':_0xabdf('0x72'),'value':'false'}]:[]};})};}})[_0xabdf('0x21')](respondWithResult(_0xbae4f5,null))[_0xabdf('0x42')](function(_0x65270){var _0x6da4e8=_0x42933b['query']['test']?0x1f4:_0x65270['statusCode']||0x1f4;logger[_0xabdf('0x23')](_0xabdf('0x73'),_0xabdf('0x50'),_0x6da4e8,JSON['stringify'](_0x65270));delete _0x65270[_0xabdf('0x25')];if(_0x6da4e8===0x191){_0x6da4e8=0x190;}_0xbae4f5[_0xabdf('0x17')](_0x6da4e8)[_0xabdf('0x74')](_0x42933b[_0xabdf('0x2c')][_0xabdf('0x75')]?{'message':_0xabdf('0x76'),'statusCode':_0x65270[_0xabdf('0x77')]}:_0x65270);});}; \ No newline at end of file +var _0x6fc8=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','SalesforceAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','type','SalesforceField','Task','remoteUri','username','Connection','clientId','clientSecret','login','password','concat','securityToken','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','textarea','phone','remove','includes','custom','picklistValues','label','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x3e8dbd,_0x1126fd){var _0xff862f=function(_0x3db9cc){while(--_0x3db9cc){_0x3e8dbd['push'](_0x3e8dbd['shift']());}};_0xff862f(++_0x1126fd);}(_0x6fc8,0x156));var _0x86fc=function(_0x56b68d,_0x38e0be){_0x56b68d=_0x56b68d-0x0;var _0x4b45aa=_0x6fc8[_0x56b68d];return _0x4b45aa;};'use strict';var emlformat=require(_0x86fc('0x0'));var rimraf=require(_0x86fc('0x1'));var zipdir=require(_0x86fc('0x2'));var jsonpatch=require(_0x86fc('0x3'));var rp=require(_0x86fc('0x4'));var moment=require(_0x86fc('0x5'));var BPromise=require(_0x86fc('0x6'));var Mustache=require(_0x86fc('0x7'));var util=require('util');var path=require(_0x86fc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x86fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x86fc('0xa'));var crypto=require('crypto');var jsforce=require(_0x86fc('0xb'));var deskjs=require(_0x86fc('0xc'));var toCsv=require(_0x86fc('0xd'));var querystring=require(_0x86fc('0xe'));var Papa=require('papaparse');var Redis=require(_0x86fc('0xf'));var authService=require(_0x86fc('0x10'));var qs=require(_0x86fc('0x11'));var as=require(_0x86fc('0x12'));var hardwareService=require(_0x86fc('0x13'));var logger=require('../../config/logger')(_0x86fc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x86fc('0x15'))['db'];var integrations=require(_0x86fc('0x16'));function respondWithStatusCode(_0x53603f,_0xd2a299){_0xd2a299=_0xd2a299||0xcc;return function(_0xb3dbd0){if(_0xb3dbd0){return _0x53603f[_0x86fc('0x17')](_0xd2a299);}return _0x53603f[_0x86fc('0x18')](_0xd2a299)['end']();};}function respondWithResult(_0x31574a,_0x5e0a6b){_0x5e0a6b=_0x5e0a6b||0xc8;return function(_0x449f1b){if(_0x449f1b){return _0x31574a[_0x86fc('0x18')](_0x5e0a6b)[_0x86fc('0x19')](_0x449f1b);}};}function respondWithFilteredResult(_0x46c90f,_0x56239a){return function(_0x281e0f){if(_0x281e0f){var _0x4dd1a0=typeof _0x56239a[_0x86fc('0x1a')]===_0x86fc('0x1b')&&typeof _0x56239a['limit']===_0x86fc('0x1b');var _0x123cc2=_0x281e0f[_0x86fc('0x1c')];var _0x58e3c3=_0x4dd1a0?0x0:_0x56239a['offset'];var _0x4d1d4a=_0x4dd1a0?_0x281e0f['count']:_0x56239a[_0x86fc('0x1a')]+_0x56239a[_0x86fc('0x1d')];var _0x4b5b67;if(_0x4d1d4a>=_0x123cc2){_0x4d1d4a=_0x123cc2;_0x4b5b67=0xc8;}else{_0x4b5b67=0xce;}_0x46c90f['status'](_0x4b5b67);return _0x46c90f[_0x86fc('0x1e')](_0x86fc('0x1f'),_0x58e3c3+'-'+_0x4d1d4a+'/'+_0x123cc2)['json'](_0x281e0f);}return null;};}function patchUpdates(_0x93109c){return function(_0x75bcaf){try{jsonpatch[_0x86fc('0x20')](_0x75bcaf,_0x93109c,!![]);}catch(_0x51108e){return BPromise[_0x86fc('0x21')](_0x51108e);}return _0x75bcaf[_0x86fc('0x22')]();};}function saveUpdates(_0xf450b1,_0x48c9c7){return function(_0x156ff0){if(_0x156ff0){return _0x156ff0[_0x86fc('0x23')](_0xf450b1)[_0x86fc('0x24')](function(_0x4cc49d){return _0x4cc49d;});}return null;};}function removeEntity(_0x55d2af,_0x16d496){return function(_0x1858a4){if(_0x1858a4){return _0x1858a4[_0x86fc('0x25')]()[_0x86fc('0x24')](function(){_0x55d2af[_0x86fc('0x18')](0xcc)[_0x86fc('0x26')]();});}};}function handleEntityNotFound(_0x230594,_0x261bc5){return function(_0x447a91){if(!_0x447a91){_0x230594[_0x86fc('0x17')](0x194);}return _0x447a91;};}function handleError(_0x51cc75,_0x72aa54){_0x72aa54=_0x72aa54||0x1f4;return function(_0x5fb433){logger[_0x86fc('0x27')](_0x5fb433['stack']);if(_0x5fb433[_0x86fc('0x28')]){delete _0x5fb433[_0x86fc('0x28')];}_0x51cc75[_0x86fc('0x18')](_0x72aa54)['send'](_0x5fb433);};}exports[_0x86fc('0x29')]=function(_0x4fc901,_0x110a37){var _0x5f312a={},_0x71d458={},_0x10d978={'count':0x0,'rows':[]};var _0x63432c=_[_0x86fc('0x2a')](db[_0x86fc('0x2b')]['rawAttributes'],function(_0x131aea){return{'name':_0x131aea[_0x86fc('0x2c')],'type':_0x131aea['type'][_0x86fc('0x2d')]};});_0x71d458[_0x86fc('0x2e')]=_[_0x86fc('0x2a')](_0x63432c,_0x86fc('0x28'));_0x71d458[_0x86fc('0x2f')]=_[_0x86fc('0x30')](_0x4fc901[_0x86fc('0x2f')]);_0x71d458[_0x86fc('0x31')]=_[_0x86fc('0x32')](_0x71d458[_0x86fc('0x2e')],_0x71d458[_0x86fc('0x2f')]);_0x5f312a[_0x86fc('0x33')]=_[_0x86fc('0x32')](_0x71d458[_0x86fc('0x2e')],qs[_0x86fc('0x34')](_0x4fc901[_0x86fc('0x2f')][_0x86fc('0x34')]));_0x5f312a[_0x86fc('0x33')]=_0x5f312a[_0x86fc('0x33')][_0x86fc('0x35')]?_0x5f312a[_0x86fc('0x33')]:_0x71d458[_0x86fc('0x2e')];if(!_0x4fc901[_0x86fc('0x2f')]['hasOwnProperty']('nolimit')){_0x5f312a[_0x86fc('0x1d')]=qs[_0x86fc('0x1d')](_0x4fc901[_0x86fc('0x2f')][_0x86fc('0x1d')]);_0x5f312a['offset']=qs[_0x86fc('0x1a')](_0x4fc901[_0x86fc('0x2f')][_0x86fc('0x1a')]);}_0x5f312a[_0x86fc('0x36')]=qs['sort'](_0x4fc901[_0x86fc('0x2f')][_0x86fc('0x37')]);_0x5f312a[_0x86fc('0x38')]=qs[_0x86fc('0x31')](_[_0x86fc('0x39')](_0x4fc901[_0x86fc('0x2f')],_0x71d458[_0x86fc('0x31')]),_0x63432c);if(_0x4fc901['query']['filter']){_0x5f312a[_0x86fc('0x38')]=_['merge'](_0x5f312a[_0x86fc('0x38')],{'$or':_[_0x86fc('0x2a')](_0x63432c,function(_0x3dc098){if(_0x3dc098['type']!==_0x86fc('0x3a')){var _0x2eb861={};_0x2eb861[_0x3dc098[_0x86fc('0x28')]]={'$like':'%'+_0x4fc901[_0x86fc('0x2f')][_0x86fc('0x3b')]+'%'};return _0x2eb861;}})});}_0x5f312a=_[_0x86fc('0x3c')]({},_0x5f312a,_0x4fc901[_0x86fc('0x3d')]);var _0x31b08f={'where':_0x5f312a[_0x86fc('0x38')]};return db[_0x86fc('0x2b')][_0x86fc('0x1c')](_0x31b08f)[_0x86fc('0x24')](function(_0x35bca1){_0x10d978[_0x86fc('0x1c')]=_0x35bca1;if(_0x4fc901[_0x86fc('0x2f')][_0x86fc('0x3e')]){_0x5f312a[_0x86fc('0x3f')]=[{'all':!![]}];}return db[_0x86fc('0x2b')][_0x86fc('0x40')](_0x5f312a);})[_0x86fc('0x24')](function(_0x15174f){_0x10d978['rows']=_0x15174f;return _0x10d978;})['then'](respondWithFilteredResult(_0x110a37,_0x5f312a))['catch'](handleError(_0x110a37,null));};exports['show']=function(_0x534631,_0x5377c1){var _0xaaa116={'raw':![],'where':{'id':_0x534631[_0x86fc('0x41')]['id']}},_0x209ab9={};_0x209ab9['model']=_[_0x86fc('0x30')](db[_0x86fc('0x2b')][_0x86fc('0x42')]);_0x209ab9[_0x86fc('0x2f')]=_['keys'](_0x534631['query']);_0x209ab9['filters']=_[_0x86fc('0x32')](_0x209ab9[_0x86fc('0x2e')],_0x209ab9[_0x86fc('0x2f')]);_0xaaa116[_0x86fc('0x33')]=_[_0x86fc('0x32')](_0x209ab9[_0x86fc('0x2e')],qs[_0x86fc('0x34')](_0x534631[_0x86fc('0x2f')][_0x86fc('0x34')]));_0xaaa116[_0x86fc('0x33')]=_0xaaa116[_0x86fc('0x33')][_0x86fc('0x35')]?_0xaaa116['attributes']:_0x209ab9[_0x86fc('0x2e')];if(_0x534631[_0x86fc('0x2f')][_0x86fc('0x3e')]){_0xaaa116[_0x86fc('0x3f')]=[{'all':!![]}];}_0xaaa116=_[_0x86fc('0x3c')]({},_0xaaa116,_0x534631['options']);return db[_0x86fc('0x2b')][_0x86fc('0x43')](_0xaaa116)[_0x86fc('0x24')](handleEntityNotFound(_0x5377c1,null))['then'](respondWithResult(_0x5377c1,null))[_0x86fc('0x44')](handleError(_0x5377c1,null));};exports[_0x86fc('0x45')]=function(_0x4a68b2,_0x4a5fae){return db['SalesforceAccount'][_0x86fc('0x45')](_0x4a68b2[_0x86fc('0x46')],{})[_0x86fc('0x24')](respondWithResult(_0x4a5fae,0xc9))[_0x86fc('0x44')](handleError(_0x4a5fae,null));};exports[_0x86fc('0x23')]=function(_0x5d780d,_0x419682){if(_0x5d780d[_0x86fc('0x46')]['id']){delete _0x5d780d[_0x86fc('0x46')]['id'];}return db[_0x86fc('0x2b')][_0x86fc('0x43')]({'where':{'id':_0x5d780d['params']['id']}})[_0x86fc('0x24')](handleEntityNotFound(_0x419682,null))[_0x86fc('0x24')](saveUpdates(_0x5d780d['body'],null))[_0x86fc('0x24')](respondWithResult(_0x419682,null))[_0x86fc('0x44')](handleError(_0x419682,null));};exports['destroy']=function(_0x14c9bd,_0x4daf12){return db[_0x86fc('0x2b')][_0x86fc('0x43')]({'where':{'id':_0x14c9bd['params']['id']}})[_0x86fc('0x24')](handleEntityNotFound(_0x4daf12,null))[_0x86fc('0x24')](removeEntity(_0x4daf12,null))['catch'](handleError(_0x4daf12,null));};exports[_0x86fc('0x47')]=function(_0x26a762,_0x12dc23,_0x1bc6f4){var _0x63216={};var _0x522eeb={};var _0xd2a7c0;var _0x1087c1;return db[_0x86fc('0x2b')][_0x86fc('0x48')]({'where':{'id':_0x26a762['params']['id']}})[_0x86fc('0x24')](handleEntityNotFound(_0x12dc23,null))[_0x86fc('0x24')](function(_0x4c036b){if(_0x4c036b){_0xd2a7c0=_0x4c036b;_0x522eeb[_0x86fc('0x2e')]=_[_0x86fc('0x30')](db[_0x86fc('0x49')][_0x86fc('0x42')]);_0x522eeb[_0x86fc('0x2f')]=_[_0x86fc('0x30')](_0x26a762[_0x86fc('0x2f')]);_0x522eeb['filters']=_[_0x86fc('0x32')](_0x522eeb['model'],_0x522eeb[_0x86fc('0x2f')]);_0x63216[_0x86fc('0x33')]=_['intersection'](_0x522eeb[_0x86fc('0x2e')],qs[_0x86fc('0x34')](_0x26a762['query'][_0x86fc('0x34')]));_0x63216['attributes']=_0x63216[_0x86fc('0x33')][_0x86fc('0x35')]?_0x63216[_0x86fc('0x33')]:_0x522eeb[_0x86fc('0x2e')];_0x63216['order']=qs[_0x86fc('0x37')](_0x26a762[_0x86fc('0x2f')]['sort']);_0x63216[_0x86fc('0x38')]=qs[_0x86fc('0x31')](_[_0x86fc('0x39')](_0x26a762['query'],_0x522eeb[_0x86fc('0x31')]));if(_0x26a762[_0x86fc('0x2f')][_0x86fc('0x3b')]){_0x63216['where']=_[_0x86fc('0x3c')](_0x63216[_0x86fc('0x38')],{'$or':_[_0x86fc('0x2a')](_0x63216[_0x86fc('0x33')],function(_0x56fbc8){var _0x21d60c={};_0x21d60c[_0x56fbc8]={'$like':'%'+_0x26a762['query'][_0x86fc('0x3b')]+'%'};return _0x21d60c;})});}_0x63216=_[_0x86fc('0x3c')]({},_0x63216,_0x26a762['options']);return _0xd2a7c0['getConfigurations'](_0x63216);}})['then'](function(_0xa58130){if(_0xa58130){_0x1087c1=_0xa58130[_0x86fc('0x35')];if(!_0x26a762[_0x86fc('0x2f')][_0x86fc('0x4a')]('nolimit')){_0x63216['limit']=qs['limit'](_0x26a762[_0x86fc('0x2f')]['limit']);_0x63216[_0x86fc('0x1a')]=qs[_0x86fc('0x1a')](_0x26a762[_0x86fc('0x2f')][_0x86fc('0x1a')]);}return _0xd2a7c0[_0x86fc('0x47')](_0x63216);}})[_0x86fc('0x24')](function(_0x9e4eee){if(_0x9e4eee){return _0x9e4eee?{'count':_0x1087c1,'rows':_0x9e4eee}:null;}})[_0x86fc('0x24')](respondWithResult(_0x12dc23,null))['catch'](handleError(_0x12dc23,null));};exports[_0x86fc('0x4b')]=function(_0x4fc9aa,_0x3ada06,_0x4061b9){if(_0x4fc9aa[_0x86fc('0x46')]['id']){delete _0x4fc9aa[_0x86fc('0x46')]['id'];}return db[_0x86fc('0x2b')][_0x86fc('0x48')]({'where':{'id':_0x4fc9aa[_0x86fc('0x41')]['id']}})[_0x86fc('0x24')](handleEntityNotFound(_0x3ada06,null))[_0x86fc('0x24')](function(_0x4a47b8){if(_0x4a47b8){_0x4fc9aa[_0x86fc('0x46')][_0x86fc('0x4c')]=_0x4a47b8['id'];_0x4fc9aa[_0x86fc('0x46')][_0x86fc('0x4d')]=integrations['getSubjects'](_0x4fc9aa[_0x86fc('0x46')][_0x86fc('0x4e')],_0x4fc9aa['body'][_0x86fc('0x4f')]);_0x4fc9aa[_0x86fc('0x46')]['Descriptions']=integrations['getDescriptions'](_0x4fc9aa[_0x86fc('0x46')][_0x86fc('0x4e')],_0x4fc9aa[_0x86fc('0x46')]['type']);return db[_0x86fc('0x49')][_0x86fc('0x45')](_0x4fc9aa[_0x86fc('0x46')],{'include':[{'model':db[_0x86fc('0x50')],'as':_0x86fc('0x4d')},{'model':db[_0x86fc('0x50')],'as':'Descriptions'}]});}return null;})[_0x86fc('0x24')](respondWithResult(_0x3ada06,null))['catch'](handleError(_0x3ada06,null));};exports['getFields']=function(_0x5b46c8,_0x29864d,_0x2695bf){var _0x395257;var _0x581ca3='';var _0x5587a8=_0x86fc('0x51');return db[_0x86fc('0x2b')][_0x86fc('0x48')]({'where':{'id':_0x5b46c8['params']['id']},'attributes':['id',_0x86fc('0x52'),'clientId','clientSecret',_0x86fc('0x53'),'password','securityToken']})[_0x86fc('0x24')](handleEntityNotFound(_0x29864d,null))[_0x86fc('0x24')](function(_0x49b630){if(_0x49b630){_0x581ca3=_0x49b630[_0x86fc('0x52')];var _0x469bc6=_0x581ca3['slice'](-0x1);if(_0x469bc6==='/'){_0x581ca3=_0x581ca3['substring'](0x0,_0x581ca3['lastIndexOf'](_0x469bc6));}_0x395257=new jsforce[(_0x86fc('0x54'))]({'oauth2':{'loginUrl':_0x581ca3,'clientId':_0x49b630[_0x86fc('0x55')],'clientSecret':_0x49b630[_0x86fc('0x56')]}});return _0x395257[_0x86fc('0x57')](_0x49b630['username'],_0x49b630[_0x86fc('0x58')][_0x86fc('0x59')](_0x49b630[_0x86fc('0x5a')]));}})['then'](function(_0xe5b44c){if(_0xe5b44c){if(!_['isNil'](_0x5b46c8[_0x86fc('0x2f')][_0x86fc('0x5b')])){_0x5587a8=_0x5b46c8['query'][_0x86fc('0x5b')];}return _0x395257[_0x86fc('0x5c')](_0x5587a8)[_0x86fc('0x5d')]();}})['then'](function(_0x462acc){var _0x35761a=[_0x86fc('0x5e'),'ActivityDate',_0x86fc('0x5f'),_0x86fc('0x60'),'Subject',_0x86fc('0x61')];var _0x5729a1=[_0x86fc('0x62'),_0x86fc('0x63'),_0x86fc('0x64'),_0x86fc('0x65'),'email',_0x86fc('0x66'),_0x86fc('0x67')];if(_0x462acc){_[_0x86fc('0x68')](_0x462acc['fields'],function(_0x2f0bbf){return _0x35761a[_0x86fc('0x69')](_0x2f0bbf['name'])||!_0x5729a1[_0x86fc('0x69')](_0x2f0bbf['type']);});return{'count':_0x462acc[_0x86fc('0x34')][_0x86fc('0x35')],'rows':_['map'](_0x462acc[_0x86fc('0x34')],function(_0x2befd5){return{'id':_0x2befd5[_0x86fc('0x28')],'name':_0x2befd5['label'],'custom':_0x2befd5[_0x86fc('0x6a')],'options':_0x2befd5[_0x86fc('0x6b')][_0x86fc('0x35')]>0x0?_[_0x86fc('0x2a')](_0x2befd5[_0x86fc('0x6b')],function(_0x325617){return{'name':_0x325617[_0x86fc('0x6c')],'value':_0x325617[_0x86fc('0x6d')]};}):_0x2befd5[_0x86fc('0x4f')]=='boolean'?[{'name':_0x86fc('0x6e'),'value':'true'},{'name':_0x86fc('0x6f'),'value':_0x86fc('0x70')}]:[]};})};}})[_0x86fc('0x24')](respondWithResult(_0x29864d,null))[_0x86fc('0x44')](function(_0x1a6f07){var _0x5a444d=_0x5b46c8['query'][_0x86fc('0x71')]?0x1f4:_0x1a6f07[_0x86fc('0x72')]||0x1f4;logger[_0x86fc('0x27')](_0x86fc('0x73'),_0x86fc('0x74'),_0x5a444d,JSON['stringify'](_0x1a6f07));delete _0x1a6f07[_0x86fc('0x28')];if(_0x5a444d===0x191){_0x5a444d=0x190;}_0x29864d['status'](_0x5a444d)[_0x86fc('0x75')](_0x5b46c8[_0x86fc('0x2f')][_0x86fc('0x71')]?{'message':_0x86fc('0x76'),'statusCode':_0x1a6f07['statusCode']}:_0x1a6f07);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bf5b1dd..86dba47 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 _0x8286=['util','moment','bluebird','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts'];(function(_0x457793,_0x5d80dd){var _0x1effd6=function(_0x35e2a9){while(--_0x35e2a9){_0x457793['push'](_0x457793['shift']());}};_0x1effd6(++_0x5d80dd);}(_0x8286,0x105));var _0x6828=function(_0x39f129,_0x53372d){_0x39f129=_0x39f129-0x0;var _0x2411e3=_0x8286[_0x39f129];return _0x2411e3;};'use strict';var _=require('lodash');var util=require(_0x6828('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6828('0x1'));var BPromise=require(_0x6828('0x2'));var rp=require(_0x6828('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6828('0x4'));var integrations=require(_0x6828('0x5'));module[_0x6828('0x6')]=function(_0xce7b3,_0x20ff22){return _0xce7b3['define'](_0x6828('0x7'),attributes,{'tableName':_0x6828('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6da3=['moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x1526d6,_0x283d58){var _0x464e27=function(_0x37845){while(--_0x37845){_0x1526d6['push'](_0x1526d6['shift']());}};_0x464e27(++_0x283d58);}(_0x6da3,0xf9));var _0x36da=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6da3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x36da('0x0'));var util=require(_0x36da('0x1'));var logger=require(_0x36da('0x2'))('api');var moment=require(_0x36da('0x3'));var BPromise=require(_0x36da('0x4'));var rp=require(_0x36da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x36da('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x36da('0x7'));module[_0x36da('0x8')]=function(_0x3eb004,_0x5d078d){return _0x3eb004[_0x36da('0x9')](_0x36da('0xa'),attributes,{'tableName':_0x36da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index b49628f..dff685c 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 _0xe528=['http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','attributes','limit','map','model','include','GetSalesforceAccount','stringify','SalesforceAccount','find','where','ShowSalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41f728,_0x133b16){var _0x29bf27=function(_0x3ae2aa){while(--_0x3ae2aa){_0x41f728['push'](_0x41f728['shift']());}};_0x29bf27(++_0x133b16);}(_0xe528,0x167));var _0x8e52=function(_0x5e02a7,_0x308590){_0x5e02a7=_0x5e02a7-0x0;var _0x34829f=_0xe528[_0x5e02a7];return _0x34829f;};'use strict';var _=require(_0x8e52('0x0'));var util=require(_0x8e52('0x1'));var moment=require(_0x8e52('0x2'));var BPromise=require(_0x8e52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e52('0x4'));var db=require(_0x8e52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e52('0x6'))(_0x8e52('0x7'));var config=require(_0x8e52('0x8'));var jayson=require(_0x8e52('0x9'));var client=jayson[_0x8e52('0xa')][_0x8e52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeb3b2c,_0x3b3f89,_0x5af88e){return new BPromise(function(_0x5ad0b4,_0x36ae3f){return client[_0x8e52('0xc')](_0xeb3b2c,_0x5af88e)[_0x8e52('0xd')](function(_0x100ebf){logger[_0x8e52('0xe')](_0x8e52('0xf'),_0x3b3f89,_0x8e52('0x10'));logger[_0x8e52('0x11')](_0x8e52('0x12'),_0x3b3f89,_0x8e52('0x10'),JSON['stringify'](_0x100ebf));if(_0x100ebf[_0x8e52('0x13')]){if(_0x100ebf[_0x8e52('0x13')][_0x8e52('0x14')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3b3f89,_0x100ebf[_0x8e52('0x13')]['message']);return _0x36ae3f(_0x100ebf[_0x8e52('0x13')][_0x8e52('0x15')]);}logger[_0x8e52('0x13')](_0x8e52('0xf'),_0x3b3f89,_0x100ebf['error'][_0x8e52('0x15')]);return _0x5ad0b4(_0x100ebf[_0x8e52('0x13')][_0x8e52('0x15')]);}else{logger[_0x8e52('0xe')](_0x8e52('0xf'),_0x3b3f89,_0x8e52('0x10'));_0x5ad0b4(_0x100ebf['result'][_0x8e52('0x15')]);}})[_0x8e52('0x16')](function(_0x4a3970){logger[_0x8e52('0x13')](_0x8e52('0xf'),_0x3b3f89,_0x4a3970);_0x36ae3f(_0x4a3970);});});}exports['GetSalesforceAccount']=function(_0x1658d6){var _0x1cc984=this;return new Promise(function(_0x3358c0,_0x3f51d7){return db['SalesforceAccount'][_0x8e52('0x17')]({'raw':_0x1658d6['options']?_0x1658d6[_0x8e52('0x18')][_0x8e52('0x19')]===undefined?!![]:![]:!![],'where':_0x1658d6[_0x8e52('0x18')]?_0x1658d6[_0x8e52('0x18')]['where']||null:null,'attributes':_0x1658d6[_0x8e52('0x18')]?_0x1658d6[_0x8e52('0x18')][_0x8e52('0x1a')]||null:null,'limit':_0x1658d6['options']?_0x1658d6[_0x8e52('0x18')][_0x8e52('0x1b')]||null:null,'include':_0x1658d6[_0x8e52('0x18')]?_0x1658d6[_0x8e52('0x18')]['include']?_[_0x8e52('0x1c')](_0x1658d6[_0x8e52('0x18')]['include'],function(_0xade2b2){return{'model':db[_0xade2b2[_0x8e52('0x1d')]],'as':_0xade2b2['as'],'attributes':_0xade2b2[_0x8e52('0x1a')],'include':_0xade2b2[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0xade2b2[_0x8e52('0x1e')],function(_0x2d1569){return{'model':db[_0x2d1569[_0x8e52('0x1d')]],'as':_0x2d1569['as'],'attributes':_0x2d1569['attributes'],'include':_0x2d1569[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0x2d1569[_0x8e52('0x1e')],function(_0x594331){return{'model':db[_0x594331[_0x8e52('0x1d')]],'as':_0x594331['as'],'attributes':_0x594331[_0x8e52('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8e52('0xd')](function(_0x29314a){logger[_0x8e52('0xe')](_0x8e52('0x1f'),_0x1658d6);logger[_0x8e52('0x11')]('GetSalesforceAccount',_0x1658d6,JSON[_0x8e52('0x20')](_0x29314a));_0x3358c0(_0x29314a);})['catch'](function(_0x27ce34){logger[_0x8e52('0x13')](_0x8e52('0x1f'),_0x27ce34[_0x8e52('0x15')],_0x1658d6);_0x3f51d7(_0x1cc984[_0x8e52('0x13')](0x1f4,_0x27ce34[_0x8e52('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x5c4b21){var _0x25d6ef=this;return new Promise(function(_0x3b8511,_0x5a8876){return db[_0x8e52('0x21')][_0x8e52('0x22')]({'raw':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21[_0x8e52('0x18')][_0x8e52('0x19')]===undefined?!![]:![]:!![],'where':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21[_0x8e52('0x18')][_0x8e52('0x23')]||null:null,'attributes':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21[_0x8e52('0x18')][_0x8e52('0x1a')]||null:null,'include':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21['options']['include']?_[_0x8e52('0x1c')](_0x5c4b21['options'][_0x8e52('0x1e')],function(_0x55b15a){return{'model':db[_0x55b15a[_0x8e52('0x1d')]],'as':_0x55b15a['as'],'attributes':_0x55b15a['attributes'],'include':_0x55b15a[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0x55b15a[_0x8e52('0x1e')],function(_0x892258){return{'model':db[_0x892258['model']],'as':_0x892258['as'],'attributes':_0x892258[_0x8e52('0x1a')],'include':_0x892258[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0x892258['include'],function(_0x252d98){return{'model':db[_0x252d98[_0x8e52('0x1d')]],'as':_0x252d98['as'],'attributes':_0x252d98[_0x8e52('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8e52('0xd')](function(_0x59cc27){logger['info'](_0x8e52('0x24'),_0x5c4b21);logger[_0x8e52('0x11')]('ShowSalesforceAccount',_0x5c4b21,JSON['stringify'](_0x59cc27));_0x3b8511(_0x59cc27);})['catch'](function(_0x42888c){logger['error']('ShowSalesforceAccount',_0x42888c[_0x8e52('0x15')],_0x5c4b21);_0x5a8876(_0x25d6ef[_0x8e52('0x13')](0x1f4,_0x42888c['message']));});});}; \ No newline at end of file +var _0xc4f3=['include','map','model','then','stringify','ShowSalesforceAccount','find','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','SalesforceAccount,\x20%s,\x20%s','message','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes'];(function(_0x27d402,_0x26a705){var _0x383012=function(_0x3b406f){while(--_0x3b406f){_0x27d402['push'](_0x27d402['shift']());}};_0x383012(++_0x26a705);}(_0xc4f3,0xbd));var _0x3c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c4f('0x0'));var util=require(_0x3c4f('0x1'));var moment=require(_0x3c4f('0x2'));var BPromise=require(_0x3c4f('0x3'));var rs=require(_0x3c4f('0x4'));var fs=require('fs');var Redis=require(_0x3c4f('0x5'));var db=require(_0x3c4f('0x6'))['db'];var utils=require(_0x3c4f('0x7'));var logger=require(_0x3c4f('0x8'))(_0x3c4f('0x9'));var config=require('../../config/environment');var jayson=require(_0x3c4f('0xa'));var client=jayson['client'][_0x3c4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x354f3e,_0x4b556d,_0x3994cf){return new BPromise(function(_0x4c29ab,_0x33152a){return client[_0x3c4f('0xc')](_0x354f3e,_0x3994cf)['then'](function(_0x58b231){logger[_0x3c4f('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x4b556d,_0x3c4f('0xe'));logger[_0x3c4f('0xf')](_0x3c4f('0x10'),_0x4b556d,'request\x20sent',JSON['stringify'](_0x58b231));if(_0x58b231[_0x3c4f('0x11')]){if(_0x58b231[_0x3c4f('0x11')][_0x3c4f('0x12')]===0x1f4){logger['error'](_0x3c4f('0x13'),_0x4b556d,_0x58b231[_0x3c4f('0x11')][_0x3c4f('0x14')]);return _0x33152a(_0x58b231[_0x3c4f('0x11')][_0x3c4f('0x14')]);}logger[_0x3c4f('0x11')](_0x3c4f('0x13'),_0x4b556d,_0x58b231[_0x3c4f('0x11')][_0x3c4f('0x14')]);return _0x4c29ab(_0x58b231[_0x3c4f('0x11')][_0x3c4f('0x14')]);}else{logger[_0x3c4f('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x4b556d,'request\x20sent');_0x4c29ab(_0x58b231['result'][_0x3c4f('0x14')]);}})['catch'](function(_0x4d05e6){logger[_0x3c4f('0x11')](_0x3c4f('0x13'),_0x4b556d,_0x4d05e6);_0x33152a(_0x4d05e6);});});}exports[_0x3c4f('0x15')]=function(_0x4bc77b){var _0x58f856=this;return new Promise(function(_0x44b30e,_0x5558ef){return db[_0x3c4f('0x16')][_0x3c4f('0x17')]({'raw':_0x4bc77b[_0x3c4f('0x18')]?_0x4bc77b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bc77b[_0x3c4f('0x18')]?_0x4bc77b[_0x3c4f('0x18')][_0x3c4f('0x19')]||null:null,'attributes':_0x4bc77b[_0x3c4f('0x18')]?_0x4bc77b[_0x3c4f('0x18')][_0x3c4f('0x1a')]||null:null,'limit':_0x4bc77b['options']?_0x4bc77b[_0x3c4f('0x18')]['limit']||null:null,'include':_0x4bc77b[_0x3c4f('0x18')]?_0x4bc77b[_0x3c4f('0x18')][_0x3c4f('0x1b')]?_[_0x3c4f('0x1c')](_0x4bc77b[_0x3c4f('0x18')][_0x3c4f('0x1b')],function(_0x3993da){return{'model':db[_0x3993da[_0x3c4f('0x1d')]],'as':_0x3993da['as'],'attributes':_0x3993da[_0x3c4f('0x1a')],'include':_0x3993da[_0x3c4f('0x1b')]?_[_0x3c4f('0x1c')](_0x3993da[_0x3c4f('0x1b')],function(_0x3d6cf0){return{'model':db[_0x3d6cf0[_0x3c4f('0x1d')]],'as':_0x3d6cf0['as'],'attributes':_0x3d6cf0[_0x3c4f('0x1a')],'include':_0x3d6cf0['include']?_[_0x3c4f('0x1c')](_0x3d6cf0[_0x3c4f('0x1b')],function(_0x4852c2){return{'model':db[_0x4852c2[_0x3c4f('0x1d')]],'as':_0x4852c2['as'],'attributes':_0x4852c2[_0x3c4f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3c4f('0x1e')](function(_0xf5880e){logger['info'](_0x3c4f('0x15'),_0x4bc77b);logger[_0x3c4f('0xf')]('GetSalesforceAccount',_0x4bc77b,JSON[_0x3c4f('0x1f')](_0xf5880e));_0x44b30e(_0xf5880e);})['catch'](function(_0x30f213){logger['error'](_0x3c4f('0x15'),_0x30f213[_0x3c4f('0x14')],_0x4bc77b);_0x5558ef(_0x58f856['error'](0x1f4,_0x30f213['message']));});});};exports[_0x3c4f('0x20')]=function(_0x1df329){var _0x16e088=this;return new Promise(function(_0x3a3deb,_0x5d9814){return db['SalesforceAccount'][_0x3c4f('0x21')]({'raw':_0x1df329[_0x3c4f('0x18')]?_0x1df329[_0x3c4f('0x18')][_0x3c4f('0x22')]===undefined?!![]:![]:!![],'where':_0x1df329['options']?_0x1df329[_0x3c4f('0x18')][_0x3c4f('0x19')]||null:null,'attributes':_0x1df329[_0x3c4f('0x18')]?_0x1df329[_0x3c4f('0x18')][_0x3c4f('0x1a')]||null:null,'include':_0x1df329[_0x3c4f('0x18')]?_0x1df329[_0x3c4f('0x18')][_0x3c4f('0x1b')]?_['map'](_0x1df329['options'][_0x3c4f('0x1b')],function(_0x5cb650){return{'model':db[_0x5cb650[_0x3c4f('0x1d')]],'as':_0x5cb650['as'],'attributes':_0x5cb650[_0x3c4f('0x1a')],'include':_0x5cb650[_0x3c4f('0x1b')]?_['map'](_0x5cb650[_0x3c4f('0x1b')],function(_0xeda9bd){return{'model':db[_0xeda9bd[_0x3c4f('0x1d')]],'as':_0xeda9bd['as'],'attributes':_0xeda9bd[_0x3c4f('0x1a')],'include':_0xeda9bd[_0x3c4f('0x1b')]?_[_0x3c4f('0x1c')](_0xeda9bd[_0x3c4f('0x1b')],function(_0x29957e){return{'model':db[_0x29957e[_0x3c4f('0x1d')]],'as':_0x29957e['as'],'attributes':_0x29957e[_0x3c4f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d636){logger[_0x3c4f('0xd')](_0x3c4f('0x20'),_0x1df329);logger[_0x3c4f('0xf')]('ShowSalesforceAccount',_0x1df329,JSON[_0x3c4f('0x1f')](_0x58d636));_0x3a3deb(_0x58d636);})[_0x3c4f('0x23')](function(_0x4fadad){logger[_0x3c4f('0x11')](_0x3c4f('0x20'),_0x4fadad['message'],_0x1df329);_0x5d9814(_0x16e088[_0x3c4f('0x11')](0x1f4,_0x4fadad[_0x3c4f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0b1d2cc..96cc7ea 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x31d140,_0x4062bc){var _0x5997a6=function(_0x4be034){while(--_0x4be034){_0x31d140['push'](_0x31d140['shift']());}};_0x5997a6(++_0x4062bc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x1f8509,_0x3993b6){_0x1f8509=_0x1f8509-0x0;var _0x213eb6=_0x2032[_0x1f8509];return _0x213eb6;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 166d005..2425a3c 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 _0xb5fa=['STRING','ENUM','Task','contact_lead','account','nothing','lead','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb5fa,0x187));var _0xab5f=function(_0x21c139,_0x228818){_0x21c139=_0x21c139-0x0;var _0x3052d8=_0xb5fa[_0x21c139];return _0x3052d8;};'use strict';var Sequelize=require('sequelize');module[_0xab5f('0x0')]={'name':{'type':Sequelize[_0xab5f('0x1')]},'description':{'type':Sequelize[_0xab5f('0x1')]},'ticketType':{'type':Sequelize[_0xab5f('0x2')](_0xab5f('0x3'),'Case'),'defaultValue':_0xab5f('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xab5f('0x4'),'contact','lead','account_contact_lead',_0xab5f('0x5')),'defaultValue':_0xab5f('0x4')},'moduleCreate':{'type':Sequelize[_0xab5f('0x2')](_0xab5f('0x6'),'contact',_0xab5f('0x7'),_0xab5f('0x5')),'defaultValue':_0xab5f('0x7')},'leadId':{'type':Sequelize[_0xab5f('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xab5f('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xab5f('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xab5f('0x1')]}}; \ No newline at end of file +var _0x0f19=['exports','STRING','ENUM','Case','Task','lead','account_contact_lead','account','contact_lead','nothing','contact'];(function(_0x2f9026,_0x3b954b){var _0x2dec99=function(_0x21ca70){while(--_0x21ca70){_0x2f9026['push'](_0x2f9026['shift']());}};_0x2dec99(++_0x3b954b);}(_0x0f19,0x160));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x90f1('0x0')]={'name':{'type':Sequelize[_0x90f1('0x1')]},'description':{'type':Sequelize[_0x90f1('0x1')]},'ticketType':{'type':Sequelize[_0x90f1('0x2')]('Task',_0x90f1('0x3')),'defaultValue':_0x90f1('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0x90f1('0x5'),_0x90f1('0x6'),_0x90f1('0x7')),'defaultValue':_0x90f1('0x8')},'moduleCreate':{'type':Sequelize[_0x90f1('0x2')](_0x90f1('0x9'),_0x90f1('0xa'),_0x90f1('0x5'),_0x90f1('0x7')),'defaultValue':_0x90f1('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x90f1('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x90f1('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8a55a4c..8fd1ebf 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 _0x661c=['offset','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','catch','show','params','fields','length','include','find','create','body','getFields','findOne','order','getSubjects','SalesforceField','getDescriptions','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x5ab27f,_0x21a462){var _0x23826c=function(_0x4292ac){while(--_0x4292ac){_0x5ab27f['push'](_0x5ab27f['shift']());}};_0x23826c(++_0x21a462);}(_0x661c,0x122));var _0xc661=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x661c[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0xc661('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc661('0x1'));var rp=require('request-promise');var moment=require(_0xc661('0x2'));var BPromise=require(_0xc661('0x3'));var Mustache=require(_0xc661('0x4'));var util=require(_0xc661('0x5'));var path=require(_0xc661('0x6'));var sox=require(_0xc661('0x7'));var csv=require(_0xc661('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc661('0x9'));var squel=require('squel');var crypto=require(_0xc661('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc661('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc661('0xc'));var Papa=require(_0xc661('0xd'));var Redis=require(_0xc661('0xe'));var authService=require(_0xc661('0xf'));var qs=require(_0xc661('0x10'));var as=require(_0xc661('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc661('0x12'))('api');var utils=require(_0xc661('0x13'));var config=require(_0xc661('0x14'));var licenseUtil=require(_0xc661('0x15'));var db=require(_0xc661('0x16'))['db'];function respondWithStatusCode(_0x5be601,_0x2a8860){_0x2a8860=_0x2a8860||0xcc;return function(_0x405477){if(_0x405477){return _0x5be601[_0xc661('0x17')](_0x2a8860);}return _0x5be601[_0xc661('0x18')](_0x2a8860)['end']();};}function respondWithResult(_0x803f14,_0x365eb9){_0x365eb9=_0x365eb9||0xc8;return function(_0x52905b){if(_0x52905b){return _0x803f14[_0xc661('0x18')](_0x365eb9)['json'](_0x52905b);}};}function respondWithFilteredResult(_0x541e64,_0x2478c8){return function(_0x2223ff){if(_0x2223ff){var _0x5565f1=typeof _0x2478c8['offset']===_0xc661('0x19')&&typeof _0x2478c8['limit']==='undefined';var _0x437eae=_0x2223ff['count'];var _0x390807=_0x5565f1?0x0:_0x2478c8[_0xc661('0x1a')];var _0xab6225=_0x5565f1?_0x2223ff[_0xc661('0x1b')]:_0x2478c8[_0xc661('0x1a')]+_0x2478c8[_0xc661('0x1c')];var _0x482913;if(_0xab6225>=_0x437eae){_0xab6225=_0x437eae;_0x482913=0xc8;}else{_0x482913=0xce;}_0x541e64[_0xc661('0x18')](_0x482913);return _0x541e64['set'](_0xc661('0x1d'),_0x390807+'-'+_0xab6225+'/'+_0x437eae)[_0xc661('0x1e')](_0x2223ff);}return null;};}function patchUpdates(_0x55e7b7){return function(_0xfc05d7){try{jsonpatch[_0xc661('0x1f')](_0xfc05d7,_0x55e7b7,!![]);}catch(_0x230528){return BPromise[_0xc661('0x20')](_0x230528);}return _0xfc05d7[_0xc661('0x21')]();};}function saveUpdates(_0x1a6d38,_0x1128fe){return function(_0x34c707){if(_0x34c707){return _0x34c707[_0xc661('0x22')](_0x1a6d38)[_0xc661('0x23')](function(_0x36c643){return _0x36c643;});}return null;};}function removeEntity(_0x3e7ca0,_0x3e8339){return function(_0x4c2ecf){if(_0x4c2ecf){return _0x4c2ecf[_0xc661('0x24')]()[_0xc661('0x23')](function(){_0x3e7ca0['status'](0xcc)[_0xc661('0x25')]();});}};}function handleEntityNotFound(_0x3eb48d,_0x1b218e){return function(_0x40f4cd){if(!_0x40f4cd){_0x3eb48d[_0xc661('0x17')](0x194);}return _0x40f4cd;};}function handleError(_0x245e42,_0x564bce){_0x564bce=_0x564bce||0x1f4;return function(_0x395491){logger['error'](_0x395491[_0xc661('0x26')]);if(_0x395491[_0xc661('0x27')]){delete _0x395491['name'];}_0x245e42['status'](_0x564bce)[_0xc661('0x28')](_0x395491);};}exports[_0xc661('0x29')]=function(_0x116db6,_0x5037d6){var _0x57d4a1={},_0x2d5ab2={},_0x306093={'count':0x0,'rows':[]};var _0x2c05a9=_[_0xc661('0x2a')](db[_0xc661('0x2b')][_0xc661('0x2c')],function(_0x4e4d49){return{'name':_0x4e4d49[_0xc661('0x2d')],'type':_0x4e4d49['type'][_0xc661('0x2e')]};});_0x2d5ab2['model']=_[_0xc661('0x2a')](_0x2c05a9,_0xc661('0x27'));_0x2d5ab2[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x116db6[_0xc661('0x2f')]);_0x2d5ab2[_0xc661('0x31')]=_[_0xc661('0x32')](_0x2d5ab2[_0xc661('0x33')],_0x2d5ab2[_0xc661('0x2f')]);_0x57d4a1[_0xc661('0x34')]=_['intersection'](_0x2d5ab2[_0xc661('0x33')],qs['fields'](_0x116db6['query']['fields']));_0x57d4a1[_0xc661('0x34')]=_0x57d4a1[_0xc661('0x34')]['length']?_0x57d4a1['attributes']:_0x2d5ab2[_0xc661('0x33')];if(!_0x116db6[_0xc661('0x2f')][_0xc661('0x35')](_0xc661('0x36'))){_0x57d4a1[_0xc661('0x1c')]=qs[_0xc661('0x1c')](_0x116db6['query']['limit']);_0x57d4a1['offset']=qs[_0xc661('0x1a')](_0x116db6[_0xc661('0x2f')][_0xc661('0x1a')]);}_0x57d4a1['order']=qs[_0xc661('0x37')](_0x116db6[_0xc661('0x2f')][_0xc661('0x37')]);_0x57d4a1['where']=qs[_0xc661('0x31')](_[_0xc661('0x38')](_0x116db6['query'],_0x2d5ab2[_0xc661('0x31')]),_0x2c05a9);if(_0x116db6[_0xc661('0x2f')][_0xc661('0x39')]){_0x57d4a1[_0xc661('0x3a')]=_['merge'](_0x57d4a1[_0xc661('0x3a')],{'$or':_['map'](_0x2c05a9,function(_0x8ce015){if(_0x8ce015[_0xc661('0x3b')]!==_0xc661('0x3c')){var _0x44ed2d={};_0x44ed2d[_0x8ce015[_0xc661('0x27')]]={'$like':'%'+_0x116db6[_0xc661('0x2f')][_0xc661('0x39')]+'%'};return _0x44ed2d;}})});}_0x57d4a1=_[_0xc661('0x3d')]({},_0x57d4a1,_0x116db6[_0xc661('0x3e')]);var _0x2f470d={'where':_0x57d4a1[_0xc661('0x3a')]};return db['SalesforceConfiguration'][_0xc661('0x1b')](_0x2f470d)[_0xc661('0x23')](function(_0x1c0708){_0x306093[_0xc661('0x1b')]=_0x1c0708;if(_0x116db6[_0xc661('0x2f')][_0xc661('0x3f')]){_0x57d4a1['include']=[{'all':!![]}];}return db[_0xc661('0x2b')]['findAll'](_0x57d4a1);})['then'](function(_0x27eb6c){_0x306093['rows']=_0x27eb6c;return _0x306093;})[_0xc661('0x23')](respondWithFilteredResult(_0x5037d6,_0x57d4a1))[_0xc661('0x40')](handleError(_0x5037d6,null));};exports[_0xc661('0x41')]=function(_0x90c62a,_0x1e5ec1){var _0x2f442d={'raw':![],'where':{'id':_0x90c62a[_0xc661('0x42')]['id']}},_0x11b53d={};_0x11b53d[_0xc661('0x33')]=_[_0xc661('0x30')](db[_0xc661('0x2b')][_0xc661('0x2c')]);_0x11b53d[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x90c62a[_0xc661('0x2f')]);_0x11b53d[_0xc661('0x31')]=_[_0xc661('0x32')](_0x11b53d['model'],_0x11b53d['query']);_0x2f442d[_0xc661('0x34')]=_[_0xc661('0x32')](_0x11b53d['model'],qs['fields'](_0x90c62a[_0xc661('0x2f')][_0xc661('0x43')]));_0x2f442d[_0xc661('0x34')]=_0x2f442d['attributes'][_0xc661('0x44')]?_0x2f442d[_0xc661('0x34')]:_0x11b53d[_0xc661('0x33')];if(_0x90c62a[_0xc661('0x2f')]['includeAll']){_0x2f442d[_0xc661('0x45')]=[{'all':!![]}];}_0x2f442d=_[_0xc661('0x3d')]({},_0x2f442d,_0x90c62a[_0xc661('0x3e')]);return db[_0xc661('0x2b')][_0xc661('0x46')](_0x2f442d)[_0xc661('0x23')](handleEntityNotFound(_0x1e5ec1,null))[_0xc661('0x23')](respondWithResult(_0x1e5ec1,null))['catch'](handleError(_0x1e5ec1,null));};exports['create']=function(_0x1a52b9,_0x3c500d){return db[_0xc661('0x2b')][_0xc661('0x47')](_0x1a52b9['body'],{})[_0xc661('0x23')](respondWithResult(_0x3c500d,0xc9))[_0xc661('0x40')](handleError(_0x3c500d,null));};exports['update']=function(_0x9f18a9,_0x1c3758){if(_0x9f18a9['body']['id']){delete _0x9f18a9['body']['id'];}return db[_0xc661('0x2b')][_0xc661('0x46')]({'where':{'id':_0x9f18a9[_0xc661('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c3758,null))['then'](saveUpdates(_0x9f18a9[_0xc661('0x48')],null))[_0xc661('0x23')](respondWithResult(_0x1c3758,null))[_0xc661('0x40')](handleError(_0x1c3758,null));};exports['destroy']=function(_0x34fe31,_0xdfa8fb){return db[_0xc661('0x2b')][_0xc661('0x46')]({'where':{'id':_0x34fe31[_0xc661('0x42')]['id']}})[_0xc661('0x23')](handleEntityNotFound(_0xdfa8fb,null))['then'](removeEntity(_0xdfa8fb,null))['catch'](handleError(_0xdfa8fb,null));};exports[_0xc661('0x49')]=function(_0xb2aa6c,_0x34933c,_0x173d0e){var _0x50e848={};var _0x7dfbf5={};var _0x5a2572;var _0x4be7fd;return db[_0xc661('0x2b')][_0xc661('0x4a')]({'where':{'id':_0xb2aa6c[_0xc661('0x42')]['id']}})[_0xc661('0x23')](handleEntityNotFound(_0x34933c,null))['then'](function(_0x1e8d75){if(_0x1e8d75){_0x5a2572=_0x1e8d75;_0x7dfbf5[_0xc661('0x33')]=_[_0xc661('0x30')](db['SalesforceField'][_0xc661('0x2c')]);_0x7dfbf5[_0xc661('0x2f')]=_[_0xc661('0x30')](_0xb2aa6c['query']);_0x7dfbf5[_0xc661('0x31')]=_[_0xc661('0x32')](_0x7dfbf5[_0xc661('0x33')],_0x7dfbf5[_0xc661('0x2f')]);_0x50e848[_0xc661('0x34')]=_[_0xc661('0x32')](_0x7dfbf5[_0xc661('0x33')],qs[_0xc661('0x43')](_0xb2aa6c['query'][_0xc661('0x43')]));_0x50e848['attributes']=_0x50e848[_0xc661('0x34')][_0xc661('0x44')]?_0x50e848[_0xc661('0x34')]:_0x7dfbf5['model'];_0x50e848[_0xc661('0x4b')]=qs['sort'](_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x37')]);_0x50e848[_0xc661('0x3a')]=qs[_0xc661('0x31')](_['pick'](_0xb2aa6c['query'],_0x7dfbf5[_0xc661('0x31')]));if(_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x39')]){_0x50e848[_0xc661('0x3a')]=_[_0xc661('0x3d')](_0x50e848[_0xc661('0x3a')],{'$or':_[_0xc661('0x2a')](_0x50e848[_0xc661('0x34')],function(_0x35a9a0){var _0x57ad49={};_0x57ad49[_0x35a9a0]={'$like':'%'+_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x39')]+'%'};return _0x57ad49;})});}_0x50e848=_[_0xc661('0x3d')]({},_0x50e848,_0xb2aa6c[_0xc661('0x3e')]);return _0x5a2572['getFields'](_0x50e848);}})['then'](function(_0x4b27eb){if(_0x4b27eb){_0x4be7fd=_0x4b27eb['length'];if(!_0xb2aa6c['query'][_0xc661('0x35')](_0xc661('0x36'))){_0x50e848[_0xc661('0x1c')]=qs[_0xc661('0x1c')](_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x1c')]);_0x50e848[_0xc661('0x1a')]=qs[_0xc661('0x1a')](_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x1a')]);}return _0x5a2572[_0xc661('0x49')](_0x50e848);}})[_0xc661('0x23')](function(_0x572293){if(_0x572293){return _0x572293?{'count':_0x4be7fd,'rows':_0x572293}:null;}})[_0xc661('0x23')](respondWithResult(_0x34933c,null))[_0xc661('0x40')](handleError(_0x34933c,null));};exports[_0xc661('0x4c')]=function(_0x25c97b,_0x417816,_0x3e105c){var _0x572b92={};var _0x5ca8c2={};var _0x1b2eaa;var _0x2f39ab;return db['SalesforceConfiguration'][_0xc661('0x4a')]({'where':{'id':_0x25c97b[_0xc661('0x42')]['id']}})[_0xc661('0x23')](handleEntityNotFound(_0x417816,null))['then'](function(_0x3166b1){if(_0x3166b1){_0x1b2eaa=_0x3166b1;_0x5ca8c2['model']=_['keys'](db[_0xc661('0x4d')][_0xc661('0x2c')]);_0x5ca8c2[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x25c97b[_0xc661('0x2f')]);_0x5ca8c2['filters']=_[_0xc661('0x32')](_0x5ca8c2[_0xc661('0x33')],_0x5ca8c2[_0xc661('0x2f')]);_0x572b92['attributes']=_[_0xc661('0x32')](_0x5ca8c2[_0xc661('0x33')],qs[_0xc661('0x43')](_0x25c97b[_0xc661('0x2f')][_0xc661('0x43')]));_0x572b92[_0xc661('0x34')]=_0x572b92[_0xc661('0x34')][_0xc661('0x44')]?_0x572b92[_0xc661('0x34')]:_0x5ca8c2['model'];_0x572b92[_0xc661('0x4b')]=qs[_0xc661('0x37')](_0x25c97b['query'][_0xc661('0x37')]);_0x572b92[_0xc661('0x3a')]=qs[_0xc661('0x31')](_[_0xc661('0x38')](_0x25c97b[_0xc661('0x2f')],_0x5ca8c2[_0xc661('0x31')]));if(_0x25c97b['query'][_0xc661('0x39')]){_0x572b92[_0xc661('0x3a')]=_['merge'](_0x572b92[_0xc661('0x3a')],{'$or':_[_0xc661('0x2a')](_0x572b92[_0xc661('0x34')],function(_0x5e8617){var _0x2d4a51={};_0x2d4a51[_0x5e8617]={'$like':'%'+_0x25c97b['query'][_0xc661('0x39')]+'%'};return _0x2d4a51;})});}_0x572b92=_[_0xc661('0x3d')]({},_0x572b92,_0x25c97b[_0xc661('0x3e')]);return _0x1b2eaa[_0xc661('0x4c')](_0x572b92);}})[_0xc661('0x23')](function(_0x20557b){if(_0x20557b){_0x2f39ab=_0x20557b[_0xc661('0x44')];if(!_0x25c97b[_0xc661('0x2f')][_0xc661('0x35')](_0xc661('0x36'))){_0x572b92['limit']=qs[_0xc661('0x1c')](_0x25c97b[_0xc661('0x2f')]['limit']);_0x572b92[_0xc661('0x1a')]=qs[_0xc661('0x1a')](_0x25c97b[_0xc661('0x2f')][_0xc661('0x1a')]);}return _0x1b2eaa[_0xc661('0x4c')](_0x572b92);}})[_0xc661('0x23')](function(_0xd831e9){if(_0xd831e9){return _0xd831e9?{'count':_0x2f39ab,'rows':_0xd831e9}:null;}})[_0xc661('0x23')](respondWithResult(_0x417816,null))[_0xc661('0x40')](handleError(_0x417816,null));};exports['getDescriptions']=function(_0x556a64,_0x10dd23,_0x26cbb4){var _0x518d21={};var _0x3efbdc={};var _0x3e28fc;var _0x1a1b24;return db[_0xc661('0x2b')][_0xc661('0x4a')]({'where':{'id':_0x556a64[_0xc661('0x42')]['id']}})['then'](handleEntityNotFound(_0x10dd23,null))[_0xc661('0x23')](function(_0xc4e3e9){if(_0xc4e3e9){_0x3e28fc=_0xc4e3e9;_0x3efbdc[_0xc661('0x33')]=_['keys'](db[_0xc661('0x4d')][_0xc661('0x2c')]);_0x3efbdc[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x556a64['query']);_0x3efbdc[_0xc661('0x31')]=_[_0xc661('0x32')](_0x3efbdc[_0xc661('0x33')],_0x3efbdc[_0xc661('0x2f')]);_0x518d21[_0xc661('0x34')]=_['intersection'](_0x3efbdc['model'],qs['fields'](_0x556a64[_0xc661('0x2f')][_0xc661('0x43')]));_0x518d21[_0xc661('0x34')]=_0x518d21[_0xc661('0x34')][_0xc661('0x44')]?_0x518d21[_0xc661('0x34')]:_0x3efbdc[_0xc661('0x33')];_0x518d21[_0xc661('0x4b')]=qs[_0xc661('0x37')](_0x556a64['query'][_0xc661('0x37')]);_0x518d21[_0xc661('0x3a')]=qs[_0xc661('0x31')](_[_0xc661('0x38')](_0x556a64[_0xc661('0x2f')],_0x3efbdc[_0xc661('0x31')]));if(_0x556a64['query'][_0xc661('0x39')]){_0x518d21[_0xc661('0x3a')]=_[_0xc661('0x3d')](_0x518d21[_0xc661('0x3a')],{'$or':_[_0xc661('0x2a')](_0x518d21[_0xc661('0x34')],function(_0x123461){var _0x2446c0={};_0x2446c0[_0x123461]={'$like':'%'+_0x556a64[_0xc661('0x2f')][_0xc661('0x39')]+'%'};return _0x2446c0;})});}_0x518d21=_[_0xc661('0x3d')]({},_0x518d21,_0x556a64['options']);return _0x3e28fc[_0xc661('0x4e')](_0x518d21);}})[_0xc661('0x23')](function(_0x4e1bda){if(_0x4e1bda){_0x1a1b24=_0x4e1bda[_0xc661('0x44')];if(!_0x556a64[_0xc661('0x2f')]['hasOwnProperty'](_0xc661('0x36'))){_0x518d21['limit']=qs[_0xc661('0x1c')](_0x556a64[_0xc661('0x2f')]['limit']);_0x518d21[_0xc661('0x1a')]=qs[_0xc661('0x1a')](_0x556a64[_0xc661('0x2f')]['offset']);}return _0x3e28fc[_0xc661('0x4e')](_0x518d21);}})[_0xc661('0x23')](function(_0x567489){if(_0x567489){return _0x567489?{'count':_0x1a1b24,'rows':_0x567489}:null;}})[_0xc661('0x23')](respondWithResult(_0x10dd23,null))[_0xc661('0x40')](handleError(_0x10dd23,null));}; \ No newline at end of file +var _0xc8b0=['name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','rows','show','params','options','find','create','body','catch','getFields','findOne','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack'];(function(_0x6522af,_0x200962){var _0x39f7de=function(_0x2da9f7){while(--_0x2da9f7){_0x6522af['push'](_0x6522af['shift']());}};_0x39f7de(++_0x200962);}(_0xc8b0,0x1cc));var _0x0c8b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc8b0[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x0c8b('0x0'));var rimraf=require(_0x0c8b('0x1'));var zipdir=require(_0x0c8b('0x2'));var jsonpatch=require(_0x0c8b('0x3'));var rp=require(_0x0c8b('0x4'));var moment=require(_0x0c8b('0x5'));var BPromise=require(_0x0c8b('0x6'));var Mustache=require(_0x0c8b('0x7'));var util=require(_0x0c8b('0x8'));var path=require(_0x0c8b('0x9'));var sox=require(_0x0c8b('0xa'));var csv=require(_0x0c8b('0xb'));var ejs=require(_0x0c8b('0xc'));var fs=require('fs');var fs_extra=require(_0x0c8b('0xd'));var _=require(_0x0c8b('0xe'));var squel=require('squel');var crypto=require(_0x0c8b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0c8b('0x10'));var toCsv=require(_0x0c8b('0xb'));var querystring=require(_0x0c8b('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c8b('0x12'));var qs=require(_0x0c8b('0x13'));var as=require(_0x0c8b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c8b('0x15'))(_0x0c8b('0x16'));var utils=require(_0x0c8b('0x17'));var config=require(_0x0c8b('0x18'));var licenseUtil=require(_0x0c8b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc391a9,_0x10980f){_0x10980f=_0x10980f||0xcc;return function(_0x440653){if(_0x440653){return _0xc391a9[_0x0c8b('0x1a')](_0x10980f);}return _0xc391a9[_0x0c8b('0x1b')](_0x10980f)['end']();};}function respondWithResult(_0x1af8c2,_0x3b1b4d){_0x3b1b4d=_0x3b1b4d||0xc8;return function(_0x5c44f0){if(_0x5c44f0){return _0x1af8c2['status'](_0x3b1b4d)[_0x0c8b('0x1c')](_0x5c44f0);}};}function respondWithFilteredResult(_0x2ef70c,_0x582e44){return function(_0x2bac49){if(_0x2bac49){var _0x4c94a7=typeof _0x582e44[_0x0c8b('0x1d')]===_0x0c8b('0x1e')&&typeof _0x582e44[_0x0c8b('0x1f')]===_0x0c8b('0x1e');var _0x4c7396=_0x2bac49[_0x0c8b('0x20')];var _0x283efd=_0x4c94a7?0x0:_0x582e44['offset'];var _0x3d97b2=_0x4c94a7?_0x2bac49['count']:_0x582e44['offset']+_0x582e44['limit'];var _0x3dcb0f;if(_0x3d97b2>=_0x4c7396){_0x3d97b2=_0x4c7396;_0x3dcb0f=0xc8;}else{_0x3dcb0f=0xce;}_0x2ef70c[_0x0c8b('0x1b')](_0x3dcb0f);return _0x2ef70c[_0x0c8b('0x21')](_0x0c8b('0x22'),_0x283efd+'-'+_0x3d97b2+'/'+_0x4c7396)['json'](_0x2bac49);}return null;};}function patchUpdates(_0x1c14da){return function(_0xe63148){try{jsonpatch[_0x0c8b('0x23')](_0xe63148,_0x1c14da,!![]);}catch(_0x5ee926){return BPromise[_0x0c8b('0x24')](_0x5ee926);}return _0xe63148[_0x0c8b('0x25')]();};}function saveUpdates(_0x1e2240,_0x1d5a73){return function(_0x503bb0){if(_0x503bb0){return _0x503bb0[_0x0c8b('0x26')](_0x1e2240)['then'](function(_0x289598){return _0x289598;});}return null;};}function removeEntity(_0x1dafe0,_0x1572ae){return function(_0x29ab10){if(_0x29ab10){return _0x29ab10[_0x0c8b('0x27')]()[_0x0c8b('0x28')](function(){_0x1dafe0[_0x0c8b('0x1b')](0xcc)[_0x0c8b('0x29')]();});}};}function handleEntityNotFound(_0x55789b,_0x5cf080){return function(_0x2b38c8){if(!_0x2b38c8){_0x55789b['sendStatus'](0x194);}return _0x2b38c8;};}function handleError(_0x304d52,_0x57a413){_0x57a413=_0x57a413||0x1f4;return function(_0x1a242b){logger[_0x0c8b('0x2a')](_0x1a242b[_0x0c8b('0x2b')]);if(_0x1a242b[_0x0c8b('0x2c')]){delete _0x1a242b['name'];}_0x304d52['status'](_0x57a413)[_0x0c8b('0x2d')](_0x1a242b);};}exports[_0x0c8b('0x2e')]=function(_0x48da90,_0x27be84){var _0x31bf70={},_0x320b34={},_0x26146d={'count':0x0,'rows':[]};var _0x178581=_[_0x0c8b('0x2f')](db[_0x0c8b('0x30')][_0x0c8b('0x31')],function(_0x7263ea){return{'name':_0x7263ea[_0x0c8b('0x32')],'type':_0x7263ea['type'][_0x0c8b('0x33')]};});_0x320b34[_0x0c8b('0x34')]=_[_0x0c8b('0x2f')](_0x178581,_0x0c8b('0x2c'));_0x320b34[_0x0c8b('0x35')]=_[_0x0c8b('0x36')](_0x48da90[_0x0c8b('0x35')]);_0x320b34['filters']=_[_0x0c8b('0x37')](_0x320b34[_0x0c8b('0x34')],_0x320b34[_0x0c8b('0x35')]);_0x31bf70['attributes']=_['intersection'](_0x320b34[_0x0c8b('0x34')],qs[_0x0c8b('0x38')](_0x48da90[_0x0c8b('0x35')]['fields']));_0x31bf70[_0x0c8b('0x39')]=_0x31bf70[_0x0c8b('0x39')][_0x0c8b('0x3a')]?_0x31bf70[_0x0c8b('0x39')]:_0x320b34[_0x0c8b('0x34')];if(!_0x48da90['query'][_0x0c8b('0x3b')](_0x0c8b('0x3c'))){_0x31bf70[_0x0c8b('0x1f')]=qs[_0x0c8b('0x1f')](_0x48da90[_0x0c8b('0x35')][_0x0c8b('0x1f')]);_0x31bf70[_0x0c8b('0x1d')]=qs['offset'](_0x48da90[_0x0c8b('0x35')]['offset']);}_0x31bf70[_0x0c8b('0x3d')]=qs[_0x0c8b('0x3e')](_0x48da90[_0x0c8b('0x35')][_0x0c8b('0x3e')]);_0x31bf70[_0x0c8b('0x3f')]=qs[_0x0c8b('0x40')](_[_0x0c8b('0x41')](_0x48da90[_0x0c8b('0x35')],_0x320b34[_0x0c8b('0x40')]),_0x178581);if(_0x48da90['query'][_0x0c8b('0x42')]){_0x31bf70[_0x0c8b('0x3f')]=_[_0x0c8b('0x43')](_0x31bf70[_0x0c8b('0x3f')],{'$or':_[_0x0c8b('0x2f')](_0x178581,function(_0x2e3822){if(_0x2e3822[_0x0c8b('0x44')]!==_0x0c8b('0x45')){var _0x5de95e={};_0x5de95e[_0x2e3822[_0x0c8b('0x2c')]]={'$like':'%'+_0x48da90['query'][_0x0c8b('0x42')]+'%'};return _0x5de95e;}})});}_0x31bf70=_[_0x0c8b('0x43')]({},_0x31bf70,_0x48da90['options']);var _0x18a67f={'where':_0x31bf70[_0x0c8b('0x3f')]};return db[_0x0c8b('0x30')][_0x0c8b('0x20')](_0x18a67f)['then'](function(_0x4499d7){_0x26146d[_0x0c8b('0x20')]=_0x4499d7;if(_0x48da90[_0x0c8b('0x35')][_0x0c8b('0x46')]){_0x31bf70['include']=[{'all':!![]}];}return db[_0x0c8b('0x30')]['findAll'](_0x31bf70);})[_0x0c8b('0x28')](function(_0x5c2f8c){_0x26146d[_0x0c8b('0x47')]=_0x5c2f8c;return _0x26146d;})[_0x0c8b('0x28')](respondWithFilteredResult(_0x27be84,_0x31bf70))['catch'](handleError(_0x27be84,null));};exports[_0x0c8b('0x48')]=function(_0x3de2bc,_0xb3e8d){var _0x299de1={'raw':![],'where':{'id':_0x3de2bc[_0x0c8b('0x49')]['id']}},_0x17dfcd={};_0x17dfcd[_0x0c8b('0x34')]=_[_0x0c8b('0x36')](db[_0x0c8b('0x30')][_0x0c8b('0x31')]);_0x17dfcd[_0x0c8b('0x35')]=_[_0x0c8b('0x36')](_0x3de2bc[_0x0c8b('0x35')]);_0x17dfcd['filters']=_[_0x0c8b('0x37')](_0x17dfcd[_0x0c8b('0x34')],_0x17dfcd[_0x0c8b('0x35')]);_0x299de1[_0x0c8b('0x39')]=_['intersection'](_0x17dfcd[_0x0c8b('0x34')],qs[_0x0c8b('0x38')](_0x3de2bc['query']['fields']));_0x299de1[_0x0c8b('0x39')]=_0x299de1[_0x0c8b('0x39')][_0x0c8b('0x3a')]?_0x299de1['attributes']:_0x17dfcd['model'];if(_0x3de2bc[_0x0c8b('0x35')]['includeAll']){_0x299de1['include']=[{'all':!![]}];}_0x299de1=_[_0x0c8b('0x43')]({},_0x299de1,_0x3de2bc[_0x0c8b('0x4a')]);return db[_0x0c8b('0x30')][_0x0c8b('0x4b')](_0x299de1)[_0x0c8b('0x28')](handleEntityNotFound(_0xb3e8d,null))[_0x0c8b('0x28')](respondWithResult(_0xb3e8d,null))['catch'](handleError(_0xb3e8d,null));};exports[_0x0c8b('0x4c')]=function(_0x3feeba,_0x3f2e5c){return db[_0x0c8b('0x30')][_0x0c8b('0x4c')](_0x3feeba[_0x0c8b('0x4d')],{})[_0x0c8b('0x28')](respondWithResult(_0x3f2e5c,0xc9))['catch'](handleError(_0x3f2e5c,null));};exports['update']=function(_0x33e8f9,_0x3d497c){if(_0x33e8f9[_0x0c8b('0x4d')]['id']){delete _0x33e8f9['body']['id'];}return db[_0x0c8b('0x30')]['find']({'where':{'id':_0x33e8f9['params']['id']}})[_0x0c8b('0x28')](handleEntityNotFound(_0x3d497c,null))[_0x0c8b('0x28')](saveUpdates(_0x33e8f9[_0x0c8b('0x4d')],null))[_0x0c8b('0x28')](respondWithResult(_0x3d497c,null))['catch'](handleError(_0x3d497c,null));};exports[_0x0c8b('0x27')]=function(_0x20d988,_0x4f296a){return db[_0x0c8b('0x30')][_0x0c8b('0x4b')]({'where':{'id':_0x20d988[_0x0c8b('0x49')]['id']}})[_0x0c8b('0x28')](handleEntityNotFound(_0x4f296a,null))[_0x0c8b('0x28')](removeEntity(_0x4f296a,null))[_0x0c8b('0x4e')](handleError(_0x4f296a,null));};exports[_0x0c8b('0x4f')]=function(_0x47f54f,_0x525c6e,_0x41fa21){var _0x52820d={};var _0x13bbde={};var _0x586326;var _0x5efbb0;return db[_0x0c8b('0x30')][_0x0c8b('0x50')]({'where':{'id':_0x47f54f['params']['id']}})[_0x0c8b('0x28')](handleEntityNotFound(_0x525c6e,null))[_0x0c8b('0x28')](function(_0x236f6f){if(_0x236f6f){_0x586326=_0x236f6f;_0x13bbde[_0x0c8b('0x34')]=_[_0x0c8b('0x36')](db['SalesforceField'][_0x0c8b('0x31')]);_0x13bbde[_0x0c8b('0x35')]=_['keys'](_0x47f54f[_0x0c8b('0x35')]);_0x13bbde[_0x0c8b('0x40')]=_[_0x0c8b('0x37')](_0x13bbde[_0x0c8b('0x34')],_0x13bbde[_0x0c8b('0x35')]);_0x52820d[_0x0c8b('0x39')]=_['intersection'](_0x13bbde[_0x0c8b('0x34')],qs['fields'](_0x47f54f[_0x0c8b('0x35')]['fields']));_0x52820d[_0x0c8b('0x39')]=_0x52820d[_0x0c8b('0x39')]['length']?_0x52820d['attributes']:_0x13bbde[_0x0c8b('0x34')];_0x52820d[_0x0c8b('0x3d')]=qs[_0x0c8b('0x3e')](_0x47f54f[_0x0c8b('0x35')][_0x0c8b('0x3e')]);_0x52820d['where']=qs[_0x0c8b('0x40')](_[_0x0c8b('0x41')](_0x47f54f[_0x0c8b('0x35')],_0x13bbde[_0x0c8b('0x40')]));if(_0x47f54f['query']['filter']){_0x52820d[_0x0c8b('0x3f')]=_[_0x0c8b('0x43')](_0x52820d[_0x0c8b('0x3f')],{'$or':_[_0x0c8b('0x2f')](_0x52820d[_0x0c8b('0x39')],function(_0x4f4e22){var _0x5ef378={};_0x5ef378[_0x4f4e22]={'$like':'%'+_0x47f54f[_0x0c8b('0x35')][_0x0c8b('0x42')]+'%'};return _0x5ef378;})});}_0x52820d=_['merge']({},_0x52820d,_0x47f54f[_0x0c8b('0x4a')]);return _0x586326['getFields'](_0x52820d);}})[_0x0c8b('0x28')](function(_0xaad1e5){if(_0xaad1e5){_0x5efbb0=_0xaad1e5[_0x0c8b('0x3a')];if(!_0x47f54f[_0x0c8b('0x35')]['hasOwnProperty'](_0x0c8b('0x3c'))){_0x52820d[_0x0c8b('0x1f')]=qs[_0x0c8b('0x1f')](_0x47f54f[_0x0c8b('0x35')][_0x0c8b('0x1f')]);_0x52820d[_0x0c8b('0x1d')]=qs['offset'](_0x47f54f[_0x0c8b('0x35')][_0x0c8b('0x1d')]);}return _0x586326[_0x0c8b('0x4f')](_0x52820d);}})[_0x0c8b('0x28')](function(_0x2bb518){if(_0x2bb518){return _0x2bb518?{'count':_0x5efbb0,'rows':_0x2bb518}:null;}})[_0x0c8b('0x28')](respondWithResult(_0x525c6e,null))[_0x0c8b('0x4e')](handleError(_0x525c6e,null));};exports[_0x0c8b('0x51')]=function(_0x102337,_0x5c13cb,_0x5df021){var _0x250c46={};var _0x11c511={};var _0x1326a0;var _0x462e99;return db[_0x0c8b('0x30')][_0x0c8b('0x50')]({'where':{'id':_0x102337[_0x0c8b('0x49')]['id']}})[_0x0c8b('0x28')](handleEntityNotFound(_0x5c13cb,null))[_0x0c8b('0x28')](function(_0x19e8fd){if(_0x19e8fd){_0x1326a0=_0x19e8fd;_0x11c511['model']=_['keys'](db[_0x0c8b('0x52')]['rawAttributes']);_0x11c511['query']=_[_0x0c8b('0x36')](_0x102337[_0x0c8b('0x35')]);_0x11c511[_0x0c8b('0x40')]=_[_0x0c8b('0x37')](_0x11c511[_0x0c8b('0x34')],_0x11c511[_0x0c8b('0x35')]);_0x250c46[_0x0c8b('0x39')]=_[_0x0c8b('0x37')](_0x11c511[_0x0c8b('0x34')],qs['fields'](_0x102337[_0x0c8b('0x35')][_0x0c8b('0x38')]));_0x250c46['attributes']=_0x250c46[_0x0c8b('0x39')][_0x0c8b('0x3a')]?_0x250c46[_0x0c8b('0x39')]:_0x11c511[_0x0c8b('0x34')];_0x250c46[_0x0c8b('0x3d')]=qs['sort'](_0x102337['query'][_0x0c8b('0x3e')]);_0x250c46[_0x0c8b('0x3f')]=qs['filters'](_[_0x0c8b('0x41')](_0x102337[_0x0c8b('0x35')],_0x11c511['filters']));if(_0x102337[_0x0c8b('0x35')]['filter']){_0x250c46[_0x0c8b('0x3f')]=_[_0x0c8b('0x43')](_0x250c46[_0x0c8b('0x3f')],{'$or':_[_0x0c8b('0x2f')](_0x250c46[_0x0c8b('0x39')],function(_0x39c74a){var _0x2ab067={};_0x2ab067[_0x39c74a]={'$like':'%'+_0x102337[_0x0c8b('0x35')]['filter']+'%'};return _0x2ab067;})});}_0x250c46=_[_0x0c8b('0x43')]({},_0x250c46,_0x102337[_0x0c8b('0x4a')]);return _0x1326a0[_0x0c8b('0x51')](_0x250c46);}})['then'](function(_0x307603){if(_0x307603){_0x462e99=_0x307603[_0x0c8b('0x3a')];if(!_0x102337[_0x0c8b('0x35')]['hasOwnProperty']('nolimit')){_0x250c46[_0x0c8b('0x1f')]=qs[_0x0c8b('0x1f')](_0x102337['query'][_0x0c8b('0x1f')]);_0x250c46[_0x0c8b('0x1d')]=qs[_0x0c8b('0x1d')](_0x102337[_0x0c8b('0x35')]['offset']);}return _0x1326a0[_0x0c8b('0x51')](_0x250c46);}})[_0x0c8b('0x28')](function(_0x299cc2){if(_0x299cc2){return _0x299cc2?{'count':_0x462e99,'rows':_0x299cc2}:null;}})[_0x0c8b('0x28')](respondWithResult(_0x5c13cb,null))['catch'](handleError(_0x5c13cb,null));};exports[_0x0c8b('0x53')]=function(_0x5ef022,_0x4b15b4,_0x53a8b1){var _0x267892={};var _0x26c8cb={};var _0x29d6f7;var _0x59df76;return db[_0x0c8b('0x30')][_0x0c8b('0x50')]({'where':{'id':_0x5ef022['params']['id']}})['then'](handleEntityNotFound(_0x4b15b4,null))[_0x0c8b('0x28')](function(_0x15a184){if(_0x15a184){_0x29d6f7=_0x15a184;_0x26c8cb[_0x0c8b('0x34')]=_[_0x0c8b('0x36')](db['SalesforceField'][_0x0c8b('0x31')]);_0x26c8cb[_0x0c8b('0x35')]=_[_0x0c8b('0x36')](_0x5ef022[_0x0c8b('0x35')]);_0x26c8cb[_0x0c8b('0x40')]=_[_0x0c8b('0x37')](_0x26c8cb[_0x0c8b('0x34')],_0x26c8cb[_0x0c8b('0x35')]);_0x267892[_0x0c8b('0x39')]=_[_0x0c8b('0x37')](_0x26c8cb[_0x0c8b('0x34')],qs[_0x0c8b('0x38')](_0x5ef022[_0x0c8b('0x35')][_0x0c8b('0x38')]));_0x267892['attributes']=_0x267892[_0x0c8b('0x39')]['length']?_0x267892['attributes']:_0x26c8cb['model'];_0x267892[_0x0c8b('0x3d')]=qs[_0x0c8b('0x3e')](_0x5ef022[_0x0c8b('0x35')]['sort']);_0x267892[_0x0c8b('0x3f')]=qs['filters'](_[_0x0c8b('0x41')](_0x5ef022[_0x0c8b('0x35')],_0x26c8cb[_0x0c8b('0x40')]));if(_0x5ef022[_0x0c8b('0x35')]['filter']){_0x267892['where']=_[_0x0c8b('0x43')](_0x267892[_0x0c8b('0x3f')],{'$or':_['map'](_0x267892['attributes'],function(_0xc2e8fe){var _0x21d3ea={};_0x21d3ea[_0xc2e8fe]={'$like':'%'+_0x5ef022['query'][_0x0c8b('0x42')]+'%'};return _0x21d3ea;})});}_0x267892=_[_0x0c8b('0x43')]({},_0x267892,_0x5ef022['options']);return _0x29d6f7[_0x0c8b('0x53')](_0x267892);}})['then'](function(_0x46a972){if(_0x46a972){_0x59df76=_0x46a972[_0x0c8b('0x3a')];if(!_0x5ef022[_0x0c8b('0x35')][_0x0c8b('0x3b')](_0x0c8b('0x3c'))){_0x267892[_0x0c8b('0x1f')]=qs[_0x0c8b('0x1f')](_0x5ef022[_0x0c8b('0x35')]['limit']);_0x267892[_0x0c8b('0x1d')]=qs[_0x0c8b('0x1d')](_0x5ef022[_0x0c8b('0x35')][_0x0c8b('0x1d')]);}return _0x29d6f7['getDescriptions'](_0x267892);}})[_0x0c8b('0x28')](function(_0x42392e){if(_0x42392e){return _0x42392e?{'count':_0x59df76,'rows':_0x42392e}:null;}})[_0x0c8b('0x28')](respondWithResult(_0x4b15b4,null))[_0x0c8b('0x4e')](handleError(_0x4b15b4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 01ef96a..c123996 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 _0x9d26=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d26,0x90));var _0x69d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x69d2('0x0'));var logger=require(_0x69d2('0x1'))(_0x69d2('0x2'));var moment=require(_0x69d2('0x3'));var BPromise=require(_0x69d2('0x4'));var rp=require(_0x69d2('0x5'));var fs=require('fs');var path=require(_0x69d2('0x6'));var rimraf=require(_0x69d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x69d2('0x8'));module[_0x69d2('0x9')]=function(_0x2b5215,_0x527c3f){return _0x2b5215[_0x69d2('0xa')](_0x69d2('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbafe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x3d95f8,_0x1089de){var _0x512cd6=function(_0x2c5f23){while(--_0x2c5f23){_0x3d95f8['push'](_0x3d95f8['shift']());}};_0x512cd6(++_0x1089de);}(_0xbafe,0x7b));var _0xebaf=function(_0x3db92c,_0x3a3d83){_0x3db92c=_0x3db92c-0x0;var _0x3a36f1=_0xbafe[_0x3db92c];return _0x3a36f1;};'use strict';var _=require(_0xebaf('0x0'));var util=require(_0xebaf('0x1'));var logger=require(_0xebaf('0x2'))('api');var moment=require(_0xebaf('0x3'));var BPromise=require(_0xebaf('0x4'));var rp=require(_0xebaf('0x5'));var fs=require('fs');var path=require(_0xebaf('0x6'));var rimraf=require(_0xebaf('0x7'));var config=require(_0xebaf('0x8'));var attributes=require(_0xebaf('0x9'));module[_0xebaf('0xa')]=function(_0x34f75a,_0x3dc9a3){return _0x34f75a[_0xebaf('0xb')](_0xebaf('0xc'),attributes,{'tableName':_0xebaf('0xd'),'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 fd98eda..228ba00 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 _0x19de=['moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x28674e,_0x9f7357){var _0x1155ef=function(_0x220a9b){while(--_0x220a9b){_0x28674e['push'](_0x28674e['shift']());}};_0x1155ef(++_0x9f7357);}(_0x19de,0x15e));var _0xe19d=function(_0x21a824,_0x52a16f){_0x21a824=_0x21a824-0x0;var _0x1b1fb6=_0x19de[_0x21a824];return _0x1b1fb6;};'use strict';var _=require(_0xe19d('0x0'));var util=require(_0xe19d('0x1'));var moment=require(_0xe19d('0x2'));var BPromise=require('bluebird');var rs=require(_0xe19d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe19d('0x4'))['db'];var utils=require(_0xe19d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe19d('0x6'));var jayson=require(_0xe19d('0x7'));var client=jayson['client'][_0xe19d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1186dc,_0x1f568c,_0x24b75c){return new BPromise(function(_0x1dd3c8,_0x3b95eb){return client[_0xe19d('0x9')](_0x1186dc,_0x24b75c)[_0xe19d('0xa')](function(_0x45ea32){logger[_0xe19d('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f568c,_0xe19d('0xc'));logger[_0xe19d('0xd')](_0xe19d('0xe'),_0x1f568c,_0xe19d('0xc'),JSON[_0xe19d('0xf')](_0x45ea32));if(_0x45ea32[_0xe19d('0x10')]){if(_0x45ea32[_0xe19d('0x10')][_0xe19d('0x11')]===0x1f4){logger[_0xe19d('0x10')](_0xe19d('0x12'),_0x1f568c,_0x45ea32['error'][_0xe19d('0x13')]);return _0x3b95eb(_0x45ea32[_0xe19d('0x10')][_0xe19d('0x13')]);}logger[_0xe19d('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f568c,_0x45ea32[_0xe19d('0x10')][_0xe19d('0x13')]);return _0x1dd3c8(_0x45ea32[_0xe19d('0x10')][_0xe19d('0x13')]);}else{logger[_0xe19d('0xb')](_0xe19d('0x12'),_0x1f568c,_0xe19d('0xc'));_0x1dd3c8(_0x45ea32[_0xe19d('0x14')]['message']);}})[_0xe19d('0x15')](function(_0x6f6183){logger['error'](_0xe19d('0x12'),_0x1f568c,_0x6f6183);_0x3b95eb(_0x6f6183);});});} \ No newline at end of file +var _0x8a89=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x40c120,_0x945e7a){var _0xe9f0d=function(_0x40c637){while(--_0x40c637){_0x40c120['push'](_0x40c120['shift']());}};_0xe9f0d(++_0x945e7a);}(_0x8a89,0xf7));var _0x98a8=function(_0x1b2748,_0x4b3ad2){_0x1b2748=_0x1b2748-0x0;var _0x18fe11=_0x8a89[_0x1b2748];return _0x18fe11;};'use strict';var _=require(_0x98a8('0x0'));var util=require(_0x98a8('0x1'));var moment=require(_0x98a8('0x2'));var BPromise=require(_0x98a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x98a8('0x5'))(_0x98a8('0x6'));var config=require(_0x98a8('0x7'));var jayson=require(_0x98a8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x251703,_0x3d763f,_0xe3e42d){return new BPromise(function(_0xfdb3bb,_0x554e42){return client[_0x98a8('0x9')](_0x251703,_0xe3e42d)[_0x98a8('0xa')](function(_0x1b298a){logger[_0x98a8('0xb')](_0x98a8('0xc'),_0x3d763f,_0x98a8('0xd'));logger[_0x98a8('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3d763f,_0x98a8('0xd'),JSON[_0x98a8('0xf')](_0x1b298a));if(_0x1b298a[_0x98a8('0x10')]){if(_0x1b298a['error'][_0x98a8('0x11')]===0x1f4){logger[_0x98a8('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3d763f,_0x1b298a[_0x98a8('0x10')]['message']);return _0x554e42(_0x1b298a['error']['message']);}logger[_0x98a8('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3d763f,_0x1b298a[_0x98a8('0x10')][_0x98a8('0x12')]);return _0xfdb3bb(_0x1b298a[_0x98a8('0x10')]['message']);}else{logger[_0x98a8('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3d763f,'request\x20sent');_0xfdb3bb(_0x1b298a[_0x98a8('0x13')][_0x98a8('0x12')]);}})[_0x98a8('0x14')](function(_0xed7da3){logger[_0x98a8('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3d763f,_0xed7da3);_0x554e42(_0xed7da3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4f48bd0..ce12c6e 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 _0xf468=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0xd37c93,_0x2b8d06){var _0x1ff20e=function(_0x1a99f5){while(--_0x1a99f5){_0xd37c93['push'](_0xd37c93['shift']());}};_0x1ff20e(++_0x2b8d06);}(_0xf468,0xfe));var _0x8f46=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xf468[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x8f46('0x0'));var util=require('util');var path=require(_0x8f46('0x1'));var timeout=require(_0x8f46('0x2'));var express=require(_0x8f46('0x3'));var router=express[_0x8f46('0x4')]();var fs_extra=require(_0x8f46('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8f46('0x6'));var config=require(_0x8f46('0x7'));var controller=require(_0x8f46('0x8'));router['get']('/',auth[_0x8f46('0x9')](),controller[_0x8f46('0xa')]);router[_0x8f46('0xb')](_0x8f46('0xc'),auth[_0x8f46('0x9')](),controller[_0x8f46('0xd')]);router[_0x8f46('0xe')]('/',auth[_0x8f46('0x9')](),controller[_0x8f46('0xf')]);router[_0x8f46('0x10')](_0x8f46('0xc'),auth[_0x8f46('0x9')](),controller[_0x8f46('0x11')]);router[_0x8f46('0x12')](_0x8f46('0xc'),auth['isAuthenticated'](),controller[_0x8f46('0x13')]);module[_0x8f46('0x14')]=router; \ No newline at end of file +var _0xdc2f=['isAuthenticated','get','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc2f,0x6f));var _0xfdc2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdc2f[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xfdc2('0x0'));var util=require(_0xfdc2('0x1'));var path=require('path');var timeout=require(_0xfdc2('0x2'));var express=require(_0xfdc2('0x3'));var router=express[_0xfdc2('0x4')]();var fs_extra=require(_0xfdc2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfdc2('0x6'));var config=require(_0xfdc2('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0xfdc2('0x8')](),controller['index']);router[_0xfdc2('0x9')](_0xfdc2('0xa'),auth[_0xfdc2('0x8')](),controller[_0xfdc2('0xb')]);router[_0xfdc2('0xc')]('/',auth[_0xfdc2('0x8')](),controller[_0xfdc2('0xd')]);router[_0xfdc2('0xe')](_0xfdc2('0xa'),auth[_0xfdc2('0x8')](),controller['update']);router[_0xfdc2('0xf')](_0xfdc2('0xa'),auth[_0xfdc2('0x8')](),controller['destroy']);module[_0xfdc2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 56bc15c..9461417 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 _0x44e6=['ENUM','string','variable','STRING','customVariable','exports'];(function(_0x344bcc,_0x51152b){var _0x1b489a=function(_0x59869c){while(--_0x59869c){_0x344bcc['push'](_0x344bcc['shift']());}};_0x1b489a(++_0x51152b);}(_0x44e6,0xa7));var _0x644e=function(_0x2d5f95,_0x9c14a5){_0x2d5f95=_0x2d5f95-0x0;var _0x41b67e=_0x44e6[_0x2d5f95];return _0x41b67e;};'use strict';var Sequelize=require('sequelize');module[_0x644e('0x0')]={'type':{'type':Sequelize[_0x644e('0x1')](_0x644e('0x2'),_0x644e('0x3'),'customVariable','keyValue','picklist'),'defaultValue':_0x644e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x644e('0x4')]},'keyType':{'type':Sequelize[_0x644e('0x1')](_0x644e('0x2'),_0x644e('0x3'),_0x644e('0x5'))},'keyContent':{'type':Sequelize[_0x644e('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc2ca=['exports','ENUM','variable','customVariable','keyValue','string','STRING','sequelize'];(function(_0x149f64,_0x5438e4){var _0x5da58c=function(_0x4650ec){while(--_0x4650ec){_0x149f64['push'](_0x149f64['shift']());}};_0x5da58c(++_0x5438e4);}(_0xc2ca,0x15f));var _0xac2c=function(_0x21bef5,_0x27b94a){_0x21bef5=_0x21bef5-0x0;var _0x524300=_0xc2ca[_0x21bef5];return _0x524300;};'use strict';var Sequelize=require(_0xac2c('0x0'));module[_0xac2c('0x1')]={'type':{'type':Sequelize[_0xac2c('0x2')]('string',_0xac2c('0x3'),_0xac2c('0x4'),_0xac2c('0x5'),'picklist'),'defaultValue':_0xac2c('0x6')},'content':{'type':Sequelize[_0xac2c('0x7')]},'key':{'type':Sequelize[_0xac2c('0x7')]},'keyType':{'type':Sequelize[_0xac2c('0x2')](_0xac2c('0x6'),_0xac2c('0x3'),_0xac2c('0x4'))},'keyContent':{'type':Sequelize[_0xac2c('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xac2c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 01458d3..7d79e12 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 _0xf4b4=['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/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','params','SalesforceField','keys','include','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5e9b8f,_0x31aa85){var _0xfbda62=function(_0xc9e587){while(--_0xc9e587){_0x5e9b8f['push'](_0x5e9b8f['shift']());}};_0xfbda62(++_0x31aa85);}(_0xf4b4,0x92));var _0x4f4b=function(_0x1777e4,_0x38b4f8){_0x1777e4=_0x1777e4-0x0;var _0x21ecac=_0xf4b4[_0x1777e4];return _0x21ecac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f4b('0x0'));var zipdir=require(_0x4f4b('0x1'));var jsonpatch=require(_0x4f4b('0x2'));var rp=require(_0x4f4b('0x3'));var moment=require(_0x4f4b('0x4'));var BPromise=require(_0x4f4b('0x5'));var Mustache=require(_0x4f4b('0x6'));var util=require('util');var path=require(_0x4f4b('0x7'));var sox=require('sox');var csv=require(_0x4f4b('0x8'));var ejs=require(_0x4f4b('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4b('0xa'));var _=require(_0x4f4b('0xb'));var squel=require(_0x4f4b('0xc'));var crypto=require(_0x4f4b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4f4b('0xe'));var toCsv=require(_0x4f4b('0x8'));var querystring=require(_0x4f4b('0xf'));var Papa=require(_0x4f4b('0x10'));var Redis=require(_0x4f4b('0x11'));var authService=require(_0x4f4b('0x12'));var qs=require(_0x4f4b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f4b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4f4b('0x15'));var licenseUtil=require(_0x4f4b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47e94b,_0x2f654b){_0x2f654b=_0x2f654b||0xcc;return function(_0x5a15c8){if(_0x5a15c8){return _0x47e94b[_0x4f4b('0x17')](_0x2f654b);}return _0x47e94b['status'](_0x2f654b)[_0x4f4b('0x18')]();};}function respondWithResult(_0x2d6c25,_0x261631){_0x261631=_0x261631||0xc8;return function(_0xfcfbdb){if(_0xfcfbdb){return _0x2d6c25['status'](_0x261631)[_0x4f4b('0x19')](_0xfcfbdb);}};}function respondWithFilteredResult(_0x29a823,_0x33447a){return function(_0x35e2be){if(_0x35e2be){var _0x13e25d=typeof _0x33447a['offset']===_0x4f4b('0x1a')&&typeof _0x33447a[_0x4f4b('0x1b')]==='undefined';var _0xf8c5af=_0x35e2be[_0x4f4b('0x1c')];var _0x180876=_0x13e25d?0x0:_0x33447a['offset'];var _0x36dc8a=_0x13e25d?_0x35e2be[_0x4f4b('0x1c')]:_0x33447a[_0x4f4b('0x1d')]+_0x33447a['limit'];var _0x3bea57;if(_0x36dc8a>=_0xf8c5af){_0x36dc8a=_0xf8c5af;_0x3bea57=0xc8;}else{_0x3bea57=0xce;}_0x29a823[_0x4f4b('0x1e')](_0x3bea57);return _0x29a823[_0x4f4b('0x1f')](_0x4f4b('0x20'),_0x180876+'-'+_0x36dc8a+'/'+_0xf8c5af)[_0x4f4b('0x19')](_0x35e2be);}return null;};}function patchUpdates(_0x8293f0){return function(_0x56df63){try{jsonpatch[_0x4f4b('0x21')](_0x56df63,_0x8293f0,!![]);}catch(_0x4db0ef){return BPromise[_0x4f4b('0x22')](_0x4db0ef);}return _0x56df63[_0x4f4b('0x23')]();};}function saveUpdates(_0x8b8312,_0x534e58){return function(_0x46ba30){if(_0x46ba30){return _0x46ba30[_0x4f4b('0x24')](_0x8b8312)[_0x4f4b('0x25')](function(_0x3db957){return _0x3db957;});}return null;};}function removeEntity(_0x1aa4d8,_0x3d5537){return function(_0x4e9264){if(_0x4e9264){return _0x4e9264[_0x4f4b('0x26')]()[_0x4f4b('0x25')](function(){_0x1aa4d8[_0x4f4b('0x1e')](0xcc)[_0x4f4b('0x18')]();});}};}function handleEntityNotFound(_0x37c888,_0x2e797b){return function(_0x24609f){if(!_0x24609f){_0x37c888['sendStatus'](0x194);}return _0x24609f;};}function handleError(_0x5df64a,_0x2247a3){_0x2247a3=_0x2247a3||0x1f4;return function(_0xa9eb93){logger[_0x4f4b('0x27')](_0xa9eb93[_0x4f4b('0x28')]);if(_0xa9eb93[_0x4f4b('0x29')]){delete _0xa9eb93[_0x4f4b('0x29')];}_0x5df64a[_0x4f4b('0x1e')](_0x2247a3)[_0x4f4b('0x2a')](_0xa9eb93);};}exports['index']=function(_0x4b030a,_0x23865a){var _0xd56c77={},_0x55a8fe={},_0x79da95={'count':0x0,'rows':[]};var _0x1043fa=_[_0x4f4b('0x2b')](db['SalesforceField'][_0x4f4b('0x2c')],function(_0x371375){return{'name':_0x371375[_0x4f4b('0x2d')],'type':_0x371375['type'][_0x4f4b('0x2e')]};});_0x55a8fe[_0x4f4b('0x2f')]=_[_0x4f4b('0x2b')](_0x1043fa,_0x4f4b('0x29'));_0x55a8fe[_0x4f4b('0x30')]=_['keys'](_0x4b030a[_0x4f4b('0x30')]);_0x55a8fe['filters']=_[_0x4f4b('0x31')](_0x55a8fe['model'],_0x55a8fe[_0x4f4b('0x30')]);_0xd56c77['attributes']=_[_0x4f4b('0x31')](_0x55a8fe[_0x4f4b('0x2f')],qs[_0x4f4b('0x32')](_0x4b030a[_0x4f4b('0x30')]['fields']));_0xd56c77[_0x4f4b('0x33')]=_0xd56c77[_0x4f4b('0x33')][_0x4f4b('0x34')]?_0xd56c77['attributes']:_0x55a8fe[_0x4f4b('0x2f')];if(!_0x4b030a['query'][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0xd56c77['limit']=qs['limit'](_0x4b030a[_0x4f4b('0x30')]['limit']);_0xd56c77[_0x4f4b('0x1d')]=qs[_0x4f4b('0x1d')](_0x4b030a['query']['offset']);}_0xd56c77[_0x4f4b('0x37')]=qs[_0x4f4b('0x38')](_0x4b030a['query']['sort']);_0xd56c77[_0x4f4b('0x39')]=qs[_0x4f4b('0x3a')](_[_0x4f4b('0x3b')](_0x4b030a[_0x4f4b('0x30')],_0x55a8fe[_0x4f4b('0x3a')]),_0x1043fa);if(_0x4b030a['query'][_0x4f4b('0x3c')]){_0xd56c77[_0x4f4b('0x39')]=_[_0x4f4b('0x3d')](_0xd56c77[_0x4f4b('0x39')],{'$or':_[_0x4f4b('0x2b')](_0x1043fa,function(_0x8496c8){if(_0x8496c8[_0x4f4b('0x3e')]!==_0x4f4b('0x3f')){var _0x227490={};_0x227490[_0x8496c8[_0x4f4b('0x29')]]={'$like':'%'+_0x4b030a['query']['filter']+'%'};return _0x227490;}})});}_0xd56c77=_[_0x4f4b('0x3d')]({},_0xd56c77,_0x4b030a['options']);var _0x1a6af7={'where':_0xd56c77[_0x4f4b('0x39')]};return db['SalesforceField'][_0x4f4b('0x1c')](_0x1a6af7)[_0x4f4b('0x25')](function(_0x47a2ab){_0x79da95[_0x4f4b('0x1c')]=_0x47a2ab;if(_0x4b030a[_0x4f4b('0x30')][_0x4f4b('0x40')]){_0xd56c77['include']=[{'all':!![]}];}return db['SalesforceField'][_0x4f4b('0x41')](_0xd56c77);})[_0x4f4b('0x25')](function(_0x29e180){_0x79da95[_0x4f4b('0x42')]=_0x29e180;return _0x79da95;})[_0x4f4b('0x25')](respondWithFilteredResult(_0x23865a,_0xd56c77))['catch'](handleError(_0x23865a,null));};exports['show']=function(_0xe0fa76,_0x294bef){var _0xf8f58a={'raw':!![],'where':{'id':_0xe0fa76[_0x4f4b('0x43')]['id']}},_0x21e8a6={};_0x21e8a6['model']=_['keys'](db[_0x4f4b('0x44')][_0x4f4b('0x2c')]);_0x21e8a6['query']=_[_0x4f4b('0x45')](_0xe0fa76[_0x4f4b('0x30')]);_0x21e8a6['filters']=_[_0x4f4b('0x31')](_0x21e8a6[_0x4f4b('0x2f')],_0x21e8a6[_0x4f4b('0x30')]);_0xf8f58a['attributes']=_[_0x4f4b('0x31')](_0x21e8a6[_0x4f4b('0x2f')],qs['fields'](_0xe0fa76['query'][_0x4f4b('0x32')]));_0xf8f58a[_0x4f4b('0x33')]=_0xf8f58a[_0x4f4b('0x33')][_0x4f4b('0x34')]?_0xf8f58a['attributes']:_0x21e8a6['model'];if(_0xe0fa76[_0x4f4b('0x30')][_0x4f4b('0x40')]){_0xf8f58a[_0x4f4b('0x46')]=[{'all':!![]}];}_0xf8f58a=_[_0x4f4b('0x3d')]({},_0xf8f58a,_0xe0fa76[_0x4f4b('0x47')]);return db[_0x4f4b('0x44')][_0x4f4b('0x48')](_0xf8f58a)[_0x4f4b('0x25')](handleEntityNotFound(_0x294bef,null))['then'](respondWithResult(_0x294bef,null))[_0x4f4b('0x49')](handleError(_0x294bef,null));};exports['create']=function(_0x164854,_0x4be367){return db['SalesforceField'][_0x4f4b('0x4a')](_0x164854[_0x4f4b('0x4b')],{})[_0x4f4b('0x25')](respondWithResult(_0x4be367,0xc9))[_0x4f4b('0x49')](handleError(_0x4be367,null));};exports['update']=function(_0x2740e3,_0x5258ed){if(_0x2740e3['body']['id']){delete _0x2740e3[_0x4f4b('0x4b')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x2740e3[_0x4f4b('0x43')]['id']}})[_0x4f4b('0x25')](handleEntityNotFound(_0x5258ed,null))[_0x4f4b('0x25')](saveUpdates(_0x2740e3['body'],null))[_0x4f4b('0x25')](respondWithResult(_0x5258ed,null))['catch'](handleError(_0x5258ed,null));};exports['destroy']=function(_0x56298c,_0x2b950b){return db[_0x4f4b('0x44')]['find']({'where':{'id':_0x56298c[_0x4f4b('0x43')]['id']}})[_0x4f4b('0x25')](handleEntityNotFound(_0x2b950b,null))['then'](removeEntity(_0x2b950b,null))[_0x4f4b('0x49')](handleError(_0x2b950b,null));}; \ No newline at end of file +var _0xb2f3=['includeAll','include','findAll','rows','catch','show','params','intersection','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x508c01,_0x243adf){var _0x4414a2=function(_0xc25331){while(--_0xc25331){_0x508c01['push'](_0x508c01['shift']());}};_0x4414a2(++_0x243adf);}(_0xb2f3,0x1d9));var _0x3b2f=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xb2f3[_0x1b6186];return _0x186121;};'use strict';var emlformat=require(_0x3b2f('0x0'));var rimraf=require(_0x3b2f('0x1'));var zipdir=require(_0x3b2f('0x2'));var jsonpatch=require(_0x3b2f('0x3'));var rp=require(_0x3b2f('0x4'));var moment=require(_0x3b2f('0x5'));var BPromise=require(_0x3b2f('0x6'));var Mustache=require(_0x3b2f('0x7'));var util=require('util');var path=require(_0x3b2f('0x8'));var sox=require(_0x3b2f('0x9'));var csv=require(_0x3b2f('0xa'));var ejs=require(_0x3b2f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b2f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b2f('0xd'));var deskjs=require(_0x3b2f('0xe'));var toCsv=require(_0x3b2f('0xa'));var querystring=require(_0x3b2f('0xf'));var Papa=require(_0x3b2f('0x10'));var Redis=require('ioredis');var authService=require(_0x3b2f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3b2f('0x12'));var hardwareService=require(_0x3b2f('0x13'));var logger=require('../../config/logger')(_0x3b2f('0x14'));var utils=require(_0x3b2f('0x15'));var config=require(_0x3b2f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b2f('0x17'))['db'];function respondWithStatusCode(_0x4410fe,_0x30a6d3){_0x30a6d3=_0x30a6d3||0xcc;return function(_0x3c89a0){if(_0x3c89a0){return _0x4410fe['sendStatus'](_0x30a6d3);}return _0x4410fe[_0x3b2f('0x18')](_0x30a6d3)[_0x3b2f('0x19')]();};}function respondWithResult(_0x23185c,_0x29f221){_0x29f221=_0x29f221||0xc8;return function(_0xfcdfd9){if(_0xfcdfd9){return _0x23185c[_0x3b2f('0x18')](_0x29f221)[_0x3b2f('0x1a')](_0xfcdfd9);}};}function respondWithFilteredResult(_0x18b1df,_0x48f1f3){return function(_0x545f9e){if(_0x545f9e){var _0x281817=typeof _0x48f1f3[_0x3b2f('0x1b')]===_0x3b2f('0x1c')&&typeof _0x48f1f3[_0x3b2f('0x1d')]==='undefined';var _0x2b98e8=_0x545f9e['count'];var _0x353337=_0x281817?0x0:_0x48f1f3[_0x3b2f('0x1b')];var _0x318676=_0x281817?_0x545f9e[_0x3b2f('0x1e')]:_0x48f1f3[_0x3b2f('0x1b')]+_0x48f1f3[_0x3b2f('0x1d')];var _0x1e5008;if(_0x318676>=_0x2b98e8){_0x318676=_0x2b98e8;_0x1e5008=0xc8;}else{_0x1e5008=0xce;}_0x18b1df[_0x3b2f('0x18')](_0x1e5008);return _0x18b1df[_0x3b2f('0x1f')](_0x3b2f('0x20'),_0x353337+'-'+_0x318676+'/'+_0x2b98e8)['json'](_0x545f9e);}return null;};}function patchUpdates(_0x8e1e0d){return function(_0x3df8c7){try{jsonpatch['apply'](_0x3df8c7,_0x8e1e0d,!![]);}catch(_0x5f162e){return BPromise[_0x3b2f('0x21')](_0x5f162e);}return _0x3df8c7[_0x3b2f('0x22')]();};}function saveUpdates(_0xa79b4a,_0x307a36){return function(_0x540463){if(_0x540463){return _0x540463[_0x3b2f('0x23')](_0xa79b4a)['then'](function(_0x14659a){return _0x14659a;});}return null;};}function removeEntity(_0x4970f0,_0x3f9d64){return function(_0x49bc19){if(_0x49bc19){return _0x49bc19[_0x3b2f('0x24')]()[_0x3b2f('0x25')](function(){_0x4970f0[_0x3b2f('0x18')](0xcc)[_0x3b2f('0x19')]();});}};}function handleEntityNotFound(_0x10035e,_0x296ccd){return function(_0x4c1e06){if(!_0x4c1e06){_0x10035e[_0x3b2f('0x26')](0x194);}return _0x4c1e06;};}function handleError(_0x2b6ed0,_0x5d15c4){_0x5d15c4=_0x5d15c4||0x1f4;return function(_0x3d3d7e){logger[_0x3b2f('0x27')](_0x3d3d7e[_0x3b2f('0x28')]);if(_0x3d3d7e['name']){delete _0x3d3d7e['name'];}_0x2b6ed0[_0x3b2f('0x18')](_0x5d15c4)[_0x3b2f('0x29')](_0x3d3d7e);};}exports[_0x3b2f('0x2a')]=function(_0x3ded8b,_0x1afa71){var _0x57c312={},_0x5ccd33={},_0x22acb5={'count':0x0,'rows':[]};var _0x1e8e6c=_[_0x3b2f('0x2b')](db[_0x3b2f('0x2c')][_0x3b2f('0x2d')],function(_0x45ee5b){return{'name':_0x45ee5b[_0x3b2f('0x2e')],'type':_0x45ee5b[_0x3b2f('0x2f')][_0x3b2f('0x30')]};});_0x5ccd33[_0x3b2f('0x31')]=_[_0x3b2f('0x2b')](_0x1e8e6c,_0x3b2f('0x32'));_0x5ccd33[_0x3b2f('0x33')]=_[_0x3b2f('0x34')](_0x3ded8b['query']);_0x5ccd33['filters']=_['intersection'](_0x5ccd33[_0x3b2f('0x31')],_0x5ccd33[_0x3b2f('0x33')]);_0x57c312[_0x3b2f('0x35')]=_['intersection'](_0x5ccd33[_0x3b2f('0x31')],qs[_0x3b2f('0x36')](_0x3ded8b[_0x3b2f('0x33')][_0x3b2f('0x36')]));_0x57c312[_0x3b2f('0x35')]=_0x57c312['attributes'][_0x3b2f('0x37')]?_0x57c312[_0x3b2f('0x35')]:_0x5ccd33[_0x3b2f('0x31')];if(!_0x3ded8b[_0x3b2f('0x33')][_0x3b2f('0x38')](_0x3b2f('0x39'))){_0x57c312[_0x3b2f('0x1d')]=qs['limit'](_0x3ded8b[_0x3b2f('0x33')][_0x3b2f('0x1d')]);_0x57c312[_0x3b2f('0x1b')]=qs[_0x3b2f('0x1b')](_0x3ded8b['query'][_0x3b2f('0x1b')]);}_0x57c312['order']=qs['sort'](_0x3ded8b[_0x3b2f('0x33')][_0x3b2f('0x3a')]);_0x57c312[_0x3b2f('0x3b')]=qs[_0x3b2f('0x3c')](_[_0x3b2f('0x3d')](_0x3ded8b[_0x3b2f('0x33')],_0x5ccd33[_0x3b2f('0x3c')]),_0x1e8e6c);if(_0x3ded8b['query'][_0x3b2f('0x3e')]){_0x57c312[_0x3b2f('0x3b')]=_[_0x3b2f('0x3f')](_0x57c312[_0x3b2f('0x3b')],{'$or':_[_0x3b2f('0x2b')](_0x1e8e6c,function(_0x32302a){if(_0x32302a['type']!==_0x3b2f('0x40')){var _0x397bf2={};_0x397bf2[_0x32302a[_0x3b2f('0x32')]]={'$like':'%'+_0x3ded8b[_0x3b2f('0x33')][_0x3b2f('0x3e')]+'%'};return _0x397bf2;}})});}_0x57c312=_[_0x3b2f('0x3f')]({},_0x57c312,_0x3ded8b[_0x3b2f('0x41')]);var _0x2b9c71={'where':_0x57c312[_0x3b2f('0x3b')]};return db[_0x3b2f('0x2c')][_0x3b2f('0x1e')](_0x2b9c71)[_0x3b2f('0x25')](function(_0x3b5c96){_0x22acb5[_0x3b2f('0x1e')]=_0x3b5c96;if(_0x3ded8b['query'][_0x3b2f('0x42')]){_0x57c312[_0x3b2f('0x43')]=[{'all':!![]}];}return db[_0x3b2f('0x2c')][_0x3b2f('0x44')](_0x57c312);})[_0x3b2f('0x25')](function(_0x2ecbf9){_0x22acb5[_0x3b2f('0x45')]=_0x2ecbf9;return _0x22acb5;})[_0x3b2f('0x25')](respondWithFilteredResult(_0x1afa71,_0x57c312))[_0x3b2f('0x46')](handleError(_0x1afa71,null));};exports[_0x3b2f('0x47')]=function(_0x1bde13,_0x4e718d){var _0x1f0e05={'raw':!![],'where':{'id':_0x1bde13[_0x3b2f('0x48')]['id']}},_0x426b17={};_0x426b17[_0x3b2f('0x31')]=_['keys'](db['SalesforceField'][_0x3b2f('0x2d')]);_0x426b17[_0x3b2f('0x33')]=_[_0x3b2f('0x34')](_0x1bde13[_0x3b2f('0x33')]);_0x426b17[_0x3b2f('0x3c')]=_[_0x3b2f('0x49')](_0x426b17['model'],_0x426b17[_0x3b2f('0x33')]);_0x1f0e05[_0x3b2f('0x35')]=_['intersection'](_0x426b17[_0x3b2f('0x31')],qs[_0x3b2f('0x36')](_0x1bde13['query'][_0x3b2f('0x36')]));_0x1f0e05[_0x3b2f('0x35')]=_0x1f0e05['attributes']['length']?_0x1f0e05['attributes']:_0x426b17[_0x3b2f('0x31')];if(_0x1bde13[_0x3b2f('0x33')][_0x3b2f('0x42')]){_0x1f0e05[_0x3b2f('0x43')]=[{'all':!![]}];}_0x1f0e05=_[_0x3b2f('0x3f')]({},_0x1f0e05,_0x1bde13[_0x3b2f('0x41')]);return db['SalesforceField']['find'](_0x1f0e05)[_0x3b2f('0x25')](handleEntityNotFound(_0x4e718d,null))[_0x3b2f('0x25')](respondWithResult(_0x4e718d,null))[_0x3b2f('0x46')](handleError(_0x4e718d,null));};exports['create']=function(_0x234d1e,_0xd79b51){return db[_0x3b2f('0x2c')][_0x3b2f('0x4a')](_0x234d1e['body'],{})[_0x3b2f('0x25')](respondWithResult(_0xd79b51,0xc9))[_0x3b2f('0x46')](handleError(_0xd79b51,null));};exports['update']=function(_0x14acf1,_0x22d612){if(_0x14acf1[_0x3b2f('0x4b')]['id']){delete _0x14acf1[_0x3b2f('0x4b')]['id'];}return db['SalesforceField'][_0x3b2f('0x4c')]({'where':{'id':_0x14acf1[_0x3b2f('0x48')]['id']}})[_0x3b2f('0x25')](handleEntityNotFound(_0x22d612,null))[_0x3b2f('0x25')](saveUpdates(_0x14acf1[_0x3b2f('0x4b')],null))[_0x3b2f('0x25')](respondWithResult(_0x22d612,null))[_0x3b2f('0x46')](handleError(_0x22d612,null));};exports['destroy']=function(_0x33f8c8,_0x362a43){return db['SalesforceField'][_0x3b2f('0x4c')]({'where':{'id':_0x33f8c8[_0x3b2f('0x48')]['id']}})[_0x3b2f('0x25')](handleEntityNotFound(_0x362a43,null))[_0x3b2f('0x25')](removeEntity(_0x362a43,null))[_0x3b2f('0x46')](handleError(_0x362a43,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b6f4fc0..fe0dca1 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 _0xcce4=['../../config/logger','moment','bluebird','request-promise','path','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xcce4,0x15e));var _0x4cce=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcce4[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x4cce('0x0'));var logger=require(_0x4cce('0x1'))('api');var moment=require(_0x4cce('0x2'));var BPromise=require(_0x4cce('0x3'));var rp=require(_0x4cce('0x4'));var fs=require('fs');var path=require(_0x4cce('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4cce('0x6'));module[_0x4cce('0x7')]=function(_0x4e86af,_0x27527d){return _0x4e86af[_0x4cce('0x8')]('SalesforceField',attributes,{'tableName':_0x4cce('0x9'),'paranoid':![],'indexes':[{'name':_0x4cce('0xa'),'fields':[_0x4cce('0xb'),_0x4cce('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7752=['./intSalesforceField.attributes','define','SalesforceField','salesforce_unique_index','idField','FieldId','util','api','moment','bluebird','rimraf'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x7752,0x1ea));var _0x2775=function(_0x31faec,_0x2c2a7e){_0x31faec=_0x31faec-0x0;var _0x5257d2=_0x7752[_0x31faec];return _0x5257d2;};'use strict';var _=require('lodash');var util=require(_0x2775('0x0'));var logger=require('../../config/logger')(_0x2775('0x1'));var moment=require(_0x2775('0x2'));var BPromise=require(_0x2775('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2775('0x4'));var config=require('../../config/environment');var attributes=require(_0x2775('0x5'));module['exports']=function(_0xbfab0e,_0x52f647){return _0xbfab0e[_0x2775('0x6')](_0x2775('0x7'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x2775('0x8'),'fields':[_0x2775('0x9'),_0x2775('0xa')],'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 cba4c90..09e2e43 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 _0x9362=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c2e65,_0x20e630){var _0x445359=function(_0x2588d4){while(--_0x2588d4){_0x5c2e65['push'](_0x5c2e65['shift']());}};_0x445359(++_0x20e630);}(_0x9362,0x1b1));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2936('0x0'));var moment=require(_0x2936('0x1'));var BPromise=require(_0x2936('0x2'));var rs=require(_0x2936('0x3'));var fs=require('fs');var Redis=require(_0x2936('0x4'));var db=require(_0x2936('0x5'))['db'];var utils=require(_0x2936('0x6'));var logger=require(_0x2936('0x7'))(_0x2936('0x8'));var config=require(_0x2936('0x9'));var jayson=require(_0x2936('0xa'));var client=jayson[_0x2936('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x427b06,_0x44adf1,_0x3ec7b0){return new BPromise(function(_0x1355d4,_0x6faf4a){return client[_0x2936('0xc')](_0x427b06,_0x3ec7b0)[_0x2936('0xd')](function(_0xbf5da0){logger['info'](_0x2936('0xe'),_0x44adf1,'request\x20sent');logger[_0x2936('0xf')](_0x2936('0x10'),_0x44adf1,_0x2936('0x11'),JSON['stringify'](_0xbf5da0));if(_0xbf5da0[_0x2936('0x12')]){if(_0xbf5da0['error']['code']===0x1f4){logger[_0x2936('0x12')]('SalesforceField,\x20%s,\x20%s',_0x44adf1,_0xbf5da0[_0x2936('0x12')]['message']);return _0x6faf4a(_0xbf5da0['error'][_0x2936('0x13')]);}logger[_0x2936('0x12')]('SalesforceField,\x20%s,\x20%s',_0x44adf1,_0xbf5da0[_0x2936('0x12')]['message']);return _0x1355d4(_0xbf5da0[_0x2936('0x12')][_0x2936('0x13')]);}else{logger[_0x2936('0x14')](_0x2936('0xe'),_0x44adf1,_0x2936('0x11'));_0x1355d4(_0xbf5da0[_0x2936('0x15')][_0x2936('0x13')]);}})['catch'](function(_0x64321d){logger[_0x2936('0x12')](_0x2936('0xe'),_0x44adf1,_0x64321d);_0x6faf4a(_0x64321d);});});} \ No newline at end of file +var _0xb726=['request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xb726,0x1eb));var _0x6b72=function(_0x5c41d6,_0x4c1aa2){_0x5c41d6=_0x5c41d6-0x0;var _0x379668=_0xb726[_0x5c41d6];return _0x379668;};'use strict';var _=require(_0x6b72('0x0'));var util=require(_0x6b72('0x1'));var moment=require('moment');var BPromise=require(_0x6b72('0x2'));var rs=require(_0x6b72('0x3'));var fs=require('fs');var Redis=require(_0x6b72('0x4'));var db=require(_0x6b72('0x5'))['db'];var utils=require(_0x6b72('0x6'));var logger=require('../../config/logger')(_0x6b72('0x7'));var config=require(_0x6b72('0x8'));var jayson=require(_0x6b72('0x9'));var client=jayson[_0x6b72('0xa')][_0x6b72('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51964b,_0x435067,_0x27ab78){return new BPromise(function(_0x29b1ca,_0x89ead2){return client['request'](_0x51964b,_0x27ab78)[_0x6b72('0xc')](function(_0x4b76b9){logger[_0x6b72('0xd')](_0x6b72('0xe'),_0x435067,_0x6b72('0xf'));logger[_0x6b72('0x10')](_0x6b72('0x11'),_0x435067,_0x6b72('0xf'),JSON['stringify'](_0x4b76b9));if(_0x4b76b9[_0x6b72('0x12')]){if(_0x4b76b9[_0x6b72('0x12')]['code']===0x1f4){logger['error'](_0x6b72('0xe'),_0x435067,_0x4b76b9[_0x6b72('0x12')][_0x6b72('0x13')]);return _0x89ead2(_0x4b76b9[_0x6b72('0x12')]['message']);}logger['error'](_0x6b72('0xe'),_0x435067,_0x4b76b9[_0x6b72('0x12')]['message']);return _0x29b1ca(_0x4b76b9[_0x6b72('0x12')][_0x6b72('0x13')]);}else{logger[_0x6b72('0xd')](_0x6b72('0xe'),_0x435067,_0x6b72('0xf'));_0x29b1ca(_0x4b76b9[_0x6b72('0x14')][_0x6b72('0x13')]);}})[_0x6b72('0x15')](function(_0x51c3a1){logger[_0x6b72('0x12')](_0x6b72('0xe'),_0x435067,_0x51c3a1);_0x89ead2(_0x51c3a1);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ae4361c..44df410 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 _0x0922=['util','path','connect-timeout','Router','fs-extra','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','update','delete','destroy','exports','multer'];(function(_0x2c1de6,_0x24d0ad){var _0xc3ba97=function(_0x47c28a){while(--_0x47c28a){_0x2c1de6['push'](_0x2c1de6['shift']());}};_0xc3ba97(++_0x24d0ad);}(_0x0922,0x77));var _0x2092=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x0922[_0x2cc594];return _0x4abff7;};'use strict';var multer=require(_0x2092('0x0'));var util=require(_0x2092('0x1'));var path=require(_0x2092('0x2'));var timeout=require(_0x2092('0x3'));var express=require('express');var router=express[_0x2092('0x4')]();var fs_extra=require(_0x2092('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2092('0x6'));router[_0x2092('0x7')]('/',auth[_0x2092('0x8')](),controller[_0x2092('0x9')]);router['get'](_0x2092('0xa'),auth['isAuthenticated'](),controller[_0x2092('0xb')]);router[_0x2092('0x7')](_0x2092('0xc'),auth['isAuthenticated'](),controller[_0x2092('0xd')]);router['get']('/:id/fields',auth[_0x2092('0x8')](),controller[_0x2092('0xe')]);router[_0x2092('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2092('0xf')](_0x2092('0xc'),auth[_0x2092('0x8')](),controller['addConfiguration']);router['put'](_0x2092('0xa'),auth[_0x2092('0x8')](),controller[_0x2092('0x10')]);router[_0x2092('0x11')]('/:id',auth[_0x2092('0x8')](),controller[_0x2092('0x12')]);module[_0x2092('0x13')]=router; \ No newline at end of file +var _0x6c98=['./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c98,0x1dc));var _0x86c9=function(_0x3e29e4,_0x3b9e88){_0x3e29e4=_0x3e29e4-0x0;var _0x1aa154=_0x6c98[_0x3e29e4];return _0x1aa154;};'use strict';var multer=require('multer');var util=require(_0x86c9('0x0'));var path=require(_0x86c9('0x1'));var timeout=require(_0x86c9('0x2'));var express=require('express');var router=express[_0x86c9('0x3')]();var fs_extra=require(_0x86c9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x86c9('0x5'));var config=require(_0x86c9('0x6'));var controller=require(_0x86c9('0x7'));router[_0x86c9('0x8')]('/',auth[_0x86c9('0x9')](),controller[_0x86c9('0xa')]);router[_0x86c9('0x8')](_0x86c9('0xb'),auth[_0x86c9('0x9')](),controller[_0x86c9('0xc')]);router['get'](_0x86c9('0xd'),auth[_0x86c9('0x9')](),controller[_0x86c9('0xe')]);router['get']('/:id/fields',auth[_0x86c9('0x9')](),controller[_0x86c9('0xf')]);router[_0x86c9('0x10')]('/',auth['isAuthenticated'](),controller[_0x86c9('0x11')]);router[_0x86c9('0x10')](_0x86c9('0xd'),auth[_0x86c9('0x9')](),controller[_0x86c9('0x12')]);router[_0x86c9('0x13')](_0x86c9('0xb'),auth['isAuthenticated'](),controller[_0x86c9('0x14')]);router['delete'](_0x86c9('0xb'),auth[_0x86c9('0x9')](),controller[_0x86c9('0x15')]);module[_0x86c9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d4170bf..8ffddac 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 _0x58b9=['exports','STRING','remoteUri'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x58b9,0x1f2));var _0x958b=function(_0x2c9004,_0x312b13){_0x2c9004=_0x2c9004-0x0;var _0x471bb5=_0x58b9[_0x2c9004];return _0x471bb5;};'use strict';var Sequelize=require('sequelize');module[_0x958b('0x0')]={'name':{'type':Sequelize[_0x958b('0x1')]},'description':{'type':Sequelize[_0x958b('0x1')]},'username':{'type':Sequelize[_0x958b('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x958b('0x1')]},'email':{'type':Sequelize[_0x958b('0x1')]},'remoteUri':{'type':Sequelize[_0x958b('0x1')],'unique':_0x958b('0x2')},'serverUrl':{'type':Sequelize[_0x958b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8e26=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2a194b,_0x4d209b){var _0x21b65c=function(_0xd20231){while(--_0xd20231){_0x2a194b['push'](_0x2a194b['shift']());}};_0x21b65c(++_0x4d209b);}(_0x8e26,0xe7));var _0x68e2=function(_0x37dc1d,_0xbf91ef){_0x37dc1d=_0x37dc1d-0x0;var _0x4ac931=_0x8e26[_0x37dc1d];return _0x4ac931;};'use strict';var Sequelize=require(_0x68e2('0x0'));module[_0x68e2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x68e2('0x2')],'unique':_0x68e2('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x68e2('0x2')]},'remoteUri':{'type':Sequelize[_0x68e2('0x2')],'unique':_0x68e2('0x4')},'serverUrl':{'type':Sequelize[_0x68e2('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 dd9b623..8e13b6b 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 _0xea48=['reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','sys_class_name','close_notes','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','GET','result','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/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','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','business_duration','group_list','work_end'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xea48,0xfb));var _0x8ea4=function(_0x324418,_0xeb0522){_0x324418=_0x324418-0x0;var _0x24e65b=_0xea48[_0x324418];return _0x24e65b;};'use strict';var emlformat=require(_0x8ea4('0x0'));var rimraf=require(_0x8ea4('0x1'));var zipdir=require(_0x8ea4('0x2'));var jsonpatch=require(_0x8ea4('0x3'));var rp=require(_0x8ea4('0x4'));var moment=require(_0x8ea4('0x5'));var BPromise=require(_0x8ea4('0x6'));var Mustache=require(_0x8ea4('0x7'));var util=require(_0x8ea4('0x8'));var path=require(_0x8ea4('0x9'));var sox=require('sox');var csv=require(_0x8ea4('0xa'));var ejs=require(_0x8ea4('0xb'));var fs=require('fs');var fs_extra=require(_0x8ea4('0xc'));var _=require(_0x8ea4('0xd'));var squel=require(_0x8ea4('0xe'));var crypto=require(_0x8ea4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8ea4('0x10'));var toCsv=require(_0x8ea4('0xa'));var querystring=require(_0x8ea4('0x11'));var Papa=require(_0x8ea4('0x12'));var Redis=require(_0x8ea4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8ea4('0x14'));var as=require(_0x8ea4('0x15'));var hardwareService=require(_0x8ea4('0x16'));var logger=require(_0x8ea4('0x17'))(_0x8ea4('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8ea4('0x19'));var db=require(_0x8ea4('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x402909,_0x184fc8){_0x184fc8=_0x184fc8||0xcc;return function(_0x4f4e3f){if(_0x4f4e3f){return _0x402909[_0x8ea4('0x1b')](_0x184fc8);}return _0x402909[_0x8ea4('0x1c')](_0x184fc8)[_0x8ea4('0x1d')]();};}function respondWithResult(_0x45598,_0x9aa16e){_0x9aa16e=_0x9aa16e||0xc8;return function(_0x11d541){if(_0x11d541){return _0x45598[_0x8ea4('0x1c')](_0x9aa16e)[_0x8ea4('0x1e')](_0x11d541);}};}function respondWithFilteredResult(_0x1ae196,_0x55457f){return function(_0x53f0f4){if(_0x53f0f4){var _0xb43557=typeof _0x55457f[_0x8ea4('0x1f')]===_0x8ea4('0x20')&&typeof _0x55457f[_0x8ea4('0x21')]===_0x8ea4('0x20');var _0x3b59fc=_0x53f0f4[_0x8ea4('0x22')];var _0x472d66=_0xb43557?0x0:_0x55457f[_0x8ea4('0x1f')];var _0x4ef254=_0xb43557?_0x53f0f4[_0x8ea4('0x22')]:_0x55457f[_0x8ea4('0x1f')]+_0x55457f[_0x8ea4('0x21')];var _0xcbf1d4;if(_0x4ef254>=_0x3b59fc){_0x4ef254=_0x3b59fc;_0xcbf1d4=0xc8;}else{_0xcbf1d4=0xce;}_0x1ae196[_0x8ea4('0x1c')](_0xcbf1d4);return _0x1ae196[_0x8ea4('0x23')](_0x8ea4('0x24'),_0x472d66+'-'+_0x4ef254+'/'+_0x3b59fc)[_0x8ea4('0x1e')](_0x53f0f4);}return null;};}function patchUpdates(_0xae0a0c){return function(_0xd64fab){try{jsonpatch[_0x8ea4('0x25')](_0xd64fab,_0xae0a0c,!![]);}catch(_0x161c75){return BPromise['reject'](_0x161c75);}return _0xd64fab[_0x8ea4('0x26')]();};}function saveUpdates(_0x5b1447,_0x388b44){return function(_0x158571){if(_0x158571){return _0x158571[_0x8ea4('0x27')](_0x5b1447)[_0x8ea4('0x28')](function(_0xeb6be5){return _0xeb6be5;});}return null;};}function removeEntity(_0x200ba1,_0x6882e5){return function(_0x49cf39){if(_0x49cf39){return _0x49cf39[_0x8ea4('0x29')]()['then'](function(){_0x200ba1[_0x8ea4('0x1c')](0xcc)[_0x8ea4('0x1d')]();});}};}function handleEntityNotFound(_0x28b07b,_0x3eb389){return function(_0x22c4b6){if(!_0x22c4b6){_0x28b07b[_0x8ea4('0x1b')](0x194);}return _0x22c4b6;};}function handleError(_0x2102b0,_0x5050b1){_0x5050b1=_0x5050b1||0x1f4;return function(_0x57adbe){logger[_0x8ea4('0x2a')](_0x57adbe[_0x8ea4('0x2b')]);if(_0x57adbe[_0x8ea4('0x2c')]){delete _0x57adbe[_0x8ea4('0x2c')];}_0x2102b0[_0x8ea4('0x1c')](_0x5050b1)[_0x8ea4('0x2d')](_0x57adbe);};}exports[_0x8ea4('0x2e')]=function(_0x4124e1,_0x1d32a6){var _0x5731dd={},_0x111b95={},_0xf09a42={'count':0x0,'rows':[]};var _0x2afe40=_[_0x8ea4('0x2f')](db[_0x8ea4('0x30')][_0x8ea4('0x31')],function(_0x5ba19f){return{'name':_0x5ba19f[_0x8ea4('0x32')],'type':_0x5ba19f[_0x8ea4('0x33')][_0x8ea4('0x34')]};});_0x111b95[_0x8ea4('0x35')]=_[_0x8ea4('0x2f')](_0x2afe40,_0x8ea4('0x2c'));_0x111b95[_0x8ea4('0x36')]=_[_0x8ea4('0x37')](_0x4124e1[_0x8ea4('0x36')]);_0x111b95[_0x8ea4('0x38')]=_[_0x8ea4('0x39')](_0x111b95['model'],_0x111b95[_0x8ea4('0x36')]);_0x5731dd['attributes']=_[_0x8ea4('0x39')](_0x111b95[_0x8ea4('0x35')],qs[_0x8ea4('0x3a')](_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x3a')]));_0x5731dd['attributes']=_0x5731dd[_0x8ea4('0x3b')]['length']?_0x5731dd[_0x8ea4('0x3b')]:_0x111b95[_0x8ea4('0x35')];if(!_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x3c')](_0x8ea4('0x3d'))){_0x5731dd[_0x8ea4('0x21')]=qs[_0x8ea4('0x21')](_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x21')]);_0x5731dd['offset']=qs[_0x8ea4('0x1f')](_0x4124e1[_0x8ea4('0x36')]['offset']);}_0x5731dd[_0x8ea4('0x3e')]=qs[_0x8ea4('0x3f')](_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x3f')]);_0x5731dd[_0x8ea4('0x40')]=qs[_0x8ea4('0x38')](_[_0x8ea4('0x41')](_0x4124e1['query'],_0x111b95[_0x8ea4('0x38')]),_0x2afe40);if(_0x4124e1['query'][_0x8ea4('0x42')]){_0x5731dd[_0x8ea4('0x40')]=_[_0x8ea4('0x43')](_0x5731dd['where'],{'$or':_['map'](_0x2afe40,function(_0x283f25){if(_0x283f25[_0x8ea4('0x33')]!==_0x8ea4('0x44')){var _0x242860={};_0x242860[_0x283f25[_0x8ea4('0x2c')]]={'$like':'%'+_0x4124e1[_0x8ea4('0x36')]['filter']+'%'};return _0x242860;}})});}_0x5731dd=_[_0x8ea4('0x43')]({},_0x5731dd,_0x4124e1[_0x8ea4('0x45')]);var _0x10c8ba={'where':_0x5731dd['where']};return db[_0x8ea4('0x30')][_0x8ea4('0x22')](_0x10c8ba)[_0x8ea4('0x28')](function(_0x51986d){_0xf09a42[_0x8ea4('0x22')]=_0x51986d;if(_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x46')]){_0x5731dd[_0x8ea4('0x47')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x8ea4('0x48')](_0x5731dd);})[_0x8ea4('0x28')](function(_0x4c329a){_0xf09a42[_0x8ea4('0x49')]=_0x4c329a;return _0xf09a42;})[_0x8ea4('0x28')](respondWithFilteredResult(_0x1d32a6,_0x5731dd))[_0x8ea4('0x4a')](handleError(_0x1d32a6,null));};exports[_0x8ea4('0x4b')]=function(_0x3bdfad,_0x1127de){var _0x30bd93={'raw':![],'where':{'id':_0x3bdfad[_0x8ea4('0x4c')]['id']}},_0x3d6044={};_0x3d6044[_0x8ea4('0x35')]=_[_0x8ea4('0x37')](db[_0x8ea4('0x30')][_0x8ea4('0x31')]);_0x3d6044[_0x8ea4('0x36')]=_[_0x8ea4('0x37')](_0x3bdfad[_0x8ea4('0x36')]);_0x3d6044[_0x8ea4('0x38')]=_[_0x8ea4('0x39')](_0x3d6044['model'],_0x3d6044[_0x8ea4('0x36')]);_0x30bd93[_0x8ea4('0x3b')]=_['intersection'](_0x3d6044['model'],qs[_0x8ea4('0x3a')](_0x3bdfad[_0x8ea4('0x36')]['fields']));_0x30bd93[_0x8ea4('0x3b')]=_0x30bd93['attributes'][_0x8ea4('0x4d')]?_0x30bd93[_0x8ea4('0x3b')]:_0x3d6044[_0x8ea4('0x35')];if(_0x3bdfad[_0x8ea4('0x36')][_0x8ea4('0x46')]){_0x30bd93[_0x8ea4('0x47')]=[{'all':!![]}];}_0x30bd93=_['merge']({},_0x30bd93,_0x3bdfad[_0x8ea4('0x45')]);return db[_0x8ea4('0x30')]['find'](_0x30bd93)[_0x8ea4('0x28')](handleEntityNotFound(_0x1127de,null))[_0x8ea4('0x28')](respondWithResult(_0x1127de,null))[_0x8ea4('0x4a')](handleError(_0x1127de,null));};exports[_0x8ea4('0x4e')]=function(_0x2f8a57,_0x59ece6){return db[_0x8ea4('0x30')][_0x8ea4('0x4e')](_0x2f8a57[_0x8ea4('0x4f')],{})['then'](respondWithResult(_0x59ece6,0xc9))[_0x8ea4('0x4a')](handleError(_0x59ece6,null));};exports[_0x8ea4('0x27')]=function(_0x199b59,_0x17dc17){if(_0x199b59[_0x8ea4('0x4f')]['id']){delete _0x199b59[_0x8ea4('0x4f')]['id'];}return db[_0x8ea4('0x30')][_0x8ea4('0x50')]({'where':{'id':_0x199b59[_0x8ea4('0x4c')]['id']}})[_0x8ea4('0x28')](handleEntityNotFound(_0x17dc17,null))['then'](saveUpdates(_0x199b59['body'],null))['then'](respondWithResult(_0x17dc17,null))['catch'](handleError(_0x17dc17,null));};exports[_0x8ea4('0x29')]=function(_0x1d4eb6,_0x3d86d5){return db['ServicenowAccount'][_0x8ea4('0x50')]({'where':{'id':_0x1d4eb6[_0x8ea4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d86d5,null))[_0x8ea4('0x28')](removeEntity(_0x3d86d5,null))[_0x8ea4('0x4a')](handleError(_0x3d86d5,null));};exports[_0x8ea4('0x51')]=function(_0x5143aa,_0x43578a,_0x18b547){var _0x13a0b0={};var _0x53db09={};var _0x368617;var _0x4af760;return db[_0x8ea4('0x30')][_0x8ea4('0x52')]({'where':{'id':_0x5143aa['params']['id']}})[_0x8ea4('0x28')](handleEntityNotFound(_0x43578a,null))['then'](function(_0x654638){if(_0x654638){_0x368617=_0x654638;_0x53db09[_0x8ea4('0x35')]=_[_0x8ea4('0x37')](db['ServicenowConfiguration'][_0x8ea4('0x31')]);_0x53db09[_0x8ea4('0x36')]=_[_0x8ea4('0x37')](_0x5143aa['query']);_0x53db09[_0x8ea4('0x38')]=_['intersection'](_0x53db09['model'],_0x53db09[_0x8ea4('0x36')]);_0x13a0b0[_0x8ea4('0x3b')]=_['intersection'](_0x53db09[_0x8ea4('0x35')],qs[_0x8ea4('0x3a')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x3a')]));_0x13a0b0[_0x8ea4('0x3b')]=_0x13a0b0[_0x8ea4('0x3b')]['length']?_0x13a0b0['attributes']:_0x53db09[_0x8ea4('0x35')];_0x13a0b0[_0x8ea4('0x3e')]=qs[_0x8ea4('0x3f')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x3f')]);_0x13a0b0[_0x8ea4('0x40')]=qs['filters'](_[_0x8ea4('0x41')](_0x5143aa[_0x8ea4('0x36')],_0x53db09['filters']));if(_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x42')]){_0x13a0b0[_0x8ea4('0x40')]=_[_0x8ea4('0x43')](_0x13a0b0[_0x8ea4('0x40')],{'$or':_[_0x8ea4('0x2f')](_0x13a0b0[_0x8ea4('0x3b')],function(_0x35e4c3){var _0x3e4755={};_0x3e4755[_0x35e4c3]={'$like':'%'+_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x42')]+'%'};return _0x3e4755;})});}_0x13a0b0=_[_0x8ea4('0x43')]({},_0x13a0b0,_0x5143aa['options']);return _0x368617['getConfigurations'](_0x13a0b0);}})['then'](function(_0x337b38){if(_0x337b38){_0x4af760=_0x337b38[_0x8ea4('0x4d')];if(!_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x3c')]('nolimit')){_0x13a0b0['limit']=qs[_0x8ea4('0x21')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x21')]);_0x13a0b0[_0x8ea4('0x1f')]=qs[_0x8ea4('0x1f')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x1f')]);}return _0x368617['getConfigurations'](_0x13a0b0);}})[_0x8ea4('0x28')](function(_0x582995){if(_0x582995){return _0x582995?{'count':_0x4af760,'rows':_0x582995}:null;}})[_0x8ea4('0x28')](respondWithResult(_0x43578a,null))[_0x8ea4('0x4a')](handleError(_0x43578a,null));};exports['addConfiguration']=function(_0x4d2202,_0x4bdd23,_0x53f784){if(_0x4d2202[_0x8ea4('0x4f')]['id']){delete _0x4d2202[_0x8ea4('0x4f')]['id'];}return db[_0x8ea4('0x30')][_0x8ea4('0x52')]({'where':{'id':_0x4d2202[_0x8ea4('0x4c')]['id']}})[_0x8ea4('0x28')](handleEntityNotFound(_0x4bdd23,null))['then'](function(_0x51e623){if(_0x51e623){_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x53')]=_0x51e623['id'];_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x54')]=integrations['getSubjects'](_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x55')],_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x33')]);_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x56')]=integrations[_0x8ea4('0x57')](_0x4d2202['body'][_0x8ea4('0x55')],_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x33')]);return db[_0x8ea4('0x58')][_0x8ea4('0x4e')](_0x4d2202[_0x8ea4('0x4f')],{'include':[{'model':db['ServicenowField'],'as':_0x8ea4('0x54')},{'model':db[_0x8ea4('0x59')],'as':_0x8ea4('0x56')}]});}return null;})[_0x8ea4('0x28')](respondWithResult(_0x4bdd23,null))[_0x8ea4('0x4a')](handleError(_0x4bdd23,null));};exports['getFields']=function(_0x403b5c,_0x4d0091,_0x5a1dbf){var _0x2c49df=[_0x8ea4('0x5a'),_0x8ea4('0x5b'),_0x8ea4('0x5c'),'subcategory',_0x8ea4('0x5d'),_0x8ea4('0x5e'),_0x8ea4('0x5f'),_0x8ea4('0x60'),_0x8ea4('0x61')];var _0x33b953=[_0x8ea4('0x62'),'made_sla',_0x8ea4('0x63'),_0x8ea4('0x64'),_0x8ea4('0x65'),'sys_updated_on',_0x8ea4('0x66'),_0x8ea4('0x5b'),_0x8ea4('0x67'),_0x8ea4('0x68'),_0x8ea4('0x69'),'sys_updated_by',_0x8ea4('0x6a'),'user_input',_0x8ea4('0x6b'),_0x8ea4('0x6c'),_0x8ea4('0x6d'),'sys_created_by',_0x8ea4('0x5c'),_0x8ea4('0x3e'),_0x8ea4('0x6e'),_0x8ea4('0x6f'),_0x8ea4('0x70'),'delivery_plan',_0x8ea4('0x71'),_0x8ea4('0x72'),_0x8ea4('0x73'),_0x8ea4('0x74'),_0x8ea4('0x75'),_0x8ea4('0x76'),_0x8ea4('0x77'),'time_worked','expected_start','opened_at',_0x8ea4('0x78'),_0x8ea4('0x79'),_0x8ea4('0x7a'),_0x8ea4('0x7b'),_0x8ea4('0x7c'),_0x8ea4('0x7d'),_0x8ea4('0x7e'),_0x8ea4('0x7f'),_0x8ea4('0x80'),_0x8ea4('0x81'),_0x8ea4('0x5d'),_0x8ea4('0x82'),_0x8ea4('0x83'),_0x8ea4('0x84'),_0x8ea4('0x85'),'business_stc','additional_assignee_list','description','calendar_duration',_0x8ea4('0x5e'),_0x8ea4('0x86'),_0x8ea4('0x87'),'closed_by',_0x8ea4('0x88'),'parent_incident',_0x8ea4('0x89'),_0x8ea4('0x8a'),_0x8ea4('0x8b'),_0x8ea4('0x5f'),'urgency',_0x8ea4('0x8c'),_0x8ea4('0x8d'),_0x8ea4('0x8e'),_0x8ea4('0x8f'),_0x8ea4('0x90'),'severity','comments',_0x8ea4('0x91'),_0x8ea4('0x92'),_0x8ea4('0x93'),_0x8ea4('0x94'),_0x8ea4('0x95'),_0x8ea4('0x96'),'sys_tags',_0x8ea4('0x97'),_0x8ea4('0x98'),_0x8ea4('0x99'),_0x8ea4('0x9a'),_0x8ea4('0x61')];var _0x1217fb='';var _0x3fc1b1='';var _0x395bc6=[];var _0x4c4de5='';var _0x124e9a='';var _0x2d2571=[];var _0x5366a8='';var _0x2c0066='';var _0x395c88={};var _0x4b9178='';return db['ServicenowAccount'][_0x8ea4('0x52')]({'where':{'id':_0x403b5c[_0x8ea4('0x4c')]['id']},'attributes':['id',_0x8ea4('0x9b'),_0x8ea4('0x9c'),_0x8ea4('0x9d'),_0x8ea4('0x9e'),_0x8ea4('0x9f')]})[_0x8ea4('0x28')](handleEntityNotFound(_0x4d0091,null))['then'](function(_0x2d8421){if(_0x2d8421){_0x4b9178=_0x2d8421[_0x8ea4('0x9e')];var _0x55b098=_0x4b9178[_0x8ea4('0xa0')](-0x1);if(_0x55b098==='/'){_0x4b9178=_0x4b9178['substring'](0x0,_0x4b9178['lastIndexOf'](_0x55b098));}_0x2c0066=util[_0x8ea4('0xa1')](_0x8ea4('0xa2'),_0x4b9178);_0x5366a8=util[_0x8ea4('0xa1')]('%s/api/now/table/',_0x4b9178);_0x395c88={'user':_0x2d8421[_0x8ea4('0x9b')],'pass':_0x2d8421[_0x8ea4('0x9c')]};var _0x116715={'method':_0x8ea4('0xa3'),'uri':_0x2c0066+'incident?sysparm_display_value=all','auth':_0x395c88,'json':!![]};return rp(_0x116715);}})[_0x8ea4('0x28')](function(_0x1c0b0d){if(_0x1c0b0d[_0x8ea4('0xa4')]['length']>0x0){_0x1217fb=_0x1c0b0d[_0x8ea4('0xa4')];}console['log'](_0x8ea4('0xa5'),_0x1217fb);_0x2d2571=[];_0x3fc1b1=Object[_0x8ea4('0xa6')]([],_0x1217fb);_['remove'](_0x3fc1b1,function(_0x5bb6ed){return!_0x2c49df[_0x8ea4('0xa7')](_0x5bb6ed[_0x8ea4('0x2c')]);});_0x3fc1b1[_0x8ea4('0xa8')](function(_0x467c6e){var _0x4a4090=createFieldObject(_0x5366a8,_0x395c88,_0x467c6e[_0x8ea4('0xa9')],_0x467c6e[_0x8ea4('0x2c')],_0x467c6e[_0x8ea4('0xaa')],![]);_0x2d2571[_0x8ea4('0xab')](_0x4a4090);});return Promise['all'](_0x2d2571);})[_0x8ea4('0x28')](function(_0x4c2d50){_0x395bc6=_0x4c2d50;_0x4c4de5=Object[_0x8ea4('0xa6')]([],_0x1217fb);console[_0x8ea4('0xac')](_0x8ea4('0xad'),_0x1217fb);_[_0x8ea4('0xae')](_0x4c4de5,function(_0x18c6c9){return _0x33b953[_0x8ea4('0xa7')](_0x18c6c9['name']);});console['log'](_0x8ea4('0xaf'),_0x4c4de5);_0x2d2571=[];_0x4c4de5[_0x8ea4('0xa8')](function(_0x2d0235){var _0x309f4f=createFieldObject(_0x5366a8,_0x395c88,_0x2d0235[_0x8ea4('0xa9')],_0x2d0235[_0x8ea4('0x2c')],_0x2d0235[_0x8ea4('0xaa')],!![]);_0x2d2571[_0x8ea4('0xab')](_0x309f4f);});return Promise[_0x8ea4('0xb0')](_0x2d2571);})[_0x8ea4('0x28')](function(_0x327e39){_0x124e9a=_0x327e39;var _0x378054=_0x395bc6[_0x8ea4('0xb1')](_0x124e9a);return{'count':_0x378054['length'],'rows':_0x378054};})[_0x8ea4('0x28')](respondWithResult(_0x4d0091,null))[_0x8ea4('0x4a')](function(_0x5682b8){console[_0x8ea4('0xac')](_0x8ea4('0xb2')+_0x5682b8);var _0x9f642=_0x403b5c[_0x8ea4('0x36')][_0x8ea4('0xb3')]?0x1f4:_0x5682b8['statusCode']||0x1f4;logger['error'](_0x5682b8[_0x8ea4('0x2b')]);delete _0x5682b8[_0x8ea4('0x2c')];if(_0x9f642===0x191){_0x9f642=0x190;}_0x4d0091[_0x8ea4('0x1c')](_0x9f642)[_0x8ea4('0x2d')](_0x403b5c[_0x8ea4('0x36')][_0x8ea4('0xb3')]?{'message':_0x8ea4('0xb4'),'statusCode':_0x5682b8[_0x8ea4('0xb5')]}:_0x5682b8);});};function createFieldObject(_0x2f43fe,_0x237432,_0x424718,_0x2d9cb8,_0x9954c9,_0x38f1ed){return new Promise(function(_0x26bb47,_0x46580b){var _0xd4e29a={'id':_0x2d9cb8,'name':_0x9954c9,'custom':_0x38f1ed};if(_0x424718===_0x8ea4('0xb6')){_0xd4e29a['options']=[{'name':'True','value':'true'},{'name':_0x8ea4('0xb7'),'value':_0x8ea4('0xb8')}];_0x26bb47(_0xd4e29a);}else{var _0x5d7a89={'method':_0x8ea4('0xa3'),'uri':_0x2f43fe+'sys_choice?sysparm_query=name=incident^element='+_0x2d9cb8,'auth':_0x237432,'json':!![]};return rp(_0x5d7a89)[_0x8ea4('0x28')](function(_0x52e701){var _0x1897e1=[];if(_0x52e701[_0x8ea4('0xa4')][_0x8ea4('0x4d')]>0x0){_0x52e701[_0x8ea4('0xa4')][_0x8ea4('0xa8')](function(_0x324806){if(_0x324806[_0x8ea4('0xb9')]===_0x8ea4('0xb8')){var _0xec0ca9={'name':_0x324806[_0x8ea4('0xaa')],'value':_0x324806[_0x8ea4('0xba')]};_0x1897e1['push'](_0xec0ca9);}});}_0xd4e29a['options']=_0x1897e1;if(_0xd4e29a[_0x8ea4('0x45')][_0x8ea4('0x4d')]>0x0){_0x26bb47(_0xd4e29a);}else{if(_0x38f1ed==![]){_0x26bb47();}else{_0x26bb47(_0xd4e29a);}}});}});} \ No newline at end of file +var _0xf212=['incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','test','error','send','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','status','stack','name','index','map','ServicenowAccount','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','pick','getConfigurations','addConfiguration','channel','getDescriptions','ServicenowConfiguration','Subjects','ServicenowField','Descriptions','knowledge','subcategory','close_code','incident_state','severity','category','parent','made_sla','caused_by','upon_reject','child_incidents','hold_reason','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','business_duration','group_list','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','findOne','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/table/','GET'];(function(_0xb8a3ad,_0x1b39d7){var _0x58e9ed=function(_0x1a6196){while(--_0x1a6196){_0xb8a3ad['push'](_0xb8a3ad['shift']());}};_0x58e9ed(++_0x1b39d7);}(_0xf212,0xc9));var _0x2f21=function(_0x5bd975,_0xa9d1ec){_0x5bd975=_0x5bd975-0x0;var _0xbfeb24=_0xf212[_0x5bd975];return _0xbfeb24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f21('0x0'));var zipdir=require(_0x2f21('0x1'));var jsonpatch=require(_0x2f21('0x2'));var rp=require('request-promise');var moment=require(_0x2f21('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f21('0x4'));var path=require('path');var sox=require(_0x2f21('0x5'));var csv=require(_0x2f21('0x6'));var ejs=require(_0x2f21('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2f21('0x8'));var deskjs=require(_0x2f21('0x9'));var toCsv=require(_0x2f21('0x6'));var querystring=require('querystring');var Papa=require(_0x2f21('0xa'));var Redis=require(_0x2f21('0xb'));var authService=require(_0x2f21('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2f21('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f21('0xe'))('api');var utils=require(_0x2f21('0xf'));var config=require(_0x2f21('0x10'));var licenseUtil=require(_0x2f21('0x11'));var db=require(_0x2f21('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5f3e93,_0x3b8fec){_0x3b8fec=_0x3b8fec||0xcc;return function(_0x38d7cf){if(_0x38d7cf){return _0x5f3e93[_0x2f21('0x13')](_0x3b8fec);}return _0x5f3e93['status'](_0x3b8fec)[_0x2f21('0x14')]();};}function respondWithResult(_0x3c2700,_0x3394b2){_0x3394b2=_0x3394b2||0xc8;return function(_0x2827ad){if(_0x2827ad){return _0x3c2700['status'](_0x3394b2)[_0x2f21('0x15')](_0x2827ad);}};}function respondWithFilteredResult(_0x1f98ee,_0x5b84c4){return function(_0x243caa){if(_0x243caa){var _0x1273a9=typeof _0x5b84c4[_0x2f21('0x16')]===_0x2f21('0x17')&&typeof _0x5b84c4[_0x2f21('0x18')]==='undefined';var _0x148edc=_0x243caa[_0x2f21('0x19')];var _0x55b54a=_0x1273a9?0x0:_0x5b84c4[_0x2f21('0x16')];var _0x139883=_0x1273a9?_0x243caa['count']:_0x5b84c4[_0x2f21('0x16')]+_0x5b84c4[_0x2f21('0x18')];var _0x25c520;if(_0x139883>=_0x148edc){_0x139883=_0x148edc;_0x25c520=0xc8;}else{_0x25c520=0xce;}_0x1f98ee['status'](_0x25c520);return _0x1f98ee['set'](_0x2f21('0x1a'),_0x55b54a+'-'+_0x139883+'/'+_0x148edc)[_0x2f21('0x15')](_0x243caa);}return null;};}function patchUpdates(_0xdb9fcc){return function(_0x1edf13){try{jsonpatch['apply'](_0x1edf13,_0xdb9fcc,!![]);}catch(_0x23830d){return BPromise['reject'](_0x23830d);}return _0x1edf13[_0x2f21('0x1b')]();};}function saveUpdates(_0x4ab55d,_0x13d20c){return function(_0x5cf906){if(_0x5cf906){return _0x5cf906[_0x2f21('0x1c')](_0x4ab55d)[_0x2f21('0x1d')](function(_0x2ee7ed){return _0x2ee7ed;});}return null;};}function removeEntity(_0x5201f7,_0x3ae2e4){return function(_0x3abfbe){if(_0x3abfbe){return _0x3abfbe[_0x2f21('0x1e')]()[_0x2f21('0x1d')](function(){_0x5201f7[_0x2f21('0x1f')](0xcc)[_0x2f21('0x14')]();});}};}function handleEntityNotFound(_0x180ae0,_0x4ba745){return function(_0x3a3ed4){if(!_0x3a3ed4){_0x180ae0[_0x2f21('0x13')](0x194);}return _0x3a3ed4;};}function handleError(_0x411923,_0xcc68ac){_0xcc68ac=_0xcc68ac||0x1f4;return function(_0x1bed45){logger['error'](_0x1bed45[_0x2f21('0x20')]);if(_0x1bed45[_0x2f21('0x21')]){delete _0x1bed45[_0x2f21('0x21')];}_0x411923[_0x2f21('0x1f')](_0xcc68ac)['send'](_0x1bed45);};}exports[_0x2f21('0x22')]=function(_0x34c55d,_0x410575){var _0x4df7f4={},_0x32ac07={},_0x1df8ef={'count':0x0,'rows':[]};var _0x52bb79=_[_0x2f21('0x23')](db[_0x2f21('0x24')][_0x2f21('0x25')],function(_0x5e04e5){return{'name':_0x5e04e5['fieldName'],'type':_0x5e04e5['type'][_0x2f21('0x26')]};});_0x32ac07[_0x2f21('0x27')]=_[_0x2f21('0x23')](_0x52bb79,'name');_0x32ac07[_0x2f21('0x28')]=_[_0x2f21('0x29')](_0x34c55d['query']);_0x32ac07[_0x2f21('0x2a')]=_['intersection'](_0x32ac07[_0x2f21('0x27')],_0x32ac07[_0x2f21('0x28')]);_0x4df7f4[_0x2f21('0x2b')]=_[_0x2f21('0x2c')](_0x32ac07[_0x2f21('0x27')],qs[_0x2f21('0x2d')](_0x34c55d[_0x2f21('0x28')][_0x2f21('0x2d')]));_0x4df7f4[_0x2f21('0x2b')]=_0x4df7f4[_0x2f21('0x2b')][_0x2f21('0x2e')]?_0x4df7f4['attributes']:_0x32ac07[_0x2f21('0x27')];if(!_0x34c55d[_0x2f21('0x28')][_0x2f21('0x2f')](_0x2f21('0x30'))){_0x4df7f4['limit']=qs['limit'](_0x34c55d['query'][_0x2f21('0x18')]);_0x4df7f4[_0x2f21('0x16')]=qs['offset'](_0x34c55d['query']['offset']);}_0x4df7f4[_0x2f21('0x31')]=qs[_0x2f21('0x32')](_0x34c55d[_0x2f21('0x28')][_0x2f21('0x32')]);_0x4df7f4[_0x2f21('0x33')]=qs[_0x2f21('0x2a')](_['pick'](_0x34c55d[_0x2f21('0x28')],_0x32ac07[_0x2f21('0x2a')]),_0x52bb79);if(_0x34c55d['query']['filter']){_0x4df7f4[_0x2f21('0x33')]=_[_0x2f21('0x34')](_0x4df7f4[_0x2f21('0x33')],{'$or':_[_0x2f21('0x23')](_0x52bb79,function(_0x1889ca){if(_0x1889ca[_0x2f21('0x35')]!=='VIRTUAL'){var _0x5eed32={};_0x5eed32[_0x1889ca[_0x2f21('0x21')]]={'$like':'%'+_0x34c55d[_0x2f21('0x28')][_0x2f21('0x36')]+'%'};return _0x5eed32;}})});}_0x4df7f4=_[_0x2f21('0x34')]({},_0x4df7f4,_0x34c55d['options']);var _0x49fa07={'where':_0x4df7f4[_0x2f21('0x33')]};return db['ServicenowAccount']['count'](_0x49fa07)[_0x2f21('0x1d')](function(_0x50632e){_0x1df8ef[_0x2f21('0x19')]=_0x50632e;if(_0x34c55d[_0x2f21('0x28')][_0x2f21('0x37')]){_0x4df7f4[_0x2f21('0x38')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x2f21('0x39')](_0x4df7f4);})[_0x2f21('0x1d')](function(_0x4616a5){_0x1df8ef[_0x2f21('0x3a')]=_0x4616a5;return _0x1df8ef;})['then'](respondWithFilteredResult(_0x410575,_0x4df7f4))[_0x2f21('0x3b')](handleError(_0x410575,null));};exports['show']=function(_0x27f8b9,_0x547b0e){var _0x4623fa={'raw':![],'where':{'id':_0x27f8b9[_0x2f21('0x3c')]['id']}},_0x43d804={};_0x43d804[_0x2f21('0x27')]=_[_0x2f21('0x29')](db[_0x2f21('0x24')][_0x2f21('0x25')]);_0x43d804['query']=_[_0x2f21('0x29')](_0x27f8b9[_0x2f21('0x28')]);_0x43d804['filters']=_[_0x2f21('0x2c')](_0x43d804[_0x2f21('0x27')],_0x43d804[_0x2f21('0x28')]);_0x4623fa['attributes']=_[_0x2f21('0x2c')](_0x43d804['model'],qs[_0x2f21('0x2d')](_0x27f8b9[_0x2f21('0x28')][_0x2f21('0x2d')]));_0x4623fa[_0x2f21('0x2b')]=_0x4623fa[_0x2f21('0x2b')][_0x2f21('0x2e')]?_0x4623fa[_0x2f21('0x2b')]:_0x43d804[_0x2f21('0x27')];if(_0x27f8b9['query'][_0x2f21('0x37')]){_0x4623fa[_0x2f21('0x38')]=[{'all':!![]}];}_0x4623fa=_[_0x2f21('0x34')]({},_0x4623fa,_0x27f8b9[_0x2f21('0x3d')]);return db[_0x2f21('0x24')][_0x2f21('0x3e')](_0x4623fa)[_0x2f21('0x1d')](handleEntityNotFound(_0x547b0e,null))[_0x2f21('0x1d')](respondWithResult(_0x547b0e,null))[_0x2f21('0x3b')](handleError(_0x547b0e,null));};exports[_0x2f21('0x3f')]=function(_0x5d780e,_0x3bc1f9){return db[_0x2f21('0x24')]['create'](_0x5d780e[_0x2f21('0x40')],{})[_0x2f21('0x1d')](respondWithResult(_0x3bc1f9,0xc9))['catch'](handleError(_0x3bc1f9,null));};exports['update']=function(_0x5eb78d,_0x1571a9){if(_0x5eb78d['body']['id']){delete _0x5eb78d[_0x2f21('0x40')]['id'];}return db[_0x2f21('0x24')]['find']({'where':{'id':_0x5eb78d[_0x2f21('0x3c')]['id']}})[_0x2f21('0x1d')](handleEntityNotFound(_0x1571a9,null))[_0x2f21('0x1d')](saveUpdates(_0x5eb78d[_0x2f21('0x40')],null))['then'](respondWithResult(_0x1571a9,null))[_0x2f21('0x3b')](handleError(_0x1571a9,null));};exports['destroy']=function(_0x2738b4,_0x8abf90){return db['ServicenowAccount']['find']({'where':{'id':_0x2738b4[_0x2f21('0x3c')]['id']}})[_0x2f21('0x1d')](handleEntityNotFound(_0x8abf90,null))[_0x2f21('0x1d')](removeEntity(_0x8abf90,null))[_0x2f21('0x3b')](handleError(_0x8abf90,null));};exports['getConfigurations']=function(_0x3f1332,_0x249389,_0x2e2873){var _0x23b8d0={};var _0x189100={};var _0x4f54f5;var _0x13bbc1;return db[_0x2f21('0x24')]['findOne']({'where':{'id':_0x3f1332['params']['id']}})[_0x2f21('0x1d')](handleEntityNotFound(_0x249389,null))[_0x2f21('0x1d')](function(_0x421050){if(_0x421050){_0x4f54f5=_0x421050;_0x189100[_0x2f21('0x27')]=_[_0x2f21('0x29')](db['ServicenowConfiguration'][_0x2f21('0x25')]);_0x189100[_0x2f21('0x28')]=_[_0x2f21('0x29')](_0x3f1332[_0x2f21('0x28')]);_0x189100[_0x2f21('0x2a')]=_[_0x2f21('0x2c')](_0x189100['model'],_0x189100[_0x2f21('0x28')]);_0x23b8d0[_0x2f21('0x2b')]=_['intersection'](_0x189100['model'],qs[_0x2f21('0x2d')](_0x3f1332['query']['fields']));_0x23b8d0[_0x2f21('0x2b')]=_0x23b8d0[_0x2f21('0x2b')]['length']?_0x23b8d0['attributes']:_0x189100[_0x2f21('0x27')];_0x23b8d0[_0x2f21('0x31')]=qs[_0x2f21('0x32')](_0x3f1332['query'][_0x2f21('0x32')]);_0x23b8d0[_0x2f21('0x33')]=qs[_0x2f21('0x2a')](_[_0x2f21('0x41')](_0x3f1332[_0x2f21('0x28')],_0x189100[_0x2f21('0x2a')]));if(_0x3f1332[_0x2f21('0x28')][_0x2f21('0x36')]){_0x23b8d0[_0x2f21('0x33')]=_[_0x2f21('0x34')](_0x23b8d0[_0x2f21('0x33')],{'$or':_['map'](_0x23b8d0[_0x2f21('0x2b')],function(_0x3aafc5){var _0x23b3a9={};_0x23b3a9[_0x3aafc5]={'$like':'%'+_0x3f1332[_0x2f21('0x28')][_0x2f21('0x36')]+'%'};return _0x23b3a9;})});}_0x23b8d0=_['merge']({},_0x23b8d0,_0x3f1332[_0x2f21('0x3d')]);return _0x4f54f5[_0x2f21('0x42')](_0x23b8d0);}})[_0x2f21('0x1d')](function(_0x133097){if(_0x133097){_0x13bbc1=_0x133097['length'];if(!_0x3f1332[_0x2f21('0x28')][_0x2f21('0x2f')]('nolimit')){_0x23b8d0[_0x2f21('0x18')]=qs[_0x2f21('0x18')](_0x3f1332[_0x2f21('0x28')]['limit']);_0x23b8d0[_0x2f21('0x16')]=qs[_0x2f21('0x16')](_0x3f1332[_0x2f21('0x28')][_0x2f21('0x16')]);}return _0x4f54f5[_0x2f21('0x42')](_0x23b8d0);}})[_0x2f21('0x1d')](function(_0x13d505){if(_0x13d505){return _0x13d505?{'count':_0x13bbc1,'rows':_0x13d505}:null;}})[_0x2f21('0x1d')](respondWithResult(_0x249389,null))[_0x2f21('0x3b')](handleError(_0x249389,null));};exports[_0x2f21('0x43')]=function(_0x44a716,_0x55b0ac,_0x306d75){if(_0x44a716[_0x2f21('0x40')]['id']){delete _0x44a716[_0x2f21('0x40')]['id'];}return db[_0x2f21('0x24')]['findOne']({'where':{'id':_0x44a716[_0x2f21('0x3c')]['id']}})[_0x2f21('0x1d')](handleEntityNotFound(_0x55b0ac,null))[_0x2f21('0x1d')](function(_0x4523c7){if(_0x4523c7){_0x44a716[_0x2f21('0x40')]['AccountId']=_0x4523c7['id'];_0x44a716[_0x2f21('0x40')]['Subjects']=integrations['getSubjects'](_0x44a716['body'][_0x2f21('0x44')],_0x44a716['body'][_0x2f21('0x35')]);_0x44a716[_0x2f21('0x40')]['Descriptions']=integrations[_0x2f21('0x45')](_0x44a716[_0x2f21('0x40')][_0x2f21('0x44')],_0x44a716[_0x2f21('0x40')]['type']);return db[_0x2f21('0x46')][_0x2f21('0x3f')](_0x44a716['body'],{'include':[{'model':db['ServicenowField'],'as':_0x2f21('0x47')},{'model':db[_0x2f21('0x48')],'as':_0x2f21('0x49')}]});}return null;})['then'](respondWithResult(_0x55b0ac,null))[_0x2f21('0x3b')](handleError(_0x55b0ac,null));};exports['getFields']=function(_0x5c9bc1,_0x47ff65,_0x422fc4){var _0x5bd91f=['made_sla','hold_reason',_0x2f21('0x4a'),_0x2f21('0x4b'),_0x2f21('0x4c'),'notify',_0x2f21('0x4d'),_0x2f21('0x4e'),_0x2f21('0x4f')];var _0x2f42c0=[_0x2f21('0x50'),_0x2f21('0x51'),_0x2f21('0x52'),'watch_list',_0x2f21('0x53'),'sys_updated_on',_0x2f21('0x54'),_0x2f21('0x55'),_0x2f21('0x56'),_0x2f21('0x57'),'resolved_by',_0x2f21('0x58'),'opened_by',_0x2f21('0x59'),_0x2f21('0x5a'),_0x2f21('0x5b'),_0x2f21('0x5c'),_0x2f21('0x5d'),_0x2f21('0x4a'),_0x2f21('0x31'),_0x2f21('0x5e'),'closed_at','cmdb_ci','delivery_plan','impact',_0x2f21('0x5f'),_0x2f21('0x60'),_0x2f21('0x61'),_0x2f21('0x62'),'sys_domain_path',_0x2f21('0x63'),_0x2f21('0x64'),_0x2f21('0x65'),'opened_at',_0x2f21('0x66'),_0x2f21('0x67'),'work_end',_0x2f21('0x68'),_0x2f21('0x69'),'caller_id',_0x2f21('0x6a'),_0x2f21('0x4b'),_0x2f21('0x6b'),_0x2f21('0x6c'),_0x2f21('0x4c'),_0x2f21('0x6d'),_0x2f21('0x6e'),_0x2f21('0x6f'),_0x2f21('0x70'),_0x2f21('0x71'),'additional_assignee_list',_0x2f21('0x72'),_0x2f21('0x73'),_0x2f21('0x74'),_0x2f21('0x75'),'close_notes',_0x2f21('0x76'),_0x2f21('0x77'),_0x2f21('0x78'),'sys_id',_0x2f21('0x79'),'reopened_by',_0x2f21('0x4d'),_0x2f21('0x7a'),_0x2f21('0x7b'),_0x2f21('0x7c'),_0x2f21('0x7d'),_0x2f21('0x7e'),_0x2f21('0x7f'),_0x2f21('0x4e'),_0x2f21('0x80'),_0x2f21('0x81'),_0x2f21('0x82'),'comments_and_work_notes',_0x2f21('0x83'),_0x2f21('0x84'),_0x2f21('0x85'),'sys_tags',_0x2f21('0x86'),_0x2f21('0x87'),_0x2f21('0x88'),_0x2f21('0x89'),_0x2f21('0x4f')];var _0x441dbc='';var _0x6d0d72='';var _0x372db9=[];var _0x498255='';var _0x5bbaf4='';var _0x26e571=[];var _0x3122d8='';var _0x3118cf='';var _0x566c98={};var _0xb48e57='';return db[_0x2f21('0x24')][_0x2f21('0x8a')]({'where':{'id':_0x5c9bc1[_0x2f21('0x3c')]['id']},'attributes':['id',_0x2f21('0x8b'),_0x2f21('0x8c'),_0x2f21('0x8d'),_0x2f21('0x8e'),_0x2f21('0x8f')]})[_0x2f21('0x1d')](handleEntityNotFound(_0x47ff65,null))['then'](function(_0x3d8aa7){if(_0x3d8aa7){_0xb48e57=_0x3d8aa7[_0x2f21('0x8e')];var _0x3c2932=_0xb48e57['slice'](-0x1);if(_0x3c2932==='/'){_0xb48e57=_0xb48e57[_0x2f21('0x90')](0x0,_0xb48e57[_0x2f21('0x91')](_0x3c2932));}_0x3118cf=util[_0x2f21('0x92')]('%s/api/now/doc/table/schema/',_0xb48e57);_0x3122d8=util['format'](_0x2f21('0x93'),_0xb48e57);_0x566c98={'user':_0x3d8aa7[_0x2f21('0x8b')],'pass':_0x3d8aa7[_0x2f21('0x8c')]};var _0x141062={'method':_0x2f21('0x94'),'uri':_0x3118cf+_0x2f21('0x95'),'auth':_0x566c98,'json':!![]};return rp(_0x141062);}})[_0x2f21('0x1d')](function(_0x4a1ebe){if(_0x4a1ebe[_0x2f21('0x96')]['length']>0x0){_0x441dbc=_0x4a1ebe[_0x2f21('0x96')];}console[_0x2f21('0x97')](_0x2f21('0x98'),_0x441dbc);_0x26e571=[];_0x6d0d72=Object['assign']([],_0x441dbc);_[_0x2f21('0x99')](_0x6d0d72,function(_0x1ef112){return!_0x5bd91f[_0x2f21('0x9a')](_0x1ef112[_0x2f21('0x21')]);});_0x6d0d72['forEach'](function(_0x284448){var _0x2fcddb=createFieldObject(_0x3122d8,_0x566c98,_0x284448[_0x2f21('0x9b')],_0x284448[_0x2f21('0x21')],_0x284448[_0x2f21('0x9c')],![]);_0x26e571[_0x2f21('0x9d')](_0x2fcddb);});return Promise[_0x2f21('0x9e')](_0x26e571);})['then'](function(_0x34d6f3){_0x372db9=_0x34d6f3;_0x498255=Object[_0x2f21('0x9f')]([],_0x441dbc);console['log'](_0x2f21('0xa0'),_0x441dbc);_['remove'](_0x498255,function(_0x3e17df){return _0x2f42c0[_0x2f21('0x9a')](_0x3e17df[_0x2f21('0x21')]);});console[_0x2f21('0x97')](_0x2f21('0xa1'),_0x498255);_0x26e571=[];_0x498255[_0x2f21('0xa2')](function(_0x217bf5){var _0x3b16c6=createFieldObject(_0x3122d8,_0x566c98,_0x217bf5['internalType'],_0x217bf5[_0x2f21('0x21')],_0x217bf5[_0x2f21('0x9c')],!![]);_0x26e571['push'](_0x3b16c6);});return Promise[_0x2f21('0x9e')](_0x26e571);})['then'](function(_0x250a61){_0x5bbaf4=_0x250a61;var _0x1582c6=_0x372db9[_0x2f21('0xa3')](_0x5bbaf4);return{'count':_0x1582c6[_0x2f21('0x2e')],'rows':_0x1582c6};})['then'](respondWithResult(_0x47ff65,null))[_0x2f21('0x3b')](function(_0x1dcd91){console[_0x2f21('0x97')]('ServiceNow\x20error:\x20'+_0x1dcd91);var _0x52e1b3=_0x5c9bc1[_0x2f21('0x28')][_0x2f21('0xa4')]?0x1f4:_0x1dcd91['statusCode']||0x1f4;logger[_0x2f21('0xa5')](_0x1dcd91[_0x2f21('0x20')]);delete _0x1dcd91['name'];if(_0x52e1b3===0x191){_0x52e1b3=0x190;}_0x47ff65['status'](_0x52e1b3)[_0x2f21('0xa6')](_0x5c9bc1[_0x2f21('0x28')][_0x2f21('0xa4')]?{'message':'Wrong\x20credentials','statusCode':_0x1dcd91[_0x2f21('0xa7')]}:_0x1dcd91);});};function createFieldObject(_0x5d994a,_0xc3b911,_0x3feb2a,_0x14b5a5,_0x55d091,_0x309a76){return new Promise(function(_0x161217,_0x50e020){var _0x2b759b={'id':_0x14b5a5,'name':_0x55d091,'custom':_0x309a76};if(_0x3feb2a===_0x2f21('0xa8')){_0x2b759b[_0x2f21('0x3d')]=[{'name':_0x2f21('0xa9'),'value':'true'},{'name':_0x2f21('0xaa'),'value':_0x2f21('0xab')}];_0x161217(_0x2b759b);}else{var _0x520d65={'method':'GET','uri':_0x5d994a+_0x2f21('0xac')+_0x14b5a5,'auth':_0xc3b911,'json':!![]};return rp(_0x520d65)['then'](function(_0x1c229c){var _0x8dbb66=[];if(_0x1c229c[_0x2f21('0x96')]['length']>0x0){_0x1c229c[_0x2f21('0x96')][_0x2f21('0xa2')](function(_0x3916a1){if(_0x3916a1[_0x2f21('0xad')]===_0x2f21('0xab')){var _0x26f38c={'name':_0x3916a1[_0x2f21('0x9c')],'value':_0x3916a1[_0x2f21('0xae')]};_0x8dbb66[_0x2f21('0x9d')](_0x26f38c);}});}_0x2b759b[_0x2f21('0x3d')]=_0x8dbb66;if(_0x2b759b[_0x2f21('0x3d')][_0x2f21('0x2e')]>0x0){_0x161217(_0x2b759b);}else{if(_0x309a76==![]){_0x161217();}else{_0x161217(_0x2b759b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ed6172a..2d3ed14 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5ce0e5,_0x3ed6cb){var _0x35db2d=function(_0x487572){while(--_0x487572){_0x5ce0e5['push'](_0x5ce0e5['shift']());}};_0x35db2d(++_0x3ed6cb);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0x407cb1,_0x2b1ac1){var _0x11bd3b=function(_0x5de5b3){while(--_0x5de5b3){_0x407cb1['push'](_0x407cb1['shift']());}};_0x11bd3b(++_0x2b1ac1);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));var integrations=require(_0xae3d('0xb'));module[_0xae3d('0xc')]=function(_0xa54808,_0x476579){return _0xa54808[_0xae3d('0xd')]('ServicenowAccount',attributes,{'tableName':_0xae3d('0xe'),'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 f4936d5..f664387 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 _0x3fa9=['map','ShowServicenowAccount','ServicenowAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','model'];(function(_0x3a7b0c,_0x89f976){var _0x26ef80=function(_0x349baf){while(--_0x349baf){_0x3a7b0c['push'](_0x3a7b0c['shift']());}};_0x26ef80(++_0x89f976);}(_0x3fa9,0x19c));var _0x93fa=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3fa9[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x93fa('0x0'));var util=require(_0x93fa('0x1'));var moment=require('moment');var BPromise=require(_0x93fa('0x2'));var rs=require(_0x93fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x93fa('0x5'))(_0x93fa('0x6'));var config=require(_0x93fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x93fa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d345,_0x18ef9f,_0x89a3d0){return new BPromise(function(_0x9b8d3e,_0xeae901){return client[_0x93fa('0x9')](_0x35d345,_0x89a3d0)[_0x93fa('0xa')](function(_0x1c2c61){logger[_0x93fa('0xb')](_0x93fa('0xc'),_0x18ef9f,_0x93fa('0xd'));logger[_0x93fa('0xe')](_0x93fa('0xf'),_0x18ef9f,_0x93fa('0xd'),JSON[_0x93fa('0x10')](_0x1c2c61));if(_0x1c2c61['error']){if(_0x1c2c61[_0x93fa('0x11')][_0x93fa('0x12')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x18ef9f,_0x1c2c61[_0x93fa('0x11')][_0x93fa('0x13')]);return _0xeae901(_0x1c2c61[_0x93fa('0x11')][_0x93fa('0x13')]);}logger[_0x93fa('0x11')](_0x93fa('0xc'),_0x18ef9f,_0x1c2c61[_0x93fa('0x11')]['message']);return _0x9b8d3e(_0x1c2c61[_0x93fa('0x11')]['message']);}else{logger[_0x93fa('0xb')](_0x93fa('0xc'),_0x18ef9f,'request\x20sent');_0x9b8d3e(_0x1c2c61[_0x93fa('0x14')][_0x93fa('0x13')]);}})[_0x93fa('0x15')](function(_0x402009){logger[_0x93fa('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x18ef9f,_0x402009);_0xeae901(_0x402009);});});}exports[_0x93fa('0x16')]=function(_0x242cc0){var _0x2d563a=this;return new Promise(function(_0x54c5b0,_0x2353bc){return db['ServicenowAccount'][_0x93fa('0x17')]({'raw':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')][_0x93fa('0x19')]||null:null,'attributes':_0x242cc0['options']?_0x242cc0['options'][_0x93fa('0x1a')]||null:null,'limit':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')][_0x93fa('0x1b')]||null:null,'include':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')][_0x93fa('0x1c')]?_['map'](_0x242cc0[_0x93fa('0x18')]['include'],function(_0x21f43a){return{'model':db[_0x21f43a[_0x93fa('0x1d')]],'as':_0x21f43a['as'],'attributes':_0x21f43a[_0x93fa('0x1a')],'include':_0x21f43a[_0x93fa('0x1c')]?_[_0x93fa('0x1e')](_0x21f43a[_0x93fa('0x1c')],function(_0x1beedb){return{'model':db[_0x1beedb[_0x93fa('0x1d')]],'as':_0x1beedb['as'],'attributes':_0x1beedb[_0x93fa('0x1a')],'include':_0x1beedb['include']?_['map'](_0x1beedb[_0x93fa('0x1c')],function(_0x238d7d){return{'model':db[_0x238d7d[_0x93fa('0x1d')]],'as':_0x238d7d['as'],'attributes':_0x238d7d['attributes']};}):[]};}):[]};}):[]:[]})[_0x93fa('0xa')](function(_0x2ea508){logger[_0x93fa('0xb')](_0x93fa('0x16'),_0x242cc0);logger[_0x93fa('0xe')](_0x93fa('0x16'),_0x242cc0,JSON['stringify'](_0x2ea508));_0x54c5b0(_0x2ea508);})[_0x93fa('0x15')](function(_0x44533a){logger[_0x93fa('0x11')](_0x93fa('0x16'),_0x44533a[_0x93fa('0x13')],_0x242cc0);_0x2353bc(_0x2d563a['error'](0x1f4,_0x44533a[_0x93fa('0x13')]));});});};exports[_0x93fa('0x1f')]=function(_0x39ad48){var _0x40b4aa=this;return new Promise(function(_0x30d012,_0x1c0803){return db[_0x93fa('0x20')][_0x93fa('0x21')]({'raw':_0x39ad48[_0x93fa('0x18')]?_0x39ad48[_0x93fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x39ad48[_0x93fa('0x18')]?_0x39ad48['options']['where']||null:null,'attributes':_0x39ad48['options']?_0x39ad48[_0x93fa('0x18')][_0x93fa('0x1a')]||null:null,'include':_0x39ad48['options']?_0x39ad48[_0x93fa('0x18')][_0x93fa('0x1c')]?_['map'](_0x39ad48[_0x93fa('0x18')][_0x93fa('0x1c')],function(_0x2f12f2){return{'model':db[_0x2f12f2[_0x93fa('0x1d')]],'as':_0x2f12f2['as'],'attributes':_0x2f12f2[_0x93fa('0x1a')],'include':_0x2f12f2['include']?_[_0x93fa('0x1e')](_0x2f12f2['include'],function(_0x5819e8){return{'model':db[_0x5819e8[_0x93fa('0x1d')]],'as':_0x5819e8['as'],'attributes':_0x5819e8[_0x93fa('0x1a')],'include':_0x5819e8[_0x93fa('0x1c')]?_[_0x93fa('0x1e')](_0x5819e8[_0x93fa('0x1c')],function(_0x2bdca9){return{'model':db[_0x2bdca9[_0x93fa('0x1d')]],'as':_0x2bdca9['as'],'attributes':_0x2bdca9['attributes']};}):[]};}):[]};}):[]:[]})[_0x93fa('0xa')](function(_0x517fc3){logger['info'](_0x93fa('0x1f'),_0x39ad48);logger[_0x93fa('0xe')](_0x93fa('0x1f'),_0x39ad48,JSON[_0x93fa('0x10')](_0x517fc3));_0x30d012(_0x517fc3);})[_0x93fa('0x15')](function(_0x15837d){logger['error'](_0x93fa('0x1f'),_0x15837d[_0x93fa('0x13')],_0x39ad48);_0x1c0803(_0x40b4aa['error'](0x1f4,_0x15837d[_0x93fa('0x13')]));});});}; \ No newline at end of file +var _0xdec6=['attributes','limit','include','map','model','then','ShowServicenowAccount','find','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ServicenowAccount','findAll','options','raw'];(function(_0x1327ed,_0x29b791){var _0x5dd63a=function(_0x3dd08b){while(--_0x3dd08b){_0x1327ed['push'](_0x1327ed['shift']());}};_0x5dd63a(++_0x29b791);}(_0xdec6,0x95));var _0x6dec=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xdec6[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x6dec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6dec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dec('0x2'));var db=require(_0x6dec('0x3'))['db'];var utils=require(_0x6dec('0x4'));var logger=require(_0x6dec('0x5'))(_0x6dec('0x6'));var config=require(_0x6dec('0x7'));var jayson=require(_0x6dec('0x8'));var client=jayson[_0x6dec('0x9')][_0x6dec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25ef1f,_0x27c578,_0x2482c9){return new BPromise(function(_0x42898f,_0x3adf45){return client[_0x6dec('0xb')](_0x25ef1f,_0x2482c9)['then'](function(_0x3641df){logger['info'](_0x6dec('0xc'),_0x27c578,_0x6dec('0xd'));logger[_0x6dec('0xe')](_0x6dec('0xf'),_0x27c578,_0x6dec('0xd'),JSON[_0x6dec('0x10')](_0x3641df));if(_0x3641df[_0x6dec('0x11')]){if(_0x3641df[_0x6dec('0x11')][_0x6dec('0x12')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x27c578,_0x3641df['error'][_0x6dec('0x13')]);return _0x3adf45(_0x3641df[_0x6dec('0x11')][_0x6dec('0x13')]);}logger['error'](_0x6dec('0xc'),_0x27c578,_0x3641df['error'][_0x6dec('0x13')]);return _0x42898f(_0x3641df[_0x6dec('0x11')][_0x6dec('0x13')]);}else{logger[_0x6dec('0x14')](_0x6dec('0xc'),_0x27c578,'request\x20sent');_0x42898f(_0x3641df['result'][_0x6dec('0x13')]);}})[_0x6dec('0x15')](function(_0x4b6abe){logger[_0x6dec('0x11')](_0x6dec('0xc'),_0x27c578,_0x4b6abe);_0x3adf45(_0x4b6abe);});});}exports['GetServicenowAccount']=function(_0xb9135){var _0x58dc55=this;return new Promise(function(_0x4524ad,_0x4d16d3){return db[_0x6dec('0x16')][_0x6dec('0x17')]({'raw':_0xb9135['options']?_0xb9135[_0x6dec('0x18')][_0x6dec('0x19')]===undefined?!![]:![]:!![],'where':_0xb9135[_0x6dec('0x18')]?_0xb9135[_0x6dec('0x18')]['where']||null:null,'attributes':_0xb9135[_0x6dec('0x18')]?_0xb9135['options'][_0x6dec('0x1a')]||null:null,'limit':_0xb9135[_0x6dec('0x18')]?_0xb9135[_0x6dec('0x18')][_0x6dec('0x1b')]||null:null,'include':_0xb9135['options']?_0xb9135[_0x6dec('0x18')][_0x6dec('0x1c')]?_[_0x6dec('0x1d')](_0xb9135[_0x6dec('0x18')][_0x6dec('0x1c')],function(_0x27c121){return{'model':db[_0x27c121[_0x6dec('0x1e')]],'as':_0x27c121['as'],'attributes':_0x27c121[_0x6dec('0x1a')],'include':_0x27c121[_0x6dec('0x1c')]?_['map'](_0x27c121['include'],function(_0x18024b){return{'model':db[_0x18024b[_0x6dec('0x1e')]],'as':_0x18024b['as'],'attributes':_0x18024b[_0x6dec('0x1a')],'include':_0x18024b[_0x6dec('0x1c')]?_['map'](_0x18024b['include'],function(_0x387487){return{'model':db[_0x387487[_0x6dec('0x1e')]],'as':_0x387487['as'],'attributes':_0x387487[_0x6dec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6dec('0x1f')](function(_0x51050b){logger['info']('GetServicenowAccount',_0xb9135);logger[_0x6dec('0xe')]('GetServicenowAccount',_0xb9135,JSON[_0x6dec('0x10')](_0x51050b));_0x4524ad(_0x51050b);})['catch'](function(_0x4e1c45){logger['error']('GetServicenowAccount',_0x4e1c45[_0x6dec('0x13')],_0xb9135);_0x4d16d3(_0x58dc55[_0x6dec('0x11')](0x1f4,_0x4e1c45[_0x6dec('0x13')]));});});};exports[_0x6dec('0x20')]=function(_0x1af7f6){var _0x398864=this;return new Promise(function(_0x3e9499,_0xaa5f74){return db['ServicenowAccount'][_0x6dec('0x21')]({'raw':_0x1af7f6['options']?_0x1af7f6[_0x6dec('0x18')][_0x6dec('0x19')]===undefined?!![]:![]:!![],'where':_0x1af7f6['options']?_0x1af7f6[_0x6dec('0x18')][_0x6dec('0x22')]||null:null,'attributes':_0x1af7f6[_0x6dec('0x18')]?_0x1af7f6[_0x6dec('0x18')][_0x6dec('0x1a')]||null:null,'include':_0x1af7f6[_0x6dec('0x18')]?_0x1af7f6[_0x6dec('0x18')]['include']?_[_0x6dec('0x1d')](_0x1af7f6[_0x6dec('0x18')][_0x6dec('0x1c')],function(_0x36cec7){return{'model':db[_0x36cec7[_0x6dec('0x1e')]],'as':_0x36cec7['as'],'attributes':_0x36cec7['attributes'],'include':_0x36cec7[_0x6dec('0x1c')]?_['map'](_0x36cec7[_0x6dec('0x1c')],function(_0x42e607){return{'model':db[_0x42e607[_0x6dec('0x1e')]],'as':_0x42e607['as'],'attributes':_0x42e607[_0x6dec('0x1a')],'include':_0x42e607[_0x6dec('0x1c')]?_[_0x6dec('0x1d')](_0x42e607['include'],function(_0x4db36a){return{'model':db[_0x4db36a[_0x6dec('0x1e')]],'as':_0x4db36a['as'],'attributes':_0x4db36a[_0x6dec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6dec('0x1f')](function(_0x597818){logger['info'](_0x6dec('0x20'),_0x1af7f6);logger['debug'](_0x6dec('0x20'),_0x1af7f6,JSON[_0x6dec('0x10')](_0x597818));_0x3e9499(_0x597818);})[_0x6dec('0x15')](function(_0x527fd9){logger[_0x6dec('0x11')]('ShowServicenowAccount',_0x527fd9['message'],_0x1af7f6);_0xaa5f74(_0x398864['error'](0x1f4,_0x527fd9['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 448203f..8c21544 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 _0x91c1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getDescriptions','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4cc765,_0x136732){var _0x5e4a03=function(_0x4042e5){while(--_0x4042e5){_0x4cc765['push'](_0x4cc765['shift']());}};_0x5e4a03(++_0x136732);}(_0x91c1,0xcc));var _0x191c=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x91c1[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0x191c('0x0'));var util=require(_0x191c('0x1'));var path=require(_0x191c('0x2'));var timeout=require(_0x191c('0x3'));var express=require(_0x191c('0x4'));var router=express[_0x191c('0x5')]();var fs_extra=require(_0x191c('0x6'));var auth=require(_0x191c('0x7'));var interaction=require(_0x191c('0x8'));var config=require(_0x191c('0x9'));var controller=require(_0x191c('0xa'));router[_0x191c('0xb')]('/',auth[_0x191c('0xc')](),controller['index']);router[_0x191c('0xb')](_0x191c('0xd'),auth[_0x191c('0xc')](),controller[_0x191c('0xe')]);router['get']('/:id/fields',auth[_0x191c('0xc')](),controller[_0x191c('0xf')]);router[_0x191c('0xb')](_0x191c('0x10'),auth[_0x191c('0xc')](),controller['getSubjects']);router[_0x191c('0xb')]('/:id/descriptions',auth[_0x191c('0xc')](),controller[_0x191c('0x11')]);router['post']('/',auth[_0x191c('0xc')](),controller[_0x191c('0x12')]);router[_0x191c('0x13')](_0x191c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x191c('0x14')](_0x191c('0xd'),auth[_0x191c('0xc')](),controller[_0x191c('0x15')]);module[_0x191c('0x16')]=router; \ No newline at end of file +var _0x2579=['getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x2bf4b8,_0x38397e){var _0x153de7=function(_0x24f62c){while(--_0x24f62c){_0x2bf4b8['push'](_0x2bf4b8['shift']());}};_0x153de7(++_0x38397e);}(_0x2579,0x14c));var _0x9257=function(_0x158012,_0x56359b){_0x158012=_0x158012-0x0;var _0x227d4c=_0x2579[_0x158012];return _0x227d4c;};'use strict';var multer=require(_0x9257('0x0'));var util=require(_0x9257('0x1'));var path=require(_0x9257('0x2'));var timeout=require(_0x9257('0x3'));var express=require('express');var router=express[_0x9257('0x4')]();var fs_extra=require(_0x9257('0x5'));var auth=require(_0x9257('0x6'));var interaction=require(_0x9257('0x7'));var config=require(_0x9257('0x8'));var controller=require(_0x9257('0x9'));router[_0x9257('0xa')]('/',auth['isAuthenticated'](),controller[_0x9257('0xb')]);router['get'](_0x9257('0xc'),auth[_0x9257('0xd')](),controller[_0x9257('0xe')]);router[_0x9257('0xa')](_0x9257('0xf'),auth[_0x9257('0xd')](),controller['getFields']);router['get'](_0x9257('0x10'),auth[_0x9257('0xd')](),controller[_0x9257('0x11')]);router[_0x9257('0xa')](_0x9257('0x12'),auth[_0x9257('0xd')](),controller[_0x9257('0x13')]);router[_0x9257('0x14')]('/',auth[_0x9257('0xd')](),controller[_0x9257('0x15')]);router[_0x9257('0x16')](_0x9257('0xc'),auth[_0x9257('0xd')](),controller[_0x9257('0x17')]);router[_0x9257('0x18')](_0x9257('0xc'),auth[_0x9257('0xd')](),controller[_0x9257('0x19')]);module[_0x9257('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 838733c..69f3a19 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 _0x9a0b=['exports','STRING','sequelize'];(function(_0x60277,_0x1e776a){var _0x1f48aa=function(_0x2f3972){while(--_0x2f3972){_0x60277['push'](_0x60277['shift']());}};_0x1f48aa(++_0x1e776a);}(_0x9a0b,0xc8));var _0xb9a0=function(_0xbdf0a0,_0x3d8e11){_0xbdf0a0=_0xbdf0a0-0x0;var _0x1d562a=_0x9a0b[_0xbdf0a0];return _0x1d562a;};'use strict';var Sequelize=require(_0xb9a0('0x0'));module[_0xb9a0('0x1')]={'name':{'type':Sequelize[_0xb9a0('0x2')]},'description':{'type':Sequelize[_0xb9a0('0x2')]}}; \ No newline at end of file +var _0x9c90=['exports','STRING','sequelize'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x9c90,0xe9));var _0x09c9=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x9c90[_0x4ec520];return _0xed49d7;};'use strict';var Sequelize=require(_0x09c9('0x0'));module[_0x09c9('0x1')]={'name':{'type':Sequelize[_0x09c9('0x2')]},'description':{'type':Sequelize[_0x09c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4d3e2af..9f93b59 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 _0xb66b=['save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','catch','show','includeAll','find','create','body','params','getFields','findOne','ServicenowField','options','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb66b,0xd7));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbb66('0x0'));var rimraf=require(_0xbb66('0x1'));var zipdir=require(_0xbb66('0x2'));var jsonpatch=require(_0xbb66('0x3'));var rp=require(_0xbb66('0x4'));var moment=require('moment');var BPromise=require(_0xbb66('0x5'));var Mustache=require(_0xbb66('0x6'));var util=require(_0xbb66('0x7'));var path=require(_0xbb66('0x8'));var sox=require(_0xbb66('0x9'));var csv=require(_0xbb66('0xa'));var ejs=require(_0xbb66('0xb'));var fs=require('fs');var fs_extra=require(_0xbb66('0xc'));var _=require(_0xbb66('0xd'));var squel=require(_0xbb66('0xe'));var crypto=require(_0xbb66('0xf'));var jsforce=require(_0xbb66('0x10'));var deskjs=require(_0xbb66('0x11'));var toCsv=require(_0xbb66('0xa'));var querystring=require(_0xbb66('0x12'));var Papa=require(_0xbb66('0x13'));var Redis=require('ioredis');var authService=require(_0xbb66('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbb66('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb66('0x16'))(_0xbb66('0x17'));var utils=require(_0xbb66('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbb66('0x19'));var db=require(_0xbb66('0x1a'))['db'];function respondWithStatusCode(_0xe47c0b,_0x4784a5){_0x4784a5=_0x4784a5||0xcc;return function(_0x4dd906){if(_0x4dd906){return _0xe47c0b['sendStatus'](_0x4784a5);}return _0xe47c0b['status'](_0x4784a5)[_0xbb66('0x1b')]();};}function respondWithResult(_0x4cc63b,_0x10b4f1){_0x10b4f1=_0x10b4f1||0xc8;return function(_0x45a149){if(_0x45a149){return _0x4cc63b[_0xbb66('0x1c')](_0x10b4f1)[_0xbb66('0x1d')](_0x45a149);}};}function respondWithFilteredResult(_0x254901,_0x39e229){return function(_0x4d05b4){if(_0x4d05b4){var _0x2a4e49=typeof _0x39e229[_0xbb66('0x1e')]===_0xbb66('0x1f')&&typeof _0x39e229[_0xbb66('0x20')]===_0xbb66('0x1f');var _0x439ed6=_0x4d05b4['count'];var _0x102460=_0x2a4e49?0x0:_0x39e229['offset'];var _0x3d7458=_0x2a4e49?_0x4d05b4[_0xbb66('0x21')]:_0x39e229['offset']+_0x39e229['limit'];var _0x558558;if(_0x3d7458>=_0x439ed6){_0x3d7458=_0x439ed6;_0x558558=0xc8;}else{_0x558558=0xce;}_0x254901[_0xbb66('0x1c')](_0x558558);return _0x254901[_0xbb66('0x22')](_0xbb66('0x23'),_0x102460+'-'+_0x3d7458+'/'+_0x439ed6)[_0xbb66('0x1d')](_0x4d05b4);}return null;};}function patchUpdates(_0x20db32){return function(_0x2b13be){try{jsonpatch[_0xbb66('0x24')](_0x2b13be,_0x20db32,!![]);}catch(_0x1d5daa){return BPromise['reject'](_0x1d5daa);}return _0x2b13be[_0xbb66('0x25')]();};}function saveUpdates(_0x584480,_0x4b46b2){return function(_0x5aad4e){if(_0x5aad4e){return _0x5aad4e[_0xbb66('0x26')](_0x584480)[_0xbb66('0x27')](function(_0x28377d){return _0x28377d;});}return null;};}function removeEntity(_0x450a2a,_0x1e31c4){return function(_0x5dd314){if(_0x5dd314){return _0x5dd314[_0xbb66('0x28')]()[_0xbb66('0x27')](function(){_0x450a2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e625e,_0x461482){return function(_0x3ffc70){if(!_0x3ffc70){_0x3e625e[_0xbb66('0x29')](0x194);}return _0x3ffc70;};}function handleError(_0x903512,_0x125108){_0x125108=_0x125108||0x1f4;return function(_0xd7ff0d){logger[_0xbb66('0x2a')](_0xd7ff0d[_0xbb66('0x2b')]);if(_0xd7ff0d[_0xbb66('0x2c')]){delete _0xd7ff0d[_0xbb66('0x2c')];}_0x903512[_0xbb66('0x1c')](_0x125108)[_0xbb66('0x2d')](_0xd7ff0d);};}exports[_0xbb66('0x2e')]=function(_0x2260dd,_0xf8d6d0){var _0x2e539c={},_0x33f394={},_0x420d75={'count':0x0,'rows':[]};var _0x2b1a92=_[_0xbb66('0x2f')](db[_0xbb66('0x30')][_0xbb66('0x31')],function(_0xd270d7){return{'name':_0xd270d7['fieldName'],'type':_0xd270d7[_0xbb66('0x32')][_0xbb66('0x33')]};});_0x33f394[_0xbb66('0x34')]=_[_0xbb66('0x2f')](_0x2b1a92,'name');_0x33f394['query']=_[_0xbb66('0x35')](_0x2260dd[_0xbb66('0x36')]);_0x33f394[_0xbb66('0x37')]=_[_0xbb66('0x38')](_0x33f394[_0xbb66('0x34')],_0x33f394[_0xbb66('0x36')]);_0x2e539c[_0xbb66('0x39')]=_['intersection'](_0x33f394['model'],qs['fields'](_0x2260dd[_0xbb66('0x36')][_0xbb66('0x3a')]));_0x2e539c[_0xbb66('0x39')]=_0x2e539c[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x2e539c[_0xbb66('0x39')]:_0x33f394[_0xbb66('0x34')];if(!_0x2260dd[_0xbb66('0x36')]['hasOwnProperty'](_0xbb66('0x3c'))){_0x2e539c[_0xbb66('0x20')]=qs[_0xbb66('0x20')](_0x2260dd[_0xbb66('0x36')]['limit']);_0x2e539c['offset']=qs['offset'](_0x2260dd['query'][_0xbb66('0x1e')]);}_0x2e539c['order']=qs[_0xbb66('0x3d')](_0x2260dd['query'][_0xbb66('0x3d')]);_0x2e539c[_0xbb66('0x3e')]=qs[_0xbb66('0x37')](_[_0xbb66('0x3f')](_0x2260dd[_0xbb66('0x36')],_0x33f394[_0xbb66('0x37')]),_0x2b1a92);if(_0x2260dd[_0xbb66('0x36')]['filter']){_0x2e539c[_0xbb66('0x3e')]=_[_0xbb66('0x40')](_0x2e539c[_0xbb66('0x3e')],{'$or':_[_0xbb66('0x2f')](_0x2b1a92,function(_0x4c8a65){if(_0x4c8a65[_0xbb66('0x32')]!==_0xbb66('0x41')){var _0x417a25={};_0x417a25[_0x4c8a65['name']]={'$like':'%'+_0x2260dd['query'][_0xbb66('0x42')]+'%'};return _0x417a25;}})});}_0x2e539c=_['merge']({},_0x2e539c,_0x2260dd['options']);var _0xb10c24={'where':_0x2e539c['where']};return db[_0xbb66('0x30')][_0xbb66('0x21')](_0xb10c24)['then'](function(_0xc6c49b){_0x420d75['count']=_0xc6c49b;if(_0x2260dd['query']['includeAll']){_0x2e539c[_0xbb66('0x43')]=[{'all':!![]}];}return db[_0xbb66('0x30')][_0xbb66('0x44')](_0x2e539c);})[_0xbb66('0x27')](function(_0xc31fb0){_0x420d75['rows']=_0xc31fb0;return _0x420d75;})['then'](respondWithFilteredResult(_0xf8d6d0,_0x2e539c))[_0xbb66('0x45')](handleError(_0xf8d6d0,null));};exports[_0xbb66('0x46')]=function(_0x3a83f8,_0x2bf437){var _0x1634da={'raw':![],'where':{'id':_0x3a83f8['params']['id']}},_0x3735dc={};_0x3735dc[_0xbb66('0x34')]=_[_0xbb66('0x35')](db['ServicenowConfiguration'][_0xbb66('0x31')]);_0x3735dc[_0xbb66('0x36')]=_[_0xbb66('0x35')](_0x3a83f8['query']);_0x3735dc['filters']=_[_0xbb66('0x38')](_0x3735dc[_0xbb66('0x34')],_0x3735dc[_0xbb66('0x36')]);_0x1634da[_0xbb66('0x39')]=_['intersection'](_0x3735dc[_0xbb66('0x34')],qs[_0xbb66('0x3a')](_0x3a83f8[_0xbb66('0x36')]['fields']));_0x1634da[_0xbb66('0x39')]=_0x1634da['attributes'][_0xbb66('0x3b')]?_0x1634da[_0xbb66('0x39')]:_0x3735dc[_0xbb66('0x34')];if(_0x3a83f8[_0xbb66('0x36')][_0xbb66('0x47')]){_0x1634da['include']=[{'all':!![]}];}_0x1634da=_[_0xbb66('0x40')]({},_0x1634da,_0x3a83f8['options']);return db[_0xbb66('0x30')][_0xbb66('0x48')](_0x1634da)[_0xbb66('0x27')](handleEntityNotFound(_0x2bf437,null))[_0xbb66('0x27')](respondWithResult(_0x2bf437,null))[_0xbb66('0x45')](handleError(_0x2bf437,null));};exports[_0xbb66('0x49')]=function(_0x14f72b,_0x4c0502){return db[_0xbb66('0x30')][_0xbb66('0x49')](_0x14f72b[_0xbb66('0x4a')],{})[_0xbb66('0x27')](respondWithResult(_0x4c0502,0xc9))[_0xbb66('0x45')](handleError(_0x4c0502,null));};exports[_0xbb66('0x26')]=function(_0x33e010,_0x46d62c){if(_0x33e010['body']['id']){delete _0x33e010[_0xbb66('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xbb66('0x48')]({'where':{'id':_0x33e010[_0xbb66('0x4b')]['id']}})[_0xbb66('0x27')](handleEntityNotFound(_0x46d62c,null))[_0xbb66('0x27')](saveUpdates(_0x33e010[_0xbb66('0x4a')],null))[_0xbb66('0x27')](respondWithResult(_0x46d62c,null))[_0xbb66('0x45')](handleError(_0x46d62c,null));};exports['destroy']=function(_0x2b4287,_0x5b80f3){return db['ServicenowConfiguration'][_0xbb66('0x48')]({'where':{'id':_0x2b4287[_0xbb66('0x4b')]['id']}})[_0xbb66('0x27')](handleEntityNotFound(_0x5b80f3,null))[_0xbb66('0x27')](removeEntity(_0x5b80f3,null))[_0xbb66('0x45')](handleError(_0x5b80f3,null));};exports[_0xbb66('0x4c')]=function(_0x57b5d4,_0x3c6ffd,_0x8f355){var _0x548e2f={};var _0x1ddf91={};var _0x16b173;var _0x305459;return db[_0xbb66('0x30')][_0xbb66('0x4d')]({'where':{'id':_0x57b5d4['params']['id']}})[_0xbb66('0x27')](handleEntityNotFound(_0x3c6ffd,null))[_0xbb66('0x27')](function(_0x14cad8){if(_0x14cad8){_0x16b173=_0x14cad8;_0x1ddf91['model']=_[_0xbb66('0x35')](db[_0xbb66('0x4e')]['rawAttributes']);_0x1ddf91['query']=_[_0xbb66('0x35')](_0x57b5d4['query']);_0x1ddf91[_0xbb66('0x37')]=_[_0xbb66('0x38')](_0x1ddf91[_0xbb66('0x34')],_0x1ddf91[_0xbb66('0x36')]);_0x548e2f[_0xbb66('0x39')]=_['intersection'](_0x1ddf91[_0xbb66('0x34')],qs[_0xbb66('0x3a')](_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x3a')]));_0x548e2f['attributes']=_0x548e2f[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x548e2f[_0xbb66('0x39')]:_0x1ddf91[_0xbb66('0x34')];_0x548e2f['order']=qs[_0xbb66('0x3d')](_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x3d')]);_0x548e2f['where']=qs[_0xbb66('0x37')](_[_0xbb66('0x3f')](_0x57b5d4['query'],_0x1ddf91['filters']));if(_0x57b5d4['query'][_0xbb66('0x42')]){_0x548e2f[_0xbb66('0x3e')]=_[_0xbb66('0x40')](_0x548e2f[_0xbb66('0x3e')],{'$or':_[_0xbb66('0x2f')](_0x548e2f[_0xbb66('0x39')],function(_0x958634){var _0x172b27={};_0x172b27[_0x958634]={'$like':'%'+_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x42')]+'%'};return _0x172b27;})});}_0x548e2f=_[_0xbb66('0x40')]({},_0x548e2f,_0x57b5d4[_0xbb66('0x4f')]);return _0x16b173[_0xbb66('0x4c')](_0x548e2f);}})[_0xbb66('0x27')](function(_0x3bdbdf){if(_0x3bdbdf){_0x305459=_0x3bdbdf[_0xbb66('0x3b')];if(!_0x57b5d4['query'][_0xbb66('0x50')](_0xbb66('0x3c'))){_0x548e2f[_0xbb66('0x20')]=qs[_0xbb66('0x20')](_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x20')]);_0x548e2f[_0xbb66('0x1e')]=qs[_0xbb66('0x1e')](_0x57b5d4['query'][_0xbb66('0x1e')]);}return _0x16b173[_0xbb66('0x4c')](_0x548e2f);}})[_0xbb66('0x27')](function(_0x137f70){if(_0x137f70){return _0x137f70?{'count':_0x305459,'rows':_0x137f70}:null;}})[_0xbb66('0x27')](respondWithResult(_0x3c6ffd,null))['catch'](handleError(_0x3c6ffd,null));};exports[_0xbb66('0x51')]=function(_0x1916bd,_0x24d473,_0x2fd256){var _0x32c6e1={};var _0x2377eb={};var _0x1d1b53;var _0xf0ed30;return db[_0xbb66('0x30')][_0xbb66('0x4d')]({'where':{'id':_0x1916bd[_0xbb66('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24d473,null))['then'](function(_0x138df9){if(_0x138df9){_0x1d1b53=_0x138df9;_0x2377eb[_0xbb66('0x34')]=_['keys'](db[_0xbb66('0x4e')][_0xbb66('0x31')]);_0x2377eb[_0xbb66('0x36')]=_[_0xbb66('0x35')](_0x1916bd[_0xbb66('0x36')]);_0x2377eb[_0xbb66('0x37')]=_['intersection'](_0x2377eb[_0xbb66('0x34')],_0x2377eb[_0xbb66('0x36')]);_0x32c6e1[_0xbb66('0x39')]=_[_0xbb66('0x38')](_0x2377eb[_0xbb66('0x34')],qs[_0xbb66('0x3a')](_0x1916bd['query'][_0xbb66('0x3a')]));_0x32c6e1[_0xbb66('0x39')]=_0x32c6e1[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x32c6e1['attributes']:_0x2377eb[_0xbb66('0x34')];_0x32c6e1[_0xbb66('0x52')]=qs[_0xbb66('0x3d')](_0x1916bd['query'][_0xbb66('0x3d')]);_0x32c6e1['where']=qs[_0xbb66('0x37')](_['pick'](_0x1916bd[_0xbb66('0x36')],_0x2377eb['filters']));if(_0x1916bd[_0xbb66('0x36')][_0xbb66('0x42')]){_0x32c6e1[_0xbb66('0x3e')]=_['merge'](_0x32c6e1[_0xbb66('0x3e')],{'$or':_['map'](_0x32c6e1['attributes'],function(_0x2d83ae){var _0x220de1={};_0x220de1[_0x2d83ae]={'$like':'%'+_0x1916bd[_0xbb66('0x36')][_0xbb66('0x42')]+'%'};return _0x220de1;})});}_0x32c6e1=_[_0xbb66('0x40')]({},_0x32c6e1,_0x1916bd[_0xbb66('0x4f')]);return _0x1d1b53['getSubjects'](_0x32c6e1);}})[_0xbb66('0x27')](function(_0x46a64e){if(_0x46a64e){_0xf0ed30=_0x46a64e[_0xbb66('0x3b')];if(!_0x1916bd[_0xbb66('0x36')][_0xbb66('0x50')](_0xbb66('0x3c'))){_0x32c6e1['limit']=qs[_0xbb66('0x20')](_0x1916bd[_0xbb66('0x36')][_0xbb66('0x20')]);_0x32c6e1['offset']=qs[_0xbb66('0x1e')](_0x1916bd['query'][_0xbb66('0x1e')]);}return _0x1d1b53[_0xbb66('0x51')](_0x32c6e1);}})[_0xbb66('0x27')](function(_0x215cae){if(_0x215cae){return _0x215cae?{'count':_0xf0ed30,'rows':_0x215cae}:null;}})[_0xbb66('0x27')](respondWithResult(_0x24d473,null))[_0xbb66('0x45')](handleError(_0x24d473,null));};exports['getDescriptions']=function(_0x80cf4f,_0x6e0450,_0x12e29a){var _0x17a85e={};var _0x3e9613={};var _0x20dc9d;var _0x21a46c;return db[_0xbb66('0x30')][_0xbb66('0x4d')]({'where':{'id':_0x80cf4f[_0xbb66('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6e0450,null))[_0xbb66('0x27')](function(_0x2cc9eb){if(_0x2cc9eb){_0x20dc9d=_0x2cc9eb;_0x3e9613[_0xbb66('0x34')]=_[_0xbb66('0x35')](db[_0xbb66('0x4e')][_0xbb66('0x31')]);_0x3e9613[_0xbb66('0x36')]=_['keys'](_0x80cf4f[_0xbb66('0x36')]);_0x3e9613[_0xbb66('0x37')]=_[_0xbb66('0x38')](_0x3e9613[_0xbb66('0x34')],_0x3e9613[_0xbb66('0x36')]);_0x17a85e['attributes']=_[_0xbb66('0x38')](_0x3e9613[_0xbb66('0x34')],qs['fields'](_0x80cf4f['query'][_0xbb66('0x3a')]));_0x17a85e['attributes']=_0x17a85e[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x17a85e[_0xbb66('0x39')]:_0x3e9613[_0xbb66('0x34')];_0x17a85e[_0xbb66('0x52')]=qs[_0xbb66('0x3d')](_0x80cf4f['query'][_0xbb66('0x3d')]);_0x17a85e[_0xbb66('0x3e')]=qs[_0xbb66('0x37')](_[_0xbb66('0x3f')](_0x80cf4f['query'],_0x3e9613[_0xbb66('0x37')]));if(_0x80cf4f[_0xbb66('0x36')]['filter']){_0x17a85e['where']=_['merge'](_0x17a85e[_0xbb66('0x3e')],{'$or':_[_0xbb66('0x2f')](_0x17a85e[_0xbb66('0x39')],function(_0xfba205){var _0x578cbd={};_0x578cbd[_0xfba205]={'$like':'%'+_0x80cf4f[_0xbb66('0x36')][_0xbb66('0x42')]+'%'};return _0x578cbd;})});}_0x17a85e=_[_0xbb66('0x40')]({},_0x17a85e,_0x80cf4f[_0xbb66('0x4f')]);return _0x20dc9d[_0xbb66('0x53')](_0x17a85e);}})[_0xbb66('0x27')](function(_0xcd7770){if(_0xcd7770){_0x21a46c=_0xcd7770[_0xbb66('0x3b')];if(!_0x80cf4f[_0xbb66('0x36')]['hasOwnProperty'](_0xbb66('0x3c'))){_0x17a85e[_0xbb66('0x20')]=qs['limit'](_0x80cf4f['query'][_0xbb66('0x20')]);_0x17a85e[_0xbb66('0x1e')]=qs[_0xbb66('0x1e')](_0x80cf4f[_0xbb66('0x36')]['offset']);}return _0x20dc9d[_0xbb66('0x53')](_0x17a85e);}})['then'](function(_0x47e777){if(_0x47e777){return _0x47e777?{'count':_0x21a46c,'rows':_0x47e777}:null;}})[_0xbb66('0x27')](respondWithResult(_0x6e0450,null))[_0xbb66('0x45')](handleError(_0x6e0450,null));}; \ No newline at end of file +var _0xb812=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','undefined','limit','json','apply','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','show','options','catch','create','body','find','params','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x51b4b3,_0x20434f){var _0x8fe390=function(_0x1a6561){while(--_0x1a6561){_0x51b4b3['push'](_0x51b4b3['shift']());}};_0x8fe390(++_0x20434f);}(_0xb812,0x117));var _0x2b81=function(_0xd86b7b,_0x4d5cd4){_0xd86b7b=_0xd86b7b-0x0;var _0x2baaea=_0xb812[_0xd86b7b];return _0x2baaea;};'use strict';var emlformat=require(_0x2b81('0x0'));var rimraf=require(_0x2b81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b81('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b81('0x3'));var Mustache=require(_0x2b81('0x4'));var util=require('util');var path=require(_0x2b81('0x5'));var sox=require(_0x2b81('0x6'));var csv=require(_0x2b81('0x7'));var ejs=require(_0x2b81('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b81('0x9'));var squel=require(_0x2b81('0xa'));var crypto=require(_0x2b81('0xb'));var jsforce=require(_0x2b81('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2b81('0x7'));var querystring=require(_0x2b81('0xd'));var Papa=require(_0x2b81('0xe'));var Redis=require(_0x2b81('0xf'));var authService=require(_0x2b81('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2b81('0x11'));var hardwareService=require(_0x2b81('0x12'));var logger=require(_0x2b81('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2b81('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c0ba,_0x64ab67){_0x64ab67=_0x64ab67||0xcc;return function(_0xcad6dc){if(_0xcad6dc){return _0x14c0ba[_0x2b81('0x15')](_0x64ab67);}return _0x14c0ba[_0x2b81('0x16')](_0x64ab67)[_0x2b81('0x17')]();};}function respondWithResult(_0x5d5f34,_0x2929cf){_0x2929cf=_0x2929cf||0xc8;return function(_0x49de89){if(_0x49de89){return _0x5d5f34[_0x2b81('0x16')](_0x2929cf)['json'](_0x49de89);}};}function respondWithFilteredResult(_0x2bbbf,_0x1e9770){return function(_0x903c63){if(_0x903c63){var _0x6b1df4=typeof _0x1e9770[_0x2b81('0x18')]===_0x2b81('0x19')&&typeof _0x1e9770[_0x2b81('0x1a')]===_0x2b81('0x19');var _0xc78c2b=_0x903c63['count'];var _0x52a51d=_0x6b1df4?0x0:_0x1e9770['offset'];var _0x4a4ee0=_0x6b1df4?_0x903c63['count']:_0x1e9770[_0x2b81('0x18')]+_0x1e9770[_0x2b81('0x1a')];var _0x51bbae;if(_0x4a4ee0>=_0xc78c2b){_0x4a4ee0=_0xc78c2b;_0x51bbae=0xc8;}else{_0x51bbae=0xce;}_0x2bbbf[_0x2b81('0x16')](_0x51bbae);return _0x2bbbf['set']('Content-Range',_0x52a51d+'-'+_0x4a4ee0+'/'+_0xc78c2b)[_0x2b81('0x1b')](_0x903c63);}return null;};}function patchUpdates(_0x172fc3){return function(_0x3e614b){try{jsonpatch[_0x2b81('0x1c')](_0x3e614b,_0x172fc3,!![]);}catch(_0x2d7bb8){return BPromise['reject'](_0x2d7bb8);}return _0x3e614b['save']();};}function saveUpdates(_0x4a135f,_0x390ac2){return function(_0x42527f){if(_0x42527f){return _0x42527f[_0x2b81('0x1d')](_0x4a135f)[_0x2b81('0x1e')](function(_0x1e6390){return _0x1e6390;});}return null;};}function removeEntity(_0x1014a9,_0x9de082){return function(_0x418cc2){if(_0x418cc2){return _0x418cc2[_0x2b81('0x1f')]()[_0x2b81('0x1e')](function(){_0x1014a9[_0x2b81('0x16')](0xcc)[_0x2b81('0x17')]();});}};}function handleEntityNotFound(_0x4c2b0a,_0x1c3d34){return function(_0x3e9b7c){if(!_0x3e9b7c){_0x4c2b0a[_0x2b81('0x15')](0x194);}return _0x3e9b7c;};}function handleError(_0x189d14,_0x388b8f){_0x388b8f=_0x388b8f||0x1f4;return function(_0x759957){logger[_0x2b81('0x20')](_0x759957[_0x2b81('0x21')]);if(_0x759957['name']){delete _0x759957[_0x2b81('0x22')];}_0x189d14[_0x2b81('0x16')](_0x388b8f)[_0x2b81('0x23')](_0x759957);};}exports[_0x2b81('0x24')]=function(_0x9f660,_0xdef496){var _0x19d94c={},_0x55d808={},_0x4b4b4f={'count':0x0,'rows':[]};var _0x44d34a=_[_0x2b81('0x25')](db[_0x2b81('0x26')][_0x2b81('0x27')],function(_0x122528){return{'name':_0x122528[_0x2b81('0x28')],'type':_0x122528[_0x2b81('0x29')]['key']};});_0x55d808[_0x2b81('0x2a')]=_[_0x2b81('0x25')](_0x44d34a,'name');_0x55d808[_0x2b81('0x2b')]=_[_0x2b81('0x2c')](_0x9f660[_0x2b81('0x2b')]);_0x55d808[_0x2b81('0x2d')]=_[_0x2b81('0x2e')](_0x55d808[_0x2b81('0x2a')],_0x55d808['query']);_0x19d94c[_0x2b81('0x2f')]=_[_0x2b81('0x2e')](_0x55d808[_0x2b81('0x2a')],qs['fields'](_0x9f660[_0x2b81('0x2b')][_0x2b81('0x30')]));_0x19d94c[_0x2b81('0x2f')]=_0x19d94c['attributes'][_0x2b81('0x31')]?_0x19d94c['attributes']:_0x55d808[_0x2b81('0x2a')];if(!_0x9f660[_0x2b81('0x2b')][_0x2b81('0x32')]('nolimit')){_0x19d94c['limit']=qs[_0x2b81('0x1a')](_0x9f660[_0x2b81('0x2b')][_0x2b81('0x1a')]);_0x19d94c[_0x2b81('0x18')]=qs['offset'](_0x9f660[_0x2b81('0x2b')]['offset']);}_0x19d94c[_0x2b81('0x33')]=qs['sort'](_0x9f660['query'][_0x2b81('0x34')]);_0x19d94c[_0x2b81('0x35')]=qs['filters'](_[_0x2b81('0x36')](_0x9f660[_0x2b81('0x2b')],_0x55d808['filters']),_0x44d34a);if(_0x9f660['query'][_0x2b81('0x37')]){_0x19d94c['where']=_[_0x2b81('0x38')](_0x19d94c[_0x2b81('0x35')],{'$or':_[_0x2b81('0x25')](_0x44d34a,function(_0xa8e654){if(_0xa8e654[_0x2b81('0x29')]!==_0x2b81('0x39')){var _0x246ec0={};_0x246ec0[_0xa8e654[_0x2b81('0x22')]]={'$like':'%'+_0x9f660[_0x2b81('0x2b')][_0x2b81('0x37')]+'%'};return _0x246ec0;}})});}_0x19d94c=_[_0x2b81('0x38')]({},_0x19d94c,_0x9f660['options']);var _0x2d068e={'where':_0x19d94c['where']};return db['ServicenowConfiguration'][_0x2b81('0x3a')](_0x2d068e)[_0x2b81('0x1e')](function(_0x305201){_0x4b4b4f['count']=_0x305201;if(_0x9f660[_0x2b81('0x2b')][_0x2b81('0x3b')]){_0x19d94c[_0x2b81('0x3c')]=[{'all':!![]}];}return db[_0x2b81('0x26')]['findAll'](_0x19d94c);})['then'](function(_0x563c84){_0x4b4b4f[_0x2b81('0x3d')]=_0x563c84;return _0x4b4b4f;})['then'](respondWithFilteredResult(_0xdef496,_0x19d94c))['catch'](handleError(_0xdef496,null));};exports[_0x2b81('0x3e')]=function(_0x41d245,_0x48d965){var _0x16122c={'raw':![],'where':{'id':_0x41d245['params']['id']}},_0x2cc151={};_0x2cc151[_0x2b81('0x2a')]=_[_0x2b81('0x2c')](db[_0x2b81('0x26')][_0x2b81('0x27')]);_0x2cc151[_0x2b81('0x2b')]=_[_0x2b81('0x2c')](_0x41d245[_0x2b81('0x2b')]);_0x2cc151[_0x2b81('0x2d')]=_[_0x2b81('0x2e')](_0x2cc151[_0x2b81('0x2a')],_0x2cc151[_0x2b81('0x2b')]);_0x16122c[_0x2b81('0x2f')]=_[_0x2b81('0x2e')](_0x2cc151[_0x2b81('0x2a')],qs[_0x2b81('0x30')](_0x41d245['query'][_0x2b81('0x30')]));_0x16122c[_0x2b81('0x2f')]=_0x16122c[_0x2b81('0x2f')][_0x2b81('0x31')]?_0x16122c['attributes']:_0x2cc151[_0x2b81('0x2a')];if(_0x41d245['query'][_0x2b81('0x3b')]){_0x16122c[_0x2b81('0x3c')]=[{'all':!![]}];}_0x16122c=_[_0x2b81('0x38')]({},_0x16122c,_0x41d245[_0x2b81('0x3f')]);return db[_0x2b81('0x26')]['find'](_0x16122c)[_0x2b81('0x1e')](handleEntityNotFound(_0x48d965,null))['then'](respondWithResult(_0x48d965,null))[_0x2b81('0x40')](handleError(_0x48d965,null));};exports[_0x2b81('0x41')]=function(_0x438964,_0x5ab456){return db['ServicenowConfiguration']['create'](_0x438964['body'],{})[_0x2b81('0x1e')](respondWithResult(_0x5ab456,0xc9))['catch'](handleError(_0x5ab456,null));};exports[_0x2b81('0x1d')]=function(_0xf0653d,_0x3ca55d){if(_0xf0653d[_0x2b81('0x42')]['id']){delete _0xf0653d[_0x2b81('0x42')]['id'];}return db[_0x2b81('0x26')][_0x2b81('0x43')]({'where':{'id':_0xf0653d[_0x2b81('0x44')]['id']}})[_0x2b81('0x1e')](handleEntityNotFound(_0x3ca55d,null))[_0x2b81('0x1e')](saveUpdates(_0xf0653d[_0x2b81('0x42')],null))['then'](respondWithResult(_0x3ca55d,null))[_0x2b81('0x40')](handleError(_0x3ca55d,null));};exports[_0x2b81('0x1f')]=function(_0x378942,_0x1dbf4f){return db[_0x2b81('0x26')]['find']({'where':{'id':_0x378942[_0x2b81('0x44')]['id']}})[_0x2b81('0x1e')](handleEntityNotFound(_0x1dbf4f,null))['then'](removeEntity(_0x1dbf4f,null))[_0x2b81('0x40')](handleError(_0x1dbf4f,null));};exports[_0x2b81('0x45')]=function(_0x4b6b14,_0x3d490b,_0x57f648){var _0x513eaf={};var _0xc4ce3c={};var _0x423511;var _0x442fc4;return db['ServicenowConfiguration'][_0x2b81('0x46')]({'where':{'id':_0x4b6b14[_0x2b81('0x44')]['id']}})[_0x2b81('0x1e')](handleEntityNotFound(_0x3d490b,null))['then'](function(_0x5a4027){if(_0x5a4027){_0x423511=_0x5a4027;_0xc4ce3c[_0x2b81('0x2a')]=_[_0x2b81('0x2c')](db[_0x2b81('0x47')][_0x2b81('0x27')]);_0xc4ce3c[_0x2b81('0x2b')]=_[_0x2b81('0x2c')](_0x4b6b14[_0x2b81('0x2b')]);_0xc4ce3c[_0x2b81('0x2d')]=_[_0x2b81('0x2e')](_0xc4ce3c[_0x2b81('0x2a')],_0xc4ce3c['query']);_0x513eaf['attributes']=_['intersection'](_0xc4ce3c['model'],qs[_0x2b81('0x30')](_0x4b6b14['query'][_0x2b81('0x30')]));_0x513eaf['attributes']=_0x513eaf[_0x2b81('0x2f')]['length']?_0x513eaf[_0x2b81('0x2f')]:_0xc4ce3c[_0x2b81('0x2a')];_0x513eaf[_0x2b81('0x33')]=qs[_0x2b81('0x34')](_0x4b6b14['query'][_0x2b81('0x34')]);_0x513eaf['where']=qs[_0x2b81('0x2d')](_[_0x2b81('0x36')](_0x4b6b14[_0x2b81('0x2b')],_0xc4ce3c[_0x2b81('0x2d')]));if(_0x4b6b14[_0x2b81('0x2b')][_0x2b81('0x37')]){_0x513eaf[_0x2b81('0x35')]=_[_0x2b81('0x38')](_0x513eaf['where'],{'$or':_[_0x2b81('0x25')](_0x513eaf[_0x2b81('0x2f')],function(_0x142d6d){var _0x2f3eed={};_0x2f3eed[_0x142d6d]={'$like':'%'+_0x4b6b14[_0x2b81('0x2b')][_0x2b81('0x37')]+'%'};return _0x2f3eed;})});}_0x513eaf=_['merge']({},_0x513eaf,_0x4b6b14['options']);return _0x423511[_0x2b81('0x45')](_0x513eaf);}})[_0x2b81('0x1e')](function(_0x289b17){if(_0x289b17){_0x442fc4=_0x289b17[_0x2b81('0x31')];if(!_0x4b6b14['query'][_0x2b81('0x32')]('nolimit')){_0x513eaf[_0x2b81('0x1a')]=qs[_0x2b81('0x1a')](_0x4b6b14['query'][_0x2b81('0x1a')]);_0x513eaf[_0x2b81('0x18')]=qs[_0x2b81('0x18')](_0x4b6b14[_0x2b81('0x2b')]['offset']);}return _0x423511[_0x2b81('0x45')](_0x513eaf);}})[_0x2b81('0x1e')](function(_0x343dc3){if(_0x343dc3){return _0x343dc3?{'count':_0x442fc4,'rows':_0x343dc3}:null;}})['then'](respondWithResult(_0x3d490b,null))[_0x2b81('0x40')](handleError(_0x3d490b,null));};exports[_0x2b81('0x48')]=function(_0x3d081c,_0x38550d,_0x22049c){var _0x2d827d={};var _0x4114ed={};var _0x144851;var _0x450aee;return db[_0x2b81('0x26')][_0x2b81('0x46')]({'where':{'id':_0x3d081c[_0x2b81('0x44')]['id']}})[_0x2b81('0x1e')](handleEntityNotFound(_0x38550d,null))[_0x2b81('0x1e')](function(_0x3a37f8){if(_0x3a37f8){_0x144851=_0x3a37f8;_0x4114ed[_0x2b81('0x2a')]=_['keys'](db[_0x2b81('0x47')]['rawAttributes']);_0x4114ed['query']=_[_0x2b81('0x2c')](_0x3d081c[_0x2b81('0x2b')]);_0x4114ed['filters']=_[_0x2b81('0x2e')](_0x4114ed[_0x2b81('0x2a')],_0x4114ed[_0x2b81('0x2b')]);_0x2d827d[_0x2b81('0x2f')]=_[_0x2b81('0x2e')](_0x4114ed[_0x2b81('0x2a')],qs[_0x2b81('0x30')](_0x3d081c[_0x2b81('0x2b')][_0x2b81('0x30')]));_0x2d827d[_0x2b81('0x2f')]=_0x2d827d[_0x2b81('0x2f')][_0x2b81('0x31')]?_0x2d827d[_0x2b81('0x2f')]:_0x4114ed[_0x2b81('0x2a')];_0x2d827d[_0x2b81('0x33')]=qs[_0x2b81('0x34')](_0x3d081c['query']['sort']);_0x2d827d[_0x2b81('0x35')]=qs[_0x2b81('0x2d')](_[_0x2b81('0x36')](_0x3d081c[_0x2b81('0x2b')],_0x4114ed[_0x2b81('0x2d')]));if(_0x3d081c[_0x2b81('0x2b')][_0x2b81('0x37')]){_0x2d827d[_0x2b81('0x35')]=_[_0x2b81('0x38')](_0x2d827d[_0x2b81('0x35')],{'$or':_[_0x2b81('0x25')](_0x2d827d[_0x2b81('0x2f')],function(_0x1cf62b){var _0x2c65d9={};_0x2c65d9[_0x1cf62b]={'$like':'%'+_0x3d081c[_0x2b81('0x2b')]['filter']+'%'};return _0x2c65d9;})});}_0x2d827d=_[_0x2b81('0x38')]({},_0x2d827d,_0x3d081c[_0x2b81('0x3f')]);return _0x144851['getSubjects'](_0x2d827d);}})[_0x2b81('0x1e')](function(_0x39b43f){if(_0x39b43f){_0x450aee=_0x39b43f[_0x2b81('0x31')];if(!_0x3d081c[_0x2b81('0x2b')][_0x2b81('0x32')]('nolimit')){_0x2d827d[_0x2b81('0x1a')]=qs[_0x2b81('0x1a')](_0x3d081c['query'][_0x2b81('0x1a')]);_0x2d827d['offset']=qs[_0x2b81('0x18')](_0x3d081c[_0x2b81('0x2b')][_0x2b81('0x18')]);}return _0x144851['getSubjects'](_0x2d827d);}})[_0x2b81('0x1e')](function(_0x150112){if(_0x150112){return _0x150112?{'count':_0x450aee,'rows':_0x150112}:null;}})['then'](respondWithResult(_0x38550d,null))[_0x2b81('0x40')](handleError(_0x38550d,null));};exports[_0x2b81('0x49')]=function(_0x308c07,_0x25c962,_0x572e77){var _0x18dc51={};var _0x3f283d={};var _0x866a18;var _0x334dbb;return db[_0x2b81('0x26')][_0x2b81('0x46')]({'where':{'id':_0x308c07[_0x2b81('0x44')]['id']}})[_0x2b81('0x1e')](handleEntityNotFound(_0x25c962,null))[_0x2b81('0x1e')](function(_0x37cf10){if(_0x37cf10){_0x866a18=_0x37cf10;_0x3f283d[_0x2b81('0x2a')]=_[_0x2b81('0x2c')](db[_0x2b81('0x47')][_0x2b81('0x27')]);_0x3f283d['query']=_['keys'](_0x308c07[_0x2b81('0x2b')]);_0x3f283d[_0x2b81('0x2d')]=_[_0x2b81('0x2e')](_0x3f283d[_0x2b81('0x2a')],_0x3f283d[_0x2b81('0x2b')]);_0x18dc51['attributes']=_['intersection'](_0x3f283d[_0x2b81('0x2a')],qs['fields'](_0x308c07[_0x2b81('0x2b')][_0x2b81('0x30')]));_0x18dc51[_0x2b81('0x2f')]=_0x18dc51[_0x2b81('0x2f')][_0x2b81('0x31')]?_0x18dc51['attributes']:_0x3f283d[_0x2b81('0x2a')];_0x18dc51['order']=qs[_0x2b81('0x34')](_0x308c07[_0x2b81('0x2b')][_0x2b81('0x34')]);_0x18dc51[_0x2b81('0x35')]=qs['filters'](_['pick'](_0x308c07[_0x2b81('0x2b')],_0x3f283d[_0x2b81('0x2d')]));if(_0x308c07[_0x2b81('0x2b')][_0x2b81('0x37')]){_0x18dc51[_0x2b81('0x35')]=_[_0x2b81('0x38')](_0x18dc51[_0x2b81('0x35')],{'$or':_[_0x2b81('0x25')](_0x18dc51[_0x2b81('0x2f')],function(_0x37d3da){var _0x4797c4={};_0x4797c4[_0x37d3da]={'$like':'%'+_0x308c07[_0x2b81('0x2b')][_0x2b81('0x37')]+'%'};return _0x4797c4;})});}_0x18dc51=_[_0x2b81('0x38')]({},_0x18dc51,_0x308c07[_0x2b81('0x3f')]);return _0x866a18['getDescriptions'](_0x18dc51);}})[_0x2b81('0x1e')](function(_0x5b1210){if(_0x5b1210){_0x334dbb=_0x5b1210[_0x2b81('0x31')];if(!_0x308c07[_0x2b81('0x2b')][_0x2b81('0x32')]('nolimit')){_0x18dc51['limit']=qs[_0x2b81('0x1a')](_0x308c07[_0x2b81('0x2b')][_0x2b81('0x1a')]);_0x18dc51[_0x2b81('0x18')]=qs[_0x2b81('0x18')](_0x308c07['query']['offset']);}return _0x866a18[_0x2b81('0x49')](_0x18dc51);}})['then'](function(_0x45211d){if(_0x45211d){return _0x45211d?{'count':_0x334dbb,'rows':_0x45211d}:null;}})[_0x2b81('0x1e')](respondWithResult(_0x25c962,null))[_0x2b81('0x40')](handleError(_0x25c962,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a4bcd73..c45f5cf 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 _0xea5b=['bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xea5b,0x152));var _0xbea5=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xea5b[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var logger=require(_0xbea5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbea5('0x3'));var rp=require(_0xbea5('0x4'));var fs=require('fs');var path=require(_0xbea5('0x5'));var rimraf=require(_0xbea5('0x6'));var config=require('../../config/environment');var attributes=require(_0xbea5('0x7'));module['exports']=function(_0x2db67a,_0x3d9263){return _0x2db67a[_0xbea5('0x8')](_0xbea5('0x9'),attributes,{'tableName':_0xbea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75dc=['int_servicenow_configurations','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x75dc,0x1d7));var _0xc75d=function(_0x4c9be7,_0x538b4d){_0x4c9be7=_0x4c9be7-0x0;var _0x5250a7=_0x75dc[_0x4c9be7];return _0x5250a7;};'use strict';var _=require(_0xc75d('0x0'));var util=require(_0xc75d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc75d('0x2'));var rp=require(_0xc75d('0x3'));var fs=require('fs');var path=require(_0xc75d('0x4'));var rimraf=require(_0xc75d('0x5'));var config=require(_0xc75d('0x6'));var attributes=require(_0xc75d('0x7'));module['exports']=function(_0x3428f0,_0x1db578){return _0x3428f0[_0xc75d('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xc75d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index b055b84..1fd68ad 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 _0x7313=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7313,0x1f1));var _0x3731=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7313[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x3731('0x0'));var util=require(_0x3731('0x1'));var moment=require(_0x3731('0x2'));var BPromise=require(_0x3731('0x3'));var rs=require(_0x3731('0x4'));var fs=require('fs');var Redis=require(_0x3731('0x5'));var db=require(_0x3731('0x6'))['db'];var utils=require(_0x3731('0x7'));var logger=require(_0x3731('0x8'))('rpc');var config=require(_0x3731('0x9'));var jayson=require(_0x3731('0xa'));var client=jayson[_0x3731('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f34c8,_0x262372,_0x78a2c1){return new BPromise(function(_0x4e3166,_0x5a9fd5){return client['request'](_0x4f34c8,_0x78a2c1)['then'](function(_0x4f7d33){logger[_0x3731('0xc')](_0x3731('0xd'),_0x262372,_0x3731('0xe'));logger['debug'](_0x3731('0xf'),_0x262372,_0x3731('0xe'),JSON[_0x3731('0x10')](_0x4f7d33));if(_0x4f7d33[_0x3731('0x11')]){if(_0x4f7d33[_0x3731('0x11')][_0x3731('0x12')]===0x1f4){logger[_0x3731('0x11')](_0x3731('0xd'),_0x262372,_0x4f7d33[_0x3731('0x11')]['message']);return _0x5a9fd5(_0x4f7d33[_0x3731('0x11')][_0x3731('0x13')]);}logger[_0x3731('0x11')](_0x3731('0xd'),_0x262372,_0x4f7d33[_0x3731('0x11')][_0x3731('0x13')]);return _0x4e3166(_0x4f7d33[_0x3731('0x11')][_0x3731('0x13')]);}else{logger[_0x3731('0xc')](_0x3731('0xd'),_0x262372,'request\x20sent');_0x4e3166(_0x4f7d33[_0x3731('0x14')][_0x3731('0x13')]);}})['catch'](function(_0x5aa8b8){logger[_0x3731('0x11')](_0x3731('0xd'),_0x262372,_0x5aa8b8);_0x5a9fd5(_0x5aa8b8);});});} \ No newline at end of file +var _0xa17b=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x753277,_0xc79c4b){var _0x5dc382=function(_0x2f65fb){while(--_0x2f65fb){_0x753277['push'](_0x753277['shift']());}};_0x5dc382(++_0xc79c4b);}(_0xa17b,0xbf));var _0xba17=function(_0x36f43c,_0x2292d7){_0x36f43c=_0x36f43c-0x0;var _0x585646=_0xa17b[_0x36f43c];return _0x585646;};'use strict';var _=require(_0xba17('0x0'));var util=require(_0xba17('0x1'));var moment=require(_0xba17('0x2'));var BPromise=require(_0xba17('0x3'));var rs=require(_0xba17('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba17('0x5'))['db'];var utils=require(_0xba17('0x6'));var logger=require(_0xba17('0x7'))(_0xba17('0x8'));var config=require(_0xba17('0x9'));var jayson=require(_0xba17('0xa'));var client=jayson[_0xba17('0xb')][_0xba17('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x270af8,_0x19c3c8,_0x12b141){return new BPromise(function(_0x2b90bf,_0x50a0d8){return client[_0xba17('0xd')](_0x270af8,_0x12b141)['then'](function(_0x461988){logger[_0xba17('0xe')](_0xba17('0xf'),_0x19c3c8,_0xba17('0x10'));logger['debug'](_0xba17('0x11'),_0x19c3c8,_0xba17('0x10'),JSON[_0xba17('0x12')](_0x461988));if(_0x461988[_0xba17('0x13')]){if(_0x461988[_0xba17('0x13')][_0xba17('0x14')]===0x1f4){logger['error'](_0xba17('0xf'),_0x19c3c8,_0x461988[_0xba17('0x13')][_0xba17('0x15')]);return _0x50a0d8(_0x461988[_0xba17('0x13')][_0xba17('0x15')]);}logger['error'](_0xba17('0xf'),_0x19c3c8,_0x461988[_0xba17('0x13')]['message']);return _0x2b90bf(_0x461988['error'][_0xba17('0x15')]);}else{logger['info'](_0xba17('0xf'),_0x19c3c8,_0xba17('0x10'));_0x2b90bf(_0x461988[_0xba17('0x16')][_0xba17('0x15')]);}})[_0xba17('0x17')](function(_0x14a972){logger[_0xba17('0x13')](_0xba17('0xf'),_0x19c3c8,_0x14a972);_0x50a0d8(_0x14a972);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3bb7432..04a7cfb 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 _0xcb0e=['post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4c8c0d,_0x4e9d39){var _0x5a7843=function(_0x4d1220){while(--_0x4d1220){_0x4c8c0d['push'](_0x4c8c0d['shift']());}};_0x5a7843(++_0x4e9d39);}(_0xcb0e,0x140));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xecb0('0x0'));var util=require(_0xecb0('0x1'));var path=require(_0xecb0('0x2'));var timeout=require(_0xecb0('0x3'));var express=require(_0xecb0('0x4'));var router=express[_0xecb0('0x5')]();var fs_extra=require(_0xecb0('0x6'));var auth=require(_0xecb0('0x7'));var interaction=require(_0xecb0('0x8'));var config=require(_0xecb0('0x9'));var controller=require(_0xecb0('0xa'));router[_0xecb0('0xb')]('/',auth['isAuthenticated'](),controller[_0xecb0('0xc')]);router[_0xecb0('0xb')](_0xecb0('0xd'),auth[_0xecb0('0xe')](),controller[_0xecb0('0xf')]);router[_0xecb0('0x10')]('/',auth[_0xecb0('0xe')](),controller[_0xecb0('0x11')]);router['put'](_0xecb0('0xd'),auth[_0xecb0('0xe')](),controller['update']);router[_0xecb0('0x12')]('/:id',auth[_0xecb0('0xe')](),controller[_0xecb0('0x13')]);module[_0xecb0('0x14')]=router; \ No newline at end of file +var _0xa32f=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','create','update','delete'];(function(_0x220363,_0x18c0f2){var _0x58b2cd=function(_0x39f212){while(--_0x39f212){_0x220363['push'](_0x220363['shift']());}};_0x58b2cd(++_0x18c0f2);}(_0xa32f,0x91));var _0xfa32=function(_0x1d1c8f,_0x114121){_0x1d1c8f=_0x1d1c8f-0x0;var _0x56b576=_0xa32f[_0x1d1c8f];return _0x56b576;};'use strict';var multer=require(_0xfa32('0x0'));var util=require(_0xfa32('0x1'));var path=require(_0xfa32('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa32('0x3'));var router=express[_0xfa32('0x4')]();var fs_extra=require(_0xfa32('0x5'));var auth=require(_0xfa32('0x6'));var interaction=require(_0xfa32('0x7'));var config=require(_0xfa32('0x8'));var controller=require(_0xfa32('0x9'));router[_0xfa32('0xa')]('/',auth[_0xfa32('0xb')](),controller[_0xfa32('0xc')]);router['get'](_0xfa32('0xd'),auth[_0xfa32('0xb')](),controller['show']);router['post']('/',auth[_0xfa32('0xb')](),controller[_0xfa32('0xe')]);router['put'](_0xfa32('0xd'),auth['isAuthenticated'](),controller[_0xfa32('0xf')]);router[_0xfa32('0x10')]('/:id',auth[_0xfa32('0xb')](),controller[_0xfa32('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f23c2bd..ce3b155 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 _0x7b1f=['STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x7b1f,0xd5));var _0xf7b1=function(_0x303238,_0x43cfae){_0x303238=_0x303238-0x0;var _0x86d7cc=_0x7b1f[_0x303238];return _0x86d7cc;};'use strict';var Sequelize=require(_0xf7b1('0x0'));module[_0xf7b1('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf7b1('0x2'),_0xf7b1('0x3'),_0xf7b1('0x4'),_0xf7b1('0x5')),'defaultValue':_0xf7b1('0x6')},'content':{'type':Sequelize[_0xf7b1('0x7')]},'key':{'type':Sequelize[_0xf7b1('0x7')]},'keyType':{'type':Sequelize[_0xf7b1('0x8')](_0xf7b1('0x6'),_0xf7b1('0x2'),_0xf7b1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf7b1('0x7')]},'nameField':{'type':Sequelize[_0xf7b1('0x7')]},'customField':{'type':Sequelize[_0xf7b1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7b1('0x7')]}}; \ No newline at end of file +var _0xe2a2=['ENUM','BOOLEAN','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x15b983,_0x2f136f){var _0xda579=function(_0x5ae752){while(--_0x5ae752){_0x15b983['push'](_0x15b983['shift']());}};_0xda579(++_0x2f136f);}(_0xe2a2,0x1da));var _0x2e2a=function(_0x44a11d,_0x5258d4){_0x44a11d=_0x44a11d-0x0;var _0x51f1c4=_0xe2a2[_0x44a11d];return _0x51f1c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x2e2a('0x0'),_0x2e2a('0x1'),_0x2e2a('0x2'),_0x2e2a('0x3')),'defaultValue':_0x2e2a('0x4')},'content':{'type':Sequelize[_0x2e2a('0x5')]},'key':{'type':Sequelize[_0x2e2a('0x5')]},'keyType':{'type':Sequelize[_0x2e2a('0x6')](_0x2e2a('0x4'),_0x2e2a('0x0'),_0x2e2a('0x1'))},'keyContent':{'type':Sequelize[_0x2e2a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2e2a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2e2a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3b2b996..64052c2 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 _0x3cdc=['findAll','rows','show','keys','rawAttributes','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','end','error','stack','name','send','map','ServicenowField','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include'];(function(_0x9f52ba,_0x341e38){var _0x549af4=function(_0x1adcd1){while(--_0x1adcd1){_0x9f52ba['push'](_0x9f52ba['shift']());}};_0x549af4(++_0x341e38);}(_0x3cdc,0x177));var _0xc3cd=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x3cdc[_0x3b7a0c];return _0x3bb70f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3cd('0x0'));var jsonpatch=require(_0xc3cd('0x1'));var rp=require(_0xc3cd('0x2'));var moment=require(_0xc3cd('0x3'));var BPromise=require(_0xc3cd('0x4'));var Mustache=require(_0xc3cd('0x5'));var util=require('util');var path=require(_0xc3cd('0x6'));var sox=require(_0xc3cd('0x7'));var csv=require(_0xc3cd('0x8'));var ejs=require(_0xc3cd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3cd('0xa'));var squel=require(_0xc3cd('0xb'));var crypto=require(_0xc3cd('0xc'));var jsforce=require(_0xc3cd('0xd'));var deskjs=require(_0xc3cd('0xe'));var toCsv=require(_0xc3cd('0x8'));var querystring=require(_0xc3cd('0xf'));var Papa=require(_0xc3cd('0x10'));var Redis=require(_0xc3cd('0x11'));var authService=require(_0xc3cd('0x12'));var qs=require(_0xc3cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3cd('0x14'));var utils=require('../../config/utils');var config=require(_0xc3cd('0x15'));var licenseUtil=require(_0xc3cd('0x16'));var db=require(_0xc3cd('0x17'))['db'];function respondWithStatusCode(_0x33338a,_0x250724){_0x250724=_0x250724||0xcc;return function(_0x1aad81){if(_0x1aad81){return _0x33338a[_0xc3cd('0x18')](_0x250724);}return _0x33338a[_0xc3cd('0x19')](_0x250724)['end']();};}function respondWithResult(_0xefcde7,_0x1d870d){_0x1d870d=_0x1d870d||0xc8;return function(_0x1af871){if(_0x1af871){return _0xefcde7[_0xc3cd('0x19')](_0x1d870d)[_0xc3cd('0x1a')](_0x1af871);}};}function respondWithFilteredResult(_0x3e4243,_0xaad00a){return function(_0x340af9){if(_0x340af9){var _0x356592=typeof _0xaad00a[_0xc3cd('0x1b')]===_0xc3cd('0x1c')&&typeof _0xaad00a[_0xc3cd('0x1d')]==='undefined';var _0x3a0c0b=_0x340af9[_0xc3cd('0x1e')];var _0x5a1e64=_0x356592?0x0:_0xaad00a[_0xc3cd('0x1b')];var _0x539a81=_0x356592?_0x340af9[_0xc3cd('0x1e')]:_0xaad00a[_0xc3cd('0x1b')]+_0xaad00a[_0xc3cd('0x1d')];var _0x3c32c7;if(_0x539a81>=_0x3a0c0b){_0x539a81=_0x3a0c0b;_0x3c32c7=0xc8;}else{_0x3c32c7=0xce;}_0x3e4243[_0xc3cd('0x19')](_0x3c32c7);return _0x3e4243[_0xc3cd('0x1f')]('Content-Range',_0x5a1e64+'-'+_0x539a81+'/'+_0x3a0c0b)[_0xc3cd('0x1a')](_0x340af9);}return null;};}function patchUpdates(_0x4be42a){return function(_0x862813){try{jsonpatch[_0xc3cd('0x20')](_0x862813,_0x4be42a,!![]);}catch(_0x12cffc){return BPromise['reject'](_0x12cffc);}return _0x862813['save']();};}function saveUpdates(_0x58906c,_0x41dca3){return function(_0x4cb219){if(_0x4cb219){return _0x4cb219[_0xc3cd('0x21')](_0x58906c)[_0xc3cd('0x22')](function(_0x1b0220){return _0x1b0220;});}return null;};}function removeEntity(_0x47fbcb,_0x3034ee){return function(_0x516be2){if(_0x516be2){return _0x516be2[_0xc3cd('0x23')]()[_0xc3cd('0x22')](function(){_0x47fbcb[_0xc3cd('0x19')](0xcc)[_0xc3cd('0x24')]();});}};}function handleEntityNotFound(_0x3d2170,_0x2a14df){return function(_0x5bf191){if(!_0x5bf191){_0x3d2170[_0xc3cd('0x18')](0x194);}return _0x5bf191;};}function handleError(_0x5dcf02,_0x26bfc0){_0x26bfc0=_0x26bfc0||0x1f4;return function(_0x54ac48){logger[_0xc3cd('0x25')](_0x54ac48[_0xc3cd('0x26')]);if(_0x54ac48[_0xc3cd('0x27')]){delete _0x54ac48['name'];}_0x5dcf02['status'](_0x26bfc0)[_0xc3cd('0x28')](_0x54ac48);};}exports['index']=function(_0x420658,_0x10321b){var _0x2de57a={},_0x339782={},_0x5588b7={'count':0x0,'rows':[]};var _0x1b3449=_[_0xc3cd('0x29')](db[_0xc3cd('0x2a')]['rawAttributes'],function(_0x1464ef){return{'name':_0x1464ef[_0xc3cd('0x2b')],'type':_0x1464ef['type'][_0xc3cd('0x2c')]};});_0x339782[_0xc3cd('0x2d')]=_[_0xc3cd('0x29')](_0x1b3449,_0xc3cd('0x27'));_0x339782[_0xc3cd('0x2e')]=_['keys'](_0x420658[_0xc3cd('0x2e')]);_0x339782[_0xc3cd('0x2f')]=_[_0xc3cd('0x30')](_0x339782[_0xc3cd('0x2d')],_0x339782[_0xc3cd('0x2e')]);_0x2de57a[_0xc3cd('0x31')]=_[_0xc3cd('0x30')](_0x339782[_0xc3cd('0x2d')],qs[_0xc3cd('0x32')](_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x32')]));_0x2de57a[_0xc3cd('0x31')]=_0x2de57a['attributes'][_0xc3cd('0x33')]?_0x2de57a[_0xc3cd('0x31')]:_0x339782[_0xc3cd('0x2d')];if(!_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x34')](_0xc3cd('0x35'))){_0x2de57a[_0xc3cd('0x1d')]=qs[_0xc3cd('0x1d')](_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x1d')]);_0x2de57a[_0xc3cd('0x1b')]=qs[_0xc3cd('0x1b')](_0x420658['query'][_0xc3cd('0x1b')]);}_0x2de57a['order']=qs[_0xc3cd('0x36')](_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x36')]);_0x2de57a['where']=qs[_0xc3cd('0x2f')](_[_0xc3cd('0x37')](_0x420658[_0xc3cd('0x2e')],_0x339782[_0xc3cd('0x2f')]),_0x1b3449);if(_0x420658['query'][_0xc3cd('0x38')]){_0x2de57a[_0xc3cd('0x39')]=_[_0xc3cd('0x3a')](_0x2de57a['where'],{'$or':_[_0xc3cd('0x29')](_0x1b3449,function(_0x348ba8){if(_0x348ba8[_0xc3cd('0x3b')]!=='VIRTUAL'){var _0x45c877={};_0x45c877[_0x348ba8['name']]={'$like':'%'+_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x38')]+'%'};return _0x45c877;}})});}_0x2de57a=_[_0xc3cd('0x3a')]({},_0x2de57a,_0x420658[_0xc3cd('0x3c')]);var _0x2991bd={'where':_0x2de57a[_0xc3cd('0x39')]};return db['ServicenowField']['count'](_0x2991bd)['then'](function(_0x27d031){_0x5588b7[_0xc3cd('0x1e')]=_0x27d031;if(_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x3d')]){_0x2de57a[_0xc3cd('0x3e')]=[{'all':!![]}];}return db[_0xc3cd('0x2a')][_0xc3cd('0x3f')](_0x2de57a);})[_0xc3cd('0x22')](function(_0x43e9d7){_0x5588b7[_0xc3cd('0x40')]=_0x43e9d7;return _0x5588b7;})[_0xc3cd('0x22')](respondWithFilteredResult(_0x10321b,_0x2de57a))['catch'](handleError(_0x10321b,null));};exports[_0xc3cd('0x41')]=function(_0x1f3507,_0x3f3c0b){var _0x570a9a={'raw':!![],'where':{'id':_0x1f3507['params']['id']}},_0x17856d={};_0x17856d[_0xc3cd('0x2d')]=_[_0xc3cd('0x42')](db[_0xc3cd('0x2a')][_0xc3cd('0x43')]);_0x17856d['query']=_['keys'](_0x1f3507[_0xc3cd('0x2e')]);_0x17856d['filters']=_[_0xc3cd('0x30')](_0x17856d[_0xc3cd('0x2d')],_0x17856d[_0xc3cd('0x2e')]);_0x570a9a[_0xc3cd('0x31')]=_[_0xc3cd('0x30')](_0x17856d['model'],qs[_0xc3cd('0x32')](_0x1f3507[_0xc3cd('0x2e')][_0xc3cd('0x32')]));_0x570a9a[_0xc3cd('0x31')]=_0x570a9a[_0xc3cd('0x31')]['length']?_0x570a9a[_0xc3cd('0x31')]:_0x17856d[_0xc3cd('0x2d')];if(_0x1f3507[_0xc3cd('0x2e')][_0xc3cd('0x3d')]){_0x570a9a[_0xc3cd('0x3e')]=[{'all':!![]}];}_0x570a9a=_[_0xc3cd('0x3a')]({},_0x570a9a,_0x1f3507[_0xc3cd('0x3c')]);return db[_0xc3cd('0x2a')][_0xc3cd('0x44')](_0x570a9a)[_0xc3cd('0x22')](handleEntityNotFound(_0x3f3c0b,null))[_0xc3cd('0x22')](respondWithResult(_0x3f3c0b,null))[_0xc3cd('0x45')](handleError(_0x3f3c0b,null));};exports['create']=function(_0x5e1e95,_0xbf3843){return db['ServicenowField'][_0xc3cd('0x46')](_0x5e1e95['body'],{})['then'](respondWithResult(_0xbf3843,0xc9))['catch'](handleError(_0xbf3843,null));};exports[_0xc3cd('0x21')]=function(_0x23957e,_0x5bbb7d){if(_0x23957e[_0xc3cd('0x47')]['id']){delete _0x23957e['body']['id'];}return db[_0xc3cd('0x2a')][_0xc3cd('0x44')]({'where':{'id':_0x23957e[_0xc3cd('0x48')]['id']}})[_0xc3cd('0x22')](handleEntityNotFound(_0x5bbb7d,null))[_0xc3cd('0x22')](saveUpdates(_0x23957e[_0xc3cd('0x47')],null))[_0xc3cd('0x22')](respondWithResult(_0x5bbb7d,null))['catch'](handleError(_0x5bbb7d,null));};exports[_0xc3cd('0x23')]=function(_0x14fd23,_0x1b388e){return db[_0xc3cd('0x2a')][_0xc3cd('0x44')]({'where':{'id':_0x14fd23[_0xc3cd('0x48')]['id']}})[_0xc3cd('0x22')](handleEntityNotFound(_0x1b388e,null))[_0xc3cd('0x22')](removeEntity(_0x1b388e,null))[_0xc3cd('0x45')](handleError(_0x1b388e,null));}; \ No newline at end of file +var _0x0dc0=['ServicenowField','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','catch','show','keys','rawAttributes','include','find','create','body','params','eml-format','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x2a5729,_0x46ce2a){var _0x229d39=function(_0x121e29){while(--_0x121e29){_0x2a5729['push'](_0x2a5729['shift']());}};_0x229d39(++_0x46ce2a);}(_0x0dc0,0x191));var _0x00dc=function(_0x56f5c5,_0x3dd9ec){_0x56f5c5=_0x56f5c5-0x0;var _0x543086=_0x0dc0[_0x56f5c5];return _0x543086;};'use strict';var emlformat=require(_0x00dc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x00dc('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00dc('0x2'));var Mustache=require(_0x00dc('0x3'));var util=require('util');var path=require(_0x00dc('0x4'));var sox=require(_0x00dc('0x5'));var csv=require(_0x00dc('0x6'));var ejs=require(_0x00dc('0x7'));var fs=require('fs');var fs_extra=require(_0x00dc('0x8'));var _=require(_0x00dc('0x9'));var squel=require(_0x00dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x00dc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x00dc('0xc'));var Papa=require('papaparse');var Redis=require(_0x00dc('0xd'));var authService=require(_0x00dc('0xe'));var qs=require(_0x00dc('0xf'));var as=require(_0x00dc('0x10'));var hardwareService=require(_0x00dc('0x11'));var logger=require(_0x00dc('0x12'))(_0x00dc('0x13'));var utils=require(_0x00dc('0x14'));var config=require(_0x00dc('0x15'));var licenseUtil=require(_0x00dc('0x16'));var db=require(_0x00dc('0x17'))['db'];function respondWithStatusCode(_0x5ccee4,_0x467f04){_0x467f04=_0x467f04||0xcc;return function(_0x58e316){if(_0x58e316){return _0x5ccee4[_0x00dc('0x18')](_0x467f04);}return _0x5ccee4['status'](_0x467f04)[_0x00dc('0x19')]();};}function respondWithResult(_0x24cb5b,_0x307f7c){_0x307f7c=_0x307f7c||0xc8;return function(_0x16d3a8){if(_0x16d3a8){return _0x24cb5b[_0x00dc('0x1a')](_0x307f7c)[_0x00dc('0x1b')](_0x16d3a8);}};}function respondWithFilteredResult(_0x1206b2,_0x296b22){return function(_0x1ffa2a){if(_0x1ffa2a){var _0x2448d6=typeof _0x296b22[_0x00dc('0x1c')]===_0x00dc('0x1d')&&typeof _0x296b22[_0x00dc('0x1e')]===_0x00dc('0x1d');var _0x221364=_0x1ffa2a['count'];var _0x239226=_0x2448d6?0x0:_0x296b22[_0x00dc('0x1c')];var _0x27417c=_0x2448d6?_0x1ffa2a['count']:_0x296b22['offset']+_0x296b22['limit'];var _0x3bde33;if(_0x27417c>=_0x221364){_0x27417c=_0x221364;_0x3bde33=0xc8;}else{_0x3bde33=0xce;}_0x1206b2['status'](_0x3bde33);return _0x1206b2[_0x00dc('0x1f')]('Content-Range',_0x239226+'-'+_0x27417c+'/'+_0x221364)[_0x00dc('0x1b')](_0x1ffa2a);}return null;};}function patchUpdates(_0x184d3e){return function(_0x127079){try{jsonpatch[_0x00dc('0x20')](_0x127079,_0x184d3e,!![]);}catch(_0x2849a4){return BPromise[_0x00dc('0x21')](_0x2849a4);}return _0x127079[_0x00dc('0x22')]();};}function saveUpdates(_0x372681,_0x1da7f0){return function(_0x368d3d){if(_0x368d3d){return _0x368d3d[_0x00dc('0x23')](_0x372681)[_0x00dc('0x24')](function(_0x4f8060){return _0x4f8060;});}return null;};}function removeEntity(_0x4fe779,_0x3fe44d){return function(_0x101e3f){if(_0x101e3f){return _0x101e3f[_0x00dc('0x25')]()['then'](function(){_0x4fe779[_0x00dc('0x1a')](0xcc)[_0x00dc('0x19')]();});}};}function handleEntityNotFound(_0x42101f,_0x251278){return function(_0x2cac9e){if(!_0x2cac9e){_0x42101f[_0x00dc('0x18')](0x194);}return _0x2cac9e;};}function handleError(_0x3a684a,_0x33cc44){_0x33cc44=_0x33cc44||0x1f4;return function(_0x2b0c05){logger[_0x00dc('0x26')](_0x2b0c05[_0x00dc('0x27')]);if(_0x2b0c05[_0x00dc('0x28')]){delete _0x2b0c05[_0x00dc('0x28')];}_0x3a684a[_0x00dc('0x1a')](_0x33cc44)[_0x00dc('0x29')](_0x2b0c05);};}exports['index']=function(_0x47d24f,_0xc6ccee){var _0x13ee16={},_0x148dfd={},_0x18b652={'count':0x0,'rows':[]};var _0x58123f=_[_0x00dc('0x2a')](db[_0x00dc('0x2b')]['rawAttributes'],function(_0x137e35){return{'name':_0x137e35[_0x00dc('0x2c')],'type':_0x137e35[_0x00dc('0x2d')]['key']};});_0x148dfd[_0x00dc('0x2e')]=_['map'](_0x58123f,_0x00dc('0x28'));_0x148dfd[_0x00dc('0x2f')]=_['keys'](_0x47d24f[_0x00dc('0x2f')]);_0x148dfd['filters']=_[_0x00dc('0x30')](_0x148dfd['model'],_0x148dfd['query']);_0x13ee16[_0x00dc('0x31')]=_[_0x00dc('0x30')](_0x148dfd['model'],qs[_0x00dc('0x32')](_0x47d24f[_0x00dc('0x2f')][_0x00dc('0x32')]));_0x13ee16[_0x00dc('0x31')]=_0x13ee16['attributes'][_0x00dc('0x33')]?_0x13ee16[_0x00dc('0x31')]:_0x148dfd[_0x00dc('0x2e')];if(!_0x47d24f[_0x00dc('0x2f')][_0x00dc('0x34')](_0x00dc('0x35'))){_0x13ee16[_0x00dc('0x1e')]=qs[_0x00dc('0x1e')](_0x47d24f[_0x00dc('0x2f')][_0x00dc('0x1e')]);_0x13ee16[_0x00dc('0x1c')]=qs[_0x00dc('0x1c')](_0x47d24f[_0x00dc('0x2f')][_0x00dc('0x1c')]);}_0x13ee16[_0x00dc('0x36')]=qs[_0x00dc('0x37')](_0x47d24f[_0x00dc('0x2f')][_0x00dc('0x37')]);_0x13ee16[_0x00dc('0x38')]=qs[_0x00dc('0x39')](_[_0x00dc('0x3a')](_0x47d24f[_0x00dc('0x2f')],_0x148dfd[_0x00dc('0x39')]),_0x58123f);if(_0x47d24f['query'][_0x00dc('0x3b')]){_0x13ee16['where']=_['merge'](_0x13ee16[_0x00dc('0x38')],{'$or':_['map'](_0x58123f,function(_0x32201d){if(_0x32201d[_0x00dc('0x2d')]!==_0x00dc('0x3c')){var _0x4deecd={};_0x4deecd[_0x32201d[_0x00dc('0x28')]]={'$like':'%'+_0x47d24f['query'][_0x00dc('0x3b')]+'%'};return _0x4deecd;}})});}_0x13ee16=_[_0x00dc('0x3d')]({},_0x13ee16,_0x47d24f[_0x00dc('0x3e')]);var _0x4921ca={'where':_0x13ee16[_0x00dc('0x38')]};return db[_0x00dc('0x2b')]['count'](_0x4921ca)['then'](function(_0x3e6536){_0x18b652[_0x00dc('0x3f')]=_0x3e6536;if(_0x47d24f['query'][_0x00dc('0x40')]){_0x13ee16['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x13ee16);})[_0x00dc('0x24')](function(_0x450597){_0x18b652['rows']=_0x450597;return _0x18b652;})['then'](respondWithFilteredResult(_0xc6ccee,_0x13ee16))[_0x00dc('0x41')](handleError(_0xc6ccee,null));};exports[_0x00dc('0x42')]=function(_0x2acfa7,_0x4d0908){var _0x4c6875={'raw':!![],'where':{'id':_0x2acfa7['params']['id']}},_0x4e037d={};_0x4e037d['model']=_[_0x00dc('0x43')](db[_0x00dc('0x2b')][_0x00dc('0x44')]);_0x4e037d[_0x00dc('0x2f')]=_[_0x00dc('0x43')](_0x2acfa7['query']);_0x4e037d[_0x00dc('0x39')]=_['intersection'](_0x4e037d['model'],_0x4e037d[_0x00dc('0x2f')]);_0x4c6875['attributes']=_['intersection'](_0x4e037d[_0x00dc('0x2e')],qs[_0x00dc('0x32')](_0x2acfa7[_0x00dc('0x2f')]['fields']));_0x4c6875[_0x00dc('0x31')]=_0x4c6875[_0x00dc('0x31')][_0x00dc('0x33')]?_0x4c6875['attributes']:_0x4e037d[_0x00dc('0x2e')];if(_0x2acfa7[_0x00dc('0x2f')]['includeAll']){_0x4c6875[_0x00dc('0x45')]=[{'all':!![]}];}_0x4c6875=_['merge']({},_0x4c6875,_0x2acfa7[_0x00dc('0x3e')]);return db['ServicenowField'][_0x00dc('0x46')](_0x4c6875)[_0x00dc('0x24')](handleEntityNotFound(_0x4d0908,null))[_0x00dc('0x24')](respondWithResult(_0x4d0908,null))[_0x00dc('0x41')](handleError(_0x4d0908,null));};exports[_0x00dc('0x47')]=function(_0x55fd6c,_0x44067f){return db[_0x00dc('0x2b')][_0x00dc('0x47')](_0x55fd6c[_0x00dc('0x48')],{})[_0x00dc('0x24')](respondWithResult(_0x44067f,0xc9))[_0x00dc('0x41')](handleError(_0x44067f,null));};exports[_0x00dc('0x23')]=function(_0x47fea7,_0x547e9e){if(_0x47fea7['body']['id']){delete _0x47fea7[_0x00dc('0x48')]['id'];}return db[_0x00dc('0x2b')][_0x00dc('0x46')]({'where':{'id':_0x47fea7[_0x00dc('0x49')]['id']}})[_0x00dc('0x24')](handleEntityNotFound(_0x547e9e,null))['then'](saveUpdates(_0x47fea7[_0x00dc('0x48')],null))[_0x00dc('0x24')](respondWithResult(_0x547e9e,null))[_0x00dc('0x41')](handleError(_0x547e9e,null));};exports[_0x00dc('0x25')]=function(_0x4c9615,_0x1f78b5){return db[_0x00dc('0x2b')][_0x00dc('0x46')]({'where':{'id':_0x4c9615[_0x00dc('0x49')]['id']}})[_0x00dc('0x24')](handleEntityNotFound(_0x1f78b5,null))[_0x00dc('0x24')](removeEntity(_0x1f78b5,null))[_0x00dc('0x41')](handleError(_0x1f78b5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 677b53b..ed4d827 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 _0x1561=['define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x502b34,_0x3d5d43){var _0x333664=function(_0x331496){while(--_0x331496){_0x502b34['push'](_0x502b34['shift']());}};_0x333664(++_0x3d5d43);}(_0x1561,0x1b7));var _0x1156=function(_0xc552f5,_0x3e039b){_0xc552f5=_0xc552f5-0x0;var _0x1d5dd1=_0x1561[_0xc552f5];return _0x1d5dd1;};'use strict';var _=require(_0x1156('0x0'));var util=require(_0x1156('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1156('0x2'));var BPromise=require(_0x1156('0x3'));var rp=require(_0x1156('0x4'));var fs=require('fs');var path=require(_0x1156('0x5'));var rimraf=require(_0x1156('0x6'));var config=require(_0x1156('0x7'));var attributes=require(_0x1156('0x8'));module['exports']=function(_0x47f6e8,_0x246731){return _0x47f6e8[_0x1156('0x9')](_0x1156('0xa'),attributes,{'tableName':_0x1156('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1156('0xc'),_0x1156('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2683=['../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x16ae90,_0x5820e4){var _0xeb77e0=function(_0xcb7935){while(--_0xcb7935){_0x16ae90['push'](_0x16ae90['shift']());}};_0xeb77e0(++_0x5820e4);}(_0x2683,0x78));var _0x3268=function(_0x5c1b05,_0x213768){_0x5c1b05=_0x5c1b05-0x0;var _0x1a65e7=_0x2683[_0x5c1b05];return _0x1a65e7;};'use strict';var _=require('lodash');var util=require(_0x3268('0x0'));var logger=require(_0x3268('0x1'))(_0x3268('0x2'));var moment=require(_0x3268('0x3'));var BPromise=require(_0x3268('0x4'));var rp=require(_0x3268('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3268('0x6'));var attributes=require(_0x3268('0x7'));module[_0x3268('0x8')]=function(_0xdc6e5e,_0x2614e8){return _0xdc6e5e[_0x3268('0x9')](_0x3268('0xa'),attributes,{'tableName':_0x3268('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x3268('0xc'),_0x3268('0xd')],'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 5f25f92..0cefc01 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xac4a,0x13f));var _0xaac4=function(_0x58e777,_0x2c0b77){_0x58e777=_0x58e777-0x0;var _0x265242=_0xac4a[_0x58e777];return _0x265242;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6de3b94..af95272 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(_0x3771b4,_0x2dfde7){var _0x50c1a0=function(_0x1e49e1){while(--_0x1e49e1){_0x3771b4['push'](_0x3771b4['shift']());}};_0x50c1a0(++_0x2dfde7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x246693,_0x4f3e85){var _0x531a05=function(_0x300bcd){while(--_0x300bcd){_0x246693['push'](_0x246693['shift']());}};_0x531a05(++_0x4f3e85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 6852e4e..bcf2f54 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(_0x531fdb,_0x2b23ce){var _0x3f35f9=function(_0x3c6fdc){while(--_0x3c6fdc){_0x531fdb['push'](_0x531fdb['shift']());}};_0x3f35f9(++_0x2b23ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x396de5,_0x577868){var _0x3eb187=function(_0x3a1163){while(--_0x3a1163){_0x396de5['push'](_0x396de5['shift']());}};_0x3eb187(++_0x577868);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 1fbcb15..101e2ec 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 _0x6ab0=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','catch','keys','length','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','Calls','values','remove','includes','label','endsWith','value','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x6ab0,0x69));var _0x06ab=function(_0x200a45,_0x585f6c){_0x200a45=_0x200a45-0x0;var _0x11f228=_0x6ab0[_0x200a45];return _0x11f228;};'use strict';var emlformat=require(_0x06ab('0x0'));var rimraf=require(_0x06ab('0x1'));var zipdir=require(_0x06ab('0x2'));var jsonpatch=require(_0x06ab('0x3'));var rp=require(_0x06ab('0x4'));var moment=require(_0x06ab('0x5'));var BPromise=require(_0x06ab('0x6'));var Mustache=require(_0x06ab('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x06ab('0x8'));var ejs=require(_0x06ab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06ab('0xa'));var squel=require(_0x06ab('0xb'));var crypto=require('crypto');var jsforce=require(_0x06ab('0xc'));var deskjs=require(_0x06ab('0xd'));var toCsv=require(_0x06ab('0x8'));var querystring=require(_0x06ab('0xe'));var Papa=require(_0x06ab('0xf'));var Redis=require(_0x06ab('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x06ab('0x11'));var as=require(_0x06ab('0x12'));var hardwareService=require(_0x06ab('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x06ab('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x06ab('0x15'));var db=require(_0x06ab('0x16'))['db'];var integrations=require(_0x06ab('0x17'));function respondWithStatusCode(_0x361e90,_0x33c62c){_0x33c62c=_0x33c62c||0xcc;return function(_0x4b453d){if(_0x4b453d){return _0x361e90[_0x06ab('0x18')](_0x33c62c);}return _0x361e90[_0x06ab('0x19')](_0x33c62c)[_0x06ab('0x1a')]();};}function respondWithResult(_0x4ab599,_0x4bdd6e){_0x4bdd6e=_0x4bdd6e||0xc8;return function(_0x313f59){if(_0x313f59){return _0x4ab599[_0x06ab('0x19')](_0x4bdd6e)[_0x06ab('0x1b')](_0x313f59);}};}function respondWithFilteredResult(_0x3ac06e,_0x450676){return function(_0x2f2454){if(_0x2f2454){var _0x1118a6=typeof _0x450676['offset']===_0x06ab('0x1c')&&typeof _0x450676['limit']===_0x06ab('0x1c');var _0x1c9f09=_0x2f2454[_0x06ab('0x1d')];var _0xa0435b=_0x1118a6?0x0:_0x450676[_0x06ab('0x1e')];var _0x52ea97=_0x1118a6?_0x2f2454['count']:_0x450676['offset']+_0x450676['limit'];var _0x132b2c;if(_0x52ea97>=_0x1c9f09){_0x52ea97=_0x1c9f09;_0x132b2c=0xc8;}else{_0x132b2c=0xce;}_0x3ac06e[_0x06ab('0x19')](_0x132b2c);return _0x3ac06e[_0x06ab('0x1f')](_0x06ab('0x20'),_0xa0435b+'-'+_0x52ea97+'/'+_0x1c9f09)[_0x06ab('0x1b')](_0x2f2454);}return null;};}function patchUpdates(_0x57c810){return function(_0x5e507d){try{jsonpatch['apply'](_0x5e507d,_0x57c810,!![]);}catch(_0xc42830){return BPromise[_0x06ab('0x21')](_0xc42830);}return _0x5e507d[_0x06ab('0x22')]();};}function saveUpdates(_0x510192,_0xc7af28){return function(_0x36b92a){if(_0x36b92a){return _0x36b92a[_0x06ab('0x23')](_0x510192)[_0x06ab('0x24')](function(_0x2f68b7){return _0x2f68b7;});}return null;};}function removeEntity(_0x37e415,_0x23ea3b){return function(_0x2deb6f){if(_0x2deb6f){return _0x2deb6f[_0x06ab('0x25')]()['then'](function(){_0x37e415['status'](0xcc)[_0x06ab('0x1a')]();});}};}function handleEntityNotFound(_0x47a443,_0x26d444){return function(_0x2a7c6d){if(!_0x2a7c6d){_0x47a443[_0x06ab('0x18')](0x194);}return _0x2a7c6d;};}function handleError(_0x5912ae,_0x2d8ea0){_0x2d8ea0=_0x2d8ea0||0x1f4;return function(_0x2eab25){logger['error'](_0x2eab25['stack']);if(_0x2eab25[_0x06ab('0x26')]){delete _0x2eab25[_0x06ab('0x26')];}_0x5912ae[_0x06ab('0x19')](_0x2d8ea0)[_0x06ab('0x27')](_0x2eab25);};}exports[_0x06ab('0x28')]=function(_0x58febc,_0xc61bf5){var _0x37db2e={},_0x1c0914={},_0x41b179={'count':0x0,'rows':[]};var _0x3330e1=_[_0x06ab('0x29')](db['SugarcrmAccount'][_0x06ab('0x2a')],function(_0x326f93){return{'name':_0x326f93[_0x06ab('0x2b')],'type':_0x326f93['type'][_0x06ab('0x2c')]};});_0x1c0914['model']=_[_0x06ab('0x29')](_0x3330e1,_0x06ab('0x26'));_0x1c0914[_0x06ab('0x2d')]=_['keys'](_0x58febc['query']);_0x1c0914[_0x06ab('0x2e')]=_[_0x06ab('0x2f')](_0x1c0914['model'],_0x1c0914[_0x06ab('0x2d')]);_0x37db2e[_0x06ab('0x30')]=_['intersection'](_0x1c0914['model'],qs['fields'](_0x58febc[_0x06ab('0x2d')][_0x06ab('0x31')]));_0x37db2e[_0x06ab('0x30')]=_0x37db2e[_0x06ab('0x30')]['length']?_0x37db2e[_0x06ab('0x30')]:_0x1c0914[_0x06ab('0x32')];if(!_0x58febc[_0x06ab('0x2d')][_0x06ab('0x33')](_0x06ab('0x34'))){_0x37db2e[_0x06ab('0x35')]=qs[_0x06ab('0x35')](_0x58febc[_0x06ab('0x2d')][_0x06ab('0x35')]);_0x37db2e['offset']=qs['offset'](_0x58febc['query']['offset']);}_0x37db2e[_0x06ab('0x36')]=qs['sort'](_0x58febc[_0x06ab('0x2d')][_0x06ab('0x37')]);_0x37db2e['where']=qs[_0x06ab('0x2e')](_[_0x06ab('0x38')](_0x58febc[_0x06ab('0x2d')],_0x1c0914[_0x06ab('0x2e')]),_0x3330e1);if(_0x58febc['query'][_0x06ab('0x39')]){_0x37db2e[_0x06ab('0x3a')]=_[_0x06ab('0x3b')](_0x37db2e[_0x06ab('0x3a')],{'$or':_[_0x06ab('0x29')](_0x3330e1,function(_0x5c1ea3){if(_0x5c1ea3['type']!==_0x06ab('0x3c')){var _0x352fe6={};_0x352fe6[_0x5c1ea3[_0x06ab('0x26')]]={'$like':'%'+_0x58febc[_0x06ab('0x2d')]['filter']+'%'};return _0x352fe6;}})});}_0x37db2e=_['merge']({},_0x37db2e,_0x58febc[_0x06ab('0x3d')]);var _0x4a583e={'where':_0x37db2e[_0x06ab('0x3a')]};return db[_0x06ab('0x3e')][_0x06ab('0x1d')](_0x4a583e)[_0x06ab('0x24')](function(_0x9e71d3){_0x41b179[_0x06ab('0x1d')]=_0x9e71d3;if(_0x58febc['query'][_0x06ab('0x3f')]){_0x37db2e[_0x06ab('0x40')]=[{'all':!![]}];}return db[_0x06ab('0x3e')][_0x06ab('0x41')](_0x37db2e);})[_0x06ab('0x24')](function(_0x589e93){_0x41b179['rows']=_0x589e93;return _0x41b179;})[_0x06ab('0x24')](respondWithFilteredResult(_0xc61bf5,_0x37db2e))[_0x06ab('0x42')](handleError(_0xc61bf5,null));};exports['show']=function(_0x3342f9,_0x32293c){var _0x6a1e83={'raw':![],'where':{'id':_0x3342f9['params']['id']}},_0x13aaeb={};_0x13aaeb[_0x06ab('0x32')]=_[_0x06ab('0x43')](db[_0x06ab('0x3e')]['rawAttributes']);_0x13aaeb['query']=_[_0x06ab('0x43')](_0x3342f9[_0x06ab('0x2d')]);_0x13aaeb[_0x06ab('0x2e')]=_[_0x06ab('0x2f')](_0x13aaeb[_0x06ab('0x32')],_0x13aaeb[_0x06ab('0x2d')]);_0x6a1e83['attributes']=_[_0x06ab('0x2f')](_0x13aaeb['model'],qs[_0x06ab('0x31')](_0x3342f9[_0x06ab('0x2d')][_0x06ab('0x31')]));_0x6a1e83['attributes']=_0x6a1e83[_0x06ab('0x30')][_0x06ab('0x44')]?_0x6a1e83['attributes']:_0x13aaeb[_0x06ab('0x32')];if(_0x3342f9[_0x06ab('0x2d')][_0x06ab('0x3f')]){_0x6a1e83[_0x06ab('0x40')]=[{'all':!![]}];}_0x6a1e83=_[_0x06ab('0x3b')]({},_0x6a1e83,_0x3342f9[_0x06ab('0x3d')]);return db[_0x06ab('0x3e')][_0x06ab('0x45')](_0x6a1e83)[_0x06ab('0x24')](handleEntityNotFound(_0x32293c,null))[_0x06ab('0x24')](respondWithResult(_0x32293c,null))['catch'](handleError(_0x32293c,null));};exports['create']=function(_0x376a64,_0xa70745){return db[_0x06ab('0x3e')][_0x06ab('0x46')](_0x376a64[_0x06ab('0x47')],{})[_0x06ab('0x24')](respondWithResult(_0xa70745,0xc9))[_0x06ab('0x42')](handleError(_0xa70745,null));};exports['update']=function(_0x1054b1,_0x45fa9f){if(_0x1054b1[_0x06ab('0x47')]['id']){delete _0x1054b1[_0x06ab('0x47')]['id'];}return db['SugarcrmAccount'][_0x06ab('0x45')]({'where':{'id':_0x1054b1[_0x06ab('0x48')]['id']}})[_0x06ab('0x24')](handleEntityNotFound(_0x45fa9f,null))[_0x06ab('0x24')](saveUpdates(_0x1054b1[_0x06ab('0x47')],null))[_0x06ab('0x24')](respondWithResult(_0x45fa9f,null))[_0x06ab('0x42')](handleError(_0x45fa9f,null));};exports[_0x06ab('0x25')]=function(_0x2980f0,_0x45a73f){return db[_0x06ab('0x3e')][_0x06ab('0x45')]({'where':{'id':_0x2980f0[_0x06ab('0x48')]['id']}})[_0x06ab('0x24')](handleEntityNotFound(_0x45a73f,null))[_0x06ab('0x24')](removeEntity(_0x45a73f,null))[_0x06ab('0x42')](handleError(_0x45a73f,null));};exports[_0x06ab('0x49')]=function(_0x36e556,_0x420290,_0x1f9839){var _0x5150dc={};var _0x3e83b2={};var _0x421b2a;var _0x18a3c4;return db['SugarcrmAccount'][_0x06ab('0x4a')]({'where':{'id':_0x36e556[_0x06ab('0x48')]['id']}})['then'](handleEntityNotFound(_0x420290,null))[_0x06ab('0x24')](function(_0x35a83a){if(_0x35a83a){_0x421b2a=_0x35a83a;_0x3e83b2[_0x06ab('0x32')]=_[_0x06ab('0x43')](db[_0x06ab('0x4b')]['rawAttributes']);_0x3e83b2['query']=_[_0x06ab('0x43')](_0x36e556[_0x06ab('0x2d')]);_0x3e83b2['filters']=_[_0x06ab('0x2f')](_0x3e83b2[_0x06ab('0x32')],_0x3e83b2['query']);_0x5150dc['attributes']=_[_0x06ab('0x2f')](_0x3e83b2['model'],qs[_0x06ab('0x31')](_0x36e556[_0x06ab('0x2d')][_0x06ab('0x31')]));_0x5150dc[_0x06ab('0x30')]=_0x5150dc[_0x06ab('0x30')][_0x06ab('0x44')]?_0x5150dc['attributes']:_0x3e83b2[_0x06ab('0x32')];_0x5150dc[_0x06ab('0x36')]=qs[_0x06ab('0x37')](_0x36e556[_0x06ab('0x2d')][_0x06ab('0x37')]);_0x5150dc[_0x06ab('0x3a')]=qs[_0x06ab('0x2e')](_[_0x06ab('0x38')](_0x36e556[_0x06ab('0x2d')],_0x3e83b2[_0x06ab('0x2e')]));if(_0x36e556[_0x06ab('0x2d')]['filter']){_0x5150dc['where']=_[_0x06ab('0x3b')](_0x5150dc[_0x06ab('0x3a')],{'$or':_['map'](_0x5150dc[_0x06ab('0x30')],function(_0x244a1c){var _0x3690d3={};_0x3690d3[_0x244a1c]={'$like':'%'+_0x36e556[_0x06ab('0x2d')]['filter']+'%'};return _0x3690d3;})});}_0x5150dc=_[_0x06ab('0x3b')]({},_0x5150dc,_0x36e556['options']);return _0x421b2a[_0x06ab('0x49')](_0x5150dc);}})[_0x06ab('0x24')](function(_0x3c17f8){if(_0x3c17f8){_0x18a3c4=_0x3c17f8[_0x06ab('0x44')];if(!_0x36e556[_0x06ab('0x2d')][_0x06ab('0x33')](_0x06ab('0x34'))){_0x5150dc[_0x06ab('0x35')]=qs[_0x06ab('0x35')](_0x36e556[_0x06ab('0x2d')][_0x06ab('0x35')]);_0x5150dc[_0x06ab('0x1e')]=qs[_0x06ab('0x1e')](_0x36e556[_0x06ab('0x2d')]['offset']);}return _0x421b2a['getConfigurations'](_0x5150dc);}})[_0x06ab('0x24')](function(_0xf678da){if(_0xf678da){return _0xf678da?{'count':_0x18a3c4,'rows':_0xf678da}:null;}})[_0x06ab('0x24')](respondWithResult(_0x420290,null))[_0x06ab('0x42')](handleError(_0x420290,null));};exports[_0x06ab('0x4c')]=function(_0x2b0e91,_0x4cce33,_0x340b5f){if(_0x2b0e91[_0x06ab('0x47')]['id']){delete _0x2b0e91['body']['id'];}return db[_0x06ab('0x3e')][_0x06ab('0x4a')]({'where':{'id':_0x2b0e91[_0x06ab('0x48')]['id']}})[_0x06ab('0x24')](handleEntityNotFound(_0x4cce33,null))[_0x06ab('0x24')](function(_0x5bbc68){if(_0x5bbc68){_0x2b0e91['body']['AccountId']=_0x5bbc68['id'];_0x2b0e91['body'][_0x06ab('0x4d')]=integrations['getSubjects'](_0x2b0e91['body'][_0x06ab('0x4e')],_0x2b0e91[_0x06ab('0x47')][_0x06ab('0x4f')]);_0x2b0e91[_0x06ab('0x47')][_0x06ab('0x50')]=integrations[_0x06ab('0x51')](_0x2b0e91[_0x06ab('0x47')][_0x06ab('0x4e')],_0x2b0e91['body'][_0x06ab('0x4f')]);return db[_0x06ab('0x4b')][_0x06ab('0x46')](_0x2b0e91[_0x06ab('0x47')],{'include':[{'model':db[_0x06ab('0x52')],'as':_0x06ab('0x4d')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x06ab('0x24')](respondWithResult(_0x4cce33,null))['catch'](handleError(_0x4cce33,null));};exports[_0x06ab('0x53')]=function(_0x44b7d9,_0x327473,_0xaf8bdd){var _0x32cc97='';var _0x6dd055=['id',_0x06ab('0x26'),_0x06ab('0x54'),_0x06ab('0x55'),_0x06ab('0x56'),'date_start',_0x06ab('0x57'),_0x06ab('0x58'),_0x06ab('0x59'),_0x06ab('0x5a'),_0x06ab('0x5b'),_0x06ab('0x5c')];return db['SugarcrmAccount'][_0x06ab('0x4a')]({'where':{'id':_0x44b7d9[_0x06ab('0x48')]['id']},'attributes':['id',_0x06ab('0x5d'),_0x06ab('0x5e'),'remoteUri']})[_0x06ab('0x24')](handleEntityNotFound(_0x327473,null))[_0x06ab('0x24')](function(_0x1b32b2){if(_0x1b32b2){_0x32cc97=_0x1b32b2['remoteUri'];var _0xedf2c2=_0x32cc97['slice'](-0x1);if(_0xedf2c2==='/'){_0x32cc97=_0x32cc97[_0x06ab('0x5f')](0x0,_0x32cc97[_0x06ab('0x60')](_0xedf2c2));}return rp({'method':_0x06ab('0x61'),'uri':util['format'](_0x06ab('0x62'),_0x32cc97,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x06ab('0x63'),'input_type':_0x06ab('0x64'),'response_type':_0x06ab('0x64'),'rest_data':JSON[_0x06ab('0x65')]({'user_auth':{'user_name':_0x1b32b2[_0x06ab('0x5d')],'password':_0x1b32b2[_0x06ab('0x5e')],'encryption':_0x06ab('0x66')},'application':_0x06ab('0x67')})}});}})[_0x06ab('0x24')](function(_0x374eac){if(_0x374eac&&_0x374eac[_0x06ab('0x26')]!==_0x06ab('0x68')&&_0x374eac[_0x06ab('0x26')]!=='Password\x20Expired'){return rp({'method':_0x06ab('0x61'),'uri':util[_0x06ab('0x69')](_0x06ab('0x62'),_0x32cc97,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x06ab('0x6a'),'input_type':_0x06ab('0x64'),'response_type':_0x06ab('0x64'),'rest_data':JSON[_0x06ab('0x65')]({'session':_0x374eac['id'],'module_name':_0x06ab('0x6b')})}})['then'](function(_0x162eb5){if(_0x162eb5){var _0x246183=_[_0x06ab('0x6c')](_0x162eb5['module_fields']);_[_0x06ab('0x6d')](_0x246183,function(_0x46e724){return _0x6dd055[_0x06ab('0x6e')](_0x46e724[_0x06ab('0x26')]);});return{'count':_0x246183[_0x06ab('0x44')],'rows':_['map'](_0x246183,function(_0x34b51a){return{'id':_0x34b51a[_0x06ab('0x26')],'name':_0x34b51a[_0x06ab('0x6f')],'custom':_[_0x06ab('0x70')](_0x34b51a[_0x06ab('0x26')],'_c')?!![]:![],'options':_0x34b51a[_0x06ab('0x3d')]?_[_0x06ab('0x29')](_[_0x06ab('0x6c')](_0x34b51a[_0x06ab('0x3d')]),function(_0x10f940){return{'name':_0x10f940[_0x06ab('0x71')],'value':_0x10f940['name']};}):[]};})};}})[_0x06ab('0x24')](respondWithResult(_0x327473,null))[_0x06ab('0x42')](function(_0x5bd597){var _0x3ab3f4=_0x44b7d9[_0x06ab('0x2d')]['test']?0x1f4:_0x5bd597[_0x06ab('0x72')]||0x1f4;logger[_0x06ab('0x73')](_0x06ab('0x74'),'getFields',_0x3ab3f4,JSON[_0x06ab('0x65')](_0x5bd597));delete _0x5bd597[_0x06ab('0x26')];if(_0x3ab3f4===0x191){_0x3ab3f4=0x190;}_0x327473[_0x06ab('0x19')](_0x3ab3f4)[_0x06ab('0x27')](_0x44b7d9[_0x06ab('0x2d')][_0x06ab('0x75')]?{'message':_0x06ab('0x76'),'statusCode':_0x5bd597[_0x06ab('0x72')]}:_0x5bd597);});}else{var _0x273867=0x1f4;_0x327473[_0x06ab('0x19')](_0x273867)[_0x06ab('0x27')]({'message':_0x06ab('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5226=['create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','remoteUri','slice','lastIndexOf','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','Invalid\x20Login','Password\x20Expired','POST','format','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find'];(function(_0x3ff8bf,_0x43a8c2){var _0x2c225e=function(_0x32f226){while(--_0x32f226){_0x3ff8bf['push'](_0x3ff8bf['shift']());}};_0x2c225e(++_0x43a8c2);}(_0x5226,0x198));var _0x6522=function(_0xa536d9,_0xcaed50){_0xa536d9=_0xa536d9-0x0;var _0xb4f882=_0x5226[_0xa536d9];return _0xb4f882;};'use strict';var emlformat=require(_0x6522('0x0'));var rimraf=require(_0x6522('0x1'));var zipdir=require(_0x6522('0x2'));var jsonpatch=require(_0x6522('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6522('0x4'));var Mustache=require(_0x6522('0x5'));var util=require(_0x6522('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6522('0x7'));var ejs=require(_0x6522('0x8'));var fs=require('fs');var fs_extra=require(_0x6522('0x9'));var _=require(_0x6522('0xa'));var squel=require(_0x6522('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6522('0xc'));var toCsv=require(_0x6522('0x7'));var querystring=require(_0x6522('0xd'));var Papa=require(_0x6522('0xe'));var Redis=require('ioredis');var authService=require(_0x6522('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6522('0x10'));var hardwareService=require(_0x6522('0x11'));var logger=require('../../config/logger')(_0x6522('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6522('0x13'));var db=require(_0x6522('0x14'))['db'];var integrations=require(_0x6522('0x15'));function respondWithStatusCode(_0x5dbfb0,_0x5c92a9){_0x5c92a9=_0x5c92a9||0xcc;return function(_0x4cb599){if(_0x4cb599){return _0x5dbfb0[_0x6522('0x16')](_0x5c92a9);}return _0x5dbfb0[_0x6522('0x17')](_0x5c92a9)['end']();};}function respondWithResult(_0x2d6ee8,_0x22c726){_0x22c726=_0x22c726||0xc8;return function(_0x124e3a){if(_0x124e3a){return _0x2d6ee8[_0x6522('0x17')](_0x22c726)[_0x6522('0x18')](_0x124e3a);}};}function respondWithFilteredResult(_0x2db8a0,_0x35236f){return function(_0x305400){if(_0x305400){var _0x2b4b6c=typeof _0x35236f[_0x6522('0x19')]===_0x6522('0x1a')&&typeof _0x35236f[_0x6522('0x1b')]===_0x6522('0x1a');var _0x387dc9=_0x305400[_0x6522('0x1c')];var _0x280450=_0x2b4b6c?0x0:_0x35236f['offset'];var _0x368c33=_0x2b4b6c?_0x305400[_0x6522('0x1c')]:_0x35236f[_0x6522('0x19')]+_0x35236f[_0x6522('0x1b')];var _0x5be505;if(_0x368c33>=_0x387dc9){_0x368c33=_0x387dc9;_0x5be505=0xc8;}else{_0x5be505=0xce;}_0x2db8a0[_0x6522('0x17')](_0x5be505);return _0x2db8a0[_0x6522('0x1d')](_0x6522('0x1e'),_0x280450+'-'+_0x368c33+'/'+_0x387dc9)[_0x6522('0x18')](_0x305400);}return null;};}function patchUpdates(_0x3144f7){return function(_0x33da3d){try{jsonpatch[_0x6522('0x1f')](_0x33da3d,_0x3144f7,!![]);}catch(_0x455069){return BPromise[_0x6522('0x20')](_0x455069);}return _0x33da3d[_0x6522('0x21')]();};}function saveUpdates(_0x1c446a,_0x1dda02){return function(_0x3fce36){if(_0x3fce36){return _0x3fce36[_0x6522('0x22')](_0x1c446a)[_0x6522('0x23')](function(_0xaa9fde){return _0xaa9fde;});}return null;};}function removeEntity(_0x4662b8,_0x58b7ec){return function(_0x11c8bc){if(_0x11c8bc){return _0x11c8bc[_0x6522('0x24')]()['then'](function(){_0x4662b8[_0x6522('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1478ec,_0x1ea62b){return function(_0x360250){if(!_0x360250){_0x1478ec[_0x6522('0x16')](0x194);}return _0x360250;};}function handleError(_0x2e34b8,_0xa3d80e){_0xa3d80e=_0xa3d80e||0x1f4;return function(_0xf5414f){logger[_0x6522('0x25')](_0xf5414f[_0x6522('0x26')]);if(_0xf5414f['name']){delete _0xf5414f[_0x6522('0x27')];}_0x2e34b8['status'](_0xa3d80e)[_0x6522('0x28')](_0xf5414f);};}exports[_0x6522('0x29')]=function(_0x6e85c8,_0x25a2f8){var _0x3cf562={},_0x2a5465={},_0x494b78={'count':0x0,'rows':[]};var _0x23c983=_[_0x6522('0x2a')](db[_0x6522('0x2b')][_0x6522('0x2c')],function(_0x54b308){return{'name':_0x54b308[_0x6522('0x2d')],'type':_0x54b308[_0x6522('0x2e')][_0x6522('0x2f')]};});_0x2a5465[_0x6522('0x30')]=_['map'](_0x23c983,_0x6522('0x27'));_0x2a5465[_0x6522('0x31')]=_[_0x6522('0x32')](_0x6e85c8[_0x6522('0x31')]);_0x2a5465[_0x6522('0x33')]=_[_0x6522('0x34')](_0x2a5465[_0x6522('0x30')],_0x2a5465[_0x6522('0x31')]);_0x3cf562[_0x6522('0x35')]=_['intersection'](_0x2a5465[_0x6522('0x30')],qs[_0x6522('0x36')](_0x6e85c8[_0x6522('0x31')][_0x6522('0x36')]));_0x3cf562[_0x6522('0x35')]=_0x3cf562[_0x6522('0x35')][_0x6522('0x37')]?_0x3cf562[_0x6522('0x35')]:_0x2a5465['model'];if(!_0x6e85c8['query'][_0x6522('0x38')](_0x6522('0x39'))){_0x3cf562[_0x6522('0x1b')]=qs[_0x6522('0x1b')](_0x6e85c8[_0x6522('0x31')]['limit']);_0x3cf562['offset']=qs[_0x6522('0x19')](_0x6e85c8[_0x6522('0x31')][_0x6522('0x19')]);}_0x3cf562[_0x6522('0x3a')]=qs[_0x6522('0x3b')](_0x6e85c8['query'][_0x6522('0x3b')]);_0x3cf562[_0x6522('0x3c')]=qs[_0x6522('0x33')](_[_0x6522('0x3d')](_0x6e85c8['query'],_0x2a5465[_0x6522('0x33')]),_0x23c983);if(_0x6e85c8[_0x6522('0x31')][_0x6522('0x3e')]){_0x3cf562[_0x6522('0x3c')]=_[_0x6522('0x3f')](_0x3cf562[_0x6522('0x3c')],{'$or':_[_0x6522('0x2a')](_0x23c983,function(_0x304016){if(_0x304016[_0x6522('0x2e')]!==_0x6522('0x40')){var _0x347411={};_0x347411[_0x304016['name']]={'$like':'%'+_0x6e85c8[_0x6522('0x31')]['filter']+'%'};return _0x347411;}})});}_0x3cf562=_['merge']({},_0x3cf562,_0x6e85c8[_0x6522('0x41')]);var _0x198711={'where':_0x3cf562[_0x6522('0x3c')]};return db[_0x6522('0x2b')][_0x6522('0x1c')](_0x198711)[_0x6522('0x23')](function(_0x7ca4cf){_0x494b78[_0x6522('0x1c')]=_0x7ca4cf;if(_0x6e85c8['query'][_0x6522('0x42')]){_0x3cf562['include']=[{'all':!![]}];}return db[_0x6522('0x2b')][_0x6522('0x43')](_0x3cf562);})[_0x6522('0x23')](function(_0x7127c){_0x494b78[_0x6522('0x44')]=_0x7127c;return _0x494b78;})['then'](respondWithFilteredResult(_0x25a2f8,_0x3cf562))[_0x6522('0x45')](handleError(_0x25a2f8,null));};exports['show']=function(_0x529f54,_0xfe113a){var _0x311597={'raw':![],'where':{'id':_0x529f54[_0x6522('0x46')]['id']}},_0xffed8f={};_0xffed8f[_0x6522('0x30')]=_['keys'](db[_0x6522('0x2b')]['rawAttributes']);_0xffed8f[_0x6522('0x31')]=_['keys'](_0x529f54[_0x6522('0x31')]);_0xffed8f[_0x6522('0x33')]=_[_0x6522('0x34')](_0xffed8f['model'],_0xffed8f[_0x6522('0x31')]);_0x311597[_0x6522('0x35')]=_[_0x6522('0x34')](_0xffed8f[_0x6522('0x30')],qs[_0x6522('0x36')](_0x529f54[_0x6522('0x31')][_0x6522('0x36')]));_0x311597[_0x6522('0x35')]=_0x311597['attributes'][_0x6522('0x37')]?_0x311597[_0x6522('0x35')]:_0xffed8f[_0x6522('0x30')];if(_0x529f54[_0x6522('0x31')][_0x6522('0x42')]){_0x311597['include']=[{'all':!![]}];}_0x311597=_[_0x6522('0x3f')]({},_0x311597,_0x529f54[_0x6522('0x41')]);return db[_0x6522('0x2b')][_0x6522('0x47')](_0x311597)['then'](handleEntityNotFound(_0xfe113a,null))[_0x6522('0x23')](respondWithResult(_0xfe113a,null))[_0x6522('0x45')](handleError(_0xfe113a,null));};exports[_0x6522('0x48')]=function(_0x14986c,_0x3caf8c){return db[_0x6522('0x2b')][_0x6522('0x48')](_0x14986c[_0x6522('0x49')],{})[_0x6522('0x23')](respondWithResult(_0x3caf8c,0xc9))['catch'](handleError(_0x3caf8c,null));};exports['update']=function(_0x4d09d2,_0x15abbf){if(_0x4d09d2[_0x6522('0x49')]['id']){delete _0x4d09d2[_0x6522('0x49')]['id'];}return db[_0x6522('0x2b')][_0x6522('0x47')]({'where':{'id':_0x4d09d2[_0x6522('0x46')]['id']}})[_0x6522('0x23')](handleEntityNotFound(_0x15abbf,null))[_0x6522('0x23')](saveUpdates(_0x4d09d2[_0x6522('0x49')],null))[_0x6522('0x23')](respondWithResult(_0x15abbf,null))[_0x6522('0x45')](handleError(_0x15abbf,null));};exports[_0x6522('0x24')]=function(_0x269c30,_0x268fdf){return db[_0x6522('0x2b')][_0x6522('0x47')]({'where':{'id':_0x269c30[_0x6522('0x46')]['id']}})[_0x6522('0x23')](handleEntityNotFound(_0x268fdf,null))['then'](removeEntity(_0x268fdf,null))[_0x6522('0x45')](handleError(_0x268fdf,null));};exports[_0x6522('0x4a')]=function(_0x40ef60,_0x259097,_0xc9f0ce){var _0xa6b76c={};var _0x577de2={};var _0x20be8e;var _0x2aab3e;return db[_0x6522('0x2b')][_0x6522('0x4b')]({'where':{'id':_0x40ef60['params']['id']}})[_0x6522('0x23')](handleEntityNotFound(_0x259097,null))['then'](function(_0x3d0a91){if(_0x3d0a91){_0x20be8e=_0x3d0a91;_0x577de2[_0x6522('0x30')]=_[_0x6522('0x32')](db['SugarcrmConfiguration'][_0x6522('0x2c')]);_0x577de2[_0x6522('0x31')]=_[_0x6522('0x32')](_0x40ef60[_0x6522('0x31')]);_0x577de2[_0x6522('0x33')]=_['intersection'](_0x577de2[_0x6522('0x30')],_0x577de2['query']);_0xa6b76c[_0x6522('0x35')]=_[_0x6522('0x34')](_0x577de2[_0x6522('0x30')],qs[_0x6522('0x36')](_0x40ef60[_0x6522('0x31')][_0x6522('0x36')]));_0xa6b76c[_0x6522('0x35')]=_0xa6b76c['attributes'][_0x6522('0x37')]?_0xa6b76c[_0x6522('0x35')]:_0x577de2[_0x6522('0x30')];_0xa6b76c[_0x6522('0x3a')]=qs[_0x6522('0x3b')](_0x40ef60[_0x6522('0x31')][_0x6522('0x3b')]);_0xa6b76c[_0x6522('0x3c')]=qs['filters'](_['pick'](_0x40ef60[_0x6522('0x31')],_0x577de2['filters']));if(_0x40ef60[_0x6522('0x31')]['filter']){_0xa6b76c[_0x6522('0x3c')]=_[_0x6522('0x3f')](_0xa6b76c[_0x6522('0x3c')],{'$or':_['map'](_0xa6b76c[_0x6522('0x35')],function(_0x34121a){var _0x5f10fa={};_0x5f10fa[_0x34121a]={'$like':'%'+_0x40ef60['query'][_0x6522('0x3e')]+'%'};return _0x5f10fa;})});}_0xa6b76c=_[_0x6522('0x3f')]({},_0xa6b76c,_0x40ef60[_0x6522('0x41')]);return _0x20be8e['getConfigurations'](_0xa6b76c);}})[_0x6522('0x23')](function(_0x111f65){if(_0x111f65){_0x2aab3e=_0x111f65[_0x6522('0x37')];if(!_0x40ef60[_0x6522('0x31')][_0x6522('0x38')]('nolimit')){_0xa6b76c[_0x6522('0x1b')]=qs['limit'](_0x40ef60[_0x6522('0x31')]['limit']);_0xa6b76c[_0x6522('0x19')]=qs[_0x6522('0x19')](_0x40ef60[_0x6522('0x31')]['offset']);}return _0x20be8e[_0x6522('0x4a')](_0xa6b76c);}})[_0x6522('0x23')](function(_0x2ddf3a){if(_0x2ddf3a){return _0x2ddf3a?{'count':_0x2aab3e,'rows':_0x2ddf3a}:null;}})[_0x6522('0x23')](respondWithResult(_0x259097,null))[_0x6522('0x45')](handleError(_0x259097,null));};exports[_0x6522('0x4c')]=function(_0x55650a,_0xf04677,_0x3dc459){if(_0x55650a[_0x6522('0x49')]['id']){delete _0x55650a[_0x6522('0x49')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x55650a[_0x6522('0x46')]['id']}})[_0x6522('0x23')](handleEntityNotFound(_0xf04677,null))[_0x6522('0x23')](function(_0xf33eb6){if(_0xf33eb6){_0x55650a[_0x6522('0x49')][_0x6522('0x4d')]=_0xf33eb6['id'];_0x55650a[_0x6522('0x49')][_0x6522('0x4e')]=integrations['getSubjects'](_0x55650a['body'][_0x6522('0x4f')],_0x55650a[_0x6522('0x49')][_0x6522('0x2e')]);_0x55650a['body'][_0x6522('0x50')]=integrations[_0x6522('0x51')](_0x55650a[_0x6522('0x49')]['channel'],_0x55650a[_0x6522('0x49')][_0x6522('0x2e')]);return db[_0x6522('0x52')][_0x6522('0x48')](_0x55650a[_0x6522('0x49')],{'include':[{'model':db[_0x6522('0x53')],'as':_0x6522('0x4e')},{'model':db[_0x6522('0x53')],'as':_0x6522('0x50')}]});}return null;})[_0x6522('0x23')](respondWithResult(_0xf04677,null))[_0x6522('0x45')](handleError(_0xf04677,null));};exports['getFields']=function(_0x1dbfb1,_0x14635b,_0x5dcf36){var _0x165cca='';var _0x517ab5=['id',_0x6522('0x27'),_0x6522('0x54'),_0x6522('0x55'),_0x6522('0x56'),_0x6522('0x57'),_0x6522('0x58'),_0x6522('0x59'),_0x6522('0x5a'),_0x6522('0x5b'),_0x6522('0x5c'),'direction'];return db[_0x6522('0x2b')][_0x6522('0x4b')]({'where':{'id':_0x1dbfb1[_0x6522('0x46')]['id']},'attributes':['id',_0x6522('0x5d'),'password',_0x6522('0x5e')]})[_0x6522('0x23')](handleEntityNotFound(_0x14635b,null))[_0x6522('0x23')](function(_0x428fad){if(_0x428fad){_0x165cca=_0x428fad[_0x6522('0x5e')];var _0x4f17c2=_0x165cca[_0x6522('0x5f')](-0x1);if(_0x4f17c2==='/'){_0x165cca=_0x165cca['substring'](0x0,_0x165cca[_0x6522('0x60')](_0x4f17c2));}return rp({'method':'POST','uri':util['format'](_0x6522('0x61'),_0x165cca,_0x6522('0x62')),'json':!![],'form':{'method':_0x6522('0x63'),'input_type':'JSON','response_type':_0x6522('0x64'),'rest_data':JSON[_0x6522('0x65')]({'user_auth':{'user_name':_0x428fad[_0x6522('0x5d')],'password':_0x428fad[_0x6522('0x66')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x6522('0x23')](function(_0xefb0fb){if(_0xefb0fb&&_0xefb0fb[_0x6522('0x27')]!==_0x6522('0x67')&&_0xefb0fb['name']!==_0x6522('0x68')){return rp({'method':_0x6522('0x69'),'uri':util[_0x6522('0x6a')](_0x6522('0x61'),_0x165cca,_0x6522('0x62')),'json':!![],'form':{'method':_0x6522('0x6b'),'input_type':_0x6522('0x64'),'response_type':_0x6522('0x64'),'rest_data':JSON['stringify']({'session':_0xefb0fb['id'],'module_name':_0x6522('0x6c')})}})[_0x6522('0x23')](function(_0x2a98f3){if(_0x2a98f3){var _0xac9672=_[_0x6522('0x6d')](_0x2a98f3[_0x6522('0x6e')]);_[_0x6522('0x6f')](_0xac9672,function(_0x88292e){return _0x517ab5[_0x6522('0x70')](_0x88292e['name']);});return{'count':_0xac9672[_0x6522('0x37')],'rows':_['map'](_0xac9672,function(_0x711d8c){return{'id':_0x711d8c['name'],'name':_0x711d8c[_0x6522('0x71')],'custom':_[_0x6522('0x72')](_0x711d8c[_0x6522('0x27')],'_c')?!![]:![],'options':_0x711d8c[_0x6522('0x41')]?_[_0x6522('0x2a')](_[_0x6522('0x6d')](_0x711d8c[_0x6522('0x41')]),function(_0x34da2d){return{'name':_0x34da2d[_0x6522('0x73')],'value':_0x34da2d['name']};}):[]};})};}})[_0x6522('0x23')](respondWithResult(_0x14635b,null))['catch'](function(_0x10b132){var _0xa9ac56=_0x1dbfb1[_0x6522('0x31')][_0x6522('0x74')]?0x1f4:_0x10b132[_0x6522('0x75')]||0x1f4;logger[_0x6522('0x25')](_0x6522('0x76'),'getFields',_0xa9ac56,JSON['stringify'](_0x10b132));delete _0x10b132[_0x6522('0x27')];if(_0xa9ac56===0x191){_0xa9ac56=0x190;}_0x14635b['status'](_0xa9ac56)['send'](_0x1dbfb1[_0x6522('0x31')][_0x6522('0x74')]?{'message':_0x6522('0x77'),'statusCode':_0x10b132[_0x6522('0x75')]}:_0x10b132);});}else{var _0x46931e=0x1f4;_0x14635b[_0x6522('0x17')](_0x46931e)[_0x6522('0x28')]({'message':_0x6522('0x77'),'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 542f443..422bf8a 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 _0xca0d=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xca0d,0x17b));var _0xdca0=function(_0x95b83e,_0x5f3d3e){_0x95b83e=_0x95b83e-0x0;var _0x2b9529=_0xca0d[_0x95b83e];return _0x2b9529;};'use strict';var _=require(_0xdca0('0x0'));var util=require(_0xdca0('0x1'));var logger=require(_0xdca0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdca0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdca0('0x4'));var config=require(_0xdca0('0x5'));var attributes=require(_0xdca0('0x6'));var integrations=require(_0xdca0('0x7'));module[_0xdca0('0x8')]=function(_0x1897b8,_0x3c0b9b){return _0x1897b8[_0xdca0('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xdca0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1437=['moment','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api'];(function(_0x3ba7f2,_0x3ab277){var _0x2178c3=function(_0x285526){while(--_0x285526){_0x3ba7f2['push'](_0x3ba7f2['shift']());}};_0x2178c3(++_0x3ab277);}(_0x1437,0x1c5));var _0x7143=function(_0x5b79ac,_0x2ba5ad){_0x5b79ac=_0x5b79ac-0x0;var _0x197bcc=_0x1437[_0x5b79ac];return _0x197bcc;};'use strict';var _=require(_0x7143('0x0'));var util=require(_0x7143('0x1'));var logger=require('../../config/logger')(_0x7143('0x2'));var moment=require(_0x7143('0x3'));var BPromise=require('bluebird');var rp=require(_0x7143('0x4'));var fs=require('fs');var path=require(_0x7143('0x5'));var rimraf=require(_0x7143('0x6'));var config=require('../../config/environment');var attributes=require(_0x7143('0x7'));var integrations=require(_0x7143('0x8'));module[_0x7143('0x9')]=function(_0x24b4f6,_0x57fdcb){return _0x24b4f6['define'](_0x7143('0xa'),attributes,{'tableName':_0x7143('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index cfb4f47..a4388b6 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 _0x38aa=['error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSugarcrmAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2d2936,_0x158cdc){var _0x3c9860=function(_0x2dda22){while(--_0x2dda22){_0x2d2936['push'](_0x2d2936['shift']());}};_0x3c9860(++_0x158cdc);}(_0x38aa,0x134));var _0xa38a=function(_0x187338,_0x5a5ede){_0x187338=_0x187338-0x0;var _0x593434=_0x38aa[_0x187338];return _0x593434;};'use strict';var _=require(_0xa38a('0x0'));var util=require('util');var moment=require(_0xa38a('0x1'));var BPromise=require(_0xa38a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa38a('0x3'));var db=require(_0xa38a('0x4'))['db'];var utils=require(_0xa38a('0x5'));var logger=require(_0xa38a('0x6'))('rpc');var config=require(_0xa38a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa38a('0x8')][_0xa38a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fc70c,_0x5c7a0a,_0x1c6686){return new BPromise(function(_0x17e394,_0x1b6a5a){return client[_0xa38a('0xa')](_0x3fc70c,_0x1c6686)[_0xa38a('0xb')](function(_0x4fcd9d){logger[_0xa38a('0xc')](_0xa38a('0xd'),_0x5c7a0a,_0xa38a('0xe'));logger['debug'](_0xa38a('0xf'),_0x5c7a0a,_0xa38a('0xe'),JSON['stringify'](_0x4fcd9d));if(_0x4fcd9d[_0xa38a('0x10')]){if(_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x11')]===0x1f4){logger[_0xa38a('0x10')](_0xa38a('0xd'),_0x5c7a0a,_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x12')]);return _0x1b6a5a(_0x4fcd9d['error'][_0xa38a('0x12')]);}logger[_0xa38a('0x10')](_0xa38a('0xd'),_0x5c7a0a,_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x12')]);return _0x17e394(_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x12')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5c7a0a,'request\x20sent');_0x17e394(_0x4fcd9d[_0xa38a('0x13')][_0xa38a('0x12')]);}})[_0xa38a('0x14')](function(_0x24fa44){logger['error'](_0xa38a('0xd'),_0x5c7a0a,_0x24fa44);_0x1b6a5a(_0x24fa44);});});}exports[_0xa38a('0x15')]=function(_0xd1810b){var _0xa11bbc=this;return new Promise(function(_0x4d3fe3,_0x22a833){return db[_0xa38a('0x16')][_0xa38a('0x17')]({'raw':_0xd1810b[_0xa38a('0x18')]?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x19')]===undefined?!![]:![]:!![],'where':_0xd1810b['options']?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1a')]||null:null,'attributes':_0xd1810b['options']?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1b')]||null:null,'limit':_0xd1810b[_0xa38a('0x18')]?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1c')]||null:null,'include':_0xd1810b[_0xa38a('0x18')]?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1d')],function(_0x45929c){return{'model':db[_0x45929c['model']],'as':_0x45929c['as'],'attributes':_0x45929c['attributes'],'include':_0x45929c[_0xa38a('0x1d')]?_['map'](_0x45929c[_0xa38a('0x1d')],function(_0x131db4){return{'model':db[_0x131db4[_0xa38a('0x1f')]],'as':_0x131db4['as'],'attributes':_0x131db4[_0xa38a('0x1b')],'include':_0x131db4[_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x131db4[_0xa38a('0x1d')],function(_0x5165e1){return{'model':db[_0x5165e1['model']],'as':_0x5165e1['as'],'attributes':_0x5165e1[_0xa38a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x443827){logger['info'](_0xa38a('0x15'),_0xd1810b);logger[_0xa38a('0x20')](_0xa38a('0x15'),_0xd1810b,JSON[_0xa38a('0x21')](_0x443827));_0x4d3fe3(_0x443827);})[_0xa38a('0x14')](function(_0x5f5931){logger[_0xa38a('0x10')](_0xa38a('0x15'),_0x5f5931[_0xa38a('0x12')],_0xd1810b);_0x22a833(_0xa11bbc[_0xa38a('0x10')](0x1f4,_0x5f5931[_0xa38a('0x12')]));});});};exports[_0xa38a('0x22')]=function(_0x1ec5ea){var _0x3493d5=this;return new Promise(function(_0x221879,_0x137856){return db[_0xa38a('0x16')][_0xa38a('0x23')]({'raw':_0x1ec5ea[_0xa38a('0x18')]?_0x1ec5ea['options'][_0xa38a('0x19')]===undefined?!![]:![]:!![],'where':_0x1ec5ea['options']?_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1a')]||null:null,'attributes':_0x1ec5ea[_0xa38a('0x18')]?_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1b')]||null:null,'include':_0x1ec5ea[_0xa38a('0x18')]?_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1d')],function(_0x20d82f){return{'model':db[_0x20d82f['model']],'as':_0x20d82f['as'],'attributes':_0x20d82f['attributes'],'include':_0x20d82f[_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x20d82f[_0xa38a('0x1d')],function(_0x471ae2){return{'model':db[_0x471ae2[_0xa38a('0x1f')]],'as':_0x471ae2['as'],'attributes':_0x471ae2[_0xa38a('0x1b')],'include':_0x471ae2[_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x471ae2['include'],function(_0x55cf50){return{'model':db[_0x55cf50[_0xa38a('0x1f')]],'as':_0x55cf50['as'],'attributes':_0x55cf50[_0xa38a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa38a('0xb')](function(_0x53ad69){logger[_0xa38a('0xc')]('ShowSugarcrmAccount',_0x1ec5ea);logger[_0xa38a('0x20')](_0xa38a('0x22'),_0x1ec5ea,JSON['stringify'](_0x53ad69));_0x221879(_0x53ad69);})[_0xa38a('0x14')](function(_0x2e26af){logger[_0xa38a('0x10')](_0xa38a('0x22'),_0x2e26af[_0xa38a('0x12')],_0x1ec5ea);_0x137856(_0x3493d5[_0xa38a('0x10')](0x1f4,_0x2e26af[_0xa38a('0x12')]));});});}; \ No newline at end of file +var _0x6d31=['raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','ShowSugarcrmAccount'];(function(_0x849902,_0x175a09){var _0x2c48b1=function(_0x523401){while(--_0x523401){_0x849902['push'](_0x849902['shift']());}};_0x2c48b1(++_0x175a09);}(_0x6d31,0xcd));var _0x16d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d31[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x16d3('0x0'));var util=require(_0x16d3('0x1'));var moment=require(_0x16d3('0x2'));var BPromise=require(_0x16d3('0x3'));var rs=require(_0x16d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d3('0x5'))['db'];var utils=require(_0x16d3('0x6'));var logger=require(_0x16d3('0x7'))(_0x16d3('0x8'));var config=require(_0x16d3('0x9'));var jayson=require(_0x16d3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5dad3b,_0x103ba5,_0x12fce3){return new BPromise(function(_0x5026b4,_0x2c129f){return client['request'](_0x5dad3b,_0x12fce3)[_0x16d3('0xb')](function(_0x113821){logger[_0x16d3('0xc')](_0x16d3('0xd'),_0x103ba5,_0x16d3('0xe'));logger[_0x16d3('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x103ba5,'request\x20sent',JSON[_0x16d3('0x10')](_0x113821));if(_0x113821[_0x16d3('0x11')]){if(_0x113821['error'][_0x16d3('0x12')]===0x1f4){logger['error'](_0x16d3('0xd'),_0x103ba5,_0x113821[_0x16d3('0x11')][_0x16d3('0x13')]);return _0x2c129f(_0x113821[_0x16d3('0x11')][_0x16d3('0x13')]);}logger[_0x16d3('0x11')](_0x16d3('0xd'),_0x103ba5,_0x113821[_0x16d3('0x11')][_0x16d3('0x13')]);return _0x5026b4(_0x113821[_0x16d3('0x11')][_0x16d3('0x13')]);}else{logger['info'](_0x16d3('0xd'),_0x103ba5,_0x16d3('0xe'));_0x5026b4(_0x113821[_0x16d3('0x14')][_0x16d3('0x13')]);}})[_0x16d3('0x15')](function(_0x2a9e28){logger[_0x16d3('0x11')](_0x16d3('0xd'),_0x103ba5,_0x2a9e28);_0x2c129f(_0x2a9e28);});});}exports[_0x16d3('0x16')]=function(_0x3c1871){var _0xfc9abb=this;return new Promise(function(_0x57b8d9,_0x305695){return db[_0x16d3('0x17')][_0x16d3('0x18')]({'raw':_0x3c1871[_0x16d3('0x19')]?_0x3c1871[_0x16d3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3c1871['options']?_0x3c1871[_0x16d3('0x19')][_0x16d3('0x1a')]||null:null,'attributes':_0x3c1871[_0x16d3('0x19')]?_0x3c1871[_0x16d3('0x19')]['attributes']||null:null,'limit':_0x3c1871[_0x16d3('0x19')]?_0x3c1871[_0x16d3('0x19')][_0x16d3('0x1b')]||null:null,'include':_0x3c1871['options']?_0x3c1871[_0x16d3('0x19')][_0x16d3('0x1c')]?_[_0x16d3('0x1d')](_0x3c1871[_0x16d3('0x19')][_0x16d3('0x1c')],function(_0xd08bb6){return{'model':db[_0xd08bb6[_0x16d3('0x1e')]],'as':_0xd08bb6['as'],'attributes':_0xd08bb6[_0x16d3('0x1f')],'include':_0xd08bb6[_0x16d3('0x1c')]?_[_0x16d3('0x1d')](_0xd08bb6[_0x16d3('0x1c')],function(_0x1689bd){return{'model':db[_0x1689bd[_0x16d3('0x1e')]],'as':_0x1689bd['as'],'attributes':_0x1689bd[_0x16d3('0x1f')],'include':_0x1689bd[_0x16d3('0x1c')]?_[_0x16d3('0x1d')](_0x1689bd['include'],function(_0x453e11){return{'model':db[_0x453e11[_0x16d3('0x1e')]],'as':_0x453e11['as'],'attributes':_0x453e11[_0x16d3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x16d3('0xb')](function(_0x5aa38f){logger[_0x16d3('0xc')](_0x16d3('0x16'),_0x3c1871);logger[_0x16d3('0xf')](_0x16d3('0x16'),_0x3c1871,JSON[_0x16d3('0x10')](_0x5aa38f));_0x57b8d9(_0x5aa38f);})['catch'](function(_0x5cca8e){logger['error'](_0x16d3('0x16'),_0x5cca8e[_0x16d3('0x13')],_0x3c1871);_0x305695(_0xfc9abb[_0x16d3('0x11')](0x1f4,_0x5cca8e['message']));});});};exports[_0x16d3('0x20')]=function(_0x584023){var _0x2e8819=this;return new Promise(function(_0x2717d4,_0x541711){return db[_0x16d3('0x17')]['find']({'raw':_0x584023[_0x16d3('0x19')]?_0x584023[_0x16d3('0x19')][_0x16d3('0x21')]===undefined?!![]:![]:!![],'where':_0x584023[_0x16d3('0x19')]?_0x584023[_0x16d3('0x19')]['where']||null:null,'attributes':_0x584023[_0x16d3('0x19')]?_0x584023[_0x16d3('0x19')]['attributes']||null:null,'include':_0x584023[_0x16d3('0x19')]?_0x584023[_0x16d3('0x19')][_0x16d3('0x1c')]?_['map'](_0x584023[_0x16d3('0x19')][_0x16d3('0x1c')],function(_0x42c39d){return{'model':db[_0x42c39d['model']],'as':_0x42c39d['as'],'attributes':_0x42c39d['attributes'],'include':_0x42c39d['include']?_[_0x16d3('0x1d')](_0x42c39d[_0x16d3('0x1c')],function(_0x5596e9){return{'model':db[_0x5596e9[_0x16d3('0x1e')]],'as':_0x5596e9['as'],'attributes':_0x5596e9[_0x16d3('0x1f')],'include':_0x5596e9[_0x16d3('0x1c')]?_[_0x16d3('0x1d')](_0x5596e9[_0x16d3('0x1c')],function(_0x33913c){return{'model':db[_0x33913c['model']],'as':_0x33913c['as'],'attributes':_0x33913c[_0x16d3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b7bae){logger[_0x16d3('0xc')]('ShowSugarcrmAccount',_0x584023);logger[_0x16d3('0xf')](_0x16d3('0x20'),_0x584023,JSON['stringify'](_0x4b7bae));_0x2717d4(_0x4b7bae);})[_0x16d3('0x15')](function(_0x21a605){logger[_0x16d3('0x11')](_0x16d3('0x20'),_0x21a605['message'],_0x584023);_0x541711(_0x2e8819['error'](0x1f4,_0x21a605[_0x16d3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d44dc2d..11694eb 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 _0xff19=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x137b03,_0x530eae){var _0xd30905=function(_0x2dc7de){while(--_0x2dc7de){_0x137b03['push'](_0x137b03['shift']());}};_0xd30905(++_0x530eae);}(_0xff19,0x156));var _0x9ff1=function(_0x125c5d,_0x809f6f){_0x125c5d=_0x125c5d-0x0;var _0x1cab49=_0xff19[_0x125c5d];return _0x1cab49;};'use strict';var multer=require(_0x9ff1('0x0'));var util=require(_0x9ff1('0x1'));var path=require('path');var timeout=require(_0x9ff1('0x2'));var express=require(_0x9ff1('0x3'));var router=express[_0x9ff1('0x4')]();var fs_extra=require(_0x9ff1('0x5'));var auth=require(_0x9ff1('0x6'));var interaction=require(_0x9ff1('0x7'));var config=require(_0x9ff1('0x8'));var controller=require(_0x9ff1('0x9'));router[_0x9ff1('0xa')]('/',auth[_0x9ff1('0xb')](),controller[_0x9ff1('0xc')]);router['get']('/:id',auth[_0x9ff1('0xb')](),controller['show']);router[_0x9ff1('0xa')]('/:id/fields',auth[_0x9ff1('0xb')](),controller[_0x9ff1('0xd')]);router[_0x9ff1('0xa')](_0x9ff1('0xe'),auth[_0x9ff1('0xb')](),controller[_0x9ff1('0xf')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9ff1('0x10')]);router[_0x9ff1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9ff1('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9ff1('0x13')](_0x9ff1('0x14'),auth[_0x9ff1('0xb')](),controller[_0x9ff1('0x15')]);module[_0x9ff1('0x16')]=router; \ No newline at end of file +var _0xcef2=['isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x3e8c5f,_0x4d6c3d){var _0x2fc008=function(_0x5d8b0f){while(--_0x5d8b0f){_0x3e8c5f['push'](_0x3e8c5f['shift']());}};_0x2fc008(++_0x4d6c3d);}(_0xcef2,0x1ae));var _0x2cef=function(_0x208a6a,_0x1a33f8){_0x208a6a=_0x208a6a-0x0;var _0x84c24a=_0xcef2[_0x208a6a];return _0x84c24a;};'use strict';var multer=require(_0x2cef('0x0'));var util=require(_0x2cef('0x1'));var path=require(_0x2cef('0x2'));var timeout=require(_0x2cef('0x3'));var express=require(_0x2cef('0x4'));var router=express[_0x2cef('0x5')]();var fs_extra=require(_0x2cef('0x6'));var auth=require(_0x2cef('0x7'));var interaction=require(_0x2cef('0x8'));var config=require(_0x2cef('0x9'));var controller=require(_0x2cef('0xa'));router[_0x2cef('0xb')]('/',auth[_0x2cef('0xc')](),controller[_0x2cef('0xd')]);router['get'](_0x2cef('0xe'),auth[_0x2cef('0xc')](),controller['show']);router[_0x2cef('0xb')](_0x2cef('0xf'),auth[_0x2cef('0xc')](),controller[_0x2cef('0x10')]);router['get'](_0x2cef('0x11'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2cef('0xb')](_0x2cef('0x12'),auth[_0x2cef('0xc')](),controller[_0x2cef('0x13')]);router[_0x2cef('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2cef('0x15')](_0x2cef('0xe'),auth['isAuthenticated'](),controller[_0x2cef('0x16')]);router[_0x2cef('0x17')]('/:id',auth[_0x2cef('0xc')](),controller[_0x2cef('0x18')]);module[_0x2cef('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index aafcd83..4324ffd 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 _0x5970=['STRING','sequelize','exports'];(function(_0x2a7049,_0x1ff477){var _0x5852d8=function(_0x303656){while(--_0x303656){_0x2a7049['push'](_0x2a7049['shift']());}};_0x5852d8(++_0x1ff477);}(_0x5970,0x151));var _0x0597=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x5970[_0x4b03c9];return _0x161ba2;};'use strict';var Sequelize=require(_0x0597('0x0'));module[_0x0597('0x1')]={'name':{'type':Sequelize[_0x0597('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf128=['STRING','exports'];(function(_0x4df479,_0x3eeb1c){var _0x14e773=function(_0x92796d){while(--_0x92796d){_0x4df479['push'](_0x4df479['shift']());}};_0x14e773(++_0x3eeb1c);}(_0xf128,0xc7));var _0x8f12=function(_0x2e1d3d,_0x719bf0){_0x2e1d3d=_0x2e1d3d-0x0;var _0x3d81df=_0xf128[_0x2e1d3d];return _0x3d81df;};'use strict';var Sequelize=require('sequelize');module[_0x8f12('0x0')]={'name':{'type':Sequelize[_0x8f12('0x1')]},'description':{'type':Sequelize[_0x8f12('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 42d5740..e62d10c 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 _0x44ee=['body','getFields','findOne','SugarcrmField','order','pick','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create'];(function(_0x2c8fc6,_0x476ff2){var _0x2b4df1=function(_0x1f6c74){while(--_0x1f6c74){_0x2c8fc6['push'](_0x2c8fc6['shift']());}};_0x2b4df1(++_0x476ff2);}(_0x44ee,0xfc));var _0xe44e=function(_0x538f4c,_0x6ecb9a){_0x538f4c=_0x538f4c-0x0;var _0x4b017a=_0x44ee[_0x538f4c];return _0x4b017a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe44e('0x0'));var zipdir=require(_0xe44e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe44e('0x2'));var moment=require(_0xe44e('0x3'));var BPromise=require(_0xe44e('0x4'));var Mustache=require(_0xe44e('0x5'));var util=require(_0xe44e('0x6'));var path=require(_0xe44e('0x7'));var sox=require(_0xe44e('0x8'));var csv=require(_0xe44e('0x9'));var ejs=require(_0xe44e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe44e('0xb'));var squel=require(_0xe44e('0xc'));var crypto=require(_0xe44e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe44e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe44e('0xf'));var Papa=require(_0xe44e('0x10'));var Redis=require('ioredis');var authService=require(_0xe44e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe44e('0x12'));var hardwareService=require(_0xe44e('0x13'));var logger=require('../../config/logger')(_0xe44e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe44e('0x15'));var db=require(_0xe44e('0x16'))['db'];function respondWithStatusCode(_0x3d2acf,_0x3b9977){_0x3b9977=_0x3b9977||0xcc;return function(_0x1df53d){if(_0x1df53d){return _0x3d2acf[_0xe44e('0x17')](_0x3b9977);}return _0x3d2acf['status'](_0x3b9977)[_0xe44e('0x18')]();};}function respondWithResult(_0x1eca92,_0x30b3ad){_0x30b3ad=_0x30b3ad||0xc8;return function(_0x4b204c){if(_0x4b204c){return _0x1eca92[_0xe44e('0x19')](_0x30b3ad)[_0xe44e('0x1a')](_0x4b204c);}};}function respondWithFilteredResult(_0x14d2ff,_0x186f5c){return function(_0x4f1509){if(_0x4f1509){var _0x1890be=typeof _0x186f5c['offset']==='undefined'&&typeof _0x186f5c[_0xe44e('0x1b')]==='undefined';var _0x4d7d78=_0x4f1509['count'];var _0x5bc441=_0x1890be?0x0:_0x186f5c[_0xe44e('0x1c')];var _0x190b10=_0x1890be?_0x4f1509[_0xe44e('0x1d')]:_0x186f5c[_0xe44e('0x1c')]+_0x186f5c[_0xe44e('0x1b')];var _0x312eb6;if(_0x190b10>=_0x4d7d78){_0x190b10=_0x4d7d78;_0x312eb6=0xc8;}else{_0x312eb6=0xce;}_0x14d2ff[_0xe44e('0x19')](_0x312eb6);return _0x14d2ff[_0xe44e('0x1e')](_0xe44e('0x1f'),_0x5bc441+'-'+_0x190b10+'/'+_0x4d7d78)[_0xe44e('0x1a')](_0x4f1509);}return null;};}function patchUpdates(_0xbb33ba){return function(_0x57ebdb){try{jsonpatch[_0xe44e('0x20')](_0x57ebdb,_0xbb33ba,!![]);}catch(_0x2fa455){return BPromise[_0xe44e('0x21')](_0x2fa455);}return _0x57ebdb['save']();};}function saveUpdates(_0x36a118,_0x3d5899){return function(_0x4980fc){if(_0x4980fc){return _0x4980fc[_0xe44e('0x22')](_0x36a118)[_0xe44e('0x23')](function(_0x3dd250){return _0x3dd250;});}return null;};}function removeEntity(_0x2a4b17,_0x2a7845){return function(_0x571da4){if(_0x571da4){return _0x571da4[_0xe44e('0x24')]()['then'](function(){_0x2a4b17[_0xe44e('0x19')](0xcc)[_0xe44e('0x18')]();});}};}function handleEntityNotFound(_0x103492,_0x123d24){return function(_0x4ce840){if(!_0x4ce840){_0x103492[_0xe44e('0x17')](0x194);}return _0x4ce840;};}function handleError(_0x822eed,_0x52d5e3){_0x52d5e3=_0x52d5e3||0x1f4;return function(_0x43c327){logger[_0xe44e('0x25')](_0x43c327[_0xe44e('0x26')]);if(_0x43c327['name']){delete _0x43c327[_0xe44e('0x27')];}_0x822eed[_0xe44e('0x19')](_0x52d5e3)[_0xe44e('0x28')](_0x43c327);};}exports[_0xe44e('0x29')]=function(_0x5bdb31,_0x45ca0d){var _0x3800a3={},_0x40d1b2={},_0xd98ce9={'count':0x0,'rows':[]};var _0x1011de=_[_0xe44e('0x2a')](db[_0xe44e('0x2b')][_0xe44e('0x2c')],function(_0x530b76){return{'name':_0x530b76[_0xe44e('0x2d')],'type':_0x530b76[_0xe44e('0x2e')][_0xe44e('0x2f')]};});_0x40d1b2['model']=_[_0xe44e('0x2a')](_0x1011de,_0xe44e('0x27'));_0x40d1b2[_0xe44e('0x30')]=_['keys'](_0x5bdb31['query']);_0x40d1b2['filters']=_['intersection'](_0x40d1b2[_0xe44e('0x31')],_0x40d1b2[_0xe44e('0x30')]);_0x3800a3['attributes']=_[_0xe44e('0x32')](_0x40d1b2[_0xe44e('0x31')],qs[_0xe44e('0x33')](_0x5bdb31[_0xe44e('0x30')]['fields']));_0x3800a3[_0xe44e('0x34')]=_0x3800a3[_0xe44e('0x34')][_0xe44e('0x35')]?_0x3800a3[_0xe44e('0x34')]:_0x40d1b2[_0xe44e('0x31')];if(!_0x5bdb31[_0xe44e('0x30')][_0xe44e('0x36')]('nolimit')){_0x3800a3[_0xe44e('0x1b')]=qs['limit'](_0x5bdb31[_0xe44e('0x30')]['limit']);_0x3800a3[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x5bdb31['query']['offset']);}_0x3800a3['order']=qs[_0xe44e('0x37')](_0x5bdb31[_0xe44e('0x30')][_0xe44e('0x37')]);_0x3800a3[_0xe44e('0x38')]=qs[_0xe44e('0x39')](_['pick'](_0x5bdb31[_0xe44e('0x30')],_0x40d1b2[_0xe44e('0x39')]),_0x1011de);if(_0x5bdb31['query'][_0xe44e('0x3a')]){_0x3800a3[_0xe44e('0x38')]=_['merge'](_0x3800a3['where'],{'$or':_[_0xe44e('0x2a')](_0x1011de,function(_0x35bd5c){if(_0x35bd5c[_0xe44e('0x2e')]!==_0xe44e('0x3b')){var _0x40e5e3={};_0x40e5e3[_0x35bd5c[_0xe44e('0x27')]]={'$like':'%'+_0x5bdb31[_0xe44e('0x30')]['filter']+'%'};return _0x40e5e3;}})});}_0x3800a3=_['merge']({},_0x3800a3,_0x5bdb31[_0xe44e('0x3c')]);var _0x580d10={'where':_0x3800a3[_0xe44e('0x38')]};return db[_0xe44e('0x2b')][_0xe44e('0x1d')](_0x580d10)[_0xe44e('0x23')](function(_0x47ae93){_0xd98ce9[_0xe44e('0x1d')]=_0x47ae93;if(_0x5bdb31[_0xe44e('0x30')][_0xe44e('0x3d')]){_0x3800a3[_0xe44e('0x3e')]=[{'all':!![]}];}return db[_0xe44e('0x2b')][_0xe44e('0x3f')](_0x3800a3);})[_0xe44e('0x23')](function(_0x406318){_0xd98ce9[_0xe44e('0x40')]=_0x406318;return _0xd98ce9;})[_0xe44e('0x23')](respondWithFilteredResult(_0x45ca0d,_0x3800a3))[_0xe44e('0x41')](handleError(_0x45ca0d,null));};exports[_0xe44e('0x42')]=function(_0x3b05a6,_0x4e1a18){var _0x16f720={'raw':![],'where':{'id':_0x3b05a6[_0xe44e('0x43')]['id']}},_0x2d12e8={};_0x2d12e8[_0xe44e('0x31')]=_['keys'](db[_0xe44e('0x2b')][_0xe44e('0x2c')]);_0x2d12e8[_0xe44e('0x30')]=_[_0xe44e('0x44')](_0x3b05a6[_0xe44e('0x30')]);_0x2d12e8[_0xe44e('0x39')]=_[_0xe44e('0x32')](_0x2d12e8[_0xe44e('0x31')],_0x2d12e8[_0xe44e('0x30')]);_0x16f720[_0xe44e('0x34')]=_['intersection'](_0x2d12e8[_0xe44e('0x31')],qs['fields'](_0x3b05a6[_0xe44e('0x30')][_0xe44e('0x33')]));_0x16f720[_0xe44e('0x34')]=_0x16f720['attributes']['length']?_0x16f720['attributes']:_0x2d12e8[_0xe44e('0x31')];if(_0x3b05a6['query'][_0xe44e('0x3d')]){_0x16f720['include']=[{'all':!![]}];}_0x16f720=_[_0xe44e('0x45')]({},_0x16f720,_0x3b05a6[_0xe44e('0x3c')]);return db[_0xe44e('0x2b')][_0xe44e('0x46')](_0x16f720)[_0xe44e('0x23')](handleEntityNotFound(_0x4e1a18,null))[_0xe44e('0x23')](respondWithResult(_0x4e1a18,null))[_0xe44e('0x41')](handleError(_0x4e1a18,null));};exports[_0xe44e('0x47')]=function(_0x211a5b,_0x5a59cd){return db[_0xe44e('0x2b')]['create'](_0x211a5b[_0xe44e('0x48')],{})[_0xe44e('0x23')](respondWithResult(_0x5a59cd,0xc9))['catch'](handleError(_0x5a59cd,null));};exports[_0xe44e('0x22')]=function(_0x3dd26b,_0x4b5b88){if(_0x3dd26b['body']['id']){delete _0x3dd26b[_0xe44e('0x48')]['id'];}return db['SugarcrmConfiguration'][_0xe44e('0x46')]({'where':{'id':_0x3dd26b['params']['id']}})[_0xe44e('0x23')](handleEntityNotFound(_0x4b5b88,null))[_0xe44e('0x23')](saveUpdates(_0x3dd26b[_0xe44e('0x48')],null))[_0xe44e('0x23')](respondWithResult(_0x4b5b88,null))['catch'](handleError(_0x4b5b88,null));};exports['destroy']=function(_0xf68e07,_0x47bf82){return db[_0xe44e('0x2b')][_0xe44e('0x46')]({'where':{'id':_0xf68e07[_0xe44e('0x43')]['id']}})[_0xe44e('0x23')](handleEntityNotFound(_0x47bf82,null))[_0xe44e('0x23')](removeEntity(_0x47bf82,null))['catch'](handleError(_0x47bf82,null));};exports[_0xe44e('0x49')]=function(_0x5e82e1,_0x2f54fb,_0x3557aa){var _0x50ed16={};var _0x1794cc={};var _0x30e1fc;var _0x2ac19b;return db[_0xe44e('0x2b')][_0xe44e('0x4a')]({'where':{'id':_0x5e82e1[_0xe44e('0x43')]['id']}})[_0xe44e('0x23')](handleEntityNotFound(_0x2f54fb,null))[_0xe44e('0x23')](function(_0x3aaece){if(_0x3aaece){_0x30e1fc=_0x3aaece;_0x1794cc['model']=_[_0xe44e('0x44')](db[_0xe44e('0x4b')][_0xe44e('0x2c')]);_0x1794cc['query']=_[_0xe44e('0x44')](_0x5e82e1[_0xe44e('0x30')]);_0x1794cc[_0xe44e('0x39')]=_[_0xe44e('0x32')](_0x1794cc[_0xe44e('0x31')],_0x1794cc['query']);_0x50ed16[_0xe44e('0x34')]=_[_0xe44e('0x32')](_0x1794cc[_0xe44e('0x31')],qs[_0xe44e('0x33')](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x33')]));_0x50ed16['attributes']=_0x50ed16[_0xe44e('0x34')][_0xe44e('0x35')]?_0x50ed16[_0xe44e('0x34')]:_0x1794cc['model'];_0x50ed16[_0xe44e('0x4c')]=qs[_0xe44e('0x37')](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x37')]);_0x50ed16['where']=qs[_0xe44e('0x39')](_[_0xe44e('0x4d')](_0x5e82e1['query'],_0x1794cc[_0xe44e('0x39')]));if(_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x3a')]){_0x50ed16['where']=_[_0xe44e('0x45')](_0x50ed16[_0xe44e('0x38')],{'$or':_[_0xe44e('0x2a')](_0x50ed16[_0xe44e('0x34')],function(_0xf9fa3b){var _0x4eab27={};_0x4eab27[_0xf9fa3b]={'$like':'%'+_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x3a')]+'%'};return _0x4eab27;})});}_0x50ed16=_['merge']({},_0x50ed16,_0x5e82e1[_0xe44e('0x3c')]);return _0x30e1fc['getFields'](_0x50ed16);}})[_0xe44e('0x23')](function(_0x194ded){if(_0x194ded){_0x2ac19b=_0x194ded['length'];if(!_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x36')](_0xe44e('0x4e'))){_0x50ed16[_0xe44e('0x1b')]=qs['limit'](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x1b')]);_0x50ed16[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x1c')]);}return _0x30e1fc[_0xe44e('0x49')](_0x50ed16);}})[_0xe44e('0x23')](function(_0x536943){if(_0x536943){return _0x536943?{'count':_0x2ac19b,'rows':_0x536943}:null;}})['then'](respondWithResult(_0x2f54fb,null))['catch'](handleError(_0x2f54fb,null));};exports['getSubjects']=function(_0x16898b,_0x852546,_0x13e353){var _0x267ab9={};var _0x312ade={};var _0x57a88a;var _0x1db9e8;return db[_0xe44e('0x2b')]['findOne']({'where':{'id':_0x16898b['params']['id']}})['then'](handleEntityNotFound(_0x852546,null))[_0xe44e('0x23')](function(_0x2d70fa){if(_0x2d70fa){_0x57a88a=_0x2d70fa;_0x312ade[_0xe44e('0x31')]=_['keys'](db[_0xe44e('0x4b')][_0xe44e('0x2c')]);_0x312ade['query']=_[_0xe44e('0x44')](_0x16898b[_0xe44e('0x30')]);_0x312ade[_0xe44e('0x39')]=_['intersection'](_0x312ade[_0xe44e('0x31')],_0x312ade[_0xe44e('0x30')]);_0x267ab9[_0xe44e('0x34')]=_[_0xe44e('0x32')](_0x312ade[_0xe44e('0x31')],qs['fields'](_0x16898b[_0xe44e('0x30')][_0xe44e('0x33')]));_0x267ab9[_0xe44e('0x34')]=_0x267ab9[_0xe44e('0x34')][_0xe44e('0x35')]?_0x267ab9[_0xe44e('0x34')]:_0x312ade[_0xe44e('0x31')];_0x267ab9['order']=qs['sort'](_0x16898b[_0xe44e('0x30')][_0xe44e('0x37')]);_0x267ab9['where']=qs[_0xe44e('0x39')](_[_0xe44e('0x4d')](_0x16898b[_0xe44e('0x30')],_0x312ade[_0xe44e('0x39')]));if(_0x16898b['query'][_0xe44e('0x3a')]){_0x267ab9['where']=_[_0xe44e('0x45')](_0x267ab9['where'],{'$or':_['map'](_0x267ab9[_0xe44e('0x34')],function(_0x148a8a){var _0x137afb={};_0x137afb[_0x148a8a]={'$like':'%'+_0x16898b['query']['filter']+'%'};return _0x137afb;})});}_0x267ab9=_[_0xe44e('0x45')]({},_0x267ab9,_0x16898b[_0xe44e('0x3c')]);return _0x57a88a[_0xe44e('0x4f')](_0x267ab9);}})[_0xe44e('0x23')](function(_0x141d63){if(_0x141d63){_0x1db9e8=_0x141d63['length'];if(!_0x16898b['query'][_0xe44e('0x36')](_0xe44e('0x4e'))){_0x267ab9['limit']=qs[_0xe44e('0x1b')](_0x16898b[_0xe44e('0x30')][_0xe44e('0x1b')]);_0x267ab9[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x16898b[_0xe44e('0x30')][_0xe44e('0x1c')]);}return _0x57a88a[_0xe44e('0x4f')](_0x267ab9);}})['then'](function(_0x4dc82b){if(_0x4dc82b){return _0x4dc82b?{'count':_0x1db9e8,'rows':_0x4dc82b}:null;}})['then'](respondWithResult(_0x852546,null))['catch'](handleError(_0x852546,null));};exports[_0xe44e('0x50')]=function(_0x3ec4c4,_0x35f065,_0x22933c){var _0x352b6e={};var _0x4a35e6={};var _0x2556f8;var _0x1fc596;return db['SugarcrmConfiguration'][_0xe44e('0x4a')]({'where':{'id':_0x3ec4c4['params']['id']}})['then'](handleEntityNotFound(_0x35f065,null))[_0xe44e('0x23')](function(_0x468a0f){if(_0x468a0f){_0x2556f8=_0x468a0f;_0x4a35e6[_0xe44e('0x31')]=_[_0xe44e('0x44')](db['SugarcrmField']['rawAttributes']);_0x4a35e6['query']=_[_0xe44e('0x44')](_0x3ec4c4[_0xe44e('0x30')]);_0x4a35e6[_0xe44e('0x39')]=_[_0xe44e('0x32')](_0x4a35e6['model'],_0x4a35e6[_0xe44e('0x30')]);_0x352b6e[_0xe44e('0x34')]=_[_0xe44e('0x32')](_0x4a35e6[_0xe44e('0x31')],qs[_0xe44e('0x33')](_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x33')]));_0x352b6e[_0xe44e('0x34')]=_0x352b6e['attributes']['length']?_0x352b6e['attributes']:_0x4a35e6[_0xe44e('0x31')];_0x352b6e[_0xe44e('0x4c')]=qs[_0xe44e('0x37')](_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x37')]);_0x352b6e['where']=qs['filters'](_['pick'](_0x3ec4c4[_0xe44e('0x30')],_0x4a35e6['filters']));if(_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x3a')]){_0x352b6e['where']=_[_0xe44e('0x45')](_0x352b6e[_0xe44e('0x38')],{'$or':_[_0xe44e('0x2a')](_0x352b6e[_0xe44e('0x34')],function(_0x2613fa){var _0xc1d82f={};_0xc1d82f[_0x2613fa]={'$like':'%'+_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x3a')]+'%'};return _0xc1d82f;})});}_0x352b6e=_[_0xe44e('0x45')]({},_0x352b6e,_0x3ec4c4[_0xe44e('0x3c')]);return _0x2556f8['getDescriptions'](_0x352b6e);}})[_0xe44e('0x23')](function(_0x261164){if(_0x261164){_0x1fc596=_0x261164[_0xe44e('0x35')];if(!_0x3ec4c4[_0xe44e('0x30')]['hasOwnProperty']('nolimit')){_0x352b6e[_0xe44e('0x1b')]=qs[_0xe44e('0x1b')](_0x3ec4c4[_0xe44e('0x30')]['limit']);_0x352b6e[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x3ec4c4[_0xe44e('0x30')]['offset']);}return _0x2556f8[_0xe44e('0x50')](_0x352b6e);}})[_0xe44e('0x23')](function(_0x25d7ef){if(_0x25d7ef){return _0x25d7ef?{'count':_0x1fc596,'rows':_0x25d7ef}:null;}})['then'](respondWithResult(_0x35f065,null))[_0xe44e('0x41')](handleError(_0x35f065,null));}; \ No newline at end of file +var _0xf646=['offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','getFields','findOne','SugarcrmField','getSubjects','pick','getDescriptions','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x260b0e,_0xb3273d){var _0x31ac9e=function(_0x39229f){while(--_0x39229f){_0x260b0e['push'](_0x260b0e['shift']());}};_0x31ac9e(++_0xb3273d);}(_0xf646,0xcc));var _0x6f64=function(_0x1069c4,_0x2ae076){_0x1069c4=_0x1069c4-0x0;var _0x21a5e5=_0xf646[_0x1069c4];return _0x21a5e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f64('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f64('0x1'));var rp=require(_0x6f64('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f64('0x3'));var util=require(_0x6f64('0x4'));var path=require('path');var sox=require(_0x6f64('0x5'));var csv=require('to-csv');var ejs=require(_0x6f64('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f64('0x7'));var squel=require(_0x6f64('0x8'));var crypto=require('crypto');var jsforce=require(_0x6f64('0x9'));var deskjs=require(_0x6f64('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6f64('0xb'));var Papa=require('papaparse');var Redis=require(_0x6f64('0xc'));var authService=require(_0x6f64('0xd'));var qs=require(_0x6f64('0xe'));var as=require(_0x6f64('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f64('0x10'))(_0x6f64('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f64('0x12'));var db=require(_0x6f64('0x13'))['db'];function respondWithStatusCode(_0x7f7edb,_0x473074){_0x473074=_0x473074||0xcc;return function(_0x92f82c){if(_0x92f82c){return _0x7f7edb[_0x6f64('0x14')](_0x473074);}return _0x7f7edb[_0x6f64('0x15')](_0x473074)[_0x6f64('0x16')]();};}function respondWithResult(_0x2d26d4,_0xca4d1a){_0xca4d1a=_0xca4d1a||0xc8;return function(_0x547918){if(_0x547918){return _0x2d26d4['status'](_0xca4d1a)[_0x6f64('0x17')](_0x547918);}};}function respondWithFilteredResult(_0x1ce2db,_0x24a397){return function(_0x162586){if(_0x162586){var _0x204e87=typeof _0x24a397[_0x6f64('0x18')]===_0x6f64('0x19')&&typeof _0x24a397['limit']===_0x6f64('0x19');var _0x47daf6=_0x162586[_0x6f64('0x1a')];var _0x55f18f=_0x204e87?0x0:_0x24a397['offset'];var _0x5b88d3=_0x204e87?_0x162586[_0x6f64('0x1a')]:_0x24a397['offset']+_0x24a397[_0x6f64('0x1b')];var _0x104ea9;if(_0x5b88d3>=_0x47daf6){_0x5b88d3=_0x47daf6;_0x104ea9=0xc8;}else{_0x104ea9=0xce;}_0x1ce2db[_0x6f64('0x15')](_0x104ea9);return _0x1ce2db['set'](_0x6f64('0x1c'),_0x55f18f+'-'+_0x5b88d3+'/'+_0x47daf6)[_0x6f64('0x17')](_0x162586);}return null;};}function patchUpdates(_0x4e8e7e){return function(_0x360fbc){try{jsonpatch[_0x6f64('0x1d')](_0x360fbc,_0x4e8e7e,!![]);}catch(_0x497da0){return BPromise[_0x6f64('0x1e')](_0x497da0);}return _0x360fbc[_0x6f64('0x1f')]();};}function saveUpdates(_0x355680,_0x3d2754){return function(_0xfd4a0d){if(_0xfd4a0d){return _0xfd4a0d[_0x6f64('0x20')](_0x355680)[_0x6f64('0x21')](function(_0x215b98){return _0x215b98;});}return null;};}function removeEntity(_0x60b632,_0x38be5b){return function(_0x202e6e){if(_0x202e6e){return _0x202e6e[_0x6f64('0x22')]()[_0x6f64('0x21')](function(){_0x60b632['status'](0xcc)[_0x6f64('0x16')]();});}};}function handleEntityNotFound(_0xcd2781,_0x417520){return function(_0x575909){if(!_0x575909){_0xcd2781['sendStatus'](0x194);}return _0x575909;};}function handleError(_0x35c441,_0x4280b3){_0x4280b3=_0x4280b3||0x1f4;return function(_0x46dee8){logger[_0x6f64('0x23')](_0x46dee8['stack']);if(_0x46dee8[_0x6f64('0x24')]){delete _0x46dee8[_0x6f64('0x24')];}_0x35c441[_0x6f64('0x15')](_0x4280b3)[_0x6f64('0x25')](_0x46dee8);};}exports[_0x6f64('0x26')]=function(_0x39daaa,_0x29d698){var _0x3af17d={},_0x3d6639={},_0x522e3c={'count':0x0,'rows':[]};var _0x2eba8a=_[_0x6f64('0x27')](db[_0x6f64('0x28')]['rawAttributes'],function(_0x207f09){return{'name':_0x207f09[_0x6f64('0x29')],'type':_0x207f09[_0x6f64('0x2a')][_0x6f64('0x2b')]};});_0x3d6639[_0x6f64('0x2c')]=_[_0x6f64('0x27')](_0x2eba8a,_0x6f64('0x24'));_0x3d6639['query']=_[_0x6f64('0x2d')](_0x39daaa[_0x6f64('0x2e')]);_0x3d6639[_0x6f64('0x2f')]=_[_0x6f64('0x30')](_0x3d6639[_0x6f64('0x2c')],_0x3d6639[_0x6f64('0x2e')]);_0x3af17d[_0x6f64('0x31')]=_['intersection'](_0x3d6639['model'],qs[_0x6f64('0x32')](_0x39daaa['query'][_0x6f64('0x32')]));_0x3af17d['attributes']=_0x3af17d[_0x6f64('0x31')][_0x6f64('0x33')]?_0x3af17d[_0x6f64('0x31')]:_0x3d6639[_0x6f64('0x2c')];if(!_0x39daaa['query'][_0x6f64('0x34')](_0x6f64('0x35'))){_0x3af17d['limit']=qs[_0x6f64('0x1b')](_0x39daaa[_0x6f64('0x2e')][_0x6f64('0x1b')]);_0x3af17d[_0x6f64('0x18')]=qs['offset'](_0x39daaa['query'][_0x6f64('0x18')]);}_0x3af17d[_0x6f64('0x36')]=qs[_0x6f64('0x37')](_0x39daaa[_0x6f64('0x2e')][_0x6f64('0x37')]);_0x3af17d[_0x6f64('0x38')]=qs['filters'](_['pick'](_0x39daaa[_0x6f64('0x2e')],_0x3d6639[_0x6f64('0x2f')]),_0x2eba8a);if(_0x39daaa[_0x6f64('0x2e')][_0x6f64('0x39')]){_0x3af17d['where']=_['merge'](_0x3af17d['where'],{'$or':_['map'](_0x2eba8a,function(_0x3f8905){if(_0x3f8905['type']!=='VIRTUAL'){var _0x3eaeea={};_0x3eaeea[_0x3f8905[_0x6f64('0x24')]]={'$like':'%'+_0x39daaa[_0x6f64('0x2e')][_0x6f64('0x39')]+'%'};return _0x3eaeea;}})});}_0x3af17d=_[_0x6f64('0x3a')]({},_0x3af17d,_0x39daaa['options']);var _0x23f220={'where':_0x3af17d[_0x6f64('0x38')]};return db[_0x6f64('0x28')]['count'](_0x23f220)['then'](function(_0x35b91a){_0x522e3c[_0x6f64('0x1a')]=_0x35b91a;if(_0x39daaa[_0x6f64('0x2e')]['includeAll']){_0x3af17d[_0x6f64('0x3b')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x6f64('0x3c')](_0x3af17d);})[_0x6f64('0x21')](function(_0x39a48e){_0x522e3c[_0x6f64('0x3d')]=_0x39a48e;return _0x522e3c;})[_0x6f64('0x21')](respondWithFilteredResult(_0x29d698,_0x3af17d))[_0x6f64('0x3e')](handleError(_0x29d698,null));};exports['show']=function(_0x14d253,_0x28ab4d){var _0x314315={'raw':![],'where':{'id':_0x14d253[_0x6f64('0x3f')]['id']}},_0x330ef8={};_0x330ef8['model']=_[_0x6f64('0x2d')](db[_0x6f64('0x28')][_0x6f64('0x40')]);_0x330ef8['query']=_['keys'](_0x14d253['query']);_0x330ef8[_0x6f64('0x2f')]=_[_0x6f64('0x30')](_0x330ef8['model'],_0x330ef8[_0x6f64('0x2e')]);_0x314315[_0x6f64('0x31')]=_[_0x6f64('0x30')](_0x330ef8[_0x6f64('0x2c')],qs[_0x6f64('0x32')](_0x14d253[_0x6f64('0x2e')]['fields']));_0x314315[_0x6f64('0x31')]=_0x314315[_0x6f64('0x31')]['length']?_0x314315[_0x6f64('0x31')]:_0x330ef8[_0x6f64('0x2c')];if(_0x14d253[_0x6f64('0x2e')][_0x6f64('0x41')]){_0x314315[_0x6f64('0x3b')]=[{'all':!![]}];}_0x314315=_['merge']({},_0x314315,_0x14d253[_0x6f64('0x42')]);return db[_0x6f64('0x28')][_0x6f64('0x43')](_0x314315)[_0x6f64('0x21')](handleEntityNotFound(_0x28ab4d,null))['then'](respondWithResult(_0x28ab4d,null))[_0x6f64('0x3e')](handleError(_0x28ab4d,null));};exports[_0x6f64('0x44')]=function(_0xe9a0e3,_0x58f907){return db[_0x6f64('0x28')][_0x6f64('0x44')](_0xe9a0e3[_0x6f64('0x45')],{})[_0x6f64('0x21')](respondWithResult(_0x58f907,0xc9))[_0x6f64('0x3e')](handleError(_0x58f907,null));};exports[_0x6f64('0x20')]=function(_0x3757f8,_0x48c885){if(_0x3757f8[_0x6f64('0x45')]['id']){delete _0x3757f8[_0x6f64('0x45')]['id'];}return db[_0x6f64('0x28')][_0x6f64('0x43')]({'where':{'id':_0x3757f8[_0x6f64('0x3f')]['id']}})[_0x6f64('0x21')](handleEntityNotFound(_0x48c885,null))[_0x6f64('0x21')](saveUpdates(_0x3757f8[_0x6f64('0x45')],null))['then'](respondWithResult(_0x48c885,null))[_0x6f64('0x3e')](handleError(_0x48c885,null));};exports[_0x6f64('0x22')]=function(_0x3bf0f6,_0x12f199){return db[_0x6f64('0x28')][_0x6f64('0x43')]({'where':{'id':_0x3bf0f6[_0x6f64('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12f199,null))['then'](removeEntity(_0x12f199,null))['catch'](handleError(_0x12f199,null));};exports[_0x6f64('0x46')]=function(_0x4633e3,_0x2ba0de,_0x1e0d77){var _0x2bbf6f={};var _0x7dc79d={};var _0x585762;var _0x13147f;return db[_0x6f64('0x28')][_0x6f64('0x47')]({'where':{'id':_0x4633e3[_0x6f64('0x3f')]['id']}})[_0x6f64('0x21')](handleEntityNotFound(_0x2ba0de,null))[_0x6f64('0x21')](function(_0x53be2d){if(_0x53be2d){_0x585762=_0x53be2d;_0x7dc79d[_0x6f64('0x2c')]=_[_0x6f64('0x2d')](db[_0x6f64('0x48')][_0x6f64('0x40')]);_0x7dc79d['query']=_[_0x6f64('0x2d')](_0x4633e3[_0x6f64('0x2e')]);_0x7dc79d[_0x6f64('0x2f')]=_[_0x6f64('0x30')](_0x7dc79d[_0x6f64('0x2c')],_0x7dc79d[_0x6f64('0x2e')]);_0x2bbf6f[_0x6f64('0x31')]=_[_0x6f64('0x30')](_0x7dc79d['model'],qs[_0x6f64('0x32')](_0x4633e3['query']['fields']));_0x2bbf6f[_0x6f64('0x31')]=_0x2bbf6f[_0x6f64('0x31')]['length']?_0x2bbf6f[_0x6f64('0x31')]:_0x7dc79d[_0x6f64('0x2c')];_0x2bbf6f[_0x6f64('0x36')]=qs[_0x6f64('0x37')](_0x4633e3[_0x6f64('0x2e')][_0x6f64('0x37')]);_0x2bbf6f[_0x6f64('0x38')]=qs[_0x6f64('0x2f')](_['pick'](_0x4633e3[_0x6f64('0x2e')],_0x7dc79d[_0x6f64('0x2f')]));if(_0x4633e3[_0x6f64('0x2e')][_0x6f64('0x39')]){_0x2bbf6f[_0x6f64('0x38')]=_[_0x6f64('0x3a')](_0x2bbf6f[_0x6f64('0x38')],{'$or':_[_0x6f64('0x27')](_0x2bbf6f[_0x6f64('0x31')],function(_0x471a7d){var _0x44d0b7={};_0x44d0b7[_0x471a7d]={'$like':'%'+_0x4633e3[_0x6f64('0x2e')][_0x6f64('0x39')]+'%'};return _0x44d0b7;})});}_0x2bbf6f=_[_0x6f64('0x3a')]({},_0x2bbf6f,_0x4633e3[_0x6f64('0x42')]);return _0x585762[_0x6f64('0x46')](_0x2bbf6f);}})[_0x6f64('0x21')](function(_0x2d124c){if(_0x2d124c){_0x13147f=_0x2d124c[_0x6f64('0x33')];if(!_0x4633e3[_0x6f64('0x2e')][_0x6f64('0x34')](_0x6f64('0x35'))){_0x2bbf6f[_0x6f64('0x1b')]=qs[_0x6f64('0x1b')](_0x4633e3[_0x6f64('0x2e')][_0x6f64('0x1b')]);_0x2bbf6f[_0x6f64('0x18')]=qs[_0x6f64('0x18')](_0x4633e3[_0x6f64('0x2e')]['offset']);}return _0x585762[_0x6f64('0x46')](_0x2bbf6f);}})[_0x6f64('0x21')](function(_0x42461f){if(_0x42461f){return _0x42461f?{'count':_0x13147f,'rows':_0x42461f}:null;}})['then'](respondWithResult(_0x2ba0de,null))[_0x6f64('0x3e')](handleError(_0x2ba0de,null));};exports[_0x6f64('0x49')]=function(_0x54420a,_0x47c12b,_0x4be123){var _0xc1ccf={};var _0x486135={};var _0x19b61f;var _0x27e80a;return db['SugarcrmConfiguration'][_0x6f64('0x47')]({'where':{'id':_0x54420a['params']['id']}})[_0x6f64('0x21')](handleEntityNotFound(_0x47c12b,null))[_0x6f64('0x21')](function(_0x1c9ddd){if(_0x1c9ddd){_0x19b61f=_0x1c9ddd;_0x486135['model']=_[_0x6f64('0x2d')](db['SugarcrmField'][_0x6f64('0x40')]);_0x486135['query']=_[_0x6f64('0x2d')](_0x54420a[_0x6f64('0x2e')]);_0x486135['filters']=_[_0x6f64('0x30')](_0x486135[_0x6f64('0x2c')],_0x486135[_0x6f64('0x2e')]);_0xc1ccf[_0x6f64('0x31')]=_[_0x6f64('0x30')](_0x486135[_0x6f64('0x2c')],qs[_0x6f64('0x32')](_0x54420a[_0x6f64('0x2e')][_0x6f64('0x32')]));_0xc1ccf[_0x6f64('0x31')]=_0xc1ccf[_0x6f64('0x31')][_0x6f64('0x33')]?_0xc1ccf['attributes']:_0x486135[_0x6f64('0x2c')];_0xc1ccf['order']=qs[_0x6f64('0x37')](_0x54420a[_0x6f64('0x2e')][_0x6f64('0x37')]);_0xc1ccf[_0x6f64('0x38')]=qs[_0x6f64('0x2f')](_[_0x6f64('0x4a')](_0x54420a[_0x6f64('0x2e')],_0x486135[_0x6f64('0x2f')]));if(_0x54420a[_0x6f64('0x2e')][_0x6f64('0x39')]){_0xc1ccf[_0x6f64('0x38')]=_[_0x6f64('0x3a')](_0xc1ccf[_0x6f64('0x38')],{'$or':_[_0x6f64('0x27')](_0xc1ccf[_0x6f64('0x31')],function(_0x13de30){var _0x165d69={};_0x165d69[_0x13de30]={'$like':'%'+_0x54420a[_0x6f64('0x2e')][_0x6f64('0x39')]+'%'};return _0x165d69;})});}_0xc1ccf=_[_0x6f64('0x3a')]({},_0xc1ccf,_0x54420a[_0x6f64('0x42')]);return _0x19b61f[_0x6f64('0x49')](_0xc1ccf);}})[_0x6f64('0x21')](function(_0x50545c){if(_0x50545c){_0x27e80a=_0x50545c[_0x6f64('0x33')];if(!_0x54420a[_0x6f64('0x2e')]['hasOwnProperty'](_0x6f64('0x35'))){_0xc1ccf[_0x6f64('0x1b')]=qs[_0x6f64('0x1b')](_0x54420a[_0x6f64('0x2e')][_0x6f64('0x1b')]);_0xc1ccf['offset']=qs[_0x6f64('0x18')](_0x54420a[_0x6f64('0x2e')][_0x6f64('0x18')]);}return _0x19b61f['getSubjects'](_0xc1ccf);}})[_0x6f64('0x21')](function(_0x49d9fa){if(_0x49d9fa){return _0x49d9fa?{'count':_0x27e80a,'rows':_0x49d9fa}:null;}})[_0x6f64('0x21')](respondWithResult(_0x47c12b,null))[_0x6f64('0x3e')](handleError(_0x47c12b,null));};exports[_0x6f64('0x4b')]=function(_0x2a13ff,_0x3adf99,_0x2a5f61){var _0xac292f={};var _0xb6b4b7={};var _0x3b798f;var _0x4332f0;return db[_0x6f64('0x28')][_0x6f64('0x47')]({'where':{'id':_0x2a13ff[_0x6f64('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3adf99,null))[_0x6f64('0x21')](function(_0x214f19){if(_0x214f19){_0x3b798f=_0x214f19;_0xb6b4b7['model']=_[_0x6f64('0x2d')](db[_0x6f64('0x48')][_0x6f64('0x40')]);_0xb6b4b7[_0x6f64('0x2e')]=_['keys'](_0x2a13ff[_0x6f64('0x2e')]);_0xb6b4b7[_0x6f64('0x2f')]=_[_0x6f64('0x30')](_0xb6b4b7[_0x6f64('0x2c')],_0xb6b4b7[_0x6f64('0x2e')]);_0xac292f[_0x6f64('0x31')]=_['intersection'](_0xb6b4b7[_0x6f64('0x2c')],qs[_0x6f64('0x32')](_0x2a13ff[_0x6f64('0x2e')][_0x6f64('0x32')]));_0xac292f[_0x6f64('0x31')]=_0xac292f[_0x6f64('0x31')][_0x6f64('0x33')]?_0xac292f[_0x6f64('0x31')]:_0xb6b4b7[_0x6f64('0x2c')];_0xac292f[_0x6f64('0x36')]=qs[_0x6f64('0x37')](_0x2a13ff[_0x6f64('0x2e')][_0x6f64('0x37')]);_0xac292f[_0x6f64('0x38')]=qs[_0x6f64('0x2f')](_[_0x6f64('0x4a')](_0x2a13ff[_0x6f64('0x2e')],_0xb6b4b7[_0x6f64('0x2f')]));if(_0x2a13ff[_0x6f64('0x2e')][_0x6f64('0x39')]){_0xac292f['where']=_[_0x6f64('0x3a')](_0xac292f[_0x6f64('0x38')],{'$or':_[_0x6f64('0x27')](_0xac292f[_0x6f64('0x31')],function(_0x514d97){var _0x4e9aae={};_0x4e9aae[_0x514d97]={'$like':'%'+_0x2a13ff[_0x6f64('0x2e')]['filter']+'%'};return _0x4e9aae;})});}_0xac292f=_[_0x6f64('0x3a')]({},_0xac292f,_0x2a13ff[_0x6f64('0x42')]);return _0x3b798f[_0x6f64('0x4b')](_0xac292f);}})[_0x6f64('0x21')](function(_0x18a219){if(_0x18a219){_0x4332f0=_0x18a219['length'];if(!_0x2a13ff[_0x6f64('0x2e')]['hasOwnProperty'](_0x6f64('0x35'))){_0xac292f[_0x6f64('0x1b')]=qs['limit'](_0x2a13ff[_0x6f64('0x2e')][_0x6f64('0x1b')]);_0xac292f[_0x6f64('0x18')]=qs[_0x6f64('0x18')](_0x2a13ff['query']['offset']);}return _0x3b798f[_0x6f64('0x4b')](_0xac292f);}})['then'](function(_0x162186){if(_0x162186){return _0x162186?{'count':_0x4332f0,'rows':_0x162186}:null;}})[_0x6f64('0x21')](respondWithResult(_0x3adf99,null))[_0x6f64('0x3e')](handleError(_0x3adf99,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index fdeb81e..b8b7113 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 _0xa2d5=['moment','request-promise','path','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x15433b,_0x629b9d){var _0x3ce496=function(_0xe54809){while(--_0xe54809){_0x15433b['push'](_0x15433b['shift']());}};_0x3ce496(++_0x629b9d);}(_0xa2d5,0x177));var _0x5a2d=function(_0x2cb58d,_0xb242df){_0x2cb58d=_0x2cb58d-0x0;var _0x2f9c1e=_0xa2d5[_0x2cb58d];return _0x2f9c1e;};'use strict';var _=require(_0x5a2d('0x0'));var util=require(_0x5a2d('0x1'));var logger=require(_0x5a2d('0x2'))('api');var moment=require(_0x5a2d('0x3'));var BPromise=require('bluebird');var rp=require(_0x5a2d('0x4'));var fs=require('fs');var path=require(_0x5a2d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5a2d('0x6'));module['exports']=function(_0x2f93ce,_0x3ae996){return _0x2f93ce[_0x5a2d('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x5a2d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa507=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2cd091,_0x5e52a6){var _0x4729d1=function(_0x3bc845){while(--_0x3bc845){_0x2cd091['push'](_0x2cd091['shift']());}};_0x4729d1(++_0x5e52a6);}(_0xa507,0xcc));var _0x7a50=function(_0x2986fb,_0x9482a0){_0x2986fb=_0x2986fb-0x0;var _0xb3c156=_0xa507[_0x2986fb];return _0xb3c156;};'use strict';var _=require(_0x7a50('0x0'));var util=require(_0x7a50('0x1'));var logger=require(_0x7a50('0x2'))(_0x7a50('0x3'));var moment=require(_0x7a50('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a50('0x5'));var config=require(_0x7a50('0x6'));var attributes=require(_0x7a50('0x7'));module['exports']=function(_0x4dcee6,_0x5c019b){return _0x4dcee6[_0x7a50('0x8')](_0x7a50('0x9'),attributes,{'tableName':_0x7a50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 8acda2f..7e31a7c 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 _0x5fb1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x41a352,_0x1feafa){var _0x101096=function(_0x2c065a){while(--_0x2c065a){_0x41a352['push'](_0x41a352['shift']());}};_0x101096(++_0x1feafa);}(_0x5fb1,0x146));var _0x15fb=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x5fb1[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x15fb('0x0'));var util=require('util');var moment=require(_0x15fb('0x1'));var BPromise=require(_0x15fb('0x2'));var rs=require(_0x15fb('0x3'));var fs=require('fs');var Redis=require(_0x15fb('0x4'));var db=require(_0x15fb('0x5'))['db'];var utils=require(_0x15fb('0x6'));var logger=require(_0x15fb('0x7'))(_0x15fb('0x8'));var config=require(_0x15fb('0x9'));var jayson=require(_0x15fb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1282e8,_0x5c2da8,_0x50aac8){return new BPromise(function(_0x389872,_0x205367){return client['request'](_0x1282e8,_0x50aac8)[_0x15fb('0xb')](function(_0x331320){logger[_0x15fb('0xc')](_0x15fb('0xd'),_0x5c2da8,_0x15fb('0xe'));logger[_0x15fb('0xf')](_0x15fb('0x10'),_0x5c2da8,_0x15fb('0xe'),JSON[_0x15fb('0x11')](_0x331320));if(_0x331320['error']){if(_0x331320[_0x15fb('0x12')][_0x15fb('0x13')]===0x1f4){logger[_0x15fb('0x12')](_0x15fb('0xd'),_0x5c2da8,_0x331320['error']['message']);return _0x205367(_0x331320[_0x15fb('0x12')][_0x15fb('0x14')]);}logger[_0x15fb('0x12')](_0x15fb('0xd'),_0x5c2da8,_0x331320[_0x15fb('0x12')]['message']);return _0x389872(_0x331320[_0x15fb('0x12')]['message']);}else{logger[_0x15fb('0xc')](_0x15fb('0xd'),_0x5c2da8,_0x15fb('0xe'));_0x389872(_0x331320[_0x15fb('0x15')][_0x15fb('0x14')]);}})['catch'](function(_0x4d98aa){logger[_0x15fb('0x12')](_0x15fb('0xd'),_0x5c2da8,_0x4d98aa);_0x205367(_0x4d98aa);});});} \ No newline at end of file +var _0x542f=['request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x8ee422,_0x5c815f){var _0x322f12=function(_0x5d7a04){while(--_0x5d7a04){_0x8ee422['push'](_0x8ee422['shift']());}};_0x322f12(++_0x5c815f);}(_0x542f,0x185));var _0xf542=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x542f[_0x46a3e8];return _0xf1442e;};'use strict';var _=require(_0xf542('0x0'));var util=require(_0xf542('0x1'));var moment=require(_0xf542('0x2'));var BPromise=require(_0xf542('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf542('0x4'));var db=require(_0xf542('0x5'))['db'];var utils=require(_0xf542('0x6'));var logger=require(_0xf542('0x7'))(_0xf542('0x8'));var config=require(_0xf542('0x9'));var jayson=require(_0xf542('0xa'));var client=jayson[_0xf542('0xb')][_0xf542('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe338c2,_0x1e85b5,_0x4544a5){return new BPromise(function(_0x529459,_0x33597e){return client[_0xf542('0xd')](_0xe338c2,_0x4544a5)[_0xf542('0xe')](function(_0x16e5e0){logger[_0xf542('0xf')](_0xf542('0x10'),_0x1e85b5,'request\x20sent');logger[_0xf542('0x11')](_0xf542('0x12'),_0x1e85b5,_0xf542('0x13'),JSON[_0xf542('0x14')](_0x16e5e0));if(_0x16e5e0[_0xf542('0x15')]){if(_0x16e5e0['error']['code']===0x1f4){logger[_0xf542('0x15')](_0xf542('0x10'),_0x1e85b5,_0x16e5e0['error'][_0xf542('0x16')]);return _0x33597e(_0x16e5e0[_0xf542('0x15')]['message']);}logger[_0xf542('0x15')](_0xf542('0x10'),_0x1e85b5,_0x16e5e0['error'][_0xf542('0x16')]);return _0x529459(_0x16e5e0[_0xf542('0x15')]['message']);}else{logger['info'](_0xf542('0x10'),_0x1e85b5,_0xf542('0x13'));_0x529459(_0x16e5e0['result'][_0xf542('0x16')]);}})[_0xf542('0x17')](function(_0x53be89){logger['error'](_0xf542('0x10'),_0x1e85b5,_0x53be89);_0x33597e(_0x53be89);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d9959a6..a8cd24e 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 _0x797e=['show','post','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id','isAuthenticated'];(function(_0x47fb54,_0x28698c){var _0x1139a7=function(_0x17c781){while(--_0x17c781){_0x47fb54['push'](_0x47fb54['shift']());}};_0x1139a7(++_0x28698c);}(_0x797e,0x71));var _0xe797=function(_0x3f264c,_0x30c0c6){_0x3f264c=_0x3f264c-0x0;var _0x133f67=_0x797e[_0x3f264c];return _0x133f67;};'use strict';var multer=require(_0xe797('0x0'));var util=require(_0xe797('0x1'));var path=require('path');var timeout=require(_0xe797('0x2'));var express=require(_0xe797('0x3'));var router=express[_0xe797('0x4')]();var fs_extra=require(_0xe797('0x5'));var auth=require(_0xe797('0x6'));var interaction=require(_0xe797('0x7'));var config=require(_0xe797('0x8'));var controller=require(_0xe797('0x9'));router[_0xe797('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe797('0xb'),auth[_0xe797('0xc')](),controller[_0xe797('0xd')]);router[_0xe797('0xe')]('/',auth[_0xe797('0xc')](),controller['create']);router[_0xe797('0xf')](_0xe797('0xb'),auth[_0xe797('0xc')](),controller['update']);router[_0xe797('0x10')](_0xe797('0xb'),auth[_0xe797('0xc')](),controller[_0xe797('0x11')]);module['exports']=router; \ No newline at end of file +var _0xed74=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer'];(function(_0x407025,_0x3196ec){var _0x41779e=function(_0x50abd2){while(--_0x50abd2){_0x407025['push'](_0x407025['shift']());}};_0x41779e(++_0x3196ec);}(_0xed74,0x9f));var _0x4ed7=function(_0x368113,_0x244119){_0x368113=_0x368113-0x0;var _0x475e26=_0xed74[_0x368113];return _0x475e26;};'use strict';var multer=require(_0x4ed7('0x0'));var util=require(_0x4ed7('0x1'));var path=require(_0x4ed7('0x2'));var timeout=require(_0x4ed7('0x3'));var express=require(_0x4ed7('0x4'));var router=express[_0x4ed7('0x5')]();var fs_extra=require(_0x4ed7('0x6'));var auth=require(_0x4ed7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4ed7('0x8'));var controller=require(_0x4ed7('0x9'));router[_0x4ed7('0xa')]('/',auth[_0x4ed7('0xb')](),controller[_0x4ed7('0xc')]);router[_0x4ed7('0xa')](_0x4ed7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4ed7('0xe')]('/',auth[_0x4ed7('0xb')](),controller[_0x4ed7('0xf')]);router[_0x4ed7('0x10')]('/:id',auth[_0x4ed7('0xb')](),controller[_0x4ed7('0x11')]);router[_0x4ed7('0x12')](_0x4ed7('0xd'),auth[_0x4ed7('0xb')](),controller[_0x4ed7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d45e67f..6adbf75 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 _0xa9b9=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x5f47a7,_0xb765cf){var _0x1a167c=function(_0x2b3029){while(--_0x2b3029){_0x5f47a7['push'](_0x5f47a7['shift']());}};_0x1a167c(++_0xb765cf);}(_0xa9b9,0x75));var _0x9a9b=function(_0x22de84,_0x56142b){_0x22de84=_0x22de84-0x0;var _0x54fc49=_0xa9b9[_0x22de84];return _0x54fc49;};'use strict';var Sequelize=require(_0x9a9b('0x0'));module['exports']={'type':{'type':Sequelize[_0x9a9b('0x1')]('string',_0x9a9b('0x2'),_0x9a9b('0x3'),_0x9a9b('0x4'),'picklist'),'defaultValue':_0x9a9b('0x5')},'content':{'type':Sequelize[_0x9a9b('0x6')]},'key':{'type':Sequelize[_0x9a9b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x9a9b('0x2'),_0x9a9b('0x3'))},'keyContent':{'type':Sequelize[_0x9a9b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9a9b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a9b('0x6')]}}; \ No newline at end of file +var _0x55b1=['STRING','BOOLEAN','ENUM','variable','customVariable','picklist','string'];(function(_0x535705,_0xf08764){var _0x3149f6=function(_0x4cd3d3){while(--_0x4cd3d3){_0x535705['push'](_0x535705['shift']());}};_0x3149f6(++_0xf08764);}(_0x55b1,0x1d0));var _0x155b=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x55b1[_0x335271];return _0xa9fff8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x155b('0x0')]('string',_0x155b('0x1'),_0x155b('0x2'),'keyValue',_0x155b('0x3')),'defaultValue':_0x155b('0x4')},'content':{'type':Sequelize[_0x155b('0x5')]},'key':{'type':Sequelize[_0x155b('0x5')]},'keyType':{'type':Sequelize[_0x155b('0x0')]('string','variable',_0x155b('0x2'))},'keyContent':{'type':Sequelize[_0x155b('0x5')]},'idField':{'type':Sequelize[_0x155b('0x5')]},'nameField':{'type':Sequelize[_0x155b('0x5')]},'customField':{'type':Sequelize[_0x155b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x155b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a586e56..725f8b8 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 _0xac3b=['SugarcrmField','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0xac3b,0xe9));var _0xbac3=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xac3b[_0x466247];return _0x4b352e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbac3('0x0'));var zipdir=require(_0xbac3('0x1'));var jsonpatch=require(_0xbac3('0x2'));var rp=require(_0xbac3('0x3'));var moment=require(_0xbac3('0x4'));var BPromise=require(_0xbac3('0x5'));var Mustache=require(_0xbac3('0x6'));var util=require(_0xbac3('0x7'));var path=require(_0xbac3('0x8'));var sox=require('sox');var csv=require(_0xbac3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbac3('0xa'));var _=require('lodash');var squel=require(_0xbac3('0xb'));var crypto=require(_0xbac3('0xc'));var jsforce=require(_0xbac3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbac3('0x9'));var querystring=require(_0xbac3('0xe'));var Papa=require(_0xbac3('0xf'));var Redis=require(_0xbac3('0x10'));var authService=require(_0xbac3('0x11'));var qs=require(_0xbac3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbac3('0x13'));var logger=require('../../config/logger')(_0xbac3('0x14'));var utils=require(_0xbac3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbac3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22782d,_0x4b838a){_0x4b838a=_0x4b838a||0xcc;return function(_0x48491c){if(_0x48491c){return _0x22782d[_0xbac3('0x17')](_0x4b838a);}return _0x22782d[_0xbac3('0x18')](_0x4b838a)[_0xbac3('0x19')]();};}function respondWithResult(_0xd9996e,_0x3e8a52){_0x3e8a52=_0x3e8a52||0xc8;return function(_0x56231b){if(_0x56231b){return _0xd9996e[_0xbac3('0x18')](_0x3e8a52)[_0xbac3('0x1a')](_0x56231b);}};}function respondWithFilteredResult(_0x1136f1,_0x28ad44){return function(_0x4a7903){if(_0x4a7903){var _0x3ccf74=typeof _0x28ad44[_0xbac3('0x1b')]==='undefined'&&typeof _0x28ad44[_0xbac3('0x1c')]===_0xbac3('0x1d');var _0x572551=_0x4a7903[_0xbac3('0x1e')];var _0x1680d1=_0x3ccf74?0x0:_0x28ad44[_0xbac3('0x1b')];var _0x5dd215=_0x3ccf74?_0x4a7903[_0xbac3('0x1e')]:_0x28ad44['offset']+_0x28ad44[_0xbac3('0x1c')];var _0x14342c;if(_0x5dd215>=_0x572551){_0x5dd215=_0x572551;_0x14342c=0xc8;}else{_0x14342c=0xce;}_0x1136f1[_0xbac3('0x18')](_0x14342c);return _0x1136f1[_0xbac3('0x1f')](_0xbac3('0x20'),_0x1680d1+'-'+_0x5dd215+'/'+_0x572551)[_0xbac3('0x1a')](_0x4a7903);}return null;};}function patchUpdates(_0x46d5a4){return function(_0x585314){try{jsonpatch[_0xbac3('0x21')](_0x585314,_0x46d5a4,!![]);}catch(_0x53a1dd){return BPromise[_0xbac3('0x22')](_0x53a1dd);}return _0x585314[_0xbac3('0x23')]();};}function saveUpdates(_0x1d6893,_0x564eef){return function(_0x50ae90){if(_0x50ae90){return _0x50ae90['update'](_0x1d6893)[_0xbac3('0x24')](function(_0x1e233b){return _0x1e233b;});}return null;};}function removeEntity(_0xbd482c,_0x31ee34){return function(_0x48e52b){if(_0x48e52b){return _0x48e52b[_0xbac3('0x25')]()[_0xbac3('0x24')](function(){_0xbd482c['status'](0xcc)[_0xbac3('0x19')]();});}};}function handleEntityNotFound(_0x1b80f8,_0x152651){return function(_0x3d2ecf){if(!_0x3d2ecf){_0x1b80f8['sendStatus'](0x194);}return _0x3d2ecf;};}function handleError(_0x223853,_0x12ef7e){_0x12ef7e=_0x12ef7e||0x1f4;return function(_0x50e61b){logger[_0xbac3('0x26')](_0x50e61b['stack']);if(_0x50e61b['name']){delete _0x50e61b[_0xbac3('0x27')];}_0x223853['status'](_0x12ef7e)[_0xbac3('0x28')](_0x50e61b);};}exports[_0xbac3('0x29')]=function(_0x1c336b,_0x3e9d4e){var _0x460c91={},_0x136f04={},_0x391234={'count':0x0,'rows':[]};var _0x3ffcc7=_[_0xbac3('0x2a')](db['SugarcrmField'][_0xbac3('0x2b')],function(_0x427021){return{'name':_0x427021[_0xbac3('0x2c')],'type':_0x427021[_0xbac3('0x2d')][_0xbac3('0x2e')]};});_0x136f04['model']=_[_0xbac3('0x2a')](_0x3ffcc7,_0xbac3('0x27'));_0x136f04[_0xbac3('0x2f')]=_['keys'](_0x1c336b[_0xbac3('0x2f')]);_0x136f04[_0xbac3('0x30')]=_[_0xbac3('0x31')](_0x136f04[_0xbac3('0x32')],_0x136f04['query']);_0x460c91['attributes']=_['intersection'](_0x136f04[_0xbac3('0x32')],qs[_0xbac3('0x33')](_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x33')]));_0x460c91['attributes']=_0x460c91[_0xbac3('0x34')][_0xbac3('0x35')]?_0x460c91[_0xbac3('0x34')]:_0x136f04[_0xbac3('0x32')];if(!_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x36')]('nolimit')){_0x460c91[_0xbac3('0x1c')]=qs[_0xbac3('0x1c')](_0x1c336b['query']['limit']);_0x460c91[_0xbac3('0x1b')]=qs[_0xbac3('0x1b')](_0x1c336b['query'][_0xbac3('0x1b')]);}_0x460c91[_0xbac3('0x37')]=qs[_0xbac3('0x38')](_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x38')]);_0x460c91['where']=qs[_0xbac3('0x30')](_[_0xbac3('0x39')](_0x1c336b[_0xbac3('0x2f')],_0x136f04['filters']),_0x3ffcc7);if(_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x3a')]){_0x460c91[_0xbac3('0x3b')]=_[_0xbac3('0x3c')](_0x460c91[_0xbac3('0x3b')],{'$or':_['map'](_0x3ffcc7,function(_0xb6cf21){if(_0xb6cf21[_0xbac3('0x2d')]!==_0xbac3('0x3d')){var _0x4edd8e={};_0x4edd8e[_0xb6cf21['name']]={'$like':'%'+_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x3a')]+'%'};return _0x4edd8e;}})});}_0x460c91=_[_0xbac3('0x3c')]({},_0x460c91,_0x1c336b[_0xbac3('0x3e')]);var _0x432648={'where':_0x460c91[_0xbac3('0x3b')]};return db[_0xbac3('0x3f')][_0xbac3('0x1e')](_0x432648)[_0xbac3('0x24')](function(_0x3881d7){_0x391234[_0xbac3('0x1e')]=_0x3881d7;if(_0x1c336b['query'][_0xbac3('0x40')]){_0x460c91[_0xbac3('0x41')]=[{'all':!![]}];}return db[_0xbac3('0x3f')][_0xbac3('0x42')](_0x460c91);})['then'](function(_0x30551a){_0x391234[_0xbac3('0x43')]=_0x30551a;return _0x391234;})['then'](respondWithFilteredResult(_0x3e9d4e,_0x460c91))[_0xbac3('0x44')](handleError(_0x3e9d4e,null));};exports['show']=function(_0x26f69f,_0x4d82ba){var _0x2a591d={'raw':!![],'where':{'id':_0x26f69f[_0xbac3('0x45')]['id']}},_0x26c0e9={};_0x26c0e9[_0xbac3('0x32')]=_[_0xbac3('0x46')](db[_0xbac3('0x3f')]['rawAttributes']);_0x26c0e9[_0xbac3('0x2f')]=_['keys'](_0x26f69f[_0xbac3('0x2f')]);_0x26c0e9['filters']=_['intersection'](_0x26c0e9['model'],_0x26c0e9[_0xbac3('0x2f')]);_0x2a591d[_0xbac3('0x34')]=_[_0xbac3('0x31')](_0x26c0e9['model'],qs[_0xbac3('0x33')](_0x26f69f['query']['fields']));_0x2a591d[_0xbac3('0x34')]=_0x2a591d[_0xbac3('0x34')]['length']?_0x2a591d[_0xbac3('0x34')]:_0x26c0e9[_0xbac3('0x32')];if(_0x26f69f['query'][_0xbac3('0x40')]){_0x2a591d[_0xbac3('0x41')]=[{'all':!![]}];}_0x2a591d=_[_0xbac3('0x3c')]({},_0x2a591d,_0x26f69f[_0xbac3('0x3e')]);return db[_0xbac3('0x3f')][_0xbac3('0x47')](_0x2a591d)[_0xbac3('0x24')](handleEntityNotFound(_0x4d82ba,null))[_0xbac3('0x24')](respondWithResult(_0x4d82ba,null))['catch'](handleError(_0x4d82ba,null));};exports[_0xbac3('0x48')]=function(_0x2257bf,_0x5c1ac9){return db['SugarcrmField'][_0xbac3('0x48')](_0x2257bf[_0xbac3('0x49')],{})['then'](respondWithResult(_0x5c1ac9,0xc9))[_0xbac3('0x44')](handleError(_0x5c1ac9,null));};exports['update']=function(_0x39473b,_0x3cd926){if(_0x39473b['body']['id']){delete _0x39473b['body']['id'];}return db[_0xbac3('0x3f')]['find']({'where':{'id':_0x39473b['params']['id']}})[_0xbac3('0x24')](handleEntityNotFound(_0x3cd926,null))[_0xbac3('0x24')](saveUpdates(_0x39473b[_0xbac3('0x49')],null))[_0xbac3('0x24')](respondWithResult(_0x3cd926,null))[_0xbac3('0x44')](handleError(_0x3cd926,null));};exports[_0xbac3('0x25')]=function(_0x32b9d4,_0x6e0274){return db['SugarcrmField'][_0xbac3('0x47')]({'where':{'id':_0x32b9d4[_0xbac3('0x45')]['id']}})[_0xbac3('0x24')](handleEntityNotFound(_0x6e0274,null))[_0xbac3('0x24')](removeEntity(_0x6e0274,null))['catch'](handleError(_0x6e0274,null));}; \ No newline at end of file +var _0xb3f8=['model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','keys','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SugarcrmField','rawAttributes','fieldName','type','key'];(function(_0x571d3a,_0x340d31){var _0x5c40e4=function(_0x2ef8c1){while(--_0x2ef8c1){_0x571d3a['push'](_0x571d3a['shift']());}};_0x5c40e4(++_0x340d31);}(_0xb3f8,0x1e9));var _0x8b3f=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0xb3f8[_0x4706a6];return _0x1bb705;};'use strict';var emlformat=require(_0x8b3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b3f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b3f('0x2'));var moment=require(_0x8b3f('0x3'));var BPromise=require(_0x8b3f('0x4'));var Mustache=require('mustache');var util=require(_0x8b3f('0x5'));var path=require(_0x8b3f('0x6'));var sox=require(_0x8b3f('0x7'));var csv=require('to-csv');var ejs=require(_0x8b3f('0x8'));var fs=require('fs');var fs_extra=require(_0x8b3f('0x9'));var _=require('lodash');var squel=require(_0x8b3f('0xa'));var crypto=require(_0x8b3f('0xb'));var jsforce=require(_0x8b3f('0xc'));var deskjs=require(_0x8b3f('0xd'));var toCsv=require(_0x8b3f('0xe'));var querystring=require(_0x8b3f('0xf'));var Papa=require(_0x8b3f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8b3f('0x11'));var as=require(_0x8b3f('0x12'));var hardwareService=require(_0x8b3f('0x13'));var logger=require(_0x8b3f('0x14'))('api');var utils=require(_0x8b3f('0x15'));var config=require(_0x8b3f('0x16'));var licenseUtil=require(_0x8b3f('0x17'));var db=require(_0x8b3f('0x18'))['db'];function respondWithStatusCode(_0x3e189f,_0x3c17f8){_0x3c17f8=_0x3c17f8||0xcc;return function(_0x3d04a7){if(_0x3d04a7){return _0x3e189f[_0x8b3f('0x19')](_0x3c17f8);}return _0x3e189f['status'](_0x3c17f8)[_0x8b3f('0x1a')]();};}function respondWithResult(_0xfd15f3,_0x3d4778){_0x3d4778=_0x3d4778||0xc8;return function(_0x1f6cc4){if(_0x1f6cc4){return _0xfd15f3[_0x8b3f('0x1b')](_0x3d4778)[_0x8b3f('0x1c')](_0x1f6cc4);}};}function respondWithFilteredResult(_0x2e6b4f,_0x164374){return function(_0x27aafe){if(_0x27aafe){var _0xf0da3d=typeof _0x164374[_0x8b3f('0x1d')]===_0x8b3f('0x1e')&&typeof _0x164374['limit']==='undefined';var _0x4bd212=_0x27aafe['count'];var _0x4d3405=_0xf0da3d?0x0:_0x164374[_0x8b3f('0x1d')];var _0x508d65=_0xf0da3d?_0x27aafe[_0x8b3f('0x1f')]:_0x164374['offset']+_0x164374[_0x8b3f('0x20')];var _0x3aa5b2;if(_0x508d65>=_0x4bd212){_0x508d65=_0x4bd212;_0x3aa5b2=0xc8;}else{_0x3aa5b2=0xce;}_0x2e6b4f[_0x8b3f('0x1b')](_0x3aa5b2);return _0x2e6b4f[_0x8b3f('0x21')](_0x8b3f('0x22'),_0x4d3405+'-'+_0x508d65+'/'+_0x4bd212)[_0x8b3f('0x1c')](_0x27aafe);}return null;};}function patchUpdates(_0x1c6770){return function(_0x39b6a5){try{jsonpatch[_0x8b3f('0x23')](_0x39b6a5,_0x1c6770,!![]);}catch(_0x3cb921){return BPromise[_0x8b3f('0x24')](_0x3cb921);}return _0x39b6a5[_0x8b3f('0x25')]();};}function saveUpdates(_0x36da1e,_0x1ecb55){return function(_0x5a97e1){if(_0x5a97e1){return _0x5a97e1[_0x8b3f('0x26')](_0x36da1e)[_0x8b3f('0x27')](function(_0x27a557){return _0x27a557;});}return null;};}function removeEntity(_0x4e5145,_0x31cb4f){return function(_0xc7bb4a){if(_0xc7bb4a){return _0xc7bb4a[_0x8b3f('0x28')]()[_0x8b3f('0x27')](function(){_0x4e5145[_0x8b3f('0x1b')](0xcc)[_0x8b3f('0x1a')]();});}};}function handleEntityNotFound(_0xba4bd6,_0x2a6be8){return function(_0x2bdb60){if(!_0x2bdb60){_0xba4bd6[_0x8b3f('0x19')](0x194);}return _0x2bdb60;};}function handleError(_0x2f6538,_0x58bb14){_0x58bb14=_0x58bb14||0x1f4;return function(_0x133ca9){logger[_0x8b3f('0x29')](_0x133ca9[_0x8b3f('0x2a')]);if(_0x133ca9[_0x8b3f('0x2b')]){delete _0x133ca9[_0x8b3f('0x2b')];}_0x2f6538[_0x8b3f('0x1b')](_0x58bb14)[_0x8b3f('0x2c')](_0x133ca9);};}exports['index']=function(_0x4cecd5,_0x2c3cc3){var _0x2ee46c={},_0x462098={},_0x420024={'count':0x0,'rows':[]};var _0x2c11d7=_['map'](db[_0x8b3f('0x2d')][_0x8b3f('0x2e')],function(_0x2b43e4){return{'name':_0x2b43e4[_0x8b3f('0x2f')],'type':_0x2b43e4[_0x8b3f('0x30')][_0x8b3f('0x31')]};});_0x462098[_0x8b3f('0x32')]=_[_0x8b3f('0x33')](_0x2c11d7,_0x8b3f('0x2b'));_0x462098[_0x8b3f('0x34')]=_['keys'](_0x4cecd5[_0x8b3f('0x34')]);_0x462098[_0x8b3f('0x35')]=_[_0x8b3f('0x36')](_0x462098[_0x8b3f('0x32')],_0x462098[_0x8b3f('0x34')]);_0x2ee46c[_0x8b3f('0x37')]=_[_0x8b3f('0x36')](_0x462098[_0x8b3f('0x32')],qs[_0x8b3f('0x38')](_0x4cecd5[_0x8b3f('0x34')]['fields']));_0x2ee46c[_0x8b3f('0x37')]=_0x2ee46c[_0x8b3f('0x37')][_0x8b3f('0x39')]?_0x2ee46c[_0x8b3f('0x37')]:_0x462098[_0x8b3f('0x32')];if(!_0x4cecd5[_0x8b3f('0x34')][_0x8b3f('0x3a')](_0x8b3f('0x3b'))){_0x2ee46c[_0x8b3f('0x20')]=qs['limit'](_0x4cecd5[_0x8b3f('0x34')][_0x8b3f('0x20')]);_0x2ee46c['offset']=qs[_0x8b3f('0x1d')](_0x4cecd5[_0x8b3f('0x34')]['offset']);}_0x2ee46c[_0x8b3f('0x3c')]=qs[_0x8b3f('0x3d')](_0x4cecd5['query']['sort']);_0x2ee46c[_0x8b3f('0x3e')]=qs[_0x8b3f('0x35')](_[_0x8b3f('0x3f')](_0x4cecd5['query'],_0x462098[_0x8b3f('0x35')]),_0x2c11d7);if(_0x4cecd5[_0x8b3f('0x34')][_0x8b3f('0x40')]){_0x2ee46c[_0x8b3f('0x3e')]=_[_0x8b3f('0x41')](_0x2ee46c['where'],{'$or':_[_0x8b3f('0x33')](_0x2c11d7,function(_0x3225bd){if(_0x3225bd[_0x8b3f('0x30')]!==_0x8b3f('0x42')){var _0x5d4fa3={};_0x5d4fa3[_0x3225bd['name']]={'$like':'%'+_0x4cecd5[_0x8b3f('0x34')][_0x8b3f('0x40')]+'%'};return _0x5d4fa3;}})});}_0x2ee46c=_[_0x8b3f('0x41')]({},_0x2ee46c,_0x4cecd5[_0x8b3f('0x43')]);var _0x81dbe2={'where':_0x2ee46c[_0x8b3f('0x3e')]};return db[_0x8b3f('0x2d')][_0x8b3f('0x1f')](_0x81dbe2)[_0x8b3f('0x27')](function(_0x1f82d8){_0x420024[_0x8b3f('0x1f')]=_0x1f82d8;if(_0x4cecd5[_0x8b3f('0x34')]['includeAll']){_0x2ee46c[_0x8b3f('0x44')]=[{'all':!![]}];}return db[_0x8b3f('0x2d')][_0x8b3f('0x45')](_0x2ee46c);})[_0x8b3f('0x27')](function(_0x3073b8){_0x420024[_0x8b3f('0x46')]=_0x3073b8;return _0x420024;})[_0x8b3f('0x27')](respondWithFilteredResult(_0x2c3cc3,_0x2ee46c))[_0x8b3f('0x47')](handleError(_0x2c3cc3,null));};exports['show']=function(_0x1c3cca,_0x2cd0ea){var _0x1bef51={'raw':!![],'where':{'id':_0x1c3cca['params']['id']}},_0x497688={};_0x497688[_0x8b3f('0x32')]=_[_0x8b3f('0x48')](db['SugarcrmField'][_0x8b3f('0x2e')]);_0x497688[_0x8b3f('0x34')]=_['keys'](_0x1c3cca[_0x8b3f('0x34')]);_0x497688[_0x8b3f('0x35')]=_[_0x8b3f('0x36')](_0x497688[_0x8b3f('0x32')],_0x497688['query']);_0x1bef51[_0x8b3f('0x37')]=_['intersection'](_0x497688[_0x8b3f('0x32')],qs[_0x8b3f('0x38')](_0x1c3cca[_0x8b3f('0x34')][_0x8b3f('0x38')]));_0x1bef51[_0x8b3f('0x37')]=_0x1bef51['attributes'][_0x8b3f('0x39')]?_0x1bef51['attributes']:_0x497688[_0x8b3f('0x32')];if(_0x1c3cca[_0x8b3f('0x34')]['includeAll']){_0x1bef51['include']=[{'all':!![]}];}_0x1bef51=_[_0x8b3f('0x41')]({},_0x1bef51,_0x1c3cca[_0x8b3f('0x43')]);return db[_0x8b3f('0x2d')][_0x8b3f('0x49')](_0x1bef51)[_0x8b3f('0x27')](handleEntityNotFound(_0x2cd0ea,null))[_0x8b3f('0x27')](respondWithResult(_0x2cd0ea,null))[_0x8b3f('0x47')](handleError(_0x2cd0ea,null));};exports['create']=function(_0x48f3d9,_0x297901){return db[_0x8b3f('0x2d')][_0x8b3f('0x4a')](_0x48f3d9[_0x8b3f('0x4b')],{})[_0x8b3f('0x27')](respondWithResult(_0x297901,0xc9))[_0x8b3f('0x47')](handleError(_0x297901,null));};exports['update']=function(_0x5d4a39,_0x247d1c){if(_0x5d4a39[_0x8b3f('0x4b')]['id']){delete _0x5d4a39['body']['id'];}return db[_0x8b3f('0x2d')][_0x8b3f('0x49')]({'where':{'id':_0x5d4a39[_0x8b3f('0x4c')]['id']}})[_0x8b3f('0x27')](handleEntityNotFound(_0x247d1c,null))[_0x8b3f('0x27')](saveUpdates(_0x5d4a39['body'],null))[_0x8b3f('0x27')](respondWithResult(_0x247d1c,null))[_0x8b3f('0x47')](handleError(_0x247d1c,null));};exports[_0x8b3f('0x28')]=function(_0x26c537,_0x46bfa0){return db[_0x8b3f('0x2d')][_0x8b3f('0x49')]({'where':{'id':_0x26c537[_0x8b3f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46bfa0,null))[_0x8b3f('0x27')](removeEntity(_0x46bfa0,null))[_0x8b3f('0x47')](handleError(_0x46bfa0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e56473a..12bb3c0 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 _0x396b=['../../config/logger','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util'];(function(_0x2be018,_0x4c6f4c){var _0x6e130b=function(_0x298894){while(--_0x298894){_0x2be018['push'](_0x2be018['shift']());}};_0x6e130b(++_0x4c6f4c);}(_0x396b,0x16a));var _0xb396=function(_0x5f1dd7,_0x5e29d0){_0x5f1dd7=_0x5f1dd7-0x0;var _0x2a4dda=_0x396b[_0x5f1dd7];return _0x2a4dda;};'use strict';var _=require(_0xb396('0x0'));var util=require(_0xb396('0x1'));var logger=require(_0xb396('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb396('0x3'));var fs=require('fs');var path=require(_0xb396('0x4'));var rimraf=require(_0xb396('0x5'));var config=require(_0xb396('0x6'));var attributes=require(_0xb396('0x7'));module['exports']=function(_0x566c6b,_0x47a1c2){return _0x566c6b[_0xb396('0x8')](_0xb396('0x9'),attributes,{'tableName':_0xb396('0xa'),'paranoid':![],'indexes':[{'name':_0xb396('0xb'),'fields':[_0xb396('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1712=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','lodash','util','../../config/logger','api'];(function(_0x53dabc,_0x563be7){var _0x401f8d=function(_0x56a1f0){while(--_0x56a1f0){_0x53dabc['push'](_0x53dabc['shift']());}};_0x401f8d(++_0x563be7);}(_0x1712,0x1d0));var _0x2171=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x1712[_0xf26c2e];return _0x46ecb4;};'use strict';var _=require(_0x2171('0x0'));var util=require(_0x2171('0x1'));var logger=require(_0x2171('0x2'))(_0x2171('0x3'));var moment=require(_0x2171('0x4'));var BPromise=require(_0x2171('0x5'));var rp=require(_0x2171('0x6'));var fs=require('fs');var path=require(_0x2171('0x7'));var rimraf=require(_0x2171('0x8'));var config=require(_0x2171('0x9'));var attributes=require(_0x2171('0xa'));module['exports']=function(_0x19494e,_0x1191ea){return _0x19494e[_0x2171('0xb')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 50aeaa6..59f9ccf 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 _0x2944=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','moment'];(function(_0x4e11a2,_0x1c9cf5){var _0x1eb57f=function(_0x2e96e4){while(--_0x2e96e4){_0x4e11a2['push'](_0x4e11a2['shift']());}};_0x1eb57f(++_0x1c9cf5);}(_0x2944,0x8a));var _0x4294=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x2944[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x4294('0x0'));var util=require('util');var moment=require(_0x4294('0x1'));var BPromise=require(_0x4294('0x2'));var rs=require(_0x4294('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4294('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4294('0x5'))(_0x4294('0x6'));var config=require('../../config/environment');var jayson=require(_0x4294('0x7'));var client=jayson[_0x4294('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17857b,_0x513515,_0x216953){return new BPromise(function(_0x10f164,_0x34a6f5){return client[_0x4294('0x9')](_0x17857b,_0x216953)[_0x4294('0xa')](function(_0xacecf7){logger[_0x4294('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x513515,'request\x20sent');logger['debug'](_0x4294('0xc'),_0x513515,_0x4294('0xd'),JSON['stringify'](_0xacecf7));if(_0xacecf7[_0x4294('0xe')]){if(_0xacecf7[_0x4294('0xe')][_0x4294('0xf')]===0x1f4){logger[_0x4294('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x513515,_0xacecf7[_0x4294('0xe')][_0x4294('0x10')]);return _0x34a6f5(_0xacecf7[_0x4294('0xe')]['message']);}logger[_0x4294('0xe')](_0x4294('0x11'),_0x513515,_0xacecf7[_0x4294('0xe')][_0x4294('0x10')]);return _0x10f164(_0xacecf7[_0x4294('0xe')][_0x4294('0x10')]);}else{logger[_0x4294('0xb')](_0x4294('0x11'),_0x513515,'request\x20sent');_0x10f164(_0xacecf7[_0x4294('0x12')][_0x4294('0x10')]);}})[_0x4294('0x13')](function(_0xc72f92){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x513515,_0xc72f92);_0x34a6f5(_0xc72f92);});});} \ No newline at end of file +var _0xf119=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0x38a33d,_0x479e99){var _0x14cc7f=function(_0xc2ec27){while(--_0xc2ec27){_0x38a33d['push'](_0x38a33d['shift']());}};_0x14cc7f(++_0x479e99);}(_0xf119,0x11e));var _0x9f11=function(_0x34d694,_0x52e1ef){_0x34d694=_0x34d694-0x0;var _0x3344d7=_0xf119[_0x34d694];return _0x3344d7;};'use strict';var _=require('lodash');var util=require(_0x9f11('0x0'));var moment=require(_0x9f11('0x1'));var BPromise=require(_0x9f11('0x2'));var rs=require(_0x9f11('0x3'));var fs=require('fs');var Redis=require(_0x9f11('0x4'));var db=require(_0x9f11('0x5'))['db'];var utils=require(_0x9f11('0x6'));var logger=require(_0x9f11('0x7'))(_0x9f11('0x8'));var config=require(_0x9f11('0x9'));var jayson=require(_0x9f11('0xa'));var client=jayson[_0x9f11('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd50dc,_0x1822fe,_0x6bdb59){return new BPromise(function(_0x17a647,_0x17e1d8){return client[_0x9f11('0xc')](_0xd50dc,_0x6bdb59)[_0x9f11('0xd')](function(_0x5d5d19){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x1822fe,'request\x20sent');logger[_0x9f11('0xe')](_0x9f11('0xf'),_0x1822fe,'request\x20sent',JSON['stringify'](_0x5d5d19));if(_0x5d5d19['error']){if(_0x5d5d19[_0x9f11('0x10')]['code']===0x1f4){logger[_0x9f11('0x10')](_0x9f11('0x11'),_0x1822fe,_0x5d5d19[_0x9f11('0x10')][_0x9f11('0x12')]);return _0x17e1d8(_0x5d5d19[_0x9f11('0x10')]['message']);}logger['error'](_0x9f11('0x11'),_0x1822fe,_0x5d5d19[_0x9f11('0x10')][_0x9f11('0x12')]);return _0x17a647(_0x5d5d19[_0x9f11('0x10')][_0x9f11('0x12')]);}else{logger['info'](_0x9f11('0x11'),_0x1822fe,_0x9f11('0x13'));_0x17a647(_0x5d5d19[_0x9f11('0x14')]['message']);}})[_0x9f11('0x15')](function(_0x3b73){logger[_0x9f11('0x10')](_0x9f11('0x11'),_0x1822fe,_0x3b73);_0x17e1d8(_0x3b73);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 499d4af..0338ea3 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 _0x5af0=['show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x18331f,_0x4c2da6){var _0x1c7882=function(_0x71822b){while(--_0x71822b){_0x18331f['push'](_0x18331f['shift']());}};_0x1c7882(++_0x4c2da6);}(_0x5af0,0x1eb));var _0x05af=function(_0x23dd67,_0x3ce921){_0x23dd67=_0x23dd67-0x0;var _0x694f09=_0x5af0[_0x23dd67];return _0x694f09;};'use strict';var multer=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var path=require(_0x05af('0x2'));var timeout=require(_0x05af('0x3'));var express=require(_0x05af('0x4'));var router=express[_0x05af('0x5')]();var fs_extra=require(_0x05af('0x6'));var auth=require(_0x05af('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x05af('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x05af('0x9')]('/',auth[_0x05af('0xa')](),controller[_0x05af('0xb')]);router['get'](_0x05af('0xc'),auth['isAuthenticated'](),controller[_0x05af('0xd')]);router[_0x05af('0x9')](_0x05af('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x05af('0xa')](),controller[_0x05af('0xf')]);router[_0x05af('0x10')]('/',auth['isAuthenticated'](),controller[_0x05af('0x11')]);router['post']('/:id/configurations',auth[_0x05af('0xa')](),controller[_0x05af('0x12')]);router[_0x05af('0x13')](_0x05af('0xc'),auth[_0x05af('0xa')](),controller[_0x05af('0x14')]);router[_0x05af('0x15')](_0x05af('0xc'),auth[_0x05af('0xa')](),controller[_0x05af('0x16')]);module[_0x05af('0x17')]=router; \ No newline at end of file +var _0xd1d4=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer'];(function(_0x399b76,_0x4e3594){var _0x1cb2f9=function(_0x51375d){while(--_0x51375d){_0x399b76['push'](_0x399b76['shift']());}};_0x1cb2f9(++_0x4e3594);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xd1d4[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0x4d1d('0x0'));var util=require(_0x4d1d('0x1'));var path=require('path');var timeout=require(_0x4d1d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d1d('0x3'));var auth=require(_0x4d1d('0x4'));var interaction=require(_0x4d1d('0x5'));var config=require(_0x4d1d('0x6'));var controller=require(_0x4d1d('0x7'));router[_0x4d1d('0x8')]('/',auth[_0x4d1d('0x9')](),controller[_0x4d1d('0xa')]);router[_0x4d1d('0x8')](_0x4d1d('0xb'),auth[_0x4d1d('0x9')](),controller['show']);router['get'](_0x4d1d('0xc'),auth[_0x4d1d('0x9')](),controller['getConfigurations']);router[_0x4d1d('0x8')](_0x4d1d('0xd'),auth[_0x4d1d('0x9')](),controller[_0x4d1d('0xe')]);router[_0x4d1d('0xf')]('/',auth[_0x4d1d('0x9')](),controller[_0x4d1d('0x10')]);router[_0x4d1d('0xf')](_0x4d1d('0xc'),auth[_0x4d1d('0x9')](),controller[_0x4d1d('0x11')]);router[_0x4d1d('0x12')](_0x4d1d('0xb'),auth['isAuthenticated'](),controller[_0x4d1d('0x13')]);router[_0x4d1d('0x14')](_0x4d1d('0xb'),auth[_0x4d1d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 307b939..2f38af2 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 _0x5317=['sequelize','exports','STRING'];(function(_0x19c700,_0x1662ee){var _0x213fe9=function(_0x1fd039){while(--_0x1fd039){_0x19c700['push'](_0x19c700['shift']());}};_0x213fe9(++_0x1662ee);}(_0x5317,0x81));var _0x7531=function(_0x2803a9,_0xa09521){_0x2803a9=_0x2803a9-0x0;var _0x305012=_0x5317[_0x2803a9];return _0x305012;};'use strict';var Sequelize=require(_0x7531('0x0'));module[_0x7531('0x1')]={'name':{'type':Sequelize[_0x7531('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7531('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x7531('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7531('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7531('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa598=['HelpDesk','sequelize','STRING'];(function(_0x2e38f4,_0x356135){var _0x376056=function(_0x3c50fd){while(--_0x3c50fd){_0x2e38f4['push'](_0x2e38f4['shift']());}};_0x376056(++_0x356135);}(_0xa598,0x1e4));var _0x8a59=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xa598[_0x1a9204];return _0x17ca68;};'use strict';var Sequelize=require(_0x8a59('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a59('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8a59('0x1')]},'username':{'type':Sequelize[_0x8a59('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8a59('0x1')],'allowNull':![],'defaultValue':_0x8a59('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8a59('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8a59('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 61883c7..95d90f8 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 _0x13a7=['sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VtigerAccount','includeAll','include','catch','show','length','find','create','body','update','getConfigurations','findOne','params','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','autogenerated','reference','owner','includes','remove','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x285f91,_0x600aee){var _0x23b3b4=function(_0x193a48){while(--_0x193a48){_0x285f91['push'](_0x285f91['shift']());}};_0x23b3b4(++_0x600aee);}(_0x13a7,0x1eb));var _0x713a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13a7[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x713a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x713a('0x1'));var jsonpatch=require(_0x713a('0x2'));var rp=require(_0x713a('0x3'));var moment=require(_0x713a('0x4'));var BPromise=require(_0x713a('0x5'));var Mustache=require(_0x713a('0x6'));var util=require(_0x713a('0x7'));var path=require(_0x713a('0x8'));var sox=require(_0x713a('0x9'));var csv=require(_0x713a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x713a('0xb'));var _=require('lodash');var squel=require(_0x713a('0xc'));var crypto=require(_0x713a('0xd'));var jsforce=require(_0x713a('0xe'));var deskjs=require(_0x713a('0xf'));var toCsv=require(_0x713a('0xa'));var querystring=require(_0x713a('0x10'));var Papa=require(_0x713a('0x11'));var Redis=require(_0x713a('0x12'));var authService=require(_0x713a('0x13'));var qs=require(_0x713a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x713a('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x713a('0x16'));var licenseUtil=require(_0x713a('0x17'));var db=require(_0x713a('0x18'))['db'];var integrations=require(_0x713a('0x19'));function respondWithStatusCode(_0x1a3e00,_0x2586f2){_0x2586f2=_0x2586f2||0xcc;return function(_0x26120d){if(_0x26120d){return _0x1a3e00['sendStatus'](_0x2586f2);}return _0x1a3e00[_0x713a('0x1a')](_0x2586f2)[_0x713a('0x1b')]();};}function respondWithResult(_0xf579ba,_0x30a897){_0x30a897=_0x30a897||0xc8;return function(_0x2f18a1){if(_0x2f18a1){return _0xf579ba[_0x713a('0x1a')](_0x30a897)[_0x713a('0x1c')](_0x2f18a1);}};}function respondWithFilteredResult(_0x421b88,_0x511f4e){return function(_0xedd33d){if(_0xedd33d){var _0x50cbc1=typeof _0x511f4e[_0x713a('0x1d')]==='undefined'&&typeof _0x511f4e[_0x713a('0x1e')]===_0x713a('0x1f');var _0xf50b98=_0xedd33d[_0x713a('0x20')];var _0x450413=_0x50cbc1?0x0:_0x511f4e[_0x713a('0x1d')];var _0x3e20e8=_0x50cbc1?_0xedd33d[_0x713a('0x20')]:_0x511f4e[_0x713a('0x1d')]+_0x511f4e['limit'];var _0x65c26e;if(_0x3e20e8>=_0xf50b98){_0x3e20e8=_0xf50b98;_0x65c26e=0xc8;}else{_0x65c26e=0xce;}_0x421b88[_0x713a('0x1a')](_0x65c26e);return _0x421b88[_0x713a('0x21')](_0x713a('0x22'),_0x450413+'-'+_0x3e20e8+'/'+_0xf50b98)['json'](_0xedd33d);}return null;};}function patchUpdates(_0x49f26b){return function(_0x1be2b1){try{jsonpatch[_0x713a('0x23')](_0x1be2b1,_0x49f26b,!![]);}catch(_0x210ede){return BPromise[_0x713a('0x24')](_0x210ede);}return _0x1be2b1[_0x713a('0x25')]();};}function saveUpdates(_0x26823b,_0x2a976f){return function(_0x9186b5){if(_0x9186b5){return _0x9186b5['update'](_0x26823b)['then'](function(_0x57e2ca){return _0x57e2ca;});}return null;};}function removeEntity(_0x4c462b,_0x1cc504){return function(_0x5e1095){if(_0x5e1095){return _0x5e1095[_0x713a('0x26')]()[_0x713a('0x27')](function(){_0x4c462b[_0x713a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50eeea,_0x44833e){return function(_0x315299){if(!_0x315299){_0x50eeea[_0x713a('0x28')](0x194);}return _0x315299;};}function handleError(_0x441e9a,_0x508976){_0x508976=_0x508976||0x1f4;return function(_0x38a67d){logger[_0x713a('0x29')](_0x38a67d[_0x713a('0x2a')]);if(_0x38a67d[_0x713a('0x2b')]){delete _0x38a67d['name'];}_0x441e9a[_0x713a('0x1a')](_0x508976)[_0x713a('0x2c')](_0x38a67d);};}exports['index']=function(_0x11657e,_0x4de133){var _0x42a27c={},_0x47bf34={},_0x3fd20d={'count':0x0,'rows':[]};var _0x97fb23=_['map'](db['VtigerAccount'][_0x713a('0x2d')],function(_0x3b4070){return{'name':_0x3b4070[_0x713a('0x2e')],'type':_0x3b4070[_0x713a('0x2f')][_0x713a('0x30')]};});_0x47bf34[_0x713a('0x31')]=_[_0x713a('0x32')](_0x97fb23,_0x713a('0x2b'));_0x47bf34[_0x713a('0x33')]=_[_0x713a('0x34')](_0x11657e['query']);_0x47bf34[_0x713a('0x35')]=_[_0x713a('0x36')](_0x47bf34[_0x713a('0x31')],_0x47bf34[_0x713a('0x33')]);_0x42a27c[_0x713a('0x37')]=_[_0x713a('0x36')](_0x47bf34[_0x713a('0x31')],qs[_0x713a('0x38')](_0x11657e['query']['fields']));_0x42a27c[_0x713a('0x37')]=_0x42a27c[_0x713a('0x37')]['length']?_0x42a27c[_0x713a('0x37')]:_0x47bf34['model'];if(!_0x11657e[_0x713a('0x33')][_0x713a('0x39')](_0x713a('0x3a'))){_0x42a27c[_0x713a('0x1e')]=qs[_0x713a('0x1e')](_0x11657e[_0x713a('0x33')][_0x713a('0x1e')]);_0x42a27c[_0x713a('0x1d')]=qs[_0x713a('0x1d')](_0x11657e[_0x713a('0x33')]['offset']);}_0x42a27c[_0x713a('0x3b')]=qs[_0x713a('0x3c')](_0x11657e[_0x713a('0x33')][_0x713a('0x3c')]);_0x42a27c[_0x713a('0x3d')]=qs[_0x713a('0x35')](_[_0x713a('0x3e')](_0x11657e[_0x713a('0x33')],_0x47bf34['filters']),_0x97fb23);if(_0x11657e[_0x713a('0x33')][_0x713a('0x3f')]){_0x42a27c[_0x713a('0x3d')]=_[_0x713a('0x40')](_0x42a27c[_0x713a('0x3d')],{'$or':_[_0x713a('0x32')](_0x97fb23,function(_0x573931){if(_0x573931['type']!=='VIRTUAL'){var _0x317b80={};_0x317b80[_0x573931[_0x713a('0x2b')]]={'$like':'%'+_0x11657e['query'][_0x713a('0x3f')]+'%'};return _0x317b80;}})});}_0x42a27c=_[_0x713a('0x40')]({},_0x42a27c,_0x11657e[_0x713a('0x41')]);var _0x543add={'where':_0x42a27c[_0x713a('0x3d')]};return db[_0x713a('0x42')][_0x713a('0x20')](_0x543add)[_0x713a('0x27')](function(_0x538789){_0x3fd20d[_0x713a('0x20')]=_0x538789;if(_0x11657e[_0x713a('0x33')][_0x713a('0x43')]){_0x42a27c[_0x713a('0x44')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x42a27c);})[_0x713a('0x27')](function(_0x360b3f){_0x3fd20d['rows']=_0x360b3f;return _0x3fd20d;})[_0x713a('0x27')](respondWithFilteredResult(_0x4de133,_0x42a27c))[_0x713a('0x45')](handleError(_0x4de133,null));};exports[_0x713a('0x46')]=function(_0x4b8283,_0x250278){var _0x5f1c27={'raw':![],'where':{'id':_0x4b8283['params']['id']}},_0x28587b={};_0x28587b[_0x713a('0x31')]=_[_0x713a('0x34')](db[_0x713a('0x42')][_0x713a('0x2d')]);_0x28587b[_0x713a('0x33')]=_['keys'](_0x4b8283['query']);_0x28587b[_0x713a('0x35')]=_[_0x713a('0x36')](_0x28587b[_0x713a('0x31')],_0x28587b['query']);_0x5f1c27[_0x713a('0x37')]=_[_0x713a('0x36')](_0x28587b[_0x713a('0x31')],qs[_0x713a('0x38')](_0x4b8283[_0x713a('0x33')][_0x713a('0x38')]));_0x5f1c27[_0x713a('0x37')]=_0x5f1c27[_0x713a('0x37')][_0x713a('0x47')]?_0x5f1c27['attributes']:_0x28587b[_0x713a('0x31')];if(_0x4b8283[_0x713a('0x33')][_0x713a('0x43')]){_0x5f1c27[_0x713a('0x44')]=[{'all':!![]}];}_0x5f1c27=_[_0x713a('0x40')]({},_0x5f1c27,_0x4b8283['options']);return db[_0x713a('0x42')][_0x713a('0x48')](_0x5f1c27)[_0x713a('0x27')](handleEntityNotFound(_0x250278,null))[_0x713a('0x27')](respondWithResult(_0x250278,null))[_0x713a('0x45')](handleError(_0x250278,null));};exports['create']=function(_0x5aaeb8,_0x4b33a4){return db[_0x713a('0x42')][_0x713a('0x49')](_0x5aaeb8[_0x713a('0x4a')],{})['then'](respondWithResult(_0x4b33a4,0xc9))[_0x713a('0x45')](handleError(_0x4b33a4,null));};exports[_0x713a('0x4b')]=function(_0x6e5c80,_0x74471d){if(_0x6e5c80[_0x713a('0x4a')]['id']){delete _0x6e5c80[_0x713a('0x4a')]['id'];}return db['VtigerAccount'][_0x713a('0x48')]({'where':{'id':_0x6e5c80['params']['id']}})[_0x713a('0x27')](handleEntityNotFound(_0x74471d,null))['then'](saveUpdates(_0x6e5c80[_0x713a('0x4a')],null))[_0x713a('0x27')](respondWithResult(_0x74471d,null))[_0x713a('0x45')](handleError(_0x74471d,null));};exports['destroy']=function(_0x443533,_0x2ff580){return db[_0x713a('0x42')][_0x713a('0x48')]({'where':{'id':_0x443533['params']['id']}})[_0x713a('0x27')](handleEntityNotFound(_0x2ff580,null))['then'](removeEntity(_0x2ff580,null))[_0x713a('0x45')](handleError(_0x2ff580,null));};exports[_0x713a('0x4c')]=function(_0x32953a,_0x3d91c1,_0x42390c){var _0x525f72={};var _0x393b20={};var _0x243528;var _0x2897c2;return db[_0x713a('0x42')][_0x713a('0x4d')]({'where':{'id':_0x32953a[_0x713a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d91c1,null))[_0x713a('0x27')](function(_0x18567c){if(_0x18567c){_0x243528=_0x18567c;_0x393b20[_0x713a('0x31')]=_['keys'](db[_0x713a('0x4f')][_0x713a('0x2d')]);_0x393b20[_0x713a('0x33')]=_[_0x713a('0x34')](_0x32953a['query']);_0x393b20[_0x713a('0x35')]=_[_0x713a('0x36')](_0x393b20[_0x713a('0x31')],_0x393b20[_0x713a('0x33')]);_0x525f72[_0x713a('0x37')]=_['intersection'](_0x393b20[_0x713a('0x31')],qs[_0x713a('0x38')](_0x32953a[_0x713a('0x33')][_0x713a('0x38')]));_0x525f72['attributes']=_0x525f72[_0x713a('0x37')]['length']?_0x525f72[_0x713a('0x37')]:_0x393b20[_0x713a('0x31')];_0x525f72['order']=qs[_0x713a('0x3c')](_0x32953a[_0x713a('0x33')]['sort']);_0x525f72[_0x713a('0x3d')]=qs[_0x713a('0x35')](_['pick'](_0x32953a[_0x713a('0x33')],_0x393b20['filters']));if(_0x32953a['query'][_0x713a('0x3f')]){_0x525f72[_0x713a('0x3d')]=_['merge'](_0x525f72['where'],{'$or':_[_0x713a('0x32')](_0x525f72['attributes'],function(_0x361dda){var _0x293784={};_0x293784[_0x361dda]={'$like':'%'+_0x32953a[_0x713a('0x33')][_0x713a('0x3f')]+'%'};return _0x293784;})});}_0x525f72=_[_0x713a('0x40')]({},_0x525f72,_0x32953a['options']);return _0x243528[_0x713a('0x4c')](_0x525f72);}})[_0x713a('0x27')](function(_0x9d8de2){if(_0x9d8de2){_0x2897c2=_0x9d8de2['length'];if(!_0x32953a[_0x713a('0x33')][_0x713a('0x39')](_0x713a('0x3a'))){_0x525f72[_0x713a('0x1e')]=qs[_0x713a('0x1e')](_0x32953a[_0x713a('0x33')][_0x713a('0x1e')]);_0x525f72[_0x713a('0x1d')]=qs['offset'](_0x32953a[_0x713a('0x33')]['offset']);}return _0x243528[_0x713a('0x4c')](_0x525f72);}})['then'](function(_0xe35841){if(_0xe35841){return _0xe35841?{'count':_0x2897c2,'rows':_0xe35841}:null;}})[_0x713a('0x27')](respondWithResult(_0x3d91c1,null))['catch'](handleError(_0x3d91c1,null));};exports[_0x713a('0x50')]=function(_0x28e463,_0x220b13,_0x2f408a){if(_0x28e463[_0x713a('0x4a')]['id']){delete _0x28e463['body']['id'];}return db['VtigerAccount'][_0x713a('0x4d')]({'where':{'id':_0x28e463['params']['id']}})[_0x713a('0x27')](handleEntityNotFound(_0x220b13,null))['then'](function(_0x15354b){if(_0x15354b){_0x28e463[_0x713a('0x4a')][_0x713a('0x51')]=_0x15354b['id'];_0x28e463[_0x713a('0x4a')][_0x713a('0x52')]=integrations['getSubjects'](_0x28e463[_0x713a('0x4a')][_0x713a('0x53')],_0x28e463[_0x713a('0x4a')][_0x713a('0x2f')]);_0x28e463[_0x713a('0x4a')][_0x713a('0x54')]=integrations[_0x713a('0x55')](_0x28e463[_0x713a('0x4a')][_0x713a('0x53')],_0x28e463[_0x713a('0x4a')][_0x713a('0x2f')]);return db[_0x713a('0x4f')][_0x713a('0x49')](_0x28e463[_0x713a('0x4a')],{'include':[{'model':db[_0x713a('0x56')],'as':_0x713a('0x52')},{'model':db[_0x713a('0x56')],'as':_0x713a('0x54')}]});}return null;})[_0x713a('0x27')](respondWithResult(_0x220b13,null))['catch'](handleError(_0x220b13,null));};var md5=require(_0x713a('0x57'));exports[_0x713a('0x58')]=function(_0x31256f,_0x449ace,_0x466a3f){var _0x4c9556=null;var _0x5d050c=null;var _0x49047b=null;var _0x563f2b=null;var _0x329424='';return db['VtigerAccount']['findOne']({'where':{'id':_0x31256f['params']['id']},'attributes':['id',_0x713a('0x2b'),_0x713a('0x59'),_0x713a('0x5a'),_0x713a('0x5b'),_0x713a('0x5c'),_0x713a('0x5d'),_0x713a('0x5e')]})[_0x713a('0x27')](handleEntityNotFound(_0x449ace,null))['then'](function(_0xeb0e8e){if(_0xeb0e8e){_0x4c9556=_0xeb0e8e[_0x713a('0x59')];_0x5d050c=_0xeb0e8e[_0x713a('0x5e')];_0x49047b=_0xeb0e8e['moduleName'];_0x329424=_0xeb0e8e[_0x713a('0x5c')];var _0x9b17f6=_0x329424['slice'](-0x1);if(_0x9b17f6==='/'){_0x329424=_0x329424[_0x713a('0x5f')](0x0,_0x329424[_0x713a('0x60')](_0x9b17f6));}_0x563f2b=util[_0x713a('0x61')](_0x713a('0x62'),_0x329424);var _0x37548e={'method':_0x713a('0x63'),'uri':_0x563f2b,'qs':{'operation':_0x713a('0x64'),'username':_0xeb0e8e['username']},'json':!![]};return rp(_0x37548e);}})[_0x713a('0x27')](function(_0x5042b2){if(_0x5042b2[_0x713a('0x65')]){var _0x44b17b={'method':_0x713a('0x66'),'uri':_0x563f2b,'form':{'operation':_0x713a('0x67'),'username':_0x4c9556,'accessKey':md5(_0x5042b2[_0x713a('0x68')][_0x713a('0x69')]+_0x5d050c)},'json':!![]};return rp(_0x44b17b);}})['then'](function(_0x34f8a6){if(_0x34f8a6[_0x713a('0x65')]){var _0x1d2200={'method':_0x713a('0x63'),'uri':_0x563f2b,'qs':{'operation':'describe','username':_0x4c9556,'sessionName':_0x34f8a6[_0x713a('0x68')][_0x713a('0x6a')],'elementType':_0x49047b},'json':!![]};return rp(_0x1d2200);}})[_0x713a('0x27')](function(_0x3204ff){if(_0x3204ff[_0x713a('0x65')]){var _0xd87fbc=[_0x713a('0x6b'),_0x713a('0x6c'),_0x713a('0x6d')];_['remove'](_0x3204ff['result'][_0x713a('0x38')],function(_0x5b4c4e){return _0xd87fbc[_0x713a('0x6e')](_0x5b4c4e[_0x713a('0x2f')]['name']);});_[_0x713a('0x6f')](_0x3204ff['result'][_0x713a('0x38')],function(_0x187485){return _0x187485['editable']==='false';});return{'count':_0x3204ff[_0x713a('0x68')][_0x713a('0x38')]['length'],'rows':_[_0x713a('0x32')](_0x3204ff[_0x713a('0x68')][_0x713a('0x38')],function(_0x5554b1){return{'id':_0x5554b1['name'],'name':_0x5554b1[_0x713a('0x70')],'custom':_[_0x713a('0x71')](_0x5554b1['name'],_0x713a('0x72'))?!![]:![],'options':_0x5554b1[_0x713a('0x2f')][_0x713a('0x2b')]===_0x713a('0x73')&&_0x5554b1['type']['picklistValues'][_0x713a('0x47')]>0x0?_[_0x713a('0x32')](_0x5554b1['type'][_0x713a('0x74')],function(_0x95cfc6){return{'name':_0x95cfc6[_0x713a('0x70')],'value':_0x95cfc6[_0x713a('0x75')]};}):[]};})};}})[_0x713a('0x27')](respondWithResult(_0x449ace,null))['catch'](function(_0x5023b0){console[_0x713a('0x76')](_0x713a('0x77')+_0x5023b0);var _0x1428cb=_0x31256f[_0x713a('0x33')][_0x713a('0x78')]?0x1f4:_0x5023b0[_0x713a('0x79')]||0x1f4;logger[_0x713a('0x29')](_0x713a('0x7a'),_0x713a('0x58'),_0x1428cb,JSON[_0x713a('0x7b')](_0x5023b0));delete _0x5023b0[_0x713a('0x2b')];if(_0x1428cb===0x191){_0x1428cb=0x190;}_0x449ace['status'](_0x1428cb)[_0x713a('0x2c')](_0x31256f[_0x713a('0x33')][_0x713a('0x78')]?{'message':_0x713a('0x7c'),'statusCode':_0x5023b0[_0x713a('0x79')]}:_0x5023b0);});}; \ No newline at end of file +var _0x8b2d=['VtigerField','Descriptions','getFields','username','description','moduleName','serverUrl','remoteUri','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','vTiger\x20error:\x20','test','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','find','create','body','catch','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','params','Subjects','channel'];(function(_0x232098,_0x5de783){var _0x3e6c62=function(_0x215393){while(--_0x215393){_0x232098['push'](_0x232098['shift']());}};_0x3e6c62(++_0x5de783);}(_0x8b2d,0x9a));var _0xd8b2=function(_0x47f762,_0x106ece){_0x47f762=_0x47f762-0x0;var _0x4d2585=_0x8b2d[_0x47f762];return _0x4d2585;};'use strict';var emlformat=require(_0xd8b2('0x0'));var rimraf=require(_0xd8b2('0x1'));var zipdir=require(_0xd8b2('0x2'));var jsonpatch=require(_0xd8b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8b2('0x4'));var Mustache=require(_0xd8b2('0x5'));var util=require(_0xd8b2('0x6'));var path=require(_0xd8b2('0x7'));var sox=require(_0xd8b2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8b2('0x9'));var crypto=require(_0xd8b2('0xa'));var jsforce=require(_0xd8b2('0xb'));var deskjs=require(_0xd8b2('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd8b2('0xd'));var Papa=require(_0xd8b2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd8b2('0xf'));var hardwareService=require(_0xd8b2('0x10'));var logger=require(_0xd8b2('0x11'))(_0xd8b2('0x12'));var utils=require(_0xd8b2('0x13'));var config=require(_0xd8b2('0x14'));var licenseUtil=require(_0xd8b2('0x15'));var db=require(_0xd8b2('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2aaac6,_0x408cb7){_0x408cb7=_0x408cb7||0xcc;return function(_0x1794e5){if(_0x1794e5){return _0x2aaac6['sendStatus'](_0x408cb7);}return _0x2aaac6[_0xd8b2('0x17')](_0x408cb7)[_0xd8b2('0x18')]();};}function respondWithResult(_0x5f2422,_0x165d5c){_0x165d5c=_0x165d5c||0xc8;return function(_0x30b730){if(_0x30b730){return _0x5f2422[_0xd8b2('0x17')](_0x165d5c)[_0xd8b2('0x19')](_0x30b730);}};}function respondWithFilteredResult(_0x1e0b28,_0x4facd7){return function(_0x150686){if(_0x150686){var _0x39da64=typeof _0x4facd7['offset']===_0xd8b2('0x1a')&&typeof _0x4facd7['limit']===_0xd8b2('0x1a');var _0x1075f7=_0x150686[_0xd8b2('0x1b')];var _0x542752=_0x39da64?0x0:_0x4facd7[_0xd8b2('0x1c')];var _0x3b865a=_0x39da64?_0x150686[_0xd8b2('0x1b')]:_0x4facd7[_0xd8b2('0x1c')]+_0x4facd7['limit'];var _0x58f1f8;if(_0x3b865a>=_0x1075f7){_0x3b865a=_0x1075f7;_0x58f1f8=0xc8;}else{_0x58f1f8=0xce;}_0x1e0b28[_0xd8b2('0x17')](_0x58f1f8);return _0x1e0b28[_0xd8b2('0x1d')]('Content-Range',_0x542752+'-'+_0x3b865a+'/'+_0x1075f7)[_0xd8b2('0x19')](_0x150686);}return null;};}function patchUpdates(_0x4ae1df){return function(_0x4143fe){try{jsonpatch[_0xd8b2('0x1e')](_0x4143fe,_0x4ae1df,!![]);}catch(_0x3920c2){return BPromise[_0xd8b2('0x1f')](_0x3920c2);}return _0x4143fe[_0xd8b2('0x20')]();};}function saveUpdates(_0x25c8b4,_0x2bafe9){return function(_0x333cce){if(_0x333cce){return _0x333cce[_0xd8b2('0x21')](_0x25c8b4)[_0xd8b2('0x22')](function(_0x1ad9b3){return _0x1ad9b3;});}return null;};}function removeEntity(_0x22a58f,_0x58e282){return function(_0x4c81ae){if(_0x4c81ae){return _0x4c81ae[_0xd8b2('0x23')]()[_0xd8b2('0x22')](function(){_0x22a58f[_0xd8b2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0cec,_0x18a206){return function(_0x1f7b8b){if(!_0x1f7b8b){_0x3a0cec['sendStatus'](0x194);}return _0x1f7b8b;};}function handleError(_0x2b6e76,_0x5ece8c){_0x5ece8c=_0x5ece8c||0x1f4;return function(_0x244ae3){logger[_0xd8b2('0x24')](_0x244ae3[_0xd8b2('0x25')]);if(_0x244ae3['name']){delete _0x244ae3[_0xd8b2('0x26')];}_0x2b6e76['status'](_0x5ece8c)['send'](_0x244ae3);};}exports[_0xd8b2('0x27')]=function(_0x383642,_0x13850a){var _0x4e1434={},_0x56fe7e={},_0x266610={'count':0x0,'rows':[]};var _0x349158=_[_0xd8b2('0x28')](db[_0xd8b2('0x29')][_0xd8b2('0x2a')],function(_0x4e3599){return{'name':_0x4e3599[_0xd8b2('0x2b')],'type':_0x4e3599[_0xd8b2('0x2c')][_0xd8b2('0x2d')]};});_0x56fe7e[_0xd8b2('0x2e')]=_['map'](_0x349158,_0xd8b2('0x26'));_0x56fe7e[_0xd8b2('0x2f')]=_[_0xd8b2('0x30')](_0x383642[_0xd8b2('0x2f')]);_0x56fe7e['filters']=_[_0xd8b2('0x31')](_0x56fe7e['model'],_0x56fe7e[_0xd8b2('0x2f')]);_0x4e1434[_0xd8b2('0x32')]=_[_0xd8b2('0x31')](_0x56fe7e[_0xd8b2('0x2e')],qs[_0xd8b2('0x33')](_0x383642['query'][_0xd8b2('0x33')]));_0x4e1434[_0xd8b2('0x32')]=_0x4e1434['attributes'][_0xd8b2('0x34')]?_0x4e1434['attributes']:_0x56fe7e[_0xd8b2('0x2e')];if(!_0x383642[_0xd8b2('0x2f')]['hasOwnProperty'](_0xd8b2('0x35'))){_0x4e1434[_0xd8b2('0x36')]=qs[_0xd8b2('0x36')](_0x383642[_0xd8b2('0x2f')][_0xd8b2('0x36')]);_0x4e1434[_0xd8b2('0x1c')]=qs[_0xd8b2('0x1c')](_0x383642[_0xd8b2('0x2f')]['offset']);}_0x4e1434['order']=qs[_0xd8b2('0x37')](_0x383642['query'][_0xd8b2('0x37')]);_0x4e1434[_0xd8b2('0x38')]=qs['filters'](_[_0xd8b2('0x39')](_0x383642[_0xd8b2('0x2f')],_0x56fe7e[_0xd8b2('0x3a')]),_0x349158);if(_0x383642[_0xd8b2('0x2f')][_0xd8b2('0x3b')]){_0x4e1434[_0xd8b2('0x38')]=_[_0xd8b2('0x3c')](_0x4e1434[_0xd8b2('0x38')],{'$or':_[_0xd8b2('0x28')](_0x349158,function(_0x477965){if(_0x477965[_0xd8b2('0x2c')]!=='VIRTUAL'){var _0x448b06={};_0x448b06[_0x477965[_0xd8b2('0x26')]]={'$like':'%'+_0x383642[_0xd8b2('0x2f')][_0xd8b2('0x3b')]+'%'};return _0x448b06;}})});}_0x4e1434=_[_0xd8b2('0x3c')]({},_0x4e1434,_0x383642[_0xd8b2('0x3d')]);var _0x5154ad={'where':_0x4e1434['where']};return db[_0xd8b2('0x29')][_0xd8b2('0x1b')](_0x5154ad)[_0xd8b2('0x22')](function(_0x3f1359){_0x266610['count']=_0x3f1359;if(_0x383642[_0xd8b2('0x2f')][_0xd8b2('0x3e')]){_0x4e1434[_0xd8b2('0x3f')]=[{'all':!![]}];}return db[_0xd8b2('0x29')][_0xd8b2('0x40')](_0x4e1434);})[_0xd8b2('0x22')](function(_0x5c5a74){_0x266610[_0xd8b2('0x41')]=_0x5c5a74;return _0x266610;})[_0xd8b2('0x22')](respondWithFilteredResult(_0x13850a,_0x4e1434))['catch'](handleError(_0x13850a,null));};exports[_0xd8b2('0x42')]=function(_0x21d387,_0x2dadf2){var _0x1ea3fe={'raw':![],'where':{'id':_0x21d387['params']['id']}},_0x56110a={};_0x56110a[_0xd8b2('0x2e')]=_[_0xd8b2('0x30')](db[_0xd8b2('0x29')][_0xd8b2('0x2a')]);_0x56110a[_0xd8b2('0x2f')]=_[_0xd8b2('0x30')](_0x21d387['query']);_0x56110a[_0xd8b2('0x3a')]=_[_0xd8b2('0x31')](_0x56110a['model'],_0x56110a[_0xd8b2('0x2f')]);_0x1ea3fe[_0xd8b2('0x32')]=_[_0xd8b2('0x31')](_0x56110a['model'],qs[_0xd8b2('0x33')](_0x21d387['query'][_0xd8b2('0x33')]));_0x1ea3fe[_0xd8b2('0x32')]=_0x1ea3fe[_0xd8b2('0x32')]['length']?_0x1ea3fe['attributes']:_0x56110a[_0xd8b2('0x2e')];if(_0x21d387[_0xd8b2('0x2f')][_0xd8b2('0x3e')]){_0x1ea3fe['include']=[{'all':!![]}];}_0x1ea3fe=_[_0xd8b2('0x3c')]({},_0x1ea3fe,_0x21d387['options']);return db['VtigerAccount'][_0xd8b2('0x43')](_0x1ea3fe)[_0xd8b2('0x22')](handleEntityNotFound(_0x2dadf2,null))[_0xd8b2('0x22')](respondWithResult(_0x2dadf2,null))['catch'](handleError(_0x2dadf2,null));};exports[_0xd8b2('0x44')]=function(_0x35aa0c,_0x3d3f1f){return db[_0xd8b2('0x29')][_0xd8b2('0x44')](_0x35aa0c[_0xd8b2('0x45')],{})[_0xd8b2('0x22')](respondWithResult(_0x3d3f1f,0xc9))[_0xd8b2('0x46')](handleError(_0x3d3f1f,null));};exports[_0xd8b2('0x21')]=function(_0x453c8f,_0x445fa4){if(_0x453c8f[_0xd8b2('0x45')]['id']){delete _0x453c8f['body']['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x453c8f['params']['id']}})[_0xd8b2('0x22')](handleEntityNotFound(_0x445fa4,null))[_0xd8b2('0x22')](saveUpdates(_0x453c8f[_0xd8b2('0x45')],null))[_0xd8b2('0x22')](respondWithResult(_0x445fa4,null))[_0xd8b2('0x46')](handleError(_0x445fa4,null));};exports[_0xd8b2('0x23')]=function(_0x17eb0f,_0x116780){return db[_0xd8b2('0x29')][_0xd8b2('0x43')]({'where':{'id':_0x17eb0f['params']['id']}})[_0xd8b2('0x22')](handleEntityNotFound(_0x116780,null))[_0xd8b2('0x22')](removeEntity(_0x116780,null))[_0xd8b2('0x46')](handleError(_0x116780,null));};exports[_0xd8b2('0x47')]=function(_0x4df683,_0x653e7c,_0x14668c){var _0x4014d0={};var _0x111983={};var _0x4d4b43;var _0x1fe06d;return db[_0xd8b2('0x29')][_0xd8b2('0x48')]({'where':{'id':_0x4df683['params']['id']}})[_0xd8b2('0x22')](handleEntityNotFound(_0x653e7c,null))[_0xd8b2('0x22')](function(_0xb384d0){if(_0xb384d0){_0x4d4b43=_0xb384d0;_0x111983[_0xd8b2('0x2e')]=_[_0xd8b2('0x30')](db[_0xd8b2('0x49')][_0xd8b2('0x2a')]);_0x111983['query']=_[_0xd8b2('0x30')](_0x4df683['query']);_0x111983[_0xd8b2('0x3a')]=_[_0xd8b2('0x31')](_0x111983['model'],_0x111983['query']);_0x4014d0[_0xd8b2('0x32')]=_['intersection'](_0x111983[_0xd8b2('0x2e')],qs[_0xd8b2('0x33')](_0x4df683['query'][_0xd8b2('0x33')]));_0x4014d0['attributes']=_0x4014d0['attributes'][_0xd8b2('0x34')]?_0x4014d0['attributes']:_0x111983[_0xd8b2('0x2e')];_0x4014d0[_0xd8b2('0x4a')]=qs[_0xd8b2('0x37')](_0x4df683[_0xd8b2('0x2f')][_0xd8b2('0x37')]);_0x4014d0[_0xd8b2('0x38')]=qs[_0xd8b2('0x3a')](_[_0xd8b2('0x39')](_0x4df683[_0xd8b2('0x2f')],_0x111983[_0xd8b2('0x3a')]));if(_0x4df683[_0xd8b2('0x2f')][_0xd8b2('0x3b')]){_0x4014d0[_0xd8b2('0x38')]=_[_0xd8b2('0x3c')](_0x4014d0[_0xd8b2('0x38')],{'$or':_[_0xd8b2('0x28')](_0x4014d0[_0xd8b2('0x32')],function(_0x26e7e3){var _0x1998aa={};_0x1998aa[_0x26e7e3]={'$like':'%'+_0x4df683[_0xd8b2('0x2f')][_0xd8b2('0x3b')]+'%'};return _0x1998aa;})});}_0x4014d0=_[_0xd8b2('0x3c')]({},_0x4014d0,_0x4df683[_0xd8b2('0x3d')]);return _0x4d4b43[_0xd8b2('0x47')](_0x4014d0);}})[_0xd8b2('0x22')](function(_0x2aefee){if(_0x2aefee){_0x1fe06d=_0x2aefee[_0xd8b2('0x34')];if(!_0x4df683[_0xd8b2('0x2f')][_0xd8b2('0x4b')](_0xd8b2('0x35'))){_0x4014d0['limit']=qs[_0xd8b2('0x36')](_0x4df683['query'][_0xd8b2('0x36')]);_0x4014d0[_0xd8b2('0x1c')]=qs[_0xd8b2('0x1c')](_0x4df683[_0xd8b2('0x2f')][_0xd8b2('0x1c')]);}return _0x4d4b43[_0xd8b2('0x47')](_0x4014d0);}})['then'](function(_0x216b3f){if(_0x216b3f){return _0x216b3f?{'count':_0x1fe06d,'rows':_0x216b3f}:null;}})[_0xd8b2('0x22')](respondWithResult(_0x653e7c,null))[_0xd8b2('0x46')](handleError(_0x653e7c,null));};exports[_0xd8b2('0x4c')]=function(_0x1ce03e,_0x2242a4,_0x4d6f5c){if(_0x1ce03e[_0xd8b2('0x45')]['id']){delete _0x1ce03e[_0xd8b2('0x45')]['id'];}return db[_0xd8b2('0x29')]['findOne']({'where':{'id':_0x1ce03e[_0xd8b2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2242a4,null))[_0xd8b2('0x22')](function(_0x195939){if(_0x195939){_0x1ce03e['body']['AccountId']=_0x195939['id'];_0x1ce03e[_0xd8b2('0x45')][_0xd8b2('0x4e')]=integrations['getSubjects'](_0x1ce03e['body'][_0xd8b2('0x4f')],_0x1ce03e[_0xd8b2('0x45')][_0xd8b2('0x2c')]);_0x1ce03e[_0xd8b2('0x45')]['Descriptions']=integrations['getDescriptions'](_0x1ce03e[_0xd8b2('0x45')]['channel'],_0x1ce03e[_0xd8b2('0x45')][_0xd8b2('0x2c')]);return db[_0xd8b2('0x49')]['create'](_0x1ce03e['body'],{'include':[{'model':db[_0xd8b2('0x50')],'as':_0xd8b2('0x4e')},{'model':db[_0xd8b2('0x50')],'as':_0xd8b2('0x51')}]});}return null;})[_0xd8b2('0x22')](respondWithResult(_0x2242a4,null))['catch'](handleError(_0x2242a4,null));};var md5=require('md5');exports[_0xd8b2('0x52')]=function(_0x154011,_0x372a1f,_0x35f329){var _0x44ddf7=null;var _0x844bf4=null;var _0x1fb593=null;var _0x2524d7=null;var _0x2b6fbc='';return db[_0xd8b2('0x29')][_0xd8b2('0x48')]({'where':{'id':_0x154011[_0xd8b2('0x4d')]['id']},'attributes':['id',_0xd8b2('0x26'),_0xd8b2('0x53'),_0xd8b2('0x54'),_0xd8b2('0x55'),'remoteUri',_0xd8b2('0x56'),'accessKey']})[_0xd8b2('0x22')](handleEntityNotFound(_0x372a1f,null))['then'](function(_0x133729){if(_0x133729){_0x44ddf7=_0x133729['username'];_0x844bf4=_0x133729['accessKey'];_0x1fb593=_0x133729[_0xd8b2('0x55')];_0x2b6fbc=_0x133729[_0xd8b2('0x57')];var _0x4b167f=_0x2b6fbc['slice'](-0x1);if(_0x4b167f==='/'){_0x2b6fbc=_0x2b6fbc[_0xd8b2('0x58')](0x0,_0x2b6fbc[_0xd8b2('0x59')](_0x4b167f));}_0x2524d7=util[_0xd8b2('0x5a')](_0xd8b2('0x5b'),_0x2b6fbc);var _0x3accc7={'method':_0xd8b2('0x5c'),'uri':_0x2524d7,'qs':{'operation':'getchallenge','username':_0x133729[_0xd8b2('0x53')]},'json':!![]};return rp(_0x3accc7);}})[_0xd8b2('0x22')](function(_0x17e779){if(_0x17e779[_0xd8b2('0x5d')]){var _0x202670={'method':_0xd8b2('0x5e'),'uri':_0x2524d7,'form':{'operation':_0xd8b2('0x5f'),'username':_0x44ddf7,'accessKey':md5(_0x17e779[_0xd8b2('0x60')][_0xd8b2('0x61')]+_0x844bf4)},'json':!![]};return rp(_0x202670);}})[_0xd8b2('0x22')](function(_0x12613d){if(_0x12613d[_0xd8b2('0x5d')]){var _0x97f5d6={'method':'GET','uri':_0x2524d7,'qs':{'operation':_0xd8b2('0x62'),'username':_0x44ddf7,'sessionName':_0x12613d[_0xd8b2('0x60')][_0xd8b2('0x63')],'elementType':_0x1fb593},'json':!![]};return rp(_0x97f5d6);}})['then'](function(_0x984907){if(_0x984907[_0xd8b2('0x5d')]){var _0x3a312b=[_0xd8b2('0x64'),_0xd8b2('0x65'),_0xd8b2('0x66')];_[_0xd8b2('0x67')](_0x984907[_0xd8b2('0x60')][_0xd8b2('0x33')],function(_0x188ca2){return _0x3a312b[_0xd8b2('0x68')](_0x188ca2['type'][_0xd8b2('0x26')]);});_[_0xd8b2('0x67')](_0x984907[_0xd8b2('0x60')]['fields'],function(_0x601025){return _0x601025[_0xd8b2('0x69')]===_0xd8b2('0x6a');});return{'count':_0x984907['result']['fields'][_0xd8b2('0x34')],'rows':_[_0xd8b2('0x28')](_0x984907['result'][_0xd8b2('0x33')],function(_0x59a692){return{'id':_0x59a692[_0xd8b2('0x26')],'name':_0x59a692[_0xd8b2('0x6b')],'custom':_[_0xd8b2('0x6c')](_0x59a692['name'],'cf_')?!![]:![],'options':_0x59a692[_0xd8b2('0x2c')][_0xd8b2('0x26')]===_0xd8b2('0x6d')&&_0x59a692[_0xd8b2('0x2c')]['picklistValues'][_0xd8b2('0x34')]>0x0?_[_0xd8b2('0x28')](_0x59a692[_0xd8b2('0x2c')][_0xd8b2('0x6e')],function(_0x518d20){return{'name':_0x518d20[_0xd8b2('0x6b')],'value':_0x518d20[_0xd8b2('0x6f')]};}):[]};})};}})[_0xd8b2('0x22')](respondWithResult(_0x372a1f,null))[_0xd8b2('0x46')](function(_0x359235){console['log'](_0xd8b2('0x70')+_0x359235);var _0x4c9569=_0x154011[_0xd8b2('0x2f')][_0xd8b2('0x71')]?0x1f4:_0x359235['statusCode']||0x1f4;logger[_0xd8b2('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xd8b2('0x52'),_0x4c9569,JSON[_0xd8b2('0x72')](_0x359235));delete _0x359235[_0xd8b2('0x26')];if(_0x4c9569===0x191){_0x4c9569=0x190;}_0x372a1f['status'](_0x4c9569)[_0xd8b2('0x73')](_0x154011[_0xd8b2('0x2f')][_0xd8b2('0x71')]?{'message':_0xd8b2('0x74'),'statusCode':_0x359235['statusCode']}:_0x359235);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b4a4e80..f210373 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 _0x3ed6=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x24c3ae,_0x3bf1d1){var _0xb02bd8=function(_0x49f94e){while(--_0x49f94e){_0x24c3ae['push'](_0x24c3ae['shift']());}};_0xb02bd8(++_0x3bf1d1);}(_0x3ed6,0x91));var _0x63ed=function(_0x32d25a,_0x2ea6f7){_0x32d25a=_0x32d25a-0x0;var _0x2a23ce=_0x3ed6[_0x32d25a];return _0x2a23ce;};'use strict';var _=require(_0x63ed('0x0'));var util=require(_0x63ed('0x1'));var logger=require(_0x63ed('0x2'))(_0x63ed('0x3'));var moment=require(_0x63ed('0x4'));var BPromise=require(_0x63ed('0x5'));var rp=require(_0x63ed('0x6'));var fs=require('fs');var path=require(_0x63ed('0x7'));var rimraf=require(_0x63ed('0x8'));var config=require('../../config/environment');var attributes=require(_0x63ed('0x9'));var integrations=require(_0x63ed('0xa'));module[_0x63ed('0xb')]=function(_0x2348fd,_0x5970f6){return _0x2348fd['define'](_0x63ed('0xc'),attributes,{'tableName':_0x63ed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6755=['api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','util','../../config/logger'];(function(_0x59e818,_0x53d6cf){var _0x2418d6=function(_0x5926a7){while(--_0x5926a7){_0x59e818['push'](_0x59e818['shift']());}};_0x2418d6(++_0x53d6cf);}(_0x6755,0xfa));var _0x5675=function(_0x2a4e13,_0x3d1c1a){_0x2a4e13=_0x2a4e13-0x0;var _0xa0fb6=_0x6755[_0x2a4e13];return _0xa0fb6;};'use strict';var _=require('lodash');var util=require(_0x5675('0x0'));var logger=require(_0x5675('0x1'))(_0x5675('0x2'));var moment=require(_0x5675('0x3'));var BPromise=require('bluebird');var rp=require(_0x5675('0x4'));var fs=require('fs');var path=require(_0x5675('0x5'));var rimraf=require(_0x5675('0x6'));var config=require(_0x5675('0x7'));var attributes=require(_0x5675('0x8'));var integrations=require(_0x5675('0x9'));module[_0x5675('0xa')]=function(_0x7a4c97,_0xd7ae55){return _0x7a4c97['define'](_0x5675('0xb'),attributes,{'tableName':'int_vtiger_accounts','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 dc77243..9412432 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 _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','attributes','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xe205,0xa7));var _0x5e20=function(_0x58f232,_0x4cfb74){_0x58f232=_0x58f232-0x0;var _0x5a041e=_0xe205[_0x58f232];return _0x5a041e;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file +var _0xb58b=['model','map','debug','catch','ShowVtigerAccount','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include'];(function(_0x212d2f,_0x5a7a54){var _0x3773ca=function(_0x46777d){while(--_0x46777d){_0x212d2f['push'](_0x212d2f['shift']());}};_0x3773ca(++_0x5a7a54);}(_0xb58b,0x1f1));var _0xbb58=function(_0x49532f,_0x3feb91){_0x49532f=_0x49532f-0x0;var _0xbe9816=_0xb58b[_0x49532f];return _0xbe9816;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['VtigerAccount'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowVtigerAccount',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 41de4b4..4c1ca62 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 _0x6d1c=['get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40c3ed,_0x2b2053){var _0x182dd7=function(_0x38732b){while(--_0x38732b){_0x40c3ed['push'](_0x40c3ed['shift']());}};_0x182dd7(++_0x2b2053);}(_0x6d1c,0xa7));var _0xc6d1=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x6d1c[_0x1fd675];return _0x16b554;};'use strict';var multer=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var path=require('path');var timeout=require(_0xc6d1('0x2'));var express=require('express');var router=express[_0xc6d1('0x3')]();var fs_extra=require(_0xc6d1('0x4'));var auth=require(_0xc6d1('0x5'));var interaction=require(_0xc6d1('0x6'));var config=require(_0xc6d1('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0xc6d1('0x8')]('/',auth[_0xc6d1('0x9')](),controller[_0xc6d1('0xa')]);router[_0xc6d1('0x8')]('/:id',auth[_0xc6d1('0x9')](),controller[_0xc6d1('0xb')]);router[_0xc6d1('0x8')](_0xc6d1('0xc'),auth[_0xc6d1('0x9')](),controller[_0xc6d1('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xc6d1('0xe')]);router[_0xc6d1('0x8')](_0xc6d1('0xf'),auth[_0xc6d1('0x9')](),controller[_0xc6d1('0x10')]);router[_0xc6d1('0x11')]('/',auth['isAuthenticated'](),controller[_0xc6d1('0x12')]);router[_0xc6d1('0x13')]('/:id',auth[_0xc6d1('0x9')](),controller[_0xc6d1('0x14')]);router[_0xc6d1('0x15')](_0xc6d1('0x16'),auth[_0xc6d1('0x9')](),controller[_0xc6d1('0x17')]);module[_0xc6d1('0x18')]=router; \ No newline at end of file +var _0xf3d2=['isAuthenticated','/:id/descriptions','post','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x49674f,_0x5b46e7){var _0x65fe4=function(_0x34365f){while(--_0x34365f){_0x49674f['push'](_0x49674f['shift']());}};_0x65fe4(++_0x5b46e7);}(_0xf3d2,0xec));var _0x2f3d=function(_0x2f3947,_0x2ee083){_0x2f3947=_0x2f3947-0x0;var _0x3e6ab7=_0xf3d2[_0x2f3947];return _0x3e6ab7;};'use strict';var multer=require(_0x2f3d('0x0'));var util=require('util');var path=require(_0x2f3d('0x1'));var timeout=require(_0x2f3d('0x2'));var express=require(_0x2f3d('0x3'));var router=express[_0x2f3d('0x4')]();var fs_extra=require(_0x2f3d('0x5'));var auth=require(_0x2f3d('0x6'));var interaction=require(_0x2f3d('0x7'));var config=require(_0x2f3d('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x2f3d('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f3d('0xa')]);router['get'](_0x2f3d('0xb'),auth['isAuthenticated'](),controller[_0x2f3d('0xc')]);router[_0x2f3d('0x9')](_0x2f3d('0xd'),auth['isAuthenticated'](),controller[_0x2f3d('0xe')]);router[_0x2f3d('0x9')](_0x2f3d('0xf'),auth[_0x2f3d('0x10')](),controller['getSubjects']);router[_0x2f3d('0x9')](_0x2f3d('0x11'),auth[_0x2f3d('0x10')](),controller['getDescriptions']);router[_0x2f3d('0x12')]('/',auth[_0x2f3d('0x10')](),controller['create']);router[_0x2f3d('0x13')](_0x2f3d('0xb'),auth[_0x2f3d('0x10')](),controller[_0x2f3d('0x14')]);router['delete'](_0x2f3d('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 17a997a..609ca89 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 _0x60a9=['STRING'];(function(_0x928f34,_0x5bcf73){var _0x498c58=function(_0x49fdb9){while(--_0x49fdb9){_0x928f34['push'](_0x928f34['shift']());}};_0x498c58(++_0x5bcf73);}(_0x60a9,0x1a0));var _0x960a=function(_0x32f339,_0x5091db){_0x32f339=_0x32f339-0x0;var _0x35c310=_0x60a9[_0x32f339];return _0x35c310;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x960a('0x0')]},'description':{'type':Sequelize[_0x960a('0x0')]}}; \ No newline at end of file +var _0x536b=['STRING','sequelize','exports'];(function(_0x3ff3bc,_0x1aeacb){var _0x189875=function(_0x47ca60){while(--_0x47ca60){_0x3ff3bc['push'](_0x3ff3bc['shift']());}};_0x189875(++_0x1aeacb);}(_0x536b,0xa6));var _0xb536=function(_0x3c7af7,_0x186661){_0x3c7af7=_0x3c7af7-0x0;var _0x3e5d42=_0x536b[_0x3c7af7];return _0x3e5d42;};'use strict';var Sequelize=require(_0xb536('0x0'));module[_0xb536('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb536('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 110dca2..081aecd 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 _0xf591=['../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0xf591,0x128));var _0x1f59=function(_0x3717fc,_0x1c5cb0){_0x3717fc=_0x3717fc-0x0;var _0x3de354=_0xf591[_0x3717fc];return _0x3de354;};'use strict';var emlformat=require(_0x1f59('0x0'));var rimraf=require(_0x1f59('0x1'));var zipdir=require(_0x1f59('0x2'));var jsonpatch=require(_0x1f59('0x3'));var rp=require('request-promise');var moment=require(_0x1f59('0x4'));var BPromise=require(_0x1f59('0x5'));var Mustache=require(_0x1f59('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1f59('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f59('0x8'));var squel=require(_0x1f59('0x9'));var crypto=require(_0x1f59('0xa'));var jsforce=require(_0x1f59('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f59('0xc'));var Redis=require(_0x1f59('0xd'));var authService=require(_0x1f59('0xe'));var qs=require(_0x1f59('0xf'));var as=require(_0x1f59('0x10'));var hardwareService=require(_0x1f59('0x11'));var logger=require('../../config/logger')(_0x1f59('0x12'));var utils=require(_0x1f59('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1f59('0x14'));var db=require(_0x1f59('0x15'))['db'];function respondWithStatusCode(_0x4589d3,_0x7e0f18){_0x7e0f18=_0x7e0f18||0xcc;return function(_0x344c3a){if(_0x344c3a){return _0x4589d3[_0x1f59('0x16')](_0x7e0f18);}return _0x4589d3['status'](_0x7e0f18)['end']();};}function respondWithResult(_0x1c4a63,_0x2cb7bd){_0x2cb7bd=_0x2cb7bd||0xc8;return function(_0x20451d){if(_0x20451d){return _0x1c4a63[_0x1f59('0x17')](_0x2cb7bd)[_0x1f59('0x18')](_0x20451d);}};}function respondWithFilteredResult(_0x46f016,_0x3afe4b){return function(_0x267c4c){if(_0x267c4c){var _0x6ff8e=typeof _0x3afe4b['offset']==='undefined'&&typeof _0x3afe4b[_0x1f59('0x19')]==='undefined';var _0x1360b8=_0x267c4c[_0x1f59('0x1a')];var _0x1ced8c=_0x6ff8e?0x0:_0x3afe4b[_0x1f59('0x1b')];var _0x2bfcf0=_0x6ff8e?_0x267c4c['count']:_0x3afe4b[_0x1f59('0x1b')]+_0x3afe4b[_0x1f59('0x19')];var _0x265093;if(_0x2bfcf0>=_0x1360b8){_0x2bfcf0=_0x1360b8;_0x265093=0xc8;}else{_0x265093=0xce;}_0x46f016[_0x1f59('0x17')](_0x265093);return _0x46f016[_0x1f59('0x1c')](_0x1f59('0x1d'),_0x1ced8c+'-'+_0x2bfcf0+'/'+_0x1360b8)[_0x1f59('0x18')](_0x267c4c);}return null;};}function patchUpdates(_0x3e821e){return function(_0x5ae10d){try{jsonpatch[_0x1f59('0x1e')](_0x5ae10d,_0x3e821e,!![]);}catch(_0x1e0495){return BPromise[_0x1f59('0x1f')](_0x1e0495);}return _0x5ae10d[_0x1f59('0x20')]();};}function saveUpdates(_0x3005a8,_0xbf0fd0){return function(_0x535bcc){if(_0x535bcc){return _0x535bcc['update'](_0x3005a8)[_0x1f59('0x21')](function(_0x3ec938){return _0x3ec938;});}return null;};}function removeEntity(_0x485b9d,_0x1b8c3f){return function(_0x4d4bdc){if(_0x4d4bdc){return _0x4d4bdc[_0x1f59('0x22')]()['then'](function(){_0x485b9d[_0x1f59('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19337d,_0x949f4f){return function(_0x181e80){if(!_0x181e80){_0x19337d[_0x1f59('0x16')](0x194);}return _0x181e80;};}function handleError(_0x460019,_0x15a65d){_0x15a65d=_0x15a65d||0x1f4;return function(_0x5256b8){logger[_0x1f59('0x23')](_0x5256b8[_0x1f59('0x24')]);if(_0x5256b8['name']){delete _0x5256b8[_0x1f59('0x25')];}_0x460019[_0x1f59('0x17')](_0x15a65d)[_0x1f59('0x26')](_0x5256b8);};}exports[_0x1f59('0x27')]=function(_0x56f778,_0x296642){var _0x4cdc23={},_0x1604dc={},_0x433a81={'count':0x0,'rows':[]};var _0x36fd78=_['map'](db[_0x1f59('0x28')][_0x1f59('0x29')],function(_0x1edc07){return{'name':_0x1edc07[_0x1f59('0x2a')],'type':_0x1edc07[_0x1f59('0x2b')][_0x1f59('0x2c')]};});_0x1604dc[_0x1f59('0x2d')]=_[_0x1f59('0x2e')](_0x36fd78,_0x1f59('0x25'));_0x1604dc['query']=_[_0x1f59('0x2f')](_0x56f778['query']);_0x1604dc[_0x1f59('0x30')]=_[_0x1f59('0x31')](_0x1604dc[_0x1f59('0x2d')],_0x1604dc[_0x1f59('0x32')]);_0x4cdc23[_0x1f59('0x33')]=_['intersection'](_0x1604dc[_0x1f59('0x2d')],qs[_0x1f59('0x34')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x34')]));_0x4cdc23[_0x1f59('0x33')]=_0x4cdc23[_0x1f59('0x33')][_0x1f59('0x35')]?_0x4cdc23[_0x1f59('0x33')]:_0x1604dc[_0x1f59('0x2d')];if(!_0x56f778[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x4cdc23[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x19')]);_0x4cdc23[_0x1f59('0x1b')]=qs[_0x1f59('0x1b')](_0x56f778['query'][_0x1f59('0x1b')]);}_0x4cdc23[_0x1f59('0x38')]=qs[_0x1f59('0x39')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x39')]);_0x4cdc23[_0x1f59('0x3a')]=qs[_0x1f59('0x30')](_['pick'](_0x56f778[_0x1f59('0x32')],_0x1604dc[_0x1f59('0x30')]),_0x36fd78);if(_0x56f778[_0x1f59('0x32')]['filter']){_0x4cdc23[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x4cdc23[_0x1f59('0x3a')],{'$or':_['map'](_0x36fd78,function(_0x356cd4){if(_0x356cd4[_0x1f59('0x2b')]!==_0x1f59('0x3c')){var _0x28df18={};_0x28df18[_0x356cd4['name']]={'$like':'%'+_0x56f778['query'][_0x1f59('0x3d')]+'%'};return _0x28df18;}})});}_0x4cdc23=_[_0x1f59('0x3b')]({},_0x4cdc23,_0x56f778[_0x1f59('0x3e')]);var _0x9cc3f1={'where':_0x4cdc23[_0x1f59('0x3a')]};return db[_0x1f59('0x28')][_0x1f59('0x1a')](_0x9cc3f1)[_0x1f59('0x21')](function(_0xe9cf98){_0x433a81['count']=_0xe9cf98;if(_0x56f778[_0x1f59('0x32')]['includeAll']){_0x4cdc23['include']=[{'all':!![]}];}return db[_0x1f59('0x28')][_0x1f59('0x3f')](_0x4cdc23);})['then'](function(_0x5839c1){_0x433a81[_0x1f59('0x40')]=_0x5839c1;return _0x433a81;})['then'](respondWithFilteredResult(_0x296642,_0x4cdc23))[_0x1f59('0x41')](handleError(_0x296642,null));};exports[_0x1f59('0x42')]=function(_0x10913f,_0x52a004){var _0x3db0cd={'raw':![],'where':{'id':_0x10913f[_0x1f59('0x43')]['id']}},_0x2b538e={};_0x2b538e[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db['VtigerConfiguration'][_0x1f59('0x29')]);_0x2b538e[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x10913f['query']);_0x2b538e[_0x1f59('0x30')]=_[_0x1f59('0x31')](_0x2b538e[_0x1f59('0x2d')],_0x2b538e[_0x1f59('0x32')]);_0x3db0cd['attributes']=_[_0x1f59('0x31')](_0x2b538e['model'],qs[_0x1f59('0x34')](_0x10913f[_0x1f59('0x32')]['fields']));_0x3db0cd[_0x1f59('0x33')]=_0x3db0cd[_0x1f59('0x33')][_0x1f59('0x35')]?_0x3db0cd[_0x1f59('0x33')]:_0x2b538e[_0x1f59('0x2d')];if(_0x10913f[_0x1f59('0x32')][_0x1f59('0x44')]){_0x3db0cd[_0x1f59('0x45')]=[{'all':!![]}];}_0x3db0cd=_['merge']({},_0x3db0cd,_0x10913f[_0x1f59('0x3e')]);return db[_0x1f59('0x28')][_0x1f59('0x46')](_0x3db0cd)[_0x1f59('0x21')](handleEntityNotFound(_0x52a004,null))[_0x1f59('0x21')](respondWithResult(_0x52a004,null))[_0x1f59('0x41')](handleError(_0x52a004,null));};exports[_0x1f59('0x47')]=function(_0x1f3e5e,_0x5074cf){return db[_0x1f59('0x28')][_0x1f59('0x47')](_0x1f3e5e[_0x1f59('0x48')],{})['then'](respondWithResult(_0x5074cf,0xc9))[_0x1f59('0x41')](handleError(_0x5074cf,null));};exports['update']=function(_0x1bbae3,_0x55eb38){if(_0x1bbae3[_0x1f59('0x48')]['id']){delete _0x1bbae3['body']['id'];}return db['VtigerConfiguration'][_0x1f59('0x46')]({'where':{'id':_0x1bbae3[_0x1f59('0x43')]['id']}})['then'](handleEntityNotFound(_0x55eb38,null))[_0x1f59('0x21')](saveUpdates(_0x1bbae3['body'],null))[_0x1f59('0x21')](respondWithResult(_0x55eb38,null))[_0x1f59('0x41')](handleError(_0x55eb38,null));};exports[_0x1f59('0x22')]=function(_0x39bb95,_0x3f3d9d){return db['VtigerConfiguration'][_0x1f59('0x46')]({'where':{'id':_0x39bb95['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x3f3d9d,null))[_0x1f59('0x21')](removeEntity(_0x3f3d9d,null))[_0x1f59('0x41')](handleError(_0x3f3d9d,null));};exports[_0x1f59('0x49')]=function(_0x2d0b21,_0xa50352,_0x5f36d0){var _0x459a5f={};var _0x3c3068={};var _0x51147f;var _0x5b757a;return db[_0x1f59('0x28')][_0x1f59('0x4a')]({'where':{'id':_0x2d0b21['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0xa50352,null))[_0x1f59('0x21')](function(_0x2430eb){if(_0x2430eb){_0x51147f=_0x2430eb;_0x3c3068[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db[_0x1f59('0x4b')][_0x1f59('0x29')]);_0x3c3068[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x2d0b21[_0x1f59('0x32')]);_0x3c3068['filters']=_[_0x1f59('0x31')](_0x3c3068[_0x1f59('0x2d')],_0x3c3068['query']);_0x459a5f[_0x1f59('0x33')]=_[_0x1f59('0x31')](_0x3c3068['model'],qs['fields'](_0x2d0b21['query']['fields']));_0x459a5f[_0x1f59('0x33')]=_0x459a5f[_0x1f59('0x33')][_0x1f59('0x35')]?_0x459a5f['attributes']:_0x3c3068[_0x1f59('0x2d')];_0x459a5f['order']=qs[_0x1f59('0x39')](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x39')]);_0x459a5f['where']=qs['filters'](_[_0x1f59('0x4c')](_0x2d0b21[_0x1f59('0x32')],_0x3c3068[_0x1f59('0x30')]));if(_0x2d0b21['query'][_0x1f59('0x3d')]){_0x459a5f[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x459a5f[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x459a5f[_0x1f59('0x33')],function(_0x218a36){var _0x3fd418={};_0x3fd418[_0x218a36]={'$like':'%'+_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x3fd418;})});}_0x459a5f=_[_0x1f59('0x3b')]({},_0x459a5f,_0x2d0b21[_0x1f59('0x3e')]);return _0x51147f[_0x1f59('0x49')](_0x459a5f);}})['then'](function(_0x3fc86f){if(_0x3fc86f){_0x5b757a=_0x3fc86f[_0x1f59('0x35')];if(!_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x459a5f[_0x1f59('0x19')]=qs['limit'](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x19')]);_0x459a5f[_0x1f59('0x1b')]=qs['offset'](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x1b')]);}return _0x51147f[_0x1f59('0x49')](_0x459a5f);}})[_0x1f59('0x21')](function(_0x4b7844){if(_0x4b7844){return _0x4b7844?{'count':_0x5b757a,'rows':_0x4b7844}:null;}})[_0x1f59('0x21')](respondWithResult(_0xa50352,null))[_0x1f59('0x41')](handleError(_0xa50352,null));};exports[_0x1f59('0x4d')]=function(_0xc483ec,_0x51389e,_0x127c3d){var _0x3a2b0a={};var _0x2d6636={};var _0xaeae17;var _0x107a82;return db[_0x1f59('0x28')][_0x1f59('0x4a')]({'where':{'id':_0xc483ec[_0x1f59('0x43')]['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x51389e,null))['then'](function(_0x5aea4d){if(_0x5aea4d){_0xaeae17=_0x5aea4d;_0x2d6636['model']=_[_0x1f59('0x2f')](db['VtigerField']['rawAttributes']);_0x2d6636[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0xc483ec[_0x1f59('0x32')]);_0x2d6636['filters']=_['intersection'](_0x2d6636[_0x1f59('0x2d')],_0x2d6636[_0x1f59('0x32')]);_0x3a2b0a['attributes']=_[_0x1f59('0x31')](_0x2d6636[_0x1f59('0x2d')],qs[_0x1f59('0x34')](_0xc483ec[_0x1f59('0x32')]['fields']));_0x3a2b0a[_0x1f59('0x33')]=_0x3a2b0a['attributes'][_0x1f59('0x35')]?_0x3a2b0a['attributes']:_0x2d6636[_0x1f59('0x2d')];_0x3a2b0a[_0x1f59('0x38')]=qs['sort'](_0xc483ec[_0x1f59('0x32')][_0x1f59('0x39')]);_0x3a2b0a[_0x1f59('0x3a')]=qs['filters'](_[_0x1f59('0x4c')](_0xc483ec['query'],_0x2d6636[_0x1f59('0x30')]));if(_0xc483ec['query']['filter']){_0x3a2b0a[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x3a2b0a[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x3a2b0a[_0x1f59('0x33')],function(_0x181689){var _0x266c2d={};_0x266c2d[_0x181689]={'$like':'%'+_0xc483ec[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x266c2d;})});}_0x3a2b0a=_['merge']({},_0x3a2b0a,_0xc483ec[_0x1f59('0x3e')]);return _0xaeae17[_0x1f59('0x4d')](_0x3a2b0a);}})['then'](function(_0x3f69e4){if(_0x3f69e4){_0x107a82=_0x3f69e4[_0x1f59('0x35')];if(!_0xc483ec['query']['hasOwnProperty']('nolimit')){_0x3a2b0a[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0xc483ec[_0x1f59('0x32')]['limit']);_0x3a2b0a['offset']=qs['offset'](_0xc483ec[_0x1f59('0x32')]['offset']);}return _0xaeae17['getSubjects'](_0x3a2b0a);}})[_0x1f59('0x21')](function(_0x43d788){if(_0x43d788){return _0x43d788?{'count':_0x107a82,'rows':_0x43d788}:null;}})[_0x1f59('0x21')](respondWithResult(_0x51389e,null))[_0x1f59('0x41')](handleError(_0x51389e,null));};exports['getDescriptions']=function(_0x4c32e8,_0x19c7c6,_0x53f9b6){var _0x35d58e={};var _0x1858a3={};var _0x576e34;var _0x2cf653;return db[_0x1f59('0x28')]['findOne']({'where':{'id':_0x4c32e8['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x19c7c6,null))['then'](function(_0x1bfff0){if(_0x1bfff0){_0x576e34=_0x1bfff0;_0x1858a3[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db[_0x1f59('0x4b')][_0x1f59('0x29')]);_0x1858a3[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x4c32e8[_0x1f59('0x32')]);_0x1858a3['filters']=_[_0x1f59('0x31')](_0x1858a3[_0x1f59('0x2d')],_0x1858a3[_0x1f59('0x32')]);_0x35d58e['attributes']=_[_0x1f59('0x31')](_0x1858a3[_0x1f59('0x2d')],qs['fields'](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x34')]));_0x35d58e[_0x1f59('0x33')]=_0x35d58e[_0x1f59('0x33')]['length']?_0x35d58e[_0x1f59('0x33')]:_0x1858a3[_0x1f59('0x2d')];_0x35d58e['order']=qs[_0x1f59('0x39')](_0x4c32e8['query'][_0x1f59('0x39')]);_0x35d58e['where']=qs[_0x1f59('0x30')](_[_0x1f59('0x4c')](_0x4c32e8['query'],_0x1858a3[_0x1f59('0x30')]));if(_0x4c32e8['query']['filter']){_0x35d58e['where']=_['merge'](_0x35d58e[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x35d58e[_0x1f59('0x33')],function(_0x1c1f09){var _0x4f6858={};_0x4f6858[_0x1c1f09]={'$like':'%'+_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x4f6858;})});}_0x35d58e=_[_0x1f59('0x3b')]({},_0x35d58e,_0x4c32e8[_0x1f59('0x3e')]);return _0x576e34[_0x1f59('0x4e')](_0x35d58e);}})[_0x1f59('0x21')](function(_0x4c1684){if(_0x4c1684){_0x2cf653=_0x4c1684['length'];if(!_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x35d58e[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x19')]);_0x35d58e[_0x1f59('0x1b')]=qs[_0x1f59('0x1b')](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x1b')]);}return _0x576e34[_0x1f59('0x4e')](_0x35d58e);}})[_0x1f59('0x21')](function(_0x494792){if(_0x494792){return _0x494792?{'count':_0x2cf653,'rows':_0x494792}:null;}})[_0x1f59('0x21')](respondWithResult(_0x19c7c6,null))[_0x1f59('0x41')](handleError(_0x19c7c6,null));}; \ No newline at end of file +var _0x6d93=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll','rows','catch','params','create','body','find','getFields','findOne','VtigerField','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d93,0x177));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x36d9('0x0'));var rimraf=require(_0x36d9('0x1'));var zipdir=require(_0x36d9('0x2'));var jsonpatch=require(_0x36d9('0x3'));var rp=require(_0x36d9('0x4'));var moment=require(_0x36d9('0x5'));var BPromise=require(_0x36d9('0x6'));var Mustache=require('mustache');var util=require(_0x36d9('0x7'));var path=require(_0x36d9('0x8'));var sox=require(_0x36d9('0x9'));var csv=require(_0x36d9('0xa'));var ejs=require(_0x36d9('0xb'));var fs=require('fs');var fs_extra=require(_0x36d9('0xc'));var _=require(_0x36d9('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36d9('0xe'));var deskjs=require(_0x36d9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x36d9('0x10'));var Papa=require(_0x36d9('0x11'));var Redis=require(_0x36d9('0x12'));var authService=require(_0x36d9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x36d9('0x14'));var hardwareService=require(_0x36d9('0x15'));var logger=require(_0x36d9('0x16'))(_0x36d9('0x17'));var utils=require('../../config/utils');var config=require(_0x36d9('0x18'));var licenseUtil=require(_0x36d9('0x19'));var db=require(_0x36d9('0x1a'))['db'];function respondWithStatusCode(_0x311864,_0x46f056){_0x46f056=_0x46f056||0xcc;return function(_0x5f3ff0){if(_0x5f3ff0){return _0x311864[_0x36d9('0x1b')](_0x46f056);}return _0x311864[_0x36d9('0x1c')](_0x46f056)['end']();};}function respondWithResult(_0x5f4c25,_0x18dd9b){_0x18dd9b=_0x18dd9b||0xc8;return function(_0x3c7dc1){if(_0x3c7dc1){return _0x5f4c25[_0x36d9('0x1c')](_0x18dd9b)[_0x36d9('0x1d')](_0x3c7dc1);}};}function respondWithFilteredResult(_0x81e3a9,_0x2f6a13){return function(_0x2c6629){if(_0x2c6629){var _0x157dd6=typeof _0x2f6a13[_0x36d9('0x1e')]==='undefined'&&typeof _0x2f6a13['limit']===_0x36d9('0x1f');var _0x1a88a3=_0x2c6629[_0x36d9('0x20')];var _0x3d76e2=_0x157dd6?0x0:_0x2f6a13[_0x36d9('0x1e')];var _0x3a9842=_0x157dd6?_0x2c6629[_0x36d9('0x20')]:_0x2f6a13[_0x36d9('0x1e')]+_0x2f6a13[_0x36d9('0x21')];var _0x2c1df;if(_0x3a9842>=_0x1a88a3){_0x3a9842=_0x1a88a3;_0x2c1df=0xc8;}else{_0x2c1df=0xce;}_0x81e3a9[_0x36d9('0x1c')](_0x2c1df);return _0x81e3a9[_0x36d9('0x22')](_0x36d9('0x23'),_0x3d76e2+'-'+_0x3a9842+'/'+_0x1a88a3)['json'](_0x2c6629);}return null;};}function patchUpdates(_0x145625){return function(_0x24b474){try{jsonpatch[_0x36d9('0x24')](_0x24b474,_0x145625,!![]);}catch(_0x178c07){return BPromise['reject'](_0x178c07);}return _0x24b474[_0x36d9('0x25')]();};}function saveUpdates(_0x207cbe,_0x57dc60){return function(_0x42cc33){if(_0x42cc33){return _0x42cc33[_0x36d9('0x26')](_0x207cbe)[_0x36d9('0x27')](function(_0x5f52b1){return _0x5f52b1;});}return null;};}function removeEntity(_0x523cf2,_0x509436){return function(_0x2ba1af){if(_0x2ba1af){return _0x2ba1af[_0x36d9('0x28')]()[_0x36d9('0x27')](function(){_0x523cf2[_0x36d9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21154c,_0x1dc1e8){return function(_0x12d2fd){if(!_0x12d2fd){_0x21154c['sendStatus'](0x194);}return _0x12d2fd;};}function handleError(_0x48c8ed,_0x1f7324){_0x1f7324=_0x1f7324||0x1f4;return function(_0x12041e){logger[_0x36d9('0x29')](_0x12041e[_0x36d9('0x2a')]);if(_0x12041e[_0x36d9('0x2b')]){delete _0x12041e[_0x36d9('0x2b')];}_0x48c8ed['status'](_0x1f7324)['send'](_0x12041e);};}exports['index']=function(_0x443902,_0x5142f6){var _0x4db48d={},_0x4b17dd={},_0x39365c={'count':0x0,'rows':[]};var _0xbadfa=_[_0x36d9('0x2c')](db[_0x36d9('0x2d')][_0x36d9('0x2e')],function(_0x59c869){return{'name':_0x59c869[_0x36d9('0x2f')],'type':_0x59c869[_0x36d9('0x30')][_0x36d9('0x31')]};});_0x4b17dd['model']=_['map'](_0xbadfa,_0x36d9('0x2b'));_0x4b17dd[_0x36d9('0x32')]=_[_0x36d9('0x33')](_0x443902[_0x36d9('0x32')]);_0x4b17dd[_0x36d9('0x34')]=_[_0x36d9('0x35')](_0x4b17dd[_0x36d9('0x36')],_0x4b17dd[_0x36d9('0x32')]);_0x4db48d[_0x36d9('0x37')]=_[_0x36d9('0x35')](_0x4b17dd[_0x36d9('0x36')],qs[_0x36d9('0x38')](_0x443902[_0x36d9('0x32')]['fields']));_0x4db48d[_0x36d9('0x37')]=_0x4db48d[_0x36d9('0x37')][_0x36d9('0x39')]?_0x4db48d[_0x36d9('0x37')]:_0x4b17dd['model'];if(!_0x443902['query'][_0x36d9('0x3a')](_0x36d9('0x3b'))){_0x4db48d[_0x36d9('0x21')]=qs[_0x36d9('0x21')](_0x443902[_0x36d9('0x32')][_0x36d9('0x21')]);_0x4db48d['offset']=qs[_0x36d9('0x1e')](_0x443902[_0x36d9('0x32')][_0x36d9('0x1e')]);}_0x4db48d[_0x36d9('0x3c')]=qs['sort'](_0x443902[_0x36d9('0x32')]['sort']);_0x4db48d[_0x36d9('0x3d')]=qs['filters'](_[_0x36d9('0x3e')](_0x443902[_0x36d9('0x32')],_0x4b17dd[_0x36d9('0x34')]),_0xbadfa);if(_0x443902['query'][_0x36d9('0x3f')]){_0x4db48d[_0x36d9('0x3d')]=_['merge'](_0x4db48d[_0x36d9('0x3d')],{'$or':_['map'](_0xbadfa,function(_0xe4159f){if(_0xe4159f[_0x36d9('0x30')]!=='VIRTUAL'){var _0x52a457={};_0x52a457[_0xe4159f[_0x36d9('0x2b')]]={'$like':'%'+_0x443902['query'][_0x36d9('0x3f')]+'%'};return _0x52a457;}})});}_0x4db48d=_[_0x36d9('0x40')]({},_0x4db48d,_0x443902[_0x36d9('0x41')]);var _0x559b62={'where':_0x4db48d[_0x36d9('0x3d')]};return db[_0x36d9('0x2d')][_0x36d9('0x20')](_0x559b62)[_0x36d9('0x27')](function(_0x206020){_0x39365c[_0x36d9('0x20')]=_0x206020;if(_0x443902[_0x36d9('0x32')]['includeAll']){_0x4db48d[_0x36d9('0x42')]=[{'all':!![]}];}return db[_0x36d9('0x2d')][_0x36d9('0x43')](_0x4db48d);})[_0x36d9('0x27')](function(_0x430f7e){_0x39365c[_0x36d9('0x44')]=_0x430f7e;return _0x39365c;})[_0x36d9('0x27')](respondWithFilteredResult(_0x5142f6,_0x4db48d))[_0x36d9('0x45')](handleError(_0x5142f6,null));};exports['show']=function(_0x8305c0,_0x21062e){var _0x148092={'raw':![],'where':{'id':_0x8305c0[_0x36d9('0x46')]['id']}},_0xad61d1={};_0xad61d1['model']=_[_0x36d9('0x33')](db[_0x36d9('0x2d')][_0x36d9('0x2e')]);_0xad61d1[_0x36d9('0x32')]=_[_0x36d9('0x33')](_0x8305c0[_0x36d9('0x32')]);_0xad61d1['filters']=_[_0x36d9('0x35')](_0xad61d1[_0x36d9('0x36')],_0xad61d1[_0x36d9('0x32')]);_0x148092['attributes']=_[_0x36d9('0x35')](_0xad61d1[_0x36d9('0x36')],qs[_0x36d9('0x38')](_0x8305c0['query'][_0x36d9('0x38')]));_0x148092[_0x36d9('0x37')]=_0x148092['attributes'][_0x36d9('0x39')]?_0x148092[_0x36d9('0x37')]:_0xad61d1[_0x36d9('0x36')];if(_0x8305c0[_0x36d9('0x32')]['includeAll']){_0x148092[_0x36d9('0x42')]=[{'all':!![]}];}_0x148092=_[_0x36d9('0x40')]({},_0x148092,_0x8305c0[_0x36d9('0x41')]);return db[_0x36d9('0x2d')]['find'](_0x148092)[_0x36d9('0x27')](handleEntityNotFound(_0x21062e,null))[_0x36d9('0x27')](respondWithResult(_0x21062e,null))[_0x36d9('0x45')](handleError(_0x21062e,null));};exports['create']=function(_0x52044d,_0x1035c7){return db[_0x36d9('0x2d')][_0x36d9('0x47')](_0x52044d[_0x36d9('0x48')],{})[_0x36d9('0x27')](respondWithResult(_0x1035c7,0xc9))[_0x36d9('0x45')](handleError(_0x1035c7,null));};exports['update']=function(_0x8c1a82,_0x32f587){if(_0x8c1a82[_0x36d9('0x48')]['id']){delete _0x8c1a82[_0x36d9('0x48')]['id'];}return db[_0x36d9('0x2d')]['find']({'where':{'id':_0x8c1a82['params']['id']}})[_0x36d9('0x27')](handleEntityNotFound(_0x32f587,null))['then'](saveUpdates(_0x8c1a82['body'],null))['then'](respondWithResult(_0x32f587,null))[_0x36d9('0x45')](handleError(_0x32f587,null));};exports[_0x36d9('0x28')]=function(_0x2ff71b,_0x5eba0c){return db[_0x36d9('0x2d')][_0x36d9('0x49')]({'where':{'id':_0x2ff71b[_0x36d9('0x46')]['id']}})['then'](handleEntityNotFound(_0x5eba0c,null))[_0x36d9('0x27')](removeEntity(_0x5eba0c,null))[_0x36d9('0x45')](handleError(_0x5eba0c,null));};exports[_0x36d9('0x4a')]=function(_0x16d512,_0x4e4dbe,_0x35fa0e){var _0xbc3576={};var _0xaa359d={};var _0x1e6ee1;var _0x2f554e;return db['VtigerConfiguration'][_0x36d9('0x4b')]({'where':{'id':_0x16d512['params']['id']}})['then'](handleEntityNotFound(_0x4e4dbe,null))[_0x36d9('0x27')](function(_0xde4ec3){if(_0xde4ec3){_0x1e6ee1=_0xde4ec3;_0xaa359d[_0x36d9('0x36')]=_[_0x36d9('0x33')](db[_0x36d9('0x4c')][_0x36d9('0x2e')]);_0xaa359d[_0x36d9('0x32')]=_['keys'](_0x16d512[_0x36d9('0x32')]);_0xaa359d[_0x36d9('0x34')]=_[_0x36d9('0x35')](_0xaa359d[_0x36d9('0x36')],_0xaa359d[_0x36d9('0x32')]);_0xbc3576[_0x36d9('0x37')]=_['intersection'](_0xaa359d['model'],qs[_0x36d9('0x38')](_0x16d512['query'][_0x36d9('0x38')]));_0xbc3576[_0x36d9('0x37')]=_0xbc3576[_0x36d9('0x37')][_0x36d9('0x39')]?_0xbc3576[_0x36d9('0x37')]:_0xaa359d[_0x36d9('0x36')];_0xbc3576['order']=qs[_0x36d9('0x4d')](_0x16d512[_0x36d9('0x32')]['sort']);_0xbc3576[_0x36d9('0x3d')]=qs[_0x36d9('0x34')](_[_0x36d9('0x3e')](_0x16d512[_0x36d9('0x32')],_0xaa359d[_0x36d9('0x34')]));if(_0x16d512['query']['filter']){_0xbc3576[_0x36d9('0x3d')]=_[_0x36d9('0x40')](_0xbc3576[_0x36d9('0x3d')],{'$or':_[_0x36d9('0x2c')](_0xbc3576[_0x36d9('0x37')],function(_0x2698a0){var _0x84026a={};_0x84026a[_0x2698a0]={'$like':'%'+_0x16d512[_0x36d9('0x32')][_0x36d9('0x3f')]+'%'};return _0x84026a;})});}_0xbc3576=_[_0x36d9('0x40')]({},_0xbc3576,_0x16d512[_0x36d9('0x41')]);return _0x1e6ee1[_0x36d9('0x4a')](_0xbc3576);}})[_0x36d9('0x27')](function(_0x1c69a9){if(_0x1c69a9){_0x2f554e=_0x1c69a9[_0x36d9('0x39')];if(!_0x16d512[_0x36d9('0x32')][_0x36d9('0x3a')](_0x36d9('0x3b'))){_0xbc3576['limit']=qs[_0x36d9('0x21')](_0x16d512['query'][_0x36d9('0x21')]);_0xbc3576[_0x36d9('0x1e')]=qs['offset'](_0x16d512['query'][_0x36d9('0x1e')]);}return _0x1e6ee1[_0x36d9('0x4a')](_0xbc3576);}})['then'](function(_0x27f603){if(_0x27f603){return _0x27f603?{'count':_0x2f554e,'rows':_0x27f603}:null;}})[_0x36d9('0x27')](respondWithResult(_0x4e4dbe,null))[_0x36d9('0x45')](handleError(_0x4e4dbe,null));};exports[_0x36d9('0x4e')]=function(_0x4fec37,_0xef5a84,_0x350da3){var _0x228161={};var _0x3901d0={};var _0x4e84d1;var _0x3eb6b6;return db['VtigerConfiguration'][_0x36d9('0x4b')]({'where':{'id':_0x4fec37[_0x36d9('0x46')]['id']}})[_0x36d9('0x27')](handleEntityNotFound(_0xef5a84,null))['then'](function(_0x338c58){if(_0x338c58){_0x4e84d1=_0x338c58;_0x3901d0['model']=_['keys'](db['VtigerField'][_0x36d9('0x2e')]);_0x3901d0['query']=_['keys'](_0x4fec37[_0x36d9('0x32')]);_0x3901d0['filters']=_[_0x36d9('0x35')](_0x3901d0[_0x36d9('0x36')],_0x3901d0[_0x36d9('0x32')]);_0x228161[_0x36d9('0x37')]=_[_0x36d9('0x35')](_0x3901d0[_0x36d9('0x36')],qs[_0x36d9('0x38')](_0x4fec37[_0x36d9('0x32')][_0x36d9('0x38')]));_0x228161[_0x36d9('0x37')]=_0x228161[_0x36d9('0x37')][_0x36d9('0x39')]?_0x228161[_0x36d9('0x37')]:_0x3901d0[_0x36d9('0x36')];_0x228161[_0x36d9('0x3c')]=qs[_0x36d9('0x4d')](_0x4fec37[_0x36d9('0x32')][_0x36d9('0x4d')]);_0x228161[_0x36d9('0x3d')]=qs['filters'](_['pick'](_0x4fec37[_0x36d9('0x32')],_0x3901d0['filters']));if(_0x4fec37[_0x36d9('0x32')]['filter']){_0x228161['where']=_[_0x36d9('0x40')](_0x228161[_0x36d9('0x3d')],{'$or':_[_0x36d9('0x2c')](_0x228161[_0x36d9('0x37')],function(_0x17e95a){var _0x5c7358={};_0x5c7358[_0x17e95a]={'$like':'%'+_0x4fec37['query'][_0x36d9('0x3f')]+'%'};return _0x5c7358;})});}_0x228161=_[_0x36d9('0x40')]({},_0x228161,_0x4fec37[_0x36d9('0x41')]);return _0x4e84d1['getSubjects'](_0x228161);}})[_0x36d9('0x27')](function(_0x5aa051){if(_0x5aa051){_0x3eb6b6=_0x5aa051[_0x36d9('0x39')];if(!_0x4fec37['query'][_0x36d9('0x3a')](_0x36d9('0x3b'))){_0x228161[_0x36d9('0x21')]=qs[_0x36d9('0x21')](_0x4fec37[_0x36d9('0x32')][_0x36d9('0x21')]);_0x228161[_0x36d9('0x1e')]=qs[_0x36d9('0x1e')](_0x4fec37[_0x36d9('0x32')][_0x36d9('0x1e')]);}return _0x4e84d1[_0x36d9('0x4e')](_0x228161);}})['then'](function(_0x23c42a){if(_0x23c42a){return _0x23c42a?{'count':_0x3eb6b6,'rows':_0x23c42a}:null;}})[_0x36d9('0x27')](respondWithResult(_0xef5a84,null))[_0x36d9('0x45')](handleError(_0xef5a84,null));};exports['getDescriptions']=function(_0x283022,_0x32f418,_0x423de5){var _0x1e0cd1={};var _0x50dbfe={};var _0x44a21a;var _0x28cd49;return db[_0x36d9('0x2d')][_0x36d9('0x4b')]({'where':{'id':_0x283022[_0x36d9('0x46')]['id']}})[_0x36d9('0x27')](handleEntityNotFound(_0x32f418,null))[_0x36d9('0x27')](function(_0x2ac8eb){if(_0x2ac8eb){_0x44a21a=_0x2ac8eb;_0x50dbfe[_0x36d9('0x36')]=_[_0x36d9('0x33')](db[_0x36d9('0x4c')][_0x36d9('0x2e')]);_0x50dbfe[_0x36d9('0x32')]=_[_0x36d9('0x33')](_0x283022[_0x36d9('0x32')]);_0x50dbfe[_0x36d9('0x34')]=_['intersection'](_0x50dbfe[_0x36d9('0x36')],_0x50dbfe[_0x36d9('0x32')]);_0x1e0cd1[_0x36d9('0x37')]=_['intersection'](_0x50dbfe[_0x36d9('0x36')],qs[_0x36d9('0x38')](_0x283022['query'][_0x36d9('0x38')]));_0x1e0cd1[_0x36d9('0x37')]=_0x1e0cd1['attributes'][_0x36d9('0x39')]?_0x1e0cd1[_0x36d9('0x37')]:_0x50dbfe[_0x36d9('0x36')];_0x1e0cd1[_0x36d9('0x3c')]=qs[_0x36d9('0x4d')](_0x283022[_0x36d9('0x32')][_0x36d9('0x4d')]);_0x1e0cd1[_0x36d9('0x3d')]=qs[_0x36d9('0x34')](_[_0x36d9('0x3e')](_0x283022[_0x36d9('0x32')],_0x50dbfe[_0x36d9('0x34')]));if(_0x283022[_0x36d9('0x32')][_0x36d9('0x3f')]){_0x1e0cd1[_0x36d9('0x3d')]=_[_0x36d9('0x40')](_0x1e0cd1[_0x36d9('0x3d')],{'$or':_[_0x36d9('0x2c')](_0x1e0cd1[_0x36d9('0x37')],function(_0x573673){var _0x288b83={};_0x288b83[_0x573673]={'$like':'%'+_0x283022[_0x36d9('0x32')][_0x36d9('0x3f')]+'%'};return _0x288b83;})});}_0x1e0cd1=_[_0x36d9('0x40')]({},_0x1e0cd1,_0x283022[_0x36d9('0x41')]);return _0x44a21a[_0x36d9('0x4f')](_0x1e0cd1);}})[_0x36d9('0x27')](function(_0x2ddd11){if(_0x2ddd11){_0x28cd49=_0x2ddd11[_0x36d9('0x39')];if(!_0x283022['query'][_0x36d9('0x3a')](_0x36d9('0x3b'))){_0x1e0cd1['limit']=qs[_0x36d9('0x21')](_0x283022[_0x36d9('0x32')][_0x36d9('0x21')]);_0x1e0cd1[_0x36d9('0x1e')]=qs[_0x36d9('0x1e')](_0x283022[_0x36d9('0x32')][_0x36d9('0x1e')]);}return _0x44a21a['getDescriptions'](_0x1e0cd1);}})['then'](function(_0x4a2db9){if(_0x4a2db9){return _0x4a2db9?{'count':_0x28cd49,'rows':_0x4a2db9}:null;}})['then'](respondWithResult(_0x32f418,null))[_0x36d9('0x45')](handleError(_0x32f418,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index fc0c8ce..14a4d72 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 _0x4df2=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x4df2,0x16d));var _0x24df=function(_0x1e392d,_0x507e78){_0x1e392d=_0x1e392d-0x0;var _0x59c9fc=_0x4df2[_0x1e392d];return _0x59c9fc;};'use strict';var _=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var logger=require(_0x24df('0x2'))(_0x24df('0x3'));var moment=require(_0x24df('0x4'));var BPromise=require(_0x24df('0x5'));var rp=require(_0x24df('0x6'));var fs=require('fs');var path=require(_0x24df('0x7'));var rimraf=require('rimraf');var config=require(_0x24df('0x8'));var attributes=require(_0x24df('0x9'));module['exports']=function(_0x3b25f6,_0x536bca){return _0x3b25f6[_0x24df('0xa')](_0x24df('0xb'),attributes,{'tableName':_0x24df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf086=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api'];(function(_0x55a1b3,_0xea6d6a){var _0x258226=function(_0x329e79){while(--_0x329e79){_0x55a1b3['push'](_0x55a1b3['shift']());}};_0x258226(++_0xea6d6a);}(_0xf086,0x8d));var _0x6f08=function(_0x4a83d7,_0x22bce5){_0x4a83d7=_0x4a83d7-0x0;var _0x5467aa=_0xf086[_0x4a83d7];return _0x5467aa;};'use strict';var _=require('lodash');var util=require(_0x6f08('0x0'));var logger=require(_0x6f08('0x1'))(_0x6f08('0x2'));var moment=require(_0x6f08('0x3'));var BPromise=require(_0x6f08('0x4'));var rp=require(_0x6f08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f08('0x6'));var config=require(_0x6f08('0x7'));var attributes=require(_0x6f08('0x8'));module['exports']=function(_0x587298,_0x4d49c4){return _0x587298[_0x6f08('0x9')](_0x6f08('0xa'),attributes,{'tableName':_0x6f08('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 f3077dc..15ae778 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 _0x7a1c=['../../config/environment','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x398b3d,_0x2f497e){var _0x20b1cf=function(_0x23a3ea){while(--_0x23a3ea){_0x398b3d['push'](_0x398b3d['shift']());}};_0x20b1cf(++_0x2f497e);}(_0x7a1c,0x1f2));var _0xc7a1=function(_0xcccf9c,_0x24bb08){_0xcccf9c=_0xcccf9c-0x0;var _0x205b75=_0x7a1c[_0xcccf9c];return _0x205b75;};'use strict';var _=require(_0xc7a1('0x0'));var util=require(_0xc7a1('0x1'));var moment=require('moment');var BPromise=require(_0xc7a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7a1('0x3'));var db=require(_0xc7a1('0x4'))['db'];var utils=require(_0xc7a1('0x5'));var logger=require(_0xc7a1('0x6'))(_0xc7a1('0x7'));var config=require(_0xc7a1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7a1('0x9')][_0xc7a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c926b,_0x351849,_0x76b3f1){return new BPromise(function(_0x44245c,_0x171d2b){return client[_0xc7a1('0xb')](_0x1c926b,_0x76b3f1)['then'](function(_0xfa43fa){logger[_0xc7a1('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x351849,_0xc7a1('0xd'));logger[_0xc7a1('0xe')](_0xc7a1('0xf'),_0x351849,_0xc7a1('0xd'),JSON[_0xc7a1('0x10')](_0xfa43fa));if(_0xfa43fa[_0xc7a1('0x11')]){if(_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x12')]===0x1f4){logger[_0xc7a1('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x351849,_0xfa43fa['error']['message']);return _0x171d2b(_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x13')]);}logger[_0xc7a1('0x11')](_0xc7a1('0x14'),_0x351849,_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x13')]);return _0x44245c(_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x13')]);}else{logger[_0xc7a1('0xc')](_0xc7a1('0x14'),_0x351849,_0xc7a1('0xd'));_0x44245c(_0xfa43fa[_0xc7a1('0x15')][_0xc7a1('0x13')]);}})[_0xc7a1('0x16')](function(_0x4db244){logger[_0xc7a1('0x11')](_0xc7a1('0x14'),_0x351849,_0x4db244);_0x171d2b(_0x4db244);});});} \ No newline at end of file +var _0x94b6=['then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xbb81d5,_0x52ffe0){var _0x1acacc=function(_0x41f3d5){while(--_0x41f3d5){_0xbb81d5['push'](_0xbb81d5['shift']());}};_0x1acacc(++_0x52ffe0);}(_0x94b6,0xbb));var _0x694b=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x94b6[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0x694b('0x0'));var util=require('util');var moment=require(_0x694b('0x1'));var BPromise=require(_0x694b('0x2'));var rs=require(_0x694b('0x3'));var fs=require('fs');var Redis=require(_0x694b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x694b('0x5'));var logger=require('../../config/logger')(_0x694b('0x6'));var config=require(_0x694b('0x7'));var jayson=require(_0x694b('0x8'));var client=jayson[_0x694b('0x9')][_0x694b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37dcf2,_0x1cb7e8,_0x3d6cf9){return new BPromise(function(_0x5b56a8,_0xc98a98){return client['request'](_0x37dcf2,_0x3d6cf9)[_0x694b('0xb')](function(_0x3b8d4e){logger[_0x694b('0xc')](_0x694b('0xd'),_0x1cb7e8,_0x694b('0xe'));logger[_0x694b('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1cb7e8,_0x694b('0xe'),JSON[_0x694b('0x10')](_0x3b8d4e));if(_0x3b8d4e[_0x694b('0x11')]){if(_0x3b8d4e[_0x694b('0x11')][_0x694b('0x12')]===0x1f4){logger[_0x694b('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x1cb7e8,_0x3b8d4e[_0x694b('0x11')][_0x694b('0x13')]);return _0xc98a98(_0x3b8d4e[_0x694b('0x11')][_0x694b('0x13')]);}logger[_0x694b('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x1cb7e8,_0x3b8d4e[_0x694b('0x11')]['message']);return _0x5b56a8(_0x3b8d4e[_0x694b('0x11')][_0x694b('0x13')]);}else{logger[_0x694b('0xc')](_0x694b('0xd'),_0x1cb7e8,_0x694b('0xe'));_0x5b56a8(_0x3b8d4e[_0x694b('0x14')]['message']);}})[_0x694b('0x15')](function(_0x11557f){logger[_0x694b('0x11')](_0x694b('0xd'),_0x1cb7e8,_0x11557f);_0xc98a98(_0x11557f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 18686a0..72409f9 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 _0x87a7=['../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x47761d,_0x3f8494){var _0x3d1c05=function(_0x3571da){while(--_0x3571da){_0x47761d['push'](_0x47761d['shift']());}};_0x3d1c05(++_0x3f8494);}(_0x87a7,0x1b5));var _0x787a=function(_0x3b3931,_0x2aa0c1){_0x3b3931=_0x3b3931-0x0;var _0x9747e0=_0x87a7[_0x3b3931];return _0x9747e0;};'use strict';var multer=require(_0x787a('0x0'));var util=require('util');var path=require(_0x787a('0x1'));var timeout=require('connect-timeout');var express=require(_0x787a('0x2'));var router=express['Router']();var fs_extra=require(_0x787a('0x3'));var auth=require(_0x787a('0x4'));var interaction=require(_0x787a('0x5'));var config=require(_0x787a('0x6'));var controller=require(_0x787a('0x7'));router[_0x787a('0x8')]('/',auth[_0x787a('0x9')](),controller[_0x787a('0xa')]);router[_0x787a('0x8')](_0x787a('0xb'),auth[_0x787a('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x787a('0xc')]);router[_0x787a('0xd')]('/:id',auth[_0x787a('0x9')](),controller[_0x787a('0xe')]);router[_0x787a('0xf')](_0x787a('0xb'),auth[_0x787a('0x9')](),controller['destroy']);module[_0x787a('0x10')]=router; \ No newline at end of file +var _0x22f2=['../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd07a7c,_0x336f87){var _0x397c71=function(_0x518a48){while(--_0x518a48){_0xd07a7c['push'](_0xd07a7c['shift']());}};_0x397c71(++_0x336f87);}(_0x22f2,0x1ec));var _0x222f=function(_0x3fa479,_0x222259){_0x3fa479=_0x3fa479-0x0;var _0x23feb5=_0x22f2[_0x3fa479];return _0x23feb5;};'use strict';var multer=require(_0x222f('0x0'));var util=require(_0x222f('0x1'));var path=require(_0x222f('0x2'));var timeout=require(_0x222f('0x3'));var express=require(_0x222f('0x4'));var router=express[_0x222f('0x5')]();var fs_extra=require(_0x222f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x222f('0x7'));var config=require(_0x222f('0x8'));var controller=require(_0x222f('0x9'));router['get']('/',auth[_0x222f('0xa')](),controller[_0x222f('0xb')]);router[_0x222f('0xc')](_0x222f('0xd'),auth[_0x222f('0xa')](),controller[_0x222f('0xe')]);router['post']('/',auth[_0x222f('0xa')](),controller[_0x222f('0xf')]);router[_0x222f('0x10')]('/:id',auth[_0x222f('0xa')](),controller['update']);router[_0x222f('0x11')](_0x222f('0xd'),auth[_0x222f('0xa')](),controller[_0x222f('0x12')]);module[_0x222f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4f4a45e..eb3bfcf 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 _0xb1bb=['sequelize','exports','customVariable','keyValue','string','STRING','ENUM','BOOLEAN'];(function(_0x500dc0,_0x58b0d6){var _0x5ec0aa=function(_0x17ecfc){while(--_0x17ecfc){_0x500dc0['push'](_0x500dc0['shift']());}};_0x5ec0aa(++_0x58b0d6);}(_0xb1bb,0xe8));var _0xbb1b=function(_0x3fa29a,_0x218173){_0x3fa29a=_0x3fa29a-0x0;var _0x4486d8=_0xb1bb[_0x3fa29a];return _0x4486d8;};'use strict';var Sequelize=require(_0xbb1b('0x0'));module[_0xbb1b('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xbb1b('0x2'),_0xbb1b('0x3'),'picklist'),'defaultValue':_0xbb1b('0x4')},'content':{'type':Sequelize[_0xbb1b('0x5')]},'key':{'type':Sequelize[_0xbb1b('0x5')]},'keyType':{'type':Sequelize[_0xbb1b('0x6')](_0xbb1b('0x4'),'variable',_0xbb1b('0x2'))},'keyContent':{'type':Sequelize[_0xbb1b('0x5')]},'idField':{'type':Sequelize[_0xbb1b('0x5')]},'nameField':{'type':Sequelize[_0xbb1b('0x5')]},'customField':{'type':Sequelize[_0xbb1b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb1b('0x5')]}}; \ No newline at end of file +var _0x5795=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN'];(function(_0x24065b,_0x1775ba){var _0x88b0b7=function(_0x1143fc){while(--_0x1143fc){_0x24065b['push'](_0x24065b['shift']());}};_0x88b0b7(++_0x1775ba);}(_0x5795,0x168));var _0x5579=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x5795[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0x5579('0x0'));module[_0x5579('0x1')]={'type':{'type':Sequelize[_0x5579('0x2')]('string',_0x5579('0x3'),_0x5579('0x4'),_0x5579('0x5'),_0x5579('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5579('0x7')]},'key':{'type':Sequelize[_0x5579('0x7')]},'keyType':{'type':Sequelize[_0x5579('0x2')](_0x5579('0x8'),'variable',_0x5579('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5579('0x7')]},'nameField':{'type':Sequelize[_0x5579('0x7')]},'customField':{'type':Sequelize[_0x5579('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5579('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0654dbb..d8f2787 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 _0xf379=['lodash','crypto','querystring','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','apply','save','then','sendStatus','error','stack','name','send','index','VtigerField','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','catch','create','update','body','find','destroy','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs'];(function(_0x1b6cf9,_0x4147a8){var _0x15d75b=function(_0x1f8fe8){while(--_0x1f8fe8){_0x1b6cf9['push'](_0x1b6cf9['shift']());}};_0x15d75b(++_0x4147a8);}(_0xf379,0x15f));var _0x9f37=function(_0x59c360,_0x59ee43){_0x59c360=_0x59c360-0x0;var _0x32cf82=_0xf379[_0x59c360];return _0x32cf82;};'use strict';var emlformat=require(_0x9f37('0x0'));var rimraf=require(_0x9f37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f37('0x2'));var moment=require('moment');var BPromise=require(_0x9f37('0x3'));var Mustache=require('mustache');var util=require(_0x9f37('0x4'));var path=require(_0x9f37('0x5'));var sox=require(_0x9f37('0x6'));var csv=require(_0x9f37('0x7'));var ejs=require(_0x9f37('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f37('0x9'));var squel=require('squel');var crypto=require(_0x9f37('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f37('0x7'));var querystring=require(_0x9f37('0xb'));var Papa=require(_0x9f37('0xc'));var Redis=require(_0x9f37('0xd'));var authService=require(_0x9f37('0xe'));var qs=require(_0x9f37('0xf'));var as=require(_0x9f37('0x10'));var hardwareService=require(_0x9f37('0x11'));var logger=require(_0x9f37('0x12'))(_0x9f37('0x13'));var utils=require(_0x9f37('0x14'));var config=require(_0x9f37('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f37('0x16'))['db'];function respondWithStatusCode(_0x4d7cb3,_0x23ad43){_0x23ad43=_0x23ad43||0xcc;return function(_0x5acd4c){if(_0x5acd4c){return _0x4d7cb3['sendStatus'](_0x23ad43);}return _0x4d7cb3[_0x9f37('0x17')](_0x23ad43)[_0x9f37('0x18')]();};}function respondWithResult(_0x32cc3c,_0x248f00){_0x248f00=_0x248f00||0xc8;return function(_0x5b1ed6){if(_0x5b1ed6){return _0x32cc3c[_0x9f37('0x17')](_0x248f00)['json'](_0x5b1ed6);}};}function respondWithFilteredResult(_0xbe038e,_0x33dfda){return function(_0x2fe3c0){if(_0x2fe3c0){var _0x1049d8=typeof _0x33dfda[_0x9f37('0x19')]===_0x9f37('0x1a')&&typeof _0x33dfda[_0x9f37('0x1b')]===_0x9f37('0x1a');var _0x2748e0=_0x2fe3c0[_0x9f37('0x1c')];var _0x3a095a=_0x1049d8?0x0:_0x33dfda[_0x9f37('0x19')];var _0x193532=_0x1049d8?_0x2fe3c0[_0x9f37('0x1c')]:_0x33dfda[_0x9f37('0x19')]+_0x33dfda[_0x9f37('0x1b')];var _0x59f9d6;if(_0x193532>=_0x2748e0){_0x193532=_0x2748e0;_0x59f9d6=0xc8;}else{_0x59f9d6=0xce;}_0xbe038e['status'](_0x59f9d6);return _0xbe038e[_0x9f37('0x1d')](_0x9f37('0x1e'),_0x3a095a+'-'+_0x193532+'/'+_0x2748e0)[_0x9f37('0x1f')](_0x2fe3c0);}return null;};}function patchUpdates(_0x5035cd){return function(_0x2f641a){try{jsonpatch[_0x9f37('0x20')](_0x2f641a,_0x5035cd,!![]);}catch(_0x45cc47){return BPromise['reject'](_0x45cc47);}return _0x2f641a[_0x9f37('0x21')]();};}function saveUpdates(_0x8d1018,_0xdeee78){return function(_0x3a3c34){if(_0x3a3c34){return _0x3a3c34['update'](_0x8d1018)[_0x9f37('0x22')](function(_0x25bb1e){return _0x25bb1e;});}return null;};}function removeEntity(_0x48d5b9,_0x2da328){return function(_0x160383){if(_0x160383){return _0x160383['destroy']()['then'](function(){_0x48d5b9[_0x9f37('0x17')](0xcc)[_0x9f37('0x18')]();});}};}function handleEntityNotFound(_0x25478c,_0x216873){return function(_0x5115c8){if(!_0x5115c8){_0x25478c[_0x9f37('0x23')](0x194);}return _0x5115c8;};}function handleError(_0xeb2de6,_0x2ac20e){_0x2ac20e=_0x2ac20e||0x1f4;return function(_0x5c5ff5){logger[_0x9f37('0x24')](_0x5c5ff5[_0x9f37('0x25')]);if(_0x5c5ff5['name']){delete _0x5c5ff5[_0x9f37('0x26')];}_0xeb2de6['status'](_0x2ac20e)[_0x9f37('0x27')](_0x5c5ff5);};}exports[_0x9f37('0x28')]=function(_0x4768dd,_0x1e09fc){var _0x560c4b={},_0x12b9e8={},_0x2f3d46={'count':0x0,'rows':[]};var _0xc8e55f=_['map'](db[_0x9f37('0x29')]['rawAttributes'],function(_0xa96806){return{'name':_0xa96806['fieldName'],'type':_0xa96806['type'][_0x9f37('0x2a')]};});_0x12b9e8[_0x9f37('0x2b')]=_[_0x9f37('0x2c')](_0xc8e55f,_0x9f37('0x26'));_0x12b9e8[_0x9f37('0x2d')]=_['keys'](_0x4768dd[_0x9f37('0x2d')]);_0x12b9e8[_0x9f37('0x2e')]=_['intersection'](_0x12b9e8[_0x9f37('0x2b')],_0x12b9e8[_0x9f37('0x2d')]);_0x560c4b[_0x9f37('0x2f')]=_[_0x9f37('0x30')](_0x12b9e8[_0x9f37('0x2b')],qs[_0x9f37('0x31')](_0x4768dd[_0x9f37('0x2d')]['fields']));_0x560c4b['attributes']=_0x560c4b[_0x9f37('0x2f')][_0x9f37('0x32')]?_0x560c4b[_0x9f37('0x2f')]:_0x12b9e8[_0x9f37('0x2b')];if(!_0x4768dd[_0x9f37('0x2d')][_0x9f37('0x33')]('nolimit')){_0x560c4b[_0x9f37('0x1b')]=qs[_0x9f37('0x1b')](_0x4768dd[_0x9f37('0x2d')]['limit']);_0x560c4b[_0x9f37('0x19')]=qs[_0x9f37('0x19')](_0x4768dd[_0x9f37('0x2d')][_0x9f37('0x19')]);}_0x560c4b['order']=qs[_0x9f37('0x34')](_0x4768dd['query'][_0x9f37('0x34')]);_0x560c4b[_0x9f37('0x35')]=qs[_0x9f37('0x2e')](_[_0x9f37('0x36')](_0x4768dd['query'],_0x12b9e8[_0x9f37('0x2e')]),_0xc8e55f);if(_0x4768dd[_0x9f37('0x2d')]['filter']){_0x560c4b[_0x9f37('0x35')]=_[_0x9f37('0x37')](_0x560c4b[_0x9f37('0x35')],{'$or':_[_0x9f37('0x2c')](_0xc8e55f,function(_0x542bc6){if(_0x542bc6['type']!==_0x9f37('0x38')){var _0x3c5450={};_0x3c5450[_0x542bc6['name']]={'$like':'%'+_0x4768dd['query'][_0x9f37('0x39')]+'%'};return _0x3c5450;}})});}_0x560c4b=_[_0x9f37('0x37')]({},_0x560c4b,_0x4768dd[_0x9f37('0x3a')]);var _0x2e19f6={'where':_0x560c4b[_0x9f37('0x35')]};return db[_0x9f37('0x29')][_0x9f37('0x1c')](_0x2e19f6)['then'](function(_0x4e16d4){_0x2f3d46[_0x9f37('0x1c')]=_0x4e16d4;if(_0x4768dd['query'][_0x9f37('0x3b')]){_0x560c4b['include']=[{'all':!![]}];}return db[_0x9f37('0x29')][_0x9f37('0x3c')](_0x560c4b);})[_0x9f37('0x22')](function(_0x1d1c8c){_0x2f3d46[_0x9f37('0x3d')]=_0x1d1c8c;return _0x2f3d46;})[_0x9f37('0x22')](respondWithFilteredResult(_0x1e09fc,_0x560c4b))['catch'](handleError(_0x1e09fc,null));};exports[_0x9f37('0x3e')]=function(_0x37def9,_0xd4f82a){var _0x2f769a={'raw':!![],'where':{'id':_0x37def9[_0x9f37('0x3f')]['id']}},_0x249d5b={};_0x249d5b['model']=_[_0x9f37('0x40')](db[_0x9f37('0x29')]['rawAttributes']);_0x249d5b['query']=_[_0x9f37('0x40')](_0x37def9[_0x9f37('0x2d')]);_0x249d5b[_0x9f37('0x2e')]=_['intersection'](_0x249d5b[_0x9f37('0x2b')],_0x249d5b[_0x9f37('0x2d')]);_0x2f769a['attributes']=_[_0x9f37('0x30')](_0x249d5b[_0x9f37('0x2b')],qs[_0x9f37('0x31')](_0x37def9[_0x9f37('0x2d')]['fields']));_0x2f769a[_0x9f37('0x2f')]=_0x2f769a['attributes'][_0x9f37('0x32')]?_0x2f769a['attributes']:_0x249d5b[_0x9f37('0x2b')];if(_0x37def9[_0x9f37('0x2d')][_0x9f37('0x3b')]){_0x2f769a[_0x9f37('0x41')]=[{'all':!![]}];}_0x2f769a=_['merge']({},_0x2f769a,_0x37def9[_0x9f37('0x3a')]);return db[_0x9f37('0x29')]['find'](_0x2f769a)[_0x9f37('0x22')](handleEntityNotFound(_0xd4f82a,null))[_0x9f37('0x22')](respondWithResult(_0xd4f82a,null))[_0x9f37('0x42')](handleError(_0xd4f82a,null));};exports[_0x9f37('0x43')]=function(_0x101908,_0x3034b8){return db[_0x9f37('0x29')][_0x9f37('0x43')](_0x101908['body'],{})[_0x9f37('0x22')](respondWithResult(_0x3034b8,0xc9))[_0x9f37('0x42')](handleError(_0x3034b8,null));};exports[_0x9f37('0x44')]=function(_0x9cb4b4,_0x43e0ac){if(_0x9cb4b4[_0x9f37('0x45')]['id']){delete _0x9cb4b4[_0x9f37('0x45')]['id'];}return db[_0x9f37('0x29')][_0x9f37('0x46')]({'where':{'id':_0x9cb4b4[_0x9f37('0x3f')]['id']}})[_0x9f37('0x22')](handleEntityNotFound(_0x43e0ac,null))[_0x9f37('0x22')](saveUpdates(_0x9cb4b4[_0x9f37('0x45')],null))[_0x9f37('0x22')](respondWithResult(_0x43e0ac,null))[_0x9f37('0x42')](handleError(_0x43e0ac,null));};exports[_0x9f37('0x47')]=function(_0xad536e,_0x2eaa6f){return db[_0x9f37('0x29')][_0x9f37('0x46')]({'where':{'id':_0xad536e['params']['id']}})[_0x9f37('0x22')](handleEntityNotFound(_0x2eaa6f,null))['then'](removeEntity(_0x2eaa6f,null))[_0x9f37('0x42')](handleError(_0x2eaa6f,null));}; \ No newline at end of file +var _0xf6f3=['includeAll','merge','find','create','body','eml-format','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','include','findAll','catch','show','params'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0xf6f3,0x1bb));var _0x3f6f=function(_0xf679a9,_0x2d6a13){_0xf679a9=_0xf679a9-0x0;var _0x9910cd=_0xf6f3[_0xf679a9];return _0x9910cd;};'use strict';var emlformat=require(_0x3f6f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f6f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f6f('0x2'));var Mustache=require('mustache');var util=require(_0x3f6f('0x3'));var path=require(_0x3f6f('0x4'));var sox=require(_0x3f6f('0x5'));var csv=require(_0x3f6f('0x6'));var ejs=require(_0x3f6f('0x7'));var fs=require('fs');var fs_extra=require(_0x3f6f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f6f('0x9'));var jsforce=require(_0x3f6f('0xa'));var deskjs=require(_0x3f6f('0xb'));var toCsv=require(_0x3f6f('0x6'));var querystring=require(_0x3f6f('0xc'));var Papa=require(_0x3f6f('0xd'));var Redis=require(_0x3f6f('0xe'));var authService=require(_0x3f6f('0xf'));var qs=require(_0x3f6f('0x10'));var as=require(_0x3f6f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f6f('0x12'));var utils=require('../../config/utils');var config=require(_0x3f6f('0x13'));var licenseUtil=require(_0x3f6f('0x14'));var db=require(_0x3f6f('0x15'))['db'];function respondWithStatusCode(_0x4f68d0,_0x3a4ac9){_0x3a4ac9=_0x3a4ac9||0xcc;return function(_0x5f4591){if(_0x5f4591){return _0x4f68d0[_0x3f6f('0x16')](_0x3a4ac9);}return _0x4f68d0['status'](_0x3a4ac9)[_0x3f6f('0x17')]();};}function respondWithResult(_0xddd29e,_0x1a3d8a){_0x1a3d8a=_0x1a3d8a||0xc8;return function(_0x5b42bc){if(_0x5b42bc){return _0xddd29e['status'](_0x1a3d8a)[_0x3f6f('0x18')](_0x5b42bc);}};}function respondWithFilteredResult(_0x757cbc,_0x198034){return function(_0x2ae839){if(_0x2ae839){var _0x1b7a0b=typeof _0x198034['offset']===_0x3f6f('0x19')&&typeof _0x198034[_0x3f6f('0x1a')]===_0x3f6f('0x19');var _0x371b6d=_0x2ae839[_0x3f6f('0x1b')];var _0x1b7f10=_0x1b7a0b?0x0:_0x198034['offset'];var _0x554e45=_0x1b7a0b?_0x2ae839['count']:_0x198034[_0x3f6f('0x1c')]+_0x198034[_0x3f6f('0x1a')];var _0x3f4672;if(_0x554e45>=_0x371b6d){_0x554e45=_0x371b6d;_0x3f4672=0xc8;}else{_0x3f4672=0xce;}_0x757cbc[_0x3f6f('0x1d')](_0x3f4672);return _0x757cbc['set'](_0x3f6f('0x1e'),_0x1b7f10+'-'+_0x554e45+'/'+_0x371b6d)[_0x3f6f('0x18')](_0x2ae839);}return null;};}function patchUpdates(_0x2500aa){return function(_0x287d40){try{jsonpatch[_0x3f6f('0x1f')](_0x287d40,_0x2500aa,!![]);}catch(_0x3ddfcd){return BPromise[_0x3f6f('0x20')](_0x3ddfcd);}return _0x287d40['save']();};}function saveUpdates(_0x30c0fd,_0x35e267){return function(_0x3a5b6c){if(_0x3a5b6c){return _0x3a5b6c[_0x3f6f('0x21')](_0x30c0fd)[_0x3f6f('0x22')](function(_0xba1252){return _0xba1252;});}return null;};}function removeEntity(_0x28c766,_0x62682){return function(_0x5ace13){if(_0x5ace13){return _0x5ace13[_0x3f6f('0x23')]()[_0x3f6f('0x22')](function(){_0x28c766[_0x3f6f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bec61,_0x55b68e){return function(_0x500da6){if(!_0x500da6){_0x4bec61[_0x3f6f('0x16')](0x194);}return _0x500da6;};}function handleError(_0x5afaa8,_0x41c11d){_0x41c11d=_0x41c11d||0x1f4;return function(_0x31429f){logger[_0x3f6f('0x24')](_0x31429f[_0x3f6f('0x25')]);if(_0x31429f[_0x3f6f('0x26')]){delete _0x31429f[_0x3f6f('0x26')];}_0x5afaa8[_0x3f6f('0x1d')](_0x41c11d)[_0x3f6f('0x27')](_0x31429f);};}exports[_0x3f6f('0x28')]=function(_0x5db9ed,_0x11a06a){var _0x17b6ef={},_0x4fdf6c={},_0x593639={'count':0x0,'rows':[]};var _0xebfe0=_[_0x3f6f('0x29')](db[_0x3f6f('0x2a')][_0x3f6f('0x2b')],function(_0x4529dc){return{'name':_0x4529dc[_0x3f6f('0x2c')],'type':_0x4529dc[_0x3f6f('0x2d')][_0x3f6f('0x2e')]};});_0x4fdf6c['model']=_[_0x3f6f('0x29')](_0xebfe0,'name');_0x4fdf6c[_0x3f6f('0x2f')]=_[_0x3f6f('0x30')](_0x5db9ed[_0x3f6f('0x2f')]);_0x4fdf6c[_0x3f6f('0x31')]=_['intersection'](_0x4fdf6c[_0x3f6f('0x32')],_0x4fdf6c[_0x3f6f('0x2f')]);_0x17b6ef[_0x3f6f('0x33')]=_[_0x3f6f('0x34')](_0x4fdf6c[_0x3f6f('0x32')],qs[_0x3f6f('0x35')](_0x5db9ed[_0x3f6f('0x2f')][_0x3f6f('0x35')]));_0x17b6ef['attributes']=_0x17b6ef['attributes'][_0x3f6f('0x36')]?_0x17b6ef[_0x3f6f('0x33')]:_0x4fdf6c[_0x3f6f('0x32')];if(!_0x5db9ed[_0x3f6f('0x2f')][_0x3f6f('0x37')](_0x3f6f('0x38'))){_0x17b6ef['limit']=qs[_0x3f6f('0x1a')](_0x5db9ed['query'][_0x3f6f('0x1a')]);_0x17b6ef[_0x3f6f('0x1c')]=qs['offset'](_0x5db9ed[_0x3f6f('0x2f')][_0x3f6f('0x1c')]);}_0x17b6ef['order']=qs[_0x3f6f('0x39')](_0x5db9ed[_0x3f6f('0x2f')][_0x3f6f('0x39')]);_0x17b6ef['where']=qs['filters'](_[_0x3f6f('0x3a')](_0x5db9ed[_0x3f6f('0x2f')],_0x4fdf6c['filters']),_0xebfe0);if(_0x5db9ed[_0x3f6f('0x2f')][_0x3f6f('0x3b')]){_0x17b6ef[_0x3f6f('0x3c')]=_['merge'](_0x17b6ef['where'],{'$or':_[_0x3f6f('0x29')](_0xebfe0,function(_0x46618c){if(_0x46618c['type']!==_0x3f6f('0x3d')){var _0x3c4e0e={};_0x3c4e0e[_0x46618c['name']]={'$like':'%'+_0x5db9ed[_0x3f6f('0x2f')][_0x3f6f('0x3b')]+'%'};return _0x3c4e0e;}})});}_0x17b6ef=_['merge']({},_0x17b6ef,_0x5db9ed[_0x3f6f('0x3e')]);var _0x2ea58f={'where':_0x17b6ef[_0x3f6f('0x3c')]};return db[_0x3f6f('0x2a')][_0x3f6f('0x1b')](_0x2ea58f)['then'](function(_0x9ae25b){_0x593639[_0x3f6f('0x1b')]=_0x9ae25b;if(_0x5db9ed[_0x3f6f('0x2f')]['includeAll']){_0x17b6ef[_0x3f6f('0x3f')]=[{'all':!![]}];}return db[_0x3f6f('0x2a')][_0x3f6f('0x40')](_0x17b6ef);})[_0x3f6f('0x22')](function(_0x5cfb7c){_0x593639['rows']=_0x5cfb7c;return _0x593639;})[_0x3f6f('0x22')](respondWithFilteredResult(_0x11a06a,_0x17b6ef))[_0x3f6f('0x41')](handleError(_0x11a06a,null));};exports[_0x3f6f('0x42')]=function(_0xf5f4a6,_0x35bd6f){var _0x3bfe22={'raw':!![],'where':{'id':_0xf5f4a6[_0x3f6f('0x43')]['id']}},_0x5036e0={};_0x5036e0[_0x3f6f('0x32')]=_[_0x3f6f('0x30')](db[_0x3f6f('0x2a')][_0x3f6f('0x2b')]);_0x5036e0[_0x3f6f('0x2f')]=_[_0x3f6f('0x30')](_0xf5f4a6['query']);_0x5036e0[_0x3f6f('0x31')]=_[_0x3f6f('0x34')](_0x5036e0[_0x3f6f('0x32')],_0x5036e0['query']);_0x3bfe22[_0x3f6f('0x33')]=_[_0x3f6f('0x34')](_0x5036e0[_0x3f6f('0x32')],qs[_0x3f6f('0x35')](_0xf5f4a6['query']['fields']));_0x3bfe22['attributes']=_0x3bfe22[_0x3f6f('0x33')]['length']?_0x3bfe22[_0x3f6f('0x33')]:_0x5036e0[_0x3f6f('0x32')];if(_0xf5f4a6['query'][_0x3f6f('0x44')]){_0x3bfe22['include']=[{'all':!![]}];}_0x3bfe22=_[_0x3f6f('0x45')]({},_0x3bfe22,_0xf5f4a6[_0x3f6f('0x3e')]);return db[_0x3f6f('0x2a')][_0x3f6f('0x46')](_0x3bfe22)[_0x3f6f('0x22')](handleEntityNotFound(_0x35bd6f,null))['then'](respondWithResult(_0x35bd6f,null))[_0x3f6f('0x41')](handleError(_0x35bd6f,null));};exports[_0x3f6f('0x47')]=function(_0x4b6e23,_0x401a4e){return db[_0x3f6f('0x2a')][_0x3f6f('0x47')](_0x4b6e23[_0x3f6f('0x48')],{})[_0x3f6f('0x22')](respondWithResult(_0x401a4e,0xc9))['catch'](handleError(_0x401a4e,null));};exports[_0x3f6f('0x21')]=function(_0x210e7e,_0x1d9f2f){if(_0x210e7e[_0x3f6f('0x48')]['id']){delete _0x210e7e[_0x3f6f('0x48')]['id'];}return db[_0x3f6f('0x2a')]['find']({'where':{'id':_0x210e7e[_0x3f6f('0x43')]['id']}})[_0x3f6f('0x22')](handleEntityNotFound(_0x1d9f2f,null))[_0x3f6f('0x22')](saveUpdates(_0x210e7e['body'],null))['then'](respondWithResult(_0x1d9f2f,null))[_0x3f6f('0x41')](handleError(_0x1d9f2f,null));};exports[_0x3f6f('0x23')]=function(_0x35c1af,_0x3d4bdf){return db['VtigerField'][_0x3f6f('0x46')]({'where':{'id':_0x35c1af[_0x3f6f('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d4bdf,null))[_0x3f6f('0x22')](removeEntity(_0x3d4bdf,null))[_0x3f6f('0x41')](handleError(_0x3d4bdf,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e5c1bf1..aa96a93 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 _0x325a=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x325a,0xff));var _0xa325=function(_0x3cc1bf,_0xed7947){_0x3cc1bf=_0x3cc1bf-0x0;var _0x2f4b69=_0x325a[_0x3cc1bf];return _0x2f4b69;};'use strict';var _=require('lodash');var util=require(_0xa325('0x0'));var logger=require(_0xa325('0x1'))(_0xa325('0x2'));var moment=require('moment');var BPromise=require(_0xa325('0x3'));var rp=require(_0xa325('0x4'));var fs=require('fs');var path=require(_0xa325('0x5'));var rimraf=require(_0xa325('0x6'));var config=require(_0xa325('0x7'));var attributes=require(_0xa325('0x8'));module[_0xa325('0x9')]=function(_0x1a51ac,_0x273699){return _0x1a51ac[_0xa325('0xa')](_0xa325('0xb'),attributes,{'tableName':_0xa325('0xc'),'paranoid':![],'indexes':[{'name':_0xa325('0xd'),'fields':[_0xa325('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeae0=['request-promise','path','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','moment','bluebird'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xeae0,0x172));var _0x0eae=function(_0x2d4a54,_0x1f759f){_0x2d4a54=_0x2d4a54-0x0;var _0x489a0f=_0xeae0[_0x2d4a54];return _0x489a0f;};'use strict';var _=require(_0x0eae('0x0'));var util=require(_0x0eae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0eae('0x2'));var BPromise=require(_0x0eae('0x3'));var rp=require(_0x0eae('0x4'));var fs=require('fs');var path=require(_0x0eae('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x1ef791,_0xf90c1f){return _0x1ef791['define'](_0x0eae('0x6'),attributes,{'tableName':_0x0eae('0x7'),'paranoid':![],'indexes':[{'name':_0x0eae('0x8'),'fields':[_0x0eae('0x9'),_0x0eae('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index bfc6389..38acaee 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 _0x28c8=['rpc','jayson/promise','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x83487c,_0x1104d8){var _0x25ce18=function(_0x5814dd){while(--_0x5814dd){_0x83487c['push'](_0x83487c['shift']());}};_0x25ce18(++_0x1104d8);}(_0x28c8,0x176));var _0x828c=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x28c8[_0x503ffd];return _0x160437;};'use strict';var _=require(_0x828c('0x0'));var util=require(_0x828c('0x1'));var moment=require(_0x828c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x828c('0x3'));var db=require(_0x828c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x828c('0x5'))(_0x828c('0x6'));var config=require('../../config/environment');var jayson=require(_0x828c('0x7'));var client=jayson['client'][_0x828c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x190d39,_0x371d22,_0x3f78f6){return new BPromise(function(_0x1ee799,_0x300b71){return client[_0x828c('0x9')](_0x190d39,_0x3f78f6)['then'](function(_0x4230ae){logger['info'](_0x828c('0xa'),_0x371d22,_0x828c('0xb'));logger[_0x828c('0xc')](_0x828c('0xd'),_0x371d22,_0x828c('0xb'),JSON[_0x828c('0xe')](_0x4230ae));if(_0x4230ae[_0x828c('0xf')]){if(_0x4230ae['error']['code']===0x1f4){logger[_0x828c('0xf')]('VtigerField,\x20%s,\x20%s',_0x371d22,_0x4230ae[_0x828c('0xf')][_0x828c('0x10')]);return _0x300b71(_0x4230ae['error'][_0x828c('0x10')]);}logger['error'](_0x828c('0xa'),_0x371d22,_0x4230ae['error']['message']);return _0x1ee799(_0x4230ae[_0x828c('0xf')][_0x828c('0x10')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x371d22,_0x828c('0xb'));_0x1ee799(_0x4230ae[_0x828c('0x11')][_0x828c('0x10')]);}})[_0x828c('0x12')](function(_0x5bf891){logger[_0x828c('0xf')](_0x828c('0xa'),_0x371d22,_0x5bf891);_0x300b71(_0x5bf891);});});} \ No newline at end of file +var _0x3d22=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1a4988,_0x64e8b8){var _0x1e3901=function(_0x1455a7){while(--_0x1455a7){_0x1a4988['push'](_0x1a4988['shift']());}};_0x1e3901(++_0x64e8b8);}(_0x3d22,0xa3));var _0x23d2=function(_0x15fabf,_0x3f9152){_0x15fabf=_0x15fabf-0x0;var _0x49eab2=_0x3d22[_0x15fabf];return _0x49eab2;};'use strict';var _=require(_0x23d2('0x0'));var util=require(_0x23d2('0x1'));var moment=require(_0x23d2('0x2'));var BPromise=require(_0x23d2('0x3'));var rs=require(_0x23d2('0x4'));var fs=require('fs');var Redis=require(_0x23d2('0x5'));var db=require(_0x23d2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23d2('0x7'));var config=require(_0x23d2('0x8'));var jayson=require(_0x23d2('0x9'));var client=jayson[_0x23d2('0xa')][_0x23d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x709b3e,_0x78abb0,_0x4e7a7d){return new BPromise(function(_0x27723b,_0x3394fd){return client[_0x23d2('0xc')](_0x709b3e,_0x4e7a7d)['then'](function(_0xc226ee){logger[_0x23d2('0xd')](_0x23d2('0xe'),_0x78abb0,'request\x20sent');logger['debug'](_0x23d2('0xf'),_0x78abb0,_0x23d2('0x10'),JSON[_0x23d2('0x11')](_0xc226ee));if(_0xc226ee[_0x23d2('0x12')]){if(_0xc226ee[_0x23d2('0x12')]['code']===0x1f4){logger[_0x23d2('0x12')]('VtigerField,\x20%s,\x20%s',_0x78abb0,_0xc226ee[_0x23d2('0x12')][_0x23d2('0x13')]);return _0x3394fd(_0xc226ee[_0x23d2('0x12')]['message']);}logger[_0x23d2('0x12')](_0x23d2('0xe'),_0x78abb0,_0xc226ee[_0x23d2('0x12')][_0x23d2('0x13')]);return _0x27723b(_0xc226ee['error'][_0x23d2('0x13')]);}else{logger[_0x23d2('0xd')](_0x23d2('0xe'),_0x78abb0,'request\x20sent');_0x27723b(_0xc226ee[_0x23d2('0x14')][_0x23d2('0x13')]);}})['catch'](function(_0x1c6857){logger[_0x23d2('0x12')]('VtigerField,\x20%s,\x20%s',_0x78abb0,_0x1c6857);_0x3394fd(_0x1c6857);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3b0d0ab..8617b7f 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 _0x3aab=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','update','delete','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x2c658a,_0x18d39e){var _0x26806e=function(_0x1943f7){while(--_0x1943f7){_0x2c658a['push'](_0x2c658a['shift']());}};_0x26806e(++_0x18d39e);}(_0x3aab,0x64));var _0xb3aa=function(_0x34a7d4,_0x351e9d){_0x34a7d4=_0x34a7d4-0x0;var _0x24395c=_0x3aab[_0x34a7d4];return _0x24395c;};'use strict';var multer=require(_0xb3aa('0x0'));var util=require(_0xb3aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb3aa('0x2'));var router=express['Router']();var fs_extra=require(_0xb3aa('0x3'));var auth=require(_0xb3aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3aa('0x5'));var controller=require('./intZendeskAccount.controller');router[_0xb3aa('0x6')]('/',auth['isAuthenticated'](),controller[_0xb3aa('0x7')]);router[_0xb3aa('0x6')](_0xb3aa('0x8'),auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xa')]);router[_0xb3aa('0x6')](_0xb3aa('0xb'),auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xc')]);router['get'](_0xb3aa('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb3aa('0xe')]('/',auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xf')]);router[_0xb3aa('0xe')]('/:id/configurations',auth[_0xb3aa('0x9')](),controller['addConfiguration']);router['put'](_0xb3aa('0x8'),auth[_0xb3aa('0x9')](),controller[_0xb3aa('0x10')]);router[_0xb3aa('0x11')](_0xb3aa('0x8'),auth[_0xb3aa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b02=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0x4d2b3f,_0x408d7e){var _0x47bef1=function(_0x42dc60){while(--_0x42dc60){_0x4d2b3f['push'](_0x4d2b3f['shift']());}};_0x47bef1(++_0x408d7e);}(_0x6b02,0x1d0));var _0x26b0=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x6b02[_0x3b1e3f];return _0x3b1cd3;};'use strict';var multer=require('multer');var util=require(_0x26b0('0x0'));var path=require(_0x26b0('0x1'));var timeout=require(_0x26b0('0x2'));var express=require(_0x26b0('0x3'));var router=express['Router']();var fs_extra=require(_0x26b0('0x4'));var auth=require(_0x26b0('0x5'));var interaction=require(_0x26b0('0x6'));var config=require(_0x26b0('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x26b0('0x8')]('/',auth[_0x26b0('0x9')](),controller[_0x26b0('0xa')]);router[_0x26b0('0x8')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller['show']);router['get'](_0x26b0('0xc'),auth['isAuthenticated'](),controller[_0x26b0('0xd')]);router[_0x26b0('0x8')](_0x26b0('0xe'),auth[_0x26b0('0x9')](),controller[_0x26b0('0xf')]);router[_0x26b0('0x10')]('/',auth['isAuthenticated'](),controller[_0x26b0('0x11')]);router[_0x26b0('0x10')](_0x26b0('0xc'),auth[_0x26b0('0x9')](),controller['addConfiguration']);router[_0x26b0('0x12')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller[_0x26b0('0x13')]);router[_0x26b0('0x14')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller[_0x26b0('0x15')]);module[_0x26b0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index a2065a3..4ac920d 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 _0xab00=['sequelize','exports','STRING','username','ENUM','password','token','newTab','integrationTab'];(function(_0x577248,_0x21014a){var _0x598ab3=function(_0x48b6c3){while(--_0x48b6c3){_0x577248['push'](_0x577248['shift']());}};_0x598ab3(++_0x21014a);}(_0xab00,0x1b9));var _0x0ab0=function(_0x456168,_0x462769){_0x456168=_0x456168-0x0;var _0x5802e0=_0xab00[_0x456168];return _0x5802e0;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module[_0x0ab0('0x1')]={'name':{'type':Sequelize[_0x0ab0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0ab0('0x2')],'unique':_0x0ab0('0x3')},'password':{'type':Sequelize[_0x0ab0('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0ab0('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x0ab0('0x4')](_0x0ab0('0x5'),_0x0ab0('0x6')),'defaultValue':_0x0ab0('0x5')},'serverUrl':{'type':Sequelize[_0x0ab0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ab0('0x4')]('integrationTab',_0x0ab0('0x7')),'defaultValue':_0x0ab0('0x8')}}; \ No newline at end of file +var _0x55c3=['remoteUri','ENUM','password','token','newTab','integrationTab','exports','STRING','username'];(function(_0xfa935c,_0x5f42a7){var _0x521482=function(_0x386e61){while(--_0x386e61){_0xfa935c['push'](_0xfa935c['shift']());}};_0x521482(++_0x5f42a7);}(_0x55c3,0x189));var _0x355c=function(_0xd7185e,_0x5ac9a5){_0xd7185e=_0xd7185e-0x0;var _0xe969ce=_0x55c3[_0xd7185e];return _0xe969ce;};'use strict';var Sequelize=require('sequelize');module[_0x355c('0x0')]={'name':{'type':Sequelize[_0x355c('0x1')]},'description':{'type':Sequelize[_0x355c('0x1')]},'username':{'type':Sequelize[_0x355c('0x1')],'unique':_0x355c('0x2')},'password':{'type':Sequelize[_0x355c('0x1')]},'token':{'type':Sequelize[_0x355c('0x1')]},'remoteUri':{'type':Sequelize[_0x355c('0x1')],'unique':_0x355c('0x3')},'authType':{'type':Sequelize[_0x355c('0x4')](_0x355c('0x5'),_0x355c('0x6')),'defaultValue':_0x355c('0x5')},'serverUrl':{'type':Sequelize[_0x355c('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x355c('0x7')),'defaultValue':_0x355c('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 03c9113..2a8cb90 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 _0x4fc2=['addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','remove','position','title','system_field_options','statusCode','error','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','update','getConfigurations','findOne','ZendeskConfiguration'];(function(_0xbc2239,_0x4e9648){var _0x4877da=function(_0x116e11){while(--_0x116e11){_0xbc2239['push'](_0xbc2239['shift']());}};_0x4877da(++_0x4e9648);}(_0x4fc2,0x111));var _0x24fc=function(_0x4b136a,_0xa8310c){_0x4b136a=_0x4b136a-0x0;var _0x51a36b=_0x4fc2[_0x4b136a];return _0x51a36b;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x306873,_0x76cb25){_0x76cb25=_0x76cb25||0xcc;return function(_0x3f6d8b){if(_0x3f6d8b){return _0x306873[_0x24fc('0x1b')](_0x76cb25);}return _0x306873[_0x24fc('0x1c')](_0x76cb25)[_0x24fc('0x1d')]();};}function respondWithResult(_0x537b5c,_0x2a0971){_0x2a0971=_0x2a0971||0xc8;return function(_0x18c0a7){if(_0x18c0a7){return _0x537b5c[_0x24fc('0x1c')](_0x2a0971)[_0x24fc('0x1e')](_0x18c0a7);}};}function respondWithFilteredResult(_0x4acd36,_0x2ac989){return function(_0x588543){if(_0x588543){var _0x4af098=typeof _0x2ac989[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x2ac989[_0x24fc('0x21')]===_0x24fc('0x20');var _0x52a884=_0x588543[_0x24fc('0x22')];var _0x1cb3d0=_0x4af098?0x0:_0x2ac989[_0x24fc('0x1f')];var _0x8ac114=_0x4af098?_0x588543['count']:_0x2ac989[_0x24fc('0x1f')]+_0x2ac989[_0x24fc('0x21')];var _0x304881;if(_0x8ac114>=_0x52a884){_0x8ac114=_0x52a884;_0x304881=0xc8;}else{_0x304881=0xce;}_0x4acd36['status'](_0x304881);return _0x4acd36[_0x24fc('0x23')](_0x24fc('0x24'),_0x1cb3d0+'-'+_0x8ac114+'/'+_0x52a884)[_0x24fc('0x1e')](_0x588543);}return null;};}function patchUpdates(_0x2d0e3d){return function(_0x49a0ba){try{jsonpatch[_0x24fc('0x25')](_0x49a0ba,_0x2d0e3d,!![]);}catch(_0x545939){return BPromise[_0x24fc('0x26')](_0x545939);}return _0x49a0ba['save']();};}function saveUpdates(_0x3ed464,_0x44c121){return function(_0x2ffade){if(_0x2ffade){return _0x2ffade['update'](_0x3ed464)[_0x24fc('0x27')](function(_0x552035){return _0x552035;});}return null;};}function removeEntity(_0x35a9c7,_0x2bb93a){return function(_0x36a9b4){if(_0x36a9b4){return _0x36a9b4[_0x24fc('0x28')]()[_0x24fc('0x27')](function(){_0x35a9c7[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x20192b,_0x168d98){return function(_0x2a5c4b){if(!_0x2a5c4b){_0x20192b['sendStatus'](0x194);}return _0x2a5c4b;};}function handleError(_0x11c913,_0x16f27f){_0x16f27f=_0x16f27f||0x1f4;return function(_0x3ee302){logger['error'](_0x3ee302[_0x24fc('0x29')]);if(_0x3ee302[_0x24fc('0x2a')]){delete _0x3ee302[_0x24fc('0x2a')];}_0x11c913[_0x24fc('0x1c')](_0x16f27f)[_0x24fc('0x2b')](_0x3ee302);};}exports[_0x24fc('0x2c')]=function(_0x5ac1f2,_0x240ae7){var _0x29a461={},_0x3c99ed={},_0x1c5146={'count':0x0,'rows':[]};var _0x9f7bbc=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x3df6f4){return{'name':_0x3df6f4['fieldName'],'type':_0x3df6f4[_0x24fc('0x2d')][_0x24fc('0x2e')]};});_0x3c99ed[_0x24fc('0x2f')]=_[_0x24fc('0x30')](_0x9f7bbc,'name');_0x3c99ed[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x5ac1f2['query']);_0x3c99ed[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x3c99ed['model'],_0x3c99ed['query']);_0x29a461[_0x24fc('0x35')]=_['intersection'](_0x3c99ed[_0x24fc('0x2f')],qs[_0x24fc('0x36')](_0x5ac1f2['query'][_0x24fc('0x36')]));_0x29a461[_0x24fc('0x35')]=_0x29a461[_0x24fc('0x35')][_0x24fc('0x37')]?_0x29a461[_0x24fc('0x35')]:_0x3c99ed[_0x24fc('0x2f')];if(!_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x38')](_0x24fc('0x39'))){_0x29a461['limit']=qs[_0x24fc('0x21')](_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x21')]);_0x29a461[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x5ac1f2['query']['offset']);}_0x29a461[_0x24fc('0x3a')]=qs['sort'](_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3b')]);_0x29a461[_0x24fc('0x3c')]=qs[_0x24fc('0x33')](_['pick'](_0x5ac1f2[_0x24fc('0x31')],_0x3c99ed['filters']),_0x9f7bbc);if(_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3d')]){_0x29a461[_0x24fc('0x3c')]=_[_0x24fc('0x3e')](_0x29a461[_0x24fc('0x3c')],{'$or':_['map'](_0x9f7bbc,function(_0xadedb4){if(_0xadedb4[_0x24fc('0x2d')]!==_0x24fc('0x3f')){var _0x22a75c={};_0x22a75c[_0xadedb4['name']]={'$like':'%'+_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3d')]+'%'};return _0x22a75c;}})});}_0x29a461=_['merge']({},_0x29a461,_0x5ac1f2[_0x24fc('0x40')]);var _0x52df2e={'where':_0x29a461[_0x24fc('0x3c')]};return db[_0x24fc('0x41')][_0x24fc('0x22')](_0x52df2e)[_0x24fc('0x27')](function(_0x431189){_0x1c5146[_0x24fc('0x22')]=_0x431189;if(_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x42')]){_0x29a461['include']=[{'all':!![]}];}return db[_0x24fc('0x41')][_0x24fc('0x43')](_0x29a461);})[_0x24fc('0x27')](function(_0x4fee9f){_0x1c5146[_0x24fc('0x44')]=_0x4fee9f;return _0x1c5146;})[_0x24fc('0x27')](respondWithFilteredResult(_0x240ae7,_0x29a461))['catch'](handleError(_0x240ae7,null));};exports[_0x24fc('0x45')]=function(_0x22f30b,_0x2c598c){var _0x5e4e9b={'raw':![],'where':{'id':_0x22f30b[_0x24fc('0x46')]['id']}},_0x31ddd0={};_0x31ddd0['model']=_[_0x24fc('0x32')](db[_0x24fc('0x41')][_0x24fc('0x47')]);_0x31ddd0[_0x24fc('0x31')]=_['keys'](_0x22f30b[_0x24fc('0x31')]);_0x31ddd0[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x31ddd0[_0x24fc('0x2f')],_0x31ddd0[_0x24fc('0x31')]);_0x5e4e9b['attributes']=_[_0x24fc('0x34')](_0x31ddd0[_0x24fc('0x2f')],qs[_0x24fc('0x36')](_0x22f30b[_0x24fc('0x31')]['fields']));_0x5e4e9b[_0x24fc('0x35')]=_0x5e4e9b[_0x24fc('0x35')]['length']?_0x5e4e9b['attributes']:_0x31ddd0[_0x24fc('0x2f')];if(_0x22f30b['query']['includeAll']){_0x5e4e9b[_0x24fc('0x48')]=[{'all':!![]}];}_0x5e4e9b=_['merge']({},_0x5e4e9b,_0x22f30b[_0x24fc('0x40')]);return db[_0x24fc('0x41')][_0x24fc('0x49')](_0x5e4e9b)['then'](handleEntityNotFound(_0x2c598c,null))[_0x24fc('0x27')](respondWithResult(_0x2c598c,null))[_0x24fc('0x4a')](handleError(_0x2c598c,null));};exports[_0x24fc('0x4b')]=function(_0x1ad8d6,_0x39873d){return db[_0x24fc('0x41')][_0x24fc('0x4b')](_0x1ad8d6[_0x24fc('0x4c')],{})['then'](respondWithResult(_0x39873d,0xc9))['catch'](handleError(_0x39873d,null));};exports[_0x24fc('0x4d')]=function(_0x2f1a99,_0x12e9f7){if(_0x2f1a99['body']['id']){delete _0x2f1a99['body']['id'];}return db[_0x24fc('0x41')][_0x24fc('0x49')]({'where':{'id':_0x2f1a99[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x12e9f7,null))[_0x24fc('0x27')](saveUpdates(_0x2f1a99[_0x24fc('0x4c')],null))[_0x24fc('0x27')](respondWithResult(_0x12e9f7,null))[_0x24fc('0x4a')](handleError(_0x12e9f7,null));};exports[_0x24fc('0x28')]=function(_0x4574d3,_0x434700){return db[_0x24fc('0x41')]['find']({'where':{'id':_0x4574d3[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x434700,null))[_0x24fc('0x27')](removeEntity(_0x434700,null))[_0x24fc('0x4a')](handleError(_0x434700,null));};exports[_0x24fc('0x4e')]=function(_0x5bdc4d,_0x428012,_0x4bf3a8){var _0x2c8f74={};var _0x2ee445={};var _0x446c14;var _0x41ddfb;return db[_0x24fc('0x41')][_0x24fc('0x4f')]({'where':{'id':_0x5bdc4d['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x428012,null))[_0x24fc('0x27')](function(_0xc49d9f){if(_0xc49d9f){_0x446c14=_0xc49d9f;_0x2ee445[_0x24fc('0x2f')]=_[_0x24fc('0x32')](db[_0x24fc('0x50')]['rawAttributes']);_0x2ee445[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x5bdc4d[_0x24fc('0x31')]);_0x2ee445[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x2ee445[_0x24fc('0x2f')],_0x2ee445[_0x24fc('0x31')]);_0x2c8f74['attributes']=_[_0x24fc('0x34')](_0x2ee445[_0x24fc('0x2f')],qs['fields'](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x36')]));_0x2c8f74[_0x24fc('0x35')]=_0x2c8f74[_0x24fc('0x35')][_0x24fc('0x37')]?_0x2c8f74[_0x24fc('0x35')]:_0x2ee445['model'];_0x2c8f74[_0x24fc('0x3a')]=qs['sort'](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3b')]);_0x2c8f74['where']=qs[_0x24fc('0x33')](_['pick'](_0x5bdc4d[_0x24fc('0x31')],_0x2ee445['filters']));if(_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3d')]){_0x2c8f74['where']=_[_0x24fc('0x3e')](_0x2c8f74['where'],{'$or':_[_0x24fc('0x30')](_0x2c8f74[_0x24fc('0x35')],function(_0x59e46e){var _0xd1638f={};_0xd1638f[_0x59e46e]={'$like':'%'+_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3d')]+'%'};return _0xd1638f;})});}_0x2c8f74=_[_0x24fc('0x3e')]({},_0x2c8f74,_0x5bdc4d[_0x24fc('0x40')]);return _0x446c14['getConfigurations'](_0x2c8f74);}})[_0x24fc('0x27')](function(_0x2f62b0){if(_0x2f62b0){_0x41ddfb=_0x2f62b0[_0x24fc('0x37')];if(!_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x38')]('nolimit')){_0x2c8f74['limit']=qs[_0x24fc('0x21')](_0x5bdc4d[_0x24fc('0x31')]['limit']);_0x2c8f74['offset']=qs[_0x24fc('0x1f')](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x1f')]);}return _0x446c14[_0x24fc('0x4e')](_0x2c8f74);}})['then'](function(_0x20973d){if(_0x20973d){return _0x20973d?{'count':_0x41ddfb,'rows':_0x20973d}:null;}})[_0x24fc('0x27')](respondWithResult(_0x428012,null))[_0x24fc('0x4a')](handleError(_0x428012,null));};exports[_0x24fc('0x51')]=function(_0x1df0c4,_0x3e896f,_0x26ac2e){if(_0x1df0c4[_0x24fc('0x4c')]['id']){delete _0x1df0c4[_0x24fc('0x4c')]['id'];}return db[_0x24fc('0x41')][_0x24fc('0x4f')]({'where':{'id':_0x1df0c4[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x3e896f,null))[_0x24fc('0x27')](function(_0x354fc6){if(_0x354fc6){_0x1df0c4['body'][_0x24fc('0x52')]=_0x354fc6['id'];_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x53')]=integrations[_0x24fc('0x54')](_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x55')],_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x2d')]);_0x1df0c4['body'][_0x24fc('0x56')]=integrations[_0x24fc('0x57')](_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x55')],_0x1df0c4['body'][_0x24fc('0x2d')]);return db[_0x24fc('0x50')]['create'](_0x1df0c4['body'],{'include':[{'model':db['ZendeskField'],'as':_0x24fc('0x53')},{'model':db[_0x24fc('0x58')],'as':_0x24fc('0x56')}]});}return null;})[_0x24fc('0x27')](respondWithResult(_0x3e896f,null))[_0x24fc('0x4a')](handleError(_0x3e896f,null));};exports[_0x24fc('0x59')]=function(_0x52e1aa,_0x11bafd,_0x15e8a3){var _0x5a2c09='';return db['ZendeskAccount'][_0x24fc('0x4f')]({'where':{'id':_0x52e1aa[_0x24fc('0x46')]['id']},'attributes':['id',_0x24fc('0x5a'),'password',_0x24fc('0x5b'),_0x24fc('0x5c'),_0x24fc('0x5d')]})['then'](handleEntityNotFound(_0x11bafd,null))['then'](function(_0x4c286d){if(_0x4c286d){_0x5a2c09=_0x4c286d['remoteUri'];var _0x4a1b8e=_0x5a2c09[_0x24fc('0x5e')](-0x1);if(_0x4a1b8e==='/'){_0x5a2c09=_0x5a2c09[_0x24fc('0x5f')](0x0,_0x5a2c09[_0x24fc('0x60')](_0x4a1b8e));}var _0x2a1236={'method':'GET','uri':util[_0x24fc('0x61')]('%s/%s',_0x5a2c09,_0x24fc('0x62')),'json':!![]};switch(_0x4c286d['authType']){case _0x24fc('0x63'):_0x2a1236[_0x24fc('0x64')]={'Authorization':util[_0x24fc('0x61')](_0x24fc('0x65'),new Buffer(util[_0x24fc('0x61')](_0x24fc('0x66'),_0x4c286d[_0x24fc('0x5a')],_0x4c286d['password']))[_0x24fc('0x67')](_0x24fc('0x68')))};break;case _0x24fc('0x5b'):_0x2a1236['headers']={'Authorization':util['format'](_0x24fc('0x65'),new Buffer(util[_0x24fc('0x61')]('%s/token:%s',_0x4c286d[_0x24fc('0x5a')],_0x4c286d[_0x24fc('0x5b')]))['toString'](_0x24fc('0x68')))};break;default:throw new db[(_0x24fc('0x69'))]['ValidationError'](_0x24fc('0x6a'));}return rp(_0x2a1236);}})[_0x24fc('0x27')](function(_0x24e717){if(_0x24e717){var _0x1efe4e=[_0x24fc('0x6b'),_0x24fc('0x6c'),'group','assignee'];_[_0x24fc('0x6d')](_0x24e717['ticket_fields'],function(_0x29bd9f){return _0x1efe4e['includes'](_0x29bd9f['type']);});return{'count':_0x24e717[_0x24fc('0x62')][_0x24fc('0x37')],'rows':_[_0x24fc('0x30')](_0x24e717[_0x24fc('0x62')],function(_0x66de4f){return{'id':_0x66de4f['id'],'name':_0x66de4f[_0x24fc('0x6e')]>0x7?_0x66de4f[_0x24fc('0x6f')]:_0x66de4f[_0x24fc('0x2d')],'custom':_0x66de4f['position']>0x7?!![]:![],'options':_0x66de4f[_0x24fc('0x70')]?_0x66de4f[_0x24fc('0x70')]:_0x66de4f['custom_field_options']?_0x66de4f['custom_field_options']:[]};})};}})[_0x24fc('0x27')](respondWithResult(_0x11bafd,null))[_0x24fc('0x4a')](function(_0x938dcf){var _0x1b2a97=_0x52e1aa[_0x24fc('0x31')]['test']?0x1f4:_0x938dcf[_0x24fc('0x71')]||0x1f4;logger[_0x24fc('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x24fc('0x59'),_0x1b2a97,JSON[_0x24fc('0x73')](_0x938dcf));delete _0x938dcf[_0x24fc('0x2a')];if(_0x1b2a97===0x191){_0x1b2a97=0x190;}_0x11bafd['status'](_0x1b2a97)[_0x24fc('0x2b')](_0x52e1aa[_0x24fc('0x31')][_0x24fc('0x74')]?{'message':_0x24fc('0x75'),'statusCode':_0x938dcf[_0x24fc('0x71')]}:_0x938dcf);});}; \ No newline at end of file +var _0x8f59=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','params','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','filter','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','username','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','position','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x56c070,_0x6e4f91){var _0x1b7013=function(_0x4269bd){while(--_0x4269bd){_0x56c070['push'](_0x56c070['shift']());}};_0x1b7013(++_0x6e4f91);}(_0x8f59,0x11d));var _0x98f5=function(_0x3c8618,_0x54ada2){_0x3c8618=_0x3c8618-0x0;var _0x2deb98=_0x8f59[_0x3c8618];return _0x2deb98;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];var integrations=require(_0x98f5('0x18'));function respondWithStatusCode(_0x1f00e8,_0x160626){_0x160626=_0x160626||0xcc;return function(_0x3286f7){if(_0x3286f7){return _0x1f00e8[_0x98f5('0x19')](_0x160626);}return _0x1f00e8['status'](_0x160626)[_0x98f5('0x1a')]();};}function respondWithResult(_0xbade31,_0x5b8bab){_0x5b8bab=_0x5b8bab||0xc8;return function(_0x9df84){if(_0x9df84){return _0xbade31[_0x98f5('0x1b')](_0x5b8bab)[_0x98f5('0x1c')](_0x9df84);}};}function respondWithFilteredResult(_0x4ae70d,_0x2437e7){return function(_0xc7a49b){if(_0xc7a49b){var _0x113545=typeof _0x2437e7['offset']===_0x98f5('0x1d')&&typeof _0x2437e7[_0x98f5('0x1e')]==='undefined';var _0x1df52d=_0xc7a49b['count'];var _0x10c57c=_0x113545?0x0:_0x2437e7[_0x98f5('0x1f')];var _0x2291d5=_0x113545?_0xc7a49b[_0x98f5('0x20')]:_0x2437e7[_0x98f5('0x1f')]+_0x2437e7[_0x98f5('0x1e')];var _0x484e1d;if(_0x2291d5>=_0x1df52d){_0x2291d5=_0x1df52d;_0x484e1d=0xc8;}else{_0x484e1d=0xce;}_0x4ae70d[_0x98f5('0x1b')](_0x484e1d);return _0x4ae70d['set'](_0x98f5('0x21'),_0x10c57c+'-'+_0x2291d5+'/'+_0x1df52d)[_0x98f5('0x1c')](_0xc7a49b);}return null;};}function patchUpdates(_0x5deca0){return function(_0x146db1){try{jsonpatch[_0x98f5('0x22')](_0x146db1,_0x5deca0,!![]);}catch(_0x331695){return BPromise[_0x98f5('0x23')](_0x331695);}return _0x146db1[_0x98f5('0x24')]();};}function saveUpdates(_0x3dc7c2,_0x38b46d){return function(_0x5ac2b7){if(_0x5ac2b7){return _0x5ac2b7[_0x98f5('0x25')](_0x3dc7c2)['then'](function(_0xcb10d6){return _0xcb10d6;});}return null;};}function removeEntity(_0x495889,_0x44bfbb){return function(_0x40c69b){if(_0x40c69b){return _0x40c69b[_0x98f5('0x26')]()[_0x98f5('0x27')](function(){_0x495889[_0x98f5('0x1b')](0xcc)[_0x98f5('0x1a')]();});}};}function handleEntityNotFound(_0x46dbd4,_0x58d506){return function(_0x27a533){if(!_0x27a533){_0x46dbd4[_0x98f5('0x19')](0x194);}return _0x27a533;};}function handleError(_0x5d7423,_0x1a1c55){_0x1a1c55=_0x1a1c55||0x1f4;return function(_0x18b0af){logger[_0x98f5('0x28')](_0x18b0af[_0x98f5('0x29')]);if(_0x18b0af[_0x98f5('0x2a')]){delete _0x18b0af[_0x98f5('0x2a')];}_0x5d7423[_0x98f5('0x1b')](_0x1a1c55)[_0x98f5('0x2b')](_0x18b0af);};}exports['index']=function(_0x4c10b8,_0x428c85){var _0x71661e={},_0x18bb29={},_0x209d15={'count':0x0,'rows':[]};var _0x15bf92=_[_0x98f5('0x2c')](db['ZendeskAccount'][_0x98f5('0x2d')],function(_0x6d7418){return{'name':_0x6d7418[_0x98f5('0x2e')],'type':_0x6d7418[_0x98f5('0x2f')][_0x98f5('0x30')]};});_0x18bb29[_0x98f5('0x31')]=_['map'](_0x15bf92,_0x98f5('0x2a'));_0x18bb29[_0x98f5('0x32')]=_[_0x98f5('0x33')](_0x4c10b8[_0x98f5('0x32')]);_0x18bb29['filters']=_[_0x98f5('0x34')](_0x18bb29[_0x98f5('0x31')],_0x18bb29[_0x98f5('0x32')]);_0x71661e[_0x98f5('0x35')]=_[_0x98f5('0x34')](_0x18bb29[_0x98f5('0x31')],qs[_0x98f5('0x36')](_0x4c10b8[_0x98f5('0x32')][_0x98f5('0x36')]));_0x71661e[_0x98f5('0x35')]=_0x71661e[_0x98f5('0x35')][_0x98f5('0x37')]?_0x71661e[_0x98f5('0x35')]:_0x18bb29[_0x98f5('0x31')];if(!_0x4c10b8[_0x98f5('0x32')][_0x98f5('0x38')](_0x98f5('0x39'))){_0x71661e[_0x98f5('0x1e')]=qs[_0x98f5('0x1e')](_0x4c10b8[_0x98f5('0x32')]['limit']);_0x71661e[_0x98f5('0x1f')]=qs['offset'](_0x4c10b8['query'][_0x98f5('0x1f')]);}_0x71661e[_0x98f5('0x3a')]=qs[_0x98f5('0x3b')](_0x4c10b8[_0x98f5('0x32')]['sort']);_0x71661e[_0x98f5('0x3c')]=qs[_0x98f5('0x3d')](_[_0x98f5('0x3e')](_0x4c10b8['query'],_0x18bb29[_0x98f5('0x3d')]),_0x15bf92);if(_0x4c10b8[_0x98f5('0x32')]['filter']){_0x71661e[_0x98f5('0x3c')]=_[_0x98f5('0x3f')](_0x71661e[_0x98f5('0x3c')],{'$or':_['map'](_0x15bf92,function(_0x15d704){if(_0x15d704[_0x98f5('0x2f')]!==_0x98f5('0x40')){var _0x544fbf={};_0x544fbf[_0x15d704[_0x98f5('0x2a')]]={'$like':'%'+_0x4c10b8['query']['filter']+'%'};return _0x544fbf;}})});}_0x71661e=_[_0x98f5('0x3f')]({},_0x71661e,_0x4c10b8[_0x98f5('0x41')]);var _0x33e6e2={'where':_0x71661e[_0x98f5('0x3c')]};return db[_0x98f5('0x42')][_0x98f5('0x20')](_0x33e6e2)['then'](function(_0x4a4129){_0x209d15[_0x98f5('0x20')]=_0x4a4129;if(_0x4c10b8[_0x98f5('0x32')][_0x98f5('0x43')]){_0x71661e[_0x98f5('0x44')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x71661e);})[_0x98f5('0x27')](function(_0x469d2c){_0x209d15[_0x98f5('0x45')]=_0x469d2c;return _0x209d15;})[_0x98f5('0x27')](respondWithFilteredResult(_0x428c85,_0x71661e))['catch'](handleError(_0x428c85,null));};exports['show']=function(_0x3db067,_0x3a191f){var _0x372c33={'raw':![],'where':{'id':_0x3db067[_0x98f5('0x46')]['id']}},_0x4a9b53={};_0x4a9b53['model']=_[_0x98f5('0x33')](db['ZendeskAccount'][_0x98f5('0x2d')]);_0x4a9b53[_0x98f5('0x32')]=_[_0x98f5('0x33')](_0x3db067['query']);_0x4a9b53[_0x98f5('0x3d')]=_[_0x98f5('0x34')](_0x4a9b53['model'],_0x4a9b53[_0x98f5('0x32')]);_0x372c33[_0x98f5('0x35')]=_['intersection'](_0x4a9b53[_0x98f5('0x31')],qs['fields'](_0x3db067[_0x98f5('0x32')][_0x98f5('0x36')]));_0x372c33['attributes']=_0x372c33['attributes']['length']?_0x372c33['attributes']:_0x4a9b53[_0x98f5('0x31')];if(_0x3db067['query'][_0x98f5('0x43')]){_0x372c33[_0x98f5('0x44')]=[{'all':!![]}];}_0x372c33=_[_0x98f5('0x3f')]({},_0x372c33,_0x3db067[_0x98f5('0x41')]);return db[_0x98f5('0x42')][_0x98f5('0x47')](_0x372c33)['then'](handleEntityNotFound(_0x3a191f,null))[_0x98f5('0x27')](respondWithResult(_0x3a191f,null))[_0x98f5('0x48')](handleError(_0x3a191f,null));};exports[_0x98f5('0x49')]=function(_0x2c3cef,_0x178867){return db[_0x98f5('0x42')]['create'](_0x2c3cef[_0x98f5('0x4a')],{})[_0x98f5('0x27')](respondWithResult(_0x178867,0xc9))[_0x98f5('0x48')](handleError(_0x178867,null));};exports[_0x98f5('0x25')]=function(_0x4a0cda,_0x2c5f96){if(_0x4a0cda[_0x98f5('0x4a')]['id']){delete _0x4a0cda[_0x98f5('0x4a')]['id'];}return db[_0x98f5('0x42')][_0x98f5('0x47')]({'where':{'id':_0x4a0cda['params']['id']}})[_0x98f5('0x27')](handleEntityNotFound(_0x2c5f96,null))[_0x98f5('0x27')](saveUpdates(_0x4a0cda['body'],null))[_0x98f5('0x27')](respondWithResult(_0x2c5f96,null))['catch'](handleError(_0x2c5f96,null));};exports[_0x98f5('0x26')]=function(_0x4cb157,_0x1bd2b9){return db[_0x98f5('0x42')][_0x98f5('0x47')]({'where':{'id':_0x4cb157['params']['id']}})[_0x98f5('0x27')](handleEntityNotFound(_0x1bd2b9,null))[_0x98f5('0x27')](removeEntity(_0x1bd2b9,null))[_0x98f5('0x48')](handleError(_0x1bd2b9,null));};exports[_0x98f5('0x4b')]=function(_0xde3d2d,_0xf39073,_0x37e620){var _0x1891ac={};var _0x2c3a23={};var _0x2e48a1;var _0x50343c;return db[_0x98f5('0x42')][_0x98f5('0x4c')]({'where':{'id':_0xde3d2d[_0x98f5('0x46')]['id']}})[_0x98f5('0x27')](handleEntityNotFound(_0xf39073,null))[_0x98f5('0x27')](function(_0x23e955){if(_0x23e955){_0x2e48a1=_0x23e955;_0x2c3a23['model']=_[_0x98f5('0x33')](db[_0x98f5('0x4d')][_0x98f5('0x2d')]);_0x2c3a23[_0x98f5('0x32')]=_[_0x98f5('0x33')](_0xde3d2d[_0x98f5('0x32')]);_0x2c3a23['filters']=_['intersection'](_0x2c3a23['model'],_0x2c3a23[_0x98f5('0x32')]);_0x1891ac[_0x98f5('0x35')]=_[_0x98f5('0x34')](_0x2c3a23[_0x98f5('0x31')],qs['fields'](_0xde3d2d[_0x98f5('0x32')]['fields']));_0x1891ac[_0x98f5('0x35')]=_0x1891ac['attributes']['length']?_0x1891ac[_0x98f5('0x35')]:_0x2c3a23[_0x98f5('0x31')];_0x1891ac[_0x98f5('0x3a')]=qs['sort'](_0xde3d2d['query'][_0x98f5('0x3b')]);_0x1891ac[_0x98f5('0x3c')]=qs['filters'](_[_0x98f5('0x3e')](_0xde3d2d[_0x98f5('0x32')],_0x2c3a23['filters']));if(_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x4e')]){_0x1891ac[_0x98f5('0x3c')]=_['merge'](_0x1891ac[_0x98f5('0x3c')],{'$or':_[_0x98f5('0x2c')](_0x1891ac[_0x98f5('0x35')],function(_0xabde69){var _0x459c64={};_0x459c64[_0xabde69]={'$like':'%'+_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x4e')]+'%'};return _0x459c64;})});}_0x1891ac=_['merge']({},_0x1891ac,_0xde3d2d[_0x98f5('0x41')]);return _0x2e48a1[_0x98f5('0x4b')](_0x1891ac);}})[_0x98f5('0x27')](function(_0x58041d){if(_0x58041d){_0x50343c=_0x58041d['length'];if(!_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x38')]('nolimit')){_0x1891ac['limit']=qs['limit'](_0xde3d2d['query'][_0x98f5('0x1e')]);_0x1891ac['offset']=qs[_0x98f5('0x1f')](_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x1f')]);}return _0x2e48a1[_0x98f5('0x4b')](_0x1891ac);}})[_0x98f5('0x27')](function(_0x26cc86){if(_0x26cc86){return _0x26cc86?{'count':_0x50343c,'rows':_0x26cc86}:null;}})[_0x98f5('0x27')](respondWithResult(_0xf39073,null))[_0x98f5('0x48')](handleError(_0xf39073,null));};exports['addConfiguration']=function(_0x4d89b6,_0x3b8229,_0x505209){if(_0x4d89b6[_0x98f5('0x4a')]['id']){delete _0x4d89b6[_0x98f5('0x4a')]['id'];}return db[_0x98f5('0x42')]['findOne']({'where':{'id':_0x4d89b6[_0x98f5('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b8229,null))['then'](function(_0x595aee){if(_0x595aee){_0x4d89b6[_0x98f5('0x4a')]['AccountId']=_0x595aee['id'];_0x4d89b6[_0x98f5('0x4a')][_0x98f5('0x4f')]=integrations[_0x98f5('0x50')](_0x4d89b6['body']['channel'],_0x4d89b6['body'][_0x98f5('0x2f')]);_0x4d89b6[_0x98f5('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x4d89b6[_0x98f5('0x4a')][_0x98f5('0x51')],_0x4d89b6[_0x98f5('0x4a')][_0x98f5('0x2f')]);return db[_0x98f5('0x4d')][_0x98f5('0x49')](_0x4d89b6[_0x98f5('0x4a')],{'include':[{'model':db[_0x98f5('0x52')],'as':_0x98f5('0x4f')},{'model':db['ZendeskField'],'as':_0x98f5('0x53')}]});}return null;})[_0x98f5('0x27')](respondWithResult(_0x3b8229,null))[_0x98f5('0x48')](handleError(_0x3b8229,null));};exports[_0x98f5('0x54')]=function(_0x50911c,_0x3e00bf,_0x48b175){var _0x42c7a6='';return db['ZendeskAccount'][_0x98f5('0x4c')]({'where':{'id':_0x50911c[_0x98f5('0x46')]['id']},'attributes':['id','username',_0x98f5('0x55'),_0x98f5('0x56'),_0x98f5('0x57'),'remoteUri']})[_0x98f5('0x27')](handleEntityNotFound(_0x3e00bf,null))[_0x98f5('0x27')](function(_0x14c4f1){if(_0x14c4f1){_0x42c7a6=_0x14c4f1[_0x98f5('0x58')];var _0x154e19=_0x42c7a6[_0x98f5('0x59')](-0x1);if(_0x154e19==='/'){_0x42c7a6=_0x42c7a6[_0x98f5('0x5a')](0x0,_0x42c7a6[_0x98f5('0x5b')](_0x154e19));}var _0x368f76={'method':'GET','uri':util[_0x98f5('0x5c')]('%s/%s',_0x42c7a6,_0x98f5('0x5d')),'json':!![]};switch(_0x14c4f1[_0x98f5('0x57')]){case _0x98f5('0x55'):_0x368f76[_0x98f5('0x5e')]={'Authorization':util['format'](_0x98f5('0x5f'),new Buffer(util[_0x98f5('0x5c')]('%s:%s',_0x14c4f1[_0x98f5('0x60')],_0x14c4f1['password']))[_0x98f5('0x61')](_0x98f5('0x62')))};break;case _0x98f5('0x56'):_0x368f76[_0x98f5('0x5e')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x98f5('0x5c')](_0x98f5('0x63'),_0x14c4f1['username'],_0x14c4f1[_0x98f5('0x56')]))[_0x98f5('0x61')](_0x98f5('0x62')))};break;default:throw new db[(_0x98f5('0x64'))][(_0x98f5('0x65'))](_0x98f5('0x66'));}return rp(_0x368f76);}})[_0x98f5('0x27')](function(_0x1a3cb8){if(_0x1a3cb8){var _0x2e0484=[_0x98f5('0x67'),_0x98f5('0x68'),'group','assignee'];_[_0x98f5('0x69')](_0x1a3cb8[_0x98f5('0x5d')],function(_0x10cd2d){return _0x2e0484['includes'](_0x10cd2d[_0x98f5('0x2f')]);});return{'count':_0x1a3cb8[_0x98f5('0x5d')]['length'],'rows':_[_0x98f5('0x2c')](_0x1a3cb8[_0x98f5('0x5d')],function(_0x4c1dda){return{'id':_0x4c1dda['id'],'name':_0x4c1dda['position']>0x7?_0x4c1dda['title']:_0x4c1dda['type'],'custom':_0x4c1dda[_0x98f5('0x6a')]>0x7?!![]:![],'options':_0x4c1dda[_0x98f5('0x6b')]?_0x4c1dda['system_field_options']:_0x4c1dda[_0x98f5('0x6c')]?_0x4c1dda[_0x98f5('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3e00bf,null))[_0x98f5('0x48')](function(_0x4f582b){var _0x4814da=_0x50911c[_0x98f5('0x32')][_0x98f5('0x6d')]?0x1f4:_0x4f582b[_0x98f5('0x6e')]||0x1f4;logger[_0x98f5('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x98f5('0x54'),_0x4814da,JSON['stringify'](_0x4f582b));delete _0x4f582b['name'];if(_0x4814da===0x191){_0x4814da=0x190;}_0x3e00bf['status'](_0x4814da)[_0x98f5('0x2b')](_0x50911c[_0x98f5('0x32')][_0x98f5('0x6d')]?{'message':_0x98f5('0x6f'),'statusCode':_0x4f582b[_0x98f5('0x6e')]}:_0x4f582b);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b7766be..3597fe3 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 _0x12b4=['path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','util','moment','bluebird','request-promise'];(function(_0x4feecd,_0x54a3de){var _0x5eb20a=function(_0x144626){while(--_0x144626){_0x4feecd['push'](_0x4feecd['shift']());}};_0x5eb20a(++_0x54a3de);}(_0x12b4,0xdf));var _0x412b=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x12b4[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x412b('0x0'));var util=require(_0x412b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x412b('0x2'));var BPromise=require(_0x412b('0x3'));var rp=require(_0x412b('0x4'));var fs=require('fs');var path=require(_0x412b('0x5'));var rimraf=require(_0x412b('0x6'));var config=require(_0x412b('0x7'));var attributes=require(_0x412b('0x8'));var integrations=require(_0x412b('0x9'));module[_0x412b('0xa')]=function(_0x3340d9,_0x280697){return _0x3340d9['define']('ZendeskAccount',attributes,{'tableName':_0x412b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x111e=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x111e,0xae));var _0xe111=function(_0x519641,_0x300b06){_0x519641=_0x519641-0x0;var _0x43bae0=_0x111e[_0x519641];return _0x43bae0;};'use strict';var _=require(_0xe111('0x0'));var util=require(_0xe111('0x1'));var logger=require(_0xe111('0x2'))(_0xe111('0x3'));var moment=require(_0xe111('0x4'));var BPromise=require(_0xe111('0x5'));var rp=require(_0xe111('0x6'));var fs=require('fs');var path=require(_0xe111('0x7'));var rimraf=require(_0xe111('0x8'));var config=require(_0xe111('0x9'));var attributes=require(_0xe111('0xa'));var integrations=require(_0xe111('0xb'));module[_0xe111('0xc')]=function(_0x3fadf6,_0x16d194){return _0x3fadf6['define']('ZendeskAccount',attributes,{'tableName':_0xe111('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index d8faeec..ef6561f 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 _0x6a10=['then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetZendeskAccount','findAll','options','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x3da938,_0x25797d){var _0x2b2768=function(_0x58d079){while(--_0x58d079){_0x3da938['push'](_0x3da938['shift']());}};_0x2b2768(++_0x25797d);}(_0x6a10,0xe3));var _0x06a1=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x6a10[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x06a1('0x0'));var BPromise=require(_0x06a1('0x1'));var rs=require(_0x06a1('0x2'));var fs=require('fs');var Redis=require(_0x06a1('0x3'));var db=require(_0x06a1('0x4'))['db'];var utils=require(_0x06a1('0x5'));var logger=require(_0x06a1('0x6'))(_0x06a1('0x7'));var config=require(_0x06a1('0x8'));var jayson=require(_0x06a1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5259a9,_0x2d3577,_0x3451cb){return new BPromise(function(_0x3fdf82,_0x1cbc29){return client[_0x06a1('0xa')](_0x5259a9,_0x3451cb)[_0x06a1('0xb')](function(_0x186c96){logger[_0x06a1('0xc')](_0x06a1('0xd'),_0x2d3577,'request\x20sent');logger[_0x06a1('0xe')](_0x06a1('0xf'),_0x2d3577,'request\x20sent',JSON[_0x06a1('0x10')](_0x186c96));if(_0x186c96['error']){if(_0x186c96[_0x06a1('0x11')]['code']===0x1f4){logger[_0x06a1('0x11')](_0x06a1('0xd'),_0x2d3577,_0x186c96['error']['message']);return _0x1cbc29(_0x186c96[_0x06a1('0x11')][_0x06a1('0x12')]);}logger[_0x06a1('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x2d3577,_0x186c96[_0x06a1('0x11')][_0x06a1('0x12')]);return _0x3fdf82(_0x186c96[_0x06a1('0x11')][_0x06a1('0x12')]);}else{logger[_0x06a1('0xc')](_0x06a1('0xd'),_0x2d3577,_0x06a1('0x13'));_0x3fdf82(_0x186c96[_0x06a1('0x14')][_0x06a1('0x12')]);}})[_0x06a1('0x15')](function(_0x519b47){logger[_0x06a1('0x11')](_0x06a1('0xd'),_0x2d3577,_0x519b47);_0x1cbc29(_0x519b47);});});}exports[_0x06a1('0x16')]=function(_0x274814){var _0x10f1bd=this;return new Promise(function(_0x3c5e71,_0x54cc57){return db['ZendeskAccount'][_0x06a1('0x17')]({'raw':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')]['where']||null:null,'attributes':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')][_0x06a1('0x19')]||null:null,'limit':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')][_0x06a1('0x1a')]||null:null,'include':_0x274814['options']?_0x274814[_0x06a1('0x18')][_0x06a1('0x1b')]?_[_0x06a1('0x1c')](_0x274814['options'][_0x06a1('0x1b')],function(_0x1a2462){return{'model':db[_0x1a2462['model']],'as':_0x1a2462['as'],'attributes':_0x1a2462[_0x06a1('0x19')],'include':_0x1a2462[_0x06a1('0x1b')]?_['map'](_0x1a2462['include'],function(_0x344bff){return{'model':db[_0x344bff[_0x06a1('0x1d')]],'as':_0x344bff['as'],'attributes':_0x344bff['attributes'],'include':_0x344bff[_0x06a1('0x1b')]?_['map'](_0x344bff[_0x06a1('0x1b')],function(_0x350894){return{'model':db[_0x350894[_0x06a1('0x1d')]],'as':_0x350894['as'],'attributes':_0x350894[_0x06a1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x06a1('0xb')](function(_0x4e583f){logger[_0x06a1('0xc')](_0x06a1('0x16'),_0x274814);logger[_0x06a1('0xe')]('GetZendeskAccount',_0x274814,JSON[_0x06a1('0x10')](_0x4e583f));_0x3c5e71(_0x4e583f);})[_0x06a1('0x15')](function(_0x22819e){logger[_0x06a1('0x11')](_0x06a1('0x16'),_0x22819e[_0x06a1('0x12')],_0x274814);_0x54cc57(_0x10f1bd[_0x06a1('0x11')](0x1f4,_0x22819e['message']));});});};exports[_0x06a1('0x1e')]=function(_0x2732fd){var _0x58bcc6=this;return new Promise(function(_0x23ade6,_0x45adb4){return db[_0x06a1('0x1f')][_0x06a1('0x20')]({'raw':_0x2732fd['options']?_0x2732fd[_0x06a1('0x18')][_0x06a1('0x21')]===undefined?!![]:![]:!![],'where':_0x2732fd[_0x06a1('0x18')]?_0x2732fd[_0x06a1('0x18')]['where']||null:null,'attributes':_0x2732fd[_0x06a1('0x18')]?_0x2732fd[_0x06a1('0x18')][_0x06a1('0x19')]||null:null,'include':_0x2732fd['options']?_0x2732fd['options'][_0x06a1('0x1b')]?_[_0x06a1('0x1c')](_0x2732fd[_0x06a1('0x18')][_0x06a1('0x1b')],function(_0x117ac7){return{'model':db[_0x117ac7['model']],'as':_0x117ac7['as'],'attributes':_0x117ac7[_0x06a1('0x19')],'include':_0x117ac7['include']?_[_0x06a1('0x1c')](_0x117ac7[_0x06a1('0x1b')],function(_0x46343d){return{'model':db[_0x46343d[_0x06a1('0x1d')]],'as':_0x46343d['as'],'attributes':_0x46343d[_0x06a1('0x19')],'include':_0x46343d['include']?_[_0x06a1('0x1c')](_0x46343d[_0x06a1('0x1b')],function(_0x51fc13){return{'model':db[_0x51fc13[_0x06a1('0x1d')]],'as':_0x51fc13['as'],'attributes':_0x51fc13[_0x06a1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1639c4){logger[_0x06a1('0xc')]('ShowZendeskAccount',_0x2732fd);logger[_0x06a1('0xe')](_0x06a1('0x1e'),_0x2732fd,JSON[_0x06a1('0x10')](_0x1639c4));_0x23ade6(_0x1639c4);})[_0x06a1('0x15')](function(_0x12462d){logger[_0x06a1('0x11')](_0x06a1('0x1e'),_0x12462d[_0x06a1('0x12')],_0x2732fd);_0x45adb4(_0x58bcc6[_0x06a1('0x11')](0x1f4,_0x12462d[_0x06a1('0x12')]));});});}; \ No newline at end of file +var _0xce1a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetZendeskAccount','options','raw','limit','include','map','model','attributes','then','debug','stringify','catch','ShowZendeskAccount','ZendeskAccount','find','where','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xce1a,0xbf));var _0xace1=function(_0x391476,_0xa2bc64){_0x391476=_0x391476-0x0;var _0x44ace8=_0xce1a[_0x391476];return _0x44ace8;};'use strict';var _=require(_0xace1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xace1('0x1'));var fs=require('fs');var Redis=require(_0xace1('0x2'));var db=require(_0xace1('0x3'))['db'];var utils=require(_0xace1('0x4'));var logger=require(_0xace1('0x5'))('rpc');var config=require(_0xace1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xace1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7c8f64,_0x2203ef,_0x7f3613){return new BPromise(function(_0x576b34,_0x495cff){return client[_0xace1('0x8')](_0x7c8f64,_0x7f3613)['then'](function(_0x3c8579){logger[_0xace1('0x9')](_0xace1('0xa'),_0x2203ef,_0xace1('0xb'));logger['debug'](_0xace1('0xc'),_0x2203ef,_0xace1('0xb'),JSON['stringify'](_0x3c8579));if(_0x3c8579[_0xace1('0xd')]){if(_0x3c8579[_0xace1('0xd')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2203ef,_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);return _0x495cff(_0x3c8579[_0xace1('0xd')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2203ef,_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);return _0x576b34(_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);}else{logger[_0xace1('0x9')](_0xace1('0xa'),_0x2203ef,_0xace1('0xb'));_0x576b34(_0x3c8579[_0xace1('0xf')]['message']);}})['catch'](function(_0x42dd0e){logger[_0xace1('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x2203ef,_0x42dd0e);_0x495cff(_0x42dd0e);});});}exports[_0xace1('0x10')]=function(_0x162a79){var _0x377507=this;return new Promise(function(_0x45541e,_0x28ab49){return db['ZendeskAccount']['findAll']({'raw':_0x162a79[_0xace1('0x11')]?_0x162a79['options'][_0xace1('0x12')]===undefined?!![]:![]:!![],'where':_0x162a79[_0xace1('0x11')]?_0x162a79[_0xace1('0x11')]['where']||null:null,'attributes':_0x162a79[_0xace1('0x11')]?_0x162a79[_0xace1('0x11')]['attributes']||null:null,'limit':_0x162a79[_0xace1('0x11')]?_0x162a79[_0xace1('0x11')][_0xace1('0x13')]||null:null,'include':_0x162a79[_0xace1('0x11')]?_0x162a79[_0xace1('0x11')][_0xace1('0x14')]?_[_0xace1('0x15')](_0x162a79[_0xace1('0x11')][_0xace1('0x14')],function(_0x120c33){return{'model':db[_0x120c33[_0xace1('0x16')]],'as':_0x120c33['as'],'attributes':_0x120c33[_0xace1('0x17')],'include':_0x120c33[_0xace1('0x14')]?_[_0xace1('0x15')](_0x120c33['include'],function(_0x5e99f5){return{'model':db[_0x5e99f5[_0xace1('0x16')]],'as':_0x5e99f5['as'],'attributes':_0x5e99f5[_0xace1('0x17')],'include':_0x5e99f5[_0xace1('0x14')]?_['map'](_0x5e99f5[_0xace1('0x14')],function(_0x51ab2c){return{'model':db[_0x51ab2c[_0xace1('0x16')]],'as':_0x51ab2c['as'],'attributes':_0x51ab2c[_0xace1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xace1('0x18')](function(_0x15ca0d){logger['info']('GetZendeskAccount',_0x162a79);logger[_0xace1('0x19')](_0xace1('0x10'),_0x162a79,JSON[_0xace1('0x1a')](_0x15ca0d));_0x45541e(_0x15ca0d);})[_0xace1('0x1b')](function(_0x4f52a9){logger['error'](_0xace1('0x10'),_0x4f52a9[_0xace1('0xe')],_0x162a79);_0x28ab49(_0x377507[_0xace1('0xd')](0x1f4,_0x4f52a9[_0xace1('0xe')]));});});};exports[_0xace1('0x1c')]=function(_0xca9f7d){var _0x356a8e=this;return new Promise(function(_0x9b5560,_0xf78389){return db[_0xace1('0x1d')][_0xace1('0x1e')]({'raw':_0xca9f7d[_0xace1('0x11')]?_0xca9f7d[_0xace1('0x11')][_0xace1('0x12')]===undefined?!![]:![]:!![],'where':_0xca9f7d['options']?_0xca9f7d['options'][_0xace1('0x1f')]||null:null,'attributes':_0xca9f7d['options']?_0xca9f7d[_0xace1('0x11')][_0xace1('0x17')]||null:null,'include':_0xca9f7d[_0xace1('0x11')]?_0xca9f7d[_0xace1('0x11')][_0xace1('0x14')]?_[_0xace1('0x15')](_0xca9f7d['options'][_0xace1('0x14')],function(_0x3182a4){return{'model':db[_0x3182a4[_0xace1('0x16')]],'as':_0x3182a4['as'],'attributes':_0x3182a4['attributes'],'include':_0x3182a4['include']?_[_0xace1('0x15')](_0x3182a4[_0xace1('0x14')],function(_0x28b8e6){return{'model':db[_0x28b8e6[_0xace1('0x16')]],'as':_0x28b8e6['as'],'attributes':_0x28b8e6[_0xace1('0x17')],'include':_0x28b8e6[_0xace1('0x14')]?_[_0xace1('0x15')](_0x28b8e6[_0xace1('0x14')],function(_0x3c81bb){return{'model':db[_0x3c81bb[_0xace1('0x16')]],'as':_0x3c81bb['as'],'attributes':_0x3c81bb[_0xace1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xace1('0x18')](function(_0x374a11){logger['info']('ShowZendeskAccount',_0xca9f7d);logger['debug'](_0xace1('0x1c'),_0xca9f7d,JSON[_0xace1('0x1a')](_0x374a11));_0x9b5560(_0x374a11);})['catch'](function(_0x3aee99){logger[_0xace1('0xd')](_0xace1('0x1c'),_0x3aee99[_0xace1('0xe')],_0xca9f7d);_0xf78389(_0x356a8e[_0xace1('0xd')](0x1f4,_0x3aee99['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d6332b7..2db55a3 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 _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x368542,_0x15a971){var _0x56cf8f=function(_0x2141dd){while(--_0x2141dd){_0x368542['push'](_0x368542['shift']());}};_0x56cf8f(++_0x15a971);}(_0x087b,0x11a));var _0xb087=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x087b[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x207907,_0x257ace){var _0x13c31a=function(_0x2b7294){while(--_0x2b7294){_0x207907['push'](_0x207907['shift']());}};_0x13c31a(++_0x257ace);}(_0x757a,0xde));var _0xa757=function(_0x420b23,_0x376c76){_0x420b23=_0x420b23-0x0;var _0x14a571=_0x757a[_0x420b23];return _0x14a571;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4c31a8f..a48a5c2 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 _0x504a=['exports','STRING'];(function(_0x2dd2ca,_0x3f4560){var _0x3bd7aa=function(_0x10e8f5){while(--_0x10e8f5){_0x2dd2ca['push'](_0x2dd2ca['shift']());}};_0x3bd7aa(++_0x3f4560);}(_0x504a,0x1ba));var _0xa504=function(_0x5b17fb,_0x62f3cf){_0x5b17fb=_0x5b17fb-0x0;var _0x5cf80b=_0x504a[_0x5b17fb];return _0x5cf80b;};'use strict';var Sequelize=require('sequelize');module[_0xa504('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa504('0x1')]}}; \ No newline at end of file +var _0x4e61=['STRING','sequelize','exports'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0x4e61,0x118));var _0x14e6=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x4e61[_0x1551af];return _0xd8eb82;};'use strict';var Sequelize=require(_0x14e6('0x0'));module[_0x14e6('0x1')]={'name':{'type':Sequelize[_0x14e6('0x2')]},'description':{'type':Sequelize[_0x14e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 8c1d704..d5f881e 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 _0xbdfc=['error','stack','name','send','map','ZendeskConfiguration','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','body','params','getFields','ZendeskField','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x457d01,_0x35a354){var _0x107051=function(_0x199699){while(--_0x199699){_0x457d01['push'](_0x457d01['shift']());}};_0x107051(++_0x35a354);}(_0xbdfc,0x1d6));var _0xcbdf=function(_0x3e95e0,_0x814112){_0x3e95e0=_0x3e95e0-0x0;var _0x2761fb=_0xbdfc[_0x3e95e0];return _0x2761fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcbdf('0x0'));var jsonpatch=require(_0xcbdf('0x1'));var rp=require(_0xcbdf('0x2'));var moment=require('moment');var BPromise=require(_0xcbdf('0x3'));var Mustache=require(_0xcbdf('0x4'));var util=require(_0xcbdf('0x5'));var path=require(_0xcbdf('0x6'));var sox=require(_0xcbdf('0x7'));var csv=require('to-csv');var ejs=require(_0xcbdf('0x8'));var fs=require('fs');var fs_extra=require(_0xcbdf('0x9'));var _=require(_0xcbdf('0xa'));var squel=require(_0xcbdf('0xb'));var crypto=require(_0xcbdf('0xc'));var jsforce=require(_0xcbdf('0xd'));var deskjs=require(_0xcbdf('0xe'));var toCsv=require(_0xcbdf('0xf'));var querystring=require(_0xcbdf('0x10'));var Papa=require('papaparse');var Redis=require(_0xcbdf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcbdf('0x12'));var as=require(_0xcbdf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbdf('0x14'))(_0xcbdf('0x15'));var utils=require(_0xcbdf('0x16'));var config=require(_0xcbdf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbdf('0x18'))['db'];function respondWithStatusCode(_0x407858,_0xa5c5ba){_0xa5c5ba=_0xa5c5ba||0xcc;return function(_0x876c2d){if(_0x876c2d){return _0x407858[_0xcbdf('0x19')](_0xa5c5ba);}return _0x407858[_0xcbdf('0x1a')](_0xa5c5ba)[_0xcbdf('0x1b')]();};}function respondWithResult(_0x422b81,_0x24b363){_0x24b363=_0x24b363||0xc8;return function(_0x52b922){if(_0x52b922){return _0x422b81['status'](_0x24b363)['json'](_0x52b922);}};}function respondWithFilteredResult(_0x37d3b0,_0x385712){return function(_0x4589a1){if(_0x4589a1){var _0x4852b7=typeof _0x385712[_0xcbdf('0x1c')]===_0xcbdf('0x1d')&&typeof _0x385712[_0xcbdf('0x1e')]==='undefined';var _0x3bf937=_0x4589a1[_0xcbdf('0x1f')];var _0x48b5fc=_0x4852b7?0x0:_0x385712['offset'];var _0x3f6b1d=_0x4852b7?_0x4589a1[_0xcbdf('0x1f')]:_0x385712['offset']+_0x385712[_0xcbdf('0x1e')];var _0x5e8eab;if(_0x3f6b1d>=_0x3bf937){_0x3f6b1d=_0x3bf937;_0x5e8eab=0xc8;}else{_0x5e8eab=0xce;}_0x37d3b0[_0xcbdf('0x1a')](_0x5e8eab);return _0x37d3b0['set'](_0xcbdf('0x20'),_0x48b5fc+'-'+_0x3f6b1d+'/'+_0x3bf937)[_0xcbdf('0x21')](_0x4589a1);}return null;};}function patchUpdates(_0xaf6925){return function(_0x25e545){try{jsonpatch[_0xcbdf('0x22')](_0x25e545,_0xaf6925,!![]);}catch(_0x465a5b){return BPromise[_0xcbdf('0x23')](_0x465a5b);}return _0x25e545[_0xcbdf('0x24')]();};}function saveUpdates(_0x39a1cb,_0x2e63ae){return function(_0x5892b5){if(_0x5892b5){return _0x5892b5[_0xcbdf('0x25')](_0x39a1cb)[_0xcbdf('0x26')](function(_0x211929){return _0x211929;});}return null;};}function removeEntity(_0x15d58a,_0x20971a){return function(_0xb74b01){if(_0xb74b01){return _0xb74b01[_0xcbdf('0x27')]()[_0xcbdf('0x26')](function(){_0x15d58a[_0xcbdf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca94,_0x28a8b6){return function(_0x34dad0){if(!_0x34dad0){_0x41ca94[_0xcbdf('0x19')](0x194);}return _0x34dad0;};}function handleError(_0x25452b,_0x1ae32d){_0x1ae32d=_0x1ae32d||0x1f4;return function(_0x31b6bf){logger[_0xcbdf('0x28')](_0x31b6bf[_0xcbdf('0x29')]);if(_0x31b6bf[_0xcbdf('0x2a')]){delete _0x31b6bf[_0xcbdf('0x2a')];}_0x25452b[_0xcbdf('0x1a')](_0x1ae32d)[_0xcbdf('0x2b')](_0x31b6bf);};}exports['index']=function(_0x51c1de,_0x144e30){var _0x28f5b0={},_0x386825={},_0x5562fe={'count':0x0,'rows':[]};var _0x146ddd=_[_0xcbdf('0x2c')](db[_0xcbdf('0x2d')]['rawAttributes'],function(_0x58ef96){return{'name':_0x58ef96['fieldName'],'type':_0x58ef96[_0xcbdf('0x2e')][_0xcbdf('0x2f')]};});_0x386825[_0xcbdf('0x30')]=_['map'](_0x146ddd,_0xcbdf('0x2a'));_0x386825['query']=_[_0xcbdf('0x31')](_0x51c1de[_0xcbdf('0x32')]);_0x386825['filters']=_[_0xcbdf('0x33')](_0x386825[_0xcbdf('0x30')],_0x386825[_0xcbdf('0x32')]);_0x28f5b0[_0xcbdf('0x34')]=_['intersection'](_0x386825[_0xcbdf('0x30')],qs[_0xcbdf('0x35')](_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x28f5b0[_0xcbdf('0x34')]=_0x28f5b0[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x28f5b0[_0xcbdf('0x34')]:_0x386825[_0xcbdf('0x30')];if(!_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x37')](_0xcbdf('0x38'))){_0x28f5b0[_0xcbdf('0x1e')]=qs['limit'](_0x51c1de['query'][_0xcbdf('0x1e')]);_0x28f5b0[_0xcbdf('0x1c')]=qs[_0xcbdf('0x1c')](_0x51c1de[_0xcbdf('0x32')]['offset']);}_0x28f5b0[_0xcbdf('0x39')]=qs[_0xcbdf('0x3a')](_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x3a')]);_0x28f5b0[_0xcbdf('0x3b')]=qs[_0xcbdf('0x3c')](_[_0xcbdf('0x3d')](_0x51c1de['query'],_0x386825[_0xcbdf('0x3c')]),_0x146ddd);if(_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x3e')]){_0x28f5b0['where']=_[_0xcbdf('0x3f')](_0x28f5b0[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x146ddd,function(_0x578d5e){if(_0x578d5e[_0xcbdf('0x2e')]!==_0xcbdf('0x40')){var _0x67e75f={};_0x67e75f[_0x578d5e[_0xcbdf('0x2a')]]={'$like':'%'+_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x67e75f;}})});}_0x28f5b0=_['merge']({},_0x28f5b0,_0x51c1de[_0xcbdf('0x41')]);var _0x443d86={'where':_0x28f5b0[_0xcbdf('0x3b')]};return db['ZendeskConfiguration'][_0xcbdf('0x1f')](_0x443d86)['then'](function(_0x2b3476){_0x5562fe[_0xcbdf('0x1f')]=_0x2b3476;if(_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x42')]){_0x28f5b0[_0xcbdf('0x43')]=[{'all':!![]}];}return db[_0xcbdf('0x2d')][_0xcbdf('0x44')](_0x28f5b0);})[_0xcbdf('0x26')](function(_0x489b7d){_0x5562fe[_0xcbdf('0x45')]=_0x489b7d;return _0x5562fe;})[_0xcbdf('0x26')](respondWithFilteredResult(_0x144e30,_0x28f5b0))['catch'](handleError(_0x144e30,null));};exports[_0xcbdf('0x46')]=function(_0x39baa4,_0x21cb99){var _0x162c8b={'raw':![],'where':{'id':_0x39baa4['params']['id']}},_0x18db2d={};_0x18db2d[_0xcbdf('0x30')]=_[_0xcbdf('0x31')](db[_0xcbdf('0x2d')][_0xcbdf('0x47')]);_0x18db2d[_0xcbdf('0x32')]=_[_0xcbdf('0x31')](_0x39baa4['query']);_0x18db2d[_0xcbdf('0x3c')]=_['intersection'](_0x18db2d[_0xcbdf('0x30')],_0x18db2d[_0xcbdf('0x32')]);_0x162c8b[_0xcbdf('0x34')]=_[_0xcbdf('0x33')](_0x18db2d[_0xcbdf('0x30')],qs[_0xcbdf('0x35')](_0x39baa4['query'][_0xcbdf('0x35')]));_0x162c8b[_0xcbdf('0x34')]=_0x162c8b[_0xcbdf('0x34')]['length']?_0x162c8b[_0xcbdf('0x34')]:_0x18db2d[_0xcbdf('0x30')];if(_0x39baa4[_0xcbdf('0x32')][_0xcbdf('0x42')]){_0x162c8b[_0xcbdf('0x43')]=[{'all':!![]}];}_0x162c8b=_[_0xcbdf('0x3f')]({},_0x162c8b,_0x39baa4[_0xcbdf('0x41')]);return db[_0xcbdf('0x2d')][_0xcbdf('0x48')](_0x162c8b)['then'](handleEntityNotFound(_0x21cb99,null))[_0xcbdf('0x26')](respondWithResult(_0x21cb99,null))[_0xcbdf('0x49')](handleError(_0x21cb99,null));};exports['create']=function(_0x4b6d7b,_0x1e755c){return db[_0xcbdf('0x2d')]['create'](_0x4b6d7b[_0xcbdf('0x4a')],{})[_0xcbdf('0x26')](respondWithResult(_0x1e755c,0xc9))['catch'](handleError(_0x1e755c,null));};exports[_0xcbdf('0x25')]=function(_0x2b2418,_0x2211ea){if(_0x2b2418[_0xcbdf('0x4a')]['id']){delete _0x2b2418[_0xcbdf('0x4a')]['id'];}return db[_0xcbdf('0x2d')][_0xcbdf('0x48')]({'where':{'id':_0x2b2418['params']['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x2211ea,null))[_0xcbdf('0x26')](saveUpdates(_0x2b2418[_0xcbdf('0x4a')],null))[_0xcbdf('0x26')](respondWithResult(_0x2211ea,null))[_0xcbdf('0x49')](handleError(_0x2211ea,null));};exports[_0xcbdf('0x27')]=function(_0x2fd414,_0x2e6551){return db[_0xcbdf('0x2d')][_0xcbdf('0x48')]({'where':{'id':_0x2fd414[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x2e6551,null))['then'](removeEntity(_0x2e6551,null))[_0xcbdf('0x49')](handleError(_0x2e6551,null));};exports[_0xcbdf('0x4c')]=function(_0x2117c4,_0xd58707,_0x2e2ffa){var _0x22e16f={};var _0x4b7840={};var _0x132f3c;var _0x3c051a;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2117c4[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0xd58707,null))[_0xcbdf('0x26')](function(_0x58b530){if(_0x58b530){_0x132f3c=_0x58b530;_0x4b7840['model']=_[_0xcbdf('0x31')](db[_0xcbdf('0x4d')]['rawAttributes']);_0x4b7840['query']=_[_0xcbdf('0x31')](_0x2117c4[_0xcbdf('0x32')]);_0x4b7840[_0xcbdf('0x3c')]=_[_0xcbdf('0x33')](_0x4b7840[_0xcbdf('0x30')],_0x4b7840[_0xcbdf('0x32')]);_0x22e16f[_0xcbdf('0x34')]=_[_0xcbdf('0x33')](_0x4b7840[_0xcbdf('0x30')],qs['fields'](_0x2117c4[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x22e16f[_0xcbdf('0x34')]=_0x22e16f[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x22e16f['attributes']:_0x4b7840['model'];_0x22e16f[_0xcbdf('0x39')]=qs['sort'](_0x2117c4['query'][_0xcbdf('0x3a')]);_0x22e16f[_0xcbdf('0x3b')]=qs['filters'](_[_0xcbdf('0x3d')](_0x2117c4[_0xcbdf('0x32')],_0x4b7840[_0xcbdf('0x3c')]));if(_0x2117c4[_0xcbdf('0x32')][_0xcbdf('0x3e')]){_0x22e16f[_0xcbdf('0x3b')]=_['merge'](_0x22e16f['where'],{'$or':_[_0xcbdf('0x2c')](_0x22e16f['attributes'],function(_0x1f56ac){var _0x3b027a={};_0x3b027a[_0x1f56ac]={'$like':'%'+_0x2117c4[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x3b027a;})});}_0x22e16f=_[_0xcbdf('0x3f')]({},_0x22e16f,_0x2117c4[_0xcbdf('0x41')]);return _0x132f3c[_0xcbdf('0x4c')](_0x22e16f);}})['then'](function(_0x5bb74d){if(_0x5bb74d){_0x3c051a=_0x5bb74d[_0xcbdf('0x36')];if(!_0x2117c4[_0xcbdf('0x32')]['hasOwnProperty']('nolimit')){_0x22e16f['limit']=qs[_0xcbdf('0x1e')](_0x2117c4[_0xcbdf('0x32')]['limit']);_0x22e16f[_0xcbdf('0x1c')]=qs['offset'](_0x2117c4['query'][_0xcbdf('0x1c')]);}return _0x132f3c['getFields'](_0x22e16f);}})['then'](function(_0x36038a){if(_0x36038a){return _0x36038a?{'count':_0x3c051a,'rows':_0x36038a}:null;}})[_0xcbdf('0x26')](respondWithResult(_0xd58707,null))[_0xcbdf('0x49')](handleError(_0xd58707,null));};exports['getSubjects']=function(_0x3eb99c,_0x235814,_0x52a898){var _0x2c13c6={};var _0x364221={};var _0x482b08;var _0x3cd8a1;return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x3eb99c[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x235814,null))[_0xcbdf('0x26')](function(_0xaa6b50){if(_0xaa6b50){_0x482b08=_0xaa6b50;_0x364221['model']=_[_0xcbdf('0x31')](db[_0xcbdf('0x4d')]['rawAttributes']);_0x364221[_0xcbdf('0x32')]=_[_0xcbdf('0x31')](_0x3eb99c[_0xcbdf('0x32')]);_0x364221[_0xcbdf('0x3c')]=_[_0xcbdf('0x33')](_0x364221[_0xcbdf('0x30')],_0x364221['query']);_0x2c13c6[_0xcbdf('0x34')]=_[_0xcbdf('0x33')](_0x364221['model'],qs[_0xcbdf('0x35')](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x2c13c6['attributes']=_0x2c13c6[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x2c13c6['attributes']:_0x364221[_0xcbdf('0x30')];_0x2c13c6[_0xcbdf('0x39')]=qs[_0xcbdf('0x3a')](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x3a')]);_0x2c13c6[_0xcbdf('0x3b')]=qs[_0xcbdf('0x3c')](_[_0xcbdf('0x3d')](_0x3eb99c[_0xcbdf('0x32')],_0x364221[_0xcbdf('0x3c')]));if(_0x3eb99c['query'][_0xcbdf('0x3e')]){_0x2c13c6[_0xcbdf('0x3b')]=_[_0xcbdf('0x3f')](_0x2c13c6[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x2c13c6['attributes'],function(_0xadf6a9){var _0x22178b={};_0x22178b[_0xadf6a9]={'$like':'%'+_0x3eb99c[_0xcbdf('0x32')]['filter']+'%'};return _0x22178b;})});}_0x2c13c6=_[_0xcbdf('0x3f')]({},_0x2c13c6,_0x3eb99c[_0xcbdf('0x41')]);return _0x482b08[_0xcbdf('0x4f')](_0x2c13c6);}})[_0xcbdf('0x26')](function(_0x4be739){if(_0x4be739){_0x3cd8a1=_0x4be739[_0xcbdf('0x36')];if(!_0x3eb99c['query'][_0xcbdf('0x37')](_0xcbdf('0x38'))){_0x2c13c6['limit']=qs[_0xcbdf('0x1e')](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x1e')]);_0x2c13c6[_0xcbdf('0x1c')]=qs['offset'](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x1c')]);}return _0x482b08[_0xcbdf('0x4f')](_0x2c13c6);}})[_0xcbdf('0x26')](function(_0xb7607c){if(_0xb7607c){return _0xb7607c?{'count':_0x3cd8a1,'rows':_0xb7607c}:null;}})['then'](respondWithResult(_0x235814,null))[_0xcbdf('0x49')](handleError(_0x235814,null));};exports[_0xcbdf('0x50')]=function(_0x527839,_0x1930bd,_0x46c81f){var _0x140737={};var _0xbae3b1={};var _0x131d9f;var _0x27d03a;return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x527839['params']['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x1930bd,null))['then'](function(_0x3bc87c){if(_0x3bc87c){_0x131d9f=_0x3bc87c;_0xbae3b1[_0xcbdf('0x30')]=_[_0xcbdf('0x31')](db['ZendeskField'][_0xcbdf('0x47')]);_0xbae3b1['query']=_[_0xcbdf('0x31')](_0x527839[_0xcbdf('0x32')]);_0xbae3b1['filters']=_[_0xcbdf('0x33')](_0xbae3b1[_0xcbdf('0x30')],_0xbae3b1['query']);_0x140737['attributes']=_[_0xcbdf('0x33')](_0xbae3b1['model'],qs[_0xcbdf('0x35')](_0x527839[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x140737[_0xcbdf('0x34')]=_0x140737['attributes'][_0xcbdf('0x36')]?_0x140737[_0xcbdf('0x34')]:_0xbae3b1[_0xcbdf('0x30')];_0x140737['order']=qs[_0xcbdf('0x3a')](_0x527839[_0xcbdf('0x32')][_0xcbdf('0x3a')]);_0x140737[_0xcbdf('0x3b')]=qs['filters'](_[_0xcbdf('0x3d')](_0x527839[_0xcbdf('0x32')],_0xbae3b1[_0xcbdf('0x3c')]));if(_0x527839['query'][_0xcbdf('0x3e')]){_0x140737[_0xcbdf('0x3b')]=_['merge'](_0x140737[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x140737[_0xcbdf('0x34')],function(_0x548a1f){var _0x885456={};_0x885456[_0x548a1f]={'$like':'%'+_0x527839[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x885456;})});}_0x140737=_[_0xcbdf('0x3f')]({},_0x140737,_0x527839['options']);return _0x131d9f[_0xcbdf('0x50')](_0x140737);}})['then'](function(_0x3a5ec6){if(_0x3a5ec6){_0x27d03a=_0x3a5ec6[_0xcbdf('0x36')];if(!_0x527839[_0xcbdf('0x32')]['hasOwnProperty'](_0xcbdf('0x38'))){_0x140737[_0xcbdf('0x1e')]=qs[_0xcbdf('0x1e')](_0x527839[_0xcbdf('0x32')]['limit']);_0x140737[_0xcbdf('0x1c')]=qs['offset'](_0x527839['query'][_0xcbdf('0x1c')]);}return _0x131d9f['getDescriptions'](_0x140737);}})[_0xcbdf('0x26')](function(_0x1a295e){if(_0x1a295e){return _0x1a295e?{'count':_0x27d03a,'rows':_0x1a295e}:null;}})[_0xcbdf('0x26')](respondWithResult(_0x1930bd,null))[_0xcbdf('0x49')](handleError(_0x1930bd,null));};exports[_0xcbdf('0x51')]=function(_0x26f0ce,_0x21bc37,_0x27523c){var _0x4ea5af={};var _0x2a84c6={};var _0x3e20b3;var _0x2e462f;return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x26f0ce[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x21bc37,null))[_0xcbdf('0x26')](function(_0x1c2161){if(_0x1c2161){_0x3e20b3=_0x1c2161;_0x2a84c6[_0xcbdf('0x30')]=_[_0xcbdf('0x31')](db[_0xcbdf('0x52')][_0xcbdf('0x47')]);_0x2a84c6[_0xcbdf('0x32')]=_[_0xcbdf('0x31')](_0x26f0ce['query']);_0x2a84c6[_0xcbdf('0x3c')]=_[_0xcbdf('0x33')](_0x2a84c6[_0xcbdf('0x30')],_0x2a84c6['query']);_0x4ea5af['attributes']=_[_0xcbdf('0x33')](_0x2a84c6[_0xcbdf('0x30')],qs[_0xcbdf('0x35')](_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x4ea5af['attributes']=_0x4ea5af[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x4ea5af[_0xcbdf('0x34')]:_0x2a84c6[_0xcbdf('0x30')];_0x4ea5af[_0xcbdf('0x39')]=qs[_0xcbdf('0x3a')](_0x26f0ce[_0xcbdf('0x32')]['sort']);_0x4ea5af[_0xcbdf('0x3b')]=qs[_0xcbdf('0x3c')](_[_0xcbdf('0x3d')](_0x26f0ce['query'],_0x2a84c6['filters']));if(_0x26f0ce[_0xcbdf('0x32')]['filter']){_0x4ea5af[_0xcbdf('0x3b')]=_['merge'](_0x4ea5af[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x4ea5af['attributes'],function(_0x92b15c){var _0x2ef7f8={};_0x2ef7f8[_0x92b15c]={'$like':'%'+_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x2ef7f8;})});}_0x4ea5af=_[_0xcbdf('0x3f')]({},_0x4ea5af,_0x26f0ce[_0xcbdf('0x41')]);return _0x3e20b3[_0xcbdf('0x51')](_0x4ea5af);}})['then'](function(_0x2d9882){if(_0x2d9882){_0x2e462f=_0x2d9882[_0xcbdf('0x36')];if(!_0x26f0ce['query'][_0xcbdf('0x37')](_0xcbdf('0x38'))){_0x4ea5af[_0xcbdf('0x1e')]=qs[_0xcbdf('0x1e')](_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x1e')]);_0x4ea5af[_0xcbdf('0x1c')]=qs['offset'](_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x1c')]);}return _0x3e20b3['getTags'](_0x4ea5af);}})[_0xcbdf('0x26')](function(_0x5499b3){if(_0x5499b3){return _0x5499b3?{'count':_0x2e462f,'rows':_0x5499b3}:null;}})[_0xcbdf('0x26')](respondWithResult(_0x21bc37,null))[_0xcbdf('0x49')](handleError(_0x21bc37,null));};exports[_0xcbdf('0x53')]=function(_0x3948bf,_0x3c063e,_0x56c826){if(_0x3948bf[_0xcbdf('0x4a')]['id']){delete _0x3948bf['body']['id'];}return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x3948bf[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x3c063e,null))[_0xcbdf('0x26')](function(_0x3a0aae){if(_0x3a0aae){return _0x3a0aae['setTags'](_0x3948bf['body'][_0xcbdf('0x54')]||[]);}return null;})[_0xcbdf('0x26')](respondWithResult(_0x3c063e,null))[_0xcbdf('0x49')](handleError(_0x3c063e,null));}; \ No newline at end of file +var _0x9a06=['attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','create','body','find','getFields','findOne','ZendeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys'];(function(_0x1dbeab,_0x19cc2b){var _0xdf2ba6=function(_0x57e6ec){while(--_0x57e6ec){_0x1dbeab['push'](_0x1dbeab['shift']());}};_0xdf2ba6(++_0x19cc2b);}(_0x9a06,0xc4));var _0x69a0=function(_0x1ead82,_0x45ee42){_0x1ead82=_0x1ead82-0x0;var _0x28ea3e=_0x9a06[_0x1ead82];return _0x28ea3e;};'use strict';var emlformat=require(_0x69a0('0x0'));var rimraf=require(_0x69a0('0x1'));var zipdir=require(_0x69a0('0x2'));var jsonpatch=require(_0x69a0('0x3'));var rp=require(_0x69a0('0x4'));var moment=require(_0x69a0('0x5'));var BPromise=require(_0x69a0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x69a0('0x7'));var sox=require(_0x69a0('0x8'));var csv=require('to-csv');var ejs=require(_0x69a0('0x9'));var fs=require('fs');var fs_extra=require(_0x69a0('0xa'));var _=require(_0x69a0('0xb'));var squel=require('squel');var crypto=require(_0x69a0('0xc'));var jsforce=require(_0x69a0('0xd'));var deskjs=require(_0x69a0('0xe'));var toCsv=require(_0x69a0('0xf'));var querystring=require(_0x69a0('0x10'));var Papa=require(_0x69a0('0x11'));var Redis=require('ioredis');var authService=require(_0x69a0('0x12'));var qs=require(_0x69a0('0x13'));var as=require(_0x69a0('0x14'));var hardwareService=require(_0x69a0('0x15'));var logger=require(_0x69a0('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69a0('0x17'))['db'];function respondWithStatusCode(_0xea967c,_0x410310){_0x410310=_0x410310||0xcc;return function(_0x2c80b2){if(_0x2c80b2){return _0xea967c[_0x69a0('0x18')](_0x410310);}return _0xea967c[_0x69a0('0x19')](_0x410310)[_0x69a0('0x1a')]();};}function respondWithResult(_0x404af5,_0x581219){_0x581219=_0x581219||0xc8;return function(_0xc6d5b8){if(_0xc6d5b8){return _0x404af5[_0x69a0('0x19')](_0x581219)[_0x69a0('0x1b')](_0xc6d5b8);}};}function respondWithFilteredResult(_0x41ac95,_0x31d4ca){return function(_0x1d32a7){if(_0x1d32a7){var _0x1ac094=typeof _0x31d4ca[_0x69a0('0x1c')]===_0x69a0('0x1d')&&typeof _0x31d4ca[_0x69a0('0x1e')]==='undefined';var _0x5493e1=_0x1d32a7[_0x69a0('0x1f')];var _0x5eae74=_0x1ac094?0x0:_0x31d4ca[_0x69a0('0x1c')];var _0xca9218=_0x1ac094?_0x1d32a7[_0x69a0('0x1f')]:_0x31d4ca[_0x69a0('0x1c')]+_0x31d4ca[_0x69a0('0x1e')];var _0x449d74;if(_0xca9218>=_0x5493e1){_0xca9218=_0x5493e1;_0x449d74=0xc8;}else{_0x449d74=0xce;}_0x41ac95[_0x69a0('0x19')](_0x449d74);return _0x41ac95[_0x69a0('0x20')]('Content-Range',_0x5eae74+'-'+_0xca9218+'/'+_0x5493e1)['json'](_0x1d32a7);}return null;};}function patchUpdates(_0x559fe1){return function(_0x43cb29){try{jsonpatch[_0x69a0('0x21')](_0x43cb29,_0x559fe1,!![]);}catch(_0x110b6e){return BPromise[_0x69a0('0x22')](_0x110b6e);}return _0x43cb29['save']();};}function saveUpdates(_0x34c827,_0x1ce39e){return function(_0x32d970){if(_0x32d970){return _0x32d970[_0x69a0('0x23')](_0x34c827)[_0x69a0('0x24')](function(_0x47a9f6){return _0x47a9f6;});}return null;};}function removeEntity(_0x1aba28,_0x27844e){return function(_0x3ec2b3){if(_0x3ec2b3){return _0x3ec2b3[_0x69a0('0x25')]()['then'](function(){_0x1aba28['status'](0xcc)[_0x69a0('0x1a')]();});}};}function handleEntityNotFound(_0x932dc2,_0x30f7bf){return function(_0x279360){if(!_0x279360){_0x932dc2[_0x69a0('0x18')](0x194);}return _0x279360;};}function handleError(_0x3e3dac,_0x40929a){_0x40929a=_0x40929a||0x1f4;return function(_0x2f5da9){logger[_0x69a0('0x26')](_0x2f5da9[_0x69a0('0x27')]);if(_0x2f5da9[_0x69a0('0x28')]){delete _0x2f5da9[_0x69a0('0x28')];}_0x3e3dac[_0x69a0('0x19')](_0x40929a)[_0x69a0('0x29')](_0x2f5da9);};}exports['index']=function(_0x168663,_0x45dbec){var _0x11494d={},_0x8ebe3f={},_0x134555={'count':0x0,'rows':[]};var _0x1f5dbd=_['map'](db[_0x69a0('0x2a')][_0x69a0('0x2b')],function(_0x3fe064){return{'name':_0x3fe064[_0x69a0('0x2c')],'type':_0x3fe064['type'][_0x69a0('0x2d')]};});_0x8ebe3f[_0x69a0('0x2e')]=_[_0x69a0('0x2f')](_0x1f5dbd,_0x69a0('0x28'));_0x8ebe3f[_0x69a0('0x30')]=_[_0x69a0('0x31')](_0x168663[_0x69a0('0x30')]);_0x8ebe3f['filters']=_['intersection'](_0x8ebe3f['model'],_0x8ebe3f[_0x69a0('0x30')]);_0x11494d[_0x69a0('0x32')]=_[_0x69a0('0x33')](_0x8ebe3f[_0x69a0('0x2e')],qs[_0x69a0('0x34')](_0x168663[_0x69a0('0x30')]['fields']));_0x11494d[_0x69a0('0x32')]=_0x11494d[_0x69a0('0x32')][_0x69a0('0x35')]?_0x11494d[_0x69a0('0x32')]:_0x8ebe3f[_0x69a0('0x2e')];if(!_0x168663[_0x69a0('0x30')][_0x69a0('0x36')]('nolimit')){_0x11494d[_0x69a0('0x1e')]=qs[_0x69a0('0x1e')](_0x168663[_0x69a0('0x30')][_0x69a0('0x1e')]);_0x11494d[_0x69a0('0x1c')]=qs[_0x69a0('0x1c')](_0x168663[_0x69a0('0x30')][_0x69a0('0x1c')]);}_0x11494d['order']=qs[_0x69a0('0x37')](_0x168663['query']['sort']);_0x11494d[_0x69a0('0x38')]=qs[_0x69a0('0x39')](_[_0x69a0('0x3a')](_0x168663[_0x69a0('0x30')],_0x8ebe3f[_0x69a0('0x39')]),_0x1f5dbd);if(_0x168663['query'][_0x69a0('0x3b')]){_0x11494d['where']=_[_0x69a0('0x3c')](_0x11494d['where'],{'$or':_['map'](_0x1f5dbd,function(_0x3d10d9){if(_0x3d10d9[_0x69a0('0x3d')]!=='VIRTUAL'){var _0x2e6e57={};_0x2e6e57[_0x3d10d9[_0x69a0('0x28')]]={'$like':'%'+_0x168663[_0x69a0('0x30')]['filter']+'%'};return _0x2e6e57;}})});}_0x11494d=_['merge']({},_0x11494d,_0x168663[_0x69a0('0x3e')]);var _0x1541ac={'where':_0x11494d['where']};return db[_0x69a0('0x2a')]['count'](_0x1541ac)['then'](function(_0x377d0c){_0x134555[_0x69a0('0x1f')]=_0x377d0c;if(_0x168663[_0x69a0('0x30')][_0x69a0('0x3f')]){_0x11494d[_0x69a0('0x40')]=[{'all':!![]}];}return db[_0x69a0('0x2a')][_0x69a0('0x41')](_0x11494d);})[_0x69a0('0x24')](function(_0x2097bc){_0x134555['rows']=_0x2097bc;return _0x134555;})[_0x69a0('0x24')](respondWithFilteredResult(_0x45dbec,_0x11494d))[_0x69a0('0x42')](handleError(_0x45dbec,null));};exports['show']=function(_0xaba50d,_0x59d380){var _0x10e238={'raw':![],'where':{'id':_0xaba50d[_0x69a0('0x43')]['id']}},_0x56e7b2={};_0x56e7b2['model']=_[_0x69a0('0x31')](db['ZendeskConfiguration'][_0x69a0('0x2b')]);_0x56e7b2[_0x69a0('0x30')]=_['keys'](_0xaba50d[_0x69a0('0x30')]);_0x56e7b2[_0x69a0('0x39')]=_[_0x69a0('0x33')](_0x56e7b2[_0x69a0('0x2e')],_0x56e7b2[_0x69a0('0x30')]);_0x10e238['attributes']=_['intersection'](_0x56e7b2[_0x69a0('0x2e')],qs['fields'](_0xaba50d[_0x69a0('0x30')][_0x69a0('0x34')]));_0x10e238[_0x69a0('0x32')]=_0x10e238[_0x69a0('0x32')]['length']?_0x10e238[_0x69a0('0x32')]:_0x56e7b2[_0x69a0('0x2e')];if(_0xaba50d[_0x69a0('0x30')][_0x69a0('0x3f')]){_0x10e238[_0x69a0('0x40')]=[{'all':!![]}];}_0x10e238=_[_0x69a0('0x3c')]({},_0x10e238,_0xaba50d[_0x69a0('0x3e')]);return db['ZendeskConfiguration']['find'](_0x10e238)['then'](handleEntityNotFound(_0x59d380,null))['then'](respondWithResult(_0x59d380,null))[_0x69a0('0x42')](handleError(_0x59d380,null));};exports[_0x69a0('0x44')]=function(_0x2e7485,_0x1f863d){return db[_0x69a0('0x2a')][_0x69a0('0x44')](_0x2e7485['body'],{})[_0x69a0('0x24')](respondWithResult(_0x1f863d,0xc9))[_0x69a0('0x42')](handleError(_0x1f863d,null));};exports[_0x69a0('0x23')]=function(_0x45c7aa,_0x4f3c4a){if(_0x45c7aa['body']['id']){delete _0x45c7aa[_0x69a0('0x45')]['id'];}return db[_0x69a0('0x2a')][_0x69a0('0x46')]({'where':{'id':_0x45c7aa['params']['id']}})[_0x69a0('0x24')](handleEntityNotFound(_0x4f3c4a,null))[_0x69a0('0x24')](saveUpdates(_0x45c7aa[_0x69a0('0x45')],null))[_0x69a0('0x24')](respondWithResult(_0x4f3c4a,null))[_0x69a0('0x42')](handleError(_0x4f3c4a,null));};exports['destroy']=function(_0x28c58e,_0x2a8795){return db[_0x69a0('0x2a')]['find']({'where':{'id':_0x28c58e[_0x69a0('0x43')]['id']}})[_0x69a0('0x24')](handleEntityNotFound(_0x2a8795,null))['then'](removeEntity(_0x2a8795,null))[_0x69a0('0x42')](handleError(_0x2a8795,null));};exports[_0x69a0('0x47')]=function(_0x35db89,_0x1fb369,_0x2f682a){var _0x22385e={};var _0x57d07d={};var _0x2909d3;var _0x1f0224;return db['ZendeskConfiguration'][_0x69a0('0x48')]({'where':{'id':_0x35db89[_0x69a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x1fb369,null))['then'](function(_0x11b6c5){if(_0x11b6c5){_0x2909d3=_0x11b6c5;_0x57d07d[_0x69a0('0x2e')]=_[_0x69a0('0x31')](db[_0x69a0('0x49')][_0x69a0('0x2b')]);_0x57d07d[_0x69a0('0x30')]=_[_0x69a0('0x31')](_0x35db89[_0x69a0('0x30')]);_0x57d07d['filters']=_[_0x69a0('0x33')](_0x57d07d[_0x69a0('0x2e')],_0x57d07d[_0x69a0('0x30')]);_0x22385e[_0x69a0('0x32')]=_[_0x69a0('0x33')](_0x57d07d[_0x69a0('0x2e')],qs[_0x69a0('0x34')](_0x35db89[_0x69a0('0x30')][_0x69a0('0x34')]));_0x22385e['attributes']=_0x22385e[_0x69a0('0x32')][_0x69a0('0x35')]?_0x22385e[_0x69a0('0x32')]:_0x57d07d[_0x69a0('0x2e')];_0x22385e[_0x69a0('0x4a')]=qs[_0x69a0('0x37')](_0x35db89['query'][_0x69a0('0x37')]);_0x22385e[_0x69a0('0x38')]=qs[_0x69a0('0x39')](_[_0x69a0('0x3a')](_0x35db89[_0x69a0('0x30')],_0x57d07d[_0x69a0('0x39')]));if(_0x35db89[_0x69a0('0x30')]['filter']){_0x22385e[_0x69a0('0x38')]=_[_0x69a0('0x3c')](_0x22385e[_0x69a0('0x38')],{'$or':_[_0x69a0('0x2f')](_0x22385e['attributes'],function(_0x584b3c){var _0x3e05ce={};_0x3e05ce[_0x584b3c]={'$like':'%'+_0x35db89[_0x69a0('0x30')][_0x69a0('0x3b')]+'%'};return _0x3e05ce;})});}_0x22385e=_[_0x69a0('0x3c')]({},_0x22385e,_0x35db89[_0x69a0('0x3e')]);return _0x2909d3['getFields'](_0x22385e);}})[_0x69a0('0x24')](function(_0x1bbaa8){if(_0x1bbaa8){_0x1f0224=_0x1bbaa8[_0x69a0('0x35')];if(!_0x35db89[_0x69a0('0x30')][_0x69a0('0x36')](_0x69a0('0x4b'))){_0x22385e[_0x69a0('0x1e')]=qs[_0x69a0('0x1e')](_0x35db89[_0x69a0('0x30')]['limit']);_0x22385e[_0x69a0('0x1c')]=qs['offset'](_0x35db89[_0x69a0('0x30')]['offset']);}return _0x2909d3[_0x69a0('0x47')](_0x22385e);}})[_0x69a0('0x24')](function(_0x37598e){if(_0x37598e){return _0x37598e?{'count':_0x1f0224,'rows':_0x37598e}:null;}})[_0x69a0('0x24')](respondWithResult(_0x1fb369,null))[_0x69a0('0x42')](handleError(_0x1fb369,null));};exports[_0x69a0('0x4c')]=function(_0x119bbb,_0xcd97b8,_0x5e20ef){var _0x2e5446={};var _0x19abf3={};var _0x343802;var _0x5d9727;return db[_0x69a0('0x2a')][_0x69a0('0x48')]({'where':{'id':_0x119bbb[_0x69a0('0x43')]['id']}})[_0x69a0('0x24')](handleEntityNotFound(_0xcd97b8,null))[_0x69a0('0x24')](function(_0x2f75ec){if(_0x2f75ec){_0x343802=_0x2f75ec;_0x19abf3[_0x69a0('0x2e')]=_[_0x69a0('0x31')](db['ZendeskField']['rawAttributes']);_0x19abf3[_0x69a0('0x30')]=_['keys'](_0x119bbb[_0x69a0('0x30')]);_0x19abf3[_0x69a0('0x39')]=_['intersection'](_0x19abf3['model'],_0x19abf3[_0x69a0('0x30')]);_0x2e5446['attributes']=_[_0x69a0('0x33')](_0x19abf3['model'],qs[_0x69a0('0x34')](_0x119bbb[_0x69a0('0x30')][_0x69a0('0x34')]));_0x2e5446[_0x69a0('0x32')]=_0x2e5446['attributes']['length']?_0x2e5446[_0x69a0('0x32')]:_0x19abf3[_0x69a0('0x2e')];_0x2e5446[_0x69a0('0x4a')]=qs['sort'](_0x119bbb['query'][_0x69a0('0x37')]);_0x2e5446['where']=qs[_0x69a0('0x39')](_[_0x69a0('0x3a')](_0x119bbb[_0x69a0('0x30')],_0x19abf3[_0x69a0('0x39')]));if(_0x119bbb['query'][_0x69a0('0x3b')]){_0x2e5446[_0x69a0('0x38')]=_[_0x69a0('0x3c')](_0x2e5446[_0x69a0('0x38')],{'$or':_['map'](_0x2e5446['attributes'],function(_0x435f7d){var _0x4b999d={};_0x4b999d[_0x435f7d]={'$like':'%'+_0x119bbb[_0x69a0('0x30')][_0x69a0('0x3b')]+'%'};return _0x4b999d;})});}_0x2e5446=_[_0x69a0('0x3c')]({},_0x2e5446,_0x119bbb[_0x69a0('0x3e')]);return _0x343802[_0x69a0('0x4c')](_0x2e5446);}})[_0x69a0('0x24')](function(_0x378ab2){if(_0x378ab2){_0x5d9727=_0x378ab2[_0x69a0('0x35')];if(!_0x119bbb[_0x69a0('0x30')][_0x69a0('0x36')]('nolimit')){_0x2e5446[_0x69a0('0x1e')]=qs[_0x69a0('0x1e')](_0x119bbb[_0x69a0('0x30')]['limit']);_0x2e5446[_0x69a0('0x1c')]=qs[_0x69a0('0x1c')](_0x119bbb[_0x69a0('0x30')][_0x69a0('0x1c')]);}return _0x343802[_0x69a0('0x4c')](_0x2e5446);}})[_0x69a0('0x24')](function(_0x4b09a4){if(_0x4b09a4){return _0x4b09a4?{'count':_0x5d9727,'rows':_0x4b09a4}:null;}})[_0x69a0('0x24')](respondWithResult(_0xcd97b8,null))[_0x69a0('0x42')](handleError(_0xcd97b8,null));};exports[_0x69a0('0x4d')]=function(_0x811de7,_0x4da7b3,_0x44b874){var _0x17e4aa={};var _0x13b636={};var _0x1540b2;var _0x19d6f0;return db[_0x69a0('0x2a')]['findOne']({'where':{'id':_0x811de7[_0x69a0('0x43')]['id']}})[_0x69a0('0x24')](handleEntityNotFound(_0x4da7b3,null))[_0x69a0('0x24')](function(_0xf19aa0){if(_0xf19aa0){_0x1540b2=_0xf19aa0;_0x13b636['model']=_['keys'](db[_0x69a0('0x49')][_0x69a0('0x2b')]);_0x13b636[_0x69a0('0x30')]=_['keys'](_0x811de7[_0x69a0('0x30')]);_0x13b636[_0x69a0('0x39')]=_['intersection'](_0x13b636[_0x69a0('0x2e')],_0x13b636['query']);_0x17e4aa[_0x69a0('0x32')]=_[_0x69a0('0x33')](_0x13b636['model'],qs['fields'](_0x811de7['query'][_0x69a0('0x34')]));_0x17e4aa['attributes']=_0x17e4aa[_0x69a0('0x32')][_0x69a0('0x35')]?_0x17e4aa[_0x69a0('0x32')]:_0x13b636['model'];_0x17e4aa[_0x69a0('0x4a')]=qs[_0x69a0('0x37')](_0x811de7[_0x69a0('0x30')]['sort']);_0x17e4aa[_0x69a0('0x38')]=qs[_0x69a0('0x39')](_[_0x69a0('0x3a')](_0x811de7[_0x69a0('0x30')],_0x13b636[_0x69a0('0x39')]));if(_0x811de7['query'][_0x69a0('0x3b')]){_0x17e4aa[_0x69a0('0x38')]=_[_0x69a0('0x3c')](_0x17e4aa[_0x69a0('0x38')],{'$or':_[_0x69a0('0x2f')](_0x17e4aa[_0x69a0('0x32')],function(_0xabbb9a){var _0x1b5d71={};_0x1b5d71[_0xabbb9a]={'$like':'%'+_0x811de7[_0x69a0('0x30')][_0x69a0('0x3b')]+'%'};return _0x1b5d71;})});}_0x17e4aa=_[_0x69a0('0x3c')]({},_0x17e4aa,_0x811de7[_0x69a0('0x3e')]);return _0x1540b2[_0x69a0('0x4d')](_0x17e4aa);}})[_0x69a0('0x24')](function(_0x47585a){if(_0x47585a){_0x19d6f0=_0x47585a['length'];if(!_0x811de7[_0x69a0('0x30')][_0x69a0('0x36')]('nolimit')){_0x17e4aa[_0x69a0('0x1e')]=qs['limit'](_0x811de7[_0x69a0('0x30')][_0x69a0('0x1e')]);_0x17e4aa[_0x69a0('0x1c')]=qs[_0x69a0('0x1c')](_0x811de7['query']['offset']);}return _0x1540b2[_0x69a0('0x4d')](_0x17e4aa);}})['then'](function(_0x4740ad){if(_0x4740ad){return _0x4740ad?{'count':_0x19d6f0,'rows':_0x4740ad}:null;}})[_0x69a0('0x24')](respondWithResult(_0x4da7b3,null))[_0x69a0('0x42')](handleError(_0x4da7b3,null));};exports[_0x69a0('0x4e')]=function(_0x4ed400,_0x47e72f,_0x5c627c){var _0x75e157={};var _0x39788f={};var _0x1a0561;var _0x3fb8cc;return db[_0x69a0('0x2a')][_0x69a0('0x48')]({'where':{'id':_0x4ed400[_0x69a0('0x43')]['id']}})[_0x69a0('0x24')](handleEntityNotFound(_0x47e72f,null))['then'](function(_0x42ae21){if(_0x42ae21){_0x1a0561=_0x42ae21;_0x39788f[_0x69a0('0x2e')]=_[_0x69a0('0x31')](db[_0x69a0('0x4f')][_0x69a0('0x2b')]);_0x39788f[_0x69a0('0x30')]=_[_0x69a0('0x31')](_0x4ed400[_0x69a0('0x30')]);_0x39788f[_0x69a0('0x39')]=_['intersection'](_0x39788f[_0x69a0('0x2e')],_0x39788f[_0x69a0('0x30')]);_0x75e157[_0x69a0('0x32')]=_[_0x69a0('0x33')](_0x39788f[_0x69a0('0x2e')],qs[_0x69a0('0x34')](_0x4ed400[_0x69a0('0x30')][_0x69a0('0x34')]));_0x75e157[_0x69a0('0x32')]=_0x75e157[_0x69a0('0x32')][_0x69a0('0x35')]?_0x75e157[_0x69a0('0x32')]:_0x39788f[_0x69a0('0x2e')];_0x75e157['order']=qs[_0x69a0('0x37')](_0x4ed400[_0x69a0('0x30')][_0x69a0('0x37')]);_0x75e157['where']=qs['filters'](_[_0x69a0('0x3a')](_0x4ed400[_0x69a0('0x30')],_0x39788f[_0x69a0('0x39')]));if(_0x4ed400[_0x69a0('0x30')][_0x69a0('0x3b')]){_0x75e157[_0x69a0('0x38')]=_[_0x69a0('0x3c')](_0x75e157[_0x69a0('0x38')],{'$or':_[_0x69a0('0x2f')](_0x75e157['attributes'],function(_0x1730f2){var _0x19bae4={};_0x19bae4[_0x1730f2]={'$like':'%'+_0x4ed400[_0x69a0('0x30')][_0x69a0('0x3b')]+'%'};return _0x19bae4;})});}_0x75e157=_[_0x69a0('0x3c')]({},_0x75e157,_0x4ed400[_0x69a0('0x3e')]);return _0x1a0561[_0x69a0('0x4e')](_0x75e157);}})[_0x69a0('0x24')](function(_0x376821){if(_0x376821){_0x3fb8cc=_0x376821[_0x69a0('0x35')];if(!_0x4ed400[_0x69a0('0x30')][_0x69a0('0x36')]('nolimit')){_0x75e157[_0x69a0('0x1e')]=qs['limit'](_0x4ed400[_0x69a0('0x30')][_0x69a0('0x1e')]);_0x75e157['offset']=qs[_0x69a0('0x1c')](_0x4ed400[_0x69a0('0x30')][_0x69a0('0x1c')]);}return _0x1a0561[_0x69a0('0x4e')](_0x75e157);}})['then'](function(_0x14fcdd){if(_0x14fcdd){return _0x14fcdd?{'count':_0x3fb8cc,'rows':_0x14fcdd}:null;}})['then'](respondWithResult(_0x47e72f,null))[_0x69a0('0x42')](handleError(_0x47e72f,null));};exports[_0x69a0('0x50')]=function(_0x452079,_0x1a0122,_0x45128c){if(_0x452079[_0x69a0('0x45')]['id']){delete _0x452079[_0x69a0('0x45')]['id'];}return db['ZendeskConfiguration'][_0x69a0('0x48')]({'where':{'id':_0x452079[_0x69a0('0x43')]['id']}})[_0x69a0('0x24')](handleEntityNotFound(_0x1a0122,null))[_0x69a0('0x24')](function(_0x4c7680){if(_0x4c7680){return _0x4c7680[_0x69a0('0x50')](_0x452079[_0x69a0('0x45')][_0x69a0('0x51')]||[]);}return null;})['then'](respondWithResult(_0x1a0122,null))[_0x69a0('0x42')](handleError(_0x1a0122,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 59b4a94..ea54886 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 _0xd914=['util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x23a020,_0x30f071){var _0x309c7e=function(_0x6bb2fc){while(--_0x6bb2fc){_0x23a020['push'](_0x23a020['shift']());}};_0x309c7e(++_0x30f071);}(_0xd914,0x17f));var _0x4d91=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0xd914[_0x461886];return _0x295e0a;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff0=['./intZendeskConfiguration.attributes','define','int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfff0,0x139));var _0x0fff=function(_0xbd26cd,_0x18535c){_0xbd26cd=_0xbd26cd-0x0;var _0x5ea7f2=_0xfff0[_0xbd26cd];return _0x5ea7f2;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var fs=require('fs');var path=require(_0x0fff('0x5'));var rimraf=require('rimraf');var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module['exports']=function(_0x33c813,_0x4c2221){return _0x33c813[_0x0fff('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0fff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d7cc38c..8f1c373 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 _0x254d=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x200c1e,_0x2c6397){var _0x4604d4=function(_0x4bdcbf){while(--_0x4bdcbf){_0x200c1e['push'](_0x200c1e['shift']());}};_0x4604d4(++_0x2c6397);}(_0x254d,0x73));var _0xd254=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x254d[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0xd254('0x0'));var util=require(_0xd254('0x1'));var moment=require(_0xd254('0x2'));var BPromise=require('bluebird');var rs=require(_0xd254('0x3'));var fs=require('fs');var Redis=require(_0xd254('0x4'));var db=require(_0xd254('0x5'))['db'];var utils=require(_0xd254('0x6'));var logger=require(_0xd254('0x7'))('rpc');var config=require(_0xd254('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd254('0x9')][_0xd254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e259a,_0x5ddb65,_0x2cc996){return new BPromise(function(_0x393a92,_0x31d448){return client[_0xd254('0xb')](_0x2e259a,_0x2cc996)[_0xd254('0xc')](function(_0x568416){logger[_0xd254('0xd')](_0xd254('0xe'),_0x5ddb65,_0xd254('0xf'));logger[_0xd254('0x10')](_0xd254('0x11'),_0x5ddb65,_0xd254('0xf'),JSON[_0xd254('0x12')](_0x568416));if(_0x568416['error']){if(_0x568416['error'][_0xd254('0x13')]===0x1f4){logger[_0xd254('0x14')](_0xd254('0xe'),_0x5ddb65,_0x568416[_0xd254('0x14')][_0xd254('0x15')]);return _0x31d448(_0x568416[_0xd254('0x14')][_0xd254('0x15')]);}logger[_0xd254('0x14')](_0xd254('0xe'),_0x5ddb65,_0x568416['error']['message']);return _0x393a92(_0x568416[_0xd254('0x14')][_0xd254('0x15')]);}else{logger['info'](_0xd254('0xe'),_0x5ddb65,_0xd254('0xf'));_0x393a92(_0x568416[_0xd254('0x16')][_0xd254('0x15')]);}})[_0xd254('0x17')](function(_0x414511){logger[_0xd254('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5ddb65,_0x414511);_0x31d448(_0x414511);});});} \ No newline at end of file +var _0x3524=['result','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0x3524,0x9a));var _0x4352=function(_0x318c93,_0xaac34f){_0x318c93=_0x318c93-0x0;var _0x30c53d=_0x3524[_0x318c93];return _0x30c53d;};'use strict';var _=require('lodash');var util=require(_0x4352('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4352('0x1'))['db'];var utils=require(_0x4352('0x2'));var logger=require('../../config/logger')(_0x4352('0x3'));var config=require(_0x4352('0x4'));var jayson=require(_0x4352('0x5'));var client=jayson[_0x4352('0x6')][_0x4352('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ac2eb,_0x4249cd,_0x16ac60){return new BPromise(function(_0x3bedb9,_0x2733c5){return client[_0x4352('0x8')](_0x3ac2eb,_0x16ac60)['then'](function(_0xde9ce8){logger[_0x4352('0x9')](_0x4352('0xa'),_0x4249cd,_0x4352('0xb'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4249cd,_0x4352('0xb'),JSON[_0x4352('0xc')](_0xde9ce8));if(_0xde9ce8[_0x4352('0xd')]){if(_0xde9ce8[_0x4352('0xd')][_0x4352('0xe')]===0x1f4){logger['error'](_0x4352('0xa'),_0x4249cd,_0xde9ce8['error'][_0x4352('0xf')]);return _0x2733c5(_0xde9ce8[_0x4352('0xd')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x4249cd,_0xde9ce8[_0x4352('0xd')][_0x4352('0xf')]);return _0x3bedb9(_0xde9ce8['error'][_0x4352('0xf')]);}else{logger[_0x4352('0x9')](_0x4352('0xa'),_0x4249cd,'request\x20sent');_0x3bedb9(_0xde9ce8[_0x4352('0x10')][_0x4352('0xf')]);}})['catch'](function(_0x39b09e){logger[_0x4352('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4249cd,_0x39b09e);_0x2733c5(_0x39b09e);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3d974a3..2b70772 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 _0x03e5=['update','delete','destroy','exports','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','/:id','show','put'];(function(_0x5276c8,_0x3c2cc8){var _0x574e31=function(_0x260cfc){while(--_0x260cfc){_0x5276c8['push'](_0x5276c8['shift']());}};_0x574e31(++_0x3c2cc8);}(_0x03e5,0xba));var _0x503e=function(_0x3180b9,_0x41e58e){_0x3180b9=_0x3180b9-0x0;var _0x5942c3=_0x03e5[_0x3180b9];return _0x5942c3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x503e('0x0'));var router=express['Router']();var fs_extra=require(_0x503e('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x503e('0x2'));var config=require(_0x503e('0x3'));var controller=require(_0x503e('0x4'));router['get']('/',auth[_0x503e('0x5')](),controller[_0x503e('0x6')]);router['get'](_0x503e('0x7'),auth['isAuthenticated'](),controller[_0x503e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x503e('0x9')]('/:id',auth[_0x503e('0x5')](),controller[_0x503e('0xa')]);router[_0x503e('0xb')](_0x503e('0x7'),auth[_0x503e('0x5')](),controller[_0x503e('0xc')]);module[_0x503e('0xd')]=router; \ No newline at end of file +var _0xba21=['isAuthenticated','index','post','create','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x3a4838,_0x5eb63c){var _0x10fc53=function(_0x23e650){while(--_0x23e650){_0x3a4838['push'](_0x3a4838['shift']());}};_0x10fc53(++_0x5eb63c);}(_0xba21,0x192));var _0x1ba2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xba21[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x1ba2('0x0'));var util=require(_0x1ba2('0x1'));var path=require(_0x1ba2('0x2'));var timeout=require(_0x1ba2('0x3'));var express=require(_0x1ba2('0x4'));var router=express[_0x1ba2('0x5')]();var fs_extra=require(_0x1ba2('0x6'));var auth=require(_0x1ba2('0x7'));var interaction=require(_0x1ba2('0x8'));var config=require(_0x1ba2('0x9'));var controller=require(_0x1ba2('0xa'));router[_0x1ba2('0xb')]('/',auth[_0x1ba2('0xc')](),controller[_0x1ba2('0xd')]);router[_0x1ba2('0xb')]('/:id',auth[_0x1ba2('0xc')](),controller['show']);router[_0x1ba2('0xe')]('/',auth[_0x1ba2('0xc')](),controller[_0x1ba2('0xf')]);router['put'](_0x1ba2('0x10'),auth[_0x1ba2('0xc')](),controller[_0x1ba2('0x11')]);router['delete'](_0x1ba2('0x10'),auth[_0x1ba2('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9f84942..01eea79 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 _0x531e=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x531e,0x1d2));var _0xe531=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x531e[_0x5471ec];return _0x121d4c;};'use strict';var Sequelize=require(_0xe531('0x0'));module[_0xe531('0x1')]={'type':{'type':Sequelize[_0xe531('0x2')](_0xe531('0x3'),_0xe531('0x4'),_0xe531('0x5'),_0xe531('0x6'),_0xe531('0x7')),'defaultValue':_0xe531('0x3')},'content':{'type':Sequelize[_0xe531('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe531('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe531('0x8')]},'nameField':{'type':Sequelize[_0xe531('0x8')]},'customField':{'type':Sequelize[_0xe531('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x611a=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x611a,0x1bf));var _0xa611=function(_0xe67fb,_0x194b71){_0xe67fb=_0xe67fb-0x0;var _0x5ca807=_0x611a[_0xe67fb];return _0x5ca807;};'use strict';var Sequelize=require('sequelize');module[_0xa611('0x0')]={'type':{'type':Sequelize[_0xa611('0x1')](_0xa611('0x2'),_0xa611('0x3'),_0xa611('0x4'),_0xa611('0x5'),_0xa611('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa611('0x7')]},'key':{'type':Sequelize[_0xa611('0x7')]},'keyType':{'type':Sequelize[_0xa611('0x1')](_0xa611('0x2'),_0xa611('0x3'),_0xa611('0x4'))},'keyContent':{'type':Sequelize[_0xa611('0x7')]},'idField':{'type':Sequelize[_0xa611('0x7')]},'nameField':{'type':Sequelize[_0xa611('0x7')]},'customField':{'type':Sequelize[_0xa611('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a956d7a..1933478 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 _0x9a7a=['Content-Range','apply','reject','save','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','ZendeskField','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9a7a,0x78));var _0xa9a7=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0x9a7a[_0xd58823];return _0x249c0a;};'use strict';var emlformat=require(_0xa9a7('0x0'));var rimraf=require(_0xa9a7('0x1'));var zipdir=require(_0xa9a7('0x2'));var jsonpatch=require(_0xa9a7('0x3'));var rp=require(_0xa9a7('0x4'));var moment=require(_0xa9a7('0x5'));var BPromise=require(_0xa9a7('0x6'));var Mustache=require(_0xa9a7('0x7'));var util=require(_0xa9a7('0x8'));var path=require(_0xa9a7('0x9'));var sox=require(_0xa9a7('0xa'));var csv=require(_0xa9a7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9a7('0xc'));var _=require(_0xa9a7('0xd'));var squel=require(_0xa9a7('0xe'));var crypto=require(_0xa9a7('0xf'));var jsforce=require(_0xa9a7('0x10'));var deskjs=require(_0xa9a7('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa9a7('0x12'));var Papa=require(_0xa9a7('0x13'));var Redis=require('ioredis');var authService=require(_0xa9a7('0x14'));var qs=require(_0xa9a7('0x15'));var as=require(_0xa9a7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9a7('0x17'));var utils=require('../../config/utils');var config=require(_0xa9a7('0x18'));var licenseUtil=require(_0xa9a7('0x19'));var db=require(_0xa9a7('0x1a'))['db'];function respondWithStatusCode(_0x3e14a8,_0x395623){_0x395623=_0x395623||0xcc;return function(_0x5d91ee){if(_0x5d91ee){return _0x3e14a8['sendStatus'](_0x395623);}return _0x3e14a8[_0xa9a7('0x1b')](_0x395623)[_0xa9a7('0x1c')]();};}function respondWithResult(_0x13b92f,_0x3c0e8e){_0x3c0e8e=_0x3c0e8e||0xc8;return function(_0x329218){if(_0x329218){return _0x13b92f[_0xa9a7('0x1b')](_0x3c0e8e)[_0xa9a7('0x1d')](_0x329218);}};}function respondWithFilteredResult(_0x4e5d55,_0x439132){return function(_0x80b88a){if(_0x80b88a){var _0x4cfa62=typeof _0x439132[_0xa9a7('0x1e')]===_0xa9a7('0x1f')&&typeof _0x439132['limit']===_0xa9a7('0x1f');var _0x493d1d=_0x80b88a[_0xa9a7('0x20')];var _0xa662f2=_0x4cfa62?0x0:_0x439132['offset'];var _0x4f1433=_0x4cfa62?_0x80b88a[_0xa9a7('0x20')]:_0x439132['offset']+_0x439132[_0xa9a7('0x21')];var _0x9392b6;if(_0x4f1433>=_0x493d1d){_0x4f1433=_0x493d1d;_0x9392b6=0xc8;}else{_0x9392b6=0xce;}_0x4e5d55[_0xa9a7('0x1b')](_0x9392b6);return _0x4e5d55['set'](_0xa9a7('0x22'),_0xa662f2+'-'+_0x4f1433+'/'+_0x493d1d)[_0xa9a7('0x1d')](_0x80b88a);}return null;};}function patchUpdates(_0x519933){return function(_0x12885c){try{jsonpatch[_0xa9a7('0x23')](_0x12885c,_0x519933,!![]);}catch(_0x1cd775){return BPromise[_0xa9a7('0x24')](_0x1cd775);}return _0x12885c[_0xa9a7('0x25')]();};}function saveUpdates(_0x28ee6b,_0xfd9d21){return function(_0x16cf32){if(_0x16cf32){return _0x16cf32['update'](_0x28ee6b)[_0xa9a7('0x26')](function(_0xdbe9c9){return _0xdbe9c9;});}return null;};}function removeEntity(_0x1fa448,_0x30cc2f){return function(_0x5a4eb4){if(_0x5a4eb4){return _0x5a4eb4['destroy']()['then'](function(){_0x1fa448['status'](0xcc)[_0xa9a7('0x1c')]();});}};}function handleEntityNotFound(_0xcca552,_0x35097f){return function(_0x32a2e2){if(!_0x32a2e2){_0xcca552['sendStatus'](0x194);}return _0x32a2e2;};}function handleError(_0x575120,_0x2e2bf5){_0x2e2bf5=_0x2e2bf5||0x1f4;return function(_0x501237){logger[_0xa9a7('0x27')](_0x501237[_0xa9a7('0x28')]);if(_0x501237[_0xa9a7('0x29')]){delete _0x501237['name'];}_0x575120['status'](_0x2e2bf5)[_0xa9a7('0x2a')](_0x501237);};}exports[_0xa9a7('0x2b')]=function(_0x73adff,_0x2ca7e9){var _0x239fb9={},_0x24bb12={},_0x5e0f17={'count':0x0,'rows':[]};var _0x325449=_[_0xa9a7('0x2c')](db['ZendeskField']['rawAttributes'],function(_0x5147d1){return{'name':_0x5147d1[_0xa9a7('0x2d')],'type':_0x5147d1[_0xa9a7('0x2e')][_0xa9a7('0x2f')]};});_0x24bb12[_0xa9a7('0x30')]=_[_0xa9a7('0x2c')](_0x325449,_0xa9a7('0x29'));_0x24bb12[_0xa9a7('0x31')]=_['keys'](_0x73adff[_0xa9a7('0x31')]);_0x24bb12[_0xa9a7('0x32')]=_[_0xa9a7('0x33')](_0x24bb12[_0xa9a7('0x30')],_0x24bb12[_0xa9a7('0x31')]);_0x239fb9[_0xa9a7('0x34')]=_[_0xa9a7('0x33')](_0x24bb12[_0xa9a7('0x30')],qs['fields'](_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x35')]));_0x239fb9['attributes']=_0x239fb9['attributes'][_0xa9a7('0x36')]?_0x239fb9[_0xa9a7('0x34')]:_0x24bb12['model'];if(!_0x73adff['query']['hasOwnProperty'](_0xa9a7('0x37'))){_0x239fb9['limit']=qs[_0xa9a7('0x21')](_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x21')]);_0x239fb9[_0xa9a7('0x1e')]=qs[_0xa9a7('0x1e')](_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x1e')]);}_0x239fb9['order']=qs[_0xa9a7('0x38')](_0x73adff['query'][_0xa9a7('0x38')]);_0x239fb9[_0xa9a7('0x39')]=qs[_0xa9a7('0x32')](_[_0xa9a7('0x3a')](_0x73adff[_0xa9a7('0x31')],_0x24bb12[_0xa9a7('0x32')]),_0x325449);if(_0x73adff['query'][_0xa9a7('0x3b')]){_0x239fb9['where']=_['merge'](_0x239fb9[_0xa9a7('0x39')],{'$or':_[_0xa9a7('0x2c')](_0x325449,function(_0x5d27cb){if(_0x5d27cb[_0xa9a7('0x2e')]!==_0xa9a7('0x3c')){var _0xe1bbf8={};_0xe1bbf8[_0x5d27cb[_0xa9a7('0x29')]]={'$like':'%'+_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x3b')]+'%'};return _0xe1bbf8;}})});}_0x239fb9=_[_0xa9a7('0x3d')]({},_0x239fb9,_0x73adff[_0xa9a7('0x3e')]);var _0x47abe3={'where':_0x239fb9['where']};return db[_0xa9a7('0x3f')][_0xa9a7('0x20')](_0x47abe3)[_0xa9a7('0x26')](function(_0x4e80d2){_0x5e0f17[_0xa9a7('0x20')]=_0x4e80d2;if(_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x40')]){_0x239fb9['include']=[{'all':!![]}];}return db[_0xa9a7('0x3f')][_0xa9a7('0x41')](_0x239fb9);})['then'](function(_0x4c8807){_0x5e0f17[_0xa9a7('0x42')]=_0x4c8807;return _0x5e0f17;})[_0xa9a7('0x26')](respondWithFilteredResult(_0x2ca7e9,_0x239fb9))[_0xa9a7('0x43')](handleError(_0x2ca7e9,null));};exports['show']=function(_0x9fadc3,_0x2b618a){var _0x5f02fd={'raw':!![],'where':{'id':_0x9fadc3[_0xa9a7('0x44')]['id']}},_0x314a8b={};_0x314a8b[_0xa9a7('0x30')]=_[_0xa9a7('0x45')](db['ZendeskField'][_0xa9a7('0x46')]);_0x314a8b['query']=_[_0xa9a7('0x45')](_0x9fadc3[_0xa9a7('0x31')]);_0x314a8b[_0xa9a7('0x32')]=_[_0xa9a7('0x33')](_0x314a8b[_0xa9a7('0x30')],_0x314a8b[_0xa9a7('0x31')]);_0x5f02fd[_0xa9a7('0x34')]=_['intersection'](_0x314a8b[_0xa9a7('0x30')],qs[_0xa9a7('0x35')](_0x9fadc3[_0xa9a7('0x31')][_0xa9a7('0x35')]));_0x5f02fd['attributes']=_0x5f02fd[_0xa9a7('0x34')][_0xa9a7('0x36')]?_0x5f02fd[_0xa9a7('0x34')]:_0x314a8b[_0xa9a7('0x30')];if(_0x9fadc3[_0xa9a7('0x31')][_0xa9a7('0x40')]){_0x5f02fd[_0xa9a7('0x47')]=[{'all':!![]}];}_0x5f02fd=_[_0xa9a7('0x3d')]({},_0x5f02fd,_0x9fadc3['options']);return db[_0xa9a7('0x3f')][_0xa9a7('0x48')](_0x5f02fd)[_0xa9a7('0x26')](handleEntityNotFound(_0x2b618a,null))[_0xa9a7('0x26')](respondWithResult(_0x2b618a,null))[_0xa9a7('0x43')](handleError(_0x2b618a,null));};exports['create']=function(_0x1f733c,_0x3a6ba6){return db['ZendeskField'][_0xa9a7('0x49')](_0x1f733c[_0xa9a7('0x4a')],{})['then'](respondWithResult(_0x3a6ba6,0xc9))[_0xa9a7('0x43')](handleError(_0x3a6ba6,null));};exports[_0xa9a7('0x4b')]=function(_0x3c71d4,_0x7cb45){if(_0x3c71d4[_0xa9a7('0x4a')]['id']){delete _0x3c71d4[_0xa9a7('0x4a')]['id'];}return db[_0xa9a7('0x3f')][_0xa9a7('0x48')]({'where':{'id':_0x3c71d4[_0xa9a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x7cb45,null))[_0xa9a7('0x26')](saveUpdates(_0x3c71d4[_0xa9a7('0x4a')],null))[_0xa9a7('0x26')](respondWithResult(_0x7cb45,null))['catch'](handleError(_0x7cb45,null));};exports[_0xa9a7('0x4c')]=function(_0x54d1af,_0x2aaa3c){return db[_0xa9a7('0x3f')]['find']({'where':{'id':_0x54d1af[_0xa9a7('0x44')]['id']}})[_0xa9a7('0x26')](handleEntityNotFound(_0x2aaa3c,null))[_0xa9a7('0x26')](removeEntity(_0x2aaa3c,null))[_0xa9a7('0x43')](handleError(_0x2aaa3c,null));}; \ No newline at end of file +var _0x01e1=['nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0x01e1,0xff));var _0x101e=function(_0x56e90f,_0xea8b9d){_0x56e90f=_0x56e90f-0x0;var _0x6cc387=_0x01e1[_0x56e90f];return _0x6cc387;};'use strict';var emlformat=require(_0x101e('0x0'));var rimraf=require(_0x101e('0x1'));var zipdir=require(_0x101e('0x2'));var jsonpatch=require(_0x101e('0x3'));var rp=require(_0x101e('0x4'));var moment=require(_0x101e('0x5'));var BPromise=require(_0x101e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x101e('0x7'));var sox=require(_0x101e('0x8'));var csv=require('to-csv');var ejs=require(_0x101e('0x9'));var fs=require('fs');var fs_extra=require(_0x101e('0xa'));var _=require('lodash');var squel=require(_0x101e('0xb'));var crypto=require(_0x101e('0xc'));var jsforce=require(_0x101e('0xd'));var deskjs=require(_0x101e('0xe'));var toCsv=require(_0x101e('0xf'));var querystring=require(_0x101e('0x10'));var Papa=require(_0x101e('0x11'));var Redis=require('ioredis');var authService=require(_0x101e('0x12'));var qs=require(_0x101e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x101e('0x14'));var logger=require(_0x101e('0x15'))(_0x101e('0x16'));var utils=require(_0x101e('0x17'));var config=require(_0x101e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x101e('0x19'))['db'];function respondWithStatusCode(_0x58281a,_0x31d4d7){_0x31d4d7=_0x31d4d7||0xcc;return function(_0x34a838){if(_0x34a838){return _0x58281a[_0x101e('0x1a')](_0x31d4d7);}return _0x58281a[_0x101e('0x1b')](_0x31d4d7)[_0x101e('0x1c')]();};}function respondWithResult(_0x4f6a18,_0x5227f3){_0x5227f3=_0x5227f3||0xc8;return function(_0x80df63){if(_0x80df63){return _0x4f6a18[_0x101e('0x1b')](_0x5227f3)[_0x101e('0x1d')](_0x80df63);}};}function respondWithFilteredResult(_0x1e8e60,_0xe4e585){return function(_0x278231){if(_0x278231){var _0x32519c=typeof _0xe4e585[_0x101e('0x1e')]===_0x101e('0x1f')&&typeof _0xe4e585[_0x101e('0x20')]===_0x101e('0x1f');var _0x2e4af2=_0x278231[_0x101e('0x21')];var _0x272a32=_0x32519c?0x0:_0xe4e585['offset'];var _0x5c9cad=_0x32519c?_0x278231[_0x101e('0x21')]:_0xe4e585[_0x101e('0x1e')]+_0xe4e585[_0x101e('0x20')];var _0x57d859;if(_0x5c9cad>=_0x2e4af2){_0x5c9cad=_0x2e4af2;_0x57d859=0xc8;}else{_0x57d859=0xce;}_0x1e8e60[_0x101e('0x1b')](_0x57d859);return _0x1e8e60[_0x101e('0x22')](_0x101e('0x23'),_0x272a32+'-'+_0x5c9cad+'/'+_0x2e4af2)[_0x101e('0x1d')](_0x278231);}return null;};}function patchUpdates(_0x36ad8d){return function(_0x16fdd7){try{jsonpatch[_0x101e('0x24')](_0x16fdd7,_0x36ad8d,!![]);}catch(_0x463c3d){return BPromise[_0x101e('0x25')](_0x463c3d);}return _0x16fdd7[_0x101e('0x26')]();};}function saveUpdates(_0x3ff4b9,_0x4ae1ca){return function(_0x395df4){if(_0x395df4){return _0x395df4[_0x101e('0x27')](_0x3ff4b9)[_0x101e('0x28')](function(_0x639eaa){return _0x639eaa;});}return null;};}function removeEntity(_0x166b3d,_0x41c125){return function(_0x3e17d1){if(_0x3e17d1){return _0x3e17d1[_0x101e('0x29')]()[_0x101e('0x28')](function(){_0x166b3d[_0x101e('0x1b')](0xcc)[_0x101e('0x1c')]();});}};}function handleEntityNotFound(_0x54eb7a,_0xcf21cb){return function(_0x19f31a){if(!_0x19f31a){_0x54eb7a[_0x101e('0x1a')](0x194);}return _0x19f31a;};}function handleError(_0x5d692d,_0x174d76){_0x174d76=_0x174d76||0x1f4;return function(_0x10fba4){logger[_0x101e('0x2a')](_0x10fba4[_0x101e('0x2b')]);if(_0x10fba4['name']){delete _0x10fba4['name'];}_0x5d692d[_0x101e('0x1b')](_0x174d76)[_0x101e('0x2c')](_0x10fba4);};}exports[_0x101e('0x2d')]=function(_0x36d53c,_0x4b87db){var _0x5ed1f8={},_0x104421={},_0x59d640={'count':0x0,'rows':[]};var _0x3a1576=_['map'](db[_0x101e('0x2e')][_0x101e('0x2f')],function(_0x1a7f88){return{'name':_0x1a7f88[_0x101e('0x30')],'type':_0x1a7f88[_0x101e('0x31')][_0x101e('0x32')]};});_0x104421['model']=_[_0x101e('0x33')](_0x3a1576,_0x101e('0x34'));_0x104421[_0x101e('0x35')]=_['keys'](_0x36d53c['query']);_0x104421[_0x101e('0x36')]=_[_0x101e('0x37')](_0x104421[_0x101e('0x38')],_0x104421[_0x101e('0x35')]);_0x5ed1f8['attributes']=_[_0x101e('0x37')](_0x104421['model'],qs[_0x101e('0x39')](_0x36d53c[_0x101e('0x35')][_0x101e('0x39')]));_0x5ed1f8[_0x101e('0x3a')]=_0x5ed1f8['attributes'][_0x101e('0x3b')]?_0x5ed1f8[_0x101e('0x3a')]:_0x104421[_0x101e('0x38')];if(!_0x36d53c[_0x101e('0x35')][_0x101e('0x3c')](_0x101e('0x3d'))){_0x5ed1f8[_0x101e('0x20')]=qs['limit'](_0x36d53c[_0x101e('0x35')][_0x101e('0x20')]);_0x5ed1f8[_0x101e('0x1e')]=qs[_0x101e('0x1e')](_0x36d53c[_0x101e('0x35')]['offset']);}_0x5ed1f8[_0x101e('0x3e')]=qs['sort'](_0x36d53c[_0x101e('0x35')]['sort']);_0x5ed1f8[_0x101e('0x3f')]=qs['filters'](_[_0x101e('0x40')](_0x36d53c[_0x101e('0x35')],_0x104421[_0x101e('0x36')]),_0x3a1576);if(_0x36d53c[_0x101e('0x35')][_0x101e('0x41')]){_0x5ed1f8[_0x101e('0x3f')]=_[_0x101e('0x42')](_0x5ed1f8[_0x101e('0x3f')],{'$or':_[_0x101e('0x33')](_0x3a1576,function(_0x4938b5){if(_0x4938b5['type']!==_0x101e('0x43')){var _0x1f2015={};_0x1f2015[_0x4938b5[_0x101e('0x34')]]={'$like':'%'+_0x36d53c[_0x101e('0x35')]['filter']+'%'};return _0x1f2015;}})});}_0x5ed1f8=_[_0x101e('0x42')]({},_0x5ed1f8,_0x36d53c[_0x101e('0x44')]);var _0x32aa72={'where':_0x5ed1f8[_0x101e('0x3f')]};return db[_0x101e('0x2e')][_0x101e('0x21')](_0x32aa72)['then'](function(_0x26cba9){_0x59d640['count']=_0x26cba9;if(_0x36d53c[_0x101e('0x35')][_0x101e('0x45')]){_0x5ed1f8[_0x101e('0x46')]=[{'all':!![]}];}return db[_0x101e('0x2e')]['findAll'](_0x5ed1f8);})['then'](function(_0xe2fb4d){_0x59d640[_0x101e('0x47')]=_0xe2fb4d;return _0x59d640;})['then'](respondWithFilteredResult(_0x4b87db,_0x5ed1f8))[_0x101e('0x48')](handleError(_0x4b87db,null));};exports[_0x101e('0x49')]=function(_0x7d4b3f,_0x4c8288){var _0x24f8ea={'raw':!![],'where':{'id':_0x7d4b3f[_0x101e('0x4a')]['id']}},_0x4e4376={};_0x4e4376[_0x101e('0x38')]=_['keys'](db[_0x101e('0x2e')][_0x101e('0x2f')]);_0x4e4376[_0x101e('0x35')]=_[_0x101e('0x4b')](_0x7d4b3f[_0x101e('0x35')]);_0x4e4376[_0x101e('0x36')]=_['intersection'](_0x4e4376[_0x101e('0x38')],_0x4e4376['query']);_0x24f8ea[_0x101e('0x3a')]=_['intersection'](_0x4e4376[_0x101e('0x38')],qs[_0x101e('0x39')](_0x7d4b3f[_0x101e('0x35')]['fields']));_0x24f8ea[_0x101e('0x3a')]=_0x24f8ea[_0x101e('0x3a')][_0x101e('0x3b')]?_0x24f8ea[_0x101e('0x3a')]:_0x4e4376['model'];if(_0x7d4b3f['query']['includeAll']){_0x24f8ea[_0x101e('0x46')]=[{'all':!![]}];}_0x24f8ea=_[_0x101e('0x42')]({},_0x24f8ea,_0x7d4b3f[_0x101e('0x44')]);return db['ZendeskField']['find'](_0x24f8ea)[_0x101e('0x28')](handleEntityNotFound(_0x4c8288,null))[_0x101e('0x28')](respondWithResult(_0x4c8288,null))[_0x101e('0x48')](handleError(_0x4c8288,null));};exports[_0x101e('0x4c')]=function(_0x4e7150,_0x5e492a){return db[_0x101e('0x2e')][_0x101e('0x4c')](_0x4e7150[_0x101e('0x4d')],{})[_0x101e('0x28')](respondWithResult(_0x5e492a,0xc9))[_0x101e('0x48')](handleError(_0x5e492a,null));};exports[_0x101e('0x27')]=function(_0x5810ed,_0x57293e){if(_0x5810ed[_0x101e('0x4d')]['id']){delete _0x5810ed[_0x101e('0x4d')]['id'];}return db[_0x101e('0x2e')][_0x101e('0x4e')]({'where':{'id':_0x5810ed[_0x101e('0x4a')]['id']}})[_0x101e('0x28')](handleEntityNotFound(_0x57293e,null))[_0x101e('0x28')](saveUpdates(_0x5810ed[_0x101e('0x4d')],null))[_0x101e('0x28')](respondWithResult(_0x57293e,null))[_0x101e('0x48')](handleError(_0x57293e,null));};exports['destroy']=function(_0x3638d1,_0x3cb393){return db[_0x101e('0x2e')][_0x101e('0x4e')]({'where':{'id':_0x3638d1[_0x101e('0x4a')]['id']}})[_0x101e('0x28')](handleEntityNotFound(_0x3cb393,null))['then'](removeEntity(_0x3cb393,null))[_0x101e('0x48')](handleError(_0x3cb393,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index af9bc7c..a9e017b 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 _0x50a1=['../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3e30e9,_0x4e605e){var _0x5633d5=function(_0x3f93a9){while(--_0x3f93a9){_0x3e30e9['push'](_0x3e30e9['shift']());}};_0x5633d5(++_0x4e605e);}(_0x50a1,0xa9));var _0x150a=function(_0x212dbb,_0x4114bb){_0x212dbb=_0x212dbb-0x0;var _0x4c5cd4=_0x50a1[_0x212dbb];return _0x4c5cd4;};'use strict';var _=require(_0x150a('0x0'));var util=require(_0x150a('0x1'));var logger=require(_0x150a('0x2'))(_0x150a('0x3'));var moment=require(_0x150a('0x4'));var BPromise=require(_0x150a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x150a('0x6'));var rimraf=require('rimraf');var config=require(_0x150a('0x7'));var attributes=require(_0x150a('0x8'));module[_0x150a('0x9')]=function(_0xcd34d5,_0x1d1e2c){return _0xcd34d5[_0x150a('0xa')](_0x150a('0xb'),attributes,{'tableName':_0x150a('0xc'),'paranoid':![],'indexes':[{'name':_0x150a('0xd'),'fields':[_0x150a('0xe'),_0x150a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8e6=['FieldId','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index'];(function(_0x3327e2,_0x251554){var _0x59fb5c=function(_0xf092ac){while(--_0xf092ac){_0x3327e2['push'](_0x3327e2['shift']());}};_0x59fb5c(++_0x251554);}(_0xf8e6,0xc1));var _0x6f8e=function(_0x3eed2b,_0x2da4e6){_0x3eed2b=_0x3eed2b-0x0;var _0xd4b2ec=_0xf8e6[_0x3eed2b];return _0xd4b2ec;};'use strict';var _=require(_0x6f8e('0x0'));var util=require(_0x6f8e('0x1'));var logger=require(_0x6f8e('0x2'))(_0x6f8e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f8e('0x4'));var rimraf=require(_0x6f8e('0x5'));var config=require(_0x6f8e('0x6'));var attributes=require(_0x6f8e('0x7'));module[_0x6f8e('0x8')]=function(_0x4a1671,_0x1b7ff2){return _0x4a1671['define']('ZendeskField',attributes,{'tableName':_0x6f8e('0x9'),'paranoid':![],'indexes':[{'name':_0x6f8e('0xa'),'fields':['idField',_0x6f8e('0xb')],'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 0a2439f..7deb4ec 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 _0xd978=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x3bd1fd,_0x1472ce){var _0x28ea80=function(_0x2222fa){while(--_0x2222fa){_0x3bd1fd['push'](_0x3bd1fd['shift']());}};_0x28ea80(++_0x1472ce);}(_0xd978,0x1c1));var _0x8d97=function(_0x276221,_0x378da4){_0x276221=_0x276221-0x0;var _0x4fa716=_0xd978[_0x276221];return _0x4fa716;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d97('0x0'));var BPromise=require(_0x8d97('0x1'));var rs=require(_0x8d97('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d97('0x3'))['db'];var utils=require(_0x8d97('0x4'));var logger=require(_0x8d97('0x5'))(_0x8d97('0x6'));var config=require(_0x8d97('0x7'));var jayson=require(_0x8d97('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x579cff,_0x1e2443,_0x9da957){return new BPromise(function(_0x2fdcc1,_0x19c0bf){return client[_0x8d97('0x9')](_0x579cff,_0x9da957)[_0x8d97('0xa')](function(_0x475743){logger[_0x8d97('0xb')](_0x8d97('0xc'),_0x1e2443,_0x8d97('0xd'));logger[_0x8d97('0xe')](_0x8d97('0xf'),_0x1e2443,_0x8d97('0xd'),JSON[_0x8d97('0x10')](_0x475743));if(_0x475743['error']){if(_0x475743[_0x8d97('0x11')][_0x8d97('0x12')]===0x1f4){logger[_0x8d97('0x11')](_0x8d97('0xc'),_0x1e2443,_0x475743['error'][_0x8d97('0x13')]);return _0x19c0bf(_0x475743[_0x8d97('0x11')]['message']);}logger[_0x8d97('0x11')](_0x8d97('0xc'),_0x1e2443,_0x475743['error']['message']);return _0x2fdcc1(_0x475743[_0x8d97('0x11')][_0x8d97('0x13')]);}else{logger[_0x8d97('0xb')]('ZendeskField,\x20%s,\x20%s',_0x1e2443,'request\x20sent');_0x2fdcc1(_0x475743[_0x8d97('0x14')][_0x8d97('0x13')]);}})[_0x8d97('0x15')](function(_0x5252e6){logger['error'](_0x8d97('0xc'),_0x1e2443,_0x5252e6);_0x19c0bf(_0x5252e6);});});} \ No newline at end of file +var _0xb6d6=['request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6d6,0x7b));var _0x6b6d=function(_0x122a67,_0x271763){_0x122a67=_0x122a67-0x0;var _0x15ecf0=_0xb6d6[_0x122a67];return _0x15ecf0;};'use strict';var _=require('lodash');var util=require(_0x6b6d('0x0'));var moment=require(_0x6b6d('0x1'));var BPromise=require(_0x6b6d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b6d('0x3'));var db=require(_0x6b6d('0x4'))['db'];var utils=require(_0x6b6d('0x5'));var logger=require(_0x6b6d('0x6'))(_0x6b6d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6b6d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x99ffd,_0x12800e,_0x2c5e83){return new BPromise(function(_0x858bba,_0x35c284){return client[_0x6b6d('0x9')](_0x99ffd,_0x2c5e83)[_0x6b6d('0xa')](function(_0x45d255){logger['info'](_0x6b6d('0xb'),_0x12800e,_0x6b6d('0xc'));logger[_0x6b6d('0xd')](_0x6b6d('0xe'),_0x12800e,_0x6b6d('0xc'),JSON[_0x6b6d('0xf')](_0x45d255));if(_0x45d255['error']){if(_0x45d255[_0x6b6d('0x10')][_0x6b6d('0x11')]===0x1f4){logger[_0x6b6d('0x10')]('ZendeskField,\x20%s,\x20%s',_0x12800e,_0x45d255[_0x6b6d('0x10')]['message']);return _0x35c284(_0x45d255[_0x6b6d('0x10')][_0x6b6d('0x12')]);}logger[_0x6b6d('0x10')](_0x6b6d('0xb'),_0x12800e,_0x45d255[_0x6b6d('0x10')][_0x6b6d('0x12')]);return _0x858bba(_0x45d255[_0x6b6d('0x10')][_0x6b6d('0x12')]);}else{logger[_0x6b6d('0x13')](_0x6b6d('0xb'),_0x12800e,'request\x20sent');_0x858bba(_0x45d255[_0x6b6d('0x14')][_0x6b6d('0x12')]);}})[_0x6b6d('0x15')](function(_0xd8809f){logger[_0x6b6d('0x10')](_0x6b6d('0xb'),_0x12800e,_0xd8809f);_0x35c284(_0xd8809f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 7a6d5e7..c6a2f7e 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 _0xee7c=['index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xee7c,0x14e));var _0xcee7=function(_0x211026,_0x56ac5b){_0x211026=_0x211026-0x0;var _0x58eca8=_0xee7c[_0x211026];return _0x58eca8;};'use strict';var multer=require('multer');var util=require(_0xcee7('0x0'));var path=require(_0xcee7('0x1'));var timeout=require(_0xcee7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcee7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcee7('0x4'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xcee7('0x5')](),controller[_0xcee7('0x6')]);router['get'](_0xcee7('0x7'),auth[_0xcee7('0x5')](),controller[_0xcee7('0x8')]);router[_0xcee7('0x9')](_0xcee7('0xa'),auth['isAuthenticated'](),controller[_0xcee7('0xb')]);router['get'](_0xcee7('0xc'),auth[_0xcee7('0x5')](),controller[_0xcee7('0xd')]);router[_0xcee7('0xe')]('/',auth['isAuthenticated'](),controller[_0xcee7('0xf')]);router['post']('/:id/configurations',auth[_0xcee7('0x5')](),controller[_0xcee7('0x10')]);router['put'](_0xcee7('0x7'),auth[_0xcee7('0x5')](),controller[_0xcee7('0x11')]);router[_0xcee7('0x12')](_0xcee7('0x7'),auth[_0xcee7('0x5')](),controller[_0xcee7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x74ce=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/configurations','/:id/fields','isAuthenticated','post','create','update','delete','destroy','multer','util'];(function(_0x197399,_0x180b3b){var _0x3ae071=function(_0x4083b3){while(--_0x4083b3){_0x197399['push'](_0x197399['shift']());}};_0x3ae071(++_0x180b3b);}(_0x74ce,0x18e));var _0xe74c=function(_0x45c776,_0x5ecafb){_0x45c776=_0x45c776-0x0;var _0x5da3d6=_0x74ce[_0x45c776];return _0x5da3d6;};'use strict';var multer=require(_0xe74c('0x0'));var util=require(_0xe74c('0x1'));var path=require(_0xe74c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe74c('0x3')]();var fs_extra=require(_0xe74c('0x4'));var auth=require(_0xe74c('0x5'));var interaction=require(_0xe74c('0x6'));var config=require(_0xe74c('0x7'));var controller=require('./intZohoAccount.controller');router[_0xe74c('0x8')]('/',auth['isAuthenticated'](),controller[_0xe74c('0x9')]);router['get'](_0xe74c('0xa'),auth['isAuthenticated'](),controller[_0xe74c('0xb')]);router[_0xe74c('0x8')](_0xe74c('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xe74c('0xd'),auth[_0xe74c('0xe')](),controller['getFields']);router[_0xe74c('0xf')]('/',auth[_0xe74c('0xe')](),controller[_0xe74c('0x10')]);router[_0xe74c('0xf')](_0xe74c('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xe74c('0xa'),auth[_0xe74c('0xe')](),controller[_0xe74c('0x11')]);router[_0xe74c('0x12')](_0xe74c('0xa'),auth[_0xe74c('0xe')](),controller[_0xe74c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 75d4b7c..c60fe09 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 _0xee5b=['sequelize','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xee5b,0x1f4));var _0xbee5=function(_0x28eecc,_0x456d20){_0x28eecc=_0x28eecc-0x0;var _0x28b963=_0xee5b[_0x28eecc];return _0x28b963;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb91=['STRING'];(function(_0x492c56,_0x21add5){var _0x1d68dc=function(_0x3b42ea){while(--_0x3b42ea){_0x492c56['push'](_0x492c56['shift']());}};_0x1d68dc(++_0x21add5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xcb91[_0x3a13cf];return _0x4817c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1cb9('0x0')]},'description':{'type':Sequelize[_0x1cb9('0x0')]},'host':{'type':Sequelize[_0x1cb9('0x0')]},'zone':{'type':Sequelize[_0x1cb9('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1cb9('0x0')]},'serverUrl':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x1cb9('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 8b859e9..ba50d0d 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 _0xee24=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','show','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','Subjects','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','refreshToken','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash'];(function(_0xaeca13,_0x51587a){var _0x2a9c6a=function(_0x39b7c4){while(--_0x39b7c4){_0xaeca13['push'](_0xaeca13['shift']());}};_0x2a9c6a(++_0x51587a);}(_0xee24,0x172));var _0x4ee2=function(_0x1255ae,_0x538fc2){_0x1255ae=_0x1255ae-0x0;var _0x5aee74=_0xee24[_0x1255ae];return _0x5aee74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ee2('0x0'));var zipdir=require(_0x4ee2('0x1'));var jsonpatch=require(_0x4ee2('0x2'));var rp=require(_0x4ee2('0x3'));var moment=require(_0x4ee2('0x4'));var BPromise=require(_0x4ee2('0x5'));var Mustache=require(_0x4ee2('0x6'));var util=require('util');var path=require(_0x4ee2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ee2('0x8'));var fs=require('fs');var fs_extra=require(_0x4ee2('0x9'));var _=require(_0x4ee2('0xa'));var squel=require('squel');var crypto=require(_0x4ee2('0xb'));var jsforce=require(_0x4ee2('0xc'));var deskjs=require(_0x4ee2('0xd'));var toCsv=require(_0x4ee2('0xe'));var querystring=require(_0x4ee2('0xf'));var Papa=require(_0x4ee2('0x10'));var Redis=require(_0x4ee2('0x11'));var authService=require(_0x4ee2('0x12'));var qs=require(_0x4ee2('0x13'));var as=require(_0x4ee2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ee2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ee2('0x16'))['db'];var integrations=require(_0x4ee2('0x17'));function respondWithStatusCode(_0x359cd8,_0x114a08){_0x114a08=_0x114a08||0xcc;return function(_0x43f55f){if(_0x43f55f){return _0x359cd8[_0x4ee2('0x18')](_0x114a08);}return _0x359cd8[_0x4ee2('0x19')](_0x114a08)['end']();};}function respondWithResult(_0x47cfe6,_0x3c4934){_0x3c4934=_0x3c4934||0xc8;return function(_0x3bc468){if(_0x3bc468){return _0x47cfe6[_0x4ee2('0x19')](_0x3c4934)[_0x4ee2('0x1a')](_0x3bc468);}};}function respondWithFilteredResult(_0x48a048,_0x4aef7b){return function(_0x2cfaa2){if(_0x2cfaa2){var _0x1b14ba=typeof _0x4aef7b['offset']===_0x4ee2('0x1b')&&typeof _0x4aef7b[_0x4ee2('0x1c')]===_0x4ee2('0x1b');var _0x16e8d6=_0x2cfaa2[_0x4ee2('0x1d')];var _0xaef88f=_0x1b14ba?0x0:_0x4aef7b[_0x4ee2('0x1e')];var _0x421665=_0x1b14ba?_0x2cfaa2[_0x4ee2('0x1d')]:_0x4aef7b[_0x4ee2('0x1e')]+_0x4aef7b['limit'];var _0x52c9d7;if(_0x421665>=_0x16e8d6){_0x421665=_0x16e8d6;_0x52c9d7=0xc8;}else{_0x52c9d7=0xce;}_0x48a048['status'](_0x52c9d7);return _0x48a048[_0x4ee2('0x1f')](_0x4ee2('0x20'),_0xaef88f+'-'+_0x421665+'/'+_0x16e8d6)[_0x4ee2('0x1a')](_0x2cfaa2);}return null;};}function patchUpdates(_0x3651c6){return function(_0x50453c){try{jsonpatch[_0x4ee2('0x21')](_0x50453c,_0x3651c6,!![]);}catch(_0x16dde4){return BPromise['reject'](_0x16dde4);}return _0x50453c[_0x4ee2('0x22')]();};}function saveUpdates(_0x43f520,_0x234dbf){return function(_0x386f4e){if(_0x386f4e){return _0x386f4e[_0x4ee2('0x23')](_0x43f520)[_0x4ee2('0x24')](function(_0x1e5a44){return _0x1e5a44;});}return null;};}function removeEntity(_0x4a764c,_0x41fbb7){return function(_0x315735){if(_0x315735){return _0x315735[_0x4ee2('0x25')]()[_0x4ee2('0x24')](function(){_0x4a764c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40a7a3,_0x36a66){return function(_0xe04041){if(!_0xe04041){_0x40a7a3[_0x4ee2('0x18')](0x194);}return _0xe04041;};}function handleError(_0x4310a8,_0x18e0d6){_0x18e0d6=_0x18e0d6||0x1f4;return function(_0x3cd3f1){logger[_0x4ee2('0x26')](_0x3cd3f1[_0x4ee2('0x27')]);if(_0x3cd3f1['name']){delete _0x3cd3f1[_0x4ee2('0x28')];}_0x4310a8[_0x4ee2('0x19')](_0x18e0d6)[_0x4ee2('0x29')](_0x3cd3f1);};}exports[_0x4ee2('0x2a')]=function(_0x701789,_0x4006b7){var _0x239e83={},_0x338032={},_0x86d1b4={'count':0x0,'rows':[]};var _0x336265=_[_0x4ee2('0x2b')](db[_0x4ee2('0x2c')][_0x4ee2('0x2d')],function(_0x21d868){return{'name':_0x21d868[_0x4ee2('0x2e')],'type':_0x21d868['type'][_0x4ee2('0x2f')]};});_0x338032[_0x4ee2('0x30')]=_[_0x4ee2('0x2b')](_0x336265,_0x4ee2('0x28'));_0x338032[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x701789[_0x4ee2('0x31')]);_0x338032['filters']=_['intersection'](_0x338032[_0x4ee2('0x30')],_0x338032[_0x4ee2('0x31')]);_0x239e83['attributes']=_[_0x4ee2('0x33')](_0x338032[_0x4ee2('0x30')],qs[_0x4ee2('0x34')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x34')]));_0x239e83[_0x4ee2('0x35')]=_0x239e83['attributes'][_0x4ee2('0x36')]?_0x239e83[_0x4ee2('0x35')]:_0x338032[_0x4ee2('0x30')];if(!_0x701789[_0x4ee2('0x31')][_0x4ee2('0x37')](_0x4ee2('0x38'))){_0x239e83[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x1c')]);_0x239e83[_0x4ee2('0x1e')]=qs[_0x4ee2('0x1e')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x1e')]);}_0x239e83['order']=qs[_0x4ee2('0x39')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x39')]);_0x239e83['where']=qs[_0x4ee2('0x3a')](_[_0x4ee2('0x3b')](_0x701789[_0x4ee2('0x31')],_0x338032[_0x4ee2('0x3a')]),_0x336265);if(_0x701789[_0x4ee2('0x31')][_0x4ee2('0x3c')]){_0x239e83[_0x4ee2('0x3d')]=_[_0x4ee2('0x3e')](_0x239e83[_0x4ee2('0x3d')],{'$or':_[_0x4ee2('0x2b')](_0x336265,function(_0x4cbd62){if(_0x4cbd62[_0x4ee2('0x3f')]!=='VIRTUAL'){var _0x129ef2={};_0x129ef2[_0x4cbd62[_0x4ee2('0x28')]]={'$like':'%'+_0x701789['query']['filter']+'%'};return _0x129ef2;}})});}_0x239e83=_[_0x4ee2('0x3e')]({},_0x239e83,_0x701789[_0x4ee2('0x40')]);var _0x5639dc={'where':_0x239e83['where']};return db[_0x4ee2('0x2c')][_0x4ee2('0x1d')](_0x5639dc)[_0x4ee2('0x24')](function(_0x192163){_0x86d1b4[_0x4ee2('0x1d')]=_0x192163;if(_0x701789[_0x4ee2('0x31')][_0x4ee2('0x41')]){_0x239e83[_0x4ee2('0x42')]=[{'all':!![]}];}return db['ZohoAccount'][_0x4ee2('0x43')](_0x239e83);})[_0x4ee2('0x24')](function(_0x5f28e2){_0x86d1b4['rows']=_0x5f28e2;return _0x86d1b4;})[_0x4ee2('0x24')](respondWithFilteredResult(_0x4006b7,_0x239e83))[_0x4ee2('0x44')](handleError(_0x4006b7,null));};exports[_0x4ee2('0x45')]=function(_0x41bad6,_0x159b99){var _0x4f6cd1={'raw':![],'where':{'id':_0x41bad6['params']['id']}},_0x57d970={};_0x57d970[_0x4ee2('0x30')]=_[_0x4ee2('0x32')](db[_0x4ee2('0x2c')][_0x4ee2('0x2d')]);_0x57d970[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x41bad6[_0x4ee2('0x31')]);_0x57d970[_0x4ee2('0x3a')]=_[_0x4ee2('0x33')](_0x57d970[_0x4ee2('0x30')],_0x57d970[_0x4ee2('0x31')]);_0x4f6cd1[_0x4ee2('0x35')]=_['intersection'](_0x57d970[_0x4ee2('0x30')],qs[_0x4ee2('0x34')](_0x41bad6[_0x4ee2('0x31')][_0x4ee2('0x34')]));_0x4f6cd1[_0x4ee2('0x35')]=_0x4f6cd1[_0x4ee2('0x35')][_0x4ee2('0x36')]?_0x4f6cd1[_0x4ee2('0x35')]:_0x57d970['model'];if(_0x41bad6[_0x4ee2('0x31')]['includeAll']){_0x4f6cd1['include']=[{'all':!![]}];}_0x4f6cd1=_[_0x4ee2('0x3e')]({},_0x4f6cd1,_0x41bad6[_0x4ee2('0x40')]);return db['ZohoAccount'][_0x4ee2('0x46')](_0x4f6cd1)[_0x4ee2('0x24')](handleEntityNotFound(_0x159b99,null))[_0x4ee2('0x24')](respondWithResult(_0x159b99,null))[_0x4ee2('0x44')](handleError(_0x159b99,null));};exports[_0x4ee2('0x47')]=function(_0xe338f5,_0x4e555c){return db[_0x4ee2('0x2c')][_0x4ee2('0x47')](_0xe338f5[_0x4ee2('0x48')],{})[_0x4ee2('0x24')](respondWithResult(_0x4e555c,0xc9))[_0x4ee2('0x44')](handleError(_0x4e555c,null));};exports['update']=function(_0x264526,_0x2b6f45){if(_0x264526[_0x4ee2('0x48')]['id']){delete _0x264526[_0x4ee2('0x48')]['id'];}return db[_0x4ee2('0x2c')]['find']({'where':{'id':_0x264526[_0x4ee2('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b6f45,null))[_0x4ee2('0x24')](saveUpdates(_0x264526['body'],null))[_0x4ee2('0x24')](respondWithResult(_0x2b6f45,null))[_0x4ee2('0x44')](handleError(_0x2b6f45,null));};exports[_0x4ee2('0x25')]=function(_0x4e28cb,_0x5d47a6){return db[_0x4ee2('0x2c')]['find']({'where':{'id':_0x4e28cb['params']['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x5d47a6,null))['then'](removeEntity(_0x5d47a6,null))[_0x4ee2('0x44')](handleError(_0x5d47a6,null));};exports[_0x4ee2('0x4a')]=function(_0x368abf,_0x45a48e,_0x26d584){var _0x494a95={};var _0x1c4252={};var _0x22172f;var _0x5f42fe;return db[_0x4ee2('0x2c')][_0x4ee2('0x4b')]({'where':{'id':_0x368abf['params']['id']}})['then'](handleEntityNotFound(_0x45a48e,null))[_0x4ee2('0x24')](function(_0x5d21a3){if(_0x5d21a3){_0x22172f=_0x5d21a3;_0x1c4252[_0x4ee2('0x30')]=_['keys'](db[_0x4ee2('0x4c')][_0x4ee2('0x2d')]);_0x1c4252[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x368abf[_0x4ee2('0x31')]);_0x1c4252[_0x4ee2('0x3a')]=_['intersection'](_0x1c4252[_0x4ee2('0x30')],_0x1c4252[_0x4ee2('0x31')]);_0x494a95[_0x4ee2('0x35')]=_[_0x4ee2('0x33')](_0x1c4252['model'],qs[_0x4ee2('0x34')](_0x368abf[_0x4ee2('0x31')]['fields']));_0x494a95[_0x4ee2('0x35')]=_0x494a95[_0x4ee2('0x35')]['length']?_0x494a95[_0x4ee2('0x35')]:_0x1c4252[_0x4ee2('0x30')];_0x494a95[_0x4ee2('0x4d')]=qs[_0x4ee2('0x39')](_0x368abf['query'][_0x4ee2('0x39')]);_0x494a95[_0x4ee2('0x3d')]=qs[_0x4ee2('0x3a')](_['pick'](_0x368abf['query'],_0x1c4252[_0x4ee2('0x3a')]));if(_0x368abf['query']['filter']){_0x494a95['where']=_[_0x4ee2('0x3e')](_0x494a95[_0x4ee2('0x3d')],{'$or':_['map'](_0x494a95[_0x4ee2('0x35')],function(_0x17c21b){var _0x4c3b0e={};_0x4c3b0e[_0x17c21b]={'$like':'%'+_0x368abf[_0x4ee2('0x31')][_0x4ee2('0x3c')]+'%'};return _0x4c3b0e;})});}_0x494a95=_[_0x4ee2('0x3e')]({},_0x494a95,_0x368abf[_0x4ee2('0x40')]);return _0x22172f[_0x4ee2('0x4a')](_0x494a95);}})[_0x4ee2('0x24')](function(_0x360cc7){if(_0x360cc7){_0x5f42fe=_0x360cc7[_0x4ee2('0x36')];if(!_0x368abf[_0x4ee2('0x31')]['hasOwnProperty']('nolimit')){_0x494a95[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0x368abf[_0x4ee2('0x31')][_0x4ee2('0x1c')]);_0x494a95[_0x4ee2('0x1e')]=qs['offset'](_0x368abf[_0x4ee2('0x31')][_0x4ee2('0x1e')]);}return _0x22172f[_0x4ee2('0x4a')](_0x494a95);}})[_0x4ee2('0x24')](function(_0x1d484a){if(_0x1d484a){return _0x1d484a?{'count':_0x5f42fe,'rows':_0x1d484a}:null;}})[_0x4ee2('0x24')](respondWithResult(_0x45a48e,null))[_0x4ee2('0x44')](handleError(_0x45a48e,null));};exports[_0x4ee2('0x4e')]=function(_0xa8df15,_0x42c49f,_0x48a74c){if(_0xa8df15[_0x4ee2('0x48')]['id']){delete _0xa8df15[_0x4ee2('0x48')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0xa8df15[_0x4ee2('0x49')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x42c49f,null))[_0x4ee2('0x24')](function(_0x127c46){if(_0x127c46){_0xa8df15[_0x4ee2('0x48')]['AccountId']=_0x127c46['id'];_0xa8df15[_0x4ee2('0x48')][_0x4ee2('0x4f')]=integrations['getSubjects'](_0xa8df15[_0x4ee2('0x48')]['channel'],_0xa8df15[_0x4ee2('0x48')]['type']);_0xa8df15[_0x4ee2('0x48')][_0x4ee2('0x50')]=integrations[_0x4ee2('0x51')](_0xa8df15[_0x4ee2('0x48')]['channel'],_0xa8df15[_0x4ee2('0x48')][_0x4ee2('0x3f')]);return db[_0x4ee2('0x4c')][_0x4ee2('0x47')](_0xa8df15[_0x4ee2('0x48')],{'include':[{'model':db[_0x4ee2('0x52')],'as':_0x4ee2('0x4f')},{'model':db[_0x4ee2('0x52')],'as':_0x4ee2('0x50')}]});}return null;})[_0x4ee2('0x24')](respondWithResult(_0x42c49f,null))[_0x4ee2('0x44')](handleError(_0x42c49f,null));};function getAccessToken(_0x30c1cc){return new Promise(function(_0x2e5573,_0x36ad91){var _0x41bfa9;switch(_0x30c1cc[_0x4ee2('0x53')]){case'US':_0x41bfa9=_0x4ee2('0x54');break;case'AU':_0x41bfa9=_0x4ee2('0x55');break;case'EU':_0x41bfa9='https://accounts.zoho.eu';break;case'IN':_0x41bfa9=_0x4ee2('0x56');break;case'CN':_0x41bfa9=_0x4ee2('0x57');break;default:_0x41bfa9='https://accounts.zoho.eu';break;}var _0x5cbba1={'method':'POST','uri':_0x41bfa9+'/oauth/v2/token','qs':{'refresh_token':_0x30c1cc['refreshToken'],'client_id':_0x30c1cc[_0x4ee2('0x58')],'client_secret':_0x30c1cc[_0x4ee2('0x59')],'grant_type':_0x4ee2('0x5a')},'json':!![]};return rp(_0x5cbba1)[_0x4ee2('0x24')](function(_0x4b82bd){if(_0x4b82bd['access_token']){_0x2e5573(_0x4b82bd[_0x4ee2('0x5b')]);}else{_0x36ad91(_0x4ee2('0x5c'));}})[_0x4ee2('0x44')](function(_0x1e7d99){_0x36ad91(_0x1e7d99);});});}exports['getFields']=function(_0x299c5d,_0x364741,_0x259830){var _0x797415,_0x444e50,_0x4a7329,_0x29a92d,_0xa6e045;return db[_0x4ee2('0x2c')][_0x4ee2('0x4b')]({'where':{'id':_0x299c5d[_0x4ee2('0x49')]['id']},'attributes':['id',_0x4ee2('0x5d'),_0x4ee2('0x53'),_0x4ee2('0x58'),_0x4ee2('0x59'),_0x4ee2('0x5e'),_0x4ee2('0x5f'),_0x4ee2('0x60')]})[_0x4ee2('0x24')](handleEntityNotFound(_0x364741,null))['then'](function(_0x2a2a9f){_0xa6e045=_0x2a2a9f;_0x797415=_0xa6e045[_0x4ee2('0x5d')];_0x444e50=_0x797415===_0x4ee2('0x61')?'eu':_0x4ee2('0x62');_0x4a7329=_0xa6e045[_0x4ee2('0x5e')];var _0x2da223=_0x4a7329[_0x4ee2('0x63')](-0x1);if(_0x2da223==='/'||_0x2da223==='\x5c'||_0x2da223===':'){_0x4a7329=_0x4a7329['substring'](0x0,_0x4a7329[_0x4ee2('0x64')](_0x2da223));}if(!_0xa6e045['refreshToken']){throw new Error(_0x4ee2('0x65'));}return getAccessToken(_0xa6e045);})[_0x4ee2('0x24')](function(_0x77a3ae){if(_0x77a3ae){return rp({'method':'GET','uri':util[_0x4ee2('0x66')](_0x4ee2('0x67'),_0x444e50),'qs':{'module':_0x4ee2('0x68')},'headers':{'Authorization':_0x4ee2('0x69')+_0x77a3ae},'json':!![]});}})['then'](function(_0x46bb4b){if(_0x46bb4b){if(_0x46bb4b[_0x4ee2('0x6a')]&&_0x46bb4b[_0x4ee2('0x6a')][_0x4ee2('0x26')]){throw new Error(_0x46bb4b['response'][_0x4ee2('0x26')][_0x4ee2('0x6b')]);}var _0x9f54c0=[];var _0x515a3a=[];var _0x3521b2=[_0x4ee2('0x6c'),'Subject',_0x4ee2('0x6d'),_0x4ee2('0x6e'),_0x4ee2('0x6f'),_0x4ee2('0x70'),'Call_Start_Time',_0x4ee2('0x71')];_0x515a3a=_['remove'](_0x46bb4b[_0x4ee2('0x34')],function(_0x36e54d){return _0x3521b2[_0x4ee2('0x72')](_0x36e54d[_0x4ee2('0x73')]);});for(var _0x30802c=0x0;_0x30802c<_0x515a3a[_0x4ee2('0x36')];_0x30802c++){if(_0x515a3a[_0x30802c][_0x4ee2('0x74')]===![]){_0x9f54c0[_0x4ee2('0x75')]({'id':_0x515a3a[_0x30802c]['id'],'name':_0x515a3a[_0x30802c][_0x4ee2('0x76')],'custom':_0x515a3a[_0x30802c]['custom_field'],'options':_0x515a3a[_0x30802c]['data_type']===_0x4ee2('0x77')&&_0x515a3a[_0x30802c]['pick_list_values'][_0x4ee2('0x36')]>-0x1?_[_0x4ee2('0x2b')](_0x515a3a[_0x30802c][_0x4ee2('0x78')],function(_0x469058){return{'name':_0x469058,'value':_0x469058};}):[]});}}return{'count':_0x9f54c0[_0x4ee2('0x36')],'rows':_0x9f54c0};}else{return{'count':0x0,'rows':[]};}})[_0x4ee2('0x24')](respondWithResult(_0x364741,null))['catch'](function(_0x3c3eae){var _0x64228a=_0x299c5d[_0x4ee2('0x31')]['test']?0x1f4:_0x3c3eae[_0x4ee2('0x79')]||0x1f4;logger[_0x4ee2('0x26')](_0x4ee2('0x7a'),_0x4ee2('0x7b'),_0x64228a,JSON[_0x4ee2('0x7c')](_0x3c3eae));delete _0x3c3eae[_0x4ee2('0x28')];if(_0x64228a===0x191){_0x64228a=0x190;}_0x364741[_0x4ee2('0x19')](_0x64228a)['send'](_0x299c5d['query'][_0x4ee2('0x7d')]?{'message':_0x4ee2('0x7e'),'statusCode':_0x3c3eae[_0x4ee2('0x79')]}:_0x3c3eae);});}; \ No newline at end of file +var _0x2280=['findOne','ZohoConfiguration','options','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.in','POST','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations'];(function(_0x6ceff,_0x3ff205){var _0x3694df=function(_0x503cdd){while(--_0x503cdd){_0x6ceff['push'](_0x6ceff['shift']());}};_0x3694df(++_0x3ff205);}(_0x2280,0xb7));var _0x0228=function(_0xbdf2f,_0x2993dc){_0xbdf2f=_0xbdf2f-0x0;var _0x2929a3=_0x2280[_0xbdf2f];return _0x2929a3;};'use strict';var emlformat=require(_0x0228('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0228('0x1'));var jsonpatch=require(_0x0228('0x2'));var rp=require(_0x0228('0x3'));var moment=require(_0x0228('0x4'));var BPromise=require(_0x0228('0x5'));var Mustache=require(_0x0228('0x6'));var util=require(_0x0228('0x7'));var path=require(_0x0228('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0228('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0228('0xa'));var squel=require(_0x0228('0xb'));var crypto=require(_0x0228('0xc'));var jsforce=require(_0x0228('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0228('0xe'));var querystring=require(_0x0228('0xf'));var Papa=require(_0x0228('0x10'));var Redis=require(_0x0228('0x11'));var authService=require(_0x0228('0x12'));var qs=require(_0x0228('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0228('0x14'))(_0x0228('0x15'));var utils=require(_0x0228('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0228('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3d1bf2,_0x5a3131){_0x5a3131=_0x5a3131||0xcc;return function(_0x5b4dce){if(_0x5b4dce){return _0x3d1bf2['sendStatus'](_0x5a3131);}return _0x3d1bf2['status'](_0x5a3131)[_0x0228('0x18')]();};}function respondWithResult(_0x1ce011,_0x4bb990){_0x4bb990=_0x4bb990||0xc8;return function(_0x413084){if(_0x413084){return _0x1ce011[_0x0228('0x19')](_0x4bb990)[_0x0228('0x1a')](_0x413084);}};}function respondWithFilteredResult(_0x193a5d,_0x24daf5){return function(_0x13dc33){if(_0x13dc33){var _0x463a51=typeof _0x24daf5[_0x0228('0x1b')]===_0x0228('0x1c')&&typeof _0x24daf5[_0x0228('0x1d')]===_0x0228('0x1c');var _0x567c9f=_0x13dc33[_0x0228('0x1e')];var _0x516464=_0x463a51?0x0:_0x24daf5[_0x0228('0x1b')];var _0x5867c7=_0x463a51?_0x13dc33[_0x0228('0x1e')]:_0x24daf5['offset']+_0x24daf5[_0x0228('0x1d')];var _0x3b7338;if(_0x5867c7>=_0x567c9f){_0x5867c7=_0x567c9f;_0x3b7338=0xc8;}else{_0x3b7338=0xce;}_0x193a5d[_0x0228('0x19')](_0x3b7338);return _0x193a5d[_0x0228('0x1f')](_0x0228('0x20'),_0x516464+'-'+_0x5867c7+'/'+_0x567c9f)[_0x0228('0x1a')](_0x13dc33);}return null;};}function patchUpdates(_0x13b104){return function(_0x15a35e){try{jsonpatch[_0x0228('0x21')](_0x15a35e,_0x13b104,!![]);}catch(_0x140514){return BPromise[_0x0228('0x22')](_0x140514);}return _0x15a35e['save']();};}function saveUpdates(_0x3c23ed,_0x196987){return function(_0x5f41a1){if(_0x5f41a1){return _0x5f41a1[_0x0228('0x23')](_0x3c23ed)[_0x0228('0x24')](function(_0x48407c){return _0x48407c;});}return null;};}function removeEntity(_0x528505,_0x35bd9d){return function(_0x390804){if(_0x390804){return _0x390804[_0x0228('0x25')]()[_0x0228('0x24')](function(){_0x528505[_0x0228('0x19')](0xcc)[_0x0228('0x18')]();});}};}function handleEntityNotFound(_0x32aea2,_0x21fabf){return function(_0x5ae3c9){if(!_0x5ae3c9){_0x32aea2['sendStatus'](0x194);}return _0x5ae3c9;};}function handleError(_0x45b536,_0x1c2450){_0x1c2450=_0x1c2450||0x1f4;return function(_0x5e2432){logger[_0x0228('0x26')](_0x5e2432[_0x0228('0x27')]);if(_0x5e2432[_0x0228('0x28')]){delete _0x5e2432['name'];}_0x45b536[_0x0228('0x19')](_0x1c2450)[_0x0228('0x29')](_0x5e2432);};}exports[_0x0228('0x2a')]=function(_0x5f2911,_0x3d0eff){var _0x47fc9e={},_0x43c6ef={},_0x528b9b={'count':0x0,'rows':[]};var _0x5ce0a8=_['map'](db[_0x0228('0x2b')][_0x0228('0x2c')],function(_0x4ba22b){return{'name':_0x4ba22b[_0x0228('0x2d')],'type':_0x4ba22b[_0x0228('0x2e')]['key']};});_0x43c6ef[_0x0228('0x2f')]=_[_0x0228('0x30')](_0x5ce0a8,_0x0228('0x28'));_0x43c6ef[_0x0228('0x31')]=_[_0x0228('0x32')](_0x5f2911[_0x0228('0x31')]);_0x43c6ef[_0x0228('0x33')]=_['intersection'](_0x43c6ef[_0x0228('0x2f')],_0x43c6ef[_0x0228('0x31')]);_0x47fc9e[_0x0228('0x34')]=_[_0x0228('0x35')](_0x43c6ef['model'],qs[_0x0228('0x36')](_0x5f2911['query'][_0x0228('0x36')]));_0x47fc9e[_0x0228('0x34')]=_0x47fc9e[_0x0228('0x34')][_0x0228('0x37')]?_0x47fc9e['attributes']:_0x43c6ef[_0x0228('0x2f')];if(!_0x5f2911['query'][_0x0228('0x38')](_0x0228('0x39'))){_0x47fc9e[_0x0228('0x1d')]=qs[_0x0228('0x1d')](_0x5f2911[_0x0228('0x31')][_0x0228('0x1d')]);_0x47fc9e[_0x0228('0x1b')]=qs[_0x0228('0x1b')](_0x5f2911[_0x0228('0x31')]['offset']);}_0x47fc9e[_0x0228('0x3a')]=qs[_0x0228('0x3b')](_0x5f2911[_0x0228('0x31')]['sort']);_0x47fc9e[_0x0228('0x3c')]=qs['filters'](_[_0x0228('0x3d')](_0x5f2911[_0x0228('0x31')],_0x43c6ef['filters']),_0x5ce0a8);if(_0x5f2911[_0x0228('0x31')][_0x0228('0x3e')]){_0x47fc9e[_0x0228('0x3c')]=_[_0x0228('0x3f')](_0x47fc9e[_0x0228('0x3c')],{'$or':_[_0x0228('0x30')](_0x5ce0a8,function(_0x4e2314){if(_0x4e2314[_0x0228('0x2e')]!==_0x0228('0x40')){var _0x58340f={};_0x58340f[_0x4e2314[_0x0228('0x28')]]={'$like':'%'+_0x5f2911['query']['filter']+'%'};return _0x58340f;}})});}_0x47fc9e=_[_0x0228('0x3f')]({},_0x47fc9e,_0x5f2911['options']);var _0x4d95dc={'where':_0x47fc9e[_0x0228('0x3c')]};return db['ZohoAccount'][_0x0228('0x1e')](_0x4d95dc)[_0x0228('0x24')](function(_0x38e624){_0x528b9b[_0x0228('0x1e')]=_0x38e624;if(_0x5f2911[_0x0228('0x31')][_0x0228('0x41')]){_0x47fc9e[_0x0228('0x42')]=[{'all':!![]}];}return db['ZohoAccount'][_0x0228('0x43')](_0x47fc9e);})['then'](function(_0x1fec2a){_0x528b9b['rows']=_0x1fec2a;return _0x528b9b;})[_0x0228('0x24')](respondWithFilteredResult(_0x3d0eff,_0x47fc9e))[_0x0228('0x44')](handleError(_0x3d0eff,null));};exports[_0x0228('0x45')]=function(_0x528228,_0x3c2c4a){var _0x2266d2={'raw':![],'where':{'id':_0x528228[_0x0228('0x46')]['id']}},_0xe0ff09={};_0xe0ff09[_0x0228('0x2f')]=_[_0x0228('0x32')](db['ZohoAccount'][_0x0228('0x2c')]);_0xe0ff09[_0x0228('0x31')]=_[_0x0228('0x32')](_0x528228[_0x0228('0x31')]);_0xe0ff09[_0x0228('0x33')]=_[_0x0228('0x35')](_0xe0ff09['model'],_0xe0ff09[_0x0228('0x31')]);_0x2266d2[_0x0228('0x34')]=_[_0x0228('0x35')](_0xe0ff09['model'],qs['fields'](_0x528228['query'][_0x0228('0x36')]));_0x2266d2[_0x0228('0x34')]=_0x2266d2[_0x0228('0x34')]['length']?_0x2266d2[_0x0228('0x34')]:_0xe0ff09['model'];if(_0x528228[_0x0228('0x31')][_0x0228('0x41')]){_0x2266d2[_0x0228('0x42')]=[{'all':!![]}];}_0x2266d2=_[_0x0228('0x3f')]({},_0x2266d2,_0x528228['options']);return db[_0x0228('0x2b')][_0x0228('0x47')](_0x2266d2)[_0x0228('0x24')](handleEntityNotFound(_0x3c2c4a,null))['then'](respondWithResult(_0x3c2c4a,null))['catch'](handleError(_0x3c2c4a,null));};exports[_0x0228('0x48')]=function(_0x252002,_0x14d4dd){return db['ZohoAccount'][_0x0228('0x48')](_0x252002['body'],{})['then'](respondWithResult(_0x14d4dd,0xc9))[_0x0228('0x44')](handleError(_0x14d4dd,null));};exports[_0x0228('0x23')]=function(_0x74579a,_0x510aca){if(_0x74579a[_0x0228('0x49')]['id']){delete _0x74579a[_0x0228('0x49')]['id'];}return db[_0x0228('0x2b')][_0x0228('0x47')]({'where':{'id':_0x74579a[_0x0228('0x46')]['id']}})[_0x0228('0x24')](handleEntityNotFound(_0x510aca,null))[_0x0228('0x24')](saveUpdates(_0x74579a[_0x0228('0x49')],null))[_0x0228('0x24')](respondWithResult(_0x510aca,null))[_0x0228('0x44')](handleError(_0x510aca,null));};exports[_0x0228('0x25')]=function(_0x530b58,_0x30b317){return db['ZohoAccount'][_0x0228('0x47')]({'where':{'id':_0x530b58[_0x0228('0x46')]['id']}})[_0x0228('0x24')](handleEntityNotFound(_0x30b317,null))['then'](removeEntity(_0x30b317,null))[_0x0228('0x44')](handleError(_0x30b317,null));};exports[_0x0228('0x4a')]=function(_0x51a8f4,_0x845a06,_0x30f9d8){var _0x525b51={};var _0xc1f062={};var _0x234dbe;var _0x3c7f4c;return db[_0x0228('0x2b')][_0x0228('0x4b')]({'where':{'id':_0x51a8f4[_0x0228('0x46')]['id']}})[_0x0228('0x24')](handleEntityNotFound(_0x845a06,null))[_0x0228('0x24')](function(_0xd3b850){if(_0xd3b850){_0x234dbe=_0xd3b850;_0xc1f062['model']=_[_0x0228('0x32')](db[_0x0228('0x4c')]['rawAttributes']);_0xc1f062[_0x0228('0x31')]=_[_0x0228('0x32')](_0x51a8f4[_0x0228('0x31')]);_0xc1f062[_0x0228('0x33')]=_[_0x0228('0x35')](_0xc1f062['model'],_0xc1f062['query']);_0x525b51['attributes']=_[_0x0228('0x35')](_0xc1f062[_0x0228('0x2f')],qs[_0x0228('0x36')](_0x51a8f4[_0x0228('0x31')]['fields']));_0x525b51[_0x0228('0x34')]=_0x525b51[_0x0228('0x34')][_0x0228('0x37')]?_0x525b51[_0x0228('0x34')]:_0xc1f062[_0x0228('0x2f')];_0x525b51['order']=qs[_0x0228('0x3b')](_0x51a8f4[_0x0228('0x31')][_0x0228('0x3b')]);_0x525b51['where']=qs[_0x0228('0x33')](_[_0x0228('0x3d')](_0x51a8f4[_0x0228('0x31')],_0xc1f062[_0x0228('0x33')]));if(_0x51a8f4[_0x0228('0x31')][_0x0228('0x3e')]){_0x525b51[_0x0228('0x3c')]=_[_0x0228('0x3f')](_0x525b51['where'],{'$or':_['map'](_0x525b51[_0x0228('0x34')],function(_0x597fca){var _0x10727a={};_0x10727a[_0x597fca]={'$like':'%'+_0x51a8f4['query'][_0x0228('0x3e')]+'%'};return _0x10727a;})});}_0x525b51=_[_0x0228('0x3f')]({},_0x525b51,_0x51a8f4[_0x0228('0x4d')]);return _0x234dbe['getConfigurations'](_0x525b51);}})[_0x0228('0x24')](function(_0x3b33bd){if(_0x3b33bd){_0x3c7f4c=_0x3b33bd[_0x0228('0x37')];if(!_0x51a8f4['query'][_0x0228('0x38')](_0x0228('0x39'))){_0x525b51[_0x0228('0x1d')]=qs[_0x0228('0x1d')](_0x51a8f4[_0x0228('0x31')][_0x0228('0x1d')]);_0x525b51[_0x0228('0x1b')]=qs[_0x0228('0x1b')](_0x51a8f4[_0x0228('0x31')]['offset']);}return _0x234dbe[_0x0228('0x4a')](_0x525b51);}})['then'](function(_0x517c30){if(_0x517c30){return _0x517c30?{'count':_0x3c7f4c,'rows':_0x517c30}:null;}})[_0x0228('0x24')](respondWithResult(_0x845a06,null))[_0x0228('0x44')](handleError(_0x845a06,null));};exports['addConfiguration']=function(_0x3c4da1,_0x23f604,_0x16afe5){if(_0x3c4da1['body']['id']){delete _0x3c4da1[_0x0228('0x49')]['id'];}return db[_0x0228('0x2b')]['findOne']({'where':{'id':_0x3c4da1['params']['id']}})[_0x0228('0x24')](handleEntityNotFound(_0x23f604,null))[_0x0228('0x24')](function(_0x5a6aab){if(_0x5a6aab){_0x3c4da1[_0x0228('0x49')][_0x0228('0x4e')]=_0x5a6aab['id'];_0x3c4da1[_0x0228('0x49')][_0x0228('0x4f')]=integrations[_0x0228('0x50')](_0x3c4da1[_0x0228('0x49')][_0x0228('0x51')],_0x3c4da1['body'][_0x0228('0x2e')]);_0x3c4da1['body']['Descriptions']=integrations[_0x0228('0x52')](_0x3c4da1['body']['channel'],_0x3c4da1[_0x0228('0x49')][_0x0228('0x2e')]);return db[_0x0228('0x4c')][_0x0228('0x48')](_0x3c4da1[_0x0228('0x49')],{'include':[{'model':db['ZohoField'],'as':_0x0228('0x4f')},{'model':db['ZohoField'],'as':_0x0228('0x53')}]});}return null;})[_0x0228('0x24')](respondWithResult(_0x23f604,null))['catch'](handleError(_0x23f604,null));};function getAccessToken(_0x32a5d0){return new Promise(function(_0x395080,_0x108452){var _0x319aef;switch(_0x32a5d0[_0x0228('0x54')]){case'US':_0x319aef=_0x0228('0x55');break;case'AU':_0x319aef='https://accounts.zoho.com.au';break;case'EU':_0x319aef='https://accounts.zoho.eu';break;case'IN':_0x319aef=_0x0228('0x56');break;case'CN':_0x319aef='https://accounts.zoho.com.cn';break;default:_0x319aef='https://accounts.zoho.eu';break;}var _0x519e15={'method':_0x0228('0x57'),'uri':_0x319aef+'/oauth/v2/token','qs':{'refresh_token':_0x32a5d0['refreshToken'],'client_id':_0x32a5d0[_0x0228('0x58')],'client_secret':_0x32a5d0[_0x0228('0x59')],'grant_type':_0x0228('0x5a')},'json':!![]};return rp(_0x519e15)[_0x0228('0x24')](function(_0x1069b3){if(_0x1069b3[_0x0228('0x5b')]){_0x395080(_0x1069b3['access_token']);}else{_0x108452(_0x0228('0x5c'));}})[_0x0228('0x44')](function(_0x52e2f6){_0x108452(_0x52e2f6);});});}exports[_0x0228('0x5d')]=function(_0x527d42,_0x4c53d3,_0x3c3b52){var _0x54aad8,_0x2af3cc,_0x2876fd,_0x1ea083,_0x448718;return db[_0x0228('0x2b')][_0x0228('0x4b')]({'where':{'id':_0x527d42[_0x0228('0x46')]['id']},'attributes':['id',_0x0228('0x5e'),_0x0228('0x54'),_0x0228('0x58'),_0x0228('0x59'),_0x0228('0x5f'),_0x0228('0x60'),_0x0228('0x61')]})[_0x0228('0x24')](handleEntityNotFound(_0x4c53d3,null))['then'](function(_0x531903){_0x448718=_0x531903;_0x54aad8=_0x448718[_0x0228('0x5e')];_0x2af3cc=_0x54aad8===_0x0228('0x62')?'eu':_0x0228('0x63');_0x2876fd=_0x448718[_0x0228('0x5f')];var _0x21583a=_0x2876fd[_0x0228('0x64')](-0x1);if(_0x21583a==='/'||_0x21583a==='\x5c'||_0x21583a===':'){_0x2876fd=_0x2876fd[_0x0228('0x65')](0x0,_0x2876fd[_0x0228('0x66')](_0x21583a));}if(!_0x448718[_0x0228('0x61')]){throw new Error(_0x0228('0x67'));}return getAccessToken(_0x448718);})['then'](function(_0x1e69aa){if(_0x1e69aa){return rp({'method':_0x0228('0x68'),'uri':util[_0x0228('0x69')](_0x0228('0x6a'),_0x2af3cc),'qs':{'module':_0x0228('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1e69aa},'json':!![]});}})[_0x0228('0x24')](function(_0x1222dc){if(_0x1222dc){if(_0x1222dc[_0x0228('0x6c')]&&_0x1222dc[_0x0228('0x6c')][_0x0228('0x26')]){throw new Error(_0x1222dc[_0x0228('0x6c')][_0x0228('0x26')]['message']);}var _0xc76dfd=[];var _0x473270=[];var _0x2a5737=[_0x0228('0x6d'),_0x0228('0x6e'),_0x0228('0x6f'),_0x0228('0x70'),_0x0228('0x71'),_0x0228('0x72'),_0x0228('0x73'),_0x0228('0x74')];_0x473270=_['remove'](_0x1222dc[_0x0228('0x36')],function(_0x44252c){return _0x2a5737[_0x0228('0x75')](_0x44252c['api_name']);});for(var _0x5b5b8e=0x0;_0x5b5b8e<_0x473270['length'];_0x5b5b8e++){if(_0x473270[_0x5b5b8e]['system_mandatory']===![]){_0xc76dfd[_0x0228('0x76')]({'id':_0x473270[_0x5b5b8e]['id'],'name':_0x473270[_0x5b5b8e][_0x0228('0x77')],'custom':_0x473270[_0x5b5b8e][_0x0228('0x78')],'options':_0x473270[_0x5b5b8e][_0x0228('0x79')]===_0x0228('0x7a')&&_0x473270[_0x5b5b8e][_0x0228('0x7b')][_0x0228('0x37')]>-0x1?_[_0x0228('0x30')](_0x473270[_0x5b5b8e][_0x0228('0x7b')],function(_0x1b36c4){return{'name':_0x1b36c4,'value':_0x1b36c4};}):[]});}}return{'count':_0xc76dfd[_0x0228('0x37')],'rows':_0xc76dfd};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4c53d3,null))[_0x0228('0x44')](function(_0x46bc23){var _0x444fd7=_0x527d42[_0x0228('0x31')][_0x0228('0x7c')]?0x1f4:_0x46bc23[_0x0228('0x7d')]||0x1f4;logger[_0x0228('0x26')](_0x0228('0x7e'),'getFields',_0x444fd7,JSON[_0x0228('0x7f')](_0x46bc23));delete _0x46bc23[_0x0228('0x28')];if(_0x444fd7===0x191){_0x444fd7=0x190;}_0x4c53d3[_0x0228('0x19')](_0x444fd7)[_0x0228('0x29')](_0x527d42['query'][_0x0228('0x7c')]?{'message':_0x0228('0x80'),'statusCode':_0x46bc23[_0x0228('0x7d')]}:_0x46bc23);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index a0daa03..ca14e9f 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 _0x4362=['POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','code','lastIndexOf','https://accounts.zoho.com','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','changed','serverUrl','clientSecret','host','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x3e1bad,_0x3b2b10){var _0x3ae54a=function(_0x2be55e){while(--_0x2be55e){_0x3e1bad['push'](_0x3e1bad['shift']());}};_0x3ae54a(++_0x3b2b10);}(_0x4362,0xdd));var _0x2436=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x4362[_0x5e9876];return _0x576c48;};'use strict';var _=require(_0x2436('0x0'));var util=require(_0x2436('0x1'));var logger=require(_0x2436('0x2'))(_0x2436('0x3'));var moment=require(_0x2436('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2436('0x5'));var rimraf=require(_0x2436('0x6'));var config=require(_0x2436('0x7'));var attributes=require(_0x2436('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2fbb2f,_0x1355de){return _0x2fbb2f[_0x2436('0x9')](_0x2436('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3018bf,_0x40c0fb,_0x50ee51){if(_0x3018bf[_0x2436('0xb')]('zone')||_0x3018bf[_0x2436('0xb')](_0x2436('0xc'))||_0x3018bf['changed']('clientId')||_0x3018bf[_0x2436('0xb')](_0x2436('0xd'))||_0x3018bf[_0x2436('0xb')]('code')||_0x3018bf['changed'](_0x2436('0xe'))){var _0xc10f28,_0x440ed7;_0xc10f28=_0x3018bf[_0x2436('0xc')];var _0x71cada=_0xc10f28['slice'](-0x1);if(_0x71cada==='/'||_0x71cada==='\x5c'||_0x71cada===':'){_0xc10f28=_0xc10f28[_0x2436('0xf')](0x0,_0xc10f28['lastIndexOf'](_0x71cada));}switch(_0x3018bf['zone']){case'US':_0x440ed7='https://accounts.zoho.com';break;case'AU':_0x440ed7=_0x2436('0x10');break;case'IN':_0x440ed7=_0x2436('0x11');break;case'CN':_0x440ed7=_0x2436('0x12');break;default:_0x440ed7='https://accounts.zoho.eu';break;}var _0x25a5d3={'method':_0x2436('0x13'),'uri':_0x440ed7+_0x2436('0x14'),'form':{'grant_type':_0x2436('0x15'),'client_id':_0x3018bf[_0x2436('0x16')],'client_secret':_0x3018bf['clientSecret'],'redirect_uri':_0x3018bf[_0x2436('0xc')],'code':_0x3018bf['code']},'headers':{'Content-Type':_0x2436('0x17')}};return rp(_0x25a5d3)[_0x2436('0x18')](function(_0x4dd9eb){var _0x1241cd=JSON[_0x2436('0x19')](_0x4dd9eb);if(_0x1241cd['refresh_token']){_0x3018bf[_0x2436('0x1a')]=_0x1241cd[_0x2436('0x1b')];logger[_0x2436('0x1c')](util[_0x2436('0x1d')](_0x2436('0x1e'),_0x3018bf[_0x2436('0x1f')],_0x3018bf['id']));}else{logger[_0x2436('0x20')](util[_0x2436('0x1d')](_0x2436('0x21'),_0x3018bf[_0x2436('0x1f')],_0x3018bf['id']),util[_0x2436('0x22')](_0x1241cd,{'showHidden':![],'depth':null}));}return _0x50ee51(null,_0x40c0fb);})[_0x2436('0x23')](function(_0x2c5825){logger[_0x2436('0x20')](util['format'](_0x2436('0x21'),_0x3018bf[_0x2436('0x1f')],_0x3018bf['id']),util[_0x2436('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x50ee51(_0x2c5825);});}else{return _0x50ee51(null,_0x40c0fb);}},'beforeUpdate':function(_0x15569b,_0x2c87e8,_0x7cdc98){if(_0x15569b[_0x2436('0xb')](_0x2436('0x24'))||_0x15569b['changed'](_0x2436('0xc'))||_0x15569b[_0x2436('0xb')]('clientId')||_0x15569b['changed'](_0x2436('0xd'))||_0x15569b['changed'](_0x2436('0x25'))||_0x15569b['changed']('host')){var _0x2f01fa,_0xc68d45;_0x2f01fa=_0x15569b[_0x2436('0xc')];var _0x39427b=_0x2f01fa['slice'](-0x1);if(_0x39427b==='/'||_0x39427b==='\x5c'||_0x39427b===':'){_0x2f01fa=_0x2f01fa[_0x2436('0xf')](0x0,_0x2f01fa[_0x2436('0x26')](_0x39427b));}switch(_0x15569b[_0x2436('0x24')]){case'US':_0xc68d45=_0x2436('0x27');break;case'AU':_0xc68d45='https://accounts.zoho.com.au';break;case'IN':_0xc68d45=_0x2436('0x11');break;case'CN':_0xc68d45=_0x2436('0x12');break;default:_0xc68d45='https://accounts.zoho.eu';break;}var _0x1efa7f={'method':_0x2436('0x13'),'uri':_0xc68d45+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x15569b[_0x2436('0x16')],'client_secret':_0x15569b[_0x2436('0xd')],'redirect_uri':_0x15569b[_0x2436('0xc')],'code':_0x15569b['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1efa7f)[_0x2436('0x18')](function(_0x230063){var _0x420546=JSON[_0x2436('0x19')](_0x230063);if(_0x420546[_0x2436('0x1b')]){_0x15569b['refreshToken']=_0x420546[_0x2436('0x1b')];logger[_0x2436('0x1c')](util[_0x2436('0x1d')](_0x2436('0x1e'),_0x15569b[_0x2436('0x1f')],_0x15569b['id']));}else{logger['error'](util[_0x2436('0x1d')](_0x2436('0x21'),_0x15569b['name'],_0x15569b['id']),util[_0x2436('0x22')](_0x420546,{'showHidden':![],'depth':null}));}return _0x7cdc98(null,_0x2c87e8);})['catch'](function(_0x2216db){logger['error'](util[_0x2436('0x1d')](_0x2436('0x21'),_0x15569b[_0x2436('0x1f')],_0x15569b['id']),util[_0x2436('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x7cdc98(_0x2216db);});}else{return _0x7cdc98(null,_0x2c87e8);}}}});}; \ No newline at end of file +var _0x2e02=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','then','refreshToken','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','lastIndexOf','https://accounts.zoho.com.au','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','info','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0x2e02,0x9b));var _0x22e0=function(_0x5ad712,_0x3e4ae0){_0x5ad712=_0x5ad712-0x0;var _0x38e339=_0x2e02[_0x5ad712];return _0x38e339;};'use strict';var _=require('lodash');var util=require(_0x22e0('0x0'));var logger=require(_0x22e0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x22e0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22e0('0x3'));var rimraf=require('rimraf');var config=require(_0x22e0('0x4'));var attributes=require(_0x22e0('0x5'));var integrations=require(_0x22e0('0x6'));module[_0x22e0('0x7')]=function(_0x328dd5,_0x516a30){return _0x328dd5[_0x22e0('0x8')](_0x22e0('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f553a,_0x34c986,_0x819611){if(_0x4f553a[_0x22e0('0xa')](_0x22e0('0xb'))||_0x4f553a[_0x22e0('0xa')](_0x22e0('0xc'))||_0x4f553a['changed'](_0x22e0('0xd'))||_0x4f553a[_0x22e0('0xa')](_0x22e0('0xe'))||_0x4f553a['changed'](_0x22e0('0xf'))||_0x4f553a[_0x22e0('0xa')](_0x22e0('0x10'))){var _0x2c3480,_0x35351a;_0x2c3480=_0x4f553a[_0x22e0('0xc')];var _0x348cac=_0x2c3480[_0x22e0('0x11')](-0x1);if(_0x348cac==='/'||_0x348cac==='\x5c'||_0x348cac===':'){_0x2c3480=_0x2c3480[_0x22e0('0x12')](0x0,_0x2c3480['lastIndexOf'](_0x348cac));}switch(_0x4f553a[_0x22e0('0xb')]){case'US':_0x35351a='https://accounts.zoho.com';break;case'AU':_0x35351a='https://accounts.zoho.com.au';break;case'IN':_0x35351a=_0x22e0('0x13');break;case'CN':_0x35351a=_0x22e0('0x14');break;default:_0x35351a=_0x22e0('0x15');break;}var _0xdd3550={'method':_0x22e0('0x16'),'uri':_0x35351a+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x4f553a[_0x22e0('0xd')],'client_secret':_0x4f553a[_0x22e0('0xe')],'redirect_uri':_0x4f553a['serverUrl'],'code':_0x4f553a['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0xdd3550)[_0x22e0('0x17')](function(_0x3a2a7b){var _0xf51cab=JSON['parse'](_0x3a2a7b);if(_0xf51cab['refresh_token']){_0x4f553a[_0x22e0('0x18')]=_0xf51cab[_0x22e0('0x19')];logger['info'](util['format'](_0x22e0('0x1a'),_0x4f553a['name'],_0x4f553a['id']));}else{logger[_0x22e0('0x1b')](util[_0x22e0('0x1c')](_0x22e0('0x1d'),_0x4f553a[_0x22e0('0x1e')],_0x4f553a['id']),util[_0x22e0('0x1f')](_0xf51cab,{'showHidden':![],'depth':null}));}return _0x819611(null,_0x34c986);})[_0x22e0('0x20')](function(_0x23c40d){logger['error'](util[_0x22e0('0x1c')](_0x22e0('0x1d'),_0x4f553a[_0x22e0('0x1e')],_0x4f553a['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x819611(_0x23c40d);});}else{return _0x819611(null,_0x34c986);}},'beforeUpdate':function(_0x3b7151,_0x18f1f7,_0x394874){if(_0x3b7151['changed'](_0x22e0('0xb'))||_0x3b7151[_0x22e0('0xa')](_0x22e0('0xc'))||_0x3b7151[_0x22e0('0xa')]('clientId')||_0x3b7151[_0x22e0('0xa')](_0x22e0('0xe'))||_0x3b7151['changed'](_0x22e0('0xf'))||_0x3b7151['changed'](_0x22e0('0x10'))){var _0x123951,_0x38a217;_0x123951=_0x3b7151['serverUrl'];var _0x3df2e0=_0x123951[_0x22e0('0x11')](-0x1);if(_0x3df2e0==='/'||_0x3df2e0==='\x5c'||_0x3df2e0===':'){_0x123951=_0x123951['substring'](0x0,_0x123951[_0x22e0('0x21')](_0x3df2e0));}switch(_0x3b7151['zone']){case'US':_0x38a217='https://accounts.zoho.com';break;case'AU':_0x38a217=_0x22e0('0x22');break;case'IN':_0x38a217='https://accounts.zoho.in';break;case'CN':_0x38a217=_0x22e0('0x14');break;default:_0x38a217='https://accounts.zoho.eu';break;}var _0x182efd={'method':'POST','uri':_0x38a217+_0x22e0('0x23'),'form':{'grant_type':_0x22e0('0x24'),'client_id':_0x3b7151[_0x22e0('0xd')],'client_secret':_0x3b7151[_0x22e0('0xe')],'redirect_uri':_0x3b7151['serverUrl'],'code':_0x3b7151[_0x22e0('0xf')]},'headers':{'Content-Type':_0x22e0('0x25')}};return rp(_0x182efd)[_0x22e0('0x17')](function(_0x998756){var _0x3c302e=JSON[_0x22e0('0x26')](_0x998756);if(_0x3c302e['refresh_token']){_0x3b7151[_0x22e0('0x18')]=_0x3c302e['refresh_token'];logger[_0x22e0('0x27')](util[_0x22e0('0x1c')](_0x22e0('0x1a'),_0x3b7151['name'],_0x3b7151['id']));}else{logger[_0x22e0('0x1b')](util[_0x22e0('0x1c')](_0x22e0('0x1d'),_0x3b7151[_0x22e0('0x1e')],_0x3b7151['id']),util[_0x22e0('0x1f')](_0x3c302e,{'showHidden':![],'depth':null}));}return _0x394874(null,_0x18f1f7);})['catch'](function(_0x3a82e8){logger['error'](util[_0x22e0('0x1c')](_0x22e0('0x1d'),_0x3b7151['name'],_0x3b7151['id']),util[_0x22e0('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x394874(_0x3a82e8);});}else{return _0x394874(null,_0x18f1f7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 5eb1b30..20df539 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 _0x72fa=['options','raw','where','attributes','limit','include','map','model','info','debug','ShowZohoAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0x3bf80d,_0xa866f0){var _0xf47f58=function(_0xbd4c6c){while(--_0xbd4c6c){_0x3bf80d['push'](_0x3bf80d['shift']());}};_0xf47f58(++_0xa866f0);}(_0x72fa,0x78));var _0xa72f=function(_0x134467,_0x40bd2a){_0x134467=_0x134467-0x0;var _0x2ab317=_0x72fa[_0x134467];return _0x2ab317;};'use strict';var _=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var moment=require('moment');var BPromise=require(_0xa72f('0x2'));var rs=require(_0xa72f('0x3'));var fs=require('fs');var Redis=require(_0xa72f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa72f('0x5'))(_0xa72f('0x6'));var config=require(_0xa72f('0x7'));var jayson=require(_0xa72f('0x8'));var client=jayson[_0xa72f('0x9')][_0xa72f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cd1a3,_0xe8aa31,_0x1e1b85){return new BPromise(function(_0x33eae5,_0x57d4fa){return client[_0xa72f('0xb')](_0x2cd1a3,_0x1e1b85)[_0xa72f('0xc')](function(_0x423bc7){logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));logger['debug'](_0xa72f('0xf'),_0xe8aa31,_0xa72f('0xe'),JSON[_0xa72f('0x10')](_0x423bc7));if(_0x423bc7[_0xa72f('0x11')]){if(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x12')]===0x1f4){logger[_0xa72f('0x11')](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x57d4fa(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);}logger['error'](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x33eae5(_0x423bc7['error'][_0xa72f('0x13')]);}else{logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));_0x33eae5(_0x423bc7['result'][_0xa72f('0x13')]);}})[_0xa72f('0x14')](function(_0x461119){logger[_0xa72f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xe8aa31,_0x461119);_0x57d4fa(_0x461119);});});}exports[_0xa72f('0x15')]=function(_0x79d7a){var _0x425e89=this;return new Promise(function(_0x303faa,_0x59b62a){return db[_0xa72f('0x16')][_0xa72f('0x17')]({'raw':_0x79d7a[_0xa72f('0x18')]?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x19')]===undefined?!![]:![]:!![],'where':_0x79d7a[_0xa72f('0x18')]?_0x79d7a['options'][_0xa72f('0x1a')]||null:null,'attributes':_0x79d7a['options']?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1b')]||null:null,'limit':_0x79d7a['options']?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1c')]||null:null,'include':_0x79d7a[_0xa72f('0x18')]?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1d')],function(_0x1e3af9){return{'model':db[_0x1e3af9[_0xa72f('0x1f')]],'as':_0x1e3af9['as'],'attributes':_0x1e3af9['attributes'],'include':_0x1e3af9[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x1e3af9[_0xa72f('0x1d')],function(_0x40cc13){return{'model':db[_0x40cc13[_0xa72f('0x1f')]],'as':_0x40cc13['as'],'attributes':_0x40cc13['attributes'],'include':_0x40cc13[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x40cc13[_0xa72f('0x1d')],function(_0x25bf66){return{'model':db[_0x25bf66['model']],'as':_0x25bf66['as'],'attributes':_0x25bf66['attributes']};}):[]};}):[]};}):[]:[]})[_0xa72f('0xc')](function(_0x51e4e4){logger[_0xa72f('0x20')](_0xa72f('0x15'),_0x79d7a);logger[_0xa72f('0x21')](_0xa72f('0x15'),_0x79d7a,JSON[_0xa72f('0x10')](_0x51e4e4));_0x303faa(_0x51e4e4);})['catch'](function(_0x259a9a){logger[_0xa72f('0x11')](_0xa72f('0x15'),_0x259a9a[_0xa72f('0x13')],_0x79d7a);_0x59b62a(_0x425e89['error'](0x1f4,_0x259a9a[_0xa72f('0x13')]));});});};exports[_0xa72f('0x22')]=function(_0x4c1eff){var _0x2cd213=this;return new Promise(function(_0x2216ce,_0x3206ab){return db['ZohoAccount'][_0xa72f('0x23')]({'raw':_0x4c1eff['options']?_0x4c1eff[_0xa72f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff['options'][_0xa72f('0x1a')]||null:null,'attributes':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff[_0xa72f('0x18')][_0xa72f('0x1b')]||null:null,'include':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff['options'][_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x4c1eff[_0xa72f('0x18')][_0xa72f('0x1d')],function(_0x216c49){return{'model':db[_0x216c49[_0xa72f('0x1f')]],'as':_0x216c49['as'],'attributes':_0x216c49[_0xa72f('0x1b')],'include':_0x216c49[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x216c49[_0xa72f('0x1d')],function(_0x316b10){return{'model':db[_0x316b10['model']],'as':_0x316b10['as'],'attributes':_0x316b10['attributes'],'include':_0x316b10[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x316b10[_0xa72f('0x1d')],function(_0x6fb77e){return{'model':db[_0x6fb77e[_0xa72f('0x1f')]],'as':_0x6fb77e['as'],'attributes':_0x6fb77e[_0xa72f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35eae4){logger[_0xa72f('0x20')]('ShowZohoAccount',_0x4c1eff);logger[_0xa72f('0x21')]('ShowZohoAccount',_0x4c1eff,JSON[_0xa72f('0x10')](_0x35eae4));_0x2216ce(_0x35eae4);})[_0xa72f('0x14')](function(_0x43a56f){logger[_0xa72f('0x11')](_0xa72f('0x22'),_0x43a56f[_0xa72f('0x13')],_0x4c1eff);_0x3206ab(_0x2cd213['error'](0x1f4,_0x43a56f[_0xa72f('0x13')]));});});}; \ No newline at end of file +var _0xdfb1=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ZohoAccount','options','raw','limit','include','model','attributes','map','then','GetZohoAccount','catch','ShowZohoAccount','find','where'];(function(_0x3f447c,_0xb0e1f3){var _0xfa01e1=function(_0x4ebe91){while(--_0x4ebe91){_0x3f447c['push'](_0x3f447c['shift']());}};_0xfa01e1(++_0xb0e1f3);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x27f55c,_0x4dec4a){_0x27f55c=_0x27f55c-0x0;var _0x5595ed=_0xdfb1[_0x27f55c];return _0x5595ed;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var moment=require(_0x1dfb('0x2'));var BPromise=require(_0x1dfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dfb('0x4'));var db=require(_0x1dfb('0x5'))['db'];var utils=require(_0x1dfb('0x6'));var logger=require(_0x1dfb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1dfb('0x8')][_0x1dfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e10d9,_0x496be7,_0x42d45e){return new BPromise(function(_0x491406,_0x141081){return client[_0x1dfb('0xa')](_0x1e10d9,_0x42d45e)['then'](function(_0x24d8b9){logger[_0x1dfb('0xb')](_0x1dfb('0xc'),_0x496be7,'request\x20sent');logger[_0x1dfb('0xd')](_0x1dfb('0xe'),_0x496be7,_0x1dfb('0xf'),JSON[_0x1dfb('0x10')](_0x24d8b9));if(_0x24d8b9[_0x1dfb('0x11')]){if(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x12')]===0x1f4){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9['error'][_0x1dfb('0x13')]);return _0x141081(_0x24d8b9[_0x1dfb('0x11')]['message']);}logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9[_0x1dfb('0x11')]['message']);return _0x491406(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x13')]);}else{logger[_0x1dfb('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x496be7,_0x1dfb('0xf'));_0x491406(_0x24d8b9[_0x1dfb('0x14')][_0x1dfb('0x13')]);}})['catch'](function(_0x1186d1){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x1186d1);_0x141081(_0x1186d1);});});}exports['GetZohoAccount']=function(_0x51c0fc){var _0x2415fe=this;return new Promise(function(_0x22cfdc,_0x37c3dc){return db[_0x1dfb('0x15')]['findAll']({'raw':_0x51c0fc[_0x1dfb('0x16')]?_0x51c0fc[_0x1dfb('0x16')][_0x1dfb('0x17')]===undefined?!![]:![]:!![],'where':_0x51c0fc[_0x1dfb('0x16')]?_0x51c0fc[_0x1dfb('0x16')]['where']||null:null,'attributes':_0x51c0fc[_0x1dfb('0x16')]?_0x51c0fc['options']['attributes']||null:null,'limit':_0x51c0fc['options']?_0x51c0fc[_0x1dfb('0x16')][_0x1dfb('0x18')]||null:null,'include':_0x51c0fc[_0x1dfb('0x16')]?_0x51c0fc['options']['include']?_['map'](_0x51c0fc[_0x1dfb('0x16')][_0x1dfb('0x19')],function(_0x1cf4cd){return{'model':db[_0x1cf4cd[_0x1dfb('0x1a')]],'as':_0x1cf4cd['as'],'attributes':_0x1cf4cd[_0x1dfb('0x1b')],'include':_0x1cf4cd[_0x1dfb('0x19')]?_[_0x1dfb('0x1c')](_0x1cf4cd[_0x1dfb('0x19')],function(_0xd711d1){return{'model':db[_0xd711d1['model']],'as':_0xd711d1['as'],'attributes':_0xd711d1['attributes'],'include':_0xd711d1[_0x1dfb('0x19')]?_[_0x1dfb('0x1c')](_0xd711d1['include'],function(_0x520ac8){return{'model':db[_0x520ac8['model']],'as':_0x520ac8['as'],'attributes':_0x520ac8[_0x1dfb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1dfb('0x1d')](function(_0x53e7b4){logger[_0x1dfb('0xb')]('GetZohoAccount',_0x51c0fc);logger[_0x1dfb('0xd')](_0x1dfb('0x1e'),_0x51c0fc,JSON['stringify'](_0x53e7b4));_0x22cfdc(_0x53e7b4);})[_0x1dfb('0x1f')](function(_0x417f71){logger[_0x1dfb('0x11')]('GetZohoAccount',_0x417f71[_0x1dfb('0x13')],_0x51c0fc);_0x37c3dc(_0x2415fe[_0x1dfb('0x11')](0x1f4,_0x417f71[_0x1dfb('0x13')]));});});};exports[_0x1dfb('0x20')]=function(_0x3c2511){var _0x49e973=this;return new Promise(function(_0x2bcc56,_0x30ad77){return db['ZohoAccount'][_0x1dfb('0x21')]({'raw':_0x3c2511[_0x1dfb('0x16')]?_0x3c2511['options'][_0x1dfb('0x17')]===undefined?!![]:![]:!![],'where':_0x3c2511[_0x1dfb('0x16')]?_0x3c2511[_0x1dfb('0x16')][_0x1dfb('0x22')]||null:null,'attributes':_0x3c2511[_0x1dfb('0x16')]?_0x3c2511[_0x1dfb('0x16')][_0x1dfb('0x1b')]||null:null,'include':_0x3c2511[_0x1dfb('0x16')]?_0x3c2511[_0x1dfb('0x16')][_0x1dfb('0x19')]?_['map'](_0x3c2511[_0x1dfb('0x16')][_0x1dfb('0x19')],function(_0x450cec){return{'model':db[_0x450cec['model']],'as':_0x450cec['as'],'attributes':_0x450cec[_0x1dfb('0x1b')],'include':_0x450cec[_0x1dfb('0x19')]?_[_0x1dfb('0x1c')](_0x450cec['include'],function(_0x4bb473){return{'model':db[_0x4bb473[_0x1dfb('0x1a')]],'as':_0x4bb473['as'],'attributes':_0x4bb473[_0x1dfb('0x1b')],'include':_0x4bb473['include']?_[_0x1dfb('0x1c')](_0x4bb473[_0x1dfb('0x19')],function(_0x2ccf70){return{'model':db[_0x2ccf70['model']],'as':_0x2ccf70['as'],'attributes':_0x2ccf70[_0x1dfb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1dfb('0x1d')](function(_0x260b06){logger[_0x1dfb('0xb')]('ShowZohoAccount',_0x3c2511);logger[_0x1dfb('0xd')](_0x1dfb('0x20'),_0x3c2511,JSON['stringify'](_0x260b06));_0x2bcc56(_0x260b06);})['catch'](function(_0x308262){logger['error'](_0x1dfb('0x20'),_0x308262['message'],_0x3c2511);_0x30ad77(_0x49e973['error'](0x1f4,_0x308262[_0x1dfb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index e9a281b..dce04b6 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 _0xa652=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','getSubjects','post','create','put','/:id','update','delete','exports','util'];(function(_0x8f19b9,_0xbf083f){var _0x1d8aab=function(_0x49b7c5){while(--_0x49b7c5){_0x8f19b9['push'](_0x8f19b9['shift']());}};_0x1d8aab(++_0xbf083f);}(_0xa652,0x99));var _0x2a65=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa652[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x2a65('0x0'));var path=require(_0x2a65('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a65('0x2'));var router=express[_0x2a65('0x3')]();var fs_extra=require(_0x2a65('0x4'));var auth=require(_0x2a65('0x5'));var interaction=require(_0x2a65('0x6'));var config=require(_0x2a65('0x7'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x2a65('0x8')](),controller[_0x2a65('0x9')]);router[_0x2a65('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2a65('0xb')]);router['get'](_0x2a65('0xc'),auth[_0x2a65('0x8')](),controller[_0x2a65('0xd')]);router[_0x2a65('0xa')]('/:id/subjects',auth[_0x2a65('0x8')](),controller[_0x2a65('0xe')]);router[_0x2a65('0xa')]('/:id/descriptions',auth[_0x2a65('0x8')](),controller['getDescriptions']);router[_0x2a65('0xf')]('/',auth[_0x2a65('0x8')](),controller[_0x2a65('0x10')]);router[_0x2a65('0x11')](_0x2a65('0x12'),auth[_0x2a65('0x8')](),controller[_0x2a65('0x13')]);router[_0x2a65('0x14')](_0x2a65('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a65('0x15')]=router; \ No newline at end of file +var _0xb84c=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','path','connect-timeout','express'];(function(_0x2bc03f,_0x3e6b61){var _0x3572cf=function(_0x5812ba){while(--_0x5812ba){_0x2bc03f['push'](_0x2bc03f['shift']());}};_0x3572cf(++_0x3e6b61);}(_0xb84c,0x164));var _0xcb84=function(_0xfb59d,_0x5f31ae){_0xfb59d=_0xfb59d-0x0;var _0x321f39=_0xb84c[_0xfb59d];return _0x321f39;};'use strict';var multer=require(_0xcb84('0x0'));var util=require('util');var path=require(_0xcb84('0x1'));var timeout=require(_0xcb84('0x2'));var express=require(_0xcb84('0x3'));var router=express[_0xcb84('0x4')]();var fs_extra=require(_0xcb84('0x5'));var auth=require(_0xcb84('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb84('0x7'));var controller=require(_0xcb84('0x8'));router[_0xcb84('0x9')]('/',auth[_0xcb84('0xa')](),controller[_0xcb84('0xb')]);router[_0xcb84('0x9')](_0xcb84('0xc'),auth[_0xcb84('0xa')](),controller[_0xcb84('0xd')]);router[_0xcb84('0x9')](_0xcb84('0xe'),auth['isAuthenticated'](),controller[_0xcb84('0xf')]);router[_0xcb84('0x9')](_0xcb84('0x10'),auth[_0xcb84('0xa')](),controller['getSubjects']);router[_0xcb84('0x9')](_0xcb84('0x11'),auth[_0xcb84('0xa')](),controller[_0xcb84('0x12')]);router[_0xcb84('0x13')]('/',auth[_0xcb84('0xa')](),controller[_0xcb84('0x14')]);router[_0xcb84('0x15')](_0xcb84('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcb84('0x16')](_0xcb84('0xc'),auth[_0xcb84('0xa')](),controller['destroy']);module[_0xcb84('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 a2010c3..3f47bf5 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 _0x7266=['lead','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x3336c1,_0x2275be){var _0x352f07=function(_0x15cd06){while(--_0x15cd06){_0x3336c1['push'](_0x3336c1['shift']());}};_0x352f07(++_0x2275be);}(_0x7266,0xec));var _0x6726=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7266[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x6726('0x0'));module[_0x6726('0x1')]={'name':{'type':Sequelize[_0x6726('0x2')]},'moduleCreate':{'type':Sequelize[_0x6726('0x3')](_0x6726('0x4'),'contact','nothing'),'defaultValue':_0x6726('0x4')},'moduleSearch':{'type':Sequelize[_0x6726('0x3')]('contact_lead','contact',_0x6726('0x4')),'defaultValue':_0x6726('0x5')},'description':{'type':Sequelize[_0x6726('0x2')]}}; \ No newline at end of file +var _0x635e=['nothing','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x805d1b,_0x4de44b){var _0x158e24=function(_0x4aabaa){while(--_0x4aabaa){_0x805d1b['push'](_0x805d1b['shift']());}};_0x158e24(++_0x4de44b);}(_0x635e,0xf6));var _0xe635=function(_0x57ed3e,_0x139b0e){_0x57ed3e=_0x57ed3e-0x0;var _0xb6506c=_0x635e[_0x57ed3e];return _0xb6506c;};'use strict';var Sequelize=require(_0xe635('0x0'));module[_0xe635('0x1')]={'name':{'type':Sequelize[_0xe635('0x2')]},'moduleCreate':{'type':Sequelize[_0xe635('0x3')](_0xe635('0x4'),_0xe635('0x5'),_0xe635('0x6')),'defaultValue':_0xe635('0x4')},'moduleSearch':{'type':Sequelize[_0xe635('0x3')]('contact_lead',_0xe635('0x5'),_0xe635('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe635('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 35aca86..9b7e200 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 _0x51f9=['keys','include','merge','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params'];(function(_0x1db91e,_0x236392){var _0x39bbbc=function(_0x1f0253){while(--_0x1f0253){_0x1db91e['push'](_0x1db91e['shift']());}};_0x39bbbc(++_0x236392);}(_0x51f9,0x13f));var _0x951f=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x51f9[_0x45ce08];return _0x23dff2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x951f('0x0'));var zipdir=require(_0x951f('0x1'));var jsonpatch=require(_0x951f('0x2'));var rp=require('request-promise');var moment=require(_0x951f('0x3'));var BPromise=require(_0x951f('0x4'));var Mustache=require(_0x951f('0x5'));var util=require(_0x951f('0x6'));var path=require(_0x951f('0x7'));var sox=require(_0x951f('0x8'));var csv=require('to-csv');var ejs=require(_0x951f('0x9'));var fs=require('fs');var fs_extra=require(_0x951f('0xa'));var _=require('lodash');var squel=require(_0x951f('0xb'));var crypto=require('crypto');var jsforce=require(_0x951f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x951f('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x951f('0xe'));var qs=require(_0x951f('0xf'));var as=require(_0x951f('0x10'));var hardwareService=require(_0x951f('0x11'));var logger=require(_0x951f('0x12'))(_0x951f('0x13'));var utils=require('../../config/utils');var config=require(_0x951f('0x14'));var licenseUtil=require(_0x951f('0x15'));var db=require(_0x951f('0x16'))['db'];function respondWithStatusCode(_0x1b5a3b,_0x5c38f8){_0x5c38f8=_0x5c38f8||0xcc;return function(_0x30b3e7){if(_0x30b3e7){return _0x1b5a3b[_0x951f('0x17')](_0x5c38f8);}return _0x1b5a3b[_0x951f('0x18')](_0x5c38f8)[_0x951f('0x19')]();};}function respondWithResult(_0x5b6787,_0x513e08){_0x513e08=_0x513e08||0xc8;return function(_0x4872df){if(_0x4872df){return _0x5b6787['status'](_0x513e08)['json'](_0x4872df);}};}function respondWithFilteredResult(_0x3a5b91,_0x61b3d4){return function(_0xb9ee45){if(_0xb9ee45){var _0x5425ec=typeof _0x61b3d4[_0x951f('0x1a')]===_0x951f('0x1b')&&typeof _0x61b3d4[_0x951f('0x1c')]===_0x951f('0x1b');var _0x2a919b=_0xb9ee45['count'];var _0x308be6=_0x5425ec?0x0:_0x61b3d4[_0x951f('0x1a')];var _0x501203=_0x5425ec?_0xb9ee45[_0x951f('0x1d')]:_0x61b3d4['offset']+_0x61b3d4[_0x951f('0x1c')];var _0x1bdff8;if(_0x501203>=_0x2a919b){_0x501203=_0x2a919b;_0x1bdff8=0xc8;}else{_0x1bdff8=0xce;}_0x3a5b91['status'](_0x1bdff8);return _0x3a5b91['set'](_0x951f('0x1e'),_0x308be6+'-'+_0x501203+'/'+_0x2a919b)[_0x951f('0x1f')](_0xb9ee45);}return null;};}function patchUpdates(_0x44a6e6){return function(_0x5024c5){try{jsonpatch[_0x951f('0x20')](_0x5024c5,_0x44a6e6,!![]);}catch(_0x17f6b2){return BPromise[_0x951f('0x21')](_0x17f6b2);}return _0x5024c5['save']();};}function saveUpdates(_0x384ffd,_0x3577f1){return function(_0x1775d9){if(_0x1775d9){return _0x1775d9['update'](_0x384ffd)[_0x951f('0x22')](function(_0x3b9066){return _0x3b9066;});}return null;};}function removeEntity(_0x3b5154,_0x4e9430){return function(_0x370281){if(_0x370281){return _0x370281[_0x951f('0x23')]()[_0x951f('0x22')](function(){_0x3b5154[_0x951f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1927bf,_0x2219ec){return function(_0x2a6535){if(!_0x2a6535){_0x1927bf[_0x951f('0x17')](0x194);}return _0x2a6535;};}function handleError(_0x52ccac,_0x3f90d0){_0x3f90d0=_0x3f90d0||0x1f4;return function(_0x4f5ad2){logger['error'](_0x4f5ad2[_0x951f('0x24')]);if(_0x4f5ad2[_0x951f('0x25')]){delete _0x4f5ad2[_0x951f('0x25')];}_0x52ccac[_0x951f('0x18')](_0x3f90d0)[_0x951f('0x26')](_0x4f5ad2);};}exports[_0x951f('0x27')]=function(_0x563b51,_0x5eaa5f){var _0x54736c={},_0x3b858a={},_0x17c3e8={'count':0x0,'rows':[]};var _0x1bae9d=_[_0x951f('0x28')](db[_0x951f('0x29')][_0x951f('0x2a')],function(_0x34983b){return{'name':_0x34983b[_0x951f('0x2b')],'type':_0x34983b[_0x951f('0x2c')]['key']};});_0x3b858a[_0x951f('0x2d')]=_['map'](_0x1bae9d,_0x951f('0x25'));_0x3b858a[_0x951f('0x2e')]=_['keys'](_0x563b51['query']);_0x3b858a[_0x951f('0x2f')]=_[_0x951f('0x30')](_0x3b858a['model'],_0x3b858a['query']);_0x54736c['attributes']=_[_0x951f('0x30')](_0x3b858a[_0x951f('0x2d')],qs[_0x951f('0x31')](_0x563b51['query'][_0x951f('0x31')]));_0x54736c[_0x951f('0x32')]=_0x54736c[_0x951f('0x32')][_0x951f('0x33')]?_0x54736c[_0x951f('0x32')]:_0x3b858a[_0x951f('0x2d')];if(!_0x563b51[_0x951f('0x2e')][_0x951f('0x34')](_0x951f('0x35'))){_0x54736c[_0x951f('0x1c')]=qs['limit'](_0x563b51[_0x951f('0x2e')][_0x951f('0x1c')]);_0x54736c[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x563b51[_0x951f('0x2e')][_0x951f('0x1a')]);}_0x54736c[_0x951f('0x36')]=qs[_0x951f('0x37')](_0x563b51[_0x951f('0x2e')][_0x951f('0x37')]);_0x54736c['where']=qs[_0x951f('0x2f')](_[_0x951f('0x38')](_0x563b51['query'],_0x3b858a['filters']),_0x1bae9d);if(_0x563b51[_0x951f('0x2e')]['filter']){_0x54736c[_0x951f('0x39')]=_['merge'](_0x54736c[_0x951f('0x39')],{'$or':_['map'](_0x1bae9d,function(_0x53671b){if(_0x53671b[_0x951f('0x2c')]!==_0x951f('0x3a')){var _0x10ae78={};_0x10ae78[_0x53671b['name']]={'$like':'%'+_0x563b51[_0x951f('0x2e')][_0x951f('0x3b')]+'%'};return _0x10ae78;}})});}_0x54736c=_['merge']({},_0x54736c,_0x563b51[_0x951f('0x3c')]);var _0x10d695={'where':_0x54736c[_0x951f('0x39')]};return db['ZohoConfiguration']['count'](_0x10d695)[_0x951f('0x22')](function(_0x585811){_0x17c3e8[_0x951f('0x1d')]=_0x585811;if(_0x563b51[_0x951f('0x2e')][_0x951f('0x3d')]){_0x54736c['include']=[{'all':!![]}];}return db[_0x951f('0x29')][_0x951f('0x3e')](_0x54736c);})[_0x951f('0x22')](function(_0x4ae82f){_0x17c3e8[_0x951f('0x3f')]=_0x4ae82f;return _0x17c3e8;})[_0x951f('0x22')](respondWithFilteredResult(_0x5eaa5f,_0x54736c))[_0x951f('0x40')](handleError(_0x5eaa5f,null));};exports['show']=function(_0x433706,_0x2cad15){var _0x30a2da={'raw':![],'where':{'id':_0x433706[_0x951f('0x41')]['id']}},_0x40f6e5={};_0x40f6e5['model']=_[_0x951f('0x42')](db[_0x951f('0x29')][_0x951f('0x2a')]);_0x40f6e5[_0x951f('0x2e')]=_[_0x951f('0x42')](_0x433706[_0x951f('0x2e')]);_0x40f6e5[_0x951f('0x2f')]=_['intersection'](_0x40f6e5[_0x951f('0x2d')],_0x40f6e5[_0x951f('0x2e')]);_0x30a2da['attributes']=_[_0x951f('0x30')](_0x40f6e5[_0x951f('0x2d')],qs[_0x951f('0x31')](_0x433706['query'][_0x951f('0x31')]));_0x30a2da[_0x951f('0x32')]=_0x30a2da['attributes'][_0x951f('0x33')]?_0x30a2da[_0x951f('0x32')]:_0x40f6e5[_0x951f('0x2d')];if(_0x433706[_0x951f('0x2e')][_0x951f('0x3d')]){_0x30a2da[_0x951f('0x43')]=[{'all':!![]}];}_0x30a2da=_[_0x951f('0x44')]({},_0x30a2da,_0x433706[_0x951f('0x3c')]);return db[_0x951f('0x29')][_0x951f('0x45')](_0x30a2da)[_0x951f('0x22')](handleEntityNotFound(_0x2cad15,null))['then'](respondWithResult(_0x2cad15,null))[_0x951f('0x40')](handleError(_0x2cad15,null));};exports[_0x951f('0x46')]=function(_0x22aa1c,_0x20e4bf){return db['ZohoConfiguration'][_0x951f('0x46')](_0x22aa1c[_0x951f('0x47')],{})[_0x951f('0x22')](respondWithResult(_0x20e4bf,0xc9))['catch'](handleError(_0x20e4bf,null));};exports['update']=function(_0x44f60b,_0x2713c2){if(_0x44f60b[_0x951f('0x47')]['id']){delete _0x44f60b['body']['id'];}return db[_0x951f('0x29')][_0x951f('0x45')]({'where':{'id':_0x44f60b[_0x951f('0x41')]['id']}})['then'](handleEntityNotFound(_0x2713c2,null))[_0x951f('0x22')](saveUpdates(_0x44f60b['body'],null))[_0x951f('0x22')](respondWithResult(_0x2713c2,null))['catch'](handleError(_0x2713c2,null));};exports['destroy']=function(_0x1c585c,_0x58a7d7){return db[_0x951f('0x29')][_0x951f('0x45')]({'where':{'id':_0x1c585c['params']['id']}})[_0x951f('0x22')](handleEntityNotFound(_0x58a7d7,null))[_0x951f('0x22')](removeEntity(_0x58a7d7,null))[_0x951f('0x40')](handleError(_0x58a7d7,null));};exports[_0x951f('0x48')]=function(_0x5f0409,_0x49526e,_0x29aed2){var _0x40e526={};var _0x30f100={};var _0x12fab6;var _0x5be4aa;return db[_0x951f('0x29')][_0x951f('0x49')]({'where':{'id':_0x5f0409[_0x951f('0x41')]['id']}})['then'](handleEntityNotFound(_0x49526e,null))[_0x951f('0x22')](function(_0x1c65fc){if(_0x1c65fc){_0x12fab6=_0x1c65fc;_0x30f100['model']=_['keys'](db[_0x951f('0x4a')][_0x951f('0x2a')]);_0x30f100['query']=_['keys'](_0x5f0409[_0x951f('0x2e')]);_0x30f100['filters']=_[_0x951f('0x30')](_0x30f100[_0x951f('0x2d')],_0x30f100[_0x951f('0x2e')]);_0x40e526[_0x951f('0x32')]=_[_0x951f('0x30')](_0x30f100[_0x951f('0x2d')],qs[_0x951f('0x31')](_0x5f0409['query'][_0x951f('0x31')]));_0x40e526[_0x951f('0x32')]=_0x40e526[_0x951f('0x32')]['length']?_0x40e526[_0x951f('0x32')]:_0x30f100[_0x951f('0x2d')];_0x40e526['order']=qs[_0x951f('0x37')](_0x5f0409[_0x951f('0x2e')]['sort']);_0x40e526['where']=qs[_0x951f('0x2f')](_[_0x951f('0x38')](_0x5f0409['query'],_0x30f100[_0x951f('0x2f')]));if(_0x5f0409[_0x951f('0x2e')][_0x951f('0x3b')]){_0x40e526[_0x951f('0x39')]=_['merge'](_0x40e526['where'],{'$or':_[_0x951f('0x28')](_0x40e526['attributes'],function(_0x9d6e47){var _0x29fef8={};_0x29fef8[_0x9d6e47]={'$like':'%'+_0x5f0409[_0x951f('0x2e')][_0x951f('0x3b')]+'%'};return _0x29fef8;})});}_0x40e526=_[_0x951f('0x44')]({},_0x40e526,_0x5f0409['options']);return _0x12fab6[_0x951f('0x48')](_0x40e526);}})['then'](function(_0x430cc9){if(_0x430cc9){_0x5be4aa=_0x430cc9[_0x951f('0x33')];if(!_0x5f0409[_0x951f('0x2e')][_0x951f('0x34')](_0x951f('0x35'))){_0x40e526[_0x951f('0x1c')]=qs[_0x951f('0x1c')](_0x5f0409[_0x951f('0x2e')][_0x951f('0x1c')]);_0x40e526[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x5f0409['query']['offset']);}return _0x12fab6[_0x951f('0x48')](_0x40e526);}})[_0x951f('0x22')](function(_0x496931){if(_0x496931){return _0x496931?{'count':_0x5be4aa,'rows':_0x496931}:null;}})[_0x951f('0x22')](respondWithResult(_0x49526e,null))[_0x951f('0x40')](handleError(_0x49526e,null));};exports[_0x951f('0x4b')]=function(_0x498cff,_0xe11c76,_0x40e648){var _0xafe1be={};var _0x3ab880={};var _0x190020;var _0x3a5391;return db['ZohoConfiguration'][_0x951f('0x49')]({'where':{'id':_0x498cff[_0x951f('0x41')]['id']}})[_0x951f('0x22')](handleEntityNotFound(_0xe11c76,null))[_0x951f('0x22')](function(_0x4d2de8){if(_0x4d2de8){_0x190020=_0x4d2de8;_0x3ab880[_0x951f('0x2d')]=_[_0x951f('0x42')](db[_0x951f('0x4a')][_0x951f('0x2a')]);_0x3ab880['query']=_['keys'](_0x498cff[_0x951f('0x2e')]);_0x3ab880[_0x951f('0x2f')]=_['intersection'](_0x3ab880[_0x951f('0x2d')],_0x3ab880['query']);_0xafe1be[_0x951f('0x32')]=_[_0x951f('0x30')](_0x3ab880['model'],qs['fields'](_0x498cff[_0x951f('0x2e')][_0x951f('0x31')]));_0xafe1be[_0x951f('0x32')]=_0xafe1be[_0x951f('0x32')][_0x951f('0x33')]?_0xafe1be[_0x951f('0x32')]:_0x3ab880[_0x951f('0x2d')];_0xafe1be[_0x951f('0x36')]=qs['sort'](_0x498cff[_0x951f('0x2e')][_0x951f('0x37')]);_0xafe1be[_0x951f('0x39')]=qs['filters'](_[_0x951f('0x38')](_0x498cff[_0x951f('0x2e')],_0x3ab880[_0x951f('0x2f')]));if(_0x498cff[_0x951f('0x2e')]['filter']){_0xafe1be['where']=_[_0x951f('0x44')](_0xafe1be[_0x951f('0x39')],{'$or':_['map'](_0xafe1be['attributes'],function(_0x3accdf){var _0x179681={};_0x179681[_0x3accdf]={'$like':'%'+_0x498cff['query'][_0x951f('0x3b')]+'%'};return _0x179681;})});}_0xafe1be=_[_0x951f('0x44')]({},_0xafe1be,_0x498cff[_0x951f('0x3c')]);return _0x190020[_0x951f('0x4b')](_0xafe1be);}})['then'](function(_0x7a48c7){if(_0x7a48c7){_0x3a5391=_0x7a48c7['length'];if(!_0x498cff[_0x951f('0x2e')][_0x951f('0x34')](_0x951f('0x35'))){_0xafe1be['limit']=qs['limit'](_0x498cff['query'][_0x951f('0x1c')]);_0xafe1be[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x498cff[_0x951f('0x2e')]['offset']);}return _0x190020['getSubjects'](_0xafe1be);}})['then'](function(_0x43e129){if(_0x43e129){return _0x43e129?{'count':_0x3a5391,'rows':_0x43e129}:null;}})[_0x951f('0x22')](respondWithResult(_0xe11c76,null))[_0x951f('0x40')](handleError(_0xe11c76,null));};exports['getDescriptions']=function(_0x7bd79c,_0x48e485,_0xaa0f51){var _0x4d20aa={};var _0x19376a={};var _0x725acc;var _0x4567b1;return db[_0x951f('0x29')][_0x951f('0x49')]({'where':{'id':_0x7bd79c[_0x951f('0x41')]['id']}})[_0x951f('0x22')](handleEntityNotFound(_0x48e485,null))[_0x951f('0x22')](function(_0x502fb3){if(_0x502fb3){_0x725acc=_0x502fb3;_0x19376a['model']=_[_0x951f('0x42')](db[_0x951f('0x4a')][_0x951f('0x2a')]);_0x19376a[_0x951f('0x2e')]=_[_0x951f('0x42')](_0x7bd79c['query']);_0x19376a[_0x951f('0x2f')]=_[_0x951f('0x30')](_0x19376a['model'],_0x19376a[_0x951f('0x2e')]);_0x4d20aa[_0x951f('0x32')]=_[_0x951f('0x30')](_0x19376a['model'],qs[_0x951f('0x31')](_0x7bd79c['query']['fields']));_0x4d20aa[_0x951f('0x32')]=_0x4d20aa['attributes'][_0x951f('0x33')]?_0x4d20aa[_0x951f('0x32')]:_0x19376a[_0x951f('0x2d')];_0x4d20aa[_0x951f('0x36')]=qs[_0x951f('0x37')](_0x7bd79c[_0x951f('0x2e')][_0x951f('0x37')]);_0x4d20aa[_0x951f('0x39')]=qs[_0x951f('0x2f')](_['pick'](_0x7bd79c['query'],_0x19376a[_0x951f('0x2f')]));if(_0x7bd79c[_0x951f('0x2e')]['filter']){_0x4d20aa[_0x951f('0x39')]=_[_0x951f('0x44')](_0x4d20aa[_0x951f('0x39')],{'$or':_[_0x951f('0x28')](_0x4d20aa[_0x951f('0x32')],function(_0x14e666){var _0x26d3af={};_0x26d3af[_0x14e666]={'$like':'%'+_0x7bd79c[_0x951f('0x2e')][_0x951f('0x3b')]+'%'};return _0x26d3af;})});}_0x4d20aa=_[_0x951f('0x44')]({},_0x4d20aa,_0x7bd79c[_0x951f('0x3c')]);return _0x725acc['getDescriptions'](_0x4d20aa);}})['then'](function(_0x35ecdc){if(_0x35ecdc){_0x4567b1=_0x35ecdc['length'];if(!_0x7bd79c[_0x951f('0x2e')]['hasOwnProperty']('nolimit')){_0x4d20aa[_0x951f('0x1c')]=qs[_0x951f('0x1c')](_0x7bd79c[_0x951f('0x2e')][_0x951f('0x1c')]);_0x4d20aa[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x7bd79c[_0x951f('0x2e')]['offset']);}return _0x725acc[_0x951f('0x4c')](_0x4d20aa);}})[_0x951f('0x22')](function(_0x2968f8){if(_0x2968f8){return _0x2968f8?{'count':_0x4567b1,'rows':_0x2968f8}:null;}})[_0x951f('0x22')](respondWithResult(_0x48e485,null))['catch'](handleError(_0x48e485,null));}; \ No newline at end of file +var _0xb490=['apply','reject','then','destroy','end','sendStatus','error','stack','send','index','map','fieldName','type','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','params','ZohoConfiguration','rawAttributes','include','create','body','update','find','findOne','ZohoField','order','filter','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xb490,0x170));var _0x0b49=function(_0x20f4bb,_0x11250a){_0x20f4bb=_0x20f4bb-0x0;var _0x528cc3=_0xb490[_0x20f4bb];return _0x528cc3;};'use strict';var emlformat=require(_0x0b49('0x0'));var rimraf=require(_0x0b49('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b49('0x2'));var rp=require(_0x0b49('0x3'));var moment=require(_0x0b49('0x4'));var BPromise=require(_0x0b49('0x5'));var Mustache=require(_0x0b49('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0b49('0x7'));var csv=require(_0x0b49('0x8'));var ejs=require(_0x0b49('0x9'));var fs=require('fs');var fs_extra=require(_0x0b49('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b49('0xb'));var jsforce=require(_0x0b49('0xc'));var deskjs=require(_0x0b49('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0b49('0xe'));var Papa=require(_0x0b49('0xf'));var Redis=require(_0x0b49('0x10'));var authService=require(_0x0b49('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b49('0x12'));var logger=require(_0x0b49('0x13'))(_0x0b49('0x14'));var utils=require(_0x0b49('0x15'));var config=require(_0x0b49('0x16'));var licenseUtil=require(_0x0b49('0x17'));var db=require(_0x0b49('0x18'))['db'];function respondWithStatusCode(_0x8f708f,_0x41e30b){_0x41e30b=_0x41e30b||0xcc;return function(_0x3b31f1){if(_0x3b31f1){return _0x8f708f['sendStatus'](_0x41e30b);}return _0x8f708f[_0x0b49('0x19')](_0x41e30b)['end']();};}function respondWithResult(_0x402fc4,_0x18e517){_0x18e517=_0x18e517||0xc8;return function(_0x4a20c5){if(_0x4a20c5){return _0x402fc4['status'](_0x18e517)[_0x0b49('0x1a')](_0x4a20c5);}};}function respondWithFilteredResult(_0x8f0bc1,_0x497a00){return function(_0x5bb1ab){if(_0x5bb1ab){var _0x521f57=typeof _0x497a00[_0x0b49('0x1b')]===_0x0b49('0x1c')&&typeof _0x497a00[_0x0b49('0x1d')]==='undefined';var _0x1dd64f=_0x5bb1ab[_0x0b49('0x1e')];var _0x39a104=_0x521f57?0x0:_0x497a00['offset'];var _0x52c8bd=_0x521f57?_0x5bb1ab[_0x0b49('0x1e')]:_0x497a00[_0x0b49('0x1b')]+_0x497a00[_0x0b49('0x1d')];var _0x317416;if(_0x52c8bd>=_0x1dd64f){_0x52c8bd=_0x1dd64f;_0x317416=0xc8;}else{_0x317416=0xce;}_0x8f0bc1[_0x0b49('0x19')](_0x317416);return _0x8f0bc1[_0x0b49('0x1f')]('Content-Range',_0x39a104+'-'+_0x52c8bd+'/'+_0x1dd64f)[_0x0b49('0x1a')](_0x5bb1ab);}return null;};}function patchUpdates(_0x456749){return function(_0x4b05a7){try{jsonpatch[_0x0b49('0x20')](_0x4b05a7,_0x456749,!![]);}catch(_0x16b8e9){return BPromise[_0x0b49('0x21')](_0x16b8e9);}return _0x4b05a7['save']();};}function saveUpdates(_0x133044,_0x16c3d6){return function(_0x476202){if(_0x476202){return _0x476202['update'](_0x133044)[_0x0b49('0x22')](function(_0x375e92){return _0x375e92;});}return null;};}function removeEntity(_0x2bde8a,_0x45c800){return function(_0x44fa8e){if(_0x44fa8e){return _0x44fa8e[_0x0b49('0x23')]()[_0x0b49('0x22')](function(){_0x2bde8a[_0x0b49('0x19')](0xcc)[_0x0b49('0x24')]();});}};}function handleEntityNotFound(_0x1898d6,_0x4e5d5c){return function(_0x439123){if(!_0x439123){_0x1898d6[_0x0b49('0x25')](0x194);}return _0x439123;};}function handleError(_0x37253e,_0x3f4f06){_0x3f4f06=_0x3f4f06||0x1f4;return function(_0x583c86){logger[_0x0b49('0x26')](_0x583c86[_0x0b49('0x27')]);if(_0x583c86['name']){delete _0x583c86['name'];}_0x37253e[_0x0b49('0x19')](_0x3f4f06)[_0x0b49('0x28')](_0x583c86);};}exports[_0x0b49('0x29')]=function(_0x4b5007,_0x47f958){var _0x5988f4={},_0x3511cb={},_0x342f38={'count':0x0,'rows':[]};var _0x4e816c=_[_0x0b49('0x2a')](db['ZohoConfiguration']['rawAttributes'],function(_0x242c70){return{'name':_0x242c70[_0x0b49('0x2b')],'type':_0x242c70[_0x0b49('0x2c')]['key']};});_0x3511cb['model']=_[_0x0b49('0x2a')](_0x4e816c,_0x0b49('0x2d'));_0x3511cb[_0x0b49('0x2e')]=_[_0x0b49('0x2f')](_0x4b5007['query']);_0x3511cb[_0x0b49('0x30')]=_['intersection'](_0x3511cb[_0x0b49('0x31')],_0x3511cb[_0x0b49('0x2e')]);_0x5988f4[_0x0b49('0x32')]=_[_0x0b49('0x33')](_0x3511cb[_0x0b49('0x31')],qs[_0x0b49('0x34')](_0x4b5007[_0x0b49('0x2e')]['fields']));_0x5988f4[_0x0b49('0x32')]=_0x5988f4['attributes'][_0x0b49('0x35')]?_0x5988f4[_0x0b49('0x32')]:_0x3511cb[_0x0b49('0x31')];if(!_0x4b5007[_0x0b49('0x2e')][_0x0b49('0x36')](_0x0b49('0x37'))){_0x5988f4[_0x0b49('0x1d')]=qs[_0x0b49('0x1d')](_0x4b5007[_0x0b49('0x2e')][_0x0b49('0x1d')]);_0x5988f4[_0x0b49('0x1b')]=qs[_0x0b49('0x1b')](_0x4b5007[_0x0b49('0x2e')]['offset']);}_0x5988f4['order']=qs[_0x0b49('0x38')](_0x4b5007[_0x0b49('0x2e')][_0x0b49('0x38')]);_0x5988f4[_0x0b49('0x39')]=qs[_0x0b49('0x30')](_[_0x0b49('0x3a')](_0x4b5007[_0x0b49('0x2e')],_0x3511cb[_0x0b49('0x30')]),_0x4e816c);if(_0x4b5007['query']['filter']){_0x5988f4[_0x0b49('0x39')]=_[_0x0b49('0x3b')](_0x5988f4[_0x0b49('0x39')],{'$or':_[_0x0b49('0x2a')](_0x4e816c,function(_0x5a77e6){if(_0x5a77e6['type']!==_0x0b49('0x3c')){var _0x44d90d={};_0x44d90d[_0x5a77e6[_0x0b49('0x2d')]]={'$like':'%'+_0x4b5007[_0x0b49('0x2e')]['filter']+'%'};return _0x44d90d;}})});}_0x5988f4=_[_0x0b49('0x3b')]({},_0x5988f4,_0x4b5007[_0x0b49('0x3d')]);var _0x352f90={'where':_0x5988f4[_0x0b49('0x39')]};return db['ZohoConfiguration'][_0x0b49('0x1e')](_0x352f90)[_0x0b49('0x22')](function(_0xb0f289){_0x342f38[_0x0b49('0x1e')]=_0xb0f289;if(_0x4b5007['query'][_0x0b49('0x3e')]){_0x5988f4['include']=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x5988f4);})[_0x0b49('0x22')](function(_0x2ff1d9){_0x342f38[_0x0b49('0x3f')]=_0x2ff1d9;return _0x342f38;})[_0x0b49('0x22')](respondWithFilteredResult(_0x47f958,_0x5988f4))[_0x0b49('0x40')](handleError(_0x47f958,null));};exports['show']=function(_0x31553b,_0x5b3ff2){var _0x297367={'raw':![],'where':{'id':_0x31553b[_0x0b49('0x41')]['id']}},_0x31e1c6={};_0x31e1c6['model']=_[_0x0b49('0x2f')](db[_0x0b49('0x42')][_0x0b49('0x43')]);_0x31e1c6[_0x0b49('0x2e')]=_[_0x0b49('0x2f')](_0x31553b[_0x0b49('0x2e')]);_0x31e1c6[_0x0b49('0x30')]=_['intersection'](_0x31e1c6[_0x0b49('0x31')],_0x31e1c6['query']);_0x297367['attributes']=_[_0x0b49('0x33')](_0x31e1c6[_0x0b49('0x31')],qs['fields'](_0x31553b[_0x0b49('0x2e')]['fields']));_0x297367[_0x0b49('0x32')]=_0x297367[_0x0b49('0x32')][_0x0b49('0x35')]?_0x297367[_0x0b49('0x32')]:_0x31e1c6['model'];if(_0x31553b[_0x0b49('0x2e')][_0x0b49('0x3e')]){_0x297367[_0x0b49('0x44')]=[{'all':!![]}];}_0x297367=_['merge']({},_0x297367,_0x31553b[_0x0b49('0x3d')]);return db['ZohoConfiguration']['find'](_0x297367)[_0x0b49('0x22')](handleEntityNotFound(_0x5b3ff2,null))['then'](respondWithResult(_0x5b3ff2,null))[_0x0b49('0x40')](handleError(_0x5b3ff2,null));};exports[_0x0b49('0x45')]=function(_0x4dee07,_0x5f3b31){return db[_0x0b49('0x42')]['create'](_0x4dee07[_0x0b49('0x46')],{})[_0x0b49('0x22')](respondWithResult(_0x5f3b31,0xc9))[_0x0b49('0x40')](handleError(_0x5f3b31,null));};exports[_0x0b49('0x47')]=function(_0x2d657c,_0x3c244f){if(_0x2d657c['body']['id']){delete _0x2d657c['body']['id'];}return db['ZohoConfiguration'][_0x0b49('0x48')]({'where':{'id':_0x2d657c[_0x0b49('0x41')]['id']}})[_0x0b49('0x22')](handleEntityNotFound(_0x3c244f,null))[_0x0b49('0x22')](saveUpdates(_0x2d657c[_0x0b49('0x46')],null))[_0x0b49('0x22')](respondWithResult(_0x3c244f,null))[_0x0b49('0x40')](handleError(_0x3c244f,null));};exports[_0x0b49('0x23')]=function(_0x15cf41,_0x4f2095){return db[_0x0b49('0x42')][_0x0b49('0x48')]({'where':{'id':_0x15cf41[_0x0b49('0x41')]['id']}})[_0x0b49('0x22')](handleEntityNotFound(_0x4f2095,null))[_0x0b49('0x22')](removeEntity(_0x4f2095,null))[_0x0b49('0x40')](handleError(_0x4f2095,null));};exports['getFields']=function(_0x803ff3,_0x57fd79,_0x1ddb8d){var _0x44d1c9={};var _0x1412d3={};var _0x39b3d8;var _0x254d61;return db['ZohoConfiguration'][_0x0b49('0x49')]({'where':{'id':_0x803ff3[_0x0b49('0x41')]['id']}})['then'](handleEntityNotFound(_0x57fd79,null))['then'](function(_0x1dcdfd){if(_0x1dcdfd){_0x39b3d8=_0x1dcdfd;_0x1412d3[_0x0b49('0x31')]=_[_0x0b49('0x2f')](db[_0x0b49('0x4a')][_0x0b49('0x43')]);_0x1412d3[_0x0b49('0x2e')]=_[_0x0b49('0x2f')](_0x803ff3[_0x0b49('0x2e')]);_0x1412d3[_0x0b49('0x30')]=_[_0x0b49('0x33')](_0x1412d3['model'],_0x1412d3['query']);_0x44d1c9[_0x0b49('0x32')]=_[_0x0b49('0x33')](_0x1412d3[_0x0b49('0x31')],qs[_0x0b49('0x34')](_0x803ff3[_0x0b49('0x2e')][_0x0b49('0x34')]));_0x44d1c9[_0x0b49('0x32')]=_0x44d1c9[_0x0b49('0x32')]['length']?_0x44d1c9[_0x0b49('0x32')]:_0x1412d3[_0x0b49('0x31')];_0x44d1c9[_0x0b49('0x4b')]=qs['sort'](_0x803ff3['query']['sort']);_0x44d1c9[_0x0b49('0x39')]=qs['filters'](_['pick'](_0x803ff3[_0x0b49('0x2e')],_0x1412d3[_0x0b49('0x30')]));if(_0x803ff3[_0x0b49('0x2e')][_0x0b49('0x4c')]){_0x44d1c9['where']=_[_0x0b49('0x3b')](_0x44d1c9[_0x0b49('0x39')],{'$or':_[_0x0b49('0x2a')](_0x44d1c9[_0x0b49('0x32')],function(_0x38c7b6){var _0x2e9b14={};_0x2e9b14[_0x38c7b6]={'$like':'%'+_0x803ff3[_0x0b49('0x2e')]['filter']+'%'};return _0x2e9b14;})});}_0x44d1c9=_['merge']({},_0x44d1c9,_0x803ff3[_0x0b49('0x3d')]);return _0x39b3d8[_0x0b49('0x4d')](_0x44d1c9);}})[_0x0b49('0x22')](function(_0x2c8279){if(_0x2c8279){_0x254d61=_0x2c8279[_0x0b49('0x35')];if(!_0x803ff3[_0x0b49('0x2e')][_0x0b49('0x36')](_0x0b49('0x37'))){_0x44d1c9[_0x0b49('0x1d')]=qs[_0x0b49('0x1d')](_0x803ff3['query'][_0x0b49('0x1d')]);_0x44d1c9[_0x0b49('0x1b')]=qs[_0x0b49('0x1b')](_0x803ff3[_0x0b49('0x2e')][_0x0b49('0x1b')]);}return _0x39b3d8[_0x0b49('0x4d')](_0x44d1c9);}})['then'](function(_0x4b07e9){if(_0x4b07e9){return _0x4b07e9?{'count':_0x254d61,'rows':_0x4b07e9}:null;}})[_0x0b49('0x22')](respondWithResult(_0x57fd79,null))[_0x0b49('0x40')](handleError(_0x57fd79,null));};exports[_0x0b49('0x4e')]=function(_0x2c2dc7,_0x23bbe6,_0x84e4ea){var _0x3e9676={};var _0x37f137={};var _0x322a77;var _0x21e2ee;return db[_0x0b49('0x42')]['findOne']({'where':{'id':_0x2c2dc7['params']['id']}})[_0x0b49('0x22')](handleEntityNotFound(_0x23bbe6,null))[_0x0b49('0x22')](function(_0xe91505){if(_0xe91505){_0x322a77=_0xe91505;_0x37f137[_0x0b49('0x31')]=_[_0x0b49('0x2f')](db[_0x0b49('0x4a')][_0x0b49('0x43')]);_0x37f137['query']=_['keys'](_0x2c2dc7[_0x0b49('0x2e')]);_0x37f137[_0x0b49('0x30')]=_['intersection'](_0x37f137[_0x0b49('0x31')],_0x37f137[_0x0b49('0x2e')]);_0x3e9676[_0x0b49('0x32')]=_[_0x0b49('0x33')](_0x37f137[_0x0b49('0x31')],qs[_0x0b49('0x34')](_0x2c2dc7['query'][_0x0b49('0x34')]));_0x3e9676[_0x0b49('0x32')]=_0x3e9676[_0x0b49('0x32')]['length']?_0x3e9676[_0x0b49('0x32')]:_0x37f137[_0x0b49('0x31')];_0x3e9676[_0x0b49('0x4b')]=qs[_0x0b49('0x38')](_0x2c2dc7[_0x0b49('0x2e')][_0x0b49('0x38')]);_0x3e9676[_0x0b49('0x39')]=qs[_0x0b49('0x30')](_['pick'](_0x2c2dc7['query'],_0x37f137[_0x0b49('0x30')]));if(_0x2c2dc7[_0x0b49('0x2e')][_0x0b49('0x4c')]){_0x3e9676[_0x0b49('0x39')]=_[_0x0b49('0x3b')](_0x3e9676[_0x0b49('0x39')],{'$or':_[_0x0b49('0x2a')](_0x3e9676[_0x0b49('0x32')],function(_0x517314){var _0x41ae0b={};_0x41ae0b[_0x517314]={'$like':'%'+_0x2c2dc7[_0x0b49('0x2e')][_0x0b49('0x4c')]+'%'};return _0x41ae0b;})});}_0x3e9676=_['merge']({},_0x3e9676,_0x2c2dc7[_0x0b49('0x3d')]);return _0x322a77[_0x0b49('0x4e')](_0x3e9676);}})[_0x0b49('0x22')](function(_0x26428c){if(_0x26428c){_0x21e2ee=_0x26428c['length'];if(!_0x2c2dc7[_0x0b49('0x2e')][_0x0b49('0x36')](_0x0b49('0x37'))){_0x3e9676[_0x0b49('0x1d')]=qs[_0x0b49('0x1d')](_0x2c2dc7['query'][_0x0b49('0x1d')]);_0x3e9676[_0x0b49('0x1b')]=qs['offset'](_0x2c2dc7[_0x0b49('0x2e')][_0x0b49('0x1b')]);}return _0x322a77[_0x0b49('0x4e')](_0x3e9676);}})[_0x0b49('0x22')](function(_0x455dd6){if(_0x455dd6){return _0x455dd6?{'count':_0x21e2ee,'rows':_0x455dd6}:null;}})[_0x0b49('0x22')](respondWithResult(_0x23bbe6,null))[_0x0b49('0x40')](handleError(_0x23bbe6,null));};exports[_0x0b49('0x4f')]=function(_0x1d2918,_0x30f414,_0x51271c){var _0x1ff7d7={};var _0x26d7f0={};var _0x53ff65;var _0x225d38;return db[_0x0b49('0x42')][_0x0b49('0x49')]({'where':{'id':_0x1d2918[_0x0b49('0x41')]['id']}})[_0x0b49('0x22')](handleEntityNotFound(_0x30f414,null))[_0x0b49('0x22')](function(_0x95c892){if(_0x95c892){_0x53ff65=_0x95c892;_0x26d7f0[_0x0b49('0x31')]=_[_0x0b49('0x2f')](db[_0x0b49('0x4a')][_0x0b49('0x43')]);_0x26d7f0[_0x0b49('0x2e')]=_[_0x0b49('0x2f')](_0x1d2918[_0x0b49('0x2e')]);_0x26d7f0[_0x0b49('0x30')]=_['intersection'](_0x26d7f0[_0x0b49('0x31')],_0x26d7f0[_0x0b49('0x2e')]);_0x1ff7d7[_0x0b49('0x32')]=_[_0x0b49('0x33')](_0x26d7f0[_0x0b49('0x31')],qs[_0x0b49('0x34')](_0x1d2918[_0x0b49('0x2e')][_0x0b49('0x34')]));_0x1ff7d7[_0x0b49('0x32')]=_0x1ff7d7[_0x0b49('0x32')][_0x0b49('0x35')]?_0x1ff7d7[_0x0b49('0x32')]:_0x26d7f0[_0x0b49('0x31')];_0x1ff7d7[_0x0b49('0x4b')]=qs[_0x0b49('0x38')](_0x1d2918[_0x0b49('0x2e')][_0x0b49('0x38')]);_0x1ff7d7[_0x0b49('0x39')]=qs[_0x0b49('0x30')](_['pick'](_0x1d2918[_0x0b49('0x2e')],_0x26d7f0[_0x0b49('0x30')]));if(_0x1d2918[_0x0b49('0x2e')]['filter']){_0x1ff7d7['where']=_[_0x0b49('0x3b')](_0x1ff7d7[_0x0b49('0x39')],{'$or':_[_0x0b49('0x2a')](_0x1ff7d7[_0x0b49('0x32')],function(_0x43d2b2){var _0x4f1f4c={};_0x4f1f4c[_0x43d2b2]={'$like':'%'+_0x1d2918[_0x0b49('0x2e')]['filter']+'%'};return _0x4f1f4c;})});}_0x1ff7d7=_[_0x0b49('0x3b')]({},_0x1ff7d7,_0x1d2918['options']);return _0x53ff65[_0x0b49('0x4f')](_0x1ff7d7);}})[_0x0b49('0x22')](function(_0x9676c9){if(_0x9676c9){_0x225d38=_0x9676c9['length'];if(!_0x1d2918[_0x0b49('0x2e')]['hasOwnProperty'](_0x0b49('0x37'))){_0x1ff7d7[_0x0b49('0x1d')]=qs[_0x0b49('0x1d')](_0x1d2918[_0x0b49('0x2e')][_0x0b49('0x1d')]);_0x1ff7d7['offset']=qs['offset'](_0x1d2918[_0x0b49('0x2e')][_0x0b49('0x1b')]);}return _0x53ff65[_0x0b49('0x4f')](_0x1ff7d7);}})[_0x0b49('0x22')](function(_0x494338){if(_0x494338){return _0x494338?{'count':_0x225d38,'rows':_0x494338}:null;}})[_0x0b49('0x22')](respondWithResult(_0x30f414,null))[_0x0b49('0x40')](handleError(_0x30f414,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 76130af..fe8de3b 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 _0xb125=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x443f47,_0xc4f09f){var _0x1c3d82=function(_0x16892a){while(--_0x16892a){_0x443f47['push'](_0x443f47['shift']());}};_0x1c3d82(++_0xc4f09f);}(_0xb125,0x14c));var _0x5b12=function(_0x411ce8,_0x55c0ef){_0x411ce8=_0x411ce8-0x0;var _0x294267=_0xb125[_0x411ce8];return _0x294267;};'use strict';var _=require(_0x5b12('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b12('0x1'));var moment=require(_0x5b12('0x2'));var BPromise=require(_0x5b12('0x3'));var rp=require(_0x5b12('0x4'));var fs=require('fs');var path=require(_0x5b12('0x5'));var rimraf=require(_0x5b12('0x6'));var config=require(_0x5b12('0x7'));var attributes=require(_0x5b12('0x8'));module[_0x5b12('0x9')]=function(_0x26733f,_0x543636){return _0x26733f[_0x5b12('0xa')](_0x5b12('0xb'),attributes,{'tableName':_0x5b12('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x590f=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x22739f,_0x703051){var _0x344477=function(_0x2b9f9b){while(--_0x2b9f9b){_0x22739f['push'](_0x22739f['shift']());}};_0x344477(++_0x703051);}(_0x590f,0x6d));var _0xf590=function(_0x468501,_0x3a38b0){_0x468501=_0x468501-0x0;var _0x320365=_0x590f[_0x468501];return _0x320365;};'use strict';var _=require(_0xf590('0x0'));var util=require(_0xf590('0x1'));var logger=require(_0xf590('0x2'))(_0xf590('0x3'));var moment=require(_0xf590('0x4'));var BPromise=require(_0xf590('0x5'));var rp=require(_0xf590('0x6'));var fs=require('fs');var path=require(_0xf590('0x7'));var rimraf=require(_0xf590('0x8'));var config=require(_0xf590('0x9'));var attributes=require(_0xf590('0xa'));module[_0xf590('0xb')]=function(_0x3038aa,_0x54c8e8){return _0x3038aa[_0xf590('0xc')](_0xf590('0xd'),attributes,{'tableName':_0xf590('0xe'),'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 ae4757b..714b6c7 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 _0x1f6e=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0x1f6e,0xa9));var _0xe1f6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1f6e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe1f6('0x0'));var util=require('util');var moment=require(_0xe1f6('0x1'));var BPromise=require(_0xe1f6('0x2'));var rs=require(_0xe1f6('0x3'));var fs=require('fs');var Redis=require(_0xe1f6('0x4'));var db=require(_0xe1f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1f6('0x6'))(_0xe1f6('0x7'));var config=require(_0xe1f6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe1f6('0x9')][_0xe1f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54043a,_0x38a2b1,_0x33f3a6){return new BPromise(function(_0x4e788f,_0x44e181){return client['request'](_0x54043a,_0x33f3a6)[_0xe1f6('0xb')](function(_0x29747b){logger['info'](_0xe1f6('0xc'),_0x38a2b1,_0xe1f6('0xd'));logger['debug'](_0xe1f6('0xe'),_0x38a2b1,_0xe1f6('0xd'),JSON[_0xe1f6('0xf')](_0x29747b));if(_0x29747b[_0xe1f6('0x10')]){if(_0x29747b[_0xe1f6('0x10')][_0xe1f6('0x11')]===0x1f4){logger[_0xe1f6('0x10')](_0xe1f6('0xc'),_0x38a2b1,_0x29747b[_0xe1f6('0x10')][_0xe1f6('0x12')]);return _0x44e181(_0x29747b[_0xe1f6('0x10')]['message']);}logger[_0xe1f6('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x38a2b1,_0x29747b[_0xe1f6('0x10')][_0xe1f6('0x12')]);return _0x4e788f(_0x29747b['error'][_0xe1f6('0x12')]);}else{logger['info'](_0xe1f6('0xc'),_0x38a2b1,_0xe1f6('0xd'));_0x4e788f(_0x29747b[_0xe1f6('0x13')][_0xe1f6('0x12')]);}})[_0xe1f6('0x14')](function(_0x3ff70c){logger[_0xe1f6('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x38a2b1,_0x3ff70c);_0x44e181(_0x3ff70c);});});} \ No newline at end of file +var _0x9d16=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9d16,0xa5));var _0x69d1=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x9d16[_0x26bcec];return _0x1049dc;};'use strict';var _=require(_0x69d1('0x0'));var util=require('util');var moment=require(_0x69d1('0x1'));var BPromise=require(_0x69d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69d1('0x3'));var db=require(_0x69d1('0x4'))['db'];var utils=require(_0x69d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x69d1('0x6'));var jayson=require(_0x69d1('0x7'));var client=jayson[_0x69d1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x395476,_0x354138,_0x331dfc){return new BPromise(function(_0x22529c,_0xd9040a){return client[_0x69d1('0x9')](_0x395476,_0x331dfc)[_0x69d1('0xa')](function(_0x25d0ab){logger[_0x69d1('0xb')](_0x69d1('0xc'),_0x354138,_0x69d1('0xd'));logger[_0x69d1('0xe')](_0x69d1('0xf'),_0x354138,_0x69d1('0xd'),JSON[_0x69d1('0x10')](_0x25d0ab));if(_0x25d0ab[_0x69d1('0x11')]){if(_0x25d0ab[_0x69d1('0x11')][_0x69d1('0x12')]===0x1f4){logger[_0x69d1('0x11')](_0x69d1('0xc'),_0x354138,_0x25d0ab[_0x69d1('0x11')][_0x69d1('0x13')]);return _0xd9040a(_0x25d0ab[_0x69d1('0x11')][_0x69d1('0x13')]);}logger[_0x69d1('0x11')](_0x69d1('0xc'),_0x354138,_0x25d0ab['error']['message']);return _0x22529c(_0x25d0ab[_0x69d1('0x11')][_0x69d1('0x13')]);}else{logger['info'](_0x69d1('0xc'),_0x354138,_0x69d1('0xd'));_0x22529c(_0x25d0ab[_0x69d1('0x14')][_0x69d1('0x13')]);}})[_0x69d1('0x15')](function(_0x791ee0){logger[_0x69d1('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x354138,_0x791ee0);_0xd9040a(_0x791ee0);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0bbf423..1dc872f 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 _0x6a3a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6a3a,0x18f));var _0xa6a3=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x6a3a[_0x4ed520];return _0x4415a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa6a3('0x0'));var timeout=require(_0xa6a3('0x1'));var express=require(_0xa6a3('0x2'));var router=express[_0xa6a3('0x3')]();var fs_extra=require(_0xa6a3('0x4'));var auth=require(_0xa6a3('0x5'));var interaction=require(_0xa6a3('0x6'));var config=require(_0xa6a3('0x7'));var controller=require(_0xa6a3('0x8'));router[_0xa6a3('0x9')]('/',auth[_0xa6a3('0xa')](),controller[_0xa6a3('0xb')]);router[_0xa6a3('0x9')](_0xa6a3('0xc'),auth[_0xa6a3('0xa')](),controller[_0xa6a3('0xd')]);router['post']('/',auth[_0xa6a3('0xa')](),controller[_0xa6a3('0xe')]);router[_0xa6a3('0xf')](_0xa6a3('0xc'),auth['isAuthenticated'](),controller[_0xa6a3('0x10')]);router[_0xa6a3('0x11')](_0xa6a3('0xc'),auth['isAuthenticated'](),controller[_0xa6a3('0x12')]);module[_0xa6a3('0x13')]=router; \ No newline at end of file +var _0x251f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','path','express','fs-extra'];(function(_0x4a4a17,_0x561ae6){var _0x16b50f=function(_0x207252){while(--_0x207252){_0x4a4a17['push'](_0x4a4a17['shift']());}};_0x16b50f(++_0x561ae6);}(_0x251f,0xf3));var _0xf251=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x251f[_0x2af160];return _0x439d67;};'use strict';var multer=require(_0xf251('0x0'));var util=require('util');var path=require(_0xf251('0x1'));var timeout=require('connect-timeout');var express=require(_0xf251('0x2'));var router=express['Router']();var fs_extra=require(_0xf251('0x3'));var auth=require(_0xf251('0x4'));var interaction=require(_0xf251('0x5'));var config=require(_0xf251('0x6'));var controller=require(_0xf251('0x7'));router['get']('/',auth[_0xf251('0x8')](),controller[_0xf251('0x9')]);router[_0xf251('0xa')](_0xf251('0xb'),auth[_0xf251('0x8')](),controller[_0xf251('0xc')]);router[_0xf251('0xd')]('/',auth['isAuthenticated'](),controller[_0xf251('0xe')]);router[_0xf251('0xf')](_0xf251('0xb'),auth[_0xf251('0x8')](),controller[_0xf251('0x10')]);router[_0xf251('0x11')](_0xf251('0xb'),auth[_0xf251('0x8')](),controller['destroy']);module[_0xf251('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e1cc1ee..27483c4 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 _0xc0d9=['ENUM','string','keyValue','picklist','STRING','variable','customVariable','sequelize'];(function(_0x1d175d,_0x10fd73){var _0x2adbd7=function(_0x5a75ae){while(--_0x5a75ae){_0x1d175d['push'](_0x1d175d['shift']());}};_0x2adbd7(++_0x10fd73);}(_0xc0d9,0x12f));var _0x9c0d=function(_0x2318d5,_0x531822){_0x2318d5=_0x2318d5-0x0;var _0xa77057=_0xc0d9[_0x2318d5];return _0xa77057;};'use strict';var Sequelize=require(_0x9c0d('0x0'));module['exports']={'type':{'type':Sequelize[_0x9c0d('0x1')](_0x9c0d('0x2'),'variable','customVariable',_0x9c0d('0x3'),_0x9c0d('0x4')),'defaultValue':_0x9c0d('0x2')},'content':{'type':Sequelize[_0x9c0d('0x5')]},'key':{'type':Sequelize[_0x9c0d('0x5')]},'keyType':{'type':Sequelize[_0x9c0d('0x1')](_0x9c0d('0x2'),_0x9c0d('0x6'),_0x9c0d('0x7'))},'keyContent':{'type':Sequelize[_0x9c0d('0x5')]},'idField':{'type':Sequelize[_0x9c0d('0x5')]},'nameField':{'type':Sequelize[_0x9c0d('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c0d('0x5')]}}; \ No newline at end of file +var _0xb4e8=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x4f3dc8,_0x2938f9){var _0x556a7b=function(_0x1098e7){while(--_0x1098e7){_0x4f3dc8['push'](_0x4f3dc8['shift']());}};_0x556a7b(++_0x2938f9);}(_0xb4e8,0xbe));var _0x8b4e=function(_0x202497,_0x17558a){_0x202497=_0x202497-0x0;var _0x1754da=_0xb4e8[_0x202497];return _0x1754da;};'use strict';var Sequelize=require(_0x8b4e('0x0'));module[_0x8b4e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8b4e('0x2'),_0x8b4e('0x3'),_0x8b4e('0x4'),_0x8b4e('0x5'),_0x8b4e('0x6')),'defaultValue':_0x8b4e('0x2')},'content':{'type':Sequelize[_0x8b4e('0x7')]},'key':{'type':Sequelize[_0x8b4e('0x7')]},'keyType':{'type':Sequelize[_0x8b4e('0x8')]('string',_0x8b4e('0x3'),_0x8b4e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8b4e('0x7')]},'nameField':{'type':Sequelize[_0x8b4e('0x7')]},'customField':{'type':Sequelize[_0x8b4e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b4e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ac27ceb..d74ea41 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 _0x4cd3=['update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','bluebird','mustache','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save'];(function(_0x15a31b,_0x4d09d0){var _0x52f1c7=function(_0x1421b6){while(--_0x1421b6){_0x15a31b['push'](_0x15a31b['shift']());}};_0x52f1c7(++_0x4d09d0);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x4cd3[_0x4cd846];return _0x2f2a7d;};'use strict';var emlformat=require(_0x34cd('0x0'));var rimraf=require(_0x34cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34cd('0x2'));var Mustache=require(_0x34cd('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x34cd('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x34cd('0x5'));var crypto=require('crypto');var jsforce=require(_0x34cd('0x6'));var deskjs=require(_0x34cd('0x7'));var toCsv=require(_0x34cd('0x4'));var querystring=require('querystring');var Papa=require(_0x34cd('0x8'));var Redis=require(_0x34cd('0x9'));var authService=require(_0x34cd('0xa'));var qs=require(_0x34cd('0xb'));var as=require(_0x34cd('0xc'));var hardwareService=require(_0x34cd('0xd'));var logger=require(_0x34cd('0xe'))(_0x34cd('0xf'));var utils=require(_0x34cd('0x10'));var config=require(_0x34cd('0x11'));var licenseUtil=require(_0x34cd('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36da2e,_0x3b31d7){_0x3b31d7=_0x3b31d7||0xcc;return function(_0x1de276){if(_0x1de276){return _0x36da2e[_0x34cd('0x13')](_0x3b31d7);}return _0x36da2e[_0x34cd('0x14')](_0x3b31d7)[_0x34cd('0x15')]();};}function respondWithResult(_0x1e65d5,_0x59a551){_0x59a551=_0x59a551||0xc8;return function(_0x2881ba){if(_0x2881ba){return _0x1e65d5[_0x34cd('0x14')](_0x59a551)['json'](_0x2881ba);}};}function respondWithFilteredResult(_0x5a1959,_0x44e5ff){return function(_0x1d5464){if(_0x1d5464){var _0x471982=typeof _0x44e5ff[_0x34cd('0x16')]==='undefined'&&typeof _0x44e5ff[_0x34cd('0x17')]===_0x34cd('0x18');var _0x203740=_0x1d5464['count'];var _0x4b20b2=_0x471982?0x0:_0x44e5ff[_0x34cd('0x16')];var _0x22351c=_0x471982?_0x1d5464[_0x34cd('0x19')]:_0x44e5ff[_0x34cd('0x16')]+_0x44e5ff['limit'];var _0xa9c5bd;if(_0x22351c>=_0x203740){_0x22351c=_0x203740;_0xa9c5bd=0xc8;}else{_0xa9c5bd=0xce;}_0x5a1959[_0x34cd('0x14')](_0xa9c5bd);return _0x5a1959[_0x34cd('0x1a')](_0x34cd('0x1b'),_0x4b20b2+'-'+_0x22351c+'/'+_0x203740)[_0x34cd('0x1c')](_0x1d5464);}return null;};}function patchUpdates(_0x2ada47){return function(_0x435a24){try{jsonpatch[_0x34cd('0x1d')](_0x435a24,_0x2ada47,!![]);}catch(_0x34cb87){return BPromise[_0x34cd('0x1e')](_0x34cb87);}return _0x435a24[_0x34cd('0x1f')]();};}function saveUpdates(_0x454e32,_0x1276aa){return function(_0x127169){if(_0x127169){return _0x127169[_0x34cd('0x20')](_0x454e32)[_0x34cd('0x21')](function(_0x4adca3){return _0x4adca3;});}return null;};}function removeEntity(_0x3821dd,_0x1dd88b){return function(_0x4cbf48){if(_0x4cbf48){return _0x4cbf48['destroy']()[_0x34cd('0x21')](function(){_0x3821dd[_0x34cd('0x14')](0xcc)[_0x34cd('0x15')]();});}};}function handleEntityNotFound(_0x396d71,_0x45f63f){return function(_0x43eb88){if(!_0x43eb88){_0x396d71[_0x34cd('0x13')](0x194);}return _0x43eb88;};}function handleError(_0x55f3d4,_0x3a37ed){_0x3a37ed=_0x3a37ed||0x1f4;return function(_0x1a580d){logger[_0x34cd('0x22')](_0x1a580d[_0x34cd('0x23')]);if(_0x1a580d[_0x34cd('0x24')]){delete _0x1a580d[_0x34cd('0x24')];}_0x55f3d4['status'](_0x3a37ed)[_0x34cd('0x25')](_0x1a580d);};}exports[_0x34cd('0x26')]=function(_0x1904b6,_0x2f5b26){var _0x15a8e7={},_0x2bca91={},_0xfd718c={'count':0x0,'rows':[]};var _0x307632=_[_0x34cd('0x27')](db[_0x34cd('0x28')][_0x34cd('0x29')],function(_0x34cb1f){return{'name':_0x34cb1f[_0x34cd('0x2a')],'type':_0x34cb1f['type'][_0x34cd('0x2b')]};});_0x2bca91[_0x34cd('0x2c')]=_[_0x34cd('0x27')](_0x307632,_0x34cd('0x24'));_0x2bca91[_0x34cd('0x2d')]=_['keys'](_0x1904b6[_0x34cd('0x2d')]);_0x2bca91[_0x34cd('0x2e')]=_[_0x34cd('0x2f')](_0x2bca91[_0x34cd('0x2c')],_0x2bca91[_0x34cd('0x2d')]);_0x15a8e7[_0x34cd('0x30')]=_[_0x34cd('0x2f')](_0x2bca91[_0x34cd('0x2c')],qs[_0x34cd('0x31')](_0x1904b6['query']['fields']));_0x15a8e7[_0x34cd('0x30')]=_0x15a8e7[_0x34cd('0x30')][_0x34cd('0x32')]?_0x15a8e7[_0x34cd('0x30')]:_0x2bca91[_0x34cd('0x2c')];if(!_0x1904b6['query']['hasOwnProperty'](_0x34cd('0x33'))){_0x15a8e7[_0x34cd('0x17')]=qs[_0x34cd('0x17')](_0x1904b6['query'][_0x34cd('0x17')]);_0x15a8e7[_0x34cd('0x16')]=qs[_0x34cd('0x16')](_0x1904b6[_0x34cd('0x2d')][_0x34cd('0x16')]);}_0x15a8e7[_0x34cd('0x34')]=qs[_0x34cd('0x35')](_0x1904b6[_0x34cd('0x2d')][_0x34cd('0x35')]);_0x15a8e7['where']=qs[_0x34cd('0x2e')](_['pick'](_0x1904b6[_0x34cd('0x2d')],_0x2bca91[_0x34cd('0x2e')]),_0x307632);if(_0x1904b6['query'][_0x34cd('0x36')]){_0x15a8e7[_0x34cd('0x37')]=_['merge'](_0x15a8e7[_0x34cd('0x37')],{'$or':_['map'](_0x307632,function(_0x1dc060){if(_0x1dc060[_0x34cd('0x38')]!==_0x34cd('0x39')){var _0x4f353b={};_0x4f353b[_0x1dc060['name']]={'$like':'%'+_0x1904b6['query'][_0x34cd('0x36')]+'%'};return _0x4f353b;}})});}_0x15a8e7=_[_0x34cd('0x3a')]({},_0x15a8e7,_0x1904b6[_0x34cd('0x3b')]);var _0x3f8766={'where':_0x15a8e7['where']};return db[_0x34cd('0x28')][_0x34cd('0x19')](_0x3f8766)[_0x34cd('0x21')](function(_0xa478f2){_0xfd718c['count']=_0xa478f2;if(_0x1904b6[_0x34cd('0x2d')][_0x34cd('0x3c')]){_0x15a8e7[_0x34cd('0x3d')]=[{'all':!![]}];}return db[_0x34cd('0x28')][_0x34cd('0x3e')](_0x15a8e7);})[_0x34cd('0x21')](function(_0x40f8d3){_0xfd718c[_0x34cd('0x3f')]=_0x40f8d3;return _0xfd718c;})[_0x34cd('0x21')](respondWithFilteredResult(_0x2f5b26,_0x15a8e7))[_0x34cd('0x40')](handleError(_0x2f5b26,null));};exports['show']=function(_0x3f852b,_0x9629e4){var _0x31f8c5={'raw':!![],'where':{'id':_0x3f852b[_0x34cd('0x41')]['id']}},_0x5d387b={};_0x5d387b[_0x34cd('0x2c')]=_[_0x34cd('0x42')](db['ZohoField'][_0x34cd('0x29')]);_0x5d387b[_0x34cd('0x2d')]=_[_0x34cd('0x42')](_0x3f852b[_0x34cd('0x2d')]);_0x5d387b[_0x34cd('0x2e')]=_[_0x34cd('0x2f')](_0x5d387b[_0x34cd('0x2c')],_0x5d387b['query']);_0x31f8c5[_0x34cd('0x30')]=_['intersection'](_0x5d387b[_0x34cd('0x2c')],qs[_0x34cd('0x31')](_0x3f852b[_0x34cd('0x2d')][_0x34cd('0x31')]));_0x31f8c5[_0x34cd('0x30')]=_0x31f8c5['attributes'][_0x34cd('0x32')]?_0x31f8c5[_0x34cd('0x30')]:_0x5d387b[_0x34cd('0x2c')];if(_0x3f852b[_0x34cd('0x2d')][_0x34cd('0x3c')]){_0x31f8c5[_0x34cd('0x3d')]=[{'all':!![]}];}_0x31f8c5=_[_0x34cd('0x3a')]({},_0x31f8c5,_0x3f852b[_0x34cd('0x3b')]);return db[_0x34cd('0x28')][_0x34cd('0x43')](_0x31f8c5)[_0x34cd('0x21')](handleEntityNotFound(_0x9629e4,null))[_0x34cd('0x21')](respondWithResult(_0x9629e4,null))[_0x34cd('0x40')](handleError(_0x9629e4,null));};exports[_0x34cd('0x44')]=function(_0xa541d1,_0x5823cf){return db[_0x34cd('0x28')][_0x34cd('0x44')](_0xa541d1[_0x34cd('0x45')],{})['then'](respondWithResult(_0x5823cf,0xc9))['catch'](handleError(_0x5823cf,null));};exports[_0x34cd('0x20')]=function(_0x1d24ac,_0x57370a){if(_0x1d24ac[_0x34cd('0x45')]['id']){delete _0x1d24ac[_0x34cd('0x45')]['id'];}return db[_0x34cd('0x28')]['find']({'where':{'id':_0x1d24ac[_0x34cd('0x41')]['id']}})[_0x34cd('0x21')](handleEntityNotFound(_0x57370a,null))[_0x34cd('0x21')](saveUpdates(_0x1d24ac[_0x34cd('0x45')],null))[_0x34cd('0x21')](respondWithResult(_0x57370a,null))['catch'](handleError(_0x57370a,null));};exports['destroy']=function(_0x23437a,_0x32d01e){return db[_0x34cd('0x28')]['find']({'where':{'id':_0x23437a[_0x34cd('0x41')]['id']}})[_0x34cd('0x21')](handleEntityNotFound(_0x32d01e,null))[_0x34cd('0x21')](removeEntity(_0x32d01e,null))[_0x34cd('0x40')](handleError(_0x32d01e,null));}; \ No newline at end of file +var _0x614d=['key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find','create','body','update','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','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','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','ZohoField','rawAttributes','fieldName'];(function(_0x3b3a9c,_0x88b6a4){var _0x23d32c=function(_0x3bd54a){while(--_0x3bd54a){_0x3b3a9c['push'](_0x3b3a9c['shift']());}};_0x23d32c(++_0x88b6a4);}(_0x614d,0x151));var _0xd614=function(_0x1cefbc,_0x1e02dd){_0x1cefbc=_0x1cefbc-0x0;var _0x4fec14=_0x614d[_0x1cefbc];return _0x4fec14;};'use strict';var emlformat=require(_0xd614('0x0'));var rimraf=require(_0xd614('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd614('0x2'));var rp=require('request-promise');var moment=require(_0xd614('0x3'));var BPromise=require(_0xd614('0x4'));var Mustache=require(_0xd614('0x5'));var util=require(_0xd614('0x6'));var path=require(_0xd614('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd614('0x8'));var fs=require('fs');var fs_extra=require(_0xd614('0x9'));var _=require('lodash');var squel=require(_0xd614('0xa'));var crypto=require(_0xd614('0xb'));var jsforce=require(_0xd614('0xc'));var deskjs=require(_0xd614('0xd'));var toCsv=require(_0xd614('0xe'));var querystring=require(_0xd614('0xf'));var Papa=require(_0xd614('0x10'));var Redis=require(_0xd614('0x11'));var authService=require(_0xd614('0x12'));var qs=require(_0xd614('0x13'));var as=require(_0xd614('0x14'));var hardwareService=require(_0xd614('0x15'));var logger=require(_0xd614('0x16'))(_0xd614('0x17'));var utils=require(_0xd614('0x18'));var config=require(_0xd614('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd614('0x1a'))['db'];function respondWithStatusCode(_0x17400d,_0x19aa9e){_0x19aa9e=_0x19aa9e||0xcc;return function(_0x32af10){if(_0x32af10){return _0x17400d['sendStatus'](_0x19aa9e);}return _0x17400d['status'](_0x19aa9e)[_0xd614('0x1b')]();};}function respondWithResult(_0x13ac15,_0x5041ea){_0x5041ea=_0x5041ea||0xc8;return function(_0x4c0748){if(_0x4c0748){return _0x13ac15[_0xd614('0x1c')](_0x5041ea)[_0xd614('0x1d')](_0x4c0748);}};}function respondWithFilteredResult(_0x254140,_0x1eafa3){return function(_0x12847c){if(_0x12847c){var _0x56d207=typeof _0x1eafa3[_0xd614('0x1e')]===_0xd614('0x1f')&&typeof _0x1eafa3[_0xd614('0x20')]===_0xd614('0x1f');var _0x180ca0=_0x12847c[_0xd614('0x21')];var _0x1007c6=_0x56d207?0x0:_0x1eafa3[_0xd614('0x1e')];var _0x25fb04=_0x56d207?_0x12847c[_0xd614('0x21')]:_0x1eafa3['offset']+_0x1eafa3[_0xd614('0x20')];var _0x2b9cab;if(_0x25fb04>=_0x180ca0){_0x25fb04=_0x180ca0;_0x2b9cab=0xc8;}else{_0x2b9cab=0xce;}_0x254140['status'](_0x2b9cab);return _0x254140['set'](_0xd614('0x22'),_0x1007c6+'-'+_0x25fb04+'/'+_0x180ca0)['json'](_0x12847c);}return null;};}function patchUpdates(_0x1129e4){return function(_0x3bcffb){try{jsonpatch[_0xd614('0x23')](_0x3bcffb,_0x1129e4,!![]);}catch(_0x5cdb5d){return BPromise[_0xd614('0x24')](_0x5cdb5d);}return _0x3bcffb[_0xd614('0x25')]();};}function saveUpdates(_0x2b8668,_0x4f0e2c){return function(_0x57c8e8){if(_0x57c8e8){return _0x57c8e8['update'](_0x2b8668)[_0xd614('0x26')](function(_0x4b2e71){return _0x4b2e71;});}return null;};}function removeEntity(_0x334e24,_0x87d620){return function(_0x5cd2af){if(_0x5cd2af){return _0x5cd2af[_0xd614('0x27')]()[_0xd614('0x26')](function(){_0x334e24[_0xd614('0x1c')](0xcc)[_0xd614('0x1b')]();});}};}function handleEntityNotFound(_0x52099e,_0x282563){return function(_0x4e2585){if(!_0x4e2585){_0x52099e[_0xd614('0x28')](0x194);}return _0x4e2585;};}function handleError(_0x4ddd43,_0x3b024d){_0x3b024d=_0x3b024d||0x1f4;return function(_0x3eeeef){logger[_0xd614('0x29')](_0x3eeeef['stack']);if(_0x3eeeef[_0xd614('0x2a')]){delete _0x3eeeef[_0xd614('0x2a')];}_0x4ddd43[_0xd614('0x1c')](_0x3b024d)[_0xd614('0x2b')](_0x3eeeef);};}exports[_0xd614('0x2c')]=function(_0x4ed26a,_0x2f491d){var _0x221916={},_0xe042f2={},_0x222dd0={'count':0x0,'rows':[]};var _0x3b4299=_['map'](db[_0xd614('0x2d')][_0xd614('0x2e')],function(_0x37917e){return{'name':_0x37917e[_0xd614('0x2f')],'type':_0x37917e['type'][_0xd614('0x30')]};});_0xe042f2[_0xd614('0x31')]=_[_0xd614('0x32')](_0x3b4299,_0xd614('0x2a'));_0xe042f2['query']=_[_0xd614('0x33')](_0x4ed26a[_0xd614('0x34')]);_0xe042f2['filters']=_[_0xd614('0x35')](_0xe042f2[_0xd614('0x31')],_0xe042f2[_0xd614('0x34')]);_0x221916[_0xd614('0x36')]=_['intersection'](_0xe042f2[_0xd614('0x31')],qs[_0xd614('0x37')](_0x4ed26a[_0xd614('0x34')]['fields']));_0x221916['attributes']=_0x221916['attributes'][_0xd614('0x38')]?_0x221916[_0xd614('0x36')]:_0xe042f2[_0xd614('0x31')];if(!_0x4ed26a[_0xd614('0x34')][_0xd614('0x39')](_0xd614('0x3a'))){_0x221916[_0xd614('0x20')]=qs[_0xd614('0x20')](_0x4ed26a[_0xd614('0x34')]['limit']);_0x221916[_0xd614('0x1e')]=qs['offset'](_0x4ed26a[_0xd614('0x34')][_0xd614('0x1e')]);}_0x221916[_0xd614('0x3b')]=qs[_0xd614('0x3c')](_0x4ed26a['query'][_0xd614('0x3c')]);_0x221916[_0xd614('0x3d')]=qs[_0xd614('0x3e')](_[_0xd614('0x3f')](_0x4ed26a['query'],_0xe042f2[_0xd614('0x3e')]),_0x3b4299);if(_0x4ed26a[_0xd614('0x34')]['filter']){_0x221916['where']=_[_0xd614('0x40')](_0x221916['where'],{'$or':_['map'](_0x3b4299,function(_0x40c6d5){if(_0x40c6d5['type']!==_0xd614('0x41')){var _0x3108cb={};_0x3108cb[_0x40c6d5[_0xd614('0x2a')]]={'$like':'%'+_0x4ed26a[_0xd614('0x34')][_0xd614('0x42')]+'%'};return _0x3108cb;}})});}_0x221916=_[_0xd614('0x40')]({},_0x221916,_0x4ed26a[_0xd614('0x43')]);var _0x56ac4b={'where':_0x221916[_0xd614('0x3d')]};return db[_0xd614('0x2d')][_0xd614('0x21')](_0x56ac4b)[_0xd614('0x26')](function(_0x1eb016){_0x222dd0[_0xd614('0x21')]=_0x1eb016;if(_0x4ed26a[_0xd614('0x34')]['includeAll']){_0x221916[_0xd614('0x44')]=[{'all':!![]}];}return db[_0xd614('0x2d')]['findAll'](_0x221916);})['then'](function(_0x472c2d){_0x222dd0[_0xd614('0x45')]=_0x472c2d;return _0x222dd0;})[_0xd614('0x26')](respondWithFilteredResult(_0x2f491d,_0x221916))[_0xd614('0x46')](handleError(_0x2f491d,null));};exports['show']=function(_0xf2fb7c,_0x5e565b){var _0x2584b4={'raw':!![],'where':{'id':_0xf2fb7c[_0xd614('0x47')]['id']}},_0x55b1be={};_0x55b1be[_0xd614('0x31')]=_[_0xd614('0x33')](db[_0xd614('0x2d')]['rawAttributes']);_0x55b1be[_0xd614('0x34')]=_[_0xd614('0x33')](_0xf2fb7c[_0xd614('0x34')]);_0x55b1be[_0xd614('0x3e')]=_[_0xd614('0x35')](_0x55b1be['model'],_0x55b1be[_0xd614('0x34')]);_0x2584b4['attributes']=_[_0xd614('0x35')](_0x55b1be[_0xd614('0x31')],qs[_0xd614('0x37')](_0xf2fb7c[_0xd614('0x34')][_0xd614('0x37')]));_0x2584b4[_0xd614('0x36')]=_0x2584b4[_0xd614('0x36')][_0xd614('0x38')]?_0x2584b4[_0xd614('0x36')]:_0x55b1be[_0xd614('0x31')];if(_0xf2fb7c[_0xd614('0x34')][_0xd614('0x48')]){_0x2584b4[_0xd614('0x44')]=[{'all':!![]}];}_0x2584b4=_[_0xd614('0x40')]({},_0x2584b4,_0xf2fb7c[_0xd614('0x43')]);return db[_0xd614('0x2d')][_0xd614('0x49')](_0x2584b4)['then'](handleEntityNotFound(_0x5e565b,null))[_0xd614('0x26')](respondWithResult(_0x5e565b,null))[_0xd614('0x46')](handleError(_0x5e565b,null));};exports[_0xd614('0x4a')]=function(_0x590ae8,_0x520fd4){return db[_0xd614('0x2d')][_0xd614('0x4a')](_0x590ae8[_0xd614('0x4b')],{})[_0xd614('0x26')](respondWithResult(_0x520fd4,0xc9))[_0xd614('0x46')](handleError(_0x520fd4,null));};exports[_0xd614('0x4c')]=function(_0x26208d,_0x2a16d2){if(_0x26208d[_0xd614('0x4b')]['id']){delete _0x26208d[_0xd614('0x4b')]['id'];}return db['ZohoField'][_0xd614('0x49')]({'where':{'id':_0x26208d[_0xd614('0x47')]['id']}})[_0xd614('0x26')](handleEntityNotFound(_0x2a16d2,null))[_0xd614('0x26')](saveUpdates(_0x26208d[_0xd614('0x4b')],null))['then'](respondWithResult(_0x2a16d2,null))[_0xd614('0x46')](handleError(_0x2a16d2,null));};exports[_0xd614('0x27')]=function(_0x433c65,_0x3b7fbf){return db[_0xd614('0x2d')]['find']({'where':{'id':_0x433c65[_0xd614('0x47')]['id']}})[_0xd614('0x26')](handleEntityNotFound(_0x3b7fbf,null))[_0xd614('0x26')](removeEntity(_0x3b7fbf,null))[_0xd614('0x46')](handleError(_0x3b7fbf,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ee73c6e..b5e4d80 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 _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x4cd581,_0x49eb2b){var _0x1ac616=function(_0x1459b3){while(--_0x1459b3){_0x4cd581['push'](_0x4cd581['shift']());}};_0x1ac616(++_0x49eb2b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField'];(function(_0x30bf1a,_0x1a9855){var _0x46ba1b=function(_0x2d2663){while(--_0x2d2663){_0x30bf1a['push'](_0x30bf1a['shift']());}};_0x46ba1b(++_0x1a9855);}(_0x1883,0xab));var _0x3188=function(_0x53ef51,_0xbe205f){_0x53ef51=_0x53ef51-0x0;var _0x34b55a=_0x1883[_0x53ef51];return _0x34b55a;};'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':[{'name':'zoho_unique_index','fields':[_0x3188('0xf'),_0x3188('0x10')],'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 dec88ce..8e9ed98 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 _0x5724=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5724,0x1bc));var _0x4572=function(_0x389608,_0x4923a6){_0x389608=_0x389608-0x0;var _0x5af592=_0x5724[_0x389608];return _0x5af592;};'use strict';var _=require(_0x4572('0x0'));var util=require(_0x4572('0x1'));var moment=require(_0x4572('0x2'));var BPromise=require('bluebird');var rs=require(_0x4572('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4572('0x4'))['db'];var utils=require(_0x4572('0x5'));var logger=require(_0x4572('0x6'))(_0x4572('0x7'));var config=require(_0x4572('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4572('0x9')][_0x4572('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x147582,_0x598710,_0x30386f){return new BPromise(function(_0x2bb95c,_0x17633c){return client[_0x4572('0xb')](_0x147582,_0x30386f)[_0x4572('0xc')](function(_0x3cb744){logger['info'](_0x4572('0xd'),_0x598710,_0x4572('0xe'));logger['debug'](_0x4572('0xf'),_0x598710,'request\x20sent',JSON[_0x4572('0x10')](_0x3cb744));if(_0x3cb744[_0x4572('0x11')]){if(_0x3cb744[_0x4572('0x11')][_0x4572('0x12')]===0x1f4){logger[_0x4572('0x11')]('ZohoField,\x20%s,\x20%s',_0x598710,_0x3cb744['error'][_0x4572('0x13')]);return _0x17633c(_0x3cb744['error']['message']);}logger['error'](_0x4572('0xd'),_0x598710,_0x3cb744[_0x4572('0x11')][_0x4572('0x13')]);return _0x2bb95c(_0x3cb744[_0x4572('0x11')][_0x4572('0x13')]);}else{logger[_0x4572('0x14')](_0x4572('0xd'),_0x598710,_0x4572('0xe'));_0x2bb95c(_0x3cb744[_0x4572('0x15')]['message']);}})[_0x4572('0x16')](function(_0x4aa9ad){logger[_0x4572('0x11')](_0x4572('0xd'),_0x598710,_0x4aa9ad);_0x17633c(_0x4aa9ad);});});} \ No newline at end of file +var _0x741c=['request\x20sent','debug','stringify','error','code','ZohoField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x741c,0x110));var _0xc741=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x741c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc741('0x0'));var util=require('util');var moment=require(_0xc741('0x1'));var BPromise=require(_0xc741('0x2'));var rs=require(_0xc741('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc741('0x4'))['db'];var utils=require(_0xc741('0x5'));var logger=require(_0xc741('0x6'))(_0xc741('0x7'));var config=require(_0xc741('0x8'));var jayson=require(_0xc741('0x9'));var client=jayson[_0xc741('0xa')][_0xc741('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e23f8,_0x2ddb73,_0x15b2b9){return new BPromise(function(_0x4608e9,_0x47a521){return client[_0xc741('0xc')](_0x5e23f8,_0x15b2b9)['then'](function(_0x1bd8ae){logger[_0xc741('0xd')]('ZohoField,\x20%s,\x20%s',_0x2ddb73,_0xc741('0xe'));logger[_0xc741('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2ddb73,_0xc741('0xe'),JSON[_0xc741('0x10')](_0x1bd8ae));if(_0x1bd8ae['error']){if(_0x1bd8ae[_0xc741('0x11')][_0xc741('0x12')]===0x1f4){logger[_0xc741('0x11')](_0xc741('0x13'),_0x2ddb73,_0x1bd8ae[_0xc741('0x11')]['message']);return _0x47a521(_0x1bd8ae['error'][_0xc741('0x14')]);}logger['error'](_0xc741('0x13'),_0x2ddb73,_0x1bd8ae[_0xc741('0x11')][_0xc741('0x14')]);return _0x4608e9(_0x1bd8ae[_0xc741('0x11')][_0xc741('0x14')]);}else{logger['info'](_0xc741('0x13'),_0x2ddb73,_0xc741('0xe'));_0x4608e9(_0x1bd8ae['result']['message']);}})[_0xc741('0x15')](function(_0x233295){logger[_0xc741('0x11')](_0xc741('0x13'),_0x2ddb73,_0x233295);_0x47a521(_0x233295);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6e38211..3e18a49 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e8982,_0x37bfc7){var _0x115066=function(_0x202cb1){while(--_0x202cb1){_0x1e8982['push'](_0x1e8982['shift']());}};_0x115066(++_0x37bfc7);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x36faa2,_0xf5954e){var _0x210fcb=function(_0x3eb66e){while(--_0x3eb66e){_0x36faa2['push'](_0x36faa2['shift']());}};_0x210fcb(++_0xf5954e);}(_0xedd9,0xfc));var _0x9edd=function(_0x54bd7a,_0x2a868e){_0x54bd7a=_0x54bd7a-0x0;var _0x54c89b=_0xedd9[_0x54bd7a];return _0x54c89b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8fae2d5..1b3825c 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 _0x5f59=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','STRING'];(function(_0x236153,_0x2242d4){var _0x3ead90=function(_0x2f0cd9){while(--_0x2f0cd9){_0x236153['push'](_0x236153['shift']());}};_0x3ead90(++_0x2242d4);}(_0x5f59,0x1ae));var _0x95f5=function(_0x4af263,_0x5e44d6){_0x4af263=_0x4af263-0x0;var _0x29015e=_0x5f59[_0x4af263];return _0x29015e;};'use strict';var Sequelize=require(_0x95f5('0x0'));module['exports']={'name':{'type':Sequelize[_0x95f5('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x95f5('0x1')],'allowNull':![],'unique':_0x95f5('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x95f5('0x1')]},'path':{'type':Sequelize[_0x95f5('0x1')]},'type':{'type':Sequelize[_0x95f5('0x1')]},'size':{'type':Sequelize[_0x95f5('0x3')]},'active':{'type':Sequelize[_0x95f5('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x95f5('0x1')]},'state':{'type':Sequelize[_0x95f5('0x1')],'unique':_0x95f5('0x5')},'description':{'type':Sequelize[_0x95f5('0x1')]},'title':{'type':Sequelize[_0x95f5('0x1')]},'remoteUri':{'type':Sequelize[_0x95f5('0x1')]},'link':{'type':Sequelize[_0x95f5('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc292=['app.js','INTEGER','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xc292,0x18b));var _0x2c29=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xc292[_0x2ca9d4];return _0x258956;};'use strict';var Sequelize=require(_0x2c29('0x0'));module[_0x2c29('0x1')]={'name':{'type':Sequelize[_0x2c29('0x2')],'allowNull':![],'unique':_0x2c29('0x3')},'version':{'type':Sequelize[_0x2c29('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x2c29('0x2')],'defaultValue':_0x2c29('0x4')},'filename':{'type':Sequelize[_0x2c29('0x2')]},'path':{'type':Sequelize[_0x2c29('0x2')]},'type':{'type':Sequelize[_0x2c29('0x2')]},'size':{'type':Sequelize[_0x2c29('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x2c29('0x2')]},'logo':{'type':Sequelize[_0x2c29('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x2c29('0x6')},'description':{'type':Sequelize[_0x2c29('0x2')]},'title':{'type':Sequelize[_0x2c29('0x2')]},'remoteUri':{'type':Sequelize[_0x2c29('0x2')]},'link':{'type':Sequelize[_0x2c29('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0c3db0b..1de5899 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(_0x2e3bd2,_0xff9cdf){var _0xa9321d=function(_0x381e63){while(--_0x381e63){_0x2e3bd2['push'](_0x2e3bd2['shift']());}};_0xa9321d(++_0xff9cdf);}(_0xafc4,0x69));var _0x4afc=function(_0x2972cb,_0x5369f1){_0x2972cb=_0x2972cb-0x0;var _0x1c0902=_0xafc4[_0x2972cb];return _0x1c0902;};'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 _0x430c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','Integration','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','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x11a9b5,_0x18e003){var _0x1d1573=function(_0x105e0e){while(--_0x105e0e){_0x11a9b5['push'](_0x11a9b5['shift']());}};_0x1d1573(++_0x18e003);}(_0x430c,0x1a1));var _0xc430=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x430c[_0x8e9386];return _0x4abf26;};'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));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 80d2e71..0a2d567 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 _0xfc8a=['api','moment','path','rimraf','./integration.attributes','Integration','integrations','lodash','../../config/logger'];(function(_0xc6574b,_0x4bf578){var _0x3f49a4=function(_0x3a1a0d){while(--_0x3a1a0d){_0xc6574b['push'](_0xc6574b['shift']());}};_0x3f49a4(++_0x4bf578);}(_0xfc8a,0x85));var _0xafc8=function(_0x192a0c,_0x299c0f){_0x192a0c=_0x192a0c-0x0;var _0x42ac96=_0xfc8a[_0x192a0c];return _0x42ac96;};'use strict';var _=require(_0xafc8('0x0'));var util=require('util');var logger=require(_0xafc8('0x1'))(_0xafc8('0x2'));var moment=require(_0xafc8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xafc8('0x4'));var rimraf=require(_0xafc8('0x5'));var config=require('../../config/environment');var attributes=require(_0xafc8('0x6'));module['exports']=function(_0xb9005b,_0x1c77fa){return _0xb9005b['define'](_0xafc8('0x7'),attributes,{'tableName':_0xafc8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf566=['bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','Integration','integrations','util','api','moment'];(function(_0x138058,_0xf8edf8){var _0x433380=function(_0xec29e4){while(--_0xec29e4){_0x138058['push'](_0x138058['shift']());}};_0x433380(++_0xf8edf8);}(_0xf566,0x135));var _0x6f56=function(_0x55db06,_0x3405c5){_0x55db06=_0x55db06-0x0;var _0x5f2bbe=_0xf566[_0x55db06];return _0x5f2bbe;};'use strict';var _=require('lodash');var util=require(_0x6f56('0x0'));var logger=require('../../config/logger')(_0x6f56('0x1'));var moment=require(_0x6f56('0x2'));var BPromise=require(_0x6f56('0x3'));var rp=require(_0x6f56('0x4'));var fs=require('fs');var path=require(_0x6f56('0x5'));var rimraf=require(_0x6f56('0x6'));var config=require('../../config/environment');var attributes=require(_0x6f56('0x7'));module[_0x6f56('0x8')]=function(_0x36e48f,_0x26df4d){return _0x36e48f[_0x6f56('0x9')](_0x6f56('0xa'),attributes,{'tableName':_0x6f56('0xb'),'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 ba006bf..762803e 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x58389d,_0x3137df){var _0x2be20a=function(_0x2b6f46){while(--_0x2b6f46){_0x58389d['push'](_0x58389d['shift']());}};_0x2be20a(++_0x3137df);}(_0x14a0,0x8e));var _0x014a=function(_0x3e4e90,_0x4c0a1e){_0x3e4e90=_0x3e4e90-0x0;var _0x38effb=_0x14a0[_0x3e4e90];return _0x38effb;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x463177,_0x59d5b5){var _0x112cbd=function(_0x36c03d){while(--_0x36c03d){_0x463177['push'](_0x463177['shift']());}};_0x112cbd(++_0x59d5b5);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x572ebf,_0x1e47e1){_0x572ebf=_0x572ebf-0x0;var _0x5caab2=_0xdd4f[_0x572ebf];return _0x5caab2;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 61bafbb..d035194 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 _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x28f673,_0xd2e05e){var _0x1d82b6=function(_0x43268a){while(--_0x43268a){_0x28f673['push'](_0x28f673['shift']());}};_0x1d82b6(++_0xd2e05e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4640e0,_0x10ef3c){_0x4640e0=_0x4640e0-0x0;var _0x3d87ea=_0xc2c7[_0x4640e0];return _0x3d87ea;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file +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(_0x5c5200,_0x148b36){var _0x48cf04=function(_0x2f652c){while(--_0x2f652c){_0x5c5200['push'](_0x5c5200['shift']());}};_0x48cf04(++_0x148b36);}(_0x6d38,0x1ef));var _0x86d3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6d38[_0x122096];return _0x3d1966;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7564a64..9cae07b 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 _0xb3ab=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED','sequelize'];(function(_0x1d311b,_0x31ed4f){var _0x1b28ca=function(_0x18d9ca){while(--_0x18d9ca){_0x1d311b['push'](_0x1d311b['shift']());}};_0x1b28ca(++_0x31ed4f);}(_0xb3ab,0x6b));var _0xbb3a=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xb3ab[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0xbb3a('0x0'));module[_0xbb3a('0x1')]={'integration':{'type':Sequelize[_0xbb3a('0x2')]},'eventChannel':{'type':Sequelize[_0xbb3a('0x2')]},'exitStatus':{'type':Sequelize[_0xbb3a('0x2')]},'ticketId':{'type':Sequelize[_0xbb3a('0x2')]},'integrationId':{'type':Sequelize[_0xbb3a('0x3')]},'contacts':{'type':Sequelize[_0xbb3a('0x2')]},'uniqueid':{'type':Sequelize[_0xbb3a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbb3a('0x2')]},'queue':{'type':Sequelize[_0xbb3a('0x2')]},'interface':{'type':Sequelize[_0xbb3a('0x2')]},'membername':{'type':Sequelize[_0xbb3a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xbb3a('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xbb3a('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbb3a('0x4')]},'talktime':{'type':Sequelize[_0xbb3a('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbb3a('0x3')]},'reason':{'type':Sequelize[_0xbb3a('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xbb3a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbb3a('0x4')]},'agentdump':{'type':Sequelize[_0xbb3a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbb3a('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbb3a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbb3a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xbb3a('0x2')]},'accountcode':{'type':Sequelize[_0xbb3a('0x2')]},'context':{'type':Sequelize[_0xbb3a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbb3a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xbb3a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xbb3a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbb3a('0x2')]},'destcalleridname':{'type':Sequelize[_0xbb3a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbb3a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xbb3a('0x2')]},'destaccountcode':{'type':Sequelize[_0xbb3a('0x2')]},'destcontext':{'type':Sequelize[_0xbb3a('0x2')]},'destexten':{'type':Sequelize[_0xbb3a('0x2')]},'destpriority':{'type':Sequelize[_0xbb3a('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xbb3a('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xbb3a('0x2')]},'from':{'type':Sequelize[_0xbb3a('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xbb3a('0x2')]},'attachment':{'type':Sequelize[_0xbb3a('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0xbb3a('0x7'),'SENDING',_0xbb3a('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xbb3a('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdc4b=['SENDING','FAILED','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x268984,_0x38d720){var _0x578e8b=function(_0x48201f){while(--_0x48201f){_0x268984['push'](_0x268984['shift']());}};_0x578e8b(++_0x38d720);}(_0xdc4b,0x12e));var _0xbdc4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xdc4b[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0xbdc4('0x0')]={'integration':{'type':Sequelize[_0xbdc4('0x1')]},'eventChannel':{'type':Sequelize[_0xbdc4('0x1')]},'exitStatus':{'type':Sequelize[_0xbdc4('0x1')]},'ticketId':{'type':Sequelize[_0xbdc4('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbdc4('0x1')]},'calleridnum':{'type':Sequelize[_0xbdc4('0x1')]},'calleridname':{'type':Sequelize[_0xbdc4('0x1')]},'queue':{'type':Sequelize[_0xbdc4('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xbdc4('0x2')]},'agentconnectAt':{'type':Sequelize[_0xbdc4('0x2')]},'holdtime':{'type':Sequelize[_0xbdc4('0x3')]},'agentcomplete':{'type':Sequelize[_0xbdc4('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbdc4('0x2')]},'talktime':{'type':Sequelize[_0xbdc4('0x3')]},'agentacw':{'type':Sequelize[_0xbdc4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbdc4('0x3')]},'reason':{'type':Sequelize[_0xbdc4('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xbdc4('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbdc4('0x2')]},'agentdump':{'type':Sequelize[_0xbdc4('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbdc4('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbdc4('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbdc4('0x1')]},'connectedlinenum':{'type':Sequelize[_0xbdc4('0x1')]},'connectedlinename':{'type':Sequelize[_0xbdc4('0x1')]},'language':{'type':Sequelize[_0xbdc4('0x1')]},'accountcode':{'type':Sequelize[_0xbdc4('0x1')]},'context':{'type':Sequelize[_0xbdc4('0x1')]},'exten':{'type':Sequelize[_0xbdc4('0x1')]},'priority':{'type':Sequelize[_0xbdc4('0x1')]},'destchannel':{'type':Sequelize[_0xbdc4('0x1')]},'destchannelstate':{'type':Sequelize[_0xbdc4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xbdc4('0x1')]},'destcalleridnum':{'type':Sequelize[_0xbdc4('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xbdc4('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xbdc4('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbdc4('0x1')]},'destpriority':{'type':Sequelize[_0xbdc4('0x1')]},'destuniqueid':{'type':Sequelize[_0xbdc4('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xbdc4('0x1')]},'subject':{'type':Sequelize[_0xbdc4('0x1')]},'from':{'type':Sequelize[_0xbdc4('0x1')]},'to':{'type':Sequelize[_0xbdc4('0x1')]},'cc':{'type':Sequelize[_0xbdc4('0x1')]},'attachment':{'type':Sequelize[_0xbdc4('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xbdc4('0x5')]},'status':{'type':Sequelize[_0xbdc4('0x6')](_0xbdc4('0x7'),_0xbdc4('0x8'),'RECEIVED',_0xbdc4('0x9'))},'url':{'type':Sequelize[_0xbdc4('0x1')]},'app':{'type':Sequelize[_0xbdc4('0x1')]},'appdata':{'type':Sequelize[_0xbdc4('0x1')]},'projectId':{'type':Sequelize[_0xbdc4('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 22866df..37bccd5 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 _0x9ddd=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','then','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','options','catch','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x19a02d,_0x508a15){var _0x2eff26=function(_0x4caab2){while(--_0x4caab2){_0x19a02d['push'](_0x19a02d['shift']());}};_0x2eff26(++_0x508a15);}(_0x9ddd,0x112));var _0xd9dd=function(_0x28d12b,_0x1a1f6f){_0x28d12b=_0x28d12b-0x0;var _0x1d58f0=_0x9ddd[_0x28d12b];return _0x1d58f0;};'use strict';var emlformat=require(_0xd9dd('0x0'));var rimraf=require(_0xd9dd('0x1'));var zipdir=require(_0xd9dd('0x2'));var jsonpatch=require(_0xd9dd('0x3'));var rp=require(_0xd9dd('0x4'));var moment=require(_0xd9dd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd9dd('0x6'));var util=require(_0xd9dd('0x7'));var path=require(_0xd9dd('0x8'));var sox=require(_0xd9dd('0x9'));var csv=require(_0xd9dd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd9dd('0xb'));var squel=require(_0xd9dd('0xc'));var crypto=require(_0xd9dd('0xd'));var jsforce=require(_0xd9dd('0xe'));var deskjs=require(_0xd9dd('0xf'));var toCsv=require(_0xd9dd('0xa'));var querystring=require(_0xd9dd('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9dd('0x11'));var authService=require(_0xd9dd('0x12'));var qs=require(_0xd9dd('0x13'));var as=require(_0xd9dd('0x14'));var hardwareService=require(_0xd9dd('0x15'));var logger=require(_0xd9dd('0x16'))(_0xd9dd('0x17'));var utils=require(_0xd9dd('0x18'));var config=require(_0xd9dd('0x19'));var licenseUtil=require(_0xd9dd('0x1a'));var db=require(_0xd9dd('0x1b'))['db'];function respondWithStatusCode(_0x5c4e53,_0x1929a4){_0x1929a4=_0x1929a4||0xcc;return function(_0x387ee1){if(_0x387ee1){return _0x5c4e53[_0xd9dd('0x1c')](_0x1929a4);}return _0x5c4e53[_0xd9dd('0x1d')](_0x1929a4)[_0xd9dd('0x1e')]();};}function respondWithResult(_0x3b159e,_0x185783){_0x185783=_0x185783||0xc8;return function(_0xc9c686){if(_0xc9c686){return _0x3b159e['status'](_0x185783)[_0xd9dd('0x1f')](_0xc9c686);}};}function respondWithFilteredResult(_0x4c1bfa,_0x596973){return function(_0xbedf08){if(_0xbedf08){var _0x1c6150=typeof _0x596973[_0xd9dd('0x20')]===_0xd9dd('0x21')&&typeof _0x596973[_0xd9dd('0x22')]===_0xd9dd('0x21');var _0x393aba=_0xbedf08[_0xd9dd('0x23')];var _0x25d2c7=_0x1c6150?0x0:_0x596973['offset'];var _0xd206fd=_0x1c6150?_0xbedf08[_0xd9dd('0x23')]:_0x596973[_0xd9dd('0x20')]+_0x596973[_0xd9dd('0x22')];var _0x54fb06;if(_0xd206fd>=_0x393aba){_0xd206fd=_0x393aba;_0x54fb06=0xc8;}else{_0x54fb06=0xce;}_0x4c1bfa[_0xd9dd('0x1d')](_0x54fb06);return _0x4c1bfa['set']('Content-Range',_0x25d2c7+'-'+_0xd206fd+'/'+_0x393aba)[_0xd9dd('0x1f')](_0xbedf08);}return null;};}function patchUpdates(_0x304f2b){return function(_0x2f1cc5){try{jsonpatch[_0xd9dd('0x24')](_0x2f1cc5,_0x304f2b,!![]);}catch(_0x5b3fe9){return BPromise[_0xd9dd('0x25')](_0x5b3fe9);}return _0x2f1cc5['save']();};}function saveUpdates(_0x1557cb,_0x548020){return function(_0x51f683){if(_0x51f683){return _0x51f683[_0xd9dd('0x26')](_0x1557cb)['then'](function(_0x1ee8be){return _0x1ee8be;});}return null;};}function removeEntity(_0x4aef55,_0x376d31){return function(_0x43fb2d){if(_0x43fb2d){return _0x43fb2d[_0xd9dd('0x27')]()[_0xd9dd('0x28')](function(){_0x4aef55[_0xd9dd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fe6de,_0x44a104){return function(_0x2987d3){if(!_0x2987d3){_0x3fe6de['sendStatus'](0x194);}return _0x2987d3;};}function handleError(_0x4e0b9a,_0xb4a027){_0xb4a027=_0xb4a027||0x1f4;return function(_0x39db8c){logger[_0xd9dd('0x29')](_0x39db8c[_0xd9dd('0x2a')]);if(_0x39db8c[_0xd9dd('0x2b')]){delete _0x39db8c[_0xd9dd('0x2b')];}_0x4e0b9a[_0xd9dd('0x1d')](_0xb4a027)[_0xd9dd('0x2c')](_0x39db8c);};}exports['index']=function(_0x436f0a,_0x32de9c){var _0x356c43={},_0x721c18={},_0x5e3ec0={'count':0x0,'rows':[]};var _0x2fc2a5=_[_0xd9dd('0x2d')](db[_0xd9dd('0x2e')][_0xd9dd('0x2f')],function(_0x409050){return{'name':_0x409050[_0xd9dd('0x30')],'type':_0x409050[_0xd9dd('0x31')][_0xd9dd('0x32')]};});_0x721c18[_0xd9dd('0x33')]=_[_0xd9dd('0x2d')](_0x2fc2a5,_0xd9dd('0x2b'));_0x721c18[_0xd9dd('0x34')]=_[_0xd9dd('0x35')](_0x436f0a['query']);_0x721c18['filters']=_[_0xd9dd('0x36')](_0x721c18[_0xd9dd('0x33')],_0x721c18[_0xd9dd('0x34')]);_0x356c43[_0xd9dd('0x37')]=_[_0xd9dd('0x36')](_0x721c18['model'],qs['fields'](_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x38')]));_0x356c43[_0xd9dd('0x37')]=_0x356c43[_0xd9dd('0x37')]['length']?_0x356c43[_0xd9dd('0x37')]:_0x721c18[_0xd9dd('0x33')];if(!_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x39')](_0xd9dd('0x3a'))){_0x356c43['limit']=qs[_0xd9dd('0x22')](_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x22')]);_0x356c43[_0xd9dd('0x20')]=qs['offset'](_0x436f0a['query'][_0xd9dd('0x20')]);}_0x356c43[_0xd9dd('0x3b')]=qs[_0xd9dd('0x3c')](_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x3c')]);_0x356c43[_0xd9dd('0x3d')]=qs[_0xd9dd('0x3e')](_['pick'](_0x436f0a[_0xd9dd('0x34')],_0x721c18[_0xd9dd('0x3e')]),_0x2fc2a5);if(_0x436f0a['query']['filter']){_0x356c43[_0xd9dd('0x3d')]=_['merge'](_0x356c43[_0xd9dd('0x3d')],{'$or':_[_0xd9dd('0x2d')](_0x2fc2a5,function(_0xa91a7d){if(_0xa91a7d[_0xd9dd('0x31')]!==_0xd9dd('0x3f')){var _0x3f3776={};_0x3f3776[_0xa91a7d[_0xd9dd('0x2b')]]={'$like':'%'+_0x436f0a[_0xd9dd('0x34')]['filter']+'%'};return _0x3f3776;}})});}_0x356c43=_[_0xd9dd('0x40')]({},_0x356c43,_0x436f0a[_0xd9dd('0x41')]);var _0xace3b9={'where':_0x356c43[_0xd9dd('0x3d')]};return db[_0xd9dd('0x2e')][_0xd9dd('0x23')](_0xace3b9)[_0xd9dd('0x28')](function(_0x5954e0){_0x5e3ec0[_0xd9dd('0x23')]=_0x5954e0;if(_0x436f0a[_0xd9dd('0x34')]['includeAll']){_0x356c43['include']=[{'all':!![]}];}return db[_0xd9dd('0x2e')]['findAll'](_0x356c43);})[_0xd9dd('0x28')](function(_0x3626b9){_0x5e3ec0['rows']=_0x3626b9;return _0x5e3ec0;})[_0xd9dd('0x28')](respondWithFilteredResult(_0x32de9c,_0x356c43))[_0xd9dd('0x42')](handleError(_0x32de9c,null));};exports['show']=function(_0x42b0e8,_0x401739){var _0x4835ea={'raw':![],'where':{'id':_0x42b0e8[_0xd9dd('0x43')]['id']}},_0x17f27b={};_0x17f27b[_0xd9dd('0x33')]=_['keys'](db[_0xd9dd('0x2e')][_0xd9dd('0x2f')]);_0x17f27b['query']=_['keys'](_0x42b0e8['query']);_0x17f27b['filters']=_[_0xd9dd('0x36')](_0x17f27b[_0xd9dd('0x33')],_0x17f27b['query']);_0x4835ea[_0xd9dd('0x37')]=_[_0xd9dd('0x36')](_0x17f27b[_0xd9dd('0x33')],qs[_0xd9dd('0x38')](_0x42b0e8[_0xd9dd('0x34')]['fields']));_0x4835ea['attributes']=_0x4835ea['attributes']['length']?_0x4835ea['attributes']:_0x17f27b[_0xd9dd('0x33')];if(_0x42b0e8[_0xd9dd('0x34')][_0xd9dd('0x44')]){_0x4835ea[_0xd9dd('0x45')]=[{'all':!![]}];}_0x4835ea=_['merge']({},_0x4835ea,_0x42b0e8[_0xd9dd('0x41')]);return db[_0xd9dd('0x2e')][_0xd9dd('0x46')](_0x4835ea)[_0xd9dd('0x28')](handleEntityNotFound(_0x401739,null))['then'](respondWithResult(_0x401739,null))[_0xd9dd('0x42')](handleError(_0x401739,null));};exports[_0xd9dd('0x47')]=function(_0x1e3713,_0x5520a3){return db[_0xd9dd('0x2e')][_0xd9dd('0x47')](_0x1e3713['body'],{})[_0xd9dd('0x28')](respondWithResult(_0x5520a3,0xc9))[_0xd9dd('0x42')](handleError(_0x5520a3,null));};exports[_0xd9dd('0x26')]=function(_0x4a17a7,_0x1e9709){if(_0x4a17a7[_0xd9dd('0x48')]['id']){delete _0x4a17a7[_0xd9dd('0x48')]['id'];}return db['IntegrationReport'][_0xd9dd('0x46')]({'where':{'id':_0x4a17a7[_0xd9dd('0x43')]['id']}})[_0xd9dd('0x28')](handleEntityNotFound(_0x1e9709,null))[_0xd9dd('0x28')](saveUpdates(_0x4a17a7['body'],null))[_0xd9dd('0x28')](respondWithResult(_0x1e9709,null))[_0xd9dd('0x42')](handleError(_0x1e9709,null));};exports[_0xd9dd('0x27')]=function(_0x577fd3,_0x3506a2){return db['IntegrationReport'][_0xd9dd('0x46')]({'where':{'id':_0x577fd3['params']['id']}})['then'](handleEntityNotFound(_0x3506a2,null))[_0xd9dd('0x28')](removeEntity(_0x3506a2,null))[_0xd9dd('0x42')](handleError(_0x3506a2,null));};exports[_0xd9dd('0x49')]=function(_0x2e29c3,_0x5ebf07){return db[_0xd9dd('0x2e')][_0xd9dd('0x49')]()[_0xd9dd('0x28')](respondWithResult(_0x5ebf07,null))[_0xd9dd('0x42')](handleError(_0x5ebf07,null));}; \ No newline at end of file +var _0xbf1a=['offset','count','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined'];(function(_0x6b942a,_0x311643){var _0x22129d=function(_0x5a1a52){while(--_0x5a1a52){_0x6b942a['push'](_0x6b942a['shift']());}};_0x22129d(++_0x311643);}(_0xbf1a,0x169));var _0xabf1=function(_0x196e8c,_0x5254a0){_0x196e8c=_0x196e8c-0x0;var _0x19d27a=_0xbf1a[_0x196e8c];return _0x19d27a;};'use strict';var emlformat=require(_0xabf1('0x0'));var rimraf=require(_0xabf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabf1('0x2'));var rp=require('request-promise');var moment=require(_0xabf1('0x3'));var BPromise=require(_0xabf1('0x4'));var Mustache=require(_0xabf1('0x5'));var util=require(_0xabf1('0x6'));var path=require(_0xabf1('0x7'));var sox=require(_0xabf1('0x8'));var csv=require(_0xabf1('0x9'));var ejs=require(_0xabf1('0xa'));var fs=require('fs');var fs_extra=require(_0xabf1('0xb'));var _=require(_0xabf1('0xc'));var squel=require('squel');var crypto=require(_0xabf1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xabf1('0xe'));var toCsv=require(_0xabf1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabf1('0xf'));var authService=require(_0xabf1('0x10'));var qs=require(_0xabf1('0x11'));var as=require(_0xabf1('0x12'));var hardwareService=require(_0xabf1('0x13'));var logger=require('../../config/logger')(_0xabf1('0x14'));var utils=require(_0xabf1('0x15'));var config=require(_0xabf1('0x16'));var licenseUtil=require(_0xabf1('0x17'));var db=require(_0xabf1('0x18'))['db'];function respondWithStatusCode(_0x2c804a,_0x339dd1){_0x339dd1=_0x339dd1||0xcc;return function(_0xa0591a){if(_0xa0591a){return _0x2c804a[_0xabf1('0x19')](_0x339dd1);}return _0x2c804a['status'](_0x339dd1)[_0xabf1('0x1a')]();};}function respondWithResult(_0x27ed50,_0xd71a69){_0xd71a69=_0xd71a69||0xc8;return function(_0x2c59e2){if(_0x2c59e2){return _0x27ed50[_0xabf1('0x1b')](_0xd71a69)['json'](_0x2c59e2);}};}function respondWithFilteredResult(_0x12d37a,_0x223e61){return function(_0x2d8afb){if(_0x2d8afb){var _0x40c383=typeof _0x223e61['offset']===_0xabf1('0x1c')&&typeof _0x223e61['limit']==='undefined';var _0x513043=_0x2d8afb['count'];var _0x2a68c5=_0x40c383?0x0:_0x223e61[_0xabf1('0x1d')];var _0x41cccb=_0x40c383?_0x2d8afb[_0xabf1('0x1e')]:_0x223e61[_0xabf1('0x1d')]+_0x223e61['limit'];var _0x33150f;if(_0x41cccb>=_0x513043){_0x41cccb=_0x513043;_0x33150f=0xc8;}else{_0x33150f=0xce;}_0x12d37a[_0xabf1('0x1b')](_0x33150f);return _0x12d37a[_0xabf1('0x1f')](_0xabf1('0x20'),_0x2a68c5+'-'+_0x41cccb+'/'+_0x513043)[_0xabf1('0x21')](_0x2d8afb);}return null;};}function patchUpdates(_0x51f76e){return function(_0x3ca98d){try{jsonpatch[_0xabf1('0x22')](_0x3ca98d,_0x51f76e,!![]);}catch(_0x3850ed){return BPromise[_0xabf1('0x23')](_0x3850ed);}return _0x3ca98d[_0xabf1('0x24')]();};}function saveUpdates(_0x148d74,_0x23eedd){return function(_0x2a77e2){if(_0x2a77e2){return _0x2a77e2['update'](_0x148d74)[_0xabf1('0x25')](function(_0x22630a){return _0x22630a;});}return null;};}function removeEntity(_0x223866,_0x2bf846){return function(_0x251fe4){if(_0x251fe4){return _0x251fe4[_0xabf1('0x26')]()[_0xabf1('0x25')](function(){_0x223866['status'](0xcc)[_0xabf1('0x1a')]();});}};}function handleEntityNotFound(_0x4f24e2,_0x57d76a){return function(_0x3153b5){if(!_0x3153b5){_0x4f24e2[_0xabf1('0x19')](0x194);}return _0x3153b5;};}function handleError(_0xab5179,_0x3228b7){_0x3228b7=_0x3228b7||0x1f4;return function(_0x357b66){logger['error'](_0x357b66[_0xabf1('0x27')]);if(_0x357b66[_0xabf1('0x28')]){delete _0x357b66['name'];}_0xab5179['status'](_0x3228b7)[_0xabf1('0x29')](_0x357b66);};}exports[_0xabf1('0x2a')]=function(_0x5a1d38,_0x36ef03){var _0x350894={},_0x5e10dd={},_0x26d420={'count':0x0,'rows':[]};var _0x1c271f=_[_0xabf1('0x2b')](db[_0xabf1('0x2c')][_0xabf1('0x2d')],function(_0x398f7){return{'name':_0x398f7[_0xabf1('0x2e')],'type':_0x398f7[_0xabf1('0x2f')][_0xabf1('0x30')]};});_0x5e10dd[_0xabf1('0x31')]=_[_0xabf1('0x2b')](_0x1c271f,_0xabf1('0x28'));_0x5e10dd[_0xabf1('0x32')]=_[_0xabf1('0x33')](_0x5a1d38[_0xabf1('0x32')]);_0x5e10dd['filters']=_['intersection'](_0x5e10dd['model'],_0x5e10dd[_0xabf1('0x32')]);_0x350894[_0xabf1('0x34')]=_[_0xabf1('0x35')](_0x5e10dd[_0xabf1('0x31')],qs[_0xabf1('0x36')](_0x5a1d38[_0xabf1('0x32')]['fields']));_0x350894[_0xabf1('0x34')]=_0x350894['attributes'][_0xabf1('0x37')]?_0x350894[_0xabf1('0x34')]:_0x5e10dd[_0xabf1('0x31')];if(!_0x5a1d38[_0xabf1('0x32')][_0xabf1('0x38')]('nolimit')){_0x350894['limit']=qs['limit'](_0x5a1d38[_0xabf1('0x32')][_0xabf1('0x39')]);_0x350894[_0xabf1('0x1d')]=qs[_0xabf1('0x1d')](_0x5a1d38[_0xabf1('0x32')][_0xabf1('0x1d')]);}_0x350894[_0xabf1('0x3a')]=qs['sort'](_0x5a1d38[_0xabf1('0x32')]['sort']);_0x350894[_0xabf1('0x3b')]=qs['filters'](_[_0xabf1('0x3c')](_0x5a1d38[_0xabf1('0x32')],_0x5e10dd[_0xabf1('0x3d')]),_0x1c271f);if(_0x5a1d38[_0xabf1('0x32')][_0xabf1('0x3e')]){_0x350894[_0xabf1('0x3b')]=_['merge'](_0x350894[_0xabf1('0x3b')],{'$or':_['map'](_0x1c271f,function(_0x2612da){if(_0x2612da[_0xabf1('0x2f')]!==_0xabf1('0x3f')){var _0x4a6c17={};_0x4a6c17[_0x2612da['name']]={'$like':'%'+_0x5a1d38['query'][_0xabf1('0x3e')]+'%'};return _0x4a6c17;}})});}_0x350894=_[_0xabf1('0x40')]({},_0x350894,_0x5a1d38[_0xabf1('0x41')]);var _0x4be20f={'where':_0x350894[_0xabf1('0x3b')]};return db[_0xabf1('0x2c')][_0xabf1('0x1e')](_0x4be20f)[_0xabf1('0x25')](function(_0x3d00a1){_0x26d420['count']=_0x3d00a1;if(_0x5a1d38[_0xabf1('0x32')][_0xabf1('0x42')]){_0x350894['include']=[{'all':!![]}];}return db[_0xabf1('0x2c')][_0xabf1('0x43')](_0x350894);})[_0xabf1('0x25')](function(_0x2e1ac4){_0x26d420[_0xabf1('0x44')]=_0x2e1ac4;return _0x26d420;})[_0xabf1('0x25')](respondWithFilteredResult(_0x36ef03,_0x350894))[_0xabf1('0x45')](handleError(_0x36ef03,null));};exports[_0xabf1('0x46')]=function(_0x3f30de,_0x396d82){var _0x3861ec={'raw':![],'where':{'id':_0x3f30de[_0xabf1('0x47')]['id']}},_0x3c4404={};_0x3c4404['model']=_[_0xabf1('0x33')](db[_0xabf1('0x2c')][_0xabf1('0x2d')]);_0x3c4404[_0xabf1('0x32')]=_[_0xabf1('0x33')](_0x3f30de['query']);_0x3c4404[_0xabf1('0x3d')]=_[_0xabf1('0x35')](_0x3c4404[_0xabf1('0x31')],_0x3c4404[_0xabf1('0x32')]);_0x3861ec[_0xabf1('0x34')]=_[_0xabf1('0x35')](_0x3c4404[_0xabf1('0x31')],qs[_0xabf1('0x36')](_0x3f30de[_0xabf1('0x32')]['fields']));_0x3861ec[_0xabf1('0x34')]=_0x3861ec[_0xabf1('0x34')][_0xabf1('0x37')]?_0x3861ec['attributes']:_0x3c4404[_0xabf1('0x31')];if(_0x3f30de[_0xabf1('0x32')][_0xabf1('0x42')]){_0x3861ec[_0xabf1('0x48')]=[{'all':!![]}];}_0x3861ec=_[_0xabf1('0x40')]({},_0x3861ec,_0x3f30de[_0xabf1('0x41')]);return db[_0xabf1('0x2c')][_0xabf1('0x49')](_0x3861ec)['then'](handleEntityNotFound(_0x396d82,null))[_0xabf1('0x25')](respondWithResult(_0x396d82,null))[_0xabf1('0x45')](handleError(_0x396d82,null));};exports[_0xabf1('0x4a')]=function(_0x27005f,_0x856a99){return db['IntegrationReport'][_0xabf1('0x4a')](_0x27005f[_0xabf1('0x4b')],{})['then'](respondWithResult(_0x856a99,0xc9))[_0xabf1('0x45')](handleError(_0x856a99,null));};exports[_0xabf1('0x4c')]=function(_0x1989fa,_0x888265){if(_0x1989fa[_0xabf1('0x4b')]['id']){delete _0x1989fa[_0xabf1('0x4b')]['id'];}return db[_0xabf1('0x2c')][_0xabf1('0x49')]({'where':{'id':_0x1989fa['params']['id']}})[_0xabf1('0x25')](handleEntityNotFound(_0x888265,null))['then'](saveUpdates(_0x1989fa[_0xabf1('0x4b')],null))[_0xabf1('0x25')](respondWithResult(_0x888265,null))[_0xabf1('0x45')](handleError(_0x888265,null));};exports[_0xabf1('0x26')]=function(_0x3626a3,_0xd5de82){return db[_0xabf1('0x2c')]['find']({'where':{'id':_0x3626a3[_0xabf1('0x47')]['id']}})[_0xabf1('0x25')](handleEntityNotFound(_0xd5de82,null))['then'](removeEntity(_0xd5de82,null))[_0xabf1('0x45')](handleError(_0xd5de82,null));};exports['describe']=function(_0x1f1d1d,_0x1cf85e){return db[_0xabf1('0x2c')][_0xabf1('0x4d')]()[_0xabf1('0x25')](respondWithResult(_0x1cf85e,null))[_0xabf1('0x45')](handleError(_0x1cf85e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 69325eb..f410bf5 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 _0x12cc=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x4a2217,_0x9c653a){var _0x24cb1c=function(_0x35155e){while(--_0x35155e){_0x4a2217['push'](_0x4a2217['shift']());}};_0x24cb1c(++_0x9c653a);}(_0x12cc,0x185));var _0xc12c=function(_0x3e6006,_0x58c01c){_0x3e6006=_0x3e6006-0x0;var _0x357adc=_0x12cc[_0x3e6006];return _0x357adc;};'use strict';var _=require(_0xc12c('0x0'));var util=require(_0xc12c('0x1'));var logger=require(_0xc12c('0x2'))('api');var moment=require(_0xc12c('0x3'));var BPromise=require(_0xc12c('0x4'));var rp=require(_0xc12c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc12c('0x6'));var config=require(_0xc12c('0x7'));var attributes=require(_0xc12c('0x8'));module[_0xc12c('0x9')]=function(_0x77e24f,_0x3c2fc9){return _0x77e24f[_0xc12c('0xa')](_0xc12c('0xb'),attributes,{'tableName':_0xc12c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc87=['exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc87,0xe4));var _0x7fc8=function(_0x276148,_0x11d7cd){_0x276148=_0x276148-0x0;var _0x3c62b8=_0xfc87[_0x276148];return _0x3c62b8;};'use strict';var _=require(_0x7fc8('0x0'));var util=require(_0x7fc8('0x1'));var logger=require(_0x7fc8('0x2'))(_0x7fc8('0x3'));var moment=require(_0x7fc8('0x4'));var BPromise=require('bluebird');var rp=require(_0x7fc8('0x5'));var fs=require('fs');var path=require(_0x7fc8('0x6'));var rimraf=require(_0x7fc8('0x7'));var config=require(_0x7fc8('0x8'));var attributes=require(_0x7fc8('0x9'));module[_0x7fc8('0xa')]=function(_0x13d8ea,_0x4902d3){return _0x13d8ea[_0x7fc8('0xb')](_0x7fc8('0xc'),attributes,{'tableName':_0x7fc8('0xd'),'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 157792d..a19282e 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4975,0x86));var _0x5497=function(_0x27513e,_0x4b06fa){_0x27513e=_0x27513e-0x0;var _0x3885eb=_0x4975[_0x27513e];return _0x3885eb;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x524e,0x15e));var _0xe524=function(_0x3040df,_0x380eb){_0x3040df=_0x3040df-0x0;var _0x5d2057=_0x524e[_0x3040df];return _0x5d2057;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index af647a0..a035e70 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 _0x081c=['post','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','exports','multer','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create'];(function(_0x30fe45,_0x3e20c8){var _0x1f7420=function(_0x406220){while(--_0x406220){_0x30fe45['push'](_0x30fe45['shift']());}};_0x1f7420(++_0x3e20c8);}(_0x081c,0xeb));var _0xc081=function(_0x35a329,_0x488fee){_0x35a329=_0x35a329-0x0;var _0x4cbdb1=_0x081c[_0x35a329];return _0x4cbdb1;};'use strict';var multer=require(_0xc081('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc081('0x1')]();var fs_extra=require(_0xc081('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc081('0x3'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0xc081('0x4')]('/',auth[_0xc081('0x5')](),controller[_0xc081('0x6')]);router['get'](_0xc081('0x7'),auth['isAuthenticated'](),controller[_0xc081('0x8')]);router['get'](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xa')]);router['post']('/',auth[_0xc081('0x5')](),controller[_0xc081('0xb')]);router[_0xc081('0xc')](_0xc081('0x9'),auth['isAuthenticated'](),controller[_0xc081('0xd')]);router[_0xc081('0xc')](_0xc081('0xe'),auth[_0xc081('0x5')](),controller[_0xc081('0xf')]);router['put'](_0xc081('0x7'),auth[_0xc081('0x5')](),controller[_0xc081('0x10')]);router[_0xc081('0x11')](_0xc081('0x7'),auth[_0xc081('0x5')](),controller['destroy']);module[_0xc081('0x12')]=router; \ No newline at end of file +var _0x3e26=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','put','update','destroy','exports','util','connect-timeout','express'];(function(_0x35d546,_0x3d9ba3){var _0x4349e5=function(_0x14efa5){while(--_0x14efa5){_0x35d546['push'](_0x35d546['shift']());}};_0x4349e5(++_0x3d9ba3);}(_0x3e26,0xed));var _0x63e2=function(_0x5ea8be,_0x2820cf){_0x5ea8be=_0x5ea8be-0x0;var _0x3b28c8=_0x3e26[_0x5ea8be];return _0x3b28c8;};'use strict';var multer=require('multer');var util=require(_0x63e2('0x0'));var path=require('path');var timeout=require(_0x63e2('0x1'));var express=require(_0x63e2('0x2'));var router=express[_0x63e2('0x3')]();var fs_extra=require(_0x63e2('0x4'));var auth=require(_0x63e2('0x5'));var interaction=require(_0x63e2('0x6'));var config=require(_0x63e2('0x7'));var controller=require(_0x63e2('0x8'));router[_0x63e2('0x9')]('/',auth[_0x63e2('0xa')](),controller[_0x63e2('0xb')]);router[_0x63e2('0x9')](_0x63e2('0xc'),auth['isAuthenticated'](),controller[_0x63e2('0xd')]);router[_0x63e2('0x9')](_0x63e2('0xe'),auth[_0x63e2('0xa')](),controller[_0x63e2('0xf')]);router['post']('/',auth[_0x63e2('0xa')](),controller[_0x63e2('0x10')]);router[_0x63e2('0x11')]('/:id/sub_intervals',auth[_0x63e2('0xa')](),controller[_0x63e2('0x12')]);router['post'](_0x63e2('0x13'),auth[_0x63e2('0xa')](),controller['addIntervals']);router[_0x63e2('0x14')](_0x63e2('0xc'),auth[_0x63e2('0xa')](),controller[_0x63e2('0x15')]);router['delete'](_0x63e2('0xc'),auth[_0x63e2('0xa')](),controller[_0x63e2('0x16')]);module[_0x63e2('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 4f105bb..2b837e9 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 _0x4b08=['STRING','sequelize'];(function(_0x4aa2c9,_0x3c74e5){var _0x212e33=function(_0x20f06a){while(--_0x20f06a){_0x4aa2c9['push'](_0x4aa2c9['shift']());}};_0x212e33(++_0x3c74e5);}(_0x4b08,0xdf));var _0x84b0=function(_0x4ae731,_0xf75b7f){_0x4ae731=_0x4ae731-0x0;var _0x587df0=_0x4b08[_0x4ae731];return _0x587df0;};'use strict';var Sequelize=require(_0x84b0('0x0'));module['exports']={'name':{'type':Sequelize[_0x84b0('0x1')]},'description':{'type':Sequelize[_0x84b0('0x1')]},'interval':{'type':Sequelize[_0x84b0('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xbe93=['STRING','sequelize'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xbe93,0xe5));var _0x3be9=function(_0x46d1bf,_0x4f63d7){_0x46d1bf=_0x46d1bf-0x0;var _0x351bb1=_0xbe93[_0x46d1bf];return _0x351bb1;};'use strict';var Sequelize=require(_0x3be9('0x0'));module['exports']={'name':{'type':Sequelize[_0x3be9('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3be9('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 c3c8376..7a37859 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 _0x41b4=['Content-Range','json','apply','reject','save','then','get','Intervals','UserProfileResource','destroy','stack','name','send','index','map','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','options','Interval','include','findAll','catch','show','params','rawAttributes','keys','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','addInterval','IntervalId','getIntervals','hasOwnProperty','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','undefined','limit','count','offset','set'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x41b4,0x1d7));var _0x441b=function(_0x3c2d87,_0x623ad){_0x3c2d87=_0x3c2d87-0x0;var _0x142d3c=_0x41b4[_0x3c2d87];return _0x142d3c;};'use strict';var emlformat=require(_0x441b('0x0'));var rimraf=require(_0x441b('0x1'));var zipdir=require(_0x441b('0x2'));var jsonpatch=require(_0x441b('0x3'));var rp=require(_0x441b('0x4'));var moment=require('moment');var BPromise=require(_0x441b('0x5'));var Mustache=require(_0x441b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x441b('0x7'));var csv=require(_0x441b('0x8'));var ejs=require(_0x441b('0x9'));var fs=require('fs');var fs_extra=require(_0x441b('0xa'));var _=require('lodash');var squel=require(_0x441b('0xb'));var crypto=require(_0x441b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x441b('0xd'));var toCsv=require(_0x441b('0x8'));var querystring=require('querystring');var Papa=require(_0x441b('0xe'));var Redis=require(_0x441b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x441b('0x10'));var as=require(_0x441b('0x11'));var hardwareService=require(_0x441b('0x12'));var logger=require(_0x441b('0x13'))('api');var utils=require(_0x441b('0x14'));var config=require(_0x441b('0x15'));var licenseUtil=require(_0x441b('0x16'));var db=require(_0x441b('0x17'))['db'];var extensions=require(_0x441b('0x18'));function respondWithStatusCode(_0x414755,_0x510b4a){_0x510b4a=_0x510b4a||0xcc;return function(_0x582b94){if(_0x582b94){return _0x414755[_0x441b('0x19')](_0x510b4a);}return _0x414755[_0x441b('0x1a')](_0x510b4a)[_0x441b('0x1b')]();};}function respondWithResult(_0x4f548a,_0x564215){_0x564215=_0x564215||0xc8;return function(_0x3e2e0b){if(_0x3e2e0b){return _0x4f548a[_0x441b('0x1a')](_0x564215)['json'](_0x3e2e0b);}};}function respondWithFilteredResult(_0x3d1fd5,_0x405f47){return function(_0x42a7b3){if(_0x42a7b3){var _0x1586b6=typeof _0x405f47['offset']===_0x441b('0x1c')&&typeof _0x405f47[_0x441b('0x1d')]===_0x441b('0x1c');var _0xb31e8=_0x42a7b3['count'];var _0x219b4d=_0x1586b6?0x0:_0x405f47['offset'];var _0x4f7232=_0x1586b6?_0x42a7b3[_0x441b('0x1e')]:_0x405f47[_0x441b('0x1f')]+_0x405f47[_0x441b('0x1d')];var _0x5c2d8d;if(_0x4f7232>=_0xb31e8){_0x4f7232=_0xb31e8;_0x5c2d8d=0xc8;}else{_0x5c2d8d=0xce;}_0x3d1fd5[_0x441b('0x1a')](_0x5c2d8d);return _0x3d1fd5[_0x441b('0x20')](_0x441b('0x21'),_0x219b4d+'-'+_0x4f7232+'/'+_0xb31e8)[_0x441b('0x22')](_0x42a7b3);}return null;};}function patchUpdates(_0xe5e04c){return function(_0x5114bf){try{jsonpatch[_0x441b('0x23')](_0x5114bf,_0xe5e04c,!![]);}catch(_0x1797ef){return BPromise[_0x441b('0x24')](_0x1797ef);}return _0x5114bf[_0x441b('0x25')]();};}function saveUpdates(_0x3fb93b,_0x24e02e){return function(_0x2946fe){if(_0x2946fe){return _0x2946fe['update'](_0x3fb93b)[_0x441b('0x26')](function(_0x469ed9){return _0x469ed9;});}return null;};}function removeEntity(_0x3fd255,_0x317eaf){return function(_0x26c0c7){if(_0x26c0c7){return _0x26c0c7['destroy']()[_0x441b('0x26')](function(){var _0x2faa15=_0x26c0c7[_0x441b('0x27')]({'plain':!![]});var _0x35fdda=_0x441b('0x28');return db[_0x441b('0x29')][_0x441b('0x2a')]({'where':{'type':_0x35fdda,'resourceId':_0x2faa15['id']}})['then'](function(){return _0x26c0c7;});})[_0x441b('0x26')](function(){_0x3fd255['status'](0xcc)[_0x441b('0x1b')]();});}};}function handleEntityNotFound(_0x29b727,_0x5ac01f){return function(_0x14de54){if(!_0x14de54){_0x29b727['sendStatus'](0x194);}return _0x14de54;};}function handleError(_0x276e10,_0x5433cb){_0x5433cb=_0x5433cb||0x1f4;return function(_0x31849e){logger['error'](_0x31849e[_0x441b('0x2b')]);if(_0x31849e[_0x441b('0x2c')]){delete _0x31849e[_0x441b('0x2c')];}_0x276e10[_0x441b('0x1a')](_0x5433cb)[_0x441b('0x2d')](_0x31849e);};}exports[_0x441b('0x2e')]=function(_0x513ba6,_0x40eb5f){var _0x2519d1={},_0x4f576e={},_0x4750cd={'count':0x0,'rows':[]};var _0x2da1d3=_[_0x441b('0x2f')](db['Interval']['rawAttributes'],function(_0x194239){return{'name':_0x194239['fieldName'],'type':_0x194239[_0x441b('0x30')]['key']};});_0x4f576e[_0x441b('0x31')]=_[_0x441b('0x2f')](_0x2da1d3,'name');_0x4f576e[_0x441b('0x32')]=_['keys'](_0x513ba6[_0x441b('0x32')]);_0x4f576e[_0x441b('0x33')]=_[_0x441b('0x34')](_0x4f576e['model'],_0x4f576e['query']);_0x2519d1[_0x441b('0x35')]=_[_0x441b('0x34')](_0x4f576e[_0x441b('0x31')],qs[_0x441b('0x36')](_0x513ba6[_0x441b('0x32')][_0x441b('0x36')]));_0x2519d1['attributes']=_0x2519d1[_0x441b('0x35')][_0x441b('0x37')]?_0x2519d1[_0x441b('0x35')]:_0x4f576e[_0x441b('0x31')];if(!_0x513ba6[_0x441b('0x32')]['hasOwnProperty'](_0x441b('0x38'))){_0x2519d1[_0x441b('0x1d')]=qs['limit'](_0x513ba6['query'][_0x441b('0x1d')]);_0x2519d1[_0x441b('0x1f')]=qs[_0x441b('0x1f')](_0x513ba6[_0x441b('0x32')][_0x441b('0x1f')]);}_0x2519d1[_0x441b('0x39')]=qs[_0x441b('0x3a')](_0x513ba6[_0x441b('0x32')][_0x441b('0x3a')]);_0x2519d1[_0x441b('0x3b')]=qs['filters'](_['pick'](_0x513ba6['query'],_0x4f576e[_0x441b('0x33')]),_0x2da1d3);if(_0x513ba6['query']['filter']){_0x2519d1['where']=_['merge'](_0x2519d1['where'],{'$or':_[_0x441b('0x2f')](_0x2da1d3,function(_0x2d3639){if(_0x2d3639['type']!==_0x441b('0x3c')){var _0x322221={};_0x322221[_0x2d3639[_0x441b('0x2c')]]={'$like':'%'+_0x513ba6[_0x441b('0x32')][_0x441b('0x3d')]+'%'};return _0x322221;}})});}_0x2519d1=_['merge']({},_0x2519d1,_0x513ba6[_0x441b('0x3e')]);var _0x52d54b={'where':_0x2519d1['where']};return db[_0x441b('0x3f')]['count'](_0x52d54b)[_0x441b('0x26')](function(_0x1f08be){_0x4750cd[_0x441b('0x1e')]=_0x1f08be;if(_0x513ba6[_0x441b('0x32')]['includeAll']){_0x2519d1[_0x441b('0x40')]=[{'all':!![]}];}return db['Interval'][_0x441b('0x41')](_0x2519d1);})[_0x441b('0x26')](function(_0x11272c){_0x4750cd['rows']=_0x11272c;return _0x4750cd;})[_0x441b('0x26')](respondWithFilteredResult(_0x40eb5f,_0x2519d1))[_0x441b('0x42')](handleError(_0x40eb5f,null));};exports[_0x441b('0x43')]=function(_0x498553,_0x49624d){var _0x316303={'raw':!![],'where':{'id':_0x498553[_0x441b('0x44')]['id']}},_0x3a57c0={};_0x3a57c0[_0x441b('0x31')]=_['keys'](db[_0x441b('0x3f')][_0x441b('0x45')]);_0x3a57c0[_0x441b('0x32')]=_[_0x441b('0x46')](_0x498553[_0x441b('0x32')]);_0x3a57c0[_0x441b('0x33')]=_[_0x441b('0x34')](_0x3a57c0[_0x441b('0x31')],_0x3a57c0[_0x441b('0x32')]);_0x316303[_0x441b('0x35')]=_[_0x441b('0x34')](_0x3a57c0[_0x441b('0x31')],qs[_0x441b('0x36')](_0x498553[_0x441b('0x32')][_0x441b('0x36')]));_0x316303[_0x441b('0x35')]=_0x316303['attributes'][_0x441b('0x37')]?_0x316303[_0x441b('0x35')]:_0x3a57c0[_0x441b('0x31')];if(_0x498553[_0x441b('0x32')][_0x441b('0x47')]){_0x316303['include']=[{'all':!![]}];}_0x316303=_[_0x441b('0x48')]({},_0x316303,_0x498553['options']);return db['Interval'][_0x441b('0x49')](_0x316303)[_0x441b('0x26')](handleEntityNotFound(_0x49624d,null))[_0x441b('0x26')](respondWithResult(_0x49624d,null))[_0x441b('0x42')](handleError(_0x49624d,null));};exports[_0x441b('0x4a')]=function(_0x369dc0,_0x13068a){return db[_0x441b('0x3f')]['create'](_0x369dc0[_0x441b('0x4b')],{})[_0x441b('0x26')](function(_0x556e18){var _0x453be3=_0x369dc0['user'][_0x441b('0x27')]({'plain':!![]});if(!_0x453be3)throw new Error(_0x441b('0x4c'));if(_0x453be3['role']==='user'){var _0x3e6234=_0x556e18[_0x441b('0x27')]({'plain':!![]});var _0x1f0479='Intervals';return db['UserProfileSection'][_0x441b('0x49')]({'where':{'name':_0x1f0479,'userProfileId':_0x453be3['userProfileId']},'raw':!![]})['then'](function(_0x561cd4){if(_0x561cd4&&_0x561cd4['autoAssociation']===0x0){return db[_0x441b('0x29')]['create']({'name':_0x3e6234[_0x441b('0x2c')],'resourceId':_0x3e6234['id'],'type':_0x561cd4[_0x441b('0x2c')],'sectionId':_0x561cd4['id']},{})[_0x441b('0x26')](function(){return _0x556e18;});}else{return _0x556e18;}})['catch'](function(_0x81b59b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x81b59b);throw _0x81b59b;});}return _0x556e18;})['then'](respondWithResult(_0x13068a,0xc9))[_0x441b('0x42')](handleError(_0x13068a,null));};exports['update']=function(_0x34fb30,_0x4111b7){if(_0x34fb30['body']['id']){delete _0x34fb30[_0x441b('0x4b')]['id'];}return db[_0x441b('0x3f')]['find']({'where':{'id':_0x34fb30[_0x441b('0x44')]['id']}})['then'](handleEntityNotFound(_0x4111b7,null))[_0x441b('0x26')](saveUpdates(_0x34fb30[_0x441b('0x4b')],null))[_0x441b('0x26')](respondWithResult(_0x4111b7,null))[_0x441b('0x42')](handleError(_0x4111b7,null));};exports[_0x441b('0x2a')]=function(_0x545d8d,_0x17aa44){return db['Interval'][_0x441b('0x49')]({'where':{'id':_0x545d8d[_0x441b('0x44')]['id']}})[_0x441b('0x26')](handleEntityNotFound(_0x17aa44,null))[_0x441b('0x26')](removeEntity(_0x17aa44,null))[_0x441b('0x42')](handleError(_0x17aa44,null));};exports[_0x441b('0x4d')]=function(_0x17cd39,_0x271b89,_0x3d4d97){if(_0x17cd39[_0x441b('0x4b')]['id']){delete _0x17cd39[_0x441b('0x4b')]['id'];}return db['Interval'][_0x441b('0x49')]({'where':{'id':_0x17cd39[_0x441b('0x44')]['id']}})[_0x441b('0x26')](handleEntityNotFound(_0x271b89,null))[_0x441b('0x26')](function(_0x3fa9d7){if(_0x3fa9d7){_0x17cd39[_0x441b('0x4b')][_0x441b('0x4e')]=_0x3fa9d7['id'];return db[_0x441b('0x3f')][_0x441b('0x4a')](_0x17cd39[_0x441b('0x4b')]);}})[_0x441b('0x26')](respondWithResult(_0x271b89,null))[_0x441b('0x42')](handleError(_0x271b89,null));};exports[_0x441b('0x4f')]=function(_0x29f15b,_0x3341f5,_0x485ffa){var _0x4091a3={};var _0x139e9d={};var _0x398137;var _0x985203;return db[_0x441b('0x3f')]['findOne']({'where':{'id':_0x29f15b[_0x441b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3341f5,null))['then'](function(_0x276d02){if(_0x276d02){_0x398137=_0x276d02;_0x139e9d['model']=_[_0x441b('0x46')](db['Interval'][_0x441b('0x45')]);_0x139e9d[_0x441b('0x32')]=_[_0x441b('0x46')](_0x29f15b[_0x441b('0x32')]);_0x139e9d[_0x441b('0x33')]=_[_0x441b('0x34')](_0x139e9d[_0x441b('0x31')],_0x139e9d['query']);_0x4091a3[_0x441b('0x35')]=_[_0x441b('0x34')](_0x139e9d['model'],qs[_0x441b('0x36')](_0x29f15b['query'][_0x441b('0x36')]));_0x4091a3[_0x441b('0x35')]=_0x4091a3[_0x441b('0x35')][_0x441b('0x37')]?_0x4091a3[_0x441b('0x35')]:_0x139e9d[_0x441b('0x31')];_0x4091a3[_0x441b('0x39')]=qs[_0x441b('0x3a')](_0x29f15b['query'][_0x441b('0x3a')]);_0x4091a3['where']=qs[_0x441b('0x33')](_['pick'](_0x29f15b[_0x441b('0x32')],_0x139e9d['filters']));if(_0x29f15b[_0x441b('0x32')]['filter']){_0x4091a3[_0x441b('0x3b')]=_[_0x441b('0x48')](_0x4091a3[_0x441b('0x3b')],{'$or':_[_0x441b('0x2f')](_0x4091a3[_0x441b('0x35')],function(_0x2be2c2){var _0x409b5d={};_0x409b5d[_0x2be2c2]={'$like':'%'+_0x29f15b['query'][_0x441b('0x3d')]+'%'};return _0x409b5d;})});}_0x4091a3=_[_0x441b('0x48')]({},_0x4091a3,_0x29f15b[_0x441b('0x3e')]);return _0x398137[_0x441b('0x4f')](_0x4091a3);}})['then'](function(_0x29f177){if(_0x29f177){_0x985203=_0x29f177[_0x441b('0x37')];if(!_0x29f15b[_0x441b('0x32')][_0x441b('0x50')](_0x441b('0x38'))){_0x4091a3[_0x441b('0x1d')]=qs[_0x441b('0x1d')](_0x29f15b[_0x441b('0x32')][_0x441b('0x1d')]);_0x4091a3[_0x441b('0x1f')]=qs['offset'](_0x29f15b[_0x441b('0x32')][_0x441b('0x1f')]);}return _0x398137[_0x441b('0x4f')](_0x4091a3);}})[_0x441b('0x26')](function(_0x5def84){if(_0x5def84){return _0x5def84?{'count':_0x985203,'rows':_0x5def84}:null;}})[_0x441b('0x26')](respondWithResult(_0x3341f5,null))['catch'](handleError(_0x3341f5,null));};exports[_0x441b('0x51')]=function(_0x3d291d,_0xa0c05a,_0x5af54b){return db['Interval']['findOne']({'where':{'id':_0x3d291d[_0x441b('0x44')]['id']}})[_0x441b('0x26')](handleEntityNotFound(_0xa0c05a,null))[_0x441b('0x26')](function(_0xc6ac96){if(_0xc6ac96){return db[_0x441b('0x52')][_0x441b('0x53')](function(_0x16a118){return db[_0x441b('0x3f')][_0x441b('0x2a')]({'where':{'IntervalId':_0x3d291d[_0x441b('0x44')]['id']},'transaction':_0x16a118})[_0x441b('0x26')](function(_0xc2d080){var _0x2b55db=_['map'](_0x3d291d[_0x441b('0x4b')],function(_0x52b8c0){delete _0x52b8c0['id'];_0x52b8c0[_0x441b('0x4e')]=_0x3d291d[_0x441b('0x44')]['id'];return _0x52b8c0;});return db[_0x441b('0x3f')]['bulkCreate'](_0x2b55db,{'transaction':_0x16a118});});})[_0x441b('0x26')](function(){return db['Interval'][_0x441b('0x41')]({'where':{'IntervalId':_0x3d291d[_0x441b('0x44')]['id']}});});}})[_0x441b('0x26')](respondWithResult(_0xa0c05a,null))[_0x441b('0x42')](handleError(_0xa0c05a,null));}; \ No newline at end of file +var _0x52b0=['sequelize','transaction','IntervalId','bulkCreate','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','Interval','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','addInterval','getIntervals','addIntervals','findOne'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0x52b0,0x10c));var _0x052b=function(_0x143b09,_0x17388d){_0x143b09=_0x143b09-0x0;var _0x465a78=_0x52b0[_0x143b09];return _0x465a78;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x052b('0x0'));var jsonpatch=require(_0x052b('0x1'));var rp=require('request-promise');var moment=require(_0x052b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x052b('0x3'));var util=require(_0x052b('0x4'));var path=require('path');var sox=require(_0x052b('0x5'));var csv=require(_0x052b('0x6'));var ejs=require(_0x052b('0x7'));var fs=require('fs');var fs_extra=require(_0x052b('0x8'));var _=require(_0x052b('0x9'));var squel=require(_0x052b('0xa'));var crypto=require('crypto');var jsforce=require(_0x052b('0xb'));var deskjs=require(_0x052b('0xc'));var toCsv=require(_0x052b('0x6'));var querystring=require(_0x052b('0xd'));var Papa=require(_0x052b('0xe'));var Redis=require(_0x052b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x052b('0x10'));var logger=require(_0x052b('0x11'))('api');var utils=require(_0x052b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x052b('0x13'));var db=require(_0x052b('0x14'))['db'];var extensions=require(_0x052b('0x15'));function respondWithStatusCode(_0x22bc37,_0x1155c8){_0x1155c8=_0x1155c8||0xcc;return function(_0x34cd88){if(_0x34cd88){return _0x22bc37['sendStatus'](_0x1155c8);}return _0x22bc37[_0x052b('0x16')](_0x1155c8)['end']();};}function respondWithResult(_0x7887e7,_0x7c0b9e){_0x7c0b9e=_0x7c0b9e||0xc8;return function(_0x4d0912){if(_0x4d0912){return _0x7887e7['status'](_0x7c0b9e)[_0x052b('0x17')](_0x4d0912);}};}function respondWithFilteredResult(_0xaf46b0,_0x1435dd){return function(_0x229366){if(_0x229366){var _0x5b00ba=typeof _0x1435dd[_0x052b('0x18')]==='undefined'&&typeof _0x1435dd[_0x052b('0x19')]===_0x052b('0x1a');var _0x9ebc21=_0x229366[_0x052b('0x1b')];var _0x229a07=_0x5b00ba?0x0:_0x1435dd['offset'];var _0x1209e2=_0x5b00ba?_0x229366[_0x052b('0x1b')]:_0x1435dd[_0x052b('0x18')]+_0x1435dd[_0x052b('0x19')];var _0x454949;if(_0x1209e2>=_0x9ebc21){_0x1209e2=_0x9ebc21;_0x454949=0xc8;}else{_0x454949=0xce;}_0xaf46b0[_0x052b('0x16')](_0x454949);return _0xaf46b0[_0x052b('0x1c')]('Content-Range',_0x229a07+'-'+_0x1209e2+'/'+_0x9ebc21)[_0x052b('0x17')](_0x229366);}return null;};}function patchUpdates(_0x234634){return function(_0x20ce97){try{jsonpatch[_0x052b('0x1d')](_0x20ce97,_0x234634,!![]);}catch(_0x8f6de4){return BPromise[_0x052b('0x1e')](_0x8f6de4);}return _0x20ce97[_0x052b('0x1f')]();};}function saveUpdates(_0x18056d,_0x2589d4){return function(_0x55d550){if(_0x55d550){return _0x55d550[_0x052b('0x20')](_0x18056d)[_0x052b('0x21')](function(_0x32bf32){return _0x32bf32;});}return null;};}function removeEntity(_0x1c1e27,_0x3d7ace){return function(_0x53f54e){if(_0x53f54e){return _0x53f54e['destroy']()['then'](function(){var _0x7cf348=_0x53f54e[_0x052b('0x22')]({'plain':!![]});var _0x2772ef=_0x052b('0x23');return db[_0x052b('0x24')][_0x052b('0x25')]({'where':{'type':_0x2772ef,'resourceId':_0x7cf348['id']}})[_0x052b('0x21')](function(){return _0x53f54e;});})[_0x052b('0x21')](function(){_0x1c1e27[_0x052b('0x16')](0xcc)[_0x052b('0x26')]();});}};}function handleEntityNotFound(_0x534cfe,_0x57750e){return function(_0x1cbc9f){if(!_0x1cbc9f){_0x534cfe[_0x052b('0x27')](0x194);}return _0x1cbc9f;};}function handleError(_0xb1cab8,_0x463b05){_0x463b05=_0x463b05||0x1f4;return function(_0x310d7f){logger[_0x052b('0x28')](_0x310d7f[_0x052b('0x29')]);if(_0x310d7f[_0x052b('0x2a')]){delete _0x310d7f[_0x052b('0x2a')];}_0xb1cab8[_0x052b('0x16')](_0x463b05)[_0x052b('0x2b')](_0x310d7f);};}exports[_0x052b('0x2c')]=function(_0x1c11dd,_0x2afad0){var _0x3d7bfd={},_0x534ae2={},_0x3fa33e={'count':0x0,'rows':[]};var _0x3d6151=_[_0x052b('0x2d')](db['Interval']['rawAttributes'],function(_0x468d8a){return{'name':_0x468d8a[_0x052b('0x2e')],'type':_0x468d8a[_0x052b('0x2f')][_0x052b('0x30')]};});_0x534ae2['model']=_[_0x052b('0x2d')](_0x3d6151,'name');_0x534ae2['query']=_[_0x052b('0x31')](_0x1c11dd[_0x052b('0x32')]);_0x534ae2[_0x052b('0x33')]=_['intersection'](_0x534ae2[_0x052b('0x34')],_0x534ae2[_0x052b('0x32')]);_0x3d7bfd[_0x052b('0x35')]=_[_0x052b('0x36')](_0x534ae2[_0x052b('0x34')],qs[_0x052b('0x37')](_0x1c11dd[_0x052b('0x32')]['fields']));_0x3d7bfd[_0x052b('0x35')]=_0x3d7bfd['attributes'][_0x052b('0x38')]?_0x3d7bfd[_0x052b('0x35')]:_0x534ae2[_0x052b('0x34')];if(!_0x1c11dd[_0x052b('0x32')]['hasOwnProperty'](_0x052b('0x39'))){_0x3d7bfd['limit']=qs[_0x052b('0x19')](_0x1c11dd[_0x052b('0x32')]['limit']);_0x3d7bfd[_0x052b('0x18')]=qs[_0x052b('0x18')](_0x1c11dd[_0x052b('0x32')][_0x052b('0x18')]);}_0x3d7bfd['order']=qs['sort'](_0x1c11dd[_0x052b('0x32')][_0x052b('0x3a')]);_0x3d7bfd[_0x052b('0x3b')]=qs[_0x052b('0x33')](_['pick'](_0x1c11dd[_0x052b('0x32')],_0x534ae2[_0x052b('0x33')]),_0x3d6151);if(_0x1c11dd[_0x052b('0x32')]['filter']){_0x3d7bfd[_0x052b('0x3b')]=_[_0x052b('0x3c')](_0x3d7bfd['where'],{'$or':_[_0x052b('0x2d')](_0x3d6151,function(_0x74af70){if(_0x74af70['type']!==_0x052b('0x3d')){var _0x4c9725={};_0x4c9725[_0x74af70[_0x052b('0x2a')]]={'$like':'%'+_0x1c11dd[_0x052b('0x32')][_0x052b('0x3e')]+'%'};return _0x4c9725;}})});}_0x3d7bfd=_['merge']({},_0x3d7bfd,_0x1c11dd[_0x052b('0x3f')]);var _0xeb33ac={'where':_0x3d7bfd[_0x052b('0x3b')]};return db[_0x052b('0x40')][_0x052b('0x1b')](_0xeb33ac)[_0x052b('0x21')](function(_0x498bb1){_0x3fa33e[_0x052b('0x1b')]=_0x498bb1;if(_0x1c11dd['query']['includeAll']){_0x3d7bfd[_0x052b('0x41')]=[{'all':!![]}];}return db[_0x052b('0x40')]['findAll'](_0x3d7bfd);})['then'](function(_0x42be92){_0x3fa33e[_0x052b('0x42')]=_0x42be92;return _0x3fa33e;})[_0x052b('0x21')](respondWithFilteredResult(_0x2afad0,_0x3d7bfd))[_0x052b('0x43')](handleError(_0x2afad0,null));};exports[_0x052b('0x44')]=function(_0x2f2fab,_0x3b30a0){var _0x2890ad={'raw':!![],'where':{'id':_0x2f2fab[_0x052b('0x45')]['id']}},_0x39fbd2={};_0x39fbd2[_0x052b('0x34')]=_['keys'](db['Interval'][_0x052b('0x46')]);_0x39fbd2[_0x052b('0x32')]=_['keys'](_0x2f2fab[_0x052b('0x32')]);_0x39fbd2[_0x052b('0x33')]=_[_0x052b('0x36')](_0x39fbd2[_0x052b('0x34')],_0x39fbd2[_0x052b('0x32')]);_0x2890ad[_0x052b('0x35')]=_[_0x052b('0x36')](_0x39fbd2[_0x052b('0x34')],qs[_0x052b('0x37')](_0x2f2fab[_0x052b('0x32')][_0x052b('0x37')]));_0x2890ad[_0x052b('0x35')]=_0x2890ad[_0x052b('0x35')][_0x052b('0x38')]?_0x2890ad[_0x052b('0x35')]:_0x39fbd2['model'];if(_0x2f2fab['query'][_0x052b('0x47')]){_0x2890ad[_0x052b('0x41')]=[{'all':!![]}];}_0x2890ad=_[_0x052b('0x3c')]({},_0x2890ad,_0x2f2fab['options']);return db[_0x052b('0x40')][_0x052b('0x48')](_0x2890ad)['then'](handleEntityNotFound(_0x3b30a0,null))['then'](respondWithResult(_0x3b30a0,null))['catch'](handleError(_0x3b30a0,null));};exports[_0x052b('0x49')]=function(_0x849a01,_0x1f5b61){return db['Interval'][_0x052b('0x49')](_0x849a01[_0x052b('0x4a')],{})[_0x052b('0x21')](function(_0x581806){var _0x3b127b=_0x849a01['user'][_0x052b('0x22')]({'plain':!![]});if(!_0x3b127b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b127b[_0x052b('0x4b')]===_0x052b('0x4c')){var _0x18f572=_0x581806[_0x052b('0x22')]({'plain':!![]});var _0x5e5cdd='Intervals';return db[_0x052b('0x4d')][_0x052b('0x48')]({'where':{'name':_0x5e5cdd,'userProfileId':_0x3b127b[_0x052b('0x4e')]},'raw':!![]})[_0x052b('0x21')](function(_0x1a9f0f){if(_0x1a9f0f&&_0x1a9f0f[_0x052b('0x4f')]===0x0){return db['UserProfileResource'][_0x052b('0x49')]({'name':_0x18f572[_0x052b('0x2a')],'resourceId':_0x18f572['id'],'type':_0x1a9f0f[_0x052b('0x2a')],'sectionId':_0x1a9f0f['id']},{})[_0x052b('0x21')](function(){return _0x581806;});}else{return _0x581806;}})[_0x052b('0x43')](function(_0x3f240e){logger[_0x052b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f240e);throw _0x3f240e;});}return _0x581806;})[_0x052b('0x21')](respondWithResult(_0x1f5b61,0xc9))['catch'](handleError(_0x1f5b61,null));};exports[_0x052b('0x20')]=function(_0x21fc24,_0x4e8c63){if(_0x21fc24[_0x052b('0x4a')]['id']){delete _0x21fc24[_0x052b('0x4a')]['id'];}return db['Interval'][_0x052b('0x48')]({'where':{'id':_0x21fc24[_0x052b('0x45')]['id']}})[_0x052b('0x21')](handleEntityNotFound(_0x4e8c63,null))[_0x052b('0x21')](saveUpdates(_0x21fc24[_0x052b('0x4a')],null))[_0x052b('0x21')](respondWithResult(_0x4e8c63,null))[_0x052b('0x43')](handleError(_0x4e8c63,null));};exports['destroy']=function(_0x15b2a1,_0x5808fc){return db['Interval'][_0x052b('0x48')]({'where':{'id':_0x15b2a1[_0x052b('0x45')]['id']}})[_0x052b('0x21')](handleEntityNotFound(_0x5808fc,null))['then'](removeEntity(_0x5808fc,null))[_0x052b('0x43')](handleError(_0x5808fc,null));};exports[_0x052b('0x50')]=function(_0x43566a,_0x202815,_0x4b227b){if(_0x43566a['body']['id']){delete _0x43566a[_0x052b('0x4a')]['id'];}return db[_0x052b('0x40')][_0x052b('0x48')]({'where':{'id':_0x43566a[_0x052b('0x45')]['id']}})[_0x052b('0x21')](handleEntityNotFound(_0x202815,null))[_0x052b('0x21')](function(_0x431292){if(_0x431292){_0x43566a[_0x052b('0x4a')]['IntervalId']=_0x431292['id'];return db[_0x052b('0x40')][_0x052b('0x49')](_0x43566a[_0x052b('0x4a')]);}})['then'](respondWithResult(_0x202815,null))[_0x052b('0x43')](handleError(_0x202815,null));};exports[_0x052b('0x51')]=function(_0x4690b8,_0x48ef0a,_0x4d7867){var _0x577d17={};var _0x56ad4d={};var _0x2a2169;var _0x445c0;return db[_0x052b('0x40')]['findOne']({'where':{'id':_0x4690b8[_0x052b('0x45')]['id']}})[_0x052b('0x21')](handleEntityNotFound(_0x48ef0a,null))[_0x052b('0x21')](function(_0x38b92f){if(_0x38b92f){_0x2a2169=_0x38b92f;_0x56ad4d[_0x052b('0x34')]=_['keys'](db['Interval'][_0x052b('0x46')]);_0x56ad4d[_0x052b('0x32')]=_[_0x052b('0x31')](_0x4690b8['query']);_0x56ad4d[_0x052b('0x33')]=_[_0x052b('0x36')](_0x56ad4d[_0x052b('0x34')],_0x56ad4d[_0x052b('0x32')]);_0x577d17[_0x052b('0x35')]=_[_0x052b('0x36')](_0x56ad4d[_0x052b('0x34')],qs[_0x052b('0x37')](_0x4690b8['query'][_0x052b('0x37')]));_0x577d17[_0x052b('0x35')]=_0x577d17[_0x052b('0x35')][_0x052b('0x38')]?_0x577d17[_0x052b('0x35')]:_0x56ad4d[_0x052b('0x34')];_0x577d17['order']=qs[_0x052b('0x3a')](_0x4690b8[_0x052b('0x32')][_0x052b('0x3a')]);_0x577d17[_0x052b('0x3b')]=qs['filters'](_['pick'](_0x4690b8['query'],_0x56ad4d[_0x052b('0x33')]));if(_0x4690b8['query'][_0x052b('0x3e')]){_0x577d17[_0x052b('0x3b')]=_['merge'](_0x577d17['where'],{'$or':_[_0x052b('0x2d')](_0x577d17['attributes'],function(_0x59d675){var _0x4c87d8={};_0x4c87d8[_0x59d675]={'$like':'%'+_0x4690b8[_0x052b('0x32')][_0x052b('0x3e')]+'%'};return _0x4c87d8;})});}_0x577d17=_['merge']({},_0x577d17,_0x4690b8[_0x052b('0x3f')]);return _0x2a2169['getIntervals'](_0x577d17);}})[_0x052b('0x21')](function(_0x26f965){if(_0x26f965){_0x445c0=_0x26f965[_0x052b('0x38')];if(!_0x4690b8[_0x052b('0x32')]['hasOwnProperty'](_0x052b('0x39'))){_0x577d17['limit']=qs[_0x052b('0x19')](_0x4690b8[_0x052b('0x32')][_0x052b('0x19')]);_0x577d17['offset']=qs['offset'](_0x4690b8[_0x052b('0x32')][_0x052b('0x18')]);}return _0x2a2169[_0x052b('0x51')](_0x577d17);}})[_0x052b('0x21')](function(_0xdb6fe8){if(_0xdb6fe8){return _0xdb6fe8?{'count':_0x445c0,'rows':_0xdb6fe8}:null;}})['then'](respondWithResult(_0x48ef0a,null))[_0x052b('0x43')](handleError(_0x48ef0a,null));};exports[_0x052b('0x52')]=function(_0x423cfa,_0xddf303,_0x5e7c57){return db[_0x052b('0x40')][_0x052b('0x53')]({'where':{'id':_0x423cfa[_0x052b('0x45')]['id']}})['then'](handleEntityNotFound(_0xddf303,null))[_0x052b('0x21')](function(_0x4d2ced){if(_0x4d2ced){return db[_0x052b('0x54')][_0x052b('0x55')](function(_0x582d74){return db[_0x052b('0x40')]['destroy']({'where':{'IntervalId':_0x423cfa['params']['id']},'transaction':_0x582d74})[_0x052b('0x21')](function(_0xe860d2){var _0x1d11d5=_[_0x052b('0x2d')](_0x423cfa['body'],function(_0xc6fe5f){delete _0xc6fe5f['id'];_0xc6fe5f[_0x052b('0x56')]=_0x423cfa[_0x052b('0x45')]['id'];return _0xc6fe5f;});return db[_0x052b('0x40')][_0x052b('0x57')](_0x1d11d5,{'transaction':_0x582d74});});})[_0x052b('0x21')](function(){return db[_0x052b('0x40')]['findAll']({'where':{'IntervalId':_0x423cfa[_0x052b('0x45')]['id']}});});}})[_0x052b('0x21')](respondWithResult(_0xddf303,null))[_0x052b('0x43')](handleError(_0xddf303,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a724a5c..14b524a 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 _0x1400=['exports','define','tools_intervals','rewrite','string','interval','getIntervals','then','all','map','reduce','../../utils/iftime','iftime'];(function(_0x3e16fa,_0x43bc73){var _0x4b043b=function(_0xab73f6){while(--_0xab73f6){_0x3e16fa['push'](_0x3e16fa['shift']());}};_0x4b043b(++_0x43bc73);}(_0x1400,0x16a));var _0x0140=function(_0x2fb4fb,_0x13abdf){_0x2fb4fb=_0x2fb4fb-0x0;var _0x36e7d6=_0x1400[_0x2fb4fb];return _0x36e7d6;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x0140('0x0'))[_0x0140('0x1')];module[_0x0140('0x2')]=function(_0x13ca20){return _0x13ca20[_0x0140('0x3')]('Interval',attributes,{'tableName':_0x0140('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43077b){extensions[_0x0140('0x5')](_0x13ca20,_0x43077b);},'afterBulkCreate':function(_0xa3314b,_0x1dbe4e,_0x8f5038){_0x8f5038();extensions[_0x0140('0x5')](_0x13ca20,_0xa3314b[0x0]);},'afterUpdate':function(_0x4777ba){extensions['rewrite'](_0x13ca20,_0x4777ba);},'afterDestroy':function(_0x30184a){extensions[_0x0140('0x5')](_0x13ca20,_0x30184a);}},'instanceMethods':{'ifTime':function(_0x3ed47=undefined,_0x3d82c9=new Date()){if(typeof this['interval']===_0x0140('0x6')){return iftime(this[_0x0140('0x7')],_0x3ed47,_0x3d82c9);}else{return this[_0x0140('0x8')]()[_0x0140('0x9')](function(_0x2e6f48){return Promise[_0x0140('0xa')](_0x2e6f48[_0x0140('0xb')](function(_0x54e481){return _0x54e481['ifTime'](_0x3ed47,_0x3d82c9);}));})['then'](function(_0x40394e){return _0x40394e[_0x0140('0xc')](function(_0x2c666d,_0x4efe56){return _0x2c666d||_0x4efe56;},![]);});}}}});}; \ No newline at end of file +var _0xbaa4=['reduce','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','interval','getIntervals','all','map','ifTime','then'];(function(_0x585b83,_0x25d403){var _0x2faa24=function(_0x2c756c){while(--_0x2c756c){_0x585b83['push'](_0x585b83['shift']());}};_0x2faa24(++_0x25d403);}(_0xbaa4,0x1ae));var _0x4baa=function(_0x561adb,_0x275786){_0x561adb=_0x561adb-0x0;var _0xed3d4e=_0xbaa4[_0x561adb];return _0xed3d4e;};'use strict';var attributes=require(_0x4baa('0x0'));var extensions=require(_0x4baa('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x4baa('0x2')]=function(_0x2b07ec){return _0x2b07ec['define'](_0x4baa('0x3'),attributes,{'tableName':_0x4baa('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e133e){extensions[_0x4baa('0x5')](_0x2b07ec,_0x4e133e);},'afterBulkCreate':function(_0x4cb1a5,_0x52b2b8,_0x1315b9){_0x1315b9();extensions['rewrite'](_0x2b07ec,_0x4cb1a5[0x0]);},'afterUpdate':function(_0x10aa9e){extensions[_0x4baa('0x5')](_0x2b07ec,_0x10aa9e);},'afterDestroy':function(_0x352082){extensions[_0x4baa('0x5')](_0x2b07ec,_0x352082);}},'instanceMethods':{'ifTime':function(_0x3e4235=undefined,_0x2f8f04=new Date()){if(typeof this[_0x4baa('0x6')]==='string'){return iftime(this['interval'],_0x3e4235,_0x2f8f04);}else{return this[_0x4baa('0x7')]()['then'](function(_0x23dc11){return Promise[_0x4baa('0x8')](_0x23dc11[_0x4baa('0x9')](function(_0x14e4dc){return _0x14e4dc[_0x4baa('0xa')](_0x3e4235,_0x2f8f04);}));})[_0x4baa('0xb')](function(_0x1d96e9){return _0x1d96e9[_0x4baa('0xc')](function(_0x21f4ec,_0x2a5f58){return _0x21f4ec||_0x2a5f58;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 30463a4..ca9c154 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 _0x58f1=['ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','isArray','reduce','lodash','util','../../mysqldb','iftime','rpc','GetInterval','Interval','options','where','attributes','limit','map','include','model','info','debug','catch','error','message','ShowInterval','find','raw','then','stringify','findAll','all'];(function(_0xc1f5e2,_0x7c879e){var _0xbec549=function(_0x3cf1ed){while(--_0x3cf1ed){_0xc1f5e2['push'](_0xc1f5e2['shift']());}};_0xbec549(++_0x7c879e);}(_0x58f1,0x1ca));var _0x158f=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x58f1[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x158f('0x0'));var util=require(_0x158f('0x1'));var db=require(_0x158f('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x158f('0x3')];var logger=require('../../config/logger')(_0x158f('0x4'));exports[_0x158f('0x5')]=function(_0xf24184){var _0x52b597=this;return new Promise(function(_0xe5ab79,_0x247f8b){return db[_0x158f('0x6')]['findAll']({'raw':_0xf24184[_0x158f('0x7')]?_0xf24184[_0x158f('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0xf24184[_0x158f('0x7')]?_0xf24184[_0x158f('0x7')][_0x158f('0x8')]||null:null,'attributes':_0xf24184['options']?_0xf24184[_0x158f('0x7')][_0x158f('0x9')]||null:null,'limit':_0xf24184['options']?_0xf24184[_0x158f('0x7')][_0x158f('0xa')]||null:null,'include':_0xf24184[_0x158f('0x7')]?_0xf24184[_0x158f('0x7')]['include']?_[_0x158f('0xb')](_0xf24184[_0x158f('0x7')][_0x158f('0xc')],function(_0x52de83){return{'model':db[_0x52de83[_0x158f('0xd')]],'as':_0x52de83['as'],'attributes':_0x52de83[_0x158f('0x9')],'include':_0x52de83[_0x158f('0xc')]?_['map'](_0x52de83[_0x158f('0xc')],function(_0x5f2c67){return{'model':db[_0x5f2c67[_0x158f('0xd')]],'as':_0x5f2c67['as'],'attributes':_0x5f2c67[_0x158f('0x9')],'include':_0x5f2c67['include']?_[_0x158f('0xb')](_0x5f2c67[_0x158f('0xc')],function(_0x51d175){return{'model':db[_0x51d175[_0x158f('0xd')]],'as':_0x51d175['as'],'attributes':_0x51d175[_0x158f('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x199e75){logger[_0x158f('0xe')](_0x158f('0x5'),_0xf24184);logger[_0x158f('0xf')](_0x158f('0x5'),_0xf24184,JSON['stringify'](_0x199e75));_0xe5ab79(_0x199e75);})[_0x158f('0x10')](function(_0x57bd57){logger[_0x158f('0x11')](_0x158f('0x5'),_0x57bd57[_0x158f('0x12')],_0xf24184);_0x247f8b(_0x52b597[_0x158f('0x11')](0x1f4,_0x57bd57[_0x158f('0x12')]));});});};exports[_0x158f('0x13')]=function(_0x3b2d26){var _0x1d78d7=this;return new Promise(function(_0x5ca96a,_0x3c7fc0){return db['Interval'][_0x158f('0x14')]({'raw':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0x15')]===undefined?!![]:![]:!![],'where':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0x8')]||null:null,'attributes':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0x9')]||null:null,'include':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0xc')]?_[_0x158f('0xb')](_0x3b2d26[_0x158f('0x7')][_0x158f('0xc')],function(_0x52a4dc){return{'model':db[_0x52a4dc[_0x158f('0xd')]],'as':_0x52a4dc['as'],'attributes':_0x52a4dc[_0x158f('0x9')],'include':_0x52a4dc[_0x158f('0xc')]?_['map'](_0x52a4dc[_0x158f('0xc')],function(_0x4862c8){return{'model':db[_0x4862c8[_0x158f('0xd')]],'as':_0x4862c8['as'],'attributes':_0x4862c8[_0x158f('0x9')],'include':_0x4862c8[_0x158f('0xc')]?_[_0x158f('0xb')](_0x4862c8[_0x158f('0xc')],function(_0x5a7297){return{'model':db[_0x5a7297[_0x158f('0xd')]],'as':_0x5a7297['as'],'attributes':_0x5a7297[_0x158f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x158f('0x16')](function(_0x5b3fc5){logger['info'](_0x158f('0x13'),_0x3b2d26);logger[_0x158f('0xf')](_0x158f('0x13'),_0x3b2d26,JSON[_0x158f('0x17')](_0x5b3fc5));_0x5ca96a(_0x5b3fc5);})[_0x158f('0x10')](function(_0x2f7abb){logger[_0x158f('0x11')]('ShowInterval',_0x2f7abb[_0x158f('0x12')],_0x3b2d26);_0x3c7fc0(_0x1d78d7[_0x158f('0x11')](0x1f4,_0x2f7abb[_0x158f('0x12')]));});});};function checkArrayOfIntervals(_0x1cfc33,_0x2d6553){var _0x5b89e6=[];return db[_0x158f('0x6')][_0x158f('0x18')]({'where':{'id':_0x1cfc33}})[_0x158f('0x16')](function(_0x5af328){_0x5b89e6=_0x5af328;return Promise[_0x158f('0x19')](_0x5b89e6[_0x158f('0xb')](function(_0x5c39fb){return _0x5c39fb[_0x158f('0x1a')](_0x2d6553);}));})[_0x158f('0x16')](function(_0x4e6d0f){var _0x4e5520=_0x4e6d0f['reduce'](function(_0x371894,_0x5114b7){return _0x371894||_0x5114b7;},![]);logger[_0x158f('0xe')](util[_0x158f('0x1b')](_0x158f('0x1c'),_0x5b89e6[_0x158f('0xb')](function(_0x325ad9){return _0x325ad9['name'];})['join'](',\x20'),_0x5b89e6['map'](function(_0x55e388){return _0x55e388['id'];})[_0x158f('0x1d')](',\x20')));return _0x4e5520;});}function checkSingleInterval(_0x22593d,_0x1b99e1){return db[_0x158f('0x6')][_0x158f('0x1e')](_0x22593d)['then'](function(_0x26e8bb){if(_0x26e8bb){logger[_0x158f('0xe')](util['format'](_0x158f('0x1f'),_0x26e8bb[_0x158f('0x20')],_0x26e8bb['id']));return _0x26e8bb[_0x158f('0x1a')](_0x1b99e1);}});}exports['IntervalIftime']=function(_0x574aa7){var _0x584501=_0x574aa7[_0x158f('0x21')];var _0xdc22e0=Array['isArray'](_0x574aa7[_0x158f('0x22')])?_0x574aa7[_0x158f('0x22')]:typeof _0x574aa7['intervals']==='string'?[_0x574aa7[_0x158f('0x22')]]:[];var _0x55a8dc=_0x574aa7[_0x158f('0x23')]||undefined;var _0x299adb=![];if(_0xdc22e0['length']){logger[_0x158f('0xe')](util[_0x158f('0x1b')](_0x158f('0x24'),_0xdc22e0[_0x158f('0x1d')](';\x20')));}if(_0x55a8dc){logger[_0x158f('0xe')](util[_0x158f('0x1b')](_0x158f('0x25'),_0x55a8dc));}logger['debug'](_0x158f('0x26'),_0x299adb);logger[_0x158f('0x27')](_0x158f('0x28'),_0x574aa7);return Promise[_0x158f('0x29')]()[_0x158f('0x16')](function(){if(Array[_0x158f('0x2a')](_0x584501)){return checkArrayOfIntervals(_0x584501,_0x55a8dc);}else if(_0x584501){return checkSingleInterval(_0x584501,_0x55a8dc);}})[_0x158f('0x16')](function(_0x52cb92){var _0x16844d=_0xdc22e0[_0x158f('0x2b')](function(_0x1388fb,_0x116eea){return _0x1388fb||iftime(_0x116eea,_0x55a8dc);},![]);_0x299adb=_0x52cb92||_0x16844d;return _0x299adb;})[_0x158f('0x10')](function(_0xc6573){logger[_0x158f('0x11')](_0x158f('0x28'),_0x574aa7,_0xc6573);throw this[_0x158f('0x11')](0x1f4,_0xc6573['message']);});}; \ No newline at end of file +var _0x9069=['intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','isArray','lodash','util','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowInterval','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9069,0x126));var _0x9906=function(_0x13a83f,_0x5c285e){_0x13a83f=_0x13a83f-0x0;var _0x1e0b86=_0x9069[_0x13a83f];return _0x1e0b86;};'use strict';var _=require(_0x9906('0x0'));var util=require(_0x9906('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')[_0x9906('0x2')];var logger=require(_0x9906('0x3'))(_0x9906('0x4'));exports[_0x9906('0x5')]=function(_0x1dd51e){var _0x8979ee=this;return new Promise(function(_0x1b75f2,_0x307d9e){return db[_0x9906('0x6')][_0x9906('0x7')]({'raw':_0x1dd51e[_0x9906('0x8')]?_0x1dd51e[_0x9906('0x8')][_0x9906('0x9')]===undefined?!![]:![]:!![],'where':_0x1dd51e['options']?_0x1dd51e[_0x9906('0x8')][_0x9906('0xa')]||null:null,'attributes':_0x1dd51e[_0x9906('0x8')]?_0x1dd51e[_0x9906('0x8')][_0x9906('0xb')]||null:null,'limit':_0x1dd51e[_0x9906('0x8')]?_0x1dd51e['options']['limit']||null:null,'include':_0x1dd51e[_0x9906('0x8')]?_0x1dd51e[_0x9906('0x8')][_0x9906('0xc')]?_[_0x9906('0xd')](_0x1dd51e[_0x9906('0x8')]['include'],function(_0x3b871d){return{'model':db[_0x3b871d[_0x9906('0xe')]],'as':_0x3b871d['as'],'attributes':_0x3b871d[_0x9906('0xb')],'include':_0x3b871d['include']?_['map'](_0x3b871d['include'],function(_0xa62934){return{'model':db[_0xa62934[_0x9906('0xe')]],'as':_0xa62934['as'],'attributes':_0xa62934[_0x9906('0xb')],'include':_0xa62934[_0x9906('0xc')]?_['map'](_0xa62934[_0x9906('0xc')],function(_0x1d3cbd){return{'model':db[_0x1d3cbd['model']],'as':_0x1d3cbd['as'],'attributes':_0x1d3cbd[_0x9906('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9906('0xf')](function(_0xfda529){logger[_0x9906('0x10')](_0x9906('0x5'),_0x1dd51e);logger[_0x9906('0x11')](_0x9906('0x5'),_0x1dd51e,JSON[_0x9906('0x12')](_0xfda529));_0x1b75f2(_0xfda529);})[_0x9906('0x13')](function(_0x922c1e){logger[_0x9906('0x14')](_0x9906('0x5'),_0x922c1e[_0x9906('0x15')],_0x1dd51e);_0x307d9e(_0x8979ee['error'](0x1f4,_0x922c1e[_0x9906('0x15')]));});});};exports['ShowInterval']=function(_0x5e790f){var _0x7b7f86=this;return new Promise(function(_0x19dae9,_0x3c329d){return db[_0x9906('0x6')]['find']({'raw':_0x5e790f[_0x9906('0x8')]?_0x5e790f['options'][_0x9906('0x9')]===undefined?!![]:![]:!![],'where':_0x5e790f[_0x9906('0x8')]?_0x5e790f['options'][_0x9906('0xa')]||null:null,'attributes':_0x5e790f[_0x9906('0x8')]?_0x5e790f[_0x9906('0x8')][_0x9906('0xb')]||null:null,'include':_0x5e790f[_0x9906('0x8')]?_0x5e790f[_0x9906('0x8')][_0x9906('0xc')]?_[_0x9906('0xd')](_0x5e790f['options'][_0x9906('0xc')],function(_0x49fa35){return{'model':db[_0x49fa35['model']],'as':_0x49fa35['as'],'attributes':_0x49fa35[_0x9906('0xb')],'include':_0x49fa35['include']?_[_0x9906('0xd')](_0x49fa35[_0x9906('0xc')],function(_0x20781e){return{'model':db[_0x20781e[_0x9906('0xe')]],'as':_0x20781e['as'],'attributes':_0x20781e['attributes'],'include':_0x20781e[_0x9906('0xc')]?_[_0x9906('0xd')](_0x20781e[_0x9906('0xc')],function(_0x38ef22){return{'model':db[_0x38ef22[_0x9906('0xe')]],'as':_0x38ef22['as'],'attributes':_0x38ef22[_0x9906('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9906('0xf')](function(_0x5a4e47){logger[_0x9906('0x10')](_0x9906('0x16'),_0x5e790f);logger[_0x9906('0x11')](_0x9906('0x16'),_0x5e790f,JSON[_0x9906('0x12')](_0x5a4e47));_0x19dae9(_0x5a4e47);})[_0x9906('0x13')](function(_0x2da540){logger[_0x9906('0x14')](_0x9906('0x16'),_0x2da540[_0x9906('0x15')],_0x5e790f);_0x3c329d(_0x7b7f86[_0x9906('0x14')](0x1f4,_0x2da540['message']));});});};function checkArrayOfIntervals(_0xdfa279,_0x479263){var _0x551aa1=[];return db[_0x9906('0x6')][_0x9906('0x7')]({'where':{'id':_0xdfa279}})[_0x9906('0xf')](function(_0x1d42e3){_0x551aa1=_0x1d42e3;return Promise[_0x9906('0x17')](_0x551aa1[_0x9906('0xd')](function(_0x9ed9f1){return _0x9ed9f1[_0x9906('0x18')](_0x479263);}));})[_0x9906('0xf')](function(_0x2a00e4){var _0x97563a=_0x2a00e4[_0x9906('0x19')](function(_0x840589,_0x1341a9){return _0x840589||_0x1341a9;},![]);logger[_0x9906('0x10')](util[_0x9906('0x1a')](_0x9906('0x1b'),_0x551aa1[_0x9906('0xd')](function(_0x206aaf){return _0x206aaf[_0x9906('0x1c')];})['join'](',\x20'),_0x551aa1['map'](function(_0x2e346e){return _0x2e346e['id'];})[_0x9906('0x1d')](',\x20')));return _0x97563a;});}function checkSingleInterval(_0x4cb994,_0x53f35c){return db[_0x9906('0x6')][_0x9906('0x1e')](_0x4cb994)[_0x9906('0xf')](function(_0x4f0462){if(_0x4f0462){logger[_0x9906('0x10')](util['format'](_0x9906('0x1f'),_0x4f0462[_0x9906('0x1c')],_0x4f0462['id']));return _0x4f0462[_0x9906('0x18')](_0x53f35c);}});}exports[_0x9906('0x20')]=function(_0x25e063){var _0x1cace7=_0x25e063[_0x9906('0x21')];var _0x95b72f=Array['isArray'](_0x25e063[_0x9906('0x22')])?_0x25e063[_0x9906('0x22')]:typeof _0x25e063[_0x9906('0x22')]==='string'?[_0x25e063[_0x9906('0x22')]]:[];var _0x45f798=_0x25e063[_0x9906('0x23')]||undefined;var _0x338756=![];if(_0x95b72f['length']){logger[_0x9906('0x10')](util[_0x9906('0x1a')](_0x9906('0x24'),_0x95b72f[_0x9906('0x1d')](';\x20')));}if(_0x45f798){logger[_0x9906('0x10')](util[_0x9906('0x1a')](_0x9906('0x25'),_0x45f798));}logger[_0x9906('0x11')](_0x9906('0x26'),_0x338756);logger[_0x9906('0x27')]('IntervalIftime',_0x25e063);return Promise['resolve']()[_0x9906('0xf')](function(){if(Array[_0x9906('0x28')](_0x1cace7)){return checkArrayOfIntervals(_0x1cace7,_0x45f798);}else if(_0x1cace7){return checkSingleInterval(_0x1cace7,_0x45f798);}})['then'](function(_0x50527f){var _0x3f2da1=_0x95b72f[_0x9906('0x19')](function(_0x4a0c4b,_0x3abe8d){return _0x4a0c4b||iftime(_0x3abe8d,_0x45f798);},![]);_0x338756=_0x50527f||_0x3f2da1;return _0x338756;})[_0x9906('0x13')](function(_0xf81eab){logger[_0x9906('0x14')](_0x9906('0x20'),_0x25e063,_0xf81eab);throw this['error'](0x1f4,_0xf81eab['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index fbeb78b..7d59a9f 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x56aa90,_0x3e3ce5){var _0x224dae=function(_0x455ab3){while(--_0x455ab3){_0x56aa90['push'](_0x56aa90['shift']());}};_0x224dae(++_0x3e3ce5);}(_0x2ef3,0xba));var _0x32ef=function(_0x50d683,_0xaea8ad){_0x50d683=_0x50d683-0x0;var _0x2fb58f=_0x2ef3[_0x50d683];return _0x2fb58f;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e014faa..d757baf 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 _0x8a3a=['remoteAddress','socket','connection','bluebird','https','../../config/logger','api','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers'];(function(_0x34ef54,_0x39404f){var _0x53823a=function(_0x405c40){while(--_0x405c40){_0x34ef54['push'](_0x34ef54['shift']());}};_0x53823a(++_0x39404f);}(_0x8a3a,0xbb));var _0xa8a3=function(_0x158074,_0x2224cb){_0x158074=_0x158074-0x0;var _0x73f669=_0x8a3a[_0x158074];return _0x73f669;};'use strict';var BPromise=require(_0xa8a3('0x0'));var https=require(_0xa8a3('0x1'));var logger=require(_0xa8a3('0x2'))(_0xa8a3('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5d8e23,_0x1ec0c2){var _0xf0451e={'fields':{'project':{'key':_0x5d8e23[_0xa8a3('0x4')]||'MOTGUI'},'summary':(_0x5d8e23[_0xa8a3('0x5')]||_0xa8a3('0x6'))+_0xa8a3('0x7')+_0x5d8e23['ip'],'description':_0x5d8e23[_0xa8a3('0x8')]||JSON[_0xa8a3('0x9')](_0x5d8e23),'issuetype':{'name':_0x5d8e23[_0xa8a3('0xa')]||_0xa8a3('0xb')}}};_0xf0451e[_0xa8a3('0xc')][_0xa8a3('0xd')]=_0x5d8e23['email'];_0xf0451e[_0xa8a3('0xc')]['customfield_11501']=_0x5d8e23[_0xa8a3('0xe')];_0xf0451e[_0xa8a3('0xc')][_0xa8a3('0xf')]=_0x5d8e23[_0xa8a3('0x10')];_0xf0451e['fields'][_0xa8a3('0x11')]=_0x5d8e23[_0xa8a3('0x12')];_0xf0451e[_0xa8a3('0xc')][_0xa8a3('0x13')]=_0x5d8e23[_0xa8a3('0x14')];_0xf0451e['fields'][_0xa8a3('0x15')]=_0x5d8e23['ip'];var _0x254440={'host':_0xa8a3('0x16'),'port':0x1bb,'path':_0xa8a3('0x17'),'method':_0xa8a3('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xa8a3('0x19'),'Authorization':_0xa8a3('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xa8a3('0x1b')](_0xa8a3('0x1c'))}};var _0x78fb3f=JSON[_0xa8a3('0x9')](_0xf0451e);var _0x35f028=https[_0xa8a3('0x1d')](_0x254440,function(_0x3c6f51){_0x3c6f51[_0xa8a3('0x1e')](_0xa8a3('0x1f'));var _0x5d3904='';_0x3c6f51['on'](_0xa8a3('0x20'),function(_0x171361){_0x5d3904+=_0x171361;});_0x3c6f51['on']('end',function(){if(_0x1ec0c2){return _0x1ec0c2[_0xa8a3('0x21')](_0x3c6f51[_0xa8a3('0x22')])['json'](JSON[_0xa8a3('0x23')](_0x5d3904));}});});_0x35f028['on']('error',function(_0x46474b){if(_0x1ec0c2){return _0x1ec0c2[_0xa8a3('0x21')](0x1f4)[_0xa8a3('0x24')]({'errors':[{'message':_0xa8a3('0x25'),'type':_0xa8a3('0x26')}]});}});_0x35f028['write'](_0x78fb3f);_0x35f028['end']();}exports[_0xa8a3('0x27')]=openIssue;exports[_0xa8a3('0x28')]=function(_0x30b7bc,_0x1ee517){_0x30b7bc[_0xa8a3('0x29')]['ip']=_0x30b7bc[_0xa8a3('0x2a')]['x-forwarded-for']||_0x30b7bc['connection'][_0xa8a3('0x2b')]||_0x30b7bc[_0xa8a3('0x2c')]['remoteAddress']||_0x30b7bc[_0xa8a3('0x2d')][_0xa8a3('0x2c')]['remoteAddress'];return openIssue(_0x30b7bc['body'],_0x1ee517);}; \ No newline at end of file +var _0xaf7d=['MOTGUI','Report','\x20from\x20','stringify','issuetype','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key'];(function(_0x2ac772,_0x48909a){var _0x48e06a=function(_0x2a6710){while(--_0x2a6710){_0x2ac772['push'](_0x2ac772['shift']());}};_0x48e06a(++_0x48909a);}(_0xaf7d,0x84));var _0xdaf7=function(_0x39de8e,_0x1fdda2){_0x39de8e=_0x39de8e-0x0;var _0x57fe58=_0xaf7d[_0x39de8e];return _0x57fe58;};'use strict';var BPromise=require(_0xdaf7('0x0'));var https=require(_0xdaf7('0x1'));var logger=require('../../config/logger')(_0xdaf7('0x2'));var USERNAME=_0xdaf7('0x3');var PASSWORD=_0xdaf7('0x4');function openIssue(_0x192273,_0x1d46ec){var _0x5f1bf7={'fields':{'project':{'key':_0x192273[_0xdaf7('0x5')]||_0xdaf7('0x6')},'summary':(_0x192273['summary']||_0xdaf7('0x7'))+_0xdaf7('0x8')+_0x192273['ip'],'description':_0x192273['description']||JSON[_0xdaf7('0x9')](_0x192273),'issuetype':{'name':_0x192273[_0xdaf7('0xa')]||'Bug'}}};_0x5f1bf7[_0xdaf7('0xb')]['customfield_11500']=_0x192273[_0xdaf7('0xc')];_0x5f1bf7[_0xdaf7('0xb')][_0xdaf7('0xd')]=_0x192273[_0xdaf7('0xe')];_0x5f1bf7[_0xdaf7('0xb')][_0xdaf7('0xf')]=_0x192273[_0xdaf7('0x10')];_0x5f1bf7[_0xdaf7('0xb')][_0xdaf7('0x11')]=_0x192273[_0xdaf7('0x12')];_0x5f1bf7['fields'][_0xdaf7('0x13')]=_0x192273['reason'];_0x5f1bf7[_0xdaf7('0xb')]['customfield_10102']=_0x192273['ip'];var _0x20d8f4={'host':_0xdaf7('0x14'),'port':0x1bb,'path':_0xdaf7('0x15'),'method':_0xdaf7('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xdaf7('0x17'),'Authorization':_0xdaf7('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xdaf7('0x19')](_0xdaf7('0x1a'))}};var _0x2c7588=JSON[_0xdaf7('0x9')](_0x5f1bf7);var _0x2ef269=https['request'](_0x20d8f4,function(_0xa83c39){_0xa83c39[_0xdaf7('0x1b')](_0xdaf7('0x1c'));var _0x14da05='';_0xa83c39['on'](_0xdaf7('0x1d'),function(_0x3854ee){_0x14da05+=_0x3854ee;});_0xa83c39['on'](_0xdaf7('0x1e'),function(){if(_0x1d46ec){return _0x1d46ec[_0xdaf7('0x1f')](_0xa83c39[_0xdaf7('0x20')])[_0xdaf7('0x21')](JSON[_0xdaf7('0x22')](_0x14da05));}});});_0x2ef269['on'](_0xdaf7('0x23'),function(_0x2b5a25){if(_0x1d46ec){return _0x1d46ec[_0xdaf7('0x1f')](0x1f4)[_0xdaf7('0x21')]({'errors':[{'message':_0xdaf7('0x24'),'type':_0xdaf7('0x25')}]});}});_0x2ef269[_0xdaf7('0x26')](_0x2c7588);_0x2ef269['end']();}exports[_0xdaf7('0x27')]=openIssue;exports[_0xdaf7('0x28')]=function(_0x436054,_0x4de3c4){_0x436054['body']['ip']=_0x436054[_0xdaf7('0x29')][_0xdaf7('0x2a')]||_0x436054[_0xdaf7('0x2b')][_0xdaf7('0x2c')]||_0x436054[_0xdaf7('0x2d')][_0xdaf7('0x2c')]||_0x436054[_0xdaf7('0x2b')][_0xdaf7('0x2d')][_0xdaf7('0x2c')];return openIssue(_0x436054['body'],_0x4de3c4);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7afbaa1..89d7a8c 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 _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0xd55486,_0x5469ed){var _0x2a2e58=function(_0x4c9f33){while(--_0x4c9f33){_0xd55486['push'](_0xd55486['shift']());}};_0x2a2e58(++_0x5469ed);}(_0x6324,0x142));var _0x4632=function(_0xa6df52,_0x1b8584){_0xa6df52=_0xa6df52-0x0;var _0x5edd57=_0x6324[_0xa6df52];return _0x5edd57;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('0x11')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 83cb610..6e2a4a8 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x333174,_0x20893e){_0x333174=_0x333174-0x0;var _0x16470e=_0x7a54[_0x333174];return _0x16470e;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7a54,0x106));var _0x47a5=function(_0x1b8818,_0x346ad3){_0x1b8818=_0x1b8818-0x0;var _0x306982=_0x7a54[_0x1b8818];return _0x306982;};'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 1e6aa0f..51d7614 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 _0x6eed=['stack','name','index','map','JscriptyAnswerReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','end','error'];(function(_0x568e41,_0x5da0f8){var _0x2dbfde=function(_0x1be9aa){while(--_0x1be9aa){_0x568e41['push'](_0x568e41['shift']());}};_0x2dbfde(++_0x5da0f8);}(_0x6eed,0xff));var _0xd6ee=function(_0x4073c8,_0x119fb4){_0x4073c8=_0x4073c8-0x0;var _0x21ef99=_0x6eed[_0x4073c8];return _0x21ef99;};'use strict';var emlformat=require(_0xd6ee('0x0'));var rimraf=require(_0xd6ee('0x1'));var zipdir=require(_0xd6ee('0x2'));var jsonpatch=require(_0xd6ee('0x3'));var rp=require(_0xd6ee('0x4'));var moment=require('moment');var BPromise=require(_0xd6ee('0x5'));var Mustache=require(_0xd6ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd6ee('0x7'));var csv=require(_0xd6ee('0x8'));var ejs=require(_0xd6ee('0x9'));var fs=require('fs');var fs_extra=require(_0xd6ee('0xa'));var _=require(_0xd6ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6ee('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6ee('0xd'));var Redis=require(_0xd6ee('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd6ee('0xf'));var as=require(_0xd6ee('0x10'));var hardwareService=require(_0xd6ee('0x11'));var logger=require(_0xd6ee('0x12'))('api');var utils=require(_0xd6ee('0x13'));var config=require(_0xd6ee('0x14'));var licenseUtil=require(_0xd6ee('0x15'));var db=require(_0xd6ee('0x16'))['db'];function respondWithStatusCode(_0x268dd1,_0x3fd1df){_0x3fd1df=_0x3fd1df||0xcc;return function(_0x48be63){if(_0x48be63){return _0x268dd1[_0xd6ee('0x17')](_0x3fd1df);}return _0x268dd1[_0xd6ee('0x18')](_0x3fd1df)['end']();};}function respondWithResult(_0x369b4a,_0x15918d){_0x15918d=_0x15918d||0xc8;return function(_0x2bf3b2){if(_0x2bf3b2){return _0x369b4a[_0xd6ee('0x18')](_0x15918d)[_0xd6ee('0x19')](_0x2bf3b2);}};}function respondWithFilteredResult(_0xe66d0d,_0x49bafc){return function(_0x1c2e51){if(_0x1c2e51){var _0xb99b70=typeof _0x49bafc[_0xd6ee('0x1a')]==='undefined'&&typeof _0x49bafc[_0xd6ee('0x1b')]==='undefined';var _0x3a82bf=_0x1c2e51[_0xd6ee('0x1c')];var _0x81d533=_0xb99b70?0x0:_0x49bafc['offset'];var _0x8a2718=_0xb99b70?_0x1c2e51['count']:_0x49bafc[_0xd6ee('0x1a')]+_0x49bafc['limit'];var _0x31ae0f;if(_0x8a2718>=_0x3a82bf){_0x8a2718=_0x3a82bf;_0x31ae0f=0xc8;}else{_0x31ae0f=0xce;}_0xe66d0d[_0xd6ee('0x18')](_0x31ae0f);return _0xe66d0d[_0xd6ee('0x1d')](_0xd6ee('0x1e'),_0x81d533+'-'+_0x8a2718+'/'+_0x3a82bf)[_0xd6ee('0x19')](_0x1c2e51);}return null;};}function patchUpdates(_0x4b33f1){return function(_0xe2f8c4){try{jsonpatch['apply'](_0xe2f8c4,_0x4b33f1,!![]);}catch(_0x17e011){return BPromise[_0xd6ee('0x1f')](_0x17e011);}return _0xe2f8c4[_0xd6ee('0x20')]();};}function saveUpdates(_0x1abedc,_0xec9287){return function(_0x48e6ad){if(_0x48e6ad){return _0x48e6ad['update'](_0x1abedc)[_0xd6ee('0x21')](function(_0x511c18){return _0x511c18;});}return null;};}function removeEntity(_0x2bae66,_0x519373){return function(_0x391844){if(_0x391844){return _0x391844[_0xd6ee('0x22')]()[_0xd6ee('0x21')](function(){_0x2bae66[_0xd6ee('0x18')](0xcc)[_0xd6ee('0x23')]();});}};}function handleEntityNotFound(_0x5476f2,_0x4b1926){return function(_0x2f438c){if(!_0x2f438c){_0x5476f2[_0xd6ee('0x17')](0x194);}return _0x2f438c;};}function handleError(_0x4edb7d,_0x2c9b30){_0x2c9b30=_0x2c9b30||0x1f4;return function(_0xa1e700){logger[_0xd6ee('0x24')](_0xa1e700[_0xd6ee('0x25')]);if(_0xa1e700[_0xd6ee('0x26')]){delete _0xa1e700[_0xd6ee('0x26')];}_0x4edb7d[_0xd6ee('0x18')](_0x2c9b30)['send'](_0xa1e700);};}exports[_0xd6ee('0x27')]=function(_0x124ab7,_0x50b786){var _0x5bcdd6={},_0x1578b3={},_0x4580a7={'count':0x0,'rows':[]};var _0xddca=_[_0xd6ee('0x28')](db[_0xd6ee('0x29')]['rawAttributes'],function(_0x414015){return{'name':_0x414015[_0xd6ee('0x2a')],'type':_0x414015[_0xd6ee('0x2b')]['key']};});_0x1578b3[_0xd6ee('0x2c')]=_[_0xd6ee('0x28')](_0xddca,_0xd6ee('0x26'));_0x1578b3['query']=_[_0xd6ee('0x2d')](_0x124ab7[_0xd6ee('0x2e')]);_0x1578b3[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],_0x1578b3[_0xd6ee('0x2e')]);_0x5bcdd6['attributes']=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x124ab7[_0xd6ee('0x2e')]['fields']));_0x5bcdd6[_0xd6ee('0x32')]=_0x5bcdd6[_0xd6ee('0x32')][_0xd6ee('0x33')]?_0x5bcdd6['attributes']:_0x1578b3['model'];if(!_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x34')](_0xd6ee('0x35'))){_0x5bcdd6[_0xd6ee('0x1b')]=qs[_0xd6ee('0x1b')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1b')]);_0x5bcdd6[_0xd6ee('0x1a')]=qs[_0xd6ee('0x1a')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1a')]);}_0x5bcdd6[_0xd6ee('0x36')]=qs[_0xd6ee('0x37')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x37')]);_0x5bcdd6['where']=qs[_0xd6ee('0x2f')](_[_0xd6ee('0x38')](_0x124ab7[_0xd6ee('0x2e')],_0x1578b3['filters']),_0xddca);if(_0x124ab7['query']['filter']){_0x5bcdd6['where']=_[_0xd6ee('0x39')](_0x5bcdd6[_0xd6ee('0x3a')],{'$or':_[_0xd6ee('0x28')](_0xddca,function(_0x2a6d2f){if(_0x2a6d2f[_0xd6ee('0x2b')]!==_0xd6ee('0x3b')){var _0x2c975a={};_0x2c975a[_0x2a6d2f['name']]={'$like':'%'+_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x3c')]+'%'};return _0x2c975a;}})});}_0x5bcdd6=_[_0xd6ee('0x39')]({},_0x5bcdd6,_0x124ab7[_0xd6ee('0x3d')]);var _0x407748={'where':_0x5bcdd6[_0xd6ee('0x3a')]};return db[_0xd6ee('0x29')][_0xd6ee('0x1c')](_0x407748)[_0xd6ee('0x21')](function(_0x24a7cb){_0x4580a7['count']=_0x24a7cb;if(_0x124ab7['query']['includeAll']){_0x5bcdd6[_0xd6ee('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd6ee('0x3f')](_0x5bcdd6);})[_0xd6ee('0x21')](function(_0x96aa7f){_0x4580a7[_0xd6ee('0x40')]=_0x96aa7f;return _0x4580a7;})[_0xd6ee('0x21')](respondWithFilteredResult(_0x50b786,_0x5bcdd6))['catch'](handleError(_0x50b786,null));};exports['show']=function(_0x4db1e9,_0x557936){var _0x3337a1={'raw':!![],'where':{'id':_0x4db1e9[_0xd6ee('0x41')]['id']}},_0xf38fc4={};_0xf38fc4[_0xd6ee('0x2c')]=_[_0xd6ee('0x2d')](db[_0xd6ee('0x29')][_0xd6ee('0x42')]);_0xf38fc4[_0xd6ee('0x2e')]=_[_0xd6ee('0x2d')](_0x4db1e9['query']);_0xf38fc4[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0xf38fc4['model'],_0xf38fc4[_0xd6ee('0x2e')]);_0x3337a1['attributes']=_['intersection'](_0xf38fc4[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x4db1e9[_0xd6ee('0x2e')][_0xd6ee('0x31')]));_0x3337a1[_0xd6ee('0x32')]=_0x3337a1[_0xd6ee('0x32')]['length']?_0x3337a1['attributes']:_0xf38fc4[_0xd6ee('0x2c')];if(_0x4db1e9[_0xd6ee('0x2e')]['includeAll']){_0x3337a1[_0xd6ee('0x3e')]=[{'all':!![]}];}_0x3337a1=_['merge']({},_0x3337a1,_0x4db1e9[_0xd6ee('0x3d')]);return db[_0xd6ee('0x29')][_0xd6ee('0x43')](_0x3337a1)[_0xd6ee('0x21')](handleEntityNotFound(_0x557936,null))[_0xd6ee('0x21')](respondWithResult(_0x557936,null))[_0xd6ee('0x44')](handleError(_0x557936,null));};exports[_0xd6ee('0x45')]=function(_0x1b02c4,_0x37c3ba){return db[_0xd6ee('0x29')][_0xd6ee('0x45')](_0x1b02c4['body'],{})[_0xd6ee('0x21')](respondWithResult(_0x37c3ba,0xc9))[_0xd6ee('0x44')](handleError(_0x37c3ba,null));};exports[_0xd6ee('0x46')]=function(_0x360e34,_0x418680){if(_0x360e34[_0xd6ee('0x47')]['id']){delete _0x360e34[_0xd6ee('0x47')]['id'];}return db[_0xd6ee('0x29')][_0xd6ee('0x43')]({'where':{'id':_0x360e34[_0xd6ee('0x41')]['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x418680,null))[_0xd6ee('0x21')](saveUpdates(_0x360e34['body'],null))[_0xd6ee('0x21')](respondWithResult(_0x418680,null))[_0xd6ee('0x44')](handleError(_0x418680,null));};exports[_0xd6ee('0x22')]=function(_0x52dfd3,_0x2f1bef){return db['JscriptyAnswerReport'][_0xd6ee('0x43')]({'where':{'id':_0x52dfd3['params']['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x2f1bef,null))[_0xd6ee('0x21')](removeEntity(_0x2f1bef,null))['catch'](handleError(_0x2f1bef,null));};exports[_0xd6ee('0x48')]=function(_0x164df4,_0xaef499){return db['JscriptyAnswerReport'][_0xd6ee('0x48')]()[_0xd6ee('0x21')](respondWithResult(_0xaef499,null))['catch'](handleError(_0xaef499,null));}; \ No newline at end of file +var _0x9206=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','JscriptyAnswerReport','fieldName','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel'];(function(_0x580dd5,_0xa6285b){var _0x129672=function(_0x2a5c9b){while(--_0x2a5c9b){_0x580dd5['push'](_0x580dd5['shift']());}};_0x129672(++_0xa6285b);}(_0x9206,0x176));var _0x6920=function(_0x219cfa,_0x8f8293){_0x219cfa=_0x219cfa-0x0;var _0x1965e0=_0x9206[_0x219cfa];return _0x1965e0;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];function respondWithStatusCode(_0x5ad438,_0x4f8430){_0x4f8430=_0x4f8430||0xcc;return function(_0x31730c){if(_0x31730c){return _0x5ad438[_0x6920('0x1a')](_0x4f8430);}return _0x5ad438['status'](_0x4f8430)[_0x6920('0x1b')]();};}function respondWithResult(_0xfa2823,_0x18140a){_0x18140a=_0x18140a||0xc8;return function(_0x2c3a35){if(_0x2c3a35){return _0xfa2823[_0x6920('0x1c')](_0x18140a)['json'](_0x2c3a35);}};}function respondWithFilteredResult(_0x338e5f,_0x20cdfb){return function(_0x15d8af){if(_0x15d8af){var _0xa64034=typeof _0x20cdfb[_0x6920('0x1d')]===_0x6920('0x1e')&&typeof _0x20cdfb[_0x6920('0x1f')]===_0x6920('0x1e');var _0x11ce91=_0x15d8af[_0x6920('0x20')];var _0x462500=_0xa64034?0x0:_0x20cdfb[_0x6920('0x1d')];var _0xc6e86b=_0xa64034?_0x15d8af[_0x6920('0x20')]:_0x20cdfb[_0x6920('0x1d')]+_0x20cdfb['limit'];var _0x3a0c0c;if(_0xc6e86b>=_0x11ce91){_0xc6e86b=_0x11ce91;_0x3a0c0c=0xc8;}else{_0x3a0c0c=0xce;}_0x338e5f[_0x6920('0x1c')](_0x3a0c0c);return _0x338e5f[_0x6920('0x21')](_0x6920('0x22'),_0x462500+'-'+_0xc6e86b+'/'+_0x11ce91)[_0x6920('0x23')](_0x15d8af);}return null;};}function patchUpdates(_0x16cb96){return function(_0x2cce0b){try{jsonpatch[_0x6920('0x24')](_0x2cce0b,_0x16cb96,!![]);}catch(_0xaf93ba){return BPromise[_0x6920('0x25')](_0xaf93ba);}return _0x2cce0b[_0x6920('0x26')]();};}function saveUpdates(_0x39013e,_0x1df372){return function(_0x2dd788){if(_0x2dd788){return _0x2dd788[_0x6920('0x27')](_0x39013e)[_0x6920('0x28')](function(_0x1ae686){return _0x1ae686;});}return null;};}function removeEntity(_0x3a6e48,_0xa8f55){return function(_0x258986){if(_0x258986){return _0x258986['destroy']()[_0x6920('0x28')](function(){_0x3a6e48['status'](0xcc)[_0x6920('0x1b')]();});}};}function handleEntityNotFound(_0x4dd08b,_0x72316a){return function(_0x32a6ae){if(!_0x32a6ae){_0x4dd08b[_0x6920('0x1a')](0x194);}return _0x32a6ae;};}function handleError(_0xd069c,_0x5868e1){_0x5868e1=_0x5868e1||0x1f4;return function(_0x1cab00){logger[_0x6920('0x29')](_0x1cab00[_0x6920('0x2a')]);if(_0x1cab00[_0x6920('0x2b')]){delete _0x1cab00[_0x6920('0x2b')];}_0xd069c[_0x6920('0x1c')](_0x5868e1)[_0x6920('0x2c')](_0x1cab00);};}exports[_0x6920('0x2d')]=function(_0x400894,_0x2f5ce8){var _0x6860c7={},_0x2b2cd9={},_0x548fbc={'count':0x0,'rows':[]};var _0x182f1b=_['map'](db[_0x6920('0x2e')]['rawAttributes'],function(_0x31aa90){return{'name':_0x31aa90[_0x6920('0x2f')],'type':_0x31aa90['type'][_0x6920('0x30')]};});_0x2b2cd9[_0x6920('0x31')]=_[_0x6920('0x32')](_0x182f1b,'name');_0x2b2cd9['query']=_[_0x6920('0x33')](_0x400894['query']);_0x2b2cd9['filters']=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],_0x2b2cd9[_0x6920('0x35')]);_0x6860c7[_0x6920('0x36')]=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],qs[_0x6920('0x37')](_0x400894['query'][_0x6920('0x37')]));_0x6860c7['attributes']=_0x6860c7[_0x6920('0x36')]['length']?_0x6860c7['attributes']:_0x2b2cd9[_0x6920('0x31')];if(!_0x400894[_0x6920('0x35')][_0x6920('0x38')](_0x6920('0x39'))){_0x6860c7[_0x6920('0x1f')]=qs[_0x6920('0x1f')](_0x400894[_0x6920('0x35')][_0x6920('0x1f')]);_0x6860c7[_0x6920('0x1d')]=qs[_0x6920('0x1d')](_0x400894[_0x6920('0x35')][_0x6920('0x1d')]);}_0x6860c7['order']=qs[_0x6920('0x3a')](_0x400894['query'][_0x6920('0x3a')]);_0x6860c7[_0x6920('0x3b')]=qs[_0x6920('0x3c')](_['pick'](_0x400894[_0x6920('0x35')],_0x2b2cd9[_0x6920('0x3c')]),_0x182f1b);if(_0x400894[_0x6920('0x35')][_0x6920('0x3d')]){_0x6860c7['where']=_[_0x6920('0x3e')](_0x6860c7[_0x6920('0x3b')],{'$or':_['map'](_0x182f1b,function(_0x49be52){if(_0x49be52[_0x6920('0x3f')]!==_0x6920('0x40')){var _0x56ca8f={};_0x56ca8f[_0x49be52[_0x6920('0x2b')]]={'$like':'%'+_0x400894[_0x6920('0x35')]['filter']+'%'};return _0x56ca8f;}})});}_0x6860c7=_['merge']({},_0x6860c7,_0x400894[_0x6920('0x41')]);var _0x1f0c5f={'where':_0x6860c7[_0x6920('0x3b')]};return db[_0x6920('0x2e')][_0x6920('0x20')](_0x1f0c5f)['then'](function(_0x58f0e8){_0x548fbc['count']=_0x58f0e8;if(_0x400894[_0x6920('0x35')]['includeAll']){_0x6860c7['include']=[{'all':!![]}];}return db[_0x6920('0x2e')][_0x6920('0x42')](_0x6860c7);})['then'](function(_0x3aad11){_0x548fbc['rows']=_0x3aad11;return _0x548fbc;})[_0x6920('0x28')](respondWithFilteredResult(_0x2f5ce8,_0x6860c7))[_0x6920('0x43')](handleError(_0x2f5ce8,null));};exports[_0x6920('0x44')]=function(_0x1b3ebb,_0x3a994d){var _0x55d7b5={'raw':!![],'where':{'id':_0x1b3ebb[_0x6920('0x45')]['id']}},_0x4dfa0c={};_0x4dfa0c['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x4dfa0c[_0x6920('0x35')]=_[_0x6920('0x33')](_0x1b3ebb[_0x6920('0x35')]);_0x4dfa0c['filters']=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],_0x4dfa0c[_0x6920('0x35')]);_0x55d7b5[_0x6920('0x36')]=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],qs['fields'](_0x1b3ebb[_0x6920('0x35')][_0x6920('0x37')]));_0x55d7b5[_0x6920('0x36')]=_0x55d7b5[_0x6920('0x36')][_0x6920('0x46')]?_0x55d7b5[_0x6920('0x36')]:_0x4dfa0c[_0x6920('0x31')];if(_0x1b3ebb[_0x6920('0x35')][_0x6920('0x47')]){_0x55d7b5[_0x6920('0x48')]=[{'all':!![]}];}_0x55d7b5=_[_0x6920('0x3e')]({},_0x55d7b5,_0x1b3ebb[_0x6920('0x41')]);return db['JscriptyAnswerReport'][_0x6920('0x49')](_0x55d7b5)[_0x6920('0x28')](handleEntityNotFound(_0x3a994d,null))['then'](respondWithResult(_0x3a994d,null))['catch'](handleError(_0x3a994d,null));};exports[_0x6920('0x4a')]=function(_0x3c231e,_0x20fab4){return db[_0x6920('0x2e')][_0x6920('0x4a')](_0x3c231e['body'],{})[_0x6920('0x28')](respondWithResult(_0x20fab4,0xc9))[_0x6920('0x43')](handleError(_0x20fab4,null));};exports[_0x6920('0x27')]=function(_0x51b12d,_0x4d1c79){if(_0x51b12d[_0x6920('0x4b')]['id']){delete _0x51b12d[_0x6920('0x4b')]['id'];}return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x51b12d['params']['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x4d1c79,null))[_0x6920('0x28')](saveUpdates(_0x51b12d[_0x6920('0x4b')],null))[_0x6920('0x28')](respondWithResult(_0x4d1c79,null))[_0x6920('0x43')](handleError(_0x4d1c79,null));};exports['destroy']=function(_0x1c0dd9,_0x3fe81d){return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x1c0dd9[_0x6920('0x45')]['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x3fe81d,null))[_0x6920('0x28')](removeEntity(_0x3fe81d,null))[_0x6920('0x43')](handleError(_0x3fe81d,null));};exports[_0x6920('0x4c')]=function(_0x1c6bba,_0x492a02){return db[_0x6920('0x2e')][_0x6920('0x4c')]()[_0x6920('0x28')](respondWithResult(_0x492a02,null))[_0x6920('0x43')](handleError(_0x492a02,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 861f3aa..522e0ca 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 _0xf2a5=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x2cddcb,_0x471e76){var _0x2d7c92=function(_0x3d8c02){while(--_0x3d8c02){_0x2cddcb['push'](_0x2cddcb['shift']());}};_0x2d7c92(++_0x471e76);}(_0xf2a5,0x8f));var _0x5f2a=function(_0x1aee43,_0x4215f9){_0x1aee43=_0x1aee43-0x0;var _0x2278ed=_0xf2a5[_0x1aee43];return _0x2278ed;};'use strict';var _=require(_0x5f2a('0x0'));var util=require('util');var logger=require(_0x5f2a('0x1'))(_0x5f2a('0x2'));var moment=require(_0x5f2a('0x3'));var BPromise=require(_0x5f2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f2a('0x5'));var rimraf=require(_0x5f2a('0x6'));var config=require(_0x5f2a('0x7'));var attributes=require(_0x5f2a('0x8'));module[_0x5f2a('0x9')]=function(_0x317961,_0x553b3c){return _0x317961[_0x5f2a('0xa')](_0x5f2a('0xb'),attributes,{'tableName':_0x5f2a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cfd=['../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x2675b7,_0x39b830){var _0x3fef23=function(_0x49e173){while(--_0x49e173){_0x2675b7['push'](_0x2675b7['shift']());}};_0x3fef23(++_0x39b830);}(_0x0cfd,0x165));var _0xd0cf=function(_0x1c4a2f,_0x8e6f48){_0x1c4a2f=_0x1c4a2f-0x0;var _0x5602db=_0x0cfd[_0x1c4a2f];return _0x5602db;};'use strict';var _=require(_0xd0cf('0x0'));var util=require(_0xd0cf('0x1'));var logger=require(_0xd0cf('0x2'))('api');var moment=require(_0xd0cf('0x3'));var BPromise=require(_0xd0cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0cf('0x5'));var rimraf=require('rimraf');var config=require(_0xd0cf('0x6'));var attributes=require(_0xd0cf('0x7'));module[_0xd0cf('0x8')]=function(_0x2ebd71,_0x387a2c){return _0x2ebd71['define'](_0xd0cf('0x9'),attributes,{'tableName':_0xd0cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index d58ccc4..380925b 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 _0x837f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x401b64,_0x5cae66){var _0x139aa0=function(_0x4bef1d){while(--_0x4bef1d){_0x401b64['push'](_0x401b64['shift']());}};_0x139aa0(++_0x5cae66);}(_0x837f,0x1e0));var _0xf837=function(_0x5cd4b9,_0x12e429){_0x5cd4b9=_0x5cd4b9-0x0;var _0x351931=_0x837f[_0x5cd4b9];return _0x351931;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf837('0x0'));var BPromise=require(_0xf837('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf837('0x2'));var db=require(_0xf837('0x3'))['db'];var utils=require(_0xf837('0x4'));var logger=require('../../config/logger')(_0xf837('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf837('0x6')][_0xf837('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb11df5,_0x2b0156,_0x296967){return new BPromise(function(_0x1374a8,_0x4fce13){return client[_0xf837('0x8')](_0xb11df5,_0x296967)[_0xf837('0x9')](function(_0x33fe68){logger[_0xf837('0xa')](_0xf837('0xb'),_0x2b0156,'request\x20sent');logger[_0xf837('0xc')](_0xf837('0xd'),_0x2b0156,'request\x20sent',JSON[_0xf837('0xe')](_0x33fe68));if(_0x33fe68[_0xf837('0xf')]){if(_0x33fe68['error'][_0xf837('0x10')]===0x1f4){logger[_0xf837('0xf')](_0xf837('0xb'),_0x2b0156,_0x33fe68['error'][_0xf837('0x11')]);return _0x4fce13(_0x33fe68[_0xf837('0xf')][_0xf837('0x11')]);}logger[_0xf837('0xf')](_0xf837('0xb'),_0x2b0156,_0x33fe68[_0xf837('0xf')][_0xf837('0x11')]);return _0x1374a8(_0x33fe68['error'][_0xf837('0x11')]);}else{logger[_0xf837('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b0156,_0xf837('0x12'));_0x1374a8(_0x33fe68[_0xf837('0x13')][_0xf837('0x11')]);}})['catch'](function(_0x292657){logger[_0xf837('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b0156,_0x292657);_0x4fce13(_0x292657);});});} \ No newline at end of file +var _0x27e2=['request\x20sent','stringify','code','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x5de9fa,_0x30f1fa){var _0x186861=function(_0x27c03f){while(--_0x27c03f){_0x5de9fa['push'](_0x5de9fa['shift']());}};_0x186861(++_0x30f1fa);}(_0x27e2,0x167));var _0x227e=function(_0x750b42,_0x54c8a4){_0x750b42=_0x750b42-0x0;var _0x3f7b24=_0x27e2[_0x750b42];return _0x3f7b24;};'use strict';var _=require('lodash');var util=require(_0x227e('0x0'));var moment=require('moment');var BPromise=require(_0x227e('0x1'));var rs=require(_0x227e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x227e('0x3'))['db'];var utils=require(_0x227e('0x4'));var logger=require(_0x227e('0x5'))(_0x227e('0x6'));var config=require('../../config/environment');var jayson=require(_0x227e('0x7'));var client=jayson[_0x227e('0x8')][_0x227e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110fa5,_0x46429b,_0x214eb7){return new BPromise(function(_0x239446,_0x1bc4da){return client[_0x227e('0xa')](_0x110fa5,_0x214eb7)['then'](function(_0x5c75a6){logger[_0x227e('0xb')](_0x227e('0xc'),_0x46429b,'request\x20sent');logger[_0x227e('0xd')](_0x227e('0xe'),_0x46429b,_0x227e('0xf'),JSON[_0x227e('0x10')](_0x5c75a6));if(_0x5c75a6['error']){if(_0x5c75a6['error'][_0x227e('0x11')]===0x1f4){logger['error'](_0x227e('0xc'),_0x46429b,_0x5c75a6[_0x227e('0x12')][_0x227e('0x13')]);return _0x1bc4da(_0x5c75a6[_0x227e('0x12')][_0x227e('0x13')]);}logger[_0x227e('0x12')](_0x227e('0xc'),_0x46429b,_0x5c75a6['error']['message']);return _0x239446(_0x5c75a6[_0x227e('0x12')]['message']);}else{logger['info'](_0x227e('0xc'),_0x46429b,_0x227e('0xf'));_0x239446(_0x5c75a6[_0x227e('0x14')]['message']);}})[_0x227e('0x15')](function(_0x117db7){logger[_0x227e('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x46429b,_0x117db7);_0x1bc4da(_0x117db7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5f9d66f..3e9ef9e 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 _0x540a=['path','express','Router','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getSummary','post','create','clone','delete','destroy','exports','util'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x540a,0xa7));var _0xa540=function(_0x47705d,_0x426790){_0x47705d=_0x47705d-0x0;var _0x58006b=_0x540a[_0x47705d];return _0x58006b;};'use strict';var multer=require('multer');var util=require(_0xa540('0x0'));var path=require(_0xa540('0x1'));var timeout=require('connect-timeout');var express=require(_0xa540('0x2'));var router=express[_0xa540('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa540('0x4'));var config=require('../../config/environment');var controller=require(_0xa540('0x5'));router[_0xa540('0x6')]('/',auth[_0xa540('0x7')](),controller[_0xa540('0x8')]);router[_0xa540('0x6')](_0xa540('0x9'),auth[_0xa540('0x7')](),controller[_0xa540('0xa')]);router[_0xa540('0x6')](_0xa540('0xb'),auth['isAuthenticated'](),controller[_0xa540('0xc')]);router[_0xa540('0x6')](_0xa540('0xd'),auth[_0xa540('0x7')](),controller['getAnswers']);router[_0xa540('0x6')]('/:id/summary',auth[_0xa540('0x7')](),timeout('30s'),controller[_0xa540('0xe')]);router[_0xa540('0xf')]('/',auth[_0xa540('0x7')](),controller[_0xa540('0x10')]);router[_0xa540('0xf')]('/:id/clone',auth[_0xa540('0x7')](),controller[_0xa540('0x11')]);router['put']('/:id',auth[_0xa540('0x7')](),controller['update']);router[_0xa540('0x12')](_0xa540('0x9'),auth[_0xa540('0x7')](),controller[_0xa540('0x13')]);module[_0xa540('0x14')]=router; \ No newline at end of file +var _0x423a=['getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions'];(function(_0x479e9b,_0x41ab3f){var _0x44efed=function(_0x311130){while(--_0x311130){_0x479e9b['push'](_0x479e9b['shift']());}};_0x44efed(++_0x41ab3f);}(_0x423a,0x13f));var _0xa423=function(_0xd03aa,_0x5df4cb){_0xd03aa=_0xd03aa-0x0;var _0x523add=_0x423a[_0xd03aa];return _0x523add;};'use strict';var multer=require(_0xa423('0x0'));var util=require('util');var path=require(_0xa423('0x1'));var timeout=require(_0xa423('0x2'));var express=require(_0xa423('0x3'));var router=express[_0xa423('0x4')]();var fs_extra=require(_0xa423('0x5'));var auth=require(_0xa423('0x6'));var interaction=require(_0xa423('0x7'));var config=require(_0xa423('0x8'));var controller=require(_0xa423('0x9'));router[_0xa423('0xa')]('/',auth['isAuthenticated'](),controller[_0xa423('0xb')]);router[_0xa423('0xa')](_0xa423('0xc'),auth[_0xa423('0xd')](),controller[_0xa423('0xe')]);router['get'](_0xa423('0xf'),auth['isAuthenticated'](),controller[_0xa423('0x10')]);router[_0xa423('0xa')]('/:id/answers',auth['isAuthenticated'](),controller[_0xa423('0x11')]);router[_0xa423('0xa')](_0xa423('0x12'),auth[_0xa423('0xd')](),timeout(_0xa423('0x13')),controller[_0xa423('0x14')]);router[_0xa423('0x15')]('/',auth[_0xa423('0xd')](),controller[_0xa423('0x16')]);router['post'](_0xa423('0x17'),auth[_0xa423('0xd')](),controller[_0xa423('0x18')]);router[_0xa423('0x19')](_0xa423('0xc'),auth[_0xa423('0xd')](),controller['update']);router[_0xa423('0x1a')]('/:id',auth[_0xa423('0xd')](),controller[_0xa423('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5b0e641..c048574 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 _0x7421=['long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','util','exports','STRING','TEXT'];(function(_0x223ace,_0x28a4f1){var _0x599ef9=function(_0x58e15f){while(--_0x58e15f){_0x223ace['push'](_0x223ace['shift']());}};_0x599ef9(++_0x28a4f1);}(_0x7421,0x1db));var _0x1742=function(_0x32596c,_0x331cb4){_0x32596c=_0x32596c-0x0;var _0xba728a=_0x7421[_0x32596c];return _0xba728a;};'use strict';var Sequelize=require(_0x1742('0x0'));var _=require('lodash');var util=require(_0x1742('0x1'));module[_0x1742('0x2')]={'name':{'type':Sequelize[_0x1742('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x1742('0x3')]},'formData':{'type':Sequelize[_0x1742('0x4')](_0x1742('0x5')),'set':function(_0x516944){if(_[_0x1742('0x6')](_0x516944)){this[_0x1742('0x7')](_0x1742('0x8'),JSON['stringify'](_0x516944));}else if(_[_0x1742('0x9')](_0x516944)){this[_0x1742('0x7')](_0x1742('0x8'),_0x516944);}else{this['setDataValue']('formData',util[_0x1742('0xa')](_0x1742('0xb'),this[_0x1742('0xc')](_0x1742('0xd'))||'',this[_0x1742('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1742('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x87ba=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','stringify','setDataValue','formData'];(function(_0x40a705,_0x2463eb){var _0x25e2b1=function(_0x5ce55f){while(--_0x5ce55f){_0x40a705['push'](_0x40a705['shift']());}};_0x25e2b1(++_0x2463eb);}(_0x87ba,0x9a));var _0xa87b=function(_0x3db17b,_0x154758){_0x3db17b=_0x3db17b-0x0;var _0x40035f=_0x87ba[_0x3db17b];return _0x40035f;};'use strict';var Sequelize=require(_0xa87b('0x0'));var _=require(_0xa87b('0x1'));var util=require(_0xa87b('0x2'));module['exports']={'name':{'type':Sequelize[_0xa87b('0x3')],'unique':_0xa87b('0x4')},'description':{'type':Sequelize[_0xa87b('0x3')]},'formData':{'type':Sequelize[_0xa87b('0x5')](_0xa87b('0x6')),'set':function(_0x597f4d){if(_[_0xa87b('0x7')](_0x597f4d)){this['setDataValue']('formData',JSON[_0xa87b('0x8')](_0x597f4d));}else if(_['isString'](_0x597f4d)){this[_0xa87b('0x9')]('formData',_0x597f4d);}else{this['setDataValue'](_0xa87b('0xa'),util[_0xa87b('0xb')](_0xa87b('0xc'),this[_0xa87b('0xd')](_0xa87b('0x4'))||'',this[_0xa87b('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa87b('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa87b('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0729495..bfd693f 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 _0x95aa=['fromCharCode','toString','indexOf','replace','startTime','parse','questionId','question','starttime','format','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','user','UserProfileSection','getSessions','JscriptySessionReport','order','where','ProjectId','getAnswers','findOne','nolimit','JscriptyAnswerReport','number'];(function(_0x3d3e6a,_0x3ac662){var _0x389380=function(_0x2d7a18){while(--_0x2d7a18){_0x3d3e6a['push'](_0x3d3e6a['shift']());}};_0x389380(++_0x3ac662);}(_0x95aa,0x91));var _0xa95a=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0x95aa[_0x5a1cc9];return _0x471761;};'use strict';var emlformat=require(_0xa95a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa95a('0x1'));var jsonpatch=require(_0xa95a('0x2'));var rp=require('request-promise');var moment=require(_0xa95a('0x3'));var BPromise=require(_0xa95a('0x4'));var Mustache=require(_0xa95a('0x5'));var util=require(_0xa95a('0x6'));var path=require(_0xa95a('0x7'));var sox=require(_0xa95a('0x8'));var csv=require(_0xa95a('0x9'));var ejs=require(_0xa95a('0xa'));var fs=require('fs');var fs_extra=require(_0xa95a('0xb'));var _=require('lodash');var squel=require(_0xa95a('0xc'));var crypto=require('crypto');var jsforce=require(_0xa95a('0xd'));var deskjs=require(_0xa95a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa95a('0xf'));var Redis=require(_0xa95a('0x10'));var authService=require(_0xa95a('0x11'));var qs=require(_0xa95a('0x12'));var as=require(_0xa95a('0x13'));var hardwareService=require(_0xa95a('0x14'));var logger=require(_0xa95a('0x15'))(_0xa95a('0x16'));var utils=require(_0xa95a('0x17'));var config=require(_0xa95a('0x18'));var licenseUtil=require(_0xa95a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd0db,_0x25ee8a){_0x25ee8a=_0x25ee8a||0xcc;return function(_0x4fbfc4){if(_0x4fbfc4){return _0x4dd0db[_0xa95a('0x1a')](_0x25ee8a);}return _0x4dd0db[_0xa95a('0x1b')](_0x25ee8a)[_0xa95a('0x1c')]();};}function respondWithResult(_0x23b41c,_0xa26339){_0xa26339=_0xa26339||0xc8;return function(_0x32dd48){if(_0x32dd48){return _0x23b41c[_0xa95a('0x1b')](_0xa26339)[_0xa95a('0x1d')](_0x32dd48);}};}function respondWithFilteredResult(_0x3265c5,_0x235e81){return function(_0x4c94a1){if(_0x4c94a1){var _0x1d60f7=typeof _0x235e81[_0xa95a('0x1e')]==='undefined'&&typeof _0x235e81[_0xa95a('0x1f')]===_0xa95a('0x20');var _0x44942d=_0x4c94a1[_0xa95a('0x21')];var _0x59aca9=_0x1d60f7?0x0:_0x235e81[_0xa95a('0x1e')];var _0x52be20=_0x1d60f7?_0x4c94a1[_0xa95a('0x21')]:_0x235e81[_0xa95a('0x1e')]+_0x235e81[_0xa95a('0x1f')];var _0x2e31a8;if(_0x52be20>=_0x44942d){_0x52be20=_0x44942d;_0x2e31a8=0xc8;}else{_0x2e31a8=0xce;}_0x3265c5[_0xa95a('0x1b')](_0x2e31a8);return _0x3265c5[_0xa95a('0x22')](_0xa95a('0x23'),_0x59aca9+'-'+_0x52be20+'/'+_0x44942d)[_0xa95a('0x1d')](_0x4c94a1);}return null;};}function patchUpdates(_0x26a3be){return function(_0x4004ef){try{jsonpatch[_0xa95a('0x24')](_0x4004ef,_0x26a3be,!![]);}catch(_0x4cd002){return BPromise[_0xa95a('0x25')](_0x4cd002);}return _0x4004ef[_0xa95a('0x26')]();};}function saveUpdates(_0x24b05c,_0x25355c){return function(_0x64522e){if(_0x64522e){return _0x64522e['update'](_0x24b05c)['then'](function(_0x3fdfef){return _0x3fdfef;});}return null;};}function removeEntity(_0xd27cab,_0xe930d2){return function(_0x24b33b){if(_0x24b33b){return _0x24b33b[_0xa95a('0x27')]()[_0xa95a('0x28')](function(){var _0x332aca=_0x24b33b[_0xa95a('0x29')]({'plain':!![]});var _0x3d27fc=_0xa95a('0x2a');return db[_0xa95a('0x2b')][_0xa95a('0x27')]({'where':{'type':_0x3d27fc,'resourceId':_0x332aca['id']}})[_0xa95a('0x28')](function(){return _0x24b33b;});})[_0xa95a('0x28')](function(){_0xd27cab['status'](0xcc)[_0xa95a('0x1c')]();});}};}function handleEntityNotFound(_0xa541a,_0x913f65){return function(_0x912d98){if(!_0x912d98){_0xa541a[_0xa95a('0x1a')](0x194);}return _0x912d98;};}function handleError(_0xdf3cce,_0x127fbd){_0x127fbd=_0x127fbd||0x1f4;return function(_0x161c25){logger[_0xa95a('0x2c')](_0x161c25[_0xa95a('0x2d')]);if(_0x161c25['name']){delete _0x161c25[_0xa95a('0x2e')];}_0xdf3cce['status'](_0x127fbd)['send'](_0x161c25);};}exports[_0xa95a('0x2f')]=function(_0x11f114,_0x558ab4){var _0x552afd={},_0x154688={},_0x199464={'count':0x0,'rows':[]};var _0x2258be=_[_0xa95a('0x30')](db[_0xa95a('0x31')][_0xa95a('0x32')],function(_0x18ae1a){return{'name':_0x18ae1a[_0xa95a('0x33')],'type':_0x18ae1a['type'][_0xa95a('0x34')]};});_0x154688[_0xa95a('0x35')]=_[_0xa95a('0x30')](_0x2258be,_0xa95a('0x2e'));_0x154688[_0xa95a('0x36')]=_[_0xa95a('0x37')](_0x11f114[_0xa95a('0x36')]);_0x154688[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x154688['model'],_0x154688[_0xa95a('0x36')]);_0x552afd['attributes']=_[_0xa95a('0x39')](_0x154688[_0xa95a('0x35')],qs[_0xa95a('0x3a')](_0x11f114['query'][_0xa95a('0x3a')]));_0x552afd[_0xa95a('0x3b')]=_0x552afd[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x552afd[_0xa95a('0x3b')]:_0x154688[_0xa95a('0x35')];if(!_0x11f114[_0xa95a('0x36')][_0xa95a('0x3d')]('nolimit')){_0x552afd['limit']=qs[_0xa95a('0x1f')](_0x11f114[_0xa95a('0x36')][_0xa95a('0x1f')]);_0x552afd['offset']=qs[_0xa95a('0x1e')](_0x11f114['query'][_0xa95a('0x1e')]);}_0x552afd['order']=qs[_0xa95a('0x3e')](_0x11f114[_0xa95a('0x36')]['sort']);_0x552afd['where']=qs[_0xa95a('0x38')](_[_0xa95a('0x3f')](_0x11f114['query'],_0x154688['filters']),_0x2258be);if(_0x11f114[_0xa95a('0x36')]['filter']){_0x552afd['where']=_['merge'](_0x552afd['where'],{'$or':_[_0xa95a('0x30')](_0x2258be,function(_0x32ee4b){if(_0x32ee4b[_0xa95a('0x40')]!==_0xa95a('0x41')){var _0x14a88f={};_0x14a88f[_0x32ee4b['name']]={'$like':'%'+_0x11f114[_0xa95a('0x36')][_0xa95a('0x42')]+'%'};return _0x14a88f;}})});}_0x552afd=_[_0xa95a('0x43')]({},_0x552afd,_0x11f114[_0xa95a('0x44')]);var _0x14bf44={'where':_0x552afd['where']};return db['JscriptyProject'][_0xa95a('0x21')](_0x14bf44)[_0xa95a('0x28')](function(_0x5b86fc){_0x199464[_0xa95a('0x21')]=_0x5b86fc;if(_0x11f114[_0xa95a('0x36')][_0xa95a('0x45')]){_0x552afd[_0xa95a('0x46')]=[{'all':!![]}];}return db['JscriptyProject'][_0xa95a('0x47')](_0x552afd);})[_0xa95a('0x28')](function(_0x418198){_0x199464[_0xa95a('0x48')]=_0x418198;return _0x199464;})['then'](respondWithFilteredResult(_0x558ab4,_0x552afd))[_0xa95a('0x49')](handleError(_0x558ab4,null));};exports[_0xa95a('0x4a')]=function(_0x343471,_0x451e86){var _0x3f7cd9={'raw':![],'where':{'id':_0x343471[_0xa95a('0x4b')]['id']}},_0x40cdba={};_0x40cdba[_0xa95a('0x35')]=_[_0xa95a('0x37')](db[_0xa95a('0x31')][_0xa95a('0x32')]);_0x40cdba['query']=_[_0xa95a('0x37')](_0x343471['query']);_0x40cdba[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x40cdba[_0xa95a('0x35')],_0x40cdba[_0xa95a('0x36')]);_0x3f7cd9[_0xa95a('0x3b')]=_[_0xa95a('0x39')](_0x40cdba[_0xa95a('0x35')],qs[_0xa95a('0x3a')](_0x343471[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x3f7cd9[_0xa95a('0x3b')]=_0x3f7cd9[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x3f7cd9['attributes']:_0x40cdba[_0xa95a('0x35')];if(_0x343471[_0xa95a('0x36')]['includeAll']){_0x3f7cd9[_0xa95a('0x46')]=[{'all':!![]}];}_0x3f7cd9=_[_0xa95a('0x43')]({},_0x3f7cd9,_0x343471[_0xa95a('0x44')]);return db[_0xa95a('0x31')][_0xa95a('0x4c')](_0x3f7cd9)[_0xa95a('0x28')](handleEntityNotFound(_0x451e86,null))[_0xa95a('0x28')](respondWithResult(_0x451e86,null))[_0xa95a('0x49')](handleError(_0x451e86,null));};exports[_0xa95a('0x4d')]=function(_0x19c6e1,_0x2494c5){return db['JscriptyProject']['create'](_0x19c6e1[_0xa95a('0x4e')],{})[_0xa95a('0x28')](function(_0x1b8304){var _0x189d9f=_0x19c6e1['user'][_0xa95a('0x29')]({'plain':!![]});if(!_0x189d9f)throw new Error(_0xa95a('0x4f'));if(_0x189d9f[_0xa95a('0x50')]==='user'){var _0x1321cc=_0x1b8304[_0xa95a('0x29')]({'plain':!![]});var _0x23b322=_0xa95a('0x2a');return db['UserProfileSection'][_0xa95a('0x4c')]({'where':{'name':_0x23b322,'userProfileId':_0x189d9f[_0xa95a('0x51')]},'raw':!![]})[_0xa95a('0x28')](function(_0x3c1785){if(_0x3c1785&&_0x3c1785['autoAssociation']===0x0){return db[_0xa95a('0x2b')]['create']({'name':_0x1321cc[_0xa95a('0x2e')],'resourceId':_0x1321cc['id'],'type':_0x3c1785['name'],'sectionId':_0x3c1785['id']},{})['then'](function(){return _0x1b8304;});}else{return _0x1b8304;}})[_0xa95a('0x49')](function(_0x3a95d4){logger[_0xa95a('0x2c')](_0xa95a('0x52'),_0x3a95d4);throw _0x3a95d4;});}return _0x1b8304;})['then'](respondWithResult(_0x2494c5,0xc9))['catch'](handleError(_0x2494c5,null));};exports[_0xa95a('0x53')]=function(_0x597ae1,_0x38c97e){var _0x56df2e={'where':{'id':_0x597ae1[_0xa95a('0x4b')]['id']}},_0x3c6627={};_0x3c6627[_0xa95a('0x35')]=_[_0xa95a('0x37')](db[_0xa95a('0x31')]['rawAttributes']);_0x56df2e[_0xa95a('0x3b')]=_[_0xa95a('0x39')](_0x3c6627['model'],qs['fields'](_0x597ae1[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x56df2e[_0xa95a('0x3b')]=_0x56df2e[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x56df2e['attributes']:_0x3c6627[_0xa95a('0x35')];if(_0x597ae1[_0xa95a('0x36')][_0xa95a('0x45')]){_0x56df2e['include']=[{'all':!![]}];}_0x56df2e=_['merge']({},_0x56df2e,_0x597ae1[_0xa95a('0x44')]);return db['JscriptyProject']['find'](_0x56df2e)[_0xa95a('0x28')](handleEntityNotFound(_0x38c97e,null))['then'](function(_0x2076e5){if(_0x2076e5){var _0x448145=_0x2076e5['get']({'plain':!![]});_0x448145=qs['omit'](_0x448145,['id',_0xa95a('0x54'),_0xa95a('0x55')]);_0x597ae1[_0xa95a('0x4e')]=_[_0xa95a('0x56')](_0x597ae1[_0xa95a('0x4e')],['id',_0xa95a('0x54'),_0xa95a('0x55')]);return db[_0xa95a('0x31')][_0xa95a('0x4d')](_[_0xa95a('0x43')](_0x448145,_0x597ae1['body']),{'include':_0x597ae1['query'][_0xa95a('0x45')]?[{'all':!![]}]:undefined})[_0xa95a('0x28')](function(_0x4b5913){var _0x17bd25=_0x597ae1[_0xa95a('0x57')][_0xa95a('0x29')]({'plain':!![]});if(!_0x17bd25)throw new Error(_0xa95a('0x4f'));if(_0x17bd25[_0xa95a('0x50')]===_0xa95a('0x57')){var _0x4045f8=_0x4b5913['get']({'plain':!![]});var _0x3b909d=_0xa95a('0x2a');return db[_0xa95a('0x58')][_0xa95a('0x4c')]({'where':{'name':_0x3b909d,'userProfileId':_0x17bd25[_0xa95a('0x51')]},'raw':!![]})[_0xa95a('0x28')](function(_0x318b12){if(_0x318b12&&_0x318b12['autoAssociation']===0x0){return db[_0xa95a('0x2b')][_0xa95a('0x4d')]({'name':_0x4045f8['name'],'resourceId':_0x4045f8['id'],'type':_0x318b12[_0xa95a('0x2e')],'sectionId':_0x318b12['id']},{})[_0xa95a('0x28')](function(){return _0x4b5913;});}else{return _0x4b5913;}})[_0xa95a('0x49')](function(_0x2a2fc5){logger[_0xa95a('0x2c')](_0xa95a('0x52'),_0x2a2fc5);throw _0x2a2fc5;});}return _0x4b5913;});}})[_0xa95a('0x28')](respondWithResult(_0x38c97e,0xc9))['catch'](handleError(_0x38c97e,null));};exports['update']=function(_0x33869e,_0x12897f){if(_0x33869e[_0xa95a('0x4e')]['id']){delete _0x33869e['body']['id'];}return db[_0xa95a('0x31')][_0xa95a('0x4c')]({'where':{'id':_0x33869e['params']['id']}})[_0xa95a('0x28')](handleEntityNotFound(_0x12897f,null))[_0xa95a('0x28')](saveUpdates(_0x33869e[_0xa95a('0x4e')],null))[_0xa95a('0x28')](respondWithResult(_0x12897f,null))['catch'](handleError(_0x12897f,null));};exports[_0xa95a('0x27')]=function(_0x3dda70,_0x394038){return db[_0xa95a('0x31')][_0xa95a('0x4c')]({'where':{'id':_0x3dda70[_0xa95a('0x4b')]['id']}})[_0xa95a('0x28')](handleEntityNotFound(_0x394038,null))[_0xa95a('0x28')](removeEntity(_0x394038,null))[_0xa95a('0x49')](handleError(_0x394038,null));};exports[_0xa95a('0x59')]=function(_0x572cb5,_0xfc400a,_0x3d4d81){var _0x3c8c75={'raw':!![],'where':{}};var _0x4ea5aa={};var _0x5170f9={'count':0x0,'rows':[]};return db[_0xa95a('0x31')]['findOne']({'where':{'id':_0x572cb5[_0xa95a('0x4b')]['id']}})[_0xa95a('0x28')](handleEntityNotFound(_0xfc400a,null))[_0xa95a('0x28')](function(_0x3aeea0){if(_0x3aeea0){_0x4ea5aa['model']=_[_0xa95a('0x37')](db[_0xa95a('0x5a')][_0xa95a('0x32')]);_0x4ea5aa[_0xa95a('0x36')]=_[_0xa95a('0x37')](_0x572cb5[_0xa95a('0x36')]);_0x4ea5aa[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x4ea5aa[_0xa95a('0x35')],_0x4ea5aa[_0xa95a('0x36')]);_0x3c8c75['attributes']=_[_0xa95a('0x39')](_0x4ea5aa[_0xa95a('0x35')],qs[_0xa95a('0x3a')](_0x572cb5[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x3c8c75['attributes']=_0x3c8c75[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x3c8c75[_0xa95a('0x3b')]:_0x4ea5aa['model'];if(!_0x572cb5['query']['hasOwnProperty']('nolimit')){_0x3c8c75[_0xa95a('0x1f')]=qs[_0xa95a('0x1f')](_0x572cb5[_0xa95a('0x36')]['limit']);_0x3c8c75[_0xa95a('0x1e')]=qs[_0xa95a('0x1e')](_0x572cb5[_0xa95a('0x36')][_0xa95a('0x1e')]);}_0x3c8c75[_0xa95a('0x5b')]=qs[_0xa95a('0x3e')](_0x572cb5['query'][_0xa95a('0x3e')]);_0x3c8c75[_0xa95a('0x5c')]=qs[_0xa95a('0x38')](_['pick'](_0x572cb5[_0xa95a('0x36')],_0x4ea5aa['filters']));_0x3c8c75[_0xa95a('0x5c')][_0xa95a('0x5d')]=_0x3aeea0['id'];if(_0x572cb5[_0xa95a('0x36')]['filter']){_0x3c8c75['where']=_[_0xa95a('0x43')](_0x3c8c75['where'],{'$or':_[_0xa95a('0x30')](_0x3c8c75[_0xa95a('0x3b')],function(_0x56f52b){var _0x3528af={};_0x3528af[_0x56f52b]={'$like':'%'+_0x572cb5[_0xa95a('0x36')][_0xa95a('0x42')]+'%'};return _0x3528af;})});}_0x3c8c75=_[_0xa95a('0x43')]({},_0x3c8c75,_0x572cb5[_0xa95a('0x44')]);return db['JscriptySessionReport'][_0xa95a('0x21')]({'where':_0x3c8c75['where']})[_0xa95a('0x28')](function(_0x4f7936){_0x5170f9[_0xa95a('0x21')]=_0x4f7936;if(_0x572cb5[_0xa95a('0x36')]['includeAll']){_0x3c8c75[_0xa95a('0x46')]=[{'all':!![]}];}return db[_0xa95a('0x5a')][_0xa95a('0x47')](_0x3c8c75);})['then'](function(_0x3096c1){_0x5170f9[_0xa95a('0x48')]=_0x3096c1;return _0x5170f9;});}})['then'](respondWithFilteredResult(_0xfc400a,_0x3c8c75))[_0xa95a('0x49')](handleError(_0xfc400a,null));};exports[_0xa95a('0x5e')]=function(_0xb46903,_0x27ceeb,_0x110d4a){var _0x111519={'raw':!![],'where':{}};var _0x4d89de={};var _0x1984f4={'count':0x0,'rows':[]};return db[_0xa95a('0x31')][_0xa95a('0x5f')]({'where':{'id':_0xb46903['params']['id']}})['then'](handleEntityNotFound(_0x27ceeb,null))['then'](function(_0x160cb7){if(_0x160cb7){_0x4d89de[_0xa95a('0x35')]=_[_0xa95a('0x37')](db['JscriptyAnswerReport'][_0xa95a('0x32')]);_0x4d89de[_0xa95a('0x36')]=_['keys'](_0xb46903['query']);_0x4d89de[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x4d89de[_0xa95a('0x35')],_0x4d89de[_0xa95a('0x36')]);_0x111519[_0xa95a('0x3b')]=_[_0xa95a('0x39')](_0x4d89de[_0xa95a('0x35')],qs['fields'](_0xb46903[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x111519[_0xa95a('0x3b')]=_0x111519[_0xa95a('0x3b')]['length']?_0x111519['attributes']:_0x4d89de[_0xa95a('0x35')];if(!_0xb46903[_0xa95a('0x36')][_0xa95a('0x3d')](_0xa95a('0x60'))){_0x111519[_0xa95a('0x1f')]=qs[_0xa95a('0x1f')](_0xb46903['query'][_0xa95a('0x1f')]);_0x111519[_0xa95a('0x1e')]=qs[_0xa95a('0x1e')](_0xb46903[_0xa95a('0x36')][_0xa95a('0x1e')]);}_0x111519['order']=qs[_0xa95a('0x3e')](_0xb46903['query'][_0xa95a('0x3e')]);_0x111519[_0xa95a('0x5c')]=qs[_0xa95a('0x38')](_[_0xa95a('0x3f')](_0xb46903[_0xa95a('0x36')],_0x4d89de[_0xa95a('0x38')]));_0x111519[_0xa95a('0x5c')][_0xa95a('0x5d')]=_0x160cb7['id'];if(_0xb46903['query'][_0xa95a('0x42')]){_0x111519[_0xa95a('0x5c')]=_[_0xa95a('0x43')](_0x111519[_0xa95a('0x5c')],{'$or':_[_0xa95a('0x30')](_0x111519[_0xa95a('0x3b')],function(_0x4a1a30){var _0x4a3c7b={};_0x4a3c7b[_0x4a1a30]={'$like':'%'+_0xb46903['query'][_0xa95a('0x42')]+'%'};return _0x4a3c7b;})});}_0x111519=_['merge']({},_0x111519,_0xb46903[_0xa95a('0x44')]);return db[_0xa95a('0x61')][_0xa95a('0x21')]({'where':_0x111519[_0xa95a('0x5c')]})[_0xa95a('0x28')](function(_0x5205e6){_0x1984f4[_0xa95a('0x21')]=_0x5205e6;if(_0xb46903[_0xa95a('0x36')][_0xa95a('0x45')]){_0x111519[_0xa95a('0x46')]=[{'all':!![]}];}return db[_0xa95a('0x61')][_0xa95a('0x47')](_0x111519);})['then'](function(_0x1c6731){_0x1984f4[_0xa95a('0x48')]=_0x1c6731;return _0x1984f4;});}})[_0xa95a('0x28')](respondWithFilteredResult(_0x27ceeb,_0x111519))[_0xa95a('0x49')](handleError(_0x27ceeb,null));};function char(_0x1aac1f){return _0xa95a('0x62')===typeof _0x1aac1f?String[_0xa95a('0x63')]['apply'](null,arguments):_0x1aac1f;}function needsEncapsulation(_0x2317d6){return!!_0x2317d6&&(_0x2317d6[_0xa95a('0x64')]()[_0xa95a('0x65')](char(0xd))>=0x0||_0x2317d6[_0xa95a('0x64')]()['indexOf'](char(0xa))>=0x0||_0x2317d6['toString']()['indexOf'](char(0x2c))>=0x0||_0x2317d6[_0xa95a('0x64')]()[_0xa95a('0x65')](char(0x22))>=0x0);}function encapsulate(_0x5ce647){var _0x13516e=char(0x22),_0x5e6841='\x5c'+char(0x22),_0x12bc64=_0x5ce647[_0xa95a('0x64')]()[_0xa95a('0x66')](new RegExp(_0x13516e,'g'),_0x5e6841);return _0x13516e+_0x12bc64+_0x13516e;}exports['getSummary']=function(_0x1f97dd,_0x33dbdb,_0x4010e5){var _0x14ca65,_0x495257;var _0x56f5a2={'where':{'ProjectId':_0x1f97dd[_0xa95a('0x4b')]['id']}};if(_0x1f97dd['query'][_0xa95a('0x67')]){_0x56f5a2[_0xa95a('0x5c')]['starttime']=JSON[_0xa95a('0x68')](_0x1f97dd[_0xa95a('0x36')][_0xa95a('0x67')]);}return db[_0xa95a('0x5a')][_0xa95a('0x47')](_0x56f5a2)[_0xa95a('0x28')](handleEntityNotFound(_0x33dbdb,null))[_0xa95a('0x28')](function(_0x4f7eb4){if(_0x4f7eb4){_0x14ca65=_0x4f7eb4;return db['JscriptyQuestionReport'][_0xa95a('0x47')]({'where':{'SessionId':{'$in':_[_0xa95a('0x30')](_0x14ca65,'id')},'ProjectId':_0x1f97dd['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x33dbdb,null))[_0xa95a('0x28')](function(_0x475913){if(_0x475913){_0x495257=_0x475913;var _0x14a8d7={};for(var _0x70499f=0x0,_0x1282bb=_0x495257[_0xa95a('0x3c')];_0x70499f<_0x1282bb;_0x70499f++){if(!_0x14a8d7['hasOwnProperty'](_0x495257[_0x70499f][_0xa95a('0x69')])){_0x14a8d7[_0x495257[_0x70499f][_0xa95a('0x69')]]=needsEncapsulation(_0x495257[_0x70499f][_0xa95a('0x6a')])?encapsulate(_0x495257[_0x70499f]['question']):_0x495257[_0x70499f][_0xa95a('0x6a')];}}var _0x5379d9=[],_0x340255={};for(var _0x4c9632=0x0,_0xb6e6b6=_0x14ca65[_0xa95a('0x3c')];_0x4c9632<_0xb6e6b6;_0x4c9632++){_0x340255={'ProjectId':_0x1f97dd[_0xa95a('0x4b')]['id'],'SessionId':_0x14ca65[_0x4c9632]['id'],'StartTime':moment(_0x14ca65[_0x4c9632][_0xa95a('0x6b')])[_0xa95a('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1d0648=0x0,_0x50bb13=_0x495257[_0xa95a('0x3c')];_0x1d0648<_0x50bb13;_0x1d0648++){if(_0x495257[_0x1d0648][_0xa95a('0x6d')]==_0x14ca65[_0x4c9632]['id']&&_0x14a8d7[_0xa95a('0x3d')](_0x495257[_0x1d0648]['questionId'])){_0x340255[_0x14a8d7[_0x495257[_0x1d0648][_0xa95a('0x69')]]]=_0x495257[_0x1d0648][_0xa95a('0x6e')];}}for(var _0x38b71a in _0x14a8d7){if(!_0x340255[_0xa95a('0x3d')](_0x14a8d7[_0x38b71a])){_0x340255[_0x14a8d7[_0x38b71a]]=null;}}_0x5379d9[_0xa95a('0x6f')](_0x340255);}return _0x5379d9;}})[_0xa95a('0x28')](function(_0x28b90e){if(!_[_0xa95a('0x70')](_0x28b90e)){var _0x59e3a8=toCsv(_0x28b90e);var _0x26f48e=Date['now']();fs[_0xa95a('0x71')](util[_0xa95a('0x6c')](_0xa95a('0x72'),_0x1f97dd[_0xa95a('0x4b')]['id'],_0x26f48e),_0x59e3a8);_0x33dbdb[_0xa95a('0x73')](_0xa95a('0x74'),_0xa95a('0x75')+util[_0xa95a('0x6c')](_0xa95a('0x76'),_0x1f97dd['params']['id'],_0x26f48e));_0x33dbdb[_0xa95a('0x73')](_0xa95a('0x77'),_0xa95a('0x78'));return _0x33dbdb[_0xa95a('0x79')](util[_0xa95a('0x6c')](_0xa95a('0x72'),_0x1f97dd[_0xa95a('0x4b')]['id'],_0x26f48e));}else{return _0x33dbdb['sendStatus'](0xcc);}})[_0xa95a('0x49')](handleError(_0x33dbdb,null));}; \ No newline at end of file +var _0x1691=['JscriptySessionReport','nolimit','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','destroy','error','stack','name','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type','options','include','JscriptyProject','findAll','rows','catch','show','rawAttributes','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','params','getSessions','findOne'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x1691,0x1ed));var _0x1169=function(_0x7b4f57,_0x2e96ed){_0x7b4f57=_0x7b4f57-0x0;var _0x544daa=_0x1691[_0x7b4f57];return _0x544daa;};'use strict';var emlformat=require(_0x1169('0x0'));var rimraf=require(_0x1169('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1169('0x2'));var rp=require(_0x1169('0x3'));var moment=require(_0x1169('0x4'));var BPromise=require(_0x1169('0x5'));var Mustache=require(_0x1169('0x6'));var util=require(_0x1169('0x7'));var path=require(_0x1169('0x8'));var sox=require(_0x1169('0x9'));var csv=require('to-csv');var ejs=require(_0x1169('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1169('0xb'));var squel=require('squel');var crypto=require(_0x1169('0xc'));var jsforce=require(_0x1169('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1169('0xe'));var querystring=require(_0x1169('0xf'));var Papa=require(_0x1169('0x10'));var Redis=require(_0x1169('0x11'));var authService=require(_0x1169('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1169('0x13'));var hardwareService=require(_0x1169('0x14'));var logger=require('../../config/logger')(_0x1169('0x15'));var utils=require('../../config/utils');var config=require(_0x1169('0x16'));var licenseUtil=require(_0x1169('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5d9b,_0x4f431e){_0x4f431e=_0x4f431e||0xcc;return function(_0x1a9f2b){if(_0x1a9f2b){return _0x5b5d9b['sendStatus'](_0x4f431e);}return _0x5b5d9b[_0x1169('0x18')](_0x4f431e)[_0x1169('0x19')]();};}function respondWithResult(_0x54ad46,_0x18ba76){_0x18ba76=_0x18ba76||0xc8;return function(_0x32636b){if(_0x32636b){return _0x54ad46[_0x1169('0x18')](_0x18ba76)[_0x1169('0x1a')](_0x32636b);}};}function respondWithFilteredResult(_0x4fc690,_0x4c4b90){return function(_0x34462b){if(_0x34462b){var _0x31a3e9=typeof _0x4c4b90[_0x1169('0x1b')]===_0x1169('0x1c')&&typeof _0x4c4b90[_0x1169('0x1d')]===_0x1169('0x1c');var _0x226420=_0x34462b[_0x1169('0x1e')];var _0x5f216f=_0x31a3e9?0x0:_0x4c4b90[_0x1169('0x1b')];var _0x51674a=_0x31a3e9?_0x34462b[_0x1169('0x1e')]:_0x4c4b90['offset']+_0x4c4b90['limit'];var _0x9c68cb;if(_0x51674a>=_0x226420){_0x51674a=_0x226420;_0x9c68cb=0xc8;}else{_0x9c68cb=0xce;}_0x4fc690['status'](_0x9c68cb);return _0x4fc690['set'](_0x1169('0x1f'),_0x5f216f+'-'+_0x51674a+'/'+_0x226420)['json'](_0x34462b);}return null;};}function patchUpdates(_0x3e6e45){return function(_0xba82ee){try{jsonpatch[_0x1169('0x20')](_0xba82ee,_0x3e6e45,!![]);}catch(_0x1b6af6){return BPromise[_0x1169('0x21')](_0x1b6af6);}return _0xba82ee[_0x1169('0x22')]();};}function saveUpdates(_0x38b4b1,_0x3c342e){return function(_0x594ac4){if(_0x594ac4){return _0x594ac4[_0x1169('0x23')](_0x38b4b1)[_0x1169('0x24')](function(_0x301646){return _0x301646;});}return null;};}function removeEntity(_0x277f69,_0x21e826){return function(_0x51040d){if(_0x51040d){return _0x51040d['destroy']()[_0x1169('0x24')](function(){var _0x5e235c=_0x51040d[_0x1169('0x25')]({'plain':!![]});var _0x428498='Projects';return db['UserProfileResource'][_0x1169('0x26')]({'where':{'type':_0x428498,'resourceId':_0x5e235c['id']}})[_0x1169('0x24')](function(){return _0x51040d;});})[_0x1169('0x24')](function(){_0x277f69['status'](0xcc)[_0x1169('0x19')]();});}};}function handleEntityNotFound(_0x3172c2,_0x494e2a){return function(_0x4edcac){if(!_0x4edcac){_0x3172c2['sendStatus'](0x194);}return _0x4edcac;};}function handleError(_0x4d89c7,_0xa60282){_0xa60282=_0xa60282||0x1f4;return function(_0x1c5499){logger[_0x1169('0x27')](_0x1c5499[_0x1169('0x28')]);if(_0x1c5499[_0x1169('0x29')]){delete _0x1c5499[_0x1169('0x29')];}_0x4d89c7[_0x1169('0x18')](_0xa60282)['send'](_0x1c5499);};}exports['index']=function(_0x40fa6d,_0x12edc7){var _0x23f6a7={},_0x44696c={},_0x44c0aa={'count':0x0,'rows':[]};var _0x4013f0=_[_0x1169('0x2a')](db['JscriptyProject']['rawAttributes'],function(_0x582758){return{'name':_0x582758['fieldName'],'type':_0x582758['type'][_0x1169('0x2b')]};});_0x44696c[_0x1169('0x2c')]=_[_0x1169('0x2a')](_0x4013f0,'name');_0x44696c[_0x1169('0x2d')]=_[_0x1169('0x2e')](_0x40fa6d[_0x1169('0x2d')]);_0x44696c[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x44696c[_0x1169('0x2c')],_0x44696c[_0x1169('0x2d')]);_0x23f6a7[_0x1169('0x31')]=_[_0x1169('0x30')](_0x44696c[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x40fa6d['query']['fields']));_0x23f6a7[_0x1169('0x31')]=_0x23f6a7['attributes'][_0x1169('0x33')]?_0x23f6a7[_0x1169('0x31')]:_0x44696c[_0x1169('0x2c')];if(!_0x40fa6d[_0x1169('0x2d')][_0x1169('0x34')]('nolimit')){_0x23f6a7[_0x1169('0x1d')]=qs['limit'](_0x40fa6d[_0x1169('0x2d')]['limit']);_0x23f6a7[_0x1169('0x1b')]=qs[_0x1169('0x1b')](_0x40fa6d[_0x1169('0x2d')][_0x1169('0x1b')]);}_0x23f6a7['order']=qs[_0x1169('0x35')](_0x40fa6d[_0x1169('0x2d')][_0x1169('0x35')]);_0x23f6a7['where']=qs['filters'](_[_0x1169('0x36')](_0x40fa6d[_0x1169('0x2d')],_0x44696c[_0x1169('0x2f')]),_0x4013f0);if(_0x40fa6d[_0x1169('0x2d')][_0x1169('0x37')]){_0x23f6a7[_0x1169('0x38')]=_['merge'](_0x23f6a7[_0x1169('0x38')],{'$or':_['map'](_0x4013f0,function(_0x2a307a){if(_0x2a307a[_0x1169('0x39')]!=='VIRTUAL'){var _0x120815={};_0x120815[_0x2a307a[_0x1169('0x29')]]={'$like':'%'+_0x40fa6d[_0x1169('0x2d')][_0x1169('0x37')]+'%'};return _0x120815;}})});}_0x23f6a7=_['merge']({},_0x23f6a7,_0x40fa6d[_0x1169('0x3a')]);var _0x8c4e97={'where':_0x23f6a7['where']};return db['JscriptyProject'][_0x1169('0x1e')](_0x8c4e97)[_0x1169('0x24')](function(_0x488025){_0x44c0aa['count']=_0x488025;if(_0x40fa6d['query']['includeAll']){_0x23f6a7[_0x1169('0x3b')]=[{'all':!![]}];}return db[_0x1169('0x3c')][_0x1169('0x3d')](_0x23f6a7);})[_0x1169('0x24')](function(_0x2ea766){_0x44c0aa[_0x1169('0x3e')]=_0x2ea766;return _0x44c0aa;})[_0x1169('0x24')](respondWithFilteredResult(_0x12edc7,_0x23f6a7))[_0x1169('0x3f')](handleError(_0x12edc7,null));};exports[_0x1169('0x40')]=function(_0x2e7d6b,_0xbc8661){var _0xef52fc={'raw':![],'where':{'id':_0x2e7d6b['params']['id']}},_0x255fc3={};_0x255fc3[_0x1169('0x2c')]=_[_0x1169('0x2e')](db[_0x1169('0x3c')][_0x1169('0x41')]);_0x255fc3[_0x1169('0x2d')]=_['keys'](_0x2e7d6b['query']);_0x255fc3[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x255fc3[_0x1169('0x2c')],_0x255fc3[_0x1169('0x2d')]);_0xef52fc[_0x1169('0x31')]=_['intersection'](_0x255fc3['model'],qs[_0x1169('0x32')](_0x2e7d6b['query']['fields']));_0xef52fc[_0x1169('0x31')]=_0xef52fc[_0x1169('0x31')]['length']?_0xef52fc[_0x1169('0x31')]:_0x255fc3['model'];if(_0x2e7d6b[_0x1169('0x2d')][_0x1169('0x42')]){_0xef52fc['include']=[{'all':!![]}];}_0xef52fc=_[_0x1169('0x43')]({},_0xef52fc,_0x2e7d6b[_0x1169('0x3a')]);return db[_0x1169('0x3c')]['find'](_0xef52fc)[_0x1169('0x24')](handleEntityNotFound(_0xbc8661,null))[_0x1169('0x24')](respondWithResult(_0xbc8661,null))[_0x1169('0x3f')](handleError(_0xbc8661,null));};exports[_0x1169('0x44')]=function(_0x511eaa,_0x3160d2){return db[_0x1169('0x3c')][_0x1169('0x44')](_0x511eaa[_0x1169('0x45')],{})[_0x1169('0x24')](function(_0x27b2f1){var _0x2676f1=_0x511eaa[_0x1169('0x46')][_0x1169('0x25')]({'plain':!![]});if(!_0x2676f1)throw new Error(_0x1169('0x47'));if(_0x2676f1[_0x1169('0x48')]==='user'){var _0x23d3bb=_0x27b2f1[_0x1169('0x25')]({'plain':!![]});var _0x5f3e39=_0x1169('0x49');return db[_0x1169('0x4a')][_0x1169('0x4b')]({'where':{'name':_0x5f3e39,'userProfileId':_0x2676f1[_0x1169('0x4c')]},'raw':!![]})[_0x1169('0x24')](function(_0x54164d){if(_0x54164d&&_0x54164d[_0x1169('0x4d')]===0x0){return db[_0x1169('0x4e')][_0x1169('0x44')]({'name':_0x23d3bb[_0x1169('0x29')],'resourceId':_0x23d3bb['id'],'type':_0x54164d[_0x1169('0x29')],'sectionId':_0x54164d['id']},{})['then'](function(){return _0x27b2f1;});}else{return _0x27b2f1;}})[_0x1169('0x3f')](function(_0xb8bec8){logger[_0x1169('0x27')](_0x1169('0x4f'),_0xb8bec8);throw _0xb8bec8;});}return _0x27b2f1;})[_0x1169('0x24')](respondWithResult(_0x3160d2,0xc9))[_0x1169('0x3f')](handleError(_0x3160d2,null));};exports[_0x1169('0x50')]=function(_0x2863f9,_0x4ede5a){var _0xe6897a={'where':{'id':_0x2863f9['params']['id']}},_0x590536={};_0x590536[_0x1169('0x2c')]=_[_0x1169('0x2e')](db[_0x1169('0x3c')][_0x1169('0x41')]);_0xe6897a[_0x1169('0x31')]=_['intersection'](_0x590536[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x2863f9[_0x1169('0x2d')][_0x1169('0x32')]));_0xe6897a[_0x1169('0x31')]=_0xe6897a[_0x1169('0x31')][_0x1169('0x33')]?_0xe6897a[_0x1169('0x31')]:_0x590536['model'];if(_0x2863f9[_0x1169('0x2d')][_0x1169('0x42')]){_0xe6897a['include']=[{'all':!![]}];}_0xe6897a=_['merge']({},_0xe6897a,_0x2863f9[_0x1169('0x3a')]);return db[_0x1169('0x3c')][_0x1169('0x4b')](_0xe6897a)['then'](handleEntityNotFound(_0x4ede5a,null))[_0x1169('0x24')](function(_0x19e50c){if(_0x19e50c){var _0x4f6932=_0x19e50c[_0x1169('0x25')]({'plain':!![]});_0x4f6932=qs[_0x1169('0x51')](_0x4f6932,['id',_0x1169('0x52'),_0x1169('0x53')]);_0x2863f9[_0x1169('0x45')]=_[_0x1169('0x51')](_0x2863f9[_0x1169('0x45')],['id','createdAt','updatedAt']);return db[_0x1169('0x3c')][_0x1169('0x44')](_[_0x1169('0x43')](_0x4f6932,_0x2863f9[_0x1169('0x45')]),{'include':_0x2863f9[_0x1169('0x2d')][_0x1169('0x42')]?[{'all':!![]}]:undefined})[_0x1169('0x24')](function(_0x1bd652){var _0x5c2437=_0x2863f9[_0x1169('0x46')]['get']({'plain':!![]});if(!_0x5c2437)throw new Error(_0x1169('0x47'));if(_0x5c2437[_0x1169('0x48')]===_0x1169('0x46')){var _0x5da8ef=_0x1bd652['get']({'plain':!![]});var _0x2cf9b7=_0x1169('0x49');return db[_0x1169('0x4a')][_0x1169('0x4b')]({'where':{'name':_0x2cf9b7,'userProfileId':_0x5c2437[_0x1169('0x4c')]},'raw':!![]})[_0x1169('0x24')](function(_0x4737f6){if(_0x4737f6&&_0x4737f6[_0x1169('0x4d')]===0x0){return db[_0x1169('0x4e')][_0x1169('0x44')]({'name':_0x5da8ef['name'],'resourceId':_0x5da8ef['id'],'type':_0x4737f6[_0x1169('0x29')],'sectionId':_0x4737f6['id']},{})[_0x1169('0x24')](function(){return _0x1bd652;});}else{return _0x1bd652;}})[_0x1169('0x3f')](function(_0x1bdb56){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bdb56);throw _0x1bdb56;});}return _0x1bd652;});}})[_0x1169('0x24')](respondWithResult(_0x4ede5a,0xc9))[_0x1169('0x3f')](handleError(_0x4ede5a,null));};exports['update']=function(_0x156d74,_0x2a2f83){if(_0x156d74[_0x1169('0x45')]['id']){delete _0x156d74['body']['id'];}return db['JscriptyProject'][_0x1169('0x4b')]({'where':{'id':_0x156d74[_0x1169('0x54')]['id']}})[_0x1169('0x24')](handleEntityNotFound(_0x2a2f83,null))[_0x1169('0x24')](saveUpdates(_0x156d74[_0x1169('0x45')],null))[_0x1169('0x24')](respondWithResult(_0x2a2f83,null))['catch'](handleError(_0x2a2f83,null));};exports['destroy']=function(_0x3e0cb0,_0xd97aa8){return db['JscriptyProject'][_0x1169('0x4b')]({'where':{'id':_0x3e0cb0[_0x1169('0x54')]['id']}})['then'](handleEntityNotFound(_0xd97aa8,null))[_0x1169('0x24')](removeEntity(_0xd97aa8,null))[_0x1169('0x3f')](handleError(_0xd97aa8,null));};exports[_0x1169('0x55')]=function(_0x19e7b8,_0x3e8114,_0x10b230){var _0x3b67c0={'raw':!![],'where':{}};var _0x51e5a6={};var _0x58d4bd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x1169('0x56')]({'where':{'id':_0x19e7b8[_0x1169('0x54')]['id']}})[_0x1169('0x24')](handleEntityNotFound(_0x3e8114,null))[_0x1169('0x24')](function(_0x3ac07d){if(_0x3ac07d){_0x51e5a6[_0x1169('0x2c')]=_['keys'](db[_0x1169('0x57')][_0x1169('0x41')]);_0x51e5a6['query']=_[_0x1169('0x2e')](_0x19e7b8[_0x1169('0x2d')]);_0x51e5a6[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x51e5a6[_0x1169('0x2c')],_0x51e5a6[_0x1169('0x2d')]);_0x3b67c0['attributes']=_[_0x1169('0x30')](_0x51e5a6[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x19e7b8['query'][_0x1169('0x32')]));_0x3b67c0['attributes']=_0x3b67c0['attributes'][_0x1169('0x33')]?_0x3b67c0[_0x1169('0x31')]:_0x51e5a6[_0x1169('0x2c')];if(!_0x19e7b8['query'][_0x1169('0x34')](_0x1169('0x58'))){_0x3b67c0[_0x1169('0x1d')]=qs[_0x1169('0x1d')](_0x19e7b8[_0x1169('0x2d')][_0x1169('0x1d')]);_0x3b67c0['offset']=qs[_0x1169('0x1b')](_0x19e7b8['query']['offset']);}_0x3b67c0[_0x1169('0x59')]=qs[_0x1169('0x35')](_0x19e7b8[_0x1169('0x2d')]['sort']);_0x3b67c0[_0x1169('0x38')]=qs[_0x1169('0x2f')](_[_0x1169('0x36')](_0x19e7b8[_0x1169('0x2d')],_0x51e5a6[_0x1169('0x2f')]));_0x3b67c0[_0x1169('0x38')][_0x1169('0x5a')]=_0x3ac07d['id'];if(_0x19e7b8['query'][_0x1169('0x37')]){_0x3b67c0[_0x1169('0x38')]=_[_0x1169('0x43')](_0x3b67c0[_0x1169('0x38')],{'$or':_[_0x1169('0x2a')](_0x3b67c0[_0x1169('0x31')],function(_0x28f45c){var _0x24979b={};_0x24979b[_0x28f45c]={'$like':'%'+_0x19e7b8[_0x1169('0x2d')][_0x1169('0x37')]+'%'};return _0x24979b;})});}_0x3b67c0=_[_0x1169('0x43')]({},_0x3b67c0,_0x19e7b8[_0x1169('0x3a')]);return db[_0x1169('0x57')][_0x1169('0x1e')]({'where':_0x3b67c0[_0x1169('0x38')]})[_0x1169('0x24')](function(_0x52314b){_0x58d4bd[_0x1169('0x1e')]=_0x52314b;if(_0x19e7b8[_0x1169('0x2d')][_0x1169('0x42')]){_0x3b67c0[_0x1169('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1169('0x3d')](_0x3b67c0);})[_0x1169('0x24')](function(_0x1585fe){_0x58d4bd[_0x1169('0x3e')]=_0x1585fe;return _0x58d4bd;});}})['then'](respondWithFilteredResult(_0x3e8114,_0x3b67c0))[_0x1169('0x3f')](handleError(_0x3e8114,null));};exports[_0x1169('0x5b')]=function(_0x10847e,_0x2ee5e3,_0x5ece74){var _0x1a3c90={'raw':!![],'where':{}};var _0x5159ab={};var _0x36fbfd={'count':0x0,'rows':[]};return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x10847e[_0x1169('0x54')]['id']}})[_0x1169('0x24')](handleEntityNotFound(_0x2ee5e3,null))[_0x1169('0x24')](function(_0xfaa12c){if(_0xfaa12c){_0x5159ab[_0x1169('0x2c')]=_[_0x1169('0x2e')](db[_0x1169('0x5c')]['rawAttributes']);_0x5159ab[_0x1169('0x2d')]=_[_0x1169('0x2e')](_0x10847e[_0x1169('0x2d')]);_0x5159ab[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x5159ab[_0x1169('0x2c')],_0x5159ab[_0x1169('0x2d')]);_0x1a3c90[_0x1169('0x31')]=_[_0x1169('0x30')](_0x5159ab[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x10847e[_0x1169('0x2d')][_0x1169('0x32')]));_0x1a3c90[_0x1169('0x31')]=_0x1a3c90[_0x1169('0x31')][_0x1169('0x33')]?_0x1a3c90[_0x1169('0x31')]:_0x5159ab['model'];if(!_0x10847e['query'][_0x1169('0x34')](_0x1169('0x58'))){_0x1a3c90[_0x1169('0x1d')]=qs[_0x1169('0x1d')](_0x10847e[_0x1169('0x2d')]['limit']);_0x1a3c90[_0x1169('0x1b')]=qs['offset'](_0x10847e['query'][_0x1169('0x1b')]);}_0x1a3c90[_0x1169('0x59')]=qs[_0x1169('0x35')](_0x10847e['query'][_0x1169('0x35')]);_0x1a3c90[_0x1169('0x38')]=qs[_0x1169('0x2f')](_[_0x1169('0x36')](_0x10847e['query'],_0x5159ab[_0x1169('0x2f')]));_0x1a3c90[_0x1169('0x38')][_0x1169('0x5a')]=_0xfaa12c['id'];if(_0x10847e['query'][_0x1169('0x37')]){_0x1a3c90['where']=_[_0x1169('0x43')](_0x1a3c90[_0x1169('0x38')],{'$or':_['map'](_0x1a3c90['attributes'],function(_0xd6ef34){var _0x58740d={};_0x58740d[_0xd6ef34]={'$like':'%'+_0x10847e[_0x1169('0x2d')][_0x1169('0x37')]+'%'};return _0x58740d;})});}_0x1a3c90=_[_0x1169('0x43')]({},_0x1a3c90,_0x10847e['options']);return db[_0x1169('0x5c')][_0x1169('0x1e')]({'where':_0x1a3c90[_0x1169('0x38')]})[_0x1169('0x24')](function(_0x4d3dfc){_0x36fbfd[_0x1169('0x1e')]=_0x4d3dfc;if(_0x10847e['query'][_0x1169('0x42')]){_0x1a3c90[_0x1169('0x3b')]=[{'all':!![]}];}return db[_0x1169('0x5c')][_0x1169('0x3d')](_0x1a3c90);})['then'](function(_0x496e54){_0x36fbfd[_0x1169('0x3e')]=_0x496e54;return _0x36fbfd;});}})[_0x1169('0x24')](respondWithFilteredResult(_0x2ee5e3,_0x1a3c90))[_0x1169('0x3f')](handleError(_0x2ee5e3,null));};function char(_0x2f8ad5){return _0x1169('0x5d')===typeof _0x2f8ad5?String[_0x1169('0x5e')][_0x1169('0x20')](null,arguments):_0x2f8ad5;}function needsEncapsulation(_0x34f006){return!!_0x34f006&&(_0x34f006['toString']()[_0x1169('0x5f')](char(0xd))>=0x0||_0x34f006[_0x1169('0x60')]()[_0x1169('0x5f')](char(0xa))>=0x0||_0x34f006[_0x1169('0x60')]()[_0x1169('0x5f')](char(0x2c))>=0x0||_0x34f006[_0x1169('0x60')]()[_0x1169('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x49fbd4){var _0x2bb509=char(0x22),_0x131d83='\x5c'+char(0x22),_0x19dd17=_0x49fbd4[_0x1169('0x60')]()[_0x1169('0x61')](new RegExp(_0x2bb509,'g'),_0x131d83);return _0x2bb509+_0x19dd17+_0x2bb509;}exports['getSummary']=function(_0x1d4bfc,_0x44b712,_0x325b5b){var _0x1776da,_0x40b47f;var _0x20a3a0={'where':{'ProjectId':_0x1d4bfc['params']['id']}};if(_0x1d4bfc[_0x1169('0x2d')][_0x1169('0x62')]){_0x20a3a0[_0x1169('0x38')][_0x1169('0x63')]=JSON['parse'](_0x1d4bfc[_0x1169('0x2d')]['startTime']);}return db[_0x1169('0x57')][_0x1169('0x3d')](_0x20a3a0)['then'](handleEntityNotFound(_0x44b712,null))[_0x1169('0x24')](function(_0x424ccc){if(_0x424ccc){_0x1776da=_0x424ccc;return db[_0x1169('0x64')][_0x1169('0x3d')]({'where':{'SessionId':{'$in':_[_0x1169('0x2a')](_0x1776da,'id')},'ProjectId':_0x1d4bfc[_0x1169('0x54')]['id']},'order':_0x1169('0x65')});}})[_0x1169('0x24')](handleEntityNotFound(_0x44b712,null))['then'](function(_0x23a2ba){if(_0x23a2ba){_0x40b47f=_0x23a2ba;var _0x5290a0={};for(var _0x2f097e=0x0,_0x11e7d0=_0x40b47f[_0x1169('0x33')];_0x2f097e<_0x11e7d0;_0x2f097e++){if(!_0x5290a0[_0x1169('0x34')](_0x40b47f[_0x2f097e][_0x1169('0x66')])){_0x5290a0[_0x40b47f[_0x2f097e][_0x1169('0x66')]]=needsEncapsulation(_0x40b47f[_0x2f097e][_0x1169('0x67')])?encapsulate(_0x40b47f[_0x2f097e]['question']):_0x40b47f[_0x2f097e]['question'];}}var _0x1dbe5b=[],_0x1e0f78={};for(var _0x27805f=0x0,_0x105ad1=_0x1776da[_0x1169('0x33')];_0x27805f<_0x105ad1;_0x27805f++){_0x1e0f78={'ProjectId':_0x1d4bfc[_0x1169('0x54')]['id'],'SessionId':_0x1776da[_0x27805f]['id'],'StartTime':moment(_0x1776da[_0x27805f][_0x1169('0x63')])[_0x1169('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x39a7b0=0x0,_0x299b63=_0x40b47f[_0x1169('0x33')];_0x39a7b0<_0x299b63;_0x39a7b0++){if(_0x40b47f[_0x39a7b0][_0x1169('0x69')]==_0x1776da[_0x27805f]['id']&&_0x5290a0['hasOwnProperty'](_0x40b47f[_0x39a7b0][_0x1169('0x66')])){_0x1e0f78[_0x5290a0[_0x40b47f[_0x39a7b0]['questionId']]]=_0x40b47f[_0x39a7b0][_0x1169('0x6a')];}}for(var _0x10c81e in _0x5290a0){if(!_0x1e0f78[_0x1169('0x34')](_0x5290a0[_0x10c81e])){_0x1e0f78[_0x5290a0[_0x10c81e]]=null;}}_0x1dbe5b[_0x1169('0x6b')](_0x1e0f78);}return _0x1dbe5b;}})['then'](function(_0x458107){if(!_[_0x1169('0x6c')](_0x458107)){var _0x4a8597=toCsv(_0x458107);var _0x4ba64d=Date['now']();fs['writeFileSync'](util[_0x1169('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1d4bfc[_0x1169('0x54')]['id'],_0x4ba64d),_0x4a8597);_0x44b712['setHeader'](_0x1169('0x6d'),_0x1169('0x6e')+util[_0x1169('0x68')](_0x1169('0x6f'),_0x1d4bfc[_0x1169('0x54')]['id'],_0x4ba64d));_0x44b712[_0x1169('0x70')](_0x1169('0x71'),'text/csv');return _0x44b712[_0x1169('0x72')](util[_0x1169('0x68')](_0x1169('0x73'),_0x1d4bfc[_0x1169('0x54')]['id'],_0x4ba64d));}else{return _0x44b712['sendStatus'](0xcc);}})[_0x1169('0x3f')](handleError(_0x44b712,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4ba2378..dc0b4dc 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 _0x8098=['define','jscripty_projects','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x8098,0x1ba));var _0x8809=function(_0x2414a4,_0x40295){_0x2414a4=_0x2414a4-0x0;var _0x2520fb=_0x8098[_0x2414a4];return _0x2520fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8809('0x0'))(_0x8809('0x1'));var moment=require(_0x8809('0x2'));var BPromise=require(_0x8809('0x3'));var rp=require(_0x8809('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8809('0x5'));var config=require(_0x8809('0x6'));var attributes=require(_0x8809('0x7'));module[_0x8809('0x8')]=function(_0x5804f0,_0xeb811){return _0x5804f0[_0x8809('0x9')]('JscriptyProject',attributes,{'tableName':_0x8809('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3c5=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x34b245,_0xfe65b4){_0x34b245=_0x34b245-0x0;var _0x3a8984=_0xe3c5[_0x34b245];return _0x3a8984;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var moment=require(_0x5e3c('0x4'));var BPromise=require(_0x5e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3c('0x6'));var rimraf=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var attributes=require(_0x5e3c('0x9'));module[_0x5e3c('0xa')]=function(_0x31a878,_0x1e631d){return _0x31a878[_0x5e3c('0xb')](_0x5e3c('0xc'),attributes,{'tableName':_0x5e3c('0xd'),'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 b38a2da..807c20e 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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x16fd24,_0x55dd7f){_0x16fd24=_0x16fd24-0x0;var _0x5a2b0d=_0xac4a[_0x16fd24];return _0x5a2b0d;};'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 _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(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xac4a,0x13f));var _0xaac4=function(_0x2ee8df,_0x1329ec){_0x2ee8df=_0x2ee8df-0x0;var _0x56db82=_0xac4a[_0x2ee8df];return _0x56db82;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ad5fb1f..7e26276 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 _0x1278=['isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x44f227,_0x82a21d){var _0x5b3928=function(_0x280ade){while(--_0x280ade){_0x44f227['push'](_0x44f227['shift']());}};_0x5b3928(++_0x82a21d);}(_0x1278,0x7e));var _0x8127=function(_0x390c42,_0x10e1ae){_0x390c42=_0x390c42-0x0;var _0x43894c=_0x1278[_0x390c42];return _0x43894c;};'use strict';var multer=require(_0x8127('0x0'));var util=require(_0x8127('0x1'));var path=require(_0x8127('0x2'));var timeout=require(_0x8127('0x3'));var express=require(_0x8127('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8127('0x5'));var interaction=require(_0x8127('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x8127('0x7')](),controller[_0x8127('0x8')]);router[_0x8127('0x9')](_0x8127('0xa'),auth[_0x8127('0x7')](),controller[_0x8127('0xb')]);router[_0x8127('0x9')](_0x8127('0xc'),auth['isAuthenticated'](),controller[_0x8127('0xd')]);router['post']('/',auth[_0x8127('0x7')](),controller[_0x8127('0xe')]);router[_0x8127('0xf')](_0x8127('0xc'),auth[_0x8127('0x7')](),controller[_0x8127('0x10')]);router[_0x8127('0x11')](_0x8127('0xc'),auth[_0x8127('0x7')](),controller[_0x8127('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9bef=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','post','exports','multer','util'];(function(_0x11731f,_0x2271b5){var _0x14587c=function(_0x31e014){while(--_0x31e014){_0x11731f['push'](_0x11731f['shift']());}};_0x14587c(++_0x2271b5);}(_0x9bef,0xe8));var _0xf9be=function(_0x3d4e63,_0x2df581){_0x3d4e63=_0x3d4e63-0x0;var _0x497db1=_0x9bef[_0x3d4e63];return _0x497db1;};'use strict';var multer=require(_0xf9be('0x0'));var util=require(_0xf9be('0x1'));var path=require(_0xf9be('0x2'));var timeout=require(_0xf9be('0x3'));var express=require(_0xf9be('0x4'));var router=express[_0xf9be('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf9be('0x6'));var interaction=require(_0xf9be('0x7'));var config=require(_0xf9be('0x8'));var controller=require(_0xf9be('0x9'));router[_0xf9be('0xa')]('/',auth[_0xf9be('0xb')](),controller[_0xf9be('0xc')]);router[_0xf9be('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xf9be('0xd')]);router[_0xf9be('0xa')](_0xf9be('0xe'),auth[_0xf9be('0xb')](),controller[_0xf9be('0xf')]);router[_0xf9be('0x10')]('/',auth[_0xf9be('0xb')](),controller['create']);router['put'](_0xf9be('0xe'),auth[_0xf9be('0xb')](),controller['update']);router['delete'](_0xf9be('0xe'),auth[_0xf9be('0xb')](),controller['destroy']);module[_0xf9be('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4a655c3..942d42d 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x3385af,_0x528180){_0x3385af=_0x3385af-0x0;var _0x38b010=_0x7a54[_0x3385af];return _0x38b010;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x15fd4e,_0x16e683){_0x15fd4e=_0x15fd4e-0x0;var _0x413f54=_0x7a54[_0x15fd4e];return _0x413f54;};'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 c4e2fb1..d0875c3 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 _0xfeea=['VIRTUAL','merge','options','JscriptyQuestionReport','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','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','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0xfeea,0xf7));var _0xafee=function(_0x395667,_0x45593a){_0x395667=_0x395667-0x0;var _0x5cdb8f=_0xfeea[_0x395667];return _0x5cdb8f;};'use strict';var emlformat=require(_0xafee('0x0'));var rimraf=require(_0xafee('0x1'));var zipdir=require(_0xafee('0x2'));var jsonpatch=require(_0xafee('0x3'));var rp=require('request-promise');var moment=require(_0xafee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xafee('0x5'));var util=require(_0xafee('0x6'));var path=require(_0xafee('0x7'));var sox=require('sox');var csv=require(_0xafee('0x8'));var ejs=require(_0xafee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafee('0xa'));var squel=require(_0xafee('0xb'));var crypto=require(_0xafee('0xc'));var jsforce=require(_0xafee('0xd'));var deskjs=require(_0xafee('0xe'));var toCsv=require(_0xafee('0x8'));var querystring=require(_0xafee('0xf'));var Papa=require('papaparse');var Redis=require(_0xafee('0x10'));var authService=require(_0xafee('0x11'));var qs=require(_0xafee('0x12'));var as=require(_0xafee('0x13'));var hardwareService=require(_0xafee('0x14'));var logger=require(_0xafee('0x15'))(_0xafee('0x16'));var utils=require('../../config/utils');var config=require(_0xafee('0x17'));var licenseUtil=require(_0xafee('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45858a,_0x1a9004){_0x1a9004=_0x1a9004||0xcc;return function(_0x4c1461){if(_0x4c1461){return _0x45858a[_0xafee('0x19')](_0x1a9004);}return _0x45858a[_0xafee('0x1a')](_0x1a9004)['end']();};}function respondWithResult(_0x6a3f57,_0x5c68a8){_0x5c68a8=_0x5c68a8||0xc8;return function(_0x977798){if(_0x977798){return _0x6a3f57[_0xafee('0x1a')](_0x5c68a8)['json'](_0x977798);}};}function respondWithFilteredResult(_0x256fc5,_0x235b93){return function(_0x6ccfae){if(_0x6ccfae){var _0x2a0825=typeof _0x235b93[_0xafee('0x1b')]===_0xafee('0x1c')&&typeof _0x235b93['limit']==='undefined';var _0xf676c5=_0x6ccfae[_0xafee('0x1d')];var _0x3de24a=_0x2a0825?0x0:_0x235b93['offset'];var _0x4a77f9=_0x2a0825?_0x6ccfae['count']:_0x235b93['offset']+_0x235b93[_0xafee('0x1e')];var _0x152b6f;if(_0x4a77f9>=_0xf676c5){_0x4a77f9=_0xf676c5;_0x152b6f=0xc8;}else{_0x152b6f=0xce;}_0x256fc5[_0xafee('0x1a')](_0x152b6f);return _0x256fc5[_0xafee('0x1f')](_0xafee('0x20'),_0x3de24a+'-'+_0x4a77f9+'/'+_0xf676c5)[_0xafee('0x21')](_0x6ccfae);}return null;};}function patchUpdates(_0x18e62b){return function(_0x15b12e){try{jsonpatch[_0xafee('0x22')](_0x15b12e,_0x18e62b,!![]);}catch(_0x250224){return BPromise[_0xafee('0x23')](_0x250224);}return _0x15b12e['save']();};}function saveUpdates(_0x3b8ddf,_0x514f01){return function(_0xc7c699){if(_0xc7c699){return _0xc7c699[_0xafee('0x24')](_0x3b8ddf)[_0xafee('0x25')](function(_0x13493c){return _0x13493c;});}return null;};}function removeEntity(_0x50602e,_0x127281){return function(_0x48ca11){if(_0x48ca11){return _0x48ca11['destroy']()[_0xafee('0x25')](function(){_0x50602e[_0xafee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ded05,_0x391d1f){return function(_0x15d545){if(!_0x15d545){_0x3ded05['sendStatus'](0x194);}return _0x15d545;};}function handleError(_0x3308fa,_0x40849f){_0x40849f=_0x40849f||0x1f4;return function(_0x3993f6){logger[_0xafee('0x26')](_0x3993f6[_0xafee('0x27')]);if(_0x3993f6[_0xafee('0x28')]){delete _0x3993f6[_0xafee('0x28')];}_0x3308fa[_0xafee('0x1a')](_0x40849f)['send'](_0x3993f6);};}exports[_0xafee('0x29')]=function(_0x36c699,_0x473b12){var _0x54a395={},_0x24f999={},_0x522d6a={'count':0x0,'rows':[]};var _0x46c125=_[_0xafee('0x2a')](db['JscriptyQuestionReport'][_0xafee('0x2b')],function(_0x1f41ce){return{'name':_0x1f41ce[_0xafee('0x2c')],'type':_0x1f41ce[_0xafee('0x2d')][_0xafee('0x2e')]};});_0x24f999[_0xafee('0x2f')]=_[_0xafee('0x2a')](_0x46c125,_0xafee('0x28'));_0x24f999[_0xafee('0x30')]=_[_0xafee('0x31')](_0x36c699[_0xafee('0x30')]);_0x24f999[_0xafee('0x32')]=_[_0xafee('0x33')](_0x24f999[_0xafee('0x2f')],_0x24f999['query']);_0x54a395[_0xafee('0x34')]=_['intersection'](_0x24f999[_0xafee('0x2f')],qs[_0xafee('0x35')](_0x36c699[_0xafee('0x30')][_0xafee('0x35')]));_0x54a395[_0xafee('0x34')]=_0x54a395['attributes']['length']?_0x54a395[_0xafee('0x34')]:_0x24f999[_0xafee('0x2f')];if(!_0x36c699[_0xafee('0x30')][_0xafee('0x36')](_0xafee('0x37'))){_0x54a395[_0xafee('0x1e')]=qs['limit'](_0x36c699[_0xafee('0x30')][_0xafee('0x1e')]);_0x54a395[_0xafee('0x1b')]=qs[_0xafee('0x1b')](_0x36c699[_0xafee('0x30')][_0xafee('0x1b')]);}_0x54a395[_0xafee('0x38')]=qs['sort'](_0x36c699['query'][_0xafee('0x39')]);_0x54a395[_0xafee('0x3a')]=qs[_0xafee('0x32')](_[_0xafee('0x3b')](_0x36c699[_0xafee('0x30')],_0x24f999['filters']),_0x46c125);if(_0x36c699['query'][_0xafee('0x3c')]){_0x54a395[_0xafee('0x3a')]=_['merge'](_0x54a395['where'],{'$or':_[_0xafee('0x2a')](_0x46c125,function(_0x12781f){if(_0x12781f[_0xafee('0x2d')]!==_0xafee('0x3d')){var _0x2013e0={};_0x2013e0[_0x12781f[_0xafee('0x28')]]={'$like':'%'+_0x36c699[_0xafee('0x30')]['filter']+'%'};return _0x2013e0;}})});}_0x54a395=_[_0xafee('0x3e')]({},_0x54a395,_0x36c699[_0xafee('0x3f')]);var _0x65ff1b={'where':_0x54a395['where']};return db[_0xafee('0x40')][_0xafee('0x1d')](_0x65ff1b)[_0xafee('0x25')](function(_0x2d36d4){_0x522d6a[_0xafee('0x1d')]=_0x2d36d4;if(_0x36c699[_0xafee('0x30')]['includeAll']){_0x54a395[_0xafee('0x41')]=[{'all':!![]}];}return db[_0xafee('0x40')][_0xafee('0x42')](_0x54a395);})['then'](function(_0x620784){_0x522d6a[_0xafee('0x43')]=_0x620784;return _0x522d6a;})[_0xafee('0x25')](respondWithFilteredResult(_0x473b12,_0x54a395))[_0xafee('0x44')](handleError(_0x473b12,null));};exports[_0xafee('0x45')]=function(_0x117109,_0x4e154f){var _0x28dc6f={'raw':!![],'where':{'id':_0x117109[_0xafee('0x46')]['id']}},_0x95b0d0={};_0x95b0d0['model']=_[_0xafee('0x31')](db[_0xafee('0x40')][_0xafee('0x2b')]);_0x95b0d0['query']=_[_0xafee('0x31')](_0x117109[_0xafee('0x30')]);_0x95b0d0[_0xafee('0x32')]=_[_0xafee('0x33')](_0x95b0d0['model'],_0x95b0d0[_0xafee('0x30')]);_0x28dc6f[_0xafee('0x34')]=_[_0xafee('0x33')](_0x95b0d0['model'],qs[_0xafee('0x35')](_0x117109[_0xafee('0x30')][_0xafee('0x35')]));_0x28dc6f['attributes']=_0x28dc6f[_0xafee('0x34')][_0xafee('0x47')]?_0x28dc6f['attributes']:_0x95b0d0[_0xafee('0x2f')];if(_0x117109[_0xafee('0x30')]['includeAll']){_0x28dc6f[_0xafee('0x41')]=[{'all':!![]}];}_0x28dc6f=_[_0xafee('0x3e')]({},_0x28dc6f,_0x117109[_0xafee('0x3f')]);return db[_0xafee('0x40')][_0xafee('0x48')](_0x28dc6f)['then'](handleEntityNotFound(_0x4e154f,null))[_0xafee('0x25')](respondWithResult(_0x4e154f,null))[_0xafee('0x44')](handleError(_0x4e154f,null));};exports[_0xafee('0x49')]=function(_0x22b6fc,_0x355ec7){return db[_0xafee('0x40')][_0xafee('0x49')](_0x22b6fc[_0xafee('0x4a')],{})[_0xafee('0x25')](respondWithResult(_0x355ec7,0xc9))[_0xafee('0x44')](handleError(_0x355ec7,null));};exports['update']=function(_0x36731d,_0x1710c2){if(_0x36731d[_0xafee('0x4a')]['id']){delete _0x36731d[_0xafee('0x4a')]['id'];}return db['JscriptyQuestionReport'][_0xafee('0x48')]({'where':{'id':_0x36731d[_0xafee('0x46')]['id']}})[_0xafee('0x25')](handleEntityNotFound(_0x1710c2,null))[_0xafee('0x25')](saveUpdates(_0x36731d[_0xafee('0x4a')],null))[_0xafee('0x25')](respondWithResult(_0x1710c2,null))['catch'](handleError(_0x1710c2,null));};exports[_0xafee('0x4b')]=function(_0x1389f7,_0x5c905c){return db[_0xafee('0x40')][_0xafee('0x48')]({'where':{'id':_0x1389f7[_0xafee('0x46')]['id']}})[_0xafee('0x25')](handleEntityNotFound(_0x5c905c,null))[_0xafee('0x25')](removeEntity(_0x5c905c,null))[_0xafee('0x44')](handleError(_0x5c905c,null));};exports['describe']=function(_0x3e2b72,_0x44846d){return db[_0xafee('0x40')][_0xafee('0x4c')]()[_0xafee('0x25')](respondWithResult(_0x44846d,null))[_0xafee('0x44')](handleError(_0x44846d,null));}; \ No newline at end of file +var _0xaff2=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','merge','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xaff2,0x15d));var _0x2aff=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xaff2[_0x28f1de];return _0x5b5dad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2aff('0x0'));var zipdir=require(_0x2aff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2aff('0x2'));var moment=require('moment');var BPromise=require(_0x2aff('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2aff('0x4'));var sox=require(_0x2aff('0x5'));var csv=require(_0x2aff('0x6'));var ejs=require(_0x2aff('0x7'));var fs=require('fs');var fs_extra=require(_0x2aff('0x8'));var _=require(_0x2aff('0x9'));var squel=require(_0x2aff('0xa'));var crypto=require(_0x2aff('0xb'));var jsforce=require(_0x2aff('0xc'));var deskjs=require(_0x2aff('0xd'));var toCsv=require(_0x2aff('0x6'));var querystring=require(_0x2aff('0xe'));var Papa=require(_0x2aff('0xf'));var Redis=require(_0x2aff('0x10'));var authService=require(_0x2aff('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2aff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aff('0x13'))(_0x2aff('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2aff('0x15'));var db=require(_0x2aff('0x16'))['db'];function respondWithStatusCode(_0x24d37c,_0x337d23){_0x337d23=_0x337d23||0xcc;return function(_0x1ebb7f){if(_0x1ebb7f){return _0x24d37c[_0x2aff('0x17')](_0x337d23);}return _0x24d37c[_0x2aff('0x18')](_0x337d23)[_0x2aff('0x19')]();};}function respondWithResult(_0x1d05c0,_0xca0ab2){_0xca0ab2=_0xca0ab2||0xc8;return function(_0x4fb0d9){if(_0x4fb0d9){return _0x1d05c0[_0x2aff('0x18')](_0xca0ab2)['json'](_0x4fb0d9);}};}function respondWithFilteredResult(_0x4c1ed1,_0x11ce66){return function(_0x1c2dff){if(_0x1c2dff){var _0xa37f30=typeof _0x11ce66[_0x2aff('0x1a')]==='undefined'&&typeof _0x11ce66[_0x2aff('0x1b')]===_0x2aff('0x1c');var _0x578b7f=_0x1c2dff[_0x2aff('0x1d')];var _0x4c8f02=_0xa37f30?0x0:_0x11ce66[_0x2aff('0x1a')];var _0x128b85=_0xa37f30?_0x1c2dff[_0x2aff('0x1d')]:_0x11ce66['offset']+_0x11ce66[_0x2aff('0x1b')];var _0x5516a6;if(_0x128b85>=_0x578b7f){_0x128b85=_0x578b7f;_0x5516a6=0xc8;}else{_0x5516a6=0xce;}_0x4c1ed1[_0x2aff('0x18')](_0x5516a6);return _0x4c1ed1[_0x2aff('0x1e')](_0x2aff('0x1f'),_0x4c8f02+'-'+_0x128b85+'/'+_0x578b7f)[_0x2aff('0x20')](_0x1c2dff);}return null;};}function patchUpdates(_0x2478cc){return function(_0x435a4e){try{jsonpatch[_0x2aff('0x21')](_0x435a4e,_0x2478cc,!![]);}catch(_0x2abf69){return BPromise[_0x2aff('0x22')](_0x2abf69);}return _0x435a4e[_0x2aff('0x23')]();};}function saveUpdates(_0x3a1adf,_0x168ef7){return function(_0x14c1db){if(_0x14c1db){return _0x14c1db['update'](_0x3a1adf)[_0x2aff('0x24')](function(_0x5d9b72){return _0x5d9b72;});}return null;};}function removeEntity(_0x54eca1,_0x2dd864){return function(_0x3baf1c){if(_0x3baf1c){return _0x3baf1c[_0x2aff('0x25')]()[_0x2aff('0x24')](function(){_0x54eca1[_0x2aff('0x18')](0xcc)[_0x2aff('0x19')]();});}};}function handleEntityNotFound(_0x429bc6,_0x5c8b82){return function(_0x3cde68){if(!_0x3cde68){_0x429bc6[_0x2aff('0x17')](0x194);}return _0x3cde68;};}function handleError(_0x33ae08,_0x25c501){_0x25c501=_0x25c501||0x1f4;return function(_0x37a290){logger[_0x2aff('0x26')](_0x37a290['stack']);if(_0x37a290[_0x2aff('0x27')]){delete _0x37a290['name'];}_0x33ae08[_0x2aff('0x18')](_0x25c501)['send'](_0x37a290);};}exports[_0x2aff('0x28')]=function(_0x5b3e24,_0x58f10b){var _0x4385bf={},_0x37ced5={},_0x357ba6={'count':0x0,'rows':[]};var _0x153ee3=_[_0x2aff('0x29')](db[_0x2aff('0x2a')]['rawAttributes'],function(_0x1fd892){return{'name':_0x1fd892[_0x2aff('0x2b')],'type':_0x1fd892[_0x2aff('0x2c')][_0x2aff('0x2d')]};});_0x37ced5[_0x2aff('0x2e')]=_[_0x2aff('0x29')](_0x153ee3,_0x2aff('0x27'));_0x37ced5[_0x2aff('0x2f')]=_['keys'](_0x5b3e24['query']);_0x37ced5[_0x2aff('0x30')]=_['intersection'](_0x37ced5[_0x2aff('0x2e')],_0x37ced5['query']);_0x4385bf[_0x2aff('0x31')]=_[_0x2aff('0x32')](_0x37ced5[_0x2aff('0x2e')],qs[_0x2aff('0x33')](_0x5b3e24[_0x2aff('0x2f')][_0x2aff('0x33')]));_0x4385bf[_0x2aff('0x31')]=_0x4385bf[_0x2aff('0x31')][_0x2aff('0x34')]?_0x4385bf['attributes']:_0x37ced5[_0x2aff('0x2e')];if(!_0x5b3e24['query']['hasOwnProperty']('nolimit')){_0x4385bf[_0x2aff('0x1b')]=qs[_0x2aff('0x1b')](_0x5b3e24[_0x2aff('0x2f')][_0x2aff('0x1b')]);_0x4385bf[_0x2aff('0x1a')]=qs[_0x2aff('0x1a')](_0x5b3e24['query'][_0x2aff('0x1a')]);}_0x4385bf[_0x2aff('0x35')]=qs[_0x2aff('0x36')](_0x5b3e24[_0x2aff('0x2f')][_0x2aff('0x36')]);_0x4385bf[_0x2aff('0x37')]=qs[_0x2aff('0x30')](_['pick'](_0x5b3e24[_0x2aff('0x2f')],_0x37ced5[_0x2aff('0x30')]),_0x153ee3);if(_0x5b3e24['query']['filter']){_0x4385bf[_0x2aff('0x37')]=_['merge'](_0x4385bf[_0x2aff('0x37')],{'$or':_[_0x2aff('0x29')](_0x153ee3,function(_0x541731){if(_0x541731[_0x2aff('0x2c')]!==_0x2aff('0x38')){var _0xfd350a={};_0xfd350a[_0x541731['name']]={'$like':'%'+_0x5b3e24[_0x2aff('0x2f')][_0x2aff('0x39')]+'%'};return _0xfd350a;}})});}_0x4385bf=_['merge']({},_0x4385bf,_0x5b3e24[_0x2aff('0x3a')]);var _0x32dd06={'where':_0x4385bf['where']};return db['JscriptyQuestionReport'][_0x2aff('0x1d')](_0x32dd06)[_0x2aff('0x24')](function(_0xa405c7){_0x357ba6['count']=_0xa405c7;if(_0x5b3e24[_0x2aff('0x2f')][_0x2aff('0x3b')]){_0x4385bf['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x2aff('0x3c')](_0x4385bf);})[_0x2aff('0x24')](function(_0x499b5c){_0x357ba6[_0x2aff('0x3d')]=_0x499b5c;return _0x357ba6;})[_0x2aff('0x24')](respondWithFilteredResult(_0x58f10b,_0x4385bf))[_0x2aff('0x3e')](handleError(_0x58f10b,null));};exports[_0x2aff('0x3f')]=function(_0x4546db,_0x276acb){var _0x1604d0={'raw':!![],'where':{'id':_0x4546db[_0x2aff('0x40')]['id']}},_0x201081={};_0x201081['model']=_[_0x2aff('0x41')](db[_0x2aff('0x2a')][_0x2aff('0x42')]);_0x201081['query']=_['keys'](_0x4546db[_0x2aff('0x2f')]);_0x201081['filters']=_[_0x2aff('0x32')](_0x201081['model'],_0x201081[_0x2aff('0x2f')]);_0x1604d0[_0x2aff('0x31')]=_[_0x2aff('0x32')](_0x201081[_0x2aff('0x2e')],qs[_0x2aff('0x33')](_0x4546db[_0x2aff('0x2f')]['fields']));_0x1604d0[_0x2aff('0x31')]=_0x1604d0[_0x2aff('0x31')][_0x2aff('0x34')]?_0x1604d0[_0x2aff('0x31')]:_0x201081[_0x2aff('0x2e')];if(_0x4546db['query']['includeAll']){_0x1604d0[_0x2aff('0x43')]=[{'all':!![]}];}_0x1604d0=_[_0x2aff('0x44')]({},_0x1604d0,_0x4546db[_0x2aff('0x3a')]);return db['JscriptyQuestionReport'][_0x2aff('0x45')](_0x1604d0)[_0x2aff('0x24')](handleEntityNotFound(_0x276acb,null))[_0x2aff('0x24')](respondWithResult(_0x276acb,null))['catch'](handleError(_0x276acb,null));};exports['create']=function(_0x47b5a0,_0x488f2e){return db[_0x2aff('0x2a')][_0x2aff('0x46')](_0x47b5a0[_0x2aff('0x47')],{})['then'](respondWithResult(_0x488f2e,0xc9))[_0x2aff('0x3e')](handleError(_0x488f2e,null));};exports['update']=function(_0x4398fe,_0x4de77f){if(_0x4398fe[_0x2aff('0x47')]['id']){delete _0x4398fe['body']['id'];}return db[_0x2aff('0x2a')][_0x2aff('0x45')]({'where':{'id':_0x4398fe[_0x2aff('0x40')]['id']}})[_0x2aff('0x24')](handleEntityNotFound(_0x4de77f,null))[_0x2aff('0x24')](saveUpdates(_0x4398fe[_0x2aff('0x47')],null))[_0x2aff('0x24')](respondWithResult(_0x4de77f,null))[_0x2aff('0x3e')](handleError(_0x4de77f,null));};exports[_0x2aff('0x25')]=function(_0x2a6f73,_0x3a6e3c){return db[_0x2aff('0x2a')]['find']({'where':{'id':_0x2a6f73['params']['id']}})['then'](handleEntityNotFound(_0x3a6e3c,null))['then'](removeEntity(_0x3a6e3c,null))[_0x2aff('0x3e')](handleError(_0x3a6e3c,null));};exports[_0x2aff('0x48')]=function(_0x33014d,_0x198158){return db[_0x2aff('0x2a')][_0x2aff('0x48')]()[_0x2aff('0x24')](respondWithResult(_0x198158,null))['catch'](handleError(_0x198158,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 50f676f..7d9cdb8 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 _0x0cf9=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x0cf9,0x161));var _0x90cf=function(_0x458dd7,_0xe5602b){_0x458dd7=_0x458dd7-0x0;var _0x2a12f3=_0x0cf9[_0x458dd7];return _0x2a12f3;};'use strict';var _=require(_0x90cf('0x0'));var util=require(_0x90cf('0x1'));var logger=require(_0x90cf('0x2'))(_0x90cf('0x3'));var moment=require(_0x90cf('0x4'));var BPromise=require(_0x90cf('0x5'));var rp=require(_0x90cf('0x6'));var fs=require('fs');var path=require(_0x90cf('0x7'));var rimraf=require(_0x90cf('0x8'));var config=require(_0x90cf('0x9'));var attributes=require(_0x90cf('0xa'));module[_0x90cf('0xb')]=function(_0x592332,_0x2b16ba){return _0x592332[_0x90cf('0xc')](_0x90cf('0xd'),attributes,{'tableName':_0x90cf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8674=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x8674,0x155));var _0x4867=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x8674[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x4867('0x0'));var util=require('util');var logger=require(_0x4867('0x1'))(_0x4867('0x2'));var moment=require(_0x4867('0x3'));var BPromise=require('bluebird');var rp=require(_0x4867('0x4'));var fs=require('fs');var path=require(_0x4867('0x5'));var rimraf=require(_0x4867('0x6'));var config=require(_0x4867('0x7'));var attributes=require(_0x4867('0x8'));module[_0x4867('0x9')]=function(_0x84b4,_0x43997c){return _0x84b4[_0x4867('0xa')](_0x4867('0xb'),attributes,{'tableName':_0x4867('0xc'),'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 10020d4..d06df09 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 _0x2077=['../../config/logger','../../config/environment','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x5bec9a,_0x1a9a0b){var _0x2bc769=function(_0x1fc1cc){while(--_0x1fc1cc){_0x5bec9a['push'](_0x5bec9a['shift']());}};_0x2bc769(++_0x1a9a0b);}(_0x2077,0x9a));var _0x7207=function(_0x216a0b,_0x3c1fc4){_0x216a0b=_0x216a0b-0x0;var _0x361a85=_0x2077[_0x216a0b];return _0x361a85;};'use strict';var _=require(_0x7207('0x0'));var util=require(_0x7207('0x1'));var moment=require(_0x7207('0x2'));var BPromise=require('bluebird');var rs=require(_0x7207('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7207('0x4'))['db'];var utils=require(_0x7207('0x5'));var logger=require(_0x7207('0x6'))('rpc');var config=require(_0x7207('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x249833,_0x5abe96,_0x4d36ec){return new BPromise(function(_0x25ca93,_0x3c6a6c){return client[_0x7207('0x9')](_0x249833,_0x4d36ec)[_0x7207('0xa')](function(_0x193974){logger['info'](_0x7207('0xb'),_0x5abe96,_0x7207('0xc'));logger[_0x7207('0xd')](_0x7207('0xe'),_0x5abe96,_0x7207('0xc'),JSON[_0x7207('0xf')](_0x193974));if(_0x193974[_0x7207('0x10')]){if(_0x193974[_0x7207('0x10')]['code']===0x1f4){logger[_0x7207('0x10')](_0x7207('0xb'),_0x5abe96,_0x193974['error']['message']);return _0x3c6a6c(_0x193974['error'][_0x7207('0x11')]);}logger[_0x7207('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5abe96,_0x193974[_0x7207('0x10')][_0x7207('0x11')]);return _0x25ca93(_0x193974[_0x7207('0x10')]['message']);}else{logger[_0x7207('0x12')](_0x7207('0xb'),_0x5abe96,_0x7207('0xc'));_0x25ca93(_0x193974['result']['message']);}})[_0x7207('0x13')](function(_0x549e91){logger[_0x7207('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5abe96,_0x549e91);_0x3c6a6c(_0x549e91);});});} \ No newline at end of file +var _0x4a4a=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x340a20,_0x1532be){var _0x4a1acd=function(_0xf7e962){while(--_0xf7e962){_0x340a20['push'](_0x340a20['shift']());}};_0x4a1acd(++_0x1532be);}(_0x4a4a,0x195));var _0xa4a4=function(_0x5b0f68,_0x4cc372){_0x5b0f68=_0x5b0f68-0x0;var _0x30a4ac=_0x4a4a[_0x5b0f68];return _0x30a4ac;};'use strict';var _=require('lodash');var util=require(_0xa4a4('0x0'));var moment=require('moment');var BPromise=require(_0xa4a4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4a4('0x2'));var db=require(_0xa4a4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4a4('0x4'))(_0xa4a4('0x5'));var config=require(_0xa4a4('0x6'));var jayson=require(_0xa4a4('0x7'));var client=jayson[_0xa4a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a80ce,_0x2d014f,_0x5b4f8a){return new BPromise(function(_0x38742e,_0x4b0a70){return client[_0xa4a4('0x9')](_0x5a80ce,_0x5b4f8a)[_0xa4a4('0xa')](function(_0xf6bf76){logger['info'](_0xa4a4('0xb'),_0x2d014f,_0xa4a4('0xc'));logger[_0xa4a4('0xd')](_0xa4a4('0xe'),_0x2d014f,_0xa4a4('0xc'),JSON[_0xa4a4('0xf')](_0xf6bf76));if(_0xf6bf76[_0xa4a4('0x10')]){if(_0xf6bf76[_0xa4a4('0x10')][_0xa4a4('0x11')]===0x1f4){logger[_0xa4a4('0x10')](_0xa4a4('0xb'),_0x2d014f,_0xf6bf76[_0xa4a4('0x10')][_0xa4a4('0x12')]);return _0x4b0a70(_0xf6bf76['error'][_0xa4a4('0x12')]);}logger[_0xa4a4('0x10')](_0xa4a4('0xb'),_0x2d014f,_0xf6bf76['error'][_0xa4a4('0x12')]);return _0x38742e(_0xf6bf76['error'][_0xa4a4('0x12')]);}else{logger[_0xa4a4('0x13')](_0xa4a4('0xb'),_0x2d014f,'request\x20sent');_0x38742e(_0xf6bf76[_0xa4a4('0x14')]['message']);}})[_0xa4a4('0x15')](function(_0x2ed924){logger['error'](_0xa4a4('0xb'),_0x2d014f,_0x2ed924);_0x4b0a70(_0x2ed924);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0aa70fa..a82b916 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 _0xe90a=['./jscriptySessionReport.controller','get','/describe','isAuthenticated','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1a2453,_0x5efe31){var _0x4d7d87=function(_0x4a5b6c){while(--_0x4a5b6c){_0x1a2453['push'](_0x1a2453['shift']());}};_0x4d7d87(++_0x5efe31);}(_0xe90a,0x151));var _0xae90=function(_0x2e6a69,_0x1ba014){_0x2e6a69=_0x2e6a69-0x0;var _0x583b2a=_0xe90a[_0x2e6a69];return _0x583b2a;};'use strict';var multer=require('multer');var util=require(_0xae90('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae90('0x1'));var router=express[_0xae90('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae90('0x3'));var config=require(_0xae90('0x4'));var controller=require(_0xae90('0x5'));router[_0xae90('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae90('0x6')](_0xae90('0x7'),auth[_0xae90('0x8')](),controller['describe']);router[_0xae90('0x6')](_0xae90('0x9'),auth['isAuthenticated'](),controller[_0xae90('0xa')]);router[_0xae90('0x6')](_0xae90('0xb'),auth[_0xae90('0x8')](),controller[_0xae90('0xc')]);router['post']('/',auth[_0xae90('0x8')](),controller[_0xae90('0xd')]);router[_0xae90('0xe')](_0xae90('0x9'),auth[_0xae90('0x8')](),controller[_0xae90('0xf')]);router[_0xae90('0x10')](_0xae90('0x9'),auth[_0xae90('0x8')](),controller[_0xae90('0x11')]);module[_0xae90('0x12')]=router; \ No newline at end of file +var _0x8a63=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','post','put','/:id'];(function(_0x39acdb,_0x5304b7){var _0x457203=function(_0x4c9dfc){while(--_0x4c9dfc){_0x39acdb['push'](_0x39acdb['shift']());}};_0x457203(++_0x5304b7);}(_0x8a63,0x163));var _0x38a6=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0x8a63[_0x58da8a];return _0x5294b9;};'use strict';var multer=require(_0x38a6('0x0'));var util=require(_0x38a6('0x1'));var path=require(_0x38a6('0x2'));var timeout=require(_0x38a6('0x3'));var express=require(_0x38a6('0x4'));var router=express[_0x38a6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x38a6('0x6'));var config=require(_0x38a6('0x7'));var controller=require(_0x38a6('0x8'));router[_0x38a6('0x9')]('/',auth[_0x38a6('0xa')](),controller[_0x38a6('0xb')]);router['get'](_0x38a6('0xc'),auth['isAuthenticated'](),controller[_0x38a6('0xd')]);router['get']('/:id',auth[_0x38a6('0xa')](),controller[_0x38a6('0xe')]);router[_0x38a6('0x9')](_0x38a6('0xf'),auth[_0x38a6('0xa')](),controller['getQuestions']);router[_0x38a6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x38a6('0x11')](_0x38a6('0x12'),auth[_0x38a6('0xa')](),controller[_0x38a6('0x13')]);router[_0x38a6('0x14')](_0x38a6('0x12'),auth['isAuthenticated'](),controller[_0x38a6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3ef8f5b..ea79b1d 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 _0xbe60=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime'];(function(_0x18c648,_0x367e58){var _0x59bad1=function(_0x174d6b){while(--_0x174d6b){_0x18c648['push'](_0x18c648['shift']());}};_0x59bad1(++_0x367e58);}(_0xbe60,0x1d4));var _0x0be6=function(_0x447db4,_0x550a89){_0x447db4=_0x447db4-0x0;var _0x17a797=_0xbe60[_0x447db4];return _0x17a797;};'use strict';var moment=require(_0x0be6('0x0'));var Sequelize=require(_0x0be6('0x1'));module[_0x0be6('0x2')]={'starttime':{'type':Sequelize[_0x0be6('0x3')],'set':function(_0x4385e9){this['setDataValue'](_0x0be6('0x4'),_0x4385e9);this[_0x0be6('0x5')](_0x0be6('0x6'),moment()[_0x0be6('0x7')](_0x0be6('0x8')));}},'endtime':{'type':Sequelize[_0x0be6('0x3')]},'membername':{'type':Sequelize[_0x0be6('0x9')]},'projectname':{'type':Sequelize[_0x0be6('0x9')]},'queue':{'type':Sequelize[_0x0be6('0x9')]},'uniqueid':{'type':Sequelize[_0x0be6('0x9')]},'calleridname':{'type':Sequelize[_0x0be6('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x0be6('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xed66=['moment','sequelize','exports','DATE','setDataValue','format','STRING','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xed66,0x1a0));var _0x6ed6=function(_0x2706f2,_0x9a058){_0x2706f2=_0x2706f2-0x0;var _0x595bab=_0xed66[_0x2706f2];return _0x595bab;};'use strict';var moment=require(_0x6ed6('0x0'));var Sequelize=require(_0x6ed6('0x1'));module[_0x6ed6('0x2')]={'starttime':{'type':Sequelize[_0x6ed6('0x3')],'set':function(_0x2d48e2){this[_0x6ed6('0x4')]('starttime',_0x2d48e2);this['setDataValue']('endtime',moment()[_0x6ed6('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x6ed6('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x6ed6('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6ed6('0x6')]},'calleridname':{'type':Sequelize[_0x6ed6('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x6ed6('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index eae2258..e2419ce 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 _0x4048=['crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','JscriptySessionReport','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','getQuestions','findOne','nolimit','pick','SessionId','options','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1d0e07,_0x2037e9){var _0x8912e0=function(_0x3b1c66){while(--_0x3b1c66){_0x1d0e07['push'](_0x1d0e07['shift']());}};_0x8912e0(++_0x2037e9);}(_0x4048,0x1e5));var _0x8404=function(_0x9e85af,_0x47be59){_0x9e85af=_0x9e85af-0x0;var _0x48a61f=_0x4048[_0x9e85af];return _0x48a61f;};'use strict';var emlformat=require(_0x8404('0x0'));var rimraf=require(_0x8404('0x1'));var zipdir=require(_0x8404('0x2'));var jsonpatch=require(_0x8404('0x3'));var rp=require('request-promise');var moment=require(_0x8404('0x4'));var BPromise=require(_0x8404('0x5'));var Mustache=require('mustache');var util=require(_0x8404('0x6'));var path=require(_0x8404('0x7'));var sox=require(_0x8404('0x8'));var csv=require(_0x8404('0x9'));var ejs=require(_0x8404('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8404('0xb'));var squel=require(_0x8404('0xc'));var crypto=require(_0x8404('0xd'));var jsforce=require(_0x8404('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8404('0x9'));var querystring=require('querystring');var Papa=require(_0x8404('0xf'));var Redis=require(_0x8404('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8404('0x11'));var as=require(_0x8404('0x12'));var hardwareService=require(_0x8404('0x13'));var logger=require(_0x8404('0x14'))(_0x8404('0x15'));var utils=require(_0x8404('0x16'));var config=require(_0x8404('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8404('0x18'))['db'];function respondWithStatusCode(_0x27ab99,_0x1cbbd7){_0x1cbbd7=_0x1cbbd7||0xcc;return function(_0x3c9fa3){if(_0x3c9fa3){return _0x27ab99[_0x8404('0x19')](_0x1cbbd7);}return _0x27ab99[_0x8404('0x1a')](_0x1cbbd7)[_0x8404('0x1b')]();};}function respondWithResult(_0x49d0b6,_0x56821b){_0x56821b=_0x56821b||0xc8;return function(_0x26e45d){if(_0x26e45d){return _0x49d0b6[_0x8404('0x1a')](_0x56821b)[_0x8404('0x1c')](_0x26e45d);}};}function respondWithFilteredResult(_0x4826f4,_0x6d53b2){return function(_0x31ccc2){if(_0x31ccc2){var _0x120e25=typeof _0x6d53b2[_0x8404('0x1d')]===_0x8404('0x1e')&&typeof _0x6d53b2[_0x8404('0x1f')]===_0x8404('0x1e');var _0x1951f1=_0x31ccc2[_0x8404('0x20')];var _0x383b39=_0x120e25?0x0:_0x6d53b2['offset'];var _0xf673ab=_0x120e25?_0x31ccc2[_0x8404('0x20')]:_0x6d53b2[_0x8404('0x1d')]+_0x6d53b2[_0x8404('0x1f')];var _0x2d1976;if(_0xf673ab>=_0x1951f1){_0xf673ab=_0x1951f1;_0x2d1976=0xc8;}else{_0x2d1976=0xce;}_0x4826f4['status'](_0x2d1976);return _0x4826f4[_0x8404('0x21')](_0x8404('0x22'),_0x383b39+'-'+_0xf673ab+'/'+_0x1951f1)[_0x8404('0x1c')](_0x31ccc2);}return null;};}function patchUpdates(_0x418280){return function(_0x165368){try{jsonpatch[_0x8404('0x23')](_0x165368,_0x418280,!![]);}catch(_0x20b156){return BPromise[_0x8404('0x24')](_0x20b156);}return _0x165368[_0x8404('0x25')]();};}function saveUpdates(_0x24e38f,_0x4b4b86){return function(_0x13dde1){if(_0x13dde1){return _0x13dde1[_0x8404('0x26')](_0x24e38f)['then'](function(_0x140c1d){return _0x140c1d;});}return null;};}function removeEntity(_0x4a4132,_0x4fe3c8){return function(_0x45b4ca){if(_0x45b4ca){return _0x45b4ca[_0x8404('0x27')]()[_0x8404('0x28')](function(){_0x4a4132['status'](0xcc)[_0x8404('0x1b')]();});}};}function handleEntityNotFound(_0x2cb1d0,_0x543e82){return function(_0x114e41){if(!_0x114e41){_0x2cb1d0[_0x8404('0x19')](0x194);}return _0x114e41;};}function handleError(_0x1a9d87,_0x131cf6){_0x131cf6=_0x131cf6||0x1f4;return function(_0x55b2fa){logger['error'](_0x55b2fa['stack']);if(_0x55b2fa[_0x8404('0x29')]){delete _0x55b2fa['name'];}_0x1a9d87[_0x8404('0x1a')](_0x131cf6)[_0x8404('0x2a')](_0x55b2fa);};}exports[_0x8404('0x2b')]=function(_0x332e80,_0x1e3763){var _0x2befbd={},_0x58c1cc={},_0x2b8ec3={'count':0x0,'rows':[]};var _0x31e0ae=_['map'](db[_0x8404('0x2c')]['rawAttributes'],function(_0x168c2b){return{'name':_0x168c2b[_0x8404('0x2d')],'type':_0x168c2b[_0x8404('0x2e')][_0x8404('0x2f')]};});_0x58c1cc[_0x8404('0x30')]=_[_0x8404('0x31')](_0x31e0ae,_0x8404('0x29'));_0x58c1cc['query']=_[_0x8404('0x32')](_0x332e80[_0x8404('0x33')]);_0x58c1cc[_0x8404('0x34')]=_[_0x8404('0x35')](_0x58c1cc[_0x8404('0x30')],_0x58c1cc['query']);_0x2befbd[_0x8404('0x36')]=_['intersection'](_0x58c1cc['model'],qs[_0x8404('0x37')](_0x332e80[_0x8404('0x33')][_0x8404('0x37')]));_0x2befbd[_0x8404('0x36')]=_0x2befbd[_0x8404('0x36')]['length']?_0x2befbd[_0x8404('0x36')]:_0x58c1cc[_0x8404('0x30')];if(!_0x332e80['query'][_0x8404('0x38')]('nolimit')){_0x2befbd[_0x8404('0x1f')]=qs['limit'](_0x332e80['query'][_0x8404('0x1f')]);_0x2befbd[_0x8404('0x1d')]=qs[_0x8404('0x1d')](_0x332e80[_0x8404('0x33')][_0x8404('0x1d')]);}_0x2befbd[_0x8404('0x39')]=qs[_0x8404('0x3a')](_0x332e80[_0x8404('0x33')]['sort']);_0x2befbd['where']=qs[_0x8404('0x34')](_['pick'](_0x332e80[_0x8404('0x33')],_0x58c1cc[_0x8404('0x34')]),_0x31e0ae);if(_0x332e80['query'][_0x8404('0x3b')]){_0x2befbd[_0x8404('0x3c')]=_[_0x8404('0x3d')](_0x2befbd[_0x8404('0x3c')],{'$or':_[_0x8404('0x31')](_0x31e0ae,function(_0x12ef10){if(_0x12ef10[_0x8404('0x2e')]!==_0x8404('0x3e')){var _0x2eaa10={};_0x2eaa10[_0x12ef10[_0x8404('0x29')]]={'$like':'%'+_0x332e80['query']['filter']+'%'};return _0x2eaa10;}})});}_0x2befbd=_[_0x8404('0x3d')]({},_0x2befbd,_0x332e80['options']);var _0xebe66e={'where':_0x2befbd['where']};return db['JscriptySessionReport']['count'](_0xebe66e)[_0x8404('0x28')](function(_0x1de5d4){_0x2b8ec3['count']=_0x1de5d4;if(_0x332e80[_0x8404('0x33')][_0x8404('0x3f')]){_0x2befbd[_0x8404('0x40')]=[{'all':!![]}];}return db[_0x8404('0x2c')][_0x8404('0x41')](_0x2befbd);})[_0x8404('0x28')](function(_0x4b35ae){_0x2b8ec3[_0x8404('0x42')]=_0x4b35ae;return _0x2b8ec3;})[_0x8404('0x28')](respondWithFilteredResult(_0x1e3763,_0x2befbd))[_0x8404('0x43')](handleError(_0x1e3763,null));};exports[_0x8404('0x44')]=function(_0x765c96,_0x5c6091){var _0x1f2689={'raw':!![],'where':{'id':_0x765c96[_0x8404('0x45')]['id']}},_0x84b6de={};_0x84b6de[_0x8404('0x30')]=_[_0x8404('0x32')](db[_0x8404('0x2c')][_0x8404('0x46')]);_0x84b6de[_0x8404('0x33')]=_[_0x8404('0x32')](_0x765c96[_0x8404('0x33')]);_0x84b6de['filters']=_[_0x8404('0x35')](_0x84b6de['model'],_0x84b6de[_0x8404('0x33')]);_0x1f2689[_0x8404('0x36')]=_[_0x8404('0x35')](_0x84b6de['model'],qs[_0x8404('0x37')](_0x765c96[_0x8404('0x33')][_0x8404('0x37')]));_0x1f2689[_0x8404('0x36')]=_0x1f2689['attributes'][_0x8404('0x47')]?_0x1f2689[_0x8404('0x36')]:_0x84b6de['model'];if(_0x765c96['query']['includeAll']){_0x1f2689[_0x8404('0x40')]=[{'all':!![]}];}_0x1f2689=_['merge']({},_0x1f2689,_0x765c96['options']);return db['JscriptySessionReport'][_0x8404('0x48')](_0x1f2689)[_0x8404('0x28')](handleEntityNotFound(_0x5c6091,null))[_0x8404('0x28')](respondWithResult(_0x5c6091,null))[_0x8404('0x43')](handleError(_0x5c6091,null));};exports[_0x8404('0x49')]=function(_0x58bb71,_0x23a4d4){return db[_0x8404('0x2c')][_0x8404('0x49')](_0x58bb71['body'],{})[_0x8404('0x28')](respondWithResult(_0x23a4d4,0xc9))[_0x8404('0x43')](handleError(_0x23a4d4,null));};exports[_0x8404('0x26')]=function(_0x2f2a68,_0x2f3721){if(_0x2f2a68['body']['id']){delete _0x2f2a68[_0x8404('0x4a')]['id'];}return db[_0x8404('0x2c')][_0x8404('0x48')]({'where':{'id':_0x2f2a68['params']['id']}})['then'](handleEntityNotFound(_0x2f3721,null))[_0x8404('0x28')](saveUpdates(_0x2f2a68[_0x8404('0x4a')],null))['then'](respondWithResult(_0x2f3721,null))['catch'](handleError(_0x2f3721,null));};exports['destroy']=function(_0x46602e,_0x1ba0c7){return db[_0x8404('0x2c')]['find']({'where':{'id':_0x46602e[_0x8404('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ba0c7,null))['then'](removeEntity(_0x1ba0c7,null))[_0x8404('0x43')](handleError(_0x1ba0c7,null));};exports[_0x8404('0x4b')]=function(_0x4eb3c2,_0x4aefb1){return db[_0x8404('0x2c')]['describe']()[_0x8404('0x28')](respondWithResult(_0x4aefb1,null))[_0x8404('0x43')](handleError(_0x4aefb1,null));};exports[_0x8404('0x4c')]=function(_0x142aa1,_0x5eb7a4,_0x246a0c){var _0x4ef876={'raw':!![],'where':{}};var _0x1f0c76={};var _0xf605e2={'count':0x0,'rows':[]};return db[_0x8404('0x2c')][_0x8404('0x4d')]({'where':{'id':_0x142aa1[_0x8404('0x45')]['id']}})[_0x8404('0x28')](handleEntityNotFound(_0x5eb7a4,null))[_0x8404('0x28')](function(_0x15dd25){if(_0x15dd25){_0x1f0c76[_0x8404('0x30')]=_['keys'](db['JscriptyQuestionReport'][_0x8404('0x46')]);_0x1f0c76[_0x8404('0x33')]=_[_0x8404('0x32')](_0x142aa1[_0x8404('0x33')]);_0x1f0c76[_0x8404('0x34')]=_[_0x8404('0x35')](_0x1f0c76['model'],_0x1f0c76['query']);_0x4ef876['attributes']=_['intersection'](_0x1f0c76[_0x8404('0x30')],qs[_0x8404('0x37')](_0x142aa1[_0x8404('0x33')][_0x8404('0x37')]));_0x4ef876[_0x8404('0x36')]=_0x4ef876['attributes'][_0x8404('0x47')]?_0x4ef876[_0x8404('0x36')]:_0x1f0c76[_0x8404('0x30')];if(!_0x142aa1['query'][_0x8404('0x38')](_0x8404('0x4e'))){_0x4ef876[_0x8404('0x1f')]=qs['limit'](_0x142aa1[_0x8404('0x33')]['limit']);_0x4ef876[_0x8404('0x1d')]=qs[_0x8404('0x1d')](_0x142aa1[_0x8404('0x33')][_0x8404('0x1d')]);}_0x4ef876['order']=qs[_0x8404('0x3a')](_0x142aa1['query'][_0x8404('0x3a')]);_0x4ef876['where']=qs['filters'](_[_0x8404('0x4f')](_0x142aa1[_0x8404('0x33')],_0x1f0c76[_0x8404('0x34')]));_0x4ef876['where'][_0x8404('0x50')]=_0x15dd25['id'];if(_0x142aa1[_0x8404('0x33')][_0x8404('0x3b')]){_0x4ef876[_0x8404('0x3c')]=_[_0x8404('0x3d')](_0x4ef876[_0x8404('0x3c')],{'$or':_[_0x8404('0x31')](_0x4ef876[_0x8404('0x36')],function(_0x3797c0){var _0x3651da={};_0x3651da[_0x3797c0]={'$like':'%'+_0x142aa1['query'][_0x8404('0x3b')]+'%'};return _0x3651da;})});}_0x4ef876=_[_0x8404('0x3d')]({},_0x4ef876,_0x142aa1[_0x8404('0x51')]);return db[_0x8404('0x52')][_0x8404('0x20')]({'where':_0x4ef876[_0x8404('0x3c')]})[_0x8404('0x28')](function(_0xa2bb96){_0xf605e2[_0x8404('0x20')]=_0xa2bb96;if(_0x142aa1[_0x8404('0x33')][_0x8404('0x3f')]){_0x4ef876[_0x8404('0x40')]=[{'all':!![]}];}return db[_0x8404('0x52')][_0x8404('0x41')](_0x4ef876);})[_0x8404('0x28')](function(_0x431054){_0xf605e2[_0x8404('0x42')]=_0x431054;return _0xf605e2;});}})[_0x8404('0x28')](respondWithFilteredResult(_0x5eb7a4,_0x4ef876))[_0x8404('0x43')](handleError(_0x5eb7a4,null));}; \ No newline at end of file +var _0x615d=['order','merge','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0x615d,0x142));var _0xd615=function(_0x3439bc,_0xc03879){_0x3439bc=_0x3439bc-0x0;var _0x484801=_0x615d[_0x3439bc];return _0x484801;};'use strict';var emlformat=require(_0xd615('0x0'));var rimraf=require(_0xd615('0x1'));var zipdir=require(_0xd615('0x2'));var jsonpatch=require(_0xd615('0x3'));var rp=require(_0xd615('0x4'));var moment=require('moment');var BPromise=require(_0xd615('0x5'));var Mustache=require(_0xd615('0x6'));var util=require(_0xd615('0x7'));var path=require(_0xd615('0x8'));var sox=require(_0xd615('0x9'));var csv=require(_0xd615('0xa'));var ejs=require(_0xd615('0xb'));var fs=require('fs');var fs_extra=require(_0xd615('0xc'));var _=require(_0xd615('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd615('0xe'));var deskjs=require(_0xd615('0xf'));var toCsv=require(_0xd615('0xa'));var querystring=require(_0xd615('0x10'));var Papa=require(_0xd615('0x11'));var Redis=require(_0xd615('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd615('0x13'));var as=require(_0xd615('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd615('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd615('0x16'));var db=require(_0xd615('0x17'))['db'];function respondWithStatusCode(_0xa890ce,_0x50f089){_0x50f089=_0x50f089||0xcc;return function(_0x5e3d06){if(_0x5e3d06){return _0xa890ce[_0xd615('0x18')](_0x50f089);}return _0xa890ce['status'](_0x50f089)[_0xd615('0x19')]();};}function respondWithResult(_0xc04ec,_0x3f71e5){_0x3f71e5=_0x3f71e5||0xc8;return function(_0x3235aa){if(_0x3235aa){return _0xc04ec[_0xd615('0x1a')](_0x3f71e5)[_0xd615('0x1b')](_0x3235aa);}};}function respondWithFilteredResult(_0x1d584d,_0x1111ce){return function(_0x32292b){if(_0x32292b){var _0x262492=typeof _0x1111ce[_0xd615('0x1c')]===_0xd615('0x1d')&&typeof _0x1111ce[_0xd615('0x1e')]===_0xd615('0x1d');var _0x186ccb=_0x32292b['count'];var _0x1f1bd7=_0x262492?0x0:_0x1111ce[_0xd615('0x1c')];var _0xc97ddb=_0x262492?_0x32292b[_0xd615('0x1f')]:_0x1111ce[_0xd615('0x1c')]+_0x1111ce[_0xd615('0x1e')];var _0x2e779a;if(_0xc97ddb>=_0x186ccb){_0xc97ddb=_0x186ccb;_0x2e779a=0xc8;}else{_0x2e779a=0xce;}_0x1d584d[_0xd615('0x1a')](_0x2e779a);return _0x1d584d[_0xd615('0x20')](_0xd615('0x21'),_0x1f1bd7+'-'+_0xc97ddb+'/'+_0x186ccb)[_0xd615('0x1b')](_0x32292b);}return null;};}function patchUpdates(_0x30efc8){return function(_0x5bb7bf){try{jsonpatch[_0xd615('0x22')](_0x5bb7bf,_0x30efc8,!![]);}catch(_0x1bcd48){return BPromise[_0xd615('0x23')](_0x1bcd48);}return _0x5bb7bf['save']();};}function saveUpdates(_0xa7c11c,_0x1d8d3d){return function(_0x4f2171){if(_0x4f2171){return _0x4f2171['update'](_0xa7c11c)[_0xd615('0x24')](function(_0x219802){return _0x219802;});}return null;};}function removeEntity(_0xa24bfb,_0x52a7e4){return function(_0x2231df){if(_0x2231df){return _0x2231df[_0xd615('0x25')]()[_0xd615('0x24')](function(){_0xa24bfb[_0xd615('0x1a')](0xcc)[_0xd615('0x19')]();});}};}function handleEntityNotFound(_0x2d5338,_0x90abd1){return function(_0xe6212b){if(!_0xe6212b){_0x2d5338[_0xd615('0x18')](0x194);}return _0xe6212b;};}function handleError(_0x1da2e9,_0x42142c){_0x42142c=_0x42142c||0x1f4;return function(_0xa0c4){logger[_0xd615('0x26')](_0xa0c4['stack']);if(_0xa0c4[_0xd615('0x27')]){delete _0xa0c4['name'];}_0x1da2e9[_0xd615('0x1a')](_0x42142c)[_0xd615('0x28')](_0xa0c4);};}exports[_0xd615('0x29')]=function(_0x35a647,_0x5ea77e){var _0x5e4969={},_0x30dcdc={},_0x5ca2d8={'count':0x0,'rows':[]};var _0x3ebbf5=_[_0xd615('0x2a')](db[_0xd615('0x2b')][_0xd615('0x2c')],function(_0x4862ca){return{'name':_0x4862ca[_0xd615('0x2d')],'type':_0x4862ca[_0xd615('0x2e')]['key']};});_0x30dcdc[_0xd615('0x2f')]=_[_0xd615('0x2a')](_0x3ebbf5,'name');_0x30dcdc[_0xd615('0x30')]=_[_0xd615('0x31')](_0x35a647['query']);_0x30dcdc[_0xd615('0x32')]=_[_0xd615('0x33')](_0x30dcdc[_0xd615('0x2f')],_0x30dcdc['query']);_0x5e4969['attributes']=_['intersection'](_0x30dcdc[_0xd615('0x2f')],qs[_0xd615('0x34')](_0x35a647[_0xd615('0x30')][_0xd615('0x34')]));_0x5e4969['attributes']=_0x5e4969[_0xd615('0x35')]['length']?_0x5e4969[_0xd615('0x35')]:_0x30dcdc[_0xd615('0x2f')];if(!_0x35a647[_0xd615('0x30')][_0xd615('0x36')](_0xd615('0x37'))){_0x5e4969['limit']=qs['limit'](_0x35a647[_0xd615('0x30')]['limit']);_0x5e4969['offset']=qs['offset'](_0x35a647[_0xd615('0x30')][_0xd615('0x1c')]);}_0x5e4969['order']=qs[_0xd615('0x38')](_0x35a647['query']['sort']);_0x5e4969[_0xd615('0x39')]=qs['filters'](_[_0xd615('0x3a')](_0x35a647[_0xd615('0x30')],_0x30dcdc['filters']),_0x3ebbf5);if(_0x35a647['query']['filter']){_0x5e4969[_0xd615('0x39')]=_['merge'](_0x5e4969[_0xd615('0x39')],{'$or':_[_0xd615('0x2a')](_0x3ebbf5,function(_0x1264e8){if(_0x1264e8[_0xd615('0x2e')]!==_0xd615('0x3b')){var _0x26fa76={};_0x26fa76[_0x1264e8[_0xd615('0x27')]]={'$like':'%'+_0x35a647[_0xd615('0x30')][_0xd615('0x3c')]+'%'};return _0x26fa76;}})});}_0x5e4969=_['merge']({},_0x5e4969,_0x35a647[_0xd615('0x3d')]);var _0x5c52cd={'where':_0x5e4969[_0xd615('0x39')]};return db[_0xd615('0x2b')][_0xd615('0x1f')](_0x5c52cd)['then'](function(_0x1c61ab){_0x5ca2d8[_0xd615('0x1f')]=_0x1c61ab;if(_0x35a647[_0xd615('0x30')]['includeAll']){_0x5e4969[_0xd615('0x3e')]=[{'all':!![]}];}return db[_0xd615('0x2b')][_0xd615('0x3f')](_0x5e4969);})[_0xd615('0x24')](function(_0x2bbaee){_0x5ca2d8[_0xd615('0x40')]=_0x2bbaee;return _0x5ca2d8;})[_0xd615('0x24')](respondWithFilteredResult(_0x5ea77e,_0x5e4969))[_0xd615('0x41')](handleError(_0x5ea77e,null));};exports[_0xd615('0x42')]=function(_0xa529d8,_0x54b3d0){var _0x435c4e={'raw':!![],'where':{'id':_0xa529d8[_0xd615('0x43')]['id']}},_0x36d346={};_0x36d346[_0xd615('0x2f')]=_['keys'](db['JscriptySessionReport'][_0xd615('0x2c')]);_0x36d346[_0xd615('0x30')]=_[_0xd615('0x31')](_0xa529d8['query']);_0x36d346[_0xd615('0x32')]=_['intersection'](_0x36d346['model'],_0x36d346[_0xd615('0x30')]);_0x435c4e['attributes']=_[_0xd615('0x33')](_0x36d346[_0xd615('0x2f')],qs['fields'](_0xa529d8[_0xd615('0x30')]['fields']));_0x435c4e[_0xd615('0x35')]=_0x435c4e[_0xd615('0x35')][_0xd615('0x44')]?_0x435c4e['attributes']:_0x36d346['model'];if(_0xa529d8['query'][_0xd615('0x45')]){_0x435c4e[_0xd615('0x3e')]=[{'all':!![]}];}_0x435c4e=_['merge']({},_0x435c4e,_0xa529d8[_0xd615('0x3d')]);return db[_0xd615('0x2b')][_0xd615('0x46')](_0x435c4e)[_0xd615('0x24')](handleEntityNotFound(_0x54b3d0,null))[_0xd615('0x24')](respondWithResult(_0x54b3d0,null))['catch'](handleError(_0x54b3d0,null));};exports[_0xd615('0x47')]=function(_0x310732,_0x268656){return db[_0xd615('0x2b')][_0xd615('0x47')](_0x310732[_0xd615('0x48')],{})['then'](respondWithResult(_0x268656,0xc9))['catch'](handleError(_0x268656,null));};exports[_0xd615('0x49')]=function(_0x13c787,_0x218e3e){if(_0x13c787[_0xd615('0x48')]['id']){delete _0x13c787[_0xd615('0x48')]['id'];}return db[_0xd615('0x2b')][_0xd615('0x46')]({'where':{'id':_0x13c787['params']['id']}})[_0xd615('0x24')](handleEntityNotFound(_0x218e3e,null))[_0xd615('0x24')](saveUpdates(_0x13c787[_0xd615('0x48')],null))['then'](respondWithResult(_0x218e3e,null))[_0xd615('0x41')](handleError(_0x218e3e,null));};exports[_0xd615('0x25')]=function(_0x48d8b3,_0x338f23){return db[_0xd615('0x2b')][_0xd615('0x46')]({'where':{'id':_0x48d8b3[_0xd615('0x43')]['id']}})[_0xd615('0x24')](handleEntityNotFound(_0x338f23,null))[_0xd615('0x24')](removeEntity(_0x338f23,null))['catch'](handleError(_0x338f23,null));};exports[_0xd615('0x4a')]=function(_0x2aa53a,_0x4d5875){return db[_0xd615('0x2b')][_0xd615('0x4a')]()[_0xd615('0x24')](respondWithResult(_0x4d5875,null))[_0xd615('0x41')](handleError(_0x4d5875,null));};exports[_0xd615('0x4b')]=function(_0x2dbe76,_0x32cb20,_0x18469f){var _0x1b6708={'raw':!![],'where':{}};var _0x311733={};var _0x3982dc={'count':0x0,'rows':[]};return db[_0xd615('0x2b')][_0xd615('0x4c')]({'where':{'id':_0x2dbe76[_0xd615('0x43')]['id']}})[_0xd615('0x24')](handleEntityNotFound(_0x32cb20,null))['then'](function(_0x1d3178){if(_0x1d3178){_0x311733[_0xd615('0x2f')]=_[_0xd615('0x31')](db[_0xd615('0x4d')][_0xd615('0x2c')]);_0x311733['query']=_[_0xd615('0x31')](_0x2dbe76[_0xd615('0x30')]);_0x311733[_0xd615('0x32')]=_['intersection'](_0x311733[_0xd615('0x2f')],_0x311733['query']);_0x1b6708['attributes']=_[_0xd615('0x33')](_0x311733[_0xd615('0x2f')],qs[_0xd615('0x34')](_0x2dbe76[_0xd615('0x30')][_0xd615('0x34')]));_0x1b6708[_0xd615('0x35')]=_0x1b6708[_0xd615('0x35')][_0xd615('0x44')]?_0x1b6708[_0xd615('0x35')]:_0x311733[_0xd615('0x2f')];if(!_0x2dbe76['query'][_0xd615('0x36')](_0xd615('0x37'))){_0x1b6708[_0xd615('0x1e')]=qs[_0xd615('0x1e')](_0x2dbe76[_0xd615('0x30')][_0xd615('0x1e')]);_0x1b6708[_0xd615('0x1c')]=qs[_0xd615('0x1c')](_0x2dbe76[_0xd615('0x30')]['offset']);}_0x1b6708[_0xd615('0x4e')]=qs['sort'](_0x2dbe76['query'][_0xd615('0x38')]);_0x1b6708[_0xd615('0x39')]=qs['filters'](_[_0xd615('0x3a')](_0x2dbe76['query'],_0x311733[_0xd615('0x32')]));_0x1b6708[_0xd615('0x39')]['SessionId']=_0x1d3178['id'];if(_0x2dbe76[_0xd615('0x30')][_0xd615('0x3c')]){_0x1b6708['where']=_[_0xd615('0x4f')](_0x1b6708[_0xd615('0x39')],{'$or':_[_0xd615('0x2a')](_0x1b6708['attributes'],function(_0x2b3a6){var _0x10b18b={};_0x10b18b[_0x2b3a6]={'$like':'%'+_0x2dbe76[_0xd615('0x30')][_0xd615('0x3c')]+'%'};return _0x10b18b;})});}_0x1b6708=_[_0xd615('0x4f')]({},_0x1b6708,_0x2dbe76[_0xd615('0x3d')]);return db[_0xd615('0x4d')]['count']({'where':_0x1b6708[_0xd615('0x39')]})[_0xd615('0x24')](function(_0xb13c31){_0x3982dc[_0xd615('0x1f')]=_0xb13c31;if(_0x2dbe76[_0xd615('0x30')][_0xd615('0x45')]){_0x1b6708[_0xd615('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd615('0x3f')](_0x1b6708);})['then'](function(_0x29c0d1){_0x3982dc[_0xd615('0x40')]=_0x29c0d1;return _0x3982dc;});}})[_0xd615('0x24')](respondWithFilteredResult(_0x32cb20,_0x1b6708))[_0xd615('0x41')](handleError(_0x32cb20,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index b9c3e2b..8194348 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1db9=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x1db9,0x176));var _0x91db=function(_0x2b53f7,_0x3a9259){_0x2b53f7=_0x2b53f7-0x0;var _0x26cee4=_0x1db9[_0x2b53f7];return _0x26cee4;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions'];(function(_0x1c71b5,_0x4726a5){var _0x48edcd=function(_0x447fc0){while(--_0x447fc0){_0x1c71b5['push'](_0x1c71b5['shift']());}};_0x48edcd(++_0x4726a5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x5fc3[_0x9b3efc];return _0x200f05;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 25bf7d0..7cb2adc 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 _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x201191,_0x177e61){var _0x5655ec=function(_0x570b54){while(--_0x570b54){_0x201191['push'](_0x201191['shift']());}};_0x5655ec(++_0x177e61);}(_0x32b6,0x1d1));var _0x632b=function(_0xe0902,_0x1e2978){_0xe0902=_0xe0902-0x0;var _0x26240c=_0x32b6[_0xe0902];return _0x26240c;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file +var _0xf2e3=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1d0448,_0x10a2de){var _0x4b9965=function(_0x260ac6){while(--_0x260ac6){_0x1d0448['push'](_0x1d0448['shift']());}};_0x4b9965(++_0x10a2de);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xf2e3[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0864,_0xdf499f,_0x12c6e7){return new BPromise(function(_0x11067d,_0x3636f6){return client[_0x3f2e('0xc')](_0x3c0864,_0x12c6e7)[_0x3f2e('0xd')](function(_0x29a6cc){logger[_0x3f2e('0xe')](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));logger[_0x3f2e('0x11')](_0x3f2e('0x12'),_0xdf499f,_0x3f2e('0x10'),JSON[_0x3f2e('0x13')](_0x29a6cc));if(_0x29a6cc[_0x3f2e('0x14')]){if(_0x29a6cc[_0x3f2e('0x14')]['code']===0x1f4){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x3636f6(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x11067d(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}else{logger['info'](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));_0x11067d(_0x29a6cc[_0x3f2e('0x16')][_0x3f2e('0x15')]);}})[_0x3f2e('0x17')](function(_0x2fef73){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x2fef73);_0x3636f6(_0x2fef73);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index aba13aa..cce1a39 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 _0xa5f6=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated','update','get','/download_log_file'];(function(_0x298955,_0x4783bb){var _0xa6774e=function(_0x3edf28){while(--_0x3edf28){_0x298955['push'](_0x298955['shift']());}};_0xa6774e(++_0x4783bb);}(_0xa5f6,0x12d));var _0x6a5f=function(_0x4a96e2,_0x42719c){_0x4a96e2=_0x4a96e2-0x0;var _0x8c640b=_0xa5f6[_0x4a96e2];return _0x8c640b;};'use strict';var multer=require(_0x6a5f('0x0'));var util=require(_0x6a5f('0x1'));var path=require(_0x6a5f('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a5f('0x3'));var router=express['Router']();var fs_extra=require(_0x6a5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a5f('0x5'));var config=require(_0x6a5f('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0x6a5f('0x7')]);router[_0x6a5f('0x8')](_0x6a5f('0x9'),auth[_0x6a5f('0xa')](),controller[_0x6a5f('0xb')]);router[_0x6a5f('0xc')](_0x6a5f('0xd'),auth[_0x6a5f('0xa')](),controller['downloadLogFile']);module[_0x6a5f('0xe')]=router; \ No newline at end of file +var _0xe6a8=['./license.controller','index','/:id','isAuthenticated','get','/download_log_file','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xe6a8,0x13b));var _0x8e6a=function(_0x112f50,_0x33355b){_0x112f50=_0x112f50-0x0;var _0x39a373=_0xe6a8[_0x112f50];return _0x39a373;};'use strict';var multer=require(_0x8e6a('0x0'));var util=require(_0x8e6a('0x1'));var path=require('path');var timeout=require(_0x8e6a('0x2'));var express=require('express');var router=express[_0x8e6a('0x3')]();var fs_extra=require(_0x8e6a('0x4'));var auth=require(_0x8e6a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e6a('0x6'));var controller=require(_0x8e6a('0x7'));router['get']('/',controller[_0x8e6a('0x8')]);router['put'](_0x8e6a('0x9'),auth[_0x8e6a('0xa')](),controller['update']);router[_0x8e6a('0xb')](_0x8e6a('0xc'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x8e6a('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c14a714..9d7deb2 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 _0xbfe8=['STRING','sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfe8,0x12d));var _0x8bfe=function(_0x14a457,_0xdf1da3){_0x14a457=_0x14a457-0x0;var _0x70f824=_0xbfe8[_0x14a457];return _0x70f824;};'use strict';var Sequelize=require(_0x8bfe('0x0'));module[_0x8bfe('0x1')]={'license':{'type':Sequelize[_0x8bfe('0x2')]},'data1':{'type':Sequelize[_0x8bfe('0x3')]},'data2':{'type':Sequelize[_0x8bfe('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7cef=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x233640,_0x4cecf0){var _0x1fb890=function(_0x355041){while(--_0x355041){_0x233640['push'](_0x233640['shift']());}};_0x1fb890(++_0x4cecf0);}(_0x7cef,0x97));var _0xf7ce=function(_0x27eaeb,_0x523041){_0x27eaeb=_0x27eaeb-0x0;var _0x539384=_0x7cef[_0x27eaeb];return _0x539384;};'use strict';var Sequelize=require(_0xf7ce('0x0'));module[_0xf7ce('0x1')]={'license':{'type':Sequelize[_0xf7ce('0x2')]},'data1':{'type':Sequelize[_0xf7ce('0x3')]},'data2':{'type':Sequelize[_0xf7ce('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xf7ce('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 429f343..ecd592c 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 _0x7847=['filters','intersection','model','fields','attributes','length','options','getLicense','body','params','get','checkLicense','key','demo','catch','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','request-promise','bluebird','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','Content-Range','reject','save','update','then','error','name','send','index','keys','License','rawAttributes','query'];(function(_0x5c3404,_0x5e4ad0){var _0x24cdde=function(_0x286000){while(--_0x286000){_0x5c3404['push'](_0x5c3404['shift']());}};_0x24cdde(++_0x5e4ad0);}(_0x7847,0x1a3));var _0x7784=function(_0x5135f1,_0xf4d1b){_0x5135f1=_0x5135f1-0x0;var _0x1ad043=_0x7847[_0x5135f1];return _0x1ad043;};'use strict';var emlformat=require(_0x7784('0x0'));var rimraf=require(_0x7784('0x1'));var zipdir=require(_0x7784('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7784('0x3'));var moment=require('moment');var BPromise=require(_0x7784('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7784('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7784('0x6'));var _=require(_0x7784('0x7'));var squel=require(_0x7784('0x8'));var crypto=require(_0x7784('0x9'));var jsforce=require(_0x7784('0xa'));var deskjs=require(_0x7784('0xb'));var toCsv=require(_0x7784('0xc'));var querystring=require(_0x7784('0xd'));var Papa=require(_0x7784('0xe'));var Redis=require(_0x7784('0xf'));var authService=require(_0x7784('0x10'));var qs=require(_0x7784('0x11'));var as=require(_0x7784('0x12'));var hardwareService=require(_0x7784('0x13'));var logger=require('../../config/logger')(_0x7784('0x14'));var utils=require(_0x7784('0x15'));var config=require(_0x7784('0x16'));var licenseUtil=require(_0x7784('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38873d,_0x237b4b){_0x237b4b=_0x237b4b||0xcc;return function(_0x5d26a9){if(_0x5d26a9){return _0x38873d[_0x7784('0x18')](_0x237b4b);}return _0x38873d['status'](_0x237b4b)[_0x7784('0x19')]();};}function respondWithResult(_0x199a9a,_0x5e93c4){_0x5e93c4=_0x5e93c4||0xc8;return function(_0x4ec443){if(_0x4ec443){return _0x199a9a[_0x7784('0x1a')](_0x5e93c4)['json'](_0x4ec443);}};}function respondWithFilteredResult(_0x333836,_0x29b359){return function(_0x1793f7){if(_0x1793f7){var _0x1ee436=typeof _0x29b359[_0x7784('0x1b')]==='undefined'&&typeof _0x29b359[_0x7784('0x1c')]==='undefined';var _0x1539a3=_0x1793f7[_0x7784('0x1d')];var _0x2fe320=_0x1ee436?0x0:_0x29b359['offset'];var _0x52e59c=_0x1ee436?_0x1793f7[_0x7784('0x1d')]:_0x29b359[_0x7784('0x1b')]+_0x29b359[_0x7784('0x1c')];var _0x34998b;if(_0x52e59c>=_0x1539a3){_0x52e59c=_0x1539a3;_0x34998b=0xc8;}else{_0x34998b=0xce;}_0x333836[_0x7784('0x1a')](_0x34998b);return _0x333836['set'](_0x7784('0x1e'),_0x2fe320+'-'+_0x52e59c+'/'+_0x1539a3)['json'](_0x1793f7);}return null;};}function patchUpdates(_0x497442){return function(_0x1669ff){try{jsonpatch['apply'](_0x1669ff,_0x497442,!![]);}catch(_0x35ad97){return BPromise[_0x7784('0x1f')](_0x35ad97);}return _0x1669ff[_0x7784('0x20')]();};}function saveUpdates(_0x42af07,_0x3ecabf){return function(_0x43a5ab){if(_0x43a5ab){return _0x43a5ab[_0x7784('0x21')](_0x42af07)[_0x7784('0x22')](function(_0x5aed48){return _0x5aed48;});}return null;};}function removeEntity(_0x228b8c,_0x1c1ba5){return function(_0x1cc479){if(_0x1cc479){return _0x1cc479['destroy']()[_0x7784('0x22')](function(){_0x228b8c[_0x7784('0x1a')](0xcc)[_0x7784('0x19')]();});}};}function handleEntityNotFound(_0xe44166,_0x1f0abc){return function(_0x12ff51){if(!_0x12ff51){_0xe44166[_0x7784('0x18')](0x194);}return _0x12ff51;};}function handleError(_0x597db9,_0x221425){_0x221425=_0x221425||0x1f4;return function(_0x5dbdca){logger[_0x7784('0x23')](_0x5dbdca['stack']);if(_0x5dbdca[_0x7784('0x24')]){delete _0x5dbdca[_0x7784('0x24')];}_0x597db9['status'](_0x221425)[_0x7784('0x25')](_0x5dbdca);};}var utilLicense=require('../../config/license/util');exports[_0x7784('0x26')]=function(_0x438fb4,_0x4c2d28){var _0x2217b1={'raw':!![],'where':{'id':0x1}},_0x57982a={};_0x57982a['model']=_[_0x7784('0x27')](db[_0x7784('0x28')][_0x7784('0x29')]);_0x57982a[_0x7784('0x2a')]=_[_0x7784('0x27')](_0x438fb4['query']);_0x57982a[_0x7784('0x2b')]=_[_0x7784('0x2c')](_0x57982a[_0x7784('0x2d')],_0x57982a[_0x7784('0x2a')]);_0x2217b1['attributes']=_[_0x7784('0x2c')](_0x57982a[_0x7784('0x2d')],qs['fields'](_0x438fb4[_0x7784('0x2a')][_0x7784('0x2e')]));_0x2217b1[_0x7784('0x2f')]=_0x2217b1[_0x7784('0x2f')][_0x7784('0x30')]?_0x2217b1['attributes']:_0x57982a[_0x7784('0x2d')];_0x2217b1=_['merge']({},_0x2217b1,_0x438fb4[_0x7784('0x31')]);return utilLicense[_0x7784('0x32')](_0x2217b1)[_0x7784('0x22')](respondWithResult(_0x4c2d28,null))['catch'](handleError(_0x4c2d28,null));};exports[_0x7784('0x21')]=function(_0x2cf26d,_0x44ac9f){if(_0x2cf26d[_0x7784('0x33')]['id']){delete _0x2cf26d['body']['id'];}return db[_0x7784('0x28')]['find']({'where':{'id':_0x2cf26d[_0x7784('0x34')]['id']}})['then'](handleEntityNotFound(_0x44ac9f,null))[_0x7784('0x22')](function(_0x3db76d){var _0x18e67f=_0x3db76d[_0x7784('0x35')]({'plain':!![]});return utilLicense[_0x7784('0x36')](_0x18e67f,_0x2cf26d[_0x7784('0x33')][_0x7784('0x37')]);})['then'](function(_0xd14b17){if(!_0xd14b17[_0x7784('0x38')]){return saveUpdates(_0x2cf26d[_0x7784('0x33')],null);}return _0xd14b17;})[_0x7784('0x22')](respondWithResult(_0x44ac9f,null))[_0x7784('0x39')](handleError(_0x44ac9f,null));};exports['downloadLogFile']=function(_0x18c9f2,_0x1b38ae){var _0x5898f7='license-info.log';var _0x41f6f2=path[_0x7784('0x3a')]('/var',_0x7784('0x3b'),_0x7784('0x3c'),_0x5898f7);_0x1b38ae[_0x7784('0x3d')](_0x7784('0x3e'),_0x7784('0x3f')+_0x5898f7);_0x1b38ae['set']('Content-Type',_0x7784('0x40'));_0x1b38ae[_0x7784('0x41')](_0x41f6f2);}; \ No newline at end of file +var _0x7be1=['get','checkLicense','demo','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','send','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge','getLicense','catch','update','body'];(function(_0x36c464,_0xc627a0){var _0x4fdbaf=function(_0x2c3398){while(--_0x2c3398){_0x36c464['push'](_0x36c464['shift']());}};_0x4fdbaf(++_0xc627a0);}(_0x7be1,0x9d));var _0x17be=function(_0x5d240d,_0x22e0e0){_0x5d240d=_0x5d240d-0x0;var _0x59701e=_0x7be1[_0x5d240d];return _0x59701e;};'use strict';var emlformat=require(_0x17be('0x0'));var rimraf=require(_0x17be('0x1'));var zipdir=require(_0x17be('0x2'));var jsonpatch=require(_0x17be('0x3'));var rp=require(_0x17be('0x4'));var moment=require(_0x17be('0x5'));var BPromise=require(_0x17be('0x6'));var Mustache=require(_0x17be('0x7'));var util=require(_0x17be('0x8'));var path=require('path');var sox=require(_0x17be('0x9'));var csv=require(_0x17be('0xa'));var ejs=require(_0x17be('0xb'));var fs=require('fs');var fs_extra=require(_0x17be('0xc'));var _=require(_0x17be('0xd'));var squel=require(_0x17be('0xe'));var crypto=require('crypto');var jsforce=require(_0x17be('0xf'));var deskjs=require(_0x17be('0x10'));var toCsv=require('to-csv');var querystring=require(_0x17be('0x11'));var Papa=require(_0x17be('0x12'));var Redis=require('ioredis');var authService=require(_0x17be('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x17be('0x14'));var hardwareService=require(_0x17be('0x15'));var logger=require(_0x17be('0x16'))(_0x17be('0x17'));var utils=require(_0x17be('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x17be('0x19'));var db=require(_0x17be('0x1a'))['db'];function respondWithStatusCode(_0x7eb7e4,_0x382418){_0x382418=_0x382418||0xcc;return function(_0x164ea5){if(_0x164ea5){return _0x7eb7e4['sendStatus'](_0x382418);}return _0x7eb7e4[_0x17be('0x1b')](_0x382418)['end']();};}function respondWithResult(_0x775127,_0x207e59){_0x207e59=_0x207e59||0xc8;return function(_0x32169e){if(_0x32169e){return _0x775127[_0x17be('0x1b')](_0x207e59)[_0x17be('0x1c')](_0x32169e);}};}function respondWithFilteredResult(_0x133b26,_0xcafad1){return function(_0x291202){if(_0x291202){var _0x54f68e=typeof _0xcafad1[_0x17be('0x1d')]===_0x17be('0x1e')&&typeof _0xcafad1[_0x17be('0x1f')]==='undefined';var _0x5771f7=_0x291202['count'];var _0x28baec=_0x54f68e?0x0:_0xcafad1[_0x17be('0x1d')];var _0x35d98f=_0x54f68e?_0x291202[_0x17be('0x20')]:_0xcafad1[_0x17be('0x1d')]+_0xcafad1['limit'];var _0x3f89c3;if(_0x35d98f>=_0x5771f7){_0x35d98f=_0x5771f7;_0x3f89c3=0xc8;}else{_0x3f89c3=0xce;}_0x133b26[_0x17be('0x1b')](_0x3f89c3);return _0x133b26[_0x17be('0x21')](_0x17be('0x22'),_0x28baec+'-'+_0x35d98f+'/'+_0x5771f7)[_0x17be('0x1c')](_0x291202);}return null;};}function patchUpdates(_0x2172e2){return function(_0x43ee59){try{jsonpatch[_0x17be('0x23')](_0x43ee59,_0x2172e2,!![]);}catch(_0x464cd2){return BPromise[_0x17be('0x24')](_0x464cd2);}return _0x43ee59[_0x17be('0x25')]();};}function saveUpdates(_0x53e05a,_0x36c803){return function(_0x121034){if(_0x121034){return _0x121034['update'](_0x53e05a)[_0x17be('0x26')](function(_0x132a64){return _0x132a64;});}return null;};}function removeEntity(_0x140a2f,_0x4c455c){return function(_0x106a06){if(_0x106a06){return _0x106a06['destroy']()[_0x17be('0x26')](function(){_0x140a2f[_0x17be('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b882b,_0x21a04d){return function(_0x3dcd55){if(!_0x3dcd55){_0x1b882b[_0x17be('0x27')](0x194);}return _0x3dcd55;};}function handleError(_0x340f27,_0x13d58e){_0x13d58e=_0x13d58e||0x1f4;return function(_0x24a374){logger['error'](_0x24a374[_0x17be('0x28')]);if(_0x24a374['name']){delete _0x24a374[_0x17be('0x29')];}_0x340f27['status'](_0x13d58e)[_0x17be('0x2a')](_0x24a374);};}var utilLicense=require(_0x17be('0x19'));exports[_0x17be('0x2b')]=function(_0x28f1e6,_0x5d0cb8){var _0x227257={'raw':!![],'where':{'id':0x1}},_0x4870db={};_0x4870db[_0x17be('0x2c')]=_[_0x17be('0x2d')](db[_0x17be('0x2e')][_0x17be('0x2f')]);_0x4870db[_0x17be('0x30')]=_[_0x17be('0x2d')](_0x28f1e6['query']);_0x4870db[_0x17be('0x31')]=_['intersection'](_0x4870db[_0x17be('0x2c')],_0x4870db[_0x17be('0x30')]);_0x227257[_0x17be('0x32')]=_[_0x17be('0x33')](_0x4870db[_0x17be('0x2c')],qs[_0x17be('0x34')](_0x28f1e6[_0x17be('0x30')][_0x17be('0x34')]));_0x227257[_0x17be('0x32')]=_0x227257[_0x17be('0x32')][_0x17be('0x35')]?_0x227257[_0x17be('0x32')]:_0x4870db[_0x17be('0x2c')];_0x227257=_[_0x17be('0x36')]({},_0x227257,_0x28f1e6['options']);return utilLicense[_0x17be('0x37')](_0x227257)[_0x17be('0x26')](respondWithResult(_0x5d0cb8,null))[_0x17be('0x38')](handleError(_0x5d0cb8,null));};exports[_0x17be('0x39')]=function(_0x24c982,_0x4bbaea){if(_0x24c982[_0x17be('0x3a')]['id']){delete _0x24c982['body']['id'];}return db[_0x17be('0x2e')]['find']({'where':{'id':_0x24c982['params']['id']}})[_0x17be('0x26')](handleEntityNotFound(_0x4bbaea,null))[_0x17be('0x26')](function(_0x5921c9){var _0x2d9370=_0x5921c9[_0x17be('0x3b')]({'plain':!![]});return utilLicense[_0x17be('0x3c')](_0x2d9370,_0x24c982[_0x17be('0x3a')]['key']);})['then'](function(_0x5e8315){if(!_0x5e8315[_0x17be('0x3d')]){return saveUpdates(_0x24c982[_0x17be('0x3a')],null);}return _0x5e8315;})[_0x17be('0x26')](respondWithResult(_0x4bbaea,null))[_0x17be('0x38')](handleError(_0x4bbaea,null));};exports['downloadLogFile']=function(_0x123532,_0x2c0589){var _0x1609ab=_0x17be('0x3e');var _0x127a0e=path[_0x17be('0x3f')](_0x17be('0x40'),'log',_0x17be('0x41'),_0x1609ab);_0x2c0589[_0x17be('0x42')](_0x17be('0x43'),_0x17be('0x44')+_0x1609ab);_0x2c0589[_0x17be('0x21')](_0x17be('0x45'),_0x17be('0x46'));_0x2c0589[_0x17be('0x47')](_0x127a0e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4ab1910..1a6a7fd 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 _0x1826=['rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4cfc35,_0xb52690){var _0x43a384=function(_0x3d896f){while(--_0x3d896f){_0x4cfc35['push'](_0x4cfc35['shift']());}};_0x43a384(++_0xb52690);}(_0x1826,0x192));var _0x6182=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x1826[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x6182('0x0'));var util=require(_0x6182('0x1'));var logger=require(_0x6182('0x2'))(_0x6182('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6182('0x4'));var fs=require('fs');var path=require(_0x6182('0x5'));var rimraf=require(_0x6182('0x6'));var config=require(_0x6182('0x7'));var attributes=require(_0x6182('0x8'));module[_0x6182('0x9')]=function(_0x20c798,_0x53810e){return _0x20c798[_0x6182('0xa')]('License',attributes,{'tableName':_0x6182('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22b3=['rimraf','../../config/environment','./license.attributes','exports','license','lodash','util','api','moment','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x22b3,0x1ef));var _0x322b=function(_0x8494cc,_0x47bee9){_0x8494cc=_0x8494cc-0x0;var _0xcbaa3f=_0x22b3[_0x8494cc];return _0xcbaa3f;};'use strict';var _=require(_0x322b('0x0'));var util=require(_0x322b('0x1'));var logger=require('../../config/logger')(_0x322b('0x2'));var moment=require(_0x322b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x322b('0x4'));var rimraf=require(_0x322b('0x5'));var config=require(_0x322b('0x6'));var attributes=require(_0x322b('0x7'));module[_0x322b('0x8')]=function(_0x1530e4,_0x2b0291){return _0x1530e4['define']('License',attributes,{'tableName':_0x322b('0x9'),'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 34f1268..bfe8daf 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 _0x0ed1=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x44699a,_0x577c57){var _0x5213cb=function(_0x463c7b){while(--_0x463c7b){_0x44699a['push'](_0x44699a['shift']());}};_0x5213cb(++_0x577c57);}(_0x0ed1,0xcf));var _0x10ed=function(_0x4d3bbe,_0x12e972){_0x4d3bbe=_0x4d3bbe-0x0;var _0x5c7af0=_0x0ed1[_0x4d3bbe];return _0x5c7af0;};'use strict';var _=require(_0x10ed('0x0'));var util=require(_0x10ed('0x1'));var moment=require(_0x10ed('0x2'));var BPromise=require(_0x10ed('0x3'));var rs=require(_0x10ed('0x4'));var fs=require('fs');var Redis=require(_0x10ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x10ed('0x6'));var logger=require(_0x10ed('0x7'))(_0x10ed('0x8'));var config=require('../../config/environment');var jayson=require(_0x10ed('0x9'));var client=jayson['client'][_0x10ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a677d,_0x450c77,_0x1ba5d5){return new BPromise(function(_0x1521cd,_0x3d8ab5){return client['request'](_0x3a677d,_0x1ba5d5)[_0x10ed('0xb')](function(_0x325f1e){logger[_0x10ed('0xc')](_0x10ed('0xd'),_0x450c77,_0x10ed('0xe'));logger[_0x10ed('0xf')](_0x10ed('0x10'),_0x450c77,_0x10ed('0xe'),JSON[_0x10ed('0x11')](_0x325f1e));if(_0x325f1e['error']){if(_0x325f1e[_0x10ed('0x12')][_0x10ed('0x13')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x450c77,_0x325f1e['error']['message']);return _0x3d8ab5(_0x325f1e[_0x10ed('0x12')][_0x10ed('0x14')]);}logger[_0x10ed('0x12')]('License,\x20%s,\x20%s',_0x450c77,_0x325f1e[_0x10ed('0x12')][_0x10ed('0x14')]);return _0x1521cd(_0x325f1e[_0x10ed('0x12')][_0x10ed('0x14')]);}else{logger['info']('License,\x20%s,\x20%s',_0x450c77,_0x10ed('0xe'));_0x1521cd(_0x325f1e[_0x10ed('0x15')][_0x10ed('0x14')]);}})[_0x10ed('0x16')](function(_0x5cd5bb){logger['error'](_0x10ed('0xd'),_0x450c77,_0x5cd5bb);_0x3d8ab5(_0x5cd5bb);});});} \ No newline at end of file +var _0x9ae4=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x28836b,_0x389433){var _0x51f3f8=function(_0x503226){while(--_0x503226){_0x28836b['push'](_0x28836b['shift']());}};_0x51f3f8(++_0x389433);}(_0x9ae4,0x1e2));var _0x49ae=function(_0xa192cb,_0x5706c7){_0xa192cb=_0xa192cb-0x0;var _0x4f33da=_0x9ae4[_0xa192cb];return _0x4f33da;};'use strict';var _=require(_0x49ae('0x0'));var util=require(_0x49ae('0x1'));var moment=require(_0x49ae('0x2'));var BPromise=require(_0x49ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49ae('0x5'));var logger=require(_0x49ae('0x6'))(_0x49ae('0x7'));var config=require(_0x49ae('0x8'));var jayson=require(_0x49ae('0x9'));var client=jayson['client'][_0x49ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c4f48,_0x1775e2,_0x121a69){return new BPromise(function(_0x256f13,_0x195cac){return client[_0x49ae('0xb')](_0x3c4f48,_0x121a69)[_0x49ae('0xc')](function(_0x2affd7){logger[_0x49ae('0xd')](_0x49ae('0xe'),_0x1775e2,_0x49ae('0xf'));logger[_0x49ae('0x10')](_0x49ae('0x11'),_0x1775e2,_0x49ae('0xf'),JSON[_0x49ae('0x12')](_0x2affd7));if(_0x2affd7[_0x49ae('0x13')]){if(_0x2affd7['error'][_0x49ae('0x14')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x1775e2,_0x2affd7[_0x49ae('0x13')][_0x49ae('0x15')]);return _0x195cac(_0x2affd7[_0x49ae('0x13')][_0x49ae('0x15')]);}logger['error']('License,\x20%s,\x20%s',_0x1775e2,_0x2affd7['error'][_0x49ae('0x15')]);return _0x256f13(_0x2affd7[_0x49ae('0x13')][_0x49ae('0x15')]);}else{logger[_0x49ae('0xd')]('License,\x20%s,\x20%s',_0x1775e2,'request\x20sent');_0x256f13(_0x2affd7[_0x49ae('0x16')][_0x49ae('0x15')]);}})['catch'](function(_0x5f2d3e){logger[_0x49ae('0x13')](_0x49ae('0xe'),_0x1775e2,_0x5f2d3e);_0x195cac(_0x5f2d3e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 09703d4..d1f68d6 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 _0xb923=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','addAnswer','create','post','/:id/in_servers','addSmtp','addInteraction','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x48478b,_0x1f15c3){var _0x48b4be=function(_0x3a795d){while(--_0x3a795d){_0x48478b['push'](_0x48478b['shift']());}};_0x48b4be(++_0x1f15c3);}(_0xb923,0x1cf));var _0x3b92=function(_0x5226b2,_0x3b3e61){_0x5226b2=_0x5226b2-0x0;var _0x325357=_0xb923[_0x5226b2];return _0x325357;};'use strict';var multer=require(_0x3b92('0x0'));var util=require(_0x3b92('0x1'));var path=require(_0x3b92('0x2'));var timeout=require(_0x3b92('0x3'));var express=require(_0x3b92('0x4'));var router=express[_0x3b92('0x5')]();var fs_extra=require(_0x3b92('0x6'));var auth=require(_0x3b92('0x7'));var interaction=require(_0x3b92('0x8'));var config=require(_0x3b92('0x9'));var controller=require(_0x3b92('0xa'));router[_0x3b92('0xb')]('/',auth['isAuthenticated'](),controller[_0x3b92('0xc')]);router[_0x3b92('0xb')]('/describe',auth[_0x3b92('0xd')](),controller[_0x3b92('0xe')]);router[_0x3b92('0xb')](_0x3b92('0xf'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x10')]);router[_0x3b92('0xb')](_0x3b92('0x11'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x12')]);router[_0x3b92('0xb')](_0x3b92('0x13'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x3b92('0xb')]('/:id/in_servers',auth[_0x3b92('0xd')](),controller[_0x3b92('0x14')]);router[_0x3b92('0xb')](_0x3b92('0x15'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x16')]);router['get'](_0x3b92('0x17'),auth[_0x3b92('0xd')](),controller['getInteractions']);router[_0x3b92('0xb')](_0x3b92('0x18'),auth[_0x3b92('0xd')](),controller['getApplications']);router[_0x3b92('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3b92('0x19')]);router[_0x3b92('0xb')](_0x3b92('0x1a'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1b')]);router[_0x3b92('0xb')](_0x3b92('0x1c'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1d')]);router['post'](_0x3b92('0x11'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1e')]);router['post'](_0x3b92('0x13'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1f')]);router['post']('/',auth[_0x3b92('0xd')](),controller[_0x3b92('0x20')]);router[_0x3b92('0x21')](_0x3b92('0x22'),auth['isAuthenticated'](),controller['addImap']);router[_0x3b92('0x21')](_0x3b92('0x15'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x23')]);router['post']('/:id/interactions',auth[_0x3b92('0xd')](),controller[_0x3b92('0x24')]);router[_0x3b92('0x21')](_0x3b92('0x18'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x25')]);router['post'](_0x3b92('0x26'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x27')]);router[_0x3b92('0x21')](_0x3b92('0x1c'),auth[_0x3b92('0xd')](),controller['addAgents']);router['put'](_0x3b92('0xf'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x28')]);router[_0x3b92('0x29')](_0x3b92('0x11'),auth['isAuthenticated'](),controller[_0x3b92('0x2a')]);router[_0x3b92('0x29')](_0x3b92('0x13'),auth['isAuthenticated'](),controller[_0x3b92('0x2b')]);router[_0x3b92('0x29')](_0x3b92('0x22'),auth['isAuthenticated'](),controller[_0x3b92('0x2c')]);router[_0x3b92('0x29')](_0x3b92('0x15'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x2d')]);router[_0x3b92('0x29')](_0x3b92('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0x3b92('0x29')](_0x3b92('0x1c'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3b92('0x2e')]=router; \ No newline at end of file +var _0x5e8f=['/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated'];(function(_0x3f4a8e,_0x507c39){var _0x7f68fd=function(_0x29890f){while(--_0x29890f){_0x3f4a8e['push'](_0x3f4a8e['shift']());}};_0x7f68fd(++_0x507c39);}(_0x5e8f,0x1b8));var _0xf5e8=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0x5e8f[_0x281e5e];return _0x5a22d2;};'use strict';var multer=require('multer');var util=require(_0xf5e8('0x0'));var path=require(_0xf5e8('0x1'));var timeout=require(_0xf5e8('0x2'));var express=require(_0xf5e8('0x3'));var router=express[_0xf5e8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf5e8('0x5'));var interaction=require(_0xf5e8('0x6'));var config=require('../../config/environment');var controller=require(_0xf5e8('0x7'));router[_0xf5e8('0x8')]('/',auth[_0xf5e8('0x9')](),controller['index']);router[_0xf5e8('0x8')](_0xf5e8('0xa'),auth['isAuthenticated'](),controller[_0xf5e8('0xb')]);router[_0xf5e8('0x8')](_0xf5e8('0xc'),auth[_0xf5e8('0x9')](),controller['show']);router[_0xf5e8('0x8')](_0xf5e8('0xd'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0xe')]);router[_0xf5e8('0x8')](_0xf5e8('0xf'),auth['isAuthenticated'](),controller[_0xf5e8('0x10')]);router['get'](_0xf5e8('0x11'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x12')]);router[_0xf5e8('0x8')](_0xf5e8('0x13'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x14')]);router['get'](_0xf5e8('0x15'),auth['isAuthenticated'](),controller[_0xf5e8('0x16')]);router[_0xf5e8('0x8')]('/:id/applications',auth[_0xf5e8('0x9')](),controller['getApplications']);router[_0xf5e8('0x8')](_0xf5e8('0x17'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x18')]);router[_0xf5e8('0x8')](_0xf5e8('0x19'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x1a')]);router[_0xf5e8('0x8')](_0xf5e8('0x1b'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x1c')]);router[_0xf5e8('0x1d')](_0xf5e8('0xd'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x1e')]);router[_0xf5e8('0x1d')](_0xf5e8('0xf'),auth[_0xf5e8('0x9')](),controller['addAnswer']);router[_0xf5e8('0x1d')]('/',auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x1f')]);router[_0xf5e8('0x1d')](_0xf5e8('0x11'),auth['isAuthenticated'](),controller[_0xf5e8('0x20')]);router[_0xf5e8('0x1d')](_0xf5e8('0x13'),auth[_0xf5e8('0x9')](),controller['addSmtp']);router['post']('/:id/interactions',auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x21')]);router['post'](_0xf5e8('0x22'),auth['isAuthenticated'](),controller[_0xf5e8('0x23')]);router[_0xf5e8('0x1d')](_0xf5e8('0x24'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x25')]);router['post'](_0xf5e8('0x1b'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x26')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf5e8('0x27')]);router['delete'](_0xf5e8('0xd'),auth[_0xf5e8('0x9')](),controller['removeDispositions']);router[_0xf5e8('0x28')](_0xf5e8('0xf'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x29')]);router[_0xf5e8('0x28')](_0xf5e8('0x11'),auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x2a')]);router[_0xf5e8('0x28')](_0xf5e8('0x13'),auth['isAuthenticated'](),controller[_0xf5e8('0x2b')]);router[_0xf5e8('0x28')]('/:id',auth[_0xf5e8('0x9')](),controller['destroy']);router[_0xf5e8('0x28')]('/:id/users',auth[_0xf5e8('0x9')](),controller[_0xf5e8('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f909e27..a36122a 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 _0x1c39=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0x260e4b,_0x54668d){var _0x18dfba=function(_0x37b530){while(--_0x37b530){_0x260e4b['push'](_0x260e4b['shift']());}};_0x18dfba(++_0x54668d);}(_0x1c39,0xc7));var _0x91c3=function(_0x1c5feb,_0x3d9b3b){_0x1c5feb=_0x1c5feb-0x0;var _0x534222=_0x1c39[_0x1c5feb];return _0x534222;};'use strict';var Sequelize=require(_0x91c3('0x0'));module[_0x91c3('0x1')]={'description':{'type':Sequelize[_0x91c3('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x91c3('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x91c3('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x91c3('0x4')]},'markAsUnread':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x91c3('0x2')],'allowNull':![],'defaultValue':_0x91c3('0x5')},'fontSize':{'type':Sequelize[_0x91c3('0x6')](0x2)[_0x91c3('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x91c3('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x91c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x91c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x91c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x91c3('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![],'comment':_0x91c3('0xa'),'set':function(_0xa49a44){if(!_0xa49a44)this[_0x91c3('0xb')]('mandatoryDispositionPauseId',null);this[_0x91c3('0xb')](_0x91c3('0xc'),_0xa49a44);}},'provider':{'type':Sequelize['ENUM'](_0x91c3('0xd'),_0x91c3('0xe'),_0x91c3('0xf'),_0x91c3('0x10')),'defaultValue':null,'get':function(){var _0x4f93b9=this[_0x91c3('0x11')](_0x91c3('0x12'));return _0x4f93b9||_0x91c3('0x13');},'set':function(_0x1610fc){if(_0x1610fc==='custom'){_0x1610fc=null;}return this[_0x91c3('0xb')](_0x91c3('0x12'),_0x1610fc);}}}; \ No newline at end of file +var _0xf21c=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xf21c,0xb9));var _0xcf21=function(_0x1ac9b6,_0xe2449a){_0x1ac9b6=_0x1ac9b6-0x0;var _0xa0d863=_0xf21c[_0x1ac9b6];return _0xa0d863;};'use strict';var Sequelize=require(_0xcf21('0x0'));module[_0xcf21('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xcf21('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xcf21('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcf21('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xcf21('0x4')]},'markAsUnread':{'type':Sequelize[_0xcf21('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcf21('0x2')],'allowNull':![],'defaultValue':_0xcf21('0x5')},'fontSize':{'type':Sequelize[_0xcf21('0x6')](0x2)[_0xcf21('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcf21('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcf21('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcf21('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcf21('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf21('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcf21('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xcf21('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x39c05c){if(!_0x39c05c)this['setDataValue'](_0xcf21('0x9'),null);this[_0xcf21('0xa')](_0xcf21('0xb'),_0x39c05c);}},'provider':{'type':Sequelize[_0xcf21('0xc')](_0xcf21('0xd'),_0xcf21('0xe'),_0xcf21('0xf'),_0xcf21('0x10')),'defaultValue':null,'get':function(){var _0x15d3ee=this['getDataValue']('provider');return _0x15d3ee||'custom';},'set':function(_0x280789){if(_0x280789===_0xcf21('0x11')){_0x280789=null;}return this[_0xcf21('0xa')](_0xcf21('0x12'),_0x280789);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index fcdfef3..e8c60d7 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 _0xb3a1=['error','code','message','info','result','status','json','offset','undefined','count','limit','set','Content-Range','update','then','get','MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','imap.mail.yahoo.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','port','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','body','custom','provider','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','sort','removeDispositions','addAnswer','CannedAnswer','getAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','ids','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','List\x20not\x20found','List','messageId','attach','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x51ea1b,_0x1c5a3b){var _0x56d914=function(_0x34623a){while(--_0x34623a){_0x51ea1b['push'](_0x51ea1b['shift']());}};_0x56d914(++_0x1c5a3b);}(_0xb3a1,0xa9));var _0x1b3a=function(_0x4bf3a7,_0x5d756b){_0x4bf3a7=_0x4bf3a7-0x0;var _0x58c9cc=_0xb3a1[_0x4bf3a7];return _0x58c9cc;};'use strict';var moment=require(_0x1b3a('0x0'));var BPromise=require(_0x1b3a('0x1'));var util=require(_0x1b3a('0x2'));var path=require('path');var _=require(_0x1b3a('0x3'));var juice=require('juice');var Redis=require(_0x1b3a('0x4'));var qs=require(_0x1b3a('0x5'));var logger=require(_0x1b3a('0x6'))(_0x1b3a('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1b3a('0x8')]=_[_0x1b3a('0x9')](config[_0x1b3a('0x8')],{'host':_0x1b3a('0xa'),'port':0x18eb});var socket=require(_0x1b3a('0xb'))(new Redis(config[_0x1b3a('0x8')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x1b3a('0xc'));var client=jayson[_0x1b3a('0xd')][_0x1b3a('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x55b0b3,_0x1b8310,_0x3c38fd,_0x3add3c){return new BPromise(function(_0x11acce,_0x47ff4b){var _0x128c34=_0x3add3c||client;return _0x128c34[_0x1b3a('0xf')](_0x55b0b3,_0x3c38fd)['then'](function(_0x25e903){logger['info'](_0x1b3a('0x10'),_0x1b8310,_0x1b3a('0x11'));logger[_0x1b3a('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1b8310,_0x1b3a('0x11'),JSON[_0x1b3a('0x13')](_0x25e903));if(_0x25e903[_0x1b3a('0x14')]){if(_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x15')]===0x1f4){logger[_0x1b3a('0x14')](_0x1b3a('0x10'),_0x1b8310,_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x16')]);return _0x47ff4b(_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x16')]);}logger[_0x1b3a('0x14')]('MailAccount,\x20%s,\x20%s',_0x1b8310,_0x25e903['error'][_0x1b3a('0x16')]);return _0x11acce(_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x16')]);}else{logger[_0x1b3a('0x17')]('MailAccount,\x20%s,\x20%s',_0x1b8310,'request\x20sent');_0x11acce(_0x25e903[_0x1b3a('0x18')][_0x1b3a('0x16')]);}})['catch'](function(_0x2b1c94){logger[_0x1b3a('0x14')](_0x1b3a('0x10'),_0x1b8310,_0x2b1c94);_0x47ff4b(_0x2b1c94);});});}function respondWithStatusCode(_0x2c780d,_0x4f7e61){_0x4f7e61=_0x4f7e61||0xcc;return function(_0x6d3d71){if(_0x6d3d71){return _0x2c780d['sendStatus'](_0x4f7e61);}return _0x2c780d[_0x1b3a('0x19')](_0x4f7e61)['end']();};}function respondWithResult(_0x130c9c,_0x4b68b2){_0x4b68b2=_0x4b68b2||0xc8;return function(_0x4a8a43){if(_0x4a8a43){return _0x130c9c['status'](_0x4b68b2)[_0x1b3a('0x1a')](_0x4a8a43);}};}function respondWithFilteredResult(_0x5a56e6,_0x4a546b){return function(_0x4d9bd9){if(_0x4d9bd9){var _0x949de=typeof _0x4a546b[_0x1b3a('0x1b')]==='undefined'&&typeof _0x4a546b['limit']===_0x1b3a('0x1c');var _0x1bf632=_0x4d9bd9[_0x1b3a('0x1d')];var _0x591769=_0x949de?0x0:_0x4a546b[_0x1b3a('0x1b')];var _0xda6f26=_0x949de?_0x4d9bd9[_0x1b3a('0x1d')]:_0x4a546b[_0x1b3a('0x1b')]+_0x4a546b[_0x1b3a('0x1e')];var _0x371b49;if(_0xda6f26>=_0x1bf632){_0xda6f26=_0x1bf632;_0x371b49=0xc8;}else{_0x371b49=0xce;}_0x5a56e6[_0x1b3a('0x19')](_0x371b49);return _0x5a56e6[_0x1b3a('0x1f')](_0x1b3a('0x20'),_0x591769+'-'+_0xda6f26+'/'+_0x1bf632)[_0x1b3a('0x1a')](_0x4d9bd9);}return null;};}function saveUpdates(_0x146d64){return function(_0x38c6ef){if(_0x38c6ef){return _0x38c6ef[_0x1b3a('0x21')](_0x146d64)[_0x1b3a('0x22')](function(_0x52551b){return _0x52551b;});}return null;};}function removeEntity(_0x4509bd){return function(_0x245f63){if(_0x245f63){return _0x245f63['destroy']()[_0x1b3a('0x22')](function(){var _0x484398=_0x245f63[_0x1b3a('0x23')]({'plain':!![]});var _0x2e9d1f=_0x1b3a('0x24');return db[_0x1b3a('0x25')][_0x1b3a('0x26')]({'where':{'type':_0x2e9d1f,'resourceId':_0x484398['id']}})[_0x1b3a('0x22')](function(){return _0x245f63;});})[_0x1b3a('0x22')](function(){_0x4509bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aff53){return function(_0x5504d9){if(!_0x5504d9){_0x4aff53['sendStatus'](0x194);}return _0x5504d9;};}function handleError(_0x54c3b3,_0x586d85){_0x586d85=_0x586d85||0x1f4;return function(_0xc7013a){logger[_0x1b3a('0x14')](_0xc7013a[_0x1b3a('0x27')]);if(_0xc7013a[_0x1b3a('0x28')]){delete _0xc7013a[_0x1b3a('0x28')];}_0x54c3b3[_0x1b3a('0x19')](_0x586d85)[_0x1b3a('0x29')](_0xc7013a);};}function getImapHost(_0x26253f){switch(_0x26253f){case _0x1b3a('0x2a'):return'imap.gmail.com';case'yahoo':return _0x1b3a('0x2b');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0x1b3a('0x2c');}throw new Error(_0x1b3a('0x2d'),_0x26253f);}function getSmtpHost(_0x45b707){switch(_0x45b707){case _0x1b3a('0x2a'):return'smtp.gmail.com';case'yahoo':return _0x1b3a('0x2e');case'hotmail':return _0x1b3a('0x2f');case _0x1b3a('0x30'):return _0x1b3a('0x31');}throw new Error(_0x1b3a('0x2d'),_0x45b707);}function getAuthenticationOptions(_0x49eb67,_0x54bc04){var _0xb03ddb={};var _0x2e372d={};if(_0x49eb67){_0xb03ddb[_0x1b3a('0x32')]=_0x2e372d[_0x1b3a('0x32')]=_0x54bc04[_0x1b3a('0x33')];_0xb03ddb[_0x1b3a('0x34')]=_0x2e372d[_0x1b3a('0x35')]=_0x54bc04[_0x1b3a('0x34')];if(_0x54bc04['modernAuthentication']){_0xb03ddb['modernAuthentication']=_0x2e372d[_0x1b3a('0x36')]=!![];_0xb03ddb['CloudProviderId']=_0x2e372d[_0x1b3a('0x37')]=_0x54bc04[_0x1b3a('0x37')];_0xb03ddb[_0x1b3a('0x34')]=_0x2e372d[_0x1b3a('0x35')]=null;}else{_0xb03ddb[_0x1b3a('0x37')]=_0x2e372d[_0x1b3a('0x37')]=null;}_0xb03ddb[_0x1b3a('0x38')]=getImapHost(_0x49eb67);_0xb03ddb['port']=0x3e1;_0x2e372d[_0x1b3a('0x38')]=getSmtpHost(_0x49eb67);_0x2e372d['port']=0x24b;_0x2e372d[_0x1b3a('0x39')]=![];_0xb03ddb['service']=_0x2e372d[_0x1b3a('0x3a')]=null;}else{if(_0x54bc04[_0x1b3a('0x3b')]){_0xb03ddb['user']=_0x2e372d[_0x1b3a('0x32')]=_0x54bc04['username'];_0xb03ddb['password']=_0x2e372d[_0x1b3a('0x35')]=_0x54bc04[_0x1b3a('0x34')];}else{_0xb03ddb[_0x1b3a('0x3b')]=_0x2e372d[_0x1b3a('0x3b')]=![];_0xb03ddb[_0x1b3a('0x32')]=_0x2e372d['user']=null;_0xb03ddb['password']=_0x2e372d[_0x1b3a('0x35')]=null;}_0xb03ddb[_0x1b3a('0x38')]=_0x54bc04['Imap'][_0x1b3a('0x38')];_0xb03ddb[_0x1b3a('0x3c')]=_0x54bc04[_0x1b3a('0x3d')][_0x1b3a('0x3c')];_0x2e372d[_0x1b3a('0x38')]=_0x54bc04[_0x1b3a('0x3e')][_0x1b3a('0x38')];_0x2e372d['port']=_0x54bc04['Smtp'][_0x1b3a('0x3c')];}return{'Imap':_0xb03ddb,'Smtp':_0x2e372d};}exports[_0x1b3a('0x3f')]=function(_0x580a46,_0x73efb8){var _0x1e1d36={'include':[{'model':db[_0x1b3a('0x40')],'as':_0x1b3a('0x3d')},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db[_0x1b3a('0x42')],'as':_0x1b3a('0x43')}]},_0x31b344={},_0x5cb120={'count':0x0,'rows':[]};var _0x43c1bb=_[_0x1b3a('0x44')](db[_0x1b3a('0x45')]['rawAttributes'],function(_0x566e8c){return{'name':_0x566e8c[_0x1b3a('0x46')],'type':_0x566e8c['type'][_0x1b3a('0x47')]};});_0x31b344[_0x1b3a('0x48')]=_[_0x1b3a('0x44')](_0x43c1bb,_0x1b3a('0x28'));_0x31b344['query']=_[_0x1b3a('0x49')](_0x580a46[_0x1b3a('0x4a')]);_0x31b344[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x31b344['model'],_0x31b344[_0x1b3a('0x4a')]);_0x1e1d36[_0x1b3a('0x4d')]=_['intersection'](_0x31b344['model'],qs[_0x1b3a('0x4e')](_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x1e1d36[_0x1b3a('0x4d')]=_0x1e1d36['attributes'][_0x1b3a('0x4f')]?_0x1e1d36[_0x1b3a('0x4d')]:_0x31b344[_0x1b3a('0x48')];if(!_0x580a46[_0x1b3a('0x4a')]['hasOwnProperty'](_0x1b3a('0x50'))){_0x1e1d36['limit']=qs[_0x1b3a('0x1e')](_0x580a46['query'][_0x1b3a('0x1e')]);_0x1e1d36['offset']=qs[_0x1b3a('0x1b')](_0x580a46[_0x1b3a('0x4a')]['offset']);}_0x1e1d36[_0x1b3a('0x51')]=qs['sort'](_0x580a46[_0x1b3a('0x4a')]['sort']);_0x1e1d36[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x580a46[_0x1b3a('0x4a')],_0x31b344[_0x1b3a('0x4b')]),_0x43c1bb);if(_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x1e1d36[_0x1b3a('0x52')]=_[_0x1b3a('0x55')](_0x1e1d36[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x43c1bb,function(_0x400c6b){if(_0x400c6b[_0x1b3a('0x56')]!=='VIRTUAL'){var _0x2a262e={};_0x2a262e[_0x400c6b[_0x1b3a('0x28')]]={'$like':'%'+_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x2a262e;}})});}_0x1e1d36=_[_0x1b3a('0x55')]({},_0x1e1d36,_0x580a46[_0x1b3a('0x57')]);var _0x1df22f={'where':_0x1e1d36[_0x1b3a('0x52')]};return db[_0x1b3a('0x45')]['count'](_0x1df22f)[_0x1b3a('0x22')](function(_0x50e3de){_0x5cb120['count']=_0x50e3de;if(_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x1e1d36[_0x1b3a('0x59')]=[{'all':!![]}];}return db[_0x1b3a('0x45')][_0x1b3a('0x5a')](_0x1e1d36);})['then'](function(_0x22ccb8){_0x5cb120[_0x1b3a('0x5b')]=_0x22ccb8;return _0x5cb120;})[_0x1b3a('0x22')](respondWithFilteredResult(_0x73efb8,_0x1e1d36))['catch'](handleError(_0x73efb8,null));};exports['show']=function(_0x5b24ca,_0x485fb9){var _0x5c74fe={'raw':![],'where':{'id':_0x5b24ca[_0x1b3a('0x5c')]['id']},'include':[{'model':db[_0x1b3a('0x40')],'as':'Imap'},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db['Pause'],'as':_0x1b3a('0x43')}]},_0x1a1959={};_0x1a1959[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db[_0x1b3a('0x45')][_0x1b3a('0x5d')]);_0x1a1959[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x5b24ca['query']);_0x1a1959['filters']=_['intersection'](_0x1a1959['model'],_0x1a1959[_0x1b3a('0x4a')]);_0x5c74fe[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0x1a1959[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5b24ca[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x5c74fe[_0x1b3a('0x4d')]=_0x5c74fe[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x5c74fe['attributes']:_0x1a1959[_0x1b3a('0x48')];if(_0x5b24ca[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x5c74fe['include']=[{'all':!![]}];}_0x5c74fe=_[_0x1b3a('0x55')]({},_0x5c74fe,_0x5b24ca[_0x1b3a('0x57')]);return db[_0x1b3a('0x45')][_0x1b3a('0x5e')](_0x5c74fe)[_0x1b3a('0x22')](handleEntityNotFound(_0x485fb9,null))[_0x1b3a('0x22')](respondWithResult(_0x485fb9,null))[_0x1b3a('0x5f')](handleError(_0x485fb9,null));};exports[_0x1b3a('0x21')]=function(_0x47a348,_0x598f2b){if(_0x47a348[_0x1b3a('0x60')]['id']){delete _0x47a348['body']['id'];}var _0x384a80=_0x47a348[_0x1b3a('0x60')]['provider']===_0x1b3a('0x61')?null:_0x47a348['body'][_0x1b3a('0x62')];var _0x3f02d3=_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3d')]||{};var _0x23a114=_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3e')]||{};if(_0x384a80){_0x3f02d3[_0x1b3a('0x38')]=getImapHost(_0x384a80);_0x3f02d3[_0x1b3a('0x3c')]=0x3e1;_0x23a114[_0x1b3a('0x38')]=getSmtpHost(_0x384a80);_0x23a114['port']=0x24b;_0x23a114[_0x1b3a('0x39')]=![];}if(_0x23a114[_0x1b3a('0x36')]){_0x23a114[_0x1b3a('0x39')]=![];}else{_0x23a114['CloudProviderId']=null;}if(!_0x3f02d3[_0x1b3a('0x36')])_0x3f02d3[_0x1b3a('0x37')]=null;_0x47a348[_0x1b3a('0x60')]['Imap']=_0x3f02d3;_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3e')]=_0x23a114;return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x47a348['params']['id']},'include':[{'model':db[_0x1b3a('0x40')],'as':_0x1b3a('0x3d')},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db[_0x1b3a('0x42')],'as':_0x1b3a('0x43')}]})[_0x1b3a('0x22')](handleEntityNotFound(_0x598f2b,null))['then'](function(_0x3e9368){if(!_0x3e9368)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3e9368['service'])delete _0x47a348['body']['Imap'];return _0x3e9368;})[_0x1b3a('0x22')](saveUpdates(_0x47a348[_0x1b3a('0x60')],null))['then'](function(_0x4d71cf){if(!_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3d')])return _0x4d71cf;return db[_0x1b3a('0x40')][_0x1b3a('0x21')](_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3d')],{'where':{'MailAccountId':_0x4d71cf['id']}})[_0x1b3a('0x22')](function(){return _0x4d71cf;});})[_0x1b3a('0x22')](function(_0x402bcc){if(!_0x47a348[_0x1b3a('0x60')]['Smtp'])return _0x402bcc;return db[_0x1b3a('0x41')]['update'](_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3e')],{'where':{'MailAccountId':_0x402bcc['id']}})[_0x1b3a('0x22')](function(){return _0x402bcc;});})['then'](respondWithResult(_0x598f2b,null))[_0x1b3a('0x5f')](handleError(_0x598f2b,null));};exports['describe']=function(_0x4edadf,_0x167f16){return db[_0x1b3a('0x45')][_0x1b3a('0x63')]()['then'](respondWithResult(_0x167f16,null))['catch'](handleError(_0x167f16,null));};exports[_0x1b3a('0x64')]=function(_0x21533f,_0x440196){if(_0x21533f['body']['id']){delete _0x21533f[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x21533f[_0x1b3a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x440196,null))['then'](function(_0x4c32d7){if(_0x4c32d7){_0x21533f[_0x1b3a('0x60')][_0x1b3a('0x65')]=_0x4c32d7['id'];return db[_0x1b3a('0x66')][_0x1b3a('0x67')](_0x21533f['body']);}})[_0x1b3a('0x22')](respondWithResult(_0x440196,null))[_0x1b3a('0x5f')](handleError(_0x440196,null));};exports['getDispositions']=function(_0x5a49d7,_0x453ba6){var _0x2cb948={'raw':![],'where':{}};var _0x2942f7={};var _0x13e5c6={'count':0x0,'rows':[]};return db['MailAccount'][_0x1b3a('0x68')]({'where':{'id':_0x5a49d7[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x453ba6,null))[_0x1b3a('0x22')](function(_0x5819ac){if(_0x5819ac){_0x2942f7['model']=_['keys'](db[_0x1b3a('0x66')][_0x1b3a('0x5d')]);_0x2942f7[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x5a49d7[_0x1b3a('0x4a')]);_0x2942f7['filters']=_[_0x1b3a('0x4c')](_0x2942f7[_0x1b3a('0x48')],_0x2942f7[_0x1b3a('0x4a')]);_0x2cb948['attributes']=_[_0x1b3a('0x4c')](_0x2942f7[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x2cb948['attributes']=_0x2cb948[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x2cb948[_0x1b3a('0x4d')]:_0x2942f7[_0x1b3a('0x48')];if(!_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x2cb948[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x5a49d7['query'][_0x1b3a('0x1e')]);_0x2cb948[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x2cb948[_0x1b3a('0x51')]=qs[_0x1b3a('0x6a')](_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x6a')]);_0x2cb948[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x5a49d7[_0x1b3a('0x4a')],_0x2942f7['filters']));_0x2cb948[_0x1b3a('0x52')][_0x1b3a('0x65')]=_0x5819ac['id'];if(_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x2cb948['where']=_[_0x1b3a('0x55')](_0x2cb948[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x2cb948[_0x1b3a('0x4d')],function(_0x5a1929){var _0x4567dd={};_0x4567dd[_0x5a1929]={'$like':'%'+_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x4567dd;})});}_0x2cb948=_[_0x1b3a('0x55')]({},_0x2cb948,_0x5a49d7['options']);return db[_0x1b3a('0x66')][_0x1b3a('0x1d')]({'where':_0x2cb948[_0x1b3a('0x52')]})['then'](function(_0x528b56){_0x13e5c6[_0x1b3a('0x1d')]=_0x528b56;if(_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x2cb948['include']=[{'all':!![]}];}return db[_0x1b3a('0x66')][_0x1b3a('0x5a')](_0x2cb948);})[_0x1b3a('0x22')](function(_0x2ebed2){_0x13e5c6[_0x1b3a('0x5b')]=_0x2ebed2;return _0x13e5c6;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x453ba6,_0x2cb948))[_0x1b3a('0x5f')](handleError(_0x453ba6,null));};exports[_0x1b3a('0x6b')]=function(_0x4d4791,_0x568b52){return db['MailAccount'][_0x1b3a('0x5e')]({'where':{'id':_0x4d4791[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x568b52,null))[_0x1b3a('0x22')](function(_0x2cf5f1){if(_0x2cf5f1){return _0x2cf5f1[_0x1b3a('0x6b')](_0x4d4791[_0x1b3a('0x4a')]['ids']);}})[_0x1b3a('0x22')](respondWithStatusCode(_0x568b52,null))[_0x1b3a('0x5f')](handleError(_0x568b52,null));};exports[_0x1b3a('0x6c')]=function(_0x4a33de,_0x10eb97){if(_0x4a33de[_0x1b3a('0x60')]['id']){delete _0x4a33de[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')]['find']({'where':{'id':_0x4a33de[_0x1b3a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x10eb97,null))['then'](function(_0xce60af){if(_0xce60af){_0x4a33de[_0x1b3a('0x60')][_0x1b3a('0x65')]=_0xce60af['id'];return db[_0x1b3a('0x6d')][_0x1b3a('0x67')](_0x4a33de[_0x1b3a('0x60')]);}})[_0x1b3a('0x22')](respondWithResult(_0x10eb97,null))['catch'](handleError(_0x10eb97,null));};exports[_0x1b3a('0x6e')]=function(_0x359926,_0x503147){var _0x4c7c10={'raw':![],'where':{}};var _0x442e6a={};var _0x5837b8={'count':0x0,'rows':[]};return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x359926[_0x1b3a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x503147,null))[_0x1b3a('0x22')](function(_0x1d5c4c){if(_0x1d5c4c){_0x442e6a[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db[_0x1b3a('0x6d')][_0x1b3a('0x5d')]);_0x442e6a[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x359926[_0x1b3a('0x4a')]);_0x442e6a[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x442e6a['model'],_0x442e6a[_0x1b3a('0x4a')]);_0x4c7c10[_0x1b3a('0x4d')]=_['intersection'](_0x442e6a[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x4c7c10['attributes']=_0x4c7c10[_0x1b3a('0x4d')]['length']?_0x4c7c10[_0x1b3a('0x4d')]:_0x442e6a[_0x1b3a('0x48')];if(!_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x4c7c10[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x4c7c10[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x4c7c10[_0x1b3a('0x51')]=qs[_0x1b3a('0x6a')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x6a')]);_0x4c7c10['where']=qs['filters'](_[_0x1b3a('0x53')](_0x359926['query'],_0x442e6a[_0x1b3a('0x4b')]));_0x4c7c10[_0x1b3a('0x52')]['MailAccountId']=_0x1d5c4c['id'];if(_0x359926['query']['filter']){_0x4c7c10[_0x1b3a('0x52')]=_['merge'](_0x4c7c10[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x4c7c10[_0x1b3a('0x4d')],function(_0x475e03){var _0x972af6={};_0x972af6[_0x475e03]={'$like':'%'+_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x972af6;})});}_0x4c7c10=_[_0x1b3a('0x55')]({},_0x4c7c10,_0x359926[_0x1b3a('0x57')]);return db[_0x1b3a('0x6d')][_0x1b3a('0x1d')]({'where':_0x4c7c10[_0x1b3a('0x52')]})[_0x1b3a('0x22')](function(_0x239beb){_0x5837b8[_0x1b3a('0x1d')]=_0x239beb;if(_0x359926['query']['includeAll']){_0x4c7c10[_0x1b3a('0x59')]=[{'all':!![]}];}return db[_0x1b3a('0x6d')][_0x1b3a('0x5a')](_0x4c7c10);})['then'](function(_0x4d174a){_0x5837b8[_0x1b3a('0x5b')]=_0x4d174a;return _0x5837b8;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x503147,_0x4c7c10))['catch'](handleError(_0x503147,null));};exports['removeAnswers']=function(_0x1317be,_0x390389){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x1317be[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x390389,null))[_0x1b3a('0x22')](function(_0x45042c){if(_0x45042c){return _0x45042c['removeAnswers'](_0x1317be['query']['ids']);}})[_0x1b3a('0x22')](respondWithStatusCode(_0x390389,null))[_0x1b3a('0x5f')](handleError(_0x390389,null));};exports[_0x1b3a('0x67')]=function(_0x390f18,_0x4796d7){var _0x2d4010={'name':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x28')],'key':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x47')],'provider':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x62')]===_0x1b3a('0x61')?null:_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x62')],'email':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x6f')],'ListId':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x70')],'active':!_[_0x1b3a('0x71')](_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x72')])?_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x72')]:!![],'description':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x73')]||null};var _0x29a0e9=getAuthenticationOptions(_0x2d4010[_0x1b3a('0x62')],_0x390f18[_0x1b3a('0x60')]);_0x2d4010[_0x1b3a('0x3d')]=_0x29a0e9[_0x1b3a('0x3d')];_0x2d4010[_0x1b3a('0x3e')]=_0x29a0e9[_0x1b3a('0x3e')];return db['MailAccount'][_0x1b3a('0x67')](_0x2d4010,{'include':[{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db[_0x1b3a('0x40')],'as':_0x1b3a('0x3d')}]})[_0x1b3a('0x22')](function(_0x10535a){var _0x48a066=_0x390f18[_0x1b3a('0x32')]['get']({'plain':!![]});if(!_0x48a066)throw new Error(_0x1b3a('0x74'));if(_0x48a066[_0x1b3a('0x75')]==='user'){var _0x9c5dad=_0x10535a[_0x1b3a('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x1b3a('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x48a066[_0x1b3a('0x76')]},'raw':!![]})[_0x1b3a('0x22')](function(_0xdf423a){if(_0xdf423a&&_0xdf423a[_0x1b3a('0x77')]===0x0){return db['UserProfileResource'][_0x1b3a('0x67')]({'name':_0x9c5dad[_0x1b3a('0x28')],'resourceId':_0x9c5dad['id'],'type':_0xdf423a['name'],'sectionId':_0xdf423a['id']},{})[_0x1b3a('0x22')](function(){return _0x10535a;});}else{return _0x10535a;}})[_0x1b3a('0x5f')](function(_0x5370bf){logger['error'](_0x1b3a('0x78'),_0x5370bf);throw _0x5370bf;});}return _0x10535a;})[_0x1b3a('0x22')](respondWithResult(_0x4796d7,0xc9))[_0x1b3a('0x5f')](handleError(_0x4796d7,null));};exports[_0x1b3a('0x79')]=function(_0x23fa8a,_0x5d577f){return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x23fa8a['params']['id']}})['then'](handleEntityNotFound(_0x5d577f,null))['then'](function(_0x2bf717){if(_0x2bf717){return _0x2bf717[_0x1b3a('0x79')]();}return null;})['then'](respondWithResult(_0x5d577f,null))[_0x1b3a('0x5f')](handleError(_0x5d577f,null));};exports[_0x1b3a('0x7a')]=function(_0x3f29d7,_0x56a6d5){if(_0x3f29d7[_0x1b3a('0x60')]['id']){delete _0x3f29d7[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x3f29d7['params']['id']}})['then'](handleEntityNotFound(_0x56a6d5,null))[_0x1b3a('0x22')](function(_0x448e70){if(_0x448e70){_0x3f29d7[_0x1b3a('0x60')][_0x1b3a('0x65')]=_0x448e70['id'];return db[_0x1b3a('0x40')][_0x1b3a('0x67')](_0x3f29d7['body']);}})[_0x1b3a('0x22')](respondWithResult(_0x56a6d5,null))[_0x1b3a('0x5f')](handleError(_0x56a6d5,null));};exports[_0x1b3a('0x7b')]=function(_0x4f4df0,_0x22bbe5){return db['MailAccount'][_0x1b3a('0x68')]({'where':{'id':_0x4f4df0[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x22bbe5,null))['then'](function(_0xbc7309){if(_0xbc7309){return _0xbc7309[_0x1b3a('0x7c')](null);}return null;})[_0x1b3a('0x22')](respondWithStatusCode(_0x22bbe5,null))['catch'](handleError(_0x22bbe5,null));};exports[_0x1b3a('0x7d')]=function(_0x2c32af,_0x2515b5){return db[_0x1b3a('0x45')]['findOne']({'where':{'id':_0x2c32af[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x2515b5,null))[_0x1b3a('0x22')](function(_0x21bc6c){if(_0x21bc6c){return _0x21bc6c['getSmtp']();}return null;})[_0x1b3a('0x22')](respondWithResult(_0x2515b5,null))[_0x1b3a('0x5f')](handleError(_0x2515b5,null));};exports[_0x1b3a('0x7e')]=function(_0x3647b4,_0x3032f9){if(_0x3647b4['body']['id']){delete _0x3647b4[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')]['find']({'where':{'id':_0x3647b4[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x3032f9,null))[_0x1b3a('0x22')](function(_0x48b0e1){if(_0x48b0e1){_0x3647b4[_0x1b3a('0x60')]['MailAccountId']=_0x48b0e1['id'];return db['MailServerOut'][_0x1b3a('0x67')](_0x3647b4[_0x1b3a('0x60')]);}})[_0x1b3a('0x22')](respondWithResult(_0x3032f9,null))[_0x1b3a('0x5f')](handleError(_0x3032f9,null));};exports[_0x1b3a('0x7f')]=function(_0x4d8e80,_0x51260c){return db['MailAccount'][_0x1b3a('0x68')]({'where':{'id':_0x4d8e80[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x51260c,null))['then'](function(_0x3f5539){if(_0x3f5539){return _0x3f5539[_0x1b3a('0x80')](null);}return null;})[_0x1b3a('0x22')](respondWithStatusCode(_0x51260c,null))[_0x1b3a('0x5f')](handleError(_0x51260c,null));};exports[_0x1b3a('0x81')]=function(_0x20d234,_0x32bc21){return db['MailInteraction']['find']({'where':{'id':_0x20d234['params']['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x32bc21,null))[_0x1b3a('0x22')](function(_0x18b7c6){if(_0x18b7c6){return _0x18b7c6['addInteraction'](_0x20d234[_0x1b3a('0x60')]['ids'],_[_0x1b3a('0x82')](_0x20d234[_0x1b3a('0x60')],[_0x1b3a('0x83'),'id'])||{});}})[_0x1b3a('0x22')](respondWithResult(_0x32bc21,null))[_0x1b3a('0x5f')](handleError(_0x32bc21,null));};exports[_0x1b3a('0x84')]=function(_0x746be0,_0x5b5a00){var _0x5423b2={'raw':![],'where':{}};var _0x544325={};var _0x2c9fc3={'count':0x0,'rows':[]};return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x746be0[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x5b5a00,null))[_0x1b3a('0x22')](function(_0x1672fd){if(_0x1672fd){_0x544325[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db['MailInteraction'][_0x1b3a('0x5d')]);_0x544325[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x746be0[_0x1b3a('0x4a')]);_0x544325[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x544325[_0x1b3a('0x48')],_0x544325[_0x1b3a('0x4a')]);_0x5423b2[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0x544325[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x5423b2[_0x1b3a('0x4d')]=_0x5423b2[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x5423b2[_0x1b3a('0x4d')]:_0x544325[_0x1b3a('0x48')];if(!_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x5423b2[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x5423b2[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x5423b2[_0x1b3a('0x51')]=qs['sort'](_0x746be0[_0x1b3a('0x4a')]['sort']);_0x5423b2['where']=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x746be0[_0x1b3a('0x4a')],_0x544325[_0x1b3a('0x4b')]));_0x5423b2[_0x1b3a('0x52')][_0x1b3a('0x65')]=_0x1672fd['id'];if(_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x5423b2['where']=_['merge'](_0x5423b2[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x5423b2[_0x1b3a('0x4d')],function(_0xe83b31){var _0x30f460={};_0x30f460[_0xe83b31]={'$like':'%'+_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x30f460;})});}_0x5423b2=_[_0x1b3a('0x55')]({},_0x5423b2,_0x746be0[_0x1b3a('0x57')]);return db[_0x1b3a('0x85')][_0x1b3a('0x1d')]({'where':_0x5423b2[_0x1b3a('0x52')]})[_0x1b3a('0x22')](function(_0x4c78e7){_0x2c9fc3[_0x1b3a('0x1d')]=_0x4c78e7;if(_0x746be0[_0x1b3a('0x4a')]['includeAll']){_0x5423b2[_0x1b3a('0x59')]=[{'model':db[_0x1b3a('0x86')],'as':_0x1b3a('0x87'),'required':![]},{'model':db['User'],'as':_0x1b3a('0x88'),'attributes':[_0x1b3a('0x28'),_0x1b3a('0x89'),_0x1b3a('0x8a')],'required':![]},{'model':db['Tag'],'as':_0x1b3a('0x8b'),'attributes':['id','name','color'],'where':_0x746be0[_0x1b3a('0x4a')]['tag']?{'id':_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x8c')]}:undefined,'required':_0x746be0['query'][_0x1b3a('0x8c')]?!![]:![]}];}return db['MailInteraction'][_0x1b3a('0x5a')](_0x5423b2);})[_0x1b3a('0x22')](function(_0x42da77){_0x2c9fc3[_0x1b3a('0x5b')]=_0x42da77;return _0x2c9fc3;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x5b5a00,_0x5423b2))['catch'](handleError(_0x5b5a00,null));};exports[_0x1b3a('0x8d')]=function addApplications(_0x24b842,_0x3da849){var _0x355713=_0x24b842['params']['id'];var _0x112e2f=_0x24b842['body'];var _0x3bc83a=0xc8;var _0x492e62=null;return db[_0x1b3a('0x8e')][_0x1b3a('0x8f')]({'isolationLevel':db[_0x1b3a('0x8e')][_0x1b3a('0x90')][_0x1b3a('0x91')][_0x1b3a('0x92')]},function(_0x26a4a4){return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x355713},'transaction':_0x26a4a4})[_0x1b3a('0x22')](function(_0x597e17){if(_0x597e17){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x355713},'transaction':_0x26a4a4})['then'](function(){var _0x213a81=_[_0x1b3a('0x44')](_0x112e2f,function(_0x195f09){_0x195f09['MailAccountId']=_0x355713;return _0x195f09;});return db['MailApplication'][_0x1b3a('0x93')](_0x213a81,{'transaction':_0x26a4a4});});}else{_0x3bc83a=0x194;_0x492e62=[];}});})[_0x1b3a('0x22')](function(){if(_0x3bc83a!==0x194){return db[_0x1b3a('0x94')][_0x1b3a('0x95')]({'where':{'MailAccountId':_0x355713},'order':'priority'})[_0x1b3a('0x22')](function(_0x36f8e7){_0x492e62=_0x36f8e7;});}})[_0x1b3a('0x5f')](function(_0x2602e3){_0x3bc83a=0x1f4;logger[_0x1b3a('0x14')](_0x2602e3[_0x1b3a('0x27')]);if(_0x2602e3[_0x1b3a('0x28')]){delete _0x2602e3[_0x1b3a('0x28')];}_0x492e62=_0x2602e3;})[_0x1b3a('0x96')](function(){if(_0x492e62===null){_0x3da849['sendStatus'](_0x3bc83a);}else{if(_0x3bc83a===0x1f4){_0x3da849[_0x1b3a('0x19')](_0x3bc83a)[_0x1b3a('0x29')](_0x492e62);}else{_0x3da849['status'](_0x3bc83a)['json'](_0x492e62);}}});};exports['getApplications']=function(_0x5ed9cf,_0x317af0){var _0x8c82b0={};var _0xe1fe5c={};var _0x2ae329;var _0x3a171f;return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x5ed9cf[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x317af0,null))['then'](function(_0x7de7d7){if(_0x7de7d7){_0x2ae329=_0x7de7d7;_0xe1fe5c[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db[_0x1b3a('0x94')][_0x1b3a('0x5d')]);_0xe1fe5c[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x5ed9cf[_0x1b3a('0x4a')]);_0xe1fe5c[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0xe1fe5c[_0x1b3a('0x48')],_0xe1fe5c[_0x1b3a('0x4a')]);_0x8c82b0[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0xe1fe5c[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x8c82b0[_0x1b3a('0x4d')]=_0x8c82b0[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x8c82b0[_0x1b3a('0x4d')]:_0xe1fe5c['model'];_0x8c82b0[_0x1b3a('0x51')]=qs['sort'](_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x6a')]);_0x8c82b0[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x5ed9cf[_0x1b3a('0x4a')],_0xe1fe5c[_0x1b3a('0x4b')]));if(_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x8c82b0[_0x1b3a('0x52')]=_[_0x1b3a('0x55')](_0x8c82b0[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x8c82b0['attributes'],function(_0x4f5c67){var _0x2ea1f3={};_0x2ea1f3[_0x4f5c67]={'$like':'%'+_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x2ea1f3;})});}_0x8c82b0=_['merge']({},_0x8c82b0,_0x5ed9cf['options']);return _0x2ae329[_0x1b3a('0x97')](_0x8c82b0);}})[_0x1b3a('0x22')](function(_0x192a4c){if(_0x192a4c){_0x3a171f=_0x192a4c['length'];if(!_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x69')]('nolimit')){_0x8c82b0['limit']=qs[_0x1b3a('0x1e')](_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x8c82b0[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x5ed9cf['query'][_0x1b3a('0x1b')]);}return _0x2ae329[_0x1b3a('0x97')](_0x8c82b0);}})[_0x1b3a('0x22')](function(_0x5a8bee){if(_0x5a8bee){return _0x5a8bee?{'count':_0x3a171f,'rows':_0x5a8bee}:null;}})[_0x1b3a('0x22')](respondWithResult(_0x317af0,null))[_0x1b3a('0x5f')](handleError(_0x317af0,null));};exports[_0x1b3a('0x98')]=function(_0x5369de,_0x326e9b){var _0x52d63a={'raw':!![],'where':{}};var _0x1ce399={};var _0x149c1b={'count':0x0,'rows':[]};return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x5369de[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x326e9b,null))[_0x1b3a('0x22')](function(_0x244c81){if(_0x244c81){_0x1ce399[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db['MailMessage'][_0x1b3a('0x5d')]);_0x1ce399['query']=_[_0x1b3a('0x49')](_0x5369de[_0x1b3a('0x4a')]);_0x1ce399[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x1ce399[_0x1b3a('0x48')],_0x1ce399['query']);_0x52d63a[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0x1ce399[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x52d63a[_0x1b3a('0x4d')]=_0x52d63a[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x52d63a['attributes']:_0x1ce399[_0x1b3a('0x48')];if(!_0x5369de['query'][_0x1b3a('0x69')]('nolimit')){_0x52d63a[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x5369de[_0x1b3a('0x4a')]['limit']);_0x52d63a[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x52d63a['order']=qs[_0x1b3a('0x6a')](_0x5369de['query'][_0x1b3a('0x6a')]);_0x52d63a['where']=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x5369de[_0x1b3a('0x4a')],_0x1ce399['filters']));_0x52d63a[_0x1b3a('0x52')][_0x1b3a('0x65')]=_0x244c81['id'];if(_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x52d63a['where']=_[_0x1b3a('0x55')](_0x52d63a[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x52d63a['attributes'],function(_0x276ef6){var _0x2db23f={};_0x2db23f[_0x276ef6]={'$like':'%'+_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x2db23f;})});}if(_0x5369de[_0x1b3a('0x4a')]['$gte']){var _0x4f2f12=_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x99')][_0x1b3a('0x9a')](',');var _0xb60e6e={};_0xb60e6e[_0x4f2f12[0x0]]={'$gte':moment(_0x4f2f12[0x1])[_0x1b3a('0x9b')](_0x1b3a('0x9c'))};_0x52d63a['where']=_[_0x1b3a('0x55')](_0x52d63a['where'],_0xb60e6e);}_0x52d63a=_[_0x1b3a('0x55')]({},_0x52d63a,_0x5369de[_0x1b3a('0x57')]);return db['MailMessage'][_0x1b3a('0x1d')]({'where':_0x52d63a['where']})[_0x1b3a('0x22')](function(_0x4d290d){_0x149c1b['count']=_0x4d290d;if(_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x52d63a[_0x1b3a('0x59')]=[{'all':!![]}];}return db[_0x1b3a('0x9d')]['findAll'](_0x52d63a);})[_0x1b3a('0x22')](function(_0x439cf4){if(_0x5369de[_0x1b3a('0x4a')]['inlineCss']===_0x1b3a('0x9e')){for(var _0x3d1c2e=0x0;_0x3d1c2e<_0x439cf4['length'];_0x3d1c2e++){_0x439cf4[_0x3d1c2e]['body']=juice(_0x439cf4[_0x3d1c2e][_0x1b3a('0x60')]);}}_0x149c1b[_0x1b3a('0x5b')]=_0x439cf4;return _0x149c1b;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x326e9b,_0x52d63a))[_0x1b3a('0x5f')](handleError(_0x326e9b,null));};exports[_0x1b3a('0x29')]=function(_0x816fd7,_0x422d9a){var _0x3b66d0,_0x1cb7d1={},_0x48fc12;if(_0x816fd7[_0x1b3a('0x60')]['to']){_0x48fc12=_0x816fd7[_0x1b3a('0x60')]['to'][_0x1b3a('0x9a')](',')[0x0];}return db['MailAccount'][_0x1b3a('0x5e')]({'where':{'id':_0x816fd7[_0x1b3a('0x5c')]['id']},'include':[{'model':db[_0x1b3a('0x9f')],'as':'List','include':[{'model':db[_0x1b3a('0x86')],'as':'Contacts','where':{'email':_0x48fc12},'limit':0x1,'order':[[_0x1b3a('0xa0'),_0x1b3a('0xa1')]]}]},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1b3a('0xa2'),'raw':!![]}]}]})[_0x1b3a('0x22')](handleEntityNotFound(_0x422d9a,null))[_0x1b3a('0x22')](function(_0x366e1e){if(!_0x366e1e)return;_0x3b66d0=_0x366e1e;if(!_0x366e1e[_0x1b3a('0x3e')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa3')])){_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa3')]=util[_0x1b3a('0x9b')](_0x1b3a('0xa4'),_0x366e1e[_0x1b3a('0x28')],_0x366e1e[_0x1b3a('0x6f')]||_0x366e1e[_0x1b3a('0x3e')][_0x1b3a('0x32')]);}if(_0x816fd7[_0x1b3a('0x60')]['attachments']&&_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')][_0x1b3a('0x4f')]){for(var _0x3c536f=0x0;_0x3c536f<_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')]['length'];_0x3c536f+=0x1){_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')][_0x3c536f]={'filename':_0x816fd7[_0x1b3a('0x60')]['attachments'][_0x3c536f][_0x1b3a('0x28')],'path':path[_0x1b3a('0xa6')](config[_0x1b3a('0xa7')],_0x1b3a('0xa8'),_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')][_0x3c536f][_0x1b3a('0xa9')])};}}var _0x24109c=_0x366e1e[_0x1b3a('0xaa')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x24109c,'message':_0x816fd7['body']});})['then'](function(_0x33755a){if(!_0x33755a)return;_0x1cb7d1=_0x33755a;if(!_0x3b66d0['List'])throw new Error(_0x1b3a('0xab'));if(_0x3b66d0['List']['Contacts']['length'])return _0x3b66d0[_0x1b3a('0xac')]['Contacts'][0x0];return db[_0x1b3a('0x86')]['create'](_[_0x1b3a('0x9')](_0x816fd7[_0x1b3a('0x60')],{'firstName':_0x816fd7[_0x1b3a('0x60')]['to'],'email':_0x816fd7['body']['to'],'phone':_0x816fd7[_0x1b3a('0x60')]['to'],'ListId':_0x3b66d0['ListId']}));})[_0x1b3a('0x22')](function(_0x42f670){if(!_0x42f670)return;var _0x38c944={'UserId':_0x816fd7['user']['id'],'ContactId':_0x42f670['id'],'MailAccountId':_0x3b66d0['id'],'inReplyTo':_0x1cb7d1[_0x1b3a('0xad')],'to':_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa3')],'cc':_0x816fd7[_0x1b3a('0x60')]['cc'],'subject':_0x816fd7['body']['subject'],'attach':_0x816fd7['body'][_0x1b3a('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x1b3a('0x9b')](_0x1b3a('0x9c')),'lastMsgDirection':'out','Messages':[_[_0x1b3a('0x55')](_0x816fd7['body'],{'messageId':_0x1cb7d1[_0x1b3a('0xad')],'sentAt':moment()['format'](_0x1b3a('0x9c')),'read':!![],'MailAccountId':_0x3b66d0['id'],'UserId':_0x816fd7[_0x1b3a('0x32')]['id'],'ContactId':_0x42f670['id']})]};if(_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xaf')]){_0x38c944=_[_0x1b3a('0x55')](_0x38c944,_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xaf')]);}return db[_0x1b3a('0x85')][_0x1b3a('0x67')](_0x38c944,{'include':[{'model':db['MailMessage'],'as':_0x1b3a('0xb0')}]});})[_0x1b3a('0x22')](respondWithResult(_0x422d9a,null))[_0x1b3a('0x5f')](handleError(_0x422d9a,null));};exports[_0x1b3a('0xb1')]=function(_0x12dcee,_0x19aa90){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x12dcee[_0x1b3a('0x5c')]['id']},'include':[{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1b3a('0xa2'),'raw':!![]}]}]})[_0x1b3a('0x22')](handleEntityNotFound(_0x19aa90,null))[_0x1b3a('0x22')](function(_0x4fbb7b){if(!_0x4fbb7b[_0x1b3a('0x3e')])return;var _0x3b09f4=_0x4fbb7b[_0x1b3a('0xaa')]();return respondWithRpcPromise(_0x1b3a('0xb2'),_0x1b3a('0xb1'),{'account':_0x3b09f4});})[_0x1b3a('0x22')](respondWithResult(_0x19aa90,null))[_0x1b3a('0x5f')](handleError(_0x19aa90,null));};exports[_0x1b3a('0x26')]=function(_0x307162,_0x42a9f8){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x307162[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x42a9f8,null))[_0x1b3a('0x22')](function(_0x32f364){if(_0x32f364&&_0x32f364['service']){throw new db[(_0x1b3a('0xb3'))]['ValidationError'](_0x1b3a('0xb4'));}return _0x32f364;})[_0x1b3a('0x22')](removeEntity(_0x42a9f8,null))[_0x1b3a('0x5f')](handleError(_0x42a9f8,null));};exports[_0x1b3a('0xb5')]=function(_0xfe1470,_0x1a77a4){return db['MailAccount'][_0x1b3a('0x5e')]({'where':{'id':_0xfe1470[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x1a77a4,null))[_0x1b3a('0x22')](function(_0x1e38bd){if(_0x1e38bd){return _0x1e38bd['addAgents'](_0xfe1470[_0x1b3a('0x60')][_0x1b3a('0x83')],_[_0x1b3a('0x82')](_0xfe1470[_0x1b3a('0x60')],[_0x1b3a('0x83'),'id'])||{})[_0x1b3a('0xb6')](function(_0xa5de5b){for(var _0x2797ca=0x0;_0x2797ca<_0xfe1470[_0x1b3a('0x60')][_0x1b3a('0x83')][_0x1b3a('0x4f')];_0x2797ca+=0x1){socket[_0x1b3a('0xb7')](_0x1b3a('0xb8'),{'UserId':Number(_0xfe1470[_0x1b3a('0x60')][_0x1b3a('0x83')][_0x2797ca]),'MailAccountId':Number(_0xfe1470[_0x1b3a('0x5c')]['id'])});}return _0xa5de5b;});}})[_0x1b3a('0x22')](respondWithResult(_0x1a77a4,null))[_0x1b3a('0x5f')](handleError(_0x1a77a4,null));};exports['removeAgents']=function(_0x343df1,_0x7be054){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x343df1[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x7be054,null))[_0x1b3a('0x22')](function(_0x20e7df){if(_0x20e7df){return _0x20e7df['removeAgents'](_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')])[_0x1b3a('0x22')](function(){if(_[_0x1b3a('0xb9')](_0x343df1['query'][_0x1b3a('0x83')])){for(var _0x54db32=0x0;_0x54db32<_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')][_0x1b3a('0x4f')];_0x54db32+=0x1){socket['emit'](_0x1b3a('0xba'),{'UserId':Number(_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')][_0x54db32]),'MailAccountId':Number(_0x343df1['params']['id'])});}}else{socket['emit'](_0x1b3a('0xba'),{'UserId':Number(_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')]),'MailAccountId':Number(_0x343df1[_0x1b3a('0x5c')]['id'])});}});}})[_0x1b3a('0x22')](respondWithStatusCode(_0x7be054,null))['catch'](handleError(_0x7be054,null));};exports[_0x1b3a('0xbb')]=function(_0x51452e,_0x4212fa){var _0x4de335={};var _0xad8378={};var _0x3c7c6d;var _0x1efd66;return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x51452e[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x4212fa,null))[_0x1b3a('0x22')](function(_0x160de6){if(_0x160de6){_0x3c7c6d=_0x160de6;_0xad8378['model']=_[_0x1b3a('0x49')](db[_0x1b3a('0xbc')][_0x1b3a('0x5d')]);_0xad8378[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x51452e['query']);_0xad8378['filters']=_[_0x1b3a('0x4c')](_0xad8378[_0x1b3a('0x48')],_0xad8378[_0x1b3a('0x4a')]);_0x4de335[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0xad8378['model'],qs[_0x1b3a('0x4e')](_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x4de335['attributes']=_0x4de335[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x4de335[_0x1b3a('0x4d')]:_0xad8378[_0x1b3a('0x48')];_0x4de335[_0x1b3a('0x51')]=qs[_0x1b3a('0x6a')](_0x51452e[_0x1b3a('0x4a')]['sort']);_0x4de335[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x51452e[_0x1b3a('0x4a')],_0xad8378[_0x1b3a('0x4b')]));if(_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x4de335['where']=_[_0x1b3a('0x55')](_0x4de335[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x4de335['attributes'],function(_0x5e915d){var _0xcb462e={};_0xcb462e[_0x5e915d]={'$like':'%'+_0x51452e[_0x1b3a('0x4a')]['filter']+'%'};return _0xcb462e;})});}_0x4de335=_[_0x1b3a('0x55')]({},_0x4de335,_0x51452e[_0x1b3a('0x57')]);return _0x3c7c6d[_0x1b3a('0xbb')](_0x4de335);}})['then'](function(_0x44f652){if(_0x44f652){_0x1efd66=_0x44f652[_0x1b3a('0x4f')];if(!_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x4de335[_0x1b3a('0x1e')]=qs['limit'](_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x4de335['offset']=qs[_0x1b3a('0x1b')](_0x51452e[_0x1b3a('0x4a')]['offset']);}return _0x3c7c6d[_0x1b3a('0xbb')](_0x4de335);}})['then'](function(_0x4b47bb){if(_0x4b47bb){return _0x4b47bb?{'count':_0x1efd66,'rows':_0x4b47bb}:null;}})[_0x1b3a('0x22')](respondWithResult(_0x4212fa,null))[_0x1b3a('0x5f')](handleError(_0x4212fa,null));}; \ No newline at end of file +var _0xce50=['UserProfileResource','end','stack','name','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','show','params','rawAttributes','includeAll','catch','update','body','custom','find','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','Disposition','create','keys','nolimit','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','provider','email','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','getImap','findOne','addImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','send','getApplications','getMessages','$gte','split','MailMessage','inlineCss','true','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','isNil','from','format','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','offset','limit','undefined','count','status','Content-Range','json','destroy','MailAccounts'];(function(_0x1cd7ee,_0x2ff605){var _0x1c2ba8=function(_0x1760e7){while(--_0x1760e7){_0x1cd7ee['push'](_0x1cd7ee['shift']());}};_0x1c2ba8(++_0x2ff605);}(_0xce50,0x15f));var _0x0ce5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xce50[_0x17d9e3];return _0x14192d;};'use strict';var moment=require(_0x0ce5('0x0'));var BPromise=require(_0x0ce5('0x1'));var util=require(_0x0ce5('0x2'));var path=require('path');var _=require(_0x0ce5('0x3'));var juice=require(_0x0ce5('0x4'));var Redis=require(_0x0ce5('0x5'));var qs=require(_0x0ce5('0x6'));var logger=require(_0x0ce5('0x7'))(_0x0ce5('0x8'));var config=require('../../config/environment');var db=require(_0x0ce5('0x9'))['db'];config[_0x0ce5('0xa')]=_[_0x0ce5('0xb')](config[_0x0ce5('0xa')],{'host':_0x0ce5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ce5('0xa')]));require(_0x0ce5('0xd'))[_0x0ce5('0xe')](socket);var jayson=require(_0x0ce5('0xf'));var client=jayson['client'][_0x0ce5('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x17e205,_0xc02105,_0x272e2c,_0xf03ae0){return new BPromise(function(_0x33a4a6,_0x8f97da){var _0x5a2fc1=_0xf03ae0||client;return _0x5a2fc1[_0x0ce5('0x11')](_0x17e205,_0x272e2c)[_0x0ce5('0x12')](function(_0x56163a){logger[_0x0ce5('0x13')](_0x0ce5('0x14'),_0xc02105,'request\x20sent');logger[_0x0ce5('0x15')](_0x0ce5('0x16'),_0xc02105,'request\x20sent',JSON[_0x0ce5('0x17')](_0x56163a));if(_0x56163a[_0x0ce5('0x18')]){if(_0x56163a[_0x0ce5('0x18')][_0x0ce5('0x19')]===0x1f4){logger[_0x0ce5('0x18')](_0x0ce5('0x14'),_0xc02105,_0x56163a[_0x0ce5('0x18')][_0x0ce5('0x1a')]);return _0x8f97da(_0x56163a[_0x0ce5('0x18')][_0x0ce5('0x1a')]);}logger[_0x0ce5('0x18')](_0x0ce5('0x14'),_0xc02105,_0x56163a['error']['message']);return _0x33a4a6(_0x56163a[_0x0ce5('0x18')][_0x0ce5('0x1a')]);}else{logger[_0x0ce5('0x13')](_0x0ce5('0x14'),_0xc02105,'request\x20sent');_0x33a4a6(_0x56163a['result'][_0x0ce5('0x1a')]);}})['catch'](function(_0x144643){logger[_0x0ce5('0x18')](_0x0ce5('0x14'),_0xc02105,_0x144643);_0x8f97da(_0x144643);});});}function respondWithStatusCode(_0x3557b7,_0x416113){_0x416113=_0x416113||0xcc;return function(_0x20372a){if(_0x20372a){return _0x3557b7[_0x0ce5('0x1b')](_0x416113);}return _0x3557b7['status'](_0x416113)['end']();};}function respondWithResult(_0x29d258,_0x306d67){_0x306d67=_0x306d67||0xc8;return function(_0x4febfa){if(_0x4febfa){return _0x29d258['status'](_0x306d67)['json'](_0x4febfa);}};}function respondWithFilteredResult(_0x89f426,_0xe2dc4c){return function(_0x311d95){if(_0x311d95){var _0x5ccfbc=typeof _0xe2dc4c[_0x0ce5('0x1c')]==='undefined'&&typeof _0xe2dc4c[_0x0ce5('0x1d')]===_0x0ce5('0x1e');var _0x3d017b=_0x311d95[_0x0ce5('0x1f')];var _0x364932=_0x5ccfbc?0x0:_0xe2dc4c['offset'];var _0x481351=_0x5ccfbc?_0x311d95[_0x0ce5('0x1f')]:_0xe2dc4c[_0x0ce5('0x1c')]+_0xe2dc4c[_0x0ce5('0x1d')];var _0x4019c0;if(_0x481351>=_0x3d017b){_0x481351=_0x3d017b;_0x4019c0=0xc8;}else{_0x4019c0=0xce;}_0x89f426[_0x0ce5('0x20')](_0x4019c0);return _0x89f426['set'](_0x0ce5('0x21'),_0x364932+'-'+_0x481351+'/'+_0x3d017b)[_0x0ce5('0x22')](_0x311d95);}return null;};}function saveUpdates(_0x2797ea){return function(_0x42c85b){if(_0x42c85b){return _0x42c85b['update'](_0x2797ea)[_0x0ce5('0x12')](function(_0x11ef86){return _0x11ef86;});}return null;};}function removeEntity(_0x2fd3b7){return function(_0x2bf157){if(_0x2bf157){return _0x2bf157[_0x0ce5('0x23')]()[_0x0ce5('0x12')](function(){var _0x5d8931=_0x2bf157['get']({'plain':!![]});var _0x5ad9f2=_0x0ce5('0x24');return db[_0x0ce5('0x25')][_0x0ce5('0x23')]({'where':{'type':_0x5ad9f2,'resourceId':_0x5d8931['id']}})[_0x0ce5('0x12')](function(){return _0x2bf157;});})[_0x0ce5('0x12')](function(){_0x2fd3b7[_0x0ce5('0x20')](0xcc)[_0x0ce5('0x26')]();});}};}function handleEntityNotFound(_0x1bca60){return function(_0x9c0f0){if(!_0x9c0f0){_0x1bca60[_0x0ce5('0x1b')](0x194);}return _0x9c0f0;};}function handleError(_0x49ab32,_0x4f1e42){_0x4f1e42=_0x4f1e42||0x1f4;return function(_0x24d92f){logger[_0x0ce5('0x18')](_0x24d92f[_0x0ce5('0x27')]);if(_0x24d92f[_0x0ce5('0x28')]){delete _0x24d92f[_0x0ce5('0x28')];}_0x49ab32[_0x0ce5('0x20')](_0x4f1e42)['send'](_0x24d92f);};}function getImapHost(_0xdc3cfb){switch(_0xdc3cfb){case _0x0ce5('0x29'):return _0x0ce5('0x2a');case _0x0ce5('0x2b'):return'imap.mail.yahoo.com';case _0x0ce5('0x2c'):return _0x0ce5('0x2d');case'outlook365':return _0x0ce5('0x2e');}throw new Error(_0x0ce5('0x2f'),_0xdc3cfb);}function getSmtpHost(_0x190f0a){switch(_0x190f0a){case _0x0ce5('0x29'):return _0x0ce5('0x30');case _0x0ce5('0x2b'):return _0x0ce5('0x31');case _0x0ce5('0x2c'):return'smtp-mail.outlook.com';case _0x0ce5('0x32'):return _0x0ce5('0x33');}throw new Error(_0x0ce5('0x2f'),_0x190f0a);}function getAuthenticationOptions(_0x2aa4da,_0x22fd7a){var _0xf4b90b={};var _0xa129e4={};if(_0x2aa4da){_0xf4b90b['user']=_0xa129e4[_0x0ce5('0x34')]=_0x22fd7a['username'];_0xf4b90b[_0x0ce5('0x35')]=_0xa129e4[_0x0ce5('0x36')]=_0x22fd7a['password'];if(_0x22fd7a[_0x0ce5('0x37')]){_0xf4b90b[_0x0ce5('0x37')]=_0xa129e4[_0x0ce5('0x37')]=!![];_0xf4b90b['CloudProviderId']=_0xa129e4['CloudProviderId']=_0x22fd7a[_0x0ce5('0x38')];_0xf4b90b[_0x0ce5('0x35')]=_0xa129e4[_0x0ce5('0x36')]=null;}else{_0xf4b90b[_0x0ce5('0x38')]=_0xa129e4[_0x0ce5('0x38')]=null;}_0xf4b90b[_0x0ce5('0x39')]=getImapHost(_0x2aa4da);_0xf4b90b[_0x0ce5('0x3a')]=0x3e1;_0xa129e4[_0x0ce5('0x39')]=getSmtpHost(_0x2aa4da);_0xa129e4[_0x0ce5('0x3a')]=0x24b;_0xa129e4[_0x0ce5('0x3b')]=![];_0xf4b90b[_0x0ce5('0x3c')]=_0xa129e4[_0x0ce5('0x3c')]=null;}else{if(_0x22fd7a[_0x0ce5('0x3d')]){_0xf4b90b['user']=_0xa129e4[_0x0ce5('0x34')]=_0x22fd7a[_0x0ce5('0x3e')];_0xf4b90b[_0x0ce5('0x35')]=_0xa129e4[_0x0ce5('0x36')]=_0x22fd7a[_0x0ce5('0x35')];}else{_0xf4b90b[_0x0ce5('0x3d')]=_0xa129e4[_0x0ce5('0x3d')]=![];_0xf4b90b[_0x0ce5('0x34')]=_0xa129e4['user']=null;_0xf4b90b[_0x0ce5('0x35')]=_0xa129e4[_0x0ce5('0x36')]=null;}_0xf4b90b[_0x0ce5('0x39')]=_0x22fd7a[_0x0ce5('0x3f')]['host'];_0xf4b90b[_0x0ce5('0x3a')]=_0x22fd7a[_0x0ce5('0x3f')]['port'];_0xa129e4[_0x0ce5('0x39')]=_0x22fd7a[_0x0ce5('0x40')][_0x0ce5('0x39')];_0xa129e4[_0x0ce5('0x3a')]=_0x22fd7a[_0x0ce5('0x40')][_0x0ce5('0x3a')];}return{'Imap':_0xf4b90b,'Smtp':_0xa129e4};}exports[_0x0ce5('0x41')]=function(_0x2502ed,_0x328340){var _0x247f60={'include':[{'model':db[_0x0ce5('0x42')],'as':_0x0ce5('0x3f')},{'model':db[_0x0ce5('0x43')],'as':_0x0ce5('0x40')},{'model':db[_0x0ce5('0x44')],'as':_0x0ce5('0x45')}]},_0x437d01={},_0x204d59={'count':0x0,'rows':[]};var _0x15adcd=_[_0x0ce5('0x46')](db[_0x0ce5('0x47')]['rawAttributes'],function(_0x2297e7){return{'name':_0x2297e7[_0x0ce5('0x48')],'type':_0x2297e7[_0x0ce5('0x49')][_0x0ce5('0x4a')]};});_0x437d01[_0x0ce5('0x4b')]=_[_0x0ce5('0x46')](_0x15adcd,_0x0ce5('0x28'));_0x437d01[_0x0ce5('0x4c')]=_['keys'](_0x2502ed[_0x0ce5('0x4c')]);_0x437d01['filters']=_[_0x0ce5('0x4d')](_0x437d01[_0x0ce5('0x4b')],_0x437d01[_0x0ce5('0x4c')]);_0x247f60[_0x0ce5('0x4e')]=_[_0x0ce5('0x4d')](_0x437d01[_0x0ce5('0x4b')],qs[_0x0ce5('0x4f')](_0x2502ed[_0x0ce5('0x4c')][_0x0ce5('0x4f')]));_0x247f60['attributes']=_0x247f60[_0x0ce5('0x4e')][_0x0ce5('0x50')]?_0x247f60[_0x0ce5('0x4e')]:_0x437d01[_0x0ce5('0x4b')];if(!_0x2502ed[_0x0ce5('0x4c')][_0x0ce5('0x51')]('nolimit')){_0x247f60[_0x0ce5('0x1d')]=qs[_0x0ce5('0x1d')](_0x2502ed[_0x0ce5('0x4c')][_0x0ce5('0x1d')]);_0x247f60['offset']=qs[_0x0ce5('0x1c')](_0x2502ed[_0x0ce5('0x4c')][_0x0ce5('0x1c')]);}_0x247f60[_0x0ce5('0x52')]=qs[_0x0ce5('0x53')](_0x2502ed['query']['sort']);_0x247f60[_0x0ce5('0x54')]=qs[_0x0ce5('0x55')](_[_0x0ce5('0x56')](_0x2502ed['query'],_0x437d01[_0x0ce5('0x55')]),_0x15adcd);if(_0x2502ed[_0x0ce5('0x4c')][_0x0ce5('0x57')]){_0x247f60[_0x0ce5('0x54')]=_[_0x0ce5('0x58')](_0x247f60[_0x0ce5('0x54')],{'$or':_[_0x0ce5('0x46')](_0x15adcd,function(_0x2c311d){if(_0x2c311d[_0x0ce5('0x49')]!=='VIRTUAL'){var _0x808f13={};_0x808f13[_0x2c311d[_0x0ce5('0x28')]]={'$like':'%'+_0x2502ed[_0x0ce5('0x4c')][_0x0ce5('0x57')]+'%'};return _0x808f13;}})});}_0x247f60=_[_0x0ce5('0x58')]({},_0x247f60,_0x2502ed[_0x0ce5('0x59')]);var _0x85662e={'where':_0x247f60['where']};return db[_0x0ce5('0x47')][_0x0ce5('0x1f')](_0x85662e)[_0x0ce5('0x12')](function(_0x26b264){_0x204d59[_0x0ce5('0x1f')]=_0x26b264;if(_0x2502ed['query']['includeAll']){_0x247f60[_0x0ce5('0x5a')]=[{'all':!![]}];}return db[_0x0ce5('0x47')][_0x0ce5('0x5b')](_0x247f60);})['then'](function(_0xb466e3){_0x204d59['rows']=_0xb466e3;return _0x204d59;})['then'](respondWithFilteredResult(_0x328340,_0x247f60))['catch'](handleError(_0x328340,null));};exports[_0x0ce5('0x5c')]=function(_0x56d618,_0x64c235){var _0x483bb8={'raw':![],'where':{'id':_0x56d618[_0x0ce5('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x0ce5('0x43')],'as':'Smtp'},{'model':db[_0x0ce5('0x44')],'as':_0x0ce5('0x45')}]},_0x46ac69={};_0x46ac69['model']=_['keys'](db[_0x0ce5('0x47')][_0x0ce5('0x5e')]);_0x46ac69['query']=_['keys'](_0x56d618[_0x0ce5('0x4c')]);_0x46ac69[_0x0ce5('0x55')]=_[_0x0ce5('0x4d')](_0x46ac69[_0x0ce5('0x4b')],_0x46ac69[_0x0ce5('0x4c')]);_0x483bb8[_0x0ce5('0x4e')]=_[_0x0ce5('0x4d')](_0x46ac69[_0x0ce5('0x4b')],qs[_0x0ce5('0x4f')](_0x56d618[_0x0ce5('0x4c')][_0x0ce5('0x4f')]));_0x483bb8[_0x0ce5('0x4e')]=_0x483bb8[_0x0ce5('0x4e')][_0x0ce5('0x50')]?_0x483bb8[_0x0ce5('0x4e')]:_0x46ac69[_0x0ce5('0x4b')];if(_0x56d618[_0x0ce5('0x4c')][_0x0ce5('0x5f')]){_0x483bb8[_0x0ce5('0x5a')]=[{'all':!![]}];}_0x483bb8=_[_0x0ce5('0x58')]({},_0x483bb8,_0x56d618['options']);return db[_0x0ce5('0x47')]['find'](_0x483bb8)[_0x0ce5('0x12')](handleEntityNotFound(_0x64c235,null))[_0x0ce5('0x12')](respondWithResult(_0x64c235,null))[_0x0ce5('0x60')](handleError(_0x64c235,null));};exports[_0x0ce5('0x61')]=function(_0x333fc0,_0x11ea12){if(_0x333fc0[_0x0ce5('0x62')]['id']){delete _0x333fc0[_0x0ce5('0x62')]['id'];}var _0xbcb6a5=_0x333fc0[_0x0ce5('0x62')]['provider']===_0x0ce5('0x63')?null:_0x333fc0[_0x0ce5('0x62')]['provider'];var _0x1b6071=_0x333fc0['body'][_0x0ce5('0x3f')]||{};var _0x25b29f=_0x333fc0[_0x0ce5('0x62')][_0x0ce5('0x40')]||{};if(_0xbcb6a5){_0x1b6071[_0x0ce5('0x39')]=getImapHost(_0xbcb6a5);_0x1b6071[_0x0ce5('0x3a')]=0x3e1;_0x25b29f[_0x0ce5('0x39')]=getSmtpHost(_0xbcb6a5);_0x25b29f[_0x0ce5('0x3a')]=0x24b;_0x25b29f['secure']=![];}if(_0x25b29f[_0x0ce5('0x37')]){_0x25b29f[_0x0ce5('0x3b')]=![];}else{_0x25b29f[_0x0ce5('0x38')]=null;}if(!_0x1b6071['modernAuthentication'])_0x1b6071[_0x0ce5('0x38')]=null;_0x333fc0[_0x0ce5('0x62')]['Imap']=_0x1b6071;_0x333fc0['body'][_0x0ce5('0x40')]=_0x25b29f;return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x333fc0['params']['id']},'include':[{'model':db[_0x0ce5('0x42')],'as':'Imap'},{'model':db[_0x0ce5('0x43')],'as':_0x0ce5('0x40')},{'model':db[_0x0ce5('0x44')],'as':_0x0ce5('0x45')}]})[_0x0ce5('0x12')](handleEntityNotFound(_0x11ea12,null))[_0x0ce5('0x12')](function(_0x589b01){if(!_0x589b01)throw new Error(_0x0ce5('0x65'));if(_0x589b01[_0x0ce5('0x3c')])delete _0x333fc0[_0x0ce5('0x62')][_0x0ce5('0x3f')];return _0x589b01;})[_0x0ce5('0x12')](saveUpdates(_0x333fc0[_0x0ce5('0x62')],null))[_0x0ce5('0x12')](function(_0x5d3245){if(!_0x333fc0[_0x0ce5('0x62')]['Imap'])return _0x5d3245;return db[_0x0ce5('0x42')][_0x0ce5('0x61')](_0x333fc0['body'][_0x0ce5('0x3f')],{'where':{'MailAccountId':_0x5d3245['id']}})['then'](function(){return _0x5d3245;});})[_0x0ce5('0x12')](function(_0xb857f1){if(!_0x333fc0[_0x0ce5('0x62')]['Smtp'])return _0xb857f1;return db[_0x0ce5('0x43')]['update'](_0x333fc0['body'][_0x0ce5('0x40')],{'where':{'MailAccountId':_0xb857f1['id']}})[_0x0ce5('0x12')](function(){return _0xb857f1;});})[_0x0ce5('0x12')](respondWithResult(_0x11ea12,null))[_0x0ce5('0x60')](handleError(_0x11ea12,null));};exports['describe']=function(_0x518740,_0x5d1a2d){return db[_0x0ce5('0x47')]['describe']()['then'](respondWithResult(_0x5d1a2d,null))[_0x0ce5('0x60')](handleError(_0x5d1a2d,null));};exports[_0x0ce5('0x66')]=function(_0x4adbd0,_0x310f01){if(_0x4adbd0[_0x0ce5('0x62')]['id']){delete _0x4adbd0[_0x0ce5('0x62')]['id'];}return db['MailAccount'][_0x0ce5('0x64')]({'where':{'id':_0x4adbd0[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x310f01,null))[_0x0ce5('0x12')](function(_0x253f9b){if(_0x253f9b){_0x4adbd0['body'][_0x0ce5('0x67')]=_0x253f9b['id'];return db[_0x0ce5('0x68')][_0x0ce5('0x69')](_0x4adbd0[_0x0ce5('0x62')]);}})['then'](respondWithResult(_0x310f01,null))['catch'](handleError(_0x310f01,null));};exports['getDispositions']=function(_0x135717,_0x1c9429){var _0x12ba66={'raw':![],'where':{}};var _0x944ad8={};var _0x1ed711={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x135717[_0x0ce5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c9429,null))[_0x0ce5('0x12')](function(_0x327b93){if(_0x327b93){_0x944ad8[_0x0ce5('0x4b')]=_[_0x0ce5('0x6a')](db[_0x0ce5('0x68')][_0x0ce5('0x5e')]);_0x944ad8['query']=_['keys'](_0x135717[_0x0ce5('0x4c')]);_0x944ad8['filters']=_[_0x0ce5('0x4d')](_0x944ad8['model'],_0x944ad8[_0x0ce5('0x4c')]);_0x12ba66[_0x0ce5('0x4e')]=_[_0x0ce5('0x4d')](_0x944ad8[_0x0ce5('0x4b')],qs[_0x0ce5('0x4f')](_0x135717[_0x0ce5('0x4c')][_0x0ce5('0x4f')]));_0x12ba66[_0x0ce5('0x4e')]=_0x12ba66[_0x0ce5('0x4e')][_0x0ce5('0x50')]?_0x12ba66[_0x0ce5('0x4e')]:_0x944ad8[_0x0ce5('0x4b')];if(!_0x135717[_0x0ce5('0x4c')][_0x0ce5('0x51')](_0x0ce5('0x6b'))){_0x12ba66[_0x0ce5('0x1d')]=qs[_0x0ce5('0x1d')](_0x135717[_0x0ce5('0x4c')][_0x0ce5('0x1d')]);_0x12ba66['offset']=qs[_0x0ce5('0x1c')](_0x135717['query']['offset']);}_0x12ba66[_0x0ce5('0x52')]=qs['sort'](_0x135717[_0x0ce5('0x4c')][_0x0ce5('0x53')]);_0x12ba66[_0x0ce5('0x54')]=qs[_0x0ce5('0x55')](_[_0x0ce5('0x56')](_0x135717[_0x0ce5('0x4c')],_0x944ad8['filters']));_0x12ba66['where'][_0x0ce5('0x67')]=_0x327b93['id'];if(_0x135717[_0x0ce5('0x4c')]['filter']){_0x12ba66['where']=_[_0x0ce5('0x58')](_0x12ba66['where'],{'$or':_['map'](_0x12ba66[_0x0ce5('0x4e')],function(_0x3f9a9d){var _0x10b038={};_0x10b038[_0x3f9a9d]={'$like':'%'+_0x135717[_0x0ce5('0x4c')]['filter']+'%'};return _0x10b038;})});}_0x12ba66=_['merge']({},_0x12ba66,_0x135717[_0x0ce5('0x59')]);return db[_0x0ce5('0x68')][_0x0ce5('0x1f')]({'where':_0x12ba66[_0x0ce5('0x54')]})[_0x0ce5('0x12')](function(_0x2b0056){_0x1ed711[_0x0ce5('0x1f')]=_0x2b0056;if(_0x135717[_0x0ce5('0x4c')][_0x0ce5('0x5f')]){_0x12ba66[_0x0ce5('0x5a')]=[{'all':!![]}];}return db[_0x0ce5('0x68')][_0x0ce5('0x5b')](_0x12ba66);})[_0x0ce5('0x12')](function(_0x3c4bc2){_0x1ed711[_0x0ce5('0x6c')]=_0x3c4bc2;return _0x1ed711;});}})[_0x0ce5('0x12')](respondWithFilteredResult(_0x1c9429,_0x12ba66))[_0x0ce5('0x60')](handleError(_0x1c9429,null));};exports['removeDispositions']=function(_0x7c3b70,_0x24bb73){return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x7c3b70[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x24bb73,null))['then'](function(_0x2b6fb9){if(_0x2b6fb9){return _0x2b6fb9[_0x0ce5('0x6d')](_0x7c3b70[_0x0ce5('0x4c')]['ids']);}})[_0x0ce5('0x12')](respondWithStatusCode(_0x24bb73,null))[_0x0ce5('0x60')](handleError(_0x24bb73,null));};exports[_0x0ce5('0x6e')]=function(_0x238616,_0x59aa6f){if(_0x238616[_0x0ce5('0x62')]['id']){delete _0x238616[_0x0ce5('0x62')]['id'];}return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x238616[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x59aa6f,null))['then'](function(_0x442b97){if(_0x442b97){_0x238616[_0x0ce5('0x62')]['MailAccountId']=_0x442b97['id'];return db[_0x0ce5('0x6f')]['create'](_0x238616[_0x0ce5('0x62')]);}})[_0x0ce5('0x12')](respondWithResult(_0x59aa6f,null))[_0x0ce5('0x60')](handleError(_0x59aa6f,null));};exports[_0x0ce5('0x70')]=function(_0x48e528,_0x52ffc7){var _0x176e19={'raw':![],'where':{}};var _0x39e93f={};var _0x4ba1f5={'count':0x0,'rows':[]};return db[_0x0ce5('0x47')]['findOne']({'where':{'id':_0x48e528[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x52ffc7,null))[_0x0ce5('0x12')](function(_0x17f035){if(_0x17f035){_0x39e93f[_0x0ce5('0x4b')]=_['keys'](db[_0x0ce5('0x6f')]['rawAttributes']);_0x39e93f[_0x0ce5('0x4c')]=_[_0x0ce5('0x6a')](_0x48e528[_0x0ce5('0x4c')]);_0x39e93f[_0x0ce5('0x55')]=_['intersection'](_0x39e93f[_0x0ce5('0x4b')],_0x39e93f[_0x0ce5('0x4c')]);_0x176e19['attributes']=_['intersection'](_0x39e93f[_0x0ce5('0x4b')],qs[_0x0ce5('0x4f')](_0x48e528[_0x0ce5('0x4c')]['fields']));_0x176e19['attributes']=_0x176e19[_0x0ce5('0x4e')]['length']?_0x176e19['attributes']:_0x39e93f[_0x0ce5('0x4b')];if(!_0x48e528[_0x0ce5('0x4c')][_0x0ce5('0x51')](_0x0ce5('0x6b'))){_0x176e19[_0x0ce5('0x1d')]=qs['limit'](_0x48e528[_0x0ce5('0x4c')][_0x0ce5('0x1d')]);_0x176e19[_0x0ce5('0x1c')]=qs['offset'](_0x48e528['query'][_0x0ce5('0x1c')]);}_0x176e19['order']=qs[_0x0ce5('0x53')](_0x48e528[_0x0ce5('0x4c')]['sort']);_0x176e19[_0x0ce5('0x54')]=qs[_0x0ce5('0x55')](_[_0x0ce5('0x56')](_0x48e528['query'],_0x39e93f[_0x0ce5('0x55')]));_0x176e19[_0x0ce5('0x54')][_0x0ce5('0x67')]=_0x17f035['id'];if(_0x48e528[_0x0ce5('0x4c')][_0x0ce5('0x57')]){_0x176e19[_0x0ce5('0x54')]=_[_0x0ce5('0x58')](_0x176e19[_0x0ce5('0x54')],{'$or':_[_0x0ce5('0x46')](_0x176e19[_0x0ce5('0x4e')],function(_0x532fcd){var _0x4e92f3={};_0x4e92f3[_0x532fcd]={'$like':'%'+_0x48e528['query'][_0x0ce5('0x57')]+'%'};return _0x4e92f3;})});}_0x176e19=_[_0x0ce5('0x58')]({},_0x176e19,_0x48e528[_0x0ce5('0x59')]);return db[_0x0ce5('0x6f')][_0x0ce5('0x1f')]({'where':_0x176e19[_0x0ce5('0x54')]})[_0x0ce5('0x12')](function(_0x5c5d83){_0x4ba1f5[_0x0ce5('0x1f')]=_0x5c5d83;if(_0x48e528['query'][_0x0ce5('0x5f')]){_0x176e19[_0x0ce5('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0ce5('0x5b')](_0x176e19);})[_0x0ce5('0x12')](function(_0x8878b8){_0x4ba1f5[_0x0ce5('0x6c')]=_0x8878b8;return _0x4ba1f5;});}})[_0x0ce5('0x12')](respondWithFilteredResult(_0x52ffc7,_0x176e19))['catch'](handleError(_0x52ffc7,null));};exports[_0x0ce5('0x71')]=function(_0x2112a1,_0x2eafde){return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x2112a1[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x2eafde,null))[_0x0ce5('0x12')](function(_0x22105c){if(_0x22105c){return _0x22105c['removeAnswers'](_0x2112a1[_0x0ce5('0x4c')][_0x0ce5('0x72')]);}})[_0x0ce5('0x12')](respondWithStatusCode(_0x2eafde,null))[_0x0ce5('0x60')](handleError(_0x2eafde,null));};exports[_0x0ce5('0x69')]=function(_0x45b4f1,_0x570760){var _0x293a4e={'name':_0x45b4f1['body'][_0x0ce5('0x28')],'key':_0x45b4f1[_0x0ce5('0x62')][_0x0ce5('0x4a')],'provider':_0x45b4f1[_0x0ce5('0x62')][_0x0ce5('0x73')]===_0x0ce5('0x63')?null:_0x45b4f1[_0x0ce5('0x62')]['provider'],'email':_0x45b4f1[_0x0ce5('0x62')][_0x0ce5('0x74')],'ListId':_0x45b4f1[_0x0ce5('0x62')][_0x0ce5('0x75')],'active':!_['isNil'](_0x45b4f1[_0x0ce5('0x62')][_0x0ce5('0x76')])?_0x45b4f1[_0x0ce5('0x62')][_0x0ce5('0x76')]:!![],'description':_0x45b4f1[_0x0ce5('0x62')][_0x0ce5('0x77')]||null};var _0x16644f=getAuthenticationOptions(_0x293a4e[_0x0ce5('0x73')],_0x45b4f1[_0x0ce5('0x62')]);_0x293a4e[_0x0ce5('0x3f')]=_0x16644f[_0x0ce5('0x3f')];_0x293a4e[_0x0ce5('0x40')]=_0x16644f[_0x0ce5('0x40')];return db['MailAccount'][_0x0ce5('0x69')](_0x293a4e,{'include':[{'model':db[_0x0ce5('0x43')],'as':_0x0ce5('0x40')},{'model':db[_0x0ce5('0x42')],'as':_0x0ce5('0x3f')}]})['then'](function(_0x3f44ae){var _0x5026de=_0x45b4f1[_0x0ce5('0x34')][_0x0ce5('0x78')]({'plain':!![]});if(!_0x5026de)throw new Error(_0x0ce5('0x79'));if(_0x5026de['role']===_0x0ce5('0x34')){var _0x1a3f81=_0x3f44ae[_0x0ce5('0x78')]({'plain':!![]});return db[_0x0ce5('0x7a')]['find']({'where':{'name':_0x0ce5('0x24'),'userProfileId':_0x5026de['userProfileId']},'raw':!![]})[_0x0ce5('0x12')](function(_0x222347){if(_0x222347&&_0x222347[_0x0ce5('0x7b')]===0x0){return db[_0x0ce5('0x25')][_0x0ce5('0x69')]({'name':_0x1a3f81[_0x0ce5('0x28')],'resourceId':_0x1a3f81['id'],'type':_0x222347[_0x0ce5('0x28')],'sectionId':_0x222347['id']},{})[_0x0ce5('0x12')](function(){return _0x3f44ae;});}else{return _0x3f44ae;}})['catch'](function(_0x4cf617){logger[_0x0ce5('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cf617);throw _0x4cf617;});}return _0x3f44ae;})[_0x0ce5('0x12')](respondWithResult(_0x570760,0xc9))[_0x0ce5('0x60')](handleError(_0x570760,null));};exports[_0x0ce5('0x7c')]=function(_0x390db3,_0x86be6b){return db['MailAccount'][_0x0ce5('0x7d')]({'where':{'id':_0x390db3[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x86be6b,null))[_0x0ce5('0x12')](function(_0x1f2ed2){if(_0x1f2ed2){return _0x1f2ed2[_0x0ce5('0x7c')]();}return null;})['then'](respondWithResult(_0x86be6b,null))[_0x0ce5('0x60')](handleError(_0x86be6b,null));};exports[_0x0ce5('0x7e')]=function(_0x5f04eb,_0x2390a0){if(_0x5f04eb[_0x0ce5('0x62')]['id']){delete _0x5f04eb[_0x0ce5('0x62')]['id'];}return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x5f04eb[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x2390a0,null))[_0x0ce5('0x12')](function(_0x29b27a){if(_0x29b27a){_0x5f04eb['body']['MailAccountId']=_0x29b27a['id'];return db['MailServerIn'][_0x0ce5('0x69')](_0x5f04eb[_0x0ce5('0x62')]);}})[_0x0ce5('0x12')](respondWithResult(_0x2390a0,null))['catch'](handleError(_0x2390a0,null));};exports['removeImap']=function(_0x314b60,_0xff1c26){return db['MailAccount']['findOne']({'where':{'id':_0x314b60[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0xff1c26,null))[_0x0ce5('0x12')](function(_0x1403a8){if(_0x1403a8){return _0x1403a8[_0x0ce5('0x7f')](null);}return null;})[_0x0ce5('0x12')](respondWithStatusCode(_0xff1c26,null))['catch'](handleError(_0xff1c26,null));};exports[_0x0ce5('0x80')]=function(_0x24aaf5,_0x197649){return db[_0x0ce5('0x47')][_0x0ce5('0x7d')]({'where':{'id':_0x24aaf5['params']['id']}})['then'](handleEntityNotFound(_0x197649,null))['then'](function(_0x19c8ef){if(_0x19c8ef){return _0x19c8ef['getSmtp']();}return null;})['then'](respondWithResult(_0x197649,null))[_0x0ce5('0x60')](handleError(_0x197649,null));};exports[_0x0ce5('0x81')]=function(_0x3be9ed,_0x39305a){if(_0x3be9ed['body']['id']){delete _0x3be9ed['body']['id'];}return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x3be9ed[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x39305a,null))[_0x0ce5('0x12')](function(_0x48799f){if(_0x48799f){_0x3be9ed[_0x0ce5('0x62')][_0x0ce5('0x67')]=_0x48799f['id'];return db[_0x0ce5('0x43')][_0x0ce5('0x69')](_0x3be9ed[_0x0ce5('0x62')]);}})[_0x0ce5('0x12')](respondWithResult(_0x39305a,null))[_0x0ce5('0x60')](handleError(_0x39305a,null));};exports['removeSmtp']=function(_0x2fc4ce,_0x275290){return db[_0x0ce5('0x47')]['findOne']({'where':{'id':_0x2fc4ce[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x275290,null))['then'](function(_0x46d343){if(_0x46d343){return _0x46d343[_0x0ce5('0x82')](null);}return null;})[_0x0ce5('0x12')](respondWithStatusCode(_0x275290,null))[_0x0ce5('0x60')](handleError(_0x275290,null));};exports[_0x0ce5('0x83')]=function(_0x3a15ad,_0x2d3674){return db[_0x0ce5('0x84')]['find']({'where':{'id':_0x3a15ad[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x2d3674,null))[_0x0ce5('0x12')](function(_0x44e667){if(_0x44e667){return _0x44e667[_0x0ce5('0x83')](_0x3a15ad[_0x0ce5('0x62')][_0x0ce5('0x72')],_[_0x0ce5('0x85')](_0x3a15ad[_0x0ce5('0x62')],[_0x0ce5('0x72'),'id'])||{});}})[_0x0ce5('0x12')](respondWithResult(_0x2d3674,null))[_0x0ce5('0x60')](handleError(_0x2d3674,null));};exports[_0x0ce5('0x86')]=function(_0x476978,_0x51880f){var _0x123321={'raw':![],'where':{}};var _0x288dc2={};var _0x19d2bd={'count':0x0,'rows':[]};return db[_0x0ce5('0x47')][_0x0ce5('0x7d')]({'where':{'id':_0x476978['params']['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x51880f,null))[_0x0ce5('0x12')](function(_0x1b44ce){if(_0x1b44ce){_0x288dc2[_0x0ce5('0x4b')]=_['keys'](db[_0x0ce5('0x84')]['rawAttributes']);_0x288dc2[_0x0ce5('0x4c')]=_[_0x0ce5('0x6a')](_0x476978[_0x0ce5('0x4c')]);_0x288dc2['filters']=_['intersection'](_0x288dc2[_0x0ce5('0x4b')],_0x288dc2['query']);_0x123321['attributes']=_['intersection'](_0x288dc2['model'],qs['fields'](_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x4f')]));_0x123321[_0x0ce5('0x4e')]=_0x123321[_0x0ce5('0x4e')]['length']?_0x123321[_0x0ce5('0x4e')]:_0x288dc2['model'];if(!_0x476978['query'][_0x0ce5('0x51')](_0x0ce5('0x6b'))){_0x123321['limit']=qs[_0x0ce5('0x1d')](_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x1d')]);_0x123321[_0x0ce5('0x1c')]=qs[_0x0ce5('0x1c')](_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x1c')]);}_0x123321[_0x0ce5('0x52')]=qs[_0x0ce5('0x53')](_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x53')]);_0x123321[_0x0ce5('0x54')]=qs[_0x0ce5('0x55')](_[_0x0ce5('0x56')](_0x476978[_0x0ce5('0x4c')],_0x288dc2[_0x0ce5('0x55')]));_0x123321[_0x0ce5('0x54')][_0x0ce5('0x67')]=_0x1b44ce['id'];if(_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x57')]){_0x123321[_0x0ce5('0x54')]=_[_0x0ce5('0x58')](_0x123321[_0x0ce5('0x54')],{'$or':_['map'](_0x123321[_0x0ce5('0x4e')],function(_0x49cb11){var _0x2f8707={};_0x2f8707[_0x49cb11]={'$like':'%'+_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x57')]+'%'};return _0x2f8707;})});}_0x123321=_['merge']({},_0x123321,_0x476978[_0x0ce5('0x59')]);return db[_0x0ce5('0x84')][_0x0ce5('0x1f')]({'where':_0x123321[_0x0ce5('0x54')]})[_0x0ce5('0x12')](function(_0x7edc25){_0x19d2bd[_0x0ce5('0x1f')]=_0x7edc25;if(_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x5f')]){_0x123321[_0x0ce5('0x5a')]=[{'model':db['CmContact'],'as':_0x0ce5('0x87'),'required':![]},{'model':db[_0x0ce5('0x88')],'as':_0x0ce5('0x89'),'attributes':[_0x0ce5('0x28'),_0x0ce5('0x8a'),_0x0ce5('0x8b')],'required':![]},{'model':db[_0x0ce5('0x8c')],'as':_0x0ce5('0x8d'),'attributes':['id',_0x0ce5('0x28'),_0x0ce5('0x8e')],'where':_0x476978[_0x0ce5('0x4c')][_0x0ce5('0x8f')]?{'id':_0x476978['query']['tag']}:undefined,'required':_0x476978['query']['tag']?!![]:![]}];}return db[_0x0ce5('0x84')][_0x0ce5('0x5b')](_0x123321);})[_0x0ce5('0x12')](function(_0xd05f37){_0x19d2bd[_0x0ce5('0x6c')]=_0xd05f37;return _0x19d2bd;});}})[_0x0ce5('0x12')](respondWithFilteredResult(_0x51880f,_0x123321))[_0x0ce5('0x60')](handleError(_0x51880f,null));};exports[_0x0ce5('0x90')]=function addApplications(_0x209779,_0x4c1c2b){var _0x4c8973=_0x209779['params']['id'];var _0x298089=_0x209779[_0x0ce5('0x62')];var _0x4a8182=0xc8;var _0x4b133f=null;return db[_0x0ce5('0x91')][_0x0ce5('0x92')]({'isolationLevel':db[_0x0ce5('0x91')]['Transaction'][_0x0ce5('0x93')][_0x0ce5('0x94')]},function(_0x155e3a){return db['MailAccount']['findOne']({'where':{'id':_0x4c8973},'transaction':_0x155e3a})['then'](function(_0xdf8eaa){if(_0xdf8eaa){return db[_0x0ce5('0x95')][_0x0ce5('0x23')]({'where':{'MailAccountId':_0x4c8973},'transaction':_0x155e3a})['then'](function(){var _0x4d7546=_[_0x0ce5('0x46')](_0x298089,function(_0xe74b19){_0xe74b19['MailAccountId']=_0x4c8973;return _0xe74b19;});return db[_0x0ce5('0x95')]['bulkCreate'](_0x4d7546,{'transaction':_0x155e3a});});}else{_0x4a8182=0x194;_0x4b133f=[];}});})[_0x0ce5('0x12')](function(){if(_0x4a8182!==0x194){return db[_0x0ce5('0x95')][_0x0ce5('0x96')]({'where':{'MailAccountId':_0x4c8973},'order':'priority'})[_0x0ce5('0x12')](function(_0x200335){_0x4b133f=_0x200335;});}})[_0x0ce5('0x60')](function(_0x10510e){_0x4a8182=0x1f4;logger['error'](_0x10510e['stack']);if(_0x10510e[_0x0ce5('0x28')]){delete _0x10510e[_0x0ce5('0x28')];}_0x4b133f=_0x10510e;})[_0x0ce5('0x97')](function(){if(_0x4b133f===null){_0x4c1c2b[_0x0ce5('0x1b')](_0x4a8182);}else{if(_0x4a8182===0x1f4){_0x4c1c2b[_0x0ce5('0x20')](_0x4a8182)[_0x0ce5('0x98')](_0x4b133f);}else{_0x4c1c2b[_0x0ce5('0x20')](_0x4a8182)[_0x0ce5('0x22')](_0x4b133f);}}});};exports['getApplications']=function(_0x72910e,_0x171cf9){var _0x1341f0={};var _0x308d89={};var _0x21297e;var _0x564f0d;return db[_0x0ce5('0x47')][_0x0ce5('0x7d')]({'where':{'id':_0x72910e[_0x0ce5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x171cf9,null))[_0x0ce5('0x12')](function(_0x21230d){if(_0x21230d){_0x21297e=_0x21230d;_0x308d89[_0x0ce5('0x4b')]=_[_0x0ce5('0x6a')](db['MailApplication'][_0x0ce5('0x5e')]);_0x308d89[_0x0ce5('0x4c')]=_[_0x0ce5('0x6a')](_0x72910e[_0x0ce5('0x4c')]);_0x308d89[_0x0ce5('0x55')]=_[_0x0ce5('0x4d')](_0x308d89['model'],_0x308d89['query']);_0x1341f0[_0x0ce5('0x4e')]=_['intersection'](_0x308d89[_0x0ce5('0x4b')],qs['fields'](_0x72910e[_0x0ce5('0x4c')]['fields']));_0x1341f0['attributes']=_0x1341f0['attributes']['length']?_0x1341f0[_0x0ce5('0x4e')]:_0x308d89[_0x0ce5('0x4b')];_0x1341f0[_0x0ce5('0x52')]=qs[_0x0ce5('0x53')](_0x72910e[_0x0ce5('0x4c')][_0x0ce5('0x53')]);_0x1341f0['where']=qs[_0x0ce5('0x55')](_[_0x0ce5('0x56')](_0x72910e[_0x0ce5('0x4c')],_0x308d89[_0x0ce5('0x55')]));if(_0x72910e['query'][_0x0ce5('0x57')]){_0x1341f0['where']=_['merge'](_0x1341f0[_0x0ce5('0x54')],{'$or':_[_0x0ce5('0x46')](_0x1341f0[_0x0ce5('0x4e')],function(_0x1b4e6b){var _0x3e0675={};_0x3e0675[_0x1b4e6b]={'$like':'%'+_0x72910e[_0x0ce5('0x4c')][_0x0ce5('0x57')]+'%'};return _0x3e0675;})});}_0x1341f0=_[_0x0ce5('0x58')]({},_0x1341f0,_0x72910e[_0x0ce5('0x59')]);return _0x21297e[_0x0ce5('0x99')](_0x1341f0);}})[_0x0ce5('0x12')](function(_0x68b4e7){if(_0x68b4e7){_0x564f0d=_0x68b4e7[_0x0ce5('0x50')];if(!_0x72910e[_0x0ce5('0x4c')]['hasOwnProperty'](_0x0ce5('0x6b'))){_0x1341f0[_0x0ce5('0x1d')]=qs[_0x0ce5('0x1d')](_0x72910e[_0x0ce5('0x4c')][_0x0ce5('0x1d')]);_0x1341f0[_0x0ce5('0x1c')]=qs[_0x0ce5('0x1c')](_0x72910e['query'][_0x0ce5('0x1c')]);}return _0x21297e[_0x0ce5('0x99')](_0x1341f0);}})[_0x0ce5('0x12')](function(_0x1d51b3){if(_0x1d51b3){return _0x1d51b3?{'count':_0x564f0d,'rows':_0x1d51b3}:null;}})[_0x0ce5('0x12')](respondWithResult(_0x171cf9,null))[_0x0ce5('0x60')](handleError(_0x171cf9,null));};exports[_0x0ce5('0x9a')]=function(_0x217ed7,_0x4e066d){var _0xd6e583={'raw':!![],'where':{}};var _0x18dcac={};var _0x463c5c={'count':0x0,'rows':[]};return db[_0x0ce5('0x47')]['findOne']({'where':{'id':_0x217ed7[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x4e066d,null))[_0x0ce5('0x12')](function(_0x91622){if(_0x91622){_0x18dcac[_0x0ce5('0x4b')]=_[_0x0ce5('0x6a')](db['MailMessage'][_0x0ce5('0x5e')]);_0x18dcac['query']=_[_0x0ce5('0x6a')](_0x217ed7['query']);_0x18dcac['filters']=_[_0x0ce5('0x4d')](_0x18dcac[_0x0ce5('0x4b')],_0x18dcac[_0x0ce5('0x4c')]);_0xd6e583[_0x0ce5('0x4e')]=_[_0x0ce5('0x4d')](_0x18dcac[_0x0ce5('0x4b')],qs[_0x0ce5('0x4f')](_0x217ed7[_0x0ce5('0x4c')][_0x0ce5('0x4f')]));_0xd6e583[_0x0ce5('0x4e')]=_0xd6e583[_0x0ce5('0x4e')][_0x0ce5('0x50')]?_0xd6e583[_0x0ce5('0x4e')]:_0x18dcac['model'];if(!_0x217ed7[_0x0ce5('0x4c')]['hasOwnProperty'](_0x0ce5('0x6b'))){_0xd6e583[_0x0ce5('0x1d')]=qs[_0x0ce5('0x1d')](_0x217ed7[_0x0ce5('0x4c')][_0x0ce5('0x1d')]);_0xd6e583[_0x0ce5('0x1c')]=qs[_0x0ce5('0x1c')](_0x217ed7[_0x0ce5('0x4c')][_0x0ce5('0x1c')]);}_0xd6e583[_0x0ce5('0x52')]=qs[_0x0ce5('0x53')](_0x217ed7[_0x0ce5('0x4c')][_0x0ce5('0x53')]);_0xd6e583[_0x0ce5('0x54')]=qs[_0x0ce5('0x55')](_[_0x0ce5('0x56')](_0x217ed7[_0x0ce5('0x4c')],_0x18dcac[_0x0ce5('0x55')]));_0xd6e583[_0x0ce5('0x54')][_0x0ce5('0x67')]=_0x91622['id'];if(_0x217ed7['query'][_0x0ce5('0x57')]){_0xd6e583['where']=_[_0x0ce5('0x58')](_0xd6e583[_0x0ce5('0x54')],{'$or':_[_0x0ce5('0x46')](_0xd6e583[_0x0ce5('0x4e')],function(_0x5c467e){var _0x314143={};_0x314143[_0x5c467e]={'$like':'%'+_0x217ed7['query'][_0x0ce5('0x57')]+'%'};return _0x314143;})});}if(_0x217ed7[_0x0ce5('0x4c')][_0x0ce5('0x9b')]){var _0x16a24a=_0x217ed7[_0x0ce5('0x4c')]['$gte'][_0x0ce5('0x9c')](',');var _0x41e531={};_0x41e531[_0x16a24a[0x0]]={'$gte':moment(_0x16a24a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xd6e583[_0x0ce5('0x54')]=_[_0x0ce5('0x58')](_0xd6e583[_0x0ce5('0x54')],_0x41e531);}_0xd6e583=_[_0x0ce5('0x58')]({},_0xd6e583,_0x217ed7[_0x0ce5('0x59')]);return db['MailMessage'][_0x0ce5('0x1f')]({'where':_0xd6e583[_0x0ce5('0x54')]})[_0x0ce5('0x12')](function(_0x5d201f){_0x463c5c[_0x0ce5('0x1f')]=_0x5d201f;if(_0x217ed7[_0x0ce5('0x4c')][_0x0ce5('0x5f')]){_0xd6e583[_0x0ce5('0x5a')]=[{'all':!![]}];}return db[_0x0ce5('0x9d')][_0x0ce5('0x5b')](_0xd6e583);})[_0x0ce5('0x12')](function(_0x15292e){if(_0x217ed7['query'][_0x0ce5('0x9e')]===_0x0ce5('0x9f')){for(var _0xb02cb9=0x0;_0xb02cb9<_0x15292e['length'];_0xb02cb9++){_0x15292e[_0xb02cb9][_0x0ce5('0x62')]=juice(_0x15292e[_0xb02cb9][_0x0ce5('0x62')]);}}_0x463c5c['rows']=_0x15292e;return _0x463c5c;});}})[_0x0ce5('0x12')](respondWithFilteredResult(_0x4e066d,_0xd6e583))[_0x0ce5('0x60')](handleError(_0x4e066d,null));};exports[_0x0ce5('0x98')]=function(_0x3e0ad9,_0x3c86a0){var _0x528243,_0x141f1e={},_0x33f1b4;if(_0x3e0ad9[_0x0ce5('0x62')]['to']){_0x33f1b4=_0x3e0ad9[_0x0ce5('0x62')]['to'][_0x0ce5('0x9c')](',')[0x0];}return db[_0x0ce5('0x47')]['find']({'where':{'id':_0x3e0ad9[_0x0ce5('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x0ce5('0xa0'),'include':[{'model':db[_0x0ce5('0xa1')],'as':_0x0ce5('0xa2'),'where':{'email':_0x33f1b4},'limit':0x1,'order':[[_0x0ce5('0xa3'),_0x0ce5('0xa4')]]}]},{'model':db[_0x0ce5('0x43')],'as':_0x0ce5('0x40'),'raw':!![],'include':[{'model':db[_0x0ce5('0xa5')],'as':_0x0ce5('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3c86a0,null))[_0x0ce5('0x12')](function(_0x443659){if(!_0x443659)return;_0x528243=_0x443659;if(!_0x443659[_0x0ce5('0x40')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x0ce5('0xa6')](_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xa7')])){_0x3e0ad9[_0x0ce5('0x62')]['from']=util[_0x0ce5('0xa8')](_0x0ce5('0xa9'),_0x443659[_0x0ce5('0x28')],_0x443659[_0x0ce5('0x74')]||_0x443659[_0x0ce5('0x40')][_0x0ce5('0x34')]);}if(_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xaa')]&&_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xaa')][_0x0ce5('0x50')]){for(var _0x183389=0x0;_0x183389<_0x3e0ad9[_0x0ce5('0x62')]['attachments'][_0x0ce5('0x50')];_0x183389+=0x1){_0x3e0ad9['body'][_0x0ce5('0xaa')][_0x183389]={'filename':_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xaa')][_0x183389][_0x0ce5('0x28')],'path':path[_0x0ce5('0xab')](config[_0x0ce5('0xac')],'server/files/attachments',_0x3e0ad9['body'][_0x0ce5('0xaa')][_0x183389][_0x0ce5('0xad')])};}}var _0x5f2221=_0x443659[_0x0ce5('0xae')]();return respondWithRpcPromise(_0x0ce5('0xaf'),_0x0ce5('0xb0'),{'account':_0x5f2221,'message':_0x3e0ad9['body']});})[_0x0ce5('0x12')](function(_0x3a4f5){if(!_0x3a4f5)return;_0x141f1e=_0x3a4f5;if(!_0x528243[_0x0ce5('0xa0')])throw new Error('List\x20not\x20found');if(_0x528243[_0x0ce5('0xa0')][_0x0ce5('0xa2')][_0x0ce5('0x50')])return _0x528243[_0x0ce5('0xa0')]['Contacts'][0x0];return db[_0x0ce5('0xa1')][_0x0ce5('0x69')](_[_0x0ce5('0xb')](_0x3e0ad9[_0x0ce5('0x62')],{'firstName':_0x3e0ad9['body']['to'],'email':_0x3e0ad9[_0x0ce5('0x62')]['to'],'phone':_0x3e0ad9[_0x0ce5('0x62')]['to'],'ListId':_0x528243[_0x0ce5('0x75')]}));})[_0x0ce5('0x12')](function(_0x40ba82){if(!_0x40ba82)return;var _0x1b5b78={'UserId':_0x3e0ad9[_0x0ce5('0x34')]['id'],'ContactId':_0x40ba82['id'],'MailAccountId':_0x528243['id'],'inReplyTo':_0x141f1e[_0x0ce5('0xb1')],'to':_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xa7')],'cc':_0x3e0ad9['body']['cc'],'subject':_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xb2')],'attach':_0x3e0ad9['body'][_0x0ce5('0xb3')],'firstMsgDirection':_0x0ce5('0xb4'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x0ce5('0xb4'),'Messages':[_[_0x0ce5('0x58')](_0x3e0ad9[_0x0ce5('0x62')],{'messageId':_0x141f1e[_0x0ce5('0xb1')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x528243['id'],'UserId':_0x3e0ad9[_0x0ce5('0x34')]['id'],'ContactId':_0x40ba82['id']})]};if(_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xb5')]){_0x1b5b78=_[_0x0ce5('0x58')](_0x1b5b78,_0x3e0ad9[_0x0ce5('0x62')][_0x0ce5('0xb5')]);}return db[_0x0ce5('0x84')][_0x0ce5('0x69')](_0x1b5b78,{'include':[{'model':db[_0x0ce5('0x9d')],'as':_0x0ce5('0xb6')}]});})['then'](respondWithResult(_0x3c86a0,null))[_0x0ce5('0x60')](handleError(_0x3c86a0,null));};exports['verifySmtp']=function(_0x36f0cc,_0x86f28e){return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x36f0cc[_0x0ce5('0x5d')]['id']},'include':[{'model':db[_0x0ce5('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0ce5('0xa5')],'as':_0x0ce5('0xa5'),'raw':!![]}]}]})[_0x0ce5('0x12')](handleEntityNotFound(_0x86f28e,null))[_0x0ce5('0x12')](function(_0x302132){if(!_0x302132['Smtp'])return;var _0x3f4102=_0x302132['getSmtpOptions']();return respondWithRpcPromise(_0x0ce5('0xb7'),_0x0ce5('0xb8'),{'account':_0x3f4102});})['then'](respondWithResult(_0x86f28e,null))[_0x0ce5('0x60')](handleError(_0x86f28e,null));};exports[_0x0ce5('0x23')]=function(_0xe80352,_0x1c53b0){return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0xe80352['params']['id']}})['then'](handleEntityNotFound(_0x1c53b0,null))[_0x0ce5('0x12')](function(_0x2201d3){if(_0x2201d3&&_0x2201d3[_0x0ce5('0x3c')]){throw new db[(_0x0ce5('0xb9'))][(_0x0ce5('0xba'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2201d3;})['then'](removeEntity(_0x1c53b0,null))[_0x0ce5('0x60')](handleError(_0x1c53b0,null));};exports[_0x0ce5('0xbb')]=function(_0x406b43,_0x18fab9){return db[_0x0ce5('0x47')][_0x0ce5('0x64')]({'where':{'id':_0x406b43[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x18fab9,null))[_0x0ce5('0x12')](function(_0x1b9e1c){if(_0x1b9e1c){return _0x1b9e1c[_0x0ce5('0xbb')](_0x406b43[_0x0ce5('0x62')]['ids'],_['omit'](_0x406b43[_0x0ce5('0x62')],['ids','id'])||{})['spread'](function(_0x4ef782){for(var _0x2c61f2=0x0;_0x2c61f2<_0x406b43[_0x0ce5('0x62')]['ids']['length'];_0x2c61f2+=0x1){socket[_0x0ce5('0xbc')](_0x0ce5('0xbd'),{'UserId':Number(_0x406b43['body'][_0x0ce5('0x72')][_0x2c61f2]),'MailAccountId':Number(_0x406b43['params']['id'])});}return _0x4ef782;});}})['then'](respondWithResult(_0x18fab9,null))[_0x0ce5('0x60')](handleError(_0x18fab9,null));};exports['removeAgents']=function(_0x17d29f,_0x5e3c2a){return db[_0x0ce5('0x47')]['find']({'where':{'id':_0x17d29f[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x5e3c2a,null))[_0x0ce5('0x12')](function(_0x2cbe66){if(_0x2cbe66){return _0x2cbe66[_0x0ce5('0xbe')](_0x17d29f[_0x0ce5('0x4c')][_0x0ce5('0x72')])[_0x0ce5('0x12')](function(){if(_[_0x0ce5('0xbf')](_0x17d29f[_0x0ce5('0x4c')][_0x0ce5('0x72')])){for(var _0x19b1c4=0x0;_0x19b1c4<_0x17d29f[_0x0ce5('0x4c')][_0x0ce5('0x72')][_0x0ce5('0x50')];_0x19b1c4+=0x1){socket[_0x0ce5('0xbc')](_0x0ce5('0xc0'),{'UserId':Number(_0x17d29f[_0x0ce5('0x4c')]['ids'][_0x19b1c4]),'MailAccountId':Number(_0x17d29f[_0x0ce5('0x5d')]['id'])});}}else{socket[_0x0ce5('0xbc')](_0x0ce5('0xc0'),{'UserId':Number(_0x17d29f[_0x0ce5('0x4c')][_0x0ce5('0x72')]),'MailAccountId':Number(_0x17d29f['params']['id'])});}});}})[_0x0ce5('0x12')](respondWithStatusCode(_0x5e3c2a,null))[_0x0ce5('0x60')](handleError(_0x5e3c2a,null));};exports['getAgents']=function(_0x2a6fcf,_0x3be022){var _0x34f9={};var _0x5d63a3={};var _0x5bd87e;var _0x2cc7a7;return db[_0x0ce5('0x47')][_0x0ce5('0x7d')]({'where':{'id':_0x2a6fcf[_0x0ce5('0x5d')]['id']}})[_0x0ce5('0x12')](handleEntityNotFound(_0x3be022,null))[_0x0ce5('0x12')](function(_0x358926){if(_0x358926){_0x5bd87e=_0x358926;_0x5d63a3[_0x0ce5('0x4b')]=_[_0x0ce5('0x6a')](db[_0x0ce5('0x88')]['rawAttributes']);_0x5d63a3[_0x0ce5('0x4c')]=_['keys'](_0x2a6fcf[_0x0ce5('0x4c')]);_0x5d63a3[_0x0ce5('0x55')]=_[_0x0ce5('0x4d')](_0x5d63a3['model'],_0x5d63a3['query']);_0x34f9['attributes']=_[_0x0ce5('0x4d')](_0x5d63a3['model'],qs['fields'](_0x2a6fcf['query'][_0x0ce5('0x4f')]));_0x34f9['attributes']=_0x34f9[_0x0ce5('0x4e')]['length']?_0x34f9[_0x0ce5('0x4e')]:_0x5d63a3[_0x0ce5('0x4b')];_0x34f9['order']=qs[_0x0ce5('0x53')](_0x2a6fcf[_0x0ce5('0x4c')]['sort']);_0x34f9[_0x0ce5('0x54')]=qs[_0x0ce5('0x55')](_[_0x0ce5('0x56')](_0x2a6fcf['query'],_0x5d63a3[_0x0ce5('0x55')]));if(_0x2a6fcf['query'][_0x0ce5('0x57')]){_0x34f9['where']=_[_0x0ce5('0x58')](_0x34f9[_0x0ce5('0x54')],{'$or':_[_0x0ce5('0x46')](_0x34f9[_0x0ce5('0x4e')],function(_0x2c0dda){var _0x52716b={};_0x52716b[_0x2c0dda]={'$like':'%'+_0x2a6fcf[_0x0ce5('0x4c')][_0x0ce5('0x57')]+'%'};return _0x52716b;})});}_0x34f9=_['merge']({},_0x34f9,_0x2a6fcf[_0x0ce5('0x59')]);return _0x5bd87e[_0x0ce5('0xc1')](_0x34f9);}})[_0x0ce5('0x12')](function(_0x28be36){if(_0x28be36){_0x2cc7a7=_0x28be36['length'];if(!_0x2a6fcf[_0x0ce5('0x4c')][_0x0ce5('0x51')](_0x0ce5('0x6b'))){_0x34f9['limit']=qs[_0x0ce5('0x1d')](_0x2a6fcf[_0x0ce5('0x4c')][_0x0ce5('0x1d')]);_0x34f9['offset']=qs['offset'](_0x2a6fcf[_0x0ce5('0x4c')][_0x0ce5('0x1c')]);}return _0x5bd87e[_0x0ce5('0xc1')](_0x34f9);}})[_0x0ce5('0x12')](function(_0x3814e7){if(_0x3814e7){return _0x3814e7?{'count':_0x2cc7a7,'rows':_0x3814e7}:null;}})['then'](respondWithResult(_0x3be022,null))[_0x0ce5('0x60')](handleError(_0x3be022,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9eed92c..2e9915e 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 _0xf426=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xf426,0x168));var _0x6f42=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xf426[_0x12d033];return _0x3b4e80;};'use strict';var EventEmitter=require(_0x6f42('0x0'));var MailAccount=require(_0x6f42('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6f42('0x2')](0x0);var events={'afterCreate':_0x6f42('0x3'),'afterUpdate':'update','afterDestroy':_0x6f42('0x4')};function emitEvent(_0x2d8784){return function(_0x2e83d8,_0x2d9121,_0x32bd6c){MailAccountEvents[_0x6f42('0x5')](_0x2d8784+':'+_0x2e83d8['id'],_0x2e83d8);MailAccountEvents[_0x6f42('0x5')](_0x2d8784,_0x2e83d8);_0x32bd6c(null);};}for(var e in events){if(events[_0x6f42('0x6')](e)){var event=events[e];MailAccount[_0x6f42('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x43d6=['MailAccount','update','remove','hasOwnProperty','hook','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43d6,0xe9));var _0x643d=function(_0x12cf27,_0x326340){_0x12cf27=_0x12cf27-0x0;var _0x2fee10=_0x43d6[_0x12cf27];return _0x2fee10;};'use strict';var EventEmitter=require(_0x643d('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x643d('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x643d('0x2'),'afterDestroy':_0x643d('0x3')};function emitEvent(_0x21f952){return function(_0x102a8a,_0x5c8b33,_0x1561f0){MailAccountEvents['emit'](_0x21f952+':'+_0x102a8a['id'],_0x102a8a);MailAccountEvents['emit'](_0x21f952,_0x102a8a);_0x1561f0(null);};}for(var e in events){if(events[_0x643d('0x4')](e)){var event=events[e];MailAccount[_0x643d('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3e8bcb9..3ad3c16 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 _0x2814=['OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','port','secure','Smtp','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x2814,0x169));var _0x4281=function(_0x9b497,_0x419469){_0x9b497=_0x9b497-0x0;var _0x18f86f=_0x2814[_0x9b497];return _0x18f86f;};'use strict';var attributes=require(_0x4281('0x0'));module[_0x4281('0x1')]=function(_0x489db0){return _0x489db0[_0x4281('0x2')](_0x4281('0x3'),attributes,{'tableName':_0x4281('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xd2ac2e=this;var _0x234608={'id':_0xd2ac2e['id'],'tls':{'rejectUnauthorized':![]}};if(_0xd2ac2e['provider']!==_0x4281('0x5')){_0x234608['service']=_0xd2ac2e['provider'];}else{_0x234608['host']=_0xd2ac2e['Smtp']['host'];_0x234608[_0x4281('0x6')]=_0xd2ac2e['Smtp'][_0x4281('0x6')];_0x234608[_0x4281('0x7')]=_0xd2ac2e[_0x4281('0x8')]['secure'];}if(_0xd2ac2e[_0x4281('0x8')][_0x4281('0x9')]){if(_0xd2ac2e[_0x4281('0x8')]['modernAuthentication']){if(!_0xd2ac2e[_0x4281('0x8')][_0x4281('0xa')])throw new Error(_0x4281('0xb'));_0x234608[_0x4281('0xc')]={'type':_0x4281('0xd'),'user':_0xd2ac2e['Smtp'][_0x4281('0xe')],'accessToken':_0xd2ac2e[_0x4281('0x8')][_0x4281('0xa')][_0x4281('0xf')]};}else{_0x234608[_0x4281('0xc')]={'user':_0xd2ac2e[_0x4281('0x8')]['user'],'pass':_0xd2ac2e['Smtp'][_0x4281('0x10')]};}}return _0x234608;}}});}; \ No newline at end of file +var _0x6ae2=['MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define'];(function(_0x30ad97,_0x1408a0){var _0x2b1835=function(_0x493ad7){while(--_0x493ad7){_0x30ad97['push'](_0x30ad97['shift']());}};_0x2b1835(++_0x1408a0);}(_0x6ae2,0x66));var _0x26ae=function(_0x1f6d64,_0x64fd3b){_0x1f6d64=_0x1f6d64-0x0;var _0x189039=_0x6ae2[_0x1f6d64];return _0x189039;};'use strict';var attributes=require(_0x26ae('0x0'));module[_0x26ae('0x1')]=function(_0x5e5c97){return _0x5e5c97[_0x26ae('0x2')](_0x26ae('0x3'),attributes,{'tableName':_0x26ae('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2e3ffc=this;var _0x2c0986={'id':_0x2e3ffc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e3ffc[_0x26ae('0x5')]!==_0x26ae('0x6')){_0x2c0986[_0x26ae('0x7')]=_0x2e3ffc['provider'];}else{_0x2c0986[_0x26ae('0x8')]=_0x2e3ffc[_0x26ae('0x9')]['host'];_0x2c0986[_0x26ae('0xa')]=_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0xa')];_0x2c0986[_0x26ae('0xb')]=_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0xb')];}if(_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0xc')]){if(_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0xd')]){if(!_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0xe')])throw new Error(_0x26ae('0xf'));_0x2c0986[_0x26ae('0x10')]={'type':_0x26ae('0x11'),'user':_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0x12')],'accessToken':_0x2e3ffc[_0x26ae('0x9')]['CloudProvider'][_0x26ae('0x13')]};}else{_0x2c0986[_0x26ae('0x10')]={'user':_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0x12')],'pass':_0x2e3ffc[_0x26ae('0x9')][_0x26ae('0x14')]};}}return _0x2c0986;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 6acf61e..a9f4044 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 _0xce50=['subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','applications','list','priority','asc','account','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate'];(function(_0x3b363c,_0x3aef2d){var _0x20095a=function(_0x59b6a5){while(--_0x59b6a5){_0x3b363c['push'](_0x3b363c['shift']());}};_0x20095a(++_0x3aef2d);}(_0xce50,0x1d8));var _0x0ce5=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xce50[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var moment=require(_0x0ce5('0x0'));var BPromise=require(_0x0ce5('0x1'));var rs=require(_0x0ce5('0x2'));var Redis=require(_0x0ce5('0x3'));var db=require(_0x0ce5('0x4'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x0ce5('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ce5('0x6')]({'port':0x232c});config[_0x0ce5('0x7')]=_[_0x0ce5('0x8')](config[_0x0ce5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ce5('0x9'))(new Redis(config[_0x0ce5('0x7')]));require('./mailAccount.socket')[_0x0ce5('0xa')](socket);function respondWithRpcPromise(_0x55639f,_0x4475c9,_0x4ecdce){return new BPromise(function(_0x3ed31c,_0x28ff19){return client['request'](_0x55639f,_0x4ecdce)[_0x0ce5('0xb')](function(_0x2b5559){logger[_0x0ce5('0xc')](_0x0ce5('0xd'),_0x4475c9,_0x0ce5('0xe'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4475c9,'request\x20sent',JSON[_0x0ce5('0xf')](_0x2b5559));if(_0x2b5559[_0x0ce5('0x10')]){if(_0x2b5559[_0x0ce5('0x10')][_0x0ce5('0x11')]===0x1f4){logger['error'](_0x0ce5('0xd'),_0x4475c9,_0x2b5559[_0x0ce5('0x10')]['message']);return _0x28ff19(_0x2b5559[_0x0ce5('0x10')]['message']);}logger[_0x0ce5('0x10')](_0x0ce5('0xd'),_0x4475c9,_0x2b5559[_0x0ce5('0x10')][_0x0ce5('0x12')]);return _0x3ed31c(_0x2b5559[_0x0ce5('0x10')][_0x0ce5('0x12')]);}else{logger[_0x0ce5('0xc')](_0x0ce5('0xd'),_0x4475c9,'request\x20sent');_0x3ed31c(_0x2b5559[_0x0ce5('0x13')][_0x0ce5('0x12')]);}})['catch'](function(_0x4f5e0b){logger[_0x0ce5('0x10')]('MailAccount,\x20%s,\x20%s',_0x4475c9,_0x4f5e0b);_0x28ff19(_0x4f5e0b);});});}exports[_0x0ce5('0x14')]=function(_0x477451){var _0x451b39=this;return new Promise(function(_0x4485e1,_0x41ef17){return db[_0x0ce5('0x15')]['findAll']({'raw':_0x477451[_0x0ce5('0x16')]?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x477451[_0x0ce5('0x16')]?_0x477451['options'][_0x0ce5('0x18')]||null:null,'attributes':_0x477451['options']?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x19')]||null:null,'limit':_0x477451[_0x0ce5('0x16')]?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x1a')]||null:null,'include':_0x477451[_0x0ce5('0x16')]?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x477451[_0x0ce5('0x16')]['include'],function(_0x5392a4){return{'model':db[_0x5392a4[_0x0ce5('0x1d')]],'as':_0x5392a4['as'],'attributes':_0x5392a4['attributes'],'include':_0x5392a4['include']?_[_0x0ce5('0x1c')](_0x5392a4['include'],function(_0x2c7414){return{'model':db[_0x2c7414[_0x0ce5('0x1d')]],'as':_0x2c7414['as'],'attributes':_0x2c7414['attributes'],'include':_0x2c7414['include']?_[_0x0ce5('0x1c')](_0x2c7414[_0x0ce5('0x1b')],function(_0x565295){return{'model':db[_0x565295[_0x0ce5('0x1d')]],'as':_0x565295['as'],'attributes':_0x565295[_0x0ce5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0ce5('0xb')](function(_0x54a385){logger['info'](_0x0ce5('0x14'),_0x477451);logger[_0x0ce5('0x1e')](_0x0ce5('0x14'),_0x477451,JSON[_0x0ce5('0xf')](_0x54a385));_0x4485e1(_0x54a385);})[_0x0ce5('0x1f')](function(_0x44dabc){logger[_0x0ce5('0x10')](_0x0ce5('0x14'),_0x44dabc[_0x0ce5('0x12')],_0x477451);_0x41ef17(_0x451b39[_0x0ce5('0x10')](0x1f4,_0x44dabc[_0x0ce5('0x12')]));});});};exports[_0x0ce5('0x20')]=function(_0x3c7d4d){var _0xfef4a3=this;return new Promise(function(_0x733d8a,_0x143960){return db[_0x0ce5('0x15')][_0x0ce5('0x21')]({'raw':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d[_0x0ce5('0x16')][_0x0ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d['options'][_0x0ce5('0x18')]||null:null,'attributes':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d[_0x0ce5('0x16')]['attributes']||null:null,'include':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d[_0x0ce5('0x16')][_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x3c7d4d['options'][_0x0ce5('0x1b')],function(_0x298f92){return{'model':db[_0x298f92[_0x0ce5('0x1d')]],'as':_0x298f92['as'],'attributes':_0x298f92[_0x0ce5('0x19')],'include':_0x298f92[_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x298f92[_0x0ce5('0x1b')],function(_0x22bc73){return{'model':db[_0x22bc73[_0x0ce5('0x1d')]],'as':_0x22bc73['as'],'attributes':_0x22bc73[_0x0ce5('0x19')],'include':_0x22bc73[_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x22bc73['include'],function(_0x13d73e){return{'model':db[_0x13d73e[_0x0ce5('0x1d')]],'as':_0x13d73e['as'],'attributes':_0x13d73e[_0x0ce5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15cbde){if(_0x3c7d4d[_0x0ce5('0x16')][_0x0ce5('0x22')]===!![])_0x15cbde[_0x0ce5('0x23')]('smtpOptions',_0x15cbde[_0x0ce5('0x24')]());logger['info'](_0x0ce5('0x20'),_0x3c7d4d);logger['debug']('ShowMailAccount',_0x3c7d4d,JSON[_0x0ce5('0xf')](_0x15cbde));_0x733d8a(_0x15cbde);})[_0x0ce5('0x1f')](function(_0x6e5145){logger['error'](_0x0ce5('0x20'),_0x6e5145[_0x0ce5('0x12')],_0x3c7d4d);_0x143960(_0xfef4a3[_0x0ce5('0x10')](0x1f4,_0x6e5145[_0x0ce5('0x12')]));});});};exports['NotifyMailAccount']=function(_0x140bbe){var _0x245414=this;return new Promise(function(_0x238f52,_0xb520a7){var _0x3952c6={'body':_0x140bbe[_0x0ce5('0x25')],'channel':'mail'};var _0x29f290=_[_0x0ce5('0x26')](_[_0x0ce5('0x27')](db[_0x0ce5('0x28')][_0x0ce5('0x29')]),[_0x0ce5('0x2a'),_0x0ce5('0x2b'),_0x0ce5('0x2c'),_0x0ce5('0x2d')]);var _0x48ebfc=![];if(_0x140bbe['body']['id']){delete _0x140bbe[_0x0ce5('0x25')]['id'];}if(_[_0x0ce5('0x2e')](_0x140bbe['body']['from'])){return _0xb520a7(_0x245414[_0x0ce5('0x10')](0x1f4,_0x0ce5('0x2f')));}if(_[_0x0ce5('0x2e')](_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x25')])||_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x25')]===''){return _0xb520a7(_0x245414[_0x0ce5('0x10')](0x1f4,_0x0ce5('0x30')));}if(_[_0x0ce5('0x2e')](_0x140bbe['body']['mapKey'])){return _0xb520a7(_0x245414['error'](0x1f4,_0x0ce5('0x31')+_0x29f290));}if(!_[_0x0ce5('0x32')](_0x29f290,_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x33')])){return _0xb520a7(_0x245414[_0x0ce5('0x10')](0x1f4,_0x0ce5('0x34')+_0x29f290));}var _0x525c20={};_0x525c20[_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x33')]]=_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x35')];return db['MailAccount'][_0x0ce5('0x21')]({'where':{'id':_0x140bbe['account']['id']},'include':[{'model':db['CmList'],'as':_0x0ce5('0x36'),'include':[{'model':db[_0x0ce5('0x28')],'as':_0x0ce5('0x37'),'where':_0x525c20,'limit':0x1,'order':[[_0x0ce5('0x2b'),_0x0ce5('0x38')]]}]},{'model':db[_0x0ce5('0x39')],'as':_0x0ce5('0x3a')},{'model':db[_0x0ce5('0x3b')],'as':_0x0ce5('0x3c'),'include':[{'model':db[_0x0ce5('0x3d')],'as':_0x0ce5('0x3d')}]}]})[_0x0ce5('0xb')](function(_0x5629f4){if(_0x5629f4&&_0x5629f4[_0x0ce5('0x36')]){var _0x57a64a=_0x5629f4[_0x0ce5('0x3e')]({'plain':!![]});_0x3952c6['account']=_['omit'](_0x57a64a,['Applications',_0x0ce5('0x36')]);_0x3952c6['account']['smtpOptions']=_0x5629f4['getSmtpOptions']();_0x3952c6[_0x0ce5('0x3f')]=_0x57a64a[_0x0ce5('0x3a')];_0x3952c6[_0x0ce5('0x40')]=_0x57a64a[_0x0ce5('0x36')];_0x3952c6['applications']=_['orderBy'](_0x3952c6[_0x0ce5('0x3f')],[_0x0ce5('0x41')],[_0x0ce5('0x42')]);if(_0x3952c6[_0x0ce5('0x43')]&&_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x44')]){_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x45')]({'id':0x0,'priority':_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x46')]+0x1,'app':_0x0ce5('0x47'),'appdata':_0x0ce5('0x44'),'interval':_0x0ce5('0x48')});}if(_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x3a')]){delete _0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x3a')];}if(_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x36')]){delete _0x3952c6['account'][_0x0ce5('0x36')];}if(_0x57a64a['List'][_0x0ce5('0x37')][_0x0ce5('0x46')]){return _0x57a64a[_0x0ce5('0x36')][_0x0ce5('0x37')][0x0];}var _0x3010ea=_[_0x0ce5('0x8')](_0x140bbe[_0x0ce5('0x25')],{'firstName':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x35')],'ListId':_0x57a64a[_0x0ce5('0x2d')]});_0x3010ea[_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x33')]]=_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x35')];return db[_0x0ce5('0x28')][_0x0ce5('0x49')](_0x3010ea);}else{throw new Error(_0x0ce5('0x4a'));}})[_0x0ce5('0xb')](function(_0x1f0a7f){_0x3952c6[_0x0ce5('0x4b')]=_0x1f0a7f;if(_0x1f0a7f){if(!_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4c')]){_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4c')]=rs[_0x0ce5('0x4d')]()+'\x20'+_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x35')];}var _0x579300={'ContactId':_0x1f0a7f['id'],'MailAccountId':_0x140bbe[_0x0ce5('0x43')]['id'],'inReplyTo':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4c')],'to':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['from'],'cc':_0x140bbe['body']['message']['cc'],'subject':_0x140bbe['body']['message'][_0x0ce5('0x4e')],'attach':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4f')],'lastMsgAt':moment()[_0x0ce5('0x50')](_0x0ce5('0x51')),'lastMsgDirection':'in'};return db[_0x0ce5('0x52')][_0x0ce5('0x21')]({'where':{'closed':![],'MailAccountId':_0x140bbe[_0x0ce5('0x43')]['id']},'include':[{'model':db[_0x0ce5('0x53')],'as':_0x0ce5('0x54'),'attributes':[_0x0ce5('0x4c')],'where':{'messageId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x55')]}}]})['then'](function(_0x270d22){if(_0x270d22){return[_0x270d22,![]];}return db[_0x0ce5('0x52')][_0x0ce5('0x49')](_0x579300)[_0x0ce5('0xb')](function(_0x2b3349){return[_0x2b3349,!![]];});});}else{throw new Error(_0x0ce5('0x56'));}})[_0x0ce5('0x57')](function(_0x1122ea,_0x199e57){if(_0x1122ea){_0x48ebfc=_0x199e57;if(!_0x199e57){return _0x1122ea[_0x0ce5('0x58')]({'inReplyTo':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x4c')],'to':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x35')],'cc':_0x140bbe[_0x0ce5('0x25')]['message']['cc'],'subject':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4e')],'attach':_0x1122ea[_0x0ce5('0x4f')]?_0x1122ea[_0x0ce5('0x4f')]:_0x140bbe[_0x0ce5('0x25')]['message'][_0x0ce5('0x4f')],'substatus':null,'substatusAt':moment()[_0x0ce5('0x50')](_0x0ce5('0x51')),'lastMsgAt':moment()['format'](_0x0ce5('0x51')),'lastMsgDirection':'in'});}else{return _0x1122ea;}}})[_0x0ce5('0xb')](function(_0x4f9e6c){_0x3952c6[_0x0ce5('0x59')]=_0x4f9e6c[_0x0ce5('0x3e')]({'plain':!![]});_0x3952c6['interaction'][_0x0ce5('0x5a')]=_0x48ebfc;return db[_0x0ce5('0x53')][_0x0ce5('0x49')]({'body':_0x140bbe[_0x0ce5('0x25')]['body'],'MailAccountId':_0x140bbe[_0x0ce5('0x43')]['id'],'MailInteractionId':_0x4f9e6c['id'],'direction':'in','ContactId':_0x3952c6[_0x0ce5('0x4b')]['id'],'messageId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x4c')],'from':_0x140bbe['body']['message'][_0x0ce5('0x35')],'to':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['to'],'cc':_0x140bbe['body'][_0x0ce5('0x12')]['cc'],'subject':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['subject'],'attach':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['attach'],'Attachments':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['attachments'],'originTo':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x5b')],'originCc':_0x140bbe[_0x0ce5('0x25')]['message'][_0x0ce5('0x5c')],'bcc':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x5d')],'ChatWebsiteId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x5e')]||null,'originChannel':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x5f')]||'Email','ChatOfflineMessageId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x60')]||null},{'include':[{'model':db[_0x0ce5('0x61')],'as':'Attachments'}]});})[_0x0ce5('0xb')](function(_0x424884){_0x3952c6[_0x0ce5('0x12')]=_0x424884;if(!_0x3952c6[_0x0ce5('0x59')][_0x0ce5('0x62')]){return;}return db[_0x0ce5('0x63')][_0x0ce5('0x21')]({'attributes':['id',_0x0ce5('0x64')],'where':{'id':_0x3952c6['interaction'][_0x0ce5('0x62')]}});})[_0x0ce5('0xb')](function(_0x37a2ae){if(_0x37a2ae){_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x65')]({'id':0x0,'priority':0x0,'app':_0x0ce5('0x66'),'appdata':_0x37a2ae[_0x0ce5('0x64')]+','+(_0x3952c6['account'][_0x0ce5('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x3952c6['interaction'][_0x0ce5('0x68')]){return;}return db[_0x0ce5('0x69')][_0x0ce5('0x21')]({'attributes':['id','name'],'where':{'id':_0x3952c6[_0x0ce5('0x59')][_0x0ce5('0x68')]}});})[_0x0ce5('0xb')](function(_0xe8a509){if(_0xe8a509){_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x65')]({'id':0x0,'priority':0x1,'app':_0x0ce5('0x6a'),'appdata':_0xe8a509[_0x0ce5('0x64')]+','+(_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x6b')]||0x12c),'interval':_0x0ce5('0x48')});}return respondWithRpcPromise(_0x0ce5('0x6c'),_0x0ce5('0x6d'),_0x3952c6);})[_0x0ce5('0xb')](function(_0x262151){_0x238f52(_0x262151);})['catch'](function(_0x2ac36a){_0xb520a7(_0x245414['error'](0x1f4,_0x2ac36a[_0x0ce5('0x12')]));});});}; \ No newline at end of file +var _0x7c09=['applications','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','Contact\x20not\x20found','spread','update','format','interaction','get','created','MailMessage','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','User','name','UserId','unshift','agent','queueId','Start','startRouting','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailAccount.socket','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailAccount','options','raw','where','attributes','include','map','model','MailAccount','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','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','account','List','Contacts','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','list','priority','asc','autoclose'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7c09,0x102));var _0x97c0=function(_0x2e993e,_0x488d38){_0x2e993e=_0x2e993e-0x0;var _0x337251=_0x7c09[_0x2e993e];return _0x337251;};'use strict';var _=require('lodash');var moment=require(_0x97c0('0x0'));var BPromise=require(_0x97c0('0x1'));var rs=require('randomstring');var Redis=require(_0x97c0('0x2'));var db=require(_0x97c0('0x3'))['db'];var logger=require(_0x97c0('0x4'))(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));var jayson=require(_0x97c0('0x7'));var client=jayson[_0x97c0('0x8')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x97c0('0x9')],{'host':_0x97c0('0xa'),'port':0x18eb});var socket=require(_0x97c0('0xb'))(new Redis(config[_0x97c0('0x9')]));require(_0x97c0('0xc'))['register'](socket);function respondWithRpcPromise(_0x205520,_0x4ac5f1,_0x2d5507){return new BPromise(function(_0x28cac4,_0x52bce2){return client['request'](_0x205520,_0x2d5507)[_0x97c0('0xd')](function(_0x340112){logger[_0x97c0('0xe')](_0x97c0('0xf'),_0x4ac5f1,_0x97c0('0x10'));logger[_0x97c0('0x11')](_0x97c0('0x12'),_0x4ac5f1,_0x97c0('0x10'),JSON[_0x97c0('0x13')](_0x340112));if(_0x340112[_0x97c0('0x14')]){if(_0x340112[_0x97c0('0x14')][_0x97c0('0x15')]===0x1f4){logger[_0x97c0('0x14')]('MailAccount,\x20%s,\x20%s',_0x4ac5f1,_0x340112[_0x97c0('0x14')][_0x97c0('0x16')]);return _0x52bce2(_0x340112[_0x97c0('0x14')]['message']);}logger[_0x97c0('0x14')](_0x97c0('0xf'),_0x4ac5f1,_0x340112[_0x97c0('0x14')][_0x97c0('0x16')]);return _0x28cac4(_0x340112[_0x97c0('0x14')][_0x97c0('0x16')]);}else{logger['info'](_0x97c0('0xf'),_0x4ac5f1,_0x97c0('0x10'));_0x28cac4(_0x340112['result'][_0x97c0('0x16')]);}})[_0x97c0('0x17')](function(_0x179d43){logger[_0x97c0('0x14')](_0x97c0('0xf'),_0x4ac5f1,_0x179d43);_0x52bce2(_0x179d43);});});}exports[_0x97c0('0x18')]=function(_0x4fed42){var _0x1eeaf0=this;return new Promise(function(_0x432705,_0x323863){return db['MailAccount']['findAll']({'raw':_0x4fed42[_0x97c0('0x19')]?_0x4fed42[_0x97c0('0x19')][_0x97c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fed42['options']?_0x4fed42[_0x97c0('0x19')][_0x97c0('0x1b')]||null:null,'attributes':_0x4fed42[_0x97c0('0x19')]?_0x4fed42[_0x97c0('0x19')][_0x97c0('0x1c')]||null:null,'limit':_0x4fed42[_0x97c0('0x19')]?_0x4fed42[_0x97c0('0x19')]['limit']||null:null,'include':_0x4fed42[_0x97c0('0x19')]?_0x4fed42[_0x97c0('0x19')][_0x97c0('0x1d')]?_[_0x97c0('0x1e')](_0x4fed42['options'][_0x97c0('0x1d')],function(_0x14cada){return{'model':db[_0x14cada['model']],'as':_0x14cada['as'],'attributes':_0x14cada[_0x97c0('0x1c')],'include':_0x14cada[_0x97c0('0x1d')]?_[_0x97c0('0x1e')](_0x14cada['include'],function(_0x4f11ba){return{'model':db[_0x4f11ba['model']],'as':_0x4f11ba['as'],'attributes':_0x4f11ba[_0x97c0('0x1c')],'include':_0x4f11ba[_0x97c0('0x1d')]?_[_0x97c0('0x1e')](_0x4f11ba[_0x97c0('0x1d')],function(_0x26939e){return{'model':db[_0x26939e[_0x97c0('0x1f')]],'as':_0x26939e['as'],'attributes':_0x26939e['attributes']};}):[]};}):[]};}):[]:[]})[_0x97c0('0xd')](function(_0x1c183f){logger[_0x97c0('0xe')]('GetMailAccount',_0x4fed42);logger[_0x97c0('0x11')](_0x97c0('0x18'),_0x4fed42,JSON[_0x97c0('0x13')](_0x1c183f));_0x432705(_0x1c183f);})[_0x97c0('0x17')](function(_0x2a7b2b){logger['error']('GetMailAccount',_0x2a7b2b[_0x97c0('0x16')],_0x4fed42);_0x323863(_0x1eeaf0[_0x97c0('0x14')](0x1f4,_0x2a7b2b[_0x97c0('0x16')]));});});};exports['ShowMailAccount']=function(_0xdedd82){var _0x1cebe7=this;return new Promise(function(_0x52bdfe,_0x30147b){return db[_0x97c0('0x20')][_0x97c0('0x21')]({'raw':_0xdedd82[_0x97c0('0x19')]?_0xdedd82[_0x97c0('0x19')][_0x97c0('0x1a')]===undefined?!![]:![]:!![],'where':_0xdedd82[_0x97c0('0x19')]?_0xdedd82[_0x97c0('0x19')][_0x97c0('0x1b')]||null:null,'attributes':_0xdedd82[_0x97c0('0x19')]?_0xdedd82[_0x97c0('0x19')][_0x97c0('0x1c')]||null:null,'include':_0xdedd82[_0x97c0('0x19')]?_0xdedd82[_0x97c0('0x19')][_0x97c0('0x1d')]?_['map'](_0xdedd82[_0x97c0('0x19')][_0x97c0('0x1d')],function(_0x2b7f9a){return{'model':db[_0x2b7f9a[_0x97c0('0x1f')]],'as':_0x2b7f9a['as'],'attributes':_0x2b7f9a[_0x97c0('0x1c')],'include':_0x2b7f9a[_0x97c0('0x1d')]?_[_0x97c0('0x1e')](_0x2b7f9a[_0x97c0('0x1d')],function(_0x582828){return{'model':db[_0x582828[_0x97c0('0x1f')]],'as':_0x582828['as'],'attributes':_0x582828['attributes'],'include':_0x582828[_0x97c0('0x1d')]?_[_0x97c0('0x1e')](_0x582828[_0x97c0('0x1d')],function(_0x3988d3){return{'model':db[_0x3988d3[_0x97c0('0x1f')]],'as':_0x3988d3['as'],'attributes':_0x3988d3[_0x97c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97c0('0xd')](function(_0x225ca4){if(_0xdedd82[_0x97c0('0x19')][_0x97c0('0x22')]===!![])_0x225ca4[_0x97c0('0x23')]('smtpOptions',_0x225ca4[_0x97c0('0x24')]());logger[_0x97c0('0xe')]('ShowMailAccount',_0xdedd82);logger[_0x97c0('0x11')](_0x97c0('0x25'),_0xdedd82,JSON[_0x97c0('0x13')](_0x225ca4));_0x52bdfe(_0x225ca4);})[_0x97c0('0x17')](function(_0x59a9d8){logger[_0x97c0('0x14')]('ShowMailAccount',_0x59a9d8[_0x97c0('0x16')],_0xdedd82);_0x30147b(_0x1cebe7[_0x97c0('0x14')](0x1f4,_0x59a9d8['message']));});});};exports[_0x97c0('0x26')]=function(_0x163ebb){var _0xd728dd=this;return new Promise(function(_0xb13649,_0x33b034){var _0x2121e8={'body':_0x163ebb[_0x97c0('0x27')],'channel':_0x97c0('0x28')};var _0x1fd594=_[_0x97c0('0x29')](_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')]),['createdAt',_0x97c0('0x2d'),_0x97c0('0x2e'),_0x97c0('0x2f')]);var _0x142421=![];if(_0x163ebb[_0x97c0('0x27')]['id']){delete _0x163ebb[_0x97c0('0x27')]['id'];}if(_[_0x97c0('0x30')](_0x163ebb['body']['from'])){return _0x33b034(_0xd728dd[_0x97c0('0x14')](0x1f4,_0x97c0('0x31')));}if(_[_0x97c0('0x30')](_0x163ebb[_0x97c0('0x27')][_0x97c0('0x27')])||_0x163ebb['body']['body']===''){return _0x33b034(_0xd728dd['error'](0x1f4,_0x97c0('0x32')));}if(_['isNil'](_0x163ebb['body'][_0x97c0('0x33')])){return _0x33b034(_0xd728dd[_0x97c0('0x14')](0x1f4,_0x97c0('0x34')+_0x1fd594));}if(!_[_0x97c0('0x35')](_0x1fd594,_0x163ebb[_0x97c0('0x27')]['mapKey'])){return _0x33b034(_0xd728dd[_0x97c0('0x14')](0x1f4,_0x97c0('0x36')+_0x1fd594));}var _0x342eeb={};_0x342eeb[_0x163ebb[_0x97c0('0x27')][_0x97c0('0x33')]]=_0x163ebb[_0x97c0('0x27')][_0x97c0('0x37')];return db[_0x97c0('0x20')][_0x97c0('0x21')]({'where':{'id':_0x163ebb[_0x97c0('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x97c0('0x39'),'include':[{'model':db[_0x97c0('0x2b')],'as':_0x97c0('0x3a'),'where':_0x342eeb,'limit':0x1,'order':[[_0x97c0('0x2d'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x97c0('0x3b')},{'model':db[_0x97c0('0x3c')],'as':_0x97c0('0x3d'),'include':[{'model':db['CloudProvider'],'as':_0x97c0('0x3e')}]}]})[_0x97c0('0xd')](function(_0x240f68){if(_0x240f68&&_0x240f68[_0x97c0('0x39')]){var _0x122524=_0x240f68['get']({'plain':!![]});_0x2121e8[_0x97c0('0x38')]=_[_0x97c0('0x3f')](_0x122524,[_0x97c0('0x3b'),'List']);_0x2121e8['account'][_0x97c0('0x40')]=_0x240f68['getSmtpOptions']();_0x2121e8['applications']=_0x122524[_0x97c0('0x3b')];_0x2121e8[_0x97c0('0x41')]=_0x122524[_0x97c0('0x39')];_0x2121e8['applications']=_['orderBy'](_0x2121e8['applications'],[_0x97c0('0x42')],[_0x97c0('0x43')]);if(_0x2121e8[_0x97c0('0x38')]&&_0x2121e8[_0x97c0('0x38')][_0x97c0('0x44')]){_0x2121e8[_0x97c0('0x45')][_0x97c0('0x46')]({'id':0x0,'priority':_0x2121e8['applications'][_0x97c0('0x47')]+0x1,'app':_0x97c0('0x48'),'appdata':_0x97c0('0x44'),'interval':_0x97c0('0x49')});}if(_0x2121e8[_0x97c0('0x38')][_0x97c0('0x3b')]){delete _0x2121e8['account'][_0x97c0('0x3b')];}if(_0x2121e8[_0x97c0('0x38')]['List']){delete _0x2121e8[_0x97c0('0x38')][_0x97c0('0x39')];}if(_0x122524[_0x97c0('0x39')][_0x97c0('0x3a')][_0x97c0('0x47')]){return _0x122524[_0x97c0('0x39')][_0x97c0('0x3a')][0x0];}var _0x4e2cec=_[_0x97c0('0x4a')](_0x163ebb[_0x97c0('0x27')],{'firstName':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x37')],'ListId':_0x122524[_0x97c0('0x2f')]});_0x4e2cec[_0x163ebb[_0x97c0('0x27')][_0x97c0('0x33')]]=_0x163ebb[_0x97c0('0x27')][_0x97c0('0x37')];return db[_0x97c0('0x2b')][_0x97c0('0x4b')](_0x4e2cec);}else{throw new Error(_0x97c0('0x4c'));}})[_0x97c0('0xd')](function(_0x57766f){_0x2121e8[_0x97c0('0x4d')]=_0x57766f;if(_0x57766f){if(!_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x4e')]){_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')]['messageId']=rs[_0x97c0('0x4f')]()+'\x20'+_0x163ebb[_0x97c0('0x27')]['message'][_0x97c0('0x37')];}var _0x3c9f09={'ContactId':_0x57766f['id'],'MailAccountId':_0x163ebb[_0x97c0('0x38')]['id'],'inReplyTo':_0x163ebb['body'][_0x97c0('0x16')]['messageId'],'to':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x37')],'cc':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')]['cc'],'subject':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x50')],'attach':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x51')],'lastMsgAt':moment()['format'](_0x97c0('0x52')),'lastMsgDirection':'in'};return db[_0x97c0('0x53')][_0x97c0('0x21')]({'where':{'closed':![],'MailAccountId':_0x163ebb[_0x97c0('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':_0x97c0('0x54'),'attributes':[_0x97c0('0x4e')],'where':{'messageId':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')]['inReplyTo']}}]})[_0x97c0('0xd')](function(_0x3c4c27){if(_0x3c4c27){return[_0x3c4c27,![]];}return db[_0x97c0('0x53')]['create'](_0x3c9f09)[_0x97c0('0xd')](function(_0x1f8ea9){return[_0x1f8ea9,!![]];});});}else{throw new Error(_0x97c0('0x55'));}})[_0x97c0('0x56')](function(_0x373c34,_0x1838c9){if(_0x373c34){_0x142421=_0x1838c9;if(!_0x1838c9){return _0x373c34[_0x97c0('0x57')]({'inReplyTo':_0x163ebb['body']['message'][_0x97c0('0x4e')],'to':_0x163ebb[_0x97c0('0x27')]['message'][_0x97c0('0x37')],'cc':_0x163ebb['body']['message']['cc'],'subject':_0x163ebb[_0x97c0('0x27')]['message'][_0x97c0('0x50')],'attach':_0x373c34[_0x97c0('0x51')]?_0x373c34['attach']:_0x163ebb['body']['message'][_0x97c0('0x51')],'substatus':null,'substatusAt':moment()['format'](_0x97c0('0x52')),'lastMsgAt':moment()[_0x97c0('0x58')](_0x97c0('0x52')),'lastMsgDirection':'in'});}else{return _0x373c34;}}})[_0x97c0('0xd')](function(_0x400a8d){_0x2121e8[_0x97c0('0x59')]=_0x400a8d[_0x97c0('0x5a')]({'plain':!![]});_0x2121e8[_0x97c0('0x59')][_0x97c0('0x5b')]=_0x142421;return db[_0x97c0('0x5c')][_0x97c0('0x4b')]({'body':_0x163ebb['body'][_0x97c0('0x27')],'MailAccountId':_0x163ebb[_0x97c0('0x38')]['id'],'MailInteractionId':_0x400a8d['id'],'direction':'in','ContactId':_0x2121e8[_0x97c0('0x4d')]['id'],'messageId':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')]['messageId'],'from':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')]['from'],'to':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')]['to'],'cc':_0x163ebb[_0x97c0('0x27')]['message']['cc'],'subject':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x50')],'attach':_0x163ebb[_0x97c0('0x27')]['message']['attach'],'Attachments':_0x163ebb['body'][_0x97c0('0x16')][_0x97c0('0x5d')],'originTo':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x5e')],'originCc':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x5f')],'bcc':_0x163ebb['body']['message'][_0x97c0('0x60')],'ChatWebsiteId':_0x163ebb['body']['message']['ChatWebsiteId']||null,'originChannel':_0x163ebb[_0x97c0('0x27')][_0x97c0('0x16')][_0x97c0('0x61')]||_0x97c0('0x62'),'ChatOfflineMessageId':_0x163ebb[_0x97c0('0x27')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x97c0('0x63')],'as':_0x97c0('0x64')}]});})[_0x97c0('0xd')](function(_0x3a8ac0){_0x2121e8['message']=_0x3a8ac0;if(!_0x2121e8[_0x97c0('0x59')]['UserId']){return;}return db[_0x97c0('0x65')][_0x97c0('0x21')]({'attributes':['id',_0x97c0('0x66')],'where':{'id':_0x2121e8[_0x97c0('0x59')][_0x97c0('0x67')]}});})[_0x97c0('0xd')](function(_0x2c00c4){if(_0x2c00c4){_0x2121e8[_0x97c0('0x45')][_0x97c0('0x68')]({'id':0x0,'priority':0x0,'app':_0x97c0('0x69'),'appdata':_0x2c00c4['name']+','+(_0x2121e8[_0x97c0('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x2121e8[_0x97c0('0x59')][_0x97c0('0x6a')]){return;}return db['MailQueue'][_0x97c0('0x21')]({'attributes':['id','name'],'where':{'id':_0x2121e8[_0x97c0('0x59')][_0x97c0('0x6a')]}});})['then'](function(_0x2d5b54){if(_0x2d5b54){_0x2121e8['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2d5b54[_0x97c0('0x66')]+','+(_0x2121e8[_0x97c0('0x38')]['waitForTheAssignedQueue']||0x12c),'interval':_0x97c0('0x49')});}return respondWithRpcPromise(_0x97c0('0x6b'),_0x97c0('0x6c'),_0x2121e8);})[_0x97c0('0xd')](function(_0x41b864){_0xb13649(_0x41b864);})[_0x97c0('0x17')](function(_0x10f3cb){_0x33b034(_0xd728dd[_0x97c0('0x14')](0x1f4,_0x10f3cb['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index fef0e8c..878d82b 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 _0x9977=['register','mailAccount:','save','remove','update','removeListener'];(function(_0x5aff33,_0x397804){var _0x49bd0b=function(_0x35bd24){while(--_0x35bd24){_0x5aff33['push'](_0x5aff33['shift']());}};_0x49bd0b(++_0x397804);}(_0x9977,0x9e));var _0x7997=function(_0x11dde4,_0x1d4852){_0x11dde4=_0x11dde4-0x0;var _0x6eea94=_0x9977[_0x11dde4];return _0x6eea94;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x7997('0x0'),_0x7997('0x1'),_0x7997('0x2')];function createListener(_0x545e56,_0x106129){return function(_0x4b74d6){_0x106129['emit'](_0x545e56,_0x4b74d6);};}function removeListener(_0x4a580d,_0x47ead9){return function(){MailAccountEvents[_0x7997('0x3')](_0x4a580d,_0x47ead9);};}exports[_0x7997('0x4')]=function(_0x3665ed){for(var _0x545f89=0x0,_0x8ecc17=events['length'];_0x545f89<_0x8ecc17;_0x545f89++){var _0x32f1b6=events[_0x545f89];var _0x582764=createListener(_0x7997('0x5')+_0x32f1b6,_0x3665ed);MailAccountEvents['on'](_0x32f1b6,_0x582764);}}; \ No newline at end of file +var _0xebd3=['length','mailAccount:','./mailAccount.events','remove','removeListener','register'];(function(_0x109f9d,_0x2de096){var _0x3677a2=function(_0x2d089e){while(--_0x2d089e){_0x109f9d['push'](_0x109f9d['shift']());}};_0x3677a2(++_0x2de096);}(_0xebd3,0x194));var _0x3ebd=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xebd3[_0x52666e];return _0x515330;};'use strict';var MailAccountEvents=require(_0x3ebd('0x0'));var events=['save',_0x3ebd('0x1'),'update'];function createListener(_0xeda736,_0x57a92f){return function(_0x52a132){_0x57a92f['emit'](_0xeda736,_0x52a132);};}function removeListener(_0x5447e4,_0x22b36b){return function(){MailAccountEvents[_0x3ebd('0x2')](_0x5447e4,_0x22b36b);};}exports[_0x3ebd('0x3')]=function(_0x159868){for(var _0x25c2ae=0x0,_0xaf0f66=events[_0x3ebd('0x4')];_0x25c2ae<_0xaf0f66;_0x25c2ae++){var _0x163009=events[_0x25c2ae];var _0x3981ab=createListener(_0x3ebd('0x5')+_0x163009,_0x159868);MailAccountEvents['on'](_0x163009,_0x3981ab);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 26780a7..52fc116 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 _0x39f1=['express','Router','fs-extra','../../components/auth/service','./mailApplication.controller','get','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x10cc81,_0x172700){var _0x3bbe1e=function(_0x319ed2){while(--_0x319ed2){_0x10cc81['push'](_0x10cc81['shift']());}};_0x3bbe1e(++_0x172700);}(_0x39f1,0x193));var _0x139f=function(_0x2c22b5,_0x4e38a2){_0x2c22b5=_0x2c22b5-0x0;var _0x1728eb=_0x39f1[_0x2c22b5];return _0x1728eb;};'use strict';var multer=require(_0x139f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x139f('0x1'));var express=require(_0x139f('0x2'));var router=express[_0x139f('0x3')]();var fs_extra=require(_0x139f('0x4'));var auth=require(_0x139f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x139f('0x6'));router[_0x139f('0x7')]('/:id',auth[_0x139f('0x8')](),controller['show']);router[_0x139f('0x9')](_0x139f('0xa'),auth['isAuthenticated'](),controller[_0x139f('0xb')]);router[_0x139f('0xc')](_0x139f('0xa'),auth[_0x139f('0x8')](),controller[_0x139f('0xd')]);module[_0x139f('0xe')]=router; \ No newline at end of file +var _0x82df=['../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3592af,_0x19d422){var _0x10696e=function(_0x47ac43){while(--_0x47ac43){_0x3592af['push'](_0x3592af['shift']());}};_0x10696e(++_0x19d422);}(_0x82df,0x1b9));var _0xf82d=function(_0x2b3c9d,_0x1c8c0c){_0x2b3c9d=_0x2b3c9d-0x0;var _0x4b8037=_0x82df[_0x2b3c9d];return _0x4b8037;};'use strict';var multer=require(_0xf82d('0x0'));var util=require(_0xf82d('0x1'));var path=require(_0xf82d('0x2'));var timeout=require(_0xf82d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf82d('0x4'));var auth=require(_0xf82d('0x5'));var interaction=require(_0xf82d('0x6'));var config=require(_0xf82d('0x7'));var controller=require('./mailApplication.controller');router[_0xf82d('0x8')](_0xf82d('0x9'),auth[_0xf82d('0xa')](),controller[_0xf82d('0xb')]);router[_0xf82d('0xc')](_0xf82d('0x9'),auth['isAuthenticated'](),controller[_0xf82d('0xd')]);router[_0xf82d('0xe')](_0xf82d('0x9'),auth[_0xf82d('0xa')](),controller[_0xf82d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 57038a1..4dc471a 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 _0x48af=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x23d8cb,_0xb28842){var _0x489878=function(_0x3900ed){while(--_0x3900ed){_0x23d8cb['push'](_0x23d8cb['shift']());}};_0x489878(++_0xb28842);}(_0x48af,0x95));var _0xf48a=function(_0x501932,_0x432837){_0x501932=_0x501932-0x0;var _0x1fe5eb=_0x48af[_0x501932];return _0x1fe5eb;};'use strict';var Sequelize=require(_0xf48a('0x0'));module[_0xf48a('0x1')]={'priority':{'type':Sequelize[_0xf48a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf48a('0x3')],'allowNull':![],'defaultValue':_0xf48a('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf48a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf48a('0x5')}}; \ No newline at end of file +var _0xad4a=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x2e8ea5,_0x1dffa5){var _0x4b8472=function(_0x48cc04){while(--_0x48cc04){_0x2e8ea5['push'](_0x2e8ea5['shift']());}};_0x4b8472(++_0x1dffa5);}(_0xad4a,0x18a));var _0xaad4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad4a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaad4('0x0'));module[_0xaad4('0x1')]={'priority':{'type':Sequelize[_0xaad4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xaad4('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaad4('0x3')],'defaultValue':_0xaad4('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 15a7ab1..38a9e1a 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x1683bb,_0x1526d3){var _0x423bfc=function(_0x148720){while(--_0x148720){_0x1683bb['push'](_0x1683bb['shift']());}};_0x423bfc(++_0x1526d3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x4fee14,_0x390fc1){var _0x255bcf=function(_0x4bef9e){while(--_0x4bef9e){_0x4fee14['push'](_0x4fee14['shift']());}};_0x255bcf(++_0x390fc1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 091e4a0..c267ff3 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 _0x49fd=['api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','MailApplication','mail_applications','util','../../config/logger'];(function(_0x389e4a,_0x1c1845){var _0x10f663=function(_0x5b89fc){while(--_0x5b89fc){_0x389e4a['push'](_0x389e4a['shift']());}};_0x10f663(++_0x1c1845);}(_0x49fd,0x1e2));var _0xd49f=function(_0x4e77d5,_0x29af90){_0x4e77d5=_0x4e77d5-0x0;var _0x5b711e=_0x49fd[_0x4e77d5];return _0x5b711e;};'use strict';var _=require('lodash');var util=require(_0xd49f('0x0'));var logger=require(_0xd49f('0x1'))(_0xd49f('0x2'));var moment=require(_0xd49f('0x3'));var BPromise=require('bluebird');var rp=require(_0xd49f('0x4'));var fs=require('fs');var path=require(_0xd49f('0x5'));var rimraf=require(_0xd49f('0x6'));var config=require(_0xd49f('0x7'));var attributes=require(_0xd49f('0x8'));module['exports']=function(_0x51a0c6,_0x533f37){return _0x51a0c6['define'](_0xd49f('0x9'),attributes,{'tableName':_0xd49f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xec68=['mail_applications','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x15696b,_0x2b7d8b){var _0x4afd55=function(_0x17b238){while(--_0x17b238){_0x15696b['push'](_0x15696b['shift']());}};_0x4afd55(++_0x2b7d8b);}(_0xec68,0x14c));var _0x8ec6=function(_0x1fd3ac,_0x2c1f18){_0x1fd3ac=_0x1fd3ac-0x0;var _0x1c818d=_0xec68[_0x1fd3ac];return _0x1c818d;};'use strict';var _=require(_0x8ec6('0x0'));var util=require(_0x8ec6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8ec6('0x2'));var BPromise=require('bluebird');var rp=require(_0x8ec6('0x3'));var fs=require('fs');var path=require(_0x8ec6('0x4'));var rimraf=require(_0x8ec6('0x5'));var config=require(_0x8ec6('0x6'));var attributes=require('./mailApplication.attributes');module[_0x8ec6('0x7')]=function(_0x222fd6,_0x1c8d85){return _0x222fd6[_0x8ec6('0x8')]('MailApplication',attributes,{'tableName':_0x8ec6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8ec6('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d106fca..bc4281c 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 _0x0132=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','MailApplication','update','body','options','raw','limit','then','UpdateMailApplication','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0132,0xfc));var _0x2013=function(_0x27627f,_0x5ce92f){_0x27627f=_0x27627f-0x0;var _0x3778bb=_0x0132[_0x27627f];return _0x3778bb;};'use strict';var _=require('lodash');var util=require(_0x2013('0x0'));var moment=require(_0x2013('0x1'));var BPromise=require('bluebird');var rs=require(_0x2013('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2013('0x3'))['db'];var utils=require(_0x2013('0x4'));var logger=require(_0x2013('0x5'))('rpc');var config=require(_0x2013('0x6'));var jayson=require(_0x2013('0x7'));var client=jayson['client'][_0x2013('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25c40d,_0x58d147,_0x59a245){return new BPromise(function(_0xc08138,_0x49103b){return client[_0x2013('0x9')](_0x25c40d,_0x59a245)['then'](function(_0x5a1e35){logger[_0x2013('0xa')](_0x2013('0xb'),_0x58d147,'request\x20sent');logger['debug'](_0x2013('0xc'),_0x58d147,'request\x20sent',JSON[_0x2013('0xd')](_0x5a1e35));if(_0x5a1e35[_0x2013('0xe')]){if(_0x5a1e35[_0x2013('0xe')][_0x2013('0xf')]===0x1f4){logger[_0x2013('0xe')](_0x2013('0xb'),_0x58d147,_0x5a1e35['error']['message']);return _0x49103b(_0x5a1e35[_0x2013('0xe')][_0x2013('0x10')]);}logger[_0x2013('0xe')](_0x2013('0xb'),_0x58d147,_0x5a1e35[_0x2013('0xe')][_0x2013('0x10')]);return _0xc08138(_0x5a1e35[_0x2013('0xe')][_0x2013('0x10')]);}else{logger[_0x2013('0xa')](_0x2013('0xb'),_0x58d147,_0x2013('0x11'));_0xc08138(_0x5a1e35[_0x2013('0x12')][_0x2013('0x10')]);}})['catch'](function(_0x2efff6){logger[_0x2013('0xe')]('MailApplication,\x20%s,\x20%s',_0x58d147,_0x2efff6);_0x49103b(_0x2efff6);});});}exports['UpdateMailApplication']=function(_0x49a36b){var _0x3f25b0=this;return new Promise(function(_0x2c3e4e,_0x8a9de0){return db[_0x2013('0x13')][_0x2013('0x14')](_0x49a36b[_0x2013('0x15')],{'raw':_0x49a36b['options']?_0x49a36b[_0x2013('0x16')][_0x2013('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49a36b[_0x2013('0x16')]?_0x49a36b['options']['where']||null:null,'attributes':_0x49a36b[_0x2013('0x16')]?_0x49a36b[_0x2013('0x16')]['attributes']||null:null,'limit':_0x49a36b[_0x2013('0x16')]?_0x49a36b[_0x2013('0x16')][_0x2013('0x18')]||null:null})[_0x2013('0x19')](function(_0x360255){logger[_0x2013('0xa')]('UpdateMailApplication',_0x49a36b);logger['debug'](_0x2013('0x1a'),_0x49a36b,JSON['stringify'](_0x360255));_0x2c3e4e(_0x360255);})[_0x2013('0x1b')](function(_0x29ba11){logger['error'](_0x2013('0x1a'),_0x29ba11['message'],_0x49a36b);_0x8a9de0(_0x3f25b0['error'](0x1f4,_0x29ba11[_0x2013('0x10')]));});});}; \ No newline at end of file +var _0xf88a=['message','result','MailApplication','update','options','where','attributes','UpdateMailApplication','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x77d80,_0x1d7045){var _0x170a64=function(_0x54de52){while(--_0x54de52){_0x77d80['push'](_0x77d80['shift']());}};_0x170a64(++_0x1d7045);}(_0xf88a,0x1ef));var _0xaf88=function(_0x299e1e,_0x20eab5){_0x299e1e=_0x299e1e-0x0;var _0x3757dc=_0xf88a[_0x299e1e];return _0x3757dc;};'use strict';var _=require(_0xaf88('0x0'));var util=require(_0xaf88('0x1'));var moment=require(_0xaf88('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf88('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf88('0x5'));var config=require(_0xaf88('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaf88('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6e13d4,_0x28ac92,_0x466978){return new BPromise(function(_0x5ac214,_0x3fea18){return client[_0xaf88('0x8')](_0x6e13d4,_0x466978)[_0xaf88('0x9')](function(_0x40a0a7){logger[_0xaf88('0xa')](_0xaf88('0xb'),_0x28ac92,_0xaf88('0xc'));logger[_0xaf88('0xd')](_0xaf88('0xe'),_0x28ac92,_0xaf88('0xc'),JSON[_0xaf88('0xf')](_0x40a0a7));if(_0x40a0a7['error']){if(_0x40a0a7[_0xaf88('0x10')][_0xaf88('0x11')]===0x1f4){logger['error'](_0xaf88('0xb'),_0x28ac92,_0x40a0a7['error'][_0xaf88('0x12')]);return _0x3fea18(_0x40a0a7[_0xaf88('0x10')][_0xaf88('0x12')]);}logger[_0xaf88('0x10')](_0xaf88('0xb'),_0x28ac92,_0x40a0a7[_0xaf88('0x10')][_0xaf88('0x12')]);return _0x5ac214(_0x40a0a7[_0xaf88('0x10')][_0xaf88('0x12')]);}else{logger['info'](_0xaf88('0xb'),_0x28ac92,'request\x20sent');_0x5ac214(_0x40a0a7[_0xaf88('0x13')][_0xaf88('0x12')]);}})['catch'](function(_0x2ee72e){logger['error'](_0xaf88('0xb'),_0x28ac92,_0x2ee72e);_0x3fea18(_0x2ee72e);});});}exports['UpdateMailApplication']=function(_0x37c0ad){var _0x1f27b9=this;return new Promise(function(_0x221600,_0x245c0b){return db[_0xaf88('0x14')][_0xaf88('0x15')](_0x37c0ad['body'],{'raw':_0x37c0ad['options']?_0x37c0ad['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c0ad[_0xaf88('0x16')]?_0x37c0ad['options'][_0xaf88('0x17')]||null:null,'attributes':_0x37c0ad[_0xaf88('0x16')]?_0x37c0ad[_0xaf88('0x16')][_0xaf88('0x18')]||null:null,'limit':_0x37c0ad['options']?_0x37c0ad[_0xaf88('0x16')]['limit']||null:null})[_0xaf88('0x9')](function(_0x5cac73){logger[_0xaf88('0xa')](_0xaf88('0x19'),_0x37c0ad);logger[_0xaf88('0xd')](_0xaf88('0x19'),_0x37c0ad,JSON['stringify'](_0x5cac73));_0x221600(_0x5cac73);})[_0xaf88('0x1a')](function(_0x2d75a8){logger[_0xaf88('0x10')]('UpdateMailApplication',_0x2d75a8['message'],_0x37c0ad);_0x245c0b(_0x1f27b9['error'](0x1f4,_0x2d75a8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 2d2731e..973cc03 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 _0x951d=['./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x951d,0xf0));var _0xd951=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0x951d[_0x15ee41];return _0x2b2846;};'use strict';var express=require(_0xd951('0x0'));var router=express[_0xd951('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xd951('0x2'));var controller=require(_0xd951('0x3'));router[_0xd951('0x4')]('/',auth[_0xd951('0x5')](),controller[_0xd951('0x6')]);router[_0xd951('0x4')](_0xd951('0x7'),auth[_0xd951('0x5')](),controller['describe']);router[_0xd951('0x4')](_0xd951('0x8'),auth[_0xd951('0x5')](),controller['show']);router[_0xd951('0x4')](_0xd951('0x9'),auth[_0xd951('0x5')](),controller[_0xd951('0xa')]);router['get'](_0xd951('0xb'),auth['isAuthenticated'](),controller[_0xd951('0xc')]);router[_0xd951('0xd')]('/',auth[_0xd951('0x5')](),controller['create']);router['post'](_0xd951('0x9'),auth[_0xd951('0x5')](),controller[_0xd951('0xe')]);router['post'](_0xd951('0xf'),auth[_0xd951('0x5')](),interaction['tracked'](_0xd951('0x10'),_0xd951('0x11')),controller[_0xd951('0x12')]);router[_0xd951('0x13')](_0xd951('0x8'),auth[_0xd951('0x5')](),interaction[_0xd951('0x14')](_0xd951('0x10'),_0xd951('0x15')),controller[_0xd951('0x16')]);router[_0xd951('0x17')]('/:id',auth[_0xd951('0x5')](),interaction[_0xd951('0x14')]('mail','mailinteraction:destroy'),controller[_0xd951('0x18')]);router[_0xd951('0x17')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd951('0x19')]);module[_0xd951('0x1a')]=router; \ No newline at end of file +var _0xf644=['exports','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','download','post','create','/:id/messages','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','/:id','tracked','mail','update','mailinteraction:destroy','removeTags'];(function(_0x43c97a,_0x4b9bda){var _0x4b81dc=function(_0x15fd92){while(--_0x15fd92){_0x43c97a['push'](_0x43c97a['shift']());}};_0x4b81dc(++_0x4b9bda);}(_0xf644,0x151));var _0x4f64=function(_0x530103,_0x1ee803){_0x530103=_0x530103-0x0;var _0x2be075=_0xf644[_0x530103];return _0x2be075;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4f64('0x0'));var interaction=require(_0x4f64('0x1'));var controller=require(_0x4f64('0x2'));router[_0x4f64('0x3')]('/',auth[_0x4f64('0x4')](),controller['index']);router[_0x4f64('0x3')](_0x4f64('0x5'),auth[_0x4f64('0x4')](),controller[_0x4f64('0x6')]);router[_0x4f64('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x4f64('0x7')]);router[_0x4f64('0x3')]('/:id/messages',auth[_0x4f64('0x4')](),controller['getMessages']);router['get']('/:id/download',auth[_0x4f64('0x4')](),controller[_0x4f64('0x8')]);router[_0x4f64('0x9')]('/',auth[_0x4f64('0x4')](),controller[_0x4f64('0xa')]);router[_0x4f64('0x9')](_0x4f64('0xb'),auth['isAuthenticated'](),controller[_0x4f64('0xc')]);router[_0x4f64('0x9')](_0x4f64('0xd'),auth[_0x4f64('0x4')](),interaction['tracked']('mail',_0x4f64('0xe')),controller[_0x4f64('0xf')]);router[_0x4f64('0x10')](_0x4f64('0x11'),auth['isAuthenticated'](),interaction[_0x4f64('0x12')](_0x4f64('0x13'),'mailinteraction:update'),controller[_0x4f64('0x14')]);router['delete'](_0x4f64('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0x4f64('0x13'),_0x4f64('0x15')),controller['destroy']);router['delete']('/:id/tags',auth[_0x4f64('0x4')](),controller[_0x4f64('0x16')]);module[_0x4f64('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index bcb902b..628e6d8 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 _0x68f7=['out','sequelize','iconv','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0xc6b104,_0x1d805a){var _0x1c6fce=function(_0x1bfb3f){while(--_0x1bfb3f){_0xc6b104['push'](_0xc6b104['shift']());}};_0x1c6fce(++_0x1d805a);}(_0x68f7,0x69));var _0x768f=function(_0x159735,_0x55e04a){_0x159735=_0x159735-0x0;var _0x51f921=_0x68f7[_0x159735];return _0x51f921;};'use strict';var Sequelize=require(_0x768f('0x0'));var iconv=require(_0x768f('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x768f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x768f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x768f('0x3')]},'note':{'type':Sequelize[_0x768f('0x3')]},'inReplyTo':{'type':Sequelize[_0x768f('0x3')](0x1fe)},'to':{'type':Sequelize[_0x768f('0x3')]},'cc':{'type':Sequelize[_0x768f('0x4')](_0x768f('0x5'))},'subject':{'type':Sequelize[_0x768f('0x4')]()},'attach':{'type':Sequelize[_0x768f('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x768f('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x768f('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x768f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x768f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x768f('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x97c5=['long','ENUM','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0x97c5,0x111));var _0x597c=function(_0x33ba49,_0x18ce5c){_0x33ba49=_0x33ba49-0x0;var _0xfb9b66=_0x97c5[_0x33ba49];return _0xfb9b66;};'use strict';var Sequelize=require(_0x597c('0x0'));var iconv=require(_0x597c('0x1'));module[_0x597c('0x2')]={'closed':{'type':Sequelize[_0x597c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x597c('0x4')]},'disposition':{'type':Sequelize[_0x597c('0x5')]},'secondDisposition':{'type':Sequelize[_0x597c('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x597c('0x5')](0x1fe)},'to':{'type':Sequelize[_0x597c('0x5')]},'cc':{'type':Sequelize[_0x597c('0x6')](_0x597c('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x597c('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x597c('0x4')]},'substatus':{'type':Sequelize[_0x597c('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x597c('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x597c('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x597c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x597c('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 203a053..d9bb9a8 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 _0x65f5=['existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','update','then','end','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','user','catch','show','model','query','keys','filters','intersection','attributes','length','includeAll','merge','options','create','body','find','params','destroy','describe','addMessage','MailMessage','ids','getMessages','findOne','fields','nolimit','order','sort','pick','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','setTags','spread','Tag','mailInteractionTags:save','removeTags','download','unix','toString','join','root','tmp','server','files','attachments','push','from','bcc','Messages','get','mkdirSync','each','missing.recipient@your.company.com','subject','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename'];(function(_0x70bed4,_0x3b40e2){var _0x3e358d=function(_0x2dd3e9){while(--_0x2dd3e9){_0x70bed4['push'](_0x70bed4['shift']());}};_0x3e358d(++_0x3b40e2);}(_0x65f5,0xef));var _0x565f=function(_0x3564e5,_0x252379){_0x3564e5=_0x3564e5-0x0;var _0x1df5ad=_0x65f5[_0x3564e5];return _0x1df5ad;};'use strict';var emlformat=require(_0x565f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x565f('0x1'));var moment=require(_0x565f('0x2'));var BPromise=require(_0x565f('0x3'));var util=require('util');var path=require(_0x565f('0x4'));var fs=require('fs');var _=require(_0x565f('0x5'));var juice=require(_0x565f('0x6'));var Redis=require(_0x565f('0x7'));var interaction=require(_0x565f('0x8'));var qs=require(_0x565f('0x9'));var logger=require(_0x565f('0xa'))(_0x565f('0xb'));var config=require(_0x565f('0xc'));var db=require(_0x565f('0xd'))['db'];var htmlEntities=require(_0x565f('0xe'));config['redis']=_[_0x565f('0xf')](config[_0x565f('0x10')],{'host':_0x565f('0x11'),'port':0x18eb});var socket=require(_0x565f('0x12'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2aa21d,_0x49517b){_0x49517b=_0x49517b||0xcc;return function(_0x42cf90){if(_0x42cf90){return _0x2aa21d[_0x565f('0x13')](_0x49517b);}return _0x2aa21d['status'](_0x49517b)['end']();};}function respondWithResult(_0x15eb9c,_0x58c450){_0x58c450=_0x58c450||0xc8;return function(_0x5a0760){if(_0x5a0760){return _0x15eb9c[_0x565f('0x14')](_0x58c450)['json'](_0x5a0760);}};}function respondWithFilteredResult(_0x398cec,_0x3f0ca0){return function(_0x457367){if(_0x457367){var _0x51e272=typeof _0x3f0ca0['offset']===_0x565f('0x15')&&typeof _0x3f0ca0[_0x565f('0x16')]===_0x565f('0x15');var _0x399cef=_0x457367[_0x565f('0x17')];var _0x1fddb0=_0x51e272?0x0:_0x3f0ca0[_0x565f('0x18')];var _0x438430=_0x51e272?_0x457367['count']:_0x3f0ca0['offset']+_0x3f0ca0[_0x565f('0x16')];var _0x104fb1;if(_0x438430>=_0x399cef){_0x438430=_0x399cef;_0x104fb1=0xc8;}else{_0x104fb1=0xce;}_0x398cec[_0x565f('0x14')](_0x104fb1);return _0x398cec[_0x565f('0x19')](_0x565f('0x1a'),_0x1fddb0+'-'+_0x438430+'/'+_0x399cef)[_0x565f('0x1b')](_0x457367);}return null;};}function saveUpdates(_0x3c1998){return function(_0x3919b2){if(_0x3919b2){return _0x3919b2[_0x565f('0x1c')](_0x3c1998)[_0x565f('0x1d')](function(_0xede5ba){return _0xede5ba;});}return null;};}function removeEntity(_0x253325){return function(_0x3d5d5b){if(_0x3d5d5b){return _0x3d5d5b['destroy']()[_0x565f('0x1d')](function(){_0x253325[_0x565f('0x14')](0xcc)[_0x565f('0x1e')]();});}};}function handleEntityNotFound(_0xcd747a){return function(_0x1f1b22){if(!_0x1f1b22){_0xcd747a[_0x565f('0x13')](0x194);}return _0x1f1b22;};}function handleError(_0x19b266,_0x2ba684){_0x2ba684=_0x2ba684||0x1f4;return function(_0x18272d){logger[_0x565f('0x1f')](_0x18272d[_0x565f('0x20')]);if(_0x18272d[_0x565f('0x21')]){delete _0x18272d[_0x565f('0x21')];}_0x19b266['status'](_0x2ba684)['send'](_0x18272d);};}exports[_0x565f('0x22')]=function(_0x404ba1,_0x460dc4){var _0x4fd1cb={};var _0x5878ac=_[_0x565f('0x23')](db[_0x565f('0x24')][_0x565f('0x25')],function(_0x26bb56){return{'name':_0x26bb56[_0x565f('0x26')],'type':_0x26bb56[_0x565f('0x27')][_0x565f('0x28')]};});_0x4fd1cb=qs[_0x565f('0x29')](_0x5878ac,_0x404ba1);return interaction[_0x565f('0x2a')](_0x565f('0x2b'),_0x404ba1['query'],_0x404ba1[_0x565f('0x2c')],_0x4fd1cb,_0x5878ac)[_0x565f('0x1d')](respondWithFilteredResult(_0x460dc4,_0x4fd1cb))[_0x565f('0x2d')](handleError(_0x460dc4,null));};exports[_0x565f('0x2e')]=function(_0x1067f8,_0x3fe8f2){var _0x3aebef={'raw':![],'where':{'id':_0x1067f8['params']['id']}},_0xdb5207={};_0xdb5207[_0x565f('0x2f')]=_['keys'](db['MailInteraction'][_0x565f('0x25')]);_0xdb5207[_0x565f('0x30')]=_[_0x565f('0x31')](_0x1067f8[_0x565f('0x30')]);_0xdb5207[_0x565f('0x32')]=_[_0x565f('0x33')](_0xdb5207['model'],_0xdb5207[_0x565f('0x30')]);_0x3aebef[_0x565f('0x34')]=_[_0x565f('0x33')](_0xdb5207[_0x565f('0x2f')],qs['fields'](_0x1067f8['query']['fields']));_0x3aebef[_0x565f('0x34')]=_0x3aebef[_0x565f('0x34')][_0x565f('0x35')]?_0x3aebef['attributes']:_0xdb5207['model'];if(_0x1067f8[_0x565f('0x30')][_0x565f('0x36')]){_0x3aebef['include']=[{'all':!![]}];}_0x3aebef=_[_0x565f('0x37')]({},_0x3aebef,_0x1067f8[_0x565f('0x38')]);return db[_0x565f('0x24')]['find'](_0x3aebef)[_0x565f('0x1d')](handleEntityNotFound(_0x3fe8f2,null))[_0x565f('0x1d')](respondWithResult(_0x3fe8f2,null))[_0x565f('0x2d')](handleError(_0x3fe8f2,null));};exports['create']=function(_0x21853f,_0x169844){return db[_0x565f('0x24')][_0x565f('0x39')](_0x21853f[_0x565f('0x3a')],{})[_0x565f('0x1d')](respondWithResult(_0x169844,0xc9))['catch'](handleError(_0x169844,null));};exports[_0x565f('0x1c')]=function(_0x298bdc,_0x8582b9){if(_0x298bdc[_0x565f('0x3a')]['id']){delete _0x298bdc[_0x565f('0x3a')]['id'];}return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x298bdc[_0x565f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x8582b9,null))[_0x565f('0x1d')](saveUpdates(_0x298bdc[_0x565f('0x3a')],null))[_0x565f('0x1d')](respondWithResult(_0x8582b9,null))[_0x565f('0x2d')](handleError(_0x8582b9,null));};exports[_0x565f('0x3d')]=function(_0x42a6c7,_0x35b875){return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x42a6c7['params']['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x35b875,null))[_0x565f('0x1d')](removeEntity(_0x35b875,null))['catch'](handleError(_0x35b875,null));};exports['describe']=function(_0x3b3bc3,_0x573edc){return db['MailInteraction'][_0x565f('0x3e')]()[_0x565f('0x1d')](respondWithResult(_0x573edc,null))[_0x565f('0x2d')](handleError(_0x573edc,null));};exports[_0x565f('0x3f')]=function(_0x3c6168,_0x131002){return db[_0x565f('0x40')][_0x565f('0x3b')]({'where':{'id':_0x3c6168[_0x565f('0x3c')]['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x131002,null))[_0x565f('0x1d')](function(_0x5ce8df){if(_0x5ce8df){return _0x5ce8df[_0x565f('0x3f')](_0x3c6168[_0x565f('0x3a')]['ids'],_['omit'](_0x3c6168[_0x565f('0x3a')],[_0x565f('0x41'),'id'])||{});}})[_0x565f('0x1d')](respondWithResult(_0x131002,null))['catch'](handleError(_0x131002,null));};exports[_0x565f('0x42')]=function(_0x2d23bb,_0x4eb8d9){var _0x525d19={'raw':![],'where':{}};var _0x315d72={};var _0x5c697e={'count':0x0,'rows':[]};return db['MailInteraction'][_0x565f('0x43')]({'where':{'id':_0x2d23bb['params']['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x4eb8d9,null))[_0x565f('0x1d')](function(_0xcef2fd){if(_0xcef2fd){_0x315d72['model']=_[_0x565f('0x31')](db[_0x565f('0x40')][_0x565f('0x25')]);_0x315d72[_0x565f('0x30')]=_[_0x565f('0x31')](_0x2d23bb[_0x565f('0x30')]);_0x315d72[_0x565f('0x32')]=_[_0x565f('0x33')](_0x315d72['model'],_0x315d72[_0x565f('0x30')]);_0x525d19['attributes']=_[_0x565f('0x33')](_0x315d72['model'],qs[_0x565f('0x44')](_0x2d23bb[_0x565f('0x30')][_0x565f('0x44')]));_0x525d19[_0x565f('0x34')]=_0x525d19[_0x565f('0x34')][_0x565f('0x35')]?_0x525d19[_0x565f('0x34')]:_0x315d72['model'];if(!_0x2d23bb[_0x565f('0x30')]['hasOwnProperty'](_0x565f('0x45'))){_0x525d19['limit']=qs[_0x565f('0x16')](_0x2d23bb[_0x565f('0x30')]['limit']);_0x525d19['offset']=qs[_0x565f('0x18')](_0x2d23bb[_0x565f('0x30')]['offset']);}_0x525d19[_0x565f('0x46')]=qs[_0x565f('0x47')](_0x2d23bb[_0x565f('0x30')][_0x565f('0x47')]);_0x525d19['where']=qs[_0x565f('0x32')](_[_0x565f('0x48')](_0x2d23bb['query'],_0x315d72['filters']));_0x525d19[_0x565f('0x49')][_0x565f('0x4a')]=_0xcef2fd['id'];if(_0x2d23bb['query'][_0x565f('0x4b')]){_0x525d19['where']=_[_0x565f('0x37')](_0x525d19[_0x565f('0x49')],{'$or':_[_0x565f('0x23')](_0x525d19[_0x565f('0x34')],function(_0x158cc9){var _0x2de39a={};_0x2de39a[_0x158cc9]={'$like':'%'+_0x2d23bb[_0x565f('0x30')][_0x565f('0x4b')]+'%'};return _0x2de39a;})});}if(_0x2d23bb['query']['$gte']){var _0x37f9e8=_0x2d23bb[_0x565f('0x30')][_0x565f('0x4c')][_0x565f('0x4d')](',');var _0x527558={};_0x527558[_0x37f9e8[0x0]]={'$gte':moment(_0x37f9e8[0x1])[_0x565f('0x4e')](_0x565f('0x4f'))};_0x525d19[_0x565f('0x49')]=_[_0x565f('0x37')](_0x525d19[_0x565f('0x49')],_0x527558);}_0x525d19=_[_0x565f('0x37')]({},_0x525d19,_0x2d23bb[_0x565f('0x38')]);return db['MailMessage']['count']({'where':_0x525d19[_0x565f('0x49')]})[_0x565f('0x1d')](function(_0x251bea){_0x5c697e[_0x565f('0x17')]=_0x251bea;if(_0x2d23bb[_0x565f('0x30')][_0x565f('0x36')]){_0x525d19['include']=[{'all':!![]}];}return db['MailMessage'][_0x565f('0x2a')](_0x525d19);})[_0x565f('0x1d')](function(_0x5416d3){if(_0x2d23bb[_0x565f('0x30')][_0x565f('0x50')]==='true'){for(var _0x405c79=0x0;_0x405c79<_0x5416d3[_0x565f('0x35')];_0x405c79++){_0x5416d3[_0x405c79][_0x565f('0x3a')]=juice(_0x5416d3[_0x405c79][_0x565f('0x3a')]);}}_0x5c697e[_0x565f('0x51')]=_0x5416d3;return _0x5c697e;});}})['then'](respondWithFilteredResult(_0x4eb8d9,_0x525d19))[_0x565f('0x2d')](handleError(_0x4eb8d9,null));};exports[_0x565f('0x52')]=function(_0x172ecc,_0x28414f){return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x172ecc[_0x565f('0x3c')]['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x28414f,null))[_0x565f('0x1d')](function(_0xe5d039){if(_0xe5d039){return _0xe5d039[_0x565f('0x53')](_0x172ecc[_0x565f('0x3a')][_0x565f('0x41')],_['omit'](_0x172ecc[_0x565f('0x3a')],[_0x565f('0x41'),'id'])||{})[_0x565f('0x54')](function(){return db[_0x565f('0x55')]['findAll']({'attributes':['id',_0x565f('0x21'),'color'],'where':{'id':_0x172ecc['body'][_0x565f('0x41')]}});})[_0x565f('0x1d')](function(_0x2de554){socket['emit'](_0x565f('0x56'),{'id':Number(_0x172ecc[_0x565f('0x3c')]['id']),'tags':_0x2de554||[]});return{'id':Number(_0x172ecc[_0x565f('0x3c')]['id']),'tags':_0x2de554||[]};});}})[_0x565f('0x1d')](respondWithResult(_0x28414f,null))[_0x565f('0x2d')](handleError(_0x28414f,null));};exports[_0x565f('0x57')]=function(_0x1c5b42,_0x2276d5){return db[_0x565f('0x24')]['find']({'where':{'id':_0x1c5b42[_0x565f('0x3c')]['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x2276d5,null))[_0x565f('0x1d')](function(_0x2bd143){if(_0x2bd143){return _0x2bd143[_0x565f('0x57')](_0x1c5b42['query']['ids']);}})[_0x565f('0x1d')](respondWithStatusCode(_0x2276d5,null))[_0x565f('0x2d')](handleError(_0x2276d5,null));};exports[_0x565f('0x58')]=function(_0x56f7bc,_0x24d8e6){var _0x44df6a=moment()[_0x565f('0x59')]()[_0x565f('0x5a')]();var _0x595e2e=path[_0x565f('0x5b')](config[_0x565f('0x5c')],'server','files',_0x565f('0x5d'));var _0x2a4b9b=path[_0x565f('0x5b')](config[_0x565f('0x5c')],_0x565f('0x5e'),_0x565f('0x5f'),_0x565f('0x60'));var _0x308246=path['join'](_0x595e2e,_0x44df6a);var _0x51d943=util['format']('transcript-%d-%s.zip',_0x56f7bc[_0x565f('0x3c')]['id'],_0x44df6a);var _0x119e06=path[_0x565f('0x5b')](_0x595e2e,_0x51d943);var _0x30e222=[];if(_0x56f7bc[_0x565f('0x30')][_0x565f('0x60')]){_0x30e222[_0x565f('0x61')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x2a0434=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x565f('0x3a'),_0x565f('0x62'),'to','cc',_0x565f('0x63'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x565f('0x47')]('id'),'include':_0x30e222}];return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x56f7bc[_0x565f('0x3c')]['id']},'include':_0x2a0434})[_0x565f('0x1d')](handleEntityNotFound(_0x24d8e6,null))[_0x565f('0x1d')](function(_0x1d8047){if(_0x1d8047&&_0x1d8047[_0x565f('0x64')]){var _0x928c8e=_0x1d8047[_0x565f('0x65')]({'plain':!![]});fs[_0x565f('0x66')](_0x308246);return BPromise[_0x565f('0x67')](_0x928c8e['Messages'],function(_0x2ad5ce,_0x252e05){var _0x4676e8={'from':_0x2ad5ce[_0x565f('0x62')],'to':_0x2ad5ce['to']||_0x565f('0x68'),'subject':_0x2ad5ce[_0x565f('0x69')],'html':htmlEntities[_0x565f('0x6a')](_0x2ad5ce[_0x565f('0x3a')]),'headers':{'Date':moment(_0x2ad5ce[_0x565f('0x6b')])['format'](_0x565f('0x6c'))},'attachments':[]};if(_0x2ad5ce['cc']){_0x4676e8[_0x565f('0x6d')]['Cc']=_0x2ad5ce['cc'];}if(_0x2ad5ce[_0x565f('0x63')]){_0x4676e8[_0x565f('0x6d')]['Bcc']=_0x2ad5ce[_0x565f('0x63')];}return new BPromise(function(_0xf0b835,_0x333599){if(_0x2ad5ce[_0x565f('0x6e')]){for(var _0xf254bd=0x0;_0xf254bd<_0x2ad5ce[_0x565f('0x6e')][_0x565f('0x35')];_0xf254bd++){var _0x25ad4f=_0x2ad5ce[_0x565f('0x6e')][_0xf254bd];var _0x515dfd=path[_0x565f('0x5b')](_0x2a4b9b,_0x25ad4f[_0x565f('0x6f')]);if(fs[_0x565f('0x70')](_0x515dfd)){_0x4676e8[_0x565f('0x60')]['push']({'name':_0x25ad4f[_0x565f('0x21')],'contentType':_0x25ad4f[_0x565f('0x27')],'data':fs[_0x565f('0x71')](_0x515dfd)});}}}emlformat['build'](_0x4676e8,function(_0x2c71ca,_0x559db1){if(_0x2c71ca)return _0x333599(_0x2c71ca);fs[_0x565f('0x72')](path['join'](_0x308246,util[_0x565f('0x4e')](_0x565f('0x73'),_0x252e05)),_0x559db1);return _0xf0b835(_0x559db1);});});})[_0x565f('0x1d')](function(){return new BPromise(function(_0x1eae40,_0x3c4e40){zipdir(_0x308246,{'saveTo':_0x119e06},function(_0x2c906e,_0x5b51ff){if(_0x2c906e)return _0x3c4e40(_0x2c906e);return _0x1eae40(_0x5b51ff);});})[_0x565f('0x1d')](function(){return new BPromise(function(_0x5dffa2,_0x4738fe){rimraf(_0x308246,function(_0x1e60f2){if(_0x1e60f2)_0x4738fe(_0x1e60f2);return _0x5dffa2();});});})['then'](function(){return _0x24d8e6[_0x565f('0x58')](_0x119e06,_0x51d943,function(_0x28e23e){if(!_0x28e23e)fs[_0x565f('0x74')](_0x119e06);});});});}else{return _0x24d8e6['sendStatus'](0xc8);}})[_0x565f('0x2d')](handleError(_0x24d8e6,null));}; \ No newline at end of file +var _0x91dc=['sort','where','MailInteractionId','filter','$gte','split','format','inlineCss','true','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','missing.recipient@your.company.com','decode','createdAt','headers','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','lodash','juice','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','undefined','count','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','catch','show','params','model','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','omit','ids','findOne','MailMessage','keys','hasOwnProperty','nolimit','order'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x91dc,0x9f));var _0xc91d=function(_0x74a1af,_0x5b73b3){_0x74a1af=_0x74a1af-0x0;var _0x2830ef=_0x91dc[_0x74a1af];return _0x2830ef;};'use strict';var emlformat=require(_0xc91d('0x0'));var rimraf=require(_0xc91d('0x1'));var zipdir=require(_0xc91d('0x2'));var moment=require(_0xc91d('0x3'));var BPromise=require('bluebird');var util=require(_0xc91d('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xc91d('0x5'));var juice=require(_0xc91d('0x6'));var Redis=require(_0xc91d('0x7'));var interaction=require(_0xc91d('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xc91d('0x9'))('api');var config=require(_0xc91d('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xc91d('0xb'));config[_0xc91d('0xc')]=_[_0xc91d('0xd')](config['redis'],{'host':_0xc91d('0xe'),'port':0x18eb});var socket=require(_0xc91d('0xf'))(new Redis(config[_0xc91d('0xc')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4ea9fc,_0x51a4e1){_0x51a4e1=_0x51a4e1||0xcc;return function(_0xc8de98){if(_0xc8de98){return _0x4ea9fc['sendStatus'](_0x51a4e1);}return _0x4ea9fc[_0xc91d('0x10')](_0x51a4e1)[_0xc91d('0x11')]();};}function respondWithResult(_0x40f0bb,_0x3a89a3){_0x3a89a3=_0x3a89a3||0xc8;return function(_0x3f4d0e){if(_0x3f4d0e){return _0x40f0bb[_0xc91d('0x10')](_0x3a89a3)[_0xc91d('0x12')](_0x3f4d0e);}};}function respondWithFilteredResult(_0x1457e4,_0x18f629){return function(_0x42f485){if(_0x42f485){var _0x2e4131=typeof _0x18f629[_0xc91d('0x13')]==='undefined'&&typeof _0x18f629[_0xc91d('0x14')]===_0xc91d('0x15');var _0x422c43=_0x42f485[_0xc91d('0x16')];var _0x45cc37=_0x2e4131?0x0:_0x18f629['offset'];var _0x431bee=_0x2e4131?_0x42f485[_0xc91d('0x16')]:_0x18f629[_0xc91d('0x13')]+_0x18f629[_0xc91d('0x14')];var _0x4b25f6;if(_0x431bee>=_0x422c43){_0x431bee=_0x422c43;_0x4b25f6=0xc8;}else{_0x4b25f6=0xce;}_0x1457e4[_0xc91d('0x10')](_0x4b25f6);return _0x1457e4['set'](_0xc91d('0x17'),_0x45cc37+'-'+_0x431bee+'/'+_0x422c43)['json'](_0x42f485);}return null;};}function saveUpdates(_0xf57a91){return function(_0x4ab979){if(_0x4ab979){return _0x4ab979[_0xc91d('0x18')](_0xf57a91)['then'](function(_0x5abdf5){return _0x5abdf5;});}return null;};}function removeEntity(_0x4bb5c7){return function(_0x1a87f6){if(_0x1a87f6){return _0x1a87f6[_0xc91d('0x19')]()[_0xc91d('0x1a')](function(){_0x4bb5c7[_0xc91d('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ff76){return function(_0x438d0f){if(!_0x438d0f){_0x46ff76[_0xc91d('0x1b')](0x194);}return _0x438d0f;};}function handleError(_0x12265b,_0x1a7bc6){_0x1a7bc6=_0x1a7bc6||0x1f4;return function(_0x430ab5){logger[_0xc91d('0x1c')](_0x430ab5[_0xc91d('0x1d')]);if(_0x430ab5['name']){delete _0x430ab5[_0xc91d('0x1e')];}_0x12265b[_0xc91d('0x10')](_0x1a7bc6)[_0xc91d('0x1f')](_0x430ab5);};}exports[_0xc91d('0x20')]=function(_0x57567a,_0x521f58){var _0x2f0a9c={};var _0x10220b=_[_0xc91d('0x21')](db[_0xc91d('0x22')][_0xc91d('0x23')],function(_0x5a6b50){return{'name':_0x5a6b50[_0xc91d('0x24')],'type':_0x5a6b50[_0xc91d('0x25')][_0xc91d('0x26')]};});_0x2f0a9c=qs[_0xc91d('0x27')](_0x10220b,_0x57567a);return interaction[_0xc91d('0x28')](_0xc91d('0x29'),_0x57567a['query'],_0x57567a['user'],_0x2f0a9c,_0x10220b)[_0xc91d('0x1a')](respondWithFilteredResult(_0x521f58,_0x2f0a9c))[_0xc91d('0x2a')](handleError(_0x521f58,null));};exports[_0xc91d('0x2b')]=function(_0xc31747,_0x3c06a5){var _0x50c59b={'raw':![],'where':{'id':_0xc31747[_0xc91d('0x2c')]['id']}},_0x32a698={};_0x32a698[_0xc91d('0x2d')]=_['keys'](db[_0xc91d('0x22')][_0xc91d('0x23')]);_0x32a698[_0xc91d('0x2e')]=_['keys'](_0xc31747['query']);_0x32a698[_0xc91d('0x2f')]=_['intersection'](_0x32a698[_0xc91d('0x2d')],_0x32a698[_0xc91d('0x2e')]);_0x50c59b[_0xc91d('0x30')]=_[_0xc91d('0x31')](_0x32a698['model'],qs[_0xc91d('0x32')](_0xc31747[_0xc91d('0x2e')][_0xc91d('0x32')]));_0x50c59b[_0xc91d('0x30')]=_0x50c59b[_0xc91d('0x30')][_0xc91d('0x33')]?_0x50c59b[_0xc91d('0x30')]:_0x32a698[_0xc91d('0x2d')];if(_0xc31747[_0xc91d('0x2e')][_0xc91d('0x34')]){_0x50c59b[_0xc91d('0x35')]=[{'all':!![]}];}_0x50c59b=_[_0xc91d('0x36')]({},_0x50c59b,_0xc31747[_0xc91d('0x37')]);return db['MailInteraction'][_0xc91d('0x38')](_0x50c59b)[_0xc91d('0x1a')](handleEntityNotFound(_0x3c06a5,null))[_0xc91d('0x1a')](respondWithResult(_0x3c06a5,null))[_0xc91d('0x2a')](handleError(_0x3c06a5,null));};exports['create']=function(_0x4b25e6,_0x43cb1e){return db[_0xc91d('0x22')][_0xc91d('0x39')](_0x4b25e6[_0xc91d('0x3a')],{})[_0xc91d('0x1a')](respondWithResult(_0x43cb1e,0xc9))[_0xc91d('0x2a')](handleError(_0x43cb1e,null));};exports[_0xc91d('0x18')]=function(_0x285539,_0x3e2bfd){if(_0x285539[_0xc91d('0x3a')]['id']){delete _0x285539[_0xc91d('0x3a')]['id'];}return db[_0xc91d('0x22')][_0xc91d('0x38')]({'where':{'id':_0x285539['params']['id']}})[_0xc91d('0x1a')](handleEntityNotFound(_0x3e2bfd,null))[_0xc91d('0x1a')](saveUpdates(_0x285539[_0xc91d('0x3a')],null))['then'](respondWithResult(_0x3e2bfd,null))[_0xc91d('0x2a')](handleError(_0x3e2bfd,null));};exports['destroy']=function(_0x52dbd1,_0x185e21){return db[_0xc91d('0x22')][_0xc91d('0x38')]({'where':{'id':_0x52dbd1[_0xc91d('0x2c')]['id']}})[_0xc91d('0x1a')](handleEntityNotFound(_0x185e21,null))[_0xc91d('0x1a')](removeEntity(_0x185e21,null))[_0xc91d('0x2a')](handleError(_0x185e21,null));};exports[_0xc91d('0x3b')]=function(_0x3b3c08,_0x441a68){return db[_0xc91d('0x22')][_0xc91d('0x3b')]()[_0xc91d('0x1a')](respondWithResult(_0x441a68,null))[_0xc91d('0x2a')](handleError(_0x441a68,null));};exports[_0xc91d('0x3c')]=function(_0x57ec90,_0x496797){return db['MailMessage']['find']({'where':{'id':_0x57ec90['params']['id']}})['then'](handleEntityNotFound(_0x496797,null))[_0xc91d('0x1a')](function(_0xe4f0ba){if(_0xe4f0ba){return _0xe4f0ba[_0xc91d('0x3c')](_0x57ec90[_0xc91d('0x3a')]['ids'],_[_0xc91d('0x3d')](_0x57ec90[_0xc91d('0x3a')],[_0xc91d('0x3e'),'id'])||{});}})[_0xc91d('0x1a')](respondWithResult(_0x496797,null))[_0xc91d('0x2a')](handleError(_0x496797,null));};exports['getMessages']=function(_0x40aed5,_0xb1d40){var _0xe9eb1a={'raw':![],'where':{}};var _0x5842ec={};var _0x32d6d7={'count':0x0,'rows':[]};return db[_0xc91d('0x22')][_0xc91d('0x3f')]({'where':{'id':_0x40aed5[_0xc91d('0x2c')]['id']}})['then'](handleEntityNotFound(_0xb1d40,null))[_0xc91d('0x1a')](function(_0x411002){if(_0x411002){_0x5842ec[_0xc91d('0x2d')]=_['keys'](db[_0xc91d('0x40')][_0xc91d('0x23')]);_0x5842ec[_0xc91d('0x2e')]=_[_0xc91d('0x41')](_0x40aed5[_0xc91d('0x2e')]);_0x5842ec[_0xc91d('0x2f')]=_[_0xc91d('0x31')](_0x5842ec[_0xc91d('0x2d')],_0x5842ec[_0xc91d('0x2e')]);_0xe9eb1a['attributes']=_[_0xc91d('0x31')](_0x5842ec[_0xc91d('0x2d')],qs[_0xc91d('0x32')](_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x32')]));_0xe9eb1a['attributes']=_0xe9eb1a[_0xc91d('0x30')][_0xc91d('0x33')]?_0xe9eb1a[_0xc91d('0x30')]:_0x5842ec[_0xc91d('0x2d')];if(!_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x42')](_0xc91d('0x43'))){_0xe9eb1a[_0xc91d('0x14')]=qs[_0xc91d('0x14')](_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x14')]);_0xe9eb1a[_0xc91d('0x13')]=qs[_0xc91d('0x13')](_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x13')]);}_0xe9eb1a[_0xc91d('0x44')]=qs[_0xc91d('0x45')](_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x45')]);_0xe9eb1a[_0xc91d('0x46')]=qs[_0xc91d('0x2f')](_['pick'](_0x40aed5['query'],_0x5842ec[_0xc91d('0x2f')]));_0xe9eb1a[_0xc91d('0x46')][_0xc91d('0x47')]=_0x411002['id'];if(_0x40aed5['query']['filter']){_0xe9eb1a[_0xc91d('0x46')]=_[_0xc91d('0x36')](_0xe9eb1a[_0xc91d('0x46')],{'$or':_[_0xc91d('0x21')](_0xe9eb1a['attributes'],function(_0x2010f7){var _0x2a5b95={};_0x2a5b95[_0x2010f7]={'$like':'%'+_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x48')]+'%'};return _0x2a5b95;})});}if(_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x49')]){var _0xf13559=_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x49')][_0xc91d('0x4a')](',');var _0x542ea4={};_0x542ea4[_0xf13559[0x0]]={'$gte':moment(_0xf13559[0x1])[_0xc91d('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0xe9eb1a['where']=_[_0xc91d('0x36')](_0xe9eb1a[_0xc91d('0x46')],_0x542ea4);}_0xe9eb1a=_[_0xc91d('0x36')]({},_0xe9eb1a,_0x40aed5[_0xc91d('0x37')]);return db[_0xc91d('0x40')][_0xc91d('0x16')]({'where':_0xe9eb1a[_0xc91d('0x46')]})['then'](function(_0x34d301){_0x32d6d7[_0xc91d('0x16')]=_0x34d301;if(_0x40aed5[_0xc91d('0x2e')][_0xc91d('0x34')]){_0xe9eb1a[_0xc91d('0x35')]=[{'all':!![]}];}return db['MailMessage'][_0xc91d('0x28')](_0xe9eb1a);})[_0xc91d('0x1a')](function(_0x25194a){if(_0x40aed5['query'][_0xc91d('0x4c')]===_0xc91d('0x4d')){for(var _0x46b857=0x0;_0x46b857<_0x25194a['length'];_0x46b857++){_0x25194a[_0x46b857][_0xc91d('0x3a')]=juice(_0x25194a[_0x46b857]['body']);}}_0x32d6d7['rows']=_0x25194a;return _0x32d6d7;});}})[_0xc91d('0x1a')](respondWithFilteredResult(_0xb1d40,_0xe9eb1a))[_0xc91d('0x2a')](handleError(_0xb1d40,null));};exports['addTags']=function(_0x30294a,_0x5766aa){return db[_0xc91d('0x22')][_0xc91d('0x38')]({'where':{'id':_0x30294a[_0xc91d('0x2c')]['id']}})[_0xc91d('0x1a')](handleEntityNotFound(_0x5766aa,null))[_0xc91d('0x1a')](function(_0x3c3887){if(_0x3c3887){return _0x3c3887[_0xc91d('0x4e')](_0x30294a[_0xc91d('0x3a')]['ids'],_[_0xc91d('0x3d')](_0x30294a[_0xc91d('0x3a')],['ids','id'])||{})[_0xc91d('0x4f')](function(){return db[_0xc91d('0x50')][_0xc91d('0x28')]({'attributes':['id',_0xc91d('0x1e'),_0xc91d('0x51')],'where':{'id':_0x30294a[_0xc91d('0x3a')]['ids']}});})['then'](function(_0xe6ec69){socket[_0xc91d('0x52')](_0xc91d('0x53'),{'id':Number(_0x30294a[_0xc91d('0x2c')]['id']),'tags':_0xe6ec69||[]});return{'id':Number(_0x30294a[_0xc91d('0x2c')]['id']),'tags':_0xe6ec69||[]};});}})[_0xc91d('0x1a')](respondWithResult(_0x5766aa,null))['catch'](handleError(_0x5766aa,null));};exports[_0xc91d('0x54')]=function(_0x350364,_0x3f829b){return db[_0xc91d('0x22')]['find']({'where':{'id':_0x350364['params']['id']}})[_0xc91d('0x1a')](handleEntityNotFound(_0x3f829b,null))[_0xc91d('0x1a')](function(_0x31bb54){if(_0x31bb54){return _0x31bb54[_0xc91d('0x54')](_0x350364['query'][_0xc91d('0x3e')]);}})[_0xc91d('0x1a')](respondWithStatusCode(_0x3f829b,null))[_0xc91d('0x2a')](handleError(_0x3f829b,null));};exports[_0xc91d('0x55')]=function(_0x3513f0,_0x5a5a85){var _0x5e2e06=moment()['unix']()[_0xc91d('0x56')]();var _0x5e31fb=path['join'](config[_0xc91d('0x57')],_0xc91d('0x58'),_0xc91d('0x59'),_0xc91d('0x5a'));var _0x57f6a2=path[_0xc91d('0x5b')](config[_0xc91d('0x57')],_0xc91d('0x58'),_0xc91d('0x59'),_0xc91d('0x5c'));var _0x409961=path[_0xc91d('0x5b')](_0x5e31fb,_0x5e2e06);var _0x322e24=util['format'](_0xc91d('0x5d'),_0x3513f0['params']['id'],_0x5e2e06);var _0x4050a0=path['join'](_0x5e31fb,_0x322e24);var _0x1a1ab5=[];if(_0x3513f0[_0xc91d('0x2e')][_0xc91d('0x5c')]){_0x1a1ab5[_0xc91d('0x5e')]({'model':db[_0xc91d('0x5f')],'as':_0xc91d('0x60'),'raw':!![]});}var _0x31b70=[{'model':db['MailMessage'],'as':_0xc91d('0x61'),'attributes':['id',_0xc91d('0x3a'),_0xc91d('0x62'),'to','cc',_0xc91d('0x63'),_0xc91d('0x64'),'createdAt'],'where':{'secret':![]},'order':qs[_0xc91d('0x45')]('id'),'include':_0x1a1ab5}];return db['MailInteraction'][_0xc91d('0x38')]({'where':{'id':_0x3513f0[_0xc91d('0x2c')]['id']},'include':_0x31b70})[_0xc91d('0x1a')](handleEntityNotFound(_0x5a5a85,null))[_0xc91d('0x1a')](function(_0x30c302){if(_0x30c302&&_0x30c302[_0xc91d('0x61')]){var _0x33767e=_0x30c302[_0xc91d('0x65')]({'plain':!![]});fs[_0xc91d('0x66')](_0x409961);return BPromise['each'](_0x33767e['Messages'],function(_0x42831b,_0x42e32d){var _0x22067b={'from':_0x42831b[_0xc91d('0x62')],'to':_0x42831b['to']||_0xc91d('0x67'),'subject':_0x42831b[_0xc91d('0x64')],'html':htmlEntities[_0xc91d('0x68')](_0x42831b[_0xc91d('0x3a')]),'headers':{'Date':moment(_0x42831b[_0xc91d('0x69')])[_0xc91d('0x4b')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x42831b['cc']){_0x22067b[_0xc91d('0x6a')]['Cc']=_0x42831b['cc'];}if(_0x42831b[_0xc91d('0x63')]){_0x22067b[_0xc91d('0x6a')][_0xc91d('0x6b')]=_0x42831b[_0xc91d('0x63')];}return new BPromise(function(_0x2cf937,_0x24d664){if(_0x42831b[_0xc91d('0x60')]){for(var _0x449038=0x0;_0x449038<_0x42831b[_0xc91d('0x60')]['length'];_0x449038++){var _0x1a416e=_0x42831b['Attachments'][_0x449038];var _0x441a64=path[_0xc91d('0x5b')](_0x57f6a2,_0x1a416e['basename']);if(fs[_0xc91d('0x6c')](_0x441a64)){_0x22067b[_0xc91d('0x5c')][_0xc91d('0x5e')]({'name':_0x1a416e[_0xc91d('0x1e')],'contentType':_0x1a416e[_0xc91d('0x25')],'data':fs[_0xc91d('0x6d')](_0x441a64)});}}}emlformat[_0xc91d('0x6e')](_0x22067b,function(_0x5965d8,_0x56ce08){if(_0x5965d8)return _0x24d664(_0x5965d8);fs[_0xc91d('0x6f')](path[_0xc91d('0x5b')](_0x409961,util[_0xc91d('0x4b')](_0xc91d('0x70'),_0x42e32d)),_0x56ce08);return _0x2cf937(_0x56ce08);});});})[_0xc91d('0x1a')](function(){return new BPromise(function(_0x356b9b,_0x33b2d1){zipdir(_0x409961,{'saveTo':_0x4050a0},function(_0x5caacd,_0x545ea5){if(_0x5caacd)return _0x33b2d1(_0x5caacd);return _0x356b9b(_0x545ea5);});})[_0xc91d('0x1a')](function(){return new BPromise(function(_0xc07023,_0x423809){rimraf(_0x409961,function(_0x42e0d5){if(_0x42e0d5)_0x423809(_0x42e0d5);return _0xc07023();});});})[_0xc91d('0x1a')](function(){return _0x5a5a85[_0xc91d('0x55')](_0x4050a0,_0x322e24,function(_0x325535){if(!_0x325535)fs[_0xc91d('0x71')](_0x4050a0);});});});}else{return _0x5a5a85[_0xc91d('0x1b')](0xc8);}})[_0xc91d('0x2a')](handleError(_0x5a5a85,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4255583..03c4890 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 _0xf3a6=['map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf3a6,0x15e));var _0x6f3a=function(_0x28e502,_0x3e36c5){_0x28e502=_0x28e502-0x0;var _0x2fd662=_0xf3a6[_0x28e502];return _0x2fd662;};'use strict';var EventEmitter=require(_0x6f3a('0x0'));var MailInteraction=require(_0x6f3a('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x6f3a('0x1'))['db'][_0x6f3a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6f3a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f3a('0x4'),'afterDestroy':_0x6f3a('0x5')};function emitEvent(_0x4a41bb){return function(_0x1fe60c,_0x40f84c,_0x185e9f){_0x1fe60c[_0x6f3a('0x6')]({'attributes':['id'],'raw':!![]})[_0x6f3a('0x7')](function(_0x21e65d){_0x1fe60c[_0x6f3a('0x8')](_0x6f3a('0x9'),_0x21e65d[_0x6f3a('0xa')](function(_0x648262){return{'id':_0x648262['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1fe60c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6f3a('0x7')](function(_0x5c5932){_0x1fe60c[_0x6f3a('0x8')]('unreadMessages',_0x5c5932['length']);MailInteractionEvents['emit'](_0x4a41bb+':'+_0x1fe60c['id'],_0x1fe60c);MailInteractionEvents[_0x6f3a('0xb')](_0x4a41bb,_0x1fe60c);_0x185e9f(null);})['catch'](_0x185e9f(null));};}for(var e in events){if(events[_0x6f3a('0xc')](e)){var event=events[e];MailInteraction[_0x6f3a('0xd')](e,emitEvent(event));}}module[_0x6f3a('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x1340=['save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x1340,0x74));var _0x0134=function(_0x23e4b9,_0x5410bd){_0x23e4b9=_0x23e4b9-0x0;var _0x87ca8c=_0x1340[_0x23e4b9];return _0x87ca8c;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x0134('0x0'))['db'][_0x0134('0x1')];var MailMessage=require(_0x0134('0x0'))['db'][_0x0134('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0134('0x3'),'afterUpdate':_0x0134('0x4'),'afterDestroy':_0x0134('0x5')};function emitEvent(_0x3d8830){return function(_0x9b5d1b,_0x2534c5,_0x1d8370){_0x9b5d1b[_0x0134('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb5af74){_0x9b5d1b[_0x0134('0x7')]('Users',_0xb5af74[_0x0134('0x8')](function(_0x4f89be){return{'id':_0x4f89be['id']};}));return MailMessage[_0x0134('0x9')]({'where':{'MailInteractionId':_0x9b5d1b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0134('0xa')](function(_0x250827){_0x9b5d1b[_0x0134('0x7')](_0x0134('0xb'),_0x250827['length']);MailInteractionEvents[_0x0134('0xc')](_0x3d8830+':'+_0x9b5d1b['id'],_0x9b5d1b);MailInteractionEvents[_0x0134('0xc')](_0x3d8830,_0x9b5d1b);_0x1d8370(null);})[_0x0134('0xd')](_0x1d8370(null));};}for(var e in events){if(events[_0x0134('0xe')](e)){var event=events[e];MailInteraction[_0x0134('0xf')](e,emitEvent(event));}}module[_0x0134('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 8c1e772..90362ff 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 _0x08e1=['substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','get','update','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','define','mail_interactions','substatus'];(function(_0x40c219,_0x514937){var _0x3e9cd5=function(_0x5892c2){while(--_0x5892c2){_0x40c219['push'](_0x40c219['shift']());}};_0x3e9cd5(++_0x514937);}(_0x08e1,0xc2));var _0x108e=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x08e1[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0x108e('0x0'));var util=require(_0x108e('0x1'));var logger=require(_0x108e('0x2'))(_0x108e('0x3'));var moment=require(_0x108e('0x4'));var BPromise=require(_0x108e('0x5'));var rp=require(_0x108e('0x6'));var fs=require('fs');var path=require(_0x108e('0x7'));var rimraf=require('rimraf');var config=require(_0x108e('0x8'));var attributes=require(_0x108e('0x9'));module['exports']=function(_0x5f1ade,_0x4e9573){return _0x5f1ade[_0x108e('0xa')]('MailInteraction',attributes,{'tableName':_0x108e('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d00a3,_0x14d131,_0x42cabb){if(_0x4d00a3[_0x108e('0xc')]){_0x4d00a3[_0x108e('0xd')]=moment()[_0x108e('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4d00a3['closed']){_0x4d00a3[_0x108e('0xf')]=moment()[_0x108e('0xe')](_0x108e('0x10'));}_0x42cabb(null,_0x14d131);},'beforeUpdate':function(_0x41a62a,_0x56d217,_0x2c7270){if(_0x41a62a[_0x108e('0x11')](_0x108e('0xc'))){_0x41a62a['substatusAt']=_0x41a62a[_0x108e('0xc')]?moment()[_0x108e('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x41a62a['changed'](_0x108e('0x12'))){_0x41a62a[_0x108e('0xf')]=moment()[_0x108e('0xe')](_0x108e('0x10'));_0x41a62a[_0x108e('0xc')]=null;_0x41a62a['substatusAt']=null;}_0x2c7270(null,_0x41a62a);},'afterUpdate':function(_0x5d9aed,_0x154cd7,_0x39e507){var _0x54c8f9=_0x5f1ade[_0x108e('0x13')];var _0x5be4d5=_0x5d9aed[_0x108e('0x14')]({'plain':!![]});if(_0x5be4d5[_0x108e('0x12')]){return _0x54c8f9['MailMessage'][_0x108e('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5be4d5['id']}})['then'](function(){_0x39e507();})['catch'](function(_0x30f118){_0x39e507(_0x30f118);});}else{_0x39e507();}}},'charset':_0x108e('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6bae=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4'];(function(_0x7c482b,_0x5f253f){var _0x26c546=function(_0x1de818){while(--_0x1de818){_0x7c482b['push'](_0x7c482b['shift']());}};_0x26c546(++_0x5f253f);}(_0x6bae,0xb6));var _0xe6ba=function(_0x1f9b15,_0x3d0a18){_0x1f9b15=_0x1f9b15-0x0;var _0x3bc1ef=_0x6bae[_0x1f9b15];return _0x3bc1ef;};'use strict';var _=require(_0xe6ba('0x0'));var util=require(_0xe6ba('0x1'));var logger=require(_0xe6ba('0x2'))(_0xe6ba('0x3'));var moment=require(_0xe6ba('0x4'));var BPromise=require(_0xe6ba('0x5'));var rp=require(_0xe6ba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6ba('0x7'));var config=require(_0xe6ba('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x5c2695,_0x114df3){return _0x5c2695[_0xe6ba('0x9')](_0xe6ba('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xe6ba('0xb'),'fields':[_0xe6ba('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a396b,_0x292a0f,_0x14953b){if(_0x5a396b[_0xe6ba('0xd')]){_0x5a396b[_0xe6ba('0xe')]=moment()[_0xe6ba('0xf')](_0xe6ba('0x10'));}if(_0x5a396b[_0xe6ba('0x11')]){_0x5a396b[_0xe6ba('0x12')]=moment()[_0xe6ba('0xf')](_0xe6ba('0x10'));}_0x14953b(null,_0x292a0f);},'beforeUpdate':function(_0x124958,_0x45cadc,_0x5d392a){if(_0x124958['changed']('substatus')){_0x124958['substatusAt']=_0x124958[_0xe6ba('0xd')]?moment()['format'](_0xe6ba('0x10')):null;}if(_0x124958['changed'](_0xe6ba('0x11'))){_0x124958[_0xe6ba('0x12')]=moment()[_0xe6ba('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x124958[_0xe6ba('0xd')]=null;_0x124958[_0xe6ba('0xe')]=null;}_0x5d392a(null,_0x124958);},'afterUpdate':function(_0x200139,_0x201a9c,_0x325a88){var _0x528e96=_0x5c2695[_0xe6ba('0x13')];var _0x59b563=_0x200139[_0xe6ba('0x14')]({'plain':!![]});if(_0x59b563[_0xe6ba('0x11')]){return _0x528e96[_0xe6ba('0x15')][_0xe6ba('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x59b563['id']}})[_0xe6ba('0x17')](function(){_0x325a88();})[_0xe6ba('0x18')](function(_0x4923ec){_0x325a88(_0x4923ec);});}else{_0x325a88();}}},'charset':_0xe6ba('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d929410..2abf9d3 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 _0x69a4=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailInteraction','update','options','raw','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','where','addTags','body','ids','omit','AddTags','util','moment'];(function(_0x31b500,_0x196ddb){var _0x208f59=function(_0xe594d0){while(--_0xe594d0){_0x31b500['push'](_0x31b500['shift']());}};_0x208f59(++_0x196ddb);}(_0x69a4,0x76));var _0x469a=function(_0x272de4,_0x1326a9){_0x272de4=_0x272de4-0x0;var _0x510a15=_0x69a4[_0x272de4];return _0x510a15;};'use strict';var _=require('lodash');var util=require(_0x469a('0x0'));var moment=require(_0x469a('0x1'));var BPromise=require('bluebird');var rs=require(_0x469a('0x2'));var fs=require('fs');var Redis=require(_0x469a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x469a('0x4'))(_0x469a('0x5'));var config=require('../../config/environment');var jayson=require(_0x469a('0x6'));var client=jayson[_0x469a('0x7')][_0x469a('0x8')]({'port':0x232a});config[_0x469a('0x9')]=_[_0x469a('0xa')](config[_0x469a('0x9')],{'host':_0x469a('0xb'),'port':0x18eb});var socket=require(_0x469a('0xc'))(new Redis(config[_0x469a('0x9')]));require('./mailInteraction.socket')[_0x469a('0xd')](socket);function respondWithRpcPromise(_0x1a26a3,_0x4de19f,_0x49d74a){return new BPromise(function(_0xd3fcce,_0x8aa78){return client[_0x469a('0xe')](_0x1a26a3,_0x49d74a)[_0x469a('0xf')](function(_0xc3dc5e){logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));logger[_0x469a('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4de19f,'request\x20sent',JSON[_0x469a('0x14')](_0xc3dc5e));if(_0xc3dc5e[_0x469a('0x15')]){if(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x16')]===0x1f4){logger[_0x469a('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0x8aa78(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x17')]);}logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0xd3fcce(_0xc3dc5e['error'][_0x469a('0x17')]);}else{logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));_0xd3fcce(_0xc3dc5e[_0x469a('0x18')]['message']);}})[_0x469a('0x19')](function(_0x440040){logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0x440040);_0x8aa78(_0x440040);});});}exports['UpdateMailInteraction']=function(_0x524a77){var _0x126c5=this;return new Promise(function(_0x4ab05a,_0x5f122a){return db[_0x469a('0x1a')][_0x469a('0x1b')](_0x524a77['body'],{'raw':_0x524a77['options']?_0x524a77[_0x469a('0x1c')][_0x469a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x524a77[_0x469a('0x1c')]?_0x524a77[_0x469a('0x1c')]['where']||null:null,'attributes':_0x524a77[_0x469a('0x1c')]?_0x524a77['options']['attributes']||null:null,'limit':_0x524a77[_0x469a('0x1c')]?_0x524a77[_0x469a('0x1c')][_0x469a('0x1e')]||null:null})[_0x469a('0xf')](function(_0x5b85c8){logger[_0x469a('0x10')](_0x469a('0x1f'),_0x524a77);logger[_0x469a('0x13')](_0x469a('0x1f'),_0x524a77,JSON[_0x469a('0x14')](_0x5b85c8));_0x4ab05a(_0x5b85c8);})[_0x469a('0x19')](function(_0x55af24){logger[_0x469a('0x15')]('UpdateMailInteraction',_0x55af24[_0x469a('0x17')],_0x524a77);_0x5f122a(_0x126c5[_0x469a('0x15')](0x1f4,_0x55af24[_0x469a('0x17')]));});});};exports[_0x469a('0x20')]=function(_0x1bbc39){return new Promise(function(_0x1e6396,_0x4de8b0){return db[_0x469a('0x1a')][_0x469a('0x21')]({'where':_0x1bbc39[_0x469a('0x1c')]?_0x1bbc39[_0x469a('0x1c')][_0x469a('0x22')]||null:null})['then'](function(_0x2ba796){if(_0x2ba796){return _0x2ba796[_0x469a('0x23')](_0x1bbc39[_0x469a('0x24')][_0x469a('0x25')],_[_0x469a('0x26')](_0x1bbc39['body'],[_0x469a('0x25'),'id'])||{});}})['spread'](function(_0xa1b73){logger[_0x469a('0x10')](_0x469a('0x27'),_0x1bbc39);logger['debug']('AddTags',_0x1bbc39,JSON[_0x469a('0x14')](_0xa1b73));_0x1e6396(_0xa1b73);})[_0x469a('0x19')](function(_0x38eecb){logger[_0x469a('0x15')](_0x469a('0x27'),_0x38eecb[_0x469a('0x17')],_0x1bbc39);_0x4de8b0(_this[_0x469a('0x15')](0x1f4,_0x38eecb[_0x469a('0x17')]));});});}; \ No newline at end of file +var _0x46e1=['UpdateMailInteraction','update','options','attributes','limit','then','AddTagsToMailInteraction','find','where','addTags','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x417728,_0x8b4caf){var _0x4af982=function(_0x2ce33e){while(--_0x2ce33e){_0x417728['push'](_0x417728['shift']());}};_0x4af982(++_0x8b4caf);}(_0x46e1,0x155));var _0x146e=function(_0xebbd32,_0x5e697c){_0xebbd32=_0xebbd32-0x0;var _0x33c686=_0x46e1[_0xebbd32];return _0x33c686;};'use strict';var _=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var moment=require(_0x146e('0x2'));var BPromise=require(_0x146e('0x3'));var rs=require(_0x146e('0x4'));var fs=require('fs');var Redis=require(_0x146e('0x5'));var db=require(_0x146e('0x6'))['db'];var utils=require(_0x146e('0x7'));var logger=require(_0x146e('0x8'))(_0x146e('0x9'));var config=require('../../config/environment');var jayson=require(_0x146e('0xa'));var client=jayson[_0x146e('0xb')][_0x146e('0xc')]({'port':0x232a});config[_0x146e('0xd')]=_[_0x146e('0xe')](config[_0x146e('0xd')],{'host':_0x146e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x146e('0xd')]));require('./mailInteraction.socket')[_0x146e('0x10')](socket);function respondWithRpcPromise(_0xf7d20d,_0xcf7c1e,_0x453b5a){return new BPromise(function(_0x15cea1,_0x335df8){return client['request'](_0xf7d20d,_0x453b5a)['then'](function(_0x209e62){logger[_0x146e('0x11')](_0x146e('0x12'),_0xcf7c1e,_0x146e('0x13'));logger[_0x146e('0x14')](_0x146e('0x15'),_0xcf7c1e,_0x146e('0x13'),JSON[_0x146e('0x16')](_0x209e62));if(_0x209e62['error']){if(_0x209e62['error'][_0x146e('0x17')]===0x1f4){logger[_0x146e('0x18')](_0x146e('0x12'),_0xcf7c1e,_0x209e62[_0x146e('0x18')][_0x146e('0x19')]);return _0x335df8(_0x209e62[_0x146e('0x18')][_0x146e('0x19')]);}logger[_0x146e('0x18')](_0x146e('0x12'),_0xcf7c1e,_0x209e62[_0x146e('0x18')][_0x146e('0x19')]);return _0x15cea1(_0x209e62['error'][_0x146e('0x19')]);}else{logger[_0x146e('0x11')](_0x146e('0x12'),_0xcf7c1e,_0x146e('0x13'));_0x15cea1(_0x209e62[_0x146e('0x1a')][_0x146e('0x19')]);}})[_0x146e('0x1b')](function(_0x4fc704){logger[_0x146e('0x18')]('MailInteraction,\x20%s,\x20%s',_0xcf7c1e,_0x4fc704);_0x335df8(_0x4fc704);});});}exports[_0x146e('0x1c')]=function(_0x1779cc){var _0x387323=this;return new Promise(function(_0x48596a,_0x45ff0c){return db['MailInteraction'][_0x146e('0x1d')](_0x1779cc['body'],{'raw':_0x1779cc[_0x146e('0x1e')]?_0x1779cc[_0x146e('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1779cc['options']?_0x1779cc['options']['where']||null:null,'attributes':_0x1779cc['options']?_0x1779cc['options'][_0x146e('0x1f')]||null:null,'limit':_0x1779cc['options']?_0x1779cc[_0x146e('0x1e')][_0x146e('0x20')]||null:null})[_0x146e('0x21')](function(_0x37e774){logger[_0x146e('0x11')](_0x146e('0x1c'),_0x1779cc);logger[_0x146e('0x14')]('UpdateMailInteraction',_0x1779cc,JSON[_0x146e('0x16')](_0x37e774));_0x48596a(_0x37e774);})['catch'](function(_0x2a31b8){logger['error']('UpdateMailInteraction',_0x2a31b8[_0x146e('0x19')],_0x1779cc);_0x45ff0c(_0x387323['error'](0x1f4,_0x2a31b8[_0x146e('0x19')]));});});};exports[_0x146e('0x22')]=function(_0x235a55){return new Promise(function(_0x209d5b,_0x3a0bf3){return db['MailInteraction'][_0x146e('0x23')]({'where':_0x235a55[_0x146e('0x1e')]?_0x235a55[_0x146e('0x1e')][_0x146e('0x24')]||null:null})[_0x146e('0x21')](function(_0x312fee){if(_0x312fee){return _0x312fee[_0x146e('0x25')](_0x235a55[_0x146e('0x26')]['ids'],_['omit'](_0x235a55[_0x146e('0x26')],['ids','id'])||{});}})[_0x146e('0x27')](function(_0x5345fb){logger['info'](_0x146e('0x28'),_0x235a55);logger[_0x146e('0x14')](_0x146e('0x28'),_0x235a55,JSON[_0x146e('0x16')](_0x5345fb));_0x209d5b(_0x5345fb);})[_0x146e('0x1b')](function(_0x2ea76e){logger['error'](_0x146e('0x28'),_0x2ea76e['message'],_0x235a55);_0x3a0bf3(_this[_0x146e('0x18')](0x1f4,_0x2ea76e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ce5d738..deccc6e 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 _0x6111=['mailInteraction:','./mailInteraction.events','save','remove','update','register'];(function(_0x195d2f,_0x58dbe8){var _0x239dee=function(_0x24404a){while(--_0x24404a){_0x195d2f['push'](_0x195d2f['shift']());}};_0x239dee(++_0x58dbe8);}(_0x6111,0xdf));var _0x1611=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6111[_0x14add3];return _0x4a174f;};'use strict';var MailInteractionEvents=require(_0x1611('0x0'));var events=[_0x1611('0x1'),_0x1611('0x2'),_0x1611('0x3')];function createListener(_0x505bc1,_0x1efa14){return function(_0x3852df){_0x1efa14['emit'](_0x505bc1,_0x3852df);};}function removeListener(_0x5d190e,_0x61e414){return function(){MailInteractionEvents['removeListener'](_0x5d190e,_0x61e414);};}exports[_0x1611('0x4')]=function(_0x422a1e){for(var _0x335a40=0x0,_0x3b28ed=events['length'];_0x335a40<_0x3b28ed;_0x335a40++){var _0xc826d9=events[_0x335a40];var _0xf9bb0d=createListener(_0x1611('0x5')+_0xc826d9,_0x422a1e);MailInteractionEvents['on'](_0xc826d9,_0xf9bb0d);}}; \ No newline at end of file +var _0x0c93=['remove','update','removeListener','register','length','mailInteraction:','save'];(function(_0x1a4b6f,_0x5f517e){var _0x3c97f2=function(_0x532994){while(--_0x532994){_0x1a4b6f['push'](_0x1a4b6f['shift']());}};_0x3c97f2(++_0x5f517e);}(_0x0c93,0x13a));var _0x30c9=function(_0x105ef7,_0x182906){_0x105ef7=_0x105ef7-0x0;var _0x265533=_0x0c93[_0x105ef7];return _0x265533;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x30c9('0x0'),_0x30c9('0x1'),_0x30c9('0x2')];function createListener(_0x2f7696,_0x2afffb){return function(_0x255b92){_0x2afffb['emit'](_0x2f7696,_0x255b92);};}function removeListener(_0x355b3c,_0x16e933){return function(){MailInteractionEvents[_0x30c9('0x3')](_0x355b3c,_0x16e933);};}exports[_0x30c9('0x4')]=function(_0x4c740c){for(var _0x5a116d=0x0,_0x4cfbab=events[_0x30c9('0x5')];_0x5a116d<_0x4cfbab;_0x5a116d++){var _0x2a80af=events[_0x5a116d];var _0x22dd12=createListener(_0x30c9('0x6')+_0x2a80af,_0x4c740c);MailInteractionEvents['on'](_0x2a80af,_0x22dd12);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index e76ee9c..4789797 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1db9=['../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','describe','exports','express','Router'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x1db9,0x176));var _0x91db=function(_0x54a7f8,_0x48e29b){_0x54a7f8=_0x54a7f8-0x0;var _0x18833e=_0x1db9[_0x54a7f8];return _0x18833e;};'use strict';var express=require(_0x91db('0x0'));var router=express[_0x91db('0x1')]();var auth=require(_0x91db('0x2'));var controller=require(_0x91db('0x3'));router[_0x91db('0x4')](_0x91db('0x5'),auth['isAuthenticated'](),controller[_0x91db('0x6')]);module[_0x91db('0x7')]=router; \ No newline at end of file +var _0x0686=['/describe','isAuthenticated','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x47f734,_0x26ae4a){var _0xc2684a=function(_0x4b9cde){while(--_0x4b9cde){_0x47f734['push'](_0x47f734['shift']());}};_0xc2684a(++_0x26ae4a);}(_0x0686,0x123));var _0x6068=function(_0x38c274,_0x45c5df){_0x38c274=_0x38c274-0x0;var _0x4d8a02=_0x0686[_0x38c274];return _0x4d8a02;};'use strict';var express=require(_0x6068('0x0'));var router=express[_0x6068('0x1')]();var auth=require(_0x6068('0x2'));var controller=require(_0x6068('0x3'));router[_0x6068('0x4')](_0x6068('0x5'),auth[_0x6068('0x6')](),controller['describe']);module[_0x6068('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 2f86011..006d22d 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x560753,_0xa71e2d){var _0x4a0a86=function(_0xbe9842){while(--_0xbe9842){_0x560753['push'](_0x560753['shift']());}};_0x4a0a86(++_0xa71e2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x388194,_0x4a063d){var _0x32a1c0=function(_0x3a462d){while(--_0x3a462d){_0x388194['push'](_0x388194['shift']());}};_0x32a1c0(++_0x4a063d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 1dae3f8..ef0b46f 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cb9=['sequelize','exports','INTEGER'];(function(_0x965b89,_0x2e394b){var _0x211af2=function(_0x5a2cdd){while(--_0x5a2cdd){_0x965b89['push'](_0x965b89['shift']());}};_0x211af2(++_0x2e394b);}(_0x5cb9,0xb4));var _0x95cb=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5cb9[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x95cb('0x0'));module[_0x95cb('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x95cb('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x0544=['INTEGER','sequelize','exports'];(function(_0xffa654,_0x4c734){var _0x5dd847=function(_0x64173a){while(--_0x64173a){_0xffa654['push'](_0xffa654['shift']());}};_0x5dd847(++_0x4c734);}(_0x0544,0x196));var _0x4054=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x0544[_0x183b97];return _0x629cf7;};'use strict';var Sequelize=require(_0x4054('0x0'));module[_0x4054('0x1')]={'MailInteractionId':{'type':Sequelize[_0x4054('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x4054('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 0ea31ce..3535386 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bc8=['define','MailInteractionHasTag','./mailInteractionHasTag'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bc8,0xd4));var _0x86bc=function(_0x11d156,_0x5e45c5){_0x11d156=_0x11d156-0x0;var _0x10d46a=_0x6bc8[_0x11d156];return _0x10d46a;};'use strict';var attributes=require(_0x86bc('0x0'));module['exports']=function(_0x153b77){return _0x153b77[_0x86bc('0x1')](_0x86bc('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b64=['./mailInteractionHasTag','define','MailInteractionHasTag','mail_interaction_has_tags'];(function(_0x27a997,_0x85f149){var _0x5aa288=function(_0x38f03c){while(--_0x38f03c){_0x27a997['push'](_0x27a997['shift']());}};_0x5aa288(++_0x85f149);}(_0x3b64,0x1c0));var _0x43b6=function(_0xf2415a,_0x3d6254){_0xf2415a=_0xf2415a-0x0;var _0x3c098e=_0x3b64[_0xf2415a];return _0x3c098e;};'use strict';var attributes=require(_0x43b6('0x0'));module['exports']=function(_0x5ef252){return _0x5ef252[_0x43b6('0x1')](_0x43b6('0x2'),attributes,{'tableName':_0x43b6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5a1dcb0..7c1214f 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 _0x3238=['describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x4b682a,_0x351971){var _0x508b4f=function(_0x4428c6){while(--_0x4428c6){_0x4b682a['push'](_0x4b682a['shift']());}};_0x508b4f(++_0x351971);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8323('0x0'));var util=require('util');var path=require(_0x8323('0x1'));var timeout=require(_0x8323('0x2'));var express=require(_0x8323('0x3'));var router=express['Router']();var fs_extra=require(_0x8323('0x4'));var auth=require(_0x8323('0x5'));var interaction=require(_0x8323('0x6'));var config=require(_0x8323('0x7'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x8323('0x8')](),controller[_0x8323('0x9')]);router[_0x8323('0xa')](_0x8323('0xb'),auth['isAuthenticated'](),controller[_0x8323('0xc')]);router['get'](_0x8323('0xd'),auth[_0x8323('0x8')](),controller[_0x8323('0xe')]);router[_0x8323('0xa')](_0x8323('0xf'),auth[_0x8323('0x8')](),controller[_0x8323('0x10')]);router[_0x8323('0x11')]('/',auth['isAuthenticated'](),interaction[_0x8323('0x12')](_0x8323('0x13'),_0x8323('0x14')),controller['create']);router[_0x8323('0x15')](_0x8323('0xd'),auth[_0x8323('0x8')](),controller[_0x8323('0x16')]);router[_0x8323('0x15')](_0x8323('0x17'),auth[_0x8323('0x8')](),controller[_0x8323('0x18')]);router[_0x8323('0x15')](_0x8323('0x19'),auth[_0x8323('0x8')](),controller[_0x8323('0x1a')]);router[_0x8323('0x1b')](_0x8323('0xd'),auth['isAuthenticated'](),controller[_0x8323('0x1c')]);module[_0x8323('0x1d')]=router; \ No newline at end of file +var _0xb458=['/:id','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x41e420,_0x1d1d67){var _0x20d6b2=function(_0x29e96b){while(--_0x29e96b){_0x41e420['push'](_0x41e420['shift']());}};_0x20d6b2(++_0x1d1d67);}(_0xb458,0xca));var _0x8b45=function(_0x24420e,_0x78d663){_0x24420e=_0x24420e-0x0;var _0x12d301=_0xb458[_0x24420e];return _0x12d301;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require(_0x8b45('0x3'));var express=require('express');var router=express[_0x8b45('0x4')]();var fs_extra=require(_0x8b45('0x5'));var auth=require(_0x8b45('0x6'));var interaction=require(_0x8b45('0x7'));var config=require(_0x8b45('0x8'));var controller=require(_0x8b45('0x9'));router[_0x8b45('0xa')]('/',auth[_0x8b45('0xb')](),controller[_0x8b45('0xc')]);router[_0x8b45('0xa')](_0x8b45('0xd'),auth[_0x8b45('0xb')](),controller[_0x8b45('0xe')]);router['get'](_0x8b45('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8b45('0xa')](_0x8b45('0x10'),auth[_0x8b45('0xb')](),controller['download']);router[_0x8b45('0x11')]('/',auth['isAuthenticated'](),interaction[_0x8b45('0x12')](_0x8b45('0x13'),_0x8b45('0x14')),controller[_0x8b45('0x15')]);router[_0x8b45('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x8b45('0x17')]);router[_0x8b45('0x16')](_0x8b45('0x18'),auth[_0x8b45('0xb')](),controller[_0x8b45('0x19')]);router[_0x8b45('0x16')](_0x8b45('0x1a'),auth[_0x8b45('0xb')](),controller[_0x8b45('0x1b')]);router[_0x8b45('0x1c')](_0x8b45('0xf'),auth[_0x8b45('0xb')](),controller[_0x8b45('0x1d')]);module[_0x8b45('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1220b55..0b6190f 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 _0x7a18=['lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat'];(function(_0x44957f,_0x2e8abc){var _0x555a2b=function(_0x4ea9b8){while(--_0x4ea9b8){_0x44957f['push'](_0x44957f['shift']());}};_0x555a2b(++_0x2e8abc);}(_0x7a18,0x15c));var _0x87a1=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x7a18[_0x10f68e];return _0x4c8372;};'use strict';var Sequelize=require('sequelize');var _=require(_0x87a1('0x0'));module[_0x87a1('0x1')]={'body':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x87a1('0x2')]('medium')},'read':{'type':Sequelize[_0x87a1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x87a1('0x5')]('in','out'),'defaultValue':_0x87a1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x87a1('0x7')](0x1fe)},'from':{'type':Sequelize[_0x87a1('0x7')]},'to':{'type':Sequelize['TEXT'](_0x87a1('0x3'))},'cc':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x87a1('0x8')]},'attach':{'type':Sequelize[_0x87a1('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x87a1('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x87a1('0x8')]},'originTo':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3'))},'originCc':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3'))},'originChannel':{'type':Sequelize[_0x87a1('0x5')](_0x87a1('0xa'),_0x87a1('0xb')),'defaultValue':_0x87a1('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xfcfb=['Chat','exports','long','TEXT','medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email'];(function(_0x529b9a,_0x3ddafe){var _0x15b1f2=function(_0x584921){while(--_0x584921){_0x529b9a['push'](_0x529b9a['shift']());}};_0x15b1f2(++_0x3ddafe);}(_0xfcfb,0x145));var _0xbfcf=function(_0x1cffe2,_0x5383e8){_0x1cffe2=_0x1cffe2-0x0;var _0x57030e=_0xfcfb[_0x1cffe2];return _0x57030e;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xbfcf('0x0')]={'body':{'type':Sequelize['TEXT'](_0xbfcf('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbfcf('0x2')](_0xbfcf('0x3'))},'read':{'type':Sequelize[_0xbfcf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfcf('0x5')]('in',_0xbfcf('0x6')),'defaultValue':_0xbfcf('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbfcf('0x7')](0x1fe)},'from':{'type':Sequelize[_0xbfcf('0x7')]},'to':{'type':Sequelize[_0xbfcf('0x2')](_0xbfcf('0x1'))},'cc':{'type':Sequelize['TEXT'](_0xbfcf('0x1'))},'bcc':{'type':Sequelize[_0xbfcf('0x2')]('long')},'subject':{'type':Sequelize[_0xbfcf('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xbfcf('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xbfcf('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xbfcf('0x9')]},'originTo':{'type':Sequelize[_0xbfcf('0x2')](_0xbfcf('0x1'))},'originCc':{'type':Sequelize[_0xbfcf('0x2')]('long')},'originChannel':{'type':Sequelize[_0xbfcf('0x5')](_0xbfcf('0xa'),_0xbfcf('0xb')),'defaultValue':_0xbfcf('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3952b13..bd5b473 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 _0x47c9=['decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','push','readFileSync','build','eml-format','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','set','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','update','body','describe','create','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','UserId','user','agent','get','MailInteractionId','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','download','toString','join','files','tmp','server','message-%s.eml','from','subject','Attachment','Attachments'];(function(_0x2996d9,_0x761881){var _0xecf6ff=function(_0x432c7d){while(--_0x432c7d){_0x2996d9['push'](_0x2996d9['shift']());}};_0xecf6ff(++_0x761881);}(_0x47c9,0x13a));var _0x947c=function(_0x4c150a,_0x1e6c73){_0x4c150a=_0x4c150a-0x0;var _0x5f52e6=_0x47c9[_0x4c150a];return _0x5f52e6;};'use strict';var emlformat=require(_0x947c('0x0'));var moment=require(_0x947c('0x1'));var util=require(_0x947c('0x2'));var path=require(_0x947c('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x947c('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0x947c('0x5'));var qs=require(_0x947c('0x6'));var logger=require(_0x947c('0x7'))('api');var interaction_log=require(_0x947c('0x7'))(_0x947c('0x8'));var config=require(_0x947c('0x9'));var db=require(_0x947c('0xa'))['db'];config[_0x947c('0xb')]=_[_0x947c('0xc')](config[_0x947c('0xb')],{'host':_0x947c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x947c('0xb')]));var htmlEntities=require(_0x947c('0xe'));require(_0x947c('0xf'))[_0x947c('0x10')](socket);var jayson=require(_0x947c('0x11'));var client=jayson[_0x947c('0x12')][_0x947c('0x13')]({'port':0x232c});var client9003=jayson[_0x947c('0x12')][_0x947c('0x13')]({'port':0x232b});var client9002=jayson[_0x947c('0x12')][_0x947c('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1eb6b6,_0x5a7942,_0x39ca66,_0x8b52f9){return new Promise(function(_0x3bfc9f,_0x41a389){var _0x204922=_0x8b52f9||client;return _0x204922[_0x947c('0x14')](_0x1eb6b6,_0x39ca66)[_0x947c('0x15')](function(_0x53df4c){logger[_0x947c('0x16')](_0x947c('0x17'),_0x5a7942,_0x947c('0x18'));logger['debug'](_0x947c('0x19'),_0x5a7942,_0x947c('0x18'),JSON[_0x947c('0x1a')](_0x53df4c));if(_0x53df4c['error']){if(_0x53df4c[_0x947c('0x1b')][_0x947c('0x1c')]===0x1f4){logger[_0x947c('0x1b')](_0x947c('0x17'),_0x5a7942,_0x53df4c[_0x947c('0x1b')][_0x947c('0x1d')]);return _0x41a389(_0x53df4c[_0x947c('0x1b')][_0x947c('0x1d')]);}logger[_0x947c('0x1b')](_0x947c('0x17'),_0x5a7942,_0x53df4c['error'][_0x947c('0x1d')]);return _0x3bfc9f(_0x53df4c[_0x947c('0x1b')][_0x947c('0x1d')]);}else{logger[_0x947c('0x16')](_0x947c('0x17'),_0x5a7942,_0x947c('0x18'));_0x3bfc9f(_0x53df4c[_0x947c('0x1e')][_0x947c('0x1d')]);}})[_0x947c('0x1f')](function(_0x3b7b73){logger[_0x947c('0x1b')](_0x947c('0x17'),_0x5a7942,_0x3b7b73);_0x41a389(_0x3b7b73);});});}function respondWithResult(_0x4908b9,_0x1695d3){_0x1695d3=_0x1695d3||0xc8;return function(_0x1e2fd2){if(_0x1e2fd2){return _0x4908b9[_0x947c('0x20')](_0x1695d3)[_0x947c('0x21')](_0x1e2fd2);}};}function respondWithFilteredResult(_0x14dc26,_0x45d54a){return function(_0x5426c5){if(_0x5426c5){var _0x2444a4=typeof _0x45d54a[_0x947c('0x22')]===_0x947c('0x23')&&typeof _0x45d54a['limit']==='undefined';var _0x380180=_0x5426c5[_0x947c('0x24')];var _0x156c7d=_0x2444a4?0x0:_0x45d54a['offset'];var _0x341c67=_0x2444a4?_0x5426c5['count']:_0x45d54a[_0x947c('0x22')]+_0x45d54a['limit'];var _0x492c67;if(_0x341c67>=_0x380180){_0x341c67=_0x380180;_0x492c67=0xc8;}else{_0x492c67=0xce;}_0x14dc26[_0x947c('0x20')](_0x492c67);return _0x14dc26[_0x947c('0x25')]('Content-Range',_0x156c7d+'-'+_0x341c67+'/'+_0x380180)[_0x947c('0x21')](_0x5426c5);}return null;};}function saveUpdates(_0x412efb){return function(_0x3f19e6){if(_0x3f19e6){return _0x3f19e6['update'](_0x412efb)[_0x947c('0x15')](function(_0x510b55){return _0x510b55;});}return null;};}function removeEntity(_0x588f17){return function(_0x246c2a){if(_0x246c2a){return _0x246c2a[_0x947c('0x26')]()[_0x947c('0x15')](function(){_0x588f17[_0x947c('0x20')](0xcc)[_0x947c('0x27')]();});}};}function handleEntityNotFound(_0x2cebd9){return function(_0x1c58c0){if(!_0x1c58c0){_0x2cebd9[_0x947c('0x28')](0x194);}return _0x1c58c0;};}function handleError(_0x203b96,_0x1c206f){_0x1c206f=_0x1c206f||0x1f4;return function(_0x465b95){logger[_0x947c('0x1b')](_0x465b95['stack']);if(_0x465b95[_0x947c('0x29')]){delete _0x465b95['name'];}_0x203b96[_0x947c('0x20')](_0x1c206f)[_0x947c('0x2a')](_0x465b95);};}exports[_0x947c('0x2b')]=function(_0x53af96,_0x22aa25){var _0x39b4d5={},_0x45e324={},_0x57903b={'count':0x0,'rows':[]};var _0x153e97=_[_0x947c('0x2c')](db[_0x947c('0x2d')][_0x947c('0x2e')],function(_0x21912b){return{'name':_0x21912b[_0x947c('0x2f')],'type':_0x21912b[_0x947c('0x30')][_0x947c('0x31')]};});_0x45e324['model']=_[_0x947c('0x2c')](_0x153e97,_0x947c('0x29'));_0x45e324['query']=_[_0x947c('0x32')](_0x53af96['query']);_0x45e324[_0x947c('0x33')]=_[_0x947c('0x34')](_0x45e324[_0x947c('0x35')],_0x45e324[_0x947c('0x36')]);_0x39b4d5['attributes']=_[_0x947c('0x34')](_0x45e324[_0x947c('0x35')],qs['fields'](_0x53af96[_0x947c('0x36')][_0x947c('0x37')]));_0x39b4d5[_0x947c('0x38')]=_0x39b4d5[_0x947c('0x38')]['length']?_0x39b4d5[_0x947c('0x38')]:_0x45e324[_0x947c('0x35')];if(!_0x53af96[_0x947c('0x36')][_0x947c('0x39')](_0x947c('0x3a'))){_0x39b4d5['limit']=qs[_0x947c('0x3b')](_0x53af96[_0x947c('0x36')]['limit']);_0x39b4d5[_0x947c('0x22')]=qs[_0x947c('0x22')](_0x53af96[_0x947c('0x36')][_0x947c('0x22')]);}_0x39b4d5[_0x947c('0x3c')]=qs['sort'](_0x53af96['query'][_0x947c('0x3d')]);_0x39b4d5[_0x947c('0x3e')]=qs['filters'](_['pick'](_0x53af96[_0x947c('0x36')],_0x45e324['filters']),_0x153e97);if(_0x53af96['query'][_0x947c('0x3f')]){_0x39b4d5[_0x947c('0x3e')]=_[_0x947c('0x40')](_0x39b4d5['where'],{'$or':_[_0x947c('0x2c')](_0x153e97,function(_0xa04ec5){if(_0xa04ec5[_0x947c('0x30')]!==_0x947c('0x41')){var _0x1b4c54={};_0x1b4c54[_0xa04ec5[_0x947c('0x29')]]={'$like':'%'+_0x53af96[_0x947c('0x36')][_0x947c('0x3f')]+'%'};return _0x1b4c54;}})});}_0x39b4d5=_[_0x947c('0x40')]({},_0x39b4d5,_0x53af96[_0x947c('0x42')]);var _0x410c8a={'where':_0x39b4d5['where']};return db['MailMessage'][_0x947c('0x24')](_0x410c8a)['then'](function(_0x21232c){_0x57903b['count']=_0x21232c;if(_0x53af96['query'][_0x947c('0x43')]){_0x39b4d5[_0x947c('0x44')]=[{'all':!![]}];}return db[_0x947c('0x2d')][_0x947c('0x45')](_0x39b4d5);})[_0x947c('0x15')](function(_0x542e20){_0x57903b[_0x947c('0x46')]=_0x542e20;return _0x57903b;})[_0x947c('0x15')](respondWithFilteredResult(_0x22aa25,_0x39b4d5))[_0x947c('0x1f')](handleError(_0x22aa25,null));};exports['show']=function(_0x1c8e7a,_0x2fdfa9){var _0x4bfb94={'raw':!![],'where':{'id':_0x1c8e7a[_0x947c('0x47')]['id']}},_0x108712={};_0x108712[_0x947c('0x35')]=_['keys'](db[_0x947c('0x2d')][_0x947c('0x2e')]);_0x108712[_0x947c('0x36')]=_[_0x947c('0x32')](_0x1c8e7a['query']);_0x108712[_0x947c('0x33')]=_[_0x947c('0x34')](_0x108712['model'],_0x108712[_0x947c('0x36')]);_0x4bfb94[_0x947c('0x38')]=_[_0x947c('0x34')](_0x108712[_0x947c('0x35')],qs[_0x947c('0x37')](_0x1c8e7a[_0x947c('0x36')][_0x947c('0x37')]));_0x4bfb94['attributes']=_0x4bfb94[_0x947c('0x38')][_0x947c('0x48')]?_0x4bfb94[_0x947c('0x38')]:_0x108712['model'];if(_0x1c8e7a[_0x947c('0x36')][_0x947c('0x43')]){_0x4bfb94[_0x947c('0x44')]=[{'all':!![]}];}_0x4bfb94=_[_0x947c('0x40')]({},_0x4bfb94,_0x1c8e7a[_0x947c('0x42')]);return db['MailMessage'][_0x947c('0x49')](_0x4bfb94)[_0x947c('0x15')](handleEntityNotFound(_0x2fdfa9,null))[_0x947c('0x15')](respondWithResult(_0x2fdfa9,null))[_0x947c('0x1f')](handleError(_0x2fdfa9,null));};exports[_0x947c('0x4a')]=function(_0xed9912,_0x332278){if(_0xed9912[_0x947c('0x4b')]['id']){delete _0xed9912[_0x947c('0x4b')]['id'];}return db[_0x947c('0x2d')]['find']({'where':{'id':_0xed9912[_0x947c('0x47')]['id']}})[_0x947c('0x15')](handleEntityNotFound(_0x332278,null))[_0x947c('0x15')](saveUpdates(_0xed9912[_0x947c('0x4b')],null))['then'](respondWithResult(_0x332278,null))[_0x947c('0x1f')](handleError(_0x332278,null));};exports[_0x947c('0x26')]=function(_0x45dae1,_0xd5c937){return db[_0x947c('0x2d')][_0x947c('0x49')]({'where':{'id':_0x45dae1['params']['id']}})[_0x947c('0x15')](handleEntityNotFound(_0xd5c937,null))[_0x947c('0x15')](removeEntity(_0xd5c937,null))[_0x947c('0x1f')](handleError(_0xd5c937,null));};exports[_0x947c('0x4c')]=function(_0x4bcaaa,_0x518b5c){return db[_0x947c('0x2d')][_0x947c('0x4c')]()[_0x947c('0x15')](respondWithResult(_0x518b5c,null))['catch'](handleError(_0x518b5c,null));};exports[_0x947c('0x4d')]=function(_0x1ba7d7,_0x44b11d){return db[_0x947c('0x2d')][_0x947c('0x4d')](_0x1ba7d7[_0x947c('0x4b')])['then'](function(_0x35713b){if(_0x35713b){if(_0x35713b['direction']===_0x947c('0x4e')&&!_0x35713b[_0x947c('0x4f')]){var _0x705e12,_0x2e1bc2,_0x38bf72;if(_0x1ba7d7[_0x947c('0x4b')]['to']){_0x2e1bc2=_0x1ba7d7[_0x947c('0x4b')]['to'][_0x947c('0x50')](',')[0x0];}return db[_0x947c('0x51')][_0x947c('0x52')]({'where':{'id':_0x35713b['MailAccountId']},'include':[{'model':db[_0x947c('0x53')],'as':_0x947c('0x54'),'include':[{'model':db[_0x947c('0x55')],'as':_0x947c('0x56'),'where':{'email':_0x2e1bc2},'limit':0x1,'order':[[_0x947c('0x57'),'DESC']]}]},{'model':db[_0x947c('0x58')],'as':_0x947c('0x59'),'raw':!![],'include':[{'model':db[_0x947c('0x5a')],'as':_0x947c('0x5a'),'raw':!![]}]}]})[_0x947c('0x15')](function(_0x60e83f){_0x705e12=_0x60e83f;if(!_0x705e12||!_0x705e12[_0x947c('0x59')])return;var _0x1d4041=_0x705e12[_0x947c('0x5b')]();if(_0x1ba7d7[_0x947c('0x4b')][_0x947c('0x5c')]&&_0x1ba7d7[_0x947c('0x4b')]['attachments']['length']){for(var _0x75ec55=0x0;_0x75ec55<_0x1ba7d7[_0x947c('0x4b')][_0x947c('0x5c')][_0x947c('0x48')];_0x75ec55+=0x1){_0x1ba7d7[_0x947c('0x4b')][_0x947c('0x5c')][_0x75ec55]={'filename':_0x1ba7d7[_0x947c('0x4b')]['attachments'][_0x75ec55][_0x947c('0x29')],'path':path['join'](config[_0x947c('0x5d')],'server/files/attachments',_0x1ba7d7[_0x947c('0x4b')]['attachments'][_0x75ec55]['basename'])};}}_0x38bf72={'account':_0x1d4041,'message':_0x1ba7d7[_0x947c('0x4b')]};return;})[_0x947c('0x15')](function(){if(_0x705e12[_0x947c('0x54')]){if(_0x705e12[_0x947c('0x54')][_0x947c('0x56')]['length']){return _0x705e12[_0x947c('0x54')][_0x947c('0x56')][0x0];}else{return db[_0x947c('0x55')][_0x947c('0x4d')](_['defaults'](_0x1ba7d7[_0x947c('0x4b')],{'firstName':_0x1ba7d7[_0x947c('0x4b')]['to'],'email':_0x1ba7d7[_0x947c('0x4b')]['to'],'phone':_0x1ba7d7['body']['to'],'ListId':_0x705e12[_0x947c('0x5e')]}));}}else{throw new Error(_0x947c('0x5f'));}})[_0x947c('0x15')](function(){if(_0x38bf72){return respondWithRpcPromise(_0x947c('0x60'),_0x947c('0x61'),_0x38bf72,client9003)[_0x947c('0x15')](function(_0x306020){return _0x35713b['update']({'read':!![],'messageId':_0x306020[_0x947c('0x62')],'sentAt':moment()['format'](_0x947c('0x63'))});})[_0x947c('0x1f')](function(_0x18d78e){logger[_0x947c('0x1b')]('%s',JSON['stringify'](_0x18d78e));return _0x35713b;});}return _0x35713b;});}return _0x35713b;}})[_0x947c('0x15')](respondWithResult(_0x44b11d,0xc9))['catch'](handleError(_0x44b11d,null));};exports[_0x947c('0x64')]=function(_0x29a56a,_0xe0a6ed){var _0x9ae1c5=_0x947c('0x65');return interactionService[_0x947c('0x66')](_0x29a56a,_0x9ae1c5)[_0x947c('0x15')](respondWithResult(_0xe0a6ed,null))['catch'](handleError(_0xe0a6ed,null));};exports[_0x947c('0x67')]=function(_0x4f5d36,_0x4fc0b1){var _0x4221ed={'agent':{},'channel':_0x947c('0x65')};if(_0x4f5d36[_0x947c('0x4b')]['id']){delete _0x4f5d36['body']['id'];}_0x4f5d36[_0x947c('0x4b')][_0x947c('0x68')]=_0x4f5d36['body']['UserId']||_0x4f5d36[_0x947c('0x69')]['id'];_0x4221ed[_0x947c('0x6a')]['id']=_0x4f5d36['body'][_0x947c('0x68')];return db[_0x947c('0x2d')]['find']({'where':{'id':_0x4f5d36['params']['id'],'UserId':null}})[_0x947c('0x15')](handleEntityNotFound(_0x4fc0b1,null))[_0x947c('0x15')](function(_0x590103){if(_0x590103){_0x4221ed['message']=_0x590103[_0x947c('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x590103[_0x947c('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x4fc0b1,null))[_0x947c('0x15')](function(_0x4be54a){if(_0x4be54a){_0x4221ed[_0x947c('0x6d')]=_0x4be54a[_0x947c('0x6b')]({'plain':!![]});interaction_log[_0x947c('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4f5d36[_0x947c('0x69')]['id'],_0x4f5d36[_0x947c('0x69')][_0x947c('0x29')],_0x4f5d36[_0x947c('0x69')][_0x947c('0x6e')],_0x4221ed['interaction']['id'],_0x4f5d36['body']?JSON['stringify'](_0x4f5d36['body']):_0x947c('0x6f'));return respondWithRpcPromise(_0x947c('0x70'),_0x947c('0x71'),_0x4221ed);}return null;})['then'](function(_0x2a8b27){var _0x3ccac5=_0x947c('0x72')+_0x2a8b27[_0x947c('0x1d')][_0x947c('0x73')];return db['sequelize'][_0x947c('0x36')](_0x3ccac5,{'type':db[_0x947c('0x74')][_0x947c('0x75')][_0x947c('0x76')],'raw':!![]})[_0x947c('0x15')](function(_0x27f498){return _0x27f498;});})[_0x947c('0x15')](function(_0x35bb42){if(_0x35bb42){_0x4221ed[_0x947c('0x1d')][_0x947c('0x77')]=_0x35bb42[0x0];if(!_0x4f5d36['body'][_0x947c('0x68')])return;return db[_0x947c('0x78')][_0x947c('0x49')]({'where':{'id':_0x4f5d36[_0x947c('0x4b')][_0x947c('0x68')],'role':_0x947c('0x6a')},'attributes':['id',_0x947c('0x29'),_0x947c('0x79'),'email',_0x947c('0x7a')],'raw':!![]});}return null;})[_0x947c('0x15')](function(_0x388926){if(!_0x388926)return null;_0x4221ed[_0x947c('0x1d')][_0x947c('0x6a')]=_0x388926;return _0x4221ed;})[_0x947c('0x15')](function(_0x67244f){if(_0x67244f){_0x67244f['message'][_0x947c('0x7b')]=util[_0x947c('0x7c')](_0x947c('0x7d'),_0x4f5d36[_0x947c('0x69')]['name']);_0x67244f['message'][_0x947c('0x7e')]=_0x4221ed[_0x947c('0x7e')];_0x67244f[_0x947c('0x1d')][_0x947c('0x7f')]=_0x4221ed[_0x947c('0x7e')];_0x67244f[_0x947c('0x1d')][_0x947c('0x80')]=_0x947c('0x67');_0x67244f[_0x947c('0x1d')]['body']=htmlToText['fromString'](_0x4221ed[_0x947c('0x1d')][_0x947c('0x4b')]);respondWithRpcPromise(_0x947c('0x81'),_0x947c('0x81'),{'event':_0x947c('0x82'),'message':_0x67244f['message']},client9002);return _0x4221ed;}return null;})[_0x947c('0x15')](respondWithResult(_0x4fc0b1,null))[_0x947c('0x1f')](handleError(_0x4fc0b1,null));};exports[_0x947c('0x83')]=function(_0x10a3e4,_0x28e007){var _0x3f614f=moment()['unix']()[_0x947c('0x84')]();var _0x110be5=path[_0x947c('0x85')](config[_0x947c('0x5d')],'server',_0x947c('0x86'),_0x947c('0x87'));var _0x27732a=path['join'](config[_0x947c('0x5d')],_0x947c('0x88'),_0x947c('0x86'),'attachments');var _0x19d61d=util[_0x947c('0x7c')](_0x947c('0x89'),_0x3f614f);return db[_0x947c('0x2d')][_0x947c('0x49')]({'where':{'id':_0x10a3e4[_0x947c('0x47')]['id']},'attributes':['id',_0x947c('0x4b'),_0x947c('0x8a'),'to','cc','bcc',_0x947c('0x8b'),'createdAt'],'include':_0x10a3e4[_0x947c('0x36')][_0x947c('0x5c')]?[{'model':db[_0x947c('0x8c')],'as':_0x947c('0x8d')}]:undefined})['then'](handleEntityNotFound(_0x28e007,null))[_0x947c('0x15')](function(_0x55e283){if(_0x55e283){var _0x28636a=_0x55e283;var _0x21bf05={'from':_0x28636a[_0x947c('0x8a')],'to':_0x28636a['to'],'subject':_0x28636a[_0x947c('0x8b')],'html':htmlEntities[_0x947c('0x8e')](_0x28636a[_0x947c('0x4b')]),'headers':{'Date':moment(_0x28636a[_0x947c('0x8f')])[_0x947c('0x7c')](_0x947c('0x90'))},'attachments':[]};if(_0x55e283['cc']){_0x21bf05[_0x947c('0x91')]['Cc']=_0x55e283['cc'];}if(_0x55e283[_0x947c('0x92')]){_0x21bf05[_0x947c('0x91')][_0x947c('0x93')]=_0x55e283['bcc'];}return new Promise(function(_0x10233d,_0x477346){if(_0x55e283[_0x947c('0x8d')]){for(var _0x956faa=0x0;_0x956faa<_0x55e283['Attachments']['length'];_0x956faa++){var _0x5ae352=_0x55e283[_0x947c('0x8d')][_0x956faa];var _0x1698e8=path[_0x947c('0x85')](_0x27732a,_0x5ae352[_0x947c('0x94')]);if(fs['existsSync'](_0x1698e8)){_0x21bf05[_0x947c('0x5c')][_0x947c('0x95')]({'name':_0x5ae352[_0x947c('0x29')],'contentType':_0x5ae352[_0x947c('0x30')],'data':fs[_0x947c('0x96')](_0x1698e8)});}}}emlformat[_0x947c('0x97')](_0x21bf05,function(_0x39788c,_0x1d2b45){if(_0x39788c)return _0x477346(_0x39788c);fs['writeFileSync'](path[_0x947c('0x85')](_0x110be5,_0x19d61d),_0x1d2b45);return _0x10233d(_0x1d2b45);});});}})['then'](function(_0x5b64b5){if(_0x5b64b5){return _0x28e007[_0x947c('0x83')](path[_0x947c('0x85')](_0x110be5,_0x19d61d),_0x19d61d,function(_0xd13269){if(!_0xd13269)fs['unlinkSync'](path[_0x947c('0x85')](_0x110be5,_0x19d61d));});}})['catch'](handleError(_0x28e007,null));}; \ No newline at end of file +var _0x2cfa=['filters','pick','filter','merge','options','include','findAll','params','includeAll','find','catch','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','root','server/files/attachments','basename','Contacts','defaults','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','reject','UserId','user','agent','get','MailInteraction','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','fromString','EventManager','rejectmessage','download','unix','toString','server','tmp','join','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','moment','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','redis','socket.io-emitter','html-entities','register','jayson/promise','client','http','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x41ed37,_0xbcd1d4){var _0x13f7ea=function(_0x270235){while(--_0x270235){_0x41ed37['push'](_0x41ed37['shift']());}};_0x13f7ea(++_0xbcd1d4);}(_0x2cfa,0xe7));var _0xa2cf=function(_0x407d57,_0xc7e784){_0x407d57=_0x407d57-0x0;var _0x16a22b=_0x2cfa[_0x407d57];return _0x16a22b;};'use strict';var emlformat=require('eml-format');var moment=require(_0xa2cf('0x0'));var util=require('util');var path=require(_0xa2cf('0x1'));var fs=require('fs');var _=require(_0xa2cf('0x2'));var Redis=require(_0xa2cf('0x3'));var htmlToText=require(_0xa2cf('0x4'));var interactionService=require('../../components/interaction/service');var qs=require(_0xa2cf('0x5'));var logger=require(_0xa2cf('0x6'))(_0xa2cf('0x7'));var interaction_log=require(_0xa2cf('0x6'))(_0xa2cf('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa2cf('0x9')]=_['defaults'](config[_0xa2cf('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2cf('0xa'))(new Redis(config[_0xa2cf('0x9')]));var htmlEntities=require(_0xa2cf('0xb'));require('./mailMessage.socket')[_0xa2cf('0xc')](socket);var jayson=require(_0xa2cf('0xd'));var client=jayson[_0xa2cf('0xe')][_0xa2cf('0xf')]({'port':0x232c});var client9003=jayson[_0xa2cf('0xe')][_0xa2cf('0xf')]({'port':0x232b});var client9002=jayson[_0xa2cf('0xe')][_0xa2cf('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x2c17b6,_0x37fccd,_0x4cb700,_0x2edce1){return new Promise(function(_0xaab3d4,_0x4cf458){var _0xdf1260=_0x2edce1||client;return _0xdf1260['request'](_0x2c17b6,_0x4cb700)['then'](function(_0x2c63e2){logger['info'](_0xa2cf('0x10'),_0x37fccd,_0xa2cf('0x11'));logger['debug'](_0xa2cf('0x12'),_0x37fccd,_0xa2cf('0x11'),JSON[_0xa2cf('0x13')](_0x2c63e2));if(_0x2c63e2[_0xa2cf('0x14')]){if(_0x2c63e2[_0xa2cf('0x14')][_0xa2cf('0x15')]===0x1f4){logger[_0xa2cf('0x14')](_0xa2cf('0x10'),_0x37fccd,_0x2c63e2[_0xa2cf('0x14')][_0xa2cf('0x16')]);return _0x4cf458(_0x2c63e2['error'][_0xa2cf('0x16')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x37fccd,_0x2c63e2['error'][_0xa2cf('0x16')]);return _0xaab3d4(_0x2c63e2['error']['message']);}else{logger['info'](_0xa2cf('0x10'),_0x37fccd,_0xa2cf('0x11'));_0xaab3d4(_0x2c63e2['result'][_0xa2cf('0x16')]);}})['catch'](function(_0x85313c){logger[_0xa2cf('0x14')](_0xa2cf('0x10'),_0x37fccd,_0x85313c);_0x4cf458(_0x85313c);});});}function respondWithResult(_0x4a7997,_0x5f0e37){_0x5f0e37=_0x5f0e37||0xc8;return function(_0x49720f){if(_0x49720f){return _0x4a7997['status'](_0x5f0e37)[_0xa2cf('0x17')](_0x49720f);}};}function respondWithFilteredResult(_0x4a810c,_0x4a4d1b){return function(_0x3fa6e2){if(_0x3fa6e2){var _0x52771c=typeof _0x4a4d1b[_0xa2cf('0x18')]===_0xa2cf('0x19')&&typeof _0x4a4d1b[_0xa2cf('0x1a')]==='undefined';var _0x1151a2=_0x3fa6e2[_0xa2cf('0x1b')];var _0x4b6386=_0x52771c?0x0:_0x4a4d1b[_0xa2cf('0x18')];var _0x2976eb=_0x52771c?_0x3fa6e2['count']:_0x4a4d1b[_0xa2cf('0x18')]+_0x4a4d1b[_0xa2cf('0x1a')];var _0x37e6c0;if(_0x2976eb>=_0x1151a2){_0x2976eb=_0x1151a2;_0x37e6c0=0xc8;}else{_0x37e6c0=0xce;}_0x4a810c[_0xa2cf('0x1c')](_0x37e6c0);return _0x4a810c[_0xa2cf('0x1d')](_0xa2cf('0x1e'),_0x4b6386+'-'+_0x2976eb+'/'+_0x1151a2)[_0xa2cf('0x17')](_0x3fa6e2);}return null;};}function saveUpdates(_0x5dc878){return function(_0x4786e5){if(_0x4786e5){return _0x4786e5[_0xa2cf('0x1f')](_0x5dc878)[_0xa2cf('0x20')](function(_0x99ae8c){return _0x99ae8c;});}return null;};}function removeEntity(_0x1b0835){return function(_0x4774f8){if(_0x4774f8){return _0x4774f8[_0xa2cf('0x21')]()[_0xa2cf('0x20')](function(){_0x1b0835[_0xa2cf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426cd9){return function(_0x4eb310){if(!_0x4eb310){_0x426cd9['sendStatus'](0x194);}return _0x4eb310;};}function handleError(_0x47d372,_0x1331f3){_0x1331f3=_0x1331f3||0x1f4;return function(_0x9bc350){logger[_0xa2cf('0x14')](_0x9bc350['stack']);if(_0x9bc350[_0xa2cf('0x22')]){delete _0x9bc350[_0xa2cf('0x22')];}_0x47d372['status'](_0x1331f3)[_0xa2cf('0x23')](_0x9bc350);};}exports[_0xa2cf('0x24')]=function(_0x58c4d0,_0x37bb49){var _0x32f1d5={},_0x100bcf={},_0x47fe4e={'count':0x0,'rows':[]};var _0xefb8b9=_[_0xa2cf('0x25')](db[_0xa2cf('0x26')][_0xa2cf('0x27')],function(_0x1c00da){return{'name':_0x1c00da[_0xa2cf('0x28')],'type':_0x1c00da[_0xa2cf('0x29')][_0xa2cf('0x2a')]};});_0x100bcf[_0xa2cf('0x2b')]=_[_0xa2cf('0x25')](_0xefb8b9,_0xa2cf('0x22'));_0x100bcf['query']=_[_0xa2cf('0x2c')](_0x58c4d0[_0xa2cf('0x2d')]);_0x100bcf['filters']=_[_0xa2cf('0x2e')](_0x100bcf['model'],_0x100bcf[_0xa2cf('0x2d')]);_0x32f1d5[_0xa2cf('0x2f')]=_[_0xa2cf('0x2e')](_0x100bcf[_0xa2cf('0x2b')],qs[_0xa2cf('0x30')](_0x58c4d0['query'][_0xa2cf('0x30')]));_0x32f1d5[_0xa2cf('0x2f')]=_0x32f1d5[_0xa2cf('0x2f')][_0xa2cf('0x31')]?_0x32f1d5[_0xa2cf('0x2f')]:_0x100bcf[_0xa2cf('0x2b')];if(!_0x58c4d0[_0xa2cf('0x2d')][_0xa2cf('0x32')](_0xa2cf('0x33'))){_0x32f1d5[_0xa2cf('0x1a')]=qs[_0xa2cf('0x1a')](_0x58c4d0[_0xa2cf('0x2d')][_0xa2cf('0x1a')]);_0x32f1d5[_0xa2cf('0x18')]=qs[_0xa2cf('0x18')](_0x58c4d0[_0xa2cf('0x2d')][_0xa2cf('0x18')]);}_0x32f1d5[_0xa2cf('0x34')]=qs[_0xa2cf('0x35')](_0x58c4d0[_0xa2cf('0x2d')][_0xa2cf('0x35')]);_0x32f1d5[_0xa2cf('0x36')]=qs[_0xa2cf('0x37')](_[_0xa2cf('0x38')](_0x58c4d0[_0xa2cf('0x2d')],_0x100bcf[_0xa2cf('0x37')]),_0xefb8b9);if(_0x58c4d0['query'][_0xa2cf('0x39')]){_0x32f1d5['where']=_[_0xa2cf('0x3a')](_0x32f1d5[_0xa2cf('0x36')],{'$or':_[_0xa2cf('0x25')](_0xefb8b9,function(_0x3f4b85){if(_0x3f4b85[_0xa2cf('0x29')]!=='VIRTUAL'){var _0x131197={};_0x131197[_0x3f4b85['name']]={'$like':'%'+_0x58c4d0['query'][_0xa2cf('0x39')]+'%'};return _0x131197;}})});}_0x32f1d5=_[_0xa2cf('0x3a')]({},_0x32f1d5,_0x58c4d0[_0xa2cf('0x3b')]);var _0x1cb64d={'where':_0x32f1d5[_0xa2cf('0x36')]};return db[_0xa2cf('0x26')][_0xa2cf('0x1b')](_0x1cb64d)[_0xa2cf('0x20')](function(_0x5b0f4a){_0x47fe4e[_0xa2cf('0x1b')]=_0x5b0f4a;if(_0x58c4d0['query']['includeAll']){_0x32f1d5[_0xa2cf('0x3c')]=[{'all':!![]}];}return db[_0xa2cf('0x26')][_0xa2cf('0x3d')](_0x32f1d5);})[_0xa2cf('0x20')](function(_0x4882cf){_0x47fe4e['rows']=_0x4882cf;return _0x47fe4e;})[_0xa2cf('0x20')](respondWithFilteredResult(_0x37bb49,_0x32f1d5))['catch'](handleError(_0x37bb49,null));};exports['show']=function(_0x22f547,_0x1f46c9){var _0x8a44c6={'raw':!![],'where':{'id':_0x22f547[_0xa2cf('0x3e')]['id']}},_0x14effc={};_0x14effc['model']=_[_0xa2cf('0x2c')](db[_0xa2cf('0x26')][_0xa2cf('0x27')]);_0x14effc['query']=_[_0xa2cf('0x2c')](_0x22f547[_0xa2cf('0x2d')]);_0x14effc['filters']=_[_0xa2cf('0x2e')](_0x14effc[_0xa2cf('0x2b')],_0x14effc[_0xa2cf('0x2d')]);_0x8a44c6['attributes']=_[_0xa2cf('0x2e')](_0x14effc[_0xa2cf('0x2b')],qs[_0xa2cf('0x30')](_0x22f547[_0xa2cf('0x2d')][_0xa2cf('0x30')]));_0x8a44c6[_0xa2cf('0x2f')]=_0x8a44c6['attributes'][_0xa2cf('0x31')]?_0x8a44c6[_0xa2cf('0x2f')]:_0x14effc[_0xa2cf('0x2b')];if(_0x22f547['query'][_0xa2cf('0x3f')]){_0x8a44c6[_0xa2cf('0x3c')]=[{'all':!![]}];}_0x8a44c6=_[_0xa2cf('0x3a')]({},_0x8a44c6,_0x22f547[_0xa2cf('0x3b')]);return db[_0xa2cf('0x26')][_0xa2cf('0x40')](_0x8a44c6)['then'](handleEntityNotFound(_0x1f46c9,null))[_0xa2cf('0x20')](respondWithResult(_0x1f46c9,null))[_0xa2cf('0x41')](handleError(_0x1f46c9,null));};exports['update']=function(_0x32f229,_0x2c68f0){if(_0x32f229[_0xa2cf('0x42')]['id']){delete _0x32f229['body']['id'];}return db[_0xa2cf('0x26')][_0xa2cf('0x40')]({'where':{'id':_0x32f229[_0xa2cf('0x3e')]['id']}})[_0xa2cf('0x20')](handleEntityNotFound(_0x2c68f0,null))[_0xa2cf('0x20')](saveUpdates(_0x32f229[_0xa2cf('0x42')],null))[_0xa2cf('0x20')](respondWithResult(_0x2c68f0,null))[_0xa2cf('0x41')](handleError(_0x2c68f0,null));};exports[_0xa2cf('0x21')]=function(_0x3512f7,_0x5afc5b){return db[_0xa2cf('0x26')]['find']({'where':{'id':_0x3512f7[_0xa2cf('0x3e')]['id']}})[_0xa2cf('0x20')](handleEntityNotFound(_0x5afc5b,null))[_0xa2cf('0x20')](removeEntity(_0x5afc5b,null))[_0xa2cf('0x41')](handleError(_0x5afc5b,null));};exports[_0xa2cf('0x43')]=function(_0x2d05dd,_0x2ccc47){return db[_0xa2cf('0x26')][_0xa2cf('0x43')]()[_0xa2cf('0x20')](respondWithResult(_0x2ccc47,null))[_0xa2cf('0x41')](handleError(_0x2ccc47,null));};exports[_0xa2cf('0x44')]=function(_0x292fee,_0xb9a4da){return db[_0xa2cf('0x26')][_0xa2cf('0x44')](_0x292fee[_0xa2cf('0x42')])[_0xa2cf('0x20')](function(_0x42d029){if(_0x42d029){if(_0x42d029[_0xa2cf('0x45')]===_0xa2cf('0x46')&&!_0x42d029[_0xa2cf('0x47')]){var _0x4494b4,_0x567699,_0x3a9bc2;if(_0x292fee['body']['to']){_0x567699=_0x292fee[_0xa2cf('0x42')]['to'][_0xa2cf('0x48')](',')[0x0];}return db['MailAccount'][_0xa2cf('0x49')]({'where':{'id':_0x42d029[_0xa2cf('0x4a')]},'include':[{'model':db[_0xa2cf('0x4b')],'as':_0xa2cf('0x4c'),'include':[{'model':db[_0xa2cf('0x4d')],'as':'Contacts','where':{'email':_0x567699},'limit':0x1,'order':[[_0xa2cf('0x4e'),_0xa2cf('0x4f')]]}]},{'model':db[_0xa2cf('0x50')],'as':_0xa2cf('0x51'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa2cf('0x52'),'raw':!![]}]}]})[_0xa2cf('0x20')](function(_0x33709a){_0x4494b4=_0x33709a;if(!_0x4494b4||!_0x4494b4[_0xa2cf('0x51')])return;var _0xba4213=_0x4494b4['getSmtpOptions']();if(_0x292fee['body']['attachments']&&_0x292fee[_0xa2cf('0x42')]['attachments'][_0xa2cf('0x31')]){for(var _0x3ca82=0x0;_0x3ca82<_0x292fee[_0xa2cf('0x42')][_0xa2cf('0x53')]['length'];_0x3ca82+=0x1){_0x292fee[_0xa2cf('0x42')]['attachments'][_0x3ca82]={'filename':_0x292fee['body'][_0xa2cf('0x53')][_0x3ca82][_0xa2cf('0x22')],'path':path['join'](config[_0xa2cf('0x54')],_0xa2cf('0x55'),_0x292fee[_0xa2cf('0x42')][_0xa2cf('0x53')][_0x3ca82][_0xa2cf('0x56')])};}}_0x3a9bc2={'account':_0xba4213,'message':_0x292fee[_0xa2cf('0x42')]};return;})[_0xa2cf('0x20')](function(){if(_0x4494b4[_0xa2cf('0x4c')]){if(_0x4494b4[_0xa2cf('0x4c')][_0xa2cf('0x57')]['length']){return _0x4494b4['List'][_0xa2cf('0x57')][0x0];}else{return db[_0xa2cf('0x4d')][_0xa2cf('0x44')](_[_0xa2cf('0x58')](_0x292fee['body'],{'firstName':_0x292fee[_0xa2cf('0x42')]['to'],'email':_0x292fee['body']['to'],'phone':_0x292fee['body']['to'],'ListId':_0x4494b4[_0xa2cf('0x59')]}));}}else{throw new Error(_0xa2cf('0x5a'));}})[_0xa2cf('0x20')](function(){if(_0x3a9bc2){return respondWithRpcPromise(_0xa2cf('0x5b'),'sendMail',_0x3a9bc2,client9003)[_0xa2cf('0x20')](function(_0x31c5c0){return _0x42d029[_0xa2cf('0x1f')]({'read':!![],'messageId':_0x31c5c0[_0xa2cf('0x5c')],'sentAt':moment()['format'](_0xa2cf('0x5d'))});})[_0xa2cf('0x41')](function(_0xa4a616){logger[_0xa2cf('0x14')]('%s',JSON[_0xa2cf('0x13')](_0xa4a616));return _0x42d029;});}return _0x42d029;});}return _0x42d029;}})[_0xa2cf('0x20')](respondWithResult(_0xb9a4da,0xc9))[_0xa2cf('0x41')](handleError(_0xb9a4da,null));};exports[_0xa2cf('0x5e')]=function(_0x461e8f,_0x4fb11b){var _0xe46557='mail';return interactionService['acceptMessage'](_0x461e8f,_0xe46557)[_0xa2cf('0x20')](respondWithResult(_0x4fb11b,null))[_0xa2cf('0x41')](handleError(_0x4fb11b,null));};exports[_0xa2cf('0x5f')]=function(_0x56e43,_0x5eb449){var _0x4affbb={'agent':{},'channel':'mail'};if(_0x56e43[_0xa2cf('0x42')]['id']){delete _0x56e43['body']['id'];}_0x56e43[_0xa2cf('0x42')][_0xa2cf('0x60')]=_0x56e43[_0xa2cf('0x42')][_0xa2cf('0x60')]||_0x56e43[_0xa2cf('0x61')]['id'];_0x4affbb[_0xa2cf('0x62')]['id']=_0x56e43['body'][_0xa2cf('0x60')];return db[_0xa2cf('0x26')][_0xa2cf('0x40')]({'where':{'id':_0x56e43[_0xa2cf('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5eb449,null))[_0xa2cf('0x20')](function(_0x3326a0){if(_0x3326a0){_0x4affbb[_0xa2cf('0x16')]=_0x3326a0[_0xa2cf('0x63')]({'plain':!![]});return db[_0xa2cf('0x64')][_0xa2cf('0x40')]({'where':{'id':_0x3326a0['MailInteractionId']}});}return null;})[_0xa2cf('0x20')](handleEntityNotFound(_0x5eb449,null))['then'](function(_0x2a3e4c){if(_0x2a3e4c){_0x4affbb[_0xa2cf('0x65')]=_0x2a3e4c[_0xa2cf('0x63')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56e43[_0xa2cf('0x61')]['id'],_0x56e43['user'][_0xa2cf('0x22')],_0x56e43[_0xa2cf('0x61')][_0xa2cf('0x66')],_0x4affbb[_0xa2cf('0x65')]['id'],_0x56e43[_0xa2cf('0x42')]?JSON[_0xa2cf('0x13')](_0x56e43[_0xa2cf('0x42')]):_0xa2cf('0x67'));return respondWithRpcPromise(_0xa2cf('0x68'),_0xa2cf('0x69'),_0x4affbb);}return null;})[_0xa2cf('0x20')](function(_0x5ea498){var _0x645e01=_0xa2cf('0x6a')+_0x5ea498['message']['ContactId'];return db[_0xa2cf('0x6b')][_0xa2cf('0x2d')](_0x645e01,{'type':db[_0xa2cf('0x6c')][_0xa2cf('0x6d')][_0xa2cf('0x6e')],'raw':!![]})[_0xa2cf('0x20')](function(_0x33448e){return _0x33448e;});})['then'](function(_0x2eef24){if(_0x2eef24){_0x4affbb[_0xa2cf('0x16')][_0xa2cf('0x6f')]=_0x2eef24[0x0];if(!_0x56e43[_0xa2cf('0x42')][_0xa2cf('0x60')])return;return db[_0xa2cf('0x70')][_0xa2cf('0x40')]({'where':{'id':_0x56e43['body'][_0xa2cf('0x60')],'role':_0xa2cf('0x62')},'attributes':['id',_0xa2cf('0x22'),_0xa2cf('0x71'),'email',_0xa2cf('0x72')],'raw':!![]});}return null;})[_0xa2cf('0x20')](function(_0x4bd255){if(!_0x4bd255)return null;_0x4affbb[_0xa2cf('0x16')][_0xa2cf('0x62')]=_0x4bd255;return _0x4affbb;})['then'](function(_0x7b7396){if(_0x7b7396){_0x7b7396[_0xa2cf('0x16')][_0xa2cf('0x73')]=util[_0xa2cf('0x74')](_0xa2cf('0x75'),_0x56e43['user'][_0xa2cf('0x22')]);_0x7b7396[_0xa2cf('0x16')][_0xa2cf('0x76')]=_0x4affbb[_0xa2cf('0x76')];_0x7b7396[_0xa2cf('0x16')]['motionChannel']=_0x4affbb['channel'];_0x7b7396[_0xa2cf('0x16')]['event']=_0xa2cf('0x5f');_0x7b7396['message']['body']=htmlToText[_0xa2cf('0x77')](_0x4affbb[_0xa2cf('0x16')]['body']);respondWithRpcPromise('EventManager',_0xa2cf('0x78'),{'event':_0xa2cf('0x79'),'message':_0x7b7396['message']},client9002);return _0x4affbb;}return null;})[_0xa2cf('0x20')](respondWithResult(_0x5eb449,null))[_0xa2cf('0x41')](handleError(_0x5eb449,null));};exports[_0xa2cf('0x7a')]=function(_0x7dba2c,_0x3286fb){var _0x23a027=moment()[_0xa2cf('0x7b')]()[_0xa2cf('0x7c')]();var _0x2a181f=path['join'](config['root'],_0xa2cf('0x7d'),'files',_0xa2cf('0x7e'));var _0x2640f7=path[_0xa2cf('0x7f')](config['root'],'server','files',_0xa2cf('0x53'));var _0x54b230=util[_0xa2cf('0x74')](_0xa2cf('0x80'),_0x23a027);return db[_0xa2cf('0x26')]['find']({'where':{'id':_0x7dba2c[_0xa2cf('0x3e')]['id']},'attributes':['id','body',_0xa2cf('0x81'),'to','cc',_0xa2cf('0x82'),'subject',_0xa2cf('0x83')],'include':_0x7dba2c[_0xa2cf('0x2d')]['attachments']?[{'model':db[_0xa2cf('0x84')],'as':_0xa2cf('0x85')}]:undefined})[_0xa2cf('0x20')](handleEntityNotFound(_0x3286fb,null))[_0xa2cf('0x20')](function(_0x5c6f2a){if(_0x5c6f2a){var _0x511a68=_0x5c6f2a;var _0x34a62d={'from':_0x511a68[_0xa2cf('0x81')],'to':_0x511a68['to'],'subject':_0x511a68[_0xa2cf('0x86')],'html':htmlEntities['decode'](_0x511a68['body']),'headers':{'Date':moment(_0x511a68['createdAt'])[_0xa2cf('0x74')](_0xa2cf('0x87'))},'attachments':[]};if(_0x5c6f2a['cc']){_0x34a62d[_0xa2cf('0x88')]['Cc']=_0x5c6f2a['cc'];}if(_0x5c6f2a[_0xa2cf('0x82')]){_0x34a62d[_0xa2cf('0x88')][_0xa2cf('0x89')]=_0x5c6f2a[_0xa2cf('0x82')];}return new Promise(function(_0x291c49,_0x18dede){if(_0x5c6f2a['Attachments']){for(var _0x17418d=0x0;_0x17418d<_0x5c6f2a['Attachments'][_0xa2cf('0x31')];_0x17418d++){var _0x25f1dc=_0x5c6f2a['Attachments'][_0x17418d];var _0x5f3a68=path[_0xa2cf('0x7f')](_0x2640f7,_0x25f1dc[_0xa2cf('0x56')]);if(fs[_0xa2cf('0x8a')](_0x5f3a68)){_0x34a62d[_0xa2cf('0x53')]['push']({'name':_0x25f1dc[_0xa2cf('0x22')],'contentType':_0x25f1dc[_0xa2cf('0x29')],'data':fs[_0xa2cf('0x8b')](_0x5f3a68)});}}}emlformat[_0xa2cf('0x8c')](_0x34a62d,function(_0x401dfc,_0x8e9f9){if(_0x401dfc)return _0x18dede(_0x401dfc);fs[_0xa2cf('0x8d')](path['join'](_0x2a181f,_0x54b230),_0x8e9f9);return _0x291c49(_0x8e9f9);});});}})[_0xa2cf('0x20')](function(_0x3005b9){if(_0x3005b9){return _0x3286fb['download'](path['join'](_0x2a181f,_0x54b230),_0x54b230,function(_0x3da289){if(!_0x3da289)fs[_0xa2cf('0x8e')](path[_0xa2cf('0x7f')](_0x2a181f,_0x54b230));});}})[_0xa2cf('0x41')](handleError(_0x3286fb,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f685479..5f5a25b 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 _0x7e3a=['hasOwnProperty','hook','events','../../mysqldb','MailMessage','emit'];(function(_0x54b3dc,_0x1ed446){var _0x5f98eb=function(_0x11edf4){while(--_0x11edf4){_0x54b3dc['push'](_0x54b3dc['shift']());}};_0x5f98eb(++_0x1ed446);}(_0x7e3a,0x1e2));var _0xa7e3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7e3a[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xa7e3('0x0'));var MailMessage=require(_0xa7e3('0x1'))['db'][_0xa7e3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9b9323){return function(_0x93d632,_0x51513f,_0x4800a4){MailMessageEvents[_0xa7e3('0x3')](_0x9b9323+':'+_0x93d632['id'],_0x93d632);MailMessageEvents[_0xa7e3('0x3')](_0x9b9323,_0x93d632);_0x4800a4(null);};}for(var e in events){if(events[_0xa7e3('0x4')](e)){var event=events[e];MailMessage[_0xa7e3('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x8f7b=['update','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x5bf6de,_0x5ab993){var _0x549c15=function(_0x279d0c){while(--_0x279d0c){_0x5bf6de['push'](_0x5bf6de['shift']());}};_0x549c15(++_0x5ab993);}(_0x8f7b,0x11b));var _0xb8f7=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8f7b[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require(_0xb8f7('0x0'));var MailMessage=require(_0xb8f7('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb8f7('0x2')](0x0);var events={'afterCreate':_0xb8f7('0x3'),'afterUpdate':_0xb8f7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58c20d){return function(_0xf8739a,_0x3ac5ba,_0x476ff5){MailMessageEvents['emit'](_0x58c20d+':'+_0xf8739a['id'],_0xf8739a);MailMessageEvents['emit'](_0x58c20d,_0xf8739a);_0x476ff5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xb8f7('0x5')](e,emitEvent(event));}}module[_0xb8f7('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 403cd09..bc48ec6 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 _0x9048=['plainBody','subject','FULLTEXT','fromString','body','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages'];(function(_0xc4750f,_0x17af16){var _0x16d2a4=function(_0x2db608){while(--_0x2db608){_0xc4750f['push'](_0xc4750f['shift']());}};_0x16d2a4(++_0x17af16);}(_0x9048,0x15d));var _0x8904=function(_0x5a881b,_0x1a843b){_0x5a881b=_0x5a881b-0x0;var _0x5c648b=_0x9048[_0x5a881b];return _0x5c648b;};'use strict';var _=require(_0x8904('0x0'));var util=require('util');var logger=require(_0x8904('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8904('0x2'));var htmlToText=require(_0x8904('0x3'));var fs=require('fs');var path=require(_0x8904('0x4'));var rimraf=require(_0x8904('0x5'));var config=require(_0x8904('0x6'));var attributes=require(_0x8904('0x7'));module[_0x8904('0x8')]=function(_0x43bf3f,_0x3abfa5){return _0x43bf3f[_0x8904('0x9')](_0x8904('0xa'),attributes,{'tableName':_0x8904('0xb'),'paranoid':![],'indexes':[{'name':_0x8904('0xc'),'fields':[_0x8904('0xc')]},{'name':_0x8904('0xd'),'fields':[_0x8904('0xe'),_0x8904('0xf')],'type':_0x8904('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49475d,_0x291c06,_0x3d7611){if(_0x49475d['body']){_0x49475d[_0x8904('0xe')]=htmlToText[_0x8904('0x11')](_0x49475d[_0x8904('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3d7611(null,_0x291c06);},'afterCreate':function(_0x451ee0,_0x15be30,_0x256acd){var _0x17f5b1=_0x43bf3f[_0x8904('0x13')];var _0x21a92b=_0x451ee0['get']({'plain':!![]});if(_0x21a92b['direction']['toLowerCase']()==='in'||_0x21a92b[_0x8904('0x14')][_0x8904('0x15')]()==='out'&&!_0x21a92b[_0x8904('0x16')]&&!_[_0x8904('0x17')](_0x21a92b[_0x8904('0x18')])){_0x17f5b1[_0x8904('0x19')][_0x8904('0x1a')]({'where':{'id':_0x21a92b[_0x8904('0x1b')]}})['then'](function(_0x5b0e08){if(_0x5b0e08){_0x5b0e08[_0x8904('0x1c')]({'lastMsgAt':_0x21a92b[_0x8904('0x1d')],'lastMsgDirection':_0x21a92b['direction']['toLowerCase']()});}})[_0x8904('0x1e')](function(_0x4b1611){console['error'](_0x4b1611);});}_0x256acd();}},'charset':_0x8904('0x1f'),'collate':_0x8904('0x20')});}; \ No newline at end of file +var _0x2624=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','createdAt','catch','error','lodash','util'];(function(_0x2ec4f5,_0x17dc9){var _0x2bb5d7=function(_0x9d386){while(--_0x9d386){_0x2ec4f5['push'](_0x2ec4f5['shift']());}};_0x2bb5d7(++_0x17dc9);}(_0x2624,0x166));var _0x4262=function(_0x105d97,_0x28a877){_0x105d97=_0x105d97-0x0;var _0x5a5020=_0x2624[_0x105d97];return _0x5a5020;};'use strict';var _=require(_0x4262('0x0'));var util=require(_0x4262('0x1'));var logger=require(_0x4262('0x2'))('api');var moment=require(_0x4262('0x3'));var BPromise=require(_0x4262('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x4262('0x5'));var rimraf=require(_0x4262('0x6'));var config=require(_0x4262('0x7'));var attributes=require(_0x4262('0x8'));module[_0x4262('0x9')]=function(_0x3fcf05,_0x15a8bb){return _0x3fcf05['define'](_0x4262('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x4262('0xb'),'fields':[_0x4262('0xb')]},{'name':_0x4262('0xc'),'fields':[_0x4262('0xd'),_0x4262('0xe')],'type':_0x4262('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e4188,_0x3637da,_0x5946e0){if(_0x4e4188[_0x4262('0x10')]){_0x4e4188[_0x4262('0xd')]=htmlToText[_0x4262('0x11')](_0x4e4188[_0x4262('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5946e0(null,_0x3637da);},'afterCreate':function(_0x3d6588,_0x517aff,_0x777ce1){var _0x5da193=_0x3fcf05[_0x4262('0x12')];var _0x556d78=_0x3d6588[_0x4262('0x13')]({'plain':!![]});if(_0x556d78[_0x4262('0x14')][_0x4262('0x15')]()==='in'||_0x556d78['direction']['toLowerCase']()===_0x4262('0x16')&&!_0x556d78['secret']&&!_[_0x4262('0x17')](_0x556d78[_0x4262('0x18')])){_0x5da193['MailInteraction'][_0x4262('0x19')]({'where':{'id':_0x556d78[_0x4262('0x1a')]}})['then'](function(_0x4b0702){if(_0x4b0702){_0x4b0702['update']({'lastMsgAt':_0x556d78[_0x4262('0x1b')],'lastMsgDirection':_0x556d78[_0x4262('0x14')]['toLowerCase']()});}})[_0x4262('0x1c')](function(_0x55fc32){console[_0x4262('0x1d')](_0x55fc32);});}_0x777ce1();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f622aac..b07d78b 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 _0x6a95=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','MailMessage,\x20%s,\x20%s','debug'];(function(_0x43a656,_0x8c7b6e){var _0x17d36d=function(_0xa659d){while(--_0xa659d){_0x43a656['push'](_0x43a656['shift']());}};_0x17d36d(++_0x8c7b6e);}(_0x6a95,0x1db));var _0x56a9=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6a95[_0x33032e];return _0x13316b;};'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});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./mailMessage.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['MailMessage'][_0x56a9('0x1d')](_0x335cc3[_0x56a9('0x1e')],{'raw':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x56a9('0x11')](function(_0x3355c4){logger[_0x56a9('0x20')](_0x56a9('0x1c'),_0x335cc3);logger['debug'](_0x56a9('0x1c'),_0x335cc3,JSON[_0x56a9('0x16')](_0x3355c4));_0x62f79f(_0x3355c4);})[_0x56a9('0x1b')](function(_0xd029f7){logger[_0x56a9('0x17')]('CreateMailMessage',_0xd029f7[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0xd029f7[_0x56a9('0x19')]));});});}; \ No newline at end of file +var _0x47c5=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailMessage','create','options','info','debug','CreateMailMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x57b301,_0x35caad){var _0x16d495=function(_0x2c541a){while(--_0x2c541a){_0x57b301['push'](_0x57b301['shift']());}};_0x16d495(++_0x35caad);}(_0x47c5,0x165));var _0x547c=function(_0x4dbc5d,_0x2d0a51){_0x4dbc5d=_0x4dbc5d-0x0;var _0x45b461=_0x47c5[_0x4dbc5d];return _0x45b461;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});}exports['CreateMailMessage']=function(_0x4511d3){var _0x41149f=this;return new Promise(function(_0x496c38,_0x5453f9){return db[_0x547c('0x1b')][_0x547c('0x1c')](_0x4511d3['body'],{'raw':_0x4511d3[_0x547c('0x1d')]?_0x4511d3[_0x547c('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x547c('0x12')](function(_0x17fd97){logger[_0x547c('0x1e')]('CreateMailMessage',_0x4511d3);logger[_0x547c('0x1f')](_0x547c('0x20'),_0x4511d3,JSON[_0x547c('0x16')](_0x17fd97));_0x496c38(_0x17fd97);})[_0x547c('0x21')](function(_0x1f3581){logger[_0x547c('0x17')](_0x547c('0x20'),_0x1f3581[_0x547c('0x19')],_0x4511d3);_0x5453f9(_0x41149f['error'](0x1f4,_0x1f3581[_0x547c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3493fa6..4f76a28 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 _0x4832=['emit','mailMessage:','./mailMessage.events','remove','update'];(function(_0x100d9d,_0x34ca06){var _0x290423=function(_0x258834){while(--_0x258834){_0x100d9d['push'](_0x100d9d['shift']());}};_0x290423(++_0x34ca06);}(_0x4832,0x183));var _0x2483=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x4832[_0x1488cd];return _0x63fa13;};'use strict';var MailMessageEvents=require(_0x2483('0x0'));var events=['save',_0x2483('0x1'),_0x2483('0x2')];function createListener(_0x50c1f0,_0x4a903f){return function(_0x33ad50){_0x4a903f[_0x2483('0x3')](_0x50c1f0,_0x33ad50);};}function removeListener(_0x31c83d,_0x27035f){return function(){MailMessageEvents['removeListener'](_0x31c83d,_0x27035f);};}exports['register']=function(_0x178e0a){for(var _0x3685e0=0x0,_0x1fdffb=events['length'];_0x3685e0<_0x1fdffb;_0x3685e0++){var _0x569731=events[_0x3685e0];var _0x4670b5=createListener(_0x2483('0x4')+_0x569731,_0x178e0a);MailMessageEvents['on'](_0x569731,_0x4670b5);}}; \ No newline at end of file +var _0x8d59=['emit','removeListener','register','length','mailMessage:','save','remove','update'];(function(_0x50145b,_0x288dc9){var _0x58d24f=function(_0x16a93f){while(--_0x16a93f){_0x50145b['push'](_0x50145b['shift']());}};_0x58d24f(++_0x288dc9);}(_0x8d59,0xa5));var _0x98d5=function(_0x2abfe4,_0xe6ba32){_0x2abfe4=_0x2abfe4-0x0;var _0x5cefb3=_0x8d59[_0x2abfe4];return _0x5cefb3;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x98d5('0x0'),_0x98d5('0x1'),_0x98d5('0x2')];function createListener(_0x592f5f,_0x3e2a1f){return function(_0x42b18f){_0x3e2a1f[_0x98d5('0x3')](_0x592f5f,_0x42b18f);};}function removeListener(_0x4f9228,_0x2ecc39){return function(){MailMessageEvents[_0x98d5('0x4')](_0x4f9228,_0x2ecc39);};}exports[_0x98d5('0x5')]=function(_0x48ca76){for(var _0x496602=0x0,_0x72678c=events[_0x98d5('0x6')];_0x496602<_0x72678c;_0x496602++){var _0x1206ad=events[_0x496602];var _0x4889ee=createListener(_0x98d5('0x7')+_0x1206ad,_0x48ca76);MailMessageEvents['on'](_0x1206ad,_0x4889ee);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d1b1fd5..92fbe0e 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 _0xdd1a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','addAgents','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path'];(function(_0x48c85d,_0x5c90b2){var _0x194214=function(_0x308964){while(--_0x308964){_0x48c85d['push'](_0x48c85d['shift']());}};_0x194214(++_0x5c90b2);}(_0xdd1a,0x185));var _0xadd1=function(_0x5b32b1,_0x32bff5){_0x5b32b1=_0x5b32b1-0x0;var _0x38e26f=_0xdd1a[_0x5b32b1];return _0x38e26f;};'use strict';var multer=require(_0xadd1('0x0'));var util=require(_0xadd1('0x1'));var path=require(_0xadd1('0x2'));var timeout=require(_0xadd1('0x3'));var express=require(_0xadd1('0x4'));var router=express['Router']();var fs_extra=require(_0xadd1('0x5'));var auth=require(_0xadd1('0x6'));var interaction=require(_0xadd1('0x7'));var config=require('../../config/environment');var controller=require(_0xadd1('0x8'));router[_0xadd1('0x9')]('/',auth[_0xadd1('0xa')](),controller['index']);router[_0xadd1('0x9')]('/describe',auth[_0xadd1('0xa')](),controller[_0xadd1('0xb')]);router[_0xadd1('0x9')](_0xadd1('0xc'),auth['isAuthenticated'](),controller[_0xadd1('0xd')]);router[_0xadd1('0x9')](_0xadd1('0xe'),auth[_0xadd1('0xa')](),controller['getMembers']);router[_0xadd1('0x9')](_0xadd1('0xf'),auth['isAuthenticated'](),controller[_0xadd1('0x10')]);router['get']('/:id/users',auth[_0xadd1('0xa')](),controller[_0xadd1('0x11')]);router['post']('/',auth[_0xadd1('0xa')](),controller[_0xadd1('0x12')]);router[_0xadd1('0x13')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xadd1('0xa')](),controller[_0xadd1('0x14')]);router['put'](_0xadd1('0xc'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x15')]);router[_0xadd1('0x16')](_0xadd1('0xc'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x17')]);router['delete'](_0xadd1('0xf'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x18')]);router[_0xadd1('0x16')](_0xadd1('0x19'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x1a')]);module[_0xadd1('0x1b')]=router; \ No newline at end of file +var _0x48dc=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','removeTeams','exports','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48dc,0x150));var _0xc48d=function(_0x2cded0,_0x26257d){_0x2cded0=_0x2cded0-0x0;var _0x178565=_0x48dc[_0x2cded0];return _0x178565;};'use strict';var multer=require('multer');var util=require(_0xc48d('0x0'));var path=require('path');var timeout=require(_0xc48d('0x1'));var express=require(_0xc48d('0x2'));var router=express[_0xc48d('0x3')]();var fs_extra=require(_0xc48d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc48d('0x5'));var config=require(_0xc48d('0x6'));var controller=require(_0xc48d('0x7'));router[_0xc48d('0x8')]('/',auth['isAuthenticated'](),controller[_0xc48d('0x9')]);router[_0xc48d('0x8')](_0xc48d('0xa'),auth[_0xc48d('0xb')](),controller['describe']);router[_0xc48d('0x8')](_0xc48d('0xc'),auth['isAuthenticated'](),controller[_0xc48d('0xd')]);router[_0xc48d('0x8')](_0xc48d('0xe'),auth[_0xc48d('0xb')](),controller['getMembers']);router[_0xc48d('0x8')](_0xc48d('0xf'),auth[_0xc48d('0xb')](),controller[_0xc48d('0x10')]);router['get'](_0xc48d('0x11'),auth[_0xc48d('0xb')](),controller[_0xc48d('0x12')]);router[_0xc48d('0x13')]('/',auth[_0xc48d('0xb')](),controller['create']);router['post'](_0xc48d('0xf'),auth[_0xc48d('0xb')](),controller['addTeams']);router[_0xc48d('0x13')](_0xc48d('0x11'),auth['isAuthenticated'](),controller[_0xc48d('0x14')]);router[_0xc48d('0x15')](_0xc48d('0xc'),auth['isAuthenticated'](),controller[_0xc48d('0x16')]);router[_0xc48d('0x17')]('/:id',auth[_0xc48d('0xb')](),controller['destroy']);router[_0xc48d('0x17')](_0xc48d('0xf'),auth['isAuthenticated'](),controller[_0xc48d('0x18')]);router[_0xc48d('0x17')](_0xc48d('0x11'),auth[_0xc48d('0xb')](),controller['removeAgents']);module[_0xc48d('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 27ef7aa..256b80b 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 _0xd3d3=['INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0xba7490,_0x3d65aa){var _0x5ad46a=function(_0x3b2ea4){while(--_0x3b2ea4){_0xba7490['push'](_0xba7490['shift']());}};_0x5ad46a(++_0x3d65aa);}(_0xd3d3,0x130));var _0x3d3d=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xd3d3[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x3d3d('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d3d('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d3d('0x1')]},'timeout':{'type':Sequelize[_0x3d3d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3d3d('0x3'),_0x3d3d('0x4'),_0x3d3d('0x5'))}}; \ No newline at end of file +var _0xaef7=['name','INTEGER','ENUM','rrmemory','exports','STRING'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xaef7,0x13c));var _0x7aef=function(_0x330a51,_0x42c33b){_0x330a51=_0x330a51-0x0;var _0x55aa63=_0xaef7[_0x330a51];return _0x55aa63;};'use strict';var Sequelize=require('sequelize');module[_0x7aef('0x0')]={'name':{'type':Sequelize[_0x7aef('0x1')],'unique':_0x7aef('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7aef('0x1')]},'timeout':{'type':Sequelize[_0x7aef('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7aef('0x4')](_0x7aef('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f711274..dc98991 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 _0xf43d=['User','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','forEach','userMailQueue:remove','addAgents','spread','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','destroy','then','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','fieldName','key','getOptions','where','include','query','rows','catch','rawAttributes','keys','filters','model','attributes','intersection','fields','includeAll','merge','options','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','length','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','UserMailQueue','findAll','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team'];(function(_0x7a9856,_0x316d9b){var _0x76fc4a=function(_0x3d9c3e){while(--_0x3d9c3e){_0x7a9856['push'](_0x7a9856['shift']());}};_0x76fc4a(++_0x316d9b);}(_0xf43d,0x11a));var _0xdf43=function(_0x4ad891,_0x5c7557){_0x4ad891=_0x4ad891-0x0;var _0x42e3eb=_0xf43d[_0x4ad891];return _0x42e3eb;};'use strict';var BPromise=require(_0xdf43('0x0'));var util=require(_0xdf43('0x1'));var _=require(_0xdf43('0x2'));var squel=require(_0xdf43('0x3'));var Redis=require(_0xdf43('0x4'));var qs=require(_0xdf43('0x5'));var logger=require(_0xdf43('0x6'))(_0xdf43('0x7'));var config=require(_0xdf43('0x8'));var db=require(_0xdf43('0x9'))['db'];config[_0xdf43('0xa')]=_[_0xdf43('0xb')](config[_0xdf43('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf43('0xc'))(new Redis(config['redis']));require(_0xdf43('0xd'))[_0xdf43('0xe')](socket);function respondWithStatusCode(_0x3236d0,_0xefe495){_0xefe495=_0xefe495||0xcc;return function(_0xa76f89){if(_0xa76f89){return _0x3236d0[_0xdf43('0xf')](_0xefe495);}return _0x3236d0['status'](_0xefe495)[_0xdf43('0x10')]();};}function respondWithResult(_0x14fa86,_0x1fef64){_0x1fef64=_0x1fef64||0xc8;return function(_0x1c9bed){if(_0x1c9bed){return _0x14fa86[_0xdf43('0x11')](_0x1fef64)[_0xdf43('0x12')](_0x1c9bed);}};}function respondWithFilteredResult(_0x1be9e9,_0x260481){return function(_0x1810ae){if(_0x1810ae){var _0x2b0730=typeof _0x260481[_0xdf43('0x13')]==='undefined'&&typeof _0x260481['limit']===_0xdf43('0x14');var _0x522fc5=_0x1810ae[_0xdf43('0x15')];var _0x5bb9d6=_0x2b0730?0x0:_0x260481['offset'];var _0x47597f=_0x2b0730?_0x1810ae[_0xdf43('0x15')]:_0x260481[_0xdf43('0x13')]+_0x260481[_0xdf43('0x16')];var _0x4ec7df;if(_0x47597f>=_0x522fc5){_0x47597f=_0x522fc5;_0x4ec7df=0xc8;}else{_0x4ec7df=0xce;}_0x1be9e9[_0xdf43('0x11')](_0x4ec7df);return _0x1be9e9[_0xdf43('0x17')]('Content-Range',_0x5bb9d6+'-'+_0x47597f+'/'+_0x522fc5)['json'](_0x1810ae);}return null;};}function saveUpdates(_0x309685){return function(_0x4458a4){if(_0x4458a4){return _0x4458a4['update'](_0x309685)['then'](function(_0xff5287){return _0xff5287;});}return null;};}function removeEntity(_0x144d7b){return function(_0x544380){if(_0x544380){return _0x544380[_0xdf43('0x18')]()[_0xdf43('0x19')](function(){var _0x4e0723=_0x544380['get']({'plain':!![]});var _0x23166c=_0xdf43('0x1a');return db[_0xdf43('0x1b')][_0xdf43('0x18')]({'where':{'type':_0x23166c,'resourceId':_0x4e0723['id']}})[_0xdf43('0x19')](function(){return _0x544380;});})['then'](function(){_0x144d7b[_0xdf43('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259581){return function(_0x466ec5){if(!_0x466ec5){_0x259581[_0xdf43('0xf')](0x194);}return _0x466ec5;};}function handleError(_0x58708a,_0x3a3091){_0x3a3091=_0x3a3091||0x1f4;return function(_0x5c606c){logger[_0xdf43('0x1c')](_0x5c606c['stack']);if(_0x5c606c[_0xdf43('0x1d')]){delete _0x5c606c[_0xdf43('0x1d')];}_0x58708a['status'](_0x3a3091)[_0xdf43('0x1e')](_0x5c606c);};}exports[_0xdf43('0x1f')]=function(_0x5ed23b,_0x4e99f2){var _0x1235a6={};var _0x1e7636={'count':0x0,'rows':[]};var _0x48224e=_[_0xdf43('0x20')](db[_0xdf43('0x21')]['rawAttributes'],function(_0x4c0077){return{'name':_0x4c0077[_0xdf43('0x22')],'type':_0x4c0077['type'][_0xdf43('0x23')]};});_0x1235a6=qs[_0xdf43('0x24')](_0x48224e,_0x5ed23b);var _0x1c687c={'where':_0x1235a6[_0xdf43('0x25')]};return db[_0xdf43('0x21')][_0xdf43('0x15')](_0x1c687c)[_0xdf43('0x19')](function(_0x1ad94c){_0x1e7636['count']=_0x1ad94c;_0x1235a6[_0xdf43('0x26')]=qs[_0xdf43('0x26')](_0x5ed23b[_0xdf43('0x27')]);return db[_0xdf43('0x21')]['findAll'](_0x1235a6);})['then'](function(_0x224388){_0x1e7636[_0xdf43('0x28')]=_0x224388;return _0x1e7636;})[_0xdf43('0x19')](respondWithFilteredResult(_0x4e99f2,_0x1235a6))[_0xdf43('0x29')](handleError(_0x4e99f2,null));};exports['show']=function(_0x41ac44,_0x39fc8b){var _0x51efc2={'raw':!![],'where':{'id':_0x41ac44['params']['id']}},_0x24b221={};_0x24b221['model']=_['keys'](db[_0xdf43('0x21')][_0xdf43('0x2a')]);_0x24b221['query']=_[_0xdf43('0x2b')](_0x41ac44[_0xdf43('0x27')]);_0x24b221[_0xdf43('0x2c')]=_['intersection'](_0x24b221[_0xdf43('0x2d')],_0x24b221['query']);_0x51efc2[_0xdf43('0x2e')]=_[_0xdf43('0x2f')](_0x24b221[_0xdf43('0x2d')],qs[_0xdf43('0x30')](_0x41ac44[_0xdf43('0x27')]['fields']));_0x51efc2[_0xdf43('0x2e')]=_0x51efc2['attributes']['length']?_0x51efc2[_0xdf43('0x2e')]:_0x24b221[_0xdf43('0x2d')];if(_0x41ac44[_0xdf43('0x27')][_0xdf43('0x31')]){_0x51efc2['include']=[{'all':!![]}];}_0x51efc2=_[_0xdf43('0x32')]({},_0x51efc2,_0x41ac44[_0xdf43('0x33')]);return db[_0xdf43('0x21')][_0xdf43('0x34')](_0x51efc2)[_0xdf43('0x19')](handleEntityNotFound(_0x39fc8b,null))[_0xdf43('0x19')](respondWithResult(_0x39fc8b,null))[_0xdf43('0x29')](handleError(_0x39fc8b,null));};exports[_0xdf43('0x35')]=function(_0xf3b847,_0x481ef0){return db['MailQueue'][_0xdf43('0x35')](_0xf3b847['body'],{})[_0xdf43('0x19')](function(_0x188858){var _0x2db52b=_0xf3b847['user'][_0xdf43('0x36')]({'plain':!![]});if(!_0x2db52b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2db52b[_0xdf43('0x37')]===_0xdf43('0x38')){var _0x2b6493=_0x188858[_0xdf43('0x36')]({'plain':!![]});var _0x1969a7=_0xdf43('0x1a');return db[_0xdf43('0x39')][_0xdf43('0x34')]({'where':{'name':_0x1969a7,'userProfileId':_0x2db52b[_0xdf43('0x3a')]},'raw':!![]})[_0xdf43('0x19')](function(_0x336ed2){if(_0x336ed2&&_0x336ed2[_0xdf43('0x3b')]===0x0){return db[_0xdf43('0x1b')]['create']({'name':_0x2b6493[_0xdf43('0x1d')],'resourceId':_0x2b6493['id'],'type':_0x336ed2[_0xdf43('0x1d')],'sectionId':_0x336ed2['id']},{})[_0xdf43('0x19')](function(){return _0x188858;});}else{return _0x188858;}})[_0xdf43('0x29')](function(_0x57e384){logger['error'](_0xdf43('0x3c'),_0x57e384);throw _0x57e384;});}return _0x188858;})['then'](respondWithResult(_0x481ef0,0xc9))['catch'](handleError(_0x481ef0,null));};exports[_0xdf43('0x3d')]=function(_0x15e9f4,_0x3b5c7a){if(_0x15e9f4[_0xdf43('0x3e')]['id']){delete _0x15e9f4[_0xdf43('0x3e')]['id'];}return db['MailQueue'][_0xdf43('0x34')]({'where':{'id':_0x15e9f4[_0xdf43('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b5c7a,null))[_0xdf43('0x19')](saveUpdates(_0x15e9f4[_0xdf43('0x3e')],null))['then'](respondWithResult(_0x3b5c7a,null))[_0xdf43('0x29')](handleError(_0x3b5c7a,null));};exports[_0xdf43('0x18')]=function(_0x343455,_0x16e221){return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x343455[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x16e221,null))['then'](removeEntity(_0x16e221,null))['catch'](handleError(_0x16e221,null));};exports['describe']=function(_0x3911d2,_0x1f18e2){return db['MailQueue'][_0xdf43('0x40')]()[_0xdf43('0x19')](respondWithResult(_0x1f18e2,null))[_0xdf43('0x29')](handleError(_0x1f18e2,null));};exports[_0xdf43('0x41')]=function(_0x47fc7f,_0x3a9119){var _0x8a100d={'raw':!![],'where':{}},_0x3888ab={},_0x3c417d;return db[_0xdf43('0x21')][_0xdf43('0x42')]({'where':{'id':_0x47fc7f['params']['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x3a9119,null))['then'](function(_0xab7ee8){if(_0xab7ee8){_0x3c417d=_0xab7ee8['get']({'plain':!![]});_0x3888ab[_0xdf43('0x2d')]=_[_0xdf43('0x2b')](db['UserMailQueue']['rawAttributes']);_0x3888ab['query']=_[_0xdf43('0x2b')](_0x47fc7f['query']);_0x3888ab['filters']=_[_0xdf43('0x2f')](_0x3888ab[_0xdf43('0x2d')],_0x3888ab[_0xdf43('0x27')]);_0x8a100d['attributes']=_[_0xdf43('0x2f')](_0x3888ab['model'],qs[_0xdf43('0x30')](_0x47fc7f['query'][_0xdf43('0x30')]));_0x8a100d[_0xdf43('0x2e')]=_0x8a100d[_0xdf43('0x2e')][_0xdf43('0x43')]?_0x8a100d[_0xdf43('0x2e')]:_0x3888ab[_0xdf43('0x2d')];if(!_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x44')](_0xdf43('0x45'))){_0x8a100d[_0xdf43('0x16')]=qs[_0xdf43('0x16')](_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x16')]);_0x8a100d[_0xdf43('0x13')]=qs[_0xdf43('0x13')](_0x47fc7f[_0xdf43('0x27')]['offset']);}_0x8a100d[_0xdf43('0x46')]=qs[_0xdf43('0x47')](_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x47')]);_0x8a100d['where']=qs[_0xdf43('0x2c')](_[_0xdf43('0x48')](_0x47fc7f['query'],_0x3888ab['filters']));_0x8a100d['where'][_0xdf43('0x49')]=_0xab7ee8['id'];if(_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x4a')]){_0x8a100d[_0xdf43('0x25')]=_[_0xdf43('0x32')](_0x8a100d[_0xdf43('0x25')],{'$or':_['map'](_0x8a100d[_0xdf43('0x2e')],function(_0x4d0840){var _0x4c1568={};_0x4c1568[_0x4d0840]={'$like':'%'+_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x4a')]+'%'};return _0x4c1568;})});}_0x8a100d=_['merge']({},_0x8a100d,_0x47fc7f[_0xdf43('0x33')]);return db[_0xdf43('0x4b')][_0xdf43('0x4c')](_0x8a100d);}})[_0xdf43('0x19')](function(_0x38feac){if(_0x38feac){return db['User'][_0xdf43('0x4d')]({'where':{'id':_[_0xdf43('0x20')](_0x38feac,_0xdf43('0x4e')),'role':_0xdf43('0x4f')},'attributes':['id',_0xdf43('0x1d'),_0xdf43('0x50'),_0xdf43('0x51'),_0xdf43('0x52')]});}})[_0xdf43('0x19')](function(_0x57cefa){if(_0x57cefa){return{'count':_0x57cefa[_0xdf43('0x15')],'rows':_[_0xdf43('0x20')](_0x57cefa['rows'],function(_0x4c86d8){return{'membername':_0x4c86d8[_0xdf43('0x1d')],'UserId':_0x4c86d8['id'],'queue_name':_0x3c417d[_0xdf43('0x1d')],'MailQueueId':_0x3c417d['id'],'interface':util[_0xdf43('0x53')](_0xdf43('0x54'),_0xdf43('0x55'),_0x4c86d8['name']),'penalty':0x0,'paused':_0x4c86d8[_0xdf43('0x50')],'createdAt':_0x4c86d8[_0xdf43('0x52')],'updatedAt':_0x4c86d8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdf43('0x19')](respondWithFilteredResult(_0x3a9119,_0x8a100d))['catch'](handleError(_0x3a9119,null));};exports[_0xdf43('0x56')]=function(_0x4c5e16,_0x2c7c61){var _0x13dbaa={};var _0x3e9529={};var _0x48b4f4;var _0x311426;return db['MailQueue'][_0xdf43('0x42')]({'where':{'id':_0x4c5e16[_0xdf43('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c7c61,null))[_0xdf43('0x19')](function(_0x137810){if(_0x137810){_0x48b4f4=_0x137810;_0x3e9529[_0xdf43('0x2d')]=_[_0xdf43('0x2b')](db['Team'][_0xdf43('0x2a')]);_0x3e9529[_0xdf43('0x27')]=_['keys'](_0x4c5e16[_0xdf43('0x27')]);_0x3e9529[_0xdf43('0x2c')]=_['intersection'](_0x3e9529[_0xdf43('0x2d')],_0x3e9529[_0xdf43('0x27')]);_0x13dbaa['attributes']=_[_0xdf43('0x2f')](_0x3e9529[_0xdf43('0x2d')],qs['fields'](_0x4c5e16[_0xdf43('0x27')]['fields']));_0x13dbaa['attributes']=_0x13dbaa['attributes']['length']?_0x13dbaa[_0xdf43('0x2e')]:_0x3e9529['model'];_0x13dbaa[_0xdf43('0x46')]=qs[_0xdf43('0x47')](_0x4c5e16['query'][_0xdf43('0x47')]);_0x13dbaa['where']=qs[_0xdf43('0x2c')](_[_0xdf43('0x48')](_0x4c5e16[_0xdf43('0x27')],_0x3e9529[_0xdf43('0x2c')]));if(_0x4c5e16[_0xdf43('0x27')]['filter']){_0x13dbaa['where']=_[_0xdf43('0x32')](_0x13dbaa[_0xdf43('0x25')],{'$or':_['map'](_0x13dbaa[_0xdf43('0x2e')],function(_0x426642){var _0x49820f={};_0x49820f[_0x426642]={'$like':'%'+_0x4c5e16['query']['filter']+'%'};return _0x49820f;})});}_0x13dbaa=_[_0xdf43('0x32')]({},_0x13dbaa,_0x4c5e16[_0xdf43('0x33')]);return _0x48b4f4['getTeams'](_0x13dbaa);}})[_0xdf43('0x19')](function(_0x5600b9){if(_0x5600b9){_0x311426=_0x5600b9['length'];if(!_0x4c5e16['query'][_0xdf43('0x44')](_0xdf43('0x45'))){_0x13dbaa[_0xdf43('0x16')]=qs['limit'](_0x4c5e16[_0xdf43('0x27')][_0xdf43('0x16')]);_0x13dbaa['offset']=qs[_0xdf43('0x13')](_0x4c5e16[_0xdf43('0x27')][_0xdf43('0x13')]);}return _0x48b4f4[_0xdf43('0x56')](_0x13dbaa);}})[_0xdf43('0x19')](function(_0x368602){if(_0x368602){return _0x368602?{'count':_0x311426,'rows':_0x368602}:null;}})[_0xdf43('0x19')](respondWithResult(_0x2c7c61,null))[_0xdf43('0x29')](handleError(_0x2c7c61,null));};exports[_0xdf43('0x57')]=function(_0x303261,_0x1b1507){var _0x3563b8=_0x303261[_0xdf43('0x3e')][_0xdf43('0x58')];return db[_0xdf43('0x59')][_0xdf43('0x4c')]({'where':{'id':_0x3563b8},'attributes':['id'],'include':[{'model':db[_0xdf43('0x5a')],'as':'Agents','attributes':['id','name','online',_0xdf43('0x5b'),_0xdf43('0x5c')],'raw':!![]}]})['then'](function(_0x4f347f){if(_0x4f347f){var _0x291dc4=_[_0xdf43('0x5d')](_0x4f347f,function(_0x3bf9b2){var _0x533428=_0x3bf9b2[_0xdf43('0x36')]({'plain':!![]});return _0x533428[_0xdf43('0x5e')];});return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x303261['params']['id']}})[_0xdf43('0x19')](function(_0x306e02){return db[_0xdf43('0x5f')][_0xdf43('0x60')](function(_0x443af8){return _0x306e02[_0xdf43('0x57')](_0x3563b8,{'transaction':_0x443af8})['then'](function(){return BPromise[_0xdf43('0x61')](_0x291dc4,function(_0x683f3){return db[_0xdf43('0x4b')][_0xdf43('0x62')]({'where':{'UserId':_0x683f3['id'],'MailQueueId':_0x303261[_0xdf43('0x3f')]['id']},'transaction':_0x443af8});});})[_0xdf43('0x19')](function(){_0x291dc4['forEach'](function(_0x16eb25){socket[_0xdf43('0x63')](_0xdf43('0x64'),{'UserId':_0x16eb25['id'],'MailQueueId':_0x306e02['id']});});});});});}})[_0xdf43('0x19')](respondWithStatusCode(_0x1b1507,null))['catch'](handleError(_0x1b1507,null));};exports[_0xdf43('0x65')]=function(_0x582c5a,_0x5cd0a8){return db[_0xdf43('0x59')][_0xdf43('0x4c')]({'where':{'id':_0x582c5a['query'][_0xdf43('0x58')]},'attributes':['id'],'include':[{'model':db[_0xdf43('0x5a')],'as':_0xdf43('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5cd0a8,null))[_0xdf43('0x19')](function(_0x1827ac){var _0x11350b=_[_0xdf43('0x20')](_0x1827ac,'id');var _0x44992c=[];var _0x583509=[];var _0x2fa37f=squel[_0xdf43('0x66')]();_0x2fa37f[_0xdf43('0x67')](_0xdf43('0x68'))['from'](_0xdf43('0x69'),'tq')[_0xdf43('0x6a')](_0xdf43('0x6b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x582c5a[_0xdf43('0x3f')]['id']);for(var _0x872db8=0x0;_0x872db8<_0x1827ac[_0xdf43('0x43')];_0x872db8+=0x1){let _0x48bf9e=_0x1827ac[_0x872db8];for(var _0x44b842=0x0;_0x44b842<_0x48bf9e[_0xdf43('0x5e')][_0xdf43('0x43')];_0x44b842+=0x1){let _0x18cd51=_0x48bf9e['Agents'][_0x44b842];var _0x2aa57c=_0x2fa37f['clone']();_0x2aa57c['where'](_0xdf43('0x6c'),_0x18cd51['id']);_0x583509[_0xdf43('0x6d')](db['sequelize'][_0xdf43('0x27')](_0x2aa57c['toString'](),{'type':db['sequelize'][_0xdf43('0x6e')][_0xdf43('0x6f')]})[_0xdf43('0x19')](function(_0x13544c){if(_0x13544c[_0xdf43('0x43')]===0x1){return _0x18cd51['id'];}else{var _0x13daaa=_[_0xdf43('0x70')](_['map'](_0x13544c,'TeamId'),function(_0x25737d){return _[_0xdf43('0x71')](_0x11350b,_0x25737d);});if(_0x13daaa){return _0x18cd51['id'];}}}));}}return BPromise[_0xdf43('0x72')](_0x583509)[_0xdf43('0x19')](function(_0x220200){_0x44992c=_(_0x44992c)[_0xdf43('0x73')](_0x220200)[_0xdf43('0x74')]()[_0xdf43('0x75')]();return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x582c5a[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](function(_0x43b0df){return db['sequelize']['transaction'](function(_0x1ccd03){return _0x43b0df['removeTeams'](_0x582c5a[_0xdf43('0x27')][_0xdf43('0x58')],{'transaction':_0x1ccd03})[_0xdf43('0x19')](function(){if(!_[_0xdf43('0x76')](_0x44992c)){return _0x43b0df['removeAgents'](_0x44992c,{'transaction':_0x1ccd03});}})[_0xdf43('0x19')](function(){_0x44992c[_0xdf43('0x77')](function(_0x2a7c85){socket[_0xdf43('0x63')](_0xdf43('0x78'),{'UserId':_0x2a7c85,'MailQueueId':_0x43b0df['id']});});});});});});})[_0xdf43('0x19')](respondWithStatusCode(_0x5cd0a8,null))[_0xdf43('0x29')](handleError(_0x5cd0a8,null));};exports[_0xdf43('0x79')]=function(_0x39ad56,_0x4671be){return db['MailQueue'][_0xdf43('0x34')]({'where':{'id':_0x39ad56[_0xdf43('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4671be,null))['then'](function(_0x14a213){if(_0x14a213){return _0x14a213[_0xdf43('0x79')](_0x39ad56['body'][_0xdf43('0x58')],_['omit'](_0x39ad56[_0xdf43('0x3e')],[_0xdf43('0x58'),'id'])||{})[_0xdf43('0x7a')](function(_0x536a64){for(var _0x633cd=0x0;_0x633cd<_0x39ad56['body'][_0xdf43('0x58')][_0xdf43('0x43')];_0x633cd+=0x1){socket['emit'](_0xdf43('0x64'),{'UserId':Number(_0x39ad56[_0xdf43('0x3e')]['ids'][_0x633cd]),'MailQueueId':Number(_0x39ad56[_0xdf43('0x3f')]['id'])});}return _0x536a64;});}})['then'](respondWithResult(_0x4671be,null))[_0xdf43('0x29')](handleError(_0x4671be,null));};exports['removeAgents']=function(_0x4dc535,_0x3bfeff){return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x4dc535[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x3bfeff,null))['then'](function(_0x9b175b){if(_0x9b175b){return _0x9b175b['removeAgents'](_0x4dc535[_0xdf43('0x27')][_0xdf43('0x58')])[_0xdf43('0x19')](function(){if(_['isArray'](_0x4dc535[_0xdf43('0x27')]['ids'])){for(var _0x1f5ad0=0x0;_0x1f5ad0<_0x4dc535[_0xdf43('0x27')][_0xdf43('0x58')][_0xdf43('0x43')];_0x1f5ad0+=0x1){socket['emit'](_0xdf43('0x78'),{'UserId':Number(_0x4dc535['query']['ids'][_0x1f5ad0]),'MailQueueId':Number(_0x4dc535['params']['id'])});}}else{socket[_0xdf43('0x63')](_0xdf43('0x78'),{'UserId':Number(_0x4dc535[_0xdf43('0x27')][_0xdf43('0x58')]),'MailQueueId':Number(_0x4dc535[_0xdf43('0x3f')]['id'])});}});}})[_0xdf43('0x19')](respondWithStatusCode(_0x3bfeff,null))[_0xdf43('0x29')](handleError(_0x3bfeff,null));};exports[_0xdf43('0x7b')]=function(_0xdeaa7c,_0x18e4b0){var _0x43e1c2={};var _0x18ea8d={};var _0x4f9036;var _0x23ca26;return db[_0xdf43('0x21')][_0xdf43('0x42')]({'where':{'id':_0xdeaa7c[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x18e4b0,null))[_0xdf43('0x19')](function(_0x556567){if(_0x556567){_0x4f9036=_0x556567;_0x18ea8d[_0xdf43('0x2d')]=_['keys'](db[_0xdf43('0x5a')]['rawAttributes']);_0x18ea8d['query']=_[_0xdf43('0x2b')](_0xdeaa7c['query']);_0x18ea8d[_0xdf43('0x2c')]=_[_0xdf43('0x2f')](_0x18ea8d[_0xdf43('0x2d')],_0x18ea8d[_0xdf43('0x27')]);_0x43e1c2[_0xdf43('0x2e')]=_[_0xdf43('0x2f')](_0x18ea8d['model'],qs[_0xdf43('0x30')](_0xdeaa7c['query'][_0xdf43('0x30')]));_0x43e1c2[_0xdf43('0x2e')]=_0x43e1c2[_0xdf43('0x2e')][_0xdf43('0x43')]?_0x43e1c2[_0xdf43('0x2e')]:_0x18ea8d[_0xdf43('0x2d')];_0x43e1c2[_0xdf43('0x46')]=qs[_0xdf43('0x47')](_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x47')]);_0x43e1c2['where']=qs[_0xdf43('0x2c')](_[_0xdf43('0x48')](_0xdeaa7c['query'],_0x18ea8d[_0xdf43('0x2c')]));if(_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x4a')]){_0x43e1c2['where']=_[_0xdf43('0x32')](_0x43e1c2[_0xdf43('0x25')],{'$or':_[_0xdf43('0x20')](_0x43e1c2[_0xdf43('0x2e')],function(_0x4325ce){var _0x1c440e={};_0x1c440e[_0x4325ce]={'$like':'%'+_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x4a')]+'%'};return _0x1c440e;})});}_0x43e1c2=_['merge']({},_0x43e1c2,_0xdeaa7c[_0xdf43('0x33')]);return _0x4f9036[_0xdf43('0x7b')](_0x43e1c2);}})[_0xdf43('0x19')](function(_0x10993c){if(_0x10993c){_0x23ca26=_0x10993c[_0xdf43('0x43')];if(!_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x44')](_0xdf43('0x45'))){_0x43e1c2[_0xdf43('0x16')]=qs[_0xdf43('0x16')](_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x16')]);_0x43e1c2['offset']=qs[_0xdf43('0x13')](_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x13')]);}return _0x4f9036[_0xdf43('0x7b')](_0x43e1c2);}})['then'](function(_0x453c9b){if(_0x453c9b){return _0x453c9b?{'count':_0x23ca26,'rows':_0x453c9b}:null;}})[_0xdf43('0x19')](respondWithResult(_0x18e4b0,null))[_0xdf43('0x29')](handleError(_0x18e4b0,null));}; \ No newline at end of file +var _0xdb8a=['lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','getOptions','MailQueue','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','fields','length','nolimit','order','sort','pick','where','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','Agents','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','hasOwnProperty','bluebird','util'];(function(_0x19880a,_0x33a629){var _0x7b6e9=function(_0x1296b6){while(--_0x1296b6){_0x19880a['push'](_0x19880a['shift']());}};_0x7b6e9(++_0x33a629);}(_0xdb8a,0x16c));var _0xadb8=function(_0x6d1fb5,_0x2f6258){_0x6d1fb5=_0x6d1fb5-0x0;var _0x2cd921=_0xdb8a[_0x6d1fb5];return _0x2cd921;};'use strict';var BPromise=require(_0xadb8('0x0'));var util=require(_0xadb8('0x1'));var _=require(_0xadb8('0x2'));var squel=require(_0xadb8('0x3'));var Redis=require(_0xadb8('0x4'));var qs=require(_0xadb8('0x5'));var logger=require('../../config/logger')(_0xadb8('0x6'));var config=require(_0xadb8('0x7'));var db=require(_0xadb8('0x8'))['db'];config['redis']=_[_0xadb8('0x9')](config[_0xadb8('0xa')],{'host':_0xadb8('0xb'),'port':0x18eb});var socket=require(_0xadb8('0xc'))(new Redis(config[_0xadb8('0xa')]));require(_0xadb8('0xd'))[_0xadb8('0xe')](socket);function respondWithStatusCode(_0x3a0b5c,_0x5d2aff){_0x5d2aff=_0x5d2aff||0xcc;return function(_0x187050){if(_0x187050){return _0x3a0b5c[_0xadb8('0xf')](_0x5d2aff);}return _0x3a0b5c[_0xadb8('0x10')](_0x5d2aff)[_0xadb8('0x11')]();};}function respondWithResult(_0x3353a4,_0x52d440){_0x52d440=_0x52d440||0xc8;return function(_0x3dc4e0){if(_0x3dc4e0){return _0x3353a4[_0xadb8('0x10')](_0x52d440)[_0xadb8('0x12')](_0x3dc4e0);}};}function respondWithFilteredResult(_0x13b484,_0xb10dd9){return function(_0x2c3aba){if(_0x2c3aba){var _0x445b6a=typeof _0xb10dd9['offset']==='undefined'&&typeof _0xb10dd9[_0xadb8('0x13')]===_0xadb8('0x14');var _0x285810=_0x2c3aba[_0xadb8('0x15')];var _0x128d01=_0x445b6a?0x0:_0xb10dd9['offset'];var _0x4447b5=_0x445b6a?_0x2c3aba[_0xadb8('0x15')]:_0xb10dd9[_0xadb8('0x16')]+_0xb10dd9[_0xadb8('0x13')];var _0x4b8481;if(_0x4447b5>=_0x285810){_0x4447b5=_0x285810;_0x4b8481=0xc8;}else{_0x4b8481=0xce;}_0x13b484['status'](_0x4b8481);return _0x13b484[_0xadb8('0x17')](_0xadb8('0x18'),_0x128d01+'-'+_0x4447b5+'/'+_0x285810)[_0xadb8('0x12')](_0x2c3aba);}return null;};}function saveUpdates(_0x6ea8e5){return function(_0x1b9558){if(_0x1b9558){return _0x1b9558[_0xadb8('0x19')](_0x6ea8e5)[_0xadb8('0x1a')](function(_0x1a447f){return _0x1a447f;});}return null;};}function removeEntity(_0x4be130){return function(_0xb02fb3){if(_0xb02fb3){return _0xb02fb3[_0xadb8('0x1b')]()['then'](function(){var _0x392b61=_0xb02fb3[_0xadb8('0x1c')]({'plain':!![]});var _0x2be50f=_0xadb8('0x1d');return db[_0xadb8('0x1e')][_0xadb8('0x1b')]({'where':{'type':_0x2be50f,'resourceId':_0x392b61['id']}})[_0xadb8('0x1a')](function(){return _0xb02fb3;});})[_0xadb8('0x1a')](function(){_0x4be130['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59128c){return function(_0x38c921){if(!_0x38c921){_0x59128c[_0xadb8('0xf')](0x194);}return _0x38c921;};}function handleError(_0xdd1b15,_0x429a5d){_0x429a5d=_0x429a5d||0x1f4;return function(_0x2ad8e1){logger[_0xadb8('0x1f')](_0x2ad8e1['stack']);if(_0x2ad8e1[_0xadb8('0x20')]){delete _0x2ad8e1[_0xadb8('0x20')];}_0xdd1b15[_0xadb8('0x10')](_0x429a5d)[_0xadb8('0x21')](_0x2ad8e1);};}exports[_0xadb8('0x22')]=function(_0x1b8deb,_0x2dcebb){var _0x19e50a={};var _0x17c2df={'count':0x0,'rows':[]};var _0x125d7f=_[_0xadb8('0x23')](db['MailQueue'][_0xadb8('0x24')],function(_0xb44922){return{'name':_0xb44922[_0xadb8('0x25')],'type':_0xb44922['type'][_0xadb8('0x26')]};});_0x19e50a=qs[_0xadb8('0x27')](_0x125d7f,_0x1b8deb);var _0x2e280c={'where':_0x19e50a['where']};return db[_0xadb8('0x28')][_0xadb8('0x15')](_0x2e280c)['then'](function(_0x276136){_0x17c2df[_0xadb8('0x15')]=_0x276136;_0x19e50a['include']=qs[_0xadb8('0x29')](_0x1b8deb[_0xadb8('0x2a')]);return db[_0xadb8('0x28')][_0xadb8('0x2b')](_0x19e50a);})[_0xadb8('0x1a')](function(_0x383554){_0x17c2df['rows']=_0x383554;return _0x17c2df;})['then'](respondWithFilteredResult(_0x2dcebb,_0x19e50a))[_0xadb8('0x2c')](handleError(_0x2dcebb,null));};exports[_0xadb8('0x2d')]=function(_0x51acd8,_0x29fee2){var _0x3d308b={'raw':!![],'where':{'id':_0x51acd8[_0xadb8('0x2e')]['id']}},_0x4dfbd7={};_0x4dfbd7[_0xadb8('0x2f')]=_[_0xadb8('0x30')](db[_0xadb8('0x28')]['rawAttributes']);_0x4dfbd7[_0xadb8('0x2a')]=_[_0xadb8('0x30')](_0x51acd8[_0xadb8('0x2a')]);_0x4dfbd7[_0xadb8('0x31')]=_[_0xadb8('0x32')](_0x4dfbd7['model'],_0x4dfbd7['query']);_0x3d308b[_0xadb8('0x33')]=_[_0xadb8('0x32')](_0x4dfbd7[_0xadb8('0x2f')],qs['fields'](_0x51acd8[_0xadb8('0x2a')]['fields']));_0x3d308b[_0xadb8('0x33')]=_0x3d308b[_0xadb8('0x33')]['length']?_0x3d308b[_0xadb8('0x33')]:_0x4dfbd7[_0xadb8('0x2f')];if(_0x51acd8[_0xadb8('0x2a')][_0xadb8('0x34')]){_0x3d308b[_0xadb8('0x29')]=[{'all':!![]}];}_0x3d308b=_[_0xadb8('0x35')]({},_0x3d308b,_0x51acd8[_0xadb8('0x36')]);return db[_0xadb8('0x28')][_0xadb8('0x37')](_0x3d308b)[_0xadb8('0x1a')](handleEntityNotFound(_0x29fee2,null))[_0xadb8('0x1a')](respondWithResult(_0x29fee2,null))[_0xadb8('0x2c')](handleError(_0x29fee2,null));};exports[_0xadb8('0x38')]=function(_0x5775d6,_0x4afa26){return db[_0xadb8('0x28')]['create'](_0x5775d6[_0xadb8('0x39')],{})[_0xadb8('0x1a')](function(_0x234c6b){var _0x227d6a=_0x5775d6[_0xadb8('0x3a')][_0xadb8('0x1c')]({'plain':!![]});if(!_0x227d6a)throw new Error(_0xadb8('0x3b'));if(_0x227d6a['role']===_0xadb8('0x3a')){var _0x3a2571=_0x234c6b['get']({'plain':!![]});var _0x17889c=_0xadb8('0x1d');return db[_0xadb8('0x3c')]['find']({'where':{'name':_0x17889c,'userProfileId':_0x227d6a['userProfileId']},'raw':!![]})[_0xadb8('0x1a')](function(_0x5396a9){if(_0x5396a9&&_0x5396a9[_0xadb8('0x3d')]===0x0){return db[_0xadb8('0x1e')]['create']({'name':_0x3a2571[_0xadb8('0x20')],'resourceId':_0x3a2571['id'],'type':_0x5396a9[_0xadb8('0x20')],'sectionId':_0x5396a9['id']},{})['then'](function(){return _0x234c6b;});}else{return _0x234c6b;}})['catch'](function(_0x535bac){logger['error'](_0xadb8('0x3e'),_0x535bac);throw _0x535bac;});}return _0x234c6b;})[_0xadb8('0x1a')](respondWithResult(_0x4afa26,0xc9))['catch'](handleError(_0x4afa26,null));};exports[_0xadb8('0x19')]=function(_0xdb868e,_0x23b805){if(_0xdb868e['body']['id']){delete _0xdb868e[_0xadb8('0x39')]['id'];}return db[_0xadb8('0x28')][_0xadb8('0x37')]({'where':{'id':_0xdb868e[_0xadb8('0x2e')]['id']}})[_0xadb8('0x1a')](handleEntityNotFound(_0x23b805,null))['then'](saveUpdates(_0xdb868e[_0xadb8('0x39')],null))['then'](respondWithResult(_0x23b805,null))[_0xadb8('0x2c')](handleError(_0x23b805,null));};exports[_0xadb8('0x1b')]=function(_0x557f51,_0x550e2e){return db['MailQueue'][_0xadb8('0x37')]({'where':{'id':_0x557f51['params']['id']}})[_0xadb8('0x1a')](handleEntityNotFound(_0x550e2e,null))[_0xadb8('0x1a')](removeEntity(_0x550e2e,null))['catch'](handleError(_0x550e2e,null));};exports[_0xadb8('0x3f')]=function(_0x37b936,_0x2ca48b){return db[_0xadb8('0x28')][_0xadb8('0x3f')]()['then'](respondWithResult(_0x2ca48b,null))['catch'](handleError(_0x2ca48b,null));};exports[_0xadb8('0x40')]=function(_0x117659,_0x492169){var _0x31e23c={'raw':!![],'where':{}},_0x4c1b2b={},_0x3835bd;return db[_0xadb8('0x28')][_0xadb8('0x41')]({'where':{'id':_0x117659[_0xadb8('0x2e')]['id']}})[_0xadb8('0x1a')](handleEntityNotFound(_0x492169,null))['then'](function(_0x5b38f9){if(_0x5b38f9){_0x3835bd=_0x5b38f9[_0xadb8('0x1c')]({'plain':!![]});_0x4c1b2b['model']=_['keys'](db[_0xadb8('0x42')]['rawAttributes']);_0x4c1b2b[_0xadb8('0x2a')]=_[_0xadb8('0x30')](_0x117659['query']);_0x4c1b2b[_0xadb8('0x31')]=_[_0xadb8('0x32')](_0x4c1b2b[_0xadb8('0x2f')],_0x4c1b2b[_0xadb8('0x2a')]);_0x31e23c[_0xadb8('0x33')]=_[_0xadb8('0x32')](_0x4c1b2b[_0xadb8('0x2f')],qs[_0xadb8('0x43')](_0x117659[_0xadb8('0x2a')]['fields']));_0x31e23c[_0xadb8('0x33')]=_0x31e23c[_0xadb8('0x33')][_0xadb8('0x44')]?_0x31e23c[_0xadb8('0x33')]:_0x4c1b2b['model'];if(!_0x117659[_0xadb8('0x2a')]['hasOwnProperty'](_0xadb8('0x45'))){_0x31e23c[_0xadb8('0x13')]=qs['limit'](_0x117659[_0xadb8('0x2a')]['limit']);_0x31e23c['offset']=qs['offset'](_0x117659[_0xadb8('0x2a')][_0xadb8('0x16')]);}_0x31e23c[_0xadb8('0x46')]=qs[_0xadb8('0x47')](_0x117659[_0xadb8('0x2a')][_0xadb8('0x47')]);_0x31e23c['where']=qs[_0xadb8('0x31')](_[_0xadb8('0x48')](_0x117659['query'],_0x4c1b2b[_0xadb8('0x31')]));_0x31e23c[_0xadb8('0x49')][_0xadb8('0x4a')]=_0x5b38f9['id'];if(_0x117659[_0xadb8('0x2a')][_0xadb8('0x4b')]){_0x31e23c[_0xadb8('0x49')]=_[_0xadb8('0x35')](_0x31e23c['where'],{'$or':_[_0xadb8('0x23')](_0x31e23c[_0xadb8('0x33')],function(_0xf18f4e){var _0x29ce6a={};_0x29ce6a[_0xf18f4e]={'$like':'%'+_0x117659[_0xadb8('0x2a')][_0xadb8('0x4b')]+'%'};return _0x29ce6a;})});}_0x31e23c=_['merge']({},_0x31e23c,_0x117659[_0xadb8('0x36')]);return db[_0xadb8('0x42')]['findAll'](_0x31e23c);}})[_0xadb8('0x1a')](function(_0x5da039){if(_0x5da039){return db[_0xadb8('0x4c')][_0xadb8('0x4d')]({'where':{'id':_['map'](_0x5da039,_0xadb8('0x4e')),'role':_0xadb8('0x4f')},'attributes':['id',_0xadb8('0x20'),_0xadb8('0x50'),_0xadb8('0x51'),_0xadb8('0x52')]});}})[_0xadb8('0x1a')](function(_0x8e2603){if(_0x8e2603){return{'count':_0x8e2603[_0xadb8('0x15')],'rows':_['map'](_0x8e2603['rows'],function(_0x5d2d9f){return{'membername':_0x5d2d9f['name'],'UserId':_0x5d2d9f['id'],'queue_name':_0x3835bd[_0xadb8('0x20')],'MailQueueId':_0x3835bd['id'],'interface':util[_0xadb8('0x53')]('%s/%s',_0xadb8('0x54'),_0x5d2d9f[_0xadb8('0x20')]),'penalty':0x0,'paused':_0x5d2d9f['mailPause'],'createdAt':_0x5d2d9f[_0xadb8('0x52')],'updatedAt':_0x5d2d9f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xadb8('0x1a')](respondWithFilteredResult(_0x492169,_0x31e23c))[_0xadb8('0x2c')](handleError(_0x492169,null));};exports[_0xadb8('0x55')]=function(_0x45c6c4,_0x58cccd){var _0x7bc2c7={};var _0x44b187={};var _0x1cc2d8;var _0x51e061;return db[_0xadb8('0x28')]['findOne']({'where':{'id':_0x45c6c4[_0xadb8('0x2e')]['id']}})[_0xadb8('0x1a')](handleEntityNotFound(_0x58cccd,null))['then'](function(_0x475f35){if(_0x475f35){_0x1cc2d8=_0x475f35;_0x44b187['model']=_[_0xadb8('0x30')](db[_0xadb8('0x56')]['rawAttributes']);_0x44b187['query']=_[_0xadb8('0x30')](_0x45c6c4['query']);_0x44b187['filters']=_[_0xadb8('0x32')](_0x44b187[_0xadb8('0x2f')],_0x44b187[_0xadb8('0x2a')]);_0x7bc2c7[_0xadb8('0x33')]=_[_0xadb8('0x32')](_0x44b187[_0xadb8('0x2f')],qs[_0xadb8('0x43')](_0x45c6c4[_0xadb8('0x2a')][_0xadb8('0x43')]));_0x7bc2c7['attributes']=_0x7bc2c7[_0xadb8('0x33')][_0xadb8('0x44')]?_0x7bc2c7[_0xadb8('0x33')]:_0x44b187[_0xadb8('0x2f')];_0x7bc2c7[_0xadb8('0x46')]=qs[_0xadb8('0x47')](_0x45c6c4[_0xadb8('0x2a')][_0xadb8('0x47')]);_0x7bc2c7[_0xadb8('0x49')]=qs[_0xadb8('0x31')](_[_0xadb8('0x48')](_0x45c6c4['query'],_0x44b187[_0xadb8('0x31')]));if(_0x45c6c4[_0xadb8('0x2a')][_0xadb8('0x4b')]){_0x7bc2c7[_0xadb8('0x49')]=_[_0xadb8('0x35')](_0x7bc2c7[_0xadb8('0x49')],{'$or':_['map'](_0x7bc2c7[_0xadb8('0x33')],function(_0x4a3e01){var _0x127697={};_0x127697[_0x4a3e01]={'$like':'%'+_0x45c6c4['query'][_0xadb8('0x4b')]+'%'};return _0x127697;})});}_0x7bc2c7=_[_0xadb8('0x35')]({},_0x7bc2c7,_0x45c6c4[_0xadb8('0x36')]);return _0x1cc2d8[_0xadb8('0x55')](_0x7bc2c7);}})[_0xadb8('0x1a')](function(_0x36a31d){if(_0x36a31d){_0x51e061=_0x36a31d[_0xadb8('0x44')];if(!_0x45c6c4['query']['hasOwnProperty'](_0xadb8('0x45'))){_0x7bc2c7[_0xadb8('0x13')]=qs['limit'](_0x45c6c4['query']['limit']);_0x7bc2c7['offset']=qs[_0xadb8('0x16')](_0x45c6c4[_0xadb8('0x2a')][_0xadb8('0x16')]);}return _0x1cc2d8[_0xadb8('0x55')](_0x7bc2c7);}})[_0xadb8('0x1a')](function(_0x5506f5){if(_0x5506f5){return _0x5506f5?{'count':_0x51e061,'rows':_0x5506f5}:null;}})[_0xadb8('0x1a')](respondWithResult(_0x58cccd,null))['catch'](handleError(_0x58cccd,null));};exports[_0xadb8('0x57')]=function(_0x361108,_0x550449){var _0x43ffcd=_0x361108['body'][_0xadb8('0x58')];return db[_0xadb8('0x56')]['findAll']({'where':{'id':_0x43ffcd},'attributes':['id'],'include':[{'model':db[_0xadb8('0x4c')],'as':'Agents','attributes':['id','name',_0xadb8('0x59'),_0xadb8('0x5a'),_0xadb8('0x5b')],'raw':!![]}]})['then'](function(_0x1fa391){if(_0x1fa391){var _0x4216b1=_[_0xadb8('0x5c')](_0x1fa391,function(_0x20a196){var _0x274e1f=_0x20a196[_0xadb8('0x1c')]({'plain':!![]});return _0x274e1f['Agents'];});return db[_0xadb8('0x28')][_0xadb8('0x37')]({'where':{'id':_0x361108[_0xadb8('0x2e')]['id']}})[_0xadb8('0x1a')](function(_0x59755f){return db[_0xadb8('0x5d')][_0xadb8('0x5e')](function(_0x179ccb){return _0x59755f[_0xadb8('0x57')](_0x43ffcd,{'transaction':_0x179ccb})[_0xadb8('0x1a')](function(){return BPromise[_0xadb8('0x5f')](_0x4216b1,function(_0x2c0d1e){return db[_0xadb8('0x42')][_0xadb8('0x60')]({'where':{'UserId':_0x2c0d1e['id'],'MailQueueId':_0x361108['params']['id']},'transaction':_0x179ccb});});})['then'](function(){_0x4216b1[_0xadb8('0x61')](function(_0x2107a5){socket[_0xadb8('0x62')](_0xadb8('0x63'),{'UserId':_0x2107a5['id'],'MailQueueId':_0x59755f['id']});});});});});}})[_0xadb8('0x1a')](respondWithStatusCode(_0x550449,null))[_0xadb8('0x2c')](handleError(_0x550449,null));};exports[_0xadb8('0x64')]=function(_0x177e08,_0x145386){return db[_0xadb8('0x56')]['findAll']({'where':{'id':_0x177e08[_0xadb8('0x2a')][_0xadb8('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xadb8('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x145386,null))[_0xadb8('0x1a')](function(_0x29fa23){var _0x157f00=_[_0xadb8('0x23')](_0x29fa23,'id');var _0xabffff=[];var _0x5b1484=[];var _0x1baf71=squel['select']();_0x1baf71[_0xadb8('0x66')](_0xadb8('0x67'))[_0xadb8('0x68')](_0xadb8('0x69'),'tq')['join'](_0xadb8('0x6a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xadb8('0x6b'),_0x177e08[_0xadb8('0x2e')]['id']);for(var _0xdc3724=0x0;_0xdc3724<_0x29fa23[_0xadb8('0x44')];_0xdc3724+=0x1){let _0xbae2c7=_0x29fa23[_0xdc3724];for(var _0x5e085b=0x0;_0x5e085b<_0xbae2c7[_0xadb8('0x65')][_0xadb8('0x44')];_0x5e085b+=0x1){let _0x276f4f=_0xbae2c7[_0xadb8('0x65')][_0x5e085b];var _0x3a2c44=_0x1baf71['clone']();_0x3a2c44[_0xadb8('0x49')]('ut.UserId\x20=\x20?',_0x276f4f['id']);_0x5b1484[_0xadb8('0x6c')](db['sequelize'][_0xadb8('0x2a')](_0x3a2c44[_0xadb8('0x6d')](),{'type':db[_0xadb8('0x5d')][_0xadb8('0x6e')]['SELECT']})[_0xadb8('0x1a')](function(_0x4ae904){if(_0x4ae904['length']===0x1){return _0x276f4f['id'];}else{var _0x1bc870=_[_0xadb8('0x6f')](_[_0xadb8('0x23')](_0x4ae904,_0xadb8('0x70')),function(_0x21a849){return _['includes'](_0x157f00,_0x21a849);});if(_0x1bc870){return _0x276f4f['id'];}}}));}}return BPromise[_0xadb8('0x71')](_0x5b1484)[_0xadb8('0x1a')](function(_0x194f24){_0xabffff=_(_0xabffff)['union'](_0x194f24)['compact']()['value']();return db[_0xadb8('0x28')][_0xadb8('0x37')]({'where':{'id':_0x177e08[_0xadb8('0x2e')]['id']}})['then'](function(_0x11e3c0){return db[_0xadb8('0x5d')][_0xadb8('0x5e')](function(_0x291f86){return _0x11e3c0['removeTeams'](_0x177e08[_0xadb8('0x2a')][_0xadb8('0x58')],{'transaction':_0x291f86})[_0xadb8('0x1a')](function(){if(!_[_0xadb8('0x72')](_0xabffff)){return _0x11e3c0[_0xadb8('0x73')](_0xabffff,{'transaction':_0x291f86});}})[_0xadb8('0x1a')](function(){_0xabffff['forEach'](function(_0x3cccb8){socket['emit'](_0xadb8('0x74'),{'UserId':_0x3cccb8,'MailQueueId':_0x11e3c0['id']});});});});});});})['then'](respondWithStatusCode(_0x145386,null))[_0xadb8('0x2c')](handleError(_0x145386,null));};exports[_0xadb8('0x75')]=function(_0x553c84,_0x9bb5f1){return db[_0xadb8('0x28')]['find']({'where':{'id':_0x553c84['params']['id']}})[_0xadb8('0x1a')](handleEntityNotFound(_0x9bb5f1,null))[_0xadb8('0x1a')](function(_0x150c24){if(_0x150c24){return _0x150c24[_0xadb8('0x75')](_0x553c84[_0xadb8('0x39')][_0xadb8('0x58')],_[_0xadb8('0x76')](_0x553c84['body'],[_0xadb8('0x58'),'id'])||{})['spread'](function(_0x8d14f8){for(var _0x556c0f=0x0;_0x556c0f<_0x553c84[_0xadb8('0x39')]['ids'][_0xadb8('0x44')];_0x556c0f+=0x1){socket[_0xadb8('0x62')](_0xadb8('0x63'),{'UserId':Number(_0x553c84[_0xadb8('0x39')][_0xadb8('0x58')][_0x556c0f]),'MailQueueId':Number(_0x553c84[_0xadb8('0x2e')]['id'])});}return _0x8d14f8;});}})['then'](respondWithResult(_0x9bb5f1,null))[_0xadb8('0x2c')](handleError(_0x9bb5f1,null));};exports[_0xadb8('0x73')]=function(_0x5b9ba3,_0x40096f){return db[_0xadb8('0x28')][_0xadb8('0x37')]({'where':{'id':_0x5b9ba3[_0xadb8('0x2e')]['id']}})['then'](handleEntityNotFound(_0x40096f,null))['then'](function(_0x61526c){if(_0x61526c){return _0x61526c[_0xadb8('0x73')](_0x5b9ba3[_0xadb8('0x2a')][_0xadb8('0x58')])[_0xadb8('0x1a')](function(){if(_[_0xadb8('0x77')](_0x5b9ba3[_0xadb8('0x2a')]['ids'])){for(var _0x5e2bf8=0x0;_0x5e2bf8<_0x5b9ba3['query'][_0xadb8('0x58')]['length'];_0x5e2bf8+=0x1){socket[_0xadb8('0x62')]('userMailQueue:remove',{'UserId':Number(_0x5b9ba3[_0xadb8('0x2a')]['ids'][_0x5e2bf8]),'MailQueueId':Number(_0x5b9ba3[_0xadb8('0x2e')]['id'])});}}else{socket['emit'](_0xadb8('0x74'),{'UserId':Number(_0x5b9ba3['query'][_0xadb8('0x58')]),'MailQueueId':Number(_0x5b9ba3[_0xadb8('0x2e')]['id'])});}});}})[_0xadb8('0x1a')](respondWithStatusCode(_0x40096f,null))[_0xadb8('0x2c')](handleError(_0x40096f,null));};exports[_0xadb8('0x78')]=function(_0xf7161b,_0x228eae){var _0x23caf3={};var _0x186286={};var _0x4e0c98;var _0x44e753;return db['MailQueue'][_0xadb8('0x41')]({'where':{'id':_0xf7161b[_0xadb8('0x2e')]['id']}})[_0xadb8('0x1a')](handleEntityNotFound(_0x228eae,null))[_0xadb8('0x1a')](function(_0x757e4b){if(_0x757e4b){_0x4e0c98=_0x757e4b;_0x186286[_0xadb8('0x2f')]=_[_0xadb8('0x30')](db[_0xadb8('0x4c')][_0xadb8('0x24')]);_0x186286[_0xadb8('0x2a')]=_[_0xadb8('0x30')](_0xf7161b['query']);_0x186286['filters']=_[_0xadb8('0x32')](_0x186286[_0xadb8('0x2f')],_0x186286[_0xadb8('0x2a')]);_0x23caf3[_0xadb8('0x33')]=_[_0xadb8('0x32')](_0x186286[_0xadb8('0x2f')],qs['fields'](_0xf7161b['query']['fields']));_0x23caf3[_0xadb8('0x33')]=_0x23caf3[_0xadb8('0x33')][_0xadb8('0x44')]?_0x23caf3['attributes']:_0x186286[_0xadb8('0x2f')];_0x23caf3['order']=qs[_0xadb8('0x47')](_0xf7161b[_0xadb8('0x2a')][_0xadb8('0x47')]);_0x23caf3[_0xadb8('0x49')]=qs[_0xadb8('0x31')](_[_0xadb8('0x48')](_0xf7161b[_0xadb8('0x2a')],_0x186286['filters']));if(_0xf7161b['query'][_0xadb8('0x4b')]){_0x23caf3[_0xadb8('0x49')]=_[_0xadb8('0x35')](_0x23caf3['where'],{'$or':_[_0xadb8('0x23')](_0x23caf3['attributes'],function(_0x2a0549){var _0x4e5d87={};_0x4e5d87[_0x2a0549]={'$like':'%'+_0xf7161b['query']['filter']+'%'};return _0x4e5d87;})});}_0x23caf3=_[_0xadb8('0x35')]({},_0x23caf3,_0xf7161b[_0xadb8('0x36')]);return _0x4e0c98[_0xadb8('0x78')](_0x23caf3);}})[_0xadb8('0x1a')](function(_0x498c3e){if(_0x498c3e){_0x44e753=_0x498c3e[_0xadb8('0x44')];if(!_0xf7161b[_0xadb8('0x2a')][_0xadb8('0x79')](_0xadb8('0x45'))){_0x23caf3[_0xadb8('0x13')]=qs[_0xadb8('0x13')](_0xf7161b[_0xadb8('0x2a')][_0xadb8('0x13')]);_0x23caf3[_0xadb8('0x16')]=qs[_0xadb8('0x16')](_0xf7161b[_0xadb8('0x2a')]['offset']);}return _0x4e0c98[_0xadb8('0x78')](_0x23caf3);}})[_0xadb8('0x1a')](function(_0x34b198){if(_0x34b198){return _0x34b198?{'count':_0x44e753,'rows':_0x34b198}:null;}})['then'](respondWithResult(_0x228eae,null))[_0xadb8('0x2c')](handleError(_0x228eae,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c4b7410..4fe370e 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 _0xce83=['exports','events','setMaxListeners','save','remove','emit','hook'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xce83,0x78));var _0x3ce8=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xce83[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require(_0x3ce8('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3ce8('0x1')](0x0);var events={'afterCreate':_0x3ce8('0x2'),'afterUpdate':'update','afterDestroy':_0x3ce8('0x3')};function emitEvent(_0x1990bf){return function(_0x23dea0,_0x53bb5b,_0x2161f1){MailQueueEvents[_0x3ce8('0x4')](_0x1990bf+':'+_0x23dea0['id'],_0x23dea0);MailQueueEvents['emit'](_0x1990bf,_0x23dea0);_0x2161f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x3ce8('0x5')](e,emitEvent(event));}}module[_0x3ce8('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xa63f=['remove','emit','hasOwnProperty','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x5c2f4b,_0xf49d84){var _0x2d23b4=function(_0x20d16d){while(--_0x20d16d){_0x5c2f4b['push'](_0x5c2f4b['shift']());}};_0x2d23b4(++_0xf49d84);}(_0xa63f,0x174));var _0xfa63=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xa63f[_0x37d0bc];return _0x170e60;};'use strict';var EventEmitter=require(_0xfa63('0x0'));var MailQueue=require(_0xfa63('0x1'))['db'][_0xfa63('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xfa63('0x3')](0x0);var events={'afterCreate':_0xfa63('0x4'),'afterUpdate':_0xfa63('0x5'),'afterDestroy':_0xfa63('0x6')};function emitEvent(_0x582708){return function(_0x4f9161,_0x763e51,_0x5e2d5f){MailQueueEvents[_0xfa63('0x7')](_0x582708+':'+_0x4f9161['id'],_0x4f9161);MailQueueEvents[_0xfa63('0x7')](_0x582708,_0x4f9161);_0x5e2d5f(null);};}for(var e in events){if(events[_0xfa63('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 26760dc..9dbe9a0 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 _0x65eb=['define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailQueue.attributes','exports'];(function(_0x5713d5,_0x4bd736){var _0x52e536=function(_0x25fdda){while(--_0x25fdda){_0x5713d5['push'](_0x5713d5['shift']());}};_0x52e536(++_0x4bd736);}(_0x65eb,0x9f));var _0xb65e=function(_0x53e8c9,_0x2ab57d){_0x53e8c9=_0x53e8c9-0x0;var _0x5e0aa9=_0x65eb[_0x53e8c9];return _0x5e0aa9;};'use strict';var _=require(_0xb65e('0x0'));var util=require(_0xb65e('0x1'));var logger=require(_0xb65e('0x2'))('api');var moment=require(_0xb65e('0x3'));var BPromise=require(_0xb65e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb65e('0x5'));var rimraf=require('rimraf');var config=require(_0xb65e('0x6'));var attributes=require(_0xb65e('0x7'));module[_0xb65e('0x8')]=function(_0x2ff7ea,_0x49f1a3){return _0x2ff7ea[_0xb65e('0x9')](_0xb65e('0xa'),attributes,{'tableName':_0xb65e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55c7=['../../config/logger','bluebird','request-promise','rimraf','./mailQueue.attributes','exports','define'];(function(_0x407c39,_0x59d586){var _0x3dbc6a=function(_0x33c869){while(--_0x33c869){_0x407c39['push'](_0x407c39['shift']());}};_0x3dbc6a(++_0x59d586);}(_0x55c7,0xaf));var _0x755c=function(_0x3e5bae,_0x4b4840){_0x3e5bae=_0x3e5bae-0x0;var _0x24a725=_0x55c7[_0x3e5bae];return _0x24a725;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x755c('0x0'))('api');var moment=require('moment');var BPromise=require(_0x755c('0x1'));var rp=require(_0x755c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x755c('0x3'));var config=require('../../config/environment');var attributes=require(_0x755c('0x4'));module[_0x755c('0x5')]=function(_0x378bce,_0x20e4a1){return _0x378bce[_0x755c('0x6')]('MailQueue',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 c7e2923..1e8de81 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 _0x009f=['catch','ShowMailQueue','find','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','debug','request\x20sent','error','code','message','MailQueue,\x20%s,\x20%s','result','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue'];(function(_0x20bb6a,_0x30050f){var _0x3ecd27=function(_0xd5594c){while(--_0xd5594c){_0x20bb6a['push'](_0x20bb6a['shift']());}};_0x3ecd27(++_0x30050f);}(_0x009f,0x194));var _0xf009=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x009f[_0xe896bf];return _0x4c7a8a;};'use strict';var _=require(_0xf009('0x0'));var util=require(_0xf009('0x1'));var moment=require(_0xf009('0x2'));var BPromise=require('bluebird');var rs=require(_0xf009('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf009('0x4'))['db'];var utils=require(_0xf009('0x5'));var logger=require(_0xf009('0x6'))(_0xf009('0x7'));var config=require('../../config/environment');var jayson=require(_0xf009('0x8'));var client=jayson[_0xf009('0x9')][_0xf009('0xa')]({'port':0x232a});config[_0xf009('0xb')]=_[_0xf009('0xc')](config[_0xf009('0xb')],{'host':_0xf009('0xd'),'port':0x18eb});var socket=require(_0xf009('0xe'))(new Redis(config[_0xf009('0xb')]));require('./mailQueue.socket')[_0xf009('0xf')](socket);function respondWithRpcPromise(_0x48a457,_0x39427c,_0x175804){return new BPromise(function(_0x1798cf,_0x163f6f){return client['request'](_0x48a457,_0x175804)[_0xf009('0x10')](function(_0x2b8892){logger[_0xf009('0x11')]('MailQueue,\x20%s,\x20%s',_0x39427c,'request\x20sent');logger[_0xf009('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x39427c,_0xf009('0x13'),JSON['stringify'](_0x2b8892));if(_0x2b8892[_0xf009('0x14')]){if(_0x2b8892[_0xf009('0x14')][_0xf009('0x15')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x39427c,_0x2b8892[_0xf009('0x14')][_0xf009('0x16')]);return _0x163f6f(_0x2b8892[_0xf009('0x14')][_0xf009('0x16')]);}logger[_0xf009('0x14')](_0xf009('0x17'),_0x39427c,_0x2b8892[_0xf009('0x14')][_0xf009('0x16')]);return _0x1798cf(_0x2b8892['error'][_0xf009('0x16')]);}else{logger[_0xf009('0x11')](_0xf009('0x17'),_0x39427c,_0xf009('0x13'));_0x1798cf(_0x2b8892[_0xf009('0x18')][_0xf009('0x16')]);}})['catch'](function(_0x4efc36){logger[_0xf009('0x14')](_0xf009('0x17'),_0x39427c,_0x4efc36);_0x163f6f(_0x4efc36);});});}exports['GetMailQueue']=function(_0x33617b){var _0x3d4d80=this;return new Promise(function(_0x427386,_0x2829b2){return db[_0xf009('0x19')][_0xf009('0x1a')]({'raw':_0x33617b['options']?_0x33617b[_0xf009('0x1b')][_0xf009('0x1c')]===undefined?!![]:![]:!![],'where':_0x33617b[_0xf009('0x1b')]?_0x33617b['options'][_0xf009('0x1d')]||null:null,'attributes':_0x33617b[_0xf009('0x1b')]?_0x33617b[_0xf009('0x1b')][_0xf009('0x1e')]||null:null,'limit':_0x33617b[_0xf009('0x1b')]?_0x33617b[_0xf009('0x1b')][_0xf009('0x1f')]||null:null,'include':_0x33617b['options']?_0x33617b['options']['include']?_[_0xf009('0x20')](_0x33617b[_0xf009('0x1b')][_0xf009('0x21')],function(_0x33cce9){return{'model':db[_0x33cce9[_0xf009('0x22')]],'as':_0x33cce9['as'],'attributes':_0x33cce9['attributes'],'include':_0x33cce9['include']?_[_0xf009('0x20')](_0x33cce9[_0xf009('0x21')],function(_0x2e0d2c){return{'model':db[_0x2e0d2c[_0xf009('0x22')]],'as':_0x2e0d2c['as'],'attributes':_0x2e0d2c[_0xf009('0x1e')],'include':_0x2e0d2c[_0xf009('0x21')]?_['map'](_0x2e0d2c[_0xf009('0x21')],function(_0x4045e5){return{'model':db[_0x4045e5[_0xf009('0x22')]],'as':_0x4045e5['as'],'attributes':_0x4045e5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x285c93){logger[_0xf009('0x11')](_0xf009('0x23'),_0x33617b);logger[_0xf009('0x12')](_0xf009('0x23'),_0x33617b,JSON['stringify'](_0x285c93));_0x427386(_0x285c93);})[_0xf009('0x24')](function(_0x382925){logger[_0xf009('0x14')](_0xf009('0x23'),_0x382925[_0xf009('0x16')],_0x33617b);_0x2829b2(_0x3d4d80[_0xf009('0x14')](0x1f4,_0x382925[_0xf009('0x16')]));});});};exports[_0xf009('0x25')]=function(_0x29cdd3){var _0x1aff17=this;return new Promise(function(_0x24ecd1,_0x29e433){return db['MailQueue'][_0xf009('0x26')]({'raw':_0x29cdd3[_0xf009('0x1b')]?_0x29cdd3[_0xf009('0x1b')][_0xf009('0x1c')]===undefined?!![]:![]:!![],'where':_0x29cdd3[_0xf009('0x1b')]?_0x29cdd3[_0xf009('0x1b')][_0xf009('0x1d')]||null:null,'attributes':_0x29cdd3['options']?_0x29cdd3[_0xf009('0x1b')]['attributes']||null:null,'include':_0x29cdd3['options']?_0x29cdd3[_0xf009('0x1b')][_0xf009('0x21')]?_[_0xf009('0x20')](_0x29cdd3[_0xf009('0x1b')]['include'],function(_0x266088){return{'model':db[_0x266088[_0xf009('0x22')]],'as':_0x266088['as'],'attributes':_0x266088[_0xf009('0x1e')],'include':_0x266088['include']?_[_0xf009('0x20')](_0x266088['include'],function(_0x599409){return{'model':db[_0x599409[_0xf009('0x22')]],'as':_0x599409['as'],'attributes':_0x599409['attributes'],'include':_0x599409['include']?_['map'](_0x599409['include'],function(_0x2c42fc){return{'model':db[_0x2c42fc[_0xf009('0x22')]],'as':_0x2c42fc['as'],'attributes':_0x2c42fc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5df1ac){logger[_0xf009('0x11')](_0xf009('0x25'),_0x29cdd3);logger[_0xf009('0x12')](_0xf009('0x25'),_0x29cdd3,JSON[_0xf009('0x27')](_0x5df1ac));_0x24ecd1(_0x5df1ac);})[_0xf009('0x24')](function(_0xf9f2e6){logger[_0xf009('0x14')](_0xf009('0x25'),_0xf9f2e6['message'],_0x29cdd3);_0x29e433(_0x1aff17['error'](0x1f4,_0xf9f2e6['message']));});});}; \ No newline at end of file +var _0x17d6=['jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include','map','model','then','find','where','ShowMailQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5edef8,_0x7af9a9){var _0x5438f6=function(_0x1ad5db){while(--_0x1ad5db){_0x5edef8['push'](_0x5edef8['shift']());}};_0x5438f6(++_0x7af9a9);}(_0x17d6,0xbc));var _0x617d=function(_0x33a1d8,_0x2d5632){_0x33a1d8=_0x33a1d8-0x0;var _0x4e1184=_0x17d6[_0x33a1d8];return _0x4e1184;};'use strict';var _=require('lodash');var util=require(_0x617d('0x0'));var moment=require('moment');var BPromise=require(_0x617d('0x1'));var rs=require(_0x617d('0x2'));var fs=require('fs');var Redis=require(_0x617d('0x3'));var db=require(_0x617d('0x4'))['db'];var utils=require(_0x617d('0x5'));var logger=require(_0x617d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x617d('0x7'));var client=jayson['client'][_0x617d('0x8')]({'port':0x232a});config[_0x617d('0x9')]=_['defaults'](config['redis'],{'host':_0x617d('0xa'),'port':0x18eb});var socket=require(_0x617d('0xb'))(new Redis(config[_0x617d('0x9')]));require(_0x617d('0xc'))[_0x617d('0xd')](socket);function respondWithRpcPromise(_0x45ee33,_0x5a045a,_0x4cdc68){return new BPromise(function(_0x1ea753,_0x1f1bcd){return client['request'](_0x45ee33,_0x4cdc68)['then'](function(_0x560c25){logger[_0x617d('0xe')]('MailQueue,\x20%s,\x20%s',_0x5a045a,_0x617d('0xf'));logger[_0x617d('0x10')](_0x617d('0x11'),_0x5a045a,_0x617d('0xf'),JSON[_0x617d('0x12')](_0x560c25));if(_0x560c25[_0x617d('0x13')]){if(_0x560c25[_0x617d('0x13')][_0x617d('0x14')]===0x1f4){logger[_0x617d('0x13')]('MailQueue,\x20%s,\x20%s',_0x5a045a,_0x560c25['error'][_0x617d('0x15')]);return _0x1f1bcd(_0x560c25['error']['message']);}logger[_0x617d('0x13')](_0x617d('0x16'),_0x5a045a,_0x560c25['error']['message']);return _0x1ea753(_0x560c25['error'][_0x617d('0x15')]);}else{logger[_0x617d('0xe')]('MailQueue,\x20%s,\x20%s',_0x5a045a,'request\x20sent');_0x1ea753(_0x560c25[_0x617d('0x17')][_0x617d('0x15')]);}})[_0x617d('0x18')](function(_0x4ea615){logger[_0x617d('0x13')](_0x617d('0x16'),_0x5a045a,_0x4ea615);_0x1f1bcd(_0x4ea615);});});}exports[_0x617d('0x19')]=function(_0x1a294c){var _0x3a49e3=this;return new Promise(function(_0x32a980,_0x44333a){return db[_0x617d('0x1a')][_0x617d('0x1b')]({'raw':_0x1a294c[_0x617d('0x1c')]?_0x1a294c[_0x617d('0x1c')][_0x617d('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a294c[_0x617d('0x1c')]?_0x1a294c[_0x617d('0x1c')]['where']||null:null,'attributes':_0x1a294c[_0x617d('0x1c')]?_0x1a294c[_0x617d('0x1c')][_0x617d('0x1e')]||null:null,'limit':_0x1a294c[_0x617d('0x1c')]?_0x1a294c['options'][_0x617d('0x1f')]||null:null,'include':_0x1a294c['options']?_0x1a294c[_0x617d('0x1c')][_0x617d('0x20')]?_[_0x617d('0x21')](_0x1a294c[_0x617d('0x1c')][_0x617d('0x20')],function(_0x3c69a2){return{'model':db[_0x3c69a2[_0x617d('0x22')]],'as':_0x3c69a2['as'],'attributes':_0x3c69a2[_0x617d('0x1e')],'include':_0x3c69a2[_0x617d('0x20')]?_[_0x617d('0x21')](_0x3c69a2[_0x617d('0x20')],function(_0x193e74){return{'model':db[_0x193e74['model']],'as':_0x193e74['as'],'attributes':_0x193e74['attributes'],'include':_0x193e74['include']?_[_0x617d('0x21')](_0x193e74[_0x617d('0x20')],function(_0x5e6c8e){return{'model':db[_0x5e6c8e[_0x617d('0x22')]],'as':_0x5e6c8e['as'],'attributes':_0x5e6c8e[_0x617d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x617d('0x23')](function(_0x3c2b1f){logger[_0x617d('0xe')](_0x617d('0x19'),_0x1a294c);logger[_0x617d('0x10')](_0x617d('0x19'),_0x1a294c,JSON[_0x617d('0x12')](_0x3c2b1f));_0x32a980(_0x3c2b1f);})['catch'](function(_0x1040f6){logger['error'](_0x617d('0x19'),_0x1040f6[_0x617d('0x15')],_0x1a294c);_0x44333a(_0x3a49e3['error'](0x1f4,_0x1040f6[_0x617d('0x15')]));});});};exports['ShowMailQueue']=function(_0x7cca2a){var _0x4e9f81=this;return new Promise(function(_0x167b6e,_0x521999){return db[_0x617d('0x1a')][_0x617d('0x24')]({'raw':_0x7cca2a[_0x617d('0x1c')]?_0x7cca2a[_0x617d('0x1c')][_0x617d('0x1d')]===undefined?!![]:![]:!![],'where':_0x7cca2a['options']?_0x7cca2a[_0x617d('0x1c')][_0x617d('0x25')]||null:null,'attributes':_0x7cca2a[_0x617d('0x1c')]?_0x7cca2a['options'][_0x617d('0x1e')]||null:null,'include':_0x7cca2a[_0x617d('0x1c')]?_0x7cca2a[_0x617d('0x1c')][_0x617d('0x20')]?_[_0x617d('0x21')](_0x7cca2a[_0x617d('0x1c')][_0x617d('0x20')],function(_0x590c94){return{'model':db[_0x590c94[_0x617d('0x22')]],'as':_0x590c94['as'],'attributes':_0x590c94[_0x617d('0x1e')],'include':_0x590c94[_0x617d('0x20')]?_[_0x617d('0x21')](_0x590c94[_0x617d('0x20')],function(_0x2fc93f){return{'model':db[_0x2fc93f[_0x617d('0x22')]],'as':_0x2fc93f['as'],'attributes':_0x2fc93f[_0x617d('0x1e')],'include':_0x2fc93f[_0x617d('0x20')]?_[_0x617d('0x21')](_0x2fc93f[_0x617d('0x20')],function(_0x132d0e){return{'model':db[_0x132d0e[_0x617d('0x22')]],'as':_0x132d0e['as'],'attributes':_0x132d0e[_0x617d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x617d('0x23')](function(_0x129260){logger[_0x617d('0xe')](_0x617d('0x26'),_0x7cca2a);logger[_0x617d('0x10')]('ShowMailQueue',_0x7cca2a,JSON[_0x617d('0x12')](_0x129260));_0x167b6e(_0x129260);})[_0x617d('0x18')](function(_0x111ca8){logger[_0x617d('0x13')](_0x617d('0x26'),_0x111ca8[_0x617d('0x15')],_0x7cca2a);_0x521999(_0x4e9f81[_0x617d('0x13')](0x1f4,_0x111ca8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e909df4..5209a7c 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 _0x92a3=['remove','update','emit','removeListener','register','./mailQueue.events','save'];(function(_0x4e76cb,_0x2fbc24){var _0x458e7d=function(_0x26670e){while(--_0x26670e){_0x4e76cb['push'](_0x4e76cb['shift']());}};_0x458e7d(++_0x2fbc24);}(_0x92a3,0x140));var _0x392a=function(_0x1d344b,_0x3a2a0a){_0x1d344b=_0x1d344b-0x0;var _0x4f3b20=_0x92a3[_0x1d344b];return _0x4f3b20;};'use strict';var MailQueueEvents=require(_0x392a('0x0'));var events=[_0x392a('0x1'),_0x392a('0x2'),_0x392a('0x3')];function createListener(_0x4df5d3,_0x20f259){return function(_0x41fc48){_0x20f259[_0x392a('0x4')](_0x4df5d3,_0x41fc48);};}function removeListener(_0x27d515,_0x1007b6){return function(){MailQueueEvents[_0x392a('0x5')](_0x27d515,_0x1007b6);};}exports[_0x392a('0x6')]=function(_0x5988cc){for(var _0x1af800=0x0,_0x38cbde=events['length'];_0x1af800<_0x38cbde;_0x1af800++){var _0x41f599=events[_0x1af800];var _0xe4c3b=createListener('mailQueue:'+_0x41f599,_0x5988cc);MailQueueEvents['on'](_0x41f599,_0xe4c3b);}}; \ No newline at end of file +var _0x4138=['mailQueue:','remove','emit','register','length'];(function(_0xa84d17,_0x29a944){var _0x52e751=function(_0x51ad27){while(--_0x51ad27){_0xa84d17['push'](_0xa84d17['shift']());}};_0x52e751(++_0x29a944);}(_0x4138,0xce));var _0x8413=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4138[_0x6c993a];return _0x27f547;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x8413('0x0'),'update'];function createListener(_0x3b3555,_0x417efa){return function(_0x36c168){_0x417efa[_0x8413('0x1')](_0x3b3555,_0x36c168);};}function removeListener(_0x494486,_0x485249){return function(){MailQueueEvents['removeListener'](_0x494486,_0x485249);};}exports[_0x8413('0x2')]=function(_0xef7742){for(var _0x3f4283=0x0,_0x58867c=events[_0x8413('0x3')];_0x3f4283<_0x58867c;_0x3f4283++){var _0x46f82f=events[_0x3f4283];var _0x3e5c61=createListener(_0x8413('0x4')+_0x46f82f,_0xef7742);MailQueueEvents['on'](_0x46f82f,_0x3e5c61);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 99eb97d..664e1bd 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 _0x78ed=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x1081a3,_0x2ac784){var _0x5696a2=function(_0x23d2f6){while(--_0x23d2f6){_0x1081a3['push'](_0x1081a3['shift']());}};_0x5696a2(++_0x2ac784);}(_0x78ed,0x191));var _0xd78e=function(_0x5af3dc,_0x10a54c){_0x5af3dc=_0x5af3dc-0x0;var _0x1ea202=_0x78ed[_0x5af3dc];return _0x1ea202;};'use strict';var multer=require(_0xd78e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd78e('0x1'));var express=require(_0xd78e('0x2'));var router=express[_0xd78e('0x3')]();var fs_extra=require(_0xd78e('0x4'));var auth=require(_0xd78e('0x5'));var interaction=require(_0xd78e('0x6'));var config=require(_0xd78e('0x7'));var controller=require('./mailQueueReport.controller');router[_0xd78e('0x8')]('/',auth[_0xd78e('0x9')](),controller['index']);router['get'](_0xd78e('0xa'),auth[_0xd78e('0x9')](),controller[_0xd78e('0xb')]);router['get'](_0xd78e('0xc'),auth[_0xd78e('0x9')](),controller[_0xd78e('0xd')]);router[_0xd78e('0xe')]('/',auth[_0xd78e('0x9')](),controller[_0xd78e('0xf')]);router[_0xd78e('0x10')]('/:id',auth[_0xd78e('0x9')](),controller[_0xd78e('0x11')]);router[_0xd78e('0x12')](_0xd78e('0xc'),auth[_0xd78e('0x9')](),controller['destroy']);module[_0xd78e('0x13')]=router; \ No newline at end of file +var _0xc9df=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x514835,_0x95fcdf){var _0x44c151=function(_0x1a23ca){while(--_0x1a23ca){_0x514835['push'](_0x514835['shift']());}};_0x44c151(++_0x95fcdf);}(_0xc9df,0x105));var _0xfc9d=function(_0x51b6b5,_0x3957cf){_0x51b6b5=_0x51b6b5-0x0;var _0x5b7633=_0xc9df[_0x51b6b5];return _0x5b7633;};'use strict';var multer=require(_0xfc9d('0x0'));var util=require(_0xfc9d('0x1'));var path=require(_0xfc9d('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc9d('0x3'));var router=express[_0xfc9d('0x4')]();var fs_extra=require(_0xfc9d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfc9d('0x6'));var config=require(_0xfc9d('0x7'));var controller=require(_0xfc9d('0x8'));router[_0xfc9d('0x9')]('/',auth['isAuthenticated'](),controller[_0xfc9d('0xa')]);router['get'](_0xfc9d('0xb'),auth[_0xfc9d('0xc')](),controller[_0xfc9d('0xd')]);router[_0xfc9d('0x9')](_0xfc9d('0xe'),auth[_0xfc9d('0xc')](),controller[_0xfc9d('0xf')]);router[_0xfc9d('0x10')]('/',auth[_0xfc9d('0xc')](),controller[_0xfc9d('0x11')]);router[_0xfc9d('0x12')](_0xfc9d('0xe'),auth[_0xfc9d('0xc')](),controller[_0xfc9d('0x13')]);router[_0xfc9d('0x14')](_0xfc9d('0xe'),auth[_0xfc9d('0xc')](),controller[_0xfc9d('0x15')]);module[_0xfc9d('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 37b598f..fe16ad7 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 _0xfb65=['STRING','DATE','sequelize','exports'];(function(_0x12ece8,_0x2508d7){var _0x236bce=function(_0x41d0f6){while(--_0x41d0f6){_0x12ece8['push'](_0x12ece8['shift']());}};_0x236bce(++_0x2508d7);}(_0xfb65,0x82));var _0x5fb6=function(_0x38b87e,_0x2aa16e){_0x38b87e=_0x38b87e-0x0;var _0x4209d9=_0xfb65[_0x38b87e];return _0x4209d9;};'use strict';var moment=require('moment');var Sequelize=require(_0x5fb6('0x0'));module[_0x5fb6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5fb6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5fb6('0x3')]},'acceptAt':{'type':Sequelize[_0x5fb6('0x3')]},'exitAt':{'type':Sequelize[_0x5fb6('0x3')]},'reason':{'type':Sequelize[_0x5fb6('0x2')]}}; \ No newline at end of file +var _0xb97c=['moment','sequelize','STRING','DATE'];(function(_0x25b750,_0x4b31ed){var _0x2c3f5c=function(_0x5f1ca6){while(--_0x5f1ca6){_0x25b750['push'](_0x25b750['shift']());}};_0x2c3f5c(++_0x4b31ed);}(_0xb97c,0x168));var _0xcb97=function(_0x5d5d5e,_0x155129){_0x5d5d5e=_0x5d5d5e-0x0;var _0x1a7154=_0xb97c[_0x5d5d5e];return _0x1a7154;};'use strict';var moment=require(_0xcb97('0x0'));var Sequelize=require(_0xcb97('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcb97('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcb97('0x3')]},'leaveAt':{'type':Sequelize[_0xcb97('0x3')]},'acceptAt':{'type':Sequelize[_0xcb97('0x3')]},'exitAt':{'type':Sequelize[_0xcb97('0x3')]},'reason':{'type':Sequelize[_0xcb97('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f15a780..5c83775 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x4090e2,_0x3c77ee){var _0x44b887=function(_0x5eded2){while(--_0x5eded2){_0x4090e2['push'](_0x4090e2['shift']());}};_0x44b887(++_0x3c77ee);}(_0x47c5,0x165));var _0x547c=function(_0x12130b,_0x1e5d98){_0x12130b=_0x12130b-0x0;var _0x398370=_0x47c5[_0x12130b];return _0x398370;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['MailQueueReport'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['MailQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['MailQueueReport'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['MailQueueReport'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','MailQueueReport','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0xc038ba,_0x55db6f){var _0x8ff2bf=function(_0x5b7685){while(--_0x5b7685){_0xc038ba['push'](_0xc038ba['shift']());}};_0x8ff2bf(++_0x55db6f);}(_0xb016,0x159));var _0x6b01=function(_0x592f8a,_0x5bfe66){_0x592f8a=_0x592f8a-0x0;var _0x4edefb=_0xb016[_0x592f8a];return _0x4edefb;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['MailQueueReport'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 39036a6..77815c4 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 _0x5699=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes'];(function(_0x38a155,_0x2aa026){var _0x269403=function(_0x47263b){while(--_0x47263b){_0x38a155['push'](_0x38a155['shift']());}};_0x269403(++_0x2aa026);}(_0x5699,0x148));var _0x9569=function(_0x571a9d,_0x55f1a4){_0x571a9d=_0x571a9d-0x0;var _0x592105=_0x5699[_0x571a9d];return _0x592105;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var logger=require(_0x9569('0x2'))('api');var moment=require(_0x9569('0x3'));var BPromise=require(_0x9569('0x4'));var rp=require(_0x9569('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9569('0x6'));var attributes=require(_0x9569('0x7'));module['exports']=function(_0x24a67d,_0x47397a){return _0x24a67d[_0x9569('0x8')](_0x9569('0x9'),attributes,{'tableName':_0x9569('0xa'),'paranoid':![],'indexes':[{'name':_0x9569('0xb'),'fields':[_0x9569('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c7a=['rimraf','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7c7a,0x1d4));var _0xa7c7=function(_0x57dfeb,_0x3b4938){_0x57dfeb=_0x57dfeb-0x0;var _0x2de95b=_0x7c7a[_0x57dfeb];return _0x2de95b;};'use strict';var _=require(_0xa7c7('0x0'));var util=require(_0xa7c7('0x1'));var logger=require(_0xa7c7('0x2'))(_0xa7c7('0x3'));var moment=require(_0xa7c7('0x4'));var BPromise=require(_0xa7c7('0x5'));var rp=require(_0xa7c7('0x6'));var fs=require('fs');var path=require(_0xa7c7('0x7'));var rimraf=require(_0xa7c7('0x8'));var config=require('../../config/environment');var attributes=require(_0xa7c7('0x9'));module[_0xa7c7('0xa')]=function(_0x4d6419,_0x5894ac){return _0x4d6419['define'](_0xa7c7('0xb'),attributes,{'tableName':_0xa7c7('0xc'),'paranoid':![],'indexes':[{'name':_0xa7c7('0xd'),'fields':[_0xa7c7('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 5d47d51..1977f23 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3948ec,_0x3dfb10){var _0x2ad8f4=function(_0x4282fb){while(--_0x4282fb){_0x3948ec['push'](_0x3948ec['shift']());}};_0x2ad8f4(++_0x3dfb10);}(_0x2ef3,0xba));var _0x32ef=function(_0x11e942,_0x29dbe8){_0x11e942=_0x11e942-0x0;var _0x456e68=_0x2ef3[_0x11e942];return _0x456e68;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x317536,_0x12832d){var _0x181d99=function(_0x38f079){while(--_0x38f079){_0x317536['push'](_0x317536['shift']());}};_0x181d99(++_0x12832d);}(_0xadb5,0xad));var _0x5adb=function(_0x2e4280,_0x11c5c2){_0x2e4280=_0x2e4280-0x0;var _0x3df262=_0xadb5[_0x2e4280];return _0x3df262;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 8677fc3..ad3617d 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd40663,_0x2821ee){var _0x5b0a74=function(_0x779c5c){while(--_0x779c5c){_0xd40663['push'](_0xd40663['shift']());}};_0x5b0a74(++_0x2821ee);}(_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(_0x1bbfbe,_0x1f60b0){var _0x499c16=function(_0x4991e3){while(--_0x4991e3){_0x1bbfbe['push'](_0x1bbfbe['shift']());}};_0x499c16(++_0x1f60b0);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 58af48f..f33d0ab 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 _0x4421=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0xf5b6e,_0x46a714){var _0x2d0afb=function(_0x2a6296){while(--_0x2a6296){_0xf5b6e['push'](_0xf5b6e['shift']());}};_0x2d0afb(++_0x46a714);}(_0x4421,0xbb));var _0x1442=function(_0x2fae20,_0x41cf52){_0x2fae20=_0x2fae20-0x0;var _0x48de81=_0x4421[_0x2fae20];return _0x48de81;};'use strict';var Sequelize=require('sequelize');module[_0x1442('0x0')]={'description':{'type':Sequelize[_0x1442('0x1')]},'host':{'type':Sequelize[_0x1442('0x1')]},'authentication':{'type':Sequelize[_0x1442('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1442('0x1')]},'password':{'type':Sequelize[_0x1442('0x1')]},'port':{'type':Sequelize[_0x1442('0x3')]},'tls':{'type':Sequelize[_0x1442('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1442('0x1')],'defaultValue':_0x1442('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1442('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1442('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1442('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc60b=['INTEGER','STRING','BOOLEAN','INBOX'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc60b,0x1c1));var _0xbc60=function(_0x213160,_0x1100e9){_0x213160=_0x213160-0x0;var _0x340e76=_0xc60b[_0x213160];return _0x340e76;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xbc60('0x0')]},'host':{'type':Sequelize[_0xbc60('0x0')]},'authentication':{'type':Sequelize[_0xbc60('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbc60('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xbc60('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xbc60('0x0')],'defaultValue':_0xbc60('0x2')},'connTimeout':{'type':Sequelize[_0xbc60('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xbc60('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 25abf29..244675d 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 _0x369e=['bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','lodash','util','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x369e,0xf9));var _0xe369=function(_0x451913,_0x29e24a){_0x451913=_0x451913-0x0;var _0x45f885=_0x369e[_0x451913];return _0x45f885;};'use strict';var _=require(_0xe369('0x0'));var util=require(_0xe369('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe369('0x2'));var BPromise=require(_0xe369('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe369('0x4'));var config=require(_0xe369('0x5'));var attributes=require(_0xe369('0x6'));module[_0xe369('0x7')]=function(_0x49d6f2,_0x9fb4eb){return _0x49d6f2[_0xe369('0x8')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ce8=['api','bluebird','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x191e32,_0x3816a4){var _0x5ceca7=function(_0x264433){while(--_0x264433){_0x191e32['push'](_0x191e32['shift']());}};_0x5ceca7(++_0x3816a4);}(_0x2ce8,0xb8));var _0x82ce=function(_0x29e2ba,_0x1b171f){_0x29e2ba=_0x29e2ba-0x0;var _0x5c5920=_0x2ce8[_0x29e2ba];return _0x5c5920;};'use strict';var _=require(_0x82ce('0x0'));var util=require(_0x82ce('0x1'));var logger=require(_0x82ce('0x2'))(_0x82ce('0x3'));var moment=require('moment');var BPromise=require(_0x82ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x82ce('0x5'));var config=require('../../config/environment');var attributes=require(_0x82ce('0x6'));module[_0x82ce('0x7')]=function(_0x4b7007,_0xb04b6){return _0x4b7007[_0x82ce('0x8')](_0x82ce('0x9'),attributes,{'tableName':_0x82ce('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 a293cf1..3a1131c 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 _0x495c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x12b21,_0xf056b0){var _0x140f6a=function(_0x199065){while(--_0x199065){_0x12b21['push'](_0x12b21['shift']());}};_0x140f6a(++_0xf056b0);}(_0x495c,0xdb));var _0xc495=function(_0x133858,_0x24ea1b){_0x133858=_0x133858-0x0;var _0x447323=_0x495c[_0x133858];return _0x447323;};'use strict';var _=require('lodash');var util=require(_0xc495('0x0'));var moment=require(_0xc495('0x1'));var BPromise=require(_0xc495('0x2'));var rs=require(_0xc495('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc495('0x4'))['db'];var utils=require(_0xc495('0x5'));var logger=require(_0xc495('0x6'))(_0xc495('0x7'));var config=require('../../config/environment');var jayson=require(_0xc495('0x8'));var client=jayson[_0xc495('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77d109,_0x460f1a,_0x548bce){return new BPromise(function(_0x4e4f24,_0xb70ffa){return client['request'](_0x77d109,_0x548bce)[_0xc495('0xa')](function(_0x369b65){logger[_0xc495('0xb')](_0xc495('0xc'),_0x460f1a,'request\x20sent');logger[_0xc495('0xd')](_0xc495('0xe'),_0x460f1a,_0xc495('0xf'),JSON['stringify'](_0x369b65));if(_0x369b65['error']){if(_0x369b65['error']['code']===0x1f4){logger[_0xc495('0x10')]('MailServerIn,\x20%s,\x20%s',_0x460f1a,_0x369b65['error'][_0xc495('0x11')]);return _0xb70ffa(_0x369b65['error']['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x460f1a,_0x369b65[_0xc495('0x10')][_0xc495('0x11')]);return _0x4e4f24(_0x369b65['error'][_0xc495('0x11')]);}else{logger['info'](_0xc495('0xc'),_0x460f1a,_0xc495('0xf'));_0x4e4f24(_0x369b65[_0xc495('0x12')][_0xc495('0x11')]);}})[_0xc495('0x13')](function(_0x2fc927){logger[_0xc495('0x10')](_0xc495('0xc'),_0x460f1a,_0x2fc927);_0xb70ffa(_0x2fc927);});});}exports[_0xc495('0x14')]=function(_0x2a67ad){var _0x4b0fff=this;return new Promise(function(_0x4adb5d,_0x5a3675){return db[_0xc495('0x15')][_0xc495('0x16')]({'raw':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad[_0xc495('0x17')][_0xc495('0x18')]===undefined?!![]:![]:!![],'where':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad['options'][_0xc495('0x19')]||null:null,'attributes':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad['options'][_0xc495('0x1a')]||null:null,'limit':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad[_0xc495('0x17')][_0xc495('0x1b')]||null:null,'include':_0x2a67ad['options']?_0x2a67ad[_0xc495('0x17')][_0xc495('0x1c')]?_[_0xc495('0x1d')](_0x2a67ad[_0xc495('0x17')][_0xc495('0x1c')],function(_0x3c287d){return{'model':db[_0x3c287d['model']],'as':_0x3c287d['as'],'attributes':_0x3c287d[_0xc495('0x1a')],'include':_0x3c287d['include']?_[_0xc495('0x1d')](_0x3c287d[_0xc495('0x1c')],function(_0x3da963){return{'model':db[_0x3da963[_0xc495('0x1e')]],'as':_0x3da963['as'],'attributes':_0x3da963[_0xc495('0x1a')],'include':_0x3da963['include']?_['map'](_0x3da963[_0xc495('0x1c')],function(_0x5782c4){return{'model':db[_0x5782c4['model']],'as':_0x5782c4['as'],'attributes':_0x5782c4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc495('0xa')](function(_0x2168c5){logger[_0xc495('0xb')]('GetMailServerIn',_0x2a67ad);logger[_0xc495('0xd')](_0xc495('0x14'),_0x2a67ad,JSON[_0xc495('0x1f')](_0x2168c5));_0x4adb5d(_0x2168c5);})[_0xc495('0x13')](function(_0x4da9c2){logger['error']('GetMailServerIn',_0x4da9c2['message'],_0x2a67ad);_0x5a3675(_0x4b0fff[_0xc495('0x10')](0x1f4,_0x4da9c2['message']));});});}; \ No newline at end of file +var _0xc8be=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','debug','catch','lodash'];(function(_0x13bc6f,_0x46851f){var _0x538a31=function(_0x4f73f0){while(--_0x4f73f0){_0x13bc6f['push'](_0x13bc6f['shift']());}};_0x538a31(++_0x46851f);}(_0xc8be,0x15d));var _0xec8b=function(_0x41b846,_0x5004bf){_0x41b846=_0x41b846-0x0;var _0x2d471f=_0xc8be[_0x41b846];return _0x2d471f;};'use strict';var _=require(_0xec8b('0x0'));var util=require(_0xec8b('0x1'));var moment=require(_0xec8b('0x2'));var BPromise=require(_0xec8b('0x3'));var rs=require(_0xec8b('0x4'));var fs=require('fs');var Redis=require(_0xec8b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec8b('0x6'));var logger=require(_0xec8b('0x7'))(_0xec8b('0x8'));var config=require(_0xec8b('0x9'));var jayson=require(_0xec8b('0xa'));var client=jayson[_0xec8b('0xb')][_0xec8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a1412,_0x3d5088,_0x47bcef){return new BPromise(function(_0x36b91a,_0x22bda1){return client[_0xec8b('0xd')](_0x5a1412,_0x47bcef)[_0xec8b('0xe')](function(_0x1e2046){logger['info'](_0xec8b('0xf'),_0x3d5088,_0xec8b('0x10'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3d5088,_0xec8b('0x10'),JSON[_0xec8b('0x11')](_0x1e2046));if(_0x1e2046[_0xec8b('0x12')]){if(_0x1e2046[_0xec8b('0x12')][_0xec8b('0x13')]===0x1f4){logger['error'](_0xec8b('0xf'),_0x3d5088,_0x1e2046[_0xec8b('0x12')][_0xec8b('0x14')]);return _0x22bda1(_0x1e2046[_0xec8b('0x12')]['message']);}logger[_0xec8b('0x12')]('MailServerIn,\x20%s,\x20%s',_0x3d5088,_0x1e2046['error']['message']);return _0x36b91a(_0x1e2046[_0xec8b('0x12')][_0xec8b('0x14')]);}else{logger[_0xec8b('0x15')](_0xec8b('0xf'),_0x3d5088,'request\x20sent');_0x36b91a(_0x1e2046[_0xec8b('0x16')][_0xec8b('0x14')]);}})['catch'](function(_0x5513b0){logger['error']('MailServerIn,\x20%s,\x20%s',_0x3d5088,_0x5513b0);_0x22bda1(_0x5513b0);});});}exports[_0xec8b('0x17')]=function(_0x550cf7){var _0x556ba6=this;return new Promise(function(_0x1669da,_0x5bfd3b){return db[_0xec8b('0x18')]['findAll']({'raw':_0x550cf7[_0xec8b('0x19')]?_0x550cf7['options'][_0xec8b('0x1a')]===undefined?!![]:![]:!![],'where':_0x550cf7[_0xec8b('0x19')]?_0x550cf7[_0xec8b('0x19')][_0xec8b('0x1b')]||null:null,'attributes':_0x550cf7['options']?_0x550cf7[_0xec8b('0x19')][_0xec8b('0x1c')]||null:null,'limit':_0x550cf7[_0xec8b('0x19')]?_0x550cf7[_0xec8b('0x19')][_0xec8b('0x1d')]||null:null,'include':_0x550cf7['options']?_0x550cf7[_0xec8b('0x19')][_0xec8b('0x1e')]?_[_0xec8b('0x1f')](_0x550cf7[_0xec8b('0x19')][_0xec8b('0x1e')],function(_0x3ee1e2){return{'model':db[_0x3ee1e2['model']],'as':_0x3ee1e2['as'],'attributes':_0x3ee1e2['attributes'],'include':_0x3ee1e2[_0xec8b('0x1e')]?_['map'](_0x3ee1e2[_0xec8b('0x1e')],function(_0x46cf22){return{'model':db[_0x46cf22[_0xec8b('0x20')]],'as':_0x46cf22['as'],'attributes':_0x46cf22['attributes'],'include':_0x46cf22[_0xec8b('0x1e')]?_[_0xec8b('0x1f')](_0x46cf22['include'],function(_0x36d7a6){return{'model':db[_0x36d7a6[_0xec8b('0x20')]],'as':_0x36d7a6['as'],'attributes':_0x36d7a6[_0xec8b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xec8b('0xe')](function(_0x1e7b30){logger[_0xec8b('0x15')](_0xec8b('0x17'),_0x550cf7);logger[_0xec8b('0x21')](_0xec8b('0x17'),_0x550cf7,JSON[_0xec8b('0x11')](_0x1e7b30));_0x1669da(_0x1e7b30);})[_0xec8b('0x22')](function(_0x4c3a9f){logger[_0xec8b('0x12')](_0xec8b('0x17'),_0x4c3a9f['message'],_0x550cf7);_0x5bfd3b(_0x556ba6[_0xec8b('0x12')](0x1f4,_0x4c3a9f[_0xec8b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ce28d77..41bc631 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(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x7a54,0x106));var _0x47a5=function(_0x32857b,_0xcd65f){_0x32857b=_0x32857b-0x0;var _0x51dea7=_0x7a54[_0x32857b];return _0x51dea7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 953f973..4ecdc69 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 _0x4e81=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5a0e32,_0x347ae2){var _0xea8f24=function(_0x47f773){while(--_0x47f773){_0x5a0e32['push'](_0x5a0e32['shift']());}};_0xea8f24(++_0x347ae2);}(_0x4e81,0x1bc));var _0x14e8=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x4e81[_0x9e0cb3];return _0x5926b7;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'description':{'type':Sequelize[_0x14e8('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x14e8('0x3')]},'secure':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x14e8('0x2')]},'authentication':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe511=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x34eb50,_0x989798){var _0x2761dd=function(_0x1801c8){while(--_0x1801c8){_0x34eb50['push'](_0x34eb50['shift']());}};_0x2761dd(++_0x989798);}(_0xe511,0x16f));var _0x1e51=function(_0x31624d,_0x5d502b){_0x31624d=_0x31624d-0x0;var _0x5cb843=_0xe511[_0x31624d];return _0x5cb843;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1e51('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1e51('0x2')]},'port':{'type':Sequelize[_0x1e51('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x1e51('0x2')]},'authentication':{'type':Sequelize[_0x1e51('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x1e51('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8696e26..9975281 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 _0x0c2c=['bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','offset','undefined','limit','count','status','json','apply','reject','save','then','destroy','end','error','name','send','index','map','MailServerOut','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','create','body','update','find','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x0c2c,0x120));var _0xc0c2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0c2c[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc0c2('0x0'));var jsonpatch=require(_0xc0c2('0x1'));var rp=require(_0xc0c2('0x2'));var moment=require(_0xc0c2('0x3'));var BPromise=require(_0xc0c2('0x4'));var Mustache=require(_0xc0c2('0x5'));var util=require('util');var path=require(_0xc0c2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc0c2('0x7'));var fs=require('fs');var fs_extra=require(_0xc0c2('0x8'));var _=require('lodash');var squel=require(_0xc0c2('0x9'));var crypto=require(_0xc0c2('0xa'));var jsforce=require(_0xc0c2('0xb'));var deskjs=require(_0xc0c2('0xc'));var toCsv=require(_0xc0c2('0xd'));var querystring=require(_0xc0c2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc0c2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc0c2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0c2('0x11'))(_0xc0c2('0x12'));var utils=require(_0xc0c2('0x13'));var config=require(_0xc0c2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0c2('0x15'))['db'];function respondWithStatusCode(_0x54463e,_0x5277d8){_0x5277d8=_0x5277d8||0xcc;return function(_0x52e0f2){if(_0x52e0f2){return _0x54463e[_0xc0c2('0x16')](_0x5277d8);}return _0x54463e['status'](_0x5277d8)['end']();};}function respondWithResult(_0x4df33f,_0x58e8af){_0x58e8af=_0x58e8af||0xc8;return function(_0x734b58){if(_0x734b58){return _0x4df33f['status'](_0x58e8af)['json'](_0x734b58);}};}function respondWithFilteredResult(_0x557a1d,_0x5785e5){return function(_0x331578){if(_0x331578){var _0x1b9ea1=typeof _0x5785e5[_0xc0c2('0x17')]===_0xc0c2('0x18')&&typeof _0x5785e5[_0xc0c2('0x19')]===_0xc0c2('0x18');var _0x22dcae=_0x331578['count'];var _0x9fda6e=_0x1b9ea1?0x0:_0x5785e5['offset'];var _0x448088=_0x1b9ea1?_0x331578[_0xc0c2('0x1a')]:_0x5785e5[_0xc0c2('0x17')]+_0x5785e5[_0xc0c2('0x19')];var _0x4c75c2;if(_0x448088>=_0x22dcae){_0x448088=_0x22dcae;_0x4c75c2=0xc8;}else{_0x4c75c2=0xce;}_0x557a1d[_0xc0c2('0x1b')](_0x4c75c2);return _0x557a1d['set']('Content-Range',_0x9fda6e+'-'+_0x448088+'/'+_0x22dcae)[_0xc0c2('0x1c')](_0x331578);}return null;};}function patchUpdates(_0x371b8d){return function(_0xd6390){try{jsonpatch[_0xc0c2('0x1d')](_0xd6390,_0x371b8d,!![]);}catch(_0x12ed79){return BPromise[_0xc0c2('0x1e')](_0x12ed79);}return _0xd6390[_0xc0c2('0x1f')]();};}function saveUpdates(_0x2699a9,_0x55118d){return function(_0x19f27f){if(_0x19f27f){return _0x19f27f['update'](_0x2699a9)[_0xc0c2('0x20')](function(_0x532e49){return _0x532e49;});}return null;};}function removeEntity(_0x370f28,_0x43a3c8){return function(_0x2b4cf7){if(_0x2b4cf7){return _0x2b4cf7[_0xc0c2('0x21')]()[_0xc0c2('0x20')](function(){_0x370f28[_0xc0c2('0x1b')](0xcc)[_0xc0c2('0x22')]();});}};}function handleEntityNotFound(_0x145e13,_0x4a860b){return function(_0x59e2c9){if(!_0x59e2c9){_0x145e13['sendStatus'](0x194);}return _0x59e2c9;};}function handleError(_0x106342,_0x5132e1){_0x5132e1=_0x5132e1||0x1f4;return function(_0xf0a8bf){logger[_0xc0c2('0x23')](_0xf0a8bf['stack']);if(_0xf0a8bf['name']){delete _0xf0a8bf[_0xc0c2('0x24')];}_0x106342['status'](_0x5132e1)[_0xc0c2('0x25')](_0xf0a8bf);};}exports[_0xc0c2('0x26')]=function(_0x5a334e,_0x52185a){var _0x4b4cfd={},_0x247ae9={},_0x3c4769={'count':0x0,'rows':[]};var _0x1d0807=_[_0xc0c2('0x27')](db[_0xc0c2('0x28')]['rawAttributes'],function(_0x2040e5){return{'name':_0x2040e5[_0xc0c2('0x29')],'type':_0x2040e5['type'][_0xc0c2('0x2a')]};});_0x247ae9['model']=_['map'](_0x1d0807,'name');_0x247ae9[_0xc0c2('0x2b')]=_['keys'](_0x5a334e[_0xc0c2('0x2b')]);_0x247ae9['filters']=_['intersection'](_0x247ae9[_0xc0c2('0x2c')],_0x247ae9[_0xc0c2('0x2b')]);_0x4b4cfd[_0xc0c2('0x2d')]=_[_0xc0c2('0x2e')](_0x247ae9['model'],qs['fields'](_0x5a334e['query'][_0xc0c2('0x2f')]));_0x4b4cfd['attributes']=_0x4b4cfd[_0xc0c2('0x2d')][_0xc0c2('0x30')]?_0x4b4cfd[_0xc0c2('0x2d')]:_0x247ae9[_0xc0c2('0x2c')];if(!_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x31')](_0xc0c2('0x32'))){_0x4b4cfd['limit']=qs[_0xc0c2('0x19')](_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x19')]);_0x4b4cfd[_0xc0c2('0x17')]=qs[_0xc0c2('0x17')](_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x17')]);}_0x4b4cfd[_0xc0c2('0x33')]=qs[_0xc0c2('0x34')](_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x34')]);_0x4b4cfd[_0xc0c2('0x35')]=qs[_0xc0c2('0x36')](_['pick'](_0x5a334e[_0xc0c2('0x2b')],_0x247ae9[_0xc0c2('0x36')]),_0x1d0807);if(_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x37')]){_0x4b4cfd[_0xc0c2('0x35')]=_[_0xc0c2('0x38')](_0x4b4cfd[_0xc0c2('0x35')],{'$or':_[_0xc0c2('0x27')](_0x1d0807,function(_0x308860){if(_0x308860[_0xc0c2('0x39')]!==_0xc0c2('0x3a')){var _0x43e07a={};_0x43e07a[_0x308860[_0xc0c2('0x24')]]={'$like':'%'+_0x5a334e['query'][_0xc0c2('0x37')]+'%'};return _0x43e07a;}})});}_0x4b4cfd=_['merge']({},_0x4b4cfd,_0x5a334e['options']);var _0x31a2db={'where':_0x4b4cfd['where']};return db['MailServerOut'][_0xc0c2('0x1a')](_0x31a2db)['then'](function(_0x5a43cc){_0x3c4769[_0xc0c2('0x1a')]=_0x5a43cc;if(_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x3b')]){_0x4b4cfd[_0xc0c2('0x3c')]=[{'all':!![]}];}return db[_0xc0c2('0x28')][_0xc0c2('0x3d')](_0x4b4cfd);})[_0xc0c2('0x20')](function(_0x2d0ac4){_0x3c4769[_0xc0c2('0x3e')]=_0x2d0ac4;return _0x3c4769;})[_0xc0c2('0x20')](respondWithFilteredResult(_0x52185a,_0x4b4cfd))[_0xc0c2('0x3f')](handleError(_0x52185a,null));};exports[_0xc0c2('0x40')]=function(_0x4dbdd7,_0x49ede4){var _0x535525={'raw':!![],'where':{'id':_0x4dbdd7[_0xc0c2('0x41')]['id']}},_0x263e4d={};_0x263e4d[_0xc0c2('0x2c')]=_['keys'](db['MailServerOut'][_0xc0c2('0x42')]);_0x263e4d[_0xc0c2('0x2b')]=_[_0xc0c2('0x43')](_0x4dbdd7[_0xc0c2('0x2b')]);_0x263e4d[_0xc0c2('0x36')]=_['intersection'](_0x263e4d[_0xc0c2('0x2c')],_0x263e4d[_0xc0c2('0x2b')]);_0x535525[_0xc0c2('0x2d')]=_[_0xc0c2('0x2e')](_0x263e4d[_0xc0c2('0x2c')],qs['fields'](_0x4dbdd7[_0xc0c2('0x2b')][_0xc0c2('0x2f')]));_0x535525[_0xc0c2('0x2d')]=_0x535525['attributes'][_0xc0c2('0x30')]?_0x535525[_0xc0c2('0x2d')]:_0x263e4d['model'];if(_0x4dbdd7[_0xc0c2('0x2b')][_0xc0c2('0x3b')]){_0x535525['include']=[{'all':!![]}];}_0x535525=_[_0xc0c2('0x38')]({},_0x535525,_0x4dbdd7[_0xc0c2('0x44')]);return db[_0xc0c2('0x28')]['find'](_0x535525)[_0xc0c2('0x20')](handleEntityNotFound(_0x49ede4,null))[_0xc0c2('0x20')](respondWithResult(_0x49ede4,null))[_0xc0c2('0x3f')](handleError(_0x49ede4,null));};exports[_0xc0c2('0x45')]=function(_0x221ab2,_0x9d4e15){return db['MailServerOut'][_0xc0c2('0x45')](_0x221ab2[_0xc0c2('0x46')],{})[_0xc0c2('0x20')](respondWithResult(_0x9d4e15,0xc9))[_0xc0c2('0x3f')](handleError(_0x9d4e15,null));};exports[_0xc0c2('0x47')]=function(_0x4f76c0,_0x157502){if(_0x4f76c0[_0xc0c2('0x46')]['id']){delete _0x4f76c0[_0xc0c2('0x46')]['id'];}return db[_0xc0c2('0x28')][_0xc0c2('0x48')]({'where':{'id':_0x4f76c0[_0xc0c2('0x41')]['id']}})[_0xc0c2('0x20')](handleEntityNotFound(_0x157502,null))[_0xc0c2('0x20')](saveUpdates(_0x4f76c0[_0xc0c2('0x46')],null))[_0xc0c2('0x20')](respondWithResult(_0x157502,null))[_0xc0c2('0x3f')](handleError(_0x157502,null));};exports[_0xc0c2('0x21')]=function(_0x20d242,_0x32337a){return db[_0xc0c2('0x28')][_0xc0c2('0x48')]({'where':{'id':_0x20d242[_0xc0c2('0x41')]['id']}})[_0xc0c2('0x20')](handleEntityNotFound(_0x32337a,null))[_0xc0c2('0x20')](removeEntity(_0x32337a,null))['catch'](handleError(_0x32337a,null));}; \ No newline at end of file +var _0x89b7=['length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x120b57,_0x52227f){var _0x42f35e=function(_0x4330b1){while(--_0x4330b1){_0x120b57['push'](_0x120b57['shift']());}};_0x42f35e(++_0x52227f);}(_0x89b7,0x184));var _0x789b=function(_0x59f5ca,_0x30ad50){_0x59f5ca=_0x59f5ca-0x0;var _0x5d5a11=_0x89b7[_0x59f5ca];return _0x5d5a11;};'use strict';var emlformat=require(_0x789b('0x0'));var rimraf=require(_0x789b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x789b('0x2'));var rp=require('request-promise');var moment=require(_0x789b('0x3'));var BPromise=require(_0x789b('0x4'));var Mustache=require(_0x789b('0x5'));var util=require(_0x789b('0x6'));var path=require(_0x789b('0x7'));var sox=require(_0x789b('0x8'));var csv=require(_0x789b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x789b('0xa'));var squel=require(_0x789b('0xb'));var crypto=require('crypto');var jsforce=require(_0x789b('0xc'));var deskjs=require(_0x789b('0xd'));var toCsv=require(_0x789b('0x9'));var querystring=require(_0x789b('0xe'));var Papa=require(_0x789b('0xf'));var Redis=require(_0x789b('0x10'));var authService=require(_0x789b('0x11'));var qs=require(_0x789b('0x12'));var as=require(_0x789b('0x13'));var hardwareService=require(_0x789b('0x14'));var logger=require(_0x789b('0x15'))(_0x789b('0x16'));var utils=require(_0x789b('0x17'));var config=require(_0x789b('0x18'));var licenseUtil=require(_0x789b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303715,_0x2d0b13){_0x2d0b13=_0x2d0b13||0xcc;return function(_0x587f02){if(_0x587f02){return _0x303715[_0x789b('0x1a')](_0x2d0b13);}return _0x303715[_0x789b('0x1b')](_0x2d0b13)[_0x789b('0x1c')]();};}function respondWithResult(_0x4f3b67,_0x11d83d){_0x11d83d=_0x11d83d||0xc8;return function(_0x192d3b){if(_0x192d3b){return _0x4f3b67[_0x789b('0x1b')](_0x11d83d)[_0x789b('0x1d')](_0x192d3b);}};}function respondWithFilteredResult(_0x167fec,_0xcee103){return function(_0x321818){if(_0x321818){var _0x43f9af=typeof _0xcee103[_0x789b('0x1e')]===_0x789b('0x1f')&&typeof _0xcee103[_0x789b('0x20')]==='undefined';var _0x243d51=_0x321818[_0x789b('0x21')];var _0xd4395a=_0x43f9af?0x0:_0xcee103[_0x789b('0x1e')];var _0x16c85a=_0x43f9af?_0x321818[_0x789b('0x21')]:_0xcee103[_0x789b('0x1e')]+_0xcee103['limit'];var _0x5b226e;if(_0x16c85a>=_0x243d51){_0x16c85a=_0x243d51;_0x5b226e=0xc8;}else{_0x5b226e=0xce;}_0x167fec[_0x789b('0x1b')](_0x5b226e);return _0x167fec[_0x789b('0x22')](_0x789b('0x23'),_0xd4395a+'-'+_0x16c85a+'/'+_0x243d51)[_0x789b('0x1d')](_0x321818);}return null;};}function patchUpdates(_0x1afc34){return function(_0x155978){try{jsonpatch[_0x789b('0x24')](_0x155978,_0x1afc34,!![]);}catch(_0x3aa33b){return BPromise['reject'](_0x3aa33b);}return _0x155978[_0x789b('0x25')]();};}function saveUpdates(_0x1c9b1a,_0x1f2c39){return function(_0x1fda93){if(_0x1fda93){return _0x1fda93[_0x789b('0x26')](_0x1c9b1a)[_0x789b('0x27')](function(_0x2b6867){return _0x2b6867;});}return null;};}function removeEntity(_0x4188a2,_0x4293ac){return function(_0x4cfb91){if(_0x4cfb91){return _0x4cfb91[_0x789b('0x28')]()['then'](function(){_0x4188a2['status'](0xcc)[_0x789b('0x1c')]();});}};}function handleEntityNotFound(_0x443a0c,_0x37adc6){return function(_0x7991f4){if(!_0x7991f4){_0x443a0c['sendStatus'](0x194);}return _0x7991f4;};}function handleError(_0x399538,_0x2a2c08){_0x2a2c08=_0x2a2c08||0x1f4;return function(_0x448844){logger['error'](_0x448844[_0x789b('0x29')]);if(_0x448844['name']){delete _0x448844['name'];}_0x399538['status'](_0x2a2c08)[_0x789b('0x2a')](_0x448844);};}exports[_0x789b('0x2b')]=function(_0x53c164,_0x48c097){var _0x1fb95b={},_0x16fac7={},_0x4c81e0={'count':0x0,'rows':[]};var _0x583e57=_[_0x789b('0x2c')](db[_0x789b('0x2d')][_0x789b('0x2e')],function(_0x1017c1){return{'name':_0x1017c1[_0x789b('0x2f')],'type':_0x1017c1[_0x789b('0x30')]['key']};});_0x16fac7[_0x789b('0x31')]=_[_0x789b('0x2c')](_0x583e57,'name');_0x16fac7[_0x789b('0x32')]=_[_0x789b('0x33')](_0x53c164['query']);_0x16fac7[_0x789b('0x34')]=_[_0x789b('0x35')](_0x16fac7['model'],_0x16fac7[_0x789b('0x32')]);_0x1fb95b[_0x789b('0x36')]=_['intersection'](_0x16fac7[_0x789b('0x31')],qs[_0x789b('0x37')](_0x53c164[_0x789b('0x32')][_0x789b('0x37')]));_0x1fb95b['attributes']=_0x1fb95b[_0x789b('0x36')][_0x789b('0x38')]?_0x1fb95b['attributes']:_0x16fac7[_0x789b('0x31')];if(!_0x53c164[_0x789b('0x32')]['hasOwnProperty'](_0x789b('0x39'))){_0x1fb95b[_0x789b('0x20')]=qs['limit'](_0x53c164[_0x789b('0x32')]['limit']);_0x1fb95b[_0x789b('0x1e')]=qs['offset'](_0x53c164[_0x789b('0x32')][_0x789b('0x1e')]);}_0x1fb95b['order']=qs['sort'](_0x53c164[_0x789b('0x32')][_0x789b('0x3a')]);_0x1fb95b[_0x789b('0x3b')]=qs[_0x789b('0x34')](_[_0x789b('0x3c')](_0x53c164['query'],_0x16fac7[_0x789b('0x34')]),_0x583e57);if(_0x53c164[_0x789b('0x32')][_0x789b('0x3d')]){_0x1fb95b[_0x789b('0x3b')]=_[_0x789b('0x3e')](_0x1fb95b[_0x789b('0x3b')],{'$or':_['map'](_0x583e57,function(_0x260075){if(_0x260075['type']!==_0x789b('0x3f')){var _0x747e0a={};_0x747e0a[_0x260075['name']]={'$like':'%'+_0x53c164[_0x789b('0x32')][_0x789b('0x3d')]+'%'};return _0x747e0a;}})});}_0x1fb95b=_[_0x789b('0x3e')]({},_0x1fb95b,_0x53c164['options']);var _0x236833={'where':_0x1fb95b[_0x789b('0x3b')]};return db['MailServerOut'][_0x789b('0x21')](_0x236833)[_0x789b('0x27')](function(_0x433222){_0x4c81e0[_0x789b('0x21')]=_0x433222;if(_0x53c164[_0x789b('0x32')][_0x789b('0x40')]){_0x1fb95b[_0x789b('0x41')]=[{'all':!![]}];}return db[_0x789b('0x2d')][_0x789b('0x42')](_0x1fb95b);})[_0x789b('0x27')](function(_0xa1e6fd){_0x4c81e0[_0x789b('0x43')]=_0xa1e6fd;return _0x4c81e0;})['then'](respondWithFilteredResult(_0x48c097,_0x1fb95b))[_0x789b('0x44')](handleError(_0x48c097,null));};exports[_0x789b('0x45')]=function(_0x515a24,_0x2acfd2){var _0x11b9ce={'raw':!![],'where':{'id':_0x515a24[_0x789b('0x46')]['id']}},_0xa217a0={};_0xa217a0[_0x789b('0x31')]=_[_0x789b('0x33')](db['MailServerOut'][_0x789b('0x2e')]);_0xa217a0[_0x789b('0x32')]=_[_0x789b('0x33')](_0x515a24[_0x789b('0x32')]);_0xa217a0[_0x789b('0x34')]=_['intersection'](_0xa217a0[_0x789b('0x31')],_0xa217a0[_0x789b('0x32')]);_0x11b9ce[_0x789b('0x36')]=_[_0x789b('0x35')](_0xa217a0['model'],qs[_0x789b('0x37')](_0x515a24[_0x789b('0x32')][_0x789b('0x37')]));_0x11b9ce[_0x789b('0x36')]=_0x11b9ce[_0x789b('0x36')][_0x789b('0x38')]?_0x11b9ce[_0x789b('0x36')]:_0xa217a0['model'];if(_0x515a24[_0x789b('0x32')][_0x789b('0x40')]){_0x11b9ce[_0x789b('0x41')]=[{'all':!![]}];}_0x11b9ce=_[_0x789b('0x3e')]({},_0x11b9ce,_0x515a24['options']);return db[_0x789b('0x2d')][_0x789b('0x47')](_0x11b9ce)[_0x789b('0x27')](handleEntityNotFound(_0x2acfd2,null))[_0x789b('0x27')](respondWithResult(_0x2acfd2,null))[_0x789b('0x44')](handleError(_0x2acfd2,null));};exports[_0x789b('0x48')]=function(_0x4b80bf,_0x158cb3){return db[_0x789b('0x2d')][_0x789b('0x48')](_0x4b80bf['body'],{})['then'](respondWithResult(_0x158cb3,0xc9))[_0x789b('0x44')](handleError(_0x158cb3,null));};exports[_0x789b('0x26')]=function(_0x2342c5,_0x4e971a){if(_0x2342c5[_0x789b('0x49')]['id']){delete _0x2342c5[_0x789b('0x49')]['id'];}return db[_0x789b('0x2d')]['find']({'where':{'id':_0x2342c5[_0x789b('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e971a,null))[_0x789b('0x27')](saveUpdates(_0x2342c5[_0x789b('0x49')],null))[_0x789b('0x27')](respondWithResult(_0x4e971a,null))['catch'](handleError(_0x4e971a,null));};exports[_0x789b('0x28')]=function(_0x3e0579,_0x4f2fda){return db[_0x789b('0x2d')][_0x789b('0x47')]({'where':{'id':_0x3e0579[_0x789b('0x46')]['id']}})[_0x789b('0x27')](handleEntityNotFound(_0x4f2fda,null))[_0x789b('0x27')](removeEntity(_0x4f2fda,null))['catch'](handleError(_0x4f2fda,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fd8f245..53526fe 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 _0x9df9=['request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','util','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9df9,0x126));var _0x99df=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9df9[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require(_0x99df('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x99df('0x1'));var BPromise=require(_0x99df('0x2'));var rp=require(_0x99df('0x3'));var fs=require('fs');var path=require(_0x99df('0x4'));var rimraf=require(_0x99df('0x5'));var config=require(_0x99df('0x6'));var attributes=require(_0x99df('0x7'));module[_0x99df('0x8')]=function(_0x58497f,_0x4b5b25){return _0x58497f[_0x99df('0x9')](_0x99df('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eed=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x11032c,_0x11764f){var _0x3a97d7=function(_0x10fdb0){while(--_0x10fdb0){_0x11032c['push'](_0x11032c['shift']());}};_0x3a97d7(++_0x11764f);}(_0x8eed,0x1af));var _0xd8ee=function(_0x27571d,_0x1f2c9e){_0x27571d=_0x27571d-0x0;var _0x25b018=_0x8eed[_0x27571d];return _0x25b018;};'use strict';var _=require(_0xd8ee('0x0'));var util=require(_0xd8ee('0x1'));var logger=require(_0xd8ee('0x2'))(_0xd8ee('0x3'));var moment=require(_0xd8ee('0x4'));var BPromise=require(_0xd8ee('0x5'));var rp=require(_0xd8ee('0x6'));var fs=require('fs');var path=require(_0xd8ee('0x7'));var rimraf=require(_0xd8ee('0x8'));var config=require(_0xd8ee('0x9'));var attributes=require('./mailServerOut.attributes');module[_0xd8ee('0xa')]=function(_0x26c97c,_0x261917){return _0x26c97c[_0xd8ee('0xb')](_0xd8ee('0xc'),attributes,{'tableName':_0xd8ee('0xd'),'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 815f4e7..c3f841c 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3dfb61,_0xe69372){var _0x4df0c1=function(_0xc8cafa){while(--_0xc8cafa){_0x3dfb61['push'](_0x3dfb61['shift']());}};_0x4df0c1(++_0xe69372);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x257cfa,_0x2e872c){var _0x574cac=function(_0x3d17de){while(--_0x3d17de){_0x257cfa['push'](_0x257cfa['shift']());}};_0x574cac(++_0x2e872c);}(_0x1261,0x144));var _0x1126=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0x1261[_0x34b1b8];return _0x542dd8;};'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 b54ecca..e7c8b74 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 _0x2c85=['index','/describe','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','./mailSubstatus.controller','get'];(function(_0x41becf,_0x4cf7bb){var _0x2d8930=function(_0x55bbb7){while(--_0x55bbb7){_0x41becf['push'](_0x41becf['shift']());}};_0x2d8930(++_0x4cf7bb);}(_0x2c85,0x9a));var _0x52c8=function(_0x1e9227,_0x5bccbc){_0x1e9227=_0x1e9227-0x0;var _0x2e8134=_0x2c85[_0x1e9227];return _0x2e8134;};'use strict';var multer=require(_0x52c8('0x0'));var util=require(_0x52c8('0x1'));var path=require(_0x52c8('0x2'));var timeout=require('connect-timeout');var express=require(_0x52c8('0x3'));var router=express[_0x52c8('0x4')]();var fs_extra=require(_0x52c8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x52c8('0x6'));router[_0x52c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x52c8('0x8')]);router['get'](_0x52c8('0x9'),auth[_0x52c8('0xa')](),controller['describe']);router[_0x52c8('0x7')](_0x52c8('0xb'),auth['isAuthenticated'](),controller[_0x52c8('0xc')]);router[_0x52c8('0xd')]('/',auth['isAuthenticated'](),controller[_0x52c8('0xe')]);router[_0x52c8('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x52c8('0x10')]);module[_0x52c8('0x11')]=router; \ No newline at end of file +var _0x4f16=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x5c1930,_0x1b15e7){var _0x163a34=function(_0x52b4b5){while(--_0x52b4b5){_0x5c1930['push'](_0x5c1930['shift']());}};_0x163a34(++_0x1b15e7);}(_0x4f16,0x1b7));var _0x64f1=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0x4f16[_0x279755];return _0x138178;};'use strict';var multer=require(_0x64f1('0x0'));var util=require(_0x64f1('0x1'));var path=require(_0x64f1('0x2'));var timeout=require(_0x64f1('0x3'));var express=require(_0x64f1('0x4'));var router=express[_0x64f1('0x5')]();var fs_extra=require(_0x64f1('0x6'));var auth=require(_0x64f1('0x7'));var interaction=require(_0x64f1('0x8'));var config=require(_0x64f1('0x9'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x64f1('0xa')](),controller[_0x64f1('0xb')]);router['get'](_0x64f1('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x64f1('0xd')](_0x64f1('0xe'),auth['isAuthenticated'](),controller[_0x64f1('0xf')]);router[_0x64f1('0x10')]('/',auth[_0x64f1('0xa')](),controller[_0x64f1('0x11')]);router[_0x64f1('0x12')](_0x64f1('0xe'),auth[_0x64f1('0xa')](),controller[_0x64f1('0x13')]);router[_0x64f1('0x14')](_0x64f1('0xe'),auth['isAuthenticated'](),controller[_0x64f1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 5cda946..da5265f 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c7b=['STRING','sequelize'];(function(_0x2b309a,_0x534b86){var _0x37b40d=function(_0xf2ffc3){while(--_0xf2ffc3){_0x2b309a['push'](_0x2b309a['shift']());}};_0x37b40d(++_0x534b86);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x53c82a,_0x31afdc){_0x53c82a=_0x53c82a-0x0;var _0x3b6e85=_0x6c7b[_0x53c82a];return _0x3b6e85;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file +var _0xbd10=['STRING','sequelize','exports'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0xbd10,0x85));var _0x0bd1=function(_0x4df76c,_0x1d8a92){_0x4df76c=_0x4df76c-0x0;var _0x446378=_0xbd10[_0x4df76c];return _0x446378;};'use strict';var Sequelize=require(_0x0bd1('0x0'));module[_0x0bd1('0x1')]={'name':{'type':Sequelize[_0x0bd1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0bd1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d2062a9..aaf4c7d 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 _0x3a6d=['offset','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','create','body','catch','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','count'];(function(_0x335c01,_0x487dbd){var _0x4df624=function(_0x5b7092){while(--_0x5b7092){_0x335c01['push'](_0x335c01['shift']());}};_0x4df624(++_0x487dbd);}(_0x3a6d,0x1ea));var _0xd3a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3a6d[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd3a6('0x0'));var jsonpatch=require(_0xd3a6('0x1'));var rp=require(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var Mustache=require(_0xd3a6('0x5'));var util=require(_0xd3a6('0x6'));var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require('to-csv');var ejs=require(_0xd3a6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd3a6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd3a6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd3a6('0xc'));var Papa=require(_0xd3a6('0xd'));var Redis=require(_0xd3a6('0xe'));var authService=require(_0xd3a6('0xf'));var qs=require(_0xd3a6('0x10'));var as=require(_0xd3a6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3a6('0x12'))(_0xd3a6('0x13'));var utils=require(_0xd3a6('0x14'));var config=require(_0xd3a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ccfd1,_0x372438){_0x372438=_0x372438||0xcc;return function(_0x2b7d0a){if(_0x2b7d0a){return _0x2ccfd1['sendStatus'](_0x372438);}return _0x2ccfd1[_0xd3a6('0x16')](_0x372438)[_0xd3a6('0x17')]();};}function respondWithResult(_0x5081c6,_0x17c534){_0x17c534=_0x17c534||0xc8;return function(_0x5c86d3){if(_0x5c86d3){return _0x5081c6['status'](_0x17c534)[_0xd3a6('0x18')](_0x5c86d3);}};}function respondWithFilteredResult(_0x386ad7,_0x7a51f){return function(_0x5c2410){if(_0x5c2410){var _0x44468b=typeof _0x7a51f['offset']===_0xd3a6('0x19')&&typeof _0x7a51f[_0xd3a6('0x1a')]===_0xd3a6('0x19');var _0x516fbd=_0x5c2410[_0xd3a6('0x1b')];var _0x149f96=_0x44468b?0x0:_0x7a51f[_0xd3a6('0x1c')];var _0x4fb5d5=_0x44468b?_0x5c2410['count']:_0x7a51f[_0xd3a6('0x1c')]+_0x7a51f[_0xd3a6('0x1a')];var _0x27e453;if(_0x4fb5d5>=_0x516fbd){_0x4fb5d5=_0x516fbd;_0x27e453=0xc8;}else{_0x27e453=0xce;}_0x386ad7[_0xd3a6('0x16')](_0x27e453);return _0x386ad7[_0xd3a6('0x1d')](_0xd3a6('0x1e'),_0x149f96+'-'+_0x4fb5d5+'/'+_0x516fbd)[_0xd3a6('0x18')](_0x5c2410);}return null;};}function patchUpdates(_0x38beed){return function(_0x17a8a2){try{jsonpatch[_0xd3a6('0x1f')](_0x17a8a2,_0x38beed,!![]);}catch(_0x248096){return BPromise[_0xd3a6('0x20')](_0x248096);}return _0x17a8a2['save']();};}function saveUpdates(_0x5799ff,_0x2839ca){return function(_0x8ddea6){if(_0x8ddea6){return _0x8ddea6[_0xd3a6('0x21')](_0x5799ff)[_0xd3a6('0x22')](function(_0x5383a2){return _0x5383a2;});}return null;};}function removeEntity(_0x2b3cd8,_0x1d538f){return function(_0x5c7fe2){if(_0x5c7fe2){return _0x5c7fe2['destroy']()[_0xd3a6('0x22')](function(){_0x2b3cd8[_0xd3a6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d9db3,_0xd64c06){return function(_0x25847a){if(!_0x25847a){_0x1d9db3[_0xd3a6('0x23')](0x194);}return _0x25847a;};}function handleError(_0x56e01d,_0x1c5d41){_0x1c5d41=_0x1c5d41||0x1f4;return function(_0x3be3e6){logger[_0xd3a6('0x24')](_0x3be3e6[_0xd3a6('0x25')]);if(_0x3be3e6[_0xd3a6('0x26')]){delete _0x3be3e6[_0xd3a6('0x26')];}_0x56e01d['status'](_0x1c5d41)[_0xd3a6('0x27')](_0x3be3e6);};}exports[_0xd3a6('0x28')]=function(_0x53bebc,_0x5f0216){var _0x85fb6d={},_0x3cf11b={},_0x2a69c1={'count':0x0,'rows':[]};var _0x280d8e=_['map'](db[_0xd3a6('0x29')][_0xd3a6('0x2a')],function(_0x147c15){return{'name':_0x147c15[_0xd3a6('0x2b')],'type':_0x147c15['type'][_0xd3a6('0x2c')]};});_0x3cf11b['model']=_[_0xd3a6('0x2d')](_0x280d8e,_0xd3a6('0x26'));_0x3cf11b[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x53bebc[_0xd3a6('0x2e')]);_0x3cf11b['filters']=_['intersection'](_0x3cf11b[_0xd3a6('0x30')],_0x3cf11b[_0xd3a6('0x2e')]);_0x85fb6d[_0xd3a6('0x31')]=_[_0xd3a6('0x32')](_0x3cf11b[_0xd3a6('0x30')],qs[_0xd3a6('0x33')](_0x53bebc['query']['fields']));_0x85fb6d[_0xd3a6('0x31')]=_0x85fb6d[_0xd3a6('0x31')][_0xd3a6('0x34')]?_0x85fb6d[_0xd3a6('0x31')]:_0x3cf11b[_0xd3a6('0x30')];if(!_0x53bebc['query']['hasOwnProperty'](_0xd3a6('0x35'))){_0x85fb6d[_0xd3a6('0x1a')]=qs['limit'](_0x53bebc[_0xd3a6('0x2e')][_0xd3a6('0x1a')]);_0x85fb6d[_0xd3a6('0x1c')]=qs['offset'](_0x53bebc[_0xd3a6('0x2e')][_0xd3a6('0x1c')]);}_0x85fb6d[_0xd3a6('0x36')]=qs[_0xd3a6('0x37')](_0x53bebc[_0xd3a6('0x2e')]['sort']);_0x85fb6d[_0xd3a6('0x38')]=qs['filters'](_[_0xd3a6('0x39')](_0x53bebc['query'],_0x3cf11b[_0xd3a6('0x3a')]),_0x280d8e);if(_0x53bebc['query'][_0xd3a6('0x3b')]){_0x85fb6d['where']=_[_0xd3a6('0x3c')](_0x85fb6d[_0xd3a6('0x38')],{'$or':_[_0xd3a6('0x2d')](_0x280d8e,function(_0x1981ba){if(_0x1981ba[_0xd3a6('0x3d')]!==_0xd3a6('0x3e')){var _0x231831={};_0x231831[_0x1981ba[_0xd3a6('0x26')]]={'$like':'%'+_0x53bebc[_0xd3a6('0x2e')]['filter']+'%'};return _0x231831;}})});}_0x85fb6d=_[_0xd3a6('0x3c')]({},_0x85fb6d,_0x53bebc[_0xd3a6('0x3f')]);var _0x571a5a={'where':_0x85fb6d['where']};return db['MailSubstatus'][_0xd3a6('0x1b')](_0x571a5a)[_0xd3a6('0x22')](function(_0x290507){_0x2a69c1['count']=_0x290507;if(_0x53bebc[_0xd3a6('0x2e')][_0xd3a6('0x40')]){_0x85fb6d[_0xd3a6('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0xd3a6('0x42')](_0x85fb6d);})[_0xd3a6('0x22')](function(_0x40de42){_0x2a69c1[_0xd3a6('0x43')]=_0x40de42;return _0x2a69c1;})[_0xd3a6('0x22')](respondWithFilteredResult(_0x5f0216,_0x85fb6d))['catch'](handleError(_0x5f0216,null));};exports['show']=function(_0x2bdb17,_0xf69d2c){var _0x5ee625={'raw':!![],'where':{'id':_0x2bdb17['params']['id']}},_0x5cf517={};_0x5cf517[_0xd3a6('0x30')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x29')][_0xd3a6('0x2a')]);_0x5cf517[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x2bdb17[_0xd3a6('0x2e')]);_0x5cf517[_0xd3a6('0x3a')]=_[_0xd3a6('0x32')](_0x5cf517[_0xd3a6('0x30')],_0x5cf517[_0xd3a6('0x2e')]);_0x5ee625[_0xd3a6('0x31')]=_['intersection'](_0x5cf517[_0xd3a6('0x30')],qs[_0xd3a6('0x33')](_0x2bdb17[_0xd3a6('0x2e')][_0xd3a6('0x33')]));_0x5ee625[_0xd3a6('0x31')]=_0x5ee625[_0xd3a6('0x31')][_0xd3a6('0x34')]?_0x5ee625[_0xd3a6('0x31')]:_0x5cf517[_0xd3a6('0x30')];if(_0x2bdb17[_0xd3a6('0x2e')]['includeAll']){_0x5ee625[_0xd3a6('0x41')]=[{'all':!![]}];}_0x5ee625=_[_0xd3a6('0x3c')]({},_0x5ee625,_0x2bdb17['options']);return db[_0xd3a6('0x29')]['find'](_0x5ee625)[_0xd3a6('0x22')](handleEntityNotFound(_0xf69d2c,null))['then'](respondWithResult(_0xf69d2c,null))['catch'](handleError(_0xf69d2c,null));};exports[_0xd3a6('0x44')]=function(_0x29d1a3,_0x5df08a){return db[_0xd3a6('0x29')][_0xd3a6('0x44')](_0x29d1a3[_0xd3a6('0x45')],{})[_0xd3a6('0x22')](respondWithResult(_0x5df08a,0xc9))[_0xd3a6('0x46')](handleError(_0x5df08a,null));};exports['update']=function(_0x564406,_0x20502b){if(_0x564406['body']['id']){delete _0x564406[_0xd3a6('0x45')]['id'];}return db[_0xd3a6('0x29')][_0xd3a6('0x47')]({'where':{'id':_0x564406['params']['id']}})[_0xd3a6('0x22')](handleEntityNotFound(_0x20502b,null))[_0xd3a6('0x22')](saveUpdates(_0x564406[_0xd3a6('0x45')],null))[_0xd3a6('0x22')](respondWithResult(_0x20502b,null))[_0xd3a6('0x46')](handleError(_0x20502b,null));};exports[_0xd3a6('0x48')]=function(_0x37d7a6,_0xa6fcfb){return db[_0xd3a6('0x29')][_0xd3a6('0x47')]({'where':{'id':_0x37d7a6['params']['id']}})[_0xd3a6('0x22')](handleEntityNotFound(_0xa6fcfb,null))[_0xd3a6('0x22')](removeEntity(_0xa6fcfb,null))[_0xd3a6('0x46')](handleError(_0xa6fcfb,null));};exports[_0xd3a6('0x49')]=function(_0x1b71f0,_0x11aa45){return db[_0xd3a6('0x29')]['describe']()[_0xd3a6('0x22')](respondWithResult(_0x11aa45,null))[_0xd3a6('0x46')](handleError(_0x11aa45,null));}; \ No newline at end of file +var _0x8fd2=['undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','MailSubstatus','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','merge','find','create','body','describe','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/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x490e52,_0x442cf4){var _0xee48fe=function(_0x551058){while(--_0x551058){_0x490e52['push'](_0x490e52['shift']());}};_0xee48fe(++_0x442cf4);}(_0x8fd2,0x1f0));var _0x28fd=function(_0x4e1017,_0x8e7bc6){_0x4e1017=_0x4e1017-0x0;var _0x37a1f1=_0x8fd2[_0x4e1017];return _0x37a1f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x28fd('0x0'));var rp=require(_0x28fd('0x1'));var moment=require(_0x28fd('0x2'));var BPromise=require(_0x28fd('0x3'));var Mustache=require(_0x28fd('0x4'));var util=require(_0x28fd('0x5'));var path=require(_0x28fd('0x6'));var sox=require(_0x28fd('0x7'));var csv=require(_0x28fd('0x8'));var ejs=require(_0x28fd('0x9'));var fs=require('fs');var fs_extra=require(_0x28fd('0xa'));var _=require(_0x28fd('0xb'));var squel=require(_0x28fd('0xc'));var crypto=require(_0x28fd('0xd'));var jsforce=require(_0x28fd('0xe'));var deskjs=require(_0x28fd('0xf'));var toCsv=require(_0x28fd('0x8'));var querystring=require(_0x28fd('0x10'));var Papa=require(_0x28fd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x28fd('0x12'));var as=require(_0x28fd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x28fd('0x14'));var utils=require(_0x28fd('0x15'));var config=require(_0x28fd('0x16'));var licenseUtil=require(_0x28fd('0x17'));var db=require(_0x28fd('0x18'))['db'];function respondWithStatusCode(_0x56b33c,_0x105e71){_0x105e71=_0x105e71||0xcc;return function(_0x5d5563){if(_0x5d5563){return _0x56b33c['sendStatus'](_0x105e71);}return _0x56b33c[_0x28fd('0x19')](_0x105e71)[_0x28fd('0x1a')]();};}function respondWithResult(_0x5ac327,_0x4da821){_0x4da821=_0x4da821||0xc8;return function(_0x4ddb1b){if(_0x4ddb1b){return _0x5ac327[_0x28fd('0x19')](_0x4da821)[_0x28fd('0x1b')](_0x4ddb1b);}};}function respondWithFilteredResult(_0x26b90f,_0x557a7c){return function(_0x4b2e44){if(_0x4b2e44){var _0x4fd8e2=typeof _0x557a7c[_0x28fd('0x1c')]===_0x28fd('0x1d')&&typeof _0x557a7c['limit']===_0x28fd('0x1d');var _0xe80eb1=_0x4b2e44[_0x28fd('0x1e')];var _0x30fa85=_0x4fd8e2?0x0:_0x557a7c['offset'];var _0x4e2e37=_0x4fd8e2?_0x4b2e44[_0x28fd('0x1e')]:_0x557a7c[_0x28fd('0x1c')]+_0x557a7c[_0x28fd('0x1f')];var _0x4ffb6d;if(_0x4e2e37>=_0xe80eb1){_0x4e2e37=_0xe80eb1;_0x4ffb6d=0xc8;}else{_0x4ffb6d=0xce;}_0x26b90f[_0x28fd('0x19')](_0x4ffb6d);return _0x26b90f[_0x28fd('0x20')](_0x28fd('0x21'),_0x30fa85+'-'+_0x4e2e37+'/'+_0xe80eb1)[_0x28fd('0x1b')](_0x4b2e44);}return null;};}function patchUpdates(_0x3c8af1){return function(_0x444222){try{jsonpatch['apply'](_0x444222,_0x3c8af1,!![]);}catch(_0x2c77eb){return BPromise[_0x28fd('0x22')](_0x2c77eb);}return _0x444222[_0x28fd('0x23')]();};}function saveUpdates(_0xc8b529,_0x550f3f){return function(_0x46591a){if(_0x46591a){return _0x46591a[_0x28fd('0x24')](_0xc8b529)['then'](function(_0x186c39){return _0x186c39;});}return null;};}function removeEntity(_0x5e0784,_0x3611a6){return function(_0x15c1c8){if(_0x15c1c8){return _0x15c1c8[_0x28fd('0x25')]()[_0x28fd('0x26')](function(){_0x5e0784['status'](0xcc)[_0x28fd('0x1a')]();});}};}function handleEntityNotFound(_0x2aee71,_0x3aca09){return function(_0x18d83d){if(!_0x18d83d){_0x2aee71['sendStatus'](0x194);}return _0x18d83d;};}function handleError(_0x1e1c0e,_0x5819d4){_0x5819d4=_0x5819d4||0x1f4;return function(_0x3ea72b){logger[_0x28fd('0x27')](_0x3ea72b[_0x28fd('0x28')]);if(_0x3ea72b[_0x28fd('0x29')]){delete _0x3ea72b[_0x28fd('0x29')];}_0x1e1c0e[_0x28fd('0x19')](_0x5819d4)[_0x28fd('0x2a')](_0x3ea72b);};}exports[_0x28fd('0x2b')]=function(_0x1443e0,_0x4a2ec0){var _0x4b7881={},_0x2b76e8={},_0x20db33={'count':0x0,'rows':[]};var _0x4ad7e3=_[_0x28fd('0x2c')](db[_0x28fd('0x2d')]['rawAttributes'],function(_0x20075b){return{'name':_0x20075b['fieldName'],'type':_0x20075b[_0x28fd('0x2e')][_0x28fd('0x2f')]};});_0x2b76e8[_0x28fd('0x30')]=_['map'](_0x4ad7e3,'name');_0x2b76e8['query']=_['keys'](_0x1443e0[_0x28fd('0x31')]);_0x2b76e8[_0x28fd('0x32')]=_[_0x28fd('0x33')](_0x2b76e8[_0x28fd('0x30')],_0x2b76e8['query']);_0x4b7881[_0x28fd('0x34')]=_[_0x28fd('0x33')](_0x2b76e8[_0x28fd('0x30')],qs[_0x28fd('0x35')](_0x1443e0['query'][_0x28fd('0x35')]));_0x4b7881[_0x28fd('0x34')]=_0x4b7881['attributes'][_0x28fd('0x36')]?_0x4b7881['attributes']:_0x2b76e8[_0x28fd('0x30')];if(!_0x1443e0[_0x28fd('0x31')][_0x28fd('0x37')](_0x28fd('0x38'))){_0x4b7881[_0x28fd('0x1f')]=qs[_0x28fd('0x1f')](_0x1443e0[_0x28fd('0x31')][_0x28fd('0x1f')]);_0x4b7881[_0x28fd('0x1c')]=qs['offset'](_0x1443e0[_0x28fd('0x31')][_0x28fd('0x1c')]);}_0x4b7881['order']=qs['sort'](_0x1443e0[_0x28fd('0x31')][_0x28fd('0x39')]);_0x4b7881[_0x28fd('0x3a')]=qs[_0x28fd('0x32')](_[_0x28fd('0x3b')](_0x1443e0[_0x28fd('0x31')],_0x2b76e8[_0x28fd('0x32')]),_0x4ad7e3);if(_0x1443e0[_0x28fd('0x31')][_0x28fd('0x3c')]){_0x4b7881[_0x28fd('0x3a')]=_['merge'](_0x4b7881[_0x28fd('0x3a')],{'$or':_['map'](_0x4ad7e3,function(_0xa5821f){if(_0xa5821f[_0x28fd('0x2e')]!=='VIRTUAL'){var _0x2ddd11={};_0x2ddd11[_0xa5821f[_0x28fd('0x29')]]={'$like':'%'+_0x1443e0[_0x28fd('0x31')][_0x28fd('0x3c')]+'%'};return _0x2ddd11;}})});}_0x4b7881=_['merge']({},_0x4b7881,_0x1443e0[_0x28fd('0x3d')]);var _0x5b6732={'where':_0x4b7881[_0x28fd('0x3a')]};return db[_0x28fd('0x2d')][_0x28fd('0x1e')](_0x5b6732)[_0x28fd('0x26')](function(_0x181ca1){_0x20db33[_0x28fd('0x1e')]=_0x181ca1;if(_0x1443e0[_0x28fd('0x31')][_0x28fd('0x3e')]){_0x4b7881[_0x28fd('0x3f')]=[{'all':!![]}];}return db[_0x28fd('0x2d')][_0x28fd('0x40')](_0x4b7881);})['then'](function(_0x3cd425){_0x20db33[_0x28fd('0x41')]=_0x3cd425;return _0x20db33;})[_0x28fd('0x26')](respondWithFilteredResult(_0x4a2ec0,_0x4b7881))[_0x28fd('0x42')](handleError(_0x4a2ec0,null));};exports['show']=function(_0x4ddd6b,_0x304c1a){var _0x1203c8={'raw':!![],'where':{'id':_0x4ddd6b[_0x28fd('0x43')]['id']}},_0x448f46={};_0x448f46[_0x28fd('0x30')]=_[_0x28fd('0x44')](db[_0x28fd('0x2d')][_0x28fd('0x45')]);_0x448f46['query']=_[_0x28fd('0x44')](_0x4ddd6b['query']);_0x448f46[_0x28fd('0x32')]=_[_0x28fd('0x33')](_0x448f46[_0x28fd('0x30')],_0x448f46[_0x28fd('0x31')]);_0x1203c8[_0x28fd('0x34')]=_[_0x28fd('0x33')](_0x448f46[_0x28fd('0x30')],qs['fields'](_0x4ddd6b[_0x28fd('0x31')][_0x28fd('0x35')]));_0x1203c8[_0x28fd('0x34')]=_0x1203c8[_0x28fd('0x34')]['length']?_0x1203c8[_0x28fd('0x34')]:_0x448f46[_0x28fd('0x30')];if(_0x4ddd6b[_0x28fd('0x31')][_0x28fd('0x3e')]){_0x1203c8[_0x28fd('0x3f')]=[{'all':!![]}];}_0x1203c8=_[_0x28fd('0x46')]({},_0x1203c8,_0x4ddd6b[_0x28fd('0x3d')]);return db[_0x28fd('0x2d')][_0x28fd('0x47')](_0x1203c8)[_0x28fd('0x26')](handleEntityNotFound(_0x304c1a,null))[_0x28fd('0x26')](respondWithResult(_0x304c1a,null))[_0x28fd('0x42')](handleError(_0x304c1a,null));};exports[_0x28fd('0x48')]=function(_0x3c17d6,_0x137515){return db[_0x28fd('0x2d')][_0x28fd('0x48')](_0x3c17d6[_0x28fd('0x49')],{})[_0x28fd('0x26')](respondWithResult(_0x137515,0xc9))['catch'](handleError(_0x137515,null));};exports['update']=function(_0x54ec87,_0x310c72){if(_0x54ec87['body']['id']){delete _0x54ec87['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x54ec87[_0x28fd('0x43')]['id']}})['then'](handleEntityNotFound(_0x310c72,null))[_0x28fd('0x26')](saveUpdates(_0x54ec87[_0x28fd('0x49')],null))[_0x28fd('0x26')](respondWithResult(_0x310c72,null))[_0x28fd('0x42')](handleError(_0x310c72,null));};exports[_0x28fd('0x25')]=function(_0x337ea4,_0x54aa72){return db[_0x28fd('0x2d')][_0x28fd('0x47')]({'where':{'id':_0x337ea4[_0x28fd('0x43')]['id']}})[_0x28fd('0x26')](handleEntityNotFound(_0x54aa72,null))[_0x28fd('0x26')](removeEntity(_0x54aa72,null))[_0x28fd('0x42')](handleError(_0x54aa72,null));};exports[_0x28fd('0x4a')]=function(_0xb9e9a1,_0x372932){return db[_0x28fd('0x2d')][_0x28fd('0x4a')]()[_0x28fd('0x26')](respondWithResult(_0x372932,null))[_0x28fd('0x42')](handleError(_0x372932,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index f1ad36f..8d1e638 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf14=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0xcf14,0x196));var _0x4cf1=function(_0x465224,_0x2d8827){_0x465224=_0x465224-0x0;var _0x55a402=_0xcf14[_0x465224];return _0x55a402;};'use strict';var EventEmitter=require(_0x4cf1('0x0'));var MailSubstatus=require(_0x4cf1('0x1'))['db'][_0x4cf1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4cf1('0x3')](0x0);var events={'afterUpdate':_0x4cf1('0x4')};function emitEvent(_0x2514c9){return function(_0x4c96c7,_0x11a347,_0x3f80ba){MailSubstatusEvents[_0x4cf1('0x5')](_0x2514c9+':'+_0x4c96c7['id'],_0x4c96c7);MailSubstatusEvents['emit'](_0x2514c9,_0x4c96c7);_0x3f80ba(null);};}for(var e in events){if(events[_0x4cf1('0x6')](e)){var event=events[e];MailSubstatus[_0x4cf1('0x7')](e,emitEvent(event));}}module[_0x4cf1('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x2d02=['../../mysqldb','setMaxListeners','emit','hasOwnProperty','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d02,0xbd));var _0x22d0=function(_0x47b0fa,_0x370026){_0x47b0fa=_0x47b0fa-0x0;var _0x17fb2a=_0x2d02[_0x47b0fa];return _0x17fb2a;};'use strict';var EventEmitter=require(_0x22d0('0x0'));var MailSubstatus=require(_0x22d0('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x22d0('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x2447db){return function(_0x15183b,_0x5f3595,_0x356ac8){MailSubstatusEvents[_0x22d0('0x3')](_0x2447db+':'+_0x15183b['id'],_0x15183b);MailSubstatusEvents[_0x22d0('0x3')](_0x2447db,_0x15183b);_0x356ac8(null);};}for(var e in events){if(events[_0x22d0('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 867e6a0..74ca4b2 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 _0xd5a2=['then','exports','models','define','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues'];(function(_0x5e3d2c,_0x21cfc0){var _0x313722=function(_0x2d4594){while(--_0x2d4594){_0x5e3d2c['push'](_0x5e3d2c['shift']());}};_0x313722(++_0x21cfc0);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x258589,_0xf6a3cb){_0x258589=_0x258589-0x0;var _0x3e05c3=_0xd5a2[_0x258589];return _0x3e05c3;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x2d5a('0x0')]=function(_0x217b8c){var _0x75b00=_0x217b8c[_0x2d5a('0x1')];return _0x217b8c[_0x2d5a('0x2')]('MailSubstatus',attributes,{'tableName':_0x2d5a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xaeebb3,_0x18590d,_0x42947b){return _0x75b00[_0x2d5a('0x4')][_0x2d5a('0x5')]({'value':_0xaeebb3[_0x2d5a('0x6')]},{'where':{'field':_0x2d5a('0x7'),'value':_0xaeebb3[_0x2d5a('0x8')][_0x2d5a('0x6')]}})[_0x2d5a('0x9')](function(){_0x42947b();})['catch'](function(_0x5054c8){_0x42947b(_0x5054c8);});}}});}; \ No newline at end of file +var _0x3bc0=['define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x3bc0,0xa2));var _0x03bc=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x3bc0[_0x36ed3c];return _0x52a2e0;};'use strict';var attributes=require(_0x03bc('0x0'));module[_0x03bc('0x1')]=function(_0x32e119){var _0x2c4013=_0x32e119[_0x03bc('0x2')];return _0x32e119[_0x03bc('0x3')](_0x03bc('0x4'),attributes,{'tableName':_0x03bc('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3a702c,_0x62f304,_0xc99ffa){return _0x2c4013[_0x03bc('0x6')]['update']({'value':_0x3a702c[_0x03bc('0x7')]},{'where':{'field':_0x03bc('0x8'),'value':_0x3a702c[_0x03bc('0x9')][_0x03bc('0x7')]}})[_0x03bc('0xa')](function(){_0xc99ffa();})['catch'](function(_0xb103b3){_0xc99ffa(_0xb103b3);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index e2037fd..415b5ac 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 _0xb8bc=['error','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2349cd,_0x536281){var _0x22bd6f=function(_0x29b17a){while(--_0x29b17a){_0x2349cd['push'](_0x2349cd['shift']());}};_0x22bd6f(++_0x536281);}(_0xb8bc,0x1d8));var _0xcb8b=function(_0x1f408c,_0x13ef54){_0x1f408c=_0x1f408c-0x0;var _0x35ef03=_0xb8bc[_0x1f408c];return _0x35ef03;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb8b('0x0'));var fs=require('fs');var Redis=require(_0xcb8b('0x1'));var db=require(_0xcb8b('0x2'))['db'];var utils=require(_0xcb8b('0x3'));var logger=require(_0xcb8b('0x4'))(_0xcb8b('0x5'));var config=require(_0xcb8b('0x6'));var jayson=require(_0xcb8b('0x7'));var client=jayson[_0xcb8b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36dd60,_0x114c9c,_0x5820fd){return new BPromise(function(_0x2e72b9,_0x4d2db7){return client[_0xcb8b('0x9')](_0x36dd60,_0x5820fd)['then'](function(_0x1eb35e){logger[_0xcb8b('0xa')](_0xcb8b('0xb'),_0x114c9c,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x114c9c,_0xcb8b('0xc'),JSON[_0xcb8b('0xd')](_0x1eb35e));if(_0x1eb35e[_0xcb8b('0xe')]){if(_0x1eb35e[_0xcb8b('0xe')]['code']===0x1f4){logger[_0xcb8b('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x114c9c,_0x1eb35e[_0xcb8b('0xe')]['message']);return _0x4d2db7(_0x1eb35e[_0xcb8b('0xe')]['message']);}logger[_0xcb8b('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x114c9c,_0x1eb35e[_0xcb8b('0xe')]['message']);return _0x2e72b9(_0x1eb35e['error'][_0xcb8b('0xf')]);}else{logger[_0xcb8b('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x114c9c,_0xcb8b('0xc'));_0x2e72b9(_0x1eb35e[_0xcb8b('0x10')][_0xcb8b('0xf')]);}})[_0xcb8b('0x11')](function(_0xbef607){logger['error'](_0xcb8b('0xb'),_0x114c9c,_0xbef607);_0x4d2db7(_0xbef607);});});} \ No newline at end of file +var _0x40dd=['stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0xd2dd3a,_0x35c8c6){var _0x37bd21=function(_0x4735a7){while(--_0x4735a7){_0xd2dd3a['push'](_0xd2dd3a['shift']());}};_0x37bd21(++_0x35c8c6);}(_0x40dd,0x18d));var _0xd40d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x40dd[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xd40d('0x0'));var util=require(_0xd40d('0x1'));var moment=require('moment');var BPromise=require(_0xd40d('0x2'));var rs=require(_0xd40d('0x3'));var fs=require('fs');var Redis=require(_0xd40d('0x4'));var db=require(_0xd40d('0x5'))['db'];var utils=require(_0xd40d('0x6'));var logger=require(_0xd40d('0x7'))(_0xd40d('0x8'));var config=require(_0xd40d('0x9'));var jayson=require(_0xd40d('0xa'));var client=jayson[_0xd40d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5158fd,_0x55d5f6,_0x5d5d56){return new BPromise(function(_0x30bd25,_0x3d7e6e){return client[_0xd40d('0xc')](_0x5158fd,_0x5d5d56)['then'](function(_0x10f9bf){logger['info'](_0xd40d('0xd'),_0x55d5f6,_0xd40d('0xe'));logger[_0xd40d('0xf')](_0xd40d('0x10'),_0x55d5f6,'request\x20sent',JSON[_0xd40d('0x11')](_0x10f9bf));if(_0x10f9bf[_0xd40d('0x12')]){if(_0x10f9bf[_0xd40d('0x12')]['code']===0x1f4){logger[_0xd40d('0x12')](_0xd40d('0xd'),_0x55d5f6,_0x10f9bf[_0xd40d('0x12')][_0xd40d('0x13')]);return _0x3d7e6e(_0x10f9bf['error'][_0xd40d('0x13')]);}logger[_0xd40d('0x12')](_0xd40d('0xd'),_0x55d5f6,_0x10f9bf[_0xd40d('0x12')]['message']);return _0x30bd25(_0x10f9bf['error'][_0xd40d('0x13')]);}else{logger[_0xd40d('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x55d5f6,_0xd40d('0xe'));_0x30bd25(_0x10f9bf[_0xd40d('0x15')]['message']);}})[_0xd40d('0x16')](function(_0xa15ff0){logger[_0xd40d('0x12')](_0xd40d('0xd'),_0x55d5f6,_0xa15ff0);_0x3d7e6e(_0xa15ff0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f06e90d..296af26 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 _0x3688=['show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x44bc23,_0x52370e){var _0x21b16f=function(_0x20ca2a){while(--_0x20ca2a){_0x44bc23['push'](_0x44bc23['shift']());}};_0x21b16f(++_0x52370e);}(_0x3688,0xea));var _0x8368=function(_0x2281a0,_0x4e7028){_0x2281a0=_0x2281a0-0x0;var _0xc326c3=_0x3688[_0x2281a0];return _0xc326c3;};'use strict';var multer=require(_0x8368('0x0'));var util=require(_0x8368('0x1'));var path=require(_0x8368('0x2'));var timeout=require(_0x8368('0x3'));var express=require(_0x8368('0x4'));var router=express['Router']();var fs_extra=require(_0x8368('0x5'));var auth=require(_0x8368('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8368('0x7'));var controller=require(_0x8368('0x8'));router[_0x8368('0x9')]('/',auth[_0x8368('0xa')](),controller['index']);router['get']('/describe',auth[_0x8368('0xa')](),controller[_0x8368('0xb')]);router['get'](_0x8368('0xc'),auth[_0x8368('0xa')](),controller[_0x8368('0xd')]);router[_0x8368('0xe')]('/',auth[_0x8368('0xa')](),controller[_0x8368('0xf')]);router[_0x8368('0x10')](_0x8368('0xc'),auth[_0x8368('0xa')](),controller[_0x8368('0x11')]);router[_0x8368('0x12')]('/:id',auth[_0x8368('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x744a=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','util'];(function(_0x50fb8b,_0x3c556c){var _0x2c6cc3=function(_0x21293c){while(--_0x21293c){_0x50fb8b['push'](_0x50fb8b['shift']());}};_0x2c6cc3(++_0x3c556c);}(_0x744a,0xc7));var _0xa744=function(_0x22a478,_0x4b6235){_0x22a478=_0x22a478-0x0;var _0x4de8e5=_0x744a[_0x22a478];return _0x4de8e5;};'use strict';var multer=require('multer');var util=require(_0xa744('0x0'));var path=require(_0xa744('0x1'));var timeout=require(_0xa744('0x2'));var express=require(_0xa744('0x3'));var router=express['Router']();var fs_extra=require(_0xa744('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa744('0x5'));var config=require(_0xa744('0x6'));var controller=require(_0xa744('0x7'));router[_0xa744('0x8')]('/',auth[_0xa744('0x9')](),controller[_0xa744('0xa')]);router[_0xa744('0x8')](_0xa744('0xb'),auth[_0xa744('0x9')](),controller['describe']);router[_0xa744('0x8')]('/:id',auth[_0xa744('0x9')](),controller[_0xa744('0xc')]);router[_0xa744('0xd')]('/',auth[_0xa744('0x9')](),controller[_0xa744('0xe')]);router[_0xa744('0xf')](_0xa744('0x10'),auth[_0xa744('0x9')](),controller['update']);router[_0xa744('0x11')](_0xa744('0x10'),auth[_0xa744('0x9')](),controller[_0xa744('0x12')]);module[_0xa744('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 86543ab..1700bd4 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x557e5a,_0x561fed){var _0x3a118e=function(_0x15793d){while(--_0x15793d){_0x557e5a['push'](_0x557e5a['shift']());}};_0x3a118e(++_0x561fed);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x59900d,_0x4d722a){var _0x3d3083=function(_0x4b7868){while(--_0x4b7868){_0x59900d['push'](_0x59900d['shift']());}};_0x3d3083(++_0x4d722a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x4b84[_0x188a93];return _0x23b40d;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0cfa8f1..d41d7b9 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 _0xb8ec=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x365056,_0x5afa4f){var _0x412743=function(_0x224968){while(--_0x224968){_0x365056['push'](_0x365056['shift']());}};_0x412743(++_0x5afa4f);}(_0xb8ec,0x11f));var _0xcb8e=function(_0x123990,_0x1025b4){_0x123990=_0x123990-0x0;var _0x3fb195=_0xb8ec[_0x123990];return _0x3fb195;};'use strict';var emlformat=require(_0xcb8e('0x0'));var rimraf=require(_0xcb8e('0x1'));var zipdir=require(_0xcb8e('0x2'));var jsonpatch=require(_0xcb8e('0x3'));var rp=require('request-promise');var moment=require(_0xcb8e('0x4'));var BPromise=require(_0xcb8e('0x5'));var Mustache=require(_0xcb8e('0x6'));var util=require(_0xcb8e('0x7'));var path=require('path');var sox=require(_0xcb8e('0x8'));var csv=require(_0xcb8e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb8e('0xa'));var _=require(_0xcb8e('0xb'));var squel=require(_0xcb8e('0xc'));var crypto=require(_0xcb8e('0xd'));var jsforce=require(_0xcb8e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcb8e('0x9'));var querystring=require(_0xcb8e('0xf'));var Papa=require(_0xcb8e('0x10'));var Redis=require(_0xcb8e('0x11'));var authService=require(_0xcb8e('0x12'));var qs=require(_0xcb8e('0x13'));var as=require(_0xcb8e('0x14'));var hardwareService=require(_0xcb8e('0x15'));var logger=require(_0xcb8e('0x16'))(_0xcb8e('0x17'));var utils=require(_0xcb8e('0x18'));var config=require(_0xcb8e('0x19'));var licenseUtil=require(_0xcb8e('0x1a'));var db=require(_0xcb8e('0x1b'))['db'];function respondWithStatusCode(_0x133c0f,_0x4c6909){_0x4c6909=_0x4c6909||0xcc;return function(_0x443a05){if(_0x443a05){return _0x133c0f[_0xcb8e('0x1c')](_0x4c6909);}return _0x133c0f[_0xcb8e('0x1d')](_0x4c6909)[_0xcb8e('0x1e')]();};}function respondWithResult(_0x675d63,_0x316782){_0x316782=_0x316782||0xc8;return function(_0x5705d2){if(_0x5705d2){return _0x675d63[_0xcb8e('0x1d')](_0x316782)[_0xcb8e('0x1f')](_0x5705d2);}};}function respondWithFilteredResult(_0x251923,_0x1c52d7){return function(_0x5bc7aa){if(_0x5bc7aa){var _0x1bad88=typeof _0x1c52d7[_0xcb8e('0x20')]===_0xcb8e('0x21')&&typeof _0x1c52d7[_0xcb8e('0x22')]===_0xcb8e('0x21');var _0x1eb421=_0x5bc7aa[_0xcb8e('0x23')];var _0x1cc8e8=_0x1bad88?0x0:_0x1c52d7[_0xcb8e('0x20')];var _0x23c934=_0x1bad88?_0x5bc7aa[_0xcb8e('0x23')]:_0x1c52d7[_0xcb8e('0x20')]+_0x1c52d7[_0xcb8e('0x22')];var _0x40c2e1;if(_0x23c934>=_0x1eb421){_0x23c934=_0x1eb421;_0x40c2e1=0xc8;}else{_0x40c2e1=0xce;}_0x251923['status'](_0x40c2e1);return _0x251923[_0xcb8e('0x24')]('Content-Range',_0x1cc8e8+'-'+_0x23c934+'/'+_0x1eb421)[_0xcb8e('0x1f')](_0x5bc7aa);}return null;};}function patchUpdates(_0x471108){return function(_0x2eac76){try{jsonpatch[_0xcb8e('0x25')](_0x2eac76,_0x471108,!![]);}catch(_0x491775){return BPromise[_0xcb8e('0x26')](_0x491775);}return _0x2eac76['save']();};}function saveUpdates(_0x5aa8e0,_0xf103b9){return function(_0x117e1b){if(_0x117e1b){return _0x117e1b[_0xcb8e('0x27')](_0x5aa8e0)[_0xcb8e('0x28')](function(_0x310084){return _0x310084;});}return null;};}function removeEntity(_0x5dbe6f,_0x3716c6){return function(_0x24c97f){if(_0x24c97f){return _0x24c97f['destroy']()[_0xcb8e('0x28')](function(){_0x5dbe6f[_0xcb8e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a627,_0x44a14c){return function(_0x2200a7){if(!_0x2200a7){_0x14a627[_0xcb8e('0x1c')](0x194);}return _0x2200a7;};}function handleError(_0x4ee515,_0x266335){_0x266335=_0x266335||0x1f4;return function(_0x1c57a2){logger[_0xcb8e('0x29')](_0x1c57a2['stack']);if(_0x1c57a2[_0xcb8e('0x2a')]){delete _0x1c57a2[_0xcb8e('0x2a')];}_0x4ee515[_0xcb8e('0x1d')](_0x266335)['send'](_0x1c57a2);};}exports['index']=function(_0x62079e,_0x230007){var _0x333130={},_0x4803ab={},_0xca4c8b={'count':0x0,'rows':[]};var _0x1860c8=_[_0xcb8e('0x2b')](db['MailTransferReport'][_0xcb8e('0x2c')],function(_0x56802c){return{'name':_0x56802c[_0xcb8e('0x2d')],'type':_0x56802c[_0xcb8e('0x2e')][_0xcb8e('0x2f')]};});_0x4803ab[_0xcb8e('0x30')]=_[_0xcb8e('0x2b')](_0x1860c8,_0xcb8e('0x2a'));_0x4803ab[_0xcb8e('0x31')]=_[_0xcb8e('0x32')](_0x62079e[_0xcb8e('0x31')]);_0x4803ab[_0xcb8e('0x33')]=_['intersection'](_0x4803ab[_0xcb8e('0x30')],_0x4803ab[_0xcb8e('0x31')]);_0x333130[_0xcb8e('0x34')]=_[_0xcb8e('0x35')](_0x4803ab[_0xcb8e('0x30')],qs[_0xcb8e('0x36')](_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x36')]));_0x333130['attributes']=_0x333130[_0xcb8e('0x34')][_0xcb8e('0x37')]?_0x333130['attributes']:_0x4803ab[_0xcb8e('0x30')];if(!_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x38')](_0xcb8e('0x39'))){_0x333130[_0xcb8e('0x22')]=qs['limit'](_0x62079e[_0xcb8e('0x31')]['limit']);_0x333130[_0xcb8e('0x20')]=qs[_0xcb8e('0x20')](_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x20')]);}_0x333130[_0xcb8e('0x3a')]=qs[_0xcb8e('0x3b')](_0x62079e['query'][_0xcb8e('0x3b')]);_0x333130[_0xcb8e('0x3c')]=qs[_0xcb8e('0x33')](_['pick'](_0x62079e['query'],_0x4803ab[_0xcb8e('0x33')]),_0x1860c8);if(_0x62079e['query'][_0xcb8e('0x3d')]){_0x333130['where']=_[_0xcb8e('0x3e')](_0x333130['where'],{'$or':_['map'](_0x1860c8,function(_0x2998ed){if(_0x2998ed[_0xcb8e('0x2e')]!==_0xcb8e('0x3f')){var _0x2c8548={};_0x2c8548[_0x2998ed[_0xcb8e('0x2a')]]={'$like':'%'+_0x62079e['query'][_0xcb8e('0x3d')]+'%'};return _0x2c8548;}})});}_0x333130=_[_0xcb8e('0x3e')]({},_0x333130,_0x62079e[_0xcb8e('0x40')]);var _0x58b235={'where':_0x333130[_0xcb8e('0x3c')]};return db[_0xcb8e('0x41')][_0xcb8e('0x23')](_0x58b235)[_0xcb8e('0x28')](function(_0x2c908e){_0xca4c8b['count']=_0x2c908e;if(_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x42')]){_0x333130['include']=[{'all':!![]}];}return db[_0xcb8e('0x41')][_0xcb8e('0x43')](_0x333130);})[_0xcb8e('0x28')](function(_0x3c6e3d){_0xca4c8b[_0xcb8e('0x44')]=_0x3c6e3d;return _0xca4c8b;})[_0xcb8e('0x28')](respondWithFilteredResult(_0x230007,_0x333130))[_0xcb8e('0x45')](handleError(_0x230007,null));};exports[_0xcb8e('0x46')]=function(_0x356fde,_0x5e7b1f){var _0x10b8bf={'raw':!![],'where':{'id':_0x356fde['params']['id']}},_0x2a01ec={};_0x2a01ec[_0xcb8e('0x30')]=_[_0xcb8e('0x32')](db['MailTransferReport']['rawAttributes']);_0x2a01ec['query']=_['keys'](_0x356fde[_0xcb8e('0x31')]);_0x2a01ec[_0xcb8e('0x33')]=_['intersection'](_0x2a01ec['model'],_0x2a01ec['query']);_0x10b8bf['attributes']=_[_0xcb8e('0x35')](_0x2a01ec['model'],qs[_0xcb8e('0x36')](_0x356fde[_0xcb8e('0x31')][_0xcb8e('0x36')]));_0x10b8bf[_0xcb8e('0x34')]=_0x10b8bf['attributes'][_0xcb8e('0x37')]?_0x10b8bf[_0xcb8e('0x34')]:_0x2a01ec['model'];if(_0x356fde[_0xcb8e('0x31')][_0xcb8e('0x42')]){_0x10b8bf[_0xcb8e('0x47')]=[{'all':!![]}];}_0x10b8bf=_[_0xcb8e('0x3e')]({},_0x10b8bf,_0x356fde[_0xcb8e('0x40')]);return db[_0xcb8e('0x41')][_0xcb8e('0x48')](_0x10b8bf)[_0xcb8e('0x28')](handleEntityNotFound(_0x5e7b1f,null))[_0xcb8e('0x28')](respondWithResult(_0x5e7b1f,null))[_0xcb8e('0x45')](handleError(_0x5e7b1f,null));};exports[_0xcb8e('0x49')]=function(_0x5d380d,_0x28b555){return db[_0xcb8e('0x41')][_0xcb8e('0x49')](_0x5d380d[_0xcb8e('0x4a')],{})['then'](respondWithResult(_0x28b555,0xc9))[_0xcb8e('0x45')](handleError(_0x28b555,null));};exports[_0xcb8e('0x27')]=function(_0x1a43f2,_0x1c8b0c){if(_0x1a43f2[_0xcb8e('0x4a')]['id']){delete _0x1a43f2[_0xcb8e('0x4a')]['id'];}return db[_0xcb8e('0x41')][_0xcb8e('0x48')]({'where':{'id':_0x1a43f2[_0xcb8e('0x4b')]['id']}})[_0xcb8e('0x28')](handleEntityNotFound(_0x1c8b0c,null))['then'](saveUpdates(_0x1a43f2[_0xcb8e('0x4a')],null))['then'](respondWithResult(_0x1c8b0c,null))[_0xcb8e('0x45')](handleError(_0x1c8b0c,null));};exports[_0xcb8e('0x4c')]=function(_0xc29b15,_0x47f6f0){return db[_0xcb8e('0x41')][_0xcb8e('0x48')]({'where':{'id':_0xc29b15[_0xcb8e('0x4b')]['id']}})[_0xcb8e('0x28')](handleEntityNotFound(_0x47f6f0,null))[_0xcb8e('0x28')](removeEntity(_0x47f6f0,null))[_0xcb8e('0x45')](handleError(_0x47f6f0,null));};exports['describe']=function(_0x21502c,_0x2198bf){return db[_0xcb8e('0x41')]['describe']()[_0xcb8e('0x28')](respondWithResult(_0x2198bf,null))[_0xcb8e('0x45')](handleError(_0x2198bf,null));}; \ No newline at end of file +var _0xdbfc=['findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','includeAll'];(function(_0x224a72,_0x72683){var _0x51848a=function(_0x4bd7da){while(--_0x4bd7da){_0x224a72['push'](_0x224a72['shift']());}};_0x51848a(++_0x72683);}(_0xdbfc,0xa7));var _0xcdbf=function(_0x39fa0e,_0x304d8b){_0x39fa0e=_0x39fa0e-0x0;var _0x3490f4=_0xdbfc[_0x39fa0e];return _0x3490f4;};'use strict';var emlformat=require(_0xcdbf('0x0'));var rimraf=require(_0xcdbf('0x1'));var zipdir=require(_0xcdbf('0x2'));var jsonpatch=require(_0xcdbf('0x3'));var rp=require('request-promise');var moment=require(_0xcdbf('0x4'));var BPromise=require(_0xcdbf('0x5'));var Mustache=require(_0xcdbf('0x6'));var util=require('util');var path=require(_0xcdbf('0x7'));var sox=require('sox');var csv=require(_0xcdbf('0x8'));var ejs=require(_0xcdbf('0x9'));var fs=require('fs');var fs_extra=require(_0xcdbf('0xa'));var _=require(_0xcdbf('0xb'));var squel=require('squel');var crypto=require(_0xcdbf('0xc'));var jsforce=require(_0xcdbf('0xd'));var deskjs=require(_0xcdbf('0xe'));var toCsv=require(_0xcdbf('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdbf('0xf'));var authService=require(_0xcdbf('0x10'));var qs=require(_0xcdbf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdbf('0x12'));var logger=require(_0xcdbf('0x13'))('api');var utils=require(_0xcdbf('0x14'));var config=require(_0xcdbf('0x15'));var licenseUtil=require(_0xcdbf('0x16'));var db=require(_0xcdbf('0x17'))['db'];function respondWithStatusCode(_0x104da5,_0x59816d){_0x59816d=_0x59816d||0xcc;return function(_0x1a51e3){if(_0x1a51e3){return _0x104da5['sendStatus'](_0x59816d);}return _0x104da5[_0xcdbf('0x18')](_0x59816d)['end']();};}function respondWithResult(_0x315602,_0x274497){_0x274497=_0x274497||0xc8;return function(_0xab4e8d){if(_0xab4e8d){return _0x315602[_0xcdbf('0x18')](_0x274497)[_0xcdbf('0x19')](_0xab4e8d);}};}function respondWithFilteredResult(_0x496024,_0x537f36){return function(_0x3764cb){if(_0x3764cb){var _0x141550=typeof _0x537f36[_0xcdbf('0x1a')]===_0xcdbf('0x1b')&&typeof _0x537f36[_0xcdbf('0x1c')]===_0xcdbf('0x1b');var _0x2e0f01=_0x3764cb[_0xcdbf('0x1d')];var _0x467ea4=_0x141550?0x0:_0x537f36[_0xcdbf('0x1a')];var _0x4f2a68=_0x141550?_0x3764cb['count']:_0x537f36[_0xcdbf('0x1a')]+_0x537f36[_0xcdbf('0x1c')];var _0x3745d7;if(_0x4f2a68>=_0x2e0f01){_0x4f2a68=_0x2e0f01;_0x3745d7=0xc8;}else{_0x3745d7=0xce;}_0x496024[_0xcdbf('0x18')](_0x3745d7);return _0x496024[_0xcdbf('0x1e')](_0xcdbf('0x1f'),_0x467ea4+'-'+_0x4f2a68+'/'+_0x2e0f01)[_0xcdbf('0x19')](_0x3764cb);}return null;};}function patchUpdates(_0x1953fb){return function(_0x4562fb){try{jsonpatch[_0xcdbf('0x20')](_0x4562fb,_0x1953fb,!![]);}catch(_0xa00620){return BPromise[_0xcdbf('0x21')](_0xa00620);}return _0x4562fb[_0xcdbf('0x22')]();};}function saveUpdates(_0x17a89a,_0x3f4ce9){return function(_0x38cce9){if(_0x38cce9){return _0x38cce9[_0xcdbf('0x23')](_0x17a89a)[_0xcdbf('0x24')](function(_0x36bebc){return _0x36bebc;});}return null;};}function removeEntity(_0x4c4dce,_0x380526){return function(_0x3ede8a){if(_0x3ede8a){return _0x3ede8a['destroy']()['then'](function(){_0x4c4dce['status'](0xcc)[_0xcdbf('0x25')]();});}};}function handleEntityNotFound(_0x4b9f5c,_0x204f96){return function(_0x44bc9e){if(!_0x44bc9e){_0x4b9f5c[_0xcdbf('0x26')](0x194);}return _0x44bc9e;};}function handleError(_0x11a71b,_0x52e245){_0x52e245=_0x52e245||0x1f4;return function(_0x339caf){logger[_0xcdbf('0x27')](_0x339caf[_0xcdbf('0x28')]);if(_0x339caf['name']){delete _0x339caf['name'];}_0x11a71b[_0xcdbf('0x18')](_0x52e245)['send'](_0x339caf);};}exports[_0xcdbf('0x29')]=function(_0x51736a,_0x416fdc){var _0x5655eb={},_0x1bdbf6={},_0x40e2ba={'count':0x0,'rows':[]};var _0x88b111=_[_0xcdbf('0x2a')](db['MailTransferReport'][_0xcdbf('0x2b')],function(_0x13a10c){return{'name':_0x13a10c[_0xcdbf('0x2c')],'type':_0x13a10c[_0xcdbf('0x2d')][_0xcdbf('0x2e')]};});_0x1bdbf6[_0xcdbf('0x2f')]=_['map'](_0x88b111,_0xcdbf('0x30'));_0x1bdbf6[_0xcdbf('0x31')]=_[_0xcdbf('0x32')](_0x51736a[_0xcdbf('0x31')]);_0x1bdbf6[_0xcdbf('0x33')]=_[_0xcdbf('0x34')](_0x1bdbf6[_0xcdbf('0x2f')],_0x1bdbf6[_0xcdbf('0x31')]);_0x5655eb['attributes']=_[_0xcdbf('0x34')](_0x1bdbf6['model'],qs[_0xcdbf('0x35')](_0x51736a[_0xcdbf('0x31')][_0xcdbf('0x35')]));_0x5655eb[_0xcdbf('0x36')]=_0x5655eb['attributes'][_0xcdbf('0x37')]?_0x5655eb[_0xcdbf('0x36')]:_0x1bdbf6[_0xcdbf('0x2f')];if(!_0x51736a[_0xcdbf('0x31')][_0xcdbf('0x38')](_0xcdbf('0x39'))){_0x5655eb[_0xcdbf('0x1c')]=qs['limit'](_0x51736a[_0xcdbf('0x31')][_0xcdbf('0x1c')]);_0x5655eb['offset']=qs[_0xcdbf('0x1a')](_0x51736a[_0xcdbf('0x31')][_0xcdbf('0x1a')]);}_0x5655eb['order']=qs[_0xcdbf('0x3a')](_0x51736a['query'][_0xcdbf('0x3a')]);_0x5655eb[_0xcdbf('0x3b')]=qs[_0xcdbf('0x33')](_[_0xcdbf('0x3c')](_0x51736a[_0xcdbf('0x31')],_0x1bdbf6['filters']),_0x88b111);if(_0x51736a[_0xcdbf('0x31')][_0xcdbf('0x3d')]){_0x5655eb[_0xcdbf('0x3b')]=_[_0xcdbf('0x3e')](_0x5655eb[_0xcdbf('0x3b')],{'$or':_[_0xcdbf('0x2a')](_0x88b111,function(_0x2c6d05){if(_0x2c6d05[_0xcdbf('0x2d')]!==_0xcdbf('0x3f')){var _0x49cbfb={};_0x49cbfb[_0x2c6d05['name']]={'$like':'%'+_0x51736a['query'][_0xcdbf('0x3d')]+'%'};return _0x49cbfb;}})});}_0x5655eb=_[_0xcdbf('0x3e')]({},_0x5655eb,_0x51736a[_0xcdbf('0x40')]);var _0xa53522={'where':_0x5655eb['where']};return db[_0xcdbf('0x41')][_0xcdbf('0x1d')](_0xa53522)['then'](function(_0xa4ec7f){_0x40e2ba['count']=_0xa4ec7f;if(_0x51736a[_0xcdbf('0x31')][_0xcdbf('0x42')]){_0x5655eb['include']=[{'all':!![]}];}return db[_0xcdbf('0x41')][_0xcdbf('0x43')](_0x5655eb);})[_0xcdbf('0x24')](function(_0x31a0bd){_0x40e2ba[_0xcdbf('0x44')]=_0x31a0bd;return _0x40e2ba;})[_0xcdbf('0x24')](respondWithFilteredResult(_0x416fdc,_0x5655eb))[_0xcdbf('0x45')](handleError(_0x416fdc,null));};exports[_0xcdbf('0x46')]=function(_0x3f965d,_0x257712){var _0x38a8c3={'raw':!![],'where':{'id':_0x3f965d[_0xcdbf('0x47')]['id']}},_0x157309={};_0x157309['model']=_[_0xcdbf('0x32')](db[_0xcdbf('0x41')][_0xcdbf('0x2b')]);_0x157309[_0xcdbf('0x31')]=_['keys'](_0x3f965d[_0xcdbf('0x31')]);_0x157309[_0xcdbf('0x33')]=_['intersection'](_0x157309[_0xcdbf('0x2f')],_0x157309[_0xcdbf('0x31')]);_0x38a8c3[_0xcdbf('0x36')]=_['intersection'](_0x157309['model'],qs[_0xcdbf('0x35')](_0x3f965d['query'][_0xcdbf('0x35')]));_0x38a8c3[_0xcdbf('0x36')]=_0x38a8c3[_0xcdbf('0x36')]['length']?_0x38a8c3['attributes']:_0x157309[_0xcdbf('0x2f')];if(_0x3f965d[_0xcdbf('0x31')][_0xcdbf('0x42')]){_0x38a8c3[_0xcdbf('0x48')]=[{'all':!![]}];}_0x38a8c3=_[_0xcdbf('0x3e')]({},_0x38a8c3,_0x3f965d[_0xcdbf('0x40')]);return db['MailTransferReport'][_0xcdbf('0x49')](_0x38a8c3)['then'](handleEntityNotFound(_0x257712,null))['then'](respondWithResult(_0x257712,null))[_0xcdbf('0x45')](handleError(_0x257712,null));};exports[_0xcdbf('0x4a')]=function(_0x4f1bdc,_0x392a4d){return db['MailTransferReport'][_0xcdbf('0x4a')](_0x4f1bdc['body'],{})[_0xcdbf('0x24')](respondWithResult(_0x392a4d,0xc9))[_0xcdbf('0x45')](handleError(_0x392a4d,null));};exports[_0xcdbf('0x23')]=function(_0xa82435,_0x59fa77){if(_0xa82435['body']['id']){delete _0xa82435[_0xcdbf('0x4b')]['id'];}return db[_0xcdbf('0x41')][_0xcdbf('0x49')]({'where':{'id':_0xa82435[_0xcdbf('0x47')]['id']}})[_0xcdbf('0x24')](handleEntityNotFound(_0x59fa77,null))[_0xcdbf('0x24')](saveUpdates(_0xa82435[_0xcdbf('0x4b')],null))[_0xcdbf('0x24')](respondWithResult(_0x59fa77,null))[_0xcdbf('0x45')](handleError(_0x59fa77,null));};exports[_0xcdbf('0x4c')]=function(_0x5a8ee0,_0x2ef8b4){return db[_0xcdbf('0x41')][_0xcdbf('0x49')]({'where':{'id':_0x5a8ee0[_0xcdbf('0x47')]['id']}})[_0xcdbf('0x24')](handleEntityNotFound(_0x2ef8b4,null))[_0xcdbf('0x24')](removeEntity(_0x2ef8b4,null))['catch'](handleError(_0x2ef8b4,null));};exports[_0xcdbf('0x4d')]=function(_0x956373,_0x5d13f0){return db[_0xcdbf('0x41')][_0xcdbf('0x4d')]()[_0xcdbf('0x24')](respondWithResult(_0x5d13f0,null))[_0xcdbf('0x45')](handleError(_0x5d13f0,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 60bd039..4940991 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 _0x4a25=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x5eaca5,_0x5effb5){var _0x15baf6=function(_0x1239b3){while(--_0x1239b3){_0x5eaca5['push'](_0x5eaca5['shift']());}};_0x15baf6(++_0x5effb5);}(_0x4a25,0x1d4));var _0x54a2=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x4a25[_0x2ab365];return _0x49fef3;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[{'name':_0x54a2('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7351=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x78c268,_0x24c33f){var _0x1aac4d=function(_0x3b1fb1){while(--_0x3b1fb1){_0x78c268['push'](_0x78c268['shift']());}};_0x1aac4d(++_0x24c33f);}(_0x7351,0x139));var _0x1735=function(_0x54d412,_0x146464){_0x54d412=_0x54d412-0x0;var _0x59eb92=_0x7351[_0x54d412];return _0x59eb92;};'use strict';var _=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var logger=require(_0x1735('0x2'))(_0x1735('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1735('0x4'));var fs=require('fs');var path=require(_0x1735('0x5'));var rimraf=require(_0x1735('0x6'));var config=require(_0x1735('0x7'));var attributes=require(_0x1735('0x8'));module[_0x1735('0x9')]=function(_0x47fa51,_0x3fdcc1){return _0x47fa51[_0x1735('0xa')](_0x1735('0xb'),attributes,{'tableName':_0x1735('0xc'),'paranoid':![],'indexes':[{'name':_0x1735('0xd'),'fields':[_0x1735('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 2f500cf..1dbdd3e 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 _0xfabe=['rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xfabe,0x12c));var _0xefab=function(_0x463912,_0x1b44df){_0x463912=_0x463912-0x0;var _0x5de804=_0xfabe[_0x463912];return _0x5de804;};'use strict';var _=require(_0xefab('0x0'));var util=require(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rs=require(_0xefab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefab('0x5'))['db'];var utils=require(_0xefab('0x6'));var logger=require(_0xefab('0x7'))(_0xefab('0x8'));var config=require(_0xefab('0x9'));var jayson=require(_0xefab('0xa'));var client=jayson[_0xefab('0xb')][_0xefab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x388f02,_0x55acc0,_0x27de60){return new BPromise(function(_0x16c001,_0x46a248){return client['request'](_0x388f02,_0x27de60)['then'](function(_0x1a2f0a){logger[_0xefab('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x55acc0,_0xefab('0xe'));logger[_0xefab('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x55acc0,'request\x20sent',JSON[_0xefab('0x10')](_0x1a2f0a));if(_0x1a2f0a[_0xefab('0x11')]){if(_0x1a2f0a[_0xefab('0x11')]['code']===0x1f4){logger[_0xefab('0x11')](_0xefab('0x12'),_0x55acc0,_0x1a2f0a[_0xefab('0x11')][_0xefab('0x13')]);return _0x46a248(_0x1a2f0a[_0xefab('0x11')][_0xefab('0x13')]);}logger['error'](_0xefab('0x12'),_0x55acc0,_0x1a2f0a[_0xefab('0x11')][_0xefab('0x13')]);return _0x16c001(_0x1a2f0a[_0xefab('0x11')]['message']);}else{logger['info'](_0xefab('0x12'),_0x55acc0,_0xefab('0xe'));_0x16c001(_0x1a2f0a[_0xefab('0x14')][_0xefab('0x13')]);}})[_0xefab('0x15')](function(_0x51b503){logger['error'](_0xefab('0x12'),_0x55acc0,_0x51b503);_0x46a248(_0x51b503);});});} \ No newline at end of file +var _0x056b=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x528011,_0x10b96d){var _0xcf52e0=function(_0x26f3f0){while(--_0x26f3f0){_0x528011['push'](_0x528011['shift']());}};_0xcf52e0(++_0x10b96d);}(_0x056b,0xb6));var _0xb056=function(_0xd76edb,_0x1583c4){_0xd76edb=_0xd76edb-0x0;var _0x528c9b=_0x056b[_0xd76edb];return _0x528c9b;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f68c90d..3434335 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 _0x1391=['/describe','describe','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0x1391,0x1ad));var _0x1139=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x1391[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x1139('0x0'));var util=require(_0x1139('0x1'));var path=require(_0x1139('0x2'));var timeout=require(_0x1139('0x3'));var express=require(_0x1139('0x4'));var router=express['Router']();var fs_extra=require(_0x1139('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1139('0x6'));var config=require(_0x1139('0x7'));var controller=require(_0x1139('0x8'));router['get']('/',auth[_0x1139('0x9')](),controller[_0x1139('0xa')]);router['get'](_0x1139('0xb'),auth['isAuthenticated'](),controller[_0x1139('0xc')]);router[_0x1139('0xd')](_0x1139('0xe'),auth[_0x1139('0x9')](),controller[_0x1139('0xf')]);router[_0x1139('0x10')]('/',auth[_0x1139('0x9')](),controller[_0x1139('0x11')]);router[_0x1139('0x12')](_0x1139('0xe'),auth['isAuthenticated'](),controller[_0x1139('0x13')]);router['delete'](_0x1139('0xe'),auth['isAuthenticated'](),controller[_0x1139('0x14')]);module[_0x1139('0x15')]=router; \ No newline at end of file +var _0x78a6=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x78a6,0x144));var _0x678a=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x78a6[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x678a('0x0'));var util=require(_0x678a('0x1'));var path=require(_0x678a('0x2'));var timeout=require('connect-timeout');var express=require(_0x678a('0x3'));var router=express[_0x678a('0x4')]();var fs_extra=require(_0x678a('0x5'));var auth=require(_0x678a('0x6'));var interaction=require(_0x678a('0x7'));var config=require(_0x678a('0x8'));var controller=require('./memberReport.controller');router[_0x678a('0x9')]('/',auth[_0x678a('0xa')](),controller[_0x678a('0xb')]);router[_0x678a('0x9')](_0x678a('0xc'),auth[_0x678a('0xa')](),controller[_0x678a('0xd')]);router[_0x678a('0x9')](_0x678a('0xe'),auth[_0x678a('0xa')](),controller[_0x678a('0xf')]);router[_0x678a('0x10')]('/',auth['isAuthenticated'](),controller[_0x678a('0x11')]);router[_0x678a('0x12')]('/:id',auth[_0x678a('0xa')](),controller[_0x678a('0x13')]);router[_0x678a('0x14')](_0x678a('0xe'),auth[_0x678a('0xa')](),controller[_0x678a('0x15')]);module[_0x678a('0x16')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ea03a6d..4ab97ae 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 _0x7c20=['sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','INTEGER'];(function(_0x4f4679,_0x713087){var _0x2f7cd0=function(_0x8eaf53){while(--_0x8eaf53){_0x4f4679['push'](_0x4f4679['shift']());}};_0x2f7cd0(++_0x713087);}(_0x7c20,0x90));var _0x07c2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7c20[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x07c2('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x07c2('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x07c2('0x1')]},'type':{'type':Sequelize[_0x07c2('0x1')],'defaultValue':_0x07c2('0x2'),'comment':_0x07c2('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x07c2('0x4')],'set':function(_0x2b671e){var _0x3d52f4=moment(_0x2b671e);var _0x249968=moment(this[_0x07c2('0x5')](_0x07c2('0x6')));var _0x561e88=_0x3d52f4[_0x07c2('0x7')](_0x249968,_0x07c2('0x8'));this[_0x07c2('0x9')](_0x07c2('0xa'),_0x2b671e);this[_0x07c2('0x9')](_0x07c2('0xb'),_0x561e88>=0x0?_0x561e88:null);}},'data1':{'type':Sequelize[_0x07c2('0x1')],'comment':_0x07c2('0xc')},'data2':{'type':Sequelize[_0x07c2('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x07c2('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x07c2('0xd')},'data5':{'type':Sequelize[_0x07c2('0x1')],'comment':_0x07c2('0xe')},'role':{'type':Sequelize[_0x07c2('0x1')]},'internal':{'type':Sequelize[_0x07c2('0xf')]},'uniqueid':{'type':Sequelize[_0x07c2('0x1')]}}; \ No newline at end of file +var _0x122a=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x122a,0x115));var _0xa122=function(_0x21deb2,_0x20383a){_0x21deb2=_0x21deb2-0x0;var _0x201b2d=_0x122a[_0x21deb2];return _0x201b2d;};'use strict';var Sequelize=require(_0xa122('0x0'));var moment=require(_0xa122('0x1'));module[_0xa122('0x2')]={'channel':{'type':Sequelize[_0xa122('0x3')]},'membername':{'type':Sequelize[_0xa122('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa122('0x3')],'defaultValue':_0xa122('0x4'),'comment':_0xa122('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xa122('0x6')]},'exitAt':{'type':Sequelize[_0xa122('0x6')],'set':function(_0x62935a){var _0x1f2bf4=moment(_0x62935a);var _0x2cf689=moment(this[_0xa122('0x7')](_0xa122('0x8')));var _0xef80f=_0x1f2bf4['diff'](_0x2cf689,_0xa122('0x9'));this[_0xa122('0xa')](_0xa122('0xb'),_0x62935a);this[_0xa122('0xa')](_0xa122('0xc'),_0xef80f>=0x0?_0xef80f:null);}},'data1':{'type':Sequelize[_0xa122('0x3')],'comment':_0xa122('0xd')},'data2':{'type':Sequelize[_0xa122('0x3')],'comment':_0xa122('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xa122('0xf')},'data4':{'type':Sequelize[_0xa122('0x3')],'comment':_0xa122('0x10')},'data5':{'type':Sequelize[_0xa122('0x3')],'comment':_0xa122('0x11')},'role':{'type':Sequelize[_0xa122('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xa122('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 36b5785..6761a1b 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(_0x1d6fff,_0x324f13){var _0xf0eaed=function(_0x58e63){while(--_0x58e63){_0x1d6fff['push'](_0x1d6fff['shift']());}};_0xf0eaed(++_0x324f13);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xedd9,0xfc));var _0x9edd=function(_0x590816,_0x57da8b){_0x590816=_0x590816-0x0;var _0x5cd527=_0xedd9[_0x590816];return _0x5cd527;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 00584c8..6447ec2 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 _0xd022=['../../config/logger','api','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','interface','lodash','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xd022,0xa6));var _0x2d02=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xd022[_0x279d37];return _0x530173;};'use strict';var _=require(_0x2d02('0x0'));var util=require(_0x2d02('0x1'));var logger=require(_0x2d02('0x2'))(_0x2d02('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d02('0x4'));var fs=require('fs');var path=require(_0x2d02('0x5'));var rimraf=require('rimraf');var config=require(_0x2d02('0x6'));var attributes=require(_0x2d02('0x7'));module[_0x2d02('0x8')]=function(_0x39c5e0,_0x511346){return _0x39c5e0[_0x2d02('0x9')]('MemberReport',attributes,{'tableName':_0x2d02('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x2d02('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','membername_interface','membername'];(function(_0xa68a32,_0x54036d){var _0x1e4b16=function(_0x4e68c9){while(--_0x4e68c9){_0xa68a32['push'](_0xa68a32['shift']());}};_0x1e4b16(++_0x54036d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0xfdbd[_0x5b3950];return _0x41e436;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8f35402..b55a38f 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 _0x980e=['options','raw','where','attributes','map','include','model','CreateMemberReport','create','body','then','UpdateMemberReport','update','limit','lodash','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x13e048,_0x110a78){var _0x20affa=function(_0x13c748){while(--_0x13c748){_0x13e048['push'](_0x13e048['shift']());}};_0x20affa(++_0x110a78);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe980('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe980('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe980('0x3'));var logger=require(_0xe980('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe980('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5825c1,_0xc47bdf,_0x27cc8c){return new BPromise(function(_0x3683df,_0x2d76d0){return client[_0xe980('0x6')](_0x5825c1,_0x27cc8c)['then'](function(_0xf9f019){logger[_0xe980('0x7')](_0xe980('0x8'),_0xc47bdf,'request\x20sent');logger[_0xe980('0x9')](_0xe980('0xa'),_0xc47bdf,_0xe980('0xb'),JSON[_0xe980('0xc')](_0xf9f019));if(_0xf9f019[_0xe980('0xd')]){if(_0xf9f019['error']['code']===0x1f4){logger['error'](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')]['message']);return _0x2d76d0(_0xf9f019['error'][_0xe980('0xe')]);}logger[_0xe980('0xd')](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);return _0x3683df(_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xc47bdf,'request\x20sent');_0x3683df(_0xf9f019[_0xe980('0xf')][_0xe980('0xe')]);}})[_0xe980('0x10')](function(_0x406418){logger[_0xe980('0xd')]('MemberReport,\x20%s,\x20%s',_0xc47bdf,_0x406418);_0x2d76d0(_0x406418);});});}exports[_0xe980('0x11')]=function(_0x1c6354){var _0x1ddb12=this;return new Promise(function(_0x538d32,_0x5aa2c1){return db[_0xe980('0x12')][_0xe980('0x13')]({'raw':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'where':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x16')]||null:null,'attributes':_0x1c6354['options']?_0x1c6354['options'][_0xe980('0x17')]||null:null,'limit':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['limit']||null:null,'include':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['include']?_[_0xe980('0x18')](_0x1c6354[_0xe980('0x14')][_0xe980('0x19')],function(_0x4b7888){return{'model':db[_0x4b7888[_0xe980('0x1a')]],'as':_0x4b7888['as'],'attributes':_0x4b7888['attributes'],'include':_0x4b7888[_0xe980('0x19')]?_[_0xe980('0x18')](_0x4b7888[_0xe980('0x19')],function(_0x40a34e){return{'model':db[_0x40a34e['model']],'as':_0x40a34e['as'],'attributes':_0x40a34e[_0xe980('0x17')],'include':_0x40a34e[_0xe980('0x19')]?_[_0xe980('0x18')](_0x40a34e['include'],function(_0x54e755){return{'model':db[_0x54e755[_0xe980('0x1a')]],'as':_0x54e755['as'],'attributes':_0x54e755[_0xe980('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16f2fe){logger['info'](_0xe980('0x11'),_0x1c6354);logger[_0xe980('0x9')](_0xe980('0x11'),_0x1c6354,JSON[_0xe980('0xc')](_0x16f2fe));_0x538d32(_0x16f2fe);})[_0xe980('0x10')](function(_0x43a7c2){logger['error'](_0xe980('0x11'),_0x43a7c2['message'],_0x1c6354);_0x5aa2c1(_0x1ddb12[_0xe980('0xd')](0x1f4,_0x43a7c2[_0xe980('0xe')]));});});};exports[_0xe980('0x1b')]=function(_0x38ab6d){var _0x2a9ea2=this;return new Promise(function(_0x56fbf7,_0x4bf013){return db[_0xe980('0x12')][_0xe980('0x1c')](_0x38ab6d[_0xe980('0x1d')],{'raw':_0x38ab6d[_0xe980('0x14')]?_0x38ab6d[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![]})[_0xe980('0x1e')](function(_0x369c3a){logger[_0xe980('0x7')](_0xe980('0x1b'),_0x38ab6d);logger[_0xe980('0x9')]('CreateMemberReport',_0x38ab6d,JSON['stringify'](_0x369c3a));_0x56fbf7(_0x369c3a);})[_0xe980('0x10')](function(_0x4702e0){logger[_0xe980('0xd')]('CreateMemberReport',_0x4702e0[_0xe980('0xe')],_0x38ab6d);_0x4bf013(_0x2a9ea2[_0xe980('0xd')](0x1f4,_0x4702e0[_0xe980('0xe')]));});});};exports[_0xe980('0x1f')]=function(_0x163db9){var _0x44686a=this;return new Promise(function(_0x1811b3,_0x36ab72){return db[_0xe980('0x12')][_0xe980('0x20')](_0x163db9['body'],{'raw':_0x163db9['options']?_0x163db9[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163db9['options']?_0x163db9[_0xe980('0x14')]['where']||null:null,'attributes':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x17')]||null:null,'limit':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x21')]||null:null})['then'](function(_0x11fb5b){logger[_0xe980('0x7')](_0xe980('0x1f'),_0x163db9);logger[_0xe980('0x9')](_0xe980('0x1f'),_0x163db9,JSON['stringify'](_0x11fb5b));_0x1811b3(_0x11fb5b);})[_0xe980('0x10')](function(_0x1f35ed){logger[_0xe980('0xd')]('UpdateMemberReport',_0x1f35ed[_0xe980('0xe')],_0x163db9);_0x36ab72(_0x44686a['error'](0x1f4,_0x1f35ed[_0xe980('0xe')]));});});}; \ No newline at end of file +var _0x5c1f=['CreateMemberReport','body','raw','then','UpdateMemberReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MemberReport','findAll','options','attributes','limit','include','map','model','GetMemberReport'];(function(_0x8a43bd,_0x16696e){var _0x598ac6=function(_0x51f138){while(--_0x51f138){_0x8a43bd['push'](_0x8a43bd['shift']());}};_0x598ac6(++_0x16696e);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0x5c1f[_0x44474f];return _0x427d97;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var moment=require(_0xf5c1('0x1'));var BPromise=require(_0xf5c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5c1('0x3'));var db=require(_0xf5c1('0x4'))['db'];var utils=require(_0xf5c1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf5c1('0x6'));var client=jayson[_0xf5c1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a073,_0x21bb02,_0x12128b){return new BPromise(function(_0x40cad7,_0x5e3ef8){return client['request'](_0x34a073,_0x12128b)['then'](function(_0x4bd3a9){logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));logger[_0xf5c1('0xb')](_0xf5c1('0xc'),_0x21bb02,_0xf5c1('0xa'),JSON[_0xf5c1('0xd')](_0x4bd3a9));if(_0x4bd3a9[_0xf5c1('0xe')]){if(_0x4bd3a9['error'][_0xf5c1('0xf')]===0x1f4){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x5e3ef8(_0x4bd3a9['error'][_0xf5c1('0x10')]);}logger['error'](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x40cad7(_0x4bd3a9['error'][_0xf5c1('0x10')]);}else{logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));_0x40cad7(_0x4bd3a9['result'][_0xf5c1('0x10')]);}})[_0xf5c1('0x11')](function(_0x312d6b){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x312d6b);_0x5e3ef8(_0x312d6b);});});}exports['GetMemberReport']=function(_0x46d8e4){var _0x280727=this;return new Promise(function(_0x2d1db9,_0x17d627){return db[_0xf5c1('0x12')][_0xf5c1('0x13')]({'raw':_0x46d8e4[_0xf5c1('0x14')]?_0x46d8e4[_0xf5c1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x46d8e4[_0xf5c1('0x14')]?_0x46d8e4[_0xf5c1('0x14')]['where']||null:null,'attributes':_0x46d8e4[_0xf5c1('0x14')]?_0x46d8e4[_0xf5c1('0x14')][_0xf5c1('0x15')]||null:null,'limit':_0x46d8e4[_0xf5c1('0x14')]?_0x46d8e4[_0xf5c1('0x14')][_0xf5c1('0x16')]||null:null,'include':_0x46d8e4[_0xf5c1('0x14')]?_0x46d8e4['options'][_0xf5c1('0x17')]?_[_0xf5c1('0x18')](_0x46d8e4[_0xf5c1('0x14')]['include'],function(_0x1d17cd){return{'model':db[_0x1d17cd[_0xf5c1('0x19')]],'as':_0x1d17cd['as'],'attributes':_0x1d17cd[_0xf5c1('0x15')],'include':_0x1d17cd[_0xf5c1('0x17')]?_['map'](_0x1d17cd[_0xf5c1('0x17')],function(_0x2acb65){return{'model':db[_0x2acb65[_0xf5c1('0x19')]],'as':_0x2acb65['as'],'attributes':_0x2acb65[_0xf5c1('0x15')],'include':_0x2acb65['include']?_['map'](_0x2acb65[_0xf5c1('0x17')],function(_0x12c706){return{'model':db[_0x12c706[_0xf5c1('0x19')]],'as':_0x12c706['as'],'attributes':_0x12c706[_0xf5c1('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fbd0f){logger[_0xf5c1('0x8')]('GetMemberReport',_0x46d8e4);logger['debug'](_0xf5c1('0x1a'),_0x46d8e4,JSON[_0xf5c1('0xd')](_0x2fbd0f));_0x2d1db9(_0x2fbd0f);})[_0xf5c1('0x11')](function(_0x36fff6){logger['error'](_0xf5c1('0x1a'),_0x36fff6[_0xf5c1('0x10')],_0x46d8e4);_0x17d627(_0x280727[_0xf5c1('0xe')](0x1f4,_0x36fff6[_0xf5c1('0x10')]));});});};exports[_0xf5c1('0x1b')]=function(_0x220e31){var _0x5212a7=this;return new Promise(function(_0x14ca67,_0x2a6ec1){return db['MemberReport']['create'](_0x220e31[_0xf5c1('0x1c')],{'raw':_0x220e31['options']?_0x220e31[_0xf5c1('0x14')][_0xf5c1('0x1d')]===undefined?!![]:![]:!![]})[_0xf5c1('0x1e')](function(_0x13188a){logger[_0xf5c1('0x8')](_0xf5c1('0x1b'),_0x220e31);logger[_0xf5c1('0xb')](_0xf5c1('0x1b'),_0x220e31,JSON[_0xf5c1('0xd')](_0x13188a));_0x14ca67(_0x13188a);})[_0xf5c1('0x11')](function(_0x4d5918){logger[_0xf5c1('0xe')](_0xf5c1('0x1b'),_0x4d5918[_0xf5c1('0x10')],_0x220e31);_0x2a6ec1(_0x5212a7[_0xf5c1('0xe')](0x1f4,_0x4d5918[_0xf5c1('0x10')]));});});};exports[_0xf5c1('0x1f')]=function(_0x2c6eab){var _0x3ab69b=this;return new Promise(function(_0x33c7a9,_0x47bc09){return db[_0xf5c1('0x12')][_0xf5c1('0x20')](_0x2c6eab[_0xf5c1('0x1c')],{'raw':_0x2c6eab[_0xf5c1('0x14')]?_0x2c6eab[_0xf5c1('0x14')][_0xf5c1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6eab[_0xf5c1('0x14')]?_0x2c6eab[_0xf5c1('0x14')]['where']||null:null,'attributes':_0x2c6eab[_0xf5c1('0x14')]?_0x2c6eab[_0xf5c1('0x14')][_0xf5c1('0x15')]||null:null,'limit':_0x2c6eab[_0xf5c1('0x14')]?_0x2c6eab[_0xf5c1('0x14')][_0xf5c1('0x16')]||null:null})[_0xf5c1('0x1e')](function(_0x25e5ee){logger['info'](_0xf5c1('0x1f'),_0x2c6eab);logger[_0xf5c1('0xb')](_0xf5c1('0x1f'),_0x2c6eab,JSON[_0xf5c1('0xd')](_0x25e5ee));_0x33c7a9(_0x25e5ee);})['catch'](function(_0x644960){logger[_0xf5c1('0xe')](_0xf5c1('0x1f'),_0x644960['message'],_0x2c6eab);_0x47bc09(_0x3ab69b[_0xf5c1('0xe')](0x1f4,_0x644960['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 25c5bef..8d6021d 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 _0x869c=['./migration.controller','get','index','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x39ae1e,_0x38d749){var _0x298d1f=function(_0x1d6aad){while(--_0x1d6aad){_0x39ae1e['push'](_0x39ae1e['shift']());}};_0x298d1f(++_0x38d749);}(_0x869c,0x1bb));var _0xc869=function(_0x184d86,_0x180b98){_0x184d86=_0x184d86-0x0;var _0x4f3c4e=_0x869c[_0x184d86];return _0x4f3c4e;};'use strict';var multer=require(_0xc869('0x0'));var util=require(_0xc869('0x1'));var path=require('path');var timeout=require(_0xc869('0x2'));var express=require(_0xc869('0x3'));var router=express[_0xc869('0x4')]();var fs_extra=require(_0xc869('0x5'));var auth=require(_0xc869('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc869('0x7'));var controller=require(_0xc869('0x8'));router[_0xc869('0x9')]('/',controller[_0xc869('0xa')]);module['exports']=router; \ No newline at end of file +var _0x24e3=['get','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x24e3,0x1a4));var _0x324e=function(_0x3cb43a,_0x7b8d1d){_0x3cb43a=_0x3cb43a-0x0;var _0x1a3d90=_0x24e3[_0x3cb43a];return _0x1a3d90;};'use strict';var multer=require('multer');var util=require(_0x324e('0x0'));var path=require('path');var timeout=require(_0x324e('0x1'));var express=require(_0x324e('0x2'));var router=express[_0x324e('0x3')]();var fs_extra=require(_0x324e('0x4'));var auth=require(_0x324e('0x5'));var interaction=require(_0x324e('0x6'));var config=require(_0x324e('0x7'));var controller=require(_0x324e('0x8'));router[_0x324e('0x9')]('/',controller['index']);module[_0x324e('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 66e7372..1de71a0 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 _0xf63f=['exports','version','sequelize'];(function(_0x7d2272,_0x41f365){var _0x5bc56e=function(_0x3974af){while(--_0x3974af){_0x7d2272['push'](_0x7d2272['shift']());}};_0x5bc56e(++_0x41f365);}(_0xf63f,0xfe));var _0xff63=function(_0x5d70d5,_0x1eab50){_0x5d70d5=_0x5d70d5-0x0;var _0x29828c=_0xf63f[_0x5d70d5];return _0x29828c;};'use strict';var Sequelize=require(_0xff63('0x0'));module[_0xff63('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xff63('0x2')}}; \ No newline at end of file +var _0xd8af=['STRING','version','sequelize','exports'];(function(_0x390365,_0x151fb5){var _0x499d9e=function(_0x1dbae3){while(--_0x1dbae3){_0x390365['push'](_0x390365['shift']());}};_0x499d9e(++_0x151fb5);}(_0xd8af,0x1ea));var _0xfd8a=function(_0x1b3672,_0xf0a37f){_0x1b3672=_0x1b3672-0x0;var _0x18a82e=_0xd8af[_0x1b3672];return _0x18a82e;};'use strict';var Sequelize=require(_0xfd8a('0x0'));module[_0xfd8a('0x1')]={'version':{'type':Sequelize[_0xfd8a('0x2')],'unique':_0xfd8a('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8621f86..b4b2fe3 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 _0xe351=['name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','sort','where','pick','VIRTUAL','filter','includeAll','include','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','reject','save','then','end','stack'];(function(_0x1100e4,_0x3edf36){var _0x14024c=function(_0x11f629){while(--_0x11f629){_0x1100e4['push'](_0x1100e4['shift']());}};_0x14024c(++_0x3edf36);}(_0xe351,0x92));var _0x1e35=function(_0x30c76f,_0x172ce0){_0x30c76f=_0x30c76f-0x0;var _0x13d693=_0xe351[_0x30c76f];return _0x13d693;};'use strict';var emlformat=require(_0x1e35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e35('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e35('0x2'));var moment=require(_0x1e35('0x3'));var BPromise=require(_0x1e35('0x4'));var Mustache=require(_0x1e35('0x5'));var util=require(_0x1e35('0x6'));var path=require(_0x1e35('0x7'));var sox=require(_0x1e35('0x8'));var csv=require(_0x1e35('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e35('0xa'));var _=require(_0x1e35('0xb'));var squel=require(_0x1e35('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e35('0xd'));var deskjs=require(_0x1e35('0xe'));var toCsv=require(_0x1e35('0x9'));var querystring=require('querystring');var Papa=require(_0x1e35('0xf'));var Redis=require(_0x1e35('0x10'));var authService=require(_0x1e35('0x11'));var qs=require(_0x1e35('0x12'));var as=require(_0x1e35('0x13'));var hardwareService=require(_0x1e35('0x14'));var logger=require(_0x1e35('0x15'))('api');var utils=require(_0x1e35('0x16'));var config=require(_0x1e35('0x17'));var licenseUtil=require(_0x1e35('0x18'));var db=require(_0x1e35('0x19'))['db'];function respondWithStatusCode(_0x531cb0,_0x57b735){_0x57b735=_0x57b735||0xcc;return function(_0x41f7fc){if(_0x41f7fc){return _0x531cb0[_0x1e35('0x1a')](_0x57b735);}return _0x531cb0[_0x1e35('0x1b')](_0x57b735)['end']();};}function respondWithResult(_0x4034fd,_0x418113){_0x418113=_0x418113||0xc8;return function(_0x171dae){if(_0x171dae){return _0x4034fd[_0x1e35('0x1b')](_0x418113)[_0x1e35('0x1c')](_0x171dae);}};}function respondWithFilteredResult(_0x45d0df,_0x403662){return function(_0x47d1ac){if(_0x47d1ac){var _0x2229bb=typeof _0x403662[_0x1e35('0x1d')]==='undefined'&&typeof _0x403662[_0x1e35('0x1e')]==='undefined';var _0x477082=_0x47d1ac[_0x1e35('0x1f')];var _0x403686=_0x2229bb?0x0:_0x403662[_0x1e35('0x1d')];var _0x5190eb=_0x2229bb?_0x47d1ac[_0x1e35('0x1f')]:_0x403662[_0x1e35('0x1d')]+_0x403662[_0x1e35('0x1e')];var _0x309e9c;if(_0x5190eb>=_0x477082){_0x5190eb=_0x477082;_0x309e9c=0xc8;}else{_0x309e9c=0xce;}_0x45d0df[_0x1e35('0x1b')](_0x309e9c);return _0x45d0df['set']('Content-Range',_0x403686+'-'+_0x5190eb+'/'+_0x477082)[_0x1e35('0x1c')](_0x47d1ac);}return null;};}function patchUpdates(_0x6be620){return function(_0x684217){try{jsonpatch['apply'](_0x684217,_0x6be620,!![]);}catch(_0x46aad4){return BPromise[_0x1e35('0x20')](_0x46aad4);}return _0x684217[_0x1e35('0x21')]();};}function saveUpdates(_0x5e5ce6,_0x213963){return function(_0x15de3e){if(_0x15de3e){return _0x15de3e['update'](_0x5e5ce6)['then'](function(_0x172365){return _0x172365;});}return null;};}function removeEntity(_0x30e36f,_0x18a20e){return function(_0x151265){if(_0x151265){return _0x151265['destroy']()[_0x1e35('0x22')](function(){_0x30e36f[_0x1e35('0x1b')](0xcc)[_0x1e35('0x23')]();});}};}function handleEntityNotFound(_0x5ce896,_0x41a1fb){return function(_0x2d7974){if(!_0x2d7974){_0x5ce896['sendStatus'](0x194);}return _0x2d7974;};}function handleError(_0x22e1ca,_0x54f974){_0x54f974=_0x54f974||0x1f4;return function(_0x2a5ba8){logger['error'](_0x2a5ba8[_0x1e35('0x24')]);if(_0x2a5ba8[_0x1e35('0x25')]){delete _0x2a5ba8[_0x1e35('0x25')];}_0x22e1ca[_0x1e35('0x1b')](_0x54f974)[_0x1e35('0x26')](_0x2a5ba8);};}exports[_0x1e35('0x27')]=function(_0x528caf,_0x4da2b7){var _0xaf4c88={},_0x30b785={},_0x352967={'count':0x0,'rows':[]};var _0xafb578=_[_0x1e35('0x28')](db[_0x1e35('0x29')][_0x1e35('0x2a')],function(_0x1bfffe){return{'name':_0x1bfffe[_0x1e35('0x2b')],'type':_0x1bfffe[_0x1e35('0x2c')][_0x1e35('0x2d')]};});_0x30b785[_0x1e35('0x2e')]=_[_0x1e35('0x28')](_0xafb578,_0x1e35('0x25'));_0x30b785[_0x1e35('0x2f')]=_['keys'](_0x528caf[_0x1e35('0x2f')]);_0x30b785[_0x1e35('0x30')]=_['intersection'](_0x30b785['model'],_0x30b785[_0x1e35('0x2f')]);_0xaf4c88['attributes']=_[_0x1e35('0x31')](_0x30b785['model'],qs[_0x1e35('0x32')](_0x528caf['query'][_0x1e35('0x32')]));_0xaf4c88[_0x1e35('0x33')]=_0xaf4c88['attributes'][_0x1e35('0x34')]?_0xaf4c88['attributes']:_0x30b785[_0x1e35('0x2e')];if(!_0x528caf[_0x1e35('0x2f')]['hasOwnProperty']('nolimit')){_0xaf4c88[_0x1e35('0x1e')]=qs[_0x1e35('0x1e')](_0x528caf[_0x1e35('0x2f')]['limit']);_0xaf4c88[_0x1e35('0x1d')]=qs[_0x1e35('0x1d')](_0x528caf[_0x1e35('0x2f')][_0x1e35('0x1d')]);}_0xaf4c88['order']=qs['sort'](_0x528caf['query'][_0x1e35('0x35')]);_0xaf4c88[_0x1e35('0x36')]=qs['filters'](_[_0x1e35('0x37')](_0x528caf[_0x1e35('0x2f')],_0x30b785[_0x1e35('0x30')]),_0xafb578);if(_0x528caf[_0x1e35('0x2f')]['filter']){_0xaf4c88[_0x1e35('0x36')]=_['merge'](_0xaf4c88[_0x1e35('0x36')],{'$or':_['map'](_0xafb578,function(_0x1da7bd){if(_0x1da7bd['type']!==_0x1e35('0x38')){var _0x5772f6={};_0x5772f6[_0x1da7bd['name']]={'$like':'%'+_0x528caf['query'][_0x1e35('0x39')]+'%'};return _0x5772f6;}})});}_0xaf4c88=_['merge']({},_0xaf4c88,_0x528caf['options']);var _0x222cd1={'where':_0xaf4c88['where']};return db[_0x1e35('0x29')]['count'](_0x222cd1)['then'](function(_0x2b8aed){_0x352967[_0x1e35('0x1f')]=_0x2b8aed;if(_0x528caf[_0x1e35('0x2f')][_0x1e35('0x3a')]){_0xaf4c88[_0x1e35('0x3b')]=[{'all':!![]}];}return db[_0x1e35('0x29')]['findAll'](_0xaf4c88);})[_0x1e35('0x22')](function(_0x39ba8d){_0x352967['rows']=_0x39ba8d;return _0x352967;})[_0x1e35('0x22')](respondWithFilteredResult(_0x4da2b7,_0xaf4c88))[_0x1e35('0x3c')](handleError(_0x4da2b7,null));}; \ No newline at end of file +var _0xd9d5=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','Migration','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model'];(function(_0x264377,_0x31fd52){var _0x5c6d92=function(_0x33c0d7){while(--_0x33c0d7){_0x264377['push'](_0x264377['shift']());}};_0x5c6d92(++_0x31fd52);}(_0xd9d5,0xa5));var _0x5d9d=function(_0x5b4203,_0x178564){_0x5b4203=_0x5b4203-0x0;var _0x2278da=_0xd9d5[_0x5b4203];return _0x2278da;};'use strict';var emlformat=require(_0x5d9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d9d('0x1'));var jsonpatch=require(_0x5d9d('0x2'));var rp=require(_0x5d9d('0x3'));var moment=require(_0x5d9d('0x4'));var BPromise=require(_0x5d9d('0x5'));var Mustache=require(_0x5d9d('0x6'));var util=require(_0x5d9d('0x7'));var path=require(_0x5d9d('0x8'));var sox=require(_0x5d9d('0x9'));var csv=require(_0x5d9d('0xa'));var ejs=require(_0x5d9d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d9d('0xc'));var squel=require(_0x5d9d('0xd'));var crypto=require(_0x5d9d('0xe'));var jsforce=require(_0x5d9d('0xf'));var deskjs=require(_0x5d9d('0x10'));var toCsv=require(_0x5d9d('0xa'));var querystring=require('querystring');var Papa=require(_0x5d9d('0x11'));var Redis=require(_0x5d9d('0x12'));var authService=require(_0x5d9d('0x13'));var qs=require(_0x5d9d('0x14'));var as=require(_0x5d9d('0x15'));var hardwareService=require(_0x5d9d('0x16'));var logger=require('../../config/logger')(_0x5d9d('0x17'));var utils=require(_0x5d9d('0x18'));var config=require(_0x5d9d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d9d('0x1a'))['db'];function respondWithStatusCode(_0x380d0f,_0x5411f2){_0x5411f2=_0x5411f2||0xcc;return function(_0x9474d4){if(_0x9474d4){return _0x380d0f['sendStatus'](_0x5411f2);}return _0x380d0f[_0x5d9d('0x1b')](_0x5411f2)[_0x5d9d('0x1c')]();};}function respondWithResult(_0x2b99f8,_0x3df265){_0x3df265=_0x3df265||0xc8;return function(_0x4c210c){if(_0x4c210c){return _0x2b99f8[_0x5d9d('0x1b')](_0x3df265)[_0x5d9d('0x1d')](_0x4c210c);}};}function respondWithFilteredResult(_0x20ccc3,_0x560f97){return function(_0x56ad8c){if(_0x56ad8c){var _0x4c2a9c=typeof _0x560f97[_0x5d9d('0x1e')]===_0x5d9d('0x1f')&&typeof _0x560f97[_0x5d9d('0x20')]===_0x5d9d('0x1f');var _0x4ee2e9=_0x56ad8c[_0x5d9d('0x21')];var _0x4c03f3=_0x4c2a9c?0x0:_0x560f97[_0x5d9d('0x1e')];var _0x4bea7e=_0x4c2a9c?_0x56ad8c[_0x5d9d('0x21')]:_0x560f97[_0x5d9d('0x1e')]+_0x560f97[_0x5d9d('0x20')];var _0x55a30e;if(_0x4bea7e>=_0x4ee2e9){_0x4bea7e=_0x4ee2e9;_0x55a30e=0xc8;}else{_0x55a30e=0xce;}_0x20ccc3[_0x5d9d('0x1b')](_0x55a30e);return _0x20ccc3[_0x5d9d('0x22')](_0x5d9d('0x23'),_0x4c03f3+'-'+_0x4bea7e+'/'+_0x4ee2e9)[_0x5d9d('0x1d')](_0x56ad8c);}return null;};}function patchUpdates(_0x2bf98f){return function(_0x5fe499){try{jsonpatch['apply'](_0x5fe499,_0x2bf98f,!![]);}catch(_0x4c0c1f){return BPromise[_0x5d9d('0x24')](_0x4c0c1f);}return _0x5fe499[_0x5d9d('0x25')]();};}function saveUpdates(_0x41752c,_0x3ca893){return function(_0xa365b7){if(_0xa365b7){return _0xa365b7[_0x5d9d('0x26')](_0x41752c)['then'](function(_0x186f9b){return _0x186f9b;});}return null;};}function removeEntity(_0x3f673b,_0xc39622){return function(_0x42d99b){if(_0x42d99b){return _0x42d99b[_0x5d9d('0x27')]()[_0x5d9d('0x28')](function(){_0x3f673b[_0x5d9d('0x1b')](0xcc)[_0x5d9d('0x1c')]();});}};}function handleEntityNotFound(_0xff6c0d,_0x2b9e06){return function(_0x2ae9a3){if(!_0x2ae9a3){_0xff6c0d[_0x5d9d('0x29')](0x194);}return _0x2ae9a3;};}function handleError(_0x21edbf,_0x1c76f7){_0x1c76f7=_0x1c76f7||0x1f4;return function(_0x40022b){logger['error'](_0x40022b[_0x5d9d('0x2a')]);if(_0x40022b[_0x5d9d('0x2b')]){delete _0x40022b[_0x5d9d('0x2b')];}_0x21edbf[_0x5d9d('0x1b')](_0x1c76f7)[_0x5d9d('0x2c')](_0x40022b);};}exports[_0x5d9d('0x2d')]=function(_0x1da4b5,_0x37fe61){var _0x3da6a8={},_0x319f32={},_0x15cce3={'count':0x0,'rows':[]};var _0x3ee0ea=_[_0x5d9d('0x2e')](db['Migration'][_0x5d9d('0x2f')],function(_0x590f77){return{'name':_0x590f77['fieldName'],'type':_0x590f77[_0x5d9d('0x30')][_0x5d9d('0x31')]};});_0x319f32[_0x5d9d('0x32')]=_[_0x5d9d('0x2e')](_0x3ee0ea,'name');_0x319f32['query']=_[_0x5d9d('0x33')](_0x1da4b5[_0x5d9d('0x34')]);_0x319f32[_0x5d9d('0x35')]=_['intersection'](_0x319f32['model'],_0x319f32['query']);_0x3da6a8['attributes']=_[_0x5d9d('0x36')](_0x319f32[_0x5d9d('0x32')],qs[_0x5d9d('0x37')](_0x1da4b5['query'][_0x5d9d('0x37')]));_0x3da6a8[_0x5d9d('0x38')]=_0x3da6a8[_0x5d9d('0x38')][_0x5d9d('0x39')]?_0x3da6a8[_0x5d9d('0x38')]:_0x319f32[_0x5d9d('0x32')];if(!_0x1da4b5[_0x5d9d('0x34')][_0x5d9d('0x3a')](_0x5d9d('0x3b'))){_0x3da6a8[_0x5d9d('0x20')]=qs[_0x5d9d('0x20')](_0x1da4b5[_0x5d9d('0x34')][_0x5d9d('0x20')]);_0x3da6a8['offset']=qs[_0x5d9d('0x1e')](_0x1da4b5[_0x5d9d('0x34')][_0x5d9d('0x1e')]);}_0x3da6a8['order']=qs[_0x5d9d('0x3c')](_0x1da4b5['query'][_0x5d9d('0x3c')]);_0x3da6a8[_0x5d9d('0x3d')]=qs['filters'](_['pick'](_0x1da4b5[_0x5d9d('0x34')],_0x319f32['filters']),_0x3ee0ea);if(_0x1da4b5['query'][_0x5d9d('0x3e')]){_0x3da6a8['where']=_['merge'](_0x3da6a8[_0x5d9d('0x3d')],{'$or':_['map'](_0x3ee0ea,function(_0x36f58e){if(_0x36f58e[_0x5d9d('0x30')]!==_0x5d9d('0x3f')){var _0x568edb={};_0x568edb[_0x36f58e['name']]={'$like':'%'+_0x1da4b5[_0x5d9d('0x34')][_0x5d9d('0x3e')]+'%'};return _0x568edb;}})});}_0x3da6a8=_[_0x5d9d('0x40')]({},_0x3da6a8,_0x1da4b5[_0x5d9d('0x41')]);var _0x1b9283={'where':_0x3da6a8['where']};return db[_0x5d9d('0x42')][_0x5d9d('0x21')](_0x1b9283)['then'](function(_0x1fd4b7){_0x15cce3[_0x5d9d('0x21')]=_0x1fd4b7;if(_0x1da4b5[_0x5d9d('0x34')][_0x5d9d('0x43')]){_0x3da6a8[_0x5d9d('0x44')]=[{'all':!![]}];}return db[_0x5d9d('0x42')][_0x5d9d('0x45')](_0x3da6a8);})[_0x5d9d('0x28')](function(_0x2a0e78){_0x15cce3[_0x5d9d('0x46')]=_0x2a0e78;return _0x15cce3;})[_0x5d9d('0x28')](respondWithFilteredResult(_0x37fe61,_0x3da6a8))[_0x5d9d('0x47')](handleError(_0x37fe61,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b537c73..ea0c6d1 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 _0xd1f3=['api','bluebird','request-promise','rimraf','./migration.attributes','Migration','util','../../config/logger'];(function(_0x19e5b1,_0x45c7d5){var _0x3597dc=function(_0x4e9add){while(--_0x4e9add){_0x19e5b1['push'](_0x19e5b1['shift']());}};_0x3597dc(++_0x45c7d5);}(_0xd1f3,0x156));var _0x3d1f=function(_0x2f603c,_0x2564c4){_0x2f603c=_0x2f603c-0x0;var _0x2da2ed=_0xd1f3[_0x2f603c];return _0x2da2ed;};'use strict';var _=require('lodash');var util=require(_0x3d1f('0x0'));var logger=require(_0x3d1f('0x1'))(_0x3d1f('0x2'));var moment=require('moment');var BPromise=require(_0x3d1f('0x3'));var rp=require(_0x3d1f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d1f('0x5'));var config=require('../../config/environment');var attributes=require(_0x3d1f('0x6'));module['exports']=function(_0xfa7bf9,_0x2c1b73){return _0xfa7bf9['define'](_0x3d1f('0x7'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x809f=['migrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','define','Migration'];(function(_0x4970e9,_0x1a1058){var _0x5daa91=function(_0x494afd){while(--_0x494afd){_0x4970e9['push'](_0x4970e9['shift']());}};_0x5daa91(++_0x1a1058);}(_0x809f,0x83));var _0xf809=function(_0x451369,_0x5492d4){_0x451369=_0x451369-0x0;var _0x513c1d=_0x809f[_0x451369];return _0x513c1d;};'use strict';var _=require(_0xf809('0x0'));var util=require(_0xf809('0x1'));var logger=require(_0xf809('0x2'))(_0xf809('0x3'));var moment=require(_0xf809('0x4'));var BPromise=require(_0xf809('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf809('0x6'));var rimraf=require(_0xf809('0x7'));var config=require(_0xf809('0x8'));var attributes=require(_0xf809('0x9'));module['exports']=function(_0x2035aa,_0x151b17){return _0x2035aa[_0xf809('0xa')](_0xf809('0xb'),attributes,{'tableName':_0xf809('0xc'),'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 b3db7d2..ff11458 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 _0xbf5c=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s'];(function(_0x172ba9,_0x2b4278){var _0x510713=function(_0x7c0a4b){while(--_0x7c0a4b){_0x172ba9['push'](_0x172ba9['shift']());}};_0x510713(++_0x2b4278);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x5c7975,_0xa80f8f){_0x5c7975=_0x5c7975-0x0;var _0x5c1b26=_0xbf5c[_0x5c7975];return _0x5c1b26;};'use strict';var _=require(_0xcbf5('0x0'));var util=require(_0xcbf5('0x1'));var moment=require(_0xcbf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbf5('0x3'));var fs=require('fs');var Redis=require(_0xcbf5('0x4'));var db=require(_0xcbf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbf5('0x6'))(_0xcbf5('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbf5('0x8'));var client=jayson[_0xcbf5('0x9')][_0xcbf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522014,_0x4504dd,_0x31b6d1){return new BPromise(function(_0x54d2d4,_0x52f784){return client[_0xcbf5('0xb')](_0x522014,_0x31b6d1)[_0xcbf5('0xc')](function(_0x230a6c){logger['info'](_0xcbf5('0xd'),_0x4504dd,_0xcbf5('0xe'));logger[_0xcbf5('0xf')](_0xcbf5('0x10'),_0x4504dd,_0xcbf5('0xe'),JSON[_0xcbf5('0x11')](_0x230a6c));if(_0x230a6c['error']){if(_0x230a6c[_0xcbf5('0x12')][_0xcbf5('0x13')]===0x1f4){logger[_0xcbf5('0x12')]('Migration,\x20%s,\x20%s',_0x4504dd,_0x230a6c['error'][_0xcbf5('0x14')]);return _0x52f784(_0x230a6c['error'][_0xcbf5('0x14')]);}logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x230a6c[_0xcbf5('0x12')]['message']);return _0x54d2d4(_0x230a6c['error'][_0xcbf5('0x14')]);}else{logger['info'](_0xcbf5('0xd'),_0x4504dd,'request\x20sent');_0x54d2d4(_0x230a6c['result'][_0xcbf5('0x14')]);}})[_0xcbf5('0x15')](function(_0x18753e){logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x18753e);_0x52f784(_0x18753e);});});} \ No newline at end of file +var _0xba47=['Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xba47,0x1ac));var _0x7ba4=function(_0x21ef09,_0x138521){_0x21ef09=_0x21ef09-0x0;var _0x4d9a72=_0xba47[_0x21ef09];return _0x4d9a72;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var moment=require(_0x7ba4('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ba4('0x3'));var fs=require('fs');var Redis=require(_0x7ba4('0x4'));var db=require(_0x7ba4('0x5'))['db'];var utils=require(_0x7ba4('0x6'));var logger=require('../../config/logger')(_0x7ba4('0x7'));var config=require(_0x7ba4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7ba4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ea18,_0x932508,_0x227abe){return new BPromise(function(_0x7963fa,_0x380790){return client[_0x7ba4('0xa')](_0x11ea18,_0x227abe)[_0x7ba4('0xb')](function(_0x48456d){logger['info'](_0x7ba4('0xc'),_0x932508,'request\x20sent');logger[_0x7ba4('0xd')](_0x7ba4('0xe'),_0x932508,_0x7ba4('0xf'),JSON[_0x7ba4('0x10')](_0x48456d));if(_0x48456d['error']){if(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x12')]===0x1f4){logger['error'](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x380790(_0x48456d['error'][_0x7ba4('0x13')]);}logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x7963fa(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);}else{logger[_0x7ba4('0x14')](_0x7ba4('0xc'),_0x932508,'request\x20sent');_0x7963fa(_0x48456d['result'][_0x7ba4('0x13')]);}})[_0x7ba4('0x15')](function(_0x53c7b2){logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x53c7b2);_0x380790(_0x53c7b2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 1e92b2e..b84da75 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 _0x87b4=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0x87b4,0xaa));var _0x487b=function(_0x2063e6,_0x28df57){_0x2063e6=_0x2063e6-0x0;var _0x63f89d=_0x87b4[_0x2063e6];return _0x63f89d;};'use strict';var multer=require(_0x487b('0x0'));var util=require(_0x487b('0x1'));var path=require(_0x487b('0x2'));var timeout=require('connect-timeout');var express=require(_0x487b('0x3'));var router=express['Router']();var fs_extra=require(_0x487b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x487b('0x5'));var config=require('../../config/environment');var controller=require(_0x487b('0x6'));router[_0x487b('0x7')]('/',auth[_0x487b('0x8')](),controller[_0x487b('0x9')]);router[_0x487b('0x7')](_0x487b('0xa'),auth[_0x487b('0x8')](),controller[_0x487b('0xb')]);router[_0x487b('0xc')]('/',auth[_0x487b('0x8')](),controller[_0x487b('0xd')]);router[_0x487b('0xe')]('/:id',auth[_0x487b('0x8')](),controller[_0x487b('0xf')]);router[_0x487b('0x10')](_0x487b('0xa'),auth[_0x487b('0x8')](),controller[_0x487b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfa94=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','put','delete','destroy','multer'];(function(_0x59f847,_0x2ae81d){var _0x1935ff=function(_0x36f550){while(--_0x36f550){_0x59f847['push'](_0x59f847['shift']());}};_0x1935ff(++_0x2ae81d);}(_0xfa94,0xef));var _0x4fa9=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xfa94[_0x9edfd5];return _0x330738;};'use strict';var multer=require(_0x4fa9('0x0'));var util=require('util');var path=require(_0x4fa9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4fa9('0x2'));var router=express[_0x4fa9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4fa9('0x4'));var interaction=require(_0x4fa9('0x5'));var config=require(_0x4fa9('0x6'));var controller=require(_0x4fa9('0x7'));router[_0x4fa9('0x8')]('/',auth[_0x4fa9('0x9')](),controller[_0x4fa9('0xa')]);router['get'](_0x4fa9('0xb'),auth[_0x4fa9('0x9')](),controller['show']);router['post']('/',auth[_0x4fa9('0x9')](),controller['create']);router[_0x4fa9('0xc')](_0x4fa9('0xb'),auth[_0x4fa9('0x9')](),controller['update']);router[_0x4fa9('0xd')]('/:id',auth[_0x4fa9('0x9')](),controller[_0x4fa9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ae798e2..cecf8e9 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 _0xd75a=['exports','ENUM','localnet','stun','turn','STRING'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xd75a,0x162));var _0xad75=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd75a[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xad75('0x0')]={'type':{'type':Sequelize[_0xad75('0x1')](_0xad75('0x2'),'externip',_0xad75('0x3'),_0xad75('0x4'))},'value':{'type':Sequelize[_0xad75('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xad75('0x5')]}}; \ No newline at end of file +var _0x6a1c=['sequelize','exports','ENUM','stun','turn','STRING'];(function(_0x25d4b1,_0x4e896d){var _0x2d51a5=function(_0x9c766){while(--_0x9c766){_0x25d4b1['push'](_0x25d4b1['shift']());}};_0x2d51a5(++_0x4e896d);}(_0x6a1c,0x138));var _0xc6a1=function(_0x4c0d98,_0x358cc5){_0x4c0d98=_0x4c0d98-0x0;var _0x5f26d4=_0x6a1c[_0x4c0d98];return _0x5f26d4;};'use strict';var Sequelize=require(_0xc6a1('0x0'));module[_0xc6a1('0x1')]={'type':{'type':Sequelize[_0xc6a1('0x2')]('localnet','externip',_0xc6a1('0x3'),_0xc6a1('0x4'))},'value':{'type':Sequelize[_0xc6a1('0x5')]},'username':{'type':Sequelize[_0xc6a1('0x5')]},'password':{'type':Sequelize[_0xc6a1('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f5df5dd..a46de34 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 _0x469a=['limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','params','length','find','create','body','STUN','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','http','request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','undefined'];(function(_0x497d7c,_0x376f95){var _0x9a970e=function(_0x386d64){while(--_0x386d64){_0x497d7c['push'](_0x497d7c['shift']());}};_0x9a970e(++_0x376f95);}(_0x469a,0xed));var _0xa469=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x469a[_0x602ca8];return _0x26e8ab;};'use strict';var util=require(_0xa469('0x0'));var path=require('path');var ejs=require(_0xa469('0x1'));var fs=require('fs');var _=require(_0xa469('0x2'));var qs=require(_0xa469('0x3'));var logger=require(_0xa469('0x4'))(_0xa469('0x5'));var config=require(_0xa469('0x6'));var db=require(_0xa469('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa469('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5857d4,_0x349048,_0x2e668f,_0xb6abf9){return new Promise(function(_0x383b63,_0x43b72a){var _0x454698=_0xb6abf9||client;return _0x454698[_0xa469('0x9')](_0x5857d4,_0x2e668f)[_0xa469('0xa')](function(_0x1f7463){logger['info']('Network,\x20%s,\x20%s',_0x349048,_0xa469('0xb'));logger[_0xa469('0xc')](_0xa469('0xd'),_0x349048,'request\x20sent',JSON['stringify'](_0x1f7463));if(_0x1f7463[_0xa469('0xe')]){if(_0x1f7463[_0xa469('0xe')][_0xa469('0xf')]===0x1f4){logger[_0xa469('0xe')]('Network,\x20%s,\x20%s',_0x349048,_0x1f7463[_0xa469('0xe')][_0xa469('0x10')]);return _0x43b72a(_0x1f7463['error'][_0xa469('0x10')]);}logger[_0xa469('0xe')]('Network,\x20%s,\x20%s',_0x349048,_0x1f7463[_0xa469('0xe')][_0xa469('0x10')]);return _0x383b63(_0x1f7463[_0xa469('0xe')][_0xa469('0x10')]);}else{logger[_0xa469('0x11')]('Network,\x20%s,\x20%s',_0x349048,_0xa469('0xb'));_0x383b63(_0x1f7463[_0xa469('0x12')][_0xa469('0x10')]);}})[_0xa469('0x13')](function(_0x1b3d7d){logger[_0xa469('0xe')]('Network,\x20%s,\x20%s',_0x349048,_0x1b3d7d);_0x43b72a(_0x1b3d7d);});});}function respondWithResult(_0x610f61,_0x2ab927){_0x2ab927=_0x2ab927||0xc8;return function(_0x58cac5){if(_0x58cac5){return _0x610f61[_0xa469('0x14')](_0x2ab927)[_0xa469('0x15')](_0x58cac5);}};}function respondWithFilteredResult(_0x57fc7f,_0x5c5fe9){return function(_0x269802){if(_0x269802){var _0x4899cb=typeof _0x5c5fe9[_0xa469('0x16')]===_0xa469('0x17')&&typeof _0x5c5fe9[_0xa469('0x18')]==='undefined';var _0x348a44=_0x269802[_0xa469('0x19')];var _0x1c390e=_0x4899cb?0x0:_0x5c5fe9[_0xa469('0x16')];var _0x4b01d4=_0x4899cb?_0x269802[_0xa469('0x19')]:_0x5c5fe9['offset']+_0x5c5fe9[_0xa469('0x18')];var _0xe2b810;if(_0x4b01d4>=_0x348a44){_0x4b01d4=_0x348a44;_0xe2b810=0xc8;}else{_0xe2b810=0xce;}_0x57fc7f['status'](_0xe2b810);return _0x57fc7f[_0xa469('0x1a')](_0xa469('0x1b'),_0x1c390e+'-'+_0x4b01d4+'/'+_0x348a44)[_0xa469('0x15')](_0x269802);}return null;};}function saveUpdates(_0xed4ae6){return function(_0x37864f){if(_0x37864f){return _0x37864f[_0xa469('0x1c')](_0xed4ae6)[_0xa469('0xa')](function(_0x31e68c){return _0x31e68c;});}return null;};}function removeEntity(_0x583899){return function(_0x33cf2b){if(_0x33cf2b){return _0x33cf2b[_0xa469('0x1d')]()[_0xa469('0xa')](function(){_0x583899[_0xa469('0x14')](0xcc)[_0xa469('0x1e')]();});}};}function handleEntityNotFound(_0x107362){return function(_0x316ce0){if(!_0x316ce0){_0x107362[_0xa469('0x1f')](0x194);}return _0x316ce0;};}function handleError(_0x23c597,_0x5ad4ff){_0x5ad4ff=_0x5ad4ff||0x1f4;return function(_0x1bbfa1){logger['error'](_0x1bbfa1[_0xa469('0x20')]);if(_0x1bbfa1[_0xa469('0x21')]){delete _0x1bbfa1[_0xa469('0x21')];}_0x23c597[_0xa469('0x14')](_0x5ad4ff)[_0xa469('0x22')](_0x1bbfa1);};}exports['index']=function(_0x207f63,_0x2447de){var _0x1cb419={},_0xa65b05={},_0x2631be={'count':0x0,'rows':[]};var _0x1702b3=_[_0xa469('0x23')](db['Network'][_0xa469('0x24')],function(_0x2d289d){return{'name':_0x2d289d[_0xa469('0x25')],'type':_0x2d289d[_0xa469('0x26')][_0xa469('0x27')]};});_0xa65b05[_0xa469('0x28')]=_[_0xa469('0x23')](_0x1702b3,_0xa469('0x21'));_0xa65b05[_0xa469('0x29')]=_[_0xa469('0x2a')](_0x207f63['query']);_0xa65b05[_0xa469('0x2b')]=_[_0xa469('0x2c')](_0xa65b05[_0xa469('0x28')],_0xa65b05[_0xa469('0x29')]);_0x1cb419[_0xa469('0x2d')]=_[_0xa469('0x2c')](_0xa65b05[_0xa469('0x28')],qs[_0xa469('0x2e')](_0x207f63[_0xa469('0x29')][_0xa469('0x2e')]));_0x1cb419['attributes']=_0x1cb419[_0xa469('0x2d')]['length']?_0x1cb419[_0xa469('0x2d')]:_0xa65b05[_0xa469('0x28')];if(!_0x207f63['query'][_0xa469('0x2f')](_0xa469('0x30'))){_0x1cb419['limit']=qs['limit'](_0x207f63[_0xa469('0x29')]['limit']);_0x1cb419[_0xa469('0x16')]=qs[_0xa469('0x16')](_0x207f63[_0xa469('0x29')]['offset']);}_0x1cb419[_0xa469('0x31')]=qs['sort'](_0x207f63[_0xa469('0x29')]['sort']);_0x1cb419[_0xa469('0x32')]=qs['filters'](_[_0xa469('0x33')](_0x207f63[_0xa469('0x29')],_0xa65b05[_0xa469('0x2b')]),_0x1702b3);if(_0x207f63[_0xa469('0x29')][_0xa469('0x34')]){_0x1cb419[_0xa469('0x32')]=_[_0xa469('0x35')](_0x1cb419[_0xa469('0x32')],{'$or':_[_0xa469('0x23')](_0x1702b3,function(_0xa05fdc){if(_0xa05fdc[_0xa469('0x26')]!==_0xa469('0x36')){var _0x42a0d4={};_0x42a0d4[_0xa05fdc[_0xa469('0x21')]]={'$like':'%'+_0x207f63['query']['filter']+'%'};return _0x42a0d4;}})});}_0x1cb419=_[_0xa469('0x35')]({},_0x1cb419,_0x207f63[_0xa469('0x37')]);var _0x247276={'where':_0x1cb419[_0xa469('0x32')]};return db[_0xa469('0x38')][_0xa469('0x19')](_0x247276)[_0xa469('0xa')](function(_0x508caa){_0x2631be[_0xa469('0x19')]=_0x508caa;if(_0x207f63['query'][_0xa469('0x39')]){_0x1cb419[_0xa469('0x3a')]=[{'all':!![]}];}return db['Network'][_0xa469('0x3b')](_0x1cb419);})[_0xa469('0xa')](function(_0x33ba47){_0x2631be[_0xa469('0x3c')]=_0x33ba47;return _0x2631be;})[_0xa469('0xa')](respondWithFilteredResult(_0x2447de,_0x1cb419))[_0xa469('0x13')](handleError(_0x2447de,null));};exports[_0xa469('0x3d')]=function(_0x10ba65,_0x11b164){var _0x444009={'raw':!![],'where':{'id':_0x10ba65[_0xa469('0x3e')]['id']}},_0xc91d0a={};_0xc91d0a['model']=_[_0xa469('0x2a')](db[_0xa469('0x38')][_0xa469('0x24')]);_0xc91d0a['query']=_[_0xa469('0x2a')](_0x10ba65[_0xa469('0x29')]);_0xc91d0a[_0xa469('0x2b')]=_[_0xa469('0x2c')](_0xc91d0a['model'],_0xc91d0a[_0xa469('0x29')]);_0x444009[_0xa469('0x2d')]=_['intersection'](_0xc91d0a[_0xa469('0x28')],qs[_0xa469('0x2e')](_0x10ba65[_0xa469('0x29')][_0xa469('0x2e')]));_0x444009[_0xa469('0x2d')]=_0x444009['attributes'][_0xa469('0x3f')]?_0x444009[_0xa469('0x2d')]:_0xc91d0a[_0xa469('0x28')];if(_0x10ba65[_0xa469('0x29')][_0xa469('0x39')]){_0x444009[_0xa469('0x3a')]=[{'all':!![]}];}_0x444009=_['merge']({},_0x444009,_0x10ba65['options']);return db['Network'][_0xa469('0x40')](_0x444009)[_0xa469('0xa')](handleEntityNotFound(_0x11b164,null))['then'](respondWithResult(_0x11b164,null))[_0xa469('0x13')](handleError(_0x11b164,null));};exports[_0xa469('0x41')]=function(_0x30b54e,_0x4847ec){var _0x116d8d;return db[_0xa469('0x38')][_0xa469('0x41')](_0x30b54e[_0xa469('0x42')],{'raw':!![]})[_0xa469('0xa')](function(_0x3103cb){_0x116d8d=_0x3103cb;return db['Network'][_0xa469('0x3b')]({'where':{'type':_0x30b54e[_0xa469('0x42')][_0xa469('0x26')]},'raw':!![]});})['then'](function(_0x1d4df5){if(_0x116d8d[_0xa469('0x26')]['toUpperCase']()==_0xa469('0x43')){var _0x32993f=fs['readFileSync'](path[_0xa469('0x44')](config['root'],_0xa469('0x45')),_0xa469('0x46'));var _0x3aae7d=ejs['render'](_0x32993f,{'networks':_0x1d4df5||[]});fs[_0xa469('0x47')](_0xa469('0x48'),_0x3aae7d);return respondWithRpcPromise('Reload','create',{'module':_0xa469('0x49')});}else if(_0x116d8d[_0xa469('0x26')][_0xa469('0x4a')]()==_0xa469('0x4b')){var _0x17a300=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x4e')),_0xa469('0x46'));var _0x249364=ejs['render'](_0x17a300,{'networks':_0x1d4df5||[]});fs[_0xa469('0x47')](_0xa469('0x4f'),_0x249364);return respondWithRpcPromise(_0xa469('0x50'),'create',{'module':_0xa469('0x49')});}else{var _0x5cf020=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config['root'],_0xa469('0x51')),_0xa469('0x46'));var _0x3405de=ejs[_0xa469('0x52')](_0x5cf020,{'networks':_0x1d4df5||[]});fs[_0xa469('0x47')](util[_0xa469('0x53')](_0xa469('0x54'),_0x30b54e['body']['type'][_0xa469('0x55')]()),_0x3405de);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x41'),{'module':_0xa469('0x56')});}})[_0xa469('0xa')](function(){return _0x116d8d;})[_0xa469('0xa')](respondWithResult(_0x4847ec,0xc9))[_0xa469('0x13')](handleError(_0x4847ec,null));};exports[_0xa469('0x1c')]=function(_0x4818fa,_0x2d562d){var _0xcb39e3;return db[_0xa469('0x38')]['find']({'where':{'id':_0x4818fa['params']['id']}})[_0xa469('0xa')](handleEntityNotFound(_0x2d562d,null))[_0xa469('0xa')](saveUpdates(_0x4818fa[_0xa469('0x42')],null))['then'](function(_0x5e9872){if(_0x5e9872){_0xcb39e3=_0x5e9872;return db['Network'][_0xa469('0x3b')]({'where':{'type':_0xcb39e3[_0xa469('0x26')]},'raw':!![]});}return null;})[_0xa469('0xa')](function(_0xde4f0c){if(_0xcb39e3[_0xa469('0x26')]['toUpperCase']()=='STUN'){var _0x512112=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x45')),_0xa469('0x46'));var _0xa90c85=ejs[_0xa469('0x52')](_0x512112,{'networks':_0xde4f0c||[]});fs[_0xa469('0x47')](_0xa469('0x48'),_0xa90c85);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1c'),{'module':_0xa469('0x49')});}else if(_0xcb39e3[_0xa469('0x26')][_0xa469('0x4a')]()==_0xa469('0x4b')){var _0x55184d=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x4e')),_0xa469('0x46'));var _0x3bb5a6=ejs[_0xa469('0x52')](_0x55184d,{'networks':_0xde4f0c||[]});fs['writeFileSync'](_0xa469('0x4f'),_0x3bb5a6);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1c'),{'module':_0xa469('0x49')});}else{var _0x1fbbac=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x51')),'utf8');var _0x141eec=ejs[_0xa469('0x52')](_0x1fbbac,{'networks':_0xde4f0c||[]});fs[_0xa469('0x47')](util[_0xa469('0x53')](_0xa469('0x54'),_0x4818fa[_0xa469('0x42')][_0xa469('0x26')][_0xa469('0x55')]()),_0x141eec);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1c'),{'module':_0xa469('0x56')});}})[_0xa469('0xa')](function(_0x540743){if(_0x540743){return _0xcb39e3;}return null;})[_0xa469('0xa')](respondWithResult(_0x2d562d,null))[_0xa469('0x13')](handleError(_0x2d562d,null));};exports[_0xa469('0x1d')]=function(_0x4c0496,_0x286698){var _0x4db4b9;return db['Network']['find']({'where':{'id':_0x4c0496[_0xa469('0x3e')]['id']}})[_0xa469('0xa')](function(_0x57085e){_0x4db4b9=_0x57085e;return _0x57085e;})[_0xa469('0xa')](handleEntityNotFound(_0x286698,null))['then'](removeEntity(_0x286698,null))[_0xa469('0xa')](function(){if(_0x4db4b9){return db['Network'][_0xa469('0x3b')]({'where':{'type':_0x4db4b9['type']},'raw':!![]});}})[_0xa469('0xa')](function(_0x31582f){if(_0x4db4b9[_0xa469('0x26')][_0xa469('0x4a')]()==_0xa469('0x43')){var _0x4c718a=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],'server/files/templates/stun_multiple.ejs'),_0xa469('0x46'));var _0x51aab7=ejs[_0xa469('0x52')](_0x4c718a,{'networks':_0x31582f||[]});fs['writeFileSync'](_0xa469('0x48'),_0x51aab7);return respondWithRpcPromise(_0xa469('0x50'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x4db4b9['type'][_0xa469('0x4a')]()=='TURN'){var _0x5d0863=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config['root'],_0xa469('0x4e')),'utf8');var _0x50aed9=ejs[_0xa469('0x52')](_0x5d0863,{'networks':_0x31582f||[]});fs[_0xa469('0x47')]('/etc/asterisk/turn_xcally.conf',_0x50aed9);return respondWithRpcPromise(_0xa469('0x50'),'destroy',{'module':_0xa469('0x49')});}else{var _0xf436a5=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config['root'],'server/files/templates/network.ejs'),_0xa469('0x46'));var _0xd0ac84=ejs[_0xa469('0x52')](_0xf436a5,{'networks':_0x31582f||[]});fs[_0xa469('0x47')](util[_0xa469('0x53')]('/etc/asterisk/sip_xcally_%s.conf',_0x4db4b9[_0xa469('0x26')]['toLowerCase']()),_0xd0ac84);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1d'),{'module':_0xa469('0x56')});}})[_0xa469('0x13')](handleError(_0x286698,null));}; \ No newline at end of file +var _0x8977=['STUN','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','readFileSync','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','findAll','TURN','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','api','../../mysqldb','client','http','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','Network','rows','params','fields','find','create','body','toUpperCase'];(function(_0x40abc4,_0x396658){var _0x188165=function(_0x366ae7){while(--_0x366ae7){_0x40abc4['push'](_0x40abc4['shift']());}};_0x188165(++_0x396658);}(_0x8977,0x160));var _0x7897=function(_0x15d746,_0x2e09cc){_0x15d746=_0x15d746-0x0;var _0x111325=_0x8977[_0x15d746];return _0x111325;};'use strict';var util=require(_0x7897('0x0'));var path=require(_0x7897('0x1'));var ejs=require(_0x7897('0x2'));var fs=require('fs');var _=require(_0x7897('0x3'));var qs=require(_0x7897('0x4'));var logger=require('../../config/logger')(_0x7897('0x5'));var config=require('../../config/environment');var db=require(_0x7897('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7897('0x7')][_0x7897('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27b3fd,_0x2db85e,_0x34829c,_0x58cf03){return new Promise(function(_0x57216c,_0x366e81){var _0x2252ad=_0x58cf03||client;return _0x2252ad['request'](_0x27b3fd,_0x34829c)['then'](function(_0x321e77){logger[_0x7897('0x9')](_0x7897('0xa'),_0x2db85e,_0x7897('0xb'));logger['debug'](_0x7897('0xc'),_0x2db85e,_0x7897('0xb'),JSON[_0x7897('0xd')](_0x321e77));if(_0x321e77[_0x7897('0xe')]){if(_0x321e77['error']['code']===0x1f4){logger[_0x7897('0xe')]('Network,\x20%s,\x20%s',_0x2db85e,_0x321e77['error']['message']);return _0x366e81(_0x321e77['error'][_0x7897('0xf')]);}logger['error'](_0x7897('0xa'),_0x2db85e,_0x321e77['error'][_0x7897('0xf')]);return _0x57216c(_0x321e77[_0x7897('0xe')][_0x7897('0xf')]);}else{logger[_0x7897('0x9')](_0x7897('0xa'),_0x2db85e,'request\x20sent');_0x57216c(_0x321e77['result'][_0x7897('0xf')]);}})[_0x7897('0x10')](function(_0x15fe47){logger[_0x7897('0xe')](_0x7897('0xa'),_0x2db85e,_0x15fe47);_0x366e81(_0x15fe47);});});}function respondWithResult(_0x1c217b,_0x5970f6){_0x5970f6=_0x5970f6||0xc8;return function(_0x4df593){if(_0x4df593){return _0x1c217b[_0x7897('0x11')](_0x5970f6)['json'](_0x4df593);}};}function respondWithFilteredResult(_0x2bd19f,_0x43cd00){return function(_0x3f9d16){if(_0x3f9d16){var _0x37ef06=typeof _0x43cd00[_0x7897('0x12')]===_0x7897('0x13')&&typeof _0x43cd00['limit']==='undefined';var _0x5e005c=_0x3f9d16['count'];var _0x36ee26=_0x37ef06?0x0:_0x43cd00['offset'];var _0x346245=_0x37ef06?_0x3f9d16[_0x7897('0x14')]:_0x43cd00[_0x7897('0x12')]+_0x43cd00[_0x7897('0x15')];var _0x4736fc;if(_0x346245>=_0x5e005c){_0x346245=_0x5e005c;_0x4736fc=0xc8;}else{_0x4736fc=0xce;}_0x2bd19f[_0x7897('0x11')](_0x4736fc);return _0x2bd19f[_0x7897('0x16')](_0x7897('0x17'),_0x36ee26+'-'+_0x346245+'/'+_0x5e005c)[_0x7897('0x18')](_0x3f9d16);}return null;};}function saveUpdates(_0x2077a3){return function(_0x352991){if(_0x352991){return _0x352991[_0x7897('0x19')](_0x2077a3)[_0x7897('0x1a')](function(_0x37796d){return _0x37796d;});}return null;};}function removeEntity(_0x42a0cc){return function(_0x39d21d){if(_0x39d21d){return _0x39d21d[_0x7897('0x1b')]()[_0x7897('0x1a')](function(){_0x42a0cc[_0x7897('0x11')](0xcc)[_0x7897('0x1c')]();});}};}function handleEntityNotFound(_0x1173d3){return function(_0x71eefc){if(!_0x71eefc){_0x1173d3[_0x7897('0x1d')](0x194);}return _0x71eefc;};}function handleError(_0x128be8,_0x5d548b){_0x5d548b=_0x5d548b||0x1f4;return function(_0x5ec3af){logger['error'](_0x5ec3af[_0x7897('0x1e')]);if(_0x5ec3af[_0x7897('0x1f')]){delete _0x5ec3af['name'];}_0x128be8['status'](_0x5d548b)['send'](_0x5ec3af);};}exports['index']=function(_0x1de2cb,_0x45f096){var _0xa9e1fa={},_0x200b16={},_0x4ee9ab={'count':0x0,'rows':[]};var _0x19a27f=_[_0x7897('0x20')](db['Network'][_0x7897('0x21')],function(_0x413add){return{'name':_0x413add[_0x7897('0x22')],'type':_0x413add[_0x7897('0x23')][_0x7897('0x24')]};});_0x200b16[_0x7897('0x25')]=_[_0x7897('0x20')](_0x19a27f,'name');_0x200b16['query']=_[_0x7897('0x26')](_0x1de2cb[_0x7897('0x27')]);_0x200b16['filters']=_['intersection'](_0x200b16['model'],_0x200b16[_0x7897('0x27')]);_0xa9e1fa[_0x7897('0x28')]=_[_0x7897('0x29')](_0x200b16[_0x7897('0x25')],qs['fields'](_0x1de2cb[_0x7897('0x27')]['fields']));_0xa9e1fa[_0x7897('0x28')]=_0xa9e1fa[_0x7897('0x28')][_0x7897('0x2a')]?_0xa9e1fa[_0x7897('0x28')]:_0x200b16[_0x7897('0x25')];if(!_0x1de2cb[_0x7897('0x27')]['hasOwnProperty'](_0x7897('0x2b'))){_0xa9e1fa[_0x7897('0x15')]=qs[_0x7897('0x15')](_0x1de2cb[_0x7897('0x27')][_0x7897('0x15')]);_0xa9e1fa['offset']=qs[_0x7897('0x12')](_0x1de2cb[_0x7897('0x27')]['offset']);}_0xa9e1fa[_0x7897('0x2c')]=qs[_0x7897('0x2d')](_0x1de2cb[_0x7897('0x27')][_0x7897('0x2d')]);_0xa9e1fa[_0x7897('0x2e')]=qs[_0x7897('0x2f')](_[_0x7897('0x30')](_0x1de2cb[_0x7897('0x27')],_0x200b16[_0x7897('0x2f')]),_0x19a27f);if(_0x1de2cb[_0x7897('0x27')][_0x7897('0x31')]){_0xa9e1fa[_0x7897('0x2e')]=_[_0x7897('0x32')](_0xa9e1fa[_0x7897('0x2e')],{'$or':_[_0x7897('0x20')](_0x19a27f,function(_0x923bee){if(_0x923bee['type']!==_0x7897('0x33')){var _0x7c51ca={};_0x7c51ca[_0x923bee['name']]={'$like':'%'+_0x1de2cb['query']['filter']+'%'};return _0x7c51ca;}})});}_0xa9e1fa=_[_0x7897('0x32')]({},_0xa9e1fa,_0x1de2cb[_0x7897('0x34')]);var _0x44bcaa={'where':_0xa9e1fa['where']};return db['Network'][_0x7897('0x14')](_0x44bcaa)[_0x7897('0x1a')](function(_0x17fc84){_0x4ee9ab[_0x7897('0x14')]=_0x17fc84;if(_0x1de2cb[_0x7897('0x27')][_0x7897('0x35')]){_0xa9e1fa[_0x7897('0x36')]=[{'all':!![]}];}return db[_0x7897('0x37')]['findAll'](_0xa9e1fa);})[_0x7897('0x1a')](function(_0x101a94){_0x4ee9ab[_0x7897('0x38')]=_0x101a94;return _0x4ee9ab;})[_0x7897('0x1a')](respondWithFilteredResult(_0x45f096,_0xa9e1fa))[_0x7897('0x10')](handleError(_0x45f096,null));};exports['show']=function(_0x16fc14,_0x10b4ce){var _0x5be212={'raw':!![],'where':{'id':_0x16fc14[_0x7897('0x39')]['id']}},_0x4f35e7={};_0x4f35e7[_0x7897('0x25')]=_['keys'](db['Network'][_0x7897('0x21')]);_0x4f35e7[_0x7897('0x27')]=_[_0x7897('0x26')](_0x16fc14[_0x7897('0x27')]);_0x4f35e7[_0x7897('0x2f')]=_[_0x7897('0x29')](_0x4f35e7[_0x7897('0x25')],_0x4f35e7['query']);_0x5be212[_0x7897('0x28')]=_[_0x7897('0x29')](_0x4f35e7[_0x7897('0x25')],qs[_0x7897('0x3a')](_0x16fc14['query'][_0x7897('0x3a')]));_0x5be212[_0x7897('0x28')]=_0x5be212['attributes']['length']?_0x5be212[_0x7897('0x28')]:_0x4f35e7[_0x7897('0x25')];if(_0x16fc14[_0x7897('0x27')]['includeAll']){_0x5be212['include']=[{'all':!![]}];}_0x5be212=_[_0x7897('0x32')]({},_0x5be212,_0x16fc14[_0x7897('0x34')]);return db[_0x7897('0x37')][_0x7897('0x3b')](_0x5be212)[_0x7897('0x1a')](handleEntityNotFound(_0x10b4ce,null))['then'](respondWithResult(_0x10b4ce,null))[_0x7897('0x10')](handleError(_0x10b4ce,null));};exports[_0x7897('0x3c')]=function(_0x5c8631,_0x3d75fe){var _0x522d9e;return db['Network'][_0x7897('0x3c')](_0x5c8631[_0x7897('0x3d')],{'raw':!![]})[_0x7897('0x1a')](function(_0x394e83){_0x522d9e=_0x394e83;return db['Network']['findAll']({'where':{'type':_0x5c8631['body'][_0x7897('0x23')]},'raw':!![]});})['then'](function(_0x56aca2){if(_0x522d9e['type'][_0x7897('0x3e')]()==_0x7897('0x3f')){var _0x17ef2b=fs['readFileSync'](path['join'](config[_0x7897('0x40')],_0x7897('0x41')),_0x7897('0x42'));var _0x423e89=ejs['render'](_0x17ef2b,{'networks':_0x56aca2||[]});fs['writeFileSync'](_0x7897('0x43'),_0x423e89);return respondWithRpcPromise(_0x7897('0x44'),'create',{'module':_0x7897('0x45')});}else if(_0x522d9e[_0x7897('0x23')][_0x7897('0x3e')]()=='TURN'){var _0x83acdf=fs[_0x7897('0x46')](path[_0x7897('0x47')](config[_0x7897('0x40')],_0x7897('0x48')),_0x7897('0x42'));var _0x1fc622=ejs[_0x7897('0x49')](_0x83acdf,{'networks':_0x56aca2||[]});fs['writeFileSync'](_0x7897('0x4a'),_0x1fc622);return respondWithRpcPromise('Reload','create',{'module':_0x7897('0x45')});}else{var _0x3fb83c=fs['readFileSync'](path[_0x7897('0x47')](config[_0x7897('0x40')],_0x7897('0x4b')),_0x7897('0x42'));var _0x1fb026=ejs['render'](_0x3fb83c,{'networks':_0x56aca2||[]});fs[_0x7897('0x4c')](util[_0x7897('0x4d')](_0x7897('0x4e'),_0x5c8631[_0x7897('0x3d')][_0x7897('0x23')]['toLowerCase']()),_0x1fb026);return respondWithRpcPromise(_0x7897('0x44'),_0x7897('0x3c'),{'module':_0x7897('0x4f')});}})[_0x7897('0x1a')](function(){return _0x522d9e;})[_0x7897('0x1a')](respondWithResult(_0x3d75fe,0xc9))[_0x7897('0x10')](handleError(_0x3d75fe,null));};exports[_0x7897('0x19')]=function(_0x4f8225,_0x4ed034){var _0x4fe919;return db[_0x7897('0x37')]['find']({'where':{'id':_0x4f8225['params']['id']}})[_0x7897('0x1a')](handleEntityNotFound(_0x4ed034,null))[_0x7897('0x1a')](saveUpdates(_0x4f8225[_0x7897('0x3d')],null))[_0x7897('0x1a')](function(_0xa2e1a8){if(_0xa2e1a8){_0x4fe919=_0xa2e1a8;return db[_0x7897('0x37')][_0x7897('0x50')]({'where':{'type':_0x4fe919['type']},'raw':!![]});}return null;})[_0x7897('0x1a')](function(_0x3a1afb){if(_0x4fe919[_0x7897('0x23')][_0x7897('0x3e')]()=='STUN'){var _0x1a3b15=fs['readFileSync'](path[_0x7897('0x47')](config[_0x7897('0x40')],_0x7897('0x41')),'utf8');var _0x23ceb4=ejs[_0x7897('0x49')](_0x1a3b15,{'networks':_0x3a1afb||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x23ceb4);return respondWithRpcPromise(_0x7897('0x44'),'update',{'module':_0x7897('0x45')});}else if(_0x4fe919['type']['toUpperCase']()==_0x7897('0x51')){var _0x57bc99=fs[_0x7897('0x46')](path['join'](config['root'],_0x7897('0x48')),_0x7897('0x42'));var _0x2f61f5=ejs[_0x7897('0x49')](_0x57bc99,{'networks':_0x3a1afb||[]});fs[_0x7897('0x4c')](_0x7897('0x4a'),_0x2f61f5);return respondWithRpcPromise(_0x7897('0x44'),_0x7897('0x19'),{'module':_0x7897('0x45')});}else{var _0x2cf5ff=fs['readFileSync'](path[_0x7897('0x47')](config[_0x7897('0x40')],_0x7897('0x4b')),_0x7897('0x42'));var _0x34692d=ejs[_0x7897('0x49')](_0x2cf5ff,{'networks':_0x3a1afb||[]});fs[_0x7897('0x4c')](util['format'](_0x7897('0x4e'),_0x4f8225[_0x7897('0x3d')][_0x7897('0x23')]['toLowerCase']()),_0x34692d);return respondWithRpcPromise(_0x7897('0x44'),'update',{'module':_0x7897('0x4f')});}})['then'](function(_0x569ec8){if(_0x569ec8){return _0x4fe919;}return null;})[_0x7897('0x1a')](respondWithResult(_0x4ed034,null))[_0x7897('0x10')](handleError(_0x4ed034,null));};exports[_0x7897('0x1b')]=function(_0x1b679d,_0x5dbc91){var _0x438bba;return db[_0x7897('0x37')][_0x7897('0x3b')]({'where':{'id':_0x1b679d[_0x7897('0x39')]['id']}})[_0x7897('0x1a')](function(_0x48649b){_0x438bba=_0x48649b;return _0x48649b;})[_0x7897('0x1a')](handleEntityNotFound(_0x5dbc91,null))['then'](removeEntity(_0x5dbc91,null))[_0x7897('0x1a')](function(){if(_0x438bba){return db[_0x7897('0x37')]['findAll']({'where':{'type':_0x438bba['type']},'raw':!![]});}})[_0x7897('0x1a')](function(_0x2157f0){if(_0x438bba[_0x7897('0x23')][_0x7897('0x3e')]()==_0x7897('0x3f')){var _0xb8f6b7=fs[_0x7897('0x46')](path[_0x7897('0x47')](config[_0x7897('0x40')],'server/files/templates/stun_multiple.ejs'),_0x7897('0x42'));var _0x3768a0=ejs[_0x7897('0x49')](_0xb8f6b7,{'networks':_0x2157f0||[]});fs['writeFileSync'](_0x7897('0x43'),_0x3768a0);return respondWithRpcPromise(_0x7897('0x44'),_0x7897('0x1b'),{'module':_0x7897('0x45')});}else if(_0x438bba[_0x7897('0x23')][_0x7897('0x3e')]()=='TURN'){var _0x546394=fs['readFileSync'](path['join'](config[_0x7897('0x40')],_0x7897('0x48')),_0x7897('0x42'));var _0x233555=ejs[_0x7897('0x49')](_0x546394,{'networks':_0x2157f0||[]});fs[_0x7897('0x4c')](_0x7897('0x4a'),_0x233555);return respondWithRpcPromise('Reload',_0x7897('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0xd22679=fs[_0x7897('0x46')](path[_0x7897('0x47')](config['root'],'server/files/templates/network.ejs'),_0x7897('0x42'));var _0x3f2fe7=ejs[_0x7897('0x49')](_0xd22679,{'networks':_0x2157f0||[]});fs[_0x7897('0x4c')](util['format'](_0x7897('0x4e'),_0x438bba[_0x7897('0x23')][_0x7897('0x52')]()),_0x3f2fe7);return respondWithRpcPromise(_0x7897('0x44'),_0x7897('0x1b'),{'module':'chan_sip.so'});}})[_0x7897('0x10')](handleError(_0x5dbc91,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index beb5553..9998ce7 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 _0x04b8=['../../config/environment','./network.attributes','exports','define','Network','util','api','moment','request-promise','path'];(function(_0x9cbad4,_0x1c2062){var _0x48931d=function(_0x34e1d7){while(--_0x34e1d7){_0x9cbad4['push'](_0x9cbad4['shift']());}};_0x48931d(++_0x1c2062);}(_0x04b8,0x159));var _0x804b=function(_0x17a11f,_0x40bf5b){_0x17a11f=_0x17a11f-0x0;var _0xe29634=_0x04b8[_0x17a11f];return _0xe29634;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var logger=require('../../config/logger')(_0x804b('0x1'));var moment=require(_0x804b('0x2'));var BPromise=require('bluebird');var rp=require(_0x804b('0x3'));var fs=require('fs');var path=require(_0x804b('0x4'));var rimraf=require('rimraf');var config=require(_0x804b('0x5'));var attributes=require(_0x804b('0x6'));module[_0x804b('0x7')]=function(_0x5a8a5b,_0x2c22e3){return _0x5a8a5b[_0x804b('0x8')](_0x804b('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd52d=['../../config/environment','./network.attributes','exports','define','network','util','../../config/logger','moment','path','rimraf'];(function(_0xdcd428,_0x15d0e9){var _0x19719c=function(_0x30491d){while(--_0x30491d){_0xdcd428['push'](_0xdcd428['shift']());}};_0x19719c(++_0x15d0e9);}(_0xd52d,0x1c7));var _0xdd52=function(_0x5dc45f,_0x308851){_0x5dc45f=_0x5dc45f-0x0;var _0xea7904=_0xd52d[_0x5dc45f];return _0xea7904;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var logger=require(_0xdd52('0x1'))('api');var moment=require(_0xdd52('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd52('0x3'));var rimraf=require(_0xdd52('0x4'));var config=require(_0xdd52('0x5'));var attributes=require(_0xdd52('0x6'));module[_0xdd52('0x7')]=function(_0x3b56e5,_0x319c4a){return _0x3b56e5[_0xdd52('0x8')]('Network',attributes,{'tableName':_0xdd52('0x9'),'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 a1b7ef2..f97d43f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x315319,_0x28bbb4){_0x315319=_0x315319-0x0;var _0x3a4acd=_0x7a54[_0x315319];return _0x3a4acd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xa148f,_0x22bc09){var _0x5260b0=function(_0x44f9cc){while(--_0x44f9cc){_0xa148f['push'](_0xa148f['shift']());}};_0x5260b0(++_0x22bc09);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 d3ed8a9..600749d 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 _0x1a37=['/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','destroy','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show'];(function(_0x3fa42c,_0x286d07){var _0xc9dac3=function(_0x63fff9){while(--_0x63fff9){_0x3fa42c['push'](_0x3fa42c['shift']());}};_0xc9dac3(++_0x286d07);}(_0x1a37,0xb4));var _0x71a3=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x1a37[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./openchannelAccount.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0xa')](_0x71a3('0x13'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0xa')](_0x71a3('0x15'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x16')]);router[_0x71a3('0x17')]('/',auth['isAuthenticated'](),controller[_0x71a3('0x18')]);router[_0x71a3('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x71a3('0x19')]);router[_0x71a3('0x17')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1a')]);router[_0x71a3('0x17')]('/:id/notify',controller[_0x71a3('0x1b')]);router[_0x71a3('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x71a3('0x1c')]);router[_0x71a3('0x17')](_0x71a3('0x15'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1d')]);router['post'](_0x71a3('0x1e'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1f')]);router[_0x71a3('0x20')](_0x71a3('0x21'),auth['isAuthenticated'](),controller[_0x71a3('0x22')]);router['delete'](_0x71a3('0x21'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x23')]);router[_0x71a3('0x24')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller['removeDispositions']);router[_0x71a3('0x24')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x25')]);router[_0x71a3('0x24')]('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x26')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['describe','/:id','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addAnswer','notify','addApplications','send','put','destroy','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index'];(function(_0x4805bd,_0x25e86c){var _0x837094=function(_0x370815){while(--_0x370815){_0x4805bd['push'](_0x4805bd['shift']());}};_0x837094(++_0x25e86c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x0b0e[_0x30d87a];return _0x48f64b;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x9')]('/:id/applications',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x11')]);router[_0xe0b0('0x9')](_0xe0b0('0x12'),auth[_0xe0b0('0xa')](),controller['getInteractions']);router[_0xe0b0('0x9')](_0xe0b0('0x13'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x15')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x16')]);router['post'](_0xe0b0('0xe'),auth[_0xe0b0('0xa')](),controller['addDisposition']);router[_0xe0b0('0x15')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x17')]);router['post']('/:id/notify',controller[_0xe0b0('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe0b0('0x19')]);router['post']('/:id/users',auth[_0xe0b0('0xa')](),controller['addAgents']);router[_0xe0b0('0x15')]('/:id/send',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1a')]);router[_0xe0b0('0x1b')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['update']);router['delete'](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x1c')]);router[_0xe0b0('0x1d')]('/:id/dispositions',auth[_0xe0b0('0xa')](),controller['removeDispositions']);router[_0xe0b0('0x1d')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller['removeAnswers']);router[_0xe0b0('0x1d')]('/:id/users',auth[_0xe0b0('0xa')](),controller['removeAgents']);module[_0xe0b0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 1a723ab..3cc14ec 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 _0xb9ed=['setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x4b5df0,_0x51759e){var _0x2e6b2b=function(_0x3df779){while(--_0x3df779){_0x4b5df0['push'](_0x4b5df0['shift']());}};_0x2e6b2b(++_0x51759e);}(_0xb9ed,0x86));var _0xdb9e=function(_0x4127f0,_0x2c7d32){_0x4127f0=_0x4127f0-0x0;var _0x13ac52=_0xb9ed[_0x4127f0];return _0x13ac52;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xdb9e('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb9e('0x1')],'unique':_0xdb9e('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdb9e('0x3')]();}},'replyUri':{'type':Sequelize[_0xdb9e('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdb9e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdb9e('0x4');}},'notificationSound':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdb9e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb9e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdb9e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb9e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xdb9e('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e7b6c){if(!_0x3e7b6c)this['setDataValue'](_0xdb9e('0x8'),null);this[_0xdb9e('0x9')](_0xdb9e('0xa'),_0x3e7b6c);}}}; \ No newline at end of file +var _0x9fc9=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2af3ba,_0x468453){var _0x1b6e2f=function(_0x1ba1c2){while(--_0x1ba1c2){_0x2af3ba['push'](_0x2af3ba['shift']());}};_0x1b6e2f(++_0x468453);}(_0x9fc9,0x86));var _0x99fc=function(_0xf7ca4f,_0x3591d7){_0xf7ca4f=_0xf7ca4f-0x0;var _0x3d17c9=_0x9fc9[_0xf7ca4f];return _0x3d17c9;};'use strict';var Sequelize=require(_0x99fc('0x0'));var rs=require(_0x99fc('0x1'));module[_0x99fc('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x99fc('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x99fc('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x99fc('0x5')],'defaultValue':function(){return _0x99fc('0x6');}},'notificationSound':{'type':Sequelize[_0x99fc('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x99fc('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x99fc('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x99fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x99fc('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x99fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x99fc('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x99fc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x99fc('0x7')],'defaultValue':![],'comment':_0x99fc('0xa'),'set':function(_0x51d89f){if(!_0x51d89f)this[_0x99fc('0xb')]('mandatoryDispositionPauseId',null);this[_0x99fc('0xb')](_0x99fc('0xc'),_0x51d89f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f389769..d954117 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 _0x6c45=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','end','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','map','query','keys','model','attributes','fields','length','order','sort','filters','filter','merge','options','count','includeAll','include','findAll','rows','show','Pause','intersection','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','params','describe','OpenchannelAccountId','Disposition','getDispositions','where','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','nolimit','pick','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','sendStatus','json','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xc8514f,_0x28fc5f){var _0x365c4c=function(_0x1df022){while(--_0x1df022){_0xc8514f['push'](_0xc8514f['shift']());}};_0x365c4c(++_0x28fc5f);}(_0x6c45,0xb1));var _0x56c4=function(_0x149002,_0x15e57b){_0x149002=_0x149002-0x0;var _0xfc81a9=_0x6c45[_0x149002];return _0xfc81a9;};'use strict';var emlformat=require(_0x56c4('0x0'));var rimraf=require(_0x56c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56c4('0x2'));var rp=require(_0x56c4('0x3'));var moment=require(_0x56c4('0x4'));var BPromise=require(_0x56c4('0x5'));var Mustache=require(_0x56c4('0x6'));var util=require(_0x56c4('0x7'));var path=require(_0x56c4('0x8'));var sox=require(_0x56c4('0x9'));var csv=require(_0x56c4('0xa'));var ejs=require(_0x56c4('0xb'));var fs=require('fs');var fs_extra=require(_0x56c4('0xc'));var _=require(_0x56c4('0xd'));var squel=require(_0x56c4('0xe'));var crypto=require(_0x56c4('0xf'));var jsforce=require(_0x56c4('0x10'));var deskjs=require(_0x56c4('0x11'));var toCsv=require(_0x56c4('0xa'));var querystring=require(_0x56c4('0x12'));var Papa=require(_0x56c4('0x13'));var Redis=require(_0x56c4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x56c4('0x15'));var as=require(_0x56c4('0x16'));var hardwareService=require(_0x56c4('0x17'));var logger=require(_0x56c4('0x18'))('api');var utils=require(_0x56c4('0x19'));var config=require(_0x56c4('0x1a'));var licenseUtil=require(_0x56c4('0x1b'));var db=require(_0x56c4('0x1c'))['db'];config['redis']=_[_0x56c4('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56c4('0x1e'))(new Redis(config[_0x56c4('0x1f')]));require(_0x56c4('0x20'))[_0x56c4('0x21')](socket);var jayson=require(_0x56c4('0x22'));var client=jayson['client'][_0x56c4('0x23')]({'port':0x232c});var client9002=jayson[_0x56c4('0x24')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b7664,_0xd0dd01,_0x2bd3c3,_0x2f0bb2){return new BPromise(function(_0x5c54bd,_0xaa6cfa){var _0x2b2e69=_0x2f0bb2||client;return _0x2b2e69['request'](_0x9b7664,_0x2bd3c3)[_0x56c4('0x25')](function(_0x73ebc7){logger[_0x56c4('0x26')](_0x56c4('0x27'),_0xd0dd01,'request\x20sent');logger[_0x56c4('0x28')](_0x56c4('0x29'),_0xd0dd01,_0x56c4('0x2a'),JSON[_0x56c4('0x2b')](_0x73ebc7));if(_0x73ebc7[_0x56c4('0x2c')]){if(_0x73ebc7[_0x56c4('0x2c')]['code']===0x1f4){logger['error'](_0x56c4('0x27'),_0xd0dd01,_0x73ebc7[_0x56c4('0x2c')]['message']);return _0xaa6cfa(_0x73ebc7[_0x56c4('0x2c')][_0x56c4('0x2d')]);}logger[_0x56c4('0x2c')](_0x56c4('0x27'),_0xd0dd01,_0x73ebc7[_0x56c4('0x2c')][_0x56c4('0x2d')]);return _0x5c54bd(_0x73ebc7[_0x56c4('0x2c')]['message']);}else{logger[_0x56c4('0x26')](_0x56c4('0x27'),_0xd0dd01,_0x56c4('0x2a'));_0x5c54bd(_0x73ebc7['result'][_0x56c4('0x2d')]);}})['catch'](function(_0x213cc6){logger[_0x56c4('0x2c')]('OpenchannelAccount,\x20%s,\x20%s',_0xd0dd01,_0x213cc6);_0xaa6cfa(_0x213cc6);});});}function respondWithStatusCode(_0x148268,_0x292b66){_0x292b66=_0x292b66||0xcc;return function(_0x51dcf8){if(_0x51dcf8){return _0x148268['sendStatus'](_0x292b66);}return _0x148268['status'](_0x292b66)[_0x56c4('0x2e')]();};}function respondWithResult(_0x2ac814,_0x3fe97d){_0x3fe97d=_0x3fe97d||0xc8;return function(_0x514d96){if(_0x514d96){return _0x2ac814[_0x56c4('0x2f')](_0x3fe97d)['json'](_0x514d96);}};}function respondWithFilteredResult(_0x4ce20d,_0x5f9cc){return function(_0x461b3a){if(_0x461b3a){var _0x45f4ee=typeof _0x5f9cc[_0x56c4('0x30')]===_0x56c4('0x31')&&typeof _0x5f9cc[_0x56c4('0x32')]===_0x56c4('0x31');var _0x3c8db4=_0x461b3a['count'];var _0x36f430=_0x45f4ee?0x0:_0x5f9cc[_0x56c4('0x30')];var _0x3af58b=_0x45f4ee?_0x461b3a['count']:_0x5f9cc[_0x56c4('0x30')]+_0x5f9cc[_0x56c4('0x32')];var _0x3894ba;if(_0x3af58b>=_0x3c8db4){_0x3af58b=_0x3c8db4;_0x3894ba=0xc8;}else{_0x3894ba=0xce;}_0x4ce20d['status'](_0x3894ba);return _0x4ce20d[_0x56c4('0x33')](_0x56c4('0x34'),_0x36f430+'-'+_0x3af58b+'/'+_0x3c8db4)['json'](_0x461b3a);}return null;};}function patchUpdates(_0x3de2e7){return function(_0x5f1e92){try{jsonpatch[_0x56c4('0x35')](_0x5f1e92,_0x3de2e7,!![]);}catch(_0x4157cd){return BPromise[_0x56c4('0x36')](_0x4157cd);}return _0x5f1e92[_0x56c4('0x37')]();};}function saveUpdates(_0x2dfa7b,_0x4985f2){return function(_0x5533cc){if(_0x5533cc){return _0x5533cc[_0x56c4('0x38')](_0x2dfa7b)[_0x56c4('0x25')](function(_0x420bb0){return _0x420bb0;});}return null;};}function removeEntity(_0x33a9e7,_0x35460d){return function(_0x4abe0f){if(_0x4abe0f){return _0x4abe0f[_0x56c4('0x39')]()[_0x56c4('0x25')](function(){var _0x373129=_0x4abe0f[_0x56c4('0x3a')]({'plain':!![]});var _0x2cb8a5=_0x56c4('0x3b');return db[_0x56c4('0x3c')]['destroy']({'where':{'type':_0x2cb8a5,'resourceId':_0x373129['id']}})['then'](function(){return _0x4abe0f;});})[_0x56c4('0x25')](function(){_0x33a9e7[_0x56c4('0x2f')](0xcc)[_0x56c4('0x2e')]();});}};}function handleEntityNotFound(_0x35e481,_0xca8997){return function(_0x5b7c01){if(!_0x5b7c01){_0x35e481['sendStatus'](0x194);}return _0x5b7c01;};}function handleError(_0x382f79,_0x547a86){_0x547a86=_0x547a86||0x1f4;return function(_0x18be52){logger[_0x56c4('0x2c')](_0x18be52[_0x56c4('0x3d')]);if(_0x18be52[_0x56c4('0x3e')]){delete _0x18be52['name'];}_0x382f79[_0x56c4('0x2f')](_0x547a86)[_0x56c4('0x3f')](_0x18be52);};}exports[_0x56c4('0x40')]=function(_0x14cc7a,_0x4ec104){var _0xf2bdac={'include':[{'model':db['Pause'],'as':_0x56c4('0x41')}]},_0x120713={},_0x5bdf0a={'count':0x0,'rows':[]};var _0x2479a1=_['map'](db[_0x56c4('0x42')][_0x56c4('0x43')],function(_0x546ec9){return{'name':_0x546ec9[_0x56c4('0x44')],'type':_0x546ec9[_0x56c4('0x45')]['key']};});_0x120713['model']=_[_0x56c4('0x46')](_0x2479a1,_0x56c4('0x3e'));_0x120713[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x14cc7a['query']);_0x120713['filters']=_['intersection'](_0x120713[_0x56c4('0x49')],_0x120713[_0x56c4('0x47')]);_0xf2bdac[_0x56c4('0x4a')]=_['intersection'](_0x120713[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x14cc7a['query'][_0x56c4('0x4b')]));_0xf2bdac[_0x56c4('0x4a')]=_0xf2bdac[_0x56c4('0x4a')][_0x56c4('0x4c')]?_0xf2bdac[_0x56c4('0x4a')]:_0x120713[_0x56c4('0x49')];if(!_0x14cc7a[_0x56c4('0x47')]['hasOwnProperty']('nolimit')){_0xf2bdac[_0x56c4('0x32')]=qs['limit'](_0x14cc7a['query'][_0x56c4('0x32')]);_0xf2bdac['offset']=qs[_0x56c4('0x30')](_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x30')]);}_0xf2bdac[_0x56c4('0x4d')]=qs['sort'](_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x4e')]);_0xf2bdac['where']=qs['filters'](_['pick'](_0x14cc7a['query'],_0x120713[_0x56c4('0x4f')]),_0x2479a1);if(_0x14cc7a['query'][_0x56c4('0x50')]){_0xf2bdac['where']=_[_0x56c4('0x51')](_0xf2bdac['where'],{'$or':_[_0x56c4('0x46')](_0x2479a1,function(_0x593a2d){if(_0x593a2d[_0x56c4('0x45')]!=='VIRTUAL'){var _0x5950e5={};_0x5950e5[_0x593a2d[_0x56c4('0x3e')]]={'$like':'%'+_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x5950e5;}})});}_0xf2bdac=_[_0x56c4('0x51')]({},_0xf2bdac,_0x14cc7a[_0x56c4('0x52')]);var _0x177a39={'where':_0xf2bdac['where']};return db[_0x56c4('0x42')][_0x56c4('0x53')](_0x177a39)[_0x56c4('0x25')](function(_0x3219d3){_0x5bdf0a[_0x56c4('0x53')]=_0x3219d3;if(_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x54')]){_0xf2bdac[_0x56c4('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x56c4('0x56')](_0xf2bdac);})[_0x56c4('0x25')](function(_0x5f44d2){_0x5bdf0a[_0x56c4('0x57')]=_0x5f44d2;return _0x5bdf0a;})[_0x56c4('0x25')](respondWithFilteredResult(_0x4ec104,_0xf2bdac))['catch'](handleError(_0x4ec104,null));};exports[_0x56c4('0x58')]=function(_0x3b0618,_0xad66b8){var _0x227001={'raw':![],'where':{'id':_0x3b0618['params']['id']},'include':[{'model':db[_0x56c4('0x59')],'as':'mandatoryDispositionPause'}]},_0x68dbe={};_0x68dbe[_0x56c4('0x49')]=_[_0x56c4('0x48')](db['OpenchannelAccount'][_0x56c4('0x43')]);_0x68dbe[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x3b0618['query']);_0x68dbe[_0x56c4('0x4f')]=_[_0x56c4('0x5a')](_0x68dbe[_0x56c4('0x49')],_0x68dbe['query']);_0x227001['attributes']=_[_0x56c4('0x5a')](_0x68dbe[_0x56c4('0x49')],qs['fields'](_0x3b0618[_0x56c4('0x47')][_0x56c4('0x4b')]));_0x227001[_0x56c4('0x4a')]=_0x227001[_0x56c4('0x4a')]['length']?_0x227001[_0x56c4('0x4a')]:_0x68dbe[_0x56c4('0x49')];if(_0x3b0618[_0x56c4('0x47')][_0x56c4('0x54')]){_0x227001['include']=[{'all':!![]}];}_0x227001=_[_0x56c4('0x51')]({},_0x227001,_0x3b0618['options']);return db[_0x56c4('0x42')][_0x56c4('0x5b')](_0x227001)['then'](handleEntityNotFound(_0xad66b8,null))[_0x56c4('0x25')](respondWithResult(_0xad66b8,null))[_0x56c4('0x5c')](handleError(_0xad66b8,null));};exports['create']=function(_0x5825e8,_0x16fc48){return db[_0x56c4('0x42')]['create'](_0x5825e8[_0x56c4('0x5d')],{})[_0x56c4('0x25')](function(_0x2fc3dd){var _0x31bcb3=_0x5825e8[_0x56c4('0x5e')][_0x56c4('0x3a')]({'plain':!![]});if(!_0x31bcb3)throw new Error(_0x56c4('0x5f'));if(_0x31bcb3[_0x56c4('0x60')]===_0x56c4('0x5e')){var _0x1487ac=_0x2fc3dd['get']({'plain':!![]});var _0x2a1e20=_0x56c4('0x3b');return db[_0x56c4('0x61')][_0x56c4('0x5b')]({'where':{'name':_0x2a1e20,'userProfileId':_0x31bcb3[_0x56c4('0x62')]},'raw':!![]})[_0x56c4('0x25')](function(_0x4241c3){if(_0x4241c3&&_0x4241c3[_0x56c4('0x63')]===0x0){return db[_0x56c4('0x3c')][_0x56c4('0x64')]({'name':_0x1487ac['name'],'resourceId':_0x1487ac['id'],'type':_0x4241c3[_0x56c4('0x3e')],'sectionId':_0x4241c3['id']},{})[_0x56c4('0x25')](function(){return _0x2fc3dd;});}else{return _0x2fc3dd;}})[_0x56c4('0x5c')](function(_0x4d2e6c){logger[_0x56c4('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d2e6c);throw _0x4d2e6c;});}return _0x2fc3dd;})[_0x56c4('0x25')](respondWithResult(_0x16fc48,0xc9))[_0x56c4('0x5c')](handleError(_0x16fc48,null));};exports[_0x56c4('0x38')]=function(_0x18b5ee,_0x1d3760){if(_0x18b5ee[_0x56c4('0x5d')]['id']){delete _0x18b5ee[_0x56c4('0x5d')]['id'];}return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x18b5ee['params']['id']},'include':[{'model':db[_0x56c4('0x59')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1d3760,null))[_0x56c4('0x25')](saveUpdates(_0x18b5ee[_0x56c4('0x5d')],null))['then'](respondWithResult(_0x1d3760,null))[_0x56c4('0x5c')](handleError(_0x1d3760,null));};exports['destroy']=function(_0x5731e9,_0x4feb13){return db[_0x56c4('0x42')]['find']({'where':{'id':_0x5731e9[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x4feb13,null))[_0x56c4('0x25')](removeEntity(_0x4feb13,null))[_0x56c4('0x5c')](handleError(_0x4feb13,null));};exports[_0x56c4('0x66')]=function(_0x1beabf,_0x196904){return db[_0x56c4('0x42')]['describe']()[_0x56c4('0x25')](respondWithResult(_0x196904,null))[_0x56c4('0x5c')](handleError(_0x196904,null));};exports['addDisposition']=function(_0x239203,_0x5c22fb,_0x493c3c){if(_0x239203[_0x56c4('0x5d')]['id']){delete _0x239203[_0x56c4('0x5d')]['id'];}return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x239203['params']['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x5c22fb,null))[_0x56c4('0x25')](function(_0x45f27f){if(_0x45f27f){_0x239203[_0x56c4('0x5d')][_0x56c4('0x67')]=_0x45f27f['id'];return db[_0x56c4('0x68')][_0x56c4('0x64')](_0x239203[_0x56c4('0x5d')]);}})['then'](respondWithResult(_0x5c22fb,null))[_0x56c4('0x5c')](handleError(_0x5c22fb,null));};exports[_0x56c4('0x69')]=function(_0x40301c,_0x6e2c28,_0x4db4ce){var _0x19cdab={'raw':![],'where':{}};var _0x5c4161={};var _0xb59d24={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x40301c[_0x56c4('0x65')]['id']}})['then'](handleEntityNotFound(_0x6e2c28,null))['then'](function(_0x5608e7){if(_0x5608e7){_0x5c4161['model']=_[_0x56c4('0x48')](db[_0x56c4('0x68')][_0x56c4('0x43')]);_0x5c4161['query']=_[_0x56c4('0x48')](_0x40301c['query']);_0x5c4161[_0x56c4('0x4f')]=_['intersection'](_0x5c4161[_0x56c4('0x49')],_0x5c4161[_0x56c4('0x47')]);_0x19cdab[_0x56c4('0x4a')]=_['intersection'](_0x5c4161[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x40301c['query']['fields']));_0x19cdab[_0x56c4('0x4a')]=_0x19cdab[_0x56c4('0x4a')]['length']?_0x19cdab[_0x56c4('0x4a')]:_0x5c4161[_0x56c4('0x49')];if(!_0x40301c['query']['hasOwnProperty']('nolimit')){_0x19cdab[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x40301c[_0x56c4('0x47')]['limit']);_0x19cdab[_0x56c4('0x30')]=qs[_0x56c4('0x30')](_0x40301c[_0x56c4('0x47')]['offset']);}_0x19cdab['order']=qs[_0x56c4('0x4e')](_0x40301c[_0x56c4('0x47')]['sort']);_0x19cdab[_0x56c4('0x6a')]=qs['filters'](_['pick'](_0x40301c['query'],_0x5c4161[_0x56c4('0x4f')]));_0x19cdab[_0x56c4('0x6a')][_0x56c4('0x67')]=_0x5608e7['id'];if(_0x40301c[_0x56c4('0x47')][_0x56c4('0x50')]){_0x19cdab[_0x56c4('0x6a')]=_[_0x56c4('0x51')](_0x19cdab[_0x56c4('0x6a')],{'$or':_['map'](_0x19cdab[_0x56c4('0x4a')],function(_0x1aa5e8){var _0x4eb801={};_0x4eb801[_0x1aa5e8]={'$like':'%'+_0x40301c[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x4eb801;})});}_0x19cdab=_[_0x56c4('0x51')]({},_0x19cdab,_0x40301c[_0x56c4('0x52')]);return db['Disposition'][_0x56c4('0x53')]({'where':_0x19cdab[_0x56c4('0x6a')]})['then'](function(_0x4eddc5){_0xb59d24[_0x56c4('0x53')]=_0x4eddc5;if(_0x40301c[_0x56c4('0x47')][_0x56c4('0x54')]){_0x19cdab['include']=[{'all':!![]}];}return db[_0x56c4('0x68')]['findAll'](_0x19cdab);})['then'](function(_0x5a054e){_0xb59d24[_0x56c4('0x57')]=_0x5a054e;return _0xb59d24;});}})['then'](respondWithFilteredResult(_0x6e2c28,_0x19cdab))[_0x56c4('0x5c')](handleError(_0x6e2c28,null));};exports[_0x56c4('0x6b')]=function(_0x400fa0,_0x46d6e9,_0x5cd682){return db['OpenchannelAccount'][_0x56c4('0x5b')]({'where':{'id':_0x400fa0['params']['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x46d6e9,null))[_0x56c4('0x25')](function(_0x253e95){if(_0x253e95){return _0x253e95['removeDispositions'](_0x400fa0[_0x56c4('0x47')][_0x56c4('0x6c')]);}})[_0x56c4('0x25')](respondWithStatusCode(_0x46d6e9,null))[_0x56c4('0x5c')](handleError(_0x46d6e9,null));};exports[_0x56c4('0x6d')]=function(_0xb04ecf,_0x537f7e,_0x598dd4){if(_0xb04ecf[_0x56c4('0x5d')]['id']){delete _0xb04ecf[_0x56c4('0x5d')]['id'];}return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0xb04ecf[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x537f7e,null))[_0x56c4('0x25')](function(_0x2f5b76){if(_0x2f5b76){_0xb04ecf['body']['OpenchannelAccountId']=_0x2f5b76['id'];return db[_0x56c4('0x6e')]['create'](_0xb04ecf[_0x56c4('0x5d')]);}})[_0x56c4('0x25')](respondWithResult(_0x537f7e,null))[_0x56c4('0x5c')](handleError(_0x537f7e,null));};exports[_0x56c4('0x6f')]=function(_0x463ecd,_0x5a6b39,_0x23f2f1){var _0x3cbb4f={'raw':![],'where':{}};var _0x3a40f2={};var _0x4df8ac={'count':0x0,'rows':[]};return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x463ecd[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x5a6b39,null))[_0x56c4('0x25')](function(_0x3293b3){if(_0x3293b3){_0x3a40f2[_0x56c4('0x49')]=_[_0x56c4('0x48')](db['CannedAnswer']['rawAttributes']);_0x3a40f2['query']=_['keys'](_0x463ecd[_0x56c4('0x47')]);_0x3a40f2[_0x56c4('0x4f')]=_[_0x56c4('0x5a')](_0x3a40f2[_0x56c4('0x49')],_0x3a40f2[_0x56c4('0x47')]);_0x3cbb4f[_0x56c4('0x4a')]=_[_0x56c4('0x5a')](_0x3a40f2[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x463ecd[_0x56c4('0x47')][_0x56c4('0x4b')]));_0x3cbb4f[_0x56c4('0x4a')]=_0x3cbb4f[_0x56c4('0x4a')][_0x56c4('0x4c')]?_0x3cbb4f['attributes']:_0x3a40f2[_0x56c4('0x49')];if(!_0x463ecd['query'][_0x56c4('0x71')](_0x56c4('0x72'))){_0x3cbb4f[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x463ecd[_0x56c4('0x47')]['limit']);_0x3cbb4f[_0x56c4('0x30')]=qs[_0x56c4('0x30')](_0x463ecd[_0x56c4('0x47')][_0x56c4('0x30')]);}_0x3cbb4f[_0x56c4('0x4d')]=qs[_0x56c4('0x4e')](_0x463ecd[_0x56c4('0x47')][_0x56c4('0x4e')]);_0x3cbb4f[_0x56c4('0x6a')]=qs['filters'](_[_0x56c4('0x73')](_0x463ecd[_0x56c4('0x47')],_0x3a40f2[_0x56c4('0x4f')]));_0x3cbb4f[_0x56c4('0x6a')][_0x56c4('0x67')]=_0x3293b3['id'];if(_0x463ecd['query'][_0x56c4('0x50')]){_0x3cbb4f[_0x56c4('0x6a')]=_['merge'](_0x3cbb4f[_0x56c4('0x6a')],{'$or':_['map'](_0x3cbb4f['attributes'],function(_0x4796bf){var _0x5dbb11={};_0x5dbb11[_0x4796bf]={'$like':'%'+_0x463ecd[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x5dbb11;})});}_0x3cbb4f=_['merge']({},_0x3cbb4f,_0x463ecd[_0x56c4('0x52')]);return db[_0x56c4('0x6e')][_0x56c4('0x53')]({'where':_0x3cbb4f['where']})[_0x56c4('0x25')](function(_0x116be3){_0x4df8ac[_0x56c4('0x53')]=_0x116be3;if(_0x463ecd['query'][_0x56c4('0x54')]){_0x3cbb4f[_0x56c4('0x55')]=[{'all':!![]}];}return db[_0x56c4('0x6e')]['findAll'](_0x3cbb4f);})['then'](function(_0x4f814f){_0x4df8ac[_0x56c4('0x57')]=_0x4f814f;return _0x4df8ac;});}})[_0x56c4('0x25')](respondWithFilteredResult(_0x5a6b39,_0x3cbb4f))[_0x56c4('0x5c')](handleError(_0x5a6b39,null));};exports[_0x56c4('0x74')]=function(_0x4509a3,_0xebea9,_0x30fb45){return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x4509a3['params']['id']}})['then'](handleEntityNotFound(_0xebea9,null))['then'](function(_0x5e9279){if(_0x5e9279){return _0x5e9279[_0x56c4('0x74')](_0x4509a3[_0x56c4('0x47')][_0x56c4('0x6c')]);}})['then'](respondWithStatusCode(_0xebea9,null))[_0x56c4('0x5c')](handleError(_0xebea9,null));};exports[_0x56c4('0x75')]=function(_0x4ab930,_0x4883cd,_0x46c4f6){var _0x5b96e6={'body':_0x4ab930[_0x56c4('0x5d')],'channel':_0x56c4('0x76')};var _0x3d310b=[];var _0x2078eb=[];var _0x3818a3={};var _0x3f9a5a=![];return db[_0x56c4('0x77')][_0x56c4('0x66')]()[_0x56c4('0x25')](function(_0x4563dd){if(!_0x4563dd){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x7a'));}_0x3d310b=_['difference'](_[_0x56c4('0x48')](_0x4563dd),[_0x56c4('0x7b'),_0x56c4('0x7c')]);_0x2078eb=_[_0x56c4('0x7d')](_['keys'](_0x4563dd),[_0x56c4('0x7b'),_0x56c4('0x7c'),_0x56c4('0x7e'),_0x56c4('0x7f')]);if(_0x4ab930['body']['id']){delete _0x4ab930[_0x56c4('0x5d')]['id'];}if(_[_0x56c4('0x80')](_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')])){throw new db['Sequelize'][(_0x56c4('0x79'))](_0x56c4('0x82'));}if(_['isNil'](_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x5d')])||_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x5d')]===''){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x83'));}if(_[_0x56c4('0x80')](_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')])){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x85')+_0x2078eb);}if(!_[_0x56c4('0x86')](_0x2078eb,_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')])){throw new db[(_0x56c4('0x78'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2078eb);}_0x3818a3[_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')]]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')];})[_0x56c4('0x25')](function(){return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x4ab930[_0x56c4('0x65')]['id']},'include':[{'model':db[_0x56c4('0x87')],'as':_0x56c4('0x88'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3818a3,'limit':0x1,'order':[['updatedAt',_0x56c4('0x89')]]}]},{'model':db[_0x56c4('0x8a')],'as':_0x56c4('0x8b')}]});})['then'](handleEntityNotFound(_0x4883cd,null))[_0x56c4('0x25')](function(_0x36b208){if(_0x36b208&&_0x36b208['List']){_0x5b96e6[_0x56c4('0x8c')]=_0x36b208;_0x5b96e6[_0x56c4('0x8d')]=_0x36b208[_0x56c4('0x8b')];_0x5b96e6[_0x56c4('0x8e')]=_0x36b208[_0x56c4('0x88')];_0x5b96e6[_0x56c4('0x8d')]=_[_0x56c4('0x8f')](_0x5b96e6['applications'],[_0x56c4('0x90')],[_0x56c4('0x91')]);if(_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x8b')]){delete _0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x8b')];}if(_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x88')]&&_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x88')]['Contacts'][_0x56c4('0x4c')]){return _0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x88')][_0x56c4('0x92')][0x0];}var _0x295b20=_[_0x56c4('0x1d')](_0x4ab930['body'],{'firstName':_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')],'ListId':_0x36b208[_0x56c4('0x7f')]});_0x295b20[_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')]]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')];return db[_0x56c4('0x77')]['create'](_0x295b20,{'fields':_0x3d310b,'raw':!![]});}})['then'](handleEntityNotFound(_0x4883cd,null))[_0x56c4('0x25')](function(_0x11b4ac){_0x5b96e6[_0x56c4('0x93')]=_0x11b4ac;if(_0x11b4ac){var _0x2080fe={'ContactId':_0x11b4ac['id'],'OpenchannelAccountId':_0x4ab930[_0x56c4('0x65')]['id'],'from':(_0x11b4ac[_0x56c4('0x94')]||'')+'\x20'+(_0x11b4ac[_0x56c4('0x95')]||'')};var _0x359080={'OpenchannelAccountId':_0x4ab930[_0x56c4('0x65')]['id'],'closed':![]};if(_0x4ab930[_0x56c4('0x5d')]['threadId']){_0x359080['threadId']=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')];return db[_0x56c4('0x97')][_0x56c4('0x5b')]({'where':_0x359080})[_0x56c4('0x25')](function(_0x589977){if(_0x589977){return[_0x589977,![]];}_0x2080fe[_0x56c4('0x96')]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')];_0x2080fe[_0x56c4('0x98')]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x98')];return db[_0x56c4('0x97')][_0x56c4('0x64')](_0x2080fe)['then'](function(_0x10341f){return[_0x10341f,!![]];});});}else{_0x359080[_0x56c4('0x96')]=null;}_0x359080['ContactId']=_0x11b4ac['id'];return db[_0x56c4('0x97')][_0x56c4('0x5b')]({'where':_0x359080})[_0x56c4('0x25')](function(_0x1445ef){if(_0x1445ef){return[_0x1445ef,![]];}return db[_0x56c4('0x97')][_0x56c4('0x64')](_0x2080fe)[_0x56c4('0x25')](function(_0x136e1d){return[_0x136e1d,!![]];});});}})[_0x56c4('0x99')](function(_0x553d65,_0x1d6e5a){if(_0x553d65){_0x3f9a5a=_0x1d6e5a;if(!_0x1d6e5a){var _0x30bd2={'from':(_0x5b96e6[_0x56c4('0x93')][_0x56c4('0x94')]||'')+'\x20'+(_0x5b96e6[_0x56c4('0x93')][_0x56c4('0x95')]||'')};if(_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')]&&_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x9a')]&&_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')]!=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x9a')]){_0x30bd2[_0x56c4('0x96')]=_0x4ab930['body'][_0x56c4('0x9a')];}return _0x553d65[_0x56c4('0x38')](_0x30bd2);}else{return _0x553d65;}}})[_0x56c4('0x25')](function(_0x30cfc9){_0x5b96e6[_0x56c4('0x9b')]=_0x30cfc9['get']({'plain':!![]});_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0x9c')]=_0x3f9a5a;if(_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0x9c')]){if(_0x5b96e6['account'][_0x56c4('0x9d')]){_0x5b96e6['applications'][_0x56c4('0x9e')]({'id':0x0,'priority':_0x5b96e6[_0x56c4('0x8d')]['length']+0x1,'app':_0x56c4('0x9f'),'appdata':_0x56c4('0xa0'),'interval':_0x56c4('0xa1')});}}return db[_0x56c4('0xa2')][_0x56c4('0x64')]({'body':_0x4ab930['body'][_0x56c4('0x5d')],'OpenchannelAccountId':_0x4ab930[_0x56c4('0x65')]['id'],'OpenchannelInteractionId':_0x30cfc9['id'],'direction':'in','ContactId':_0x5b96e6[_0x56c4('0x93')]['id'],'AttachmentId':_0x4ab930[_0x56c4('0x5d')][_0x56c4('0xa3')]});})[_0x56c4('0x25')](function(_0x30a5aa){_0x5b96e6[_0x56c4('0x2d')]=_0x30a5aa;if(!_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0xa4')])return;return db[_0x56c4('0xa5')][_0x56c4('0x5b')]({'attributes':['id',_0x56c4('0x3e')],'where':{'id':_0x5b96e6['interaction'][_0x56c4('0xa4')]}});})[_0x56c4('0x25')](function(_0x1a0e0c){if(_0x1a0e0c){_0x5b96e6['applications'][_0x56c4('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a0e0c['name']+','+(_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0xa7')]||0xa),'interval':_0x56c4('0xa1')});}if(!_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0xa8')])return;return db[_0x56c4('0xa9')]['find']({'attributes':['id',_0x56c4('0x3e')],'where':{'id':_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0xa8')]}});})[_0x56c4('0x25')](function(_0x55c122){if(_0x55c122){_0x5b96e6[_0x56c4('0x8d')][_0x56c4('0xa6')]({'id':0x0,'priority':0x1,'app':_0x56c4('0xaa'),'appdata':_0x55c122['name']+','+(_0x5b96e6['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x56c4('0xa1')});}return respondWithRpcPromise(_0x56c4('0xab'),_0x56c4('0xac'),_0x5b96e6);})[_0x56c4('0x25')](function(_0x3bdbf5){respondWithRpcPromise(_0x56c4('0xad'),_0x56c4('0xad'),{'event':'notify','message':_0x3bdbf5},client9002);return _0x3bdbf5;})[_0x56c4('0x25')](respondWithResult(_0x4883cd,null))[_0x56c4('0x5c')](handleError(_0x4883cd,null));};exports[_0x56c4('0xae')]=function(_0x4ff4f6,_0x603897){var _0x1ddc3e=_0x4ff4f6['params']['id'];var _0x4086ba=_0x4ff4f6[_0x56c4('0x5d')];var _0x204386=0xc8;var _0x3b5a30=null;return db[_0x56c4('0xaf')][_0x56c4('0xb0')]({'isolationLevel':db[_0x56c4('0xaf')]['Transaction'][_0x56c4('0xb1')][_0x56c4('0xb2')]},function(_0x5209c9){return db['OpenchannelAccount'][_0x56c4('0x70')]({'where':{'id':_0x1ddc3e},'transaction':_0x5209c9})[_0x56c4('0x25')](function(_0x5aa1c8){if(_0x5aa1c8){return db[_0x56c4('0x8a')][_0x56c4('0x39')]({'where':{'OpenchannelAccountId':_0x1ddc3e},'transaction':_0x5209c9})[_0x56c4('0x25')](function(){var _0xfb6978=_['map'](_0x4086ba,function(_0x1c76c5){_0x1c76c5['OpenchannelAccountId']=_0x1ddc3e;return _0x1c76c5;});return db['OpenchannelApplication'][_0x56c4('0xb3')](_0xfb6978,{'transaction':_0x5209c9});});}else{_0x204386=0x194;_0x3b5a30=[];}});})[_0x56c4('0x25')](function(){if(_0x204386!==0x194){return db[_0x56c4('0x8a')][_0x56c4('0xb4')]({'where':{'OpenchannelAccountId':_0x1ddc3e},'order':_0x56c4('0x90')})['then'](function(_0x525a0f){_0x3b5a30=_0x525a0f;});}})[_0x56c4('0x5c')](function(_0x4b92fd){_0x204386=0x1f4;logger[_0x56c4('0x2c')](_0x4b92fd[_0x56c4('0x3d')]);if(_0x4b92fd[_0x56c4('0x3e')]){delete _0x4b92fd[_0x56c4('0x3e')];}_0x3b5a30=_0x4b92fd;})['finally'](function(){if(_0x3b5a30===null){_0x603897[_0x56c4('0xb5')](_0x204386);}else{if(_0x204386===0x1f4){_0x603897['status'](_0x204386)[_0x56c4('0x3f')](_0x3b5a30);}else{_0x603897[_0x56c4('0x2f')](_0x204386)[_0x56c4('0xb6')](_0x3b5a30);}}});};exports[_0x56c4('0xb7')]=function(_0x5c627b,_0x111161,_0x4bfdb0){var _0x696605={};var _0x30cd5c={};var _0x4a9d0b;var _0x74b2a6;return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x5c627b[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x111161,null))[_0x56c4('0x25')](function(_0x38f0af){if(_0x38f0af){_0x4a9d0b=_0x38f0af;_0x30cd5c[_0x56c4('0x49')]=_[_0x56c4('0x48')](db[_0x56c4('0x8a')]['rawAttributes']);_0x30cd5c[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x5c627b[_0x56c4('0x47')]);_0x30cd5c['filters']=_[_0x56c4('0x5a')](_0x30cd5c[_0x56c4('0x49')],_0x30cd5c[_0x56c4('0x47')]);_0x696605['attributes']=_['intersection'](_0x30cd5c[_0x56c4('0x49')],qs['fields'](_0x5c627b['query'][_0x56c4('0x4b')]));_0x696605[_0x56c4('0x4a')]=_0x696605[_0x56c4('0x4a')][_0x56c4('0x4c')]?_0x696605['attributes']:_0x30cd5c[_0x56c4('0x49')];_0x696605[_0x56c4('0x4d')]=qs[_0x56c4('0x4e')](_0x5c627b[_0x56c4('0x47')][_0x56c4('0x4e')]);_0x696605[_0x56c4('0x6a')]=qs[_0x56c4('0x4f')](_['pick'](_0x5c627b[_0x56c4('0x47')],_0x30cd5c['filters']));if(_0x5c627b[_0x56c4('0x47')][_0x56c4('0x50')]){_0x696605['where']=_[_0x56c4('0x51')](_0x696605['where'],{'$or':_[_0x56c4('0x46')](_0x696605['attributes'],function(_0x366689){var _0x1ef8e0={};_0x1ef8e0[_0x366689]={'$like':'%'+_0x5c627b['query']['filter']+'%'};return _0x1ef8e0;})});}_0x696605=_['merge']({},_0x696605,_0x5c627b['options']);return _0x4a9d0b[_0x56c4('0xb7')](_0x696605);}})['then'](function(_0x3a00b3){if(_0x3a00b3){_0x74b2a6=_0x3a00b3[_0x56c4('0x4c')];if(!_0x5c627b[_0x56c4('0x47')][_0x56c4('0x71')](_0x56c4('0x72'))){_0x696605[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x5c627b[_0x56c4('0x47')]['limit']);_0x696605[_0x56c4('0x30')]=qs[_0x56c4('0x30')](_0x5c627b[_0x56c4('0x47')][_0x56c4('0x30')]);}return _0x4a9d0b[_0x56c4('0xb7')](_0x696605);}})[_0x56c4('0x25')](function(_0xe10a55){if(_0xe10a55){return _0xe10a55?{'count':_0x74b2a6,'rows':_0xe10a55}:null;}})[_0x56c4('0x25')](respondWithResult(_0x111161,null))[_0x56c4('0x5c')](handleError(_0x111161,null));};exports[_0x56c4('0xb8')]=function(_0x3980e0,_0x1199ff,_0x4c23e3){var _0x5bd16a={'raw':![],'where':{}};var _0x1b7c0={};var _0x357917={'count':0x0,'rows':[]};return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x3980e0[_0x56c4('0x65')]['id']}})['then'](handleEntityNotFound(_0x1199ff,null))['then'](function(_0x218330){if(_0x218330){_0x1b7c0[_0x56c4('0x49')]=_[_0x56c4('0x48')](db[_0x56c4('0x97')][_0x56c4('0x43')]);_0x1b7c0[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x3980e0[_0x56c4('0x47')]);_0x1b7c0[_0x56c4('0x4f')]=_[_0x56c4('0x5a')](_0x1b7c0['model'],_0x1b7c0['query']);_0x5bd16a[_0x56c4('0x4a')]=_[_0x56c4('0x5a')](_0x1b7c0[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x3980e0['query'][_0x56c4('0x4b')]));_0x5bd16a['attributes']=_0x5bd16a['attributes']['length']?_0x5bd16a['attributes']:_0x1b7c0[_0x56c4('0x49')];if(!_0x3980e0[_0x56c4('0x47')][_0x56c4('0x71')]('nolimit')){_0x5bd16a[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x3980e0[_0x56c4('0x47')][_0x56c4('0x32')]);_0x5bd16a['offset']=qs[_0x56c4('0x30')](_0x3980e0['query'][_0x56c4('0x30')]);}_0x5bd16a[_0x56c4('0x4d')]=qs[_0x56c4('0x4e')](_0x3980e0[_0x56c4('0x47')][_0x56c4('0x4e')]);_0x5bd16a['where']=qs[_0x56c4('0x4f')](_['pick'](_0x3980e0[_0x56c4('0x47')],_0x1b7c0[_0x56c4('0x4f')]));_0x5bd16a[_0x56c4('0x6a')][_0x56c4('0x67')]=_0x218330['id'];if(_0x3980e0[_0x56c4('0x47')][_0x56c4('0x50')]){_0x5bd16a[_0x56c4('0x6a')]=_[_0x56c4('0x51')](_0x5bd16a[_0x56c4('0x6a')],{'$or':_[_0x56c4('0x46')](_0x5bd16a[_0x56c4('0x4a')],function(_0x229296){var _0x284227={};_0x284227[_0x229296]={'$like':'%'+_0x3980e0[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x284227;})});}_0x5bd16a=_[_0x56c4('0x51')]({},_0x5bd16a,_0x3980e0[_0x56c4('0x52')]);return db[_0x56c4('0x97')]['count']({'where':_0x5bd16a[_0x56c4('0x6a')]})[_0x56c4('0x25')](function(_0x54a813){_0x357917['count']=_0x54a813;if(_0x3980e0[_0x56c4('0x47')][_0x56c4('0x54')]){_0x5bd16a[_0x56c4('0x55')]=[{'model':db[_0x56c4('0x77')],'as':'Contact','required':![]},{'model':db[_0x56c4('0xa5')],'as':_0x56c4('0xb9'),'attributes':[_0x56c4('0x3e'),_0x56c4('0xba'),'internal'],'required':![]},{'model':db[_0x56c4('0xbb')],'as':_0x56c4('0xbc'),'attributes':['id',_0x56c4('0x3e'),_0x56c4('0xbd')],'where':_0x3980e0[_0x56c4('0x47')][_0x56c4('0xbe')]?{'id':_0x3980e0[_0x56c4('0x47')]['tag']}:undefined,'required':_0x3980e0[_0x56c4('0x47')][_0x56c4('0xbe')]?!![]:![]}];}return db[_0x56c4('0x97')]['findAll'](_0x5bd16a);})[_0x56c4('0x25')](function(_0x535bf5){_0x357917[_0x56c4('0x57')]=_0x535bf5;return _0x357917;});}})['then'](respondWithFilteredResult(_0x1199ff,_0x5bd16a))[_0x56c4('0x5c')](handleError(_0x1199ff,null));};exports['addAgents']=function(_0x3325e9,_0x4e593b,_0x5d1a44){return db['OpenchannelAccount'][_0x56c4('0x5b')]({'where':{'id':_0x3325e9[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x4e593b,null))[_0x56c4('0x25')](function(_0xb003f4){if(_0xb003f4){return _0xb003f4['addAgents'](_0x3325e9[_0x56c4('0x5d')][_0x56c4('0x6c')],_[_0x56c4('0xbf')](_0x3325e9[_0x56c4('0x5d')],[_0x56c4('0x6c'),'id'])||{})[_0x56c4('0x99')](function(_0x3ea47c){for(var _0x2522bb=0x0;_0x2522bb<_0x3325e9['body'][_0x56c4('0x6c')][_0x56c4('0x4c')];_0x2522bb+=0x1){socket[_0x56c4('0xc0')](_0x56c4('0xc1'),{'UserId':Number(_0x3325e9['body'][_0x56c4('0x6c')][_0x2522bb]),'OpenchannelAccountId':Number(_0x3325e9[_0x56c4('0x65')]['id'])});}return _0x3ea47c;});}})['then'](respondWithResult(_0x4e593b,null))[_0x56c4('0x5c')](handleError(_0x4e593b,null));};exports[_0x56c4('0xc2')]=function(_0x4a7903,_0x26d566,_0x42adf7){return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x4a7903['params']['id']}})['then'](handleEntityNotFound(_0x26d566,null))[_0x56c4('0x25')](function(_0x50e7c3){if(_0x50e7c3){return _0x50e7c3[_0x56c4('0xc2')](_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')])[_0x56c4('0x25')](function(){if(_['isArray'](_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')])){for(var _0x346d3c=0x0;_0x346d3c<_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')]['length'];_0x346d3c+=0x1){socket[_0x56c4('0xc0')](_0x56c4('0xc3'),{'UserId':Number(_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')][_0x346d3c]),'OpenchannelAccountId':Number(_0x4a7903[_0x56c4('0x65')]['id'])});}}else{socket[_0x56c4('0xc0')](_0x56c4('0xc3'),{'UserId':Number(_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')]),'OpenchannelAccountId':Number(_0x4a7903[_0x56c4('0x65')]['id'])});}});}})[_0x56c4('0x25')](respondWithStatusCode(_0x26d566,null))[_0x56c4('0x5c')](handleError(_0x26d566,null));};exports[_0x56c4('0xc4')]=function(_0x3100a0,_0x33ea7a,_0x864216){var _0x8642c0={};var _0x5beaf6={};var _0x5f2ee8;var _0x2beb23;return db[_0x56c4('0x42')]['findOne']({'where':{'id':_0x3100a0[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x33ea7a,null))[_0x56c4('0x25')](function(_0x107b30){if(_0x107b30){_0x5f2ee8=_0x107b30;_0x5beaf6[_0x56c4('0x49')]=_['keys'](db['User'][_0x56c4('0x43')]);_0x5beaf6['query']=_[_0x56c4('0x48')](_0x3100a0[_0x56c4('0x47')]);_0x5beaf6[_0x56c4('0x4f')]=_['intersection'](_0x5beaf6['model'],_0x5beaf6[_0x56c4('0x47')]);_0x8642c0[_0x56c4('0x4a')]=_[_0x56c4('0x5a')](_0x5beaf6[_0x56c4('0x49')],qs['fields'](_0x3100a0[_0x56c4('0x47')][_0x56c4('0x4b')]));_0x8642c0['attributes']=_0x8642c0[_0x56c4('0x4a')]['length']?_0x8642c0[_0x56c4('0x4a')]:_0x5beaf6[_0x56c4('0x49')];_0x8642c0[_0x56c4('0x4d')]=qs['sort'](_0x3100a0['query'][_0x56c4('0x4e')]);_0x8642c0[_0x56c4('0x6a')]=qs[_0x56c4('0x4f')](_[_0x56c4('0x73')](_0x3100a0[_0x56c4('0x47')],_0x5beaf6[_0x56c4('0x4f')]));if(_0x3100a0['query']['filter']){_0x8642c0[_0x56c4('0x6a')]=_[_0x56c4('0x51')](_0x8642c0['where'],{'$or':_[_0x56c4('0x46')](_0x8642c0[_0x56c4('0x4a')],function(_0x19824a){var _0x25425a={};_0x25425a[_0x19824a]={'$like':'%'+_0x3100a0[_0x56c4('0x47')]['filter']+'%'};return _0x25425a;})});}_0x8642c0=_[_0x56c4('0x51')]({},_0x8642c0,_0x3100a0[_0x56c4('0x52')]);return _0x5f2ee8['getAgents'](_0x8642c0);}})[_0x56c4('0x25')](function(_0x486350){if(_0x486350){_0x2beb23=_0x486350['length'];if(!_0x3100a0[_0x56c4('0x47')][_0x56c4('0x71')](_0x56c4('0x72'))){_0x8642c0[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x3100a0[_0x56c4('0x47')][_0x56c4('0x32')]);_0x8642c0['offset']=qs[_0x56c4('0x30')](_0x3100a0[_0x56c4('0x47')][_0x56c4('0x30')]);}return _0x5f2ee8[_0x56c4('0xc4')](_0x8642c0);}})[_0x56c4('0x25')](function(_0x1268fc){if(_0x1268fc){return _0x1268fc?{'count':_0x2beb23,'rows':_0x1268fc}:null;}})['then'](respondWithResult(_0x33ea7a,null))['catch'](handleError(_0x33ea7a,null));};exports['send']=function(_0x5958f0,_0xfc59db,_0x3cd135){var _0x25552b,_0x2efbe5,_0x545461;if(_[_0x56c4('0x80')](_0x5958f0[_0x56c4('0x5d')]['body'])||_0x5958f0[_0x56c4('0x5d')][_0x56c4('0x5d')]===''){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x83'));}if(_[_0x56c4('0x80')](_0x5958f0[_0x56c4('0x5d')]['to'])){}_0x25552b=_0x5958f0[_0x56c4('0x5d')]['to'];return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x5958f0[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0xfc59db,null))[_0x56c4('0x25')](function(_0x58519f){if(_0x58519f){return db['OpenchannelAccount'][_0x56c4('0x5b')]({'where':{'id':_0x58519f['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x56c4('0x92'),'where':{[_0x58519f[_0x56c4('0x84')]]:_0x25552b},'limit':0x1,'order':[[_0x56c4('0x7c'),_0x56c4('0x89')]]}]}]})['then'](handleEntityNotFound(_0xfc59db,null))[_0x56c4('0x25')](function(_0x3fa34a){if(_0x3fa34a&&_0x3fa34a[_0x56c4('0x88')]){_0x2efbe5=_0x3fa34a['get']({'plain':!![]});if(_0x2efbe5['List']&&_0x2efbe5[_0x56c4('0x88')][_0x56c4('0x92')][_0x56c4('0x4c')]){return _0x2efbe5['List']['Contacts'][0x0];}return db[_0x56c4('0x77')][_0x56c4('0x64')](_[_0x56c4('0x1d')](_0x5958f0[_0x56c4('0x5d')],{'firstName':_0x25552b,[_0x3fa34a['mapKey']]:_0x25552b,'phone':_0x25552b,'ListId':_0x2efbe5[_0x56c4('0x7f')]}));}})['then'](handleEntityNotFound(_0xfc59db,null))['then'](function(_0x1a0a83){if(_0x1a0a83){_0x545461=_0x1a0a83;return db['OpenchannelInteraction'][_0x56c4('0x5b')]({'where':{'ContactId':_0x545461['id'],'closed':![],'OpenchannelAccountId':_0x2efbe5['id']}})[_0x56c4('0x25')](function(_0xa55237){if(_0xa55237){return[_0xa55237,![]];}return db[_0x56c4('0x97')][_0x56c4('0x64')]({'UserId':_0x5958f0[_0x56c4('0x5e')]['id'],'ContactId':_0x545461['id'],'OpenchannelAccountId':_0x2efbe5['id'],'lastMsgDirection':_0x56c4('0xc5'),'firstMsgDirection':'out','Messages':[_['merge'](_0x5958f0[_0x56c4('0x5d')],{'read':![],'body':_0x5958f0[_0x56c4('0x5d')][_0x56c4('0x5d')],'OpenchannelAccountId':_0x2efbe5['id'],'UserId':_0x5958f0['user']['id'],'ContactId':_0x545461['id']})]},{'include':[{'model':db[_0x56c4('0xa2')],'as':_0x56c4('0xc6')}]})[_0x56c4('0x25')](function(_0x54f0e7){return[_0x54f0e7,!![]];});});}})[_0x56c4('0x99')](function(_0x10bd0c,_0x1d8598){if(_0x1d8598){return _0x10bd0c;}return db[_0x56c4('0xa2')][_0x56c4('0x64')](_[_0x56c4('0x51')](_0x5958f0['body'],{'read':![],'body':_0x5958f0[_0x56c4('0x5d')][_0x56c4('0x5d')],'OpenchannelAccountId':_0x2efbe5['id'],'OpenchannelInteractionId':_0x10bd0c['id'],'UserId':_0x5958f0[_0x56c4('0x5e')]['id'],'ContactId':_0x545461['id']}))[_0x56c4('0x25')](function(_0x23c204){_0x10bd0c[_0x56c4('0xc7')][_0x56c4('0xc6')]=[];_0x10bd0c[_0x56c4('0xc7')][_0x56c4('0xc6')][_0x56c4('0x9e')](_0x23c204['dataValues']);return _0x10bd0c;});});}})[_0x56c4('0x25')](respondWithResult(_0xfc59db,null))[_0x56c4('0x5c')](handleError(_0xfc59db,null));}; \ No newline at end of file +var _0x91c6=['Applications','account','list','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','close','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','fullname','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x91c6,0xf9));var _0x691c=function(_0x25829f,_0x673baa){_0x25829f=_0x25829f-0x0;var _0x11c359=_0x91c6[_0x25829f];return _0x11c359;};'use strict';var emlformat=require(_0x691c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x691c('0x1'));var rp=require(_0x691c('0x2'));var moment=require(_0x691c('0x3'));var BPromise=require(_0x691c('0x4'));var Mustache=require(_0x691c('0x5'));var util=require('util');var path=require(_0x691c('0x6'));var sox=require(_0x691c('0x7'));var csv=require(_0x691c('0x8'));var ejs=require(_0x691c('0x9'));var fs=require('fs');var fs_extra=require(_0x691c('0xa'));var _=require(_0x691c('0xb'));var squel=require('squel');var crypto=require(_0x691c('0xc'));var jsforce=require(_0x691c('0xd'));var deskjs=require(_0x691c('0xe'));var toCsv=require(_0x691c('0x8'));var querystring=require('querystring');var Papa=require(_0x691c('0xf'));var Redis=require(_0x691c('0x10'));var authService=require(_0x691c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x691c('0x12'))(_0x691c('0x13'));var utils=require(_0x691c('0x14'));var config=require(_0x691c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x691c('0x16')]=_[_0x691c('0x17')](config[_0x691c('0x16')],{'host':_0x691c('0x18'),'port':0x18eb});var socket=require(_0x691c('0x19'))(new Redis(config[_0x691c('0x16')]));require(_0x691c('0x1a'))[_0x691c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x691c('0x1c')][_0x691c('0x1d')]({'port':0x232c});var client9002=jayson[_0x691c('0x1c')][_0x691c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x136747,_0x13c97d,_0x3efaec,_0x6b9f85){return new BPromise(function(_0x482351,_0x634280){var _0x1b4cf0=_0x6b9f85||client;return _0x1b4cf0[_0x691c('0x1e')](_0x136747,_0x3efaec)[_0x691c('0x1f')](function(_0x436951){logger['info'](_0x691c('0x20'),_0x13c97d,_0x691c('0x21'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x13c97d,'request\x20sent',JSON[_0x691c('0x22')](_0x436951));if(_0x436951['error']){if(_0x436951[_0x691c('0x23')]['code']===0x1f4){logger['error'](_0x691c('0x20'),_0x13c97d,_0x436951[_0x691c('0x23')][_0x691c('0x24')]);return _0x634280(_0x436951[_0x691c('0x23')][_0x691c('0x24')]);}logger['error'](_0x691c('0x20'),_0x13c97d,_0x436951['error'][_0x691c('0x24')]);return _0x482351(_0x436951['error'][_0x691c('0x24')]);}else{logger[_0x691c('0x25')](_0x691c('0x20'),_0x13c97d,_0x691c('0x21'));_0x482351(_0x436951[_0x691c('0x26')]['message']);}})[_0x691c('0x27')](function(_0x5a1635){logger[_0x691c('0x23')](_0x691c('0x20'),_0x13c97d,_0x5a1635);_0x634280(_0x5a1635);});});}function respondWithStatusCode(_0x2d7c67,_0x2a8fa3){_0x2a8fa3=_0x2a8fa3||0xcc;return function(_0x228488){if(_0x228488){return _0x2d7c67[_0x691c('0x28')](_0x2a8fa3);}return _0x2d7c67[_0x691c('0x29')](_0x2a8fa3)[_0x691c('0x2a')]();};}function respondWithResult(_0x54a16d,_0x7a07ec){_0x7a07ec=_0x7a07ec||0xc8;return function(_0x124933){if(_0x124933){return _0x54a16d[_0x691c('0x29')](_0x7a07ec)[_0x691c('0x2b')](_0x124933);}};}function respondWithFilteredResult(_0x598ece,_0x5208b2){return function(_0x3f2b90){if(_0x3f2b90){var _0xcceaa=typeof _0x5208b2['offset']===_0x691c('0x2c')&&typeof _0x5208b2['limit']===_0x691c('0x2c');var _0x5071f9=_0x3f2b90[_0x691c('0x2d')];var _0x2cb3ab=_0xcceaa?0x0:_0x5208b2[_0x691c('0x2e')];var _0x5cebbd=_0xcceaa?_0x3f2b90['count']:_0x5208b2[_0x691c('0x2e')]+_0x5208b2[_0x691c('0x2f')];var _0x203e2e;if(_0x5cebbd>=_0x5071f9){_0x5cebbd=_0x5071f9;_0x203e2e=0xc8;}else{_0x203e2e=0xce;}_0x598ece[_0x691c('0x29')](_0x203e2e);return _0x598ece[_0x691c('0x30')](_0x691c('0x31'),_0x2cb3ab+'-'+_0x5cebbd+'/'+_0x5071f9)[_0x691c('0x2b')](_0x3f2b90);}return null;};}function patchUpdates(_0x5b1259){return function(_0x266286){try{jsonpatch[_0x691c('0x32')](_0x266286,_0x5b1259,!![]);}catch(_0x47c460){return BPromise[_0x691c('0x33')](_0x47c460);}return _0x266286[_0x691c('0x34')]();};}function saveUpdates(_0x26dcc4,_0x4367cc){return function(_0x47f73c){if(_0x47f73c){return _0x47f73c[_0x691c('0x35')](_0x26dcc4)[_0x691c('0x1f')](function(_0x41974c){return _0x41974c;});}return null;};}function removeEntity(_0x4a900e,_0x2b8d12){return function(_0x37a7da){if(_0x37a7da){return _0x37a7da[_0x691c('0x36')]()[_0x691c('0x1f')](function(){var _0x278f65=_0x37a7da['get']({'plain':!![]});var _0x184449=_0x691c('0x37');return db[_0x691c('0x38')][_0x691c('0x36')]({'where':{'type':_0x184449,'resourceId':_0x278f65['id']}})[_0x691c('0x1f')](function(){return _0x37a7da;});})[_0x691c('0x1f')](function(){_0x4a900e['status'](0xcc)[_0x691c('0x2a')]();});}};}function handleEntityNotFound(_0x483e54,_0x4b28d5){return function(_0x9e5670){if(!_0x9e5670){_0x483e54[_0x691c('0x28')](0x194);}return _0x9e5670;};}function handleError(_0x230274,_0x187d9b){_0x187d9b=_0x187d9b||0x1f4;return function(_0x523875){logger[_0x691c('0x23')](_0x523875[_0x691c('0x39')]);if(_0x523875[_0x691c('0x3a')]){delete _0x523875[_0x691c('0x3a')];}_0x230274[_0x691c('0x29')](_0x187d9b)[_0x691c('0x3b')](_0x523875);};}exports[_0x691c('0x3c')]=function(_0x2c2cc4,_0x9ca616){var _0x790e98={'include':[{'model':db[_0x691c('0x3d')],'as':_0x691c('0x3e')}]},_0x7dd2c3={},_0x535544={'count':0x0,'rows':[]};var _0x515aa2=_['map'](db[_0x691c('0x3f')][_0x691c('0x40')],function(_0x373a92){return{'name':_0x373a92[_0x691c('0x41')],'type':_0x373a92[_0x691c('0x42')][_0x691c('0x43')]};});_0x7dd2c3[_0x691c('0x44')]=_[_0x691c('0x45')](_0x515aa2,_0x691c('0x3a'));_0x7dd2c3[_0x691c('0x46')]=_['keys'](_0x2c2cc4[_0x691c('0x46')]);_0x7dd2c3[_0x691c('0x47')]=_[_0x691c('0x48')](_0x7dd2c3[_0x691c('0x44')],_0x7dd2c3[_0x691c('0x46')]);_0x790e98[_0x691c('0x49')]=_[_0x691c('0x48')](_0x7dd2c3[_0x691c('0x44')],qs[_0x691c('0x4a')](_0x2c2cc4[_0x691c('0x46')][_0x691c('0x4a')]));_0x790e98[_0x691c('0x49')]=_0x790e98[_0x691c('0x49')][_0x691c('0x4b')]?_0x790e98[_0x691c('0x49')]:_0x7dd2c3[_0x691c('0x44')];if(!_0x2c2cc4['query'][_0x691c('0x4c')](_0x691c('0x4d'))){_0x790e98['limit']=qs[_0x691c('0x2f')](_0x2c2cc4[_0x691c('0x46')][_0x691c('0x2f')]);_0x790e98[_0x691c('0x2e')]=qs[_0x691c('0x2e')](_0x2c2cc4['query'][_0x691c('0x2e')]);}_0x790e98[_0x691c('0x4e')]=qs['sort'](_0x2c2cc4[_0x691c('0x46')][_0x691c('0x4f')]);_0x790e98[_0x691c('0x50')]=qs['filters'](_[_0x691c('0x51')](_0x2c2cc4[_0x691c('0x46')],_0x7dd2c3[_0x691c('0x47')]),_0x515aa2);if(_0x2c2cc4[_0x691c('0x46')][_0x691c('0x52')]){_0x790e98[_0x691c('0x50')]=_[_0x691c('0x53')](_0x790e98['where'],{'$or':_[_0x691c('0x45')](_0x515aa2,function(_0x137624){if(_0x137624[_0x691c('0x42')]!==_0x691c('0x54')){var _0x41b361={};_0x41b361[_0x137624[_0x691c('0x3a')]]={'$like':'%'+_0x2c2cc4[_0x691c('0x46')][_0x691c('0x52')]+'%'};return _0x41b361;}})});}_0x790e98=_['merge']({},_0x790e98,_0x2c2cc4[_0x691c('0x55')]);var _0x27feef={'where':_0x790e98[_0x691c('0x50')]};return db[_0x691c('0x3f')][_0x691c('0x2d')](_0x27feef)['then'](function(_0x55f3b7){_0x535544[_0x691c('0x2d')]=_0x55f3b7;if(_0x2c2cc4['query'][_0x691c('0x56')]){_0x790e98[_0x691c('0x57')]=[{'all':!![]}];}return db[_0x691c('0x3f')][_0x691c('0x58')](_0x790e98);})['then'](function(_0x4062f5){_0x535544[_0x691c('0x59')]=_0x4062f5;return _0x535544;})[_0x691c('0x1f')](respondWithFilteredResult(_0x9ca616,_0x790e98))[_0x691c('0x27')](handleError(_0x9ca616,null));};exports[_0x691c('0x5a')]=function(_0x1d7655,_0x26421b){var _0x19a471={'raw':![],'where':{'id':_0x1d7655[_0x691c('0x5b')]['id']},'include':[{'model':db[_0x691c('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5593ce={};_0x5593ce[_0x691c('0x44')]=_[_0x691c('0x5c')](db['OpenchannelAccount'][_0x691c('0x40')]);_0x5593ce['query']=_[_0x691c('0x5c')](_0x1d7655[_0x691c('0x46')]);_0x5593ce[_0x691c('0x47')]=_[_0x691c('0x48')](_0x5593ce['model'],_0x5593ce[_0x691c('0x46')]);_0x19a471[_0x691c('0x49')]=_[_0x691c('0x48')](_0x5593ce['model'],qs[_0x691c('0x4a')](_0x1d7655[_0x691c('0x46')][_0x691c('0x4a')]));_0x19a471[_0x691c('0x49')]=_0x19a471[_0x691c('0x49')][_0x691c('0x4b')]?_0x19a471[_0x691c('0x49')]:_0x5593ce['model'];if(_0x1d7655[_0x691c('0x46')][_0x691c('0x56')]){_0x19a471[_0x691c('0x57')]=[{'all':!![]}];}_0x19a471=_[_0x691c('0x53')]({},_0x19a471,_0x1d7655[_0x691c('0x55')]);return db[_0x691c('0x3f')][_0x691c('0x5d')](_0x19a471)[_0x691c('0x1f')](handleEntityNotFound(_0x26421b,null))[_0x691c('0x1f')](respondWithResult(_0x26421b,null))[_0x691c('0x27')](handleError(_0x26421b,null));};exports['create']=function(_0xb64567,_0x54a816){return db[_0x691c('0x3f')][_0x691c('0x5e')](_0xb64567['body'],{})['then'](function(_0x218a16){var _0x383b7f=_0xb64567[_0x691c('0x5f')][_0x691c('0x60')]({'plain':!![]});if(!_0x383b7f)throw new Error(_0x691c('0x61'));if(_0x383b7f[_0x691c('0x62')]===_0x691c('0x5f')){var _0x42a076=_0x218a16['get']({'plain':!![]});var _0x5ba8a7='OpenchannelAccounts';return db[_0x691c('0x63')][_0x691c('0x5d')]({'where':{'name':_0x5ba8a7,'userProfileId':_0x383b7f['userProfileId']},'raw':!![]})['then'](function(_0x104e29){if(_0x104e29&&_0x104e29[_0x691c('0x64')]===0x0){return db[_0x691c('0x38')]['create']({'name':_0x42a076[_0x691c('0x3a')],'resourceId':_0x42a076['id'],'type':_0x104e29[_0x691c('0x3a')],'sectionId':_0x104e29['id']},{})[_0x691c('0x1f')](function(){return _0x218a16;});}else{return _0x218a16;}})['catch'](function(_0xfab472){logger[_0x691c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfab472);throw _0xfab472;});}return _0x218a16;})[_0x691c('0x1f')](respondWithResult(_0x54a816,0xc9))[_0x691c('0x27')](handleError(_0x54a816,null));};exports[_0x691c('0x35')]=function(_0x1cedd6,_0x2be40f){if(_0x1cedd6[_0x691c('0x65')]['id']){delete _0x1cedd6[_0x691c('0x65')]['id'];}return db['OpenchannelAccount'][_0x691c('0x5d')]({'where':{'id':_0x1cedd6[_0x691c('0x5b')]['id']},'include':[{'model':db[_0x691c('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2be40f,null))[_0x691c('0x1f')](saveUpdates(_0x1cedd6[_0x691c('0x65')],null))[_0x691c('0x1f')](respondWithResult(_0x2be40f,null))['catch'](handleError(_0x2be40f,null));};exports[_0x691c('0x36')]=function(_0x5bf20c,_0x19a50e){return db[_0x691c('0x3f')][_0x691c('0x5d')]({'where':{'id':_0x5bf20c[_0x691c('0x5b')]['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x19a50e,null))['then'](removeEntity(_0x19a50e,null))[_0x691c('0x27')](handleError(_0x19a50e,null));};exports[_0x691c('0x66')]=function(_0x41fc7f,_0x3375fb){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x3375fb,null))[_0x691c('0x27')](handleError(_0x3375fb,null));};exports[_0x691c('0x67')]=function(_0x488eeb,_0x3892b7,_0x54ea24){if(_0x488eeb['body']['id']){delete _0x488eeb['body']['id'];}return db['OpenchannelAccount'][_0x691c('0x5d')]({'where':{'id':_0x488eeb[_0x691c('0x5b')]['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x3892b7,null))[_0x691c('0x1f')](function(_0x32b722){if(_0x32b722){_0x488eeb[_0x691c('0x65')][_0x691c('0x68')]=_0x32b722['id'];return db['Disposition'][_0x691c('0x5e')](_0x488eeb['body']);}})['then'](respondWithResult(_0x3892b7,null))[_0x691c('0x27')](handleError(_0x3892b7,null));};exports[_0x691c('0x69')]=function(_0x35192f,_0x5ae5f7,_0x20ab3d){var _0x81a2e8={'raw':![],'where':{}};var _0x1afef1={};var _0x3ab038={'count':0x0,'rows':[]};return db[_0x691c('0x3f')][_0x691c('0x6a')]({'where':{'id':_0x35192f[_0x691c('0x5b')]['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x5ae5f7,null))[_0x691c('0x1f')](function(_0x41d2d7){if(_0x41d2d7){_0x1afef1[_0x691c('0x44')]=_[_0x691c('0x5c')](db[_0x691c('0x6b')]['rawAttributes']);_0x1afef1[_0x691c('0x46')]=_[_0x691c('0x5c')](_0x35192f[_0x691c('0x46')]);_0x1afef1[_0x691c('0x47')]=_[_0x691c('0x48')](_0x1afef1[_0x691c('0x44')],_0x1afef1[_0x691c('0x46')]);_0x81a2e8[_0x691c('0x49')]=_[_0x691c('0x48')](_0x1afef1[_0x691c('0x44')],qs[_0x691c('0x4a')](_0x35192f[_0x691c('0x46')]['fields']));_0x81a2e8[_0x691c('0x49')]=_0x81a2e8[_0x691c('0x49')][_0x691c('0x4b')]?_0x81a2e8['attributes']:_0x1afef1[_0x691c('0x44')];if(!_0x35192f['query'][_0x691c('0x4c')](_0x691c('0x4d'))){_0x81a2e8[_0x691c('0x2f')]=qs[_0x691c('0x2f')](_0x35192f['query']['limit']);_0x81a2e8['offset']=qs[_0x691c('0x2e')](_0x35192f[_0x691c('0x46')][_0x691c('0x2e')]);}_0x81a2e8[_0x691c('0x4e')]=qs['sort'](_0x35192f[_0x691c('0x46')]['sort']);_0x81a2e8[_0x691c('0x50')]=qs[_0x691c('0x47')](_[_0x691c('0x51')](_0x35192f[_0x691c('0x46')],_0x1afef1[_0x691c('0x47')]));_0x81a2e8[_0x691c('0x50')][_0x691c('0x68')]=_0x41d2d7['id'];if(_0x35192f['query'][_0x691c('0x52')]){_0x81a2e8[_0x691c('0x50')]=_[_0x691c('0x53')](_0x81a2e8['where'],{'$or':_['map'](_0x81a2e8['attributes'],function(_0x112dd7){var _0x401d3b={};_0x401d3b[_0x112dd7]={'$like':'%'+_0x35192f[_0x691c('0x46')][_0x691c('0x52')]+'%'};return _0x401d3b;})});}_0x81a2e8=_[_0x691c('0x53')]({},_0x81a2e8,_0x35192f[_0x691c('0x55')]);return db[_0x691c('0x6b')][_0x691c('0x2d')]({'where':_0x81a2e8[_0x691c('0x50')]})[_0x691c('0x1f')](function(_0x71b7a6){_0x3ab038[_0x691c('0x2d')]=_0x71b7a6;if(_0x35192f[_0x691c('0x46')]['includeAll']){_0x81a2e8[_0x691c('0x57')]=[{'all':!![]}];}return db[_0x691c('0x6b')][_0x691c('0x58')](_0x81a2e8);})[_0x691c('0x1f')](function(_0x3d21be){_0x3ab038[_0x691c('0x59')]=_0x3d21be;return _0x3ab038;});}})[_0x691c('0x1f')](respondWithFilteredResult(_0x5ae5f7,_0x81a2e8))[_0x691c('0x27')](handleError(_0x5ae5f7,null));};exports['removeDispositions']=function(_0x2dca71,_0x24ce9c,_0x28b92a){return db['OpenchannelAccount']['find']({'where':{'id':_0x2dca71['params']['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x24ce9c,null))['then'](function(_0x4c4a52){if(_0x4c4a52){return _0x4c4a52[_0x691c('0x6c')](_0x2dca71[_0x691c('0x46')][_0x691c('0x6d')]);}})[_0x691c('0x1f')](respondWithStatusCode(_0x24ce9c,null))[_0x691c('0x27')](handleError(_0x24ce9c,null));};exports[_0x691c('0x6e')]=function(_0x5ef00e,_0x32d2a6,_0xebeb27){if(_0x5ef00e[_0x691c('0x65')]['id']){delete _0x5ef00e[_0x691c('0x65')]['id'];}return db[_0x691c('0x3f')][_0x691c('0x5d')]({'where':{'id':_0x5ef00e[_0x691c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x32d2a6,null))[_0x691c('0x1f')](function(_0x4515ab){if(_0x4515ab){_0x5ef00e['body'][_0x691c('0x68')]=_0x4515ab['id'];return db['CannedAnswer'][_0x691c('0x5e')](_0x5ef00e[_0x691c('0x65')]);}})[_0x691c('0x1f')](respondWithResult(_0x32d2a6,null))[_0x691c('0x27')](handleError(_0x32d2a6,null));};exports['getAnswers']=function(_0x29ceba,_0x4b6123,_0x2ef5e2){var _0x5ab991={'raw':![],'where':{}};var _0x220a21={};var _0xf0db7c={'count':0x0,'rows':[]};return db[_0x691c('0x3f')][_0x691c('0x6a')]({'where':{'id':_0x29ceba[_0x691c('0x5b')]['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x4b6123,null))[_0x691c('0x1f')](function(_0x6eb5e1){if(_0x6eb5e1){_0x220a21[_0x691c('0x44')]=_[_0x691c('0x5c')](db[_0x691c('0x6f')]['rawAttributes']);_0x220a21['query']=_[_0x691c('0x5c')](_0x29ceba[_0x691c('0x46')]);_0x220a21['filters']=_['intersection'](_0x220a21['model'],_0x220a21[_0x691c('0x46')]);_0x5ab991[_0x691c('0x49')]=_['intersection'](_0x220a21['model'],qs[_0x691c('0x4a')](_0x29ceba[_0x691c('0x46')][_0x691c('0x4a')]));_0x5ab991['attributes']=_0x5ab991[_0x691c('0x49')]['length']?_0x5ab991[_0x691c('0x49')]:_0x220a21['model'];if(!_0x29ceba[_0x691c('0x46')][_0x691c('0x4c')](_0x691c('0x4d'))){_0x5ab991[_0x691c('0x2f')]=qs['limit'](_0x29ceba[_0x691c('0x46')]['limit']);_0x5ab991[_0x691c('0x2e')]=qs[_0x691c('0x2e')](_0x29ceba[_0x691c('0x46')][_0x691c('0x2e')]);}_0x5ab991[_0x691c('0x4e')]=qs[_0x691c('0x4f')](_0x29ceba[_0x691c('0x46')][_0x691c('0x4f')]);_0x5ab991[_0x691c('0x50')]=qs['filters'](_[_0x691c('0x51')](_0x29ceba[_0x691c('0x46')],_0x220a21['filters']));_0x5ab991['where'][_0x691c('0x68')]=_0x6eb5e1['id'];if(_0x29ceba[_0x691c('0x46')][_0x691c('0x52')]){_0x5ab991[_0x691c('0x50')]=_['merge'](_0x5ab991[_0x691c('0x50')],{'$or':_['map'](_0x5ab991['attributes'],function(_0x5cc174){var _0xeb2549={};_0xeb2549[_0x5cc174]={'$like':'%'+_0x29ceba['query'][_0x691c('0x52')]+'%'};return _0xeb2549;})});}_0x5ab991=_[_0x691c('0x53')]({},_0x5ab991,_0x29ceba[_0x691c('0x55')]);return db[_0x691c('0x6f')][_0x691c('0x2d')]({'where':_0x5ab991['where']})[_0x691c('0x1f')](function(_0x5e3d3d){_0xf0db7c[_0x691c('0x2d')]=_0x5e3d3d;if(_0x29ceba[_0x691c('0x46')][_0x691c('0x56')]){_0x5ab991[_0x691c('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x691c('0x58')](_0x5ab991);})[_0x691c('0x1f')](function(_0x1af44a){_0xf0db7c[_0x691c('0x59')]=_0x1af44a;return _0xf0db7c;});}})[_0x691c('0x1f')](respondWithFilteredResult(_0x4b6123,_0x5ab991))[_0x691c('0x27')](handleError(_0x4b6123,null));};exports[_0x691c('0x70')]=function(_0x3f56b0,_0x55eed3,_0x4829f3){return db[_0x691c('0x3f')][_0x691c('0x5d')]({'where':{'id':_0x3f56b0[_0x691c('0x5b')]['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x55eed3,null))[_0x691c('0x1f')](function(_0x234b50){if(_0x234b50){return _0x234b50[_0x691c('0x70')](_0x3f56b0[_0x691c('0x46')][_0x691c('0x6d')]);}})['then'](respondWithStatusCode(_0x55eed3,null))[_0x691c('0x27')](handleError(_0x55eed3,null));};exports[_0x691c('0x71')]=function(_0x306cf8,_0xd27c7,_0x2e3d8d){var _0x35636e={'body':_0x306cf8['body'],'channel':'openchannel'};var _0x18b061=[];var _0x25acd6=[];var _0x5ce4ef={};var _0x26c5d6=![];return db['CmContact'][_0x691c('0x66')]()[_0x691c('0x1f')](function(_0x1297e1){if(!_0x1297e1){throw new db[(_0x691c('0x72'))]['ValidationError']('no\x20available\x20attributes');}_0x18b061=_['difference'](_[_0x691c('0x5c')](_0x1297e1),[_0x691c('0x73'),_0x691c('0x74')]);_0x25acd6=_[_0x691c('0x75')](_[_0x691c('0x5c')](_0x1297e1),[_0x691c('0x73'),_0x691c('0x74'),_0x691c('0x76'),_0x691c('0x77')]);if(_0x306cf8[_0x691c('0x65')]['id']){delete _0x306cf8[_0x691c('0x65')]['id'];}if(_['isNil'](_0x306cf8[_0x691c('0x65')][_0x691c('0x78')])){throw new db[(_0x691c('0x72'))]['ValidationError'](_0x691c('0x79'));}if(_[_0x691c('0x7a')](_0x306cf8['body'][_0x691c('0x65')])||_0x306cf8[_0x691c('0x65')]['body']===''){throw new db[(_0x691c('0x72'))][(_0x691c('0x7b'))](_0x691c('0x7c'));}if(_['isNil'](_0x306cf8['body'][_0x691c('0x7d')])){throw new db[(_0x691c('0x72'))]['ValidationError'](_0x691c('0x7e')+_0x25acd6);}if(!_[_0x691c('0x7f')](_0x25acd6,_0x306cf8[_0x691c('0x65')][_0x691c('0x7d')])){throw new db[(_0x691c('0x72'))][(_0x691c('0x7b'))](_0x691c('0x80')+_0x25acd6);}_0x5ce4ef[_0x306cf8[_0x691c('0x65')][_0x691c('0x7d')]]=_0x306cf8['body']['from'];})['then'](function(){return db[_0x691c('0x3f')][_0x691c('0x5d')]({'where':{'id':_0x306cf8['params']['id']},'include':[{'model':db[_0x691c('0x81')],'as':_0x691c('0x82'),'include':[{'model':db[_0x691c('0x83')],'as':_0x691c('0x84'),'where':_0x5ce4ef,'limit':0x1,'order':[[_0x691c('0x74'),_0x691c('0x85')]]}]},{'model':db[_0x691c('0x86')],'as':_0x691c('0x87')}]});})[_0x691c('0x1f')](handleEntityNotFound(_0xd27c7,null))['then'](function(_0x575a07){if(_0x575a07&&_0x575a07['List']){_0x35636e[_0x691c('0x88')]=_0x575a07;_0x35636e['applications']=_0x575a07['Applications'];_0x35636e[_0x691c('0x89')]=_0x575a07['List'];_0x35636e[_0x691c('0x8a')]=_[_0x691c('0x8b')](_0x35636e[_0x691c('0x8a')],[_0x691c('0x8c')],[_0x691c('0x8d')]);if(_0x35636e['account']['Applications']){delete _0x35636e[_0x691c('0x88')]['Applications'];}if(_0x35636e[_0x691c('0x88')][_0x691c('0x82')]&&_0x35636e[_0x691c('0x88')][_0x691c('0x82')][_0x691c('0x84')][_0x691c('0x4b')]){return _0x35636e[_0x691c('0x88')][_0x691c('0x82')]['Contacts'][0x0];}var _0x522831=_['defaults'](_0x306cf8[_0x691c('0x65')],{'firstName':_0x306cf8['body']['from'],'ListId':_0x575a07[_0x691c('0x77')]});_0x522831[_0x306cf8[_0x691c('0x65')][_0x691c('0x7d')]]=_0x306cf8[_0x691c('0x65')][_0x691c('0x78')];return db[_0x691c('0x83')][_0x691c('0x5e')](_0x522831,{'fields':_0x18b061,'raw':!![]});}})[_0x691c('0x1f')](handleEntityNotFound(_0xd27c7,null))[_0x691c('0x1f')](function(_0x4de73d){_0x35636e[_0x691c('0x8e')]=_0x4de73d;if(_0x4de73d){var _0x2b3364={'ContactId':_0x4de73d['id'],'OpenchannelAccountId':_0x306cf8['params']['id'],'from':(_0x4de73d[_0x691c('0x8f')]||'')+'\x20'+(_0x4de73d[_0x691c('0x90')]||'')};var _0x3180e5={'OpenchannelAccountId':_0x306cf8[_0x691c('0x5b')]['id'],'closed':![]};if(_0x306cf8[_0x691c('0x65')]['threadId']){_0x3180e5[_0x691c('0x91')]=_0x306cf8['body']['threadId'];return db[_0x691c('0x92')]['find']({'where':_0x3180e5})['then'](function(_0xfc9dd3){if(_0xfc9dd3){return[_0xfc9dd3,![]];}_0x2b3364[_0x691c('0x91')]=_0x306cf8[_0x691c('0x65')]['threadId'];_0x2b3364[_0x691c('0x93')]=_0x306cf8['body'][_0x691c('0x93')];return db['OpenchannelInteraction'][_0x691c('0x5e')](_0x2b3364)[_0x691c('0x1f')](function(_0x1ec92f){return[_0x1ec92f,!![]];});});}else{_0x3180e5[_0x691c('0x91')]=null;}_0x3180e5['ContactId']=_0x4de73d['id'];return db[_0x691c('0x92')][_0x691c('0x5d')]({'where':_0x3180e5})[_0x691c('0x1f')](function(_0x399f6b){if(_0x399f6b){return[_0x399f6b,![]];}return db['OpenchannelInteraction'][_0x691c('0x5e')](_0x2b3364)[_0x691c('0x1f')](function(_0x4f4955){return[_0x4f4955,!![]];});});}})[_0x691c('0x94')](function(_0xaf45a3,_0x12ddcb){if(_0xaf45a3){_0x26c5d6=_0x12ddcb;if(!_0x12ddcb){var _0x50ebda={'from':(_0x35636e[_0x691c('0x8e')]['firstName']||'')+'\x20'+(_0x35636e[_0x691c('0x8e')][_0x691c('0x90')]||'')};if(_0x306cf8['body']['threadId']&&_0x306cf8[_0x691c('0x65')][_0x691c('0x95')]&&_0x306cf8[_0x691c('0x65')][_0x691c('0x91')]!=_0x306cf8['body']['messageId']){_0x50ebda[_0x691c('0x91')]=_0x306cf8[_0x691c('0x65')][_0x691c('0x95')];}return _0xaf45a3[_0x691c('0x35')](_0x50ebda);}else{return _0xaf45a3;}}})[_0x691c('0x1f')](function(_0x2cac15){_0x35636e[_0x691c('0x96')]=_0x2cac15[_0x691c('0x60')]({'plain':!![]});_0x35636e['interaction'][_0x691c('0x97')]=_0x26c5d6;if(_0x35636e['interaction']['created']){if(_0x35636e[_0x691c('0x88')][_0x691c('0x98')]){_0x35636e[_0x691c('0x8a')]['push']({'id':0x0,'priority':_0x35636e['applications']['length']+0x1,'app':_0x691c('0x99'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x691c('0x9a')][_0x691c('0x5e')]({'body':_0x306cf8[_0x691c('0x65')][_0x691c('0x65')],'OpenchannelAccountId':_0x306cf8[_0x691c('0x5b')]['id'],'OpenchannelInteractionId':_0x2cac15['id'],'direction':'in','ContactId':_0x35636e[_0x691c('0x8e')]['id'],'AttachmentId':_0x306cf8['body'][_0x691c('0x9b')]});})[_0x691c('0x1f')](function(_0x1903ae){_0x35636e[_0x691c('0x24')]=_0x1903ae;if(!_0x35636e[_0x691c('0x96')][_0x691c('0x9c')])return;return db['User'][_0x691c('0x5d')]({'attributes':['id',_0x691c('0x3a')],'where':{'id':_0x35636e[_0x691c('0x96')][_0x691c('0x9c')]}});})[_0x691c('0x1f')](function(_0x347e14){if(_0x347e14){_0x35636e['applications'][_0x691c('0x9d')]({'id':0x0,'priority':0x0,'app':_0x691c('0x9e'),'appdata':_0x347e14[_0x691c('0x3a')]+','+(_0x35636e[_0x691c('0x88')][_0x691c('0x9f')]||0xa),'interval':_0x691c('0xa0')});}if(!_0x35636e[_0x691c('0x96')][_0x691c('0xa1')])return;return db[_0x691c('0xa2')][_0x691c('0x5d')]({'attributes':['id',_0x691c('0x3a')],'where':{'id':_0x35636e['interaction']['queueId']}});})['then'](function(_0x116553){if(_0x116553){_0x35636e['applications'][_0x691c('0x9d')]({'id':0x0,'priority':0x1,'app':_0x691c('0xa3'),'appdata':_0x116553[_0x691c('0x3a')]+','+(_0x35636e[_0x691c('0x88')][_0x691c('0xa4')]||0x12c),'interval':_0x691c('0xa0')});}return respondWithRpcPromise('Start',_0x691c('0xa5'),_0x35636e);})[_0x691c('0x1f')](function(_0x4ef111){respondWithRpcPromise('EventManager',_0x691c('0xa6'),{'event':_0x691c('0x71'),'message':_0x4ef111},client9002);return _0x4ef111;})['then'](respondWithResult(_0xd27c7,null))[_0x691c('0x27')](handleError(_0xd27c7,null));};exports[_0x691c('0xa7')]=function(_0x1c6d93,_0x560833){var _0xb15935=_0x1c6d93[_0x691c('0x5b')]['id'];var _0x5e7cc4=_0x1c6d93[_0x691c('0x65')];var _0x111f51=0xc8;var _0x1568f6=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x691c('0xa8')]['Transaction'][_0x691c('0xa9')][_0x691c('0xaa')]},function(_0xbdc4e){return db[_0x691c('0x3f')]['findOne']({'where':{'id':_0xb15935},'transaction':_0xbdc4e})[_0x691c('0x1f')](function(_0x315e73){if(_0x315e73){return db[_0x691c('0x86')][_0x691c('0x36')]({'where':{'OpenchannelAccountId':_0xb15935},'transaction':_0xbdc4e})[_0x691c('0x1f')](function(){var _0x359ce2=_[_0x691c('0x45')](_0x5e7cc4,function(_0x49651a){_0x49651a[_0x691c('0x68')]=_0xb15935;return _0x49651a;});return db[_0x691c('0x86')][_0x691c('0xab')](_0x359ce2,{'transaction':_0xbdc4e});});}else{_0x111f51=0x194;_0x1568f6=[];}});})[_0x691c('0x1f')](function(){if(_0x111f51!==0x194){return db[_0x691c('0x86')][_0x691c('0xac')]({'where':{'OpenchannelAccountId':_0xb15935},'order':'priority'})[_0x691c('0x1f')](function(_0x3a94d1){_0x1568f6=_0x3a94d1;});}})[_0x691c('0x27')](function(_0x473566){_0x111f51=0x1f4;logger[_0x691c('0x23')](_0x473566['stack']);if(_0x473566[_0x691c('0x3a')]){delete _0x473566[_0x691c('0x3a')];}_0x1568f6=_0x473566;})['finally'](function(){if(_0x1568f6===null){_0x560833['sendStatus'](_0x111f51);}else{if(_0x111f51===0x1f4){_0x560833[_0x691c('0x29')](_0x111f51)[_0x691c('0x3b')](_0x1568f6);}else{_0x560833[_0x691c('0x29')](_0x111f51)[_0x691c('0x2b')](_0x1568f6);}}});};exports[_0x691c('0xad')]=function(_0x323105,_0x3195fc,_0x21d48a){var _0x1da800={};var _0x5480e1={};var _0x40dbbb;var _0x1fc2f5;return db[_0x691c('0x3f')]['findOne']({'where':{'id':_0x323105[_0x691c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3195fc,null))[_0x691c('0x1f')](function(_0x4d88af){if(_0x4d88af){_0x40dbbb=_0x4d88af;_0x5480e1['model']=_[_0x691c('0x5c')](db[_0x691c('0x86')][_0x691c('0x40')]);_0x5480e1[_0x691c('0x46')]=_['keys'](_0x323105[_0x691c('0x46')]);_0x5480e1[_0x691c('0x47')]=_[_0x691c('0x48')](_0x5480e1['model'],_0x5480e1['query']);_0x1da800[_0x691c('0x49')]=_['intersection'](_0x5480e1['model'],qs['fields'](_0x323105[_0x691c('0x46')][_0x691c('0x4a')]));_0x1da800[_0x691c('0x49')]=_0x1da800[_0x691c('0x49')][_0x691c('0x4b')]?_0x1da800[_0x691c('0x49')]:_0x5480e1[_0x691c('0x44')];_0x1da800['order']=qs[_0x691c('0x4f')](_0x323105['query'][_0x691c('0x4f')]);_0x1da800['where']=qs['filters'](_[_0x691c('0x51')](_0x323105['query'],_0x5480e1['filters']));if(_0x323105[_0x691c('0x46')][_0x691c('0x52')]){_0x1da800['where']=_['merge'](_0x1da800[_0x691c('0x50')],{'$or':_['map'](_0x1da800[_0x691c('0x49')],function(_0x2d1d82){var _0x435f89={};_0x435f89[_0x2d1d82]={'$like':'%'+_0x323105[_0x691c('0x46')][_0x691c('0x52')]+'%'};return _0x435f89;})});}_0x1da800=_[_0x691c('0x53')]({},_0x1da800,_0x323105[_0x691c('0x55')]);return _0x40dbbb[_0x691c('0xad')](_0x1da800);}})[_0x691c('0x1f')](function(_0x18ad3d){if(_0x18ad3d){_0x1fc2f5=_0x18ad3d[_0x691c('0x4b')];if(!_0x323105[_0x691c('0x46')][_0x691c('0x4c')](_0x691c('0x4d'))){_0x1da800[_0x691c('0x2f')]=qs[_0x691c('0x2f')](_0x323105['query'][_0x691c('0x2f')]);_0x1da800[_0x691c('0x2e')]=qs[_0x691c('0x2e')](_0x323105[_0x691c('0x46')][_0x691c('0x2e')]);}return _0x40dbbb[_0x691c('0xad')](_0x1da800);}})['then'](function(_0x474223){if(_0x474223){return _0x474223?{'count':_0x1fc2f5,'rows':_0x474223}:null;}})['then'](respondWithResult(_0x3195fc,null))[_0x691c('0x27')](handleError(_0x3195fc,null));};exports[_0x691c('0xae')]=function(_0x21496b,_0x290aee,_0x505d53){var _0x4d1561={'raw':![],'where':{}};var _0x526df2={};var _0x391485={'count':0x0,'rows':[]};return db[_0x691c('0x3f')][_0x691c('0x6a')]({'where':{'id':_0x21496b['params']['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x290aee,null))[_0x691c('0x1f')](function(_0x238fd3){if(_0x238fd3){_0x526df2[_0x691c('0x44')]=_[_0x691c('0x5c')](db[_0x691c('0x92')][_0x691c('0x40')]);_0x526df2[_0x691c('0x46')]=_['keys'](_0x21496b['query']);_0x526df2[_0x691c('0x47')]=_['intersection'](_0x526df2[_0x691c('0x44')],_0x526df2[_0x691c('0x46')]);_0x4d1561[_0x691c('0x49')]=_[_0x691c('0x48')](_0x526df2[_0x691c('0x44')],qs['fields'](_0x21496b[_0x691c('0x46')]['fields']));_0x4d1561[_0x691c('0x49')]=_0x4d1561['attributes'][_0x691c('0x4b')]?_0x4d1561[_0x691c('0x49')]:_0x526df2[_0x691c('0x44')];if(!_0x21496b['query'][_0x691c('0x4c')](_0x691c('0x4d'))){_0x4d1561['limit']=qs['limit'](_0x21496b[_0x691c('0x46')][_0x691c('0x2f')]);_0x4d1561[_0x691c('0x2e')]=qs[_0x691c('0x2e')](_0x21496b[_0x691c('0x46')]['offset']);}_0x4d1561[_0x691c('0x4e')]=qs['sort'](_0x21496b[_0x691c('0x46')][_0x691c('0x4f')]);_0x4d1561[_0x691c('0x50')]=qs[_0x691c('0x47')](_[_0x691c('0x51')](_0x21496b[_0x691c('0x46')],_0x526df2[_0x691c('0x47')]));_0x4d1561[_0x691c('0x50')]['OpenchannelAccountId']=_0x238fd3['id'];if(_0x21496b[_0x691c('0x46')]['filter']){_0x4d1561[_0x691c('0x50')]=_[_0x691c('0x53')](_0x4d1561['where'],{'$or':_['map'](_0x4d1561['attributes'],function(_0x28c87c){var _0x15a596={};_0x15a596[_0x28c87c]={'$like':'%'+_0x21496b[_0x691c('0x46')]['filter']+'%'};return _0x15a596;})});}_0x4d1561=_[_0x691c('0x53')]({},_0x4d1561,_0x21496b[_0x691c('0x55')]);return db['OpenchannelInteraction'][_0x691c('0x2d')]({'where':_0x4d1561['where']})['then'](function(_0x589951){_0x391485[_0x691c('0x2d')]=_0x589951;if(_0x21496b[_0x691c('0x46')][_0x691c('0x56')]){_0x4d1561['include']=[{'model':db[_0x691c('0x83')],'as':_0x691c('0xaf'),'required':![]},{'model':db[_0x691c('0xb0')],'as':'Owner','attributes':[_0x691c('0x3a'),_0x691c('0xb1'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x691c('0xb2'),'attributes':['id',_0x691c('0x3a'),_0x691c('0xb3')],'where':_0x21496b['query'][_0x691c('0xb4')]?{'id':_0x21496b[_0x691c('0x46')][_0x691c('0xb4')]}:undefined,'required':_0x21496b[_0x691c('0x46')][_0x691c('0xb4')]?!![]:![]}];}return db[_0x691c('0x92')][_0x691c('0x58')](_0x4d1561);})[_0x691c('0x1f')](function(_0x18830c){_0x391485['rows']=_0x18830c;return _0x391485;});}})[_0x691c('0x1f')](respondWithFilteredResult(_0x290aee,_0x4d1561))['catch'](handleError(_0x290aee,null));};exports[_0x691c('0xb5')]=function(_0x122782,_0x288faf,_0x5de687){return db[_0x691c('0x3f')]['find']({'where':{'id':_0x122782[_0x691c('0x5b')]['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x288faf,null))[_0x691c('0x1f')](function(_0x148c49){if(_0x148c49){return _0x148c49[_0x691c('0xb5')](_0x122782[_0x691c('0x65')][_0x691c('0x6d')],_['omit'](_0x122782[_0x691c('0x65')],[_0x691c('0x6d'),'id'])||{})[_0x691c('0x94')](function(_0x3dfeb8){for(var _0x42abfa=0x0;_0x42abfa<_0x122782[_0x691c('0x65')]['ids'][_0x691c('0x4b')];_0x42abfa+=0x1){socket[_0x691c('0xb6')](_0x691c('0xb7'),{'UserId':Number(_0x122782[_0x691c('0x65')][_0x691c('0x6d')][_0x42abfa]),'OpenchannelAccountId':Number(_0x122782[_0x691c('0x5b')]['id'])});}return _0x3dfeb8;});}})[_0x691c('0x1f')](respondWithResult(_0x288faf,null))[_0x691c('0x27')](handleError(_0x288faf,null));};exports['removeAgents']=function(_0x2d501f,_0x42e58b,_0x27f84e){return db[_0x691c('0x3f')][_0x691c('0x5d')]({'where':{'id':_0x2d501f['params']['id']}})['then'](handleEntityNotFound(_0x42e58b,null))[_0x691c('0x1f')](function(_0x391ce0){if(_0x391ce0){return _0x391ce0[_0x691c('0xb8')](_0x2d501f[_0x691c('0x46')]['ids'])[_0x691c('0x1f')](function(){if(_[_0x691c('0xb9')](_0x2d501f[_0x691c('0x46')][_0x691c('0x6d')])){for(var _0x43ec29=0x0;_0x43ec29<_0x2d501f[_0x691c('0x46')]['ids']['length'];_0x43ec29+=0x1){socket['emit'](_0x691c('0xba'),{'UserId':Number(_0x2d501f[_0x691c('0x46')][_0x691c('0x6d')][_0x43ec29]),'OpenchannelAccountId':Number(_0x2d501f[_0x691c('0x5b')]['id'])});}}else{socket[_0x691c('0xb6')](_0x691c('0xba'),{'UserId':Number(_0x2d501f[_0x691c('0x46')][_0x691c('0x6d')]),'OpenchannelAccountId':Number(_0x2d501f['params']['id'])});}});}})[_0x691c('0x1f')](respondWithStatusCode(_0x42e58b,null))[_0x691c('0x27')](handleError(_0x42e58b,null));};exports[_0x691c('0xbb')]=function(_0x2cce23,_0x111c9e,_0x38c2de){var _0x2f20a0={};var _0x887fa9={};var _0x41c2ea;var _0x74ba80;return db[_0x691c('0x3f')][_0x691c('0x6a')]({'where':{'id':_0x2cce23[_0x691c('0x5b')]['id']}})[_0x691c('0x1f')](handleEntityNotFound(_0x111c9e,null))[_0x691c('0x1f')](function(_0x47457e){if(_0x47457e){_0x41c2ea=_0x47457e;_0x887fa9[_0x691c('0x44')]=_[_0x691c('0x5c')](db[_0x691c('0xb0')][_0x691c('0x40')]);_0x887fa9[_0x691c('0x46')]=_[_0x691c('0x5c')](_0x2cce23[_0x691c('0x46')]);_0x887fa9[_0x691c('0x47')]=_[_0x691c('0x48')](_0x887fa9[_0x691c('0x44')],_0x887fa9['query']);_0x2f20a0[_0x691c('0x49')]=_['intersection'](_0x887fa9[_0x691c('0x44')],qs[_0x691c('0x4a')](_0x2cce23['query'][_0x691c('0x4a')]));_0x2f20a0[_0x691c('0x49')]=_0x2f20a0[_0x691c('0x49')]['length']?_0x2f20a0[_0x691c('0x49')]:_0x887fa9[_0x691c('0x44')];_0x2f20a0[_0x691c('0x4e')]=qs[_0x691c('0x4f')](_0x2cce23[_0x691c('0x46')]['sort']);_0x2f20a0[_0x691c('0x50')]=qs[_0x691c('0x47')](_[_0x691c('0x51')](_0x2cce23['query'],_0x887fa9[_0x691c('0x47')]));if(_0x2cce23[_0x691c('0x46')][_0x691c('0x52')]){_0x2f20a0[_0x691c('0x50')]=_[_0x691c('0x53')](_0x2f20a0[_0x691c('0x50')],{'$or':_['map'](_0x2f20a0[_0x691c('0x49')],function(_0x100a40){var _0x5999fc={};_0x5999fc[_0x100a40]={'$like':'%'+_0x2cce23['query']['filter']+'%'};return _0x5999fc;})});}_0x2f20a0=_[_0x691c('0x53')]({},_0x2f20a0,_0x2cce23['options']);return _0x41c2ea['getAgents'](_0x2f20a0);}})[_0x691c('0x1f')](function(_0x488cb1){if(_0x488cb1){_0x74ba80=_0x488cb1['length'];if(!_0x2cce23[_0x691c('0x46')]['hasOwnProperty'](_0x691c('0x4d'))){_0x2f20a0[_0x691c('0x2f')]=qs[_0x691c('0x2f')](_0x2cce23[_0x691c('0x46')][_0x691c('0x2f')]);_0x2f20a0[_0x691c('0x2e')]=qs[_0x691c('0x2e')](_0x2cce23[_0x691c('0x46')][_0x691c('0x2e')]);}return _0x41c2ea[_0x691c('0xbb')](_0x2f20a0);}})['then'](function(_0x3abd76){if(_0x3abd76){return _0x3abd76?{'count':_0x74ba80,'rows':_0x3abd76}:null;}})[_0x691c('0x1f')](respondWithResult(_0x111c9e,null))[_0x691c('0x27')](handleError(_0x111c9e,null));};exports['send']=function(_0x27b163,_0x33267c,_0x339162){var _0x10f1d5,_0x43dc40,_0x39f6e0;if(_[_0x691c('0x7a')](_0x27b163[_0x691c('0x65')][_0x691c('0x65')])||_0x27b163[_0x691c('0x65')][_0x691c('0x65')]===''){throw new db[(_0x691c('0x72'))]['ValidationError'](_0x691c('0x7c'));}if(_[_0x691c('0x7a')](_0x27b163[_0x691c('0x65')]['to'])){}_0x10f1d5=_0x27b163[_0x691c('0x65')]['to'];return db[_0x691c('0x3f')][_0x691c('0x6a')]({'where':{'id':_0x27b163[_0x691c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x33267c,null))['then'](function(_0x1fe2b4){if(_0x1fe2b4){return db[_0x691c('0x3f')][_0x691c('0x5d')]({'where':{'id':_0x1fe2b4['id']},'include':[{'model':db[_0x691c('0x81')],'as':_0x691c('0x82'),'include':[{'model':db[_0x691c('0x83')],'as':_0x691c('0x84'),'where':{[_0x1fe2b4[_0x691c('0x7d')]]:_0x10f1d5},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x33267c,null))['then'](function(_0x215e9d){if(_0x215e9d&&_0x215e9d['List']){_0x43dc40=_0x215e9d[_0x691c('0x60')]({'plain':!![]});if(_0x43dc40[_0x691c('0x82')]&&_0x43dc40[_0x691c('0x82')][_0x691c('0x84')][_0x691c('0x4b')]){return _0x43dc40[_0x691c('0x82')][_0x691c('0x84')][0x0];}return db[_0x691c('0x83')][_0x691c('0x5e')](_['defaults'](_0x27b163[_0x691c('0x65')],{'firstName':_0x10f1d5,[_0x215e9d[_0x691c('0x7d')]]:_0x10f1d5,'phone':_0x10f1d5,'ListId':_0x43dc40[_0x691c('0x77')]}));}})['then'](handleEntityNotFound(_0x33267c,null))[_0x691c('0x1f')](function(_0x312545){if(_0x312545){_0x39f6e0=_0x312545;return db['OpenchannelInteraction'][_0x691c('0x5d')]({'where':{'ContactId':_0x39f6e0['id'],'closed':![],'OpenchannelAccountId':_0x43dc40['id']}})[_0x691c('0x1f')](function(_0x23057e){if(_0x23057e){return[_0x23057e,![]];}return db[_0x691c('0x92')]['create']({'UserId':_0x27b163[_0x691c('0x5f')]['id'],'ContactId':_0x39f6e0['id'],'OpenchannelAccountId':_0x43dc40['id'],'lastMsgDirection':_0x691c('0xbc'),'firstMsgDirection':'out','Messages':[_[_0x691c('0x53')](_0x27b163[_0x691c('0x65')],{'read':![],'body':_0x27b163[_0x691c('0x65')][_0x691c('0x65')],'OpenchannelAccountId':_0x43dc40['id'],'UserId':_0x27b163[_0x691c('0x5f')]['id'],'ContactId':_0x39f6e0['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x691c('0xbd')}]})[_0x691c('0x1f')](function(_0x4afcf2){return[_0x4afcf2,!![]];});});}})[_0x691c('0x94')](function(_0x509d68,_0x444e39){if(_0x444e39){return _0x509d68;}return db['OpenchannelMessage'][_0x691c('0x5e')](_['merge'](_0x27b163[_0x691c('0x65')],{'read':![],'body':_0x27b163[_0x691c('0x65')][_0x691c('0x65')],'OpenchannelAccountId':_0x43dc40['id'],'OpenchannelInteractionId':_0x509d68['id'],'UserId':_0x27b163[_0x691c('0x5f')]['id'],'ContactId':_0x39f6e0['id']}))[_0x691c('0x1f')](function(_0x1abf6a){_0x509d68[_0x691c('0xbe')]['Messages']=[];_0x509d68[_0x691c('0xbe')][_0x691c('0xbd')][_0x691c('0xbf')](_0x1abf6a['dataValues']);return _0x509d68;});});}})[_0x691c('0x1f')](respondWithResult(_0x33267c,null))['catch'](handleError(_0x33267c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8701d81..9312c6d 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x495123,_0x2bf158){var _0x39e1ee=function(_0x226778){while(--_0x226778){_0x495123['push'](_0x495123['shift']());}};_0x39e1ee(++_0x2bf158);}(_0x750a,0x140));var _0xa750=function(_0x1727b5,_0x2bbbfc){_0x1727b5=_0x1727b5-0x0;var _0x38ce81=_0x750a[_0x1727b5];return _0x38ce81;};'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 +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x456103,_0x5330a3){var _0x8abcb3=function(_0x3373f0){while(--_0x3373f0){_0x456103['push'](_0x456103['shift']());}};_0x8abcb3(++_0x5330a3);}(_0x9348,0x10d));var _0x8934=function(_0x393cfd,_0x33d7b2){_0x393cfd=_0x393cfd-0x0;var _0x26c8df=_0x9348[_0x393cfd];return _0x26c8df;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8f57015..7be8bbf 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(_0x4bc5ef,_0x5a1276){var _0xc6b005=function(_0x1a6d83){while(--_0x1a6d83){_0x4bc5ef['push'](_0x4bc5ef['shift']());}};_0xc6b005(++_0x5a1276);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x4e81a4,_0x2f942f){var _0xfd7a56=function(_0x49666e){while(--_0x49666e){_0x4e81a4['push'](_0x4e81a4['shift']());}};_0xfd7a56(++_0x2f942f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b6f17a6..36fec6c 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 _0xe493=['client','http','redis','defaults','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x13854c,_0x2ed273){var _0x4d9c2e=function(_0x2680d9){while(--_0x2680d9){_0x13854c['push'](_0x13854c['shift']());}};_0x4d9c2e(++_0x2ed273);}(_0xe493,0x7e));var _0x3e49=function(_0x43b1d5,_0x2c7fa1){_0x43b1d5=_0x43b1d5-0x0;var _0x1737c6=_0xe493[_0x43b1d5];return _0x1737c6;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});config[_0x3e49('0xb')]=_[_0x3e49('0xc')](config[_0x3e49('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e49('0xd'))[_0x3e49('0xe')](socket);function respondWithRpcPromise(_0x155727,_0x723d28,_0xb3f9f0){return new BPromise(function(_0x293965,_0xef8167){return client[_0x3e49('0xf')](_0x155727,_0xb3f9f0)[_0x3e49('0x10')](function(_0xf5e45f){logger[_0x3e49('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x723d28,_0x3e49('0x12'));logger[_0x3e49('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x723d28,_0x3e49('0x12'),JSON[_0x3e49('0x14')](_0xf5e45f));if(_0xf5e45f['error']){if(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x16')]===0x1f4){logger['error'](_0x3e49('0x17'),_0x723d28,_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);return _0xef8167(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);}logger[_0x3e49('0x15')](_0x3e49('0x17'),_0x723d28,_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);return _0x293965(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);}else{logger[_0x3e49('0x11')](_0x3e49('0x17'),_0x723d28,_0x3e49('0x12'));_0x293965(_0xf5e45f[_0x3e49('0x19')]['message']);}})[_0x3e49('0x1a')](function(_0x59bde3){logger[_0x3e49('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x723d28,_0x59bde3);_0xef8167(_0x59bde3);});});} \ No newline at end of file +var _0xd87e=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x43b768,_0x5e120f){var _0x408517=function(_0x3e43f2){while(--_0x3e43f2){_0x43b768['push'](_0x43b768['shift']());}};_0x408517(++_0x5e120f);}(_0xd87e,0x1bf));var _0xed87=function(_0xb301ed,_0x280e7f){_0xb301ed=_0xb301ed-0x0;var _0x3558be=_0xd87e[_0xb301ed];return _0x3558be;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});config['redis']=_[_0xed87('0x9')](config[_0xed87('0xa')],{'host':_0xed87('0xb'),'port':0x18eb});var socket=require(_0xed87('0xc'))(new Redis(config['redis']));require(_0xed87('0xd'))[_0xed87('0xe')](socket);function respondWithRpcPromise(_0x21d399,_0x3c9a3c,_0x1eeadf){return new BPromise(function(_0x1f1150,_0x293db4){return client['request'](_0x21d399,_0x1eeadf)[_0xed87('0xf')](function(_0xf104cb){logger['info'](_0xed87('0x10'),_0x3c9a3c,_0xed87('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3c9a3c,_0xed87('0x11'),JSON[_0xed87('0x12')](_0xf104cb));if(_0xf104cb[_0xed87('0x13')]){if(_0xf104cb[_0xed87('0x13')][_0xed87('0x14')]===0x1f4){logger[_0xed87('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c9a3c,_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);return _0x293db4(_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);}logger[_0xed87('0x13')](_0xed87('0x10'),_0x3c9a3c,_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);return _0x1f1150(_0xf104cb[_0xed87('0x13')]['message']);}else{logger[_0xed87('0x16')](_0xed87('0x10'),_0x3c9a3c,_0xed87('0x11'));_0x1f1150(_0xf104cb[_0xed87('0x17')]['message']);}})[_0xed87('0x18')](function(_0x473f00){logger[_0xed87('0x13')](_0xed87('0x10'),_0x3c9a3c,_0x473f00);_0x293db4(_0x473f00);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 004de5f..3f0bfcd 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4198=['openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x258317,_0x86bcc6){var _0x8e8765=function(_0x47967b){while(--_0x47967b){_0x258317['push'](_0x258317['shift']());}};_0x8e8765(++_0x86bcc6);}(_0x4198,0x69));var _0x8419=function(_0x276ea0,_0x5e9611){_0x276ea0=_0x276ea0-0x0;var _0x34d0c2=_0x4198[_0x276ea0];return _0x34d0c2;};'use strict';var OpenchannelAccountEvents=require(_0x8419('0x0'));var events=['save',_0x8419('0x1'),_0x8419('0x2')];function createListener(_0x29612a,_0x1e7a2f){return function(_0x182359){_0x1e7a2f[_0x8419('0x3')](_0x29612a,_0x182359);};}function removeListener(_0x1eaff0,_0xc19396){return function(){OpenchannelAccountEvents[_0x8419('0x4')](_0x1eaff0,_0xc19396);};}exports[_0x8419('0x5')]=function(_0x502e00){for(var _0x1f5bfe=0x0,_0x839abf=events[_0x8419('0x6')];_0x1f5bfe<_0x839abf;_0x1f5bfe++){var _0x2043cd=events[_0x1f5bfe];var _0x45c2b5=createListener(_0x8419('0x7')+_0x2043cd,_0x502e00);OpenchannelAccountEvents['on'](_0x2043cd,_0x45c2b5);}}; \ No newline at end of file +var _0xe28e=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe28e,0x1ba));var _0xee28=function(_0x41ae8b,_0x27b015){_0x41ae8b=_0x41ae8b-0x0;var _0x213b5a=_0xe28e[_0x41ae8b];return _0x213b5a;};'use strict';var OpenchannelAccountEvents=require(_0xee28('0x0'));var events=[_0xee28('0x1'),_0xee28('0x2'),_0xee28('0x3')];function createListener(_0x415017,_0x117a12){return function(_0x3e541a){_0x117a12[_0xee28('0x4')](_0x415017,_0x3e541a);};}function removeListener(_0xdc22c0,_0x40fdf8){return function(){OpenchannelAccountEvents[_0xee28('0x5')](_0xdc22c0,_0x40fdf8);};}exports[_0xee28('0x6')]=function(_0x162d3f){for(var _0x48e72f=0x0,_0x39b337=events[_0xee28('0x7')];_0x48e72f<_0x39b337;_0x48e72f++){var _0x3f9bd9=events[_0x48e72f];var _0x66d0b6=createListener(_0xee28('0x8')+_0x3f9bd9,_0x162d3f);OpenchannelAccountEvents['on'](_0x3f9bd9,_0x66d0b6);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1a32e46..a2ef5c4 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 _0xc2ea=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util'];(function(_0x2bf01c,_0x5f492e){var _0x13655f=function(_0x5782f8){while(--_0x5782f8){_0x2bf01c['push'](_0x2bf01c['shift']());}};_0x13655f(++_0x5f492e);}(_0xc2ea,0x67));var _0xac2e=function(_0x5bff0,_0x20716d){_0x5bff0=_0x5bff0-0x0;var _0x3ead2e=_0xc2ea[_0x5bff0];return _0x3ead2e;};'use strict';var multer=require(_0xac2e('0x0'));var util=require(_0xac2e('0x1'));var path=require(_0xac2e('0x2'));var timeout=require('connect-timeout');var express=require(_0xac2e('0x3'));var router=express[_0xac2e('0x4')]();var fs_extra=require(_0xac2e('0x5'));var auth=require(_0xac2e('0x6'));var interaction=require(_0xac2e('0x7'));var config=require(_0xac2e('0x8'));var controller=require(_0xac2e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xac2e('0xa')]);router[_0xac2e('0xb')](_0xac2e('0xc'),auth[_0xac2e('0xd')](),controller[_0xac2e('0xe')]);router[_0xac2e('0xf')]('/',auth[_0xac2e('0xd')](),controller[_0xac2e('0x10')]);router[_0xac2e('0x11')](_0xac2e('0xc'),auth[_0xac2e('0xd')](),controller[_0xac2e('0x12')]);router[_0xac2e('0x13')]('/:id',auth[_0xac2e('0xd')](),controller['destroy']);module[_0xac2e('0x14')]=router; \ No newline at end of file +var _0x625c=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x625c,0xe9));var _0xc625=function(_0x4c57d0,_0x21a3ff){_0x4c57d0=_0x4c57d0-0x0;var _0x2c2c71=_0x625c[_0x4c57d0];return _0x2c2c71;};'use strict';var multer=require(_0xc625('0x0'));var util=require(_0xc625('0x1'));var path=require(_0xc625('0x2'));var timeout=require(_0xc625('0x3'));var express=require(_0xc625('0x4'));var router=express[_0xc625('0x5')]();var fs_extra=require(_0xc625('0x6'));var auth=require(_0xc625('0x7'));var interaction=require(_0xc625('0x8'));var config=require(_0xc625('0x9'));var controller=require(_0xc625('0xa'));router[_0xc625('0xb')]('/',auth['isAuthenticated'](),controller[_0xc625('0xc')]);router[_0xc625('0xb')](_0xc625('0xd'),auth[_0xc625('0xe')](),controller['show']);router[_0xc625('0xf')]('/',auth[_0xc625('0xe')](),controller[_0xc625('0x10')]);router[_0xc625('0x11')](_0xc625('0xd'),auth[_0xc625('0xe')](),controller[_0xc625('0x12')]);router['delete'](_0xc625('0xd'),auth[_0xc625('0xe')](),controller[_0xc625('0x13')]);module[_0xc625('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7eea83c..64fba21 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 _0xecdf=['*,*,*,*','INTEGER','STRING','noop'];(function(_0x1ae93b,_0x562c7c){var _0x41802f=function(_0x56da68){while(--_0x56da68){_0x1ae93b['push'](_0x1ae93b['shift']());}};_0x41802f(++_0x562c7c);}(_0xecdf,0x195));var _0xfecd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xecdf[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xfecd('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xfecd('0x1')],'allowNull':![],'defaultValue':_0xfecd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfecd('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfecd('0x3')}}; \ No newline at end of file +var _0xb8e8=['noop','TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x319d10,_0x415c2e){var _0x4f6ff2=function(_0xc72e83){while(--_0xc72e83){_0x319d10['push'](_0x319d10['shift']());}};_0x4f6ff2(++_0x415c2e);}(_0xb8e8,0x85));var _0x8b8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb8e8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8b8e('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x8b8e('0x1')],'allowNull':![],'defaultValue':_0x8b8e('0x2')},'appdata':{'type':Sequelize[_0x8b8e('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8b8e('0x1')],'defaultValue':_0x8b8e('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e073ede..ca42383 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 _0xb120=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','error','stack','index','map','OpenchannelApplication','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4420e4,_0x68974c){var _0x15b7b7=function(_0xd1397){while(--_0xd1397){_0x4420e4['push'](_0x4420e4['shift']());}};_0x15b7b7(++_0x68974c);}(_0xb120,0x16a));var _0x0b12=function(_0x21434b,_0x5612a1){_0x21434b=_0x21434b-0x0;var _0x3c255e=_0xb120[_0x21434b];return _0x3c255e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b12('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b12('0x1'));var rp=require(_0x0b12('0x2'));var moment=require(_0x0b12('0x3'));var BPromise=require(_0x0b12('0x4'));var Mustache=require(_0x0b12('0x5'));var util=require(_0x0b12('0x6'));var path=require(_0x0b12('0x7'));var sox=require('sox');var csv=require(_0x0b12('0x8'));var ejs=require(_0x0b12('0x9'));var fs=require('fs');var fs_extra=require(_0x0b12('0xa'));var _=require(_0x0b12('0xb'));var squel=require(_0x0b12('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b12('0xd'));var toCsv=require(_0x0b12('0x8'));var querystring=require('querystring');var Papa=require(_0x0b12('0xe'));var Redis=require(_0x0b12('0xf'));var authService=require(_0x0b12('0x10'));var qs=require(_0x0b12('0x11'));var as=require(_0x0b12('0x12'));var hardwareService=require(_0x0b12('0x13'));var logger=require(_0x0b12('0x14'))(_0x0b12('0x15'));var utils=require(_0x0b12('0x16'));var config=require(_0x0b12('0x17'));var licenseUtil=require(_0x0b12('0x18'));var db=require(_0x0b12('0x19'))['db'];function respondWithStatusCode(_0x2363d5,_0x1b1c5a){_0x1b1c5a=_0x1b1c5a||0xcc;return function(_0x5e918c){if(_0x5e918c){return _0x2363d5[_0x0b12('0x1a')](_0x1b1c5a);}return _0x2363d5[_0x0b12('0x1b')](_0x1b1c5a)[_0x0b12('0x1c')]();};}function respondWithResult(_0x4c8836,_0xd2424d){_0xd2424d=_0xd2424d||0xc8;return function(_0x403965){if(_0x403965){return _0x4c8836[_0x0b12('0x1b')](_0xd2424d)['json'](_0x403965);}};}function respondWithFilteredResult(_0x293880,_0x3e9d1c){return function(_0x596b9a){if(_0x596b9a){var _0x1088e6=typeof _0x3e9d1c['offset']==='undefined'&&typeof _0x3e9d1c[_0x0b12('0x1d')]===_0x0b12('0x1e');var _0x164355=_0x596b9a[_0x0b12('0x1f')];var _0x3735e6=_0x1088e6?0x0:_0x3e9d1c[_0x0b12('0x20')];var _0x22a14b=_0x1088e6?_0x596b9a[_0x0b12('0x1f')]:_0x3e9d1c['offset']+_0x3e9d1c[_0x0b12('0x1d')];var _0x33438e;if(_0x22a14b>=_0x164355){_0x22a14b=_0x164355;_0x33438e=0xc8;}else{_0x33438e=0xce;}_0x293880[_0x0b12('0x1b')](_0x33438e);return _0x293880[_0x0b12('0x21')](_0x0b12('0x22'),_0x3735e6+'-'+_0x22a14b+'/'+_0x164355)[_0x0b12('0x23')](_0x596b9a);}return null;};}function patchUpdates(_0x2a8f7a){return function(_0x1cf32a){try{jsonpatch[_0x0b12('0x24')](_0x1cf32a,_0x2a8f7a,!![]);}catch(_0x25ff0c){return BPromise['reject'](_0x25ff0c);}return _0x1cf32a[_0x0b12('0x25')]();};}function saveUpdates(_0x4b1471,_0x585a39){return function(_0x2e7146){if(_0x2e7146){return _0x2e7146[_0x0b12('0x26')](_0x4b1471)[_0x0b12('0x27')](function(_0x436018){return _0x436018;});}return null;};}function removeEntity(_0x14b1ab,_0x49a29c){return function(_0x1f3a1d){if(_0x1f3a1d){return _0x1f3a1d['destroy']()[_0x0b12('0x27')](function(){_0x14b1ab[_0x0b12('0x1b')](0xcc)[_0x0b12('0x1c')]();});}};}function handleEntityNotFound(_0x105301,_0x19e6cb){return function(_0xe80cfe){if(!_0xe80cfe){_0x105301['sendStatus'](0x194);}return _0xe80cfe;};}function handleError(_0x5220b8,_0x71f993){_0x71f993=_0x71f993||0x1f4;return function(_0xf66a42){logger[_0x0b12('0x28')](_0xf66a42[_0x0b12('0x29')]);if(_0xf66a42['name']){delete _0xf66a42['name'];}_0x5220b8['status'](_0x71f993)['send'](_0xf66a42);};}exports[_0x0b12('0x2a')]=function(_0x7f64d9,_0x2ae08d){var _0x2d5635={},_0x1fefcf={},_0x1b2db0={'count':0x0,'rows':[]};var _0x15adce=_[_0x0b12('0x2b')](db[_0x0b12('0x2c')]['rawAttributes'],function(_0x35b963){return{'name':_0x35b963[_0x0b12('0x2d')],'type':_0x35b963[_0x0b12('0x2e')][_0x0b12('0x2f')]};});_0x1fefcf[_0x0b12('0x30')]=_['map'](_0x15adce,_0x0b12('0x31'));_0x1fefcf[_0x0b12('0x32')]=_['keys'](_0x7f64d9[_0x0b12('0x32')]);_0x1fefcf[_0x0b12('0x33')]=_[_0x0b12('0x34')](_0x1fefcf[_0x0b12('0x30')],_0x1fefcf[_0x0b12('0x32')]);_0x2d5635[_0x0b12('0x35')]=_['intersection'](_0x1fefcf['model'],qs[_0x0b12('0x36')](_0x7f64d9['query'][_0x0b12('0x36')]));_0x2d5635[_0x0b12('0x35')]=_0x2d5635['attributes']['length']?_0x2d5635['attributes']:_0x1fefcf[_0x0b12('0x30')];if(!_0x7f64d9['query'][_0x0b12('0x37')](_0x0b12('0x38'))){_0x2d5635['limit']=qs['limit'](_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x1d')]);_0x2d5635['offset']=qs['offset'](_0x7f64d9['query'][_0x0b12('0x20')]);}_0x2d5635[_0x0b12('0x39')]=qs['sort'](_0x7f64d9['query'][_0x0b12('0x3a')]);_0x2d5635[_0x0b12('0x3b')]=qs[_0x0b12('0x33')](_[_0x0b12('0x3c')](_0x7f64d9[_0x0b12('0x32')],_0x1fefcf[_0x0b12('0x33')]),_0x15adce);if(_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x3d')]){_0x2d5635[_0x0b12('0x3b')]=_[_0x0b12('0x3e')](_0x2d5635[_0x0b12('0x3b')],{'$or':_['map'](_0x15adce,function(_0x4bbf4d){if(_0x4bbf4d['type']!=='VIRTUAL'){var _0xbcaa55={};_0xbcaa55[_0x4bbf4d[_0x0b12('0x31')]]={'$like':'%'+_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x3d')]+'%'};return _0xbcaa55;}})});}_0x2d5635=_[_0x0b12('0x3e')]({},_0x2d5635,_0x7f64d9[_0x0b12('0x3f')]);var _0xda3fbe={'where':_0x2d5635[_0x0b12('0x3b')]};return db['OpenchannelApplication'][_0x0b12('0x1f')](_0xda3fbe)[_0x0b12('0x27')](function(_0x31977a){_0x1b2db0[_0x0b12('0x1f')]=_0x31977a;if(_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x40')]){_0x2d5635['include']=[{'all':!![]}];}return db[_0x0b12('0x2c')][_0x0b12('0x41')](_0x2d5635);})[_0x0b12('0x27')](function(_0x44d246){_0x1b2db0[_0x0b12('0x42')]=_0x44d246;return _0x1b2db0;})[_0x0b12('0x27')](respondWithFilteredResult(_0x2ae08d,_0x2d5635))[_0x0b12('0x43')](handleError(_0x2ae08d,null));};exports[_0x0b12('0x44')]=function(_0x20372d,_0x46f8e2){var _0x3ef550={'raw':!![],'where':{'id':_0x20372d[_0x0b12('0x45')]['id']}},_0x140ec1={};_0x140ec1[_0x0b12('0x30')]=_[_0x0b12('0x46')](db[_0x0b12('0x2c')]['rawAttributes']);_0x140ec1['query']=_[_0x0b12('0x46')](_0x20372d['query']);_0x140ec1[_0x0b12('0x33')]=_['intersection'](_0x140ec1[_0x0b12('0x30')],_0x140ec1[_0x0b12('0x32')]);_0x3ef550['attributes']=_[_0x0b12('0x34')](_0x140ec1[_0x0b12('0x30')],qs[_0x0b12('0x36')](_0x20372d[_0x0b12('0x32')][_0x0b12('0x36')]));_0x3ef550[_0x0b12('0x35')]=_0x3ef550['attributes'][_0x0b12('0x47')]?_0x3ef550[_0x0b12('0x35')]:_0x140ec1[_0x0b12('0x30')];if(_0x20372d[_0x0b12('0x32')][_0x0b12('0x40')]){_0x3ef550[_0x0b12('0x48')]=[{'all':!![]}];}_0x3ef550=_[_0x0b12('0x3e')]({},_0x3ef550,_0x20372d['options']);return db['OpenchannelApplication'][_0x0b12('0x49')](_0x3ef550)[_0x0b12('0x27')](handleEntityNotFound(_0x46f8e2,null))[_0x0b12('0x27')](respondWithResult(_0x46f8e2,null))['catch'](handleError(_0x46f8e2,null));};exports[_0x0b12('0x4a')]=function(_0x4a8039,_0x1824ff){return db[_0x0b12('0x2c')][_0x0b12('0x4a')](_0x4a8039['body'],{})['then'](respondWithResult(_0x1824ff,0xc9))[_0x0b12('0x43')](handleError(_0x1824ff,null));};exports[_0x0b12('0x26')]=function(_0x5c0d20,_0x42c074){if(_0x5c0d20['body']['id']){delete _0x5c0d20[_0x0b12('0x4b')]['id'];}return db[_0x0b12('0x2c')][_0x0b12('0x49')]({'where':{'id':_0x5c0d20[_0x0b12('0x45')]['id']}})[_0x0b12('0x27')](handleEntityNotFound(_0x42c074,null))[_0x0b12('0x27')](saveUpdates(_0x5c0d20[_0x0b12('0x4b')],null))[_0x0b12('0x27')](respondWithResult(_0x42c074,null))[_0x0b12('0x43')](handleError(_0x42c074,null));};exports['destroy']=function(_0x5865a6,_0x56a5b3){return db[_0x0b12('0x2c')][_0x0b12('0x49')]({'where':{'id':_0x5865a6[_0x0b12('0x45')]['id']}})[_0x0b12('0x27')](handleEntityNotFound(_0x56a5b3,null))[_0x0b12('0x27')](removeEntity(_0x56a5b3,null))[_0x0b12('0x43')](handleError(_0x56a5b3,null));}; \ No newline at end of file +var _0x4ec8=['index','map','OpenchannelApplication','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','offset','undefined','count','limit','set','json','reject','save','then','destroy','sendStatus','stack','name'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0x4ec8,0x187));var _0x84ec=function(_0x4b866c,_0x4c8daa){_0x4b866c=_0x4b866c-0x0;var _0x2f40be=_0x4ec8[_0x4b866c];return _0x2f40be;};'use strict';var emlformat=require(_0x84ec('0x0'));var rimraf=require(_0x84ec('0x1'));var zipdir=require(_0x84ec('0x2'));var jsonpatch=require(_0x84ec('0x3'));var rp=require(_0x84ec('0x4'));var moment=require(_0x84ec('0x5'));var BPromise=require(_0x84ec('0x6'));var Mustache=require(_0x84ec('0x7'));var util=require(_0x84ec('0x8'));var path=require(_0x84ec('0x9'));var sox=require(_0x84ec('0xa'));var csv=require(_0x84ec('0xb'));var ejs=require(_0x84ec('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x84ec('0xd'));var crypto=require(_0x84ec('0xe'));var jsforce=require(_0x84ec('0xf'));var deskjs=require(_0x84ec('0x10'));var toCsv=require(_0x84ec('0xb'));var querystring=require(_0x84ec('0x11'));var Papa=require(_0x84ec('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x84ec('0x13'));var as=require(_0x84ec('0x14'));var hardwareService=require(_0x84ec('0x15'));var logger=require(_0x84ec('0x16'))(_0x84ec('0x17'));var utils=require(_0x84ec('0x18'));var config=require(_0x84ec('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5645eb,_0x40c5ad){_0x40c5ad=_0x40c5ad||0xcc;return function(_0x357b8a){if(_0x357b8a){return _0x5645eb['sendStatus'](_0x40c5ad);}return _0x5645eb['status'](_0x40c5ad)[_0x84ec('0x1a')]();};}function respondWithResult(_0x5a414e,_0x3cc276){_0x3cc276=_0x3cc276||0xc8;return function(_0x2b1c8a){if(_0x2b1c8a){return _0x5a414e[_0x84ec('0x1b')](_0x3cc276)['json'](_0x2b1c8a);}};}function respondWithFilteredResult(_0x28fbf1,_0x1cb3fa){return function(_0x2361bd){if(_0x2361bd){var _0x349181=typeof _0x1cb3fa[_0x84ec('0x1c')]===_0x84ec('0x1d')&&typeof _0x1cb3fa['limit']===_0x84ec('0x1d');var _0x2bb49e=_0x2361bd[_0x84ec('0x1e')];var _0xc6419f=_0x349181?0x0:_0x1cb3fa['offset'];var _0x5e08dc=_0x349181?_0x2361bd['count']:_0x1cb3fa['offset']+_0x1cb3fa[_0x84ec('0x1f')];var _0x2e0a8e;if(_0x5e08dc>=_0x2bb49e){_0x5e08dc=_0x2bb49e;_0x2e0a8e=0xc8;}else{_0x2e0a8e=0xce;}_0x28fbf1['status'](_0x2e0a8e);return _0x28fbf1[_0x84ec('0x20')]('Content-Range',_0xc6419f+'-'+_0x5e08dc+'/'+_0x2bb49e)[_0x84ec('0x21')](_0x2361bd);}return null;};}function patchUpdates(_0x40c439){return function(_0xfd9a1a){try{jsonpatch['apply'](_0xfd9a1a,_0x40c439,!![]);}catch(_0x613048){return BPromise[_0x84ec('0x22')](_0x613048);}return _0xfd9a1a[_0x84ec('0x23')]();};}function saveUpdates(_0x23ef72,_0x3484d7){return function(_0xecef86){if(_0xecef86){return _0xecef86['update'](_0x23ef72)[_0x84ec('0x24')](function(_0x87d23f){return _0x87d23f;});}return null;};}function removeEntity(_0x1d9729,_0x19a8ec){return function(_0x8905e2){if(_0x8905e2){return _0x8905e2[_0x84ec('0x25')]()[_0x84ec('0x24')](function(){_0x1d9729['status'](0xcc)[_0x84ec('0x1a')]();});}};}function handleEntityNotFound(_0x4e090,_0x416d7c){return function(_0x36aa61){if(!_0x36aa61){_0x4e090[_0x84ec('0x26')](0x194);}return _0x36aa61;};}function handleError(_0x560768,_0x5bc50a){_0x5bc50a=_0x5bc50a||0x1f4;return function(_0x269c07){logger['error'](_0x269c07[_0x84ec('0x27')]);if(_0x269c07['name']){delete _0x269c07[_0x84ec('0x28')];}_0x560768['status'](_0x5bc50a)['send'](_0x269c07);};}exports[_0x84ec('0x29')]=function(_0x17d2a5,_0x95966d){var _0x43a65e={},_0x510f55={},_0x33d813={'count':0x0,'rows':[]};var _0x3959fe=_[_0x84ec('0x2a')](db[_0x84ec('0x2b')]['rawAttributes'],function(_0x5e99de){return{'name':_0x5e99de['fieldName'],'type':_0x5e99de['type'][_0x84ec('0x2c')]};});_0x510f55[_0x84ec('0x2d')]=_[_0x84ec('0x2a')](_0x3959fe,'name');_0x510f55[_0x84ec('0x2e')]=_['keys'](_0x17d2a5[_0x84ec('0x2e')]);_0x510f55[_0x84ec('0x2f')]=_[_0x84ec('0x30')](_0x510f55[_0x84ec('0x2d')],_0x510f55[_0x84ec('0x2e')]);_0x43a65e['attributes']=_[_0x84ec('0x30')](_0x510f55[_0x84ec('0x2d')],qs[_0x84ec('0x31')](_0x17d2a5[_0x84ec('0x2e')][_0x84ec('0x31')]));_0x43a65e['attributes']=_0x43a65e[_0x84ec('0x32')][_0x84ec('0x33')]?_0x43a65e[_0x84ec('0x32')]:_0x510f55[_0x84ec('0x2d')];if(!_0x17d2a5[_0x84ec('0x2e')][_0x84ec('0x34')](_0x84ec('0x35'))){_0x43a65e[_0x84ec('0x1f')]=qs[_0x84ec('0x1f')](_0x17d2a5[_0x84ec('0x2e')][_0x84ec('0x1f')]);_0x43a65e[_0x84ec('0x1c')]=qs['offset'](_0x17d2a5[_0x84ec('0x2e')]['offset']);}_0x43a65e[_0x84ec('0x36')]=qs[_0x84ec('0x37')](_0x17d2a5['query'][_0x84ec('0x37')]);_0x43a65e[_0x84ec('0x38')]=qs[_0x84ec('0x2f')](_['pick'](_0x17d2a5[_0x84ec('0x2e')],_0x510f55['filters']),_0x3959fe);if(_0x17d2a5[_0x84ec('0x2e')]['filter']){_0x43a65e[_0x84ec('0x38')]=_[_0x84ec('0x39')](_0x43a65e[_0x84ec('0x38')],{'$or':_[_0x84ec('0x2a')](_0x3959fe,function(_0x5e1d3a){if(_0x5e1d3a[_0x84ec('0x3a')]!==_0x84ec('0x3b')){var _0x466863={};_0x466863[_0x5e1d3a['name']]={'$like':'%'+_0x17d2a5[_0x84ec('0x2e')][_0x84ec('0x3c')]+'%'};return _0x466863;}})});}_0x43a65e=_[_0x84ec('0x39')]({},_0x43a65e,_0x17d2a5[_0x84ec('0x3d')]);var _0x227c47={'where':_0x43a65e[_0x84ec('0x38')]};return db[_0x84ec('0x2b')]['count'](_0x227c47)[_0x84ec('0x24')](function(_0x25b670){_0x33d813[_0x84ec('0x1e')]=_0x25b670;if(_0x17d2a5[_0x84ec('0x2e')][_0x84ec('0x3e')]){_0x43a65e[_0x84ec('0x3f')]=[{'all':!![]}];}return db[_0x84ec('0x2b')][_0x84ec('0x40')](_0x43a65e);})['then'](function(_0x20d189){_0x33d813['rows']=_0x20d189;return _0x33d813;})[_0x84ec('0x24')](respondWithFilteredResult(_0x95966d,_0x43a65e))[_0x84ec('0x41')](handleError(_0x95966d,null));};exports[_0x84ec('0x42')]=function(_0x15b5bb,_0x112000){var _0x2860b9={'raw':!![],'where':{'id':_0x15b5bb['params']['id']}},_0x313656={};_0x313656[_0x84ec('0x2d')]=_['keys'](db['OpenchannelApplication'][_0x84ec('0x43')]);_0x313656['query']=_['keys'](_0x15b5bb[_0x84ec('0x2e')]);_0x313656['filters']=_[_0x84ec('0x30')](_0x313656[_0x84ec('0x2d')],_0x313656[_0x84ec('0x2e')]);_0x2860b9[_0x84ec('0x32')]=_[_0x84ec('0x30')](_0x313656['model'],qs[_0x84ec('0x31')](_0x15b5bb['query'][_0x84ec('0x31')]));_0x2860b9[_0x84ec('0x32')]=_0x2860b9[_0x84ec('0x32')][_0x84ec('0x33')]?_0x2860b9[_0x84ec('0x32')]:_0x313656[_0x84ec('0x2d')];if(_0x15b5bb[_0x84ec('0x2e')][_0x84ec('0x3e')]){_0x2860b9[_0x84ec('0x3f')]=[{'all':!![]}];}_0x2860b9=_[_0x84ec('0x39')]({},_0x2860b9,_0x15b5bb[_0x84ec('0x3d')]);return db[_0x84ec('0x2b')][_0x84ec('0x44')](_0x2860b9)[_0x84ec('0x24')](handleEntityNotFound(_0x112000,null))[_0x84ec('0x24')](respondWithResult(_0x112000,null))[_0x84ec('0x41')](handleError(_0x112000,null));};exports[_0x84ec('0x45')]=function(_0x3cbfd9,_0x4cd93b){return db[_0x84ec('0x2b')][_0x84ec('0x45')](_0x3cbfd9[_0x84ec('0x46')],{})['then'](respondWithResult(_0x4cd93b,0xc9))[_0x84ec('0x41')](handleError(_0x4cd93b,null));};exports['update']=function(_0x25f019,_0x380583){if(_0x25f019[_0x84ec('0x46')]['id']){delete _0x25f019[_0x84ec('0x46')]['id'];}return db['OpenchannelApplication'][_0x84ec('0x44')]({'where':{'id':_0x25f019[_0x84ec('0x47')]['id']}})[_0x84ec('0x24')](handleEntityNotFound(_0x380583,null))[_0x84ec('0x24')](saveUpdates(_0x25f019[_0x84ec('0x46')],null))[_0x84ec('0x24')](respondWithResult(_0x380583,null))[_0x84ec('0x41')](handleError(_0x380583,null));};exports['destroy']=function(_0x2bc48a,_0x440808){return db['OpenchannelApplication']['find']({'where':{'id':_0x2bc48a[_0x84ec('0x47')]['id']}})[_0x84ec('0x24')](handleEntityNotFound(_0x440808,null))[_0x84ec('0x24')](removeEntity(_0x440808,null))['catch'](handleError(_0x440808,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 6a612a8..ef3c3ef 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 _0x4867=['api','moment','request-promise','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','../../config/logger'];(function(_0x3ba69c,_0x3e370c){var _0x1c722b=function(_0x1ba57a){while(--_0x1ba57a){_0x3ba69c['push'](_0x3ba69c['shift']());}};_0x1c722b(++_0x3e370c);}(_0x4867,0x1c1));var _0x7486=function(_0x2ea4f0,_0x420118){_0x2ea4f0=_0x2ea4f0-0x0;var _0x5c5877=_0x4867[_0x2ea4f0];return _0x5c5877;};'use strict';var _=require(_0x7486('0x0'));var util=require('util');var logger=require(_0x7486('0x1'))(_0x7486('0x2'));var moment=require(_0x7486('0x3'));var BPromise=require('bluebird');var rp=require(_0x7486('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7486('0x5'));var config=require('../../config/environment');var attributes=require(_0x7486('0x6'));module[_0x7486('0x7')]=function(_0x337247,_0x13fc6e){return _0x337247[_0x7486('0x8')](_0x7486('0x9'),attributes,{'tableName':_0x7486('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xff9d=['api','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x105559,_0xed36fe){var _0x1f2e16=function(_0x1bc6bf){while(--_0x1bc6bf){_0x105559['push'](_0x105559['shift']());}};_0x1f2e16(++_0xed36fe);}(_0xff9d,0x80));var _0xdff9=function(_0x29c3f3,_0x17cc26){_0x29c3f3=_0x29c3f3-0x0;var _0x420c9e=_0xff9d[_0x29c3f3];return _0x420c9e;};'use strict';var _=require(_0xdff9('0x0'));var util=require(_0xdff9('0x1'));var logger=require('../../config/logger')(_0xdff9('0x2'));var moment=require('moment');var BPromise=require(_0xdff9('0x3'));var rp=require(_0xdff9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdff9('0x5'));var config=require(_0xdff9('0x6'));var attributes=require(_0xdff9('0x7'));module[_0xdff9('0x8')]=function(_0x42721a,_0x3e897d){return _0x42721a[_0xdff9('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xdff9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdff9('0xb'),'collate':_0xdff9('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1a91d3b..5dca44a 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 _0xd0e5=['error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','then','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f4863,_0x54bc8d){var _0x30c440=function(_0x57f30e){while(--_0x57f30e){_0x3f4863['push'](_0x3f4863['shift']());}};_0x30c440(++_0x54bc8d);}(_0xd0e5,0xd2));var _0x5d0e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xd0e5[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x5d0e('0x0'));var util=require(_0x5d0e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d0e('0x2'));var fs=require('fs');var Redis=require(_0x5d0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d0e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d0e('0x5'));var jayson=require(_0x5d0e('0x6'));var client=jayson[_0x5d0e('0x7')][_0x5d0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d54b0,_0x1e0b63,_0x2efba3){return new BPromise(function(_0x11997d,_0x22e656){return client['request'](_0x2d54b0,_0x2efba3)['then'](function(_0x49007b){logger[_0x5d0e('0x9')](_0x5d0e('0xa'),_0x1e0b63,_0x5d0e('0xb'));logger['debug'](_0x5d0e('0xc'),_0x1e0b63,_0x5d0e('0xb'),JSON[_0x5d0e('0xd')](_0x49007b));if(_0x49007b[_0x5d0e('0xe')]){if(_0x49007b[_0x5d0e('0xe')]['code']===0x1f4){logger[_0x5d0e('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e0b63,_0x49007b[_0x5d0e('0xe')][_0x5d0e('0xf')]);return _0x22e656(_0x49007b[_0x5d0e('0xe')][_0x5d0e('0xf')]);}logger[_0x5d0e('0xe')](_0x5d0e('0xa'),_0x1e0b63,_0x49007b[_0x5d0e('0xe')]['message']);return _0x11997d(_0x49007b['error']['message']);}else{logger[_0x5d0e('0x9')](_0x5d0e('0xa'),_0x1e0b63,_0x5d0e('0xb'));_0x11997d(_0x49007b[_0x5d0e('0x10')][_0x5d0e('0xf')]);}})[_0x5d0e('0x11')](function(_0x2b45e8){logger[_0x5d0e('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e0b63,_0x2b45e8);_0x22e656(_0x2b45e8);});});}exports[_0x5d0e('0x12')]=function(_0x4b3abb){var _0x4a5042=this;return new Promise(function(_0x273c0a,_0x14232b){return db[_0x5d0e('0x13')][_0x5d0e('0x14')](_0x4b3abb[_0x5d0e('0x15')],{'raw':_0x4b3abb['options']?_0x4b3abb[_0x5d0e('0x16')][_0x5d0e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3abb[_0x5d0e('0x16')]?_0x4b3abb[_0x5d0e('0x16')][_0x5d0e('0x18')]||null:null,'attributes':_0x4b3abb['options']?_0x4b3abb[_0x5d0e('0x16')][_0x5d0e('0x19')]||null:null,'limit':_0x4b3abb[_0x5d0e('0x16')]?_0x4b3abb[_0x5d0e('0x16')]['limit']||null:null})[_0x5d0e('0x1a')](function(_0x43ee34){logger['info']('UpdateOpenchannelApplication',_0x4b3abb);logger[_0x5d0e('0x1b')](_0x5d0e('0x12'),_0x4b3abb,JSON[_0x5d0e('0xd')](_0x43ee34));_0x273c0a(_0x43ee34);})['catch'](function(_0x1c16e3){logger[_0x5d0e('0xe')](_0x5d0e('0x12'),_0x1c16e3[_0x5d0e('0xf')],_0x4b3abb);_0x14232b(_0x4a5042[_0x5d0e('0xe')](0x1f4,_0x1c16e3[_0x5d0e('0xf')]));});});}; \ No newline at end of file +var _0x2e2a=['catch','UpdateOpenchannelApplication','update','options','raw','where','attributes','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result'];(function(_0x2d2030,_0x3aa483){var _0x17ab71=function(_0x4c9d71){while(--_0x4c9d71){_0x2d2030['push'](_0x2d2030['shift']());}};_0x17ab71(++_0x3aa483);}(_0x2e2a,0x103));var _0xa2e2=function(_0x5c609f,_0x121078){_0x5c609f=_0x5c609f-0x0;var _0x3e934d=_0x2e2a[_0x5c609f];return _0x3e934d;};'use strict';var _=require('lodash');var util=require(_0xa2e2('0x0'));var moment=require(_0xa2e2('0x1'));var BPromise=require('bluebird');var rs=require(_0xa2e2('0x2'));var fs=require('fs');var Redis=require(_0xa2e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2e2('0x4'));var logger=require(_0xa2e2('0x5'))(_0xa2e2('0x6'));var config=require(_0xa2e2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2e2('0x8')][_0xa2e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d30f0,_0x1a626c,_0x2b5eec){return new BPromise(function(_0x465700,_0x2a1695){return client[_0xa2e2('0xa')](_0x1d30f0,_0x2b5eec)[_0xa2e2('0xb')](function(_0x58dde1){logger[_0xa2e2('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x1a626c,_0xa2e2('0xd'));logger[_0xa2e2('0xe')](_0xa2e2('0xf'),_0x1a626c,_0xa2e2('0xd'),JSON['stringify'](_0x58dde1));if(_0x58dde1[_0xa2e2('0x10')]){if(_0x58dde1[_0xa2e2('0x10')][_0xa2e2('0x11')]===0x1f4){logger[_0xa2e2('0x10')](_0xa2e2('0x12'),_0x1a626c,_0x58dde1[_0xa2e2('0x10')][_0xa2e2('0x13')]);return _0x2a1695(_0x58dde1[_0xa2e2('0x10')][_0xa2e2('0x13')]);}logger[_0xa2e2('0x10')](_0xa2e2('0x12'),_0x1a626c,_0x58dde1[_0xa2e2('0x10')]['message']);return _0x465700(_0x58dde1[_0xa2e2('0x10')][_0xa2e2('0x13')]);}else{logger[_0xa2e2('0xc')](_0xa2e2('0x12'),_0x1a626c,'request\x20sent');_0x465700(_0x58dde1[_0xa2e2('0x14')][_0xa2e2('0x13')]);}})[_0xa2e2('0x15')](function(_0x156ab6){logger[_0xa2e2('0x10')](_0xa2e2('0x12'),_0x1a626c,_0x156ab6);_0x2a1695(_0x156ab6);});});}exports[_0xa2e2('0x16')]=function(_0x3bab9d){var _0x219fd0=this;return new Promise(function(_0xe093f3,_0x1c9da5){return db['OpenchannelApplication'][_0xa2e2('0x17')](_0x3bab9d['body'],{'raw':_0x3bab9d['options']?_0x3bab9d[_0xa2e2('0x18')][_0xa2e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bab9d[_0xa2e2('0x18')]?_0x3bab9d[_0xa2e2('0x18')][_0xa2e2('0x1a')]||null:null,'attributes':_0x3bab9d[_0xa2e2('0x18')]?_0x3bab9d[_0xa2e2('0x18')][_0xa2e2('0x1b')]||null:null,'limit':_0x3bab9d[_0xa2e2('0x18')]?_0x3bab9d[_0xa2e2('0x18')]['limit']||null:null})[_0xa2e2('0xb')](function(_0x289e09){logger[_0xa2e2('0xc')]('UpdateOpenchannelApplication',_0x3bab9d);logger[_0xa2e2('0xe')](_0xa2e2('0x16'),_0x3bab9d,JSON['stringify'](_0x289e09));_0xe093f3(_0x289e09);})[_0xa2e2('0x15')](function(_0x20c2d1){logger['error'](_0xa2e2('0x16'),_0x20c2d1[_0xa2e2('0x13')],_0x3bab9d);_0x1c9da5(_0x219fd0[_0xa2e2('0x10')](0x1f4,_0x20c2d1[_0xa2e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 23f1aff..3084900 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 _0x363b=['/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe'];(function(_0x23c2ec,_0x2a8ff9){var _0x23e5d4=function(_0x425d25){while(--_0x425d25){_0x23c2ec['push'](_0x23c2ec['shift']());}};_0x23e5d4(++_0x2a8ff9);}(_0x363b,0x18a));var _0xb363=function(_0x36628b,_0x9e370a){_0x36628b=_0x36628b-0x0;var _0x5680fe=_0x363b[_0x36628b];return _0x5680fe;};'use strict';var multer=require(_0xb363('0x0'));var util=require(_0xb363('0x1'));var path=require(_0xb363('0x2'));var timeout=require(_0xb363('0x3'));var express=require(_0xb363('0x4'));var router=express['Router']();var fs_extra=require(_0xb363('0x5'));var auth=require(_0xb363('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb363('0x7'));router[_0xb363('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb363('0x8')](_0xb363('0x9'),auth[_0xb363('0xa')](),controller[_0xb363('0xb')]);router[_0xb363('0x8')](_0xb363('0xc'),auth[_0xb363('0xa')](),controller[_0xb363('0xd')]);router[_0xb363('0x8')]('/:id/messages',auth[_0xb363('0xa')](),controller[_0xb363('0xe')]);router[_0xb363('0x8')](_0xb363('0xf'),auth[_0xb363('0xa')](),controller[_0xb363('0x10')]);router[_0xb363('0x11')]('/',auth[_0xb363('0xa')](),controller[_0xb363('0x12')]);router[_0xb363('0x11')](_0xb363('0x13'),auth[_0xb363('0xa')](),controller['addMessage']);router[_0xb363('0x11')](_0xb363('0x14'),auth[_0xb363('0xa')](),interaction[_0xb363('0x15')](_0xb363('0x16'),_0xb363('0x17')),controller[_0xb363('0x18')]);router['put'](_0xb363('0xc'),auth[_0xb363('0xa')](),interaction[_0xb363('0x15')](_0xb363('0x16'),_0xb363('0x19')),controller['update']);router[_0xb363('0x1a')](_0xb363('0xc'),auth[_0xb363('0xa')](),interaction[_0xb363('0x15')](_0xb363('0x16'),'openchannelinteraction:destroy'),controller[_0xb363('0x1b')]);router[_0xb363('0x1a')](_0xb363('0x14'),auth[_0xb363('0xa')](),controller[_0xb363('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x66af=['tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x49a309,_0x1fbb40){var _0x447009=function(_0x2c7650){while(--_0x2c7650){_0x49a309['push'](_0x49a309['shift']());}};_0x447009(++_0x1fbb40);}(_0x66af,0x1c3));var _0xf66a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x66af[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xf66a('0x0'));var util=require(_0xf66a('0x1'));var path=require(_0xf66a('0x2'));var timeout=require(_0xf66a('0x3'));var express=require(_0xf66a('0x4'));var router=express[_0xf66a('0x5')]();var fs_extra=require(_0xf66a('0x6'));var auth=require(_0xf66a('0x7'));var interaction=require(_0xf66a('0x8'));var config=require(_0xf66a('0x9'));var controller=require(_0xf66a('0xa'));router[_0xf66a('0xb')]('/',auth[_0xf66a('0xc')](),controller[_0xf66a('0xd')]);router[_0xf66a('0xb')](_0xf66a('0xe'),auth[_0xf66a('0xc')](),controller['describe']);router[_0xf66a('0xb')](_0xf66a('0xf'),auth[_0xf66a('0xc')](),controller[_0xf66a('0x10')]);router[_0xf66a('0xb')](_0xf66a('0x11'),auth['isAuthenticated'](),controller[_0xf66a('0x12')]);router[_0xf66a('0xb')](_0xf66a('0x13'),auth[_0xf66a('0xc')](),controller[_0xf66a('0x14')]);router[_0xf66a('0x15')]('/',auth[_0xf66a('0xc')](),controller[_0xf66a('0x16')]);router[_0xf66a('0x15')]('/:id/messages',auth[_0xf66a('0xc')](),controller[_0xf66a('0x17')]);router[_0xf66a('0x15')](_0xf66a('0x18'),auth[_0xf66a('0xc')](),interaction[_0xf66a('0x19')](_0xf66a('0x1a'),_0xf66a('0x1b')),controller['addTags']);router[_0xf66a('0x1c')]('/:id',auth[_0xf66a('0xc')](),interaction[_0xf66a('0x19')]('openchannel',_0xf66a('0x1d')),controller['update']);router[_0xf66a('0x1e')](_0xf66a('0xf'),auth[_0xf66a('0xc')](),interaction['tracked']('openchannel',_0xf66a('0x1f')),controller['destroy']);router['delete'](_0xf66a('0x18'),auth[_0xf66a('0xc')](),controller[_0xf66a('0x20')]);module[_0xf66a('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 165d93e..16e6257 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 _0xacc5=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xacc5,0x104));var _0x5acc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xacc5[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x5acc('0x0'));module[_0x5acc('0x1')]={'closed':{'type':Sequelize[_0x5acc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5acc('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5acc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5acc('0x4')]},'note':{'type':Sequelize[_0x5acc('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5acc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x5acc('0x5')]('in',_0x5acc('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x5acc('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfd7b=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x4237d8,_0x13cc54){var _0x1e8caf=function(_0x1b18c5){while(--_0x1b18c5){_0x4237d8['push'](_0x4237d8['shift']());}};_0x1e8caf(++_0x13cc54);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfd7b[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'closed':{'type':Sequelize[_0xbfd7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbfd7('0x3')]},'secondDisposition':{'type':Sequelize[_0xbfd7('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbfd7('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbfd7('0x4')]},'threadId':{'type':Sequelize[_0xbfd7('0x3')]},'externalUrl':{'type':Sequelize[_0xbfd7('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xbfd7('0x5')]('in',_0xbfd7('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbfd7('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbfd7('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xbfd7('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6d9d5ac..abe681a 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 _0x9727=['fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','disposition','Private','map','basename','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','moment','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','then','error','stack','send','getOptions','findAll','query','user','catch','show','type','params','model','keys','OpenchannelInteraction','rawAttributes','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','length','order','sort','where','filters','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','Tag','name','emit','removeTags','unix','toString','server','files','tmp','join','root','attachments','push','User'];(function(_0x2a04df,_0x48f2de){var _0x1369a2=function(_0x11724e){while(--_0x11724e){_0x2a04df['push'](_0x2a04df['shift']());}};_0x1369a2(++_0x48f2de);}(_0x9727,0x18a));var _0x7972=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x9727[_0x644560];return _0x41b76b;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x7972('0x0'));var util=require(_0x7972('0x1'));var path=require('path');var ejs=require(_0x7972('0x2'));var fs=require('fs');var _=require(_0x7972('0x3'));var Redis=require(_0x7972('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x7972('0x5'));var pdf=require(_0x7972('0x6'));var logger=require(_0x7972('0x7'))(_0x7972('0x8'));var config=require(_0x7972('0x9'));var db=require('../../mysqldb')['db'];config[_0x7972('0xa')]=_[_0x7972('0xb')](config[_0x7972('0xa')],{'host':_0x7972('0xc'),'port':0x18eb});var socket=require(_0x7972('0xd'))(new Redis(config[_0x7972('0xa')]));require('./openchannelInteraction.socket')[_0x7972('0xe')](socket);function respondWithStatusCode(_0x21435f,_0x552c24){_0x552c24=_0x552c24||0xcc;return function(_0x43b1c7){if(_0x43b1c7){return _0x21435f[_0x7972('0xf')](_0x552c24);}return _0x21435f['status'](_0x552c24)[_0x7972('0x10')]();};}function respondWithResult(_0x5500c7,_0x563312){_0x563312=_0x563312||0xc8;return function(_0x4291e1){if(_0x4291e1){return _0x5500c7[_0x7972('0x11')](_0x563312)[_0x7972('0x12')](_0x4291e1);}};}function respondWithFilteredResult(_0x2da42f,_0x10cd0){return function(_0x4de6dc){if(_0x4de6dc){var _0x2eacd8=typeof _0x10cd0[_0x7972('0x13')]===_0x7972('0x14')&&typeof _0x10cd0[_0x7972('0x15')]==='undefined';var _0x535a11=_0x4de6dc[_0x7972('0x16')];var _0x32056c=_0x2eacd8?0x0:_0x10cd0[_0x7972('0x13')];var _0x4a7151=_0x2eacd8?_0x4de6dc[_0x7972('0x16')]:_0x10cd0[_0x7972('0x13')]+_0x10cd0['limit'];var _0x106949;if(_0x4a7151>=_0x535a11){_0x4a7151=_0x535a11;_0x106949=0xc8;}else{_0x106949=0xce;}_0x2da42f[_0x7972('0x11')](_0x106949);return _0x2da42f['set'](_0x7972('0x17'),_0x32056c+'-'+_0x4a7151+'/'+_0x535a11)[_0x7972('0x12')](_0x4de6dc);}return null;};}function saveUpdates(_0x53b392){return function(_0x1dbea3){if(_0x1dbea3){return _0x1dbea3['update'](_0x53b392)[_0x7972('0x18')](function(_0x1eb0da){return _0x1eb0da;});}return null;};}function removeEntity(_0x30bae4){return function(_0xe401f4){if(_0xe401f4){return _0xe401f4['destroy']()[_0x7972('0x18')](function(){_0x30bae4[_0x7972('0x11')](0xcc)[_0x7972('0x10')]();});}};}function handleEntityNotFound(_0x26690a){return function(_0x3d6150){if(!_0x3d6150){_0x26690a[_0x7972('0xf')](0x194);}return _0x3d6150;};}function handleError(_0x200447,_0x502b61){_0x502b61=_0x502b61||0x1f4;return function(_0x543c7d){logger[_0x7972('0x19')](_0x543c7d[_0x7972('0x1a')]);if(_0x543c7d['name']){delete _0x543c7d['name'];}_0x200447[_0x7972('0x11')](_0x502b61)[_0x7972('0x1b')](_0x543c7d);};}exports['index']=function(_0x172565,_0x297b65){var _0x36be9f={};var _0x477747=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x30a94e){return{'name':_0x30a94e['fieldName'],'type':_0x30a94e['type']['key']};});_0x36be9f=qs[_0x7972('0x1c')](_0x477747,_0x172565);return interaction[_0x7972('0x1d')]('openchannel',_0x172565[_0x7972('0x1e')],_0x172565[_0x7972('0x1f')],_0x36be9f,_0x477747)[_0x7972('0x18')](respondWithFilteredResult(_0x297b65,_0x36be9f))[_0x7972('0x20')](handleError(_0x297b65,null));};exports[_0x7972('0x21')]=function(_0x281318,_0x1a5534){var _0x2299b8={};if(_0x281318[_0x7972('0x1e')][_0x7972('0x22')]&&_0x281318[_0x7972('0x1e')]['type']==='from'){_0x2299b8['from']=_0x281318[_0x7972('0x23')]['id'];}else{_0x2299b8['id']=_0x281318[_0x7972('0x23')]['id'];}var _0x25697c={'raw':![],'where':_0x2299b8},_0x21a2a1={};_0x21a2a1[_0x7972('0x24')]=_[_0x7972('0x25')](db[_0x7972('0x26')][_0x7972('0x27')]);_0x21a2a1[_0x7972('0x1e')]=_[_0x7972('0x25')](_0x281318['query']);_0x21a2a1['filters']=_[_0x7972('0x28')](_0x21a2a1[_0x7972('0x24')],_0x21a2a1[_0x7972('0x1e')]);_0x25697c[_0x7972('0x29')]=_['intersection'](_0x21a2a1[_0x7972('0x24')],qs[_0x7972('0x2a')](_0x281318[_0x7972('0x1e')][_0x7972('0x2a')]));_0x25697c[_0x7972('0x29')]=_0x25697c[_0x7972('0x29')]['length']?_0x25697c[_0x7972('0x29')]:_0x21a2a1[_0x7972('0x24')];if(_0x281318[_0x7972('0x1e')][_0x7972('0x2b')]){_0x25697c[_0x7972('0x2c')]=[{'all':!![]}];}_0x25697c=_[_0x7972('0x2d')]({},_0x25697c,_0x281318[_0x7972('0x2e')]);return db['OpenchannelInteraction'][_0x7972('0x2f')](_0x25697c)[_0x7972('0x18')](handleEntityNotFound(_0x1a5534,null))[_0x7972('0x18')](respondWithResult(_0x1a5534,null))[_0x7972('0x20')](handleError(_0x1a5534,null));};exports[_0x7972('0x30')]=function(_0x4e4339,_0xb1816){return db['OpenchannelInteraction'][_0x7972('0x30')](_0x4e4339[_0x7972('0x31')],{})[_0x7972('0x18')](respondWithResult(_0xb1816,0xc9))[_0x7972('0x20')](handleError(_0xb1816,null));};exports['update']=function(_0x1c52d5,_0x51ad05){if(_0x1c52d5[_0x7972('0x31')]['id']){delete _0x1c52d5[_0x7972('0x31')]['id'];}return db['OpenchannelInteraction'][_0x7972('0x2f')]({'where':{'id':_0x1c52d5['params']['id']}})[_0x7972('0x18')](handleEntityNotFound(_0x51ad05,null))['then'](saveUpdates(_0x1c52d5[_0x7972('0x31')],null))['then'](respondWithResult(_0x51ad05,null))[_0x7972('0x20')](handleError(_0x51ad05,null));};exports[_0x7972('0x32')]=function(_0x552d65,_0x3d39a9){return db[_0x7972('0x26')][_0x7972('0x2f')]({'where':{'id':_0x552d65[_0x7972('0x23')]['id']}})['then'](handleEntityNotFound(_0x3d39a9,null))[_0x7972('0x18')](removeEntity(_0x3d39a9,null))[_0x7972('0x20')](handleError(_0x3d39a9,null));};exports['describe']=function(_0x159a83,_0x1f5e38){return db[_0x7972('0x26')][_0x7972('0x33')]()['then'](respondWithResult(_0x1f5e38,null))[_0x7972('0x20')](handleError(_0x1f5e38,null));};exports[_0x7972('0x34')]=function(_0x21d049,_0xefe6a){return db['OpenchannelMessage'][_0x7972('0x2f')]({'where':{'id':_0x21d049[_0x7972('0x23')]['id']}})[_0x7972('0x18')](handleEntityNotFound(_0xefe6a,null))['then'](function(_0x47c0c1){if(_0x47c0c1){return _0x47c0c1[_0x7972('0x34')](_0x21d049[_0x7972('0x31')][_0x7972('0x35')],_['omit'](_0x21d049[_0x7972('0x31')],[_0x7972('0x35'),'id'])||{});}})[_0x7972('0x18')](respondWithResult(_0xefe6a,null))['catch'](handleError(_0xefe6a,null));};exports[_0x7972('0x36')]=function(_0x5c3d8b,_0xc03ff2){var _0x4d8774={'raw':![],'where':{}};var _0x5a25ae={};var _0x1ceabb={'count':0x0,'rows':[]};return db[_0x7972('0x26')][_0x7972('0x37')]({'where':{'id':_0x5c3d8b[_0x7972('0x23')]['id']}})[_0x7972('0x18')](handleEntityNotFound(_0xc03ff2,null))[_0x7972('0x18')](function(_0x28c6d2){if(_0x28c6d2){_0x5a25ae[_0x7972('0x24')]=_[_0x7972('0x25')](db[_0x7972('0x38')][_0x7972('0x27')]);_0x5a25ae[_0x7972('0x1e')]=_['keys'](_0x5c3d8b[_0x7972('0x1e')]);_0x5a25ae['filters']=_['intersection'](_0x5a25ae['model'],_0x5a25ae[_0x7972('0x1e')]);_0x4d8774[_0x7972('0x29')]=_['intersection'](_0x5a25ae[_0x7972('0x24')],qs[_0x7972('0x2a')](_0x5c3d8b[_0x7972('0x1e')]['fields']));_0x4d8774[_0x7972('0x29')]=_0x4d8774[_0x7972('0x29')][_0x7972('0x39')]?_0x4d8774[_0x7972('0x29')]:_0x5a25ae[_0x7972('0x24')];if(!_0x5c3d8b['query']['hasOwnProperty']('nolimit')){_0x4d8774['limit']=qs[_0x7972('0x15')](_0x5c3d8b[_0x7972('0x1e')][_0x7972('0x15')]);_0x4d8774['offset']=qs['offset'](_0x5c3d8b[_0x7972('0x1e')]['offset']);}_0x4d8774[_0x7972('0x3a')]=qs[_0x7972('0x3b')](_0x5c3d8b[_0x7972('0x1e')][_0x7972('0x3b')]);_0x4d8774[_0x7972('0x3c')]=qs[_0x7972('0x3d')](_['pick'](_0x5c3d8b[_0x7972('0x1e')],_0x5a25ae[_0x7972('0x3d')]));_0x4d8774[_0x7972('0x3c')][_0x7972('0x3e')]=_0x28c6d2['id'];if(_0x5c3d8b['query'][_0x7972('0x3f')]){_0x4d8774[_0x7972('0x3c')]=_[_0x7972('0x2d')](_0x4d8774['where'],{'$or':_['map'](_0x4d8774[_0x7972('0x29')],function(_0x49aa8e){var _0x5bd20b={};_0x5bd20b[_0x49aa8e]={'$like':'%'+_0x5c3d8b['query'][_0x7972('0x3f')]+'%'};return _0x5bd20b;})});}if(_0x5c3d8b[_0x7972('0x1e')][_0x7972('0x40')]){var _0x2319d2=_0x5c3d8b['query']['$gte'][_0x7972('0x41')](',');var _0x2fa17e={};_0x2fa17e[_0x2319d2[0x0]]={'$gte':moment(_0x2319d2[0x1])[_0x7972('0x42')](_0x7972('0x43'))};_0x4d8774[_0x7972('0x3c')]=_[_0x7972('0x2d')](_0x4d8774[_0x7972('0x3c')],_0x2fa17e);}_0x4d8774=_[_0x7972('0x2d')]({},_0x4d8774,_0x5c3d8b['options']);return db['OpenchannelMessage'][_0x7972('0x16')]({'where':_0x4d8774['where']})[_0x7972('0x18')](function(_0x340ad9){_0x1ceabb[_0x7972('0x16')]=_0x340ad9;if(_0x5c3d8b[_0x7972('0x1e')]['includeAll']){_0x4d8774[_0x7972('0x2c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7972('0x1d')](_0x4d8774);})['then'](function(_0x1c81f2){_0x1ceabb[_0x7972('0x44')]=_0x1c81f2;return _0x1ceabb;});}})[_0x7972('0x18')](respondWithFilteredResult(_0xc03ff2,_0x4d8774))[_0x7972('0x20')](handleError(_0xc03ff2,null));};exports[_0x7972('0x45')]=function(_0x58d87d,_0x22067a){return db[_0x7972('0x26')]['find']({'where':{'id':_0x58d87d['params']['id']}})[_0x7972('0x18')](handleEntityNotFound(_0x22067a,null))[_0x7972('0x18')](function(_0xee08c3){if(_0xee08c3){return _0xee08c3['setTags'](_0x58d87d[_0x7972('0x31')][_0x7972('0x35')],_[_0x7972('0x46')](_0x58d87d[_0x7972('0x31')],['ids','id'])||{})[_0x7972('0x47')](function(){return db[_0x7972('0x48')][_0x7972('0x1d')]({'attributes':['id',_0x7972('0x49'),'color'],'where':{'id':_0x58d87d['body'][_0x7972('0x35')]}});})[_0x7972('0x18')](function(_0x69fcdc){socket[_0x7972('0x4a')]('openchannelInteractionTags:save',{'id':Number(_0x58d87d['params']['id']),'tags':_0x69fcdc||[]});return{'id':Number(_0x58d87d[_0x7972('0x23')]['id']),'tags':_0x69fcdc||[]};});}})[_0x7972('0x18')](respondWithResult(_0x22067a,null))[_0x7972('0x20')](handleError(_0x22067a,null));};exports[_0x7972('0x4b')]=function(_0x4af89d,_0x276714){return db['OpenchannelInteraction'][_0x7972('0x2f')]({'where':{'id':_0x4af89d[_0x7972('0x23')]['id']}})[_0x7972('0x18')](handleEntityNotFound(_0x276714,null))[_0x7972('0x18')](function(_0x14b1d4){if(_0x14b1d4){return _0x14b1d4['removeTags'](_0x4af89d[_0x7972('0x1e')]['ids']);}})['then'](respondWithStatusCode(_0x276714,null))[_0x7972('0x20')](handleError(_0x276714,null));};exports['download']=function(_0x4a9f66,_0x7aab4d){var _0x3c71d4=moment()[_0x7972('0x4c')]()[_0x7972('0x4d')]();var _0x2d9063=path['join'](config['root'],_0x7972('0x4e'),_0x7972('0x4f'),_0x7972('0x50'));var _0x5e824c=path[_0x7972('0x51')](config[_0x7972('0x52')],_0x7972('0x4e'),'files',_0x7972('0x53'));var _0x5e1ac7=path[_0x7972('0x51')](_0x2d9063,_0x3c71d4);var _0x1e63a3=util[_0x7972('0x42')]('transcript-%d-%s.zip',_0x4a9f66['params']['id'],_0x3c71d4);var _0xa27e94=path[_0x7972('0x51')](_0x2d9063,_0x1e63a3);var _0x3a2407=[];_0x3a2407[_0x7972('0x54')]({'model':db[_0x7972('0x55')],'as':_0x7972('0x55'),'attributes':['id',_0x7972('0x56')],'raw':!![]});_0x3a2407[_0x7972('0x54')]({'model':db[_0x7972('0x57')],'as':_0x7972('0x58'),'attributes':['id',_0x7972('0x59'),_0x7972('0x5a')],'raw':!![]});if(_0x4a9f66[_0x7972('0x1e')]['attachments']){_0x3a2407['push']({'model':db['Attachment'],'as':_0x7972('0x5b'),'raw':!![]});}var _0x48879d=[{'model':db[_0x7972('0x38')],'as':_0x7972('0x5c'),'attributes':['id','body',_0x7972('0x5d'),_0x7972('0x5e'),_0x7972('0x5f'),_0x7972('0x60')],'include':_0x3a2407}];_0x48879d[_0x7972('0x54')]({'model':db[_0x7972('0x61')],'as':_0x7972('0x62'),'attributes':['id',_0x7972('0x49')]});_0x48879d[_0x7972('0x54')]({'model':db[_0x7972('0x55')],'as':'Owner','attributes':['id','fullname']});return db[_0x7972('0x26')]['find']({'where':{'id':_0x4a9f66[_0x7972('0x23')]['id']},'include':_0x48879d})['then'](handleEntityNotFound(_0x7aab4d,null))[_0x7972('0x18')](function(_0x580443){if(_0x580443){var _0x2be0f4=_0x580443[_0x7972('0x63')]({'plain':!![]});fs[_0x7972('0x64')](_0x5e1ac7);var _0x5155c1={'channel':_0x7972('0x65'),'account':_0x2be0f4['Account']['name'],'agent':_0x2be0f4[_0x7972('0x66')]?_0x2be0f4[_0x7972('0x66')]['fullname']:_0x7972('0x67'),'createdAt':moment(_0x2be0f4[_0x7972('0x5d')])['format'](_0x7972('0x43'))[_0x7972('0x4d')](),'closedAt':_0x2be0f4[_0x7972('0x68')]?moment(_0x2be0f4['closedAt'])[_0x7972('0x42')](_0x7972('0x43'))[_0x7972('0x4d')]():'','disposition':_0x2be0f4[_0x7972('0x69')],'visibility':_0x2be0f4['threadId']?'Public':_0x7972('0x6a'),'messages':_(_0x2be0f4[_0x7972('0x5c')])[_0x7972('0x3f')]({'secret':![]})[_0x7972('0x6b')](function(_0x30dc98){if(_0x30dc98[_0x7972('0x5b')]){var _0x9664f3=path[_0x7972('0x51')](_0x5e824c,_0x30dc98[_0x7972('0x5b')][_0x7972('0x6c')]);if(fs['existsSync'](_0x9664f3)){fs['createReadStream'](_0x9664f3)['pipe'](fs[_0x7972('0x6d')](path[_0x7972('0x51')](_0x5e1ac7,_0x30dc98[_0x7972('0x5b')][_0x7972('0x6c')])));}}return{'date':moment(_0x30dc98[_0x7972('0x5d')])['format'](_0x7972('0x43'))['toString'](),'sender':_0x30dc98[_0x7972('0x5e')]===_0x7972('0x6e')?_0x30dc98['User']?_0x30dc98['User'][_0x7972('0x56')]:_0x7972('0x6f'):_0x30dc98[_0x7972('0x58')][_0x7972('0x59')]+(_0x30dc98['Contact'][_0x7972('0x5a')]?'\x20'+_0x30dc98[_0x7972('0x58')][_0x7972('0x5a')]:''),'body':_0x30dc98[_0x7972('0x5b')]?_0x30dc98['Attachment']['basename']:_0x30dc98[_0x7972('0x31')],'direction':_0x30dc98['direction']===_0x7972('0x6e')?'A':'C','secret':_0x30dc98[_0x7972('0x5f')],'read':_0x30dc98[_0x7972('0x60')],'attachment':_0x30dc98['Attachment']};})[_0x7972('0x70')]()};return ejs[_0x7972('0x71')](path[_0x7972('0x51')](config['root'],_0x7972('0x4e'),_0x7972('0x72'),_0x7972('0x73')),{'interaction':_0x5155c1})[_0x7972('0x18')](function(_0x25a299){var _0x2d30a6=path['join'](_0x5e1ac7,_0x7972('0x74')+_0x2be0f4['id']+'-'+_0x3c71d4+_0x7972('0x75'));var _0x39a8e5={'path':_0x2d30a6,'channel':_0x7972('0x65'),'interactionId':_0x2be0f4['id']};return pdf[_0x7972('0x76')](_0x25a299,_0x39a8e5);})[_0x7972('0x18')](function(){return new Promise(function(_0x354470,_0x14bc06){zipdir(_0x5e1ac7,{'saveTo':_0xa27e94},function(_0x13ae1c,_0x165073){if(_0x13ae1c)return _0x14bc06(_0x13ae1c);return _0x354470(_0x165073);});})[_0x7972('0x18')](function(){return new Promise(function(_0x120aa7,_0x4f15ac){rimraf(_0x5e1ac7,function(_0x69e094){if(_0x69e094)_0x4f15ac(_0x69e094);return _0x120aa7();});});})[_0x7972('0x18')](function(){return _0x7aab4d['download'](_0xa27e94,_0x1e63a3,function(_0x566dda){if(_0x566dda){logger[_0x7972('0x19')](_0x7972('0x77'),_0x566dda);}else{fs['unlinkSync'](_0xa27e94);}});});});}else{return _0x7aab4d[_0x7972('0xf')](0xc8);}})['catch'](handleError(_0x7aab4d,null));}; \ No newline at end of file +var _0x8348=['destroy','error','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','key','findAll','openchannel','query','show','type','from','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','findOne','nolimit','sort','where','pick','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','OpenchannelMessage','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','join','files','root','server','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','createdAt','toString','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','download','Unable\x20to\x20delete\x20zip\x20file','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then'];(function(_0x434029,_0x18b9c){var _0x3efaca=function(_0x3e8564){while(--_0x3e8564){_0x434029['push'](_0x434029['shift']());}};_0x3efaca(++_0x18b9c);}(_0x8348,0x64));var _0x8834=function(_0x499b9c,_0x3b795c){_0x499b9c=_0x499b9c-0x0;var _0x255a75=_0x8348[_0x499b9c];return _0x255a75;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x8834('0x0'));var moment=require(_0x8834('0x1'));var util=require(_0x8834('0x2'));var path=require(_0x8834('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8834('0x4'));var Redis=require(_0x8834('0x5'));var interaction=require(_0x8834('0x6'));var qs=require(_0x8834('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x8834('0x8'))('api');var config=require(_0x8834('0x9'));var db=require(_0x8834('0xa'))['db'];config[_0x8834('0xb')]=_[_0x8834('0xc')](config[_0x8834('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8834('0xd'))(new Redis(config[_0x8834('0xb')]));require(_0x8834('0xe'))[_0x8834('0xf')](socket);function respondWithStatusCode(_0x3a1e4e,_0x4ebe1e){_0x4ebe1e=_0x4ebe1e||0xcc;return function(_0x23a70e){if(_0x23a70e){return _0x3a1e4e[_0x8834('0x10')](_0x4ebe1e);}return _0x3a1e4e['status'](_0x4ebe1e)[_0x8834('0x11')]();};}function respondWithResult(_0x457d0a,_0x437392){_0x437392=_0x437392||0xc8;return function(_0xe20182){if(_0xe20182){return _0x457d0a['status'](_0x437392)[_0x8834('0x12')](_0xe20182);}};}function respondWithFilteredResult(_0x2d616e,_0x5711a3){return function(_0x23b9e6){if(_0x23b9e6){var _0x231f58=typeof _0x5711a3[_0x8834('0x13')]===_0x8834('0x14')&&typeof _0x5711a3[_0x8834('0x15')]===_0x8834('0x14');var _0x49b7a0=_0x23b9e6[_0x8834('0x16')];var _0x891a8a=_0x231f58?0x0:_0x5711a3[_0x8834('0x13')];var _0x15cece=_0x231f58?_0x23b9e6[_0x8834('0x16')]:_0x5711a3[_0x8834('0x13')]+_0x5711a3[_0x8834('0x15')];var _0x1dc09b;if(_0x15cece>=_0x49b7a0){_0x15cece=_0x49b7a0;_0x1dc09b=0xc8;}else{_0x1dc09b=0xce;}_0x2d616e[_0x8834('0x17')](_0x1dc09b);return _0x2d616e[_0x8834('0x18')](_0x8834('0x19'),_0x891a8a+'-'+_0x15cece+'/'+_0x49b7a0)[_0x8834('0x12')](_0x23b9e6);}return null;};}function saveUpdates(_0x51d0f3){return function(_0x275f0a){if(_0x275f0a){return _0x275f0a[_0x8834('0x1a')](_0x51d0f3)[_0x8834('0x1b')](function(_0x5edff5){return _0x5edff5;});}return null;};}function removeEntity(_0x4b3210){return function(_0x2fb109){if(_0x2fb109){return _0x2fb109[_0x8834('0x1c')]()[_0x8834('0x1b')](function(){_0x4b3210[_0x8834('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d6df0){return function(_0x42f944){if(!_0x42f944){_0x1d6df0[_0x8834('0x10')](0x194);}return _0x42f944;};}function handleError(_0x528fe0,_0x2b8fc3){_0x2b8fc3=_0x2b8fc3||0x1f4;return function(_0x21d3c0){logger[_0x8834('0x1d')](_0x21d3c0['stack']);if(_0x21d3c0['name']){delete _0x21d3c0[_0x8834('0x1e')];}_0x528fe0[_0x8834('0x17')](_0x2b8fc3)[_0x8834('0x1f')](_0x21d3c0);};}exports[_0x8834('0x20')]=function(_0x205278,_0x44f476){var _0x27394c={};var _0x149258=_['map'](db[_0x8834('0x21')][_0x8834('0x22')],function(_0xbbe285){return{'name':_0xbbe285[_0x8834('0x23')],'type':_0xbbe285['type'][_0x8834('0x24')]};});_0x27394c=qs['getOptions'](_0x149258,_0x205278);return interaction[_0x8834('0x25')](_0x8834('0x26'),_0x205278[_0x8834('0x27')],_0x205278['user'],_0x27394c,_0x149258)[_0x8834('0x1b')](respondWithFilteredResult(_0x44f476,_0x27394c))['catch'](handleError(_0x44f476,null));};exports[_0x8834('0x28')]=function(_0x426878,_0x11cfb3){var _0x30af2f={};if(_0x426878[_0x8834('0x27')][_0x8834('0x29')]&&_0x426878[_0x8834('0x27')][_0x8834('0x29')]==='from'){_0x30af2f[_0x8834('0x2a')]=_0x426878[_0x8834('0x2b')]['id'];}else{_0x30af2f['id']=_0x426878['params']['id'];}var _0x2862fa={'raw':![],'where':_0x30af2f},_0xdab1b1={};_0xdab1b1[_0x8834('0x2c')]=_[_0x8834('0x2d')](db[_0x8834('0x21')][_0x8834('0x22')]);_0xdab1b1[_0x8834('0x27')]=_[_0x8834('0x2d')](_0x426878[_0x8834('0x27')]);_0xdab1b1[_0x8834('0x2e')]=_[_0x8834('0x2f')](_0xdab1b1[_0x8834('0x2c')],_0xdab1b1[_0x8834('0x27')]);_0x2862fa[_0x8834('0x30')]=_[_0x8834('0x2f')](_0xdab1b1[_0x8834('0x2c')],qs['fields'](_0x426878[_0x8834('0x27')][_0x8834('0x31')]));_0x2862fa[_0x8834('0x30')]=_0x2862fa['attributes'][_0x8834('0x32')]?_0x2862fa[_0x8834('0x30')]:_0xdab1b1[_0x8834('0x2c')];if(_0x426878[_0x8834('0x27')]['includeAll']){_0x2862fa[_0x8834('0x33')]=[{'all':!![]}];}_0x2862fa=_[_0x8834('0x34')]({},_0x2862fa,_0x426878[_0x8834('0x35')]);return db['OpenchannelInteraction'][_0x8834('0x36')](_0x2862fa)[_0x8834('0x1b')](handleEntityNotFound(_0x11cfb3,null))[_0x8834('0x1b')](respondWithResult(_0x11cfb3,null))[_0x8834('0x37')](handleError(_0x11cfb3,null));};exports[_0x8834('0x38')]=function(_0x1602a1,_0x19661d){return db[_0x8834('0x21')][_0x8834('0x38')](_0x1602a1[_0x8834('0x39')],{})['then'](respondWithResult(_0x19661d,0xc9))[_0x8834('0x37')](handleError(_0x19661d,null));};exports[_0x8834('0x1a')]=function(_0x4a41f0,_0x545a21){if(_0x4a41f0['body']['id']){delete _0x4a41f0[_0x8834('0x39')]['id'];}return db['OpenchannelInteraction'][_0x8834('0x36')]({'where':{'id':_0x4a41f0[_0x8834('0x2b')]['id']}})[_0x8834('0x1b')](handleEntityNotFound(_0x545a21,null))[_0x8834('0x1b')](saveUpdates(_0x4a41f0[_0x8834('0x39')],null))[_0x8834('0x1b')](respondWithResult(_0x545a21,null))[_0x8834('0x37')](handleError(_0x545a21,null));};exports[_0x8834('0x1c')]=function(_0x399110,_0x1d72d3){return db[_0x8834('0x21')][_0x8834('0x36')]({'where':{'id':_0x399110['params']['id']}})[_0x8834('0x1b')](handleEntityNotFound(_0x1d72d3,null))['then'](removeEntity(_0x1d72d3,null))['catch'](handleError(_0x1d72d3,null));};exports[_0x8834('0x3a')]=function(_0x102286,_0x2c1a06){return db[_0x8834('0x21')][_0x8834('0x3a')]()[_0x8834('0x1b')](respondWithResult(_0x2c1a06,null))[_0x8834('0x37')](handleError(_0x2c1a06,null));};exports[_0x8834('0x3b')]=function(_0x3342dd,_0xe89a7c){return db['OpenchannelMessage'][_0x8834('0x36')]({'where':{'id':_0x3342dd['params']['id']}})[_0x8834('0x1b')](handleEntityNotFound(_0xe89a7c,null))['then'](function(_0x57cbd8){if(_0x57cbd8){return _0x57cbd8[_0x8834('0x3b')](_0x3342dd[_0x8834('0x39')][_0x8834('0x3c')],_[_0x8834('0x3d')](_0x3342dd[_0x8834('0x39')],[_0x8834('0x3c'),'id'])||{});}})[_0x8834('0x1b')](respondWithResult(_0xe89a7c,null))['catch'](handleError(_0xe89a7c,null));};exports['getMessages']=function(_0x55d801,_0x18f6be){var _0x2b5640={'raw':![],'where':{}};var _0x3f922a={};var _0x2cf24f={'count':0x0,'rows':[]};return db[_0x8834('0x21')][_0x8834('0x3e')]({'where':{'id':_0x55d801[_0x8834('0x2b')]['id']}})[_0x8834('0x1b')](handleEntityNotFound(_0x18f6be,null))['then'](function(_0x5a88d0){if(_0x5a88d0){_0x3f922a[_0x8834('0x2c')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x3f922a[_0x8834('0x27')]=_['keys'](_0x55d801[_0x8834('0x27')]);_0x3f922a[_0x8834('0x2e')]=_[_0x8834('0x2f')](_0x3f922a[_0x8834('0x2c')],_0x3f922a[_0x8834('0x27')]);_0x2b5640[_0x8834('0x30')]=_[_0x8834('0x2f')](_0x3f922a[_0x8834('0x2c')],qs[_0x8834('0x31')](_0x55d801[_0x8834('0x27')][_0x8834('0x31')]));_0x2b5640['attributes']=_0x2b5640[_0x8834('0x30')][_0x8834('0x32')]?_0x2b5640['attributes']:_0x3f922a['model'];if(!_0x55d801[_0x8834('0x27')]['hasOwnProperty'](_0x8834('0x3f'))){_0x2b5640[_0x8834('0x15')]=qs[_0x8834('0x15')](_0x55d801[_0x8834('0x27')][_0x8834('0x15')]);_0x2b5640[_0x8834('0x13')]=qs['offset'](_0x55d801[_0x8834('0x27')]['offset']);}_0x2b5640['order']=qs[_0x8834('0x40')](_0x55d801[_0x8834('0x27')]['sort']);_0x2b5640[_0x8834('0x41')]=qs[_0x8834('0x2e')](_[_0x8834('0x42')](_0x55d801[_0x8834('0x27')],_0x3f922a[_0x8834('0x2e')]));_0x2b5640[_0x8834('0x41')]['OpenchannelInteractionId']=_0x5a88d0['id'];if(_0x55d801[_0x8834('0x27')]['filter']){_0x2b5640['where']=_[_0x8834('0x34')](_0x2b5640[_0x8834('0x41')],{'$or':_[_0x8834('0x43')](_0x2b5640[_0x8834('0x30')],function(_0x172f4e){var _0x739313={};_0x739313[_0x172f4e]={'$like':'%'+_0x55d801['query'][_0x8834('0x44')]+'%'};return _0x739313;})});}if(_0x55d801[_0x8834('0x27')]['$gte']){var _0x51f8b5=_0x55d801[_0x8834('0x27')][_0x8834('0x45')][_0x8834('0x46')](',');var _0x4f69f8={};_0x4f69f8[_0x51f8b5[0x0]]={'$gte':moment(_0x51f8b5[0x1])[_0x8834('0x47')](_0x8834('0x48'))};_0x2b5640[_0x8834('0x41')]=_[_0x8834('0x34')](_0x2b5640[_0x8834('0x41')],_0x4f69f8);}_0x2b5640=_['merge']({},_0x2b5640,_0x55d801['options']);return db['OpenchannelMessage'][_0x8834('0x16')]({'where':_0x2b5640[_0x8834('0x41')]})[_0x8834('0x1b')](function(_0x4a9625){_0x2cf24f[_0x8834('0x16')]=_0x4a9625;if(_0x55d801[_0x8834('0x27')][_0x8834('0x49')]){_0x2b5640[_0x8834('0x33')]=[{'all':!![]}];}return db[_0x8834('0x4a')][_0x8834('0x25')](_0x2b5640);})[_0x8834('0x1b')](function(_0x5a9f67){_0x2cf24f[_0x8834('0x4b')]=_0x5a9f67;return _0x2cf24f;});}})['then'](respondWithFilteredResult(_0x18f6be,_0x2b5640))[_0x8834('0x37')](handleError(_0x18f6be,null));};exports[_0x8834('0x4c')]=function(_0x28f0c5,_0x467cd8){return db['OpenchannelInteraction']['find']({'where':{'id':_0x28f0c5[_0x8834('0x2b')]['id']}})[_0x8834('0x1b')](handleEntityNotFound(_0x467cd8,null))[_0x8834('0x1b')](function(_0x54321e){if(_0x54321e){return _0x54321e[_0x8834('0x4d')](_0x28f0c5[_0x8834('0x39')][_0x8834('0x3c')],_[_0x8834('0x3d')](_0x28f0c5[_0x8834('0x39')],['ids','id'])||{})[_0x8834('0x4e')](function(){return db[_0x8834('0x4f')][_0x8834('0x25')]({'attributes':['id',_0x8834('0x1e'),_0x8834('0x50')],'where':{'id':_0x28f0c5[_0x8834('0x39')]['ids']}});})[_0x8834('0x1b')](function(_0x37950c){socket[_0x8834('0x51')](_0x8834('0x52'),{'id':Number(_0x28f0c5[_0x8834('0x2b')]['id']),'tags':_0x37950c||[]});return{'id':Number(_0x28f0c5['params']['id']),'tags':_0x37950c||[]};});}})[_0x8834('0x1b')](respondWithResult(_0x467cd8,null))['catch'](handleError(_0x467cd8,null));};exports[_0x8834('0x53')]=function(_0x17a62f,_0x34c683){return db[_0x8834('0x21')][_0x8834('0x36')]({'where':{'id':_0x17a62f[_0x8834('0x2b')]['id']}})[_0x8834('0x1b')](handleEntityNotFound(_0x34c683,null))[_0x8834('0x1b')](function(_0x157b58){if(_0x157b58){return _0x157b58['removeTags'](_0x17a62f[_0x8834('0x27')][_0x8834('0x3c')]);}})['then'](respondWithStatusCode(_0x34c683,null))['catch'](handleError(_0x34c683,null));};exports['download']=function(_0x3fa1a,_0x4f5012){var _0x45fe7=moment()[_0x8834('0x54')]()['toString']();var _0x4a2b6f=path[_0x8834('0x55')](config['root'],'server',_0x8834('0x56'),'tmp');var _0x21841c=path[_0x8834('0x55')](config[_0x8834('0x57')],_0x8834('0x58'),_0x8834('0x56'),_0x8834('0x59'));var _0x115629=path[_0x8834('0x55')](_0x4a2b6f,_0x45fe7);var _0x373de1=util[_0x8834('0x47')](_0x8834('0x5a'),_0x3fa1a['params']['id'],_0x45fe7);var _0x490f82=path[_0x8834('0x55')](_0x4a2b6f,_0x373de1);var _0x1bc7eb=[];_0x1bc7eb['push']({'model':db[_0x8834('0x5b')],'as':_0x8834('0x5b'),'attributes':['id',_0x8834('0x5c')],'raw':!![]});_0x1bc7eb[_0x8834('0x5d')]({'model':db['CmContact'],'as':_0x8834('0x5e'),'attributes':['id',_0x8834('0x5f'),_0x8834('0x60')],'raw':!![]});if(_0x3fa1a['query']['attachments']){_0x1bc7eb['push']({'model':db[_0x8834('0x61')],'as':'Attachment','raw':!![]});}var _0x37925b=[{'model':db['OpenchannelMessage'],'as':_0x8834('0x62'),'attributes':['id',_0x8834('0x39'),'createdAt',_0x8834('0x63'),_0x8834('0x64'),_0x8834('0x65')],'include':_0x1bc7eb}];_0x37925b[_0x8834('0x5d')]({'model':db[_0x8834('0x66')],'as':_0x8834('0x67'),'attributes':['id',_0x8834('0x1e')]});_0x37925b[_0x8834('0x5d')]({'model':db[_0x8834('0x5b')],'as':'Owner','attributes':['id',_0x8834('0x5c')]});return db[_0x8834('0x21')][_0x8834('0x36')]({'where':{'id':_0x3fa1a['params']['id']},'include':_0x37925b})[_0x8834('0x1b')](handleEntityNotFound(_0x4f5012,null))[_0x8834('0x1b')](function(_0x2df2e0){if(_0x2df2e0){var _0x4ee757=_0x2df2e0['get']({'plain':!![]});fs[_0x8834('0x68')](_0x115629);var _0x12673b={'channel':_0x8834('0x69'),'account':_0x4ee757[_0x8834('0x67')]['name'],'agent':_0x4ee757[_0x8834('0x6a')]?_0x4ee757[_0x8834('0x6a')][_0x8834('0x5c')]:_0x8834('0x6b'),'createdAt':moment(_0x4ee757[_0x8834('0x6c')])[_0x8834('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8834('0x6d')](),'closedAt':_0x4ee757[_0x8834('0x6e')]?moment(_0x4ee757[_0x8834('0x6f')])[_0x8834('0x47')](_0x8834('0x48'))[_0x8834('0x6d')]():'','disposition':_0x4ee757[_0x8834('0x70')],'visibility':_0x4ee757[_0x8834('0x71')]?_0x8834('0x72'):'Private','messages':_(_0x4ee757[_0x8834('0x62')])[_0x8834('0x44')]({'secret':![]})[_0x8834('0x43')](function(_0x1c0f16){if(_0x1c0f16[_0x8834('0x61')]){var _0x4f54e7=path[_0x8834('0x55')](_0x21841c,_0x1c0f16['Attachment'][_0x8834('0x73')]);if(fs[_0x8834('0x74')](_0x4f54e7)){fs[_0x8834('0x75')](_0x4f54e7)[_0x8834('0x76')](fs[_0x8834('0x77')](path['join'](_0x115629,_0x1c0f16['Attachment']['basename'])));}}return{'date':moment(_0x1c0f16[_0x8834('0x6c')])[_0x8834('0x47')](_0x8834('0x48'))[_0x8834('0x6d')](),'sender':_0x1c0f16[_0x8834('0x63')]==='out'?_0x1c0f16['User']?_0x1c0f16[_0x8834('0x5b')][_0x8834('0x5c')]:_0x8834('0x78'):_0x1c0f16[_0x8834('0x5e')]['firstName']+(_0x1c0f16['Contact'][_0x8834('0x60')]?'\x20'+_0x1c0f16['Contact'][_0x8834('0x60')]:''),'body':_0x1c0f16[_0x8834('0x61')]?_0x1c0f16[_0x8834('0x61')][_0x8834('0x73')]:_0x1c0f16[_0x8834('0x39')],'direction':_0x1c0f16['direction']===_0x8834('0x79')?'A':'C','secret':_0x1c0f16[_0x8834('0x64')],'read':_0x1c0f16[_0x8834('0x65')],'attachment':_0x1c0f16['Attachment']};})['value']()};return ejs[_0x8834('0x7a')](path[_0x8834('0x55')](config['root'],'server','views',_0x8834('0x7b')),{'interaction':_0x12673b})[_0x8834('0x1b')](function(_0x491182){var _0x54d6df=path[_0x8834('0x55')](_0x115629,_0x8834('0x7c')+_0x4ee757['id']+'-'+_0x45fe7+_0x8834('0x7d'));var _0x4f59d1={'path':_0x54d6df,'channel':_0x8834('0x69'),'interactionId':_0x4ee757['id']};return pdf['createPdfFromHTML'](_0x491182,_0x4f59d1);})[_0x8834('0x1b')](function(){return new Promise(function(_0x46aec2,_0x463c94){zipdir(_0x115629,{'saveTo':_0x490f82},function(_0x3ce8b0,_0xc39f22){if(_0x3ce8b0)return _0x463c94(_0x3ce8b0);return _0x46aec2(_0xc39f22);});})[_0x8834('0x1b')](function(){return new Promise(function(_0x4b0e3e,_0x4d91ad){rimraf(_0x115629,function(_0x4d0d64){if(_0x4d0d64)_0x4d91ad(_0x4d0d64);return _0x4b0e3e();});});})['then'](function(){return _0x4f5012[_0x8834('0x7e')](_0x490f82,_0x373de1,function(_0x50f295){if(_0x50f295){logger[_0x8834('0x1d')](_0x8834('0x7f'),_0x50f295);}else{fs['unlinkSync'](_0x490f82);}});});});}else{return _0x4f5012['sendStatus'](0xc8);}})[_0x8834('0x37')](handleError(_0x4f5012,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index df7f7c1..059ebb3 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 _0x0193=['Users','map','findAll','unreadMessages','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x10355a,_0x5ab3b9){var _0x3481ba=function(_0x271719){while(--_0x271719){_0x10355a['push'](_0x10355a['shift']());}};_0x3481ba(++_0x5ab3b9);}(_0x0193,0xd9));var _0x3019=function(_0x59c95f,_0xe7dbe7){_0x59c95f=_0x59c95f-0x0;var _0x42b4d5=_0x0193[_0x59c95f];return _0x42b4d5;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x3019('0x0'))['db'][_0x3019('0x1')];var OpenchannelMessage=require(_0x3019('0x0'))['db'][_0x3019('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3019('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3019('0x4'),'afterDestroy':_0x3019('0x5')};function emitEvent(_0x5d7feb){return function(_0x267ada,_0x285a54,_0x200c5f){_0x267ada[_0x3019('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d7a70){_0x267ada[_0x3019('0x7')](_0x3019('0x8'),_0x1d7a70[_0x3019('0x9')](function(_0x12c3ad){return{'id':_0x12c3ad['id']};}));return OpenchannelMessage[_0x3019('0xa')]({'where':{'OpenchannelInteractionId':_0x267ada['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x345ace){_0x267ada[_0x3019('0x7')](_0x3019('0xb'),_0x345ace['length']);OpenchannelInteractionEvents['emit'](_0x5d7feb+':'+_0x267ada['id'],_0x267ada);OpenchannelInteractionEvents[_0x3019('0xc')](_0x5d7feb,_0x267ada);_0x200c5f(null);})['catch'](_0x200c5f(null));};}for(var e in events){if(events[_0x3019('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x3019('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb135=['hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch'];(function(_0x1162f8,_0x5f2615){var _0x5cd82a=function(_0x86b232){while(--_0x86b232){_0x1162f8['push'](_0x1162f8['shift']());}};_0x5cd82a(++_0x5f2615);}(_0xb135,0xab));var _0x5b13=function(_0xe7689b,_0x299227){_0xe7689b=_0xe7689b-0x0;var _0x3ea6fb=_0xb135[_0xe7689b];return _0x3ea6fb;};'use strict';var EventEmitter=require(_0x5b13('0x0'));var OpenchannelInteraction=require(_0x5b13('0x1'))['db'][_0x5b13('0x2')];var OpenchannelMessage=require(_0x5b13('0x1'))['db'][_0x5b13('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5b13('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b13('0x5'),'afterDestroy':_0x5b13('0x6')};function emitEvent(_0x446e85){return function(_0x46e7c4,_0x256182,_0x45a98b){_0x46e7c4[_0x5b13('0x7')]({'attributes':['id'],'raw':!![]})[_0x5b13('0x8')](function(_0x46203d){_0x46e7c4[_0x5b13('0x9')](_0x5b13('0xa'),_0x46203d[_0x5b13('0xb')](function(_0x222978){return{'id':_0x222978['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x46e7c4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5b13('0x8')](function(_0x2e37f5){_0x46e7c4[_0x5b13('0x9')](_0x5b13('0xc'),_0x2e37f5[_0x5b13('0xd')]);OpenchannelInteractionEvents['emit'](_0x446e85+':'+_0x46e7c4['id'],_0x46e7c4);OpenchannelInteractionEvents[_0x5b13('0xe')](_0x446e85,_0x46e7c4);_0x45a98b(null);})[_0x5b13('0xf')](_0x45a98b(null));};}for(var e in events){if(events[_0x5b13('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](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 c983d8f..63c6189 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 _0x0a14=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3bb7d1,_0x5913e9){var _0x15a5be=function(_0x9d2542){while(--_0x9d2542){_0x3bb7d1['push'](_0x3bb7d1['shift']());}};_0x15a5be(++_0x5913e9);}(_0x0a14,0x120));var _0x40a1=function(_0x30afa8,_0x4f089d){_0x30afa8=_0x30afa8-0x0;var _0x4286b7=_0x0a14[_0x30afa8];return _0x4286b7;};'use strict';var _=require(_0x40a1('0x0'));var util=require(_0x40a1('0x1'));var logger=require(_0x40a1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x40a1('0x3'));var rp=require(_0x40a1('0x4'));var fs=require('fs');var path=require(_0x40a1('0x5'));var rimraf=require(_0x40a1('0x6'));var config=require(_0x40a1('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x40a1('0x8')]=function(_0x28da3d,_0x52bc3c){return _0x28da3d[_0x40a1('0x9')](_0x40a1('0xa'),attributes,{'tableName':_0x40a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x40a1('0xc'),'hooks':{'beforeUpdate':function(_0x1734aa,_0x46bf4b,_0x145f43){if(_0x1734aa[_0x40a1('0xd')](_0x40a1('0xe'))){_0x1734aa[_0x40a1('0xf')]=moment()[_0x40a1('0x10')](_0x40a1('0x11'));}_0x145f43(null,_0x1734aa);}}});}; \ No newline at end of file +var _0xe557=['rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','path'];(function(_0x9f970c,_0x39b548){var _0x1d1e3c=function(_0x86fda2){while(--_0x86fda2){_0x9f970c['push'](_0x9f970c['shift']());}};_0x1d1e3c(++_0x39b548);}(_0xe557,0x154));var _0x7e55=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe557[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x7e55('0x0'));var util=require(_0x7e55('0x1'));var logger=require(_0x7e55('0x2'))('api');var moment=require(_0x7e55('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e55('0x4'));var rimraf=require(_0x7e55('0x5'));var config=require(_0x7e55('0x6'));var attributes=require(_0x7e55('0x7'));module['exports']=function(_0x3f6a10,_0x48ccac){return _0x3f6a10[_0x7e55('0x8')](_0x7e55('0x9'),attributes,{'tableName':_0x7e55('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x230c27,_0xea0fe4,_0x2f6b00){if(_0x230c27['changed'](_0x7e55('0xb'))){_0x230c27[_0x7e55('0xc')]=moment()[_0x7e55('0xd')](_0x7e55('0xe'));}_0x2f6b00(null,_0x230c27);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 5c4ca1c..ee91ed5 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 _0x5bcf=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','catch','find','addTags','omit','AddTags','stringify','lodash','util','moment','randomstring'];(function(_0x22579d,_0x55e681){var _0x211f24=function(_0x23aea1){while(--_0x23aea1){_0x22579d['push'](_0x22579d['shift']());}};_0x211f24(++_0x55e681);}(_0x5bcf,0xf2));var _0xf5bc=function(_0xa452c4,_0x1ee154){_0xa452c4=_0xa452c4-0x0;var _0x5b9bbc=_0x5bcf[_0xa452c4];return _0x5b9bbc;};'use strict';var _=require(_0xf5bc('0x0'));var util=require(_0xf5bc('0x1'));var moment=require(_0xf5bc('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5bc('0x3'));var fs=require('fs');var Redis=require(_0xf5bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5bc('0x5'));var logger=require(_0xf5bc('0x6'))(_0xf5bc('0x7'));var config=require(_0xf5bc('0x8'));var jayson=require(_0xf5bc('0x9'));var client=jayson['client'][_0xf5bc('0xa')]({'port':0x232a});config[_0xf5bc('0xb')]=_['defaults'](config[_0xf5bc('0xb')],{'host':_0xf5bc('0xc'),'port':0x18eb});var socket=require(_0xf5bc('0xd'))(new Redis(config[_0xf5bc('0xb')]));require(_0xf5bc('0xe'))[_0xf5bc('0xf')](socket);function respondWithRpcPromise(_0x1c23f8,_0x508aba,_0x2e7adf){return new BPromise(function(_0x4df53a,_0x62730){return client[_0xf5bc('0x10')](_0x1c23f8,_0x2e7adf)[_0xf5bc('0x11')](function(_0x27c2be){logger[_0xf5bc('0x12')](_0xf5bc('0x13'),_0x508aba,_0xf5bc('0x14'));logger[_0xf5bc('0x15')](_0xf5bc('0x16'),_0x508aba,_0xf5bc('0x14'),JSON['stringify'](_0x27c2be));if(_0x27c2be[_0xf5bc('0x17')]){if(_0x27c2be[_0xf5bc('0x17')][_0xf5bc('0x18')]===0x1f4){logger[_0xf5bc('0x17')](_0xf5bc('0x13'),_0x508aba,_0x27c2be[_0xf5bc('0x17')]['message']);return _0x62730(_0x27c2be[_0xf5bc('0x17')][_0xf5bc('0x19')]);}logger[_0xf5bc('0x17')](_0xf5bc('0x13'),_0x508aba,_0x27c2be[_0xf5bc('0x17')][_0xf5bc('0x19')]);return _0x4df53a(_0x27c2be[_0xf5bc('0x17')]['message']);}else{logger['info'](_0xf5bc('0x13'),_0x508aba,_0xf5bc('0x14'));_0x4df53a(_0x27c2be[_0xf5bc('0x1a')]['message']);}})['catch'](function(_0x4f6457){logger[_0xf5bc('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x508aba,_0x4f6457);_0x62730(_0x4f6457);});});}exports[_0xf5bc('0x1b')]=function(_0x408b90){var _0x748eca=this;return new Promise(function(_0x10a8df,_0x5ca2d9){return db[_0xf5bc('0x1c')][_0xf5bc('0x1d')](_0x408b90[_0xf5bc('0x1e')],{'raw':_0x408b90[_0xf5bc('0x1f')]?_0x408b90[_0xf5bc('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408b90[_0xf5bc('0x1f')]?_0x408b90[_0xf5bc('0x1f')][_0xf5bc('0x20')]||null:null,'attributes':_0x408b90[_0xf5bc('0x1f')]?_0x408b90[_0xf5bc('0x1f')][_0xf5bc('0x21')]||null:null,'limit':_0x408b90['options']?_0x408b90[_0xf5bc('0x1f')][_0xf5bc('0x22')]||null:null})[_0xf5bc('0x11')](function(_0x8e301d){logger[_0xf5bc('0x12')](_0xf5bc('0x1b'),_0x408b90);logger[_0xf5bc('0x15')](_0xf5bc('0x1b'),_0x408b90,JSON['stringify'](_0x8e301d));_0x10a8df(_0x8e301d);})[_0xf5bc('0x23')](function(_0x200e97){logger[_0xf5bc('0x17')](_0xf5bc('0x1b'),_0x200e97[_0xf5bc('0x19')],_0x408b90);_0x5ca2d9(_0x748eca[_0xf5bc('0x17')](0x1f4,_0x200e97[_0xf5bc('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x5b09a1){return new Promise(function(_0x6992be,_0x7f8424){return db[_0xf5bc('0x1c')][_0xf5bc('0x24')]({'where':_0x5b09a1[_0xf5bc('0x1f')]?_0x5b09a1[_0xf5bc('0x1f')][_0xf5bc('0x20')]||null:null})[_0xf5bc('0x11')](function(_0x9c3e7c){if(_0x9c3e7c){return _0x9c3e7c[_0xf5bc('0x25')](_0x5b09a1[_0xf5bc('0x1e')]['ids'],_[_0xf5bc('0x26')](_0x5b09a1[_0xf5bc('0x1e')],['ids','id'])||{});}})['spread'](function(_0x5634dc){logger[_0xf5bc('0x12')](_0xf5bc('0x27'),_0x5b09a1);logger[_0xf5bc('0x15')](_0xf5bc('0x27'),_0x5b09a1,JSON[_0xf5bc('0x28')](_0x5634dc));_0x6992be(_0x5634dc);})[_0xf5bc('0x23')](function(_0x18ce4b){logger[_0xf5bc('0x17')](_0xf5bc('0x27'),_0x18ce4b[_0xf5bc('0x19')],_0x5b09a1);_0x7f8424(_this['error'](0x1f4,_0x18ce4b[_0xf5bc('0x19')]));});});}; \ No newline at end of file +var _0x59d4=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','./openchannelInteraction.socket','register','request','info','debug','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','then','AddTagsToOpenchannelInteraction','find','addTags','ids','AddTags','lodash','util','moment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x59d4,0xe1));var _0x459d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x59d4[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x459d('0x0'));var util=require(_0x459d('0x1'));var moment=require(_0x459d('0x2'));var BPromise=require(_0x459d('0x3'));var rs=require(_0x459d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x459d('0x5'))['db'];var utils=require(_0x459d('0x6'));var logger=require(_0x459d('0x7'))(_0x459d('0x8'));var config=require('../../config/environment');var jayson=require(_0x459d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x459d('0xa')]=_['defaults'](config[_0x459d('0xa')],{'host':_0x459d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x459d('0xa')]));require(_0x459d('0xc'))[_0x459d('0xd')](socket);function respondWithRpcPromise(_0x2d90a5,_0x56b316,_0x5621f3){return new BPromise(function(_0x462dd9,_0x231bcb){return client[_0x459d('0xe')](_0x2d90a5,_0x5621f3)['then'](function(_0x411fc0){logger[_0x459d('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x56b316,'request\x20sent');logger[_0x459d('0x10')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x56b316,_0x459d('0x11'),JSON[_0x459d('0x12')](_0x411fc0));if(_0x411fc0[_0x459d('0x13')]){if(_0x411fc0[_0x459d('0x13')][_0x459d('0x14')]===0x1f4){logger[_0x459d('0x13')](_0x459d('0x15'),_0x56b316,_0x411fc0[_0x459d('0x13')][_0x459d('0x16')]);return _0x231bcb(_0x411fc0[_0x459d('0x13')][_0x459d('0x16')]);}logger[_0x459d('0x13')](_0x459d('0x15'),_0x56b316,_0x411fc0[_0x459d('0x13')][_0x459d('0x16')]);return _0x462dd9(_0x411fc0['error'][_0x459d('0x16')]);}else{logger[_0x459d('0xf')](_0x459d('0x15'),_0x56b316,'request\x20sent');_0x462dd9(_0x411fc0['result'][_0x459d('0x16')]);}})[_0x459d('0x17')](function(_0x51ae62){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x56b316,_0x51ae62);_0x231bcb(_0x51ae62);});});}exports[_0x459d('0x18')]=function(_0x1d73c7){var _0x4ce012=this;return new Promise(function(_0x3c6c28,_0x200858){return db[_0x459d('0x19')][_0x459d('0x1a')](_0x1d73c7[_0x459d('0x1b')],{'raw':_0x1d73c7[_0x459d('0x1c')]?_0x1d73c7[_0x459d('0x1c')][_0x459d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d73c7[_0x459d('0x1c')]?_0x1d73c7[_0x459d('0x1c')][_0x459d('0x1e')]||null:null,'attributes':_0x1d73c7['options']?_0x1d73c7[_0x459d('0x1c')]['attributes']||null:null,'limit':_0x1d73c7[_0x459d('0x1c')]?_0x1d73c7[_0x459d('0x1c')][_0x459d('0x1f')]||null:null})[_0x459d('0x20')](function(_0x1da7d1){logger[_0x459d('0xf')](_0x459d('0x18'),_0x1d73c7);logger[_0x459d('0x10')](_0x459d('0x18'),_0x1d73c7,JSON[_0x459d('0x12')](_0x1da7d1));_0x3c6c28(_0x1da7d1);})[_0x459d('0x17')](function(_0x4cf4c3){logger[_0x459d('0x13')](_0x459d('0x18'),_0x4cf4c3[_0x459d('0x16')],_0x1d73c7);_0x200858(_0x4ce012[_0x459d('0x13')](0x1f4,_0x4cf4c3[_0x459d('0x16')]));});});};exports[_0x459d('0x21')]=function(_0x426367){return new Promise(function(_0x3cdf91,_0x5f596b){return db[_0x459d('0x19')][_0x459d('0x22')]({'where':_0x426367[_0x459d('0x1c')]?_0x426367['options'][_0x459d('0x1e')]||null:null})[_0x459d('0x20')](function(_0x574423){if(_0x574423){return _0x574423[_0x459d('0x23')](_0x426367[_0x459d('0x1b')][_0x459d('0x24')],_['omit'](_0x426367[_0x459d('0x1b')],[_0x459d('0x24'),'id'])||{});}})['spread'](function(_0x40f48f){logger[_0x459d('0xf')](_0x459d('0x25'),_0x426367);logger[_0x459d('0x10')](_0x459d('0x25'),_0x426367,JSON[_0x459d('0x12')](_0x40f48f));_0x3cdf91(_0x40f48f);})['catch'](function(_0x338e2c){logger[_0x459d('0x13')](_0x459d('0x25'),_0x338e2c['message'],_0x426367);_0x5f596b(_this['error'](0x1f4,_0x338e2c[_0x459d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 0ae7ac7..bc32564 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 _0xfedb=['remove','removeListener','length','openchannelInteraction:','save'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfedb,0xdb));var _0xbfed=function(_0xfb75c4,_0x49906a){_0xfb75c4=_0xfb75c4-0x0;var _0x10d2fc=_0xfedb[_0xfb75c4];return _0x10d2fc;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xbfed('0x0'),_0xbfed('0x1'),'update'];function createListener(_0x11c5bd,_0x34147e){return function(_0xa8e275){_0x34147e['emit'](_0x11c5bd,_0xa8e275);};}function removeListener(_0x173f72,_0x5adcb0){return function(){OpenchannelInteractionEvents[_0xbfed('0x2')](_0x173f72,_0x5adcb0);};}exports['register']=function(_0x4a3b44){for(var _0x3e7b0f=0x0,_0x1e08d0=events[_0xbfed('0x3')];_0x3e7b0f<_0x1e08d0;_0x3e7b0f++){var _0x4445bf=events[_0x3e7b0f];var _0x48bc96=createListener(_0xbfed('0x4')+_0x4445bf,_0x4a3b44);OpenchannelInteractionEvents['on'](_0x4445bf,_0x48bc96);}}; \ No newline at end of file +var _0x5bc5=['removeListener','register','length','save','remove','update','emit'];(function(_0x2bc518,_0x57d705){var _0x1c1e53=function(_0x4082ab){while(--_0x4082ab){_0x2bc518['push'](_0x2bc518['shift']());}};_0x1c1e53(++_0x57d705);}(_0x5bc5,0x130));var _0x55bc=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x5bc5[_0x5a5395];return _0x4da43d;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x55bc('0x0'),_0x55bc('0x1'),_0x55bc('0x2')];function createListener(_0x2dd1c9,_0x5204b4){return function(_0x5c62d2){_0x5204b4[_0x55bc('0x3')](_0x2dd1c9,_0x5c62d2);};}function removeListener(_0x4e8a5e,_0x12c4b0){return function(){OpenchannelInteractionEvents[_0x55bc('0x4')](_0x4e8a5e,_0x12c4b0);};}exports[_0x55bc('0x5')]=function(_0x21c665){for(var _0x1519ad=0x0,_0x52aaed=events[_0x55bc('0x6')];_0x1519ad<_0x52aaed;_0x1519ad++){var _0x147ae6=events[_0x1519ad];var _0x1bf250=createListener('openchannelInteraction:'+_0x147ae6,_0x21c665);OpenchannelInteractionEvents['on'](_0x147ae6,_0x1bf250);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b2cd6df..0ff04a5 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0xa0518c,_0x3cd20e){var _0x9c384d=function(_0x3602c7){while(--_0x3602c7){_0xa0518c['push'](_0xa0518c['shift']());}};_0x9c384d(++_0x3cd20e);}(_0xedd9,0xfc));var _0x9edd=function(_0x55a313,_0x447e14){_0x55a313=_0x55a313-0x0;var _0x170ff0=_0xedd9[_0x55a313];return _0x170ff0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a0b4d7d..c9fab78 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 _0x58a4=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x20c3ef,_0x37ce65){var _0x564eb8=function(_0x48d49c){while(--_0x48d49c){_0x20c3ef['push'](_0x20c3ef['shift']());}};_0x564eb8(++_0x37ce65);}(_0x58a4,0xbf));var _0x458a=function(_0x49677a,_0x197e86){_0x49677a=_0x49677a-0x0;var _0x115408=_0x58a4[_0x49677a];return _0x115408;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'body':{'type':Sequelize[_0x458a('0x2')](_0x458a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x458a('0x5')]('in',_0x458a('0x6')),'defaultValue':_0x458a('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x458a('0x7')]},'providerName':{'type':Sequelize[_0x458a('0x8')]},'providerResponse':{'type':Sequelize[_0x458a('0x2')]}}; \ No newline at end of file +var _0xc901=['sequelize','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x17215e,_0x404898){var _0x46ed53=function(_0x2b8e2e){while(--_0x2b8e2e){_0x17215e['push'](_0x17215e['shift']());}};_0x46ed53(++_0x404898);}(_0xc901,0x142));var _0x1c90=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc901[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1c90('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x1c90('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1c90('0x2')]('in','out'),'defaultValue':_0x1c90('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1c90('0x4')]},'providerName':{'type':Sequelize[_0x1c90('0x5')]},'providerResponse':{'type':Sequelize[_0x1c90('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 47caf07..52af576 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 _0x0d6a=['fields','attributes','length','hasOwnProperty','nolimit','order','where','merge','filter','options','includeAll','include','rows','show','params','model','keys','find','create','body','describe','accept','acceptMessage','reject','openchannel','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','client','http','openchannel-interactions','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','end','sendStatus','name','send','OpenchannelMessage','rawAttributes','fieldName','type','key','map','query','filters','intersection'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0d6a,0x97));var _0xa0d6=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x0d6a[_0x1d24eb];return _0x1dc576;};'use strict';var util=require(_0xa0d6('0x0'));var _=require(_0xa0d6('0x1'));var Redis=require(_0xa0d6('0x2'));var interactionService=require(_0xa0d6('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xa0d6('0x4'))(_0xa0d6('0x5'));var config=require(_0xa0d6('0x6'));var db=require(_0xa0d6('0x7'))['db'];config[_0xa0d6('0x8')]=_[_0xa0d6('0x9')](config[_0xa0d6('0x8')],{'host':_0xa0d6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0d6('0x8')]));require(_0xa0d6('0xb'))[_0xa0d6('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa0d6('0xd')][_0xa0d6('0xe')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0xa0d6('0x4'))(_0xa0d6('0xf'));function respondWithRpcPromise(_0x4385b6,_0x2630c1,_0x3667cb,_0x3f77ba){return new Promise(function(_0x265a68,_0xe7453c){var _0x2e02fb=_0x3f77ba||client;return _0x2e02fb[_0xa0d6('0x10')](_0x4385b6,_0x3667cb)['then'](function(_0x323b5a){logger[_0xa0d6('0x11')](_0xa0d6('0x12'),_0x2630c1,_0xa0d6('0x13'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2630c1,'request\x20sent',JSON['stringify'](_0x323b5a));if(_0x323b5a['error']){if(_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x15')]===0x1f4){logger[_0xa0d6('0x14')](_0xa0d6('0x12'),_0x2630c1,_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x16')]);return _0xe7453c(_0x323b5a[_0xa0d6('0x14')]['message']);}logger[_0xa0d6('0x14')](_0xa0d6('0x12'),_0x2630c1,_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x16')]);return _0x265a68(_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x16')]);}else{logger[_0xa0d6('0x11')](_0xa0d6('0x12'),_0x2630c1,_0xa0d6('0x13'));_0x265a68(_0x323b5a[_0xa0d6('0x17')][_0xa0d6('0x16')]);}})[_0xa0d6('0x18')](function(_0x4571c9){logger[_0xa0d6('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x2630c1,_0x4571c9);_0xe7453c(_0x4571c9);});});}function respondWithResult(_0x1ba8be,_0xf94749){_0xf94749=_0xf94749||0xc8;return function(_0x5629f0){if(_0x5629f0){return _0x1ba8be[_0xa0d6('0x19')](_0xf94749)[_0xa0d6('0x1a')](_0x5629f0);}};}function respondWithFilteredResult(_0x49c6b9,_0x137dc3){return function(_0x1e3c56){if(_0x1e3c56){var _0x4d4391=typeof _0x137dc3[_0xa0d6('0x1b')]==='undefined'&&typeof _0x137dc3[_0xa0d6('0x1c')]===_0xa0d6('0x1d');var _0x2c8ee9=_0x1e3c56[_0xa0d6('0x1e')];var _0x4a2153=_0x4d4391?0x0:_0x137dc3[_0xa0d6('0x1b')];var _0x4a3706=_0x4d4391?_0x1e3c56[_0xa0d6('0x1e')]:_0x137dc3[_0xa0d6('0x1b')]+_0x137dc3[_0xa0d6('0x1c')];var _0x424061;if(_0x4a3706>=_0x2c8ee9){_0x4a3706=_0x2c8ee9;_0x424061=0xc8;}else{_0x424061=0xce;}_0x49c6b9[_0xa0d6('0x19')](_0x424061);return _0x49c6b9[_0xa0d6('0x1f')](_0xa0d6('0x20'),_0x4a2153+'-'+_0x4a3706+'/'+_0x2c8ee9)[_0xa0d6('0x1a')](_0x1e3c56);}return null;};}function saveUpdates(_0x14b4bc){return function(_0xbd0e00){if(_0xbd0e00){return _0xbd0e00[_0xa0d6('0x21')](_0x14b4bc)['then'](function(_0x23be44){return _0x23be44;});}return null;};}function removeEntity(_0x3dc9df){return function(_0x301862){if(_0x301862){return _0x301862[_0xa0d6('0x22')]()[_0xa0d6('0x23')](function(){_0x3dc9df[_0xa0d6('0x19')](0xcc)[_0xa0d6('0x24')]();});}};}function handleEntityNotFound(_0x10150c){return function(_0x19b97b){if(!_0x19b97b){_0x10150c[_0xa0d6('0x25')](0x194);}return _0x19b97b;};}function handleError(_0x2a7e72,_0x406255){_0x406255=_0x406255||0x1f4;return function(_0x116e09){logger[_0xa0d6('0x14')](_0x116e09['stack']);if(_0x116e09[_0xa0d6('0x26')]){delete _0x116e09[_0xa0d6('0x26')];}_0x2a7e72[_0xa0d6('0x19')](_0x406255)[_0xa0d6('0x27')](_0x116e09);};}exports['index']=function(_0x105e3d,_0x46fec1){var _0x4a9855={},_0x352b51={},_0x472305={'count':0x0,'rows':[]};var _0x1d73af=_['map'](db[_0xa0d6('0x28')][_0xa0d6('0x29')],function(_0x229343){return{'name':_0x229343[_0xa0d6('0x2a')],'type':_0x229343[_0xa0d6('0x2b')][_0xa0d6('0x2c')]};});_0x352b51['model']=_[_0xa0d6('0x2d')](_0x1d73af,_0xa0d6('0x26'));_0x352b51[_0xa0d6('0x2e')]=_['keys'](_0x105e3d[_0xa0d6('0x2e')]);_0x352b51[_0xa0d6('0x2f')]=_[_0xa0d6('0x30')](_0x352b51['model'],_0x352b51[_0xa0d6('0x2e')]);_0x4a9855['attributes']=_[_0xa0d6('0x30')](_0x352b51['model'],qs['fields'](_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x31')]));_0x4a9855['attributes']=_0x4a9855[_0xa0d6('0x32')][_0xa0d6('0x33')]?_0x4a9855[_0xa0d6('0x32')]:_0x352b51['model'];if(!_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x34')](_0xa0d6('0x35'))){_0x4a9855[_0xa0d6('0x1c')]=qs['limit'](_0x105e3d[_0xa0d6('0x2e')]['limit']);_0x4a9855[_0xa0d6('0x1b')]=qs[_0xa0d6('0x1b')](_0x105e3d[_0xa0d6('0x2e')]['offset']);}_0x4a9855[_0xa0d6('0x36')]=qs['sort'](_0x105e3d[_0xa0d6('0x2e')]['sort']);_0x4a9855[_0xa0d6('0x37')]=qs[_0xa0d6('0x2f')](_['pick'](_0x105e3d['query'],_0x352b51[_0xa0d6('0x2f')]),_0x1d73af);if(_0x105e3d[_0xa0d6('0x2e')]['filter']){_0x4a9855[_0xa0d6('0x37')]=_[_0xa0d6('0x38')](_0x4a9855[_0xa0d6('0x37')],{'$or':_[_0xa0d6('0x2d')](_0x1d73af,function(_0x3dbc32){if(_0x3dbc32[_0xa0d6('0x2b')]!=='VIRTUAL'){var _0x418e31={};_0x418e31[_0x3dbc32[_0xa0d6('0x26')]]={'$like':'%'+_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x39')]+'%'};return _0x418e31;}})});}_0x4a9855=_['merge']({},_0x4a9855,_0x105e3d[_0xa0d6('0x3a')]);var _0x170cdd={'where':_0x4a9855[_0xa0d6('0x37')]};return db[_0xa0d6('0x28')][_0xa0d6('0x1e')](_0x170cdd)[_0xa0d6('0x23')](function(_0x183d83){_0x472305[_0xa0d6('0x1e')]=_0x183d83;if(_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x3b')]){_0x4a9855[_0xa0d6('0x3c')]=[{'all':!![]}];}return db[_0xa0d6('0x28')]['findAll'](_0x4a9855);})[_0xa0d6('0x23')](function(_0x353f56){_0x472305[_0xa0d6('0x3d')]=_0x353f56;return _0x472305;})[_0xa0d6('0x23')](respondWithFilteredResult(_0x46fec1,_0x4a9855))['catch'](handleError(_0x46fec1,null));};exports[_0xa0d6('0x3e')]=function(_0x291cd0,_0x4fc144){var _0x56d09e={'raw':!![],'where':{'id':_0x291cd0[_0xa0d6('0x3f')]['id']}},_0x19e0e9={};_0x19e0e9[_0xa0d6('0x40')]=_[_0xa0d6('0x41')](db['OpenchannelMessage'][_0xa0d6('0x29')]);_0x19e0e9[_0xa0d6('0x2e')]=_['keys'](_0x291cd0[_0xa0d6('0x2e')]);_0x19e0e9[_0xa0d6('0x2f')]=_[_0xa0d6('0x30')](_0x19e0e9[_0xa0d6('0x40')],_0x19e0e9[_0xa0d6('0x2e')]);_0x56d09e[_0xa0d6('0x32')]=_[_0xa0d6('0x30')](_0x19e0e9[_0xa0d6('0x40')],qs[_0xa0d6('0x31')](_0x291cd0[_0xa0d6('0x2e')]['fields']));_0x56d09e[_0xa0d6('0x32')]=_0x56d09e[_0xa0d6('0x32')]['length']?_0x56d09e[_0xa0d6('0x32')]:_0x19e0e9['model'];if(_0x291cd0[_0xa0d6('0x2e')]['includeAll']){_0x56d09e[_0xa0d6('0x3c')]=[{'all':!![]}];}_0x56d09e=_[_0xa0d6('0x38')]({},_0x56d09e,_0x291cd0[_0xa0d6('0x3a')]);return db[_0xa0d6('0x28')][_0xa0d6('0x42')](_0x56d09e)[_0xa0d6('0x23')](handleEntityNotFound(_0x4fc144,null))[_0xa0d6('0x23')](respondWithResult(_0x4fc144,null))[_0xa0d6('0x18')](handleError(_0x4fc144,null));};exports[_0xa0d6('0x43')]=function(_0x672fb3,_0x50431d){return db[_0xa0d6('0x28')]['create'](_0x672fb3['body'],{})[_0xa0d6('0x23')](respondWithResult(_0x50431d,0xc9))['catch'](handleError(_0x50431d,null));};exports[_0xa0d6('0x21')]=function(_0x4bf3ec,_0x532ff7){if(_0x4bf3ec[_0xa0d6('0x44')]['id']){delete _0x4bf3ec[_0xa0d6('0x44')]['id'];}return db[_0xa0d6('0x28')][_0xa0d6('0x42')]({'where':{'id':_0x4bf3ec[_0xa0d6('0x3f')]['id']}})[_0xa0d6('0x23')](handleEntityNotFound(_0x532ff7,null))[_0xa0d6('0x23')](saveUpdates(_0x4bf3ec[_0xa0d6('0x44')],null))[_0xa0d6('0x23')](respondWithResult(_0x532ff7,null))[_0xa0d6('0x18')](handleError(_0x532ff7,null));};exports[_0xa0d6('0x22')]=function(_0x429fac,_0x374b83){return db['OpenchannelMessage']['find']({'where':{'id':_0x429fac[_0xa0d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x374b83,null))['then'](removeEntity(_0x374b83,null))[_0xa0d6('0x18')](handleError(_0x374b83,null));};exports['describe']=function(_0x479390,_0x38fe54){return db[_0xa0d6('0x28')][_0xa0d6('0x45')]()['then'](respondWithResult(_0x38fe54,null))['catch'](handleError(_0x38fe54,null));};exports[_0xa0d6('0x46')]=function(_0x5ed5b6,_0x34f144){var _0x5f206e='openchannel';return interactionService[_0xa0d6('0x47')](_0x5ed5b6,_0x5f206e)['then'](respondWithResult(_0x34f144,null))[_0xa0d6('0x18')](handleError(_0x34f144,null));};exports[_0xa0d6('0x48')]=function(_0xf0e5fb,_0x177175){var _0x2f4a0b={'agent':{},'channel':_0xa0d6('0x49')};if(_0xf0e5fb['body']['id']){delete _0xf0e5fb[_0xa0d6('0x44')]['id'];}_0xf0e5fb[_0xa0d6('0x44')]['UserId']=_0xf0e5fb[_0xa0d6('0x44')][_0xa0d6('0x4a')]||_0xf0e5fb[_0xa0d6('0x4b')]['id'];_0x2f4a0b[_0xa0d6('0x4c')]['id']=_0xf0e5fb[_0xa0d6('0x44')]['UserId'];return db[_0xa0d6('0x28')][_0xa0d6('0x42')]({'where':{'id':_0xf0e5fb[_0xa0d6('0x3f')]['id'],'UserId':null}})[_0xa0d6('0x23')](handleEntityNotFound(_0x177175,null))[_0xa0d6('0x23')](function(_0x578c33){if(_0x578c33){_0x2f4a0b[_0xa0d6('0x16')]=_0x578c33[_0xa0d6('0x4d')]({'plain':!![]});return db[_0xa0d6('0x4e')][_0xa0d6('0x42')]({'where':{'id':_0x578c33[_0xa0d6('0x4f')]}});}return null;})[_0xa0d6('0x23')](handleEntityNotFound(_0x177175,null))[_0xa0d6('0x23')](function(_0xe9dfdd){if(_0xe9dfdd){_0x2f4a0b[_0xa0d6('0x50')]=_0xe9dfdd['get']({'plain':!![]});interaction_log[_0xa0d6('0x11')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf0e5fb[_0xa0d6('0x4b')]['id'],_0xf0e5fb[_0xa0d6('0x4b')][_0xa0d6('0x26')],_0xf0e5fb['user'][_0xa0d6('0x51')],_0x2f4a0b[_0xa0d6('0x50')]['id'],_0xf0e5fb[_0xa0d6('0x44')]?JSON['stringify'](_0xf0e5fb[_0xa0d6('0x44')]):_0xa0d6('0x52'));return respondWithRpcPromise(_0xa0d6('0x53'),_0xa0d6('0x54'),_0x2f4a0b);}return null;})[_0xa0d6('0x23')](function(_0x49716d){var _0x207c92=_0xa0d6('0x55')+_0x49716d[_0xa0d6('0x16')][_0xa0d6('0x56')];return db[_0xa0d6('0x57')][_0xa0d6('0x2e')](_0x207c92,{'type':db[_0xa0d6('0x58')]['QueryTypes'][_0xa0d6('0x59')],'raw':!![]})[_0xa0d6('0x23')](function(_0x1010c3){return _0x1010c3;});})[_0xa0d6('0x23')](function(_0x4ca86e){if(_0x4ca86e){_0x2f4a0b['message'][_0xa0d6('0x5a')]=_0x4ca86e[0x0];if(!_0xf0e5fb[_0xa0d6('0x44')]['UserId'])return;return db['User'][_0xa0d6('0x42')]({'where':{'id':_0xf0e5fb['body'][_0xa0d6('0x4a')],'role':_0xa0d6('0x4c')},'attributes':['id',_0xa0d6('0x26'),_0xa0d6('0x5b'),_0xa0d6('0x5c'),'internal'],'raw':!![]});}return null;})[_0xa0d6('0x23')](function(_0x50c88a){if(!_0x50c88a)return null;_0x2f4a0b[_0xa0d6('0x16')][_0xa0d6('0x4c')]=_0x50c88a;return _0x2f4a0b;})[_0xa0d6('0x23')](function(_0x563bb3){if(_0x563bb3){_0x563bb3[_0xa0d6('0x16')]['interface']=util[_0xa0d6('0x5d')](_0xa0d6('0x5e'),_0xf0e5fb[_0xa0d6('0x4b')][_0xa0d6('0x26')]);_0x563bb3[_0xa0d6('0x16')]['channel']=_0x2f4a0b[_0xa0d6('0x5f')];_0x563bb3[_0xa0d6('0x16')][_0xa0d6('0x60')]=_0x2f4a0b[_0xa0d6('0x5f')];_0x563bb3[_0xa0d6('0x16')][_0xa0d6('0x61')]=_0xa0d6('0x48');respondWithRpcPromise('EventManager',_0xa0d6('0x62'),{'event':_0xa0d6('0x63'),'message':_0x563bb3[_0xa0d6('0x16')]},client9002);return _0x2f4a0b;}return null;})[_0xa0d6('0x23')](respondWithResult(_0x177175,null))[_0xa0d6('0x18')](handleError(_0x177175,null));}; \ No newline at end of file +var _0x9192=['util','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','../../config/logger','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','end','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','map','options','includeAll','include','show','params','keys','length','find','create','body','destroy','describe','openchannel','reject','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage'];(function(_0x350108,_0x3ad392){var _0x4eb389=function(_0x5e5c02){while(--_0x5e5c02){_0x350108['push'](_0x350108['shift']());}};_0x4eb389(++_0x3ad392);}(_0x9192,0x129));var _0x2919=function(_0x350796,_0x1bf21f){_0x350796=_0x350796-0x0;var _0x126f19=_0x9192[_0x350796];return _0x126f19;};'use strict';var util=require(_0x2919('0x0'));var _=require(_0x2919('0x1'));var Redis=require(_0x2919('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x2919('0x3'));var logger=require('../../config/logger')(_0x2919('0x4'));var config=require('../../config/environment');var db=require(_0x2919('0x5'))['db'];config[_0x2919('0x6')]=_[_0x2919('0x7')](config[_0x2919('0x6')],{'host':_0x2919('0x8'),'port':0x18eb});var socket=require(_0x2919('0x9'))(new Redis(config[_0x2919('0x6')]));require(_0x2919('0xa'))[_0x2919('0xb')](socket);var jayson=require(_0x2919('0xc'));var client=jayson[_0x2919('0xd')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2919('0xe')]({'port':0x232a});var interaction_log=require(_0x2919('0xf'))(_0x2919('0x10'));function respondWithRpcPromise(_0x5dcd93,_0x295fcc,_0x559fc5,_0x922848){return new Promise(function(_0x2ae611,_0x538590){var _0x37faf7=_0x922848||client;return _0x37faf7[_0x2919('0x11')](_0x5dcd93,_0x559fc5)[_0x2919('0x12')](function(_0x48dc54){logger[_0x2919('0x13')](_0x2919('0x14'),_0x295fcc,_0x2919('0x15'));logger[_0x2919('0x16')](_0x2919('0x17'),_0x295fcc,'request\x20sent',JSON[_0x2919('0x18')](_0x48dc54));if(_0x48dc54['error']){if(_0x48dc54['error']['code']===0x1f4){logger[_0x2919('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x295fcc,_0x48dc54[_0x2919('0x19')]['message']);return _0x538590(_0x48dc54[_0x2919('0x19')]['message']);}logger[_0x2919('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x295fcc,_0x48dc54['error'][_0x2919('0x1a')]);return _0x2ae611(_0x48dc54[_0x2919('0x19')][_0x2919('0x1a')]);}else{logger[_0x2919('0x13')](_0x2919('0x14'),_0x295fcc,_0x2919('0x15'));_0x2ae611(_0x48dc54[_0x2919('0x1b')][_0x2919('0x1a')]);}})[_0x2919('0x1c')](function(_0x26ae61){logger['error'](_0x2919('0x14'),_0x295fcc,_0x26ae61);_0x538590(_0x26ae61);});});}function respondWithResult(_0x36ad89,_0x1adf4a){_0x1adf4a=_0x1adf4a||0xc8;return function(_0xd6424a){if(_0xd6424a){return _0x36ad89[_0x2919('0x1d')](_0x1adf4a)[_0x2919('0x1e')](_0xd6424a);}};}function respondWithFilteredResult(_0x473b13,_0x2b26d6){return function(_0x435603){if(_0x435603){var _0x20739c=typeof _0x2b26d6['offset']==='undefined'&&typeof _0x2b26d6['limit']===_0x2919('0x1f');var _0x2ed362=_0x435603[_0x2919('0x20')];var _0x1bf375=_0x20739c?0x0:_0x2b26d6[_0x2919('0x21')];var _0x4ac6af=_0x20739c?_0x435603[_0x2919('0x20')]:_0x2b26d6[_0x2919('0x21')]+_0x2b26d6[_0x2919('0x22')];var _0x252180;if(_0x4ac6af>=_0x2ed362){_0x4ac6af=_0x2ed362;_0x252180=0xc8;}else{_0x252180=0xce;}_0x473b13[_0x2919('0x1d')](_0x252180);return _0x473b13[_0x2919('0x23')](_0x2919('0x24'),_0x1bf375+'-'+_0x4ac6af+'/'+_0x2ed362)[_0x2919('0x1e')](_0x435603);}return null;};}function saveUpdates(_0x301f0f){return function(_0x245246){if(_0x245246){return _0x245246[_0x2919('0x25')](_0x301f0f)[_0x2919('0x12')](function(_0x4c860d){return _0x4c860d;});}return null;};}function removeEntity(_0x4282e4){return function(_0x2500c9){if(_0x2500c9){return _0x2500c9['destroy']()[_0x2919('0x12')](function(){_0x4282e4[_0x2919('0x1d')](0xcc)[_0x2919('0x26')]();});}};}function handleEntityNotFound(_0x1947a8){return function(_0x56c511){if(!_0x56c511){_0x1947a8[_0x2919('0x27')](0x194);}return _0x56c511;};}function handleError(_0x265568,_0x5b975e){_0x5b975e=_0x5b975e||0x1f4;return function(_0x3fecba){logger[_0x2919('0x19')](_0x3fecba[_0x2919('0x28')]);if(_0x3fecba['name']){delete _0x3fecba[_0x2919('0x29')];}_0x265568['status'](_0x5b975e)[_0x2919('0x2a')](_0x3fecba);};}exports[_0x2919('0x2b')]=function(_0x5a5820,_0x41f2d2){var _0x815232={},_0x164fda={},_0x3c901d={'count':0x0,'rows':[]};var _0xdcc6c3=_['map'](db[_0x2919('0x2c')][_0x2919('0x2d')],function(_0x67e3d3){return{'name':_0x67e3d3[_0x2919('0x2e')],'type':_0x67e3d3['type']['key']};});_0x164fda[_0x2919('0x2f')]=_['map'](_0xdcc6c3,_0x2919('0x29'));_0x164fda[_0x2919('0x30')]=_['keys'](_0x5a5820[_0x2919('0x30')]);_0x164fda[_0x2919('0x31')]=_[_0x2919('0x32')](_0x164fda['model'],_0x164fda[_0x2919('0x30')]);_0x815232[_0x2919('0x33')]=_[_0x2919('0x32')](_0x164fda[_0x2919('0x2f')],qs['fields'](_0x5a5820[_0x2919('0x30')][_0x2919('0x34')]));_0x815232[_0x2919('0x33')]=_0x815232[_0x2919('0x33')]['length']?_0x815232['attributes']:_0x164fda[_0x2919('0x2f')];if(!_0x5a5820[_0x2919('0x30')][_0x2919('0x35')]('nolimit')){_0x815232[_0x2919('0x22')]=qs['limit'](_0x5a5820[_0x2919('0x30')][_0x2919('0x22')]);_0x815232[_0x2919('0x21')]=qs['offset'](_0x5a5820[_0x2919('0x30')][_0x2919('0x21')]);}_0x815232[_0x2919('0x36')]=qs[_0x2919('0x37')](_0x5a5820[_0x2919('0x30')][_0x2919('0x37')]);_0x815232[_0x2919('0x38')]=qs[_0x2919('0x31')](_['pick'](_0x5a5820[_0x2919('0x30')],_0x164fda[_0x2919('0x31')]),_0xdcc6c3);if(_0x5a5820['query'][_0x2919('0x39')]){_0x815232[_0x2919('0x38')]=_[_0x2919('0x3a')](_0x815232['where'],{'$or':_[_0x2919('0x3b')](_0xdcc6c3,function(_0x35b606){if(_0x35b606['type']!=='VIRTUAL'){var _0x5640c4={};_0x5640c4[_0x35b606[_0x2919('0x29')]]={'$like':'%'+_0x5a5820['query'][_0x2919('0x39')]+'%'};return _0x5640c4;}})});}_0x815232=_['merge']({},_0x815232,_0x5a5820[_0x2919('0x3c')]);var _0x2f292c={'where':_0x815232[_0x2919('0x38')]};return db[_0x2919('0x2c')][_0x2919('0x20')](_0x2f292c)['then'](function(_0x16cfb8){_0x3c901d['count']=_0x16cfb8;if(_0x5a5820['query'][_0x2919('0x3d')]){_0x815232[_0x2919('0x3e')]=[{'all':!![]}];}return db[_0x2919('0x2c')]['findAll'](_0x815232);})[_0x2919('0x12')](function(_0x316e80){_0x3c901d['rows']=_0x316e80;return _0x3c901d;})[_0x2919('0x12')](respondWithFilteredResult(_0x41f2d2,_0x815232))['catch'](handleError(_0x41f2d2,null));};exports[_0x2919('0x3f')]=function(_0x3e0ac7,_0x179d39){var _0x2e39bb={'raw':!![],'where':{'id':_0x3e0ac7[_0x2919('0x40')]['id']}},_0x2a7ce7={};_0x2a7ce7[_0x2919('0x2f')]=_[_0x2919('0x41')](db[_0x2919('0x2c')]['rawAttributes']);_0x2a7ce7[_0x2919('0x30')]=_[_0x2919('0x41')](_0x3e0ac7[_0x2919('0x30')]);_0x2a7ce7['filters']=_['intersection'](_0x2a7ce7[_0x2919('0x2f')],_0x2a7ce7['query']);_0x2e39bb['attributes']=_[_0x2919('0x32')](_0x2a7ce7[_0x2919('0x2f')],qs[_0x2919('0x34')](_0x3e0ac7[_0x2919('0x30')][_0x2919('0x34')]));_0x2e39bb[_0x2919('0x33')]=_0x2e39bb[_0x2919('0x33')][_0x2919('0x42')]?_0x2e39bb['attributes']:_0x2a7ce7[_0x2919('0x2f')];if(_0x3e0ac7[_0x2919('0x30')][_0x2919('0x3d')]){_0x2e39bb[_0x2919('0x3e')]=[{'all':!![]}];}_0x2e39bb=_[_0x2919('0x3a')]({},_0x2e39bb,_0x3e0ac7[_0x2919('0x3c')]);return db[_0x2919('0x2c')][_0x2919('0x43')](_0x2e39bb)[_0x2919('0x12')](handleEntityNotFound(_0x179d39,null))[_0x2919('0x12')](respondWithResult(_0x179d39,null))[_0x2919('0x1c')](handleError(_0x179d39,null));};exports[_0x2919('0x44')]=function(_0x15f892,_0x2b9748){return db['OpenchannelMessage'][_0x2919('0x44')](_0x15f892[_0x2919('0x45')],{})[_0x2919('0x12')](respondWithResult(_0x2b9748,0xc9))[_0x2919('0x1c')](handleError(_0x2b9748,null));};exports[_0x2919('0x25')]=function(_0x2f674d,_0x2dfbf3){if(_0x2f674d[_0x2919('0x45')]['id']){delete _0x2f674d['body']['id'];}return db['OpenchannelMessage'][_0x2919('0x43')]({'where':{'id':_0x2f674d[_0x2919('0x40')]['id']}})[_0x2919('0x12')](handleEntityNotFound(_0x2dfbf3,null))[_0x2919('0x12')](saveUpdates(_0x2f674d['body'],null))[_0x2919('0x12')](respondWithResult(_0x2dfbf3,null))[_0x2919('0x1c')](handleError(_0x2dfbf3,null));};exports[_0x2919('0x46')]=function(_0x4c0146,_0x36583d){return db[_0x2919('0x2c')][_0x2919('0x43')]({'where':{'id':_0x4c0146[_0x2919('0x40')]['id']}})[_0x2919('0x12')](handleEntityNotFound(_0x36583d,null))[_0x2919('0x12')](removeEntity(_0x36583d,null))[_0x2919('0x1c')](handleError(_0x36583d,null));};exports[_0x2919('0x47')]=function(_0x1c0f2b,_0x46ecef){return db[_0x2919('0x2c')][_0x2919('0x47')]()[_0x2919('0x12')](respondWithResult(_0x46ecef,null))[_0x2919('0x1c')](handleError(_0x46ecef,null));};exports['accept']=function(_0x3b3de2,_0x19e188){var _0x3cb039=_0x2919('0x48');return interactionService['acceptMessage'](_0x3b3de2,_0x3cb039)['then'](respondWithResult(_0x19e188,null))[_0x2919('0x1c')](handleError(_0x19e188,null));};exports[_0x2919('0x49')]=function(_0x3e8110,_0x569856){var _0x2bd44c={'agent':{},'channel':_0x2919('0x48')};if(_0x3e8110[_0x2919('0x45')]['id']){delete _0x3e8110[_0x2919('0x45')]['id'];}_0x3e8110[_0x2919('0x45')][_0x2919('0x4a')]=_0x3e8110[_0x2919('0x45')]['UserId']||_0x3e8110[_0x2919('0x4b')]['id'];_0x2bd44c[_0x2919('0x4c')]['id']=_0x3e8110[_0x2919('0x45')][_0x2919('0x4a')];return db[_0x2919('0x2c')][_0x2919('0x43')]({'where':{'id':_0x3e8110[_0x2919('0x40')]['id'],'UserId':null}})[_0x2919('0x12')](handleEntityNotFound(_0x569856,null))['then'](function(_0x2d3e63){if(_0x2d3e63){_0x2bd44c[_0x2919('0x1a')]=_0x2d3e63[_0x2919('0x4d')]({'plain':!![]});return db[_0x2919('0x4e')][_0x2919('0x43')]({'where':{'id':_0x2d3e63[_0x2919('0x4f')]}});}return null;})[_0x2919('0x12')](handleEntityNotFound(_0x569856,null))[_0x2919('0x12')](function(_0x3d1a35){if(_0x3d1a35){_0x2bd44c[_0x2919('0x50')]=_0x3d1a35['get']({'plain':!![]});interaction_log[_0x2919('0x13')](_0x2919('0x51'),_0x3e8110['user']['id'],_0x3e8110[_0x2919('0x4b')]['name'],_0x3e8110[_0x2919('0x4b')]['role'],_0x2bd44c[_0x2919('0x50')]['id'],_0x3e8110[_0x2919('0x45')]?JSON['stringify'](_0x3e8110[_0x2919('0x45')]):'null');return respondWithRpcPromise(_0x2919('0x52'),_0x2919('0x53'),_0x2bd44c);}return null;})['then'](function(_0x4d75d2){var _0x19a222=_0x2919('0x54')+_0x4d75d2[_0x2919('0x1a')]['ContactId'];return db['sequelize'][_0x2919('0x30')](_0x19a222,{'type':db[_0x2919('0x55')][_0x2919('0x56')][_0x2919('0x57')],'raw':!![]})['then'](function(_0x4bfd84){return _0x4bfd84;});})['then'](function(_0xbc9f3e){if(_0xbc9f3e){_0x2bd44c[_0x2919('0x1a')][_0x2919('0x58')]=_0xbc9f3e[0x0];if(!_0x3e8110[_0x2919('0x45')]['UserId'])return;return db[_0x2919('0x59')]['find']({'where':{'id':_0x3e8110[_0x2919('0x45')]['UserId'],'role':_0x2919('0x4c')},'attributes':['id',_0x2919('0x29'),'fullname',_0x2919('0x5a'),'internal'],'raw':!![]});}return null;})[_0x2919('0x12')](function(_0x50bef1){if(!_0x50bef1)return null;_0x2bd44c['message'][_0x2919('0x4c')]=_0x50bef1;return _0x2bd44c;})[_0x2919('0x12')](function(_0x4b7abc){if(_0x4b7abc){_0x4b7abc[_0x2919('0x1a')][_0x2919('0x5b')]=util[_0x2919('0x5c')](_0x2919('0x5d'),_0x3e8110[_0x2919('0x4b')][_0x2919('0x29')]);_0x4b7abc[_0x2919('0x1a')][_0x2919('0x5e')]=_0x2bd44c[_0x2919('0x5e')];_0x4b7abc[_0x2919('0x1a')][_0x2919('0x5f')]=_0x2bd44c[_0x2919('0x5e')];_0x4b7abc[_0x2919('0x1a')][_0x2919('0x60')]='reject';respondWithRpcPromise(_0x2919('0x61'),'EventManager',{'event':_0x2919('0x62'),'message':_0x4b7abc[_0x2919('0x1a')]},client9002);return _0x2bd44c;}return null;})['then'](respondWithResult(_0x569856,null))[_0x2919('0x1c')](handleError(_0x569856,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e0a1542..5e0186f 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 _0x8754=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2043b5,_0x4139a8){var _0x20efac=function(_0x366087){while(--_0x366087){_0x2043b5['push'](_0x2043b5['shift']());}};_0x20efac(++_0x4139a8);}(_0x8754,0xb7));var _0x4875=function(_0x2a4b13,_0x4b941b){_0x2a4b13=_0x2a4b13-0x0;var _0x3413d6=_0x8754[_0x2a4b13];return _0x3413d6;};'use strict';var EventEmitter=require(_0x4875('0x0'));var OpenchannelMessage=require(_0x4875('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4875('0x2'),'afterUpdate':'update','afterDestroy':_0x4875('0x3')};function emitEvent(_0x2dc5e3){return function(_0x110069,_0xbf4313,_0x2c3fdf){OpenchannelMessageEvents[_0x4875('0x4')](_0x2dc5e3+':'+_0x110069['id'],_0x110069);OpenchannelMessageEvents['emit'](_0x2dc5e3,_0x110069);_0x2c3fdf(null);};}for(var e in events){if(events[_0x4875('0x5')](e)){var event=events[e];OpenchannelMessage[_0x4875('0x6')](e,emitEvent(event));}}module[_0x4875('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8d5c=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x59c683,_0x209444){var _0x47251b=function(_0x4db046){while(--_0x4db046){_0x59c683['push'](_0x59c683['shift']());}};_0x47251b(++_0x209444);}(_0x8d5c,0x114));var _0xc8d5=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x8d5c[_0x836465];return _0x2150ea;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xc8d5('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc8d5('0x1')](0x0);var events={'afterCreate':_0xc8d5('0x2'),'afterUpdate':_0xc8d5('0x3'),'afterDestroy':_0xc8d5('0x4')};function emitEvent(_0x5e243a){return function(_0x3928ca,_0x3c71f8,_0x5e8350){OpenchannelMessageEvents[_0xc8d5('0x5')](_0x5e243a+':'+_0x3928ca['id'],_0x3928ca);OpenchannelMessageEvents['emit'](_0x5e243a,_0x3928ca);_0x5e8350(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xc8d5('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a4bfcff..69b7c60 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 _0x949d=['inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','update','createdAt','error','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','CmContact','keys','then','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Interactions','omit','Contact','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction'];(function(_0x3866a0,_0x501e9a){var _0x4de61c=function(_0x581267){while(--_0x581267){_0x3866a0['push'](_0x3866a0['shift']());}};_0x4de61c(++_0x501e9a);}(_0x949d,0x6a));var _0xd949=function(_0x50a46f,_0x188384){_0x50a46f=_0x50a46f-0x0;var _0x428db1=_0x949d[_0x50a46f];return _0x428db1;};'use strict';var _=require(_0xd949('0x0'));var util=require(_0xd949('0x1'));var logger=require(_0xd949('0x2'))('api');var moment=require(_0xd949('0x3'));var BPromise=require(_0xd949('0x4'));var rp=require(_0xd949('0x5'));var fs=require('fs');var path=require(_0xd949('0x6'));var rimraf=require('rimraf');var config=require(_0xd949('0x7'));var attributes=require(_0xd949('0x8'));module[_0xd949('0x9')]=function(_0x42edf8,_0x15a864){return _0x42edf8[_0xd949('0xa')](_0xd949('0xb'),attributes,{'tableName':_0xd949('0xc'),'paranoid':![],'indexes':[{'name':_0xd949('0xd'),'fields':[_0xd949('0xe')],'type':_0xd949('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40c4b3,_0x352256,_0xc1bb03){var _0x4d9ba7=_0x42edf8[_0xd949('0x10')];var _0x1ad12e=_0x40c4b3['get']({'plain':!![]});if(_0x1ad12e[_0xd949('0x11')]['toLowerCase']()==='in'||_0x1ad12e['direction'][_0xd949('0x12')]()===_0xd949('0x13')&&!_0x1ad12e[_0xd949('0x14')]&&!_['isNil'](_0x1ad12e[_0xd949('0x15')])){_0x4d9ba7[_0xd949('0x16')][_0xd949('0x17')]({'where':{'id':_0x1ad12e['OpenchannelInteractionId']}})['then'](function(_0x1c73c9){if(_0x1c73c9){_0x1c73c9[_0xd949('0x18')]({'lastMsgAt':_0x1ad12e[_0xd949('0x19')],'lastMsgDirection':_0x1ad12e[_0xd949('0x11')][_0xd949('0x12')]()});}})['catch'](function(_0xc9788f){console[_0xd949('0x1a')](_0xc9788f);});}if(_0x1ad12e[_0xd949('0x11')]===_0xd949('0x13')&&!_0x1ad12e['secret']){var _0x20eaaf;_0x4d9ba7['CmContact'][_0xd949('0x1b')]()['then'](function(_0x29ad08){return _0x4d9ba7[_0xd949('0x1c')][_0xd949('0x1d')]({'where':{'id':_0x1ad12e[_0xd949('0x1e')]},'include':[{'model':_0x4d9ba7[_0xd949('0x16')],'as':'Interactions','where':{'id':_0x1ad12e[_0xd949('0x1f')]},'limit':0x1,'include':[{'model':_0x4d9ba7[_0xd949('0x20')],'as':'Contact','attributes':_[_0xd949('0x21')](_0x29ad08)}]}]});})[_0xd949('0x22')](function(_0x10aa6b){_0x20eaaf=_0x10aa6b['get']({'plain':!![]});if(_0x20eaaf&&_0x20eaaf[_0xd949('0x23')]){logger[_0xd949('0x24')](_0xd949('0x25'),_0xd949('0x26'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1ad12e['id'],_0x20eaaf['replyUri']));if(_0x20eaaf['Interactions']&&_0x20eaaf[_0xd949('0x27')]['length']){_0x1ad12e['Interaction']=_[_0xd949('0x28')](_0x20eaaf[_0xd949('0x27')][0x0],_0xd949('0x29'));_0x1ad12e[_0xd949('0x29')]=_0x20eaaf[_0xd949('0x27')][0x0]['Contact'];}var _0x352256={'method':'POST','uri':encodeURI(_0x20eaaf[_0xd949('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x352256[_0xd949('0x2a')]){case _0xd949('0x2b'):_0x352256['qs']=_0x1ad12e;break;case'POST':_0x352256[_0xd949('0xe')]=_0x1ad12e;break;}return rp(_0x352256)['then'](function(_0x56f617){logger[_0xd949('0x24')](_0xd949('0x25'),_0xd949('0x26'),util['format'](_0xd949('0x2c'),_0x1ad12e['id'],_0x20eaaf[_0xd949('0x23')]));if(_0x56f617[_0xd949('0xe')]['threadId']&&_0x56f617['body'][_0xd949('0x2d')]!=_0x1ad12e['Interaction']['threadId']){return _0x4d9ba7[_0xd949('0x16')]['update']({'threadId':_0x56f617[_0xd949('0xe')][_0xd949('0x2d')]},{'where':{'id':_0x1ad12e[_0xd949('0x2e')]['id']}});}else{return;}})['then'](function(){return _0x40c4b3[_0xd949('0x18')]({'read':!![]});})['catch'](function(_0x2e8973){logger['error'](_0xd949('0x25'),_0xd949('0x26'),util[_0xd949('0x2f')](_0x2e8973,{'showHidden':![],'depth':null}));_0xc1bb03();});}else{_0xc1bb03();}})[_0xd949('0x30')](function(){_0xc1bb03();});}else{_0xc1bb03();}}},'charset':_0xd949('0x31'),'collate':_0xd949('0x32')});}; \ No newline at end of file +var _0x317b=['catch','error','describe','OpenchannelAccount','find','CmContact','Contact','get','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','POST','GET','body','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','toLowerCase'];(function(_0xf3eb8f,_0x63d65b){var _0x8ebf95=function(_0x4dea8){while(--_0x4dea8){_0xf3eb8f['push'](_0xf3eb8f['shift']());}};_0x8ebf95(++_0x63d65b);}(_0x317b,0x171));var _0xb317=function(_0x350538,_0x1d9a9d){_0x350538=_0x350538-0x0;var _0x282cfd=_0x317b[_0x350538];return _0x282cfd;};'use strict';var _=require('lodash');var util=require(_0xb317('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb317('0x1'));var BPromise=require(_0xb317('0x2'));var rp=require(_0xb317('0x3'));var fs=require('fs');var path=require(_0xb317('0x4'));var rimraf=require(_0xb317('0x5'));var config=require('../../config/environment');var attributes=require(_0xb317('0x6'));module['exports']=function(_0x488bc8,_0x4dceb){return _0x488bc8['define'](_0xb317('0x7'),attributes,{'tableName':_0xb317('0x8'),'paranoid':![],'indexes':[{'name':_0xb317('0x9'),'fields':['body'],'type':_0xb317('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cafce,_0xef4ec6,_0x4be28e){var _0x3362f2=_0x488bc8[_0xb317('0xb')];var _0x255a81=_0x5cafce['get']({'plain':!![]});if(_0x255a81[_0xb317('0xc')]['toLowerCase']()==='in'||_0x255a81[_0xb317('0xc')]['toLowerCase']()===_0xb317('0xd')&&!_0x255a81[_0xb317('0xe')]&&!_[_0xb317('0xf')](_0x255a81['UserId'])){_0x3362f2[_0xb317('0x10')][_0xb317('0x11')]({'where':{'id':_0x255a81[_0xb317('0x12')]}})[_0xb317('0x13')](function(_0x2f694f){if(_0x2f694f){_0x2f694f[_0xb317('0x14')]({'lastMsgAt':_0x255a81[_0xb317('0x15')],'lastMsgDirection':_0x255a81[_0xb317('0xc')][_0xb317('0x16')]()});}})[_0xb317('0x17')](function(_0x149ff0){console[_0xb317('0x18')](_0x149ff0);});}if(_0x255a81[_0xb317('0xc')]===_0xb317('0xd')&&!_0x255a81[_0xb317('0xe')]){var _0x5893ff;_0x3362f2['CmContact'][_0xb317('0x19')]()[_0xb317('0x13')](function(_0x2b1924){return _0x3362f2[_0xb317('0x1a')][_0xb317('0x1b')]({'where':{'id':_0x255a81['OpenchannelAccountId']},'include':[{'model':_0x3362f2[_0xb317('0x10')],'as':'Interactions','where':{'id':_0x255a81[_0xb317('0x12')]},'limit':0x1,'include':[{'model':_0x3362f2[_0xb317('0x1c')],'as':_0xb317('0x1d'),'attributes':_['keys'](_0x2b1924)}]}]});})[_0xb317('0x13')](function(_0xc58d57){_0x5893ff=_0xc58d57[_0xb317('0x1e')]({'plain':!![]});if(_0x5893ff&&_0x5893ff[_0xb317('0x1f')]){logger[_0xb317('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xb317('0x21'),util[_0xb317('0x22')](_0xb317('0x23'),_0x255a81['id'],_0x5893ff[_0xb317('0x1f')]));if(_0x5893ff['Interactions']&&_0x5893ff[_0xb317('0x24')][_0xb317('0x25')]){_0x255a81['Interaction']=_[_0xb317('0x26')](_0x5893ff[_0xb317('0x24')][0x0],'Contact');_0x255a81[_0xb317('0x1d')]=_0x5893ff[_0xb317('0x24')][0x0]['Contact'];}var _0xef4ec6={'method':_0xb317('0x27'),'uri':encodeURI(_0x5893ff[_0xb317('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xef4ec6['method']){case _0xb317('0x28'):_0xef4ec6['qs']=_0x255a81;break;case _0xb317('0x27'):_0xef4ec6[_0xb317('0x29')]=_0x255a81;break;}return rp(_0xef4ec6)[_0xb317('0x13')](function(_0xbed87f){logger[_0xb317('0x20')](_0xb317('0x2a'),_0xb317('0x21'),util[_0xb317('0x22')](_0xb317('0x2b'),_0x255a81['id'],_0x5893ff[_0xb317('0x1f')]));if(_0xbed87f[_0xb317('0x29')]['threadId']&&_0xbed87f[_0xb317('0x29')][_0xb317('0x2c')]!=_0x255a81[_0xb317('0x2d')][_0xb317('0x2c')]){return _0x3362f2['OpenchannelInteraction'][_0xb317('0x14')]({'threadId':_0xbed87f[_0xb317('0x29')][_0xb317('0x2c')]},{'where':{'id':_0x255a81[_0xb317('0x2d')]['id']}});}else{return;}})[_0xb317('0x13')](function(){return _0x5cafce[_0xb317('0x14')]({'read':!![]});})[_0xb317('0x17')](function(_0x472d60){logger[_0xb317('0x18')](_0xb317('0x2a'),'afterCreate',util[_0xb317('0x2e')](_0x472d60,{'showHidden':![],'depth':null}));_0x4be28e();});}else{_0x4be28e();}})['finally'](function(){_0x4be28e();});}else{_0x4be28e();}}},'charset':_0xb317('0x2f'),'collate':_0xb317('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6f29ac4..0979faa 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x4e65a5,_0x1e0cb9){var _0xcba877=function(_0x1e0669){while(--_0x1e0669){_0x4e65a5['push'](_0x4e65a5['shift']());}};_0xcba877(++_0x1e0cb9);}(_0xadb5,0xad));var _0x5adb=function(_0x5d77e9,_0x33d19c){_0x5d77e9=_0x5d77e9-0x0;var _0x5334cd=_0xadb5[_0x5d77e9];return _0x5334cd;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x550ea8,_0x1d4a91){var _0x39d1c5=function(_0x10b821){while(--_0x10b821){_0x550ea8['push'](_0x550ea8['shift']());}};_0x39d1c5(++_0x1d4a91);}(_0xadb5,0xad));var _0x5adb=function(_0x47936d,_0x2403a1){_0x47936d=_0x47936d-0x0;var _0x31bc43=_0xadb5[_0x47936d];return _0x31bc43;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 4004f96..3572bee 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 _0x0127=['update','removeListener','register','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x5787e9,_0x5e2be6){var _0x7bb998=function(_0xb5dfe8){while(--_0xb5dfe8){_0x5787e9['push'](_0x5787e9['shift']());}};_0x7bb998(++_0x5e2be6);}(_0x0127,0xa0));var _0x7012=function(_0x31e511,_0x2dedb9){_0x31e511=_0x31e511-0x0;var _0x1cf899=_0x0127[_0x31e511];return _0x1cf899;};'use strict';var OpenchannelMessageEvents=require(_0x7012('0x0'));var events=['save',_0x7012('0x1'),_0x7012('0x2')];function createListener(_0x4a6b99,_0x467838){return function(_0x2c65bc){_0x467838['emit'](_0x4a6b99,_0x2c65bc);};}function removeListener(_0x308ba0,_0x35d7d7){return function(){OpenchannelMessageEvents[_0x7012('0x3')](_0x308ba0,_0x35d7d7);};}exports[_0x7012('0x4')]=function(_0x3cfeca){for(var _0x446df5=0x0,_0x21e6a5=events['length'];_0x446df5<_0x21e6a5;_0x446df5++){var _0xaca19a=events[_0x446df5];var _0x2d4954=createListener(_0x7012('0x5')+_0xaca19a,_0x3cfeca);OpenchannelMessageEvents['on'](_0xaca19a,_0x2d4954);}}; \ No newline at end of file +var _0xaa00=['./openchannelMessage.events','save','remove','update','removeListener'];(function(_0x506eee,_0x567df1){var _0x275ef0=function(_0x2a583a){while(--_0x2a583a){_0x506eee['push'](_0x506eee['shift']());}};_0x275ef0(++_0x567df1);}(_0xaa00,0x1f4));var _0x0aa0=function(_0x1671e6,_0xe83fb6){_0x1671e6=_0x1671e6-0x0;var _0x2da936=_0xaa00[_0x1671e6];return _0x2da936;};'use strict';var OpenchannelMessageEvents=require(_0x0aa0('0x0'));var events=[_0x0aa0('0x1'),_0x0aa0('0x2'),_0x0aa0('0x3')];function createListener(_0x265751,_0x29252f){return function(_0x1118b1){_0x29252f['emit'](_0x265751,_0x1118b1);};}function removeListener(_0x15098c,_0x182cee){return function(){OpenchannelMessageEvents[_0x0aa0('0x4')](_0x15098c,_0x182cee);};}exports['register']=function(_0x484708){for(var _0x150c01=0x0,_0x24db82=events['length'];_0x150c01<_0x24db82;_0x150c01++){var _0x2524d5=events[_0x150c01];var _0xa371c0=createListener('openchannelMessage:'+_0x2524d5,_0x484708);OpenchannelMessageEvents['on'](_0x2524d5,_0xa371c0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index bee7c66..f78a48a 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 _0x1fbc=['removeTeams','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fbc,0xe2));var _0xc1fb=function(_0x3010be,_0x1ac04c){_0x3010be=_0x3010be-0x0;var _0x17836e=_0x1fbc[_0x3010be];return _0x17836e;};'use strict';var multer=require(_0xc1fb('0x0'));var util=require(_0xc1fb('0x1'));var path=require(_0xc1fb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1fb('0x3')]();var fs_extra=require(_0xc1fb('0x4'));var auth=require(_0xc1fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc1fb('0x6'));var controller=require('./openchannelQueue.controller');router[_0xc1fb('0x7')]('/',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x9')]);router[_0xc1fb('0x7')](_0xc1fb('0xa'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0xb')]);router['get'](_0xc1fb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc1fb('0x7')](_0xc1fb('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xc1fb('0xe'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0xf')]);router[_0xc1fb('0x7')](_0xc1fb('0x10'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x11')]);router[_0xc1fb('0x12')]('/',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x13')]);router[_0xc1fb('0x12')]('/:id/teams',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x14')]);router[_0xc1fb('0x12')]('/:id/users',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x15')]);router[_0xc1fb('0x16')]('/:id',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x17')]);router[_0xc1fb('0x18')](_0xc1fb('0xc'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x19')]);router['delete'](_0xc1fb('0xe'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x1a')]);router[_0xc1fb('0x18')](_0xc1fb('0x10'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0d59=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','removeTeams','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x4b72f6,_0x1bae5a){var _0x4f1c3e=function(_0x3cbb76){while(--_0x3cbb76){_0x4b72f6['push'](_0x4b72f6['shift']());}};_0x4f1c3e(++_0x1bae5a);}(_0x0d59,0x9a));var _0x90d5=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x0d59[_0x46ec32];return _0x338f60;};'use strict';var multer=require(_0x90d5('0x0'));var util=require('util');var path=require(_0x90d5('0x1'));var timeout=require('connect-timeout');var express=require(_0x90d5('0x2'));var router=express[_0x90d5('0x3')]();var fs_extra=require(_0x90d5('0x4'));var auth=require(_0x90d5('0x5'));var interaction=require(_0x90d5('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x90d5('0x7')]('/',auth[_0x90d5('0x8')](),controller[_0x90d5('0x9')]);router[_0x90d5('0x7')](_0x90d5('0xa'),auth[_0x90d5('0x8')](),controller[_0x90d5('0xb')]);router[_0x90d5('0x7')](_0x90d5('0xc'),auth[_0x90d5('0x8')](),controller[_0x90d5('0xd')]);router[_0x90d5('0x7')](_0x90d5('0xe'),auth[_0x90d5('0x8')](),controller[_0x90d5('0xf')]);router[_0x90d5('0x7')](_0x90d5('0x10'),auth[_0x90d5('0x8')](),controller[_0x90d5('0x11')]);router[_0x90d5('0x7')](_0x90d5('0x12'),auth[_0x90d5('0x8')](),controller[_0x90d5('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x90d5('0x14')](_0x90d5('0x10'),auth['isAuthenticated'](),controller[_0x90d5('0x15')]);router[_0x90d5('0x14')](_0x90d5('0x12'),auth[_0x90d5('0x8')](),controller[_0x90d5('0x16')]);router[_0x90d5('0x17')](_0x90d5('0xc'),auth[_0x90d5('0x8')](),controller[_0x90d5('0x18')]);router[_0x90d5('0x19')](_0x90d5('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x90d5('0x19')](_0x90d5('0x10'),auth[_0x90d5('0x8')](),controller[_0x90d5('0x1a')]);router['delete']('/:id/users',auth[_0x90d5('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 985864b..b965e9e 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 _0x430c=['name','ENUM','beepall','exports','STRING'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x430c,0x8a));var _0xc430=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x430c[_0x29c3b2];return _0x4b3aa7;};'use strict';var Sequelize=require('sequelize');module[_0xc430('0x0')]={'name':{'type':Sequelize[_0xc430('0x1')],'unique':_0xc430('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc430('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc430('0x3')]('rrmemory',_0xc430('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x6bcd=['INTEGER','ENUM','rrmemory','roundrobin','exports','STRING'];(function(_0x178563,_0x28a47f){var _0x56e103=function(_0x197e5f){while(--_0x197e5f){_0x178563['push'](_0x178563['shift']());}};_0x56e103(++_0x28a47f);}(_0x6bcd,0x100));var _0xd6bc=function(_0x19615d,_0x296bf1){_0x19615d=_0x19615d-0x0;var _0x2b13bc=_0x6bcd[_0x19615d];return _0x2b13bc;};'use strict';var Sequelize=require('sequelize');module[_0xd6bc('0x0')]={'name':{'type':Sequelize[_0xd6bc('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd6bc('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd6bc('0x3')](_0xd6bc('0x4'),'beepall',_0xd6bc('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index b1ecb3a..254e87e 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 _0x80bf=['redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','OpenchannelQueues','error','name','send','OpenchannelQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','model','keys','rawAttributes','attributes','intersection','fields','length','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','filters','OpenchannelQueueId','filter','map','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','SIP','getTeams','Team','addTeams','Agents','online','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults'];(function(_0xbc9ae6,_0x3b7c66){var _0x33446e=function(_0x2222c1){while(--_0x2222c1){_0xbc9ae6['push'](_0xbc9ae6['shift']());}};_0x33446e(++_0x3b7c66);}(_0x80bf,0x163));var _0xf80b=function(_0x4d6451,_0x214b3e){_0x4d6451=_0x4d6451-0x0;var _0x599768=_0x80bf[_0x4d6451];return _0x599768;};'use strict';var BPromise=require(_0xf80b('0x0'));var util=require(_0xf80b('0x1'));var _=require(_0xf80b('0x2'));var squel=require(_0xf80b('0x3'));var Redis=require(_0xf80b('0x4'));var qs=require(_0xf80b('0x5'));var logger=require(_0xf80b('0x6'))(_0xf80b('0x7'));var config=require(_0xf80b('0x8'));var db=require(_0xf80b('0x9'))['db'];config['redis']=_[_0xf80b('0xa')](config[_0xf80b('0xb')],{'host':_0xf80b('0xc'),'port':0x18eb});var socket=require(_0xf80b('0xd'))(new Redis(config[_0xf80b('0xb')]));require('./openchannelQueue.socket')[_0xf80b('0xe')](socket);function respondWithStatusCode(_0x4d2c1d,_0x27c7c4){_0x27c7c4=_0x27c7c4||0xcc;return function(_0xf54599){if(_0xf54599){return _0x4d2c1d[_0xf80b('0xf')](_0x27c7c4);}return _0x4d2c1d[_0xf80b('0x10')](_0x27c7c4)[_0xf80b('0x11')]();};}function respondWithResult(_0x3c0144,_0x5b07cc){_0x5b07cc=_0x5b07cc||0xc8;return function(_0xc01cfd){if(_0xc01cfd){return _0x3c0144[_0xf80b('0x10')](_0x5b07cc)[_0xf80b('0x12')](_0xc01cfd);}};}function respondWithFilteredResult(_0x1f50cb,_0x124b40){return function(_0x515c51){if(_0x515c51){var _0x798117=typeof _0x124b40[_0xf80b('0x13')]===_0xf80b('0x14')&&typeof _0x124b40[_0xf80b('0x15')]===_0xf80b('0x14');var _0x348293=_0x515c51[_0xf80b('0x16')];var _0x563815=_0x798117?0x0:_0x124b40['offset'];var _0x9a87f6=_0x798117?_0x515c51['count']:_0x124b40['offset']+_0x124b40[_0xf80b('0x15')];var _0x17c8cd;if(_0x9a87f6>=_0x348293){_0x9a87f6=_0x348293;_0x17c8cd=0xc8;}else{_0x17c8cd=0xce;}_0x1f50cb[_0xf80b('0x10')](_0x17c8cd);return _0x1f50cb[_0xf80b('0x17')](_0xf80b('0x18'),_0x563815+'-'+_0x9a87f6+'/'+_0x348293)[_0xf80b('0x12')](_0x515c51);}return null;};}function saveUpdates(_0x192c48){return function(_0xfb5bee){if(_0xfb5bee){return _0xfb5bee[_0xf80b('0x19')](_0x192c48)[_0xf80b('0x1a')](function(_0x2eb103){return _0x2eb103;});}return null;};}function removeEntity(_0x562043){return function(_0x59da79){if(_0x59da79){return _0x59da79[_0xf80b('0x1b')]()['then'](function(){var _0x12d75a=_0x59da79[_0xf80b('0x1c')]({'plain':!![]});var _0x1e3d7e=_0xf80b('0x1d');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e3d7e,'resourceId':_0x12d75a['id']}})[_0xf80b('0x1a')](function(){return _0x59da79;});})[_0xf80b('0x1a')](function(){_0x562043[_0xf80b('0x10')](0xcc)[_0xf80b('0x11')]();});}};}function handleEntityNotFound(_0x216815){return function(_0xb536cd){if(!_0xb536cd){_0x216815[_0xf80b('0xf')](0x194);}return _0xb536cd;};}function handleError(_0x18de2e,_0x619640){_0x619640=_0x619640||0x1f4;return function(_0x1167e4){logger[_0xf80b('0x1e')](_0x1167e4['stack']);if(_0x1167e4[_0xf80b('0x1f')]){delete _0x1167e4[_0xf80b('0x1f')];}_0x18de2e[_0xf80b('0x10')](_0x619640)[_0xf80b('0x20')](_0x1167e4);};}exports['index']=function(_0x39caab,_0x5e14ff){var _0x3dc894={};var _0x490c30={'count':0x0,'rows':[]};var _0x1ab366=_['map'](db[_0xf80b('0x21')]['rawAttributes'],function(_0x5498d2){return{'name':_0x5498d2[_0xf80b('0x22')],'type':_0x5498d2[_0xf80b('0x23')][_0xf80b('0x24')]};});_0x3dc894=qs[_0xf80b('0x25')](_0x1ab366,_0x39caab);var _0x1d4e75={'where':_0x3dc894[_0xf80b('0x26')]};return db[_0xf80b('0x21')]['count'](_0x1d4e75)['then'](function(_0x49f0d0){_0x490c30[_0xf80b('0x16')]=_0x49f0d0;_0x3dc894[_0xf80b('0x27')]=qs[_0xf80b('0x27')](_0x39caab[_0xf80b('0x28')]);return db[_0xf80b('0x21')][_0xf80b('0x29')](_0x3dc894);})[_0xf80b('0x1a')](function(_0x4d1d9b){_0x490c30[_0xf80b('0x2a')]=_0x4d1d9b;return _0x490c30;})['then'](respondWithFilteredResult(_0x5e14ff,_0x3dc894))[_0xf80b('0x2b')](handleError(_0x5e14ff,null));};exports['show']=function(_0x464e15,_0x581218){var _0x4db465={'raw':!![],'where':{'id':_0x464e15['params']['id']}},_0x5ce20a={};_0x5ce20a[_0xf80b('0x2c')]=_[_0xf80b('0x2d')](db[_0xf80b('0x21')][_0xf80b('0x2e')]);_0x5ce20a['query']=_[_0xf80b('0x2d')](_0x464e15[_0xf80b('0x28')]);_0x5ce20a['filters']=_['intersection'](_0x5ce20a[_0xf80b('0x2c')],_0x5ce20a['query']);_0x4db465[_0xf80b('0x2f')]=_[_0xf80b('0x30')](_0x5ce20a[_0xf80b('0x2c')],qs[_0xf80b('0x31')](_0x464e15['query'][_0xf80b('0x31')]));_0x4db465[_0xf80b('0x2f')]=_0x4db465[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x4db465[_0xf80b('0x2f')]:_0x5ce20a[_0xf80b('0x2c')];if(_0x464e15[_0xf80b('0x28')]['includeAll']){_0x4db465['include']=[{'all':!![]}];}_0x4db465=_[_0xf80b('0x33')]({},_0x4db465,_0x464e15[_0xf80b('0x34')]);return db[_0xf80b('0x21')]['find'](_0x4db465)[_0xf80b('0x1a')](handleEntityNotFound(_0x581218,null))[_0xf80b('0x1a')](respondWithResult(_0x581218,null))[_0xf80b('0x2b')](handleError(_0x581218,null));};exports[_0xf80b('0x35')]=function(_0x2a72bb,_0x2e06b8){return db[_0xf80b('0x21')]['create'](_0x2a72bb[_0xf80b('0x36')],{})[_0xf80b('0x1a')](function(_0x316001){var _0x869354=_0x2a72bb['user'][_0xf80b('0x1c')]({'plain':!![]});if(!_0x869354)throw new Error(_0xf80b('0x37'));if(_0x869354[_0xf80b('0x38')]==='user'){var _0x1650d3=_0x316001[_0xf80b('0x1c')]({'plain':!![]});var _0x31d19e='OpenchannelQueues';return db[_0xf80b('0x39')][_0xf80b('0x3a')]({'where':{'name':_0x31d19e,'userProfileId':_0x869354[_0xf80b('0x3b')]},'raw':!![]})[_0xf80b('0x1a')](function(_0x33f8c5){if(_0x33f8c5&&_0x33f8c5[_0xf80b('0x3c')]===0x0){return db[_0xf80b('0x3d')][_0xf80b('0x35')]({'name':_0x1650d3[_0xf80b('0x1f')],'resourceId':_0x1650d3['id'],'type':_0x33f8c5['name'],'sectionId':_0x33f8c5['id']},{})['then'](function(){return _0x316001;});}else{return _0x316001;}})['catch'](function(_0x56e995){logger['error'](_0xf80b('0x3e'),_0x56e995);throw _0x56e995;});}return _0x316001;})['then'](respondWithResult(_0x2e06b8,0xc9))['catch'](handleError(_0x2e06b8,null));};exports[_0xf80b('0x19')]=function(_0x2747ea,_0x1ff61e){if(_0x2747ea[_0xf80b('0x36')]['id']){delete _0x2747ea[_0xf80b('0x36')]['id'];}return db[_0xf80b('0x21')][_0xf80b('0x3a')]({'where':{'id':_0x2747ea[_0xf80b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1ff61e,null))['then'](saveUpdates(_0x2747ea[_0xf80b('0x36')],null))[_0xf80b('0x1a')](respondWithResult(_0x1ff61e,null))[_0xf80b('0x2b')](handleError(_0x1ff61e,null));};exports[_0xf80b('0x1b')]=function(_0x4fb982,_0x3af70e){return db['OpenchannelQueue']['find']({'where':{'id':_0x4fb982[_0xf80b('0x3f')]['id']}})[_0xf80b('0x1a')](handleEntityNotFound(_0x3af70e,null))[_0xf80b('0x1a')](removeEntity(_0x3af70e,null))['catch'](handleError(_0x3af70e,null));};exports[_0xf80b('0x40')]=function(_0xecb58b,_0x1210e9){return db[_0xf80b('0x21')][_0xf80b('0x40')]()['then'](respondWithResult(_0x1210e9,null))[_0xf80b('0x2b')](handleError(_0x1210e9,null));};exports[_0xf80b('0x41')]=function(_0x4c30c7,_0x4b88b3){var _0x5046ad={'raw':!![],'where':{}},_0x21e94f={},_0x483dec;return db[_0xf80b('0x21')][_0xf80b('0x42')]({'where':{'id':_0x4c30c7['params']['id']}})['then'](handleEntityNotFound(_0x4b88b3,null))[_0xf80b('0x1a')](function(_0x336e63){if(_0x336e63){_0x483dec=_0x336e63[_0xf80b('0x1c')]({'plain':!![]});_0x21e94f[_0xf80b('0x2c')]=_['keys'](db[_0xf80b('0x43')][_0xf80b('0x2e')]);_0x21e94f[_0xf80b('0x28')]=_['keys'](_0x4c30c7[_0xf80b('0x28')]);_0x21e94f['filters']=_[_0xf80b('0x30')](_0x21e94f['model'],_0x21e94f[_0xf80b('0x28')]);_0x5046ad[_0xf80b('0x2f')]=_['intersection'](_0x21e94f[_0xf80b('0x2c')],qs['fields'](_0x4c30c7['query']['fields']));_0x5046ad[_0xf80b('0x2f')]=_0x5046ad[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x5046ad[_0xf80b('0x2f')]:_0x21e94f['model'];if(!_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x44')](_0xf80b('0x45'))){_0x5046ad[_0xf80b('0x15')]=qs[_0xf80b('0x15')](_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x15')]);_0x5046ad[_0xf80b('0x13')]=qs[_0xf80b('0x13')](_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x13')]);}_0x5046ad[_0xf80b('0x46')]=qs['sort'](_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x47')]);_0x5046ad['where']=qs['filters'](_[_0xf80b('0x48')](_0x4c30c7['query'],_0x21e94f[_0xf80b('0x49')]));_0x5046ad[_0xf80b('0x26')][_0xf80b('0x4a')]=_0x336e63['id'];if(_0x4c30c7['query'][_0xf80b('0x4b')]){_0x5046ad[_0xf80b('0x26')]=_['merge'](_0x5046ad[_0xf80b('0x26')],{'$or':_[_0xf80b('0x4c')](_0x5046ad[_0xf80b('0x2f')],function(_0x55dc2d){var _0x394973={};_0x394973[_0x55dc2d]={'$like':'%'+_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x4b')]+'%'};return _0x394973;})});}_0x5046ad=_[_0xf80b('0x33')]({},_0x5046ad,_0x4c30c7['options']);return db[_0xf80b('0x43')]['findAll'](_0x5046ad);}})[_0xf80b('0x1a')](function(_0x5aa503){if(_0x5aa503){return db[_0xf80b('0x4d')][_0xf80b('0x4e')]({'where':{'id':_['map'](_0x5aa503,_0xf80b('0x4f')),'role':_0xf80b('0x50')},'attributes':['id',_0xf80b('0x1f'),_0xf80b('0x51'),_0xf80b('0x52'),'createdAt']});}})[_0xf80b('0x1a')](function(_0x491af1){if(_0x491af1){return{'count':_0x491af1[_0xf80b('0x16')],'rows':_['map'](_0x491af1[_0xf80b('0x2a')],function(_0x4e2c61){return{'membername':_0x4e2c61['name'],'UserId':_0x4e2c61['id'],'queue_name':_0x483dec['name'],'OpenchannelQueueId':_0x483dec['id'],'interface':util[_0xf80b('0x53')]('%s/%s',_0xf80b('0x54'),_0x4e2c61['name']),'penalty':0x0,'paused':_0x4e2c61[_0xf80b('0x51')],'createdAt':_0x4e2c61['createdAt'],'updatedAt':_0x4e2c61['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf80b('0x1a')](respondWithFilteredResult(_0x4b88b3,_0x5046ad))[_0xf80b('0x2b')](handleError(_0x4b88b3,null));};exports[_0xf80b('0x55')]=function(_0xe4dc5a,_0x67248f){var _0x3ff7b0={};var _0x4c9e82={};var _0x5312ce;var _0x49d63f;return db[_0xf80b('0x21')][_0xf80b('0x42')]({'where':{'id':_0xe4dc5a[_0xf80b('0x3f')]['id']}})[_0xf80b('0x1a')](handleEntityNotFound(_0x67248f,null))[_0xf80b('0x1a')](function(_0x1e577f){if(_0x1e577f){_0x5312ce=_0x1e577f;_0x4c9e82[_0xf80b('0x2c')]=_[_0xf80b('0x2d')](db[_0xf80b('0x56')][_0xf80b('0x2e')]);_0x4c9e82[_0xf80b('0x28')]=_[_0xf80b('0x2d')](_0xe4dc5a[_0xf80b('0x28')]);_0x4c9e82[_0xf80b('0x49')]=_[_0xf80b('0x30')](_0x4c9e82[_0xf80b('0x2c')],_0x4c9e82[_0xf80b('0x28')]);_0x3ff7b0['attributes']=_[_0xf80b('0x30')](_0x4c9e82[_0xf80b('0x2c')],qs[_0xf80b('0x31')](_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x31')]));_0x3ff7b0[_0xf80b('0x2f')]=_0x3ff7b0[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x3ff7b0['attributes']:_0x4c9e82[_0xf80b('0x2c')];_0x3ff7b0[_0xf80b('0x46')]=qs[_0xf80b('0x47')](_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x47')]);_0x3ff7b0[_0xf80b('0x26')]=qs[_0xf80b('0x49')](_[_0xf80b('0x48')](_0xe4dc5a['query'],_0x4c9e82['filters']));if(_0xe4dc5a['query']['filter']){_0x3ff7b0[_0xf80b('0x26')]=_[_0xf80b('0x33')](_0x3ff7b0['where'],{'$or':_[_0xf80b('0x4c')](_0x3ff7b0[_0xf80b('0x2f')],function(_0x432ac9){var _0x26f1f3={};_0x26f1f3[_0x432ac9]={'$like':'%'+_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x4b')]+'%'};return _0x26f1f3;})});}_0x3ff7b0=_[_0xf80b('0x33')]({},_0x3ff7b0,_0xe4dc5a[_0xf80b('0x34')]);return _0x5312ce['getTeams'](_0x3ff7b0);}})['then'](function(_0x494ff5){if(_0x494ff5){_0x49d63f=_0x494ff5[_0xf80b('0x32')];if(!_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x44')](_0xf80b('0x45'))){_0x3ff7b0[_0xf80b('0x15')]=qs[_0xf80b('0x15')](_0xe4dc5a[_0xf80b('0x28')]['limit']);_0x3ff7b0[_0xf80b('0x13')]=qs[_0xf80b('0x13')](_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x13')]);}return _0x5312ce['getTeams'](_0x3ff7b0);}})[_0xf80b('0x1a')](function(_0x3fc818){if(_0x3fc818){return _0x3fc818?{'count':_0x49d63f,'rows':_0x3fc818}:null;}})[_0xf80b('0x1a')](respondWithResult(_0x67248f,null))[_0xf80b('0x2b')](handleError(_0x67248f,null));};exports[_0xf80b('0x57')]=function(_0x2c0f2a,_0x5b5400){var _0xb44f10=_0x2c0f2a[_0xf80b('0x36')]['ids'];return db[_0xf80b('0x56')][_0xf80b('0x29')]({'where':{'id':_0xb44f10},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf80b('0x58'),'attributes':['id',_0xf80b('0x1f'),_0xf80b('0x59'),'voicePause','interface'],'raw':!![]}]})[_0xf80b('0x1a')](function(_0x117186){if(_0x117186){var _0x1a9af7=_['flatMap'](_0x117186,function(_0x457f04){var _0x3cc368=_0x457f04['get']({'plain':!![]});return _0x3cc368[_0xf80b('0x58')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x2c0f2a[_0xf80b('0x3f')]['id']}})[_0xf80b('0x1a')](function(_0x3587d4){return db[_0xf80b('0x5a')]['transaction'](function(_0x59f90b){return _0x3587d4['addTeams'](_0xb44f10,{'transaction':_0x59f90b})[_0xf80b('0x1a')](function(){return BPromise[_0xf80b('0x5b')](_0x1a9af7,function(_0x42bc96){return db[_0xf80b('0x43')][_0xf80b('0x5c')]({'where':{'UserId':_0x42bc96['id'],'OpenchannelQueueId':_0x2c0f2a[_0xf80b('0x3f')]['id']},'transaction':_0x59f90b});});})[_0xf80b('0x1a')](function(){_0x1a9af7[_0xf80b('0x5d')](function(_0x51a5d5){socket[_0xf80b('0x5e')](_0xf80b('0x5f'),{'UserId':_0x51a5d5['id'],'OpenchannelQueueId':_0x3587d4['id']});});});});});}})[_0xf80b('0x1a')](respondWithStatusCode(_0x5b5400,null))[_0xf80b('0x2b')](handleError(_0x5b5400,null));};exports[_0xf80b('0x60')]=function(_0x2b13dc,_0x41a03f){return db['Team'][_0xf80b('0x29')]({'where':{'id':_0x2b13dc[_0xf80b('0x28')][_0xf80b('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf80b('0x4d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf80b('0x1a')](handleEntityNotFound(_0x41a03f,null))[_0xf80b('0x1a')](function(_0x3ecdb0){var _0x55ed2f=_[_0xf80b('0x4c')](_0x3ecdb0,'id');var _0x840308=[];var _0x1e8ea2=[];var _0x25e06c=squel[_0xf80b('0x62')]();_0x25e06c[_0xf80b('0x63')]('tq.TeamId')[_0xf80b('0x64')]('team_has_openchannel_queues','tq')[_0xf80b('0x65')](_0xf80b('0x66'),'ut',_0xf80b('0x67'))[_0xf80b('0x26')]('OpenchannelQueueId\x20=\x20?',_0x2b13dc[_0xf80b('0x3f')]['id']);for(var _0x2a2a2b=0x0;_0x2a2a2b<_0x3ecdb0['length'];_0x2a2a2b+=0x1){let _0x1a1c26=_0x3ecdb0[_0x2a2a2b];for(var _0x23c095=0x0;_0x23c095<_0x1a1c26[_0xf80b('0x58')][_0xf80b('0x32')];_0x23c095+=0x1){let _0xbe24f2=_0x1a1c26[_0xf80b('0x58')][_0x23c095];var _0x4ce95f=_0x25e06c[_0xf80b('0x68')]();_0x4ce95f['where'](_0xf80b('0x69'),_0xbe24f2['id']);_0x1e8ea2[_0xf80b('0x6a')](db[_0xf80b('0x5a')]['query'](_0x4ce95f[_0xf80b('0x6b')](),{'type':db[_0xf80b('0x5a')][_0xf80b('0x6c')][_0xf80b('0x6d')]})[_0xf80b('0x1a')](function(_0x342193){if(_0x342193['length']===0x1){return _0xbe24f2['id'];}else{var _0x2bc855=_['every'](_['map'](_0x342193,'TeamId'),function(_0x851c50){return _[_0xf80b('0x6e')](_0x55ed2f,_0x851c50);});if(_0x2bc855){return _0xbe24f2['id'];}}}));}}return BPromise[_0xf80b('0x6f')](_0x1e8ea2)[_0xf80b('0x1a')](function(_0xd11d9a){_0x840308=_(_0x840308)[_0xf80b('0x70')](_0xd11d9a)[_0xf80b('0x71')]()[_0xf80b('0x72')]();return db[_0xf80b('0x21')][_0xf80b('0x3a')]({'where':{'id':_0x2b13dc['params']['id']}})[_0xf80b('0x1a')](function(_0x146438){return db[_0xf80b('0x5a')]['transaction'](function(_0x53123f){return _0x146438[_0xf80b('0x60')](_0x2b13dc['query']['ids'],{'transaction':_0x53123f})[_0xf80b('0x1a')](function(){if(!_[_0xf80b('0x73')](_0x840308)){return _0x146438[_0xf80b('0x74')](_0x840308,{'transaction':_0x53123f});}})['then'](function(){_0x840308[_0xf80b('0x5d')](function(_0x36a07b){socket[_0xf80b('0x5e')](_0xf80b('0x75'),{'UserId':_0x36a07b,'OpenchannelQueueId':_0x146438['id']});});});});});});})[_0xf80b('0x1a')](respondWithStatusCode(_0x41a03f,null))[_0xf80b('0x2b')](handleError(_0x41a03f,null));};exports[_0xf80b('0x76')]=function(_0x460f1a,_0xc4ba6d){return db['OpenchannelQueue']['find']({'where':{'id':_0x460f1a[_0xf80b('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc4ba6d,null))[_0xf80b('0x1a')](function(_0x278ff0){if(_0x278ff0){return _0x278ff0[_0xf80b('0x76')](_0x460f1a[_0xf80b('0x36')][_0xf80b('0x61')],_[_0xf80b('0x77')](_0x460f1a[_0xf80b('0x36')],[_0xf80b('0x61'),'id'])||{})[_0xf80b('0x78')](function(_0x2b5d3e){for(var _0x3b0084=0x0;_0x3b0084<_0x460f1a['body'][_0xf80b('0x61')]['length'];_0x3b0084+=0x1){socket[_0xf80b('0x5e')](_0xf80b('0x5f'),{'UserId':Number(_0x460f1a[_0xf80b('0x36')][_0xf80b('0x61')][_0x3b0084]),'OpenchannelQueueId':Number(_0x460f1a[_0xf80b('0x3f')]['id'])});}return _0x2b5d3e;});}})['then'](respondWithResult(_0xc4ba6d,null))[_0xf80b('0x2b')](handleError(_0xc4ba6d,null));};exports[_0xf80b('0x74')]=function(_0x2f900a,_0x2f9c5c){return db[_0xf80b('0x21')][_0xf80b('0x3a')]({'where':{'id':_0x2f900a[_0xf80b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f9c5c,null))[_0xf80b('0x1a')](function(_0x2bbef9){if(_0x2bbef9){return _0x2bbef9['removeAgents'](_0x2f900a[_0xf80b('0x28')][_0xf80b('0x61')])[_0xf80b('0x1a')](function(){if(_['isArray'](_0x2f900a['query'][_0xf80b('0x61')])){for(var _0x1997c0=0x0;_0x1997c0<_0x2f900a[_0xf80b('0x28')][_0xf80b('0x61')][_0xf80b('0x32')];_0x1997c0+=0x1){socket[_0xf80b('0x5e')](_0xf80b('0x75'),{'UserId':Number(_0x2f900a['query']['ids'][_0x1997c0]),'OpenchannelQueueId':Number(_0x2f900a[_0xf80b('0x3f')]['id'])});}}else{socket[_0xf80b('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2f900a['query'][_0xf80b('0x61')]),'OpenchannelQueueId':Number(_0x2f900a['params']['id'])});}});}})[_0xf80b('0x1a')](respondWithStatusCode(_0x2f9c5c,null))['catch'](handleError(_0x2f9c5c,null));};exports['getAgents']=function(_0xee3957,_0x3b98df){var _0x2f0948={};var _0x42cef6={};var _0x5361af;var _0xe4973d;return db[_0xf80b('0x21')]['findOne']({'where':{'id':_0xee3957['params']['id']}})[_0xf80b('0x1a')](handleEntityNotFound(_0x3b98df,null))[_0xf80b('0x1a')](function(_0x5f1a26){if(_0x5f1a26){_0x5361af=_0x5f1a26;_0x42cef6['model']=_[_0xf80b('0x2d')](db[_0xf80b('0x4d')][_0xf80b('0x2e')]);_0x42cef6[_0xf80b('0x28')]=_[_0xf80b('0x2d')](_0xee3957['query']);_0x42cef6[_0xf80b('0x49')]=_['intersection'](_0x42cef6[_0xf80b('0x2c')],_0x42cef6[_0xf80b('0x28')]);_0x2f0948['attributes']=_[_0xf80b('0x30')](_0x42cef6['model'],qs[_0xf80b('0x31')](_0xee3957['query']['fields']));_0x2f0948[_0xf80b('0x2f')]=_0x2f0948[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x2f0948[_0xf80b('0x2f')]:_0x42cef6['model'];_0x2f0948[_0xf80b('0x46')]=qs['sort'](_0xee3957[_0xf80b('0x28')][_0xf80b('0x47')]);_0x2f0948[_0xf80b('0x26')]=qs['filters'](_[_0xf80b('0x48')](_0xee3957['query'],_0x42cef6['filters']));if(_0xee3957[_0xf80b('0x28')]['filter']){_0x2f0948[_0xf80b('0x26')]=_[_0xf80b('0x33')](_0x2f0948[_0xf80b('0x26')],{'$or':_[_0xf80b('0x4c')](_0x2f0948['attributes'],function(_0x28572d){var _0x228b76={};_0x228b76[_0x28572d]={'$like':'%'+_0xee3957[_0xf80b('0x28')]['filter']+'%'};return _0x228b76;})});}_0x2f0948=_[_0xf80b('0x33')]({},_0x2f0948,_0xee3957['options']);return _0x5361af[_0xf80b('0x79')](_0x2f0948);}})['then'](function(_0x15528b){if(_0x15528b){_0xe4973d=_0x15528b['length'];if(!_0xee3957[_0xf80b('0x28')]['hasOwnProperty'](_0xf80b('0x45'))){_0x2f0948[_0xf80b('0x15')]=qs[_0xf80b('0x15')](_0xee3957['query'][_0xf80b('0x15')]);_0x2f0948[_0xf80b('0x13')]=qs[_0xf80b('0x13')](_0xee3957[_0xf80b('0x28')]['offset']);}return _0x5361af[_0xf80b('0x79')](_0x2f0948);}})[_0xf80b('0x1a')](function(_0x4002c0){if(_0x4002c0){return _0x4002c0?{'count':_0xe4973d,'rows':_0x4002c0}:null;}})[_0xf80b('0x1a')](respondWithResult(_0x3b98df,null))['catch'](handleError(_0x3b98df,null));}; \ No newline at end of file +var _0x8540=['userOpenchannelQueue:save','removeTeams','field','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','value','userOpenchannelQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','offset','undefined','Content-Range','update','then','destroy','get','OpenchannelQueues','sendStatus','error','name','send','map','OpenchannelQueue','rawAttributes','getOptions','count','include','query','findAll','params','model','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','findOne','UserOpenchannelQueue','keys','filters','hasOwnProperty','nolimit','limit','order','sort','pick','OpenchannelQueueId','filter','where','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','transaction','findOrCreate','forEach','emit'];(function(_0x432322,_0x73dcac){var _0x53142b=function(_0x207fb0){while(--_0x207fb0){_0x432322['push'](_0x432322['shift']());}};_0x53142b(++_0x73dcac);}(_0x8540,0x1ed));var _0x0854=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0x8540[_0xbbfe59];return _0x28a2a4;};'use strict';var BPromise=require('bluebird');var util=require(_0x0854('0x0'));var _=require(_0x0854('0x1'));var squel=require(_0x0854('0x2'));var Redis=require(_0x0854('0x3'));var qs=require(_0x0854('0x4'));var logger=require('../../config/logger')(_0x0854('0x5'));var config=require(_0x0854('0x6'));var db=require(_0x0854('0x7'))['db'];config[_0x0854('0x8')]=_[_0x0854('0x9')](config[_0x0854('0x8')],{'host':_0x0854('0xa'),'port':0x18eb});var socket=require(_0x0854('0xb'))(new Redis(config['redis']));require(_0x0854('0xc'))[_0x0854('0xd')](socket);function respondWithStatusCode(_0x49f503,_0x33a534){_0x33a534=_0x33a534||0xcc;return function(_0x48e95f){if(_0x48e95f){return _0x49f503['sendStatus'](_0x33a534);}return _0x49f503['status'](_0x33a534)[_0x0854('0xe')]();};}function respondWithResult(_0x10d7a7,_0x5f9fbc){_0x5f9fbc=_0x5f9fbc||0xc8;return function(_0x79da37){if(_0x79da37){return _0x10d7a7[_0x0854('0xf')](_0x5f9fbc)[_0x0854('0x10')](_0x79da37);}};}function respondWithFilteredResult(_0x1eeb51,_0x1fb847){return function(_0x1d226c){if(_0x1d226c){var _0x2ed6fb=typeof _0x1fb847[_0x0854('0x11')]===_0x0854('0x12')&&typeof _0x1fb847['limit']===_0x0854('0x12');var _0x39a01c=_0x1d226c['count'];var _0x3a4419=_0x2ed6fb?0x0:_0x1fb847['offset'];var _0xfb2121=_0x2ed6fb?_0x1d226c['count']:_0x1fb847[_0x0854('0x11')]+_0x1fb847['limit'];var _0x268d4b;if(_0xfb2121>=_0x39a01c){_0xfb2121=_0x39a01c;_0x268d4b=0xc8;}else{_0x268d4b=0xce;}_0x1eeb51[_0x0854('0xf')](_0x268d4b);return _0x1eeb51['set'](_0x0854('0x13'),_0x3a4419+'-'+_0xfb2121+'/'+_0x39a01c)['json'](_0x1d226c);}return null;};}function saveUpdates(_0x24161a){return function(_0x3a3182){if(_0x3a3182){return _0x3a3182[_0x0854('0x14')](_0x24161a)[_0x0854('0x15')](function(_0x1660cb){return _0x1660cb;});}return null;};}function removeEntity(_0x85f72c){return function(_0x221d46){if(_0x221d46){return _0x221d46[_0x0854('0x16')]()[_0x0854('0x15')](function(){var _0x5d3b84=_0x221d46[_0x0854('0x17')]({'plain':!![]});var _0x442073=_0x0854('0x18');return db['UserProfileResource'][_0x0854('0x16')]({'where':{'type':_0x442073,'resourceId':_0x5d3b84['id']}})['then'](function(){return _0x221d46;});})['then'](function(){_0x85f72c[_0x0854('0xf')](0xcc)[_0x0854('0xe')]();});}};}function handleEntityNotFound(_0x330f36){return function(_0x148605){if(!_0x148605){_0x330f36[_0x0854('0x19')](0x194);}return _0x148605;};}function handleError(_0x559fda,_0x432940){_0x432940=_0x432940||0x1f4;return function(_0x336e84){logger[_0x0854('0x1a')](_0x336e84['stack']);if(_0x336e84[_0x0854('0x1b')]){delete _0x336e84[_0x0854('0x1b')];}_0x559fda['status'](_0x432940)[_0x0854('0x1c')](_0x336e84);};}exports['index']=function(_0x46b11e,_0x2d4010){var _0x277b94={};var _0x233b72={'count':0x0,'rows':[]};var _0x4cf8b3=_[_0x0854('0x1d')](db[_0x0854('0x1e')][_0x0854('0x1f')],function(_0x470d29){return{'name':_0x470d29['fieldName'],'type':_0x470d29['type']['key']};});_0x277b94=qs[_0x0854('0x20')](_0x4cf8b3,_0x46b11e);var _0x5ec3fa={'where':_0x277b94['where']};return db[_0x0854('0x1e')][_0x0854('0x21')](_0x5ec3fa)[_0x0854('0x15')](function(_0x4362c9){_0x233b72[_0x0854('0x21')]=_0x4362c9;_0x277b94[_0x0854('0x22')]=qs[_0x0854('0x22')](_0x46b11e[_0x0854('0x23')]);return db['OpenchannelQueue'][_0x0854('0x24')](_0x277b94);})['then'](function(_0x19b24c){_0x233b72['rows']=_0x19b24c;return _0x233b72;})[_0x0854('0x15')](respondWithFilteredResult(_0x2d4010,_0x277b94))['catch'](handleError(_0x2d4010,null));};exports['show']=function(_0x16362c,_0x506dc7){var _0x4a2fd9={'raw':!![],'where':{'id':_0x16362c[_0x0854('0x25')]['id']}},_0x27d5ca={};_0x27d5ca[_0x0854('0x26')]=_['keys'](db[_0x0854('0x1e')][_0x0854('0x1f')]);_0x27d5ca['query']=_['keys'](_0x16362c[_0x0854('0x23')]);_0x27d5ca['filters']=_[_0x0854('0x27')](_0x27d5ca[_0x0854('0x26')],_0x27d5ca[_0x0854('0x23')]);_0x4a2fd9[_0x0854('0x28')]=_[_0x0854('0x27')](_0x27d5ca[_0x0854('0x26')],qs[_0x0854('0x29')](_0x16362c['query'][_0x0854('0x29')]));_0x4a2fd9[_0x0854('0x28')]=_0x4a2fd9[_0x0854('0x28')][_0x0854('0x2a')]?_0x4a2fd9[_0x0854('0x28')]:_0x27d5ca['model'];if(_0x16362c[_0x0854('0x23')][_0x0854('0x2b')]){_0x4a2fd9[_0x0854('0x22')]=[{'all':!![]}];}_0x4a2fd9=_[_0x0854('0x2c')]({},_0x4a2fd9,_0x16362c[_0x0854('0x2d')]);return db[_0x0854('0x1e')][_0x0854('0x2e')](_0x4a2fd9)[_0x0854('0x15')](handleEntityNotFound(_0x506dc7,null))[_0x0854('0x15')](respondWithResult(_0x506dc7,null))[_0x0854('0x2f')](handleError(_0x506dc7,null));};exports[_0x0854('0x30')]=function(_0x52174f,_0x468191){return db[_0x0854('0x1e')][_0x0854('0x30')](_0x52174f['body'],{})[_0x0854('0x15')](function(_0x51bbe6){var _0x2cf20a=_0x52174f[_0x0854('0x31')][_0x0854('0x17')]({'plain':!![]});if(!_0x2cf20a)throw new Error(_0x0854('0x32'));if(_0x2cf20a[_0x0854('0x33')]===_0x0854('0x31')){var _0x1eb2f2=_0x51bbe6[_0x0854('0x17')]({'plain':!![]});var _0xc359b6=_0x0854('0x18');return db[_0x0854('0x34')][_0x0854('0x2e')]({'where':{'name':_0xc359b6,'userProfileId':_0x2cf20a[_0x0854('0x35')]},'raw':!![]})['then'](function(_0x9f5297){if(_0x9f5297&&_0x9f5297[_0x0854('0x36')]===0x0){return db[_0x0854('0x37')][_0x0854('0x30')]({'name':_0x1eb2f2['name'],'resourceId':_0x1eb2f2['id'],'type':_0x9f5297[_0x0854('0x1b')],'sectionId':_0x9f5297['id']},{})[_0x0854('0x15')](function(){return _0x51bbe6;});}else{return _0x51bbe6;}})[_0x0854('0x2f')](function(_0x397e50){logger[_0x0854('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x397e50);throw _0x397e50;});}return _0x51bbe6;})[_0x0854('0x15')](respondWithResult(_0x468191,0xc9))[_0x0854('0x2f')](handleError(_0x468191,null));};exports[_0x0854('0x14')]=function(_0x2c0637,_0x490c24){if(_0x2c0637[_0x0854('0x38')]['id']){delete _0x2c0637[_0x0854('0x38')]['id'];}return db[_0x0854('0x1e')][_0x0854('0x2e')]({'where':{'id':_0x2c0637[_0x0854('0x25')]['id']}})['then'](handleEntityNotFound(_0x490c24,null))[_0x0854('0x15')](saveUpdates(_0x2c0637[_0x0854('0x38')],null))['then'](respondWithResult(_0x490c24,null))[_0x0854('0x2f')](handleError(_0x490c24,null));};exports[_0x0854('0x16')]=function(_0x58ef11,_0x3e769c){return db[_0x0854('0x1e')][_0x0854('0x2e')]({'where':{'id':_0x58ef11[_0x0854('0x25')]['id']}})[_0x0854('0x15')](handleEntityNotFound(_0x3e769c,null))[_0x0854('0x15')](removeEntity(_0x3e769c,null))[_0x0854('0x2f')](handleError(_0x3e769c,null));};exports[_0x0854('0x39')]=function(_0x5b1273,_0x5757f0){return db[_0x0854('0x1e')][_0x0854('0x39')]()['then'](respondWithResult(_0x5757f0,null))['catch'](handleError(_0x5757f0,null));};exports[_0x0854('0x3a')]=function(_0x6e6a0b,_0x1a714f){var _0x5eff81={'raw':!![],'where':{}},_0x18038c={},_0x3b94b6;return db[_0x0854('0x1e')][_0x0854('0x3b')]({'where':{'id':_0x6e6a0b[_0x0854('0x25')]['id']}})[_0x0854('0x15')](handleEntityNotFound(_0x1a714f,null))['then'](function(_0x5f2f06){if(_0x5f2f06){_0x3b94b6=_0x5f2f06[_0x0854('0x17')]({'plain':!![]});_0x18038c[_0x0854('0x26')]=_['keys'](db[_0x0854('0x3c')][_0x0854('0x1f')]);_0x18038c[_0x0854('0x23')]=_[_0x0854('0x3d')](_0x6e6a0b['query']);_0x18038c[_0x0854('0x3e')]=_['intersection'](_0x18038c[_0x0854('0x26')],_0x18038c[_0x0854('0x23')]);_0x5eff81[_0x0854('0x28')]=_[_0x0854('0x27')](_0x18038c[_0x0854('0x26')],qs[_0x0854('0x29')](_0x6e6a0b[_0x0854('0x23')]['fields']));_0x5eff81['attributes']=_0x5eff81['attributes']['length']?_0x5eff81[_0x0854('0x28')]:_0x18038c[_0x0854('0x26')];if(!_0x6e6a0b[_0x0854('0x23')][_0x0854('0x3f')](_0x0854('0x40'))){_0x5eff81[_0x0854('0x41')]=qs[_0x0854('0x41')](_0x6e6a0b['query']['limit']);_0x5eff81[_0x0854('0x11')]=qs['offset'](_0x6e6a0b[_0x0854('0x23')]['offset']);}_0x5eff81[_0x0854('0x42')]=qs[_0x0854('0x43')](_0x6e6a0b[_0x0854('0x23')]['sort']);_0x5eff81['where']=qs[_0x0854('0x3e')](_[_0x0854('0x44')](_0x6e6a0b[_0x0854('0x23')],_0x18038c[_0x0854('0x3e')]));_0x5eff81['where'][_0x0854('0x45')]=_0x5f2f06['id'];if(_0x6e6a0b[_0x0854('0x23')][_0x0854('0x46')]){_0x5eff81[_0x0854('0x47')]=_[_0x0854('0x2c')](_0x5eff81[_0x0854('0x47')],{'$or':_[_0x0854('0x1d')](_0x5eff81['attributes'],function(_0x6e918d){var _0x1c37b6={};_0x1c37b6[_0x6e918d]={'$like':'%'+_0x6e6a0b[_0x0854('0x23')][_0x0854('0x46')]+'%'};return _0x1c37b6;})});}_0x5eff81=_[_0x0854('0x2c')]({},_0x5eff81,_0x6e6a0b[_0x0854('0x2d')]);return db[_0x0854('0x3c')][_0x0854('0x24')](_0x5eff81);}})['then'](function(_0x416281){if(_0x416281){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x416281,_0x0854('0x48')),'role':'agent'},'attributes':['id',_0x0854('0x1b'),'openchannelPause',_0x0854('0x49'),_0x0854('0x4a')]});}})['then'](function(_0x8ee16e){if(_0x8ee16e){return{'count':_0x8ee16e[_0x0854('0x21')],'rows':_['map'](_0x8ee16e[_0x0854('0x4b')],function(_0x257afe){return{'membername':_0x257afe[_0x0854('0x1b')],'UserId':_0x257afe['id'],'queue_name':_0x3b94b6['name'],'OpenchannelQueueId':_0x3b94b6['id'],'interface':util[_0x0854('0x4c')](_0x0854('0x4d'),_0x0854('0x4e'),_0x257afe[_0x0854('0x1b')]),'penalty':0x0,'paused':_0x257afe['openchannelPause'],'createdAt':_0x257afe[_0x0854('0x4a')],'updatedAt':_0x257afe[_0x0854('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0854('0x15')](respondWithFilteredResult(_0x1a714f,_0x5eff81))[_0x0854('0x2f')](handleError(_0x1a714f,null));};exports[_0x0854('0x4f')]=function(_0x7ec825,_0x7cbbd1){var _0x5cfde0={};var _0x2b8e28={};var _0x52f12e;var _0x14651d;return db[_0x0854('0x1e')][_0x0854('0x3b')]({'where':{'id':_0x7ec825[_0x0854('0x25')]['id']}})[_0x0854('0x15')](handleEntityNotFound(_0x7cbbd1,null))['then'](function(_0x594ca6){if(_0x594ca6){_0x52f12e=_0x594ca6;_0x2b8e28[_0x0854('0x26')]=_[_0x0854('0x3d')](db[_0x0854('0x50')]['rawAttributes']);_0x2b8e28['query']=_[_0x0854('0x3d')](_0x7ec825[_0x0854('0x23')]);_0x2b8e28['filters']=_[_0x0854('0x27')](_0x2b8e28[_0x0854('0x26')],_0x2b8e28[_0x0854('0x23')]);_0x5cfde0[_0x0854('0x28')]=_[_0x0854('0x27')](_0x2b8e28[_0x0854('0x26')],qs['fields'](_0x7ec825[_0x0854('0x23')][_0x0854('0x29')]));_0x5cfde0['attributes']=_0x5cfde0[_0x0854('0x28')][_0x0854('0x2a')]?_0x5cfde0['attributes']:_0x2b8e28['model'];_0x5cfde0[_0x0854('0x42')]=qs[_0x0854('0x43')](_0x7ec825[_0x0854('0x23')][_0x0854('0x43')]);_0x5cfde0[_0x0854('0x47')]=qs[_0x0854('0x3e')](_[_0x0854('0x44')](_0x7ec825[_0x0854('0x23')],_0x2b8e28[_0x0854('0x3e')]));if(_0x7ec825[_0x0854('0x23')][_0x0854('0x46')]){_0x5cfde0[_0x0854('0x47')]=_[_0x0854('0x2c')](_0x5cfde0[_0x0854('0x47')],{'$or':_['map'](_0x5cfde0[_0x0854('0x28')],function(_0xe4120c){var _0x886d61={};_0x886d61[_0xe4120c]={'$like':'%'+_0x7ec825['query'][_0x0854('0x46')]+'%'};return _0x886d61;})});}_0x5cfde0=_['merge']({},_0x5cfde0,_0x7ec825[_0x0854('0x2d')]);return _0x52f12e['getTeams'](_0x5cfde0);}})['then'](function(_0x550f2e){if(_0x550f2e){_0x14651d=_0x550f2e[_0x0854('0x2a')];if(!_0x7ec825[_0x0854('0x23')][_0x0854('0x3f')](_0x0854('0x40'))){_0x5cfde0[_0x0854('0x41')]=qs['limit'](_0x7ec825[_0x0854('0x23')]['limit']);_0x5cfde0[_0x0854('0x11')]=qs['offset'](_0x7ec825['query'][_0x0854('0x11')]);}return _0x52f12e['getTeams'](_0x5cfde0);}})['then'](function(_0x49e12e){if(_0x49e12e){return _0x49e12e?{'count':_0x14651d,'rows':_0x49e12e}:null;}})[_0x0854('0x15')](respondWithResult(_0x7cbbd1,null))[_0x0854('0x2f')](handleError(_0x7cbbd1,null));};exports[_0x0854('0x51')]=function(_0x45476e,_0x7adcb5){var _0x3043d7=_0x45476e['body'][_0x0854('0x52')];return db[_0x0854('0x50')]['findAll']({'where':{'id':_0x3043d7},'attributes':['id'],'include':[{'model':db[_0x0854('0x53')],'as':_0x0854('0x54'),'attributes':['id',_0x0854('0x1b'),_0x0854('0x55'),_0x0854('0x56'),_0x0854('0x57')],'raw':!![]}]})['then'](function(_0x542aa9){if(_0x542aa9){var _0x3bfa3f=_['flatMap'](_0x542aa9,function(_0xda6a77){var _0xd91f3a=_0xda6a77[_0x0854('0x17')]({'plain':!![]});return _0xd91f3a['Agents'];});return db['OpenchannelQueue'][_0x0854('0x2e')]({'where':{'id':_0x45476e[_0x0854('0x25')]['id']}})[_0x0854('0x15')](function(_0x236198){return db['sequelize'][_0x0854('0x58')](function(_0x2e9625){return _0x236198[_0x0854('0x51')](_0x3043d7,{'transaction':_0x2e9625})[_0x0854('0x15')](function(){return BPromise['each'](_0x3bfa3f,function(_0x56556c){return db[_0x0854('0x3c')][_0x0854('0x59')]({'where':{'UserId':_0x56556c['id'],'OpenchannelQueueId':_0x45476e['params']['id']},'transaction':_0x2e9625});});})[_0x0854('0x15')](function(){_0x3bfa3f[_0x0854('0x5a')](function(_0x4c401d){socket[_0x0854('0x5b')](_0x0854('0x5c'),{'UserId':_0x4c401d['id'],'OpenchannelQueueId':_0x236198['id']});});});});});}})[_0x0854('0x15')](respondWithStatusCode(_0x7adcb5,null))[_0x0854('0x2f')](handleError(_0x7adcb5,null));};exports[_0x0854('0x5d')]=function(_0x2976d0,_0x2963a3){return db[_0x0854('0x50')]['findAll']({'where':{'id':_0x2976d0['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0854('0x15')](handleEntityNotFound(_0x2963a3,null))[_0x0854('0x15')](function(_0xe2433a){var _0x41d856=_['map'](_0xe2433a,'id');var _0x305cb1=[];var _0x3a158d=[];var _0x414189=squel['select']();_0x414189[_0x0854('0x5e')]('tq.TeamId')[_0x0854('0x5f')]('team_has_openchannel_queues','tq')[_0x0854('0x60')]('user_has_teams','ut',_0x0854('0x61'))[_0x0854('0x47')](_0x0854('0x62'),_0x2976d0[_0x0854('0x25')]['id']);for(var _0x22c608=0x0;_0x22c608<_0xe2433a[_0x0854('0x2a')];_0x22c608+=0x1){let _0x1d534c=_0xe2433a[_0x22c608];for(var _0x49f183=0x0;_0x49f183<_0x1d534c[_0x0854('0x54')][_0x0854('0x2a')];_0x49f183+=0x1){let _0x1fb3fb=_0x1d534c[_0x0854('0x54')][_0x49f183];var _0x337e41=_0x414189[_0x0854('0x63')]();_0x337e41[_0x0854('0x47')](_0x0854('0x64'),_0x1fb3fb['id']);_0x3a158d[_0x0854('0x65')](db[_0x0854('0x66')]['query'](_0x337e41[_0x0854('0x67')](),{'type':db['sequelize'][_0x0854('0x68')][_0x0854('0x69')]})[_0x0854('0x15')](function(_0x3e080f){if(_0x3e080f[_0x0854('0x2a')]===0x1){return _0x1fb3fb['id'];}else{var _0x19c6aa=_[_0x0854('0x6a')](_[_0x0854('0x1d')](_0x3e080f,'TeamId'),function(_0x8c556a){return _[_0x0854('0x6b')](_0x41d856,_0x8c556a);});if(_0x19c6aa){return _0x1fb3fb['id'];}}}));}}return BPromise[_0x0854('0x6c')](_0x3a158d)[_0x0854('0x15')](function(_0x39db87){_0x305cb1=_(_0x305cb1)[_0x0854('0x6d')](_0x39db87)['compact']()[_0x0854('0x6e')]();return db[_0x0854('0x1e')]['find']({'where':{'id':_0x2976d0[_0x0854('0x25')]['id']}})[_0x0854('0x15')](function(_0x56736f){return db[_0x0854('0x66')][_0x0854('0x58')](function(_0x4e091d){return _0x56736f[_0x0854('0x5d')](_0x2976d0[_0x0854('0x23')][_0x0854('0x52')],{'transaction':_0x4e091d})['then'](function(){if(!_['isEmpty'](_0x305cb1)){return _0x56736f['removeAgents'](_0x305cb1,{'transaction':_0x4e091d});}})[_0x0854('0x15')](function(){_0x305cb1['forEach'](function(_0x164e77){socket[_0x0854('0x5b')](_0x0854('0x6f'),{'UserId':_0x164e77,'OpenchannelQueueId':_0x56736f['id']});});});});});});})[_0x0854('0x15')](respondWithStatusCode(_0x2963a3,null))[_0x0854('0x2f')](handleError(_0x2963a3,null));};exports[_0x0854('0x70')]=function(_0x35a74f,_0x3bbaff){return db[_0x0854('0x1e')]['find']({'where':{'id':_0x35a74f[_0x0854('0x25')]['id']}})['then'](handleEntityNotFound(_0x3bbaff,null))['then'](function(_0x3d4c24){if(_0x3d4c24){return _0x3d4c24['addAgents'](_0x35a74f['body'][_0x0854('0x52')],_['omit'](_0x35a74f[_0x0854('0x38')],[_0x0854('0x52'),'id'])||{})[_0x0854('0x71')](function(_0x277310){for(var _0x49e38b=0x0;_0x49e38b<_0x35a74f[_0x0854('0x38')]['ids'][_0x0854('0x2a')];_0x49e38b+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x35a74f[_0x0854('0x38')][_0x0854('0x52')][_0x49e38b]),'OpenchannelQueueId':Number(_0x35a74f[_0x0854('0x25')]['id'])});}return _0x277310;});}})[_0x0854('0x15')](respondWithResult(_0x3bbaff,null))[_0x0854('0x2f')](handleError(_0x3bbaff,null));};exports['removeAgents']=function(_0x1c2c3e,_0x264ec2){return db[_0x0854('0x1e')][_0x0854('0x2e')]({'where':{'id':_0x1c2c3e[_0x0854('0x25')]['id']}})[_0x0854('0x15')](handleEntityNotFound(_0x264ec2,null))[_0x0854('0x15')](function(_0x3c846e){if(_0x3c846e){return _0x3c846e[_0x0854('0x72')](_0x1c2c3e['query']['ids'])[_0x0854('0x15')](function(){if(_[_0x0854('0x73')](_0x1c2c3e['query'][_0x0854('0x52')])){for(var _0x2f70ed=0x0;_0x2f70ed<_0x1c2c3e['query'][_0x0854('0x52')][_0x0854('0x2a')];_0x2f70ed+=0x1){socket[_0x0854('0x5b')](_0x0854('0x6f'),{'UserId':Number(_0x1c2c3e[_0x0854('0x23')]['ids'][_0x2f70ed]),'OpenchannelQueueId':Number(_0x1c2c3e['params']['id'])});}}else{socket[_0x0854('0x5b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1c2c3e[_0x0854('0x23')]['ids']),'OpenchannelQueueId':Number(_0x1c2c3e[_0x0854('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x264ec2,null))[_0x0854('0x2f')](handleError(_0x264ec2,null));};exports[_0x0854('0x74')]=function(_0x5bf1d4,_0x32e088){var _0x4bec67={};var _0x7eb271={};var _0x1d545f;var _0x1444d5;return db[_0x0854('0x1e')]['findOne']({'where':{'id':_0x5bf1d4[_0x0854('0x25')]['id']}})['then'](handleEntityNotFound(_0x32e088,null))[_0x0854('0x15')](function(_0x5801bc){if(_0x5801bc){_0x1d545f=_0x5801bc;_0x7eb271[_0x0854('0x26')]=_['keys'](db[_0x0854('0x53')][_0x0854('0x1f')]);_0x7eb271['query']=_[_0x0854('0x3d')](_0x5bf1d4[_0x0854('0x23')]);_0x7eb271[_0x0854('0x3e')]=_[_0x0854('0x27')](_0x7eb271[_0x0854('0x26')],_0x7eb271[_0x0854('0x23')]);_0x4bec67[_0x0854('0x28')]=_[_0x0854('0x27')](_0x7eb271[_0x0854('0x26')],qs['fields'](_0x5bf1d4[_0x0854('0x23')][_0x0854('0x29')]));_0x4bec67[_0x0854('0x28')]=_0x4bec67[_0x0854('0x28')][_0x0854('0x2a')]?_0x4bec67[_0x0854('0x28')]:_0x7eb271[_0x0854('0x26')];_0x4bec67[_0x0854('0x42')]=qs['sort'](_0x5bf1d4[_0x0854('0x23')][_0x0854('0x43')]);_0x4bec67[_0x0854('0x47')]=qs['filters'](_['pick'](_0x5bf1d4[_0x0854('0x23')],_0x7eb271['filters']));if(_0x5bf1d4[_0x0854('0x23')][_0x0854('0x46')]){_0x4bec67[_0x0854('0x47')]=_['merge'](_0x4bec67[_0x0854('0x47')],{'$or':_[_0x0854('0x1d')](_0x4bec67[_0x0854('0x28')],function(_0x1f2cd7){var _0x4a2af={};_0x4a2af[_0x1f2cd7]={'$like':'%'+_0x5bf1d4[_0x0854('0x23')][_0x0854('0x46')]+'%'};return _0x4a2af;})});}_0x4bec67=_[_0x0854('0x2c')]({},_0x4bec67,_0x5bf1d4[_0x0854('0x2d')]);return _0x1d545f['getAgents'](_0x4bec67);}})[_0x0854('0x15')](function(_0x311b3a){if(_0x311b3a){_0x1444d5=_0x311b3a[_0x0854('0x2a')];if(!_0x5bf1d4[_0x0854('0x23')][_0x0854('0x3f')](_0x0854('0x40'))){_0x4bec67[_0x0854('0x41')]=qs[_0x0854('0x41')](_0x5bf1d4[_0x0854('0x23')][_0x0854('0x41')]);_0x4bec67['offset']=qs[_0x0854('0x11')](_0x5bf1d4[_0x0854('0x23')][_0x0854('0x11')]);}return _0x1d545f[_0x0854('0x74')](_0x4bec67);}})[_0x0854('0x15')](function(_0x9ea183){if(_0x9ea183){return _0x9ea183?{'count':_0x1444d5,'rows':_0x9ea183}:null;}})[_0x0854('0x15')](respondWithResult(_0x32e088,null))[_0x0854('0x2f')](handleError(_0x32e088,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1c3aebb..02abce8 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 _0x6785=['exports','events','../../mysqldb','OpenchannelQueue','remove','emit','hasOwnProperty'];(function(_0xcf97f3,_0x50c3e8){var _0x176ae2=function(_0x1ed524){while(--_0x1ed524){_0xcf97f3['push'](_0xcf97f3['shift']());}};_0x176ae2(++_0x50c3e8);}(_0x6785,0x1c8));var _0x5678=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6785[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require(_0x5678('0x0'));var OpenchannelQueue=require(_0x5678('0x1'))['db'][_0x5678('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5678('0x3')};function emitEvent(_0x2e4a04){return function(_0xd61888,_0x1e220d,_0x1edba4){OpenchannelQueueEvents[_0x5678('0x4')](_0x2e4a04+':'+_0xd61888['id'],_0xd61888);OpenchannelQueueEvents[_0x5678('0x4')](_0x2e4a04,_0xd61888);_0x1edba4(null);};}for(var e in events){if(events[_0x5678('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5678('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6b6e=['emit','hasOwnProperty','hook','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x4f3b26,_0x1de290){var _0x79d0e1=function(_0x47f35c){while(--_0x47f35c){_0x4f3b26['push'](_0x4f3b26['shift']());}};_0x79d0e1(++_0x1de290);}(_0x6b6e,0x143));var _0xe6b6=function(_0x490ae3,_0x34200f){_0x490ae3=_0x490ae3-0x0;var _0xbe9824=_0x6b6e[_0x490ae3];return _0xbe9824;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xe6b6('0x0'))['db'][_0xe6b6('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe6b6('0x2')](0x0);var events={'afterCreate':_0xe6b6('0x3'),'afterUpdate':_0xe6b6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x475f5a){return function(_0x283302,_0x814639,_0x42d5d6){OpenchannelQueueEvents[_0xe6b6('0x5')](_0x475f5a+':'+_0x283302['id'],_0x283302);OpenchannelQueueEvents[_0xe6b6('0x5')](_0x475f5a,_0x283302);_0x42d5d6(null);};}for(var e in events){if(events[_0xe6b6('0x6')](e)){var event=events[e];OpenchannelQueue[_0xe6b6('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 027210e..bfaf590 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 _0x9edc=['OpenchannelQueue','lodash','util','api','moment','bluebird','path','../../config/environment','./openchannelQueue.attributes','define'];(function(_0x1d5450,_0x57ed0b){var _0x216cc7=function(_0x5be307){while(--_0x5be307){_0x1d5450['push'](_0x1d5450['shift']());}};_0x216cc7(++_0x57ed0b);}(_0x9edc,0x79));var _0xc9ed=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x9edc[_0x2aa48b];return _0x48caf8;};'use strict';var _=require(_0xc9ed('0x0'));var util=require(_0xc9ed('0x1'));var logger=require('../../config/logger')(_0xc9ed('0x2'));var moment=require(_0xc9ed('0x3'));var BPromise=require(_0xc9ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9ed('0x5'));var rimraf=require('rimraf');var config=require(_0xc9ed('0x6'));var attributes=require(_0xc9ed('0x7'));module['exports']=function(_0x4ebf30,_0x13375b){return _0x4ebf30[_0xc9ed('0x8')](_0xc9ed('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61d1=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x24a42a,_0x47afa8){var _0xd93521=function(_0xbbbfa){while(--_0xbbbfa){_0x24a42a['push'](_0x24a42a['shift']());}};_0xd93521(++_0x47afa8);}(_0x61d1,0x1da));var _0x161d=function(_0x190145,_0x434ef1){_0x190145=_0x190145-0x0;var _0x540a75=_0x61d1[_0x190145];return _0x540a75;};'use strict';var _=require('lodash');var util=require(_0x161d('0x0'));var logger=require(_0x161d('0x1'))(_0x161d('0x2'));var moment=require(_0x161d('0x3'));var BPromise=require(_0x161d('0x4'));var rp=require(_0x161d('0x5'));var fs=require('fs');var path=require(_0x161d('0x6'));var rimraf=require(_0x161d('0x7'));var config=require(_0x161d('0x8'));var attributes=require(_0x161d('0x9'));module[_0x161d('0xa')]=function(_0x4de47f,_0x2763c2){return _0x4de47f['define'](_0x161d('0xb'),attributes,{'tableName':_0x161d('0xc'),'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 7fffa04..5ed0a36 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 _0x43e4=['client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','OpenchannelQueue','find','ShowOpenchannelQueue','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ac722,_0x144fd5){var _0x4d7380=function(_0x5a6781){while(--_0x5a6781){_0x4ac722['push'](_0x4ac722['shift']());}};_0x4d7380(++_0x144fd5);}(_0x43e4,0xe7));var _0x443e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x43e4[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x443e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x443e('0x1'));var rs=require(_0x443e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x443e('0x3'))['db'];var utils=require(_0x443e('0x4'));var logger=require(_0x443e('0x5'))(_0x443e('0x6'));var config=require(_0x443e('0x7'));var jayson=require(_0x443e('0x8'));var client=jayson[_0x443e('0x9')][_0x443e('0xa')]({'port':0x232a});config[_0x443e('0xb')]=_['defaults'](config['redis'],{'host':_0x443e('0xc'),'port':0x18eb});var socket=require(_0x443e('0xd'))(new Redis(config['redis']));require(_0x443e('0xe'))[_0x443e('0xf')](socket);function respondWithRpcPromise(_0x590296,_0x109f9c,_0x1c8c51){return new BPromise(function(_0x230c56,_0x304e39){return client[_0x443e('0x10')](_0x590296,_0x1c8c51)[_0x443e('0x11')](function(_0x16ecf9){logger[_0x443e('0x12')](_0x443e('0x13'),_0x109f9c,_0x443e('0x14'));logger[_0x443e('0x15')](_0x443e('0x16'),_0x109f9c,_0x443e('0x14'),JSON[_0x443e('0x17')](_0x16ecf9));if(_0x16ecf9[_0x443e('0x18')]){if(_0x16ecf9['error']['code']===0x1f4){logger[_0x443e('0x18')](_0x443e('0x13'),_0x109f9c,_0x16ecf9[_0x443e('0x18')][_0x443e('0x19')]);return _0x304e39(_0x16ecf9[_0x443e('0x18')]['message']);}logger[_0x443e('0x18')](_0x443e('0x13'),_0x109f9c,_0x16ecf9['error'][_0x443e('0x19')]);return _0x230c56(_0x16ecf9[_0x443e('0x18')][_0x443e('0x19')]);}else{logger[_0x443e('0x12')](_0x443e('0x13'),_0x109f9c,_0x443e('0x14'));_0x230c56(_0x16ecf9['result']['message']);}})[_0x443e('0x1a')](function(_0x4617c5){logger[_0x443e('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x109f9c,_0x4617c5);_0x304e39(_0x4617c5);});});}exports[_0x443e('0x1b')]=function(_0x3a20db){var _0x3a8f60=this;return new Promise(function(_0x1efedf,_0x800fdf){return db['OpenchannelQueue'][_0x443e('0x1c')]({'raw':_0x3a20db[_0x443e('0x1d')]?_0x3a20db[_0x443e('0x1d')][_0x443e('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a20db['options']?_0x3a20db[_0x443e('0x1d')][_0x443e('0x1f')]||null:null,'attributes':_0x3a20db[_0x443e('0x1d')]?_0x3a20db[_0x443e('0x1d')][_0x443e('0x20')]||null:null,'limit':_0x3a20db['options']?_0x3a20db[_0x443e('0x1d')][_0x443e('0x21')]||null:null,'include':_0x3a20db[_0x443e('0x1d')]?_0x3a20db[_0x443e('0x1d')][_0x443e('0x22')]?_[_0x443e('0x23')](_0x3a20db[_0x443e('0x1d')][_0x443e('0x22')],function(_0x49dd53){return{'model':db[_0x49dd53[_0x443e('0x24')]],'as':_0x49dd53['as'],'attributes':_0x49dd53[_0x443e('0x20')],'include':_0x49dd53[_0x443e('0x22')]?_['map'](_0x49dd53[_0x443e('0x22')],function(_0x533363){return{'model':db[_0x533363[_0x443e('0x24')]],'as':_0x533363['as'],'attributes':_0x533363[_0x443e('0x20')],'include':_0x533363[_0x443e('0x22')]?_[_0x443e('0x23')](_0x533363['include'],function(_0xbc9dcc){return{'model':db[_0xbc9dcc[_0x443e('0x24')]],'as':_0xbc9dcc['as'],'attributes':_0xbc9dcc['attributes']};}):[]};}):[]};}):[]:[]})[_0x443e('0x11')](function(_0x465ae7){logger['info']('GetOpenchannelQueue',_0x3a20db);logger[_0x443e('0x15')](_0x443e('0x1b'),_0x3a20db,JSON[_0x443e('0x17')](_0x465ae7));_0x1efedf(_0x465ae7);})[_0x443e('0x1a')](function(_0xed347b){logger[_0x443e('0x18')](_0x443e('0x1b'),_0xed347b[_0x443e('0x19')],_0x3a20db);_0x800fdf(_0x3a8f60[_0x443e('0x18')](0x1f4,_0xed347b[_0x443e('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x14fe84){var _0x2dd167=this;return new Promise(function(_0x3ab0e5,_0x5c959d){return db[_0x443e('0x25')][_0x443e('0x26')]({'raw':_0x14fe84['options']?_0x14fe84['options'][_0x443e('0x1e')]===undefined?!![]:![]:!![],'where':_0x14fe84[_0x443e('0x1d')]?_0x14fe84[_0x443e('0x1d')][_0x443e('0x1f')]||null:null,'attributes':_0x14fe84[_0x443e('0x1d')]?_0x14fe84[_0x443e('0x1d')][_0x443e('0x20')]||null:null,'include':_0x14fe84['options']?_0x14fe84[_0x443e('0x1d')][_0x443e('0x22')]?_[_0x443e('0x23')](_0x14fe84['options'][_0x443e('0x22')],function(_0x1b38d){return{'model':db[_0x1b38d['model']],'as':_0x1b38d['as'],'attributes':_0x1b38d[_0x443e('0x20')],'include':_0x1b38d[_0x443e('0x22')]?_['map'](_0x1b38d[_0x443e('0x22')],function(_0x1fc9ed){return{'model':db[_0x1fc9ed[_0x443e('0x24')]],'as':_0x1fc9ed['as'],'attributes':_0x1fc9ed['attributes'],'include':_0x1fc9ed[_0x443e('0x22')]?_[_0x443e('0x23')](_0x1fc9ed['include'],function(_0x269854){return{'model':db[_0x269854[_0x443e('0x24')]],'as':_0x269854['as'],'attributes':_0x269854['attributes']};}):[]};}):[]};}):[]:[]})[_0x443e('0x11')](function(_0x112db5){logger['info'](_0x443e('0x27'),_0x14fe84);logger['debug']('ShowOpenchannelQueue',_0x14fe84,JSON[_0x443e('0x17')](_0x112db5));_0x3ab0e5(_0x112db5);})['catch'](function(_0x4e2746){logger[_0x443e('0x18')]('ShowOpenchannelQueue',_0x4e2746[_0x443e('0x19')],_0x14fe84);_0x5c959d(_0x2dd167['error'](0x1f4,_0x4e2746[_0x443e('0x19')]));});});}; \ No newline at end of file +var _0x1fda=['debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','model','map','attributes','stringify','ShowOpenchannelQueue','find','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x443b90,_0x31d827){var _0x4ff4c5=function(_0x36de5b){while(--_0x36de5b){_0x443b90['push'](_0x443b90['shift']());}};_0x4ff4c5(++_0x31d827);}(_0x1fda,0xbd));var _0xa1fd=function(_0x31db21,_0x78c1d7){_0x31db21=_0x31db21-0x0;var _0x3360c4=_0x1fda[_0x31db21];return _0x3360c4;};'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(_0xa1fd('0x0'));var db=require(_0xa1fd('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1fd('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa1fd('0x3'));var client=jayson[_0xa1fd('0x4')][_0xa1fd('0x5')]({'port':0x232a});config[_0xa1fd('0x6')]=_[_0xa1fd('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa1fd('0x8'))(new Redis(config[_0xa1fd('0x6')]));require('./openchannelQueue.socket')[_0xa1fd('0x9')](socket);function respondWithRpcPromise(_0x29fc9d,_0x12f724,_0x3849d1){return new BPromise(function(_0x17bf04,_0x1b886e){return client[_0xa1fd('0xa')](_0x29fc9d,_0x3849d1)[_0xa1fd('0xb')](function(_0x5025fd){logger[_0xa1fd('0xc')](_0xa1fd('0xd'),_0x12f724,_0xa1fd('0xe'));logger[_0xa1fd('0xf')](_0xa1fd('0x10'),_0x12f724,_0xa1fd('0xe'),JSON['stringify'](_0x5025fd));if(_0x5025fd[_0xa1fd('0x11')]){if(_0x5025fd[_0xa1fd('0x11')]['code']===0x1f4){logger[_0xa1fd('0x11')](_0xa1fd('0xd'),_0x12f724,_0x5025fd[_0xa1fd('0x11')][_0xa1fd('0x12')]);return _0x1b886e(_0x5025fd[_0xa1fd('0x11')][_0xa1fd('0x12')]);}logger[_0xa1fd('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x12f724,_0x5025fd[_0xa1fd('0x11')][_0xa1fd('0x12')]);return _0x17bf04(_0x5025fd[_0xa1fd('0x11')][_0xa1fd('0x12')]);}else{logger[_0xa1fd('0xc')](_0xa1fd('0xd'),_0x12f724,'request\x20sent');_0x17bf04(_0x5025fd['result'][_0xa1fd('0x12')]);}})[_0xa1fd('0x13')](function(_0x4199f9){logger[_0xa1fd('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x12f724,_0x4199f9);_0x1b886e(_0x4199f9);});});}exports[_0xa1fd('0x14')]=function(_0x11eb2c){var _0x55df02=this;return new Promise(function(_0x8aae63,_0x5a8e40){return db[_0xa1fd('0x15')][_0xa1fd('0x16')]({'raw':_0x11eb2c[_0xa1fd('0x17')]?_0x11eb2c[_0xa1fd('0x17')][_0xa1fd('0x18')]===undefined?!![]:![]:!![],'where':_0x11eb2c[_0xa1fd('0x17')]?_0x11eb2c[_0xa1fd('0x17')][_0xa1fd('0x19')]||null:null,'attributes':_0x11eb2c['options']?_0x11eb2c[_0xa1fd('0x17')]['attributes']||null:null,'limit':_0x11eb2c[_0xa1fd('0x17')]?_0x11eb2c[_0xa1fd('0x17')][_0xa1fd('0x1a')]||null:null,'include':_0x11eb2c[_0xa1fd('0x17')]?_0x11eb2c['options']['include']?_['map'](_0x11eb2c[_0xa1fd('0x17')][_0xa1fd('0x1b')],function(_0x113e16){return{'model':db[_0x113e16[_0xa1fd('0x1c')]],'as':_0x113e16['as'],'attributes':_0x113e16['attributes'],'include':_0x113e16[_0xa1fd('0x1b')]?_[_0xa1fd('0x1d')](_0x113e16[_0xa1fd('0x1b')],function(_0x34d42a){return{'model':db[_0x34d42a[_0xa1fd('0x1c')]],'as':_0x34d42a['as'],'attributes':_0x34d42a[_0xa1fd('0x1e')],'include':_0x34d42a[_0xa1fd('0x1b')]?_[_0xa1fd('0x1d')](_0x34d42a[_0xa1fd('0x1b')],function(_0x4950d9){return{'model':db[_0x4950d9[_0xa1fd('0x1c')]],'as':_0x4950d9['as'],'attributes':_0x4950d9['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1fd('0xb')](function(_0x175979){logger[_0xa1fd('0xc')](_0xa1fd('0x14'),_0x11eb2c);logger[_0xa1fd('0xf')]('GetOpenchannelQueue',_0x11eb2c,JSON[_0xa1fd('0x1f')](_0x175979));_0x8aae63(_0x175979);})[_0xa1fd('0x13')](function(_0x18eba9){logger[_0xa1fd('0x11')]('GetOpenchannelQueue',_0x18eba9[_0xa1fd('0x12')],_0x11eb2c);_0x5a8e40(_0x55df02['error'](0x1f4,_0x18eba9['message']));});});};exports[_0xa1fd('0x20')]=function(_0x454df5){var _0x33d928=this;return new Promise(function(_0x44c101,_0x42546c){return db[_0xa1fd('0x15')][_0xa1fd('0x21')]({'raw':_0x454df5['options']?_0x454df5[_0xa1fd('0x17')][_0xa1fd('0x18')]===undefined?!![]:![]:!![],'where':_0x454df5[_0xa1fd('0x17')]?_0x454df5[_0xa1fd('0x17')][_0xa1fd('0x19')]||null:null,'attributes':_0x454df5['options']?_0x454df5[_0xa1fd('0x17')][_0xa1fd('0x1e')]||null:null,'include':_0x454df5[_0xa1fd('0x17')]?_0x454df5[_0xa1fd('0x17')][_0xa1fd('0x1b')]?_['map'](_0x454df5[_0xa1fd('0x17')][_0xa1fd('0x1b')],function(_0x320c87){return{'model':db[_0x320c87[_0xa1fd('0x1c')]],'as':_0x320c87['as'],'attributes':_0x320c87[_0xa1fd('0x1e')],'include':_0x320c87[_0xa1fd('0x1b')]?_[_0xa1fd('0x1d')](_0x320c87['include'],function(_0x4b1cc5){return{'model':db[_0x4b1cc5[_0xa1fd('0x1c')]],'as':_0x4b1cc5['as'],'attributes':_0x4b1cc5[_0xa1fd('0x1e')],'include':_0x4b1cc5[_0xa1fd('0x1b')]?_[_0xa1fd('0x1d')](_0x4b1cc5[_0xa1fd('0x1b')],function(_0x185efc){return{'model':db[_0x185efc['model']],'as':_0x185efc['as'],'attributes':_0x185efc[_0xa1fd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41ac4a){logger[_0xa1fd('0xc')](_0xa1fd('0x20'),_0x454df5);logger[_0xa1fd('0xf')](_0xa1fd('0x20'),_0x454df5,JSON[_0xa1fd('0x1f')](_0x41ac4a));_0x44c101(_0x41ac4a);})[_0xa1fd('0x13')](function(_0x331b22){logger[_0xa1fd('0x11')](_0xa1fd('0x20'),_0x331b22['message'],_0x454df5);_0x42546c(_0x33d928[_0xa1fd('0x11')](0x1f4,_0x331b22[_0xa1fd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 1a9d185..0165f4b 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 _0x6ccf=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','emit'];(function(_0x210be7,_0x7872f6){var _0x1566ba=function(_0xca934f){while(--_0xca934f){_0x210be7['push'](_0x210be7['shift']());}};_0x1566ba(++_0x7872f6);}(_0x6ccf,0x1d8));var _0xf6cc=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x6ccf[_0x5cc8];return _0x450661;};'use strict';var OpenchannelQueueEvents=require(_0xf6cc('0x0'));var events=['save','remove','update'];function createListener(_0x11a59a,_0xe81b0d){return function(_0x463ff){_0xe81b0d[_0xf6cc('0x1')](_0x11a59a,_0x463ff);};}function removeListener(_0x27f842,_0x1f9acc){return function(){OpenchannelQueueEvents[_0xf6cc('0x2')](_0x27f842,_0x1f9acc);};}exports[_0xf6cc('0x3')]=function(_0x2f8d2c){for(var _0x315155=0x0,_0x196e52=events[_0xf6cc('0x4')];_0x315155<_0x196e52;_0x315155++){var _0x29f251=events[_0x315155];var _0x20bdd6=createListener(_0xf6cc('0x5')+_0x29f251,_0x2f8d2c);OpenchannelQueueEvents['on'](_0x29f251,_0x20bdd6);}}; \ No newline at end of file +var _0xc820=['openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','register','length'];(function(_0x3a3988,_0xa593be){var _0x5b8178=function(_0x43bd53){while(--_0x43bd53){_0x3a3988['push'](_0x3a3988['shift']());}};_0x5b8178(++_0xa593be);}(_0xc820,0x1d9));var _0x0c82=function(_0x5740d5,_0x3a335c){_0x5740d5=_0x5740d5-0x0;var _0xfb34fe=_0xc820[_0x5740d5];return _0xfb34fe;};'use strict';var OpenchannelQueueEvents=require(_0x0c82('0x0'));var events=[_0x0c82('0x1'),_0x0c82('0x2'),_0x0c82('0x3')];function createListener(_0x4e0582,_0x4fca04){return function(_0x29440c){_0x4fca04[_0x0c82('0x4')](_0x4e0582,_0x29440c);};}function removeListener(_0x8b0ee0,_0x507d86){return function(){OpenchannelQueueEvents['removeListener'](_0x8b0ee0,_0x507d86);};}exports[_0x0c82('0x5')]=function(_0x4237c4){for(var _0x26ceab=0x0,_0x178bab=events[_0x0c82('0x6')];_0x26ceab<_0x178bab;_0x26ceab++){var _0x389abf=events[_0x26ceab];var _0x1b0435=createListener(_0x0c82('0x7')+_0x389abf,_0x4237c4);OpenchannelQueueEvents['on'](_0x389abf,_0x1b0435);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 351f112..10addf7 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 _0x8ac4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5ef1d3,_0x1feca1){var _0x3c990e=function(_0x589ba6){while(--_0x589ba6){_0x5ef1d3['push'](_0x5ef1d3['shift']());}};_0x3c990e(++_0x1feca1);}(_0x8ac4,0x19b));var _0x48ac=function(_0x26a93a,_0x56509f){_0x26a93a=_0x26a93a-0x0;var _0x38b4b3=_0x8ac4[_0x26a93a];return _0x38b4b3;};'use strict';var multer=require(_0x48ac('0x0'));var util=require(_0x48ac('0x1'));var path=require(_0x48ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x48ac('0x3'));var router=express[_0x48ac('0x4')]();var fs_extra=require(_0x48ac('0x5'));var auth=require(_0x48ac('0x6'));var interaction=require(_0x48ac('0x7'));var config=require(_0x48ac('0x8'));var controller=require(_0x48ac('0x9'));router[_0x48ac('0xa')]('/',auth[_0x48ac('0xb')](),controller[_0x48ac('0xc')]);router[_0x48ac('0xa')](_0x48ac('0xd'),auth[_0x48ac('0xb')](),controller['describe']);router[_0x48ac('0xa')](_0x48ac('0xe'),auth[_0x48ac('0xb')](),controller[_0x48ac('0xf')]);router[_0x48ac('0x10')]('/',auth[_0x48ac('0xb')](),controller[_0x48ac('0x11')]);router[_0x48ac('0x12')](_0x48ac('0xe'),auth['isAuthenticated'](),controller[_0x48ac('0x13')]);router[_0x48ac('0x14')](_0x48ac('0xe'),auth[_0x48ac('0xb')](),controller[_0x48ac('0x15')]);module[_0x48ac('0x16')]=router; \ No newline at end of file +var _0x1326=['index','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x1326,0x140));var _0x6132=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0x1326[_0x455893];return _0x3851e8;};'use strict';var multer=require(_0x6132('0x0'));var util=require(_0x6132('0x1'));var path=require('path');var timeout=require(_0x6132('0x2'));var express=require(_0x6132('0x3'));var router=express[_0x6132('0x4')]();var fs_extra=require(_0x6132('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6132('0x6'));var config=require(_0x6132('0x7'));var controller=require(_0x6132('0x8'));router['get']('/',auth[_0x6132('0x9')](),controller[_0x6132('0xa')]);router[_0x6132('0xb')](_0x6132('0xc'),auth[_0x6132('0x9')](),controller['describe']);router[_0x6132('0xb')](_0x6132('0xd'),auth['isAuthenticated'](),controller[_0x6132('0xe')]);router[_0x6132('0xf')]('/',auth[_0x6132('0x9')](),controller[_0x6132('0x10')]);router[_0x6132('0x11')](_0x6132('0xd'),auth[_0x6132('0x9')](),controller[_0x6132('0x12')]);router[_0x6132('0x13')](_0x6132('0xd'),auth[_0x6132('0x9')](),controller[_0x6132('0x14')]);module[_0x6132('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 34c7752..b45dadb 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 _0x2598=['DATE','moment','sequelize','exports','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2598,0xba));var _0x8259=function(_0x3a51f0,_0x84e1c7){_0x3a51f0=_0x3a51f0-0x0;var _0x11c7c8=_0x2598[_0x3a51f0];return _0x11c7c8;};'use strict';var moment=require(_0x8259('0x0'));var Sequelize=require(_0x8259('0x1'));module[_0x8259('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8259('0x3')]},'joinAt':{'type':Sequelize[_0x8259('0x4')]},'leaveAt':{'type':Sequelize[_0x8259('0x4')]},'acceptAt':{'type':Sequelize[_0x8259('0x4')]},'exitAt':{'type':Sequelize[_0x8259('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd1d=['moment','sequelize','STRING','DATE'];(function(_0x3459d9,_0x3af486){var _0x5f533a=function(_0x43a284){while(--_0x43a284){_0x3459d9['push'](_0x3459d9['shift']());}};_0x5f533a(++_0x3af486);}(_0xbd1d,0x1d8));var _0xdbd1=function(_0x1befb6,_0x20110a){_0x1befb6=_0x1befb6-0x0;var _0x3efa4c=_0xbd1d[_0x1befb6];return _0x3efa4c;};'use strict';var moment=require(_0xdbd1('0x0'));var Sequelize=require(_0xdbd1('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdbd1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdbd1('0x2')]},'joinAt':{'type':Sequelize[_0xdbd1('0x3')]},'leaveAt':{'type':Sequelize[_0xdbd1('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdbd1('0x3')]},'reason':{'type':Sequelize[_0xdbd1('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 42d3f3c..915a1c9 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 _0x0a87=['apply','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','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','undefined','limit','offset','set'];(function(_0xaa9204,_0x163a47){var _0x1e39f8=function(_0x4737eb){while(--_0x4737eb){_0xaa9204['push'](_0xaa9204['shift']());}};_0x1e39f8(++_0x163a47);}(_0x0a87,0x196));var _0x70a8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a87[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x70a8('0x0'));var rimraf=require(_0x70a8('0x1'));var zipdir=require(_0x70a8('0x2'));var jsonpatch=require(_0x70a8('0x3'));var rp=require(_0x70a8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x70a8('0x5'));var util=require(_0x70a8('0x6'));var path=require('path');var sox=require(_0x70a8('0x7'));var csv=require(_0x70a8('0x8'));var ejs=require(_0x70a8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70a8('0xa'));var squel=require(_0x70a8('0xb'));var crypto=require(_0x70a8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x70a8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70a8('0xe'));var Papa=require(_0x70a8('0xf'));var Redis=require('ioredis');var authService=require(_0x70a8('0x10'));var qs=require(_0x70a8('0x11'));var as=require(_0x70a8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70a8('0x13'))(_0x70a8('0x14'));var utils=require(_0x70a8('0x15'));var config=require(_0x70a8('0x16'));var licenseUtil=require(_0x70a8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x87f966,_0x177888){_0x177888=_0x177888||0xcc;return function(_0x2f4ec5){if(_0x2f4ec5){return _0x87f966[_0x70a8('0x18')](_0x177888);}return _0x87f966[_0x70a8('0x19')](_0x177888)[_0x70a8('0x1a')]();};}function respondWithResult(_0x49db46,_0x209603){_0x209603=_0x209603||0xc8;return function(_0x3d5db9){if(_0x3d5db9){return _0x49db46[_0x70a8('0x19')](_0x209603)[_0x70a8('0x1b')](_0x3d5db9);}};}function respondWithFilteredResult(_0xd74bfe,_0x3ff44e){return function(_0xa00aca){if(_0xa00aca){var _0x5e3579=typeof _0x3ff44e['offset']===_0x70a8('0x1c')&&typeof _0x3ff44e[_0x70a8('0x1d')]===_0x70a8('0x1c');var _0x25ad56=_0xa00aca['count'];var _0x1d7287=_0x5e3579?0x0:_0x3ff44e[_0x70a8('0x1e')];var _0x450192=_0x5e3579?_0xa00aca['count']:_0x3ff44e[_0x70a8('0x1e')]+_0x3ff44e['limit'];var _0x482660;if(_0x450192>=_0x25ad56){_0x450192=_0x25ad56;_0x482660=0xc8;}else{_0x482660=0xce;}_0xd74bfe[_0x70a8('0x19')](_0x482660);return _0xd74bfe[_0x70a8('0x1f')]('Content-Range',_0x1d7287+'-'+_0x450192+'/'+_0x25ad56)[_0x70a8('0x1b')](_0xa00aca);}return null;};}function patchUpdates(_0x3c31a4){return function(_0x396620){try{jsonpatch[_0x70a8('0x20')](_0x396620,_0x3c31a4,!![]);}catch(_0x47bcc1){return BPromise['reject'](_0x47bcc1);}return _0x396620[_0x70a8('0x21')]();};}function saveUpdates(_0x368610,_0x2bf622){return function(_0x46de2d){if(_0x46de2d){return _0x46de2d[_0x70a8('0x22')](_0x368610)[_0x70a8('0x23')](function(_0x1883f4){return _0x1883f4;});}return null;};}function removeEntity(_0x5ee6bc,_0x210e85){return function(_0x58ade3){if(_0x58ade3){return _0x58ade3[_0x70a8('0x24')]()[_0x70a8('0x23')](function(){_0x5ee6bc[_0x70a8('0x19')](0xcc)[_0x70a8('0x1a')]();});}};}function handleEntityNotFound(_0x26fe9f,_0x23455a){return function(_0x1d0af0){if(!_0x1d0af0){_0x26fe9f[_0x70a8('0x18')](0x194);}return _0x1d0af0;};}function handleError(_0x195b73,_0xed06b0){_0xed06b0=_0xed06b0||0x1f4;return function(_0x4969c8){logger[_0x70a8('0x25')](_0x4969c8[_0x70a8('0x26')]);if(_0x4969c8[_0x70a8('0x27')]){delete _0x4969c8['name'];}_0x195b73[_0x70a8('0x19')](_0xed06b0)[_0x70a8('0x28')](_0x4969c8);};}exports['index']=function(_0x2f1ca4,_0x17d320){var _0x3102c5={},_0x1e9174={},_0x2fdacf={'count':0x0,'rows':[]};var _0x541edc=_[_0x70a8('0x29')](db[_0x70a8('0x2a')][_0x70a8('0x2b')],function(_0x5a630c){return{'name':_0x5a630c[_0x70a8('0x2c')],'type':_0x5a630c[_0x70a8('0x2d')]['key']};});_0x1e9174[_0x70a8('0x2e')]=_[_0x70a8('0x29')](_0x541edc,_0x70a8('0x27'));_0x1e9174[_0x70a8('0x2f')]=_['keys'](_0x2f1ca4[_0x70a8('0x2f')]);_0x1e9174['filters']=_['intersection'](_0x1e9174['model'],_0x1e9174[_0x70a8('0x2f')]);_0x3102c5[_0x70a8('0x30')]=_[_0x70a8('0x31')](_0x1e9174[_0x70a8('0x2e')],qs[_0x70a8('0x32')](_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x32')]));_0x3102c5[_0x70a8('0x30')]=_0x3102c5[_0x70a8('0x30')][_0x70a8('0x33')]?_0x3102c5[_0x70a8('0x30')]:_0x1e9174['model'];if(!_0x2f1ca4[_0x70a8('0x2f')]['hasOwnProperty'](_0x70a8('0x34'))){_0x3102c5['limit']=qs[_0x70a8('0x1d')](_0x2f1ca4['query']['limit']);_0x3102c5[_0x70a8('0x1e')]=qs[_0x70a8('0x1e')](_0x2f1ca4['query'][_0x70a8('0x1e')]);}_0x3102c5['order']=qs[_0x70a8('0x35')](_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x35')]);_0x3102c5['where']=qs[_0x70a8('0x36')](_['pick'](_0x2f1ca4[_0x70a8('0x2f')],_0x1e9174[_0x70a8('0x36')]),_0x541edc);if(_0x2f1ca4['query'][_0x70a8('0x37')]){_0x3102c5[_0x70a8('0x38')]=_[_0x70a8('0x39')](_0x3102c5[_0x70a8('0x38')],{'$or':_[_0x70a8('0x29')](_0x541edc,function(_0x17b65c){if(_0x17b65c[_0x70a8('0x2d')]!==_0x70a8('0x3a')){var _0x5283aa={};_0x5283aa[_0x17b65c[_0x70a8('0x27')]]={'$like':'%'+_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x37')]+'%'};return _0x5283aa;}})});}_0x3102c5=_[_0x70a8('0x39')]({},_0x3102c5,_0x2f1ca4[_0x70a8('0x3b')]);var _0x280d68={'where':_0x3102c5[_0x70a8('0x38')]};return db[_0x70a8('0x2a')][_0x70a8('0x3c')](_0x280d68)[_0x70a8('0x23')](function(_0x79ca8c){_0x2fdacf['count']=_0x79ca8c;if(_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x3d')]){_0x3102c5[_0x70a8('0x3e')]=[{'all':!![]}];}return db[_0x70a8('0x2a')][_0x70a8('0x3f')](_0x3102c5);})['then'](function(_0x20c73c){_0x2fdacf[_0x70a8('0x40')]=_0x20c73c;return _0x2fdacf;})[_0x70a8('0x23')](respondWithFilteredResult(_0x17d320,_0x3102c5))[_0x70a8('0x41')](handleError(_0x17d320,null));};exports[_0x70a8('0x42')]=function(_0x2e7d66,_0x492cde){var _0x5d1d01={'raw':!![],'where':{'id':_0x2e7d66[_0x70a8('0x43')]['id']}},_0x3151b3={};_0x3151b3['model']=_[_0x70a8('0x44')](db[_0x70a8('0x2a')]['rawAttributes']);_0x3151b3[_0x70a8('0x2f')]=_[_0x70a8('0x44')](_0x2e7d66[_0x70a8('0x2f')]);_0x3151b3[_0x70a8('0x36')]=_['intersection'](_0x3151b3[_0x70a8('0x2e')],_0x3151b3[_0x70a8('0x2f')]);_0x5d1d01['attributes']=_[_0x70a8('0x31')](_0x3151b3[_0x70a8('0x2e')],qs[_0x70a8('0x32')](_0x2e7d66[_0x70a8('0x2f')][_0x70a8('0x32')]));_0x5d1d01[_0x70a8('0x30')]=_0x5d1d01[_0x70a8('0x30')][_0x70a8('0x33')]?_0x5d1d01[_0x70a8('0x30')]:_0x3151b3[_0x70a8('0x2e')];if(_0x2e7d66['query']['includeAll']){_0x5d1d01['include']=[{'all':!![]}];}_0x5d1d01=_[_0x70a8('0x39')]({},_0x5d1d01,_0x2e7d66['options']);return db[_0x70a8('0x2a')]['find'](_0x5d1d01)[_0x70a8('0x23')](handleEntityNotFound(_0x492cde,null))['then'](respondWithResult(_0x492cde,null))[_0x70a8('0x41')](handleError(_0x492cde,null));};exports[_0x70a8('0x45')]=function(_0x3fad81,_0x282775){return db[_0x70a8('0x2a')]['create'](_0x3fad81[_0x70a8('0x46')],{})[_0x70a8('0x23')](respondWithResult(_0x282775,0xc9))[_0x70a8('0x41')](handleError(_0x282775,null));};exports[_0x70a8('0x22')]=function(_0x15a954,_0x3f1fea){if(_0x15a954[_0x70a8('0x46')]['id']){delete _0x15a954[_0x70a8('0x46')]['id'];}return db[_0x70a8('0x2a')][_0x70a8('0x47')]({'where':{'id':_0x15a954[_0x70a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f1fea,null))[_0x70a8('0x23')](saveUpdates(_0x15a954[_0x70a8('0x46')],null))[_0x70a8('0x23')](respondWithResult(_0x3f1fea,null))[_0x70a8('0x41')](handleError(_0x3f1fea,null));};exports['destroy']=function(_0x4211cf,_0x575d50){return db[_0x70a8('0x2a')][_0x70a8('0x47')]({'where':{'id':_0x4211cf[_0x70a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x575d50,null))[_0x70a8('0x23')](removeEntity(_0x575d50,null))[_0x70a8('0x41')](handleError(_0x575d50,null));};exports[_0x70a8('0x48')]=function(_0x26f322,_0x2fedc5){return db[_0x70a8('0x2a')][_0x70a8('0x48')]()['then'](respondWithResult(_0x2fedc5,null))[_0x70a8('0x41')](handleError(_0x2fedc5,null));}; \ No newline at end of file +var _0xdc15=['offset','set','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','update','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','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count'];(function(_0x429bc0,_0x244ced){var _0x4be5bb=function(_0x4cfd96){while(--_0x4cfd96){_0x429bc0['push'](_0x429bc0['shift']());}};_0x4be5bb(++_0x244ced);}(_0xdc15,0x1bd));var _0x5dc1=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0xdc15[_0xea343d];return _0x2c6e9c;};'use strict';var emlformat=require(_0x5dc1('0x0'));var rimraf=require(_0x5dc1('0x1'));var zipdir=require(_0x5dc1('0x2'));var jsonpatch=require(_0x5dc1('0x3'));var rp=require(_0x5dc1('0x4'));var moment=require(_0x5dc1('0x5'));var BPromise=require(_0x5dc1('0x6'));var Mustache=require(_0x5dc1('0x7'));var util=require(_0x5dc1('0x8'));var path=require(_0x5dc1('0x9'));var sox=require(_0x5dc1('0xa'));var csv=require(_0x5dc1('0xb'));var ejs=require(_0x5dc1('0xc'));var fs=require('fs');var fs_extra=require(_0x5dc1('0xd'));var _=require(_0x5dc1('0xe'));var squel=require(_0x5dc1('0xf'));var crypto=require(_0x5dc1('0x10'));var jsforce=require(_0x5dc1('0x11'));var deskjs=require(_0x5dc1('0x12'));var toCsv=require(_0x5dc1('0xb'));var querystring=require(_0x5dc1('0x13'));var Papa=require(_0x5dc1('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5dc1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5dc1('0x16'));var logger=require(_0x5dc1('0x17'))('api');var utils=require(_0x5dc1('0x18'));var config=require(_0x5dc1('0x19'));var licenseUtil=require(_0x5dc1('0x1a'));var db=require(_0x5dc1('0x1b'))['db'];function respondWithStatusCode(_0xd442e5,_0x19bbe9){_0x19bbe9=_0x19bbe9||0xcc;return function(_0x3a6495){if(_0x3a6495){return _0xd442e5[_0x5dc1('0x1c')](_0x19bbe9);}return _0xd442e5[_0x5dc1('0x1d')](_0x19bbe9)[_0x5dc1('0x1e')]();};}function respondWithResult(_0x3aa9f8,_0x50fee4){_0x50fee4=_0x50fee4||0xc8;return function(_0x399f94){if(_0x399f94){return _0x3aa9f8[_0x5dc1('0x1d')](_0x50fee4)[_0x5dc1('0x1f')](_0x399f94);}};}function respondWithFilteredResult(_0x2a01e4,_0x1cbf4f){return function(_0x60eaf8){if(_0x60eaf8){var _0x4f2e21=typeof _0x1cbf4f['offset']==='undefined'&&typeof _0x1cbf4f[_0x5dc1('0x20')]===_0x5dc1('0x21');var _0x5eeb47=_0x60eaf8[_0x5dc1('0x22')];var _0x56167d=_0x4f2e21?0x0:_0x1cbf4f['offset'];var _0x63f4f1=_0x4f2e21?_0x60eaf8[_0x5dc1('0x22')]:_0x1cbf4f[_0x5dc1('0x23')]+_0x1cbf4f['limit'];var _0x1aa558;if(_0x63f4f1>=_0x5eeb47){_0x63f4f1=_0x5eeb47;_0x1aa558=0xc8;}else{_0x1aa558=0xce;}_0x2a01e4[_0x5dc1('0x1d')](_0x1aa558);return _0x2a01e4[_0x5dc1('0x24')]('Content-Range',_0x56167d+'-'+_0x63f4f1+'/'+_0x5eeb47)[_0x5dc1('0x1f')](_0x60eaf8);}return null;};}function patchUpdates(_0x522ca8){return function(_0x25ae13){try{jsonpatch[_0x5dc1('0x25')](_0x25ae13,_0x522ca8,!![]);}catch(_0x175c2a){return BPromise[_0x5dc1('0x26')](_0x175c2a);}return _0x25ae13[_0x5dc1('0x27')]();};}function saveUpdates(_0xc7b21e,_0x2f1d9){return function(_0x5f500b){if(_0x5f500b){return _0x5f500b['update'](_0xc7b21e)[_0x5dc1('0x28')](function(_0x42b45c){return _0x42b45c;});}return null;};}function removeEntity(_0x2143de,_0x4556fb){return function(_0x12d45c){if(_0x12d45c){return _0x12d45c[_0x5dc1('0x29')]()[_0x5dc1('0x28')](function(){_0x2143de[_0x5dc1('0x1d')](0xcc)[_0x5dc1('0x1e')]();});}};}function handleEntityNotFound(_0x2e99b4,_0x1bba46){return function(_0x18235d){if(!_0x18235d){_0x2e99b4['sendStatus'](0x194);}return _0x18235d;};}function handleError(_0x2b68f0,_0x110704){_0x110704=_0x110704||0x1f4;return function(_0x2f6f2e){logger['error'](_0x2f6f2e[_0x5dc1('0x2a')]);if(_0x2f6f2e[_0x5dc1('0x2b')]){delete _0x2f6f2e[_0x5dc1('0x2b')];}_0x2b68f0[_0x5dc1('0x1d')](_0x110704)[_0x5dc1('0x2c')](_0x2f6f2e);};}exports[_0x5dc1('0x2d')]=function(_0xfa34c1,_0x384ba5){var _0x1b51eb={},_0xdc0c44={},_0x4c21c3={'count':0x0,'rows':[]};var _0xc4d896=_[_0x5dc1('0x2e')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x25e810){return{'name':_0x25e810[_0x5dc1('0x2f')],'type':_0x25e810['type'][_0x5dc1('0x30')]};});_0xdc0c44[_0x5dc1('0x31')]=_['map'](_0xc4d896,_0x5dc1('0x2b'));_0xdc0c44[_0x5dc1('0x32')]=_['keys'](_0xfa34c1[_0x5dc1('0x32')]);_0xdc0c44[_0x5dc1('0x33')]=_[_0x5dc1('0x34')](_0xdc0c44[_0x5dc1('0x31')],_0xdc0c44[_0x5dc1('0x32')]);_0x1b51eb[_0x5dc1('0x35')]=_[_0x5dc1('0x34')](_0xdc0c44['model'],qs[_0x5dc1('0x36')](_0xfa34c1[_0x5dc1('0x32')][_0x5dc1('0x36')]));_0x1b51eb[_0x5dc1('0x35')]=_0x1b51eb[_0x5dc1('0x35')][_0x5dc1('0x37')]?_0x1b51eb['attributes']:_0xdc0c44[_0x5dc1('0x31')];if(!_0xfa34c1['query'][_0x5dc1('0x38')](_0x5dc1('0x39'))){_0x1b51eb[_0x5dc1('0x20')]=qs[_0x5dc1('0x20')](_0xfa34c1[_0x5dc1('0x32')][_0x5dc1('0x20')]);_0x1b51eb['offset']=qs[_0x5dc1('0x23')](_0xfa34c1[_0x5dc1('0x32')][_0x5dc1('0x23')]);}_0x1b51eb[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0xfa34c1[_0x5dc1('0x32')]['sort']);_0x1b51eb[_0x5dc1('0x3c')]=qs['filters'](_['pick'](_0xfa34c1['query'],_0xdc0c44['filters']),_0xc4d896);if(_0xfa34c1[_0x5dc1('0x32')][_0x5dc1('0x3d')]){_0x1b51eb['where']=_[_0x5dc1('0x3e')](_0x1b51eb[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x2e')](_0xc4d896,function(_0x315335){if(_0x315335[_0x5dc1('0x3f')]!==_0x5dc1('0x40')){var _0x5d1ec0={};_0x5d1ec0[_0x315335[_0x5dc1('0x2b')]]={'$like':'%'+_0xfa34c1[_0x5dc1('0x32')][_0x5dc1('0x3d')]+'%'};return _0x5d1ec0;}})});}_0x1b51eb=_[_0x5dc1('0x3e')]({},_0x1b51eb,_0xfa34c1['options']);var _0x137107={'where':_0x1b51eb[_0x5dc1('0x3c')]};return db[_0x5dc1('0x41')][_0x5dc1('0x22')](_0x137107)[_0x5dc1('0x28')](function(_0x283483){_0x4c21c3[_0x5dc1('0x22')]=_0x283483;if(_0xfa34c1[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x1b51eb[_0x5dc1('0x43')]=[{'all':!![]}];}return db[_0x5dc1('0x41')][_0x5dc1('0x44')](_0x1b51eb);})[_0x5dc1('0x28')](function(_0x492350){_0x4c21c3[_0x5dc1('0x45')]=_0x492350;return _0x4c21c3;})[_0x5dc1('0x28')](respondWithFilteredResult(_0x384ba5,_0x1b51eb))[_0x5dc1('0x46')](handleError(_0x384ba5,null));};exports[_0x5dc1('0x47')]=function(_0x28806d,_0x17b30b){var _0x1ffacc={'raw':!![],'where':{'id':_0x28806d[_0x5dc1('0x48')]['id']}},_0x49bad4={};_0x49bad4[_0x5dc1('0x31')]=_[_0x5dc1('0x49')](db[_0x5dc1('0x41')]['rawAttributes']);_0x49bad4['query']=_['keys'](_0x28806d[_0x5dc1('0x32')]);_0x49bad4['filters']=_[_0x5dc1('0x34')](_0x49bad4[_0x5dc1('0x31')],_0x49bad4['query']);_0x1ffacc[_0x5dc1('0x35')]=_[_0x5dc1('0x34')](_0x49bad4[_0x5dc1('0x31')],qs[_0x5dc1('0x36')](_0x28806d[_0x5dc1('0x32')][_0x5dc1('0x36')]));_0x1ffacc[_0x5dc1('0x35')]=_0x1ffacc[_0x5dc1('0x35')][_0x5dc1('0x37')]?_0x1ffacc['attributes']:_0x49bad4[_0x5dc1('0x31')];if(_0x28806d[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x1ffacc[_0x5dc1('0x43')]=[{'all':!![]}];}_0x1ffacc=_[_0x5dc1('0x3e')]({},_0x1ffacc,_0x28806d[_0x5dc1('0x4a')]);return db[_0x5dc1('0x41')]['find'](_0x1ffacc)[_0x5dc1('0x28')](handleEntityNotFound(_0x17b30b,null))['then'](respondWithResult(_0x17b30b,null))[_0x5dc1('0x46')](handleError(_0x17b30b,null));};exports[_0x5dc1('0x4b')]=function(_0x385ca5,_0x13e220){return db['OpenchannelQueueReport'][_0x5dc1('0x4b')](_0x385ca5[_0x5dc1('0x4c')],{})['then'](respondWithResult(_0x13e220,0xc9))[_0x5dc1('0x46')](handleError(_0x13e220,null));};exports[_0x5dc1('0x4d')]=function(_0x2b9491,_0x54afcf){if(_0x2b9491[_0x5dc1('0x4c')]['id']){delete _0x2b9491[_0x5dc1('0x4c')]['id'];}return db[_0x5dc1('0x41')][_0x5dc1('0x4e')]({'where':{'id':_0x2b9491[_0x5dc1('0x48')]['id']}})['then'](handleEntityNotFound(_0x54afcf,null))[_0x5dc1('0x28')](saveUpdates(_0x2b9491['body'],null))[_0x5dc1('0x28')](respondWithResult(_0x54afcf,null))[_0x5dc1('0x46')](handleError(_0x54afcf,null));};exports[_0x5dc1('0x29')]=function(_0x54e38b,_0x48c621){return db[_0x5dc1('0x41')][_0x5dc1('0x4e')]({'where':{'id':_0x54e38b[_0x5dc1('0x48')]['id']}})[_0x5dc1('0x28')](handleEntityNotFound(_0x48c621,null))['then'](removeEntity(_0x48c621,null))[_0x5dc1('0x46')](handleError(_0x48c621,null));};exports[_0x5dc1('0x4f')]=function(_0x17331f,_0x3965d9){return db[_0x5dc1('0x41')][_0x5dc1('0x4f')]()['then'](respondWithResult(_0x3965d9,null))[_0x5dc1('0x46')](handleError(_0x3965d9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b4cc1ff..18c6f88 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x4047c1,_0x1d41aa){var _0xb6d722=function(_0x2075ce){while(--_0x2075ce){_0x4047c1['push'](_0x4047c1['shift']());}};_0xb6d722(++_0x1d41aa);}(_0x7a54,0x106));var _0x47a5=function(_0x1bc979,_0x3cf2f4){_0x1bc979=_0x1bc979-0x0;var _0x590046=_0x7a54[_0x1bc979];return _0x590046;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x4cc280,_0x3b77f3){var _0x16ed24=function(_0x473e10){while(--_0x473e10){_0x4cc280['push'](_0x4cc280['shift']());}};_0x16ed24(++_0x3b77f3);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x5fc3[_0x4695ba];return _0x524b7d;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('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 9e3d8c9..15cbd05 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 _0x282b=['catch','CreateOpenchannelQueueReport','create','body','options','raw','debug','OpenchannelQueueReport','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x47e9d4,_0x3ef1f7){var _0x5aa858=function(_0x3e2874){while(--_0x3e2874){_0x47e9d4['push'](_0x47e9d4['shift']());}};_0x5aa858(++_0x3ef1f7);}(_0x282b,0xec));var _0xb282=function(_0x301b3,_0x17eb8e){_0x301b3=_0x301b3-0x0;var _0x585f4e=_0x282b[_0x301b3];return _0x585f4e;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['OpenchannelQueueReport'][_0xb282('0x16')](_0xca5f12[_0xb282('0x17')],{'raw':_0xca5f12['options']?_0xca5f12[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![]})[_0xb282('0xb')](function(_0x438dbe){logger[_0xb282('0xc')]('CreateOpenchannelQueueReport',_0xca5f12);logger[_0xb282('0x1a')](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x438dbe));_0x3f8a3f(_0x438dbe);})['catch'](function(_0x437d66){logger[_0xb282('0x11')](_0xb282('0x15'),_0x437d66[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070[_0xb282('0x11')](0x1f4,_0x437d66['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x360f15){var _0x3c7f1f=this;return new Promise(function(_0x4934f0,_0x5e828e){return db[_0xb282('0x1b')][_0xb282('0x1c')](_0x360f15[_0xb282('0x17')],{'raw':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1d')]||null:null,'attributes':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1e')]||null:null,'limit':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')]['limit']||null:null})[_0xb282('0xb')](function(_0x1fb89f){logger[_0xb282('0xc')](_0xb282('0x1f'),_0x360f15);logger[_0xb282('0x1a')](_0xb282('0x1f'),_0x360f15,JSON[_0xb282('0x10')](_0x1fb89f));_0x4934f0(_0x1fb89f);})['catch'](function(_0x1b15b5){logger[_0xb282('0x11')](_0xb282('0x1f'),_0x1b15b5[_0xb282('0x12')],_0x360f15);_0x5e828e(_0x3c7f1f[_0xb282('0x11')](0x1f4,_0x1b15b5['message']));});});}; \ No newline at end of file +var _0xab40=['OpenchannelQueueReport','create','body','options','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','raw','attributes','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x439e6b,_0x39bf05){var _0x4b43a6=function(_0x5c2532){while(--_0x5c2532){_0x439e6b['push'](_0x439e6b['shift']());}};_0x4b43a6(++_0x39bf05);}(_0xab40,0xcd));var _0x0ab4=function(_0x54a0d8,_0xb969fc){_0x54a0d8=_0x54a0d8-0x0;var _0x3e89f2=_0xab40[_0x54a0d8];return _0x3e89f2;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['CreateOpenchannelQueueReport']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')](_0x17422f[_0x0ab4('0x15')],{'raw':_0x17422f[_0x0ab4('0x16')]?_0x17422f['options']['raw']===undefined?!![]:![]:!![]})[_0x0ab4('0x17')](function(_0x5b1ed5){logger[_0x0ab4('0x8')](_0x0ab4('0x18'),_0x17422f);logger['debug'](_0x0ab4('0x18'),_0x17422f,JSON[_0x0ab4('0xd')](_0x5b1ed5));_0x2f50d2(_0x5b1ed5);})[_0x0ab4('0x12')](function(_0x1d5c14){logger[_0x0ab4('0xf')]('CreateOpenchannelQueueReport',_0x1d5c14['message'],_0x17422f);_0x53723c(_0x30d5df[_0x0ab4('0xf')](0x1f4,_0x1d5c14[_0x0ab4('0x10')]));});});};exports[_0x0ab4('0x19')]=function(_0x13c882){var _0x4e4b80=this;return new Promise(function(_0x42d2dd,_0x3caa9d){return db[_0x0ab4('0x13')]['update'](_0x13c882['body'],{'raw':_0x13c882[_0x0ab4('0x16')]?_0x13c882[_0x0ab4('0x16')][_0x0ab4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13c882['options']?_0x13c882['options']['where']||null:null,'attributes':_0x13c882[_0x0ab4('0x16')]?_0x13c882['options'][_0x0ab4('0x1b')]||null:null,'limit':_0x13c882[_0x0ab4('0x16')]?_0x13c882['options']['limit']||null:null})['then'](function(_0x3d38a4){logger[_0x0ab4('0x8')](_0x0ab4('0x19'),_0x13c882);logger[_0x0ab4('0xb')](_0x0ab4('0x19'),_0x13c882,JSON['stringify'](_0x3d38a4));_0x42d2dd(_0x3d38a4);})['catch'](function(_0x580d56){logger[_0x0ab4('0xf')](_0x0ab4('0x19'),_0x580d56[_0x0ab4('0x10')],_0x13c882);_0x3caa9d(_0x4e4b80[_0x0ab4('0xf')](0x1f4,_0x580d56[_0x0ab4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index d0e19d0..bf2aa2a 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 _0x0b2d=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','describe','get','show','post','put','/:id','update','delete','destroy'];(function(_0x56f3a3,_0x47d801){var _0x40c0cb=function(_0x500a7a){while(--_0x500a7a){_0x56f3a3['push'](_0x56f3a3['shift']());}};_0x40c0cb(++_0x47d801);}(_0x0b2d,0xd3));var _0xd0b2=function(_0x530ce7,_0x5b4ac5){_0x530ce7=_0x530ce7-0x0;var _0x5b1233=_0x0b2d[_0x530ce7];return _0x5b1233;};'use strict';var multer=require(_0xd0b2('0x0'));var util=require(_0xd0b2('0x1'));var path=require(_0xd0b2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0b2('0x3'));var router=express[_0xd0b2('0x4')]();var fs_extra=require(_0xd0b2('0x5'));var auth=require(_0xd0b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0b2('0x7'));var controller=require(_0xd0b2('0x8'));router['get']('/',auth[_0xd0b2('0x9')](),controller[_0xd0b2('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd0b2('0xb')]);router[_0xd0b2('0xc')]('/:id',auth[_0xd0b2('0x9')](),controller[_0xd0b2('0xd')]);router[_0xd0b2('0xe')]('/',auth[_0xd0b2('0x9')](),controller['create']);router[_0xd0b2('0xf')](_0xd0b2('0x10'),auth[_0xd0b2('0x9')](),controller[_0xd0b2('0x11')]);router[_0xd0b2('0x12')](_0xd0b2('0x10'),auth[_0xd0b2('0x9')](),controller[_0xd0b2('0x13')]);module[_0xd0b2('0x14')]=router; \ No newline at end of file +var _0x039e=['isAuthenticated','index','/describe','describe','show','create','put','/:id','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0xd5eb18,_0x210063){var _0x23aeb3=function(_0x42df36){while(--_0x42df36){_0xd5eb18['push'](_0xd5eb18['shift']());}};_0x23aeb3(++_0x210063);}(_0x039e,0x101));var _0xe039=function(_0x42f0ba,_0x33efdd){_0x42f0ba=_0x42f0ba-0x0;var _0x58ad93=_0x039e[_0x42f0ba];return _0x58ad93;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe039('0x0'));var timeout=require(_0xe039('0x1'));var express=require('express');var router=express[_0xe039('0x2')]();var fs_extra=require(_0xe039('0x3'));var auth=require(_0xe039('0x4'));var interaction=require(_0xe039('0x5'));var config=require(_0xe039('0x6'));var controller=require(_0xe039('0x7'));router[_0xe039('0x8')]('/',auth[_0xe039('0x9')](),controller[_0xe039('0xa')]);router[_0xe039('0x8')](_0xe039('0xb'),auth['isAuthenticated'](),controller[_0xe039('0xc')]);router[_0xe039('0x8')]('/:id',auth[_0xe039('0x9')](),controller[_0xe039('0xd')]);router['post']('/',auth[_0xe039('0x9')](),controller[_0xe039('0xe')]);router[_0xe039('0xf')](_0xe039('0x10'),auth[_0xe039('0x9')](),controller['update']);router['delete'](_0xe039('0x10'),auth['isAuthenticated'](),controller[_0xe039('0x11')]);module[_0xe039('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 03b1036..e14354c 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x38838f,_0x1cd670){_0x38838f=_0x38838f-0x0;var _0x4a30d6=_0xb43b[_0x38838f];return _0x4a30d6;};'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(_0x39270a,_0xd82b18){var _0x44bd7d=function(_0x190b47){while(--_0x190b47){_0x39270a['push'](_0x39270a['shift']());}};_0x44bd7d(++_0xd82b18);}(_0x70e0,0x17b));var _0x070e=function(_0x4452c5,_0x13a76c){_0x4452c5=_0x4452c5-0x0;var _0x447b3d=_0x70e0[_0x4452c5];return _0x447b3d;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 778bf2d..70d55ff 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 _0xa5fc=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelTransferReport','include','findAll','catch','show','params','length','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x379ad5,_0x552893){var _0x2bcdec=function(_0x2b7568){while(--_0x2b7568){_0x379ad5['push'](_0x379ad5['shift']());}};_0x2bcdec(++_0x552893);}(_0xa5fc,0x146));var _0xca5f=function(_0x211b20,_0x306c73){_0x211b20=_0x211b20-0x0;var _0xa1eab=_0xa5fc[_0x211b20];return _0xa1eab;};'use strict';var emlformat=require(_0xca5f('0x0'));var rimraf=require(_0xca5f('0x1'));var zipdir=require(_0xca5f('0x2'));var jsonpatch=require(_0xca5f('0x3'));var rp=require(_0xca5f('0x4'));var moment=require(_0xca5f('0x5'));var BPromise=require(_0xca5f('0x6'));var Mustache=require('mustache');var util=require(_0xca5f('0x7'));var path=require(_0xca5f('0x8'));var sox=require(_0xca5f('0x9'));var csv=require(_0xca5f('0xa'));var ejs=require(_0xca5f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xca5f('0xc'));var crypto=require(_0xca5f('0xd'));var jsforce=require(_0xca5f('0xe'));var deskjs=require(_0xca5f('0xf'));var toCsv=require(_0xca5f('0xa'));var querystring=require(_0xca5f('0x10'));var Papa=require(_0xca5f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca5f('0x13'));var logger=require(_0xca5f('0x14'))(_0xca5f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xca5f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5278ef,_0x5e744d){_0x5e744d=_0x5e744d||0xcc;return function(_0x3a9057){if(_0x3a9057){return _0x5278ef[_0xca5f('0x17')](_0x5e744d);}return _0x5278ef[_0xca5f('0x18')](_0x5e744d)[_0xca5f('0x19')]();};}function respondWithResult(_0x1c3f9d,_0x1246dd){_0x1246dd=_0x1246dd||0xc8;return function(_0x43758a){if(_0x43758a){return _0x1c3f9d[_0xca5f('0x18')](_0x1246dd)[_0xca5f('0x1a')](_0x43758a);}};}function respondWithFilteredResult(_0x23cab6,_0x3da903){return function(_0x28754c){if(_0x28754c){var _0x4b414b=typeof _0x3da903[_0xca5f('0x1b')]===_0xca5f('0x1c')&&typeof _0x3da903[_0xca5f('0x1d')]===_0xca5f('0x1c');var _0xe4302d=_0x28754c[_0xca5f('0x1e')];var _0x185004=_0x4b414b?0x0:_0x3da903['offset'];var _0x588bf0=_0x4b414b?_0x28754c[_0xca5f('0x1e')]:_0x3da903[_0xca5f('0x1b')]+_0x3da903[_0xca5f('0x1d')];var _0x510058;if(_0x588bf0>=_0xe4302d){_0x588bf0=_0xe4302d;_0x510058=0xc8;}else{_0x510058=0xce;}_0x23cab6[_0xca5f('0x18')](_0x510058);return _0x23cab6[_0xca5f('0x1f')](_0xca5f('0x20'),_0x185004+'-'+_0x588bf0+'/'+_0xe4302d)['json'](_0x28754c);}return null;};}function patchUpdates(_0x327039){return function(_0x710489){try{jsonpatch[_0xca5f('0x21')](_0x710489,_0x327039,!![]);}catch(_0xfb9933){return BPromise['reject'](_0xfb9933);}return _0x710489['save']();};}function saveUpdates(_0x445d1d,_0x3aebe6){return function(_0x48c239){if(_0x48c239){return _0x48c239[_0xca5f('0x22')](_0x445d1d)['then'](function(_0x469db2){return _0x469db2;});}return null;};}function removeEntity(_0x4ce755,_0xed8b41){return function(_0x2a5ba1){if(_0x2a5ba1){return _0x2a5ba1['destroy']()[_0xca5f('0x23')](function(){_0x4ce755['status'](0xcc)[_0xca5f('0x19')]();});}};}function handleEntityNotFound(_0x185044,_0xc798e5){return function(_0x1b246a){if(!_0x1b246a){_0x185044[_0xca5f('0x17')](0x194);}return _0x1b246a;};}function handleError(_0x103630,_0xf68a4f){_0xf68a4f=_0xf68a4f||0x1f4;return function(_0x2954a6){logger[_0xca5f('0x24')](_0x2954a6[_0xca5f('0x25')]);if(_0x2954a6['name']){delete _0x2954a6[_0xca5f('0x26')];}_0x103630[_0xca5f('0x18')](_0xf68a4f)[_0xca5f('0x27')](_0x2954a6);};}exports[_0xca5f('0x28')]=function(_0x3b9054,_0x268233){var _0x5c29e4={},_0x30cb5a={},_0x314d61={'count':0x0,'rows':[]};var _0x1777a5=_[_0xca5f('0x29')](db['OpenchannelTransferReport'][_0xca5f('0x2a')],function(_0x17b500){return{'name':_0x17b500[_0xca5f('0x2b')],'type':_0x17b500[_0xca5f('0x2c')]['key']};});_0x30cb5a[_0xca5f('0x2d')]=_[_0xca5f('0x29')](_0x1777a5,_0xca5f('0x26'));_0x30cb5a[_0xca5f('0x2e')]=_[_0xca5f('0x2f')](_0x3b9054['query']);_0x30cb5a[_0xca5f('0x30')]=_[_0xca5f('0x31')](_0x30cb5a[_0xca5f('0x2d')],_0x30cb5a[_0xca5f('0x2e')]);_0x5c29e4[_0xca5f('0x32')]=_['intersection'](_0x30cb5a[_0xca5f('0x2d')],qs[_0xca5f('0x33')](_0x3b9054['query'][_0xca5f('0x33')]));_0x5c29e4[_0xca5f('0x32')]=_0x5c29e4[_0xca5f('0x32')]['length']?_0x5c29e4[_0xca5f('0x32')]:_0x30cb5a[_0xca5f('0x2d')];if(!_0x3b9054['query'][_0xca5f('0x34')](_0xca5f('0x35'))){_0x5c29e4[_0xca5f('0x1d')]=qs[_0xca5f('0x1d')](_0x3b9054[_0xca5f('0x2e')][_0xca5f('0x1d')]);_0x5c29e4[_0xca5f('0x1b')]=qs['offset'](_0x3b9054[_0xca5f('0x2e')][_0xca5f('0x1b')]);}_0x5c29e4[_0xca5f('0x36')]=qs[_0xca5f('0x37')](_0x3b9054[_0xca5f('0x2e')]['sort']);_0x5c29e4[_0xca5f('0x38')]=qs['filters'](_[_0xca5f('0x39')](_0x3b9054['query'],_0x30cb5a['filters']),_0x1777a5);if(_0x3b9054[_0xca5f('0x2e')][_0xca5f('0x3a')]){_0x5c29e4['where']=_[_0xca5f('0x3b')](_0x5c29e4[_0xca5f('0x38')],{'$or':_[_0xca5f('0x29')](_0x1777a5,function(_0x2fb677){if(_0x2fb677[_0xca5f('0x2c')]!==_0xca5f('0x3c')){var _0x4706a7={};_0x4706a7[_0x2fb677[_0xca5f('0x26')]]={'$like':'%'+_0x3b9054[_0xca5f('0x2e')]['filter']+'%'};return _0x4706a7;}})});}_0x5c29e4=_[_0xca5f('0x3b')]({},_0x5c29e4,_0x3b9054['options']);var _0x1bed30={'where':_0x5c29e4[_0xca5f('0x38')]};return db[_0xca5f('0x3d')][_0xca5f('0x1e')](_0x1bed30)[_0xca5f('0x23')](function(_0x5cfc1d){_0x314d61['count']=_0x5cfc1d;if(_0x3b9054[_0xca5f('0x2e')]['includeAll']){_0x5c29e4[_0xca5f('0x3e')]=[{'all':!![]}];}return db[_0xca5f('0x3d')][_0xca5f('0x3f')](_0x5c29e4);})[_0xca5f('0x23')](function(_0x4e575e){_0x314d61['rows']=_0x4e575e;return _0x314d61;})[_0xca5f('0x23')](respondWithFilteredResult(_0x268233,_0x5c29e4))[_0xca5f('0x40')](handleError(_0x268233,null));};exports[_0xca5f('0x41')]=function(_0xa199ed,_0x4cf099){var _0xef1548={'raw':!![],'where':{'id':_0xa199ed[_0xca5f('0x42')]['id']}},_0x4b3a85={};_0x4b3a85[_0xca5f('0x2d')]=_[_0xca5f('0x2f')](db[_0xca5f('0x3d')]['rawAttributes']);_0x4b3a85['query']=_[_0xca5f('0x2f')](_0xa199ed[_0xca5f('0x2e')]);_0x4b3a85[_0xca5f('0x30')]=_[_0xca5f('0x31')](_0x4b3a85['model'],_0x4b3a85[_0xca5f('0x2e')]);_0xef1548[_0xca5f('0x32')]=_[_0xca5f('0x31')](_0x4b3a85['model'],qs[_0xca5f('0x33')](_0xa199ed[_0xca5f('0x2e')][_0xca5f('0x33')]));_0xef1548[_0xca5f('0x32')]=_0xef1548[_0xca5f('0x32')][_0xca5f('0x43')]?_0xef1548[_0xca5f('0x32')]:_0x4b3a85[_0xca5f('0x2d')];if(_0xa199ed[_0xca5f('0x2e')][_0xca5f('0x44')]){_0xef1548[_0xca5f('0x3e')]=[{'all':!![]}];}_0xef1548=_[_0xca5f('0x3b')]({},_0xef1548,_0xa199ed[_0xca5f('0x45')]);return db[_0xca5f('0x3d')][_0xca5f('0x46')](_0xef1548)[_0xca5f('0x23')](handleEntityNotFound(_0x4cf099,null))[_0xca5f('0x23')](respondWithResult(_0x4cf099,null))[_0xca5f('0x40')](handleError(_0x4cf099,null));};exports[_0xca5f('0x47')]=function(_0x589992,_0x320db1){return db[_0xca5f('0x3d')][_0xca5f('0x47')](_0x589992[_0xca5f('0x48')],{})['then'](respondWithResult(_0x320db1,0xc9))[_0xca5f('0x40')](handleError(_0x320db1,null));};exports[_0xca5f('0x22')]=function(_0x984d07,_0x57350a){if(_0x984d07[_0xca5f('0x48')]['id']){delete _0x984d07[_0xca5f('0x48')]['id'];}return db[_0xca5f('0x3d')]['find']({'where':{'id':_0x984d07[_0xca5f('0x42')]['id']}})['then'](handleEntityNotFound(_0x57350a,null))[_0xca5f('0x23')](saveUpdates(_0x984d07['body'],null))['then'](respondWithResult(_0x57350a,null))[_0xca5f('0x40')](handleError(_0x57350a,null));};exports[_0xca5f('0x49')]=function(_0x59906e,_0x2b7363){return db[_0xca5f('0x3d')][_0xca5f('0x46')]({'where':{'id':_0x59906e['params']['id']}})['then'](handleEntityNotFound(_0x2b7363,null))['then'](removeEntity(_0x2b7363,null))[_0xca5f('0x40')](handleError(_0x2b7363,null));};exports[_0xca5f('0x4a')]=function(_0xac30a9,_0x15a011){return db[_0xca5f('0x3d')][_0xca5f('0x4a')]()[_0xca5f('0x23')](respondWithResult(_0x15a011,null))['catch'](handleError(_0x15a011,null));}; \ No newline at end of file +var _0x36cb=['Content-Range','apply','save','update','then','end','error','stack','name','send','index','OpenchannelTransferReport','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','keys','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x150257,_0x33db7b){var _0x4050eb=function(_0x2a45a2){while(--_0x2a45a2){_0x150257['push'](_0x150257['shift']());}};_0x4050eb(++_0x33db7b);}(_0x36cb,0x15f));var _0xb36c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x36cb[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb36c('0x0'));var zipdir=require(_0xb36c('0x1'));var jsonpatch=require(_0xb36c('0x2'));var rp=require(_0xb36c('0x3'));var moment=require(_0xb36c('0x4'));var BPromise=require(_0xb36c('0x5'));var Mustache=require('mustache');var util=require(_0xb36c('0x6'));var path=require(_0xb36c('0x7'));var sox=require(_0xb36c('0x8'));var csv=require(_0xb36c('0x9'));var ejs=require(_0xb36c('0xa'));var fs=require('fs');var fs_extra=require(_0xb36c('0xb'));var _=require('lodash');var squel=require(_0xb36c('0xc'));var crypto=require(_0xb36c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb36c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb36c('0xf'));var Redis=require(_0xb36c('0x10'));var authService=require(_0xb36c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb36c('0x12'));var hardwareService=require(_0xb36c('0x13'));var logger=require(_0xb36c('0x14'))(_0xb36c('0x15'));var utils=require(_0xb36c('0x16'));var config=require(_0xb36c('0x17'));var licenseUtil=require(_0xb36c('0x18'));var db=require(_0xb36c('0x19'))['db'];function respondWithStatusCode(_0x6c8a7f,_0x399c9c){_0x399c9c=_0x399c9c||0xcc;return function(_0x2e7c62){if(_0x2e7c62){return _0x6c8a7f[_0xb36c('0x1a')](_0x399c9c);}return _0x6c8a7f['status'](_0x399c9c)['end']();};}function respondWithResult(_0x2999e1,_0x361653){_0x361653=_0x361653||0xc8;return function(_0x172f9a){if(_0x172f9a){return _0x2999e1[_0xb36c('0x1b')](_0x361653)[_0xb36c('0x1c')](_0x172f9a);}};}function respondWithFilteredResult(_0x53a98a,_0x196bbf){return function(_0x428b23){if(_0x428b23){var _0x9ce543=typeof _0x196bbf[_0xb36c('0x1d')]===_0xb36c('0x1e')&&typeof _0x196bbf[_0xb36c('0x1f')]===_0xb36c('0x1e');var _0x539ce1=_0x428b23[_0xb36c('0x20')];var _0x2063be=_0x9ce543?0x0:_0x196bbf[_0xb36c('0x1d')];var _0x3b4266=_0x9ce543?_0x428b23[_0xb36c('0x20')]:_0x196bbf['offset']+_0x196bbf[_0xb36c('0x1f')];var _0x44c9ee;if(_0x3b4266>=_0x539ce1){_0x3b4266=_0x539ce1;_0x44c9ee=0xc8;}else{_0x44c9ee=0xce;}_0x53a98a[_0xb36c('0x1b')](_0x44c9ee);return _0x53a98a[_0xb36c('0x21')](_0xb36c('0x22'),_0x2063be+'-'+_0x3b4266+'/'+_0x539ce1)['json'](_0x428b23);}return null;};}function patchUpdates(_0x1911a0){return function(_0x5d9b5c){try{jsonpatch[_0xb36c('0x23')](_0x5d9b5c,_0x1911a0,!![]);}catch(_0x16f03e){return BPromise['reject'](_0x16f03e);}return _0x5d9b5c[_0xb36c('0x24')]();};}function saveUpdates(_0x34085c,_0x4376f5){return function(_0x11c4ea){if(_0x11c4ea){return _0x11c4ea[_0xb36c('0x25')](_0x34085c)[_0xb36c('0x26')](function(_0x5a8908){return _0x5a8908;});}return null;};}function removeEntity(_0x555abb,_0x7a983a){return function(_0x4bc92c){if(_0x4bc92c){return _0x4bc92c['destroy']()[_0xb36c('0x26')](function(){_0x555abb[_0xb36c('0x1b')](0xcc)[_0xb36c('0x27')]();});}};}function handleEntityNotFound(_0x183127,_0x3d4ac7){return function(_0x2f25c9){if(!_0x2f25c9){_0x183127[_0xb36c('0x1a')](0x194);}return _0x2f25c9;};}function handleError(_0x402e07,_0x492eea){_0x492eea=_0x492eea||0x1f4;return function(_0x139baf){logger[_0xb36c('0x28')](_0x139baf[_0xb36c('0x29')]);if(_0x139baf[_0xb36c('0x2a')]){delete _0x139baf['name'];}_0x402e07[_0xb36c('0x1b')](_0x492eea)[_0xb36c('0x2b')](_0x139baf);};}exports[_0xb36c('0x2c')]=function(_0x9997b0,_0x1f0b03){var _0x59adec={},_0x311784={},_0x90c97b={'count':0x0,'rows':[]};var _0x2b190d=_['map'](db[_0xb36c('0x2d')]['rawAttributes'],function(_0x5ba714){return{'name':_0x5ba714[_0xb36c('0x2e')],'type':_0x5ba714[_0xb36c('0x2f')][_0xb36c('0x30')]};});_0x311784[_0xb36c('0x31')]=_[_0xb36c('0x32')](_0x2b190d,_0xb36c('0x2a'));_0x311784['query']=_['keys'](_0x9997b0[_0xb36c('0x33')]);_0x311784[_0xb36c('0x34')]=_[_0xb36c('0x35')](_0x311784[_0xb36c('0x31')],_0x311784[_0xb36c('0x33')]);_0x59adec['attributes']=_['intersection'](_0x311784[_0xb36c('0x31')],qs[_0xb36c('0x36')](_0x9997b0['query'][_0xb36c('0x36')]));_0x59adec[_0xb36c('0x37')]=_0x59adec[_0xb36c('0x37')][_0xb36c('0x38')]?_0x59adec[_0xb36c('0x37')]:_0x311784[_0xb36c('0x31')];if(!_0x9997b0[_0xb36c('0x33')]['hasOwnProperty'](_0xb36c('0x39'))){_0x59adec[_0xb36c('0x1f')]=qs['limit'](_0x9997b0[_0xb36c('0x33')][_0xb36c('0x1f')]);_0x59adec['offset']=qs['offset'](_0x9997b0[_0xb36c('0x33')][_0xb36c('0x1d')]);}_0x59adec[_0xb36c('0x3a')]=qs[_0xb36c('0x3b')](_0x9997b0['query'][_0xb36c('0x3b')]);_0x59adec['where']=qs[_0xb36c('0x34')](_[_0xb36c('0x3c')](_0x9997b0[_0xb36c('0x33')],_0x311784[_0xb36c('0x34')]),_0x2b190d);if(_0x9997b0['query'][_0xb36c('0x3d')]){_0x59adec[_0xb36c('0x3e')]=_[_0xb36c('0x3f')](_0x59adec[_0xb36c('0x3e')],{'$or':_[_0xb36c('0x32')](_0x2b190d,function(_0xf3b039){if(_0xf3b039[_0xb36c('0x2f')]!==_0xb36c('0x40')){var _0x1b999a={};_0x1b999a[_0xf3b039[_0xb36c('0x2a')]]={'$like':'%'+_0x9997b0[_0xb36c('0x33')][_0xb36c('0x3d')]+'%'};return _0x1b999a;}})});}_0x59adec=_[_0xb36c('0x3f')]({},_0x59adec,_0x9997b0[_0xb36c('0x41')]);var _0x181c4f={'where':_0x59adec[_0xb36c('0x3e')]};return db['OpenchannelTransferReport'][_0xb36c('0x20')](_0x181c4f)[_0xb36c('0x26')](function(_0x459877){_0x90c97b['count']=_0x459877;if(_0x9997b0[_0xb36c('0x33')]['includeAll']){_0x59adec[_0xb36c('0x42')]=[{'all':!![]}];}return db[_0xb36c('0x2d')]['findAll'](_0x59adec);})[_0xb36c('0x26')](function(_0x299793){_0x90c97b[_0xb36c('0x43')]=_0x299793;return _0x90c97b;})['then'](respondWithFilteredResult(_0x1f0b03,_0x59adec))[_0xb36c('0x44')](handleError(_0x1f0b03,null));};exports[_0xb36c('0x45')]=function(_0x220062,_0x2fc5e4){var _0x485659={'raw':!![],'where':{'id':_0x220062['params']['id']}},_0x5ab4ba={};_0x5ab4ba[_0xb36c('0x31')]=_[_0xb36c('0x46')](db[_0xb36c('0x2d')]['rawAttributes']);_0x5ab4ba[_0xb36c('0x33')]=_[_0xb36c('0x46')](_0x220062[_0xb36c('0x33')]);_0x5ab4ba['filters']=_[_0xb36c('0x35')](_0x5ab4ba[_0xb36c('0x31')],_0x5ab4ba[_0xb36c('0x33')]);_0x485659[_0xb36c('0x37')]=_['intersection'](_0x5ab4ba[_0xb36c('0x31')],qs['fields'](_0x220062['query'][_0xb36c('0x36')]));_0x485659['attributes']=_0x485659['attributes'][_0xb36c('0x38')]?_0x485659[_0xb36c('0x37')]:_0x5ab4ba[_0xb36c('0x31')];if(_0x220062['query'][_0xb36c('0x47')]){_0x485659[_0xb36c('0x42')]=[{'all':!![]}];}_0x485659=_[_0xb36c('0x3f')]({},_0x485659,_0x220062['options']);return db[_0xb36c('0x2d')][_0xb36c('0x48')](_0x485659)['then'](handleEntityNotFound(_0x2fc5e4,null))[_0xb36c('0x26')](respondWithResult(_0x2fc5e4,null))[_0xb36c('0x44')](handleError(_0x2fc5e4,null));};exports[_0xb36c('0x49')]=function(_0x3d7307,_0x5231d5){return db[_0xb36c('0x2d')][_0xb36c('0x49')](_0x3d7307[_0xb36c('0x4a')],{})['then'](respondWithResult(_0x5231d5,0xc9))[_0xb36c('0x44')](handleError(_0x5231d5,null));};exports['update']=function(_0x4f2e45,_0x4bc413){if(_0x4f2e45[_0xb36c('0x4a')]['id']){delete _0x4f2e45[_0xb36c('0x4a')]['id'];}return db[_0xb36c('0x2d')][_0xb36c('0x48')]({'where':{'id':_0x4f2e45[_0xb36c('0x4b')]['id']}})[_0xb36c('0x26')](handleEntityNotFound(_0x4bc413,null))[_0xb36c('0x26')](saveUpdates(_0x4f2e45['body'],null))[_0xb36c('0x26')](respondWithResult(_0x4bc413,null))[_0xb36c('0x44')](handleError(_0x4bc413,null));};exports['destroy']=function(_0x44ef1e,_0x45dcf4){return db[_0xb36c('0x2d')][_0xb36c('0x48')]({'where':{'id':_0x44ef1e[_0xb36c('0x4b')]['id']}})[_0xb36c('0x26')](handleEntityNotFound(_0x45dcf4,null))[_0xb36c('0x26')](removeEntity(_0x45dcf4,null))['catch'](handleError(_0x45dcf4,null));};exports[_0xb36c('0x4c')]=function(_0x3e795d,_0x150848){return db[_0xb36c('0x2d')][_0xb36c('0x4c')]()[_0xb36c('0x26')](respondWithResult(_0x150848,null))[_0xb36c('0x44')](handleError(_0x150848,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8d1f9d9..d6bd65d 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 _0x9676=['lodash','util','../../config/logger','api','bluebird','request-promise','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9676,0x136));var _0x6967=function(_0x3e8450,_0x3d95a1){_0x3e8450=_0x3e8450-0x0;var _0x40a872=_0x9676[_0x3e8450];return _0x40a872;};'use strict';var _=require(_0x6967('0x0'));var util=require(_0x6967('0x1'));var logger=require(_0x6967('0x2'))(_0x6967('0x3'));var moment=require('moment');var BPromise=require(_0x6967('0x4'));var rp=require(_0x6967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6967('0x6'));module[_0x6967('0x7')]=function(_0x47cb93,_0x126465){return _0x47cb93[_0x6967('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x6967('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34d5=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid','lodash'];(function(_0x477a11,_0x5340c4){var _0x9216d8=function(_0x3a665c){while(--_0x3a665c){_0x477a11['push'](_0x477a11['shift']());}};_0x9216d8(++_0x5340c4);}(_0x34d5,0x15b));var _0x534d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x34d5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x534d('0x0'));var util=require(_0x534d('0x1'));var logger=require(_0x534d('0x2'))(_0x534d('0x3'));var moment=require(_0x534d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x534d('0x5'));var rimraf=require(_0x534d('0x6'));var config=require(_0x534d('0x7'));var attributes=require(_0x534d('0x8'));module['exports']=function(_0x3f869a,_0x131cba){return _0x3f869a[_0x534d('0x9')](_0x534d('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x534d('0xb'),'fields':[_0x534d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index fe0b15a..17dcab8 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 _0xed1f=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x514ea0,_0x352eb7){var _0x57b24b=function(_0x57fe04){while(--_0x57fe04){_0x514ea0['push'](_0x514ea0['shift']());}};_0x57b24b(++_0x352eb7);}(_0xed1f,0x6a));var _0xfed1=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xed1f[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file +var _0x2eb2=['request','then','info','request\x20sent','error','OpenchannelTransferReport,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x4d5812,_0x27a69c){var _0x5649ef=function(_0x2aecbd){while(--_0x2aecbd){_0x4d5812['push'](_0x4d5812['shift']());}};_0x5649ef(++_0x27a69c);}(_0x2eb2,0x19f));var _0x22eb=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2eb2[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bf238f7..bc8c079 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 _0x86d1=['post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id'];(function(_0x4f495f,_0x1844cd){var _0x5c08c9=function(_0x357e34){while(--_0x357e34){_0x4f495f['push'](_0x4f495f['shift']());}};_0x5c08c9(++_0x1844cd);}(_0x86d1,0xc5));var _0x186d=function(_0x5cb410,_0x25605f){_0x5cb410=_0x5cb410-0x0;var _0x3ac7c7=_0x86d1[_0x5cb410];return _0x3ac7c7;};'use strict';var multer=require(_0x186d('0x0'));var util=require(_0x186d('0x1'));var path=require(_0x186d('0x2'));var timeout=require(_0x186d('0x3'));var express=require('express');var router=express[_0x186d('0x4')]();var fs_extra=require(_0x186d('0x5'));var auth=require(_0x186d('0x6'));var interaction=require(_0x186d('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0x186d('0x8')](),controller['index']);router[_0x186d('0x9')](_0x186d('0xa'),auth[_0x186d('0x8')](),controller['show']);router[_0x186d('0xb')]('/',auth[_0x186d('0x8')](),controller[_0x186d('0xc')]);router['put'](_0x186d('0xa'),auth[_0x186d('0x8')](),controller[_0x186d('0xd')]);router[_0x186d('0xe')](_0x186d('0xa'),auth[_0x186d('0x8')](),controller['destroy']);module[_0x186d('0xf')]=router; \ No newline at end of file +var _0xac6c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x1eaaf6,_0x56e941){var _0x1616cc=function(_0x3c24c2){while(--_0x3c24c2){_0x1eaaf6['push'](_0x1eaaf6['shift']());}};_0x1616cc(++_0x56e941);}(_0xac6c,0xf4));var _0xcac6=function(_0x1e058a,_0x2a3d25){_0x1e058a=_0x1e058a-0x0;var _0x509fcb=_0xac6c[_0x1e058a];return _0x509fcb;};'use strict';var multer=require(_0xcac6('0x0'));var util=require(_0xcac6('0x1'));var path=require(_0xcac6('0x2'));var timeout=require(_0xcac6('0x3'));var express=require(_0xcac6('0x4'));var router=express[_0xcac6('0x5')]();var fs_extra=require(_0xcac6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcac6('0x7'));var config=require(_0xcac6('0x8'));var controller=require(_0xcac6('0x9'));router[_0xcac6('0xa')]('/',auth[_0xcac6('0xb')](),controller['index']);router[_0xcac6('0xa')](_0xcac6('0xc'),auth[_0xcac6('0xb')](),controller['show']);router[_0xcac6('0xd')]('/',auth[_0xcac6('0xb')](),controller[_0xcac6('0xe')]);router[_0xcac6('0xf')]('/:id',auth[_0xcac6('0xb')](),controller['update']);router[_0xcac6('0x10')](_0xcac6('0xc'),auth['isAuthenticated'](),controller[_0xcac6('0x11')]);module[_0xcac6('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index c1a8c85..82d77e7 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 _0x3e7a=['sequelize','exports','STRING','name'];(function(_0x35c978,_0x54d0c1){var _0x286dde=function(_0x399fc5){while(--_0x399fc5){_0x35c978['push'](_0x35c978['shift']());}};_0x286dde(++_0x54d0c1);}(_0x3e7a,0x1d4));var _0xa3e7=function(_0x3266ba,_0x3a3980){_0x3266ba=_0x3266ba-0x0;var _0x5a1bde=_0x3e7a[_0x3266ba];return _0x5a1bde;};'use strict';var Sequelize=require(_0xa3e7('0x0'));module[_0xa3e7('0x1')]={'name':{'type':Sequelize[_0xa3e7('0x2')],'unique':_0xa3e7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa3e7('0x2')]}}; \ No newline at end of file +var _0x8a4e=['STRING','name','sequelize'];(function(_0x214b79,_0x2b7146){var _0x38bfdc=function(_0x3b1698){while(--_0x3b1698){_0x214b79['push'](_0x214b79['shift']());}};_0x38bfdc(++_0x2b7146);}(_0x8a4e,0x68));var _0xe8a4=function(_0x136cbb,_0x2a97f9){_0x136cbb=_0x136cbb-0x0;var _0x333a69=_0x8a4e[_0x136cbb];return _0x333a69;};'use strict';var Sequelize=require(_0xe8a4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8a4('0x1')],'unique':_0xe8a4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xe8a4('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3969d15..e78125e 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 _0x27cb=['rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','Content-Range','reject','save','update','then','destroy','get','name','send','index','Pause'];(function(_0x3f9ff7,_0x187ae0){var _0x5bf44e=function(_0x45d4cd){while(--_0x45d4cd){_0x3f9ff7['push'](_0x3f9ff7['shift']());}};_0x5bf44e(++_0x187ae0);}(_0x27cb,0x1b1));var _0xb27c=function(_0x1d0dad,_0x1e00f9){_0x1d0dad=_0x1d0dad-0x0;var _0x560ed1=_0x27cb[_0x1d0dad];return _0x560ed1;};'use strict';var emlformat=require(_0xb27c('0x0'));var rimraf=require(_0xb27c('0x1'));var zipdir=require(_0xb27c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb27c('0x3'));var moment=require(_0xb27c('0x4'));var BPromise=require(_0xb27c('0x5'));var Mustache=require(_0xb27c('0x6'));var util=require(_0xb27c('0x7'));var path=require(_0xb27c('0x8'));var sox=require(_0xb27c('0x9'));var csv=require(_0xb27c('0xa'));var ejs=require(_0xb27c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb27c('0xc'));var crypto=require('crypto');var jsforce=require(_0xb27c('0xd'));var deskjs=require(_0xb27c('0xe'));var toCsv=require(_0xb27c('0xa'));var querystring=require('querystring');var Papa=require(_0xb27c('0xf'));var Redis=require('ioredis');var authService=require(_0xb27c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb27c('0x11'));var hardwareService=require(_0xb27c('0x12'));var logger=require(_0xb27c('0x13'))(_0xb27c('0x14'));var utils=require(_0xb27c('0x15'));var config=require(_0xb27c('0x16'));var licenseUtil=require(_0xb27c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2495ab,_0x4f713d){_0x4f713d=_0x4f713d||0xcc;return function(_0x41ac4e){if(_0x41ac4e){return _0x2495ab[_0xb27c('0x18')](_0x4f713d);}return _0x2495ab[_0xb27c('0x19')](_0x4f713d)[_0xb27c('0x1a')]();};}function respondWithResult(_0x4f2394,_0x41516f){_0x41516f=_0x41516f||0xc8;return function(_0x56962b){if(_0x56962b){return _0x4f2394['status'](_0x41516f)['json'](_0x56962b);}};}function respondWithFilteredResult(_0x2e96e5,_0x283db8){return function(_0x57d0fa){if(_0x57d0fa){var _0x599860=typeof _0x283db8[_0xb27c('0x1b')]==='undefined'&&typeof _0x283db8[_0xb27c('0x1c')]==='undefined';var _0x5f3219=_0x57d0fa[_0xb27c('0x1d')];var _0x91a80a=_0x599860?0x0:_0x283db8[_0xb27c('0x1b')];var _0x2a94c9=_0x599860?_0x57d0fa[_0xb27c('0x1d')]:_0x283db8[_0xb27c('0x1b')]+_0x283db8['limit'];var _0x5dd4cb;if(_0x2a94c9>=_0x5f3219){_0x2a94c9=_0x5f3219;_0x5dd4cb=0xc8;}else{_0x5dd4cb=0xce;}_0x2e96e5[_0xb27c('0x19')](_0x5dd4cb);return _0x2e96e5['set'](_0xb27c('0x1e'),_0x91a80a+'-'+_0x2a94c9+'/'+_0x5f3219)['json'](_0x57d0fa);}return null;};}function patchUpdates(_0xe0e0ae){return function(_0xfbcbd1){try{jsonpatch['apply'](_0xfbcbd1,_0xe0e0ae,!![]);}catch(_0x54e102){return BPromise[_0xb27c('0x1f')](_0x54e102);}return _0xfbcbd1[_0xb27c('0x20')]();};}function saveUpdates(_0x399314,_0xe10d10){return function(_0x5475ca){if(_0x5475ca){return _0x5475ca[_0xb27c('0x21')](_0x399314)[_0xb27c('0x22')](function(_0x519eea){return _0x519eea;});}return null;};}function removeEntity(_0x3a7ab9,_0x2593e8){return function(_0x356694){if(_0x356694){return _0x356694[_0xb27c('0x23')]()[_0xb27c('0x22')](function(){var _0x3d55b7=_0x356694[_0xb27c('0x24')]({'plain':!![]});var _0x38130d='Pauses';return db['UserProfileResource'][_0xb27c('0x23')]({'where':{'type':_0x38130d,'resourceId':_0x3d55b7['id']}})[_0xb27c('0x22')](function(){return _0x356694;});})['then'](function(){_0x3a7ab9['status'](0xcc)[_0xb27c('0x1a')]();});}};}function handleEntityNotFound(_0x5652a0,_0x453725){return function(_0x335d04){if(!_0x335d04){_0x5652a0[_0xb27c('0x18')](0x194);}return _0x335d04;};}function handleError(_0xad63eb,_0x73eee6){_0x73eee6=_0x73eee6||0x1f4;return function(_0x59b02d){logger['error'](_0x59b02d['stack']);if(_0x59b02d[_0xb27c('0x25')]){delete _0x59b02d[_0xb27c('0x25')];}_0xad63eb[_0xb27c('0x19')](_0x73eee6)[_0xb27c('0x26')](_0x59b02d);};}exports[_0xb27c('0x27')]=function(_0x2618a2,_0x1eafba){var _0x4d9c64={},_0x22898a={},_0x16f9b2={'count':0x0,'rows':[]};var _0x1c0e77=_['map'](db[_0xb27c('0x28')][_0xb27c('0x29')],function(_0x4669af){return{'name':_0x4669af[_0xb27c('0x2a')],'type':_0x4669af['type'][_0xb27c('0x2b')]};});_0x22898a[_0xb27c('0x2c')]=_['map'](_0x1c0e77,_0xb27c('0x25'));_0x22898a['query']=_['keys'](_0x2618a2['query']);_0x22898a[_0xb27c('0x2d')]=_[_0xb27c('0x2e')](_0x22898a[_0xb27c('0x2c')],_0x22898a[_0xb27c('0x2f')]);_0x4d9c64[_0xb27c('0x30')]=_[_0xb27c('0x2e')](_0x22898a[_0xb27c('0x2c')],qs[_0xb27c('0x31')](_0x2618a2['query']['fields']));_0x4d9c64[_0xb27c('0x30')]=_0x4d9c64[_0xb27c('0x30')]['length']?_0x4d9c64['attributes']:_0x22898a[_0xb27c('0x2c')];if(!_0x2618a2['query']['hasOwnProperty']('nolimit')){_0x4d9c64[_0xb27c('0x1c')]=qs[_0xb27c('0x1c')](_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x1c')]);_0x4d9c64[_0xb27c('0x1b')]=qs[_0xb27c('0x1b')](_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x1b')]);}_0x4d9c64[_0xb27c('0x32')]=qs['sort'](_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x33')]);_0x4d9c64[_0xb27c('0x34')]=qs[_0xb27c('0x2d')](_[_0xb27c('0x35')](_0x2618a2[_0xb27c('0x2f')],_0x22898a['filters']),_0x1c0e77);if(_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x36')]){_0x4d9c64['where']=_[_0xb27c('0x37')](_0x4d9c64[_0xb27c('0x34')],{'$or':_['map'](_0x1c0e77,function(_0xcaaf17){if(_0xcaaf17[_0xb27c('0x38')]!=='VIRTUAL'){var _0x1e7c9f={};_0x1e7c9f[_0xcaaf17['name']]={'$like':'%'+_0x2618a2['query'][_0xb27c('0x36')]+'%'};return _0x1e7c9f;}})});}_0x4d9c64=_[_0xb27c('0x37')]({},_0x4d9c64,_0x2618a2[_0xb27c('0x39')]);var _0x51c128={'where':_0x4d9c64[_0xb27c('0x34')]};return db[_0xb27c('0x28')][_0xb27c('0x1d')](_0x51c128)[_0xb27c('0x22')](function(_0x40f740){_0x16f9b2[_0xb27c('0x1d')]=_0x40f740;if(_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x3a')]){_0x4d9c64[_0xb27c('0x3b')]=[{'all':!![]}];}return db[_0xb27c('0x28')][_0xb27c('0x3c')](_0x4d9c64);})[_0xb27c('0x22')](function(_0x1fe373){_0x16f9b2[_0xb27c('0x3d')]=_0x1fe373;return _0x16f9b2;})[_0xb27c('0x22')](respondWithFilteredResult(_0x1eafba,_0x4d9c64))[_0xb27c('0x3e')](handleError(_0x1eafba,null));};exports[_0xb27c('0x3f')]=function(_0x2d4024,_0x2a77f0){var _0x2e49b1={'raw':!![],'where':{'id':_0x2d4024['params']['id']}},_0x39a27c={};_0x39a27c['model']=_[_0xb27c('0x40')](db[_0xb27c('0x28')]['rawAttributes']);_0x39a27c[_0xb27c('0x2f')]=_[_0xb27c('0x40')](_0x2d4024[_0xb27c('0x2f')]);_0x39a27c['filters']=_[_0xb27c('0x2e')](_0x39a27c[_0xb27c('0x2c')],_0x39a27c[_0xb27c('0x2f')]);_0x2e49b1[_0xb27c('0x30')]=_['intersection'](_0x39a27c[_0xb27c('0x2c')],qs[_0xb27c('0x31')](_0x2d4024[_0xb27c('0x2f')][_0xb27c('0x31')]));_0x2e49b1[_0xb27c('0x30')]=_0x2e49b1[_0xb27c('0x30')][_0xb27c('0x41')]?_0x2e49b1[_0xb27c('0x30')]:_0x39a27c[_0xb27c('0x2c')];if(_0x2d4024[_0xb27c('0x2f')]['includeAll']){_0x2e49b1[_0xb27c('0x3b')]=[{'all':!![]}];}_0x2e49b1=_[_0xb27c('0x37')]({},_0x2e49b1,_0x2d4024[_0xb27c('0x39')]);return db[_0xb27c('0x28')][_0xb27c('0x42')](_0x2e49b1)['then'](handleEntityNotFound(_0x2a77f0,null))[_0xb27c('0x22')](respondWithResult(_0x2a77f0,null))[_0xb27c('0x3e')](handleError(_0x2a77f0,null));};exports[_0xb27c('0x43')]=function(_0x131106,_0xf70894){return db[_0xb27c('0x28')][_0xb27c('0x43')](_0x131106[_0xb27c('0x44')],{})[_0xb27c('0x22')](function(_0x3480fa){var _0xaab730=_0x131106[_0xb27c('0x45')][_0xb27c('0x24')]({'plain':!![]});if(!_0xaab730)throw new Error(_0xb27c('0x46'));if(_0xaab730[_0xb27c('0x47')]==='user'){var _0x326dc6=_0x3480fa[_0xb27c('0x24')]({'plain':!![]});var _0x2e1e0d=_0xb27c('0x48');return db[_0xb27c('0x49')][_0xb27c('0x42')]({'where':{'name':_0x2e1e0d,'userProfileId':_0xaab730['userProfileId']},'raw':!![]})[_0xb27c('0x22')](function(_0x4b4cc1){if(_0x4b4cc1&&_0x4b4cc1[_0xb27c('0x4a')]===0x0){return db[_0xb27c('0x4b')]['create']({'name':_0x326dc6[_0xb27c('0x25')],'resourceId':_0x326dc6['id'],'type':_0x4b4cc1['name'],'sectionId':_0x4b4cc1['id']},{})[_0xb27c('0x22')](function(){return _0x3480fa;});}else{return _0x3480fa;}})[_0xb27c('0x3e')](function(_0x3df82b){logger[_0xb27c('0x4c')](_0xb27c('0x4d'),_0x3df82b);throw _0x3df82b;});}return _0x3480fa;})[_0xb27c('0x22')](respondWithResult(_0xf70894,0xc9))['catch'](handleError(_0xf70894,null));};exports[_0xb27c('0x21')]=function(_0x1c208e,_0x541fc1){if(_0x1c208e['body']['id']){delete _0x1c208e[_0xb27c('0x44')]['id'];}return db[_0xb27c('0x28')][_0xb27c('0x42')]({'where':{'id':_0x1c208e[_0xb27c('0x4e')]['id']}})[_0xb27c('0x22')](handleEntityNotFound(_0x541fc1,null))[_0xb27c('0x22')](saveUpdates(_0x1c208e[_0xb27c('0x44')],null))[_0xb27c('0x22')](respondWithResult(_0x541fc1,null))[_0xb27c('0x3e')](handleError(_0x541fc1,null));};exports[_0xb27c('0x23')]=function(_0x3155f9,_0x1f684d){return db[_0xb27c('0x28')]['find']({'where':{'id':_0x3155f9[_0xb27c('0x4e')]['id']}})[_0xb27c('0x22')](handleEntityNotFound(_0x1f684d,null))[_0xb27c('0x22')](removeEntity(_0x1f684d,null))[_0xb27c('0x3e')](handleError(_0x1f684d,null));}; \ No newline at end of file +var _0x9cdc=['zip-dir','fast-json-patch','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Pause','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x9cdc,0xef));var _0xc9cd=function(_0x111c98,_0x5641a7){_0x111c98=_0x111c98-0x0;var _0x19c401=_0x9cdc[_0x111c98];return _0x19c401;};'use strict';var emlformat=require(_0xc9cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9cd('0x1'));var jsonpatch=require(_0xc9cd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc9cd('0x3'));var path=require(_0xc9cd('0x4'));var sox=require('sox');var csv=require(_0xc9cd('0x5'));var ejs=require(_0xc9cd('0x6'));var fs=require('fs');var fs_extra=require(_0xc9cd('0x7'));var _=require(_0xc9cd('0x8'));var squel=require(_0xc9cd('0x9'));var crypto=require('crypto');var jsforce=require(_0xc9cd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc9cd('0x5'));var querystring=require('querystring');var Papa=require(_0xc9cd('0xb'));var Redis=require(_0xc9cd('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc9cd('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9cd('0xe'));var logger=require('../../config/logger')(_0xc9cd('0xf'));var utils=require(_0xc9cd('0x10'));var config=require(_0xc9cd('0x11'));var licenseUtil=require(_0xc9cd('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35bf3c,_0x300b05){_0x300b05=_0x300b05||0xcc;return function(_0x87a857){if(_0x87a857){return _0x35bf3c[_0xc9cd('0x13')](_0x300b05);}return _0x35bf3c[_0xc9cd('0x14')](_0x300b05)[_0xc9cd('0x15')]();};}function respondWithResult(_0x1c0d78,_0x51b435){_0x51b435=_0x51b435||0xc8;return function(_0x5b3ee5){if(_0x5b3ee5){return _0x1c0d78[_0xc9cd('0x14')](_0x51b435)[_0xc9cd('0x16')](_0x5b3ee5);}};}function respondWithFilteredResult(_0x4a5697,_0x2a9803){return function(_0x49148f){if(_0x49148f){var _0x1c767d=typeof _0x2a9803[_0xc9cd('0x17')]===_0xc9cd('0x18')&&typeof _0x2a9803[_0xc9cd('0x19')]===_0xc9cd('0x18');var _0x350c3e=_0x49148f['count'];var _0x17774b=_0x1c767d?0x0:_0x2a9803['offset'];var _0xfb8df4=_0x1c767d?_0x49148f[_0xc9cd('0x1a')]:_0x2a9803[_0xc9cd('0x17')]+_0x2a9803[_0xc9cd('0x19')];var _0x5301e3;if(_0xfb8df4>=_0x350c3e){_0xfb8df4=_0x350c3e;_0x5301e3=0xc8;}else{_0x5301e3=0xce;}_0x4a5697[_0xc9cd('0x14')](_0x5301e3);return _0x4a5697[_0xc9cd('0x1b')](_0xc9cd('0x1c'),_0x17774b+'-'+_0xfb8df4+'/'+_0x350c3e)[_0xc9cd('0x16')](_0x49148f);}return null;};}function patchUpdates(_0x209b0a){return function(_0x49f6fa){try{jsonpatch[_0xc9cd('0x1d')](_0x49f6fa,_0x209b0a,!![]);}catch(_0x22e747){return BPromise[_0xc9cd('0x1e')](_0x22e747);}return _0x49f6fa[_0xc9cd('0x1f')]();};}function saveUpdates(_0x5778e3,_0x11e7e8){return function(_0x1ed11){if(_0x1ed11){return _0x1ed11[_0xc9cd('0x20')](_0x5778e3)[_0xc9cd('0x21')](function(_0x3570b3){return _0x3570b3;});}return null;};}function removeEntity(_0x34feda,_0x2656e0){return function(_0x42f682){if(_0x42f682){return _0x42f682[_0xc9cd('0x22')]()[_0xc9cd('0x21')](function(){var _0x20e2b0=_0x42f682[_0xc9cd('0x23')]({'plain':!![]});var _0xb00d16='Pauses';return db[_0xc9cd('0x24')]['destroy']({'where':{'type':_0xb00d16,'resourceId':_0x20e2b0['id']}})[_0xc9cd('0x21')](function(){return _0x42f682;});})[_0xc9cd('0x21')](function(){_0x34feda['status'](0xcc)[_0xc9cd('0x15')]();});}};}function handleEntityNotFound(_0x549a1a,_0x4f9a17){return function(_0x223bb1){if(!_0x223bb1){_0x549a1a[_0xc9cd('0x13')](0x194);}return _0x223bb1;};}function handleError(_0x326074,_0x5930b4){_0x5930b4=_0x5930b4||0x1f4;return function(_0x34ed87){logger[_0xc9cd('0x25')](_0x34ed87[_0xc9cd('0x26')]);if(_0x34ed87[_0xc9cd('0x27')]){delete _0x34ed87[_0xc9cd('0x27')];}_0x326074[_0xc9cd('0x14')](_0x5930b4)['send'](_0x34ed87);};}exports[_0xc9cd('0x28')]=function(_0x362da5,_0xb61a84){var _0xb3edea={},_0x20a944={},_0x566b2d={'count':0x0,'rows':[]};var _0x46a8f7=_[_0xc9cd('0x29')](db[_0xc9cd('0x2a')][_0xc9cd('0x2b')],function(_0x4d1584){return{'name':_0x4d1584['fieldName'],'type':_0x4d1584[_0xc9cd('0x2c')][_0xc9cd('0x2d')]};});_0x20a944[_0xc9cd('0x2e')]=_[_0xc9cd('0x29')](_0x46a8f7,_0xc9cd('0x27'));_0x20a944[_0xc9cd('0x2f')]=_[_0xc9cd('0x30')](_0x362da5[_0xc9cd('0x2f')]);_0x20a944[_0xc9cd('0x31')]=_['intersection'](_0x20a944[_0xc9cd('0x2e')],_0x20a944[_0xc9cd('0x2f')]);_0xb3edea[_0xc9cd('0x32')]=_[_0xc9cd('0x33')](_0x20a944[_0xc9cd('0x2e')],qs[_0xc9cd('0x34')](_0x362da5[_0xc9cd('0x2f')][_0xc9cd('0x34')]));_0xb3edea[_0xc9cd('0x32')]=_0xb3edea[_0xc9cd('0x32')]['length']?_0xb3edea[_0xc9cd('0x32')]:_0x20a944[_0xc9cd('0x2e')];if(!_0x362da5[_0xc9cd('0x2f')][_0xc9cd('0x35')](_0xc9cd('0x36'))){_0xb3edea['limit']=qs[_0xc9cd('0x19')](_0x362da5[_0xc9cd('0x2f')]['limit']);_0xb3edea['offset']=qs[_0xc9cd('0x17')](_0x362da5[_0xc9cd('0x2f')][_0xc9cd('0x17')]);}_0xb3edea[_0xc9cd('0x37')]=qs[_0xc9cd('0x38')](_0x362da5[_0xc9cd('0x2f')][_0xc9cd('0x38')]);_0xb3edea['where']=qs[_0xc9cd('0x31')](_[_0xc9cd('0x39')](_0x362da5[_0xc9cd('0x2f')],_0x20a944[_0xc9cd('0x31')]),_0x46a8f7);if(_0x362da5[_0xc9cd('0x2f')][_0xc9cd('0x3a')]){_0xb3edea['where']=_[_0xc9cd('0x3b')](_0xb3edea[_0xc9cd('0x3c')],{'$or':_[_0xc9cd('0x29')](_0x46a8f7,function(_0x5734b0){if(_0x5734b0[_0xc9cd('0x2c')]!==_0xc9cd('0x3d')){var _0xbc1eca={};_0xbc1eca[_0x5734b0[_0xc9cd('0x27')]]={'$like':'%'+_0x362da5[_0xc9cd('0x2f')]['filter']+'%'};return _0xbc1eca;}})});}_0xb3edea=_['merge']({},_0xb3edea,_0x362da5['options']);var _0x53651f={'where':_0xb3edea[_0xc9cd('0x3c')]};return db[_0xc9cd('0x2a')]['count'](_0x53651f)[_0xc9cd('0x21')](function(_0x35574d){_0x566b2d['count']=_0x35574d;if(_0x362da5['query']['includeAll']){_0xb3edea[_0xc9cd('0x3e')]=[{'all':!![]}];}return db[_0xc9cd('0x2a')][_0xc9cd('0x3f')](_0xb3edea);})[_0xc9cd('0x21')](function(_0x589707){_0x566b2d[_0xc9cd('0x40')]=_0x589707;return _0x566b2d;})[_0xc9cd('0x21')](respondWithFilteredResult(_0xb61a84,_0xb3edea))[_0xc9cd('0x41')](handleError(_0xb61a84,null));};exports[_0xc9cd('0x42')]=function(_0xd6b0ba,_0x1c7249){var _0x1f579b={'raw':!![],'where':{'id':_0xd6b0ba[_0xc9cd('0x43')]['id']}},_0x2b0f7d={};_0x2b0f7d[_0xc9cd('0x2e')]=_[_0xc9cd('0x30')](db['Pause']['rawAttributes']);_0x2b0f7d[_0xc9cd('0x2f')]=_[_0xc9cd('0x30')](_0xd6b0ba[_0xc9cd('0x2f')]);_0x2b0f7d[_0xc9cd('0x31')]=_[_0xc9cd('0x33')](_0x2b0f7d[_0xc9cd('0x2e')],_0x2b0f7d[_0xc9cd('0x2f')]);_0x1f579b['attributes']=_[_0xc9cd('0x33')](_0x2b0f7d[_0xc9cd('0x2e')],qs[_0xc9cd('0x34')](_0xd6b0ba[_0xc9cd('0x2f')]['fields']));_0x1f579b[_0xc9cd('0x32')]=_0x1f579b['attributes'][_0xc9cd('0x44')]?_0x1f579b[_0xc9cd('0x32')]:_0x2b0f7d[_0xc9cd('0x2e')];if(_0xd6b0ba['query']['includeAll']){_0x1f579b[_0xc9cd('0x3e')]=[{'all':!![]}];}_0x1f579b=_[_0xc9cd('0x3b')]({},_0x1f579b,_0xd6b0ba[_0xc9cd('0x45')]);return db[_0xc9cd('0x2a')][_0xc9cd('0x46')](_0x1f579b)[_0xc9cd('0x21')](handleEntityNotFound(_0x1c7249,null))['then'](respondWithResult(_0x1c7249,null))[_0xc9cd('0x41')](handleError(_0x1c7249,null));};exports[_0xc9cd('0x47')]=function(_0x28f361,_0x2e5285){return db[_0xc9cd('0x2a')][_0xc9cd('0x47')](_0x28f361[_0xc9cd('0x48')],{})['then'](function(_0x1d76b5){var _0x3fcdae=_0x28f361[_0xc9cd('0x49')]['get']({'plain':!![]});if(!_0x3fcdae)throw new Error(_0xc9cd('0x4a'));if(_0x3fcdae[_0xc9cd('0x4b')]===_0xc9cd('0x49')){var _0x30e679=_0x1d76b5['get']({'plain':!![]});var _0x5aebf3=_0xc9cd('0x4c');return db[_0xc9cd('0x4d')][_0xc9cd('0x46')]({'where':{'name':_0x5aebf3,'userProfileId':_0x3fcdae[_0xc9cd('0x4e')]},'raw':!![]})[_0xc9cd('0x21')](function(_0x13432f){if(_0x13432f&&_0x13432f['autoAssociation']===0x0){return db[_0xc9cd('0x24')][_0xc9cd('0x47')]({'name':_0x30e679[_0xc9cd('0x27')],'resourceId':_0x30e679['id'],'type':_0x13432f[_0xc9cd('0x27')],'sectionId':_0x13432f['id']},{})['then'](function(){return _0x1d76b5;});}else{return _0x1d76b5;}})[_0xc9cd('0x41')](function(_0x320ce3){logger['error'](_0xc9cd('0x4f'),_0x320ce3);throw _0x320ce3;});}return _0x1d76b5;})[_0xc9cd('0x21')](respondWithResult(_0x2e5285,0xc9))[_0xc9cd('0x41')](handleError(_0x2e5285,null));};exports['update']=function(_0x5bfbf9,_0x4794be){if(_0x5bfbf9[_0xc9cd('0x48')]['id']){delete _0x5bfbf9[_0xc9cd('0x48')]['id'];}return db[_0xc9cd('0x2a')]['find']({'where':{'id':_0x5bfbf9[_0xc9cd('0x43')]['id']}})[_0xc9cd('0x21')](handleEntityNotFound(_0x4794be,null))['then'](saveUpdates(_0x5bfbf9['body'],null))[_0xc9cd('0x21')](respondWithResult(_0x4794be,null))['catch'](handleError(_0x4794be,null));};exports[_0xc9cd('0x22')]=function(_0x3d96a3,_0x2f4520){return db['Pause'][_0xc9cd('0x46')]({'where':{'id':_0x3d96a3['params']['id']}})['then'](handleEntityNotFound(_0x2f4520,null))[_0xc9cd('0x21')](removeEntity(_0x2f4520,null))['catch'](handleError(_0x2f4520,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7979972..e7d4b2a 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x23efe8,_0x69b604){_0x23efe8=_0x23efe8-0x0;var _0x394b38=_0x6aa7[_0x23efe8];return _0x394b38;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 3ff278e..a78dddf 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(_0x2ec2f7,_0x399e63){var _0x5a52d5=function(_0x525dfb){while(--_0x525dfb){_0x2ec2f7['push'](_0x2ec2f7['shift']());}};_0x5a52d5(++_0x399e63);}(_0x7a54,0x106));var _0x47a5=function(_0x147e8e,_0x12b71d){_0x147e8e=_0x147e8e-0x0;var _0x52742c=_0x7a54[_0x147e8e];return _0x52742c;};'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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x51f677,_0x364a87){var _0x1c6515=function(_0x2e0149){while(--_0x2e0149){_0x51f677['push'](_0x51f677['shift']());}};_0x1c6515(++_0x364a87);}(_0xb10b,0x12a));var _0xbb10=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0xb10b[_0x53056c];return _0x5cec88;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 03952df..07fbc05 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 _0xc874=['originalname','extname','now','post','single','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','format','%s-%s%s','basename'];(function(_0xb7ff96,_0x25837a){var _0x205e45=function(_0x4856d1){while(--_0x4856d1){_0xb7ff96['push'](_0xb7ff96['shift']());}};_0x205e45(++_0x25837a);}(_0xc874,0x154));var _0x4c87=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xc874[_0x1c510a];return _0x23cedd;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),controller[_0x4c87('0xa')]);router[_0x4c87('0x7')]('/:id',auth[_0x4c87('0xb')](),controller['show']);router[_0x4c87('0x7')](_0x4c87('0xc'),auth[_0x4c87('0xb')](),controller[_0x4c87('0xd')]);var upload=multer({'storage':multer[_0x4c87('0xe')]({'destination':function(_0x548e1a,_0x1fcc99,_0x2b82cb){_0x2b82cb(null,path['join'](config[_0x4c87('0xf')],_0x4c87('0x10')));},'filename':function(_0x1e0530,_0x3b01bb,_0x3a2aa2){_0x3b01bb['originalname']=_0x3b01bb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a2aa2(null,util[_0x4c87('0x11')](_0x4c87('0x12'),path[_0x4c87('0x13')](_0x3b01bb[_0x4c87('0x14')],path[_0x4c87('0x15')](_0x3b01bb[_0x4c87('0x14')])),Date[_0x4c87('0x16')](),path[_0x4c87('0x15')](_0x3b01bb['originalname'])));}})});router[_0x4c87('0x17')]('/',upload[_0x4c87('0x18')]('file'),controller['upload']);router[_0x4c87('0x17')](_0x4c87('0x9'),controller[_0x4c87('0x19')]);router['put'](_0x4c87('0x1a'),auth['isAuthenticated'](),controller[_0x4c87('0x1b')]);router[_0x4c87('0x1c')](_0x4c87('0x1a'),auth[_0x4c87('0xb')](),controller['delete']);module[_0x4c87('0x1d')]=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(_0x1e9992,_0x24a7db){var _0x4204e2=function(_0x43b540){while(--_0x43b540){_0x1e9992['push'](_0x1e9992['shift']());}};_0x4204e2(++_0x24a7db);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x5ac44a,_0x53b933){_0x5ac44a=_0x5ac44a-0x0;var _0x17db5c=_0xc3b5[_0x5ac44a];return _0x17db5c;};'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 012e7ae..60e58c5 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 _0x1c9e=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x437aa2,_0x48d508){var _0x28ac4d=function(_0x4afc37){while(--_0x4afc37){_0x437aa2['push'](_0x437aa2['shift']());}};_0x28ac4d(++_0x48d508);}(_0x1c9e,0xd5));var _0xe1c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe1c9('0x0')]={'name':{'type':Sequelize[_0xe1c9('0x1')]},'type':{'type':Sequelize[_0xe1c9('0x2')](_0xe1c9('0x3'),_0xe1c9('0x4'))},'description':{'type':Sequelize[_0xe1c9('0x5')]},'version':{'type':Sequelize[_0xe1c9('0x5')]},'path':{'type':Sequelize[_0xe1c9('0x1')],'comment':_0xe1c9('0x6')},'active':{'type':Sequelize[_0xe1c9('0x7')],'defaultValue':0x0,'comment':_0xe1c9('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xe1c9('0x9'),_0xe1c9('0xa'),_0xe1c9('0xb')),'defaultValue':'always','comment':_0xe1c9('0xc')},'icon':{'type':Sequelize[_0xe1c9('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe1c9('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6aaa=['adminOnly','agentOnly','never','exports','ENUM','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x6aaa,0x147));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xa6aa('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa6aa('0x1')]('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xa6aa('0x2')]},'path':{'type':Sequelize[_0xa6aa('0x3')],'comment':_0xa6aa('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa6aa('0x5')},'sidebar':{'type':Sequelize[_0xa6aa('0x1')](_0xa6aa('0x6'),_0xa6aa('0x7'),'always',_0xa6aa('0x8')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xa6aa('0x3')]},'agentUrl':{'type':Sequelize[_0xa6aa('0x3')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xa6aa('0x3')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4f6097a..35db0ce 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 _0x815c=['stack','name','send','map','Plugin','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Plugins','UserProfileResource','then','error'];(function(_0x3f15af,_0x1b4091){var _0x47dfa8=function(_0x1a0cec){while(--_0x1a0cec){_0x3f15af['push'](_0x3f15af['shift']());}};_0x47dfa8(++_0x1b4091);}(_0x815c,0x1cb));var _0xc815=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0x815c[_0x3def1b];return _0x57340e;};'use strict';var emlformat=require(_0xc815('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc815('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc815('0x2'));var moment=require(_0xc815('0x3'));var BPromise=require(_0xc815('0x4'));var Mustache=require(_0xc815('0x5'));var util=require(_0xc815('0x6'));var path=require(_0xc815('0x7'));var sox=require(_0xc815('0x8'));var csv=require(_0xc815('0x9'));var ejs=require(_0xc815('0xa'));var fs=require('fs');var fs_extra=require(_0xc815('0xb'));var _=require(_0xc815('0xc'));var squel=require(_0xc815('0xd'));var crypto=require(_0xc815('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc815('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc815('0x10'));var extract=require(_0xc815('0x11'));var rimraf=require(_0xc815('0x12'));var archiver=require(_0xc815('0x13'));var Redis=require(_0xc815('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc815('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc815('0x16'));var logger=require(_0xc815('0x17'))(_0xc815('0x18'));var utils=require(_0xc815('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc815('0x1a'));var db=require(_0xc815('0x1b'))['db'];config[_0xc815('0x1c')]=_[_0xc815('0x1d')](config[_0xc815('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc815('0x1e'))(new Redis(config[_0xc815('0x1c')]));require(_0xc815('0x1f'))['register'](socket);function respondWithStatusCode(_0x9d49,_0xa5611e){_0xa5611e=_0xa5611e||0xcc;return function(_0x369cfa){if(_0x369cfa){return _0x9d49[_0xc815('0x20')](_0xa5611e);}return _0x9d49[_0xc815('0x21')](_0xa5611e)[_0xc815('0x22')]();};}function respondWithResult(_0x48e1b0,_0x7f1e24){_0x7f1e24=_0x7f1e24||0xc8;return function(_0x5c9e8c){if(_0x5c9e8c){return _0x48e1b0['status'](_0x7f1e24)[_0xc815('0x23')](_0x5c9e8c);}};}function respondWithFilteredResult(_0x336f65,_0x2924b3){return function(_0x421c02){if(_0x421c02){var _0x36e45e=typeof _0x2924b3[_0xc815('0x24')]==='undefined'&&typeof _0x2924b3[_0xc815('0x25')]==='undefined';var _0x138263=_0x421c02[_0xc815('0x26')];var _0x16c784=_0x36e45e?0x0:_0x2924b3['offset'];var _0x115afd=_0x36e45e?_0x421c02['count']:_0x2924b3[_0xc815('0x24')]+_0x2924b3[_0xc815('0x25')];var _0x55216d;if(_0x115afd>=_0x138263){_0x115afd=_0x138263;_0x55216d=0xc8;}else{_0x55216d=0xce;}_0x336f65['status'](_0x55216d);return _0x336f65[_0xc815('0x27')](_0xc815('0x28'),_0x16c784+'-'+_0x115afd+'/'+_0x138263)[_0xc815('0x23')](_0x421c02);}return null;};}function patchUpdates(_0x2c7ef9){return function(_0x32e39a){try{jsonpatch[_0xc815('0x29')](_0x32e39a,_0x2c7ef9,!![]);}catch(_0x3373bc){return BPromise[_0xc815('0x2a')](_0x3373bc);}return _0x32e39a[_0xc815('0x2b')]();};}function saveUpdates(_0x1ef4da,_0x17e9f8){return function(_0x3ed41e){if(_0x3ed41e){return _0x3ed41e[_0xc815('0x2c')](_0x1ef4da)['then'](function(_0x4b9f70){return _0x4b9f70;});}return null;};}function removeEntity(_0x375852,_0x6dbfda){return function(_0x30e580){if(_0x30e580){return _0x30e580[_0xc815('0x2d')]()['then'](function(){var _0x285eaa=_0x30e580[_0xc815('0x2e')]({'plain':!![]});var _0x4c9e73=_0xc815('0x2f');return db[_0xc815('0x30')][_0xc815('0x2d')]({'where':{'type':_0x4c9e73,'resourceId':_0x285eaa['id']}})['then'](function(){return _0x30e580;});})[_0xc815('0x31')](function(){_0x375852[_0xc815('0x21')](0xcc)[_0xc815('0x22')]();});}};}function handleEntityNotFound(_0x5833d5,_0x5a2434){return function(_0x58f150){if(!_0x58f150){_0x5833d5[_0xc815('0x20')](0x194);}return _0x58f150;};}function handleError(_0x3b6204,_0x31d909){_0x31d909=_0x31d909||0x1f4;return function(_0x3f52af){logger[_0xc815('0x32')](_0x3f52af[_0xc815('0x33')]);if(_0x3f52af[_0xc815('0x34')]){delete _0x3f52af[_0xc815('0x34')];}_0x3b6204[_0xc815('0x21')](_0x31d909)[_0xc815('0x35')](_0x3f52af);};}exports['index']=function(_0x1896f2,_0x24d997){var _0x2533c8={},_0x3276de={},_0x5ab52d={'count':0x0,'rows':[]};var _0xfd0867=_[_0xc815('0x36')](db[_0xc815('0x37')][_0xc815('0x38')],function(_0x3455b7){return{'name':_0x3455b7[_0xc815('0x39')],'type':_0x3455b7[_0xc815('0x3a')]['key']};});_0x3276de[_0xc815('0x3b')]=_[_0xc815('0x36')](_0xfd0867,_0xc815('0x34'));_0x3276de['query']=_[_0xc815('0x3c')](_0x1896f2[_0xc815('0x3d')]);_0x3276de[_0xc815('0x3e')]=_[_0xc815('0x3f')](_0x3276de[_0xc815('0x3b')],_0x3276de[_0xc815('0x3d')]);_0x2533c8[_0xc815('0x40')]=_[_0xc815('0x3f')](_0x3276de[_0xc815('0x3b')],qs['fields'](_0x1896f2[_0xc815('0x3d')][_0xc815('0x41')]));_0x2533c8[_0xc815('0x40')]=_0x2533c8['attributes'][_0xc815('0x42')]?_0x2533c8[_0xc815('0x40')]:_0x3276de[_0xc815('0x3b')];if(!_0x1896f2[_0xc815('0x3d')][_0xc815('0x43')]('nolimit')){_0x2533c8[_0xc815('0x25')]=qs['limit'](_0x1896f2[_0xc815('0x3d')]['limit']);_0x2533c8[_0xc815('0x24')]=qs[_0xc815('0x24')](_0x1896f2['query'][_0xc815('0x24')]);}_0x2533c8['order']=qs['sort'](_0x1896f2[_0xc815('0x3d')][_0xc815('0x44')]);_0x2533c8['where']=qs['filters'](_[_0xc815('0x45')](_0x1896f2[_0xc815('0x3d')],_0x3276de[_0xc815('0x3e')]),_0xfd0867);if(_0x1896f2[_0xc815('0x3d')][_0xc815('0x46')]){_0x2533c8[_0xc815('0x47')]=_[_0xc815('0x48')](_0x2533c8['where'],{'$or':_[_0xc815('0x36')](_0xfd0867,function(_0x5bf40a){if(_0x5bf40a['type']!==_0xc815('0x49')){var _0x5cc145={};_0x5cc145[_0x5bf40a[_0xc815('0x34')]]={'$like':'%'+_0x1896f2[_0xc815('0x3d')]['filter']+'%'};return _0x5cc145;}})});}_0x2533c8=_[_0xc815('0x48')]({},_0x2533c8,_0x1896f2['options']);var _0x3f4f6a={'where':_0x2533c8['where']};return db[_0xc815('0x37')][_0xc815('0x26')](_0x3f4f6a)[_0xc815('0x31')](function(_0x482004){_0x5ab52d[_0xc815('0x26')]=_0x482004;if(_0x1896f2['query'][_0xc815('0x4a')]){_0x2533c8[_0xc815('0x4b')]=[{'all':!![]}];}return db[_0xc815('0x37')]['findAll'](_0x2533c8);})['then'](function(_0x546a3c){_0x5ab52d[_0xc815('0x4c')]=_0x546a3c;return _0x5ab52d;})[_0xc815('0x31')](respondWithFilteredResult(_0x24d997,_0x2533c8))[_0xc815('0x4d')](handleError(_0x24d997,null));};exports[_0xc815('0x4e')]=function(_0x33471d,_0x1c7837){var _0x1dc9e7={'raw':!![],'where':{'id':_0x33471d[_0xc815('0x4f')]['id']}},_0x3013da={};_0x3013da[_0xc815('0x3b')]=_[_0xc815('0x3c')](db[_0xc815('0x37')][_0xc815('0x38')]);_0x3013da[_0xc815('0x3d')]=_[_0xc815('0x3c')](_0x33471d[_0xc815('0x3d')]);_0x3013da[_0xc815('0x3e')]=_['intersection'](_0x3013da['model'],_0x3013da[_0xc815('0x3d')]);_0x1dc9e7[_0xc815('0x40')]=_['intersection'](_0x3013da[_0xc815('0x3b')],qs['fields'](_0x33471d[_0xc815('0x3d')][_0xc815('0x41')]));_0x1dc9e7[_0xc815('0x40')]=_0x1dc9e7['attributes'][_0xc815('0x42')]?_0x1dc9e7[_0xc815('0x40')]:_0x3013da[_0xc815('0x3b')];if(_0x33471d[_0xc815('0x3d')][_0xc815('0x4a')]){_0x1dc9e7[_0xc815('0x4b')]=[{'all':!![]}];}_0x1dc9e7=_[_0xc815('0x48')]({},_0x1dc9e7,_0x33471d['options']);return db['Plugin'][_0xc815('0x50')](_0x1dc9e7)[_0xc815('0x31')](handleEntityNotFound(_0x1c7837,null))['then'](respondWithResult(_0x1c7837,null))['catch'](handleError(_0x1c7837,null));};exports[_0xc815('0x51')]=function(_0x268fd8,_0x309c68,_0x3770f8){return db[_0xc815('0x37')][_0xc815('0x50')]({'where':{'id':_0x268fd8['params']['id']},'attributes':[_0xc815('0x34'),_0xc815('0x7')],'raw':!![]})[_0xc815('0x31')](handleEntityNotFound(_0x309c68,null))[_0xc815('0x31')](function(_0x51813f){if(_0x51813f){var _0x5e2d32=path[_0xc815('0x52')](config[_0xc815('0x53')],_0xc815('0x54'),util[_0xc815('0x55')](_0xc815('0x56'),path['basename'](_0x51813f[_0xc815('0x7')])));var _0x20865e=fs[_0xc815('0x57')](_0x5e2d32);var _0xadf931=archiver(_0xc815('0x58'),{'zlib':{'level':0x9}});_0xadf931['on'](_0xc815('0x59'),function(_0x3a9a78){if(_0x3a9a78['code']==='ENOENT'){logger['error'](_0x3a9a78);}else{throw new db[(_0xc815('0x5a'))][(_0xc815('0x5b'))](_0xc815('0x5c'));}});_0xadf931['on']('error',function(_0x410bd9){throw new db[(_0xc815('0x5a'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xadf931[_0xc815('0x5d')](_0x20865e);_0xadf931['glob']('**/*',{'cwd':path[_0xc815('0x52')](config['root'],'server/files/plugins',path[_0xc815('0x5e')](_0x51813f[_0xc815('0x7')])),'ignore':[path[_0xc815('0x52')](path[_0xc815('0x5f')](_0x51813f[_0xc815('0x7')]),_0xc815('0x60')),path[_0xc815('0x52')](path[_0xc815('0x5f')](_0x51813f[_0xc815('0x7')]),_0xc815('0x61'))],'nodir':!![]})[_0xc815('0x62')]();_0x20865e['on']('close',function(){if(!fs[_0xc815('0x63')](_0x5e2d32)){throw new db['Sequelize'][(_0xc815('0x5b'))]('Plugin\x20not\x20found');}return _0x309c68[_0xc815('0x51')](_0x5e2d32,util['format'](_0xc815('0x56'),path['basename'](_0x51813f['path'])),function(_0x29c118){if(_0x29c118){throw new db[(_0xc815('0x5a'))][(_0xc815('0x5b'))](_0xc815('0x64'));}fs[_0xc815('0x65')](_0x5e2d32);logger[_0xc815('0x66')](_0xc815('0x67'));logger['info'](_0xc815('0x68'));});});}return null;})[_0xc815('0x4d')](handleError(_0x309c68,null));};exports[_0xc815('0x69')]=function(_0x342cba,_0x24c166,_0x32c50c){var _0x1c64df=path[_0xc815('0x5f')](_0x342cba[_0xc815('0x6a')][_0xc815('0x6b')],path['extname'](_0x342cba[_0xc815('0x6a')][_0xc815('0x6b')]));var _0xaad695=path['join'](config[_0xc815('0x53')],'server/files/plugins',_0x342cba['file'][_0xc815('0x6b')]);var _0xcd922b=path[_0xc815('0x52')](config[_0xc815('0x53')],_0xc815('0x54'),_0x1c64df);logger['info'](_0xc815('0x6c'),_0xaad695);logger[_0xc815('0x66')]('Plugin\x20upload\x20destination:\x20%s',_0xcd922b);try{fs[_0xc815('0x6d')](_0xaad695,parseInt(_0xc815('0x6e'),0x8));extract(_0xaad695,{'dir':_0xcd922b},function(_0x459e53){if(_0x459e53){logger[_0xc815('0x32')](_0x459e53);handleError(_0x459e53,!![]);};var _0x5753f6=fs[_0xc815('0x6f')](_0xcd922b);if(_0x5753f6[_0xc815('0x42')]>0x1){removeReferences(_0xaad695,_0xcd922b);logger[_0xc815('0x32')](_0xc815('0x70'));return _0x32c50c(new Error(_0xc815('0x70')));}var _0x1ba90f=fs[_0xc815('0x71')](path[_0xc815('0x52')](_0xcd922b,_0x5753f6[0x0]));if(_0x1ba90f[_0xc815('0x72')]()){removeReferences(_0xaad695,_0xcd922b);logger[_0xc815('0x32')](_0xc815('0x70'));return _0x32c50c(new Error(_0xc815('0x70')));}if(_0x1ba90f[_0xc815('0x73')]()){var _0x3a67b0=fs[_0xc815('0x6f')](path['join'](_0xcd922b,_0x5753f6[0x0]));if(_0x3a67b0[_0xc815('0x42')]===0x0){removeReferences(_0xaad695,_0xcd922b);logger['error']('Invalid\x20plugin\x20structure');return _0x32c50c(new Error(_0xc815('0x70')));}var _0x3694d5=_0x3a67b0[_0xc815('0x74')](function(_0x167277){return _0x167277===_0xc815('0x75');});if(!_0x3694d5){return _0x32c50c(new Error('Plugin\x20manifest\x20missing'));}var _0x404843=fs['readFileSync'](path[_0xc815('0x52')](_0xcd922b,_0x5753f6[0x0],_0xc815('0x75')));var _0x51795b=JSON[_0xc815('0x76')](_0x404843);if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x34')]){return _0x32c50c(new Error(_0xc815('0x78')));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x3a')]){return _0x32c50c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x79')]){return _0x32c50c(new Error(_0xc815('0x7a')));}if('undefined'==typeof _0x51795b[_0xc815('0x7b')]){return _0x32c50c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x51795b[_0xc815('0x3a')]==='html'){if(_0xc815('0x77')==typeof _0x51795b['parameters'][_0xc815('0x7c')]){return _0x32c50c(new Error(_0xc815('0x7d')));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')]['views'][_0xc815('0x7e')]&&_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')]){return _0x32c50c(new Error(_0xc815('0x80')));}}else if(_0x51795b[_0xc815('0x3a')]===_0xc815('0x81')){if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x82')]){return _0x32c50c(new Error(_0xc815('0x83')));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x84')]){return _0x32c50c(new Error(_0xc815('0x85')));}}else{return _0x32c50c(new Error(_0xc815('0x86')));}var _0x55236a=_0x51795b['name'];var _0x2c55d4=_0x51795b[_0xc815('0x87')];var _0x9c5c82=_0x51795b[_0xc815('0x3a')];var _0x2e9d0b=_0x51795b[_0xc815('0x88')]?_0x51795b[_0xc815('0x88')]:_0xc815('0x89');var _0x11d4d6=_0x51795b[_0xc815('0x8a')]?_0x51795b[_0xc815('0x8a')]:_0xc815('0x8b');var _0x16b3d4='';var _0x417a81='';var _0x3225bd='';var _0x23f028='';var _0x29b1d7=_0x51795b[_0xc815('0x79')];if(_0x9c5c82==='html'){if('undefined'!=typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7e')]){var _0x15e46f=_0x51795b[_0xc815('0x7b')][_0xc815('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x15e46f)){_0x16b3d4=path[_0xc815('0x52')]('plugins',_0x1c64df,_0x5753f6[0x0],_0x15e46f);}else{_0x16b3d4=_0x15e46f;}}else{logger[_0xc815('0x66')](_0xc815('0x8c'));}if(_0xc815('0x77')!=typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')]){var _0x469697=_0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc815('0x8d')](_0x469697)){_0x417a81=path[_0xc815('0x52')](_0xc815('0x8e'),_0x1c64df,_0x5753f6[0x0],_0x469697);}else{_0x417a81=_0x469697;}}else{logger[_0xc815('0x66')](_0xc815('0x8f'));}}else if(_0x9c5c82===_0xc815('0x81')){_0x3225bd=_0x51795b[_0xc815('0x7b')][_0xc815('0x82')];_0x23f028=_0x51795b['parameters']['scriptPath'];if('undefined'!=typeof _0x51795b[_0xc815('0x7b')]['views']){if(_0xc815('0x77')!=typeof _0x51795b[_0xc815('0x7b')]['views']['admin']){var _0x15e46f=_0x51795b[_0xc815('0x7b')][_0xc815('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x15e46f)){_0x16b3d4=path[_0xc815('0x52')](_0xc815('0x8e'),_0x1c64df,_0x5753f6[0x0],_0x15e46f);}else{_0x16b3d4=_0x15e46f;}}if(_0xc815('0x77')!=typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')]){var _0x469697=_0x51795b['parameters'][_0xc815('0x7c')][_0xc815('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc815('0x8d')](_0x469697)){_0x417a81=path[_0xc815('0x52')]('plugins',_0x1c64df,_0x5753f6[0x0],_0x469697);}else{_0x417a81=_0x469697;}}}}var _0x5a5f6b={'name':_0x55236a,'description':_0x2c55d4,'path':path[_0xc815('0x52')](_0x1c64df,_0x5753f6[0x0]),'type':_0x9c5c82,'sidebar':_0x2e9d0b,'icon':_0x11d4d6,'adminUrl':_0x16b3d4,'agentUrl':_0x417a81,'scriptName':_0x3225bd,'scriptPath':_0x23f028,'version':_0x29b1d7};removeReferences(_0xaad695,null);return db['Plugin'][_0xc815('0x90')](_0x5a5f6b)[_0xc815('0x31')](function(_0x39dbca){var _0x465421={'role':_0x342cba[_0xc815('0x91')][_0xc815('0x92')],'userProfileId':_0x342cba['body']['userProfileId']};if(!_0x465421)throw new Error(_0xc815('0x93'));if(_0x465421[_0xc815('0x92')]===_0xc815('0x94')){var _0x47239a=_0x39dbca['get']({'plain':!![]});return db[_0xc815('0x95')]['find']({'where':{'name':_0xc815('0x2f'),'userProfileId':_0x465421[_0xc815('0x96')]},'raw':!![]})[_0xc815('0x31')](function(_0x30f381){if(_0x30f381&&_0x30f381[_0xc815('0x97')]===0x0){return db[_0xc815('0x30')]['create']({'name':_0x47239a[_0xc815('0x34')],'resourceId':_0x47239a['id'],'type':_0x30f381[_0xc815('0x34')],'sectionId':_0x30f381['id']},{})[_0xc815('0x31')](function(){return _0x39dbca;});}else{return _0x39dbca;}})['catch'](function(_0xdb1f98){logger[_0xc815('0x32')](_0xc815('0x98'),_0xdb1f98);throw _0xdb1f98;});}return _0x39dbca;})['then'](respondWithResult(_0x24c166,null))['catch'](handleError(_0x24c166,null));}});}catch(_0x394fca){_0x24c166['status'](0x1f4)[_0xc815('0x35')](_0x394fca);}};function removeReferences(_0x523306,_0x4753d1){try{if(_0x523306){fs[_0xc815('0x65')](_0x523306);logger['info']('Zip\x20archive\x20removed');}if(_0x4753d1){rimraf(_0x4753d1,function(){});logger[_0xc815('0x66')](_0xc815('0x99'));}}catch(_0x1c865a){logger['error'](_0x1c865a);}}exports[_0xc815('0x2c')]=function(_0x38d891,_0x15d856,_0x3279f5){return db[_0xc815('0x37')]['find']({'where':{'id':_0x38d891[_0xc815('0x4f')]['id']}})[_0xc815('0x31')](handleEntityNotFound(_0x15d856,null))['then'](saveUpdates(_0x38d891[_0xc815('0x91')],null))[_0xc815('0x31')](respondWithResult(_0x15d856,null))[_0xc815('0x4d')](handleError(_0x15d856,null));};exports[_0xc815('0x9a')]=function(_0x33a222,_0x4ccf06,_0x4151b6){return db[_0xc815('0x37')][_0xc815('0x50')]({'where':{'id':_0x33a222['params']['id']}})[_0xc815('0x31')](function(_0xbf6065){if(_0xbf6065){return _0xbf6065['destroy']();}})[_0xc815('0x31')](function(_0x54055e){rimraf(path[_0xc815('0x52')](config[_0xc815('0x53')],_0xc815('0x54'),path['dirname'](_0x54055e[_0xc815('0x7')])),function(){});return _0x54055e;})['then'](handleEntityNotFound(_0x4ccf06,null))[_0xc815('0x31')](respondWithStatusCode(_0x4ccf06,null))[_0xc815('0x4d')](handleError(_0x4ccf06,null));};exports[_0xc815('0x9b')]=function(_0x4adb02,_0x1efbee,_0x5f3655){return BPromise['resolve']()[_0xc815('0x31')](function(){if(!_0x4adb02['query'][_0xc815('0x7')]){throw new Error(_0xc815('0x9c'));}if(!_0x4adb02[_0xc815('0x3d')][_0xc815('0x9d')]){throw new Error(_0xc815('0x9e'));}var _0x9c5fda=_0x4adb02[_0xc815('0x3d')][_0xc815('0x9f')]?_0x4adb02['query']['hostname']+':'+_0x4adb02[_0xc815('0x3d')][_0xc815('0x9d')]:'http://localhost:'+_0x4adb02[_0xc815('0x3d')]['port'];var _0x3a87c0=_0x4adb02[_0xc815('0x3d')][_0xc815('0x23')]?_0x4adb02[_0xc815('0x3d')]['json']:!![];var _0x3573f9=_0x4adb02[_0xc815('0x3d')][_0xc815('0xa0')]?_0x4adb02[_0xc815('0x3d')][_0xc815('0xa0')]:null;var _0x49f5df={'method':_0x4adb02[_0xc815('0xa1')],'uri':util[_0xc815('0x55')](_0xc815('0xa2'),_0x9c5fda,_0x4adb02['query'][_0xc815('0x7')]),'json':_0x3a87c0,'resolveWithFullResponse':!![],'encoding':_0x3573f9,'qs':_0x4adb02[_0xc815('0x3d')]};if(_0x4adb02[_0xc815('0xa3')]){_0x49f5df[_0xc815('0xa3')]=_0x4adb02[_0xc815('0xa3')];if(_0x49f5df[_0xc815('0xa3')][_0xc815('0xa4')]){delete _0x49f5df[_0xc815('0xa3')]['content-length'];}}if(_0x49f5df[_0xc815('0xa3')][_0xc815('0xa5')]){delete _0x49f5df[_0xc815('0xa3')][_0xc815('0xa5')];}return rp(_0x49f5df);})[_0xc815('0x31')](function(_0x7a0ce4){if(_0x7a0ce4){_0x1efbee[_0xc815('0x27')](_0x7a0ce4['headers']);logger[_0xc815('0x66')](_0x7a0ce4['body']);if(_[_0xc815('0xa6')](_0x4adb02[_0xc815('0x3d')][_0xc815('0x7')],_0xc815('0x51'))&&_0x7a0ce4[_0xc815('0xa7')]==0x1f4){return _0x1efbee['sendStatus'](_0x7a0ce4[_0xc815('0xa7')]);}else{return _0x1efbee['status'](_0x7a0ce4[_0xc815('0xa7')])[_0xc815('0x35')](_0x7a0ce4[_0xc815('0x91')]);}}else{return _0x1efbee[_0xc815('0x20')](0xc8);}})[_0xc815('0x4d')](handleError(_0x1efbee,null));};exports[_0xc815('0xa8')]=function(_0x3881fb,_0x562add,_0x31cad8){return BPromise[_0xc815('0xa9')]()['then'](function(){if(!_0x3881fb[_0xc815('0x3d')][_0xc815('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3881fb['query'][_0xc815('0x9d')]){throw new Error(_0xc815('0x9e'));}var _0x5c9769=_0x3881fb[_0xc815('0x3d')]['hostname']?_0x3881fb[_0xc815('0x3d')][_0xc815('0x9f')]+':'+_0x3881fb['query']['port']:'http://localhost:'+_0x3881fb[_0xc815('0x3d')][_0xc815('0x9d')];var _0x2db01f=_0x3881fb[_0xc815('0x3d')][_0xc815('0x23')]?_0x3881fb['query'][_0xc815('0x23')]:!![];var _0x56267f=_0x3881fb[_0xc815('0x3d')]['encoding']?_0x3881fb[_0xc815('0x3d')][_0xc815('0xa0')]:null;var _0x251e33={'method':_0x3881fb['method'],'uri':util['format'](_0xc815('0xa2'),_0x5c9769,_0x3881fb[_0xc815('0x3d')][_0xc815('0x7')]),'json':_0x2db01f,'resolveWithFullResponse':!![],'encoding':_0x56267f,'body':_0x3881fb[_0xc815('0x91')]};if(_0x3881fb[_0xc815('0xa3')]){_0x251e33[_0xc815('0xa3')]=_0x3881fb[_0xc815('0xa3')];if(_0x251e33['headers'][_0xc815('0xa4')]){delete _0x251e33[_0xc815('0xa3')][_0xc815('0xa4')];}}if(_0x251e33[_0xc815('0xa3')][_0xc815('0xa5')]){delete _0x251e33[_0xc815('0xa3')]['content-type'];}return rp(_0x251e33);})[_0xc815('0x31')](function(_0x55936d){if(_0x55936d){_0x562add['set'](_0x55936d[_0xc815('0xa3')]);logger[_0xc815('0x66')](_0x55936d['body']);return _0x562add[_0xc815('0x21')](_0x55936d['statusCode'])[_0xc815('0x35')](_0x55936d[_0xc815('0x91')]);}else{return _0x562add[_0xc815('0x20')](0xc8);}})[_0xc815('0x4d')](handleError(_0x562add,null));}; \ No newline at end of file +var _0xad58=['Warning:\x20admin\x20view\x20not\x20specified','script','scriptName','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','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','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./plugin.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','filter','includeAll','include','Plugin','findAll','rows','show','params','keys','options','find','catch','format','%s.zip','createWriteStream','zip','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','root','dirname','join','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','basename','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','test','plugins'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xad58,0xce));var _0x8ad5=function(_0x109333,_0x5ce132){_0x109333=_0x109333-0x0;var _0x7eb389=_0xad58[_0x109333];return _0x7eb389;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ad5('0x0'));var zipdir=require(_0x8ad5('0x1'));var jsonpatch=require(_0x8ad5('0x2'));var rp=require(_0x8ad5('0x3'));var moment=require(_0x8ad5('0x4'));var BPromise=require(_0x8ad5('0x5'));var Mustache=require(_0x8ad5('0x6'));var util=require(_0x8ad5('0x7'));var path=require(_0x8ad5('0x8'));var sox=require('sox');var csv=require(_0x8ad5('0x9'));var ejs=require(_0x8ad5('0xa'));var fs=require('fs');var fs_extra=require(_0x8ad5('0xb'));var _=require(_0x8ad5('0xc'));var squel=require(_0x8ad5('0xd'));var crypto=require(_0x8ad5('0xe'));var jsforce=require(_0x8ad5('0xf'));var deskjs=require(_0x8ad5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8ad5('0x11'));var Papa=require(_0x8ad5('0x12'));var extract=require('extract-zip');var rimraf=require(_0x8ad5('0x0'));var archiver=require(_0x8ad5('0x13'));var Redis=require(_0x8ad5('0x14'));var authService=require(_0x8ad5('0x15'));var qs=require(_0x8ad5('0x16'));var as=require(_0x8ad5('0x17'));var hardwareService=require(_0x8ad5('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x8ad5('0x19'));var config=require(_0x8ad5('0x1a'));var licenseUtil=require(_0x8ad5('0x1b'));var db=require(_0x8ad5('0x1c'))['db'];config[_0x8ad5('0x1d')]=_[_0x8ad5('0x1e')](config[_0x8ad5('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ad5('0x1f'))['register'](socket);function respondWithStatusCode(_0x33224a,_0x45a676){_0x45a676=_0x45a676||0xcc;return function(_0x3d1442){if(_0x3d1442){return _0x33224a[_0x8ad5('0x20')](_0x45a676);}return _0x33224a[_0x8ad5('0x21')](_0x45a676)[_0x8ad5('0x22')]();};}function respondWithResult(_0x3e9345,_0x5571d1){_0x5571d1=_0x5571d1||0xc8;return function(_0x41e7d7){if(_0x41e7d7){return _0x3e9345['status'](_0x5571d1)['json'](_0x41e7d7);}};}function respondWithFilteredResult(_0x5d7b3c,_0x3b0f32){return function(_0x579253){if(_0x579253){var _0x5bae4e=typeof _0x3b0f32[_0x8ad5('0x23')]===_0x8ad5('0x24')&&typeof _0x3b0f32[_0x8ad5('0x25')]==='undefined';var _0x4e7a9c=_0x579253[_0x8ad5('0x26')];var _0x3cb1fd=_0x5bae4e?0x0:_0x3b0f32[_0x8ad5('0x23')];var _0xd210b=_0x5bae4e?_0x579253[_0x8ad5('0x26')]:_0x3b0f32['offset']+_0x3b0f32[_0x8ad5('0x25')];var _0x48a179;if(_0xd210b>=_0x4e7a9c){_0xd210b=_0x4e7a9c;_0x48a179=0xc8;}else{_0x48a179=0xce;}_0x5d7b3c['status'](_0x48a179);return _0x5d7b3c[_0x8ad5('0x27')](_0x8ad5('0x28'),_0x3cb1fd+'-'+_0xd210b+'/'+_0x4e7a9c)[_0x8ad5('0x29')](_0x579253);}return null;};}function patchUpdates(_0x560cc9){return function(_0x3ae328){try{jsonpatch[_0x8ad5('0x2a')](_0x3ae328,_0x560cc9,!![]);}catch(_0x30cc11){return BPromise[_0x8ad5('0x2b')](_0x30cc11);}return _0x3ae328[_0x8ad5('0x2c')]();};}function saveUpdates(_0x5af9ed,_0x47e12d){return function(_0x576e08){if(_0x576e08){return _0x576e08['update'](_0x5af9ed)[_0x8ad5('0x2d')](function(_0x40cb60){return _0x40cb60;});}return null;};}function removeEntity(_0x9c5e7e,_0xcc206){return function(_0x53ab0b){if(_0x53ab0b){return _0x53ab0b[_0x8ad5('0x2e')]()[_0x8ad5('0x2d')](function(){var _0x317646=_0x53ab0b[_0x8ad5('0x2f')]({'plain':!![]});var _0x175bb4=_0x8ad5('0x30');return db[_0x8ad5('0x31')][_0x8ad5('0x2e')]({'where':{'type':_0x175bb4,'resourceId':_0x317646['id']}})[_0x8ad5('0x2d')](function(){return _0x53ab0b;});})[_0x8ad5('0x2d')](function(){_0x9c5e7e['status'](0xcc)[_0x8ad5('0x22')]();});}};}function handleEntityNotFound(_0xc211d2,_0x457c1c){return function(_0x365523){if(!_0x365523){_0xc211d2[_0x8ad5('0x20')](0x194);}return _0x365523;};}function handleError(_0x25b400,_0x4b3fac){_0x4b3fac=_0x4b3fac||0x1f4;return function(_0x22df9f){logger[_0x8ad5('0x32')](_0x22df9f[_0x8ad5('0x33')]);if(_0x22df9f['name']){delete _0x22df9f[_0x8ad5('0x34')];}_0x25b400[_0x8ad5('0x21')](_0x4b3fac)[_0x8ad5('0x35')](_0x22df9f);};}exports[_0x8ad5('0x36')]=function(_0x369d28,_0x4861ee){var _0x55f4a8={},_0x2383c9={},_0x2de08a={'count':0x0,'rows':[]};var _0x5763e4=_[_0x8ad5('0x37')](db['Plugin'][_0x8ad5('0x38')],function(_0xa4d4ef){return{'name':_0xa4d4ef['fieldName'],'type':_0xa4d4ef[_0x8ad5('0x39')][_0x8ad5('0x3a')]};});_0x2383c9[_0x8ad5('0x3b')]=_[_0x8ad5('0x37')](_0x5763e4,_0x8ad5('0x34'));_0x2383c9[_0x8ad5('0x3c')]=_['keys'](_0x369d28[_0x8ad5('0x3c')]);_0x2383c9[_0x8ad5('0x3d')]=_[_0x8ad5('0x3e')](_0x2383c9[_0x8ad5('0x3b')],_0x2383c9[_0x8ad5('0x3c')]);_0x55f4a8[_0x8ad5('0x3f')]=_[_0x8ad5('0x3e')](_0x2383c9[_0x8ad5('0x3b')],qs[_0x8ad5('0x40')](_0x369d28[_0x8ad5('0x3c')][_0x8ad5('0x40')]));_0x55f4a8[_0x8ad5('0x3f')]=_0x55f4a8[_0x8ad5('0x3f')][_0x8ad5('0x41')]?_0x55f4a8[_0x8ad5('0x3f')]:_0x2383c9['model'];if(!_0x369d28[_0x8ad5('0x3c')]['hasOwnProperty'](_0x8ad5('0x42'))){_0x55f4a8[_0x8ad5('0x25')]=qs['limit'](_0x369d28[_0x8ad5('0x3c')]['limit']);_0x55f4a8[_0x8ad5('0x23')]=qs[_0x8ad5('0x23')](_0x369d28[_0x8ad5('0x3c')]['offset']);}_0x55f4a8[_0x8ad5('0x43')]=qs[_0x8ad5('0x44')](_0x369d28[_0x8ad5('0x3c')][_0x8ad5('0x44')]);_0x55f4a8['where']=qs[_0x8ad5('0x3d')](_[_0x8ad5('0x45')](_0x369d28['query'],_0x2383c9[_0x8ad5('0x3d')]),_0x5763e4);if(_0x369d28['query']['filter']){_0x55f4a8[_0x8ad5('0x46')]=_[_0x8ad5('0x47')](_0x55f4a8[_0x8ad5('0x46')],{'$or':_[_0x8ad5('0x37')](_0x5763e4,function(_0x26a75d){if(_0x26a75d[_0x8ad5('0x39')]!=='VIRTUAL'){var _0x26958b={};_0x26958b[_0x26a75d[_0x8ad5('0x34')]]={'$like':'%'+_0x369d28[_0x8ad5('0x3c')][_0x8ad5('0x48')]+'%'};return _0x26958b;}})});}_0x55f4a8=_[_0x8ad5('0x47')]({},_0x55f4a8,_0x369d28['options']);var _0x2c1a0f={'where':_0x55f4a8[_0x8ad5('0x46')]};return db['Plugin']['count'](_0x2c1a0f)[_0x8ad5('0x2d')](function(_0x1723d9){_0x2de08a[_0x8ad5('0x26')]=_0x1723d9;if(_0x369d28[_0x8ad5('0x3c')][_0x8ad5('0x49')]){_0x55f4a8[_0x8ad5('0x4a')]=[{'all':!![]}];}return db[_0x8ad5('0x4b')][_0x8ad5('0x4c')](_0x55f4a8);})[_0x8ad5('0x2d')](function(_0x4d9047){_0x2de08a[_0x8ad5('0x4d')]=_0x4d9047;return _0x2de08a;})['then'](respondWithFilteredResult(_0x4861ee,_0x55f4a8))['catch'](handleError(_0x4861ee,null));};exports[_0x8ad5('0x4e')]=function(_0x56fa3e,_0x44ff5c){var _0xacc1d7={'raw':!![],'where':{'id':_0x56fa3e[_0x8ad5('0x4f')]['id']}},_0x15d6d6={};_0x15d6d6[_0x8ad5('0x3b')]=_[_0x8ad5('0x50')](db[_0x8ad5('0x4b')][_0x8ad5('0x38')]);_0x15d6d6['query']=_['keys'](_0x56fa3e['query']);_0x15d6d6[_0x8ad5('0x3d')]=_['intersection'](_0x15d6d6['model'],_0x15d6d6['query']);_0xacc1d7[_0x8ad5('0x3f')]=_['intersection'](_0x15d6d6[_0x8ad5('0x3b')],qs[_0x8ad5('0x40')](_0x56fa3e['query'][_0x8ad5('0x40')]));_0xacc1d7[_0x8ad5('0x3f')]=_0xacc1d7[_0x8ad5('0x3f')][_0x8ad5('0x41')]?_0xacc1d7[_0x8ad5('0x3f')]:_0x15d6d6['model'];if(_0x56fa3e['query'][_0x8ad5('0x49')]){_0xacc1d7[_0x8ad5('0x4a')]=[{'all':!![]}];}_0xacc1d7=_[_0x8ad5('0x47')]({},_0xacc1d7,_0x56fa3e[_0x8ad5('0x51')]);return db[_0x8ad5('0x4b')][_0x8ad5('0x52')](_0xacc1d7)[_0x8ad5('0x2d')](handleEntityNotFound(_0x44ff5c,null))['then'](respondWithResult(_0x44ff5c,null))[_0x8ad5('0x53')](handleError(_0x44ff5c,null));};exports['download']=function(_0xe8b0b2,_0x521703,_0x2ac90d){return db[_0x8ad5('0x4b')][_0x8ad5('0x52')]({'where':{'id':_0xe8b0b2[_0x8ad5('0x4f')]['id']},'attributes':[_0x8ad5('0x34'),_0x8ad5('0x8')],'raw':!![]})[_0x8ad5('0x2d')](handleEntityNotFound(_0x521703,null))['then'](function(_0x23176c){if(_0x23176c){var _0x48f2a1=path['join'](config['root'],'server/files/plugins',util[_0x8ad5('0x54')](_0x8ad5('0x55'),path['basename'](_0x23176c['path'])));var _0x2fdd89=fs[_0x8ad5('0x56')](_0x48f2a1);var _0x500422=archiver(_0x8ad5('0x57'),{'zlib':{'level':0x9}});_0x500422['on']('warning',function(_0x2577cf){if(_0x2577cf['code']===_0x8ad5('0x58')){logger['error'](_0x2577cf);}else{throw new db[(_0x8ad5('0x59'))][(_0x8ad5('0x5a'))](_0x8ad5('0x5b'));}});_0x500422['on'](_0x8ad5('0x32'),function(_0x3d3cd7){throw new db[(_0x8ad5('0x59'))][(_0x8ad5('0x5a'))](_0x8ad5('0x5b'));});_0x500422[_0x8ad5('0x5c')](_0x2fdd89);_0x500422['glob'](_0x8ad5('0x5d'),{'cwd':path['join'](config[_0x8ad5('0x5e')],'server/files/plugins',path[_0x8ad5('0x5f')](_0x23176c[_0x8ad5('0x8')])),'ignore':[path[_0x8ad5('0x60')](path['basename'](_0x23176c[_0x8ad5('0x8')]),_0x8ad5('0x61')),path[_0x8ad5('0x60')](path['basename'](_0x23176c[_0x8ad5('0x8')]),_0x8ad5('0x62'))],'nodir':!![]})[_0x8ad5('0x63')]();_0x2fdd89['on']('close',function(){if(!fs[_0x8ad5('0x64')](_0x48f2a1)){throw new db[(_0x8ad5('0x59'))][(_0x8ad5('0x5a'))](_0x8ad5('0x65'));}return _0x521703['download'](_0x48f2a1,util['format'](_0x8ad5('0x55'),path['basename'](_0x23176c[_0x8ad5('0x8')])),function(_0x1e3378){if(_0x1e3378){throw new db[(_0x8ad5('0x59'))][(_0x8ad5('0x5a'))](_0x8ad5('0x66'));}fs[_0x8ad5('0x67')](_0x48f2a1);logger[_0x8ad5('0x68')](_0x8ad5('0x69'));logger[_0x8ad5('0x68')](_0x8ad5('0x6a'));});});}return null;})['catch'](handleError(_0x521703,null));};exports[_0x8ad5('0x6b')]=function(_0x10a365,_0x37532e,_0x3064b9){var _0x5c8c11=path[_0x8ad5('0x6c')](_0x10a365[_0x8ad5('0x6d')][_0x8ad5('0x6e')],path[_0x8ad5('0x6f')](_0x10a365['file'][_0x8ad5('0x6e')]));var _0x5b73b0=path[_0x8ad5('0x60')](config['root'],_0x8ad5('0x70'),_0x10a365[_0x8ad5('0x6d')][_0x8ad5('0x6e')]);var _0x2a8588=path[_0x8ad5('0x60')](config[_0x8ad5('0x5e')],_0x8ad5('0x70'),_0x5c8c11);logger[_0x8ad5('0x68')](_0x8ad5('0x71'),_0x5b73b0);logger[_0x8ad5('0x68')](_0x8ad5('0x72'),_0x2a8588);try{fs['chmodSync'](_0x5b73b0,parseInt('0777',0x8));extract(_0x5b73b0,{'dir':_0x2a8588},function(_0x5b47db){if(_0x5b47db){logger[_0x8ad5('0x32')](_0x5b47db);handleError(_0x5b47db,!![]);};var _0xeb3b5b=fs[_0x8ad5('0x73')](_0x2a8588);if(_0xeb3b5b['length']>0x1){removeReferences(_0x5b73b0,_0x2a8588);logger[_0x8ad5('0x32')]('Invalid\x20plugin\x20structure');return _0x3064b9(new Error(_0x8ad5('0x74')));}var _0x2d0ffd=fs[_0x8ad5('0x75')](path[_0x8ad5('0x60')](_0x2a8588,_0xeb3b5b[0x0]));if(_0x2d0ffd['isFile']()){removeReferences(_0x5b73b0,_0x2a8588);logger[_0x8ad5('0x32')](_0x8ad5('0x74'));return _0x3064b9(new Error(_0x8ad5('0x74')));}if(_0x2d0ffd[_0x8ad5('0x76')]()){var _0x45d3f6=fs[_0x8ad5('0x73')](path['join'](_0x2a8588,_0xeb3b5b[0x0]));if(_0x45d3f6[_0x8ad5('0x41')]===0x0){removeReferences(_0x5b73b0,_0x2a8588);logger[_0x8ad5('0x32')](_0x8ad5('0x74'));return _0x3064b9(new Error(_0x8ad5('0x74')));}var _0x371bb1=_0x45d3f6['some'](function(_0x3c30c5){return _0x3c30c5===_0x8ad5('0x77');});if(!_0x371bb1){return _0x3064b9(new Error(_0x8ad5('0x78')));}var _0x235ca0=fs[_0x8ad5('0x79')](path['join'](_0x2a8588,_0xeb3b5b[0x0],_0x8ad5('0x77')));var _0x23555a=JSON[_0x8ad5('0x7a')](_0x235ca0);if(_0x8ad5('0x24')==typeof _0x23555a[_0x8ad5('0x34')]){return _0x3064b9(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x8ad5('0x24')==typeof _0x23555a[_0x8ad5('0x39')]){return _0x3064b9(new Error(_0x8ad5('0x7b')));}if(_0x8ad5('0x24')==typeof _0x23555a[_0x8ad5('0x7c')]){return _0x3064b9(new Error(_0x8ad5('0x7d')));}if('undefined'==typeof _0x23555a['parameters']){return _0x3064b9(new Error(_0x8ad5('0x7e')));}if(_0x23555a[_0x8ad5('0x39')]==='html'){if(_0x8ad5('0x24')==typeof _0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')]){return _0x3064b9(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x23555a['parameters'][_0x8ad5('0x80')][_0x8ad5('0x81')]&&'undefined'==typeof _0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')][_0x8ad5('0x82')]){return _0x3064b9(new Error(_0x8ad5('0x83')));}}else if(_0x23555a['type']==='script'){if(_0x8ad5('0x24')==typeof _0x23555a['parameters']['scriptName']){return _0x3064b9(new Error(_0x8ad5('0x84')));}if('undefined'==typeof _0x23555a['parameters']['scriptPath']){return _0x3064b9(new Error(_0x8ad5('0x85')));}}else{return _0x3064b9(new Error(_0x8ad5('0x86')));}var _0x1f5499=_0x23555a[_0x8ad5('0x34')];var _0x239bb3=_0x23555a['description'];var _0x3b935a=_0x23555a[_0x8ad5('0x39')];var _0x34629b=_0x23555a[_0x8ad5('0x87')]?_0x23555a[_0x8ad5('0x87')]:_0x8ad5('0x88');var _0x9ecb8e=_0x23555a[_0x8ad5('0x89')]?_0x23555a['icon']:_0x8ad5('0x8a');var _0x4807f9='';var _0x294299='';var _0xb0bd46='';var _0x5ab02a='';var _0x3b70c4=_0x23555a['version'];if(_0x3b935a===_0x8ad5('0x8b')){if('undefined'!=typeof _0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')][_0x8ad5('0x81')]){var _0xb9220d=_0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')][_0x8ad5('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x8ad5('0x8c')](_0xb9220d)){_0x4807f9=path['join'](_0x8ad5('0x8d'),_0x5c8c11,_0xeb3b5b[0x0],_0xb9220d);}else{_0x4807f9=_0xb9220d;}}else{logger['info'](_0x8ad5('0x8e'));}if('undefined'!=typeof _0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')][_0x8ad5('0x82')]){var _0x4e052e=_0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')][_0x8ad5('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x8ad5('0x8c')](_0x4e052e)){_0x294299=path[_0x8ad5('0x60')]('plugins',_0x5c8c11,_0xeb3b5b[0x0],_0x4e052e);}else{_0x294299=_0x4e052e;}}else{logger[_0x8ad5('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3b935a===_0x8ad5('0x8f')){_0xb0bd46=_0x23555a['parameters'][_0x8ad5('0x90')];_0x5ab02a=_0x23555a['parameters']['scriptPath'];if(_0x8ad5('0x24')!=typeof _0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')]){if(_0x8ad5('0x24')!=typeof _0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')]['admin']){var _0xb9220d=_0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8ad5('0x8c')](_0xb9220d)){_0x4807f9=path['join'](_0x8ad5('0x8d'),_0x5c8c11,_0xeb3b5b[0x0],_0xb9220d);}else{_0x4807f9=_0xb9220d;}}if(_0x8ad5('0x24')!=typeof _0x23555a['parameters'][_0x8ad5('0x80')]['agent']){var _0x4e052e=_0x23555a[_0x8ad5('0x7f')][_0x8ad5('0x80')][_0x8ad5('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4e052e)){_0x294299=path[_0x8ad5('0x60')]('plugins',_0x5c8c11,_0xeb3b5b[0x0],_0x4e052e);}else{_0x294299=_0x4e052e;}}}}var _0x1f69b6={'name':_0x1f5499,'description':_0x239bb3,'path':path[_0x8ad5('0x60')](_0x5c8c11,_0xeb3b5b[0x0]),'type':_0x3b935a,'sidebar':_0x34629b,'icon':_0x9ecb8e,'adminUrl':_0x4807f9,'agentUrl':_0x294299,'scriptName':_0xb0bd46,'scriptPath':_0x5ab02a,'version':_0x3b70c4};removeReferences(_0x5b73b0,null);return db[_0x8ad5('0x4b')][_0x8ad5('0x91')](_0x1f69b6)['then'](function(_0x3b6df1){var _0x1f1b99={'role':_0x10a365['body'][_0x8ad5('0x92')],'userProfileId':_0x10a365[_0x8ad5('0x93')][_0x8ad5('0x94')]};if(!_0x1f1b99)throw new Error(_0x8ad5('0x95'));if(_0x1f1b99[_0x8ad5('0x92')]===_0x8ad5('0x96')){var _0x54faff=_0x3b6df1['get']({'plain':!![]});return db[_0x8ad5('0x97')][_0x8ad5('0x52')]({'where':{'name':'Plugins','userProfileId':_0x1f1b99[_0x8ad5('0x94')]},'raw':!![]})[_0x8ad5('0x2d')](function(_0x586f03){if(_0x586f03&&_0x586f03[_0x8ad5('0x98')]===0x0){return db['UserProfileResource'][_0x8ad5('0x91')]({'name':_0x54faff[_0x8ad5('0x34')],'resourceId':_0x54faff['id'],'type':_0x586f03[_0x8ad5('0x34')],'sectionId':_0x586f03['id']},{})['then'](function(){return _0x3b6df1;});}else{return _0x3b6df1;}})[_0x8ad5('0x53')](function(_0x64de5a){logger[_0x8ad5('0x32')](_0x8ad5('0x99'),_0x64de5a);throw _0x64de5a;});}return _0x3b6df1;})['then'](respondWithResult(_0x37532e,null))[_0x8ad5('0x53')](handleError(_0x37532e,null));}});}catch(_0x519b8f){_0x37532e[_0x8ad5('0x21')](0x1f4)[_0x8ad5('0x35')](_0x519b8f);}};function removeReferences(_0x236510,_0x529ae5){try{if(_0x236510){fs[_0x8ad5('0x67')](_0x236510);logger['info'](_0x8ad5('0x9a'));}if(_0x529ae5){rimraf(_0x529ae5,function(){});logger['info'](_0x8ad5('0x9b'));}}catch(_0x727cef){logger['error'](_0x727cef);}}exports[_0x8ad5('0x9c')]=function(_0x244e33,_0x51e6b3,_0x49d2c8){return db['Plugin']['find']({'where':{'id':_0x244e33[_0x8ad5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51e6b3,null))['then'](saveUpdates(_0x244e33[_0x8ad5('0x93')],null))[_0x8ad5('0x2d')](respondWithResult(_0x51e6b3,null))['catch'](handleError(_0x51e6b3,null));};exports['delete']=function(_0x11c28d,_0x19d212,_0x4f839d){return db[_0x8ad5('0x4b')][_0x8ad5('0x52')]({'where':{'id':_0x11c28d[_0x8ad5('0x4f')]['id']}})['then'](function(_0x1cad0d){if(_0x1cad0d){return _0x1cad0d['destroy']();}})['then'](function(_0x4ebd90){rimraf(path[_0x8ad5('0x60')](config['root'],_0x8ad5('0x70'),path[_0x8ad5('0x5f')](_0x4ebd90[_0x8ad5('0x8')])),function(){});return _0x4ebd90;})['then'](handleEntityNotFound(_0x19d212,null))[_0x8ad5('0x2d')](respondWithStatusCode(_0x19d212,null))[_0x8ad5('0x53')](handleError(_0x19d212,null));};exports[_0x8ad5('0x9d')]=function(_0xaab3c2,_0x49803a,_0x453eb4){return BPromise[_0x8ad5('0x9e')]()[_0x8ad5('0x2d')](function(){if(!_0xaab3c2[_0x8ad5('0x3c')]['path']){throw new Error(_0x8ad5('0x9f'));}if(!_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x49c958=_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0xa1')]?_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0xa1')]+':'+_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0xa0')]:_0x8ad5('0xa2')+_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0xa0')];var _0x4c20a2=_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0x29')]?_0xaab3c2['query'][_0x8ad5('0x29')]:!![];var _0x1513c8=_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0xa3')]?_0xaab3c2['query']['encoding']:null;var _0x2f339a={'method':_0xaab3c2[_0x8ad5('0xa4')],'uri':util[_0x8ad5('0x54')](_0x8ad5('0xa5'),_0x49c958,_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0x8')]),'json':_0x4c20a2,'resolveWithFullResponse':!![],'encoding':_0x1513c8,'qs':_0xaab3c2['query']};if(_0xaab3c2[_0x8ad5('0xa6')]){_0x2f339a[_0x8ad5('0xa6')]=_0xaab3c2[_0x8ad5('0xa6')];if(_0x2f339a[_0x8ad5('0xa6')][_0x8ad5('0xa7')]){delete _0x2f339a[_0x8ad5('0xa6')][_0x8ad5('0xa7')];}}if(_0x2f339a['headers'][_0x8ad5('0xa8')]){delete _0x2f339a[_0x8ad5('0xa6')][_0x8ad5('0xa8')];}return rp(_0x2f339a);})['then'](function(_0x97959d){if(_0x97959d){_0x49803a['set'](_0x97959d[_0x8ad5('0xa6')]);logger[_0x8ad5('0x68')](_0x97959d[_0x8ad5('0x93')]);if(_[_0x8ad5('0xa9')](_0xaab3c2[_0x8ad5('0x3c')][_0x8ad5('0x8')],_0x8ad5('0xaa'))&&_0x97959d[_0x8ad5('0xab')]==0x1f4){return _0x49803a[_0x8ad5('0x20')](_0x97959d['statusCode']);}else{return _0x49803a['status'](_0x97959d[_0x8ad5('0xab')])[_0x8ad5('0x35')](_0x97959d[_0x8ad5('0x93')]);}}else{return _0x49803a[_0x8ad5('0x20')](0xc8);}})[_0x8ad5('0x53')](handleError(_0x49803a,null));};exports[_0x8ad5('0xac')]=function(_0x5d9e9a,_0x54624a,_0x40bb94){return BPromise[_0x8ad5('0x9e')]()['then'](function(){if(!_0x5d9e9a['query'][_0x8ad5('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5d9e9a[_0x8ad5('0x3c')][_0x8ad5('0xa0')]){throw new Error(_0x8ad5('0xad'));}var _0x55b1ae=_0x5d9e9a['query']['hostname']?_0x5d9e9a[_0x8ad5('0x3c')][_0x8ad5('0xa1')]+':'+_0x5d9e9a[_0x8ad5('0x3c')][_0x8ad5('0xa0')]:'http://localhost:'+_0x5d9e9a[_0x8ad5('0x3c')][_0x8ad5('0xa0')];var _0x162271=_0x5d9e9a[_0x8ad5('0x3c')]['json']?_0x5d9e9a[_0x8ad5('0x3c')][_0x8ad5('0x29')]:!![];var _0x5b2c05=_0x5d9e9a[_0x8ad5('0x3c')][_0x8ad5('0xa3')]?_0x5d9e9a[_0x8ad5('0x3c')]['encoding']:null;var _0x19575c={'method':_0x5d9e9a['method'],'uri':util[_0x8ad5('0x54')](_0x8ad5('0xa5'),_0x55b1ae,_0x5d9e9a[_0x8ad5('0x3c')]['path']),'json':_0x162271,'resolveWithFullResponse':!![],'encoding':_0x5b2c05,'body':_0x5d9e9a[_0x8ad5('0x93')]};if(_0x5d9e9a[_0x8ad5('0xa6')]){_0x19575c['headers']=_0x5d9e9a[_0x8ad5('0xa6')];if(_0x19575c[_0x8ad5('0xa6')]['content-length']){delete _0x19575c['headers']['content-length'];}}if(_0x19575c['headers'][_0x8ad5('0xa8')]){delete _0x19575c[_0x8ad5('0xa6')][_0x8ad5('0xa8')];}return rp(_0x19575c);})[_0x8ad5('0x2d')](function(_0x3dbbc4){if(_0x3dbbc4){_0x54624a[_0x8ad5('0x27')](_0x3dbbc4[_0x8ad5('0xa6')]);logger[_0x8ad5('0x68')](_0x3dbbc4[_0x8ad5('0x93')]);return _0x54624a['status'](_0x3dbbc4[_0x8ad5('0xab')])[_0x8ad5('0x35')](_0x3dbbc4[_0x8ad5('0x93')]);}else{return _0x54624a['sendStatus'](0xc8);}})['catch'](handleError(_0x54624a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 352f151..92b303a 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 _0x0f80=['hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update','emit'];(function(_0x4011ed,_0x3b671e){var _0x4e8143=function(_0x124fce){while(--_0x124fce){_0x4011ed['push'](_0x4011ed['shift']());}};_0x4e8143(++_0x3b671e);}(_0x0f80,0x108));var _0x00f8=function(_0x4316a5,_0x663fdb){_0x4316a5=_0x4316a5-0x0;var _0x53eee9=_0x0f80[_0x4316a5];return _0x53eee9;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x00f8('0x0'))['db'][_0x00f8('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x00f8('0x2')](0x0);var events={'afterCreate':_0x00f8('0x3'),'afterUpdate':_0x00f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c5e26){return function(_0x1921a1,_0x257013,_0x523990){PluginEvents[_0x00f8('0x5')](_0x1c5e26+':'+_0x1921a1['id'],_0x1921a1);PluginEvents[_0x00f8('0x5')](_0x1c5e26,_0x1921a1);_0x523990(null);};}for(var e in events){if(events[_0x00f8('0x6')](e)){var event=events[e];Plugin[_0x00f8('0x7')](e,emitEvent(event));}}module[_0x00f8('0x8')]=PluginEvents; \ No newline at end of file +var _0x374c=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x4bfe6b,_0x43c264){var _0x4f87c1=function(_0x36e4ab){while(--_0x36e4ab){_0x4bfe6b['push'](_0x4bfe6b['shift']());}};_0x4f87c1(++_0x43c264);}(_0x374c,0x1e3));var _0xc374=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x374c[_0x513aa5];return _0x1a1a7c;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc374('0x0'))['db'][_0xc374('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc374('0x2')](0x0);var events={'afterCreate':_0xc374('0x3'),'afterUpdate':_0xc374('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8d161e){return function(_0x534707,_0x1f68cf,_0x2561c0){PluginEvents['emit'](_0x8d161e+':'+_0x534707['id'],_0x534707);PluginEvents[_0xc374('0x5')](_0x8d161e,_0x534707);_0x2561c0(null);};}for(var e in events){if(events[_0xc374('0x6')](e)){var event=events[e];Plugin[_0xc374('0x7')](e,emitEvent(event));}}module[_0xc374('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e9c35be..9048ae4 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 _0xc53a=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define','lodash','util'];(function(_0x5b2c68,_0x11cf2c){var _0x205310=function(_0xc13ded){while(--_0xc13ded){_0x5b2c68['push'](_0x5b2c68['shift']());}};_0x205310(++_0x11cf2c);}(_0xc53a,0xd6));var _0xac53=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc53a[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xac53('0x0'));var util=require(_0xac53('0x1'));var logger=require(_0xac53('0x2'))('api');var moment=require('moment');var BPromise=require(_0xac53('0x3'));var rp=require(_0xac53('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac53('0x5'));var config=require(_0xac53('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x4c1923,_0x29a030){return _0x4c1923[_0xac53('0x7')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c6e=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','api','bluebird','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c6e,0x1ef));var _0xe6c6=function(_0x3086a0,_0x17c784){_0x3086a0=_0x3086a0-0x0;var _0x48b926=_0x6c6e[_0x3086a0];return _0x48b926;};'use strict';var _=require(_0xe6c6('0x0'));var util=require(_0xe6c6('0x1'));var logger=require('../../config/logger')(_0xe6c6('0x2'));var moment=require('moment');var BPromise=require(_0xe6c6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe6c6('0x4'));var attributes=require(_0xe6c6('0x5'));module[_0xe6c6('0x6')]=function(_0x494f8b,_0x15bbd6){return _0x494f8b[_0xe6c6('0x7')](_0xe6c6('0x8'),attributes,{'tableName':_0xe6c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index df23fca..00de39f 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 _0x0179=['request','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./plugin.socket'];(function(_0x4bb336,_0x81fd3c){var _0x4da388=function(_0x2e9240){while(--_0x2e9240){_0x4bb336['push'](_0x4bb336['shift']());}};_0x4da388(++_0x81fd3c);}(_0x0179,0x1f1));var _0x9017=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x0179[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x9017('0x0'));var util=require(_0x9017('0x1'));var moment=require(_0x9017('0x2'));var BPromise=require(_0x9017('0x3'));var rs=require(_0x9017('0x4'));var fs=require('fs');var Redis=require(_0x9017('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9017('0x6'));var config=require(_0x9017('0x7'));var jayson=require(_0x9017('0x8'));var client=jayson[_0x9017('0x9')][_0x9017('0xa')]({'port':0x232a});config['redis']=_[_0x9017('0xb')](config[_0x9017('0xc')],{'host':_0x9017('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9017('0xc')]));require(_0x9017('0xe'))['register'](socket);function respondWithRpcPromise(_0x5f3785,_0x5cd595,_0x59852b){return new BPromise(function(_0x39b19f,_0x286b77){return client[_0x9017('0xf')](_0x5f3785,_0x59852b)[_0x9017('0x10')](function(_0x13afa6){logger[_0x9017('0x11')]('Plugin,\x20%s,\x20%s',_0x5cd595,'request\x20sent');logger[_0x9017('0x12')](_0x9017('0x13'),_0x5cd595,'request\x20sent',JSON[_0x9017('0x14')](_0x13afa6));if(_0x13afa6[_0x9017('0x15')]){if(_0x13afa6['error'][_0x9017('0x16')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x5cd595,_0x13afa6['error'][_0x9017('0x17')]);return _0x286b77(_0x13afa6[_0x9017('0x15')][_0x9017('0x17')]);}logger['error'](_0x9017('0x18'),_0x5cd595,_0x13afa6[_0x9017('0x15')][_0x9017('0x17')]);return _0x39b19f(_0x13afa6[_0x9017('0x15')][_0x9017('0x17')]);}else{logger[_0x9017('0x11')](_0x9017('0x18'),_0x5cd595,'request\x20sent');_0x39b19f(_0x13afa6[_0x9017('0x19')]['message']);}})[_0x9017('0x1a')](function(_0x57ccfa){logger['error'](_0x9017('0x18'),_0x5cd595,_0x57ccfa);_0x286b77(_0x57ccfa);});});}exports[_0x9017('0x1b')]=function(_0x20e64f){var _0x2837c5=this;return new Promise(function(_0x2b70aa,_0x17934e){return db[_0x9017('0x1c')]['create'](_0x20e64f[_0x9017('0x1d')],{'raw':_0x20e64f['options']?_0x20e64f[_0x9017('0x1e')][_0x9017('0x1f')]===undefined?!![]:![]:!![]})[_0x9017('0x10')](function(_0x5c7ea4){logger['info'](_0x9017('0x1b'),_0x20e64f);logger[_0x9017('0x12')](_0x9017('0x1b'),_0x20e64f,JSON[_0x9017('0x14')](_0x5c7ea4));_0x2b70aa(_0x5c7ea4);})['catch'](function(_0x251f8d){logger[_0x9017('0x15')]('CreatePlugin',_0x251f8d['message'],_0x20e64f);_0x17934e(_0x2837c5[_0x9017('0x15')](0x1f4,_0x251f8d[_0x9017('0x17')]));});});}; \ No newline at end of file +var _0xe203=['ioredis','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','error','code','Plugin,\x20%s,\x20%s','message','info','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','util','moment','bluebird'];(function(_0x127ed7,_0x18c2c5){var _0x17c7bb=function(_0x212045){while(--_0x212045){_0x127ed7['push'](_0x127ed7['shift']());}};_0x17c7bb(++_0x18c2c5);}(_0xe203,0x1be));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e20('0x0'));var util=require(_0x3e20('0x1'));var moment=require(_0x3e20('0x2'));var BPromise=require(_0x3e20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e20('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3e20('0x5'))(_0x3e20('0x6'));var config=require('../../config/environment');var jayson=require(_0x3e20('0x7'));var client=jayson['client'][_0x3e20('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3e20('0x9')],{'host':_0x3e20('0xa'),'port':0x18eb});var socket=require(_0x3e20('0xb'))(new Redis(config['redis']));require('./plugin.socket')[_0x3e20('0xc')](socket);function respondWithRpcPromise(_0x549a68,_0x21e19d,_0x48bdd3){return new BPromise(function(_0x34ea71,_0x247a12){return client[_0x3e20('0xd')](_0x549a68,_0x48bdd3)[_0x3e20('0xe')](function(_0x1bd7a4){logger['info']('Plugin,\x20%s,\x20%s',_0x21e19d,_0x3e20('0xf'));logger[_0x3e20('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x21e19d,'request\x20sent',JSON['stringify'](_0x1bd7a4));if(_0x1bd7a4[_0x3e20('0x11')]){if(_0x1bd7a4[_0x3e20('0x11')][_0x3e20('0x12')]===0x1f4){logger[_0x3e20('0x11')](_0x3e20('0x13'),_0x21e19d,_0x1bd7a4[_0x3e20('0x11')][_0x3e20('0x14')]);return _0x247a12(_0x1bd7a4['error'][_0x3e20('0x14')]);}logger['error'](_0x3e20('0x13'),_0x21e19d,_0x1bd7a4[_0x3e20('0x11')][_0x3e20('0x14')]);return _0x34ea71(_0x1bd7a4[_0x3e20('0x11')][_0x3e20('0x14')]);}else{logger[_0x3e20('0x15')]('Plugin,\x20%s,\x20%s',_0x21e19d,_0x3e20('0xf'));_0x34ea71(_0x1bd7a4['result']['message']);}})[_0x3e20('0x16')](function(_0x38ada8){logger['error'](_0x3e20('0x13'),_0x21e19d,_0x38ada8);_0x247a12(_0x38ada8);});});}exports[_0x3e20('0x17')]=function(_0x349e2f){var _0x3cf709=this;return new Promise(function(_0x571457,_0x2a020){return db[_0x3e20('0x18')][_0x3e20('0x19')](_0x349e2f[_0x3e20('0x1a')],{'raw':_0x349e2f[_0x3e20('0x1b')]?_0x349e2f[_0x3e20('0x1b')][_0x3e20('0x1c')]===undefined?!![]:![]:!![]})[_0x3e20('0xe')](function(_0xba1cf3){logger[_0x3e20('0x15')]('CreatePlugin',_0x349e2f);logger[_0x3e20('0x10')](_0x3e20('0x17'),_0x349e2f,JSON[_0x3e20('0x1d')](_0xba1cf3));_0x571457(_0xba1cf3);})[_0x3e20('0x16')](function(_0x9d96dd){logger[_0x3e20('0x11')](_0x3e20('0x17'),_0x9d96dd[_0x3e20('0x14')],_0x349e2f);_0x2a020(_0x3cf709[_0x3e20('0x11')](0x1f4,_0x9d96dd[_0x3e20('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 6375ad8..057d719 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 _0x3069=['remove','removeListener','register','length','./plugin.events','save'];(function(_0x4e4da4,_0x511775){var _0x4b2cc0=function(_0x58b406){while(--_0x58b406){_0x4e4da4['push'](_0x4e4da4['shift']());}};_0x4b2cc0(++_0x511775);}(_0x3069,0x16c));var _0x9306=function(_0x1b87a6,_0x4b11a0){_0x1b87a6=_0x1b87a6-0x0;var _0x3f2b76=_0x3069[_0x1b87a6];return _0x3f2b76;};'use strict';var PluginEvents=require(_0x9306('0x0'));var events=[_0x9306('0x1'),_0x9306('0x2'),'update'];function createListener(_0x48a219,_0x9ca79d){return function(_0x10963b){_0x9ca79d['emit'](_0x48a219,_0x10963b);};}function removeListener(_0x5a11be,_0x4949f2){return function(){PluginEvents[_0x9306('0x3')](_0x5a11be,_0x4949f2);};}exports[_0x9306('0x4')]=function(_0x1e91d0){for(var _0x29e605=0x0,_0x294d37=events[_0x9306('0x5')];_0x29e605<_0x294d37;_0x29e605++){var _0x3930eb=events[_0x29e605];var _0x283058=createListener('plugin:'+_0x3930eb,_0x1e91d0);PluginEvents['on'](_0x3930eb,_0x283058);}}; \ No newline at end of file +var _0xe024=['save','remove','removeListener','register','length','plugin:'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0xe024,0x150));var _0x4e02=function(_0x256b67,_0x14e47b){_0x256b67=_0x256b67-0x0;var _0x3e2d99=_0xe024[_0x256b67];return _0x3e2d99;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x4e02('0x0'),_0x4e02('0x1'),'update'];function createListener(_0x5e81a7,_0x308bca){return function(_0x1b6afc){_0x308bca['emit'](_0x5e81a7,_0x1b6afc);};}function removeListener(_0x308a87,_0x5a3e39){return function(){PluginEvents[_0x4e02('0x2')](_0x308a87,_0x5a3e39);};}exports[_0x4e02('0x3')]=function(_0x208bda){for(var _0x309554=0x0,_0x11664c=events[_0x4e02('0x4')];_0x309554<_0x11664c;_0x309554++){var _0x13fa4d=events[_0x309554];var _0x5bcf80=createListener(_0x4e02('0x5')+_0x13fa4d,_0x208bda);PluginEvents['on'](_0x13fa4d,_0x5bcf80);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 3d9bac0..f280dc1 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(_0xa1596b,_0x923dd1){var _0x3ce2f6=function(_0x240286){while(--_0x240286){_0xa1596b['push'](_0xa1596b['shift']());}};_0x3ce2f6(++_0x923dd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x3e5bc7,_0x26ac70){var _0x4bfe53=function(_0x592edb){while(--_0x592edb){_0x3e5bc7['push'](_0x3e5bc7['shift']());}};_0x4bfe53(++_0x26ac70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 8ad8015..3a9b468 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 _0xb821=['params','then','create','body','script','join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','../../config/pm2','../../config/logger','child_process','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','reject','express','length','catch','show'];(function(_0x520155,_0x5c8d3c){var _0x164f31=function(_0xeec4a9){while(--_0xeec4a9){_0x520155['push'](_0x520155['shift']());}};_0x164f31(++_0x5c8d3c);}(_0xb821,0xa7));var _0x1b82=function(_0x944be3,_0x163b09){_0x944be3=_0x944be3-0x0;var _0x38ad64=_0xb821[_0x944be3];return _0x38ad64;};'use strict';var _=require('lodash');var pm2=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var path=require('path');var exec=require(_0x1b82('0x2'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x3b1d14,_0x1403ab){return function(_0x3fadf0){if(!_0x3fadf0){_0x3b1d14[_0x1b82('0x3')](0x194);;}return _0x3fadf0;};}function respondWithResult(_0x597ca7,_0x3e27c4){_0x3e27c4=_0x3e27c4||0xc8;return function(_0x192434){if(_0x192434){return _0x597ca7[_0x1b82('0x4')](_0x3e27c4)[_0x1b82('0x5')](_0x192434);}return null;};}function handleError(_0x18f45f,_0x7b87e8){_0x7b87e8=_0x7b87e8||0x1f4;return function(_0x161155){logger[_0x1b82('0x6')](_0x161155[_0x1b82('0x7')]);if(_0x161155['name']){delete _0x161155[_0x1b82('0x8')];}_0x18f45f[_0x1b82('0x4')](_0x7b87e8)[_0x1b82('0x9')](_0x161155);};}function execChildProcess(){return new BPromise(function(_0x14c57a,_0xcffb87){exec(_0x1b82('0xa'),function(_0x739f99,_0x1ce719,_0x5f521f){logger[_0x1b82('0xb')](_0x1ce719);logger[_0x1b82('0xb')](_0x5f521f);if(_0x739f99){logger[_0x1b82('0x6')](_0x739f99);return _0xcffb87(_0x739f99);}return _0x14c57a(_0x1ce719);});});}exports[_0x1b82('0xc')]=function(_0x50aed7,_0x1a6285){return pm2['list']()['then'](function(_0x1e553a){if(_0x1e553a){var _0x4bf75b=_[_0x1b82('0xd')](_0x1e553a,function(_0xe1d608){return _0xe1d608['name']===_0x1b82('0xe')||_0xe1d608['name']==='motion2';});return{'rows':_0x4bf75b,'count':_0x4bf75b[_0x1b82('0xf')]};}return null;})['then'](respondWithResult(_0x1a6285,null))[_0x1b82('0x10')](handleError(_0x1a6285,null));};exports[_0x1b82('0x11')]=function(_0xf42818,_0x4a09a2){return pm2['describe'](_0xf42818[_0x1b82('0x12')]['id'])['then'](respondWithResult(_0x4a09a2,null))[_0x1b82('0x13')](handleEntityNotFound(_0x4a09a2,null))[_0x1b82('0x10')](handleError(_0x4a09a2,null));};exports[_0x1b82('0x14')]=function(_0x594a63,_0x352426){if(_0x594a63[_0x1b82('0x15')][_0x1b82('0x8')]&&_0x594a63[_0x1b82('0x15')][_0x1b82('0x16')]){var _0x47e99b=path[_0x1b82('0x17')](__dirname,_0x1b82('0x18'),_0x594a63[_0x1b82('0x15')][_0x1b82('0x16')]);var _0x26e481=process[_0x1b82('0x19')]();process[_0x1b82('0x1a')](path['dirname'](_0x47e99b));return execChildProcess()[_0x1b82('0x13')](function(_0x233740){process['chdir'](_0x26e481);return pm2[_0x1b82('0x1b')]({'name':_0x594a63[_0x1b82('0x15')][_0x1b82('0x8')],'script':_0x47e99b});})['then'](function(_0x3a1226){pm2['dump']();return _0x3a1226[0x0];})['then'](respondWithResult(_0x352426,0xc9))['catch'](handleError(_0x352426,null));}else{return _0x352426[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':_0x1b82('0x1c')});}};exports[_0x1b82('0x1d')]=function(_0x548a3b,_0x222483){if(_0x548a3b[_0x1b82('0x15')]['id']){delete _0x548a3b[_0x1b82('0x15')]['id'];}var _0x7455e8={'online':_0x1b82('0x1e'),'stopped':_0x1b82('0x1f')};if(_0x7455e8[_0x1b82('0x20')](_0x548a3b[_0x1b82('0x15')][_0x1b82('0x4')])){return pm2[_0x7455e8[_0x548a3b[_0x1b82('0x15')][_0x1b82('0x4')]]](_0x548a3b[_0x1b82('0x12')]['id'])[_0x1b82('0x13')](respondWithResult(_0x222483,0xc8))['catch'](handleError(_0x222483,null));}else{return _0x222483[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':_0x1b82('0x21')});}};exports[_0x1b82('0x22')]=function(_0x18e4ff,_0x115ce7){if(_0x18e4ff[_0x1b82('0x15')]['id']){delete _0x18e4ff[_0x1b82('0x15')]['id'];}if(_0x18e4ff[_0x1b82('0x12')]['id']){return pm2[_0x1b82('0x23')](_0x18e4ff['params']['id'])[_0x1b82('0x13')](function(_0x29a31e){pm2[_0x1b82('0x24')]();return _0x29a31e[0x0];})[_0x1b82('0x13')](respondWithResult(_0x115ce7,null))['catch'](handleError(_0x115ce7,null));}else{return _0x115ce7[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x4ea3=['dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','destroy','lodash','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','status','json','error','name','npm\x20install','info','index','list','then','reject','express','length','catch','show','describe','params','create','body','script','../../files/plugins','chdir'];(function(_0x24f8ba,_0x224a0){var _0x14aa1f=function(_0x563359){while(--_0x563359){_0x24f8ba['push'](_0x24f8ba['shift']());}};_0x14aa1f(++_0x224a0);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x34ea('0x0'));var pm2=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var path=require('path');var exec=require(_0x34ea('0x4'))['exec'];var BPromise=require(_0x34ea('0x5'));function handleEntityNotFound(_0x571f1b,_0x5e5a84){return function(_0x2ce955){if(!_0x2ce955){_0x571f1b[_0x34ea('0x6')](0x194);;}return _0x2ce955;};}function respondWithResult(_0x962596,_0x123d48){_0x123d48=_0x123d48||0xc8;return function(_0x40434e){if(_0x40434e){return _0x962596[_0x34ea('0x7')](_0x123d48)[_0x34ea('0x8')](_0x40434e);}return null;};}function handleError(_0x5bec7c,_0x341727){_0x341727=_0x341727||0x1f4;return function(_0x6e9ccc){logger[_0x34ea('0x9')](_0x6e9ccc['stack']);if(_0x6e9ccc[_0x34ea('0xa')]){delete _0x6e9ccc[_0x34ea('0xa')];}_0x5bec7c['status'](_0x341727)['send'](_0x6e9ccc);};}function execChildProcess(){return new BPromise(function(_0x5bd8b6,_0x346287){exec(_0x34ea('0xb'),function(_0x58bb0d,_0x11229e,_0x29a5c8){logger[_0x34ea('0xc')](_0x11229e);logger[_0x34ea('0xc')](_0x29a5c8);if(_0x58bb0d){logger[_0x34ea('0x9')](_0x58bb0d);return _0x346287(_0x58bb0d);}return _0x5bd8b6(_0x11229e);});});}exports[_0x34ea('0xd')]=function(_0x37e1b4,_0x36af43){return pm2[_0x34ea('0xe')]()[_0x34ea('0xf')](function(_0x36a4c6){if(_0x36a4c6){var _0x5ef9ae=_[_0x34ea('0x10')](_0x36a4c6,function(_0x89e3f2){return _0x89e3f2[_0x34ea('0xa')]===_0x34ea('0x11')||_0x89e3f2[_0x34ea('0xa')]==='motion2';});return{'rows':_0x5ef9ae,'count':_0x5ef9ae[_0x34ea('0x12')]};}return null;})[_0x34ea('0xf')](respondWithResult(_0x36af43,null))[_0x34ea('0x13')](handleError(_0x36af43,null));};exports[_0x34ea('0x14')]=function(_0x5f420f,_0x2680e0){return pm2[_0x34ea('0x15')](_0x5f420f[_0x34ea('0x16')]['id'])['then'](respondWithResult(_0x2680e0,null))[_0x34ea('0xf')](handleEntityNotFound(_0x2680e0,null))[_0x34ea('0x13')](handleError(_0x2680e0,null));};exports[_0x34ea('0x17')]=function(_0x127308,_0x52af16){if(_0x127308[_0x34ea('0x18')][_0x34ea('0xa')]&&_0x127308[_0x34ea('0x18')][_0x34ea('0x19')]){var _0x4fc1a2=path['join'](__dirname,_0x34ea('0x1a'),_0x127308[_0x34ea('0x18')][_0x34ea('0x19')]);var _0x51022f=process['cwd']();process[_0x34ea('0x1b')](path[_0x34ea('0x1c')](_0x4fc1a2));return execChildProcess()[_0x34ea('0xf')](function(_0x30c4b0){process[_0x34ea('0x1b')](_0x51022f);return pm2[_0x34ea('0x1d')]({'name':_0x127308['body'][_0x34ea('0xa')],'script':_0x4fc1a2});})[_0x34ea('0xf')](function(_0x3c0983){pm2[_0x34ea('0x1e')]();return _0x3c0983[0x0];})['then'](respondWithResult(_0x52af16,0xc9))['catch'](handleError(_0x52af16,null));}else{return _0x52af16['status'](0x1f4)[_0x34ea('0x1f')]({'message':_0x34ea('0x20')});}};exports[_0x34ea('0x21')]=function(_0x4204d7,_0x5b8b3e){if(_0x4204d7[_0x34ea('0x18')]['id']){delete _0x4204d7[_0x34ea('0x18')]['id'];}var _0x27c6f7={'online':'restart','stopped':'stop'};if(_0x27c6f7['hasOwnProperty'](_0x4204d7['body'][_0x34ea('0x7')])){return pm2[_0x27c6f7[_0x4204d7[_0x34ea('0x18')][_0x34ea('0x7')]]](_0x4204d7[_0x34ea('0x16')]['id'])['then'](respondWithResult(_0x5b8b3e,0xc8))[_0x34ea('0x13')](handleError(_0x5b8b3e,null));}else{return _0x5b8b3e['status'](0x1f4)[_0x34ea('0x1f')]({'message':'Unknown\x20status'});}};exports[_0x34ea('0x22')]=function(_0x14e018,_0x3cb968){if(_0x14e018['body']['id']){delete _0x14e018[_0x34ea('0x18')]['id'];}if(_0x14e018[_0x34ea('0x16')]['id']){return pm2['delete'](_0x14e018[_0x34ea('0x16')]['id'])['then'](function(_0x1392b6){pm2[_0x34ea('0x1e')]();return _0x1392b6[0x0];})[_0x34ea('0xf')](respondWithResult(_0x3cb968,null))['catch'](handleError(_0x3cb968,null));}else{return _0x3cb968['status'](0x1f4)[_0x34ea('0x1f')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9dd6572..6106916 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 _0x4579=['/queues','getQueues','express','../../components/auth/service','./realtime.controller','get','isAuthenticated','getAgents'];(function(_0x34cea1,_0x16d860){var _0x2d796a=function(_0x11e340){while(--_0x11e340){_0x34cea1['push'](_0x34cea1['shift']());}};_0x2d796a(++_0x16d860);}(_0x4579,0x8a));var _0x9457=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4579[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x9457('0x0'));var router=express['Router']();var auth=require(_0x9457('0x1'));var controller=require(_0x9457('0x2'));router[_0x9457('0x3')]('/agents',auth[_0x9457('0x4')](),controller[_0x9457('0x5')]);router[_0x9457('0x3')](_0x9457('0x6'),auth[_0x9457('0x4')](),controller[_0x9457('0x7')]);module['exports']=router; \ No newline at end of file +var _0x2b80=['../../components/auth/service','./realtime.controller','get','getAgents','isAuthenticated','getQueues','Router'];(function(_0x58a131,_0x2b8e1f){var _0x1aa797=function(_0xe0c83){while(--_0xe0c83){_0x58a131['push'](_0x58a131['shift']());}};_0x1aa797(++_0x2b8e1f);}(_0x2b80,0x68));var _0x02b8=function(_0x396ac0,_0x2f55d8){_0x396ac0=_0x396ac0-0x0;var _0x3e10ad=_0x2b80[_0x396ac0];return _0x3e10ad;};'use strict';var express=require('express');var router=express[_0x02b8('0x0')]();var auth=require(_0x02b8('0x1'));var controller=require(_0x02b8('0x2'));router[_0x02b8('0x3')]('/agents',auth['isAuthenticated'](),controller[_0x02b8('0x4')]);router['get']('/queues',auth[_0x02b8('0x5')](),controller[_0x02b8('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 7a975cc..003daf8 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 _0x7cce=['talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','map','pick','catch','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','Queue','key','fields','outbound','dialMethod','QueueCampaigns','Queues','name','filter','getResources','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','format','toLowerCase','sort','includes','validateSortParameter','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','role','agent','getOptions','raw','literal','FIELD(id,','forEach','Pause','push','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','findAndCountAll','find','globalStatus','getAgentStatus','pause','voice','voiceStatus'];(function(_0x21b0ef,_0x2bec64){var _0x135500=function(_0x4d155){while(--_0x4d155){_0x21b0ef['push'](_0x21b0ef['shift']());}};_0x135500(++_0x2bec64);}(_0x7cce,0xc2));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7cc('0x0'));var util=require(_0xe7cc('0x1'));var rta=require(_0xe7cc('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0xe7cc('0x3'));var utils=require(_0xe7cc('0x4'));var db=require(_0xe7cc('0x5'))['db'];var APIBadRequestError=require(_0xe7cc('0x6'))[_0xe7cc('0x7')];var APIHandleError=require('../../errors/api')[_0xe7cc('0x8')];function respondWithFilteredResult(_0x1df0bc,_0x3207b0){return function(_0x7c6627){if(_0x7c6627){var _0x135d3a=typeof _0x3207b0[_0xe7cc('0x9')]===_0xe7cc('0xa')&&typeof _0x3207b0['limit']===_0xe7cc('0xa');var _0x23958d=_0x7c6627[_0xe7cc('0xb')];var _0xffacfa=_0x135d3a?0x0:_0x3207b0[_0xe7cc('0x9')];var _0x1718a7=_0x135d3a?_0x7c6627[_0xe7cc('0xb')]:_0x3207b0['offset']+_0x3207b0[_0xe7cc('0xc')];var _0x18747a;if(_0x1718a7>=_0x23958d){_0x1718a7=_0x23958d;_0x18747a=0xc8;}else{_0x18747a=0xce;}_0x1df0bc['status'](_0x18747a);return _0x1df0bc[_0xe7cc('0xd')](_0xe7cc('0xe'),_0xffacfa+'-'+_0x1718a7+'/'+_0x23958d)[_0xe7cc('0xf')](_0x7c6627);}return null;};}exports[_0xe7cc('0x10')]=function(_0x368b24,_0x533dfe){var _0x22c1a2={'count':0x0,'rows':[]};var _0x9276f6={};var _0x1ee1b5;var _0x140e9d=utils[_0xe7cc('0x11')]();var _0x39c900;var _0x5c4f99;var _0x26fb2e=_0x368b24[_0xe7cc('0x12')]['globalQueueFilter'];var _0x374178=_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x13')];var _0xe8746e=_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x14')];var _0x108e78=_0x374178==='pause'||_0x374178===_0xe7cc('0x15')?!![]:![];var _0x5780f6=[];var _0x3ebc6e;var _0x38ace9;Promise[_0xe7cc('0x16')]()['then'](function(){if(_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x17')]){if(!utils['isValidChannel'](_0x368b24['query'][_0xe7cc('0x17')])){throw new APIBadRequestError(util[_0xe7cc('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x368b24['query'][_0xe7cc('0x17')]));}_0x1ee1b5=_0x368b24['query']['channel'][_0xe7cc('0x19')]();}if(!_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x1a')]||!_0x368b24[_0xe7cc('0x12')]['sort'][_0xe7cc('0x1b')]('globalStatus')){_0x368b24['query'][_0xe7cc('0x1a')]=rta[_0xe7cc('0x1c')](_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x1a')]);return;}var _0x2ed518=rta['getUpdatedSortOptions'](_0x368b24[_0xe7cc('0x12')]['sort']);_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x1a')]=_0x2ed518['fields'][_0xe7cc('0x1d')](',');_0x3ebc6e=_0x2ed518[_0xe7cc('0x1e')];})[_0xe7cc('0x1f')](function(){if(!_0x26fb2e){return[];}return rta[_0xe7cc('0x20')](_0x26fb2e,_0x1ee1b5);})['then'](function(_0x3f8884){_0x5780f6=_0x3f8884;return rta[_0xe7cc('0x21')]();})['then'](function(_0x422ec6){_0x5c4f99=_0x422ec6[_0xe7cc('0x22')];if((!_0x374178||_0x108e78)&&!_0x3ebc6e){return _0x5780f6;}if(_0x3ebc6e&&!_0x374178){return rta[_0xe7cc('0x23')](_0x5c4f99,_0x5780f6,_0x3ebc6e);}else{return rta[_0xe7cc('0x24')](_0x5c4f99,_0x5780f6,_0x374178);}})[_0xe7cc('0x1f')](function(_0x3618b6){_0x5780f6=_0x3618b6;var _0x20b9d0=![];if(_0x5780f6[_0xe7cc('0x25')]===0x0){if(_0x26fb2e||_0x374178){_0x20b9d0=!![];}if(_0x108e78){_0x20b9d0=![];}}if(_0x20b9d0){return _0x22c1a2;}var _0x557cb2=_['map'](db[_0xe7cc('0x26')][_0xe7cc('0x27')],function(_0x25bca6){return{'name':_0x25bca6[_0xe7cc('0x28')],'type':_0x25bca6[_0xe7cc('0x29')]['key']};});_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x2a')]=_0xe7cc('0x2b');_0x9276f6=qs[_0xe7cc('0x2c')](_0x557cb2,_0x368b24);_0x9276f6[_0xe7cc('0x2d')]=!![];var _0x138375=[];if(_0x5780f6['length']>0x0){_0x138375['push']({'id':{'$in':_0x5780f6}});if(_0x3ebc6e&&!_0x374178){_0x38ace9=[db['sequelize'][_0xe7cc('0x2e')](_0xe7cc('0x2f')+_0x5780f6+')')];_0x9276f6[_0xe7cc('0x1e')]=_0x38ace9;}}if(_0x108e78){_0x140e9d[_0xe7cc('0x30')](function(_0x48ba96){var _0x4808a9=!![];if(_0x374178===_0xe7cc('0x15')&&_0x1ee1b5!==_0x48ba96){_0x4808a9=![];}_0x138375['push']({[_0x48ba96+_0xe7cc('0x31')]:_0x4808a9});});if(_0xe8746e){_0x138375[_0xe7cc('0x32')]({'pauseType':_0xe8746e});}}else if(_0x374178){_0x140e9d[_0xe7cc('0x30')](function(_0x3d8c0e){_0x138375[_0xe7cc('0x32')]({[_0x3d8c0e+'Pause']:![]});});}_0x9276f6[_0xe7cc('0x33')]=_[_0xe7cc('0x34')](_0x9276f6[_0xe7cc('0x33')],{'$and':_0x138375});if(_0x368b24['user'][_0xe7cc('0x2a')]===_0xe7cc('0x35')){var _0x17735d={'params':{'id':_0x368b24[_0xe7cc('0x35')][_0xe7cc('0x36')]},'query':{'section':_0xe7cc('0x37'),'role':_0xe7cc('0x2b'),'raw':!![],'ids':_0x5780f6,'customSorting':_0x38ace9}};if(_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x38')]){_0x17735d[_0xe7cc('0x12')]['online']=!![];}if(_0x108e78){_0x17735d['query'][_0xe7cc('0x39')]=_0x138375;}_0x17735d['query']=Object[_0xe7cc('0x3a')](_0x17735d['query'],_['omit'](_0x368b24['query'],'id'));return db[_0xe7cc('0x3b')]['getResources'](_0x17735d);}return db[_0xe7cc('0x26')][_0xe7cc('0x3c')](_0x9276f6);})[_0xe7cc('0x1f')](function(_0x138e3a){_0x22c1a2[_0xe7cc('0xb')]=_0x138e3a[_0xe7cc('0xb')];_0x39c900=_0x138e3a['rows'];return _0x39c900['map'](function(_0x4a07ab){var _0x46620e=_[_0xe7cc('0x3d')](_0x5c4f99,['id',_0x4a07ab['id']]);if(_0x46620e){var _0x37947b=rta['filterAgentAttributes'](_0x46620e);_[_0xe7cc('0x34')](_0x4a07ab,_0x37947b);}_0x4a07ab[_0xe7cc('0x3e')]=rta[_0xe7cc('0x3f')](_0x4a07ab);if(_0x4a07ab[_0xe7cc('0x3e')][_0xe7cc('0x1b')](_0xe7cc('0x40'))){_0x140e9d[_0xe7cc('0x30')](function(_0x44c33c){if(_0x4a07ab[_0x44c33c+'Pause']){if(_0x44c33c===_0xe7cc('0x41')){if(_0x4a07ab[_0xe7cc('0x42')]!==_0xe7cc('0x43')){_0x4a07ab[_0xe7cc('0x42')]='pause';}}else{_0x4a07ab[_0x44c33c+_0xe7cc('0x44')]=_0xe7cc('0x40');}}});}return _0x4a07ab;});})['then'](function(_0xc26360){if(!_0x3ebc6e||_0x38ace9){return _0xc26360;}return rta[_0xe7cc('0x45')](_0xc26360,_0x3ebc6e);})['then'](function(_0x490da3){var _0x379e5c=rta[_0xe7cc('0x46')]();_0x22c1a2[_0xe7cc('0x22')]=_0x490da3[_0xe7cc('0x47')](function(_0x43b357){return _[_0xe7cc('0x48')](_0x43b357,_0x379e5c);});return _0x22c1a2;})[_0xe7cc('0x1f')](respondWithFilteredResult(_0x533dfe,_0x9276f6))[_0xe7cc('0x49')](APIHandleError(_0x533dfe));};exports['getQueues']=function(_0x2d9dbb,_0x402733){var _0xa546d7={'count':0x0,'rows':[]};var _0x476908={};var _0x10ce97;var _0x1ab6ca;var _0x23ebdd;Promise[_0xe7cc('0x16')]()[_0xe7cc('0x1f')](function(){if(_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x17')]){if(!utils[_0xe7cc('0x4a')](_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x17')])){throw new APIBadRequestError(util[_0xe7cc('0x18')](_0xe7cc('0x4b'),_0x2d9dbb['query'][_0xe7cc('0x17')]));}_0x10ce97=_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x17')][_0xe7cc('0x19')]();}var _0x3e9a54=_['startCase'](_0x10ce97)+_0xe7cc('0x4c');var _0x25b2d8=_[_0xe7cc('0x47')](db[_0x3e9a54]['rawAttributes'],function(_0x3d8276){return{'name':_0x3d8276[_0xe7cc('0x28')],'type':_0x3d8276['type'][_0xe7cc('0x4d')]};});if(!_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x4e')]){var _0x14ebaf=['id','name'];if(_0x10ce97===_0xe7cc('0x41')){_0x14ebaf[_0xe7cc('0x32')]('type');if(_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')]===_0xe7cc('0x4f')){_0x14ebaf[_0xe7cc('0x32')](['dialActive',_0xe7cc('0x50')]);}}_0x2d9dbb[_0xe7cc('0x12')]['fields']=_0x14ebaf['join'](',');}_0x476908=qs['getOptions'](_0x25b2d8,_0x2d9dbb);if(_0x2d9dbb[_0xe7cc('0x35')]['role']===_0xe7cc('0x35')){var _0x3d7401={'params':{'id':_0x2d9dbb[_0xe7cc('0x35')][_0xe7cc('0x36')]},'query':{'section':_0x10ce97==='voice'&&_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')]==='outbound'?_0xe7cc('0x51'):_['startCase'](_0x10ce97)+_0xe7cc('0x52'),'type':_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')],'nolimit':!![],'sort':_0xe7cc('0x53'),'filter':_0x2d9dbb['query'][_0xe7cc('0x54')]}};_0x3d7401[_0xe7cc('0x12')]=Object['assign'](_0x3d7401['query'],_0x2d9dbb[_0xe7cc('0x12')]);delete _0x3d7401[_0xe7cc('0x12')]['id'];return db['UserProfile'][_0xe7cc('0x55')](_0x3d7401);}return db[_0x3e9a54][_0xe7cc('0x3c')](_0x476908);})[_0xe7cc('0x1f')](function(_0x2b964c){_0xa546d7[_0xe7cc('0xb')]=_0x2b964c[_0xe7cc('0xb')];_0x1ab6ca=_0x2b964c['rows'];return rtq[_0xe7cc('0x56')](_0x2d9dbb,_0x10ce97);})[_0xe7cc('0x1f')](function(_0x3b81cf){_0x23ebdd=_0x3b81cf[_0xe7cc('0x22')];return rtq['initializeQueues'](_0x1ab6ca,_0x23ebdd,_0x10ce97,_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')]);})[_0xe7cc('0x1f')](function(_0x53481c){_0xa546d7['rows']=_0x53481c;return _0xa546d7;})['then'](respondWithFilteredResult(_0x402733,_0x476908))[_0xe7cc('0x49')](APIHandleError(_0x402733));}; \ No newline at end of file +var _0x6287=['isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','key','role','raw','literal','order','forEach','Pause','push','where','user','userProfileId','Agents','agent','online','extraQueryConditions','assign','omit','find','filterAgentAttributes','merge','getAgentStatus','includes','voice','voiceStatus','Status','catch','getQueues','resolve','Queue','type','name','outbound','dialActive','getOptions','startCase','Queues','filter','UserProfile','getResources','findAndCountAll','initializeQueues','lodash','util','../../components/realtime/queues','handleError','offset','undefined','limit','count','set','Content-Range','json','getChannels','query','globalQueueFilter','globalStatusFilter','pause','*pause','then','channel'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0x6287,0x129));var _0x7628=function(_0x20410e,_0x11ea83){_0x20410e=_0x20410e-0x0;var _0x18e1cc=_0x6287[_0x20410e];return _0x18e1cc;};'use strict';var _=require(_0x7628('0x0'));var util=require(_0x7628('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x7628('0x2'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require('../../errors/api')[_0x7628('0x3')];function respondWithFilteredResult(_0x5f4d34,_0x34c8d5){return function(_0x5d87fa){if(_0x5d87fa){var _0x107b66=typeof _0x34c8d5[_0x7628('0x4')]===_0x7628('0x5')&&typeof _0x34c8d5[_0x7628('0x6')]===_0x7628('0x5');var _0xcd2c69=_0x5d87fa[_0x7628('0x7')];var _0x5390c0=_0x107b66?0x0:_0x34c8d5[_0x7628('0x4')];var _0x5b467e=_0x107b66?_0x5d87fa[_0x7628('0x7')]:_0x34c8d5['offset']+_0x34c8d5[_0x7628('0x6')];var _0x9acd6d;if(_0x5b467e>=_0xcd2c69){_0x5b467e=_0xcd2c69;_0x9acd6d=0xc8;}else{_0x9acd6d=0xce;}_0x5f4d34['status'](_0x9acd6d);return _0x5f4d34[_0x7628('0x8')](_0x7628('0x9'),_0x5390c0+'-'+_0x5b467e+'/'+_0xcd2c69)[_0x7628('0xa')](_0x5d87fa);}return null;};}exports['getAgents']=function(_0x39f38a,_0x14793f){var _0xc02965={'count':0x0,'rows':[]};var _0x618225={};var _0x50f1e0;var _0x3cfd42=utils[_0x7628('0xb')]();var _0x281e91;var _0x5963bc;var _0xc241ea=_0x39f38a[_0x7628('0xc')][_0x7628('0xd')];var _0x156d24=_0x39f38a[_0x7628('0xc')][_0x7628('0xe')];var _0x5f514a=_0x39f38a[_0x7628('0xc')]['pauseTypeFilter'];var _0x44f700=_0x156d24===_0x7628('0xf')||_0x156d24===_0x7628('0x10')?!![]:![];var _0x2b4837=[];var _0x1d913d;var _0x214f4e;Promise['resolve']()[_0x7628('0x11')](function(){if(_0x39f38a[_0x7628('0xc')][_0x7628('0x12')]){if(!utils[_0x7628('0x13')](_0x39f38a[_0x7628('0xc')][_0x7628('0x12')])){throw new APIBadRequestError(util[_0x7628('0x14')](_0x7628('0x15'),_0x39f38a['query']['channel']));}_0x50f1e0=_0x39f38a['query']['channel'][_0x7628('0x16')]();}if(!_0x39f38a[_0x7628('0xc')][_0x7628('0x17')]||!_0x39f38a['query']['sort']['includes'](_0x7628('0x18'))){_0x39f38a[_0x7628('0xc')][_0x7628('0x17')]=rta[_0x7628('0x19')](_0x39f38a[_0x7628('0xc')]['sort']);return;}var _0x1367a7=rta[_0x7628('0x1a')](_0x39f38a['query']['sort']);_0x39f38a[_0x7628('0xc')]['sort']=_0x1367a7[_0x7628('0x1b')][_0x7628('0x1c')](',');_0x1d913d=_0x1367a7['order'];})[_0x7628('0x11')](function(){if(!_0xc241ea){return[];}return rta['getAgentIdsByQueues'](_0xc241ea,_0x50f1e0);})[_0x7628('0x11')](function(_0x2c8bcb){_0x2b4837=_0x2c8bcb;return rta[_0x7628('0x1d')]();})['then'](function(_0x399f8d){_0x5963bc=_0x399f8d[_0x7628('0x1e')];if((!_0x156d24||_0x44f700)&&!_0x1d913d){return _0x2b4837;}if(_0x1d913d&&!_0x156d24){return rta[_0x7628('0x1f')](_0x5963bc,_0x2b4837,_0x1d913d);}else{return rta[_0x7628('0x20')](_0x5963bc,_0x2b4837,_0x156d24);}})[_0x7628('0x11')](function(_0x47238c){_0x2b4837=_0x47238c;var _0x4c0c25=![];if(_0x2b4837[_0x7628('0x21')]===0x0){if(_0xc241ea||_0x156d24){_0x4c0c25=!![];}if(_0x44f700){_0x4c0c25=![];}}if(_0x4c0c25){return _0xc02965;}var _0x3ea882=_[_0x7628('0x22')](db[_0x7628('0x23')][_0x7628('0x24')],function(_0x52d425){return{'name':_0x52d425[_0x7628('0x25')],'type':_0x52d425['type'][_0x7628('0x26')]};});_0x39f38a[_0x7628('0xc')][_0x7628('0x27')]='agent';_0x618225=qs['getOptions'](_0x3ea882,_0x39f38a);_0x618225[_0x7628('0x28')]=!![];var _0x15c377=[];if(_0x2b4837[_0x7628('0x21')]>0x0){_0x15c377['push']({'id':{'$in':_0x2b4837}});if(_0x1d913d&&!_0x156d24){_0x214f4e=[db['sequelize'][_0x7628('0x29')]('FIELD(id,'+_0x2b4837+')')];_0x618225[_0x7628('0x2a')]=_0x214f4e;}}if(_0x44f700){_0x3cfd42[_0x7628('0x2b')](function(_0x20f349){var _0x107db1=!![];if(_0x156d24===_0x7628('0x10')&&_0x50f1e0!==_0x20f349){_0x107db1=![];}_0x15c377['push']({[_0x20f349+_0x7628('0x2c')]:_0x107db1});});if(_0x5f514a){_0x15c377[_0x7628('0x2d')]({'pauseType':_0x5f514a});}}else if(_0x156d24){_0x3cfd42[_0x7628('0x2b')](function(_0x379aad){_0x15c377[_0x7628('0x2d')]({[_0x379aad+_0x7628('0x2c')]:![]});});}_0x618225[_0x7628('0x2e')]=_['merge'](_0x618225[_0x7628('0x2e')],{'$and':_0x15c377});if(_0x39f38a[_0x7628('0x2f')][_0x7628('0x27')]===_0x7628('0x2f')){var _0x588271={'params':{'id':_0x39f38a[_0x7628('0x2f')][_0x7628('0x30')]},'query':{'section':_0x7628('0x31'),'role':_0x7628('0x32'),'raw':!![],'ids':_0x2b4837,'customSorting':_0x214f4e}};if(_0x39f38a['query'][_0x7628('0x33')]){_0x588271['query'][_0x7628('0x33')]=!![];}if(_0x44f700){_0x588271[_0x7628('0xc')][_0x7628('0x34')]=_0x15c377;}_0x588271[_0x7628('0xc')]=Object[_0x7628('0x35')](_0x588271[_0x7628('0xc')],_[_0x7628('0x36')](_0x39f38a[_0x7628('0xc')],'id'));return db['UserProfile']['getResources'](_0x588271);}return db['User']['findAndCountAll'](_0x618225);})['then'](function(_0x218f8a){_0xc02965[_0x7628('0x7')]=_0x218f8a[_0x7628('0x7')];_0x281e91=_0x218f8a[_0x7628('0x1e')];return _0x281e91['map'](function(_0x523276){var _0x4c7741=_[_0x7628('0x37')](_0x5963bc,['id',_0x523276['id']]);if(_0x4c7741){var _0x100831=rta[_0x7628('0x38')](_0x4c7741);_[_0x7628('0x39')](_0x523276,_0x100831);}_0x523276[_0x7628('0x18')]=rta[_0x7628('0x3a')](_0x523276);if(_0x523276[_0x7628('0x18')][_0x7628('0x3b')]('pause')){_0x3cfd42['forEach'](function(_0x255a71){if(_0x523276[_0x255a71+'Pause']){if(_0x255a71===_0x7628('0x3c')){if(_0x523276[_0x7628('0x3d')]!=='talking'){_0x523276[_0x7628('0x3d')]=_0x7628('0xf');}}else{_0x523276[_0x255a71+_0x7628('0x3e')]='pause';}}});}return _0x523276;});})[_0x7628('0x11')](function(_0x466d97){if(!_0x1d913d||_0x214f4e){return _0x466d97;}return rta['sortAgentsByStatus'](_0x466d97,_0x1d913d);})['then'](function(_0x38e79d){var _0xf87bb5=rta['getRealtimeAgentsQueryFields']();_0xc02965[_0x7628('0x1e')]=_0x38e79d['map'](function(_0x78c4a0){return _['pick'](_0x78c4a0,_0xf87bb5);});return _0xc02965;})[_0x7628('0x11')](respondWithFilteredResult(_0x14793f,_0x618225))[_0x7628('0x3f')](APIHandleError(_0x14793f));};exports[_0x7628('0x40')]=function(_0x471b57,_0xe372c1){var _0xa1d015={'count':0x0,'rows':[]};var _0x4ebf53={};var _0x2dd9fc;var _0x1e3873;var _0x31cd0c;Promise[_0x7628('0x41')]()['then'](function(){if(_0x471b57['query'][_0x7628('0x12')]){if(!utils[_0x7628('0x13')](_0x471b57['query']['channel'])){throw new APIBadRequestError(util[_0x7628('0x14')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x471b57[_0x7628('0xc')][_0x7628('0x12')]));}_0x2dd9fc=_0x471b57[_0x7628('0xc')]['channel']['toLowerCase']();}var _0xae0b8b=_['startCase'](_0x2dd9fc)+_0x7628('0x42');var _0x4521f1=_['map'](db[_0xae0b8b][_0x7628('0x24')],function(_0x56598b){return{'name':_0x56598b['fieldName'],'type':_0x56598b[_0x7628('0x43')][_0x7628('0x26')]};});if(!_0x471b57[_0x7628('0xc')]['fields']){var _0x33c4a6=['id',_0x7628('0x44')];if(_0x2dd9fc==='voice'){_0x33c4a6[_0x7628('0x2d')]('type');if(_0x471b57[_0x7628('0xc')][_0x7628('0x43')]===_0x7628('0x45')){_0x33c4a6[_0x7628('0x2d')]([_0x7628('0x46'),'dialMethod']);}}_0x471b57[_0x7628('0xc')]['fields']=_0x33c4a6['join'](',');}_0x4ebf53=qs[_0x7628('0x47')](_0x4521f1,_0x471b57);if(_0x471b57['user']['role']===_0x7628('0x2f')){var _0x421e14={'params':{'id':_0x471b57['user']['userProfileId']},'query':{'section':_0x2dd9fc==='voice'&&_0x471b57['query'][_0x7628('0x43')]===_0x7628('0x45')?'QueueCampaigns':_[_0x7628('0x48')](_0x2dd9fc)+_0x7628('0x49'),'type':_0x471b57['query'][_0x7628('0x43')],'nolimit':!![],'sort':_0x7628('0x44'),'filter':_0x471b57[_0x7628('0xc')][_0x7628('0x4a')]}};_0x421e14[_0x7628('0xc')]=Object[_0x7628('0x35')](_0x421e14[_0x7628('0xc')],_0x471b57[_0x7628('0xc')]);delete _0x421e14[_0x7628('0xc')]['id'];return db[_0x7628('0x4b')][_0x7628('0x4c')](_0x421e14);}return db[_0xae0b8b][_0x7628('0x4d')](_0x4ebf53);})[_0x7628('0x11')](function(_0x55e38f){_0xa1d015[_0x7628('0x7')]=_0x55e38f[_0x7628('0x7')];_0x1e3873=_0x55e38f[_0x7628('0x1e')];return rtq['getRealtimeQueues'](_0x471b57,_0x2dd9fc);})[_0x7628('0x11')](function(_0x3fcfe9){_0x31cd0c=_0x3fcfe9[_0x7628('0x1e')];return rtq[_0x7628('0x4e')](_0x1e3873,_0x31cd0c,_0x2dd9fc,_0x471b57[_0x7628('0xc')][_0x7628('0x43')]);})[_0x7628('0x11')](function(_0x2b46cd){_0xa1d015[_0x7628('0x1e')]=_0x2b46cd;return _0xa1d015;})[_0x7628('0x11')](respondWithFilteredResult(_0xe372c1,_0x4ebf53))['catch'](APIHandleError(_0xe372c1));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9329be3..a6910e1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x52dbd1,_0xe46f69){var _0x58c76a=function(_0x35bff0){while(--_0x35bff0){_0x52dbd1['push'](_0x52dbd1['shift']());}};_0x58c76a(++_0xe46f69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x289190,_0x2c00a2){var _0x2c63ab=function(_0x287e06){while(--_0x287e06){_0x289190['push'](_0x289190['shift']());}};_0x2c63ab(++_0x2c00a2);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 57c6e5f..abf3a7b 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 _0x7217=['STRING','DATE','sequelize','INTEGER'];(function(_0x26abbb,_0xce92dd){var _0x4fc77f=function(_0x1d8c33){while(--_0x1d8c33){_0x26abbb['push'](_0x26abbb['shift']());}};_0x4fc77f(++_0xce92dd);}(_0x7217,0x19e));var _0x7721=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7217[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'state':{'type':Sequelize[_0x7721('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7721('0x2')]},'scheduledat':{'type':Sequelize[_0x7721('0x3')]},'uniqueid':{'type':Sequelize[_0x7721('0x2')]},'starttime':{'type':Sequelize[_0x7721('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7721('0x2')]},'campaigntype':{'type':Sequelize[_0x7721('0x2')]},'membername':{'type':Sequelize[_0x7721('0x2')]}}; \ No newline at end of file +var _0x7278=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x145556,_0x2a2625){var _0x30b5c0=function(_0x38fb78){while(--_0x38fb78){_0x145556['push'](_0x145556['shift']());}};_0x30b5c0(++_0x2a2625);}(_0x7278,0x161));var _0x8727=function(_0x225681,_0x1348e7){_0x225681=_0x225681-0x0;var _0x1d26ee=_0x7278[_0x225681];return _0x1d26ee;};'use strict';var Sequelize=require(_0x8727('0x0'));module[_0x8727('0x1')]={'state':{'type':Sequelize[_0x8727('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8727('0x3')]},'scheduledat':{'type':Sequelize[_0x8727('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8727('0x4')]},'responsetime':{'type':Sequelize[_0x8727('0x4')]},'ringtime':{'type':Sequelize[_0x8727('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8727('0x3')]},'campaigntype':{'type':Sequelize[_0x8727('0x3')]},'membername':{'type':Sequelize[_0x8727('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 1ee4a5c..ca6f1cb 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 _0x4ffa=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview','../../config/logger','api','moment','bluebird'];(function(_0x533b90,_0x4352f3){var _0x210919=function(_0x383bb9){while(--_0x383bb9){_0x533b90['push'](_0x533b90['shift']());}};_0x210919(++_0x4352f3);}(_0x4ffa,0x1ca));var _0xa4ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ffa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4ff('0x0'))(_0xa4ff('0x1'));var moment=require(_0xa4ff('0x2'));var BPromise=require(_0xa4ff('0x3'));var rp=require(_0xa4ff('0x4'));var fs=require('fs');var path=require(_0xa4ff('0x5'));var rimraf=require(_0xa4ff('0x6'));var config=require(_0xa4ff('0x7'));var attributes=require(_0xa4ff('0x8'));module['exports']=function(_0x57124b,_0x2d4b1d){return _0x57124b[_0xa4ff('0x9')]('ReportAgentPreview',attributes,{'tableName':_0xa4ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11b4=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','util'];(function(_0x21b3e0,_0x32be94){var _0x3043fe=function(_0x2980cb){while(--_0x2980cb){_0x21b3e0['push'](_0x21b3e0['shift']());}};_0x3043fe(++_0x32be94);}(_0x11b4,0x197));var _0x411b=function(_0x359108,_0x26a371){_0x359108=_0x359108-0x0;var _0x56d60d=_0x11b4[_0x359108];return _0x56d60d;};'use strict';var _=require('lodash');var util=require(_0x411b('0x0'));var logger=require(_0x411b('0x1'))(_0x411b('0x2'));var moment=require(_0x411b('0x3'));var BPromise=require(_0x411b('0x4'));var rp=require(_0x411b('0x5'));var fs=require('fs');var path=require(_0x411b('0x6'));var rimraf=require('rimraf');var config=require(_0x411b('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x411b('0x8')]=function(_0x59f530,_0x5a8adb){return _0x59f530[_0x411b('0x9')](_0x411b('0xa'),attributes,{'tableName':_0x411b('0xb'),'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 f43dd94..63250fd 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 _0xc20d=['../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','body','options','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc20d,0x1b3));var _0xdc20=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xc20d[_0x3f4891];return _0x54f2d8;};'use strict';var _=require('lodash');var util=require(_0xdc20('0x0'));var moment=require(_0xdc20('0x1'));var BPromise=require(_0xdc20('0x2'));var rs=require(_0xdc20('0x3'));var fs=require('fs');var Redis=require(_0xdc20('0x4'));var db=require(_0xdc20('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc20('0x6'));var config=require(_0xdc20('0x7'));var jayson=require(_0xdc20('0x8'));var client=jayson[_0xdc20('0x9')][_0xdc20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3046c9,_0x19e1c5,_0xd0a871){return new BPromise(function(_0x3600a7,_0x5f00d9){return client[_0xdc20('0xb')](_0x3046c9,_0xd0a871)[_0xdc20('0xc')](function(_0x177ae5){logger['info'](_0xdc20('0xd'),_0x19e1c5,_0xdc20('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x19e1c5,_0xdc20('0xe'),JSON[_0xdc20('0xf')](_0x177ae5));if(_0x177ae5['error']){if(_0x177ae5[_0xdc20('0x10')][_0xdc20('0x11')]===0x1f4){logger[_0xdc20('0x10')](_0xdc20('0xd'),_0x19e1c5,_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);return _0x5f00d9(_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);}logger[_0xdc20('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x19e1c5,_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);return _0x3600a7(_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);}else{logger[_0xdc20('0x13')](_0xdc20('0xd'),_0x19e1c5,'request\x20sent');_0x3600a7(_0x177ae5[_0xdc20('0x14')][_0xdc20('0x12')]);}})[_0xdc20('0x15')](function(_0x272420){logger[_0xdc20('0x10')](_0xdc20('0xd'),_0x19e1c5,_0x272420);_0x5f00d9(_0x272420);});});}exports[_0xdc20('0x16')]=function(_0x1bc036){var _0x1b8f0f=this;return new Promise(function(_0x1b1c07,_0x2ce286){return db['ReportAgentPreview']['create'](_0x1bc036[_0xdc20('0x17')],{'raw':_0x1bc036[_0xdc20('0x18')]?_0x1bc036[_0xdc20('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xdc20('0xc')](function(_0x4e036f){logger[_0xdc20('0x13')](_0xdc20('0x16'),_0x1bc036);logger[_0xdc20('0x19')](_0xdc20('0x16'),_0x1bc036,JSON[_0xdc20('0xf')](_0x4e036f));_0x1b1c07(_0x4e036f);})[_0xdc20('0x15')](function(_0x94d1e1){logger[_0xdc20('0x10')](_0xdc20('0x16'),_0x94d1e1[_0xdc20('0x12')],_0x1bc036);_0x2ce286(_0x1b8f0f[_0xdc20('0x10')](0x1f4,_0x94d1e1[_0xdc20('0x12')]));});});}; \ No newline at end of file +var _0x9b2e=['CreateReportAgentPreview','options','raw','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x9b2e,0x7c));var _0xe9b2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9b2e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xe9b2('0x0'));var moment=require('moment');var BPromise=require(_0xe9b2('0x1'));var rs=require(_0xe9b2('0x2'));var fs=require('fs');var Redis=require(_0xe9b2('0x3'));var db=require(_0xe9b2('0x4'))['db'];var utils=require(_0xe9b2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe9b2('0x6'));var jayson=require(_0xe9b2('0x7'));var client=jayson['client'][_0xe9b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fbae5,_0x3d201a,_0x531192){return new BPromise(function(_0x4dfe35,_0x1d03cd){return client['request'](_0x3fbae5,_0x531192)[_0xe9b2('0x9')](function(_0x73ba2a){logger['info'](_0xe9b2('0xa'),_0x3d201a,_0xe9b2('0xb'));logger[_0xe9b2('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3d201a,_0xe9b2('0xb'),JSON[_0xe9b2('0xd')](_0x73ba2a));if(_0x73ba2a[_0xe9b2('0xe')]){if(_0x73ba2a[_0xe9b2('0xe')]['code']===0x1f4){logger[_0xe9b2('0xe')](_0xe9b2('0xa'),_0x3d201a,_0x73ba2a['error'][_0xe9b2('0xf')]);return _0x1d03cd(_0x73ba2a[_0xe9b2('0xe')][_0xe9b2('0xf')]);}logger[_0xe9b2('0xe')](_0xe9b2('0xa'),_0x3d201a,_0x73ba2a[_0xe9b2('0xe')][_0xe9b2('0xf')]);return _0x4dfe35(_0x73ba2a[_0xe9b2('0xe')][_0xe9b2('0xf')]);}else{logger['info'](_0xe9b2('0xa'),_0x3d201a,_0xe9b2('0xb'));_0x4dfe35(_0x73ba2a['result']['message']);}})['catch'](function(_0x412632){logger[_0xe9b2('0xe')](_0xe9b2('0xa'),_0x3d201a,_0x412632);_0x1d03cd(_0x412632);});});}exports[_0xe9b2('0x10')]=function(_0x30b280){var _0x586009=this;return new Promise(function(_0x53e3a0,_0x4205a9){return db['ReportAgentPreview']['create'](_0x30b280['body'],{'raw':_0x30b280[_0xe9b2('0x11')]?_0x30b280[_0xe9b2('0x11')][_0xe9b2('0x12')]===undefined?!![]:![]:!![]})[_0xe9b2('0x9')](function(_0x55cfe6){logger['info'](_0xe9b2('0x10'),_0x30b280);logger[_0xe9b2('0xc')](_0xe9b2('0x10'),_0x30b280,JSON[_0xe9b2('0xd')](_0x55cfe6));_0x53e3a0(_0x55cfe6);})[_0xe9b2('0x13')](function(_0x489267){logger[_0xe9b2('0xe')]('CreateReportAgentPreview',_0x489267[_0xe9b2('0xf')],_0x30b280);_0x4205a9(_0x586009[_0xe9b2('0xe')](0x1f4,_0x489267[_0xe9b2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 97cb178..158aa79 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 _0xe5e6=['/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues'];(function(_0xc1ecf9,_0x52f5af){var _0x4f5829=function(_0x3c375f){while(--_0x3c375f){_0xc1ecf9['push'](_0xc1ecf9['shift']());}};_0x4f5829(++_0x52f5af);}(_0xe5e6,0x158));var _0x6e5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe5e6[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6e5e('0x0'));var util=require(_0x6e5e('0x1'));var path=require(_0x6e5e('0x2'));var express=require(_0x6e5e('0x3'));var router=express[_0x6e5e('0x4')]();var auth=require(_0x6e5e('0x5'));var controller=require('./rpc.controller');router[_0x6e5e('0x6')](_0x6e5e('0x7'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x9')]);router[_0x6e5e('0x6')](_0x6e5e('0xa'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0xb')]);router[_0x6e5e('0x6')](_0x6e5e('0xc'),auth['isAuthenticated'](),controller[_0x6e5e('0xd')]);router['get'](_0x6e5e('0xe'),auth[_0x6e5e('0x8')](),controller['voiceQueues']);router[_0x6e5e('0x6')](_0x6e5e('0xf'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x10')]);router[_0x6e5e('0x6')](_0x6e5e('0x11'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x12')]);router['get'](_0x6e5e('0x13'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x14')]);router[_0x6e5e('0x6')]('/openchannel/queues',auth[_0x6e5e('0x8')](),controller['openchannelQueues']);router['get'](_0x6e5e('0x15'),auth['isAuthenticated'](),controller[_0x6e5e('0x16')]);router[_0x6e5e('0x6')](_0x6e5e('0x17'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x18')]);router[_0x6e5e('0x6')]('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0x6e5e('0x6')](_0x6e5e('0x19'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x1a')]);router[_0x6e5e('0x6')](_0x6e5e('0x1b'),auth['isAuthenticated'](),controller[_0x6e5e('0x1c')]);router[_0x6e5e('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x6e5e('0x8')](),controller['voiceQueuesChannel']);router['get'](_0x6e5e('0x1d'),auth['isAuthenticated'](),controller[_0x6e5e('0x1e')]);router[_0x6e5e('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x6e5e('0x1f')]);router[_0x6e5e('0x6')]('/voice/queues/:id',auth[_0x6e5e('0x8')](),controller['showVoiceQueues']);router['put'](_0x6e5e('0x20'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x6e5e('0x6')](_0x6e5e('0x21'),auth[_0x6e5e('0x8')](),controller['outbound']);router[_0x6e5e('0x6')](_0x6e5e('0x22'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x23')]);router[_0x6e5e('0x6')](_0x6e5e('0x24'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x25')]);router['put'](_0x6e5e('0x26'),auth['isAuthenticated'](),controller[_0x6e5e('0x27')]);router[_0x6e5e('0x6')](_0x6e5e('0x28'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x29')]);router[_0x6e5e('0x6')](_0x6e5e('0x2a'),auth[_0x6e5e('0x8')](),controller['trunks']);router[_0x6e5e('0x6')](_0x6e5e('0x2b'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x2c')]);router[_0x6e5e('0x6')](_0x6e5e('0x2d'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x2e')]);router[_0x6e5e('0x6')](_0x6e5e('0x2f'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x30')]);router[_0x6e5e('0x6')](_0x6e5e('0x31'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x32')]);router[_0x6e5e('0x6')](_0x6e5e('0x33'),auth['isAuthenticated'](),controller[_0x6e5e('0x34')]);router[_0x6e5e('0x6')](_0x6e5e('0x35'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x36')]);router[_0x6e5e('0x6')]('/sms/queues/waitinginteractions',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x37')]);router[_0x6e5e('0x6')](_0x6e5e('0x38'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x39')]);router[_0x6e5e('0x6')](_0x6e5e('0x3a'),auth['isAuthenticated'](),controller[_0x6e5e('0x3b')]);router[_0x6e5e('0x3c')](_0x6e5e('0x3d'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x3e')](_0x6e5e('0x3f')));router[_0x6e5e('0x6')](_0x6e5e('0x40'),auth['isAuthenticated'](),controller[_0x6e5e('0x41')]);router['post']('/chat/queues/:id/notify',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x3e')](_0x6e5e('0x42')));router[_0x6e5e('0x6')](_0x6e5e('0x43'),auth['isAuthenticated'](),controller[_0x6e5e('0x44')]);router['post'](_0x6e5e('0x45'),auth['isAuthenticated'](),controller[_0x6e5e('0x3e')]('fax'));router['get']('/fax/queues/:id',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x46')]);router['post'](_0x6e5e('0x47'),auth[_0x6e5e('0x8')](),controller['queueNotify'](_0x6e5e('0x48')));router[_0x6e5e('0x6')](_0x6e5e('0x49'),auth[_0x6e5e('0x8')](),controller['showOpenchannelQueues']);router[_0x6e5e('0x3c')](_0x6e5e('0x4a'),auth['isAuthenticated'](),controller[_0x6e5e('0x3e')](_0x6e5e('0x4b')));router[_0x6e5e('0x3c')](_0x6e5e('0x4c'),auth[_0x6e5e('0x8')](),controller['queueNotify'](_0x6e5e('0x4d')));router['get'](_0x6e5e('0x4e'),auth[_0x6e5e('0x8')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x4f')]);router[_0x6e5e('0x3c')](_0x6e5e('0x50'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x51')]);module[_0x6e5e('0x52')]=router; \ No newline at end of file +var _0xc7a4=['faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/agents','agentCapacity','/trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0xc7a4,0xad));var _0x4c7a=function(_0x4064cc,_0x5c940e){_0x4064cc=_0x4064cc-0x0;var _0x437437=_0xc7a4[_0x4064cc];return _0x437437;};'use strict';var multer=require(_0x4c7a('0x0'));var util=require(_0x4c7a('0x1'));var path=require(_0x4c7a('0x2'));var express=require(_0x4c7a('0x3'));var router=express[_0x4c7a('0x4')]();var auth=require(_0x4c7a('0x5'));var controller=require(_0x4c7a('0x6'));router[_0x4c7a('0x7')](_0x4c7a('0x8'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x4c7a('0x7')](_0x4c7a('0x9'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0xb')]);router['get'](_0x4c7a('0xc'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0xd')]);router['get']('/voice/queues',auth[_0x4c7a('0xa')](),controller[_0x4c7a('0xe')]);router[_0x4c7a('0x7')]('/chat/queues',auth[_0x4c7a('0xa')](),controller[_0x4c7a('0xf')]);router['get']('/mail/queues',auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x10')]);router['get'](_0x4c7a('0x11'),auth['isAuthenticated'](),controller[_0x4c7a('0x12')]);router['get'](_0x4c7a('0x13'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x14')]);router['get'](_0x4c7a('0x15'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x16')]);router['get'](_0x4c7a('0x17'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x18')]);router[_0x4c7a('0x7')]('/fax/queues',auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x19')]);router[_0x4c7a('0x7')](_0x4c7a('0x1a'),auth[_0x4c7a('0xa')](),controller['voiceQueuesPreview']);router['get'](_0x4c7a('0x1b'),auth['isAuthenticated'](),controller[_0x4c7a('0x1c')]);router[_0x4c7a('0x7')](_0x4c7a('0x1d'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x1e')]);router[_0x4c7a('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x1f')]);router[_0x4c7a('0x7')](_0x4c7a('0x20'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x21')]);router['get'](_0x4c7a('0x22'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x23')]);router[_0x4c7a('0x24')](_0x4c7a('0x22'),auth['isAuthenticated'](),controller[_0x4c7a('0x25')]);router[_0x4c7a('0x7')](_0x4c7a('0x26'),auth[_0x4c7a('0xa')](),controller['outbound']);router[_0x4c7a('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller['outboundChannels']);router[_0x4c7a('0x7')](_0x4c7a('0x27'),auth['isAuthenticated'](),controller['agents']);router[_0x4c7a('0x24')]('/agents/:id/capacity',auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x28')]);router['get']('/telephones',auth[_0x4c7a('0xa')](),controller['telephones']);router[_0x4c7a('0x7')](_0x4c7a('0x29'),auth[_0x4c7a('0xa')](),controller['trunks']);router[_0x4c7a('0x7')](_0x4c7a('0x2a'),auth[_0x4c7a('0xa')](),controller['campaigns']);router[_0x4c7a('0x7')](_0x4c7a('0x2b'),auth[_0x4c7a('0xa')](),controller['faxAccounts']);router[_0x4c7a('0x7')](_0x4c7a('0x2c'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x4c7a('0x7')](_0x4c7a('0x2d'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x2e')]);router[_0x4c7a('0x7')](_0x4c7a('0x2f'),auth['isAuthenticated'](),controller[_0x4c7a('0x30')]);router[_0x4c7a('0x7')](_0x4c7a('0x31'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x4c7a('0x7')](_0x4c7a('0x32'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x33')]);router[_0x4c7a('0x7')](_0x4c7a('0x34'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x35')]);router[_0x4c7a('0x7')](_0x4c7a('0x36'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x37')]);router[_0x4c7a('0x38')](_0x4c7a('0x39'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x3a')](_0x4c7a('0x3b')));router['get'](_0x4c7a('0x3c'),auth[_0x4c7a('0xa')](),controller['showMailQueues']);router['post'](_0x4c7a('0x3d'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x3a')]('chat'));router[_0x4c7a('0x7')]('/chat/queues/:id',auth[_0x4c7a('0xa')](),controller['showChatQueues']);router[_0x4c7a('0x38')](_0x4c7a('0x3e'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x3a')](_0x4c7a('0x3f')));router[_0x4c7a('0x7')](_0x4c7a('0x40'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x4c7a('0x38')](_0x4c7a('0x41'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x3a')]('openchannel'));router[_0x4c7a('0x7')](_0x4c7a('0x42'),auth['isAuthenticated'](),controller[_0x4c7a('0x43')]);router[_0x4c7a('0x38')](_0x4c7a('0x44'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x3a')](_0x4c7a('0x45')));router[_0x4c7a('0x38')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x4c7a('0x46')));router['get'](_0x4c7a('0x47'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x48')]);router[_0x4c7a('0x7')](_0x4c7a('0x49'),auth[_0x4c7a('0xa')](),controller[_0x4c7a('0x4a')]);router[_0x4c7a('0x38')]('/agents/:id/notify',auth[_0x4c7a('0xa')](),controller['agentNotify']);module[_0x4c7a('0x4b')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 2dc1d4d..ff69fbd 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 _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x2507b6,_0x2d059a){var _0x22c8a4=function(_0x3deebb){while(--_0x3deebb){_0x2507b6['push'](_0x2507b6['shift']());}};_0x22c8a4(++_0x2d059a);}(_0xb10b,0x12a));var _0xbb10=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0xb10b[_0x190681];return _0x4f2ada;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x316594,_0x39b01a){var _0x585dd7=function(_0x3a7ead){while(--_0x3a7ead){_0x316594['push'](_0x316594['shift']());}};_0x585dd7(++_0x39b01a);}(_0xe706,0xa3));var _0x6e70=function(_0x2b192e,_0x28ec8a){_0x2b192e=_0x2b192e-0x0;var _0x3478b5=_0xe706[_0x2b192e];return _0x3478b5;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0503b2e..57ba54e 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 _0xcf13=['update','/:id','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','index','isAuthenticated','show','/:id/run','run','post','put'];(function(_0x2bb625,_0xf8de66){var _0x14696a=function(_0x4bc92c){while(--_0x4bc92c){_0x2bb625['push'](_0x2bb625['shift']());}};_0x14696a(++_0xf8de66);}(_0xcf13,0xe0));var _0x3cf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3cf1('0x0'));var util=require(_0x3cf1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3cf1('0x2'));var router=express[_0x3cf1('0x3')]();var fs_extra=require(_0x3cf1('0x4'));var auth=require(_0x3cf1('0x5'));var interaction=require(_0x3cf1('0x6'));var config=require('../../config/environment');var controller=require(_0x3cf1('0x7'));router[_0x3cf1('0x8')]('/',auth['isAuthenticated'](),controller[_0x3cf1('0x9')]);router['get']('/:id',auth[_0x3cf1('0xa')](),controller[_0x3cf1('0xb')]);router[_0x3cf1('0x8')](_0x3cf1('0xc'),auth['isAuthenticated'](),controller[_0x3cf1('0xd')]);router[_0x3cf1('0xe')]('/',auth[_0x3cf1('0xa')](),controller['create']);router[_0x3cf1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3cf1('0x10')]);router['delete'](_0x3cf1('0x11'),auth[_0x3cf1('0xa')](),controller[_0x3cf1('0x12')]);module[_0x3cf1('0x13')]=router; \ No newline at end of file +var _0xdc48=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/run','run','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4b6804,_0x301b24){var _0x11b4f1=function(_0x31e66c){while(--_0x31e66c){_0x4b6804['push'](_0x4b6804['shift']());}};_0x11b4f1(++_0x301b24);}(_0xdc48,0xa1));var _0x8dc4=function(_0x372b5a,_0x5d3393){_0x372b5a=_0x372b5a-0x0;var _0x43ac01=_0xdc48[_0x372b5a];return _0x43ac01;};'use strict';var multer=require(_0x8dc4('0x0'));var util=require(_0x8dc4('0x1'));var path=require(_0x8dc4('0x2'));var timeout=require(_0x8dc4('0x3'));var express=require(_0x8dc4('0x4'));var router=express[_0x8dc4('0x5')]();var fs_extra=require(_0x8dc4('0x6'));var auth=require(_0x8dc4('0x7'));var interaction=require(_0x8dc4('0x8'));var config=require(_0x8dc4('0x9'));var controller=require('./schedule.controller');router[_0x8dc4('0xa')]('/',auth[_0x8dc4('0xb')](),controller[_0x8dc4('0xc')]);router[_0x8dc4('0xa')](_0x8dc4('0xd'),auth[_0x8dc4('0xb')](),controller['show']);router[_0x8dc4('0xa')](_0x8dc4('0xe'),auth[_0x8dc4('0xb')](),controller[_0x8dc4('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8dc4('0x10')]);router[_0x8dc4('0x11')](_0x8dc4('0xd'),auth[_0x8dc4('0xb')](),controller[_0x8dc4('0x12')]);router[_0x8dc4('0x13')](_0x8dc4('0xd'),auth[_0x8dc4('0xb')](),controller['destroy']);module[_0x8dc4('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 1b8cc1a..e00e9e5 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 _0x55a4=['days','hours','minutes','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0x10699e,_0x4f8055){var _0x3181ae=function(_0x307c34){while(--_0x307c34){_0x10699e['push'](_0x10699e['shift']());}};_0x3181ae(++_0x4f8055);}(_0x55a4,0xbb));var _0x455a=function(_0x34ac3d,_0x289201){_0x34ac3d=_0x34ac3d-0x0;var _0x216857=_0x55a4[_0x34ac3d];return _0x216857;};'use strict';var Sequelize=require(_0x455a('0x0'));module[_0x455a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x455a('0x2')]},'active':{'type':Sequelize[_0x455a('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x455a('0x2')],'allowNull':![],'defaultValue':_0x455a('0x4')},'startAt':{'type':Sequelize[_0x455a('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x455a('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x455a('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x455a('0x7')](_0x455a('0x8'),_0x455a('0x9'),_0x455a('0xa'),'weeks',_0x455a('0xb'),_0x455a('0xc'),_0x455a('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x455a('0x7')](_0x455a('0xe'),_0x455a('0xf'),'xlsx'),'allowNull':![],'defaultValue':_0x455a('0xe')},'type':{'type':Sequelize[_0x455a('0x7')](_0x455a('0x10'),'default'),'allowNull':![],'defaultValue':_0x455a('0x10')},'sendMail':{'type':Sequelize[_0x455a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x455a('0x2')]},'cc':{'type':Sequelize[_0x455a('0x11')]},'bcc':{'type':Sequelize[_0x455a('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x455a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdedd=['months','weeks','days','hours','pdf','xlsx','csv','custom','default','BOOLEAN','TEXT','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0xdedd,0x14f));var _0xdded=function(_0x29b5a2,_0x5602fe){_0x29b5a2=_0x29b5a2-0x0;var _0x21de06=_0xdedd[_0x29b5a2];return _0x21de06;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdded('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xdded('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdded('0x0')],'allowNull':![],'defaultValue':_0xdded('0x1')},'startAt':{'type':Sequelize[_0xdded('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0xdded('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdded('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdded('0x4')](_0xdded('0x5'),_0xdded('0x6'),_0xdded('0x7'),_0xdded('0x8'),_0xdded('0x9'),_0xdded('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xdded('0x4')]('csv',_0xdded('0xb'),_0xdded('0xc')),'allowNull':![],'defaultValue':_0xdded('0xd')},'type':{'type':Sequelize[_0xdded('0x4')](_0xdded('0xe'),_0xdded('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xdded('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xdded('0x0')]},'cc':{'type':Sequelize[_0xdded('0x11')]},'bcc':{'type':Sequelize[_0xdded('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xdded('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 5714859..36f899f 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 _0xdd9c=['status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xdd9c,0xee));var _0xcdd9=function(_0x3213c2,_0x3fb44e){_0x3213c2=_0x3213c2-0x0;var _0x381092=_0xdd9c[_0x3213c2];return _0x381092;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcdd9('0x0'));var jsonpatch=require(_0xcdd9('0x1'));var rp=require(_0xcdd9('0x2'));var moment=require(_0xcdd9('0x3'));var BPromise=require(_0xcdd9('0x4'));var Mustache=require(_0xcdd9('0x5'));var util=require(_0xcdd9('0x6'));var path=require('path');var sox=require(_0xcdd9('0x7'));var csv=require(_0xcdd9('0x8'));var ejs=require(_0xcdd9('0x9'));var fs=require('fs');var fs_extra=require(_0xcdd9('0xa'));var _=require(_0xcdd9('0xb'));var squel=require(_0xcdd9('0xc'));var crypto=require(_0xcdd9('0xd'));var jsforce=require(_0xcdd9('0xe'));var deskjs=require(_0xcdd9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcdd9('0x10'));var Papa=require(_0xcdd9('0x11'));var Redis=require(_0xcdd9('0x12'));var authService=require(_0xcdd9('0x13'));var qs=require(_0xcdd9('0x14'));var as=require(_0xcdd9('0x15'));var hardwareService=require(_0xcdd9('0x16'));var logger=require(_0xcdd9('0x17'))(_0xcdd9('0x18'));var utils=require(_0xcdd9('0x19'));var config=require(_0xcdd9('0x1a'));var licenseUtil=require(_0xcdd9('0x1b'));var db=require(_0xcdd9('0x1c'))['db'];function respondWithStatusCode(_0x11b3da,_0x3c730a){_0x3c730a=_0x3c730a||0xcc;return function(_0xaf4488){if(_0xaf4488){return _0x11b3da['sendStatus'](_0x3c730a);}return _0x11b3da[_0xcdd9('0x1d')](_0x3c730a)[_0xcdd9('0x1e')]();};}function respondWithResult(_0x4b1118,_0x365c58){_0x365c58=_0x365c58||0xc8;return function(_0x529bca){if(_0x529bca){return _0x4b1118['status'](_0x365c58)[_0xcdd9('0x1f')](_0x529bca);}};}function respondWithFilteredResult(_0x2e3d6e,_0x3a587a){return function(_0x1a569e){if(_0x1a569e){var _0x52f899=typeof _0x3a587a[_0xcdd9('0x20')]===_0xcdd9('0x21')&&typeof _0x3a587a['limit']===_0xcdd9('0x21');var _0x38f787=_0x1a569e[_0xcdd9('0x22')];var _0x418091=_0x52f899?0x0:_0x3a587a[_0xcdd9('0x20')];var _0x15f41b=_0x52f899?_0x1a569e['count']:_0x3a587a[_0xcdd9('0x20')]+_0x3a587a['limit'];var _0x2a0a49;if(_0x15f41b>=_0x38f787){_0x15f41b=_0x38f787;_0x2a0a49=0xc8;}else{_0x2a0a49=0xce;}_0x2e3d6e[_0xcdd9('0x1d')](_0x2a0a49);return _0x2e3d6e[_0xcdd9('0x23')](_0xcdd9('0x24'),_0x418091+'-'+_0x15f41b+'/'+_0x38f787)[_0xcdd9('0x1f')](_0x1a569e);}return null;};}function patchUpdates(_0x4ac143){return function(_0x426761){try{jsonpatch['apply'](_0x426761,_0x4ac143,!![]);}catch(_0x1f0a5c){return BPromise[_0xcdd9('0x25')](_0x1f0a5c);}return _0x426761[_0xcdd9('0x26')]();};}function saveUpdates(_0x4a6e47,_0x298a82){return function(_0x66b1f2){if(_0x66b1f2){return _0x66b1f2[_0xcdd9('0x27')](_0x4a6e47)[_0xcdd9('0x28')](function(_0x3a476c){return _0x3a476c;});}return null;};}function removeEntity(_0x485a64,_0x1eb7fa){return function(_0x473fe7){if(_0x473fe7){return _0x473fe7[_0xcdd9('0x29')]()['then'](function(){var _0x41fe0c=_0x473fe7['get']({'plain':!![]});var _0x3e64e8=_0xcdd9('0x2a');return db[_0xcdd9('0x2b')][_0xcdd9('0x29')]({'where':{'type':_0x3e64e8,'resourceId':_0x41fe0c['id']}})['then'](function(){return _0x473fe7;});})[_0xcdd9('0x28')](function(){_0x485a64[_0xcdd9('0x1d')](0xcc)[_0xcdd9('0x1e')]();});}};}function handleEntityNotFound(_0x279c96,_0x748cdb){return function(_0x27389d){if(!_0x27389d){_0x279c96['sendStatus'](0x194);}return _0x27389d;};}function handleError(_0x1ee9fa,_0x4c1e59){_0x4c1e59=_0x4c1e59||0x1f4;return function(_0x4a9ac5){logger[_0xcdd9('0x2c')](_0x4a9ac5['stack']);if(_0x4a9ac5[_0xcdd9('0x2d')]){delete _0x4a9ac5[_0xcdd9('0x2d')];}_0x1ee9fa[_0xcdd9('0x1d')](_0x4c1e59)['send'](_0x4a9ac5);};}exports[_0xcdd9('0x2e')]=function(_0x2fc93b,_0x3974e9){var _0x518fb9={},_0x3fa536={},_0x16862b={'count':0x0,'rows':[]};var _0x2b728a=_[_0xcdd9('0x2f')](db['Schedule'][_0xcdd9('0x30')],function(_0x422d08){return{'name':_0x422d08[_0xcdd9('0x31')],'type':_0x422d08[_0xcdd9('0x32')][_0xcdd9('0x33')]};});_0x3fa536[_0xcdd9('0x34')]=_[_0xcdd9('0x2f')](_0x2b728a,_0xcdd9('0x2d'));_0x3fa536[_0xcdd9('0x35')]=_[_0xcdd9('0x36')](_0x2fc93b[_0xcdd9('0x35')]);_0x3fa536[_0xcdd9('0x37')]=_[_0xcdd9('0x38')](_0x3fa536[_0xcdd9('0x34')],_0x3fa536['query']);_0x518fb9[_0xcdd9('0x39')]=_[_0xcdd9('0x38')](_0x3fa536[_0xcdd9('0x34')],qs[_0xcdd9('0x3a')](_0x2fc93b['query']['fields']));_0x518fb9['attributes']=_0x518fb9[_0xcdd9('0x39')]['length']?_0x518fb9[_0xcdd9('0x39')]:_0x3fa536[_0xcdd9('0x34')];if(!_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x3b')](_0xcdd9('0x3c'))){_0x518fb9[_0xcdd9('0x3d')]=qs[_0xcdd9('0x3d')](_0x2fc93b['query'][_0xcdd9('0x3d')]);_0x518fb9[_0xcdd9('0x20')]=qs[_0xcdd9('0x20')](_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x20')]);}_0x518fb9[_0xcdd9('0x3e')]=qs[_0xcdd9('0x3f')](_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x3f')]);_0x518fb9[_0xcdd9('0x40')]=qs[_0xcdd9('0x37')](_['pick'](_0x2fc93b[_0xcdd9('0x35')],_0x3fa536['filters']),_0x2b728a);if(_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x41')]){_0x518fb9[_0xcdd9('0x40')]=_['merge'](_0x518fb9[_0xcdd9('0x40')],{'$or':_[_0xcdd9('0x2f')](_0x2b728a,function(_0x3acd21){if(_0x3acd21[_0xcdd9('0x32')]!==_0xcdd9('0x42')){var _0x272b81={};_0x272b81[_0x3acd21['name']]={'$like':'%'+_0x2fc93b['query'][_0xcdd9('0x41')]+'%'};return _0x272b81;}})});}_0x518fb9=_[_0xcdd9('0x43')]({},_0x518fb9,_0x2fc93b[_0xcdd9('0x44')]);var _0x3a2471={'where':_0x518fb9[_0xcdd9('0x40')]};return db[_0xcdd9('0x45')][_0xcdd9('0x22')](_0x3a2471)[_0xcdd9('0x28')](function(_0x5ad57b){_0x16862b[_0xcdd9('0x22')]=_0x5ad57b;if(_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x46')]){_0x518fb9[_0xcdd9('0x47')]=[{'all':!![]}];}return db['Schedule'][_0xcdd9('0x48')](_0x518fb9);})[_0xcdd9('0x28')](function(_0x49729e){_0x16862b[_0xcdd9('0x49')]=_0x49729e;return _0x16862b;})[_0xcdd9('0x28')](respondWithFilteredResult(_0x3974e9,_0x518fb9))[_0xcdd9('0x4a')](handleError(_0x3974e9,null));};exports[_0xcdd9('0x4b')]=function(_0x50a9f1,_0x230e9c){var _0x234263={'raw':![],'where':{'id':_0x50a9f1[_0xcdd9('0x4c')]['id']}},_0x4ecbd4={};_0x4ecbd4[_0xcdd9('0x34')]=_[_0xcdd9('0x36')](db[_0xcdd9('0x45')][_0xcdd9('0x30')]);_0x4ecbd4[_0xcdd9('0x35')]=_[_0xcdd9('0x36')](_0x50a9f1[_0xcdd9('0x35')]);_0x4ecbd4[_0xcdd9('0x37')]=_[_0xcdd9('0x38')](_0x4ecbd4[_0xcdd9('0x34')],_0x4ecbd4[_0xcdd9('0x35')]);_0x234263['attributes']=_[_0xcdd9('0x38')](_0x4ecbd4['model'],qs[_0xcdd9('0x3a')](_0x50a9f1['query'][_0xcdd9('0x3a')]));_0x234263[_0xcdd9('0x39')]=_0x234263['attributes'][_0xcdd9('0x4d')]?_0x234263[_0xcdd9('0x39')]:_0x4ecbd4[_0xcdd9('0x34')];if(_0x50a9f1[_0xcdd9('0x35')][_0xcdd9('0x46')]){_0x234263[_0xcdd9('0x47')]=[{'all':!![]}];}_0x234263=_[_0xcdd9('0x43')]({},_0x234263,_0x50a9f1[_0xcdd9('0x44')]);return db[_0xcdd9('0x45')][_0xcdd9('0x4e')](_0x234263)['then'](handleEntityNotFound(_0x230e9c,null))[_0xcdd9('0x28')](respondWithResult(_0x230e9c,null))['catch'](handleError(_0x230e9c,null));};exports[_0xcdd9('0x4f')]=function(_0x2467c5,_0x4f46da){return db[_0xcdd9('0x45')]['create'](_0x2467c5[_0xcdd9('0x50')],{})[_0xcdd9('0x28')](function(_0x5d84c9){var _0x39db94=_0x2467c5[_0xcdd9('0x51')][_0xcdd9('0x52')]({'plain':!![]});if(!_0x39db94)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39db94[_0xcdd9('0x53')]==='user'){var _0x19df9d=_0x5d84c9[_0xcdd9('0x52')]({'plain':!![]});var _0x1acec7=_0xcdd9('0x2a');return db[_0xcdd9('0x54')]['find']({'where':{'name':_0x1acec7,'userProfileId':_0x39db94[_0xcdd9('0x55')]},'raw':!![]})['then'](function(_0x202e5c){if(_0x202e5c&&_0x202e5c['autoAssociation']===0x0){return db[_0xcdd9('0x2b')][_0xcdd9('0x4f')]({'name':_0x19df9d[_0xcdd9('0x2d')],'resourceId':_0x19df9d['id'],'type':_0x202e5c[_0xcdd9('0x2d')],'sectionId':_0x202e5c['id']},{})['then'](function(){return _0x5d84c9;});}else{return _0x5d84c9;}})[_0xcdd9('0x4a')](function(_0x2febb1){logger[_0xcdd9('0x2c')](_0xcdd9('0x56'),_0x2febb1);throw _0x2febb1;});}return _0x5d84c9;})[_0xcdd9('0x28')](respondWithResult(_0x4f46da,0xc9))[_0xcdd9('0x4a')](handleError(_0x4f46da,null));};exports[_0xcdd9('0x27')]=function(_0x548ec6,_0xb58b0e){if(_0x548ec6[_0xcdd9('0x50')]['id']){delete _0x548ec6['body']['id'];}return db[_0xcdd9('0x45')]['find']({'where':{'id':_0x548ec6[_0xcdd9('0x4c')]['id']}})[_0xcdd9('0x28')](handleEntityNotFound(_0xb58b0e,null))['then'](saveUpdates(_0x548ec6[_0xcdd9('0x50')],null))['then'](respondWithResult(_0xb58b0e,null))[_0xcdd9('0x4a')](handleError(_0xb58b0e,null));};exports[_0xcdd9('0x29')]=function(_0xf4004e,_0x62f891){return db[_0xcdd9('0x45')][_0xcdd9('0x4e')]({'where':{'id':_0xf4004e[_0xcdd9('0x4c')]['id']}})[_0xcdd9('0x28')](handleEntityNotFound(_0x62f891,null))[_0xcdd9('0x28')](removeEntity(_0x62f891,null))[_0xcdd9('0x4a')](handleError(_0x62f891,null));};exports['run']=function(_0x4ba91d,_0x4e222a,_0x47e0df){var _0x6c0a4e=require(_0xcdd9('0x57'));return db[_0xcdd9('0x45')][_0xcdd9('0x4e')]({'where':{'id':_0x4ba91d[_0xcdd9('0x4c')]['id']},'raw':!![]})[_0xcdd9('0x28')](handleEntityNotFound(_0x4e222a,null))['then'](function(){_0x6c0a4e[_0xcdd9('0x58')](_0x4ba91d[_0xcdd9('0x4c')]['id']);})[_0xcdd9('0x28')](respondWithStatusCode(_0x4e222a,null))[_0xcdd9('0x4a')](handleError(_0x4e222a,null));}; \ No newline at end of file +var _0x2ebb=['filter','merge','VIRTUAL','includeAll','include','rows','catch','show','length','options','find','create','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x47abb1,_0x3f5545){var _0x26ef7c=function(_0x1f7d42){while(--_0x1f7d42){_0x47abb1['push'](_0x47abb1['shift']());}};_0x26ef7c(++_0x3f5545);}(_0x2ebb,0x157));var _0xb2eb=function(_0xc60da5,_0x2904db){_0xc60da5=_0xc60da5-0x0;var _0x36d2ae=_0x2ebb[_0xc60da5];return _0x36d2ae;};'use strict';var emlformat=require(_0xb2eb('0x0'));var rimraf=require(_0xb2eb('0x1'));var zipdir=require(_0xb2eb('0x2'));var jsonpatch=require(_0xb2eb('0x3'));var rp=require(_0xb2eb('0x4'));var moment=require(_0xb2eb('0x5'));var BPromise=require(_0xb2eb('0x6'));var Mustache=require(_0xb2eb('0x7'));var util=require(_0xb2eb('0x8'));var path=require(_0xb2eb('0x9'));var sox=require(_0xb2eb('0xa'));var csv=require('to-csv');var ejs=require(_0xb2eb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2eb('0xc'));var squel=require(_0xb2eb('0xd'));var crypto=require('crypto');var jsforce=require(_0xb2eb('0xe'));var deskjs=require(_0xb2eb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb2eb('0x10'));var Papa=require('papaparse');var Redis=require(_0xb2eb('0x11'));var authService=require(_0xb2eb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2eb('0x13'));var hardwareService=require(_0xb2eb('0x14'));var logger=require(_0xb2eb('0x15'))('api');var utils=require(_0xb2eb('0x16'));var config=require(_0xb2eb('0x17'));var licenseUtil=require(_0xb2eb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38f973,_0x1d0267){_0x1d0267=_0x1d0267||0xcc;return function(_0xf6ce84){if(_0xf6ce84){return _0x38f973[_0xb2eb('0x19')](_0x1d0267);}return _0x38f973[_0xb2eb('0x1a')](_0x1d0267)[_0xb2eb('0x1b')]();};}function respondWithResult(_0x7465cf,_0x2f8fc8){_0x2f8fc8=_0x2f8fc8||0xc8;return function(_0x3f7ec1){if(_0x3f7ec1){return _0x7465cf[_0xb2eb('0x1a')](_0x2f8fc8)['json'](_0x3f7ec1);}};}function respondWithFilteredResult(_0x54fce2,_0x47cca9){return function(_0x4ed530){if(_0x4ed530){var _0x2fdead=typeof _0x47cca9[_0xb2eb('0x1c')]===_0xb2eb('0x1d')&&typeof _0x47cca9[_0xb2eb('0x1e')]===_0xb2eb('0x1d');var _0x5ec4fe=_0x4ed530[_0xb2eb('0x1f')];var _0x2533a7=_0x2fdead?0x0:_0x47cca9[_0xb2eb('0x1c')];var _0x575df1=_0x2fdead?_0x4ed530['count']:_0x47cca9[_0xb2eb('0x1c')]+_0x47cca9[_0xb2eb('0x1e')];var _0x54992a;if(_0x575df1>=_0x5ec4fe){_0x575df1=_0x5ec4fe;_0x54992a=0xc8;}else{_0x54992a=0xce;}_0x54fce2[_0xb2eb('0x1a')](_0x54992a);return _0x54fce2[_0xb2eb('0x20')](_0xb2eb('0x21'),_0x2533a7+'-'+_0x575df1+'/'+_0x5ec4fe)['json'](_0x4ed530);}return null;};}function patchUpdates(_0xbf06d0){return function(_0x447e5a){try{jsonpatch[_0xb2eb('0x22')](_0x447e5a,_0xbf06d0,!![]);}catch(_0x121a9c){return BPromise['reject'](_0x121a9c);}return _0x447e5a['save']();};}function saveUpdates(_0x1dbb3f,_0x5115e6){return function(_0x3892f1){if(_0x3892f1){return _0x3892f1['update'](_0x1dbb3f)[_0xb2eb('0x23')](function(_0x1479ae){return _0x1479ae;});}return null;};}function removeEntity(_0x2dc213,_0x476457){return function(_0xd4357b){if(_0xd4357b){return _0xd4357b[_0xb2eb('0x24')]()[_0xb2eb('0x23')](function(){var _0x4ee62b=_0xd4357b[_0xb2eb('0x25')]({'plain':!![]});var _0x49a297=_0xb2eb('0x26');return db[_0xb2eb('0x27')][_0xb2eb('0x24')]({'where':{'type':_0x49a297,'resourceId':_0x4ee62b['id']}})[_0xb2eb('0x23')](function(){return _0xd4357b;});})[_0xb2eb('0x23')](function(){_0x2dc213['status'](0xcc)[_0xb2eb('0x1b')]();});}};}function handleEntityNotFound(_0x703d73,_0xf6df09){return function(_0x25c96d){if(!_0x25c96d){_0x703d73[_0xb2eb('0x19')](0x194);}return _0x25c96d;};}function handleError(_0x225ae7,_0x310b19){_0x310b19=_0x310b19||0x1f4;return function(_0x34e359){logger['error'](_0x34e359[_0xb2eb('0x28')]);if(_0x34e359[_0xb2eb('0x29')]){delete _0x34e359['name'];}_0x225ae7[_0xb2eb('0x1a')](_0x310b19)[_0xb2eb('0x2a')](_0x34e359);};}exports[_0xb2eb('0x2b')]=function(_0x28cc9a,_0x213b16){var _0x72477f={},_0x243dc0={},_0x1dc70c={'count':0x0,'rows':[]};var _0x187099=_[_0xb2eb('0x2c')](db[_0xb2eb('0x2d')][_0xb2eb('0x2e')],function(_0x1ee334){return{'name':_0x1ee334[_0xb2eb('0x2f')],'type':_0x1ee334[_0xb2eb('0x30')][_0xb2eb('0x31')]};});_0x243dc0[_0xb2eb('0x32')]=_[_0xb2eb('0x2c')](_0x187099,_0xb2eb('0x29'));_0x243dc0[_0xb2eb('0x33')]=_[_0xb2eb('0x34')](_0x28cc9a['query']);_0x243dc0[_0xb2eb('0x35')]=_[_0xb2eb('0x36')](_0x243dc0[_0xb2eb('0x32')],_0x243dc0[_0xb2eb('0x33')]);_0x72477f[_0xb2eb('0x37')]=_[_0xb2eb('0x36')](_0x243dc0[_0xb2eb('0x32')],qs[_0xb2eb('0x38')](_0x28cc9a['query'][_0xb2eb('0x38')]));_0x72477f['attributes']=_0x72477f[_0xb2eb('0x37')]['length']?_0x72477f[_0xb2eb('0x37')]:_0x243dc0[_0xb2eb('0x32')];if(!_0x28cc9a['query'][_0xb2eb('0x39')](_0xb2eb('0x3a'))){_0x72477f[_0xb2eb('0x1e')]=qs[_0xb2eb('0x1e')](_0x28cc9a[_0xb2eb('0x33')]['limit']);_0x72477f['offset']=qs[_0xb2eb('0x1c')](_0x28cc9a[_0xb2eb('0x33')][_0xb2eb('0x1c')]);}_0x72477f['order']=qs[_0xb2eb('0x3b')](_0x28cc9a[_0xb2eb('0x33')][_0xb2eb('0x3b')]);_0x72477f[_0xb2eb('0x3c')]=qs[_0xb2eb('0x35')](_[_0xb2eb('0x3d')](_0x28cc9a[_0xb2eb('0x33')],_0x243dc0[_0xb2eb('0x35')]),_0x187099);if(_0x28cc9a[_0xb2eb('0x33')][_0xb2eb('0x3e')]){_0x72477f['where']=_[_0xb2eb('0x3f')](_0x72477f['where'],{'$or':_[_0xb2eb('0x2c')](_0x187099,function(_0x33da82){if(_0x33da82[_0xb2eb('0x30')]!==_0xb2eb('0x40')){var _0xcd247b={};_0xcd247b[_0x33da82[_0xb2eb('0x29')]]={'$like':'%'+_0x28cc9a['query'][_0xb2eb('0x3e')]+'%'};return _0xcd247b;}})});}_0x72477f=_[_0xb2eb('0x3f')]({},_0x72477f,_0x28cc9a['options']);var _0xee8c8e={'where':_0x72477f[_0xb2eb('0x3c')]};return db[_0xb2eb('0x2d')][_0xb2eb('0x1f')](_0xee8c8e)[_0xb2eb('0x23')](function(_0x4a9f81){_0x1dc70c[_0xb2eb('0x1f')]=_0x4a9f81;if(_0x28cc9a[_0xb2eb('0x33')][_0xb2eb('0x41')]){_0x72477f[_0xb2eb('0x42')]=[{'all':!![]}];}return db[_0xb2eb('0x2d')]['findAll'](_0x72477f);})[_0xb2eb('0x23')](function(_0x18b688){_0x1dc70c[_0xb2eb('0x43')]=_0x18b688;return _0x1dc70c;})['then'](respondWithFilteredResult(_0x213b16,_0x72477f))[_0xb2eb('0x44')](handleError(_0x213b16,null));};exports[_0xb2eb('0x45')]=function(_0x48b0f0,_0x41ec44){var _0x5e373f={'raw':![],'where':{'id':_0x48b0f0['params']['id']}},_0x2cf207={};_0x2cf207['model']=_['keys'](db[_0xb2eb('0x2d')]['rawAttributes']);_0x2cf207['query']=_[_0xb2eb('0x34')](_0x48b0f0[_0xb2eb('0x33')]);_0x2cf207[_0xb2eb('0x35')]=_[_0xb2eb('0x36')](_0x2cf207[_0xb2eb('0x32')],_0x2cf207[_0xb2eb('0x33')]);_0x5e373f['attributes']=_[_0xb2eb('0x36')](_0x2cf207['model'],qs[_0xb2eb('0x38')](_0x48b0f0[_0xb2eb('0x33')]['fields']));_0x5e373f[_0xb2eb('0x37')]=_0x5e373f[_0xb2eb('0x37')][_0xb2eb('0x46')]?_0x5e373f[_0xb2eb('0x37')]:_0x2cf207[_0xb2eb('0x32')];if(_0x48b0f0[_0xb2eb('0x33')]['includeAll']){_0x5e373f['include']=[{'all':!![]}];}_0x5e373f=_[_0xb2eb('0x3f')]({},_0x5e373f,_0x48b0f0[_0xb2eb('0x47')]);return db[_0xb2eb('0x2d')][_0xb2eb('0x48')](_0x5e373f)[_0xb2eb('0x23')](handleEntityNotFound(_0x41ec44,null))[_0xb2eb('0x23')](respondWithResult(_0x41ec44,null))[_0xb2eb('0x44')](handleError(_0x41ec44,null));};exports[_0xb2eb('0x49')]=function(_0xa597c9,_0x15fb67){return db[_0xb2eb('0x2d')][_0xb2eb('0x49')](_0xa597c9['body'],{})[_0xb2eb('0x23')](function(_0x4d5b70){var _0x3a7639=_0xa597c9[_0xb2eb('0x4a')][_0xb2eb('0x25')]({'plain':!![]});if(!_0x3a7639)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a7639['role']===_0xb2eb('0x4a')){var _0x53240c=_0x4d5b70[_0xb2eb('0x25')]({'plain':!![]});var _0x36509d=_0xb2eb('0x26');return db['UserProfileSection'][_0xb2eb('0x48')]({'where':{'name':_0x36509d,'userProfileId':_0x3a7639['userProfileId']},'raw':!![]})[_0xb2eb('0x23')](function(_0x501aeb){if(_0x501aeb&&_0x501aeb[_0xb2eb('0x4b')]===0x0){return db[_0xb2eb('0x27')]['create']({'name':_0x53240c['name'],'resourceId':_0x53240c['id'],'type':_0x501aeb[_0xb2eb('0x29')],'sectionId':_0x501aeb['id']},{})['then'](function(){return _0x4d5b70;});}else{return _0x4d5b70;}})[_0xb2eb('0x44')](function(_0x5b2656){logger['error'](_0xb2eb('0x4c'),_0x5b2656);throw _0x5b2656;});}return _0x4d5b70;})[_0xb2eb('0x23')](respondWithResult(_0x15fb67,0xc9))[_0xb2eb('0x44')](handleError(_0x15fb67,null));};exports[_0xb2eb('0x4d')]=function(_0x2e8571,_0x169803){if(_0x2e8571[_0xb2eb('0x4e')]['id']){delete _0x2e8571[_0xb2eb('0x4e')]['id'];}return db[_0xb2eb('0x2d')]['find']({'where':{'id':_0x2e8571['params']['id']}})[_0xb2eb('0x23')](handleEntityNotFound(_0x169803,null))[_0xb2eb('0x23')](saveUpdates(_0x2e8571[_0xb2eb('0x4e')],null))['then'](respondWithResult(_0x169803,null))[_0xb2eb('0x44')](handleError(_0x169803,null));};exports[_0xb2eb('0x24')]=function(_0x1e9007,_0x41a90c){return db[_0xb2eb('0x2d')][_0xb2eb('0x48')]({'where':{'id':_0x1e9007[_0xb2eb('0x4f')]['id']}})[_0xb2eb('0x23')](handleEntityNotFound(_0x41a90c,null))['then'](removeEntity(_0x41a90c,null))[_0xb2eb('0x44')](handleError(_0x41a90c,null));};exports[_0xb2eb('0x50')]=function(_0xbcd520,_0x2b665b,_0x3ff0c0){var _0x19fe03=require('../../config/schedule');return db[_0xb2eb('0x2d')][_0xb2eb('0x48')]({'where':{'id':_0xbcd520[_0xb2eb('0x4f')]['id']},'raw':!![]})[_0xb2eb('0x23')](handleEntityNotFound(_0x2b665b,null))[_0xb2eb('0x23')](function(){_0x19fe03[_0xb2eb('0x50')](_0xbcd520[_0xb2eb('0x4f')]['id']);})[_0xb2eb('0x23')](respondWithStatusCode(_0x2b665b,null))['catch'](handleError(_0x2b665b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 75c1d83..254d070 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 _0x5d15=['moment','bluebird','request-promise','path','exports','define','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x52319f,_0x3b2128){var _0x4530fd=function(_0x49f9ac){while(--_0x49f9ac){_0x52319f['push'](_0x52319f['shift']());}};_0x4530fd(++_0x3b2128);}(_0x5d15,0x1eb));var _0x55d1=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x5d15[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x55d1('0x0'));var util=require(_0x55d1('0x1'));var logger=require(_0x55d1('0x2'))(_0x55d1('0x3'));var moment=require(_0x55d1('0x4'));var BPromise=require(_0x55d1('0x5'));var rp=require(_0x55d1('0x6'));var fs=require('fs');var path=require(_0x55d1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x55d1('0x8')]=function(_0x3ae19c,_0x34410e){return _0x3ae19c[_0x55d1('0x9')]('Schedule',attributes,{'tableName':_0x55d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd53f=['../../config/logger','api','moment','bluebird','request-promise','path','./schedule.attributes','define','Schedule','tools_schedules','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd53f,0x14e));var _0xfd53=function(_0x23310f,_0x4d48ee){_0x23310f=_0x23310f-0x0;var _0x4606d2=_0xd53f[_0x23310f];return _0x4606d2;};'use strict';var _=require(_0xfd53('0x0'));var util=require(_0xfd53('0x1'));var logger=require(_0xfd53('0x2'))(_0xfd53('0x3'));var moment=require(_0xfd53('0x4'));var BPromise=require(_0xfd53('0x5'));var rp=require(_0xfd53('0x6'));var fs=require('fs');var path=require(_0xfd53('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd53('0x8'));module['exports']=function(_0x15faf2,_0x3da4d4){return _0x15faf2[_0xfd53('0x9')](_0xfd53('0xa'),attributes,{'tableName':_0xfd53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 4829968..6fbf633 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 _0xe9c5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x255385,_0x119512){var _0x122c23=function(_0x5a8ed7){while(--_0x5a8ed7){_0x255385['push'](_0x255385['shift']());}};_0x122c23(++_0x119512);}(_0xe9c5,0x14d));var _0x5e9c=function(_0x3d466a,_0x599d63){_0x3d466a=_0x3d466a-0x0;var _0x57ebab=_0xe9c5[_0x3d466a];return _0x57ebab;};'use strict';var _=require(_0x5e9c('0x0'));var util=require(_0x5e9c('0x1'));var moment=require(_0x5e9c('0x2'));var BPromise=require(_0x5e9c('0x3'));var rs=require(_0x5e9c('0x4'));var fs=require('fs');var Redis=require(_0x5e9c('0x5'));var db=require(_0x5e9c('0x6'))['db'];var utils=require(_0x5e9c('0x7'));var logger=require('../../config/logger')(_0x5e9c('0x8'));var config=require(_0x5e9c('0x9'));var jayson=require(_0x5e9c('0xa'));var client=jayson[_0x5e9c('0xb')][_0x5e9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe172a,_0x597b5b,_0x11f84e){return new BPromise(function(_0x4b4f20,_0x253320){return client[_0x5e9c('0xd')](_0xe172a,_0x11f84e)[_0x5e9c('0xe')](function(_0x383cf0){logger[_0x5e9c('0xf')](_0x5e9c('0x10'),_0x597b5b,_0x5e9c('0x11'));logger[_0x5e9c('0x12')](_0x5e9c('0x13'),_0x597b5b,'request\x20sent',JSON[_0x5e9c('0x14')](_0x383cf0));if(_0x383cf0[_0x5e9c('0x15')]){if(_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x16')]===0x1f4){logger[_0x5e9c('0x15')](_0x5e9c('0x10'),_0x597b5b,_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x17')]);return _0x253320(_0x383cf0[_0x5e9c('0x15')]['message']);}logger[_0x5e9c('0x15')](_0x5e9c('0x10'),_0x597b5b,_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x17')]);return _0x4b4f20(_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x17')]);}else{logger[_0x5e9c('0xf')](_0x5e9c('0x10'),_0x597b5b,_0x5e9c('0x11'));_0x4b4f20(_0x383cf0[_0x5e9c('0x18')][_0x5e9c('0x17')]);}})[_0x5e9c('0x19')](function(_0x19b7ab){logger[_0x5e9c('0x15')](_0x5e9c('0x10'),_0x597b5b,_0x19b7ab);_0x253320(_0x19b7ab);});});} \ No newline at end of file +var _0xf48a=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x3cee22,_0x54ad32){var _0x286fa5=function(_0x3026e5){while(--_0x3026e5){_0x3cee22['push'](_0x3cee22['shift']());}};_0x286fa5(++_0x54ad32);}(_0xf48a,0x19f));var _0xaf48=function(_0x298b53,_0x3f830d){_0x298b53=_0x298b53-0x0;var _0x370c14=_0xf48a[_0x298b53];return _0x370c14;};'use strict';var _=require(_0xaf48('0x0'));var util=require(_0xaf48('0x1'));var moment=require(_0xaf48('0x2'));var BPromise=require(_0xaf48('0x3'));var rs=require(_0xaf48('0x4'));var fs=require('fs');var Redis=require(_0xaf48('0x5'));var db=require(_0xaf48('0x6'))['db'];var utils=require(_0xaf48('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xaf48('0x8'));var jayson=require(_0xaf48('0x9'));var client=jayson['client'][_0xaf48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13f8eb,_0x1cda37,_0x384998){return new BPromise(function(_0x3bc598,_0x2e5dfe){return client[_0xaf48('0xb')](_0x13f8eb,_0x384998)[_0xaf48('0xc')](function(_0x354b65){logger['info'](_0xaf48('0xd'),_0x1cda37,_0xaf48('0xe'));logger['debug'](_0xaf48('0xf'),_0x1cda37,_0xaf48('0xe'),JSON[_0xaf48('0x10')](_0x354b65));if(_0x354b65[_0xaf48('0x11')]){if(_0x354b65[_0xaf48('0x11')][_0xaf48('0x12')]===0x1f4){logger['error'](_0xaf48('0xd'),_0x1cda37,_0x354b65[_0xaf48('0x11')][_0xaf48('0x13')]);return _0x2e5dfe(_0x354b65['error'][_0xaf48('0x13')]);}logger['error'](_0xaf48('0xd'),_0x1cda37,_0x354b65[_0xaf48('0x11')]['message']);return _0x3bc598(_0x354b65[_0xaf48('0x11')]['message']);}else{logger[_0xaf48('0x14')](_0xaf48('0xd'),_0x1cda37,_0xaf48('0xe'));_0x3bc598(_0x354b65[_0xaf48('0x15')]['message']);}})[_0xaf48('0x16')](function(_0x1fc141){logger['error'](_0xaf48('0xd'),_0x1cda37,_0x1fc141);_0x2e5dfe(_0x1fc141);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ab30d53..dc48257 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 _0xf7be=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','index','get','describe','/:id','isAuthenticated','post','create','put','update','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf7be,0x104));var _0xef7b=function(_0x41d1b5,_0x262fdf){_0x41d1b5=_0x41d1b5-0x0;var _0x4f7783=_0xf7be[_0x41d1b5];return _0x4f7783;};'use strict';var multer=require(_0xef7b('0x0'));var util=require(_0xef7b('0x1'));var path=require(_0xef7b('0x2'));var timeout=require(_0xef7b('0x3'));var express=require(_0xef7b('0x4'));var router=express['Router']();var fs_extra=require(_0xef7b('0x5'));var auth=require(_0xef7b('0x6'));var interaction=require(_0xef7b('0x7'));var config=require(_0xef7b('0x8'));var controller=require(_0xef7b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xef7b('0xa')]);router[_0xef7b('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xef7b('0xc')]);router[_0xef7b('0xb')](_0xef7b('0xd'),auth[_0xef7b('0xe')](),controller['show']);router[_0xef7b('0xb')]('/:id/download',auth[_0xef7b('0xe')](),controller['download']);router[_0xef7b('0xf')]('/',auth[_0xef7b('0xe')](),controller[_0xef7b('0x10')]);router[_0xef7b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xef7b('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xef7b('0x13')]=router; \ No newline at end of file +var _0xb258=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x46cd70,_0x7c0357){var _0x1e1391=function(_0x3951be){while(--_0x3951be){_0x46cd70['push'](_0x46cd70['shift']());}};_0x1e1391(++_0x7c0357);}(_0xb258,0xf6));var _0x8b25=function(_0x96435f,_0x44ae95){_0x96435f=_0x96435f-0x0;var _0x5c520b=_0xb258[_0x96435f];return _0x5c520b;};'use strict';var multer=require(_0x8b25('0x0'));var util=require(_0x8b25('0x1'));var path=require(_0x8b25('0x2'));var timeout=require(_0x8b25('0x3'));var express=require(_0x8b25('0x4'));var router=express[_0x8b25('0x5')]();var fs_extra=require(_0x8b25('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b25('0x7'));var controller=require('./screenRecording.controller');router[_0x8b25('0x8')]('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0xa')]);router[_0x8b25('0x8')](_0x8b25('0xb'),auth['isAuthenticated'](),controller[_0x8b25('0xc')]);router[_0x8b25('0x8')](_0x8b25('0xd'),auth[_0x8b25('0x9')](),controller['show']);router[_0x8b25('0x8')]('/:id/download',auth[_0x8b25('0x9')](),controller['download']);router[_0x8b25('0xe')]('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0xf')]);router[_0x8b25('0x10')](_0x8b25('0xd'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x11')]);router['delete'](_0x8b25('0xd'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x12')]);module[_0x8b25('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 2d5559f..32a739b 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 _0x1a85=['extname','getDataValue','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','value'];(function(_0x235d9c,_0xf831bb){var _0x32534f=function(_0x10345b){while(--_0x10345b){_0x235d9c['push'](_0x235d9c['shift']());}};_0x32534f(++_0xf831bb);}(_0x1a85,0x178));var _0x51a8=function(_0x4e5b60,_0x58b613){_0x4e5b60=_0x4e5b60-0x0;var _0x3b53bf=_0x1a85[_0x4e5b60];return _0x3b53bf;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x51a8('0x0'));var config=require(_0x51a8('0x1'));module[_0x51a8('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x51a8('0x3'))?path[_0x51a8('0x4')](this[_0x51a8('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x51a8('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x51a8('0x6')],'set':function(_0x5cf430){var _0x331117=_0x5cf430[_0x51a8('0x7')](/\\/g,'/');this['setDataValue'](_0x51a8('0x3'),_0x331117);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x39e06a){this[_0x51a8('0x8')](_0x51a8('0x9'),moment()[_0x51a8('0xa')](_0x39e06a,'ms'));this[_0x51a8('0x8')](_0x51a8('0xb'),moment());this[_0x51a8('0x8')](_0x51a8('0xc'),_0x39e06a);}},'startedAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this[_0x51a8('0x5')](_0x51a8('0x9')))[_0x51a8('0xe')](_0x51a8('0xf'))[_0x51a8('0x10')]();}},'closedAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this[_0x51a8('0x5')](_0x51a8('0xb')))['format'](_0x51a8('0xf'))[_0x51a8('0x10')]();}},'createdAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this['getDataValue'](_0x51a8('0x11')))['format'](_0x51a8('0xf'))[_0x51a8('0x10')]();}},'updatedAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this[_0x51a8('0x5')](_0x51a8('0x12')))[_0x51a8('0xe')](_0x51a8('0xf'))['toString']();}}}; \ No newline at end of file +var _0xb90a=['startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','../../config/environment','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x15f3c9,_0x221453){var _0x5d644c=function(_0x1692e8){while(--_0x1692e8){_0x15f3c9['push'](_0x15f3c9['shift']());}};_0x5d644c(++_0x221453);}(_0xb90a,0x12a));var _0xab90=function(_0x3d6aa3,_0x8d8519){_0x3d6aa3=_0x3d6aa3-0x0;var _0x4ef13d=_0xb90a[_0x3d6aa3];return _0x4ef13d;};'use strict';var Sequelize=require(_0xab90('0x0'));var moment=require(_0xab90('0x1'));var path=require('path');var config=require(_0xab90('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0xab90('0x3')](_0xab90('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xab90('0x5')],'set':function(_0x426588){var _0x275bf7=_0x426588['replace'](/\\/g,'/');this[_0xab90('0x6')](_0xab90('0x4'),_0x275bf7);}},'rating':{'type':Sequelize[_0xab90('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xab90('0x7')],'set':function(_0x93af2f){this[_0xab90('0x6')](_0xab90('0x8'),moment()[_0xab90('0x9')](_0x93af2f,'ms'));this['setDataValue'](_0xab90('0xa'),moment());this[_0xab90('0x6')](_0xab90('0xb'),_0x93af2f);}},'startedAt':{'type':Sequelize[_0xab90('0xc')],'get':function(){return moment(this[_0xab90('0x3')]('startedAt'))[_0xab90('0xd')](_0xab90('0xe'))[_0xab90('0xf')]();}},'closedAt':{'type':Sequelize[_0xab90('0xc')],'get':function(){return moment(this[_0xab90('0x3')](_0xab90('0xa')))[_0xab90('0xd')](_0xab90('0xe'))[_0xab90('0xf')]();}},'createdAt':{'type':Sequelize[_0xab90('0xc')],'get':function(){return moment(this[_0xab90('0x3')](_0xab90('0x10')))[_0xab90('0xd')]('MM-DD-YYYY\x20HH:mm')[_0xab90('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xab90('0x3')](_0xab90('0x11')))['format'](_0xab90('0xe'))[_0xab90('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 20798ac..2eb934b 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','params','rawAttributes','intersection','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','decryptFile','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5dd35a,_0x543f8d){var _0x6a3f73=function(_0x20c369){while(--_0x20c369){_0x5dd35a['push'](_0x5dd35a['shift']());}};_0x6a3f73(++_0x543f8d);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x34')](_[_0x7721('0x2f')](_0x5c54f0,'name'),[_0x7721('0x35')]);_0xd7d703[_0x7721('0x36')]=_[_0x7721('0x37')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x38')]=_['intersection'](_0xd7d703[_0x7721('0x33')],_0xd7d703[_0x7721('0x36')]);_0x37b9f0[_0x7721('0x39')]=_['intersection'](_0xd7d703[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x158d98['query'][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')][_0x7721('0x3b')]?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3c')](_0x7721('0x3d'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0['offset']=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x3f')](_0x158d98[_0x7721('0x36')][_0x7721('0x3f')]);_0x37b9f0[_0x7721('0x40')]=qs['filters'](_['pick'](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98[_0x7721('0x36')][_0x7721('0x41')]){_0x37b9f0[_0x7721('0x40')]=_[_0x7721('0x42')](_0x37b9f0['where'],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4cf659){if(_0x4cf659[_0x7721('0x32')]!==_0x7721('0x43')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x44')]]={'$like':'%'+_0x158d98[_0x7721('0x36')]['filter']+'%'};return _0x5a278e;}})});}_0x37b9f0=_['merge']({},_0x37b9f0,_0x158d98[_0x7721('0x45')]);var _0xfc4dc4={'where':_0x37b9f0[_0x7721('0x40')]};return db[_0x7721('0x30')]['count'](_0xfc4dc4)[_0x7721('0x29')](function(_0x120de9){_0x1da2d8[_0x7721('0x22')]=_0x120de9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x46')]){_0x37b9f0['include']=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a5b59){_0x1da2d8[_0x7721('0x47')]=_0x4a5b59;return _0x1da2d8;})[_0x7721('0x29')](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x48')](handleError(_0x1ea4d,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x37')](db[_0x7721('0x30')][_0x7721('0x4a')]);_0x481fa8[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x36')]);_0x1ad315[_0x7721('0x39')]=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x1453d4[_0x7721('0x36')][_0x7721('0x3a')]));_0x1ad315[_0x7721('0x39')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x39')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x36')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x42')]({},_0x1ad315,_0x1453d4[_0x7721('0x45')]);return db['ScreenRecording'][_0x7721('0x4c')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x29')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4d')]=function(_0x196be4,_0xf17c40){return db['ScreenRecording'][_0x7721('0x4d')](_0x196be4[_0x7721('0x4e')],{})['then'](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x28')]=function(_0xf88e8c,_0x5c4078){if(_0xf88e8c[_0x7721('0x4e')]['id']){delete _0xf88e8c['body']['id'];}delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x4f')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x50')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x51')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x52')];return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0xf88e8c[_0x7721('0x49')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x5c4078,null))[_0x7721('0x29')](saveUpdates(_0xf88e8c[_0x7721('0x4e')],null))[_0x7721('0x29')](respondWithResult(_0x5c4078,null))['catch'](handleError(_0x5c4078,null));};exports[_0x7721('0x53')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x30')][_0x7721('0x53')]()[_0x7721('0x29')](respondWithResult(_0x8e1214,null))[_0x7721('0x48')](handleError(_0x8e1214,null));};exports['download']=function(_0x234bee,_0x17036e,_0x134908){var _0x3b7382=require(_0x7721('0x54'));var _0x9c0d4=![];var _0x7fbd6c={};if(_0x234bee[_0x7721('0x36')][_0x7721('0x32')]&&_0x234bee[_0x7721('0x36')][_0x7721('0x32')]==='uniqueid'){_0x7fbd6c[_0x7721('0x55')]=_0x234bee[_0x7721('0x49')]['id'];}else{_0x7fbd6c['id']=_0x234bee[_0x7721('0x49')]['id'];}return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':_0x7fbd6c,'attributes':['id',_0x7721('0x52')],'raw':!![]})[_0x7721('0x29')](handleEntityNotFound(_0x17036e,null))[_0x7721('0x29')](function(_0x360882){if(_0x360882){var _0x287452=path[_0x7721('0x56')](config[_0x7721('0x57')],_0x7721('0x58'),_0x360882[_0x7721('0x52')]);var _0x300ea4=util['format']('%s.cypher',_0x287452);if(fs['existsSync'](_0x300ea4)){_0x9c0d4=!![];return _0x3b7382[_0x7721('0x59')](_0x300ea4,_0x287452,config['secrets']['recording'])['then'](function(){return _0x360882;});}return _0x360882;}})['then'](function(_0x47925a){if(_0x47925a){var _0x219181=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x47925a['value']);if(!fs['existsSync'](_0x219181)){throw new db['Sequelize'][(_0x7721('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x47925a['filename']){return _0x17036e['download'](_0x219181,_0x47925a[_0x7721('0x5b')]+path[_0x7721('0x5c')](_0x219181),function(){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}else{return _0x17036e['download'](_0x219181,function(_0x2a025c){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}}})[_0x7721('0x48')](function(_0x168343){if(_0x168343[_0x7721('0x5e')]===_0x7721('0x5f')){_0x17036e[_0x7721('0x1c')](0x194)[_0x7721('0x2d')](_0x7721('0x60'));}else{return handleError(_0x17036e,null);}});};exports[_0x7721('0x2a')]=function(_0x3b03cf,_0x10666e){return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0x3b03cf[_0x7721('0x49')]['id']}})['then'](function(_0x233e5d){if(_[_0x7721('0x61')](_0x233e5d)){throw new ReferenceError(_0x7721('0x62'));}return _0x233e5d;})[_0x7721('0x29')](function(_0x542e30){var _0x103009=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x542e30['value']);logger[_0x7721('0x63')](_0x7721('0x64'),_0x103009);if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}_0x103009=_0x103009+'.cypher';if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}return _0x542e30;})['then'](function(_0xb6f2f2){if(!_0xb6f2f2)throw new InternalError();return _0xb6f2f2[_0x7721('0x2a')]();})['then'](function(){_0x10666e[_0x7721('0x1c')](0xcc)['end']();})[_0x7721('0x48')](handleError(_0x10666e,null));}; \ No newline at end of file +var _0xb4c7=['rawAttributes','fieldName','type','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','ValidationError','download','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording'];(function(_0x56a347,_0x54d322){var _0x2745f7=function(_0xc7abe5){while(--_0xc7abe5){_0x56a347['push'](_0x56a347['shift']());}};_0x2745f7(++_0x54d322);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3cb626,_0x3ca975){_0x3cb626=_0x3cb626-0x0;var _0x3db387=_0xb4c7[_0x3cb626];return _0x3db387;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['differenceBy'](_[_0x7b4c('0x30')](_0x3544bc,_0x7b4c('0x2d')),[_0x7b4c('0x35')]);_0x3585cd[_0x7b4c('0x36')]=_['keys'](_0x2552f9[_0x7b4c('0x36')]);_0x3585cd[_0x7b4c('0x37')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_[_0x7b4c('0x3a')](_0x3585cd[_0x7b4c('0x38')],qs['fields'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x39')][_0x7b4c('0x3c')]?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9['query']['hasOwnProperty'](_0x7b4c('0x3d'))){_0x9a799b[_0x7b4c('0x22')]=qs['limit'](_0x2552f9[_0x7b4c('0x36')]['limit']);_0x9a799b['offset']=qs[_0x7b4c('0x1f')](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3e')]=qs['sort'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3f')]);_0x9a799b[_0x7b4c('0x40')]=qs[_0x7b4c('0x37')](_[_0x7b4c('0x41')](_0x2552f9[_0x7b4c('0x36')],_0x3585cd[_0x7b4c('0x37')]),_0x3544bc);if(_0x2552f9['query']['filter']){_0x9a799b[_0x7b4c('0x40')]=_[_0x7b4c('0x42')](_0x9a799b[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0xb8486d){if(_0xb8486d['type']!==_0x7b4c('0x43')){var _0x902367={};_0x902367[_0xb8486d[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x44')]+'%'};return _0x902367;}})});}_0x9a799b=_[_0x7b4c('0x42')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x45')]);var _0x1080fc={'where':_0x9a799b[_0x7b4c('0x40')]};return db['ScreenRecording'][_0x7b4c('0x21')](_0x1080fc)['then'](function(_0x2a3a74){_0x130ace['count']=_0x2a3a74;if(_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x9a799b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7b4c('0x47')](_0x9a799b);})[_0x7b4c('0x29')](function(_0x1def44){_0x130ace[_0x7b4c('0x48')]=_0x1def44;return _0x130ace;})['then'](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x49')](handleError(_0x3e4a46,null));};exports[_0x7b4c('0x4a')]=function(_0x100774,_0x5d4ed8){var _0x45ad59={'raw':![],'where':{'id':_0x100774['params']['id']}},_0x4b4757={};_0x4b4757[_0x7b4c('0x38')]=_['keys'](db[_0x7b4c('0x31')][_0x7b4c('0x32')]);_0x4b4757[_0x7b4c('0x36')]=_[_0x7b4c('0x4b')](_0x100774[_0x7b4c('0x36')]);_0x4b4757[_0x7b4c('0x37')]=_[_0x7b4c('0x3a')](_0x4b4757[_0x7b4c('0x38')],_0x4b4757[_0x7b4c('0x36')]);_0x45ad59['attributes']=_[_0x7b4c('0x3a')](_0x4b4757['model'],qs['fields'](_0x100774[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x45ad59['attributes']=_0x45ad59['attributes'][_0x7b4c('0x3c')]?_0x45ad59[_0x7b4c('0x39')]:_0x4b4757[_0x7b4c('0x38')];if(_0x100774[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x45ad59[_0x7b4c('0x4c')]=[{'all':!![]}];}_0x45ad59=_[_0x7b4c('0x42')]({},_0x45ad59,_0x100774[_0x7b4c('0x45')]);return db['ScreenRecording'][_0x7b4c('0x4d')](_0x45ad59)[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4ed8,null))[_0x7b4c('0x29')](respondWithResult(_0x5d4ed8,null))[_0x7b4c('0x49')](handleError(_0x5d4ed8,null));};exports[_0x7b4c('0x4e')]=function(_0x379f15,_0x11a6f9){return db[_0x7b4c('0x31')][_0x7b4c('0x4e')](_0x379f15['body'],{})['then'](respondWithResult(_0x11a6f9,0xc9))[_0x7b4c('0x49')](handleError(_0x11a6f9,null));};exports[_0x7b4c('0x28')]=function(_0x97eadf,_0x5d4192){if(_0x97eadf[_0x7b4c('0x4f')]['id']){delete _0x97eadf[_0x7b4c('0x4f')]['id'];}delete _0x97eadf['body'][_0x7b4c('0x50')];delete _0x97eadf['body'][_0x7b4c('0x51')];delete _0x97eadf['body'][_0x7b4c('0x52')];delete _0x97eadf['body'][_0x7b4c('0x53')];return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x97eadf['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4192,null))[_0x7b4c('0x29')](saveUpdates(_0x97eadf[_0x7b4c('0x4f')],null))['then'](respondWithResult(_0x5d4192,null))['catch'](handleError(_0x5d4192,null));};exports[_0x7b4c('0x54')]=function(_0x1c118a,_0x4cbf1b){return db['ScreenRecording'][_0x7b4c('0x54')]()[_0x7b4c('0x29')](respondWithResult(_0x4cbf1b,null))[_0x7b4c('0x49')](handleError(_0x4cbf1b,null));};exports['download']=function(_0x1d017d,_0x2f009a,_0x4aaf57){var _0x484e80=require(_0x7b4c('0x55'));var _0x4d8491=![];var _0x59db20={};if(_0x1d017d[_0x7b4c('0x36')]['type']&&_0x1d017d['query'][_0x7b4c('0x34')]===_0x7b4c('0x56')){_0x59db20[_0x7b4c('0x56')]=_0x1d017d[_0x7b4c('0x57')]['id'];}else{_0x59db20['id']=_0x1d017d['params']['id'];}return db['ScreenRecording'][_0x7b4c('0x4d')]({'where':_0x59db20,'attributes':['id',_0x7b4c('0x53')],'raw':!![]})[_0x7b4c('0x29')](handleEntityNotFound(_0x2f009a,null))['then'](function(_0x255262){if(_0x255262){var _0x3d81fb=path[_0x7b4c('0x58')](config['root'],_0x7b4c('0x59'),_0x255262[_0x7b4c('0x53')]);var _0x529803=util[_0x7b4c('0x35')](_0x7b4c('0x5a'),_0x3d81fb);if(fs[_0x7b4c('0x5b')](_0x529803)){_0x4d8491=!![];return _0x484e80[_0x7b4c('0x5c')](_0x529803,_0x3d81fb,config[_0x7b4c('0x5d')][_0x7b4c('0x5e')])[_0x7b4c('0x29')](function(){return _0x255262;});}return _0x255262;}})['then'](function(_0x4443d0){if(_0x4443d0){var _0x2dc79a=path['join'](config[_0x7b4c('0x5f')],_0x7b4c('0x59'),_0x4443d0[_0x7b4c('0x53')]);if(!fs[_0x7b4c('0x5b')](_0x2dc79a)){throw new db['Sequelize'][(_0x7b4c('0x60'))]('ScreenRecording\x20not\x20found');}if(_0x4443d0['filename']){return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,_0x4443d0[_0x7b4c('0x62')]+path[_0x7b4c('0x63')](_0x2dc79a),function(){if(_0x4d8491){fs[_0x7b4c('0x64')](_0x2dc79a);}});}else{return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,function(_0x5b24f6){if(_0x4d8491){fs['unlink'](_0x2dc79a);}});}}})[_0x7b4c('0x49')](function(_0x3c84af){if(_0x3c84af[_0x7b4c('0x65')]==='ScreenRecording\x20not\x20found'){_0x2f009a[_0x7b4c('0x1c')](0x194)[_0x7b4c('0x2e')](_0x7b4c('0x66'));}else{return handleError(_0x2f009a,null);}});};exports['destroy']=function(_0x222b47,_0x3b2144){return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x222b47[_0x7b4c('0x57')]['id']}})[_0x7b4c('0x29')](function(_0x4ac03e){if(_[_0x7b4c('0x67')](_0x4ac03e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4ac03e;})[_0x7b4c('0x29')](function(_0x11ae6e){var _0x3a3713=path['join'](config['root'],_0x7b4c('0x59'),_0x11ae6e[_0x7b4c('0x53')]);logger[_0x7b4c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3713);if(!_[_0x7b4c('0x67')](_0x11ae6e['value'])&&fs[_0x7b4c('0x5b')](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}_0x3a3713=_0x3a3713+'.cypher';if(!_[_0x7b4c('0x67')](_0x11ae6e[_0x7b4c('0x53')])&&fs['existsSync'](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}return _0x11ae6e;})[_0x7b4c('0x29')](function(_0x2befd7){if(!_0x2befd7)throw new InternalError();return _0x2befd7[_0x7b4c('0x2a')]();})[_0x7b4c('0x29')](function(){_0x3b2144['status'](0xcc)[_0x7b4c('0x1d')]();})[_0x7b4c('0x49')](handleError(_0x3b2144,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 86677f0..3676887 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 _0x2452=['../../config/environment','exports','interactionid','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x2a9e6f,_0x216211){var _0x1159d1=function(_0x86dcc0){while(--_0x86dcc0){_0x2a9e6f['push'](_0x2a9e6f['shift']());}};_0x1159d1(++_0x216211);}(_0x2452,0xae));var _0x2245=function(_0x5be46a,_0x2fb035){_0x5be46a=_0x5be46a-0x0;var _0x1ce3b8=_0x2452[_0x5be46a];return _0x1ce3b8;};'use strict';var _=require(_0x2245('0x0'));var util=require('util');var logger=require(_0x2245('0x1'))(_0x2245('0x2'));var moment=require('moment');var BPromise=require(_0x2245('0x3'));var rp=require(_0x2245('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2245('0x5'));var config=require(_0x2245('0x6'));var attributes=require('./screenRecording.attributes');module[_0x2245('0x7')]=function(_0x54f3bc,_0x510634){return _0x54f3bc['define']('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x2245('0x8'),'fields':[_0x2245('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95eb=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','api','moment','request-promise','path'];(function(_0x2dcb33,_0x3c58c8){var _0x53324c=function(_0x3bae28){while(--_0x3bae28){_0x2dcb33['push'](_0x2dcb33['shift']());}};_0x53324c(++_0x3c58c8);}(_0x95eb,0x1a7));var _0xb95e=function(_0x11aaa1,_0x3d106c){_0x11aaa1=_0x11aaa1-0x0;var _0x11f1c2=_0x95eb[_0x11aaa1];return _0x11f1c2;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var logger=require('../../config/logger')(_0xb95e('0x2'));var moment=require(_0xb95e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb95e('0x4'));var fs=require('fs');var path=require(_0xb95e('0x5'));var rimraf=require(_0xb95e('0x6'));var config=require(_0xb95e('0x7'));var attributes=require(_0xb95e('0x8'));module[_0xb95e('0x9')]=function(_0x5c9a93,_0x59742e){return _0x5c9a93[_0xb95e('0xa')]('ScreenRecording',attributes,{'tableName':_0xb95e('0xb'),'paranoid':![],'indexes':[{'name':_0xb95e('0xc'),'fields':[_0xb95e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9b05691..f346b99 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 _0xdd6b=['ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2e2c96,_0x37c518){var _0x53fcfc=function(_0xf79f9f){while(--_0xf79f9f){_0x2e2c96['push'](_0x2e2c96['shift']());}};_0x53fcfc(++_0x37c518);}(_0xdd6b,0x9f));var _0xbdd6=function(_0x5e92db,_0x2dd018){_0x5e92db=_0x5e92db-0x0;var _0x25674c=_0xdd6b[_0x5e92db];return _0x25674c;};'use strict';var _=require(_0xbdd6('0x0'));var util=require(_0xbdd6('0x1'));var moment=require(_0xbdd6('0x2'));var BPromise=require(_0xbdd6('0x3'));var rs=require(_0xbdd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdd6('0x5'))['db'];var utils=require(_0xbdd6('0x6'));var logger=require(_0xbdd6('0x7'))(_0xbdd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xbdd6('0x9'));var client=jayson['client'][_0xbdd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31bceb,_0x38ae21,_0x46e8b3){return new BPromise(function(_0x4399d4,_0x4fe832){return client[_0xbdd6('0xb')](_0x31bceb,_0x46e8b3)[_0xbdd6('0xc')](function(_0x3ef8bc){logger[_0xbdd6('0xd')](_0xbdd6('0xe'),_0x38ae21,_0xbdd6('0xf'));logger[_0xbdd6('0x10')](_0xbdd6('0x11'),_0x38ae21,_0xbdd6('0xf'),JSON['stringify'](_0x3ef8bc));if(_0x3ef8bc[_0xbdd6('0x12')]){if(_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x13')]===0x1f4){logger[_0xbdd6('0x12')](_0xbdd6('0xe'),_0x38ae21,_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);return _0x4fe832(_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);}logger[_0xbdd6('0x12')](_0xbdd6('0xe'),_0x38ae21,_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);return _0x4399d4(_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);}else{logger[_0xbdd6('0xd')](_0xbdd6('0xe'),_0x38ae21,'request\x20sent');_0x4399d4(_0x3ef8bc['result'][_0xbdd6('0x14')]);}})[_0xbdd6('0x15')](function(_0x50488f){logger[_0xbdd6('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x38ae21,_0x50488f);_0x4fe832(_0x50488f);});});} \ No newline at end of file +var _0xdb8b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb8b,0xa5));var _0xbdb8=function(_0x4a357c,_0x2e533d){_0x4a357c=_0x4a357c-0x0;var _0x4795be=_0xdb8b[_0x4a357c];return _0x4795be;};'use strict';var _=require(_0xbdb8('0x0'));var util=require(_0xbdb8('0x1'));var moment=require(_0xbdb8('0x2'));var BPromise=require(_0xbdb8('0x3'));var rs=require(_0xbdb8('0x4'));var fs=require('fs');var Redis=require(_0xbdb8('0x5'));var db=require(_0xbdb8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdb8('0x7'))('rpc');var config=require(_0xbdb8('0x8'));var jayson=require(_0xbdb8('0x9'));var client=jayson[_0xbdb8('0xa')][_0xbdb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3310b7,_0xb816c5,_0x436106){return new BPromise(function(_0x39a956,_0x5702ce){return client[_0xbdb8('0xc')](_0x3310b7,_0x436106)[_0xbdb8('0xd')](function(_0x2d6abc){logger[_0xbdb8('0xe')]('ScreenRecording,\x20%s,\x20%s',_0xb816c5,_0xbdb8('0xf'));logger[_0xbdb8('0x10')](_0xbdb8('0x11'),_0xb816c5,'request\x20sent',JSON['stringify'](_0x2d6abc));if(_0x2d6abc['error']){if(_0x2d6abc[_0xbdb8('0x12')][_0xbdb8('0x13')]===0x1f4){logger[_0xbdb8('0x12')](_0xbdb8('0x14'),_0xb816c5,_0x2d6abc[_0xbdb8('0x12')][_0xbdb8('0x15')]);return _0x5702ce(_0x2d6abc[_0xbdb8('0x12')][_0xbdb8('0x15')]);}logger[_0xbdb8('0x12')](_0xbdb8('0x14'),_0xb816c5,_0x2d6abc['error'][_0xbdb8('0x15')]);return _0x39a956(_0x2d6abc[_0xbdb8('0x12')]['message']);}else{logger[_0xbdb8('0xe')](_0xbdb8('0x14'),_0xb816c5,_0xbdb8('0xf'));_0x39a956(_0x2d6abc[_0xbdb8('0x16')][_0xbdb8('0x15')]);}})[_0xbdb8('0x17')](function(_0x44c64c){logger[_0xbdb8('0x12')](_0xbdb8('0x14'),_0xb816c5,_0x44c64c);_0x5702ce(_0x44c64c);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c86d7d4..6ebbd0b 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 _0x1e5d=['server/files/images/logos/','logologin','extname','addLogoLogin','preferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root','format','%s%s','logo','originalname','post','single','file','addLogo'];(function(_0x40f99e,_0x3ac4e8){var _0x8504eb=function(_0x2199a8){while(--_0x2199a8){_0x40f99e['push'](_0x40f99e['shift']());}};_0x8504eb(++_0x3ac4e8);}(_0x1e5d,0x1ee));var _0xd1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd1e5('0x0'));var util=require(_0xd1e5('0x1'));var path=require(_0xd1e5('0x2'));var timeout=require(_0xd1e5('0x3'));var express=require(_0xd1e5('0x4'));var router=express[_0xd1e5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd1e5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd1e5('0x7'));var controller=require(_0xd1e5('0x8'));router[_0xd1e5('0x9')]('/',auth[_0xd1e5('0xa')](),controller[_0xd1e5('0xb')]);router[_0xd1e5('0x9')](_0xd1e5('0xc'),controller[_0xd1e5('0xd')]);router['get'](_0xd1e5('0xe'),controller['show']);router[_0xd1e5('0x9')](_0xd1e5('0xf'),controller[_0xd1e5('0x10')]);router[_0xd1e5('0x9')](_0xd1e5('0x11'),controller[_0xd1e5('0x12')]);router[_0xd1e5('0x9')](_0xd1e5('0x13'),controller[_0xd1e5('0x14')]);router['get'](_0xd1e5('0x15'),controller['getPreferred']);router[_0xd1e5('0x9')](_0xd1e5('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0x2195a5,_0x540586,_0x2a3684){_0x2a3684(null,path[_0xd1e5('0x18')](config[_0xd1e5('0x19')],'server/files/images/logos/'));},'filename':function(_0x38748e,_0x3bb40c,_0xe502e7){_0xe502e7(null,util[_0xd1e5('0x1a')](_0xd1e5('0x1b'),_0xd1e5('0x1c'),path['extname'](_0x3bb40c[_0xd1e5('0x1d')])));}})});router[_0xd1e5('0x1e')]('/:id/logo',upload[_0xd1e5('0x1f')](_0xd1e5('0x20')),controller[_0xd1e5('0x21')]);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0x22f9c1,_0x369735,_0xbc0dfb){_0xbc0dfb(null,path[_0xd1e5('0x18')](config['root'],_0xd1e5('0x22')));},'filename':function(_0x337fef,_0x27fe3b,_0x532efd){_0x532efd(null,util['format'](_0xd1e5('0x1b'),_0xd1e5('0x23'),path[_0xd1e5('0x24')](_0x27fe3b[_0xd1e5('0x1d')])));}})});router['post'](_0xd1e5('0x11'),upload[_0xd1e5('0x1f')](_0xd1e5('0x20')),controller[_0xd1e5('0x25')]);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0xcfbf00,_0x152189,_0x5deaf3){_0x5deaf3(null,path[_0xd1e5('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5278f1,_0x27d5a0,_0x12724b){_0x12724b(null,util[_0xd1e5('0x1a')](_0xd1e5('0x1b'),_0xd1e5('0x26'),path[_0xd1e5('0x24')](_0x27d5a0[_0xd1e5('0x1d')])));}})});router[_0xd1e5('0x1e')](_0xd1e5('0x15'),upload[_0xd1e5('0x1f')](_0xd1e5('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0x21d94e,_0x1026e6,_0xc06885){_0xc06885(null,path[_0xd1e5('0x18')](config[_0xd1e5('0x19')],_0xd1e5('0x22')));},'filename':function(_0x12c28c,_0x57aea7,_0x3d39ec){_0x3d39ec(null,util[_0xd1e5('0x1a')](_0xd1e5('0x1b'),_0xd1e5('0x27'),path['extname'](_0x57aea7[_0xd1e5('0x1d')])));}})});router['post'](_0xd1e5('0x16'),upload[_0xd1e5('0x1f')]('file'),controller[_0xd1e5('0x28')]);router[_0xd1e5('0x29')](_0xd1e5('0xe'),auth['isAuthenticated'](),controller[_0xd1e5('0x2a')]);module[_0xd1e5('0x2b')]=router; \ No newline at end of file +var _0x1648=['favicon','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root','format','%s%s','extname','originalname','addLogo','server/files/images/logos/','logologin','post','single','file','addLogoLogin','preferred','addPreferred'];(function(_0x8d956c,_0x4ec00e){var _0x425c39=function(_0x50b4b6){while(--_0x50b4b6){_0x8d956c['push'](_0x8d956c['shift']());}};_0x425c39(++_0x4ec00e);}(_0x1648,0x129));var _0x8164=function(_0x377223,_0x6f7ec8){_0x377223=_0x377223-0x0;var _0x1f4972=_0x1648[_0x377223];return _0x1f4972;};'use strict';var multer=require(_0x8164('0x0'));var util=require('util');var path=require(_0x8164('0x1'));var timeout=require(_0x8164('0x2'));var express=require(_0x8164('0x3'));var router=express[_0x8164('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8164('0x5'));var interaction=require(_0x8164('0x6'));var config=require(_0x8164('0x7'));var controller=require(_0x8164('0x8'));router[_0x8164('0x9')]('/',auth[_0x8164('0xa')](),controller['index']);router[_0x8164('0x9')](_0x8164('0xb'),controller[_0x8164('0xc')]);router[_0x8164('0x9')](_0x8164('0xd'),controller['show']);router[_0x8164('0x9')]('/:id/logo',controller['getLogo']);router[_0x8164('0x9')](_0x8164('0xe'),controller[_0x8164('0xf')]);router[_0x8164('0x9')](_0x8164('0x10'),controller[_0x8164('0x11')]);router[_0x8164('0x9')](_0x8164('0x12'),controller['getPreferred']);router[_0x8164('0x9')](_0x8164('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0x8164('0x14')]({'destination':function(_0x11a354,_0x429388,_0x261b32){_0x261b32(null,path[_0x8164('0x15')](config[_0x8164('0x16')],'server/files/images/logos/'));},'filename':function(_0x503af7,_0x175072,_0x3742a1){_0x3742a1(null,util[_0x8164('0x17')](_0x8164('0x18'),'logo',path[_0x8164('0x19')](_0x175072[_0x8164('0x1a')])));}})});router['post']('/:id/logo',upload['single']('file'),controller[_0x8164('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc5487c,_0x1a173a,_0x3ec3fb){_0x3ec3fb(null,path[_0x8164('0x15')](config['root'],_0x8164('0x1c')));},'filename':function(_0x5458ab,_0x4a6e40,_0xbd85fd){_0xbd85fd(null,util['format'](_0x8164('0x18'),_0x8164('0x1d'),path[_0x8164('0x19')](_0x4a6e40[_0x8164('0x1a')])));}})});router[_0x8164('0x1e')](_0x8164('0xe'),upload[_0x8164('0x1f')](_0x8164('0x20')),controller[_0x8164('0x21')]);var upload=multer({'storage':multer[_0x8164('0x14')]({'destination':function(_0x5202a3,_0x3a178e,_0xf9e79b){_0xf9e79b(null,path[_0x8164('0x15')](config[_0x8164('0x16')],_0x8164('0x1c')));},'filename':function(_0x1e4559,_0x38716c,_0x5c23b0){_0x5c23b0(null,util[_0x8164('0x17')](_0x8164('0x18'),_0x8164('0x22'),path[_0x8164('0x19')](_0x38716c[_0x8164('0x1a')])));}})});router[_0x8164('0x1e')](_0x8164('0x12'),upload[_0x8164('0x1f')](_0x8164('0x20')),controller[_0x8164('0x23')]);var upload=multer({'storage':multer[_0x8164('0x14')]({'destination':function(_0x5a1f58,_0x45f30a,_0x541db2){_0x541db2(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x245015,_0x52549c,_0xfd499a){_0xfd499a(null,util[_0x8164('0x17')](_0x8164('0x18'),_0x8164('0x24'),path['extname'](_0x52549c[_0x8164('0x1a')])));}})});router[_0x8164('0x1e')](_0x8164('0x13'),upload[_0x8164('0x1f')](_0x8164('0x20')),controller['addFavicon']);router['put'](_0x8164('0xd'),auth[_0x8164('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b97c2f7..18643a9 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 _0x1a91=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize','INTEGER','min_internal'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x1a91,0xd5));var _0x11a9=function(_0x141e5f,_0x216927){_0x141e5f=_0x141e5f-0x0;var _0x5bea96=_0x1a91[_0x141e5f];return _0x5bea96;};'use strict';var Sequelize=require(_0x11a9('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x11a9('0x1')](0xb),'unique':_0x11a9('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x11a9('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x11a9('0x3')],'defaultValue':_0x11a9('0x4')},'logo':{'type':Sequelize[_0x11a9('0x3')]},'defaultLogo':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x11a9('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x11a9('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x11a9('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x11a9('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x11a9('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x11a9('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x11a9('0x3')],'defaultValue':_0x11a9('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x11a9('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x11a9('0x3')]},'defaultFavicon':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x11a9('0x1')]},'sentimentRegion':{'type':Sequelize[_0x11a9('0x3')]},'language':{'type':Sequelize[_0x11a9('0x3')]},'bucket':{'type':Sequelize[_0x11a9('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x11a9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x11a9('0x1')](0x2)[_0x11a9('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x11a9('0x1')](0x2)[_0x11a9('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x11a9('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf796=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf796,0xfc));var _0x6f79=function(_0x407bef,_0x304076){_0x407bef=_0x407bef-0x0;var _0x155f07=_0xf796[_0x407bef];return _0x155f07;};'use strict';var Sequelize=require(_0x6f79('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x6f79('0x1')](0xb),'unique':_0x6f79('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6f79('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x6f79('0x3')]},'defaultLogo':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6f79('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6f79('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6f79('0x3')]},'turnaddr':{'type':Sequelize[_0x6f79('0x3')]},'turnusername':{'type':Sequelize[_0x6f79('0x3')]},'turnpassword':{'type':Sequelize[_0x6f79('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6f79('0x3')],'defaultValue':_0x6f79('0x5')},'enableEmailPreview':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6f79('0x6')},'chatTimeout':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6f79('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6f79('0x3')]},'defaultFavicon':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6f79('0x1')]},'transcribeRegion':{'type':Sequelize[_0x6f79('0x3')]},'sentiment':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x6f79('0x1')]},'sentimentRegion':{'type':Sequelize[_0x6f79('0x3')]},'language':{'type':Sequelize[_0x6f79('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6f79('0x1')](0x2)[_0x6f79('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6f79('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6f79('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x6f79('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x6f79('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 20bd577..0624511 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 _0x09f4=['sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','name','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','fields','find','body','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','favicon','defaultLoginLogo','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x26a8aa,_0xcc692a){var _0x3d35f7=function(_0x125686){while(--_0x125686){_0x26a8aa['push'](_0x26a8aa['shift']());}};_0x3d35f7(++_0xcc692a);}(_0x09f4,0xe4));var _0x409f=function(_0x361931,_0x27574e){_0x361931=_0x361931-0x0;var _0x57984b=_0x09f4[_0x361931];return _0x57984b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x409f('0x0'));var jsonpatch=require(_0x409f('0x1'));var rp=require(_0x409f('0x2'));var moment=require(_0x409f('0x3'));var BPromise=require(_0x409f('0x4'));var Mustache=require(_0x409f('0x5'));var util=require(_0x409f('0x6'));var path=require(_0x409f('0x7'));var sox=require(_0x409f('0x8'));var csv=require(_0x409f('0x9'));var ejs=require(_0x409f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x409f('0xb'));var crypto=require(_0x409f('0xc'));var jsforce=require(_0x409f('0xd'));var deskjs=require(_0x409f('0xe'));var toCsv=require(_0x409f('0x9'));var querystring=require(_0x409f('0xf'));var Papa=require(_0x409f('0x10'));var Redis=require(_0x409f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x409f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x409f('0x13'))(_0x409f('0x14'));var utils=require(_0x409f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x409f('0x16'))['db'];var jayson=require(_0x409f('0x17'));var client=jayson[_0x409f('0x18')][_0x409f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1555c0,_0x3234c3,_0x2c4e0e,_0x565f47){return new BPromise(function(_0x1bc1bb,_0x55e557){var _0x3ec157=_0x565f47||client;return _0x3ec157[_0x409f('0x1a')](_0x1555c0,_0x2c4e0e)['then'](function(_0x34fcc9){logger[_0x409f('0x1b')](_0x409f('0x1c'),_0x3234c3,_0x409f('0x1d'));logger[_0x409f('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x3234c3,'request\x20sent',JSON['stringify'](_0x34fcc9));if(_0x34fcc9['error']){if(_0x34fcc9[_0x409f('0x1f')][_0x409f('0x20')]===0x1f4){logger[_0x409f('0x1f')]('Setting,\x20%s,\x20%s',_0x3234c3,_0x34fcc9[_0x409f('0x1f')]['message']);return _0x55e557(_0x34fcc9[_0x409f('0x1f')][_0x409f('0x21')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3234c3,_0x34fcc9[_0x409f('0x1f')]['message']);return _0x1bc1bb(_0x34fcc9[_0x409f('0x1f')][_0x409f('0x21')]);}else{logger[_0x409f('0x1b')]('Setting,\x20%s,\x20%s',_0x3234c3,_0x409f('0x1d'));_0x1bc1bb(_0x34fcc9[_0x409f('0x22')]['message']);}})[_0x409f('0x23')](function(_0x2f11c2){logger[_0x409f('0x1f')](_0x409f('0x1c'),_0x3234c3,_0x2f11c2);_0x55e557(_0x2f11c2);});});}function respondWithStatusCode(_0x344b3b,_0x11ca7f){_0x11ca7f=_0x11ca7f||0xcc;return function(_0xd937fe){if(_0xd937fe){return _0x344b3b[_0x409f('0x24')](_0x11ca7f);}return _0x344b3b[_0x409f('0x25')](_0x11ca7f)[_0x409f('0x26')]();};}function respondWithResult(_0x4dc190,_0x7e2bad){_0x7e2bad=_0x7e2bad||0xc8;return function(_0x1b9bce){if(_0x1b9bce){return _0x4dc190['status'](_0x7e2bad)['json'](_0x1b9bce);}};}function respondWithFilteredResult(_0x2f3051,_0x301cd4){return function(_0x521da8){if(_0x521da8){var _0x113f6b=typeof _0x301cd4[_0x409f('0x27')]===_0x409f('0x28')&&typeof _0x301cd4[_0x409f('0x29')]===_0x409f('0x28');var _0x2fca1d=_0x521da8[_0x409f('0x2a')];var _0x1aeea3=_0x113f6b?0x0:_0x301cd4['offset'];var _0x3750bb=_0x113f6b?_0x521da8[_0x409f('0x2a')]:_0x301cd4['offset']+_0x301cd4[_0x409f('0x29')];var _0xc7971e;if(_0x3750bb>=_0x2fca1d){_0x3750bb=_0x2fca1d;_0xc7971e=0xc8;}else{_0xc7971e=0xce;}_0x2f3051[_0x409f('0x25')](_0xc7971e);return _0x2f3051[_0x409f('0x2b')]('Content-Range',_0x1aeea3+'-'+_0x3750bb+'/'+_0x2fca1d)[_0x409f('0x2c')](_0x521da8);}return null;};}function patchUpdates(_0x14832d){return function(_0x6ef0ba){try{jsonpatch[_0x409f('0x2d')](_0x6ef0ba,_0x14832d,!![]);}catch(_0x1f5f39){return BPromise[_0x409f('0x2e')](_0x1f5f39);}return _0x6ef0ba[_0x409f('0x2f')]();};}function saveUpdates(_0x405bc3,_0x3fd225){return function(_0x2aaf0e){if(_0x2aaf0e){return _0x2aaf0e[_0x409f('0x30')](_0x405bc3)[_0x409f('0x31')](function(_0x4ba72d){return _0x4ba72d;});}return null;};}function removeEntity(_0x45a99f,_0x13a920){return function(_0x59df7c){if(_0x59df7c){return _0x59df7c[_0x409f('0x32')]()['then'](function(){_0x45a99f[_0x409f('0x25')](0xcc)[_0x409f('0x26')]();});}};}function handleEntityNotFound(_0x1f3e67,_0x44e1a3){return function(_0x362d85){if(!_0x362d85){_0x1f3e67[_0x409f('0x24')](0x194);}return _0x362d85;};}function handleError(_0x582b8a,_0xff40aa){_0xff40aa=_0xff40aa||0x1f4;return function(_0x2095f7){logger[_0x409f('0x1f')](_0x2095f7['stack']);if(_0x2095f7[_0x409f('0x33')]){delete _0x2095f7[_0x409f('0x33')];}_0x582b8a['status'](_0xff40aa)['send'](_0x2095f7);};}exports['index']=function(_0x28a50f,_0x12f98d){var _0x55e2bb={},_0x4eaf35={},_0x3720bb={'count':0x0,'rows':[]};var _0x4ef3d2=_[_0x409f('0x34')](db[_0x409f('0x35')][_0x409f('0x36')],function(_0x4791f5){return{'name':_0x4791f5[_0x409f('0x37')],'type':_0x4791f5[_0x409f('0x38')][_0x409f('0x39')]};});_0x4eaf35[_0x409f('0x3a')]=_[_0x409f('0x34')](_0x4ef3d2,_0x409f('0x33'));_0x4eaf35[_0x409f('0x3b')]=_['keys'](_0x28a50f[_0x409f('0x3b')]);_0x4eaf35[_0x409f('0x3c')]=_[_0x409f('0x3d')](_0x4eaf35[_0x409f('0x3a')],_0x4eaf35[_0x409f('0x3b')]);_0x55e2bb[_0x409f('0x3e')]=_[_0x409f('0x3d')](_0x4eaf35[_0x409f('0x3a')],qs['fields'](_0x28a50f[_0x409f('0x3b')]['fields']));_0x55e2bb[_0x409f('0x3e')]=_0x55e2bb['attributes'][_0x409f('0x3f')]?_0x55e2bb[_0x409f('0x3e')]:_0x4eaf35['model'];if(!_0x28a50f[_0x409f('0x3b')][_0x409f('0x40')]('nolimit')){_0x55e2bb[_0x409f('0x29')]=qs['limit'](_0x28a50f[_0x409f('0x3b')]['limit']);_0x55e2bb['offset']=qs[_0x409f('0x27')](_0x28a50f[_0x409f('0x3b')][_0x409f('0x27')]);}_0x55e2bb[_0x409f('0x41')]=qs[_0x409f('0x42')](_0x28a50f[_0x409f('0x3b')]['sort']);_0x55e2bb[_0x409f('0x43')]=qs[_0x409f('0x3c')](_[_0x409f('0x44')](_0x28a50f[_0x409f('0x3b')],_0x4eaf35[_0x409f('0x3c')]),_0x4ef3d2);if(_0x28a50f[_0x409f('0x3b')]['filter']){_0x55e2bb['where']=_[_0x409f('0x45')](_0x55e2bb[_0x409f('0x43')],{'$or':_[_0x409f('0x34')](_0x4ef3d2,function(_0x54f842){if(_0x54f842['type']!=='VIRTUAL'){var _0xf72ba5={};_0xf72ba5[_0x54f842[_0x409f('0x33')]]={'$like':'%'+_0x28a50f[_0x409f('0x3b')][_0x409f('0x46')]+'%'};return _0xf72ba5;}})});}_0x55e2bb=_[_0x409f('0x45')]({},_0x55e2bb,_0x28a50f[_0x409f('0x47')]);var _0x3bded7={'where':_0x55e2bb['where']};return db[_0x409f('0x35')][_0x409f('0x2a')](_0x3bded7)[_0x409f('0x31')](function(_0x160e45){_0x3720bb['count']=_0x160e45;if(_0x28a50f[_0x409f('0x3b')][_0x409f('0x48')]){_0x55e2bb[_0x409f('0x49')]=[{'all':!![]}];}return db[_0x409f('0x35')]['findAll'](_0x55e2bb);})[_0x409f('0x31')](function(_0x536f83){_0x3720bb[_0x409f('0x4a')]=_0x536f83;return _0x3720bb;})[_0x409f('0x31')](respondWithFilteredResult(_0x12f98d,_0x55e2bb))[_0x409f('0x23')](handleError(_0x12f98d,null));};exports[_0x409f('0x4b')]=function(_0x22ba65,_0x232373){var _0x84283f={'raw':![],'where':{'id':_0x22ba65[_0x409f('0x4c')]['id']}},_0x63a7a8={};_0x63a7a8[_0x409f('0x3a')]=_['keys'](db[_0x409f('0x35')][_0x409f('0x36')]);_0x63a7a8[_0x409f('0x3b')]=_['keys'](_0x22ba65[_0x409f('0x3b')]);_0x63a7a8[_0x409f('0x3c')]=_[_0x409f('0x3d')](_0x63a7a8['model'],_0x63a7a8[_0x409f('0x3b')]);_0x84283f[_0x409f('0x3e')]=_[_0x409f('0x3d')](_0x63a7a8[_0x409f('0x3a')],qs[_0x409f('0x4d')](_0x22ba65[_0x409f('0x3b')][_0x409f('0x4d')]));_0x84283f[_0x409f('0x3e')]=_0x84283f['attributes'][_0x409f('0x3f')]?_0x84283f[_0x409f('0x3e')]:_0x63a7a8['model'];if(_0x22ba65[_0x409f('0x3b')]['includeAll']){_0x84283f[_0x409f('0x49')]=[{'all':!![]}];}_0x84283f=_[_0x409f('0x45')]({},_0x84283f,_0x22ba65[_0x409f('0x47')]);return db[_0x409f('0x35')][_0x409f('0x4e')](_0x84283f)[_0x409f('0x31')](handleEntityNotFound(_0x232373,null))['then'](respondWithResult(_0x232373,null))['catch'](handleError(_0x232373,null));};exports[_0x409f('0x30')]=function(_0x43bbb3,_0x28e2b5){if(_0x43bbb3[_0x409f('0x4f')]['id']){delete _0x43bbb3[_0x409f('0x4f')]['id'];}return db[_0x409f('0x35')]['find']({'where':{'id':_0x43bbb3['params']['id']}})[_0x409f('0x31')](handleEntityNotFound(_0x28e2b5,null))[_0x409f('0x31')](saveUpdates(_0x43bbb3[_0x409f('0x4f')],null))[_0x409f('0x31')](respondWithResult(_0x28e2b5,null))[_0x409f('0x23')](handleError(_0x28e2b5,null));};exports[_0x409f('0x50')]=function(_0xc17b73,_0x45791,_0x16eaf8){if(_0xc17b73[_0x409f('0x51')]&&_0xc17b73[_0x409f('0x51')]['filename']){_0xc17b73[_0x409f('0x4f')]['logo']=_0xc17b73[_0x409f('0x51')]['filename'];}return db[_0x409f('0x35')]['find']({'where':{'id':_0xc17b73[_0x409f('0x4c')]['id']}})[_0x409f('0x31')](handleEntityNotFound(_0x45791,null))['then'](saveUpdates(_0xc17b73['body'],null))[_0x409f('0x31')](respondWithResult(_0x45791,null))[_0x409f('0x23')](handleError(_0x45791,null));};exports['addLogoLogin']=function(_0x2df918,_0xe2bab7,_0x3ce7c0){if(_0x2df918[_0x409f('0x51')]&&_0x2df918['file'][_0x409f('0x52')]){_0x2df918[_0x409f('0x4f')][_0x409f('0x53')]=_0x2df918[_0x409f('0x51')][_0x409f('0x52')];}return db[_0x409f('0x35')]['find']({'where':{'id':_0x2df918['params']['id']}})['then'](handleEntityNotFound(_0xe2bab7,null))['then'](saveUpdates(_0x2df918['body'],null))[_0x409f('0x31')](respondWithResult(_0xe2bab7,null))['catch'](handleError(_0xe2bab7,null));};var utilLicense=require(_0x409f('0x54'));exports[_0x409f('0x55')]=function(_0x2ba474,_0x2248af,_0x4c3d6b){var _0x59d163=_0x409f('0x56');var _0x5e2918={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x68eceb){if(_0x68eceb){_0x5e2918=_0x68eceb;}return db[_0x409f('0x35')]['find']({'where':{'id':_0x2ba474[_0x409f('0x4c')]['id']},'attributes':[_0x409f('0x58'),_0x409f('0x53'),_0x409f('0x59'),'favicon',_0x409f('0x5a'),'defaultLoginLogo',_0x409f('0x5b'),_0x409f('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x2248af,null))['then'](function(_0x5979a9){if(_0x5979a9){var _0x54d4b5=_0x5979a9['logo']&&fs[_0x409f('0x5d')](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_['toLower'](_0x5979a9['logo'])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_[_0x409f('0x60')](_0x5979a9[_0x409f('0x58')])):path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_[_0x409f('0x60')](_0x409f('0x61')));var _0xf44f6=_0x409f('0x62')+_[_0x409f('0x63')](_0x409f('0x58'));if(_0x5979a9[_0xf44f6]||!_0x5e2918[_0x409f('0x64')]){_0x54d4b5=path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_[_0x409f('0x60')](_0x409f('0x61')));}if(!fs[_0x409f('0x5d')](_0x54d4b5)){throw new db['Sequelize'][(_0x409f('0x65'))](_[_0x409f('0x63')](_0x409f('0x58'))+_0x409f('0x66'));}return _0x2248af['download'](_0x54d4b5);}})['catch'](handleError(_0x2248af,null));};var utilLicense=require(_0x409f('0x54'));exports['getLogoLogin']=function(_0x352ff7,_0x6a1cbb,_0x9b4838){var _0x3442f5=_0x409f('0x56');var _0x1f45f0={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x1f7fce){if(_0x1f7fce){_0x1f45f0=_0x1f7fce;}return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x352ff7[_0x409f('0x4c')]['id']},'attributes':[_0x409f('0x58'),_0x409f('0x53'),_0x409f('0x59'),_0x409f('0x67'),_0x409f('0x5a'),_0x409f('0x68'),_0x409f('0x5b'),_0x409f('0x5c')],'raw':!![]});})[_0x409f('0x31')](handleEntityNotFound(_0x6a1cbb,null))[_0x409f('0x31')](function(_0xf3e408){if(_0xf3e408){var _0x32d84d=_0xf3e408['loginLogo']&&fs[_0x409f('0x5d')](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_[_0x409f('0x60')](_0xf3e408[_0x409f('0x53')])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_[_0x409f('0x60')](_0xf3e408[_0x409f('0x53')])):path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_['toLower'](_0x409f('0x69')));var _0x36fb42=_0x409f('0x62')+_[_0x409f('0x63')]('loginLogo');if(_0xf3e408[_0x36fb42]||!_0x1f45f0[_0x409f('0x64')]){_0x32d84d=path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_['toLower'](_0x409f('0x69')));}if(!fs['existsSync'](_0x32d84d)){throw new db[(_0x409f('0x6a'))][(_0x409f('0x65'))](_['upperFirst'](_0x409f('0x53'))+_0x409f('0x66'));}return _0x6a1cbb[_0x409f('0x6b')](_0x32d84d);}})[_0x409f('0x23')](handleError(_0x6a1cbb,null));};exports[_0x409f('0x6c')]=function(_0x322ea4,_0x52664a){return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x322ea4[_0x409f('0x4c')]['id']},'attributes':[_0x409f('0x6d')]})[_0x409f('0x31')](respondWithResult(_0x52664a,null))[_0x409f('0x23')](handleError(_0x52664a,null));};exports[_0x409f('0x6e')]=function(_0x2b946b,_0x321eeb,_0x5868b5){if(_0x2b946b['file']&&_0x2b946b[_0x409f('0x51')][_0x409f('0x52')]){_0x2b946b['body'][_0x409f('0x59')]=_0x2b946b[_0x409f('0x51')]['filename'];}return db['Setting'][_0x409f('0x4e')]({'where':{'id':_0x2b946b[_0x409f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x321eeb,null))[_0x409f('0x31')](saveUpdates(_0x2b946b[_0x409f('0x4f')],null))[_0x409f('0x31')](respondWithResult(_0x321eeb,null))[_0x409f('0x23')](handleError(_0x321eeb,null));};var utilLicense=require(_0x409f('0x54'));exports[_0x409f('0x6f')]=function(_0x1ad442,_0x5929f3,_0x3e6d37){var _0x506cd4=_0x409f('0x56');var _0x5747df={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x26d419){if(_0x26d419){_0x5747df=_0x26d419;}return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x1ad442[_0x409f('0x4c')]['id']},'attributes':['logo',_0x409f('0x53'),_0x409f('0x59'),'favicon',_0x409f('0x5a'),_0x409f('0x68'),_0x409f('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x409f('0x31')](handleEntityNotFound(_0x5929f3,null))[_0x409f('0x31')](function(_0x5c2922){if(_0x5c2922){var _0x539107=_0x5c2922[_0x409f('0x59')]&&fs['existsSync'](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_['toLower'](_0x5c2922[_0x409f('0x59')])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_[_0x409f('0x60')](_0x5c2922['preferred'])):path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_[_0x409f('0x60')](_0x409f('0x70')));var _0x55e8a9='default'+_[_0x409f('0x63')](_0x409f('0x59'));if(_0x5c2922[_0x55e8a9]||!_0x5747df['custom']||!_0x5747df['preferred']){_0x539107=path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_[_0x409f('0x60')]('default_preferred.png'));}if(!fs[_0x409f('0x5d')](_0x539107)){throw new db['Sequelize'][(_0x409f('0x65'))](_[_0x409f('0x63')](_0x409f('0x59'))+_0x409f('0x66'));}return _0x5929f3[_0x409f('0x6b')](_0x539107);}})[_0x409f('0x23')](handleError(_0x5929f3,null));};exports[_0x409f('0x71')]=function(_0x1a2800,_0x5e3f2a,_0x469bd9){if(_0x1a2800[_0x409f('0x51')]&&_0x1a2800[_0x409f('0x51')]['filename']){_0x1a2800[_0x409f('0x4f')][_0x409f('0x67')]=_0x1a2800[_0x409f('0x51')]['filename'];}return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x1a2800[_0x409f('0x4c')]['id']}})[_0x409f('0x31')](handleEntityNotFound(_0x5e3f2a,null))[_0x409f('0x31')](saveUpdates(_0x1a2800[_0x409f('0x4f')],null))['then'](respondWithResult(_0x5e3f2a,null))['catch'](handleError(_0x5e3f2a,null));};var utilLicense=require(_0x409f('0x54'));exports['getFavicon']=function(_0x58af2c,_0x48abfa,_0x2a7f90){var _0x6ab63d='server/files/images/logos';var _0x38d278={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x3022e7){if(_0x3022e7){_0x38d278=_0x3022e7;}return db['Setting'][_0x409f('0x4e')]({'where':{'id':_0x58af2c[_0x409f('0x4c')]['id']},'attributes':['logo',_0x409f('0x53'),_0x409f('0x59'),_0x409f('0x67'),_0x409f('0x5a'),_0x409f('0x68'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x48abfa,null))[_0x409f('0x31')](function(_0x162e31){if(_0x162e31){var _0x8fde12=_0x162e31[_0x409f('0x67')]&&fs[_0x409f('0x5d')](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x6ab63d,_[_0x409f('0x60')](_0x162e31[_0x409f('0x67')])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x6ab63d,_[_0x409f('0x60')](_0x162e31[_0x409f('0x67')])):path['join'](config[_0x409f('0x5f')],_0x6ab63d,_[_0x409f('0x60')](_0x409f('0x72')));var _0x30809b=_0x409f('0x62')+_[_0x409f('0x63')](_0x409f('0x67'));if(_0x162e31[_0x30809b]||!_0x38d278[_0x409f('0x64')]){_0x8fde12=path[_0x409f('0x5e')](config['root'],_0x6ab63d,_[_0x409f('0x60')](_0x409f('0x72')));}if(!fs[_0x409f('0x5d')](_0x8fde12)){throw new db[(_0x409f('0x6a'))]['ValidationError'](_[_0x409f('0x63')](_0x409f('0x67'))+_0x409f('0x66'));}return _0x48abfa[_0x409f('0x6b')](_0x8fde12);}})['catch'](handleError(_0x48abfa,null));};exports['getDate']=function(_0x311cf7,_0x18c5ef){var _0x2461a9={'offset':moment()[_0x409f('0x73')]()};_0x2461a9['now']=moment()[_0x409f('0x73')](_0x2461a9[_0x409f('0x27')])[_0x409f('0x74')](_0x409f('0x75'));return _0x18c5ef[_0x409f('0x25')](0xc8)['send'](_0x2461a9);}; \ No newline at end of file +var _0x2b52=['pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','defaultLoginLogo','default_loginLogo.svg','getPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','map','Setting','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x179322,_0xe26301){var _0x1800e3=function(_0x28d023){while(--_0x28d023){_0x179322['push'](_0x179322['shift']());}};_0x1800e3(++_0xe26301);}(_0x2b52,0x12a));var _0x22b5=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x2b52[_0x20aadb];return _0x520018;};'use strict';var emlformat=require(_0x22b5('0x0'));var rimraf=require(_0x22b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22b5('0x2'));var rp=require(_0x22b5('0x3'));var moment=require(_0x22b5('0x4'));var BPromise=require(_0x22b5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x22b5('0x6'));var sox=require(_0x22b5('0x7'));var csv=require(_0x22b5('0x8'));var ejs=require(_0x22b5('0x9'));var fs=require('fs');var fs_extra=require(_0x22b5('0xa'));var _=require(_0x22b5('0xb'));var squel=require('squel');var crypto=require(_0x22b5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x22b5('0xd'));var Papa=require(_0x22b5('0xe'));var Redis=require(_0x22b5('0xf'));var authService=require(_0x22b5('0x10'));var qs=require(_0x22b5('0x11'));var as=require(_0x22b5('0x12'));var hardwareService=require(_0x22b5('0x13'));var logger=require(_0x22b5('0x14'))('api');var utils=require(_0x22b5('0x15'));var config=require(_0x22b5('0x16'));var licenseUtil=require(_0x22b5('0x17'));var db=require(_0x22b5('0x18'))['db'];var jayson=require(_0x22b5('0x19'));var client=jayson[_0x22b5('0x1a')][_0x22b5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3d093b,_0x49ce98,_0xb32a37,_0x2b38a3){return new BPromise(function(_0x1ebd1d,_0xf0c7d0){var _0x13222e=_0x2b38a3||client;return _0x13222e[_0x22b5('0x1c')](_0x3d093b,_0xb32a37)['then'](function(_0x4686a5){logger[_0x22b5('0x1d')](_0x22b5('0x1e'),_0x49ce98,_0x22b5('0x1f'));logger[_0x22b5('0x20')](_0x22b5('0x21'),_0x49ce98,_0x22b5('0x1f'),JSON[_0x22b5('0x22')](_0x4686a5));if(_0x4686a5[_0x22b5('0x23')]){if(_0x4686a5[_0x22b5('0x23')][_0x22b5('0x24')]===0x1f4){logger['error'](_0x22b5('0x1e'),_0x49ce98,_0x4686a5[_0x22b5('0x23')][_0x22b5('0x25')]);return _0xf0c7d0(_0x4686a5[_0x22b5('0x23')][_0x22b5('0x25')]);}logger['error'](_0x22b5('0x1e'),_0x49ce98,_0x4686a5[_0x22b5('0x23')][_0x22b5('0x25')]);return _0x1ebd1d(_0x4686a5['error'][_0x22b5('0x25')]);}else{logger[_0x22b5('0x1d')](_0x22b5('0x1e'),_0x49ce98,_0x22b5('0x1f'));_0x1ebd1d(_0x4686a5['result'][_0x22b5('0x25')]);}})[_0x22b5('0x26')](function(_0x262ead){logger[_0x22b5('0x23')](_0x22b5('0x1e'),_0x49ce98,_0x262ead);_0xf0c7d0(_0x262ead);});});}function respondWithStatusCode(_0x23c7c1,_0x2ea9c5){_0x2ea9c5=_0x2ea9c5||0xcc;return function(_0x3ccdbd){if(_0x3ccdbd){return _0x23c7c1[_0x22b5('0x27')](_0x2ea9c5);}return _0x23c7c1['status'](_0x2ea9c5)['end']();};}function respondWithResult(_0x19d12a,_0x1fcee0){_0x1fcee0=_0x1fcee0||0xc8;return function(_0xd8984d){if(_0xd8984d){return _0x19d12a[_0x22b5('0x28')](_0x1fcee0)[_0x22b5('0x29')](_0xd8984d);}};}function respondWithFilteredResult(_0xbdd923,_0x16d84d){return function(_0x2acef7){if(_0x2acef7){var _0x443ac6=typeof _0x16d84d[_0x22b5('0x2a')]===_0x22b5('0x2b')&&typeof _0x16d84d[_0x22b5('0x2c')]===_0x22b5('0x2b');var _0xc03b6f=_0x2acef7[_0x22b5('0x2d')];var _0x516f79=_0x443ac6?0x0:_0x16d84d['offset'];var _0x3448f7=_0x443ac6?_0x2acef7[_0x22b5('0x2d')]:_0x16d84d[_0x22b5('0x2a')]+_0x16d84d[_0x22b5('0x2c')];var _0x513a5b;if(_0x3448f7>=_0xc03b6f){_0x3448f7=_0xc03b6f;_0x513a5b=0xc8;}else{_0x513a5b=0xce;}_0xbdd923[_0x22b5('0x28')](_0x513a5b);return _0xbdd923[_0x22b5('0x2e')](_0x22b5('0x2f'),_0x516f79+'-'+_0x3448f7+'/'+_0xc03b6f)[_0x22b5('0x29')](_0x2acef7);}return null;};}function patchUpdates(_0x53aebc){return function(_0x34643d){try{jsonpatch['apply'](_0x34643d,_0x53aebc,!![]);}catch(_0x17f424){return BPromise[_0x22b5('0x30')](_0x17f424);}return _0x34643d[_0x22b5('0x31')]();};}function saveUpdates(_0x96ffee,_0x4a91c7){return function(_0x2542c0){if(_0x2542c0){return _0x2542c0[_0x22b5('0x32')](_0x96ffee)[_0x22b5('0x33')](function(_0x538ce4){return _0x538ce4;});}return null;};}function removeEntity(_0x16cbd0,_0x430ef9){return function(_0x257ce2){if(_0x257ce2){return _0x257ce2[_0x22b5('0x34')]()['then'](function(){_0x16cbd0[_0x22b5('0x28')](0xcc)[_0x22b5('0x35')]();});}};}function handleEntityNotFound(_0x21ab64,_0x40430a){return function(_0x262a51){if(!_0x262a51){_0x21ab64[_0x22b5('0x27')](0x194);}return _0x262a51;};}function handleError(_0x507798,_0x3ba364){_0x3ba364=_0x3ba364||0x1f4;return function(_0x2008e4){logger[_0x22b5('0x23')](_0x2008e4[_0x22b5('0x36')]);if(_0x2008e4[_0x22b5('0x37')]){delete _0x2008e4['name'];}_0x507798[_0x22b5('0x28')](_0x3ba364)['send'](_0x2008e4);};}exports[_0x22b5('0x38')]=function(_0x3956dc,_0x477d62){var _0x19240b={},_0x5b1ea4={},_0x59c00d={'count':0x0,'rows':[]};var _0x2aca3e=_[_0x22b5('0x39')](db[_0x22b5('0x3a')][_0x22b5('0x3b')],function(_0x7cced9){return{'name':_0x7cced9[_0x22b5('0x3c')],'type':_0x7cced9[_0x22b5('0x3d')]['key']};});_0x5b1ea4[_0x22b5('0x3e')]=_['map'](_0x2aca3e,'name');_0x5b1ea4['query']=_['keys'](_0x3956dc[_0x22b5('0x3f')]);_0x5b1ea4[_0x22b5('0x40')]=_[_0x22b5('0x41')](_0x5b1ea4[_0x22b5('0x3e')],_0x5b1ea4['query']);_0x19240b[_0x22b5('0x42')]=_['intersection'](_0x5b1ea4[_0x22b5('0x3e')],qs[_0x22b5('0x43')](_0x3956dc[_0x22b5('0x3f')][_0x22b5('0x43')]));_0x19240b[_0x22b5('0x42')]=_0x19240b[_0x22b5('0x42')][_0x22b5('0x44')]?_0x19240b[_0x22b5('0x42')]:_0x5b1ea4[_0x22b5('0x3e')];if(!_0x3956dc[_0x22b5('0x3f')][_0x22b5('0x45')](_0x22b5('0x46'))){_0x19240b[_0x22b5('0x2c')]=qs[_0x22b5('0x2c')](_0x3956dc[_0x22b5('0x3f')][_0x22b5('0x2c')]);_0x19240b[_0x22b5('0x2a')]=qs['offset'](_0x3956dc[_0x22b5('0x3f')]['offset']);}_0x19240b[_0x22b5('0x47')]=qs[_0x22b5('0x48')](_0x3956dc[_0x22b5('0x3f')]['sort']);_0x19240b[_0x22b5('0x49')]=qs[_0x22b5('0x40')](_[_0x22b5('0x4a')](_0x3956dc[_0x22b5('0x3f')],_0x5b1ea4[_0x22b5('0x40')]),_0x2aca3e);if(_0x3956dc[_0x22b5('0x3f')][_0x22b5('0x4b')]){_0x19240b[_0x22b5('0x49')]=_[_0x22b5('0x4c')](_0x19240b[_0x22b5('0x49')],{'$or':_[_0x22b5('0x39')](_0x2aca3e,function(_0x5c5283){if(_0x5c5283[_0x22b5('0x3d')]!==_0x22b5('0x4d')){var _0xd8b3c1={};_0xd8b3c1[_0x5c5283[_0x22b5('0x37')]]={'$like':'%'+_0x3956dc[_0x22b5('0x3f')]['filter']+'%'};return _0xd8b3c1;}})});}_0x19240b=_[_0x22b5('0x4c')]({},_0x19240b,_0x3956dc['options']);var _0xf8ad70={'where':_0x19240b['where']};return db[_0x22b5('0x3a')][_0x22b5('0x2d')](_0xf8ad70)['then'](function(_0x313c3c){_0x59c00d[_0x22b5('0x2d')]=_0x313c3c;if(_0x3956dc[_0x22b5('0x3f')][_0x22b5('0x4e')]){_0x19240b[_0x22b5('0x4f')]=[{'all':!![]}];}return db[_0x22b5('0x3a')][_0x22b5('0x50')](_0x19240b);})['then'](function(_0xc439e2){_0x59c00d[_0x22b5('0x51')]=_0xc439e2;return _0x59c00d;})[_0x22b5('0x33')](respondWithFilteredResult(_0x477d62,_0x19240b))[_0x22b5('0x26')](handleError(_0x477d62,null));};exports[_0x22b5('0x52')]=function(_0x5919dd,_0x426e60){var _0x398c8d={'raw':![],'where':{'id':_0x5919dd[_0x22b5('0x53')]['id']}},_0x2fb17e={};_0x2fb17e[_0x22b5('0x3e')]=_[_0x22b5('0x54')](db[_0x22b5('0x3a')][_0x22b5('0x3b')]);_0x2fb17e[_0x22b5('0x3f')]=_[_0x22b5('0x54')](_0x5919dd['query']);_0x2fb17e[_0x22b5('0x40')]=_[_0x22b5('0x41')](_0x2fb17e[_0x22b5('0x3e')],_0x2fb17e[_0x22b5('0x3f')]);_0x398c8d[_0x22b5('0x42')]=_[_0x22b5('0x41')](_0x2fb17e[_0x22b5('0x3e')],qs[_0x22b5('0x43')](_0x5919dd[_0x22b5('0x3f')][_0x22b5('0x43')]));_0x398c8d[_0x22b5('0x42')]=_0x398c8d['attributes'][_0x22b5('0x44')]?_0x398c8d[_0x22b5('0x42')]:_0x2fb17e[_0x22b5('0x3e')];if(_0x5919dd['query']['includeAll']){_0x398c8d[_0x22b5('0x4f')]=[{'all':!![]}];}_0x398c8d=_[_0x22b5('0x4c')]({},_0x398c8d,_0x5919dd[_0x22b5('0x55')]);return db[_0x22b5('0x3a')]['find'](_0x398c8d)[_0x22b5('0x33')](handleEntityNotFound(_0x426e60,null))['then'](respondWithResult(_0x426e60,null))['catch'](handleError(_0x426e60,null));};exports[_0x22b5('0x32')]=function(_0x4d4cff,_0x2df8d9){if(_0x4d4cff[_0x22b5('0x56')]['id']){delete _0x4d4cff[_0x22b5('0x56')]['id'];}return db[_0x22b5('0x3a')][_0x22b5('0x57')]({'where':{'id':_0x4d4cff['params']['id']}})[_0x22b5('0x33')](handleEntityNotFound(_0x2df8d9,null))['then'](saveUpdates(_0x4d4cff[_0x22b5('0x56')],null))[_0x22b5('0x33')](respondWithResult(_0x2df8d9,null))['catch'](handleError(_0x2df8d9,null));};exports[_0x22b5('0x58')]=function(_0x5006e6,_0x4328dd,_0x14f6e7){if(_0x5006e6['file']&&_0x5006e6[_0x22b5('0x59')][_0x22b5('0x5a')]){_0x5006e6[_0x22b5('0x56')][_0x22b5('0x5b')]=_0x5006e6[_0x22b5('0x59')]['filename'];}return db['Setting'][_0x22b5('0x57')]({'where':{'id':_0x5006e6['params']['id']}})['then'](handleEntityNotFound(_0x4328dd,null))[_0x22b5('0x33')](saveUpdates(_0x5006e6[_0x22b5('0x56')],null))[_0x22b5('0x33')](respondWithResult(_0x4328dd,null))[_0x22b5('0x26')](handleError(_0x4328dd,null));};exports[_0x22b5('0x5c')]=function(_0x4557a6,_0x5c6794,_0x46a89f){if(_0x4557a6[_0x22b5('0x59')]&&_0x4557a6['file']['filename']){_0x4557a6[_0x22b5('0x56')][_0x22b5('0x5d')]=_0x4557a6['file'][_0x22b5('0x5a')];}return db[_0x22b5('0x3a')]['find']({'where':{'id':_0x4557a6[_0x22b5('0x53')]['id']}})[_0x22b5('0x33')](handleEntityNotFound(_0x5c6794,null))[_0x22b5('0x33')](saveUpdates(_0x4557a6['body'],null))[_0x22b5('0x33')](respondWithResult(_0x5c6794,null))[_0x22b5('0x26')](handleError(_0x5c6794,null));};var utilLicense=require(_0x22b5('0x17'));exports[_0x22b5('0x5e')]=function(_0xbde814,_0x552bff,_0x1279ea){var _0x8a9aef=_0x22b5('0x5f');var _0x8315ea={'custom':![]};return utilLicense[_0x22b5('0x60')]()[_0x22b5('0x33')](function(_0x4251ab){if(_0x4251ab){_0x8315ea=_0x4251ab;}return db[_0x22b5('0x3a')][_0x22b5('0x57')]({'where':{'id':_0xbde814[_0x22b5('0x53')]['id']},'attributes':[_0x22b5('0x5b'),_0x22b5('0x5d'),_0x22b5('0x61'),_0x22b5('0x62'),_0x22b5('0x63'),'defaultLoginLogo',_0x22b5('0x64'),_0x22b5('0x65')],'raw':!![]});})[_0x22b5('0x33')](handleEntityNotFound(_0x552bff,null))[_0x22b5('0x33')](function(_0x5e749a){if(_0x5e749a){var _0x405eee=_0x5e749a['logo']&&fs[_0x22b5('0x66')](path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x8a9aef,_[_0x22b5('0x69')](_0x5e749a[_0x22b5('0x5b')])))?path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x8a9aef,_[_0x22b5('0x69')](_0x5e749a[_0x22b5('0x5b')])):path['join'](config['root'],_0x8a9aef,_[_0x22b5('0x69')](_0x22b5('0x6a')));var _0x26aa06=_0x22b5('0x6b')+_[_0x22b5('0x6c')](_0x22b5('0x5b'));if(_0x5e749a[_0x26aa06]||!_0x8315ea[_0x22b5('0x6d')]){_0x405eee=path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x8a9aef,_[_0x22b5('0x69')]('default_logo.svg'));}if(!fs[_0x22b5('0x66')](_0x405eee)){throw new db[(_0x22b5('0x6e'))][(_0x22b5('0x6f'))](_[_0x22b5('0x6c')]('logo')+_0x22b5('0x70'));}return _0x552bff[_0x22b5('0x71')](_0x405eee);}})[_0x22b5('0x26')](handleError(_0x552bff,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x20d319,_0x5a9ee7,_0x3b6bcf){var _0x185c63='server/files/images/logos';var _0x452cad={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x127a61){if(_0x127a61){_0x452cad=_0x127a61;}return db['Setting'][_0x22b5('0x57')]({'where':{'id':_0x20d319['params']['id']},'attributes':['logo','loginLogo',_0x22b5('0x61'),'favicon',_0x22b5('0x63'),_0x22b5('0x72'),_0x22b5('0x64'),_0x22b5('0x65')],'raw':!![]});})[_0x22b5('0x33')](handleEntityNotFound(_0x5a9ee7,null))[_0x22b5('0x33')](function(_0x4380e4){if(_0x4380e4){var _0x5b3f4a=_0x4380e4[_0x22b5('0x5d')]&&fs[_0x22b5('0x66')](path['join'](config[_0x22b5('0x68')],_0x185c63,_[_0x22b5('0x69')](_0x4380e4[_0x22b5('0x5d')])))?path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x185c63,_[_0x22b5('0x69')](_0x4380e4['loginLogo'])):path[_0x22b5('0x67')](config['root'],_0x185c63,_[_0x22b5('0x69')](_0x22b5('0x73')));var _0x1e44f2=_0x22b5('0x6b')+_['upperFirst']('loginLogo');if(_0x4380e4[_0x1e44f2]||!_0x452cad[_0x22b5('0x6d')]){_0x5b3f4a=path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x185c63,_[_0x22b5('0x69')](_0x22b5('0x73')));}if(!fs[_0x22b5('0x66')](_0x5b3f4a)){throw new db['Sequelize'][(_0x22b5('0x6f'))](_['upperFirst'](_0x22b5('0x5d'))+_0x22b5('0x70'));}return _0x5a9ee7[_0x22b5('0x71')](_0x5b3f4a);}})['catch'](handleError(_0x5a9ee7,null));};exports['gdpr']=function(_0x2bd159,_0x3c0abe){return db[_0x22b5('0x3a')][_0x22b5('0x57')]({'where':{'id':_0x2bd159['params']['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x3c0abe,null))[_0x22b5('0x26')](handleError(_0x3c0abe,null));};exports['addPreferred']=function(_0x274d4a,_0x32e86a,_0x39c81a){if(_0x274d4a[_0x22b5('0x59')]&&_0x274d4a[_0x22b5('0x59')]['filename']){_0x274d4a[_0x22b5('0x56')]['preferred']=_0x274d4a[_0x22b5('0x59')][_0x22b5('0x5a')];}return db[_0x22b5('0x3a')][_0x22b5('0x57')]({'where':{'id':_0x274d4a['params']['id']}})['then'](handleEntityNotFound(_0x32e86a,null))[_0x22b5('0x33')](saveUpdates(_0x274d4a[_0x22b5('0x56')],null))[_0x22b5('0x33')](respondWithResult(_0x32e86a,null))[_0x22b5('0x26')](handleError(_0x32e86a,null));};var utilLicense=require(_0x22b5('0x17'));exports[_0x22b5('0x74')]=function(_0x12d487,_0x50976b,_0x3c24d1){var _0x4bb653=_0x22b5('0x5f');var _0x15d4ba={'custom':![]};return utilLicense[_0x22b5('0x60')]()['then'](function(_0x3cf7c0){if(_0x3cf7c0){_0x15d4ba=_0x3cf7c0;}return db[_0x22b5('0x3a')][_0x22b5('0x57')]({'where':{'id':_0x12d487['params']['id']},'attributes':[_0x22b5('0x5b'),'loginLogo','preferred',_0x22b5('0x62'),_0x22b5('0x63'),_0x22b5('0x72'),_0x22b5('0x64'),_0x22b5('0x65')],'raw':!![]});})[_0x22b5('0x33')](handleEntityNotFound(_0x50976b,null))['then'](function(_0x159a98){if(_0x159a98){var _0x8c664a=_0x159a98[_0x22b5('0x61')]&&fs['existsSync'](path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x4bb653,_[_0x22b5('0x69')](_0x159a98[_0x22b5('0x61')])))?path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x4bb653,_[_0x22b5('0x69')](_0x159a98[_0x22b5('0x61')])):path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x4bb653,_[_0x22b5('0x69')]('default_preferred.png'));var _0x23173d=_0x22b5('0x6b')+_[_0x22b5('0x6c')](_0x22b5('0x61'));if(_0x159a98[_0x23173d]||!_0x15d4ba[_0x22b5('0x6d')]||!_0x15d4ba[_0x22b5('0x61')]){_0x8c664a=path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x4bb653,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x8c664a)){throw new db[(_0x22b5('0x6e'))][(_0x22b5('0x6f'))](_[_0x22b5('0x6c')](_0x22b5('0x61'))+_0x22b5('0x70'));}return _0x50976b[_0x22b5('0x71')](_0x8c664a);}})[_0x22b5('0x26')](handleError(_0x50976b,null));};exports[_0x22b5('0x75')]=function(_0x90d266,_0x69330a,_0x5bc691){if(_0x90d266[_0x22b5('0x59')]&&_0x90d266[_0x22b5('0x59')]['filename']){_0x90d266[_0x22b5('0x56')]['favicon']=_0x90d266[_0x22b5('0x59')][_0x22b5('0x5a')];}return db[_0x22b5('0x3a')]['find']({'where':{'id':_0x90d266[_0x22b5('0x53')]['id']}})[_0x22b5('0x33')](handleEntityNotFound(_0x69330a,null))['then'](saveUpdates(_0x90d266['body'],null))[_0x22b5('0x33')](respondWithResult(_0x69330a,null))[_0x22b5('0x26')](handleError(_0x69330a,null));};var utilLicense=require('../../config/license/util');exports[_0x22b5('0x76')]=function(_0x22698b,_0x57ae3d,_0x5a0a23){var _0x263e3a='server/files/images/logos';var _0x536715={'custom':![]};return utilLicense[_0x22b5('0x60')]()['then'](function(_0x2d4db8){if(_0x2d4db8){_0x536715=_0x2d4db8;}return db[_0x22b5('0x3a')][_0x22b5('0x57')]({'where':{'id':_0x22698b[_0x22b5('0x53')]['id']},'attributes':[_0x22b5('0x5b'),_0x22b5('0x5d'),'preferred',_0x22b5('0x62'),_0x22b5('0x63'),_0x22b5('0x72'),_0x22b5('0x64'),_0x22b5('0x65')],'raw':!![]});})[_0x22b5('0x33')](handleEntityNotFound(_0x57ae3d,null))[_0x22b5('0x33')](function(_0x1d6bc7){if(_0x1d6bc7){var _0x7d9c39=_0x1d6bc7[_0x22b5('0x62')]&&fs[_0x22b5('0x66')](path[_0x22b5('0x67')](config['root'],_0x263e3a,_[_0x22b5('0x69')](_0x1d6bc7[_0x22b5('0x62')])))?path['join'](config[_0x22b5('0x68')],_0x263e3a,_[_0x22b5('0x69')](_0x1d6bc7[_0x22b5('0x62')])):path[_0x22b5('0x67')](config[_0x22b5('0x68')],_0x263e3a,_['toLower'](_0x22b5('0x77')));var _0x25da17='default'+_[_0x22b5('0x6c')](_0x22b5('0x62'));if(_0x1d6bc7[_0x25da17]||!_0x536715[_0x22b5('0x6d')]){_0x7d9c39=path['join'](config['root'],_0x263e3a,_[_0x22b5('0x69')](_0x22b5('0x77')));}if(!fs[_0x22b5('0x66')](_0x7d9c39)){throw new db['Sequelize'][(_0x22b5('0x6f'))](_[_0x22b5('0x6c')](_0x22b5('0x62'))+_0x22b5('0x70'));}return _0x57ae3d[_0x22b5('0x71')](_0x7d9c39);}})[_0x22b5('0x26')](handleError(_0x57ae3d,null));};exports[_0x22b5('0x78')]=function(_0x3506b5,_0x54999c){var _0x4c3233={'offset':moment()[_0x22b5('0x79')]()};_0x4c3233['now']=moment()['utcOffset'](_0x4c3233['offset'])['format'](_0x22b5('0x7a'));return _0x54999c[_0x22b5('0x28')](0xc8)[_0x22b5('0x7b')](_0x4c3233);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 7dcb570..bba3c97 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x4dfa20,_0x35afb5){var _0x146afc=function(_0x5a4344){while(--_0x5a4344){_0x4dfa20['push'](_0x4dfa20['shift']());}};_0x146afc(++_0x35afb5);}(_0x3e74,0x175));var _0x43e7=function(_0x2903e0,_0xefce2c){_0x2903e0=_0x2903e0-0x0;var _0x5744cb=_0x3e74[_0x2903e0];return _0x5744cb;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0x55ca,0x126));var _0xa55c=function(_0xcd9ec8,_0x27699f){_0xcd9ec8=_0xcd9ec8-0x0;var _0x5aa31b=_0x55ca[_0xcd9ec8];return _0x5aa31b;};'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 7c92f6c..4dc61a3 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 _0xa5c3=['attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','ShowSetting','Setting','find','options','raw','where','include','model','map'];(function(_0x5e7c7a,_0x3439c1){var _0x106214=function(_0x4516ca){while(--_0x4516ca){_0x5e7c7a['push'](_0x5e7c7a['shift']());}};_0x106214(++_0x3439c1);}(_0xa5c3,0x1e1));var _0x3a5c=function(_0x1c5032,_0xb1820b){_0x1c5032=_0x1c5032-0x0;var _0x36acea=_0xa5c3[_0x1c5032];return _0x36acea;};'use strict';var _=require(_0x3a5c('0x0'));var util=require(_0x3a5c('0x1'));var moment=require(_0x3a5c('0x2'));var BPromise=require(_0x3a5c('0x3'));var rs=require(_0x3a5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a5c('0x5'))['db'];var utils=require(_0x3a5c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a5c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3a5c('0x8')][_0x3a5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb105a,_0x1b16aa,_0x25343e){return new BPromise(function(_0xb42579,_0x151705){return client[_0x3a5c('0xa')](_0xb105a,_0x25343e)[_0x3a5c('0xb')](function(_0x59a94f){logger['info']('Setting,\x20%s,\x20%s',_0x1b16aa,'request\x20sent');logger[_0x3a5c('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x1b16aa,_0x3a5c('0xd'),JSON[_0x3a5c('0xe')](_0x59a94f));if(_0x59a94f['error']){if(_0x59a94f[_0x3a5c('0xf')][_0x3a5c('0x10')]===0x1f4){logger['error'](_0x3a5c('0x11'),_0x1b16aa,_0x59a94f[_0x3a5c('0xf')]['message']);return _0x151705(_0x59a94f[_0x3a5c('0xf')][_0x3a5c('0x12')]);}logger[_0x3a5c('0xf')](_0x3a5c('0x11'),_0x1b16aa,_0x59a94f['error'][_0x3a5c('0x12')]);return _0xb42579(_0x59a94f[_0x3a5c('0xf')]['message']);}else{logger[_0x3a5c('0x13')](_0x3a5c('0x11'),_0x1b16aa,'request\x20sent');_0xb42579(_0x59a94f[_0x3a5c('0x14')][_0x3a5c('0x12')]);}})[_0x3a5c('0x15')](function(_0x5e4f0e){logger['error'](_0x3a5c('0x11'),_0x1b16aa,_0x5e4f0e);_0x151705(_0x5e4f0e);});});}exports[_0x3a5c('0x16')]=function(_0x24fcf4){var _0xc73235=this;return new Promise(function(_0x44c142,_0x269479){return db[_0x3a5c('0x17')][_0x3a5c('0x18')]({'raw':_0x24fcf4['options']?_0x24fcf4[_0x3a5c('0x19')][_0x3a5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x24fcf4['options']?_0x24fcf4[_0x3a5c('0x19')][_0x3a5c('0x1b')]||null:null,'attributes':_0x24fcf4[_0x3a5c('0x19')]?_0x24fcf4[_0x3a5c('0x19')]['attributes']||null:null,'include':_0x24fcf4[_0x3a5c('0x19')]?_0x24fcf4['options']['include']?_['map'](_0x24fcf4[_0x3a5c('0x19')][_0x3a5c('0x1c')],function(_0x3c0566){return{'model':db[_0x3c0566[_0x3a5c('0x1d')]],'as':_0x3c0566['as'],'attributes':_0x3c0566['attributes'],'include':_0x3c0566[_0x3a5c('0x1c')]?_[_0x3a5c('0x1e')](_0x3c0566[_0x3a5c('0x1c')],function(_0xbc1306){return{'model':db[_0xbc1306[_0x3a5c('0x1d')]],'as':_0xbc1306['as'],'attributes':_0xbc1306[_0x3a5c('0x1f')],'include':_0xbc1306[_0x3a5c('0x1c')]?_[_0x3a5c('0x1e')](_0xbc1306[_0x3a5c('0x1c')],function(_0x4d4312){return{'model':db[_0x4d4312['model']],'as':_0x4d4312['as'],'attributes':_0x4d4312[_0x3a5c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3a5c('0xb')](function(_0x1a269f){logger[_0x3a5c('0x13')](_0x3a5c('0x16'),_0x24fcf4);logger[_0x3a5c('0xc')]('ShowSetting',_0x24fcf4,JSON[_0x3a5c('0xe')](_0x1a269f));_0x44c142(_0x1a269f);})[_0x3a5c('0x15')](function(_0x432d7f){logger[_0x3a5c('0xf')](_0x3a5c('0x16'),_0x432d7f[_0x3a5c('0x12')],_0x24fcf4);_0x269479(_0xc73235[_0x3a5c('0xf')](0x1f4,_0x432d7f['message']));});});}; \ No newline at end of file +var _0x73d4=['where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSetting','Setting','find','options'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x73d4,0x105));var _0x473d=function(_0x5f1e1c,_0x329fc6){_0x5f1e1c=_0x5f1e1c-0x0;var _0x5981f5=_0x73d4[_0x5f1e1c];return _0x5981f5;};'use strict';var _=require(_0x473d('0x0'));var util=require('util');var moment=require(_0x473d('0x1'));var BPromise=require('bluebird');var rs=require(_0x473d('0x2'));var fs=require('fs');var Redis=require(_0x473d('0x3'));var db=require(_0x473d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x473d('0x5'))(_0x473d('0x6'));var config=require('../../config/environment');var jayson=require(_0x473d('0x7'));var client=jayson[_0x473d('0x8')][_0x473d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b642d,_0x545889,_0x1ed1a1){return new BPromise(function(_0x5bff0a,_0x16b6a3){return client[_0x473d('0xa')](_0x4b642d,_0x1ed1a1)[_0x473d('0xb')](function(_0x44154d){logger['info'](_0x473d('0xc'),_0x545889,_0x473d('0xd'));logger[_0x473d('0xe')](_0x473d('0xf'),_0x545889,_0x473d('0xd'),JSON[_0x473d('0x10')](_0x44154d));if(_0x44154d[_0x473d('0x11')]){if(_0x44154d['error'][_0x473d('0x12')]===0x1f4){logger[_0x473d('0x11')](_0x473d('0xc'),_0x545889,_0x44154d[_0x473d('0x11')][_0x473d('0x13')]);return _0x16b6a3(_0x44154d[_0x473d('0x11')][_0x473d('0x13')]);}logger[_0x473d('0x11')](_0x473d('0xc'),_0x545889,_0x44154d[_0x473d('0x11')][_0x473d('0x13')]);return _0x5bff0a(_0x44154d[_0x473d('0x11')][_0x473d('0x13')]);}else{logger[_0x473d('0x14')](_0x473d('0xc'),_0x545889,_0x473d('0xd'));_0x5bff0a(_0x44154d[_0x473d('0x15')]['message']);}})[_0x473d('0x16')](function(_0x4afdc8){logger[_0x473d('0x11')](_0x473d('0xc'),_0x545889,_0x4afdc8);_0x16b6a3(_0x4afdc8);});});}exports[_0x473d('0x17')]=function(_0x2a494a){var _0x283c88=this;return new Promise(function(_0x6fcb47,_0x2158b9){return db[_0x473d('0x18')][_0x473d('0x19')]({'raw':_0x2a494a[_0x473d('0x1a')]?_0x2a494a[_0x473d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2a494a['options']?_0x2a494a[_0x473d('0x1a')][_0x473d('0x1b')]||null:null,'attributes':_0x2a494a['options']?_0x2a494a['options'][_0x473d('0x1c')]||null:null,'include':_0x2a494a[_0x473d('0x1a')]?_0x2a494a['options'][_0x473d('0x1d')]?_[_0x473d('0x1e')](_0x2a494a[_0x473d('0x1a')]['include'],function(_0x5447e3){return{'model':db[_0x5447e3['model']],'as':_0x5447e3['as'],'attributes':_0x5447e3['attributes'],'include':_0x5447e3['include']?_['map'](_0x5447e3[_0x473d('0x1d')],function(_0xe97906){return{'model':db[_0xe97906[_0x473d('0x1f')]],'as':_0xe97906['as'],'attributes':_0xe97906[_0x473d('0x1c')],'include':_0xe97906[_0x473d('0x1d')]?_[_0x473d('0x1e')](_0xe97906[_0x473d('0x1d')],function(_0x14ed95){return{'model':db[_0x14ed95['model']],'as':_0x14ed95['as'],'attributes':_0x14ed95[_0x473d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38ec2f){logger[_0x473d('0x14')]('ShowSetting',_0x2a494a);logger['debug']('ShowSetting',_0x2a494a,JSON['stringify'](_0x38ec2f));_0x6fcb47(_0x38ec2f);})['catch'](function(_0x3ceb09){logger['error'](_0x473d('0x17'),_0x3ceb09[_0x473d('0x13')],_0x2a494a);_0x2158b9(_0x283c88['error'](0x1f4,_0x3ceb09[_0x473d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index bbf02d7..583b955 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x455eda,_0x5ba3e4){var _0x30284b=function(_0x46ea92){while(--_0x46ea92){_0x455eda['push'](_0x455eda['shift']());}};_0x30284b(++_0x5ba3e4);}(_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('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x4eaa3e,_0x24031c){var _0x18d712=function(_0x34c24b){while(--_0x34c24b){_0x4eaa3e['push'](_0x4eaa3e['shift']());}};_0x18d712(++_0x24031c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 8ae0cdc..2c6d951 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 _0xb11c=['connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING','generate','ENUM','twilio','skebby'];(function(_0x317019,_0x1725f4){var _0x2840ca=function(_0x370a85){while(--_0x370a85){_0x317019['push'](_0x317019['shift']());}};_0x2840ca(++_0x1725f4);}(_0xb11c,0x12d));var _0xcb11=function(_0x35d7c2,_0x5a0252){_0x35d7c2=_0x35d7c2-0x0;var _0x3d9ace=_0xb11c[_0x35d7c2];return _0x3d9ace;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcb11('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcb11('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xcb11('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xcb11('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcb11('0x2')],'defaultValue':function(){return rs[_0xcb11('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcb11('0x4')](_0xcb11('0x5'),_0xcb11('0x6'),_0xcb11('0x7'),_0xcb11('0x8'),_0xcb11('0x9'),_0xcb11('0xa'),'bandwidth',_0xcb11('0xb'),_0xcb11('0xc'),_0xcb11('0xd'))},'accountSid':{'type':Sequelize[_0xcb11('0x2')]},'authId':{'type':Sequelize[_0xcb11('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xcb11('0x2')]},'password':{'type':Sequelize[_0xcb11('0x2')]},'apiKey':{'type':Sequelize[_0xcb11('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xcb11('0x2')]},'senderString':{'type':Sequelize[_0xcb11('0x2')]},'deliveryReport':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xcb11('0x2')]},'notificationTemplate':{'type':Sequelize[_0xcb11('0xf')],'defaultValue':function(){return _0xcb11('0x10');}},'notificationSound':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb11('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb11('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![],'comment':_0xcb11('0x12'),'set':function(_0x397049){if(!_0x397049)this[_0xcb11('0x13')](_0xcb11('0x14'),null);this['setDataValue'](_0xcb11('0x15'),_0x397049);}}}; \ No newline at end of file +var _0x4ec3=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','connectel','plivo','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3ee7e4,_0x4debc8){var _0x642a7b=function(_0x5eef30){while(--_0x5eef30){_0x3ee7e4['push'](_0x3ee7e4['shift']());}};_0x642a7b(++_0x4debc8);}(_0x4ec3,0x124));var _0x34ec=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0x4ec3[_0x4c6cf0];return _0x108145;};'use strict';var Sequelize=require(_0x34ec('0x0'));var rs=require(_0x34ec('0x1'));module[_0x34ec('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x34ec('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x34ec('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x34ec('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x34ec('0x4')],'defaultValue':function(){return rs[_0x34ec('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x34ec('0x6')](_0x34ec('0x7'),'skebby',_0x34ec('0x8'),'clicksend',_0x34ec('0x9'),'clickatell',_0x34ec('0xa'),_0x34ec('0xb'),_0x34ec('0xc'),_0x34ec('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x34ec('0x4')]},'authToken':{'type':Sequelize[_0x34ec('0x4')]},'smsMethod':{'type':Sequelize[_0x34ec('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x34ec('0x4')]},'password':{'type':Sequelize[_0x34ec('0x4')]},'apiKey':{'type':Sequelize[_0x34ec('0x4')]},'applicationId':{'type':Sequelize[_0x34ec('0x4')]},'accountId':{'type':Sequelize[_0x34ec('0x4')]},'senderString':{'type':Sequelize[_0x34ec('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x34ec('0x4')]},'notificationTemplate':{'type':Sequelize[_0x34ec('0xe')],'defaultValue':function(){return _0x34ec('0xf');}},'notificationSound':{'type':Sequelize[_0x34ec('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x34ec('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x34ec('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x34ec('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x34ec('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x34ec('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x34ec('0x12'),'set':function(_0x48b5e9){if(!_0x48b5e9)this[_0x34ec('0x13')](_0x34ec('0x14'),null);this[_0x34ec('0x13')](_0x34ec('0x15'),_0x48b5e9);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 86aa2f6..745fd16 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 _0x1d03=['removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','Body','messageId','MessageSid','from','sender','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','SmsQueue','queueId','waitForTheAssignedQueue','receiveMessage','entity\x20found','send','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','push','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby','requestid','statusInt','status_code','DELIVERED','clickatell','bandwidth','redif','update','connectel','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','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/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','SmsAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','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','describe','addDisposition','getDispositions','findOne','Disposition','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1d03,0x166));var _0x31d0=function(_0x1b0e94,_0x522b67){_0x1b0e94=_0x1b0e94-0x0;var _0x180971=_0x1d03[_0x1b0e94];return _0x180971;};'use strict';var emlformat=require(_0x31d0('0x0'));var rimraf=require(_0x31d0('0x1'));var zipdir=require(_0x31d0('0x2'));var jsonpatch=require(_0x31d0('0x3'));var rp=require(_0x31d0('0x4'));var moment=require(_0x31d0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31d0('0x6'));var util=require(_0x31d0('0x7'));var path=require(_0x31d0('0x8'));var sox=require(_0x31d0('0x9'));var csv=require('to-csv');var ejs=require(_0x31d0('0xa'));var fs=require('fs');var fs_extra=require(_0x31d0('0xb'));var _=require(_0x31d0('0xc'));var squel=require(_0x31d0('0xd'));var crypto=require(_0x31d0('0xe'));var jsforce=require(_0x31d0('0xf'));var deskjs=require(_0x31d0('0x10'));var toCsv=require(_0x31d0('0x11'));var querystring=require('querystring');var Papa=require(_0x31d0('0x12'));var Redis=require(_0x31d0('0x13'));var authService=require(_0x31d0('0x14'));var qs=require(_0x31d0('0x15'));var as=require(_0x31d0('0x16'));var hardwareService=require(_0x31d0('0x17'));var logger=require(_0x31d0('0x18'))(_0x31d0('0x19'));var utils=require(_0x31d0('0x1a'));var config=require(_0x31d0('0x1b'));var licenseUtil=require(_0x31d0('0x1c'));var db=require('../../mysqldb')['db'];config[_0x31d0('0x1d')]=_['defaults'](config[_0x31d0('0x1d')],{'host':_0x31d0('0x1e'),'port':0x18eb});var socket=require(_0x31d0('0x1f'))(new Redis(config[_0x31d0('0x1d')]));require(_0x31d0('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x31d0('0x21')][_0x31d0('0x22')]({'port':0x232c});function respondWithRpcPromise(_0xa55c23,_0x569f31,_0x26361c,_0x3fae25){return new BPromise(function(_0x5c373c,_0x30db48){var _0x4cc938=_0x3fae25||client;return _0x4cc938[_0x31d0('0x23')](_0xa55c23,_0x26361c)[_0x31d0('0x24')](function(_0x4b2304){logger[_0x31d0('0x25')](_0x31d0('0x26'),_0x569f31,_0x31d0('0x27'));logger[_0x31d0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x569f31,_0x31d0('0x27'),JSON['stringify'](_0x4b2304));if(_0x4b2304[_0x31d0('0x29')]){if(_0x4b2304[_0x31d0('0x29')][_0x31d0('0x2a')]===0x1f4){logger[_0x31d0('0x29')](_0x31d0('0x26'),_0x569f31,_0x4b2304[_0x31d0('0x29')][_0x31d0('0x2b')]);return _0x30db48(_0x4b2304['error'][_0x31d0('0x2b')]);}logger[_0x31d0('0x29')](_0x31d0('0x26'),_0x569f31,_0x4b2304[_0x31d0('0x29')]['message']);return _0x5c373c(_0x4b2304[_0x31d0('0x29')][_0x31d0('0x2b')]);}else{logger[_0x31d0('0x25')]('SmsAccount,\x20%s,\x20%s',_0x569f31,_0x31d0('0x27'));_0x5c373c(_0x4b2304[_0x31d0('0x2c')]['message']);}})[_0x31d0('0x2d')](function(_0x4f19bd){logger[_0x31d0('0x29')](_0x31d0('0x26'),_0x569f31,_0x4f19bd);_0x30db48(_0x4f19bd);});});}function respondWithStatusCode(_0x144e9b,_0x8c6cea){_0x8c6cea=_0x8c6cea||0xcc;return function(_0x5d0b1c){if(_0x5d0b1c){return _0x144e9b[_0x31d0('0x2e')](_0x8c6cea);}return _0x144e9b['status'](_0x8c6cea)[_0x31d0('0x2f')]();};}function respondWithResult(_0x4c08ce,_0x5c3e85){_0x5c3e85=_0x5c3e85||0xc8;return function(_0x2769e1){if(_0x2769e1){return _0x4c08ce[_0x31d0('0x30')](_0x5c3e85)[_0x31d0('0x31')](_0x2769e1);}};}function respondWithFilteredResult(_0x3c9bda,_0xcd96e6){return function(_0x589f50){if(_0x589f50){var _0x4e97e5=typeof _0xcd96e6[_0x31d0('0x32')]===_0x31d0('0x33')&&typeof _0xcd96e6[_0x31d0('0x34')]===_0x31d0('0x33');var _0x376027=_0x589f50[_0x31d0('0x35')];var _0x5bda42=_0x4e97e5?0x0:_0xcd96e6['offset'];var _0x375311=_0x4e97e5?_0x589f50[_0x31d0('0x35')]:_0xcd96e6[_0x31d0('0x32')]+_0xcd96e6[_0x31d0('0x34')];var _0x483503;if(_0x375311>=_0x376027){_0x375311=_0x376027;_0x483503=0xc8;}else{_0x483503=0xce;}_0x3c9bda[_0x31d0('0x30')](_0x483503);return _0x3c9bda[_0x31d0('0x36')](_0x31d0('0x37'),_0x5bda42+'-'+_0x375311+'/'+_0x376027)[_0x31d0('0x31')](_0x589f50);}return null;};}function patchUpdates(_0x1cf2c3){return function(_0x3ace78){try{jsonpatch['apply'](_0x3ace78,_0x1cf2c3,!![]);}catch(_0x41f331){return BPromise[_0x31d0('0x38')](_0x41f331);}return _0x3ace78[_0x31d0('0x39')]();};}function saveUpdates(_0x64194e,_0x2a2da4){return function(_0x1d25d2){if(_0x1d25d2){return _0x1d25d2['update'](_0x64194e)[_0x31d0('0x24')](function(_0x20e4a6){return _0x20e4a6;});}return null;};}function removeEntity(_0x19104a,_0x2deeed){return function(_0x18b993){if(_0x18b993){return _0x18b993[_0x31d0('0x3a')]()[_0x31d0('0x24')](function(){var _0x11921f=_0x18b993[_0x31d0('0x3b')]({'plain':!![]});var _0x2a5c4a=_0x31d0('0x3c');return db[_0x31d0('0x3d')][_0x31d0('0x3a')]({'where':{'type':_0x2a5c4a,'resourceId':_0x11921f['id']}})[_0x31d0('0x24')](function(){return _0x18b993;});})[_0x31d0('0x24')](function(){_0x19104a[_0x31d0('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bec9f,_0x51a210){return function(_0xe7498f){if(!_0xe7498f){_0x1bec9f['sendStatus'](0x194);}return _0xe7498f;};}function handleError(_0x32e95a,_0x2ed5f3){_0x2ed5f3=_0x2ed5f3||0x1f4;return function(_0x37ff0f){logger[_0x31d0('0x29')](_0x37ff0f['stack']);if(_0x37ff0f[_0x31d0('0x3e')]){delete _0x37ff0f['name'];}_0x32e95a['status'](_0x2ed5f3)['send'](_0x37ff0f);};}exports[_0x31d0('0x3f')]=function(_0x4cfd21,_0x4c845e){var _0xac608={'include':[{'model':db[_0x31d0('0x40')],'as':_0x31d0('0x41')}]},_0x172fb6={},_0x1f1c64={'count':0x0,'rows':[]};var _0x29486f=_[_0x31d0('0x42')](db[_0x31d0('0x43')][_0x31d0('0x44')],function(_0x53c40f){return{'name':_0x53c40f['fieldName'],'type':_0x53c40f['type'][_0x31d0('0x45')]};});_0x172fb6[_0x31d0('0x46')]=_[_0x31d0('0x42')](_0x29486f,_0x31d0('0x3e'));_0x172fb6[_0x31d0('0x47')]=_['keys'](_0x4cfd21[_0x31d0('0x47')]);_0x172fb6[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x172fb6['model'],_0x172fb6[_0x31d0('0x47')]);_0xac608[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x172fb6['model'],qs[_0x31d0('0x4b')](_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x4b')]));_0xac608[_0x31d0('0x4a')]=_0xac608[_0x31d0('0x4a')][_0x31d0('0x4c')]?_0xac608[_0x31d0('0x4a')]:_0x172fb6[_0x31d0('0x46')];if(!_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0xac608[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0x4cfd21['query'][_0x31d0('0x34')]);_0xac608['offset']=qs[_0x31d0('0x32')](_0x4cfd21[_0x31d0('0x47')]['offset']);}_0xac608[_0x31d0('0x4f')]=qs['sort'](_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x50')]);_0xac608['where']=qs['filters'](_[_0x31d0('0x51')](_0x4cfd21[_0x31d0('0x47')],_0x172fb6['filters']),_0x29486f);if(_0x4cfd21['query'][_0x31d0('0x52')]){_0xac608['where']=_[_0x31d0('0x53')](_0xac608[_0x31d0('0x54')],{'$or':_['map'](_0x29486f,function(_0x2f2c96){if(_0x2f2c96[_0x31d0('0x55')]!==_0x31d0('0x56')){var _0x2f22ba={};_0x2f22ba[_0x2f2c96['name']]={'$like':'%'+_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x2f22ba;}})});}_0xac608=_[_0x31d0('0x53')]({},_0xac608,_0x4cfd21[_0x31d0('0x57')]);var _0x35cab6={'where':_0xac608[_0x31d0('0x54')]};return db['SmsAccount'][_0x31d0('0x35')](_0x35cab6)[_0x31d0('0x24')](function(_0x3970f2){_0x1f1c64[_0x31d0('0x35')]=_0x3970f2;if(_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x58')]){_0xac608[_0x31d0('0x59')]=[{'all':!![]}];}return db[_0x31d0('0x43')]['findAll'](_0xac608);})[_0x31d0('0x24')](function(_0x12a142){_0x1f1c64[_0x31d0('0x5a')]=_0x12a142;return _0x1f1c64;})[_0x31d0('0x24')](respondWithFilteredResult(_0x4c845e,_0xac608))[_0x31d0('0x2d')](handleError(_0x4c845e,null));};exports[_0x31d0('0x5b')]=function(_0x585027,_0x18d314){var _0x5a15f8={'raw':![],'where':{'id':_0x585027[_0x31d0('0x5c')]['id']},'include':[{'model':db[_0x31d0('0x40')],'as':_0x31d0('0x41')}]},_0x49e827={};_0x49e827[_0x31d0('0x46')]=_['keys'](db[_0x31d0('0x43')][_0x31d0('0x44')]);_0x49e827[_0x31d0('0x47')]=_[_0x31d0('0x5d')](_0x585027[_0x31d0('0x47')]);_0x49e827[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x49e827[_0x31d0('0x46')],_0x49e827[_0x31d0('0x47')]);_0x5a15f8[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x49e827['model'],qs['fields'](_0x585027[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x5a15f8[_0x31d0('0x4a')]=_0x5a15f8[_0x31d0('0x4a')][_0x31d0('0x4c')]?_0x5a15f8[_0x31d0('0x4a')]:_0x49e827[_0x31d0('0x46')];if(_0x585027[_0x31d0('0x47')]['includeAll']){_0x5a15f8[_0x31d0('0x59')]=[{'all':!![]}];}_0x5a15f8=_[_0x31d0('0x53')]({},_0x5a15f8,_0x585027[_0x31d0('0x57')]);return db[_0x31d0('0x43')][_0x31d0('0x5e')](_0x5a15f8)[_0x31d0('0x24')](handleEntityNotFound(_0x18d314,null))[_0x31d0('0x24')](respondWithResult(_0x18d314,null))[_0x31d0('0x2d')](handleError(_0x18d314,null));};exports[_0x31d0('0x5f')]=function(_0x344065,_0x214f39){return db[_0x31d0('0x43')]['create'](_0x344065[_0x31d0('0x60')],{})[_0x31d0('0x24')](function(_0x3f616a){var _0xcb07c6=_0x344065[_0x31d0('0x61')][_0x31d0('0x3b')]({'plain':!![]});if(!_0xcb07c6)throw new Error(_0x31d0('0x62'));if(_0xcb07c6[_0x31d0('0x63')]===_0x31d0('0x61')){var _0x51504c=_0x3f616a[_0x31d0('0x3b')]({'plain':!![]});var _0x406188='SmsAccounts';return db[_0x31d0('0x64')][_0x31d0('0x5e')]({'where':{'name':_0x406188,'userProfileId':_0xcb07c6[_0x31d0('0x65')]},'raw':!![]})[_0x31d0('0x24')](function(_0x20c971){if(_0x20c971&&_0x20c971[_0x31d0('0x66')]===0x0){return db[_0x31d0('0x3d')][_0x31d0('0x5f')]({'name':_0x51504c['name'],'resourceId':_0x51504c['id'],'type':_0x20c971['name'],'sectionId':_0x20c971['id']},{})[_0x31d0('0x24')](function(){return _0x3f616a;});}else{return _0x3f616a;}})[_0x31d0('0x2d')](function(_0x2e9029){logger[_0x31d0('0x29')](_0x31d0('0x67'),_0x2e9029);throw _0x2e9029;});}return _0x3f616a;})['then'](respondWithResult(_0x214f39,0xc9))[_0x31d0('0x2d')](handleError(_0x214f39,null));};exports['update']=function(_0x3edb93,_0x242eb7){if(_0x3edb93['body']['id']){delete _0x3edb93[_0x31d0('0x60')]['id'];}return db['SmsAccount'][_0x31d0('0x5e')]({'where':{'id':_0x3edb93['params']['id']},'include':[{'model':db[_0x31d0('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x242eb7,null))['then'](saveUpdates(_0x3edb93[_0x31d0('0x60')],null))['then'](respondWithResult(_0x242eb7,null))['catch'](handleError(_0x242eb7,null));};exports[_0x31d0('0x3a')]=function(_0x19d2e5,_0x1cff54){return db[_0x31d0('0x43')]['find']({'where':{'id':_0x19d2e5[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1cff54,null))['then'](removeEntity(_0x1cff54,null))[_0x31d0('0x2d')](handleError(_0x1cff54,null));};exports['describe']=function(_0x470910,_0x45b18f){return db[_0x31d0('0x43')][_0x31d0('0x68')]()[_0x31d0('0x24')](respondWithResult(_0x45b18f,null))[_0x31d0('0x2d')](handleError(_0x45b18f,null));};exports[_0x31d0('0x69')]=function(_0x4cad45,_0x4a9134,_0x135881){if(_0x4cad45['body']['id']){delete _0x4cad45[_0x31d0('0x60')]['id'];}return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x4cad45[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a9134,null))[_0x31d0('0x24')](function(_0x1afaaf){if(_0x1afaaf){_0x4cad45[_0x31d0('0x60')]['SmsAccountId']=_0x1afaaf['id'];return db['Disposition'][_0x31d0('0x5f')](_0x4cad45[_0x31d0('0x60')]);}})[_0x31d0('0x24')](respondWithResult(_0x4a9134,null))[_0x31d0('0x2d')](handleError(_0x4a9134,null));};exports[_0x31d0('0x6a')]=function(_0x1b6ff3,_0x26ca9c,_0x4c5c52){var _0x2b7172={'raw':![],'where':{}};var _0x63ccdd={};var _0x56f9cf={'count':0x0,'rows':[]};return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x1b6ff3[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x26ca9c,null))[_0x31d0('0x24')](function(_0x2b7a48){if(_0x2b7a48){_0x63ccdd[_0x31d0('0x46')]=_[_0x31d0('0x5d')](db[_0x31d0('0x6c')]['rawAttributes']);_0x63ccdd[_0x31d0('0x47')]=_[_0x31d0('0x5d')](_0x1b6ff3[_0x31d0('0x47')]);_0x63ccdd[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x63ccdd['model'],_0x63ccdd[_0x31d0('0x47')]);_0x2b7172[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x63ccdd[_0x31d0('0x46')],qs['fields'](_0x1b6ff3[_0x31d0('0x47')]['fields']));_0x2b7172[_0x31d0('0x4a')]=_0x2b7172[_0x31d0('0x4a')]['length']?_0x2b7172[_0x31d0('0x4a')]:_0x63ccdd[_0x31d0('0x46')];if(!_0x1b6ff3[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0x2b7172[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0x1b6ff3['query']['limit']);_0x2b7172['offset']=qs['offset'](_0x1b6ff3[_0x31d0('0x47')][_0x31d0('0x32')]);}_0x2b7172['order']=qs[_0x31d0('0x50')](_0x1b6ff3[_0x31d0('0x47')]['sort']);_0x2b7172[_0x31d0('0x54')]=qs['filters'](_[_0x31d0('0x51')](_0x1b6ff3[_0x31d0('0x47')],_0x63ccdd['filters']));_0x2b7172['where'][_0x31d0('0x6d')]=_0x2b7a48['id'];if(_0x1b6ff3['query'][_0x31d0('0x52')]){_0x2b7172['where']=_[_0x31d0('0x53')](_0x2b7172[_0x31d0('0x54')],{'$or':_[_0x31d0('0x42')](_0x2b7172[_0x31d0('0x4a')],function(_0x36ea06){var _0x51a495={};_0x51a495[_0x36ea06]={'$like':'%'+_0x1b6ff3['query'][_0x31d0('0x52')]+'%'};return _0x51a495;})});}_0x2b7172=_[_0x31d0('0x53')]({},_0x2b7172,_0x1b6ff3['options']);return db[_0x31d0('0x6c')][_0x31d0('0x35')]({'where':_0x2b7172[_0x31d0('0x54')]})[_0x31d0('0x24')](function(_0x11fd47){_0x56f9cf[_0x31d0('0x35')]=_0x11fd47;if(_0x1b6ff3[_0x31d0('0x47')]['includeAll']){_0x2b7172[_0x31d0('0x59')]=[{'all':!![]}];}return db[_0x31d0('0x6c')]['findAll'](_0x2b7172);})[_0x31d0('0x24')](function(_0x4fadd6){_0x56f9cf[_0x31d0('0x5a')]=_0x4fadd6;return _0x56f9cf;});}})[_0x31d0('0x24')](respondWithFilteredResult(_0x26ca9c,_0x2b7172))['catch'](handleError(_0x26ca9c,null));};exports['removeDispositions']=function(_0x3d8234,_0x34591f,_0x25c25c){return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x3d8234[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x34591f,null))[_0x31d0('0x24')](function(_0x5e1933){if(_0x5e1933){return _0x5e1933[_0x31d0('0x6e')](_0x3d8234['query'][_0x31d0('0x6f')]);}})[_0x31d0('0x24')](respondWithStatusCode(_0x34591f,null))[_0x31d0('0x2d')](handleError(_0x34591f,null));};exports[_0x31d0('0x70')]=function(_0x59cb02,_0x463059,_0x5e1063){if(_0x59cb02['body']['id']){delete _0x59cb02[_0x31d0('0x60')]['id'];}return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x59cb02[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x463059,null))[_0x31d0('0x24')](function(_0x255ba1){if(_0x255ba1){_0x59cb02[_0x31d0('0x60')]['SmsAccountId']=_0x255ba1['id'];return db[_0x31d0('0x71')][_0x31d0('0x5f')](_0x59cb02[_0x31d0('0x60')]);}})['then'](respondWithResult(_0x463059,null))['catch'](handleError(_0x463059,null));};exports[_0x31d0('0x72')]=function(_0xa690cb,_0x4f03e4,_0x35e450){var _0x4ea13d={'raw':![],'where':{}};var _0x2f785e={};var _0x2c7fe1={'count':0x0,'rows':[]};return db[_0x31d0('0x43')]['findOne']({'where':{'id':_0xa690cb[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x4f03e4,null))[_0x31d0('0x24')](function(_0x5c1dc3){if(_0x5c1dc3){_0x2f785e[_0x31d0('0x46')]=_['keys'](db[_0x31d0('0x71')][_0x31d0('0x44')]);_0x2f785e[_0x31d0('0x47')]=_['keys'](_0xa690cb[_0x31d0('0x47')]);_0x2f785e[_0x31d0('0x48')]=_['intersection'](_0x2f785e[_0x31d0('0x46')],_0x2f785e['query']);_0x4ea13d[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x2f785e[_0x31d0('0x46')],qs[_0x31d0('0x4b')](_0xa690cb[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x4ea13d[_0x31d0('0x4a')]=_0x4ea13d[_0x31d0('0x4a')]['length']?_0x4ea13d[_0x31d0('0x4a')]:_0x2f785e['model'];if(!_0xa690cb[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0x4ea13d[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0xa690cb[_0x31d0('0x47')][_0x31d0('0x34')]);_0x4ea13d[_0x31d0('0x32')]=qs['offset'](_0xa690cb['query'][_0x31d0('0x32')]);}_0x4ea13d[_0x31d0('0x4f')]=qs[_0x31d0('0x50')](_0xa690cb['query'][_0x31d0('0x50')]);_0x4ea13d[_0x31d0('0x54')]=qs['filters'](_['pick'](_0xa690cb['query'],_0x2f785e['filters']));_0x4ea13d[_0x31d0('0x54')][_0x31d0('0x6d')]=_0x5c1dc3['id'];if(_0xa690cb[_0x31d0('0x47')]['filter']){_0x4ea13d['where']=_[_0x31d0('0x53')](_0x4ea13d[_0x31d0('0x54')],{'$or':_['map'](_0x4ea13d['attributes'],function(_0x12ad50){var _0x599e45={};_0x599e45[_0x12ad50]={'$like':'%'+_0xa690cb[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x599e45;})});}_0x4ea13d=_[_0x31d0('0x53')]({},_0x4ea13d,_0xa690cb[_0x31d0('0x57')]);return db[_0x31d0('0x71')]['count']({'where':_0x4ea13d[_0x31d0('0x54')]})['then'](function(_0x10840f){_0x2c7fe1['count']=_0x10840f;if(_0xa690cb['query']['includeAll']){_0x4ea13d[_0x31d0('0x59')]=[{'all':!![]}];}return db[_0x31d0('0x71')][_0x31d0('0x73')](_0x4ea13d);})[_0x31d0('0x24')](function(_0x1abeaf){_0x2c7fe1[_0x31d0('0x5a')]=_0x1abeaf;return _0x2c7fe1;});}})['then'](respondWithFilteredResult(_0x4f03e4,_0x4ea13d))[_0x31d0('0x2d')](handleError(_0x4f03e4,null));};exports[_0x31d0('0x74')]=function(_0x383a9a,_0x25d659,_0x477a30){return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x383a9a[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x25d659,null))['then'](function(_0x2a4be8){if(_0x2a4be8){return _0x2a4be8[_0x31d0('0x74')](_0x383a9a[_0x31d0('0x47')]['ids']);}})[_0x31d0('0x24')](respondWithStatusCode(_0x25d659,null))[_0x31d0('0x2d')](handleError(_0x25d659,null));};exports[_0x31d0('0x75')]=function(_0x2bbf11,_0x5e333e,_0x472471){var _0x1f91a7={'channel':_0x31d0('0x76')};var _0x1f27b4=[];var _0xbfa71c=[];var _0x425d49={};return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x2bbf11[_0x31d0('0x5c')]['id']},'include':[{'model':db[_0x31d0('0x77')],'as':_0x31d0('0x78')}]})[_0x31d0('0x24')](handleEntityNotFound(_0x5e333e,null))[_0x31d0('0x24')](function(_0x21f686){_0x1f91a7[_0x31d0('0x79')]=_0x21f686;_0x1f91a7[_0x31d0('0x7a')]=_[_0x31d0('0x7b')](_0x21f686['Applications'],['priority'],[_0x31d0('0x7c')]);if(_0x1f91a7[_0x31d0('0x79')]['Applications']){delete _0x1f91a7['account'][_0x31d0('0x78')];}return db[_0x31d0('0x7d')][_0x31d0('0x68')]();})[_0x31d0('0x24')](function(_0x298a3c){if(!_0x298a3c){throw new db[(_0x31d0('0x7e'))][(_0x31d0('0x7f'))]('no\x20available\x20attributes');}_0x1f27b4=_[_0x31d0('0x80')](_[_0x31d0('0x5d')](_0x298a3c),['createdAt',_0x31d0('0x81')]);_0xbfa71c=_[_0x31d0('0x80')](_[_0x31d0('0x5d')](_0x298a3c),[_0x31d0('0x82'),_0x31d0('0x81'),_0x31d0('0x83'),_0x31d0('0x84')]);_0x1f91a7[_0x31d0('0x60')]={'mapKey':_0x31d0('0x85')};if(_0x1f91a7['account'][_0x31d0('0x55')]){switch(_0x1f91a7[_0x31d0('0x79')][_0x31d0('0x55')]){case _0x31d0('0x86'):_0x1f91a7[_0x31d0('0x60')]['from']=_0x2bbf11[_0x31d0('0x60')]['From'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11['body'][_0x31d0('0x87')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x89')];break;case'skebby':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]='+'+_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8b')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')]['text'];break;case'connectel':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')]['from'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11['body'][_0x31d0('0x2b')];break;case _0x31d0('0x8c'):_0x1f91a7['body']['from']=_0x2bbf11['body'][_0x31d0('0x8a')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')]['body'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8d')];break;case _0x31d0('0x8e'):_0x1f91a7[_0x31d0('0x60')]['from']=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8f')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x90')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11['body'][_0x31d0('0x91')];break;case _0x31d0('0x92'):_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]='+'+_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x93')][0x0][_0x31d0('0x8a')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x93')][0x0][_0x31d0('0x94')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11['body'][_0x31d0('0x93')][0x0]['messageId'];break;case'csc':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x95')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x96')][_0x31d0('0x2b')];break;case'clickatell':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x97')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x94')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x98')];break;case'bandwidth':_0x1f91a7[_0x31d0('0x60')]['messageId']=_0x2bbf11[_0x31d0('0x60')][0x0]['message']['id'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][0x0][_0x31d0('0x2b')][_0x31d0('0x8a')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][0x0][_0x31d0('0x2b')][_0x31d0('0x94')];break;case _0x31d0('0x99'):_0x1f91a7['body'][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8a')];_0x1f91a7[_0x31d0('0x60')]['body']=_0x2bbf11[_0x31d0('0x60')]['message'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')]['refid'];break;}}if(_0x1f91a7[_0x31d0('0x60')]['id']){delete _0x1f91a7[_0x31d0('0x60')]['id'];}if(_['isNil'](_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')])){throw new db['Sequelize'][(_0x31d0('0x7f'))](_0x31d0('0x9a'));}if(_[_0x31d0('0x9b')](_0x1f91a7[_0x31d0('0x60')]['body'])||_0x1f91a7['body'][_0x31d0('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x31d0('0x9c'));}if(_[_0x31d0('0x9b')](_0x1f91a7['body'][_0x31d0('0x9d')])){throw new db[(_0x31d0('0x7e'))]['ValidationError'](_0x31d0('0x9e')+_0xbfa71c);}if(!_['includes'](_0xbfa71c,_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x9d')])){throw new db[(_0x31d0('0x7e'))]['ValidationError'](_0x31d0('0x9f')+_0xbfa71c);}_0x425d49[_0x1f91a7['body'][_0x31d0('0x9d')]]=_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')];return db[_0x31d0('0xa0')][_0x31d0('0x5e')]({'where':{'id':_0x1f91a7[_0x31d0('0x79')][_0x31d0('0x84')]},'include':[{'model':db['CmContact'],'as':_0x31d0('0xa1'),'where':_0x425d49,'limit':0x1,'order':[[_0x31d0('0x81'),_0x31d0('0xa2')]]}]});})[_0x31d0('0x24')](handleEntityNotFound(_0x5e333e,null))['then'](function(_0x374dff){if(_0x374dff){_0x1f91a7[_0x31d0('0xa3')]=_[_0x31d0('0xa4')](_0x374dff,[_0x31d0('0xa1')]);if(_0x374dff[_0x31d0('0xa1')][_0x31d0('0x4c')]){return _0x374dff[_0x31d0('0xa1')][0x0];}var _0x4775da=_[_0x31d0('0xa5')](_0x1f91a7[_0x31d0('0x60')],{'firstName':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')],'ListId':_0x374dff['id']});_0x4775da[_0x1f91a7['body'][_0x31d0('0x9d')]]=_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')];return db['CmContact']['create'](_0x4775da,{'fields':_0x1f27b4,'raw':!![]});}})['then'](handleEntityNotFound(_0x5e333e,null))[_0x31d0('0x24')](function(_0x216ea0){if(_0x216ea0){_0x1f91a7[_0x31d0('0xa6')]=_0x216ea0;var _0x5cc2cd={'ContactId':_0x216ea0['id'],'phone':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')],'SmsAccountId':_0x2bbf11[_0x31d0('0x5c')]['id']};var _0x35966d={'ContactId':_0x216ea0['id'],'SmsAccountId':_0x2bbf11['params']['id'],'closed':![]};return db[_0x31d0('0xa7')][_0x31d0('0x5e')]({'where':_0x35966d})[_0x31d0('0x24')](function(_0x3a6f57){if(_0x3a6f57){return[_0x3a6f57,![]];}return db[_0x31d0('0xa7')][_0x31d0('0x5f')](_0x5cc2cd)[_0x31d0('0x24')](function(_0x43513d){return[_0x43513d,!![]];});});}})[_0x31d0('0xa8')](function(_0x1d422b,_0x33266a){_0x1f91a7[_0x31d0('0xa9')]=_0x1d422b[_0x31d0('0x3b')]({'plain':!![]});_0x1f91a7[_0x31d0('0xa9')][_0x31d0('0xaa')]=![];if(_0x33266a){if(_0x1f91a7[_0x31d0('0x79')][_0x31d0('0xab')]){_0x1f91a7['applications']['push']({'id':0x0,'priority':_0x1f91a7['applications']['length']+0x1,'app':'close','appdata':_0x31d0('0xac'),'interval':_0x31d0('0xad')});}_0x1f91a7['interaction'][_0x31d0('0xaa')]=!![];}return db[_0x31d0('0xae')]['create']({'phone':_0x1f91a7[_0x31d0('0x60')]['from'],'messageId':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')],'body':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')],'SmsAccountId':_0x2bbf11[_0x31d0('0x5c')]['id'],'SmsInteractionId':_0x1d422b['id'],'direction':'in','ContactId':_0x1d422b[_0x31d0('0xaf')],'AttachmentId':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0xb0')]});})[_0x31d0('0x24')](function(_0x2c2bd6){_0x1f91a7[_0x31d0('0x2b')]=_0x2c2bd6;if(!_0x1f91a7[_0x31d0('0xa9')][_0x31d0('0xb1')])return;return db['User'][_0x31d0('0x5e')]({'attributes':['id',_0x31d0('0x3e')],'where':{'id':_0x1f91a7['interaction'][_0x31d0('0xb1')]}});})[_0x31d0('0x24')](function(_0x463a4b){if(_0x463a4b){_0x1f91a7[_0x31d0('0x7a')][_0x31d0('0xb2')]({'id':0x0,'priority':0x0,'app':_0x31d0('0xb3'),'appdata':_0x463a4b[_0x31d0('0x3e')]+','+(_0x1f91a7[_0x31d0('0x79')]['waitForTheAssignedAgent']||0xa),'interval':_0x31d0('0xad')});}if(!_0x1f91a7[_0x31d0('0xa9')]['queueId'])return;return db[_0x31d0('0xb4')][_0x31d0('0x5e')]({'attributes':['id',_0x31d0('0x3e')],'where':{'id':_0x1f91a7[_0x31d0('0xa9')][_0x31d0('0xb5')]}});})['then'](function(_0x7a383b){if(_0x7a383b){_0x1f91a7[_0x31d0('0x7a')][_0x31d0('0xb2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x7a383b[_0x31d0('0x3e')]+','+(_0x1f91a7[_0x31d0('0x79')][_0x31d0('0xb6')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x1f91a7);})[_0x31d0('0x24')](function(_0x382de8){if(_0x382de8){var _0x4a943c=0xc8;var _0x26324d=_0x31d0('0xb7');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x26324d,_0x4a943c,'entity\x20found');logger[_0x31d0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x26324d,_0x4a943c,_0x31d0('0xb8'),JSON['stringify'](_0x382de8));if(_0x1f91a7[_0x31d0('0x79')]['type']===_0x31d0('0x86')){return _0x5e333e[_0x31d0('0x30')](_0x4a943c)[_0x31d0('0x36')]('Content-Type','text/xml')[_0x31d0('0xb9')]('\x0a');}else{return _0x5e333e[_0x31d0('0x30')](_0x4a943c)['json'](_0x382de8);}}})[_0x31d0('0x2d')](handleError(_0x5e333e,null));};exports[_0x31d0('0xba')]=function(_0x3130ca,_0x5788de){var _0x5431fc=_0x3130ca[_0x31d0('0x5c')]['id'];var _0x56046a=_0x3130ca[_0x31d0('0x60')];var _0x33231b=0xc8;var _0x390e23=null;return db['sequelize'][_0x31d0('0xbb')]({'isolationLevel':db['sequelize'][_0x31d0('0xbc')][_0x31d0('0xbd')][_0x31d0('0xbe')]},function(_0x24a62f){return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x5431fc},'transaction':_0x24a62f})[_0x31d0('0x24')](function(_0x2a8c2f){if(_0x2a8c2f){return db['SmsApplication'][_0x31d0('0x3a')]({'where':{'SmsAccountId':_0x5431fc},'transaction':_0x24a62f})['then'](function(){var _0x19794f=_[_0x31d0('0x42')](_0x56046a,function(_0x470eea){_0x470eea['SmsAccountId']=_0x5431fc;return _0x470eea;});return db[_0x31d0('0x77')][_0x31d0('0xbf')](_0x19794f,{'transaction':_0x24a62f});});}else{_0x33231b=0x194;_0x390e23=[];}});})[_0x31d0('0x24')](function(){if(_0x33231b!==0x194){return db[_0x31d0('0x77')]['findAndCountAll']({'where':{'SmsAccountId':_0x5431fc},'order':'priority'})[_0x31d0('0x24')](function(_0x10bcea){_0x390e23=_0x10bcea;});}})[_0x31d0('0x2d')](function(_0x1b725c){_0x33231b=0x1f4;logger[_0x31d0('0x29')](_0x1b725c[_0x31d0('0xc0')]);if(_0x1b725c[_0x31d0('0x3e')]){delete _0x1b725c['name'];}_0x390e23=_0x1b725c;})[_0x31d0('0xc1')](function(){if(_0x390e23===null){_0x5788de[_0x31d0('0x2e')](_0x33231b);}else{if(_0x33231b===0x1f4){_0x5788de[_0x31d0('0x30')](_0x33231b)['send'](_0x390e23);}else{_0x5788de[_0x31d0('0x30')](_0x33231b)[_0x31d0('0x31')](_0x390e23);}}});};exports[_0x31d0('0xc2')]=function(_0xab9d89,_0x141524,_0x53fd47){var _0x19bf22={};var _0x213e52={};var _0xb157f2;var _0xc79ded;return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0xab9d89[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x141524,null))[_0x31d0('0x24')](function(_0x4403b4){if(_0x4403b4){_0xb157f2=_0x4403b4;_0x213e52[_0x31d0('0x46')]=_['keys'](db[_0x31d0('0x77')][_0x31d0('0x44')]);_0x213e52[_0x31d0('0x47')]=_['keys'](_0xab9d89[_0x31d0('0x47')]);_0x213e52[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x213e52[_0x31d0('0x46')],_0x213e52[_0x31d0('0x47')]);_0x19bf22['attributes']=_[_0x31d0('0x49')](_0x213e52[_0x31d0('0x46')],qs[_0x31d0('0x4b')](_0xab9d89[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x19bf22[_0x31d0('0x4a')]=_0x19bf22[_0x31d0('0x4a')][_0x31d0('0x4c')]?_0x19bf22[_0x31d0('0x4a')]:_0x213e52[_0x31d0('0x46')];_0x19bf22[_0x31d0('0x4f')]=qs['sort'](_0xab9d89[_0x31d0('0x47')][_0x31d0('0x50')]);_0x19bf22[_0x31d0('0x54')]=qs[_0x31d0('0x48')](_[_0x31d0('0x51')](_0xab9d89[_0x31d0('0x47')],_0x213e52['filters']));if(_0xab9d89['query'][_0x31d0('0x52')]){_0x19bf22[_0x31d0('0x54')]=_[_0x31d0('0x53')](_0x19bf22[_0x31d0('0x54')],{'$or':_[_0x31d0('0x42')](_0x19bf22[_0x31d0('0x4a')],function(_0x1bc1e9){var _0x305467={};_0x305467[_0x1bc1e9]={'$like':'%'+_0xab9d89['query']['filter']+'%'};return _0x305467;})});}_0x19bf22=_['merge']({},_0x19bf22,_0xab9d89['options']);return _0xb157f2[_0x31d0('0xc2')](_0x19bf22);}})[_0x31d0('0x24')](function(_0x48f489){if(_0x48f489){_0xc79ded=_0x48f489['length'];if(!_0xab9d89[_0x31d0('0x47')]['hasOwnProperty'](_0x31d0('0x4e'))){_0x19bf22[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0xab9d89[_0x31d0('0x47')]['limit']);_0x19bf22[_0x31d0('0x32')]=qs['offset'](_0xab9d89['query'][_0x31d0('0x32')]);}return _0xb157f2[_0x31d0('0xc2')](_0x19bf22);}})[_0x31d0('0x24')](function(_0xc6601e){if(_0xc6601e){return _0xc6601e?{'count':_0xc79ded,'rows':_0xc6601e}:null;}})[_0x31d0('0x24')](respondWithResult(_0x141524,null))[_0x31d0('0x2d')](handleError(_0x141524,null));};exports[_0x31d0('0xc3')]=function(_0x5dd66a,_0x4d9f54,_0x48e37c){var _0x1a350e={'raw':![],'where':{}};var _0x46d9a3={};var _0x14cd36={'count':0x0,'rows':[]};return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x5dd66a[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x4d9f54,null))['then'](function(_0x1ced2){if(_0x1ced2){_0x46d9a3[_0x31d0('0x46')]=_[_0x31d0('0x5d')](db[_0x31d0('0xa7')][_0x31d0('0x44')]);_0x46d9a3['query']=_[_0x31d0('0x5d')](_0x5dd66a[_0x31d0('0x47')]);_0x46d9a3[_0x31d0('0x48')]=_['intersection'](_0x46d9a3[_0x31d0('0x46')],_0x46d9a3['query']);_0x1a350e[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x46d9a3[_0x31d0('0x46')],qs['fields'](_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x1a350e[_0x31d0('0x4a')]=_0x1a350e['attributes'][_0x31d0('0x4c')]?_0x1a350e[_0x31d0('0x4a')]:_0x46d9a3[_0x31d0('0x46')];if(!_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x4d')]('nolimit')){_0x1a350e['limit']=qs[_0x31d0('0x34')](_0x5dd66a['query'][_0x31d0('0x34')]);_0x1a350e[_0x31d0('0x32')]=qs[_0x31d0('0x32')](_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x32')]);}_0x1a350e[_0x31d0('0x4f')]=qs['sort'](_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x50')]);_0x1a350e[_0x31d0('0x54')]=qs[_0x31d0('0x48')](_[_0x31d0('0x51')](_0x5dd66a['query'],_0x46d9a3[_0x31d0('0x48')]));_0x1a350e[_0x31d0('0x54')]['SmsAccountId']=_0x1ced2['id'];if(_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x52')]){_0x1a350e[_0x31d0('0x54')]=_['merge'](_0x1a350e[_0x31d0('0x54')],{'$or':_['map'](_0x1a350e[_0x31d0('0x4a')],function(_0x3873a9){var _0x5b568d={};_0x5b568d[_0x3873a9]={'$like':'%'+_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x5b568d;})});}_0x1a350e=_['merge']({},_0x1a350e,_0x5dd66a['options']);return db[_0x31d0('0xa7')][_0x31d0('0x35')]({'where':_0x1a350e[_0x31d0('0x54')]})['then'](function(_0x300f5c){_0x14cd36[_0x31d0('0x35')]=_0x300f5c;if(_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x58')]){_0x1a350e[_0x31d0('0x59')]=[{'model':db[_0x31d0('0x7d')],'as':_0x31d0('0xc4'),'required':![]},{'model':db['User'],'as':_0x31d0('0xc5'),'attributes':[_0x31d0('0x3e'),_0x31d0('0xc6'),_0x31d0('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x31d0('0xc8'),'attributes':['id',_0x31d0('0x3e'),_0x31d0('0xc9')],'where':_0x5dd66a[_0x31d0('0x47')]['tag']?{'id':_0x5dd66a['query'][_0x31d0('0xca')]}:undefined,'required':_0x5dd66a[_0x31d0('0x47')][_0x31d0('0xca')]?!![]:![]}];}return db[_0x31d0('0xa7')][_0x31d0('0x73')](_0x1a350e);})[_0x31d0('0x24')](function(_0x4ab0a1){_0x14cd36[_0x31d0('0x5a')]=_0x4ab0a1;return _0x14cd36;});}})[_0x31d0('0x24')](respondWithFilteredResult(_0x4d9f54,_0x1a350e))[_0x31d0('0x2d')](handleError(_0x4d9f54,null));};exports[_0x31d0('0xb9')]=function(_0x17bcdf,_0x33830a,_0x13de35){var _0x13142b,_0xd8c3b6,_0x888d81;if(_[_0x31d0('0x9b')](_0x17bcdf['body'][_0x31d0('0x60')])||_0x17bcdf[_0x31d0('0x60')]['body']===''){throw new db[(_0x31d0('0x7e'))][(_0x31d0('0x7f'))](_0x31d0('0x9c'));}if(_[_0x31d0('0x9b')](_0x17bcdf[_0x31d0('0x60')]['to'])){throw new db[(_0x31d0('0x7e'))][(_0x31d0('0x7f'))](_0x31d0('0xcb'));}_0x13142b=_0x17bcdf[_0x31d0('0x60')]['to'];return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x17bcdf[_0x31d0('0x5c')]['id']},'include':[{'model':db[_0x31d0('0xa0')],'as':'List','include':[{'model':db[_0x31d0('0x7d')],'as':_0x31d0('0xa1'),'where':{'mobile':_0x13142b},'limit':0x1,'order':[[_0x31d0('0x81'),_0x31d0('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x33830a,null))[_0x31d0('0x24')](function(_0x3c8818){if(_0x3c8818&&_0x3c8818[_0x31d0('0xcc')]){_0xd8c3b6=_0x3c8818[_0x31d0('0x3b')]({'plain':!![]});if(_0xd8c3b6[_0x31d0('0xcc')]&&_0xd8c3b6['List'][_0x31d0('0xa1')]['length']){return _0xd8c3b6[_0x31d0('0xcc')][_0x31d0('0xa1')][0x0];}return db[_0x31d0('0x7d')][_0x31d0('0x5f')](_[_0x31d0('0xa5')](_0x17bcdf['body'],{'firstName':_0x13142b,'mobile':_0x13142b,'phone':_0x13142b,'ListId':_0xd8c3b6[_0x31d0('0x84')]}));}})[_0x31d0('0x24')](handleEntityNotFound(_0x33830a,null))[_0x31d0('0x24')](function(_0x2394aa){if(_0x2394aa){_0x888d81=_0x2394aa;return db[_0x31d0('0xa7')]['find']({'where':{'ContactId':_0x888d81['id'],'closed':![],'SmsAccountId':_0xd8c3b6['id']}})['then'](function(_0x114e82){if(_0x114e82){return[_0x114e82,![]];}return db[_0x31d0('0xa7')][_0x31d0('0x5f')]({'UserId':_0x17bcdf[_0x31d0('0x61')]['id'],'ContactId':_0x888d81['id'],'SmsAccountId':_0xd8c3b6['id'],'phone':_0x13142b,'firstMsgDirection':_0x31d0('0xcd'),'Messages':[_[_0x31d0('0x53')](_0x17bcdf[_0x31d0('0x60')],{'read':![],'body':_0x17bcdf['body'][_0x31d0('0x60')],'phone':_0x13142b,'SmsAccountId':_0xd8c3b6['id'],'UserId':_0x17bcdf[_0x31d0('0x61')]['id'],'ContactId':_0x888d81['id']})]},{'include':[{'model':db[_0x31d0('0xae')],'as':'Messages'}]})[_0x31d0('0x24')](function(_0x76343d){return[_0x76343d,!![]];});});}})[_0x31d0('0xa8')](function(_0x2a6988,_0x53b79d){if(_0x53b79d){return _0x2a6988;}return db[_0x31d0('0xae')]['create'](_[_0x31d0('0x53')](_0x17bcdf[_0x31d0('0x60')],{'read':![],'body':_0x17bcdf['body'][_0x31d0('0x60')],'phone':_0x13142b,'SmsAccountId':_0xd8c3b6['id'],'SmsInteractionId':_0x2a6988['id'],'UserId':_0x17bcdf[_0x31d0('0x61')]['id'],'ContactId':_0x888d81['id']}))[_0x31d0('0x24')](function(_0x30c15a){_0x2a6988['dataValues']['Messages']=[];_0x2a6988[_0x31d0('0xce')][_0x31d0('0xcf')][_0x31d0('0xd0')](_0x30c15a[_0x31d0('0xce')]);return _0x2a6988;});})[_0x31d0('0x24')](respondWithResult(_0x33830a,null))[_0x31d0('0x2d')](handleError(_0x33830a,null));};exports['status']=function(_0x26b34d,_0x164b22,_0x2e3943){if(_0x26b34d[_0x31d0('0x60')]['id']){delete _0x26b34d['body']['id'];}var _0x5c62c6,_0x3ec816,_0x76b5db;return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x26b34d[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x164b22,null))[_0x31d0('0x24')](function(_0x21ef7c){if(_0x21ef7c){_0x76b5db=_0x21ef7c;logger[_0x31d0('0x28')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xd2'),_0x21ef7c[_0x31d0('0x55')],util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));switch(_0x21ef7c[_0x31d0('0x55')]){case _0x31d0('0xd4'):if(_0x26b34d[_0x31d0('0x60')]['skebby_dispatch_id']&&_0x26b34d['body'][_0x31d0('0x30')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')]['status'];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x26b34d[_0x31d0('0x60')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd5')]&&_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd6')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')]['statusInt'];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x26b34d[_0x31d0('0x60')]['requestid']}});}break;case'clicksend':if(_0x26b34d['body'][_0x31d0('0x8d')]&&_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd7')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd7')];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][_0x31d0('0x8d')]}});}break;case _0x31d0('0x92'):var _0x47a8b3=_0x26b34d[_0x31d0('0x60')][_0x31d0('0x93')][0x0];if(_0x47a8b3[_0x31d0('0x88')]&&_0x47a8b3[_0x31d0('0x30')]['groupName']===_0x31d0('0xd8')){_0x3ec816=_0x47a8b3[_0x31d0('0x30')]['groupName'];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x47a8b3[_0x31d0('0x88')]}});}break;case _0x31d0('0xd9'):if(_0x26b34d[_0x31d0('0x60')][_0x31d0('0x88')]&&_0x26b34d['body']['status']){_0x3ec816=_0x26b34d[_0x31d0('0x60')]['status'];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][_0x31d0('0x88')]}});}break;case _0x31d0('0xda'):if(_0x26b34d[_0x31d0('0x60')][0x0][_0x31d0('0x2b')]['id']){_0x3ec816=_0x26b34d[_0x31d0('0x60')][0x0][_0x31d0('0x55')];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][0x0][_0x31d0('0x2b')]['id']}});}break;case _0x31d0('0x99'):if(_0x26b34d['body'][_0x31d0('0xdb')]&&_0x26b34d['body'][_0x31d0('0x30')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')][_0x31d0('0x30')];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][_0x31d0('0xdb')]}});}break;}}})[_0x31d0('0x24')](handleEntityNotFound(_0x164b22,null))['then'](function(_0x16e185){if(_0x16e185){_0x5c62c6=_0x16e185;switch(_0x76b5db[_0x31d0('0x55')]){case _0x31d0('0xd4'):if(_0x3ec816===_0x31d0('0xd8')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')](_0x31d0('0xd1'),_0x31d0('0x30'),'skebby',util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x31d0('0xdd'):if(_0x3ec816==='1'){return _0x5c62c6['update']({'read':!![]});}else{logger['error'](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xd4'),util[_0x31d0('0xd3')](_0x26b34d['body'],{'showHidden':![],'depth':null}));}break;case _0x31d0('0x8c'):if(!_0x26b34d[_0x31d0('0x60')][_0x31d0('0xde')]&&_0x3ec816>=0xc8&&_0x3ec816<=0xce){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31d0('0x30'),_0x31d0('0x8c'),util[_0x31d0('0xd3')](_0x26b34d['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3743a3=_0x26b34d[_0x31d0('0x60')][_0x31d0('0x93')][0x0];if(_0x3743a3[_0x31d0('0x30')]['groupName']==='DELIVERED'){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger['error'](_0x31d0('0xd1'),_0x31d0('0x30'),'infobip',util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3ec816=='DELIVERED_TO_GATEWAY'||_0x3ec816==_0x31d0('0xdf')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31d0('0x30'),_0x31d0('0xd9'),util['inspect'](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3ec816==_0x31d0('0xe0')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xda'),util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x31d0('0x99'):if(_0x3ec816===_0x31d0('0xe1')||_0x3ec816===_0x31d0('0xe2')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31d0('0x30'),_0x31d0('0x99'),util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x5c62c6;}})['then'](respondWithResult(_0x164b22,null))['catch'](handleError(_0x164b22,null));};exports['statusGet']=function(_0x5ccef2,_0x1a940b,_0x4cbc05){var _0x25da23,_0x12853c,_0x41fa8a;return db[_0x31d0('0x43')]['find']({'where':{'id':_0x5ccef2['params']['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x1a940b,null))[_0x31d0('0x24')](function(_0x14c2db){if(_0x14c2db){_0x41fa8a=_0x14c2db;logger[_0x31d0('0x28')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xd2'),_0x14c2db['type'],util[_0x31d0('0xd3')](_0x5ccef2[_0x31d0('0x47')],{'showHidden':![],'depth':null}));switch(_0x14c2db[_0x31d0('0x55')]){case _0x31d0('0xe3'):if(_0x5ccef2[_0x31d0('0x47')][_0x31d0('0xe4')]&&_0x5ccef2['query']['state']){_0x12853c=_0x5ccef2['query'][_0x31d0('0xe5')];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x5ccef2[_0x31d0('0x47')][_0x31d0('0xe4')]}});}break;}}})[_0x31d0('0x24')](handleEntityNotFound(_0x1a940b,null))[_0x31d0('0x24')](function(_0x29ac94){if(_0x29ac94){_0x25da23=_0x29ac94;switch(_0x41fa8a['type']){case _0x31d0('0xe3'):if(_0x12853c==='2'||_0x12853c==='6'){return _0x25da23['update']({'read':!![]});}else{logger[_0x31d0('0x29')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xe3'),util[_0x31d0('0xd3')](_0x5ccef2[_0x31d0('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x25da23;}})[_0x31d0('0x24')](respondWithResult(_0x1a940b,null))[_0x31d0('0x2d')](handleError(_0x1a940b,null));};exports[_0x31d0('0xe6')]=function(_0x54c7f8,_0x669db0,_0x3064ca){return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x54c7f8[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x669db0,null))[_0x31d0('0x24')](function(_0x3adf70){if(_0x3adf70){return _0x3adf70[_0x31d0('0xe6')](_0x54c7f8[_0x31d0('0x60')][_0x31d0('0x6f')],_['omit'](_0x54c7f8['body'],['ids','id'])||{})['spread'](function(_0x2699ff){for(var _0x371a05=0x0;_0x371a05<_0x54c7f8[_0x31d0('0x60')]['ids'][_0x31d0('0x4c')];_0x371a05+=0x1){socket['emit'](_0x31d0('0xe7'),{'UserId':Number(_0x54c7f8[_0x31d0('0x60')][_0x31d0('0x6f')][_0x371a05]),'SmsAccountId':Number(_0x54c7f8['params']['id'])});}return _0x2699ff;});}})['then'](respondWithResult(_0x669db0,null))['catch'](handleError(_0x669db0,null));};exports[_0x31d0('0xe8')]=function(_0x4a156e,_0x568379,_0x48c6a7){return db['SmsAccount'][_0x31d0('0x5e')]({'where':{'id':_0x4a156e[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x568379,null))[_0x31d0('0x24')](function(_0xbe3358){if(_0xbe3358){return _0xbe3358[_0x31d0('0xe8')](_0x4a156e[_0x31d0('0x47')]['ids'])['then'](function(){if(_[_0x31d0('0xe9')](_0x4a156e[_0x31d0('0x47')]['ids'])){for(var _0x1a60a3=0x0;_0x1a60a3<_0x4a156e['query'][_0x31d0('0x6f')][_0x31d0('0x4c')];_0x1a60a3+=0x1){socket[_0x31d0('0xea')](_0x31d0('0xeb'),{'UserId':Number(_0x4a156e[_0x31d0('0x47')][_0x31d0('0x6f')][_0x1a60a3]),'SmsAccountId':Number(_0x4a156e[_0x31d0('0x5c')]['id'])});}}else{socket[_0x31d0('0xea')](_0x31d0('0xeb'),{'UserId':Number(_0x4a156e['query'][_0x31d0('0x6f')]),'SmsAccountId':Number(_0x4a156e[_0x31d0('0x5c')]['id'])});}});}})[_0x31d0('0x24')](respondWithStatusCode(_0x568379,null))[_0x31d0('0x2d')](handleError(_0x568379,null));};exports[_0x31d0('0xec')]=function(_0x52374d,_0x81244d,_0x2f73cd){var _0x5ee0bf={};var _0x1c38cf={};var _0x55085a;var _0x4e9050;return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x52374d['params']['id']}})['then'](handleEntityNotFound(_0x81244d,null))['then'](function(_0x461926){if(_0x461926){_0x55085a=_0x461926;_0x1c38cf[_0x31d0('0x46')]=_['keys'](db['User'][_0x31d0('0x44')]);_0x1c38cf[_0x31d0('0x47')]=_[_0x31d0('0x5d')](_0x52374d[_0x31d0('0x47')]);_0x1c38cf[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x1c38cf[_0x31d0('0x46')],_0x1c38cf['query']);_0x5ee0bf[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x1c38cf[_0x31d0('0x46')],qs['fields'](_0x52374d[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x5ee0bf[_0x31d0('0x4a')]=_0x5ee0bf['attributes'][_0x31d0('0x4c')]?_0x5ee0bf[_0x31d0('0x4a')]:_0x1c38cf[_0x31d0('0x46')];_0x5ee0bf[_0x31d0('0x4f')]=qs[_0x31d0('0x50')](_0x52374d[_0x31d0('0x47')]['sort']);_0x5ee0bf[_0x31d0('0x54')]=qs[_0x31d0('0x48')](_['pick'](_0x52374d['query'],_0x1c38cf[_0x31d0('0x48')]));if(_0x52374d['query']['filter']){_0x5ee0bf[_0x31d0('0x54')]=_['merge'](_0x5ee0bf[_0x31d0('0x54')],{'$or':_[_0x31d0('0x42')](_0x5ee0bf['attributes'],function(_0x4c527f){var _0x1f4f77={};_0x1f4f77[_0x4c527f]={'$like':'%'+_0x52374d[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x1f4f77;})});}_0x5ee0bf=_[_0x31d0('0x53')]({},_0x5ee0bf,_0x52374d[_0x31d0('0x57')]);return _0x55085a[_0x31d0('0xec')](_0x5ee0bf);}})['then'](function(_0x25bf2e){if(_0x25bf2e){_0x4e9050=_0x25bf2e['length'];if(!_0x52374d[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0x5ee0bf['limit']=qs[_0x31d0('0x34')](_0x52374d['query'][_0x31d0('0x34')]);_0x5ee0bf[_0x31d0('0x32')]=qs['offset'](_0x52374d[_0x31d0('0x47')][_0x31d0('0x32')]);}return _0x55085a[_0x31d0('0xec')](_0x5ee0bf);}})[_0x31d0('0x24')](function(_0x1dcba5){if(_0x1dcba5){return _0x1dcba5?{'count':_0x4e9050,'rows':_0x1dcba5}:null;}})[_0x31d0('0x24')](respondWithResult(_0x81244d,null))[_0x31d0('0x2d')](handleError(_0x81244d,null));}; \ No newline at end of file +var _0xaa9d=['notify','SmsApplication','Applications','applications','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','infobip','results','csc','originatingAddress','fromNumber','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','SmsInteraction','spread','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','SmsQueue','queueId','unshift','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','DESC','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','bandwidth','redif','inspect','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','state','message-id','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','SmsAccounts','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xaa9d,0x153));var _0xdaa9=function(_0x35a870,_0x13a0ae){_0x35a870=_0x35a870-0x0;var _0x37ec78=_0xaa9d[_0x35a870];return _0x37ec78;};'use strict';var emlformat=require(_0xdaa9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdaa9('0x1'));var moment=require(_0xdaa9('0x2'));var BPromise=require(_0xdaa9('0x3'));var Mustache=require(_0xdaa9('0x4'));var util=require('util');var path=require('path');var sox=require(_0xdaa9('0x5'));var csv=require(_0xdaa9('0x6'));var ejs=require(_0xdaa9('0x7'));var fs=require('fs');var fs_extra=require(_0xdaa9('0x8'));var _=require('lodash');var squel=require(_0xdaa9('0x9'));var crypto=require(_0xdaa9('0xa'));var jsforce=require(_0xdaa9('0xb'));var deskjs=require(_0xdaa9('0xc'));var toCsv=require(_0xdaa9('0x6'));var querystring=require(_0xdaa9('0xd'));var Papa=require(_0xdaa9('0xe'));var Redis=require('ioredis');var authService=require(_0xdaa9('0xf'));var qs=require(_0xdaa9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaa9('0x11'))(_0xdaa9('0x12'));var utils=require(_0xdaa9('0x13'));var config=require(_0xdaa9('0x14'));var licenseUtil=require(_0xdaa9('0x15'));var db=require(_0xdaa9('0x16'))['db'];config['redis']=_[_0xdaa9('0x17')](config['redis'],{'host':_0xdaa9('0x18'),'port':0x18eb});var socket=require(_0xdaa9('0x19'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xdaa9('0x1a')](socket);var jayson=require(_0xdaa9('0x1b'));var client=jayson[_0xdaa9('0x1c')][_0xdaa9('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5a4499,_0x143747,_0x4cc63f,_0x396bc8){return new BPromise(function(_0x18c96c,_0xff1ba1){var _0xba29b3=_0x396bc8||client;return _0xba29b3[_0xdaa9('0x1e')](_0x5a4499,_0x4cc63f)[_0xdaa9('0x1f')](function(_0x5b8cb){logger[_0xdaa9('0x20')](_0xdaa9('0x21'),_0x143747,'request\x20sent');logger[_0xdaa9('0x22')](_0xdaa9('0x23'),_0x143747,'request\x20sent',JSON[_0xdaa9('0x24')](_0x5b8cb));if(_0x5b8cb[_0xdaa9('0x25')]){if(_0x5b8cb['error'][_0xdaa9('0x26')]===0x1f4){logger[_0xdaa9('0x25')](_0xdaa9('0x21'),_0x143747,_0x5b8cb[_0xdaa9('0x25')][_0xdaa9('0x27')]);return _0xff1ba1(_0x5b8cb[_0xdaa9('0x25')]['message']);}logger[_0xdaa9('0x25')](_0xdaa9('0x21'),_0x143747,_0x5b8cb[_0xdaa9('0x25')][_0xdaa9('0x27')]);return _0x18c96c(_0x5b8cb[_0xdaa9('0x25')][_0xdaa9('0x27')]);}else{logger[_0xdaa9('0x20')](_0xdaa9('0x21'),_0x143747,_0xdaa9('0x28'));_0x18c96c(_0x5b8cb[_0xdaa9('0x29')][_0xdaa9('0x27')]);}})[_0xdaa9('0x2a')](function(_0x2618a0){logger['error']('SmsAccount,\x20%s,\x20%s',_0x143747,_0x2618a0);_0xff1ba1(_0x2618a0);});});}function respondWithStatusCode(_0x3ce0d4,_0x59f933){_0x59f933=_0x59f933||0xcc;return function(_0x3e00b4){if(_0x3e00b4){return _0x3ce0d4[_0xdaa9('0x2b')](_0x59f933);}return _0x3ce0d4[_0xdaa9('0x2c')](_0x59f933)['end']();};}function respondWithResult(_0x5b8820,_0x3437bb){_0x3437bb=_0x3437bb||0xc8;return function(_0x1a09ac){if(_0x1a09ac){return _0x5b8820['status'](_0x3437bb)[_0xdaa9('0x2d')](_0x1a09ac);}};}function respondWithFilteredResult(_0x3fb71d,_0x463b0f){return function(_0x52d4df){if(_0x52d4df){var _0x516c27=typeof _0x463b0f[_0xdaa9('0x2e')]===_0xdaa9('0x2f')&&typeof _0x463b0f[_0xdaa9('0x30')]===_0xdaa9('0x2f');var _0x1ab49d=_0x52d4df[_0xdaa9('0x31')];var _0x2473f7=_0x516c27?0x0:_0x463b0f['offset'];var _0x2840d7=_0x516c27?_0x52d4df[_0xdaa9('0x31')]:_0x463b0f[_0xdaa9('0x2e')]+_0x463b0f[_0xdaa9('0x30')];var _0x407e0b;if(_0x2840d7>=_0x1ab49d){_0x2840d7=_0x1ab49d;_0x407e0b=0xc8;}else{_0x407e0b=0xce;}_0x3fb71d['status'](_0x407e0b);return _0x3fb71d[_0xdaa9('0x32')](_0xdaa9('0x33'),_0x2473f7+'-'+_0x2840d7+'/'+_0x1ab49d)[_0xdaa9('0x2d')](_0x52d4df);}return null;};}function patchUpdates(_0x3e146a){return function(_0x159826){try{jsonpatch[_0xdaa9('0x34')](_0x159826,_0x3e146a,!![]);}catch(_0x58d470){return BPromise['reject'](_0x58d470);}return _0x159826[_0xdaa9('0x35')]();};}function saveUpdates(_0x1603fd,_0x38803c){return function(_0x55ddca){if(_0x55ddca){return _0x55ddca[_0xdaa9('0x36')](_0x1603fd)[_0xdaa9('0x1f')](function(_0x976055){return _0x976055;});}return null;};}function removeEntity(_0x2c13e7,_0x44d3e0){return function(_0x33a51d){if(_0x33a51d){return _0x33a51d[_0xdaa9('0x37')]()[_0xdaa9('0x1f')](function(){var _0x56388d=_0x33a51d['get']({'plain':!![]});var _0xc2679b=_0xdaa9('0x38');return db[_0xdaa9('0x39')]['destroy']({'where':{'type':_0xc2679b,'resourceId':_0x56388d['id']}})[_0xdaa9('0x1f')](function(){return _0x33a51d;});})[_0xdaa9('0x1f')](function(){_0x2c13e7[_0xdaa9('0x2c')](0xcc)[_0xdaa9('0x3a')]();});}};}function handleEntityNotFound(_0x6cd27e,_0x15654d){return function(_0x252e89){if(!_0x252e89){_0x6cd27e[_0xdaa9('0x2b')](0x194);}return _0x252e89;};}function handleError(_0x39b309,_0x38be72){_0x38be72=_0x38be72||0x1f4;return function(_0x107668){logger['error'](_0x107668[_0xdaa9('0x3b')]);if(_0x107668[_0xdaa9('0x3c')]){delete _0x107668[_0xdaa9('0x3c')];}_0x39b309[_0xdaa9('0x2c')](_0x38be72)[_0xdaa9('0x3d')](_0x107668);};}exports['index']=function(_0x5808e8,_0x9ea2c8){var _0x653ac3={'include':[{'model':db[_0xdaa9('0x3e')],'as':_0xdaa9('0x3f')}]},_0x2ed1d0={},_0x1f040c={'count':0x0,'rows':[]};var _0x4487d1=_['map'](db[_0xdaa9('0x40')][_0xdaa9('0x41')],function(_0x123738){return{'name':_0x123738['fieldName'],'type':_0x123738[_0xdaa9('0x42')][_0xdaa9('0x43')]};});_0x2ed1d0['model']=_[_0xdaa9('0x44')](_0x4487d1,'name');_0x2ed1d0['query']=_[_0xdaa9('0x45')](_0x5808e8[_0xdaa9('0x46')]);_0x2ed1d0['filters']=_[_0xdaa9('0x47')](_0x2ed1d0[_0xdaa9('0x48')],_0x2ed1d0[_0xdaa9('0x46')]);_0x653ac3[_0xdaa9('0x49')]=_['intersection'](_0x2ed1d0[_0xdaa9('0x48')],qs['fields'](_0x5808e8[_0xdaa9('0x46')][_0xdaa9('0x4a')]));_0x653ac3[_0xdaa9('0x49')]=_0x653ac3[_0xdaa9('0x49')][_0xdaa9('0x4b')]?_0x653ac3[_0xdaa9('0x49')]:_0x2ed1d0['model'];if(!_0x5808e8['query'][_0xdaa9('0x4c')](_0xdaa9('0x4d'))){_0x653ac3[_0xdaa9('0x30')]=qs[_0xdaa9('0x30')](_0x5808e8[_0xdaa9('0x46')][_0xdaa9('0x30')]);_0x653ac3[_0xdaa9('0x2e')]=qs[_0xdaa9('0x2e')](_0x5808e8[_0xdaa9('0x46')][_0xdaa9('0x2e')]);}_0x653ac3[_0xdaa9('0x4e')]=qs[_0xdaa9('0x4f')](_0x5808e8[_0xdaa9('0x46')]['sort']);_0x653ac3[_0xdaa9('0x50')]=qs[_0xdaa9('0x51')](_['pick'](_0x5808e8[_0xdaa9('0x46')],_0x2ed1d0[_0xdaa9('0x51')]),_0x4487d1);if(_0x5808e8[_0xdaa9('0x46')][_0xdaa9('0x52')]){_0x653ac3[_0xdaa9('0x50')]=_[_0xdaa9('0x53')](_0x653ac3[_0xdaa9('0x50')],{'$or':_[_0xdaa9('0x44')](_0x4487d1,function(_0x3e4e3f){if(_0x3e4e3f[_0xdaa9('0x42')]!=='VIRTUAL'){var _0x61eae6={};_0x61eae6[_0x3e4e3f['name']]={'$like':'%'+_0x5808e8[_0xdaa9('0x46')]['filter']+'%'};return _0x61eae6;}})});}_0x653ac3=_['merge']({},_0x653ac3,_0x5808e8[_0xdaa9('0x54')]);var _0x106656={'where':_0x653ac3[_0xdaa9('0x50')]};return db[_0xdaa9('0x40')]['count'](_0x106656)['then'](function(_0x391aa5){_0x1f040c[_0xdaa9('0x31')]=_0x391aa5;if(_0x5808e8[_0xdaa9('0x46')][_0xdaa9('0x55')]){_0x653ac3[_0xdaa9('0x56')]=[{'all':!![]}];}return db[_0xdaa9('0x40')][_0xdaa9('0x57')](_0x653ac3);})[_0xdaa9('0x1f')](function(_0x2c8761){_0x1f040c['rows']=_0x2c8761;return _0x1f040c;})[_0xdaa9('0x1f')](respondWithFilteredResult(_0x9ea2c8,_0x653ac3))[_0xdaa9('0x2a')](handleError(_0x9ea2c8,null));};exports['show']=function(_0x2394e3,_0x2c398b){var _0x1d729e={'raw':![],'where':{'id':_0x2394e3[_0xdaa9('0x58')]['id']},'include':[{'model':db[_0xdaa9('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1ec529={};_0x1ec529[_0xdaa9('0x48')]=_[_0xdaa9('0x45')](db['SmsAccount'][_0xdaa9('0x41')]);_0x1ec529[_0xdaa9('0x46')]=_['keys'](_0x2394e3[_0xdaa9('0x46')]);_0x1ec529[_0xdaa9('0x51')]=_['intersection'](_0x1ec529[_0xdaa9('0x48')],_0x1ec529['query']);_0x1d729e[_0xdaa9('0x49')]=_[_0xdaa9('0x47')](_0x1ec529[_0xdaa9('0x48')],qs[_0xdaa9('0x4a')](_0x2394e3[_0xdaa9('0x46')][_0xdaa9('0x4a')]));_0x1d729e['attributes']=_0x1d729e[_0xdaa9('0x49')]['length']?_0x1d729e[_0xdaa9('0x49')]:_0x1ec529['model'];if(_0x2394e3[_0xdaa9('0x46')]['includeAll']){_0x1d729e[_0xdaa9('0x56')]=[{'all':!![]}];}_0x1d729e=_[_0xdaa9('0x53')]({},_0x1d729e,_0x2394e3[_0xdaa9('0x54')]);return db['SmsAccount'][_0xdaa9('0x59')](_0x1d729e)[_0xdaa9('0x1f')](handleEntityNotFound(_0x2c398b,null))[_0xdaa9('0x1f')](respondWithResult(_0x2c398b,null))['catch'](handleError(_0x2c398b,null));};exports[_0xdaa9('0x5a')]=function(_0x3c4c9e,_0x35162d){return db[_0xdaa9('0x40')][_0xdaa9('0x5a')](_0x3c4c9e[_0xdaa9('0x5b')],{})['then'](function(_0x8c2549){var _0x46f117=_0x3c4c9e[_0xdaa9('0x5c')][_0xdaa9('0x5d')]({'plain':!![]});if(!_0x46f117)throw new Error(_0xdaa9('0x5e'));if(_0x46f117[_0xdaa9('0x5f')]==='user'){var _0x5aeefd=_0x8c2549[_0xdaa9('0x5d')]({'plain':!![]});var _0x249c94='SmsAccounts';return db[_0xdaa9('0x60')][_0xdaa9('0x59')]({'where':{'name':_0x249c94,'userProfileId':_0x46f117['userProfileId']},'raw':!![]})[_0xdaa9('0x1f')](function(_0x3ba0a){if(_0x3ba0a&&_0x3ba0a['autoAssociation']===0x0){return db['UserProfileResource'][_0xdaa9('0x5a')]({'name':_0x5aeefd['name'],'resourceId':_0x5aeefd['id'],'type':_0x3ba0a[_0xdaa9('0x3c')],'sectionId':_0x3ba0a['id']},{})['then'](function(){return _0x8c2549;});}else{return _0x8c2549;}})['catch'](function(_0x1e643e){logger[_0xdaa9('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e643e);throw _0x1e643e;});}return _0x8c2549;})['then'](respondWithResult(_0x35162d,0xc9))[_0xdaa9('0x2a')](handleError(_0x35162d,null));};exports[_0xdaa9('0x36')]=function(_0x4b9c60,_0xa24907){if(_0x4b9c60['body']['id']){delete _0x4b9c60[_0xdaa9('0x5b')]['id'];}return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x4b9c60[_0xdaa9('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xdaa9('0x1f')](handleEntityNotFound(_0xa24907,null))[_0xdaa9('0x1f')](saveUpdates(_0x4b9c60[_0xdaa9('0x5b')],null))[_0xdaa9('0x1f')](respondWithResult(_0xa24907,null))['catch'](handleError(_0xa24907,null));};exports[_0xdaa9('0x37')]=function(_0x182eed,_0x30734c){return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x182eed[_0xdaa9('0x58')]['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x30734c,null))['then'](removeEntity(_0x30734c,null))[_0xdaa9('0x2a')](handleError(_0x30734c,null));};exports[_0xdaa9('0x61')]=function(_0x5d111e,_0x2aaf98){return db[_0xdaa9('0x40')][_0xdaa9('0x61')]()[_0xdaa9('0x1f')](respondWithResult(_0x2aaf98,null))[_0xdaa9('0x2a')](handleError(_0x2aaf98,null));};exports[_0xdaa9('0x62')]=function(_0x54fe5c,_0x43e2bd,_0x2268a5){if(_0x54fe5c[_0xdaa9('0x5b')]['id']){delete _0x54fe5c['body']['id'];}return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x54fe5c[_0xdaa9('0x58')]['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x43e2bd,null))['then'](function(_0x2045a0){if(_0x2045a0){_0x54fe5c[_0xdaa9('0x5b')][_0xdaa9('0x63')]=_0x2045a0['id'];return db[_0xdaa9('0x64')]['create'](_0x54fe5c[_0xdaa9('0x5b')]);}})[_0xdaa9('0x1f')](respondWithResult(_0x43e2bd,null))[_0xdaa9('0x2a')](handleError(_0x43e2bd,null));};exports[_0xdaa9('0x65')]=function(_0x448b11,_0x3f2192,_0x12e057){var _0x16a7d4={'raw':![],'where':{}};var _0x2ed74c={};var _0x534b84={'count':0x0,'rows':[]};return db['SmsAccount'][_0xdaa9('0x66')]({'where':{'id':_0x448b11[_0xdaa9('0x58')]['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x3f2192,null))[_0xdaa9('0x1f')](function(_0x524b8e){if(_0x524b8e){_0x2ed74c[_0xdaa9('0x48')]=_[_0xdaa9('0x45')](db[_0xdaa9('0x64')][_0xdaa9('0x41')]);_0x2ed74c[_0xdaa9('0x46')]=_[_0xdaa9('0x45')](_0x448b11[_0xdaa9('0x46')]);_0x2ed74c[_0xdaa9('0x51')]=_[_0xdaa9('0x47')](_0x2ed74c[_0xdaa9('0x48')],_0x2ed74c['query']);_0x16a7d4['attributes']=_[_0xdaa9('0x47')](_0x2ed74c[_0xdaa9('0x48')],qs[_0xdaa9('0x4a')](_0x448b11['query'][_0xdaa9('0x4a')]));_0x16a7d4[_0xdaa9('0x49')]=_0x16a7d4['attributes']['length']?_0x16a7d4[_0xdaa9('0x49')]:_0x2ed74c[_0xdaa9('0x48')];if(!_0x448b11['query'][_0xdaa9('0x4c')](_0xdaa9('0x4d'))){_0x16a7d4[_0xdaa9('0x30')]=qs[_0xdaa9('0x30')](_0x448b11[_0xdaa9('0x46')]['limit']);_0x16a7d4[_0xdaa9('0x2e')]=qs[_0xdaa9('0x2e')](_0x448b11[_0xdaa9('0x46')]['offset']);}_0x16a7d4[_0xdaa9('0x4e')]=qs[_0xdaa9('0x4f')](_0x448b11[_0xdaa9('0x46')]['sort']);_0x16a7d4[_0xdaa9('0x50')]=qs['filters'](_[_0xdaa9('0x67')](_0x448b11[_0xdaa9('0x46')],_0x2ed74c['filters']));_0x16a7d4[_0xdaa9('0x50')][_0xdaa9('0x63')]=_0x524b8e['id'];if(_0x448b11[_0xdaa9('0x46')]['filter']){_0x16a7d4[_0xdaa9('0x50')]=_['merge'](_0x16a7d4[_0xdaa9('0x50')],{'$or':_[_0xdaa9('0x44')](_0x16a7d4['attributes'],function(_0x454481){var _0x3ca1e0={};_0x3ca1e0[_0x454481]={'$like':'%'+_0x448b11['query']['filter']+'%'};return _0x3ca1e0;})});}_0x16a7d4=_[_0xdaa9('0x53')]({},_0x16a7d4,_0x448b11['options']);return db[_0xdaa9('0x64')][_0xdaa9('0x31')]({'where':_0x16a7d4['where']})[_0xdaa9('0x1f')](function(_0x55a578){_0x534b84[_0xdaa9('0x31')]=_0x55a578;if(_0x448b11[_0xdaa9('0x46')][_0xdaa9('0x55')]){_0x16a7d4['include']=[{'all':!![]}];}return db[_0xdaa9('0x64')]['findAll'](_0x16a7d4);})[_0xdaa9('0x1f')](function(_0x4afcdf){_0x534b84[_0xdaa9('0x68')]=_0x4afcdf;return _0x534b84;});}})['then'](respondWithFilteredResult(_0x3f2192,_0x16a7d4))[_0xdaa9('0x2a')](handleError(_0x3f2192,null));};exports['removeDispositions']=function(_0x4c282e,_0x284c20,_0x3b15a1){return db['SmsAccount']['find']({'where':{'id':_0x4c282e['params']['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x284c20,null))[_0xdaa9('0x1f')](function(_0x4206dc){if(_0x4206dc){return _0x4206dc[_0xdaa9('0x69')](_0x4c282e[_0xdaa9('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x284c20,null))[_0xdaa9('0x2a')](handleError(_0x284c20,null));};exports[_0xdaa9('0x6a')]=function(_0xd6c91e,_0x1e267b,_0x42681c){if(_0xd6c91e['body']['id']){delete _0xd6c91e[_0xdaa9('0x5b')]['id'];}return db['SmsAccount'][_0xdaa9('0x59')]({'where':{'id':_0xd6c91e['params']['id']}})['then'](handleEntityNotFound(_0x1e267b,null))[_0xdaa9('0x1f')](function(_0x4e78e2){if(_0x4e78e2){_0xd6c91e[_0xdaa9('0x5b')][_0xdaa9('0x63')]=_0x4e78e2['id'];return db[_0xdaa9('0x6b')][_0xdaa9('0x5a')](_0xd6c91e[_0xdaa9('0x5b')]);}})[_0xdaa9('0x1f')](respondWithResult(_0x1e267b,null))['catch'](handleError(_0x1e267b,null));};exports[_0xdaa9('0x6c')]=function(_0x4de0cc,_0x58d482,_0x4afe14){var _0x4f1686={'raw':![],'where':{}};var _0x44eb29={};var _0x1f3254={'count':0x0,'rows':[]};return db[_0xdaa9('0x40')][_0xdaa9('0x66')]({'where':{'id':_0x4de0cc[_0xdaa9('0x58')]['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x58d482,null))[_0xdaa9('0x1f')](function(_0x1e18b4){if(_0x1e18b4){_0x44eb29[_0xdaa9('0x48')]=_[_0xdaa9('0x45')](db['CannedAnswer'][_0xdaa9('0x41')]);_0x44eb29[_0xdaa9('0x46')]=_[_0xdaa9('0x45')](_0x4de0cc['query']);_0x44eb29['filters']=_[_0xdaa9('0x47')](_0x44eb29[_0xdaa9('0x48')],_0x44eb29['query']);_0x4f1686['attributes']=_[_0xdaa9('0x47')](_0x44eb29[_0xdaa9('0x48')],qs[_0xdaa9('0x4a')](_0x4de0cc[_0xdaa9('0x46')][_0xdaa9('0x4a')]));_0x4f1686['attributes']=_0x4f1686[_0xdaa9('0x49')][_0xdaa9('0x4b')]?_0x4f1686[_0xdaa9('0x49')]:_0x44eb29[_0xdaa9('0x48')];if(!_0x4de0cc['query'][_0xdaa9('0x4c')](_0xdaa9('0x4d'))){_0x4f1686['limit']=qs[_0xdaa9('0x30')](_0x4de0cc[_0xdaa9('0x46')][_0xdaa9('0x30')]);_0x4f1686[_0xdaa9('0x2e')]=qs[_0xdaa9('0x2e')](_0x4de0cc['query']['offset']);}_0x4f1686[_0xdaa9('0x4e')]=qs['sort'](_0x4de0cc[_0xdaa9('0x46')]['sort']);_0x4f1686['where']=qs[_0xdaa9('0x51')](_[_0xdaa9('0x67')](_0x4de0cc[_0xdaa9('0x46')],_0x44eb29[_0xdaa9('0x51')]));_0x4f1686[_0xdaa9('0x50')][_0xdaa9('0x63')]=_0x1e18b4['id'];if(_0x4de0cc[_0xdaa9('0x46')][_0xdaa9('0x52')]){_0x4f1686[_0xdaa9('0x50')]=_[_0xdaa9('0x53')](_0x4f1686['where'],{'$or':_[_0xdaa9('0x44')](_0x4f1686[_0xdaa9('0x49')],function(_0x4356fa){var _0x3c0464={};_0x3c0464[_0x4356fa]={'$like':'%'+_0x4de0cc[_0xdaa9('0x46')][_0xdaa9('0x52')]+'%'};return _0x3c0464;})});}_0x4f1686=_['merge']({},_0x4f1686,_0x4de0cc[_0xdaa9('0x54')]);return db['CannedAnswer']['count']({'where':_0x4f1686[_0xdaa9('0x50')]})[_0xdaa9('0x1f')](function(_0x3be6f6){_0x1f3254['count']=_0x3be6f6;if(_0x4de0cc[_0xdaa9('0x46')][_0xdaa9('0x55')]){_0x4f1686['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xdaa9('0x57')](_0x4f1686);})[_0xdaa9('0x1f')](function(_0x3f4532){_0x1f3254[_0xdaa9('0x68')]=_0x3f4532;return _0x1f3254;});}})[_0xdaa9('0x1f')](respondWithFilteredResult(_0x58d482,_0x4f1686))[_0xdaa9('0x2a')](handleError(_0x58d482,null));};exports[_0xdaa9('0x6d')]=function(_0x42b6bc,_0x2644fc,_0x49145c){return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x42b6bc[_0xdaa9('0x58')]['id']}})['then'](handleEntityNotFound(_0x2644fc,null))['then'](function(_0x27f1f7){if(_0x27f1f7){return _0x27f1f7[_0xdaa9('0x6d')](_0x42b6bc[_0xdaa9('0x46')][_0xdaa9('0x6e')]);}})[_0xdaa9('0x1f')](respondWithStatusCode(_0x2644fc,null))[_0xdaa9('0x2a')](handleError(_0x2644fc,null));};exports[_0xdaa9('0x6f')]=function(_0x18cf96,_0xa91f9f,_0x1188fe){var _0x210d74={'channel':'sms'};var _0xf562fb=[];var _0x4a7b51=[];var _0x11dcee={};return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x18cf96[_0xdaa9('0x58')]['id']},'include':[{'model':db[_0xdaa9('0x70')],'as':_0xdaa9('0x71')}]})[_0xdaa9('0x1f')](handleEntityNotFound(_0xa91f9f,null))['then'](function(_0x9b8dce){_0x210d74['account']=_0x9b8dce;_0x210d74[_0xdaa9('0x72')]=_['orderBy'](_0x9b8dce[_0xdaa9('0x71')],[_0xdaa9('0x73')],[_0xdaa9('0x74')]);if(_0x210d74[_0xdaa9('0x75')]['Applications']){delete _0x210d74[_0xdaa9('0x75')][_0xdaa9('0x71')];}return db['CmContact'][_0xdaa9('0x61')]();})['then'](function(_0x114811){if(!_0x114811){throw new db[(_0xdaa9('0x76'))][(_0xdaa9('0x77'))](_0xdaa9('0x78'));}_0xf562fb=_[_0xdaa9('0x79')](_[_0xdaa9('0x45')](_0x114811),[_0xdaa9('0x7a'),_0xdaa9('0x7b')]);_0x4a7b51=_['difference'](_[_0xdaa9('0x45')](_0x114811),['createdAt',_0xdaa9('0x7b'),_0xdaa9('0x7c'),_0xdaa9('0x7d')]);_0x210d74[_0xdaa9('0x5b')]={'mapKey':_0xdaa9('0x7e')};if(_0x210d74[_0xdaa9('0x75')]['type']){switch(_0x210d74[_0xdaa9('0x75')][_0xdaa9('0x42')]){case _0xdaa9('0x7f'):_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')]=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x81')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96[_0xdaa9('0x5b')]['Body'];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x82')]=_0x18cf96['body'][_0xdaa9('0x83')];break;case _0xdaa9('0x84'):_0x210d74[_0xdaa9('0x5b')]['from']='+'+_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x85')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x86')];break;case _0xdaa9('0x87'):_0x210d74[_0xdaa9('0x5b')]['from']=_0x18cf96[_0xdaa9('0x5b')]['from'];_0x210d74[_0xdaa9('0x5b')]['body']=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x27')];break;case _0xdaa9('0x88'):_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')]=_0x18cf96['body'][_0xdaa9('0x80')];_0x210d74[_0xdaa9('0x5b')]['body']=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x5b')];_0x210d74['body'][_0xdaa9('0x82')]=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x89')];break;case _0xdaa9('0x8a'):_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')]=_0x18cf96['body'][_0xdaa9('0x81')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x8b')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x82')]=_0x18cf96[_0xdaa9('0x5b')]['MessageUUID'];break;case _0xdaa9('0x8c'):_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')]='+'+_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x8d')][0x0][_0xdaa9('0x80')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96[_0xdaa9('0x5b')]['results'][0x0]['text'];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x82')]=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x8d')][0x0][_0xdaa9('0x82')];break;case _0xdaa9('0x8e'):_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')]=_0x18cf96['body'][_0xdaa9('0x8f')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96[_0xdaa9('0x5b')]['segmentedMessage'][_0xdaa9('0x27')];break;case'clickatell':_0x210d74['body'][_0xdaa9('0x80')]=_0x18cf96['body'][_0xdaa9('0x90')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96['body'][_0xdaa9('0x86')];_0x210d74[_0xdaa9('0x5b')]['messageId']=_0x18cf96[_0xdaa9('0x5b')]['replyMessageId'];break;case'bandwidth':_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x82')]=_0x18cf96[_0xdaa9('0x5b')][0x0][_0xdaa9('0x27')]['id'];_0x210d74['body']['from']=_0x18cf96[_0xdaa9('0x5b')][0x0][_0xdaa9('0x27')][_0xdaa9('0x80')];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96[_0xdaa9('0x5b')][0x0][_0xdaa9('0x27')][_0xdaa9('0x86')];break;case _0xdaa9('0x91'):_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')]=_0x18cf96[_0xdaa9('0x5b')]['from'];_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')]=_0x18cf96[_0xdaa9('0x5b')]['message'];_0x210d74['body'][_0xdaa9('0x82')]=_0x18cf96[_0xdaa9('0x5b')][_0xdaa9('0x92')];break;}}if(_0x210d74['body']['id']){delete _0x210d74[_0xdaa9('0x5b')]['id'];}if(_[_0xdaa9('0x93')](_0x210d74[_0xdaa9('0x5b')]['from'])){throw new db[(_0xdaa9('0x76'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')])||_0x210d74[_0xdaa9('0x5b')]['body']===''){throw new db[(_0xdaa9('0x76'))][(_0xdaa9('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdaa9('0x93')](_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x94')])){throw new db[(_0xdaa9('0x76'))][(_0xdaa9('0x77'))](_0xdaa9('0x95')+_0x4a7b51);}if(!_[_0xdaa9('0x96')](_0x4a7b51,_0x210d74['body'][_0xdaa9('0x94')])){throw new db[(_0xdaa9('0x76'))][(_0xdaa9('0x77'))](_0xdaa9('0x97')+_0x4a7b51);}_0x11dcee[_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x94')]]=_0x210d74['body'][_0xdaa9('0x80')];return db[_0xdaa9('0x98')][_0xdaa9('0x59')]({'where':{'id':_0x210d74['account'][_0xdaa9('0x7d')]},'include':[{'model':db[_0xdaa9('0x99')],'as':_0xdaa9('0x9a'),'where':_0x11dcee,'limit':0x1,'order':[[_0xdaa9('0x7b'),'DESC']]}]});})[_0xdaa9('0x1f')](handleEntityNotFound(_0xa91f9f,null))[_0xdaa9('0x1f')](function(_0x16e0d2){if(_0x16e0d2){_0x210d74[_0xdaa9('0x9b')]=_['omit'](_0x16e0d2,['Contacts']);if(_0x16e0d2['Contacts'][_0xdaa9('0x4b')]){return _0x16e0d2[_0xdaa9('0x9a')][0x0];}var _0x5e66f0=_[_0xdaa9('0x17')](_0x210d74[_0xdaa9('0x5b')],{'firstName':_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')],'ListId':_0x16e0d2['id']});_0x5e66f0[_0x210d74[_0xdaa9('0x5b')]['mapKey']]=_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')];return db[_0xdaa9('0x99')][_0xdaa9('0x5a')](_0x5e66f0,{'fields':_0xf562fb,'raw':!![]});}})[_0xdaa9('0x1f')](handleEntityNotFound(_0xa91f9f,null))[_0xdaa9('0x1f')](function(_0x312a9d){if(_0x312a9d){_0x210d74['contact']=_0x312a9d;var _0x18ba81={'ContactId':_0x312a9d['id'],'phone':_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')],'SmsAccountId':_0x18cf96[_0xdaa9('0x58')]['id']};var _0x29fe5a={'ContactId':_0x312a9d['id'],'SmsAccountId':_0x18cf96[_0xdaa9('0x58')]['id'],'closed':![]};return db[_0xdaa9('0x9c')][_0xdaa9('0x59')]({'where':_0x29fe5a})[_0xdaa9('0x1f')](function(_0x1f3937){if(_0x1f3937){return[_0x1f3937,![]];}return db['SmsInteraction'][_0xdaa9('0x5a')](_0x18ba81)[_0xdaa9('0x1f')](function(_0x185dd1){return[_0x185dd1,!![]];});});}})[_0xdaa9('0x9d')](function(_0x159399,_0x54ebd4){_0x210d74[_0xdaa9('0x9e')]=_0x159399[_0xdaa9('0x5d')]({'plain':!![]});_0x210d74[_0xdaa9('0x9e')][_0xdaa9('0x9f')]=![];if(_0x54ebd4){if(_0x210d74[_0xdaa9('0x75')][_0xdaa9('0xa0')]){_0x210d74['applications'][_0xdaa9('0xa1')]({'id':0x0,'priority':_0x210d74[_0xdaa9('0x72')][_0xdaa9('0x4b')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xdaa9('0xa2')});}_0x210d74[_0xdaa9('0x9e')][_0xdaa9('0x9f')]=!![];}return db['SmsMessage']['create']({'phone':_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x80')],'messageId':_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x82')],'body':_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0x5b')],'SmsAccountId':_0x18cf96[_0xdaa9('0x58')]['id'],'SmsInteractionId':_0x159399['id'],'direction':'in','ContactId':_0x159399[_0xdaa9('0xa3')],'AttachmentId':_0x210d74[_0xdaa9('0x5b')][_0xdaa9('0xa4')]});})[_0xdaa9('0x1f')](function(_0x1913b1){_0x210d74[_0xdaa9('0x27')]=_0x1913b1;if(!_0x210d74['interaction'][_0xdaa9('0xa5')])return;return db[_0xdaa9('0xa6')]['find']({'attributes':['id','name'],'where':{'id':_0x210d74[_0xdaa9('0x9e')][_0xdaa9('0xa5')]}});})['then'](function(_0x2c9d6f){if(_0x2c9d6f){_0x210d74['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xdaa9('0xa7'),'appdata':_0x2c9d6f[_0xdaa9('0x3c')]+','+(_0x210d74[_0xdaa9('0x75')][_0xdaa9('0xa8')]||0xa),'interval':_0xdaa9('0xa2')});}if(!_0x210d74[_0xdaa9('0x9e')]['queueId'])return;return db[_0xdaa9('0xa9')]['find']({'attributes':['id','name'],'where':{'id':_0x210d74[_0xdaa9('0x9e')][_0xdaa9('0xaa')]}});})[_0xdaa9('0x1f')](function(_0x4b47ff){if(_0x4b47ff){_0x210d74['applications'][_0xdaa9('0xab')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4b47ff[_0xdaa9('0x3c')]+','+(_0x210d74[_0xdaa9('0x75')][_0xdaa9('0xac')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xdaa9('0xad'),'startRouting',_0x210d74);})[_0xdaa9('0x1f')](function(_0x4eeac6){if(_0x4eeac6){var _0x38d6a1=0xc8;var _0x48cbd6=_0xdaa9('0xae');logger['info'](_0xdaa9('0x23'),_0x48cbd6,_0x38d6a1,_0xdaa9('0xaf'));logger[_0xdaa9('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x48cbd6,_0x38d6a1,'entity\x20found',JSON['stringify'](_0x4eeac6));if(_0x210d74['account'][_0xdaa9('0x42')]==='twilio'){return _0xa91f9f['status'](_0x38d6a1)['set'](_0xdaa9('0xb0'),_0xdaa9('0xb1'))[_0xdaa9('0x3d')](_0xdaa9('0xb2'));}else{return _0xa91f9f[_0xdaa9('0x2c')](_0x38d6a1)['json'](_0x4eeac6);}}})['catch'](handleError(_0xa91f9f,null));};exports['addApplications']=function(_0x16dbb1,_0x5e7bd4){var _0x26454a=_0x16dbb1['params']['id'];var _0x1eef64=_0x16dbb1[_0xdaa9('0x5b')];var _0x454be2=0xc8;var _0x55dbf3=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xdaa9('0xb3')][_0xdaa9('0xb4')][_0xdaa9('0xb5')][_0xdaa9('0xb6')]},function(_0x46a308){return db['SmsAccount'][_0xdaa9('0x66')]({'where':{'id':_0x26454a},'transaction':_0x46a308})[_0xdaa9('0x1f')](function(_0x20e17d){if(_0x20e17d){return db[_0xdaa9('0x70')]['destroy']({'where':{'SmsAccountId':_0x26454a},'transaction':_0x46a308})[_0xdaa9('0x1f')](function(){var _0xcf9916=_['map'](_0x1eef64,function(_0x34f7d6){_0x34f7d6['SmsAccountId']=_0x26454a;return _0x34f7d6;});return db[_0xdaa9('0x70')][_0xdaa9('0xb7')](_0xcf9916,{'transaction':_0x46a308});});}else{_0x454be2=0x194;_0x55dbf3=[];}});})[_0xdaa9('0x1f')](function(){if(_0x454be2!==0x194){return db[_0xdaa9('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x26454a},'order':_0xdaa9('0x73')})['then'](function(_0x1de3a0){_0x55dbf3=_0x1de3a0;});}})[_0xdaa9('0x2a')](function(_0xea2904){_0x454be2=0x1f4;logger[_0xdaa9('0x25')](_0xea2904[_0xdaa9('0x3b')]);if(_0xea2904[_0xdaa9('0x3c')]){delete _0xea2904[_0xdaa9('0x3c')];}_0x55dbf3=_0xea2904;})['finally'](function(){if(_0x55dbf3===null){_0x5e7bd4['sendStatus'](_0x454be2);}else{if(_0x454be2===0x1f4){_0x5e7bd4[_0xdaa9('0x2c')](_0x454be2)['send'](_0x55dbf3);}else{_0x5e7bd4[_0xdaa9('0x2c')](_0x454be2)[_0xdaa9('0x2d')](_0x55dbf3);}}});};exports['getApplications']=function(_0x35cfac,_0x139fe3,_0x2560b3){var _0x245022={};var _0x1c390b={};var _0x343ec7;var _0x4ef2e7;return db[_0xdaa9('0x40')][_0xdaa9('0x66')]({'where':{'id':_0x35cfac[_0xdaa9('0x58')]['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x139fe3,null))[_0xdaa9('0x1f')](function(_0x2e98bd){if(_0x2e98bd){_0x343ec7=_0x2e98bd;_0x1c390b['model']=_[_0xdaa9('0x45')](db['SmsApplication'][_0xdaa9('0x41')]);_0x1c390b['query']=_[_0xdaa9('0x45')](_0x35cfac[_0xdaa9('0x46')]);_0x1c390b[_0xdaa9('0x51')]=_[_0xdaa9('0x47')](_0x1c390b[_0xdaa9('0x48')],_0x1c390b[_0xdaa9('0x46')]);_0x245022[_0xdaa9('0x49')]=_['intersection'](_0x1c390b[_0xdaa9('0x48')],qs['fields'](_0x35cfac[_0xdaa9('0x46')][_0xdaa9('0x4a')]));_0x245022[_0xdaa9('0x49')]=_0x245022['attributes'][_0xdaa9('0x4b')]?_0x245022[_0xdaa9('0x49')]:_0x1c390b[_0xdaa9('0x48')];_0x245022['order']=qs[_0xdaa9('0x4f')](_0x35cfac[_0xdaa9('0x46')][_0xdaa9('0x4f')]);_0x245022[_0xdaa9('0x50')]=qs['filters'](_['pick'](_0x35cfac['query'],_0x1c390b['filters']));if(_0x35cfac[_0xdaa9('0x46')][_0xdaa9('0x52')]){_0x245022[_0xdaa9('0x50')]=_[_0xdaa9('0x53')](_0x245022[_0xdaa9('0x50')],{'$or':_[_0xdaa9('0x44')](_0x245022[_0xdaa9('0x49')],function(_0x50e862){var _0x2d9682={};_0x2d9682[_0x50e862]={'$like':'%'+_0x35cfac['query'][_0xdaa9('0x52')]+'%'};return _0x2d9682;})});}_0x245022=_['merge']({},_0x245022,_0x35cfac[_0xdaa9('0x54')]);return _0x343ec7['getApplications'](_0x245022);}})[_0xdaa9('0x1f')](function(_0xec425f){if(_0xec425f){_0x4ef2e7=_0xec425f[_0xdaa9('0x4b')];if(!_0x35cfac[_0xdaa9('0x46')]['hasOwnProperty'](_0xdaa9('0x4d'))){_0x245022['limit']=qs[_0xdaa9('0x30')](_0x35cfac['query']['limit']);_0x245022[_0xdaa9('0x2e')]=qs['offset'](_0x35cfac[_0xdaa9('0x46')]['offset']);}return _0x343ec7[_0xdaa9('0xb8')](_0x245022);}})[_0xdaa9('0x1f')](function(_0x1eb61c){if(_0x1eb61c){return _0x1eb61c?{'count':_0x4ef2e7,'rows':_0x1eb61c}:null;}})[_0xdaa9('0x1f')](respondWithResult(_0x139fe3,null))['catch'](handleError(_0x139fe3,null));};exports[_0xdaa9('0xb9')]=function(_0x1c1816,_0x35e54f,_0x5710e1){var _0x29f4b1={'raw':![],'where':{}};var _0x31cea4={};var _0x360413={'count':0x0,'rows':[]};return db['SmsAccount'][_0xdaa9('0x66')]({'where':{'id':_0x1c1816[_0xdaa9('0x58')]['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x35e54f,null))['then'](function(_0x503a9a){if(_0x503a9a){_0x31cea4[_0xdaa9('0x48')]=_[_0xdaa9('0x45')](db[_0xdaa9('0x9c')]['rawAttributes']);_0x31cea4['query']=_[_0xdaa9('0x45')](_0x1c1816[_0xdaa9('0x46')]);_0x31cea4[_0xdaa9('0x51')]=_['intersection'](_0x31cea4[_0xdaa9('0x48')],_0x31cea4[_0xdaa9('0x46')]);_0x29f4b1['attributes']=_['intersection'](_0x31cea4[_0xdaa9('0x48')],qs[_0xdaa9('0x4a')](_0x1c1816[_0xdaa9('0x46')][_0xdaa9('0x4a')]));_0x29f4b1['attributes']=_0x29f4b1['attributes'][_0xdaa9('0x4b')]?_0x29f4b1[_0xdaa9('0x49')]:_0x31cea4[_0xdaa9('0x48')];if(!_0x1c1816[_0xdaa9('0x46')][_0xdaa9('0x4c')](_0xdaa9('0x4d'))){_0x29f4b1[_0xdaa9('0x30')]=qs[_0xdaa9('0x30')](_0x1c1816[_0xdaa9('0x46')]['limit']);_0x29f4b1[_0xdaa9('0x2e')]=qs['offset'](_0x1c1816[_0xdaa9('0x46')][_0xdaa9('0x2e')]);}_0x29f4b1[_0xdaa9('0x4e')]=qs[_0xdaa9('0x4f')](_0x1c1816['query']['sort']);_0x29f4b1['where']=qs[_0xdaa9('0x51')](_['pick'](_0x1c1816[_0xdaa9('0x46')],_0x31cea4['filters']));_0x29f4b1[_0xdaa9('0x50')][_0xdaa9('0x63')]=_0x503a9a['id'];if(_0x1c1816['query']['filter']){_0x29f4b1[_0xdaa9('0x50')]=_[_0xdaa9('0x53')](_0x29f4b1[_0xdaa9('0x50')],{'$or':_[_0xdaa9('0x44')](_0x29f4b1[_0xdaa9('0x49')],function(_0x482529){var _0x4a0b55={};_0x4a0b55[_0x482529]={'$like':'%'+_0x1c1816[_0xdaa9('0x46')]['filter']+'%'};return _0x4a0b55;})});}_0x29f4b1=_[_0xdaa9('0x53')]({},_0x29f4b1,_0x1c1816[_0xdaa9('0x54')]);return db[_0xdaa9('0x9c')][_0xdaa9('0x31')]({'where':_0x29f4b1[_0xdaa9('0x50')]})['then'](function(_0x563b0c){_0x360413[_0xdaa9('0x31')]=_0x563b0c;if(_0x1c1816[_0xdaa9('0x46')][_0xdaa9('0x55')]){_0x29f4b1['include']=[{'model':db[_0xdaa9('0x99')],'as':_0xdaa9('0xba'),'required':![]},{'model':db[_0xdaa9('0xa6')],'as':_0xdaa9('0xbb'),'attributes':[_0xdaa9('0x3c'),_0xdaa9('0xbc'),_0xdaa9('0xbd')],'required':![]},{'model':db[_0xdaa9('0xbe')],'as':_0xdaa9('0xbf'),'attributes':['id','name','color'],'where':_0x1c1816['query'][_0xdaa9('0xc0')]?{'id':_0x1c1816[_0xdaa9('0x46')][_0xdaa9('0xc0')]}:undefined,'required':_0x1c1816['query'][_0xdaa9('0xc0')]?!![]:![]}];}return db[_0xdaa9('0x9c')][_0xdaa9('0x57')](_0x29f4b1);})[_0xdaa9('0x1f')](function(_0x5141c8){_0x360413['rows']=_0x5141c8;return _0x360413;});}})[_0xdaa9('0x1f')](respondWithFilteredResult(_0x35e54f,_0x29f4b1))[_0xdaa9('0x2a')](handleError(_0x35e54f,null));};exports['send']=function(_0x2655a4,_0x2dd38d,_0x27fbcc){var _0x4fb38a,_0x2496bb,_0x4517eb;if(_[_0xdaa9('0x93')](_0x2655a4[_0xdaa9('0x5b')][_0xdaa9('0x5b')])||_0x2655a4[_0xdaa9('0x5b')]['body']===''){throw new db[(_0xdaa9('0x76'))][(_0xdaa9('0x77'))](_0xdaa9('0xc1'));}if(_[_0xdaa9('0x93')](_0x2655a4[_0xdaa9('0x5b')]['to'])){throw new db[(_0xdaa9('0x76'))][(_0xdaa9('0x77'))](_0xdaa9('0xc2'));}_0x4fb38a=_0x2655a4[_0xdaa9('0x5b')]['to'];return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x2655a4[_0xdaa9('0x58')]['id']},'include':[{'model':db[_0xdaa9('0x98')],'as':'List','include':[{'model':db[_0xdaa9('0x99')],'as':_0xdaa9('0x9a'),'where':{'mobile':_0x4fb38a},'limit':0x1,'order':[['updatedAt',_0xdaa9('0xc3')]]}]}]})[_0xdaa9('0x1f')](handleEntityNotFound(_0x2dd38d,null))[_0xdaa9('0x1f')](function(_0x30fe3b){if(_0x30fe3b&&_0x30fe3b['List']){_0x2496bb=_0x30fe3b[_0xdaa9('0x5d')]({'plain':!![]});if(_0x2496bb['List']&&_0x2496bb['List'][_0xdaa9('0x9a')][_0xdaa9('0x4b')]){return _0x2496bb[_0xdaa9('0xc4')][_0xdaa9('0x9a')][0x0];}return db[_0xdaa9('0x99')][_0xdaa9('0x5a')](_[_0xdaa9('0x17')](_0x2655a4[_0xdaa9('0x5b')],{'firstName':_0x4fb38a,'mobile':_0x4fb38a,'phone':_0x4fb38a,'ListId':_0x2496bb[_0xdaa9('0x7d')]}));}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x2dd38d,null))[_0xdaa9('0x1f')](function(_0x520a63){if(_0x520a63){_0x4517eb=_0x520a63;return db[_0xdaa9('0x9c')][_0xdaa9('0x59')]({'where':{'ContactId':_0x4517eb['id'],'closed':![],'SmsAccountId':_0x2496bb['id']}})['then'](function(_0x4d2358){if(_0x4d2358){return[_0x4d2358,![]];}return db[_0xdaa9('0x9c')][_0xdaa9('0x5a')]({'UserId':_0x2655a4[_0xdaa9('0x5c')]['id'],'ContactId':_0x4517eb['id'],'SmsAccountId':_0x2496bb['id'],'phone':_0x4fb38a,'firstMsgDirection':_0xdaa9('0xc5'),'Messages':[_[_0xdaa9('0x53')](_0x2655a4[_0xdaa9('0x5b')],{'read':![],'body':_0x2655a4[_0xdaa9('0x5b')][_0xdaa9('0x5b')],'phone':_0x4fb38a,'SmsAccountId':_0x2496bb['id'],'UserId':_0x2655a4[_0xdaa9('0x5c')]['id'],'ContactId':_0x4517eb['id']})]},{'include':[{'model':db[_0xdaa9('0xc6')],'as':_0xdaa9('0xc7')}]})[_0xdaa9('0x1f')](function(_0xd4438e){return[_0xd4438e,!![]];});});}})[_0xdaa9('0x9d')](function(_0x273793,_0x5f5997){if(_0x5f5997){return _0x273793;}return db[_0xdaa9('0xc6')][_0xdaa9('0x5a')](_['merge'](_0x2655a4[_0xdaa9('0x5b')],{'read':![],'body':_0x2655a4[_0xdaa9('0x5b')][_0xdaa9('0x5b')],'phone':_0x4fb38a,'SmsAccountId':_0x2496bb['id'],'SmsInteractionId':_0x273793['id'],'UserId':_0x2655a4[_0xdaa9('0x5c')]['id'],'ContactId':_0x4517eb['id']}))[_0xdaa9('0x1f')](function(_0x55766f){_0x273793[_0xdaa9('0xc8')][_0xdaa9('0xc7')]=[];_0x273793[_0xdaa9('0xc8')][_0xdaa9('0xc7')][_0xdaa9('0xa1')](_0x55766f['dataValues']);return _0x273793;});})['then'](respondWithResult(_0x2dd38d,null))['catch'](handleError(_0x2dd38d,null));};exports[_0xdaa9('0x2c')]=function(_0x1ba7fe,_0xf831cc,_0x5a30dd){if(_0x1ba7fe['body']['id']){delete _0x1ba7fe[_0xdaa9('0x5b')]['id'];}var _0x4cab95,_0x25c075,_0x47277c;return db[_0xdaa9('0x40')]['find']({'where':{'id':_0x1ba7fe['params']['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0xf831cc,null))[_0xdaa9('0x1f')](function(_0x269aec){if(_0x269aec){_0x47277c=_0x269aec;logger[_0xdaa9('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdaa9('0x2c'),_0xdaa9('0xc9'),_0x269aec[_0xdaa9('0x42')],util['inspect'](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));switch(_0x269aec['type']){case'skebby':if(_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0xca')]&&_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x2c')]){_0x25c075=_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x2c')];return db[_0xdaa9('0xc6')]['find']({'where':{'messageId':_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0xca')]}});}break;case _0xdaa9('0x87'):if(_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0xcb')]&&_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0xcc')]){_0x25c075=_0x1ba7fe[_0xdaa9('0x5b')]['statusInt'];return db[_0xdaa9('0xc6')]['find']({'where':{'messageId':_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0xcb')]}});}break;case _0xdaa9('0x88'):if(_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x89')]&&_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0xcd')]){_0x25c075=_0x1ba7fe[_0xdaa9('0x5b')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x89')]}});}break;case _0xdaa9('0x8c'):var _0x35048c=_0x1ba7fe[_0xdaa9('0x5b')]['results'][0x0];if(_0x35048c[_0xdaa9('0x82')]&&_0x35048c[_0xdaa9('0x2c')][_0xdaa9('0xce')]===_0xdaa9('0xcf')){_0x25c075=_0x35048c[_0xdaa9('0x2c')][_0xdaa9('0xce')];return db['SmsMessage'][_0xdaa9('0x59')]({'where':{'messageId':_0x35048c[_0xdaa9('0x82')]}});}break;case _0xdaa9('0xd0'):if(_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x82')]&&_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x2c')]){_0x25c075=_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x2c')];return db[_0xdaa9('0xc6')][_0xdaa9('0x59')]({'where':{'messageId':_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x82')]}});}break;case _0xdaa9('0xd1'):if(_0x1ba7fe['body'][0x0]['message']['id']){_0x25c075=_0x1ba7fe['body'][0x0][_0xdaa9('0x42')];return db['SmsMessage'][_0xdaa9('0x59')]({'where':{'messageId':_0x1ba7fe[_0xdaa9('0x5b')][0x0][_0xdaa9('0x27')]['id']}});}break;case _0xdaa9('0x91'):if(_0x1ba7fe['body'][_0xdaa9('0xd2')]&&_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x2c')]){_0x25c075=_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x2c')];return db[_0xdaa9('0xc6')]['find']({'where':{'messageId':_0x1ba7fe['body'][_0xdaa9('0xd2')]}});}break;}}})[_0xdaa9('0x1f')](handleEntityNotFound(_0xf831cc,null))[_0xdaa9('0x1f')](function(_0x877a02){if(_0x877a02){_0x4cab95=_0x877a02;switch(_0x47277c[_0xdaa9('0x42')]){case _0xdaa9('0x84'):if(_0x25c075==='DELIVERED'){return _0x4cab95[_0xdaa9('0x36')]({'read':!![]});}else{logger[_0xdaa9('0x25')](_0xdaa9('0x23'),'status',_0xdaa9('0x84'),util[_0xdaa9('0xd3')](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x25c075==='1'){return _0x4cab95[_0xdaa9('0x36')]({'read':!![]});}else{logger[_0xdaa9('0x25')](_0xdaa9('0x23'),'status','skebby',util[_0xdaa9('0xd3')](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xdaa9('0x88'):if(!_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0xd4')]&&_0x25c075>=0xc8&&_0x25c075<=0xce){return _0x4cab95[_0xdaa9('0x36')]({'read':!![]});}else{logger[_0xdaa9('0x25')](_0xdaa9('0x23'),_0xdaa9('0x2c'),_0xdaa9('0x88'),util[_0xdaa9('0xd3')](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x330823=_0x1ba7fe[_0xdaa9('0x5b')][_0xdaa9('0x8d')][0x0];if(_0x330823['status'][_0xdaa9('0xce')]===_0xdaa9('0xcf')){return _0x4cab95[_0xdaa9('0x36')]({'read':!![]});}else{logger[_0xdaa9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdaa9('0x2c'),_0xdaa9('0x8c'),util[_0xdaa9('0xd3')](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xdaa9('0xd0'):if(_0x25c075==_0xdaa9('0xd5')||_0x25c075=='RECEIVED_BY_RECIPIENT'){return _0x4cab95[_0xdaa9('0x36')]({'read':!![]});}else{logger[_0xdaa9('0x25')](_0xdaa9('0x23'),_0xdaa9('0x2c'),_0xdaa9('0xd0'),util[_0xdaa9('0xd3')](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x25c075==_0xdaa9('0xd6')){return _0x4cab95[_0xdaa9('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdaa9('0x2c'),_0xdaa9('0xd1'),util[_0xdaa9('0xd3')](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x25c075===_0xdaa9('0xd7')||_0x25c075===_0xdaa9('0xd8')){return _0x4cab95[_0xdaa9('0x36')]({'read':!![]});}else{logger['error'](_0xdaa9('0x23'),_0xdaa9('0x2c'),_0xdaa9('0x91'),util['inspect'](_0x1ba7fe[_0xdaa9('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x4cab95;}})[_0xdaa9('0x1f')](respondWithResult(_0xf831cc,null))['catch'](handleError(_0xf831cc,null));};exports['statusGet']=function(_0xfa55a,_0x5c8024,_0x53c99b){var _0x14d53f,_0x257a9c,_0x1c3df4;return db['SmsAccount'][_0xdaa9('0x59')]({'where':{'id':_0xfa55a['params']['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x5c8024,null))['then'](function(_0x2dae55){if(_0x2dae55){_0x1c3df4=_0x2dae55;logger[_0xdaa9('0x22')](_0xdaa9('0x23'),_0xdaa9('0x2c'),_0xdaa9('0xc9'),_0x2dae55[_0xdaa9('0x42')],util[_0xdaa9('0xd3')](_0xfa55a['query'],{'showHidden':![],'depth':null}));switch(_0x2dae55[_0xdaa9('0x42')]){case _0xdaa9('0x8e'):if(_0xfa55a['query']['message-id']&&_0xfa55a[_0xdaa9('0x46')][_0xdaa9('0xd9')]){_0x257a9c=_0xfa55a[_0xdaa9('0x46')]['state'];return db['SmsMessage']['find']({'where':{'messageId':_0xfa55a[_0xdaa9('0x46')][_0xdaa9('0xda')]}});}break;}}})['then'](handleEntityNotFound(_0x5c8024,null))[_0xdaa9('0x1f')](function(_0x46ed68){if(_0x46ed68){_0x14d53f=_0x46ed68;switch(_0x1c3df4[_0xdaa9('0x42')]){case _0xdaa9('0x8e'):if(_0x257a9c==='2'||_0x257a9c==='6'){return _0x14d53f[_0xdaa9('0x36')]({'read':!![]});}else{logger[_0xdaa9('0x25')](_0xdaa9('0x23'),_0xdaa9('0x2c'),'csc',util['inspect'](_0xfa55a['query'],{'showHidden':![],'depth':null}));};break;}return _0x14d53f;}})[_0xdaa9('0x1f')](respondWithResult(_0x5c8024,null))[_0xdaa9('0x2a')](handleError(_0x5c8024,null));};exports['addAgents']=function(_0x3065ef,_0x205fed,_0x4d569d){return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x3065ef['params']['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x205fed,null))['then'](function(_0x406cd6){if(_0x406cd6){return _0x406cd6['addAgents'](_0x3065ef[_0xdaa9('0x5b')][_0xdaa9('0x6e')],_['omit'](_0x3065ef['body'],[_0xdaa9('0x6e'),'id'])||{})[_0xdaa9('0x9d')](function(_0x266408){for(var _0x469423=0x0;_0x469423<_0x3065ef['body'][_0xdaa9('0x6e')]['length'];_0x469423+=0x1){socket[_0xdaa9('0xdb')](_0xdaa9('0xdc'),{'UserId':Number(_0x3065ef[_0xdaa9('0x5b')][_0xdaa9('0x6e')][_0x469423]),'SmsAccountId':Number(_0x3065ef['params']['id'])});}return _0x266408;});}})['then'](respondWithResult(_0x205fed,null))[_0xdaa9('0x2a')](handleError(_0x205fed,null));};exports[_0xdaa9('0xdd')]=function(_0x555484,_0x3c5952,_0x14ef09){return db[_0xdaa9('0x40')][_0xdaa9('0x59')]({'where':{'id':_0x555484['params']['id']}})['then'](handleEntityNotFound(_0x3c5952,null))[_0xdaa9('0x1f')](function(_0x597586){if(_0x597586){return _0x597586[_0xdaa9('0xdd')](_0x555484[_0xdaa9('0x46')][_0xdaa9('0x6e')])['then'](function(){if(_[_0xdaa9('0xde')](_0x555484[_0xdaa9('0x46')][_0xdaa9('0x6e')])){for(var _0x4dedd3=0x0;_0x4dedd3<_0x555484['query'][_0xdaa9('0x6e')][_0xdaa9('0x4b')];_0x4dedd3+=0x1){socket[_0xdaa9('0xdb')](_0xdaa9('0xdf'),{'UserId':Number(_0x555484[_0xdaa9('0x46')][_0xdaa9('0x6e')][_0x4dedd3]),'SmsAccountId':Number(_0x555484[_0xdaa9('0x58')]['id'])});}}else{socket[_0xdaa9('0xdb')](_0xdaa9('0xdf'),{'UserId':Number(_0x555484[_0xdaa9('0x46')][_0xdaa9('0x6e')]),'SmsAccountId':Number(_0x555484[_0xdaa9('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c5952,null))[_0xdaa9('0x2a')](handleError(_0x3c5952,null));};exports[_0xdaa9('0xe0')]=function(_0x31cf72,_0x5a3e7d,_0x1e7b9f){var _0x4ea73f={};var _0x4fe742={};var _0x2da074;var _0x458f80;return db['SmsAccount']['findOne']({'where':{'id':_0x31cf72[_0xdaa9('0x58')]['id']}})[_0xdaa9('0x1f')](handleEntityNotFound(_0x5a3e7d,null))[_0xdaa9('0x1f')](function(_0x52d650){if(_0x52d650){_0x2da074=_0x52d650;_0x4fe742['model']=_[_0xdaa9('0x45')](db[_0xdaa9('0xa6')][_0xdaa9('0x41')]);_0x4fe742[_0xdaa9('0x46')]=_[_0xdaa9('0x45')](_0x31cf72['query']);_0x4fe742[_0xdaa9('0x51')]=_[_0xdaa9('0x47')](_0x4fe742[_0xdaa9('0x48')],_0x4fe742['query']);_0x4ea73f['attributes']=_['intersection'](_0x4fe742[_0xdaa9('0x48')],qs[_0xdaa9('0x4a')](_0x31cf72['query'][_0xdaa9('0x4a')]));_0x4ea73f[_0xdaa9('0x49')]=_0x4ea73f['attributes'][_0xdaa9('0x4b')]?_0x4ea73f[_0xdaa9('0x49')]:_0x4fe742[_0xdaa9('0x48')];_0x4ea73f[_0xdaa9('0x4e')]=qs[_0xdaa9('0x4f')](_0x31cf72[_0xdaa9('0x46')][_0xdaa9('0x4f')]);_0x4ea73f['where']=qs[_0xdaa9('0x51')](_['pick'](_0x31cf72[_0xdaa9('0x46')],_0x4fe742[_0xdaa9('0x51')]));if(_0x31cf72[_0xdaa9('0x46')][_0xdaa9('0x52')]){_0x4ea73f['where']=_['merge'](_0x4ea73f['where'],{'$or':_['map'](_0x4ea73f[_0xdaa9('0x49')],function(_0x340280){var _0x298e47={};_0x298e47[_0x340280]={'$like':'%'+_0x31cf72[_0xdaa9('0x46')][_0xdaa9('0x52')]+'%'};return _0x298e47;})});}_0x4ea73f=_[_0xdaa9('0x53')]({},_0x4ea73f,_0x31cf72[_0xdaa9('0x54')]);return _0x2da074[_0xdaa9('0xe0')](_0x4ea73f);}})['then'](function(_0x4e54e5){if(_0x4e54e5){_0x458f80=_0x4e54e5['length'];if(!_0x31cf72[_0xdaa9('0x46')][_0xdaa9('0x4c')](_0xdaa9('0x4d'))){_0x4ea73f[_0xdaa9('0x30')]=qs[_0xdaa9('0x30')](_0x31cf72['query'][_0xdaa9('0x30')]);_0x4ea73f[_0xdaa9('0x2e')]=qs[_0xdaa9('0x2e')](_0x31cf72[_0xdaa9('0x46')][_0xdaa9('0x2e')]);}return _0x2da074['getAgents'](_0x4ea73f);}})[_0xdaa9('0x1f')](function(_0x559ee9){if(_0x559ee9){return _0x559ee9?{'count':_0x458f80,'rows':_0x559ee9}:null;}})[_0xdaa9('0x1f')](respondWithResult(_0x5a3e7d,null))[_0xdaa9('0x2a')](handleError(_0x5a3e7d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2b3e461..beea101 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 _0xf847=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x50e1b8,_0x15934e){var _0x16e922=function(_0x58d5f9){while(--_0x58d5f9){_0x50e1b8['push'](_0x50e1b8['shift']());}};_0x16e922(++_0x15934e);}(_0xf847,0xdd));var _0x7f84=function(_0x5c4fea,_0x5a21fc){_0x5c4fea=_0x5c4fea-0x0;var _0x2341fb=_0xf847[_0x5c4fea];return _0x2341fb;};'use strict';var EventEmitter=require(_0x7f84('0x0'));var SmsAccount=require(_0x7f84('0x1'))['db'][_0x7f84('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7f84('0x3')](0x0);var events={'afterCreate':_0x7f84('0x4'),'afterUpdate':'update','afterDestroy':_0x7f84('0x5')};function emitEvent(_0x5cf105){return function(_0x3e835d,_0x5d8aac,_0x53e008){SmsAccountEvents[_0x7f84('0x6')](_0x5cf105+':'+_0x3e835d['id'],_0x3e835d);SmsAccountEvents[_0x7f84('0x6')](_0x5cf105,_0x3e835d);_0x53e008(null);};}for(var e in events){if(events[_0x7f84('0x7')](e)){var event=events[e];SmsAccount[_0x7f84('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x7c5f=['../../mysqldb','SmsAccount','save','update','remove','emit','hook','events'];(function(_0x57ee1d,_0x54111b){var _0x12a933=function(_0x5c9d92){while(--_0x5c9d92){_0x57ee1d['push'](_0x57ee1d['shift']());}};_0x12a933(++_0x54111b);}(_0x7c5f,0x147));var _0xf7c5=function(_0x25630d,_0x29a97d){_0x25630d=_0x25630d-0x0;var _0x1991bc=_0x7c5f[_0x25630d];return _0x1991bc;};'use strict';var EventEmitter=require(_0xf7c5('0x0'));var SmsAccount=require(_0xf7c5('0x1'))['db'][_0xf7c5('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7c5('0x3'),'afterUpdate':_0xf7c5('0x4'),'afterDestroy':_0xf7c5('0x5')};function emitEvent(_0x271967){return function(_0xf0799b,_0x5d876b,_0x52a01c){SmsAccountEvents['emit'](_0x271967+':'+_0xf0799b['id'],_0xf0799b);SmsAccountEvents[_0xf7c5('0x6')](_0x271967,_0xf0799b);_0x52a01c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xf7c5('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4f25b41..e2c7441 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 _0x2221=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4a21e4,_0x47b754){var _0x46c9a5=function(_0x5a1cea){while(--_0x5a1cea){_0x4a21e4['push'](_0x4a21e4['shift']());}};_0x46c9a5(++_0x47b754);}(_0x2221,0x96));var _0x1222=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x2221[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0x1222('0x0'));var util=require(_0x1222('0x1'));var logger=require(_0x1222('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1222('0x3'));var rp=require(_0x1222('0x4'));var fs=require('fs');var path=require(_0x1222('0x5'));var rimraf=require('rimraf');var config=require(_0x1222('0x6'));var attributes=require(_0x1222('0x7'));module[_0x1222('0x8')]=function(_0x2dbae8,_0x1393bb){return _0x2dbae8[_0x1222('0x9')](_0x1222('0xa'),attributes,{'tableName':_0x1222('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9034=['rimraf','exports','define','SmsAccount','sms_accounts','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x9034,0x68));var _0x4903=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9034[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4903('0x0'));var util=require(_0x4903('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4903('0x2'));var BPromise=require(_0x4903('0x3'));var rp=require(_0x4903('0x4'));var fs=require('fs');var path=require(_0x4903('0x5'));var rimraf=require(_0x4903('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x4903('0x7')]=function(_0x21d7e3,_0xdcfa3d){return _0x21d7e3[_0x4903('0x8')](_0x4903('0x9'),attributes,{'tableName':_0x4903('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index dae0ee8..b762b09 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 _0xb5e1=['error','code','message','result','catch','SmsAccount','options','raw','where','attributes','map','include','model','ShowSmsAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x13a37e,_0x449327){var _0x1b5924=function(_0x27d622){while(--_0x27d622){_0x13a37e['push'](_0x13a37e['shift']());}};_0x1b5924(++_0x449327);}(_0xb5e1,0x15c));var _0x1b5e=function(_0x91c951,_0x2988ba){_0x91c951=_0x91c951-0x0;var _0xc454d1=_0xb5e1[_0x91c951];return _0xc454d1;};'use strict';var _=require(_0x1b5e('0x0'));var util=require(_0x1b5e('0x1'));var moment=require(_0x1b5e('0x2'));var BPromise=require(_0x1b5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b5e('0x4'));var db=require(_0x1b5e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b5e('0x6'))(_0x1b5e('0x7'));var config=require(_0x1b5e('0x8'));var jayson=require(_0x1b5e('0x9'));var client=jayson[_0x1b5e('0xa')]['http']({'port':0x232a});config[_0x1b5e('0xb')]=_[_0x1b5e('0xc')](config[_0x1b5e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b5e('0xd'))(new Redis(config[_0x1b5e('0xb')]));require(_0x1b5e('0xe'))[_0x1b5e('0xf')](socket);function respondWithRpcPromise(_0x4b8348,_0x767619,_0x5bdbe1){return new BPromise(function(_0x160442,_0x499734){return client[_0x1b5e('0x10')](_0x4b8348,_0x5bdbe1)[_0x1b5e('0x11')](function(_0x216cda){logger[_0x1b5e('0x12')](_0x1b5e('0x13'),_0x767619,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x767619,_0x1b5e('0x14'),JSON[_0x1b5e('0x15')](_0x216cda));if(_0x216cda[_0x1b5e('0x16')]){if(_0x216cda['error'][_0x1b5e('0x17')]===0x1f4){logger[_0x1b5e('0x16')](_0x1b5e('0x13'),_0x767619,_0x216cda['error'][_0x1b5e('0x18')]);return _0x499734(_0x216cda[_0x1b5e('0x16')][_0x1b5e('0x18')]);}logger[_0x1b5e('0x16')](_0x1b5e('0x13'),_0x767619,_0x216cda[_0x1b5e('0x16')]['message']);return _0x160442(_0x216cda[_0x1b5e('0x16')][_0x1b5e('0x18')]);}else{logger[_0x1b5e('0x12')](_0x1b5e('0x13'),_0x767619,_0x1b5e('0x14'));_0x160442(_0x216cda[_0x1b5e('0x19')][_0x1b5e('0x18')]);}})[_0x1b5e('0x1a')](function(_0x5ab832){logger['error'](_0x1b5e('0x13'),_0x767619,_0x5ab832);_0x499734(_0x5ab832);});});}exports['ShowSmsAccount']=function(_0x1b83e0){var _0xaedb3e=this;return new Promise(function(_0x2227c1,_0x4f90d1){return db[_0x1b5e('0x1b')]['find']({'raw':_0x1b83e0[_0x1b5e('0x1c')]?_0x1b83e0[_0x1b5e('0x1c')][_0x1b5e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b83e0['options']?_0x1b83e0[_0x1b5e('0x1c')][_0x1b5e('0x1e')]||null:null,'attributes':_0x1b83e0['options']?_0x1b83e0[_0x1b5e('0x1c')][_0x1b5e('0x1f')]||null:null,'include':_0x1b83e0[_0x1b5e('0x1c')]?_0x1b83e0['options']['include']?_[_0x1b5e('0x20')](_0x1b83e0['options'][_0x1b5e('0x21')],function(_0x1d47ec){return{'model':db[_0x1d47ec['model']],'as':_0x1d47ec['as'],'attributes':_0x1d47ec[_0x1b5e('0x1f')],'include':_0x1d47ec[_0x1b5e('0x21')]?_[_0x1b5e('0x20')](_0x1d47ec[_0x1b5e('0x21')],function(_0x3b0ad9){return{'model':db[_0x3b0ad9[_0x1b5e('0x22')]],'as':_0x3b0ad9['as'],'attributes':_0x3b0ad9[_0x1b5e('0x1f')],'include':_0x3b0ad9[_0x1b5e('0x21')]?_[_0x1b5e('0x20')](_0x3b0ad9[_0x1b5e('0x21')],function(_0x279558){return{'model':db[_0x279558[_0x1b5e('0x22')]],'as':_0x279558['as'],'attributes':_0x279558[_0x1b5e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18a0b8){logger[_0x1b5e('0x12')](_0x1b5e('0x23'),_0x1b83e0);logger[_0x1b5e('0x24')](_0x1b5e('0x23'),_0x1b83e0,JSON['stringify'](_0x18a0b8));_0x2227c1(_0x18a0b8);})[_0x1b5e('0x1a')](function(_0xf89e88){logger[_0x1b5e('0x16')](_0x1b5e('0x23'),_0xf89e88[_0x1b5e('0x18')],_0x1b83e0);_0x4f90d1(_0xaedb3e[_0x1b5e('0x16')](0x1f4,_0xf89e88[_0x1b5e('0x18')]));});});}; \ No newline at end of file +var _0x9626=['error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','model','then','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4f138e,_0x121725){var _0xa6e793=function(_0x3cb153){while(--_0x3cb153){_0x4f138e['push'](_0x4f138e['shift']());}};_0xa6e793(++_0x121725);}(_0x9626,0x7c));var _0x6962=function(_0x31fb93,_0x5a48d6){_0x31fb93=_0x31fb93-0x0;var _0x3cd142=_0x9626[_0x31fb93];return _0x3cd142;};'use strict';var _=require(_0x6962('0x0'));var util=require(_0x6962('0x1'));var moment=require('moment');var BPromise=require(_0x6962('0x2'));var rs=require(_0x6962('0x3'));var fs=require('fs');var Redis=require(_0x6962('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6962('0x5'))('rpc');var config=require(_0x6962('0x6'));var jayson=require(_0x6962('0x7'));var client=jayson['client'][_0x6962('0x8')]({'port':0x232a});config[_0x6962('0x9')]=_[_0x6962('0xa')](config[_0x6962('0x9')],{'host':_0x6962('0xb'),'port':0x18eb});var socket=require(_0x6962('0xc'))(new Redis(config['redis']));require(_0x6962('0xd'))[_0x6962('0xe')](socket);function respondWithRpcPromise(_0x520e38,_0x39bb18,_0x105162){return new BPromise(function(_0x5b2c8c,_0x3896ac){return client['request'](_0x520e38,_0x105162)['then'](function(_0xeb59b1){logger[_0x6962('0xf')]('SmsAccount,\x20%s,\x20%s',_0x39bb18,'request\x20sent');logger[_0x6962('0x10')](_0x6962('0x11'),_0x39bb18,_0x6962('0x12'),JSON[_0x6962('0x13')](_0xeb59b1));if(_0xeb59b1[_0x6962('0x14')]){if(_0xeb59b1['error'][_0x6962('0x15')]===0x1f4){logger['error'](_0x6962('0x16'),_0x39bb18,_0xeb59b1['error'][_0x6962('0x17')]);return _0x3896ac(_0xeb59b1[_0x6962('0x14')][_0x6962('0x17')]);}logger['error'](_0x6962('0x16'),_0x39bb18,_0xeb59b1[_0x6962('0x14')][_0x6962('0x17')]);return _0x5b2c8c(_0xeb59b1[_0x6962('0x14')][_0x6962('0x17')]);}else{logger[_0x6962('0xf')]('SmsAccount,\x20%s,\x20%s',_0x39bb18,_0x6962('0x12'));_0x5b2c8c(_0xeb59b1[_0x6962('0x18')][_0x6962('0x17')]);}})[_0x6962('0x19')](function(_0x370cc6){logger['error'](_0x6962('0x16'),_0x39bb18,_0x370cc6);_0x3896ac(_0x370cc6);});});}exports[_0x6962('0x1a')]=function(_0x9eede5){var _0x47d4c5=this;return new Promise(function(_0x2304a8,_0x351e27){return db[_0x6962('0x1b')]['find']({'raw':_0x9eede5[_0x6962('0x1c')]?_0x9eede5[_0x6962('0x1c')][_0x6962('0x1d')]===undefined?!![]:![]:!![],'where':_0x9eede5[_0x6962('0x1c')]?_0x9eede5[_0x6962('0x1c')][_0x6962('0x1e')]||null:null,'attributes':_0x9eede5['options']?_0x9eede5[_0x6962('0x1c')][_0x6962('0x1f')]||null:null,'include':_0x9eede5[_0x6962('0x1c')]?_0x9eede5['options']['include']?_[_0x6962('0x20')](_0x9eede5['options'][_0x6962('0x21')],function(_0x242173){return{'model':db[_0x242173['model']],'as':_0x242173['as'],'attributes':_0x242173[_0x6962('0x1f')],'include':_0x242173['include']?_[_0x6962('0x20')](_0x242173[_0x6962('0x21')],function(_0x51b1f4){return{'model':db[_0x51b1f4[_0x6962('0x22')]],'as':_0x51b1f4['as'],'attributes':_0x51b1f4[_0x6962('0x1f')],'include':_0x51b1f4[_0x6962('0x21')]?_[_0x6962('0x20')](_0x51b1f4[_0x6962('0x21')],function(_0x56ff71){return{'model':db[_0x56ff71[_0x6962('0x22')]],'as':_0x56ff71['as'],'attributes':_0x56ff71[_0x6962('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6962('0x23')](function(_0x590191){logger[_0x6962('0xf')](_0x6962('0x1a'),_0x9eede5);logger[_0x6962('0x10')](_0x6962('0x1a'),_0x9eede5,JSON[_0x6962('0x13')](_0x590191));_0x2304a8(_0x590191);})[_0x6962('0x19')](function(_0x4407d5){logger[_0x6962('0x14')]('ShowSmsAccount',_0x4407d5[_0x6962('0x17')],_0x9eede5);_0x351e27(_0x47d4c5[_0x6962('0x14')](0x1f4,_0x4407d5[_0x6962('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 11969f8..2f42dd0 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 8cedcc6..5ee323d 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x290501,_0x1c8e10){var _0x151537=function(_0x3c28ec){while(--_0x3c28ec){_0x290501['push'](_0x290501['shift']());}};_0x151537(++_0x1c8e10);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +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(_0x29165d,_0x221063){var _0x3dd8f9=function(_0x428f99){while(--_0x428f99){_0x29165d['push'](_0x29165d['shift']());}};_0x3dd8f9(++_0x221063);}(_0x3e74,0x175));var _0x43e7=function(_0x3814c6,_0xf0511f){_0x3814c6=_0x3814c6-0x0;var _0x31b634=_0x3e74[_0x3814c6];return _0x31b634;};'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 5fd37eb..71aef09 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 _0x2999=['exports','noop','TEXT','STRING','sequelize'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x2999,0x1c1));var _0x9299=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2999[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9299('0x0'));module[_0x9299('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9299('0x2')},'appdata':{'type':Sequelize[_0x9299('0x3')]()},'description':{'type':Sequelize[_0x9299('0x4')]},'interval':{'type':Sequelize[_0x9299('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4925=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x25ae76,_0x225972){var _0x425b92=function(_0x5aa4eb){while(--_0x5aa4eb){_0x25ae76['push'](_0x25ae76['shift']());}};_0x425b92(++_0x225972);}(_0x4925,0x1b5));var _0x5492=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x4925[_0x687ddc];return _0x441991;};'use strict';var Sequelize=require('sequelize');module[_0x5492('0x0')]={'priority':{'type':Sequelize[_0x5492('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5492('0x2')],'allowNull':![],'defaultValue':_0x5492('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5492('0x2')],'defaultValue':_0x5492('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 9c8cb42..1501ee9 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 _0x86a3=['sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','end','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x500d35,_0x3f5d69){var _0x383af4=function(_0x22c7e9){while(--_0x22c7e9){_0x500d35['push'](_0x500d35['shift']());}};_0x383af4(++_0x3f5d69);}(_0x86a3,0x152));var _0x386a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x86a3[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x386a('0x0'));var zipdir=require(_0x386a('0x1'));var jsonpatch=require(_0x386a('0x2'));var rp=require('request-promise');var moment=require(_0x386a('0x3'));var BPromise=require(_0x386a('0x4'));var Mustache=require(_0x386a('0x5'));var util=require(_0x386a('0x6'));var path=require(_0x386a('0x7'));var sox=require(_0x386a('0x8'));var csv=require(_0x386a('0x9'));var ejs=require(_0x386a('0xa'));var fs=require('fs');var fs_extra=require(_0x386a('0xb'));var _=require('lodash');var squel=require(_0x386a('0xc'));var crypto=require('crypto');var jsforce=require(_0x386a('0xd'));var deskjs=require(_0x386a('0xe'));var toCsv=require(_0x386a('0x9'));var querystring=require(_0x386a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x386a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x386a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x386a('0x12'))(_0x386a('0x13'));var utils=require(_0x386a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x386a('0x15'))['db'];function respondWithStatusCode(_0x81450b,_0x15d95a){_0x15d95a=_0x15d95a||0xcc;return function(_0x326fb4){if(_0x326fb4){return _0x81450b[_0x386a('0x16')](_0x15d95a);}return _0x81450b[_0x386a('0x17')](_0x15d95a)['end']();};}function respondWithResult(_0x4de3a4,_0x28116f){_0x28116f=_0x28116f||0xc8;return function(_0x3d562a){if(_0x3d562a){return _0x4de3a4[_0x386a('0x17')](_0x28116f)['json'](_0x3d562a);}};}function respondWithFilteredResult(_0xc13ace,_0x13b2c9){return function(_0x2fe44f){if(_0x2fe44f){var _0x1d24ca=typeof _0x13b2c9[_0x386a('0x18')]===_0x386a('0x19')&&typeof _0x13b2c9[_0x386a('0x1a')]===_0x386a('0x19');var _0x68461d=_0x2fe44f['count'];var _0x4040a9=_0x1d24ca?0x0:_0x13b2c9['offset'];var _0x743840=_0x1d24ca?_0x2fe44f['count']:_0x13b2c9['offset']+_0x13b2c9[_0x386a('0x1a')];var _0x5048ed;if(_0x743840>=_0x68461d){_0x743840=_0x68461d;_0x5048ed=0xc8;}else{_0x5048ed=0xce;}_0xc13ace[_0x386a('0x17')](_0x5048ed);return _0xc13ace[_0x386a('0x1b')](_0x386a('0x1c'),_0x4040a9+'-'+_0x743840+'/'+_0x68461d)[_0x386a('0x1d')](_0x2fe44f);}return null;};}function patchUpdates(_0x165e0c){return function(_0xe0e8dd){try{jsonpatch[_0x386a('0x1e')](_0xe0e8dd,_0x165e0c,!![]);}catch(_0x570d05){return BPromise[_0x386a('0x1f')](_0x570d05);}return _0xe0e8dd[_0x386a('0x20')]();};}function saveUpdates(_0x18d2c1,_0x587dab){return function(_0x10bae3){if(_0x10bae3){return _0x10bae3['update'](_0x18d2c1)[_0x386a('0x21')](function(_0x4eda3d){return _0x4eda3d;});}return null;};}function removeEntity(_0x3380d8,_0x504ec0){return function(_0x453109){if(_0x453109){return _0x453109['destroy']()['then'](function(){_0x3380d8['status'](0xcc)[_0x386a('0x22')]();});}};}function handleEntityNotFound(_0xd7f2df,_0x2daf81){return function(_0x59e24e){if(!_0x59e24e){_0xd7f2df['sendStatus'](0x194);}return _0x59e24e;};}function handleError(_0x42312a,_0x29a95f){_0x29a95f=_0x29a95f||0x1f4;return function(_0x563cb0){logger['error'](_0x563cb0[_0x386a('0x23')]);if(_0x563cb0[_0x386a('0x24')]){delete _0x563cb0[_0x386a('0x24')];}_0x42312a[_0x386a('0x17')](_0x29a95f)[_0x386a('0x25')](_0x563cb0);};}exports['index']=function(_0x3b973f,_0x1a2d7d){var _0xb4c918={},_0x4a6c83={},_0x10a445={'count':0x0,'rows':[]};var _0x5b1acb=_[_0x386a('0x26')](db[_0x386a('0x27')][_0x386a('0x28')],function(_0x405559){return{'name':_0x405559[_0x386a('0x29')],'type':_0x405559[_0x386a('0x2a')][_0x386a('0x2b')]};});_0x4a6c83[_0x386a('0x2c')]=_[_0x386a('0x26')](_0x5b1acb,'name');_0x4a6c83[_0x386a('0x2d')]=_[_0x386a('0x2e')](_0x3b973f[_0x386a('0x2d')]);_0x4a6c83[_0x386a('0x2f')]=_['intersection'](_0x4a6c83[_0x386a('0x2c')],_0x4a6c83[_0x386a('0x2d')]);_0xb4c918[_0x386a('0x30')]=_[_0x386a('0x31')](_0x4a6c83[_0x386a('0x2c')],qs['fields'](_0x3b973f[_0x386a('0x2d')][_0x386a('0x32')]));_0xb4c918[_0x386a('0x30')]=_0xb4c918[_0x386a('0x30')][_0x386a('0x33')]?_0xb4c918['attributes']:_0x4a6c83[_0x386a('0x2c')];if(!_0x3b973f[_0x386a('0x2d')]['hasOwnProperty'](_0x386a('0x34'))){_0xb4c918[_0x386a('0x1a')]=qs[_0x386a('0x1a')](_0x3b973f[_0x386a('0x2d')][_0x386a('0x1a')]);_0xb4c918['offset']=qs[_0x386a('0x18')](_0x3b973f[_0x386a('0x2d')][_0x386a('0x18')]);}_0xb4c918['order']=qs[_0x386a('0x35')](_0x3b973f[_0x386a('0x2d')][_0x386a('0x35')]);_0xb4c918[_0x386a('0x36')]=qs[_0x386a('0x2f')](_[_0x386a('0x37')](_0x3b973f[_0x386a('0x2d')],_0x4a6c83['filters']),_0x5b1acb);if(_0x3b973f['query']['filter']){_0xb4c918[_0x386a('0x36')]=_['merge'](_0xb4c918[_0x386a('0x36')],{'$or':_[_0x386a('0x26')](_0x5b1acb,function(_0xab5720){if(_0xab5720[_0x386a('0x2a')]!==_0x386a('0x38')){var _0x325744={};_0x325744[_0xab5720[_0x386a('0x24')]]={'$like':'%'+_0x3b973f[_0x386a('0x2d')][_0x386a('0x39')]+'%'};return _0x325744;}})});}_0xb4c918=_[_0x386a('0x3a')]({},_0xb4c918,_0x3b973f[_0x386a('0x3b')]);var _0x30d5c8={'where':_0xb4c918['where']};return db[_0x386a('0x27')][_0x386a('0x3c')](_0x30d5c8)[_0x386a('0x21')](function(_0x572035){_0x10a445[_0x386a('0x3c')]=_0x572035;if(_0x3b973f[_0x386a('0x2d')][_0x386a('0x3d')]){_0xb4c918[_0x386a('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0x386a('0x3f')](_0xb4c918);})[_0x386a('0x21')](function(_0x9369ad){_0x10a445[_0x386a('0x40')]=_0x9369ad;return _0x10a445;})['then'](respondWithFilteredResult(_0x1a2d7d,_0xb4c918))['catch'](handleError(_0x1a2d7d,null));};exports['show']=function(_0x1fc613,_0x5dd48a){var _0x424547={'raw':!![],'where':{'id':_0x1fc613[_0x386a('0x41')]['id']}},_0x5673ff={};_0x5673ff[_0x386a('0x2c')]=_[_0x386a('0x2e')](db[_0x386a('0x27')][_0x386a('0x28')]);_0x5673ff[_0x386a('0x2d')]=_[_0x386a('0x2e')](_0x1fc613[_0x386a('0x2d')]);_0x5673ff[_0x386a('0x2f')]=_[_0x386a('0x31')](_0x5673ff[_0x386a('0x2c')],_0x5673ff[_0x386a('0x2d')]);_0x424547[_0x386a('0x30')]=_[_0x386a('0x31')](_0x5673ff['model'],qs[_0x386a('0x32')](_0x1fc613['query'][_0x386a('0x32')]));_0x424547[_0x386a('0x30')]=_0x424547['attributes'][_0x386a('0x33')]?_0x424547['attributes']:_0x5673ff[_0x386a('0x2c')];if(_0x1fc613['query'][_0x386a('0x3d')]){_0x424547[_0x386a('0x3e')]=[{'all':!![]}];}_0x424547=_['merge']({},_0x424547,_0x1fc613['options']);return db['SmsApplication'][_0x386a('0x42')](_0x424547)['then'](handleEntityNotFound(_0x5dd48a,null))[_0x386a('0x21')](respondWithResult(_0x5dd48a,null))[_0x386a('0x43')](handleError(_0x5dd48a,null));};exports[_0x386a('0x44')]=function(_0x48607f,_0x24acc9){return db[_0x386a('0x27')][_0x386a('0x44')](_0x48607f[_0x386a('0x45')],{})[_0x386a('0x21')](respondWithResult(_0x24acc9,0xc9))[_0x386a('0x43')](handleError(_0x24acc9,null));};exports[_0x386a('0x46')]=function(_0x24c18b,_0x15d5e1){if(_0x24c18b[_0x386a('0x45')]['id']){delete _0x24c18b['body']['id'];}return db[_0x386a('0x27')][_0x386a('0x42')]({'where':{'id':_0x24c18b[_0x386a('0x41')]['id']}})['then'](handleEntityNotFound(_0x15d5e1,null))[_0x386a('0x21')](saveUpdates(_0x24c18b['body'],null))[_0x386a('0x21')](respondWithResult(_0x15d5e1,null))[_0x386a('0x43')](handleError(_0x15d5e1,null));};exports[_0x386a('0x47')]=function(_0xd5ff12,_0x529949){return db['SmsApplication'][_0x386a('0x42')]({'where':{'id':_0xd5ff12[_0x386a('0x41')]['id']}})[_0x386a('0x21')](handleEntityNotFound(_0x529949,null))[_0x386a('0x21')](removeEntity(_0x529949,null))['catch'](handleError(_0x529949,null));}; \ No newline at end of file +var _0x88b7=['pick','merge','VIRTUAL','filter','options','includeAll','include','catch','params','find','create','update','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','map','SmsApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x55e305,_0x4c06ae){var _0x39a933=function(_0x341dd2){while(--_0x341dd2){_0x55e305['push'](_0x55e305['shift']());}};_0x39a933(++_0x4c06ae);}(_0x88b7,0xca));var _0x788b=function(_0x482ab3,_0x324048){_0x482ab3=_0x482ab3-0x0;var _0xc53a26=_0x88b7[_0x482ab3];return _0xc53a26;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x788b('0x0'));var jsonpatch=require(_0x788b('0x1'));var rp=require(_0x788b('0x2'));var moment=require(_0x788b('0x3'));var BPromise=require(_0x788b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x788b('0x5'));var csv=require('to-csv');var ejs=require(_0x788b('0x6'));var fs=require('fs');var fs_extra=require(_0x788b('0x7'));var _=require(_0x788b('0x8'));var squel=require(_0x788b('0x9'));var crypto=require(_0x788b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x788b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x788b('0xc'));var Papa=require(_0x788b('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(_0x788b('0xe'));var logger=require(_0x788b('0xf'))('api');var utils=require(_0x788b('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x788b('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d784f,_0x5bb8cd){_0x5bb8cd=_0x5bb8cd||0xcc;return function(_0x1457ad){if(_0x1457ad){return _0x5d784f['sendStatus'](_0x5bb8cd);}return _0x5d784f[_0x788b('0x12')](_0x5bb8cd)[_0x788b('0x13')]();};}function respondWithResult(_0x2debec,_0x5f1afb){_0x5f1afb=_0x5f1afb||0xc8;return function(_0x4590fb){if(_0x4590fb){return _0x2debec['status'](_0x5f1afb)[_0x788b('0x14')](_0x4590fb);}};}function respondWithFilteredResult(_0x467a7b,_0x521bc2){return function(_0x68e6c7){if(_0x68e6c7){var _0x1fdc5c=typeof _0x521bc2[_0x788b('0x15')]==='undefined'&&typeof _0x521bc2[_0x788b('0x16')]===_0x788b('0x17');var _0x35653c=_0x68e6c7[_0x788b('0x18')];var _0x5424e3=_0x1fdc5c?0x0:_0x521bc2['offset'];var _0x530749=_0x1fdc5c?_0x68e6c7[_0x788b('0x18')]:_0x521bc2[_0x788b('0x15')]+_0x521bc2[_0x788b('0x16')];var _0x267da1;if(_0x530749>=_0x35653c){_0x530749=_0x35653c;_0x267da1=0xc8;}else{_0x267da1=0xce;}_0x467a7b[_0x788b('0x12')](_0x267da1);return _0x467a7b['set'](_0x788b('0x19'),_0x5424e3+'-'+_0x530749+'/'+_0x35653c)[_0x788b('0x14')](_0x68e6c7);}return null;};}function patchUpdates(_0x29db6f){return function(_0x4fde10){try{jsonpatch['apply'](_0x4fde10,_0x29db6f,!![]);}catch(_0x1a9a0e){return BPromise[_0x788b('0x1a')](_0x1a9a0e);}return _0x4fde10[_0x788b('0x1b')]();};}function saveUpdates(_0x5d90ec,_0x5e009a){return function(_0xbdce2e){if(_0xbdce2e){return _0xbdce2e['update'](_0x5d90ec)[_0x788b('0x1c')](function(_0x57c892){return _0x57c892;});}return null;};}function removeEntity(_0x1646bd,_0x4f1b51){return function(_0x1763a5){if(_0x1763a5){return _0x1763a5[_0x788b('0x1d')]()['then'](function(){_0x1646bd['status'](0xcc)[_0x788b('0x13')]();});}};}function handleEntityNotFound(_0x5514aa,_0x45424b){return function(_0x2267cf){if(!_0x2267cf){_0x5514aa[_0x788b('0x1e')](0x194);}return _0x2267cf;};}function handleError(_0x14b9a8,_0x518a30){_0x518a30=_0x518a30||0x1f4;return function(_0x218167){logger[_0x788b('0x1f')](_0x218167[_0x788b('0x20')]);if(_0x218167[_0x788b('0x21')]){delete _0x218167[_0x788b('0x21')];}_0x14b9a8[_0x788b('0x12')](_0x518a30)['send'](_0x218167);};}exports['index']=function(_0x2e9ce1,_0x4ad57f){var _0x5126d5={},_0x1f5575={},_0x494671={'count':0x0,'rows':[]};var _0x1d2687=_[_0x788b('0x22')](db[_0x788b('0x23')]['rawAttributes'],function(_0x314a72){return{'name':_0x314a72[_0x788b('0x24')],'type':_0x314a72[_0x788b('0x25')]['key']};});_0x1f5575[_0x788b('0x26')]=_[_0x788b('0x22')](_0x1d2687,_0x788b('0x21'));_0x1f5575[_0x788b('0x27')]=_[_0x788b('0x28')](_0x2e9ce1['query']);_0x1f5575[_0x788b('0x29')]=_[_0x788b('0x2a')](_0x1f5575[_0x788b('0x26')],_0x1f5575['query']);_0x5126d5[_0x788b('0x2b')]=_[_0x788b('0x2a')](_0x1f5575[_0x788b('0x26')],qs[_0x788b('0x2c')](_0x2e9ce1[_0x788b('0x27')][_0x788b('0x2c')]));_0x5126d5['attributes']=_0x5126d5[_0x788b('0x2b')][_0x788b('0x2d')]?_0x5126d5[_0x788b('0x2b')]:_0x1f5575[_0x788b('0x26')];if(!_0x2e9ce1[_0x788b('0x27')][_0x788b('0x2e')](_0x788b('0x2f'))){_0x5126d5[_0x788b('0x16')]=qs[_0x788b('0x16')](_0x2e9ce1['query']['limit']);_0x5126d5[_0x788b('0x15')]=qs[_0x788b('0x15')](_0x2e9ce1[_0x788b('0x27')][_0x788b('0x15')]);}_0x5126d5['order']=qs['sort'](_0x2e9ce1[_0x788b('0x27')][_0x788b('0x30')]);_0x5126d5[_0x788b('0x31')]=qs[_0x788b('0x29')](_[_0x788b('0x32')](_0x2e9ce1[_0x788b('0x27')],_0x1f5575[_0x788b('0x29')]),_0x1d2687);if(_0x2e9ce1[_0x788b('0x27')]['filter']){_0x5126d5['where']=_[_0x788b('0x33')](_0x5126d5[_0x788b('0x31')],{'$or':_[_0x788b('0x22')](_0x1d2687,function(_0x5a1a02){if(_0x5a1a02[_0x788b('0x25')]!==_0x788b('0x34')){var _0x5d3390={};_0x5d3390[_0x5a1a02[_0x788b('0x21')]]={'$like':'%'+_0x2e9ce1[_0x788b('0x27')][_0x788b('0x35')]+'%'};return _0x5d3390;}})});}_0x5126d5=_[_0x788b('0x33')]({},_0x5126d5,_0x2e9ce1[_0x788b('0x36')]);var _0x51de1b={'where':_0x5126d5[_0x788b('0x31')]};return db[_0x788b('0x23')]['count'](_0x51de1b)[_0x788b('0x1c')](function(_0x414565){_0x494671[_0x788b('0x18')]=_0x414565;if(_0x2e9ce1[_0x788b('0x27')][_0x788b('0x37')]){_0x5126d5[_0x788b('0x38')]=[{'all':!![]}];}return db[_0x788b('0x23')]['findAll'](_0x5126d5);})['then'](function(_0x1f50c6){_0x494671['rows']=_0x1f50c6;return _0x494671;})[_0x788b('0x1c')](respondWithFilteredResult(_0x4ad57f,_0x5126d5))[_0x788b('0x39')](handleError(_0x4ad57f,null));};exports['show']=function(_0x21e7e3,_0x17cd36){var _0x33591f={'raw':!![],'where':{'id':_0x21e7e3[_0x788b('0x3a')]['id']}},_0x5b8890={};_0x5b8890['model']=_[_0x788b('0x28')](db[_0x788b('0x23')]['rawAttributes']);_0x5b8890[_0x788b('0x27')]=_[_0x788b('0x28')](_0x21e7e3[_0x788b('0x27')]);_0x5b8890[_0x788b('0x29')]=_[_0x788b('0x2a')](_0x5b8890[_0x788b('0x26')],_0x5b8890[_0x788b('0x27')]);_0x33591f[_0x788b('0x2b')]=_[_0x788b('0x2a')](_0x5b8890[_0x788b('0x26')],qs[_0x788b('0x2c')](_0x21e7e3[_0x788b('0x27')][_0x788b('0x2c')]));_0x33591f['attributes']=_0x33591f['attributes'][_0x788b('0x2d')]?_0x33591f[_0x788b('0x2b')]:_0x5b8890['model'];if(_0x21e7e3[_0x788b('0x27')][_0x788b('0x37')]){_0x33591f[_0x788b('0x38')]=[{'all':!![]}];}_0x33591f=_[_0x788b('0x33')]({},_0x33591f,_0x21e7e3[_0x788b('0x36')]);return db['SmsApplication'][_0x788b('0x3b')](_0x33591f)['then'](handleEntityNotFound(_0x17cd36,null))['then'](respondWithResult(_0x17cd36,null))['catch'](handleError(_0x17cd36,null));};exports[_0x788b('0x3c')]=function(_0x117224,_0x36a446){return db[_0x788b('0x23')][_0x788b('0x3c')](_0x117224['body'],{})[_0x788b('0x1c')](respondWithResult(_0x36a446,0xc9))[_0x788b('0x39')](handleError(_0x36a446,null));};exports[_0x788b('0x3d')]=function(_0x1e0754,_0x554a72){if(_0x1e0754[_0x788b('0x3e')]['id']){delete _0x1e0754[_0x788b('0x3e')]['id'];}return db[_0x788b('0x23')][_0x788b('0x3b')]({'where':{'id':_0x1e0754[_0x788b('0x3a')]['id']}})['then'](handleEntityNotFound(_0x554a72,null))['then'](saveUpdates(_0x1e0754[_0x788b('0x3e')],null))[_0x788b('0x1c')](respondWithResult(_0x554a72,null))[_0x788b('0x39')](handleError(_0x554a72,null));};exports[_0x788b('0x1d')]=function(_0x4a9f73,_0x2bb29e){return db[_0x788b('0x23')]['find']({'where':{'id':_0x4a9f73[_0x788b('0x3a')]['id']}})[_0x788b('0x1c')](handleEntityNotFound(_0x2bb29e,null))['then'](removeEntity(_0x2bb29e,null))[_0x788b('0x39')](handleError(_0x2bb29e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 8c351e5..6c74ee1 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 _0xc502=['../../config/environment','./smsApplication.attributes','exports','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0xc502,0x1cc));var _0x2c50=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xc502[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0x2c50('0x0'));var util=require(_0x2c50('0x1'));var logger=require(_0x2c50('0x2'))(_0x2c50('0x3'));var moment=require(_0x2c50('0x4'));var BPromise=require(_0x2c50('0x5'));var rp=require(_0x2c50('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c50('0x7'));var config=require(_0x2c50('0x8'));var attributes=require(_0x2c50('0x9'));module[_0x2c50('0xa')]=function(_0x2298e6,_0x3dcd9b){return _0x2298e6['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c50('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3e74=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x3e74,0x175));var _0x43e7=function(_0x1579fa,_0x18d023){_0x1579fa=_0x1579fa-0x0;var _0x5938be=_0x3e74[_0x1579fa];return _0x5938be;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x43e7('0xa'),'collate':_0x43e7('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index cc0ac0e..ed2e438 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 _0x1619=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4d4d61,_0x271183){var _0x24572a=function(_0x2d6077){while(--_0x2d6077){_0x4d4d61['push'](_0x4d4d61['shift']());}};_0x24572a(++_0x271183);}(_0x1619,0x189));var _0x9161=function(_0x34e461,_0x18b647){_0x34e461=_0x34e461-0x0;var _0x1b312e=_0x1619[_0x34e461];return _0x1b312e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9161('0x0'));var BPromise=require('bluebird');var rs=require(_0x9161('0x1'));var fs=require('fs');var Redis=require(_0x9161('0x2'));var db=require(_0x9161('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9161('0x4'))('rpc');var config=require(_0x9161('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9161('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x280562,_0x4a0ec2,_0xb212e4){return new BPromise(function(_0x1f8240,_0x4f3e87){return client[_0x9161('0x7')](_0x280562,_0xb212e4)['then'](function(_0x3d6e0b){logger['info'](_0x9161('0x8'),_0x4a0ec2,_0x9161('0x9'));logger[_0x9161('0xa')](_0x9161('0xb'),_0x4a0ec2,_0x9161('0x9'),JSON[_0x9161('0xc')](_0x3d6e0b));if(_0x3d6e0b[_0x9161('0xd')]){if(_0x3d6e0b['error']['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4a0ec2,_0x3d6e0b[_0x9161('0xd')]['message']);return _0x4f3e87(_0x3d6e0b[_0x9161('0xd')][_0x9161('0xe')]);}logger[_0x9161('0xd')](_0x9161('0x8'),_0x4a0ec2,_0x3d6e0b[_0x9161('0xd')][_0x9161('0xe')]);return _0x1f8240(_0x3d6e0b[_0x9161('0xd')][_0x9161('0xe')]);}else{logger['info'](_0x9161('0x8'),_0x4a0ec2,_0x9161('0x9'));_0x1f8240(_0x3d6e0b[_0x9161('0xf')]['message']);}})[_0x9161('0x10')](function(_0x2a7261){logger[_0x9161('0xd')]('SmsApplication,\x20%s,\x20%s',_0x4a0ec2,_0x2a7261);_0x4f3e87(_0x2a7261);});});} \ No newline at end of file +var _0xdc91=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x300c9f,_0x2e85c3){var _0x3a54aa=function(_0x56d3c8){while(--_0x56d3c8){_0x300c9f['push'](_0x300c9f['shift']());}};_0x3a54aa(++_0x2e85c3);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1493c9,_0x45108d){_0x1493c9=_0x1493c9-0x0;var _0x355353=_0xdc91[_0x1493c9];return _0x355353;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc9('0x2'))['db'];var utils=require(_0x1dc9('0x3'));var logger=require(_0x1dc9('0x4'))(_0x1dc9('0x5'));var config=require(_0x1dc9('0x6'));var jayson=require(_0x1dc9('0x7'));var client=jayson[_0x1dc9('0x8')][_0x1dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac058,_0x2c6e6c,_0x25a752){return new BPromise(function(_0x316995,_0x3d1772){return client[_0x1dc9('0xa')](_0x5ac058,_0x25a752)[_0x1dc9('0xb')](function(_0x43c405){logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,_0x1dc9('0xe'));logger['debug'](_0x1dc9('0xf'),_0x2c6e6c,'request\x20sent',JSON[_0x1dc9('0x10')](_0x43c405));if(_0x43c405['error']){if(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x12')]===0x1f4){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error'][_0x1dc9('0x13')]);return _0x3d1772(_0x43c405[_0x1dc9('0x11')]['message']);}logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error']['message']);return _0x316995(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x13')]);}else{logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,'request\x20sent');_0x316995(_0x43c405['result'][_0x1dc9('0x13')]);}})[_0x1dc9('0x14')](function(_0x5cccb9){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x5cccb9);_0x3d1772(_0x5cccb9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 709279a..613dc39 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 _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x17bb47,_0x10a06c){var _0x4bc955=function(_0x1e020f){while(--_0x1e020f){_0x17bb47['push'](_0x17bb47['shift']());}};_0x4bc955(++_0x10a06c);}(_0xea28,0x13a));var _0x8ea2=function(_0x3d1174,_0x51dfc3){_0x3d1174=_0x3d1174-0x0;var _0x321c3a=_0xea28[_0x3d1174];return _0x321c3a;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0x8f4c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x3b4aa7,_0x27f8cf){var _0xb3b9c7=function(_0x5827cd){while(--_0x5827cd){_0x3b4aa7['push'](_0x3b4aa7['shift']());}};_0xb3b9c7(++_0x27f8cf);}(_0x8f4c,0x113));var _0xc8f4=function(_0xe41b50,_0x4c80c6){_0xe41b50=_0xe41b50-0x0;var _0x197d37=_0x8f4c[_0xe41b50];return _0x197d37;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./smsInteraction.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/download',auth[_0xc8f4('0xd')](),controller['download']);router[_0xc8f4('0x11')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x11')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x11')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),'smsinteraction:addtags'),controller[_0xc8f4('0x17')]);router[_0xc8f4('0x18')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')]('sms',_0xc8f4('0x19')),controller['update']);router['delete'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),_0xc8f4('0x1a')),controller[_0xc8f4('0x1b')]);router[_0xc8f4('0x1c')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1d')]);module[_0xc8f4('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 90da262..c586342 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 _0xc5c0=['sequelize','moment','exports','STRING','DATE','ENUM','out','BOOLEAN','INTEGER'];(function(_0x1bc7c4,_0x498d70){var _0x493b1e=function(_0x7f7142){while(--_0x7f7142){_0x1bc7c4['push'](_0x1bc7c4['shift']());}};_0x493b1e(++_0x498d70);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x2a255f,_0x2ed0f4){_0x2a255f=_0x2a255f-0x0;var _0x4f2a1c=_0xc5c0[_0x2a255f];return _0x4f2a1c;};'use strict';var Sequelize=require(_0x0c5c('0x0'));var moment=require(_0x0c5c('0x1'));module[_0x0c5c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0c5c('0x3')]},'secondDisposition':{'type':Sequelize[_0x0c5c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0c5c('0x3')]},'phone':{'type':Sequelize[_0x0c5c('0x3')]},'read1stAt':{'type':Sequelize[_0x0c5c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0c5c('0x5')]('in',_0x0c5c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0c5c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0c5c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0c5c('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0c5c('0x8')]}}; \ No newline at end of file +var _0x4dcb=['BOOLEAN','DATE','STRING','out','ENUM','INTEGER','moment','exports'];(function(_0x4c0fe9,_0xed8556){var _0xe75b50=function(_0x4902e6){while(--_0x4902e6){_0x4c0fe9['push'](_0x4c0fe9['shift']());}};_0xe75b50(++_0xed8556);}(_0x4dcb,0x186));var _0xb4dc=function(_0x591b97,_0x5f28d6){_0x591b97=_0x591b97-0x0;var _0x4c2976=_0x4dcb[_0x591b97];return _0x4c2976;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb4dc('0x0'));module[_0xb4dc('0x1')]={'closed':{'type':Sequelize[_0xb4dc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb4dc('0x3')]},'disposition':{'type':Sequelize[_0xb4dc('0x4')]},'secondDisposition':{'type':Sequelize[_0xb4dc('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb4dc('0x4')]},'note':{'type':Sequelize[_0xb4dc('0x4')]},'phone':{'type':Sequelize[_0xb4dc('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb4dc('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb4dc('0x6')]('in',_0xb4dc('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb4dc('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb4dc('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1585ed1..428ad9e 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 _0xf81f=['Messages','System','firstName','out','value','renderFile','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','name','send','index','SmsInteraction','type','key','getOptions','findAll','query','user','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','length','nolimit','order','sort','where','filters','pick','SmsInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','omit','spread','color','emit','smsInteractionTags:save','removeTags','download','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','createdAt','direction','secret','read','Account','get','mkdirSync','Owner','N.A.','disposition'];(function(_0x2a275e,_0x5aa79b){var _0x2287fe=function(_0x2f2a70){while(--_0x2f2a70){_0x2a275e['push'](_0x2a275e['shift']());}};_0x2287fe(++_0x5aa79b);}(_0xf81f,0xfc));var _0xff81=function(_0x5f07f6,_0x22b465){_0x5f07f6=_0x5f07f6-0x0;var _0x5c7947=_0xf81f[_0x5f07f6];return _0x5c7947;};'use strict';var rimraf=require(_0xff81('0x0'));var zipdir=require(_0xff81('0x1'));var moment=require(_0xff81('0x2'));var BPromise=require(_0xff81('0x3'));var util=require(_0xff81('0x4'));var path=require(_0xff81('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xff81('0x6'));var qs=require(_0xff81('0x7'));var pdf=require(_0xff81('0x8'));var logger=require(_0xff81('0x9'))('api');var config=require(_0xff81('0xa'));var db=require(_0xff81('0xb'))['db'];config[_0xff81('0xc')]=_['defaults'](config['redis'],{'host':_0xff81('0xd'),'port':0x18eb});var socket=require(_0xff81('0xe'))(new Redis(config[_0xff81('0xc')]));require(_0xff81('0xf'))[_0xff81('0x10')](socket);function respondWithStatusCode(_0x464fc8,_0x365e5f){_0x365e5f=_0x365e5f||0xcc;return function(_0x45a94c){if(_0x45a94c){return _0x464fc8[_0xff81('0x11')](_0x365e5f);}return _0x464fc8[_0xff81('0x12')](_0x365e5f)['end']();};}function respondWithResult(_0xf487e9,_0x129e2d){_0x129e2d=_0x129e2d||0xc8;return function(_0x23e2b5){if(_0x23e2b5){return _0xf487e9[_0xff81('0x12')](_0x129e2d)[_0xff81('0x13')](_0x23e2b5);}};}function respondWithFilteredResult(_0x119f14,_0xd71d4b){return function(_0x4d9a3b){if(_0x4d9a3b){var _0x4be67c=typeof _0xd71d4b[_0xff81('0x14')]===_0xff81('0x15')&&typeof _0xd71d4b[_0xff81('0x16')]===_0xff81('0x15');var _0x240636=_0x4d9a3b[_0xff81('0x17')];var _0x47c943=_0x4be67c?0x0:_0xd71d4b[_0xff81('0x14')];var _0x2c2968=_0x4be67c?_0x4d9a3b[_0xff81('0x17')]:_0xd71d4b['offset']+_0xd71d4b['limit'];var _0x580968;if(_0x2c2968>=_0x240636){_0x2c2968=_0x240636;_0x580968=0xc8;}else{_0x580968=0xce;}_0x119f14['status'](_0x580968);return _0x119f14[_0xff81('0x18')](_0xff81('0x19'),_0x47c943+'-'+_0x2c2968+'/'+_0x240636)['json'](_0x4d9a3b);}return null;};}function saveUpdates(_0x917498){return function(_0x455bf4){if(_0x455bf4){return _0x455bf4[_0xff81('0x1a')](_0x917498)[_0xff81('0x1b')](function(_0xbb170d){return _0xbb170d;});}return null;};}function removeEntity(_0x3996ec){return function(_0x5ad290){if(_0x5ad290){return _0x5ad290[_0xff81('0x1c')]()[_0xff81('0x1b')](function(){_0x3996ec[_0xff81('0x12')](0xcc)[_0xff81('0x1d')]();});}};}function handleEntityNotFound(_0x5e9b08){return function(_0x5c75de){if(!_0x5c75de){_0x5e9b08[_0xff81('0x11')](0x194);}return _0x5c75de;};}function handleError(_0x558312,_0x272cc8){_0x272cc8=_0x272cc8||0x1f4;return function(_0x1c28f5){logger[_0xff81('0x1e')](_0x1c28f5['stack']);if(_0x1c28f5[_0xff81('0x1f')]){delete _0x1c28f5[_0xff81('0x1f')];}_0x558312[_0xff81('0x12')](_0x272cc8)[_0xff81('0x20')](_0x1c28f5);};}exports[_0xff81('0x21')]=function(_0x6f881f,_0x40eff2){var _0x16179b={};var _0x2a91db=_['map'](db[_0xff81('0x22')]['rawAttributes'],function(_0x2e734d){return{'name':_0x2e734d['fieldName'],'type':_0x2e734d[_0xff81('0x23')][_0xff81('0x24')]};});_0x16179b=qs[_0xff81('0x25')](_0x2a91db,_0x6f881f);return interaction[_0xff81('0x26')]('sms',_0x6f881f[_0xff81('0x27')],_0x6f881f[_0xff81('0x28')],_0x16179b,_0x2a91db)[_0xff81('0x1b')](respondWithFilteredResult(_0x40eff2,_0x16179b))[_0xff81('0x29')](handleError(_0x40eff2,null));};exports[_0xff81('0x2a')]=function(_0x2d3afe,_0x326d3c){var _0x1f861b={'raw':![],'where':{'id':_0x2d3afe[_0xff81('0x2b')]['id']}},_0x214fb1={};_0x214fb1[_0xff81('0x2c')]=_[_0xff81('0x2d')](db[_0xff81('0x22')][_0xff81('0x2e')]);_0x214fb1[_0xff81('0x27')]=_['keys'](_0x2d3afe[_0xff81('0x27')]);_0x214fb1['filters']=_[_0xff81('0x2f')](_0x214fb1['model'],_0x214fb1['query']);_0x1f861b[_0xff81('0x30')]=_[_0xff81('0x2f')](_0x214fb1['model'],qs['fields'](_0x2d3afe[_0xff81('0x27')][_0xff81('0x31')]));_0x1f861b[_0xff81('0x30')]=_0x1f861b[_0xff81('0x30')]['length']?_0x1f861b['attributes']:_0x214fb1['model'];if(_0x2d3afe[_0xff81('0x27')][_0xff81('0x32')]){_0x1f861b[_0xff81('0x33')]=[{'all':!![]}];}_0x1f861b=_[_0xff81('0x34')]({},_0x1f861b,_0x2d3afe[_0xff81('0x35')]);return db[_0xff81('0x22')][_0xff81('0x36')](_0x1f861b)[_0xff81('0x1b')](handleEntityNotFound(_0x326d3c,null))[_0xff81('0x1b')](respondWithResult(_0x326d3c,null))['catch'](handleError(_0x326d3c,null));};exports[_0xff81('0x37')]=function(_0x2a3100,_0x59f790){return db[_0xff81('0x22')][_0xff81('0x37')](_0x2a3100[_0xff81('0x38')],{})[_0xff81('0x1b')](respondWithResult(_0x59f790,0xc9))[_0xff81('0x29')](handleError(_0x59f790,null));};exports['update']=function(_0x2f5458,_0x42c312){if(_0x2f5458['body']['id']){delete _0x2f5458[_0xff81('0x38')]['id'];}return db[_0xff81('0x22')]['find']({'where':{'id':_0x2f5458[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x42c312,null))['then'](saveUpdates(_0x2f5458['body'],null))[_0xff81('0x1b')](respondWithResult(_0x42c312,null))['catch'](handleError(_0x42c312,null));};exports[_0xff81('0x1c')]=function(_0x3dcb13,_0x215392){return db[_0xff81('0x22')][_0xff81('0x36')]({'where':{'id':_0x3dcb13[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x215392,null))['then'](removeEntity(_0x215392,null))[_0xff81('0x29')](handleError(_0x215392,null));};exports[_0xff81('0x39')]=function(_0x1c0ba9,_0x260627){return db[_0xff81('0x22')][_0xff81('0x39')]()[_0xff81('0x1b')](respondWithResult(_0x260627,null))[_0xff81('0x29')](handleError(_0x260627,null));};exports[_0xff81('0x3a')]=function(_0x2755f5,_0x5e1199){return db[_0xff81('0x3b')][_0xff81('0x36')]({'where':{'id':_0x2755f5[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x5e1199,null))[_0xff81('0x1b')](function(_0x44785e){if(_0x44785e){return _0x44785e[_0xff81('0x3a')](_0x2755f5[_0xff81('0x38')]['ids'],_['omit'](_0x2755f5[_0xff81('0x38')],[_0xff81('0x3c'),'id'])||{});}})[_0xff81('0x1b')](respondWithResult(_0x5e1199,null))[_0xff81('0x29')](handleError(_0x5e1199,null));};exports['getMessages']=function(_0xb1153b,_0x325ab0){var _0x46add9={'raw':![],'where':{}};var _0x354c43={};var _0xad4cc4={'count':0x0,'rows':[]};return db[_0xff81('0x22')]['findOne']({'where':{'id':_0xb1153b['params']['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x325ab0,null))[_0xff81('0x1b')](function(_0x2fce75){if(_0x2fce75){_0x354c43[_0xff81('0x2c')]=_['keys'](db[_0xff81('0x3b')][_0xff81('0x2e')]);_0x354c43['query']=_['keys'](_0xb1153b[_0xff81('0x27')]);_0x354c43['filters']=_[_0xff81('0x2f')](_0x354c43[_0xff81('0x2c')],_0x354c43[_0xff81('0x27')]);_0x46add9[_0xff81('0x30')]=_[_0xff81('0x2f')](_0x354c43[_0xff81('0x2c')],qs[_0xff81('0x31')](_0xb1153b[_0xff81('0x27')][_0xff81('0x31')]));_0x46add9[_0xff81('0x30')]=_0x46add9['attributes'][_0xff81('0x3d')]?_0x46add9['attributes']:_0x354c43[_0xff81('0x2c')];if(!_0xb1153b[_0xff81('0x27')]['hasOwnProperty'](_0xff81('0x3e'))){_0x46add9[_0xff81('0x16')]=qs[_0xff81('0x16')](_0xb1153b[_0xff81('0x27')]['limit']);_0x46add9[_0xff81('0x14')]=qs[_0xff81('0x14')](_0xb1153b['query'][_0xff81('0x14')]);}_0x46add9[_0xff81('0x3f')]=qs['sort'](_0xb1153b[_0xff81('0x27')][_0xff81('0x40')]);_0x46add9[_0xff81('0x41')]=qs[_0xff81('0x42')](_[_0xff81('0x43')](_0xb1153b['query'],_0x354c43['filters']));_0x46add9[_0xff81('0x41')][_0xff81('0x44')]=_0x2fce75['id'];if(_0xb1153b['query']['filter']){_0x46add9[_0xff81('0x41')]=_[_0xff81('0x34')](_0x46add9[_0xff81('0x41')],{'$or':_[_0xff81('0x45')](_0x46add9[_0xff81('0x30')],function(_0x29dbd2){var _0x393c8f={};_0x393c8f[_0x29dbd2]={'$like':'%'+_0xb1153b['query'][_0xff81('0x46')]+'%'};return _0x393c8f;})});}if(_0xb1153b[_0xff81('0x27')][_0xff81('0x47')]){var _0x31b169=_0xb1153b[_0xff81('0x27')][_0xff81('0x47')][_0xff81('0x48')](',');var _0x3a78ca={};_0x3a78ca[_0x31b169[0x0]]={'$gte':moment(_0x31b169[0x1])[_0xff81('0x49')](_0xff81('0x4a'))};_0x46add9['where']=_[_0xff81('0x34')](_0x46add9[_0xff81('0x41')],_0x3a78ca);}_0x46add9=_['merge']({},_0x46add9,_0xb1153b[_0xff81('0x35')]);return db['SmsMessage']['count']({'where':_0x46add9[_0xff81('0x41')]})[_0xff81('0x1b')](function(_0x3d19cd){_0xad4cc4[_0xff81('0x17')]=_0x3d19cd;if(_0xb1153b[_0xff81('0x27')][_0xff81('0x32')]){_0x46add9[_0xff81('0x33')]=[{'all':!![]}];}return db[_0xff81('0x3b')]['findAll'](_0x46add9);})[_0xff81('0x1b')](function(_0x2f5505){_0xad4cc4[_0xff81('0x4b')]=_0x2f5505;return _0xad4cc4;});}})[_0xff81('0x1b')](respondWithFilteredResult(_0x325ab0,_0x46add9))[_0xff81('0x29')](handleError(_0x325ab0,null));};exports['addTags']=function(_0x293012,_0x316e38){return db['SmsInteraction'][_0xff81('0x36')]({'where':{'id':_0x293012[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x316e38,null))['then'](function(_0x1e6ebe){if(_0x1e6ebe){return _0x1e6ebe['setTags'](_0x293012['body'][_0xff81('0x3c')],_[_0xff81('0x4c')](_0x293012[_0xff81('0x38')],[_0xff81('0x3c'),'id'])||{})[_0xff81('0x4d')](function(){return db['Tag'][_0xff81('0x26')]({'attributes':['id',_0xff81('0x1f'),_0xff81('0x4e')],'where':{'id':_0x293012['body']['ids']}});})[_0xff81('0x1b')](function(_0x4512a1){socket[_0xff81('0x4f')](_0xff81('0x50'),{'id':Number(_0x293012['params']['id']),'tags':_0x4512a1||[]});return{'id':Number(_0x293012[_0xff81('0x2b')]['id']),'tags':_0x4512a1||[]};});}})[_0xff81('0x1b')](respondWithResult(_0x316e38,null))['catch'](handleError(_0x316e38,null));};exports[_0xff81('0x51')]=function(_0x34caa4,_0x487a7b){return db['SmsInteraction'][_0xff81('0x36')]({'where':{'id':_0x34caa4[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x487a7b,null))[_0xff81('0x1b')](function(_0x320509){if(_0x320509){return _0x320509[_0xff81('0x51')](_0x34caa4[_0xff81('0x27')]['ids']);}})[_0xff81('0x1b')](respondWithStatusCode(_0x487a7b,null))['catch'](handleError(_0x487a7b,null));};exports[_0xff81('0x52')]=function(_0x335726,_0x201be5){var _0x2aa692=moment()['unix']()[_0xff81('0x53')]();var _0x557659=path[_0xff81('0x54')](config[_0xff81('0x55')],_0xff81('0x56'),'files',_0xff81('0x57'));var _0x2a08da=path[_0xff81('0x54')](_0x557659,_0x2aa692);var _0x33235e=util[_0xff81('0x49')](_0xff81('0x58'),_0x335726[_0xff81('0x2b')]['id'],_0x2aa692);var _0x5c542c=path[_0xff81('0x54')](_0x557659,_0x33235e);var _0x130f92=[];_0x130f92[_0xff81('0x59')]({'model':db['User'],'as':_0xff81('0x5a'),'attributes':['id',_0xff81('0x5b')],'raw':!![]});_0x130f92[_0xff81('0x59')]({'model':db[_0xff81('0x5c')],'as':_0xff81('0x5d'),'attributes':['id','firstName',_0xff81('0x5e')],'raw':!![]});var _0x54f0dd=[{'model':db[_0xff81('0x3b')],'as':'Messages','attributes':['id',_0xff81('0x38'),_0xff81('0x5f'),_0xff81('0x60'),_0xff81('0x61'),_0xff81('0x62')],'include':_0x130f92}];_0x54f0dd[_0xff81('0x59')]({'model':db['SmsAccount'],'as':_0xff81('0x63'),'attributes':['id',_0xff81('0x1f')]});_0x54f0dd[_0xff81('0x59')]({'model':db[_0xff81('0x5a')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xff81('0x36')]({'where':{'id':_0x335726[_0xff81('0x2b')]['id']},'include':_0x54f0dd})[_0xff81('0x1b')](handleEntityNotFound(_0x201be5,null))['then'](function(_0x471dde){if(_0x471dde){var _0x1ab5ba=_0x471dde[_0xff81('0x64')]({'plain':!![]});fs[_0xff81('0x65')](_0x2a08da);var _0x24b797={'channel':'Sms','account':_0x1ab5ba[_0xff81('0x63')]['name'],'agent':_0x1ab5ba['Owner']?_0x1ab5ba[_0xff81('0x66')][_0xff81('0x5b')]:_0xff81('0x67'),'createdAt':moment(_0x1ab5ba[_0xff81('0x5f')])['format'](_0xff81('0x4a'))[_0xff81('0x53')](),'closedAt':_0x1ab5ba['closed']?moment(_0x1ab5ba['closedAt'])[_0xff81('0x49')](_0xff81('0x4a'))[_0xff81('0x53')]():'','disposition':_0x1ab5ba[_0xff81('0x68')],'messages':_(_0x1ab5ba[_0xff81('0x69')])[_0xff81('0x46')]({'secret':![]})[_0xff81('0x45')](function(_0x28516){return{'date':moment(_0x28516[_0xff81('0x5f')])['format'](_0xff81('0x4a'))['toString'](),'sender':_0x28516['direction']==='out'?_0x28516['User']?_0x28516[_0xff81('0x5a')][_0xff81('0x5b')]:_0xff81('0x6a'):_0x28516[_0xff81('0x5d')][_0xff81('0x6b')]+(_0x28516[_0xff81('0x5d')][_0xff81('0x5e')]?'\x20'+_0x28516[_0xff81('0x5d')][_0xff81('0x5e')]:''),'body':_0x28516[_0xff81('0x38')],'direction':_0x28516[_0xff81('0x60')]===_0xff81('0x6c')?'A':'C','secret':_0x28516['secret'],'read':_0x28516['read']};})[_0xff81('0x6d')]()};return ejs[_0xff81('0x6e')](path[_0xff81('0x54')](config[_0xff81('0x55')],'server',_0xff81('0x6f'),_0xff81('0x70')),{'interaction':_0x24b797})[_0xff81('0x1b')](function(_0x29efaf){var _0x16e886=path[_0xff81('0x54')](_0x2a08da,_0xff81('0x71')+_0x1ab5ba['id']+'-'+_0x2aa692+'.pdf');var _0x45c829={'path':_0x16e886,'channel':_0xff81('0x72'),'interactionId':_0x1ab5ba['id']};return pdf[_0xff81('0x73')](_0x29efaf,_0x45c829);})[_0xff81('0x1b')](function(){return new BPromise(function(_0x589c61,_0x55ff1c){zipdir(_0x2a08da,{'saveTo':_0x5c542c},function(_0x4677a2,_0x15f82){if(_0x4677a2)return _0x55ff1c(_0x4677a2);return _0x589c61(_0x15f82);});})[_0xff81('0x1b')](function(){return new BPromise(function(_0x46f41b,_0x7878a4){rimraf(_0x2a08da,function(_0x5b87f8){if(_0x5b87f8)_0x7878a4(_0x5b87f8);return _0x46f41b();});});})[_0xff81('0x1b')](function(){return _0x201be5[_0xff81('0x52')](_0x5c542c,_0x33235e,function(_0x4b7e7b){if(_0x4b7e7b){console[_0xff81('0x74')](_0xff81('0x75'),_0x4b7e7b);}else{fs[_0xff81('0x76')](_0x5c542c);}});});});}else{return _0x201be5[_0xff81('0x11')](0xc8);}})['catch'](handleError(_0x201be5,null));}; \ No newline at end of file +var _0x485f=['SmsInteractionId','filter','merge','split','format','options','addTags','setTags','ids','spread','color','removeTags','download','toString','server','files','join','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','util','path','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','error','name','send','map','SmsInteraction','type','key','findAll','sms','user','catch','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','params','describe','addMessage','getMessages','findOne','SmsMessage','sort','where'];(function(_0x1a3b62,_0x4d746d){var _0x22b203=function(_0x480566){while(--_0x480566){_0x1a3b62['push'](_0x1a3b62['shift']());}};_0x22b203(++_0x4d746d);}(_0x485f,0x188));var _0xf485=function(_0x4ffb46,_0x8bdcc9){_0x4ffb46=_0x4ffb46-0x0;var _0x42cc4b=_0x485f[_0x4ffb46];return _0x42cc4b;};'use strict';var rimraf=require(_0xf485('0x0'));var zipdir=require(_0xf485('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xf485('0x2'));var path=require(_0xf485('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xf485('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xf485('0x5'));var pdf=require(_0xf485('0x6'));var logger=require(_0xf485('0x7'))(_0xf485('0x8'));var config=require(_0xf485('0x9'));var db=require('../../mysqldb')['db'];config[_0xf485('0xa')]=_[_0xf485('0xb')](config[_0xf485('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf485('0xc'))(new Redis(config[_0xf485('0xa')]));require('./smsInteraction.socket')[_0xf485('0xd')](socket);function respondWithStatusCode(_0x148c52,_0xaedb1b){_0xaedb1b=_0xaedb1b||0xcc;return function(_0x254ba8){if(_0x254ba8){return _0x148c52[_0xf485('0xe')](_0xaedb1b);}return _0x148c52['status'](_0xaedb1b)[_0xf485('0xf')]();};}function respondWithResult(_0x1bd966,_0x4dbd91){_0x4dbd91=_0x4dbd91||0xc8;return function(_0xc5cca4){if(_0xc5cca4){return _0x1bd966[_0xf485('0x10')](_0x4dbd91)[_0xf485('0x11')](_0xc5cca4);}};}function respondWithFilteredResult(_0x2fe016,_0x176adb){return function(_0xc41987){if(_0xc41987){var _0x460f83=typeof _0x176adb[_0xf485('0x12')]===_0xf485('0x13')&&typeof _0x176adb[_0xf485('0x14')]===_0xf485('0x13');var _0x552353=_0xc41987['count'];var _0x1b4918=_0x460f83?0x0:_0x176adb[_0xf485('0x12')];var _0x407d9d=_0x460f83?_0xc41987[_0xf485('0x15')]:_0x176adb['offset']+_0x176adb[_0xf485('0x14')];var _0x57dc36;if(_0x407d9d>=_0x552353){_0x407d9d=_0x552353;_0x57dc36=0xc8;}else{_0x57dc36=0xce;}_0x2fe016[_0xf485('0x10')](_0x57dc36);return _0x2fe016[_0xf485('0x16')]('Content-Range',_0x1b4918+'-'+_0x407d9d+'/'+_0x552353)[_0xf485('0x11')](_0xc41987);}return null;};}function saveUpdates(_0x415290){return function(_0x125325){if(_0x125325){return _0x125325[_0xf485('0x17')](_0x415290)[_0xf485('0x18')](function(_0x158ade){return _0x158ade;});}return null;};}function removeEntity(_0x20b19b){return function(_0x37fe4c){if(_0x37fe4c){return _0x37fe4c[_0xf485('0x19')]()[_0xf485('0x18')](function(){_0x20b19b[_0xf485('0x10')](0xcc)[_0xf485('0xf')]();});}};}function handleEntityNotFound(_0xd21fdc){return function(_0x125610){if(!_0x125610){_0xd21fdc[_0xf485('0xe')](0x194);}return _0x125610;};}function handleError(_0xde54c4,_0x110f13){_0x110f13=_0x110f13||0x1f4;return function(_0x29c8e1){logger[_0xf485('0x1a')](_0x29c8e1['stack']);if(_0x29c8e1[_0xf485('0x1b')]){delete _0x29c8e1[_0xf485('0x1b')];}_0xde54c4['status'](_0x110f13)[_0xf485('0x1c')](_0x29c8e1);};}exports['index']=function(_0x4be2df,_0x29c71d){var _0x1ab852={};var _0x3619a7=_[_0xf485('0x1d')](db[_0xf485('0x1e')]['rawAttributes'],function(_0x4b38d5){return{'name':_0x4b38d5['fieldName'],'type':_0x4b38d5[_0xf485('0x1f')][_0xf485('0x20')]};});_0x1ab852=qs['getOptions'](_0x3619a7,_0x4be2df);return interaction[_0xf485('0x21')](_0xf485('0x22'),_0x4be2df['query'],_0x4be2df[_0xf485('0x23')],_0x1ab852,_0x3619a7)[_0xf485('0x18')](respondWithFilteredResult(_0x29c71d,_0x1ab852))[_0xf485('0x24')](handleError(_0x29c71d,null));};exports[_0xf485('0x25')]=function(_0xb660d7,_0x38a4f1){var _0x338a35={'raw':![],'where':{'id':_0xb660d7['params']['id']}},_0x184357={};_0x184357[_0xf485('0x26')]=_[_0xf485('0x27')](db[_0xf485('0x1e')][_0xf485('0x28')]);_0x184357[_0xf485('0x29')]=_[_0xf485('0x27')](_0xb660d7[_0xf485('0x29')]);_0x184357[_0xf485('0x2a')]=_[_0xf485('0x2b')](_0x184357[_0xf485('0x26')],_0x184357[_0xf485('0x29')]);_0x338a35[_0xf485('0x2c')]=_[_0xf485('0x2b')](_0x184357[_0xf485('0x26')],qs[_0xf485('0x2d')](_0xb660d7[_0xf485('0x29')][_0xf485('0x2d')]));_0x338a35[_0xf485('0x2c')]=_0x338a35['attributes'][_0xf485('0x2e')]?_0x338a35[_0xf485('0x2c')]:_0x184357[_0xf485('0x26')];if(_0xb660d7[_0xf485('0x29')][_0xf485('0x2f')]){_0x338a35[_0xf485('0x30')]=[{'all':!![]}];}_0x338a35=_['merge']({},_0x338a35,_0xb660d7['options']);return db[_0xf485('0x1e')][_0xf485('0x31')](_0x338a35)['then'](handleEntityNotFound(_0x38a4f1,null))['then'](respondWithResult(_0x38a4f1,null))[_0xf485('0x24')](handleError(_0x38a4f1,null));};exports[_0xf485('0x32')]=function(_0x4f3e91,_0x2f725a){return db['SmsInteraction'][_0xf485('0x32')](_0x4f3e91['body'],{})[_0xf485('0x18')](respondWithResult(_0x2f725a,0xc9))[_0xf485('0x24')](handleError(_0x2f725a,null));};exports[_0xf485('0x17')]=function(_0x3f1bc8,_0x51cd6e){if(_0x3f1bc8[_0xf485('0x33')]['id']){delete _0x3f1bc8['body']['id'];}return db[_0xf485('0x1e')][_0xf485('0x31')]({'where':{'id':_0x3f1bc8[_0xf485('0x34')]['id']}})[_0xf485('0x18')](handleEntityNotFound(_0x51cd6e,null))['then'](saveUpdates(_0x3f1bc8[_0xf485('0x33')],null))[_0xf485('0x18')](respondWithResult(_0x51cd6e,null))[_0xf485('0x24')](handleError(_0x51cd6e,null));};exports[_0xf485('0x19')]=function(_0x1aca5a,_0x19bdb4){return db[_0xf485('0x1e')][_0xf485('0x31')]({'where':{'id':_0x1aca5a[_0xf485('0x34')]['id']}})[_0xf485('0x18')](handleEntityNotFound(_0x19bdb4,null))[_0xf485('0x18')](removeEntity(_0x19bdb4,null))['catch'](handleError(_0x19bdb4,null));};exports[_0xf485('0x35')]=function(_0x148d0c,_0x235e26){return db[_0xf485('0x1e')][_0xf485('0x35')]()[_0xf485('0x18')](respondWithResult(_0x235e26,null))['catch'](handleError(_0x235e26,null));};exports[_0xf485('0x36')]=function(_0x1f0cce,_0xfb6af){return db['SmsMessage'][_0xf485('0x31')]({'where':{'id':_0x1f0cce[_0xf485('0x34')]['id']}})['then'](handleEntityNotFound(_0xfb6af,null))[_0xf485('0x18')](function(_0x46f851){if(_0x46f851){return _0x46f851[_0xf485('0x36')](_0x1f0cce[_0xf485('0x33')]['ids'],_['omit'](_0x1f0cce['body'],['ids','id'])||{});}})[_0xf485('0x18')](respondWithResult(_0xfb6af,null))[_0xf485('0x24')](handleError(_0xfb6af,null));};exports[_0xf485('0x37')]=function(_0x13fd68,_0xc6717f){var _0x28b5ac={'raw':![],'where':{}};var _0x1c40a3={};var _0x3c2e02={'count':0x0,'rows':[]};return db[_0xf485('0x1e')][_0xf485('0x38')]({'where':{'id':_0x13fd68[_0xf485('0x34')]['id']}})[_0xf485('0x18')](handleEntityNotFound(_0xc6717f,null))[_0xf485('0x18')](function(_0x218936){if(_0x218936){_0x1c40a3['model']=_[_0xf485('0x27')](db[_0xf485('0x39')][_0xf485('0x28')]);_0x1c40a3[_0xf485('0x29')]=_['keys'](_0x13fd68[_0xf485('0x29')]);_0x1c40a3[_0xf485('0x2a')]=_[_0xf485('0x2b')](_0x1c40a3[_0xf485('0x26')],_0x1c40a3[_0xf485('0x29')]);_0x28b5ac[_0xf485('0x2c')]=_[_0xf485('0x2b')](_0x1c40a3[_0xf485('0x26')],qs[_0xf485('0x2d')](_0x13fd68[_0xf485('0x29')][_0xf485('0x2d')]));_0x28b5ac['attributes']=_0x28b5ac[_0xf485('0x2c')][_0xf485('0x2e')]?_0x28b5ac[_0xf485('0x2c')]:_0x1c40a3[_0xf485('0x26')];if(!_0x13fd68['query']['hasOwnProperty']('nolimit')){_0x28b5ac[_0xf485('0x14')]=qs['limit'](_0x13fd68['query'][_0xf485('0x14')]);_0x28b5ac[_0xf485('0x12')]=qs[_0xf485('0x12')](_0x13fd68['query'][_0xf485('0x12')]);}_0x28b5ac['order']=qs['sort'](_0x13fd68[_0xf485('0x29')][_0xf485('0x3a')]);_0x28b5ac[_0xf485('0x3b')]=qs[_0xf485('0x2a')](_['pick'](_0x13fd68[_0xf485('0x29')],_0x1c40a3[_0xf485('0x2a')]));_0x28b5ac[_0xf485('0x3b')][_0xf485('0x3c')]=_0x218936['id'];if(_0x13fd68[_0xf485('0x29')][_0xf485('0x3d')]){_0x28b5ac[_0xf485('0x3b')]=_[_0xf485('0x3e')](_0x28b5ac[_0xf485('0x3b')],{'$or':_[_0xf485('0x1d')](_0x28b5ac[_0xf485('0x2c')],function(_0x4e7a21){var _0x51630a={};_0x51630a[_0x4e7a21]={'$like':'%'+_0x13fd68[_0xf485('0x29')][_0xf485('0x3d')]+'%'};return _0x51630a;})});}if(_0x13fd68[_0xf485('0x29')]['$gte']){var _0xd6a0d4=_0x13fd68[_0xf485('0x29')]['$gte'][_0xf485('0x3f')](',');var _0x4df05a={};_0x4df05a[_0xd6a0d4[0x0]]={'$gte':moment(_0xd6a0d4[0x1])[_0xf485('0x40')]('YYYY-MM-DD\x20HH:mm:ss')};_0x28b5ac[_0xf485('0x3b')]=_[_0xf485('0x3e')](_0x28b5ac['where'],_0x4df05a);}_0x28b5ac=_['merge']({},_0x28b5ac,_0x13fd68[_0xf485('0x41')]);return db[_0xf485('0x39')][_0xf485('0x15')]({'where':_0x28b5ac['where']})[_0xf485('0x18')](function(_0x484264){_0x3c2e02[_0xf485('0x15')]=_0x484264;if(_0x13fd68['query'][_0xf485('0x2f')]){_0x28b5ac[_0xf485('0x30')]=[{'all':!![]}];}return db[_0xf485('0x39')]['findAll'](_0x28b5ac);})[_0xf485('0x18')](function(_0x4833c9){_0x3c2e02['rows']=_0x4833c9;return _0x3c2e02;});}})['then'](respondWithFilteredResult(_0xc6717f,_0x28b5ac))[_0xf485('0x24')](handleError(_0xc6717f,null));};exports[_0xf485('0x42')]=function(_0x36e49d,_0x36bd49){return db[_0xf485('0x1e')][_0xf485('0x31')]({'where':{'id':_0x36e49d[_0xf485('0x34')]['id']}})[_0xf485('0x18')](handleEntityNotFound(_0x36bd49,null))[_0xf485('0x18')](function(_0x29996d){if(_0x29996d){return _0x29996d[_0xf485('0x43')](_0x36e49d['body'][_0xf485('0x44')],_['omit'](_0x36e49d[_0xf485('0x33')],['ids','id'])||{})[_0xf485('0x45')](function(){return db['Tag'][_0xf485('0x21')]({'attributes':['id',_0xf485('0x1b'),_0xf485('0x46')],'where':{'id':_0x36e49d[_0xf485('0x33')][_0xf485('0x44')]}});})[_0xf485('0x18')](function(_0x3aec75){socket['emit']('smsInteractionTags:save',{'id':Number(_0x36e49d['params']['id']),'tags':_0x3aec75||[]});return{'id':Number(_0x36e49d[_0xf485('0x34')]['id']),'tags':_0x3aec75||[]};});}})['then'](respondWithResult(_0x36bd49,null))[_0xf485('0x24')](handleError(_0x36bd49,null));};exports[_0xf485('0x47')]=function(_0x33c7d1,_0x5a2d31){return db[_0xf485('0x1e')][_0xf485('0x31')]({'where':{'id':_0x33c7d1[_0xf485('0x34')]['id']}})[_0xf485('0x18')](handleEntityNotFound(_0x5a2d31,null))[_0xf485('0x18')](function(_0x294271){if(_0x294271){return _0x294271[_0xf485('0x47')](_0x33c7d1[_0xf485('0x29')]['ids']);}})[_0xf485('0x18')](respondWithStatusCode(_0x5a2d31,null))[_0xf485('0x24')](handleError(_0x5a2d31,null));};exports[_0xf485('0x48')]=function(_0x117150,_0x48a60a){var _0xf3bd93=moment()['unix']()[_0xf485('0x49')]();var _0x1a6e76=path['join'](config['root'],_0xf485('0x4a'),_0xf485('0x4b'),'tmp');var _0x1ce23e=path[_0xf485('0x4c')](_0x1a6e76,_0xf3bd93);var _0x3a391b=util[_0xf485('0x40')](_0xf485('0x4d'),_0x117150[_0xf485('0x34')]['id'],_0xf3bd93);var _0x2a5bee=path['join'](_0x1a6e76,_0x3a391b);var _0x1c4f98=[];_0x1c4f98[_0xf485('0x4e')]({'model':db[_0xf485('0x4f')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1c4f98[_0xf485('0x4e')]({'model':db[_0xf485('0x50')],'as':_0xf485('0x51'),'attributes':['id',_0xf485('0x52'),_0xf485('0x53')],'raw':!![]});var _0x37871d=[{'model':db[_0xf485('0x39')],'as':_0xf485('0x54'),'attributes':['id','body',_0xf485('0x55'),_0xf485('0x56'),_0xf485('0x57'),_0xf485('0x58')],'include':_0x1c4f98}];_0x37871d['push']({'model':db[_0xf485('0x59')],'as':_0xf485('0x5a'),'attributes':['id',_0xf485('0x1b')]});_0x37871d['push']({'model':db[_0xf485('0x4f')],'as':_0xf485('0x5b'),'attributes':['id',_0xf485('0x5c')]});return db['SmsInteraction'][_0xf485('0x31')]({'where':{'id':_0x117150[_0xf485('0x34')]['id']},'include':_0x37871d})[_0xf485('0x18')](handleEntityNotFound(_0x48a60a,null))[_0xf485('0x18')](function(_0x527f7e){if(_0x527f7e){var _0x4a2710=_0x527f7e[_0xf485('0x5d')]({'plain':!![]});fs[_0xf485('0x5e')](_0x1ce23e);var _0x15ad49={'channel':_0xf485('0x5f'),'account':_0x4a2710[_0xf485('0x5a')][_0xf485('0x1b')],'agent':_0x4a2710[_0xf485('0x5b')]?_0x4a2710[_0xf485('0x5b')]['fullname']:_0xf485('0x60'),'createdAt':moment(_0x4a2710[_0xf485('0x55')])['format'](_0xf485('0x61'))[_0xf485('0x49')](),'closedAt':_0x4a2710[_0xf485('0x62')]?moment(_0x4a2710[_0xf485('0x63')])['format'](_0xf485('0x61'))[_0xf485('0x49')]():'','disposition':_0x4a2710[_0xf485('0x64')],'messages':_(_0x4a2710[_0xf485('0x54')])[_0xf485('0x3d')]({'secret':![]})['map'](function(_0x864fd1){return{'date':moment(_0x864fd1[_0xf485('0x55')])['format'](_0xf485('0x61'))[_0xf485('0x49')](),'sender':_0x864fd1[_0xf485('0x56')]===_0xf485('0x65')?_0x864fd1['User']?_0x864fd1[_0xf485('0x4f')][_0xf485('0x5c')]:_0xf485('0x66'):_0x864fd1[_0xf485('0x51')]['firstName']+(_0x864fd1[_0xf485('0x51')]['lastName']?'\x20'+_0x864fd1['Contact']['lastName']:''),'body':_0x864fd1['body'],'direction':_0x864fd1['direction']===_0xf485('0x65')?'A':'C','secret':_0x864fd1['secret'],'read':_0x864fd1[_0xf485('0x58')]};})[_0xf485('0x67')]()};return ejs[_0xf485('0x68')](path[_0xf485('0x4c')](config[_0xf485('0x69')],'server',_0xf485('0x6a'),_0xf485('0x6b')),{'interaction':_0x15ad49})[_0xf485('0x18')](function(_0x3fa458){var _0x13790a=path[_0xf485('0x4c')](_0x1ce23e,_0xf485('0x6c')+_0x4a2710['id']+'-'+_0xf3bd93+_0xf485('0x6d'));var _0x2710a2={'path':_0x13790a,'channel':_0xf485('0x5f'),'interactionId':_0x4a2710['id']};return pdf[_0xf485('0x6e')](_0x3fa458,_0x2710a2);})[_0xf485('0x18')](function(){return new BPromise(function(_0x1f275d,_0x1bb8da){zipdir(_0x1ce23e,{'saveTo':_0x2a5bee},function(_0x4c705a,_0x35908b){if(_0x4c705a)return _0x1bb8da(_0x4c705a);return _0x1f275d(_0x35908b);});})[_0xf485('0x18')](function(){return new BPromise(function(_0x298634,_0x1cd7ff){rimraf(_0x1ce23e,function(_0xa969c4){if(_0xa969c4)_0x1cd7ff(_0xa969c4);return _0x298634();});});})[_0xf485('0x18')](function(){return _0x48a60a['download'](_0x2a5bee,_0x3a391b,function(_0x2978d2){if(_0x2978d2){console[_0xf485('0x6f')](_0xf485('0x70'),_0x2978d2);}else{fs['unlinkSync'](_0x2a5bee);}});});});}else{return _0x48a60a[_0xf485('0xe')](0xc8);}})['catch'](handleError(_0x48a60a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a1f7de4..a860715 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 _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x4d30bb,_0x429e29){var _0x252221=function(_0x49789f){while(--_0x49789f){_0x4d30bb['push'](_0x4d30bb['shift']());}};_0x252221(++_0x429e29);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5c206f,_0x2e4f65){_0x5c206f=_0x5c206f-0x0;var _0x3ef9e7=_0xdd4f[_0x5c206f];return _0x3ef9e7;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x2da6=['setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x2da6,0x1dd));var _0x62da=function(_0x4b23f2,_0x544da5){_0x4b23f2=_0x4b23f2-0x0;var _0x18e086=_0x2da6[_0x4b23f2];return _0x18e086;};'use strict';var EventEmitter=require(_0x62da('0x0'));var SmsInteraction=require(_0x62da('0x1'))['db'][_0x62da('0x2')];var SmsMessage=require(_0x62da('0x1'))['db'][_0x62da('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x62da('0x4')](0x0);var events={'afterCreate':_0x62da('0x5'),'afterUpdate':_0x62da('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4a8428){return function(_0xe28204,_0x3163df,_0x3a59f8){_0xe28204[_0x62da('0x7')]({'attributes':['id'],'raw':!![]})[_0x62da('0x8')](function(_0x9d9139){_0xe28204[_0x62da('0x9')](_0x62da('0xa'),_0x9d9139[_0x62da('0xb')](function(_0x4cfc5d){return{'id':_0x4cfc5d['id']};}));return SmsMessage[_0x62da('0xc')]({'where':{'SmsInteractionId':_0xe28204['id'],'direction':'in','read':![]},'raw':!![]});})[_0x62da('0x8')](function(_0x2a3d7c){_0xe28204[_0x62da('0x9')]('unreadMessages',_0x2a3d7c[_0x62da('0xd')]);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428+':'+_0xe28204['id'],_0xe28204);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428,_0xe28204);_0x3a59f8(null);})[_0x62da('0xf')](_0x3a59f8(null));};}for(var e in events){if(events[_0x62da('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x62da('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0d4fd15..238754a 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 _0xc113=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x47201e,_0x4d8da2){var _0x87043=function(_0x2544c0){while(--_0x2544c0){_0x47201e['push'](_0x47201e['shift']());}};_0x87043(++_0x4d8da2);}(_0xc113,0xfe));var _0x3c11=function(_0x143288,_0x238f3e){_0x143288=_0x143288-0x0;var _0x1f3742=_0xc113[_0x143288];return _0x1f3742;};'use strict';var _=require('lodash');var util=require(_0x3c11('0x0'));var logger=require(_0x3c11('0x1'))(_0x3c11('0x2'));var moment=require(_0x3c11('0x3'));var BPromise=require(_0x3c11('0x4'));var rp=require(_0x3c11('0x5'));var fs=require('fs');var path=require(_0x3c11('0x6'));var rimraf=require(_0x3c11('0x7'));var config=require(_0x3c11('0x8'));var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x49aa61,_0x8c43cc){return _0x49aa61[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16cc84,_0x5e2c76,_0x290640){if(_0x16cc84[_0x3c11('0xd')]('closed')){_0x16cc84[_0x3c11('0xe')]=moment()[_0x3c11('0xf')](_0x3c11('0x10'));}_0x290640(null,_0x16cc84);}}});}; \ No newline at end of file +var _0xac4f=['changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','SmsInteraction','sms_interactions'];(function(_0x4ba5d2,_0x287b3b){var _0x31c798=function(_0xf43de){while(--_0xf43de){_0x4ba5d2['push'](_0x4ba5d2['shift']());}};_0x31c798(++_0x287b3b);}(_0xac4f,0x1af));var _0xfac4=function(_0x9fc5a2,_0x46c38f){_0x9fc5a2=_0x9fc5a2-0x0;var _0x10a4a8=_0xac4f[_0x9fc5a2];return _0x10a4a8;};'use strict';var _=require(_0xfac4('0x0'));var util=require(_0xfac4('0x1'));var logger=require(_0xfac4('0x2'))(_0xfac4('0x3'));var moment=require(_0xfac4('0x4'));var BPromise=require(_0xfac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfac4('0x6'));var config=require(_0xfac4('0x7'));var attributes=require('./smsInteraction.attributes');module[_0xfac4('0x8')]=function(_0x42310e,_0x2ae88a){return _0x42310e['define'](_0xfac4('0x9'),attributes,{'tableName':_0xfac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a5dcd,_0xfd39cc,_0x45000e){if(_0x2a5dcd[_0xfac4('0xb')]('closed')){_0x2a5dcd['closedAt']=moment()['format'](_0xfac4('0xc'));}_0x45000e(null,_0x2a5dcd);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f421bfa..296765c 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 _0xb6d3=['info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','limit','then','AddTagsToSmsInteraction','find','addTags','omit','spread','stringify','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x51d651,_0x5657e3){var _0x14e40a=function(_0x30b961){while(--_0x30b961){_0x51d651['push'](_0x51d651['shift']());}};_0x14e40a(++_0x5657e3);}(_0xb6d3,0xe9));var _0x3b6d=function(_0x125e3c,_0x59cbb3){_0x125e3c=_0x125e3c-0x0;var _0x15e625=_0xb6d3[_0x125e3c];return _0x15e625;};'use strict';var _=require(_0x3b6d('0x0'));var util=require('util');var moment=require(_0x3b6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x3b6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b6d('0x4'));var config=require(_0x3b6d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3b6d('0x6')][_0x3b6d('0x7')]({'port':0x232a});config['redis']=_[_0x3b6d('0x8')](config['redis'],{'host':_0x3b6d('0x9'),'port':0x18eb});var socket=require(_0x3b6d('0xa'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x3b6d('0xb')](socket);function respondWithRpcPromise(_0x16a9ab,_0x5f1169,_0x1ca188){return new BPromise(function(_0x38a9de,_0x1f4137){return client[_0x3b6d('0xc')](_0x16a9ab,_0x1ca188)['then'](function(_0x2e5039){logger['info'](_0x3b6d('0xd'),_0x5f1169,_0x3b6d('0xe'));logger[_0x3b6d('0xf')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x5f1169,'request\x20sent',JSON['stringify'](_0x2e5039));if(_0x2e5039[_0x3b6d('0x10')]){if(_0x2e5039[_0x3b6d('0x10')][_0x3b6d('0x11')]===0x1f4){logger['error'](_0x3b6d('0xd'),_0x5f1169,_0x2e5039['error'][_0x3b6d('0x12')]);return _0x1f4137(_0x2e5039['error']['message']);}logger[_0x3b6d('0x10')](_0x3b6d('0xd'),_0x5f1169,_0x2e5039[_0x3b6d('0x10')]['message']);return _0x38a9de(_0x2e5039[_0x3b6d('0x10')][_0x3b6d('0x12')]);}else{logger[_0x3b6d('0x13')](_0x3b6d('0xd'),_0x5f1169,'request\x20sent');_0x38a9de(_0x2e5039[_0x3b6d('0x14')][_0x3b6d('0x12')]);}})[_0x3b6d('0x15')](function(_0x4a1b5a){logger['error'](_0x3b6d('0xd'),_0x5f1169,_0x4a1b5a);_0x1f4137(_0x4a1b5a);});});}exports[_0x3b6d('0x16')]=function(_0x2f96e0){var _0x4c4ec8=this;return new Promise(function(_0x514a2e,_0x5a2013){return db[_0x3b6d('0x17')][_0x3b6d('0x18')](_0x2f96e0[_0x3b6d('0x19')],{'raw':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0[_0x3b6d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0['options'][_0x3b6d('0x1b')]||null:null,'attributes':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0[_0x3b6d('0x1a')]['attributes']||null:null,'limit':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0['options'][_0x3b6d('0x1c')]||null:null})[_0x3b6d('0x1d')](function(_0x10802a){logger[_0x3b6d('0x13')](_0x3b6d('0x16'),_0x2f96e0);logger['debug'](_0x3b6d('0x16'),_0x2f96e0,JSON['stringify'](_0x10802a));_0x514a2e(_0x10802a);})[_0x3b6d('0x15')](function(_0x17be35){logger[_0x3b6d('0x10')](_0x3b6d('0x16'),_0x17be35[_0x3b6d('0x12')],_0x2f96e0);_0x5a2013(_0x4c4ec8['error'](0x1f4,_0x17be35['message']));});});};exports[_0x3b6d('0x1e')]=function(_0x4ceb7d){return new Promise(function(_0x4c2675,_0x1cd3cf){return db[_0x3b6d('0x17')][_0x3b6d('0x1f')]({'where':_0x4ceb7d[_0x3b6d('0x1a')]?_0x4ceb7d['options'][_0x3b6d('0x1b')]||null:null})[_0x3b6d('0x1d')](function(_0x30c117){if(_0x30c117){return _0x30c117[_0x3b6d('0x20')](_0x4ceb7d[_0x3b6d('0x19')]['ids'],_[_0x3b6d('0x21')](_0x4ceb7d[_0x3b6d('0x19')],['ids','id'])||{});}})[_0x3b6d('0x22')](function(_0x502845){logger[_0x3b6d('0x13')]('AddTags',_0x4ceb7d);logger[_0x3b6d('0xf')]('AddTags',_0x4ceb7d,JSON[_0x3b6d('0x23')](_0x502845));_0x4c2675(_0x502845);})['catch'](function(_0x423422){logger[_0x3b6d('0x10')]('AddTags',_0x423422[_0x3b6d('0x12')],_0x4ceb7d);_0x1cd3cf(_this['error'](0x1f4,_0x423422[_0x3b6d('0x12')]));});});}; \ No newline at end of file +var _0x6f5e=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','SmsInteraction','body','options','raw','where','attributes','limit','UpdateSmsInteraction','stringify','find','addTags','ids','omit','spread','AddTags','moment','../../mysqldb','../../config/utils'];(function(_0xea81ab,_0x23eb5e){var _0xb98237=function(_0x132024){while(--_0x132024){_0xea81ab['push'](_0xea81ab['shift']());}};_0xb98237(++_0x23eb5e);}(_0x6f5e,0xdb));var _0xe6f5=function(_0x1a381e,_0x3030ab){_0x1a381e=_0x1a381e-0x0;var _0x4d0482=_0x6f5e[_0x1a381e];return _0x4d0482;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe6f5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6f5('0x1'))['db'];var utils=require(_0xe6f5('0x2'));var logger=require('../../config/logger')(_0xe6f5('0x3'));var config=require(_0xe6f5('0x4'));var jayson=require(_0xe6f5('0x5'));var client=jayson[_0xe6f5('0x6')][_0xe6f5('0x7')]({'port':0x232a});config[_0xe6f5('0x8')]=_['defaults'](config['redis'],{'host':_0xe6f5('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6f5('0x8')]));require(_0xe6f5('0xa'))[_0xe6f5('0xb')](socket);function respondWithRpcPromise(_0x5b3859,_0x24be21,_0x25db1e){return new BPromise(function(_0x58e2f8,_0x38518d){return client['request'](_0x5b3859,_0x25db1e)[_0xe6f5('0xc')](function(_0x15be6f){logger[_0xe6f5('0xd')](_0xe6f5('0xe'),_0x24be21,_0xe6f5('0xf'));logger[_0xe6f5('0x10')](_0xe6f5('0x11'),_0x24be21,_0xe6f5('0xf'),JSON['stringify'](_0x15be6f));if(_0x15be6f[_0xe6f5('0x12')]){if(_0x15be6f[_0xe6f5('0x12')]['code']===0x1f4){logger[_0xe6f5('0x12')](_0xe6f5('0xe'),_0x24be21,_0x15be6f[_0xe6f5('0x12')][_0xe6f5('0x13')]);return _0x38518d(_0x15be6f[_0xe6f5('0x12')][_0xe6f5('0x13')]);}logger[_0xe6f5('0x12')](_0xe6f5('0xe'),_0x24be21,_0x15be6f[_0xe6f5('0x12')]['message']);return _0x58e2f8(_0x15be6f[_0xe6f5('0x12')][_0xe6f5('0x13')]);}else{logger[_0xe6f5('0xd')](_0xe6f5('0xe'),_0x24be21,_0xe6f5('0xf'));_0x58e2f8(_0x15be6f[_0xe6f5('0x14')]['message']);}})[_0xe6f5('0x15')](function(_0x1d43aa){logger[_0xe6f5('0x12')](_0xe6f5('0xe'),_0x24be21,_0x1d43aa);_0x38518d(_0x1d43aa);});});}exports['UpdateSmsInteraction']=function(_0x2831d3){var _0x46710d=this;return new Promise(function(_0x2e98bf,_0x4e97d3){return db[_0xe6f5('0x16')]['update'](_0x2831d3[_0xe6f5('0x17')],{'raw':_0x2831d3[_0xe6f5('0x18')]?_0x2831d3[_0xe6f5('0x18')][_0xe6f5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2831d3['options']?_0x2831d3[_0xe6f5('0x18')][_0xe6f5('0x1a')]||null:null,'attributes':_0x2831d3[_0xe6f5('0x18')]?_0x2831d3['options'][_0xe6f5('0x1b')]||null:null,'limit':_0x2831d3[_0xe6f5('0x18')]?_0x2831d3[_0xe6f5('0x18')][_0xe6f5('0x1c')]||null:null})[_0xe6f5('0xc')](function(_0x366b0c){logger[_0xe6f5('0xd')]('UpdateSmsInteraction',_0x2831d3);logger[_0xe6f5('0x10')](_0xe6f5('0x1d'),_0x2831d3,JSON[_0xe6f5('0x1e')](_0x366b0c));_0x2e98bf(_0x366b0c);})[_0xe6f5('0x15')](function(_0x23dc7f){logger[_0xe6f5('0x12')]('UpdateSmsInteraction',_0x23dc7f[_0xe6f5('0x13')],_0x2831d3);_0x4e97d3(_0x46710d[_0xe6f5('0x12')](0x1f4,_0x23dc7f[_0xe6f5('0x13')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2b3754){return new Promise(function(_0x3000c9,_0xe306ad){return db[_0xe6f5('0x16')][_0xe6f5('0x1f')]({'where':_0x2b3754['options']?_0x2b3754['options'][_0xe6f5('0x1a')]||null:null})[_0xe6f5('0xc')](function(_0x2b62af){if(_0x2b62af){return _0x2b62af[_0xe6f5('0x20')](_0x2b3754[_0xe6f5('0x17')][_0xe6f5('0x21')],_[_0xe6f5('0x22')](_0x2b3754[_0xe6f5('0x17')],[_0xe6f5('0x21'),'id'])||{});}})[_0xe6f5('0x23')](function(_0x33112f){logger[_0xe6f5('0xd')](_0xe6f5('0x24'),_0x2b3754);logger[_0xe6f5('0x10')](_0xe6f5('0x24'),_0x2b3754,JSON['stringify'](_0x33112f));_0x3000c9(_0x33112f);})['catch'](function(_0x4d0474){logger[_0xe6f5('0x12')]('AddTags',_0x4d0474[_0xe6f5('0x13')],_0x2b3754);_0xe306ad(_this[_0xe6f5('0x12')](0x1f4,_0x4d0474[_0xe6f5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8e4d181..3b8e974 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 _0x1e03=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x1ae802,_0x75149d){var _0x15404e=function(_0x3d6b8b){while(--_0x3d6b8b){_0x1ae802['push'](_0x1ae802['shift']());}};_0x15404e(++_0x75149d);}(_0x1e03,0x1bd));var _0x31e0=function(_0x26a844,_0x18c9bc){_0x26a844=_0x26a844-0x0;var _0x19b920=_0x1e03[_0x26a844];return _0x19b920;};'use strict';var SmsInteractionEvents=require(_0x31e0('0x0'));var events=['save',_0x31e0('0x1'),_0x31e0('0x2')];function createListener(_0x3d3e58,_0x1c23ad){return function(_0x2a6dc8){_0x1c23ad[_0x31e0('0x3')](_0x3d3e58,_0x2a6dc8);};}function removeListener(_0x1ed893,_0x3c23de){return function(){SmsInteractionEvents[_0x31e0('0x4')](_0x1ed893,_0x3c23de);};}exports[_0x31e0('0x5')]=function(_0x43fc2f){for(var _0x2a750a=0x0,_0x53f315=events['length'];_0x2a750a<_0x53f315;_0x2a750a++){var _0x3fa110=events[_0x2a750a];var _0x5cab3c=createListener(_0x31e0('0x6')+_0x3fa110,_0x43fc2f);SmsInteractionEvents['on'](_0x3fa110,_0x5cab3c);}}; \ No newline at end of file +var _0x0038=['removeListener','length','smsInteraction:','remove','update','emit'];(function(_0x208b84,_0x52b478){var _0x1a3752=function(_0x43b03f){while(--_0x43b03f){_0x208b84['push'](_0x208b84['shift']());}};_0x1a3752(++_0x52b478);}(_0x0038,0x195));var _0x8003=function(_0x3769a1,_0x1511f1){_0x3769a1=_0x3769a1-0x0;var _0xa4c3e1=_0x0038[_0x3769a1];return _0xa4c3e1;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x8003('0x0'),_0x8003('0x1')];function createListener(_0x225974,_0x3c27cd){return function(_0x40ae0c){_0x3c27cd[_0x8003('0x2')](_0x225974,_0x40ae0c);};}function removeListener(_0x158542,_0xcf52cd){return function(){SmsInteractionEvents[_0x8003('0x3')](_0x158542,_0xcf52cd);};}exports['register']=function(_0x50295f){for(var _0x51d3e6=0x0,_0x1467a0=events[_0x8003('0x4')];_0x51d3e6<_0x1467a0;_0x51d3e6++){var _0x23aa4d=events[_0x51d3e6];var _0x64f9d8=createListener(_0x8003('0x5')+_0x23aa4d,_0x50295f);SmsInteractionEvents['on'](_0x23aa4d,_0x64f9d8);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 85f02cf..6cb7f9a 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 _0x6c1c=['/:id/reject','reject','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','/describe','/:id','isAuthenticated','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id/accept'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c1c,0x124));var _0xc6c1=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x6c1c[_0x1ac6e5];return _0x5877dc;};'use strict';var multer=require(_0xc6c1('0x0'));var util=require(_0xc6c1('0x1'));var path=require('path');var timeout=require(_0xc6c1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc6c1('0x3'));var auth=require(_0xc6c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6c1('0x5'));var controller=require(_0xc6c1('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc6c1('0x7')](_0xc6c1('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc6c1('0x9'),auth[_0xc6c1('0xa')](),controller[_0xc6c1('0xb')]);router[_0xc6c1('0xc')]('/',auth['isAuthenticated'](),interaction[_0xc6c1('0xd')](_0xc6c1('0xe'),_0xc6c1('0xf')),controller['create']);router['post'](_0xc6c1('0x10'),controller[_0xc6c1('0x11')]);router[_0xc6c1('0x12')]('/:id',auth[_0xc6c1('0xa')](),controller['update']);router[_0xc6c1('0x12')](_0xc6c1('0x13'),auth[_0xc6c1('0xa')](),controller['accept']);router[_0xc6c1('0x12')](_0xc6c1('0x14'),auth[_0xc6c1('0xa')](),controller[_0xc6c1('0x15')]);router['delete']('/:id',auth[_0xc6c1('0xa')](),controller[_0xc6c1('0x16')]);module[_0xc6c1('0x17')]=router; \ No newline at end of file +var _0xd1d9=['isAuthenticated','index','describe','/:id','show','post','sms','smsmessage:create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get'];(function(_0x57f8b7,_0x56ce05){var _0xdb4f29=function(_0x54e6ec){while(--_0x54e6ec){_0x57f8b7['push'](_0x57f8b7['shift']());}};_0xdb4f29(++_0x56ce05);}(_0xd1d9,0x13b));var _0x9d1d=function(_0x9d0c24,_0x49ce7c){_0x9d0c24=_0x9d0c24-0x0;var _0xbdd05=_0xd1d9[_0x9d0c24];return _0xbdd05;};'use strict';var multer=require(_0x9d1d('0x0'));var util=require(_0x9d1d('0x1'));var path=require(_0x9d1d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d1d('0x3'));var router=express[_0x9d1d('0x4')]();var fs_extra=require(_0x9d1d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9d1d('0x6'));var config=require('../../config/environment');var controller=require(_0x9d1d('0x7'));router[_0x9d1d('0x8')]('/',auth[_0x9d1d('0x9')](),controller[_0x9d1d('0xa')]);router['get']('/describe',auth[_0x9d1d('0x9')](),controller[_0x9d1d('0xb')]);router[_0x9d1d('0x8')](_0x9d1d('0xc'),auth[_0x9d1d('0x9')](),controller[_0x9d1d('0xd')]);router[_0x9d1d('0xe')]('/',auth[_0x9d1d('0x9')](),interaction['tracked'](_0x9d1d('0xf'),_0x9d1d('0x10')),controller['create']);router[_0x9d1d('0xe')](_0x9d1d('0x11'),controller[_0x9d1d('0x12')]);router[_0x9d1d('0x13')](_0x9d1d('0xc'),auth['isAuthenticated'](),controller[_0x9d1d('0x14')]);router[_0x9d1d('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x9d1d('0x15')]);router[_0x9d1d('0x13')](_0x9d1d('0x16'),auth[_0x9d1d('0x9')](),controller[_0x9d1d('0x17')]);router[_0x9d1d('0x18')](_0x9d1d('0xc'),auth[_0x9d1d('0x9')](),controller[_0x9d1d('0x19')]);module[_0x9d1d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1bba990..0e6fe36 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 _0x8bc3=['ENUM','out','STRING','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x8bc3,0x82));var _0x38bc=function(_0x350034,_0x341770){_0x350034=_0x350034-0x0;var _0x303eb4=_0x8bc3[_0x350034];return _0x303eb4;};'use strict';var Sequelize=require(_0x38bc('0x0'));module['exports']={'body':{'type':Sequelize[_0x38bc('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x38bc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x38bc('0x3')]('in','out'),'defaultValue':_0x38bc('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x38bc('0x5')](0xbe)},'phone':{'type':Sequelize[_0x38bc('0x5')]},'readAt':{'type':Sequelize[_0x38bc('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x38bc('0x5')]},'providerResponse':{'type':Sequelize[_0x38bc('0x1')]}}; \ No newline at end of file +var _0xbfb8=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x43fd3d,_0x4b7295){var _0x1388e7=function(_0x1114ee){while(--_0x1114ee){_0x43fd3d['push'](_0x43fd3d['shift']());}};_0x1388e7(++_0x4b7295);}(_0xbfb8,0x194));var _0x8bfb=function(_0x4c3168,_0x415f2d){_0x4c3168=_0x4c3168-0x0;var _0x4b7189=_0xbfb8[_0x4c3168];return _0x4b7189;};'use strict';var Sequelize=require(_0x8bfb('0x0'));module[_0x8bfb('0x1')]={'body':{'type':Sequelize[_0x8bfb('0x2')](_0x8bfb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8bfb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8bfb('0x5')]('in','out'),'defaultValue':_0x8bfb('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8bfb('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x8bfb('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e8e1e36..1ac3510 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 _0xfd41=['filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','body','params','destroy','describe','accept','sms','acceptMessage','reject','UserId','user','agent','get','SmsInteraction','SmsInteractionId','interaction','role','null','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','SIP/%s','channel','motionChannel','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','../../config/logger','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','update','end','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x335e68,_0x271f8c){var _0x2cecbc=function(_0x21c0c4){while(--_0x21c0c4){_0x335e68['push'](_0x335e68['shift']());}};_0x2cecbc(++_0x271f8c);}(_0xfd41,0xb6));var _0x1fd4=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfd41[_0x12fc8d];return _0x3f9d04;};'use strict';var util=require(_0x1fd4('0x0'));var _=require(_0x1fd4('0x1'));var Redis=require(_0x1fd4('0x2'));var interactionService=require(_0x1fd4('0x3'));var qs=require(_0x1fd4('0x4'));var logger=require('../../config/logger')(_0x1fd4('0x5'));var config=require('../../config/environment');var db=require(_0x1fd4('0x6'))['db'];config[_0x1fd4('0x7')]=_['defaults'](config[_0x1fd4('0x7')],{'host':_0x1fd4('0x8'),'port':0x18eb});var socket=require(_0x1fd4('0x9'))(new Redis(config[_0x1fd4('0x7')]));require(_0x1fd4('0xa'))[_0x1fd4('0xb')](socket);var jayson=require(_0x1fd4('0xc'));var client=jayson[_0x1fd4('0xd')][_0x1fd4('0xe')]({'port':0x232c});var client9002=jayson[_0x1fd4('0xd')][_0x1fd4('0xe')]({'port':0x232a});var interaction_log=require(_0x1fd4('0xf'))(_0x1fd4('0x10'));function respondWithRpcPromise(_0x484f4f,_0x1860c5,_0x23b37a,_0x448435){return new Promise(function(_0x4b6f42,_0x155d3d){var _0x1adc90=_0x448435||client;return _0x1adc90[_0x1fd4('0x11')](_0x484f4f,_0x23b37a)[_0x1fd4('0x12')](function(_0x2b8bca){logger[_0x1fd4('0x13')](_0x1fd4('0x14'),_0x1860c5,'request\x20sent');logger['debug'](_0x1fd4('0x15'),_0x1860c5,_0x1fd4('0x16'),JSON[_0x1fd4('0x17')](_0x2b8bca));if(_0x2b8bca[_0x1fd4('0x18')]){if(_0x2b8bca[_0x1fd4('0x18')]['code']===0x1f4){logger[_0x1fd4('0x18')](_0x1fd4('0x14'),_0x1860c5,_0x2b8bca[_0x1fd4('0x18')][_0x1fd4('0x19')]);return _0x155d3d(_0x2b8bca['error'][_0x1fd4('0x19')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1860c5,_0x2b8bca[_0x1fd4('0x18')][_0x1fd4('0x19')]);return _0x4b6f42(_0x2b8bca[_0x1fd4('0x18')]['message']);}else{logger[_0x1fd4('0x13')]('SmsMessage,\x20%s,\x20%s',_0x1860c5,'request\x20sent');_0x4b6f42(_0x2b8bca[_0x1fd4('0x1a')]['message']);}})[_0x1fd4('0x1b')](function(_0x177d46){logger[_0x1fd4('0x18')]('SmsMessage,\x20%s,\x20%s',_0x1860c5,_0x177d46);_0x155d3d(_0x177d46);});});}function respondWithResult(_0x51a392,_0x124446){_0x124446=_0x124446||0xc8;return function(_0x5e4f1d){if(_0x5e4f1d){return _0x51a392[_0x1fd4('0x1c')](_0x124446)[_0x1fd4('0x1d')](_0x5e4f1d);}};}function respondWithFilteredResult(_0x4b5bc3,_0x423f32){return function(_0x9dbd9){if(_0x9dbd9){var _0x2dbc9e=typeof _0x423f32[_0x1fd4('0x1e')]===_0x1fd4('0x1f')&&typeof _0x423f32[_0x1fd4('0x20')]===_0x1fd4('0x1f');var _0x3f2e95=_0x9dbd9['count'];var _0xcfd965=_0x2dbc9e?0x0:_0x423f32[_0x1fd4('0x1e')];var _0x556c05=_0x2dbc9e?_0x9dbd9[_0x1fd4('0x21')]:_0x423f32[_0x1fd4('0x1e')]+_0x423f32[_0x1fd4('0x20')];var _0x49aeb5;if(_0x556c05>=_0x3f2e95){_0x556c05=_0x3f2e95;_0x49aeb5=0xc8;}else{_0x49aeb5=0xce;}_0x4b5bc3[_0x1fd4('0x1c')](_0x49aeb5);return _0x4b5bc3[_0x1fd4('0x22')]('Content-Range',_0xcfd965+'-'+_0x556c05+'/'+_0x3f2e95)[_0x1fd4('0x1d')](_0x9dbd9);}return null;};}function saveUpdates(_0x3353af){return function(_0x1d2a0c){if(_0x1d2a0c){return _0x1d2a0c[_0x1fd4('0x23')](_0x3353af)[_0x1fd4('0x12')](function(_0x45bcb4){return _0x45bcb4;});}return null;};}function removeEntity(_0x15dfb8){return function(_0x5ded6c){if(_0x5ded6c){return _0x5ded6c['destroy']()['then'](function(){_0x15dfb8[_0x1fd4('0x1c')](0xcc)[_0x1fd4('0x24')]();});}};}function handleEntityNotFound(_0x2e79ec){return function(_0x1f2b9b){if(!_0x1f2b9b){_0x2e79ec[_0x1fd4('0x25')](0x194);}return _0x1f2b9b;};}function handleError(_0x5ceba8,_0x346977){_0x346977=_0x346977||0x1f4;return function(_0x1e5bda){logger[_0x1fd4('0x18')](_0x1e5bda[_0x1fd4('0x26')]);if(_0x1e5bda[_0x1fd4('0x27')]){delete _0x1e5bda[_0x1fd4('0x27')];}_0x5ceba8[_0x1fd4('0x1c')](_0x346977)[_0x1fd4('0x28')](_0x1e5bda);};}exports[_0x1fd4('0x29')]=function(_0x29864e,_0x55aaa5){var _0x5925f3={},_0x808f48={},_0x2c007e={'count':0x0,'rows':[]};var _0x2f8fb6=_[_0x1fd4('0x2a')](db[_0x1fd4('0x2b')][_0x1fd4('0x2c')],function(_0x29e141){return{'name':_0x29e141[_0x1fd4('0x2d')],'type':_0x29e141[_0x1fd4('0x2e')][_0x1fd4('0x2f')]};});_0x808f48[_0x1fd4('0x30')]=_[_0x1fd4('0x2a')](_0x2f8fb6,'name');_0x808f48[_0x1fd4('0x31')]=_[_0x1fd4('0x32')](_0x29864e[_0x1fd4('0x31')]);_0x808f48[_0x1fd4('0x33')]=_['intersection'](_0x808f48[_0x1fd4('0x30')],_0x808f48[_0x1fd4('0x31')]);_0x5925f3[_0x1fd4('0x34')]=_[_0x1fd4('0x35')](_0x808f48[_0x1fd4('0x30')],qs[_0x1fd4('0x36')](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x36')]));_0x5925f3[_0x1fd4('0x34')]=_0x5925f3[_0x1fd4('0x34')]['length']?_0x5925f3[_0x1fd4('0x34')]:_0x808f48[_0x1fd4('0x30')];if(!_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x37')]('nolimit')){_0x5925f3['limit']=qs[_0x1fd4('0x20')](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x20')]);_0x5925f3[_0x1fd4('0x1e')]=qs['offset'](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x1e')]);}_0x5925f3[_0x1fd4('0x38')]=qs[_0x1fd4('0x39')](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x39')]);_0x5925f3[_0x1fd4('0x3a')]=qs[_0x1fd4('0x33')](_[_0x1fd4('0x3b')](_0x29864e['query'],_0x808f48[_0x1fd4('0x33')]),_0x2f8fb6);if(_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x3c')]){_0x5925f3[_0x1fd4('0x3a')]=_[_0x1fd4('0x3d')](_0x5925f3[_0x1fd4('0x3a')],{'$or':_[_0x1fd4('0x2a')](_0x2f8fb6,function(_0x605cd8){if(_0x605cd8[_0x1fd4('0x2e')]!==_0x1fd4('0x3e')){var _0x3d0dff={};_0x3d0dff[_0x605cd8[_0x1fd4('0x27')]]={'$like':'%'+_0x29864e['query'][_0x1fd4('0x3c')]+'%'};return _0x3d0dff;}})});}_0x5925f3=_[_0x1fd4('0x3d')]({},_0x5925f3,_0x29864e[_0x1fd4('0x3f')]);var _0x4ad9d6={'where':_0x5925f3[_0x1fd4('0x3a')]};return db[_0x1fd4('0x2b')][_0x1fd4('0x21')](_0x4ad9d6)[_0x1fd4('0x12')](function(_0x439fc8){_0x2c007e['count']=_0x439fc8;if(_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x40')]){_0x5925f3[_0x1fd4('0x41')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5925f3);})[_0x1fd4('0x12')](function(_0x1493b5){_0x2c007e[_0x1fd4('0x42')]=_0x1493b5;return _0x2c007e;})['then'](respondWithFilteredResult(_0x55aaa5,_0x5925f3))[_0x1fd4('0x1b')](handleError(_0x55aaa5,null));};exports[_0x1fd4('0x43')]=function(_0x5719bd,_0x56f843){var _0x18af7e={'raw':!![],'where':{'id':_0x5719bd['params']['id']}},_0xe54fb={};_0xe54fb['model']=_[_0x1fd4('0x32')](db[_0x1fd4('0x2b')][_0x1fd4('0x2c')]);_0xe54fb[_0x1fd4('0x31')]=_[_0x1fd4('0x32')](_0x5719bd['query']);_0xe54fb[_0x1fd4('0x33')]=_[_0x1fd4('0x35')](_0xe54fb[_0x1fd4('0x30')],_0xe54fb[_0x1fd4('0x31')]);_0x18af7e[_0x1fd4('0x34')]=_['intersection'](_0xe54fb[_0x1fd4('0x30')],qs[_0x1fd4('0x36')](_0x5719bd[_0x1fd4('0x31')][_0x1fd4('0x36')]));_0x18af7e[_0x1fd4('0x34')]=_0x18af7e[_0x1fd4('0x34')]['length']?_0x18af7e['attributes']:_0xe54fb[_0x1fd4('0x30')];if(_0x5719bd[_0x1fd4('0x31')][_0x1fd4('0x40')]){_0x18af7e[_0x1fd4('0x41')]=[{'all':!![]}];}_0x18af7e=_[_0x1fd4('0x3d')]({},_0x18af7e,_0x5719bd[_0x1fd4('0x3f')]);return db[_0x1fd4('0x2b')][_0x1fd4('0x44')](_0x18af7e)[_0x1fd4('0x12')](handleEntityNotFound(_0x56f843,null))[_0x1fd4('0x12')](respondWithResult(_0x56f843,null))[_0x1fd4('0x1b')](handleError(_0x56f843,null));};exports[_0x1fd4('0x45')]=function(_0x1cf7a2,_0x3a5799){return db[_0x1fd4('0x2b')][_0x1fd4('0x45')](_0x1cf7a2[_0x1fd4('0x46')],{})[_0x1fd4('0x12')](respondWithResult(_0x3a5799,0xc9))[_0x1fd4('0x1b')](handleError(_0x3a5799,null));};exports[_0x1fd4('0x23')]=function(_0x5258e5,_0x348fb6){if(_0x5258e5['body']['id']){delete _0x5258e5[_0x1fd4('0x46')]['id'];}return db[_0x1fd4('0x2b')][_0x1fd4('0x44')]({'where':{'id':_0x5258e5[_0x1fd4('0x47')]['id']}})[_0x1fd4('0x12')](handleEntityNotFound(_0x348fb6,null))['then'](saveUpdates(_0x5258e5[_0x1fd4('0x46')],null))['then'](respondWithResult(_0x348fb6,null))[_0x1fd4('0x1b')](handleError(_0x348fb6,null));};exports[_0x1fd4('0x48')]=function(_0x4ab7cd,_0x3e3dfc){return db['SmsMessage'][_0x1fd4('0x44')]({'where':{'id':_0x4ab7cd[_0x1fd4('0x47')]['id']}})[_0x1fd4('0x12')](handleEntityNotFound(_0x3e3dfc,null))['then'](removeEntity(_0x3e3dfc,null))[_0x1fd4('0x1b')](handleError(_0x3e3dfc,null));};exports[_0x1fd4('0x49')]=function(_0x40b244,_0x152ee9){return db[_0x1fd4('0x2b')][_0x1fd4('0x49')]()[_0x1fd4('0x12')](respondWithResult(_0x152ee9,null))[_0x1fd4('0x1b')](handleError(_0x152ee9,null));};exports[_0x1fd4('0x4a')]=function(_0x248b32,_0x401e54){var _0x1b29bd=_0x1fd4('0x4b');return interactionService[_0x1fd4('0x4c')](_0x248b32,_0x1b29bd)[_0x1fd4('0x12')](respondWithResult(_0x401e54,null))['catch'](handleError(_0x401e54,null));};exports[_0x1fd4('0x4d')]=function(_0x57783b,_0xc85bb0){var _0x346e26={'agent':{},'channel':_0x1fd4('0x4b')};if(_0x57783b[_0x1fd4('0x46')]['id']){delete _0x57783b[_0x1fd4('0x46')]['id'];}_0x57783b[_0x1fd4('0x46')][_0x1fd4('0x4e')]=_0x57783b['body'][_0x1fd4('0x4e')]||_0x57783b[_0x1fd4('0x4f')]['id'];_0x346e26[_0x1fd4('0x50')]['id']=_0x57783b[_0x1fd4('0x46')][_0x1fd4('0x4e')];return db[_0x1fd4('0x2b')][_0x1fd4('0x44')]({'where':{'id':_0x57783b[_0x1fd4('0x47')]['id'],'UserId':null}})[_0x1fd4('0x12')](handleEntityNotFound(_0xc85bb0,null))['then'](function(_0x36e5c2){if(_0x36e5c2){_0x346e26[_0x1fd4('0x19')]=_0x36e5c2[_0x1fd4('0x51')]({'plain':!![]});return db[_0x1fd4('0x52')][_0x1fd4('0x44')]({'where':{'id':_0x36e5c2[_0x1fd4('0x53')]}});}return null;})['then'](handleEntityNotFound(_0xc85bb0,null))['then'](function(_0x3fff61){if(_0x3fff61){_0x346e26[_0x1fd4('0x54')]=_0x3fff61[_0x1fd4('0x51')]({'plain':!![]});interaction_log[_0x1fd4('0x13')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57783b['user']['id'],_0x57783b[_0x1fd4('0x4f')][_0x1fd4('0x27')],_0x57783b[_0x1fd4('0x4f')][_0x1fd4('0x55')],_0x346e26['interaction']['id'],_0x57783b['body']?JSON['stringify'](_0x57783b[_0x1fd4('0x46')]):_0x1fd4('0x56'));return respondWithRpcPromise(_0x1fd4('0x57'),_0x1fd4('0x58'),_0x346e26);}return null;})['then'](function(_0x160f58){var _0x56ddfb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x160f58[_0x1fd4('0x19')]['ContactId'];return db['sequelize'][_0x1fd4('0x31')](_0x56ddfb,{'type':db[_0x1fd4('0x59')][_0x1fd4('0x5a')][_0x1fd4('0x5b')],'raw':!![]})[_0x1fd4('0x12')](function(_0x53e19b){return _0x53e19b;});})['then'](function(_0x35c75b){if(_0x35c75b){_0x346e26['message']['contact']=_0x35c75b[0x0];if(!_0x57783b['body'][_0x1fd4('0x4e')])return;return db[_0x1fd4('0x5c')][_0x1fd4('0x44')]({'where':{'id':_0x57783b[_0x1fd4('0x46')][_0x1fd4('0x4e')],'role':_0x1fd4('0x50')},'attributes':['id',_0x1fd4('0x27'),_0x1fd4('0x5d'),_0x1fd4('0x5e'),_0x1fd4('0x5f')],'raw':!![]});}return null;})[_0x1fd4('0x12')](function(_0x273bd5){if(!_0x273bd5)return null;_0x346e26[_0x1fd4('0x19')]['agent']=_0x273bd5;return _0x346e26;})[_0x1fd4('0x12')](function(_0x40e405){if(_0x40e405){_0x40e405[_0x1fd4('0x19')]['interface']=util['format'](_0x1fd4('0x60'),_0x57783b['user']['name']);_0x40e405[_0x1fd4('0x19')][_0x1fd4('0x61')]=_0x346e26['channel'];_0x40e405[_0x1fd4('0x19')][_0x1fd4('0x62')]=_0x346e26[_0x1fd4('0x61')];_0x40e405[_0x1fd4('0x19')]['event']=_0x1fd4('0x4d');respondWithRpcPromise(_0x1fd4('0x63'),_0x1fd4('0x63'),{'event':_0x1fd4('0x64'),'message':_0x40e405[_0x1fd4('0x19')]},client9002);return _0x346e26;}return null;})[_0x1fd4('0x12')](respondWithResult(_0xc85bb0,null))[_0x1fd4('0x1b')](handleError(_0xc85bb0,null));};exports[_0x1fd4('0x1c')]=function(_0x38fde6,_0x34679a){if(_0x38fde6[_0x1fd4('0x46')]['id']){delete _0x38fde6[_0x1fd4('0x46')]['id'];}var _0x133bed;return db[_0x1fd4('0x2b')][_0x1fd4('0x44')]({'where':{'id':_0x38fde6[_0x1fd4('0x47')]['id']}})[_0x1fd4('0x12')](handleEntityNotFound(_0x34679a,null))['then'](function(_0x232574){if(_0x232574){_0x133bed=_0x232574;return db[_0x1fd4('0x65')]['find']({'where':{'id':_0x232574[_0x1fd4('0x66')]}});}})[_0x1fd4('0x12')](handleEntityNotFound(_0x34679a,null))[_0x1fd4('0x12')](function(_0x42b85f){if(_0x42b85f){logger[_0x1fd4('0x67')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1fd4('0x1c'),_0x1fd4('0x68'),_0x42b85f[_0x1fd4('0x2e')],util['inspect'](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));switch(_0x42b85f[_0x1fd4('0x2e')]){case _0x1fd4('0x69'):if(_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x6a')]&&_0x38fde6[_0x1fd4('0x46')]['MessageSid']===_0x133bed[_0x1fd4('0x6b')]){return _0x133bed['update']({'read':!![]});}else{logger[_0x1fd4('0x18')](_0x1fd4('0x6c'),_0x1fd4('0x1c'),'twilio',util[_0x1fd4('0x6d')](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));}break;case _0x1fd4('0x6e'):if(_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x6f')]&&_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x6f')]===_0x133bed['messageId']&&_[_0x1fd4('0x70')]([_0x1fd4('0x71'),_0x1fd4('0x72')],_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x73')])>=0x0){return _0x133bed[_0x1fd4('0x23')]({'read':!![]});}else{logger[_0x1fd4('0x18')](_0x1fd4('0x6c'),_0x1fd4('0x1c'),_0x1fd4('0x74'),util[_0x1fd4('0x6d')](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe38d59=_0x38fde6['body'][_0x1fd4('0x75')][0x0];if(_0xe38d59[_0x1fd4('0x1c')][_0x1fd4('0x76')]===_0x1fd4('0x77')){return _0x133bed[_0x1fd4('0x23')]({'read':!![]});}else{logger[_0x1fd4('0x18')](_0x1fd4('0x6c'),'status',_0x1fd4('0x78'),util[_0x1fd4('0x6d')](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));}break;}return _0x133bed;}})['then'](respondWithResult(_0x34679a,null))[_0x1fd4('0x1b')](handleError(_0x34679a,null));}; \ No newline at end of file +var _0x2f1a=['plivo','indexOf','delivered','Status','infobip','results','DELIVERED','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./smsMessage.socket','register','jayson/promise','client','http','../../config/logger','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','offset','undefined','count','set','Content-Range','json','update','destroy','status','end','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','length','include','find','create','body','describe','accept','sms','reject','UserId','user','agent','get','SmsInteractionId','interaction','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','interface','SIP/%s','channel','motionChannel','EventManager','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x412362,_0x63b9ee){var _0x3347f1=function(_0x3c9e88){while(--_0x3c9e88){_0x412362['push'](_0x412362['shift']());}};_0x3347f1(++_0x63b9ee);}(_0x2f1a,0xef));var _0xa2f1=function(_0x5a608a,_0x22faf3){_0x5a608a=_0x5a608a-0x0;var _0x3062c9=_0x2f1a[_0x5a608a];return _0x3062c9;};'use strict';var util=require(_0xa2f1('0x0'));var _=require(_0xa2f1('0x1'));var Redis=require(_0xa2f1('0x2'));var interactionService=require(_0xa2f1('0x3'));var qs=require(_0xa2f1('0x4'));var logger=require('../../config/logger')(_0xa2f1('0x5'));var config=require(_0xa2f1('0x6'));var db=require(_0xa2f1('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa2f1('0x8'),'port':0x18eb});var socket=require(_0xa2f1('0x9'))(new Redis(config[_0xa2f1('0xa')]));require(_0xa2f1('0xb'))[_0xa2f1('0xc')](socket);var jayson=require(_0xa2f1('0xd'));var client=jayson[_0xa2f1('0xe')][_0xa2f1('0xf')]({'port':0x232c});var client9002=jayson[_0xa2f1('0xe')][_0xa2f1('0xf')]({'port':0x232a});var interaction_log=require(_0xa2f1('0x10'))(_0xa2f1('0x11'));function respondWithRpcPromise(_0x3dac4d,_0x64b5a4,_0x3df11f,_0x4ccf7d){return new Promise(function(_0x3131b4,_0xbba003){var _0x45683d=_0x4ccf7d||client;return _0x45683d[_0xa2f1('0x12')](_0x3dac4d,_0x3df11f)[_0xa2f1('0x13')](function(_0xedc786){logger[_0xa2f1('0x14')](_0xa2f1('0x15'),_0x64b5a4,_0xa2f1('0x16'));logger[_0xa2f1('0x17')](_0xa2f1('0x18'),_0x64b5a4,_0xa2f1('0x16'),JSON[_0xa2f1('0x19')](_0xedc786));if(_0xedc786['error']){if(_0xedc786[_0xa2f1('0x1a')]['code']===0x1f4){logger['error'](_0xa2f1('0x15'),_0x64b5a4,_0xedc786[_0xa2f1('0x1a')][_0xa2f1('0x1b')]);return _0xbba003(_0xedc786[_0xa2f1('0x1a')][_0xa2f1('0x1b')]);}logger['error'](_0xa2f1('0x15'),_0x64b5a4,_0xedc786[_0xa2f1('0x1a')][_0xa2f1('0x1b')]);return _0x3131b4(_0xedc786[_0xa2f1('0x1a')][_0xa2f1('0x1b')]);}else{logger[_0xa2f1('0x14')](_0xa2f1('0x15'),_0x64b5a4,_0xa2f1('0x16'));_0x3131b4(_0xedc786[_0xa2f1('0x1c')][_0xa2f1('0x1b')]);}})[_0xa2f1('0x1d')](function(_0x17b8d5){logger[_0xa2f1('0x1a')](_0xa2f1('0x15'),_0x64b5a4,_0x17b8d5);_0xbba003(_0x17b8d5);});});}function respondWithResult(_0x4f64cb,_0x2ff826){_0x2ff826=_0x2ff826||0xc8;return function(_0x4d578a){if(_0x4d578a){return _0x4f64cb['status'](_0x2ff826)['json'](_0x4d578a);}};}function respondWithFilteredResult(_0x55edfa,_0x3ce660){return function(_0xee22ab){if(_0xee22ab){var _0x418a27=typeof _0x3ce660[_0xa2f1('0x1e')]===_0xa2f1('0x1f')&&typeof _0x3ce660['limit']===_0xa2f1('0x1f');var _0xa19ce1=_0xee22ab[_0xa2f1('0x20')];var _0x1e4de8=_0x418a27?0x0:_0x3ce660[_0xa2f1('0x1e')];var _0x284fae=_0x418a27?_0xee22ab[_0xa2f1('0x20')]:_0x3ce660[_0xa2f1('0x1e')]+_0x3ce660['limit'];var _0x79d05d;if(_0x284fae>=_0xa19ce1){_0x284fae=_0xa19ce1;_0x79d05d=0xc8;}else{_0x79d05d=0xce;}_0x55edfa['status'](_0x79d05d);return _0x55edfa[_0xa2f1('0x21')](_0xa2f1('0x22'),_0x1e4de8+'-'+_0x284fae+'/'+_0xa19ce1)[_0xa2f1('0x23')](_0xee22ab);}return null;};}function saveUpdates(_0x557147){return function(_0x4ae4db){if(_0x4ae4db){return _0x4ae4db[_0xa2f1('0x24')](_0x557147)['then'](function(_0x97dd31){return _0x97dd31;});}return null;};}function removeEntity(_0x456fb7){return function(_0x35353e){if(_0x35353e){return _0x35353e[_0xa2f1('0x25')]()['then'](function(){_0x456fb7[_0xa2f1('0x26')](0xcc)[_0xa2f1('0x27')]();});}};}function handleEntityNotFound(_0x14237d){return function(_0x5c8699){if(!_0x5c8699){_0x14237d['sendStatus'](0x194);}return _0x5c8699;};}function handleError(_0x2033a0,_0x31e63b){_0x31e63b=_0x31e63b||0x1f4;return function(_0x202a6f){logger[_0xa2f1('0x1a')](_0x202a6f['stack']);if(_0x202a6f[_0xa2f1('0x28')]){delete _0x202a6f[_0xa2f1('0x28')];}_0x2033a0[_0xa2f1('0x26')](_0x31e63b)[_0xa2f1('0x29')](_0x202a6f);};}exports[_0xa2f1('0x2a')]=function(_0x2410da,_0x5e50e6){var _0x3d726d={},_0x45c360={},_0x1b6167={'count':0x0,'rows':[]};var _0x1204e5=_[_0xa2f1('0x2b')](db[_0xa2f1('0x2c')][_0xa2f1('0x2d')],function(_0x5a71ea){return{'name':_0x5a71ea[_0xa2f1('0x2e')],'type':_0x5a71ea[_0xa2f1('0x2f')][_0xa2f1('0x30')]};});_0x45c360[_0xa2f1('0x31')]=_[_0xa2f1('0x2b')](_0x1204e5,'name');_0x45c360['query']=_[_0xa2f1('0x32')](_0x2410da[_0xa2f1('0x33')]);_0x45c360['filters']=_[_0xa2f1('0x34')](_0x45c360[_0xa2f1('0x31')],_0x45c360[_0xa2f1('0x33')]);_0x3d726d['attributes']=_[_0xa2f1('0x34')](_0x45c360[_0xa2f1('0x31')],qs[_0xa2f1('0x35')](_0x2410da[_0xa2f1('0x33')][_0xa2f1('0x35')]));_0x3d726d[_0xa2f1('0x36')]=_0x3d726d[_0xa2f1('0x36')]['length']?_0x3d726d[_0xa2f1('0x36')]:_0x45c360[_0xa2f1('0x31')];if(!_0x2410da[_0xa2f1('0x33')]['hasOwnProperty'](_0xa2f1('0x37'))){_0x3d726d['limit']=qs['limit'](_0x2410da[_0xa2f1('0x33')][_0xa2f1('0x38')]);_0x3d726d[_0xa2f1('0x1e')]=qs[_0xa2f1('0x1e')](_0x2410da['query'][_0xa2f1('0x1e')]);}_0x3d726d[_0xa2f1('0x39')]=qs[_0xa2f1('0x3a')](_0x2410da[_0xa2f1('0x33')][_0xa2f1('0x3a')]);_0x3d726d[_0xa2f1('0x3b')]=qs['filters'](_[_0xa2f1('0x3c')](_0x2410da[_0xa2f1('0x33')],_0x45c360[_0xa2f1('0x3d')]),_0x1204e5);if(_0x2410da['query'][_0xa2f1('0x3e')]){_0x3d726d[_0xa2f1('0x3b')]=_['merge'](_0x3d726d[_0xa2f1('0x3b')],{'$or':_[_0xa2f1('0x2b')](_0x1204e5,function(_0x58f4f0){if(_0x58f4f0['type']!==_0xa2f1('0x3f')){var _0x5bb74f={};_0x5bb74f[_0x58f4f0[_0xa2f1('0x28')]]={'$like':'%'+_0x2410da[_0xa2f1('0x33')]['filter']+'%'};return _0x5bb74f;}})});}_0x3d726d=_[_0xa2f1('0x40')]({},_0x3d726d,_0x2410da[_0xa2f1('0x41')]);var _0x3cffd4={'where':_0x3d726d[_0xa2f1('0x3b')]};return db['SmsMessage'][_0xa2f1('0x20')](_0x3cffd4)['then'](function(_0x5cceea){_0x1b6167[_0xa2f1('0x20')]=_0x5cceea;if(_0x2410da[_0xa2f1('0x33')][_0xa2f1('0x42')]){_0x3d726d['include']=[{'all':!![]}];}return db['SmsMessage'][_0xa2f1('0x43')](_0x3d726d);})[_0xa2f1('0x13')](function(_0xbd7130){_0x1b6167[_0xa2f1('0x44')]=_0xbd7130;return _0x1b6167;})[_0xa2f1('0x13')](respondWithFilteredResult(_0x5e50e6,_0x3d726d))[_0xa2f1('0x1d')](handleError(_0x5e50e6,null));};exports['show']=function(_0x5da9fb,_0x45578c){var _0x1c7d94={'raw':!![],'where':{'id':_0x5da9fb[_0xa2f1('0x45')]['id']}},_0xc3213b={};_0xc3213b[_0xa2f1('0x31')]=_['keys'](db[_0xa2f1('0x2c')][_0xa2f1('0x2d')]);_0xc3213b[_0xa2f1('0x33')]=_[_0xa2f1('0x32')](_0x5da9fb[_0xa2f1('0x33')]);_0xc3213b[_0xa2f1('0x3d')]=_[_0xa2f1('0x34')](_0xc3213b[_0xa2f1('0x31')],_0xc3213b['query']);_0x1c7d94[_0xa2f1('0x36')]=_[_0xa2f1('0x34')](_0xc3213b['model'],qs[_0xa2f1('0x35')](_0x5da9fb[_0xa2f1('0x33')][_0xa2f1('0x35')]));_0x1c7d94[_0xa2f1('0x36')]=_0x1c7d94[_0xa2f1('0x36')][_0xa2f1('0x46')]?_0x1c7d94[_0xa2f1('0x36')]:_0xc3213b['model'];if(_0x5da9fb[_0xa2f1('0x33')][_0xa2f1('0x42')]){_0x1c7d94[_0xa2f1('0x47')]=[{'all':!![]}];}_0x1c7d94=_[_0xa2f1('0x40')]({},_0x1c7d94,_0x5da9fb[_0xa2f1('0x41')]);return db[_0xa2f1('0x2c')][_0xa2f1('0x48')](_0x1c7d94)[_0xa2f1('0x13')](handleEntityNotFound(_0x45578c,null))['then'](respondWithResult(_0x45578c,null))[_0xa2f1('0x1d')](handleError(_0x45578c,null));};exports[_0xa2f1('0x49')]=function(_0x2e9ee5,_0x30939c){return db[_0xa2f1('0x2c')]['create'](_0x2e9ee5[_0xa2f1('0x4a')],{})[_0xa2f1('0x13')](respondWithResult(_0x30939c,0xc9))[_0xa2f1('0x1d')](handleError(_0x30939c,null));};exports[_0xa2f1('0x24')]=function(_0x368814,_0x44925a){if(_0x368814[_0xa2f1('0x4a')]['id']){delete _0x368814['body']['id'];}return db[_0xa2f1('0x2c')]['find']({'where':{'id':_0x368814[_0xa2f1('0x45')]['id']}})[_0xa2f1('0x13')](handleEntityNotFound(_0x44925a,null))[_0xa2f1('0x13')](saveUpdates(_0x368814[_0xa2f1('0x4a')],null))[_0xa2f1('0x13')](respondWithResult(_0x44925a,null))[_0xa2f1('0x1d')](handleError(_0x44925a,null));};exports['destroy']=function(_0x58ff46,_0x129c56){return db[_0xa2f1('0x2c')]['find']({'where':{'id':_0x58ff46['params']['id']}})['then'](handleEntityNotFound(_0x129c56,null))[_0xa2f1('0x13')](removeEntity(_0x129c56,null))[_0xa2f1('0x1d')](handleError(_0x129c56,null));};exports[_0xa2f1('0x4b')]=function(_0x49cefc,_0x4a8ec8){return db[_0xa2f1('0x2c')][_0xa2f1('0x4b')]()[_0xa2f1('0x13')](respondWithResult(_0x4a8ec8,null))[_0xa2f1('0x1d')](handleError(_0x4a8ec8,null));};exports[_0xa2f1('0x4c')]=function(_0x1e9a02,_0x2d138b){var _0x107836=_0xa2f1('0x4d');return interactionService['acceptMessage'](_0x1e9a02,_0x107836)[_0xa2f1('0x13')](respondWithResult(_0x2d138b,null))[_0xa2f1('0x1d')](handleError(_0x2d138b,null));};exports[_0xa2f1('0x4e')]=function(_0x2326e3,_0x4244cd){var _0x4abb49={'agent':{},'channel':_0xa2f1('0x4d')};if(_0x2326e3[_0xa2f1('0x4a')]['id']){delete _0x2326e3['body']['id'];}_0x2326e3[_0xa2f1('0x4a')][_0xa2f1('0x4f')]=_0x2326e3[_0xa2f1('0x4a')][_0xa2f1('0x4f')]||_0x2326e3[_0xa2f1('0x50')]['id'];_0x4abb49[_0xa2f1('0x51')]['id']=_0x2326e3[_0xa2f1('0x4a')]['UserId'];return db[_0xa2f1('0x2c')][_0xa2f1('0x48')]({'where':{'id':_0x2326e3['params']['id'],'UserId':null}})[_0xa2f1('0x13')](handleEntityNotFound(_0x4244cd,null))[_0xa2f1('0x13')](function(_0x23bfef){if(_0x23bfef){_0x4abb49['message']=_0x23bfef[_0xa2f1('0x52')]({'plain':!![]});return db['SmsInteraction'][_0xa2f1('0x48')]({'where':{'id':_0x23bfef[_0xa2f1('0x53')]}});}return null;})[_0xa2f1('0x13')](handleEntityNotFound(_0x4244cd,null))[_0xa2f1('0x13')](function(_0x475c9f){if(_0x475c9f){_0x4abb49[_0xa2f1('0x54')]=_0x475c9f[_0xa2f1('0x52')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2326e3[_0xa2f1('0x50')]['id'],_0x2326e3['user']['name'],_0x2326e3[_0xa2f1('0x50')][_0xa2f1('0x55')],_0x4abb49['interaction']['id'],_0x2326e3[_0xa2f1('0x4a')]?JSON[_0xa2f1('0x19')](_0x2326e3['body']):_0xa2f1('0x56'));return respondWithRpcPromise(_0xa2f1('0x57'),'rejectMessage',_0x4abb49);}return null;})[_0xa2f1('0x13')](function(_0x2fb030){var _0x58e9b0=_0xa2f1('0x58')+_0x2fb030[_0xa2f1('0x1b')][_0xa2f1('0x59')];return db[_0xa2f1('0x5a')][_0xa2f1('0x33')](_0x58e9b0,{'type':db[_0xa2f1('0x5b')][_0xa2f1('0x5c')][_0xa2f1('0x5d')],'raw':!![]})[_0xa2f1('0x13')](function(_0x3054fc){return _0x3054fc;});})['then'](function(_0x54e5ca){if(_0x54e5ca){_0x4abb49[_0xa2f1('0x1b')]['contact']=_0x54e5ca[0x0];if(!_0x2326e3[_0xa2f1('0x4a')][_0xa2f1('0x4f')])return;return db['User'][_0xa2f1('0x48')]({'where':{'id':_0x2326e3[_0xa2f1('0x4a')][_0xa2f1('0x4f')],'role':_0xa2f1('0x51')},'attributes':['id','name',_0xa2f1('0x5e'),_0xa2f1('0x5f'),'internal'],'raw':!![]});}return null;})[_0xa2f1('0x13')](function(_0x2e537d){if(!_0x2e537d)return null;_0x4abb49['message'][_0xa2f1('0x51')]=_0x2e537d;return _0x4abb49;})['then'](function(_0x1be80b){if(_0x1be80b){_0x1be80b[_0xa2f1('0x1b')][_0xa2f1('0x60')]=util['format'](_0xa2f1('0x61'),_0x2326e3['user'][_0xa2f1('0x28')]);_0x1be80b['message'][_0xa2f1('0x62')]=_0x4abb49[_0xa2f1('0x62')];_0x1be80b['message'][_0xa2f1('0x63')]=_0x4abb49[_0xa2f1('0x62')];_0x1be80b[_0xa2f1('0x1b')]['event']='reject';respondWithRpcPromise('EventManager',_0xa2f1('0x64'),{'event':_0xa2f1('0x65'),'message':_0x1be80b[_0xa2f1('0x1b')]},client9002);return _0x4abb49;}return null;})[_0xa2f1('0x13')](respondWithResult(_0x4244cd,null))[_0xa2f1('0x1d')](handleError(_0x4244cd,null));};exports[_0xa2f1('0x26')]=function(_0x40cbf9,_0x46b044){if(_0x40cbf9[_0xa2f1('0x4a')]['id']){delete _0x40cbf9[_0xa2f1('0x4a')]['id'];}var _0x4e6dc7;return db['SmsMessage'][_0xa2f1('0x48')]({'where':{'id':_0x40cbf9[_0xa2f1('0x45')]['id']}})[_0xa2f1('0x13')](handleEntityNotFound(_0x46b044,null))['then'](function(_0x199ee9){if(_0x199ee9){_0x4e6dc7=_0x199ee9;return db[_0xa2f1('0x66')][_0xa2f1('0x48')]({'where':{'id':_0x199ee9['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x46b044,null))['then'](function(_0x790bc7){if(_0x790bc7){logger[_0xa2f1('0x17')](_0xa2f1('0x18'),_0xa2f1('0x26'),_0xa2f1('0x67'),_0x790bc7[_0xa2f1('0x2f')],util[_0xa2f1('0x68')](_0x40cbf9['body'],{'showHidden':![],'depth':null}));switch(_0x790bc7[_0xa2f1('0x2f')]){case _0xa2f1('0x69'):if(_0x40cbf9[_0xa2f1('0x4a')][_0xa2f1('0x6a')]&&_0x40cbf9[_0xa2f1('0x4a')][_0xa2f1('0x6a')]===_0x4e6dc7[_0xa2f1('0x6b')]){return _0x4e6dc7[_0xa2f1('0x24')]({'read':!![]});}else{logger[_0xa2f1('0x1a')](_0xa2f1('0x6c'),_0xa2f1('0x26'),_0xa2f1('0x69'),util[_0xa2f1('0x68')](_0x40cbf9[_0xa2f1('0x4a')],{'showHidden':![],'depth':null}));}break;case _0xa2f1('0x6d'):if(_0x40cbf9[_0xa2f1('0x4a')]['MessageUUID']&&_0x40cbf9[_0xa2f1('0x4a')]['MessageUUID']===_0x4e6dc7[_0xa2f1('0x6b')]&&_[_0xa2f1('0x6e')](['sent',_0xa2f1('0x6f')],_0x40cbf9[_0xa2f1('0x4a')][_0xa2f1('0x70')])>=0x0){return _0x4e6dc7['update']({'read':!![]});}else{logger[_0xa2f1('0x1a')](_0xa2f1('0x6c'),_0xa2f1('0x26'),'plivio',util[_0xa2f1('0x68')](_0x40cbf9[_0xa2f1('0x4a')],{'showHidden':![],'depth':null}));}break;case _0xa2f1('0x71'):var _0x11d46e=_0x40cbf9[_0xa2f1('0x4a')][_0xa2f1('0x72')][0x0];if(_0x11d46e[_0xa2f1('0x26')]['groupName']===_0xa2f1('0x73')){return _0x4e6dc7[_0xa2f1('0x24')]({'read':!![]});}else{logger[_0xa2f1('0x1a')](_0xa2f1('0x6c'),_0xa2f1('0x26'),_0xa2f1('0x71'),util[_0xa2f1('0x68')](_0x40cbf9[_0xa2f1('0x4a')],{'showHidden':![],'depth':null}));}break;}return _0x4e6dc7;}})[_0xa2f1('0x13')](respondWithResult(_0x46b044,null))['catch'](handleError(_0x46b044,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7912b56..b1b40de 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 _0x7f4f=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0x7f4f,0x89));var _0xf7f4=function(_0x54331b,_0x27138c){_0x54331b=_0x54331b-0x0;var _0x60bf0d=_0x7f4f[_0x54331b];return _0x60bf0d;};'use strict';var EventEmitter=require(_0xf7f4('0x0'));var SmsMessage=require(_0xf7f4('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7f4('0x2'),'afterUpdate':_0xf7f4('0x3'),'afterDestroy':_0xf7f4('0x4')};function emitEvent(_0xb80e52){return function(_0x184bf9,_0x58ad94,_0x3ad711){SmsMessageEvents[_0xf7f4('0x5')](_0xb80e52+':'+_0x184bf9['id'],_0x184bf9);SmsMessageEvents[_0xf7f4('0x5')](_0xb80e52,_0x184bf9);_0x3ad711(null);};}for(var e in events){if(events[_0xf7f4('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf7f4('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xd7ec=['save','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xd7ec,0xe2));var _0xcd7e=function(_0x16c3dc,_0x2f53a4){_0x16c3dc=_0x16c3dc-0x0;var _0x4232d0=_0xd7ec[_0x16c3dc];return _0x4232d0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xcd7e('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xcd7e('0x1')](0x0);var events={'afterCreate':_0xcd7e('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f5afa){return function(_0x34054b,_0x3beac6,_0x109e03){SmsMessageEvents[_0xcd7e('0x3')](_0x1f5afa+':'+_0x34054b['id'],_0x34054b);SmsMessageEvents[_0xcd7e('0x3')](_0x1f5afa,_0x34054b);_0x109e03(null);};}for(var e in events){if(events[_0xcd7e('0x4')](e)){var event=events[e];SmsMessage[_0xcd7e('0x5')](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 a59254a..0766124 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 _0x90ad=['digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','toString','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','clicksend','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','sort','md5'];(function(_0x4706ca,_0x15a8d7){var _0xc3acdf=function(_0x390bc2){while(--_0x390bc2){_0x4706ca['push'](_0x4706ca['shift']());}};_0xc3acdf(++_0x15a8d7);}(_0x90ad,0x18e));var _0xd90a=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x90ad[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xd90a('0x0'));var util=require('util');var logger=require(_0xd90a('0x1'))('api');var moment=require(_0xd90a('0x2'));var BPromise=require('bluebird');var rp=require(_0xd90a('0x3'));var fs=require('fs');var path=require(_0xd90a('0x4'));var rimraf=require(_0xd90a('0x5'));var config=require('../../config/environment');var attributes=require(_0xd90a('0x6'));module[_0xd90a('0x7')]=function(_0x45e34b,_0x30a61c){return _0x45e34b[_0xd90a('0x8')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xd90a('0x9'),'fields':[_0xd90a('0x9')]},{'name':_0xd90a('0xa'),'fields':[_0xd90a('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x557b5c,_0x48702b,_0x2f6bd3){var _0x130453=_0x45e34b[_0xd90a('0xc')];var _0xa74b36=_0x557b5c[_0xd90a('0xd')]({'plain':!![]});if(_0xa74b36[_0xd90a('0xe')][_0xd90a('0xf')]()==='in'||_0xa74b36[_0xd90a('0xe')]['toLowerCase']()===_0xd90a('0x10')&&!_0xa74b36[_0xd90a('0x11')]&&!_['isNil'](_0xa74b36[_0xd90a('0x12')])&&!_[_0xd90a('0x13')](_0xa74b36['SmsInteractionId'])){_0x130453['SmsInteraction'][_0xd90a('0x14')]({'where':{'id':_0xa74b36[_0xd90a('0x15')]}})[_0xd90a('0x16')](function(_0x5b1cc9){if(_0x5b1cc9){_0x5b1cc9[_0xd90a('0x17')]({'lastMsgAt':_0xa74b36[_0xd90a('0x18')],'lastMsgDirection':_0xa74b36[_0xd90a('0xe')][_0xd90a('0xf')]()});}})[_0xd90a('0x19')](function(_0x3bc1a0){console[_0xd90a('0x1a')](_0x3bc1a0);});}if(_0xa74b36[_0xd90a('0xe')]==='out'&&!_0xa74b36[_0xd90a('0x11')]){var _0xdec43f;_0x130453['SmsAccount'][_0xd90a('0x1b')]({'where':{'id':_0xa74b36[_0xd90a('0x1c')]},'raw':!![]})[_0xd90a('0x16')](function(_0x2489e9){_0xdec43f=_0x2489e9;if(_0xdec43f&&_0xdec43f['type']){switch(_0xdec43f[_0xd90a('0x1d')]){case _0xd90a('0x1e'):var _0x36d001=require(_0xd90a('0x1e'));if(_0xdec43f[_0xd90a('0x1f')]&&_0xdec43f[_0xd90a('0x20')]&&_0xdec43f['phone']){var _0x223126=new _0x36d001(_0xdec43f[_0xd90a('0x1f')],_0xdec43f[_0xd90a('0x20')]);_0x223126[_0xd90a('0x21')][_0xd90a('0x22')]({'body':_0xa74b36[_0xd90a('0xb')],'to':_0xa74b36[_0xd90a('0x23')],'from':_0xdec43f[_0xd90a('0x23')],'statusCallback':_0xdec43f[_0xd90a('0x24')]+'/api/sms/messages/'+_0xa74b36['id']+_0xd90a('0x25')+_0xdec43f[_0xd90a('0x26')]})[_0xd90a('0x16')](function(_0x410e8d){if(_0x410e8d[_0xd90a('0x27')]){return _0x557b5c[_0xd90a('0x17')]({'messageId':_0x410e8d[_0xd90a('0x27')]});}})[_0xd90a('0x19')](function(_0x7769f6){logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x1e'),util[_0xd90a('0x2a')](_0x7769f6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x1e'),_0xd90a('0x2b'));}break;case _0xd90a('0x2c'):var _0x2f274d=_0xd90a('0x2d');if(_0xdec43f[_0xd90a('0x2e')]&&_0xdec43f[_0xd90a('0x2f')]){var _0x4b926a={'recipient':[_0xa74b36[_0xd90a('0x23')]],'message':_0xa74b36[_0xd90a('0xb')],'message_type':_0xdec43f[_0xd90a('0x30')]};if(_0xdec43f[_0xd90a('0x30')]&&_0xdec43f[_0xd90a('0x30')]!=='SI'){_0x4b926a[_0xd90a('0x31')]=_0xdec43f['phone'];}var _0x35adad={'url':_0x2f274d+'login?username='+_0xdec43f[_0xd90a('0x2e')]+_0xd90a('0x32')+_0xdec43f[_0xd90a('0x2f')],'method':_0xd90a('0x33')};rp(_0x35adad)['then'](function(_0x11c855){var _0x3f1f2b=_0x11c855[_0xd90a('0x34')](';');var _0x242d25={'user_key':_0x3f1f2b[0x0],'session_key':_0x3f1f2b[0x1]};_0x35adad={'url':_0x2f274d+_0xd90a('0x35'),'method':_0xd90a('0x36'),'headers':{'user_key':_0x242d25['user_key'],'Session_key':_0x242d25[_0xd90a('0x37')]},'json':!![],'body':_0x4b926a};return rp(_0x35adad);})[_0xd90a('0x16')](function(_0x44c30d){if(_0x44c30d[_0xd90a('0x38')]>=0x1){var _0x2b38a8={'messageId':_0x44c30d[_0xd90a('0x39')]};if(_0xdec43f[_0xd90a('0x30')]!=='GP'||!_0xdec43f[_0xd90a('0x3a')]){_0x2b38a8['read']=!![];}return _0x557b5c[_0xd90a('0x17')](_0x2b38a8);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x2c'),util[_0xd90a('0x2a')](_0x44c30d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x176deb){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x2c'),util[_0xd90a('0x2a')](_0x176deb,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),'skebby',_0xd90a('0x3b'));}break;case _0xd90a('0x3c'):if(_0xdec43f[_0xd90a('0x20')]){var _0x35911c={'recipient':_0xa74b36[_0xd90a('0x23')],'message':_0xa74b36[_0xd90a('0xb')],'sender':_0xdec43f[_0xd90a('0x3d')]||_0xdec43f['phone'],'authorization':_0xdec43f[_0xd90a('0x20')]};var _0x48702b={'method':'POST','uri':_0xd90a('0x3e'),'body':_0x35911c,'json':!![]};rp(_0x48702b)[_0xd90a('0x16')](function(_0xdce34e){var _0x3fc547={'messageId':_0xdce34e[_0xd90a('0x3f')]};if(!_0xdec43f['deliveryReport']){_0x3fc547[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x3fc547);})[_0xd90a('0x19')](function(_0x89ac26){logger['error'](_0xd90a('0x28'),'afterCreate',_0xd90a('0x3c'),util['inspect'](_0x89ac26,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd90a('0x29'),_0xd90a('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0xd90a('0x41'):if(_0xdec43f[_0xd90a('0x2e')]&&_0xdec43f['password']){var _0x35911c={'messages':[{'source':_0xd90a('0x42'),'to':_0xa74b36[_0xd90a('0x23')],'body':_0xa74b36[_0xd90a('0xb')],'from':_0xdec43f[_0xd90a('0x3d')]||_0xdec43f['phone']}]};var _0x45dbec=util['format'](_0xd90a('0x43'),_0xdec43f[_0xd90a('0x2e')],_0xdec43f['password']);var _0x48702b={'method':_0xd90a('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x35911c,'headers':{'Authorization':util[_0xd90a('0x44')](_0xd90a('0x45'),new Buffer(_0x45dbec)['toString'](_0xd90a('0x46')))},'json':!![]};rp(_0x48702b)['then'](function(_0xa191e7){if(_0xa191e7[_0xd90a('0x47')]>=0xc8&&_0xa191e7['http_code']<=0xce){if(_0xa191e7[_0xd90a('0x48')]&&_0xa191e7[_0xd90a('0x48')][_0xd90a('0x49')]>0x0){var _0x2b6fd7=_[_0xd90a('0x4a')](_0xa191e7['data'][_0xd90a('0x21')]);var _0x4f58db={'messageId':_0x2b6fd7['message_id']};if(!_0xdec43f['deliveryReport']){_0x4f58db[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x4f58db);}else{logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0xa191e7,{'showHidden':![],'depth':null}));}}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x4b'),util[_0xd90a('0x2a')](_0xa191e7,{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x174462){logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd90a('0x29'),_0xd90a('0x4b'),util[_0xd90a('0x2a')](_0x174462,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xd90a('0x4c'):if(_0xdec43f[_0xd90a('0x4d')]&&_0xdec43f[_0xd90a('0x20')]){var _0x35911c={'dst':_0xa74b36[_0xd90a('0x23')],'text':_0xa74b36[_0xd90a('0xb')],'src':_0xdec43f[_0xd90a('0x3d')]||_0xdec43f[_0xd90a('0x23')],'url':_0xdec43f[_0xd90a('0x24')]+_0xd90a('0x4e')+_0xa74b36['id']+'/status?token='+_0xdec43f[_0xd90a('0x26')]};var _0x45dbec=util[_0xd90a('0x44')](_0xd90a('0x43'),_0xdec43f[_0xd90a('0x4d')],_0xdec43f[_0xd90a('0x20')]);var _0x48702b={'method':'POST','uri':util[_0xd90a('0x44')](_0xd90a('0x4f'),_0xdec43f['authId']),'body':_0x35911c,'headers':{'Authorization':util[_0xd90a('0x44')](_0xd90a('0x45'),new Buffer(_0x45dbec)['toString'](_0xd90a('0x46')))},'json':!![]};rp(_0x48702b)[_0xd90a('0x16')](function(_0x510412){var _0x46f55f={'messageId':_0x510412[_0xd90a('0x50')][0x0]};return _0x557b5c['update'](_0x46f55f);})[_0xd90a('0x19')](function(_0x507f7d){logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x4c'),util['inspect'](_0x507f7d,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd90a('0x29'),_0xd90a('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xd90a('0x51'):if(_0xdec43f['username']&&_0xdec43f[_0xd90a('0x2f')]){if(_0xdec43f['baseUrl']){var _0x26a55e={'method':_0xd90a('0x36'),'uri':_0xdec43f[_0xd90a('0x52')]+_0xd90a('0x53'),'body':{'username':_0xdec43f[_0xd90a('0x2e')],'password':_0xdec43f[_0xd90a('0x2f')]},'json':!![]};return rp(_0x26a55e)[_0xd90a('0x16')](function(_0x288f22){var _0x4427cd={'method':'POST','uri':_0xdec43f[_0xd90a('0x52')]+_0xd90a('0x54'),'body':{'messages':[{'from':_0xdec43f[_0xd90a('0x23')],'destinations':[{'to':_0xa74b36[_0xd90a('0x23')]}],'text':_0xa74b36[_0xd90a('0xb')],'notifyUrl':_0xdec43f[_0xd90a('0x24')]+_0xd90a('0x4e')+_0xa74b36['id']+_0xd90a('0x25')+_0xdec43f[_0xd90a('0x26')],'notifyContentType':'application/json','callbackData':_0xdec43f['phone']+';'+_0xa74b36[_0xd90a('0xb')]}]},'headers':{'Authorization':_0xd90a('0x55')+_0x288f22[_0xd90a('0x26')]},'json':!![]};return rp(_0x4427cd)['then'](function(_0x359d7c){if(_0x359d7c['messages']){var _0x56bdba={'messageId':_0x359d7c['messages'][0x0][_0xd90a('0x9')]};if(!_0xdec43f[_0xd90a('0x3a')]){_0x56bdba[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x56bdba);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x51'),util['inspect'](_0x359d7c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x13bee4){return logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd90a('0x51'),util['inspect'](_0x13bee4,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate',_0xd90a('0x51'),_0xd90a('0x56'));}}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate',_0xd90a('0x51'),_0xd90a('0x3b'));}break;case _0xd90a('0x57'):var _0x1cf1aa=require(_0xd90a('0x58'));if(_0xdec43f[_0xd90a('0x59')]){var _0x54d7c0={};_0x54d7c0[_0xd90a('0x5a')]=_0xdec43f[_0xd90a('0x2e')];_0x54d7c0['phone']=_0xa74b36['phone'];_0x54d7c0['sender']=_0xdec43f[_0xd90a('0x23')];_0x54d7c0['text']=_0xa74b36[_0xd90a('0xb')];_0x54d7c0[_0xd90a('0x5b')]=+new Date();var _0x457c5d='';var _0x50ad2d='';var _0x439e08=Object['keys'](_0x54d7c0);_0x439e08[_0xd90a('0x5c')]();for(var _0x3e1147=0x0;_0x3e1147<_0x439e08['length'];_0x3e1147++){if(_0x457c5d!=''){_0x457c5d+='&';}_0x457c5d+=_0x439e08[_0x3e1147]+'='+encodeURIComponent(_0x54d7c0[_0x439e08[_0x3e1147]]);_0x50ad2d+=_0x54d7c0[_0x439e08[_0x3e1147]];}_0x50ad2d+=_0xdec43f[_0xd90a('0x59')];_0x50ad2d=_0x1cf1aa['createHash'](_0xd90a('0x5d'))['update'](_0x50ad2d)[_0xd90a('0x5e')](_0xd90a('0x5f'));if(_0x457c5d!==''){_0x457c5d+='&';}_0x457c5d+=_0xd90a('0x60')+_0x50ad2d;var _0x35adad={'method':_0xd90a('0x33'),'uri':_0xdec43f[_0xd90a('0x52')]+_0xd90a('0x61')+_0x457c5d,'json':!![]};return rp(_0x35adad)[_0xd90a('0x16')](function(_0x271d54){var _0x232c28=Object['keys'](_0x271d54);if(_0x271d54[_0x232c28[0x0]][_0xd90a('0x1a')]&&parseInt(_0x271d54[_0x232c28[0x0]]['error'])===0x0){var _0x565646={'messageId':_0x271d54[_0x232c28[0x0]][_0xd90a('0x62')]};if(!_0xdec43f[_0xd90a('0x3a')]){_0x565646[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x565646);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x57'),util[_0xd90a('0x2a')](_0x271d54[_0xd90a('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x55611f){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate','csc',util[_0xd90a('0x2a')](_0x55611f,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x57'),_0xd90a('0x63'));}break;case _0xd90a('0x64'):if(_0xdec43f['apiKey']){var _0x52d010={'method':_0xd90a('0x36'),'uri':_0xd90a('0x65'),'headers':{'Authorization':_0xdec43f['apiKey']},'body':{'content':_0xa74b36[_0xd90a('0xb')],'to':[_0xa74b36[_0xd90a('0x23')]],'from':_0xdec43f[_0xd90a('0x23')],'binary':![],'clientMessageId':_0xd90a('0x66'),'charset':_0xd90a('0x67')},'json':!![]};rp(_0x52d010)['then'](function(_0x39c8e6){if(!_0x39c8e6[_0xd90a('0x1a')]){var _0x14db8c={'messageId':_0x39c8e6[_0xd90a('0x21')][0x0]['apiMessageId']};if(!_0xdec43f[_0xd90a('0x3a')]){_0x14db8c[_0xd90a('0x40')]=!![];}return _0x557b5c['update'](_0x14db8c);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x64'),util[_0xd90a('0x2a')](_0x39c8e6[_0xd90a('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x39d9ba){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate','clickatell',util[_0xd90a('0x2a')](_0x39d9ba,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x64'),_0xd90a('0x63'));}break;case _0xd90a('0x68'):if(_0xdec43f[_0xd90a('0x2e')]&&_0xdec43f['password']){var _0x45dbec=util[_0xd90a('0x44')](_0xd90a('0x43'),_0xdec43f[_0xd90a('0x2e')],_0xdec43f[_0xd90a('0x2f')]);var _0x48702b={'method':_0xd90a('0x36'),'uri':_0xd90a('0x69')+_0xdec43f[_0xd90a('0x6a')]+_0xd90a('0x6b'),'body':{'to':[_0xa74b36['phone']],'text':_0xa74b36[_0xd90a('0xb')],'from':_0xdec43f[_0xd90a('0x23')],'applicationId':_0xdec43f[_0xd90a('0x6c')]},'headers':{'Authorization':util[_0xd90a('0x44')](_0xd90a('0x45'),new Buffer(_0x45dbec)[_0xd90a('0x6d')]('base64'))},'json':!![]};rp(_0x48702b)[_0xd90a('0x16')](function(_0xd11cf2){if(_0xd11cf2['id']){var _0x45b997={'messageId':_0xd11cf2['id']};return _0x557b5c['update'](_0x45b997);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util['inspect'](_0xd11cf2,{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x9b86c6){logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x68'),util['inspect'](_0x9b86c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x68'),_0xd90a('0x3b'));}break;case _0xd90a('0x6e'):if(_0xdec43f['apiKey']){var _0x13c3b7={};var _0x35adad={'method':_0xd90a('0x36'),'uri':_0xd90a('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0xdec43f[_0xd90a('0x59')],'Content-Type':_0xd90a('0x70')},'body':{'from':_0xdec43f[_0xd90a('0x23')],'to':_0xa74b36[_0xd90a('0x23')],'text':_0xa74b36[_0xd90a('0xb')]},'json':!![]};return rp(_0x35adad)[_0xd90a('0x16')](function(_0x306d93){if(_0x306d93[_0xd90a('0x71')]==0xca){_0x13c3b7[_0xd90a('0x72')]=_0x306d93;var _0x27550d={'method':'POST','uri':_0xd90a('0x73'),'headers':{'Authorization':_0xd90a('0x74')+_0xdec43f['apiKey'],'Content-Type':_0xd90a('0x70')},'body':{'refid':_0x13c3b7[_0xd90a('0x72')][_0xd90a('0x75')]},'json':!![]};return rp(_0x27550d)[_0xd90a('0x16')](function(_0x1b586a){_0x13c3b7[_0xd90a('0x76')]=_0x1b586a;var _0x56ef84={'messageId':_0x13c3b7[_0xd90a('0x72')][_0xd90a('0x75')],'read':!![]};return _0x557b5c[_0xd90a('0x17')](_0x56ef84);});}else{return logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x6e'),util['inspect'](_0x306d93,{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x2b178a){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x6e'),util['inspect'](_0x2b178a,{'showHidden':![],'depth':null}));});}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x6e'),_0xd90a('0x77'));}break;}}})[_0xd90a('0x78')](function(){_0x2f6bd3();});}else{_0x2f6bd3();}}},'charset':_0xd90a('0x79'),'collate':_0xd90a('0x7a')});}; \ No newline at end of file +var _0x13ea=['hex','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','fti_sms_messages','FULLTEXT','direction','toLowerCase','out','isNil','SmsInteractionId','findOne','then','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','body','phone','remote','/api/sms/messages/','token','sid','update','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','password','split','POST','user_key','session_key','total_sent','internal_order_id','skebby','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','length','createHash','md5'];(function(_0x64a149,_0x1a9d99){var _0x1596cb=function(_0x438471){while(--_0x438471){_0x64a149['push'](_0x64a149['shift']());}};_0x1596cb(++_0x1a9d99);}(_0x13ea,0x1ee));var _0xa13e=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x13ea[_0x2d344f];return _0x2e796b;};'use strict';var _=require(_0xa13e('0x0'));var util=require(_0xa13e('0x1'));var logger=require(_0xa13e('0x2'))('api');var moment=require(_0xa13e('0x3'));var BPromise=require(_0xa13e('0x4'));var rp=require(_0xa13e('0x5'));var fs=require('fs');var path=require(_0xa13e('0x6'));var rimraf=require(_0xa13e('0x7'));var config=require(_0xa13e('0x8'));var attributes=require(_0xa13e('0x9'));module[_0xa13e('0xa')]=function(_0x322c6c,_0x1acabb){return _0x322c6c['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xa13e('0xb'),'fields':[_0xa13e('0xb')]},{'name':_0xa13e('0xc'),'fields':['body'],'type':_0xa13e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2409b2,_0x23ff69,_0x1f0139){var _0x3dac2b=_0x322c6c['models'];var _0x1c0672=_0x2409b2['get']({'plain':!![]});if(_0x1c0672[_0xa13e('0xe')][_0xa13e('0xf')]()==='in'||_0x1c0672[_0xa13e('0xe')][_0xa13e('0xf')]()===_0xa13e('0x10')&&!_0x1c0672['secret']&&!_[_0xa13e('0x11')](_0x1c0672['UserId'])&&!_[_0xa13e('0x11')](_0x1c0672[_0xa13e('0x12')])){_0x3dac2b['SmsInteraction'][_0xa13e('0x13')]({'where':{'id':_0x1c0672['SmsInteractionId']}})[_0xa13e('0x14')](function(_0x6a18a7){if(_0x6a18a7){_0x6a18a7['update']({'lastMsgAt':_0x1c0672[_0xa13e('0x15')],'lastMsgDirection':_0x1c0672[_0xa13e('0xe')]['toLowerCase']()});}})[_0xa13e('0x16')](function(_0x44c752){console[_0xa13e('0x17')](_0x44c752);});}if(_0x1c0672['direction']==='out'&&!_0x1c0672['secret']){var _0x4e027b;_0x3dac2b['SmsAccount'][_0xa13e('0x18')]({'where':{'id':_0x1c0672[_0xa13e('0x19')]},'raw':!![]})[_0xa13e('0x14')](function(_0x123375){_0x4e027b=_0x123375;if(_0x4e027b&&_0x4e027b[_0xa13e('0x1a')]){switch(_0x4e027b[_0xa13e('0x1a')]){case _0xa13e('0x1b'):var _0x4bdd77=require(_0xa13e('0x1b'));if(_0x4e027b[_0xa13e('0x1c')]&&_0x4e027b['authToken']&&_0x4e027b['phone']){var _0x250844=new _0x4bdd77(_0x4e027b[_0xa13e('0x1c')],_0x4e027b[_0xa13e('0x1d')]);_0x250844[_0xa13e('0x1e')]['create']({'body':_0x1c0672[_0xa13e('0x1f')],'to':_0x1c0672[_0xa13e('0x20')],'from':_0x4e027b[_0xa13e('0x20')],'statusCallback':_0x4e027b[_0xa13e('0x21')]+_0xa13e('0x22')+_0x1c0672['id']+'/status?token='+_0x4e027b[_0xa13e('0x23')]})['then'](function(_0x285113){if(_0x285113[_0xa13e('0x24')]){return _0x2409b2[_0xa13e('0x25')]({'messageId':_0x285113[_0xa13e('0x24')]});}})[_0xa13e('0x16')](function(_0x174744){logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa13e('0x26'),_0xa13e('0x1b'),util[_0xa13e('0x27')](_0x174744,{'showHidden':![],'depth':null}));});}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x1b'),_0xa13e('0x29'));}break;case'skebby':var _0xeb3b3b=_0xa13e('0x2a');if(_0x4e027b['username']&&_0x4e027b['password']){var _0x4b20fb={'recipient':[_0x1c0672[_0xa13e('0x20')]],'message':_0x1c0672[_0xa13e('0x1f')],'message_type':_0x4e027b['smsMethod']};if(_0x4e027b[_0xa13e('0x2b')]&&_0x4e027b[_0xa13e('0x2b')]!=='SI'){_0x4b20fb[_0xa13e('0x2c')]=_0x4e027b['phone'];}var _0x16bb4c={'url':_0xeb3b3b+_0xa13e('0x2d')+_0x4e027b[_0xa13e('0x2e')]+_0xa13e('0x2f')+_0x4e027b[_0xa13e('0x30')],'method':'GET'};rp(_0x16bb4c)[_0xa13e('0x14')](function(_0x171d29){var _0x3d33e5=_0x171d29[_0xa13e('0x31')](';');var _0x569a2e={'user_key':_0x3d33e5[0x0],'session_key':_0x3d33e5[0x1]};_0x16bb4c={'url':_0xeb3b3b+'sms','method':_0xa13e('0x32'),'headers':{'user_key':_0x569a2e[_0xa13e('0x33')],'Session_key':_0x569a2e[_0xa13e('0x34')]},'json':!![],'body':_0x4b20fb};return rp(_0x16bb4c);})[_0xa13e('0x14')](function(_0x40133a){if(_0x40133a[_0xa13e('0x35')]>=0x1){var _0x4e66ae={'messageId':_0x40133a[_0xa13e('0x36')]};if(_0x4e027b[_0xa13e('0x2b')]!=='GP'||!_0x4e027b['deliveryReport']){_0x4e66ae['read']=!![];}return _0x2409b2['update'](_0x4e66ae);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa13e('0x26'),_0xa13e('0x37'),util[_0xa13e('0x27')](_0x40133a,{'showHidden':![],'depth':null}));}})[_0xa13e('0x16')](function(_0x46e0a1){return logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0xa13e('0x27')](_0x46e0a1,{'showHidden':![],'depth':null}));});}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x4e027b['authToken']){var _0x43b40d={'recipient':_0x1c0672[_0xa13e('0x20')],'message':_0x1c0672[_0xa13e('0x1f')],'sender':_0x4e027b[_0xa13e('0x38')]||_0x4e027b['phone'],'authorization':_0x4e027b[_0xa13e('0x1d')]};var _0x23ff69={'method':'POST','uri':_0xa13e('0x39'),'body':_0x43b40d,'json':!![]};rp(_0x23ff69)['then'](function(_0x20b85c){var _0xfd4693={'messageId':_0x20b85c[_0xa13e('0x3a')]};if(!_0x4e027b[_0xa13e('0x3b')]){_0xfd4693[_0xa13e('0x3c')]=!![];}return _0x2409b2['update'](_0xfd4693);})[_0xa13e('0x16')](function(_0x253097){logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa13e('0x26'),_0xa13e('0x3d'),util['inspect'](_0x253097,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa13e('0x3d'),_0xa13e('0x3e'));}break;case _0xa13e('0x3f'):if(_0x4e027b[_0xa13e('0x2e')]&&_0x4e027b[_0xa13e('0x30')]){var _0x43b40d={'messages':[{'source':_0xa13e('0x40'),'to':_0x1c0672[_0xa13e('0x20')],'body':_0x1c0672[_0xa13e('0x1f')],'from':_0x4e027b[_0xa13e('0x38')]||_0x4e027b[_0xa13e('0x20')]}]};var _0x18be8d=util[_0xa13e('0x41')](_0xa13e('0x42'),_0x4e027b[_0xa13e('0x2e')],_0x4e027b[_0xa13e('0x30')]);var _0x23ff69={'method':_0xa13e('0x32'),'uri':_0xa13e('0x43'),'body':_0x43b40d,'headers':{'Authorization':util[_0xa13e('0x41')](_0xa13e('0x44'),new Buffer(_0x18be8d)[_0xa13e('0x45')]('base64'))},'json':!![]};rp(_0x23ff69)[_0xa13e('0x14')](function(_0x4e9b5a){if(_0x4e9b5a[_0xa13e('0x46')]>=0xc8&&_0x4e9b5a[_0xa13e('0x46')]<=0xce){if(_0x4e9b5a[_0xa13e('0x47')]&&_0x4e9b5a['data'][_0xa13e('0x48')]>0x0){var _0x515a02=_[_0xa13e('0x49')](_0x4e9b5a[_0xa13e('0x47')][_0xa13e('0x1e')]);var _0x176f95={'messageId':_0x515a02[_0xa13e('0x4a')]};if(!_0x4e027b[_0xa13e('0x3b')]){_0x176f95[_0xa13e('0x3c')]=!![];}return _0x2409b2[_0xa13e('0x25')](_0x176f95);}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),'afterCreate',_0xa13e('0x4b'),util['inspect'](_0x4e9b5a,{'showHidden':![],'depth':null}));}}else{logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa13e('0x4b'),util[_0xa13e('0x27')](_0x4e9b5a,{'showHidden':![],'depth':null}));}})[_0xa13e('0x16')](function(_0x58e43c){logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa13e('0x4b'),util[_0xa13e('0x27')](_0x58e43c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x4b'),_0xa13e('0x4c'));}break;case _0xa13e('0x4d'):if(_0x4e027b[_0xa13e('0x4e')]&&_0x4e027b[_0xa13e('0x1d')]){var _0x43b40d={'dst':_0x1c0672[_0xa13e('0x20')],'text':_0x1c0672['body'],'src':_0x4e027b[_0xa13e('0x38')]||_0x4e027b[_0xa13e('0x20')],'url':_0x4e027b['remote']+_0xa13e('0x22')+_0x1c0672['id']+_0xa13e('0x4f')+_0x4e027b[_0xa13e('0x23')]};var _0x18be8d=util[_0xa13e('0x41')](_0xa13e('0x42'),_0x4e027b['authId'],_0x4e027b[_0xa13e('0x1d')]);var _0x23ff69={'method':_0xa13e('0x32'),'uri':util[_0xa13e('0x41')](_0xa13e('0x50'),_0x4e027b[_0xa13e('0x4e')]),'body':_0x43b40d,'headers':{'Authorization':util['format'](_0xa13e('0x44'),new Buffer(_0x18be8d)['toString'](_0xa13e('0x51')))},'json':!![]};rp(_0x23ff69)['then'](function(_0x16facc){var _0x3a831d={'messageId':_0x16facc['message_uuid'][0x0]};return _0x2409b2['update'](_0x3a831d);})[_0xa13e('0x16')](function(_0x5becfc){logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa13e('0x26'),_0xa13e('0x4d'),util['inspect'](_0x5becfc,{'showHidden':![],'depth':null}));});}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x4d'),_0xa13e('0x52'));}break;case _0xa13e('0x53'):if(_0x4e027b[_0xa13e('0x2e')]&&_0x4e027b['password']){if(_0x4e027b[_0xa13e('0x54')]){var _0x44ebce={'method':_0xa13e('0x32'),'uri':_0x4e027b[_0xa13e('0x54')]+'/auth/1/session','body':{'username':_0x4e027b[_0xa13e('0x2e')],'password':_0x4e027b[_0xa13e('0x30')]},'json':!![]};return rp(_0x44ebce)[_0xa13e('0x14')](function(_0x536b37){var _0x12c973={'method':_0xa13e('0x32'),'uri':_0x4e027b[_0xa13e('0x54')]+_0xa13e('0x55'),'body':{'messages':[{'from':_0x4e027b['phone'],'destinations':[{'to':_0x1c0672[_0xa13e('0x20')]}],'text':_0x1c0672[_0xa13e('0x1f')],'notifyUrl':_0x4e027b[_0xa13e('0x21')]+_0xa13e('0x22')+_0x1c0672['id']+'/status?token='+_0x4e027b[_0xa13e('0x23')],'notifyContentType':_0xa13e('0x56'),'callbackData':_0x4e027b[_0xa13e('0x20')]+';'+_0x1c0672['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x536b37[_0xa13e('0x23')]},'json':!![]};return rp(_0x12c973)[_0xa13e('0x14')](function(_0x20b37c){if(_0x20b37c[_0xa13e('0x1e')]){var _0x1cc5be={'messageId':_0x20b37c[_0xa13e('0x1e')][0x0]['messageId']};if(!_0x4e027b[_0xa13e('0x3b')]){_0x1cc5be[_0xa13e('0x3c')]=!![];}return _0x2409b2[_0xa13e('0x25')](_0x1cc5be);}else{return logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa13e('0x53'),util['inspect'](_0x20b37c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0xa8dd7f){return logger['error'](_0xa13e('0x28'),'afterCreate',_0xa13e('0x53'),util[_0xa13e('0x27')](_0xa8dd7f,{'showHidden':![],'depth':null}));});}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x53'),_0xa13e('0x57'));}}else{logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa13e('0x53'),_0xa13e('0x4c'));}break;case _0xa13e('0x58'):var _0x1b3ec1=require(_0xa13e('0x59'));if(_0x4e027b[_0xa13e('0x5a')]){var _0x46e7a7={};_0x46e7a7['login']=_0x4e027b[_0xa13e('0x2e')];_0x46e7a7['phone']=_0x1c0672[_0xa13e('0x20')];_0x46e7a7[_0xa13e('0x2c')]=_0x4e027b[_0xa13e('0x20')];_0x46e7a7[_0xa13e('0x5b')]=_0x1c0672[_0xa13e('0x1f')];_0x46e7a7['timestamp']=+new Date();var _0x482ffc='';var _0x5103d4='';var _0x357a2c=Object[_0xa13e('0x5c')](_0x46e7a7);_0x357a2c['sort']();for(var _0x1fa7bd=0x0;_0x1fa7bd<_0x357a2c[_0xa13e('0x5d')];_0x1fa7bd++){if(_0x482ffc!=''){_0x482ffc+='&';}_0x482ffc+=_0x357a2c[_0x1fa7bd]+'='+encodeURIComponent(_0x46e7a7[_0x357a2c[_0x1fa7bd]]);_0x5103d4+=_0x46e7a7[_0x357a2c[_0x1fa7bd]];}_0x5103d4+=_0x4e027b[_0xa13e('0x5a')];_0x5103d4=_0x1b3ec1[_0xa13e('0x5e')](_0xa13e('0x5f'))[_0xa13e('0x25')](_0x5103d4)['digest'](_0xa13e('0x60'));if(_0x482ffc!==''){_0x482ffc+='&';}_0x482ffc+=_0xa13e('0x61')+_0x5103d4;var _0x16bb4c={'method':_0xa13e('0x62'),'uri':_0x4e027b['baseUrl']+'/external/get/send.php?'+_0x482ffc,'json':!![]};return rp(_0x16bb4c)[_0xa13e('0x14')](function(_0x30b3db){var _0x111ec5=Object[_0xa13e('0x5c')](_0x30b3db);if(_0x30b3db[_0x111ec5[0x0]][_0xa13e('0x17')]&&parseInt(_0x30b3db[_0x111ec5[0x0]][_0xa13e('0x17')])===0x0){var _0x55a27a={'messageId':_0x30b3db[_0x111ec5[0x0]][_0xa13e('0x63')]};if(!_0x4e027b[_0xa13e('0x3b')]){_0x55a27a[_0xa13e('0x3c')]=!![];}return _0x2409b2[_0xa13e('0x25')](_0x55a27a);}else{return logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa13e('0x26'),_0xa13e('0x58'),util[_0xa13e('0x27')](_0x30b3db['error'],{'showHidden':![],'depth':null}));}})[_0xa13e('0x16')](function(_0x180fcc){return logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x58'),util[_0xa13e('0x27')](_0x180fcc,{'showHidden':![],'depth':null}));});}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),'afterCreate',_0xa13e('0x58'),_0xa13e('0x64'));}break;case _0xa13e('0x65'):if(_0x4e027b[_0xa13e('0x5a')]){var _0x2b2749={'method':_0xa13e('0x32'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4e027b[_0xa13e('0x5a')]},'body':{'content':_0x1c0672[_0xa13e('0x1f')],'to':[_0x1c0672[_0xa13e('0x20')]],'from':_0x4e027b[_0xa13e('0x20')],'binary':![],'clientMessageId':_0xa13e('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x2b2749)['then'](function(_0x2ac0b7){if(!_0x2ac0b7[_0xa13e('0x17')]){var _0x3e6bd2={'messageId':_0x2ac0b7[_0xa13e('0x1e')][0x0][_0xa13e('0x67')]};if(!_0x4e027b[_0xa13e('0x3b')]){_0x3e6bd2[_0xa13e('0x3c')]=!![];}return _0x2409b2[_0xa13e('0x25')](_0x3e6bd2);}else{return logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x65'),util[_0xa13e('0x27')](_0x2ac0b7[_0xa13e('0x17')],{'showHidden':![],'depth':null}));}})[_0xa13e('0x16')](function(_0x24200d){return logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x65'),util[_0xa13e('0x27')](_0x24200d,{'showHidden':![],'depth':null}));});}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),'clickatell',_0xa13e('0x64'));}break;case'bandwidth':if(_0x4e027b[_0xa13e('0x2e')]&&_0x4e027b['password']){var _0x18be8d=util[_0xa13e('0x41')](_0xa13e('0x42'),_0x4e027b[_0xa13e('0x2e')],_0x4e027b[_0xa13e('0x30')]);var _0x23ff69={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x4e027b[_0xa13e('0x68')]+_0xa13e('0x69'),'body':{'to':[_0x1c0672[_0xa13e('0x20')]],'text':_0x1c0672[_0xa13e('0x1f')],'from':_0x4e027b[_0xa13e('0x20')],'applicationId':_0x4e027b[_0xa13e('0x6a')]},'headers':{'Authorization':util[_0xa13e('0x41')]('Basic\x20%s',new Buffer(_0x18be8d)[_0xa13e('0x45')](_0xa13e('0x51')))},'json':!![]};rp(_0x23ff69)['then'](function(_0x3b3c4f){if(_0x3b3c4f['id']){var _0x2e46ff={'messageId':_0x3b3c4f['id']};return _0x2409b2[_0xa13e('0x25')](_0x2e46ff);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa13e('0x6b'),util[_0xa13e('0x27')](_0x3b3c4f,{'showHidden':![],'depth':null}));}})[_0xa13e('0x16')](function(_0x2aaea0){logger['error'](_0xa13e('0x28'),_0xa13e('0x26'),'bandwidth',util['inspect'](_0x2aaea0,{'showHidden':![],'depth':null}));});}else{logger[_0xa13e('0x17')](_0xa13e('0x28'),'afterCreate',_0xa13e('0x6b'),_0xa13e('0x4c'));}break;case _0xa13e('0x6c'):if(_0x4e027b[_0xa13e('0x5a')]){var _0x563a18={};var _0x16bb4c={'method':_0xa13e('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xa13e('0x6d')+_0x4e027b[_0xa13e('0x5a')],'Content-Type':_0xa13e('0x56')},'body':{'from':_0x4e027b[_0xa13e('0x20')],'to':_0x1c0672['phone'],'text':_0x1c0672[_0xa13e('0x1f')]},'json':!![]};return rp(_0x16bb4c)[_0xa13e('0x14')](function(_0x29e251){if(_0x29e251[_0xa13e('0x6e')]==0xca){_0x563a18[_0xa13e('0x6f')]=_0x29e251;var _0x5df536={'method':_0xa13e('0x32'),'uri':_0xa13e('0x70'),'headers':{'Authorization':_0xa13e('0x6d')+_0x4e027b['apiKey'],'Content-Type':_0xa13e('0x56')},'body':{'refid':_0x563a18['message'][_0xa13e('0x71')]},'json':!![]};return rp(_0x5df536)['then'](function(_0x427868){_0x563a18[_0xa13e('0x72')]=_0x427868;var _0x45446f={'messageId':_0x563a18[_0xa13e('0x6f')][_0xa13e('0x71')],'read':!![]};return _0x2409b2[_0xa13e('0x25')](_0x45446f);});}else{return logger[_0xa13e('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa13e('0x26'),_0xa13e('0x6c'),util[_0xa13e('0x27')](_0x29e251,{'showHidden':![],'depth':null}));}})[_0xa13e('0x16')](function(_0x3d2826){return logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),_0xa13e('0x6c'),util[_0xa13e('0x27')](_0x3d2826,{'showHidden':![],'depth':null}));});}else{return logger[_0xa13e('0x17')](_0xa13e('0x28'),_0xa13e('0x26'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xa13e('0x73')](function(){_0x1f0139();});}else{_0x1f0139();}}},'charset':_0xa13e('0x74'),'collate':_0xa13e('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c32d226..4188f6d 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 _0x757d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util'];(function(_0x249862,_0x22ad39){var _0xcc638a=function(_0x4c0858){while(--_0x4c0858){_0x249862['push'](_0x249862['shift']());}};_0xcc638a(++_0x22ad39);}(_0x757d,0x65));var _0xd757=function(_0x20a137,_0x4d9549){_0x20a137=_0x20a137-0x0;var _0x3dc414=_0x757d[_0x20a137];return _0x3dc414;};'use strict';var _=require('lodash');var util=require(_0xd757('0x0'));var moment=require(_0xd757('0x1'));var BPromise=require(_0xd757('0x2'));var rs=require(_0xd757('0x3'));var fs=require('fs');var Redis=require(_0xd757('0x4'));var db=require(_0xd757('0x5'))['db'];var utils=require(_0xd757('0x6'));var logger=require(_0xd757('0x7'))(_0xd757('0x8'));var config=require(_0xd757('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd757('0xa')][_0xd757('0xb')]({'port':0x232a});config[_0xd757('0xc')]=_['defaults'](config[_0xd757('0xc')],{'host':_0xd757('0xd'),'port':0x18eb});var socket=require(_0xd757('0xe'))(new Redis(config['redis']));require(_0xd757('0xf'))[_0xd757('0x10')](socket);function respondWithRpcPromise(_0x107fef,_0x2725fc,_0x28eaf2){return new BPromise(function(_0x1dc3d6,_0x4da76c){return client[_0xd757('0x11')](_0x107fef,_0x28eaf2)[_0xd757('0x12')](function(_0x1d48eb){logger[_0xd757('0x13')](_0xd757('0x14'),_0x2725fc,_0xd757('0x15'));logger[_0xd757('0x16')](_0xd757('0x17'),_0x2725fc,_0xd757('0x15'),JSON[_0xd757('0x18')](_0x1d48eb));if(_0x1d48eb['error']){if(_0x1d48eb['error']['code']===0x1f4){logger[_0xd757('0x19')](_0xd757('0x14'),_0x2725fc,_0x1d48eb[_0xd757('0x19')][_0xd757('0x1a')]);return _0x4da76c(_0x1d48eb[_0xd757('0x19')]['message']);}logger[_0xd757('0x19')](_0xd757('0x14'),_0x2725fc,_0x1d48eb[_0xd757('0x19')][_0xd757('0x1a')]);return _0x1dc3d6(_0x1d48eb['error']['message']);}else{logger[_0xd757('0x13')](_0xd757('0x14'),_0x2725fc,_0xd757('0x15'));_0x1dc3d6(_0x1d48eb['result'][_0xd757('0x1a')]);}})[_0xd757('0x1b')](function(_0x57b4a1){logger['error'](_0xd757('0x14'),_0x2725fc,_0x57b4a1);_0x4da76c(_0x57b4a1);});});}exports['CreateSmsMessage']=function(_0x16ca86){var _0x192a11=this;return new Promise(function(_0x379601,_0x2b0b29){return db[_0xd757('0x1c')][_0xd757('0x1d')](_0x16ca86[_0xd757('0x1e')],{'raw':_0x16ca86[_0xd757('0x1f')]?_0x16ca86[_0xd757('0x1f')][_0xd757('0x20')]===undefined?!![]:![]:!![]})[_0xd757('0x12')](function(_0x276c2d){logger[_0xd757('0x13')](_0xd757('0x21'),_0x16ca86);logger[_0xd757('0x16')](_0xd757('0x21'),_0x16ca86,JSON[_0xd757('0x18')](_0x276c2d));_0x379601(_0x276c2d);})[_0xd757('0x1b')](function(_0x365a3a){logger['error'](_0xd757('0x21'),_0x365a3a['message'],_0x16ca86);_0x2b0b29(_0x192a11[_0xd757('0x19')](0x1f4,_0x365a3a['message']));});});}; \ No newline at end of file +var _0x4e51=['register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter'];(function(_0x2a5f91,_0x160515){var _0xbeb660=function(_0x181226){while(--_0x181226){_0x2a5f91['push'](_0x2a5f91['shift']());}};_0xbeb660(++_0x160515);}(_0x4e51,0xe4));var _0x14e5=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x4e51[_0x650e11];return _0x1a9b47;};'use strict';var _=require(_0x14e5('0x0'));var util=require(_0x14e5('0x1'));var moment=require(_0x14e5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14e5('0x3'));var db=require(_0x14e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x14e5('0x5'))(_0x14e5('0x6'));var config=require(_0x14e5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x14e5('0x8')]({'port':0x232a});config[_0x14e5('0x9')]=_['defaults'](config['redis'],{'host':_0x14e5('0xa'),'port':0x18eb});var socket=require(_0x14e5('0xb'))(new Redis(config[_0x14e5('0x9')]));require('./smsMessage.socket')[_0x14e5('0xc')](socket);function respondWithRpcPromise(_0xc89846,_0x3a560d,_0x3452b7){return new BPromise(function(_0x2f2fb9,_0x39b0d8){return client['request'](_0xc89846,_0x3452b7)[_0x14e5('0xd')](function(_0x228951){logger[_0x14e5('0xe')](_0x14e5('0xf'),_0x3a560d,_0x14e5('0x10'));logger[_0x14e5('0x11')](_0x14e5('0x12'),_0x3a560d,'request\x20sent',JSON['stringify'](_0x228951));if(_0x228951[_0x14e5('0x13')]){if(_0x228951[_0x14e5('0x13')][_0x14e5('0x14')]===0x1f4){logger[_0x14e5('0x13')](_0x14e5('0xf'),_0x3a560d,_0x228951['error'][_0x14e5('0x15')]);return _0x39b0d8(_0x228951[_0x14e5('0x13')][_0x14e5('0x15')]);}logger['error'](_0x14e5('0xf'),_0x3a560d,_0x228951['error']['message']);return _0x2f2fb9(_0x228951[_0x14e5('0x13')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x3a560d,_0x14e5('0x10'));_0x2f2fb9(_0x228951[_0x14e5('0x16')][_0x14e5('0x15')]);}})['catch'](function(_0x3d8e37){logger['error'](_0x14e5('0xf'),_0x3a560d,_0x3d8e37);_0x39b0d8(_0x3d8e37);});});}exports[_0x14e5('0x17')]=function(_0x55242d){var _0x3b7826=this;return new Promise(function(_0x37f76c,_0x3e1728){return db[_0x14e5('0x18')][_0x14e5('0x19')](_0x55242d[_0x14e5('0x1a')],{'raw':_0x55242d[_0x14e5('0x1b')]?_0x55242d[_0x14e5('0x1b')][_0x14e5('0x1c')]===undefined?!![]:![]:!![]})[_0x14e5('0xd')](function(_0x472428){logger[_0x14e5('0xe')](_0x14e5('0x17'),_0x55242d);logger[_0x14e5('0x11')](_0x14e5('0x17'),_0x55242d,JSON['stringify'](_0x472428));_0x37f76c(_0x472428);})[_0x14e5('0x1d')](function(_0x19a524){logger['error'](_0x14e5('0x17'),_0x19a524[_0x14e5('0x15')],_0x55242d);_0x3e1728(_0x3b7826[_0x14e5('0x13')](0x1f4,_0x19a524['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7110c6a..2e40087 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 _0x9807=['update','emit','removeListener','register','./smsMessage.events','save'];(function(_0x3347ed,_0x5e569b){var _0x5d4dcb=function(_0x140baa){while(--_0x140baa){_0x3347ed['push'](_0x3347ed['shift']());}};_0x5d4dcb(++_0x5e569b);}(_0x9807,0x11e));var _0x7980=function(_0x2fac53,_0x14b60a){_0x2fac53=_0x2fac53-0x0;var _0x4a17dd=_0x9807[_0x2fac53];return _0x4a17dd;};'use strict';var SmsMessageEvents=require(_0x7980('0x0'));var events=[_0x7980('0x1'),'remove',_0x7980('0x2')];function createListener(_0x3057f8,_0x4bc0b3){return function(_0x2187e5){_0x4bc0b3[_0x7980('0x3')](_0x3057f8,_0x2187e5);};}function removeListener(_0x579e49,_0x40c1df){return function(){SmsMessageEvents[_0x7980('0x4')](_0x579e49,_0x40c1df);};}exports[_0x7980('0x5')]=function(_0x53d0db){for(var _0x4a40c6=0x0,_0x41d360=events['length'];_0x4a40c6<_0x41d360;_0x4a40c6++){var _0x85cb45=events[_0x4a40c6];var _0x2c43b7=createListener('smsMessage:'+_0x85cb45,_0x53d0db);SmsMessageEvents['on'](_0x85cb45,_0x2c43b7);}}; \ No newline at end of file +var _0xf44c=['./smsMessage.events','remove','update','length','smsMessage:'];(function(_0x449631,_0x5d2162){var _0x1f8b6e=function(_0x11bbbf){while(--_0x11bbbf){_0x449631['push'](_0x449631['shift']());}};_0x1f8b6e(++_0x5d2162);}(_0xf44c,0x163));var _0xcf44=function(_0x132c41,_0x35bacb){_0x132c41=_0x132c41-0x0;var _0x213594=_0xf44c[_0x132c41];return _0x213594;};'use strict';var SmsMessageEvents=require(_0xcf44('0x0'));var events=['save',_0xcf44('0x1'),_0xcf44('0x2')];function createListener(_0x7463be,_0x248e58){return function(_0x21583b){_0x248e58['emit'](_0x7463be,_0x21583b);};}function removeListener(_0x4f7d81,_0x55c2c3){return function(){SmsMessageEvents['removeListener'](_0x4f7d81,_0x55c2c3);};}exports['register']=function(_0x14485c){for(var _0x3b1eb0=0x0,_0x36fe32=events[_0xcf44('0x3')];_0x3b1eb0<_0x36fe32;_0x3b1eb0++){var _0x3fe761=events[_0x3b1eb0];var _0x374379=createListener(_0xcf44('0x4')+_0x3fe761,_0x14485c);SmsMessageEvents['on'](_0x3fe761,_0x374379);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7a11fba..bdad710 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 _0x1479=['delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update'];(function(_0x2c2e74,_0x5e8ebf){var _0x50db91=function(_0xfa65e3){while(--_0xfa65e3){_0x2c2e74['push'](_0x2c2e74['shift']());}};_0x50db91(++_0x5e8ebf);}(_0x1479,0x14e));var _0x9147=function(_0x4a3103,_0x3417bd){_0x4a3103=_0x4a3103-0x0;var _0x780cea=_0x1479[_0x4a3103];return _0x780cea;};'use strict';var multer=require(_0x9147('0x0'));var util=require(_0x9147('0x1'));var path=require(_0x9147('0x2'));var timeout=require(_0x9147('0x3'));var express=require(_0x9147('0x4'));var router=express[_0x9147('0x5')]();var fs_extra=require(_0x9147('0x6'));var auth=require(_0x9147('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9147('0x8'));var controller=require(_0x9147('0x9'));router[_0x9147('0xa')]('/',auth[_0x9147('0xb')](),controller[_0x9147('0xc')]);router[_0x9147('0xa')](_0x9147('0xd'),auth[_0x9147('0xb')](),controller[_0x9147('0xe')]);router[_0x9147('0xa')](_0x9147('0xf'),auth[_0x9147('0xb')](),controller['show']);router[_0x9147('0xa')](_0x9147('0x10'),auth['isAuthenticated'](),controller[_0x9147('0x11')]);router[_0x9147('0xa')](_0x9147('0x12'),auth[_0x9147('0xb')](),controller['getTeams']);router[_0x9147('0xa')](_0x9147('0x13'),auth[_0x9147('0xb')](),controller['getAgents']);router[_0x9147('0x14')]('/',auth['isAuthenticated'](),controller[_0x9147('0x15')]);router[_0x9147('0x14')](_0x9147('0x12'),auth['isAuthenticated'](),controller[_0x9147('0x16')]);router['post'](_0x9147('0x13'),auth[_0x9147('0xb')](),controller[_0x9147('0x17')]);router[_0x9147('0x18')](_0x9147('0xf'),auth[_0x9147('0xb')](),controller[_0x9147('0x19')]);router[_0x9147('0x1a')](_0x9147('0xf'),auth[_0x9147('0xb')](),controller['destroy']);router['delete'](_0x9147('0x12'),auth[_0x9147('0xb')](),controller[_0x9147('0x1b')]);router[_0x9147('0x1a')](_0x9147('0x13'),auth[_0x9147('0xb')](),controller[_0x9147('0x1c')]);module[_0x9147('0x1d')]=router; \ No newline at end of file +var _0xb008=['update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id'];(function(_0x1d4127,_0x1db1af){var _0x58248e=function(_0xe0c1c4){while(--_0xe0c1c4){_0x1d4127['push'](_0x1d4127['shift']());}};_0x58248e(++_0x1db1af);}(_0xb008,0x71));var _0x8b00=function(_0x2f446e,_0x4eb26d){_0x2f446e=_0x2f446e-0x0;var _0x4aec1f=_0xb008[_0x2f446e];return _0x4aec1f;};'use strict';var multer=require(_0x8b00('0x0'));var util=require(_0x8b00('0x1'));var path=require(_0x8b00('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b00('0x3'));var router=express[_0x8b00('0x4')]();var fs_extra=require(_0x8b00('0x5'));var auth=require(_0x8b00('0x6'));var interaction=require(_0x8b00('0x7'));var config=require('../../config/environment');var controller=require(_0x8b00('0x8'));router['get']('/',auth[_0x8b00('0x9')](),controller[_0x8b00('0xa')]);router[_0x8b00('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8b00('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8b00('0xb')](_0x8b00('0xc'),auth[_0x8b00('0x9')](),controller[_0x8b00('0xd')]);router['get'](_0x8b00('0xe'),auth[_0x8b00('0x9')](),controller['getTeams']);router[_0x8b00('0xb')](_0x8b00('0xf'),auth[_0x8b00('0x9')](),controller[_0x8b00('0x10')]);router[_0x8b00('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8b00('0x11')](_0x8b00('0xe'),auth[_0x8b00('0x9')](),controller[_0x8b00('0x12')]);router['post']('/:id/users',auth[_0x8b00('0x9')](),controller[_0x8b00('0x13')]);router[_0x8b00('0x14')](_0x8b00('0x15'),auth[_0x8b00('0x9')](),controller[_0x8b00('0x16')]);router[_0x8b00('0x17')](_0x8b00('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0x8b00('0x17')](_0x8b00('0xe'),auth[_0x8b00('0x9')](),controller[_0x8b00('0x18')]);router[_0x8b00('0x17')](_0x8b00('0xf'),auth[_0x8b00('0x9')](),controller[_0x8b00('0x19')]);module[_0x8b00('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c4d71ed..4d0b431 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 _0x609c=['STRING','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x609c,0x1e4));var _0xc609=function(_0x502e47,_0x535f0d){_0x502e47=_0x502e47-0x0;var _0x11a93a=_0x609c[_0x502e47];return _0x11a93a;};'use strict';var Sequelize=require(_0xc609('0x0'));module[_0xc609('0x1')]={'name':{'type':Sequelize[_0xc609('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc609('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc609('0x3')](_0xc609('0x4'),_0xc609('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x5a7f=['INTEGER','roundrobin','STRING'];(function(_0x3ee901,_0x3f455b){var _0x35d50c=function(_0x5a07a0){while(--_0x5a07a0){_0x3ee901['push'](_0x3ee901['shift']());}};_0x35d50c(++_0x3f455b);}(_0x5a7f,0x1af));var _0xf5a7=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x5a7f[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf5a7('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf5a7('0x0')]},'timeout':{'type':Sequelize[_0xf5a7('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xf5a7('0x2'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 09b4856..7d15b7e 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 _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x205b6a,_0x426c63){var _0x2d8e62=function(_0x417a6b){while(--_0x417a6b){_0x205b6a['push'](_0x205b6a['shift']());}};_0x2d8e62(++_0x426c63);}(_0x2ef3,0xba));var _0x32ef=function(_0x1e1d10,_0x986873){_0x1e1d10=_0x1e1d10-0x0;var _0x2fcb97=_0x2ef3[_0x1e1d10];return _0x2fcb97;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0xadb5,0xad));var _0x5adb=function(_0x7484cd,_0x2ef3e0){_0x7484cd=_0x7484cd-0x0;var _0x3c9c2d=_0xadb5[_0x7484cd];return _0x3c9c2d;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2a0cf45..4fc7820 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 _0x3ccb=['SmsQueue','setMaxListeners','emit','hook','events'];(function(_0x30a528,_0x1d04f2){var _0x3e029c=function(_0x4e4b97){while(--_0x4e4b97){_0x30a528['push'](_0x30a528['shift']());}};_0x3e029c(++_0x1d04f2);}(_0x3ccb,0xdb));var _0xb3cc=function(_0x1f4fe3,_0x5b660b){_0x1f4fe3=_0x1f4fe3-0x0;var _0xe8dd52=_0x3ccb[_0x1f4fe3];return _0xe8dd52;};'use strict';var EventEmitter=require(_0xb3cc('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xb3cc('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb3cc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4d4618){return function(_0x29bf24,_0x1ac04d,_0x18d24c){SmsQueueEvents[_0xb3cc('0x3')](_0x4d4618+':'+_0x29bf24['id'],_0x29bf24);SmsQueueEvents['emit'](_0x4d4618,_0x29bf24);_0x18d24c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xb3cc('0x4')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x6f78=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue'];(function(_0x39979b,_0x2111f9){var _0x560b41=function(_0x859cc0){while(--_0x859cc0){_0x39979b['push'](_0x39979b['shift']());}};_0x560b41(++_0x2111f9);}(_0x6f78,0x129));var _0x86f7=function(_0xe720e3,_0x34a17a){_0xe720e3=_0xe720e3-0x0;var _0x298342=_0x6f78[_0xe720e3];return _0x298342;};'use strict';var EventEmitter=require(_0x86f7('0x0'));var SmsQueue=require(_0x86f7('0x1'))['db'][_0x86f7('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x86f7('0x3')](0x0);var events={'afterCreate':_0x86f7('0x4'),'afterUpdate':_0x86f7('0x5'),'afterDestroy':_0x86f7('0x6')};function emitEvent(_0x2a4a01){return function(_0x19b2f4,_0x1026cd,_0x4387b8){SmsQueueEvents[_0x86f7('0x7')](_0x2a4a01+':'+_0x19b2f4['id'],_0x19b2f4);SmsQueueEvents[_0x86f7('0x7')](_0x2a4a01,_0x19b2f4);_0x4387b8(null);};}for(var e in events){if(events[_0x86f7('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x86f7('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 6858530..8a39ad6 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 _0x4a3d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue','lodash','../../config/logger'];(function(_0x2d35b5,_0x520c90){var _0x333e77=function(_0x260f8a){while(--_0x260f8a){_0x2d35b5['push'](_0x2d35b5['shift']());}};_0x333e77(++_0x520c90);}(_0x4a3d,0x111));var _0xd4a3=function(_0x4e4eff,_0x59e6f8){_0x4e4eff=_0x4e4eff-0x0;var _0x181d13=_0x4a3d[_0x4e4eff];return _0x181d13;};'use strict';var _=require(_0xd4a3('0x0'));var util=require('util');var logger=require(_0xd4a3('0x1'))('api');var moment=require(_0xd4a3('0x2'));var BPromise=require(_0xd4a3('0x3'));var rp=require(_0xd4a3('0x4'));var fs=require('fs');var path=require(_0xd4a3('0x5'));var rimraf=require(_0xd4a3('0x6'));var config=require(_0xd4a3('0x7'));var attributes=require('./smsQueue.attributes');module[_0xd4a3('0x8')]=function(_0x6b01bb,_0x19d36c){return _0x6b01bb[_0xd4a3('0x9')](_0xd4a3('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x948f=['./smsQueue.attributes','define','util','api','moment','request-promise','../../config/environment'];(function(_0x2a7ff6,_0x30b523){var _0x80f40f=function(_0x1e0be2){while(--_0x1e0be2){_0x2a7ff6['push'](_0x2a7ff6['shift']());}};_0x80f40f(++_0x30b523);}(_0x948f,0x152));var _0xf948=function(_0x3b541e,_0x14a851){_0x3b541e=_0x3b541e-0x0;var _0x1b54ae=_0x948f[_0x3b541e];return _0x1b54ae;};'use strict';var _=require('lodash');var util=require(_0xf948('0x0'));var logger=require('../../config/logger')(_0xf948('0x1'));var moment=require(_0xf948('0x2'));var BPromise=require('bluebird');var rp=require(_0xf948('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf948('0x4'));var attributes=require(_0xf948('0x5'));module['exports']=function(_0x1c4381,_0x113ad5){return _0x1c4381[_0xf948('0x6')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 1a5f1d1..99fe494 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 _0x79c4=['options','raw','attributes','limit','include','map','model','GetSmsQueue','debug','ShowSmsQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./smsQueue.socket','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue'];(function(_0x493900,_0x552812){var _0x3d8452=function(_0x46d9c5){while(--_0x46d9c5){_0x493900['push'](_0x493900['shift']());}};_0x3d8452(++_0x552812);}(_0x79c4,0x1eb));var _0x479c=function(_0x392c55,_0xb615d5){_0x392c55=_0x392c55-0x0;var _0x3860de=_0x79c4[_0x392c55];return _0x3860de;};'use strict';var _=require(_0x479c('0x0'));var util=require(_0x479c('0x1'));var moment=require(_0x479c('0x2'));var BPromise=require(_0x479c('0x3'));var rs=require(_0x479c('0x4'));var fs=require('fs');var Redis=require(_0x479c('0x5'));var db=require(_0x479c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x479c('0x7'))(_0x479c('0x8'));var config=require(_0x479c('0x9'));var jayson=require(_0x479c('0xa'));var client=jayson[_0x479c('0xb')]['http']({'port':0x232a});config[_0x479c('0xc')]=_['defaults'](config[_0x479c('0xc')],{'host':_0x479c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x479c('0xc')]));require(_0x479c('0xe'))[_0x479c('0xf')](socket);function respondWithRpcPromise(_0x37ee39,_0x469730,_0x136ef6){return new BPromise(function(_0x3d9fcb,_0x45131c){return client[_0x479c('0x10')](_0x37ee39,_0x136ef6)[_0x479c('0x11')](function(_0x54ddaa){logger[_0x479c('0x12')]('SmsQueue,\x20%s,\x20%s',_0x469730,_0x479c('0x13'));logger['debug'](_0x479c('0x14'),_0x469730,_0x479c('0x13'),JSON[_0x479c('0x15')](_0x54ddaa));if(_0x54ddaa[_0x479c('0x16')]){if(_0x54ddaa[_0x479c('0x16')][_0x479c('0x17')]===0x1f4){logger[_0x479c('0x16')](_0x479c('0x18'),_0x469730,_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);return _0x45131c(_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);}logger[_0x479c('0x16')]('SmsQueue,\x20%s,\x20%s',_0x469730,_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);return _0x3d9fcb(_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);}else{logger[_0x479c('0x12')]('SmsQueue,\x20%s,\x20%s',_0x469730,_0x479c('0x13'));_0x3d9fcb(_0x54ddaa[_0x479c('0x1a')][_0x479c('0x19')]);}})[_0x479c('0x1b')](function(_0x526191){logger[_0x479c('0x16')](_0x479c('0x18'),_0x469730,_0x526191);_0x45131c(_0x526191);});});}exports['GetSmsQueue']=function(_0x1c534e){var _0x59d350=this;return new Promise(function(_0x5e6aed,_0x2c4cd9){return db[_0x479c('0x1c')]['findAll']({'raw':_0x1c534e[_0x479c('0x1d')]?_0x1c534e['options'][_0x479c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c534e[_0x479c('0x1d')]?_0x1c534e['options']['where']||null:null,'attributes':_0x1c534e['options']?_0x1c534e[_0x479c('0x1d')][_0x479c('0x1f')]||null:null,'limit':_0x1c534e[_0x479c('0x1d')]?_0x1c534e['options'][_0x479c('0x20')]||null:null,'include':_0x1c534e[_0x479c('0x1d')]?_0x1c534e[_0x479c('0x1d')][_0x479c('0x21')]?_[_0x479c('0x22')](_0x1c534e[_0x479c('0x1d')][_0x479c('0x21')],function(_0x82e19c){return{'model':db[_0x82e19c['model']],'as':_0x82e19c['as'],'attributes':_0x82e19c[_0x479c('0x1f')],'include':_0x82e19c[_0x479c('0x21')]?_[_0x479c('0x22')](_0x82e19c[_0x479c('0x21')],function(_0x479e3d){return{'model':db[_0x479e3d[_0x479c('0x23')]],'as':_0x479e3d['as'],'attributes':_0x479e3d[_0x479c('0x1f')],'include':_0x479e3d[_0x479c('0x21')]?_[_0x479c('0x22')](_0x479e3d[_0x479c('0x21')],function(_0x542105){return{'model':db[_0x542105[_0x479c('0x23')]],'as':_0x542105['as'],'attributes':_0x542105[_0x479c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x479c('0x11')](function(_0x21d287){logger[_0x479c('0x12')](_0x479c('0x24'),_0x1c534e);logger[_0x479c('0x25')]('GetSmsQueue',_0x1c534e,JSON[_0x479c('0x15')](_0x21d287));_0x5e6aed(_0x21d287);})['catch'](function(_0x3f6ec2){logger[_0x479c('0x16')](_0x479c('0x24'),_0x3f6ec2[_0x479c('0x19')],_0x1c534e);_0x2c4cd9(_0x59d350['error'](0x1f4,_0x3f6ec2['message']));});});};exports[_0x479c('0x26')]=function(_0x2bb7ff){var _0xf43590=this;return new Promise(function(_0x2b69ab,_0x214e72){return db[_0x479c('0x1c')]['find']({'raw':_0x2bb7ff[_0x479c('0x1d')]?_0x2bb7ff[_0x479c('0x1d')][_0x479c('0x1e')]===undefined?!![]:![]:!![],'where':_0x2bb7ff['options']?_0x2bb7ff[_0x479c('0x1d')][_0x479c('0x27')]||null:null,'attributes':_0x2bb7ff['options']?_0x2bb7ff['options'][_0x479c('0x1f')]||null:null,'include':_0x2bb7ff[_0x479c('0x1d')]?_0x2bb7ff['options']['include']?_[_0x479c('0x22')](_0x2bb7ff[_0x479c('0x1d')][_0x479c('0x21')],function(_0x2bdc7d){return{'model':db[_0x2bdc7d[_0x479c('0x23')]],'as':_0x2bdc7d['as'],'attributes':_0x2bdc7d[_0x479c('0x1f')],'include':_0x2bdc7d[_0x479c('0x21')]?_[_0x479c('0x22')](_0x2bdc7d[_0x479c('0x21')],function(_0x2b80c6){return{'model':db[_0x2b80c6[_0x479c('0x23')]],'as':_0x2b80c6['as'],'attributes':_0x2b80c6[_0x479c('0x1f')],'include':_0x2b80c6[_0x479c('0x21')]?_[_0x479c('0x22')](_0x2b80c6[_0x479c('0x21')],function(_0x1483ca){return{'model':db[_0x1483ca[_0x479c('0x23')]],'as':_0x1483ca['as'],'attributes':_0x1483ca[_0x479c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x479c('0x11')](function(_0x1af05d){logger[_0x479c('0x12')](_0x479c('0x26'),_0x2bb7ff);logger[_0x479c('0x25')](_0x479c('0x26'),_0x2bb7ff,JSON[_0x479c('0x15')](_0x1af05d));_0x2b69ab(_0x1af05d);})['catch'](function(_0x6a70b7){logger[_0x479c('0x16')](_0x479c('0x26'),_0x6a70b7[_0x479c('0x19')],_0x2bb7ff);_0x214e72(_0xf43590['error'](0x1f4,_0x6a70b7[_0x479c('0x19')]));});});}; \ No newline at end of file +var _0xa048=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','SmsQueue','find','info','ShowSmsQueue'];(function(_0x30dfb0,_0x2d3fbc){var _0x2c3683=function(_0x54b041){while(--_0x54b041){_0x30dfb0['push'](_0x30dfb0['shift']());}};_0x2c3683(++_0x2d3fbc);}(_0xa048,0x126));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8a04('0x0'));var rs=require(_0x8a04('0x1'));var fs=require('fs');var Redis=require(_0x8a04('0x2'));var db=require(_0x8a04('0x3'))['db'];var utils=require(_0x8a04('0x4'));var logger=require(_0x8a04('0x5'))(_0x8a04('0x6'));var config=require(_0x8a04('0x7'));var jayson=require(_0x8a04('0x8'));var client=jayson[_0x8a04('0x9')][_0x8a04('0xa')]({'port':0x232a});config[_0x8a04('0xb')]=_['defaults'](config[_0x8a04('0xb')],{'host':_0x8a04('0xc'),'port':0x18eb});var socket=require(_0x8a04('0xd'))(new Redis(config[_0x8a04('0xb')]));require(_0x8a04('0xe'))[_0x8a04('0xf')](socket);function respondWithRpcPromise(_0x4553a1,_0x335601,_0x1c1fec){return new BPromise(function(_0x4ad40c,_0xf73ae0){return client[_0x8a04('0x10')](_0x4553a1,_0x1c1fec)[_0x8a04('0x11')](function(_0x26fd58){logger['info']('SmsQueue,\x20%s,\x20%s',_0x335601,_0x8a04('0x12'));logger['debug'](_0x8a04('0x13'),_0x335601,'request\x20sent',JSON[_0x8a04('0x14')](_0x26fd58));if(_0x26fd58['error']){if(_0x26fd58[_0x8a04('0x15')][_0x8a04('0x16')]===0x1f4){logger['error'](_0x8a04('0x17'),_0x335601,_0x26fd58['error']['message']);return _0xf73ae0(_0x26fd58[_0x8a04('0x15')][_0x8a04('0x18')]);}logger['error'](_0x8a04('0x17'),_0x335601,_0x26fd58[_0x8a04('0x15')]['message']);return _0x4ad40c(_0x26fd58['error'][_0x8a04('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x335601,_0x8a04('0x12'));_0x4ad40c(_0x26fd58[_0x8a04('0x19')][_0x8a04('0x18')]);}})[_0x8a04('0x1a')](function(_0x47cc41){logger['error'](_0x8a04('0x17'),_0x335601,_0x47cc41);_0xf73ae0(_0x47cc41);});});}exports[_0x8a04('0x1b')]=function(_0x89a863){var _0x1049ca=this;return new Promise(function(_0x2a650f,_0x2287a3){return db['SmsQueue'][_0x8a04('0x1c')]({'raw':_0x89a863[_0x8a04('0x1d')]?_0x89a863[_0x8a04('0x1d')][_0x8a04('0x1e')]===undefined?!![]:![]:!![],'where':_0x89a863[_0x8a04('0x1d')]?_0x89a863[_0x8a04('0x1d')][_0x8a04('0x1f')]||null:null,'attributes':_0x89a863[_0x8a04('0x1d')]?_0x89a863[_0x8a04('0x1d')][_0x8a04('0x20')]||null:null,'limit':_0x89a863[_0x8a04('0x1d')]?_0x89a863[_0x8a04('0x1d')][_0x8a04('0x21')]||null:null,'include':_0x89a863[_0x8a04('0x1d')]?_0x89a863[_0x8a04('0x1d')][_0x8a04('0x22')]?_['map'](_0x89a863[_0x8a04('0x1d')][_0x8a04('0x22')],function(_0x56d34f){return{'model':db[_0x56d34f[_0x8a04('0x23')]],'as':_0x56d34f['as'],'attributes':_0x56d34f['attributes'],'include':_0x56d34f['include']?_[_0x8a04('0x24')](_0x56d34f[_0x8a04('0x22')],function(_0x23a8d0){return{'model':db[_0x23a8d0[_0x8a04('0x23')]],'as':_0x23a8d0['as'],'attributes':_0x23a8d0[_0x8a04('0x20')],'include':_0x23a8d0[_0x8a04('0x22')]?_['map'](_0x23a8d0[_0x8a04('0x22')],function(_0x420ef7){return{'model':db[_0x420ef7[_0x8a04('0x23')]],'as':_0x420ef7['as'],'attributes':_0x420ef7[_0x8a04('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be3ca){logger['info'](_0x8a04('0x1b'),_0x89a863);logger[_0x8a04('0x25')](_0x8a04('0x1b'),_0x89a863,JSON['stringify'](_0x4be3ca));_0x2a650f(_0x4be3ca);})['catch'](function(_0x40e2de){logger['error']('GetSmsQueue',_0x40e2de[_0x8a04('0x18')],_0x89a863);_0x2287a3(_0x1049ca[_0x8a04('0x15')](0x1f4,_0x40e2de[_0x8a04('0x18')]));});});};exports['ShowSmsQueue']=function(_0x12429f){var _0x395810=this;return new Promise(function(_0x16dcb4,_0x5070b3){return db[_0x8a04('0x26')][_0x8a04('0x27')]({'raw':_0x12429f['options']?_0x12429f[_0x8a04('0x1d')][_0x8a04('0x1e')]===undefined?!![]:![]:!![],'where':_0x12429f['options']?_0x12429f[_0x8a04('0x1d')]['where']||null:null,'attributes':_0x12429f['options']?_0x12429f[_0x8a04('0x1d')][_0x8a04('0x20')]||null:null,'include':_0x12429f['options']?_0x12429f[_0x8a04('0x1d')][_0x8a04('0x22')]?_[_0x8a04('0x24')](_0x12429f['options'][_0x8a04('0x22')],function(_0xe5180e){return{'model':db[_0xe5180e[_0x8a04('0x23')]],'as':_0xe5180e['as'],'attributes':_0xe5180e[_0x8a04('0x20')],'include':_0xe5180e[_0x8a04('0x22')]?_[_0x8a04('0x24')](_0xe5180e[_0x8a04('0x22')],function(_0x17bfc9){return{'model':db[_0x17bfc9['model']],'as':_0x17bfc9['as'],'attributes':_0x17bfc9['attributes'],'include':_0x17bfc9[_0x8a04('0x22')]?_['map'](_0x17bfc9[_0x8a04('0x22')],function(_0x4b46a2){return{'model':db[_0x4b46a2['model']],'as':_0x4b46a2['as'],'attributes':_0x4b46a2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16ffd3){logger[_0x8a04('0x28')](_0x8a04('0x29'),_0x12429f);logger[_0x8a04('0x25')](_0x8a04('0x29'),_0x12429f,JSON[_0x8a04('0x14')](_0x16ffd3));_0x16dcb4(_0x16ffd3);})[_0x8a04('0x1a')](function(_0x2701f6){logger[_0x8a04('0x15')](_0x8a04('0x29'),_0x2701f6[_0x8a04('0x18')],_0x12429f);_0x5070b3(_0x395810['error'](0x1f4,_0x2701f6[_0x8a04('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 06b9390..47d14c2 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 _0xa5ee=['save','remove','emit','removeListener','register','smsQueue:','./smsQueue.events'];(function(_0x506b15,_0x4a4eb2){var _0x46175d=function(_0xb21280){while(--_0xb21280){_0x506b15['push'](_0x506b15['shift']());}};_0x46175d(++_0x4a4eb2);}(_0xa5ee,0x180));var _0xea5e=function(_0x3b6fef,_0x5ae452){_0x3b6fef=_0x3b6fef-0x0;var _0x227b3f=_0xa5ee[_0x3b6fef];return _0x227b3f;};'use strict';var SmsQueueEvents=require(_0xea5e('0x0'));var events=[_0xea5e('0x1'),_0xea5e('0x2'),'update'];function createListener(_0x35d0cd,_0x3e7f1a){return function(_0x389b55){_0x3e7f1a[_0xea5e('0x3')](_0x35d0cd,_0x389b55);};}function removeListener(_0x1e404c,_0x27c847){return function(){SmsQueueEvents[_0xea5e('0x4')](_0x1e404c,_0x27c847);};}exports[_0xea5e('0x5')]=function(_0x5e4614){for(var _0x43efae=0x0,_0x3705e4=events['length'];_0x43efae<_0x3705e4;_0x43efae++){var _0x5cec59=events[_0x43efae];var _0x4a497b=createListener(_0xea5e('0x6')+_0x5cec59,_0x5e4614);SmsQueueEvents['on'](_0x5cec59,_0x4a497b);}}; \ No newline at end of file +var _0x22c5=['save','remove','removeListener','register','smsQueue:','./smsQueue.events'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x22c5,0x1d3));var _0x522c=function(_0x4f1fc2,_0x38fc4d){_0x4f1fc2=_0x4f1fc2-0x0;var _0x4e36e1=_0x22c5[_0x4f1fc2];return _0x4e36e1;};'use strict';var SmsQueueEvents=require(_0x522c('0x0'));var events=[_0x522c('0x1'),_0x522c('0x2'),'update'];function createListener(_0x3ea1bf,_0x73b027){return function(_0xa4be54){_0x73b027['emit'](_0x3ea1bf,_0xa4be54);};}function removeListener(_0x394af9,_0x561dd6){return function(){SmsQueueEvents[_0x522c('0x3')](_0x394af9,_0x561dd6);};}exports[_0x522c('0x4')]=function(_0x1fd6eb){for(var _0x11ba5c=0x0,_0x46ce63=events['length'];_0x11ba5c<_0x46ce63;_0x11ba5c++){var _0x4e06b2=events[_0x11ba5c];var _0x42560b=createListener(_0x522c('0x5')+_0x4e06b2,_0x1fd6eb);SmsQueueEvents['on'](_0x4e06b2,_0x42560b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 26efcd6..73aca6b 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 _0xe920=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','post','put','/:id','update','destroy','multer','express','Router','fs-extra'];(function(_0x2918e1,_0x9613bc){var _0x2f5165=function(_0x12d6e2){while(--_0x12d6e2){_0x2918e1['push'](_0x2918e1['shift']());}};_0x2f5165(++_0x9613bc);}(_0xe920,0x11c));var _0x0e92=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xe920[_0x419e17];return _0x1f2044;};'use strict';var multer=require(_0x0e92('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e92('0x1'));var router=express[_0x0e92('0x2')]();var fs_extra=require(_0x0e92('0x3'));var auth=require(_0x0e92('0x4'));var interaction=require(_0x0e92('0x5'));var config=require(_0x0e92('0x6'));var controller=require('./smsQueueReport.controller');router[_0x0e92('0x7')]('/',auth[_0x0e92('0x8')](),controller[_0x0e92('0x9')]);router[_0x0e92('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x0e92('0xa')]);router[_0x0e92('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e92('0xb')]('/',auth[_0x0e92('0x8')](),controller['create']);router[_0x0e92('0xc')](_0x0e92('0xd'),auth['isAuthenticated'](),controller[_0x0e92('0xe')]);router['delete'](_0x0e92('0xd'),auth[_0x0e92('0x8')](),controller[_0x0e92('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc80f=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x1582e3,_0x11b25c){var _0x227171=function(_0x4492bd){while(--_0x4492bd){_0x1582e3['push'](_0x1582e3['shift']());}};_0x227171(++_0x11b25c);}(_0xc80f,0x7e));var _0xfc80=function(_0x22583a,_0x5ee5bb){_0x22583a=_0x22583a-0x0;var _0xdd0bba=_0xc80f[_0x22583a];return _0xdd0bba;};'use strict';var multer=require(_0xfc80('0x0'));var util=require(_0xfc80('0x1'));var path=require(_0xfc80('0x2'));var timeout=require(_0xfc80('0x3'));var express=require(_0xfc80('0x4'));var router=express[_0xfc80('0x5')]();var fs_extra=require(_0xfc80('0x6'));var auth=require(_0xfc80('0x7'));var interaction=require(_0xfc80('0x8'));var config=require(_0xfc80('0x9'));var controller=require(_0xfc80('0xa'));router[_0xfc80('0xb')]('/',auth['isAuthenticated'](),controller[_0xfc80('0xc')]);router['get'](_0xfc80('0xd'),auth[_0xfc80('0xe')](),controller[_0xfc80('0xf')]);router[_0xfc80('0xb')](_0xfc80('0x10'),auth['isAuthenticated'](),controller[_0xfc80('0x11')]);router[_0xfc80('0x12')]('/',auth[_0xfc80('0xe')](),controller['create']);router[_0xfc80('0x13')](_0xfc80('0x10'),auth[_0xfc80('0xe')](),controller[_0xfc80('0x14')]);router[_0xfc80('0x15')](_0xfc80('0x10'),auth[_0xfc80('0xe')](),controller[_0xfc80('0x16')]);module[_0xfc80('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 8f2d268..5bcf75e 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 _0x3ed6=['exports','STRING','DATE','sequelize'];(function(_0x3f55bb,_0x48f83c){var _0x4af5e9=function(_0x515c34){while(--_0x515c34){_0x3f55bb['push'](_0x3f55bb['shift']());}};_0x4af5e9(++_0x48f83c);}(_0x3ed6,0x12f));var _0x63ed=function(_0x3c28a3,_0x32f5c0){_0x3c28a3=_0x3c28a3-0x0;var _0x59d25d=_0x3ed6[_0x3c28a3];return _0x59d25d;};'use strict';var moment=require('moment');var Sequelize=require(_0x63ed('0x0'));module[_0x63ed('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x63ed('0x2')]},'joinAt':{'type':Sequelize[_0x63ed('0x3')]},'leaveAt':{'type':Sequelize[_0x63ed('0x3')]},'acceptAt':{'type':Sequelize[_0x63ed('0x3')]},'exitAt':{'type':Sequelize[_0x63ed('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf513=['moment','sequelize','exports','STRING','DATE'];(function(_0x582d37,_0xc34a90){var _0x4aa6b6=function(_0x47224a){while(--_0x47224a){_0x582d37['push'](_0x582d37['shift']());}};_0x4aa6b6(++_0xc34a90);}(_0xf513,0x181));var _0x3f51=function(_0x163772,_0x50b0e2){_0x163772=_0x163772-0x0;var _0x50f91f=_0xf513[_0x163772];return _0x50f91f;};'use strict';var moment=require(_0x3f51('0x0'));var Sequelize=require(_0x3f51('0x1'));module[_0x3f51('0x2')]={'uniqueid':{'type':Sequelize[_0x3f51('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3f51('0x3')]},'joinAt':{'type':Sequelize[_0x3f51('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3f51('0x4')]},'exitAt':{'type':Sequelize[_0x3f51('0x4')]},'reason':{'type':Sequelize[_0x3f51('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 48b9e1c..4f3aeca 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 _0x8337=['update','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject'];(function(_0x575135,_0x2ed478){var _0x12c2e8=function(_0x323e65){while(--_0x323e65){_0x575135['push'](_0x575135['shift']());}};_0x12c2e8(++_0x2ed478);}(_0x8337,0x13e));var _0x7833=function(_0x5378c1,_0x156fe4){_0x5378c1=_0x5378c1-0x0;var _0x31e8a7=_0x8337[_0x5378c1];return _0x31e8a7;};'use strict';var emlformat=require(_0x7833('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7833('0x1'));var jsonpatch=require(_0x7833('0x2'));var rp=require(_0x7833('0x3'));var moment=require('moment');var BPromise=require(_0x7833('0x4'));var Mustache=require(_0x7833('0x5'));var util=require('util');var path=require(_0x7833('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7833('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7833('0x8'));var squel=require('squel');var crypto=require(_0x7833('0x9'));var jsforce=require(_0x7833('0xa'));var deskjs=require(_0x7833('0xb'));var toCsv=require(_0x7833('0xc'));var querystring=require(_0x7833('0xd'));var Papa=require('papaparse');var Redis=require(_0x7833('0xe'));var authService=require(_0x7833('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7833('0x10'));var hardwareService=require(_0x7833('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7833('0x12'));var config=require(_0x7833('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2197a9,_0x57378a){_0x57378a=_0x57378a||0xcc;return function(_0x5b6e41){if(_0x5b6e41){return _0x2197a9[_0x7833('0x14')](_0x57378a);}return _0x2197a9['status'](_0x57378a)[_0x7833('0x15')]();};}function respondWithResult(_0x368a3f,_0x4c3729){_0x4c3729=_0x4c3729||0xc8;return function(_0x5762c1){if(_0x5762c1){return _0x368a3f[_0x7833('0x16')](_0x4c3729)['json'](_0x5762c1);}};}function respondWithFilteredResult(_0x318cd8,_0x26e7cf){return function(_0x53b783){if(_0x53b783){var _0x3d374d=typeof _0x26e7cf[_0x7833('0x17')]==='undefined'&&typeof _0x26e7cf['limit']===_0x7833('0x18');var _0x2ce4b4=_0x53b783[_0x7833('0x19')];var _0x239cbb=_0x3d374d?0x0:_0x26e7cf[_0x7833('0x17')];var _0x477982=_0x3d374d?_0x53b783[_0x7833('0x19')]:_0x26e7cf[_0x7833('0x17')]+_0x26e7cf[_0x7833('0x1a')];var _0x5ee0e3;if(_0x477982>=_0x2ce4b4){_0x477982=_0x2ce4b4;_0x5ee0e3=0xc8;}else{_0x5ee0e3=0xce;}_0x318cd8[_0x7833('0x16')](_0x5ee0e3);return _0x318cd8[_0x7833('0x1b')](_0x7833('0x1c'),_0x239cbb+'-'+_0x477982+'/'+_0x2ce4b4)[_0x7833('0x1d')](_0x53b783);}return null;};}function patchUpdates(_0x16dedb){return function(_0x29fd7b){try{jsonpatch[_0x7833('0x1e')](_0x29fd7b,_0x16dedb,!![]);}catch(_0xe1002f){return BPromise[_0x7833('0x1f')](_0xe1002f);}return _0x29fd7b['save']();};}function saveUpdates(_0x3310bc,_0x11bfbf){return function(_0x114c49){if(_0x114c49){return _0x114c49[_0x7833('0x20')](_0x3310bc)[_0x7833('0x21')](function(_0x4aa060){return _0x4aa060;});}return null;};}function removeEntity(_0xc04c4e,_0xf5caef){return function(_0x2d4108){if(_0x2d4108){return _0x2d4108[_0x7833('0x22')]()[_0x7833('0x21')](function(){_0xc04c4e['status'](0xcc)[_0x7833('0x15')]();});}};}function handleEntityNotFound(_0x82cdd8,_0x46f4b5){return function(_0x51d02e){if(!_0x51d02e){_0x82cdd8[_0x7833('0x14')](0x194);}return _0x51d02e;};}function handleError(_0x3b16e2,_0x209b43){_0x209b43=_0x209b43||0x1f4;return function(_0x518861){logger['error'](_0x518861[_0x7833('0x23')]);if(_0x518861[_0x7833('0x24')]){delete _0x518861[_0x7833('0x24')];}_0x3b16e2[_0x7833('0x16')](_0x209b43)[_0x7833('0x25')](_0x518861);};}exports[_0x7833('0x26')]=function(_0x1e30fc,_0x5e3b9b){var _0x3a9b7c={},_0xa22801={},_0x3c81a2={'count':0x0,'rows':[]};var _0x2a4750=_[_0x7833('0x27')](db[_0x7833('0x28')][_0x7833('0x29')],function(_0x58b40b){return{'name':_0x58b40b['fieldName'],'type':_0x58b40b[_0x7833('0x2a')][_0x7833('0x2b')]};});_0xa22801[_0x7833('0x2c')]=_['map'](_0x2a4750,_0x7833('0x24'));_0xa22801[_0x7833('0x2d')]=_[_0x7833('0x2e')](_0x1e30fc[_0x7833('0x2d')]);_0xa22801[_0x7833('0x2f')]=_[_0x7833('0x30')](_0xa22801[_0x7833('0x2c')],_0xa22801[_0x7833('0x2d')]);_0x3a9b7c[_0x7833('0x31')]=_[_0x7833('0x30')](_0xa22801[_0x7833('0x2c')],qs[_0x7833('0x32')](_0x1e30fc[_0x7833('0x2d')][_0x7833('0x32')]));_0x3a9b7c[_0x7833('0x31')]=_0x3a9b7c[_0x7833('0x31')]['length']?_0x3a9b7c[_0x7833('0x31')]:_0xa22801[_0x7833('0x2c')];if(!_0x1e30fc['query'][_0x7833('0x33')]('nolimit')){_0x3a9b7c['limit']=qs[_0x7833('0x1a')](_0x1e30fc['query']['limit']);_0x3a9b7c['offset']=qs[_0x7833('0x17')](_0x1e30fc[_0x7833('0x2d')][_0x7833('0x17')]);}_0x3a9b7c[_0x7833('0x34')]=qs['sort'](_0x1e30fc['query'][_0x7833('0x35')]);_0x3a9b7c['where']=qs[_0x7833('0x2f')](_['pick'](_0x1e30fc[_0x7833('0x2d')],_0xa22801['filters']),_0x2a4750);if(_0x1e30fc[_0x7833('0x2d')][_0x7833('0x36')]){_0x3a9b7c[_0x7833('0x37')]=_[_0x7833('0x38')](_0x3a9b7c[_0x7833('0x37')],{'$or':_[_0x7833('0x27')](_0x2a4750,function(_0x4b43a4){if(_0x4b43a4['type']!==_0x7833('0x39')){var _0x1ff955={};_0x1ff955[_0x4b43a4[_0x7833('0x24')]]={'$like':'%'+_0x1e30fc[_0x7833('0x2d')][_0x7833('0x36')]+'%'};return _0x1ff955;}})});}_0x3a9b7c=_['merge']({},_0x3a9b7c,_0x1e30fc[_0x7833('0x3a')]);var _0x1d3227={'where':_0x3a9b7c['where']};return db[_0x7833('0x28')][_0x7833('0x19')](_0x1d3227)['then'](function(_0x56f223){_0x3c81a2[_0x7833('0x19')]=_0x56f223;if(_0x1e30fc[_0x7833('0x2d')]['includeAll']){_0x3a9b7c[_0x7833('0x3b')]=[{'all':!![]}];}return db[_0x7833('0x28')][_0x7833('0x3c')](_0x3a9b7c);})['then'](function(_0x261d9a){_0x3c81a2[_0x7833('0x3d')]=_0x261d9a;return _0x3c81a2;})['then'](respondWithFilteredResult(_0x5e3b9b,_0x3a9b7c))[_0x7833('0x3e')](handleError(_0x5e3b9b,null));};exports[_0x7833('0x3f')]=function(_0x5d0983,_0x3fcb3b){var _0x3f440a={'raw':!![],'where':{'id':_0x5d0983['params']['id']}},_0x5d7dbb={};_0x5d7dbb[_0x7833('0x2c')]=_[_0x7833('0x2e')](db['SmsQueueReport'][_0x7833('0x29')]);_0x5d7dbb['query']=_[_0x7833('0x2e')](_0x5d0983[_0x7833('0x2d')]);_0x5d7dbb['filters']=_[_0x7833('0x30')](_0x5d7dbb['model'],_0x5d7dbb['query']);_0x3f440a[_0x7833('0x31')]=_[_0x7833('0x30')](_0x5d7dbb['model'],qs[_0x7833('0x32')](_0x5d0983[_0x7833('0x2d')]['fields']));_0x3f440a[_0x7833('0x31')]=_0x3f440a['attributes'][_0x7833('0x40')]?_0x3f440a[_0x7833('0x31')]:_0x5d7dbb[_0x7833('0x2c')];if(_0x5d0983['query']['includeAll']){_0x3f440a['include']=[{'all':!![]}];}_0x3f440a=_[_0x7833('0x38')]({},_0x3f440a,_0x5d0983['options']);return db[_0x7833('0x28')][_0x7833('0x41')](_0x3f440a)[_0x7833('0x21')](handleEntityNotFound(_0x3fcb3b,null))[_0x7833('0x21')](respondWithResult(_0x3fcb3b,null))[_0x7833('0x3e')](handleError(_0x3fcb3b,null));};exports[_0x7833('0x42')]=function(_0x30517e,_0x2d4db2){return db[_0x7833('0x28')][_0x7833('0x42')](_0x30517e[_0x7833('0x43')],{})[_0x7833('0x21')](respondWithResult(_0x2d4db2,0xc9))[_0x7833('0x3e')](handleError(_0x2d4db2,null));};exports['update']=function(_0x249ebf,_0x292dec){if(_0x249ebf[_0x7833('0x43')]['id']){delete _0x249ebf[_0x7833('0x43')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x249ebf[_0x7833('0x44')]['id']}})[_0x7833('0x21')](handleEntityNotFound(_0x292dec,null))[_0x7833('0x21')](saveUpdates(_0x249ebf[_0x7833('0x43')],null))['then'](respondWithResult(_0x292dec,null))[_0x7833('0x3e')](handleError(_0x292dec,null));};exports[_0x7833('0x22')]=function(_0x1d383b,_0x32b17d){return db[_0x7833('0x28')][_0x7833('0x41')]({'where':{'id':_0x1d383b['params']['id']}})[_0x7833('0x21')](handleEntityNotFound(_0x32b17d,null))[_0x7833('0x21')](removeEntity(_0x32b17d,null))[_0x7833('0x3e')](handleError(_0x32b17d,null));};exports[_0x7833('0x45')]=function(_0x12eedf,_0x4a9c1a){return db[_0x7833('0x28')]['describe']()[_0x7833('0x21')](respondWithResult(_0x4a9c1a,null))[_0x7833('0x3e')](handleError(_0x4a9c1a,null));}; \ No newline at end of file +var _0x062c=['apply','reject','save','update','then','sendStatus','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','describe','zip-dir','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x21bb4d,_0x110dd2){var _0x2839c7=function(_0x4d50b7){while(--_0x4d50b7){_0x21bb4d['push'](_0x21bb4d['shift']());}};_0x2839c7(++_0x110dd2);}(_0x062c,0x111));var _0xc062=function(_0x422cb8,_0x257c75){_0x422cb8=_0x422cb8-0x0;var _0xf19501=_0x062c[_0x422cb8];return _0xf19501;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc062('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc062('0x1'));var moment=require(_0xc062('0x2'));var BPromise=require(_0xc062('0x3'));var Mustache=require(_0xc062('0x4'));var util=require(_0xc062('0x5'));var path=require('path');var sox=require(_0xc062('0x6'));var csv=require('to-csv');var ejs=require(_0xc062('0x7'));var fs=require('fs');var fs_extra=require(_0xc062('0x8'));var _=require(_0xc062('0x9'));var squel=require(_0xc062('0xa'));var crypto=require('crypto');var jsforce=require(_0xc062('0xb'));var deskjs=require(_0xc062('0xc'));var toCsv=require(_0xc062('0xd'));var querystring=require(_0xc062('0xe'));var Papa=require(_0xc062('0xf'));var Redis=require(_0xc062('0x10'));var authService=require(_0xc062('0x11'));var qs=require(_0xc062('0x12'));var as=require(_0xc062('0x13'));var hardwareService=require(_0xc062('0x14'));var logger=require(_0xc062('0x15'))('api');var utils=require(_0xc062('0x16'));var config=require(_0xc062('0x17'));var licenseUtil=require(_0xc062('0x18'));var db=require(_0xc062('0x19'))['db'];function respondWithStatusCode(_0x4e5b37,_0x3579ef){_0x3579ef=_0x3579ef||0xcc;return function(_0xa831cb){if(_0xa831cb){return _0x4e5b37['sendStatus'](_0x3579ef);}return _0x4e5b37['status'](_0x3579ef)[_0xc062('0x1a')]();};}function respondWithResult(_0x4c984f,_0x1230a7){_0x1230a7=_0x1230a7||0xc8;return function(_0x1228f9){if(_0x1228f9){return _0x4c984f[_0xc062('0x1b')](_0x1230a7)[_0xc062('0x1c')](_0x1228f9);}};}function respondWithFilteredResult(_0x36bada,_0x286271){return function(_0x1c96db){if(_0x1c96db){var _0x884497=typeof _0x286271[_0xc062('0x1d')]===_0xc062('0x1e')&&typeof _0x286271[_0xc062('0x1f')]===_0xc062('0x1e');var _0x26d3c2=_0x1c96db[_0xc062('0x20')];var _0x272d00=_0x884497?0x0:_0x286271[_0xc062('0x1d')];var _0x2b5b9c=_0x884497?_0x1c96db[_0xc062('0x20')]:_0x286271[_0xc062('0x1d')]+_0x286271[_0xc062('0x1f')];var _0x2eb41f;if(_0x2b5b9c>=_0x26d3c2){_0x2b5b9c=_0x26d3c2;_0x2eb41f=0xc8;}else{_0x2eb41f=0xce;}_0x36bada[_0xc062('0x1b')](_0x2eb41f);return _0x36bada[_0xc062('0x21')](_0xc062('0x22'),_0x272d00+'-'+_0x2b5b9c+'/'+_0x26d3c2)[_0xc062('0x1c')](_0x1c96db);}return null;};}function patchUpdates(_0x2b8e2f){return function(_0x3ebb16){try{jsonpatch[_0xc062('0x23')](_0x3ebb16,_0x2b8e2f,!![]);}catch(_0x5176c1){return BPromise[_0xc062('0x24')](_0x5176c1);}return _0x3ebb16[_0xc062('0x25')]();};}function saveUpdates(_0x14c037,_0x30c1cd){return function(_0x1cbf06){if(_0x1cbf06){return _0x1cbf06[_0xc062('0x26')](_0x14c037)['then'](function(_0x3436d7){return _0x3436d7;});}return null;};}function removeEntity(_0x17c671,_0xc436f3){return function(_0x46cbd8){if(_0x46cbd8){return _0x46cbd8['destroy']()[_0xc062('0x27')](function(){_0x17c671[_0xc062('0x1b')](0xcc)[_0xc062('0x1a')]();});}};}function handleEntityNotFound(_0x14a8dd,_0x11db72){return function(_0x230448){if(!_0x230448){_0x14a8dd[_0xc062('0x28')](0x194);}return _0x230448;};}function handleError(_0x5161d9,_0x3ec8ea){_0x3ec8ea=_0x3ec8ea||0x1f4;return function(_0x2d6ef1){logger['error'](_0x2d6ef1[_0xc062('0x29')]);if(_0x2d6ef1[_0xc062('0x2a')]){delete _0x2d6ef1['name'];}_0x5161d9[_0xc062('0x1b')](_0x3ec8ea)[_0xc062('0x2b')](_0x2d6ef1);};}exports[_0xc062('0x2c')]=function(_0x301651,_0x15e1fc){var _0x365f87={},_0x2208a8={},_0x26a21a={'count':0x0,'rows':[]};var _0x4101ea=_[_0xc062('0x2d')](db[_0xc062('0x2e')][_0xc062('0x2f')],function(_0x62333b){return{'name':_0x62333b[_0xc062('0x30')],'type':_0x62333b['type']['key']};});_0x2208a8[_0xc062('0x31')]=_['map'](_0x4101ea,_0xc062('0x2a'));_0x2208a8[_0xc062('0x32')]=_[_0xc062('0x33')](_0x301651['query']);_0x2208a8[_0xc062('0x34')]=_[_0xc062('0x35')](_0x2208a8[_0xc062('0x31')],_0x2208a8[_0xc062('0x32')]);_0x365f87['attributes']=_[_0xc062('0x35')](_0x2208a8[_0xc062('0x31')],qs[_0xc062('0x36')](_0x301651['query'][_0xc062('0x36')]));_0x365f87[_0xc062('0x37')]=_0x365f87['attributes'][_0xc062('0x38')]?_0x365f87[_0xc062('0x37')]:_0x2208a8[_0xc062('0x31')];if(!_0x301651[_0xc062('0x32')][_0xc062('0x39')](_0xc062('0x3a'))){_0x365f87[_0xc062('0x1f')]=qs[_0xc062('0x1f')](_0x301651[_0xc062('0x32')][_0xc062('0x1f')]);_0x365f87[_0xc062('0x1d')]=qs[_0xc062('0x1d')](_0x301651[_0xc062('0x32')][_0xc062('0x1d')]);}_0x365f87['order']=qs[_0xc062('0x3b')](_0x301651[_0xc062('0x32')][_0xc062('0x3b')]);_0x365f87['where']=qs['filters'](_[_0xc062('0x3c')](_0x301651[_0xc062('0x32')],_0x2208a8[_0xc062('0x34')]),_0x4101ea);if(_0x301651[_0xc062('0x32')]['filter']){_0x365f87[_0xc062('0x3d')]=_[_0xc062('0x3e')](_0x365f87[_0xc062('0x3d')],{'$or':_['map'](_0x4101ea,function(_0x646a09){if(_0x646a09[_0xc062('0x3f')]!==_0xc062('0x40')){var _0x486bac={};_0x486bac[_0x646a09[_0xc062('0x2a')]]={'$like':'%'+_0x301651['query']['filter']+'%'};return _0x486bac;}})});}_0x365f87=_[_0xc062('0x3e')]({},_0x365f87,_0x301651[_0xc062('0x41')]);var _0x6e1ef4={'where':_0x365f87[_0xc062('0x3d')]};return db[_0xc062('0x2e')][_0xc062('0x20')](_0x6e1ef4)[_0xc062('0x27')](function(_0xafb4db){_0x26a21a[_0xc062('0x20')]=_0xafb4db;if(_0x301651[_0xc062('0x32')][_0xc062('0x42')]){_0x365f87[_0xc062('0x43')]=[{'all':!![]}];}return db[_0xc062('0x2e')]['findAll'](_0x365f87);})[_0xc062('0x27')](function(_0x50b424){_0x26a21a[_0xc062('0x44')]=_0x50b424;return _0x26a21a;})['then'](respondWithFilteredResult(_0x15e1fc,_0x365f87))[_0xc062('0x45')](handleError(_0x15e1fc,null));};exports[_0xc062('0x46')]=function(_0x48305b,_0x1f06be){var _0x39c74c={'raw':!![],'where':{'id':_0x48305b['params']['id']}},_0x19c7cf={};_0x19c7cf['model']=_['keys'](db['SmsQueueReport'][_0xc062('0x2f')]);_0x19c7cf[_0xc062('0x32')]=_[_0xc062('0x33')](_0x48305b[_0xc062('0x32')]);_0x19c7cf[_0xc062('0x34')]=_[_0xc062('0x35')](_0x19c7cf[_0xc062('0x31')],_0x19c7cf['query']);_0x39c74c[_0xc062('0x37')]=_[_0xc062('0x35')](_0x19c7cf[_0xc062('0x31')],qs[_0xc062('0x36')](_0x48305b['query']['fields']));_0x39c74c[_0xc062('0x37')]=_0x39c74c[_0xc062('0x37')][_0xc062('0x38')]?_0x39c74c[_0xc062('0x37')]:_0x19c7cf[_0xc062('0x31')];if(_0x48305b[_0xc062('0x32')]['includeAll']){_0x39c74c[_0xc062('0x43')]=[{'all':!![]}];}_0x39c74c=_[_0xc062('0x3e')]({},_0x39c74c,_0x48305b[_0xc062('0x41')]);return db[_0xc062('0x2e')][_0xc062('0x47')](_0x39c74c)['then'](handleEntityNotFound(_0x1f06be,null))[_0xc062('0x27')](respondWithResult(_0x1f06be,null))[_0xc062('0x45')](handleError(_0x1f06be,null));};exports[_0xc062('0x48')]=function(_0x2efbc5,_0x41ede7){return db['SmsQueueReport'][_0xc062('0x48')](_0x2efbc5['body'],{})[_0xc062('0x27')](respondWithResult(_0x41ede7,0xc9))[_0xc062('0x45')](handleError(_0x41ede7,null));};exports[_0xc062('0x26')]=function(_0x467c4b,_0x1019ef){if(_0x467c4b[_0xc062('0x49')]['id']){delete _0x467c4b[_0xc062('0x49')]['id'];}return db[_0xc062('0x2e')][_0xc062('0x47')]({'where':{'id':_0x467c4b[_0xc062('0x4a')]['id']}})[_0xc062('0x27')](handleEntityNotFound(_0x1019ef,null))[_0xc062('0x27')](saveUpdates(_0x467c4b[_0xc062('0x49')],null))['then'](respondWithResult(_0x1019ef,null))[_0xc062('0x45')](handleError(_0x1019ef,null));};exports[_0xc062('0x4b')]=function(_0x6d4e39,_0x5ec30b){return db['SmsQueueReport'][_0xc062('0x47')]({'where':{'id':_0x6d4e39['params']['id']}})[_0xc062('0x27')](handleEntityNotFound(_0x5ec30b,null))[_0xc062('0x27')](removeEntity(_0x5ec30b,null))[_0xc062('0x45')](handleError(_0x5ec30b,null));};exports['describe']=function(_0x276e85,_0x50dd0a){return db[_0xc062('0x2e')][_0xc062('0x4c')]()[_0xc062('0x27')](respondWithResult(_0x50dd0a,null))[_0xc062('0x45')](handleError(_0x50dd0a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d29029d..0d8ef9b 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0xe706,0xa3));var _0x6e70=function(_0x180632,_0x3a229e){_0x180632=_0x180632-0x0;var _0x151961=_0xe706[_0x180632];return _0x151961;};'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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x2dd615,_0x18099c){var _0x5255a4=function(_0x3f4c54){while(--_0x3f4c54){_0x2dd615['push'](_0x2dd615['shift']());}};_0x5255a4(++_0x18099c);}(_0xe706,0xa3));var _0x6e70=function(_0x3e3012,_0x46fe06){_0x3e3012=_0x3e3012-0x0;var _0x5dfc61=_0xe706[_0x3e3012];return _0x5dfc61;};'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/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index a74698d..60fac8c 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 _0x7a2d=['create','body','options','raw','debug','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x459de1,_0x187d8c){var _0x2a1006=function(_0x4931b1){while(--_0x4931b1){_0x459de1['push'](_0x459de1['shift']());}};_0x2a1006(++_0x187d8c);}(_0x7a2d,0x111));var _0xd7a2=function(_0x4cd5ba,_0x3f16b5){_0x4cd5ba=_0x4cd5ba-0x0;var _0x3e4fe5=_0x7a2d[_0x4cd5ba];return _0x3e4fe5;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var moment=require(_0xd7a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7a2('0x3'));var db=require(_0xd7a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7a2('0x5'))(_0xd7a2('0x6'));var config=require(_0xd7a2('0x7'));var jayson=require(_0xd7a2('0x8'));var client=jayson[_0xd7a2('0x9')][_0xd7a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x139185,_0x1a6b9e,_0x5775ee){return new BPromise(function(_0x3a8d76,_0x5bd25e){return client[_0xd7a2('0xb')](_0x139185,_0x5775ee)[_0xd7a2('0xc')](function(_0x3949f4){logger[_0xd7a2('0xd')](_0xd7a2('0xe'),_0x1a6b9e,_0xd7a2('0xf'));logger['debug'](_0xd7a2('0x10'),_0x1a6b9e,'request\x20sent',JSON[_0xd7a2('0x11')](_0x3949f4));if(_0x3949f4[_0xd7a2('0x12')]){if(_0x3949f4[_0xd7a2('0x12')]['code']===0x1f4){logger['error'](_0xd7a2('0xe'),_0x1a6b9e,_0x3949f4[_0xd7a2('0x12')][_0xd7a2('0x13')]);return _0x5bd25e(_0x3949f4[_0xd7a2('0x12')][_0xd7a2('0x13')]);}logger['error'](_0xd7a2('0xe'),_0x1a6b9e,_0x3949f4[_0xd7a2('0x12')][_0xd7a2('0x13')]);return _0x3a8d76(_0x3949f4['error']['message']);}else{logger[_0xd7a2('0xd')](_0xd7a2('0xe'),_0x1a6b9e,_0xd7a2('0xf'));_0x3a8d76(_0x3949f4[_0xd7a2('0x14')][_0xd7a2('0x13')]);}})[_0xd7a2('0x15')](function(_0x3a7176){logger[_0xd7a2('0x12')](_0xd7a2('0xe'),_0x1a6b9e,_0x3a7176);_0x5bd25e(_0x3a7176);});});}exports[_0xd7a2('0x16')]=function(_0x592272){var _0x274db7=this;return new Promise(function(_0x1e4673,_0x19e67d){return db[_0xd7a2('0x17')][_0xd7a2('0x18')](_0x592272[_0xd7a2('0x19')],{'raw':_0x592272[_0xd7a2('0x1a')]?_0x592272[_0xd7a2('0x1a')][_0xd7a2('0x1b')]===undefined?!![]:![]:!![]})[_0xd7a2('0xc')](function(_0x257055){logger[_0xd7a2('0xd')]('CreateSmsQueueReport',_0x592272);logger[_0xd7a2('0x1c')](_0xd7a2('0x16'),_0x592272,JSON[_0xd7a2('0x11')](_0x257055));_0x1e4673(_0x257055);})[_0xd7a2('0x15')](function(_0x28b584){logger[_0xd7a2('0x12')]('CreateSmsQueueReport',_0x28b584['message'],_0x592272);_0x19e67d(_0x274db7['error'](0x1f4,_0x28b584[_0xd7a2('0x13')]));});});};exports[_0xd7a2('0x1d')]=function(_0x458ad5){var _0x9be6a7=this;return new Promise(function(_0x4bee04,_0x3e6593){return db[_0xd7a2('0x17')][_0xd7a2('0x1e')](_0x458ad5['body'],{'raw':_0x458ad5[_0xd7a2('0x1a')]?_0x458ad5['options'][_0xd7a2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x458ad5['options']?_0x458ad5[_0xd7a2('0x1a')][_0xd7a2('0x1f')]||null:null,'attributes':_0x458ad5['options']?_0x458ad5['options']['attributes']||null:null,'limit':_0x458ad5['options']?_0x458ad5[_0xd7a2('0x1a')][_0xd7a2('0x20')]||null:null})[_0xd7a2('0xc')](function(_0x403c9c){logger['info'](_0xd7a2('0x1d'),_0x458ad5);logger[_0xd7a2('0x1c')]('UpdateSmsQueueReport',_0x458ad5,JSON[_0xd7a2('0x11')](_0x403c9c));_0x4bee04(_0x403c9c);})[_0xd7a2('0x15')](function(_0x2d24a6){logger[_0xd7a2('0x12')]('UpdateSmsQueueReport',_0x2d24a6[_0xd7a2('0x13')],_0x458ad5);_0x3e6593(_0x9be6a7['error'](0x1f4,_0x2d24a6['message']));});});}; \ No newline at end of file +var _0xb5b1=['rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','CreateSmsQueueReport','SmsQueueReport','options','raw','then','debug','catch','UpdateSmsQueueReport','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb5b1,0x75));var _0x1b5b=function(_0x23bb2a,_0x2bc506){_0x23bb2a=_0x23bb2a-0x0;var _0x15208d=_0xb5b1[_0x23bb2a];return _0x15208d;};'use strict';var _=require(_0x1b5b('0x0'));var util=require(_0x1b5b('0x1'));var moment=require(_0x1b5b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b5b('0x3'));var db=require(_0x1b5b('0x4'))['db'];var utils=require(_0x1b5b('0x5'));var logger=require(_0x1b5b('0x6'))(_0x1b5b('0x7'));var config=require(_0x1b5b('0x8'));var jayson=require(_0x1b5b('0x9'));var client=jayson[_0x1b5b('0xa')][_0x1b5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6cb8,_0x41387d,_0x3ab819){return new BPromise(function(_0x53e5ac,_0x5eaa37){return client[_0x1b5b('0xc')](_0x2b6cb8,_0x3ab819)['then'](function(_0x3ec7cf){logger[_0x1b5b('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x41387d,'request\x20sent');logger['debug'](_0x1b5b('0xe'),_0x41387d,_0x1b5b('0xf'),JSON[_0x1b5b('0x10')](_0x3ec7cf));if(_0x3ec7cf[_0x1b5b('0x11')]){if(_0x3ec7cf[_0x1b5b('0x11')][_0x1b5b('0x12')]===0x1f4){logger[_0x1b5b('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x41387d,_0x3ec7cf['error'][_0x1b5b('0x13')]);return _0x5eaa37(_0x3ec7cf['error'][_0x1b5b('0x13')]);}logger[_0x1b5b('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x41387d,_0x3ec7cf[_0x1b5b('0x11')][_0x1b5b('0x13')]);return _0x53e5ac(_0x3ec7cf[_0x1b5b('0x11')]['message']);}else{logger[_0x1b5b('0xd')](_0x1b5b('0x14'),_0x41387d,_0x1b5b('0xf'));_0x53e5ac(_0x3ec7cf[_0x1b5b('0x15')][_0x1b5b('0x13')]);}})['catch'](function(_0x1a6ac6){logger[_0x1b5b('0x11')](_0x1b5b('0x14'),_0x41387d,_0x1a6ac6);_0x5eaa37(_0x1a6ac6);});});}exports[_0x1b5b('0x16')]=function(_0x3da02a){var _0xa65a17=this;return new Promise(function(_0x5a3f9c,_0x2ccef9){return db[_0x1b5b('0x17')]['create'](_0x3da02a['body'],{'raw':_0x3da02a['options']?_0x3da02a[_0x1b5b('0x18')][_0x1b5b('0x19')]===undefined?!![]:![]:!![]})[_0x1b5b('0x1a')](function(_0x28e064){logger[_0x1b5b('0xd')](_0x1b5b('0x16'),_0x3da02a);logger[_0x1b5b('0x1b')](_0x1b5b('0x16'),_0x3da02a,JSON['stringify'](_0x28e064));_0x5a3f9c(_0x28e064);})[_0x1b5b('0x1c')](function(_0x5eb635){logger[_0x1b5b('0x11')](_0x1b5b('0x16'),_0x5eb635[_0x1b5b('0x13')],_0x3da02a);_0x2ccef9(_0xa65a17[_0x1b5b('0x11')](0x1f4,_0x5eb635[_0x1b5b('0x13')]));});});};exports[_0x1b5b('0x1d')]=function(_0x39fd6d){var _0xb68687=this;return new Promise(function(_0x5508fa,_0x1d27cf){return db['SmsQueueReport']['update'](_0x39fd6d['body'],{'raw':_0x39fd6d[_0x1b5b('0x18')]?_0x39fd6d['options'][_0x1b5b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39fd6d['options']?_0x39fd6d[_0x1b5b('0x18')][_0x1b5b('0x1e')]||null:null,'attributes':_0x39fd6d[_0x1b5b('0x18')]?_0x39fd6d[_0x1b5b('0x18')]['attributes']||null:null,'limit':_0x39fd6d[_0x1b5b('0x18')]?_0x39fd6d[_0x1b5b('0x18')]['limit']||null:null})['then'](function(_0x3ff65f){logger[_0x1b5b('0xd')](_0x1b5b('0x1d'),_0x39fd6d);logger[_0x1b5b('0x1b')](_0x1b5b('0x1d'),_0x39fd6d,JSON[_0x1b5b('0x10')](_0x3ff65f));_0x5508fa(_0x3ff65f);})[_0x1b5b('0x1c')](function(_0x31dffc){logger[_0x1b5b('0x11')](_0x1b5b('0x1d'),_0x31dffc['message'],_0x39fd6d);_0x1d27cf(_0xb68687[_0x1b5b('0x11')](0x1f4,_0x31dffc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ce333d7..8096602 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 _0x0b78=['get','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','/describe','isAuthenticated','describe'];(function(_0xcaad02,_0x248307){var _0x49160c=function(_0x32e738){while(--_0x32e738){_0xcaad02['push'](_0xcaad02['shift']());}};_0x49160c(++_0x248307);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),auth[_0x80b7('0xa')](),controller[_0x80b7('0xb')]);router[_0x80b7('0xc')]('/:id',auth[_0x80b7('0xa')](),controller[_0x80b7('0xd')]);router[_0x80b7('0xe')]('/',auth['isAuthenticated'](),controller[_0x80b7('0xf')]);router['put'](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x11')]);router[_0x80b7('0x12')](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x13')]);module[_0x80b7('0x14')]=router; \ No newline at end of file +var _0xf3be=['./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf3be,0x1e1));var _0xef3b=function(_0x1b56a5,_0x320dc7){_0x1b56a5=_0x1b56a5-0x0;var _0x119e9b=_0xf3be[_0x1b56a5];return _0x119e9b;};'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('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xef3b('0xb')]);router['post']('/',auth[_0xef3b('0x9')](),controller[_0xef3b('0xc')]);router[_0xef3b('0xd')]('/:id',auth[_0xef3b('0x9')](),controller['update']);router[_0xef3b('0xe')](_0xef3b('0xf'),auth[_0xef3b('0x9')](),controller[_0xef3b('0x10')]);module[_0xef3b('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index c771df6..f2bc558 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4421da,_0x41121b){var _0x4be32c=function(_0x296a07){while(--_0x296a07){_0x4421da['push'](_0x4421da['shift']());}};_0x4be32c(++_0x41121b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x33a5c6,_0x1536d5){_0x33a5c6=_0x33a5c6-0x0;var _0x206d7c=_0xf4eb[_0x33a5c6];return _0x206d7c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1dbeda,_0x11a72b){_0x1dbeda=_0x1dbeda-0x0;var _0x4a4e14=_0xb43b[_0x1dbeda];return _0x4a4e14;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 88f4f3c..a7b7bd4 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 _0xa7b1=['sendStatus','status','json','limit','count','offset','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','SmsTransferReport','findAll','rows','catch','show','params','keys','rawAttributes','create','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util'];(function(_0xd5f8c9,_0xdf425b){var _0x5ae8f6=function(_0xc5d316){while(--_0xc5d316){_0xd5f8c9['push'](_0xd5f8c9['shift']());}};_0x5ae8f6(++_0xdf425b);}(_0xa7b1,0x7a));var _0x1a7b=function(_0x584880,_0x5ebdfc){_0x584880=_0x584880-0x0;var _0x1342e0=_0xa7b1[_0x584880];return _0x1342e0;};'use strict';var emlformat=require(_0x1a7b('0x0'));var rimraf=require(_0x1a7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a7b('0x2'));var rp=require(_0x1a7b('0x3'));var moment=require(_0x1a7b('0x4'));var BPromise=require(_0x1a7b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1a7b('0x6'));var csv=require(_0x1a7b('0x7'));var ejs=require(_0x1a7b('0x8'));var fs=require('fs');var fs_extra=require(_0x1a7b('0x9'));var _=require(_0x1a7b('0xa'));var squel=require(_0x1a7b('0xb'));var crypto=require(_0x1a7b('0xc'));var jsforce=require(_0x1a7b('0xd'));var deskjs=require(_0x1a7b('0xe'));var toCsv=require(_0x1a7b('0x7'));var querystring=require(_0x1a7b('0xf'));var Papa=require(_0x1a7b('0x10'));var Redis=require(_0x1a7b('0x11'));var authService=require(_0x1a7b('0x12'));var qs=require(_0x1a7b('0x13'));var as=require(_0x1a7b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a7b('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1a7b('0x16'));var licenseUtil=require(_0x1a7b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bb380,_0x4a3bbd){_0x4a3bbd=_0x4a3bbd||0xcc;return function(_0x3513e4){if(_0x3513e4){return _0x4bb380[_0x1a7b('0x18')](_0x4a3bbd);}return _0x4bb380['status'](_0x4a3bbd)['end']();};}function respondWithResult(_0x4c233d,_0x36a61f){_0x36a61f=_0x36a61f||0xc8;return function(_0x477894){if(_0x477894){return _0x4c233d[_0x1a7b('0x19')](_0x36a61f)[_0x1a7b('0x1a')](_0x477894);}};}function respondWithFilteredResult(_0x459702,_0x29e8e2){return function(_0x22d9f3){if(_0x22d9f3){var _0x5f349f=typeof _0x29e8e2['offset']==='undefined'&&typeof _0x29e8e2[_0x1a7b('0x1b')]==='undefined';var _0x50d8db=_0x22d9f3[_0x1a7b('0x1c')];var _0x534ad2=_0x5f349f?0x0:_0x29e8e2[_0x1a7b('0x1d')];var _0x1c66dd=_0x5f349f?_0x22d9f3[_0x1a7b('0x1c')]:_0x29e8e2[_0x1a7b('0x1d')]+_0x29e8e2[_0x1a7b('0x1b')];var _0x33966c;if(_0x1c66dd>=_0x50d8db){_0x1c66dd=_0x50d8db;_0x33966c=0xc8;}else{_0x33966c=0xce;}_0x459702['status'](_0x33966c);return _0x459702['set']('Content-Range',_0x534ad2+'-'+_0x1c66dd+'/'+_0x50d8db)[_0x1a7b('0x1a')](_0x22d9f3);}return null;};}function patchUpdates(_0x2e8864){return function(_0x1282bf){try{jsonpatch[_0x1a7b('0x1e')](_0x1282bf,_0x2e8864,!![]);}catch(_0x479691){return BPromise[_0x1a7b('0x1f')](_0x479691);}return _0x1282bf['save']();};}function saveUpdates(_0x53767e,_0x43262b){return function(_0x3ede02){if(_0x3ede02){return _0x3ede02[_0x1a7b('0x20')](_0x53767e)[_0x1a7b('0x21')](function(_0x1f4d92){return _0x1f4d92;});}return null;};}function removeEntity(_0x816c41,_0x447aad){return function(_0x5f1ea1){if(_0x5f1ea1){return _0x5f1ea1[_0x1a7b('0x22')]()[_0x1a7b('0x21')](function(){_0x816c41['status'](0xcc)[_0x1a7b('0x23')]();});}};}function handleEntityNotFound(_0x56402d,_0x2e2a0b){return function(_0x4a3fcf){if(!_0x4a3fcf){_0x56402d['sendStatus'](0x194);}return _0x4a3fcf;};}function handleError(_0x8c950d,_0x2d64a9){_0x2d64a9=_0x2d64a9||0x1f4;return function(_0x41120a){logger[_0x1a7b('0x24')](_0x41120a[_0x1a7b('0x25')]);if(_0x41120a[_0x1a7b('0x26')]){delete _0x41120a[_0x1a7b('0x26')];}_0x8c950d[_0x1a7b('0x19')](_0x2d64a9)[_0x1a7b('0x27')](_0x41120a);};}exports[_0x1a7b('0x28')]=function(_0x919ec2,_0x11fe75){var _0x24f1bd={},_0x453ba4={},_0x4872cd={'count':0x0,'rows':[]};var _0x1c890a=_[_0x1a7b('0x29')](db['SmsTransferReport']['rawAttributes'],function(_0x57f2c0){return{'name':_0x57f2c0[_0x1a7b('0x2a')],'type':_0x57f2c0['type'][_0x1a7b('0x2b')]};});_0x453ba4[_0x1a7b('0x2c')]=_[_0x1a7b('0x29')](_0x1c890a,'name');_0x453ba4[_0x1a7b('0x2d')]=_['keys'](_0x919ec2[_0x1a7b('0x2d')]);_0x453ba4['filters']=_[_0x1a7b('0x2e')](_0x453ba4[_0x1a7b('0x2c')],_0x453ba4[_0x1a7b('0x2d')]);_0x24f1bd[_0x1a7b('0x2f')]=_['intersection'](_0x453ba4[_0x1a7b('0x2c')],qs[_0x1a7b('0x30')](_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x30')]));_0x24f1bd['attributes']=_0x24f1bd[_0x1a7b('0x2f')]['length']?_0x24f1bd[_0x1a7b('0x2f')]:_0x453ba4[_0x1a7b('0x2c')];if(!_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x31')]('nolimit')){_0x24f1bd[_0x1a7b('0x1b')]=qs[_0x1a7b('0x1b')](_0x919ec2[_0x1a7b('0x2d')]['limit']);_0x24f1bd[_0x1a7b('0x1d')]=qs[_0x1a7b('0x1d')](_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x1d')]);}_0x24f1bd['order']=qs[_0x1a7b('0x32')](_0x919ec2[_0x1a7b('0x2d')]['sort']);_0x24f1bd[_0x1a7b('0x33')]=qs['filters'](_[_0x1a7b('0x34')](_0x919ec2['query'],_0x453ba4[_0x1a7b('0x35')]),_0x1c890a);if(_0x919ec2[_0x1a7b('0x2d')]['filter']){_0x24f1bd[_0x1a7b('0x33')]=_[_0x1a7b('0x36')](_0x24f1bd['where'],{'$or':_[_0x1a7b('0x29')](_0x1c890a,function(_0x5011d1){if(_0x5011d1[_0x1a7b('0x37')]!==_0x1a7b('0x38')){var _0x177513={};_0x177513[_0x5011d1[_0x1a7b('0x26')]]={'$like':'%'+_0x919ec2['query'][_0x1a7b('0x39')]+'%'};return _0x177513;}})});}_0x24f1bd=_['merge']({},_0x24f1bd,_0x919ec2[_0x1a7b('0x3a')]);var _0x34b077={'where':_0x24f1bd[_0x1a7b('0x33')]};return db['SmsTransferReport'][_0x1a7b('0x1c')](_0x34b077)[_0x1a7b('0x21')](function(_0x150e94){_0x4872cd[_0x1a7b('0x1c')]=_0x150e94;if(_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x3b')]){_0x24f1bd[_0x1a7b('0x3c')]=[{'all':!![]}];}return db[_0x1a7b('0x3d')][_0x1a7b('0x3e')](_0x24f1bd);})[_0x1a7b('0x21')](function(_0x6d2461){_0x4872cd[_0x1a7b('0x3f')]=_0x6d2461;return _0x4872cd;})['then'](respondWithFilteredResult(_0x11fe75,_0x24f1bd))[_0x1a7b('0x40')](handleError(_0x11fe75,null));};exports[_0x1a7b('0x41')]=function(_0x3010a2,_0x3d5813){var _0x40b6bf={'raw':!![],'where':{'id':_0x3010a2[_0x1a7b('0x42')]['id']}},_0x44f258={};_0x44f258[_0x1a7b('0x2c')]=_[_0x1a7b('0x43')](db['SmsTransferReport'][_0x1a7b('0x44')]);_0x44f258[_0x1a7b('0x2d')]=_[_0x1a7b('0x43')](_0x3010a2[_0x1a7b('0x2d')]);_0x44f258['filters']=_[_0x1a7b('0x2e')](_0x44f258[_0x1a7b('0x2c')],_0x44f258[_0x1a7b('0x2d')]);_0x40b6bf[_0x1a7b('0x2f')]=_[_0x1a7b('0x2e')](_0x44f258[_0x1a7b('0x2c')],qs['fields'](_0x3010a2[_0x1a7b('0x2d')]['fields']));_0x40b6bf[_0x1a7b('0x2f')]=_0x40b6bf[_0x1a7b('0x2f')]['length']?_0x40b6bf[_0x1a7b('0x2f')]:_0x44f258[_0x1a7b('0x2c')];if(_0x3010a2[_0x1a7b('0x2d')]['includeAll']){_0x40b6bf[_0x1a7b('0x3c')]=[{'all':!![]}];}_0x40b6bf=_[_0x1a7b('0x36')]({},_0x40b6bf,_0x3010a2['options']);return db[_0x1a7b('0x3d')]['find'](_0x40b6bf)[_0x1a7b('0x21')](handleEntityNotFound(_0x3d5813,null))[_0x1a7b('0x21')](respondWithResult(_0x3d5813,null))[_0x1a7b('0x40')](handleError(_0x3d5813,null));};exports[_0x1a7b('0x45')]=function(_0x20862d,_0x3b0b44){return db[_0x1a7b('0x3d')][_0x1a7b('0x45')](_0x20862d['body'],{})[_0x1a7b('0x21')](respondWithResult(_0x3b0b44,0xc9))[_0x1a7b('0x40')](handleError(_0x3b0b44,null));};exports[_0x1a7b('0x20')]=function(_0x2a89ca,_0x22bc18){if(_0x2a89ca['body']['id']){delete _0x2a89ca['body']['id'];}return db[_0x1a7b('0x3d')][_0x1a7b('0x46')]({'where':{'id':_0x2a89ca['params']['id']}})[_0x1a7b('0x21')](handleEntityNotFound(_0x22bc18,null))[_0x1a7b('0x21')](saveUpdates(_0x2a89ca[_0x1a7b('0x47')],null))[_0x1a7b('0x21')](respondWithResult(_0x22bc18,null))['catch'](handleError(_0x22bc18,null));};exports[_0x1a7b('0x22')]=function(_0x3a9153,_0x10ae0d){return db[_0x1a7b('0x3d')][_0x1a7b('0x46')]({'where':{'id':_0x3a9153[_0x1a7b('0x42')]['id']}})[_0x1a7b('0x21')](handleEntityNotFound(_0x10ae0d,null))[_0x1a7b('0x21')](removeEntity(_0x10ae0d,null))[_0x1a7b('0x40')](handleError(_0x10ae0d,null));};exports['describe']=function(_0x3ae008,_0x210093){return db[_0x1a7b('0x3d')][_0x1a7b('0x48')]()[_0x1a7b('0x21')](respondWithResult(_0x210093,null))[_0x1a7b('0x40')](handleError(_0x210093,null));}; \ No newline at end of file +var _0x9961=['ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x9961,0x89));var _0x1996=function(_0x31bca3,_0x48ea7e){_0x31bca3=_0x31bca3-0x0;var _0x394585=_0x9961[_0x31bca3];return _0x394585;};'use strict';var emlformat=require(_0x1996('0x0'));var rimraf=require(_0x1996('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1996('0x2'));var rp=require(_0x1996('0x3'));var moment=require(_0x1996('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1996('0x5'));var util=require(_0x1996('0x6'));var path=require(_0x1996('0x7'));var sox=require('sox');var csv=require(_0x1996('0x8'));var ejs=require(_0x1996('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1996('0xa'));var squel=require(_0x1996('0xb'));var crypto=require(_0x1996('0xc'));var jsforce=require(_0x1996('0xd'));var deskjs=require(_0x1996('0xe'));var toCsv=require(_0x1996('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1996('0xf'));var authService=require(_0x1996('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1996('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1996('0x12'));var utils=require('../../config/utils');var config=require(_0x1996('0x13'));var licenseUtil=require(_0x1996('0x14'));var db=require(_0x1996('0x15'))['db'];function respondWithStatusCode(_0x1c17b0,_0x59e7bf){_0x59e7bf=_0x59e7bf||0xcc;return function(_0x48af2d){if(_0x48af2d){return _0x1c17b0[_0x1996('0x16')](_0x59e7bf);}return _0x1c17b0[_0x1996('0x17')](_0x59e7bf)[_0x1996('0x18')]();};}function respondWithResult(_0x6764c6,_0x5e695b){_0x5e695b=_0x5e695b||0xc8;return function(_0xc44384){if(_0xc44384){return _0x6764c6[_0x1996('0x17')](_0x5e695b)[_0x1996('0x19')](_0xc44384);}};}function respondWithFilteredResult(_0x185cac,_0x15fb63){return function(_0x7dc7cd){if(_0x7dc7cd){var _0x47cf83=typeof _0x15fb63[_0x1996('0x1a')]===_0x1996('0x1b')&&typeof _0x15fb63[_0x1996('0x1c')]==='undefined';var _0x2bf6fa=_0x7dc7cd[_0x1996('0x1d')];var _0x385cff=_0x47cf83?0x0:_0x15fb63[_0x1996('0x1a')];var _0x30be62=_0x47cf83?_0x7dc7cd[_0x1996('0x1d')]:_0x15fb63[_0x1996('0x1a')]+_0x15fb63[_0x1996('0x1c')];var _0x3c9d81;if(_0x30be62>=_0x2bf6fa){_0x30be62=_0x2bf6fa;_0x3c9d81=0xc8;}else{_0x3c9d81=0xce;}_0x185cac[_0x1996('0x17')](_0x3c9d81);return _0x185cac['set'](_0x1996('0x1e'),_0x385cff+'-'+_0x30be62+'/'+_0x2bf6fa)['json'](_0x7dc7cd);}return null;};}function patchUpdates(_0x5ad82a){return function(_0x5aff04){try{jsonpatch[_0x1996('0x1f')](_0x5aff04,_0x5ad82a,!![]);}catch(_0x199712){return BPromise[_0x1996('0x20')](_0x199712);}return _0x5aff04[_0x1996('0x21')]();};}function saveUpdates(_0x2374fd,_0x43130b){return function(_0x196b27){if(_0x196b27){return _0x196b27['update'](_0x2374fd)[_0x1996('0x22')](function(_0x14b2db){return _0x14b2db;});}return null;};}function removeEntity(_0xe8875d,_0x498b3b){return function(_0x3bca8a){if(_0x3bca8a){return _0x3bca8a[_0x1996('0x23')]()['then'](function(){_0xe8875d[_0x1996('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19ea9f,_0x3b1e96){return function(_0x1426f7){if(!_0x1426f7){_0x19ea9f['sendStatus'](0x194);}return _0x1426f7;};}function handleError(_0x18bf0f,_0x1e2bd3){_0x1e2bd3=_0x1e2bd3||0x1f4;return function(_0x553657){logger['error'](_0x553657[_0x1996('0x24')]);if(_0x553657[_0x1996('0x25')]){delete _0x553657[_0x1996('0x25')];}_0x18bf0f[_0x1996('0x17')](_0x1e2bd3)['send'](_0x553657);};}exports['index']=function(_0x27d21e,_0x3e5fd7){var _0xc324c1={},_0x23ac16={},_0x1085de={'count':0x0,'rows':[]};var _0x54b93d=_[_0x1996('0x26')](db['SmsTransferReport'][_0x1996('0x27')],function(_0x51fa27){return{'name':_0x51fa27[_0x1996('0x28')],'type':_0x51fa27[_0x1996('0x29')][_0x1996('0x2a')]};});_0x23ac16[_0x1996('0x2b')]=_[_0x1996('0x26')](_0x54b93d,_0x1996('0x25'));_0x23ac16['query']=_[_0x1996('0x2c')](_0x27d21e[_0x1996('0x2d')]);_0x23ac16['filters']=_[_0x1996('0x2e')](_0x23ac16[_0x1996('0x2b')],_0x23ac16['query']);_0xc324c1[_0x1996('0x2f')]=_[_0x1996('0x2e')](_0x23ac16[_0x1996('0x2b')],qs[_0x1996('0x30')](_0x27d21e['query'][_0x1996('0x30')]));_0xc324c1[_0x1996('0x2f')]=_0xc324c1['attributes'][_0x1996('0x31')]?_0xc324c1['attributes']:_0x23ac16[_0x1996('0x2b')];if(!_0x27d21e[_0x1996('0x2d')][_0x1996('0x32')](_0x1996('0x33'))){_0xc324c1[_0x1996('0x1c')]=qs[_0x1996('0x1c')](_0x27d21e[_0x1996('0x2d')][_0x1996('0x1c')]);_0xc324c1[_0x1996('0x1a')]=qs[_0x1996('0x1a')](_0x27d21e[_0x1996('0x2d')][_0x1996('0x1a')]);}_0xc324c1['order']=qs['sort'](_0x27d21e[_0x1996('0x2d')][_0x1996('0x34')]);_0xc324c1[_0x1996('0x35')]=qs[_0x1996('0x36')](_[_0x1996('0x37')](_0x27d21e[_0x1996('0x2d')],_0x23ac16['filters']),_0x54b93d);if(_0x27d21e[_0x1996('0x2d')][_0x1996('0x38')]){_0xc324c1['where']=_[_0x1996('0x39')](_0xc324c1[_0x1996('0x35')],{'$or':_[_0x1996('0x26')](_0x54b93d,function(_0x508d88){if(_0x508d88[_0x1996('0x29')]!==_0x1996('0x3a')){var _0x2f1838={};_0x2f1838[_0x508d88[_0x1996('0x25')]]={'$like':'%'+_0x27d21e[_0x1996('0x2d')][_0x1996('0x38')]+'%'};return _0x2f1838;}})});}_0xc324c1=_[_0x1996('0x39')]({},_0xc324c1,_0x27d21e[_0x1996('0x3b')]);var _0xe3f3ee={'where':_0xc324c1[_0x1996('0x35')]};return db[_0x1996('0x3c')]['count'](_0xe3f3ee)['then'](function(_0xa8086b){_0x1085de['count']=_0xa8086b;if(_0x27d21e[_0x1996('0x2d')][_0x1996('0x3d')]){_0xc324c1[_0x1996('0x3e')]=[{'all':!![]}];}return db[_0x1996('0x3c')][_0x1996('0x3f')](_0xc324c1);})[_0x1996('0x22')](function(_0x4321c2){_0x1085de[_0x1996('0x40')]=_0x4321c2;return _0x1085de;})['then'](respondWithFilteredResult(_0x3e5fd7,_0xc324c1))[_0x1996('0x41')](handleError(_0x3e5fd7,null));};exports[_0x1996('0x42')]=function(_0x38543c,_0x4a1bf9){var _0x148d51={'raw':!![],'where':{'id':_0x38543c['params']['id']}},_0x11d8ec={};_0x11d8ec[_0x1996('0x2b')]=_['keys'](db[_0x1996('0x3c')]['rawAttributes']);_0x11d8ec[_0x1996('0x2d')]=_['keys'](_0x38543c[_0x1996('0x2d')]);_0x11d8ec[_0x1996('0x36')]=_[_0x1996('0x2e')](_0x11d8ec[_0x1996('0x2b')],_0x11d8ec[_0x1996('0x2d')]);_0x148d51[_0x1996('0x2f')]=_[_0x1996('0x2e')](_0x11d8ec[_0x1996('0x2b')],qs[_0x1996('0x30')](_0x38543c['query'][_0x1996('0x30')]));_0x148d51[_0x1996('0x2f')]=_0x148d51[_0x1996('0x2f')][_0x1996('0x31')]?_0x148d51[_0x1996('0x2f')]:_0x11d8ec['model'];if(_0x38543c[_0x1996('0x2d')]['includeAll']){_0x148d51[_0x1996('0x3e')]=[{'all':!![]}];}_0x148d51=_[_0x1996('0x39')]({},_0x148d51,_0x38543c[_0x1996('0x3b')]);return db[_0x1996('0x3c')][_0x1996('0x43')](_0x148d51)[_0x1996('0x22')](handleEntityNotFound(_0x4a1bf9,null))[_0x1996('0x22')](respondWithResult(_0x4a1bf9,null))[_0x1996('0x41')](handleError(_0x4a1bf9,null));};exports[_0x1996('0x44')]=function(_0x52498f,_0x5b86ce){return db['SmsTransferReport'][_0x1996('0x44')](_0x52498f[_0x1996('0x45')],{})[_0x1996('0x22')](respondWithResult(_0x5b86ce,0xc9))[_0x1996('0x41')](handleError(_0x5b86ce,null));};exports[_0x1996('0x46')]=function(_0x378571,_0x518632){if(_0x378571[_0x1996('0x45')]['id']){delete _0x378571['body']['id'];}return db[_0x1996('0x3c')][_0x1996('0x43')]({'where':{'id':_0x378571[_0x1996('0x47')]['id']}})[_0x1996('0x22')](handleEntityNotFound(_0x518632,null))[_0x1996('0x22')](saveUpdates(_0x378571[_0x1996('0x45')],null))[_0x1996('0x22')](respondWithResult(_0x518632,null))[_0x1996('0x41')](handleError(_0x518632,null));};exports[_0x1996('0x23')]=function(_0x1d6056,_0x3b19b5){return db[_0x1996('0x3c')][_0x1996('0x43')]({'where':{'id':_0x1d6056[_0x1996('0x47')]['id']}})[_0x1996('0x22')](handleEntityNotFound(_0x3b19b5,null))[_0x1996('0x22')](removeEntity(_0x3b19b5,null))[_0x1996('0x41')](handleError(_0x3b19b5,null));};exports[_0x1996('0x48')]=function(_0x1cad3b,_0x3c37aa){return db[_0x1996('0x3c')][_0x1996('0x48')]()[_0x1996('0x22')](respondWithResult(_0x3c37aa,null))[_0x1996('0x41')](handleError(_0x3c37aa,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 16583d4..f884509 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 _0xd0b2=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path'];(function(_0xc5fcc3,_0x33883a){var _0x26f33a=function(_0xa4a50b){while(--_0xa4a50b){_0xc5fcc3['push'](_0xc5fcc3['shift']());}};_0x26f33a(++_0x33883a);}(_0xd0b2,0x96));var _0x2d0b=function(_0x271b23,_0x39789c){_0x271b23=_0x271b23-0x0;var _0x1266a3=_0xd0b2[_0x271b23];return _0x1266a3;};'use strict';var _=require(_0x2d0b('0x0'));var util=require(_0x2d0b('0x1'));var logger=require(_0x2d0b('0x2'))(_0x2d0b('0x3'));var moment=require(_0x2d0b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d0b('0x5'));var rimraf=require(_0x2d0b('0x6'));var config=require(_0x2d0b('0x7'));var attributes=require(_0x2d0b('0x8'));module[_0x2d0b('0x9')]=function(_0x419d84,_0x11654a){return _0x419d84['define']('SmsTransferReport',attributes,{'tableName':_0x2d0b('0xa'),'paranoid':![],'indexes':[{'name':_0x2d0b('0xb'),'fields':[_0x2d0b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec9=['rimraf','../../config/environment','exports','uniqueid','lodash','../../config/logger','moment','request-promise'];(function(_0x7503c6,_0x4e57d4){var _0x322983=function(_0x34298a){while(--_0x34298a){_0x7503c6['push'](_0x7503c6['shift']());}};_0x322983(++_0x4e57d4);}(_0x6ec9,0x174));var _0x96ec=function(_0x5d1bc5,_0x25b013){_0x5d1bc5=_0x5d1bc5-0x0;var _0x573b3c=_0x6ec9[_0x5d1bc5];return _0x573b3c;};'use strict';var _=require(_0x96ec('0x0'));var util=require('util');var logger=require(_0x96ec('0x1'))('api');var moment=require(_0x96ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x96ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96ec('0x4'));var config=require(_0x96ec('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0x96ec('0x6')]=function(_0x41a215,_0x2fcbb7){return _0x41a215['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x96ec('0x7'),'fields':[_0x96ec('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 723da7f..a3679e9 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 _0x1793=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1793,0x1ce));var _0x3179=function(_0x3f7111,_0x3c0988){_0x3f7111=_0x3f7111-0x0;var _0x216d7d=_0x1793[_0x3f7111];return _0x216d7d;};'use strict';var _=require(_0x3179('0x0'));var util=require(_0x3179('0x1'));var moment=require(_0x3179('0x2'));var BPromise=require(_0x3179('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3179('0x4'));var db=require(_0x3179('0x5'))['db'];var utils=require(_0x3179('0x6'));var logger=require(_0x3179('0x7'))(_0x3179('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3179('0x9')][_0x3179('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52ff5c,_0x4e43f3,_0x446329){return new BPromise(function(_0x160208,_0x23d2ee){return client['request'](_0x52ff5c,_0x446329)[_0x3179('0xb')](function(_0x433f39){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4e43f3,_0x3179('0xc'));logger[_0x3179('0xd')](_0x3179('0xe'),_0x4e43f3,'request\x20sent',JSON[_0x3179('0xf')](_0x433f39));if(_0x433f39[_0x3179('0x10')]){if(_0x433f39[_0x3179('0x10')][_0x3179('0x11')]===0x1f4){logger['error'](_0x3179('0x12'),_0x4e43f3,_0x433f39[_0x3179('0x10')][_0x3179('0x13')]);return _0x23d2ee(_0x433f39['error']['message']);}logger[_0x3179('0x10')](_0x3179('0x12'),_0x4e43f3,_0x433f39['error']['message']);return _0x160208(_0x433f39[_0x3179('0x10')][_0x3179('0x13')]);}else{logger[_0x3179('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4e43f3,_0x3179('0xc'));_0x160208(_0x433f39[_0x3179('0x15')][_0x3179('0x13')]);}})[_0x3179('0x16')](function(_0x24451a){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4e43f3,_0x24451a);_0x23d2ee(_0x24451a);});});} \ No newline at end of file +var _0xbe22=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xbe22,0x1c1));var _0x2be2=function(_0xa245ab,_0x4957c9){_0xa245ab=_0xa245ab-0x0;var _0x135f60=_0xbe22[_0xa245ab];return _0x135f60;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2be2('0x2'));var fs=require('fs');var Redis=require(_0x2be2('0x3'));var db=require(_0x2be2('0x4'))['db'];var utils=require(_0x2be2('0x5'));var logger=require(_0x2be2('0x6'))(_0x2be2('0x7'));var config=require(_0x2be2('0x8'));var jayson=require(_0x2be2('0x9'));var client=jayson[_0x2be2('0xa')][_0x2be2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59740c,_0x1fd9fc,_0x27e1a9){return new BPromise(function(_0x12d9b4,_0x4855fa){return client[_0x2be2('0xc')](_0x59740c,_0x27e1a9)[_0x2be2('0xd')](function(_0x1d20f1){logger[_0x2be2('0xe')](_0x2be2('0xf'),_0x1fd9fc,_0x2be2('0x10'));logger[_0x2be2('0x11')](_0x2be2('0x12'),_0x1fd9fc,'request\x20sent',JSON[_0x2be2('0x13')](_0x1d20f1));if(_0x1d20f1[_0x2be2('0x14')]){if(_0x1d20f1['error'][_0x2be2('0x15')]===0x1f4){logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x1d20f1['error'][_0x2be2('0x16')]);return _0x4855fa(_0x1d20f1[_0x2be2('0x14')]['message']);}logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x1d20f1[_0x2be2('0x14')]['message']);return _0x12d9b4(_0x1d20f1[_0x2be2('0x14')][_0x2be2('0x16')]);}else{logger['info'](_0x2be2('0xf'),_0x1fd9fc,_0x2be2('0x10'));_0x12d9b4(_0x1d20f1['result'][_0x2be2('0x16')]);}})['catch'](function(_0x435664){logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x435664);_0x4855fa(_0x435664);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 678f03d..e03903b 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 _0xf133=['format','%s-%s%s','basename','now','post','file','create','put','update','delete','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','/:id','show','/:id/download','isAuthenticated','diskStorage','join','root','originalname','replace'];(function(_0x151add,_0x1b87c6){var _0x1479e7=function(_0x627399){while(--_0x627399){_0x151add['push'](_0x151add['shift']());}};_0x1479e7(++_0x1b87c6);}(_0xf133,0x176));var _0x3f13=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf133[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3f13('0x0'));var timeout=require(_0x3f13('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3f13('0x2'));var auth=require(_0x3f13('0x3'));var interaction=require(_0x3f13('0x4'));var config=require('../../config/environment');var controller=require(_0x3f13('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3f13('0x6')](_0x3f13('0x7'),auth['isAuthenticated'](),controller[_0x3f13('0x8')]);router[_0x3f13('0x6')](_0x3f13('0x9'),auth[_0x3f13('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x3f13('0xb')]({'destination':function(_0x30bde9,_0x55a23c,_0x5489e9){_0x5489e9(null,path[_0x3f13('0xc')](config[_0x3f13('0xd')],'server/files/sounds/original/'));},'filename':function(_0x15be44,_0x296b18,_0x144013){_0x296b18[_0x3f13('0xe')]=_0x296b18[_0x3f13('0xe')][_0x3f13('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x144013(null,util[_0x3f13('0x10')](_0x3f13('0x11'),path[_0x3f13('0x12')](_0x296b18[_0x3f13('0xe')],path['extname'](_0x296b18['originalname'])),Date[_0x3f13('0x13')](),path['extname'](_0x296b18[_0x3f13('0xe')])));}})});router[_0x3f13('0x14')]('/',upload['single'](_0x3f13('0x15')),controller[_0x3f13('0x16')]);router[_0x3f13('0x17')](_0x3f13('0x7'),auth[_0x3f13('0xa')](),controller[_0x3f13('0x18')]);router[_0x3f13('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x3f13('0x19')]);module['exports']=router; \ No newline at end of file +var _0x531a=['./sound.controller','get','isAuthenticated','/:id','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','extname','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4c7922,_0xea9dab){var _0x2a60c6=function(_0x29b6d2){while(--_0x29b6d2){_0x4c7922['push'](_0x4c7922['shift']());}};_0x2a60c6(++_0xea9dab);}(_0x531a,0xd7));var _0xa531=function(_0x110d53,_0x59b52e){_0x110d53=_0x110d53-0x0;var _0x24c192=_0x531a[_0x110d53];return _0x24c192;};'use strict';var multer=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var path=require(_0xa531('0x2'));var timeout=require(_0xa531('0x3'));var express=require(_0xa531('0x4'));var router=express[_0xa531('0x5')]();var fs_extra=require(_0xa531('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa531('0x7'));var config=require(_0xa531('0x8'));var controller=require(_0xa531('0x9'));router[_0xa531('0xa')]('/',auth[_0xa531('0xb')](),controller['index']);router[_0xa531('0xa')](_0xa531('0xc'),auth[_0xa531('0xb')](),controller['show']);router[_0xa531('0xa')]('/:id/download',auth[_0xa531('0xb')](),controller[_0xa531('0xd')]);var upload=multer({'storage':multer[_0xa531('0xe')]({'destination':function(_0x400d0a,_0x428f83,_0x407890){_0x407890(null,path[_0xa531('0xf')](config[_0xa531('0x10')],_0xa531('0x11')));},'filename':function(_0x5f18c0,_0xea61a0,_0x54634e){_0xea61a0['originalname']=_0xea61a0[_0xa531('0x12')][_0xa531('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x54634e(null,util['format']('%s-%s%s',path['basename'](_0xea61a0[_0xa531('0x12')],path[_0xa531('0x14')](_0xea61a0[_0xa531('0x12')])),Date['now'](),path[_0xa531('0x14')](_0xea61a0['originalname'])));}})});router['post']('/',upload[_0xa531('0x15')](_0xa531('0x16')),controller[_0xa531('0x17')]);router[_0xa531('0x18')](_0xa531('0xc'),auth['isAuthenticated'](),controller[_0xa531('0x19')]);router[_0xa531('0x1a')](_0xa531('0xc'),auth[_0xa531('0xb')](),controller['delete']);module[_0xa531('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index cf421dc..6ce2e0f 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 _0xf698=['BIGINT','INTEGER','STRING','FLOAT'];(function(_0x1695ce,_0xfbc15){var _0x216995=function(_0x508c4f){while(--_0x508c4f){_0x1695ce['push'](_0x1695ce['shift']());}};_0x216995(++_0xfbc15);}(_0xf698,0x10e));var _0x8f69=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xf698[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8f69('0x0')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x8f69('0x0')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x8f69('0x0')]},'original_format':{'type':Sequelize[_0x8f69('0x0')]},'original_duration':{'type':Sequelize[_0x8f69('0x1')]},'original_sampleCount':{'type':Sequelize[_0x8f69('0x2')]},'original_channelCount':{'type':Sequelize[_0x8f69('0x3')]},'original_bitRate':{'type':Sequelize[_0x8f69('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x8f69('0x0')]},'converted_duration':{'type':Sequelize[_0x8f69('0x1')]},'converted_sampleCount':{'type':Sequelize[_0x8f69('0x2')]},'converted_channelCount':{'type':Sequelize[_0x8f69('0x3')]},'converted_bitRate':{'type':Sequelize[_0x8f69('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x8f69('0x3')]}}; \ No newline at end of file +var _0x0974=['name','FLOAT','INTEGER','BIGINT','exports','STRING'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x0974,0x100));var _0x4097=function(_0x4575dd,_0x314721){_0x4575dd=_0x4575dd-0x0;var _0x4e5186=_0x0974[_0x4575dd];return _0x4e5186;};'use strict';var Sequelize=require('sequelize');module[_0x4097('0x0')]={'name':{'type':Sequelize[_0x4097('0x1')],'unique':_0x4097('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4097('0x1')]},'display_name':{'type':Sequelize[_0x4097('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4097('0x1')]},'original_format':{'type':Sequelize[_0x4097('0x1')]},'original_duration':{'type':Sequelize[_0x4097('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x4097('0x4')]},'original_bitRate':{'type':Sequelize[_0x4097('0x5')]},'original_sampleRate':{'type':Sequelize[_0x4097('0x4')]},'converted_format':{'type':Sequelize[_0x4097('0x1')]},'converted_duration':{'type':Sequelize[_0x4097('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4097('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ee1c812..837dbb3 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 _0x4cb7=['converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','sampleRate','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','Sound','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','download','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','save_name','format','converted_format','file','originalname','extname','basename','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','send','src','duration','sampleCount','original_channelCount','channelCount'];(function(_0xdeffe6,_0x198150){var _0x5baeb=function(_0x51e1c5){while(--_0x51e1c5){_0xdeffe6['push'](_0xdeffe6['shift']());}};_0x5baeb(++_0x198150);}(_0x4cb7,0x8b));var _0x74cb=function(_0x56ebcf,_0x15423d){_0x56ebcf=_0x56ebcf-0x0;var _0x5ba88a=_0x4cb7[_0x56ebcf];return _0x5ba88a;};'use strict';var emlformat=require(_0x74cb('0x0'));var rimraf=require(_0x74cb('0x1'));var zipdir=require(_0x74cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x74cb('0x3'));var BPromise=require(_0x74cb('0x4'));var Mustache=require(_0x74cb('0x5'));var util=require(_0x74cb('0x6'));var path=require(_0x74cb('0x7'));var sox=require(_0x74cb('0x8'));var csv=require(_0x74cb('0x9'));var ejs=require(_0x74cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74cb('0xb'));var squel=require(_0x74cb('0xc'));var crypto=require(_0x74cb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74cb('0x9'));var querystring=require(_0x74cb('0xe'));var Papa=require('papaparse');var Redis=require(_0x74cb('0xf'));var authService=require(_0x74cb('0x10'));var qs=require(_0x74cb('0x11'));var as=require(_0x74cb('0x12'));var hardwareService=require(_0x74cb('0x13'));var logger=require(_0x74cb('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x74cb('0x15'));var db=require(_0x74cb('0x16'))['db'];function respondWithStatusCode(_0x4b62ef,_0x29ad3f){_0x29ad3f=_0x29ad3f||0xcc;return function(_0x4e8e03){if(_0x4e8e03){return _0x4b62ef['sendStatus'](_0x29ad3f);}return _0x4b62ef[_0x74cb('0x17')](_0x29ad3f)[_0x74cb('0x18')]();};}function respondWithResult(_0x3e5157,_0x111a9c){_0x111a9c=_0x111a9c||0xc8;return function(_0x4f4af4){if(_0x4f4af4){return _0x3e5157['status'](_0x111a9c)['json'](_0x4f4af4);}};}function respondWithFilteredResult(_0x253e16,_0x214670){return function(_0x56228e){if(_0x56228e){var _0x3b7569=typeof _0x214670[_0x74cb('0x19')]===_0x74cb('0x1a')&&typeof _0x214670[_0x74cb('0x1b')]===_0x74cb('0x1a');var _0x274de=_0x56228e[_0x74cb('0x1c')];var _0x1ae24e=_0x3b7569?0x0:_0x214670['offset'];var _0x3cfdec=_0x3b7569?_0x56228e['count']:_0x214670['offset']+_0x214670['limit'];var _0xf2ed5a;if(_0x3cfdec>=_0x274de){_0x3cfdec=_0x274de;_0xf2ed5a=0xc8;}else{_0xf2ed5a=0xce;}_0x253e16[_0x74cb('0x17')](_0xf2ed5a);return _0x253e16[_0x74cb('0x1d')](_0x74cb('0x1e'),_0x1ae24e+'-'+_0x3cfdec+'/'+_0x274de)['json'](_0x56228e);}return null;};}function patchUpdates(_0x1f0ef2){return function(_0x390546){try{jsonpatch['apply'](_0x390546,_0x1f0ef2,!![]);}catch(_0x58c26d){return BPromise['reject'](_0x58c26d);}return _0x390546[_0x74cb('0x1f')]();};}function saveUpdates(_0x2758ae,_0x138607){return function(_0x460580){if(_0x460580){return _0x460580[_0x74cb('0x20')](_0x2758ae)[_0x74cb('0x21')](function(_0x28541d){return _0x28541d;});}return null;};}function removeEntity(_0x257782,_0xfdc262){return function(_0x57fd9f){if(_0x57fd9f){return _0x57fd9f[_0x74cb('0x22')]()[_0x74cb('0x21')](function(){var _0x1a982c=_0x57fd9f[_0x74cb('0x23')]({'plain':!![]});var _0x2ce217=_0x74cb('0x24');return db[_0x74cb('0x25')][_0x74cb('0x22')]({'where':{'type':_0x2ce217,'resourceId':_0x1a982c['id']}})[_0x74cb('0x21')](function(){return _0x57fd9f;});})[_0x74cb('0x21')](function(){_0x257782[_0x74cb('0x17')](0xcc)[_0x74cb('0x18')]();});}};}function handleEntityNotFound(_0xf57509,_0x533de2){return function(_0x10e0a1){if(!_0x10e0a1){_0xf57509[_0x74cb('0x26')](0x194);}return _0x10e0a1;};}function handleError(_0xe03e5d,_0x10724f){_0x10724f=_0x10724f||0x1f4;return function(_0xc52ec0){logger[_0x74cb('0x27')](_0xc52ec0[_0x74cb('0x28')]);if(_0xc52ec0[_0x74cb('0x29')]){delete _0xc52ec0[_0x74cb('0x29')];}_0xe03e5d['status'](_0x10724f)['send'](_0xc52ec0);};}exports['index']=function(_0x42a4e8,_0x5ae6b2){var _0x1dab99={},_0x49aaea={},_0x26c463={'count':0x0,'rows':[]};var _0x494aeb=_['map'](db[_0x74cb('0x2a')][_0x74cb('0x2b')],function(_0x127cc1){return{'name':_0x127cc1[_0x74cb('0x2c')],'type':_0x127cc1[_0x74cb('0x2d')][_0x74cb('0x2e')]};});_0x49aaea['model']=_[_0x74cb('0x2f')](_0x494aeb,_0x74cb('0x29'));_0x49aaea[_0x74cb('0x30')]=_[_0x74cb('0x31')](_0x42a4e8[_0x74cb('0x30')]);_0x49aaea[_0x74cb('0x32')]=_['intersection'](_0x49aaea[_0x74cb('0x33')],_0x49aaea[_0x74cb('0x30')]);_0x1dab99[_0x74cb('0x34')]=_[_0x74cb('0x35')](_0x49aaea[_0x74cb('0x33')],qs[_0x74cb('0x36')](_0x42a4e8['query'][_0x74cb('0x36')]));_0x1dab99[_0x74cb('0x34')]=_0x1dab99['attributes'][_0x74cb('0x37')]?_0x1dab99['attributes']:_0x49aaea[_0x74cb('0x33')];if(!_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x38')]('nolimit')){_0x1dab99[_0x74cb('0x1b')]=qs[_0x74cb('0x1b')](_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x1b')]);_0x1dab99[_0x74cb('0x19')]=qs[_0x74cb('0x19')](_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x19')]);}_0x1dab99[_0x74cb('0x39')]=qs[_0x74cb('0x3a')](_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x3a')]);_0x1dab99['where']=qs[_0x74cb('0x32')](_[_0x74cb('0x3b')](_0x42a4e8[_0x74cb('0x30')],_0x49aaea['filters']),_0x494aeb);if(_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x3c')]){_0x1dab99[_0x74cb('0x3d')]=_[_0x74cb('0x3e')](_0x1dab99['where'],{'$or':_[_0x74cb('0x2f')](_0x494aeb,function(_0x2c6736){if(_0x2c6736[_0x74cb('0x2d')]!==_0x74cb('0x3f')){var _0x4dbda6={};_0x4dbda6[_0x2c6736['name']]={'$like':'%'+_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x3c')]+'%'};return _0x4dbda6;}})});}_0x1dab99=_[_0x74cb('0x3e')]({},_0x1dab99,_0x42a4e8[_0x74cb('0x40')]);var _0x3af50d={'where':_0x1dab99['where']};return db[_0x74cb('0x2a')][_0x74cb('0x1c')](_0x3af50d)[_0x74cb('0x21')](function(_0x83119a){_0x26c463[_0x74cb('0x1c')]=_0x83119a;if(_0x42a4e8[_0x74cb('0x30')]['includeAll']){_0x1dab99[_0x74cb('0x41')]=[{'all':!![]}];}return db[_0x74cb('0x2a')][_0x74cb('0x42')](_0x1dab99);})[_0x74cb('0x21')](function(_0x54af86){_0x26c463[_0x74cb('0x43')]=_0x54af86;return _0x26c463;})[_0x74cb('0x21')](respondWithFilteredResult(_0x5ae6b2,_0x1dab99))[_0x74cb('0x44')](handleError(_0x5ae6b2,null));};exports[_0x74cb('0x45')]=function(_0x60aae4,_0x35265b){var _0x2aa7e2={'raw':!![],'where':{'id':_0x60aae4[_0x74cb('0x46')]['id']}},_0x4cf832={};_0x4cf832[_0x74cb('0x33')]=_[_0x74cb('0x31')](db[_0x74cb('0x2a')]['rawAttributes']);_0x4cf832[_0x74cb('0x30')]=_[_0x74cb('0x31')](_0x60aae4[_0x74cb('0x30')]);_0x4cf832[_0x74cb('0x32')]=_[_0x74cb('0x35')](_0x4cf832['model'],_0x4cf832[_0x74cb('0x30')]);_0x2aa7e2[_0x74cb('0x34')]=_[_0x74cb('0x35')](_0x4cf832[_0x74cb('0x33')],qs[_0x74cb('0x36')](_0x60aae4['query'][_0x74cb('0x36')]));_0x2aa7e2[_0x74cb('0x34')]=_0x2aa7e2[_0x74cb('0x34')][_0x74cb('0x37')]?_0x2aa7e2[_0x74cb('0x34')]:_0x4cf832['model'];if(_0x60aae4['query'][_0x74cb('0x47')]){_0x2aa7e2[_0x74cb('0x41')]=[{'all':!![]}];}_0x2aa7e2=_['merge']({},_0x2aa7e2,_0x60aae4['options']);return db[_0x74cb('0x2a')][_0x74cb('0x48')](_0x2aa7e2)['then'](handleEntityNotFound(_0x35265b,null))[_0x74cb('0x21')](respondWithResult(_0x35265b,null))[_0x74cb('0x44')](handleError(_0x35265b,null));};exports[_0x74cb('0x49')]=function(_0x353b76,_0x4d297c,_0x4606a5){return db[_0x74cb('0x2a')]['find']({'where':{'id':_0x353b76[_0x74cb('0x46')]['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})[_0x74cb('0x21')](handleEntityNotFound(_0x4d297c,null))[_0x74cb('0x21')](function(_0x3ef3f9){if(_0x3ef3f9){if(!fs['existsSync'](path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x4c'),_0x3ef3f9['save_name']+'.'+_0x3ef3f9['converted_format']))){throw new db[(_0x74cb('0x4d'))][(_0x74cb('0x4e'))](_0x74cb('0x4f'));}return _0x4d297c[_0x74cb('0x49')](path[_0x74cb('0x4a')](config['root'],_0x74cb('0x4c'),util['format'](_0x74cb('0x50'),_0x3ef3f9[_0x74cb('0x51')],_0x3ef3f9['converted_format'])),util[_0x74cb('0x52')](_0x74cb('0x50'),_0x3ef3f9[_0x74cb('0x29')],_0x3ef3f9[_0x74cb('0x53')]));}return null;})['catch'](handleError(_0x4d297c,null));};exports['create']=function(_0x2626d8,_0x119917,_0x4d46f4){var _0x11c87a={'name':path['basename'](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x55')],path[_0x74cb('0x56')](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x55')])),'save_name':path[_0x74cb('0x57')](_0x2626d8[_0x74cb('0x54')]['filename'],path[_0x74cb('0x56')](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')])),'original_format':path['extname'](_0x2626d8[_0x74cb('0x54')]['originalname'])[_0x74cb('0x59')](0x1),'converted_format':'wav'};var _0x4c7e16=path['join'](config[_0x74cb('0x4b')],_0x74cb('0x5a'),_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')]);var _0x903e04=path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x4c'),util['format']('%s.%s',path['basename'](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')],path[_0x74cb('0x56')](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')])),_0x11c87a[_0x74cb('0x53')]));logger[_0x74cb('0x5b')](_0x74cb('0x5c'),_0x4c7e16);logger['info'](_0x74cb('0x5d'),_0x903e04);try{fs[_0x74cb('0x5e')](_0x4c7e16,parseInt(_0x74cb('0x5f'),0x8));var _0x437b4a=sox[_0x74cb('0x60')](_0x4c7e16,_0x903e04,{'sampleRate':0x1f40,'format':_0x74cb('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x437b4a['on'](_0x74cb('0x27'),function(_0x479025){fs[_0x74cb('0x62')](_0x4c7e16);_0x119917['status'](0x1f4)[_0x74cb('0x63')](_0x479025);});_0x437b4a['on'](_0x74cb('0x64'),function(_0x47439d){_0x11c87a['original_duration']=isNaN(_0x47439d[_0x74cb('0x65')])?null:_0x47439d[_0x74cb('0x65')]*0x3e8;_0x11c87a['original_sampleCount']=isNaN(_0x47439d['sampleCount'])?null:_0x47439d[_0x74cb('0x66')];_0x11c87a[_0x74cb('0x67')]=isNaN(_0x47439d['channelCount'])?null:_0x47439d[_0x74cb('0x68')];_0x11c87a['original_bitRate']=isNaN(_0x47439d['bitRate'])?null:_0x47439d['bitRate'];_0x11c87a['original_sampleRate']=isNaN(_0x47439d['sampleRate'])?null:_0x47439d['sampleRate'];});_0x437b4a['on']('dest',function(_0x141f97){_0x11c87a[_0x74cb('0x69')]=isNaN(_0x141f97[_0x74cb('0x65')])?null:_0x141f97['duration']*0x3e8;_0x11c87a[_0x74cb('0x6a')]=isNaN(_0x141f97[_0x74cb('0x66')])?null:_0x141f97[_0x74cb('0x66')];_0x11c87a[_0x74cb('0x6b')]=isNaN(_0x141f97[_0x74cb('0x68')])?null:_0x141f97[_0x74cb('0x68')];_0x11c87a[_0x74cb('0x6c')]=isNaN(_0x141f97[_0x74cb('0x6d')])?null:_0x141f97[_0x74cb('0x6d')];_0x11c87a[_0x74cb('0x6e')]=isNaN(_0x141f97[_0x74cb('0x6f')])?null:_0x141f97['sampleRate'];});_0x437b4a['on']('end',function(){fs[_0x74cb('0x5e')](_0x903e04,parseInt('0777',0x8));return db['Sound'][_0x74cb('0x70')](_0x11c87a)['then'](function(_0x2ce030){var _0x4fab6c={'role':_0x2626d8[_0x74cb('0x71')][_0x74cb('0x72')],'userProfileId':_0x2626d8['body']['userProfileId']};if(!_0x4fab6c)throw new Error(_0x74cb('0x73'));if(_0x4fab6c[_0x74cb('0x72')]==='user'){var _0x42547b=_0x2ce030[_0x74cb('0x23')]({'plain':!![]});return db[_0x74cb('0x74')][_0x74cb('0x48')]({'where':{'name':_0x74cb('0x24'),'userProfileId':_0x4fab6c[_0x74cb('0x75')]},'raw':!![]})[_0x74cb('0x21')](function(_0x25b5cf){if(_0x25b5cf&&_0x25b5cf['autoAssociation']===0x0){return db[_0x74cb('0x25')][_0x74cb('0x70')]({'name':_0x42547b[_0x74cb('0x29')],'resourceId':_0x42547b['id'],'type':_0x25b5cf['name'],'sectionId':_0x25b5cf['id']},{})['then'](function(){return _0x2ce030;});}else{return _0x2ce030;}})[_0x74cb('0x44')](function(_0xe35646){logger['error'](_0x74cb('0x76'),_0xe35646);throw _0xe35646;});}return _0x2ce030;})[_0x74cb('0x21')](respondWithResult(_0x119917,null))['catch'](handleError(_0x119917,null));});_0x437b4a[_0x74cb('0x77')]();}catch(_0x267875){_0x119917[_0x74cb('0x17')](0x1f4)[_0x74cb('0x63')](_0x267875);}};exports[_0x74cb('0x20')]=function(_0x46f3db,_0x3cf995,_0x1e414f){return db[_0x74cb('0x2a')][_0x74cb('0x48')]({'where':{'id':_0x46f3db['params']['id']}})[_0x74cb('0x21')](handleEntityNotFound(_0x3cf995,null))['then'](saveUpdates(_[_0x74cb('0x3b')](_0x46f3db['body'],[_0x74cb('0x29'),_0x74cb('0x78')]),null))[_0x74cb('0x21')](respondWithResult(_0x3cf995,null))[_0x74cb('0x44')](handleError(_0x3cf995,null));};exports[_0x74cb('0x79')]=function(_0x4926b4,_0x1aa977,_0x26dab8){return db['Sound'][_0x74cb('0x48')]({'where':{'id':_0x4926b4[_0x74cb('0x46')]['id']}})['then'](function(_0xfbdd6b){if(_0xfbdd6b){return _0xfbdd6b['destroy']();}})[_0x74cb('0x21')](function(_0x1543e8){var _0x51acf7=path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x5a'),util[_0x74cb('0x52')](_0x74cb('0x50'),_0x1543e8[_0x74cb('0x51')],_0x1543e8['original_format']));var _0x47f826=path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x4c'),util[_0x74cb('0x52')](_0x74cb('0x50'),_0x1543e8[_0x74cb('0x51')],_0x1543e8['converted_format']));fs['unlinkSync'](_0x51acf7);fs[_0x74cb('0x62')](_0x47f826);return _0x1543e8;})[_0x74cb('0x21')](function(_0x4640b6){if(_0x4640b6){return _0x1aa977['status'](0xcc)[_0x74cb('0x18')]();}})[_0x74cb('0x21')](handleEntityNotFound(_0x1aa977,null))['catch'](handleError(_0x1aa977,null));}; \ No newline at end of file +var _0x9e2d=['%s.%s','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','send','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds','autoAssociation','start','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','Sound','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format'];(function(_0x30bd3b,_0x2b8bfc){var _0x2bfbdd=function(_0x19dba2){while(--_0x19dba2){_0x30bd3b['push'](_0x30bd3b['shift']());}};_0x2bfbdd(++_0x2b8bfc);}(_0x9e2d,0x1b1));var _0xd9e2=function(_0x297873,_0x168898){_0x297873=_0x297873-0x0;var _0x33d338=_0x9e2d[_0x297873];return _0x33d338;};'use strict';var emlformat=require(_0xd9e2('0x0'));var rimraf=require(_0xd9e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9e2('0x2'));var rp=require(_0xd9e2('0x3'));var moment=require(_0xd9e2('0x4'));var BPromise=require(_0xd9e2('0x5'));var Mustache=require(_0xd9e2('0x6'));var util=require('util');var path=require(_0xd9e2('0x7'));var sox=require(_0xd9e2('0x8'));var csv=require(_0xd9e2('0x9'));var ejs=require(_0xd9e2('0xa'));var fs=require('fs');var fs_extra=require(_0xd9e2('0xb'));var _=require(_0xd9e2('0xc'));var squel=require(_0xd9e2('0xd'));var crypto=require('crypto');var jsforce=require(_0xd9e2('0xe'));var deskjs=require(_0xd9e2('0xf'));var toCsv=require(_0xd9e2('0x9'));var querystring=require(_0xd9e2('0x10'));var Papa=require(_0xd9e2('0x11'));var Redis=require(_0xd9e2('0x12'));var authService=require(_0xd9e2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd9e2('0x14'));var hardwareService=require(_0xd9e2('0x15'));var logger=require(_0xd9e2('0x16'))(_0xd9e2('0x17'));var utils=require('../../config/utils');var config=require(_0xd9e2('0x18'));var licenseUtil=require(_0xd9e2('0x19'));var db=require(_0xd9e2('0x1a'))['db'];function respondWithStatusCode(_0x247e01,_0x5672ac){_0x5672ac=_0x5672ac||0xcc;return function(_0x272ff6){if(_0x272ff6){return _0x247e01[_0xd9e2('0x1b')](_0x5672ac);}return _0x247e01[_0xd9e2('0x1c')](_0x5672ac)[_0xd9e2('0x1d')]();};}function respondWithResult(_0x21dde1,_0x1fc9c0){_0x1fc9c0=_0x1fc9c0||0xc8;return function(_0x5b8d99){if(_0x5b8d99){return _0x21dde1[_0xd9e2('0x1c')](_0x1fc9c0)[_0xd9e2('0x1e')](_0x5b8d99);}};}function respondWithFilteredResult(_0x16d002,_0x4b18aa){return function(_0x41bfe1){if(_0x41bfe1){var _0x12b78c=typeof _0x4b18aa['offset']===_0xd9e2('0x1f')&&typeof _0x4b18aa[_0xd9e2('0x20')]===_0xd9e2('0x1f');var _0x3cad08=_0x41bfe1[_0xd9e2('0x21')];var _0x5685ee=_0x12b78c?0x0:_0x4b18aa[_0xd9e2('0x22')];var _0x2a23df=_0x12b78c?_0x41bfe1['count']:_0x4b18aa[_0xd9e2('0x22')]+_0x4b18aa['limit'];var _0x2a01a6;if(_0x2a23df>=_0x3cad08){_0x2a23df=_0x3cad08;_0x2a01a6=0xc8;}else{_0x2a01a6=0xce;}_0x16d002[_0xd9e2('0x1c')](_0x2a01a6);return _0x16d002['set'](_0xd9e2('0x23'),_0x5685ee+'-'+_0x2a23df+'/'+_0x3cad08)[_0xd9e2('0x1e')](_0x41bfe1);}return null;};}function patchUpdates(_0x57d0c2){return function(_0x136bbe){try{jsonpatch['apply'](_0x136bbe,_0x57d0c2,!![]);}catch(_0x13f3f8){return BPromise[_0xd9e2('0x24')](_0x13f3f8);}return _0x136bbe[_0xd9e2('0x25')]();};}function saveUpdates(_0xb4348c,_0x3f0fb4){return function(_0x2d5a61){if(_0x2d5a61){return _0x2d5a61[_0xd9e2('0x26')](_0xb4348c)['then'](function(_0x1db084){return _0x1db084;});}return null;};}function removeEntity(_0x32625f,_0x1437f2){return function(_0x48a687){if(_0x48a687){return _0x48a687[_0xd9e2('0x27')]()[_0xd9e2('0x28')](function(){var _0x515da5=_0x48a687[_0xd9e2('0x29')]({'plain':!![]});var _0x1e14d9='Sounds';return db[_0xd9e2('0x2a')]['destroy']({'where':{'type':_0x1e14d9,'resourceId':_0x515da5['id']}})[_0xd9e2('0x28')](function(){return _0x48a687;});})[_0xd9e2('0x28')](function(){_0x32625f[_0xd9e2('0x1c')](0xcc)[_0xd9e2('0x1d')]();});}};}function handleEntityNotFound(_0x3ed030,_0x2d15ff){return function(_0x48b17c){if(!_0x48b17c){_0x3ed030['sendStatus'](0x194);}return _0x48b17c;};}function handleError(_0x35979f,_0xb9f0bf){_0xb9f0bf=_0xb9f0bf||0x1f4;return function(_0x5ca19b){logger[_0xd9e2('0x2b')](_0x5ca19b[_0xd9e2('0x2c')]);if(_0x5ca19b[_0xd9e2('0x2d')]){delete _0x5ca19b['name'];}_0x35979f[_0xd9e2('0x1c')](_0xb9f0bf)['send'](_0x5ca19b);};}exports[_0xd9e2('0x2e')]=function(_0x1b61fd,_0xa0ea55){var _0x59f28f={},_0x5aadeb={},_0x360bad={'count':0x0,'rows':[]};var _0x49b2b7=_[_0xd9e2('0x2f')](db['Sound'][_0xd9e2('0x30')],function(_0x5720db){return{'name':_0x5720db[_0xd9e2('0x31')],'type':_0x5720db[_0xd9e2('0x32')][_0xd9e2('0x33')]};});_0x5aadeb['model']=_[_0xd9e2('0x2f')](_0x49b2b7,_0xd9e2('0x2d'));_0x5aadeb[_0xd9e2('0x34')]=_[_0xd9e2('0x35')](_0x1b61fd[_0xd9e2('0x34')]);_0x5aadeb[_0xd9e2('0x36')]=_[_0xd9e2('0x37')](_0x5aadeb['model'],_0x5aadeb[_0xd9e2('0x34')]);_0x59f28f[_0xd9e2('0x38')]=_[_0xd9e2('0x37')](_0x5aadeb[_0xd9e2('0x39')],qs[_0xd9e2('0x3a')](_0x1b61fd[_0xd9e2('0x34')]['fields']));_0x59f28f[_0xd9e2('0x38')]=_0x59f28f[_0xd9e2('0x38')][_0xd9e2('0x3b')]?_0x59f28f[_0xd9e2('0x38')]:_0x5aadeb[_0xd9e2('0x39')];if(!_0x1b61fd[_0xd9e2('0x34')]['hasOwnProperty'](_0xd9e2('0x3c'))){_0x59f28f[_0xd9e2('0x20')]=qs[_0xd9e2('0x20')](_0x1b61fd[_0xd9e2('0x34')][_0xd9e2('0x20')]);_0x59f28f[_0xd9e2('0x22')]=qs[_0xd9e2('0x22')](_0x1b61fd[_0xd9e2('0x34')][_0xd9e2('0x22')]);}_0x59f28f[_0xd9e2('0x3d')]=qs[_0xd9e2('0x3e')](_0x1b61fd[_0xd9e2('0x34')][_0xd9e2('0x3e')]);_0x59f28f['where']=qs[_0xd9e2('0x36')](_[_0xd9e2('0x3f')](_0x1b61fd[_0xd9e2('0x34')],_0x5aadeb[_0xd9e2('0x36')]),_0x49b2b7);if(_0x1b61fd[_0xd9e2('0x34')][_0xd9e2('0x40')]){_0x59f28f['where']=_[_0xd9e2('0x41')](_0x59f28f['where'],{'$or':_[_0xd9e2('0x2f')](_0x49b2b7,function(_0x42fe28){if(_0x42fe28[_0xd9e2('0x32')]!==_0xd9e2('0x42')){var _0x26d03e={};_0x26d03e[_0x42fe28[_0xd9e2('0x2d')]]={'$like':'%'+_0x1b61fd['query']['filter']+'%'};return _0x26d03e;}})});}_0x59f28f=_[_0xd9e2('0x41')]({},_0x59f28f,_0x1b61fd[_0xd9e2('0x43')]);var _0x189120={'where':_0x59f28f['where']};return db['Sound'][_0xd9e2('0x21')](_0x189120)[_0xd9e2('0x28')](function(_0x33ef13){_0x360bad[_0xd9e2('0x21')]=_0x33ef13;if(_0x1b61fd['query'][_0xd9e2('0x44')]){_0x59f28f[_0xd9e2('0x45')]=[{'all':!![]}];}return db['Sound'][_0xd9e2('0x46')](_0x59f28f);})[_0xd9e2('0x28')](function(_0x126e16){_0x360bad[_0xd9e2('0x47')]=_0x126e16;return _0x360bad;})[_0xd9e2('0x28')](respondWithFilteredResult(_0xa0ea55,_0x59f28f))[_0xd9e2('0x48')](handleError(_0xa0ea55,null));};exports[_0xd9e2('0x49')]=function(_0x27b99e,_0x177312){var _0x1386b6={'raw':!![],'where':{'id':_0x27b99e[_0xd9e2('0x4a')]['id']}},_0x3bfa05={};_0x3bfa05[_0xd9e2('0x39')]=_['keys'](db['Sound'][_0xd9e2('0x30')]);_0x3bfa05[_0xd9e2('0x34')]=_['keys'](_0x27b99e[_0xd9e2('0x34')]);_0x3bfa05['filters']=_[_0xd9e2('0x37')](_0x3bfa05[_0xd9e2('0x39')],_0x3bfa05[_0xd9e2('0x34')]);_0x1386b6[_0xd9e2('0x38')]=_[_0xd9e2('0x37')](_0x3bfa05[_0xd9e2('0x39')],qs[_0xd9e2('0x3a')](_0x27b99e['query'][_0xd9e2('0x3a')]));_0x1386b6['attributes']=_0x1386b6[_0xd9e2('0x38')]['length']?_0x1386b6['attributes']:_0x3bfa05['model'];if(_0x27b99e['query'][_0xd9e2('0x44')]){_0x1386b6[_0xd9e2('0x45')]=[{'all':!![]}];}_0x1386b6=_[_0xd9e2('0x41')]({},_0x1386b6,_0x27b99e[_0xd9e2('0x43')]);return db[_0xd9e2('0x4b')][_0xd9e2('0x4c')](_0x1386b6)[_0xd9e2('0x28')](handleEntityNotFound(_0x177312,null))[_0xd9e2('0x28')](respondWithResult(_0x177312,null))['catch'](handleError(_0x177312,null));};exports['download']=function(_0x7f3f92,_0x4cf038,_0x2ac0a7){return db['Sound'][_0xd9e2('0x4c')]({'where':{'id':_0x7f3f92[_0xd9e2('0x4a')]['id']},'attributes':[_0xd9e2('0x2d'),_0xd9e2('0x4d'),_0xd9e2('0x4e')],'raw':!![]})[_0xd9e2('0x28')](handleEntityNotFound(_0x4cf038,null))[_0xd9e2('0x28')](function(_0x1cd2b1){if(_0x1cd2b1){if(!fs['existsSync'](path[_0xd9e2('0x4f')](config[_0xd9e2('0x50')],_0xd9e2('0x51'),_0x1cd2b1['save_name']+'.'+_0x1cd2b1[_0xd9e2('0x4e')]))){throw new db[(_0xd9e2('0x52'))][(_0xd9e2('0x53'))](_0xd9e2('0x54'));}return _0x4cf038[_0xd9e2('0x55')](path['join'](config[_0xd9e2('0x50')],_0xd9e2('0x51'),util['format']('%s.%s',_0x1cd2b1[_0xd9e2('0x4d')],_0x1cd2b1[_0xd9e2('0x4e')])),util[_0xd9e2('0x56')](_0xd9e2('0x57'),_0x1cd2b1[_0xd9e2('0x2d')],_0x1cd2b1[_0xd9e2('0x4e')]));}return null;})[_0xd9e2('0x48')](handleError(_0x4cf038,null));};exports[_0xd9e2('0x58')]=function(_0x37b2ce,_0x4d0052,_0x4d5bb2){var _0x21ecab={'name':path[_0xd9e2('0x59')](_0x37b2ce[_0xd9e2('0x5a')]['originalname'],path[_0xd9e2('0x5b')](_0x37b2ce[_0xd9e2('0x5a')][_0xd9e2('0x5c')])),'save_name':path[_0xd9e2('0x59')](_0x37b2ce[_0xd9e2('0x5a')][_0xd9e2('0x5d')],path['extname'](_0x37b2ce[_0xd9e2('0x5a')][_0xd9e2('0x5d')])),'original_format':path['extname'](_0x37b2ce['file'][_0xd9e2('0x5c')])[_0xd9e2('0x5e')](0x1),'converted_format':_0xd9e2('0x5f')};var _0x3f8735=path[_0xd9e2('0x4f')](config[_0xd9e2('0x50')],_0xd9e2('0x60'),_0x37b2ce[_0xd9e2('0x5a')][_0xd9e2('0x5d')]);var _0x460b75=path[_0xd9e2('0x4f')](config[_0xd9e2('0x50')],_0xd9e2('0x51'),util['format'](_0xd9e2('0x57'),path[_0xd9e2('0x59')](_0x37b2ce[_0xd9e2('0x5a')][_0xd9e2('0x5d')],path['extname'](_0x37b2ce['file'][_0xd9e2('0x5d')])),_0x21ecab[_0xd9e2('0x4e')]));logger[_0xd9e2('0x61')](_0xd9e2('0x62'),_0x3f8735);logger[_0xd9e2('0x61')](_0xd9e2('0x63'),_0x460b75);try{fs['chmodSync'](_0x3f8735,parseInt(_0xd9e2('0x64'),0x8));var _0x4cefe0=sox[_0xd9e2('0x65')](_0x3f8735,_0x460b75,{'sampleRate':0x1f40,'format':_0xd9e2('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4cefe0['on'](_0xd9e2('0x2b'),function(_0x32b083){fs[_0xd9e2('0x66')](_0x3f8735);_0x4d0052['status'](0x1f4)[_0xd9e2('0x67')](_0x32b083);});_0x4cefe0['on'](_0xd9e2('0x68'),function(_0x5cbd33){_0x21ecab[_0xd9e2('0x69')]=isNaN(_0x5cbd33[_0xd9e2('0x6a')])?null:_0x5cbd33['duration']*0x3e8;_0x21ecab['original_sampleCount']=isNaN(_0x5cbd33['sampleCount'])?null:_0x5cbd33[_0xd9e2('0x6b')];_0x21ecab['original_channelCount']=isNaN(_0x5cbd33[_0xd9e2('0x6c')])?null:_0x5cbd33[_0xd9e2('0x6c')];_0x21ecab[_0xd9e2('0x6d')]=isNaN(_0x5cbd33[_0xd9e2('0x6e')])?null:_0x5cbd33[_0xd9e2('0x6e')];_0x21ecab[_0xd9e2('0x6f')]=isNaN(_0x5cbd33[_0xd9e2('0x70')])?null:_0x5cbd33[_0xd9e2('0x70')];});_0x4cefe0['on']('dest',function(_0x857de6){_0x21ecab[_0xd9e2('0x71')]=isNaN(_0x857de6['duration'])?null:_0x857de6['duration']*0x3e8;_0x21ecab[_0xd9e2('0x72')]=isNaN(_0x857de6[_0xd9e2('0x6b')])?null:_0x857de6[_0xd9e2('0x6b')];_0x21ecab[_0xd9e2('0x73')]=isNaN(_0x857de6[_0xd9e2('0x6c')])?null:_0x857de6[_0xd9e2('0x6c')];_0x21ecab[_0xd9e2('0x74')]=isNaN(_0x857de6[_0xd9e2('0x6e')])?null:_0x857de6[_0xd9e2('0x6e')];_0x21ecab[_0xd9e2('0x75')]=isNaN(_0x857de6['sampleRate'])?null:_0x857de6[_0xd9e2('0x70')];});_0x4cefe0['on'](_0xd9e2('0x1d'),function(){fs[_0xd9e2('0x76')](_0x460b75,parseInt(_0xd9e2('0x64'),0x8));return db[_0xd9e2('0x4b')]['create'](_0x21ecab)[_0xd9e2('0x28')](function(_0x8d19c2){var _0x4d2563={'role':_0x37b2ce['body'][_0xd9e2('0x77')],'userProfileId':_0x37b2ce[_0xd9e2('0x78')][_0xd9e2('0x79')]};if(!_0x4d2563)throw new Error(_0xd9e2('0x7a'));if(_0x4d2563[_0xd9e2('0x77')]===_0xd9e2('0x7b')){var _0x14c921=_0x8d19c2[_0xd9e2('0x29')]({'plain':!![]});return db['UserProfileSection'][_0xd9e2('0x4c')]({'where':{'name':_0xd9e2('0x7c'),'userProfileId':_0x4d2563['userProfileId']},'raw':!![]})[_0xd9e2('0x28')](function(_0x3fb73b){if(_0x3fb73b&&_0x3fb73b[_0xd9e2('0x7d')]===0x0){return db[_0xd9e2('0x2a')]['create']({'name':_0x14c921[_0xd9e2('0x2d')],'resourceId':_0x14c921['id'],'type':_0x3fb73b[_0xd9e2('0x2d')],'sectionId':_0x3fb73b['id']},{})[_0xd9e2('0x28')](function(){return _0x8d19c2;});}else{return _0x8d19c2;}})[_0xd9e2('0x48')](function(_0x2c638a){logger[_0xd9e2('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c638a);throw _0x2c638a;});}return _0x8d19c2;})[_0xd9e2('0x28')](respondWithResult(_0x4d0052,null))[_0xd9e2('0x48')](handleError(_0x4d0052,null));});_0x4cefe0[_0xd9e2('0x7e')]();}catch(_0x4cffce){_0x4d0052[_0xd9e2('0x1c')](0x1f4)['send'](_0x4cffce);}};exports[_0xd9e2('0x26')]=function(_0xf97bc9,_0x209ed1,_0x3711a4){return db[_0xd9e2('0x4b')][_0xd9e2('0x4c')]({'where':{'id':_0xf97bc9[_0xd9e2('0x4a')]['id']}})[_0xd9e2('0x28')](handleEntityNotFound(_0x209ed1,null))[_0xd9e2('0x28')](saveUpdates(_[_0xd9e2('0x3f')](_0xf97bc9[_0xd9e2('0x78')],[_0xd9e2('0x2d'),_0xd9e2('0x7f')]),null))[_0xd9e2('0x28')](respondWithResult(_0x209ed1,null))[_0xd9e2('0x48')](handleError(_0x209ed1,null));};exports[_0xd9e2('0x80')]=function(_0x3b8b08,_0x5ac157,_0x3dfd9f){return db[_0xd9e2('0x4b')]['find']({'where':{'id':_0x3b8b08[_0xd9e2('0x4a')]['id']}})[_0xd9e2('0x28')](function(_0x59bf85){if(_0x59bf85){return _0x59bf85[_0xd9e2('0x27')]();}})[_0xd9e2('0x28')](function(_0x291d60){var _0x552e80=path[_0xd9e2('0x4f')](config['root'],'server/files/sounds/original',util[_0xd9e2('0x56')](_0xd9e2('0x57'),_0x291d60[_0xd9e2('0x4d')],_0x291d60[_0xd9e2('0x81')]));var _0x3831b5=path[_0xd9e2('0x4f')](config['root'],'server/files/sounds/converted',util['format'](_0xd9e2('0x57'),_0x291d60[_0xd9e2('0x4d')],_0x291d60[_0xd9e2('0x4e')]));fs[_0xd9e2('0x66')](_0x552e80);fs[_0xd9e2('0x66')](_0x3831b5);return _0x291d60;})[_0xd9e2('0x28')](function(_0x3af1d6){if(_0x3af1d6){return _0x5ac157['status'](0xcc)[_0xd9e2('0x1d')]();}})['then'](handleEntityNotFound(_0x5ac157,null))[_0xd9e2('0x48')](handleError(_0x5ac157,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d853d3b..6e1ad46 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 _0x9db5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x2ac193,_0x313650){var _0x10e2dc=function(_0x4003e0){while(--_0x4003e0){_0x2ac193['push'](_0x2ac193['shift']());}};_0x10e2dc(++_0x313650);}(_0x9db5,0xf4));var _0x59db=function(_0x1131a5,_0x263b45){_0x1131a5=_0x1131a5-0x0;var _0x4af3cb=_0x9db5[_0x1131a5];return _0x4af3cb;};'use strict';var _=require(_0x59db('0x0'));var util=require(_0x59db('0x1'));var logger=require(_0x59db('0x2'))(_0x59db('0x3'));var moment=require(_0x59db('0x4'));var BPromise=require(_0x59db('0x5'));var rp=require(_0x59db('0x6'));var fs=require('fs');var path=require(_0x59db('0x7'));var rimraf=require(_0x59db('0x8'));var config=require(_0x59db('0x9'));var attributes=require('./sound.attributes');module['exports']=function(_0x1fab55,_0x18f56c){return _0x1fab55[_0x59db('0xa')](_0x59db('0xb'),attributes,{'tableName':_0x59db('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7d4=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4f9807,_0x2a229f){var _0x1ea38c=function(_0xece789){while(--_0xece789){_0x4f9807['push'](_0x4f9807['shift']());}};_0x1ea38c(++_0x2a229f);}(_0xe7d4,0xae));var _0x4e7d=function(_0x20ac4d,_0x1657d9){_0x20ac4d=_0x20ac4d-0x0;var _0x3f1b26=_0xe7d4[_0x20ac4d];return _0x3f1b26;};'use strict';var _=require(_0x4e7d('0x0'));var util=require(_0x4e7d('0x1'));var logger=require(_0x4e7d('0x2'))(_0x4e7d('0x3'));var moment=require(_0x4e7d('0x4'));var BPromise=require('bluebird');var rp=require(_0x4e7d('0x5'));var fs=require('fs');var path=require(_0x4e7d('0x6'));var rimraf=require('rimraf');var config=require(_0x4e7d('0x7'));var attributes=require(_0x4e7d('0x8'));module[_0x4e7d('0x9')]=function(_0x34471b,_0x272b39){return _0x34471b[_0x4e7d('0xa')](_0x4e7d('0xb'),attributes,{'tableName':_0x4e7d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index a828d57..d20774d 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 _0x00db=['ShowSound','Sound','options','raw','where','attributes','map','model','include','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x00db,0x166));var _0xb00d=function(_0x5cdb47,_0x1e43d6){_0x5cdb47=_0x5cdb47-0x0;var _0x5c5e2b=_0x00db[_0x5cdb47];return _0x5c5e2b;};'use strict';var _=require('lodash');var util=require(_0xb00d('0x0'));var moment=require(_0xb00d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb00d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb00d('0x3'))(_0xb00d('0x4'));var config=require(_0xb00d('0x5'));var jayson=require(_0xb00d('0x6'));var client=jayson['client'][_0xb00d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x284ea7,_0x45b616,_0x3ce941){return new BPromise(function(_0x3b9f8a,_0x17c87f){return client[_0xb00d('0x8')](_0x284ea7,_0x3ce941)[_0xb00d('0x9')](function(_0x56a9cd){logger[_0xb00d('0xa')](_0xb00d('0xb'),_0x45b616,_0xb00d('0xc'));logger[_0xb00d('0xd')](_0xb00d('0xe'),_0x45b616,'request\x20sent',JSON[_0xb00d('0xf')](_0x56a9cd));if(_0x56a9cd[_0xb00d('0x10')]){if(_0x56a9cd[_0xb00d('0x10')]['code']===0x1f4){logger[_0xb00d('0x10')](_0xb00d('0xb'),_0x45b616,_0x56a9cd[_0xb00d('0x10')][_0xb00d('0x11')]);return _0x17c87f(_0x56a9cd['error'][_0xb00d('0x11')]);}logger[_0xb00d('0x10')](_0xb00d('0xb'),_0x45b616,_0x56a9cd[_0xb00d('0x10')][_0xb00d('0x11')]);return _0x3b9f8a(_0x56a9cd[_0xb00d('0x10')][_0xb00d('0x11')]);}else{logger[_0xb00d('0xa')](_0xb00d('0xb'),_0x45b616,_0xb00d('0xc'));_0x3b9f8a(_0x56a9cd[_0xb00d('0x12')]['message']);}})['catch'](function(_0x45f127){logger[_0xb00d('0x10')](_0xb00d('0xb'),_0x45b616,_0x45f127);_0x17c87f(_0x45f127);});});}exports[_0xb00d('0x13')]=function(_0x1fa748){var _0xd62938=this;return new Promise(function(_0x2c9a70,_0x5c16ea){return db[_0xb00d('0x14')]['find']({'raw':_0x1fa748[_0xb00d('0x15')]?_0x1fa748[_0xb00d('0x15')][_0xb00d('0x16')]===undefined?!![]:![]:!![],'where':_0x1fa748[_0xb00d('0x15')]?_0x1fa748['options'][_0xb00d('0x17')]||null:null,'attributes':_0x1fa748['options']?_0x1fa748['options'][_0xb00d('0x18')]||null:null,'include':_0x1fa748[_0xb00d('0x15')]?_0x1fa748[_0xb00d('0x15')]['include']?_[_0xb00d('0x19')](_0x1fa748[_0xb00d('0x15')]['include'],function(_0x548cb8){return{'model':db[_0x548cb8[_0xb00d('0x1a')]],'as':_0x548cb8['as'],'attributes':_0x548cb8['attributes'],'include':_0x548cb8[_0xb00d('0x1b')]?_['map'](_0x548cb8[_0xb00d('0x1b')],function(_0x22fe53){return{'model':db[_0x22fe53['model']],'as':_0x22fe53['as'],'attributes':_0x22fe53['attributes'],'include':_0x22fe53['include']?_[_0xb00d('0x19')](_0x22fe53[_0xb00d('0x1b')],function(_0x11dce4){return{'model':db[_0x11dce4[_0xb00d('0x1a')]],'as':_0x11dce4['as'],'attributes':_0x11dce4[_0xb00d('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb00d('0x9')](function(_0x7b9d6f){logger[_0xb00d('0xa')]('ShowSound',_0x1fa748);logger[_0xb00d('0xd')](_0xb00d('0x13'),_0x1fa748,JSON[_0xb00d('0xf')](_0x7b9d6f));_0x2c9a70(_0x7b9d6f);})[_0xb00d('0x1c')](function(_0x58d134){logger[_0xb00d('0x10')](_0xb00d('0x13'),_0x58d134[_0xb00d('0x11')],_0x1fa748);_0x5c16ea(_0xd62938[_0xb00d('0x10')](0x1f4,_0x58d134[_0xb00d('0x11')]));});});}; \ No newline at end of file +var _0x72f3=['debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSound','find','options','raw','where','attributes','map','include','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','request\x20sent'];(function(_0x1d062d,_0x17fa78){var _0x40e450=function(_0x3fb53e){while(--_0x3fb53e){_0x1d062d['push'](_0x1d062d['shift']());}};_0x40e450(++_0x17fa78);}(_0x72f3,0xd8));var _0x372f=function(_0x2e4441,_0x366096){_0x2e4441=_0x2e4441-0x0;var _0x3f1c00=_0x72f3[_0x2e4441];return _0x3f1c00;};'use strict';var _=require(_0x372f('0x0'));var util=require(_0x372f('0x1'));var moment=require('moment');var BPromise=require(_0x372f('0x2'));var rs=require(_0x372f('0x3'));var fs=require('fs');var Redis=require(_0x372f('0x4'));var db=require(_0x372f('0x5'))['db'];var utils=require(_0x372f('0x6'));var logger=require('../../config/logger')(_0x372f('0x7'));var config=require(_0x372f('0x8'));var jayson=require(_0x372f('0x9'));var client=jayson[_0x372f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1663,_0x39188c,_0x410f9a){return new BPromise(function(_0x17f3dc,_0x47c0c4){return client[_0x372f('0xb')](_0x4d1663,_0x410f9a)[_0x372f('0xc')](function(_0x1d9bbb){logger['info'](_0x372f('0xd'),_0x39188c,_0x372f('0xe'));logger[_0x372f('0xf')](_0x372f('0x10'),_0x39188c,_0x372f('0xe'),JSON[_0x372f('0x11')](_0x1d9bbb));if(_0x1d9bbb[_0x372f('0x12')]){if(_0x1d9bbb['error'][_0x372f('0x13')]===0x1f4){logger[_0x372f('0x12')](_0x372f('0xd'),_0x39188c,_0x1d9bbb[_0x372f('0x12')]['message']);return _0x47c0c4(_0x1d9bbb[_0x372f('0x12')][_0x372f('0x14')]);}logger[_0x372f('0x12')]('Sound,\x20%s,\x20%s',_0x39188c,_0x1d9bbb['error'][_0x372f('0x14')]);return _0x17f3dc(_0x1d9bbb['error'][_0x372f('0x14')]);}else{logger[_0x372f('0x15')](_0x372f('0xd'),_0x39188c,_0x372f('0xe'));_0x17f3dc(_0x1d9bbb[_0x372f('0x16')][_0x372f('0x14')]);}})[_0x372f('0x17')](function(_0x2bc523){logger[_0x372f('0x12')](_0x372f('0xd'),_0x39188c,_0x2bc523);_0x47c0c4(_0x2bc523);});});}exports[_0x372f('0x18')]=function(_0x504956){var _0x418171=this;return new Promise(function(_0x229f0a,_0x1ff340){return db['Sound'][_0x372f('0x19')]({'raw':_0x504956['options']?_0x504956[_0x372f('0x1a')][_0x372f('0x1b')]===undefined?!![]:![]:!![],'where':_0x504956[_0x372f('0x1a')]?_0x504956[_0x372f('0x1a')][_0x372f('0x1c')]||null:null,'attributes':_0x504956[_0x372f('0x1a')]?_0x504956[_0x372f('0x1a')][_0x372f('0x1d')]||null:null,'include':_0x504956[_0x372f('0x1a')]?_0x504956[_0x372f('0x1a')]['include']?_[_0x372f('0x1e')](_0x504956[_0x372f('0x1a')][_0x372f('0x1f')],function(_0x2efa2d){return{'model':db[_0x2efa2d[_0x372f('0x20')]],'as':_0x2efa2d['as'],'attributes':_0x2efa2d[_0x372f('0x1d')],'include':_0x2efa2d[_0x372f('0x1f')]?_['map'](_0x2efa2d[_0x372f('0x1f')],function(_0x4773be){return{'model':db[_0x4773be['model']],'as':_0x4773be['as'],'attributes':_0x4773be['attributes'],'include':_0x4773be[_0x372f('0x1f')]?_[_0x372f('0x1e')](_0x4773be[_0x372f('0x1f')],function(_0x54a40b){return{'model':db[_0x54a40b[_0x372f('0x20')]],'as':_0x54a40b['as'],'attributes':_0x54a40b[_0x372f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x372f('0xc')](function(_0x40ab62){logger[_0x372f('0x15')](_0x372f('0x18'),_0x504956);logger['debug'](_0x372f('0x18'),_0x504956,JSON[_0x372f('0x11')](_0x40ab62));_0x229f0a(_0x40ab62);})['catch'](function(_0x7b42d5){logger[_0x372f('0x12')](_0x372f('0x18'),_0x7b42d5[_0x372f('0x14')],_0x504956);_0x1ff340(_0x418171[_0x372f('0x12')](0x1f4,_0x7b42d5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a879184..c4b5174 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x35d294,_0x3a9b4){var _0xb9ae9a=function(_0x3c08ce){while(--_0x3c08ce){_0x35d294['push'](_0x35d294['shift']());}};_0xb9ae9a(++_0x3a9b4);}(_0x2032,0xd9));var _0x2203=function(_0x3c29ac,_0x278e96){_0x3c29ac=_0x3c29ac-0x0;var _0x4320d0=_0x2032[_0x3c29ac];return _0x4320d0;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x0b0e,0x187));var _0xe0b0=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x0b0e[_0xbf8ebe];return _0x1e25e8;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 36813e7..cc7547a 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 _0xde49=['TEXT','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x2a64ab,_0x3ad8bc){var _0x289b69=function(_0x3eb6b3){while(--_0x3eb6b3){_0x2a64ab['push'](_0x2a64ab['shift']());}};_0x289b69(++_0x3ad8bc);}(_0xde49,0xbe));var _0x9de4=function(_0xe25d87,_0x391229){_0xe25d87=_0xe25d87-0x0;var _0x199807=_0xde49[_0xe25d87];return _0x199807;};'use strict';var Sequelize=require(_0x9de4('0x0'));module[_0x9de4('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x9de4('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x9de4('0x3')]('in',_0x9de4('0x4')),'defaultValue':_0x9de4('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9de4('0x5')]},'providerResponse':{'type':Sequelize[_0x9de4('0x6')]}}; \ No newline at end of file +var _0x8ead=['STRING','TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x2ac9bb,_0x217e49){var _0x32ca5e=function(_0x307b78){while(--_0x307b78){_0x2ac9bb['push'](_0x2ac9bb['shift']());}};_0x32ca5e(++_0x217e49);}(_0x8ead,0x98));var _0xd8ea=function(_0x14de6b,_0x2bece2){_0x14de6b=_0x14de6b-0x0;var _0x15b46c=_0x8ead[_0x14de6b];return _0x15b46c;};'use strict';var Sequelize=require(_0xd8ea('0x0'));module[_0xd8ea('0x1')]={'uniqueid':{'type':Sequelize[_0xd8ea('0x2')]},'body':{'type':Sequelize[_0xd8ea('0x3')](_0xd8ea('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xd8ea('0x5')]('in','out'),'defaultValue':_0xd8ea('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd8ea('0x2')]},'providerResponse':{'type':Sequelize[_0xd8ea('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index b5a6bfd..057e67f 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 _0xa0df=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','send','index','map','SquareMessage','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x42774c,_0x54b775){var _0x167bbf=function(_0x677611){while(--_0x677611){_0x42774c['push'](_0x42774c['shift']());}};_0x167bbf(++_0x54b775);}(_0xa0df,0x11d));var _0xfa0d=function(_0x564090,_0x26aa09){_0x564090=_0x564090-0x0;var _0x295eaf=_0xa0df[_0x564090];return _0x295eaf;};'use strict';var emlformat=require(_0xfa0d('0x0'));var rimraf=require(_0xfa0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa0d('0x2'));var rp=require(_0xfa0d('0x3'));var moment=require('moment');var BPromise=require(_0xfa0d('0x4'));var Mustache=require(_0xfa0d('0x5'));var util=require(_0xfa0d('0x6'));var path=require(_0xfa0d('0x7'));var sox=require(_0xfa0d('0x8'));var csv=require(_0xfa0d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa0d('0xa'));var _=require(_0xfa0d('0xb'));var squel=require('squel');var crypto=require(_0xfa0d('0xc'));var jsforce=require(_0xfa0d('0xd'));var deskjs=require(_0xfa0d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa0d('0xf'));var Papa=require(_0xfa0d('0x10'));var Redis=require('ioredis');var authService=require(_0xfa0d('0x11'));var qs=require(_0xfa0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa0d('0x13'));var logger=require(_0xfa0d('0x14'))(_0xfa0d('0x15'));var utils=require(_0xfa0d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfa0d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x546d98,_0x5e5c57){_0x5e5c57=_0x5e5c57||0xcc;return function(_0x383693){if(_0x383693){return _0x546d98['sendStatus'](_0x5e5c57);}return _0x546d98['status'](_0x5e5c57)[_0xfa0d('0x18')]();};}function respondWithResult(_0x44dee5,_0x52744a){_0x52744a=_0x52744a||0xc8;return function(_0x44f341){if(_0x44f341){return _0x44dee5[_0xfa0d('0x19')](_0x52744a)[_0xfa0d('0x1a')](_0x44f341);}};}function respondWithFilteredResult(_0x6feb24,_0x42c249){return function(_0x5e9e9b){if(_0x5e9e9b){var _0x3e0859=typeof _0x42c249[_0xfa0d('0x1b')]===_0xfa0d('0x1c')&&typeof _0x42c249[_0xfa0d('0x1d')]===_0xfa0d('0x1c');var _0x11474b=_0x5e9e9b['count'];var _0x4d3191=_0x3e0859?0x0:_0x42c249['offset'];var _0x2bef43=_0x3e0859?_0x5e9e9b[_0xfa0d('0x1e')]:_0x42c249[_0xfa0d('0x1b')]+_0x42c249['limit'];var _0x5a83b5;if(_0x2bef43>=_0x11474b){_0x2bef43=_0x11474b;_0x5a83b5=0xc8;}else{_0x5a83b5=0xce;}_0x6feb24['status'](_0x5a83b5);return _0x6feb24[_0xfa0d('0x1f')](_0xfa0d('0x20'),_0x4d3191+'-'+_0x2bef43+'/'+_0x11474b)['json'](_0x5e9e9b);}return null;};}function patchUpdates(_0x1d4824){return function(_0xa450b7){try{jsonpatch[_0xfa0d('0x21')](_0xa450b7,_0x1d4824,!![]);}catch(_0x19a3b4){return BPromise[_0xfa0d('0x22')](_0x19a3b4);}return _0xa450b7[_0xfa0d('0x23')]();};}function saveUpdates(_0x49c02f,_0x447c4c){return function(_0x3af8c6){if(_0x3af8c6){return _0x3af8c6[_0xfa0d('0x24')](_0x49c02f)['then'](function(_0x2f4331){return _0x2f4331;});}return null;};}function removeEntity(_0x2dd3a3,_0x25b0ff){return function(_0x2a90e7){if(_0x2a90e7){return _0x2a90e7[_0xfa0d('0x25')]()[_0xfa0d('0x26')](function(){_0x2dd3a3[_0xfa0d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc5ad83,_0x1a5028){return function(_0xb9cc55){if(!_0xb9cc55){_0xc5ad83[_0xfa0d('0x27')](0x194);}return _0xb9cc55;};}function handleError(_0x1ba354,_0x3a14fa){_0x3a14fa=_0x3a14fa||0x1f4;return function(_0x3331e8){logger['error'](_0x3331e8[_0xfa0d('0x28')]);if(_0x3331e8['name']){delete _0x3331e8['name'];}_0x1ba354['status'](_0x3a14fa)[_0xfa0d('0x29')](_0x3331e8);};}exports[_0xfa0d('0x2a')]=function(_0x454d99,_0x11e396){var _0x4c885f={},_0x3119f3={},_0x13c2ed={'count':0x0,'rows':[]};var _0x2bf1d3=_[_0xfa0d('0x2b')](db[_0xfa0d('0x2c')][_0xfa0d('0x2d')],function(_0x262f4d){return{'name':_0x262f4d[_0xfa0d('0x2e')],'type':_0x262f4d[_0xfa0d('0x2f')]['key']};});_0x3119f3['model']=_[_0xfa0d('0x2b')](_0x2bf1d3,_0xfa0d('0x30'));_0x3119f3['query']=_['keys'](_0x454d99[_0xfa0d('0x31')]);_0x3119f3[_0xfa0d('0x32')]=_[_0xfa0d('0x33')](_0x3119f3[_0xfa0d('0x34')],_0x3119f3[_0xfa0d('0x31')]);_0x4c885f[_0xfa0d('0x35')]=_[_0xfa0d('0x33')](_0x3119f3[_0xfa0d('0x34')],qs[_0xfa0d('0x36')](_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x36')]));_0x4c885f[_0xfa0d('0x35')]=_0x4c885f[_0xfa0d('0x35')][_0xfa0d('0x37')]?_0x4c885f['attributes']:_0x3119f3[_0xfa0d('0x34')];if(!_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x38')](_0xfa0d('0x39'))){_0x4c885f[_0xfa0d('0x1d')]=qs['limit'](_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x1d')]);_0x4c885f[_0xfa0d('0x1b')]=qs['offset'](_0x454d99[_0xfa0d('0x31')]['offset']);}_0x4c885f[_0xfa0d('0x3a')]=qs[_0xfa0d('0x3b')](_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x3b')]);_0x4c885f[_0xfa0d('0x3c')]=qs[_0xfa0d('0x32')](_[_0xfa0d('0x3d')](_0x454d99[_0xfa0d('0x31')],_0x3119f3[_0xfa0d('0x32')]),_0x2bf1d3);if(_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x3e')]){_0x4c885f[_0xfa0d('0x3c')]=_[_0xfa0d('0x3f')](_0x4c885f[_0xfa0d('0x3c')],{'$or':_['map'](_0x2bf1d3,function(_0x12470e){if(_0x12470e[_0xfa0d('0x2f')]!==_0xfa0d('0x40')){var _0x43cf7b={};_0x43cf7b[_0x12470e[_0xfa0d('0x30')]]={'$like':'%'+_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x3e')]+'%'};return _0x43cf7b;}})});}_0x4c885f=_[_0xfa0d('0x3f')]({},_0x4c885f,_0x454d99['options']);var _0x226b42={'where':_0x4c885f[_0xfa0d('0x3c')]};return db['SquareMessage'][_0xfa0d('0x1e')](_0x226b42)[_0xfa0d('0x26')](function(_0xc6b36e){_0x13c2ed[_0xfa0d('0x1e')]=_0xc6b36e;if(_0x454d99['query'][_0xfa0d('0x41')]){_0x4c885f[_0xfa0d('0x42')]=[{'all':!![]}];}return db[_0xfa0d('0x2c')][_0xfa0d('0x43')](_0x4c885f);})[_0xfa0d('0x26')](function(_0x4c2ba2){_0x13c2ed[_0xfa0d('0x44')]=_0x4c2ba2;return _0x13c2ed;})[_0xfa0d('0x26')](respondWithFilteredResult(_0x11e396,_0x4c885f))[_0xfa0d('0x45')](handleError(_0x11e396,null));};exports[_0xfa0d('0x46')]=function(_0x49da4c,_0x48096e){var _0x5ccc1c={'raw':!![],'where':{'id':_0x49da4c[_0xfa0d('0x47')]['id']}},_0xd9cae={};_0xd9cae[_0xfa0d('0x34')]=_[_0xfa0d('0x48')](db[_0xfa0d('0x2c')][_0xfa0d('0x2d')]);_0xd9cae['query']=_[_0xfa0d('0x48')](_0x49da4c['query']);_0xd9cae[_0xfa0d('0x32')]=_[_0xfa0d('0x33')](_0xd9cae['model'],_0xd9cae[_0xfa0d('0x31')]);_0x5ccc1c[_0xfa0d('0x35')]=_['intersection'](_0xd9cae[_0xfa0d('0x34')],qs[_0xfa0d('0x36')](_0x49da4c[_0xfa0d('0x31')][_0xfa0d('0x36')]));_0x5ccc1c[_0xfa0d('0x35')]=_0x5ccc1c[_0xfa0d('0x35')][_0xfa0d('0x37')]?_0x5ccc1c['attributes']:_0xd9cae['model'];if(_0x49da4c[_0xfa0d('0x31')][_0xfa0d('0x41')]){_0x5ccc1c[_0xfa0d('0x42')]=[{'all':!![]}];}_0x5ccc1c=_[_0xfa0d('0x3f')]({},_0x5ccc1c,_0x49da4c['options']);return db[_0xfa0d('0x2c')][_0xfa0d('0x49')](_0x5ccc1c)[_0xfa0d('0x26')](handleEntityNotFound(_0x48096e,null))[_0xfa0d('0x26')](respondWithResult(_0x48096e,null))[_0xfa0d('0x45')](handleError(_0x48096e,null));};exports[_0xfa0d('0x4a')]=function(_0x35e9b9,_0xeba2c6){return db[_0xfa0d('0x2c')][_0xfa0d('0x4a')](_0x35e9b9['body'],{})[_0xfa0d('0x26')](respondWithResult(_0xeba2c6,0xc9))['catch'](handleError(_0xeba2c6,null));};exports[_0xfa0d('0x24')]=function(_0x262951,_0x5858eb){if(_0x262951[_0xfa0d('0x4b')]['id']){delete _0x262951[_0xfa0d('0x4b')]['id'];}return db[_0xfa0d('0x2c')][_0xfa0d('0x49')]({'where':{'id':_0x262951['params']['id']}})['then'](handleEntityNotFound(_0x5858eb,null))[_0xfa0d('0x26')](saveUpdates(_0x262951[_0xfa0d('0x4b')],null))['then'](respondWithResult(_0x5858eb,null))[_0xfa0d('0x45')](handleError(_0x5858eb,null));};exports['destroy']=function(_0x28f066,_0x25c574){return db[_0xfa0d('0x2c')]['find']({'where':{'id':_0x28f066['params']['id']}})[_0xfa0d('0x26')](handleEntityNotFound(_0x25c574,null))['then'](removeEntity(_0x25c574,null))['catch'](handleError(_0x25c574,null));}; \ No newline at end of file +var _0x9c36=['then','destroy','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','intersection','options','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9c36,0xbf));var _0x69c3=function(_0x5d4c91,_0x29c02a){_0x5d4c91=_0x5d4c91-0x0;var _0x3875cf=_0x9c36[_0x5d4c91];return _0x3875cf;};'use strict';var emlformat=require(_0x69c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69c3('0x1'));var jsonpatch=require(_0x69c3('0x2'));var rp=require(_0x69c3('0x3'));var moment=require(_0x69c3('0x4'));var BPromise=require(_0x69c3('0x5'));var Mustache=require(_0x69c3('0x6'));var util=require(_0x69c3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x69c3('0x8'));var ejs=require(_0x69c3('0x9'));var fs=require('fs');var fs_extra=require(_0x69c3('0xa'));var _=require(_0x69c3('0xb'));var squel=require('squel');var crypto=require(_0x69c3('0xc'));var jsforce=require(_0x69c3('0xd'));var deskjs=require(_0x69c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x69c3('0xf'));var Papa=require(_0x69c3('0x10'));var Redis=require(_0x69c3('0x11'));var authService=require(_0x69c3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x69c3('0x13'));var hardwareService=require(_0x69c3('0x14'));var logger=require(_0x69c3('0x15'))(_0x69c3('0x16'));var utils=require('../../config/utils');var config=require(_0x69c3('0x17'));var licenseUtil=require(_0x69c3('0x18'));var db=require(_0x69c3('0x19'))['db'];function respondWithStatusCode(_0x5d8462,_0x9cc727){_0x9cc727=_0x9cc727||0xcc;return function(_0xb76c14){if(_0xb76c14){return _0x5d8462['sendStatus'](_0x9cc727);}return _0x5d8462[_0x69c3('0x1a')](_0x9cc727)[_0x69c3('0x1b')]();};}function respondWithResult(_0x13e6d5,_0x4a7f3c){_0x4a7f3c=_0x4a7f3c||0xc8;return function(_0x447b43){if(_0x447b43){return _0x13e6d5['status'](_0x4a7f3c)[_0x69c3('0x1c')](_0x447b43);}};}function respondWithFilteredResult(_0x3f5ca7,_0x4f039d){return function(_0x348716){if(_0x348716){var _0x4d3de0=typeof _0x4f039d[_0x69c3('0x1d')]===_0x69c3('0x1e')&&typeof _0x4f039d[_0x69c3('0x1f')]===_0x69c3('0x1e');var _0x29007f=_0x348716['count'];var _0x254102=_0x4d3de0?0x0:_0x4f039d['offset'];var _0x2423c5=_0x4d3de0?_0x348716[_0x69c3('0x20')]:_0x4f039d['offset']+_0x4f039d[_0x69c3('0x1f')];var _0x6d8117;if(_0x2423c5>=_0x29007f){_0x2423c5=_0x29007f;_0x6d8117=0xc8;}else{_0x6d8117=0xce;}_0x3f5ca7[_0x69c3('0x1a')](_0x6d8117);return _0x3f5ca7[_0x69c3('0x21')](_0x69c3('0x22'),_0x254102+'-'+_0x2423c5+'/'+_0x29007f)[_0x69c3('0x1c')](_0x348716);}return null;};}function patchUpdates(_0x2dac50){return function(_0x261262){try{jsonpatch['apply'](_0x261262,_0x2dac50,!![]);}catch(_0x4de9d2){return BPromise['reject'](_0x4de9d2);}return _0x261262[_0x69c3('0x23')]();};}function saveUpdates(_0x41b5d1,_0x4e8354){return function(_0x22ad82){if(_0x22ad82){return _0x22ad82[_0x69c3('0x24')](_0x41b5d1)[_0x69c3('0x25')](function(_0x55bf5b){return _0x55bf5b;});}return null;};}function removeEntity(_0x1cabc8,_0x1bb8bc){return function(_0xe92b55){if(_0xe92b55){return _0xe92b55[_0x69c3('0x26')]()['then'](function(){_0x1cabc8[_0x69c3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17af97,_0x133a51){return function(_0x243f09){if(!_0x243f09){_0x17af97[_0x69c3('0x27')](0x194);}return _0x243f09;};}function handleError(_0x56bef9,_0x8cb97e){_0x8cb97e=_0x8cb97e||0x1f4;return function(_0x1ad52a){logger[_0x69c3('0x28')](_0x1ad52a['stack']);if(_0x1ad52a['name']){delete _0x1ad52a[_0x69c3('0x29')];}_0x56bef9[_0x69c3('0x1a')](_0x8cb97e)[_0x69c3('0x2a')](_0x1ad52a);};}exports[_0x69c3('0x2b')]=function(_0x119f5e,_0x2599b5){var _0x3dd4df={},_0x47bc51={},_0x27205f={'count':0x0,'rows':[]};var _0x54ed96=_[_0x69c3('0x2c')](db[_0x69c3('0x2d')][_0x69c3('0x2e')],function(_0x244315){return{'name':_0x244315[_0x69c3('0x2f')],'type':_0x244315[_0x69c3('0x30')][_0x69c3('0x31')]};});_0x47bc51[_0x69c3('0x32')]=_[_0x69c3('0x2c')](_0x54ed96,'name');_0x47bc51[_0x69c3('0x33')]=_[_0x69c3('0x34')](_0x119f5e['query']);_0x47bc51[_0x69c3('0x35')]=_['intersection'](_0x47bc51[_0x69c3('0x32')],_0x47bc51[_0x69c3('0x33')]);_0x3dd4df['attributes']=_['intersection'](_0x47bc51['model'],qs[_0x69c3('0x36')](_0x119f5e[_0x69c3('0x33')]['fields']));_0x3dd4df[_0x69c3('0x37')]=_0x3dd4df[_0x69c3('0x37')][_0x69c3('0x38')]?_0x3dd4df[_0x69c3('0x37')]:_0x47bc51['model'];if(!_0x119f5e[_0x69c3('0x33')][_0x69c3('0x39')]('nolimit')){_0x3dd4df[_0x69c3('0x1f')]=qs[_0x69c3('0x1f')](_0x119f5e[_0x69c3('0x33')][_0x69c3('0x1f')]);_0x3dd4df[_0x69c3('0x1d')]=qs[_0x69c3('0x1d')](_0x119f5e[_0x69c3('0x33')][_0x69c3('0x1d')]);}_0x3dd4df[_0x69c3('0x3a')]=qs['sort'](_0x119f5e[_0x69c3('0x33')][_0x69c3('0x3b')]);_0x3dd4df[_0x69c3('0x3c')]=qs[_0x69c3('0x35')](_['pick'](_0x119f5e['query'],_0x47bc51['filters']),_0x54ed96);if(_0x119f5e[_0x69c3('0x33')]['filter']){_0x3dd4df['where']=_['merge'](_0x3dd4df[_0x69c3('0x3c')],{'$or':_[_0x69c3('0x2c')](_0x54ed96,function(_0xeb8aa1){if(_0xeb8aa1['type']!==_0x69c3('0x3d')){var _0x4326d9={};_0x4326d9[_0xeb8aa1[_0x69c3('0x29')]]={'$like':'%'+_0x119f5e[_0x69c3('0x33')][_0x69c3('0x3e')]+'%'};return _0x4326d9;}})});}_0x3dd4df=_[_0x69c3('0x3f')]({},_0x3dd4df,_0x119f5e['options']);var _0x58cb15={'where':_0x3dd4df['where']};return db[_0x69c3('0x2d')][_0x69c3('0x20')](_0x58cb15)[_0x69c3('0x25')](function(_0x599a15){_0x27205f[_0x69c3('0x20')]=_0x599a15;if(_0x119f5e[_0x69c3('0x33')][_0x69c3('0x40')]){_0x3dd4df[_0x69c3('0x41')]=[{'all':!![]}];}return db[_0x69c3('0x2d')][_0x69c3('0x42')](_0x3dd4df);})[_0x69c3('0x25')](function(_0x4ff07e){_0x27205f[_0x69c3('0x43')]=_0x4ff07e;return _0x27205f;})[_0x69c3('0x25')](respondWithFilteredResult(_0x2599b5,_0x3dd4df))[_0x69c3('0x44')](handleError(_0x2599b5,null));};exports[_0x69c3('0x45')]=function(_0x420ae7,_0x488b3a){var _0x2554ec={'raw':!![],'where':{'id':_0x420ae7[_0x69c3('0x46')]['id']}},_0x107878={};_0x107878['model']=_[_0x69c3('0x34')](db[_0x69c3('0x2d')][_0x69c3('0x2e')]);_0x107878[_0x69c3('0x33')]=_[_0x69c3('0x34')](_0x420ae7[_0x69c3('0x33')]);_0x107878['filters']=_[_0x69c3('0x47')](_0x107878[_0x69c3('0x32')],_0x107878[_0x69c3('0x33')]);_0x2554ec['attributes']=_['intersection'](_0x107878[_0x69c3('0x32')],qs[_0x69c3('0x36')](_0x420ae7[_0x69c3('0x33')][_0x69c3('0x36')]));_0x2554ec[_0x69c3('0x37')]=_0x2554ec[_0x69c3('0x37')][_0x69c3('0x38')]?_0x2554ec['attributes']:_0x107878[_0x69c3('0x32')];if(_0x420ae7[_0x69c3('0x33')][_0x69c3('0x40')]){_0x2554ec[_0x69c3('0x41')]=[{'all':!![]}];}_0x2554ec=_[_0x69c3('0x3f')]({},_0x2554ec,_0x420ae7[_0x69c3('0x48')]);return db[_0x69c3('0x2d')]['find'](_0x2554ec)[_0x69c3('0x25')](handleEntityNotFound(_0x488b3a,null))[_0x69c3('0x25')](respondWithResult(_0x488b3a,null))[_0x69c3('0x44')](handleError(_0x488b3a,null));};exports['create']=function(_0x57b443,_0x55db96){return db[_0x69c3('0x2d')][_0x69c3('0x49')](_0x57b443[_0x69c3('0x4a')],{})[_0x69c3('0x25')](respondWithResult(_0x55db96,0xc9))[_0x69c3('0x44')](handleError(_0x55db96,null));};exports[_0x69c3('0x24')]=function(_0x1d0fe4,_0x4e2281){if(_0x1d0fe4[_0x69c3('0x4a')]['id']){delete _0x1d0fe4[_0x69c3('0x4a')]['id'];}return db[_0x69c3('0x2d')][_0x69c3('0x4b')]({'where':{'id':_0x1d0fe4[_0x69c3('0x46')]['id']}})[_0x69c3('0x25')](handleEntityNotFound(_0x4e2281,null))[_0x69c3('0x25')](saveUpdates(_0x1d0fe4[_0x69c3('0x4a')],null))[_0x69c3('0x25')](respondWithResult(_0x4e2281,null))[_0x69c3('0x44')](handleError(_0x4e2281,null));};exports[_0x69c3('0x26')]=function(_0x4c9784,_0xe30e3){return db[_0x69c3('0x2d')]['find']({'where':{'id':_0x4c9784['params']['id']}})[_0x69c3('0x25')](handleEntityNotFound(_0xe30e3,null))[_0x69c3('0x25')](removeEntity(_0xe30e3,null))[_0x69c3('0x44')](handleError(_0xe30e3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index bd4dc0f..f6a5ab7 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 _0x3410=['moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x3410,0x8c));var _0x0341=function(_0x41f2e8,_0x56df53){_0x41f2e8=_0x41f2e8-0x0;var _0x21d86f=_0x3410[_0x41f2e8];return _0x21d86f;};'use strict';var _=require(_0x0341('0x0'));var util=require(_0x0341('0x1'));var logger=require('../../config/logger')(_0x0341('0x2'));var moment=require(_0x0341('0x3'));var BPromise=require('bluebird');var rp=require(_0x0341('0x4'));var fs=require('fs');var path=require(_0x0341('0x5'));var rimraf=require(_0x0341('0x6'));var config=require(_0x0341('0x7'));var attributes=require(_0x0341('0x8'));module[_0x0341('0x9')]=function(_0x5046f4,_0x1be255){return _0x5046f4[_0x0341('0xa')](_0x0341('0xb'),attributes,{'tableName':_0x0341('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ad9=['api','moment','bluebird','request-promise','path','./squareMessage.attributes','define','square_messages','lodash','util'];(function(_0x1eaf9a,_0x4a10c3){var _0x1fbedb=function(_0x261b11){while(--_0x261b11){_0x1eaf9a['push'](_0x1eaf9a['shift']());}};_0x1fbedb(++_0x4a10c3);}(_0x3ad9,0x1d4));var _0x93ad=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x3ad9[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x93ad('0x0'));var util=require(_0x93ad('0x1'));var logger=require('../../config/logger')(_0x93ad('0x2'));var moment=require(_0x93ad('0x3'));var BPromise=require(_0x93ad('0x4'));var rp=require(_0x93ad('0x5'));var fs=require('fs');var path=require(_0x93ad('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x93ad('0x7'));module['exports']=function(_0xf6ba6e,_0x212e13){return _0xf6ba6e[_0x93ad('0x8')]('SquareMessage',attributes,{'tableName':_0x93ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index da030e3..04f9b6e 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 _0x1c47=['result','catch','CreateSquareMessage','create','body','options','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x28e4cf,_0x12dfd6){var _0x4cc2ba=function(_0x4b6c88){while(--_0x4b6c88){_0x28e4cf['push'](_0x28e4cf['shift']());}};_0x4cc2ba(++_0x12dfd6);}(_0x1c47,0x16e));var _0x71c4=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x1c47[_0x478c8a];return _0x3b6b3e;};'use strict';var _=require(_0x71c4('0x0'));var util=require(_0x71c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71c4('0x3'))['db'];var utils=require(_0x71c4('0x4'));var logger=require('../../config/logger')(_0x71c4('0x5'));var config=require(_0x71c4('0x6'));var jayson=require(_0x71c4('0x7'));var client=jayson[_0x71c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb385,_0x3d6be1,_0x5e301a){return new BPromise(function(_0x484f80,_0x7a2427){return client['request'](_0x1bb385,_0x5e301a)[_0x71c4('0x9')](function(_0x188ce3){logger[_0x71c4('0xa')](_0x71c4('0xb'),_0x3d6be1,_0x71c4('0xc'));logger[_0x71c4('0xd')](_0x71c4('0xe'),_0x3d6be1,_0x71c4('0xc'),JSON[_0x71c4('0xf')](_0x188ce3));if(_0x188ce3[_0x71c4('0x10')]){if(_0x188ce3[_0x71c4('0x10')]['code']===0x1f4){logger[_0x71c4('0x10')](_0x71c4('0xb'),_0x3d6be1,_0x188ce3[_0x71c4('0x10')]['message']);return _0x7a2427(_0x188ce3[_0x71c4('0x10')]['message']);}logger[_0x71c4('0x10')](_0x71c4('0xb'),_0x3d6be1,_0x188ce3[_0x71c4('0x10')]['message']);return _0x484f80(_0x188ce3[_0x71c4('0x10')][_0x71c4('0x11')]);}else{logger['info'](_0x71c4('0xb'),_0x3d6be1,_0x71c4('0xc'));_0x484f80(_0x188ce3[_0x71c4('0x12')]['message']);}})[_0x71c4('0x13')](function(_0x19692a){logger['error'](_0x71c4('0xb'),_0x3d6be1,_0x19692a);_0x7a2427(_0x19692a);});});}exports[_0x71c4('0x14')]=function(_0x1c8d96){var _0x3a300d=this;return new Promise(function(_0x3a5858,_0x37c8ad){return db['SquareMessage'][_0x71c4('0x15')](_0x1c8d96[_0x71c4('0x16')],{'raw':_0x1c8d96[_0x71c4('0x17')]?_0x1c8d96[_0x71c4('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3f0298){logger[_0x71c4('0xa')](_0x71c4('0x14'),_0x1c8d96);logger['debug'](_0x71c4('0x14'),_0x1c8d96,JSON[_0x71c4('0xf')](_0x3f0298));_0x3a5858(_0x3f0298);})[_0x71c4('0x13')](function(_0x56e620){logger[_0x71c4('0x10')](_0x71c4('0x14'),_0x56e620['message'],_0x1c8d96);_0x37c8ad(_0x3a300d[_0x71c4('0x10')](0x1f4,_0x56e620[_0x71c4('0x11')]));});});}; \ No newline at end of file +var _0x484e=['message','result','catch','body','options','raw','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s'];(function(_0xadf96d,_0x54fb33){var _0x205b12=function(_0xd21d9a){while(--_0xd21d9a){_0xadf96d['push'](_0xadf96d['shift']());}};_0x205b12(++_0x54fb33);}(_0x484e,0x7b));var _0xe484=function(_0x3505b1,_0x54e75a){_0x3505b1=_0x3505b1-0x0;var _0x27961a=_0x484e[_0x3505b1];return _0x27961a;};'use strict';var _=require(_0xe484('0x0'));var util=require(_0xe484('0x1'));var moment=require(_0xe484('0x2'));var BPromise=require(_0xe484('0x3'));var rs=require(_0xe484('0x4'));var fs=require('fs');var Redis=require(_0xe484('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe484('0x6'));var logger=require(_0xe484('0x7'))(_0xe484('0x8'));var config=require(_0xe484('0x9'));var jayson=require(_0xe484('0xa'));var client=jayson['client'][_0xe484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19090b,_0x3da03d,_0x47f9af){return new BPromise(function(_0x1e68a6,_0x3197ca){return client[_0xe484('0xc')](_0x19090b,_0x47f9af)[_0xe484('0xd')](function(_0x1e5efe){logger[_0xe484('0xe')]('SquareMessage,\x20%s,\x20%s',_0x3da03d,_0xe484('0xf'));logger[_0xe484('0x10')](_0xe484('0x11'),_0x3da03d,_0xe484('0xf'),JSON[_0xe484('0x12')](_0x1e5efe));if(_0x1e5efe['error']){if(_0x1e5efe[_0xe484('0x13')][_0xe484('0x14')]===0x1f4){logger[_0xe484('0x13')](_0xe484('0x15'),_0x3da03d,_0x1e5efe[_0xe484('0x13')][_0xe484('0x16')]);return _0x3197ca(_0x1e5efe['error']['message']);}logger[_0xe484('0x13')](_0xe484('0x15'),_0x3da03d,_0x1e5efe[_0xe484('0x13')][_0xe484('0x16')]);return _0x1e68a6(_0x1e5efe[_0xe484('0x13')][_0xe484('0x16')]);}else{logger[_0xe484('0xe')](_0xe484('0x15'),_0x3da03d,'request\x20sent');_0x1e68a6(_0x1e5efe[_0xe484('0x17')]['message']);}})[_0xe484('0x18')](function(_0x414405){logger['error'](_0xe484('0x15'),_0x3da03d,_0x414405);_0x3197ca(_0x414405);});});}exports['CreateSquareMessage']=function(_0x65c370){var _0x28998e=this;return new Promise(function(_0x1f3762,_0x48735d){return db['SquareMessage']['create'](_0x65c370[_0xe484('0x19')],{'raw':_0x65c370['options']?_0x65c370[_0xe484('0x1a')][_0xe484('0x1b')]===undefined?!![]:![]:!![]})[_0xe484('0xd')](function(_0x315732){logger[_0xe484('0xe')](_0xe484('0x1c'),_0x65c370);logger[_0xe484('0x10')](_0xe484('0x1c'),_0x65c370,JSON['stringify'](_0x315732));_0x1f3762(_0x315732);})['catch'](function(_0x4b19d5){logger[_0xe484('0x13')](_0xe484('0x1c'),_0x4b19d5[_0xe484('0x16')],_0x65c370);_0x48735d(_0x28998e[_0xe484('0x13')](0x1f4,_0x4b19d5[_0xe484('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e401d05..84b1464 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 _0x52c1=['show','/:id/test','15s','test','post','exports','util','path','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0x36d5d5,_0x1c1590){var _0x4eaa56=function(_0x56fa0e){while(--_0x56fa0e){_0x36d5d5['push'](_0x36d5d5['shift']());}};_0x4eaa56(++_0x1c1590);}(_0x52c1,0xd8));var _0x152c=function(_0x32af19,_0x40198d){_0x32af19=_0x32af19-0x0;var _0x45c202=_0x52c1[_0x32af19];return _0x45c202;};'use strict';var multer=require('multer');var util=require(_0x152c('0x0'));var path=require(_0x152c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x152c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x152c('0x3'));var controller=require(_0x152c('0x4'));router[_0x152c('0x5')]('/',auth[_0x152c('0x6')](),controller[_0x152c('0x7')]);router['get'](_0x152c('0x8'),auth[_0x152c('0x6')](),controller[_0x152c('0x9')]);router[_0x152c('0x5')](_0x152c('0xa'),auth[_0x152c('0x6')](),timeout(_0x152c('0xb')),controller[_0x152c('0xc')]);router[_0x152c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x152c('0x8'),auth[_0x152c('0x6')](),controller['update']);router['delete']('/:id',auth[_0x152c('0x6')](),controller['destroy']);module[_0x152c('0xe')]=router; \ No newline at end of file +var _0x7cd6=['test','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','15s'];(function(_0x5e3133,_0x4f87ff){var _0x1dfc3e=function(_0xd47cc8){while(--_0xd47cc8){_0x5e3133['push'](_0x5e3133['shift']());}};_0x1dfc3e(++_0x4f87ff);}(_0x7cd6,0x77));var _0x67cd=function(_0xa4cc4c,_0x2ff840){_0xa4cc4c=_0xa4cc4c-0x0;var _0x6278a7=_0x7cd6[_0xa4cc4c];return _0x6278a7;};'use strict';var multer=require(_0x67cd('0x0'));var util=require(_0x67cd('0x1'));var path=require(_0x67cd('0x2'));var timeout=require(_0x67cd('0x3'));var express=require(_0x67cd('0x4'));var router=express['Router']();var fs_extra=require(_0x67cd('0x5'));var auth=require(_0x67cd('0x6'));var interaction=require(_0x67cd('0x7'));var config=require(_0x67cd('0x8'));var controller=require('./squareOdbc.controller');router[_0x67cd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x67cd('0x9')]('/:id',auth[_0x67cd('0xa')](),controller[_0x67cd('0xb')]);router[_0x67cd('0x9')]('/:id/test',auth['isAuthenticated'](),timeout(_0x67cd('0xc')),controller[_0x67cd('0xd')]);router[_0x67cd('0xe')]('/',auth['isAuthenticated'](),controller[_0x67cd('0xf')]);router[_0x67cd('0x10')](_0x67cd('0x11'),auth[_0x67cd('0xa')](),controller[_0x67cd('0x12')]);router[_0x67cd('0x13')](_0x67cd('0x11'),auth[_0x67cd('0xa')](),controller[_0x67cd('0x14')]);module[_0x67cd('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8edf920..a78ae1d 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 _0x9d50=['exports','STRING','name','sequelize'];(function(_0x53da0e,_0x2c4eb0){var _0x3a6ae7=function(_0xbcafb3){while(--_0xbcafb3){_0x53da0e['push'](_0x53da0e['shift']());}};_0x3a6ae7(++_0x2c4eb0);}(_0x9d50,0xd3));var _0x09d5=function(_0x1b1857,_0x5d90f4){_0x1b1857=_0x1b1857-0x0;var _0xcb5c13=_0x9d50[_0x1b1857];return _0xcb5c13;};'use strict';var Sequelize=require(_0x09d5('0x0'));module[_0x09d5('0x1')]={'name':{'type':Sequelize[_0x09d5('0x2')],'unique':_0x09d5('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x09d5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x57cd=['name','sequelize','STRING'];(function(_0x778d68,_0x247d03){var _0x30078c=function(_0x1a705d){while(--_0x1a705d){_0x778d68['push'](_0x778d68['shift']());}};_0x30078c(++_0x247d03);}(_0x57cd,0x12d));var _0xd57c=function(_0x14af83,_0x142cca){_0x14af83=_0x14af83-0x0;var _0xabbc6f=_0x57cd[_0x14af83];return _0xabbc6f;};'use strict';var Sequelize=require(_0xd57c('0x0'));module['exports']={'name':{'type':Sequelize[_0xd57c('0x1')],'unique':_0xd57c('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd57c('0x1')]},'description':{'type':Sequelize[_0xd57c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 6d1e658..f538f92 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 _0xc10c=['hasOwnProperty','nolimit','order','sort','where','filter','options','SquareOdbc','includeAll','include','rows','catch','show','length','merge','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xc10c,0x1bb));var _0xcc10=function(_0xdd57d2,_0x437799){_0xdd57d2=_0xdd57d2-0x0;var _0x426d85=_0xc10c[_0xdd57d2];return _0x426d85;};'use strict';var emlformat=require(_0xcc10('0x0'));var rimraf=require(_0xcc10('0x1'));var zipdir=require(_0xcc10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc10('0x3'));var moment=require(_0xcc10('0x4'));var BPromise=require(_0xcc10('0x5'));var Mustache=require('mustache');var util=require(_0xcc10('0x6'));var path=require(_0xcc10('0x7'));var sox=require(_0xcc10('0x8'));var csv=require(_0xcc10('0x9'));var ejs=require(_0xcc10('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc10('0xb'));var squel=require(_0xcc10('0xc'));var crypto=require(_0xcc10('0xd'));var jsforce=require(_0xcc10('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc10('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcc10('0x10'));var as=require(_0xcc10('0x11'));var hardwareService=require(_0xcc10('0x12'));var logger=require('../../config/logger')(_0xcc10('0x13'));var utils=require(_0xcc10('0x14'));var config=require(_0xcc10('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc10('0x16'))['db'];function respondWithStatusCode(_0x1fec53,_0xb471ca){_0xb471ca=_0xb471ca||0xcc;return function(_0x10dbf1){if(_0x10dbf1){return _0x1fec53[_0xcc10('0x17')](_0xb471ca);}return _0x1fec53[_0xcc10('0x18')](_0xb471ca)[_0xcc10('0x19')]();};}function respondWithResult(_0xe28a63,_0x33f1fc){_0x33f1fc=_0x33f1fc||0xc8;return function(_0x1bb69a){if(_0x1bb69a){return _0xe28a63['status'](_0x33f1fc)[_0xcc10('0x1a')](_0x1bb69a);}};}function respondWithFilteredResult(_0x221060,_0x1861ea){return function(_0x173477){if(_0x173477){var _0x3eb186=typeof _0x1861ea[_0xcc10('0x1b')]==='undefined'&&typeof _0x1861ea['limit']===_0xcc10('0x1c');var _0x24a805=_0x173477[_0xcc10('0x1d')];var _0x337a03=_0x3eb186?0x0:_0x1861ea['offset'];var _0x5ee76e=_0x3eb186?_0x173477[_0xcc10('0x1d')]:_0x1861ea[_0xcc10('0x1b')]+_0x1861ea[_0xcc10('0x1e')];var _0x3553b9;if(_0x5ee76e>=_0x24a805){_0x5ee76e=_0x24a805;_0x3553b9=0xc8;}else{_0x3553b9=0xce;}_0x221060[_0xcc10('0x18')](_0x3553b9);return _0x221060[_0xcc10('0x1f')](_0xcc10('0x20'),_0x337a03+'-'+_0x5ee76e+'/'+_0x24a805)[_0xcc10('0x1a')](_0x173477);}return null;};}function patchUpdates(_0x5cdb94){return function(_0x392ca0){try{jsonpatch[_0xcc10('0x21')](_0x392ca0,_0x5cdb94,!![]);}catch(_0x259fbe){return BPromise['reject'](_0x259fbe);}return _0x392ca0[_0xcc10('0x22')]();};}function saveUpdates(_0x963e40,_0x384e95){return function(_0x499596){if(_0x499596){return _0x499596[_0xcc10('0x23')](_0x963e40)[_0xcc10('0x24')](function(_0x4e9bf7){return _0x4e9bf7;});}return null;};}function removeEntity(_0x50edf5,_0x143a4d){return function(_0x5c979f){if(_0x5c979f){return _0x5c979f[_0xcc10('0x25')]()[_0xcc10('0x24')](function(){var _0x2c4733=_0x5c979f[_0xcc10('0x26')]({'plain':!![]});var _0x1d3d63=_0xcc10('0x27');return db[_0xcc10('0x28')]['destroy']({'where':{'type':_0x1d3d63,'resourceId':_0x2c4733['id']}})[_0xcc10('0x24')](function(){return _0x5c979f;});})[_0xcc10('0x24')](function(){_0x50edf5[_0xcc10('0x18')](0xcc)[_0xcc10('0x19')]();});}};}function handleEntityNotFound(_0x5bacb9,_0x45385a){return function(_0x4daa5){if(!_0x4daa5){_0x5bacb9['sendStatus'](0x194);}return _0x4daa5;};}function handleError(_0x26fd7c,_0x48bfb0){_0x48bfb0=_0x48bfb0||0x1f4;return function(_0x245eda){logger[_0xcc10('0x29')](_0x245eda['stack']);if(_0x245eda[_0xcc10('0x2a')]){delete _0x245eda['name'];}_0x26fd7c[_0xcc10('0x18')](_0x48bfb0)[_0xcc10('0x2b')](_0x245eda);};}exports[_0xcc10('0x2c')]=function(_0x1f48ee,_0x7abf24){var _0x212289={},_0x2cd602={},_0x13bc5b={'count':0x0,'rows':[]};var _0xb03139=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x377888){return{'name':_0x377888[_0xcc10('0x2d')],'type':_0x377888[_0xcc10('0x2e')][_0xcc10('0x2f')]};});_0x2cd602[_0xcc10('0x30')]=_['map'](_0xb03139,_0xcc10('0x2a'));_0x2cd602[_0xcc10('0x31')]=_[_0xcc10('0x32')](_0x1f48ee[_0xcc10('0x31')]);_0x2cd602[_0xcc10('0x33')]=_['intersection'](_0x2cd602[_0xcc10('0x30')],_0x2cd602[_0xcc10('0x31')]);_0x212289['attributes']=_[_0xcc10('0x34')](_0x2cd602[_0xcc10('0x30')],qs['fields'](_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x35')]));_0x212289['attributes']=_0x212289[_0xcc10('0x36')]['length']?_0x212289[_0xcc10('0x36')]:_0x2cd602['model'];if(!_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x37')](_0xcc10('0x38'))){_0x212289[_0xcc10('0x1e')]=qs['limit'](_0x1f48ee[_0xcc10('0x31')]['limit']);_0x212289['offset']=qs[_0xcc10('0x1b')](_0x1f48ee[_0xcc10('0x31')]['offset']);}_0x212289[_0xcc10('0x39')]=qs['sort'](_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3a')]);_0x212289['where']=qs['filters'](_['pick'](_0x1f48ee[_0xcc10('0x31')],_0x2cd602[_0xcc10('0x33')]),_0xb03139);if(_0x1f48ee[_0xcc10('0x31')]['filter']){_0x212289[_0xcc10('0x3b')]=_['merge'](_0x212289[_0xcc10('0x3b')],{'$or':_['map'](_0xb03139,function(_0x2ac843){if(_0x2ac843[_0xcc10('0x2e')]!=='VIRTUAL'){var _0x7fa816={};_0x7fa816[_0x2ac843['name']]={'$like':'%'+_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3c')]+'%'};return _0x7fa816;}})});}_0x212289=_['merge']({},_0x212289,_0x1f48ee[_0xcc10('0x3d')]);var _0x4b6836={'where':_0x212289[_0xcc10('0x3b')]};return db[_0xcc10('0x3e')][_0xcc10('0x1d')](_0x4b6836)['then'](function(_0x425f06){_0x13bc5b['count']=_0x425f06;if(_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3f')]){_0x212289[_0xcc10('0x40')]=[{'all':!![]}];}return db[_0xcc10('0x3e')]['findAll'](_0x212289);})[_0xcc10('0x24')](function(_0x3bb1d3){_0x13bc5b[_0xcc10('0x41')]=_0x3bb1d3;return _0x13bc5b;})['then'](respondWithFilteredResult(_0x7abf24,_0x212289))[_0xcc10('0x42')](handleError(_0x7abf24,null));};exports[_0xcc10('0x43')]=function(_0x36c3b6,_0x5068cd){var _0x34f4f6={'raw':!![],'where':{'id':_0x36c3b6['params']['id']}},_0x1af38e={};_0x1af38e[_0xcc10('0x30')]=_[_0xcc10('0x32')](db[_0xcc10('0x3e')]['rawAttributes']);_0x1af38e[_0xcc10('0x31')]=_[_0xcc10('0x32')](_0x36c3b6[_0xcc10('0x31')]);_0x1af38e[_0xcc10('0x33')]=_[_0xcc10('0x34')](_0x1af38e[_0xcc10('0x30')],_0x1af38e['query']);_0x34f4f6['attributes']=_[_0xcc10('0x34')](_0x1af38e[_0xcc10('0x30')],qs['fields'](_0x36c3b6[_0xcc10('0x31')][_0xcc10('0x35')]));_0x34f4f6[_0xcc10('0x36')]=_0x34f4f6[_0xcc10('0x36')][_0xcc10('0x44')]?_0x34f4f6[_0xcc10('0x36')]:_0x1af38e[_0xcc10('0x30')];if(_0x36c3b6[_0xcc10('0x31')][_0xcc10('0x3f')]){_0x34f4f6[_0xcc10('0x40')]=[{'all':!![]}];}_0x34f4f6=_[_0xcc10('0x45')]({},_0x34f4f6,_0x36c3b6['options']);return db[_0xcc10('0x3e')][_0xcc10('0x46')](_0x34f4f6)['then'](handleEntityNotFound(_0x5068cd,null))[_0xcc10('0x24')](respondWithResult(_0x5068cd,null))[_0xcc10('0x42')](handleError(_0x5068cd,null));};exports['create']=function(_0x22e737,_0x1e3efc){return db[_0xcc10('0x3e')][_0xcc10('0x47')](_0x22e737[_0xcc10('0x48')],{})[_0xcc10('0x24')](function(_0x5b9b4d){var _0x4064ae=_0x22e737[_0xcc10('0x49')][_0xcc10('0x26')]({'plain':!![]});if(!_0x4064ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4064ae[_0xcc10('0x4a')]===_0xcc10('0x49')){var _0x11ff8a=_0x5b9b4d['get']({'plain':!![]});var _0x51e635=_0xcc10('0x27');return db[_0xcc10('0x4b')][_0xcc10('0x46')]({'where':{'name':_0x51e635,'userProfileId':_0x4064ae[_0xcc10('0x4c')]},'raw':!![]})[_0xcc10('0x24')](function(_0x27f2cf){if(_0x27f2cf&&_0x27f2cf['autoAssociation']===0x0){return db[_0xcc10('0x28')][_0xcc10('0x47')]({'name':_0x11ff8a[_0xcc10('0x2a')],'resourceId':_0x11ff8a['id'],'type':_0x27f2cf[_0xcc10('0x2a')],'sectionId':_0x27f2cf['id']},{})[_0xcc10('0x24')](function(){return _0x5b9b4d;});}else{return _0x5b9b4d;}})[_0xcc10('0x42')](function(_0x3cd560){logger[_0xcc10('0x29')](_0xcc10('0x4d'),_0x3cd560);throw _0x3cd560;});}return _0x5b9b4d;})[_0xcc10('0x24')](respondWithResult(_0x1e3efc,0xc9))[_0xcc10('0x42')](handleError(_0x1e3efc,null));};exports[_0xcc10('0x23')]=function(_0x5833a0,_0x19078f){if(_0x5833a0[_0xcc10('0x48')]['id']){delete _0x5833a0[_0xcc10('0x48')]['id'];}return db[_0xcc10('0x3e')]['find']({'where':{'id':_0x5833a0[_0xcc10('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19078f,null))[_0xcc10('0x24')](saveUpdates(_0x5833a0[_0xcc10('0x48')],null))[_0xcc10('0x24')](respondWithResult(_0x19078f,null))['catch'](handleError(_0x19078f,null));};exports[_0xcc10('0x25')]=function(_0x11d2e,_0x466c80){return db[_0xcc10('0x3e')][_0xcc10('0x46')]({'where':{'id':_0x11d2e[_0xcc10('0x4e')]['id']}})[_0xcc10('0x24')](handleEntityNotFound(_0x466c80,null))[_0xcc10('0x24')](removeEntity(_0x466c80,null))[_0xcc10('0x42')](handleError(_0x466c80,null));};exports[_0xcc10('0x4f')]=function(_0x2a6a3f,_0x2bff81,_0x716b1b){var _0x21a9ab;return db['SquareOdbc'][_0xcc10('0x46')]({'where':{'id':_0x2a6a3f[_0xcc10('0x4e')]['id']},'attributes':['id',_0xcc10('0x50')]})[_0xcc10('0x24')](handleEntityNotFound(_0x2bff81,null))[_0xcc10('0x24')](function(_0x3f72de){if(_0x3f72de){var _0x107edf=require('odbc')();_0x107edf[_0xcc10('0x51')](_0x3f72de[_0xcc10('0x50')]);_0x107edf[_0xcc10('0x52')]();return _0x3f72de;}})[_0xcc10('0x24')](respondWithResult(_0x2bff81,null))[_0xcc10('0x42')](handleError(_0x2bff81,null));}; \ No newline at end of file +var _0xe54e=['error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','params','find','catch','create','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','ODBC','UserProfileResource'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe54e,0x124));var _0xee54=function(_0x2f4cee,_0x39827d){_0x2f4cee=_0x2f4cee-0x0;var _0x5631e9=_0xe54e[_0x2f4cee];return _0x5631e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee54('0x0'));var jsonpatch=require(_0xee54('0x1'));var rp=require(_0xee54('0x2'));var moment=require('moment');var BPromise=require(_0xee54('0x3'));var Mustache=require(_0xee54('0x4'));var util=require('util');var path=require(_0xee54('0x5'));var sox=require(_0xee54('0x6'));var csv=require(_0xee54('0x7'));var ejs=require(_0xee54('0x8'));var fs=require('fs');var fs_extra=require(_0xee54('0x9'));var _=require('lodash');var squel=require(_0xee54('0xa'));var crypto=require('crypto');var jsforce=require(_0xee54('0xb'));var deskjs=require(_0xee54('0xc'));var toCsv=require(_0xee54('0x7'));var querystring=require(_0xee54('0xd'));var Papa=require(_0xee54('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee54('0xf'));var hardwareService=require(_0xee54('0x10'));var logger=require(_0xee54('0x11'))(_0xee54('0x12'));var utils=require('../../config/utils');var config=require(_0xee54('0x13'));var licenseUtil=require(_0xee54('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31dec7,_0x2cd4f4){_0x2cd4f4=_0x2cd4f4||0xcc;return function(_0x181ae9){if(_0x181ae9){return _0x31dec7[_0xee54('0x15')](_0x2cd4f4);}return _0x31dec7[_0xee54('0x16')](_0x2cd4f4)[_0xee54('0x17')]();};}function respondWithResult(_0x2de5ca,_0xc7db12){_0xc7db12=_0xc7db12||0xc8;return function(_0x95a035){if(_0x95a035){return _0x2de5ca[_0xee54('0x16')](_0xc7db12)[_0xee54('0x18')](_0x95a035);}};}function respondWithFilteredResult(_0x46d3d4,_0x2e1ea4){return function(_0x11a885){if(_0x11a885){var _0x3dabb6=typeof _0x2e1ea4[_0xee54('0x19')]==='undefined'&&typeof _0x2e1ea4[_0xee54('0x1a')]===_0xee54('0x1b');var _0xa73fcf=_0x11a885['count'];var _0x4cc7a1=_0x3dabb6?0x0:_0x2e1ea4[_0xee54('0x19')];var _0xd53f4e=_0x3dabb6?_0x11a885[_0xee54('0x1c')]:_0x2e1ea4[_0xee54('0x19')]+_0x2e1ea4[_0xee54('0x1a')];var _0xb10044;if(_0xd53f4e>=_0xa73fcf){_0xd53f4e=_0xa73fcf;_0xb10044=0xc8;}else{_0xb10044=0xce;}_0x46d3d4['status'](_0xb10044);return _0x46d3d4['set'](_0xee54('0x1d'),_0x4cc7a1+'-'+_0xd53f4e+'/'+_0xa73fcf)[_0xee54('0x18')](_0x11a885);}return null;};}function patchUpdates(_0x185053){return function(_0x1673b7){try{jsonpatch[_0xee54('0x1e')](_0x1673b7,_0x185053,!![]);}catch(_0x249472){return BPromise['reject'](_0x249472);}return _0x1673b7['save']();};}function saveUpdates(_0x4beec4,_0x182bd){return function(_0x1abf3e){if(_0x1abf3e){return _0x1abf3e[_0xee54('0x1f')](_0x4beec4)[_0xee54('0x20')](function(_0x213578){return _0x213578;});}return null;};}function removeEntity(_0x246bfd,_0xe9e4e9){return function(_0x56dfa6){if(_0x56dfa6){return _0x56dfa6[_0xee54('0x21')]()[_0xee54('0x20')](function(){var _0x1ce5f3=_0x56dfa6['get']({'plain':!![]});var _0x4a4967=_0xee54('0x22');return db[_0xee54('0x23')]['destroy']({'where':{'type':_0x4a4967,'resourceId':_0x1ce5f3['id']}})[_0xee54('0x20')](function(){return _0x56dfa6;});})[_0xee54('0x20')](function(){_0x246bfd[_0xee54('0x16')](0xcc)[_0xee54('0x17')]();});}};}function handleEntityNotFound(_0x463676,_0x3b3d98){return function(_0x7c54f1){if(!_0x7c54f1){_0x463676[_0xee54('0x15')](0x194);}return _0x7c54f1;};}function handleError(_0x47e1b8,_0x4e70c4){_0x4e70c4=_0x4e70c4||0x1f4;return function(_0x2fdc85){logger[_0xee54('0x24')](_0x2fdc85[_0xee54('0x25')]);if(_0x2fdc85['name']){delete _0x2fdc85[_0xee54('0x26')];}_0x47e1b8['status'](_0x4e70c4)[_0xee54('0x27')](_0x2fdc85);};}exports[_0xee54('0x28')]=function(_0x5572b2,_0x27b508){var _0x31b9ec={},_0x46177f={},_0x1cc8f5={'count':0x0,'rows':[]};var _0x8bb7aa=_['map'](db[_0xee54('0x29')][_0xee54('0x2a')],function(_0x48b21e){return{'name':_0x48b21e[_0xee54('0x2b')],'type':_0x48b21e['type']['key']};});_0x46177f[_0xee54('0x2c')]=_['map'](_0x8bb7aa,_0xee54('0x26'));_0x46177f[_0xee54('0x2d')]=_[_0xee54('0x2e')](_0x5572b2[_0xee54('0x2d')]);_0x46177f[_0xee54('0x2f')]=_[_0xee54('0x30')](_0x46177f[_0xee54('0x2c')],_0x46177f[_0xee54('0x2d')]);_0x31b9ec['attributes']=_[_0xee54('0x30')](_0x46177f[_0xee54('0x2c')],qs[_0xee54('0x31')](_0x5572b2[_0xee54('0x2d')][_0xee54('0x31')]));_0x31b9ec[_0xee54('0x32')]=_0x31b9ec['attributes'][_0xee54('0x33')]?_0x31b9ec['attributes']:_0x46177f[_0xee54('0x2c')];if(!_0x5572b2[_0xee54('0x2d')]['hasOwnProperty']('nolimit')){_0x31b9ec[_0xee54('0x1a')]=qs['limit'](_0x5572b2[_0xee54('0x2d')]['limit']);_0x31b9ec[_0xee54('0x19')]=qs[_0xee54('0x19')](_0x5572b2[_0xee54('0x2d')][_0xee54('0x19')]);}_0x31b9ec[_0xee54('0x34')]=qs[_0xee54('0x35')](_0x5572b2['query'][_0xee54('0x35')]);_0x31b9ec[_0xee54('0x36')]=qs[_0xee54('0x2f')](_[_0xee54('0x37')](_0x5572b2[_0xee54('0x2d')],_0x46177f[_0xee54('0x2f')]),_0x8bb7aa);if(_0x5572b2[_0xee54('0x2d')][_0xee54('0x38')]){_0x31b9ec[_0xee54('0x36')]=_[_0xee54('0x39')](_0x31b9ec[_0xee54('0x36')],{'$or':_[_0xee54('0x3a')](_0x8bb7aa,function(_0x19f537){if(_0x19f537[_0xee54('0x3b')]!==_0xee54('0x3c')){var _0x1f5098={};_0x1f5098[_0x19f537[_0xee54('0x26')]]={'$like':'%'+_0x5572b2['query'][_0xee54('0x38')]+'%'};return _0x1f5098;}})});}_0x31b9ec=_[_0xee54('0x39')]({},_0x31b9ec,_0x5572b2[_0xee54('0x3d')]);var _0x57fc41={'where':_0x31b9ec['where']};return db[_0xee54('0x29')][_0xee54('0x1c')](_0x57fc41)[_0xee54('0x20')](function(_0x412acc){_0x1cc8f5[_0xee54('0x1c')]=_0x412acc;if(_0x5572b2[_0xee54('0x2d')][_0xee54('0x3e')]){_0x31b9ec['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xee54('0x3f')](_0x31b9ec);})[_0xee54('0x20')](function(_0x2393c4){_0x1cc8f5[_0xee54('0x40')]=_0x2393c4;return _0x1cc8f5;})['then'](respondWithFilteredResult(_0x27b508,_0x31b9ec))['catch'](handleError(_0x27b508,null));};exports['show']=function(_0x1a41e5,_0x383caf){var _0x4738fa={'raw':!![],'where':{'id':_0x1a41e5[_0xee54('0x41')]['id']}},_0x206eec={};_0x206eec[_0xee54('0x2c')]=_[_0xee54('0x2e')](db[_0xee54('0x29')][_0xee54('0x2a')]);_0x206eec[_0xee54('0x2d')]=_[_0xee54('0x2e')](_0x1a41e5[_0xee54('0x2d')]);_0x206eec[_0xee54('0x2f')]=_[_0xee54('0x30')](_0x206eec[_0xee54('0x2c')],_0x206eec[_0xee54('0x2d')]);_0x4738fa[_0xee54('0x32')]=_[_0xee54('0x30')](_0x206eec[_0xee54('0x2c')],qs[_0xee54('0x31')](_0x1a41e5[_0xee54('0x2d')][_0xee54('0x31')]));_0x4738fa['attributes']=_0x4738fa[_0xee54('0x32')][_0xee54('0x33')]?_0x4738fa[_0xee54('0x32')]:_0x206eec[_0xee54('0x2c')];if(_0x1a41e5[_0xee54('0x2d')]['includeAll']){_0x4738fa['include']=[{'all':!![]}];}_0x4738fa=_[_0xee54('0x39')]({},_0x4738fa,_0x1a41e5[_0xee54('0x3d')]);return db[_0xee54('0x29')][_0xee54('0x42')](_0x4738fa)[_0xee54('0x20')](handleEntityNotFound(_0x383caf,null))[_0xee54('0x20')](respondWithResult(_0x383caf,null))[_0xee54('0x43')](handleError(_0x383caf,null));};exports[_0xee54('0x44')]=function(_0x558b84,_0x2c975d){return db[_0xee54('0x29')]['create'](_0x558b84['body'],{})[_0xee54('0x20')](function(_0x16f3b7){var _0x1ad228=_0x558b84[_0xee54('0x45')]['get']({'plain':!![]});if(!_0x1ad228)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ad228[_0xee54('0x46')]===_0xee54('0x45')){var _0x56214e=_0x16f3b7[_0xee54('0x47')]({'plain':!![]});var _0x41bca2=_0xee54('0x22');return db[_0xee54('0x48')][_0xee54('0x42')]({'where':{'name':_0x41bca2,'userProfileId':_0x1ad228[_0xee54('0x49')]},'raw':!![]})[_0xee54('0x20')](function(_0x498dcd){if(_0x498dcd&&_0x498dcd[_0xee54('0x4a')]===0x0){return db[_0xee54('0x23')][_0xee54('0x44')]({'name':_0x56214e[_0xee54('0x26')],'resourceId':_0x56214e['id'],'type':_0x498dcd[_0xee54('0x26')],'sectionId':_0x498dcd['id']},{})[_0xee54('0x20')](function(){return _0x16f3b7;});}else{return _0x16f3b7;}})[_0xee54('0x43')](function(_0x4a45e4){logger[_0xee54('0x24')](_0xee54('0x4b'),_0x4a45e4);throw _0x4a45e4;});}return _0x16f3b7;})[_0xee54('0x20')](respondWithResult(_0x2c975d,0xc9))[_0xee54('0x43')](handleError(_0x2c975d,null));};exports[_0xee54('0x1f')]=function(_0x12ec3b,_0x2e2b33){if(_0x12ec3b[_0xee54('0x4c')]['id']){delete _0x12ec3b[_0xee54('0x4c')]['id'];}return db[_0xee54('0x29')]['find']({'where':{'id':_0x12ec3b[_0xee54('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e2b33,null))[_0xee54('0x20')](saveUpdates(_0x12ec3b[_0xee54('0x4c')],null))['then'](respondWithResult(_0x2e2b33,null))[_0xee54('0x43')](handleError(_0x2e2b33,null));};exports[_0xee54('0x21')]=function(_0x13abdf,_0x462f6e){return db[_0xee54('0x29')]['find']({'where':{'id':_0x13abdf[_0xee54('0x41')]['id']}})[_0xee54('0x20')](handleEntityNotFound(_0x462f6e,null))[_0xee54('0x20')](removeEntity(_0x462f6e,null))[_0xee54('0x43')](handleError(_0x462f6e,null));};exports[_0xee54('0x4d')]=function(_0x409fbf,_0x2085f5,_0x597bca){var _0xea164f;return db[_0xee54('0x29')][_0xee54('0x42')]({'where':{'id':_0x409fbf[_0xee54('0x41')]['id']},'attributes':['id',_0xee54('0x4e')]})[_0xee54('0x20')](handleEntityNotFound(_0x2085f5,null))[_0xee54('0x20')](function(_0x34f8c6){if(_0x34f8c6){var _0xa58f09=require(_0xee54('0x4f'))();_0xa58f09[_0xee54('0x50')](_0x34f8c6[_0xee54('0x4e')]);_0xa58f09[_0xee54('0x51')]();return _0x34f8c6;}})[_0xee54('0x20')](respondWithResult(_0x2085f5,null))[_0xee54('0x43')](handleError(_0x2085f5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c82110b..21e832d 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 _0x7256=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareOdbc','square_odbc','lodash'];(function(_0x105a8e,_0x12dd9a){var _0x298729=function(_0x3e9079){while(--_0x3e9079){_0x105a8e['push'](_0x105a8e['shift']());}};_0x298729(++_0x12dd9a);}(_0x7256,0x77));var _0x6725=function(_0x373119,_0x336dee){_0x373119=_0x373119-0x0;var _0x446d29=_0x7256[_0x373119];return _0x446d29;};'use strict';var _=require(_0x6725('0x0'));var util=require('util');var logger=require(_0x6725('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6725('0x2'));var rp=require(_0x6725('0x3'));var fs=require('fs');var path=require(_0x6725('0x4'));var rimraf=require(_0x6725('0x5'));var config=require(_0x6725('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x6725('0x7')]=function(_0x332b44,_0xd4a32d){return _0x332b44['define'](_0x6725('0x8'),attributes,{'tableName':_0x6725('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x315a=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','lodash'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x315a,0x1f3));var _0xa315=function(_0x4cd14a,_0x3c08b4){_0x4cd14a=_0x4cd14a-0x0;var _0x59ac6a=_0x315a[_0x4cd14a];return _0x59ac6a;};'use strict';var _=require(_0xa315('0x0'));var util=require(_0xa315('0x1'));var logger=require(_0xa315('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa315('0x3'));var rp=require(_0xa315('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa315('0x5'));var config=require(_0xa315('0x6'));var attributes=require(_0xa315('0x7'));module[_0xa315('0x8')]=function(_0x45a1c9,_0x1e6ccf){return _0x45a1c9[_0xa315('0x9')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index c4fbf2a..4c861d6 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 _0x5366=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','map','include','model','lodash','moment'];(function(_0x1851dc,_0x47b570){var _0x37abb4=function(_0x4a3244){while(--_0x4a3244){_0x1851dc['push'](_0x1851dc['shift']());}};_0x37abb4(++_0x47b570);}(_0x5366,0x134));var _0x6536=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5366[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x6536('0x0'));var util=require('util');var moment=require(_0x6536('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6536('0x2'));var db=require(_0x6536('0x3'))['db'];var utils=require(_0x6536('0x4'));var logger=require(_0x6536('0x5'))(_0x6536('0x6'));var config=require('../../config/environment');var jayson=require(_0x6536('0x7'));var client=jayson['client'][_0x6536('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30e09f,_0xfbf468,_0x2e2597){return new BPromise(function(_0x1a259,_0xb24339){return client[_0x6536('0x9')](_0x30e09f,_0x2e2597)[_0x6536('0xa')](function(_0x4259c7){logger[_0x6536('0xb')](_0x6536('0xc'),_0xfbf468,'request\x20sent');logger[_0x6536('0xd')](_0x6536('0xe'),_0xfbf468,_0x6536('0xf'),JSON[_0x6536('0x10')](_0x4259c7));if(_0x4259c7[_0x6536('0x11')]){if(_0x4259c7[_0x6536('0x11')][_0x6536('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xfbf468,_0x4259c7['error']['message']);return _0xb24339(_0x4259c7[_0x6536('0x11')][_0x6536('0x13')]);}logger[_0x6536('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xfbf468,_0x4259c7['error'][_0x6536('0x13')]);return _0x1a259(_0x4259c7['error'][_0x6536('0x13')]);}else{logger[_0x6536('0xb')](_0x6536('0xc'),_0xfbf468,_0x6536('0xf'));_0x1a259(_0x4259c7[_0x6536('0x14')][_0x6536('0x13')]);}})[_0x6536('0x15')](function(_0x3117b3){logger[_0x6536('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xfbf468,_0x3117b3);_0xb24339(_0x3117b3);});});}exports[_0x6536('0x16')]=function(_0x8a2859){var _0x5afe1d=this;return new Promise(function(_0x17e71e,_0x94b612){return db[_0x6536('0x17')]['find']({'raw':_0x8a2859[_0x6536('0x18')]?_0x8a2859[_0x6536('0x18')][_0x6536('0x19')]===undefined?!![]:![]:!![],'where':_0x8a2859[_0x6536('0x18')]?_0x8a2859[_0x6536('0x18')][_0x6536('0x1a')]||null:null,'attributes':_0x8a2859[_0x6536('0x18')]?_0x8a2859[_0x6536('0x18')][_0x6536('0x1b')]||null:null,'include':_0x8a2859[_0x6536('0x18')]?_0x8a2859['options']['include']?_[_0x6536('0x1c')](_0x8a2859[_0x6536('0x18')][_0x6536('0x1d')],function(_0x48dd93){return{'model':db[_0x48dd93[_0x6536('0x1e')]],'as':_0x48dd93['as'],'attributes':_0x48dd93[_0x6536('0x1b')],'include':_0x48dd93[_0x6536('0x1d')]?_[_0x6536('0x1c')](_0x48dd93[_0x6536('0x1d')],function(_0x395b65){return{'model':db[_0x395b65[_0x6536('0x1e')]],'as':_0x395b65['as'],'attributes':_0x395b65[_0x6536('0x1b')],'include':_0x395b65[_0x6536('0x1d')]?_['map'](_0x395b65[_0x6536('0x1d')],function(_0x3d712a){return{'model':db[_0x3d712a['model']],'as':_0x3d712a['as'],'attributes':_0x3d712a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6536('0xa')](function(_0x46530f){logger[_0x6536('0xb')](_0x6536('0x16'),_0x8a2859);logger[_0x6536('0xd')]('ShowSquareOdbc',_0x8a2859,JSON[_0x6536('0x10')](_0x46530f));_0x17e71e(_0x46530f);})['catch'](function(_0x133bf9){logger[_0x6536('0x11')](_0x6536('0x16'),_0x133bf9['message'],_0x8a2859);_0x94b612(_0x5afe1d[_0x6536('0x11')](0x1f4,_0x133bf9[_0x6536('0x13')]));});});}; \ No newline at end of file +var _0xb3bb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','map','include','model','attributes','debug','lodash','util'];(function(_0x1434ef,_0x113082){var _0x114646=function(_0x170ec1){while(--_0x170ec1){_0x1434ef['push'](_0x1434ef['shift']());}};_0x114646(++_0x113082);}(_0xb3bb,0xbe));var _0xbb3b=function(_0x554e31,_0x434380){_0x554e31=_0x554e31-0x0;var _0x572d5b=_0xb3bb[_0x554e31];return _0x572d5b;};'use strict';var _=require(_0xbb3b('0x0'));var util=require(_0xbb3b('0x1'));var moment=require(_0xbb3b('0x2'));var BPromise=require(_0xbb3b('0x3'));var rs=require(_0xbb3b('0x4'));var fs=require('fs');var Redis=require(_0xbb3b('0x5'));var db=require(_0xbb3b('0x6'))['db'];var utils=require(_0xbb3b('0x7'));var logger=require('../../config/logger')(_0xbb3b('0x8'));var config=require('../../config/environment');var jayson=require(_0xbb3b('0x9'));var client=jayson[_0xbb3b('0xa')][_0xbb3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b7a20,_0x18264a,_0x9973b7){return new BPromise(function(_0x188b6c,_0x2ae173){return client['request'](_0x2b7a20,_0x9973b7)[_0xbb3b('0xc')](function(_0x1e3389){logger[_0xbb3b('0xd')](_0xbb3b('0xe'),_0x18264a,_0xbb3b('0xf'));logger['debug'](_0xbb3b('0x10'),_0x18264a,'request\x20sent',JSON[_0xbb3b('0x11')](_0x1e3389));if(_0x1e3389['error']){if(_0x1e3389[_0xbb3b('0x12')]['code']===0x1f4){logger[_0xbb3b('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x18264a,_0x1e3389[_0xbb3b('0x12')]['message']);return _0x2ae173(_0x1e3389['error'][_0xbb3b('0x13')]);}logger[_0xbb3b('0x12')](_0xbb3b('0xe'),_0x18264a,_0x1e3389[_0xbb3b('0x12')]['message']);return _0x188b6c(_0x1e3389[_0xbb3b('0x12')][_0xbb3b('0x13')]);}else{logger[_0xbb3b('0xd')](_0xbb3b('0xe'),_0x18264a,'request\x20sent');_0x188b6c(_0x1e3389['result'][_0xbb3b('0x13')]);}})[_0xbb3b('0x14')](function(_0x5bcc50){logger[_0xbb3b('0x12')](_0xbb3b('0xe'),_0x18264a,_0x5bcc50);_0x2ae173(_0x5bcc50);});});}exports[_0xbb3b('0x15')]=function(_0x181a6a){var _0x1d7cfd=this;return new Promise(function(_0xb6b9d5,_0xd77949){return db[_0xbb3b('0x16')][_0xbb3b('0x17')]({'raw':_0x181a6a[_0xbb3b('0x18')]?_0x181a6a[_0xbb3b('0x18')][_0xbb3b('0x19')]===undefined?!![]:![]:!![],'where':_0x181a6a['options']?_0x181a6a['options'][_0xbb3b('0x1a')]||null:null,'attributes':_0x181a6a['options']?_0x181a6a[_0xbb3b('0x18')]['attributes']||null:null,'include':_0x181a6a[_0xbb3b('0x18')]?_0x181a6a['options']['include']?_[_0xbb3b('0x1b')](_0x181a6a[_0xbb3b('0x18')][_0xbb3b('0x1c')],function(_0x2e00c1){return{'model':db[_0x2e00c1[_0xbb3b('0x1d')]],'as':_0x2e00c1['as'],'attributes':_0x2e00c1['attributes'],'include':_0x2e00c1[_0xbb3b('0x1c')]?_[_0xbb3b('0x1b')](_0x2e00c1['include'],function(_0x4dd45d){return{'model':db[_0x4dd45d[_0xbb3b('0x1d')]],'as':_0x4dd45d['as'],'attributes':_0x4dd45d[_0xbb3b('0x1e')],'include':_0x4dd45d[_0xbb3b('0x1c')]?_[_0xbb3b('0x1b')](_0x4dd45d[_0xbb3b('0x1c')],function(_0x5a1e5d){return{'model':db[_0x5a1e5d[_0xbb3b('0x1d')]],'as':_0x5a1e5d['as'],'attributes':_0x5a1e5d[_0xbb3b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbb3b('0xc')](function(_0x5acba0){logger['info'](_0xbb3b('0x15'),_0x181a6a);logger[_0xbb3b('0x1f')](_0xbb3b('0x15'),_0x181a6a,JSON[_0xbb3b('0x11')](_0x5acba0));_0xb6b9d5(_0x5acba0);})[_0xbb3b('0x14')](function(_0x4b9f2c){logger[_0xbb3b('0x12')](_0xbb3b('0x15'),_0x4b9f2c[_0xbb3b('0x13')],_0x181a6a);_0xd77949(_0x1d7cfd[_0xbb3b('0x12')](0x1f4,_0x4b9f2c[_0xbb3b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e3f8133..c7d1c65 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 _0xe837=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','create','update','delete','destroy','exports','multer','util'];(function(_0x245891,_0x5bedf9){var _0x59dfa8=function(_0x288c2f){while(--_0x288c2f){_0x245891['push'](_0x245891['shift']());}};_0x59dfa8(++_0x5bedf9);}(_0xe837,0xae));var _0x7e83=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xe837[_0x4bb581];return _0x316bf5;};'use strict';var multer=require(_0x7e83('0x0'));var util=require(_0x7e83('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e83('0x2'));var router=express[_0x7e83('0x3')]();var fs_extra=require(_0x7e83('0x4'));var auth=require(_0x7e83('0x5'));var interaction=require(_0x7e83('0x6'));var config=require(_0x7e83('0x7'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7e83('0x8')]);router['get'](_0x7e83('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7e83('0xa')](),controller[_0x7e83('0xb')]);router['put']('/:id',auth[_0x7e83('0xa')](),controller[_0x7e83('0xc')]);router[_0x7e83('0xd')](_0x7e83('0x9'),auth['isAuthenticated'](),controller[_0x7e83('0xe')]);module[_0x7e83('0xf')]=router; \ No newline at end of file +var _0x0d5d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express'];(function(_0x279de4,_0x5d552d){var _0x104a16=function(_0x365e5a){while(--_0x365e5a){_0x279de4['push'](_0x279de4['shift']());}};_0x104a16(++_0x5d552d);}(_0x0d5d,0x7a));var _0xd0d5=function(_0x148b67,_0x5b390c){_0x148b67=_0x148b67-0x0;var _0x33cae0=_0x0d5d[_0x148b67];return _0x33cae0;};'use strict';var multer=require(_0xd0d5('0x0'));var util=require(_0xd0d5('0x1'));var path=require(_0xd0d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0d5('0x3'));var router=express[_0xd0d5('0x4')]();var fs_extra=require(_0xd0d5('0x5'));var auth=require(_0xd0d5('0x6'));var interaction=require(_0xd0d5('0x7'));var config=require(_0xd0d5('0x8'));var controller=require(_0xd0d5('0x9'));router[_0xd0d5('0xa')]('/',auth[_0xd0d5('0xb')](),controller[_0xd0d5('0xc')]);router[_0xd0d5('0xa')]('/:id',auth[_0xd0d5('0xb')](),controller[_0xd0d5('0xd')]);router[_0xd0d5('0xe')]('/',auth[_0xd0d5('0xb')](),controller[_0xd0d5('0xf')]);router[_0xd0d5('0x10')](_0xd0d5('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xd0d5('0x12')](_0xd0d5('0x11'),auth['isAuthenticated'](),controller[_0xd0d5('0x13')]);module[_0xd0d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2c96586..bfaa341 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 _0xe1fc=['utf8','production','DATE','sequelize','STRING','name','TEXT','BLOB','long','preproduction','getDataValue','toString'];(function(_0x209ee1,_0x16c7f6){var _0x399881=function(_0xd7ea8e){while(--_0xd7ea8e){_0x209ee1['push'](_0x209ee1['shift']());}};_0x399881(++_0x16c7f6);}(_0xe1fc,0x1e3));var _0xce1f=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xe1fc[_0x2f4c1c];return _0x25e0f2;};'use strict';var Sequelize=require(_0xce1f('0x0'));module['exports']={'name':{'type':Sequelize[_0xce1f('0x1')],'unique':_0xce1f('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xce1f('0x3')]},'preproduction':{'type':Sequelize[_0xce1f('0x4')](_0xce1f('0x5')),'get':function(){if(this['getDataValue'](_0xce1f('0x6'))){return this[_0xce1f('0x7')](_0xce1f('0x6'))[_0xce1f('0x8')](_0xce1f('0x9'));}}},'production':{'type':Sequelize[_0xce1f('0x4')]('long'),'get':function(){if(this['getDataValue']('production')){return this[_0xce1f('0x7')](_0xce1f('0xa'))[_0xce1f('0x8')](_0xce1f('0x9'));}}},'savedAt':{'type':Sequelize[_0xce1f('0xb')]},'publishedAt':{'type':Sequelize[_0xce1f('0xb')]}}; \ No newline at end of file +var _0xa23f=['DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0xa23f,0x18d));var _0xfa23=function(_0x2b37e9,_0x28bb31){_0x2b37e9=_0x2b37e9-0x0;var _0x25b17f=_0xa23f[_0x2b37e9];return _0x25b17f;};'use strict';var Sequelize=require(_0xfa23('0x0'));module[_0xfa23('0x1')]={'name':{'type':Sequelize[_0xfa23('0x2')],'unique':_0xfa23('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xfa23('0x4')](_0xfa23('0x5')),'get':function(){if(this[_0xfa23('0x6')](_0xfa23('0x7'))){return this[_0xfa23('0x6')]('preproduction')[_0xfa23('0x8')](_0xfa23('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xfa23('0x5')),'get':function(){if(this['getDataValue'](_0xfa23('0xa'))){return this['getDataValue']('production')[_0xfa23('0x8')](_0xfa23('0x9'));}}},'savedAt':{'type':Sequelize[_0xfa23('0xb')]},'publishedAt':{'type':Sequelize[_0xfa23('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 94586ef..5bb8519 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 _0x53ba=['count','set','then','get','SquareProjects','UserProfileResource','publish','agi','end','sendStatus','stack','name','send','map','SquareProject','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit'];(function(_0x2b8d9e,_0x38f52a){var _0x380e14=function(_0xfc9680){while(--_0xfc9680){_0x2b8d9e['push'](_0x2b8d9e['shift']());}};_0x380e14(++_0x38f52a);}(_0x53ba,0x18e));var _0xa53b=function(_0x902b9c,_0x57b164){_0x902b9c=_0x902b9c-0x0;var _0x230e34=_0x53ba[_0x902b9c];return _0x230e34;};'use strict';var _=require(_0xa53b('0x0'));var Redis=require(_0xa53b('0x1'));var qs=require(_0xa53b('0x2'));var logger=require(_0xa53b('0x3'))('api');var config=require(_0xa53b('0x4'));var db=require(_0xa53b('0x5'))['db'];config[_0xa53b('0x6')]=_['defaults'](config[_0xa53b('0x6')],{'host':_0xa53b('0x7'),'port':0x18eb});var socket=require(_0xa53b('0x8'))(new Redis(config['redis']));require(_0xa53b('0x9'))[_0xa53b('0xa')](socket);function respondWithResult(_0x482a56,_0x52d9ca){_0x52d9ca=_0x52d9ca||0xc8;return function(_0x3fcdfe){if(_0x3fcdfe){return _0x482a56[_0xa53b('0xb')](_0x52d9ca)[_0xa53b('0xc')](_0x3fcdfe);}};}function respondWithFilteredResult(_0x157f11,_0x238c6b){return function(_0x4c36b1){if(_0x4c36b1){var _0x127938=typeof _0x238c6b[_0xa53b('0xd')]===_0xa53b('0xe')&&typeof _0x238c6b[_0xa53b('0xf')]===_0xa53b('0xe');var _0x41481c=_0x4c36b1[_0xa53b('0x10')];var _0x47434d=_0x127938?0x0:_0x238c6b[_0xa53b('0xd')];var _0x5df1a0=_0x127938?_0x4c36b1[_0xa53b('0x10')]:_0x238c6b[_0xa53b('0xd')]+_0x238c6b['limit'];var _0x2d2ea6;if(_0x5df1a0>=_0x41481c){_0x5df1a0=_0x41481c;_0x2d2ea6=0xc8;}else{_0x2d2ea6=0xce;}_0x157f11[_0xa53b('0xb')](_0x2d2ea6);return _0x157f11[_0xa53b('0x11')]('Content-Range',_0x47434d+'-'+_0x5df1a0+'/'+_0x41481c)[_0xa53b('0xc')](_0x4c36b1);}return null;};}function saveUpdates(_0x3cc8d1){return function(_0x3ca0f3){if(_0x3ca0f3){return _0x3ca0f3['update'](_0x3cc8d1)['then'](function(_0x10bc46){return _0x10bc46;});}return null;};}function removeEntity(_0x56a921){return function(_0x26ddff){if(_0x26ddff){return _0x26ddff['destroy']()[_0xa53b('0x12')](function(){var _0x367b1e=_0x26ddff[_0xa53b('0x13')]({'plain':!![]});var _0x52e7f7=_0xa53b('0x14');return db[_0xa53b('0x15')]['destroy']({'where':{'type':_0x52e7f7,'resourceId':_0x367b1e['id']}})[_0xa53b('0x12')](function(){return _0x26ddff;});})[_0xa53b('0x12')](function(){var _0x300a8d=new Redis(config['redis']);_0x300a8d[_0xa53b('0x16')](_0xa53b('0x17'),JSON['stringify']({'id':_0x26ddff['id'],'deleted':!![]}));})[_0xa53b('0x12')](function(){_0x56a921[_0xa53b('0xb')](0xcc)[_0xa53b('0x18')]();});}};}function handleEntityNotFound(_0x319a3d){return function(_0x483bea){if(!_0x483bea){_0x319a3d[_0xa53b('0x19')](0x194);}return _0x483bea;};}function handleError(_0x4bd53c,_0x1d09e7){_0x1d09e7=_0x1d09e7||0x1f4;return function(_0x223e7d){logger['error'](_0x223e7d[_0xa53b('0x1a')]);if(_0x223e7d['name']){delete _0x223e7d[_0xa53b('0x1b')];}_0x4bd53c[_0xa53b('0xb')](_0x1d09e7)[_0xa53b('0x1c')](_0x223e7d);};}exports['index']=function(_0x1e2eed,_0x42c0c9){var _0x2b3fd7={},_0x495683={},_0x4afea5={'count':0x0,'rows':[]};var _0x2e1848=_[_0xa53b('0x1d')](db[_0xa53b('0x1e')]['rawAttributes'],function(_0x26b7cf){return{'name':_0x26b7cf['fieldName'],'type':_0x26b7cf[_0xa53b('0x1f')][_0xa53b('0x20')]};});_0x495683['model']=_[_0xa53b('0x1d')](_0x2e1848,_0xa53b('0x1b'));_0x495683['query']=_[_0xa53b('0x21')](_0x1e2eed[_0xa53b('0x22')]);_0x495683[_0xa53b('0x23')]=_[_0xa53b('0x24')](_0x495683[_0xa53b('0x25')],_0x495683[_0xa53b('0x22')]);_0x2b3fd7[_0xa53b('0x26')]=_[_0xa53b('0x24')](_0x495683[_0xa53b('0x25')],qs[_0xa53b('0x27')](_0x1e2eed[_0xa53b('0x22')][_0xa53b('0x27')]));_0x2b3fd7['attributes']=_0x2b3fd7[_0xa53b('0x26')][_0xa53b('0x28')]?_0x2b3fd7['attributes']:_0x495683[_0xa53b('0x25')];if(!_0x1e2eed[_0xa53b('0x22')][_0xa53b('0x29')](_0xa53b('0x2a'))){_0x2b3fd7[_0xa53b('0xf')]=qs['limit'](_0x1e2eed['query'][_0xa53b('0xf')]);_0x2b3fd7[_0xa53b('0xd')]=qs['offset'](_0x1e2eed[_0xa53b('0x22')][_0xa53b('0xd')]);}_0x2b3fd7[_0xa53b('0x2b')]=qs['sort'](_0x1e2eed[_0xa53b('0x22')]['sort']);_0x2b3fd7[_0xa53b('0x2c')]=qs[_0xa53b('0x23')](_[_0xa53b('0x2d')](_0x1e2eed[_0xa53b('0x22')],_0x495683['filters']),_0x2e1848);if(_0x1e2eed[_0xa53b('0x22')]['filter']){_0x2b3fd7[_0xa53b('0x2c')]=_[_0xa53b('0x2e')](_0x2b3fd7[_0xa53b('0x2c')],{'$or':_[_0xa53b('0x1d')](_0x2e1848,function(_0x5c5d8a){if(_0x5c5d8a[_0xa53b('0x1f')]!==_0xa53b('0x2f')){var _0x14d152={};_0x14d152[_0x5c5d8a['name']]={'$like':'%'+_0x1e2eed['query'][_0xa53b('0x30')]+'%'};return _0x14d152;}})});}_0x2b3fd7=_[_0xa53b('0x2e')]({},_0x2b3fd7,_0x1e2eed[_0xa53b('0x31')]);var _0x364a18={'where':_0x2b3fd7['where']};return db[_0xa53b('0x1e')][_0xa53b('0x10')](_0x364a18)[_0xa53b('0x12')](function(_0x479ddc){_0x4afea5[_0xa53b('0x10')]=_0x479ddc;if(_0x1e2eed['query']['includeAll']){_0x2b3fd7['include']=[{'all':!![]}];}return db[_0xa53b('0x1e')][_0xa53b('0x32')](_0x2b3fd7);})[_0xa53b('0x12')](function(_0x6e38bb){_0x4afea5[_0xa53b('0x33')]=_0x6e38bb;return _0x4afea5;})['then'](respondWithFilteredResult(_0x42c0c9,_0x2b3fd7))[_0xa53b('0x34')](handleError(_0x42c0c9,null));};exports[_0xa53b('0x35')]=function(_0x30057b,_0x17a100){var _0xc61266={'raw':![],'where':{'id':_0x30057b[_0xa53b('0x36')]['id']}},_0x20021b={};_0x20021b[_0xa53b('0x25')]=_['keys'](db[_0xa53b('0x1e')][_0xa53b('0x37')]);_0x20021b['query']=_[_0xa53b('0x21')](_0x30057b['query']);_0x20021b[_0xa53b('0x23')]=_['intersection'](_0x20021b[_0xa53b('0x25')],_0x20021b[_0xa53b('0x22')]);_0xc61266[_0xa53b('0x26')]=_[_0xa53b('0x24')](_0x20021b['model'],qs[_0xa53b('0x27')](_0x30057b['query'][_0xa53b('0x27')]));_0xc61266['attributes']=_0xc61266[_0xa53b('0x26')][_0xa53b('0x28')]?_0xc61266['attributes']:_0x20021b[_0xa53b('0x25')];if(_0x30057b[_0xa53b('0x22')][_0xa53b('0x38')]){_0xc61266[_0xa53b('0x39')]=[{'all':!![]}];}_0xc61266=_[_0xa53b('0x2e')]({},_0xc61266,_0x30057b['options']);return db['SquareProject'][_0xa53b('0x3a')](_0xc61266)[_0xa53b('0x12')](handleEntityNotFound(_0x17a100,null))['then'](respondWithResult(_0x17a100,null))[_0xa53b('0x34')](handleError(_0x17a100,null));};exports[_0xa53b('0x3b')]=function(_0x13f021,_0x3eca8a){return db[_0xa53b('0x1e')][_0xa53b('0x3b')](_0x13f021[_0xa53b('0x3c')],{})['then'](function(_0x467c14){var _0x590ce9=_0x13f021[_0xa53b('0x3d')][_0xa53b('0x13')]({'plain':!![]});if(!_0x590ce9)throw new Error(_0xa53b('0x3e'));if(_0x590ce9[_0xa53b('0x3f')]==='user'){var _0x7608b4=_0x467c14['get']({'plain':!![]});var _0x3bfaac=_0xa53b('0x14');return db['UserProfileSection'][_0xa53b('0x3a')]({'where':{'name':_0x3bfaac,'userProfileId':_0x590ce9['userProfileId']},'raw':!![]})['then'](function(_0x34f56f){if(_0x34f56f&&_0x34f56f[_0xa53b('0x40')]===0x0){return db[_0xa53b('0x15')]['create']({'name':_0x7608b4[_0xa53b('0x1b')],'resourceId':_0x7608b4['id'],'type':_0x34f56f['name'],'sectionId':_0x34f56f['id']},{})[_0xa53b('0x12')](function(){return _0x467c14;});}else{return _0x467c14;}})['catch'](function(_0x159b89){logger[_0xa53b('0x41')](_0xa53b('0x42'),_0x159b89);throw _0x159b89;});}return _0x467c14;})['then'](respondWithResult(_0x3eca8a,0xc9))[_0xa53b('0x34')](handleError(_0x3eca8a,null));};exports[_0xa53b('0x43')]=function(_0x5712ec,_0x58148c){if(_0x5712ec[_0xa53b('0x3c')]['id']){delete _0x5712ec[_0xa53b('0x3c')]['id'];}return db[_0xa53b('0x1e')]['find']({'where':{'id':_0x5712ec['params']['id']}})['then'](handleEntityNotFound(_0x58148c,null))[_0xa53b('0x12')](saveUpdates(_0x5712ec['body'],null))[_0xa53b('0x12')](function(_0x1f5d0b){if(!_0x1f5d0b)return;var _0x7a332f=_0x1f5d0b[_0xa53b('0x13')]({'plain':!![]});return _0x7a332f;})['then'](function(_0x4d6baa){var _0x46fc12=new Redis(config[_0xa53b('0x6')]);_0x46fc12[_0xa53b('0x16')](_0xa53b('0x17'),JSON['stringify'](_[_0xa53b('0x2d')](_0x4d6baa,['id',_0xa53b('0x1b'),_0xa53b('0x44')])));return _0x4d6baa;})[_0xa53b('0x12')](respondWithResult(_0x58148c,null))[_0xa53b('0x34')](handleError(_0x58148c,null));};exports['destroy']=function(_0x45f12b,_0x5ad543){return db[_0xa53b('0x1e')][_0xa53b('0x3a')]({'where':{'id':_0x45f12b[_0xa53b('0x36')]['id']}})[_0xa53b('0x12')](handleEntityNotFound(_0x5ad543,null))[_0xa53b('0x12')](removeEntity(_0x5ad543,null))['catch'](handleError(_0x5ad543,null));}; \ No newline at end of file +var _0x3dce=['nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','undefined','limit','count','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length'];(function(_0x246dca,_0xe0ab57){var _0x341224=function(_0x2ef7da){while(--_0x2ef7da){_0x246dca['push'](_0x246dca['shift']());}};_0x341224(++_0xe0ab57);}(_0x3dce,0x164));var _0xe3dc=function(_0x19b5c6,_0x28fa44){_0x19b5c6=_0x19b5c6-0x0;var _0x12b830=_0x3dce[_0x19b5c6];return _0x12b830;};'use strict';var _=require(_0xe3dc('0x0'));var Redis=require(_0xe3dc('0x1'));var qs=require(_0xe3dc('0x2'));var logger=require(_0xe3dc('0x3'))(_0xe3dc('0x4'));var config=require('../../config/environment');var db=require(_0xe3dc('0x5'))['db'];config['redis']=_[_0xe3dc('0x6')](config[_0xe3dc('0x7')],{'host':_0xe3dc('0x8'),'port':0x18eb});var socket=require(_0xe3dc('0x9'))(new Redis(config[_0xe3dc('0x7')]));require(_0xe3dc('0xa'))[_0xe3dc('0xb')](socket);function respondWithResult(_0x1006de,_0x447554){_0x447554=_0x447554||0xc8;return function(_0x7e946c){if(_0x7e946c){return _0x1006de[_0xe3dc('0xc')](_0x447554)['json'](_0x7e946c);}};}function respondWithFilteredResult(_0x34dd73,_0x3a2ada){return function(_0x58ada9){if(_0x58ada9){var _0xfc0938=typeof _0x3a2ada[_0xe3dc('0xd')]===_0xe3dc('0xe')&&typeof _0x3a2ada[_0xe3dc('0xf')]===_0xe3dc('0xe');var _0x2359ad=_0x58ada9[_0xe3dc('0x10')];var _0x3534eb=_0xfc0938?0x0:_0x3a2ada['offset'];var _0x3052d6=_0xfc0938?_0x58ada9['count']:_0x3a2ada[_0xe3dc('0xd')]+_0x3a2ada['limit'];var _0x433476;if(_0x3052d6>=_0x2359ad){_0x3052d6=_0x2359ad;_0x433476=0xc8;}else{_0x433476=0xce;}_0x34dd73[_0xe3dc('0xc')](_0x433476);return _0x34dd73['set'](_0xe3dc('0x11'),_0x3534eb+'-'+_0x3052d6+'/'+_0x2359ad)['json'](_0x58ada9);}return null;};}function saveUpdates(_0x168bba){return function(_0x745864){if(_0x745864){return _0x745864[_0xe3dc('0x12')](_0x168bba)[_0xe3dc('0x13')](function(_0x106eb6){return _0x106eb6;});}return null;};}function removeEntity(_0x5ba763){return function(_0x598c24){if(_0x598c24){return _0x598c24[_0xe3dc('0x14')]()['then'](function(){var _0x4a2799=_0x598c24[_0xe3dc('0x15')]({'plain':!![]});var _0x2235cb=_0xe3dc('0x16');return db[_0xe3dc('0x17')][_0xe3dc('0x14')]({'where':{'type':_0x2235cb,'resourceId':_0x4a2799['id']}})['then'](function(){return _0x598c24;});})[_0xe3dc('0x13')](function(){var _0x196c7f=new Redis(config['redis']);_0x196c7f[_0xe3dc('0x18')](_0xe3dc('0x19'),JSON['stringify']({'id':_0x598c24['id'],'deleted':!![]}));})[_0xe3dc('0x13')](function(){_0x5ba763[_0xe3dc('0xc')](0xcc)[_0xe3dc('0x1a')]();});}};}function handleEntityNotFound(_0x597b01){return function(_0x44f973){if(!_0x44f973){_0x597b01[_0xe3dc('0x1b')](0x194);}return _0x44f973;};}function handleError(_0x23e874,_0x25bbbb){_0x25bbbb=_0x25bbbb||0x1f4;return function(_0x5c3eca){logger[_0xe3dc('0x1c')](_0x5c3eca[_0xe3dc('0x1d')]);if(_0x5c3eca[_0xe3dc('0x1e')]){delete _0x5c3eca[_0xe3dc('0x1e')];}_0x23e874[_0xe3dc('0xc')](_0x25bbbb)[_0xe3dc('0x1f')](_0x5c3eca);};}exports[_0xe3dc('0x20')]=function(_0x3b3cbe,_0xa2a7d1){var _0x1bd350={},_0x5b075c={},_0x2eda10={'count':0x0,'rows':[]};var _0x929c5a=_[_0xe3dc('0x21')](db[_0xe3dc('0x22')][_0xe3dc('0x23')],function(_0x50f744){return{'name':_0x50f744[_0xe3dc('0x24')],'type':_0x50f744[_0xe3dc('0x25')][_0xe3dc('0x26')]};});_0x5b075c[_0xe3dc('0x27')]=_[_0xe3dc('0x21')](_0x929c5a,_0xe3dc('0x1e'));_0x5b075c[_0xe3dc('0x28')]=_[_0xe3dc('0x29')](_0x3b3cbe[_0xe3dc('0x28')]);_0x5b075c['filters']=_['intersection'](_0x5b075c[_0xe3dc('0x27')],_0x5b075c['query']);_0x1bd350[_0xe3dc('0x2a')]=_[_0xe3dc('0x2b')](_0x5b075c['model'],qs[_0xe3dc('0x2c')](_0x3b3cbe[_0xe3dc('0x28')][_0xe3dc('0x2c')]));_0x1bd350['attributes']=_0x1bd350['attributes'][_0xe3dc('0x2d')]?_0x1bd350[_0xe3dc('0x2a')]:_0x5b075c[_0xe3dc('0x27')];if(!_0x3b3cbe['query']['hasOwnProperty'](_0xe3dc('0x2e'))){_0x1bd350[_0xe3dc('0xf')]=qs[_0xe3dc('0xf')](_0x3b3cbe[_0xe3dc('0x28')][_0xe3dc('0xf')]);_0x1bd350[_0xe3dc('0xd')]=qs[_0xe3dc('0xd')](_0x3b3cbe[_0xe3dc('0x28')][_0xe3dc('0xd')]);}_0x1bd350['order']=qs[_0xe3dc('0x2f')](_0x3b3cbe['query']['sort']);_0x1bd350[_0xe3dc('0x30')]=qs['filters'](_[_0xe3dc('0x31')](_0x3b3cbe['query'],_0x5b075c[_0xe3dc('0x32')]),_0x929c5a);if(_0x3b3cbe[_0xe3dc('0x28')][_0xe3dc('0x33')]){_0x1bd350[_0xe3dc('0x30')]=_[_0xe3dc('0x34')](_0x1bd350[_0xe3dc('0x30')],{'$or':_['map'](_0x929c5a,function(_0x5b8410){if(_0x5b8410[_0xe3dc('0x25')]!=='VIRTUAL'){var _0x4bbd9a={};_0x4bbd9a[_0x5b8410[_0xe3dc('0x1e')]]={'$like':'%'+_0x3b3cbe['query'][_0xe3dc('0x33')]+'%'};return _0x4bbd9a;}})});}_0x1bd350=_['merge']({},_0x1bd350,_0x3b3cbe[_0xe3dc('0x35')]);var _0x4e57b2={'where':_0x1bd350[_0xe3dc('0x30')]};return db[_0xe3dc('0x22')][_0xe3dc('0x10')](_0x4e57b2)[_0xe3dc('0x13')](function(_0x4e8665){_0x2eda10[_0xe3dc('0x10')]=_0x4e8665;if(_0x3b3cbe[_0xe3dc('0x28')][_0xe3dc('0x36')]){_0x1bd350[_0xe3dc('0x37')]=[{'all':!![]}];}return db[_0xe3dc('0x22')][_0xe3dc('0x38')](_0x1bd350);})[_0xe3dc('0x13')](function(_0x5cd848){_0x2eda10[_0xe3dc('0x39')]=_0x5cd848;return _0x2eda10;})[_0xe3dc('0x13')](respondWithFilteredResult(_0xa2a7d1,_0x1bd350))['catch'](handleError(_0xa2a7d1,null));};exports['show']=function(_0x475a2f,_0x4c96c9){var _0x1e781a={'raw':![],'where':{'id':_0x475a2f[_0xe3dc('0x3a')]['id']}},_0x61a321={};_0x61a321[_0xe3dc('0x27')]=_[_0xe3dc('0x29')](db[_0xe3dc('0x22')][_0xe3dc('0x23')]);_0x61a321[_0xe3dc('0x28')]=_[_0xe3dc('0x29')](_0x475a2f[_0xe3dc('0x28')]);_0x61a321[_0xe3dc('0x32')]=_[_0xe3dc('0x2b')](_0x61a321['model'],_0x61a321['query']);_0x1e781a['attributes']=_[_0xe3dc('0x2b')](_0x61a321['model'],qs['fields'](_0x475a2f[_0xe3dc('0x28')][_0xe3dc('0x2c')]));_0x1e781a[_0xe3dc('0x2a')]=_0x1e781a[_0xe3dc('0x2a')][_0xe3dc('0x2d')]?_0x1e781a[_0xe3dc('0x2a')]:_0x61a321[_0xe3dc('0x27')];if(_0x475a2f[_0xe3dc('0x28')]['includeAll']){_0x1e781a[_0xe3dc('0x37')]=[{'all':!![]}];}_0x1e781a=_[_0xe3dc('0x34')]({},_0x1e781a,_0x475a2f[_0xe3dc('0x35')]);return db[_0xe3dc('0x22')][_0xe3dc('0x3b')](_0x1e781a)['then'](handleEntityNotFound(_0x4c96c9,null))[_0xe3dc('0x13')](respondWithResult(_0x4c96c9,null))[_0xe3dc('0x3c')](handleError(_0x4c96c9,null));};exports['create']=function(_0x4ec5ef,_0x252baf){return db['SquareProject'][_0xe3dc('0x3d')](_0x4ec5ef[_0xe3dc('0x3e')],{})['then'](function(_0x34ed00){var _0x3f6000=_0x4ec5ef[_0xe3dc('0x3f')]['get']({'plain':!![]});if(!_0x3f6000)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f6000[_0xe3dc('0x40')]===_0xe3dc('0x3f')){var _0x4b371d=_0x34ed00['get']({'plain':!![]});var _0x2341e7='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x2341e7,'userProfileId':_0x3f6000[_0xe3dc('0x41')]},'raw':!![]})[_0xe3dc('0x13')](function(_0x65f104){if(_0x65f104&&_0x65f104['autoAssociation']===0x0){return db[_0xe3dc('0x17')]['create']({'name':_0x4b371d[_0xe3dc('0x1e')],'resourceId':_0x4b371d['id'],'type':_0x65f104['name'],'sectionId':_0x65f104['id']},{})['then'](function(){return _0x34ed00;});}else{return _0x34ed00;}})[_0xe3dc('0x3c')](function(_0x4835e6){logger[_0xe3dc('0x1c')](_0xe3dc('0x42'),_0x4835e6);throw _0x4835e6;});}return _0x34ed00;})[_0xe3dc('0x13')](respondWithResult(_0x252baf,0xc9))[_0xe3dc('0x3c')](handleError(_0x252baf,null));};exports[_0xe3dc('0x12')]=function(_0x3fd6d5,_0x3adc27){if(_0x3fd6d5[_0xe3dc('0x3e')]['id']){delete _0x3fd6d5[_0xe3dc('0x3e')]['id'];}return db[_0xe3dc('0x22')][_0xe3dc('0x3b')]({'where':{'id':_0x3fd6d5[_0xe3dc('0x3a')]['id']}})[_0xe3dc('0x13')](handleEntityNotFound(_0x3adc27,null))[_0xe3dc('0x13')](saveUpdates(_0x3fd6d5['body'],null))['then'](function(_0x36e294){if(!_0x36e294)return;var _0x1176b0=_0x36e294['get']({'plain':!![]});return _0x1176b0;})[_0xe3dc('0x13')](function(_0x3595f2){var _0x1533c7=new Redis(config[_0xe3dc('0x7')]);_0x1533c7[_0xe3dc('0x18')](_0xe3dc('0x19'),JSON['stringify'](_[_0xe3dc('0x31')](_0x3595f2,['id',_0xe3dc('0x1e'),'production'])));return _0x3595f2;})[_0xe3dc('0x13')](respondWithResult(_0x3adc27,null))[_0xe3dc('0x3c')](handleError(_0x3adc27,null));};exports[_0xe3dc('0x14')]=function(_0x36fab6,_0xd71f40){return db['SquareProject']['find']({'where':{'id':_0x36fab6[_0xe3dc('0x3a')]['id']}})[_0xe3dc('0x13')](handleEntityNotFound(_0xd71f40,null))[_0xe3dc('0x13')](removeEntity(_0xd71f40,null))[_0xe3dc('0x3c')](handleError(_0xd71f40,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 98d8fa1..6e9c533 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 _0x2a22=['events','../../mysqldb','SquareProject','remove','emit','hasOwnProperty','hook','exports'];(function(_0x27d15a,_0x3e904b){var _0x4aedf1=function(_0x424141){while(--_0x424141){_0x27d15a['push'](_0x27d15a['shift']());}};_0x4aedf1(++_0x3e904b);}(_0x2a22,0x158));var _0x22a2=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2a22[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require(_0x22a2('0x0'));var SquareProject=require(_0x22a2('0x1'))['db'][_0x22a2('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x22a2('0x3')};function emitEvent(_0x362c7c){return function(_0x5d322f,_0x324173,_0x221984){SquareProjectEvents[_0x22a2('0x4')](_0x362c7c+':'+_0x5d322f['id'],_0x5d322f);SquareProjectEvents[_0x22a2('0x4')](_0x362c7c,_0x5d322f);_0x221984(null);};}for(var e in events){if(events[_0x22a2('0x5')](e)){var event=events[e];SquareProject[_0x22a2('0x6')](e,emitEvent(event));}}module[_0x22a2('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x5d5b=['emit','hook','exports','events','../../mysqldb','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d5b,0xa5));var _0xb5d5=function(_0x2368a9,_0x27dd2e){_0x2368a9=_0x2368a9-0x0;var _0x5886b7=_0x5d5b[_0x2368a9];return _0x5886b7;};'use strict';var EventEmitter=require(_0xb5d5('0x0'));var SquareProject=require(_0xb5d5('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb5d5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x14b1b1){return function(_0xfdf7e0,_0x164b02,_0x3c8095){SquareProjectEvents['emit'](_0x14b1b1+':'+_0xfdf7e0['id'],_0xfdf7e0);SquareProjectEvents[_0xb5d5('0x3')](_0x14b1b1,_0xfdf7e0);_0x3c8095(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb5d5('0x4')](e,emitEvent(event));}}module[_0xb5d5('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7b13115..44a0798 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 _0x7c03=['changed','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x21dca6,_0x322ca5){var _0x183068=function(_0x376af0){while(--_0x376af0){_0x21dca6['push'](_0x21dca6['shift']());}};_0x183068(++_0x322ca5);}(_0x7c03,0x1a4));var _0x37c0=function(_0x424e92,_0x48fc5c){_0x424e92=_0x424e92-0x0;var _0x316d3c=_0x7c03[_0x424e92];return _0x316d3c;};'use strict';var _=require(_0x37c0('0x0'));var util=require(_0x37c0('0x1'));var logger=require('../../config/logger')(_0x37c0('0x2'));var moment=require(_0x37c0('0x3'));var BPromise=require(_0x37c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37c0('0x5'));var rimraf=require(_0x37c0('0x6'));var config=require(_0x37c0('0x7'));var attributes=require(_0x37c0('0x8'));module[_0x37c0('0x9')]=function(_0x4f3c1c,_0x11541d){return _0x4f3c1c[_0x37c0('0xa')](_0x37c0('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2601d3,_0x1023b9,_0x501b4d){if(_0x2601d3[_0x37c0('0xc')]('preproduction')){_0x2601d3[_0x37c0('0xd')]=moment()[_0x37c0('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2601d3[_0x37c0('0xc')](_0x37c0('0xf'))){_0x2601d3[_0x37c0('0x10')]=moment()[_0x37c0('0xe')](_0x37c0('0x11'));}_0x501b4d(null,_0x2601d3);}}});}; \ No newline at end of file +var _0x7a12=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger'];(function(_0x2b9e1a,_0x45dc8b){var _0x587360=function(_0x3f999f){while(--_0x3f999f){_0x2b9e1a['push'](_0x2b9e1a['shift']());}};_0x587360(++_0x45dc8b);}(_0x7a12,0xf9));var _0x27a1=function(_0x1935b7,_0x529312){_0x1935b7=_0x1935b7-0x0;var _0x2fd1cf=_0x7a12[_0x1935b7];return _0x2fd1cf;};'use strict';var _=require(_0x27a1('0x0'));var util=require(_0x27a1('0x1'));var logger=require(_0x27a1('0x2'))('api');var moment=require(_0x27a1('0x3'));var BPromise=require(_0x27a1('0x4'));var rp=require(_0x27a1('0x5'));var fs=require('fs');var path=require(_0x27a1('0x6'));var rimraf=require(_0x27a1('0x7'));var config=require(_0x27a1('0x8'));var attributes=require(_0x27a1('0x9'));module[_0x27a1('0xa')]=function(_0x52c4e8,_0x1a2cbb){return _0x52c4e8['define'](_0x27a1('0xb'),attributes,{'tableName':_0x27a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4fa25e,_0x5a82dc,_0x5ecf1c){if(_0x4fa25e[_0x27a1('0xd')](_0x27a1('0xe'))){_0x4fa25e['savedAt']=moment()[_0x27a1('0xf')](_0x27a1('0x10'));}if(_0x4fa25e[_0x27a1('0xd')](_0x27a1('0x11'))){_0x4fa25e['publishedAt']=moment()[_0x27a1('0xf')](_0x27a1('0x10'));}_0x5ecf1c(null,_0x4fa25e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 84e909c..47ae7e3 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 _0x6dc5=['localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','include','map','then','info','debug','stringify','catch','message','error','ShowSquareProject','find','where','model','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0x6dc5,0x161));var _0x56dc=function(_0x530f66,_0x5c92ae){_0x530f66=_0x530f66-0x0;var _0x384937=_0x6dc5[_0x530f66];return _0x384937;};'use strict';var _=require(_0x56dc('0x0'));var Redis=require(_0x56dc('0x1'));var db=require(_0x56dc('0x2'))['db'];var logger=require(_0x56dc('0x3'))('rpc');var config=require(_0x56dc('0x4'));config[_0x56dc('0x5')]=_[_0x56dc('0x6')](config[_0x56dc('0x5')],{'host':_0x56dc('0x7'),'port':0x18eb});var socket=require(_0x56dc('0x8'))(new Redis(config[_0x56dc('0x5')]));require(_0x56dc('0x9'))[_0x56dc('0xa')](socket);exports[_0x56dc('0xb')]=function(_0x1f37a8){var _0x4a54b7=this;return new Promise(function(_0x1bdb87,_0x5c5626){return db[_0x56dc('0xc')][_0x56dc('0xd')]({'raw':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')][_0x56dc('0xf')]===undefined?!![]:![]:!![],'where':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')]['where']||null:null,'attributes':_0x1f37a8['options']?_0x1f37a8[_0x56dc('0xe')][_0x56dc('0x10')]||null:null,'limit':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')]['limit']||null:null,'include':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')][_0x56dc('0x11')]?_['map'](_0x1f37a8[_0x56dc('0xe')][_0x56dc('0x11')],function(_0x273ae1){return{'model':db[_0x273ae1['model']],'as':_0x273ae1['as'],'attributes':_0x273ae1[_0x56dc('0x10')],'include':_0x273ae1['include']?_[_0x56dc('0x12')](_0x273ae1[_0x56dc('0x11')],function(_0x4a7e90){return{'model':db[_0x4a7e90['model']],'as':_0x4a7e90['as'],'attributes':_0x4a7e90[_0x56dc('0x10')],'include':_0x4a7e90[_0x56dc('0x11')]?_[_0x56dc('0x12')](_0x4a7e90[_0x56dc('0x11')],function(_0xb20e8d){return{'model':db[_0xb20e8d['model']],'as':_0xb20e8d['as'],'attributes':_0xb20e8d['attributes']};}):[]};}):[]};}):[]:[]})[_0x56dc('0x13')](function(_0x4bd960){logger[_0x56dc('0x14')]('GetSquareProjects',_0x1f37a8);logger[_0x56dc('0x15')](_0x56dc('0xb'),_0x1f37a8,JSON[_0x56dc('0x16')](_0x4bd960));_0x1bdb87(_0x4bd960);})[_0x56dc('0x17')](function(_0x3a5365){logger['error'](_0x56dc('0xb'),_0x3a5365[_0x56dc('0x18')],_0x1f37a8);_0x5c5626(_0x4a54b7[_0x56dc('0x19')](0x1f4,_0x3a5365[_0x56dc('0x18')]));});});};exports[_0x56dc('0x1a')]=function(_0x27c394){var _0x3e1c8a=this;return new Promise(function(_0x283d56,_0x44fea7){return db['SquareProject'][_0x56dc('0x1b')]({'raw':_0x27c394[_0x56dc('0xe')]?_0x27c394[_0x56dc('0xe')][_0x56dc('0xf')]===undefined?!![]:![]:!![],'where':_0x27c394['options']?_0x27c394['options'][_0x56dc('0x1c')]||null:null,'attributes':_0x27c394[_0x56dc('0xe')]?_0x27c394['options'][_0x56dc('0x10')]||null:null,'include':_0x27c394[_0x56dc('0xe')]?_0x27c394[_0x56dc('0xe')][_0x56dc('0x11')]?_[_0x56dc('0x12')](_0x27c394[_0x56dc('0xe')][_0x56dc('0x11')],function(_0x47c2a8){return{'model':db[_0x47c2a8[_0x56dc('0x1d')]],'as':_0x47c2a8['as'],'attributes':_0x47c2a8[_0x56dc('0x10')],'include':_0x47c2a8[_0x56dc('0x11')]?_['map'](_0x47c2a8[_0x56dc('0x11')],function(_0x31ff0b){return{'model':db[_0x31ff0b['model']],'as':_0x31ff0b['as'],'attributes':_0x31ff0b['attributes'],'include':_0x31ff0b['include']?_['map'](_0x31ff0b[_0x56dc('0x11')],function(_0x594ce2){return{'model':db[_0x594ce2[_0x56dc('0x1d')]],'as':_0x594ce2['as'],'attributes':_0x594ce2[_0x56dc('0x10')]};}):[]};}):[]};}):[]:[]})[_0x56dc('0x13')](function(_0x296385){logger[_0x56dc('0x14')](_0x56dc('0x1a'),_0x27c394);logger['debug'](_0x56dc('0x1a'),_0x27c394,JSON[_0x56dc('0x16')](_0x296385));_0x283d56(_0x296385);})[_0x56dc('0x17')](function(_0x1813ef){logger['error'](_0x56dc('0x1a'),_0x1813ef['message'],_0x27c394);_0x44fea7(_0x3e1c8a[_0x56dc('0x19')](0x1f4,_0x1813ef[_0x56dc('0x18')]));});});}; \ No newline at end of file +var _0xf6a9=['message','ShowSquareProject','SquareProject','find','stringify','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','where','attributes','limit','include','map','model','then','info','debug','catch','error'];(function(_0x27a51a,_0x360b20){var _0xadafb1=function(_0x3351af){while(--_0x3351af){_0x27a51a['push'](_0x27a51a['shift']());}};_0xadafb1(++_0x360b20);}(_0xf6a9,0x131));var _0x9f6a=function(_0x497144,_0x4d0c38){_0x497144=_0x497144-0x0;var _0xaa659f=_0xf6a9[_0x497144];return _0xaa659f;};'use strict';var _=require('lodash');var Redis=require(_0x9f6a('0x0'));var db=require(_0x9f6a('0x1'))['db'];var logger=require(_0x9f6a('0x2'))(_0x9f6a('0x3'));var config=require(_0x9f6a('0x4'));config[_0x9f6a('0x5')]=_[_0x9f6a('0x6')](config[_0x9f6a('0x5')],{'host':_0x9f6a('0x7'),'port':0x18eb});var socket=require(_0x9f6a('0x8'))(new Redis(config[_0x9f6a('0x5')]));require(_0x9f6a('0x9'))[_0x9f6a('0xa')](socket);exports[_0x9f6a('0xb')]=function(_0x5d5dd5){var _0x3a2056=this;return new Promise(function(_0x20a7a5,_0xe9456f){return db['SquareProject'][_0x9f6a('0xc')]({'raw':_0x5d5dd5['options']?_0x5d5dd5['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d5dd5[_0x9f6a('0xd')]?_0x5d5dd5['options'][_0x9f6a('0xe')]||null:null,'attributes':_0x5d5dd5[_0x9f6a('0xd')]?_0x5d5dd5['options'][_0x9f6a('0xf')]||null:null,'limit':_0x5d5dd5['options']?_0x5d5dd5[_0x9f6a('0xd')][_0x9f6a('0x10')]||null:null,'include':_0x5d5dd5[_0x9f6a('0xd')]?_0x5d5dd5[_0x9f6a('0xd')][_0x9f6a('0x11')]?_[_0x9f6a('0x12')](_0x5d5dd5[_0x9f6a('0xd')][_0x9f6a('0x11')],function(_0x1bbd73){return{'model':db[_0x1bbd73[_0x9f6a('0x13')]],'as':_0x1bbd73['as'],'attributes':_0x1bbd73[_0x9f6a('0xf')],'include':_0x1bbd73['include']?_[_0x9f6a('0x12')](_0x1bbd73['include'],function(_0x4450ad){return{'model':db[_0x4450ad[_0x9f6a('0x13')]],'as':_0x4450ad['as'],'attributes':_0x4450ad[_0x9f6a('0xf')],'include':_0x4450ad[_0x9f6a('0x11')]?_[_0x9f6a('0x12')](_0x4450ad[_0x9f6a('0x11')],function(_0x4da4b8){return{'model':db[_0x4da4b8[_0x9f6a('0x13')]],'as':_0x4da4b8['as'],'attributes':_0x4da4b8[_0x9f6a('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9f6a('0x14')](function(_0x3d2fa0){logger[_0x9f6a('0x15')](_0x9f6a('0xb'),_0x5d5dd5);logger[_0x9f6a('0x16')](_0x9f6a('0xb'),_0x5d5dd5,JSON['stringify'](_0x3d2fa0));_0x20a7a5(_0x3d2fa0);})[_0x9f6a('0x17')](function(_0x285fc8){logger[_0x9f6a('0x18')]('GetSquareProjects',_0x285fc8[_0x9f6a('0x19')],_0x5d5dd5);_0xe9456f(_0x3a2056[_0x9f6a('0x18')](0x1f4,_0x285fc8[_0x9f6a('0x19')]));});});};exports[_0x9f6a('0x1a')]=function(_0x55930c){var _0x5d561c=this;return new Promise(function(_0x332436,_0x40823a){return db[_0x9f6a('0x1b')][_0x9f6a('0x1c')]({'raw':_0x55930c[_0x9f6a('0xd')]?_0x55930c[_0x9f6a('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x55930c[_0x9f6a('0xd')]?_0x55930c[_0x9f6a('0xd')][_0x9f6a('0xe')]||null:null,'attributes':_0x55930c[_0x9f6a('0xd')]?_0x55930c[_0x9f6a('0xd')]['attributes']||null:null,'include':_0x55930c[_0x9f6a('0xd')]?_0x55930c[_0x9f6a('0xd')][_0x9f6a('0x11')]?_[_0x9f6a('0x12')](_0x55930c['options'][_0x9f6a('0x11')],function(_0x329d94){return{'model':db[_0x329d94['model']],'as':_0x329d94['as'],'attributes':_0x329d94[_0x9f6a('0xf')],'include':_0x329d94[_0x9f6a('0x11')]?_[_0x9f6a('0x12')](_0x329d94[_0x9f6a('0x11')],function(_0x145e08){return{'model':db[_0x145e08[_0x9f6a('0x13')]],'as':_0x145e08['as'],'attributes':_0x145e08[_0x9f6a('0xf')],'include':_0x145e08[_0x9f6a('0x11')]?_[_0x9f6a('0x12')](_0x145e08[_0x9f6a('0x11')],function(_0xdf9f7d){return{'model':db[_0xdf9f7d[_0x9f6a('0x13')]],'as':_0xdf9f7d['as'],'attributes':_0xdf9f7d[_0x9f6a('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9f6a('0x14')](function(_0x394689){logger[_0x9f6a('0x15')](_0x9f6a('0x1a'),_0x55930c);logger[_0x9f6a('0x16')](_0x9f6a('0x1a'),_0x55930c,JSON[_0x9f6a('0x1d')](_0x394689));_0x332436(_0x394689);})[_0x9f6a('0x17')](function(_0x3cd87d){logger[_0x9f6a('0x18')]('ShowSquareProject',_0x3cd87d[_0x9f6a('0x19')],_0x55930c);_0x40823a(_0x5d561c[_0x9f6a('0x18')](0x1f4,_0x3cd87d[_0x9f6a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 64f7bdd..1d770df 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 _0x892f=['update','removeListener','squareProject:','./squareProject.events','save','remove'];(function(_0x5694cd,_0x2fefe4){var _0x5235d6=function(_0x4cd263){while(--_0x4cd263){_0x5694cd['push'](_0x5694cd['shift']());}};_0x5235d6(++_0x2fefe4);}(_0x892f,0x123));var _0xf892=function(_0x373e3c,_0xa87c9e){_0x373e3c=_0x373e3c-0x0;var _0x17ef08=_0x892f[_0x373e3c];return _0x17ef08;};'use strict';var SquareProjectEvents=require(_0xf892('0x0'));var events=[_0xf892('0x1'),_0xf892('0x2'),_0xf892('0x3')];function createListener(_0x394984,_0x436864){return function(_0x26b26c){_0x436864['emit'](_0x394984,_0x26b26c);};}function removeListener(_0xd471d2,_0xe4487e){return function(){SquareProjectEvents[_0xf892('0x4')](_0xd471d2,_0xe4487e);};}exports['register']=function(_0x2a7d62){for(var _0x402e2e=0x0,_0x381637=events['length'];_0x402e2e<_0x381637;_0x402e2e++){var _0x3822e1=events[_0x402e2e];var _0x34f879=createListener(_0xf892('0x5')+_0x3822e1,_0x2a7d62);SquareProjectEvents['on'](_0x3822e1,_0x34f879);}}; \ No newline at end of file +var _0x1af1=['update','emit','removeListener','register','length','squareProject:','save','remove'];(function(_0x21ed7f,_0x182260){var _0x543a09=function(_0x4498c7){while(--_0x4498c7){_0x21ed7f['push'](_0x21ed7f['shift']());}};_0x543a09(++_0x182260);}(_0x1af1,0x1c6));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x11af('0x0'),_0x11af('0x1'),_0x11af('0x2')];function createListener(_0x28f503,_0x22d52d){return function(_0xf41651){_0x22d52d[_0x11af('0x3')](_0x28f503,_0xf41651);};}function removeListener(_0x11e844,_0x2b3a20){return function(){SquareProjectEvents[_0x11af('0x4')](_0x11e844,_0x2b3a20);};}exports[_0x11af('0x5')]=function(_0x1596dc){for(var _0x27b256=0x0,_0x1fdcf6=events[_0x11af('0x6')];_0x27b256<_0x1fdcf6;_0x27b256++){var _0x5e7ebe=events[_0x27b256];var _0x111502=createListener(_0x11af('0x7')+_0x5e7ebe,_0x1596dc);SquareProjectEvents['on'](_0x5e7ebe,_0x111502);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 114cbe8..1cd94da 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3b224c,_0x4eaedb){var _0x4b21f3=function(_0xfc0413){while(--_0xfc0413){_0x3b224c['push'](_0x3b224c['shift']());}};_0x4b21f3(++_0x4eaedb);}(_0x4975,0x86));var _0x5497=function(_0x214346,_0x32b38a){_0x214346=_0x214346-0x0;var _0x373f68=_0x4975[_0x214346];return _0x373f68;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x169c01,_0x59f28d){var _0x2c3be4=function(_0x14032f){while(--_0x14032f){_0x169c01['push'](_0x169c01['shift']());}};_0x2c3be4(++_0x59f28d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x339936,_0x4cb8f4){_0x339936=_0x339936-0x0;var _0x407152=_0x1cb9[_0x339936];return _0x407152;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6982875..0e40234 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 _0x7bae=['savePath','substring','lastIndexOf','STRING','VIRTUAL','getDataValue'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7bae[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7ba('0x0')]},'callerid':{'type':Sequelize[_0xe7ba('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe7ba('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe7ba('0x0')]},'accountcode':{'type':Sequelize[_0xe7ba('0x0')]},'dnid':{'type':Sequelize[_0xe7ba('0x0')]},'projectName':{'type':Sequelize[_0xe7ba('0x0')]},'saveName':{'type':Sequelize[_0xe7ba('0x0')]},'filename':{'type':Sequelize[_0xe7ba('0x0')]},'savePath':{'type':Sequelize[_0xe7ba('0x0')]},'format':{'type':Sequelize[_0xe7ba('0x1')],'get':function(){var _0x10b307='';var _0x34fb18=this[_0xe7ba('0x2')](_0xe7ba('0x3'));if(_0x34fb18){_0x10b307=_0x34fb18[_0xe7ba('0x4')](_0x34fb18[_0xe7ba('0x5')]('.'));}return _0x10b307;}}}; \ No newline at end of file +var _0x2bd8=['STRING','VIRTUAL','getDataValue','substring','sequelize'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x2bd8,0x130));var _0x82bd=function(_0x10b527,_0x53c998){_0x10b527=_0x10b527-0x0;var _0x42b6dc=_0x2bd8[_0x10b527];return _0x42b6dc;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x82bd('0x1')]},'callerid':{'type':Sequelize[_0x82bd('0x1')]},'calleridname':{'type':Sequelize[_0x82bd('0x1')]},'context':{'type':Sequelize[_0x82bd('0x1')]},'extension':{'type':Sequelize[_0x82bd('0x1')]},'priority':{'type':Sequelize[_0x82bd('0x1')]},'accountcode':{'type':Sequelize[_0x82bd('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x82bd('0x1')]},'saveName':{'type':Sequelize[_0x82bd('0x1')]},'filename':{'type':Sequelize[_0x82bd('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x82bd('0x2')],'get':function(){var _0x77d7a9='';var _0x226f60=this[_0x82bd('0x3')]('savePath');if(_0x226f60){_0x77d7a9=_0x226f60[_0x82bd('0x4')](_0x226f60['lastIndexOf']('.'));}return _0x77d7a9;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index dfabc73..0d84fa6 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 _0xae05=['secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','end','sendStatus','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','body','params','download','../../components/encryptor','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','decryptFile'];(function(_0x46d1b5,_0x167007){var _0x5002cc=function(_0x473946){while(--_0x473946){_0x46d1b5['push'](_0x46d1b5['shift']());}};_0x5002cc(++_0x167007);}(_0xae05,0x1e9));var _0x5ae0=function(_0xa4f529,_0x36add4){_0xa4f529=_0xa4f529-0x0;var _0x3ce0df=_0xae05[_0xa4f529];return _0x3ce0df;};'use strict';var emlformat=require(_0x5ae0('0x0'));var rimraf=require(_0x5ae0('0x1'));var zipdir=require(_0x5ae0('0x2'));var jsonpatch=require(_0x5ae0('0x3'));var rp=require(_0x5ae0('0x4'));var moment=require('moment');var BPromise=require(_0x5ae0('0x5'));var Mustache=require('mustache');var util=require(_0x5ae0('0x6'));var path=require(_0x5ae0('0x7'));var sox=require(_0x5ae0('0x8'));var csv=require('to-csv');var ejs=require(_0x5ae0('0x9'));var fs=require('fs');var fs_extra=require(_0x5ae0('0xa'));var _=require('lodash');var squel=require(_0x5ae0('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ae0('0xc'));var deskjs=require(_0x5ae0('0xd'));var toCsv=require(_0x5ae0('0xe'));var querystring=require(_0x5ae0('0xf'));var Papa=require(_0x5ae0('0x10'));var Redis=require(_0x5ae0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ae0('0x12'));var logger=require(_0x5ae0('0x13'))('api');var utils=require(_0x5ae0('0x14'));var config=require(_0x5ae0('0x15'));var licenseUtil=require(_0x5ae0('0x16'));var db=require(_0x5ae0('0x17'))['db'];function respondWithStatusCode(_0x160e68,_0x4e07a5){_0x4e07a5=_0x4e07a5||0xcc;return function(_0x108a6a){if(_0x108a6a){return _0x160e68['sendStatus'](_0x4e07a5);}return _0x160e68[_0x5ae0('0x18')](_0x4e07a5)['end']();};}function respondWithResult(_0x3e62b9,_0x18d7a6){_0x18d7a6=_0x18d7a6||0xc8;return function(_0x57a9c0){if(_0x57a9c0){return _0x3e62b9[_0x5ae0('0x18')](_0x18d7a6)[_0x5ae0('0x19')](_0x57a9c0);}};}function respondWithFilteredResult(_0x5017d8,_0x53d238){return function(_0x6f13e3){if(_0x6f13e3){var _0x4e8585=typeof _0x53d238[_0x5ae0('0x1a')]===_0x5ae0('0x1b')&&typeof _0x53d238['limit']===_0x5ae0('0x1b');var _0x2539f8=_0x6f13e3[_0x5ae0('0x1c')];var _0x129e82=_0x4e8585?0x0:_0x53d238[_0x5ae0('0x1a')];var _0x54d477=_0x4e8585?_0x6f13e3[_0x5ae0('0x1c')]:_0x53d238[_0x5ae0('0x1a')]+_0x53d238['limit'];var _0x3fce03;if(_0x54d477>=_0x2539f8){_0x54d477=_0x2539f8;_0x3fce03=0xc8;}else{_0x3fce03=0xce;}_0x5017d8['status'](_0x3fce03);return _0x5017d8['set'](_0x5ae0('0x1d'),_0x129e82+'-'+_0x54d477+'/'+_0x2539f8)[_0x5ae0('0x19')](_0x6f13e3);}return null;};}function patchUpdates(_0x57ab38){return function(_0x3682f0){try{jsonpatch['apply'](_0x3682f0,_0x57ab38,!![]);}catch(_0xa444b0){return BPromise[_0x5ae0('0x1e')](_0xa444b0);}return _0x3682f0[_0x5ae0('0x1f')]();};}function saveUpdates(_0x20029a,_0x5369a5){return function(_0x28c2d6){if(_0x28c2d6){return _0x28c2d6[_0x5ae0('0x20')](_0x20029a)[_0x5ae0('0x21')](function(_0x18d34d){return _0x18d34d;});}return null;};}function removeEntity(_0x5ca299,_0xac89fb){return function(_0x4207f){if(_0x4207f){return _0x4207f[_0x5ae0('0x22')]()['then'](function(){_0x5ca299['status'](0xcc)[_0x5ae0('0x23')]();});}};}function handleEntityNotFound(_0x2ca02f,_0x1513ce){return function(_0x53e219){if(!_0x53e219){_0x2ca02f[_0x5ae0('0x24')](0x194);}return _0x53e219;};}function handleError(_0x56913e,_0x520644){_0x520644=_0x520644||0x1f4;return function(_0x1d3225){logger['error'](_0x1d3225['stack']);if(_0x1d3225[_0x5ae0('0x25')]){delete _0x1d3225['name'];}_0x56913e[_0x5ae0('0x18')](_0x520644)[_0x5ae0('0x26')](_0x1d3225);};}exports[_0x5ae0('0x27')]=function(_0x30076e,_0x38d7d1){var _0x351fd6={},_0x2eb3ee={},_0x4632e5={'count':0x0,'rows':[]};var _0x4070e3=_[_0x5ae0('0x28')](db[_0x5ae0('0x29')][_0x5ae0('0x2a')],function(_0x483f59){return{'name':_0x483f59[_0x5ae0('0x2b')],'type':_0x483f59[_0x5ae0('0x2c')][_0x5ae0('0x2d')]};});_0x2eb3ee[_0x5ae0('0x2e')]=_[_0x5ae0('0x28')](_0x4070e3,'name');_0x2eb3ee[_0x5ae0('0x2f')]=_[_0x5ae0('0x30')](_0x30076e['query']);_0x2eb3ee[_0x5ae0('0x31')]=_['intersection'](_0x2eb3ee[_0x5ae0('0x2e')],_0x2eb3ee[_0x5ae0('0x2f')]);_0x351fd6[_0x5ae0('0x32')]=_[_0x5ae0('0x33')](_0x2eb3ee[_0x5ae0('0x2e')],qs[_0x5ae0('0x34')](_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x34')]));_0x351fd6[_0x5ae0('0x32')]=_0x351fd6[_0x5ae0('0x32')][_0x5ae0('0x35')]?_0x351fd6['attributes']:_0x2eb3ee[_0x5ae0('0x2e')];if(!_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x36')](_0x5ae0('0x37'))){_0x351fd6[_0x5ae0('0x38')]=qs[_0x5ae0('0x38')](_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x38')]);_0x351fd6['offset']=qs[_0x5ae0('0x1a')](_0x30076e['query'][_0x5ae0('0x1a')]);}_0x351fd6[_0x5ae0('0x39')]=qs['sort'](_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x3a')]);_0x351fd6[_0x5ae0('0x3b')]=qs[_0x5ae0('0x31')](_['pick'](_0x30076e[_0x5ae0('0x2f')],_0x2eb3ee[_0x5ae0('0x31')]),_0x4070e3);if(_0x30076e['query'][_0x5ae0('0x3c')]){_0x351fd6[_0x5ae0('0x3b')]=_[_0x5ae0('0x3d')](_0x351fd6[_0x5ae0('0x3b')],{'$or':_[_0x5ae0('0x28')](_0x4070e3,function(_0x2b9781){if(_0x2b9781[_0x5ae0('0x2c')]!=='VIRTUAL'){var _0x56aca2={};_0x56aca2[_0x2b9781[_0x5ae0('0x25')]]={'$like':'%'+_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x3c')]+'%'};return _0x56aca2;}})});}_0x351fd6=_[_0x5ae0('0x3d')]({},_0x351fd6,_0x30076e[_0x5ae0('0x3e')]);var _0x5ab1c9={'where':_0x351fd6[_0x5ae0('0x3b')]};return db[_0x5ae0('0x29')][_0x5ae0('0x1c')](_0x5ab1c9)[_0x5ae0('0x21')](function(_0x2313cc){_0x4632e5['count']=_0x2313cc;if(_0x30076e['query'][_0x5ae0('0x3f')]){_0x351fd6[_0x5ae0('0x40')]=[{'all':!![]}];}return db[_0x5ae0('0x29')][_0x5ae0('0x41')](_0x351fd6);})[_0x5ae0('0x21')](function(_0x79c0d7){_0x4632e5[_0x5ae0('0x42')]=_0x79c0d7;return _0x4632e5;})[_0x5ae0('0x21')](respondWithFilteredResult(_0x38d7d1,_0x351fd6))[_0x5ae0('0x43')](handleError(_0x38d7d1,null));};exports[_0x5ae0('0x44')]=function(_0x543745,_0x24d877){var _0xdbc428={'raw':!![],'where':{'id':_0x543745['params']['id']}},_0x299a59={};_0x299a59['model']=_[_0x5ae0('0x30')](db[_0x5ae0('0x29')]['rawAttributes']);_0x299a59['query']=_[_0x5ae0('0x30')](_0x543745[_0x5ae0('0x2f')]);_0x299a59[_0x5ae0('0x31')]=_['intersection'](_0x299a59['model'],_0x299a59[_0x5ae0('0x2f')]);_0xdbc428[_0x5ae0('0x32')]=_[_0x5ae0('0x33')](_0x299a59['model'],qs[_0x5ae0('0x34')](_0x543745['query']['fields']));_0xdbc428[_0x5ae0('0x32')]=_0xdbc428[_0x5ae0('0x32')]['length']?_0xdbc428['attributes']:_0x299a59[_0x5ae0('0x2e')];if(_0x543745[_0x5ae0('0x2f')][_0x5ae0('0x3f')]){_0xdbc428['include']=[{'all':!![]}];}_0xdbc428=_[_0x5ae0('0x3d')]({},_0xdbc428,_0x543745[_0x5ae0('0x3e')]);return db[_0x5ae0('0x29')]['find'](_0xdbc428)['then'](handleEntityNotFound(_0x24d877,null))['then'](respondWithResult(_0x24d877,null))[_0x5ae0('0x43')](handleError(_0x24d877,null));};exports['create']=function(_0x3e9246,_0x19207d){return db[_0x5ae0('0x29')]['create'](_0x3e9246[_0x5ae0('0x45')],{})[_0x5ae0('0x21')](respondWithResult(_0x19207d,0xc9))[_0x5ae0('0x43')](handleError(_0x19207d,null));};exports['update']=function(_0x12eb9b,_0x232a0b){if(_0x12eb9b[_0x5ae0('0x45')]['id']){delete _0x12eb9b[_0x5ae0('0x45')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x12eb9b[_0x5ae0('0x46')]['id']}})[_0x5ae0('0x21')](handleEntityNotFound(_0x232a0b,null))[_0x5ae0('0x21')](saveUpdates(_0x12eb9b['body'],null))[_0x5ae0('0x21')](respondWithResult(_0x232a0b,null))[_0x5ae0('0x43')](handleError(_0x232a0b,null));};exports[_0x5ae0('0x47')]=function(_0xdfdacd,_0x402d5e,_0x409d0a){var _0x4c3ef2=require(_0x5ae0('0x48'));var _0x49a22e=![];var _0x37d71={};if(_0xdfdacd[_0x5ae0('0x2f')][_0x5ae0('0x2c')]&&_0xdfdacd['query'][_0x5ae0('0x2c')]===_0x5ae0('0x49')){_0x37d71[_0x5ae0('0x49')]=_0xdfdacd[_0x5ae0('0x46')]['id'];}else{_0x37d71['id']=_0xdfdacd[_0x5ae0('0x46')]['id'];}return db[_0x5ae0('0x29')][_0x5ae0('0x4a')]({'where':_0x37d71,'attributes':['id',_0x5ae0('0x4b'),_0x5ae0('0x4c')],'raw':!![]})[_0x5ae0('0x21')](handleEntityNotFound(_0x402d5e,null))[_0x5ae0('0x21')](function(_0x3f6129){if(_0x3f6129){var _0x164600=_0x3f6129[_0x5ae0('0x4b')];var _0x19fdde=util[_0x5ae0('0x4d')](_0x5ae0('0x4e'),_0x164600);if(fs[_0x5ae0('0x4f')](_0x19fdde)){_0x49a22e=!![];return _0x4c3ef2[_0x5ae0('0x50')](_0x19fdde,_0x164600,config[_0x5ae0('0x51')][_0x5ae0('0x52')])['then'](function(){return _0x3f6129;});}return _0x3f6129;}})[_0x5ae0('0x21')](function(_0x92e6ed){if(_0x92e6ed){var _0x113cf2=_0x92e6ed[_0x5ae0('0x4b')];if(!fs[_0x5ae0('0x4f')](_0x113cf2)){throw new db[(_0x5ae0('0x53'))]['ValidationError'](_0x5ae0('0x54'));}if(_0x92e6ed[_0x5ae0('0x4c')]){return _0x402d5e[_0x5ae0('0x47')](_0x113cf2,_0x92e6ed[_0x5ae0('0x4c')]+path['extname'](_0x113cf2),function(){if(_0x49a22e){fs[_0x5ae0('0x55')](_0x113cf2);}});}else{return _0x402d5e[_0x5ae0('0x47')](_0x113cf2,function(_0x361ac3){if(_0x49a22e){fs[_0x5ae0('0x55')](_0x113cf2);}});}}})['catch'](function(_0x588bab){if(_0x588bab[_0x5ae0('0x56')]===_0x5ae0('0x54')){_0x402d5e['status'](0x194)[_0x5ae0('0x26')](_0x5ae0('0x57'));}else{return handleError(_0x402d5e,null);}});};exports[_0x5ae0('0x22')]=function(_0x204385,_0x317414){return db['SquareRecording'][_0x5ae0('0x4a')]({'where':{'id':_0x204385[_0x5ae0('0x46')]['id']}})[_0x5ae0('0x21')](function(_0x2280d6){if(_['isNil'](_0x2280d6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2280d6;})[_0x5ae0('0x21')](function(_0x38d560){var _0x1d9773=_0x38d560[_0x5ae0('0x4b')];logger[_0x5ae0('0x58')](_0x5ae0('0x59'),_0x1d9773);if(!_['isNil'](_0x38d560[_0x5ae0('0x4b')])&&fs[_0x5ae0('0x4f')](_0x1d9773)){logger[_0x5ae0('0x58')](_0x5ae0('0x5a')+_0x1d9773+_0x5ae0('0x5b'));fs[_0x5ae0('0x5c')](_0x1d9773);}_0x1d9773=_0x1d9773+_0x5ae0('0x5d');if(!_[_0x5ae0('0x5e')](_0x38d560['savePath'])&&fs[_0x5ae0('0x4f')](_0x1d9773)){logger[_0x5ae0('0x58')](_0x5ae0('0x5a')+_0x1d9773+_0x5ae0('0x5b'));fs[_0x5ae0('0x5c')](_0x1d9773);}return _0x38d560;})[_0x5ae0('0x21')](function(_0x1a4588){if(!_0x1a4588)throw new InternalError();return _0x1a4588[_0x5ae0('0x22')]();})[_0x5ae0('0x21')](function(){_0x317414['status'](0xcc)[_0x5ae0('0x23')]();})[_0x5ae0('0x43')](handleError(_0x317414,null));}; \ No newline at end of file +var _0x4c04=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareRecording','includeAll','rows','catch','params','keys','rawAttributes','options','find','create','body','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x80b972,_0x42fab1){var _0x3174ee=function(_0x5120ba){while(--_0x5120ba){_0x80b972['push'](_0x80b972['shift']());}};_0x3174ee(++_0x42fab1);}(_0x4c04,0x10d));var _0x44c0=function(_0x36a63e,_0x37611f){_0x36a63e=_0x36a63e-0x0;var _0x167410=_0x4c04[_0x36a63e];return _0x167410;};'use strict';var emlformat=require(_0x44c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44c0('0x2'));var moment=require(_0x44c0('0x3'));var BPromise=require(_0x44c0('0x4'));var Mustache=require('mustache');var util=require(_0x44c0('0x5'));var path=require(_0x44c0('0x6'));var sox=require(_0x44c0('0x7'));var csv=require(_0x44c0('0x8'));var ejs=require(_0x44c0('0x9'));var fs=require('fs');var fs_extra=require(_0x44c0('0xa'));var _=require(_0x44c0('0xb'));var squel=require(_0x44c0('0xc'));var crypto=require(_0x44c0('0xd'));var jsforce=require(_0x44c0('0xe'));var deskjs=require(_0x44c0('0xf'));var toCsv=require(_0x44c0('0x8'));var querystring=require(_0x44c0('0x10'));var Papa=require('papaparse');var Redis=require(_0x44c0('0x11'));var authService=require(_0x44c0('0x12'));var qs=require(_0x44c0('0x13'));var as=require(_0x44c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x44c0('0x15'));var utils=require(_0x44c0('0x16'));var config=require(_0x44c0('0x17'));var licenseUtil=require(_0x44c0('0x18'));var db=require(_0x44c0('0x19'))['db'];function respondWithStatusCode(_0x24b7f1,_0x14d11e){_0x14d11e=_0x14d11e||0xcc;return function(_0x1b10f9){if(_0x1b10f9){return _0x24b7f1[_0x44c0('0x1a')](_0x14d11e);}return _0x24b7f1[_0x44c0('0x1b')](_0x14d11e)[_0x44c0('0x1c')]();};}function respondWithResult(_0x558496,_0x35eb11){_0x35eb11=_0x35eb11||0xc8;return function(_0xc0a7d6){if(_0xc0a7d6){return _0x558496[_0x44c0('0x1b')](_0x35eb11)[_0x44c0('0x1d')](_0xc0a7d6);}};}function respondWithFilteredResult(_0x171ce3,_0x5ce55c){return function(_0x25a6f3){if(_0x25a6f3){var _0x408288=typeof _0x5ce55c['offset']==='undefined'&&typeof _0x5ce55c[_0x44c0('0x1e')]===_0x44c0('0x1f');var _0x4bb135=_0x25a6f3[_0x44c0('0x20')];var _0x5d43ff=_0x408288?0x0:_0x5ce55c[_0x44c0('0x21')];var _0x4fe735=_0x408288?_0x25a6f3[_0x44c0('0x20')]:_0x5ce55c[_0x44c0('0x21')]+_0x5ce55c[_0x44c0('0x1e')];var _0x584a9f;if(_0x4fe735>=_0x4bb135){_0x4fe735=_0x4bb135;_0x584a9f=0xc8;}else{_0x584a9f=0xce;}_0x171ce3[_0x44c0('0x1b')](_0x584a9f);return _0x171ce3[_0x44c0('0x22')](_0x44c0('0x23'),_0x5d43ff+'-'+_0x4fe735+'/'+_0x4bb135)['json'](_0x25a6f3);}return null;};}function patchUpdates(_0x20405d){return function(_0x10e20a){try{jsonpatch['apply'](_0x10e20a,_0x20405d,!![]);}catch(_0x215b83){return BPromise[_0x44c0('0x24')](_0x215b83);}return _0x10e20a[_0x44c0('0x25')]();};}function saveUpdates(_0xcaee0c,_0x5b61ca){return function(_0x15e40c){if(_0x15e40c){return _0x15e40c[_0x44c0('0x26')](_0xcaee0c)[_0x44c0('0x27')](function(_0x3642f4){return _0x3642f4;});}return null;};}function removeEntity(_0x29d8e3,_0x35c62f){return function(_0x585102){if(_0x585102){return _0x585102[_0x44c0('0x28')]()[_0x44c0('0x27')](function(){_0x29d8e3['status'](0xcc)[_0x44c0('0x1c')]();});}};}function handleEntityNotFound(_0x16a391,_0x3b36a0){return function(_0x34bf3b){if(!_0x34bf3b){_0x16a391[_0x44c0('0x1a')](0x194);}return _0x34bf3b;};}function handleError(_0x28b52a,_0x5531a7){_0x5531a7=_0x5531a7||0x1f4;return function(_0x1948d9){logger['error'](_0x1948d9[_0x44c0('0x29')]);if(_0x1948d9[_0x44c0('0x2a')]){delete _0x1948d9['name'];}_0x28b52a[_0x44c0('0x1b')](_0x5531a7)['send'](_0x1948d9);};}exports[_0x44c0('0x2b')]=function(_0x407dc2,_0x5645df){var _0x2f562b={},_0x2dbabe={},_0x14149f={'count':0x0,'rows':[]};var _0x7df152=_['map'](db['SquareRecording']['rawAttributes'],function(_0x4dbe62){return{'name':_0x4dbe62[_0x44c0('0x2c')],'type':_0x4dbe62[_0x44c0('0x2d')]['key']};});_0x2dbabe[_0x44c0('0x2e')]=_[_0x44c0('0x2f')](_0x7df152,_0x44c0('0x2a'));_0x2dbabe[_0x44c0('0x30')]=_['keys'](_0x407dc2['query']);_0x2dbabe[_0x44c0('0x31')]=_[_0x44c0('0x32')](_0x2dbabe['model'],_0x2dbabe[_0x44c0('0x30')]);_0x2f562b[_0x44c0('0x33')]=_['intersection'](_0x2dbabe[_0x44c0('0x2e')],qs['fields'](_0x407dc2['query'][_0x44c0('0x34')]));_0x2f562b[_0x44c0('0x33')]=_0x2f562b[_0x44c0('0x33')][_0x44c0('0x35')]?_0x2f562b[_0x44c0('0x33')]:_0x2dbabe[_0x44c0('0x2e')];if(!_0x407dc2[_0x44c0('0x30')][_0x44c0('0x36')](_0x44c0('0x37'))){_0x2f562b[_0x44c0('0x1e')]=qs['limit'](_0x407dc2[_0x44c0('0x30')]['limit']);_0x2f562b[_0x44c0('0x21')]=qs['offset'](_0x407dc2[_0x44c0('0x30')]['offset']);}_0x2f562b[_0x44c0('0x38')]=qs[_0x44c0('0x39')](_0x407dc2[_0x44c0('0x30')]['sort']);_0x2f562b[_0x44c0('0x3a')]=qs[_0x44c0('0x31')](_[_0x44c0('0x3b')](_0x407dc2['query'],_0x2dbabe['filters']),_0x7df152);if(_0x407dc2[_0x44c0('0x30')][_0x44c0('0x3c')]){_0x2f562b[_0x44c0('0x3a')]=_[_0x44c0('0x3d')](_0x2f562b[_0x44c0('0x3a')],{'$or':_[_0x44c0('0x2f')](_0x7df152,function(_0x5e193b){if(_0x5e193b[_0x44c0('0x2d')]!==_0x44c0('0x3e')){var _0x41ae5d={};_0x41ae5d[_0x5e193b['name']]={'$like':'%'+_0x407dc2[_0x44c0('0x30')][_0x44c0('0x3c')]+'%'};return _0x41ae5d;}})});}_0x2f562b=_[_0x44c0('0x3d')]({},_0x2f562b,_0x407dc2['options']);var _0x3719cc={'where':_0x2f562b[_0x44c0('0x3a')]};return db[_0x44c0('0x3f')][_0x44c0('0x20')](_0x3719cc)[_0x44c0('0x27')](function(_0x590de4){_0x14149f[_0x44c0('0x20')]=_0x590de4;if(_0x407dc2['query'][_0x44c0('0x40')]){_0x2f562b['include']=[{'all':!![]}];}return db[_0x44c0('0x3f')]['findAll'](_0x2f562b);})[_0x44c0('0x27')](function(_0xc873e9){_0x14149f[_0x44c0('0x41')]=_0xc873e9;return _0x14149f;})['then'](respondWithFilteredResult(_0x5645df,_0x2f562b))[_0x44c0('0x42')](handleError(_0x5645df,null));};exports['show']=function(_0x3578c4,_0x192eb0){var _0x3fb5e5={'raw':!![],'where':{'id':_0x3578c4[_0x44c0('0x43')]['id']}},_0x1d9aa8={};_0x1d9aa8[_0x44c0('0x2e')]=_[_0x44c0('0x44')](db[_0x44c0('0x3f')][_0x44c0('0x45')]);_0x1d9aa8[_0x44c0('0x30')]=_['keys'](_0x3578c4[_0x44c0('0x30')]);_0x1d9aa8['filters']=_['intersection'](_0x1d9aa8[_0x44c0('0x2e')],_0x1d9aa8[_0x44c0('0x30')]);_0x3fb5e5[_0x44c0('0x33')]=_[_0x44c0('0x32')](_0x1d9aa8[_0x44c0('0x2e')],qs[_0x44c0('0x34')](_0x3578c4['query'][_0x44c0('0x34')]));_0x3fb5e5[_0x44c0('0x33')]=_0x3fb5e5[_0x44c0('0x33')][_0x44c0('0x35')]?_0x3fb5e5[_0x44c0('0x33')]:_0x1d9aa8['model'];if(_0x3578c4['query'][_0x44c0('0x40')]){_0x3fb5e5['include']=[{'all':!![]}];}_0x3fb5e5=_[_0x44c0('0x3d')]({},_0x3fb5e5,_0x3578c4[_0x44c0('0x46')]);return db['SquareRecording'][_0x44c0('0x47')](_0x3fb5e5)['then'](handleEntityNotFound(_0x192eb0,null))[_0x44c0('0x27')](respondWithResult(_0x192eb0,null))[_0x44c0('0x42')](handleError(_0x192eb0,null));};exports[_0x44c0('0x48')]=function(_0x4ccb1c,_0x5f47cf){return db['SquareRecording'][_0x44c0('0x48')](_0x4ccb1c[_0x44c0('0x49')],{})[_0x44c0('0x27')](respondWithResult(_0x5f47cf,0xc9))[_0x44c0('0x42')](handleError(_0x5f47cf,null));};exports['update']=function(_0x299f25,_0x10ae35){if(_0x299f25[_0x44c0('0x49')]['id']){delete _0x299f25[_0x44c0('0x49')]['id'];}return db[_0x44c0('0x3f')][_0x44c0('0x47')]({'where':{'id':_0x299f25[_0x44c0('0x43')]['id']}})[_0x44c0('0x27')](handleEntityNotFound(_0x10ae35,null))[_0x44c0('0x27')](saveUpdates(_0x299f25[_0x44c0('0x49')],null))[_0x44c0('0x27')](respondWithResult(_0x10ae35,null))[_0x44c0('0x42')](handleError(_0x10ae35,null));};exports['download']=function(_0x5b9c56,_0x140898,_0x29eefb){var _0x3eda87=require(_0x44c0('0x4a'));var _0x3fcba9=![];var _0x3a048d={};if(_0x5b9c56[_0x44c0('0x30')][_0x44c0('0x2d')]&&_0x5b9c56['query'][_0x44c0('0x2d')]===_0x44c0('0x4b')){_0x3a048d[_0x44c0('0x4b')]=_0x5b9c56['params']['id'];}else{_0x3a048d['id']=_0x5b9c56['params']['id'];}return db[_0x44c0('0x3f')]['find']({'where':_0x3a048d,'attributes':['id','savePath',_0x44c0('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x140898,null))['then'](function(_0x5a5a7e){if(_0x5a5a7e){var _0x15a20c=_0x5a5a7e[_0x44c0('0x4d')];var _0x457fa1=util[_0x44c0('0x4e')](_0x44c0('0x4f'),_0x15a20c);if(fs['existsSync'](_0x457fa1)){_0x3fcba9=!![];return _0x3eda87['decryptFile'](_0x457fa1,_0x15a20c,config[_0x44c0('0x50')]['recording'])[_0x44c0('0x27')](function(){return _0x5a5a7e;});}return _0x5a5a7e;}})[_0x44c0('0x27')](function(_0x2e985f){if(_0x2e985f){var _0x158673=_0x2e985f[_0x44c0('0x4d')];if(!fs[_0x44c0('0x51')](_0x158673)){throw new db[(_0x44c0('0x52'))][(_0x44c0('0x53'))](_0x44c0('0x54'));}if(_0x2e985f[_0x44c0('0x4c')]){return _0x140898[_0x44c0('0x55')](_0x158673,_0x2e985f[_0x44c0('0x4c')]+path[_0x44c0('0x56')](_0x158673),function(){if(_0x3fcba9){fs['unlink'](_0x158673);}});}else{return _0x140898[_0x44c0('0x55')](_0x158673,function(_0x11e35c){if(_0x3fcba9){fs[_0x44c0('0x57')](_0x158673);}});}}})[_0x44c0('0x42')](function(_0x4943f0){if(_0x4943f0[_0x44c0('0x58')]===_0x44c0('0x54')){_0x140898['status'](0x194)[_0x44c0('0x59')](_0x44c0('0x5a'));}else{return handleError(_0x140898,null);}});};exports[_0x44c0('0x28')]=function(_0x2af644,_0x4e80a1){return db[_0x44c0('0x3f')][_0x44c0('0x47')]({'where':{'id':_0x2af644[_0x44c0('0x43')]['id']}})[_0x44c0('0x27')](function(_0x2531ad){if(_[_0x44c0('0x5b')](_0x2531ad)){throw new ReferenceError(_0x44c0('0x5c'));}return _0x2531ad;})[_0x44c0('0x27')](function(_0x588565){var _0x4f686a=_0x588565[_0x44c0('0x4d')];logger[_0x44c0('0x5d')](_0x44c0('0x5e'),_0x4f686a);if(!_['isNil'](_0x588565[_0x44c0('0x4d')])&&fs[_0x44c0('0x51')](_0x4f686a)){logger[_0x44c0('0x5d')]('File:\x20\x22'+_0x4f686a+_0x44c0('0x5f'));fs['unlinkSync'](_0x4f686a);}_0x4f686a=_0x4f686a+'.cypher';if(!_[_0x44c0('0x5b')](_0x588565[_0x44c0('0x4d')])&&fs[_0x44c0('0x51')](_0x4f686a)){logger['info']('File:\x20\x22'+_0x4f686a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44c0('0x60')](_0x4f686a);}return _0x588565;})[_0x44c0('0x27')](function(_0x1a21c9){if(!_0x1a21c9)throw new InternalError();return _0x1a21c9['destroy']();})[_0x44c0('0x27')](function(){_0x4e80a1[_0x44c0('0x1b')](0xcc)[_0x44c0('0x1c')]();})[_0x44c0('0x42')](handleError(_0x4e80a1,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index db777a0..7b7d17b 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 _0x9512=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x4afc2c,_0x336a88){var _0x164084=function(_0x14b783){while(--_0x14b783){_0x4afc2c['push'](_0x4afc2c['shift']());}};_0x164084(++_0x336a88);}(_0x9512,0x75));var _0x2951=function(_0x44176c,_0x150427){_0x44176c=_0x44176c-0x0;var _0x15f4bb=_0x9512[_0x44176c];return _0x15f4bb;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var logger=require(_0x2951('0x2'))(_0x2951('0x3'));var moment=require(_0x2951('0x4'));var BPromise=require(_0x2951('0x5'));var rp=require(_0x2951('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2951('0x7'));var config=require(_0x2951('0x8'));var attributes=require(_0x2951('0x9'));module[_0x2951('0xa')]=function(_0x15d4fa,_0x293a9c){return _0x15d4fa[_0x2951('0xb')]('SquareRecording',attributes,{'tableName':_0x2951('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['api','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x503ea8,_0x22e391){var _0x427e5d=function(_0x1484e8){while(--_0x1484e8){_0x503ea8['push'](_0x503ea8['shift']());}};_0x427e5d(++_0x22e391);}(_0x2542,0x169));var _0x2254=function(_0x312626,_0x22b9b1){_0x312626=_0x312626-0x0;var _0x1ecf54=_0x2542[_0x312626];return _0x1ecf54;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 61d8ca8..c731f66 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 _0xa3f1=['rpc','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a0693,_0x5e80b8){var _0x5daa64=function(_0x36f24f){while(--_0x36f24f){_0x5a0693['push'](_0x5a0693['shift']());}};_0x5daa64(++_0x5e80b8);}(_0xa3f1,0x111));var _0x1a3f=function(_0x2bbfcd,_0x5c117b){_0x2bbfcd=_0x2bbfcd-0x0;var _0x5a3f66=_0xa3f1[_0x2bbfcd];return _0x5a3f66;};'use strict';var _=require(_0x1a3f('0x0'));var util=require(_0x1a3f('0x1'));var moment=require('moment');var BPromise=require(_0x1a3f('0x2'));var rs=require(_0x1a3f('0x3'));var fs=require('fs');var Redis=require(_0x1a3f('0x4'));var db=require(_0x1a3f('0x5'))['db'];var utils=require(_0x1a3f('0x6'));var logger=require('../../config/logger')(_0x1a3f('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a3f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x405293,_0x1adb72,_0x518cc7){return new BPromise(function(_0x451723,_0x295bda){return client[_0x1a3f('0x9')](_0x405293,_0x518cc7)[_0x1a3f('0xa')](function(_0x3573e9){logger[_0x1a3f('0xb')](_0x1a3f('0xc'),_0x1adb72,_0x1a3f('0xd'));logger[_0x1a3f('0xe')](_0x1a3f('0xf'),_0x1adb72,_0x1a3f('0xd'),JSON[_0x1a3f('0x10')](_0x3573e9));if(_0x3573e9['error']){if(_0x3573e9['error'][_0x1a3f('0x11')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x1adb72,_0x3573e9[_0x1a3f('0x12')][_0x1a3f('0x13')]);return _0x295bda(_0x3573e9[_0x1a3f('0x12')][_0x1a3f('0x13')]);}logger[_0x1a3f('0x12')](_0x1a3f('0xc'),_0x1adb72,_0x3573e9['error'][_0x1a3f('0x13')]);return _0x451723(_0x3573e9['error'][_0x1a3f('0x13')]);}else{logger[_0x1a3f('0xb')](_0x1a3f('0xc'),_0x1adb72,'request\x20sent');_0x451723(_0x3573e9[_0x1a3f('0x14')][_0x1a3f('0x13')]);}})[_0x1a3f('0x15')](function(_0x19f6eb){logger[_0x1a3f('0x12')](_0x1a3f('0xc'),_0x1adb72,_0x19f6eb);_0x295bda(_0x19f6eb);});});}exports['CreateSquareRecording']=function(_0xe32e39){var _0x1a4f5f=this;return new Promise(function(_0x3b5595,_0x2cfcb5){return db[_0x1a3f('0x16')][_0x1a3f('0x17')](_0xe32e39[_0x1a3f('0x18')],{'raw':_0xe32e39['options']?_0xe32e39[_0x1a3f('0x19')][_0x1a3f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x52200b){logger[_0x1a3f('0xb')](_0x1a3f('0x1b'),_0xe32e39);logger[_0x1a3f('0xe')]('CreateSquareRecording',_0xe32e39,JSON[_0x1a3f('0x10')](_0x52200b));_0x3b5595(_0x52200b);})[_0x1a3f('0x15')](function(_0x3a2ab1){logger['error']('CreateSquareRecording',_0x3a2ab1[_0x1a3f('0x13')],_0xe32e39);_0x2cfcb5(_0x1a4f5f[_0x1a3f('0x12')](0x1f4,_0x3a2ab1[_0x1a3f('0x13')]));});});}; \ No newline at end of file +var _0x55ea=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateSquareRecording','SquareRecording','body','options','stringify','moment','bluebird'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x55ea,0xae));var _0xa55e=function(_0x2b577e,_0x3f87e9){_0x2b577e=_0x2b577e-0x0;var _0x368aea=_0x55ea[_0x2b577e];return _0x368aea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa55e('0x0'));var BPromise=require(_0xa55e('0x1'));var rs=require(_0xa55e('0x2'));var fs=require('fs');var Redis=require(_0xa55e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa55e('0x4'));var logger=require(_0xa55e('0x5'))('rpc');var config=require(_0xa55e('0x6'));var jayson=require(_0xa55e('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42a02f,_0x458c42,_0x2909d5){return new BPromise(function(_0x1cffbd,_0x37962b){return client[_0xa55e('0x8')](_0x42a02f,_0x2909d5)['then'](function(_0x1125d6){logger[_0xa55e('0x9')](_0xa55e('0xa'),_0x458c42,_0xa55e('0xb'));logger[_0xa55e('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x458c42,'request\x20sent',JSON['stringify'](_0x1125d6));if(_0x1125d6[_0xa55e('0xd')]){if(_0x1125d6['error']['code']===0x1f4){logger[_0xa55e('0xd')](_0xa55e('0xa'),_0x458c42,_0x1125d6[_0xa55e('0xd')][_0xa55e('0xe')]);return _0x37962b(_0x1125d6[_0xa55e('0xd')][_0xa55e('0xe')]);}logger[_0xa55e('0xd')](_0xa55e('0xa'),_0x458c42,_0x1125d6[_0xa55e('0xd')][_0xa55e('0xe')]);return _0x1cffbd(_0x1125d6['error']['message']);}else{logger['info'](_0xa55e('0xa'),_0x458c42,_0xa55e('0xb'));_0x1cffbd(_0x1125d6[_0xa55e('0xf')][_0xa55e('0xe')]);}})[_0xa55e('0x10')](function(_0x57ae6b){logger['error'](_0xa55e('0xa'),_0x458c42,_0x57ae6b);_0x37962b(_0x57ae6b);});});}exports[_0xa55e('0x11')]=function(_0x591df5){var _0x5a519f=this;return new Promise(function(_0x17e0cb,_0x582f29){return db[_0xa55e('0x12')]['create'](_0x591df5[_0xa55e('0x13')],{'raw':_0x591df5[_0xa55e('0x14')]?_0x591df5['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c42c3){logger[_0xa55e('0x9')](_0xa55e('0x11'),_0x591df5);logger[_0xa55e('0xc')](_0xa55e('0x11'),_0x591df5,JSON[_0xa55e('0x15')](_0x4c42c3));_0x17e0cb(_0x4c42c3);})['catch'](function(_0xab941c){logger[_0xa55e('0xd')](_0xa55e('0x11'),_0xab941c[_0xa55e('0xe')],_0x591df5);_0x582f29(_0x5a519f[_0xa55e('0xd')](0x1f4,_0xab941c[_0xa55e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9fdc6d2..7cad696 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4c7d93,_0x346501){var _0x5298c7=function(_0x592460){while(--_0x592460){_0x4c7d93['push'](_0x4c7d93['shift']());}};_0x5298c7(++_0x346501);}(_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'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2d57a9,_0x5ae060){var _0x1b9671=function(_0x95fb4e){while(--_0x95fb4e){_0x2d57a9['push'](_0x2d57a9['shift']());}};_0x1b9671(++_0x5ae060);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 937ae6a..be58b5c 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 _0x652d=['STRING','DATE','exports'];(function(_0xa52e8e,_0x1cdcdf){var _0x498424=function(_0x3a8c81){while(--_0x3a8c81){_0xa52e8e['push'](_0xa52e8e['shift']());}};_0x498424(++_0x1cdcdf);}(_0x652d,0x1a0));var _0xd652=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x652d[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xd652('0x0')]={'network':{'type':Sequelize[_0xd652('0x1')]},'network_script':{'type':Sequelize[_0xd652('0x1')]},'request':{'type':Sequelize[_0xd652('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd652('0x1')]},'version':{'type':Sequelize[_0xd652('0x1')]},'callerid':{'type':Sequelize[_0xd652('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd652('0x1')]},'callingani2':{'type':Sequelize[_0xd652('0x1')]},'callington':{'type':Sequelize[_0xd652('0x1')]},'callingtns':{'type':Sequelize[_0xd652('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xd652('0x1')]},'context':{'type':Sequelize[_0xd652('0x1')]},'extension':{'type':Sequelize[_0xd652('0x1')]},'priority':{'type':Sequelize[_0xd652('0x1')]},'enhanced':{'type':Sequelize[_0xd652('0x1')]},'accountcode':{'type':Sequelize[_0xd652('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd652('0x2')]},'leaveAt':{'type':Sequelize[_0xd652('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3294=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x3294,0x131));var _0x4329=function(_0x562aea,_0xb4a3e0){_0x562aea=_0x562aea-0x0;var _0x12e09f=_0x3294[_0x562aea];return _0x12e09f;};'use strict';var Sequelize=require(_0x4329('0x0'));module[_0x4329('0x1')]={'network':{'type':Sequelize[_0x4329('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4329('0x2')]},'channel':{'type':Sequelize[_0x4329('0x2')]},'language':{'type':Sequelize[_0x4329('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4329('0x2')]},'version':{'type':Sequelize[_0x4329('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4329('0x2')]},'callingpres':{'type':Sequelize[_0x4329('0x2')]},'callingani2':{'type':Sequelize[_0x4329('0x2')]},'callington':{'type':Sequelize[_0x4329('0x2')]},'callingtns':{'type':Sequelize[_0x4329('0x2')]},'dnid':{'type':Sequelize[_0x4329('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4329('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4329('0x2')]},'threadid':{'type':Sequelize[_0x4329('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4329('0x3')]},'leaveAt':{'type':Sequelize[_0x4329('0x3')]},'bot':{'type':Sequelize[_0x4329('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 e7b0e60..8394544 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 _0x3c4b=['where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','SquareReport','rawAttributes','type','map','name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x3c4b,0xa0));var _0xb3c4=function(_0x297c6a,_0x1fca7a){_0x297c6a=_0x297c6a-0x0;var _0x4820ff=_0x3c4b[_0x297c6a];return _0x4820ff;};'use strict';var emlformat=require(_0xb3c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3c4('0x1'));var jsonpatch=require(_0xb3c4('0x2'));var rp=require(_0xb3c4('0x3'));var moment=require(_0xb3c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb3c4('0x5'));var util=require(_0xb3c4('0x6'));var path=require(_0xb3c4('0x7'));var sox=require(_0xb3c4('0x8'));var csv=require(_0xb3c4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb3c4('0xa'));var crypto=require(_0xb3c4('0xb'));var jsforce=require(_0xb3c4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3c4('0xd'));var Papa=require(_0xb3c4('0xe'));var Redis=require(_0xb3c4('0xf'));var authService=require(_0xb3c4('0x10'));var qs=require(_0xb3c4('0x11'));var as=require(_0xb3c4('0x12'));var hardwareService=require(_0xb3c4('0x13'));var logger=require('../../config/logger')(_0xb3c4('0x14'));var utils=require(_0xb3c4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d64ca,_0x26d381){_0x26d381=_0x26d381||0xcc;return function(_0x5e64c1){if(_0x5e64c1){return _0x3d64ca[_0xb3c4('0x16')](_0x26d381);}return _0x3d64ca[_0xb3c4('0x17')](_0x26d381)[_0xb3c4('0x18')]();};}function respondWithResult(_0x269b13,_0x25781f){_0x25781f=_0x25781f||0xc8;return function(_0x2b3e52){if(_0x2b3e52){return _0x269b13[_0xb3c4('0x17')](_0x25781f)[_0xb3c4('0x19')](_0x2b3e52);}};}function respondWithFilteredResult(_0x1c6158,_0x27b1de){return function(_0x4ebcfa){if(_0x4ebcfa){var _0x42e8fe=typeof _0x27b1de[_0xb3c4('0x1a')]==='undefined'&&typeof _0x27b1de[_0xb3c4('0x1b')]===_0xb3c4('0x1c');var _0x5aacad=_0x4ebcfa[_0xb3c4('0x1d')];var _0x596c6e=_0x42e8fe?0x0:_0x27b1de['offset'];var _0x17384c=_0x42e8fe?_0x4ebcfa[_0xb3c4('0x1d')]:_0x27b1de['offset']+_0x27b1de['limit'];var _0x171614;if(_0x17384c>=_0x5aacad){_0x17384c=_0x5aacad;_0x171614=0xc8;}else{_0x171614=0xce;}_0x1c6158[_0xb3c4('0x17')](_0x171614);return _0x1c6158[_0xb3c4('0x1e')](_0xb3c4('0x1f'),_0x596c6e+'-'+_0x17384c+'/'+_0x5aacad)['json'](_0x4ebcfa);}return null;};}function patchUpdates(_0x4f2a97){return function(_0x1cb94b){try{jsonpatch['apply'](_0x1cb94b,_0x4f2a97,!![]);}catch(_0x16dcb5){return BPromise[_0xb3c4('0x20')](_0x16dcb5);}return _0x1cb94b[_0xb3c4('0x21')]();};}function saveUpdates(_0x16d22f,_0x4151b7){return function(_0x53a5c8){if(_0x53a5c8){return _0x53a5c8[_0xb3c4('0x22')](_0x16d22f)[_0xb3c4('0x23')](function(_0x4ea8ad){return _0x4ea8ad;});}return null;};}function removeEntity(_0x519b2f,_0x44c7a3){return function(_0x2a979b){if(_0x2a979b){return _0x2a979b[_0xb3c4('0x24')]()[_0xb3c4('0x23')](function(){_0x519b2f[_0xb3c4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4684c7,_0x1a23cb){return function(_0x59b972){if(!_0x59b972){_0x4684c7['sendStatus'](0x194);}return _0x59b972;};}function handleError(_0x1f15ea,_0x4bf87c){_0x4bf87c=_0x4bf87c||0x1f4;return function(_0x4bb87b){logger[_0xb3c4('0x25')](_0x4bb87b[_0xb3c4('0x26')]);if(_0x4bb87b['name']){delete _0x4bb87b['name'];}_0x1f15ea[_0xb3c4('0x17')](_0x4bf87c)[_0xb3c4('0x27')](_0x4bb87b);};}exports['index']=function(_0x418478,_0x11e724){var _0x255e66={},_0x36c446={},_0x3ee0a6={'count':0x0,'rows':[]};var _0x109435=_['map'](db[_0xb3c4('0x28')][_0xb3c4('0x29')],function(_0x107cc9){return{'name':_0x107cc9['fieldName'],'type':_0x107cc9[_0xb3c4('0x2a')]['key']};});_0x36c446['model']=_[_0xb3c4('0x2b')](_0x109435,_0xb3c4('0x2c'));_0x36c446[_0xb3c4('0x2d')]=_[_0xb3c4('0x2e')](_0x418478[_0xb3c4('0x2d')]);_0x36c446[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x36c446[_0xb3c4('0x31')],_0x36c446[_0xb3c4('0x2d')]);_0x255e66['attributes']=_['intersection'](_0x36c446[_0xb3c4('0x31')],qs['fields'](_0x418478[_0xb3c4('0x2d')]['fields']));_0x255e66[_0xb3c4('0x32')]=_0x255e66[_0xb3c4('0x32')][_0xb3c4('0x33')]?_0x255e66['attributes']:_0x36c446['model'];if(!_0x418478['query'][_0xb3c4('0x34')](_0xb3c4('0x35'))){_0x255e66[_0xb3c4('0x1b')]=qs[_0xb3c4('0x1b')](_0x418478['query'][_0xb3c4('0x1b')]);_0x255e66[_0xb3c4('0x1a')]=qs[_0xb3c4('0x1a')](_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x1a')]);}_0x255e66[_0xb3c4('0x36')]=qs[_0xb3c4('0x37')](_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x37')]);_0x255e66[_0xb3c4('0x38')]=qs[_0xb3c4('0x2f')](_['pick'](_0x418478[_0xb3c4('0x2d')],_0x36c446[_0xb3c4('0x2f')]),_0x109435);if(_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x39')]){_0x255e66[_0xb3c4('0x38')]=_[_0xb3c4('0x3a')](_0x255e66['where'],{'$or':_[_0xb3c4('0x2b')](_0x109435,function(_0x14d09f){if(_0x14d09f[_0xb3c4('0x2a')]!==_0xb3c4('0x3b')){var _0x294f23={};_0x294f23[_0x14d09f[_0xb3c4('0x2c')]]={'$like':'%'+_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x39')]+'%'};return _0x294f23;}})});}_0x255e66=_[_0xb3c4('0x3a')]({},_0x255e66,_0x418478[_0xb3c4('0x3c')]);var _0x248371={'where':_0x255e66['where']};return db[_0xb3c4('0x28')][_0xb3c4('0x1d')](_0x248371)['then'](function(_0x3786d7){_0x3ee0a6[_0xb3c4('0x1d')]=_0x3786d7;if(_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x3d')]){_0x255e66[_0xb3c4('0x3e')]=[{'all':!![]}];}return db[_0xb3c4('0x28')][_0xb3c4('0x3f')](_0x255e66);})[_0xb3c4('0x23')](function(_0x50d50b){_0x3ee0a6[_0xb3c4('0x40')]=_0x50d50b;return _0x3ee0a6;})[_0xb3c4('0x23')](respondWithFilteredResult(_0x11e724,_0x255e66))[_0xb3c4('0x41')](handleError(_0x11e724,null));};exports['show']=function(_0xf0a98a,_0x121720){var _0xac5448={'raw':!![],'where':{'id':_0xf0a98a['params']['id']}},_0x1c96e3={};_0x1c96e3[_0xb3c4('0x31')]=_[_0xb3c4('0x2e')](db['SquareReport']['rawAttributes']);_0x1c96e3['query']=_[_0xb3c4('0x2e')](_0xf0a98a[_0xb3c4('0x2d')]);_0x1c96e3[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x1c96e3['model'],_0x1c96e3['query']);_0xac5448['attributes']=_[_0xb3c4('0x30')](_0x1c96e3['model'],qs[_0xb3c4('0x42')](_0xf0a98a[_0xb3c4('0x2d')][_0xb3c4('0x42')]));_0xac5448['attributes']=_0xac5448[_0xb3c4('0x32')]['length']?_0xac5448[_0xb3c4('0x32')]:_0x1c96e3[_0xb3c4('0x31')];if(_0xf0a98a[_0xb3c4('0x2d')][_0xb3c4('0x3d')]){_0xac5448['include']=[{'all':!![]}];}_0xac5448=_[_0xb3c4('0x3a')]({},_0xac5448,_0xf0a98a[_0xb3c4('0x3c')]);return db[_0xb3c4('0x28')][_0xb3c4('0x43')](_0xac5448)[_0xb3c4('0x23')](handleEntityNotFound(_0x121720,null))['then'](respondWithResult(_0x121720,null))[_0xb3c4('0x41')](handleError(_0x121720,null));};exports[_0xb3c4('0x44')]=function(_0xf4d961,_0x204a8b){return db[_0xb3c4('0x28')]['create'](_0xf4d961[_0xb3c4('0x45')],{})[_0xb3c4('0x23')](respondWithResult(_0x204a8b,0xc9))['catch'](handleError(_0x204a8b,null));};exports[_0xb3c4('0x22')]=function(_0x27f64f,_0x526def){if(_0x27f64f['body']['id']){delete _0x27f64f[_0xb3c4('0x45')]['id'];}return db[_0xb3c4('0x28')]['find']({'where':{'id':_0x27f64f[_0xb3c4('0x46')]['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x526def,null))['then'](saveUpdates(_0x27f64f[_0xb3c4('0x45')],null))[_0xb3c4('0x23')](respondWithResult(_0x526def,null))[_0xb3c4('0x41')](handleError(_0x526def,null));};exports['destroy']=function(_0x24411e,_0x4f818f){return db[_0xb3c4('0x28')]['find']({'where':{'id':_0x24411e[_0xb3c4('0x46')]['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x4f818f,null))[_0xb3c4('0x23')](removeEntity(_0x4f818f,null))[_0xb3c4('0x41')](handleError(_0x4f818f,null));};exports[_0xb3c4('0x47')]=function(_0x3a2b89,_0x4125d6){return db[_0xb3c4('0x28')]['describe']()[_0xb3c4('0x23')](respondWithResult(_0x4125d6,null))['catch'](handleError(_0x4125d6,null));}; \ No newline at end of file +var _0x2ee0=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','SquareReport','includeAll','include','findAll','rows','params','options','catch','create','body','update','find','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0x2ee0,0x125));var _0x02ee=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x2ee0[_0x502953];return _0x2fa32d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02ee('0x0'));var zipdir=require(_0x02ee('0x1'));var jsonpatch=require(_0x02ee('0x2'));var rp=require('request-promise');var moment=require(_0x02ee('0x3'));var BPromise=require(_0x02ee('0x4'));var Mustache=require(_0x02ee('0x5'));var util=require(_0x02ee('0x6'));var path=require(_0x02ee('0x7'));var sox=require(_0x02ee('0x8'));var csv=require('to-csv');var ejs=require(_0x02ee('0x9'));var fs=require('fs');var fs_extra=require(_0x02ee('0xa'));var _=require('lodash');var squel=require(_0x02ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x02ee('0xc'));var deskjs=require(_0x02ee('0xd'));var toCsv=require(_0x02ee('0xe'));var querystring=require(_0x02ee('0xf'));var Papa=require(_0x02ee('0x10'));var Redis=require(_0x02ee('0x11'));var authService=require(_0x02ee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x02ee('0x13'));var hardwareService=require(_0x02ee('0x14'));var logger=require('../../config/logger')(_0x02ee('0x15'));var utils=require(_0x02ee('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x02ee('0x17'));var db=require(_0x02ee('0x18'))['db'];function respondWithStatusCode(_0x2d4406,_0xd1db){_0xd1db=_0xd1db||0xcc;return function(_0xd3e11e){if(_0xd3e11e){return _0x2d4406['sendStatus'](_0xd1db);}return _0x2d4406[_0x02ee('0x19')](_0xd1db)[_0x02ee('0x1a')]();};}function respondWithResult(_0x5e2e37,_0x46f2e5){_0x46f2e5=_0x46f2e5||0xc8;return function(_0x5d696b){if(_0x5d696b){return _0x5e2e37['status'](_0x46f2e5)['json'](_0x5d696b);}};}function respondWithFilteredResult(_0x86224a,_0x43d073){return function(_0x5958c4){if(_0x5958c4){var _0x3fc418=typeof _0x43d073['offset']===_0x02ee('0x1b')&&typeof _0x43d073[_0x02ee('0x1c')]==='undefined';var _0x37af0f=_0x5958c4[_0x02ee('0x1d')];var _0xc6bc5d=_0x3fc418?0x0:_0x43d073[_0x02ee('0x1e')];var _0x3670cd=_0x3fc418?_0x5958c4[_0x02ee('0x1d')]:_0x43d073[_0x02ee('0x1e')]+_0x43d073[_0x02ee('0x1c')];var _0xf06f23;if(_0x3670cd>=_0x37af0f){_0x3670cd=_0x37af0f;_0xf06f23=0xc8;}else{_0xf06f23=0xce;}_0x86224a[_0x02ee('0x19')](_0xf06f23);return _0x86224a['set'](_0x02ee('0x1f'),_0xc6bc5d+'-'+_0x3670cd+'/'+_0x37af0f)['json'](_0x5958c4);}return null;};}function patchUpdates(_0x5205f1){return function(_0x2afd94){try{jsonpatch['apply'](_0x2afd94,_0x5205f1,!![]);}catch(_0x482ed7){return BPromise[_0x02ee('0x20')](_0x482ed7);}return _0x2afd94[_0x02ee('0x21')]();};}function saveUpdates(_0x260ed2,_0x3d88e7){return function(_0x4bb595){if(_0x4bb595){return _0x4bb595['update'](_0x260ed2)[_0x02ee('0x22')](function(_0x57ae44){return _0x57ae44;});}return null;};}function removeEntity(_0x2a713b,_0x28f3c6){return function(_0x564eb6){if(_0x564eb6){return _0x564eb6[_0x02ee('0x23')]()[_0x02ee('0x22')](function(){_0x2a713b[_0x02ee('0x19')](0xcc)[_0x02ee('0x1a')]();});}};}function handleEntityNotFound(_0x10bc41,_0x1cd919){return function(_0x5882db){if(!_0x5882db){_0x10bc41[_0x02ee('0x24')](0x194);}return _0x5882db;};}function handleError(_0x194f83,_0x59b9b6){_0x59b9b6=_0x59b9b6||0x1f4;return function(_0x59759b){logger[_0x02ee('0x25')](_0x59759b[_0x02ee('0x26')]);if(_0x59759b[_0x02ee('0x27')]){delete _0x59759b[_0x02ee('0x27')];}_0x194f83['status'](_0x59b9b6)[_0x02ee('0x28')](_0x59759b);};}exports[_0x02ee('0x29')]=function(_0x109f49,_0x443c4c){var _0x18940a={},_0x9dd631={},_0x3b4e20={'count':0x0,'rows':[]};var _0xc6ea71=_[_0x02ee('0x2a')](db['SquareReport'][_0x02ee('0x2b')],function(_0x1b80c2){return{'name':_0x1b80c2[_0x02ee('0x2c')],'type':_0x1b80c2['type']['key']};});_0x9dd631[_0x02ee('0x2d')]=_[_0x02ee('0x2a')](_0xc6ea71,_0x02ee('0x27'));_0x9dd631[_0x02ee('0x2e')]=_[_0x02ee('0x2f')](_0x109f49[_0x02ee('0x2e')]);_0x9dd631[_0x02ee('0x30')]=_[_0x02ee('0x31')](_0x9dd631[_0x02ee('0x2d')],_0x9dd631[_0x02ee('0x2e')]);_0x18940a[_0x02ee('0x32')]=_[_0x02ee('0x31')](_0x9dd631['model'],qs[_0x02ee('0x33')](_0x109f49[_0x02ee('0x2e')]['fields']));_0x18940a[_0x02ee('0x32')]=_0x18940a[_0x02ee('0x32')][_0x02ee('0x34')]?_0x18940a['attributes']:_0x9dd631[_0x02ee('0x2d')];if(!_0x109f49[_0x02ee('0x2e')]['hasOwnProperty'](_0x02ee('0x35'))){_0x18940a[_0x02ee('0x1c')]=qs['limit'](_0x109f49[_0x02ee('0x2e')][_0x02ee('0x1c')]);_0x18940a[_0x02ee('0x1e')]=qs['offset'](_0x109f49['query']['offset']);}_0x18940a['order']=qs['sort'](_0x109f49[_0x02ee('0x2e')][_0x02ee('0x36')]);_0x18940a[_0x02ee('0x37')]=qs[_0x02ee('0x30')](_[_0x02ee('0x38')](_0x109f49[_0x02ee('0x2e')],_0x9dd631[_0x02ee('0x30')]),_0xc6ea71);if(_0x109f49['query'][_0x02ee('0x39')]){_0x18940a[_0x02ee('0x37')]=_[_0x02ee('0x3a')](_0x18940a[_0x02ee('0x37')],{'$or':_['map'](_0xc6ea71,function(_0x2050f5){if(_0x2050f5[_0x02ee('0x3b')]!==_0x02ee('0x3c')){var _0x5a8811={};_0x5a8811[_0x2050f5['name']]={'$like':'%'+_0x109f49['query'][_0x02ee('0x39')]+'%'};return _0x5a8811;}})});}_0x18940a=_[_0x02ee('0x3a')]({},_0x18940a,_0x109f49['options']);var _0x159436={'where':_0x18940a[_0x02ee('0x37')]};return db[_0x02ee('0x3d')][_0x02ee('0x1d')](_0x159436)['then'](function(_0x109431){_0x3b4e20[_0x02ee('0x1d')]=_0x109431;if(_0x109f49[_0x02ee('0x2e')][_0x02ee('0x3e')]){_0x18940a[_0x02ee('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x02ee('0x40')](_0x18940a);})[_0x02ee('0x22')](function(_0x340fa5){_0x3b4e20[_0x02ee('0x41')]=_0x340fa5;return _0x3b4e20;})[_0x02ee('0x22')](respondWithFilteredResult(_0x443c4c,_0x18940a))['catch'](handleError(_0x443c4c,null));};exports['show']=function(_0x1ec63b,_0x3197e5){var _0x1ec17b={'raw':!![],'where':{'id':_0x1ec63b[_0x02ee('0x42')]['id']}},_0x5547c2={};_0x5547c2[_0x02ee('0x2d')]=_[_0x02ee('0x2f')](db[_0x02ee('0x3d')][_0x02ee('0x2b')]);_0x5547c2[_0x02ee('0x2e')]=_[_0x02ee('0x2f')](_0x1ec63b[_0x02ee('0x2e')]);_0x5547c2[_0x02ee('0x30')]=_[_0x02ee('0x31')](_0x5547c2['model'],_0x5547c2['query']);_0x1ec17b['attributes']=_['intersection'](_0x5547c2['model'],qs[_0x02ee('0x33')](_0x1ec63b[_0x02ee('0x2e')]['fields']));_0x1ec17b[_0x02ee('0x32')]=_0x1ec17b[_0x02ee('0x32')][_0x02ee('0x34')]?_0x1ec17b['attributes']:_0x5547c2['model'];if(_0x1ec63b['query']['includeAll']){_0x1ec17b[_0x02ee('0x3f')]=[{'all':!![]}];}_0x1ec17b=_['merge']({},_0x1ec17b,_0x1ec63b[_0x02ee('0x43')]);return db[_0x02ee('0x3d')]['find'](_0x1ec17b)['then'](handleEntityNotFound(_0x3197e5,null))[_0x02ee('0x22')](respondWithResult(_0x3197e5,null))[_0x02ee('0x44')](handleError(_0x3197e5,null));};exports[_0x02ee('0x45')]=function(_0x49dc0b,_0x2af2d9){return db[_0x02ee('0x3d')][_0x02ee('0x45')](_0x49dc0b[_0x02ee('0x46')],{})[_0x02ee('0x22')](respondWithResult(_0x2af2d9,0xc9))[_0x02ee('0x44')](handleError(_0x2af2d9,null));};exports[_0x02ee('0x47')]=function(_0x23892a,_0x3a8706){if(_0x23892a[_0x02ee('0x46')]['id']){delete _0x23892a[_0x02ee('0x46')]['id'];}return db[_0x02ee('0x3d')][_0x02ee('0x48')]({'where':{'id':_0x23892a[_0x02ee('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a8706,null))[_0x02ee('0x22')](saveUpdates(_0x23892a[_0x02ee('0x46')],null))['then'](respondWithResult(_0x3a8706,null))[_0x02ee('0x44')](handleError(_0x3a8706,null));};exports[_0x02ee('0x23')]=function(_0x36847d,_0x3099ff){return db[_0x02ee('0x3d')][_0x02ee('0x48')]({'where':{'id':_0x36847d[_0x02ee('0x42')]['id']}})[_0x02ee('0x22')](handleEntityNotFound(_0x3099ff,null))[_0x02ee('0x22')](removeEntity(_0x3099ff,null))[_0x02ee('0x44')](handleError(_0x3099ff,null));};exports[_0x02ee('0x49')]=function(_0x203e41,_0x357e82){return db[_0x02ee('0x3d')][_0x02ee('0x49')]()['then'](respondWithResult(_0x357e82,null))[_0x02ee('0x44')](handleError(_0x357e82,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0d16f76..b33f921 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 _0xdfd8=['uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareReport','report_square','uid_pname'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdfd8,0x133));var _0x8dfd=function(_0x56fa90,_0x5726e3){_0x56fa90=_0x56fa90-0x0;var _0xae05b=_0xdfd8[_0x56fa90];return _0xae05b;};'use strict';var _=require(_0x8dfd('0x0'));var util=require(_0x8dfd('0x1'));var logger=require(_0x8dfd('0x2'))('api');var moment=require(_0x8dfd('0x3'));var BPromise=require(_0x8dfd('0x4'));var rp=require(_0x8dfd('0x5'));var fs=require('fs');var path=require(_0x8dfd('0x6'));var rimraf=require('rimraf');var config=require(_0x8dfd('0x7'));var attributes=require('./squareReport.attributes');module[_0x8dfd('0x8')]=function(_0x3fc640,_0x53a9af){return _0x3fc640[_0x8dfd('0x9')](_0x8dfd('0xa'),attributes,{'tableName':_0x8dfd('0xb'),'paranoid':![],'indexes':[{'name':_0x8dfd('0xc'),'fields':[_0x8dfd('0xd'),_0x8dfd('0xe')]},{'name':_0x8dfd('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x61b2=['rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uniqueid','project_name','leaveAt','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x61b2,0x1bc));var _0x261b=function(_0x5d0ea1,_0x2ac2c3){_0x5d0ea1=_0x5d0ea1-0x0;var _0x542c09=_0x61b2[_0x5d0ea1];return _0x542c09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x261b('0x0'))(_0x261b('0x1'));var moment=require(_0x261b('0x2'));var BPromise=require(_0x261b('0x3'));var rp=require(_0x261b('0x4'));var fs=require('fs');var path=require(_0x261b('0x5'));var rimraf=require(_0x261b('0x6'));var config=require(_0x261b('0x7'));var attributes=require(_0x261b('0x8'));module[_0x261b('0x9')]=function(_0x491ced,_0x2ae89f){return _0x491ced[_0x261b('0xa')](_0x261b('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x261b('0xc'),_0x261b('0xd')]},{'name':_0x261b('0xe'),'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 b06d926..b9de107 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 _0x48db=['stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x1a89d0,_0x433624){var _0x2fa8e8=function(_0xc4da1c){while(--_0xc4da1c){_0x1a89d0['push'](_0x1a89d0['shift']());}};_0x2fa8e8(++_0x433624);}(_0x48db,0x19b));var _0xb48d=function(_0x150ced,_0x486de0){_0x150ced=_0x150ced-0x0;var _0x538c95=_0x48db[_0x150ced];return _0x538c95;};'use strict';var _=require(_0xb48d('0x0'));var util=require(_0xb48d('0x1'));var moment=require(_0xb48d('0x2'));var BPromise=require(_0xb48d('0x3'));var rs=require(_0xb48d('0x4'));var fs=require('fs');var Redis=require(_0xb48d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb48d('0x6'))(_0xb48d('0x7'));var config=require(_0xb48d('0x8'));var jayson=require(_0xb48d('0x9'));var client=jayson[_0xb48d('0xa')][_0xb48d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c7133,_0x3e0bc7,_0x5d8aa5){return new BPromise(function(_0x3a24e6,_0x48dd8b){return client['request'](_0x1c7133,_0x5d8aa5)[_0xb48d('0xc')](function(_0x186b7a){logger[_0xb48d('0xd')](_0xb48d('0xe'),_0x3e0bc7,_0xb48d('0xf'));logger[_0xb48d('0x10')](_0xb48d('0x11'),_0x3e0bc7,_0xb48d('0xf'),JSON[_0xb48d('0x12')](_0x186b7a));if(_0x186b7a['error']){if(_0x186b7a[_0xb48d('0x13')][_0xb48d('0x14')]===0x1f4){logger[_0xb48d('0x13')](_0xb48d('0xe'),_0x3e0bc7,_0x186b7a[_0xb48d('0x13')][_0xb48d('0x15')]);return _0x48dd8b(_0x186b7a['error'][_0xb48d('0x15')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x3e0bc7,_0x186b7a[_0xb48d('0x13')][_0xb48d('0x15')]);return _0x3a24e6(_0x186b7a['error']['message']);}else{logger['info'](_0xb48d('0xe'),_0x3e0bc7,_0xb48d('0xf'));_0x3a24e6(_0x186b7a[_0xb48d('0x16')][_0xb48d('0x15')]);}})[_0xb48d('0x17')](function(_0x450924){logger[_0xb48d('0x13')](_0xb48d('0xe'),_0x3e0bc7,_0x450924);_0x48dd8b(_0x450924);});});}exports[_0xb48d('0x18')]=function(_0x431bd1){var _0x3b09be=this;return new Promise(function(_0x578cc9,_0x38a3c7){return db[_0xb48d('0x19')][_0xb48d('0x1a')](_0x431bd1[_0xb48d('0x1b')],{'raw':_0x431bd1['options']?_0x431bd1[_0xb48d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xb48d('0xc')](function(_0x2a569c){logger[_0xb48d('0xd')]('CreateSquareReport',_0x431bd1);logger[_0xb48d('0x10')](_0xb48d('0x18'),_0x431bd1,JSON[_0xb48d('0x12')](_0x2a569c));_0x578cc9(_0x2a569c);})[_0xb48d('0x17')](function(_0x51284a){logger['error'](_0xb48d('0x18'),_0x51284a[_0xb48d('0x15')],_0x431bd1);_0x38a3c7(_0x3b09be['error'](0x1f4,_0x51284a[_0xb48d('0x15')]));});});};exports[_0xb48d('0x1d')]=function(_0x480f58){var _0xf83f36=this;return new Promise(function(_0x102b66,_0x4654d7){return db[_0xb48d('0x19')][_0xb48d('0x1e')](_0x480f58[_0xb48d('0x1b')],{'raw':_0x480f58['options']?_0x480f58['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480f58[_0xb48d('0x1c')]?_0x480f58[_0xb48d('0x1c')]['where']||null:null,'attributes':_0x480f58[_0xb48d('0x1c')]?_0x480f58[_0xb48d('0x1c')][_0xb48d('0x1f')]||null:null,'limit':_0x480f58['options']?_0x480f58['options'][_0xb48d('0x20')]||null:null})[_0xb48d('0xc')](function(_0x54d45d){logger[_0xb48d('0xd')](_0xb48d('0x1d'),_0x480f58);logger[_0xb48d('0x10')](_0xb48d('0x1d'),_0x480f58,JSON['stringify'](_0x54d45d));_0x102b66(_0x54d45d);})['catch'](function(_0x11c629){logger[_0xb48d('0x13')](_0xb48d('0x1d'),_0x11c629[_0xb48d('0x15')],_0x480f58);_0x4654d7(_0xf83f36[_0xb48d('0x13')](0x1f4,_0x11c629[_0xb48d('0x15')]));});});}; \ No newline at end of file +var _0x8eb8=['../../config/environment','jayson/promise','client','http','info','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','request\x20sent','CreateSquareReport','SquareReport','create','body','options','raw','then','catch','UpdateSquareReport','update','where','attributes','limit','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8eb8,0x100));var _0x88eb=function(_0x296fac,_0x44e091){_0x296fac=_0x296fac-0x0;var _0x9d04f9=_0x8eb8[_0x296fac];return _0x9d04f9;};'use strict';var _=require(_0x88eb('0x0'));var util=require(_0x88eb('0x1'));var moment=require(_0x88eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x88eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88eb('0x4'))['db'];var utils=require(_0x88eb('0x5'));var logger=require(_0x88eb('0x6'))(_0x88eb('0x7'));var config=require(_0x88eb('0x8'));var jayson=require(_0x88eb('0x9'));var client=jayson[_0x88eb('0xa')][_0x88eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43b328,_0xda6f93,_0x459673){return new BPromise(function(_0x4ee596,_0x45ff6d){return client['request'](_0x43b328,_0x459673)['then'](function(_0x17812f){logger[_0x88eb('0xc')]('SquareReport,\x20%s,\x20%s',_0xda6f93,'request\x20sent');logger['debug'](_0x88eb('0xd'),_0xda6f93,'request\x20sent',JSON[_0x88eb('0xe')](_0x17812f));if(_0x17812f[_0x88eb('0xf')]){if(_0x17812f[_0x88eb('0xf')]['code']===0x1f4){logger[_0x88eb('0xf')](_0x88eb('0x10'),_0xda6f93,_0x17812f['error'][_0x88eb('0x11')]);return _0x45ff6d(_0x17812f['error'][_0x88eb('0x11')]);}logger[_0x88eb('0xf')]('SquareReport,\x20%s,\x20%s',_0xda6f93,_0x17812f['error']['message']);return _0x4ee596(_0x17812f['error'][_0x88eb('0x11')]);}else{logger['info'](_0x88eb('0x10'),_0xda6f93,_0x88eb('0x12'));_0x4ee596(_0x17812f['result'][_0x88eb('0x11')]);}})['catch'](function(_0x21fc16){logger[_0x88eb('0xf')](_0x88eb('0x10'),_0xda6f93,_0x21fc16);_0x45ff6d(_0x21fc16);});});}exports[_0x88eb('0x13')]=function(_0x366575){var _0x457cd0=this;return new Promise(function(_0x2876aa,_0x418fc6){return db[_0x88eb('0x14')][_0x88eb('0x15')](_0x366575[_0x88eb('0x16')],{'raw':_0x366575['options']?_0x366575[_0x88eb('0x17')][_0x88eb('0x18')]===undefined?!![]:![]:!![]})[_0x88eb('0x19')](function(_0x114fa2){logger['info'](_0x88eb('0x13'),_0x366575);logger['debug'](_0x88eb('0x13'),_0x366575,JSON[_0x88eb('0xe')](_0x114fa2));_0x2876aa(_0x114fa2);})[_0x88eb('0x1a')](function(_0x5d9862){logger['error'](_0x88eb('0x13'),_0x5d9862[_0x88eb('0x11')],_0x366575);_0x418fc6(_0x457cd0[_0x88eb('0xf')](0x1f4,_0x5d9862[_0x88eb('0x11')]));});});};exports[_0x88eb('0x1b')]=function(_0x17afd9){var _0x4ae12c=this;return new Promise(function(_0x439911,_0x486871){return db[_0x88eb('0x14')][_0x88eb('0x1c')](_0x17afd9[_0x88eb('0x16')],{'raw':_0x17afd9[_0x88eb('0x17')]?_0x17afd9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17afd9[_0x88eb('0x17')]?_0x17afd9[_0x88eb('0x17')][_0x88eb('0x1d')]||null:null,'attributes':_0x17afd9[_0x88eb('0x17')]?_0x17afd9[_0x88eb('0x17')][_0x88eb('0x1e')]||null:null,'limit':_0x17afd9[_0x88eb('0x17')]?_0x17afd9[_0x88eb('0x17')][_0x88eb('0x1f')]||null:null})[_0x88eb('0x19')](function(_0x46346c){logger[_0x88eb('0xc')](_0x88eb('0x1b'),_0x17afd9);logger[_0x88eb('0x20')](_0x88eb('0x1b'),_0x17afd9,JSON[_0x88eb('0xe')](_0x46346c));_0x439911(_0x46346c);})['catch'](function(_0x5174a1){logger[_0x88eb('0xf')](_0x88eb('0x1b'),_0x5174a1[_0x88eb('0x11')],_0x17afd9);_0x486871(_0x4ae12c[_0x88eb('0xf')](0x1f4,_0x5174a1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 07eb09c..e0d5e48 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 _0x5645=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x213000,_0x159d84){var _0x493fa5=function(_0x476899){while(--_0x476899){_0x213000['push'](_0x213000['shift']());}};_0x493fa5(++_0x159d84);}(_0x5645,0x8c));var _0x5564=function(_0x107719,_0x36a59f){_0x107719=_0x107719-0x0;var _0xb3e990=_0x5645[_0x107719];return _0xb3e990;};'use strict';var multer=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var path=require(_0x5564('0x2'));var timeout=require(_0x5564('0x3'));var express=require('express');var router=express[_0x5564('0x4')]();var fs_extra=require(_0x5564('0x5'));var auth=require(_0x5564('0x6'));var interaction=require(_0x5564('0x7'));var config=require(_0x5564('0x8'));var controller=require(_0x5564('0x9'));router[_0x5564('0xa')]('/',auth[_0x5564('0xb')](),controller[_0x5564('0xc')]);router[_0x5564('0xa')](_0x5564('0xd'),auth[_0x5564('0xb')](),controller['describe']);router['get'](_0x5564('0xe'),auth[_0x5564('0xb')](),controller[_0x5564('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5564('0x10')]);router[_0x5564('0x11')](_0x5564('0xe'),auth[_0x5564('0xb')](),controller[_0x5564('0x12')]);router[_0x5564('0x13')](_0x5564('0xe'),auth[_0x5564('0xb')](),controller[_0x5564('0x14')]);module[_0x5564('0x15')]=router; \ No newline at end of file +var _0xa1c7=['/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','describe'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xa1c7,0x182));var _0x7a1c=function(_0x5b033b,_0x496d65){_0x5b033b=_0x5b033b-0x0;var _0xdcd8df=_0xa1c7[_0x5b033b];return _0xdcd8df;};'use strict';var multer=require(_0x7a1c('0x0'));var util=require(_0x7a1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a1c('0x2'));var router=express[_0x7a1c('0x3')]();var fs_extra=require(_0x7a1c('0x4'));var auth=require(_0x7a1c('0x5'));var interaction=require(_0x7a1c('0x6'));var config=require(_0x7a1c('0x7'));var controller=require(_0x7a1c('0x8'));router[_0x7a1c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7a1c('0xa')]);router['get'](_0x7a1c('0xb'),auth['isAuthenticated'](),controller[_0x7a1c('0xc')]);router['get'](_0x7a1c('0xd'),auth[_0x7a1c('0xe')](),controller[_0x7a1c('0xf')]);router[_0x7a1c('0x10')]('/',auth[_0x7a1c('0xe')](),controller[_0x7a1c('0x11')]);router['put'](_0x7a1c('0xd'),auth[_0x7a1c('0xe')](),controller[_0x7a1c('0x12')]);router[_0x7a1c('0x13')](_0x7a1c('0xd'),auth[_0x7a1c('0xe')](),controller['destroy']);module[_0x7a1c('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5dda067..9e1ff5b 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 _0xcd3c=['exports','STRING','TEXT','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcd3c,0x1b7));var _0xccd3=function(_0x3dc8cd,_0x4696a3){_0x3dc8cd=_0x3dc8cd-0x0;var _0x192ac8=_0xcd3c[_0x3dc8cd];return _0x192ac8;};'use strict';var Sequelize=require(_0xccd3('0x0'));module[_0xccd3('0x1')]={'uniqueid':{'type':Sequelize[_0xccd3('0x2')]},'node':{'type':Sequelize[_0xccd3('0x2')]},'application':{'type':Sequelize[_0xccd3('0x2')]},'data':{'type':Sequelize[_0xccd3('0x3')]},'project_name':{'type':Sequelize[_0xccd3('0x2')]},'callerid':{'type':Sequelize[_0xccd3('0x2')]}}; \ No newline at end of file +var _0xc8b6=['TEXT','sequelize','exports','STRING'];(function(_0x286193,_0x5c37e9){var _0x2d3c7f=function(_0x3814b2){while(--_0x3814b2){_0x286193['push'](_0x286193['shift']());}};_0x2d3c7f(++_0x5c37e9);}(_0xc8b6,0x1f1));var _0x6c8b=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0xc8b6[_0x532112];return _0x23e5fb;};'use strict';var Sequelize=require(_0x6c8b('0x0'));module[_0x6c8b('0x1')]={'uniqueid':{'type':Sequelize[_0x6c8b('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6c8b('0x2')]},'data':{'type':Sequelize[_0x6c8b('0x3')]},'project_name':{'type':Sequelize[_0x6c8b('0x2')]},'callerid':{'type':Sequelize[_0x6c8b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c3bd76a..06b4b6f 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 _0xd238=['bluebird','mustache','util','path','sox','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','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','then','end','stack','name','send','index','SquareDetailsReport','rawAttributes','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','destroy','describe','rimraf','request-promise','moment'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd238,0x174));var _0x8d23=function(_0x20a098,_0x14b7cb){_0x20a098=_0x20a098-0x0;var _0xc7e9c=_0xd238[_0x20a098];return _0xc7e9c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d23('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d23('0x1'));var moment=require(_0x8d23('0x2'));var BPromise=require(_0x8d23('0x3'));var Mustache=require(_0x8d23('0x4'));var util=require(_0x8d23('0x5'));var path=require(_0x8d23('0x6'));var sox=require(_0x8d23('0x7'));var csv=require(_0x8d23('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d23('0x9'));var _=require('lodash');var squel=require(_0x8d23('0xa'));var crypto=require(_0x8d23('0xb'));var jsforce=require(_0x8d23('0xc'));var deskjs=require(_0x8d23('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d23('0xe'));var Papa=require(_0x8d23('0xf'));var Redis=require('ioredis');var authService=require(_0x8d23('0x10'));var qs=require(_0x8d23('0x11'));var as=require(_0x8d23('0x12'));var hardwareService=require(_0x8d23('0x13'));var logger=require('../../config/logger')(_0x8d23('0x14'));var utils=require(_0x8d23('0x15'));var config=require(_0x8d23('0x16'));var licenseUtil=require(_0x8d23('0x17'));var db=require(_0x8d23('0x18'))['db'];function respondWithStatusCode(_0x32b172,_0xdb414d){_0xdb414d=_0xdb414d||0xcc;return function(_0x4a6e92){if(_0x4a6e92){return _0x32b172[_0x8d23('0x19')](_0xdb414d);}return _0x32b172[_0x8d23('0x1a')](_0xdb414d)['end']();};}function respondWithResult(_0x16b273,_0x5aa3af){_0x5aa3af=_0x5aa3af||0xc8;return function(_0x3f8567){if(_0x3f8567){return _0x16b273[_0x8d23('0x1a')](_0x5aa3af)[_0x8d23('0x1b')](_0x3f8567);}};}function respondWithFilteredResult(_0x3e1130,_0x16dd9b){return function(_0x26804e){if(_0x26804e){var _0x173636=typeof _0x16dd9b[_0x8d23('0x1c')]==='undefined'&&typeof _0x16dd9b[_0x8d23('0x1d')]===_0x8d23('0x1e');var _0x10bfea=_0x26804e['count'];var _0x3d3480=_0x173636?0x0:_0x16dd9b[_0x8d23('0x1c')];var _0xa79697=_0x173636?_0x26804e[_0x8d23('0x1f')]:_0x16dd9b[_0x8d23('0x1c')]+_0x16dd9b['limit'];var _0x27006b;if(_0xa79697>=_0x10bfea){_0xa79697=_0x10bfea;_0x27006b=0xc8;}else{_0x27006b=0xce;}_0x3e1130[_0x8d23('0x1a')](_0x27006b);return _0x3e1130[_0x8d23('0x20')]('Content-Range',_0x3d3480+'-'+_0xa79697+'/'+_0x10bfea)[_0x8d23('0x1b')](_0x26804e);}return null;};}function patchUpdates(_0x5c72f8){return function(_0x4a0aff){try{jsonpatch['apply'](_0x4a0aff,_0x5c72f8,!![]);}catch(_0x4017b8){return BPromise[_0x8d23('0x21')](_0x4017b8);}return _0x4a0aff['save']();};}function saveUpdates(_0x50d256,_0x47e98b){return function(_0x16a217){if(_0x16a217){return _0x16a217[_0x8d23('0x22')](_0x50d256)[_0x8d23('0x23')](function(_0x4d8576){return _0x4d8576;});}return null;};}function removeEntity(_0x116d3e,_0x1fb0f7){return function(_0x3a9ded){if(_0x3a9ded){return _0x3a9ded['destroy']()[_0x8d23('0x23')](function(){_0x116d3e[_0x8d23('0x1a')](0xcc)[_0x8d23('0x24')]();});}};}function handleEntityNotFound(_0x561c11,_0x27478d){return function(_0x286411){if(!_0x286411){_0x561c11[_0x8d23('0x19')](0x194);}return _0x286411;};}function handleError(_0x52deeb,_0x224333){_0x224333=_0x224333||0x1f4;return function(_0x56b678){logger['error'](_0x56b678[_0x8d23('0x25')]);if(_0x56b678['name']){delete _0x56b678[_0x8d23('0x26')];}_0x52deeb[_0x8d23('0x1a')](_0x224333)[_0x8d23('0x27')](_0x56b678);};}exports[_0x8d23('0x28')]=function(_0x53d4cc,_0x210627){var _0x4047c0={},_0x5190d4={},_0x23a133={'count':0x0,'rows':[]};var _0x1e65a9=_['map'](db[_0x8d23('0x29')][_0x8d23('0x2a')],function(_0x587964){return{'name':_0x587964['fieldName'],'type':_0x587964['type'][_0x8d23('0x2b')]};});_0x5190d4['model']=_[_0x8d23('0x2c')](_0x1e65a9,'name');_0x5190d4[_0x8d23('0x2d')]=_[_0x8d23('0x2e')](_0x53d4cc[_0x8d23('0x2d')]);_0x5190d4[_0x8d23('0x2f')]=_[_0x8d23('0x30')](_0x5190d4[_0x8d23('0x31')],_0x5190d4['query']);_0x4047c0['attributes']=_[_0x8d23('0x30')](_0x5190d4[_0x8d23('0x31')],qs[_0x8d23('0x32')](_0x53d4cc[_0x8d23('0x2d')]['fields']));_0x4047c0[_0x8d23('0x33')]=_0x4047c0[_0x8d23('0x33')][_0x8d23('0x34')]?_0x4047c0[_0x8d23('0x33')]:_0x5190d4[_0x8d23('0x31')];if(!_0x53d4cc['query'][_0x8d23('0x35')](_0x8d23('0x36'))){_0x4047c0[_0x8d23('0x1d')]=qs['limit'](_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x1d')]);_0x4047c0[_0x8d23('0x1c')]=qs[_0x8d23('0x1c')](_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x1c')]);}_0x4047c0[_0x8d23('0x37')]=qs[_0x8d23('0x38')](_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x38')]);_0x4047c0['where']=qs[_0x8d23('0x2f')](_[_0x8d23('0x39')](_0x53d4cc[_0x8d23('0x2d')],_0x5190d4['filters']),_0x1e65a9);if(_0x53d4cc['query'][_0x8d23('0x3a')]){_0x4047c0['where']=_[_0x8d23('0x3b')](_0x4047c0[_0x8d23('0x3c')],{'$or':_['map'](_0x1e65a9,function(_0xbd9d49){if(_0xbd9d49[_0x8d23('0x3d')]!==_0x8d23('0x3e')){var _0x1664a7={};_0x1664a7[_0xbd9d49[_0x8d23('0x26')]]={'$like':'%'+_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x3a')]+'%'};return _0x1664a7;}})});}_0x4047c0=_[_0x8d23('0x3b')]({},_0x4047c0,_0x53d4cc[_0x8d23('0x3f')]);var _0x49ded3={'where':_0x4047c0[_0x8d23('0x3c')]};return db['SquareDetailsReport'][_0x8d23('0x1f')](_0x49ded3)['then'](function(_0x68112c){_0x23a133['count']=_0x68112c;if(_0x53d4cc['query']['includeAll']){_0x4047c0[_0x8d23('0x40')]=[{'all':!![]}];}return db[_0x8d23('0x29')][_0x8d23('0x41')](_0x4047c0);})['then'](function(_0x3739cb){_0x23a133[_0x8d23('0x42')]=_0x3739cb;return _0x23a133;})['then'](respondWithFilteredResult(_0x210627,_0x4047c0))[_0x8d23('0x43')](handleError(_0x210627,null));};exports[_0x8d23('0x44')]=function(_0x41f5cc,_0x41f50e){var _0x22dd3e={'raw':!![],'where':{'id':_0x41f5cc[_0x8d23('0x45')]['id']}},_0x120459={};_0x120459['model']=_[_0x8d23('0x2e')](db[_0x8d23('0x29')][_0x8d23('0x2a')]);_0x120459[_0x8d23('0x2d')]=_['keys'](_0x41f5cc[_0x8d23('0x2d')]);_0x120459[_0x8d23('0x2f')]=_[_0x8d23('0x30')](_0x120459[_0x8d23('0x31')],_0x120459[_0x8d23('0x2d')]);_0x22dd3e[_0x8d23('0x33')]=_[_0x8d23('0x30')](_0x120459[_0x8d23('0x31')],qs[_0x8d23('0x32')](_0x41f5cc[_0x8d23('0x2d')][_0x8d23('0x32')]));_0x22dd3e['attributes']=_0x22dd3e['attributes']['length']?_0x22dd3e['attributes']:_0x120459['model'];if(_0x41f5cc[_0x8d23('0x2d')][_0x8d23('0x46')]){_0x22dd3e[_0x8d23('0x40')]=[{'all':!![]}];}_0x22dd3e=_[_0x8d23('0x3b')]({},_0x22dd3e,_0x41f5cc[_0x8d23('0x3f')]);return db[_0x8d23('0x29')]['find'](_0x22dd3e)[_0x8d23('0x23')](handleEntityNotFound(_0x41f50e,null))[_0x8d23('0x23')](respondWithResult(_0x41f50e,null))[_0x8d23('0x43')](handleError(_0x41f50e,null));};exports[_0x8d23('0x47')]=function(_0xc23c7e,_0x545a23){return db['SquareDetailsReport'][_0x8d23('0x47')](_0xc23c7e['body'],{})[_0x8d23('0x23')](respondWithResult(_0x545a23,0xc9))[_0x8d23('0x43')](handleError(_0x545a23,null));};exports[_0x8d23('0x22')]=function(_0x34e06b,_0x3cb960){if(_0x34e06b[_0x8d23('0x48')]['id']){delete _0x34e06b['body']['id'];}return db[_0x8d23('0x29')]['find']({'where':{'id':_0x34e06b[_0x8d23('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cb960,null))[_0x8d23('0x23')](saveUpdates(_0x34e06b[_0x8d23('0x48')],null))[_0x8d23('0x23')](respondWithResult(_0x3cb960,null))['catch'](handleError(_0x3cb960,null));};exports[_0x8d23('0x49')]=function(_0x1afd63,_0x594f00){return db[_0x8d23('0x29')]['find']({'where':{'id':_0x1afd63[_0x8d23('0x45')]['id']}})[_0x8d23('0x23')](handleEntityNotFound(_0x594f00,null))[_0x8d23('0x23')](removeEntity(_0x594f00,null))[_0x8d23('0x43')](handleError(_0x594f00,null));};exports[_0x8d23('0x4a')]=function(_0xcc8f02,_0x585851){return db[_0x8d23('0x29')][_0x8d23('0x4a')]()[_0x8d23('0x23')](respondWithResult(_0x585851,null))[_0x8d23('0x43')](handleError(_0x585851,null));}; \ No newline at end of file +var _0xf6c7=['then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','update'];(function(_0x36c1da,_0x584a4a){var _0x2a8586=function(_0x2b35ba){while(--_0x2b35ba){_0x36c1da['push'](_0x36c1da['shift']());}};_0x2a8586(++_0x584a4a);}(_0xf6c7,0x19e));var _0x7f6c=function(_0x5adf3d,_0x26965f){_0x5adf3d=_0x5adf3d-0x0;var _0x55e445=_0xf6c7[_0x5adf3d];return _0x55e445;};'use strict';var emlformat=require(_0x7f6c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7f6c('0x1'));var rp=require(_0x7f6c('0x2'));var moment=require(_0x7f6c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7f6c('0x4'));var util=require(_0x7f6c('0x5'));var path=require(_0x7f6c('0x6'));var sox=require(_0x7f6c('0x7'));var csv=require('to-csv');var ejs=require(_0x7f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x7f6c('0x9'));var _=require(_0x7f6c('0xa'));var squel=require(_0x7f6c('0xb'));var crypto=require('crypto');var jsforce=require(_0x7f6c('0xc'));var deskjs=require(_0x7f6c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f6c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7f6c('0xf'));var qs=require(_0x7f6c('0x10'));var as=require(_0x7f6c('0x11'));var hardwareService=require(_0x7f6c('0x12'));var logger=require(_0x7f6c('0x13'))(_0x7f6c('0x14'));var utils=require(_0x7f6c('0x15'));var config=require(_0x7f6c('0x16'));var licenseUtil=require(_0x7f6c('0x17'));var db=require(_0x7f6c('0x18'))['db'];function respondWithStatusCode(_0x4c5319,_0x5b75e5){_0x5b75e5=_0x5b75e5||0xcc;return function(_0x21eede){if(_0x21eede){return _0x4c5319[_0x7f6c('0x19')](_0x5b75e5);}return _0x4c5319['status'](_0x5b75e5)[_0x7f6c('0x1a')]();};}function respondWithResult(_0x42d54a,_0x2770e2){_0x2770e2=_0x2770e2||0xc8;return function(_0x5d5e0e){if(_0x5d5e0e){return _0x42d54a[_0x7f6c('0x1b')](_0x2770e2)[_0x7f6c('0x1c')](_0x5d5e0e);}};}function respondWithFilteredResult(_0x502736,_0x58a089){return function(_0x28aa21){if(_0x28aa21){var _0x2b5395=typeof _0x58a089[_0x7f6c('0x1d')]==='undefined'&&typeof _0x58a089['limit']===_0x7f6c('0x1e');var _0x5287ce=_0x28aa21[_0x7f6c('0x1f')];var _0x330cb9=_0x2b5395?0x0:_0x58a089['offset'];var _0x4e5f86=_0x2b5395?_0x28aa21[_0x7f6c('0x1f')]:_0x58a089[_0x7f6c('0x1d')]+_0x58a089['limit'];var _0x2a0519;if(_0x4e5f86>=_0x5287ce){_0x4e5f86=_0x5287ce;_0x2a0519=0xc8;}else{_0x2a0519=0xce;}_0x502736[_0x7f6c('0x1b')](_0x2a0519);return _0x502736[_0x7f6c('0x20')](_0x7f6c('0x21'),_0x330cb9+'-'+_0x4e5f86+'/'+_0x5287ce)['json'](_0x28aa21);}return null;};}function patchUpdates(_0x49a1bd){return function(_0x89f648){try{jsonpatch['apply'](_0x89f648,_0x49a1bd,!![]);}catch(_0x20ad0f){return BPromise[_0x7f6c('0x22')](_0x20ad0f);}return _0x89f648['save']();};}function saveUpdates(_0x4c1ee8,_0x34b14c){return function(_0x296e30){if(_0x296e30){return _0x296e30[_0x7f6c('0x23')](_0x4c1ee8)[_0x7f6c('0x24')](function(_0x295bfe){return _0x295bfe;});}return null;};}function removeEntity(_0x41a3d6,_0x13dff6){return function(_0x389c8e){if(_0x389c8e){return _0x389c8e[_0x7f6c('0x25')]()[_0x7f6c('0x24')](function(){_0x41a3d6[_0x7f6c('0x1b')](0xcc)[_0x7f6c('0x1a')]();});}};}function handleEntityNotFound(_0x5e08b2,_0x212841){return function(_0x5b753a){if(!_0x5b753a){_0x5e08b2[_0x7f6c('0x19')](0x194);}return _0x5b753a;};}function handleError(_0x5776fe,_0xf6a744){_0xf6a744=_0xf6a744||0x1f4;return function(_0x2659a7){logger[_0x7f6c('0x26')](_0x2659a7[_0x7f6c('0x27')]);if(_0x2659a7['name']){delete _0x2659a7[_0x7f6c('0x28')];}_0x5776fe[_0x7f6c('0x1b')](_0xf6a744)[_0x7f6c('0x29')](_0x2659a7);};}exports['index']=function(_0x2837fa,_0x20337a){var _0x122242={},_0x33aa42={},_0x3c4f4f={'count':0x0,'rows':[]};var _0x3d3726=_[_0x7f6c('0x2a')](db[_0x7f6c('0x2b')][_0x7f6c('0x2c')],function(_0x28a40a){return{'name':_0x28a40a[_0x7f6c('0x2d')],'type':_0x28a40a['type']['key']};});_0x33aa42[_0x7f6c('0x2e')]=_[_0x7f6c('0x2a')](_0x3d3726,_0x7f6c('0x28'));_0x33aa42[_0x7f6c('0x2f')]=_[_0x7f6c('0x30')](_0x2837fa[_0x7f6c('0x2f')]);_0x33aa42[_0x7f6c('0x31')]=_[_0x7f6c('0x32')](_0x33aa42[_0x7f6c('0x2e')],_0x33aa42[_0x7f6c('0x2f')]);_0x122242[_0x7f6c('0x33')]=_[_0x7f6c('0x32')](_0x33aa42[_0x7f6c('0x2e')],qs['fields'](_0x2837fa['query'][_0x7f6c('0x34')]));_0x122242['attributes']=_0x122242[_0x7f6c('0x33')][_0x7f6c('0x35')]?_0x122242['attributes']:_0x33aa42[_0x7f6c('0x2e')];if(!_0x2837fa[_0x7f6c('0x2f')][_0x7f6c('0x36')](_0x7f6c('0x37'))){_0x122242[_0x7f6c('0x38')]=qs[_0x7f6c('0x38')](_0x2837fa['query']['limit']);_0x122242[_0x7f6c('0x1d')]=qs[_0x7f6c('0x1d')](_0x2837fa[_0x7f6c('0x2f')]['offset']);}_0x122242[_0x7f6c('0x39')]=qs[_0x7f6c('0x3a')](_0x2837fa[_0x7f6c('0x2f')]['sort']);_0x122242['where']=qs['filters'](_[_0x7f6c('0x3b')](_0x2837fa[_0x7f6c('0x2f')],_0x33aa42[_0x7f6c('0x31')]),_0x3d3726);if(_0x2837fa[_0x7f6c('0x2f')][_0x7f6c('0x3c')]){_0x122242[_0x7f6c('0x3d')]=_['merge'](_0x122242['where'],{'$or':_['map'](_0x3d3726,function(_0x397c24){if(_0x397c24['type']!==_0x7f6c('0x3e')){var _0x5abcf3={};_0x5abcf3[_0x397c24[_0x7f6c('0x28')]]={'$like':'%'+_0x2837fa['query'][_0x7f6c('0x3c')]+'%'};return _0x5abcf3;}})});}_0x122242=_[_0x7f6c('0x3f')]({},_0x122242,_0x2837fa[_0x7f6c('0x40')]);var _0x1e7053={'where':_0x122242[_0x7f6c('0x3d')]};return db['SquareDetailsReport'][_0x7f6c('0x1f')](_0x1e7053)[_0x7f6c('0x24')](function(_0x680b8f){_0x3c4f4f['count']=_0x680b8f;if(_0x2837fa['query'][_0x7f6c('0x41')]){_0x122242['include']=[{'all':!![]}];}return db[_0x7f6c('0x2b')][_0x7f6c('0x42')](_0x122242);})[_0x7f6c('0x24')](function(_0x41fecc){_0x3c4f4f[_0x7f6c('0x43')]=_0x41fecc;return _0x3c4f4f;})['then'](respondWithFilteredResult(_0x20337a,_0x122242))[_0x7f6c('0x44')](handleError(_0x20337a,null));};exports[_0x7f6c('0x45')]=function(_0x8a3b51,_0x1f07d9){var _0xab8f59={'raw':!![],'where':{'id':_0x8a3b51[_0x7f6c('0x46')]['id']}},_0xf6ebd5={};_0xf6ebd5[_0x7f6c('0x2e')]=_[_0x7f6c('0x30')](db[_0x7f6c('0x2b')][_0x7f6c('0x2c')]);_0xf6ebd5[_0x7f6c('0x2f')]=_['keys'](_0x8a3b51[_0x7f6c('0x2f')]);_0xf6ebd5[_0x7f6c('0x31')]=_[_0x7f6c('0x32')](_0xf6ebd5[_0x7f6c('0x2e')],_0xf6ebd5[_0x7f6c('0x2f')]);_0xab8f59[_0x7f6c('0x33')]=_[_0x7f6c('0x32')](_0xf6ebd5['model'],qs[_0x7f6c('0x34')](_0x8a3b51[_0x7f6c('0x2f')][_0x7f6c('0x34')]));_0xab8f59[_0x7f6c('0x33')]=_0xab8f59[_0x7f6c('0x33')][_0x7f6c('0x35')]?_0xab8f59[_0x7f6c('0x33')]:_0xf6ebd5[_0x7f6c('0x2e')];if(_0x8a3b51[_0x7f6c('0x2f')][_0x7f6c('0x41')]){_0xab8f59['include']=[{'all':!![]}];}_0xab8f59=_[_0x7f6c('0x3f')]({},_0xab8f59,_0x8a3b51[_0x7f6c('0x40')]);return db[_0x7f6c('0x2b')]['find'](_0xab8f59)[_0x7f6c('0x24')](handleEntityNotFound(_0x1f07d9,null))[_0x7f6c('0x24')](respondWithResult(_0x1f07d9,null))[_0x7f6c('0x44')](handleError(_0x1f07d9,null));};exports['create']=function(_0x2131bc,_0x4aa641){return db[_0x7f6c('0x2b')][_0x7f6c('0x47')](_0x2131bc[_0x7f6c('0x48')],{})[_0x7f6c('0x24')](respondWithResult(_0x4aa641,0xc9))[_0x7f6c('0x44')](handleError(_0x4aa641,null));};exports[_0x7f6c('0x23')]=function(_0x4b7715,_0x13bb70){if(_0x4b7715[_0x7f6c('0x48')]['id']){delete _0x4b7715[_0x7f6c('0x48')]['id'];}return db[_0x7f6c('0x2b')][_0x7f6c('0x49')]({'where':{'id':_0x4b7715[_0x7f6c('0x46')]['id']}})[_0x7f6c('0x24')](handleEntityNotFound(_0x13bb70,null))[_0x7f6c('0x24')](saveUpdates(_0x4b7715[_0x7f6c('0x48')],null))[_0x7f6c('0x24')](respondWithResult(_0x13bb70,null))[_0x7f6c('0x44')](handleError(_0x13bb70,null));};exports[_0x7f6c('0x25')]=function(_0x234bdf,_0x50d587){return db[_0x7f6c('0x2b')][_0x7f6c('0x49')]({'where':{'id':_0x234bdf[_0x7f6c('0x46')]['id']}})[_0x7f6c('0x24')](handleEntityNotFound(_0x50d587,null))['then'](removeEntity(_0x50d587,null))[_0x7f6c('0x44')](handleError(_0x50d587,null));};exports[_0x7f6c('0x4a')]=function(_0x516937,_0x40f130){return db[_0x7f6c('0x2b')][_0x7f6c('0x4a')]()['then'](respondWithResult(_0x40f130,null))['catch'](handleError(_0x40f130,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 792f02e..8a60990 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 _0x4ce1=['SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x4ce1,0xca));var _0x14ce=function(_0x1fe6e7,_0x30fdb){_0x1fe6e7=_0x1fe6e7-0x0;var _0xf87e74=_0x4ce1[_0x1fe6e7];return _0xf87e74;};'use strict';var _=require(_0x14ce('0x0'));var util=require('util');var logger=require(_0x14ce('0x1'))(_0x14ce('0x2'));var moment=require('moment');var BPromise=require(_0x14ce('0x3'));var rp=require(_0x14ce('0x4'));var fs=require('fs');var path=require(_0x14ce('0x5'));var rimraf=require('rimraf');var config=require(_0x14ce('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x11763d,_0x4c48bf){return _0x11763d[_0x14ce('0x7')](_0x14ce('0x8'),attributes,{'tableName':_0x14ce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8828=['api','moment','request-promise','path','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger'];(function(_0x28e11b,_0x2c2b09){var _0x5ad2f9=function(_0x22978b){while(--_0x22978b){_0x28e11b['push'](_0x28e11b['shift']());}};_0x5ad2f9(++_0x2c2b09);}(_0x8828,0xb8));var _0x8882=function(_0x3b0861,_0x2fdfda){_0x3b0861=_0x3b0861-0x0;var _0x222042=_0x8828[_0x3b0861];return _0x222042;};'use strict';var _=require(_0x8882('0x0'));var util=require(_0x8882('0x1'));var logger=require(_0x8882('0x2'))(_0x8882('0x3'));var moment=require(_0x8882('0x4'));var BPromise=require('bluebird');var rp=require(_0x8882('0x5'));var fs=require('fs');var path=require(_0x8882('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8882('0x7'));module[_0x8882('0x8')]=function(_0x56f691,_0x4f8b0b){return _0x56f691[_0x8882('0x9')](_0x8882('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 76f8b8e..30f04c0 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 _0xe1e3=['jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','options','raw','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x48c26b,_0x8dec12){var _0x32d08b=function(_0x5b2c3b){while(--_0x5b2c3b){_0x48c26b['push'](_0x48c26b['shift']());}};_0x32d08b(++_0x8dec12);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4b4d5f,_0x4b7dab){_0x4b4d5f=_0x4b4d5f-0x0;var _0x352832=_0xe1e3[_0x4b4d5f];return _0x352832;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['SquareDetailsReport']['create'](_0x1d786c['body'],{'raw':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c5acd){logger['info'](_0x3e1e('0x14'),_0x1d786c);logger[_0x3e1e('0x17')](_0x3e1e('0x14'),_0x1d786c,JSON['stringify'](_0x1c5acd));_0x791ed8(_0x1c5acd);})[_0x3e1e('0x18')](function(_0x96396){logger[_0x3e1e('0xf')]('CreateSquareDetailsReport',_0x96396['message'],_0x1d786c);_0x1c181b(_0x39eaa7[_0x3e1e('0xf')](0x1f4,_0x96396[_0x3e1e('0x11')]));});});}; \ No newline at end of file +var _0x7334=['error','code','message','request\x20sent','result','CreateSquareDetailsReport','create','body','options','raw','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x18dadd,_0x31a4b6){var _0x4c2846=function(_0x1c65e0){while(--_0x1c65e0){_0x18dadd['push'](_0x18dadd['shift']());}};_0x4c2846(++_0x31a4b6);}(_0x7334,0x184));var _0x4733=function(_0x1e1c46,_0x3bc49b){_0x1e1c46=_0x1e1c46-0x0;var _0x1ed519=_0x7334[_0x1e1c46];return _0x1ed519;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['SquareDetailsReport'][_0x4733('0x18')](_0x1d2fb6[_0x4733('0x19')],{'raw':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![]})[_0x4733('0xc')](function(_0x7a4e0){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger[_0x4733('0xf')]('CreateSquareDetailsReport',_0x1d2fb6,JSON[_0x4733('0x11')](_0x7a4e0));_0x384e0c(_0x7a4e0);})[_0x4733('0x1c')](function(_0x478e34){logger[_0x4733('0x12')](_0x4733('0x17'),_0x478e34[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x478e34[_0x4733('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e32cc55..f13f492 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 _0x34d4=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x1478b1,_0x85d8e5){var _0x403f8d=function(_0x45d00d){while(--_0x45d00d){_0x1478b1['push'](_0x1478b1['shift']());}};_0x403f8d(++_0x85d8e5);}(_0x34d4,0xeb));var _0x434d=function(_0x4ac517,_0x481cb1){_0x4ac517=_0x4ac517-0x0;var _0x17dec8=_0x34d4[_0x4ac517];return _0x17dec8;};'use strict';var express=require(_0x434d('0x0'));var router=express[_0x434d('0x1')]();var auth=require(_0x434d('0x2'));var controller=require(_0x434d('0x3'));router[_0x434d('0x4')]('/',auth[_0x434d('0x5')](),controller[_0x434d('0x6')]);router[_0x434d('0x4')](_0x434d('0x7'),auth[_0x434d('0x5')](),controller[_0x434d('0x8')]);module[_0x434d('0x9')]=router; \ No newline at end of file +var _0x1c97=['./system.controller','get','isAuthenticated','/process/:pid/kill','exports','Router','../../components/auth/service'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x1c97,0xc2));var _0x71c9=function(_0x4a31a5,_0x36856b){_0x4a31a5=_0x4a31a5-0x0;var _0x281eff=_0x1c97[_0x4a31a5];return _0x281eff;};'use strict';var express=require('express');var router=express[_0x71c9('0x0')]();var auth=require(_0x71c9('0x1'));var controller=require(_0x71c9('0x2'));router[_0x71c9('0x3')]('/',auth[_0x71c9('0x4')](),controller['index']);router['get'](_0x71c9('0x5'),auth[_0x71c9('0x4')](),controller['killProcess']);module[_0x71c9('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index afa613a..571aa4a 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 _0xc406=['kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x57a7f3,_0x26889b){var _0x38d9f9=function(_0x412d55){while(--_0x412d55){_0x57a7f3['push'](_0x57a7f3['shift']());}};_0x38d9f9(++_0x26889b);}(_0xc406,0x1a9));var _0x6c40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc406[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x6c40('0x0'));var exec=require(_0x6c40('0x1'))[_0x6c40('0x2')];var logger=require(_0x6c40('0x3'))(_0x6c40('0x4'));var util=require('util');var BPromise=require(_0x6c40('0x5'));var _=require(_0x6c40('0x6'));function handleError(_0x70c2e5,_0x17aed0,_0x417200){_0x17aed0=_0x17aed0||0x1f4;return function(_0x22befc){logger[_0x6c40('0x7')](_0x6c40('0x8'),_0x417200,_0x17aed0,util[_0x6c40('0x9')](_0x22befc,{'showHidden':![],'depth':null}));delete _0x22befc['name'];_0x70c2e5[_0x6c40('0xa')](_0x17aed0)[_0x6c40('0xb')](_0x22befc);};}exports['index']=function(_0x1748c4,_0x55b1a7){return info[_0x6c40('0xc')]()[_0x6c40('0xd')](function(_0x2f7b92){return _0x55b1a7[_0x6c40('0xa')](0xc8)[_0x6c40('0xe')](_0x2f7b92);})['catch'](function(_0x46f9fb){return _0x55b1a7[_0x6c40('0xa')](0x1f4)[_0x6c40('0xe')](_0x46f9fb);});};exports[_0x6c40('0xf')]=function(_0x40e80c,_0x34212b){var _0x48c023=[_0x6c40('0x10')];return new BPromise(function(_0x5e1122,_0x579f3c){return exec(util[_0x6c40('0x11')](_0x6c40('0x12'),_0x40e80c[_0x6c40('0x13')]['pid']),function(_0x347310,_0x584338,_0x2eb4b6){if(_0x347310){return _0x579f3c(_0x347310);}return _0x5e1122(_0x584338);});})['then'](function(_0x29ca23){var _0x5c907b=![];var _0x5ba6a8=_0x29ca23[_0x6c40('0x14')](/\n/);for(var _0x449519=0x0,_0x5b2dcb=_0x48c023[_0x6c40('0x15')];_0x449519<_0x5b2dcb,_0x5c907b===![];_0x449519+=0x1){if(_0x29ca23['indexOf'](_0x48c023[_0x449519])>=0x0){_0x5c907b=!![];}}if(!_0x5c907b){throw new Error(util[_0x6c40('0x11')](_0x6c40('0x16'),_0x40e80c[_0x6c40('0x13')]['pid']));}process[_0x6c40('0x17')](_0x40e80c[_0x6c40('0x13')][_0x6c40('0x18')],_0x6c40('0x19'));return _0x34212b[_0x6c40('0xa')](0xc8)[_0x6c40('0xe')]({'message':util[_0x6c40('0x11')](_0x6c40('0x1a'),_0x40e80c[_0x6c40('0x13')][_0x6c40('0x18')])});})[_0x6c40('0x1b')](handleError(_0x34212b,null,_0x6c40('0xf')));}; \ No newline at end of file +var _0x3f5e=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','killProcess','components/import/cm','format','params','pid','length','indexOf','kill','SIGINT','catch','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0x3f5e,0xd0));var _0xe3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5e[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0xe3f5('0x0'));var exec=require('child_process')[_0xe3f5('0x1')];var logger=require(_0xe3f5('0x2'))(_0xe3f5('0x3'));var util=require(_0xe3f5('0x4'));var BPromise=require(_0xe3f5('0x5'));var _=require(_0xe3f5('0x6'));function handleError(_0x1571b1,_0x2b624b,_0x28653b){_0x2b624b=_0x2b624b||0x1f4;return function(_0x4ce10a){logger[_0xe3f5('0x7')](_0xe3f5('0x8'),_0x28653b,_0x2b624b,util[_0xe3f5('0x9')](_0x4ce10a,{'showHidden':![],'depth':null}));delete _0x4ce10a[_0xe3f5('0xa')];_0x1571b1[_0xe3f5('0xb')](_0x2b624b)[_0xe3f5('0xc')](_0x4ce10a);};}exports[_0xe3f5('0xd')]=function(_0x59278d,_0x2260ac){return info[_0xe3f5('0xe')]()[_0xe3f5('0xf')](function(_0xc930){return _0x2260ac[_0xe3f5('0xb')](0xc8)[_0xe3f5('0x10')](_0xc930);})['catch'](function(_0x995de9){return _0x2260ac[_0xe3f5('0xb')](0x1f4)['json'](_0x995de9);});};exports[_0xe3f5('0x11')]=function(_0x258452,_0x268896){var _0x148a07=[_0xe3f5('0x12')];return new BPromise(function(_0x168853,_0xd74bba){return exec(util[_0xe3f5('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x258452[_0xe3f5('0x14')][_0xe3f5('0x15')]),function(_0x1ccaa5,_0x559e3d,_0x4bc610){if(_0x1ccaa5){return _0xd74bba(_0x1ccaa5);}return _0x168853(_0x559e3d);});})['then'](function(_0x34d4e1){var _0x4c71cf=![];var _0x1d6bbf=_0x34d4e1['split'](/\n/);for(var _0x5588c7=0x0,_0x4fcefd=_0x148a07[_0xe3f5('0x16')];_0x5588c7<_0x4fcefd,_0x4c71cf===![];_0x5588c7+=0x1){if(_0x34d4e1[_0xe3f5('0x17')](_0x148a07[_0x5588c7])>=0x0){_0x4c71cf=!![];}}if(!_0x4c71cf){throw new Error(util[_0xe3f5('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x258452[_0xe3f5('0x14')][_0xe3f5('0x15')]));}process[_0xe3f5('0x18')](_0x258452[_0xe3f5('0x14')][_0xe3f5('0x15')],_0xe3f5('0x19'));return _0x268896['status'](0xc8)[_0xe3f5('0x10')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x258452[_0xe3f5('0x14')][_0xe3f5('0x15')])});})[_0xe3f5('0x1a')](handleError(_0x268896,null,_0xe3f5('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index af2c3c0..f3ecb83 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 _0x153f=['Router','fs-extra','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3ae7ab,_0x898902){var _0x9f04f2=function(_0x2243c0){while(--_0x2243c0){_0x3ae7ab['push'](_0x3ae7ab['shift']());}};_0x9f04f2(++_0x898902);}(_0x153f,0x15b));var _0xf153=function(_0x3983a2,_0x5adabe){_0x3983a2=_0x3983a2-0x0;var _0x5d1578=_0x153f[_0x3983a2];return _0x5d1578;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('0x15')]=router; \ No newline at end of file +var _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x3e1249,_0x329d83){var _0xc3b9d0=function(_0x12f390){while(--_0x12f390){_0x3e1249['push'](_0x3e1249['shift']());}};_0xc3b9d0(++_0x329d83);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7bae[_0x4baae2];return _0x1a2285;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d5f3ff8..9cbfeb6 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 _0xefe3=['STRING','#0091EA','sequelize'];(function(_0x4eebcf,_0x5a49f3){var _0x1612a5=function(_0x5d4264){while(--_0x5d4264){_0x4eebcf['push'](_0x4eebcf['shift']());}};_0x1612a5(++_0x5a49f3);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3efe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3efe('0x1')],'defaultValue':_0x3efe('0x2')},'description':{'type':Sequelize[_0x3efe('0x1')]}}; \ No newline at end of file +var _0x1b0e=['#0091EA','sequelize','exports','STRING','name'];(function(_0xe4d6c2,_0x10e41b){var _0xbf3dd9=function(_0x2cf5cc){while(--_0x2cf5cc){_0xe4d6c2['push'](_0xe4d6c2['shift']());}};_0xbf3dd9(++_0x10e41b);}(_0x1b0e,0x132));var _0xe1b0=function(_0x4e08e7,_0x2a488c){_0x4e08e7=_0x4e08e7-0x0;var _0x2800be=_0x1b0e[_0x4e08e7];return _0x2800be;};'use strict';var Sequelize=require(_0xe1b0('0x0'));module[_0xe1b0('0x1')]={'name':{'type':Sequelize[_0xe1b0('0x2')],'unique':_0xe1b0('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe1b0('0x2')],'defaultValue':_0xe1b0('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9c94ddf..b032ba4 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 _0x8be8=['bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','Tags','error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x342308,_0xdb4482){var _0x295eae=function(_0x366bb9){while(--_0x366bb9){_0x342308['push'](_0x342308['shift']());}};_0x295eae(++_0xdb4482);}(_0x8be8,0xf6));var _0x88be=function(_0x21b831,_0x2de10a){_0x21b831=_0x21b831-0x0;var _0x31354f=_0x8be8[_0x21b831];return _0x31354f;};'use strict';var emlformat=require(_0x88be('0x0'));var rimraf=require(_0x88be('0x1'));var zipdir=require(_0x88be('0x2'));var jsonpatch=require(_0x88be('0x3'));var rp=require(_0x88be('0x4'));var moment=require(_0x88be('0x5'));var BPromise=require(_0x88be('0x6'));var Mustache=require(_0x88be('0x7'));var util=require(_0x88be('0x8'));var path=require('path');var sox=require(_0x88be('0x9'));var csv=require('to-csv');var ejs=require(_0x88be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88be('0xb'));var squel=require(_0x88be('0xc'));var crypto=require(_0x88be('0xd'));var jsforce=require(_0x88be('0xe'));var deskjs=require(_0x88be('0xf'));var toCsv=require(_0x88be('0x10'));var querystring=require('querystring');var Papa=require(_0x88be('0x11'));var Redis=require('ioredis');var authService=require(_0x88be('0x12'));var qs=require(_0x88be('0x13'));var as=require(_0x88be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88be('0x15'))(_0x88be('0x16'));var utils=require(_0x88be('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88be('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321775,_0x484d78){_0x484d78=_0x484d78||0xcc;return function(_0x51ee23){if(_0x51ee23){return _0x321775[_0x88be('0x19')](_0x484d78);}return _0x321775[_0x88be('0x1a')](_0x484d78)[_0x88be('0x1b')]();};}function respondWithResult(_0x220d9f,_0x1f6f57){_0x1f6f57=_0x1f6f57||0xc8;return function(_0x209623){if(_0x209623){return _0x220d9f[_0x88be('0x1a')](_0x1f6f57)[_0x88be('0x1c')](_0x209623);}};}function respondWithFilteredResult(_0x4ec7cc,_0xefc67){return function(_0x94737d){if(_0x94737d){var _0x44a12f=typeof _0xefc67['offset']===_0x88be('0x1d')&&typeof _0xefc67[_0x88be('0x1e')]==='undefined';var _0x3566e7=_0x94737d[_0x88be('0x1f')];var _0xf43785=_0x44a12f?0x0:_0xefc67[_0x88be('0x20')];var _0x152918=_0x44a12f?_0x94737d[_0x88be('0x1f')]:_0xefc67[_0x88be('0x20')]+_0xefc67[_0x88be('0x1e')];var _0x53fb85;if(_0x152918>=_0x3566e7){_0x152918=_0x3566e7;_0x53fb85=0xc8;}else{_0x53fb85=0xce;}_0x4ec7cc[_0x88be('0x1a')](_0x53fb85);return _0x4ec7cc['set'](_0x88be('0x21'),_0xf43785+'-'+_0x152918+'/'+_0x3566e7)['json'](_0x94737d);}return null;};}function patchUpdates(_0x51c0e4){return function(_0x2fd77d){try{jsonpatch[_0x88be('0x22')](_0x2fd77d,_0x51c0e4,!![]);}catch(_0x4079f7){return BPromise['reject'](_0x4079f7);}return _0x2fd77d[_0x88be('0x23')]();};}function saveUpdates(_0x332e50,_0x1d0414){return function(_0x213580){if(_0x213580){return _0x213580[_0x88be('0x24')](_0x332e50)[_0x88be('0x25')](function(_0x466b19){return _0x466b19;});}return null;};}function removeEntity(_0x344c20,_0xdd27c1){return function(_0x215024){if(_0x215024){return _0x215024[_0x88be('0x26')]()[_0x88be('0x25')](function(){var _0x358d2c=_0x215024[_0x88be('0x27')]({'plain':!![]});var _0x1c3e45=_0x88be('0x28');return db['UserProfileResource'][_0x88be('0x26')]({'where':{'type':_0x1c3e45,'resourceId':_0x358d2c['id']}})[_0x88be('0x25')](function(){return _0x215024;});})[_0x88be('0x25')](function(){_0x344c20['status'](0xcc)[_0x88be('0x1b')]();});}};}function handleEntityNotFound(_0x381a99,_0x1ca77c){return function(_0x44c139){if(!_0x44c139){_0x381a99[_0x88be('0x19')](0x194);}return _0x44c139;};}function handleError(_0x4f8d52,_0x1fea9d){_0x1fea9d=_0x1fea9d||0x1f4;return function(_0x48f6a0){logger[_0x88be('0x29')](_0x48f6a0['stack']);if(_0x48f6a0[_0x88be('0x2a')]){delete _0x48f6a0[_0x88be('0x2a')];}_0x4f8d52[_0x88be('0x1a')](_0x1fea9d)[_0x88be('0x2b')](_0x48f6a0);};}exports[_0x88be('0x2c')]=function(_0x134910,_0x3180a5){var _0x390cf0={},_0x1de831={},_0x59d21f={'count':0x0,'rows':[]};var _0x46ca1c=_[_0x88be('0x2d')](db[_0x88be('0x2e')][_0x88be('0x2f')],function(_0x382be6){return{'name':_0x382be6[_0x88be('0x30')],'type':_0x382be6[_0x88be('0x31')][_0x88be('0x32')]};});_0x1de831[_0x88be('0x33')]=_['map'](_0x46ca1c,'name');_0x1de831[_0x88be('0x34')]=_[_0x88be('0x35')](_0x134910[_0x88be('0x34')]);_0x1de831['filters']=_['intersection'](_0x1de831[_0x88be('0x33')],_0x1de831['query']);_0x390cf0[_0x88be('0x36')]=_['intersection'](_0x1de831[_0x88be('0x33')],qs[_0x88be('0x37')](_0x134910[_0x88be('0x34')][_0x88be('0x37')]));_0x390cf0[_0x88be('0x36')]=_0x390cf0[_0x88be('0x36')][_0x88be('0x38')]?_0x390cf0[_0x88be('0x36')]:_0x1de831[_0x88be('0x33')];if(!_0x134910[_0x88be('0x34')][_0x88be('0x39')](_0x88be('0x3a'))){_0x390cf0[_0x88be('0x1e')]=qs[_0x88be('0x1e')](_0x134910[_0x88be('0x34')][_0x88be('0x1e')]);_0x390cf0[_0x88be('0x20')]=qs[_0x88be('0x20')](_0x134910[_0x88be('0x34')][_0x88be('0x20')]);}_0x390cf0[_0x88be('0x3b')]=qs[_0x88be('0x3c')](_0x134910[_0x88be('0x34')][_0x88be('0x3c')]);_0x390cf0['where']=qs['filters'](_['pick'](_0x134910[_0x88be('0x34')],_0x1de831['filters']),_0x46ca1c);if(_0x134910[_0x88be('0x34')][_0x88be('0x3d')]){_0x390cf0[_0x88be('0x3e')]=_[_0x88be('0x3f')](_0x390cf0[_0x88be('0x3e')],{'$or':_[_0x88be('0x2d')](_0x46ca1c,function(_0x224c91){if(_0x224c91['type']!=='VIRTUAL'){var _0x2ed10d={};_0x2ed10d[_0x224c91[_0x88be('0x2a')]]={'$like':'%'+_0x134910[_0x88be('0x34')][_0x88be('0x3d')]+'%'};return _0x2ed10d;}})});}_0x390cf0=_['merge']({},_0x390cf0,_0x134910[_0x88be('0x40')]);var _0x1f65a8={'where':_0x390cf0[_0x88be('0x3e')]};return db[_0x88be('0x2e')]['count'](_0x1f65a8)[_0x88be('0x25')](function(_0x429f7b){_0x59d21f[_0x88be('0x1f')]=_0x429f7b;if(_0x134910[_0x88be('0x34')][_0x88be('0x41')]){_0x390cf0[_0x88be('0x42')]=[{'all':!![]}];}return db[_0x88be('0x2e')][_0x88be('0x43')](_0x390cf0);})[_0x88be('0x25')](function(_0x5261d7){_0x59d21f[_0x88be('0x44')]=_0x5261d7;return _0x59d21f;})['then'](respondWithFilteredResult(_0x3180a5,_0x390cf0))['catch'](handleError(_0x3180a5,null));};exports[_0x88be('0x45')]=function(_0x101e20,_0x267cdc){var _0xae6c17={'raw':!![],'where':{'id':_0x101e20[_0x88be('0x46')]['id']}},_0x4aca27={};_0x4aca27[_0x88be('0x33')]=_[_0x88be('0x35')](db[_0x88be('0x2e')][_0x88be('0x2f')]);_0x4aca27['query']=_[_0x88be('0x35')](_0x101e20[_0x88be('0x34')]);_0x4aca27['filters']=_[_0x88be('0x47')](_0x4aca27['model'],_0x4aca27[_0x88be('0x34')]);_0xae6c17['attributes']=_[_0x88be('0x47')](_0x4aca27[_0x88be('0x33')],qs['fields'](_0x101e20[_0x88be('0x34')][_0x88be('0x37')]));_0xae6c17[_0x88be('0x36')]=_0xae6c17[_0x88be('0x36')][_0x88be('0x38')]?_0xae6c17[_0x88be('0x36')]:_0x4aca27['model'];if(_0x101e20['query'][_0x88be('0x41')]){_0xae6c17[_0x88be('0x42')]=[{'all':!![]}];}_0xae6c17=_[_0x88be('0x3f')]({},_0xae6c17,_0x101e20[_0x88be('0x40')]);return db[_0x88be('0x2e')][_0x88be('0x48')](_0xae6c17)['then'](handleEntityNotFound(_0x267cdc,null))['then'](respondWithResult(_0x267cdc,null))[_0x88be('0x49')](handleError(_0x267cdc,null));};exports[_0x88be('0x4a')]=function(_0xf60d87,_0x174488){return db['Tag']['create'](_0xf60d87[_0x88be('0x4b')],{})['then'](function(_0x3f5de3){var _0x4007cd=_0xf60d87[_0x88be('0x4c')]['get']({'plain':!![]});if(!_0x4007cd)throw new Error(_0x88be('0x4d'));if(_0x4007cd[_0x88be('0x4e')]==='user'){var _0x3dc85b=_0x3f5de3['get']({'plain':!![]});var _0x1956ae='Tags';return db[_0x88be('0x4f')][_0x88be('0x48')]({'where':{'name':_0x1956ae,'userProfileId':_0x4007cd[_0x88be('0x50')]},'raw':!![]})[_0x88be('0x25')](function(_0xffc8a9){if(_0xffc8a9&&_0xffc8a9[_0x88be('0x51')]===0x0){return db[_0x88be('0x52')][_0x88be('0x4a')]({'name':_0x3dc85b['name'],'resourceId':_0x3dc85b['id'],'type':_0xffc8a9[_0x88be('0x2a')],'sectionId':_0xffc8a9['id']},{})[_0x88be('0x25')](function(){return _0x3f5de3;});}else{return _0x3f5de3;}})['catch'](function(_0x44dd80){logger[_0x88be('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44dd80);throw _0x44dd80;});}return _0x3f5de3;})[_0x88be('0x25')](respondWithResult(_0x174488,0xc9))['catch'](handleError(_0x174488,null));};exports[_0x88be('0x24')]=function(_0x22352f,_0x288c13){if(_0x22352f[_0x88be('0x4b')]['id']){delete _0x22352f['body']['id'];}return db[_0x88be('0x2e')][_0x88be('0x48')]({'where':{'id':_0x22352f[_0x88be('0x46')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x288c13,null))['then'](saveUpdates(_0x22352f[_0x88be('0x4b')],null))['then'](respondWithResult(_0x288c13,null))['catch'](handleError(_0x288c13,null));};exports[_0x88be('0x26')]=function(_0x4849a1,_0x341349){return db[_0x88be('0x2e')][_0x88be('0x48')]({'where':{'id':_0x4849a1[_0x88be('0x46')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x341349,null))['then'](removeEntity(_0x341349,null))[_0x88be('0x49')](handleError(_0x341349,null));};exports[_0x88be('0x53')]=function(_0x29ad7e,_0x132f83){return db[_0x88be('0x2e')][_0x88be('0x53')]()[_0x88be('0x25')](respondWithResult(_0x132f83,null))['catch'](handleError(_0x132f83,null));}; \ No newline at end of file +var _0x5d58=['params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','get','Tags','UserProfileResource','sendStatus','stack','name','send','Tag','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows'];(function(_0x1c4c5e,_0x2c7e69){var _0x3e902e=function(_0x309cab){while(--_0x309cab){_0x1c4c5e['push'](_0x1c4c5e['shift']());}};_0x3e902e(++_0x2c7e69);}(_0x5d58,0x187));var _0x85d5=function(_0x4ca54e,_0x341c88){_0x4ca54e=_0x4ca54e-0x0;var _0x58714d=_0x5d58[_0x4ca54e];return _0x58714d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){var _0x46c06e=_0x4da71b[_0x85d5('0x1d')]({'plain':!![]});var _0x466bbd=_0x85d5('0x1e');return db[_0x85d5('0x1f')]['destroy']({'where':{'type':_0x466bbd,'resourceId':_0x46c06e['id']}})[_0x85d5('0x1c')](function(){return _0x4da71b;});})['then'](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x233ccd,_0x5cc2cf){return function(_0x2d0497){if(!_0x2d0497){_0x233ccd[_0x85d5('0x20')](0x194);}return _0x2d0497;};}function handleError(_0x815808,_0x370c97){_0x370c97=_0x370c97||0x1f4;return function(_0x4605c5){logger['error'](_0x4605c5[_0x85d5('0x21')]);if(_0x4605c5[_0x85d5('0x22')]){delete _0x4605c5[_0x85d5('0x22')];}_0x815808[_0x85d5('0x13')](_0x370c97)[_0x85d5('0x23')](_0x4605c5);};}exports['index']=function(_0x539dc9,_0x2ce7a9){var _0x24a0a3={},_0x2d1157={},_0x176dd3={'count':0x0,'rows':[]};var _0x5cc30c=_['map'](db[_0x85d5('0x24')][_0x85d5('0x25')],function(_0x5561dd){return{'name':_0x5561dd['fieldName'],'type':_0x5561dd[_0x85d5('0x26')][_0x85d5('0x27')]};});_0x2d1157['model']=_[_0x85d5('0x28')](_0x5cc30c,'name');_0x2d1157[_0x85d5('0x29')]=_[_0x85d5('0x2a')](_0x539dc9['query']);_0x2d1157[_0x85d5('0x2b')]=_[_0x85d5('0x2c')](_0x2d1157[_0x85d5('0x2d')],_0x2d1157[_0x85d5('0x29')]);_0x24a0a3['attributes']=_['intersection'](_0x2d1157[_0x85d5('0x2d')],qs[_0x85d5('0x2e')](_0x539dc9[_0x85d5('0x29')][_0x85d5('0x2e')]));_0x24a0a3[_0x85d5('0x2f')]=_0x24a0a3[_0x85d5('0x2f')][_0x85d5('0x30')]?_0x24a0a3[_0x85d5('0x2f')]:_0x2d1157[_0x85d5('0x2d')];if(!_0x539dc9['query']['hasOwnProperty'](_0x85d5('0x31'))){_0x24a0a3[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x539dc9[_0x85d5('0x29')][_0x85d5('0x18')]);_0x24a0a3[_0x85d5('0x16')]=qs[_0x85d5('0x16')](_0x539dc9[_0x85d5('0x29')]['offset']);}_0x24a0a3[_0x85d5('0x32')]=qs[_0x85d5('0x33')](_0x539dc9[_0x85d5('0x29')][_0x85d5('0x33')]);_0x24a0a3['where']=qs[_0x85d5('0x2b')](_[_0x85d5('0x34')](_0x539dc9[_0x85d5('0x29')],_0x2d1157[_0x85d5('0x2b')]),_0x5cc30c);if(_0x539dc9['query'][_0x85d5('0x35')]){_0x24a0a3['where']=_['merge'](_0x24a0a3[_0x85d5('0x36')],{'$or':_['map'](_0x5cc30c,function(_0x446993){if(_0x446993['type']!=='VIRTUAL'){var _0x1d17e9={};_0x1d17e9[_0x446993[_0x85d5('0x22')]]={'$like':'%'+_0x539dc9[_0x85d5('0x29')][_0x85d5('0x35')]+'%'};return _0x1d17e9;}})});}_0x24a0a3=_[_0x85d5('0x37')]({},_0x24a0a3,_0x539dc9['options']);var _0x519ced={'where':_0x24a0a3[_0x85d5('0x36')]};return db[_0x85d5('0x24')][_0x85d5('0x19')](_0x519ced)[_0x85d5('0x1c')](function(_0xdd8b3e){_0x176dd3[_0x85d5('0x19')]=_0xdd8b3e;if(_0x539dc9['query']['includeAll']){_0x24a0a3[_0x85d5('0x38')]=[{'all':!![]}];}return db['Tag'][_0x85d5('0x39')](_0x24a0a3);})[_0x85d5('0x1c')](function(_0x7dd430){_0x176dd3[_0x85d5('0x3a')]=_0x7dd430;return _0x176dd3;})[_0x85d5('0x1c')](respondWithFilteredResult(_0x2ce7a9,_0x24a0a3))['catch'](handleError(_0x2ce7a9,null));};exports['show']=function(_0x34a42b,_0x3325aa){var _0x1f699e={'raw':!![],'where':{'id':_0x34a42b[_0x85d5('0x3b')]['id']}},_0x45a6cc={};_0x45a6cc[_0x85d5('0x2d')]=_[_0x85d5('0x2a')](db[_0x85d5('0x24')][_0x85d5('0x25')]);_0x45a6cc[_0x85d5('0x29')]=_[_0x85d5('0x2a')](_0x34a42b[_0x85d5('0x29')]);_0x45a6cc[_0x85d5('0x2b')]=_[_0x85d5('0x2c')](_0x45a6cc[_0x85d5('0x2d')],_0x45a6cc[_0x85d5('0x29')]);_0x1f699e[_0x85d5('0x2f')]=_['intersection'](_0x45a6cc['model'],qs[_0x85d5('0x2e')](_0x34a42b[_0x85d5('0x29')][_0x85d5('0x2e')]));_0x1f699e[_0x85d5('0x2f')]=_0x1f699e[_0x85d5('0x2f')][_0x85d5('0x30')]?_0x1f699e['attributes']:_0x45a6cc[_0x85d5('0x2d')];if(_0x34a42b['query']['includeAll']){_0x1f699e[_0x85d5('0x38')]=[{'all':!![]}];}_0x1f699e=_[_0x85d5('0x37')]({},_0x1f699e,_0x34a42b[_0x85d5('0x3c')]);return db[_0x85d5('0x24')][_0x85d5('0x3d')](_0x1f699e)['then'](handleEntityNotFound(_0x3325aa,null))[_0x85d5('0x1c')](respondWithResult(_0x3325aa,null))['catch'](handleError(_0x3325aa,null));};exports[_0x85d5('0x3e')]=function(_0xd8db57,_0x219154){return db['Tag']['create'](_0xd8db57['body'],{})[_0x85d5('0x1c')](function(_0x925f98){var _0x2d4fe4=_0xd8db57['user']['get']({'plain':!![]});if(!_0x2d4fe4)throw new Error(_0x85d5('0x3f'));if(_0x2d4fe4[_0x85d5('0x40')]===_0x85d5('0x41')){var _0x288b56=_0x925f98['get']({'plain':!![]});var _0x3f69ea=_0x85d5('0x1e');return db[_0x85d5('0x42')][_0x85d5('0x3d')]({'where':{'name':_0x3f69ea,'userProfileId':_0x2d4fe4[_0x85d5('0x43')]},'raw':!![]})[_0x85d5('0x1c')](function(_0x31cdeb){if(_0x31cdeb&&_0x31cdeb[_0x85d5('0x44')]===0x0){return db[_0x85d5('0x1f')][_0x85d5('0x3e')]({'name':_0x288b56[_0x85d5('0x22')],'resourceId':_0x288b56['id'],'type':_0x31cdeb[_0x85d5('0x22')],'sectionId':_0x31cdeb['id']},{})[_0x85d5('0x1c')](function(){return _0x925f98;});}else{return _0x925f98;}})[_0x85d5('0x45')](function(_0x34bc14){logger['error'](_0x85d5('0x46'),_0x34bc14);throw _0x34bc14;});}return _0x925f98;})[_0x85d5('0x1c')](respondWithResult(_0x219154,0xc9))[_0x85d5('0x45')](handleError(_0x219154,null));};exports[_0x85d5('0x47')]=function(_0x548b37,_0x32cd99){if(_0x548b37['body']['id']){delete _0x548b37[_0x85d5('0x48')]['id'];}return db[_0x85d5('0x24')][_0x85d5('0x3d')]({'where':{'id':_0x548b37[_0x85d5('0x3b')]['id']}})['then'](handleEntityNotFound(_0x32cd99,null))[_0x85d5('0x1c')](saveUpdates(_0x548b37['body'],null))['then'](respondWithResult(_0x32cd99,null))['catch'](handleError(_0x32cd99,null));};exports[_0x85d5('0x49')]=function(_0x410d7f,_0x295d81){return db[_0x85d5('0x24')][_0x85d5('0x3d')]({'where':{'id':_0x410d7f['params']['id']}})['then'](handleEntityNotFound(_0x295d81,null))[_0x85d5('0x1c')](removeEntity(_0x295d81,null))[_0x85d5('0x45')](handleError(_0x295d81,null));};exports[_0x85d5('0x4a')]=function(_0xfac901,_0x5809d4){return db[_0x85d5('0x24')][_0x85d5('0x4a')]()[_0x85d5('0x1c')](respondWithResult(_0x5809d4,null))['catch'](handleError(_0x5809d4,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 638a18f..4a06554 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 _0xe25b=['bluebird','request-promise','path','rimraf','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x5a150c,_0x583b40){var _0x17d8ea=function(_0x41092b){while(--_0x41092b){_0x5a150c['push'](_0x5a150c['shift']());}};_0x17d8ea(++_0x583b40);}(_0xe25b,0xe4));var _0xbe25=function(_0x58b28b,_0x528710){_0x58b28b=_0x58b28b-0x0;var _0x22a632=_0xe25b[_0x58b28b];return _0x22a632;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var logger=require(_0xbe25('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbe25('0x3'));var rp=require(_0xbe25('0x4'));var fs=require('fs');var path=require(_0xbe25('0x5'));var rimraf=require(_0xbe25('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe25('0x7'));module['exports']=function(_0xeba575,_0x3b9c86){return _0xeba575[_0xbe25('0x8')](_0xbe25('0x9'),attributes,{'tableName':_0xbe25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2c2=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Tag','tools_tags'];(function(_0xf7202,_0x26b9ec){var _0x1a6f82=function(_0x58256b){while(--_0x58256b){_0xf7202['push'](_0xf7202['shift']());}};_0x1a6f82(++_0x26b9ec);}(_0xd2c2,0x18c));var _0x2d2c=function(_0x341787,_0x5b7560){_0x341787=_0x341787-0x0;var _0x1a15e7=_0xd2c2[_0x341787];return _0x1a15e7;};'use strict';var _=require(_0x2d2c('0x0'));var util=require('util');var logger=require(_0x2d2c('0x1'))(_0x2d2c('0x2'));var moment=require(_0x2d2c('0x3'));var BPromise=require(_0x2d2c('0x4'));var rp=require(_0x2d2c('0x5'));var fs=require('fs');var path=require(_0x2d2c('0x6'));var rimraf=require(_0x2d2c('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x2d2c('0x8')]=function(_0x1c7914,_0x4b4c9c){return _0x1c7914[_0x2d2c('0x9')](_0x2d2c('0xa'),attributes,{'tableName':_0x2d2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 207aaed..c1fbb49 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x577a2c,_0x34f252){var _0x458b35=function(_0x2814d2){while(--_0x2814d2){_0x577a2c['push'](_0x577a2c['shift']());}};_0x458b35(++_0x34f252);}(_0x55ca,0x126));var _0xa55c=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0x55ca[_0x4cee4b];return _0x4d891d;};'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')]('Tag,\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')]('Tag,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0xa8a8=['stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0xf1af03,_0x3ffc26){var _0x4ae9f0=function(_0x192f2c){while(--_0x192f2c){_0xf1af03['push'](_0xf1af03['shift']());}};_0x4ae9f0(++_0x3ffc26);}(_0xa8a8,0xec));var _0x8a8a=function(_0x67c85c,_0x42d2bd){_0x67c85c=_0x67c85c-0x0;var _0x190d36=_0xa8a8[_0x67c85c];return _0x190d36;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('Tag,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('Tag,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 8e51bf5..dc89136 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 a79cc5e..33cf6ca 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 _0xbaf0=['name','exports','STRING'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x171793,_0x2b767b){var _0x58d4fc=function(_0x1294ca){while(--_0x1294ca){_0x171793['push'](_0x171793['shift']());}};_0x58d4fc(++_0x2b767b);}(_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 9a93c56..c27573d 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 _0xc9f0=['upsert','isNil','format','interface','all','spread','removeAgents','Chat','Mail','emit','Queue:remove','VoicePrefixId','getAgents','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','sendStatus','status','json','undefined','limit','offset','Content-Range','apply','reject','save','then','error','stack','name','send','index','Team','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','find','params','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','map','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','channel','ValidationError','keys','toLowerCase','get','capitalize','Queues','addQueues','findOne','isValidChannel','Unknown\x20channel','removeQueues','remove','ids','isArray','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue','Queue:save','Voice','online','voicePause','UserVoiceQueueRt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc9f0,0xa8));var _0x0c9f=function(_0x66c435,_0x1dfb48){_0x66c435=_0x66c435-0x0;var _0x3e174a=_0xc9f0[_0x66c435];return _0x3e174a;};'use strict';var emlformat=require(_0x0c9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c9f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c9f('0x2'));var moment=require(_0x0c9f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0c9f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0c9f('0x5'));var csv=require(_0x0c9f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c9f('0x7'));var _=require('lodash');var squel=require(_0x0c9f('0x8'));var crypto=require(_0x0c9f('0x9'));var jsforce=require(_0x0c9f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0c9f('0x6'));var querystring=require(_0x0c9f('0xb'));var Papa=require(_0x0c9f('0xc'));var Redis=require('ioredis');var authService=require(_0x0c9f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0c9f('0xe'));var hardwareService=require(_0x0c9f('0xf'));var logger=require(_0x0c9f('0x10'))('api');var utils=require(_0x0c9f('0x11'));var config=require(_0x0c9f('0x12'));var licenseUtil=require(_0x0c9f('0x13'));var db=require(_0x0c9f('0x14'))['db'];config[_0x0c9f('0x15')]=_['defaults'](config[_0x0c9f('0x15')],{'host':_0x0c9f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c9f('0x15')]));require(_0x0c9f('0x17'))[_0x0c9f('0x18')](socket);function respondWithStatusCode(_0x5023ce,_0x21d464){_0x21d464=_0x21d464||0xcc;return function(_0x2d6ca6){if(_0x2d6ca6){return _0x5023ce[_0x0c9f('0x19')](_0x21d464);}return _0x5023ce[_0x0c9f('0x1a')](_0x21d464)['end']();};}function respondWithResult(_0x477d32,_0x422235){_0x422235=_0x422235||0xc8;return function(_0x180cb0){if(_0x180cb0){return _0x477d32[_0x0c9f('0x1a')](_0x422235)[_0x0c9f('0x1b')](_0x180cb0);}};}function respondWithFilteredResult(_0x4a87b0,_0xe46b99){return function(_0x2ff2d1){if(_0x2ff2d1){var _0x4bdf98=typeof _0xe46b99['offset']===_0x0c9f('0x1c')&&typeof _0xe46b99[_0x0c9f('0x1d')]===_0x0c9f('0x1c');var _0x3b77c8=_0x2ff2d1['count'];var _0x34f136=_0x4bdf98?0x0:_0xe46b99['offset'];var _0x3f7ac4=_0x4bdf98?_0x2ff2d1['count']:_0xe46b99[_0x0c9f('0x1e')]+_0xe46b99['limit'];var _0x1312a8;if(_0x3f7ac4>=_0x3b77c8){_0x3f7ac4=_0x3b77c8;_0x1312a8=0xc8;}else{_0x1312a8=0xce;}_0x4a87b0[_0x0c9f('0x1a')](_0x1312a8);return _0x4a87b0['set'](_0x0c9f('0x1f'),_0x34f136+'-'+_0x3f7ac4+'/'+_0x3b77c8)[_0x0c9f('0x1b')](_0x2ff2d1);}return null;};}function patchUpdates(_0x3a609f){return function(_0x3cc36f){try{jsonpatch[_0x0c9f('0x20')](_0x3cc36f,_0x3a609f,!![]);}catch(_0x3b239c){return BPromise[_0x0c9f('0x21')](_0x3b239c);}return _0x3cc36f[_0x0c9f('0x22')]();};}function saveUpdates(_0x572a21,_0x13bf69){return function(_0x4f853c){if(_0x4f853c){return _0x4f853c['update'](_0x572a21)[_0x0c9f('0x23')](function(_0x3ddd27){return _0x3ddd27;});}return null;};}function handleEntityNotFound(_0x593e44,_0x1c729b){return function(_0x3fa62c){if(!_0x3fa62c){_0x593e44['sendStatus'](0x194);}return _0x3fa62c;};}function handleError(_0x4d8321,_0x242d52){_0x242d52=_0x242d52||0x1f4;return function(_0x248553){logger[_0x0c9f('0x24')](_0x248553[_0x0c9f('0x25')]);if(_0x248553[_0x0c9f('0x26')]){delete _0x248553[_0x0c9f('0x26')];}_0x4d8321[_0x0c9f('0x1a')](_0x242d52)[_0x0c9f('0x27')](_0x248553);};}exports[_0x0c9f('0x28')]=function(_0xfcba9a,_0x2f5f34){var _0x21f861={},_0x4e90e={},_0x4ed8ee={'count':0x0,'rows':[]};var _0x44b477=_['map'](db[_0x0c9f('0x29')][_0x0c9f('0x2a')],function(_0x2e7fce){return{'name':_0x2e7fce[_0x0c9f('0x2b')],'type':_0x2e7fce['type']['key']};});_0x4e90e[_0x0c9f('0x2c')]=_['map'](_0x44b477,_0x0c9f('0x26'));_0x4e90e[_0x0c9f('0x2d')]=_['keys'](_0xfcba9a[_0x0c9f('0x2d')]);_0x4e90e[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x4e90e[_0x0c9f('0x2c')],_0x4e90e[_0x0c9f('0x2d')]);_0x21f861[_0x0c9f('0x30')]=_['intersection'](_0x4e90e[_0x0c9f('0x2c')],qs[_0x0c9f('0x31')](_0xfcba9a[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x21f861[_0x0c9f('0x30')]=_0x21f861[_0x0c9f('0x30')][_0x0c9f('0x32')]?_0x21f861[_0x0c9f('0x30')]:_0x4e90e['model'];if(!_0xfcba9a[_0x0c9f('0x2d')][_0x0c9f('0x33')](_0x0c9f('0x34'))){_0x21f861['limit']=qs[_0x0c9f('0x1d')](_0xfcba9a['query']['limit']);_0x21f861[_0x0c9f('0x1e')]=qs[_0x0c9f('0x1e')](_0xfcba9a[_0x0c9f('0x2d')]['offset']);}_0x21f861[_0x0c9f('0x35')]=qs[_0x0c9f('0x36')](_0xfcba9a[_0x0c9f('0x2d')]['sort']);_0x21f861[_0x0c9f('0x37')]=qs[_0x0c9f('0x2e')](_[_0x0c9f('0x38')](_0xfcba9a[_0x0c9f('0x2d')],_0x4e90e[_0x0c9f('0x2e')]),_0x44b477);if(_0xfcba9a['query']['filter']){_0x21f861[_0x0c9f('0x37')]=_[_0x0c9f('0x39')](_0x21f861[_0x0c9f('0x37')],{'$or':_['map'](_0x44b477,function(_0x51ad63){if(_0x51ad63[_0x0c9f('0x3a')]!==_0x0c9f('0x3b')){var _0x22d7bd={};_0x22d7bd[_0x51ad63[_0x0c9f('0x26')]]={'$like':'%'+_0xfcba9a[_0x0c9f('0x2d')][_0x0c9f('0x3c')]+'%'};return _0x22d7bd;}})});}_0x21f861=_[_0x0c9f('0x39')]({},_0x21f861,_0xfcba9a[_0x0c9f('0x3d')]);var _0x1c2091={'where':_0x21f861[_0x0c9f('0x37')]};return db[_0x0c9f('0x29')][_0x0c9f('0x3e')](_0x1c2091)[_0x0c9f('0x23')](function(_0x5f1769){_0x4ed8ee[_0x0c9f('0x3e')]=_0x5f1769;if(_0xfcba9a['query']['includeAll']){_0x21f861[_0x0c9f('0x3f')]=[{'all':!![]}];}return db[_0x0c9f('0x29')][_0x0c9f('0x40')](_0x21f861);})[_0x0c9f('0x23')](function(_0xc2d331){_0x4ed8ee[_0x0c9f('0x41')]=_0xc2d331;return _0x4ed8ee;})[_0x0c9f('0x23')](respondWithFilteredResult(_0x2f5f34,_0x21f861))[_0x0c9f('0x42')](handleError(_0x2f5f34,null));};exports[_0x0c9f('0x43')]=function(_0x4db6c5,_0x30f4bf){var _0x238219={'raw':![],'where':{'id':_0x4db6c5['params']['id']}},_0x42004c={};_0x42004c[_0x0c9f('0x2c')]=_['keys'](db[_0x0c9f('0x29')]['rawAttributes']);_0x42004c[_0x0c9f('0x2d')]=_['keys'](_0x4db6c5[_0x0c9f('0x2d')]);_0x42004c[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x42004c[_0x0c9f('0x2c')],_0x42004c[_0x0c9f('0x2d')]);_0x238219['attributes']=_[_0x0c9f('0x2f')](_0x42004c[_0x0c9f('0x2c')],qs[_0x0c9f('0x31')](_0x4db6c5[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x238219[_0x0c9f('0x30')]=_0x238219[_0x0c9f('0x30')][_0x0c9f('0x32')]?_0x238219[_0x0c9f('0x30')]:_0x42004c[_0x0c9f('0x2c')];if(_0x4db6c5[_0x0c9f('0x2d')][_0x0c9f('0x44')]){_0x238219[_0x0c9f('0x3f')]=[{'all':!![]}];}_0x238219=_[_0x0c9f('0x39')]({},_0x238219,_0x4db6c5[_0x0c9f('0x3d')]);return db[_0x0c9f('0x29')]['find'](_0x238219)[_0x0c9f('0x23')](handleEntityNotFound(_0x30f4bf,null))[_0x0c9f('0x23')](respondWithResult(_0x30f4bf,null))[_0x0c9f('0x42')](handleError(_0x30f4bf,null));};exports[_0x0c9f('0x45')]=function(_0x16056a,_0x15c9d4){return db[_0x0c9f('0x29')]['create'](_0x16056a[_0x0c9f('0x46')],{})['then'](function(_0x4b3254){var _0x1e2a6e=_0x16056a[_0x0c9f('0x47')]['get']({'plain':!![]});if(!_0x1e2a6e)throw new Error(_0x0c9f('0x48'));if(_0x1e2a6e[_0x0c9f('0x49')]==='user'){var _0x1d47b9=_0x4b3254['get']({'plain':!![]});var _0x2e281c=_0x0c9f('0x4a');return db[_0x0c9f('0x4b')]['find']({'where':{'name':_0x2e281c,'userProfileId':_0x1e2a6e[_0x0c9f('0x4c')]},'raw':!![]})[_0x0c9f('0x23')](function(_0x2e6f7d){if(_0x2e6f7d&&_0x2e6f7d[_0x0c9f('0x4d')]===0x0){return db[_0x0c9f('0x4e')][_0x0c9f('0x45')]({'name':_0x1d47b9[_0x0c9f('0x26')],'resourceId':_0x1d47b9['id'],'type':_0x2e6f7d['name'],'sectionId':_0x2e6f7d['id']},{})[_0x0c9f('0x23')](function(){return _0x4b3254;});}else{return _0x4b3254;}})[_0x0c9f('0x42')](function(_0x3e5dcd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e5dcd);throw _0x3e5dcd;});}return _0x4b3254;})['then'](respondWithResult(_0x15c9d4,0xc9))[_0x0c9f('0x42')](handleError(_0x15c9d4,null));};exports[_0x0c9f('0x4f')]=function(_0x28e647,_0x397942){if(_0x28e647['body']['id']){delete _0x28e647[_0x0c9f('0x46')]['id'];}return db[_0x0c9f('0x29')][_0x0c9f('0x50')]({'where':{'id':_0x28e647[_0x0c9f('0x51')]['id']}})[_0x0c9f('0x23')](handleEntityNotFound(_0x397942,null))[_0x0c9f('0x23')](saveUpdates(_0x28e647['body'],null))['then'](respondWithResult(_0x397942,null))[_0x0c9f('0x42')](handleError(_0x397942,null));};exports[_0x0c9f('0x52')]=function(_0x126472,_0x45ef43){var _0x5d0258=_0x126472[_0x0c9f('0x51')]['id'];var _0x2031f8=[];return db[_0x0c9f('0x53')]['transaction'](function(_0x2a2035){var _0x5e67ce=_0x0c9f('0x54')+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x5e67ce,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')]['SELECT'],'raw':!![],'transaction':_0x2a2035})[_0x0c9f('0x23')](function(_0x38da10){_0x2031f8=_[_0x0c9f('0x57')](_0x38da10,function(_0x4616e1){return Number(_0x4616e1[_0x0c9f('0x58')]);});})[_0x0c9f('0x23')](function(){var _0x260b2e=_0x0c9f('0x59')+_0x5d0258;return db['sequelize'][_0x0c9f('0x2d')](_0x260b2e,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x5d1634){var _0x52f0e3=_[_0x0c9f('0x57')](_0x5d1634,function(_0x4e94af){return Number(_0x4e94af[_0x0c9f('0x5b')]);});return db[_0x0c9f('0x5c')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'VoiceQueueId':{'$in':_0x52f0e3}},'transaction':_0x2a2035});})['then'](function(){var _0x47d431=_0x0c9f('0x5d')+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x47d431,{'type':db['Sequelize'][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x5a6d64){var _0x26dfa7=_['map'](_0x5a6d64,function(_0x564b14){return Number(_0x564b14[_0x0c9f('0x5e')]);});return db[_0x0c9f('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x2031f8},'MailQueueId':{'$in':_0x26dfa7}},'transaction':_0x2a2035});})['then'](function(){var _0x34e95f=_0x0c9f('0x60')+_0x5d0258;return db['sequelize'][_0x0c9f('0x2d')](_0x34e95f,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')]['SELECT'],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x1d4090){var _0x369966=_[_0x0c9f('0x57')](_0x1d4090,function(_0x9454d){return Number(_0x9454d[_0x0c9f('0x61')]);});return db[_0x0c9f('0x62')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'SmsQueueId':{'$in':_0x369966}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){var _0x1fe32e='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x1fe32e,{'type':db['Sequelize'][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x1d204a){var _0x22c22d=_[_0x0c9f('0x57')](_0x1d204a,function(_0x2f682e){return Number(_0x2f682e[_0x0c9f('0x63')]);});return db[_0x0c9f('0x64')]['destroy']({'where':{'UserId':{'$in':_0x2031f8},'ChatQueueId':{'$in':_0x22c22d}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){var _0xb33e84=_0x0c9f('0x65')+_0x5d0258;return db[_0x0c9f('0x53')]['query'](_0xb33e84,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x31d82d){var _0x1a8c1b=_[_0x0c9f('0x57')](_0x31d82d,function(_0x2d31eb){return Number(_0x2d31eb['FaxQueueId']);});return db[_0x0c9f('0x66')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'FaxQueueId':{'$in':_0x1a8c1b}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){var _0x515d1a='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x515d1a,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})['then'](function(_0x200d7a){var _0x8b7b=_[_0x0c9f('0x57')](_0x200d7a,function(_0x35e914){return Number(_0x35e914[_0x0c9f('0x67')]);});return db[_0x0c9f('0x68')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'OpenchannelQueueId':{'$in':_0x8b7b}},'transaction':_0x2a2035});})['then'](function(){var _0x4c7ef9=_0x0c9f('0x69')+_0x5d0258;return db['sequelize'][_0x0c9f('0x2d')](_0x4c7ef9,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x10298f){var _0x54843e=_[_0x0c9f('0x57')](_0x10298f,function(_0x44354f){return Number(_0x44354f['WhatsappQueueId']);});return db[_0x0c9f('0x6a')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'WhatsappQueueId':{'$in':_0x54843e}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){return db[_0x0c9f('0x6b')][_0x0c9f('0x50')]({'where':{'TeamId':_0x5d0258}});})['then'](function(_0x4ea140){if(_0x4ea140===null){return;}return db[_0x0c9f('0x6c')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'VoicePrefixId':_0x4ea140['VoicePrefixId']},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){return db[_0x0c9f('0x29')][_0x0c9f('0x52')]({'where':{'id':_0x5d0258},'cascade':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x179987){if(_0x179987===0x0){_0x45ef43[_0x0c9f('0x19')](0x194);}else{return db[_0x0c9f('0x4e')][_0x0c9f('0x52')]({'where':{'type':_0x0c9f('0x4a'),'resourceId':_0x5d0258},'cascade':!![],'transaction':_0x2a2035})[_0x0c9f('0x23')](function(){_0x45ef43[_0x0c9f('0x1a')](0xcc)['end']();});}})[_0x0c9f('0x42')](function(_0x529f41){_0x45ef43[_0x0c9f('0x1a')](0x1f4)[_0x0c9f('0x27')](_0x529f41);});});};exports[_0x0c9f('0x6d')]=function(_0x54dc79,_0x2e1f60,_0xa2c773){return db['Team']['findOne']({'where':{'id':_0x54dc79['params']['id']}})[_0x0c9f('0x23')](handleEntityNotFound(_0x2e1f60,null))['then'](function(_0xf86fde){if(!_0x54dc79['query'][_0x0c9f('0x6e')]||!utils['isValidChannel'](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x6e')])){throw new db[(_0x0c9f('0x55'))][(_0x0c9f('0x6f'))]('Unknown\x20channel');}var _0x399a83={};var _0x1ec6d4={};_0x1ec6d4[_0x0c9f('0x2c')]=_[_0x0c9f('0x70')](db[_['capitalize'](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+'Queue'][_0x0c9f('0x2a')]);_0x1ec6d4[_0x0c9f('0x2d')]=_['keys'](_0x54dc79['query']);_0x1ec6d4[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x1ec6d4[_0x0c9f('0x2c')],_0x1ec6d4['query']);_0x399a83['attributes']=_[_0x0c9f('0x2f')](_0x1ec6d4[_0x0c9f('0x2c')],qs[_0x0c9f('0x31')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x399a83[_0x0c9f('0x30')]=_0x399a83[_0x0c9f('0x30')][_0x0c9f('0x32')]?_0x399a83[_0x0c9f('0x30')]:_0x1ec6d4[_0x0c9f('0x2c')];_0x399a83['limit']=qs[_0x0c9f('0x1d')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x1d')]);_0x399a83['offset']=qs[_0x0c9f('0x1e')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x1e')]);_0x399a83[_0x0c9f('0x35')]=qs[_0x0c9f('0x36')](_0x54dc79[_0x0c9f('0x2d')]['sort']);_0x399a83[_0x0c9f('0x37')]=qs[_0x0c9f('0x2e')](_['pick'](_0x54dc79['query'],_0x1ec6d4[_0x0c9f('0x2e')]));_0x399a83=_[_0x0c9f('0x39')]({},_0x399a83,_0x54dc79[_0x0c9f('0x3d')]);return _0xf86fde[_0x0c9f('0x72')+_[_0x0c9f('0x73')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+_0x0c9f('0x74')](_0x399a83);})['then'](respondWithResult(_0x2e1f60,null))[_0x0c9f('0x42')](handleError(_0x2e1f60,null));};exports[_0x0c9f('0x75')]=function(_0x276aad,_0x4cd77f,_0x2241a9){return db[_0x0c9f('0x29')][_0x0c9f('0x76')]({'where':{'id':_0x276aad[_0x0c9f('0x51')]['id']}})[_0x0c9f('0x23')](function(_0xf4e7c3){if(_0xf4e7c3){if(!_0x276aad[_0x0c9f('0x46')][_0x0c9f('0x6e')]||!utils[_0x0c9f('0x77')](_0x276aad[_0x0c9f('0x46')]['channel'])){throw new db[(_0x0c9f('0x55'))]['ValidationError'](_0x0c9f('0x78'));}return _0xf4e7c3['add'+_[_0x0c9f('0x73')](_0x276aad[_0x0c9f('0x46')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+'Queues'](_0x276aad[_0x0c9f('0x46')]['ids']);}return null;})['then'](handleEntityNotFound(_0x4cd77f,null))['then'](respondWithStatusCode(_0x4cd77f,null))['catch'](handleError(_0x4cd77f,null));};exports[_0x0c9f('0x79')]=function(_0x4fe15c,_0x1c8303,_0x500a69){return db[_0x0c9f('0x29')][_0x0c9f('0x76')]({'where':{'id':_0x4fe15c[_0x0c9f('0x51')]['id']}})[_0x0c9f('0x23')](function(_0x490557){if(_0x490557){if(!_0x4fe15c[_0x0c9f('0x2d')][_0x0c9f('0x6e')]||!utils[_0x0c9f('0x77')](_0x4fe15c[_0x0c9f('0x2d')][_0x0c9f('0x6e')])){throw new db[(_0x0c9f('0x55'))][(_0x0c9f('0x6f'))](_0x0c9f('0x78'));}return _0x490557[_0x0c9f('0x7a')+_[_0x0c9f('0x73')](_0x4fe15c[_0x0c9f('0x2d')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+_0x0c9f('0x74')](_0x4fe15c['query'][_0x0c9f('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x1c8303,null))[_0x0c9f('0x23')](respondWithStatusCode(_0x1c8303,null))[_0x0c9f('0x42')](handleError(_0x1c8303,null));};exports['addAgents']=function(_0x296a8b,_0x43ccea){var _0x3afe98=_[_0x0c9f('0x7c')](_0x296a8b['body'][_0x0c9f('0x7b')])?_0x296a8b[_0x0c9f('0x46')][_0x0c9f('0x7b')]:[_0x296a8b[_0x0c9f('0x46')]['ids']];var _0x54058d=_0x296a8b[_0x0c9f('0x51')]['id'];return db[_0x0c9f('0x29')][_0x0c9f('0x50')]({'where':{'id':_0x54058d}})[_0x0c9f('0x23')](handleEntityNotFound(_0x43ccea,null))[_0x0c9f('0x23')](function(_0x2cdf71){if(_0x2cdf71){var _0x586ace=['Voice','Chat','Mail',_0x0c9f('0x7d'),_0x0c9f('0x7e'),_0x0c9f('0x7f'),_0x0c9f('0x80')];return db[_0x0c9f('0x53')][_0x0c9f('0x81')](function(_0x32a962){var _0x27582b=_['map'](_0x586ace,function(_0x4edd30){var _0xe7e0f6={'attributes':['id',_0x0c9f('0x26')]};if(_0x4edd30==='Voice'){_0xe7e0f6[_0x0c9f('0x82')]={'attributes':[_0x0c9f('0x83')]};}return _0x2cdf71[_0x0c9f('0x72')+_0x4edd30+'Queues'](_0xe7e0f6)[_0x0c9f('0x23')](function(_0x2df316){var _0x5c7ecb=_[_0x0c9f('0x57')](_0x2df316,function(_0x3b87e2){var _0x31bb6d=_[_0x0c9f('0x57')](_0x3afe98,function(_0x13b019){var _0x38e915={'where':{'UserId':_0x13b019,[_0x4edd30+_0x0c9f('0x84')]:_0x3b87e2['id']},'transaction':_0x32a962};if(_0x4edd30==='Voice'){_0x38e915[_0x0c9f('0x85')]={'penalty':_0x3b87e2[_0x0c9f('0x86')][_0x0c9f('0x83')]};}return db[_0x0c9f('0x87')+_0x4edd30+_0x0c9f('0x88')]['findOrCreate'](_0x38e915)[_0x0c9f('0x23')](function(){socket['emit'](_0x0c9f('0x47')+_0x4edd30+_0x0c9f('0x89'),{'UserId':_0x13b019,[_0x4edd30+_0x0c9f('0x84')]:_0x3b87e2['id']});if(_0x4edd30!==_0x0c9f('0x8a')){return;}return db[_0x0c9f('0x87')]['findAll']({'where':{'id':_0x3afe98,'online':0x1},'attributes':['id',_0x0c9f('0x26'),_0x0c9f('0x8b'),_0x0c9f('0x8c'),'interface'],'raw':!![]})[_0x0c9f('0x23')](function(_0x35ff20){var _0x390a2a=_[_0x0c9f('0x57')](_0x35ff20,function(_0x52ac7a){return db[_0x0c9f('0x8d')][_0x0c9f('0x8e')]({'membername':_0x52ac7a[_0x0c9f('0x26')],'UserId':_0x52ac7a['id'],'queue_name':_0x3b87e2['name'],'VoiceQueueId':_0x3b87e2['id'],'interface':_[_0x0c9f('0x8f')](_0x52ac7a['interface'])?util[_0x0c9f('0x90')]('SIP/%s',_0x52ac7a[_0x0c9f('0x26')]):_0x52ac7a[_0x0c9f('0x91')],'paused':_0x52ac7a[_0x0c9f('0x8c')]||![],'penalty':_0x3b87e2[_0x0c9f('0x86')]['penalty']},{'transaction':_0x32a962});});return Promise[_0x0c9f('0x92')](_0x390a2a);});});});return Promise['all'](_0x31bb6d);});return Promise['all'](_0x5c7ecb);})[_0x0c9f('0x23')](function(){return db[_0x0c9f('0x6b')][_0x0c9f('0x76')]({'where':{'teamId':_0x54058d}})[_0x0c9f('0x23')](function(_0x23f450){if(_0x23f450){var _0x40c2c4=_[_0x0c9f('0x57')](_0x3afe98,function(_0xc5d4d4){db['UserVoicePrefix'][_0x0c9f('0x8e')]({'UserId':_0xc5d4d4,'VoicePrefixId':_0x23f450['VoicePrefixId']});});return Promise[_0x0c9f('0x92')](_0x40c2c4);}});});});return Promise[_0x0c9f('0x92')](_0x27582b)['then'](function(){return _0x2cdf71['addAgents'](_0x3afe98,{'transaction':_0x32a962})[_0x0c9f('0x93')](function(_0x27720f){return _0x27720f;});});});}})['then'](respondWithResult(_0x43ccea,null))[_0x0c9f('0x42')](handleError(_0x43ccea,null));};exports[_0x0c9f('0x94')]=function(_0x13f96c,_0xb7ea59){var _0x3ffb7a=_['isArray'](_0x13f96c[_0x0c9f('0x2d')]['ids'])?_0x13f96c['query'][_0x0c9f('0x7b')]:[_0x13f96c[_0x0c9f('0x2d')][_0x0c9f('0x7b')]];var _0x5d67d0=_0x13f96c[_0x0c9f('0x51')]['id'];return db[_0x0c9f('0x29')][_0x0c9f('0x50')]({'where':{'id':_0x5d67d0}})['then'](handleEntityNotFound(_0xb7ea59,null))[_0x0c9f('0x23')](function(_0x5f200c){if(_0x5f200c){var _0x3aa285=['Voice',_0x0c9f('0x95'),_0x0c9f('0x96'),'Sms',_0x0c9f('0x7e'),_0x0c9f('0x7f'),'Whatsapp'];return db[_0x0c9f('0x53')]['transaction'](function(_0x73fea3){var _0x3ae80f=_[_0x0c9f('0x57')](_0x3aa285,function(_0x30f244){var _0x3f8e03={'attributes':['id',_0x0c9f('0x26')]};return _0x5f200c[_0x0c9f('0x72')+_0x30f244+_0x0c9f('0x74')](_0x3f8e03)[_0x0c9f('0x23')](function(_0x57a11d){var _0x453702=_[_0x0c9f('0x57')](_0x57a11d,function(_0x3e07d9){return _0x3e07d9[_0x0c9f('0x94')](_0x3ffb7a,{'transaction':_0x73fea3})[_0x0c9f('0x23')](function(){var _0x6fa67=_[_0x0c9f('0x57')](_0x3ffb7a,function(_0x4e3c50){socket[_0x0c9f('0x97')](_0x0c9f('0x47')+_0x30f244+_0x0c9f('0x98'),{'UserId':Number(_0x4e3c50),[_0x30f244+_0x0c9f('0x84')]:_0x3e07d9['id']});if(_0x30f244!==_0x0c9f('0x8a')){return;}return db[_0x0c9f('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x3e07d9['id'],'UserId':_0x4e3c50},'transaction':_0x73fea3});});return Promise[_0x0c9f('0x92')](_0x6fa67);});});return Promise['all'](_0x453702);});});return Promise[_0x0c9f('0x92')](_0x3ae80f)[_0x0c9f('0x23')](function(){return _0x5f200c[_0x0c9f('0x94')](_0x3ffb7a,{'transaction':_0x73fea3});})[_0x0c9f('0x23')](function(){return db['TeamVoicePrefix'][_0x0c9f('0x76')]({'where':{'teamId':_0x5d67d0}})[_0x0c9f('0x23')](function(_0x58de70){if(_0x58de70){var _0x2e636c=_[_0x0c9f('0x57')](_0x3ffb7a,function(_0x3792cc){db[_0x0c9f('0x6c')][_0x0c9f('0x52')]({'where':{'UserId':_0x3792cc,'VoicePrefixId':_0x58de70[_0x0c9f('0x99')]}});});return Promise['all'](_0x2e636c);}});});});}})[_0x0c9f('0x23')](respondWithStatusCode(_0xb7ea59,null))[_0x0c9f('0x42')](handleError(_0xb7ea59,null));};exports['getAgents']=function(_0x15e5c7,_0x24a388,_0x5ba657){var _0x1eef4f={};var _0x5cf5ba={};var _0x2ffea3;var _0xd34378;return db[_0x0c9f('0x29')]['findOne']({'where':{'id':_0x15e5c7['params']['id']}})[_0x0c9f('0x23')](handleEntityNotFound(_0x24a388,null))['then'](function(_0x8ac362){if(_0x8ac362){_0x2ffea3=_0x8ac362;_0x5cf5ba[_0x0c9f('0x2c')]=_[_0x0c9f('0x70')](db['User'][_0x0c9f('0x2a')]);_0x5cf5ba[_0x0c9f('0x2d')]=_[_0x0c9f('0x70')](_0x15e5c7[_0x0c9f('0x2d')]);_0x5cf5ba[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x5cf5ba[_0x0c9f('0x2c')],_0x5cf5ba[_0x0c9f('0x2d')]);_0x1eef4f[_0x0c9f('0x30')]=_[_0x0c9f('0x2f')](_0x5cf5ba[_0x0c9f('0x2c')],qs['fields'](_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x1eef4f['attributes']=_0x1eef4f[_0x0c9f('0x30')]['length']?_0x1eef4f[_0x0c9f('0x30')]:_0x5cf5ba['model'];_0x1eef4f[_0x0c9f('0x35')]=qs['sort'](_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x36')]);_0x1eef4f[_0x0c9f('0x37')]=qs[_0x0c9f('0x2e')](_[_0x0c9f('0x38')](_0x15e5c7[_0x0c9f('0x2d')],_0x5cf5ba[_0x0c9f('0x2e')]));if(_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x3c')]){_0x1eef4f[_0x0c9f('0x37')]=_[_0x0c9f('0x39')](_0x1eef4f[_0x0c9f('0x37')],{'$or':_[_0x0c9f('0x57')](_0x1eef4f['attributes'],function(_0x307db1){var _0x578833={};_0x578833[_0x307db1]={'$like':'%'+_0x15e5c7[_0x0c9f('0x2d')]['filter']+'%'};return _0x578833;})});}_0x1eef4f=_[_0x0c9f('0x39')]({},_0x1eef4f,_0x15e5c7[_0x0c9f('0x3d')]);return _0x2ffea3[_0x0c9f('0x9a')](_0x1eef4f);}})[_0x0c9f('0x23')](function(_0x2236d0){if(_0x2236d0){_0xd34378=_0x2236d0['length'];if(!_0x15e5c7['query']['hasOwnProperty'](_0x0c9f('0x34'))){_0x1eef4f[_0x0c9f('0x1d')]=qs[_0x0c9f('0x1d')](_0x15e5c7['query'][_0x0c9f('0x1d')]);_0x1eef4f[_0x0c9f('0x1e')]=qs[_0x0c9f('0x1e')](_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x1e')]);}return _0x2ffea3[_0x0c9f('0x9a')](_0x1eef4f);}})['then'](function(_0x14fe73){if(_0x14fe73){return _0x14fe73?{'count':_0xd34378,'rows':_0x14fe73}:null;}})['then'](respondWithResult(_0x24a388,null))[_0x0c9f('0x42')](handleError(_0x24a388,null));}; \ No newline at end of file +var _0x37be=['fieldName','type','query','filters','intersection','model','attributes','fields','sort','where','pick','filter','merge','Team','includeAll','findAll','rows','params','keys','length','include','options','catch','create','body','user','get','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','ValidationError','add','ids','remove','addAgents','isArray','Voice','Sms','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','emit','Queue:save','online','voicePause','UserVoiceQueueRt','isNil','interface','format','all','TeamVoicePrefix','upsert','spread','removeAgents','Chat','Mail','Fax','Openchannel','Queue:remove','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','sendStatus','end','json','undefined','limit','offset','count','status','Content-Range','reject','save','update','then','error','stack','name','index','map','rawAttributes'];(function(_0x3df486,_0x297524){var _0x450ee1=function(_0x547c68){while(--_0x547c68){_0x3df486['push'](_0x3df486['shift']());}};_0x450ee1(++_0x297524);}(_0x37be,0x101));var _0xe37b=function(_0x75456,_0x5037d2){_0x75456=_0x75456-0x0;var _0x16bc4a=_0x37be[_0x75456];return _0x16bc4a;};'use strict';var emlformat=require(_0xe37b('0x0'));var rimraf=require(_0xe37b('0x1'));var zipdir=require(_0xe37b('0x2'));var jsonpatch=require(_0xe37b('0x3'));var rp=require(_0xe37b('0x4'));var moment=require(_0xe37b('0x5'));var BPromise=require(_0xe37b('0x6'));var Mustache=require(_0xe37b('0x7'));var util=require(_0xe37b('0x8'));var path=require(_0xe37b('0x9'));var sox=require(_0xe37b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe37b('0xb'));var _=require(_0xe37b('0xc'));var squel=require(_0xe37b('0xd'));var crypto=require(_0xe37b('0xe'));var jsforce=require(_0xe37b('0xf'));var deskjs=require(_0xe37b('0x10'));var toCsv=require(_0xe37b('0x11'));var querystring=require(_0xe37b('0x12'));var Papa=require(_0xe37b('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe37b('0x14'));var hardwareService=require(_0xe37b('0x15'));var logger=require(_0xe37b('0x16'))(_0xe37b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe37b('0x18'));var db=require(_0xe37b('0x19'))['db'];config[_0xe37b('0x1a')]=_[_0xe37b('0x1b')](config[_0xe37b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe37b('0x1c'))(new Redis(config[_0xe37b('0x1a')]));require(_0xe37b('0x1d'))['register'](socket);function respondWithStatusCode(_0x18defa,_0x2b3f9f){_0x2b3f9f=_0x2b3f9f||0xcc;return function(_0x3562f7){if(_0x3562f7){return _0x18defa[_0xe37b('0x1e')](_0x2b3f9f);}return _0x18defa['status'](_0x2b3f9f)[_0xe37b('0x1f')]();};}function respondWithResult(_0x15f757,_0x21f562){_0x21f562=_0x21f562||0xc8;return function(_0x357819){if(_0x357819){return _0x15f757['status'](_0x21f562)[_0xe37b('0x20')](_0x357819);}};}function respondWithFilteredResult(_0x2ab14c,_0x2cf480){return function(_0xbe27b6){if(_0xbe27b6){var _0x57e533=typeof _0x2cf480['offset']===_0xe37b('0x21')&&typeof _0x2cf480[_0xe37b('0x22')]==='undefined';var _0x53930c=_0xbe27b6['count'];var _0x5a606f=_0x57e533?0x0:_0x2cf480[_0xe37b('0x23')];var _0x48b018=_0x57e533?_0xbe27b6[_0xe37b('0x24')]:_0x2cf480[_0xe37b('0x23')]+_0x2cf480['limit'];var _0x7f6022;if(_0x48b018>=_0x53930c){_0x48b018=_0x53930c;_0x7f6022=0xc8;}else{_0x7f6022=0xce;}_0x2ab14c[_0xe37b('0x25')](_0x7f6022);return _0x2ab14c['set'](_0xe37b('0x26'),_0x5a606f+'-'+_0x48b018+'/'+_0x53930c)[_0xe37b('0x20')](_0xbe27b6);}return null;};}function patchUpdates(_0x39e492){return function(_0x531440){try{jsonpatch['apply'](_0x531440,_0x39e492,!![]);}catch(_0x57ff51){return BPromise[_0xe37b('0x27')](_0x57ff51);}return _0x531440[_0xe37b('0x28')]();};}function saveUpdates(_0x2afc75,_0x2eed16){return function(_0x1a3323){if(_0x1a3323){return _0x1a3323[_0xe37b('0x29')](_0x2afc75)[_0xe37b('0x2a')](function(_0x5a0cd8){return _0x5a0cd8;});}return null;};}function handleEntityNotFound(_0x3098cd,_0x49d068){return function(_0x10e42a){if(!_0x10e42a){_0x3098cd[_0xe37b('0x1e')](0x194);}return _0x10e42a;};}function handleError(_0x1619e4,_0x50b4cf){_0x50b4cf=_0x50b4cf||0x1f4;return function(_0x5b65e4){logger[_0xe37b('0x2b')](_0x5b65e4[_0xe37b('0x2c')]);if(_0x5b65e4[_0xe37b('0x2d')]){delete _0x5b65e4[_0xe37b('0x2d')];}_0x1619e4[_0xe37b('0x25')](_0x50b4cf)['send'](_0x5b65e4);};}exports[_0xe37b('0x2e')]=function(_0xc7ad8,_0x1249e9){var _0x28920f={},_0x5532c1={},_0x45fa45={'count':0x0,'rows':[]};var _0x1aed53=_[_0xe37b('0x2f')](db['Team'][_0xe37b('0x30')],function(_0x447722){return{'name':_0x447722[_0xe37b('0x31')],'type':_0x447722[_0xe37b('0x32')]['key']};});_0x5532c1['model']=_[_0xe37b('0x2f')](_0x1aed53,'name');_0x5532c1[_0xe37b('0x33')]=_['keys'](_0xc7ad8[_0xe37b('0x33')]);_0x5532c1[_0xe37b('0x34')]=_[_0xe37b('0x35')](_0x5532c1[_0xe37b('0x36')],_0x5532c1[_0xe37b('0x33')]);_0x28920f[_0xe37b('0x37')]=_[_0xe37b('0x35')](_0x5532c1['model'],qs['fields'](_0xc7ad8[_0xe37b('0x33')][_0xe37b('0x38')]));_0x28920f[_0xe37b('0x37')]=_0x28920f[_0xe37b('0x37')]['length']?_0x28920f[_0xe37b('0x37')]:_0x5532c1['model'];if(!_0xc7ad8[_0xe37b('0x33')]['hasOwnProperty']('nolimit')){_0x28920f[_0xe37b('0x22')]=qs[_0xe37b('0x22')](_0xc7ad8[_0xe37b('0x33')][_0xe37b('0x22')]);_0x28920f[_0xe37b('0x23')]=qs[_0xe37b('0x23')](_0xc7ad8[_0xe37b('0x33')][_0xe37b('0x23')]);}_0x28920f['order']=qs[_0xe37b('0x39')](_0xc7ad8[_0xe37b('0x33')][_0xe37b('0x39')]);_0x28920f[_0xe37b('0x3a')]=qs['filters'](_[_0xe37b('0x3b')](_0xc7ad8[_0xe37b('0x33')],_0x5532c1['filters']),_0x1aed53);if(_0xc7ad8[_0xe37b('0x33')][_0xe37b('0x3c')]){_0x28920f[_0xe37b('0x3a')]=_[_0xe37b('0x3d')](_0x28920f[_0xe37b('0x3a')],{'$or':_[_0xe37b('0x2f')](_0x1aed53,function(_0x3065c1){if(_0x3065c1[_0xe37b('0x32')]!=='VIRTUAL'){var _0x249996={};_0x249996[_0x3065c1[_0xe37b('0x2d')]]={'$like':'%'+_0xc7ad8[_0xe37b('0x33')][_0xe37b('0x3c')]+'%'};return _0x249996;}})});}_0x28920f=_['merge']({},_0x28920f,_0xc7ad8['options']);var _0x42cd34={'where':_0x28920f[_0xe37b('0x3a')]};return db[_0xe37b('0x3e')][_0xe37b('0x24')](_0x42cd34)[_0xe37b('0x2a')](function(_0x3945ba){_0x45fa45[_0xe37b('0x24')]=_0x3945ba;if(_0xc7ad8['query'][_0xe37b('0x3f')]){_0x28920f['include']=[{'all':!![]}];}return db[_0xe37b('0x3e')][_0xe37b('0x40')](_0x28920f);})[_0xe37b('0x2a')](function(_0x5477a4){_0x45fa45[_0xe37b('0x41')]=_0x5477a4;return _0x45fa45;})[_0xe37b('0x2a')](respondWithFilteredResult(_0x1249e9,_0x28920f))['catch'](handleError(_0x1249e9,null));};exports['show']=function(_0x9650f0,_0x26fd4f){var _0x3319c0={'raw':![],'where':{'id':_0x9650f0[_0xe37b('0x42')]['id']}},_0xd1a897={};_0xd1a897[_0xe37b('0x36')]=_['keys'](db[_0xe37b('0x3e')][_0xe37b('0x30')]);_0xd1a897[_0xe37b('0x33')]=_[_0xe37b('0x43')](_0x9650f0[_0xe37b('0x33')]);_0xd1a897['filters']=_[_0xe37b('0x35')](_0xd1a897[_0xe37b('0x36')],_0xd1a897[_0xe37b('0x33')]);_0x3319c0[_0xe37b('0x37')]=_[_0xe37b('0x35')](_0xd1a897['model'],qs[_0xe37b('0x38')](_0x9650f0[_0xe37b('0x33')]['fields']));_0x3319c0[_0xe37b('0x37')]=_0x3319c0[_0xe37b('0x37')][_0xe37b('0x44')]?_0x3319c0[_0xe37b('0x37')]:_0xd1a897[_0xe37b('0x36')];if(_0x9650f0[_0xe37b('0x33')]['includeAll']){_0x3319c0[_0xe37b('0x45')]=[{'all':!![]}];}_0x3319c0=_[_0xe37b('0x3d')]({},_0x3319c0,_0x9650f0[_0xe37b('0x46')]);return db[_0xe37b('0x3e')]['find'](_0x3319c0)[_0xe37b('0x2a')](handleEntityNotFound(_0x26fd4f,null))['then'](respondWithResult(_0x26fd4f,null))[_0xe37b('0x47')](handleError(_0x26fd4f,null));};exports[_0xe37b('0x48')]=function(_0x5475e2,_0x1f2ba6){return db[_0xe37b('0x3e')]['create'](_0x5475e2[_0xe37b('0x49')],{})['then'](function(_0x4c028d){var _0x4590e0=_0x5475e2[_0xe37b('0x4a')][_0xe37b('0x4b')]({'plain':!![]});if(!_0x4590e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4590e0[_0xe37b('0x4c')]===_0xe37b('0x4a')){var _0x4ca7a6=_0x4c028d['get']({'plain':!![]});var _0x4651af='Teams';return db[_0xe37b('0x4d')][_0xe37b('0x4e')]({'where':{'name':_0x4651af,'userProfileId':_0x4590e0[_0xe37b('0x4f')]},'raw':!![]})[_0xe37b('0x2a')](function(_0x10f697){if(_0x10f697&&_0x10f697['autoAssociation']===0x0){return db[_0xe37b('0x50')]['create']({'name':_0x4ca7a6[_0xe37b('0x2d')],'resourceId':_0x4ca7a6['id'],'type':_0x10f697[_0xe37b('0x2d')],'sectionId':_0x10f697['id']},{})[_0xe37b('0x2a')](function(){return _0x4c028d;});}else{return _0x4c028d;}})[_0xe37b('0x47')](function(_0x20f72c){logger[_0xe37b('0x2b')](_0xe37b('0x51'),_0x20f72c);throw _0x20f72c;});}return _0x4c028d;})['then'](respondWithResult(_0x1f2ba6,0xc9))['catch'](handleError(_0x1f2ba6,null));};exports[_0xe37b('0x29')]=function(_0x2bded1,_0x3059dd){if(_0x2bded1['body']['id']){delete _0x2bded1['body']['id'];}return db[_0xe37b('0x3e')][_0xe37b('0x4e')]({'where':{'id':_0x2bded1[_0xe37b('0x42')]['id']}})[_0xe37b('0x2a')](handleEntityNotFound(_0x3059dd,null))[_0xe37b('0x2a')](saveUpdates(_0x2bded1[_0xe37b('0x49')],null))[_0xe37b('0x2a')](respondWithResult(_0x3059dd,null))['catch'](handleError(_0x3059dd,null));};exports[_0xe37b('0x52')]=function(_0x269c42,_0x4d928a){var _0x3d7096=_0x269c42[_0xe37b('0x42')]['id'];var _0x201784=[];return db['sequelize']['transaction'](function(_0x565b53){var _0x3f7ad3='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x3d7096;return db[_0xe37b('0x53')]['query'](_0x3f7ad3,{'type':db[_0xe37b('0x54')][_0xe37b('0x55')]['SELECT'],'raw':!![],'transaction':_0x565b53})[_0xe37b('0x2a')](function(_0x527290){_0x201784=_[_0xe37b('0x2f')](_0x527290,function(_0x1dc6f7){return Number(_0x1dc6f7[_0xe37b('0x56')]);});})[_0xe37b('0x2a')](function(){var _0x5ac127=_0xe37b('0x57')+_0x3d7096;return db['sequelize']['query'](_0x5ac127,{'type':db[_0xe37b('0x54')]['QueryTypes'][_0xe37b('0x58')],'raw':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0x42d5dc){var _0xd2fe48=_[_0xe37b('0x2f')](_0x42d5dc,function(_0x3ea6b4){return Number(_0x3ea6b4[_0xe37b('0x59')]);});return db['UserVoiceQueue'][_0xe37b('0x52')]({'where':{'UserId':{'$in':_0x201784},'VoiceQueueId':{'$in':_0xd2fe48}},'transaction':_0x565b53});})[_0xe37b('0x2a')](function(){var _0x14ee78=_0xe37b('0x5a')+_0x3d7096;return db['sequelize'][_0xe37b('0x33')](_0x14ee78,{'type':db[_0xe37b('0x54')][_0xe37b('0x55')][_0xe37b('0x58')],'raw':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0x2c7968){var _0x15d51f=_[_0xe37b('0x2f')](_0x2c7968,function(_0x25507f){return Number(_0x25507f[_0xe37b('0x5b')]);});return db[_0xe37b('0x5c')][_0xe37b('0x52')]({'where':{'UserId':{'$in':_0x201784},'MailQueueId':{'$in':_0x15d51f}},'transaction':_0x565b53});})[_0xe37b('0x2a')](function(){var _0xbd3a78=_0xe37b('0x5d')+_0x3d7096;return db[_0xe37b('0x53')]['query'](_0xbd3a78,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0x2244e0){var _0x3eda99=_[_0xe37b('0x2f')](_0x2244e0,function(_0x6be001){return Number(_0x6be001[_0xe37b('0x5e')]);});return db[_0xe37b('0x5f')][_0xe37b('0x52')]({'where':{'UserId':{'$in':_0x201784},'SmsQueueId':{'$in':_0x3eda99}},'transaction':_0x565b53});})[_0xe37b('0x2a')](function(){var _0x43983f=_0xe37b('0x60')+_0x3d7096;return db[_0xe37b('0x53')]['query'](_0x43983f,{'type':db[_0xe37b('0x54')][_0xe37b('0x55')][_0xe37b('0x58')],'raw':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0x19e551){var _0xc11252=_[_0xe37b('0x2f')](_0x19e551,function(_0x381757){return Number(_0x381757[_0xe37b('0x61')]);});return db[_0xe37b('0x62')]['destroy']({'where':{'UserId':{'$in':_0x201784},'ChatQueueId':{'$in':_0xc11252}},'transaction':_0x565b53});})[_0xe37b('0x2a')](function(){var _0x29c392=_0xe37b('0x63')+_0x3d7096;return db['sequelize'][_0xe37b('0x33')](_0x29c392,{'type':db[_0xe37b('0x54')][_0xe37b('0x55')][_0xe37b('0x58')],'raw':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0x1546a0){var _0x4bcd5d=_['map'](_0x1546a0,function(_0x2b8259){return Number(_0x2b8259['FaxQueueId']);});return db['UserFaxQueue'][_0xe37b('0x52')]({'where':{'UserId':{'$in':_0x201784},'FaxQueueId':{'$in':_0x4bcd5d}},'transaction':_0x565b53});})['then'](function(){var _0x3548cc=_0xe37b('0x64')+_0x3d7096;return db['sequelize'][_0xe37b('0x33')](_0x3548cc,{'type':db[_0xe37b('0x54')][_0xe37b('0x55')]['SELECT'],'raw':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0xd3b29e){var _0x2cc15a=_['map'](_0xd3b29e,function(_0x56d300){return Number(_0x56d300[_0xe37b('0x65')]);});return db['UserOpenchannelQueue'][_0xe37b('0x52')]({'where':{'UserId':{'$in':_0x201784},'OpenchannelQueueId':{'$in':_0x2cc15a}},'transaction':_0x565b53});})[_0xe37b('0x2a')](function(){var _0x2ff46e=_0xe37b('0x66')+_0x3d7096;return db[_0xe37b('0x53')][_0xe37b('0x33')](_0x2ff46e,{'type':db[_0xe37b('0x54')][_0xe37b('0x55')][_0xe37b('0x58')],'raw':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0x21ffda){var _0x385243=_[_0xe37b('0x2f')](_0x21ffda,function(_0x4394a9){return Number(_0x4394a9['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xe37b('0x52')]({'where':{'UserId':{'$in':_0x201784},'WhatsappQueueId':{'$in':_0x385243}},'transaction':_0x565b53});})['then'](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x3d7096}});})[_0xe37b('0x2a')](function(_0x28929e){if(_0x28929e===null){return;}return db[_0xe37b('0x67')][_0xe37b('0x52')]({'where':{'UserId':{'$in':_0x201784},'VoicePrefixId':_0x28929e[_0xe37b('0x68')]},'transaction':_0x565b53});})[_0xe37b('0x2a')](function(){return db['Team'][_0xe37b('0x52')]({'where':{'id':_0x3d7096},'cascade':!![],'transaction':_0x565b53});})[_0xe37b('0x2a')](function(_0x44a769){if(_0x44a769===0x0){_0x4d928a['sendStatus'](0x194);}else{return db[_0xe37b('0x50')]['destroy']({'where':{'type':_0xe37b('0x69'),'resourceId':_0x3d7096},'cascade':!![],'transaction':_0x565b53})[_0xe37b('0x2a')](function(){_0x4d928a['status'](0xcc)[_0xe37b('0x1f')]();});}})[_0xe37b('0x47')](function(_0xa6e477){_0x4d928a['status'](0x1f4)['send'](_0xa6e477);});});};exports[_0xe37b('0x6a')]=function(_0x13604f,_0x5a5c05,_0x57fddd){return db[_0xe37b('0x3e')][_0xe37b('0x6b')]({'where':{'id':_0x13604f[_0xe37b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a5c05,null))['then'](function(_0x3f43e9){if(!_0x13604f['query'][_0xe37b('0x6c')]||!utils[_0xe37b('0x6d')](_0x13604f[_0xe37b('0x33')][_0xe37b('0x6c')])){throw new db[(_0xe37b('0x54'))]['ValidationError'](_0xe37b('0x6e'));}var _0x3be4f0={};var _0x2a1baa={};_0x2a1baa[_0xe37b('0x36')]=_[_0xe37b('0x43')](db[_[_0xe37b('0x6f')](_0x13604f[_0xe37b('0x33')][_0xe37b('0x6c')][_0xe37b('0x70')]())+_0xe37b('0x71')]['rawAttributes']);_0x2a1baa['query']=_['keys'](_0x13604f['query']);_0x2a1baa[_0xe37b('0x34')]=_[_0xe37b('0x35')](_0x2a1baa[_0xe37b('0x36')],_0x2a1baa[_0xe37b('0x33')]);_0x3be4f0[_0xe37b('0x37')]=_['intersection'](_0x2a1baa[_0xe37b('0x36')],qs[_0xe37b('0x38')](_0x13604f[_0xe37b('0x33')]['fields']));_0x3be4f0[_0xe37b('0x37')]=_0x3be4f0['attributes'][_0xe37b('0x44')]?_0x3be4f0[_0xe37b('0x37')]:_0x2a1baa[_0xe37b('0x36')];_0x3be4f0[_0xe37b('0x22')]=qs[_0xe37b('0x22')](_0x13604f[_0xe37b('0x33')][_0xe37b('0x22')]);_0x3be4f0['offset']=qs[_0xe37b('0x23')](_0x13604f[_0xe37b('0x33')]['offset']);_0x3be4f0[_0xe37b('0x72')]=qs['sort'](_0x13604f[_0xe37b('0x33')][_0xe37b('0x39')]);_0x3be4f0[_0xe37b('0x3a')]=qs[_0xe37b('0x34')](_[_0xe37b('0x3b')](_0x13604f[_0xe37b('0x33')],_0x2a1baa[_0xe37b('0x34')]));_0x3be4f0=_['merge']({},_0x3be4f0,_0x13604f[_0xe37b('0x46')]);return _0x3f43e9[_0xe37b('0x4b')+_[_0xe37b('0x6f')](_0x13604f[_0xe37b('0x33')][_0xe37b('0x6c')][_0xe37b('0x70')]())+_0xe37b('0x73')](_0x3be4f0);})[_0xe37b('0x2a')](respondWithResult(_0x5a5c05,null))[_0xe37b('0x47')](handleError(_0x5a5c05,null));};exports[_0xe37b('0x74')]=function(_0x1ebed5,_0x52f58d,_0x4699a3){return db['Team'][_0xe37b('0x6b')]({'where':{'id':_0x1ebed5[_0xe37b('0x42')]['id']}})[_0xe37b('0x2a')](function(_0x27a2e2){if(_0x27a2e2){if(!_0x1ebed5['body'][_0xe37b('0x6c')]||!utils['isValidChannel'](_0x1ebed5['body'][_0xe37b('0x6c')])){throw new db[(_0xe37b('0x54'))][(_0xe37b('0x75'))](_0xe37b('0x6e'));}return _0x27a2e2[_0xe37b('0x76')+_[_0xe37b('0x6f')](_0x1ebed5[_0xe37b('0x49')][_0xe37b('0x6c')][_0xe37b('0x70')]())+_0xe37b('0x73')](_0x1ebed5[_0xe37b('0x49')][_0xe37b('0x77')]);}return null;})['then'](handleEntityNotFound(_0x52f58d,null))[_0xe37b('0x2a')](respondWithStatusCode(_0x52f58d,null))[_0xe37b('0x47')](handleError(_0x52f58d,null));};exports['removeQueues']=function(_0x27e81a,_0x2d5c3c,_0x5b10ed){return db[_0xe37b('0x3e')][_0xe37b('0x6b')]({'where':{'id':_0x27e81a['params']['id']}})['then'](function(_0x303f2a){if(_0x303f2a){if(!_0x27e81a[_0xe37b('0x33')][_0xe37b('0x6c')]||!utils[_0xe37b('0x6d')](_0x27e81a[_0xe37b('0x33')][_0xe37b('0x6c')])){throw new db[(_0xe37b('0x54'))][(_0xe37b('0x75'))]('Unknown\x20channel');}return _0x303f2a[_0xe37b('0x78')+_[_0xe37b('0x6f')](_0x27e81a[_0xe37b('0x33')][_0xe37b('0x6c')][_0xe37b('0x70')]())+'Queues'](_0x27e81a[_0xe37b('0x33')]['ids']);}return null;})['then'](handleEntityNotFound(_0x2d5c3c,null))[_0xe37b('0x2a')](respondWithStatusCode(_0x2d5c3c,null))[_0xe37b('0x47')](handleError(_0x2d5c3c,null));};exports[_0xe37b('0x79')]=function(_0x433687,_0x3d0112){var _0xf7540a=_[_0xe37b('0x7a')](_0x433687[_0xe37b('0x49')][_0xe37b('0x77')])?_0x433687[_0xe37b('0x49')][_0xe37b('0x77')]:[_0x433687[_0xe37b('0x49')][_0xe37b('0x77')]];var _0x56d62f=_0x433687[_0xe37b('0x42')]['id'];return db[_0xe37b('0x3e')][_0xe37b('0x4e')]({'where':{'id':_0x56d62f}})[_0xe37b('0x2a')](handleEntityNotFound(_0x3d0112,null))['then'](function(_0xebd86c){if(_0xebd86c){var _0x108d93=[_0xe37b('0x7b'),'Chat','Mail',_0xe37b('0x7c'),'Fax','Openchannel',_0xe37b('0x7d')];return db[_0xe37b('0x53')][_0xe37b('0x7e')](function(_0x4a6797){var _0x4b403a=_['map'](_0x108d93,function(_0x5eb82a){var _0x2e34f7={'attributes':['id',_0xe37b('0x2d')]};if(_0x5eb82a===_0xe37b('0x7b')){_0x2e34f7[_0xe37b('0x7f')]={'attributes':[_0xe37b('0x80')]};}return _0xebd86c[_0xe37b('0x4b')+_0x5eb82a+_0xe37b('0x73')](_0x2e34f7)[_0xe37b('0x2a')](function(_0x1fc987){var _0x11411b=_['map'](_0x1fc987,function(_0x4081fb){var _0xff4177=_[_0xe37b('0x2f')](_0xf7540a,function(_0x178923){var _0xcb71ca={'where':{'UserId':_0x178923,[_0x5eb82a+_0xe37b('0x81')]:_0x4081fb['id']},'transaction':_0x4a6797};if(_0x5eb82a===_0xe37b('0x7b')){_0xcb71ca['defaults']={'penalty':_0x4081fb[_0xe37b('0x82')][_0xe37b('0x80')]};}return db[_0xe37b('0x83')+_0x5eb82a+_0xe37b('0x71')]['findOrCreate'](_0xcb71ca)[_0xe37b('0x2a')](function(){socket[_0xe37b('0x84')]('user'+_0x5eb82a+_0xe37b('0x85'),{'UserId':_0x178923,[_0x5eb82a+_0xe37b('0x81')]:_0x4081fb['id']});if(_0x5eb82a!==_0xe37b('0x7b')){return;}return db[_0xe37b('0x83')][_0xe37b('0x40')]({'where':{'id':_0xf7540a,'online':0x1},'attributes':['id',_0xe37b('0x2d'),_0xe37b('0x86'),_0xe37b('0x87'),'interface'],'raw':!![]})[_0xe37b('0x2a')](function(_0x3b493f){var _0x85df5b=_['map'](_0x3b493f,function(_0x11e23d){return db[_0xe37b('0x88')]['upsert']({'membername':_0x11e23d[_0xe37b('0x2d')],'UserId':_0x11e23d['id'],'queue_name':_0x4081fb[_0xe37b('0x2d')],'VoiceQueueId':_0x4081fb['id'],'interface':_[_0xe37b('0x89')](_0x11e23d[_0xe37b('0x8a')])?util[_0xe37b('0x8b')]('SIP/%s',_0x11e23d['name']):_0x11e23d[_0xe37b('0x8a')],'paused':_0x11e23d['voicePause']||![],'penalty':_0x4081fb[_0xe37b('0x82')][_0xe37b('0x80')]},{'transaction':_0x4a6797});});return Promise[_0xe37b('0x8c')](_0x85df5b);});});});return Promise[_0xe37b('0x8c')](_0xff4177);});return Promise[_0xe37b('0x8c')](_0x11411b);})[_0xe37b('0x2a')](function(){return db[_0xe37b('0x8d')][_0xe37b('0x6b')]({'where':{'teamId':_0x56d62f}})['then'](function(_0xf4c17c){if(_0xf4c17c){var _0x1900a7=_[_0xe37b('0x2f')](_0xf7540a,function(_0x7dca2f){db['UserVoicePrefix'][_0xe37b('0x8e')]({'UserId':_0x7dca2f,'VoicePrefixId':_0xf4c17c['VoicePrefixId']});});return Promise[_0xe37b('0x8c')](_0x1900a7);}});});});return Promise['all'](_0x4b403a)[_0xe37b('0x2a')](function(){return _0xebd86c[_0xe37b('0x79')](_0xf7540a,{'transaction':_0x4a6797})[_0xe37b('0x8f')](function(_0x3bdba0){return _0x3bdba0;});});});}})[_0xe37b('0x2a')](respondWithResult(_0x3d0112,null))[_0xe37b('0x47')](handleError(_0x3d0112,null));};exports[_0xe37b('0x90')]=function(_0x321d7c,_0x38f6c4){var _0x382875=_[_0xe37b('0x7a')](_0x321d7c[_0xe37b('0x33')]['ids'])?_0x321d7c['query'][_0xe37b('0x77')]:[_0x321d7c[_0xe37b('0x33')]['ids']];var _0x279766=_0x321d7c['params']['id'];return db[_0xe37b('0x3e')][_0xe37b('0x4e')]({'where':{'id':_0x279766}})['then'](handleEntityNotFound(_0x38f6c4,null))['then'](function(_0x15486f){if(_0x15486f){var _0x36e227=[_0xe37b('0x7b'),_0xe37b('0x91'),_0xe37b('0x92'),_0xe37b('0x7c'),_0xe37b('0x93'),_0xe37b('0x94'),_0xe37b('0x7d')];return db['sequelize']['transaction'](function(_0x391a7e){var _0x285dc5=_[_0xe37b('0x2f')](_0x36e227,function(_0x3b02e0){var _0x595326={'attributes':['id',_0xe37b('0x2d')]};return _0x15486f[_0xe37b('0x4b')+_0x3b02e0+_0xe37b('0x73')](_0x595326)[_0xe37b('0x2a')](function(_0x5c4f45){var _0x3f622f=_['map'](_0x5c4f45,function(_0x4a7e76){return _0x4a7e76[_0xe37b('0x90')](_0x382875,{'transaction':_0x391a7e})['then'](function(){var _0x495cc9=_['map'](_0x382875,function(_0x5819c7){socket[_0xe37b('0x84')](_0xe37b('0x4a')+_0x3b02e0+_0xe37b('0x95'),{'UserId':Number(_0x5819c7),[_0x3b02e0+_0xe37b('0x81')]:_0x4a7e76['id']});if(_0x3b02e0!==_0xe37b('0x7b')){return;}return db[_0xe37b('0x88')][_0xe37b('0x52')]({'where':{'VoiceQueueId':_0x4a7e76['id'],'UserId':_0x5819c7},'transaction':_0x391a7e});});return Promise[_0xe37b('0x8c')](_0x495cc9);});});return Promise[_0xe37b('0x8c')](_0x3f622f);});});return Promise['all'](_0x285dc5)[_0xe37b('0x2a')](function(){return _0x15486f[_0xe37b('0x90')](_0x382875,{'transaction':_0x391a7e});})[_0xe37b('0x2a')](function(){return db['TeamVoicePrefix'][_0xe37b('0x6b')]({'where':{'teamId':_0x279766}})[_0xe37b('0x2a')](function(_0x57949d){if(_0x57949d){var _0x24f198=_[_0xe37b('0x2f')](_0x382875,function(_0x1ebf60){db[_0xe37b('0x67')][_0xe37b('0x52')]({'where':{'UserId':_0x1ebf60,'VoicePrefixId':_0x57949d['VoicePrefixId']}});});return Promise[_0xe37b('0x8c')](_0x24f198);}});});});}})['then'](respondWithStatusCode(_0x38f6c4,null))[_0xe37b('0x47')](handleError(_0x38f6c4,null));};exports[_0xe37b('0x96')]=function(_0x336738,_0x300e34,_0x33ae96){var _0x4b641b={};var _0x856d84={};var _0x19edf6;var _0x5043e2;return db[_0xe37b('0x3e')][_0xe37b('0x6b')]({'where':{'id':_0x336738['params']['id']}})[_0xe37b('0x2a')](handleEntityNotFound(_0x300e34,null))[_0xe37b('0x2a')](function(_0x304ab1){if(_0x304ab1){_0x19edf6=_0x304ab1;_0x856d84[_0xe37b('0x36')]=_[_0xe37b('0x43')](db['User']['rawAttributes']);_0x856d84['query']=_[_0xe37b('0x43')](_0x336738[_0xe37b('0x33')]);_0x856d84['filters']=_['intersection'](_0x856d84[_0xe37b('0x36')],_0x856d84[_0xe37b('0x33')]);_0x4b641b[_0xe37b('0x37')]=_[_0xe37b('0x35')](_0x856d84[_0xe37b('0x36')],qs['fields'](_0x336738['query'][_0xe37b('0x38')]));_0x4b641b['attributes']=_0x4b641b[_0xe37b('0x37')]['length']?_0x4b641b[_0xe37b('0x37')]:_0x856d84['model'];_0x4b641b['order']=qs['sort'](_0x336738['query'][_0xe37b('0x39')]);_0x4b641b[_0xe37b('0x3a')]=qs['filters'](_[_0xe37b('0x3b')](_0x336738[_0xe37b('0x33')],_0x856d84[_0xe37b('0x34')]));if(_0x336738['query']['filter']){_0x4b641b[_0xe37b('0x3a')]=_[_0xe37b('0x3d')](_0x4b641b['where'],{'$or':_[_0xe37b('0x2f')](_0x4b641b['attributes'],function(_0x22847e){var _0x1b0981={};_0x1b0981[_0x22847e]={'$like':'%'+_0x336738['query'][_0xe37b('0x3c')]+'%'};return _0x1b0981;})});}_0x4b641b=_[_0xe37b('0x3d')]({},_0x4b641b,_0x336738[_0xe37b('0x46')]);return _0x19edf6[_0xe37b('0x96')](_0x4b641b);}})[_0xe37b('0x2a')](function(_0x1e0b06){if(_0x1e0b06){_0x5043e2=_0x1e0b06[_0xe37b('0x44')];if(!_0x336738[_0xe37b('0x33')][_0xe37b('0x97')](_0xe37b('0x98'))){_0x4b641b[_0xe37b('0x22')]=qs[_0xe37b('0x22')](_0x336738[_0xe37b('0x33')][_0xe37b('0x22')]);_0x4b641b[_0xe37b('0x23')]=qs[_0xe37b('0x23')](_0x336738['query'][_0xe37b('0x23')]);}return _0x19edf6[_0xe37b('0x96')](_0x4b641b);}})[_0xe37b('0x2a')](function(_0x56f29e){if(_0x56f29e){return _0x56f29e?{'count':_0x5043e2,'rows':_0x56f29e}:null;}})[_0xe37b('0x2a')](respondWithResult(_0x300e34,null))[_0xe37b('0x47')](handleError(_0x300e34,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index cbe2551..7f67eed 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 _0x052a=['save','remove','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x5a9600,_0x46da77){var _0x20b0e6=function(_0x351865){while(--_0x351865){_0x5a9600['push'](_0x5a9600['shift']());}};_0x20b0e6(++_0x46da77);}(_0x052a,0x17f));var _0xa052=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x052a[_0x1c546c];return _0x2cc384;};'use strict';var EventEmitter=require(_0xa052('0x0'));var Team=require(_0xa052('0x1'))['db'][_0xa052('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa052('0x3')](0x0);var events={'afterCreate':_0xa052('0x4'),'afterUpdate':'update','afterDestroy':_0xa052('0x5')};function emitEvent(_0x33a63d){return function(_0x275dfd,_0x2ec568,_0x187dfa){TeamEvents['emit'](_0x33a63d+':'+_0x275dfd['id'],_0x275dfd);TeamEvents['emit'](_0x33a63d,_0x275dfd);_0x187dfa(null);};}for(var e in events){if(events[_0xa052('0x6')](e)){var event=events[e];Team[_0xa052('0x7')](e,emitEvent(event));}}module[_0xa052('0x8')]=TeamEvents; \ No newline at end of file +var _0xef54=['Team','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x13f640,_0x30b3c9){var _0x55995c=function(_0x2eeafe){while(--_0x2eeafe){_0x13f640['push'](_0x13f640['shift']());}};_0x55995c(++_0x30b3c9);}(_0xef54,0x181));var _0x4ef5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef54[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4ef5('0x0'));var Team=require(_0x4ef5('0x1'))['db'][_0x4ef5('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4ef5('0x3')](0x0);var events={'afterCreate':_0x4ef5('0x4'),'afterUpdate':_0x4ef5('0x5'),'afterDestroy':_0x4ef5('0x6')};function emitEvent(_0x3ea134){return function(_0x1ec88d,_0x5b9eba,_0x39bef1){TeamEvents[_0x4ef5('0x7')](_0x3ea134+':'+_0x1ec88d['id'],_0x1ec88d);TeamEvents[_0x4ef5('0x7')](_0x3ea134,_0x1ec88d);_0x39bef1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x4ef5('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b06ca2e..d959282 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 _0x06fe=['Team','Fax','Mail','Openchannel','Sms','catch','lodash','./team.attributes','Queues','then','map','exports','define'];(function(_0x384207,_0x4e2b68){var _0xbc41bc=function(_0x1ff5e9){while(--_0x1ff5e9){_0x384207['push'](_0x384207['shift']());}};_0xbc41bc(++_0x4e2b68);}(_0x06fe,0x1c0));var _0xe06f=function(_0x33c70e,_0xd8cb0b){_0x33c70e=_0x33c70e-0x0;var _0x5a33e5=_0x06fe[_0x33c70e];return _0x5a33e5;};'use strict';var _=require(_0xe06f('0x0'));var attributes=require(_0xe06f('0x1'));function getQueuesByChannel(_0x5bd58f,_0x3b5802){var _0x2e3143='get'+_0x3b5802+_0xe06f('0x2');return _0x5bd58f[_0x2e3143]()[_0xe06f('0x3')](function(_0x8b087d){return _[_0xe06f('0x4')](_0x8b087d,function(_0xc62649){_0xc62649['setDataValue']('channel',_0x3b5802);return _0xc62649;});})['catch'](function(_0x5e5845){throw _0x5e5845;});}module[_0xe06f('0x5')]=function(_0xf4965c){return _0xf4965c[_0xe06f('0x6')](_0xe06f('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x516c5a=this;var _0x3b6b44=['Chat',_0xe06f('0x8'),_0xe06f('0x9'),_0xe06f('0xa'),_0xe06f('0xb'),'Voice','Whatsapp'];return Promise['resolve']()[_0xe06f('0x3')](function(){var _0x1d1cac=_[_0xe06f('0x4')](_0x3b6b44,function(_0x4137ec){return getQueuesByChannel(_0x516c5a,_0x4137ec);});return Promise['all'](_0x1d1cac);})[_0xe06f('0xc')](function(_0x1938e5){throw _0x1938e5;});}}});}; \ No newline at end of file +var _0x7833=['./team.attributes','get','Queues','then','map','channel','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Whatsapp','resolve','lodash'];(function(_0x4d28c9,_0x37d9d8){var _0x41795b=function(_0x194037){while(--_0x194037){_0x4d28c9['push'](_0x4d28c9['shift']());}};_0x41795b(++_0x37d9d8);}(_0x7833,0x1af));var _0x3783=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x7833[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x3783('0x0'));var attributes=require(_0x3783('0x1'));function getQueuesByChannel(_0x4e9081,_0x114d3f){var _0xe2db42=_0x3783('0x2')+_0x114d3f+_0x3783('0x3');return _0x4e9081[_0xe2db42]()[_0x3783('0x4')](function(_0x3e263f){return _[_0x3783('0x5')](_0x3e263f,function(_0x2f5f20){_0x2f5f20['setDataValue'](_0x3783('0x6'),_0x114d3f);return _0x2f5f20;});})['catch'](function(_0x5ee7eb){throw _0x5ee7eb;});}module[_0x3783('0x7')]=function(_0x24fccb){return _0x24fccb[_0x3783('0x8')](_0x3783('0x9'),attributes,{'tableName':_0x3783('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4da612=this;var _0x2b73fb=[_0x3783('0xb'),_0x3783('0xc'),_0x3783('0xd'),_0x3783('0xe'),_0x3783('0xf'),'Voice',_0x3783('0x10')];return Promise[_0x3783('0x11')]()['then'](function(){var _0x596bb9=_['map'](_0x2b73fb,function(_0x28c339){return getQueuesByChannel(_0x4da612,_0x28c339);});return Promise['all'](_0x596bb9);})['catch'](function(_0x34de3c){throw _0x34de3c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 567b687..7f30e46 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 _0x6b37=['message','info','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3da227,_0x4af25b){var _0x7d0ba9=function(_0xe4c6b3){while(--_0xe4c6b3){_0x3da227['push'](_0x3da227['shift']());}};_0x7d0ba9(++_0x4af25b);}(_0x6b37,0x86));var _0x76b3=function(_0x450127,_0x2e3ade){_0x450127=_0x450127-0x0;var _0x17ea36=_0x6b37[_0x450127];return _0x17ea36;};'use strict';var _=require(_0x76b3('0x0'));var util=require(_0x76b3('0x1'));var moment=require('moment');var BPromise=require(_0x76b3('0x2'));var rs=require(_0x76b3('0x3'));var fs=require('fs');var Redis=require(_0x76b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76b3('0x5'));var logger=require(_0x76b3('0x6'))(_0x76b3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76b3('0x8')][_0x76b3('0x9')]({'port':0x232a});config['redis']=_[_0x76b3('0xa')](config[_0x76b3('0xb')],{'host':_0x76b3('0xc'),'port':0x18eb});var socket=require(_0x76b3('0xd'))(new Redis(config[_0x76b3('0xb')]));require('./team.socket')[_0x76b3('0xe')](socket);function respondWithRpcPromise(_0x18568a,_0x3a708e,_0x30cc2e){return new BPromise(function(_0x21738c,_0x48fa20){return client[_0x76b3('0xf')](_0x18568a,_0x30cc2e)[_0x76b3('0x10')](function(_0x32802a){logger['info'](_0x76b3('0x11'),_0x3a708e,'request\x20sent');logger[_0x76b3('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x3a708e,'request\x20sent',JSON[_0x76b3('0x13')](_0x32802a));if(_0x32802a['error']){if(_0x32802a[_0x76b3('0x14')][_0x76b3('0x15')]===0x1f4){logger['error'](_0x76b3('0x11'),_0x3a708e,_0x32802a[_0x76b3('0x14')][_0x76b3('0x16')]);return _0x48fa20(_0x32802a['error'][_0x76b3('0x16')]);}logger[_0x76b3('0x14')](_0x76b3('0x11'),_0x3a708e,_0x32802a[_0x76b3('0x14')]['message']);return _0x21738c(_0x32802a[_0x76b3('0x14')][_0x76b3('0x16')]);}else{logger[_0x76b3('0x17')]('Team,\x20%s,\x20%s',_0x3a708e,_0x76b3('0x18'));_0x21738c(_0x32802a['result'][_0x76b3('0x16')]);}})[_0x76b3('0x19')](function(_0x26c8d7){logger[_0x76b3('0x14')](_0x76b3('0x11'),_0x3a708e,_0x26c8d7);_0x48fa20(_0x26c8d7);});});} \ No newline at end of file +var _0xe53c=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x4c67d9,_0x351438){var _0x26f975=function(_0x43f193){while(--_0x43f193){_0x4c67d9['push'](_0x4c67d9['shift']());}};_0x26f975(++_0x351438);}(_0xe53c,0x1da));var _0xce53=function(_0xfa2e1e,_0x4002ed){_0xfa2e1e=_0xfa2e1e-0x0;var _0x2f1d12=_0xe53c[_0xfa2e1e];return _0x2f1d12;};'use strict';var _=require(_0xce53('0x0'));var util=require(_0xce53('0x1'));var moment=require(_0xce53('0x2'));var BPromise=require('bluebird');var rs=require(_0xce53('0x3'));var fs=require('fs');var Redis=require(_0xce53('0x4'));var db=require(_0xce53('0x5'))['db'];var utils=require(_0xce53('0x6'));var logger=require('../../config/logger')(_0xce53('0x7'));var config=require(_0xce53('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xce53('0x9')][_0xce53('0xa')]({'port':0x232a});config[_0xce53('0xb')]=_[_0xce53('0xc')](config[_0xce53('0xb')],{'host':_0xce53('0xd'),'port':0x18eb});var socket=require(_0xce53('0xe'))(new Redis(config[_0xce53('0xb')]));require(_0xce53('0xf'))['register'](socket);function respondWithRpcPromise(_0x4ba8a8,_0x3b7c27,_0x38de9b){return new BPromise(function(_0xb9d6f2,_0x30e2a2){return client[_0xce53('0x10')](_0x4ba8a8,_0x38de9b)[_0xce53('0x11')](function(_0x1eb222){logger[_0xce53('0x12')](_0xce53('0x13'),_0x3b7c27,'request\x20sent');logger[_0xce53('0x14')](_0xce53('0x15'),_0x3b7c27,_0xce53('0x16'),JSON[_0xce53('0x17')](_0x1eb222));if(_0x1eb222[_0xce53('0x18')]){if(_0x1eb222['error'][_0xce53('0x19')]===0x1f4){logger[_0xce53('0x18')](_0xce53('0x13'),_0x3b7c27,_0x1eb222['error'][_0xce53('0x1a')]);return _0x30e2a2(_0x1eb222[_0xce53('0x18')][_0xce53('0x1a')]);}logger['error'](_0xce53('0x13'),_0x3b7c27,_0x1eb222[_0xce53('0x18')]['message']);return _0xb9d6f2(_0x1eb222[_0xce53('0x18')][_0xce53('0x1a')]);}else{logger['info'](_0xce53('0x13'),_0x3b7c27,'request\x20sent');_0xb9d6f2(_0x1eb222[_0xce53('0x1b')]['message']);}})['catch'](function(_0x2e2c0d){logger[_0xce53('0x18')](_0xce53('0x13'),_0x3b7c27,_0x2e2c0d);_0x30e2a2(_0x2e2c0d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9cfe0a8..ed78897 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 _0x585b=['team:','./team.events','save','removeListener','register'];(function(_0x3ed474,_0x31854a){var _0x303c91=function(_0x286f62){while(--_0x286f62){_0x3ed474['push'](_0x3ed474['shift']());}};_0x303c91(++_0x31854a);}(_0x585b,0x1af));var _0xb585=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x585b[_0x5d4607];return _0x5e4a86;};'use strict';var TeamEvents=require(_0xb585('0x0'));var events=[_0xb585('0x1'),'remove','update'];function createListener(_0x2da463,_0x527906){return function(_0x124908){_0x527906['emit'](_0x2da463,_0x124908);};}function removeListener(_0x4db6de,_0x5cc948){return function(){TeamEvents[_0xb585('0x2')](_0x4db6de,_0x5cc948);};}exports[_0xb585('0x3')]=function(_0x2ed1c1){for(var _0x474970=0x0,_0x378aff=events['length'];_0x474970<_0x378aff;_0x474970++){var _0x1488a5=events[_0x474970];var _0x4d8dfc=createListener(_0xb585('0x4')+_0x1488a5,_0x2ed1c1);TeamEvents['on'](_0x1488a5,_0x4d8dfc);}}; \ No newline at end of file +var _0xb689=['save','update','removeListener','length','team:','./team.events'];(function(_0x5e7391,_0x670bd0){var _0x469a09=function(_0x3cad10){while(--_0x3cad10){_0x5e7391['push'](_0x5e7391['shift']());}};_0x469a09(++_0x670bd0);}(_0xb689,0x113));var _0x9b68=function(_0x3dacbb,_0x525bf9){_0x3dacbb=_0x3dacbb-0x0;var _0x21f126=_0xb689[_0x3dacbb];return _0x21f126;};'use strict';var TeamEvents=require(_0x9b68('0x0'));var events=[_0x9b68('0x1'),'remove',_0x9b68('0x2')];function createListener(_0x40fdeb,_0x573a58){return function(_0x1be1c2){_0x573a58['emit'](_0x40fdeb,_0x1be1c2);};}function removeListener(_0x2ea337,_0x2dc284){return function(){TeamEvents[_0x9b68('0x3')](_0x2ea337,_0x2dc284);};}exports['register']=function(_0x1139f2){for(var _0x136d42=0x0,_0x10b3f5=events[_0x9b68('0x4')];_0x136d42<_0x10b3f5;_0x136d42++){var _0x26216c=events[_0x136d42];var _0x404399=createListener(_0x9b68('0x5')+_0x26216c,_0x1139f2);TeamEvents['on'](_0x26216c,_0x404399);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index d8d9b1b..02cacec 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 _0x8cc8=['sequelize','exports','INTEGER'];(function(_0x43ada0,_0x4d4c5a){var _0x33531f=function(_0x1b5ba8){while(--_0x1b5ba8){_0x43ada0['push'](_0x43ada0['shift']());}};_0x33531f(++_0x4d4c5a);}(_0x8cc8,0x177));var _0x88cc=function(_0x283170,_0x5cc2e1){_0x283170=_0x283170-0x0;var _0x1437f9=_0x8cc8[_0x283170];return _0x1437f9;};'use strict';var Sequelize=require(_0x88cc('0x0'));module[_0x88cc('0x1')]={'TeamId':{'type':Sequelize[_0x88cc('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x88cc('0x2')]}}; \ No newline at end of file +var _0x3fec=['sequelize','INTEGER'];(function(_0x13e850,_0x50d8fa){var _0x5c2995=function(_0x53d361){while(--_0x53d361){_0x13e850['push'](_0x13e850['shift']());}};_0x5c2995(++_0x50d8fa);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc3fe('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc3fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index cc1ed45..47bb8ab 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 _0x174b=['path','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise'];(function(_0x2ae97e,_0x1071e6){var _0x205fa1=function(_0x3411ce){while(--_0x3411ce){_0x2ae97e['push'](_0x2ae97e['shift']());}};_0x205fa1(++_0x1071e6);}(_0x174b,0x19d));var _0xb174=function(_0x432b34,_0x1a86de){_0x432b34=_0x432b34-0x0;var _0x5eca50=_0x174b[_0x432b34];return _0x5eca50;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb174('0x1'));var moment=require(_0xb174('0x2'));var BPromise=require(_0xb174('0x3'));var rp=require(_0xb174('0x4'));var fs=require('fs');var path=require(_0xb174('0x5'));var rimraf=require(_0xb174('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xb174('0x7')]=function(_0x3e81c9,_0x326afc){return _0x3e81c9[_0xb174('0x8')](_0xb174('0x9'),attributes,{'tableName':_0xb174('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','TeamVoicePrefix','lodash','util'];(function(_0x329935,_0x24b29f){var _0x26d30a=function(_0x4a669f){while(--_0x4a669f){_0x329935['push'](_0x329935['shift']());}};_0x26d30a(++_0x24b29f);}(_0x63a5,0x18e));var _0x563a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x63a5[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var logger=require(_0x563a('0x2'))('api');var moment=require(_0x563a('0x3'));var BPromise=require('bluebird');var rp=require(_0x563a('0x4'));var fs=require('fs');var path=require(_0x563a('0x5'));var rimraf=require(_0x563a('0x6'));var config=require(_0x563a('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x1fdcb0,_0x5a6458){return _0x1fdcb0[_0x563a('0x8')](_0x563a('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8fa1715..1e4881a 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x23b7e4,_0x1c9417){var _0x40d91b=function(_0x398d53){while(--_0x398d53){_0x23b7e4['push'](_0x23b7e4['shift']());}};_0x40d91b(++_0x1c9417);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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 441bd1a..5c06ac6 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 _0xbb74=['sequelize','INTEGER'];(function(_0x20fc32,_0x2f4981){var _0x2c6e0d=function(_0x1747de){while(--_0x1747de){_0x20fc32['push'](_0x20fc32['shift']());}};_0x2c6e0d(++_0x2f4981);}(_0xbb74,0x116));var _0x4bb7=function(_0x204b81,_0x26783e){_0x204b81=_0x204b81-0x0;var _0x4833e9=_0xbb74[_0x204b81];return _0x4833e9;};'use strict';var Sequelize=require(_0x4bb7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4bb7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd69=['exports','INTEGER','sequelize'];(function(_0xf70116,_0x2d92de){var _0x412da4=function(_0x599c35){while(--_0x599c35){_0xf70116['push'](_0xf70116['shift']());}};_0x412da4(++_0x2d92de);}(_0xfd69,0xa4));var _0x9fd6=function(_0x42210c,_0x379f80){_0x42210c=_0x42210c-0x0;var _0x7f1ff=_0xfd69[_0x42210c];return _0x7f1ff;};'use strict';var Sequelize=require(_0x9fd6('0x0'));module[_0x9fd6('0x1')]={'penalty':{'type':Sequelize[_0x9fd6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index c9d5961..d28dc4c 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(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0xe5b3,0x133));var _0x3e5b=function(_0x204be9,_0x525eaf){_0x204be9=_0x204be9-0x0;var _0x54fe9c=_0xe5b3[_0x204be9];return _0x54fe9c;};'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 _0xe2cc=['team_has_voice_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x3df899,_0x1ad444){var _0x507a91=function(_0x17684f){while(--_0x17684f){_0x3df899['push'](_0x3df899['shift']());}};_0x507a91(++_0x1ad444);}(_0xe2cc,0x69));var _0xce2c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe2cc[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xce2c('0x2'));var BPromise=require(_0xce2c('0x3'));var rp=require(_0xce2c('0x4'));var fs=require('fs');var path=require(_0xce2c('0x5'));var rimraf=require(_0xce2c('0x6'));var config=require(_0xce2c('0x7'));var attributes=require(_0xce2c('0x8'));module[_0xce2c('0x9')]=function(_0x592e10,_0x51e5d0){return _0x592e10[_0xce2c('0xa')](_0xce2c('0xb'),attributes,{'tableName':_0xce2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index fe8fd00..ef0eab8 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 _0x865c=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x865c,0x91));var _0xc865=function(_0x4ff0d8,_0x32a4af){_0x4ff0d8=_0x4ff0d8-0x0;var _0x3bfba7=_0x865c[_0x4ff0d8];return _0x3bfba7;};'use strict';var _=require(_0xc865('0x0'));var util=require(_0xc865('0x1'));var moment=require('moment');var BPromise=require(_0xc865('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc865('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc865('0x4'));var logger=require(_0xc865('0x5'))(_0xc865('0x6'));var config=require(_0xc865('0x7'));var jayson=require(_0xc865('0x8'));var client=jayson['client'][_0xc865('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36404c,_0x1897c0,_0x2290c5){return new BPromise(function(_0x31a3b9,_0x275fdc){return client[_0xc865('0xa')](_0x36404c,_0x2290c5)[_0xc865('0xb')](function(_0x374800){logger[_0xc865('0xc')](_0xc865('0xd'),_0x1897c0,_0xc865('0xe'));logger[_0xc865('0xf')](_0xc865('0x10'),_0x1897c0,'request\x20sent',JSON[_0xc865('0x11')](_0x374800));if(_0x374800['error']){if(_0x374800[_0xc865('0x12')][_0xc865('0x13')]===0x1f4){logger[_0xc865('0x12')](_0xc865('0xd'),_0x1897c0,_0x374800['error'][_0xc865('0x14')]);return _0x275fdc(_0x374800['error'][_0xc865('0x14')]);}logger['error'](_0xc865('0xd'),_0x1897c0,_0x374800[_0xc865('0x12')][_0xc865('0x14')]);return _0x31a3b9(_0x374800[_0xc865('0x12')][_0xc865('0x14')]);}else{logger[_0xc865('0xc')](_0xc865('0xd'),_0x1897c0,_0xc865('0xe'));_0x31a3b9(_0x374800[_0xc865('0x15')][_0xc865('0x14')]);}})[_0xc865('0x16')](function(_0x5c1799){logger[_0xc865('0x12')](_0xc865('0xd'),_0x1897c0,_0x5c1799);_0x275fdc(_0x5c1799);});});} \ No newline at end of file +var _0x46a2=['rpc','../../config/environment','jayson/promise','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','randomstring','../../config/utils','../../config/logger'];(function(_0x482d2b,_0x44a077){var _0x5e6bc4=function(_0x17a8a7){while(--_0x17a8a7){_0x482d2b['push'](_0x482d2b['shift']());}};_0x5e6bc4(++_0x44a077);}(_0x46a2,0xfa));var _0x246a=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0x46a2[_0x318410];return _0x2898a3;};'use strict';var _=require(_0x246a('0x0'));var util=require(_0x246a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x246a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x246a('0x3'));var logger=require(_0x246a('0x4'))(_0x246a('0x5'));var config=require(_0x246a('0x6'));var jayson=require(_0x246a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40e01e,_0x4bec45,_0x4ebb0f){return new BPromise(function(_0x2d061d,_0x59ea02){return client['request'](_0x40e01e,_0x4ebb0f)[_0x246a('0x8')](function(_0x16d74a){logger[_0x246a('0x9')](_0x246a('0xa'),_0x4bec45,_0x246a('0xb'));logger[_0x246a('0xc')](_0x246a('0xd'),_0x4bec45,_0x246a('0xb'),JSON['stringify'](_0x16d74a));if(_0x16d74a[_0x246a('0xe')]){if(_0x16d74a[_0x246a('0xe')][_0x246a('0xf')]===0x1f4){logger[_0x246a('0xe')](_0x246a('0xa'),_0x4bec45,_0x16d74a[_0x246a('0xe')]['message']);return _0x59ea02(_0x16d74a['error'][_0x246a('0x10')]);}logger['error'](_0x246a('0xa'),_0x4bec45,_0x16d74a[_0x246a('0xe')][_0x246a('0x10')]);return _0x2d061d(_0x16d74a[_0x246a('0xe')][_0x246a('0x10')]);}else{logger[_0x246a('0x9')](_0x246a('0xa'),_0x4bec45,_0x246a('0xb'));_0x2d061d(_0x16d74a['result'][_0x246a('0x10')]);}})['catch'](function(_0x59f666){logger[_0x246a('0xe')](_0x246a('0xa'),_0x4bec45,_0x59f666);_0x59ea02(_0x59f666);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 82083f1..8bb1822 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 _0x96d8=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x504f3b,_0x385350){var _0x31f12c=function(_0x146e0b){while(--_0x146e0b){_0x504f3b['push'](_0x504f3b['shift']());}};_0x31f12c(++_0x385350);}(_0x96d8,0x1e2));var _0x896d=function(_0x4cfff8,_0x37aa0a){_0x4cfff8=_0x4cfff8-0x0;var _0x3617d7=_0x96d8[_0x4cfff8];return _0x3617d7;};'use strict';var multer=require(_0x896d('0x0'));var util=require(_0x896d('0x1'));var path=require(_0x896d('0x2'));var timeout=require(_0x896d('0x3'));var express=require(_0x896d('0x4'));var router=express[_0x896d('0x5')]();var fs_extra=require(_0x896d('0x6'));var auth=require(_0x896d('0x7'));var interaction=require(_0x896d('0x8'));var config=require(_0x896d('0x9'));var controller=require(_0x896d('0xa'));router[_0x896d('0xb')]('/',auth[_0x896d('0xc')](),controller[_0x896d('0xd')]);router['get'](_0x896d('0xe'),auth[_0x896d('0xc')](),controller[_0x896d('0xf')]);router[_0x896d('0x10')]('/',auth[_0x896d('0xc')](),controller[_0x896d('0x11')]);router[_0x896d('0x12')](_0x896d('0xe'),auth['isAuthenticated'](),controller[_0x896d('0x13')]);router[_0x896d('0x14')](_0x896d('0xe'),auth[_0x896d('0xc')](),controller[_0x896d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0adf=['./template.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x15c60c,_0x278c58){_0x15c60c=_0x15c60c-0x0;var _0x33712a=_0x0adf[_0x15c60c];return _0x33712a;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xe')]('/',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xf')]);router['put'](_0xf0ad('0xc'),auth['isAuthenticated'](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a5c7eba..e653f39 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 _0x9bc2=['TEXT','sequelize','exports','STRING'];(function(_0x3e9b46,_0xe0b9c0){var _0x2e402f=function(_0x3c2b64){while(--_0x3c2b64){_0x3e9b46['push'](_0x3e9b46['shift']());}};_0x2e402f(++_0xe0b9c0);}(_0x9bc2,0x121));var _0x29bc=function(_0x32a2e8,_0x2b28c8){_0x32a2e8=_0x32a2e8-0x0;var _0x7641ae=_0x9bc2[_0x32a2e8];return _0x7641ae;};'use strict';var Sequelize=require(_0x29bc('0x0'));module[_0x29bc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29bc('0x2')]},'html':{'type':Sequelize[_0x29bc('0x3')]}}; \ No newline at end of file +var _0xf468=['exports','STRING','sequelize'];(function(_0x17c3e2,_0x2cce59){var _0x88c181=function(_0x43557a){while(--_0x43557a){_0x17c3e2['push'](_0x17c3e2['shift']());}};_0x88c181(++_0x2cce59);}(_0xf468,0xfb));var _0x8f46=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xf468[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x8f46('0x0'));module[_0x8f46('0x1')]={'name':{'type':Sequelize[_0x8f46('0x2')]},'description':{'type':Sequelize[_0x8f46('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 39c849a..c5231ae 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 _0xb2c4=['to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','Template','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x5d2cf3,_0x16bfd2){var _0x45a3fc=function(_0x24e67f){while(--_0x24e67f){_0x5d2cf3['push'](_0x5d2cf3['shift']());}};_0x45a3fc(++_0x16bfd2);}(_0xb2c4,0x1eb));var _0x4b2c=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xb2c4[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x4b2c('0x0'));var rimraf=require(_0x4b2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b2c('0x2'));var rp=require('request-promise');var moment=require(_0x4b2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b2c('0x4'));var util=require(_0x4b2c('0x5'));var path=require(_0x4b2c('0x6'));var sox=require(_0x4b2c('0x7'));var csv=require('to-csv');var ejs=require(_0x4b2c('0x8'));var fs=require('fs');var fs_extra=require(_0x4b2c('0x9'));var _=require('lodash');var squel=require(_0x4b2c('0xa'));var crypto=require(_0x4b2c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b2c('0xc'));var toCsv=require(_0x4b2c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b2c('0xe'));var authService=require(_0x4b2c('0xf'));var qs=require(_0x4b2c('0x10'));var as=require(_0x4b2c('0x11'));var hardwareService=require(_0x4b2c('0x12'));var logger=require(_0x4b2c('0x13'))(_0x4b2c('0x14'));var utils=require(_0x4b2c('0x15'));var config=require(_0x4b2c('0x16'));var licenseUtil=require(_0x4b2c('0x17'));var db=require(_0x4b2c('0x18'))['db'];function respondWithStatusCode(_0x5caea0,_0x1734ed){_0x1734ed=_0x1734ed||0xcc;return function(_0x2cf5cc){if(_0x2cf5cc){return _0x5caea0[_0x4b2c('0x19')](_0x1734ed);}return _0x5caea0['status'](_0x1734ed)[_0x4b2c('0x1a')]();};}function respondWithResult(_0x13a39b,_0x12fa70){_0x12fa70=_0x12fa70||0xc8;return function(_0x400a78){if(_0x400a78){return _0x13a39b[_0x4b2c('0x1b')](_0x12fa70)['json'](_0x400a78);}};}function respondWithFilteredResult(_0x18270e,_0x5a506e){return function(_0x378e2e){if(_0x378e2e){var _0x2571e2=typeof _0x5a506e[_0x4b2c('0x1c')]===_0x4b2c('0x1d')&&typeof _0x5a506e[_0x4b2c('0x1e')]===_0x4b2c('0x1d');var _0x41d66e=_0x378e2e['count'];var _0x556ad9=_0x2571e2?0x0:_0x5a506e[_0x4b2c('0x1c')];var _0x3dd945=_0x2571e2?_0x378e2e[_0x4b2c('0x1f')]:_0x5a506e['offset']+_0x5a506e[_0x4b2c('0x1e')];var _0x3662ec;if(_0x3dd945>=_0x41d66e){_0x3dd945=_0x41d66e;_0x3662ec=0xc8;}else{_0x3662ec=0xce;}_0x18270e[_0x4b2c('0x1b')](_0x3662ec);return _0x18270e[_0x4b2c('0x20')](_0x4b2c('0x21'),_0x556ad9+'-'+_0x3dd945+'/'+_0x41d66e)[_0x4b2c('0x22')](_0x378e2e);}return null;};}function patchUpdates(_0x3011b5){return function(_0x2b36b3){try{jsonpatch[_0x4b2c('0x23')](_0x2b36b3,_0x3011b5,!![]);}catch(_0x5c47f4){return BPromise[_0x4b2c('0x24')](_0x5c47f4);}return _0x2b36b3['save']();};}function saveUpdates(_0x52155c,_0x4baa54){return function(_0x532fe6){if(_0x532fe6){return _0x532fe6[_0x4b2c('0x25')](_0x52155c)['then'](function(_0x377402){return _0x377402;});}return null;};}function removeEntity(_0x2eab60,_0x584e0e){return function(_0x5ebb9c){if(_0x5ebb9c){return _0x5ebb9c[_0x4b2c('0x26')]()[_0x4b2c('0x27')](function(){var _0x1981d4=_0x5ebb9c[_0x4b2c('0x28')]({'plain':!![]});var _0x49f630=_0x4b2c('0x29');return db[_0x4b2c('0x2a')][_0x4b2c('0x26')]({'where':{'type':_0x49f630,'resourceId':_0x1981d4['id']}})[_0x4b2c('0x27')](function(){return _0x5ebb9c;});})[_0x4b2c('0x27')](function(){_0x2eab60[_0x4b2c('0x1b')](0xcc)[_0x4b2c('0x1a')]();});}};}function handleEntityNotFound(_0x2641a5,_0xcce124){return function(_0x3f28e4){if(!_0x3f28e4){_0x2641a5[_0x4b2c('0x19')](0x194);}return _0x3f28e4;};}function handleError(_0x189678,_0x1c9dae){_0x1c9dae=_0x1c9dae||0x1f4;return function(_0x6c5713){logger[_0x4b2c('0x2b')](_0x6c5713[_0x4b2c('0x2c')]);if(_0x6c5713[_0x4b2c('0x2d')]){delete _0x6c5713[_0x4b2c('0x2d')];}_0x189678['status'](_0x1c9dae)[_0x4b2c('0x2e')](_0x6c5713);};}exports['index']=function(_0x2b5648,_0x17d3cc){var _0x55cd26={},_0x5b25bb={},_0x16e73d={'count':0x0,'rows':[]};var _0x2f4530=_['map'](db[_0x4b2c('0x2f')][_0x4b2c('0x30')],function(_0x5e0ba6){return{'name':_0x5e0ba6['fieldName'],'type':_0x5e0ba6[_0x4b2c('0x31')][_0x4b2c('0x32')]};});_0x5b25bb['model']=_[_0x4b2c('0x33')](_0x2f4530,'name');_0x5b25bb[_0x4b2c('0x34')]=_[_0x4b2c('0x35')](_0x2b5648[_0x4b2c('0x34')]);_0x5b25bb[_0x4b2c('0x36')]=_[_0x4b2c('0x37')](_0x5b25bb['model'],_0x5b25bb[_0x4b2c('0x34')]);_0x55cd26[_0x4b2c('0x38')]=_['intersection'](_0x5b25bb[_0x4b2c('0x39')],qs['fields'](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x3a')]));_0x55cd26[_0x4b2c('0x38')]=_0x55cd26['attributes']['length']?_0x55cd26[_0x4b2c('0x38')]:_0x5b25bb[_0x4b2c('0x39')];if(!_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x3b')](_0x4b2c('0x3c'))){_0x55cd26['limit']=qs[_0x4b2c('0x1e')](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x1e')]);_0x55cd26[_0x4b2c('0x1c')]=qs[_0x4b2c('0x1c')](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x1c')]);}_0x55cd26[_0x4b2c('0x3d')]=qs[_0x4b2c('0x3e')](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x3e')]);_0x55cd26[_0x4b2c('0x3f')]=qs[_0x4b2c('0x36')](_[_0x4b2c('0x40')](_0x2b5648[_0x4b2c('0x34')],_0x5b25bb[_0x4b2c('0x36')]),_0x2f4530);if(_0x2b5648['query'][_0x4b2c('0x41')]){_0x55cd26['where']=_['merge'](_0x55cd26[_0x4b2c('0x3f')],{'$or':_[_0x4b2c('0x33')](_0x2f4530,function(_0x410169){if(_0x410169[_0x4b2c('0x31')]!==_0x4b2c('0x42')){var _0x25c135={};_0x25c135[_0x410169[_0x4b2c('0x2d')]]={'$like':'%'+_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x41')]+'%'};return _0x25c135;}})});}_0x55cd26=_[_0x4b2c('0x43')]({},_0x55cd26,_0x2b5648['options']);var _0x8e239c={'where':_0x55cd26[_0x4b2c('0x3f')]};return db[_0x4b2c('0x2f')]['count'](_0x8e239c)[_0x4b2c('0x27')](function(_0x835976){_0x16e73d[_0x4b2c('0x1f')]=_0x835976;if(_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x44')]){_0x55cd26['include']=[{'all':!![]}];}return db[_0x4b2c('0x2f')][_0x4b2c('0x45')](_0x55cd26);})[_0x4b2c('0x27')](function(_0x552581){_0x16e73d[_0x4b2c('0x46')]=_0x552581;return _0x16e73d;})[_0x4b2c('0x27')](respondWithFilteredResult(_0x17d3cc,_0x55cd26))[_0x4b2c('0x47')](handleError(_0x17d3cc,null));};exports[_0x4b2c('0x48')]=function(_0x1f71a9,_0xef53b6){var _0x2239b4={'raw':!![],'where':{'id':_0x1f71a9[_0x4b2c('0x49')]['id']}},_0x429f84={};_0x429f84['model']=_[_0x4b2c('0x35')](db[_0x4b2c('0x2f')][_0x4b2c('0x30')]);_0x429f84[_0x4b2c('0x34')]=_[_0x4b2c('0x35')](_0x1f71a9[_0x4b2c('0x34')]);_0x429f84[_0x4b2c('0x36')]=_[_0x4b2c('0x37')](_0x429f84[_0x4b2c('0x39')],_0x429f84[_0x4b2c('0x34')]);_0x2239b4[_0x4b2c('0x38')]=_['intersection'](_0x429f84[_0x4b2c('0x39')],qs[_0x4b2c('0x3a')](_0x1f71a9['query'][_0x4b2c('0x3a')]));_0x2239b4[_0x4b2c('0x38')]=_0x2239b4[_0x4b2c('0x38')][_0x4b2c('0x4a')]?_0x2239b4[_0x4b2c('0x38')]:_0x429f84[_0x4b2c('0x39')];if(_0x1f71a9['query'][_0x4b2c('0x44')]){_0x2239b4[_0x4b2c('0x4b')]=[{'all':!![]}];}_0x2239b4=_[_0x4b2c('0x43')]({},_0x2239b4,_0x1f71a9[_0x4b2c('0x4c')]);return db[_0x4b2c('0x2f')][_0x4b2c('0x4d')](_0x2239b4)[_0x4b2c('0x27')](handleEntityNotFound(_0xef53b6,null))['then'](respondWithResult(_0xef53b6,null))[_0x4b2c('0x47')](handleError(_0xef53b6,null));};exports[_0x4b2c('0x4e')]=function(_0x3ed787,_0x50d794){return db[_0x4b2c('0x2f')]['create'](_0x3ed787[_0x4b2c('0x4f')],{})['then'](function(_0x19b134){var _0x498f8e=_0x3ed787['user'][_0x4b2c('0x28')]({'plain':!![]});if(!_0x498f8e)throw new Error(_0x4b2c('0x50'));if(_0x498f8e[_0x4b2c('0x51')]===_0x4b2c('0x52')){var _0x34087d=_0x19b134['get']({'plain':!![]});var _0x10f223=_0x4b2c('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x10f223,'userProfileId':_0x498f8e['userProfileId']},'raw':!![]})[_0x4b2c('0x27')](function(_0x3f5608){if(_0x3f5608&&_0x3f5608['autoAssociation']===0x0){return db[_0x4b2c('0x2a')]['create']({'name':_0x34087d['name'],'resourceId':_0x34087d['id'],'type':_0x3f5608[_0x4b2c('0x2d')],'sectionId':_0x3f5608['id']},{})[_0x4b2c('0x27')](function(){return _0x19b134;});}else{return _0x19b134;}})['catch'](function(_0x4eb05a){logger[_0x4b2c('0x2b')](_0x4b2c('0x53'),_0x4eb05a);throw _0x4eb05a;});}return _0x19b134;})[_0x4b2c('0x27')](respondWithResult(_0x50d794,0xc9))[_0x4b2c('0x47')](handleError(_0x50d794,null));};exports[_0x4b2c('0x25')]=function(_0x1b0e06,_0x8c6590){if(_0x1b0e06[_0x4b2c('0x4f')]['id']){delete _0x1b0e06[_0x4b2c('0x4f')]['id'];}return db['Template'][_0x4b2c('0x4d')]({'where':{'id':_0x1b0e06[_0x4b2c('0x49')]['id']}})[_0x4b2c('0x27')](handleEntityNotFound(_0x8c6590,null))[_0x4b2c('0x27')](saveUpdates(_0x1b0e06[_0x4b2c('0x4f')],null))[_0x4b2c('0x27')](respondWithResult(_0x8c6590,null))['catch'](handleError(_0x8c6590,null));};exports[_0x4b2c('0x26')]=function(_0x10f533,_0x1dca09){return db[_0x4b2c('0x2f')]['find']({'where':{'id':_0x10f533[_0x4b2c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1dca09,null))[_0x4b2c('0x27')](removeEntity(_0x1dca09,null))[_0x4b2c('0x47')](handleError(_0x1dca09,null));}; \ No newline at end of file +var _0x64a1=['includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','index','map','Template','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x4a5d15,_0x409bac){var _0x562ae4=function(_0x5c6da5){while(--_0x5c6da5){_0x4a5d15['push'](_0x4a5d15['shift']());}};_0x562ae4(++_0x409bac);}(_0x64a1,0xba));var _0x164a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x64a1[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x164a('0x0'));var rimraf=require(_0x164a('0x1'));var zipdir=require(_0x164a('0x2'));var jsonpatch=require(_0x164a('0x3'));var rp=require(_0x164a('0x4'));var moment=require('moment');var BPromise=require(_0x164a('0x5'));var Mustache=require(_0x164a('0x6'));var util=require(_0x164a('0x7'));var path=require(_0x164a('0x8'));var sox=require(_0x164a('0x9'));var csv=require(_0x164a('0xa'));var ejs=require(_0x164a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x164a('0xc'));var squel=require(_0x164a('0xd'));var crypto=require(_0x164a('0xe'));var jsforce=require(_0x164a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x164a('0x10'));var Redis=require(_0x164a('0x11'));var authService=require(_0x164a('0x12'));var qs=require(_0x164a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x164a('0x14'));var logger=require(_0x164a('0x15'))(_0x164a('0x16'));var utils=require(_0x164a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x164a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52bff8,_0x2512fe){_0x2512fe=_0x2512fe||0xcc;return function(_0x4c4b2b){if(_0x4c4b2b){return _0x52bff8[_0x164a('0x19')](_0x2512fe);}return _0x52bff8[_0x164a('0x1a')](_0x2512fe)[_0x164a('0x1b')]();};}function respondWithResult(_0x12c989,_0xdc9714){_0xdc9714=_0xdc9714||0xc8;return function(_0x5788e0){if(_0x5788e0){return _0x12c989['status'](_0xdc9714)[_0x164a('0x1c')](_0x5788e0);}};}function respondWithFilteredResult(_0x1891fb,_0x1a35ce){return function(_0x2a2625){if(_0x2a2625){var _0x478aab=typeof _0x1a35ce['offset']===_0x164a('0x1d')&&typeof _0x1a35ce['limit']==='undefined';var _0x8e3378=_0x2a2625[_0x164a('0x1e')];var _0x3ee193=_0x478aab?0x0:_0x1a35ce[_0x164a('0x1f')];var _0x530fb7=_0x478aab?_0x2a2625[_0x164a('0x1e')]:_0x1a35ce[_0x164a('0x1f')]+_0x1a35ce['limit'];var _0x309067;if(_0x530fb7>=_0x8e3378){_0x530fb7=_0x8e3378;_0x309067=0xc8;}else{_0x309067=0xce;}_0x1891fb[_0x164a('0x1a')](_0x309067);return _0x1891fb[_0x164a('0x20')](_0x164a('0x21'),_0x3ee193+'-'+_0x530fb7+'/'+_0x8e3378)['json'](_0x2a2625);}return null;};}function patchUpdates(_0x2789bb){return function(_0x53cfbd){try{jsonpatch['apply'](_0x53cfbd,_0x2789bb,!![]);}catch(_0x4f7cbd){return BPromise[_0x164a('0x22')](_0x4f7cbd);}return _0x53cfbd['save']();};}function saveUpdates(_0x19996d,_0x48731d){return function(_0x491e27){if(_0x491e27){return _0x491e27[_0x164a('0x23')](_0x19996d)[_0x164a('0x24')](function(_0x51308f){return _0x51308f;});}return null;};}function removeEntity(_0x2a2616,_0xe6330e){return function(_0x54c768){if(_0x54c768){return _0x54c768['destroy']()[_0x164a('0x24')](function(){var _0x32a2ff=_0x54c768[_0x164a('0x25')]({'plain':!![]});var _0x53adb7=_0x164a('0x26');return db[_0x164a('0x27')][_0x164a('0x28')]({'where':{'type':_0x53adb7,'resourceId':_0x32a2ff['id']}})[_0x164a('0x24')](function(){return _0x54c768;});})['then'](function(){_0x2a2616['status'](0xcc)[_0x164a('0x1b')]();});}};}function handleEntityNotFound(_0x22b0e1,_0x41a6e0){return function(_0x2ff53a){if(!_0x2ff53a){_0x22b0e1['sendStatus'](0x194);}return _0x2ff53a;};}function handleError(_0x9ab52,_0x33ee18){_0x33ee18=_0x33ee18||0x1f4;return function(_0x5b7c57){logger[_0x164a('0x29')](_0x5b7c57[_0x164a('0x2a')]);if(_0x5b7c57[_0x164a('0x2b')]){delete _0x5b7c57['name'];}_0x9ab52[_0x164a('0x1a')](_0x33ee18)['send'](_0x5b7c57);};}exports[_0x164a('0x2c')]=function(_0x2508e6,_0x472aa9){var _0x53285f={},_0x400753={},_0x1103ae={'count':0x0,'rows':[]};var _0x21d525=_[_0x164a('0x2d')](db[_0x164a('0x2e')]['rawAttributes'],function(_0x3f19a6){return{'name':_0x3f19a6[_0x164a('0x2f')],'type':_0x3f19a6[_0x164a('0x30')][_0x164a('0x31')]};});_0x400753[_0x164a('0x32')]=_[_0x164a('0x2d')](_0x21d525,'name');_0x400753[_0x164a('0x33')]=_[_0x164a('0x34')](_0x2508e6['query']);_0x400753[_0x164a('0x35')]=_[_0x164a('0x36')](_0x400753[_0x164a('0x32')],_0x400753[_0x164a('0x33')]);_0x53285f[_0x164a('0x37')]=_[_0x164a('0x36')](_0x400753[_0x164a('0x32')],qs[_0x164a('0x38')](_0x2508e6['query'][_0x164a('0x38')]));_0x53285f[_0x164a('0x37')]=_0x53285f[_0x164a('0x37')][_0x164a('0x39')]?_0x53285f[_0x164a('0x37')]:_0x400753[_0x164a('0x32')];if(!_0x2508e6[_0x164a('0x33')][_0x164a('0x3a')](_0x164a('0x3b'))){_0x53285f[_0x164a('0x3c')]=qs[_0x164a('0x3c')](_0x2508e6['query']['limit']);_0x53285f['offset']=qs['offset'](_0x2508e6[_0x164a('0x33')][_0x164a('0x1f')]);}_0x53285f[_0x164a('0x3d')]=qs['sort'](_0x2508e6[_0x164a('0x33')][_0x164a('0x3e')]);_0x53285f[_0x164a('0x3f')]=qs['filters'](_[_0x164a('0x40')](_0x2508e6[_0x164a('0x33')],_0x400753[_0x164a('0x35')]),_0x21d525);if(_0x2508e6[_0x164a('0x33')][_0x164a('0x41')]){_0x53285f[_0x164a('0x3f')]=_['merge'](_0x53285f[_0x164a('0x3f')],{'$or':_['map'](_0x21d525,function(_0x21357b){if(_0x21357b[_0x164a('0x30')]!==_0x164a('0x42')){var _0x858e37={};_0x858e37[_0x21357b['name']]={'$like':'%'+_0x2508e6[_0x164a('0x33')][_0x164a('0x41')]+'%'};return _0x858e37;}})});}_0x53285f=_[_0x164a('0x43')]({},_0x53285f,_0x2508e6[_0x164a('0x44')]);var _0x3b4e03={'where':_0x53285f[_0x164a('0x3f')]};return db[_0x164a('0x2e')][_0x164a('0x1e')](_0x3b4e03)['then'](function(_0x259f08){_0x1103ae[_0x164a('0x1e')]=_0x259f08;if(_0x2508e6[_0x164a('0x33')][_0x164a('0x45')]){_0x53285f[_0x164a('0x46')]=[{'all':!![]}];}return db[_0x164a('0x2e')][_0x164a('0x47')](_0x53285f);})[_0x164a('0x24')](function(_0x2083cd){_0x1103ae[_0x164a('0x48')]=_0x2083cd;return _0x1103ae;})[_0x164a('0x24')](respondWithFilteredResult(_0x472aa9,_0x53285f))[_0x164a('0x49')](handleError(_0x472aa9,null));};exports['show']=function(_0x58cd1d,_0xf0a138){var _0x5b4350={'raw':!![],'where':{'id':_0x58cd1d['params']['id']}},_0x311197={};_0x311197[_0x164a('0x32')]=_['keys'](db[_0x164a('0x2e')][_0x164a('0x4a')]);_0x311197['query']=_[_0x164a('0x34')](_0x58cd1d['query']);_0x311197[_0x164a('0x35')]=_[_0x164a('0x36')](_0x311197[_0x164a('0x32')],_0x311197[_0x164a('0x33')]);_0x5b4350[_0x164a('0x37')]=_[_0x164a('0x36')](_0x311197[_0x164a('0x32')],qs[_0x164a('0x38')](_0x58cd1d[_0x164a('0x33')][_0x164a('0x38')]));_0x5b4350[_0x164a('0x37')]=_0x5b4350[_0x164a('0x37')][_0x164a('0x39')]?_0x5b4350['attributes']:_0x311197[_0x164a('0x32')];if(_0x58cd1d['query'][_0x164a('0x45')]){_0x5b4350['include']=[{'all':!![]}];}_0x5b4350=_['merge']({},_0x5b4350,_0x58cd1d[_0x164a('0x44')]);return db[_0x164a('0x2e')][_0x164a('0x4b')](_0x5b4350)[_0x164a('0x24')](handleEntityNotFound(_0xf0a138,null))[_0x164a('0x24')](respondWithResult(_0xf0a138,null))['catch'](handleError(_0xf0a138,null));};exports[_0x164a('0x4c')]=function(_0x1a5227,_0x173f79){return db[_0x164a('0x2e')][_0x164a('0x4c')](_0x1a5227[_0x164a('0x4d')],{})[_0x164a('0x24')](function(_0x342dfc){var _0x2c8d4e=_0x1a5227[_0x164a('0x4e')][_0x164a('0x25')]({'plain':!![]});if(!_0x2c8d4e)throw new Error(_0x164a('0x4f'));if(_0x2c8d4e[_0x164a('0x50')]===_0x164a('0x4e')){var _0x3df590=_0x342dfc[_0x164a('0x25')]({'plain':!![]});var _0x50858b=_0x164a('0x26');return db['UserProfileSection'][_0x164a('0x4b')]({'where':{'name':_0x50858b,'userProfileId':_0x2c8d4e[_0x164a('0x51')]},'raw':!![]})[_0x164a('0x24')](function(_0x10b3a6){if(_0x10b3a6&&_0x10b3a6[_0x164a('0x52')]===0x0){return db[_0x164a('0x27')][_0x164a('0x4c')]({'name':_0x3df590[_0x164a('0x2b')],'resourceId':_0x3df590['id'],'type':_0x10b3a6['name'],'sectionId':_0x10b3a6['id']},{})['then'](function(){return _0x342dfc;});}else{return _0x342dfc;}})[_0x164a('0x49')](function(_0x1f5a66){logger[_0x164a('0x29')](_0x164a('0x53'),_0x1f5a66);throw _0x1f5a66;});}return _0x342dfc;})[_0x164a('0x24')](respondWithResult(_0x173f79,0xc9))[_0x164a('0x49')](handleError(_0x173f79,null));};exports['update']=function(_0x2cfcc1,_0x2bce5d){if(_0x2cfcc1[_0x164a('0x4d')]['id']){delete _0x2cfcc1['body']['id'];}return db[_0x164a('0x2e')][_0x164a('0x4b')]({'where':{'id':_0x2cfcc1['params']['id']}})[_0x164a('0x24')](handleEntityNotFound(_0x2bce5d,null))[_0x164a('0x24')](saveUpdates(_0x2cfcc1[_0x164a('0x4d')],null))[_0x164a('0x24')](respondWithResult(_0x2bce5d,null))[_0x164a('0x49')](handleError(_0x2bce5d,null));};exports[_0x164a('0x28')]=function(_0x3b8ccb,_0x4aa426){return db[_0x164a('0x2e')][_0x164a('0x4b')]({'where':{'id':_0x3b8ccb[_0x164a('0x54')]['id']}})['then'](handleEntityNotFound(_0x4aa426,null))[_0x164a('0x24')](removeEntity(_0x4aa426,null))[_0x164a('0x49')](handleError(_0x4aa426,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 1ca6a3f..5af115e 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 _0x078c=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./template.attributes','exports','tools_templates'];(function(_0xbd8c33,_0x5d1f67){var _0x4e29ee=function(_0x4ef1e1){while(--_0x4ef1e1){_0xbd8c33['push'](_0xbd8c33['shift']());}};_0x4e29ee(++_0x5d1f67);}(_0x078c,0x18c));var _0xc078=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0x078c[_0x183256];return _0x5394a2;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var logger=require(_0xc078('0x1'))('api');var moment=require(_0xc078('0x2'));var BPromise=require('bluebird');var rp=require(_0xc078('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc078('0x4'));var config=require(_0xc078('0x5'));var attributes=require(_0xc078('0x6'));module[_0xc078('0x7')]=function(_0x7c7ea8,_0x5d7ca6){return _0x7c7ea8['define']('Template',attributes,{'tableName':_0xc078('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd38e=['moment','bluebird','request-promise','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api'];(function(_0x5219e5,_0x4a3da0){var _0x4c69a5=function(_0x120a23){while(--_0x120a23){_0x5219e5['push'](_0x5219e5['shift']());}};_0x4c69a5(++_0x4a3da0);}(_0xd38e,0xe0));var _0xed38=function(_0x2f5d34,_0x13ba4a){_0x2f5d34=_0x2f5d34-0x0;var _0x350cda=_0xd38e[_0x2f5d34];return _0x350cda;};'use strict';var _=require(_0xed38('0x0'));var util=require(_0xed38('0x1'));var logger=require(_0xed38('0x2'))(_0xed38('0x3'));var moment=require(_0xed38('0x4'));var BPromise=require(_0xed38('0x5'));var rp=require(_0xed38('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed38('0x7'));module[_0xed38('0x8')]=function(_0x3c26f7,_0x52c292){return _0x3c26f7[_0xed38('0x9')](_0xed38('0xa'),attributes,{'tableName':_0xed38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index f917c98..2daff75 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 _0xb875=['catch','GetTemplate','options','raw','include','map','model','attributes','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x49e37a,_0x40beae){var _0x56f277=function(_0xa9b029){while(--_0xa9b029){_0x49e37a['push'](_0x49e37a['shift']());}};_0x56f277(++_0x40beae);}(_0xb875,0x167));var _0x5b87=function(_0x51d1ac,_0x3479a6){_0x51d1ac=_0x51d1ac-0x0;var _0x3399b6=_0xb875[_0x51d1ac];return _0x3399b6;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b27af,_0x1fc1a8,_0x46b1bf){return new BPromise(function(_0x1fb944,_0xb2888){return client['request'](_0x5b27af,_0x46b1bf)[_0x5b87('0x9')](function(_0x537f81){logger[_0x5b87('0xa')](_0x5b87('0xb'),_0x1fc1a8,_0x5b87('0xc'));logger[_0x5b87('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent',JSON[_0x5b87('0xe')](_0x537f81));if(_0x537f81[_0x5b87('0xf')]){if(_0x537f81['error'][_0x5b87('0x10')]===0x1f4){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);return _0xb2888(_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);}logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81['error'][_0x5b87('0x11')]);return _0x1fb944(_0x537f81['error'][_0x5b87('0x11')]);}else{logger[_0x5b87('0xa')]('Template,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent');_0x1fb944(_0x537f81[_0x5b87('0x12')]['message']);}})[_0x5b87('0x13')](function(_0x175452){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x175452);_0xb2888(_0x175452);});});}exports[_0x5b87('0x14')]=function(_0x18cfa8){var _0x384289=this;return new Promise(function(_0x4865da,_0x4e6777){return db['Template']['findAll']({'raw':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')][_0x5b87('0x16')]===undefined?!![]:![]:!![],'where':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')]['where']||null:null,'attributes':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8['options']['attributes']||null:null,'limit':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')]['limit']||null:null,'include':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')][_0x5b87('0x17')]?_[_0x5b87('0x18')](_0x18cfa8[_0x5b87('0x15')][_0x5b87('0x17')],function(_0x1afe46){return{'model':db[_0x1afe46[_0x5b87('0x19')]],'as':_0x1afe46['as'],'attributes':_0x1afe46[_0x5b87('0x1a')],'include':_0x1afe46[_0x5b87('0x17')]?_['map'](_0x1afe46[_0x5b87('0x17')],function(_0x250dec){return{'model':db[_0x250dec[_0x5b87('0x19')]],'as':_0x250dec['as'],'attributes':_0x250dec[_0x5b87('0x1a')],'include':_0x250dec[_0x5b87('0x17')]?_[_0x5b87('0x18')](_0x250dec[_0x5b87('0x17')],function(_0x27b4e1){return{'model':db[_0x27b4e1[_0x5b87('0x19')]],'as':_0x27b4e1['as'],'attributes':_0x27b4e1[_0x5b87('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b87('0x9')](function(_0x5a9f77){logger['info'](_0x5b87('0x14'),_0x18cfa8);logger['debug'](_0x5b87('0x14'),_0x18cfa8,JSON[_0x5b87('0xe')](_0x5a9f77));_0x4865da(_0x5a9f77);})['catch'](function(_0x49f639){logger[_0x5b87('0xf')](_0x5b87('0x14'),_0x49f639[_0x5b87('0x11')],_0x18cfa8);_0x4e6777(_0x384289[_0x5b87('0xf')](0x1f4,_0x49f639[_0x5b87('0x11')]));});});}; \ No newline at end of file +var _0xb97f=['limit','include','map','model','debug','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xb97f,0xe6));var _0xfb97=function(_0x2798c7,_0x5f110f){_0x2798c7=_0x2798c7-0x0;var _0x5efc59=_0xb97f[_0x2798c7];return _0x5efc59;};'use strict';var _=require(_0xfb97('0x0'));var util=require('util');var moment=require(_0xfb97('0x1'));var BPromise=require('bluebird');var rs=require(_0xfb97('0x2'));var fs=require('fs');var Redis=require(_0xfb97('0x3'));var db=require(_0xfb97('0x4'))['db'];var utils=require(_0xfb97('0x5'));var logger=require(_0xfb97('0x6'))('rpc');var config=require(_0xfb97('0x7'));var jayson=require(_0xfb97('0x8'));var client=jayson[_0xfb97('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23f921,_0xd7e453,_0x6adae8){return new BPromise(function(_0x5b4e15,_0x57c3ce){return client[_0xfb97('0xa')](_0x23f921,_0x6adae8)[_0xfb97('0xb')](function(_0x108b1d){logger[_0xfb97('0xc')](_0xfb97('0xd'),_0xd7e453,_0xfb97('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0xd7e453,_0xfb97('0xe'),JSON['stringify'](_0x108b1d));if(_0x108b1d[_0xfb97('0xf')]){if(_0x108b1d[_0xfb97('0xf')][_0xfb97('0x10')]===0x1f4){logger[_0xfb97('0xf')](_0xfb97('0xd'),_0xd7e453,_0x108b1d[_0xfb97('0xf')][_0xfb97('0x11')]);return _0x57c3ce(_0x108b1d[_0xfb97('0xf')][_0xfb97('0x11')]);}logger['error'](_0xfb97('0xd'),_0xd7e453,_0x108b1d[_0xfb97('0xf')][_0xfb97('0x11')]);return _0x5b4e15(_0x108b1d['error']['message']);}else{logger[_0xfb97('0xc')](_0xfb97('0xd'),_0xd7e453,_0xfb97('0xe'));_0x5b4e15(_0x108b1d['result'][_0xfb97('0x11')]);}})[_0xfb97('0x12')](function(_0x170501){logger[_0xfb97('0xf')](_0xfb97('0xd'),_0xd7e453,_0x170501);_0x57c3ce(_0x170501);});});}exports[_0xfb97('0x13')]=function(_0x49e82f){var _0x352adc=this;return new Promise(function(_0x5d4337,_0x3cb6ad){return db[_0xfb97('0x14')][_0xfb97('0x15')]({'raw':_0x49e82f['options']?_0x49e82f[_0xfb97('0x16')][_0xfb97('0x17')]===undefined?!![]:![]:!![],'where':_0x49e82f[_0xfb97('0x16')]?_0x49e82f[_0xfb97('0x16')][_0xfb97('0x18')]||null:null,'attributes':_0x49e82f['options']?_0x49e82f['options'][_0xfb97('0x19')]||null:null,'limit':_0x49e82f['options']?_0x49e82f[_0xfb97('0x16')][_0xfb97('0x1a')]||null:null,'include':_0x49e82f[_0xfb97('0x16')]?_0x49e82f[_0xfb97('0x16')][_0xfb97('0x1b')]?_[_0xfb97('0x1c')](_0x49e82f[_0xfb97('0x16')][_0xfb97('0x1b')],function(_0x560efd){return{'model':db[_0x560efd[_0xfb97('0x1d')]],'as':_0x560efd['as'],'attributes':_0x560efd[_0xfb97('0x19')],'include':_0x560efd[_0xfb97('0x1b')]?_[_0xfb97('0x1c')](_0x560efd[_0xfb97('0x1b')],function(_0x3c03b6){return{'model':db[_0x3c03b6[_0xfb97('0x1d')]],'as':_0x3c03b6['as'],'attributes':_0x3c03b6[_0xfb97('0x19')],'include':_0x3c03b6[_0xfb97('0x1b')]?_[_0xfb97('0x1c')](_0x3c03b6[_0xfb97('0x1b')],function(_0x5467a3){return{'model':db[_0x5467a3['model']],'as':_0x5467a3['as'],'attributes':_0x5467a3['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb97('0xb')](function(_0x47edf9){logger[_0xfb97('0xc')](_0xfb97('0x13'),_0x49e82f);logger[_0xfb97('0x1e')](_0xfb97('0x13'),_0x49e82f,JSON[_0xfb97('0x1f')](_0x47edf9));_0x5d4337(_0x47edf9);})[_0xfb97('0x12')](function(_0x507603){logger['error']('GetTemplate',_0x507603[_0xfb97('0x11')],_0x49e82f);_0x3cb6ad(_0x352adc['error'](0x1f4,_0x507603['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index dc130c4..ea319b4 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 _0xa44d=['update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','create','post','/:id/all_conditions','addAllCondition','/:id/actions','addAction','put','/:id'];(function(_0x5f415f,_0x15ba69){var _0x4f9ff7=function(_0xec410f){while(--_0xec410f){_0x5f415f['push'](_0x5f415f['shift']());}};_0x4f9ff7(++_0x15ba69);}(_0xa44d,0xf6));var _0xda44=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xa44d[_0x96f74c];return _0x379222;};'use strict';var multer=require('multer');var util=require(_0xda44('0x0'));var path=require('path');var timeout=require(_0xda44('0x1'));var express=require(_0xda44('0x2'));var router=express[_0xda44('0x3')]();var fs_extra=require(_0xda44('0x4'));var auth=require(_0xda44('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda44('0x6'));var controller=require(_0xda44('0x7'));router[_0xda44('0x8')]('/',auth[_0xda44('0x9')](),controller[_0xda44('0xa')]);router[_0xda44('0x8')]('/:id',auth[_0xda44('0x9')](),controller[_0xda44('0xb')]);router[_0xda44('0x8')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xda44('0xc')]);router[_0xda44('0x8')](_0xda44('0xd'),auth[_0xda44('0x9')](),controller[_0xda44('0xe')]);router[_0xda44('0x8')]('/:id/actions',auth[_0xda44('0x9')](),controller[_0xda44('0xf')]);router['post']('/',auth[_0xda44('0x9')](),controller[_0xda44('0x10')]);router[_0xda44('0x11')](_0xda44('0x12'),auth['isAuthenticated'](),controller[_0xda44('0x13')]);router[_0xda44('0x11')](_0xda44('0xd'),auth[_0xda44('0x9')](),controller['addAnyCondition']);router[_0xda44('0x11')](_0xda44('0x14'),auth['isAuthenticated'](),controller[_0xda44('0x15')]);router[_0xda44('0x16')](_0xda44('0x17'),auth[_0xda44('0x9')](),controller[_0xda44('0x18')]);router['delete'](_0xda44('0x17'),auth[_0xda44('0x9')](),controller[_0xda44('0x19')]);module[_0xda44('0x1a')]=router; \ No newline at end of file +var _0x7f9c=['destroy','exports','util','express','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','delete'];(function(_0x55f9a7,_0x2c2fa4){var _0x18d9bb=function(_0x46ad55){while(--_0x46ad55){_0x55f9a7['push'](_0x55f9a7['shift']());}};_0x18d9bb(++_0x2c2fa4);}(_0x7f9c,0x8c));var _0xc7f9=function(_0x5ec188,_0x7f617){_0x5ec188=_0x5ec188-0x0;var _0x5e3109=_0x7f9c[_0x5ec188];return _0x5e3109;};'use strict';var multer=require('multer');var util=require(_0xc7f9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc7f9('0x1'));var router=express['Router']();var fs_extra=require(_0xc7f9('0x2'));var auth=require(_0xc7f9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc7f9('0x4'));router[_0xc7f9('0x5')]('/',auth[_0xc7f9('0x6')](),controller[_0xc7f9('0x7')]);router[_0xc7f9('0x5')](_0xc7f9('0x8'),auth[_0xc7f9('0x6')](),controller['show']);router[_0xc7f9('0x5')](_0xc7f9('0x9'),auth[_0xc7f9('0x6')](),controller[_0xc7f9('0xa')]);router[_0xc7f9('0x5')]('/:id/any_conditions',auth[_0xc7f9('0x6')](),controller[_0xc7f9('0xb')]);router[_0xc7f9('0x5')]('/:id/actions',auth[_0xc7f9('0x6')](),controller[_0xc7f9('0xc')]);router[_0xc7f9('0xd')]('/',auth[_0xc7f9('0x6')](),controller[_0xc7f9('0xe')]);router[_0xc7f9('0xd')]('/:id/all_conditions',auth[_0xc7f9('0x6')](),controller['addAllCondition']);router[_0xc7f9('0xd')](_0xc7f9('0xf'),auth['isAuthenticated'](),controller[_0xc7f9('0x10')]);router[_0xc7f9('0xd')](_0xc7f9('0x11'),auth[_0xc7f9('0x6')](),controller[_0xc7f9('0x12')]);router[_0xc7f9('0x13')](_0xc7f9('0x8'),auth[_0xc7f9('0x6')](),controller['update']);router[_0xc7f9('0x14')](_0xc7f9('0x8'),auth[_0xc7f9('0x6')](),controller[_0xc7f9('0x15')]);module[_0xc7f9('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ec4caec..c2da91a 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 _0x2f55=['BOOLEAN','exports','STRING'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x2f55,0x112));var _0x52f5=function(_0x18051f,_0x187f33){_0x18051f=_0x18051f-0x0;var _0x372160=_0x2f55[_0x18051f];return _0x372160;};'use strict';var Sequelize=require('sequelize');module[_0x52f5('0x0')]={'name':{'type':Sequelize[_0x52f5('0x1')]},'channel':{'type':Sequelize[_0x52f5('0x1')]},'description':{'type':Sequelize[_0x52f5('0x1')]},'status':{'type':Sequelize[_0x52f5('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xfde5=['BOOLEAN','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfde5,0x19c));var _0x5fde=function(_0x986dbb,_0x4885df){_0x986dbb=_0x986dbb-0x0;var _0x2fea95=_0xfde5[_0x986dbb];return _0x2fea95;};'use strict';var Sequelize=require(_0x5fde('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5fde('0x1')]},'description':{'type':Sequelize[_0x5fde('0x1')]},'status':{'type':Sequelize[_0x5fde('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 2491e1a..7561c01 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 _0x8902=['show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','filter','getAnyConditions','addAction','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','catch'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x8902,0x1de));var _0x2890=function(_0x3552a2,_0x3fe749){_0x3552a2=_0x3552a2-0x0;var _0x21ce29=_0x8902[_0x3552a2];return _0x21ce29;};'use strict';var emlformat=require(_0x2890('0x0'));var rimraf=require(_0x2890('0x1'));var zipdir=require(_0x2890('0x2'));var jsonpatch=require(_0x2890('0x3'));var rp=require(_0x2890('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2890('0x5'));var util=require(_0x2890('0x6'));var path=require('path');var sox=require(_0x2890('0x7'));var csv=require('to-csv');var ejs=require(_0x2890('0x8'));var fs=require('fs');var fs_extra=require(_0x2890('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2890('0xa'));var jsforce=require(_0x2890('0xb'));var deskjs=require(_0x2890('0xc'));var toCsv=require(_0x2890('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2890('0xe'));var authService=require(_0x2890('0xf'));var qs=require(_0x2890('0x10'));var as=require(_0x2890('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2890('0x12'))(_0x2890('0x13'));var utils=require(_0x2890('0x14'));var config=require(_0x2890('0x15'));var licenseUtil=require(_0x2890('0x16'));var db=require(_0x2890('0x17'))['db'];function respondWithStatusCode(_0x5c4467,_0x4e62ec){_0x4e62ec=_0x4e62ec||0xcc;return function(_0x56e74d){if(_0x56e74d){return _0x5c4467['sendStatus'](_0x4e62ec);}return _0x5c4467[_0x2890('0x18')](_0x4e62ec)[_0x2890('0x19')]();};}function respondWithResult(_0x469ad0,_0x39eba6){_0x39eba6=_0x39eba6||0xc8;return function(_0x5e9ca5){if(_0x5e9ca5){return _0x469ad0[_0x2890('0x18')](_0x39eba6)['json'](_0x5e9ca5);}};}function respondWithFilteredResult(_0x578d94,_0x593345){return function(_0x244062){if(_0x244062){var _0x34793e=typeof _0x593345[_0x2890('0x1a')]===_0x2890('0x1b')&&typeof _0x593345[_0x2890('0x1c')]==='undefined';var _0x1f9995=_0x244062[_0x2890('0x1d')];var _0x5e1a48=_0x34793e?0x0:_0x593345[_0x2890('0x1a')];var _0x29eb7e=_0x34793e?_0x244062[_0x2890('0x1d')]:_0x593345[_0x2890('0x1a')]+_0x593345[_0x2890('0x1c')];var _0xa66396;if(_0x29eb7e>=_0x1f9995){_0x29eb7e=_0x1f9995;_0xa66396=0xc8;}else{_0xa66396=0xce;}_0x578d94[_0x2890('0x18')](_0xa66396);return _0x578d94['set']('Content-Range',_0x5e1a48+'-'+_0x29eb7e+'/'+_0x1f9995)[_0x2890('0x1e')](_0x244062);}return null;};}function patchUpdates(_0x444add){return function(_0x1684f1){try{jsonpatch['apply'](_0x1684f1,_0x444add,!![]);}catch(_0x5f4fe2){return BPromise[_0x2890('0x1f')](_0x5f4fe2);}return _0x1684f1[_0x2890('0x20')]();};}function saveUpdates(_0x2a839e,_0x31ae19){return function(_0x5451f9){if(_0x5451f9){return _0x5451f9['update'](_0x2a839e)[_0x2890('0x21')](function(_0x2e8fdc){return _0x2e8fdc;});}return null;};}function removeEntity(_0x56c3f2,_0x3ff89e){return function(_0x1d5f08){if(_0x1d5f08){return _0x1d5f08[_0x2890('0x22')]()[_0x2890('0x21')](function(){var _0x2b6b7a=_0x1d5f08[_0x2890('0x23')]({'plain':!![]});var _0x2a5234=_0x2890('0x24');return db[_0x2890('0x25')]['destroy']({'where':{'type':_0x2a5234,'resourceId':_0x2b6b7a['id']}})['then'](function(){return _0x1d5f08;});})[_0x2890('0x21')](function(){_0x56c3f2[_0x2890('0x18')](0xcc)[_0x2890('0x19')]();});}};}function handleEntityNotFound(_0x264f5e,_0x509622){return function(_0xbebb16){if(!_0xbebb16){_0x264f5e['sendStatus'](0x194);}return _0xbebb16;};}function handleError(_0x1ca749,_0x4adc16){_0x4adc16=_0x4adc16||0x1f4;return function(_0x4a6b53){logger[_0x2890('0x26')](_0x4a6b53[_0x2890('0x27')]);if(_0x4a6b53[_0x2890('0x28')]){delete _0x4a6b53[_0x2890('0x28')];}_0x1ca749['status'](_0x4adc16)[_0x2890('0x29')](_0x4a6b53);};}exports[_0x2890('0x2a')]=function(_0x2a51b1,_0x33a35d){var _0x103a4c={},_0x5bac99={},_0x3e1455={'count':0x0,'rows':[]};var _0x37465b=_[_0x2890('0x2b')](db[_0x2890('0x2c')]['rawAttributes'],function(_0x5ccb23){return{'name':_0x5ccb23[_0x2890('0x2d')],'type':_0x5ccb23[_0x2890('0x2e')][_0x2890('0x2f')]};});_0x5bac99[_0x2890('0x30')]=_[_0x2890('0x2b')](_0x37465b,'name');_0x5bac99[_0x2890('0x31')]=_[_0x2890('0x32')](_0x2a51b1['query']);_0x5bac99[_0x2890('0x33')]=_[_0x2890('0x34')](_0x5bac99[_0x2890('0x30')],_0x5bac99[_0x2890('0x31')]);_0x103a4c[_0x2890('0x35')]=_[_0x2890('0x34')](_0x5bac99[_0x2890('0x30')],qs[_0x2890('0x36')](_0x2a51b1[_0x2890('0x31')]['fields']));_0x103a4c['attributes']=_0x103a4c[_0x2890('0x35')]['length']?_0x103a4c[_0x2890('0x35')]:_0x5bac99['model'];if(!_0x2a51b1[_0x2890('0x31')][_0x2890('0x37')](_0x2890('0x38'))){_0x103a4c['limit']=qs[_0x2890('0x1c')](_0x2a51b1[_0x2890('0x31')][_0x2890('0x1c')]);_0x103a4c[_0x2890('0x1a')]=qs['offset'](_0x2a51b1[_0x2890('0x31')][_0x2890('0x1a')]);}_0x103a4c[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x2a51b1['query'][_0x2890('0x3a')]);_0x103a4c[_0x2890('0x3b')]=qs[_0x2890('0x33')](_[_0x2890('0x3c')](_0x2a51b1[_0x2890('0x31')],_0x5bac99[_0x2890('0x33')]),_0x37465b);if(_0x2a51b1[_0x2890('0x31')]['filter']){_0x103a4c[_0x2890('0x3b')]=_['merge'](_0x103a4c[_0x2890('0x3b')],{'$or':_['map'](_0x37465b,function(_0x350c39){if(_0x350c39[_0x2890('0x2e')]!==_0x2890('0x3d')){var _0x56d016={};_0x56d016[_0x350c39[_0x2890('0x28')]]={'$like':'%'+_0x2a51b1['query']['filter']+'%'};return _0x56d016;}})});}_0x103a4c=_[_0x2890('0x3e')]({},_0x103a4c,_0x2a51b1[_0x2890('0x3f')]);var _0x43ead6={'where':_0x103a4c['where']};return db['Trigger'][_0x2890('0x1d')](_0x43ead6)[_0x2890('0x21')](function(_0x3e5433){_0x3e1455[_0x2890('0x1d')]=_0x3e5433;if(_0x2a51b1[_0x2890('0x31')][_0x2890('0x40')]){_0x103a4c[_0x2890('0x41')]=[{'all':!![]}];}return db['Trigger'][_0x2890('0x42')](_0x103a4c);})[_0x2890('0x21')](function(_0x5af786){_0x3e1455['rows']=_0x5af786;return _0x3e1455;})[_0x2890('0x21')](respondWithFilteredResult(_0x33a35d,_0x103a4c))[_0x2890('0x43')](handleError(_0x33a35d,null));};exports[_0x2890('0x44')]=function(_0x3209d9,_0x1c4a68){var _0x565365={'raw':![],'where':{'id':_0x3209d9[_0x2890('0x45')]['id']}},_0xdb7799={};_0xdb7799['model']=_[_0x2890('0x32')](db[_0x2890('0x2c')][_0x2890('0x46')]);_0xdb7799[_0x2890('0x31')]=_['keys'](_0x3209d9[_0x2890('0x31')]);_0xdb7799[_0x2890('0x33')]=_[_0x2890('0x34')](_0xdb7799[_0x2890('0x30')],_0xdb7799[_0x2890('0x31')]);_0x565365[_0x2890('0x35')]=_[_0x2890('0x34')](_0xdb7799[_0x2890('0x30')],qs[_0x2890('0x36')](_0x3209d9[_0x2890('0x31')][_0x2890('0x36')]));_0x565365[_0x2890('0x35')]=_0x565365[_0x2890('0x35')][_0x2890('0x47')]?_0x565365[_0x2890('0x35')]:_0xdb7799[_0x2890('0x30')];if(_0x3209d9['query'][_0x2890('0x40')]){_0x565365[_0x2890('0x41')]=[{'all':!![]}];}_0x565365=_['merge']({},_0x565365,_0x3209d9[_0x2890('0x3f')]);return db[_0x2890('0x2c')][_0x2890('0x48')](_0x565365)[_0x2890('0x21')](handleEntityNotFound(_0x1c4a68,null))['then'](respondWithResult(_0x1c4a68,null))[_0x2890('0x43')](handleError(_0x1c4a68,null));};exports[_0x2890('0x49')]=function(_0x441292,_0x540f02){return db[_0x2890('0x2c')]['create'](_0x441292[_0x2890('0x4a')],{})[_0x2890('0x21')](function(_0xd0b47a){var _0x2b89c8=_0x441292[_0x2890('0x4b')][_0x2890('0x23')]({'plain':!![]});if(!_0x2b89c8)throw new Error(_0x2890('0x4c'));if(_0x2b89c8['role']===_0x2890('0x4b')){var _0x59e8f4=_0xd0b47a[_0x2890('0x23')]({'plain':!![]});var _0x499187=_0x2890('0x24');return db['UserProfileSection'][_0x2890('0x48')]({'where':{'name':_0x499187,'userProfileId':_0x2b89c8[_0x2890('0x4d')]},'raw':!![]})[_0x2890('0x21')](function(_0x5dc8d7){if(_0x5dc8d7&&_0x5dc8d7[_0x2890('0x4e')]===0x0){return db[_0x2890('0x25')][_0x2890('0x49')]({'name':_0x59e8f4[_0x2890('0x28')],'resourceId':_0x59e8f4['id'],'type':_0x5dc8d7[_0x2890('0x28')],'sectionId':_0x5dc8d7['id']},{})[_0x2890('0x21')](function(){return _0xd0b47a;});}else{return _0xd0b47a;}})[_0x2890('0x43')](function(_0x209076){logger[_0x2890('0x26')](_0x2890('0x4f'),_0x209076);throw _0x209076;});}return _0xd0b47a;})[_0x2890('0x21')](respondWithResult(_0x540f02,0xc9))[_0x2890('0x43')](handleError(_0x540f02,null));};exports[_0x2890('0x50')]=function(_0x2599ea,_0x1b2250){if(_0x2599ea['body']['id']){delete _0x2599ea[_0x2890('0x4a')]['id'];}return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x2599ea[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x1b2250,null))[_0x2890('0x21')](saveUpdates(_0x2599ea['body'],null))['then'](respondWithResult(_0x1b2250,null))[_0x2890('0x43')](handleError(_0x1b2250,null));};exports[_0x2890('0x22')]=function(_0x31b696,_0xd9fd43){return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x31b696[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0xd9fd43,null))[_0x2890('0x21')](removeEntity(_0xd9fd43,null))[_0x2890('0x43')](handleError(_0xd9fd43,null));};exports[_0x2890('0x51')]=function(_0x5eebd2,_0x26136f,_0x537085){if(_0x5eebd2['body']['id']){delete _0x5eebd2[_0x2890('0x4a')]['id'];}return db[_0x2890('0x2c')]['find']({'where':{'id':_0x5eebd2['params']['id']}})['then'](handleEntityNotFound(_0x26136f,null))[_0x2890('0x21')](function(_0xb1a58c){if(_0xb1a58c){_0x5eebd2[_0x2890('0x4a')][_0x2890('0x52')]=_0xb1a58c['id'];return db[_0x2890('0x53')][_0x2890('0x49')](_0x5eebd2[_0x2890('0x4a')]);}})[_0x2890('0x21')](respondWithResult(_0x26136f,null))[_0x2890('0x43')](handleError(_0x26136f,null));};exports[_0x2890('0x54')]=function(_0x35f43e,_0x2540e3,_0x2dc99e){if(_0x35f43e[_0x2890('0x4a')]['id']){delete _0x35f43e['body']['id'];}return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x35f43e[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x2540e3,null))[_0x2890('0x21')](function(_0x37a16a){if(_0x37a16a){_0x35f43e[_0x2890('0x4a')]['TriggerAnyId']=_0x37a16a['id'];return db['Condition']['create'](_0x35f43e[_0x2890('0x4a')]);}})['then'](respondWithResult(_0x2540e3,null))[_0x2890('0x43')](handleError(_0x2540e3,null));};exports[_0x2890('0x55')]=function(_0x50eb6d,_0x53f1c4,_0x3866c7){var _0x2feb92={};var _0x15b756={};var _0x612b49;var _0x5a544a;return db[_0x2890('0x2c')][_0x2890('0x56')]({'where':{'id':_0x50eb6d[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x53f1c4,null))[_0x2890('0x21')](function(_0x17c8df){if(_0x17c8df){_0x612b49=_0x17c8df;_0x15b756[_0x2890('0x30')]=_[_0x2890('0x32')](db[_0x2890('0x53')][_0x2890('0x46')]);_0x15b756[_0x2890('0x31')]=_[_0x2890('0x32')](_0x50eb6d[_0x2890('0x31')]);_0x15b756['filters']=_[_0x2890('0x34')](_0x15b756[_0x2890('0x30')],_0x15b756[_0x2890('0x31')]);_0x2feb92[_0x2890('0x35')]=_['intersection'](_0x15b756[_0x2890('0x30')],qs[_0x2890('0x36')](_0x50eb6d[_0x2890('0x31')][_0x2890('0x36')]));_0x2feb92[_0x2890('0x35')]=_0x2feb92[_0x2890('0x35')]['length']?_0x2feb92[_0x2890('0x35')]:_0x15b756[_0x2890('0x30')];_0x2feb92[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x50eb6d['query'][_0x2890('0x3a')]);_0x2feb92[_0x2890('0x3b')]=qs['filters'](_['pick'](_0x50eb6d['query'],_0x15b756[_0x2890('0x33')]));if(_0x50eb6d[_0x2890('0x31')][_0x2890('0x57')]){_0x2feb92[_0x2890('0x3b')]=_['merge'](_0x2feb92[_0x2890('0x3b')],{'$or':_[_0x2890('0x2b')](_0x2feb92[_0x2890('0x35')],function(_0x413700){var _0x47673f={};_0x47673f[_0x413700]={'$like':'%'+_0x50eb6d['query'][_0x2890('0x57')]+'%'};return _0x47673f;})});}_0x2feb92=_[_0x2890('0x3e')]({},_0x2feb92,_0x50eb6d['options']);return _0x612b49[_0x2890('0x55')](_0x2feb92);}})[_0x2890('0x21')](function(_0x34853a){if(_0x34853a){_0x5a544a=_0x34853a[_0x2890('0x47')];if(!_0x50eb6d[_0x2890('0x31')][_0x2890('0x37')](_0x2890('0x38'))){_0x2feb92[_0x2890('0x1c')]=qs[_0x2890('0x1c')](_0x50eb6d['query'][_0x2890('0x1c')]);_0x2feb92['offset']=qs[_0x2890('0x1a')](_0x50eb6d['query']['offset']);}return _0x612b49[_0x2890('0x55')](_0x2feb92);}})['then'](function(_0xd1a222){if(_0xd1a222){return _0xd1a222?{'count':_0x5a544a,'rows':_0xd1a222}:null;}})[_0x2890('0x21')](respondWithResult(_0x53f1c4,null))['catch'](handleError(_0x53f1c4,null));};exports[_0x2890('0x58')]=function(_0x43cc51,_0x3ab1c0,_0x21c6ef){var _0x5c734b={};var _0x1a856b={};var _0x501a60;var _0x7961ab;return db[_0x2890('0x2c')][_0x2890('0x56')]({'where':{'id':_0x43cc51[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x3ab1c0,null))[_0x2890('0x21')](function(_0x5427d5){if(_0x5427d5){_0x501a60=_0x5427d5;_0x1a856b[_0x2890('0x30')]=_[_0x2890('0x32')](db[_0x2890('0x53')][_0x2890('0x46')]);_0x1a856b['query']=_[_0x2890('0x32')](_0x43cc51[_0x2890('0x31')]);_0x1a856b[_0x2890('0x33')]=_[_0x2890('0x34')](_0x1a856b[_0x2890('0x30')],_0x1a856b['query']);_0x5c734b[_0x2890('0x35')]=_['intersection'](_0x1a856b[_0x2890('0x30')],qs[_0x2890('0x36')](_0x43cc51[_0x2890('0x31')][_0x2890('0x36')]));_0x5c734b[_0x2890('0x35')]=_0x5c734b[_0x2890('0x35')][_0x2890('0x47')]?_0x5c734b[_0x2890('0x35')]:_0x1a856b[_0x2890('0x30')];_0x5c734b[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x43cc51[_0x2890('0x31')][_0x2890('0x3a')]);_0x5c734b[_0x2890('0x3b')]=qs[_0x2890('0x33')](_[_0x2890('0x3c')](_0x43cc51[_0x2890('0x31')],_0x1a856b[_0x2890('0x33')]));if(_0x43cc51[_0x2890('0x31')][_0x2890('0x57')]){_0x5c734b[_0x2890('0x3b')]=_[_0x2890('0x3e')](_0x5c734b[_0x2890('0x3b')],{'$or':_['map'](_0x5c734b[_0x2890('0x35')],function(_0x5acd0b){var _0x4f644a={};_0x4f644a[_0x5acd0b]={'$like':'%'+_0x43cc51[_0x2890('0x31')][_0x2890('0x57')]+'%'};return _0x4f644a;})});}_0x5c734b=_[_0x2890('0x3e')]({},_0x5c734b,_0x43cc51[_0x2890('0x3f')]);return _0x501a60[_0x2890('0x58')](_0x5c734b);}})[_0x2890('0x21')](function(_0x1b829c){if(_0x1b829c){_0x7961ab=_0x1b829c[_0x2890('0x47')];if(!_0x43cc51[_0x2890('0x31')][_0x2890('0x37')](_0x2890('0x38'))){_0x5c734b[_0x2890('0x1c')]=qs[_0x2890('0x1c')](_0x43cc51[_0x2890('0x31')][_0x2890('0x1c')]);_0x5c734b['offset']=qs[_0x2890('0x1a')](_0x43cc51['query']['offset']);}return _0x501a60[_0x2890('0x58')](_0x5c734b);}})[_0x2890('0x21')](function(_0x30e248){if(_0x30e248){return _0x30e248?{'count':_0x7961ab,'rows':_0x30e248}:null;}})['then'](respondWithResult(_0x3ab1c0,null))[_0x2890('0x43')](handleError(_0x3ab1c0,null));};exports[_0x2890('0x59')]=function(_0x1deb3a,_0x2da514,_0x452468){if(_0x1deb3a[_0x2890('0x4a')]['id']){delete _0x1deb3a[_0x2890('0x4a')]['id'];}return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x1deb3a['params']['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x2da514,null))[_0x2890('0x21')](function(_0x1bba60){if(_0x1bba60){_0x1deb3a['body']['TriggerId']=_0x1bba60['id'];return db[_0x2890('0x5a')][_0x2890('0x49')](_0x1deb3a[_0x2890('0x4a')]);}})[_0x2890('0x21')](respondWithResult(_0x2da514,null))[_0x2890('0x43')](handleError(_0x2da514,null));};exports['getActions']=function(_0x2d4779,_0x16477d,_0x570aea){var _0x1c6302={};var _0x1f6398={};var _0x291608;var _0x2ea0b1;return db[_0x2890('0x2c')][_0x2890('0x56')]({'where':{'id':_0x2d4779[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x16477d,null))[_0x2890('0x21')](function(_0x7ce9aa){if(_0x7ce9aa){_0x291608=_0x7ce9aa;_0x1f6398[_0x2890('0x30')]=_['keys'](db[_0x2890('0x5a')][_0x2890('0x46')]);_0x1f6398[_0x2890('0x31')]=_[_0x2890('0x32')](_0x2d4779['query']);_0x1f6398[_0x2890('0x33')]=_['intersection'](_0x1f6398['model'],_0x1f6398[_0x2890('0x31')]);_0x1c6302['attributes']=_[_0x2890('0x34')](_0x1f6398['model'],qs[_0x2890('0x36')](_0x2d4779[_0x2890('0x31')]['fields']));_0x1c6302['attributes']=_0x1c6302[_0x2890('0x35')][_0x2890('0x47')]?_0x1c6302[_0x2890('0x35')]:_0x1f6398[_0x2890('0x30')];_0x1c6302[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x2d4779['query'][_0x2890('0x3a')]);_0x1c6302['where']=qs[_0x2890('0x33')](_[_0x2890('0x3c')](_0x2d4779[_0x2890('0x31')],_0x1f6398[_0x2890('0x33')]));if(_0x2d4779[_0x2890('0x31')][_0x2890('0x57')]){_0x1c6302[_0x2890('0x3b')]=_[_0x2890('0x3e')](_0x1c6302[_0x2890('0x3b')],{'$or':_['map'](_0x1c6302[_0x2890('0x35')],function(_0x42053c){var _0x5ae172={};_0x5ae172[_0x42053c]={'$like':'%'+_0x2d4779[_0x2890('0x31')][_0x2890('0x57')]+'%'};return _0x5ae172;})});}_0x1c6302=_['merge']({},_0x1c6302,_0x2d4779[_0x2890('0x3f')]);return _0x291608['getActions'](_0x1c6302);}})['then'](function(_0x18bc35){if(_0x18bc35){_0x2ea0b1=_0x18bc35[_0x2890('0x47')];if(!_0x2d4779['query'][_0x2890('0x37')]('nolimit')){_0x1c6302[_0x2890('0x1c')]=qs['limit'](_0x2d4779[_0x2890('0x31')][_0x2890('0x1c')]);_0x1c6302['offset']=qs['offset'](_0x2d4779[_0x2890('0x31')]['offset']);}return _0x291608['getActions'](_0x1c6302);}})[_0x2890('0x21')](function(_0x59a07a){if(_0x59a07a){return _0x59a07a?{'count':_0x2ea0b1,'rows':_0x59a07a}:null;}})[_0x2890('0x21')](respondWithResult(_0x16477d,null))[_0x2890('0x43')](handleError(_0x16477d,null));}; \ No newline at end of file +var _0x6b94=['nolimit','order','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','sort','getAnyConditions','addAction','Action','getActions','eml-format','request-promise','bluebird','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','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','error','stack','name','send','Trigger','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x1b2c60,_0x53b096){var _0x1b6b7e=function(_0x5e2b02){while(--_0x5e2b02){_0x1b2c60['push'](_0x1b2c60['shift']());}};_0x1b6b7e(++_0x53b096);}(_0x6b94,0x139));var _0x46b9=function(_0x591b88,_0xd4b097){_0x591b88=_0x591b88-0x0;var _0x1c133c=_0x6b94[_0x591b88];return _0x1c133c;};'use strict';var emlformat=require(_0x46b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46b9('0x1'));var moment=require('moment');var BPromise=require(_0x46b9('0x2'));var Mustache=require('mustache');var util=require(_0x46b9('0x3'));var path=require(_0x46b9('0x4'));var sox=require(_0x46b9('0x5'));var csv=require(_0x46b9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46b9('0x7'));var _=require(_0x46b9('0x8'));var squel=require('squel');var crypto=require(_0x46b9('0x9'));var jsforce=require(_0x46b9('0xa'));var deskjs=require(_0x46b9('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46b9('0xc'));var authService=require(_0x46b9('0xd'));var qs=require(_0x46b9('0xe'));var as=require(_0x46b9('0xf'));var hardwareService=require(_0x46b9('0x10'));var logger=require(_0x46b9('0x11'))('api');var utils=require(_0x46b9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x46b9('0x13'));var db=require(_0x46b9('0x14'))['db'];function respondWithStatusCode(_0x9a79ef,_0x1482d7){_0x1482d7=_0x1482d7||0xcc;return function(_0x2443d7){if(_0x2443d7){return _0x9a79ef[_0x46b9('0x15')](_0x1482d7);}return _0x9a79ef['status'](_0x1482d7)['end']();};}function respondWithResult(_0x40bd94,_0x2c5575){_0x2c5575=_0x2c5575||0xc8;return function(_0x38cba2){if(_0x38cba2){return _0x40bd94[_0x46b9('0x16')](_0x2c5575)[_0x46b9('0x17')](_0x38cba2);}};}function respondWithFilteredResult(_0x4fc60a,_0x140c78){return function(_0x3d7f23){if(_0x3d7f23){var _0x2fc645=typeof _0x140c78[_0x46b9('0x18')]===_0x46b9('0x19')&&typeof _0x140c78[_0x46b9('0x1a')]==='undefined';var _0xd6ea9b=_0x3d7f23[_0x46b9('0x1b')];var _0x188961=_0x2fc645?0x0:_0x140c78[_0x46b9('0x18')];var _0x1c13c0=_0x2fc645?_0x3d7f23['count']:_0x140c78[_0x46b9('0x18')]+_0x140c78[_0x46b9('0x1a')];var _0x5c8942;if(_0x1c13c0>=_0xd6ea9b){_0x1c13c0=_0xd6ea9b;_0x5c8942=0xc8;}else{_0x5c8942=0xce;}_0x4fc60a['status'](_0x5c8942);return _0x4fc60a[_0x46b9('0x1c')](_0x46b9('0x1d'),_0x188961+'-'+_0x1c13c0+'/'+_0xd6ea9b)[_0x46b9('0x17')](_0x3d7f23);}return null;};}function patchUpdates(_0x5881f9){return function(_0x411565){try{jsonpatch[_0x46b9('0x1e')](_0x411565,_0x5881f9,!![]);}catch(_0x2f5c39){return BPromise[_0x46b9('0x1f')](_0x2f5c39);}return _0x411565[_0x46b9('0x20')]();};}function saveUpdates(_0x1a2cb8,_0x591ff2){return function(_0x3c6e92){if(_0x3c6e92){return _0x3c6e92[_0x46b9('0x21')](_0x1a2cb8)[_0x46b9('0x22')](function(_0x1bcfdd){return _0x1bcfdd;});}return null;};}function removeEntity(_0x4857de,_0x17aa98){return function(_0x1db8d7){if(_0x1db8d7){return _0x1db8d7[_0x46b9('0x23')]()['then'](function(){var _0x2ead5b=_0x1db8d7['get']({'plain':!![]});var _0x667542=_0x46b9('0x24');return db[_0x46b9('0x25')][_0x46b9('0x23')]({'where':{'type':_0x667542,'resourceId':_0x2ead5b['id']}})['then'](function(){return _0x1db8d7;});})['then'](function(){_0x4857de[_0x46b9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d91f,_0x4b3fdd){return function(_0x2bf2f6){if(!_0x2bf2f6){_0x53d91f[_0x46b9('0x15')](0x194);}return _0x2bf2f6;};}function handleError(_0x162878,_0x2458b6){_0x2458b6=_0x2458b6||0x1f4;return function(_0x2b8e78){logger[_0x46b9('0x26')](_0x2b8e78[_0x46b9('0x27')]);if(_0x2b8e78[_0x46b9('0x28')]){delete _0x2b8e78['name'];}_0x162878[_0x46b9('0x16')](_0x2458b6)[_0x46b9('0x29')](_0x2b8e78);};}exports['index']=function(_0x5e5637,_0x28fa7e){var _0x5d0634={},_0x2db51e={},_0x2c57d1={'count':0x0,'rows':[]};var _0x519135=_['map'](db[_0x46b9('0x2a')][_0x46b9('0x2b')],function(_0xaa42f0){return{'name':_0xaa42f0[_0x46b9('0x2c')],'type':_0xaa42f0[_0x46b9('0x2d')]['key']};});_0x2db51e['model']=_[_0x46b9('0x2e')](_0x519135,'name');_0x2db51e[_0x46b9('0x2f')]=_['keys'](_0x5e5637[_0x46b9('0x2f')]);_0x2db51e[_0x46b9('0x30')]=_[_0x46b9('0x31')](_0x2db51e[_0x46b9('0x32')],_0x2db51e[_0x46b9('0x2f')]);_0x5d0634[_0x46b9('0x33')]=_[_0x46b9('0x31')](_0x2db51e['model'],qs['fields'](_0x5e5637[_0x46b9('0x2f')][_0x46b9('0x34')]));_0x5d0634['attributes']=_0x5d0634['attributes'][_0x46b9('0x35')]?_0x5d0634[_0x46b9('0x33')]:_0x2db51e['model'];if(!_0x5e5637[_0x46b9('0x2f')][_0x46b9('0x36')](_0x46b9('0x37'))){_0x5d0634['limit']=qs[_0x46b9('0x1a')](_0x5e5637[_0x46b9('0x2f')][_0x46b9('0x1a')]);_0x5d0634['offset']=qs[_0x46b9('0x18')](_0x5e5637[_0x46b9('0x2f')][_0x46b9('0x18')]);}_0x5d0634[_0x46b9('0x38')]=qs['sort'](_0x5e5637[_0x46b9('0x2f')]['sort']);_0x5d0634[_0x46b9('0x39')]=qs[_0x46b9('0x30')](_[_0x46b9('0x3a')](_0x5e5637[_0x46b9('0x2f')],_0x2db51e['filters']),_0x519135);if(_0x5e5637[_0x46b9('0x2f')]['filter']){_0x5d0634[_0x46b9('0x39')]=_[_0x46b9('0x3b')](_0x5d0634[_0x46b9('0x39')],{'$or':_['map'](_0x519135,function(_0x35d20c){if(_0x35d20c[_0x46b9('0x2d')]!==_0x46b9('0x3c')){var _0x35cb22={};_0x35cb22[_0x35d20c['name']]={'$like':'%'+_0x5e5637['query'][_0x46b9('0x3d')]+'%'};return _0x35cb22;}})});}_0x5d0634=_[_0x46b9('0x3b')]({},_0x5d0634,_0x5e5637[_0x46b9('0x3e')]);var _0x4edc1f={'where':_0x5d0634[_0x46b9('0x39')]};return db[_0x46b9('0x2a')][_0x46b9('0x1b')](_0x4edc1f)[_0x46b9('0x22')](function(_0xa041e3){_0x2c57d1[_0x46b9('0x1b')]=_0xa041e3;if(_0x5e5637[_0x46b9('0x2f')]['includeAll']){_0x5d0634[_0x46b9('0x3f')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x5d0634);})['then'](function(_0x1a2729){_0x2c57d1[_0x46b9('0x40')]=_0x1a2729;return _0x2c57d1;})[_0x46b9('0x22')](respondWithFilteredResult(_0x28fa7e,_0x5d0634))[_0x46b9('0x41')](handleError(_0x28fa7e,null));};exports[_0x46b9('0x42')]=function(_0x5b5f41,_0x38c768){var _0x36e1d8={'raw':![],'where':{'id':_0x5b5f41[_0x46b9('0x43')]['id']}},_0x5ef822={};_0x5ef822['model']=_[_0x46b9('0x44')](db[_0x46b9('0x2a')][_0x46b9('0x2b')]);_0x5ef822['query']=_[_0x46b9('0x44')](_0x5b5f41[_0x46b9('0x2f')]);_0x5ef822[_0x46b9('0x30')]=_[_0x46b9('0x31')](_0x5ef822['model'],_0x5ef822[_0x46b9('0x2f')]);_0x36e1d8[_0x46b9('0x33')]=_['intersection'](_0x5ef822['model'],qs['fields'](_0x5b5f41[_0x46b9('0x2f')]['fields']));_0x36e1d8['attributes']=_0x36e1d8['attributes'][_0x46b9('0x35')]?_0x36e1d8[_0x46b9('0x33')]:_0x5ef822[_0x46b9('0x32')];if(_0x5b5f41[_0x46b9('0x2f')][_0x46b9('0x45')]){_0x36e1d8[_0x46b9('0x3f')]=[{'all':!![]}];}_0x36e1d8=_[_0x46b9('0x3b')]({},_0x36e1d8,_0x5b5f41[_0x46b9('0x3e')]);return db[_0x46b9('0x2a')][_0x46b9('0x46')](_0x36e1d8)['then'](handleEntityNotFound(_0x38c768,null))[_0x46b9('0x22')](respondWithResult(_0x38c768,null))[_0x46b9('0x41')](handleError(_0x38c768,null));};exports[_0x46b9('0x47')]=function(_0x47069f,_0x1cdbcd){return db['Trigger'][_0x46b9('0x47')](_0x47069f[_0x46b9('0x48')],{})[_0x46b9('0x22')](function(_0x2f90f0){var _0x56aa48=_0x47069f['user']['get']({'plain':!![]});if(!_0x56aa48)throw new Error(_0x46b9('0x49'));if(_0x56aa48[_0x46b9('0x4a')]===_0x46b9('0x4b')){var _0x502dcd=_0x2f90f0[_0x46b9('0x4c')]({'plain':!![]});var _0x42bed6=_0x46b9('0x24');return db[_0x46b9('0x4d')][_0x46b9('0x46')]({'where':{'name':_0x42bed6,'userProfileId':_0x56aa48[_0x46b9('0x4e')]},'raw':!![]})['then'](function(_0x5897ca){if(_0x5897ca&&_0x5897ca[_0x46b9('0x4f')]===0x0){return db[_0x46b9('0x25')]['create']({'name':_0x502dcd[_0x46b9('0x28')],'resourceId':_0x502dcd['id'],'type':_0x5897ca[_0x46b9('0x28')],'sectionId':_0x5897ca['id']},{})['then'](function(){return _0x2f90f0;});}else{return _0x2f90f0;}})[_0x46b9('0x41')](function(_0x3f4f49){logger['error'](_0x46b9('0x50'),_0x3f4f49);throw _0x3f4f49;});}return _0x2f90f0;})['then'](respondWithResult(_0x1cdbcd,0xc9))['catch'](handleError(_0x1cdbcd,null));};exports[_0x46b9('0x21')]=function(_0x1083c8,_0x2e478f){if(_0x1083c8[_0x46b9('0x48')]['id']){delete _0x1083c8['body']['id'];}return db[_0x46b9('0x2a')][_0x46b9('0x46')]({'where':{'id':_0x1083c8[_0x46b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e478f,null))['then'](saveUpdates(_0x1083c8['body'],null))[_0x46b9('0x22')](respondWithResult(_0x2e478f,null))[_0x46b9('0x41')](handleError(_0x2e478f,null));};exports['destroy']=function(_0x337db1,_0xc554fa){return db['Trigger']['find']({'where':{'id':_0x337db1[_0x46b9('0x43')]['id']}})[_0x46b9('0x22')](handleEntityNotFound(_0xc554fa,null))[_0x46b9('0x22')](removeEntity(_0xc554fa,null))[_0x46b9('0x41')](handleError(_0xc554fa,null));};exports[_0x46b9('0x51')]=function(_0x57911d,_0x2e8957,_0x3eb754){if(_0x57911d['body']['id']){delete _0x57911d[_0x46b9('0x48')]['id'];}return db['Trigger'][_0x46b9('0x46')]({'where':{'id':_0x57911d[_0x46b9('0x43')]['id']}})[_0x46b9('0x22')](handleEntityNotFound(_0x2e8957,null))[_0x46b9('0x22')](function(_0x1ecab3){if(_0x1ecab3){_0x57911d['body'][_0x46b9('0x52')]=_0x1ecab3['id'];return db[_0x46b9('0x53')][_0x46b9('0x47')](_0x57911d['body']);}})[_0x46b9('0x22')](respondWithResult(_0x2e8957,null))['catch'](handleError(_0x2e8957,null));};exports['addAnyCondition']=function(_0x43b1be,_0x1e7340,_0x3a408f){if(_0x43b1be[_0x46b9('0x48')]['id']){delete _0x43b1be[_0x46b9('0x48')]['id'];}return db[_0x46b9('0x2a')][_0x46b9('0x46')]({'where':{'id':_0x43b1be[_0x46b9('0x43')]['id']}})[_0x46b9('0x22')](handleEntityNotFound(_0x1e7340,null))['then'](function(_0x37fda0){if(_0x37fda0){_0x43b1be[_0x46b9('0x48')][_0x46b9('0x54')]=_0x37fda0['id'];return db[_0x46b9('0x53')][_0x46b9('0x47')](_0x43b1be[_0x46b9('0x48')]);}})[_0x46b9('0x22')](respondWithResult(_0x1e7340,null))[_0x46b9('0x41')](handleError(_0x1e7340,null));};exports[_0x46b9('0x55')]=function(_0x2ae37c,_0x4838b4,_0x5cab92){var _0x440734={};var _0x6382a2={};var _0x24fad1;var _0x2a200a;return db[_0x46b9('0x2a')][_0x46b9('0x56')]({'where':{'id':_0x2ae37c[_0x46b9('0x43')]['id']}})[_0x46b9('0x22')](handleEntityNotFound(_0x4838b4,null))['then'](function(_0x2fa4d8){if(_0x2fa4d8){_0x24fad1=_0x2fa4d8;_0x6382a2[_0x46b9('0x32')]=_[_0x46b9('0x44')](db[_0x46b9('0x53')][_0x46b9('0x2b')]);_0x6382a2[_0x46b9('0x2f')]=_['keys'](_0x2ae37c[_0x46b9('0x2f')]);_0x6382a2[_0x46b9('0x30')]=_[_0x46b9('0x31')](_0x6382a2[_0x46b9('0x32')],_0x6382a2[_0x46b9('0x2f')]);_0x440734['attributes']=_[_0x46b9('0x31')](_0x6382a2[_0x46b9('0x32')],qs[_0x46b9('0x34')](_0x2ae37c[_0x46b9('0x2f')][_0x46b9('0x34')]));_0x440734['attributes']=_0x440734['attributes'][_0x46b9('0x35')]?_0x440734[_0x46b9('0x33')]:_0x6382a2[_0x46b9('0x32')];_0x440734[_0x46b9('0x38')]=qs[_0x46b9('0x57')](_0x2ae37c['query'][_0x46b9('0x57')]);_0x440734[_0x46b9('0x39')]=qs[_0x46b9('0x30')](_[_0x46b9('0x3a')](_0x2ae37c[_0x46b9('0x2f')],_0x6382a2[_0x46b9('0x30')]));if(_0x2ae37c['query'][_0x46b9('0x3d')]){_0x440734[_0x46b9('0x39')]=_['merge'](_0x440734['where'],{'$or':_['map'](_0x440734['attributes'],function(_0x5a85c7){var _0x46e193={};_0x46e193[_0x5a85c7]={'$like':'%'+_0x2ae37c[_0x46b9('0x2f')][_0x46b9('0x3d')]+'%'};return _0x46e193;})});}_0x440734=_[_0x46b9('0x3b')]({},_0x440734,_0x2ae37c[_0x46b9('0x3e')]);return _0x24fad1[_0x46b9('0x55')](_0x440734);}})[_0x46b9('0x22')](function(_0x46cb4b){if(_0x46cb4b){_0x2a200a=_0x46cb4b[_0x46b9('0x35')];if(!_0x2ae37c[_0x46b9('0x2f')]['hasOwnProperty'](_0x46b9('0x37'))){_0x440734[_0x46b9('0x1a')]=qs[_0x46b9('0x1a')](_0x2ae37c[_0x46b9('0x2f')][_0x46b9('0x1a')]);_0x440734[_0x46b9('0x18')]=qs[_0x46b9('0x18')](_0x2ae37c[_0x46b9('0x2f')][_0x46b9('0x18')]);}return _0x24fad1['getAllConditions'](_0x440734);}})[_0x46b9('0x22')](function(_0x3405a2){if(_0x3405a2){return _0x3405a2?{'count':_0x2a200a,'rows':_0x3405a2}:null;}})[_0x46b9('0x22')](respondWithResult(_0x4838b4,null))[_0x46b9('0x41')](handleError(_0x4838b4,null));};exports[_0x46b9('0x58')]=function(_0x41df58,_0x59fcd3,_0x38f2bc){var _0x4105f6={};var _0x66dc13={};var _0x48496e;var _0x288e6f;return db[_0x46b9('0x2a')]['findOne']({'where':{'id':_0x41df58['params']['id']}})[_0x46b9('0x22')](handleEntityNotFound(_0x59fcd3,null))[_0x46b9('0x22')](function(_0x231b1d){if(_0x231b1d){_0x48496e=_0x231b1d;_0x66dc13[_0x46b9('0x32')]=_['keys'](db['Condition']['rawAttributes']);_0x66dc13['query']=_[_0x46b9('0x44')](_0x41df58[_0x46b9('0x2f')]);_0x66dc13[_0x46b9('0x30')]=_['intersection'](_0x66dc13[_0x46b9('0x32')],_0x66dc13['query']);_0x4105f6[_0x46b9('0x33')]=_[_0x46b9('0x31')](_0x66dc13[_0x46b9('0x32')],qs[_0x46b9('0x34')](_0x41df58[_0x46b9('0x2f')][_0x46b9('0x34')]));_0x4105f6[_0x46b9('0x33')]=_0x4105f6['attributes']['length']?_0x4105f6['attributes']:_0x66dc13[_0x46b9('0x32')];_0x4105f6[_0x46b9('0x38')]=qs[_0x46b9('0x57')](_0x41df58['query'][_0x46b9('0x57')]);_0x4105f6[_0x46b9('0x39')]=qs['filters'](_[_0x46b9('0x3a')](_0x41df58[_0x46b9('0x2f')],_0x66dc13[_0x46b9('0x30')]));if(_0x41df58[_0x46b9('0x2f')][_0x46b9('0x3d')]){_0x4105f6['where']=_[_0x46b9('0x3b')](_0x4105f6['where'],{'$or':_[_0x46b9('0x2e')](_0x4105f6[_0x46b9('0x33')],function(_0x1974e1){var _0x42f17d={};_0x42f17d[_0x1974e1]={'$like':'%'+_0x41df58['query'][_0x46b9('0x3d')]+'%'};return _0x42f17d;})});}_0x4105f6=_[_0x46b9('0x3b')]({},_0x4105f6,_0x41df58[_0x46b9('0x3e')]);return _0x48496e[_0x46b9('0x58')](_0x4105f6);}})[_0x46b9('0x22')](function(_0x94dd96){if(_0x94dd96){_0x288e6f=_0x94dd96[_0x46b9('0x35')];if(!_0x41df58[_0x46b9('0x2f')]['hasOwnProperty']('nolimit')){_0x4105f6[_0x46b9('0x1a')]=qs[_0x46b9('0x1a')](_0x41df58[_0x46b9('0x2f')][_0x46b9('0x1a')]);_0x4105f6[_0x46b9('0x18')]=qs['offset'](_0x41df58[_0x46b9('0x2f')][_0x46b9('0x18')]);}return _0x48496e[_0x46b9('0x58')](_0x4105f6);}})[_0x46b9('0x22')](function(_0x6128a7){if(_0x6128a7){return _0x6128a7?{'count':_0x288e6f,'rows':_0x6128a7}:null;}})[_0x46b9('0x22')](respondWithResult(_0x59fcd3,null))[_0x46b9('0x41')](handleError(_0x59fcd3,null));};exports[_0x46b9('0x59')]=function(_0x3c4aa8,_0xabe7b4,_0x14294e){if(_0x3c4aa8[_0x46b9('0x48')]['id']){delete _0x3c4aa8[_0x46b9('0x48')]['id'];}return db['Trigger'][_0x46b9('0x46')]({'where':{'id':_0x3c4aa8[_0x46b9('0x43')]['id']}})[_0x46b9('0x22')](handleEntityNotFound(_0xabe7b4,null))[_0x46b9('0x22')](function(_0x4b32ad){if(_0x4b32ad){_0x3c4aa8[_0x46b9('0x48')]['TriggerId']=_0x4b32ad['id'];return db[_0x46b9('0x5a')]['create'](_0x3c4aa8[_0x46b9('0x48')]);}})[_0x46b9('0x22')](respondWithResult(_0xabe7b4,null))[_0x46b9('0x41')](handleError(_0xabe7b4,null));};exports[_0x46b9('0x5b')]=function(_0x51b678,_0x95a588,_0x201f79){var _0x4caeae={};var _0x322d08={};var _0x5915ca;var _0x2c08a0;return db[_0x46b9('0x2a')]['findOne']({'where':{'id':_0x51b678[_0x46b9('0x43')]['id']}})[_0x46b9('0x22')](handleEntityNotFound(_0x95a588,null))[_0x46b9('0x22')](function(_0x441e2b){if(_0x441e2b){_0x5915ca=_0x441e2b;_0x322d08[_0x46b9('0x32')]=_[_0x46b9('0x44')](db[_0x46b9('0x5a')][_0x46b9('0x2b')]);_0x322d08[_0x46b9('0x2f')]=_[_0x46b9('0x44')](_0x51b678[_0x46b9('0x2f')]);_0x322d08[_0x46b9('0x30')]=_[_0x46b9('0x31')](_0x322d08[_0x46b9('0x32')],_0x322d08[_0x46b9('0x2f')]);_0x4caeae[_0x46b9('0x33')]=_[_0x46b9('0x31')](_0x322d08['model'],qs[_0x46b9('0x34')](_0x51b678[_0x46b9('0x2f')]['fields']));_0x4caeae[_0x46b9('0x33')]=_0x4caeae[_0x46b9('0x33')][_0x46b9('0x35')]?_0x4caeae[_0x46b9('0x33')]:_0x322d08[_0x46b9('0x32')];_0x4caeae[_0x46b9('0x38')]=qs[_0x46b9('0x57')](_0x51b678[_0x46b9('0x2f')][_0x46b9('0x57')]);_0x4caeae['where']=qs[_0x46b9('0x30')](_[_0x46b9('0x3a')](_0x51b678[_0x46b9('0x2f')],_0x322d08[_0x46b9('0x30')]));if(_0x51b678[_0x46b9('0x2f')][_0x46b9('0x3d')]){_0x4caeae[_0x46b9('0x39')]=_[_0x46b9('0x3b')](_0x4caeae['where'],{'$or':_[_0x46b9('0x2e')](_0x4caeae['attributes'],function(_0x2193e){var _0x154df2={};_0x154df2[_0x2193e]={'$like':'%'+_0x51b678['query']['filter']+'%'};return _0x154df2;})});}_0x4caeae=_[_0x46b9('0x3b')]({},_0x4caeae,_0x51b678[_0x46b9('0x3e')]);return _0x5915ca['getActions'](_0x4caeae);}})[_0x46b9('0x22')](function(_0x3916d2){if(_0x3916d2){_0x2c08a0=_0x3916d2[_0x46b9('0x35')];if(!_0x51b678[_0x46b9('0x2f')][_0x46b9('0x36')](_0x46b9('0x37'))){_0x4caeae[_0x46b9('0x1a')]=qs['limit'](_0x51b678['query']['limit']);_0x4caeae['offset']=qs['offset'](_0x51b678['query'][_0x46b9('0x18')]);}return _0x5915ca[_0x46b9('0x5b')](_0x4caeae);}})['then'](function(_0x26769d){if(_0x26769d){return _0x26769d?{'count':_0x2c08a0,'rows':_0x26769d}:null;}})[_0x46b9('0x22')](respondWithResult(_0x95a588,null))[_0x46b9('0x41')](handleError(_0x95a588,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 376069a..88ceccc 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 _0x7a2c=['path','rimraf','../../config/environment','exports','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2829c0,_0x23823c){var _0x4a9ff6=function(_0x348974){while(--_0x348974){_0x2829c0['push'](_0x2829c0['shift']());}};_0x4a9ff6(++_0x23823c);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x14e119,_0x464ffc){_0x14e119=_0x14e119-0x0;var _0x2e5775=_0x7a2c[_0x14e119];return _0x2e5775;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./trigger.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Trigger',attributes,{'tableName':_0xc7a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72a2=['define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x72a2,0x161));var _0x272a=function(_0x1ea3b2,_0x1d0d02){_0x1ea3b2=_0x1ea3b2-0x0;var _0xfd6a39=_0x72a2[_0x1ea3b2];return _0xfd6a39;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var logger=require(_0x272a('0x1'))(_0x272a('0x2'));var moment=require(_0x272a('0x3'));var BPromise=require(_0x272a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x272a('0x5'));var rimraf=require('rimraf');var config=require(_0x272a('0x6'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4f628a,_0x2ba5db){return _0x4f628a[_0x272a('0x7')](_0x272a('0x8'),attributes,{'tableName':_0x272a('0x9'),'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 1921bf0..e337b34 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 _0x3926=['stringify','error','code','message','result','catch','GetTrigger','options','raw','where','attributes','include','map','model','ShowTrigger','Trigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x3926,0xe3));var _0x6392=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x3926[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x6392('0x0'));var util=require('util');var moment=require(_0x6392('0x1'));var BPromise=require(_0x6392('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6392('0x3'));var db=require(_0x6392('0x4'))['db'];var utils=require(_0x6392('0x5'));var logger=require(_0x6392('0x6'))(_0x6392('0x7'));var config=require(_0x6392('0x8'));var jayson=require(_0x6392('0x9'));var client=jayson[_0x6392('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482397,_0x2f947a,_0x26af1d){return new BPromise(function(_0x472252,_0x471bae){return client[_0x6392('0xb')](_0x482397,_0x26af1d)[_0x6392('0xc')](function(_0x2edcef){logger[_0x6392('0xd')](_0x6392('0xe'),_0x2f947a,'request\x20sent');logger[_0x6392('0xf')](_0x6392('0x10'),_0x2f947a,_0x6392('0x11'),JSON[_0x6392('0x12')](_0x2edcef));if(_0x2edcef[_0x6392('0x13')]){if(_0x2edcef[_0x6392('0x13')][_0x6392('0x14')]===0x1f4){logger[_0x6392('0x13')](_0x6392('0xe'),_0x2f947a,_0x2edcef[_0x6392('0x13')][_0x6392('0x15')]);return _0x471bae(_0x2edcef[_0x6392('0x13')]['message']);}logger[_0x6392('0x13')](_0x6392('0xe'),_0x2f947a,_0x2edcef[_0x6392('0x13')][_0x6392('0x15')]);return _0x472252(_0x2edcef[_0x6392('0x13')][_0x6392('0x15')]);}else{logger[_0x6392('0xd')](_0x6392('0xe'),_0x2f947a,_0x6392('0x11'));_0x472252(_0x2edcef[_0x6392('0x16')][_0x6392('0x15')]);}})[_0x6392('0x17')](function(_0x5693ac){logger['error']('Trigger,\x20%s,\x20%s',_0x2f947a,_0x5693ac);_0x471bae(_0x5693ac);});});}exports[_0x6392('0x18')]=function(_0x22cfba){var _0x4b0121=this;return new Promise(function(_0xfd827a,_0x38db68){return db['Trigger']['findAll']({'raw':_0x22cfba[_0x6392('0x19')]?_0x22cfba[_0x6392('0x19')][_0x6392('0x1a')]===undefined?!![]:![]:!![],'where':_0x22cfba[_0x6392('0x19')]?_0x22cfba[_0x6392('0x19')][_0x6392('0x1b')]||null:null,'attributes':_0x22cfba['options']?_0x22cfba[_0x6392('0x19')][_0x6392('0x1c')]||null:null,'limit':_0x22cfba[_0x6392('0x19')]?_0x22cfba['options']['limit']||null:null,'include':_0x22cfba[_0x6392('0x19')]?_0x22cfba[_0x6392('0x19')][_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x22cfba[_0x6392('0x19')]['include'],function(_0xe3df92){return{'model':db[_0xe3df92[_0x6392('0x1f')]],'as':_0xe3df92['as'],'attributes':_0xe3df92[_0x6392('0x1c')],'include':_0xe3df92[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0xe3df92['include'],function(_0x58160b){return{'model':db[_0x58160b['model']],'as':_0x58160b['as'],'attributes':_0x58160b['attributes'],'include':_0x58160b[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x58160b['include'],function(_0x22c2e3){return{'model':db[_0x22c2e3[_0x6392('0x1f')]],'as':_0x22c2e3['as'],'attributes':_0x22c2e3[_0x6392('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6392('0xc')](function(_0x158db3){logger[_0x6392('0xd')]('GetTrigger',_0x22cfba);logger[_0x6392('0xf')](_0x6392('0x18'),_0x22cfba,JSON[_0x6392('0x12')](_0x158db3));_0xfd827a(_0x158db3);})[_0x6392('0x17')](function(_0x1ce6bb){logger['error'](_0x6392('0x18'),_0x1ce6bb[_0x6392('0x15')],_0x22cfba);_0x38db68(_0x4b0121[_0x6392('0x13')](0x1f4,_0x1ce6bb[_0x6392('0x15')]));});});};exports[_0x6392('0x20')]=function(_0x46fc4d){var _0xa56b3c=this;return new Promise(function(_0x5bbbdb,_0x5b1e15){return db[_0x6392('0x21')][_0x6392('0x22')]({'raw':_0x46fc4d[_0x6392('0x19')]?_0x46fc4d[_0x6392('0x19')][_0x6392('0x1a')]===undefined?!![]:![]:!![],'where':_0x46fc4d['options']?_0x46fc4d[_0x6392('0x19')][_0x6392('0x1b')]||null:null,'attributes':_0x46fc4d[_0x6392('0x19')]?_0x46fc4d['options'][_0x6392('0x1c')]||null:null,'include':_0x46fc4d[_0x6392('0x19')]?_0x46fc4d['options'][_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x46fc4d[_0x6392('0x19')][_0x6392('0x1d')],function(_0x3adfb3){return{'model':db[_0x3adfb3['model']],'as':_0x3adfb3['as'],'attributes':_0x3adfb3[_0x6392('0x1c')],'include':_0x3adfb3[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x3adfb3[_0x6392('0x1d')],function(_0x7a1ad5){return{'model':db[_0x7a1ad5['model']],'as':_0x7a1ad5['as'],'attributes':_0x7a1ad5['attributes'],'include':_0x7a1ad5[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x7a1ad5[_0x6392('0x1d')],function(_0x51615d){return{'model':db[_0x51615d[_0x6392('0x1f')]],'as':_0x51615d['as'],'attributes':_0x51615d[_0x6392('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6392('0xc')](function(_0x3db577){logger[_0x6392('0xd')](_0x6392('0x20'),_0x46fc4d);logger[_0x6392('0xf')]('ShowTrigger',_0x46fc4d,JSON[_0x6392('0x12')](_0x3db577));_0x5bbbdb(_0x3db577);})['catch'](function(_0x33610b){logger[_0x6392('0x13')]('ShowTrigger',_0x33610b['message'],_0x46fc4d);_0x5b1e15(_0xa56b3c[_0x6392('0x13')](0x1f4,_0x33610b[_0x6392('0x15')]));});});}; \ No newline at end of file +var _0xefe8=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s'];(function(_0x3e1353,_0x138834){var _0x2e6cae=function(_0x52fedf){while(--_0x52fedf){_0x3e1353['push'](_0x3e1353['shift']());}};_0x2e6cae(++_0x138834);}(_0xefe8,0x1de));var _0x8efe=function(_0x4533c1,_0xc9c0ca){_0x4533c1=_0x4533c1-0x0;var _0x45fd62=_0xefe8[_0x4533c1];return _0x45fd62;};'use strict';var _=require(_0x8efe('0x0'));var util=require(_0x8efe('0x1'));var moment=require(_0x8efe('0x2'));var BPromise=require(_0x8efe('0x3'));var rs=require(_0x8efe('0x4'));var fs=require('fs');var Redis=require(_0x8efe('0x5'));var db=require(_0x8efe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8efe('0x7'))(_0x8efe('0x8'));var config=require(_0x8efe('0x9'));var jayson=require(_0x8efe('0xa'));var client=jayson[_0x8efe('0xb')][_0x8efe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x517f57,_0x205c38,_0x342712){return new BPromise(function(_0x4f0735,_0x24d437){return client[_0x8efe('0xd')](_0x517f57,_0x342712)[_0x8efe('0xe')](function(_0x1c5804){logger['info'](_0x8efe('0xf'),_0x205c38,_0x8efe('0x10'));logger[_0x8efe('0x11')](_0x8efe('0x12'),_0x205c38,'request\x20sent',JSON[_0x8efe('0x13')](_0x1c5804));if(_0x1c5804[_0x8efe('0x14')]){if(_0x1c5804['error'][_0x8efe('0x15')]===0x1f4){logger[_0x8efe('0x14')](_0x8efe('0xf'),_0x205c38,_0x1c5804['error'][_0x8efe('0x16')]);return _0x24d437(_0x1c5804['error'][_0x8efe('0x16')]);}logger['error'](_0x8efe('0xf'),_0x205c38,_0x1c5804[_0x8efe('0x14')]['message']);return _0x4f0735(_0x1c5804[_0x8efe('0x14')][_0x8efe('0x16')]);}else{logger[_0x8efe('0x17')](_0x8efe('0xf'),_0x205c38,_0x8efe('0x10'));_0x4f0735(_0x1c5804['result']['message']);}})[_0x8efe('0x18')](function(_0x5593ff){logger[_0x8efe('0x14')](_0x8efe('0xf'),_0x205c38,_0x5593ff);_0x24d437(_0x5593ff);});});}exports[_0x8efe('0x19')]=function(_0x5b24dc){var _0x106055=this;return new Promise(function(_0x3d324e,_0x49612a){return db[_0x8efe('0x1a')][_0x8efe('0x1b')]({'raw':_0x5b24dc[_0x8efe('0x1c')]?_0x5b24dc[_0x8efe('0x1c')][_0x8efe('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b24dc[_0x8efe('0x1c')]?_0x5b24dc[_0x8efe('0x1c')][_0x8efe('0x1e')]||null:null,'attributes':_0x5b24dc['options']?_0x5b24dc[_0x8efe('0x1c')][_0x8efe('0x1f')]||null:null,'limit':_0x5b24dc['options']?_0x5b24dc[_0x8efe('0x1c')][_0x8efe('0x20')]||null:null,'include':_0x5b24dc[_0x8efe('0x1c')]?_0x5b24dc['options'][_0x8efe('0x21')]?_[_0x8efe('0x22')](_0x5b24dc[_0x8efe('0x1c')][_0x8efe('0x21')],function(_0x17ee85){return{'model':db[_0x17ee85[_0x8efe('0x23')]],'as':_0x17ee85['as'],'attributes':_0x17ee85[_0x8efe('0x1f')],'include':_0x17ee85[_0x8efe('0x21')]?_[_0x8efe('0x22')](_0x17ee85[_0x8efe('0x21')],function(_0x1e1bf5){return{'model':db[_0x1e1bf5[_0x8efe('0x23')]],'as':_0x1e1bf5['as'],'attributes':_0x1e1bf5[_0x8efe('0x1f')],'include':_0x1e1bf5[_0x8efe('0x21')]?_['map'](_0x1e1bf5[_0x8efe('0x21')],function(_0x2b29ed){return{'model':db[_0x2b29ed[_0x8efe('0x23')]],'as':_0x2b29ed['as'],'attributes':_0x2b29ed[_0x8efe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8efe('0xe')](function(_0x9ba231){logger['info'](_0x8efe('0x19'),_0x5b24dc);logger[_0x8efe('0x11')]('GetTrigger',_0x5b24dc,JSON[_0x8efe('0x13')](_0x9ba231));_0x3d324e(_0x9ba231);})[_0x8efe('0x18')](function(_0x2649e9){logger[_0x8efe('0x14')](_0x8efe('0x19'),_0x2649e9[_0x8efe('0x16')],_0x5b24dc);_0x49612a(_0x106055[_0x8efe('0x14')](0x1f4,_0x2649e9[_0x8efe('0x16')]));});});};exports[_0x8efe('0x24')]=function(_0x344667){var _0xbe8fe=this;return new Promise(function(_0x18e9e5,_0x1daed5){return db[_0x8efe('0x1a')][_0x8efe('0x25')]({'raw':_0x344667['options']?_0x344667[_0x8efe('0x1c')][_0x8efe('0x1d')]===undefined?!![]:![]:!![],'where':_0x344667[_0x8efe('0x1c')]?_0x344667[_0x8efe('0x1c')][_0x8efe('0x1e')]||null:null,'attributes':_0x344667[_0x8efe('0x1c')]?_0x344667[_0x8efe('0x1c')]['attributes']||null:null,'include':_0x344667[_0x8efe('0x1c')]?_0x344667['options'][_0x8efe('0x21')]?_[_0x8efe('0x22')](_0x344667[_0x8efe('0x1c')][_0x8efe('0x21')],function(_0x20b02f){return{'model':db[_0x20b02f[_0x8efe('0x23')]],'as':_0x20b02f['as'],'attributes':_0x20b02f[_0x8efe('0x1f')],'include':_0x20b02f['include']?_[_0x8efe('0x22')](_0x20b02f[_0x8efe('0x21')],function(_0xb73f94){return{'model':db[_0xb73f94[_0x8efe('0x23')]],'as':_0xb73f94['as'],'attributes':_0xb73f94[_0x8efe('0x1f')],'include':_0xb73f94[_0x8efe('0x21')]?_[_0x8efe('0x22')](_0xb73f94[_0x8efe('0x21')],function(_0x4476fc){return{'model':db[_0x4476fc[_0x8efe('0x23')]],'as':_0x4476fc['as'],'attributes':_0x4476fc[_0x8efe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8efe('0xe')](function(_0x5b94c9){logger[_0x8efe('0x17')]('ShowTrigger',_0x344667);logger[_0x8efe('0x11')]('ShowTrigger',_0x344667,JSON[_0x8efe('0x13')](_0x5b94c9));_0x18e9e5(_0x5b94c9);})[_0x8efe('0x18')](function(_0x142db9){logger[_0x8efe('0x14')]('ShowTrigger',_0x142db9[_0x8efe('0x16')],_0x344667);_0x1daed5(_0xbe8fe['error'](0x1f4,_0x142db9[_0x8efe('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 62caf28..bd35621 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 _0x8ec2=['express','fs-extra','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','show','post','/:id/clone','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x1bc5c5,_0xeca88c){var _0x304977=function(_0x18f09e){while(--_0x18f09e){_0x1bc5c5['push'](_0x1bc5c5['shift']());}};_0x304977(++_0xeca88c);}(_0x8ec2,0x11e));var _0x28ec=function(_0x5676df,_0x14d122){_0x5676df=_0x5676df-0x0;var _0x1fb878=_0x8ec2[_0x5676df];return _0x1fb878;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x28ec('0x0'));var timeout=require(_0x28ec('0x1'));var express=require(_0x28ec('0x2'));var router=express['Router']();var fs_extra=require(_0x28ec('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x28ec('0x4'));var controller=require(_0x28ec('0x5'));router['get']('/',auth[_0x28ec('0x6')](),controller['index']);router[_0x28ec('0x7')](_0x28ec('0x8'),auth[_0x28ec('0x6')](),controller[_0x28ec('0x9')]);router[_0x28ec('0xa')](_0x28ec('0xb'),auth[_0x28ec('0x6')](),controller['clone']);router[_0x28ec('0xa')]('/',auth[_0x28ec('0x6')](),controller[_0x28ec('0xc')]);router[_0x28ec('0xd')](_0x28ec('0x8'),auth[_0x28ec('0x6')](),controller[_0x28ec('0xe')]);router[_0x28ec('0xf')]('/:id',auth[_0x28ec('0x6')](),controller[_0x28ec('0x10')]);module[_0x28ec('0x11')]=router; \ No newline at end of file +var _0x2c75=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','destroy','exports','util'];(function(_0xad1f54,_0x1899cd){var _0x382340=function(_0xb2b529){while(--_0xb2b529){_0xad1f54['push'](_0xad1f54['shift']());}};_0x382340(++_0x1899cd);}(_0x2c75,0x7d));var _0x52c7=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x2c75[_0xbb091];return _0x467a04;};'use strict';var multer=require('multer');var util=require(_0x52c7('0x0'));var path=require(_0x52c7('0x1'));var timeout=require(_0x52c7('0x2'));var express=require(_0x52c7('0x3'));var router=express[_0x52c7('0x4')]();var fs_extra=require(_0x52c7('0x5'));var auth=require(_0x52c7('0x6'));var interaction=require(_0x52c7('0x7'));var config=require('../../config/environment');var controller=require(_0x52c7('0x8'));router['get']('/',auth[_0x52c7('0x9')](),controller[_0x52c7('0xa')]);router['get'](_0x52c7('0xb'),auth[_0x52c7('0x9')](),controller[_0x52c7('0xc')]);router[_0x52c7('0xd')](_0x52c7('0xe'),auth[_0x52c7('0x9')](),controller[_0x52c7('0xf')]);router[_0x52c7('0xd')]('/',auth[_0x52c7('0x9')](),controller[_0x52c7('0x10')]);router[_0x52c7('0x11')](_0x52c7('0xb'),auth['isAuthenticated'](),controller[_0x52c7('0x12')]);router['delete'](_0x52c7('0xb'),auth['isAuthenticated'](),controller[_0x52c7('0x13')]);module[_0x52c7('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6075496..56b584f 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 _0x9968=['ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','STRING','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','originate','uac','pai','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x9968,0x8d));var _0x8996=function(_0x5292e7,_0xdb4d75){_0x5292e7=_0x5292e7-0x0;var _0x2d6b73=_0x9968[_0x5292e7];return _0x2d6b73;};'use strict';var Sequelize=require(_0x8996('0x0'));module[_0x8996('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8996('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x4'),_0x8996('0x5'),'peer'),'allowNull':![],'defaultValue':_0x8996('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8996('0x6')},'callingpres':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x7'),_0x8996('0x8'),_0x8996('0x9'),'ALLOWED',_0x8996('0xa'),_0x8996('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x8996('0xc')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8996('0xc')]},'md5secret':{'type':Sequelize[_0x8996('0xc')]},'remotesecret':{'type':Sequelize[_0x8996('0xc')]},'transport':{'type':Sequelize[_0x8996('0xc')],'defaultValue':'udp','set':function(_0x2a23d5){this['setDataValue']('transport',_0x2a23d5?_0x2a23d5[_0x8996('0xd')](','):null);},'get':function(){return this[_0x8996('0xe')](_0x8996('0xf'))?this[_0x8996('0xe')](_0x8996('0xf'))[_0x8996('0x10')](','):null;},'comment':_0x8996('0x11')},'dtmfmode':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x12'),_0x8996('0x13'),_0x8996('0x14'),_0x8996('0x15'),_0x8996('0x16')),'defaultValue':_0x8996('0x12')},'directmedia':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no',_0x8996('0x18'),_0x8996('0x19'),_0x8996('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8996('0xc')]},'directmediadeny':{'type':Sequelize[_0x8996('0xc')]},'nat':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x1b'),'set':function(_0x35e5b3){this[_0x8996('0x1c')]('nat',_0x35e5b3?_0x35e5b3[_0x8996('0xd')](','):null);},'get':function(){return this[_0x8996('0xe')](_0x8996('0x1d'))?this[_0x8996('0xe')](_0x8996('0x1d'))[_0x8996('0x10')](','):null;},'comment':_0x8996('0x1e')},'callgroup':{'type':Sequelize[_0x8996('0xc')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8996('0xc')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8996('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8996('0xc')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x1f')},'allow':{'type':Sequelize[_0x8996('0xc')],'allowNull':![],'defaultValue':_0x8996('0x20'),'set':function(_0x4b5903){this[_0x8996('0x1c')](_0x8996('0x21'),_0x4b5903?_0x4b5903[_0x8996('0xd')](';'):_0x8996('0x20'));},'get':function(){return this[_0x8996('0xe')](_0x8996('0x21'))?this[_0x8996('0xe')](_0x8996('0x21'))[_0x8996('0x10')](';'):null;},'comment':_0x8996('0x22')},'autoframing':{'type':Sequelize[_0x8996('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x23'),'set':function(_0x4b08e8){this[_0x8996('0x1c')](_0x8996('0x24'),_0x4b08e8?_0x4b08e8['join'](','):null);},'get':function(){return this[_0x8996('0xe')](_0x8996('0x24'))?this[_0x8996('0xe')](_0x8996('0x24'))[_0x8996('0x10')](','):null;},'comment':_0x8996('0x25')},'trustrpid':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8996('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no',_0x8996('0x26'))},'promiscredir':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no')},'accountcode':{'type':Sequelize[_0x8996('0x27')](0xb)},'setvar':{'type':Sequelize[_0x8996('0xc')]},'callerid':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':_0x8996('0x17')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x8996('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x8996('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x8996('0xc')]},'template':{'type':Sequelize[_0x8996('0xc')]},'videosupport':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8996('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x8996('0x3')]('accept','refuse',_0x8996('0x29'))},'session_expires':{'type':Sequelize[_0x8996('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x8996('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x8996('0xc')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x8996('0xc')]},'port':{'type':Sequelize[_0x8996('0x27')](0x5)},'qualify':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':_0x8996('0x17')},'keepalive':{'type':Sequelize[_0x8996('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8996('0xc')]},'rtptimeout':{'type':Sequelize[_0x8996('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8996('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8996('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no',_0x8996('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x8996('0xc')]},'timert1':{'type':Sequelize[_0x8996('0x27')](0xb)},'timerb':{'type':Sequelize[_0x8996('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x8996('0xc')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x8996('0xc')]},'use_q850_reason':{'type':Sequelize[_0x8996('0xc')]},'maxforwards':{'type':Sequelize[_0x8996('0x27')](0xb)},'encryption':{'type':Sequelize[_0x8996('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x8996('0x3')]('yes','no','fingerprint',_0x8996('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x8996('0xc')]},'dtlsprivatekey':{'type':Sequelize[_0x8996('0xc')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8996('0xc')]},'dtlscapath':{'type':Sequelize[_0x8996('0xc')]},'dtlssetup':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x2d'),_0x8996('0x2e'),_0x8996('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8996('0xc')]},'usereqphone':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8996('0xc')]},'recordofffeature':{'type':Sequelize[_0x8996('0xc')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'vmexten':{'type':Sequelize[_0x8996('0xc')]},'mohinterpret':{'type':Sequelize[_0x8996('0xc')]},'mohsuggest':{'type':Sequelize[_0x8996('0xc')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8996('0xc')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x8996('0x18'),'update',_0x8996('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8996('0xc')]},'otherFields':{'type':Sequelize[_0x8996('0xc')]},'active':{'type':Sequelize[_0x8996('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8996('0xc')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe85c=['\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','inband','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','insecure','never'];(function(_0x4570a3,_0x4f8d6e){var _0x1ddbd3=function(_0xff53fd){while(--_0xff53fd){_0x4570a3['push'](_0x4570a3['shift']());}};_0x1ddbd3(++_0x4f8d6e);}(_0xe85c,0x1be));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce85('0x0'));module[_0xce85('0x1')]={'name':{'type':Sequelize[_0xce85('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xce85('0x3'),_0xce85('0x4'),_0xce85('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xce85('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xce85('0x6'),_0xce85('0x7'),_0xce85('0x8'),_0xce85('0x9'),_0xce85('0xa'),_0xce85('0xb'),_0xce85('0xc'),_0xce85('0xd'))},'deny':{'type':Sequelize[_0xce85('0x2')]},'permit':{'type':Sequelize[_0xce85('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xce85('0x2')]},'transport':{'type':Sequelize[_0xce85('0x2')],'defaultValue':_0xce85('0xe'),'set':function(_0x29abc2){this['setDataValue']('transport',_0x29abc2?_0x29abc2[_0xce85('0xf')](','):null);},'get':function(){return this[_0xce85('0x10')](_0xce85('0x11'))?this[_0xce85('0x10')](_0xce85('0x11'))[_0xce85('0x12')](','):null;},'comment':_0xce85('0x13')},'dtmfmode':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x15'),'info','shortinfo',_0xce85('0x16'),'auto'),'defaultValue':_0xce85('0x15')},'directmedia':{'type':Sequelize[_0xce85('0x14')]('yes','no',_0xce85('0x17'),_0xce85('0x18'),_0xce85('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xce85('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xce85('0x1b'),'set':function(_0x49acbc){this[_0xce85('0x1c')](_0xce85('0x1d'),_0x49acbc?_0x49acbc[_0xce85('0xf')](','):null);},'get':function(){return this[_0xce85('0x10')](_0xce85('0x1d'))?this[_0xce85('0x10')](_0xce85('0x1d'))['split'](','):null;},'comment':_0xce85('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xce85('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xce85('0x2')]},'language':{'type':Sequelize[_0xce85('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xce85('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x49d340){this[_0xce85('0x1c')](_0xce85('0x1f'),_0x49d340?_0x49d340[_0xce85('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xce85('0x10')](_0xce85('0x1f'))?this[_0xce85('0x10')](_0xce85('0x1f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'insecure':{'type':Sequelize[_0xce85('0x2')],'defaultValue':'port,invite','set':function(_0x2769b4){this[_0xce85('0x1c')](_0xce85('0x20'),_0x2769b4?_0x2769b4['join'](','):null);},'get':function(){return this[_0xce85('0x10')](_0xce85('0x20'))?this[_0xce85('0x10')](_0xce85('0x20'))[_0xce85('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xce85('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no',_0xce85('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0xce85('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xce85('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xce85('0x22')},'amaflags':{'type':Sequelize[_0xce85('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xce85('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xce85('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xce85('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xce85('0x14')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xce85('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xce85('0x1a'),'no',_0xce85('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xce85('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xce85('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xce85('0x2')]},'session_timers':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x25'),_0xce85('0x26'),_0xce85('0x27'))},'session_expires':{'type':Sequelize[_0xce85('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xce85('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x28'),'uas'),'defaultValue':_0xce85('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xce85('0x2')]},'fromuser':{'type':Sequelize[_0xce85('0x2')]},'port':{'type':Sequelize[_0xce85('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xce85('0x1a')},'keepalive':{'type':Sequelize[_0xce85('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xce85('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xce85('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xce85('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xce85('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xce85('0x2')]},'callbackextension':{'type':Sequelize[_0xce85('0x2')]},'timert1':{'type':Sequelize[_0xce85('0x23')](0xb)},'timerb':{'type':Sequelize[_0xce85('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xce85('0x2')]},'contactdeny':{'type':Sequelize[_0xce85('0x2')]},'contactacl':{'type':Sequelize[_0xce85('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xce85('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xce85('0x23')](0xb)},'encryption':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xce85('0x14')]('yes','no')},'icesupport':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xce85('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xce85('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xce85('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xce85('0x2')]},'dtlscapath':{'type':Sequelize[_0xce85('0x2')]},'dtlssetup':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x2b'),_0xce85('0x2c'),_0xce85('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xce85('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xce85('0x2')]},'mohinterpret':{'type':Sequelize[_0xce85('0x2')]},'mohsuggest':{'type':Sequelize[_0xce85('0x2')]},'parkinglot':{'type':Sequelize[_0xce85('0x2')]},'description':{'type':Sequelize[_0xce85('0x2')]},'host':{'type':Sequelize[_0xce85('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xce85('0x14')](_0xce85('0x1a'),'no',_0xce85('0x17'),_0xce85('0x18'),_0xce85('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xce85('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xce85('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xce85('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index b3f5b70..f5b79db 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 _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0xcaa808,_0x5c4f17){var _0x236f7e=function(_0xf7c24f){while(--_0xf7c24f){_0xcaa808['push'](_0xcaa808['shift']());}};_0x236f7e(++_0x5c4f17);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file +var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','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','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x2f5737,_0x1cc0b1){var _0x23b5e7=function(_0x107b59){while(--_0x107b59){_0x2f5737['push'](_0x2f5737['shift']());}};_0x23b5e7(++_0x1cc0b1);}(_0x54ef,0x112));var _0xf54e=function(_0x21aad4,_0x10fc44){_0x21aad4=_0x21aad4-0x0;var _0x482dda=_0x54ef[_0x21aad4];return _0x482dda;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ca79876..87cabce 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 _0xc17e=['tools_trunks','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','Trunk'];(function(_0x31981d,_0x4ec54a){var _0xa67d83=function(_0x21fc22){while(--_0x21fc22){_0x31981d['push'](_0x31981d['shift']());}};_0xa67d83(++_0x4ec54a);}(_0xc17e,0x1da));var _0xec17=function(_0x35e683,_0x128119){_0x35e683=_0x35e683-0x0;var _0x580795=_0xc17e[_0x35e683];return _0x580795;};'use strict';var _=require(_0xec17('0x0'));var util=require(_0xec17('0x1'));var logger=require(_0xec17('0x2'))('api');var moment=require(_0xec17('0x3'));var BPromise=require('bluebird');var rp=require(_0xec17('0x4'));var fs=require('fs');var path=require(_0xec17('0x5'));var rimraf=require(_0xec17('0x6'));var config=require(_0xec17('0x7'));var attributes=require(_0xec17('0x8'));module['exports']=function(_0x292589,_0x406eba){return _0x292589['define'](_0xec17('0x9'),attributes,{'tableName':_0xec17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccfc=['../../config/environment','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x370be2,_0x361221){var _0x16af5c=function(_0x8a4a84){while(--_0x8a4a84){_0x370be2['push'](_0x370be2['shift']());}};_0x16af5c(++_0x361221);}(_0xccfc,0xa0));var _0xcccf=function(_0x1106b7,_0x2cc5d2){_0x1106b7=_0x1106b7-0x0;var _0x32c373=_0xccfc[_0x1106b7];return _0x32c373;};'use strict';var _=require(_0xcccf('0x0'));var util=require(_0xcccf('0x1'));var logger=require(_0xcccf('0x2'))(_0xcccf('0x3'));var moment=require(_0xcccf('0x4'));var BPromise=require(_0xcccf('0x5'));var rp=require(_0xcccf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcccf('0x7'));var config=require(_0xcccf('0x8'));var attributes=require('./trunk.attributes');module[_0xcccf('0x9')]=function(_0x63898d,_0x204ae5){return _0x63898d['define'](_0xcccf('0xa'),attributes,{'tableName':_0xcccf('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 4dca328..ef5fcee 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 _0x2906=['debug','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x384120,_0x382556){var _0x35f5a2=function(_0x2e6bcc){while(--_0x2e6bcc){_0x384120['push'](_0x384120['shift']());}};_0x35f5a2(++_0x382556);}(_0x2906,0x9f));var _0x6290=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x2906[_0x5e8c32];return _0x595f7b;};'use strict';var _=require(_0x6290('0x0'));var util=require(_0x6290('0x1'));var moment=require(_0x6290('0x2'));var BPromise=require(_0x6290('0x3'));var rs=require(_0x6290('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6290('0x5'))['db'];var utils=require(_0x6290('0x6'));var logger=require(_0x6290('0x7'))(_0x6290('0x8'));var config=require('../../config/environment');var jayson=require(_0x6290('0x9'));var client=jayson[_0x6290('0xa')][_0x6290('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54e82f,_0xec958c,_0x4215eb){return new BPromise(function(_0x3a86ab,_0x34961f){return client[_0x6290('0xc')](_0x54e82f,_0x4215eb)['then'](function(_0x1f504b){logger[_0x6290('0xd')](_0x6290('0xe'),_0xec958c,_0x6290('0xf'));logger[_0x6290('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0xec958c,_0x6290('0xf'),JSON[_0x6290('0x11')](_0x1f504b));if(_0x1f504b[_0x6290('0x12')]){if(_0x1f504b[_0x6290('0x12')][_0x6290('0x13')]===0x1f4){logger[_0x6290('0x12')](_0x6290('0xe'),_0xec958c,_0x1f504b[_0x6290('0x12')][_0x6290('0x14')]);return _0x34961f(_0x1f504b[_0x6290('0x12')][_0x6290('0x14')]);}logger['error'](_0x6290('0xe'),_0xec958c,_0x1f504b[_0x6290('0x12')]['message']);return _0x3a86ab(_0x1f504b[_0x6290('0x12')][_0x6290('0x14')]);}else{logger[_0x6290('0xd')](_0x6290('0xe'),_0xec958c,_0x6290('0xf'));_0x3a86ab(_0x1f504b['result'][_0x6290('0x14')]);}})[_0x6290('0x15')](function(_0x25126c){logger[_0x6290('0x12')]('Trunk,\x20%s,\x20%s',_0xec958c,_0x25126c);_0x34961f(_0x25126c);});});}exports[_0x6290('0x16')]=function(_0x4065de){var _0x34b8aa=this;return new Promise(function(_0x414228,_0x3b5f16){return db[_0x6290('0x17')][_0x6290('0x18')]({'raw':_0x4065de[_0x6290('0x19')]?_0x4065de['options'][_0x6290('0x1a')]===undefined?!![]:![]:!![],'where':_0x4065de[_0x6290('0x19')]?_0x4065de[_0x6290('0x19')][_0x6290('0x1b')]||null:null,'attributes':_0x4065de['options']?_0x4065de[_0x6290('0x19')][_0x6290('0x1c')]||null:null,'limit':_0x4065de[_0x6290('0x19')]?_0x4065de['options'][_0x6290('0x1d')]||null:null,'include':_0x4065de[_0x6290('0x19')]?_0x4065de['options'][_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x4065de['options'][_0x6290('0x1e')],function(_0xfe2de6){return{'model':db[_0xfe2de6[_0x6290('0x20')]],'as':_0xfe2de6['as'],'attributes':_0xfe2de6[_0x6290('0x1c')],'include':_0xfe2de6['include']?_['map'](_0xfe2de6[_0x6290('0x1e')],function(_0x426ae3){return{'model':db[_0x426ae3['model']],'as':_0x426ae3['as'],'attributes':_0x426ae3['attributes'],'include':_0x426ae3[_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x426ae3[_0x6290('0x1e')],function(_0x473226){return{'model':db[_0x473226[_0x6290('0x20')]],'as':_0x473226['as'],'attributes':_0x473226[_0x6290('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6290('0x21')](function(_0x2ad2c3){logger[_0x6290('0xd')]('GetTrunk',_0x4065de);logger[_0x6290('0x10')]('GetTrunk',_0x4065de,JSON[_0x6290('0x11')](_0x2ad2c3));_0x414228(_0x2ad2c3);})[_0x6290('0x15')](function(_0x2d0be7){logger['error']('GetTrunk',_0x2d0be7[_0x6290('0x14')],_0x4065de);_0x3b5f16(_0x34b8aa[_0x6290('0x12')](0x1f4,_0x2d0be7[_0x6290('0x14')]));});});};exports[_0x6290('0x22')]=function(_0x4b38db){var _0xa77326=this;return new Promise(function(_0x44a103,_0x4b80e0){return db[_0x6290('0x17')]['find']({'raw':_0x4b38db[_0x6290('0x19')]?_0x4b38db['options'][_0x6290('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b38db['options']?_0x4b38db['options'][_0x6290('0x1b')]||null:null,'attributes':_0x4b38db[_0x6290('0x19')]?_0x4b38db[_0x6290('0x19')][_0x6290('0x1c')]||null:null,'include':_0x4b38db[_0x6290('0x19')]?_0x4b38db[_0x6290('0x19')][_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x4b38db[_0x6290('0x19')][_0x6290('0x1e')],function(_0x77c2e8){return{'model':db[_0x77c2e8[_0x6290('0x20')]],'as':_0x77c2e8['as'],'attributes':_0x77c2e8[_0x6290('0x1c')],'include':_0x77c2e8[_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x77c2e8[_0x6290('0x1e')],function(_0x1a7fd4){return{'model':db[_0x1a7fd4[_0x6290('0x20')]],'as':_0x1a7fd4['as'],'attributes':_0x1a7fd4[_0x6290('0x1c')],'include':_0x1a7fd4['include']?_[_0x6290('0x1f')](_0x1a7fd4['include'],function(_0x52a142){return{'model':db[_0x52a142[_0x6290('0x20')]],'as':_0x52a142['as'],'attributes':_0x52a142[_0x6290('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c62b){logger[_0x6290('0xd')]('ShowTrunk',_0x4b38db);logger[_0x6290('0x10')](_0x6290('0x22'),_0x4b38db,JSON[_0x6290('0x11')](_0x51c62b));_0x44a103(_0x51c62b);})[_0x6290('0x15')](function(_0x23a062){logger[_0x6290('0x12')](_0x6290('0x22'),_0x23a062[_0x6290('0x14')],_0x4b38db);_0x4b80e0(_0xa77326['error'](0x1f4,_0x23a062[_0x6290('0x14')]));});});}; \ No newline at end of file +var _0x48a3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetTrunk','options','raw','where','attributes','include','map','model','find','ShowTrunk','stringify','lodash','util'];(function(_0x2ec0f6,_0x2b4b4d){var _0x175945=function(_0x3ed960){while(--_0x3ed960){_0x2ec0f6['push'](_0x2ec0f6['shift']());}};_0x175945(++_0x2b4b4d);}(_0x48a3,0x1ed));var _0x348a=function(_0x396101,_0x2d5b6c){_0x396101=_0x396101-0x0;var _0x4006c0=_0x48a3[_0x396101];return _0x4006c0;};'use strict';var _=require(_0x348a('0x0'));var util=require(_0x348a('0x1'));var moment=require('moment');var BPromise=require(_0x348a('0x2'));var rs=require(_0x348a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x348a('0x4'))['db'];var utils=require(_0x348a('0x5'));var logger=require(_0x348a('0x6'))(_0x348a('0x7'));var config=require('../../config/environment');var jayson=require(_0x348a('0x8'));var client=jayson[_0x348a('0x9')][_0x348a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5867f2,_0x23111d,_0x2116e5){return new BPromise(function(_0x415c23,_0x5f2541){return client[_0x348a('0xb')](_0x5867f2,_0x2116e5)[_0x348a('0xc')](function(_0x42d6be){logger['info'](_0x348a('0xd'),_0x23111d,_0x348a('0xe'));logger[_0x348a('0xf')](_0x348a('0x10'),_0x23111d,_0x348a('0xe'),JSON['stringify'](_0x42d6be));if(_0x42d6be[_0x348a('0x11')]){if(_0x42d6be[_0x348a('0x11')]['code']===0x1f4){logger[_0x348a('0x11')]('Trunk,\x20%s,\x20%s',_0x23111d,_0x42d6be[_0x348a('0x11')][_0x348a('0x12')]);return _0x5f2541(_0x42d6be[_0x348a('0x11')][_0x348a('0x12')]);}logger['error'](_0x348a('0xd'),_0x23111d,_0x42d6be[_0x348a('0x11')][_0x348a('0x12')]);return _0x415c23(_0x42d6be[_0x348a('0x11')][_0x348a('0x12')]);}else{logger[_0x348a('0x13')](_0x348a('0xd'),_0x23111d,'request\x20sent');_0x415c23(_0x42d6be[_0x348a('0x14')][_0x348a('0x12')]);}})[_0x348a('0x15')](function(_0x2803e6){logger[_0x348a('0x11')](_0x348a('0xd'),_0x23111d,_0x2803e6);_0x5f2541(_0x2803e6);});});}exports[_0x348a('0x16')]=function(_0x9eab4a){var _0x1e92d6=this;return new Promise(function(_0x680f2a,_0x2689b7){return db['Trunk']['findAll']({'raw':_0x9eab4a[_0x348a('0x17')]?_0x9eab4a['options'][_0x348a('0x18')]===undefined?!![]:![]:!![],'where':_0x9eab4a[_0x348a('0x17')]?_0x9eab4a[_0x348a('0x17')][_0x348a('0x19')]||null:null,'attributes':_0x9eab4a[_0x348a('0x17')]?_0x9eab4a[_0x348a('0x17')][_0x348a('0x1a')]||null:null,'limit':_0x9eab4a[_0x348a('0x17')]?_0x9eab4a['options']['limit']||null:null,'include':_0x9eab4a[_0x348a('0x17')]?_0x9eab4a[_0x348a('0x17')][_0x348a('0x1b')]?_[_0x348a('0x1c')](_0x9eab4a[_0x348a('0x17')][_0x348a('0x1b')],function(_0x1b5018){return{'model':db[_0x1b5018[_0x348a('0x1d')]],'as':_0x1b5018['as'],'attributes':_0x1b5018[_0x348a('0x1a')],'include':_0x1b5018[_0x348a('0x1b')]?_[_0x348a('0x1c')](_0x1b5018[_0x348a('0x1b')],function(_0x96bae7){return{'model':db[_0x96bae7[_0x348a('0x1d')]],'as':_0x96bae7['as'],'attributes':_0x96bae7[_0x348a('0x1a')],'include':_0x96bae7[_0x348a('0x1b')]?_[_0x348a('0x1c')](_0x96bae7[_0x348a('0x1b')],function(_0x10e120){return{'model':db[_0x10e120[_0x348a('0x1d')]],'as':_0x10e120['as'],'attributes':_0x10e120['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x325be4){logger[_0x348a('0x13')](_0x348a('0x16'),_0x9eab4a);logger[_0x348a('0xf')](_0x348a('0x16'),_0x9eab4a,JSON['stringify'](_0x325be4));_0x680f2a(_0x325be4);})[_0x348a('0x15')](function(_0x2c902f){logger[_0x348a('0x11')](_0x348a('0x16'),_0x2c902f[_0x348a('0x12')],_0x9eab4a);_0x2689b7(_0x1e92d6[_0x348a('0x11')](0x1f4,_0x2c902f[_0x348a('0x12')]));});});};exports['ShowTrunk']=function(_0x77c822){var _0x2ec06f=this;return new Promise(function(_0xb24918,_0x2a8172){return db['Trunk'][_0x348a('0x1e')]({'raw':_0x77c822[_0x348a('0x17')]?_0x77c822[_0x348a('0x17')][_0x348a('0x18')]===undefined?!![]:![]:!![],'where':_0x77c822[_0x348a('0x17')]?_0x77c822[_0x348a('0x17')][_0x348a('0x19')]||null:null,'attributes':_0x77c822['options']?_0x77c822[_0x348a('0x17')]['attributes']||null:null,'include':_0x77c822['options']?_0x77c822[_0x348a('0x17')][_0x348a('0x1b')]?_[_0x348a('0x1c')](_0x77c822[_0x348a('0x17')]['include'],function(_0x5c647d){return{'model':db[_0x5c647d[_0x348a('0x1d')]],'as':_0x5c647d['as'],'attributes':_0x5c647d[_0x348a('0x1a')],'include':_0x5c647d[_0x348a('0x1b')]?_[_0x348a('0x1c')](_0x5c647d['include'],function(_0x170609){return{'model':db[_0x170609[_0x348a('0x1d')]],'as':_0x170609['as'],'attributes':_0x170609[_0x348a('0x1a')],'include':_0x170609['include']?_[_0x348a('0x1c')](_0x170609[_0x348a('0x1b')],function(_0x516f3a){return{'model':db[_0x516f3a[_0x348a('0x1d')]],'as':_0x516f3a['as'],'attributes':_0x516f3a[_0x348a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x348a('0xc')](function(_0x26f34a){logger['info'](_0x348a('0x1f'),_0x77c822);logger[_0x348a('0xf')](_0x348a('0x1f'),_0x77c822,JSON[_0x348a('0x20')](_0x26f34a));_0xb24918(_0x26f34a);})[_0x348a('0x15')](function(_0x432c00){logger[_0x348a('0x11')](_0x348a('0x1f'),_0x432c00[_0x348a('0x12')],_0x77c822);_0x2a8172(_0x2ec06f[_0x348a('0x11')](0x1f4,_0x432c00['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 12e3c60..f65c39c 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b29=['put','isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x59beb6,_0x10d085){var _0x331d47=function(_0x367f16){while(--_0x367f16){_0x59beb6['push'](_0x59beb6['shift']());}};_0x331d47(++_0x10d085);}(_0x2b29,0x17e));var _0x92b2=function(_0x5756b7,_0x172674){_0x5756b7=_0x5756b7-0x0;var _0x11aa10=_0x2b29[_0x5756b7];return _0x11aa10;};'use strict';var express=require(_0x92b2('0x0'));var router=express['Router']();var auth=require(_0x92b2('0x1'));var controller=require(_0x92b2('0x2'));router[_0x92b2('0x3')]('/:id',auth[_0x92b2('0x4')](),controller[_0x92b2('0x5')]);module[_0x92b2('0x6')]=router; \ No newline at end of file +var _0xe943=['put','/:id','isAuthenticated','exports','../../components/auth/service','./user-setting.controller'];(function(_0x57560d,_0x215718){var _0x50b44a=function(_0x47d56b){while(--_0x47d56b){_0x57560d['push'](_0x57560d['shift']());}};_0x50b44a(++_0x215718);}(_0xe943,0x16c));var _0x3e94=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe943[_0x5f1391];return _0x50ebe3;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x3e94('0x0'));var controller=require(_0x3e94('0x1'));router[_0x3e94('0x2')](_0x3e94('0x3'),auth[_0x3e94('0x4')](),controller['update']);module[_0x3e94('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 9a1d6aa..72317c6 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32ff=['warning','info','debug','ENUM','TEXT','INTEGER','UserId','sequelize','error'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x32ff,0x16f));var _0xf32f=function(_0x2bfbc3,_0x4d7905){_0x2bfbc3=_0x2bfbc3-0x0;var _0x52293d=_0x32ff[_0x2bfbc3];return _0x52293d;};'use strict';var Sequelize=require(_0xf32f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf32f('0x1'),_0xf32f('0x2'),_0xf32f('0x3'),_0xf32f('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xf32f('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf32f('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf32f('0x7')],'unique':_0xf32f('0x8')}}; \ No newline at end of file +var _0x8737=['info','debug','exports','ENUM','TEXT','DATE','INTEGER','UserId','error','warning'];(function(_0x1b2214,_0x1000e6){var _0x273cf9=function(_0x338fba){while(--_0x338fba){_0x1b2214['push'](_0x1b2214['shift']());}};_0x273cf9(++_0x1000e6);}(_0x8737,0xee));var _0x7873=function(_0x245c4c,_0x312a5b){_0x245c4c=_0x245c4c-0x0;var _0x2b8e9f=_0x8737[_0x245c4c];return _0x2b8e9f;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x7873('0x0'),_0x7873('0x1'),_0x7873('0x2'),_0x7873('0x3')];module[_0x7873('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x7873('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7873('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7873('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x7873('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7873('0x8')],'unique':_0x7873('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 6c9fd9f..ef3a77c 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61a5=['../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','defaults','redis','localhost','status','update','then','error','stack','name','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','api'];(function(_0x10c467,_0x298f44){var _0x92aaa2=function(_0x233054){while(--_0x233054){_0x10c467['push'](_0x10c467['shift']());}};_0x92aaa2(++_0x298f44);}(_0x61a5,0xf0));var _0x561a=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x61a5[_0x687ddc];return _0x441991;};'use strict';var _=require(_0x561a('0x0'));var Redis=require('ioredis');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var config=require(_0x561a('0x3'));var db=require(_0x561a('0x4'))['db'];var socket=require(_0x561a('0x5'))(new Redis(config['redis']));require(_0x561a('0x6'))[_0x561a('0x7')](socket);config['redis']=_[_0x561a('0x8')](config[_0x561a('0x9')],{'host':_0x561a('0xa'),'port':0x18eb});function respondWithResult(_0x2646bd,_0x3d55f8){_0x3d55f8=_0x3d55f8||0xc8;return function(_0xfe091){if(_0xfe091){return _0x2646bd[_0x561a('0xb')](_0x3d55f8)['json'](_0xfe091);}};}function saveUpdates(_0x3db11c){return function(_0x52563e){if(_0x52563e){return _0x52563e[_0x561a('0xc')](_0x3db11c)[_0x561a('0xd')](function(_0x5b3510){return _0x5b3510;});}return null;};}function handleEntityNotFound(_0x34e464){return function(_0x4071ba){if(!_0x4071ba){_0x34e464['sendStatus'](0x194);}return _0x4071ba;};}function handleError(_0x3a1eee,_0x5cc8ed){_0x5cc8ed=_0x5cc8ed||0x1f4;return function(_0x205e99){logger[_0x561a('0xe')](_0x205e99[_0x561a('0xf')]);if(_0x205e99[_0x561a('0x10')]){delete _0x205e99[_0x561a('0x10')];}_0x3a1eee[_0x561a('0xb')](_0x5cc8ed)[_0x561a('0x11')](_0x205e99);};}exports[_0x561a('0xc')]=function(_0x8c1952,_0x4f1e33){if(_0x8c1952[_0x561a('0x12')][_0x561a('0x13')]!=='admin')throw new Error(_0x561a('0x14'));if(isNaN(Number(_0x8c1952[_0x561a('0x15')]['id'])))throw new Error(_0x561a('0x16'));return db[_0x561a('0x17')][_0x561a('0x18')]({'where':{'id':_0x8c1952[_0x561a('0x15')]['id']}})[_0x561a('0xd')](handleEntityNotFound(_0x4f1e33,null))[_0x561a('0xd')](saveUpdates(_0x8c1952[_0x561a('0x19')],null))[_0x561a('0xd')](respondWithResult(_0x4f1e33,null))[_0x561a('0x1a')](handleError(_0x4f1e33,null));}; \ No newline at end of file +var _0x9c44=['admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','localhost','json','update','stack','name','status','send','user','role'];(function(_0x429913,_0xe1ab59){var _0x439e59=function(_0x50179c){while(--_0x50179c){_0x429913['push'](_0x429913['shift']());}};_0x439e59(++_0xe1ab59);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var config=require(_0x49c4('0x2'));var db=require(_0x49c4('0x3'))['db'];var socket=require(_0x49c4('0x4'))(new Redis(config[_0x49c4('0x5')]));require('./user-setting.socket')['register'](socket);config[_0x49c4('0x5')]=_['defaults'](config[_0x49c4('0x5')],{'host':_0x49c4('0x6'),'port':0x18eb});function respondWithResult(_0x69bc41,_0x2c4e2e){_0x2c4e2e=_0x2c4e2e||0xc8;return function(_0x436234){if(_0x436234){return _0x69bc41['status'](_0x2c4e2e)[_0x49c4('0x7')](_0x436234);}};}function saveUpdates(_0x42e4f8){return function(_0x1d13fb){if(_0x1d13fb){return _0x1d13fb[_0x49c4('0x8')](_0x42e4f8)['then'](function(_0x5ab4a3){return _0x5ab4a3;});}return null;};}function handleEntityNotFound(_0x451ea6){return function(_0x313e73){if(!_0x313e73){_0x451ea6['sendStatus'](0x194);}return _0x313e73;};}function handleError(_0xb611a1,_0x459d09){_0x459d09=_0x459d09||0x1f4;return function(_0x4adb3c){logger['error'](_0x4adb3c[_0x49c4('0x9')]);if(_0x4adb3c[_0x49c4('0xa')]){delete _0x4adb3c['name'];}_0xb611a1[_0x49c4('0xb')](_0x459d09)[_0x49c4('0xc')](_0x4adb3c);};}exports['update']=function(_0x1909fe,_0x280996){if(_0x1909fe[_0x49c4('0xd')][_0x49c4('0xe')]!==_0x49c4('0xf'))throw new Error(_0x49c4('0x10'));if(isNaN(Number(_0x1909fe[_0x49c4('0x11')]['id'])))throw new Error(_0x49c4('0x12'));return db['UserSetting'][_0x49c4('0x13')]({'where':{'id':_0x1909fe[_0x49c4('0x11')]['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x280996,null))[_0x49c4('0x14')](saveUpdates(_0x1909fe[_0x49c4('0x15')],null))['then'](respondWithResult(_0x280996,null))[_0x49c4('0x16')](handleError(_0x280996,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 8ac1d87..a63192a 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30cc=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x4469a8,_0x43db44){var _0x473935=function(_0x565ae8){while(--_0x565ae8){_0x4469a8['push'](_0x4469a8['shift']());}};_0x473935(++_0x43db44);}(_0x30cc,0x1aa));var _0xc30c=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x30cc[_0x1f71d8];return _0x10b045;};'use strict';var EventEmitter=require(_0xc30c('0x0'));var UserSetting=require(_0xc30c('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc30c('0x2')](0x0);var events={'afterCreate':_0xc30c('0x3'),'afterUpdate':'update','afterDestroy':_0xc30c('0x4')};function emitEvent(_0x48bd4e){return function(_0x4666dd,_0x4e0cd6,_0x4e7b54){UserSettingEvents['emit'](_0x48bd4e+':'+_0x4666dd['id'],_0x4666dd);UserSettingEvents[_0xc30c('0x5')](_0x48bd4e,_0x4666dd);_0x4e7b54(null);};}for(var e in events){if(events[_0xc30c('0x6')](e)){var event=events[e];UserSetting[_0xc30c('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xd25e=['UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x299fff,_0x58f442){var _0x379e74=function(_0x4321e0){while(--_0x4321e0){_0x299fff['push'](_0x299fff['shift']());}};_0x379e74(++_0x58f442);}(_0xd25e,0xa1));var _0xed25=function(_0x4c92b1,_0x5f2253){_0x4c92b1=_0x4c92b1-0x0;var _0x4fd564=_0xd25e[_0x4c92b1];return _0x4fd564;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xed25('0x0'))['db'][_0xed25('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xed25('0x2')](0x0);var events={'afterCreate':_0xed25('0x3'),'afterUpdate':_0xed25('0x4'),'afterDestroy':_0xed25('0x5')};function emitEvent(_0x574e63){return function(_0x3a7534,_0x31e5d5,_0x4cd187){UserSettingEvents[_0xed25('0x6')](_0x574e63+':'+_0x3a7534['id'],_0x3a7534);UserSettingEvents[_0xed25('0x6')](_0x574e63,_0x3a7534);_0x4cd187(null);};}for(var e in events){if(events[_0xed25('0x7')](e)){var event=events[e];UserSetting[_0xed25('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index e351b66..7ba0943 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c71=['clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings'];(function(_0x2b893b,_0x1c0f36){var _0x42c815=function(_0x120674){while(--_0x120674){_0x2b893b['push'](_0x2b893b['shift']());}};_0x42c815(++_0x1c0f36);}(_0x0c71,0xfb));var _0x10c7=function(_0x1adf7b,_0x187d58){_0x1adf7b=_0x1adf7b-0x0;var _0x2973fb=_0x0c71[_0x1adf7b];return _0x2973fb;};'use strict';var attributes=require('./user-setting.attributes');module[_0x10c7('0x0')]=function(_0x4ff793){return _0x4ff793[_0x10c7('0x1')](_0x10c7('0x2'),attributes,{'tableName':_0x10c7('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4858c1){if(!_0x4858c1['clientSideLoggingEnabled'])_0x4858c1[_0x10c7('0x4')]=null;else if(_0x4858c1['clientSideLoggingEnabledSince']===null)_0x4858c1[_0x10c7('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x58a4=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings'];(function(_0x4ad6e4,_0x103161){var _0x11e62a=function(_0x10dc1e){while(--_0x10dc1e){_0x4ad6e4['push'](_0x4ad6e4['shift']());}};_0x11e62a(++_0x103161);}(_0x58a4,0xbf));var _0x458a=function(_0x52753e,_0x1718bc){_0x52753e=_0x52753e-0x0;var _0x5b2cd5=_0x58a4[_0x52753e];return _0x5b2cd5;};'use strict';var attributes=require(_0x458a('0x0'));module[_0x458a('0x1')]=function(_0x4043ce){return _0x4043ce[_0x458a('0x2')](_0x458a('0x3'),attributes,{'tableName':_0x458a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a1838){if(!_0x2a1838[_0x458a('0x5')])_0x2a1838[_0x458a('0x6')]=null;else if(_0x2a1838[_0x458a('0x6')]===null)_0x2a1838[_0x458a('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 895cc36..005bc82 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc174=['UserId','register','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x45806c,_0x158f22){var _0x4f8fcc=function(_0x4f20e4){while(--_0x4f20e4){_0x45806c['push'](_0x45806c['shift']());}};_0x4f8fcc(++_0x158f22);}(_0xc174,0x1c2));var _0x4c17=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xc174[_0xa1e3e3];return _0xc980e9;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x4c17('0x0'),_0x4c17('0x1')];function createListener(_0x12c849,_0x2f3f9d){return function(_0x12068d){_0x2f3f9d[_0x4c17('0x2')](_0x12c849,_0x12068d);if(_0x12c849===_0x4c17('0x3')){_0x2f3f9d[_0x4c17('0x2')](_0x4c17('0x4')+_0x12068d[_0x4c17('0x5')],_0x12068d);}};}exports[_0x4c17('0x6')]=function(_0x4493e5){for(var _0x1a8114=0x0,_0x400b95=events['length'];_0x1a8114<_0x400b95;_0x1a8114++){var _0x12764d=events[_0x1a8114];var _0x59db26=createListener('user-setting:'+_0x12764d,_0x4493e5);UserSettingEvents['on'](_0x12764d,_0x59db26);}}; \ No newline at end of file +var _0xfdf6=['user-setting:','save','emit','user-setting:update','user-setting:update:user-','length'];(function(_0x4d9fca,_0x3f6ae1){var _0x6c394d=function(_0x9dd03d){while(--_0x9dd03d){_0x4d9fca['push'](_0x4d9fca['shift']());}};_0x6c394d(++_0x3f6ae1);}(_0xfdf6,0x9d));var _0x6fdf=function(_0x5cbaae,_0xf01db1){_0x5cbaae=_0x5cbaae-0x0;var _0xd164d5=_0xfdf6[_0x5cbaae];return _0xd164d5;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x6fdf('0x0'),'remove','update'];function createListener(_0x14c6a2,_0x104a05){return function(_0x4b456f){_0x104a05[_0x6fdf('0x1')](_0x14c6a2,_0x4b456f);if(_0x14c6a2===_0x6fdf('0x2')){_0x104a05[_0x6fdf('0x1')](_0x6fdf('0x3')+_0x4b456f['UserId'],_0x4b456f);}};}exports['register']=function(_0x33699f){for(var _0x5406b4=0x0,_0x5c1b27=events[_0x6fdf('0x4')];_0x5406b4<_0x5c1b27;_0x5406b4++){var _0x20d77d=events[_0x5406b4];var _0xfcebcf=createListener(_0x6fdf('0x5')+_0x20d77d,_0x33699f);UserSettingEvents['on'](_0x20d77d,_0xfcebcf);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8a00606..dc89b80 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 _0x1069=['addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/fax_accounts','addFaxAccounts'];(function(_0x42f78a,_0x210841){var _0x26cb8f=function(_0x5c596a){while(--_0x5c596a){_0x42f78a['push'](_0x42f78a['shift']());}};_0x26cb8f(++_0x210841);}(_0x1069,0x167));var _0x9106=function(_0xe47ef0,_0x30445d){_0xe47ef0=_0xe47ef0-0x0;var _0x45d200=_0x1069[_0xe47ef0];return _0x45d200;};'use strict';var multer=require(_0x9106('0x0'));var util=require(_0x9106('0x1'));var path=require(_0x9106('0x2'));var timeout=require(_0x9106('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9106('0x4'));var interaction=require(_0x9106('0x5'));var config=require(_0x9106('0x6'));var controller=require('./user.controller');router['get']('/',auth[_0x9106('0x7')](),controller[_0x9106('0x8')]);router[_0x9106('0x9')]('/describe',auth[_0x9106('0x7')](),controller['describe']);router[_0x9106('0x9')](_0x9106('0xa'),auth[_0x9106('0x7')](),controller[_0x9106('0xb')]);router[_0x9106('0x9')](_0x9106('0xc'),auth[_0x9106('0x7')](),controller[_0x9106('0xd')]);router[_0x9106('0x9')]('/:id',auth[_0x9106('0x7')](),controller[_0x9106('0xe')]);router[_0x9106('0x9')](_0x9106('0xf'),controller[_0x9106('0x10')]);router[_0x9106('0x9')]('/:id/open_tabs',auth[_0x9106('0x7')](),controller[_0x9106('0x11')]);router[_0x9106('0x9')](_0x9106('0x12'),auth[_0x9106('0x7')](),controller['getContacts']);router[_0x9106('0x9')](_0x9106('0x13'),auth['isAuthenticated'](),controller['getQueues']);router[_0x9106('0x9')]('/:id/queues_rt',auth[_0x9106('0x7')](),controller[_0x9106('0x14')]);router['get'](_0x9106('0x15'),auth[_0x9106('0x7')](),controller[_0x9106('0x16')]);router[_0x9106('0x9')](_0x9106('0x17'),auth['isAuthenticated'](),controller[_0x9106('0x18')]);router['get'](_0x9106('0x19'),auth[_0x9106('0x7')](),controller['getScreenRecordings']);router['get'](_0x9106('0x1a'),auth['isAuthenticated'](),controller[_0x9106('0x1b')]);router[_0x9106('0x9')](_0x9106('0x1c'),auth[_0x9106('0x7')](),controller[_0x9106('0x1d')]);router[_0x9106('0x9')](_0x9106('0x1e'),auth[_0x9106('0x7')](),controller['getMailInteractions']);router[_0x9106('0x9')](_0x9106('0x1f'),auth[_0x9106('0x7')](),controller[_0x9106('0x20')]);router[_0x9106('0x9')]('/:id/fax/interactions',auth[_0x9106('0x7')](),controller[_0x9106('0x21')]);router[_0x9106('0x9')]('/:id/whatsapp/interactions',auth[_0x9106('0x7')](),controller['getWhatsappInteractions']);router['get'](_0x9106('0x22'),auth[_0x9106('0x7')](),controller['getTeams']);router[_0x9106('0x9')](_0x9106('0x23'),auth['isAuthenticated'](),controller[_0x9106('0x24')]);router[_0x9106('0x9')](_0x9106('0x25'),auth[_0x9106('0x7')](),controller[_0x9106('0x26')]);router['get']('/:id/prefixes',auth[_0x9106('0x7')](),controller[_0x9106('0x27')]);router[_0x9106('0x9')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x9106('0x28')]);router[_0x9106('0x9')](_0x9106('0x29'),auth[_0x9106('0x7')](),controller[_0x9106('0x2a')]);router[_0x9106('0x9')]('/:id/openchannel_accounts',auth[_0x9106('0x7')](),controller[_0x9106('0x2b')]);router[_0x9106('0x9')](_0x9106('0x2c'),auth[_0x9106('0x7')](),controller['getSmsAccounts']);router[_0x9106('0x9')](_0x9106('0x2d'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x9106('0x9')](_0x9106('0x2e'),auth[_0x9106('0x7')](),controller[_0x9106('0x2f')]);router[_0x9106('0x9')](_0x9106('0x30'),auth['isAuthenticated'](),controller[_0x9106('0x31')]);router[_0x9106('0x9')](_0x9106('0x32'),auth[_0x9106('0x7')](),controller[_0x9106('0x33')]);router['post'](_0x9106('0x12'),auth['isAuthenticated'](),controller[_0x9106('0x34')]);router[_0x9106('0x35')]('/',auth[_0x9106('0x7')](),controller[_0x9106('0x36')]);router[_0x9106('0x35')](_0x9106('0x37'),auth[_0x9106('0x7')](),controller[_0x9106('0x38')]);router['post'](_0x9106('0x13'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x9106('0x39')]({'destination':function(_0xc3d35,_0x352a97,_0x2e2108){_0x2e2108(null,path[_0x9106('0x3a')](config[_0x9106('0x3b')],_0x9106('0x3c')));},'filename':function(_0xc6c990,_0x2e8738,_0x1d3252){_0x1d3252(null,util[_0x9106('0x3d')]('%s-%s',Date['now'](),_0x2e8738['originalname']));}})});router[_0x9106('0x35')](_0x9106('0xf'),upload[_0x9106('0x3e')](_0x9106('0x3f')),controller['addAvatar']);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0x9106('0x40')]);router[_0x9106('0x35')](_0x9106('0x41'),auth[_0x9106('0x7')](),controller[_0x9106('0x42')]);router[_0x9106('0x35')](_0x9106('0x43'),auth[_0x9106('0x7')](),controller[_0x9106('0x44')]);router[_0x9106('0x35')](_0x9106('0x45'),auth[_0x9106('0x7')](),controller[_0x9106('0x46')]);router[_0x9106('0x35')](_0x9106('0x22'),auth[_0x9106('0x7')](),controller[_0x9106('0x47')]);router[_0x9106('0x35')](_0x9106('0x48'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x9106('0x35')](_0x9106('0x49'),auth[_0x9106('0x7')](),controller[_0x9106('0x4a')]);router[_0x9106('0x35')](_0x9106('0x4b'),auth[_0x9106('0x7')](),controller[_0x9106('0x4c')]);router[_0x9106('0x35')](_0x9106('0x4d'),auth['isAuthenticated'](),controller[_0x9106('0x4e')]);router[_0x9106('0x35')]('/:id/openchannel_interactions',auth[_0x9106('0x7')](),controller['addOpenchannelInteractions']);router[_0x9106('0x35')]('/:id/whatsapp_interactions',auth[_0x9106('0x7')](),controller['addWhatsappInteractions']);router[_0x9106('0x35')](_0x9106('0x4f'),auth[_0x9106('0x7')](),controller[_0x9106('0x50')]);router[_0x9106('0x35')](_0x9106('0x29'),auth[_0x9106('0x7')](),controller[_0x9106('0x51')]);router[_0x9106('0x35')]('/:id/openchannel_accounts',auth[_0x9106('0x7')](),controller[_0x9106('0x52')]);router[_0x9106('0x35')](_0x9106('0x2c'),auth[_0x9106('0x7')](),controller[_0x9106('0x53')]);router['post'](_0x9106('0x2d'),auth[_0x9106('0x7')](),controller[_0x9106('0x54')]);router[_0x9106('0x35')](_0x9106('0x2e'),auth['isAuthenticated'](),controller[_0x9106('0x55')]);router[_0x9106('0x35')](_0x9106('0x32'),auth[_0x9106('0x7')](),controller[_0x9106('0x56')]);router[_0x9106('0x57')]('/:id',auth['isAuthenticated'](),controller[_0x9106('0x58')]);router[_0x9106('0x57')](_0x9106('0x59'),auth[_0x9106('0x7')](),controller[_0x9106('0x5a')]);router[_0x9106('0x5b')](_0x9106('0x13'),auth['isAuthenticated'](),controller[_0x9106('0x5c')]);router[_0x9106('0x5b')]('/:id/teams',auth[_0x9106('0x7')](),controller[_0x9106('0x5d')]);router[_0x9106('0x5b')](_0x9106('0x5e'),auth[_0x9106('0x7')](),controller['destroy']);router[_0x9106('0x5b')](_0x9106('0x48'),auth[_0x9106('0x7')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0x9106('0x7')](),controller[_0x9106('0x5f')]);router[_0x9106('0x5b')]('/:id/fax_interactions',auth[_0x9106('0x7')](),controller[_0x9106('0x60')]);router[_0x9106('0x5b')](_0x9106('0x4d'),auth[_0x9106('0x7')](),controller[_0x9106('0x61')]);router[_0x9106('0x5b')](_0x9106('0x62'),auth[_0x9106('0x7')](),controller[_0x9106('0x63')]);router[_0x9106('0x5b')](_0x9106('0x64'),auth[_0x9106('0x7')](),controller[_0x9106('0x65')]);router[_0x9106('0x5b')](_0x9106('0x4f'),auth[_0x9106('0x7')](),controller['removeFaxAccounts']);router[_0x9106('0x5b')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x9106('0x66'),auth['isAuthenticated'](),controller[_0x9106('0x67')]);router[_0x9106('0x5b')]('/:id/sms_accounts',auth[_0x9106('0x7')](),controller[_0x9106('0x68')]);router[_0x9106('0x5b')](_0x9106('0x2d'),auth[_0x9106('0x7')](),controller[_0x9106('0x69')]);router[_0x9106('0x5b')](_0x9106('0x2e'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x9106('0x5b')]('/:id/api_key',auth[_0x9106('0x7')](),controller[_0x9106('0x6a')]);router[_0x9106('0x35')](_0x9106('0x6b'),auth[_0x9106('0x7')](),controller[_0x9106('0x6c')]);module[_0x9106('0x6d')]=router; \ No newline at end of file +var _0x7a35=['/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','diskStorage','join','root','format','%s-%s','now','originalname','file','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addFaxAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','/:id','update','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeMailAccounts','removeSmsAccounts','messengerSoundNotification','exports','multer','path','express','Router','../../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','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x7a35,0x1ea));var _0x57a3=function(_0x14915a,_0x222f6b){_0x14915a=_0x14915a-0x0;var _0x2f683c=_0x7a35[_0x14915a];return _0x2f683c;};'use strict';var multer=require(_0x57a3('0x0'));var util=require('util');var path=require(_0x57a3('0x1'));var timeout=require('connect-timeout');var express=require(_0x57a3('0x2'));var router=express[_0x57a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x57a3('0x4'));var interaction=require(_0x57a3('0x5'));var config=require(_0x57a3('0x6'));var controller=require(_0x57a3('0x7'));router[_0x57a3('0x8')]('/',auth[_0x57a3('0x9')](),controller[_0x57a3('0xa')]);router[_0x57a3('0x8')](_0x57a3('0xb'),auth['isAuthenticated'](),controller[_0x57a3('0xc')]);router['get'](_0x57a3('0xd'),auth['isAuthenticated'](),controller[_0x57a3('0xe')]);router['get'](_0x57a3('0xf'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x10')]);router['get']('/:id',auth[_0x57a3('0x9')](),controller[_0x57a3('0x11')]);router[_0x57a3('0x8')](_0x57a3('0x12'),controller[_0x57a3('0x13')]);router['get'](_0x57a3('0x14'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x15')]);router[_0x57a3('0x8')](_0x57a3('0x16'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x17')]);router[_0x57a3('0x8')](_0x57a3('0x18'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x19')]);router[_0x57a3('0x8')](_0x57a3('0x1a'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x1b')]);router['get']('/:id/groups',auth[_0x57a3('0x9')](),controller[_0x57a3('0x1c')]);router[_0x57a3('0x8')](_0x57a3('0x1d'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x1e')]);router[_0x57a3('0x8')](_0x57a3('0x1f'),auth[_0x57a3('0x9')](),controller['getScreenRecordings']);router[_0x57a3('0x8')](_0x57a3('0x20'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x21')]);router['get'](_0x57a3('0x22'),auth[_0x57a3('0x9')](),controller['getOpenchannelInteractions']);router[_0x57a3('0x8')]('/:id/mail/interactions',auth[_0x57a3('0x9')](),controller[_0x57a3('0x23')]);router[_0x57a3('0x8')](_0x57a3('0x24'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x25')]);router[_0x57a3('0x8')]('/:id/fax/interactions',auth[_0x57a3('0x9')](),controller['getFaxInteractions']);router['get'](_0x57a3('0x26'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x57a3('0x8')](_0x57a3('0x27'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x28')]);router[_0x57a3('0x8')]('/:id/lists',auth[_0x57a3('0x9')](),controller['getLists']);router[_0x57a3('0x8')](_0x57a3('0x29'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x2a')]);router[_0x57a3('0x8')](_0x57a3('0x2b'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x2c')]);router[_0x57a3('0x8')](_0x57a3('0x2d'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x2e')]);router[_0x57a3('0x8')](_0x57a3('0x2f'),auth[_0x57a3('0x9')](),controller['getMailAccounts']);router[_0x57a3('0x8')](_0x57a3('0x30'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x31')]);router[_0x57a3('0x8')](_0x57a3('0x32'),auth[_0x57a3('0x9')](),controller['getSmsAccounts']);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x57a3('0x33')]);router['get'](_0x57a3('0x34'),auth[_0x57a3('0x9')](),controller['getWhatsappAccounts']);router[_0x57a3('0x8')](_0x57a3('0x35'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x36')]);router[_0x57a3('0x8')](_0x57a3('0x37'),auth['isAuthenticated'](),controller[_0x57a3('0x38')]);router[_0x57a3('0x39')](_0x57a3('0x16'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x3a')]);router[_0x57a3('0x39')]('/',auth[_0x57a3('0x9')](),controller[_0x57a3('0x3b')]);router[_0x57a3('0x39')](_0x57a3('0x3c'),auth[_0x57a3('0x9')](),controller['bulkCreate']);router['post'](_0x57a3('0x18'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x57a3('0x3d')]({'destination':function(_0x41f121,_0x15dd47,_0x287be1){_0x287be1(null,path[_0x57a3('0x3e')](config[_0x57a3('0x3f')],'server/files/images/'));},'filename':function(_0x8244dc,_0x3cf5a4,_0x120036){_0x120036(null,util[_0x57a3('0x40')](_0x57a3('0x41'),Date[_0x57a3('0x42')](),_0x3cf5a4[_0x57a3('0x43')]));}})});router['post'](_0x57a3('0x12'),upload['single'](_0x57a3('0x44')),controller[_0x57a3('0x45')]);router[_0x57a3('0x39')](_0x57a3('0x46'),auth[_0x57a3('0x9')](),controller['login']);router[_0x57a3('0x39')]('/:id/logout',auth[_0x57a3('0x9')](),controller[_0x57a3('0x47')]);router[_0x57a3('0x39')](_0x57a3('0x48'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x49')]);router[_0x57a3('0x39')](_0x57a3('0x4a'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x4b')]);router['post'](_0x57a3('0x27'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x4c')]);router[_0x57a3('0x39')](_0x57a3('0x4d'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x4e')]);router['post']('/:id/mail_interactions',auth[_0x57a3('0x9')](),controller[_0x57a3('0x4f')]);router['post']('/:id/fax_interactions',auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x57a3('0x39')](_0x57a3('0x50'),auth['isAuthenticated'](),controller[_0x57a3('0x51')]);router[_0x57a3('0x39')](_0x57a3('0x52'),auth[_0x57a3('0x9')](),controller['addOpenchannelInteractions']);router[_0x57a3('0x39')]('/:id/whatsapp_interactions',auth[_0x57a3('0x9')](),controller['addWhatsappInteractions']);router[_0x57a3('0x39')](_0x57a3('0x2d'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x53')]);router[_0x57a3('0x39')](_0x57a3('0x2f'),auth[_0x57a3('0x9')](),controller['addMailAccounts']);router[_0x57a3('0x39')](_0x57a3('0x30'),auth[_0x57a3('0x9')](),controller['addOpenchannelAccounts']);router[_0x57a3('0x39')](_0x57a3('0x32'),auth['isAuthenticated'](),controller[_0x57a3('0x54')]);router['post'](_0x57a3('0x55'),auth['isAuthenticated'](),controller[_0x57a3('0x56')]);router[_0x57a3('0x39')](_0x57a3('0x34'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x57')]);router[_0x57a3('0x39')]('/:id/api_key',auth[_0x57a3('0x9')](),controller[_0x57a3('0x58')]);router['put'](_0x57a3('0x59'),auth['isAuthenticated'](),controller[_0x57a3('0x5a')]);router[_0x57a3('0x5b')](_0x57a3('0x5c'),auth['isAuthenticated'](),controller[_0x57a3('0x5d')]);router[_0x57a3('0x5e')]('/:id/queues',auth[_0x57a3('0x9')](),controller['removeQueues']);router[_0x57a3('0x5e')](_0x57a3('0x27'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x5f')]);router[_0x57a3('0x5e')](_0x57a3('0x59'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x60')]);router['delete'](_0x57a3('0x4d'),auth['isAuthenticated'](),controller[_0x57a3('0x61')]);router[_0x57a3('0x5e')]('/:id/mail_interactions',auth[_0x57a3('0x9')](),controller[_0x57a3('0x62')]);router[_0x57a3('0x5e')](_0x57a3('0x63'),auth['isAuthenticated'](),controller[_0x57a3('0x64')]);router[_0x57a3('0x5e')](_0x57a3('0x50'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x65')]);router[_0x57a3('0x5e')](_0x57a3('0x52'),auth['isAuthenticated'](),controller[_0x57a3('0x66')]);router[_0x57a3('0x5e')](_0x57a3('0x67'),auth[_0x57a3('0x9')](),controller['removeWhatsappInteractions']);router[_0x57a3('0x5e')](_0x57a3('0x2d'),auth[_0x57a3('0x9')](),controller['removeFaxAccounts']);router[_0x57a3('0x5e')](_0x57a3('0x2f'),auth['isAuthenticated'](),controller[_0x57a3('0x68')]);router[_0x57a3('0x5e')]('/:id/openchannel_accounts',auth[_0x57a3('0x9')](),controller['removeOpenchannelAccounts']);router[_0x57a3('0x5e')](_0x57a3('0x32'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x69')]);router['delete'](_0x57a3('0x55'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x57a3('0x5e')](_0x57a3('0x34'),auth[_0x57a3('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0x57a3('0x37'),auth[_0x57a3('0x9')](),controller['removeApiKey']);router['post']('/:id/messengerSoundNotification',auth[_0x57a3('0x9')](),controller[_0x57a3('0x6a')]);module[_0x57a3('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 470fc53..a16156b 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 _0xd627=['name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','STRING','email','toLowerCase','admin','agent','telephone','local','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','user','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','info','shortinfo','inband','rfc2833','yes','nonat','update','outgoing','nat','split','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','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','uac','certificate','active','passive','update,nonat','TEXT','showWebBar','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','exports'];(function(_0x38f9fc,_0x2ca82b){var _0x242585=function(_0x3b9371){while(--_0x3b9371){_0x38f9fc['push'](_0x38f9fc['shift']());}};_0x242585(++_0x2ca82b);}(_0xd627,0xb0));var _0x7d62=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xd627[_0x561f25];return _0x150e4c;};'use strict';var Sequelize=require(_0x7d62('0x0'));var moment=require('moment');var util=require(_0x7d62('0x1'));var _=require(_0x7d62('0x2'));module[_0x7d62('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7d62('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3bb2d6){this['setDataValue'](_0x7d62('0x4'),_0x3bb2d6);this[_0x7d62('0x5')]('defaultuser',_0x3bb2d6);},'comment':_0x7d62('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x32de9a){this['setDataValue']('fullname',_0x32de9a);this[_0x7d62('0x5')](_0x7d62('0x7'),util[_0x7d62('0x8')](_0x7d62('0x9'),_0x32de9a,this['getDataValue'](_0x7d62('0xa'))));}},'alias':{'type':Sequelize[_0x7d62('0xb')]},'email':{'type':Sequelize[_0x7d62('0xb')],'allowNull':![],'unique':_0x7d62('0xc'),'validate':{'isEmail':!![]},'set':function(_0x4f64f8){if(_0x4f64f8){this[_0x7d62('0x5')](_0x7d62('0xc'),_0x4f64f8[_0x7d62('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x7d62('0xe'),'user',_0x7d62('0xf'),_0x7d62('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':_0x7d62('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x21001e){this['setDataValue']('internal',_0x21001e);this[_0x7d62('0x5')](_0x7d62('0x12'),_0x21001e);this[_0x7d62('0x5')](_0x7d62('0x7'),util[_0x7d62('0x8')](_0x7d62('0x9'),this['getDataValue'](_0x7d62('0x13')),_0x21001e));}},'salt':{'type':Sequelize[_0x7d62('0xb')]},'phone':{'type':Sequelize[_0x7d62('0xb')]},'mobile':{'type':Sequelize[_0x7d62('0xb')]},'address':{'type':Sequelize[_0x7d62('0xb')]},'zipcode':{'type':Sequelize[_0x7d62('0xb')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7d62('0xb')]},'country':{'type':Sequelize[_0x7d62('0xb')]},'online':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x7d62('0x15')]},'voicePause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':_0x7d62('0x16')},'lastPauseAt':{'type':Sequelize[_0x7d62('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7d62('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7d62('0x18')},'ipaddr':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'port':{'type':Sequelize[_0x7d62('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x1a'),_0x7d62('0x1b'),'peer'),'allowNull':!![],'defaultValue':_0x7d62('0x1a')},'context':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'defaultValue':_0x7d62('0x1c')},'callingpres':{'type':Sequelize[_0x7d62('0x19')]('ALLOWED_NOT_SCREENED',_0x7d62('0x1d'),_0x7d62('0x1e'),_0x7d62('0x1f'),_0x7d62('0x20'),'PROHIB_PASSED_SCREEN',_0x7d62('0x21'),_0x7d62('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'transport':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'defaultValue':_0x7d62('0x23'),'set':function(_0x1e6a28){this[_0x7d62('0x5')](_0x7d62('0x24'),_0x1e6a28?_0x1e6a28['join'](','):null);},'get':function(){return this[_0x7d62('0x25')](_0x7d62('0x24'))?this['getDataValue'](_0x7d62('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7d62('0x19')]('rfc2833',_0x7d62('0x26'),_0x7d62('0x27'),_0x7d62('0x28'),'auto'),'allowNull':!![],'defaultValue':_0x7d62('0x29')},'directmedia':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no',_0x7d62('0x2b'),_0x7d62('0x2c'),_0x7d62('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'nat':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x58562f){this[_0x7d62('0x5')](_0x7d62('0x2e'),_0x58562f?_0x58562f['join'](','):null);},'get':function(){return this[_0x7d62('0x25')]('nat')?this['getDataValue']('nat')[_0x7d62('0x2f')](','):null;},'comment':_0x7d62('0x30')},'callgroup':{'type':Sequelize[_0x7d62('0xb')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x7d62('0xb')]},'namedpickupgroup':{'type':Sequelize[_0x7d62('0xb')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7d62('0xb')]},'disallow':{'type':Sequelize[_0x7d62('0xb')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x7d62('0xb')],'allowNull':![],'defaultValue':_0x7d62('0x31'),'set':function(_0x119cf8){this[_0x7d62('0x5')]('allow',_0x119cf8?_0x119cf8['join'](';'):_0x7d62('0x31'));},'get':function(){return this[_0x7d62('0x25')](_0x7d62('0x32'))?this[_0x7d62('0x25')](_0x7d62('0x32'))[_0x7d62('0x2f')](';'):null;},'comment':_0x7d62('0x33')},'autoframing':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'set':function(_0x33945c){this[_0x7d62('0x5')](_0x7d62('0x34'),_0x33945c?_0x33945c[_0x7d62('0x35')](','):null);},'get':function(){return this[_0x7d62('0x25')]('insecure')?this[_0x7d62('0x25')](_0x7d62('0x34'))['split'](','):null;},'comment':_0x7d62('0x36')},'trustrpid':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no',_0x7d62('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7d62('0x38')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x7d62('0x2a')},'busylevel':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'template':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7d62('0x19')]('yes','no',_0x7d62('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x7d62('0x19')]('accept',_0x7d62('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x3b'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x7d62('0x2a')},'keepalive':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7d62('0x19')]('yes','no','fingerprint',_0x7d62('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7d62('0x3d'),_0x7d62('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no','nonat',_0x7d62('0x2c'),_0x7d62('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x7d62('0x15')]},'passwordResetAt':{'type':Sequelize[_0x7d62('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x7d62('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5b99dc){this['setDataValue'](_0x7d62('0x41'),_0x5b99dc);var _0x37cd4a=this['get']({'plain':!![]});switch(_0x5b99dc){case 0x0:case 0x1:var _0x224735=_0x37cd4a[_0x7d62('0x24')]?_[_0x7d62('0x42')](_0x37cd4a[_0x7d62('0x24')])?_0x37cd4a[_0x7d62('0x24')][_0x7d62('0x35')]():_0x37cd4a['transport']:_0x7d62('0x23');if(_0x224735===_0x7d62('0x43')){_0x224735='udp';}this[_0x7d62('0x5')](_0x7d62('0x24'),_0x224735);this[_0x7d62('0x5')](_0x7d62('0x44'),'no');this[_0x7d62('0x5')]('avpf',null);this[_0x7d62('0x5')](_0x7d62('0x45'),null);this[_0x7d62('0x5')](_0x7d62('0x46'),null);this['setDataValue'](_0x7d62('0x47'),null);this[_0x7d62('0x5')]('dtlsverify',null);this['setDataValue'](_0x7d62('0x48'),null);this[_0x7d62('0x5')](_0x7d62('0x49'),null);this[_0x7d62('0x5')](_0x7d62('0x4a'),null);this[_0x7d62('0x5')](_0x7d62('0x4b'),'no');break;case 0x2:this[_0x7d62('0x5')](_0x7d62('0x24'),_0x7d62('0x43'));this[_0x7d62('0x5')]('encryption',_0x7d62('0x2a'));this[_0x7d62('0x5')]('avpf','yes');this[_0x7d62('0x5')](_0x7d62('0x45'),_0x7d62('0x2a'));this[_0x7d62('0x5')](_0x7d62('0x46'),_0x7d62('0x2a'));this['setDataValue'](_0x7d62('0x47'),'yes');this[_0x7d62('0x5')]('dtlsverify','no');this[_0x7d62('0x5')](_0x7d62('0x48'),_0x7d62('0x4c'));this[_0x7d62('0x5')](_0x7d62('0x49'),_0x37cd4a[_0x7d62('0x49')]||_0x7d62('0x4d'));this[_0x7d62('0x5')](_0x7d62('0x4a'),_0x37cd4a['dtlsprivatekey']||_0x7d62('0x4e'));this['setDataValue'](_0x7d62('0x4b'),_0x7d62('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x7d62('0x40')],'set':function(_0x316e0f){this[_0x7d62('0x5')](_0x7d62('0x4f'),_0x316e0f?_0x316e0f[_0x7d62('0x35')](','):[]);},'get':function(){return this[_0x7d62('0x25')]('permissions')?_[_0x7d62('0x50')](this[_0x7d62('0x25')](_0x7d62('0x4f'))[_0x7d62('0x2f')](','),function(_0x457f55){return parseInt(_0x457f55,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x7d62('0xb')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x7d62('0xb')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7d62('0xb')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x7d62('0x51')],'get':function(){return this[_0x7d62('0x25')](_0x7d62('0x52'))?this['getDataValue'](_0x7d62('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![],'set':function(_0x1cc367){if(typeof _0x1cc367===_0x7d62('0x53')){var _0x775070=_0x1cc367==='1'?!![]:_0x1cc367==='0'?![]:_0x1cc367==='true'?!![]:_0x1cc367===_0x7d62('0x54')?![]:![];this[_0x7d62('0x5')](_0x7d62('0x55'),_0x775070);}else{this[_0x7d62('0x5')](_0x7d62('0x55'),_0x1cc367);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x40c918){this[_0x7d62('0x5')](_0x7d62('0x56'),_0x40c918);if(_0x40c918===!![]){this[_0x7d62('0x5')](_0x7d62('0x57'),moment());this[_0x7d62('0x5')](_0x7d62('0x58'),0x0);}else{this[_0x7d62('0x5')](_0x7d62('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x7d62('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x7d62('0x17')](0x5)[_0x7d62('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x3644=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','UNSIGNED','sequelize','moment','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','user','agent','telephone','local','INTEGER','internal','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','\x22\x22\x20<>','always','originate','uac','uas','fingerprint','certificate','active','passive','update','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport'];(function(_0x4b124e,_0x11bd17){var _0x562039=function(_0x271f8b){while(--_0x271f8b){_0x4b124e['push'](_0x4b124e['shift']());}};_0x562039(++_0x11bd17);}(_0x3644,0x1cd));var _0x4364=function(_0x3d0a21,_0x161bec){_0x3d0a21=_0x3d0a21-0x0;var _0x12abd2=_0x3644[_0x3d0a21];return _0x12abd2;};'use strict';var Sequelize=require(_0x4364('0x0'));var moment=require(_0x4364('0x1'));var util=require('util');var _=require('lodash');module[_0x4364('0x2')]={'name':{'type':Sequelize[_0x4364('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x15b28b){this['setDataValue'](_0x4364('0x4'),_0x15b28b);this[_0x4364('0x5')](_0x4364('0x6'),_0x15b28b);},'comment':_0x4364('0x7')},'fullname':{'type':Sequelize[_0x4364('0x3')],'allowNull':![],'set':function(_0x530eeb){this['setDataValue'](_0x4364('0x8'),_0x530eeb);this[_0x4364('0x5')](_0x4364('0x9'),util['format'](_0x4364('0xa'),_0x530eeb,this[_0x4364('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x4364('0x3')]},'email':{'type':Sequelize[_0x4364('0x3')],'allowNull':![],'unique':_0x4364('0xc'),'validate':{'isEmail':!![]},'set':function(_0x317aa2){if(_0x317aa2){this[_0x4364('0x5')](_0x4364('0xc'),_0x317aa2[_0x4364('0xd')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x4364('0xe'),_0x4364('0xf'),_0x4364('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x4364('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4364('0x3')],'defaultValue':_0x4364('0x11')},'internal':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':![],'unique':_0x4364('0x13'),'set':function(_0x41e224){this[_0x4364('0x5')](_0x4364('0x13'),_0x41e224);this[_0x4364('0x5')](_0x4364('0x14'),_0x41e224);this[_0x4364('0x5')](_0x4364('0x9'),util[_0x4364('0x15')](_0x4364('0xa'),this[_0x4364('0xb')]('fullname'),_0x41e224));}},'salt':{'type':Sequelize[_0x4364('0x3')]},'phone':{'type':Sequelize[_0x4364('0x3')]},'mobile':{'type':Sequelize[_0x4364('0x3')]},'address':{'type':Sequelize[_0x4364('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4364('0x3')]},'online':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4364('0x17')]},'voicePause':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4364('0x3')],'defaultValue':_0x4364('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4364('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4364('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![],'defaultValue':_0x4364('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4364('0x1a')]('friend',_0x4364('0xe'),_0x4364('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x4364('0x1a')]('ALLOWED_NOT_SCREENED',_0x4364('0x1c'),_0x4364('0x1d'),_0x4364('0x1e'),_0x4364('0x1f'),_0x4364('0x20'),_0x4364('0x21'),_0x4364('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x20c6db){this[_0x4364('0x5')](_0x4364('0x23'),_0x20c6db?_0x20c6db[_0x4364('0x24')](','):null);},'get':function(){return this[_0x4364('0xb')](_0x4364('0x23'))?this['getDataValue']('transport')[_0x4364('0x25')](','):null;},'comment':_0x4364('0x26')},'dtmfmode':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x27'),_0x4364('0x28'),_0x4364('0x29'),_0x4364('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0x4364('0x27')},'directmedia':{'type':Sequelize[_0x4364('0x1a')]('yes','no','nonat','update',_0x4364('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4364('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0xa500fb){this[_0x4364('0x5')](_0x4364('0x2c'),_0xa500fb?_0xa500fb[_0x4364('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x4364('0x2c'))?this[_0x4364('0xb')](_0x4364('0x2c'))[_0x4364('0x25')](','):null;},'comment':_0x4364('0x2d')},'callgroup':{'type':Sequelize[_0x4364('0x3')]},'namedcallgroup':{'type':Sequelize[_0x4364('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4364('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x4364('0x3')],'allowNull':![],'defaultValue':_0x4364('0x2e')},'allow':{'type':Sequelize[_0x4364('0x3')],'allowNull':![],'defaultValue':_0x4364('0x2f'),'set':function(_0x45f2c6){this[_0x4364('0x5')](_0x4364('0x30'),_0x45f2c6?_0x45f2c6['join'](';'):_0x4364('0x2f'));},'get':function(){return this[_0x4364('0xb')]('allow')?this['getDataValue'](_0x4364('0x30'))[_0x4364('0x25')](';'):null;},'comment':_0x4364('0x31')},'autoframing':{'type':Sequelize[_0x4364('0x1a')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![],'set':function(_0x2725c9){this[_0x4364('0x5')](_0x4364('0x32'),_0x2725c9?_0x2725c9[_0x4364('0x24')](','):null);},'get':function(){return this[_0x4364('0xb')](_0x4364('0x32'))?this['getDataValue']('insecure')[_0x4364('0x25')](','):null;},'comment':_0x4364('0x33')},'trustrpid':{'type':Sequelize[_0x4364('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4364('0x34'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x4364('0x34'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![],'defaultValue':_0x4364('0x35')},'amaflags':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x4364('0x34')},'busylevel':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4364('0x1a')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4364('0x1a')]('yes','no',_0x4364('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4364('0x1a')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4364('0x1a')]('accept','refuse',_0x4364('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x4364('0x38'),_0x4364('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x4364('0x34'),'no'),'allowNull':!![],'defaultValue':_0x4364('0x34')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4364('0x34'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x4364('0x34'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4364('0x1a')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x4364('0x34'),'no',_0x4364('0x3a'),_0x4364('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4364('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x3c'),_0x4364('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4364('0x1a')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no','nonat',_0x4364('0x3e'),_0x4364('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4364('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0,'set':function(_0x4b343b){this[_0x4364('0x5')](_0x4364('0x40'),_0x4b343b);var _0xd0eb4d=this[_0x4364('0x41')]({'plain':!![]});switch(_0x4b343b){case 0x0:case 0x1:var _0x10ac98=_0xd0eb4d[_0x4364('0x23')]?_[_0x4364('0x42')](_0xd0eb4d[_0x4364('0x23')])?_0xd0eb4d[_0x4364('0x23')]['join']():_0xd0eb4d[_0x4364('0x23')]:_0x4364('0x43');if(_0x10ac98===_0x4364('0x44')){_0x10ac98=_0x4364('0x43');}this[_0x4364('0x5')](_0x4364('0x23'),_0x10ac98);this[_0x4364('0x5')](_0x4364('0x45'),'no');this[_0x4364('0x5')](_0x4364('0x46'),null);this[_0x4364('0x5')](_0x4364('0x47'),null);this['setDataValue']('icesupport',null);this[_0x4364('0x5')](_0x4364('0x48'),null);this[_0x4364('0x5')](_0x4364('0x49'),null);this[_0x4364('0x5')](_0x4364('0x4a'),null);this[_0x4364('0x5')](_0x4364('0x4b'),null);this['setDataValue'](_0x4364('0x4c'),null);this['setDataValue'](_0x4364('0x4d'),'no');break;case 0x2:this[_0x4364('0x5')]('transport','wss');this['setDataValue'](_0x4364('0x45'),'yes');this[_0x4364('0x5')](_0x4364('0x46'),_0x4364('0x34'));this[_0x4364('0x5')](_0x4364('0x47'),_0x4364('0x34'));this['setDataValue'](_0x4364('0x4e'),_0x4364('0x34'));this[_0x4364('0x5')](_0x4364('0x48'),_0x4364('0x34'));this[_0x4364('0x5')](_0x4364('0x49'),'no');this[_0x4364('0x5')]('dtlssetup','actpass');this[_0x4364('0x5')](_0x4364('0x4b'),_0xd0eb4d[_0x4364('0x4b')]||_0x4364('0x4f'));this[_0x4364('0x5')](_0x4364('0x4c'),_0xd0eb4d['dtlsprivatekey']||_0x4364('0x50'));this[_0x4364('0x5')](_0x4364('0x4d'),_0x4364('0x34'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x556b73){this[_0x4364('0x5')](_0x4364('0x51'),_0x556b73?_0x556b73[_0x4364('0x24')](','):[]);},'get':function(){return this['getDataValue'](_0x4364('0x51'))?_['map'](this[_0x4364('0xb')](_0x4364('0x51'))[_0x4364('0x25')](','),function(_0x4f4fa3){return parseInt(_0x4f4fa3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x4364('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4364('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4364('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4364('0x1a')](_0x4364('0x34'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4364('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4364('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4364('0x52')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x4364('0xb')](_0x4364('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x4364('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4364('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![],'set':function(_0x482c64){if(typeof _0x482c64===_0x4364('0x54')){var _0x54fda3=_0x482c64==='1'?!![]:_0x482c64==='0'?![]:_0x482c64===_0x4364('0x55')?!![]:_0x482c64==='false'?![]:![];this[_0x4364('0x5')](_0x4364('0x56'),_0x54fda3);}else{this[_0x4364('0x5')]('screenrecording',_0x482c64);}}},'blocked':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![],'set':function(_0x413e46){this['setDataValue'](_0x4364('0x57'),_0x413e46);if(_0x413e46===!![]){this[_0x4364('0x5')]('blockedAt',moment());this[_0x4364('0x5')](_0x4364('0x58'),0x0);}else{this[_0x4364('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x4364('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x4364('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x4364('0x12')](0x5)[_0x4364('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4364('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4364('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4364('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x4364('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x4364('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 2c9bc87..0cfd153 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 _0x2400=['OPENCHANNEL','MAIL','SmsOpenTabs','SMS','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','includeAll','List','Tag','Tags','color','tag','getQueues','keys','Queue','filters','intersection','model','fields','order','sort','pick','Queues','Unknown\x20role','nolimit','getVoiceQueuesRt','where','ChatGroup','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','headers','connection','remoteAddress','socket','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','pause','updateAttributes','DEFAULT\x20PAUSE','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','resolve','Team','addAgent','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','getLists','CmList','getAgents','CmHopper','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','firstName','phone','CmContact','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','getPresence','idle','ringing','queues','inbound','toString','lower','asc','desc','substring','uniqBy','orderBy','voiceStatus','unavailable','busy','slice','charAt','select','field','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','util','lodash','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','client','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','role','emit','destroy','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','name','stack','send','rawAttributes','fieldName','type','key','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','query','include','userSetting','true','UserSetting','attributes','push','User','findAll','openTabs','rows','length','chat','dataValues','sms','openchannel','whatsapp','all','show','params','merge','options','fax','body','describe','addContacts','ids','omit','internal','validatePasswordPattern','max','min_internal','isNil','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','password','email','permissions','102','103','113','105','106','108','109','100','111','114','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','UserProfileResource','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','VoiceQueue','get','voice','interface','format','SIP/%s','UserVoiceQueueRt','removeQueues','channel','remove','isArray','Queue:remove','addAvatar','userpic','filename','getAvatar','existsSync','join','server/files/images/','download','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs'];(function(_0x25ab89,_0x2ec2cb){var _0xd4a91c=function(_0x52422b){while(--_0x52422b){_0x25ab89['push'](_0x25ab89['shift']());}};_0xd4a91c(++_0x2ec2cb);}(_0x2400,0xc2));var _0x0240=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x2400[_0x2aec52];return _0x3b8835;};'use strict';var moment=require(_0x0240('0x0'));var util=require(_0x0240('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x0240('0x2'));var squel=require(_0x0240('0x3'));var Redis=require('ioredis');var jayson=require(_0x0240('0x4'));var authService=require(_0x0240('0x5'));var contacts=require(_0x0240('0x6'));var qs=require(_0x0240('0x7'));var rta=require(_0x0240('0x8'));var logger=require(_0x0240('0x9'))(_0x0240('0xa'));var utils=require(_0x0240('0xb'));var config=require(_0x0240('0xc'));var licenseUtil=require(_0x0240('0xd'));var APIBadRequestError=require(_0x0240('0xe'))[_0x0240('0xf')];var APINotFoundError=require(_0x0240('0xe'))[_0x0240('0x10')];var APIForbiddenError=require(_0x0240('0xe'))[_0x0240('0x11')];var APIHandleError=require('../../errors/api')[_0x0240('0x12')];var db=require(_0x0240('0x13'))['db'];var socket=require(_0x0240('0x14'))(new Redis(config[_0x0240('0x15')]));require(_0x0240('0x16'))[_0x0240('0x17')](socket);config[_0x0240('0x15')]=_['defaults'](config[_0x0240('0x15')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0x0240('0x18')]['http']({'port':0x232a});var values;function respondWithStatusCode(_0x2beb93,_0x5c4182){_0x5c4182=_0x5c4182||0xcc;return function(_0x435a50){if(_0x435a50){return _0x2beb93[_0x0240('0x19')](_0x5c4182);}return _0x2beb93[_0x0240('0x1a')](_0x5c4182)[_0x0240('0x1b')]();};}function respondWithResult(_0x12dfdb,_0xa3e0b4){_0xa3e0b4=_0xa3e0b4||0xc8;return function(_0x4ffc64){if(_0x4ffc64){return _0x12dfdb[_0x0240('0x1a')](_0xa3e0b4)[_0x0240('0x1c')](_0x4ffc64);}};}function respondWithFilteredResult(_0x2e3ae8,_0x48949f){return function(_0x2ab730){if(_0x2ab730){var _0x1c76b0=typeof _0x48949f[_0x0240('0x1d')]===_0x0240('0x1e')&&typeof _0x48949f[_0x0240('0x1f')]===_0x0240('0x1e');var _0x127a9d=_0x2ab730[_0x0240('0x20')];var _0x4bdd84=_0x1c76b0?0x0:_0x48949f['offset'];var _0xf5a57e=_0x1c76b0?_0x2ab730[_0x0240('0x20')]:_0x48949f[_0x0240('0x1d')]+_0x48949f[_0x0240('0x1f')];var _0x37b002;if(_0xf5a57e>=_0x127a9d){_0xf5a57e=_0x127a9d;_0x37b002=0xc8;}else{_0x37b002=0xce;}_0x2e3ae8['status'](_0x37b002);return _0x2e3ae8[_0x0240('0x21')](_0x0240('0x22'),_0x4bdd84+'-'+_0xf5a57e+'/'+_0x127a9d)[_0x0240('0x1c')](_0x2ab730);}return null;};}function respondWithRpcPromise(_0x163977,_0x494b90,_0x4c10fd,_0x47b553){return new Promise(function(_0x197131,_0x4b2114){var _0x2ded4a=_0x47b553||amiClient;return _0x2ded4a[_0x0240('0x23')](_0x163977,_0x4c10fd)[_0x0240('0x24')](function(_0x652406){logger[_0x0240('0x25')](_0x0240('0x26'),_0x494b90,_0x0240('0x27'));logger[_0x0240('0x28')](_0x0240('0x29'),_0x494b90,_0x0240('0x27'),JSON[_0x0240('0x2a')](_0x652406));if(_0x652406[_0x0240('0x2b')]){if(_0x652406[_0x0240('0x2b')]['code']===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x494b90,_0x652406[_0x0240('0x2b')]['message']);return _0x4b2114(_0x652406[_0x0240('0x2b')][_0x0240('0x2c')]);}logger[_0x0240('0x2b')](_0x0240('0x26'),_0x494b90,_0x652406['error'][_0x0240('0x2c')]);return _0x197131(_0x652406[_0x0240('0x2b')][_0x0240('0x2c')]);}else{logger['info'](_0x0240('0x26'),_0x494b90,_0x0240('0x27'));_0x197131(_0x652406[_0x0240('0x2d')]['message']);}})[_0x0240('0x2e')](function(_0x121be6){logger['error']('User,\x20%s,\x20%s',_0x494b90,_0x121be6);_0x4b2114(_0x121be6);});});}function saveUpdates(_0x390e82){return function(_0x4df2cf){if(_0x4df2cf){return _0x4df2cf[_0x0240('0x2f')](_0x390e82)[_0x0240('0x24')](function(_0x2258b3){if(_0x2258b3[_0x0240('0x30')]==='agent'){socket[_0x0240('0x31')]('userNotification:recalc:'+_0x2258b3['id'],_0x2258b3);}return _0x2258b3;});}return null;};}function removeEntity(_0xf68f1f,_0x13e795){return function(_0x27420b){if(_0x27420b){return _0x27420b[_0x0240('0x32')]({'transaction':_0x13e795})[_0x0240('0x24')](function(){var _0x134220=_0x27420b['get']({'plain':!![]});if(_0x134220[_0x0240('0x30')]==='admin')return;var _0xd0ed05=[{'name':_0x0240('0x33'),'value':_0x0240('0x34'),'ignore':!![]},{'name':_0x0240('0x35'),'value':_0x0240('0x36'),'ignore':![]},{'name':_0x0240('0x37'),'value':_0x0240('0x38'),'ignore':![]}];var _0x2af602=_(_0xd0ed05)[_0x0240('0x39')](_0x0240('0x3a'))[_0x0240('0x3b')](_0x0240('0x3c'))['value']();if(_[_0x0240('0x3d')](_0x2af602,_0x134220[_0x0240('0x30')])){return;}var _0x4730d7=_[_0x0240('0x3e')](_0xd0ed05,['value',_0x134220[_0x0240('0x30')]])[_0x0240('0x3f')];return db['UserProfileResource'][_0x0240('0x32')]({'where':{'type':_0x4730d7,'resourceId':_0x134220['id']},'transaction':_0x13e795})[_0x0240('0x24')](function(){return _0x27420b;});})[_0x0240('0x24')](function(){_0xf68f1f['status'](0xcc)[_0x0240('0x1b')]();});}};}function handleEntityNotFound(_0x22831a){return function(_0x2e3bcd){if(!_0x2e3bcd){_0x22831a['sendStatus'](0x194);}return _0x2e3bcd;};}function handleError(_0xfeb578,_0x248ab6){_0x248ab6=_0x248ab6||0x1f4;return function(_0x41e858){logger[_0x0240('0x2b')](_0x41e858[_0x0240('0x40')]);if(_0x41e858['name']){delete _0x41e858[_0x0240('0x3f')];}_0xfeb578[_0x0240('0x1a')](_0x248ab6)[_0x0240('0x41')](_0x41e858);};}function getUserAttributes(){return _(db['User'][_0x0240('0x42')])['map'](function(_0x1f0066){return{'name':_0x1f0066[_0x0240('0x43')],'type':_0x1f0066[_0x0240('0x44')][_0x0240('0x45')]};})['filter'](function(_0x1fb9fc){return!['password',_0x0240('0x46'),_0x0240('0x47'),_0x0240('0x48'),_0x0240('0x49'),_0x0240('0x4a')][_0x0240('0x3d')](_0x1fb9fc[_0x0240('0x3f')]);})[_0x0240('0x3c')]();}exports[_0x0240('0x4b')]=function(_0x578680,_0x5f1664){var _0x4a4788={},_0x31f4bc={'count':0x0,'rows':[]};var _0x44a12a=getUserAttributes();_0x4a4788=qs[_0x0240('0x4c')](_0x44a12a,_0x578680);var _0x3a841c={'where':_0x4a4788['where']};return db['User']['count'](_0x3a841c)[_0x0240('0x24')](function(_0x1e20cc){_0x31f4bc[_0x0240('0x20')]=_0x1e20cc;if(_0x578680[_0x0240('0x4d')]['includeAll']){_0x4a4788[_0x0240('0x4e')]=[{'all':!![]}];}if(_0x578680[_0x0240('0x4d')][_0x0240('0x4f')]===_0x0240('0x50')){_0x4a4788[_0x0240('0x4e')]=[{'model':db[_0x0240('0x51')],'as':_0x0240('0x4f')}];}if(!_[_0x0240('0x3d')](_0x4a4788[_0x0240('0x52')],'id')){_0x4a4788[_0x0240('0x52')][_0x0240('0x53')]('id');}return db[_0x0240('0x54')][_0x0240('0x55')](_0x4a4788);})[_0x0240('0x24')](function(_0x36f3ee){_0x31f4bc['rows']=_0x36f3ee;if(_0x578680[_0x0240('0x4d')][_0x0240('0x56')]==='true'){var _0x33cf4e=[];for(var _0x1f9e35=0x0;_0x1f9e35<_0x31f4bc[_0x0240('0x57')][_0x0240('0x58')];_0x1f9e35++){_0x33cf4e['push'](get_open_tabs(_0x0240('0x59'),_0x31f4bc[_0x0240('0x57')][_0x1f9e35][_0x0240('0x5a')]));_0x33cf4e['push'](get_open_tabs(_0x0240('0x5b'),_0x31f4bc[_0x0240('0x57')][_0x1f9e35][_0x0240('0x5a')]));_0x33cf4e[_0x0240('0x53')](get_open_tabs('fax',_0x31f4bc[_0x0240('0x57')][_0x1f9e35]['dataValues']));_0x33cf4e[_0x0240('0x53')](get_open_tabs('mail',_0x31f4bc['rows'][_0x1f9e35][_0x0240('0x5a')]));_0x33cf4e[_0x0240('0x53')](get_open_tabs(_0x0240('0x5c'),_0x31f4bc[_0x0240('0x57')][_0x1f9e35]['dataValues']));_0x33cf4e[_0x0240('0x53')](get_open_tabs(_0x0240('0x5d'),_0x31f4bc['rows'][_0x1f9e35]['dataValues']));}return Promise[_0x0240('0x5e')](_0x33cf4e)[_0x0240('0x24')](function(){return _0x31f4bc;});}else{return _0x31f4bc;}})[_0x0240('0x24')](respondWithFilteredResult(_0x5f1664,_0x4a4788))[_0x0240('0x2e')](handleError(_0x5f1664,null));};exports[_0x0240('0x5f')]=function(_0x3f0647,_0x213bff){var _0xfbcbd1=getUserAttributes();_0x3f0647[_0x0240('0x4d')]['id']=_0x3f0647[_0x0240('0x60')]['id'];var _0x24ebe5=qs[_0x0240('0x4c')](_0xfbcbd1,_0x3f0647);if(_0x3f0647[_0x0240('0x4d')]['includeAll']){_0x24ebe5[_0x0240('0x4e')]=[{'all':!![]}];}if(_0x3f0647[_0x0240('0x4d')][_0x0240('0x4f')]==='true'){_0x24ebe5[_0x0240('0x4e')]=[{'model':db[_0x0240('0x51')],'as':_0x0240('0x4f')}];}_0x24ebe5=_[_0x0240('0x61')]({},_0x24ebe5,_0x3f0647[_0x0240('0x62')]);if(!_['includes'](_0x24ebe5[_0x0240('0x52')],'id')){_0x24ebe5[_0x0240('0x52')][_0x0240('0x53')]('id');}return db[_0x0240('0x54')][_0x0240('0x3e')](_0x24ebe5)['then'](handleEntityNotFound(_0x213bff,null))['then'](function(_0x30364b){var _0x3ed430=[];values=_0x30364b;if(_0x3f0647[_0x0240('0x4d')][_0x0240('0x56')]===_0x0240('0x50')){_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x59'),_0x30364b[_0x0240('0x5a')]));_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x5b'),_0x30364b['dataValues']));_0x3ed430['push'](get_open_tabs(_0x0240('0x5c'),_0x30364b[_0x0240('0x5a')]));_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x5d'),_0x30364b[_0x0240('0x5a')]));_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x63'),_0x30364b['dataValues']));_0x3ed430[_0x0240('0x53')](get_open_tabs('mail',_0x30364b[_0x0240('0x5a')]));return Promise[_0x0240('0x5e')](_0x3ed430);}else{return values;}})[_0x0240('0x24')](function(){return values;})[_0x0240('0x24')](respondWithResult(_0x213bff,null))[_0x0240('0x2e')](handleError(_0x213bff,null));};exports['update']=function(_0x338af6,_0x2747d6){if(_0x338af6[_0x0240('0x64')]['id']){delete _0x338af6[_0x0240('0x64')]['id'];}delete _0x338af6['body'][_0x0240('0x30')];return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x338af6['params']['id']}})['then'](handleEntityNotFound(_0x2747d6,null))[_0x0240('0x24')](saveUpdates(_0x338af6['body'],null))[_0x0240('0x24')](respondWithResult(_0x2747d6,null))[_0x0240('0x2e')](handleError(_0x2747d6,null));};exports['describe']=function(_0x1ff3b9,_0x5cf559){return db[_0x0240('0x54')][_0x0240('0x65')]()[_0x0240('0x24')](respondWithResult(_0x5cf559,null))[_0x0240('0x2e')](handleError(_0x5cf559,null));};exports[_0x0240('0x66')]=function(_0x3fc625,_0x3d9dd0){return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x3fc625[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x3d9dd0,null))[_0x0240('0x24')](function(_0x13588c){if(_0x13588c){return _0x13588c[_0x0240('0x66')](_0x3fc625[_0x0240('0x64')][_0x0240('0x67')],_[_0x0240('0x68')](_0x3fc625[_0x0240('0x64')],[_0x0240('0x67'),'id'])||{});}})[_0x0240('0x24')](respondWithResult(_0x3d9dd0,null))[_0x0240('0x2e')](handleError(_0x3d9dd0,null));};function validateUser(_0xf3a8d8){return new Promise(function(_0x5b88a6,_0x74f35d){if(_0xf3a8d8[_0x0240('0x69')])return _0x5b88a6(_0xf3a8d8);return db['Setting']['findById'](0x1)['then'](function(_0x206a20){if(_0x206a20['securePassword'])authService[_0x0240('0x6a')](_0xf3a8d8['password']);db['User'][_0x0240('0x6b')](_0x0240('0x69'))[_0x0240('0x24')](function(_0x46491f){if(_['isNil'](_0x46491f)){_0xf3a8d8['internal']=_0x206a20[_0x0240('0x6c')]||0x1;return;}if(_[_0x0240('0x6d')](_0x206a20[_0x0240('0x6c')])||_0x206a20['min_internal']===_0x46491f){_0xf3a8d8[_0x0240('0x69')]=_0x46491f+0x1;return;}if(_0x206a20[_0x0240('0x6c')]>_0x46491f){_0xf3a8d8[_0x0240('0x69')]=_0x206a20[_0x0240('0x6c')];return;}return db[_0x0240('0x6e')][_0x0240('0x4d')](_0x0240('0x6f'),{'type':db[_0x0240('0x6e')][_0x0240('0x70')][_0x0240('0x71')]})['then'](function(_0x55e0f4){if(_0x55e0f4&&_0x55e0f4[_0x0240('0x58')]){for(var _0x25e0f7=0x0,_0x532725=_0x55e0f4[_0x0240('0x58')];_0x25e0f7<_0x532725&&_[_0x0240('0x6d')](_0xf3a8d8[_0x0240('0x69')]);_0x25e0f7++){if(_0x206a20[_0x0240('0x6c')]<=_0x55e0f4[_0x25e0f7][_0x0240('0x72')]){_0xf3a8d8[_0x0240('0x69')]=_0x55e0f4[_0x25e0f7][_0x0240('0x72')];}else if(_0x206a20[_0x0240('0x6c')]>_0x55e0f4[_0x25e0f7][_0x0240('0x72')]&&_0x206a20[_0x0240('0x6c')]<=_0x55e0f4[_0x25e0f7]['to']){_0xf3a8d8[_0x0240('0x69')]=_0x206a20['min_internal'];}}}if(_[_0x0240('0x6d')](_0xf3a8d8[_0x0240('0x69')])){_0xf3a8d8[_0x0240('0x69')]=_0x46491f+0x1;}return _0x5b88a6(_0xf3a8d8);});});})[_0x0240('0x2e')](function(_0x577594){_0x74f35d(_0x577594);});});}function updateUser(_0x41a144){return new Promise(function(_0x3b8564,_0x4f4cc2){try{if(_0x41a144[_0x0240('0x73')]){_0x41a144[_0x0240('0x74')]=_0x41a144['internal'];_0x41a144[_0x0240('0x75')]={'mailbox':_0x41a144['internal'],'password':_0x41a144[_0x0240('0x76')],'fullname':_0x41a144['fullname'],'email':_0x41a144[_0x0240('0x77')]};}if(_0x41a144[_0x0240('0x30')]===_0x0240('0x36')){if(!_0x41a144[_0x0240('0x78')])_0x41a144[_0x0240('0x78')]=['101',_0x0240('0x79'),_0x0240('0x7a'),_0x0240('0x7b'),'110','104',_0x0240('0x7c'),_0x0240('0x7d'),'107',_0x0240('0x7e'),_0x0240('0x7f'),_0x0240('0x80'),_0x0240('0x81'),_0x0240('0x82'),'115'];}_0x3b8564(_0x41a144);}catch(_0x437e03){_0x4f4cc2(_0x437e03);}});}exports[_0x0240('0x83')]=function(_0x43ed4a,_0x4afdf5){if(_0x43ed4a[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x36'))throw new Error(_0x0240('0x84'));if(_0x43ed4a[_0x0240('0x64')]['role']===_0x0240('0x34')&&_0x43ed4a[_0x0240('0x34')]['role']!==_0x0240('0x85')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x43ed4a[_0x0240('0x64')]['role']===_0x0240('0x85')&&_0x43ed4a['user']['role']!=='admin'){throw new Error(_0x0240('0x86'));}return licenseUtil[_0x0240('0x87')]([_0x43ed4a[_0x0240('0x64')]])[_0x0240('0x24')](function(){return validateUser(_0x43ed4a['body']);})['then'](function(_0x97acac){return updateUser(_0x97acac)[_0x0240('0x24')](function(_0x40d744){if(_0x40d744['role']==='admin'){_0x40d744[_0x0240('0x88')]=_0x43ed4a[_0x0240('0x34')][_0x0240('0x88')];delete _0x40d744[_0x0240('0x89')];}return _0x40d744;});})[_0x0240('0x24')](function(_0x1dbdb3){return db['User'][_0x0240('0x83')](_0x1dbdb3,{'include':[{'model':db[_0x0240('0x75')],'as':_0x0240('0x75')}]});})['then'](function(_0x194e01){if(_0x43ed4a[_0x0240('0x64')]['role']===_0x0240('0x34'))return _0x194e01;if(_0x43ed4a[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x34'))return _0x194e01;return db['UserProfileSection'][_0x0240('0x3e')]({'where':{'name':_0x194e01[_0x0240('0x30')]==='agent'?_0x0240('0x35'):_0x0240('0x37'),'userProfileId':_0x43ed4a[_0x0240('0x34')][_0x0240('0x89')]},'raw':!![]})[_0x0240('0x24')](function(_0x566aaf){if(!_0x566aaf||_0x566aaf[_0x0240('0x8a')]!=0x0)return _0x194e01;return db[_0x0240('0x8b')][_0x0240('0x83')]({'name':_0x194e01[_0x0240('0x3f')],'resourceId':_0x194e01['id'],'type':_0x566aaf[_0x0240('0x3f')],'sectionId':_0x566aaf['id']},{})[_0x0240('0x24')](function(){return _0x194e01;});})[_0x0240('0x2e')](function(_0x3c1a3e){logger[_0x0240('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c1a3e);throw _0x3c1a3e;});})[_0x0240('0x24')](respondWithResult(_0x4afdf5,0xc9))[_0x0240('0x2e')](handleError(_0x4afdf5,null));};exports[_0x0240('0x8c')]=function(_0x4ec522,_0x30d6be){var _0xeed3a1=_0x4ec522[_0x0240('0x64')];var _0x18889b=[];if(_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x36'))throw new Error(_0x0240('0x84'));if(_[_0x0240('0x8d')](_0xeed3a1,[_0x0240('0x30'),'user'])&&_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x85')){throw new Error(_0x0240('0x8e'));}if(_[_0x0240('0x8d')](_0xeed3a1,[_0x0240('0x30'),_0x0240('0x85')])&&_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x85')){throw new Error(_0x0240('0x8f'));}return licenseUtil['checkUserLimits'](_0xeed3a1)[_0x0240('0x24')](function(){return validateUser(_0xeed3a1[0x0]);})[_0x0240('0x24')](function(){for(var _0x389909=0x1;_0x389909<_0xeed3a1[_0x0240('0x58')];_0x389909++){var _0x43dea7=_0xeed3a1[_0x389909-0x1][_0x0240('0x69')];if(!_0xeed3a1[_0x389909][_0x0240('0x69')])_0xeed3a1[_0x389909][_0x0240('0x69')]=_0x43dea7+0x1;_0x18889b[_0x0240('0x53')](validateUser(_0xeed3a1[_0x389909]));}return Promise['all'](_0x18889b);})['then'](function(){_0x18889b=[];for(var _0x4ac990=0x0;_0x4ac990<_0xeed3a1['length'];_0x4ac990++){_0x18889b[_0x0240('0x53')](updateUser(_0xeed3a1[_0x4ac990]));}return Promise[_0x0240('0x5e')](_0x18889b);})['then'](function(){_0x18889b=_0xeed3a1[_0x0240('0x3b')](function(_0x45cb03){return db[_0x0240('0x54')]['create'](_0x45cb03,{'include':[{'model':db[_0x0240('0x75')],'as':_0x0240('0x75')}]})[_0x0240('0x24')](function(_0x2e3820){_0x45cb03['id']=_0x2e3820['id'];return _0x45cb03;});});return Promise['all'](_0x18889b);})[_0x0240('0x24')](function(_0x2fd752){if(_0x4ec522[_0x0240('0x64')][_0x0240('0x30')]==='user')return _0x2fd752;if(_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x34'))return _0x2fd752;var _0x5d57fa=_['some'](_0x2fd752,function(_0x4ae3ec){return _0x4ae3ec[_0x0240('0x30')]===_0x0240('0x36')||_0x4ae3ec[_0x0240('0x30')]===_0x0240('0x38');});if(!_0x5d57fa)return _0x2fd752;return db[_0x0240('0x90')]['findAll']({'where':{'name':{'$or':[_0x0240('0x35'),'Telephones']},'userProfileId':_0x4ec522[_0x0240('0x34')][_0x0240('0x89')]},'raw':!![]})[_0x0240('0x24')](function(_0x3b0c48){if(_[_0x0240('0x91')](_0x3b0c48)||!_[_0x0240('0x8d')](_0x3b0c48,[_0x0240('0x8a'),0x0]))return _0x2fd752;_0x18889b=[];var _0x2c8a09=_(_0x3b0c48)['map'](function(_0x234152){if(_0x234152[_0x0240('0x8a')]===0x1)return;return _0x234152[_0x0240('0x3f')]==='Agents'?_0x0240('0x36'):_0x0240('0x38');})['compact']()[_0x0240('0x3c')]();for(var _0x4eedba=0x0;_0x4eedba<_0x2fd752['length'];_0x4eedba++){if(!_[_0x0240('0x3d')](_0x2c8a09,_0x2fd752[_0x4eedba]['role']))return;var _0x1f1234=_0x2fd752[_0x4eedba][_0x0240('0x30')]===_0x0240('0x36')?'Agents':_0x0240('0x37');_0x18889b[_0x0240('0x53')](db[_0x0240('0x8b')][_0x0240('0x83')]({'name':_0x2fd752[_0x4eedba][_0x0240('0x3f')],'resourceId':_0x2fd752[_0x4eedba]['id'],'type':_0x1f1234,'sectionId':_[_0x0240('0x3e')](_0x3b0c48,[_0x0240('0x3f'),_0x1f1234])['id']},{}));}return Promise['all'](_0x18889b);});})[_0x0240('0x24')](respondWithResult(_0x30d6be,0xc9))['catch'](handleError(_0x30d6be,null));};exports[_0x0240('0x92')]=function(_0xe30be3,_0x2a4b59){if(_0xe30be3[_0x0240('0x64')]['id']){delete _0xe30be3['body']['id'];}return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0xe30be3[_0x0240('0x60')]['id']}})[_0x0240('0x24')](function(_0x3ed96c){if(!_0x3ed96c)return null;if(_0x3ed96c['id']===_0xe30be3[_0x0240('0x34')]['id']){if(!_0xe30be3['body'][_0x0240('0x93')]||!_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3ed96c['authenticate'](_0xe30be3[_0x0240('0x64')][_0x0240('0x93')])){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x97'));}if(_0xe30be3[_0x0240('0x64')][_0x0240('0x93')]===_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x98'));}}else if(_0xe30be3[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x85')){if(!_0xe30be3['body'][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x99'));}}else if(_0xe30be3[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x34')){if(!_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))]['ValidationError'](_0x0240('0x99'));}if(_0x3ed96c['role']!==_0x0240('0x36')){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))]('Unauthorized');}}else{throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x84'));}return _0x3ed96c;})[_0x0240('0x24')](handleEntityNotFound(_0x2a4b59,null))[_0x0240('0x24')](function(_0x5d0fcb){return db['Setting']['findOne']({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x0240('0x24')](function(_0x38437c){if(_0x38437c['securePassword'])authService['validatePasswordPattern'](_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]);if(!_0x38437c[_0x0240('0x9a')]||!_0x5d0fcb[_0x0240('0x47')])return _0x5d0fcb;authService[_0x0240('0x9b')](_0xe30be3[_0x0240('0x64')]['newPassword'],_0x5d0fcb[_0x0240('0x47')],_0x38437c[_0x0240('0x9c')]);return _0x5d0fcb;})['then'](saveUpdates({'password':_0xe30be3[_0x0240('0x64')][_0x0240('0x94')],'passwordResetAt':_0xe30be3[_0x0240('0x34')]['id']==_0xe30be3['params']['id']?moment():null,'previousPasswords':authService[_0x0240('0x9d')](_0xe30be3[_0x0240('0x64')][_0x0240('0x94')],_0x5d0fcb[_0x0240('0x47')])},null));})['then'](respondWithResult(_0x2a4b59,null))[_0x0240('0x2e')](handleError(_0x2a4b59,null));};exports[_0x0240('0x9e')]=function(_0x4b0b25,_0xefb7e3){var _0x41aa5d=_0x4b0b25[_0x0240('0x64')]['channel'];return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x4b0b25[_0x0240('0x60')]['id']},'attributes':['id','name','role',_0x0240('0x9f'),'loginInPause',_0x0240('0xa0'),'interface']})[_0x0240('0x24')](handleEntityNotFound(_0xefb7e3,null))[_0x0240('0x24')](function(_0x4b089b){if(_0x4b089b){if(!utils[_0x0240('0xa1')](_0x41aa5d)){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xa2'));}return _0x4b089b[_0x0240('0xa3')+_[_0x0240('0xa4')](_0x41aa5d[_0x0240('0xa5')]())+'Queues'](_0x4b0b25[_0x0240('0x64')][_0x0240('0x67')],{'penalty':_0x4b0b25[_0x0240('0x64')][_0x0240('0xa6')]||0x0})[_0x0240('0xa7')](function(_0x285a52){for(var _0x1d8fdc=0x0;_0x1d8fdc<_0x4b0b25[_0x0240('0x64')][_0x0240('0x67')][_0x0240('0x58')];_0x1d8fdc+=0x1){var _0x2a2f72={'UserId':Number(_0x4b0b25[_0x0240('0x60')]['id'])};_0x2a2f72[_[_0x0240('0xa4')](_0x41aa5d[_0x0240('0xa5')]())+_0x0240('0xa8')]=Number(_0x4b0b25[_0x0240('0x64')][_0x0240('0x67')][_0x1d8fdc]);socket['emit'](_0x0240('0x34')+_[_0x0240('0xa4')](_0x41aa5d['toLowerCase']())+'Queue:save',_0x2a2f72);}return _0x285a52;})[_0x0240('0x24')](function(){if(_0x41aa5d==='voice'){return db[_0x0240('0xa9')][_0x0240('0x55')]({'where':{'id':_0x4b0b25[_0x0240('0x64')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x0240('0x24')](function(_0x3e22f6){var _0x2bba83=_0x4b089b[_0x0240('0xaa')]({'plain':!![]});var _0x190dd5=[];if(_0x41aa5d===_0x0240('0xab')&&_0x2bba83[_0x0240('0x30')]===_0x0240('0x36')&&_0x2bba83['online']){for(let _0x53578e=0x0;_0x53578e<_0x3e22f6['length'];_0x53578e+=0x1){_0x190dd5[_0x0240('0x53')]({'membername':_0x2bba83['name'],'UserId':_0x2bba83['id'],'queue_name':_0x3e22f6[_0x53578e][_0x0240('0x3f')],'VoiceQueueId':_0x3e22f6[_0x53578e]['id'],'interface':_['isNil'](_0x2bba83[_0x0240('0xac')])?util[_0x0240('0xad')](_0x0240('0xae'),_0x2bba83[_0x0240('0x3f')]):_0x2bba83[_0x0240('0xac')],'paused':_0x2bba83[_0x0240('0xa0')]||![],'penalty':_0x4b0b25[_0x0240('0x64')]['penalty']||0x0});}return Promise[_0x0240('0x5e')](_0x190dd5[_0x0240('0x3b')](function(_0x3b0e2b){return db[_0x0240('0xaf')]['upsert'](_0x3b0e2b);}));}return _0x4b089b;});}})['then'](respondWithStatusCode(_0xefb7e3,null))[_0x0240('0x2e')](handleError(_0xefb7e3,null));};exports[_0x0240('0xb0')]=function(_0x45cc17,_0x50ff98){var _0x56d179,_0x5431f7;return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x45cc17[_0x0240('0x60')]['id']},'attributes':['id','name','role']})[_0x0240('0x24')](handleEntityNotFound(_0x50ff98,null))['then'](function(_0xc75a13){if(_0xc75a13){_0x56d179=_0xc75a13;if(!_0x45cc17[_0x0240('0x4d')][_0x0240('0xb1')]||!utils[_0x0240('0xa1')](_0x45cc17['query'][_0x0240('0xb1')])){throw new db[(_0x0240('0x95'))]['ValidationError'](_0x0240('0xa2'));}return _0xc75a13[_0x0240('0xb2')+_[_0x0240('0xa4')](_0x45cc17['query'][_0x0240('0xb1')][_0x0240('0xa5')]())+'Queues'](_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')]);}})['then'](function(_0x44307a){if(_[_0x0240('0xb3')](_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')])){for(var _0x26cf75=0x0;_0x26cf75<_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')][_0x0240('0x58')];_0x26cf75+=0x1){_0x5431f7={'UserId':Number(_0x45cc17[_0x0240('0x60')]['id'])};_0x5431f7[_[_0x0240('0xa4')](_0x45cc17[_0x0240('0x4d')][_0x0240('0xb1')]['toLowerCase']())+_0x0240('0xa8')]=Number(_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')][_0x26cf75]);socket[_0x0240('0x31')](_0x0240('0x34')+_[_0x0240('0xa4')](_0x45cc17['query'][_0x0240('0xb1')]['toLowerCase']())+_0x0240('0xb4'),_0x5431f7);}}else{_0x5431f7={'UserId':Number(_0x45cc17[_0x0240('0x60')]['id'])};_0x5431f7[_[_0x0240('0xa4')](_0x45cc17['query'][_0x0240('0xb1')][_0x0240('0xa5')]())+'QueueId']=Number(_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')]);socket[_0x0240('0x31')](_0x0240('0x34')+_['capitalize'](_0x45cc17[_0x0240('0x4d')][_0x0240('0xb1')]['toLowerCase']())+_0x0240('0xb4'),_0x5431f7);}return _0x44307a;})[_0x0240('0x24')](function(){if(_0x45cc17[_0x0240('0x4d')]['channel']==='voice'){return db[_0x0240('0xaf')]['destroy']({'where':{'UserId':_0x45cc17[_0x0240('0x60')]['id'],'VoiceQueueId':_0x45cc17[_0x0240('0x4d')]['ids']},'individualHooks':!![]})['then'](function(){return _0x56d179;});}return _0x56d179;})[_0x0240('0x24')](respondWithStatusCode(_0x50ff98,null))[_0x0240('0x2e')](handleError(_0x50ff98,null));};exports[_0x0240('0xb5')]=function(_0x42b9a0,_0x4471bb){_0x42b9a0[_0x0240('0x64')][_0x0240('0xb6')]=_0x42b9a0['file'][_0x0240('0xb7')];return db['User']['find']({'where':{'id':_0x42b9a0[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x4471bb,null))[_0x0240('0x24')](saveUpdates(_0x42b9a0[_0x0240('0x64')],null))[_0x0240('0x24')](respondWithResult(_0x4471bb,null))['catch'](handleError(_0x4471bb,null));};exports[_0x0240('0xb8')]=function(_0x299ed1,_0x6fb277){var _0x92c9af=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x0240('0x54')]['find']({'where':{'id':_0x299ed1[_0x0240('0x60')]['id']},'attributes':['id',_0x0240('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x6fb277,null))[_0x0240('0x24')](function(_0x4e6e86){if(_0x4e6e86){if(_[_0x0240('0x6d')](_0x4e6e86[_0x0240('0xb6')])){return _0x6fb277['download'](_0x92c9af);}else{if(!fs[_0x0240('0xb9')](path[_0x0240('0xba')](config['root'],_0x0240('0xbb'),_0x4e6e86['userpic']))){return _0x6fb277[_0x0240('0xbc')](_0x92c9af);}return _0x6fb277[_0x0240('0xbc')](path['join'](config['root'],'server/files/images/',_0x4e6e86[_0x0240('0xb6')]));}}})[_0x0240('0x2e')](handleError(_0x6fb277,null));};exports['getOpenTabs']=function(_0x25b8a0,_0x2df38b){return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x25b8a0[_0x0240('0x60')]['id']},'attributes':['id']})[_0x0240('0x24')](handleEntityNotFound(_0x2df38b,null))[_0x0240('0x24')](function(_0x500260){var _0x413b94=[];values=_0x500260[_0x0240('0x5a')];_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x59'),_0x500260[_0x0240('0x5a')]));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x5b'),_0x500260['dataValues']));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x5c'),_0x500260[_0x0240('0x5a')]));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x5d'),_0x500260['dataValues']));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x63'),_0x500260[_0x0240('0x5a')]));_0x413b94[_0x0240('0x53')](get_open_tabs('mail',_0x500260[_0x0240('0x5a')]));return Promise[_0x0240('0x5e')](_0x413b94);})[_0x0240('0x24')](function(_0x31c3a6){if(_0x31c3a6){var _0x4eef67=_['map'](values[_0x0240('0xbd')],function(_0x162f84){return{'channel':_0x0240('0xbe'),'id':_0x162f84['id'],'createdAt':_0x162f84[_0x0240('0xbf')]};});var _0x189bf6=_[_0x0240('0x3b')](values[_0x0240('0xc0')],function(_0x2aa2a0){return{'channel':_0x0240('0xc1'),'id':_0x2aa2a0['id'],'createdAt':_0x2aa2a0['createdAt']};});var _0x46e07f=_[_0x0240('0x3b')](values[_0x0240('0xc2')],function(_0x907fa2){return{'channel':_0x0240('0xc3'),'id':_0x907fa2['id'],'createdAt':_0x907fa2['createdAt']};});var _0xac24df=_[_0x0240('0x3b')](values['MailOpenTabs'],function(_0x35b92a){return{'channel':_0x0240('0xc4'),'id':_0x35b92a['id'],'createdAt':_0x35b92a['createdAt']};});var _0x226e7e=_['map'](values[_0x0240('0xc5')],function(_0x20aa22){return{'channel':_0x0240('0xc6'),'id':_0x20aa22['id'],'createdAt':_0x20aa22[_0x0240('0xbf')]};});var _0x5427ea=_[_0x0240('0x3b')](values['WhatsappOpenTabs'],function(_0xfb7227){return{'channel':'WHATSAPP','id':_0xfb7227['id'],'createdAt':_0xfb7227[_0x0240('0xbf')]};});var _0x209835=_[_0x0240('0xc7')](_0x4eef67,_0x189bf6,_0x46e07f,_0xac24df,_0x226e7e,_0x5427ea);var _0x1f2946={'count':_0x209835[_0x0240('0x58')],'rows':_0x209835};return _0x1f2946;}else return null;})[_0x0240('0x24')](respondWithResult(_0x2df38b,null))['catch'](handleError(_0x2df38b,null));};exports[_0x0240('0xc8')]=function(_0x1ee741,_0x2a396d){var _0x5c6ff4={};return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x1ee741[_0x0240('0x60')]['id']}})[_0x0240('0x24')](function(_0x37e1ae){if(!_0x37e1ae){throw new APINotFoundError(util['format'](_0x0240('0xca'),_0x1ee741['params']['id']));}return contacts[_0x0240('0x65')]();})['then'](function(_0x20f8a8){_0x1ee741[_0x0240('0x4d')][_0x0240('0x54')]=_0x1ee741['params']['id'];_0x5c6ff4=qs['getOptions'](_0x20f8a8,_0x1ee741);if(_0x1ee741[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xcc'))){_0x5c6ff4['include']=[{'model':db['CmList'],'as':_0x0240('0xcd'),'required':![]},{'model':db[_0x0240('0xce')],'as':_0x0240('0xcf'),'attributes':['id','name',_0x0240('0xd0')],'where':_0x1ee741[_0x0240('0x4d')]['tag']?{'id':_0x1ee741[_0x0240('0x4d')][_0x0240('0xd1')]}:undefined,'required':_0x1ee741[_0x0240('0x4d')][_0x0240('0xd1')]?!![]:![]}];}return contacts['findAll'](_0x1ee741[_0x0240('0x4d')],_0x1ee741[_0x0240('0x34')],_0x5c6ff4,_0x20f8a8);})[_0x0240('0x24')](respondWithFilteredResult(_0x2a396d,_0x5c6ff4))[_0x0240('0x2e')](APIHandleError(_0x2a396d));};exports[_0x0240('0xd2')]=function(_0x1c7f07,_0x4963d3){var _0x5374f3;var _0xec5bab={};var _0x592e82;return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x1c7f07['params']['id']},'attributes':['id','name',_0x0240('0x30')]})['then'](handleEntityNotFound(_0x4963d3,null))[_0x0240('0x24')](function(_0x5cef0a){if(!utils[_0x0240('0xa1')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xb1')])){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xa2'));}_0x5374f3=_0x5cef0a;var _0x13161c={};_0x13161c['model']=_[_0x0240('0xd3')](db[_[_0x0240('0xa4')](_0x1c7f07['query'][_0x0240('0xb1')])+_0x0240('0xd4')][_0x0240('0x42')]);_0x13161c['query']=_[_0x0240('0xd3')](_0x1c7f07[_0x0240('0x4d')]);_0x13161c[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x13161c[_0x0240('0xd7')],_0x13161c[_0x0240('0x4d')]);_0xec5bab[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x13161c[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x1c7f07['query']['fields']));_0xec5bab['attributes']=_0xec5bab['attributes'][_0x0240('0x58')]?_0xec5bab[_0x0240('0x52')]:_0x13161c[_0x0240('0xd7')];_0xec5bab[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xda')]);_0xec5bab['where']=qs['filters'](_[_0x0240('0xdb')](_0x1c7f07[_0x0240('0x4d')],_0x13161c['filters']));if(_0x1c7f07[_0x0240('0x4d')][_0x0240('0x39')]){_0xec5bab['where']=_[_0x0240('0x61')](_0xec5bab['where'],{'$or':_[_0x0240('0x3b')](_0xec5bab[_0x0240('0x52')],function(_0xa5e5ef){var _0x3fafd8={};_0x3fafd8[_0xa5e5ef]={'$like':'%'+_0x1c7f07['query'][_0x0240('0x39')]+'%'};return _0x3fafd8;})});}_0xec5bab=_['merge']({},_0xec5bab,_0x1c7f07[_0x0240('0x62')]);switch(_0x5374f3[_0x0240('0x30')]){case _0x0240('0x85'):return db[_[_0x0240('0xa4')](_0x1c7f07[_0x0240('0x4d')]['channel'])+_0x0240('0xd4')][_0x0240('0x55')](_0xec5bab);case _0x0240('0x34'):case _0x0240('0x36'):return _0x5374f3['get'+_[_0x0240('0xa4')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xb1')])+_0x0240('0xdc')](_0xec5bab);default:throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xdd'));}})['then'](function(_0x2f8d11){_0x592e82=_0x2f8d11[_0x0240('0x58')];if(!_0x1c7f07['query']['hasOwnProperty'](_0x0240('0xde'))){_0xec5bab[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0x1f')]);_0xec5bab[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0x1d')]);}switch(_0x5374f3[_0x0240('0x30')]){case _0x0240('0x85'):return db[_[_0x0240('0xa4')](_0x1c7f07['query'][_0x0240('0xb1')])+_0x0240('0xd4')][_0x0240('0x55')](_0xec5bab);case _0x0240('0x34'):case _0x0240('0x36'):return _0x5374f3[_0x0240('0xaa')+_['capitalize'](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xb1')])+_0x0240('0xdc')](_0xec5bab);}})[_0x0240('0x24')](function(_0x42d8c4){return{'count':_0x592e82,'rows':_0x42d8c4};})[_0x0240('0x24')](respondWithResult(_0x4963d3,null))[_0x0240('0x2e')](handleError(_0x4963d3,null));};exports[_0x0240('0xdf')]=function(_0x102a2c,_0x313f49){var _0xe63399={};var _0x366eb7={};var _0x12f306;var _0x35924d;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x102a2c[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x313f49,null))[_0x0240('0x24')](function(_0x319b77){if(_0x319b77){_0x12f306=_0x319b77;_0x366eb7['model']=_['keys'](db[_0x0240('0xaf')][_0x0240('0x42')]);_0x366eb7[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x102a2c['query']);_0x366eb7[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x366eb7[_0x0240('0xd7')],_0x366eb7['query']);_0xe63399[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x366eb7['model'],qs[_0x0240('0xd8')](_0x102a2c[_0x0240('0x4d')][_0x0240('0xd8')]));_0xe63399['attributes']=_0xe63399[_0x0240('0x52')]['length']?_0xe63399[_0x0240('0x52')]:_0x366eb7[_0x0240('0xd7')];_0xe63399['order']=qs[_0x0240('0xda')](_0x102a2c[_0x0240('0x4d')][_0x0240('0xda')]);_0xe63399[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x102a2c[_0x0240('0x4d')],_0x366eb7[_0x0240('0xd5')]));if(_0x102a2c[_0x0240('0x4d')][_0x0240('0x39')]){_0xe63399[_0x0240('0xe0')]=_[_0x0240('0x61')](_0xe63399['where'],{'$or':_[_0x0240('0x3b')](_0xe63399[_0x0240('0x52')],function(_0x365fd4){var _0x31959c={};_0x31959c[_0x365fd4]={'$like':'%'+_0x102a2c[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x31959c;})});}_0xe63399=_['merge']({},_0xe63399,_0x102a2c[_0x0240('0x62')]);return _0x12f306['getVoiceQueuesRt'](_0xe63399);}})[_0x0240('0x24')](function(_0x4d87ef){if(_0x4d87ef){_0x35924d=_0x4d87ef[_0x0240('0x58')];if(!_0x102a2c['query']['hasOwnProperty'](_0x0240('0xde'))){_0xe63399['limit']=qs[_0x0240('0x1f')](_0x102a2c['query'][_0x0240('0x1f')]);_0xe63399[_0x0240('0x1d')]=qs['offset'](_0x102a2c[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x12f306[_0x0240('0xdf')](_0xe63399);}})[_0x0240('0x24')](function(_0x194058){if(_0x194058){return _0x194058?{'count':_0x35924d,'rows':_0x194058}:null;}})[_0x0240('0x24')](respondWithResult(_0x313f49,null))['catch'](handleError(_0x313f49,null));};exports['getGroups']=function(_0x53f870,_0x61e002){var _0x3023b4={};var _0x35833b={};var _0x2eca4e;var _0x36d5a2;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x53f870[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x61e002,null))[_0x0240('0x24')](function(_0x924ddc){if(_0x924ddc){_0x2eca4e=_0x924ddc;_0x35833b[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xe1')][_0x0240('0x42')]);_0x35833b[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x53f870[_0x0240('0x4d')]);_0x35833b[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x35833b[_0x0240('0xd7')],_0x35833b[_0x0240('0x4d')]);_0x3023b4[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x35833b[_0x0240('0xd7')],qs['fields'](_0x53f870[_0x0240('0x4d')][_0x0240('0xd8')]));_0x3023b4[_0x0240('0x52')]=_0x3023b4[_0x0240('0x52')][_0x0240('0x58')]?_0x3023b4[_0x0240('0x52')]:_0x35833b[_0x0240('0xd7')];_0x3023b4[_0x0240('0xd9')]=qs['sort'](_0x53f870[_0x0240('0x4d')][_0x0240('0xda')]);_0x3023b4[_0x0240('0xe0')]=qs['filters'](_['pick'](_0x53f870[_0x0240('0x4d')],_0x35833b[_0x0240('0xd5')]));if(_0x53f870['query'][_0x0240('0x39')]){_0x3023b4[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x3023b4[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x3023b4[_0x0240('0x52')],function(_0x4eacc5){var _0xb364a3={};_0xb364a3[_0x4eacc5]={'$like':'%'+_0x53f870[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0xb364a3;})});}_0x3023b4=_[_0x0240('0x61')]({},_0x3023b4,_0x53f870['options']);return _0x2eca4e[_0x0240('0xe2')](_0x3023b4);}})[_0x0240('0x24')](function(_0x5cff6a){if(_0x5cff6a){_0x36d5a2=_0x5cff6a['length'];if(!_0x53f870['query']['hasOwnProperty'](_0x0240('0xde'))){_0x3023b4[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x53f870[_0x0240('0x4d')][_0x0240('0x1f')]);_0x3023b4[_0x0240('0x1d')]=qs['offset'](_0x53f870[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x2eca4e[_0x0240('0xe2')](_0x3023b4);}})[_0x0240('0x24')](function(_0x5a9ec2){if(_0x5a9ec2){return _0x5a9ec2?{'count':_0x36d5a2,'rows':_0x5a9ec2}:null;}})[_0x0240('0x24')](respondWithResult(_0x61e002,null))['catch'](handleError(_0x61e002,null));};exports['getRecordings']=function(_0x464957,_0x4a5b53){var _0x551991={'raw':!![],'where':{}};var _0x25794a={};var _0x58ca12={'count':0x0,'rows':[]};return db['User'][_0x0240('0xc9')]({'where':{'id':_0x464957[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x4a5b53,null))[_0x0240('0x24')](function(_0x55b154){if(_0x55b154){_0x25794a[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xe3')][_0x0240('0x42')]);_0x25794a[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x464957[_0x0240('0x4d')]);_0x25794a[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x25794a[_0x0240('0xd7')],_0x25794a[_0x0240('0x4d')]);_0x551991['attributes']=_[_0x0240('0xd6')](_0x25794a['model'],qs[_0x0240('0xd8')](_0x464957['query']['fields']));_0x551991[_0x0240('0x52')]=_0x551991[_0x0240('0x52')][_0x0240('0x58')]?_0x551991[_0x0240('0x52')]:_0x25794a['model'];if(!_0x464957[_0x0240('0x4d')]['hasOwnProperty'](_0x0240('0xde'))){_0x551991[_0x0240('0x1f')]=qs['limit'](_0x464957[_0x0240('0x4d')][_0x0240('0x1f')]);_0x551991[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x464957['query']['offset']);}_0x551991[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x464957[_0x0240('0x4d')][_0x0240('0xda')]);_0x551991[_0x0240('0xe0')]=qs['filters'](_[_0x0240('0xdb')](_0x464957['query'],_0x25794a[_0x0240('0xd5')]));_0x551991['where'][_0x0240('0xe4')]=_0x55b154['id'];if(_0x464957[_0x0240('0x4d')][_0x0240('0x39')]){_0x551991['where']=_[_0x0240('0x61')](_0x551991[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x551991[_0x0240('0x52')],function(_0x584d48){var _0x2d996b={};_0x2d996b[_0x584d48]={'$like':'%'+_0x464957['query'][_0x0240('0x39')]+'%'};return _0x2d996b;})});}_0x551991=_[_0x0240('0x61')]({},_0x551991,_0x464957[_0x0240('0x62')]);return db[_0x0240('0xe3')][_0x0240('0x20')]({'where':_0x551991[_0x0240('0xe0')]})['then'](function(_0xd1f3f5){_0x58ca12['count']=_0xd1f3f5;if(_0x464957['query'][_0x0240('0xcc')]){_0x551991['include']=[{'all':!![]}];}return db[_0x0240('0xe3')][_0x0240('0x55')](_0x551991);})['then'](function(_0x2afbc5){_0x58ca12[_0x0240('0x57')]=_0x2afbc5;return _0x58ca12;});}})['then'](respondWithFilteredResult(_0x4a5b53,_0x551991))[_0x0240('0x2e')](handleError(_0x4a5b53,null));};exports[_0x0240('0xe5')]=function(_0x5b99d3,_0x147ba3){var _0xa6bb4={'raw':!![],'where':{}};var _0x11cf01={};var _0x493d9c={'count':0x0,'rows':[]};return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x5b99d3[_0x0240('0x60')]['id']}})['then'](handleEntityNotFound(_0x147ba3,null))['then'](function(_0x4bb6c0){if(_0x4bb6c0){_0x11cf01['model']=_['keys'](db[_0x0240('0xe6')][_0x0240('0x42')]);_0x11cf01[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x5b99d3[_0x0240('0x4d')]);_0x11cf01[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x11cf01[_0x0240('0xd7')],_0x11cf01['query']);_0xa6bb4[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x11cf01['model'],qs['fields'](_0x5b99d3['query'][_0x0240('0xd8')]));_0xa6bb4[_0x0240('0x52')]=_0xa6bb4['attributes'][_0x0240('0x58')]?_0xa6bb4[_0x0240('0x52')]:_0x11cf01['model'];if(!_0x5b99d3[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0xa6bb4[_0x0240('0x1f')]=qs['limit'](_0x5b99d3[_0x0240('0x4d')][_0x0240('0x1f')]);_0xa6bb4[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x5b99d3[_0x0240('0x4d')][_0x0240('0x1d')]);}_0xa6bb4[_0x0240('0xd9')]=qs['sort'](_0x5b99d3[_0x0240('0x4d')]['sort']);_0xa6bb4['where']=qs[_0x0240('0xd5')](_['pick'](_0x5b99d3['query'],_0x11cf01[_0x0240('0xd5')]));_0xa6bb4[_0x0240('0xe0')][_0x0240('0xe4')]=_0x4bb6c0['id'];if(_0x5b99d3[_0x0240('0x4d')][_0x0240('0x39')]){_0xa6bb4[_0x0240('0xe0')]=_['merge'](_0xa6bb4['where'],{'$or':_[_0x0240('0x3b')](_0xa6bb4['attributes'],function(_0x29dd22){var _0x8cbc39={};_0x8cbc39[_0x29dd22]={'$like':'%'+_0x5b99d3[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x8cbc39;})});}_0xa6bb4=_[_0x0240('0x61')]({},_0xa6bb4,_0x5b99d3[_0x0240('0x62')]);return db['ScreenRecording'][_0x0240('0x20')]({'where':_0xa6bb4[_0x0240('0xe0')]})['then'](function(_0x4c67ad){_0x493d9c[_0x0240('0x20')]=_0x4c67ad;if(_0x5b99d3['query']['includeAll']){_0xa6bb4['include']=[{'all':!![]}];}return db[_0x0240('0xe6')]['findAll'](_0xa6bb4);})['then'](function(_0x14a823){_0x493d9c['rows']=_0x14a823;return _0x493d9c;});}})[_0x0240('0x24')](respondWithFilteredResult(_0x147ba3,_0xa6bb4))[_0x0240('0x2e')](handleError(_0x147ba3,null));};exports[_0x0240('0xe7')]=function(_0x296714,_0x45acca){var _0x1b5aa2={};var _0x3f6c7b={};var _0x1d6da1;var _0x4b43d0;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x296714[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x45acca,null))['then'](function(_0x1da172){if(_0x1da172){_0x1d6da1=_0x1da172;_0x3f6c7b[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xe8')][_0x0240('0x42')]);_0x3f6c7b[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x296714[_0x0240('0x4d')]);_0x3f6c7b[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x3f6c7b['model'],_0x3f6c7b[_0x0240('0x4d')]);_0x1b5aa2[_0x0240('0x52')]=_['intersection'](_0x3f6c7b[_0x0240('0xd7')],qs['fields'](_0x296714[_0x0240('0x4d')][_0x0240('0xd8')]));_0x1b5aa2[_0x0240('0x52')]=_0x1b5aa2[_0x0240('0x52')][_0x0240('0x58')]?_0x1b5aa2['attributes']:_0x3f6c7b[_0x0240('0xd7')];_0x1b5aa2[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x296714[_0x0240('0x4d')]['sort']);_0x1b5aa2[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0x296714[_0x0240('0x4d')],_0x3f6c7b['filters']));if(_0x296714[_0x0240('0x4d')][_0x0240('0x39')]){_0x1b5aa2[_0x0240('0xe0')]=_['merge'](_0x1b5aa2[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x1b5aa2[_0x0240('0x52')],function(_0x34a86e){var _0x494c28={};_0x494c28[_0x34a86e]={'$like':'%'+_0x296714[_0x0240('0x4d')]['filter']+'%'};return _0x494c28;})});}_0x1b5aa2=_['merge']({},_0x1b5aa2,_0x296714[_0x0240('0x62')]);return _0x1d6da1[_0x0240('0xe7')](_0x1b5aa2);}})[_0x0240('0x24')](function(_0x441358){if(_0x441358){_0x4b43d0=_0x441358[_0x0240('0x58')];if(!_0x296714['query']['hasOwnProperty'](_0x0240('0xde'))){_0x1b5aa2['limit']=qs[_0x0240('0x1f')](_0x296714[_0x0240('0x4d')]['limit']);_0x1b5aa2[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x296714[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x1d6da1[_0x0240('0xe7')](_0x1b5aa2);}})[_0x0240('0x24')](function(_0x3724f0){if(_0x3724f0){return _0x3724f0?{'count':_0x4b43d0,'rows':_0x3724f0}:null;}})[_0x0240('0x24')](respondWithResult(_0x45acca,null))[_0x0240('0x2e')](handleError(_0x45acca,null));};exports[_0x0240('0xe9')]=function(_0x282a3c,_0x348165){var _0x54ad78={};var _0x4673e4={};var _0x393cc0;var _0x100f19;return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x282a3c[_0x0240('0x60')]['id']}})['then'](handleEntityNotFound(_0x348165,null))[_0x0240('0x24')](function(_0x4948e6){if(_0x4948e6){_0x393cc0=_0x4948e6;_0x4673e4['model']=_[_0x0240('0xd3')](db[_0x0240('0xea')]['rawAttributes']);_0x4673e4[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x282a3c[_0x0240('0x4d')]);_0x4673e4[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x4673e4['model'],_0x4673e4['query']);_0x54ad78['attributes']=_[_0x0240('0xd6')](_0x4673e4['model'],qs[_0x0240('0xd8')](_0x282a3c['query']['fields']));_0x54ad78[_0x0240('0x52')]=_0x54ad78['attributes'][_0x0240('0x58')]?_0x54ad78[_0x0240('0x52')]:_0x4673e4[_0x0240('0xd7')];_0x54ad78[_0x0240('0xd9')]=qs['sort'](_0x282a3c[_0x0240('0x4d')]['sort']);_0x54ad78[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x282a3c[_0x0240('0x4d')],_0x4673e4[_0x0240('0xd5')]));if(_0x282a3c[_0x0240('0x4d')][_0x0240('0x39')]){_0x54ad78[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x54ad78['where'],{'$or':_['map'](_0x54ad78[_0x0240('0x52')],function(_0x3d4f04){var _0x1ab3ca={};_0x1ab3ca[_0x3d4f04]={'$like':'%'+_0x282a3c['query']['filter']+'%'};return _0x1ab3ca;})});}_0x54ad78=_['merge']({},_0x54ad78,_0x282a3c[_0x0240('0x62')]);return _0x393cc0[_0x0240('0xe9')](_0x54ad78);}})[_0x0240('0x24')](function(_0x2b8d17){if(_0x2b8d17){_0x100f19=_0x2b8d17[_0x0240('0x58')];if(!_0x282a3c[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x54ad78['limit']=qs[_0x0240('0x1f')](_0x282a3c[_0x0240('0x4d')][_0x0240('0x1f')]);_0x54ad78['offset']=qs['offset'](_0x282a3c['query']['offset']);}return _0x393cc0['getOpenchannelInteractions'](_0x54ad78);}})['then'](function(_0x40ceb6){if(_0x40ceb6){return _0x40ceb6?{'count':_0x100f19,'rows':_0x40ceb6}:null;}})[_0x0240('0x24')](respondWithResult(_0x348165,null))[_0x0240('0x2e')](handleError(_0x348165,null));};exports['getMailInteractions']=function(_0x402b69,_0x445b2f){var _0xb6756d={'raw':!![],'where':{}};var _0x5ed859={};var _0xb92850={'count':0x0,'rows':[]};return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x402b69['params']['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x445b2f,null))[_0x0240('0x24')](function(_0x52cca6){if(_0x52cca6){_0x5ed859[_0x0240('0xd7')]=_['keys'](db[_0x0240('0xeb')][_0x0240('0x42')]);_0x5ed859[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x402b69['query']);_0x5ed859['filters']=_[_0x0240('0xd6')](_0x5ed859[_0x0240('0xd7')],_0x5ed859[_0x0240('0x4d')]);_0xb6756d[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x5ed859[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x402b69[_0x0240('0x4d')][_0x0240('0xd8')]));_0xb6756d[_0x0240('0x52')]=_0xb6756d['attributes'][_0x0240('0x58')]?_0xb6756d[_0x0240('0x52')]:_0x5ed859[_0x0240('0xd7')];if(!_0x402b69[_0x0240('0x4d')][_0x0240('0xcb')]('nolimit')){_0xb6756d[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x402b69[_0x0240('0x4d')]['limit']);_0xb6756d[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x402b69[_0x0240('0x4d')][_0x0240('0x1d')]);}_0xb6756d[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x402b69[_0x0240('0x4d')][_0x0240('0xda')]);_0xb6756d[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0x402b69[_0x0240('0x4d')],_0x5ed859['filters']));_0xb6756d[_0x0240('0xe0')]['UserId']=_0x52cca6['id'];if(_0x402b69['query'][_0x0240('0x39')]){_0xb6756d[_0x0240('0xe0')]=_[_0x0240('0x61')](_0xb6756d[_0x0240('0xe0')],{'$or':_['map'](_0xb6756d['attributes'],function(_0x342574){var _0x3f696f={};_0x3f696f[_0x342574]={'$like':'%'+_0x402b69['query'][_0x0240('0x39')]+'%'};return _0x3f696f;})});}_0xb6756d=_['merge']({},_0xb6756d,_0x402b69[_0x0240('0x62')]);return db[_0x0240('0xeb')][_0x0240('0x20')]({'where':_0xb6756d[_0x0240('0xe0')]})['then'](function(_0x4a6006){_0xb92850[_0x0240('0x20')]=_0x4a6006;if(_0x402b69[_0x0240('0x4d')][_0x0240('0xcc')]){_0xb6756d[_0x0240('0x4e')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0xb6756d);})['then'](function(_0xfd4568){_0xb92850[_0x0240('0x57')]=_0xfd4568;return _0xb92850;});}})[_0x0240('0x24')](respondWithFilteredResult(_0x445b2f,_0xb6756d))[_0x0240('0x2e')](handleError(_0x445b2f,null));};exports[_0x0240('0xec')]=function(_0x329003,_0x4b090d){var _0x19ebf2={};var _0x444f11={};var _0x28ff70;var _0xf45056;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x329003[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x4b090d,null))[_0x0240('0x24')](function(_0x1fe430){if(_0x1fe430){_0x28ff70=_0x1fe430;_0x444f11['model']=_[_0x0240('0xd3')](db[_0x0240('0xed')][_0x0240('0x42')]);_0x444f11[_0x0240('0x4d')]=_['keys'](_0x329003[_0x0240('0x4d')]);_0x444f11[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x444f11[_0x0240('0xd7')],_0x444f11[_0x0240('0x4d')]);_0x19ebf2[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x444f11[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x329003[_0x0240('0x4d')][_0x0240('0xd8')]));_0x19ebf2['attributes']=_0x19ebf2[_0x0240('0x52')][_0x0240('0x58')]?_0x19ebf2[_0x0240('0x52')]:_0x444f11[_0x0240('0xd7')];_0x19ebf2[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x329003[_0x0240('0x4d')][_0x0240('0xda')]);_0x19ebf2[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x329003['query'],_0x444f11['filters']));if(_0x329003[_0x0240('0x4d')][_0x0240('0x39')]){_0x19ebf2['where']=_[_0x0240('0x61')](_0x19ebf2[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x19ebf2['attributes'],function(_0x2c4a01){var _0x48c6fa={};_0x48c6fa[_0x2c4a01]={'$like':'%'+_0x329003[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x48c6fa;})});}_0x19ebf2=_['merge']({},_0x19ebf2,_0x329003[_0x0240('0x62')]);return _0x28ff70[_0x0240('0xec')](_0x19ebf2);}})[_0x0240('0x24')](function(_0x3a2016){if(_0x3a2016){_0xf45056=_0x3a2016[_0x0240('0x58')];if(!_0x329003[_0x0240('0x4d')]['hasOwnProperty'](_0x0240('0xde'))){_0x19ebf2['limit']=qs[_0x0240('0x1f')](_0x329003[_0x0240('0x4d')][_0x0240('0x1f')]);_0x19ebf2[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x329003[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x28ff70['getSmsInteractions'](_0x19ebf2);}})[_0x0240('0x24')](function(_0x2918e0){if(_0x2918e0){return _0x2918e0?{'count':_0xf45056,'rows':_0x2918e0}:null;}})[_0x0240('0x24')](respondWithResult(_0x4b090d,null))['catch'](handleError(_0x4b090d,null));};exports['getFaxInteractions']=function(_0x3d8ec7,_0x107c2a){var _0x230f19={};var _0x12ad08={};var _0x57ea7b;var _0x50732e;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x3d8ec7[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x107c2a,null))[_0x0240('0x24')](function(_0x5d31d9){if(_0x5d31d9){_0x57ea7b=_0x5d31d9;_0x12ad08[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xee')][_0x0240('0x42')]);_0x12ad08[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x3d8ec7[_0x0240('0x4d')]);_0x12ad08[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x12ad08[_0x0240('0xd7')],_0x12ad08[_0x0240('0x4d')]);_0x230f19[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x12ad08['model'],qs[_0x0240('0xd8')](_0x3d8ec7['query'][_0x0240('0xd8')]));_0x230f19['attributes']=_0x230f19[_0x0240('0x52')]['length']?_0x230f19[_0x0240('0x52')]:_0x12ad08['model'];_0x230f19[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x3d8ec7['query'][_0x0240('0xda')]);_0x230f19[_0x0240('0xe0')]=qs['filters'](_[_0x0240('0xdb')](_0x3d8ec7[_0x0240('0x4d')],_0x12ad08[_0x0240('0xd5')]));if(_0x3d8ec7['query'][_0x0240('0x39')]){_0x230f19[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x230f19[_0x0240('0xe0')],{'$or':_['map'](_0x230f19['attributes'],function(_0x562fe4){var _0x23d5be={};_0x23d5be[_0x562fe4]={'$like':'%'+_0x3d8ec7[_0x0240('0x4d')]['filter']+'%'};return _0x23d5be;})});}_0x230f19=_['merge']({},_0x230f19,_0x3d8ec7['options']);return _0x57ea7b[_0x0240('0xef')](_0x230f19);}})[_0x0240('0x24')](function(_0x4f9d41){if(_0x4f9d41){_0x50732e=_0x4f9d41[_0x0240('0x58')];if(!_0x3d8ec7[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x230f19[_0x0240('0x1f')]=qs['limit'](_0x3d8ec7[_0x0240('0x4d')][_0x0240('0x1f')]);_0x230f19[_0x0240('0x1d')]=qs['offset'](_0x3d8ec7['query'][_0x0240('0x1d')]);}return _0x57ea7b['getFaxInteractions'](_0x230f19);}})[_0x0240('0x24')](function(_0x44caae){if(_0x44caae){return _0x44caae?{'count':_0x50732e,'rows':_0x44caae}:null;}})['then'](respondWithResult(_0x107c2a,null))['catch'](handleError(_0x107c2a,null));};exports[_0x0240('0xf0')]=function(_0x160e7d,_0x3cc53c){var _0x2ce749={};var _0x397257={};var _0x56bca5;var _0x4624f7;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x160e7d[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x3cc53c,null))[_0x0240('0x24')](function(_0x391c3d){if(_0x391c3d){_0x56bca5=_0x391c3d;_0x397257[_0x0240('0xd7')]=_['keys'](db[_0x0240('0xf1')]['rawAttributes']);_0x397257[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x160e7d[_0x0240('0x4d')]);_0x397257[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x397257['model'],_0x397257[_0x0240('0x4d')]);_0x2ce749[_0x0240('0x52')]=_['intersection'](_0x397257[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x160e7d[_0x0240('0x4d')]['fields']));_0x2ce749[_0x0240('0x52')]=_0x2ce749[_0x0240('0x52')][_0x0240('0x58')]?_0x2ce749[_0x0240('0x52')]:_0x397257['model'];_0x2ce749[_0x0240('0xd9')]=qs['sort'](_0x160e7d[_0x0240('0x4d')][_0x0240('0xda')]);_0x2ce749[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x160e7d[_0x0240('0x4d')],_0x397257[_0x0240('0xd5')]));if(_0x160e7d[_0x0240('0x4d')]['filter']){_0x2ce749[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x2ce749['where'],{'$or':_[_0x0240('0x3b')](_0x2ce749[_0x0240('0x52')],function(_0x5718fa){var _0x1e7869={};_0x1e7869[_0x5718fa]={'$like':'%'+_0x160e7d['query'][_0x0240('0x39')]+'%'};return _0x1e7869;})});}_0x2ce749=_[_0x0240('0x61')]({},_0x2ce749,_0x160e7d['options']);return _0x56bca5[_0x0240('0xf0')](_0x2ce749);}})[_0x0240('0x24')](function(_0x59e5e0){if(_0x59e5e0){_0x4624f7=_0x59e5e0['length'];if(!_0x160e7d[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x2ce749[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x160e7d['query'][_0x0240('0x1f')]);_0x2ce749[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x160e7d[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x56bca5['getWhatsappInteractions'](_0x2ce749);}})[_0x0240('0x24')](function(_0x508210){if(_0x508210){return _0x508210?{'count':_0x4624f7,'rows':_0x508210}:null;}})[_0x0240('0x24')](respondWithResult(_0x3cc53c,null))[_0x0240('0x2e')](handleError(_0x3cc53c,null));};exports[_0x0240('0xf2')]=function(_0x433f1c,_0x354a38,_0x119706){var _0x46e33c;var _0xe399dd;var _0x5b518b;var _0x3ad831=!_[_0x0240('0x6d')](_0x433f1c[_0x0240('0x60')]['id'])?_0x433f1c[_0x0240('0x60')]['id']:!_[_0x0240('0x6d')](_0x433f1c['user']['id'])?_0x433f1c[_0x0240('0x34')]['id']:null;return db['User']['find']({'where':{'id':_0x3ad831,'role':{'$or':[_0x0240('0x85'),_0x0240('0x34'),_0x0240('0x36')]}},'attributes':['id','name','phone',_0x0240('0xf3'),_0x0240('0x30'),_0x0240('0x69'),_0x0240('0xf4')]})[_0x0240('0x24')](function(_0x4ce4a1){if(_0x4ce4a1){if(_0x4ce4a1[_0x0240('0x30')]===_0x0240('0x36')){_0x46e33c=_0x4ce4a1;if(_0x433f1c[_0x0240('0x64')][_0x0240('0xac')]){_0x5b518b=util[_0x0240('0xad')](_0x0240('0xf5'),_0x46e33c[_0x433f1c[_0x0240('0x64')]['interface']]);}else if(_0x433f1c[_0x0240('0x64')][_0x0240('0xf6')]){_0x5b518b=util[_0x0240('0xad')]('SIP/%s',_0x433f1c[_0x0240('0x64')][_0x0240('0xf6')]);}else{_0x5b518b=util[_0x0240('0xad')](_0x0240('0xae'),_0x46e33c[_0x0240('0x3f')]);}socket['to'](util[_0x0240('0xad')](_0x0240('0xf7'),_0x46e33c['name']))[_0x0240('0x31')]('user:forcelogout',{'user':{'id':_0x46e33c['id'],'name':_0x46e33c[_0x0240('0x3f')]},'ip':_0x433f1c[_0x0240('0xf8')]['x-forwarded-for']||_0x433f1c[_0x0240('0xf9')][_0x0240('0xfa')]||_0x433f1c['socket'][_0x0240('0xfa')]||_0x433f1c['connection'][_0x0240('0xfb')][_0x0240('0xfa')]});return new Promise(function(_0xb35698,_0x3f28f5){db[_0x0240('0x6e')][_0x0240('0xfc')]()[_0x0240('0x24')](_0x157912=>{db[_0x0240('0xaf')][_0x0240('0x32')]({'where':{'membername':_0x46e33c[_0x0240('0x3f')]},'individualHooks':!![]},{'transaction':_0x157912})[_0x0240('0x24')](function(){return _0x157912[_0x0240('0xfd')]();})['then'](_0xb35698)[_0x0240('0x2e')](_0x3f28f5);});});}}else{throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xfe'));}})[_0x0240('0x24')](function(){if(_0x46e33c){return _0x46e33c[_0x0240('0xff')]({'raw':!![]});}})[_0x0240('0x24')](function(_0x291f92){if(_0x46e33c){if(_0x291f92){_0xe399dd=_0x291f92;if(_0xe399dd['length']){var _0x48394d=_0xe399dd['map'](function(_0x2cdbd8){return{'membername':_0x46e33c[_0x0240('0x3f')],'UserId':_0x46e33c['id'],'queue_name':_0x2cdbd8['name'],'VoiceQueueId':_0x2cdbd8['id'],'interface':_0x5b518b,'paused':_0x46e33c[_0x0240('0xf4')]||![],'penalty':_0x2cdbd8['UserVoiceQueue.penalty']||0x0};});return db[_0x0240('0xaf')]['bulkCreate'](_0x48394d);}}}})['then'](function(){if(_0x46e33c){return db[_0x0240('0x100')][_0x0240('0x55')]({'where':{'membername':_0x46e33c[_0x0240('0x3f')],'exitAt':null}});}})[_0x0240('0x24')](function(_0x1e7d5b){if(_0x46e33c){var _0x2a32b4=[];_0x1e7d5b[_0x0240('0x101')](function(_0x45816d){_0x2a32b4[_0x0240('0x53')](_0x45816d[_0x0240('0x2f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x0240('0x5e')](_0x2a32b4);}})['then'](function(){if(_0x46e33c){var _0x289cb5=[];var _0x4b7d0f=[];var _0x686c38=utils[_0x0240('0x102')]();var _0x280d44={'membername':_0x46e33c['name'],'interface':_0x5b518b,'enterAt':moment()[_0x0240('0xad')](_0x0240('0x103')),'role':_0x46e33c['role'],'internal':_0x46e33c[_0x0240('0x69')]};_0x686c38[_0x0240('0x101')](function(_0x1299d8){_0x289cb5[_0x0240('0x53')](_['merge']({'channel':_0x1299d8,'type':_0x0240('0x104'),'data1':_0x433f1c[_0x0240('0x64')]['device'],'data2':_0x5b518b},_0x280d44));if(_0x46e33c[_0x0240('0xf4')]){_0x4b7d0f[_0x0240('0x53')](_[_0x0240('0x61')]({'channel':_0x1299d8,'type':_0x0240('0x105'),'data1':_0x0240('0x106')},_0x280d44));}});return db[_0x0240('0x100')][_0x0240('0x8c')](_0x289cb5['concat'](_0x4b7d0f),{'individualHooks':!![]});}})[_0x0240('0x24')](function(){if(_0x46e33c){return _0x46e33c[_0x0240('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x0240('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x46e33c[_0x0240('0xf4')]||![],'mailPause':_0x46e33c['loginInPause']||![],'chatPause':_0x46e33c[_0x0240('0xf4')]||![],'faxPause':_0x46e33c[_0x0240('0xf4')]||![],'smsPause':_0x46e33c['loginInPause']||![],'openchannelPause':_0x46e33c['loginInPause']||![],'whatsappPause':_0x46e33c['loginInPause']||![],'pauseType':_0x46e33c[_0x0240('0xf4')]?'LOGININPAUSE':null,'interface':_0x5b518b,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0240('0x24')](function(_0x14b71d){if(_0x433f1c[_0x0240('0x107')]){return _0x119706();}else{return Promise['resolve'](_0x14b71d)['then'](respondWithResult(_0x354a38,null));}})['catch'](handleError(_0x354a38,null));};exports['logout']=function(_0x591217,_0x2b3a31){var _0x52215f;return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x591217[_0x0240('0x60')]['id'],'role':'agent'},'attributes':['id',_0x0240('0x3f'),_0x0240('0x30')]})[_0x0240('0x24')](handleEntityNotFound(_0x2b3a31,null))['then'](function(_0x551060){if(_0x551060){_0x52215f=_0x551060;return db['UserVoiceQueueRt'][_0x0240('0x32')]({'where':{'membername':_0x52215f['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x0240('0x100')][_0x0240('0x55')]({'where':{'membername':_0x52215f[_0x0240('0x3f')],'exitAt':null}});})[_0x0240('0x24')](function(_0x5f04ab){var _0x38a873=[];_0x5f04ab[_0x0240('0x101')](function(_0x128834){_0x38a873[_0x0240('0x53')](_0x128834[_0x0240('0x2f')]({'exitAt':moment()[_0x0240('0xad')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x0240('0x5e')](_0x38a873);})[_0x0240('0x24')](function(){return _0x52215f[_0x0240('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0240('0x24')](respondWithResult(_0x2b3a31,null))[_0x0240('0x2e')](handleError(_0x2b3a31,null));};exports[_0x0240('0x108')]=function(_0x5867bc,_0x1a4038){var _0x401182;return db[_0x0240('0xaf')]['update']({'paused':0x1},{'where':{'UserId':_0x5867bc[_0x0240('0x60')]['id']},'individualHooks':!![]})[_0x0240('0x24')](function(){return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x5867bc[_0x0240('0x60')]['id'],'role':'agent'},'attributes':['id',_0x0240('0x3f'),_0x0240('0x30'),_0x0240('0x69'),_0x0240('0xac'),_0x0240('0x9f')]});})['then'](handleEntityNotFound(_0x1a4038,null))[_0x0240('0x24')](function(_0xfdb3dc){if(_0xfdb3dc){_0x401182=_0xfdb3dc;return respondWithRpcPromise('QueuePause',_0x0240('0x108'),{'id':_0x401182['id'],'name':_0x401182[_0x0240('0x3f')],'pause':!![]});}})[_0x0240('0x24')](function(){if(_0x401182){return db[_0x0240('0x100')][_0x0240('0x55')]({'where':{'membername':_0x401182[_0x0240('0x3f')],'type':_0x0240('0x105'),'exitAt':null}});}})['then'](function(_0x1733a5){if(_0x1733a5[_0x0240('0x58')]){var _0x391592=moment()[_0x0240('0xad')](_0x0240('0x103'));for(var _0xe8feed=0x0,_0x3d45a8=_0x1733a5[_0x0240('0x58')];_0xe8feed<_0x3d45a8;_0xe8feed++){_0x1733a5[_0xe8feed][_0x0240('0x109')]({'exitAt':_0x391592});}}})[_0x0240('0x24')](function(){var _0x33f227=[];var _0x406994=utils[_0x0240('0x102')]();_0x406994[_0x0240('0x101')](function(_0x3bf481){_0x33f227[_0x0240('0x53')]({'channel':_0x3bf481,'membername':_0x401182[_0x0240('0x3f')],'interface':_[_0x0240('0x6d')](_0x401182[_0x0240('0xac')])?util[_0x0240('0xad')](_0x0240('0xae'),_0x401182[_0x0240('0x3f')]):_0x401182['interface'],'type':_0x0240('0x105'),'enterAt':moment()[_0x0240('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5867bc['body'][_0x0240('0x44')]||'DEFAULT\x20PAUSE','role':_0x401182[_0x0240('0x30')],'internal':_0x401182[_0x0240('0x69')]});});return db[_0x0240('0x100')][_0x0240('0x8c')](_0x33f227,{'individualHooks':!![]});})['then'](function(){return _0x401182['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5867bc[_0x0240('0x64')][_0x0240('0x44')]||_0x0240('0x10a'),'lastPauseAt':moment()['format'](_0x0240('0x103'))});})[_0x0240('0x24')](respondWithResult(_0x1a4038,null))[_0x0240('0x2e')](handleError(_0x1a4038,null));};exports['unpause']=function(_0x217bee,_0x22e03e){if(_0x217bee['body'][_0x0240('0xb1')]&&!utils[_0x0240('0xa1')](_0x217bee[_0x0240('0x64')]['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x217bee['body'][_0x0240('0xb1')]));}return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x217bee[_0x0240('0x60')]['id']},'attributes':['id',_0x0240('0x3f'),_0x0240('0x30'),_0x0240('0x69'),'interface','online','voicePause','mailPause','chatPause',_0x0240('0x10b'),'openchannelPause',_0x0240('0x10c'),_0x0240('0x10d'),_0x0240('0x10e'),_0x0240('0x10f')]})[_0x0240('0x24')](function(_0x558112){if(!_0x558112){throw new APINotFoundError(util[_0x0240('0xad')](_0x0240('0xca'),_0x217bee['params']['id']));}return _0x558112[_0x0240('0x110')](_0x217bee[_0x0240('0x64')][_0x0240('0xb1')]);})['then'](respondWithResult(_0x22e03e,null))[_0x0240('0x2e')](APIHandleError(_0x22e03e));};exports[_0x0240('0x111')]=function(_0x2e3781,_0x3f03cd){var _0x5ba690={};var _0x25c700={};var _0x214761;var _0x3b0930;return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x2e3781[_0x0240('0x60')]['id']}})['then'](handleEntityNotFound(_0x3f03cd,null))[_0x0240('0x24')](function(_0xb05b9f){if(_0xb05b9f){_0x214761=_0xb05b9f;_0x25c700[_0x0240('0xd7')]=_[_0x0240('0xd3')](db['Team'][_0x0240('0x42')]);_0x25c700[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x2e3781[_0x0240('0x4d')]);_0x25c700[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x25c700[_0x0240('0xd7')],_0x25c700[_0x0240('0x4d')]);_0x5ba690[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x25c700[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x2e3781['query'][_0x0240('0xd8')]));_0x5ba690[_0x0240('0x52')]=_0x5ba690[_0x0240('0x52')][_0x0240('0x58')]?_0x5ba690[_0x0240('0x52')]:_0x25c700[_0x0240('0xd7')];_0x5ba690[_0x0240('0xd9')]=qs['sort'](_0x2e3781['query'][_0x0240('0xda')]);_0x5ba690[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0x2e3781[_0x0240('0x4d')],_0x25c700[_0x0240('0xd5')]));if(_0x2e3781['query'][_0x0240('0x39')]){_0x5ba690[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x5ba690[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x5ba690['attributes'],function(_0x3e9765){var _0x141ae4={};_0x141ae4[_0x3e9765]={'$like':'%'+_0x2e3781['query'][_0x0240('0x39')]+'%'};return _0x141ae4;})});}_0x5ba690=_[_0x0240('0x61')]({},_0x5ba690,_0x2e3781['options']);return _0x214761[_0x0240('0x111')](_0x5ba690);}})['then'](function(_0x5c14a5){if(_0x5c14a5){_0x3b0930=_0x5c14a5[_0x0240('0x58')];if(!_0x2e3781[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x5ba690[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x2e3781[_0x0240('0x4d')]['limit']);_0x5ba690['offset']=qs[_0x0240('0x1d')](_0x2e3781['query'][_0x0240('0x1d')]);}return _0x214761[_0x0240('0x111')](_0x5ba690);}})[_0x0240('0x24')](function(_0x5df71a){if(_0x5df71a){return _0x5df71a?{'count':_0x3b0930,'rows':_0x5df71a}:null;}})[_0x0240('0x24')](respondWithResult(_0x3f03cd,null))['catch'](handleError(_0x3f03cd,null));};exports['addTeams']=function(_0x814317,_0x27067a){var _0x43b514=_0x814317[_0x0240('0x60')]['id'];var _0x309ae3=_0x814317[_0x0240('0x64')]?_0x814317[_0x0240('0x64')][_0x0240('0x67')]:null;var _0x5bce5f=[];return Promise[_0x0240('0x112')]()[_0x0240('0x24')](function(){if(!_0x309ae3)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x0240('0x24')](function(){return db['User'][_0x0240('0xc9')]({'where':{'id':_0x43b514}});})[_0x0240('0x24')](function(_0x33159c){if(!_0x33159c)throw new APINotFoundError(util[_0x0240('0xad')]('User\x20with\x20id\x20%s\x20not\x20found',_0x814317['params']['id']));return db[_0x0240('0x6e')][_0x0240('0xfc')](function(_0x30b895){return _0x33159c['addTeams'](_0x309ae3,{'transaction':_0x30b895})[_0x0240('0x24')](function(){return db[_0x0240('0x113')][_0x0240('0x55')]({'where':{'id':{'$in':_0x309ae3}}});})[_0x0240('0x24')](function(_0x57b1ac){var _0x735c56=_[_0x0240('0x3b')](_0x57b1ac,function(_0x1ec98b){return _0x1ec98b['getAssociatedQueues']();});return Promise[_0x0240('0x5e')](_0x735c56);})[_0x0240('0x24')](function(_0x23776c){_0x5bce5f=_['flattenDeep'](_0x23776c);var _0x22393c=_['map'](_0x5bce5f,function(_0x566e5e){return _0x566e5e[_0x0240('0x114')](_0x33159c['id'],{'transaction':_0x30b895});});return Promise['all'](_0x22393c);})[_0x0240('0x24')](function(){if(!_0x33159c[_0x0240('0x9f')])return;var _0x416768=_[_0x0240('0x39')](_0x5bce5f,function(_0x2eb4fc){return _0x2eb4fc[_0x0240('0x115')](_0x0240('0xb1'))===_0x0240('0x116');});var _0x3f3d15=_[_0x0240('0x3b')](_0x416768,function(_0x58b65a){return db[_0x0240('0xaf')]['upsert']({'membername':_0x33159c[_0x0240('0x3f')],'UserId':_0x33159c['id'],'queue_name':_0x58b65a[_0x0240('0x3f')],'VoiceQueueId':_0x58b65a['id'],'interface':_[_0x0240('0x6d')](_0x33159c['interface'])?util[_0x0240('0xad')](_0x0240('0xae'),_0x33159c[_0x0240('0x3f')]):_0x33159c[_0x0240('0xac')],'paused':_0x33159c[_0x0240('0xa0')]||![],'penalty':_0x33159c[_0x0240('0xa6')]},{'transaction':_0x30b895});});return Promise[_0x0240('0x5e')](_0x3f3d15);})[_0x0240('0x24')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x309ae3}}});})['then'](function(_0x2cad50){var _0xc8cb7=_[_0x0240('0x3b')](_0x2cad50,function(_0x3620df){return db[_0x0240('0x117')][_0x0240('0x83')]({'UserId':_0x33159c['id'],'VoicePrefixId':_0x3620df[_0x0240('0x118')]},{'transaction':_0x30b895});});return Promise[_0x0240('0x5e')](_0xc8cb7);});});})[_0x0240('0x24')](function(){for(var _0x55470c=0x0;_0x55470c<_0x5bce5f[_0x0240('0x58')];_0x55470c++){var _0x3bd1f1=_0x5bce5f[_0x55470c][_0x0240('0x115')](_0x0240('0xb1'));var _0x29ddf7=_0x3bd1f1+_0x0240('0xa8');socket[_0x0240('0x31')](_0x0240('0x34')+_0x3bd1f1+_0x0240('0x119'),{'UserId':_0x43b514,['queueField']:_0x5bce5f[_0x55470c]['id']});}})[_0x0240('0x24')](respondWithStatusCode(_0x27067a,null))['catch'](APIHandleError(_0x27067a));};exports[_0x0240('0x11a')]=function(_0x405905,_0x597433){var _0x512fdf=_0x405905['params']['id'];var _0x174b35=null;if(_0x405905[_0x0240('0x4d')][_0x0240('0x67')]){_0x174b35=_[_0x0240('0xb3')](_0x405905[_0x0240('0x4d')]['ids'])?_0x405905[_0x0240('0x4d')][_0x0240('0x67')]:[_0x405905[_0x0240('0x4d')][_0x0240('0x67')]];}var _0x4626ef=[];return Promise[_0x0240('0x112')]()['then'](function(){if(!_0x174b35)throw new APIBadRequestError(_0x0240('0x11b'));})[_0x0240('0x24')](function(){return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x512fdf}});})[_0x0240('0x24')](function(_0x1e4457){if(!_0x1e4457)throw new APINotFoundError(util[_0x0240('0xad')](_0x0240('0xca'),_0x405905['params']['id']));return db[_0x0240('0x6e')]['transaction'](function(_0x3271b2){return _0x1e4457[_0x0240('0x11a')](_0x174b35,{'transaction':_0x3271b2})['then'](function(){return db[_0x0240('0x113')][_0x0240('0x55')]({'where':{'id':{'$in':_0x174b35}}});})[_0x0240('0x24')](function(_0x24a702){var _0x4072e2=_[_0x0240('0x3b')](_0x24a702,function(_0x2ef941){return _0x2ef941['getAssociatedQueues']();});return Promise[_0x0240('0x5e')](_0x4072e2);})['then'](function(_0x5a3463){_0x4626ef=_[_0x0240('0x11c')](_0x5a3463);var _0x3f4048=_[_0x0240('0x3b')](_0x4626ef,function(_0x42c6df){return _0x42c6df['removeAgent'](_0x1e4457['id'],{'transaction':_0x3271b2});});return Promise['all'](_0x3f4048);})['then'](function(){if(!_0x1e4457[_0x0240('0x9f')])return;var _0x1f16ad=_['filter'](_0x4626ef,function(_0x27942a){return _0x27942a[_0x0240('0x115')](_0x0240('0xb1'))===_0x0240('0x116');});var _0x5bc752=_[_0x0240('0x3b')](_0x1f16ad,function(_0xd77e14){return db[_0x0240('0xaf')]['destroy']({'where':{'VoiceQueueId':_0xd77e14['id'],'UserId':_0x1e4457['id']},'transaction':_0x3271b2});});return Promise[_0x0240('0x5e')](_0x5bc752);})[_0x0240('0x24')](function(){return db['TeamVoicePrefix'][_0x0240('0x55')]({'where':{'teamId':{'$in':_0x174b35}}});})['then'](function(_0x41101d){var _0x4de11e=_[_0x0240('0x3b')](_0x41101d,function(_0x3a45ac){return db[_0x0240('0x117')]['destroy']({'where':{'UserId':_0x1e4457['id'],'VoicePrefixId':_0x3a45ac['VoicePrefixId']}},{'transaction':_0x3271b2});});return Promise['all'](_0x4de11e);});});})[_0x0240('0x24')](function(){for(var _0x28e434=0x0;_0x28e434<_0x4626ef[_0x0240('0x58')];_0x28e434++){var _0x5edb39=_0x4626ef[_0x28e434][_0x0240('0x115')]('channel');var _0x40cc85=_0x5edb39+_0x0240('0xa8');socket[_0x0240('0x31')]('user'+_0x5edb39+'Queue:remove',{'UserId':_0x512fdf,['queueField']:_0x4626ef[_0x28e434]['id']});}})[_0x0240('0x24')](respondWithStatusCode(_0x597433,null))[_0x0240('0x2e')](APIHandleError(_0x597433));};exports[_0x0240('0x11d')]=function(_0xdfe45e,_0x350b94){var _0x3eb66d={};var _0x1d314d={};var _0x1c1db6;var _0x5a99a8;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0xdfe45e[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x350b94,null))[_0x0240('0x24')](function(_0x17e061){if(_0x17e061){_0x1c1db6=_0x17e061;_0x1d314d[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0x11e')][_0x0240('0x42')]);_0x1d314d[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0xdfe45e[_0x0240('0x4d')]);_0x1d314d['filters']=_['intersection'](_0x1d314d[_0x0240('0xd7')],_0x1d314d[_0x0240('0x4d')]);_0x3eb66d[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x1d314d[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0xdfe45e[_0x0240('0x4d')]['fields']));_0x3eb66d[_0x0240('0x52')]=_0x3eb66d[_0x0240('0x52')][_0x0240('0x58')]?_0x3eb66d[_0x0240('0x52')]:_0x1d314d[_0x0240('0xd7')];_0x3eb66d['order']=qs[_0x0240('0xda')](_0xdfe45e[_0x0240('0x4d')][_0x0240('0xda')]);_0x3eb66d[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0xdfe45e[_0x0240('0x4d')],_0x1d314d[_0x0240('0xd5')]));if(_0xdfe45e[_0x0240('0x4d')][_0x0240('0x39')]){_0x3eb66d[_0x0240('0xe0')]=_['merge'](_0x3eb66d[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x3eb66d[_0x0240('0x52')],function(_0xd1df38){var _0x2ba8e0={};_0x2ba8e0[_0xd1df38]={'$like':'%'+_0xdfe45e[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x2ba8e0;})});}_0x3eb66d=_[_0x0240('0x61')]({},_0x3eb66d,_0xdfe45e[_0x0240('0x62')]);return _0x1c1db6[_0x0240('0x11d')](_0x3eb66d);}})[_0x0240('0x24')](function(_0x654d6d){if(_0x654d6d){_0x5a99a8=_0x654d6d['length'];if(!_0xdfe45e['query'][_0x0240('0xcb')](_0x0240('0xde'))){_0x3eb66d[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0xdfe45e['query'][_0x0240('0x1f')]);_0x3eb66d[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0xdfe45e['query'][_0x0240('0x1d')]);}return _0x1c1db6[_0x0240('0x11d')](_0x3eb66d);}})[_0x0240('0x24')](function(_0x2ebfa0){if(_0x2ebfa0){return _0x2ebfa0?{'count':_0x5a99a8,'rows':_0x2ebfa0}:null;}})[_0x0240('0x24')](respondWithResult(_0x350b94,null))[_0x0240('0x2e')](handleError(_0x350b94,null));};exports[_0x0240('0x11f')]=function(_0x1b4a49,_0x46010e){var _0xf4a68={};var _0x23e4d2={};var _0x4eba10;return db['User'][_0x0240('0xc9')]({'where':{'id':_0x1b4a49[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x46010e,null))[_0x0240('0x24')](function(_0x184f1d){if(_0x184f1d){_0x4eba10=_0x184f1d;_0x23e4d2[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0x54')][_0x0240('0x42')]);_0x23e4d2['query']=_[_0x0240('0xd3')](_0x1b4a49[_0x0240('0x4d')]);_0x23e4d2[_0x0240('0xd5')]=_['intersection'](_0x23e4d2['model'],_0x23e4d2[_0x0240('0x4d')]);_0xf4a68['attributes']=_[_0x0240('0xd6')](_0x23e4d2[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x1b4a49['query'][_0x0240('0xd8')]));_0xf4a68[_0x0240('0x52')]=_0xf4a68[_0x0240('0x52')][_0x0240('0x58')]?_0xf4a68['attributes']:_0x23e4d2[_0x0240('0xd7')];_0xf4a68[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x1b4a49[_0x0240('0x4d')][_0x0240('0xda')]);_0xf4a68[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x1b4a49[_0x0240('0x4d')],_0x23e4d2[_0x0240('0xd5')]));if(_0x1b4a49['query'][_0x0240('0x39')]){_0xf4a68[_0x0240('0xe0')]=_[_0x0240('0x61')](_0xf4a68[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0xf4a68[_0x0240('0x52')],function(_0x1ef2ac){var _0x5739e6={};_0x5739e6[_0x1ef2ac]={'$like':'%'+_0x1b4a49['query'][_0x0240('0x39')]+'%'};return _0x5739e6;})});}_0xf4a68[_0x0240('0xd7')]=db['User'];_0xf4a68['as']=_0x0240('0x35');_0xf4a68=_[_0x0240('0x61')]({},_0xf4a68,_0x1b4a49[_0x0240('0x62')]);return _0x4eba10['getVoiceQueues']({'include':[_0xf4a68]});}})['then'](function(_0x144599){if(_0x144599){var _0x230212={},_0x4af789=[];for(var _0x295867=0x0;_0x295867<_0x144599[_0x0240('0x58')];_0x295867+=0x1){for(var _0x17516c=0x0,_0x1629d2;_0x17516c<_0x144599[_0x295867]['Agents'][_0x0240('0x58')];_0x17516c+=0x1){_0x1629d2=_0x144599[_0x295867][_0x0240('0x35')][_0x17516c]['get']({'plain':!![]});_0x230212[_0x1629d2['id']]=_0x1629d2;}}_0x230212=_['values'](_0x230212);for(var _0x562bf5=qs[_0x0240('0x1d')](_0x1b4a49[_0x0240('0x4d')]['offset']);_0x562bf5<_0x230212[_0x0240('0x58')]&&_0x4af789['length']=_0x220558){_0x8a2fde=_0x220558;_0x2c8b47=0xc8;}else{_0x2c8b47=0xce;}_0x4a3794[_0x9609('0x1a')](_0x2c8b47);return _0x4a3794[_0x9609('0x20')](_0x9609('0x21'),_0x219642+'-'+_0x8a2fde+'/'+_0x220558)['json'](_0xfc42f0);}return null;};}function respondWithRpcPromise(_0xd9b0e4,_0xf6199d,_0x16ee0a,_0x81dd03){return new Promise(function(_0xac1768,_0x4ca0c9){var _0x206df3=_0x81dd03||amiClient;return _0x206df3[_0x9609('0x22')](_0xd9b0e4,_0x16ee0a)[_0x9609('0x23')](function(_0x5e2f3d){logger[_0x9609('0x24')](_0x9609('0x25'),_0xf6199d,_0x9609('0x26'));logger[_0x9609('0x27')](_0x9609('0x28'),_0xf6199d,_0x9609('0x26'),JSON[_0x9609('0x29')](_0x5e2f3d));if(_0x5e2f3d[_0x9609('0x2a')]){if(_0x5e2f3d[_0x9609('0x2a')]['code']===0x1f4){logger['error'](_0x9609('0x25'),_0xf6199d,_0x5e2f3d[_0x9609('0x2a')][_0x9609('0x2b')]);return _0x4ca0c9(_0x5e2f3d[_0x9609('0x2a')][_0x9609('0x2b')]);}logger[_0x9609('0x2a')](_0x9609('0x25'),_0xf6199d,_0x5e2f3d[_0x9609('0x2a')][_0x9609('0x2b')]);return _0xac1768(_0x5e2f3d[_0x9609('0x2a')][_0x9609('0x2b')]);}else{logger[_0x9609('0x24')](_0x9609('0x25'),_0xf6199d,_0x9609('0x26'));_0xac1768(_0x5e2f3d[_0x9609('0x2c')][_0x9609('0x2b')]);}})[_0x9609('0x2d')](function(_0x30e131){logger[_0x9609('0x2a')]('User,\x20%s,\x20%s',_0xf6199d,_0x30e131);_0x4ca0c9(_0x30e131);});});}function saveUpdates(_0x4d8047){return function(_0xafba1c){if(_0xafba1c){return _0xafba1c['update'](_0x4d8047)[_0x9609('0x23')](function(_0x136124){if(_0x136124[_0x9609('0x2e')]===_0x9609('0x2f')){socket[_0x9609('0x30')](_0x9609('0x31')+_0x136124['id'],_0x136124);}return _0x136124;});}return null;};}function removeEntity(_0x21f14a,_0x32ae4a){return function(_0x99f80){if(_0x99f80){return _0x99f80[_0x9609('0x32')]({'transaction':_0x32ae4a})[_0x9609('0x23')](function(){var _0x5293ad=_0x99f80[_0x9609('0x33')]({'plain':!![]});if(_0x5293ad[_0x9609('0x2e')]===_0x9609('0x34'))return;var _0x4531b4=[{'name':'Users','value':_0x9609('0x35'),'ignore':!![]},{'name':'Agents','value':_0x9609('0x2f'),'ignore':![]},{'name':_0x9609('0x36'),'value':_0x9609('0x37'),'ignore':![]}];var _0x3a73b2=_(_0x4531b4)[_0x9609('0x38')](_0x9609('0x39'))['map']('value')[_0x9609('0x3a')]();if(_[_0x9609('0x3b')](_0x3a73b2,_0x5293ad[_0x9609('0x2e')])){return;}var _0x4a681c=_[_0x9609('0x3c')](_0x4531b4,[_0x9609('0x3a'),_0x5293ad[_0x9609('0x2e')]])[_0x9609('0x3d')];return db[_0x9609('0x3e')][_0x9609('0x32')]({'where':{'type':_0x4a681c,'resourceId':_0x5293ad['id']},'transaction':_0x32ae4a})[_0x9609('0x23')](function(){return _0x99f80;});})[_0x9609('0x23')](function(){_0x21f14a[_0x9609('0x1a')](0xcc)[_0x9609('0x3f')]();});}};}function handleEntityNotFound(_0x10e7fc){return function(_0x103dc9){if(!_0x103dc9){_0x10e7fc[_0x9609('0x19')](0x194);}return _0x103dc9;};}function handleError(_0x221e4a,_0x3328e5){_0x3328e5=_0x3328e5||0x1f4;return function(_0x1f197f){logger[_0x9609('0x2a')](_0x1f197f[_0x9609('0x40')]);if(_0x1f197f[_0x9609('0x3d')]){delete _0x1f197f[_0x9609('0x3d')];}_0x221e4a[_0x9609('0x1a')](_0x3328e5)[_0x9609('0x41')](_0x1f197f);};}function getUserAttributes(){return _(db['User'][_0x9609('0x42')])[_0x9609('0x43')](function(_0x1a0e3f){return{'name':_0x1a0e3f[_0x9609('0x44')],'type':_0x1a0e3f[_0x9609('0x45')][_0x9609('0x46')]};})['filter'](function(_0x1cde6b){return![_0x9609('0x47'),_0x9609('0x48'),_0x9609('0x49'),'resetPasswordToken',_0x9609('0x4a'),_0x9609('0x4b')][_0x9609('0x3b')](_0x1cde6b['name']);})[_0x9609('0x3a')]();}exports[_0x9609('0x4c')]=function(_0x430295,_0x49829c){var _0x1c59ff={},_0x254421={'count':0x0,'rows':[]};var _0x440919=getUserAttributes();_0x1c59ff=qs[_0x9609('0x4d')](_0x440919,_0x430295);var _0x257be0={'where':_0x1c59ff[_0x9609('0x4e')]};return db[_0x9609('0x4f')][_0x9609('0x1f')](_0x257be0)[_0x9609('0x23')](function(_0x15a631){_0x254421[_0x9609('0x1f')]=_0x15a631;if(_0x430295['query'][_0x9609('0x50')]){_0x1c59ff['include']=[{'all':!![]}];}if(_0x430295[_0x9609('0x51')]['userSetting']===_0x9609('0x52')){_0x1c59ff[_0x9609('0x53')]=[{'model':db[_0x9609('0x54')],'as':_0x9609('0x55')}];}if(!_[_0x9609('0x3b')](_0x1c59ff['attributes'],'id')){_0x1c59ff[_0x9609('0x56')][_0x9609('0x57')]('id');}return db[_0x9609('0x4f')][_0x9609('0x58')](_0x1c59ff);})['then'](function(_0x341366){_0x254421[_0x9609('0x59')]=_0x341366;if(_0x430295[_0x9609('0x51')][_0x9609('0x5a')]===_0x9609('0x52')){var _0x22f902=[];for(var _0x3a1523=0x0;_0x3a1523<_0x254421[_0x9609('0x59')][_0x9609('0x5b')];_0x3a1523++){_0x22f902[_0x9609('0x57')](get_open_tabs('chat',_0x254421[_0x9609('0x59')][_0x3a1523][_0x9609('0x5c')]));_0x22f902[_0x9609('0x57')](get_open_tabs('sms',_0x254421[_0x9609('0x59')][_0x3a1523][_0x9609('0x5c')]));_0x22f902[_0x9609('0x57')](get_open_tabs('fax',_0x254421[_0x9609('0x59')][_0x3a1523][_0x9609('0x5c')]));_0x22f902['push'](get_open_tabs(_0x9609('0x5d'),_0x254421[_0x9609('0x59')][_0x3a1523]['dataValues']));_0x22f902[_0x9609('0x57')](get_open_tabs(_0x9609('0x5e'),_0x254421[_0x9609('0x59')][_0x3a1523]['dataValues']));_0x22f902[_0x9609('0x57')](get_open_tabs(_0x9609('0x5f'),_0x254421[_0x9609('0x59')][_0x3a1523]['dataValues']));}return Promise[_0x9609('0x60')](_0x22f902)[_0x9609('0x23')](function(){return _0x254421;});}else{return _0x254421;}})[_0x9609('0x23')](respondWithFilteredResult(_0x49829c,_0x1c59ff))['catch'](handleError(_0x49829c,null));};exports['show']=function(_0x4ed80f,_0x2c3c2e){var _0x1032ca=getUserAttributes();_0x4ed80f[_0x9609('0x51')]['id']=_0x4ed80f[_0x9609('0x61')]['id'];var _0x3868c4=qs[_0x9609('0x4d')](_0x1032ca,_0x4ed80f);if(_0x4ed80f[_0x9609('0x51')][_0x9609('0x50')]){_0x3868c4['include']=[{'all':!![]}];}if(_0x4ed80f[_0x9609('0x51')][_0x9609('0x55')]===_0x9609('0x52')){_0x3868c4['include']=[{'model':db[_0x9609('0x54')],'as':_0x9609('0x55')}];}_0x3868c4=_[_0x9609('0x62')]({},_0x3868c4,_0x4ed80f[_0x9609('0x63')]);if(!_[_0x9609('0x3b')](_0x3868c4[_0x9609('0x56')],'id')){_0x3868c4[_0x9609('0x56')][_0x9609('0x57')]('id');}return db[_0x9609('0x4f')]['find'](_0x3868c4)[_0x9609('0x23')](handleEntityNotFound(_0x2c3c2e,null))[_0x9609('0x23')](function(_0x344411){var _0x421eb2=[];values=_0x344411;if(_0x4ed80f[_0x9609('0x51')][_0x9609('0x5a')]===_0x9609('0x52')){_0x421eb2[_0x9609('0x57')](get_open_tabs(_0x9609('0x64'),_0x344411[_0x9609('0x5c')]));_0x421eb2[_0x9609('0x57')](get_open_tabs('sms',_0x344411[_0x9609('0x5c')]));_0x421eb2[_0x9609('0x57')](get_open_tabs(_0x9609('0x5e'),_0x344411[_0x9609('0x5c')]));_0x421eb2[_0x9609('0x57')](get_open_tabs(_0x9609('0x5f'),_0x344411[_0x9609('0x5c')]));_0x421eb2[_0x9609('0x57')](get_open_tabs(_0x9609('0x65'),_0x344411[_0x9609('0x5c')]));_0x421eb2[_0x9609('0x57')](get_open_tabs(_0x9609('0x5d'),_0x344411[_0x9609('0x5c')]));return Promise[_0x9609('0x60')](_0x421eb2);}else{return values;}})['then'](function(){return values;})[_0x9609('0x23')](respondWithResult(_0x2c3c2e,null))[_0x9609('0x2d')](handleError(_0x2c3c2e,null));};exports[_0x9609('0x66')]=function(_0x4891ac,_0x441075){if(_0x4891ac[_0x9609('0x67')]['id']){delete _0x4891ac['body']['id'];}delete _0x4891ac[_0x9609('0x67')][_0x9609('0x2e')];return db[_0x9609('0x4f')]['find']({'where':{'id':_0x4891ac['params']['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x441075,null))[_0x9609('0x23')](saveUpdates(_0x4891ac['body'],null))['then'](respondWithResult(_0x441075,null))['catch'](handleError(_0x441075,null));};exports[_0x9609('0x68')]=function(_0x2d77de,_0x551600){return db[_0x9609('0x4f')][_0x9609('0x68')]()[_0x9609('0x23')](respondWithResult(_0x551600,null))[_0x9609('0x2d')](handleError(_0x551600,null));};exports[_0x9609('0x69')]=function(_0x24d5dc,_0x3ede53){return db[_0x9609('0x4f')]['find']({'where':{'id':_0x24d5dc[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x3ede53,null))['then'](function(_0xda48e){if(_0xda48e){return _0xda48e[_0x9609('0x69')](_0x24d5dc[_0x9609('0x67')]['ids'],_[_0x9609('0x6a')](_0x24d5dc[_0x9609('0x67')],[_0x9609('0x6b'),'id'])||{});}})[_0x9609('0x23')](respondWithResult(_0x3ede53,null))['catch'](handleError(_0x3ede53,null));};function validateUser(_0x5072d7){return new Promise(function(_0x322e90,_0x2da1b9){if(_0x5072d7[_0x9609('0x6c')])return _0x322e90(_0x5072d7);return db[_0x9609('0x6d')][_0x9609('0x6e')](0x1)[_0x9609('0x23')](function(_0x3ff365){if(_0x3ff365['securePassword'])authService[_0x9609('0x6f')](_0x5072d7[_0x9609('0x47')]);db['User'][_0x9609('0x70')](_0x9609('0x6c'))[_0x9609('0x23')](function(_0x13a5cf){if(_[_0x9609('0x71')](_0x13a5cf)){_0x5072d7['internal']=_0x3ff365[_0x9609('0x72')]||0x1;return;}if(_[_0x9609('0x71')](_0x3ff365[_0x9609('0x72')])||_0x3ff365[_0x9609('0x72')]===_0x13a5cf){_0x5072d7[_0x9609('0x6c')]=_0x13a5cf+0x1;return;}if(_0x3ff365['min_internal']>_0x13a5cf){_0x5072d7['internal']=_0x3ff365[_0x9609('0x72')];return;}return db[_0x9609('0x73')][_0x9609('0x51')](_0x9609('0x74'),{'type':db[_0x9609('0x73')][_0x9609('0x75')][_0x9609('0x76')]})[_0x9609('0x23')](function(_0x5d8a78){if(_0x5d8a78&&_0x5d8a78[_0x9609('0x5b')]){for(var _0x6cd84e=0x0,_0x474d62=_0x5d8a78[_0x9609('0x5b')];_0x6cd84e<_0x474d62&&_[_0x9609('0x71')](_0x5072d7[_0x9609('0x6c')]);_0x6cd84e++){if(_0x3ff365[_0x9609('0x72')]<=_0x5d8a78[_0x6cd84e][_0x9609('0x77')]){_0x5072d7['internal']=_0x5d8a78[_0x6cd84e][_0x9609('0x77')];}else if(_0x3ff365['min_internal']>_0x5d8a78[_0x6cd84e][_0x9609('0x77')]&&_0x3ff365[_0x9609('0x72')]<=_0x5d8a78[_0x6cd84e]['to']){_0x5072d7[_0x9609('0x6c')]=_0x3ff365[_0x9609('0x72')];}}}if(_[_0x9609('0x71')](_0x5072d7[_0x9609('0x6c')])){_0x5072d7[_0x9609('0x6c')]=_0x13a5cf+0x1;}return _0x322e90(_0x5072d7);});});})[_0x9609('0x2d')](function(_0x132769){_0x2da1b9(_0x132769);});});}function updateUser(_0x4111df){return new Promise(function(_0x57fc14,_0x18a03e){try{if(_0x4111df[_0x9609('0x78')]){_0x4111df[_0x9609('0x79')]=_0x4111df[_0x9609('0x6c')];_0x4111df[_0x9609('0x7a')]={'mailbox':_0x4111df[_0x9609('0x6c')],'password':_0x4111df[_0x9609('0x47')],'fullname':_0x4111df[_0x9609('0x7b')],'email':_0x4111df[_0x9609('0x7c')]};}if(_0x4111df['role']===_0x9609('0x2f')){if(!_0x4111df[_0x9609('0x7d')])_0x4111df[_0x9609('0x7d')]=[_0x9609('0x7e'),_0x9609('0x7f'),_0x9609('0x80'),_0x9609('0x81'),_0x9609('0x82'),_0x9609('0x83'),_0x9609('0x84'),_0x9609('0x85'),'107','108',_0x9609('0x86'),_0x9609('0x87'),'111',_0x9609('0x88'),_0x9609('0x89')];}_0x57fc14(_0x4111df);}catch(_0x47c4d2){_0x18a03e(_0x47c4d2);}});}exports[_0x9609('0x8a')]=function(_0x9e97dd,_0x387334){if(_0x9e97dd['user']['role']===_0x9609('0x2f'))throw new Error('Unauthorized');if(_0x9e97dd['body']['role']===_0x9609('0x35')&&_0x9e97dd[_0x9609('0x35')][_0x9609('0x2e')]!=='admin'){throw new Error(_0x9609('0x8b'));}if(_0x9e97dd['body'][_0x9609('0x2e')]===_0x9609('0x34')&&_0x9e97dd['user']['role']!==_0x9609('0x34')){throw new Error(_0x9609('0x8c'));}return licenseUtil[_0x9609('0x8d')]([_0x9e97dd[_0x9609('0x67')]])[_0x9609('0x23')](function(){return validateUser(_0x9e97dd[_0x9609('0x67')]);})['then'](function(_0x451333){return updateUser(_0x451333)[_0x9609('0x23')](function(_0x5f2f47){if(_0x5f2f47[_0x9609('0x2e')]==='admin'){_0x5f2f47[_0x9609('0x8e')]=_0x9e97dd[_0x9609('0x35')]['settingsEnabled'];delete _0x5f2f47[_0x9609('0x8f')];}return _0x5f2f47;});})[_0x9609('0x23')](function(_0x155988){return db[_0x9609('0x4f')][_0x9609('0x8a')](_0x155988,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x9609('0x23')](function(_0x350fca){if(_0x9e97dd[_0x9609('0x67')][_0x9609('0x2e')]===_0x9609('0x35'))return _0x350fca;if(_0x9e97dd['user'][_0x9609('0x2e')]!==_0x9609('0x35'))return _0x350fca;return db[_0x9609('0x90')][_0x9609('0x3c')]({'where':{'name':_0x350fca[_0x9609('0x2e')]===_0x9609('0x2f')?_0x9609('0x91'):_0x9609('0x36'),'userProfileId':_0x9e97dd[_0x9609('0x35')][_0x9609('0x8f')]},'raw':!![]})[_0x9609('0x23')](function(_0x12ff15){if(!_0x12ff15||_0x12ff15['autoAssociation']!=0x0)return _0x350fca;return db[_0x9609('0x3e')]['create']({'name':_0x350fca[_0x9609('0x3d')],'resourceId':_0x350fca['id'],'type':_0x12ff15[_0x9609('0x3d')],'sectionId':_0x12ff15['id']},{})['then'](function(){return _0x350fca;});})[_0x9609('0x2d')](function(_0x4b61a7){logger['error'](_0x9609('0x92'),_0x4b61a7);throw _0x4b61a7;});})[_0x9609('0x23')](respondWithResult(_0x387334,0xc9))[_0x9609('0x2d')](handleError(_0x387334,null));};exports[_0x9609('0x93')]=function(_0x526fbd,_0x3555a6){var _0x316736=_0x526fbd[_0x9609('0x67')];var _0x5a9365=[];if(_0x526fbd['user'][_0x9609('0x2e')]==='agent')throw new Error(_0x9609('0x94'));if(_[_0x9609('0x95')](_0x316736,[_0x9609('0x2e'),_0x9609('0x35')])&&_0x526fbd['user']['role']!==_0x9609('0x34')){throw new Error(_0x9609('0x8b'));}if(_[_0x9609('0x95')](_0x316736,[_0x9609('0x2e'),_0x9609('0x34')])&&_0x526fbd[_0x9609('0x35')]['role']!==_0x9609('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x9609('0x8d')](_0x316736)[_0x9609('0x23')](function(){return validateUser(_0x316736[0x0]);})[_0x9609('0x23')](function(){for(var _0x55b060=0x1;_0x55b060<_0x316736['length'];_0x55b060++){var _0x113d9f=_0x316736[_0x55b060-0x1]['internal'];if(!_0x316736[_0x55b060][_0x9609('0x6c')])_0x316736[_0x55b060][_0x9609('0x6c')]=_0x113d9f+0x1;_0x5a9365[_0x9609('0x57')](validateUser(_0x316736[_0x55b060]));}return Promise[_0x9609('0x60')](_0x5a9365);})[_0x9609('0x23')](function(){_0x5a9365=[];for(var _0x2f8ae6=0x0;_0x2f8ae6<_0x316736[_0x9609('0x5b')];_0x2f8ae6++){_0x5a9365[_0x9609('0x57')](updateUser(_0x316736[_0x2f8ae6]));}return Promise[_0x9609('0x60')](_0x5a9365);})[_0x9609('0x23')](function(){_0x5a9365=_0x316736[_0x9609('0x43')](function(_0xcc259d){return db['User']['create'](_0xcc259d,{'include':[{'model':db[_0x9609('0x7a')],'as':'VoiceMail'}]})[_0x9609('0x23')](function(_0x90d350){_0xcc259d['id']=_0x90d350['id'];return _0xcc259d;});});return Promise[_0x9609('0x60')](_0x5a9365);})[_0x9609('0x23')](function(_0x5b3926){if(_0x526fbd['body'][_0x9609('0x2e')]===_0x9609('0x35'))return _0x5b3926;if(_0x526fbd[_0x9609('0x35')][_0x9609('0x2e')]!=='user')return _0x5b3926;var _0x3e0bff=_[_0x9609('0x95')](_0x5b3926,function(_0x3723df){return _0x3723df[_0x9609('0x2e')]==='agent'||_0x3723df['role']==='telephone';});if(!_0x3e0bff)return _0x5b3926;return db[_0x9609('0x90')][_0x9609('0x58')]({'where':{'name':{'$or':[_0x9609('0x91'),_0x9609('0x36')]},'userProfileId':_0x526fbd[_0x9609('0x35')]['userProfileId']},'raw':!![]})[_0x9609('0x23')](function(_0x14d3e2){if(_[_0x9609('0x96')](_0x14d3e2)||!_[_0x9609('0x95')](_0x14d3e2,['autoAssociation',0x0]))return _0x5b3926;_0x5a9365=[];var _0x255d23=_(_0x14d3e2)[_0x9609('0x43')](function(_0x330132){if(_0x330132[_0x9609('0x97')]===0x1)return;return _0x330132[_0x9609('0x3d')]===_0x9609('0x91')?_0x9609('0x2f'):'telephone';})[_0x9609('0x98')]()['value']();for(var _0x3e2731=0x0;_0x3e2731<_0x5b3926[_0x9609('0x5b')];_0x3e2731++){if(!_[_0x9609('0x3b')](_0x255d23,_0x5b3926[_0x3e2731][_0x9609('0x2e')]))return;var _0x18f9d5=_0x5b3926[_0x3e2731][_0x9609('0x2e')]===_0x9609('0x2f')?'Agents':'Telephones';_0x5a9365[_0x9609('0x57')](db[_0x9609('0x3e')][_0x9609('0x8a')]({'name':_0x5b3926[_0x3e2731][_0x9609('0x3d')],'resourceId':_0x5b3926[_0x3e2731]['id'],'type':_0x18f9d5,'sectionId':_[_0x9609('0x3c')](_0x14d3e2,[_0x9609('0x3d'),_0x18f9d5])['id']},{}));}return Promise['all'](_0x5a9365);});})['then'](respondWithResult(_0x3555a6,0xc9))[_0x9609('0x2d')](handleError(_0x3555a6,null));};exports[_0x9609('0x99')]=function(_0x3a1af9,_0xa03a4e){if(_0x3a1af9[_0x9609('0x67')]['id']){delete _0x3a1af9[_0x9609('0x67')]['id'];}return db[_0x9609('0x4f')]['find']({'where':{'id':_0x3a1af9[_0x9609('0x61')]['id']}})[_0x9609('0x23')](function(_0x5f3ba1){if(!_0x5f3ba1)return null;if(_0x5f3ba1['id']===_0x3a1af9[_0x9609('0x35')]['id']){if(!_0x3a1af9[_0x9609('0x67')][_0x9609('0x9a')]||!_0x3a1af9['body'][_0x9609('0x9b')]){throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))](_0x9609('0x9e'));}if(!_0x5f3ba1[_0x9609('0x9f')](_0x3a1af9[_0x9609('0x67')][_0x9609('0x9a')])){throw new db['Sequelize'][(_0x9609('0x9d'))](_0x9609('0xa0'));}if(_0x3a1af9[_0x9609('0x67')][_0x9609('0x9a')]===_0x3a1af9[_0x9609('0x67')][_0x9609('0x9b')]){throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))](_0x9609('0xa1'));}}else if(_0x3a1af9['user'][_0x9609('0x2e')]==='admin'){if(!_0x3a1af9[_0x9609('0x67')][_0x9609('0x9b')]){throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))](_0x9609('0xa2'));}}else if(_0x3a1af9[_0x9609('0x35')][_0x9609('0x2e')]===_0x9609('0x35')){if(!_0x3a1af9[_0x9609('0x67')][_0x9609('0x9b')]){throw new db[(_0x9609('0x9c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5f3ba1[_0x9609('0x2e')]!==_0x9609('0x2f')){throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))](_0x9609('0x94'));}}else{throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))]('Unauthorized');}return _0x5f3ba1;})[_0x9609('0x23')](handleEntityNotFound(_0xa03a4e,null))[_0x9609('0x23')](function(_0x23b8cf){return db[_0x9609('0x6d')][_0x9609('0xa3')]({'attributes':['id',_0x9609('0xa4'),'enforcePasswordHistory',_0x9609('0xa5')]})[_0x9609('0x23')](function(_0x5a5b09){if(_0x5a5b09[_0x9609('0xa4')])authService['validatePasswordPattern'](_0x3a1af9[_0x9609('0x67')][_0x9609('0x9b')]);if(!_0x5a5b09['enforcePasswordHistory']||!_0x23b8cf[_0x9609('0x49')])return _0x23b8cf;authService['validatePasswordHistory'](_0x3a1af9['body'][_0x9609('0x9b')],_0x23b8cf[_0x9609('0x49')],_0x5a5b09[_0x9609('0xa5')]);return _0x23b8cf;})[_0x9609('0x23')](saveUpdates({'password':_0x3a1af9[_0x9609('0x67')][_0x9609('0x9b')],'passwordResetAt':_0x3a1af9['user']['id']==_0x3a1af9['params']['id']?moment():null,'previousPasswords':authService[_0x9609('0xa6')](_0x3a1af9['body'][_0x9609('0x9b')],_0x23b8cf[_0x9609('0x49')])},null));})['then'](respondWithResult(_0xa03a4e,null))[_0x9609('0x2d')](handleError(_0xa03a4e,null));};exports[_0x9609('0xa7')]=function(_0x3cd80d,_0x3eda49){var _0xa51345=_0x3cd80d[_0x9609('0x67')][_0x9609('0xa8')];return db[_0x9609('0x4f')][_0x9609('0x3c')]({'where':{'id':_0x3cd80d[_0x9609('0x61')]['id']},'attributes':['id',_0x9609('0x3d'),_0x9609('0x2e'),_0x9609('0xa9'),'loginInPause',_0x9609('0xaa'),_0x9609('0xab')]})[_0x9609('0x23')](handleEntityNotFound(_0x3eda49,null))[_0x9609('0x23')](function(_0x705fb7){if(_0x705fb7){if(!utils[_0x9609('0xac')](_0xa51345)){throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))]('Unknown\x20channel');}return _0x705fb7[_0x9609('0xad')+_[_0x9609('0xae')](_0xa51345[_0x9609('0xaf')]())+_0x9609('0xb0')](_0x3cd80d[_0x9609('0x67')]['ids'],{'penalty':_0x3cd80d[_0x9609('0x67')][_0x9609('0xb1')]||0x0})[_0x9609('0xb2')](function(_0x2e0ec5){for(var _0xebab24=0x0;_0xebab24<_0x3cd80d[_0x9609('0x67')][_0x9609('0x6b')]['length'];_0xebab24+=0x1){var _0x20b29f={'UserId':Number(_0x3cd80d[_0x9609('0x61')]['id'])};_0x20b29f[_[_0x9609('0xae')](_0xa51345[_0x9609('0xaf')]())+'QueueId']=Number(_0x3cd80d[_0x9609('0x67')][_0x9609('0x6b')][_0xebab24]);socket['emit'](_0x9609('0x35')+_['capitalize'](_0xa51345[_0x9609('0xaf')]())+_0x9609('0xb3'),_0x20b29f);}return _0x2e0ec5;})[_0x9609('0x23')](function(){if(_0xa51345===_0x9609('0xb4')){return db[_0x9609('0xb5')][_0x9609('0x58')]({'where':{'id':_0x3cd80d[_0x9609('0x67')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x9609('0x23')](function(_0x1ea2f5){var _0x1b5c1=_0x705fb7[_0x9609('0x33')]({'plain':!![]});var _0x51b492=[];if(_0xa51345===_0x9609('0xb4')&&_0x1b5c1[_0x9609('0x2e')]==='agent'&&_0x1b5c1[_0x9609('0xa9')]){for(let _0x211d04=0x0;_0x211d04<_0x1ea2f5[_0x9609('0x5b')];_0x211d04+=0x1){_0x51b492['push']({'membername':_0x1b5c1[_0x9609('0x3d')],'UserId':_0x1b5c1['id'],'queue_name':_0x1ea2f5[_0x211d04][_0x9609('0x3d')],'VoiceQueueId':_0x1ea2f5[_0x211d04]['id'],'interface':_[_0x9609('0x71')](_0x1b5c1['interface'])?util[_0x9609('0xb6')]('SIP/%s',_0x1b5c1['name']):_0x1b5c1[_0x9609('0xab')],'paused':_0x1b5c1['voicePause']||![],'penalty':_0x3cd80d[_0x9609('0x67')][_0x9609('0xb1')]||0x0});}return Promise[_0x9609('0x60')](_0x51b492[_0x9609('0x43')](function(_0x1c3c17){return db[_0x9609('0xb7')][_0x9609('0xb8')](_0x1c3c17);}));}return _0x705fb7;});}})[_0x9609('0x23')](respondWithStatusCode(_0x3eda49,null))[_0x9609('0x2d')](handleError(_0x3eda49,null));};exports[_0x9609('0xb9')]=function(_0x304d48,_0x1c123e){var _0x278508,_0x381362;return db[_0x9609('0x4f')][_0x9609('0x3c')]({'where':{'id':_0x304d48[_0x9609('0x61')]['id']},'attributes':['id',_0x9609('0x3d'),'role']})['then'](handleEntityNotFound(_0x1c123e,null))[_0x9609('0x23')](function(_0x5b2103){if(_0x5b2103){_0x278508=_0x5b2103;if(!_0x304d48['query'][_0x9609('0xa8')]||!utils[_0x9609('0xac')](_0x304d48[_0x9609('0x51')][_0x9609('0xa8')])){throw new db[(_0x9609('0x9c'))]['ValidationError'](_0x9609('0xba'));}return _0x5b2103[_0x9609('0xbb')+_['capitalize'](_0x304d48[_0x9609('0x51')][_0x9609('0xa8')][_0x9609('0xaf')]())+_0x9609('0xb0')](_0x304d48[_0x9609('0x51')]['ids']);}})['then'](function(_0x3dbb3a){if(_[_0x9609('0xbc')](_0x304d48[_0x9609('0x51')][_0x9609('0x6b')])){for(var _0x4a024=0x0;_0x4a024<_0x304d48[_0x9609('0x51')][_0x9609('0x6b')][_0x9609('0x5b')];_0x4a024+=0x1){_0x381362={'UserId':Number(_0x304d48[_0x9609('0x61')]['id'])};_0x381362[_[_0x9609('0xae')](_0x304d48[_0x9609('0x51')][_0x9609('0xa8')][_0x9609('0xaf')]())+_0x9609('0xbd')]=Number(_0x304d48[_0x9609('0x51')][_0x9609('0x6b')][_0x4a024]);socket[_0x9609('0x30')](_0x9609('0x35')+_[_0x9609('0xae')](_0x304d48[_0x9609('0x51')][_0x9609('0xa8')][_0x9609('0xaf')]())+_0x9609('0xbe'),_0x381362);}}else{_0x381362={'UserId':Number(_0x304d48[_0x9609('0x61')]['id'])};_0x381362[_[_0x9609('0xae')](_0x304d48[_0x9609('0x51')][_0x9609('0xa8')][_0x9609('0xaf')]())+_0x9609('0xbd')]=Number(_0x304d48['query'][_0x9609('0x6b')]);socket[_0x9609('0x30')](_0x9609('0x35')+_['capitalize'](_0x304d48['query'][_0x9609('0xa8')][_0x9609('0xaf')]())+_0x9609('0xbe'),_0x381362);}return _0x3dbb3a;})['then'](function(){if(_0x304d48[_0x9609('0x51')][_0x9609('0xa8')]===_0x9609('0xb4')){return db[_0x9609('0xb7')][_0x9609('0x32')]({'where':{'UserId':_0x304d48[_0x9609('0x61')]['id'],'VoiceQueueId':_0x304d48[_0x9609('0x51')]['ids']},'individualHooks':!![]})[_0x9609('0x23')](function(){return _0x278508;});}return _0x278508;})[_0x9609('0x23')](respondWithStatusCode(_0x1c123e,null))[_0x9609('0x2d')](handleError(_0x1c123e,null));};exports[_0x9609('0xbf')]=function(_0x4eb427,_0x28f0cf){_0x4eb427['body'][_0x9609('0xc0')]=_0x4eb427['file'][_0x9609('0xc1')];return db[_0x9609('0x4f')]['find']({'where':{'id':_0x4eb427[_0x9609('0x61')]['id']}})['then'](handleEntityNotFound(_0x28f0cf,null))[_0x9609('0x23')](saveUpdates(_0x4eb427[_0x9609('0x67')],null))[_0x9609('0x23')](respondWithResult(_0x28f0cf,null))[_0x9609('0x2d')](handleError(_0x28f0cf,null));};exports[_0x9609('0xc2')]=function(_0xea4657,_0x346a7a){var _0x2d2ca5=path[_0x9609('0xc3')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x9609('0x4f')][_0x9609('0x3c')]({'where':{'id':_0xea4657['params']['id']},'attributes':['id',_0x9609('0xc0')],'raw':!![]})['then'](handleEntityNotFound(_0x346a7a,null))[_0x9609('0x23')](function(_0x3f9499){if(_0x3f9499){if(_['isNil'](_0x3f9499[_0x9609('0xc0')])){return _0x346a7a['download'](_0x2d2ca5);}else{if(!fs[_0x9609('0xc4')](path[_0x9609('0xc3')](config[_0x9609('0xc5')],_0x9609('0xc6'),_0x3f9499[_0x9609('0xc0')]))){return _0x346a7a[_0x9609('0xc7')](_0x2d2ca5);}return _0x346a7a['download'](path[_0x9609('0xc3')](config[_0x9609('0xc5')],_0x9609('0xc6'),_0x3f9499['userpic']));}}})[_0x9609('0x2d')](handleError(_0x346a7a,null));};exports[_0x9609('0xc8')]=function(_0x1c831f,_0x78c012){return db[_0x9609('0x4f')][_0x9609('0x3c')]({'where':{'id':_0x1c831f[_0x9609('0x61')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x78c012,null))['then'](function(_0x552196){var _0x2eee05=[];values=_0x552196[_0x9609('0x5c')];_0x2eee05[_0x9609('0x57')](get_open_tabs('chat',_0x552196[_0x9609('0x5c')]));_0x2eee05[_0x9609('0x57')](get_open_tabs(_0x9609('0xc9'),_0x552196['dataValues']));_0x2eee05[_0x9609('0x57')](get_open_tabs(_0x9609('0x5e'),_0x552196[_0x9609('0x5c')]));_0x2eee05[_0x9609('0x57')](get_open_tabs(_0x9609('0x5f'),_0x552196['dataValues']));_0x2eee05[_0x9609('0x57')](get_open_tabs(_0x9609('0x65'),_0x552196[_0x9609('0x5c')]));_0x2eee05[_0x9609('0x57')](get_open_tabs(_0x9609('0x5d'),_0x552196[_0x9609('0x5c')]));return Promise['all'](_0x2eee05);})[_0x9609('0x23')](function(_0x4f23ee){if(_0x4f23ee){var _0x13ab83=_[_0x9609('0x43')](values[_0x9609('0xca')],function(_0x376c70){return{'channel':_0x9609('0xcb'),'id':_0x376c70['id'],'createdAt':_0x376c70[_0x9609('0xcc')]};});var _0x1b3471=_['map'](values[_0x9609('0xcd')],function(_0x16233d){return{'channel':_0x9609('0xce'),'id':_0x16233d['id'],'createdAt':_0x16233d[_0x9609('0xcc')]};});var _0x509136=_[_0x9609('0x43')](values[_0x9609('0xcf')],function(_0x5386b7){return{'channel':'OPENCHANNEL','id':_0x5386b7['id'],'createdAt':_0x5386b7['createdAt']};});var _0x2f1b94=_[_0x9609('0x43')](values['MailOpenTabs'],function(_0x34c835){return{'channel':_0x9609('0xd0'),'id':_0x34c835['id'],'createdAt':_0x34c835['createdAt']};});var _0x5c626f=_[_0x9609('0x43')](values[_0x9609('0xd1')],function(_0x2221ba){return{'channel':_0x9609('0xd2'),'id':_0x2221ba['id'],'createdAt':_0x2221ba[_0x9609('0xcc')]};});var _0x17971f=_[_0x9609('0x43')](values[_0x9609('0xd3')],function(_0x2bfbb7){return{'channel':'WHATSAPP','id':_0x2bfbb7['id'],'createdAt':_0x2bfbb7['createdAt']};});var _0x509a3c=_[_0x9609('0xd4')](_0x13ab83,_0x1b3471,_0x509136,_0x2f1b94,_0x5c626f,_0x17971f);var _0x35f01e={'count':_0x509a3c[_0x9609('0x5b')],'rows':_0x509a3c};return _0x35f01e;}else return null;})['then'](respondWithResult(_0x78c012,null))['catch'](handleError(_0x78c012,null));};exports['getContacts']=function(_0x49ff6d,_0x1f6c7b){var _0x34bf37={};return db['User'][_0x9609('0xa3')]({'where':{'id':_0x49ff6d[_0x9609('0x61')]['id']}})['then'](function(_0x4e67e4){if(!_0x4e67e4){throw new APINotFoundError(util[_0x9609('0xb6')](_0x9609('0xd5'),_0x49ff6d[_0x9609('0x61')]['id']));}return contacts[_0x9609('0x68')]();})['then'](function(_0x502a19){_0x49ff6d['query']['User']=_0x49ff6d['params']['id'];_0x34bf37=qs[_0x9609('0x4d')](_0x502a19,_0x49ff6d);if(_0x49ff6d[_0x9609('0x51')][_0x9609('0xd6')](_0x9609('0x50'))){_0x34bf37[_0x9609('0x53')]=[{'model':db['CmList'],'as':_0x9609('0xd7'),'required':![]},{'model':db[_0x9609('0xd8')],'as':'Tags','attributes':['id',_0x9609('0x3d'),'color'],'where':_0x49ff6d[_0x9609('0x51')][_0x9609('0xd9')]?{'id':_0x49ff6d[_0x9609('0x51')]['tag']}:undefined,'required':_0x49ff6d[_0x9609('0x51')][_0x9609('0xd9')]?!![]:![]}];}return contacts[_0x9609('0x58')](_0x49ff6d[_0x9609('0x51')],_0x49ff6d[_0x9609('0x35')],_0x34bf37,_0x502a19);})[_0x9609('0x23')](respondWithFilteredResult(_0x1f6c7b,_0x34bf37))['catch'](APIHandleError(_0x1f6c7b));};exports[_0x9609('0xda')]=function(_0x5aefbd,_0x1eca5e){var _0x2b0fb0;var _0x1c5626={};var _0x549f0c;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x5aefbd['params']['id']},'attributes':['id',_0x9609('0x3d'),_0x9609('0x2e')]})['then'](handleEntityNotFound(_0x1eca5e,null))['then'](function(_0x1650d8){if(!utils['isValidChannel'](_0x5aefbd['query'][_0x9609('0xa8')])){throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))](_0x9609('0xba'));}_0x2b0fb0=_0x1650d8;var _0x56fc72={};_0x56fc72[_0x9609('0xdb')]=_['keys'](db[_[_0x9609('0xae')](_0x5aefbd[_0x9609('0x51')][_0x9609('0xa8')])+_0x9609('0xdc')][_0x9609('0x42')]);_0x56fc72[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x5aefbd[_0x9609('0x51')]);_0x56fc72['filters']=_['intersection'](_0x56fc72[_0x9609('0xdb')],_0x56fc72['query']);_0x1c5626[_0x9609('0x56')]=_['intersection'](_0x56fc72[_0x9609('0xdb')],qs['fields'](_0x5aefbd[_0x9609('0x51')][_0x9609('0xde')]));_0x1c5626[_0x9609('0x56')]=_0x1c5626[_0x9609('0x56')]['length']?_0x1c5626[_0x9609('0x56')]:_0x56fc72[_0x9609('0xdb')];_0x1c5626[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x5aefbd[_0x9609('0x51')]['sort']);_0x1c5626[_0x9609('0x4e')]=qs['filters'](_['pick'](_0x5aefbd[_0x9609('0x51')],_0x56fc72[_0x9609('0xe1')]));if(_0x5aefbd['query'][_0x9609('0x38')]){_0x1c5626[_0x9609('0x4e')]=_['merge'](_0x1c5626['where'],{'$or':_['map'](_0x1c5626['attributes'],function(_0x4a4e59){var _0x580468={};_0x580468[_0x4a4e59]={'$like':'%'+_0x5aefbd[_0x9609('0x51')][_0x9609('0x38')]+'%'};return _0x580468;})});}_0x1c5626=_[_0x9609('0x62')]({},_0x1c5626,_0x5aefbd[_0x9609('0x63')]);switch(_0x2b0fb0[_0x9609('0x2e')]){case'admin':return db[_[_0x9609('0xae')](_0x5aefbd[_0x9609('0x51')][_0x9609('0xa8')])+'Queue']['findAll'](_0x1c5626);case _0x9609('0x35'):case'agent':return _0x2b0fb0[_0x9609('0x33')+_[_0x9609('0xae')](_0x5aefbd[_0x9609('0x51')][_0x9609('0xa8')])+'Queues'](_0x1c5626);default:throw new db[(_0x9609('0x9c'))][(_0x9609('0x9d'))](_0x9609('0xe2'));}})[_0x9609('0x23')](function(_0x4a7835){_0x549f0c=_0x4a7835['length'];if(!_0x5aefbd[_0x9609('0x51')]['hasOwnProperty']('nolimit')){_0x1c5626[_0x9609('0x1e')]=qs['limit'](_0x5aefbd[_0x9609('0x51')][_0x9609('0x1e')]);_0x1c5626[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x5aefbd['query']['offset']);}switch(_0x2b0fb0['role']){case _0x9609('0x34'):return db[_[_0x9609('0xae')](_0x5aefbd[_0x9609('0x51')][_0x9609('0xa8')])+_0x9609('0xdc')]['findAll'](_0x1c5626);case'user':case _0x9609('0x2f'):return _0x2b0fb0[_0x9609('0x33')+_[_0x9609('0xae')](_0x5aefbd[_0x9609('0x51')][_0x9609('0xa8')])+_0x9609('0xb0')](_0x1c5626);}})[_0x9609('0x23')](function(_0x55cbe5){return{'count':_0x549f0c,'rows':_0x55cbe5};})[_0x9609('0x23')](respondWithResult(_0x1eca5e,null))[_0x9609('0x2d')](handleError(_0x1eca5e,null));};exports[_0x9609('0xe3')]=function(_0x239a27,_0x4ad956){var _0x9924c0={};var _0x4ac288={};var _0x1fa72f;var _0x5afd98;return db[_0x9609('0x4f')]['findOne']({'where':{'id':_0x239a27[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x4ad956,null))[_0x9609('0x23')](function(_0x4bf430){if(_0x4bf430){_0x1fa72f=_0x4bf430;_0x4ac288[_0x9609('0xdb')]=_[_0x9609('0xdd')](db[_0x9609('0xb7')][_0x9609('0x42')]);_0x4ac288[_0x9609('0x51')]=_['keys'](_0x239a27[_0x9609('0x51')]);_0x4ac288[_0x9609('0xe1')]=_[_0x9609('0xe4')](_0x4ac288[_0x9609('0xdb')],_0x4ac288[_0x9609('0x51')]);_0x9924c0[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x4ac288[_0x9609('0xdb')],qs['fields'](_0x239a27[_0x9609('0x51')]['fields']));_0x9924c0[_0x9609('0x56')]=_0x9924c0['attributes'][_0x9609('0x5b')]?_0x9924c0[_0x9609('0x56')]:_0x4ac288['model'];_0x9924c0[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x239a27[_0x9609('0x51')]['sort']);_0x9924c0[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_['pick'](_0x239a27['query'],_0x4ac288['filters']));if(_0x239a27[_0x9609('0x51')][_0x9609('0x38')]){_0x9924c0[_0x9609('0x4e')]=_[_0x9609('0x62')](_0x9924c0[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x9924c0[_0x9609('0x56')],function(_0x5eff46){var _0x13b6e4={};_0x13b6e4[_0x5eff46]={'$like':'%'+_0x239a27[_0x9609('0x51')][_0x9609('0x38')]+'%'};return _0x13b6e4;})});}_0x9924c0=_[_0x9609('0x62')]({},_0x9924c0,_0x239a27['options']);return _0x1fa72f[_0x9609('0xe3')](_0x9924c0);}})[_0x9609('0x23')](function(_0x1b8517){if(_0x1b8517){_0x5afd98=_0x1b8517['length'];if(!_0x239a27[_0x9609('0x51')][_0x9609('0xd6')]('nolimit')){_0x9924c0['limit']=qs[_0x9609('0x1e')](_0x239a27[_0x9609('0x51')][_0x9609('0x1e')]);_0x9924c0['offset']=qs[_0x9609('0x1c')](_0x239a27[_0x9609('0x51')][_0x9609('0x1c')]);}return _0x1fa72f[_0x9609('0xe3')](_0x9924c0);}})[_0x9609('0x23')](function(_0x36a1ee){if(_0x36a1ee){return _0x36a1ee?{'count':_0x5afd98,'rows':_0x36a1ee}:null;}})[_0x9609('0x23')](respondWithResult(_0x4ad956,null))[_0x9609('0x2d')](handleError(_0x4ad956,null));};exports[_0x9609('0xe5')]=function(_0x165a32,_0xcb6d4d){var _0x3be864={};var _0x35dd7a={};var _0x1bdd8f;var _0x942044;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x165a32[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0xcb6d4d,null))[_0x9609('0x23')](function(_0x8c8897){if(_0x8c8897){_0x1bdd8f=_0x8c8897;_0x35dd7a[_0x9609('0xdb')]=_[_0x9609('0xdd')](db[_0x9609('0xe6')][_0x9609('0x42')]);_0x35dd7a['query']=_['keys'](_0x165a32[_0x9609('0x51')]);_0x35dd7a[_0x9609('0xe1')]=_['intersection'](_0x35dd7a[_0x9609('0xdb')],_0x35dd7a['query']);_0x3be864[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x35dd7a['model'],qs[_0x9609('0xde')](_0x165a32[_0x9609('0x51')][_0x9609('0xde')]));_0x3be864[_0x9609('0x56')]=_0x3be864[_0x9609('0x56')][_0x9609('0x5b')]?_0x3be864[_0x9609('0x56')]:_0x35dd7a[_0x9609('0xdb')];_0x3be864['order']=qs['sort'](_0x165a32[_0x9609('0x51')][_0x9609('0xe0')]);_0x3be864['where']=qs[_0x9609('0xe1')](_[_0x9609('0xe7')](_0x165a32[_0x9609('0x51')],_0x35dd7a['filters']));if(_0x165a32[_0x9609('0x51')][_0x9609('0x38')]){_0x3be864[_0x9609('0x4e')]=_[_0x9609('0x62')](_0x3be864[_0x9609('0x4e')],{'$or':_['map'](_0x3be864[_0x9609('0x56')],function(_0x1980a0){var _0x52a1ac={};_0x52a1ac[_0x1980a0]={'$like':'%'+_0x165a32[_0x9609('0x51')][_0x9609('0x38')]+'%'};return _0x52a1ac;})});}_0x3be864=_['merge']({},_0x3be864,_0x165a32['options']);return _0x1bdd8f[_0x9609('0xe5')](_0x3be864);}})[_0x9609('0x23')](function(_0x40bdb3){if(_0x40bdb3){_0x942044=_0x40bdb3[_0x9609('0x5b')];if(!_0x165a32[_0x9609('0x51')][_0x9609('0xd6')]('nolimit')){_0x3be864[_0x9609('0x1e')]=qs[_0x9609('0x1e')](_0x165a32[_0x9609('0x51')][_0x9609('0x1e')]);_0x3be864[_0x9609('0x1c')]=qs['offset'](_0x165a32[_0x9609('0x51')][_0x9609('0x1c')]);}return _0x1bdd8f['getGroups'](_0x3be864);}})[_0x9609('0x23')](function(_0xafa405){if(_0xafa405){return _0xafa405?{'count':_0x942044,'rows':_0xafa405}:null;}})[_0x9609('0x23')](respondWithResult(_0xcb6d4d,null))[_0x9609('0x2d')](handleError(_0xcb6d4d,null));};exports[_0x9609('0xe8')]=function(_0x5054fa,_0x5a322b){var _0x465277={'raw':!![],'where':{}};var _0x572b01={};var _0x9b3e40={'count':0x0,'rows':[]};return db['User'][_0x9609('0xa3')]({'where':{'id':_0x5054fa[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x5a322b,null))['then'](function(_0x752f8f){if(_0x752f8f){_0x572b01[_0x9609('0xdb')]=_[_0x9609('0xdd')](db[_0x9609('0xe9')][_0x9609('0x42')]);_0x572b01[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x5054fa[_0x9609('0x51')]);_0x572b01['filters']=_[_0x9609('0xe4')](_0x572b01[_0x9609('0xdb')],_0x572b01['query']);_0x465277[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x572b01['model'],qs['fields'](_0x5054fa[_0x9609('0x51')][_0x9609('0xde')]));_0x465277[_0x9609('0x56')]=_0x465277['attributes'][_0x9609('0x5b')]?_0x465277[_0x9609('0x56')]:_0x572b01['model'];if(!_0x5054fa[_0x9609('0x51')]['hasOwnProperty'](_0x9609('0xea'))){_0x465277[_0x9609('0x1e')]=qs[_0x9609('0x1e')](_0x5054fa['query']['limit']);_0x465277[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x5054fa[_0x9609('0x51')]['offset']);}_0x465277[_0x9609('0xdf')]=qs['sort'](_0x5054fa[_0x9609('0x51')][_0x9609('0xe0')]);_0x465277[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_[_0x9609('0xe7')](_0x5054fa['query'],_0x572b01[_0x9609('0xe1')]));_0x465277[_0x9609('0x4e')][_0x9609('0xeb')]=_0x752f8f['id'];if(_0x5054fa[_0x9609('0x51')][_0x9609('0x38')]){_0x465277[_0x9609('0x4e')]=_[_0x9609('0x62')](_0x465277['where'],{'$or':_[_0x9609('0x43')](_0x465277[_0x9609('0x56')],function(_0x5e4c72){var _0x5f4789={};_0x5f4789[_0x5e4c72]={'$like':'%'+_0x5054fa[_0x9609('0x51')][_0x9609('0x38')]+'%'};return _0x5f4789;})});}_0x465277=_[_0x9609('0x62')]({},_0x465277,_0x5054fa['options']);return db['VoiceRecording'][_0x9609('0x1f')]({'where':_0x465277[_0x9609('0x4e')]})[_0x9609('0x23')](function(_0x2ba7fd){_0x9b3e40[_0x9609('0x1f')]=_0x2ba7fd;if(_0x5054fa['query'][_0x9609('0x50')]){_0x465277[_0x9609('0x53')]=[{'all':!![]}];}return db['VoiceRecording'][_0x9609('0x58')](_0x465277);})[_0x9609('0x23')](function(_0x18bb0b){_0x9b3e40[_0x9609('0x59')]=_0x18bb0b;return _0x9b3e40;});}})[_0x9609('0x23')](respondWithFilteredResult(_0x5a322b,_0x465277))[_0x9609('0x2d')](handleError(_0x5a322b,null));};exports[_0x9609('0xec')]=function(_0x546abd,_0x5ec9de){var _0x241d8d={'raw':!![],'where':{}};var _0x481cc0={};var _0x1501ef={'count':0x0,'rows':[]};return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x546abd['params']['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x5ec9de,null))[_0x9609('0x23')](function(_0x748639){if(_0x748639){_0x481cc0[_0x9609('0xdb')]=_[_0x9609('0xdd')](db[_0x9609('0xed')]['rawAttributes']);_0x481cc0[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x546abd[_0x9609('0x51')]);_0x481cc0[_0x9609('0xe1')]=_[_0x9609('0xe4')](_0x481cc0[_0x9609('0xdb')],_0x481cc0[_0x9609('0x51')]);_0x241d8d[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x481cc0['model'],qs['fields'](_0x546abd['query'][_0x9609('0xde')]));_0x241d8d[_0x9609('0x56')]=_0x241d8d['attributes']['length']?_0x241d8d[_0x9609('0x56')]:_0x481cc0[_0x9609('0xdb')];if(!_0x546abd[_0x9609('0x51')][_0x9609('0xd6')](_0x9609('0xea'))){_0x241d8d[_0x9609('0x1e')]=qs['limit'](_0x546abd[_0x9609('0x51')]['limit']);_0x241d8d[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x546abd[_0x9609('0x51')][_0x9609('0x1c')]);}_0x241d8d['order']=qs[_0x9609('0xe0')](_0x546abd[_0x9609('0x51')][_0x9609('0xe0')]);_0x241d8d[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_['pick'](_0x546abd[_0x9609('0x51')],_0x481cc0[_0x9609('0xe1')]));_0x241d8d[_0x9609('0x4e')][_0x9609('0xeb')]=_0x748639['id'];if(_0x546abd[_0x9609('0x51')][_0x9609('0x38')]){_0x241d8d['where']=_[_0x9609('0x62')](_0x241d8d[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x241d8d[_0x9609('0x56')],function(_0x5219df){var _0xcea398={};_0xcea398[_0x5219df]={'$like':'%'+_0x546abd[_0x9609('0x51')]['filter']+'%'};return _0xcea398;})});}_0x241d8d=_[_0x9609('0x62')]({},_0x241d8d,_0x546abd[_0x9609('0x63')]);return db['ScreenRecording'][_0x9609('0x1f')]({'where':_0x241d8d[_0x9609('0x4e')]})[_0x9609('0x23')](function(_0x4fe49c){_0x1501ef['count']=_0x4fe49c;if(_0x546abd[_0x9609('0x51')]['includeAll']){_0x241d8d['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x9609('0x58')](_0x241d8d);})['then'](function(_0x1ede6c){_0x1501ef[_0x9609('0x59')]=_0x1ede6c;return _0x1501ef;});}})[_0x9609('0x23')](respondWithFilteredResult(_0x5ec9de,_0x241d8d))[_0x9609('0x2d')](handleError(_0x5ec9de,null));};exports['getChatInteractions']=function(_0x1a8b47,_0x2670d7){var _0x2531ad={};var _0x59721e={};var _0x552764;var _0x2dec55;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x1a8b47[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x2670d7,null))[_0x9609('0x23')](function(_0x5f383d){if(_0x5f383d){_0x552764=_0x5f383d;_0x59721e[_0x9609('0xdb')]=_[_0x9609('0xdd')](db[_0x9609('0xee')][_0x9609('0x42')]);_0x59721e['query']=_[_0x9609('0xdd')](_0x1a8b47[_0x9609('0x51')]);_0x59721e[_0x9609('0xe1')]=_[_0x9609('0xe4')](_0x59721e[_0x9609('0xdb')],_0x59721e['query']);_0x2531ad[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x59721e[_0x9609('0xdb')],qs['fields'](_0x1a8b47[_0x9609('0x51')][_0x9609('0xde')]));_0x2531ad[_0x9609('0x56')]=_0x2531ad[_0x9609('0x56')][_0x9609('0x5b')]?_0x2531ad[_0x9609('0x56')]:_0x59721e[_0x9609('0xdb')];_0x2531ad[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x1a8b47[_0x9609('0x51')][_0x9609('0xe0')]);_0x2531ad[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_['pick'](_0x1a8b47[_0x9609('0x51')],_0x59721e[_0x9609('0xe1')]));if(_0x1a8b47['query'][_0x9609('0x38')]){_0x2531ad[_0x9609('0x4e')]=_[_0x9609('0x62')](_0x2531ad[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x2531ad['attributes'],function(_0x445c8d){var _0x2ea30a={};_0x2ea30a[_0x445c8d]={'$like':'%'+_0x1a8b47['query'][_0x9609('0x38')]+'%'};return _0x2ea30a;})});}_0x2531ad=_[_0x9609('0x62')]({},_0x2531ad,_0x1a8b47[_0x9609('0x63')]);return _0x552764[_0x9609('0xef')](_0x2531ad);}})[_0x9609('0x23')](function(_0x3f7f79){if(_0x3f7f79){_0x2dec55=_0x3f7f79[_0x9609('0x5b')];if(!_0x1a8b47[_0x9609('0x51')]['hasOwnProperty'](_0x9609('0xea'))){_0x2531ad[_0x9609('0x1e')]=qs['limit'](_0x1a8b47[_0x9609('0x51')][_0x9609('0x1e')]);_0x2531ad['offset']=qs['offset'](_0x1a8b47[_0x9609('0x51')][_0x9609('0x1c')]);}return _0x552764[_0x9609('0xef')](_0x2531ad);}})[_0x9609('0x23')](function(_0x1b902c){if(_0x1b902c){return _0x1b902c?{'count':_0x2dec55,'rows':_0x1b902c}:null;}})[_0x9609('0x23')](respondWithResult(_0x2670d7,null))[_0x9609('0x2d')](handleError(_0x2670d7,null));};exports[_0x9609('0xf0')]=function(_0x15fbae,_0x392a35){var _0x5a1e37={};var _0x401dc0={};var _0x574d33;var _0x34683e;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x15fbae[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x392a35,null))['then'](function(_0x17cb36){if(_0x17cb36){_0x574d33=_0x17cb36;_0x401dc0['model']=_[_0x9609('0xdd')](db['OpenchannelInteraction']['rawAttributes']);_0x401dc0[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x15fbae[_0x9609('0x51')]);_0x401dc0[_0x9609('0xe1')]=_[_0x9609('0xe4')](_0x401dc0[_0x9609('0xdb')],_0x401dc0[_0x9609('0x51')]);_0x5a1e37['attributes']=_['intersection'](_0x401dc0[_0x9609('0xdb')],qs['fields'](_0x15fbae['query']['fields']));_0x5a1e37[_0x9609('0x56')]=_0x5a1e37[_0x9609('0x56')][_0x9609('0x5b')]?_0x5a1e37[_0x9609('0x56')]:_0x401dc0[_0x9609('0xdb')];_0x5a1e37[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x15fbae['query']['sort']);_0x5a1e37[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_['pick'](_0x15fbae[_0x9609('0x51')],_0x401dc0[_0x9609('0xe1')]));if(_0x15fbae[_0x9609('0x51')][_0x9609('0x38')]){_0x5a1e37[_0x9609('0x4e')]=_[_0x9609('0x62')](_0x5a1e37[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x5a1e37['attributes'],function(_0x1cfb71){var _0x3868e9={};_0x3868e9[_0x1cfb71]={'$like':'%'+_0x15fbae[_0x9609('0x51')]['filter']+'%'};return _0x3868e9;})});}_0x5a1e37=_[_0x9609('0x62')]({},_0x5a1e37,_0x15fbae[_0x9609('0x63')]);return _0x574d33[_0x9609('0xf0')](_0x5a1e37);}})[_0x9609('0x23')](function(_0x1a1df4){if(_0x1a1df4){_0x34683e=_0x1a1df4[_0x9609('0x5b')];if(!_0x15fbae[_0x9609('0x51')]['hasOwnProperty'](_0x9609('0xea'))){_0x5a1e37[_0x9609('0x1e')]=qs[_0x9609('0x1e')](_0x15fbae[_0x9609('0x51')]['limit']);_0x5a1e37[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x15fbae[_0x9609('0x51')][_0x9609('0x1c')]);}return _0x574d33[_0x9609('0xf0')](_0x5a1e37);}})[_0x9609('0x23')](function(_0x290785){if(_0x290785){return _0x290785?{'count':_0x34683e,'rows':_0x290785}:null;}})[_0x9609('0x23')](respondWithResult(_0x392a35,null))[_0x9609('0x2d')](handleError(_0x392a35,null));};exports[_0x9609('0xf1')]=function(_0x5f0471,_0x51792d){var _0x5c1b3b={'raw':!![],'where':{}};var _0x29e53a={};var _0x510a6d={'count':0x0,'rows':[]};return db['User'][_0x9609('0xa3')]({'where':{'id':_0x5f0471[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x51792d,null))['then'](function(_0x6b5f5e){if(_0x6b5f5e){_0x29e53a[_0x9609('0xdb')]=_[_0x9609('0xdd')](db['MailInteraction'][_0x9609('0x42')]);_0x29e53a[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x5f0471['query']);_0x29e53a[_0x9609('0xe1')]=_['intersection'](_0x29e53a['model'],_0x29e53a['query']);_0x5c1b3b[_0x9609('0x56')]=_['intersection'](_0x29e53a[_0x9609('0xdb')],qs[_0x9609('0xde')](_0x5f0471[_0x9609('0x51')]['fields']));_0x5c1b3b['attributes']=_0x5c1b3b['attributes']['length']?_0x5c1b3b[_0x9609('0x56')]:_0x29e53a[_0x9609('0xdb')];if(!_0x5f0471[_0x9609('0x51')][_0x9609('0xd6')](_0x9609('0xea'))){_0x5c1b3b[_0x9609('0x1e')]=qs[_0x9609('0x1e')](_0x5f0471[_0x9609('0x51')][_0x9609('0x1e')]);_0x5c1b3b['offset']=qs[_0x9609('0x1c')](_0x5f0471[_0x9609('0x51')][_0x9609('0x1c')]);}_0x5c1b3b[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x5f0471[_0x9609('0x51')][_0x9609('0xe0')]);_0x5c1b3b[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_[_0x9609('0xe7')](_0x5f0471[_0x9609('0x51')],_0x29e53a[_0x9609('0xe1')]));_0x5c1b3b[_0x9609('0x4e')][_0x9609('0xeb')]=_0x6b5f5e['id'];if(_0x5f0471[_0x9609('0x51')][_0x9609('0x38')]){_0x5c1b3b['where']=_[_0x9609('0x62')](_0x5c1b3b[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x5c1b3b[_0x9609('0x56')],function(_0x35ebee){var _0x476a88={};_0x476a88[_0x35ebee]={'$like':'%'+_0x5f0471['query'][_0x9609('0x38')]+'%'};return _0x476a88;})});}_0x5c1b3b=_['merge']({},_0x5c1b3b,_0x5f0471[_0x9609('0x63')]);return db['MailInteraction'][_0x9609('0x1f')]({'where':_0x5c1b3b['where']})[_0x9609('0x23')](function(_0x5e0f92){_0x510a6d[_0x9609('0x1f')]=_0x5e0f92;if(_0x5f0471[_0x9609('0x51')][_0x9609('0x50')]){_0x5c1b3b[_0x9609('0x53')]=[{'all':!![]}];}return db[_0x9609('0xf2')][_0x9609('0x58')](_0x5c1b3b);})[_0x9609('0x23')](function(_0x952103){_0x510a6d[_0x9609('0x59')]=_0x952103;return _0x510a6d;});}})[_0x9609('0x23')](respondWithFilteredResult(_0x51792d,_0x5c1b3b))[_0x9609('0x2d')](handleError(_0x51792d,null));};exports[_0x9609('0xf3')]=function(_0x454e5b,_0x4567e7){var _0x2584d4={};var _0x307825={};var _0x39994f;var _0x287eb3;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x454e5b[_0x9609('0x61')]['id']}})['then'](handleEntityNotFound(_0x4567e7,null))[_0x9609('0x23')](function(_0x153a56){if(_0x153a56){_0x39994f=_0x153a56;_0x307825[_0x9609('0xdb')]=_['keys'](db[_0x9609('0xf4')]['rawAttributes']);_0x307825[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x454e5b[_0x9609('0x51')]);_0x307825[_0x9609('0xe1')]=_['intersection'](_0x307825[_0x9609('0xdb')],_0x307825[_0x9609('0x51')]);_0x2584d4[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x307825[_0x9609('0xdb')],qs[_0x9609('0xde')](_0x454e5b[_0x9609('0x51')][_0x9609('0xde')]));_0x2584d4[_0x9609('0x56')]=_0x2584d4[_0x9609('0x56')][_0x9609('0x5b')]?_0x2584d4[_0x9609('0x56')]:_0x307825[_0x9609('0xdb')];_0x2584d4['order']=qs[_0x9609('0xe0')](_0x454e5b[_0x9609('0x51')][_0x9609('0xe0')]);_0x2584d4[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_['pick'](_0x454e5b[_0x9609('0x51')],_0x307825[_0x9609('0xe1')]));if(_0x454e5b[_0x9609('0x51')][_0x9609('0x38')]){_0x2584d4[_0x9609('0x4e')]=_[_0x9609('0x62')](_0x2584d4[_0x9609('0x4e')],{'$or':_['map'](_0x2584d4['attributes'],function(_0x5aca35){var _0x40f7de={};_0x40f7de[_0x5aca35]={'$like':'%'+_0x454e5b['query']['filter']+'%'};return _0x40f7de;})});}_0x2584d4=_[_0x9609('0x62')]({},_0x2584d4,_0x454e5b[_0x9609('0x63')]);return _0x39994f['getSmsInteractions'](_0x2584d4);}})[_0x9609('0x23')](function(_0x3456f4){if(_0x3456f4){_0x287eb3=_0x3456f4[_0x9609('0x5b')];if(!_0x454e5b['query']['hasOwnProperty'](_0x9609('0xea'))){_0x2584d4[_0x9609('0x1e')]=qs[_0x9609('0x1e')](_0x454e5b[_0x9609('0x51')][_0x9609('0x1e')]);_0x2584d4[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x454e5b[_0x9609('0x51')]['offset']);}return _0x39994f['getSmsInteractions'](_0x2584d4);}})[_0x9609('0x23')](function(_0x394516){if(_0x394516){return _0x394516?{'count':_0x287eb3,'rows':_0x394516}:null;}})['then'](respondWithResult(_0x4567e7,null))[_0x9609('0x2d')](handleError(_0x4567e7,null));};exports[_0x9609('0xf5')]=function(_0x49a991,_0x43b433){var _0x1aa00a={};var _0x4a40b4={};var _0x402615;var _0x110738;return db['User'][_0x9609('0xa3')]({'where':{'id':_0x49a991['params']['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x43b433,null))[_0x9609('0x23')](function(_0xce1c0c){if(_0xce1c0c){_0x402615=_0xce1c0c;_0x4a40b4[_0x9609('0xdb')]=_[_0x9609('0xdd')](db['FaxInteraction'][_0x9609('0x42')]);_0x4a40b4[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x49a991[_0x9609('0x51')]);_0x4a40b4[_0x9609('0xe1')]=_[_0x9609('0xe4')](_0x4a40b4['model'],_0x4a40b4['query']);_0x1aa00a['attributes']=_[_0x9609('0xe4')](_0x4a40b4[_0x9609('0xdb')],qs[_0x9609('0xde')](_0x49a991['query'][_0x9609('0xde')]));_0x1aa00a['attributes']=_0x1aa00a[_0x9609('0x56')][_0x9609('0x5b')]?_0x1aa00a[_0x9609('0x56')]:_0x4a40b4['model'];_0x1aa00a[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x49a991['query']['sort']);_0x1aa00a[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_[_0x9609('0xe7')](_0x49a991[_0x9609('0x51')],_0x4a40b4[_0x9609('0xe1')]));if(_0x49a991[_0x9609('0x51')][_0x9609('0x38')]){_0x1aa00a[_0x9609('0x4e')]=_['merge'](_0x1aa00a[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x1aa00a[_0x9609('0x56')],function(_0x384f92){var _0x30e010={};_0x30e010[_0x384f92]={'$like':'%'+_0x49a991[_0x9609('0x51')][_0x9609('0x38')]+'%'};return _0x30e010;})});}_0x1aa00a=_[_0x9609('0x62')]({},_0x1aa00a,_0x49a991[_0x9609('0x63')]);return _0x402615[_0x9609('0xf5')](_0x1aa00a);}})[_0x9609('0x23')](function(_0x579081){if(_0x579081){_0x110738=_0x579081['length'];if(!_0x49a991[_0x9609('0x51')][_0x9609('0xd6')](_0x9609('0xea'))){_0x1aa00a[_0x9609('0x1e')]=qs[_0x9609('0x1e')](_0x49a991[_0x9609('0x51')][_0x9609('0x1e')]);_0x1aa00a[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x49a991['query'][_0x9609('0x1c')]);}return _0x402615['getFaxInteractions'](_0x1aa00a);}})[_0x9609('0x23')](function(_0x16e465){if(_0x16e465){return _0x16e465?{'count':_0x110738,'rows':_0x16e465}:null;}})[_0x9609('0x23')](respondWithResult(_0x43b433,null))[_0x9609('0x2d')](handleError(_0x43b433,null));};exports[_0x9609('0xf6')]=function(_0x2a1547,_0x15f1d7){var _0xec36d9={};var _0x12bab6={};var _0x2a36fe;var _0x5dd4cb;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x2a1547[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x15f1d7,null))[_0x9609('0x23')](function(_0x4da2f5){if(_0x4da2f5){_0x2a36fe=_0x4da2f5;_0x12bab6[_0x9609('0xdb')]=_[_0x9609('0xdd')](db[_0x9609('0xf7')][_0x9609('0x42')]);_0x12bab6[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x2a1547[_0x9609('0x51')]);_0x12bab6['filters']=_['intersection'](_0x12bab6[_0x9609('0xdb')],_0x12bab6[_0x9609('0x51')]);_0xec36d9[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x12bab6[_0x9609('0xdb')],qs[_0x9609('0xde')](_0x2a1547[_0x9609('0x51')][_0x9609('0xde')]));_0xec36d9['attributes']=_0xec36d9[_0x9609('0x56')][_0x9609('0x5b')]?_0xec36d9['attributes']:_0x12bab6['model'];_0xec36d9[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x2a1547[_0x9609('0x51')][_0x9609('0xe0')]);_0xec36d9[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_[_0x9609('0xe7')](_0x2a1547[_0x9609('0x51')],_0x12bab6[_0x9609('0xe1')]));if(_0x2a1547['query'][_0x9609('0x38')]){_0xec36d9['where']=_['merge'](_0xec36d9[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0xec36d9[_0x9609('0x56')],function(_0x1a58fd){var _0x3959cd={};_0x3959cd[_0x1a58fd]={'$like':'%'+_0x2a1547[_0x9609('0x51')]['filter']+'%'};return _0x3959cd;})});}_0xec36d9=_[_0x9609('0x62')]({},_0xec36d9,_0x2a1547[_0x9609('0x63')]);return _0x2a36fe[_0x9609('0xf6')](_0xec36d9);}})['then'](function(_0x519f25){if(_0x519f25){_0x5dd4cb=_0x519f25[_0x9609('0x5b')];if(!_0x2a1547['query'][_0x9609('0xd6')](_0x9609('0xea'))){_0xec36d9['limit']=qs[_0x9609('0x1e')](_0x2a1547[_0x9609('0x51')][_0x9609('0x1e')]);_0xec36d9['offset']=qs['offset'](_0x2a1547[_0x9609('0x51')][_0x9609('0x1c')]);}return _0x2a36fe[_0x9609('0xf6')](_0xec36d9);}})[_0x9609('0x23')](function(_0x151e8f){if(_0x151e8f){return _0x151e8f?{'count':_0x5dd4cb,'rows':_0x151e8f}:null;}})[_0x9609('0x23')](respondWithResult(_0x15f1d7,null))[_0x9609('0x2d')](handleError(_0x15f1d7,null));};exports[_0x9609('0xf8')]=function(_0x667066,_0x403bcf,_0x10da50){var _0x12876d;var _0x1e6ac1;var _0x3abc38;var _0x3a2351=!_[_0x9609('0x71')](_0x667066['params']['id'])?_0x667066[_0x9609('0x61')]['id']:!_[_0x9609('0x71')](_0x667066['user']['id'])?_0x667066[_0x9609('0x35')]['id']:null;return db[_0x9609('0x4f')][_0x9609('0x3c')]({'where':{'id':_0x3a2351,'role':{'$or':[_0x9609('0x34'),_0x9609('0x35'),_0x9609('0x2f')]}},'attributes':['id','name',_0x9609('0xf9'),_0x9609('0xfa'),_0x9609('0x2e'),_0x9609('0x6c'),_0x9609('0xfb')]})[_0x9609('0x23')](function(_0x413a9f){if(_0x413a9f){if(_0x413a9f[_0x9609('0x2e')]===_0x9609('0x2f')){_0x12876d=_0x413a9f;if(_0x667066[_0x9609('0x67')][_0x9609('0xab')]){_0x3abc38=util[_0x9609('0xb6')](_0x9609('0xfc'),_0x12876d[_0x667066['body'][_0x9609('0xab')]]);}else if(_0x667066['body'][_0x9609('0xfd')]){_0x3abc38=util[_0x9609('0xb6')](_0x9609('0xfe'),_0x667066['body'][_0x9609('0xfd')]);}else{_0x3abc38=util[_0x9609('0xb6')](_0x9609('0xfe'),_0x12876d[_0x9609('0x3d')]);}socket['to'](util['format'](_0x9609('0xff'),_0x12876d['name']))[_0x9609('0x30')]('user:forcelogout',{'user':{'id':_0x12876d['id'],'name':_0x12876d['name']},'ip':_0x667066[_0x9609('0x100')][_0x9609('0x101')]||_0x667066[_0x9609('0x102')][_0x9609('0x103')]||_0x667066[_0x9609('0x104')][_0x9609('0x103')]||_0x667066['connection']['socket'][_0x9609('0x103')]});return new Promise(function(_0x472ed8,_0x48fa95){db['sequelize']['transaction']()['then'](_0x2a93f7=>{db[_0x9609('0xb7')]['destroy']({'where':{'membername':_0x12876d['name']},'individualHooks':!![]},{'transaction':_0x2a93f7})[_0x9609('0x23')](function(){return _0x2a93f7['commit']();})[_0x9609('0x23')](_0x472ed8)[_0x9609('0x2d')](_0x48fa95);});});}}else{throw new db['Sequelize'][(_0x9609('0x9d'))](_0x9609('0x105'));}})[_0x9609('0x23')](function(){if(_0x12876d){return _0x12876d[_0x9609('0x106')]({'raw':!![]});}})[_0x9609('0x23')](function(_0x39ed64){if(_0x12876d){if(_0x39ed64){_0x1e6ac1=_0x39ed64;if(_0x1e6ac1['length']){var _0xb55cd8=_0x1e6ac1[_0x9609('0x43')](function(_0xdde1ec){return{'membername':_0x12876d[_0x9609('0x3d')],'UserId':_0x12876d['id'],'queue_name':_0xdde1ec[_0x9609('0x3d')],'VoiceQueueId':_0xdde1ec['id'],'interface':_0x3abc38,'paused':_0x12876d['loginInPause']||![],'penalty':_0xdde1ec['UserVoiceQueue.penalty']||0x0};});return db[_0x9609('0xb7')][_0x9609('0x93')](_0xb55cd8);}}}})['then'](function(){if(_0x12876d){return db[_0x9609('0x107')][_0x9609('0x58')]({'where':{'membername':_0x12876d[_0x9609('0x3d')],'exitAt':null}});}})[_0x9609('0x23')](function(_0x3602ac){if(_0x12876d){var _0x214278=[];_0x3602ac[_0x9609('0x108')](function(_0x515e28){_0x214278[_0x9609('0x57')](_0x515e28[_0x9609('0x66')]({'exitAt':moment()['format'](_0x9609('0x109'))}));});return Promise[_0x9609('0x60')](_0x214278);}})[_0x9609('0x23')](function(){if(_0x12876d){var _0x498844=[];var _0x5e8b09=[];var _0xd7c747=utils[_0x9609('0x10a')]();var _0x4f9414={'membername':_0x12876d[_0x9609('0x3d')],'interface':_0x3abc38,'enterAt':moment()[_0x9609('0xb6')](_0x9609('0x109')),'role':_0x12876d[_0x9609('0x2e')],'internal':_0x12876d[_0x9609('0x6c')]};_0xd7c747[_0x9609('0x108')](function(_0x432ad1){_0x498844['push'](_[_0x9609('0x62')]({'channel':_0x432ad1,'type':_0x9609('0x10b'),'data1':_0x667066[_0x9609('0x67')][_0x9609('0x10c')],'data2':_0x3abc38},_0x4f9414));if(_0x12876d[_0x9609('0xfb')]){_0x5e8b09[_0x9609('0x57')](_['merge']({'channel':_0x432ad1,'type':_0x9609('0x10d'),'data1':_0x9609('0x10e')},_0x4f9414));}});return db[_0x9609('0x107')][_0x9609('0x93')](_0x498844[_0x9609('0xd4')](_0x5e8b09),{'individualHooks':!![]});}})[_0x9609('0x23')](function(){if(_0x12876d){return _0x12876d['update']({'online':!![],'lastLoginAt':moment()[_0x9609('0xb6')](_0x9609('0x109')),'voicePause':_0x12876d[_0x9609('0xfb')]||![],'mailPause':_0x12876d[_0x9609('0xfb')]||![],'chatPause':_0x12876d[_0x9609('0xfb')]||![],'faxPause':_0x12876d[_0x9609('0xfb')]||![],'smsPause':_0x12876d[_0x9609('0xfb')]||![],'openchannelPause':_0x12876d[_0x9609('0xfb')]||![],'whatsappPause':_0x12876d[_0x9609('0xfb')]||![],'pauseType':_0x12876d[_0x9609('0xfb')]?_0x9609('0x10e'):null,'interface':_0x3abc38,'lastPauseAt':moment()[_0x9609('0xb6')](_0x9609('0x109'))});}})[_0x9609('0x23')](function(_0x52135f){if(_0x667066[_0x9609('0x10f')]){return _0x10da50();}else{return Promise['resolve'](_0x52135f)['then'](respondWithResult(_0x403bcf,null));}})['catch'](handleError(_0x403bcf,null));};exports[_0x9609('0x110')]=function(_0x20eee3,_0x59461e){var _0x24d45d;return db[_0x9609('0x4f')][_0x9609('0x3c')]({'where':{'id':_0x20eee3[_0x9609('0x61')]['id'],'role':_0x9609('0x2f')},'attributes':['id',_0x9609('0x3d'),_0x9609('0x2e')]})[_0x9609('0x23')](handleEntityNotFound(_0x59461e,null))[_0x9609('0x23')](function(_0x390382){if(_0x390382){_0x24d45d=_0x390382;return db['UserVoiceQueueRt'][_0x9609('0x32')]({'where':{'membername':_0x24d45d[_0x9609('0x3d')]},'individualHooks':!![]});}})[_0x9609('0x23')](function(){return db['MemberReport'][_0x9609('0x58')]({'where':{'membername':_0x24d45d[_0x9609('0x3d')],'exitAt':null}});})['then'](function(_0x593556){var _0x40b57b=[];_0x593556['forEach'](function(_0x15a102){_0x40b57b['push'](_0x15a102[_0x9609('0x66')]({'exitAt':moment()[_0x9609('0xb6')](_0x9609('0x109'))}));});return Promise[_0x9609('0x60')](_0x40b57b);})['then'](function(){return _0x24d45d[_0x9609('0x66')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x59461e,null))[_0x9609('0x2d')](handleError(_0x59461e,null));};exports[_0x9609('0x111')]=function(_0x444f24,_0x7f23e3){var _0x53d146;return db['UserVoiceQueueRt'][_0x9609('0x66')]({'paused':0x1},{'where':{'UserId':_0x444f24[_0x9609('0x61')]['id']},'individualHooks':!![]})[_0x9609('0x23')](function(){return db['User'][_0x9609('0x3c')]({'where':{'id':_0x444f24['params']['id'],'role':_0x9609('0x2f')},'attributes':['id',_0x9609('0x3d'),_0x9609('0x2e'),_0x9609('0x6c'),_0x9609('0xab'),_0x9609('0xa9')]});})[_0x9609('0x23')](handleEntityNotFound(_0x7f23e3,null))[_0x9609('0x23')](function(_0x2c1e1f){if(_0x2c1e1f){_0x53d146=_0x2c1e1f;return respondWithRpcPromise(_0x9609('0x112'),_0x9609('0x111'),{'id':_0x53d146['id'],'name':_0x53d146[_0x9609('0x3d')],'pause':!![]});}})[_0x9609('0x23')](function(){if(_0x53d146){return db[_0x9609('0x107')][_0x9609('0x58')]({'where':{'membername':_0x53d146['name'],'type':'PAUSE','exitAt':null}});}})[_0x9609('0x23')](function(_0x1f9972){if(_0x1f9972[_0x9609('0x5b')]){var _0x312a09=moment()[_0x9609('0xb6')](_0x9609('0x109'));for(var _0x8a84c1=0x0,_0x12cfb4=_0x1f9972[_0x9609('0x5b')];_0x8a84c1<_0x12cfb4;_0x8a84c1++){_0x1f9972[_0x8a84c1]['updateAttributes']({'exitAt':_0x312a09});}}})['then'](function(){var _0x4e03f2=[];var _0xc813c0=utils['getChannels']();_0xc813c0[_0x9609('0x108')](function(_0x4af404){_0x4e03f2[_0x9609('0x57')]({'channel':_0x4af404,'membername':_0x53d146[_0x9609('0x3d')],'interface':_[_0x9609('0x71')](_0x53d146['interface'])?util[_0x9609('0xb6')](_0x9609('0xfe'),_0x53d146[_0x9609('0x3d')]):_0x53d146[_0x9609('0xab')],'type':_0x9609('0x10d'),'enterAt':moment()[_0x9609('0xb6')](_0x9609('0x109')),'data1':_0x444f24[_0x9609('0x67')][_0x9609('0x45')]||'DEFAULT\x20PAUSE','role':_0x53d146[_0x9609('0x2e')],'internal':_0x53d146['internal']});});return db['MemberReport']['bulkCreate'](_0x4e03f2,{'individualHooks':!![]});})[_0x9609('0x23')](function(){return _0x53d146[_0x9609('0x66')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x444f24[_0x9609('0x67')][_0x9609('0x45')]||_0x9609('0x113'),'lastPauseAt':moment()[_0x9609('0xb6')](_0x9609('0x109'))});})[_0x9609('0x23')](respondWithResult(_0x7f23e3,null))[_0x9609('0x2d')](handleError(_0x7f23e3,null));};exports[_0x9609('0x114')]=function(_0x417e2d,_0x16f846){if(_0x417e2d[_0x9609('0x67')][_0x9609('0xa8')]&&!utils['isValidChannel'](_0x417e2d['body'][_0x9609('0xa8')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x417e2d[_0x9609('0x67')][_0x9609('0xa8')]));}return db[_0x9609('0x4f')][_0x9609('0x3c')]({'where':{'id':_0x417e2d[_0x9609('0x61')]['id']},'attributes':['id','name','role',_0x9609('0x6c'),_0x9609('0xab'),'online','voicePause',_0x9609('0x115'),_0x9609('0x116'),'faxPause','openchannelPause',_0x9609('0x117'),_0x9609('0x118'),_0x9609('0x119'),_0x9609('0x11a')]})[_0x9609('0x23')](function(_0x7cd5a3){if(!_0x7cd5a3){throw new APINotFoundError(util[_0x9609('0xb6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x417e2d[_0x9609('0x61')]['id']));}return _0x7cd5a3['unpause'](_0x417e2d[_0x9609('0x67')][_0x9609('0xa8')]);})[_0x9609('0x23')](respondWithResult(_0x16f846,null))[_0x9609('0x2d')](APIHandleError(_0x16f846));};exports[_0x9609('0x11b')]=function(_0x40a2f4,_0x150ddf){var _0x56595e={};var _0x5bcd42={};var _0x1bc2e1;var _0x523e47;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x40a2f4[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x150ddf,null))[_0x9609('0x23')](function(_0xf497a1){if(_0xf497a1){_0x1bc2e1=_0xf497a1;_0x5bcd42[_0x9609('0xdb')]=_[_0x9609('0xdd')](db[_0x9609('0x11c')][_0x9609('0x42')]);_0x5bcd42[_0x9609('0x51')]=_['keys'](_0x40a2f4['query']);_0x5bcd42['filters']=_[_0x9609('0xe4')](_0x5bcd42[_0x9609('0xdb')],_0x5bcd42[_0x9609('0x51')]);_0x56595e[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x5bcd42['model'],qs['fields'](_0x40a2f4[_0x9609('0x51')][_0x9609('0xde')]));_0x56595e[_0x9609('0x56')]=_0x56595e[_0x9609('0x56')]['length']?_0x56595e[_0x9609('0x56')]:_0x5bcd42[_0x9609('0xdb')];_0x56595e['order']=qs[_0x9609('0xe0')](_0x40a2f4[_0x9609('0x51')][_0x9609('0xe0')]);_0x56595e[_0x9609('0x4e')]=qs[_0x9609('0xe1')](_[_0x9609('0xe7')](_0x40a2f4[_0x9609('0x51')],_0x5bcd42[_0x9609('0xe1')]));if(_0x40a2f4[_0x9609('0x51')]['filter']){_0x56595e[_0x9609('0x4e')]=_['merge'](_0x56595e[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x56595e['attributes'],function(_0x87cbc7){var _0x361059={};_0x361059[_0x87cbc7]={'$like':'%'+_0x40a2f4['query'][_0x9609('0x38')]+'%'};return _0x361059;})});}_0x56595e=_[_0x9609('0x62')]({},_0x56595e,_0x40a2f4[_0x9609('0x63')]);return _0x1bc2e1[_0x9609('0x11b')](_0x56595e);}})[_0x9609('0x23')](function(_0x403b1e){if(_0x403b1e){_0x523e47=_0x403b1e['length'];if(!_0x40a2f4['query'][_0x9609('0xd6')](_0x9609('0xea'))){_0x56595e[_0x9609('0x1e')]=qs[_0x9609('0x1e')](_0x40a2f4[_0x9609('0x51')]['limit']);_0x56595e[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x40a2f4['query'][_0x9609('0x1c')]);}return _0x1bc2e1[_0x9609('0x11b')](_0x56595e);}})[_0x9609('0x23')](function(_0x33aaca){if(_0x33aaca){return _0x33aaca?{'count':_0x523e47,'rows':_0x33aaca}:null;}})[_0x9609('0x23')](respondWithResult(_0x150ddf,null))['catch'](handleError(_0x150ddf,null));};exports['addTeams']=function(_0x629c09,_0x4ec344){var _0x385014=_0x629c09[_0x9609('0x61')]['id'];var _0xe33e8e=_0x629c09[_0x9609('0x67')]?_0x629c09['body'][_0x9609('0x6b')]:null;var _0x56fd8e=[];return Promise[_0x9609('0x11d')]()[_0x9609('0x23')](function(){if(!_0xe33e8e)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x9609('0x23')](function(){return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x385014}});})[_0x9609('0x23')](function(_0x4ac6b0){if(!_0x4ac6b0)throw new APINotFoundError(util[_0x9609('0xb6')](_0x9609('0xd5'),_0x629c09[_0x9609('0x61')]['id']));return db['sequelize'][_0x9609('0x11e')](function(_0x23dd97){return _0x4ac6b0[_0x9609('0x11f')](_0xe33e8e,{'transaction':_0x23dd97})[_0x9609('0x23')](function(){return db[_0x9609('0x11c')][_0x9609('0x58')]({'where':{'id':{'$in':_0xe33e8e}}});})[_0x9609('0x23')](function(_0x2b8507){var _0x4bf4a0=_['map'](_0x2b8507,function(_0x32b765){return _0x32b765[_0x9609('0x120')]();});return Promise[_0x9609('0x60')](_0x4bf4a0);})[_0x9609('0x23')](function(_0xa732e5){_0x56fd8e=_['flattenDeep'](_0xa732e5);var _0x10c357=_[_0x9609('0x43')](_0x56fd8e,function(_0x29c1a0){return _0x29c1a0[_0x9609('0x121')](_0x4ac6b0['id'],{'transaction':_0x23dd97});});return Promise[_0x9609('0x60')](_0x10c357);})[_0x9609('0x23')](function(){if(!_0x4ac6b0[_0x9609('0xa9')])return;var _0x1318c9=_['filter'](_0x56fd8e,function(_0x1046b0){return _0x1046b0[_0x9609('0x122')]('channel')===_0x9609('0x123');});var _0x38230f=_['map'](_0x1318c9,function(_0x81e1d9){return db[_0x9609('0xb7')][_0x9609('0xb8')]({'membername':_0x4ac6b0[_0x9609('0x3d')],'UserId':_0x4ac6b0['id'],'queue_name':_0x81e1d9[_0x9609('0x3d')],'VoiceQueueId':_0x81e1d9['id'],'interface':_[_0x9609('0x71')](_0x4ac6b0[_0x9609('0xab')])?util[_0x9609('0xb6')]('SIP/%s',_0x4ac6b0[_0x9609('0x3d')]):_0x4ac6b0[_0x9609('0xab')],'paused':_0x4ac6b0['voicePause']||![],'penalty':_0x4ac6b0[_0x9609('0xb1')]},{'transaction':_0x23dd97});});return Promise[_0x9609('0x60')](_0x38230f);})[_0x9609('0x23')](function(){return db['TeamVoicePrefix'][_0x9609('0x58')]({'where':{'teamId':{'$in':_0xe33e8e}}});})[_0x9609('0x23')](function(_0xe565ba){var _0x3ba85f=_[_0x9609('0x43')](_0xe565ba,function(_0x5b8a6c){return db['UserVoicePrefix']['create']({'UserId':_0x4ac6b0['id'],'VoicePrefixId':_0x5b8a6c[_0x9609('0x124')]},{'transaction':_0x23dd97});});return Promise[_0x9609('0x60')](_0x3ba85f);});});})['then'](function(){for(var _0x4ec464=0x0;_0x4ec464<_0x56fd8e['length'];_0x4ec464++){var _0x593785=_0x56fd8e[_0x4ec464][_0x9609('0x122')](_0x9609('0xa8'));var _0x227afb=_0x593785+_0x9609('0xbd');socket[_0x9609('0x30')]('user'+_0x593785+'Queue:save',{'UserId':_0x385014,['queueField']:_0x56fd8e[_0x4ec464]['id']});}})[_0x9609('0x23')](respondWithStatusCode(_0x4ec344,null))['catch'](APIHandleError(_0x4ec344));};exports[_0x9609('0x125')]=function(_0xc8aabe,_0xdbd5cc){var _0x42086a=_0xc8aabe['params']['id'];var _0xd5f4df=null;if(_0xc8aabe[_0x9609('0x51')][_0x9609('0x6b')]){_0xd5f4df=_[_0x9609('0xbc')](_0xc8aabe[_0x9609('0x51')][_0x9609('0x6b')])?_0xc8aabe[_0x9609('0x51')]['ids']:[_0xc8aabe[_0x9609('0x51')][_0x9609('0x6b')]];}var _0xf3478f=[];return Promise[_0x9609('0x11d')]()[_0x9609('0x23')](function(){if(!_0xd5f4df)throw new APIBadRequestError(_0x9609('0x126'));})[_0x9609('0x23')](function(){return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x42086a}});})['then'](function(_0xf8869a){if(!_0xf8869a)throw new APINotFoundError(util[_0x9609('0xb6')](_0x9609('0xd5'),_0xc8aabe[_0x9609('0x61')]['id']));return db[_0x9609('0x73')][_0x9609('0x11e')](function(_0x2e3227){return _0xf8869a[_0x9609('0x125')](_0xd5f4df,{'transaction':_0x2e3227})[_0x9609('0x23')](function(){return db[_0x9609('0x11c')]['findAll']({'where':{'id':{'$in':_0xd5f4df}}});})[_0x9609('0x23')](function(_0x32cd61){var _0x3e5942=_['map'](_0x32cd61,function(_0x1e3938){return _0x1e3938[_0x9609('0x120')]();});return Promise[_0x9609('0x60')](_0x3e5942);})[_0x9609('0x23')](function(_0x9a1541){_0xf3478f=_[_0x9609('0x127')](_0x9a1541);var _0xfd9b5b=_[_0x9609('0x43')](_0xf3478f,function(_0x35b2b3){return _0x35b2b3[_0x9609('0x128')](_0xf8869a['id'],{'transaction':_0x2e3227});});return Promise[_0x9609('0x60')](_0xfd9b5b);})[_0x9609('0x23')](function(){if(!_0xf8869a[_0x9609('0xa9')])return;var _0x36542c=_[_0x9609('0x38')](_0xf3478f,function(_0x19b882){return _0x19b882['getDataValue'](_0x9609('0xa8'))===_0x9609('0x123');});var _0x490c2f=_[_0x9609('0x43')](_0x36542c,function(_0x2b6f67){return db[_0x9609('0xb7')][_0x9609('0x32')]({'where':{'VoiceQueueId':_0x2b6f67['id'],'UserId':_0xf8869a['id']},'transaction':_0x2e3227});});return Promise['all'](_0x490c2f);})[_0x9609('0x23')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0xd5f4df}}});})[_0x9609('0x23')](function(_0x2585ec){var _0x1f071e=_[_0x9609('0x43')](_0x2585ec,function(_0x1f40e3){return db[_0x9609('0x129')][_0x9609('0x32')]({'where':{'UserId':_0xf8869a['id'],'VoicePrefixId':_0x1f40e3['VoicePrefixId']}},{'transaction':_0x2e3227});});return Promise[_0x9609('0x60')](_0x1f071e);});});})[_0x9609('0x23')](function(){for(var _0x375f5f=0x0;_0x375f5f<_0xf3478f[_0x9609('0x5b')];_0x375f5f++){var _0x42c7cb=_0xf3478f[_0x375f5f][_0x9609('0x122')](_0x9609('0xa8'));var _0x25f6de=_0x42c7cb+_0x9609('0xbd');socket[_0x9609('0x30')]('user'+_0x42c7cb+_0x9609('0xbe'),{'UserId':_0x42086a,['queueField']:_0xf3478f[_0x375f5f]['id']});}})['then'](respondWithStatusCode(_0xdbd5cc,null))[_0x9609('0x2d')](APIHandleError(_0xdbd5cc));};exports['getLists']=function(_0x1ef30c,_0x5412e4){var _0xa8e71f={};var _0x4ed05c={};var _0xdd677;var _0x3b3fcc;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x1ef30c[_0x9609('0x61')]['id']}})[_0x9609('0x23')](handleEntityNotFound(_0x5412e4,null))[_0x9609('0x23')](function(_0x5b630b){if(_0x5b630b){_0xdd677=_0x5b630b;_0x4ed05c[_0x9609('0xdb')]=_['keys'](db['CmList'][_0x9609('0x42')]);_0x4ed05c['query']=_[_0x9609('0xdd')](_0x1ef30c[_0x9609('0x51')]);_0x4ed05c['filters']=_['intersection'](_0x4ed05c['model'],_0x4ed05c[_0x9609('0x51')]);_0xa8e71f[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x4ed05c[_0x9609('0xdb')],qs[_0x9609('0xde')](_0x1ef30c[_0x9609('0x51')][_0x9609('0xde')]));_0xa8e71f[_0x9609('0x56')]=_0xa8e71f[_0x9609('0x56')][_0x9609('0x5b')]?_0xa8e71f[_0x9609('0x56')]:_0x4ed05c[_0x9609('0xdb')];_0xa8e71f[_0x9609('0xdf')]=qs[_0x9609('0xe0')](_0x1ef30c[_0x9609('0x51')][_0x9609('0xe0')]);_0xa8e71f['where']=qs[_0x9609('0xe1')](_[_0x9609('0xe7')](_0x1ef30c[_0x9609('0x51')],_0x4ed05c[_0x9609('0xe1')]));if(_0x1ef30c['query']['filter']){_0xa8e71f['where']=_['merge'](_0xa8e71f[_0x9609('0x4e')],{'$or':_['map'](_0xa8e71f[_0x9609('0x56')],function(_0x5989fb){var _0x1ceaf8={};_0x1ceaf8[_0x5989fb]={'$like':'%'+_0x1ef30c['query'][_0x9609('0x38')]+'%'};return _0x1ceaf8;})});}_0xa8e71f=_[_0x9609('0x62')]({},_0xa8e71f,_0x1ef30c[_0x9609('0x63')]);return _0xdd677[_0x9609('0x12a')](_0xa8e71f);}})[_0x9609('0x23')](function(_0x4b8358){if(_0x4b8358){_0x3b3fcc=_0x4b8358[_0x9609('0x5b')];if(!_0x1ef30c[_0x9609('0x51')][_0x9609('0xd6')](_0x9609('0xea'))){_0xa8e71f['limit']=qs[_0x9609('0x1e')](_0x1ef30c[_0x9609('0x51')][_0x9609('0x1e')]);_0xa8e71f[_0x9609('0x1c')]=qs[_0x9609('0x1c')](_0x1ef30c[_0x9609('0x51')][_0x9609('0x1c')]);}return _0xdd677[_0x9609('0x12a')](_0xa8e71f);}})[_0x9609('0x23')](function(_0x1db6aa){if(_0x1db6aa){return _0x1db6aa?{'count':_0x3b3fcc,'rows':_0x1db6aa}:null;}})[_0x9609('0x23')](respondWithResult(_0x5412e4,null))[_0x9609('0x2d')](handleError(_0x5412e4,null));};exports['getAgents']=function(_0x4aaac7,_0x4889e9){var _0x28acdd={};var _0x6e8993={};var _0x56f3d8;return db[_0x9609('0x4f')][_0x9609('0xa3')]({'where':{'id':_0x4aaac7[_0x9609('0x61')]['id']}})['then'](handleEntityNotFound(_0x4889e9,null))[_0x9609('0x23')](function(_0x1ae5a8){if(_0x1ae5a8){_0x56f3d8=_0x1ae5a8;_0x6e8993[_0x9609('0xdb')]=_['keys'](db['User']['rawAttributes']);_0x6e8993[_0x9609('0x51')]=_[_0x9609('0xdd')](_0x4aaac7[_0x9609('0x51')]);_0x6e8993['filters']=_[_0x9609('0xe4')](_0x6e8993[_0x9609('0xdb')],_0x6e8993[_0x9609('0x51')]);_0x28acdd[_0x9609('0x56')]=_[_0x9609('0xe4')](_0x6e8993[_0x9609('0xdb')],qs['fields'](_0x4aaac7[_0x9609('0x51')][_0x9609('0xde')]));_0x28acdd[_0x9609('0x56')]=_0x28acdd[_0x9609('0x56')][_0x9609('0x5b')]?_0x28acdd['attributes']:_0x6e8993[_0x9609('0xdb')];_0x28acdd['order']=qs['sort'](_0x4aaac7[_0x9609('0x51')][_0x9609('0xe0')]);_0x28acdd[_0x9609('0x4e')]=qs['filters'](_[_0x9609('0xe7')](_0x4aaac7[_0x9609('0x51')],_0x6e8993['filters']));if(_0x4aaac7['query']['filter']){_0x28acdd[_0x9609('0x4e')]=_['merge'](_0x28acdd[_0x9609('0x4e')],{'$or':_[_0x9609('0x43')](_0x28acdd['attributes'],function(_0x3871f7){var _0x46aafc={};_0x46aafc[_0x3871f7]={'$like':'%'+_0x4aaac7[_0x9609('0x51')][_0x9609('0x38')]+'%'};return _0x46aafc;})});}_0x28acdd[_0x9609('0xdb')]=db[_0x9609('0x4f')];_0x28acdd['as']=_0x9609('0x91');_0x28acdd=_[_0x9609('0x62')]({},_0x28acdd,_0x4aaac7['options']);return _0x56f3d8[_0x9609('0x106')]({'include':[_0x28acdd]});}})[_0x9609('0x23')](function(_0x1a4929){if(_0x1a4929){var _0x332738={},_0x3fbad0=[];for(var _0x154ee4=0x0;_0x154ee4<_0x1a4929[_0x9609('0x5b')];_0x154ee4+=0x1){for(var _0x3159cc=0x0,_0x4eeb19;_0x3159cc<_0x1a4929[_0x154ee4][_0x9609('0x91')]['length'];_0x3159cc+=0x1){_0x4eeb19=_0x1a4929[_0x154ee4][_0x9609('0x91')][_0x3159cc][_0x9609('0x33')]({'plain':!![]});_0x332738[_0x4eeb19['id']]=_0x4eeb19;}}_0x332738=_['values'](_0x332738);for(var _0x4652f5=qs['offset'](_0x4aaac7[_0x9609('0x51')][_0x9609('0x1c')]);_0x4652f5<_0x332738[_0x9609('0x5b')]&&_0x3fbad0[_0x9609('0x5b')]=_0x516167[_0x5842('0x4d')]){throw new Error(_0x5842('0x4e'));}})['then'](function(){if(_0x44dd88){return db[_0x5842('0x26')][_0x5842('0x4f')]({'where':{'membername':_0x44dd88['name']},'individualHooks':!![]});}})[_0x5842('0x1e')](function(){if(_0x44dd88){return _0x44dd88[_0x5842('0x50')]({'raw':!![]});}})[_0x5842('0x1e')](function(_0x5f5c95){if(_0x44dd88){if(_0x5f5c95){var _0x3e87fe=[];_0x1c48b4=_0x5f5c95;if(_0x1c48b4[_0x5842('0x2a')]){for(var _0x4147af=0x0;_0x4147af<_0x1c48b4['length'];_0x4147af++){_0x3e87fe['push'](db[_0x5842('0x26')][_0x5842('0x51')]({'membername':_0x44dd88['name'],'UserId':_0x44dd88['id'],'queue_name':_0x1c48b4[_0x4147af][_0x5842('0x28')],'VoiceQueueId':_0x1c48b4[_0x4147af]['id'],'interface':_0x376504,'paused':_0x44dd88['loginInPause']||![],'penalty':_0x1c48b4[_0x4147af]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x3e87fe);}}}})[_0x5842('0x1e')](function(){if(_0x44dd88){return db['MemberReport'][_0x5842('0xf')]({'where':{'membername':_0x44dd88['name'],'exitAt':null}});}})['then'](function(_0x12239d){if(_0x44dd88){if(_0x12239d&&_0x12239d['length']){var _0x4557a1=[];_0x12239d[_0x5842('0x2e')](function(_0x184cfc){_0x4557a1[_0x5842('0x2f')](_0x184cfc['update']({'exitAt':moment()[_0x5842('0x30')](_0x5842('0x2b'))}));});return BPromise[_0x5842('0x44')](_0x4557a1);}}})[_0x5842('0x1e')](function(){if(_0x44dd88){var _0x1ea687=[];var _0x1565b2=[];var _0x5200be=utils['getChannels']();var _0x337647={'membername':_0x44dd88[_0x5842('0x28')],'interface':_0x376504,'enterAt':moment()[_0x5842('0x30')](_0x5842('0x2b')),'role':_0x44dd88[_0x5842('0x22')],'internal':_0x44dd88[_0x5842('0x35')]};_0x5200be['forEach'](function(_0x1b5008){_0x1ea687['push'](_[_0x5842('0x52')]({'channel':_0x1b5008,'type':'LOGIN','data1':_0x5842('0x53'),'data2':_0x376504},_0x337647));if(_0x44dd88[_0x5842('0x48')]){_0x1565b2[_0x5842('0x2f')](_[_0x5842('0x52')]({'channel':_0x1b5008,'type':_0x5842('0x29'),'data1':'LOGININPAUSE'},_0x337647));}});return db[_0x5842('0x27')][_0x5842('0x36')](_0x1ea687['concat'](_0x1565b2),{'individualHooks':!![]});}})['then'](function(){if(_0x44dd88){return _0x44dd88['update']({'online':!![],'lastLoginAt':moment()['format'](_0x5842('0x2b')),'voicePause':_0x44dd88[_0x5842('0x48')]||![],'mailPause':_0x44dd88['loginInPause']||![],'chatPause':_0x44dd88['loginInPause']||![],'faxPause':_0x44dd88[_0x5842('0x48')]||![],'smsPause':_0x44dd88[_0x5842('0x48')]||![],'openchannelPause':_0x44dd88['loginInPause']||![],'pauseType':_0x44dd88[_0x5842('0x48')]?_0x5842('0x54'):null,'lastPauseAt':moment()[_0x5842('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x376504});}})['then'](function(_0x3284f2){_0xcb14bc(_0x3284f2);})[_0x5842('0x1a')](function(_0xd89817){_0x35167c(_0x5df67d['error'](0x1f4,_0xd89817['message']));});});}; \ No newline at end of file +var _0x5dc8=['error','message','find','info','ShowUser','PauseUser','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','PAUSE','updateAttributes','getChannels','forEach','push','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','findOne','online','voicePause','mailPause','chatPause','openchannelPause','whatsappPause','system','LogoutUser','destroy','MemberReport','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','length','loginInPause','UserVoiceQueue.penalty','all','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5dc8,0xed));var _0x85dc=function(_0x31f5b0,_0x3ceb60){_0x31f5b0=_0x31f5b0-0x0;var _0x25dfd3=_0x5dc8[_0x31f5b0];return _0x25dfd3;};'use strict';var _=require(_0x85dc('0x0'));var util=require(_0x85dc('0x1'));var moment=require(_0x85dc('0x2'));var BPromise=require(_0x85dc('0x3'));var Redis=require(_0x85dc('0x4'));var db=require(_0x85dc('0x5'))['db'];var utils=require(_0x85dc('0x6'));var logger=require(_0x85dc('0x7'))(_0x85dc('0x8'));var config=require(_0x85dc('0x9'));config[_0x85dc('0xa')]=_['defaults'](config['redis'],{'host':_0x85dc('0xb'),'port':0x18eb});var socket=require(_0x85dc('0xc'))(new Redis(config[_0x85dc('0xa')]));require(_0x85dc('0xd'))[_0x85dc('0xe')](socket);exports[_0x85dc('0xf')]=function(_0x3e17d4){var _0x399062=this;return new Promise(function(_0x2a248a,_0x10df42){return db[_0x85dc('0x10')][_0x85dc('0x11')]({'raw':_0x3e17d4['options']?_0x3e17d4[_0x85dc('0x12')][_0x85dc('0x13')]===undefined?!![]:![]:!![],'where':_0x3e17d4[_0x85dc('0x12')]?_0x3e17d4[_0x85dc('0x12')][_0x85dc('0x14')]||null:null,'attributes':_0x3e17d4['options']?_0x3e17d4[_0x85dc('0x12')][_0x85dc('0x15')]||null:null,'limit':_0x3e17d4['options']?_0x3e17d4[_0x85dc('0x12')][_0x85dc('0x16')]||null:null,'include':_0x3e17d4[_0x85dc('0x12')]?_0x3e17d4[_0x85dc('0x12')][_0x85dc('0x17')]?_[_0x85dc('0x18')](_0x3e17d4[_0x85dc('0x12')][_0x85dc('0x17')],function(_0x3007ef){return{'model':db[_0x3007ef[_0x85dc('0x19')]],'as':_0x3007ef['as'],'attributes':_0x3007ef[_0x85dc('0x15')],'include':_0x3007ef['include']?_[_0x85dc('0x18')](_0x3007ef[_0x85dc('0x17')],function(_0x379ef8){return{'model':db[_0x379ef8[_0x85dc('0x19')]],'as':_0x379ef8['as'],'attributes':_0x379ef8['attributes'],'include':_0x379ef8[_0x85dc('0x17')]?_[_0x85dc('0x18')](_0x379ef8[_0x85dc('0x17')],function(_0x4a1ef9){return{'model':db[_0x4a1ef9[_0x85dc('0x19')]],'as':_0x4a1ef9['as'],'attributes':_0x4a1ef9['attributes']};}):[]};}):[]};}):[]:[]})[_0x85dc('0x1a')](function(_0x38362e){logger['info'](_0x85dc('0xf'),_0x3e17d4);logger[_0x85dc('0x1b')](_0x85dc('0xf'),_0x3e17d4,JSON[_0x85dc('0x1c')](_0x38362e));_0x2a248a(_0x38362e);})[_0x85dc('0x1d')](function(_0xb94df8){logger[_0x85dc('0x1e')](_0x85dc('0xf'),_0xb94df8[_0x85dc('0x1f')],_0x3e17d4);_0x10df42(_0x399062[_0x85dc('0x1e')](0x1f4,_0xb94df8[_0x85dc('0x1f')]));});});};exports['ShowUser']=function(_0x4f3360){var _0x4c2135=this;return new Promise(function(_0x57cf31,_0x36e8ec){return db[_0x85dc('0x10')][_0x85dc('0x20')]({'raw':_0x4f3360['options']?_0x4f3360[_0x85dc('0x12')][_0x85dc('0x13')]===undefined?!![]:![]:!![],'where':_0x4f3360[_0x85dc('0x12')]?_0x4f3360[_0x85dc('0x12')][_0x85dc('0x14')]||null:null,'attributes':_0x4f3360['options']?_0x4f3360[_0x85dc('0x12')][_0x85dc('0x15')]||null:null,'include':_0x4f3360['options']?_0x4f3360[_0x85dc('0x12')][_0x85dc('0x17')]?_[_0x85dc('0x18')](_0x4f3360[_0x85dc('0x12')][_0x85dc('0x17')],function(_0x447b55){return{'model':db[_0x447b55[_0x85dc('0x19')]],'as':_0x447b55['as'],'attributes':_0x447b55[_0x85dc('0x15')],'include':_0x447b55[_0x85dc('0x17')]?_['map'](_0x447b55[_0x85dc('0x17')],function(_0x23d23c){return{'model':db[_0x23d23c[_0x85dc('0x19')]],'as':_0x23d23c['as'],'attributes':_0x23d23c[_0x85dc('0x15')],'include':_0x23d23c[_0x85dc('0x17')]?_[_0x85dc('0x18')](_0x23d23c[_0x85dc('0x17')],function(_0x25b5c1){return{'model':db[_0x25b5c1[_0x85dc('0x19')]],'as':_0x25b5c1['as'],'attributes':_0x25b5c1[_0x85dc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x85dc('0x1a')](function(_0x55a390){logger[_0x85dc('0x21')](_0x85dc('0x22'),_0x4f3360);logger[_0x85dc('0x1b')](_0x85dc('0x22'),_0x4f3360,JSON['stringify'](_0x55a390));_0x57cf31(_0x55a390);})['catch'](function(_0x515321){logger[_0x85dc('0x1e')](_0x85dc('0x22'),_0x515321[_0x85dc('0x1f')],_0x4f3360);_0x36e8ec(_0x4c2135[_0x85dc('0x1e')](0x1f4,_0x515321[_0x85dc('0x1f')]));});});};exports[_0x85dc('0x23')]=function(_0x459781){var _0x1ecbe6;return db[_0x85dc('0x10')][_0x85dc('0x20')]({'where':_0x459781[_0x85dc('0x12')][_0x85dc('0x14')]||{},'attributes':['id',_0x85dc('0x24'),'role',_0x85dc('0x25'),_0x85dc('0x26')]})[_0x85dc('0x1a')](function(_0x3af25e){if(!_0x3af25e){throw new Error(util[_0x85dc('0x27')](_0x85dc('0x28'),_0x459781[_0x85dc('0x29')]['id']));}_0x1ecbe6=_0x3af25e;return db[_0x85dc('0x2a')][_0x85dc('0x2b')]({'paused':0x1},{'where':{'UserId':_0x1ecbe6['id']},'individualHooks':!![]});})[_0x85dc('0x1a')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x1ecbe6[_0x85dc('0x24')],'type':_0x85dc('0x2c'),'exitAt':null}});})[_0x85dc('0x1a')](function(_0x33ff19){if(_0x33ff19&&_0x33ff19['length']){var _0x5bb785=moment()[_0x85dc('0x27')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xd19c55=0x0,_0x302345=_0x33ff19['length'];_0xd19c55<_0x302345;_0xd19c55++){_0x33ff19[_0xd19c55][_0x85dc('0x2d')]({'exitAt':_0x5bb785});}}})[_0x85dc('0x1a')](function(){var _0x2bf758=[];var _0x165cbb=utils[_0x85dc('0x2e')]();_0x165cbb[_0x85dc('0x2f')](function(_0x1c3c7a){_0x2bf758[_0x85dc('0x30')]({'channel':_0x1c3c7a,'membername':_0x1ecbe6[_0x85dc('0x24')],'interface':_['isNil'](_0x1ecbe6[_0x85dc('0x26')])?util[_0x85dc('0x27')](_0x85dc('0x31'),_0x1ecbe6[_0x85dc('0x24')]):_0x1ecbe6[_0x85dc('0x26')],'type':_0x85dc('0x2c'),'enterAt':moment()[_0x85dc('0x27')](_0x85dc('0x32')),'data1':_0x459781[_0x85dc('0x33')][_0x85dc('0x34')]||_0x85dc('0x35'),'role':_0x1ecbe6[_0x85dc('0x36')],'internal':_0x1ecbe6[_0x85dc('0x25')],'uniqueid':_0x459781[_0x85dc('0x33')][_0x85dc('0x37')]||null});});return db['MemberReport'][_0x85dc('0x38')](_0x2bf758,{'individualHooks':!![]});})['then'](function(){return _0x1ecbe6[_0x85dc('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x459781[_0x85dc('0x33')][_0x85dc('0x34')]||_0x85dc('0x35'),'lastPauseAt':moment()['format'](_0x85dc('0x32'))});})[_0x85dc('0x1d')](function(_0x3b4401){throw _0x3b4401;});};exports[_0x85dc('0x39')]=function(_0x572d0a){return Promise[_0x85dc('0x3a')]()[_0x85dc('0x1a')](function(){if(_0x572d0a[_0x85dc('0x33')][_0x85dc('0x3b')]&&!utils[_0x85dc('0x3c')](_0x572d0a['body'][_0x85dc('0x3b')])){throw new Error(util[_0x85dc('0x27')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x572d0a[_0x85dc('0x33')][_0x85dc('0x3b')]));}return db[_0x85dc('0x10')][_0x85dc('0x3d')]({'where':_0x572d0a[_0x85dc('0x12')][_0x85dc('0x14')]||{},'attributes':['id',_0x85dc('0x24'),_0x85dc('0x36'),_0x85dc('0x25'),_0x85dc('0x26'),_0x85dc('0x3e'),_0x85dc('0x3f'),_0x85dc('0x40'),_0x85dc('0x41'),'faxPause',_0x85dc('0x42'),'smsPause',_0x85dc('0x43'),'pauseType','lastPauseAt']});})['then'](function(_0x7869c0){if(!_0x7869c0){throw new Error(util[_0x85dc('0x27')](_0x85dc('0x28'),_0x572d0a['params']['id']));}return _0x7869c0['unpause'](_0x572d0a[_0x85dc('0x33')][_0x85dc('0x3b')],_0x85dc('0x44'));})[_0x85dc('0x1d')](function(_0x5e88f3){throw _0x5e88f3;});};exports[_0x85dc('0x45')]=function(_0x50d0fd){var _0x5bd0ad=this;return new Promise(function(_0x32042d,_0x3013c5){var _0x162a01;return db[_0x85dc('0x10')][_0x85dc('0x3d')]({'where':_0x50d0fd['options']['where']||{},'attributes':['id',_0x85dc('0x24')]})[_0x85dc('0x1a')](function(_0x37e6d9){if(_0x37e6d9){_0x162a01=_0x37e6d9;return db[_0x85dc('0x2a')][_0x85dc('0x46')]({'where':{'membername':_0x162a01[_0x85dc('0x24')]},'individualHooks':!![]});}})[_0x85dc('0x1a')](function(){if(_0x162a01){return db[_0x85dc('0x47')][_0x85dc('0x11')]({'where':{'membername':_0x162a01[_0x85dc('0x24')],'exitAt':null}});}})[_0x85dc('0x1a')](function(_0x28daf5){if(_0x162a01){if(_0x28daf5&&_0x28daf5['length']){var _0x532e6d=[];_0x28daf5['forEach'](function(_0x3af770){_0x532e6d[_0x85dc('0x30')](_0x3af770[_0x85dc('0x2b')]({'exitAt':moment()[_0x85dc('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x532e6d);}}})[_0x85dc('0x1a')](function(){if(_0x162a01){return _0x162a01[_0x85dc('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x85dc('0x1a')](function(_0x423dc1){_0x32042d(_0x423dc1);})[_0x85dc('0x1d')](function(_0x2b3c7f){_0x3013c5(_0x5bd0ad[_0x85dc('0x1e')](0x1f4,_0x2b3c7f[_0x85dc('0x1f')]));});});};exports['LoginUser']=function(_0x26cdb){var _0x3b376b=this;return new Promise(function(_0x2b51be,_0x33b0e6){var _0x33aefe;var _0x58b4d4;var _0x554ff0;var _0x67e377;return db['User'][_0x85dc('0x3d')]({'where':_0x26cdb[_0x85dc('0x12')]['where']||{},'attributes':['id','name',_0x85dc('0x36'),_0x85dc('0x48'),_0x85dc('0x49'),'internal','loginInPause',_0x85dc('0x26')]})[_0x85dc('0x1a')](function(_0x18a8d4){if(_0x18a8d4){_0x33aefe=_0x18a8d4;_0x67e377=_0x26cdb[_0x85dc('0x33')][_0x85dc('0x26')]?_0x26cdb['body'][_0x85dc('0x26')]:util['format'](_0x85dc('0x31'),_0x33aefe[_0x85dc('0x24')]);return db[_0x85dc('0x10')][_0x85dc('0x4a')]({'where':{'role':_0x85dc('0x4b'),'online':!![],'id':{'$ne':_0x33aefe['id']}}});}})[_0x85dc('0x1a')](function(_0x1abf85){if(_0x1abf85){_0x554ff0=_0x1abf85;return require(_0x85dc('0x4c'))[_0x85dc('0x4d')]();}})[_0x85dc('0x1a')](function(_0x18e16d){if(_0x18e16d&&_0x18e16d['agents']&&_0x554ff0>=_0x18e16d[_0x85dc('0x4e')]){throw new Error(_0x85dc('0x4f'));}})[_0x85dc('0x1a')](function(){if(_0x33aefe){return db[_0x85dc('0x2a')][_0x85dc('0x46')]({'where':{'membername':_0x33aefe[_0x85dc('0x24')]},'individualHooks':!![]});}})[_0x85dc('0x1a')](function(){if(_0x33aefe){return _0x33aefe[_0x85dc('0x50')]({'raw':!![]});}})['then'](function(_0x2ec23a){if(_0x33aefe){if(_0x2ec23a){var _0x381651=[];_0x58b4d4=_0x2ec23a;if(_0x58b4d4[_0x85dc('0x51')]){for(var _0x1cefc9=0x0;_0x1cefc9<_0x58b4d4[_0x85dc('0x51')];_0x1cefc9++){_0x381651[_0x85dc('0x30')](db[_0x85dc('0x2a')]['upsert']({'membername':_0x33aefe[_0x85dc('0x24')],'UserId':_0x33aefe['id'],'queue_name':_0x58b4d4[_0x1cefc9][_0x85dc('0x24')],'VoiceQueueId':_0x58b4d4[_0x1cefc9]['id'],'interface':_0x67e377,'paused':_0x33aefe[_0x85dc('0x52')]||![],'penalty':_0x58b4d4[_0x1cefc9][_0x85dc('0x53')]||0x0}));}return BPromise[_0x85dc('0x54')](_0x381651);}}}})['then'](function(){if(_0x33aefe){return db[_0x85dc('0x47')][_0x85dc('0x11')]({'where':{'membername':_0x33aefe[_0x85dc('0x24')],'exitAt':null}});}})['then'](function(_0x5b05d7){if(_0x33aefe){if(_0x5b05d7&&_0x5b05d7['length']){var _0x17ce08=[];_0x5b05d7[_0x85dc('0x2f')](function(_0x59e17d){_0x17ce08[_0x85dc('0x30')](_0x59e17d[_0x85dc('0x2b')]({'exitAt':moment()[_0x85dc('0x27')](_0x85dc('0x32'))}));});return BPromise['all'](_0x17ce08);}}})[_0x85dc('0x1a')](function(){if(_0x33aefe){var _0x215d24=[];var _0x47c745=[];var _0x1c3a90=utils[_0x85dc('0x2e')]();var _0x2e95aa={'membername':_0x33aefe['name'],'interface':_0x67e377,'enterAt':moment()[_0x85dc('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x33aefe[_0x85dc('0x36')],'internal':_0x33aefe[_0x85dc('0x25')]};_0x1c3a90['forEach'](function(_0x11c7f4){_0x215d24[_0x85dc('0x30')](_['merge']({'channel':_0x11c7f4,'type':_0x85dc('0x55'),'data1':_0x85dc('0x56'),'data2':_0x67e377},_0x2e95aa));if(_0x33aefe['loginInPause']){_0x47c745['push'](_['merge']({'channel':_0x11c7f4,'type':_0x85dc('0x2c'),'data1':_0x85dc('0x57')},_0x2e95aa));}});return db[_0x85dc('0x47')][_0x85dc('0x38')](_0x215d24[_0x85dc('0x58')](_0x47c745),{'individualHooks':!![]});}})['then'](function(){if(_0x33aefe){return _0x33aefe[_0x85dc('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x85dc('0x27')](_0x85dc('0x32')),'voicePause':_0x33aefe[_0x85dc('0x52')]||![],'mailPause':_0x33aefe[_0x85dc('0x52')]||![],'chatPause':_0x33aefe[_0x85dc('0x52')]||![],'faxPause':_0x33aefe[_0x85dc('0x52')]||![],'smsPause':_0x33aefe['loginInPause']||![],'openchannelPause':_0x33aefe[_0x85dc('0x52')]||![],'pauseType':_0x33aefe[_0x85dc('0x52')]?_0x85dc('0x57'):null,'lastPauseAt':moment()[_0x85dc('0x27')](_0x85dc('0x32')),'interface':_0x67e377});}})[_0x85dc('0x1a')](function(_0x1f3bf0){_0x2b51be(_0x1f3bf0);})[_0x85dc('0x1d')](function(_0x78a3c6){_0x33b0e6(_0x3b376b['error'](0x1f4,_0x78a3c6['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 60cdd62..518ce2c 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 _0xbc61=['./user.events','save','remove','update','emit','removeListener','register','length','user:'];(function(_0x3c7f88,_0x482322){var _0x40e7f4=function(_0x5dbea0){while(--_0x5dbea0){_0x3c7f88['push'](_0x3c7f88['shift']());}};_0x40e7f4(++_0x482322);}(_0xbc61,0x14d));var _0x1bc6=function(_0x141dbc,_0x4afed3){_0x141dbc=_0x141dbc-0x0;var _0x4a5555=_0xbc61[_0x141dbc];return _0x4a5555;};'use strict';var UserEvents=require(_0x1bc6('0x0'));var events=[_0x1bc6('0x1'),_0x1bc6('0x2'),_0x1bc6('0x3')];function createListener(_0x416bed,_0x255d46){return function(_0xc7ccae){_0x255d46[_0x1bc6('0x4')](_0x416bed,_0xc7ccae);};}function removeListener(_0x365ed5,_0x58d948){return function(){UserEvents[_0x1bc6('0x5')](_0x365ed5,_0x58d948);};}exports[_0x1bc6('0x6')]=function(_0x2d6069){for(var _0x4b80e4=0x0,_0x28c7d4=events[_0x1bc6('0x7')];_0x4b80e4<_0x28c7d4;_0x4b80e4++){var _0x3e2dc6=events[_0x4b80e4];var _0x34a75a=createListener(_0x1bc6('0x8')+_0x3e2dc6,_0x2d6069);UserEvents['on'](_0x3e2dc6,_0x34a75a);}}; \ No newline at end of file +var _0xb378=['user:','./user.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4c6c44,_0x25157c){var _0x1b5208=function(_0x357f7f){while(--_0x357f7f){_0x4c6c44['push'](_0x4c6c44['shift']());}};_0x1b5208(++_0x25157c);}(_0xb378,0x1e7));var _0x8b37=function(_0x2a1340,_0x38adab){_0x2a1340=_0x2a1340-0x0;var _0x4e47af=_0xb378[_0x2a1340];return _0x4e47af;};'use strict';var UserEvents=require(_0x8b37('0x0'));var events=[_0x8b37('0x1'),_0x8b37('0x2'),_0x8b37('0x3')];function createListener(_0x1d4840,_0x162555){return function(_0x1c0dd9){_0x162555[_0x8b37('0x4')](_0x1d4840,_0x1c0dd9);};}function removeListener(_0x5d2f23,_0x27ce95){return function(){UserEvents[_0x8b37('0x5')](_0x5d2f23,_0x27ce95);};}exports[_0x8b37('0x6')]=function(_0x400ef4){for(var _0x27fa96=0x0,_0x3a5c0c=events[_0x8b37('0x7')];_0x27fa96<_0x3a5c0c;_0x27fa96++){var _0x4efe2c=events[_0x27fa96];var _0x4aab55=createListener(_0x8b37('0x8')+_0x4efe2c,_0x400ef4);UserEvents['on'](_0x4efe2c,_0x4aab55);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 510f7f5..cb61990 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x516462,_0x37285f){var _0x249f3e=function(_0x1afda0){while(--_0x1afda0){_0x516462['push'](_0x516462['shift']());}};_0x249f3e(++_0x37285f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0xcb91[_0x168127];return _0x4c99ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x36d57f,_0x55f672){var _0x11c2f1=function(_0x30adbb){while(--_0x30adbb){_0x36d57f['push'](_0x36d57f['shift']());}};_0x11c2f1(++_0x55f672);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index da8693b..540003b 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 _0xdc1b=['INTEGER'];(function(_0x24df0d,_0x40abcc){var _0x3baa8b=function(_0x36f1ee){while(--_0x36f1ee){_0x24df0d['push'](_0x24df0d['shift']());}};_0x3baa8b(++_0x40abcc);}(_0xdc1b,0x161));var _0xbdc1=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xdc1b[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xbdc1('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7a0f=['INTEGER','sequelize'];(function(_0x15841e,_0x3e369f){var _0xd25e16=function(_0x5bdee5){while(--_0x5bdee5){_0x15841e['push'](_0x15841e['shift']());}};_0xd25e16(++_0x3e369f);}(_0x7a0f,0x199));var _0xf7a0=function(_0x1aeadb,_0x4ca650){_0x1aeadb=_0x1aeadb-0x0;var _0x3ede61=_0x7a0f[_0x1aeadb];return _0x3ede61;};'use strict';var Sequelize=require(_0xf7a0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf7a0('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 cf9cbe3..06dd512 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 _0xd788=['../../config/environment','./userChatQueue.attributes','UserChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x49f9e7,_0x35c95d){var _0x3de1b0=function(_0x411ff1){while(--_0x411ff1){_0x49f9e7['push'](_0x49f9e7['shift']());}};_0x3de1b0(++_0x35c95d);}(_0xd788,0xea));var _0x8d78=function(_0x32f704,_0x4d0be7){_0x32f704=_0x32f704-0x0;var _0x1bde32=_0xd788[_0x32f704];return _0x1bde32;};'use strict';var _=require(_0x8d78('0x0'));var util=require('util');var logger=require(_0x8d78('0x1'))(_0x8d78('0x2'));var moment=require(_0x8d78('0x3'));var BPromise=require(_0x8d78('0x4'));var rp=require(_0x8d78('0x5'));var fs=require('fs');var path=require(_0x8d78('0x6'));var rimraf=require(_0x8d78('0x7'));var config=require(_0x8d78('0x8'));var attributes=require(_0x8d78('0x9'));module['exports']=function(_0x3cf3a8,_0x16a137){return _0x3cf3a8['define'](_0x8d78('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0102=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','user_has_chat_queues'];(function(_0x35dd0f,_0xe5942a){var _0x556fb4=function(_0x5af705){while(--_0x5af705){_0x35dd0f['push'](_0x35dd0f['shift']());}};_0x556fb4(++_0xe5942a);}(_0x0102,0x6e));var _0x2010=function(_0x58ace6,_0x4338df){_0x58ace6=_0x58ace6-0x0;var _0x31c823=_0x0102[_0x58ace6];return _0x31c823;};'use strict';var _=require(_0x2010('0x0'));var util=require(_0x2010('0x1'));var logger=require('../../config/logger')(_0x2010('0x2'));var moment=require(_0x2010('0x3'));var BPromise=require(_0x2010('0x4'));var rp=require(_0x2010('0x5'));var fs=require('fs');var path=require(_0x2010('0x6'));var rimraf=require('rimraf');var config=require(_0x2010('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x2010('0x8')]=function(_0x42c8ac,_0x18276b){return _0x42c8ac[_0x2010('0x9')]('UserChatQueue',attributes,{'tableName':_0x2010('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 45a02b3..bf84659 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 _0x5e1b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x3941c7,_0x48ce4f){var _0x1ac551=function(_0x33e059){while(--_0x33e059){_0x3941c7['push'](_0x3941c7['shift']());}};_0x1ac551(++_0x48ce4f);}(_0x5e1b,0x98));var _0xb5e1=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x5e1b[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0xb5e1('0x0'));var util=require(_0xb5e1('0x1'));var moment=require(_0xb5e1('0x2'));var BPromise=require(_0xb5e1('0x3'));var rs=require(_0xb5e1('0x4'));var fs=require('fs');var Redis=require(_0xb5e1('0x5'));var db=require(_0xb5e1('0x6'))['db'];var utils=require(_0xb5e1('0x7'));var logger=require(_0xb5e1('0x8'))(_0xb5e1('0x9'));var config=require(_0xb5e1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb5e1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1df511,_0x51ddd0,_0x2652a9){return new BPromise(function(_0x32ef1a,_0x564bd7){return client[_0xb5e1('0xc')](_0x1df511,_0x2652a9)[_0xb5e1('0xd')](function(_0xf97f3b){logger[_0xb5e1('0xe')](_0xb5e1('0xf'),_0x51ddd0,_0xb5e1('0x10'));logger['debug'](_0xb5e1('0x11'),_0x51ddd0,'request\x20sent',JSON[_0xb5e1('0x12')](_0xf97f3b));if(_0xf97f3b[_0xb5e1('0x13')]){if(_0xf97f3b[_0xb5e1('0x13')]['code']===0x1f4){logger[_0xb5e1('0x13')](_0xb5e1('0xf'),_0x51ddd0,_0xf97f3b[_0xb5e1('0x13')]['message']);return _0x564bd7(_0xf97f3b[_0xb5e1('0x13')][_0xb5e1('0x14')]);}logger['error'](_0xb5e1('0xf'),_0x51ddd0,_0xf97f3b[_0xb5e1('0x13')][_0xb5e1('0x14')]);return _0x32ef1a(_0xf97f3b[_0xb5e1('0x13')]['message']);}else{logger[_0xb5e1('0xe')](_0xb5e1('0xf'),_0x51ddd0,'request\x20sent');_0x32ef1a(_0xf97f3b['result']['message']);}})[_0xb5e1('0x15')](function(_0x34d09d){logger[_0xb5e1('0x13')](_0xb5e1('0xf'),_0x51ddd0,_0x34d09d);_0x564bd7(_0x34d09d);});});} \ No newline at end of file +var _0x024a=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ec049,_0x2b0a71){var _0x30feee=function(_0x1b7d55){while(--_0x1b7d55){_0x3ec049['push'](_0x3ec049['shift']());}};_0x30feee(++_0x2b0a71);}(_0x024a,0x7e));var _0xa024=function(_0x419d31,_0x13b4c6){_0x419d31=_0x419d31-0x0;var _0x484e74=_0x024a[_0x419d31];return _0x484e74;};'use strict';var _=require(_0xa024('0x0'));var util=require(_0xa024('0x1'));var moment=require(_0xa024('0x2'));var BPromise=require('bluebird');var rs=require(_0xa024('0x3'));var fs=require('fs');var Redis=require(_0xa024('0x4'));var db=require(_0xa024('0x5'))['db'];var utils=require(_0xa024('0x6'));var logger=require(_0xa024('0x7'))(_0xa024('0x8'));var config=require(_0xa024('0x9'));var jayson=require(_0xa024('0xa'));var client=jayson[_0xa024('0xb')][_0xa024('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50c717,_0x1864f0,_0x1f9cfc){return new BPromise(function(_0x3a8459,_0x468c88){return client[_0xa024('0xd')](_0x50c717,_0x1f9cfc)[_0xa024('0xe')](function(_0x49f4b9){logger[_0xa024('0xf')](_0xa024('0x10'),_0x1864f0,_0xa024('0x11'));logger[_0xa024('0x12')](_0xa024('0x13'),_0x1864f0,_0xa024('0x11'),JSON[_0xa024('0x14')](_0x49f4b9));if(_0x49f4b9[_0xa024('0x15')]){if(_0x49f4b9[_0xa024('0x15')][_0xa024('0x16')]===0x1f4){logger[_0xa024('0x15')](_0xa024('0x10'),_0x1864f0,_0x49f4b9['error'][_0xa024('0x17')]);return _0x468c88(_0x49f4b9[_0xa024('0x15')]['message']);}logger[_0xa024('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x1864f0,_0x49f4b9[_0xa024('0x15')][_0xa024('0x17')]);return _0x3a8459(_0x49f4b9[_0xa024('0x15')][_0xa024('0x17')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1864f0,_0xa024('0x11'));_0x3a8459(_0x49f4b9['result'][_0xa024('0x17')]);}})[_0xa024('0x18')](function(_0xdb77a3){logger[_0xa024('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x1864f0,_0xdb77a3);_0x468c88(_0xdb77a3);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8ea6971..0d38e07 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4faf3f,_0x387866){var _0x2ff145=function(_0x478881){while(--_0x478881){_0x4faf3f['push'](_0x4faf3f['shift']());}};_0x2ff145(++_0x387866);}(_0xedd9,0xfc));var _0x9edd=function(_0x406871,_0x249860){_0x406871=_0x406871-0x0;var _0x528bb7=_0xedd9[_0x406871];return _0x528bb7;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x18f39e,_0x18d356){var _0x303cf3=function(_0x4c0d00){while(--_0x4c0d00){_0x18f39e['push'](_0x18f39e['shift']());}};_0x303cf3(++_0x18d356);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xcb91[_0x37c07d];return _0x10dadc;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index bb4e63d..eb87a9c 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 _0x8e89=['exports','INTEGER'];(function(_0x573cc9,_0x260154){var _0x4404f1=function(_0x962162){while(--_0x962162){_0x573cc9['push'](_0x573cc9['shift']());}};_0x4404f1(++_0x260154);}(_0x8e89,0xa0));var _0x98e8=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x8e89[_0x4fc421];return _0x8c6d63;};'use strict';var Sequelize=require('sequelize');module[_0x98e8('0x0')]={'penalty':{'type':Sequelize[_0x98e8('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x98e8('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2547=['INTEGER','sequelize','exports'];(function(_0x39cad2,_0x24fc23){var _0x1429ab=function(_0x59d9c5){while(--_0x59d9c5){_0x39cad2['push'](_0x39cad2['shift']());}};_0x1429ab(++_0x24fc23);}(_0x2547,0x136));var _0x7254=function(_0x54ac94,_0x516ffc){_0x54ac94=_0x54ac94-0x0;var _0x490300=_0x2547[_0x54ac94];return _0x490300;};'use strict';var Sequelize=require(_0x7254('0x0'));module[_0x7254('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7254('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 6897cc1..ee9a87c 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 _0x5eea=['exports','define','user_has_fax_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x334223,_0x4f5839){var _0xc1a2b6=function(_0x4453d3){while(--_0x4453d3){_0x334223['push'](_0x334223['shift']());}};_0xc1a2b6(++_0x4f5839);}(_0x5eea,0x18f));var _0xa5ee=function(_0x463649,_0x25d8c5){_0x463649=_0x463649-0x0;var _0x207472=_0x5eea[_0x463649];return _0x207472;};'use strict';var _=require(_0xa5ee('0x0'));var util=require(_0xa5ee('0x1'));var logger=require('../../config/logger')(_0xa5ee('0x2'));var moment=require(_0xa5ee('0x3'));var BPromise=require(_0xa5ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5ee('0x5'));var rimraf=require(_0xa5ee('0x6'));var config=require(_0xa5ee('0x7'));var attributes=require(_0xa5ee('0x8'));module[_0xa5ee('0x9')]=function(_0x231ef2,_0xbf56b3){return _0x231ef2[_0xa5ee('0xa')]('UserFaxQueue',attributes,{'tableName':_0xa5ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9d3=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','util'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xb9d3,0x149));var _0x3b9d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb9d3[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var util=require(_0x3b9d('0x0'));var logger=require(_0x3b9d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3b9d('0x2'));var rp=require(_0x3b9d('0x3'));var fs=require('fs');var path=require(_0x3b9d('0x4'));var rimraf=require(_0x3b9d('0x5'));var config=require(_0x3b9d('0x6'));var attributes=require(_0x3b9d('0x7'));module['exports']=function(_0x188316,_0x259687){return _0x188316[_0x3b9d('0x8')](_0x3b9d('0x9'),attributes,{'tableName':_0x3b9d('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 e5070eb..7330f44 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 _0x56d3=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xf1dbc8,_0x4ff00c){var _0x2947f9=function(_0x1660a0){while(--_0x1660a0){_0xf1dbc8['push'](_0xf1dbc8['shift']());}};_0x2947f9(++_0x4ff00c);}(_0x56d3,0xfc));var _0x356d=function(_0x449ab5,_0x32ed29){_0x449ab5=_0x449ab5-0x0;var _0x20dafd=_0x56d3[_0x449ab5];return _0x20dafd;};'use strict';var _=require(_0x356d('0x0'));var util=require(_0x356d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x356d('0x2'));var db=require(_0x356d('0x3'))['db'];var utils=require(_0x356d('0x4'));var logger=require(_0x356d('0x5'))(_0x356d('0x6'));var config=require('../../config/environment');var jayson=require(_0x356d('0x7'));var client=jayson[_0x356d('0x8')][_0x356d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xded95d,_0x5d44c8,_0x727f45){return new BPromise(function(_0x40a4a5,_0x5b958f){return client[_0x356d('0xa')](_0xded95d,_0x727f45)['then'](function(_0x1e72a9){logger[_0x356d('0xb')](_0x356d('0xc'),_0x5d44c8,_0x356d('0xd'));logger[_0x356d('0xe')](_0x356d('0xf'),_0x5d44c8,_0x356d('0xd'),JSON[_0x356d('0x10')](_0x1e72a9));if(_0x1e72a9[_0x356d('0x11')]){if(_0x1e72a9['error'][_0x356d('0x12')]===0x1f4){logger[_0x356d('0x11')](_0x356d('0xc'),_0x5d44c8,_0x1e72a9[_0x356d('0x11')]['message']);return _0x5b958f(_0x1e72a9[_0x356d('0x11')][_0x356d('0x13')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x5d44c8,_0x1e72a9[_0x356d('0x11')][_0x356d('0x13')]);return _0x40a4a5(_0x1e72a9['error'][_0x356d('0x13')]);}else{logger['info'](_0x356d('0xc'),_0x5d44c8,_0x356d('0xd'));_0x40a4a5(_0x1e72a9['result'][_0x356d('0x13')]);}})[_0x356d('0x14')](function(_0x55970e){logger[_0x356d('0x11')](_0x356d('0xc'),_0x5d44c8,_0x55970e);_0x5b958f(_0x55970e);});});} \ No newline at end of file +var _0xb69b=['../../config/environment','jayson/promise','http','request','then','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserFaxQueue,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xb69b,0x6f));var _0xbb69=function(_0x3c68fd,_0x26a9be){_0x3c68fd=_0x3c68fd-0x0;var _0x205d4c=_0xb69b[_0x3c68fd];return _0x205d4c;};'use strict';var _=require(_0xbb69('0x0'));var util=require(_0xbb69('0x1'));var moment=require(_0xbb69('0x2'));var BPromise=require(_0xbb69('0x3'));var rs=require(_0xbb69('0x4'));var fs=require('fs');var Redis=require(_0xbb69('0x5'));var db=require(_0xbb69('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb69('0x7'))(_0xbb69('0x8'));var config=require(_0xbb69('0x9'));var jayson=require(_0xbb69('0xa'));var client=jayson['client'][_0xbb69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17f361,_0x347d31,_0x263ae7){return new BPromise(function(_0x2124b5,_0x1ecccc){return client[_0xbb69('0xc')](_0x17f361,_0x263ae7)[_0xbb69('0xd')](function(_0x4b2dd6){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x347d31,'request\x20sent');logger[_0xbb69('0xe')](_0xbb69('0xf'),_0x347d31,_0xbb69('0x10'),JSON['stringify'](_0x4b2dd6));if(_0x4b2dd6[_0xbb69('0x11')]){if(_0x4b2dd6[_0xbb69('0x11')][_0xbb69('0x12')]===0x1f4){logger[_0xbb69('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x347d31,_0x4b2dd6['error'][_0xbb69('0x13')]);return _0x1ecccc(_0x4b2dd6['error']['message']);}logger[_0xbb69('0x11')](_0xbb69('0x14'),_0x347d31,_0x4b2dd6['error'][_0xbb69('0x13')]);return _0x2124b5(_0x4b2dd6[_0xbb69('0x11')][_0xbb69('0x13')]);}else{logger[_0xbb69('0x15')]('UserFaxQueue,\x20%s,\x20%s',_0x347d31,'request\x20sent');_0x2124b5(_0x4b2dd6[_0xbb69('0x16')]['message']);}})[_0xbb69('0x17')](function(_0x414e92){logger[_0xbb69('0x11')](_0xbb69('0x14'),_0x347d31,_0x414e92);_0x1ecccc(_0x414e92);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a1b2393..cb16000 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x232baf,_0x1b1b84){var _0x1167a0=function(_0x9ed3fc){while(--_0x9ed3fc){_0x232baf['push'](_0x232baf['shift']());}};_0x1167a0(++_0x1b1b84);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xcb91[_0x967959];return _0x5c4489;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x39479f,_0x822ae4){var _0x4a6d96=function(_0x55bfba){while(--_0x55bfba){_0x39479f['push'](_0x39479f['shift']());}};_0x4a6d96(++_0x822ae4);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index b206c17..21e2b39 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 _0xa9f6=['sequelize','exports','INTEGER'];(function(_0x1ce919,_0x1bbb96){var _0x34ec94=function(_0x3f7a6f){while(--_0x3f7a6f){_0x1ce919['push'](_0x1ce919['shift']());}};_0x34ec94(++_0x1bbb96);}(_0xa9f6,0x198));var _0x6a9f=function(_0x1b7564,_0x1d75ed){_0x1b7564=_0x1b7564-0x0;var _0x193a61=_0xa9f6[_0x1b7564];return _0x193a61;};'use strict';var Sequelize=require(_0x6a9f('0x0'));module[_0x6a9f('0x1')]={'penalty':{'type':Sequelize[_0x6a9f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1672=['INTEGER','sequelize','exports'];(function(_0x1bb990,_0x1af736){var _0x1234fd=function(_0x378c5b){while(--_0x378c5b){_0x1bb990['push'](_0x1bb990['shift']());}};_0x1234fd(++_0x1af736);}(_0x1672,0x121));var _0x2167=function(_0x3315b2,_0x430581){_0x3315b2=_0x3315b2-0x0;var _0xa13b85=_0x1672[_0x3315b2];return _0xa13b85;};'use strict';var Sequelize=require(_0x2167('0x0'));module[_0x2167('0x1')]={'penalty':{'type':Sequelize[_0x2167('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 46365fd..8b166c9 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 _0x97c3=['UserMailQueue','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x3868c0,_0x5c5666){var _0x4eab7e=function(_0x10822d){while(--_0x10822d){_0x3868c0['push'](_0x3868c0['shift']());}};_0x4eab7e(++_0x5c5666);}(_0x97c3,0x18e));var _0x397c=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x97c3[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x397c('0x0'));var util=require(_0x397c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x397c('0x2'));var rp=require(_0x397c('0x3'));var fs=require('fs');var path=require(_0x397c('0x4'));var rimraf=require(_0x397c('0x5'));var config=require(_0x397c('0x6'));var attributes=require(_0x397c('0x7'));module[_0x397c('0x8')]=function(_0x582a9b,_0x351529){return _0x582a9b[_0x397c('0x9')](_0x397c('0xa'),attributes,{'tableName':_0x397c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44c6=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./userMailQueue.attributes','exports','define'];(function(_0x161ee6,_0x4f8bb6){var _0x31aab0=function(_0x153fba){while(--_0x153fba){_0x161ee6['push'](_0x161ee6['shift']());}};_0x31aab0(++_0x4f8bb6);}(_0x44c6,0x16e));var _0x644c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x644c('0x0'));var util=require(_0x644c('0x1'));var logger=require(_0x644c('0x2'))(_0x644c('0x3'));var moment=require(_0x644c('0x4'));var BPromise=require(_0x644c('0x5'));var rp=require(_0x644c('0x6'));var fs=require('fs');var path=require(_0x644c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x644c('0x8'));module[_0x644c('0x9')]=function(_0x46a041,_0x799954){return _0x46a041[_0x644c('0xa')](_0x644c('0xb'),attributes,{'tableName':_0x644c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e44ae67..f997c85 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x42b850,_0x5e41da){var _0x4f1c70=function(_0x5964fd){while(--_0x5964fd){_0x42b850['push'](_0x42b850['shift']());}};_0x4f1c70(++_0x5e41da);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x4b84[_0x5090d4];return _0x56c310;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20f092,_0x492711){var _0x47bbec=function(_0x398e0d){while(--_0x398e0d){_0x20f092['push'](_0x20f092['shift']());}};_0x47bbec(++_0x492711);}(_0x6aa7,0x178));var _0x76aa=function(_0x41a981,_0x1fb34e){_0x41a981=_0x41a981-0x0;var _0x4e2090=_0x6aa7[_0x41a981];return _0x4e2090;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 4fc3718..79bef74 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 _0x8bab=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userNotification.controller','exports'];(function(_0x256157,_0x2c03ac){var _0x400bc5=function(_0x2faf62){while(--_0x2faf62){_0x256157['push'](_0x256157['shift']());}};_0x400bc5(++_0x2c03ac);}(_0x8bab,0x186));var _0xb8ba=function(_0x2eb3d4,_0x470071){_0x2eb3d4=_0x2eb3d4-0x0;var _0x477c2c=_0x8bab[_0x2eb3d4];return _0x477c2c;};'use strict';var multer=require(_0xb8ba('0x0'));var util=require(_0xb8ba('0x1'));var path=require(_0xb8ba('0x2'));var timeout=require(_0xb8ba('0x3'));var express=require(_0xb8ba('0x4'));var router=express[_0xb8ba('0x5')]();var fs_extra=require(_0xb8ba('0x6'));var auth=require(_0xb8ba('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb8ba('0x8'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xb8ba('0x9')]=router; \ No newline at end of file +var _0x0613=['isAuthenticated','sendUserNotification','util','path','connect-timeout','express','Router','fs-extra','./userNotification.controller','post'];(function(_0x447ef0,_0x2e686a){var _0xdd0086=function(_0x17ce5c){while(--_0x17ce5c){_0x447ef0['push'](_0x447ef0['shift']());}};_0xdd0086(++_0x2e686a);}(_0x0613,0xe8));var _0x3061=function(_0x4e457b,_0x31b37c){_0x4e457b=_0x4e457b-0x0;var _0x248e7b=_0x0613[_0x4e457b];return _0x248e7b;};'use strict';var multer=require('multer');var util=require(_0x3061('0x0'));var path=require(_0x3061('0x1'));var timeout=require(_0x3061('0x2'));var express=require(_0x3061('0x3'));var router=express[_0x3061('0x4')]();var fs_extra=require(_0x3061('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3061('0x6'));router[_0x3061('0x7')]('/',auth[_0x3061('0x8')](),controller[_0x3061('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c5b529d..87c6437 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 _0x71e7=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x45bcb1,_0x46cad0){var _0x4bd6a3=function(_0x1f197f){while(--_0x1f197f){_0x45bcb1['push'](_0x45bcb1['shift']());}};_0x4bd6a3(++_0x46cad0);}(_0x71e7,0xc9));var _0x771e=function(_0x15cb60,_0x571e22){_0x15cb60=_0x15cb60-0x0;var _0x2410a1=_0x71e7[_0x15cb60];return _0x2410a1;};'use strict';var Sequelize=require(_0x771e('0x0'));module[_0x771e('0x1')]={'body':{'type':Sequelize[_0x771e('0x2')]},'senderName':{'type':Sequelize[_0x771e('0x3')]},'recipientsId':{'type':Sequelize[_0x771e('0x2')]},'recipientsDescription':{'type':Sequelize[_0x771e('0x3')]},'beep':{'type':Sequelize[_0x771e('0x4')]}}; \ No newline at end of file +var _0xd291=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xd291,0x1d2));var _0x1d29=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd291[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1d29('0x0'));module[_0x1d29('0x1')]={'body':{'type':Sequelize[_0x1d29('0x2')]},'senderName':{'type':Sequelize[_0x1d29('0x3')]},'recipientsId':{'type':Sequelize[_0x1d29('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x1d29('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d593f23..7a9ac4d 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 _0xae12=['../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','forEach','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','startCase','User','union','queue','replace','ids','push','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xac56ce,_0xb73e4){var _0x5105e1=function(_0x52768d){while(--_0x52768d){_0xac56ce['push'](_0xac56ce['shift']());}};_0x5105e1(++_0xb73e4);}(_0xae12,0x18f));var _0x2ae1=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xae12[_0x2ec2bf];return _0x2c279c;};'use strict';var emlformat=require(_0x2ae1('0x0'));var rimraf=require(_0x2ae1('0x1'));var zipdir=require(_0x2ae1('0x2'));var jsonpatch=require(_0x2ae1('0x3'));var rp=require(_0x2ae1('0x4'));var moment=require(_0x2ae1('0x5'));var BPromise=require(_0x2ae1('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ae1('0x7'));var sox=require(_0x2ae1('0x8'));var csv=require(_0x2ae1('0x9'));var ejs=require(_0x2ae1('0xa'));var fs=require('fs');var fs_extra=require(_0x2ae1('0xb'));var _=require(_0x2ae1('0xc'));var squel=require(_0x2ae1('0xd'));var crypto=require('crypto');var jsforce=require(_0x2ae1('0xe'));var deskjs=require(_0x2ae1('0xf'));var toCsv=require(_0x2ae1('0x9'));var querystring=require('querystring');var Papa=require(_0x2ae1('0x10'));var Redis=require(_0x2ae1('0x11'));var authService=require(_0x2ae1('0x12'));var qs=require(_0x2ae1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ae1('0x14'));var logger=require(_0x2ae1('0x15'))(_0x2ae1('0x16'));var utils=require('../../config/utils');var config=require(_0x2ae1('0x17'));var licenseUtil=require(_0x2ae1('0x18'));var db=require('../../mysqldb')['db'];config[_0x2ae1('0x19')]=_[_0x2ae1('0x1a')](config[_0x2ae1('0x19')],{'host':_0x2ae1('0x1b'),'port':0x18eb});var socket=require(_0x2ae1('0x1c'))(new Redis(config[_0x2ae1('0x19')]));require(_0x2ae1('0x1d'))[_0x2ae1('0x1e')](socket);function respondWithStatusCode(_0x3609a6,_0x54fb10){_0x54fb10=_0x54fb10||0xcc;return function(_0x1bb4cb){if(_0x1bb4cb){return _0x3609a6['sendStatus'](_0x54fb10);}return _0x3609a6[_0x2ae1('0x1f')](_0x54fb10)[_0x2ae1('0x20')]();};}function respondWithResult(_0x484a22,_0xf45a38){_0xf45a38=_0xf45a38||0xc8;return function(_0x2d3fb1){if(_0x2d3fb1){return _0x484a22[_0x2ae1('0x1f')](_0xf45a38)[_0x2ae1('0x21')](_0x2d3fb1);}};}function respondWithFilteredResult(_0x14547f,_0x1ecad0){return function(_0x2ac9e9){if(_0x2ac9e9){var _0x356b65=typeof _0x1ecad0['offset']===_0x2ae1('0x22')&&typeof _0x1ecad0[_0x2ae1('0x23')]===_0x2ae1('0x22');var _0x2e40ff=_0x2ac9e9[_0x2ae1('0x24')];var _0x4b33e8=_0x356b65?0x0:_0x1ecad0[_0x2ae1('0x25')];var _0x2c8671=_0x356b65?_0x2ac9e9[_0x2ae1('0x24')]:_0x1ecad0['offset']+_0x1ecad0[_0x2ae1('0x23')];var _0x316f9c;if(_0x2c8671>=_0x2e40ff){_0x2c8671=_0x2e40ff;_0x316f9c=0xc8;}else{_0x316f9c=0xce;}_0x14547f[_0x2ae1('0x1f')](_0x316f9c);return _0x14547f['set'](_0x2ae1('0x26'),_0x4b33e8+'-'+_0x2c8671+'/'+_0x2e40ff)['json'](_0x2ac9e9);}return null;};}function patchUpdates(_0x38646d){return function(_0x139043){try{jsonpatch[_0x2ae1('0x27')](_0x139043,_0x38646d,!![]);}catch(_0x4c8d44){return BPromise[_0x2ae1('0x28')](_0x4c8d44);}return _0x139043[_0x2ae1('0x29')]();};}function saveUpdates(_0x591c28,_0x35694b){return function(_0x209402){if(_0x209402){return _0x209402[_0x2ae1('0x2a')](_0x591c28)[_0x2ae1('0x2b')](function(_0x4f3fba){return _0x4f3fba;});}return null;};}function removeEntity(_0x29d971,_0x539508){return function(_0x3cfd73){if(_0x3cfd73){return _0x3cfd73[_0x2ae1('0x2c')]()['then'](function(){_0x29d971[_0x2ae1('0x1f')](0xcc)[_0x2ae1('0x20')]();});}};}function handleEntityNotFound(_0x9f01fb,_0x5c708d){return function(_0x21b1fa){if(!_0x21b1fa){_0x9f01fb[_0x2ae1('0x2d')](0x194);}return _0x21b1fa;};}function handleError(_0x5d836a,_0x1b8744){_0x1b8744=_0x1b8744||0x1f4;return function(_0x223213){logger[_0x2ae1('0x2e')](_0x223213[_0x2ae1('0x2f')]);if(_0x223213[_0x2ae1('0x30')]){delete _0x223213[_0x2ae1('0x30')];}_0x5d836a[_0x2ae1('0x1f')](_0x1b8744)[_0x2ae1('0x31')](_0x223213);};}exports['sendUserNotification']=function(_0x5c0084,_0x57de07,_0x155ae8){if(!_0x5c0084[_0x2ae1('0x32')][_0x2ae1('0x33')](_0x2ae1('0x34'))&&!_0x5c0084['body'][_0x2ae1('0x33')](_0x2ae1('0x35'))){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x38'));}else{if(_0x5c0084[_0x2ae1('0x32')]['hasOwnProperty']('TemplateId')&&!_0x5c0084['body'][_0x2ae1('0x33')]('view')){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x39'));}if(!_0x5c0084[_0x2ae1('0x32')]['hasOwnProperty'](_0x2ae1('0x3a'))){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x3b'));}else{try{var _0x1b22ea=JSON[_0x2ae1('0x3c')](_0x5c0084['body']['recipients']);}catch(_0x4bd69d){logger[_0x2ae1('0x2e')](_0x4bd69d);throw new db[(_0x2ae1('0x36'))]['ValidationError'](_0x2ae1('0x3d'));}var _0x1ddf34=[_0x2ae1('0x3e'),'faxqueue',_0x2ae1('0x3f'),_0x2ae1('0x40'),_0x2ae1('0x41'),_0x2ae1('0x42'),_0x2ae1('0x43'),_0x2ae1('0x44'),_0x2ae1('0x45')];if(_[_0x2ae1('0x46')](_0x1b22ea,function(_0x5ed2a2){return!_[_0x2ae1('0x47')](_0x1ddf34,_0x5ed2a2[_0x2ae1('0x48')][_0x2ae1('0x49')]());})){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x4a'));}}}var _0x9d04ee={};_0x9d04ee['senderName']=_0x5c0084[_0x2ae1('0x32')][_0x2ae1('0x33')](_0x2ae1('0x4b'))?_0x5c0084[_0x2ae1('0x32')]['senderName']:_0x5c0084['user'][_0x2ae1('0x4c')];_0x9d04ee[_0x2ae1('0x4d')]=_[_0x2ae1('0x4e')](_0x5c0084[_0x2ae1('0x32')]['recipientsDescription'])?null:_0x5c0084[_0x2ae1('0x32')]['recipientsDescription'];_0x9d04ee[_0x2ae1('0x4f')]=_0x5c0084[_0x2ae1('0x32')]['beep']||![];_0x9d04ee[_0x2ae1('0x50')]=_0x5c0084['user']['id'];return getContent(_0x5c0084[_0x2ae1('0x32')])[_0x2ae1('0x2b')](function(_0x3dce5d){_0x9d04ee[_0x2ae1('0x32')]=_0x3dce5d;return getRecipients(_0x1b22ea);})[_0x2ae1('0x2b')](function(_0x52d941){_0x9d04ee['recipientsId']=_[_0x2ae1('0x51')](_0x52d941)[_0x2ae1('0x52')](',');return db[_0x2ae1('0x53')][_0x2ae1('0x54')](function(_0x27b321){return db['UserNotification']['create'](_0x9d04ee,{'raw':!![],'transaction':_0x27b321})[_0x2ae1('0x2b')](function(_0x20d4eb){var _0x358fbb={'sender':_0x9d04ee['senderName'],'description':_0x9d04ee['recipientsDescription'],'content':_0x9d04ee[_0x2ae1('0x32')],'beep':_0x9d04ee['beep']};_0x52d941[_0x2ae1('0x55')](function(_0x39d533){_0x358fbb[_0x2ae1('0x56')]=_0x39d533;socket[_0x2ae1('0x57')](_0x2ae1('0x58'),_0x358fbb);});return _0x20d4eb;});});})['then'](respondWithResult(_0x57de07,0xc9))[_0x2ae1('0x59')](handleError(_0x57de07,null));};function getContent(_0x4f2a95){return new BPromise(function(_0x254f11,_0x47fc33){if(_0x4f2a95[_0x2ae1('0x34')]){_0x254f11(_0x4f2a95[_0x2ae1('0x34')]);return;}return db[_0x2ae1('0x5a')][_0x2ae1('0x5b')]({'attributes':['html'],'where':{'id':_0x4f2a95[_0x2ae1('0x35')]},'raw':!![]})[_0x2ae1('0x2b')](function(_0x514b8c){if(!_0x514b8c)throw new db[(_0x2ae1('0x36'))]['ValidationError'](_0x2ae1('0x5c'));var _0x3b4e45=Mustache[_0x2ae1('0x5d')](_0x514b8c[_0x2ae1('0x5e')],_0x4f2a95[_0x2ae1('0x5f')]);_0x254f11(_0x3b4e45);})['catch'](function(_0x3897bc){_0x47fc33(_0x3897bc);});});}function getRecipients(_0x21d59e){return new BPromise(function(_0x16d76f,_0x58bb2c){var _0x14d384=[];var _0x370769=[];_0x21d59e[_0x2ae1('0x55')](function(_0x299eb9){var _0xecab4a=_[_0x2ae1('0x60')](_0x299eb9[_0x2ae1('0x48')][_0x2ae1('0x49')]());if(_0xecab4a===_0x2ae1('0x61')){_0x14d384=_[_0x2ae1('0x62')](_0x14d384,_0x299eb9['ids']);}else{if(_[_0x2ae1('0x47')](_0xecab4a,_0x2ae1('0x63')))_0xecab4a=_0xecab4a[_0x2ae1('0x64')](_0x2ae1('0x63'),'Queue');_0x299eb9[_0x2ae1('0x65')][_0x2ae1('0x55')](function(_0x1bc46d){_0x370769[_0x2ae1('0x66')](getAgents(_0xecab4a,_0x1bc46d));});}});return BPromise['all'](_0x370769)[_0x2ae1('0x2b')](function(_0x3dbbde){_0x14d384=_[_0x2ae1('0x62')](_0x14d384,_[_0x2ae1('0x67')](_0x3dbbde));_0x16d76f(_0x14d384);})[_0x2ae1('0x59')](function(_0x377caa){_0x58bb2c(_0x377caa);});});}function getAgents(_0x5bf861,_0x4aa292){return new BPromise(function(_0x37b3a5,_0x41eca9){return db[_0x5bf861]['findOne']({'where':{'id':_0x4aa292}})['then'](function(_0x321600){return _0x321600[_0x2ae1('0x68')]({'attributes':['id'],'raw':!![]})['then'](function(_0x417c7a){var _0x2f2df5=_['map'](_0x417c7a,'id');_0x37b3a5(_0x2f2df5);});})[_0x2ae1('0x59')](function(_0x353cac){_0x41eca9(_0x353cac);});});} \ No newline at end of file +var _0xd391=['defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','text','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','ids','queue','replace','Queue','push','union','flatten','findOne','getAgents','map','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xaa7f16,_0x55eddf){var _0x40bbcf=function(_0x49f4c6){while(--_0x49f4c6){_0xaa7f16['push'](_0xaa7f16['shift']());}};_0x40bbcf(++_0x55eddf);}(_0xd391,0xb2));var _0x1d39=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd391[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x1d39('0x0'));var rimraf=require(_0x1d39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d39('0x2'));var rp=require('request-promise');var moment=require(_0x1d39('0x3'));var BPromise=require(_0x1d39('0x4'));var Mustache=require(_0x1d39('0x5'));var util=require(_0x1d39('0x6'));var path=require(_0x1d39('0x7'));var sox=require(_0x1d39('0x8'));var csv=require('to-csv');var ejs=require(_0x1d39('0x9'));var fs=require('fs');var fs_extra=require(_0x1d39('0xa'));var _=require(_0x1d39('0xb'));var squel=require(_0x1d39('0xc'));var crypto=require(_0x1d39('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d39('0xe'));var toCsv=require(_0x1d39('0xf'));var querystring=require('querystring');var Papa=require(_0x1d39('0x10'));var Redis=require(_0x1d39('0x11'));var authService=require(_0x1d39('0x12'));var qs=require(_0x1d39('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d39('0x14'));var logger=require(_0x1d39('0x15'))(_0x1d39('0x16'));var utils=require(_0x1d39('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1d39('0x18'));var db=require(_0x1d39('0x19'))['db'];config['redis']=_[_0x1d39('0x1a')](config['redis'],{'host':_0x1d39('0x1b'),'port':0x18eb});var socket=require(_0x1d39('0x1c'))(new Redis(config[_0x1d39('0x1d')]));require(_0x1d39('0x1e'))[_0x1d39('0x1f')](socket);function respondWithStatusCode(_0x4aed24,_0x3f1fbf){_0x3f1fbf=_0x3f1fbf||0xcc;return function(_0x240f43){if(_0x240f43){return _0x4aed24[_0x1d39('0x20')](_0x3f1fbf);}return _0x4aed24[_0x1d39('0x21')](_0x3f1fbf)['end']();};}function respondWithResult(_0x4d4d98,_0x3ffd12){_0x3ffd12=_0x3ffd12||0xc8;return function(_0x3a8217){if(_0x3a8217){return _0x4d4d98[_0x1d39('0x21')](_0x3ffd12)[_0x1d39('0x22')](_0x3a8217);}};}function respondWithFilteredResult(_0x38960a,_0x4ba2ec){return function(_0x213f85){if(_0x213f85){var _0x2ded92=typeof _0x4ba2ec['offset']===_0x1d39('0x23')&&typeof _0x4ba2ec[_0x1d39('0x24')]==='undefined';var _0x1fefae=_0x213f85['count'];var _0x45a653=_0x2ded92?0x0:_0x4ba2ec['offset'];var _0x5bd935=_0x2ded92?_0x213f85[_0x1d39('0x25')]:_0x4ba2ec[_0x1d39('0x26')]+_0x4ba2ec[_0x1d39('0x24')];var _0x269e11;if(_0x5bd935>=_0x1fefae){_0x5bd935=_0x1fefae;_0x269e11=0xc8;}else{_0x269e11=0xce;}_0x38960a[_0x1d39('0x21')](_0x269e11);return _0x38960a[_0x1d39('0x27')](_0x1d39('0x28'),_0x45a653+'-'+_0x5bd935+'/'+_0x1fefae)['json'](_0x213f85);}return null;};}function patchUpdates(_0x116323){return function(_0x3ff2fa){try{jsonpatch[_0x1d39('0x29')](_0x3ff2fa,_0x116323,!![]);}catch(_0x1f6801){return BPromise[_0x1d39('0x2a')](_0x1f6801);}return _0x3ff2fa[_0x1d39('0x2b')]();};}function saveUpdates(_0x52a012,_0x28376c){return function(_0x366e65){if(_0x366e65){return _0x366e65[_0x1d39('0x2c')](_0x52a012)[_0x1d39('0x2d')](function(_0x127827){return _0x127827;});}return null;};}function removeEntity(_0x866a06,_0x2d581f){return function(_0x580add){if(_0x580add){return _0x580add[_0x1d39('0x2e')]()['then'](function(){_0x866a06[_0x1d39('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25def4,_0x102f00){return function(_0xb6b641){if(!_0xb6b641){_0x25def4[_0x1d39('0x20')](0x194);}return _0xb6b641;};}function handleError(_0x42ffd2,_0x526f89){_0x526f89=_0x526f89||0x1f4;return function(_0x2ef0cb){logger['error'](_0x2ef0cb['stack']);if(_0x2ef0cb['name']){delete _0x2ef0cb[_0x1d39('0x2f')];}_0x42ffd2['status'](_0x526f89)[_0x1d39('0x30')](_0x2ef0cb);};}exports[_0x1d39('0x31')]=function(_0x2f046b,_0x1e2a5b,_0x27f81a){if(!_0x2f046b[_0x1d39('0x32')]['hasOwnProperty']('text')&&!_0x2f046b[_0x1d39('0x32')][_0x1d39('0x33')]('TemplateId')){throw new db[(_0x1d39('0x34'))][(_0x1d39('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2f046b[_0x1d39('0x32')][_0x1d39('0x33')](_0x1d39('0x36'))&&!_0x2f046b[_0x1d39('0x32')][_0x1d39('0x33')](_0x1d39('0x37'))){throw new db[(_0x1d39('0x34'))][(_0x1d39('0x35'))](_0x1d39('0x38'));}if(!_0x2f046b[_0x1d39('0x32')][_0x1d39('0x33')]('recipients')){throw new db[(_0x1d39('0x34'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0xcb0d1c=JSON[_0x1d39('0x39')](_0x2f046b[_0x1d39('0x32')][_0x1d39('0x3a')]);}catch(_0x24d903){logger[_0x1d39('0x3b')](_0x24d903);throw new db[(_0x1d39('0x34'))][(_0x1d39('0x35'))](_0x1d39('0x3c'));}var _0x20f686=[_0x1d39('0x3d'),'faxqueue','mailqueue',_0x1d39('0x3e'),'smsqueue',_0x1d39('0x3f'),_0x1d39('0x40'),_0x1d39('0x41'),_0x1d39('0x42')];if(_[_0x1d39('0x43')](_0xcb0d1c,function(_0x36ee40){return!_[_0x1d39('0x44')](_0x20f686,_0x36ee40['model']['toLowerCase']());})){throw new db[(_0x1d39('0x34'))][(_0x1d39('0x35'))](_0x1d39('0x45'));}}}var _0x41de02={};_0x41de02[_0x1d39('0x46')]=_0x2f046b[_0x1d39('0x32')][_0x1d39('0x33')]('senderName')?_0x2f046b[_0x1d39('0x32')][_0x1d39('0x46')]:_0x2f046b[_0x1d39('0x42')][_0x1d39('0x47')];_0x41de02[_0x1d39('0x48')]=_[_0x1d39('0x49')](_0x2f046b[_0x1d39('0x32')][_0x1d39('0x48')])?null:_0x2f046b[_0x1d39('0x32')][_0x1d39('0x48')];_0x41de02[_0x1d39('0x4a')]=_0x2f046b[_0x1d39('0x32')][_0x1d39('0x4a')]||![];_0x41de02[_0x1d39('0x4b')]=_0x2f046b[_0x1d39('0x42')]['id'];return getContent(_0x2f046b[_0x1d39('0x32')])[_0x1d39('0x2d')](function(_0xaf6bb7){_0x41de02['body']=_0xaf6bb7;return getRecipients(_0xcb0d1c);})[_0x1d39('0x2d')](function(_0x74db04){_0x41de02[_0x1d39('0x4c')]=_['sortBy'](_0x74db04)[_0x1d39('0x4d')](',');return db[_0x1d39('0x4e')][_0x1d39('0x4f')](function(_0x4c69b5){return db[_0x1d39('0x50')][_0x1d39('0x51')](_0x41de02,{'raw':!![],'transaction':_0x4c69b5})[_0x1d39('0x2d')](function(_0x582f98){var _0x50da38={'sender':_0x41de02[_0x1d39('0x46')],'description':_0x41de02[_0x1d39('0x48')],'content':_0x41de02[_0x1d39('0x32')],'beep':_0x41de02[_0x1d39('0x4a')]};_0x74db04[_0x1d39('0x52')](function(_0xd380f7){_0x50da38[_0x1d39('0x53')]=_0xd380f7;socket['emit'](_0x1d39('0x54'),_0x50da38);});return _0x582f98;});});})['then'](respondWithResult(_0x1e2a5b,0xc9))['catch'](handleError(_0x1e2a5b,null));};function getContent(_0xb6a2d5){return new BPromise(function(_0x12dbdb,_0x19809d){if(_0xb6a2d5[_0x1d39('0x55')]){_0x12dbdb(_0xb6a2d5[_0x1d39('0x55')]);return;}return db['Template']['findOne']({'attributes':[_0x1d39('0x56')],'where':{'id':_0xb6a2d5[_0x1d39('0x36')]},'raw':!![]})[_0x1d39('0x2d')](function(_0x2dfefb){if(!_0x2dfefb)throw new db[(_0x1d39('0x34'))]['ValidationError'](_0x1d39('0x57'));var _0x55ab84=Mustache[_0x1d39('0x58')](_0x2dfefb[_0x1d39('0x56')],_0xb6a2d5['view']);_0x12dbdb(_0x55ab84);})['catch'](function(_0x27ca3c){_0x19809d(_0x27ca3c);});});}function getRecipients(_0x182cac){return new BPromise(function(_0x28e509,_0x17820a){var _0xfaedc6=[];var _0x41a451=[];_0x182cac[_0x1d39('0x52')](function(_0x2c3eb5){var _0x323d7b=_[_0x1d39('0x59')](_0x2c3eb5[_0x1d39('0x5a')]['toLowerCase']());if(_0x323d7b==='User'){_0xfaedc6=_['union'](_0xfaedc6,_0x2c3eb5[_0x1d39('0x5b')]);}else{if(_[_0x1d39('0x44')](_0x323d7b,_0x1d39('0x5c')))_0x323d7b=_0x323d7b[_0x1d39('0x5d')](_0x1d39('0x5c'),_0x1d39('0x5e'));_0x2c3eb5['ids']['forEach'](function(_0x3b95c2){_0x41a451[_0x1d39('0x5f')](getAgents(_0x323d7b,_0x3b95c2));});}});return BPromise['all'](_0x41a451)[_0x1d39('0x2d')](function(_0x2721d9){_0xfaedc6=_[_0x1d39('0x60')](_0xfaedc6,_[_0x1d39('0x61')](_0x2721d9));_0x28e509(_0xfaedc6);})['catch'](function(_0x2617d6){_0x17820a(_0x2617d6);});});}function getAgents(_0x53bdf5,_0x3b5753){return new BPromise(function(_0x4adf6a,_0x520dd9){return db[_0x53bdf5][_0x1d39('0x62')]({'where':{'id':_0x3b5753}})[_0x1d39('0x2d')](function(_0xc1139a){return _0xc1139a[_0x1d39('0x63')]({'attributes':['id'],'raw':!![]})[_0x1d39('0x2d')](function(_0x2c0c47){var _0x46e4a9=_[_0x1d39('0x64')](_0x2c0c47,'id');_0x4adf6a(_0x46e4a9);});})[_0x1d39('0x65')](function(_0x54ceee){_0x520dd9(_0x54ceee);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 38fb561..888380d 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 _0x6ea1=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x5ad55d,_0x5eaefe){var _0x388987=function(_0x15a06b){while(--_0x15a06b){_0x5ad55d['push'](_0x5ad55d['shift']());}};_0x388987(++_0x5eaefe);}(_0x6ea1,0xd9));var _0x16ea=function(_0x10530b,_0x305795){_0x10530b=_0x10530b-0x0;var _0x37ccf7=_0x6ea1[_0x10530b];return _0x37ccf7;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x16ea('0x0'))['db'][_0x16ea('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x16ea('0x2')](0x0);var events={'afterCreate':_0x16ea('0x3'),'afterUpdate':_0x16ea('0x4'),'afterDestroy':_0x16ea('0x5')};function emitEvent(_0x3b46b7){return function(_0x4bf1b0,_0x5f3803,_0x3245bb){UserNotificationEvents[_0x16ea('0x6')](_0x3b46b7+':'+_0x4bf1b0['id'],_0x4bf1b0);UserNotificationEvents[_0x16ea('0x6')](_0x3b46b7,_0x4bf1b0);_0x3245bb(null);};}for(var e in events){if(events[_0x16ea('0x7')](e)){var event=events[e];UserNotification[_0x16ea('0x8')](e,emitEvent(event));}}module[_0x16ea('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xfccf=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xfccf,0x1b3));var _0xffcc=function(_0x5981b7,_0x27b732){_0x5981b7=_0x5981b7-0x0;var _0x562fc5=_0xfccf[_0x5981b7];return _0x562fc5;};'use strict';var EventEmitter=require(_0xffcc('0x0'));var UserNotification=require(_0xffcc('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xffcc('0x2')](0x0);var events={'afterCreate':_0xffcc('0x3'),'afterUpdate':_0xffcc('0x4'),'afterDestroy':_0xffcc('0x5')};function emitEvent(_0x103217){return function(_0x1352bc,_0x3562d2,_0x44fd50){UserNotificationEvents['emit'](_0x103217+':'+_0x1352bc['id'],_0x1352bc);UserNotificationEvents['emit'](_0x103217,_0x1352bc);_0x44fd50(null);};}for(var e in events){if(events[_0xffcc('0x6')](e)){var event=events[e];UserNotification[_0xffcc('0x7')](e,emitEvent(event));}}module[_0xffcc('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 dfb0d8e..6072153 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 _0x0a4b=['request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x238202,_0x10da07){var _0x217367=function(_0x34f6d0){while(--_0x34f6d0){_0x238202['push'](_0x238202['shift']());}};_0x217367(++_0x10da07);}(_0x0a4b,0x168));var _0xb0a4=function(_0x4967c2,_0x545950){_0x4967c2=_0x4967c2-0x0;var _0x11746b=_0x0a4b[_0x4967c2];return _0x11746b;};'use strict';var _=require('lodash');var util=require(_0xb0a4('0x0'));var logger=require(_0xb0a4('0x1'))(_0xb0a4('0x2'));var moment=require('moment');var BPromise=require(_0xb0a4('0x3'));var rp=require(_0xb0a4('0x4'));var fs=require('fs');var path=require(_0xb0a4('0x5'));var rimraf=require(_0xb0a4('0x6'));var config=require('../../config/environment');var attributes=require(_0xb0a4('0x7'));module[_0xb0a4('0x8')]=function(_0x1d7282,_0x3633d5){return _0x1d7282[_0xb0a4('0x9')](_0xb0a4('0xa'),attributes,{'tableName':_0xb0a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb0a4('0xc'),'collate':_0xb0a4('0xd')});}; \ No newline at end of file +var _0x5f9c=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserNotification'];(function(_0x5d35ed,_0x253127){var _0x1977fa=function(_0x973a96){while(--_0x973a96){_0x5d35ed['push'](_0x5d35ed['shift']());}};_0x1977fa(++_0x253127);}(_0x5f9c,0x13a));var _0xc5f9=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x5f9c[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc5f9('0x0'))(_0xc5f9('0x1'));var moment=require(_0xc5f9('0x2'));var BPromise=require(_0xc5f9('0x3'));var rp=require(_0xc5f9('0x4'));var fs=require('fs');var path=require(_0xc5f9('0x5'));var rimraf=require(_0xc5f9('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0xc5f9('0x7')]=function(_0x2ffb81,_0x4d664f){return _0x2ffb81[_0xc5f9('0x8')](_0xc5f9('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc5f9('0xa'),'collate':_0xc5f9('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 182be4c..97095f8 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 _0xba73=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x1aaa00,_0x245138){var _0x4be822=function(_0x249c61){while(--_0x249c61){_0x1aaa00['push'](_0x1aaa00['shift']());}};_0x4be822(++_0x245138);}(_0xba73,0x1ab));var _0x3ba7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xba73[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x3ba7('0x0'));var util=require(_0x3ba7('0x1'));var moment=require(_0x3ba7('0x2'));var BPromise=require(_0x3ba7('0x3'));var rs=require(_0x3ba7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ba7('0x5'))['db'];var utils=require(_0x3ba7('0x6'));var logger=require(_0x3ba7('0x7'))('rpc');var config=require(_0x3ba7('0x8'));var jayson=require(_0x3ba7('0x9'));var client=jayson[_0x3ba7('0xa')][_0x3ba7('0xb')]({'port':0x232a});config[_0x3ba7('0xc')]=_[_0x3ba7('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ba7('0xe'))(new Redis(config[_0x3ba7('0xc')]));require('./userNotification.socket')[_0x3ba7('0xf')](socket);function respondWithRpcPromise(_0x29f385,_0x4d14fa,_0xa21dfd){return new BPromise(function(_0x551569,_0x2def1a){return client[_0x3ba7('0x10')](_0x29f385,_0xa21dfd)[_0x3ba7('0x11')](function(_0x1fbb75){logger[_0x3ba7('0x12')](_0x3ba7('0x13'),_0x4d14fa,_0x3ba7('0x14'));logger['debug'](_0x3ba7('0x15'),_0x4d14fa,_0x3ba7('0x14'),JSON[_0x3ba7('0x16')](_0x1fbb75));if(_0x1fbb75['error']){if(_0x1fbb75['error'][_0x3ba7('0x17')]===0x1f4){logger[_0x3ba7('0x18')](_0x3ba7('0x13'),_0x4d14fa,_0x1fbb75[_0x3ba7('0x18')]['message']);return _0x2def1a(_0x1fbb75[_0x3ba7('0x18')]['message']);}logger[_0x3ba7('0x18')](_0x3ba7('0x13'),_0x4d14fa,_0x1fbb75[_0x3ba7('0x18')][_0x3ba7('0x19')]);return _0x551569(_0x1fbb75[_0x3ba7('0x18')][_0x3ba7('0x19')]);}else{logger[_0x3ba7('0x12')](_0x3ba7('0x13'),_0x4d14fa,_0x3ba7('0x14'));_0x551569(_0x1fbb75[_0x3ba7('0x1a')]['message']);}})[_0x3ba7('0x1b')](function(_0x343cae){logger[_0x3ba7('0x18')](_0x3ba7('0x13'),_0x4d14fa,_0x343cae);_0x2def1a(_0x343cae);});});} \ No newline at end of file +var _0x5f16=['register','request','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket'];(function(_0x857779,_0x125412){var _0x2012a8=function(_0x58e07){while(--_0x58e07){_0x857779['push'](_0x857779['shift']());}};_0x2012a8(++_0x125412);}(_0x5f16,0x1ad));var _0x65f1=function(_0x110511,_0x5e9db9){_0x110511=_0x110511-0x0;var _0x5102c3=_0x5f16[_0x110511];return _0x5102c3;};'use strict';var _=require(_0x65f1('0x0'));var util=require(_0x65f1('0x1'));var moment=require(_0x65f1('0x2'));var BPromise=require(_0x65f1('0x3'));var rs=require(_0x65f1('0x4'));var fs=require('fs');var Redis=require(_0x65f1('0x5'));var db=require(_0x65f1('0x6'))['db'];var utils=require(_0x65f1('0x7'));var logger=require(_0x65f1('0x8'))(_0x65f1('0x9'));var config=require(_0x65f1('0xa'));var jayson=require(_0x65f1('0xb'));var client=jayson[_0x65f1('0xc')][_0x65f1('0xd')]({'port':0x232a});config[_0x65f1('0xe')]=_[_0x65f1('0xf')](config[_0x65f1('0xe')],{'host':_0x65f1('0x10'),'port':0x18eb});var socket=require(_0x65f1('0x11'))(new Redis(config[_0x65f1('0xe')]));require(_0x65f1('0x12'))[_0x65f1('0x13')](socket);function respondWithRpcPromise(_0x28ef86,_0x117962,_0x599b01){return new BPromise(function(_0x8b4b98,_0x2731d2){return client[_0x65f1('0x14')](_0x28ef86,_0x599b01)['then'](function(_0xbc45f8){logger[_0x65f1('0x15')]('UserNotification,\x20%s,\x20%s',_0x117962,_0x65f1('0x16'));logger[_0x65f1('0x17')](_0x65f1('0x18'),_0x117962,_0x65f1('0x16'),JSON[_0x65f1('0x19')](_0xbc45f8));if(_0xbc45f8[_0x65f1('0x1a')]){if(_0xbc45f8[_0x65f1('0x1a')][_0x65f1('0x1b')]===0x1f4){logger[_0x65f1('0x1a')](_0x65f1('0x1c'),_0x117962,_0xbc45f8[_0x65f1('0x1a')]['message']);return _0x2731d2(_0xbc45f8[_0x65f1('0x1a')][_0x65f1('0x1d')]);}logger[_0x65f1('0x1a')]('UserNotification,\x20%s,\x20%s',_0x117962,_0xbc45f8[_0x65f1('0x1a')][_0x65f1('0x1d')]);return _0x8b4b98(_0xbc45f8['error'][_0x65f1('0x1d')]);}else{logger['info'](_0x65f1('0x1c'),_0x117962,_0x65f1('0x16'));_0x8b4b98(_0xbc45f8[_0x65f1('0x1e')][_0x65f1('0x1d')]);}})[_0x65f1('0x1f')](function(_0x929429){logger[_0x65f1('0x1a')](_0x65f1('0x1c'),_0x117962,_0x929429);_0x2731d2(_0x929429);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c450f0e..3ab5ea4 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 _0xb183=['./userNotification.events','save','remove','update','emit','removeListener','register','userNotification:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb183,0x1e8));var _0x3b18=function(_0x238f63,_0x14a6b4){_0x238f63=_0x238f63-0x0;var _0x25aa75=_0xb183[_0x238f63];return _0x25aa75;};'use strict';var UserNotificationEvents=require(_0x3b18('0x0'));var events=[_0x3b18('0x1'),_0x3b18('0x2'),_0x3b18('0x3')];function createListener(_0x3f8cc5,_0x56685e){return function(_0x2f684a){_0x56685e[_0x3b18('0x4')](_0x3f8cc5,_0x2f684a);};}function removeListener(_0x90821b,_0x2a8831){return function(){UserNotificationEvents[_0x3b18('0x5')](_0x90821b,_0x2a8831);};}exports[_0x3b18('0x6')]=function(_0x521783){for(var _0x21a1f0=0x0,_0x6132ec=events['length'];_0x21a1f0<_0x6132ec;_0x21a1f0++){var _0x11914e=events[_0x21a1f0];var _0x103042=createListener(_0x3b18('0x7')+_0x11914e,_0x521783);UserNotificationEvents['on'](_0x11914e,_0x103042);}}; \ No newline at end of file +var _0x4ae0=['register','userNotification:','save','remove','emit','removeListener'];(function(_0xbbb12c,_0x3d1846){var _0x19fc59=function(_0x8ec074){while(--_0x8ec074){_0xbbb12c['push'](_0xbbb12c['shift']());}};_0x19fc59(++_0x3d1846);}(_0x4ae0,0x6e));var _0x04ae=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x4ae0[_0x5c2e3e];return _0x53f64a;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x04ae('0x0'),_0x04ae('0x1'),'update'];function createListener(_0x56f83f,_0x1eb8e7){return function(_0xd3fd6f){_0x1eb8e7[_0x04ae('0x2')](_0x56f83f,_0xd3fd6f);};}function removeListener(_0x160d36,_0x7ed9c8){return function(){UserNotificationEvents[_0x04ae('0x3')](_0x160d36,_0x7ed9c8);};}exports[_0x04ae('0x4')]=function(_0x3188c9){for(var _0x52215f=0x0,_0x1d701f=events['length'];_0x52215f<_0x1d701f;_0x52215f++){var _0x3e9920=events[_0x52215f];var _0xe4dafd=createListener(_0x04ae('0x5')+_0x3e9920,_0x3188c9);UserNotificationEvents['on'](_0x3e9920,_0xe4dafd);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c2640bc..8ab7c15 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2068bb,_0xe39035){var _0x476332=function(_0x19dfb1){while(--_0x19dfb1){_0x2068bb['push'](_0x2068bb['shift']());}};_0x476332(++_0xe39035);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xcb91[_0xa8883];return _0x479426;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x47a884,_0x5f2e4e){var _0x296907=function(_0x5d3690){while(--_0x5d3690){_0x47a884['push'](_0x47a884['shift']());}};_0x296907(++_0x5f2e4e);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a49a8d3..b7ffd3b 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 _0x20ad=['exports','INTEGER','sequelize'];(function(_0x28a4d8,_0x284459){var _0x5d53a5=function(_0x186c23){while(--_0x186c23){_0x28a4d8['push'](_0x28a4d8['shift']());}};_0x5d53a5(++_0x284459);}(_0x20ad,0x13a));var _0xd20a=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x20ad[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0xd20a('0x0'));module[_0xd20a('0x1')]={'penalty':{'type':Sequelize[_0xd20a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa95b=['INTEGER','sequelize'];(function(_0x358224,_0x225ed6){var _0x17131d=function(_0x298e3c){while(--_0x298e3c){_0x358224['push'](_0x358224['shift']());}};_0x17131d(++_0x225ed6);}(_0xa95b,0x1e1));var _0xba95=function(_0x572c70,_0x4b00ec){_0x572c70=_0x572c70-0x0;var _0x3c740c=_0xa95b[_0x572c70];return _0x3c740c;};'use strict';var Sequelize=require(_0xba95('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xba95('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 71c11de..70a97ca 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 _0x68c4=['path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68c4,0x1ab));var _0x468c=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0x68c4[_0x214d54];return _0x44ca46;};'use strict';var _=require(_0x468c('0x0'));var util=require(_0x468c('0x1'));var logger=require(_0x468c('0x2'))(_0x468c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x468c('0x4'));var fs=require('fs');var path=require(_0x468c('0x5'));var rimraf=require(_0x468c('0x6'));var config=require('../../config/environment');var attributes=require(_0x468c('0x7'));module[_0x468c('0x8')]=function(_0x652dfd,_0x467542){return _0x652dfd[_0x468c('0x9')](_0x468c('0xa'),attributes,{'tableName':_0x468c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10cc=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2c5769,_0x3dafe9){var _0x44f56b=function(_0x586692){while(--_0x586692){_0x2c5769['push'](_0x2c5769['shift']());}};_0x44f56b(++_0x3dafe9);}(_0x10cc,0x1ab));var _0xc10c=function(_0x55f699,_0x3373d8){_0x55f699=_0x55f699-0x0;var _0x1c02c5=_0x10cc[_0x55f699];return _0x1c02c5;};'use strict';var _=require(_0xc10c('0x0'));var util=require(_0xc10c('0x1'));var logger=require(_0xc10c('0x2'))(_0xc10c('0x3'));var moment=require(_0xc10c('0x4'));var BPromise=require(_0xc10c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc10c('0x6'));var rimraf=require(_0xc10c('0x7'));var config=require(_0xc10c('0x8'));var attributes=require(_0xc10c('0x9'));module[_0xc10c('0xa')]=function(_0x4da401,_0x51516d){return _0x4da401[_0xc10c('0xb')](_0xc10c('0xc'),attributes,{'tableName':_0xc10c('0xd'),'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 acbb3a1..4758413 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 _0xd988=['result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3425d1,_0x46945d){var _0x58adee=function(_0x115ca2){while(--_0x115ca2){_0x3425d1['push'](_0x3425d1['shift']());}};_0x58adee(++_0x46945d);}(_0xd988,0x17d));var _0x8d98=function(_0x5af4d2,_0x5f372a){_0x5af4d2=_0x5af4d2-0x0;var _0x3edf6a=_0xd988[_0x5af4d2];return _0x3edf6a;};'use strict';var _=require('lodash');var util=require(_0x8d98('0x0'));var moment=require('moment');var BPromise=require(_0x8d98('0x1'));var rs=require(_0x8d98('0x2'));var fs=require('fs');var Redis=require(_0x8d98('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d98('0x4'));var logger=require(_0x8d98('0x5'))(_0x8d98('0x6'));var config=require(_0x8d98('0x7'));var jayson=require(_0x8d98('0x8'));var client=jayson['client'][_0x8d98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bd42c,_0x475c74,_0x361664){return new BPromise(function(_0x114c53,_0x1d5e61){return client[_0x8d98('0xa')](_0x1bd42c,_0x361664)[_0x8d98('0xb')](function(_0x415065){logger[_0x8d98('0xc')](_0x8d98('0xd'),_0x475c74,_0x8d98('0xe'));logger[_0x8d98('0xf')](_0x8d98('0x10'),_0x475c74,'request\x20sent',JSON['stringify'](_0x415065));if(_0x415065['error']){if(_0x415065[_0x8d98('0x11')]['code']===0x1f4){logger['error'](_0x8d98('0xd'),_0x475c74,_0x415065[_0x8d98('0x11')][_0x8d98('0x12')]);return _0x1d5e61(_0x415065[_0x8d98('0x11')][_0x8d98('0x12')]);}logger['error'](_0x8d98('0xd'),_0x475c74,_0x415065['error'][_0x8d98('0x12')]);return _0x114c53(_0x415065[_0x8d98('0x11')][_0x8d98('0x12')]);}else{logger['info'](_0x8d98('0xd'),_0x475c74,_0x8d98('0xe'));_0x114c53(_0x415065[_0x8d98('0x13')]['message']);}})['catch'](function(_0x3199b6){logger[_0x8d98('0x11')](_0x8d98('0xd'),_0x475c74,_0x3199b6);_0x1d5e61(_0x3199b6);});});} \ No newline at end of file +var _0x4b2c=['client','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x4b2c,0x6e));var _0xc4b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b2('0x0'));var util=require(_0xc4b2('0x1'));var moment=require(_0xc4b2('0x2'));var BPromise=require(_0xc4b2('0x3'));var rs=require(_0xc4b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4b2('0x6'))(_0xc4b2('0x7'));var config=require(_0xc4b2('0x8'));var jayson=require(_0xc4b2('0x9'));var client=jayson[_0xc4b2('0xa')][_0xc4b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x250d30,_0x74e743,_0xa0b5e7){return new BPromise(function(_0xd2c0c0,_0x3b5ec3){return client['request'](_0x250d30,_0xa0b5e7)[_0xc4b2('0xc')](function(_0x573310){logger['info'](_0xc4b2('0xd'),_0x74e743,_0xc4b2('0xe'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x74e743,_0xc4b2('0xe'),JSON['stringify'](_0x573310));if(_0x573310[_0xc4b2('0xf')]){if(_0x573310[_0xc4b2('0xf')][_0xc4b2('0x10')]===0x1f4){logger[_0xc4b2('0xf')](_0xc4b2('0xd'),_0x74e743,_0x573310[_0xc4b2('0xf')][_0xc4b2('0x11')]);return _0x3b5ec3(_0x573310[_0xc4b2('0xf')]['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x74e743,_0x573310[_0xc4b2('0xf')]['message']);return _0xd2c0c0(_0x573310[_0xc4b2('0xf')][_0xc4b2('0x11')]);}else{logger[_0xc4b2('0x12')](_0xc4b2('0xd'),_0x74e743,_0xc4b2('0xe'));_0xd2c0c0(_0x573310['result']['message']);}})[_0xc4b2('0x13')](function(_0x14f7fb){logger[_0xc4b2('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x74e743,_0x14f7fb);_0x3b5ec3(_0x14f7fb);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 741dbaf..32e486d 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 _0x9c91=['get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','destroy','delete','/:id/sections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfile.controller'];(function(_0x129b2c,_0x2bcd57){var _0x5ac558=function(_0x531f54){while(--_0x531f54){_0x129b2c['push'](_0x129b2c['shift']());}};_0x5ac558(++_0x2bcd57);}(_0x9c91,0x153));var _0x19c9=function(_0x22dcdb,_0x46bac5){_0x22dcdb=_0x22dcdb-0x0;var _0x1c96f5=_0x9c91[_0x22dcdb];return _0x1c96f5;};'use strict';var multer=require(_0x19c9('0x0'));var util=require(_0x19c9('0x1'));var path=require(_0x19c9('0x2'));var timeout=require(_0x19c9('0x3'));var express=require(_0x19c9('0x4'));var router=express[_0x19c9('0x5')]();var fs_extra=require(_0x19c9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19c9('0x7'));var controller=require(_0x19c9('0x8'));router[_0x19c9('0x9')]('/',auth[_0x19c9('0xa')](),controller[_0x19c9('0xb')]);router[_0x19c9('0x9')](_0x19c9('0xc'),auth[_0x19c9('0xa')](),controller[_0x19c9('0xd')]);router['get'](_0x19c9('0xe'),auth['isAuthenticated'](),controller[_0x19c9('0xf')]);router[_0x19c9('0x9')]('/:id/sections',auth[_0x19c9('0xa')](),controller[_0x19c9('0x10')]);router[_0x19c9('0x9')](_0x19c9('0x11'),auth['isAuthenticated'](),controller[_0x19c9('0x12')]);router[_0x19c9('0x13')]('/',auth[_0x19c9('0xa')](),controller[_0x19c9('0x14')]);router[_0x19c9('0x13')]('/:id/clone',auth['isAuthenticated'](),controller[_0x19c9('0x15')]);router[_0x19c9('0x13')]('/:id/sections',auth[_0x19c9('0xa')](),controller[_0x19c9('0x16')]);router[_0x19c9('0x13')](_0x19c9('0x11'),auth[_0x19c9('0xa')](),controller[_0x19c9('0x17')]);router['put'](_0x19c9('0xe'),auth[_0x19c9('0xa')](),controller['update']);router['delete'](_0x19c9('0xe'),auth['isAuthenticated'](),controller[_0x19c9('0x18')]);router[_0x19c9('0x19')](_0x19c9('0x1a'),auth[_0x19c9('0xa')](),controller['removeSections']);router[_0x19c9('0x19')](_0x19c9('0x11'),auth[_0x19c9('0xa')](),controller[_0x19c9('0x1b')]);module[_0x19c9('0x1c')]=router; \ No newline at end of file +var _0x9828=['addSections','addResources','put','update','removeSections','delete','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0x4bf811,_0x110f7b){var _0x2319ad=function(_0x2235b6){while(--_0x2235b6){_0x4bf811['push'](_0x4bf811['shift']());}};_0x2319ad(++_0x110f7b);}(_0x9828,0xef));var _0x8982=function(_0x493b53,_0x559c47){_0x493b53=_0x493b53-0x0;var _0x5528a5=_0x9828[_0x493b53];return _0x5528a5;};'use strict';var multer=require('multer');var util=require(_0x8982('0x0'));var path=require(_0x8982('0x1'));var timeout=require(_0x8982('0x2'));var express=require(_0x8982('0x3'));var router=express[_0x8982('0x4')]();var fs_extra=require(_0x8982('0x5'));var auth=require(_0x8982('0x6'));var interaction=require(_0x8982('0x7'));var config=require(_0x8982('0x8'));var controller=require(_0x8982('0x9'));router['get']('/',auth[_0x8982('0xa')](),controller[_0x8982('0xb')]);router['get'](_0x8982('0xc'),auth[_0x8982('0xa')](),controller['describe']);router[_0x8982('0xd')](_0x8982('0xe'),auth['isAuthenticated'](),controller[_0x8982('0xf')]);router[_0x8982('0xd')](_0x8982('0x10'),auth['isAuthenticated'](),controller[_0x8982('0x11')]);router[_0x8982('0xd')](_0x8982('0x12'),auth['isAuthenticated'](),controller[_0x8982('0x13')]);router[_0x8982('0x14')]('/',auth['isAuthenticated'](),controller[_0x8982('0x15')]);router[_0x8982('0x14')]('/:id/clone',auth[_0x8982('0xa')](),controller['clone']);router[_0x8982('0x14')](_0x8982('0x10'),auth[_0x8982('0xa')](),controller[_0x8982('0x16')]);router['post'](_0x8982('0x12'),auth[_0x8982('0xa')](),controller[_0x8982('0x17')]);router[_0x8982('0x18')](_0x8982('0xe'),auth['isAuthenticated'](),controller[_0x8982('0x19')]);router['delete'](_0x8982('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x8982('0x1a')]);router[_0x8982('0x1b')]('/:id/resources',auth[_0x8982('0xa')](),controller[_0x8982('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index e66a20f..bee13b5 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 _0xccde=['STRING','name','setDataValue','join','getDataValue','crudPermissions','BOOLEAN','sequelize'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xccde,0x18f));var _0xeccd=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0xccde[_0x34bc94];return _0xee41e7;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'name':{'type':Sequelize[_0xeccd('0x1')],'allowNull':![],'unique':_0xeccd('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xecb04b){this[_0xeccd('0x3')]('crudPermissions',_0xecb04b?_0xecb04b[_0xeccd('0x4')](''):[]);},'get':function(){return this[_0xeccd('0x5')](_0xeccd('0x6'))?this[_0xeccd('0x5')](_0xeccd('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xeccd('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0d95=['name','setDataValue','crudPermissions','join','split','BOOLEAN','sequelize','STRING'];(function(_0x557404,_0x1f162){var _0x2fdec8=function(_0x3f4ef2){while(--_0x3f4ef2){_0x557404['push'](_0x557404['shift']());}};_0x2fdec8(++_0x1f162);}(_0x0d95,0x16e));var _0x50d9=function(_0xdfb03,_0x2644d2){_0xdfb03=_0xdfb03-0x0;var _0x2e5bbc=_0x0d95[_0xdfb03];return _0x2e5bbc;};'use strict';var Sequelize=require(_0x50d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x50d9('0x1')],'allowNull':![],'unique':_0x50d9('0x2')},'crudPermissions':{'type':Sequelize[_0x50d9('0x1')],'set':function(_0x5d8144){this[_0x50d9('0x3')](_0x50d9('0x4'),_0x5d8144?_0x5d8144[_0x50d9('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x50d9('0x4'))?this['getDataValue'](_0x50d9('0x4'))[_0x50d9('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 68dcff0..bfbc14f 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 _0x56ca=['fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','UserProfile','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','name','includeAll','include','rows','catch','show','params','keys','options','find','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','sequelize','push','removeSections','getSections','findAll','enabled','includes','isEmpty','subsections','concat','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x56ca,0xde));var _0xa56c=function(_0x214cb8,_0x406018){_0x214cb8=_0x214cb8-0x0;var _0x1cebbf=_0x56ca[_0x214cb8];return _0x1cebbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa56c('0x0'));var zipdir=require(_0xa56c('0x1'));var jsonpatch=require(_0xa56c('0x2'));var rp=require(_0xa56c('0x3'));var moment=require('moment');var BPromise=require(_0xa56c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa56c('0x5'));var sox=require(_0xa56c('0x6'));var csv=require(_0xa56c('0x7'));var ejs=require(_0xa56c('0x8'));var fs=require('fs');var fs_extra=require(_0xa56c('0x9'));var _=require(_0xa56c('0xa'));var squel=require(_0xa56c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa56c('0x7'));var querystring=require('querystring');var Papa=require(_0xa56c('0xc'));var Redis=require(_0xa56c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa56c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa56c('0xf'));var logger=require(_0xa56c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xa56c('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa56c('0x12')](config[_0xa56c('0x13')],{'host':_0xa56c('0x14'),'port':0x18eb});var socket=require(_0xa56c('0x15'))(new Redis(config[_0xa56c('0x13')]));require(_0xa56c('0x16'))['register'](socket);function respondWithStatusCode(_0x51771d,_0x42baff){_0x42baff=_0x42baff||0xcc;return function(_0xdbecc3){if(_0xdbecc3){return _0x51771d[_0xa56c('0x17')](_0x42baff);}return _0x51771d['status'](_0x42baff)[_0xa56c('0x18')]();};}function respondWithResult(_0x32a2ce,_0x524b7d){_0x524b7d=_0x524b7d||0xc8;return function(_0xac227a){if(_0xac227a){return _0x32a2ce['status'](_0x524b7d)[_0xa56c('0x19')](_0xac227a);}};}function respondWithFilteredResult(_0x17f943,_0x4f0273){return function(_0x141b74){if(_0x141b74){var _0x4cc297=typeof _0x4f0273[_0xa56c('0x1a')]===_0xa56c('0x1b')&&typeof _0x4f0273['limit']===_0xa56c('0x1b');var _0x591570=_0x141b74[_0xa56c('0x1c')];var _0x100c40=_0x4cc297?0x0:_0x4f0273[_0xa56c('0x1a')];var _0x4e2de3=_0x4cc297?_0x141b74[_0xa56c('0x1c')]:_0x4f0273[_0xa56c('0x1a')]+_0x4f0273[_0xa56c('0x1d')];var _0x28aeda;if(_0x4e2de3>=_0x591570){_0x4e2de3=_0x591570;_0x28aeda=0xc8;}else{_0x28aeda=0xce;}_0x17f943[_0xa56c('0x1e')](_0x28aeda);return _0x17f943[_0xa56c('0x1f')](_0xa56c('0x20'),_0x100c40+'-'+_0x4e2de3+'/'+_0x591570)['json'](_0x141b74);}return null;};}function patchUpdates(_0x58dc5d){return function(_0x44d844){try{jsonpatch[_0xa56c('0x21')](_0x44d844,_0x58dc5d,!![]);}catch(_0x2eb1d0){return BPromise[_0xa56c('0x22')](_0x2eb1d0);}return _0x44d844[_0xa56c('0x23')]();};}function saveUpdates(_0x31bc27,_0x21c4b0){return function(_0xc9518d){if(_0xc9518d){return _0xc9518d[_0xa56c('0x24')](_0x31bc27)[_0xa56c('0x25')](function(_0x20a35a){return _0x20a35a;});}return null;};}function removeEntity(_0x438436,_0x132913){return function(_0x13f708){if(_0x13f708){return _0x13f708[_0xa56c('0x26')]()[_0xa56c('0x25')](function(){_0x438436[_0xa56c('0x1e')](0xcc)[_0xa56c('0x18')]();});}};}function handleEntityNotFound(_0x2f899a,_0x2c50d0){return function(_0x313e2d){if(!_0x313e2d){_0x2f899a[_0xa56c('0x17')](0x194);}return _0x313e2d;};}function handleError(_0x1132ea,_0x1376c5){_0x1376c5=_0x1376c5||0x1f4;return function(_0x46c031){logger[_0xa56c('0x27')](_0x46c031[_0xa56c('0x28')]);if(_0x46c031['name']){delete _0x46c031['name'];}_0x1132ea[_0xa56c('0x1e')](_0x1376c5)[_0xa56c('0x29')](_0x46c031);};}exports[_0xa56c('0x2a')]=function(_0x41c612,_0x44c7f5){var _0x33f968={},_0xcb047={},_0x5e860d={'count':0x0,'rows':[]};var _0x5cf04b=_['map'](db[_0xa56c('0x2b')][_0xa56c('0x2c')],function(_0x3e88cf){return{'name':_0x3e88cf[_0xa56c('0x2d')],'type':_0x3e88cf[_0xa56c('0x2e')]['key']};});_0xcb047['model']=_['map'](_0x5cf04b,'name');_0xcb047[_0xa56c('0x2f')]=_['keys'](_0x41c612[_0xa56c('0x2f')]);_0xcb047[_0xa56c('0x30')]=_[_0xa56c('0x31')](_0xcb047[_0xa56c('0x32')],_0xcb047[_0xa56c('0x2f')]);_0x33f968[_0xa56c('0x33')]=_[_0xa56c('0x31')](_0xcb047[_0xa56c('0x32')],qs[_0xa56c('0x34')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x34')]));_0x33f968[_0xa56c('0x33')]=_0x33f968[_0xa56c('0x33')][_0xa56c('0x35')]?_0x33f968[_0xa56c('0x33')]:_0xcb047[_0xa56c('0x32')];if(!_0x41c612[_0xa56c('0x2f')][_0xa56c('0x36')](_0xa56c('0x37'))){_0x33f968[_0xa56c('0x1d')]=qs[_0xa56c('0x1d')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x1d')]);_0x33f968[_0xa56c('0x1a')]=qs[_0xa56c('0x1a')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x1a')]);}_0x33f968[_0xa56c('0x38')]=qs[_0xa56c('0x39')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x39')]);_0x33f968['where']=qs['filters'](_[_0xa56c('0x3a')](_0x41c612['query'],_0xcb047[_0xa56c('0x30')]),_0x5cf04b);if(_0x41c612['query'][_0xa56c('0x3b')]){_0x33f968[_0xa56c('0x3c')]=_[_0xa56c('0x3d')](_0x33f968['where'],{'$or':_[_0xa56c('0x3e')](_0x5cf04b,function(_0x4af76a){if(_0x4af76a[_0xa56c('0x2e')]!==_0xa56c('0x3f')){var _0x38db6a={};_0x38db6a[_0x4af76a[_0xa56c('0x40')]]={'$like':'%'+_0x41c612['query'][_0xa56c('0x3b')]+'%'};return _0x38db6a;}})});}_0x33f968=_['merge']({},_0x33f968,_0x41c612['options']);var _0x4bd5f1={'where':_0x33f968[_0xa56c('0x3c')]};return db[_0xa56c('0x2b')][_0xa56c('0x1c')](_0x4bd5f1)[_0xa56c('0x25')](function(_0x1c1d13){_0x5e860d[_0xa56c('0x1c')]=_0x1c1d13;if(_0x41c612[_0xa56c('0x2f')][_0xa56c('0x41')]){_0x33f968[_0xa56c('0x42')]=[{'all':!![]}];}return db[_0xa56c('0x2b')]['findAll'](_0x33f968);})['then'](function(_0x183333){_0x5e860d[_0xa56c('0x43')]=_0x183333;return _0x5e860d;})[_0xa56c('0x25')](respondWithFilteredResult(_0x44c7f5,_0x33f968))[_0xa56c('0x44')](handleError(_0x44c7f5,null));};exports[_0xa56c('0x45')]=function(_0x3516a0,_0x573d6d){var _0x562594={'raw':![],'where':{'id':_0x3516a0[_0xa56c('0x46')]['id']}},_0x4f5cb2={};_0x4f5cb2[_0xa56c('0x32')]=_['keys'](db['UserProfile'][_0xa56c('0x2c')]);_0x4f5cb2[_0xa56c('0x2f')]=_[_0xa56c('0x47')](_0x3516a0['query']);_0x4f5cb2[_0xa56c('0x30')]=_[_0xa56c('0x31')](_0x4f5cb2[_0xa56c('0x32')],_0x4f5cb2[_0xa56c('0x2f')]);_0x562594[_0xa56c('0x33')]=_[_0xa56c('0x31')](_0x4f5cb2[_0xa56c('0x32')],qs[_0xa56c('0x34')](_0x3516a0[_0xa56c('0x2f')][_0xa56c('0x34')]));_0x562594[_0xa56c('0x33')]=_0x562594[_0xa56c('0x33')][_0xa56c('0x35')]?_0x562594[_0xa56c('0x33')]:_0x4f5cb2[_0xa56c('0x32')];if(_0x3516a0[_0xa56c('0x2f')]['includeAll']){_0x562594['include']=[{'all':!![]}];}_0x562594=_[_0xa56c('0x3d')]({},_0x562594,_0x3516a0[_0xa56c('0x48')]);return db['UserProfile'][_0xa56c('0x49')](_0x562594)['then'](handleEntityNotFound(_0x573d6d,null))[_0xa56c('0x25')](respondWithResult(_0x573d6d,null))['catch'](handleError(_0x573d6d,null));};exports[_0xa56c('0x4a')]=function(_0x11df4a,_0x201c86){return db[_0xa56c('0x2b')]['create'](_0x11df4a[_0xa56c('0x4b')],{})['then'](respondWithResult(_0x201c86,0xc9))[_0xa56c('0x44')](handleError(_0x201c86,null));};exports[_0xa56c('0x4c')]=function(_0x1402dc,_0x2c6d2a){var _0xc14a40={'where':{'id':_0x1402dc[_0xa56c('0x46')]['id']}},_0x27b9bb={};_0x27b9bb[_0xa56c('0x32')]=_[_0xa56c('0x47')](db[_0xa56c('0x2b')][_0xa56c('0x2c')]);_0xc14a40[_0xa56c('0x33')]=_[_0xa56c('0x31')](_0x27b9bb[_0xa56c('0x32')],qs[_0xa56c('0x34')](_0x1402dc['query'][_0xa56c('0x34')]));_0xc14a40[_0xa56c('0x33')]=_0xc14a40['attributes'][_0xa56c('0x35')]?_0xc14a40['attributes']:_0x27b9bb[_0xa56c('0x32')];if(_0x1402dc[_0xa56c('0x2f')]['includeAll']){_0xc14a40[_0xa56c('0x42')]=[{'all':!![]}];}_0xc14a40=_[_0xa56c('0x3d')]({},_0xc14a40,_0x1402dc[_0xa56c('0x48')]);return db[_0xa56c('0x2b')][_0xa56c('0x49')](_0xc14a40)[_0xa56c('0x25')](handleEntityNotFound(_0x2c6d2a,null))[_0xa56c('0x25')](function(_0x1b2b08){if(_0x1b2b08){var _0x1d3ce8=_0x1b2b08[_0xa56c('0x4d')]({'plain':!![]});_0x1d3ce8=qs[_0xa56c('0x4e')](_0x1d3ce8,['id','createdAt',_0xa56c('0x4f'),_0xa56c('0x50')]);_0x1402dc[_0xa56c('0x4b')]=_[_0xa56c('0x4e')](_0x1402dc[_0xa56c('0x4b')],['id',_0xa56c('0x51'),'updatedAt']);return db['sequelize'][_0xa56c('0x52')](function(_0x21381f){return db[_0xa56c('0x2b')][_0xa56c('0x4a')](_[_0xa56c('0x3d')](_0x1d3ce8,_0x1402dc[_0xa56c('0x4b')]),{'include':_0x1402dc[_0xa56c('0x2f')][_0xa56c('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x21381f})[_0xa56c('0x25')](function(_0xaddd0d){var _0x4e5820=_0xaddd0d[_0xa56c('0x4d')]({'plain':!![]});return db[_0xa56c('0x53')]['findAll']({'where':{'userProfileId':_0x1402dc[_0xa56c('0x46')]['id']},'raw':!![]})[_0xa56c('0x25')](function(_0x6fe8ee){if(_0x6fe8ee){return BPromise[_0xa56c('0x54')](_0x6fe8ee,function(_0x171b2a){return new BPromise(function(_0x11d6b8,_0x38f66a){if(_0x171b2a[_0xa56c('0x55')]===null||_0x171b2a['autoAssociation']===0x1)_0x11d6b8(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x171b2a['id']},'raw':!![]})['then'](function(_0x137d7f){var _0x25d85b=_[_0xa56c('0x3e')](_0x137d7f,function(_0x3fd5f4){return qs[_0xa56c('0x4e')](_0x3fd5f4,['id',_0xa56c('0x51'),'updatedAt',_0xa56c('0x56')]);});_0x11d6b8(_0x25d85b);})[_0xa56c('0x44')](function(_0x3b498a){_0x38f66a(_0x3b498a);});})['then'](function(_0x4d8a96){var _0x138e05=qs['omit'](_0x171b2a,['id','createdAt',_0xa56c('0x4f')]);_0x138e05[_0xa56c('0x57')]=_0x4e5820['id'];if(_0x4d8a96)_0x138e05[_0xa56c('0x58')]=_0x4d8a96;return _0x138e05;})[_0xa56c('0x25')](function(_0x2c6bb5){return db[_0xa56c('0x53')][_0xa56c('0x4a')](_0x2c6bb5,{'include':[{'model':db[_0xa56c('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x21381f});});})[_0xa56c('0x25')](function(){return _0x4e5820;});}});});});}})['then'](respondWithResult(_0x2c6d2a,0xc9))[_0xa56c('0x44')](handleError(_0x2c6d2a,null));};exports[_0xa56c('0x24')]=function(_0x457c75,_0x12554d){if(_0x457c75['body']['id']){delete _0x457c75['body']['id'];}return db[_0xa56c('0x2b')][_0xa56c('0x49')]({'where':{'id':_0x457c75[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x12554d,null))[_0xa56c('0x25')](saveUpdates(_0x457c75[_0xa56c('0x4b')],null))['then'](respondWithResult(_0x12554d,null))[_0xa56c('0x44')](handleError(_0x12554d,null));};exports[_0xa56c('0x26')]=function(_0x4b2b50,_0x4094f8){return db['UserProfile'][_0xa56c('0x49')]({'where':{'id':_0x4b2b50[_0xa56c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4094f8,null))[_0xa56c('0x25')](removeEntity(_0x4094f8,null))[_0xa56c('0x44')](handleError(_0x4094f8,null));};exports[_0xa56c('0x5a')]=function(_0x41d9b4,_0xee2278){return db[_0xa56c('0x2b')][_0xa56c('0x5a')]()[_0xa56c('0x25')](respondWithResult(_0xee2278,null))[_0xa56c('0x44')](handleError(_0xee2278,null));};exports['addSections']=function(_0x4dabfa,_0x57333c){var _0x5c3b32=_0x4dabfa['body'];return db['UserProfile']['find']({'where':{'id':_0x4dabfa[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x57333c,null))[_0xa56c('0x25')](function(_0x569cce){if(_0x569cce){return db[_0xa56c('0x5b')][_0xa56c('0x52')](function(_0x2daf13){return db[_0xa56c('0x53')]['destroy']({'where':{'userProfileId':_0x4dabfa[_0xa56c('0x46')]['id'],'sectionId':_['map'](_0x5c3b32,function(_0x4b9b29){return _0x4b9b29[_0xa56c('0x56')];})},'transaction':_0x2daf13})[_0xa56c('0x25')](function(){var _0x5b860c=_[_0xa56c('0x3e')](_0x5c3b32,function(_0x5f2a33){_0x5f2a33['userProfileId']=_0x4dabfa[_0xa56c('0x46')]['id'];return _0x5f2a33;});var _0x52bb0b=[];return BPromise['each'](_0x5b860c,function(_0x54b53a){return db['UserProfileSection'][_0xa56c('0x4a')](_0x54b53a,{'include':[{'model':db[_0xa56c('0x59')],'as':_0xa56c('0x58')}],'raw':!![],'transaction':_0x2daf13})[_0xa56c('0x25')](function(_0x3e8323){_0x52bb0b[_0xa56c('0x5c')](_0x3e8323[_0xa56c('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x52bb0b;});});});}})['then'](function(_0x4521b1){return _0x4521b1;})[_0xa56c('0x25')](respondWithResult(_0x57333c,null))['catch'](handleError(_0x57333c,null));};exports[_0xa56c('0x5d')]=function(_0x1e8716,_0x47090d){var _0x59b078;return db[_0xa56c('0x2b')][_0xa56c('0x49')]({'where':{'id':_0x1e8716[_0xa56c('0x46')]['id']},'attributes':['id',_0xa56c('0x40')]})[_0xa56c('0x25')](handleEntityNotFound(_0x47090d,null))[_0xa56c('0x25')](function(_0x1b5c7b){if(_0x1b5c7b){_0x59b078=_0x1b5c7b;return db['UserProfileSection'][_0xa56c('0x26')]({'where':{'userProfileId':_0x1e8716[_0xa56c('0x46')]['id'],'sectionId':_0x1e8716[_0xa56c('0x2f')]['ids']}});}})['then'](function(){return _0x59b078;})['then'](respondWithStatusCode(_0x47090d,null))[_0xa56c('0x44')](handleError(_0x47090d,null));};exports[_0xa56c('0x5e')]=function(_0x3d64ec,_0x105141){var _0x56a900=[];var _0x346148=[];return db[_0xa56c('0x53')][_0xa56c('0x5f')]({'where':{'userProfileId':_0x3d64ec[_0xa56c('0x46')]['id']},'raw':!![]})['then'](function(_0x313cea){_0x56a900=_['filter'](_0x313cea,function(_0x16ea7d){return _0x16ea7d[_0xa56c('0x60')]===0x1||_[_0xa56c('0x61')]([0x3eb,0x709],_0x16ea7d[_0xa56c('0x56')]);});if(!_[_0xa56c('0x62')](_0x56a900)){return _[_0xa56c('0x3e')](_0x56a900,function(_0x52d9ff){return _0x52d9ff['sectionId'];});}else{return;}})['then'](function(_0x571871){if(_0x571871)_0x346148=_0x571871;if(_[_0xa56c('0x61')](_0x346148,0x64)){var _0x274496=_[_0xa56c('0x49')](_0x56a900,{'sectionId':0x64});return hasDefaultDashboard(_0x274496)[_0xa56c('0x25')](function(_0x51ca47){return _['map'](_0x56a900,function(_0x2ccb1a){if(_0x2ccb1a[_0xa56c('0x56')]===0x64){_0x2ccb1a[_0xa56c('0x63')]=_0x51ca47;}return _0x2ccb1a;});});}else{return;}})[_0xa56c('0x25')](function(_0x58115f){if(_0x58115f)_0x56a900=_0x58115f;if(_[_0xa56c('0x61')](_0x346148,0x3eb)){var _0x961836=_[_0xa56c('0x49')](_0x56a900,{'sectionId':0x3eb});return getCustomDashboards(_0x961836)[_0xa56c('0x25')](function(_0x3242d3){return _[_0xa56c('0x3e')](_0x56a900,function(_0x31eed4){if(_0x961836['enabled']){if(_0x31eed4[_0xa56c('0x56')]===0x3eb){_0x31eed4['subsections']=_0x3242d3;}}else{if(_0x31eed4[_0xa56c('0x56')]===0x64){if(!_0x31eed4[_0xa56c('0x63')]){_0x31eed4[_0xa56c('0x63')]=[];}_0x31eed4[_0xa56c('0x63')]=_0x31eed4[_0xa56c('0x63')][_0xa56c('0x64')](_0x3242d3);}}return _0x31eed4;});});}else{return;}})[_0xa56c('0x25')](function(_0x2dd36a){if(_0x2dd36a)_0x56a900=_0x2dd36a;if(_[_0xa56c('0x61')](_0x346148,0x709)){var _0x445321=_[_0xa56c('0x49')](_0x56a900,{'sectionId':0x709});return getPlugins(_0x445321)['then'](function(_0x3c59cb){if(_0x445321[_0xa56c('0x60')]){return _['map'](_0x56a900,function(_0x5c3239){if(_0x5c3239[_0xa56c('0x56')]===0x709){_0x5c3239['subsections']=_0x3c59cb;}return _0x5c3239;});}else{var _0xc0d2a4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3c59cb};var _0x1edfc6=_[_0xa56c('0x3e')](_0x56a900);_0x1edfc6[_0xa56c('0x5c')](_0xc0d2a4);return _0x1edfc6;}});}else{return;}})[_0xa56c('0x25')](function(_0x254e56){if(_0x254e56)_0x56a900=_0x254e56;return _[_0xa56c('0x3b')](_0x56a900,[_0xa56c('0x60'),0x1]);})[_0xa56c('0x25')](respondWithResult(_0x105141,null))[_0xa56c('0x44')](handleError(_0x105141,null));};function hasDefaultDashboard(_0xcbac0c){var _0x5bce3d=[0x65];return new BPromise(function(_0x2c853b,_0x3591fc){try{if(_0xcbac0c[_0xa56c('0x55')]){_0x2c853b(_0x5bce3d);}else{return db[_0xa56c('0x59')]['findOne']({'where':{'sectionId':_0xcbac0c['id']},'raw':!![]})[_0xa56c('0x25')](function(_0x4df500){_0x4df500?_0x2c853b(_0x5bce3d):_0x2c853b();});}}catch(_0x299346){_0x3591fc(_0x299346);}});}function getCustomDashboards(_0x394ad3){var _0x1c9f9a=[];return new BPromise(function(_0x40d9bf,_0x3b460a){try{if(_0x394ad3[_0xa56c('0x55')]){return db[_0xa56c('0x65')][_0xa56c('0x5f')]({'raw':!![]})['then'](function(_0x1ac0d5){_0x1ac0d5['forEach'](function(_0x556548){_0x1c9f9a[_0xa56c('0x5c')](_0x556548['id']+0x1869f);});_0x40d9bf(_0x1c9f9a);});}else{return db[_0xa56c('0x59')][_0xa56c('0x5f')]({'where':{'sectionId':_0x394ad3['id']},'raw':!![]})['then'](function(_0x5422e9){_0x5422e9[_0xa56c('0x66')](function(_0x180fd4){_0x1c9f9a[_0xa56c('0x5c')](_0x180fd4['resourceId']+0x1869f);});_0x40d9bf(_0x1c9f9a);});}}catch(_0x15d7aa){_0x3b460a(_0x15d7aa);}});}function getPlugins(_0x420c01){var _0x3248ed=[];return new BPromise(function(_0x35cb06,_0x4e4e92){try{if(_0x420c01[_0xa56c('0x55')]){return db[_0xa56c('0x67')][_0xa56c('0x5f')]({'raw':!![]})[_0xa56c('0x25')](function(_0x55f114){_0x55f114[_0xa56c('0x66')](function(_0x1b3f2e){_0x3248ed[_0xa56c('0x5c')](_0x1b3f2e['id']+0x15b38);});_0x35cb06(_0x3248ed);});}else{return db[_0xa56c('0x59')][_0xa56c('0x5f')]({'where':{'sectionId':_0x420c01['id']},'raw':!![]})[_0xa56c('0x25')](function(_0x4e26ae){_0x4e26ae[_0xa56c('0x66')](function(_0x5050f7){_0x3248ed[_0xa56c('0x5c')](_0x5050f7[_0xa56c('0x68')]+0x15b38);});_0x35cb06(_0x3248ed);});}}catch(_0x55c60a){_0x4e4e92(_0x55c60a);}});}exports[_0xa56c('0x69')]=function(_0x206244,_0x3f6202){return db[_0xa56c('0x2b')]['find']({'where':{'id':_0x206244['params']['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x3f6202,null))[_0xa56c('0x25')](function(_0x2ab804){if(_0x2ab804){return db[_0xa56c('0x5b')][_0xa56c('0x52')](function(_0x330d11){return db[_0xa56c('0x53')][_0xa56c('0x5f')]({'where':{'userProfileId':_0x206244[_0xa56c('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x9d1157){if(_0x9d1157){return db[_0xa56c('0x53')][_0xa56c('0x26')]({'where':{'userProfileId':_0x206244[_0xa56c('0x46')]['id'],'id':_['map'](_0x9d1157,function(_0x5db439){return _0x5db439['id'];})},'transaction':_0x330d11});}})[_0xa56c('0x25')](function(_0x3e4568){var _0x312b8a=_[_0xa56c('0x3e')](_0x206244[_0xa56c('0x4b')],function(_0x5c4977){_0x5c4977[_0xa56c('0x57')]=_0x206244['params']['id'];return _0x5c4977;});return db[_0xa56c('0x53')][_0xa56c('0x6a')](_0x312b8a,{'raw':!![],'transaction':_0x330d11});})['then'](function(_0x53fd48){var _0x3337ab=_[_0xa56c('0x3b')](_['map'](_0x53fd48,function(_0x4f7904){return _0x4f7904[_0xa56c('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x3337ab){return db[_0xa56c('0x53')][_0xa56c('0x5f')]({'where':{'userProfileId':_0x206244[_0xa56c('0x46')]['id'],'sectionId':_[_0xa56c('0x3e')](_0x3337ab,function(_0x351b95){return _0x351b95['sectionId'];})},'attributes':['id',_0xa56c('0x56')],'raw':!![]})[_0xa56c('0x25')](function(_0x3166c9){var _0x4d87c8=_[_0xa56c('0x3e')](_0x206244[_0xa56c('0x4b')],function(_0x2e3990){_0x2e3990[_0xa56c('0x57')]=_0x206244['params']['id'];return _0x2e3990;});return db[_0xa56c('0x59')]['bulkCreate'](_0x4d87c8,{'raw':!![],'transaction':_0x330d11});});}})['catch'](handleError(_0x3f6202,null));});}})[_0xa56c('0x25')](function(_0x2c8bf5){var _0x4797f0=_[_0xa56c('0x3e')](_0x2c8bf5,function(_0x41a80e){return _0x41a80e[_0xa56c('0x4d')]({'plain':!![]});});})['then'](respondWithResult(_0x3f6202,null))[_0xa56c('0x44')](handleError(_0x3f6202,null));};exports[_0xa56c('0x6b')]=function(_0x3a9dbd,_0x41d5e8,_0x5ca802){return db[_0xa56c('0x2b')][_0xa56c('0x49')]({'where':{'id':_0x3a9dbd[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x41d5e8,null))[_0xa56c('0x25')](function(_0x4d6fbd){if(_0x4d6fbd){return _0x4d6fbd['removeResources'](_0x3a9dbd[_0xa56c('0x2f')]['ids']);}})[_0xa56c('0x25')](respondWithStatusCode(_0x41d5e8,null))[_0xa56c('0x44')](handleError(_0x41d5e8,null));};exports[_0xa56c('0x6c')]=function(_0x17ee20,_0x34adfb){var _0x6df1dc={};if(!_0x17ee20[_0xa56c('0x2f')][_0xa56c('0x6d')])throw new Error(_0xa56c('0x6e'));if(!_0x17ee20['query'][_0xa56c('0x36')](_0xa56c('0x37'))){_0x6df1dc[_0xa56c('0x1d')]=qs[_0xa56c('0x1d')](_0x17ee20[_0xa56c('0x2f')][_0xa56c('0x1d')]);_0x6df1dc[_0xa56c('0x1a')]=qs['offset'](_0x17ee20[_0xa56c('0x2f')][_0xa56c('0x1a')]);}return db['UserProfile'][_0xa56c('0x49')]({'where':{'id':_0x17ee20[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](function(_0x39a8f2){if(!_0x39a8f2)throw new Error(_0xa56c('0x6f')+_0x17ee20[_0xa56c('0x46')]['id']);return db[_0xa56c('0x2b')]['getResources'](_0x17ee20);})[_0xa56c('0x25')](respondWithFilteredResult(_0x34adfb,_0x6df1dc))[_0xa56c('0x44')](handleError(_0x34adfb,null));}; \ No newline at end of file +var _0x650c=['rows','catch','show','params','create','body','clone','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','find','describe','addSections','each','Resources','push','removeSections','ids','getSections','filter','enabled','includes','isEmpty','subsections','concat','findOne','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include'];(function(_0x624a46,_0x3b3c14){var _0x3a1a39=function(_0x2b8f96){while(--_0x2b8f96){_0x624a46['push'](_0x624a46['shift']());}};_0x3a1a39(++_0x3b3c14);}(_0x650c,0x1df));var _0xc650=function(_0x51fb74,_0x5b169b){_0x51fb74=_0x51fb74-0x0;var _0x1d62dd=_0x650c[_0x51fb74];return _0x1d62dd;};'use strict';var emlformat=require(_0xc650('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc650('0x1'));var jsonpatch=require(_0xc650('0x2'));var rp=require(_0xc650('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc650('0x4'));var sox=require(_0xc650('0x5'));var csv=require(_0xc650('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc650('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc650('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc650('0x6'));var querystring=require(_0xc650('0x9'));var Papa=require('papaparse');var Redis=require(_0xc650('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xc650('0xb'));var as=require(_0xc650('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc650('0xd'))(_0xc650('0xe'));var utils=require(_0xc650('0xf'));var config=require(_0xc650('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xc650('0x11'))['db'];config[_0xc650('0x12')]=_[_0xc650('0x13')](config[_0xc650('0x12')],{'host':_0xc650('0x14'),'port':0x18eb});var socket=require(_0xc650('0x15'))(new Redis(config[_0xc650('0x12')]));require(_0xc650('0x16'))[_0xc650('0x17')](socket);function respondWithStatusCode(_0x670cc2,_0x586ab0){_0x586ab0=_0x586ab0||0xcc;return function(_0x58a289){if(_0x58a289){return _0x670cc2[_0xc650('0x18')](_0x586ab0);}return _0x670cc2[_0xc650('0x19')](_0x586ab0)['end']();};}function respondWithResult(_0x5c1d38,_0x2be82){_0x2be82=_0x2be82||0xc8;return function(_0xdc4f43){if(_0xdc4f43){return _0x5c1d38[_0xc650('0x19')](_0x2be82)[_0xc650('0x1a')](_0xdc4f43);}};}function respondWithFilteredResult(_0x3f5ce3,_0x32d3e5){return function(_0x3c32e5){if(_0x3c32e5){var _0x3838e4=typeof _0x32d3e5[_0xc650('0x1b')]===_0xc650('0x1c')&&typeof _0x32d3e5[_0xc650('0x1d')]===_0xc650('0x1c');var _0x29bd57=_0x3c32e5[_0xc650('0x1e')];var _0x2fab03=_0x3838e4?0x0:_0x32d3e5[_0xc650('0x1b')];var _0x2f9909=_0x3838e4?_0x3c32e5[_0xc650('0x1e')]:_0x32d3e5[_0xc650('0x1b')]+_0x32d3e5['limit'];var _0x4181ba;if(_0x2f9909>=_0x29bd57){_0x2f9909=_0x29bd57;_0x4181ba=0xc8;}else{_0x4181ba=0xce;}_0x3f5ce3[_0xc650('0x19')](_0x4181ba);return _0x3f5ce3['set'](_0xc650('0x1f'),_0x2fab03+'-'+_0x2f9909+'/'+_0x29bd57)[_0xc650('0x1a')](_0x3c32e5);}return null;};}function patchUpdates(_0x5f3880){return function(_0x21afb4){try{jsonpatch[_0xc650('0x20')](_0x21afb4,_0x5f3880,!![]);}catch(_0x43208d){return BPromise[_0xc650('0x21')](_0x43208d);}return _0x21afb4[_0xc650('0x22')]();};}function saveUpdates(_0x391235,_0x410689){return function(_0x26f59c){if(_0x26f59c){return _0x26f59c[_0xc650('0x23')](_0x391235)[_0xc650('0x24')](function(_0x1ce5a8){return _0x1ce5a8;});}return null;};}function removeEntity(_0x484783,_0x10f784){return function(_0x40f264){if(_0x40f264){return _0x40f264[_0xc650('0x25')]()[_0xc650('0x24')](function(){_0x484783['status'](0xcc)[_0xc650('0x26')]();});}};}function handleEntityNotFound(_0x18c94f,_0x466b39){return function(_0x29e5ef){if(!_0x29e5ef){_0x18c94f[_0xc650('0x18')](0x194);}return _0x29e5ef;};}function handleError(_0x57bd5c,_0xc74214){_0xc74214=_0xc74214||0x1f4;return function(_0x1fb306){logger['error'](_0x1fb306[_0xc650('0x27')]);if(_0x1fb306[_0xc650('0x28')]){delete _0x1fb306[_0xc650('0x28')];}_0x57bd5c[_0xc650('0x19')](_0xc74214)['send'](_0x1fb306);};}exports['index']=function(_0x3d3cfc,_0x3ed313){var _0x2a3cde={},_0x582b06={},_0x4493eb={'count':0x0,'rows':[]};var _0x11a804=_[_0xc650('0x29')](db[_0xc650('0x2a')][_0xc650('0x2b')],function(_0x53423d){return{'name':_0x53423d[_0xc650('0x2c')],'type':_0x53423d[_0xc650('0x2d')][_0xc650('0x2e')]};});_0x582b06[_0xc650('0x2f')]=_[_0xc650('0x29')](_0x11a804,_0xc650('0x28'));_0x582b06['query']=_[_0xc650('0x30')](_0x3d3cfc['query']);_0x582b06[_0xc650('0x31')]=_[_0xc650('0x32')](_0x582b06[_0xc650('0x2f')],_0x582b06[_0xc650('0x33')]);_0x2a3cde[_0xc650('0x34')]=_[_0xc650('0x32')](_0x582b06[_0xc650('0x2f')],qs[_0xc650('0x35')](_0x3d3cfc['query'][_0xc650('0x35')]));_0x2a3cde[_0xc650('0x34')]=_0x2a3cde[_0xc650('0x34')][_0xc650('0x36')]?_0x2a3cde[_0xc650('0x34')]:_0x582b06['model'];if(!_0x3d3cfc['query'][_0xc650('0x37')](_0xc650('0x38'))){_0x2a3cde[_0xc650('0x1d')]=qs['limit'](_0x3d3cfc[_0xc650('0x33')][_0xc650('0x1d')]);_0x2a3cde[_0xc650('0x1b')]=qs['offset'](_0x3d3cfc['query'][_0xc650('0x1b')]);}_0x2a3cde[_0xc650('0x39')]=qs[_0xc650('0x3a')](_0x3d3cfc[_0xc650('0x33')][_0xc650('0x3a')]);_0x2a3cde[_0xc650('0x3b')]=qs[_0xc650('0x31')](_[_0xc650('0x3c')](_0x3d3cfc[_0xc650('0x33')],_0x582b06[_0xc650('0x31')]),_0x11a804);if(_0x3d3cfc[_0xc650('0x33')]['filter']){_0x2a3cde[_0xc650('0x3b')]=_['merge'](_0x2a3cde[_0xc650('0x3b')],{'$or':_[_0xc650('0x29')](_0x11a804,function(_0x261f39){if(_0x261f39[_0xc650('0x2d')]!==_0xc650('0x3d')){var _0x2908ab={};_0x2908ab[_0x261f39[_0xc650('0x28')]]={'$like':'%'+_0x3d3cfc['query']['filter']+'%'};return _0x2908ab;}})});}_0x2a3cde=_[_0xc650('0x3e')]({},_0x2a3cde,_0x3d3cfc[_0xc650('0x3f')]);var _0x542999={'where':_0x2a3cde[_0xc650('0x3b')]};return db['UserProfile']['count'](_0x542999)['then'](function(_0x512670){_0x4493eb[_0xc650('0x1e')]=_0x512670;if(_0x3d3cfc[_0xc650('0x33')][_0xc650('0x40')]){_0x2a3cde[_0xc650('0x41')]=[{'all':!![]}];}return db[_0xc650('0x2a')]['findAll'](_0x2a3cde);})[_0xc650('0x24')](function(_0x510c69){_0x4493eb[_0xc650('0x42')]=_0x510c69;return _0x4493eb;})['then'](respondWithFilteredResult(_0x3ed313,_0x2a3cde))[_0xc650('0x43')](handleError(_0x3ed313,null));};exports[_0xc650('0x44')]=function(_0xb79946,_0xa8269f){var _0x4b51b6={'raw':![],'where':{'id':_0xb79946[_0xc650('0x45')]['id']}},_0x3b0468={};_0x3b0468[_0xc650('0x2f')]=_[_0xc650('0x30')](db[_0xc650('0x2a')][_0xc650('0x2b')]);_0x3b0468[_0xc650('0x33')]=_[_0xc650('0x30')](_0xb79946[_0xc650('0x33')]);_0x3b0468[_0xc650('0x31')]=_[_0xc650('0x32')](_0x3b0468['model'],_0x3b0468[_0xc650('0x33')]);_0x4b51b6['attributes']=_['intersection'](_0x3b0468[_0xc650('0x2f')],qs[_0xc650('0x35')](_0xb79946['query'][_0xc650('0x35')]));_0x4b51b6['attributes']=_0x4b51b6['attributes'][_0xc650('0x36')]?_0x4b51b6['attributes']:_0x3b0468[_0xc650('0x2f')];if(_0xb79946[_0xc650('0x33')]['includeAll']){_0x4b51b6['include']=[{'all':!![]}];}_0x4b51b6=_[_0xc650('0x3e')]({},_0x4b51b6,_0xb79946['options']);return db[_0xc650('0x2a')]['find'](_0x4b51b6)[_0xc650('0x24')](handleEntityNotFound(_0xa8269f,null))[_0xc650('0x24')](respondWithResult(_0xa8269f,null))[_0xc650('0x43')](handleError(_0xa8269f,null));};exports[_0xc650('0x46')]=function(_0x97618c,_0x5a5b44){return db[_0xc650('0x2a')][_0xc650('0x46')](_0x97618c[_0xc650('0x47')],{})[_0xc650('0x24')](respondWithResult(_0x5a5b44,0xc9))[_0xc650('0x43')](handleError(_0x5a5b44,null));};exports[_0xc650('0x48')]=function(_0x56ef95,_0x3e2fa){var _0x24ae0d={'where':{'id':_0x56ef95[_0xc650('0x45')]['id']}},_0x2165f9={};_0x2165f9[_0xc650('0x2f')]=_[_0xc650('0x30')](db[_0xc650('0x2a')][_0xc650('0x2b')]);_0x24ae0d[_0xc650('0x34')]=_[_0xc650('0x32')](_0x2165f9[_0xc650('0x2f')],qs['fields'](_0x56ef95[_0xc650('0x33')][_0xc650('0x35')]));_0x24ae0d[_0xc650('0x34')]=_0x24ae0d[_0xc650('0x34')][_0xc650('0x36')]?_0x24ae0d[_0xc650('0x34')]:_0x2165f9['model'];if(_0x56ef95['query'][_0xc650('0x40')]){_0x24ae0d[_0xc650('0x41')]=[{'all':!![]}];}_0x24ae0d=_[_0xc650('0x3e')]({},_0x24ae0d,_0x56ef95[_0xc650('0x3f')]);return db[_0xc650('0x2a')]['find'](_0x24ae0d)[_0xc650('0x24')](handleEntityNotFound(_0x3e2fa,null))['then'](function(_0x22f894){if(_0x22f894){var _0x1c0382=_0x22f894[_0xc650('0x49')]({'plain':!![]});_0x1c0382=qs[_0xc650('0x4a')](_0x1c0382,['id',_0xc650('0x4b'),_0xc650('0x4c'),'crudPermissions']);_0x56ef95[_0xc650('0x47')]=_[_0xc650('0x4a')](_0x56ef95[_0xc650('0x47')],['id',_0xc650('0x4b'),_0xc650('0x4c')]);return db[_0xc650('0x4d')]['transaction'](function(_0x5934e8){return db[_0xc650('0x2a')][_0xc650('0x46')](_['merge'](_0x1c0382,_0x56ef95[_0xc650('0x47')]),{'include':_0x56ef95['query'][_0xc650('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x5934e8})['then'](function(_0x4b76a1){var _0x5b84b3=_0x4b76a1[_0xc650('0x49')]({'plain':!![]});return db[_0xc650('0x4e')][_0xc650('0x4f')]({'where':{'userProfileId':_0x56ef95[_0xc650('0x45')]['id']},'raw':!![]})[_0xc650('0x24')](function(_0x54d6ff){if(_0x54d6ff){return BPromise['each'](_0x54d6ff,function(_0x522714){return new BPromise(function(_0x4c81e4,_0x243b68){if(_0x522714[_0xc650('0x50')]===null||_0x522714[_0xc650('0x50')]===0x1)_0x4c81e4(null);return db[_0xc650('0x51')][_0xc650('0x4f')]({'where':{'sectionId':_0x522714['id']},'raw':!![]})['then'](function(_0x50b346){var _0x8a7a2=_[_0xc650('0x29')](_0x50b346,function(_0x3b8f7e){return qs[_0xc650('0x4a')](_0x3b8f7e,['id','createdAt',_0xc650('0x4c'),_0xc650('0x52')]);});_0x4c81e4(_0x8a7a2);})[_0xc650('0x43')](function(_0x4add3f){_0x243b68(_0x4add3f);});})[_0xc650('0x24')](function(_0x43ef76){var _0x4b7bc6=qs[_0xc650('0x4a')](_0x522714,['id',_0xc650('0x4b'),_0xc650('0x4c')]);_0x4b7bc6[_0xc650('0x53')]=_0x5b84b3['id'];if(_0x43ef76)_0x4b7bc6['Resources']=_0x43ef76;return _0x4b7bc6;})[_0xc650('0x24')](function(_0x303566){return db[_0xc650('0x4e')][_0xc650('0x46')](_0x303566,{'include':[{'model':db[_0xc650('0x51')],'as':'Resources'}],'raw':!![],'transaction':_0x5934e8});});})[_0xc650('0x24')](function(){return _0x5b84b3;});}});});});}})[_0xc650('0x24')](respondWithResult(_0x3e2fa,0xc9))['catch'](handleError(_0x3e2fa,null));};exports[_0xc650('0x23')]=function(_0x15342f,_0x9e7f5){if(_0x15342f[_0xc650('0x47')]['id']){delete _0x15342f[_0xc650('0x47')]['id'];}return db['UserProfile'][_0xc650('0x54')]({'where':{'id':_0x15342f[_0xc650('0x45')]['id']}})[_0xc650('0x24')](handleEntityNotFound(_0x9e7f5,null))['then'](saveUpdates(_0x15342f[_0xc650('0x47')],null))[_0xc650('0x24')](respondWithResult(_0x9e7f5,null))[_0xc650('0x43')](handleError(_0x9e7f5,null));};exports['destroy']=function(_0x2b6bc4,_0x59f312){return db['UserProfile'][_0xc650('0x54')]({'where':{'id':_0x2b6bc4[_0xc650('0x45')]['id']}})[_0xc650('0x24')](handleEntityNotFound(_0x59f312,null))['then'](removeEntity(_0x59f312,null))[_0xc650('0x43')](handleError(_0x59f312,null));};exports[_0xc650('0x55')]=function(_0x4fb05f,_0x1e690f){return db[_0xc650('0x2a')][_0xc650('0x55')]()[_0xc650('0x24')](respondWithResult(_0x1e690f,null))[_0xc650('0x43')](handleError(_0x1e690f,null));};exports[_0xc650('0x56')]=function(_0x3276a9,_0x1c4f3d){var _0x1de8a2=_0x3276a9[_0xc650('0x47')];return db[_0xc650('0x2a')][_0xc650('0x54')]({'where':{'id':_0x3276a9[_0xc650('0x45')]['id']}})[_0xc650('0x24')](handleEntityNotFound(_0x1c4f3d,null))[_0xc650('0x24')](function(_0x4c1c81){if(_0x4c1c81){return db[_0xc650('0x4d')]['transaction'](function(_0x34a738){return db[_0xc650('0x4e')][_0xc650('0x25')]({'where':{'userProfileId':_0x3276a9[_0xc650('0x45')]['id'],'sectionId':_[_0xc650('0x29')](_0x1de8a2,function(_0x3c0bc4){return _0x3c0bc4[_0xc650('0x52')];})},'transaction':_0x34a738})[_0xc650('0x24')](function(){var _0x4cc84d=_[_0xc650('0x29')](_0x1de8a2,function(_0x1a6bf9){_0x1a6bf9[_0xc650('0x53')]=_0x3276a9[_0xc650('0x45')]['id'];return _0x1a6bf9;});var _0x170199=[];return BPromise[_0xc650('0x57')](_0x4cc84d,function(_0x18852e){return db[_0xc650('0x4e')][_0xc650('0x46')](_0x18852e,{'include':[{'model':db['UserProfileResource'],'as':_0xc650('0x58')}],'raw':!![],'transaction':_0x34a738})[_0xc650('0x24')](function(_0x58cd42){_0x170199[_0xc650('0x59')](_0x58cd42[_0xc650('0x49')]({'plain':!![]}));});})['then'](function(){return _0x170199;});});});}})[_0xc650('0x24')](function(_0x52b707){return _0x52b707;})[_0xc650('0x24')](respondWithResult(_0x1c4f3d,null))[_0xc650('0x43')](handleError(_0x1c4f3d,null));};exports[_0xc650('0x5a')]=function(_0x384946,_0x5d09aa){var _0x5b9c83;return db['UserProfile'][_0xc650('0x54')]({'where':{'id':_0x384946[_0xc650('0x45')]['id']},'attributes':['id',_0xc650('0x28')]})[_0xc650('0x24')](handleEntityNotFound(_0x5d09aa,null))[_0xc650('0x24')](function(_0x568e78){if(_0x568e78){_0x5b9c83=_0x568e78;return db[_0xc650('0x4e')][_0xc650('0x25')]({'where':{'userProfileId':_0x384946[_0xc650('0x45')]['id'],'sectionId':_0x384946[_0xc650('0x33')][_0xc650('0x5b')]}});}})[_0xc650('0x24')](function(){return _0x5b9c83;})['then'](respondWithStatusCode(_0x5d09aa,null))[_0xc650('0x43')](handleError(_0x5d09aa,null));};exports[_0xc650('0x5c')]=function(_0x5db465,_0x36407d){var _0x12a05e=[];var _0x40eeed=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5db465[_0xc650('0x45')]['id']},'raw':!![]})['then'](function(_0x588655){_0x12a05e=_[_0xc650('0x5d')](_0x588655,function(_0xc054af){return _0xc054af[_0xc650('0x5e')]===0x1||_[_0xc650('0x5f')]([0x3eb,0x709],_0xc054af['sectionId']);});if(!_[_0xc650('0x60')](_0x12a05e)){return _[_0xc650('0x29')](_0x12a05e,function(_0x3c8e22){return _0x3c8e22['sectionId'];});}else{return;}})[_0xc650('0x24')](function(_0x322b24){if(_0x322b24)_0x40eeed=_0x322b24;if(_['includes'](_0x40eeed,0x64)){var _0x40bed7=_[_0xc650('0x54')](_0x12a05e,{'sectionId':0x64});return hasDefaultDashboard(_0x40bed7)[_0xc650('0x24')](function(_0x9c6ac4){return _[_0xc650('0x29')](_0x12a05e,function(_0x1f5828){if(_0x1f5828[_0xc650('0x52')]===0x64){_0x1f5828['subsections']=_0x9c6ac4;}return _0x1f5828;});});}else{return;}})[_0xc650('0x24')](function(_0x158a75){if(_0x158a75)_0x12a05e=_0x158a75;if(_['includes'](_0x40eeed,0x3eb)){var _0x475ecb=_[_0xc650('0x54')](_0x12a05e,{'sectionId':0x3eb});return getCustomDashboards(_0x475ecb)['then'](function(_0x9e5fba){return _[_0xc650('0x29')](_0x12a05e,function(_0x137f93){if(_0x475ecb[_0xc650('0x5e')]){if(_0x137f93[_0xc650('0x52')]===0x3eb){_0x137f93[_0xc650('0x61')]=_0x9e5fba;}}else{if(_0x137f93[_0xc650('0x52')]===0x64){if(!_0x137f93[_0xc650('0x61')]){_0x137f93[_0xc650('0x61')]=[];}_0x137f93['subsections']=_0x137f93[_0xc650('0x61')][_0xc650('0x62')](_0x9e5fba);}}return _0x137f93;});});}else{return;}})[_0xc650('0x24')](function(_0x401899){if(_0x401899)_0x12a05e=_0x401899;if(_[_0xc650('0x5f')](_0x40eeed,0x709)){var _0x5e50ed=_[_0xc650('0x54')](_0x12a05e,{'sectionId':0x709});return getPlugins(_0x5e50ed)[_0xc650('0x24')](function(_0x47bf09){if(_0x5e50ed['enabled']){return _['map'](_0x12a05e,function(_0x4b5384){if(_0x4b5384[_0xc650('0x52')]===0x709){_0x4b5384[_0xc650('0x61')]=_0x47bf09;}return _0x4b5384;});}else{var _0x5a8cf6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x47bf09};var _0x422760=_[_0xc650('0x29')](_0x12a05e);_0x422760['push'](_0x5a8cf6);return _0x422760;}});}else{return;}})[_0xc650('0x24')](function(_0x103070){if(_0x103070)_0x12a05e=_0x103070;return _[_0xc650('0x5d')](_0x12a05e,[_0xc650('0x5e'),0x1]);})[_0xc650('0x24')](respondWithResult(_0x36407d,null))['catch'](handleError(_0x36407d,null));};function hasDefaultDashboard(_0x262c28){var _0x437bee=[0x65];return new BPromise(function(_0x161482,_0x4d6ad9){try{if(_0x262c28['autoAssociation']){_0x161482(_0x437bee);}else{return db[_0xc650('0x51')][_0xc650('0x63')]({'where':{'sectionId':_0x262c28['id']},'raw':!![]})[_0xc650('0x24')](function(_0x5ebabc){_0x5ebabc?_0x161482(_0x437bee):_0x161482();});}}catch(_0xf7680d){_0x4d6ad9(_0xf7680d);}});}function getCustomDashboards(_0x1502ff){var _0x4f9d28=[];return new BPromise(function(_0x1dd434,_0x4e0c81){try{if(_0x1502ff[_0xc650('0x50')]){return db['Dashboard'][_0xc650('0x4f')]({'raw':!![]})[_0xc650('0x24')](function(_0x3a7abe){_0x3a7abe[_0xc650('0x64')](function(_0x4b4dd8){_0x4f9d28['push'](_0x4b4dd8['id']+0x1869f);});_0x1dd434(_0x4f9d28);});}else{return db[_0xc650('0x51')][_0xc650('0x4f')]({'where':{'sectionId':_0x1502ff['id']},'raw':!![]})[_0xc650('0x24')](function(_0x3f8bd7){_0x3f8bd7[_0xc650('0x64')](function(_0x4753c8){_0x4f9d28[_0xc650('0x59')](_0x4753c8[_0xc650('0x65')]+0x1869f);});_0x1dd434(_0x4f9d28);});}}catch(_0x922c66){_0x4e0c81(_0x922c66);}});}function getPlugins(_0x1e00f3){var _0x1dbe79=[];return new BPromise(function(_0x574895,_0x1cb785){try{if(_0x1e00f3['autoAssociation']){return db[_0xc650('0x66')][_0xc650('0x4f')]({'raw':!![]})['then'](function(_0x29142e){_0x29142e[_0xc650('0x64')](function(_0x3fe115){_0x1dbe79[_0xc650('0x59')](_0x3fe115['id']+0x15b38);});_0x574895(_0x1dbe79);});}else{return db[_0xc650('0x51')]['findAll']({'where':{'sectionId':_0x1e00f3['id']},'raw':!![]})[_0xc650('0x24')](function(_0x34f5cc){_0x34f5cc[_0xc650('0x64')](function(_0x4ccbdf){_0x1dbe79[_0xc650('0x59')](_0x4ccbdf['resourceId']+0x15b38);});_0x574895(_0x1dbe79);});}}catch(_0x397b37){_0x1cb785(_0x397b37);}});}exports[_0xc650('0x67')]=function(_0x2aaedf,_0x33bea3){return db[_0xc650('0x2a')][_0xc650('0x54')]({'where':{'id':_0x2aaedf[_0xc650('0x45')]['id']}})['then'](handleEntityNotFound(_0x33bea3,null))[_0xc650('0x24')](function(_0x230505){if(_0x230505){return db['sequelize'][_0xc650('0x68')](function(_0x4c4c23){return db[_0xc650('0x4e')][_0xc650('0x4f')]({'where':{'userProfileId':_0x2aaedf[_0xc650('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x51e280){if(_0x51e280){return db[_0xc650('0x4e')][_0xc650('0x25')]({'where':{'userProfileId':_0x2aaedf[_0xc650('0x45')]['id'],'id':_[_0xc650('0x29')](_0x51e280,function(_0x6fd477){return _0x6fd477['id'];})},'transaction':_0x4c4c23});}})[_0xc650('0x24')](function(_0x39e7b8){var _0x31a587=_[_0xc650('0x29')](_0x2aaedf[_0xc650('0x47')],function(_0x2bdba6){_0x2bdba6['userProfileId']=_0x2aaedf[_0xc650('0x45')]['id'];return _0x2bdba6;});return db[_0xc650('0x4e')][_0xc650('0x69')](_0x31a587,{'raw':!![],'transaction':_0x4c4c23});})[_0xc650('0x24')](function(_0x477a81){var _0x28269e=_[_0xc650('0x5d')](_['map'](_0x477a81,function(_0x458270){return _0x458270['get']({'plain':!![]});}),{'includeAll':![]});if(_0x28269e){return db[_0xc650('0x4e')][_0xc650('0x4f')]({'where':{'userProfileId':_0x2aaedf[_0xc650('0x45')]['id'],'sectionId':_[_0xc650('0x29')](_0x28269e,function(_0x506ee9){return _0x506ee9['sectionId'];})},'attributes':['id',_0xc650('0x52')],'raw':!![]})[_0xc650('0x24')](function(_0x1b7471){var _0xfc6dc2=_[_0xc650('0x29')](_0x2aaedf[_0xc650('0x47')],function(_0x397f85){_0x397f85[_0xc650('0x53')]=_0x2aaedf[_0xc650('0x45')]['id'];return _0x397f85;});return db['UserProfileResource'][_0xc650('0x69')](_0xfc6dc2,{'raw':!![],'transaction':_0x4c4c23});});}})['catch'](handleError(_0x33bea3,null));});}})[_0xc650('0x24')](function(_0x1970a5){var _0x1a2cba=_[_0xc650('0x29')](_0x1970a5,function(_0xac3d68){return _0xac3d68[_0xc650('0x49')]({'plain':!![]});});})[_0xc650('0x24')](respondWithResult(_0x33bea3,null))[_0xc650('0x43')](handleError(_0x33bea3,null));};exports[_0xc650('0x6a')]=function(_0x1c425c,_0x33e625,_0x42a963){return db[_0xc650('0x2a')][_0xc650('0x54')]({'where':{'id':_0x1c425c['params']['id']}})[_0xc650('0x24')](handleEntityNotFound(_0x33e625,null))[_0xc650('0x24')](function(_0x55ad8a){if(_0x55ad8a){return _0x55ad8a[_0xc650('0x6a')](_0x1c425c['query'][_0xc650('0x5b')]);}})[_0xc650('0x24')](respondWithStatusCode(_0x33e625,null))[_0xc650('0x43')](handleError(_0x33e625,null));};exports['getResources']=function(_0x160a28,_0x335f62){var _0x582192={};if(!_0x160a28[_0xc650('0x33')]['section'])throw new Error(_0xc650('0x6b'));if(!_0x160a28[_0xc650('0x33')]['hasOwnProperty'](_0xc650('0x38'))){_0x582192[_0xc650('0x1d')]=qs[_0xc650('0x1d')](_0x160a28['query']['limit']);_0x582192['offset']=qs['offset'](_0x160a28[_0xc650('0x33')][_0xc650('0x1b')]);}return db[_0xc650('0x2a')][_0xc650('0x54')]({'where':{'id':_0x160a28[_0xc650('0x45')]['id']}})['then'](function(_0x49853e){if(!_0x49853e)throw new Error(_0xc650('0x6c')+_0x160a28[_0xc650('0x45')]['id']);return db[_0xc650('0x2a')]['getResources'](_0x160a28);})[_0xc650('0x24')](respondWithFilteredResult(_0x335f62,_0x582192))['catch'](handleError(_0x335f62,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index aa9c0b6..c9562a1 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 _0x77d4=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x1a9681,_0x341d2f){var _0x54dfda=function(_0x65f242){while(--_0x65f242){_0x1a9681['push'](_0x1a9681['shift']());}};_0x54dfda(++_0x341d2f);}(_0x77d4,0x108));var _0x477d=function(_0x55ffee,_0x1862c1){_0x55ffee=_0x55ffee-0x0;var _0x27992d=_0x77d4[_0x55ffee];return _0x27992d;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x477d('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x477d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x477d('0x2'),'afterDestroy':_0x477d('0x3')};function emitEvent(_0x53637c){return function(_0x53e1b8,_0x16213f,_0xf3cde0){UserProfileEvents[_0x477d('0x4')](_0x53637c+':'+_0x53e1b8['id'],_0x53e1b8);UserProfileEvents[_0x477d('0x4')](_0x53637c,_0x53e1b8);_0xf3cde0(null);};}for(var e in events){if(events[_0x477d('0x5')](e)){var event=events[e];UserProfile[_0x477d('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x6691=['hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2d991d,_0x57dfd6){var _0x21ad9a=function(_0x274f83){while(--_0x274f83){_0x2d991d['push'](_0x2d991d['shift']());}};_0x21ad9a(++_0x57dfd6);}(_0x6691,0x12d));var _0x1669=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6691[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x1669('0x0'));var UserProfile=require(_0x1669('0x1'))['db'][_0x1669('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1669('0x3')](0x0);var events={'afterCreate':_0x1669('0x4'),'afterUpdate':_0x1669('0x5'),'afterDestroy':_0x1669('0x6')};function emitEvent(_0x455cbd){return function(_0x19a3f5,_0x2ad807,_0x4b41a5){UserProfileEvents[_0x1669('0x7')](_0x455cbd+':'+_0x19a3f5['id'],_0x19a3f5);UserProfileEvents[_0x1669('0x7')](_0x455cbd,_0x19a3f5);_0x4b41a5(null);};}for(var e in events){if(events[_0x1669('0x8')](e)){var event=events[e];UserProfile[_0x1669('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 976fd3f..54a4872 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 _0xc41d=['FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','all','ignore','union','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','find','foreignKey','forEach','options','autoAssociation','includeAll','include','default','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','associatedResources','catch','value','model','findAll','then','name','resolve','map','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','outboundroutes','VoiceExtension','contexts','voicemails','membername','User','role','telephone','VoiceQueues','VoiceQueue','queue','outbound','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','QueueCampaigns','users','Users','admin','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0xc41d,0x6a));var _0xdc41=function(_0x24442f,_0x2fe48b){_0x24442f=_0x24442f-0x0;var _0x41c2e3=_0xc41d[_0x24442f];return _0x41c2e3;};'use strict';var _=require(_0xdc41('0x0'));var attributes=require(_0xdc41('0x1'));var squel=require(_0xdc41('0x2'));module[_0xdc41('0x3')]=function(_0x16f657){var _0x4e8770=_0x16f657[_0xdc41('0x4')];function _0x123829(_0x22991c,_0x4f671e){return new Promise(function(_0xda6eb9,_0x709b6d){if(!_0x4f671e)return _0xda6eb9(null);var _0x1b024d=_0x4f671e[_0xdc41('0x5')]?{[_0x4f671e['filter'][_0xdc41('0x6')]]:_0x4f671e['filter']['value']}:undefined;return _0x4e8770[_0x22991c]['findAll']({'where':_0x1b024d,'raw':!![]})['then'](function(_0x2acc85){_0x4f671e[_0xdc41('0x7')]=_['map'](_0x2acc85,'id');_0xda6eb9(_0x4f671e);})[_0xdc41('0x8')](function(_0x565a0f){_0x709b6d(_0x565a0f);});});}function _0x3a4da9(_0x5e80e3,_0x33dd10){return new Promise(function(_0x52732e,_0x2ba5a2){var _0x311262=_0x5e80e3['filter']?{[_0x5e80e3[_0xdc41('0x5')]['field']]:_0x5e80e3[_0xdc41('0x5')][_0xdc41('0x9')]}:undefined;return _0x4e8770[_0x5e80e3[_0xdc41('0xa')]][_0xdc41('0xb')]({'where':_0x311262,'raw':!![]})[_0xdc41('0xc')](function(_0x1a7f25){_0x33dd10[_0xdc41('0x7')]=_['map'](_0x1a7f25,function(_0x347a93){return _0x347a93[_0xdc41('0xd')];});_0x52732e(_0x33dd10);})['catch'](function(_0x27307e){_0x2ba5a2(_0x27307e);});});}function _0xc61204(_0x3cc43e,_0x3dd411,_0x434c8d){if(!_0x3dd411)return Promise[_0xdc41('0xe')](null);return new Promise(function(_0x44adf2,_0x23812a){return _0x4e8770['UserProfileResource'][_0xdc41('0xb')]({'where':{'sectionId':_0x3dd411['id']},'raw':!![]})[_0xdc41('0xc')](function(_0x1fd3d8){if(_0x3cc43e[_0xdc41('0x6')]&&_0x3cc43e[_0xdc41('0x6')]!=='id'){_0x3dd411[_0xdc41('0x7')]=_[_0xdc41('0xf')](_0x1fd3d8,function(_0x7190a6){return _0x7190a6[_0x3cc43e[_0xdc41('0x6')]];});}else{if(_0x434c8d===_0xdc41('0x10')){_0x3dd411[_0xdc41('0x7')]=_[_0xdc41('0xf')](_0x1fd3d8,function(_0x22aeea){return{'id':_0x22aeea[_0xdc41('0x11')],'type':_0x22aeea[_0xdc41('0x12')]};});}else{_0x3dd411['associatedResources']=_[_0xdc41('0xf')](_0x1fd3d8,function(_0x5c6912){return _0x5c6912[_0xdc41('0x11')];});}}_0x44adf2(_0x3dd411);})['catch'](function(_0x272f54){_0x23812a(_0x272f54);});});}function _0x399a71(_0x27b226,_0x5c6a8f){var _0x508c5e={'parentSections':[]};switch(_0x27b226[_0xdc41('0x13')]()){case _0xdc41('0x14'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x16');break;case _0xdc41('0x17'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x18');break;case _0xdc41('0x19'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x1a');_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x1c'),'field':'name','foreignKey':_0xdc41('0x1d')}];break;case _0xdc41('0x1e'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x1f');break;case _0xdc41('0x20'):_0x508c5e['childModel']=_0xdc41('0x21');_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x22'),'field':'id','foreignKey':'ListId'}];break;case _0xdc41('0x23'):_0x508c5e['childModel']=_0xdc41('0x24');break;case'companies':_0x508c5e[_0xdc41('0x15')]='CmCompany';break;case'globalcustomfields':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x25');break;case _0xdc41('0x26'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x27');break;case _0xdc41('0x28'):_0x508c5e['childModel']=_0xdc41('0x29');break;case _0xdc41('0x2a'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x2b');break;case _0xdc41('0x2c'):_0x508c5e[_0xdc41('0x15')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0xdc41('0x2d'):_0x508c5e['childModel']=_0xdc41('0x2e');break;case _0xdc41('0x2f'):_0x508c5e[_0xdc41('0x15')]='VoiceContext';break;case _0xdc41('0x30'):_0x508c5e[_0xdc41('0x15')]='VoiceMail';break;case'voicerecordings':_0x508c5e[_0xdc41('0x15')]='VoiceRecording';_0x508c5e[_0xdc41('0x1b')]=[{'name':'Agents','field':_0xdc41('0xd'),'foreignKey':_0xdc41('0x31'),'model':_0xdc41('0x32'),'filter':{'field':_0xdc41('0x33'),'value':['agent']}},{'name':'Telephones','field':'name','foreignKey':_0xdc41('0x31'),'model':_0xdc41('0x32'),'filter':{'field':'role','value':[_0xdc41('0x34')]}},{'name':_0xdc41('0x35'),'field':_0xdc41('0xd'),'foreignKey':'queue','model':_0xdc41('0x36'),'filter':{'field':_0xdc41('0x12'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xdc41('0xd'),'foreignKey':_0xdc41('0x37'),'model':'VoiceQueue','filter':{'field':_0xdc41('0x12'),'value':[_0xdc41('0x38')]}}];break;case'musiconholds':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x39');break;case'chanspies':_0x508c5e['childModel']='VoiceChanSpy';break;case _0xdc41('0x3a'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x3b');break;case _0xdc41('0x3c'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x3d');break;case _0xdc41('0x3e'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x3f');break;case _0xdc41('0x40'):_0x508c5e[_0xdc41('0x15')]='MailAccount';break;case'mailsubstatuses':_0x508c5e['childModel']=_0xdc41('0x41');break;case _0xdc41('0x42'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x43');break;case _0xdc41('0x44'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x45');break;case _0xdc41('0x46'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x47');break;case _0xdc41('0x48'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x49');break;case _0xdc41('0x4a'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x4b');break;case'whatsappaccounts':_0x508c5e['childModel']=_0xdc41('0x4c');break;case _0xdc41('0x4d'):_0x508c5e['childModel']=_0xdc41('0x4e');break;case _0xdc41('0x4f'):case'queuecampaigns':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x36');if(_0x5c6a8f){_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x35')},{'name':_0xdc41('0x50')}];}break;case _0xdc41('0x51'):case'agents':case'telephones':_0x508c5e[_0xdc41('0x15')]='User';if(_0x5c6a8f){_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x52'),'filter':{'field':_0xdc41('0x33'),'value':[_0xdc41('0x53'),_0xdc41('0x54')]},'ignore':!![]},{'name':_0xdc41('0x55')},{'name':_0xdc41('0x56')}];}break;case _0xdc41('0x57'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x58');break;case _0xdc41('0x59'):_0x508c5e[_0xdc41('0x15')]='SalesforceAccount';break;case'freshdeskaccounts':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x5a');break;case _0xdc41('0x5b'):_0x508c5e['childModel']=_0xdc41('0x5c');break;case _0xdc41('0x5d'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x5e');break;case _0xdc41('0x5f'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x60');break;case _0xdc41('0x61'):_0x508c5e[_0xdc41('0x15')]='User';break;case'cannedanswers':_0x508c5e['childModel']=_0xdc41('0x62');break;case _0xdc41('0x63'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x64');break;case _0xdc41('0x65'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x66');break;case _0xdc41('0x67'):_0x508c5e['childModel']=_0xdc41('0x68');break;case _0xdc41('0x69'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x6a');break;case _0xdc41('0x6b'):_0x508c5e['childModel']=_0xdc41('0x6c');break;case _0xdc41('0x6d'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x6e');break;case _0xdc41('0x6f'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x70');break;case _0xdc41('0x71'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x72');break;case _0xdc41('0x73'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x74');break;case _0xdc41('0x75'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x76');break;case'variables':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x77');break;case _0xdc41('0x78'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x79');break;case'extractedreports':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x10');_0x508c5e['parentSections']=[{'name':_0xdc41('0x7a'),'field':'id','foreignKey':_0xdc41('0x7b')}];break;case _0xdc41('0x7c'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x7d');break;}return _0x508c5e;}function _0x33c570(_0x400eb8,_0x586a1f){var _0x3fcaa8=_0x400eb8[_0xdc41('0x7e')](0x0)[_0xdc41('0x7f')]()+_0x400eb8[_0xdc41('0x80')](0x1);var _0x598556={'type':_0x4e8770['Sequelize'][_0xdc41('0x81')][_0xdc41('0x82')],'raw':!![]};return new Promise(function(_0x1c56bb,_0x40864b){var _0x347f3d=squel[_0xdc41('0x83')]()[_0xdc41('0x6')](_0xdc41('0x84')+_0x3fcaa8+_0xdc41('0x85'),'id')[_0xdc41('0x6')](_0xdc41('0x86'))[_0xdc41('0x87')](_0xdc41('0x88')+_0x400eb8+'_interactions','ui')[_0xdc41('0x89')](_0xdc41('0x8a'),_0x586a1f['id']);return _0x4e8770[_0xdc41('0x8b')][_0xdc41('0x8c')](_0x347f3d[_0xdc41('0x8d')](),_0x598556)[_0xdc41('0xc')](function(_0x441d3a){_0x586a1f[_0x3fcaa8+_0xdc41('0x8e')]=_0x441d3a;_0x1c56bb(_0x441d3a);})[_0xdc41('0x8')](function(_0x460fd4){_0x40864b(_0x460fd4);});});}return _0x16f657[_0xdc41('0x8f')](_0xdc41('0x90'),attributes,{'tableName':_0xdc41('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4cc3a0){var _0x1ce0e6=require(_0xdc41('0x92'));var _0x42dd10={'raw':_0x4cc3a0[_0xdc41('0x8c')]['raw'],'where':{}};var _0xf15faa={};var _0x5c4d9b={'count':0x0,'rows':[]};var _0x31ddba=_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0x93')];var _0x5f5a05=_0x4cc3a0[_0xdc41('0x8c')]['mergeResources']||![];var _0x24d3df=_0x399a71(_0x31ddba,_0x5f5a05);if(!_0x24d3df[_0xdc41('0x15')])throw new Error(_0xdc41('0x94')+_0x31ddba+'\x27');var _0x390fc4=[{'name':_0x31ddba}];if(!_[_0xdc41('0x95')](_0x24d3df['parentSections']))_0x390fc4=_0x24d3df[_0xdc41('0x1b')];var _0xe6792b=[];for(var _0x3eccb4=0x0;_0x3eccb4<_0x390fc4[_0xdc41('0x96')];_0x3eccb4++){_0xe6792b[_0xdc41('0x97')](_0x4e8770[_0xdc41('0x98')]['find']({'where':{'userProfileId':_0x4cc3a0['params']['id'],'name':_0x390fc4[_0x3eccb4][_0xdc41('0xd')]},'raw':!![]}));}return Promise[_0xdc41('0x99')](_0xe6792b)[_0xdc41('0xc')](function(_0x361d63){var _0x2929d2=_[_0xdc41('0x5')](_0x361d63,function(_0x2121e8){return _0x2121e8?_0x2121e8:undefined;});var _0x2f8b2a=_[_0xdc41('0x5')](_0x390fc4,[_0xdc41('0x9a'),!![]]);var _0x20285c=_[_0xdc41('0x95')](_0x2929d2)&&_['isEmpty'](_0x2f8b2a)?null:_[_0xdc41('0x9b')](_0x2f8b2a,_0x2929d2);if(!_0x20285c)return null;var _0x16255f=[];for(var _0x38a350=0x0;_0x38a350<_0x20285c[_0xdc41('0x96')];_0x38a350++){var _0x5b9581=_['find'](_0x390fc4,function(_0xc7555c){return _0x20285c[_0x38a350]?_0xc7555c[_0xdc41('0xd')]===_0x20285c[_0x38a350][_0xdc41('0xd')]:null;});if(_0x5b9581){if(_0x20285c[_0x38a350][_0xdc41('0x9a')]){_0x16255f[_0xdc41('0x97')](_0x123829(_0x24d3df[_0xdc41('0x15')],_0x20285c[_0x38a350]));}else{if(!_0x20285c[_0x38a350]['autoAssociation']){_0x16255f[_0xdc41('0x97')](_0xc61204(_0x5b9581,_0x20285c[_0x38a350],_0x24d3df[_0xdc41('0x15')]));}else{if(_0x5b9581[_0xdc41('0xa')]){_0x16255f[_0xdc41('0x97')](_0x3a4da9(_0x5b9581,_0x20285c[_0x38a350]));}}}}}return Promise[_0xdc41('0x99')](_0x16255f);})[_0xdc41('0xc')](function(_0x3b0283){var _0x3bcacf=_0x3b0283;var _0x338b12=null;if(_0x3bcacf){_0x338b12=_0x3bcacf[_0xdc41('0x96')]===0x1?_0x3bcacf[0x0]:null;}if(!_0x338b12&&!_0x3bcacf)return _0x5c4d9b;var _0x1794bb=_0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0x9c')];_0xf15faa[_0xdc41('0xa')]=_[_0xdc41('0x9d')](_0x1794bb);_0xf15faa[_0xdc41('0x8c')]=_[_0xdc41('0x9d')](_0x4cc3a0['query']);_0xf15faa[_0xdc41('0x9e')]=_['intersection'](_0xf15faa['model'],_0xf15faa[_0xdc41('0x8c')]);_0x42dd10[_0xdc41('0x9f')]=_[_0xdc41('0xa0')](_0xf15faa[_0xdc41('0xa')],_0x1ce0e6[_0xdc41('0xa1')](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa1')]));_0x42dd10['attributes']=_0x42dd10[_0xdc41('0x9f')]['length']?_0x42dd10[_0xdc41('0x9f')]:_0xf15faa['model'];if(!_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa2')](_0xdc41('0xa3'))){_0x42dd10[_0xdc41('0xa4')]=_0x1ce0e6['limit'](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa4')]);_0x42dd10[_0xdc41('0xa5')]=_0x1ce0e6[_0xdc41('0xa5')](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa5')]);}_0x42dd10[_0xdc41('0xa6')]=_0x1ce0e6[_0xdc41('0xa7')](_0x4cc3a0['query'][_0xdc41('0xa7')]);_0x42dd10['where']=_0x1ce0e6[_0xdc41('0x9e')](_[_0xdc41('0xa8')](_0x4cc3a0[_0xdc41('0x8c')],_0xf15faa[_0xdc41('0x9e')]));if(_0x4cc3a0['query']['filter']){_0x42dd10[_0xdc41('0x89')]=_[_0xdc41('0xa9')](_0x42dd10[_0xdc41('0x89')],{'$or':_['map'](_0x1794bb,function(_0x4a6d0e){if(_0x4a6d0e[_0xdc41('0x12')][_0xdc41('0xaa')]!=='VIRTUAL'){var _0x16efa7={};_0x16efa7[_0x4a6d0e['field']]={'$like':'%'+_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0x5')]+'%'};return _0x16efa7;}})});}var _0xc6a354=[];var _0x3d0d78=null;var _0x2f05a4={};if(_0x338b12){_0x3d0d78=_[_0xdc41('0xab')](_0x390fc4,['name',_0x338b12[_0xdc41('0xd')]]);if(_0x3d0d78[_0xdc41('0x6')]){_0x2f05a4={};if(_0x24d3df['childModel']===_0xdc41('0x10')){_0x2f05a4[_0x3d0d78[_0xdc41('0xac')]]=_[_0xdc41('0xf')](_0x338b12[_0xdc41('0x7')],'id');}else{_0x2f05a4[_0x3d0d78[_0xdc41('0xac')]]=_0x338b12[_0xdc41('0x7')];}_0xc6a354[_0xdc41('0x97')](_0x2f05a4);}else{_0x42dd10[_0xdc41('0x89')]['id']=_0x338b12[_0xdc41('0x7')];}}else{for(var _0x43f840=0x0;_0x43f840<_0x3bcacf[_0xdc41('0x96')];_0x43f840++){_0x3d0d78=_[_0xdc41('0xab')](_0x390fc4,['name',_0x3bcacf[_0x43f840][_0xdc41('0xd')]]);if(_0x3d0d78[_0xdc41('0x6')]){_0x2f05a4={};_0x2f05a4[_0x3d0d78[_0xdc41('0xac')]]=_0x3bcacf[_0x43f840][_0xdc41('0x7')];_0xc6a354[_0xdc41('0x97')](_0x2f05a4);}else{if(!_0x42dd10[_0xdc41('0x89')]['id'])_0x42dd10[_0xdc41('0x89')]['id']=[];_0x3bcacf[_0x43f840][_0xdc41('0x7')][_0xdc41('0xad')](function(_0x543654){_0x42dd10[_0xdc41('0x89')]['id'][_0xdc41('0x97')](_0x543654);});}}}if(!_[_0xdc41('0x95')](_0xc6a354)){_0x42dd10[_0xdc41('0x89')]=_[_0xdc41('0xa9')](_0x42dd10[_0xdc41('0x89')],{'$and':{'$or':_0xc6a354}});}_0x42dd10=_[_0xdc41('0xa9')]({},_0x42dd10,_0x4cc3a0[_0xdc41('0xae')]);if(_0x338b12&&!_0x338b12[_0xdc41('0xaf')]&&_0x24d3df[_0xdc41('0x15')]===_0xdc41('0x10')){if(_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb0')]){_0x42dd10[_0xdc41('0xb1')]=[{'all':!![]}];}return _0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0xb')](_0x42dd10)['then'](function(_0x2e6535){var _0x2d5f16=[];_0x2e6535[_0xdc41('0xad')](function(_0xc9ac17){var _0x33de71;switch(_0xc9ac17['reportType']){case _0xdc41('0xb2'):_0x33de71=_[_0xdc41('0xab')](_0x338b12[_0xdc41('0x7')],function(_0x26e9c5){return _0x26e9c5['id']===_0xc9ac17['reportId']&&_0x26e9c5[_0xdc41('0x12')]===_0xdc41('0xb3');});break;case'custom':_0x33de71=_[_0xdc41('0xab')](_0x338b12['associatedResources'],function(_0x363c35){return _0x363c35['id']===_0xc9ac17[_0xdc41('0x7b')]&&_0x363c35[_0xdc41('0x12')]===_0xdc41('0xb4');});break;}if(_0x33de71)_0x2d5f16[_0xdc41('0x97')](_0xc9ac17);});_0x5c4d9b[_0xdc41('0xb5')]=_0x2d5f16[_0xdc41('0x96')];_0x5c4d9b[_0xdc41('0xb6')]=_0x2d5f16;return _0x5c4d9b;});}else{if(!_['isEmpty'](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb7')])){_0x42dd10[_0xdc41('0x89')]['id']=_0x42dd10[_0xdc41('0x89')]['id']?_[_0xdc41('0xa0')](_0x42dd10[_0xdc41('0x89')]['id'],_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb7')]):_0x4cc3a0['query'][_0xdc41('0xb7')];if(_0x4cc3a0['query'][_0xdc41('0xb8')]){_0x42dd10[_0xdc41('0xa6')]=_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb8')];}}if(_0x4cc3a0[_0xdc41('0x8c')]['extraQueryConditions']){_0x42dd10['where']=_[_0xdc41('0xa9')](_0x42dd10[_0xdc41('0x89')],{'$and':_0x4cc3a0['query'][_0xdc41('0xb9')]});}return _0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0xb5')]({'where':_0x42dd10['where']})[_0xdc41('0xc')](function(_0x5030d1){_0x5c4d9b[_0xdc41('0xb5')]=_0x5030d1;if(_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb0')]){if(_0x24d3df[_0xdc41('0x15')]===_0xdc41('0x21')){_0x42dd10[_0xdc41('0xb1')]=[{'model':_0x4e8770[_0xdc41('0x70')],'as':_0xdc41('0xba'),'attributes':['id',_0xdc41('0xd'),_0xdc41('0xbb')],'required':_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xbc')]?!![]:![]},{'model':_0x4e8770['Tag'],'as':_0xdc41('0xbd'),'attributes':['id','name',_0xdc41('0xbb')],'through':_0x4cc3a0['query']['tag']?{'attributes':[],'where':{'TagId':_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xbc')]||undefined}}:{},'required':_0x4cc3a0[_0xdc41('0x8c')]['tag']?!![]:![]}];}else{_0x42dd10[_0xdc41('0xb1')]=[{'all':!![]}];}}return _0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0xb')](_0x42dd10);})['then'](function(_0x889943){_0x5c4d9b[_0xdc41('0xb6')]=_0x889943;if(_0x31ddba===_0xdc41('0x55')&&_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xbe')]==='true'){var _0x553a58=[];for(var _0x5cf38a=0x0;_0x5cf38a<_0x5c4d9b['rows'][_0xdc41('0x96')];_0x5cf38a++){_0x553a58[_0xdc41('0x97')](_0x33c570(_0xdc41('0xbf'),_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a]['dataValues']));_0x553a58['push'](_0x33c570('sms',_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a][_0xdc41('0xc0')]));_0x553a58['push'](_0x33c570('fax',_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a][_0xdc41('0xc0')]));_0x553a58[_0xdc41('0x97')](_0x33c570(_0xdc41('0xc1'),_0x5c4d9b['rows'][_0x5cf38a]['dataValues']));_0x553a58['push'](_0x33c570(_0xdc41('0xc2'),_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a]['dataValues']));_0x553a58[_0xdc41('0x97')](_0x33c570(_0xdc41('0xc3'),_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a][_0xdc41('0xc0')]));}return Promise[_0xdc41('0x99')](_0x553a58)[_0xdc41('0xc')](function(){return _0x5c4d9b;});}return _0x5c4d9b;});}});}}});}; \ No newline at end of file +var _0xef65=['include','forEach','default','DefaultReports','custom','rows','ids','customSorting','order','extraQueryConditions','count','tag','ThroughTags','openTabs','chat','sms','dataValues','fax','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxaccounts','FaxAccount','outboundroutes','VoiceContext','VoiceMail','VoiceRecording','Agents','name','membername','User','role','agent','Telephones','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','VoiceQueues','QueueCampaigns','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','Plugin','AnalyticExtractedReport','Reports','reportId','metrics','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','sequelize','UserProfile','user_profiles','query','raw','section','mergeResources','length','push','UserProfileSection','params','all','ignore','isEmpty','union','model','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','find','foreignKey','merge','options','autoAssociation','includeAll'];(function(_0x275c37,_0x568bd4){var _0x2c8d9b=function(_0x53a27d){while(--_0x53a27d){_0x275c37['push'](_0x275c37['shift']());}};_0x2c8d9b(++_0x568bd4);}(_0xef65,0x17a));var _0x5ef6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef65[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5ef6('0x0'));var attributes=require(_0x5ef6('0x1'));var squel=require(_0x5ef6('0x2'));module[_0x5ef6('0x3')]=function(_0x440f5c){var _0xa4353c=_0x440f5c[_0x5ef6('0x4')];function _0x5c1638(_0x2e664b,_0x57e32b){return new Promise(function(_0x432276,_0x15d7f9){if(!_0x57e32b)return _0x432276(null);var _0x32fe95=_0x57e32b[_0x5ef6('0x5')]?{[_0x57e32b[_0x5ef6('0x5')][_0x5ef6('0x6')]]:_0x57e32b[_0x5ef6('0x5')][_0x5ef6('0x7')]}:undefined;return _0xa4353c[_0x2e664b][_0x5ef6('0x8')]({'where':_0x32fe95,'raw':!![]})[_0x5ef6('0x9')](function(_0x311f7c){_0x57e32b[_0x5ef6('0xa')]=_[_0x5ef6('0xb')](_0x311f7c,'id');_0x432276(_0x57e32b);})['catch'](function(_0x408b4a){_0x15d7f9(_0x408b4a);});});}function _0x2bd33d(_0x206be3,_0x4f889b){return new Promise(function(_0x1e2e44,_0x4feb4c){var _0xf6be9b=_0x206be3[_0x5ef6('0x5')]?{[_0x206be3['filter']['field']]:_0x206be3[_0x5ef6('0x5')][_0x5ef6('0x7')]}:undefined;return _0xa4353c[_0x206be3['model']][_0x5ef6('0x8')]({'where':_0xf6be9b,'raw':!![]})[_0x5ef6('0x9')](function(_0x42bfe0){_0x4f889b[_0x5ef6('0xa')]=_[_0x5ef6('0xb')](_0x42bfe0,function(_0x8d5705){return _0x8d5705['name'];});_0x1e2e44(_0x4f889b);})[_0x5ef6('0xc')](function(_0x36b25d){_0x4feb4c(_0x36b25d);});});}function _0x2c9f13(_0x56d4ee,_0x29cec7,_0x4a8889){if(!_0x29cec7)return Promise['resolve'](null);return new Promise(function(_0x38136b,_0x46e4b4){return _0xa4353c['UserProfileResource']['findAll']({'where':{'sectionId':_0x29cec7['id']},'raw':!![]})[_0x5ef6('0x9')](function(_0x46678e){if(_0x56d4ee[_0x5ef6('0x6')]&&_0x56d4ee[_0x5ef6('0x6')]!=='id'){_0x29cec7['associatedResources']=_['map'](_0x46678e,function(_0x2e6478){return _0x2e6478[_0x56d4ee[_0x5ef6('0x6')]];});}else{if(_0x4a8889==='AnalyticExtractedReport'){_0x29cec7[_0x5ef6('0xa')]=_[_0x5ef6('0xb')](_0x46678e,function(_0x30c771){return{'id':_0x30c771[_0x5ef6('0xd')],'type':_0x30c771[_0x5ef6('0xe')]};});}else{_0x29cec7[_0x5ef6('0xa')]=_[_0x5ef6('0xb')](_0x46678e,function(_0x1d7bee){return _0x1d7bee[_0x5ef6('0xd')];});}}_0x38136b(_0x29cec7);})[_0x5ef6('0xc')](function(_0x1ba1d4){_0x46e4b4(_0x1ba1d4);});});}function _0x4e8c2e(_0x5c6af0,_0x2b4ab7){var _0x3c6074={'parentSections':[]};switch(_0x5c6af0[_0x5ef6('0xf')]()){case _0x5ef6('0x10'):_0x3c6074['childModel']=_0x5ef6('0x11');break;case _0x5ef6('0x12'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x14');break;case _0x5ef6('0x15'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x16');_0x3c6074['parentSections']=[{'name':_0x5ef6('0x17'),'field':'name','foreignKey':_0x5ef6('0x18')}];break;case _0x5ef6('0x19'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x1a');break;case _0x5ef6('0x1b'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x1c');_0x3c6074[_0x5ef6('0x1d')]=[{'name':_0x5ef6('0x1e'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x1f');break;case _0x5ef6('0x20'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x21');break;case _0x5ef6('0x22'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x23');break;case _0x5ef6('0x24'):_0x3c6074['childModel']=_0x5ef6('0x25');break;case _0x5ef6('0x26'):_0x3c6074['childModel']='ChatWebsite';break;case'faxqueues':_0x3c6074[_0x5ef6('0x13')]='FaxQueue';break;case _0x5ef6('0x27'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x28');break;case'inboundroutes':case'internalroutes':case _0x5ef6('0x29'):_0x3c6074[_0x5ef6('0x13')]='VoiceExtension';break;case'contexts':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x2a');break;case'voicemails':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x2b');break;case'voicerecordings':_0x3c6074['childModel']=_0x5ef6('0x2c');_0x3c6074[_0x5ef6('0x1d')]=[{'name':_0x5ef6('0x2d'),'field':_0x5ef6('0x2e'),'foreignKey':_0x5ef6('0x2f'),'model':_0x5ef6('0x30'),'filter':{'field':_0x5ef6('0x31'),'value':[_0x5ef6('0x32')]}},{'name':_0x5ef6('0x33'),'field':_0x5ef6('0x2e'),'foreignKey':_0x5ef6('0x2f'),'model':'User','filter':{'field':_0x5ef6('0x31'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x5ef6('0x2e'),'foreignKey':_0x5ef6('0x34'),'model':'VoiceQueue','filter':{'field':_0x5ef6('0xe'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x5ef6('0x2e'),'foreignKey':_0x5ef6('0x34'),'model':_0x5ef6('0x35'),'filter':{'field':_0x5ef6('0xe'),'value':[_0x5ef6('0x36')]}}];break;case _0x5ef6('0x37'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x38');break;case _0x5ef6('0x39'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x3a');break;case _0x5ef6('0x3b'):_0x3c6074['childModel']=_0x5ef6('0x3c');break;case'ivrcampaigns':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x3d');break;case'mailqueues':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x3e');break;case _0x5ef6('0x3f'):_0x3c6074['childModel']=_0x5ef6('0x40');break;case'mailsubstatuses':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x41');break;case _0x5ef6('0x42'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x43');break;case _0x5ef6('0x44'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x45');break;case _0x5ef6('0x46'):_0x3c6074[_0x5ef6('0x13')]='SmsQueue';break;case _0x5ef6('0x47'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x48');break;case _0x5ef6('0x49'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x4a');break;case'whatsappaccounts':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x4b');break;case _0x5ef6('0x4c'):_0x3c6074['childModel']=_0x5ef6('0x4d');break;case _0x5ef6('0x4e'):case'queuecampaigns':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x35');if(_0x2b4ab7){_0x3c6074['parentSections']=[{'name':_0x5ef6('0x4f')},{'name':_0x5ef6('0x50')}];}break;case'users':case _0x5ef6('0x51'):case _0x5ef6('0x52'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x30');if(_0x2b4ab7){_0x3c6074[_0x5ef6('0x1d')]=[{'name':_0x5ef6('0x53'),'filter':{'field':_0x5ef6('0x31'),'value':[_0x5ef6('0x54'),_0x5ef6('0x55')]},'ignore':!![]},{'name':_0x5ef6('0x2d')},{'name':_0x5ef6('0x33')}];}break;case'zendeskaccounts':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x56');break;case _0x5ef6('0x57'):_0x3c6074['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x58');break;case _0x5ef6('0x59'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x5a');break;case'deskaccounts':_0x3c6074[_0x5ef6('0x13')]='DeskAccount';break;case _0x5ef6('0x5b'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x5c');break;case _0x5ef6('0x5d'):_0x3c6074[_0x5ef6('0x13')]='User';break;case _0x5ef6('0x5e'):_0x3c6074['childModel']=_0x5ef6('0x5f');break;case _0x5ef6('0x60'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x61');break;case _0x5ef6('0x62'):_0x3c6074['childModel']='Dashboard';break;case _0x5ef6('0x63'):_0x3c6074[_0x5ef6('0x13')]='Interval';break;case _0x5ef6('0x64'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x65');break;case _0x5ef6('0x66'):_0x3c6074['childModel']='Schedule';break;case _0x5ef6('0x67'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x68');break;case _0x5ef6('0x69'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x6a');break;case _0x5ef6('0x6b'):_0x3c6074['childModel']=_0x5ef6('0x6c');break;case _0x5ef6('0x6d'):_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x6e');break;case _0x5ef6('0x6f'):_0x3c6074[_0x5ef6('0x13')]='Trunk';break;case'variables':_0x3c6074['childModel']=_0x5ef6('0x70');break;case'plugins':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x71');break;case'extractedreports':_0x3c6074[_0x5ef6('0x13')]=_0x5ef6('0x72');_0x3c6074['parentSections']=[{'name':_0x5ef6('0x73'),'field':'id','foreignKey':_0x5ef6('0x74')}];break;case _0x5ef6('0x75'):_0x3c6074[_0x5ef6('0x13')]='AnalyticMetric';break;}return _0x3c6074;}function _0x185cf9(_0x57fa94,_0x4996a2){var _0x335257=_0x57fa94['charAt'](0x0)[_0x5ef6('0x76')]()+_0x57fa94['slice'](0x1);var _0x55a3bb={'type':_0xa4353c[_0x5ef6('0x77')][_0x5ef6('0x78')][_0x5ef6('0x79')],'raw':!![]};return new Promise(function(_0x40f1b9,_0x298b0f){var _0x3f36bf=squel[_0x5ef6('0x7a')]()[_0x5ef6('0x6')](_0x5ef6('0x7b')+_0x335257+_0x5ef6('0x7c'),'id')[_0x5ef6('0x6')]('ui.createdAt')[_0x5ef6('0x7d')](_0x5ef6('0x7e')+_0x57fa94+_0x5ef6('0x7f'),'ui')[_0x5ef6('0x80')]('ui.UserId\x20=\x20?',_0x4996a2['id']);return _0xa4353c[_0x5ef6('0x81')]['query'](_0x3f36bf['toString'](),_0x55a3bb)['then'](function(_0x46f84e){_0x4996a2[_0x335257+'OpenTabs']=_0x46f84e;_0x40f1b9(_0x46f84e);})['catch'](function(_0xf8fe2b){_0x298b0f(_0xf8fe2b);});});}return _0x440f5c['define'](_0x5ef6('0x82'),attributes,{'tableName':_0x5ef6('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4837e0){var _0xd3d9f0=require('../../components/parsers/qs');var _0x4a10f8={'raw':_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x85')],'where':{}};var _0x5949da={};var _0x2bb064={'count':0x0,'rows':[]};var _0x121ecc=_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x86')];var _0x527dc9=_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x87')]||![];var _0x3dc418=_0x4e8c2e(_0x121ecc,_0x527dc9);if(!_0x3dc418[_0x5ef6('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x121ecc+'\x27');var _0x1a9040=[{'name':_0x121ecc}];if(!_['isEmpty'](_0x3dc418[_0x5ef6('0x1d')]))_0x1a9040=_0x3dc418[_0x5ef6('0x1d')];var _0x2634a5=[];for(var _0xa1b6c9=0x0;_0xa1b6c9<_0x1a9040[_0x5ef6('0x88')];_0xa1b6c9++){_0x2634a5[_0x5ef6('0x89')](_0xa4353c[_0x5ef6('0x8a')]['find']({'where':{'userProfileId':_0x4837e0[_0x5ef6('0x8b')]['id'],'name':_0x1a9040[_0xa1b6c9][_0x5ef6('0x2e')]},'raw':!![]}));}return Promise[_0x5ef6('0x8c')](_0x2634a5)[_0x5ef6('0x9')](function(_0x499101){var _0x4c36dd=_['filter'](_0x499101,function(_0x2267a7){return _0x2267a7?_0x2267a7:undefined;});var _0x25f058=_[_0x5ef6('0x5')](_0x1a9040,[_0x5ef6('0x8d'),!![]]);var _0x283ca6=_[_0x5ef6('0x8e')](_0x4c36dd)&&_[_0x5ef6('0x8e')](_0x25f058)?null:_[_0x5ef6('0x8f')](_0x25f058,_0x4c36dd);if(!_0x283ca6)return null;var _0x34939b=[];for(var _0x21df60=0x0;_0x21df60<_0x283ca6['length'];_0x21df60++){var _0x4e00d9=_['find'](_0x1a9040,function(_0x4064f2){return _0x283ca6[_0x21df60]?_0x4064f2[_0x5ef6('0x2e')]===_0x283ca6[_0x21df60][_0x5ef6('0x2e')]:null;});if(_0x4e00d9){if(_0x283ca6[_0x21df60][_0x5ef6('0x8d')]){_0x34939b[_0x5ef6('0x89')](_0x5c1638(_0x3dc418[_0x5ef6('0x13')],_0x283ca6[_0x21df60]));}else{if(!_0x283ca6[_0x21df60]['autoAssociation']){_0x34939b[_0x5ef6('0x89')](_0x2c9f13(_0x4e00d9,_0x283ca6[_0x21df60],_0x3dc418['childModel']));}else{if(_0x4e00d9[_0x5ef6('0x90')]){_0x34939b[_0x5ef6('0x89')](_0x2bd33d(_0x4e00d9,_0x283ca6[_0x21df60]));}}}}}return Promise[_0x5ef6('0x8c')](_0x34939b);})[_0x5ef6('0x9')](function(_0x1fff75){var _0x2ad4cd=_0x1fff75;var _0x118fe0=null;if(_0x2ad4cd){_0x118fe0=_0x2ad4cd['length']===0x1?_0x2ad4cd[0x0]:null;}if(!_0x118fe0&&!_0x2ad4cd)return _0x2bb064;var _0x1d7512=_0xa4353c[_0x3dc418[_0x5ef6('0x13')]]['rawAttributes'];_0x5949da[_0x5ef6('0x90')]=_[_0x5ef6('0x91')](_0x1d7512);_0x5949da[_0x5ef6('0x84')]=_[_0x5ef6('0x91')](_0x4837e0[_0x5ef6('0x84')]);_0x5949da[_0x5ef6('0x92')]=_['intersection'](_0x5949da[_0x5ef6('0x90')],_0x5949da[_0x5ef6('0x84')]);_0x4a10f8[_0x5ef6('0x93')]=_[_0x5ef6('0x94')](_0x5949da[_0x5ef6('0x90')],_0xd3d9f0[_0x5ef6('0x95')](_0x4837e0[_0x5ef6('0x84')]['fields']));_0x4a10f8[_0x5ef6('0x93')]=_0x4a10f8[_0x5ef6('0x93')]['length']?_0x4a10f8['attributes']:_0x5949da['model'];if(!_0x4837e0['query'][_0x5ef6('0x96')](_0x5ef6('0x97'))){_0x4a10f8[_0x5ef6('0x98')]=_0xd3d9f0['limit'](_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x98')]);_0x4a10f8[_0x5ef6('0x99')]=_0xd3d9f0[_0x5ef6('0x99')](_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x99')]);}_0x4a10f8['order']=_0xd3d9f0['sort'](_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x9a')]);_0x4a10f8['where']=_0xd3d9f0[_0x5ef6('0x92')](_[_0x5ef6('0x9b')](_0x4837e0[_0x5ef6('0x84')],_0x5949da[_0x5ef6('0x92')]));if(_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x5')]){_0x4a10f8[_0x5ef6('0x80')]=_['merge'](_0x4a10f8['where'],{'$or':_[_0x5ef6('0xb')](_0x1d7512,function(_0x438f3e){if(_0x438f3e[_0x5ef6('0xe')]['key']!=='VIRTUAL'){var _0x630f7e={};_0x630f7e[_0x438f3e[_0x5ef6('0x6')]]={'$like':'%'+_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0x5')]+'%'};return _0x630f7e;}})});}var _0x25907d=[];var _0x46100d=null;var _0xa66e11={};if(_0x118fe0){_0x46100d=_[_0x5ef6('0x9c')](_0x1a9040,[_0x5ef6('0x2e'),_0x118fe0[_0x5ef6('0x2e')]]);if(_0x46100d[_0x5ef6('0x6')]){_0xa66e11={};if(_0x3dc418[_0x5ef6('0x13')]===_0x5ef6('0x72')){_0xa66e11[_0x46100d[_0x5ef6('0x9d')]]=_[_0x5ef6('0xb')](_0x118fe0[_0x5ef6('0xa')],'id');}else{_0xa66e11[_0x46100d['foreignKey']]=_0x118fe0[_0x5ef6('0xa')];}_0x25907d[_0x5ef6('0x89')](_0xa66e11);}else{_0x4a10f8[_0x5ef6('0x80')]['id']=_0x118fe0[_0x5ef6('0xa')];}}else{for(var _0x216c57=0x0;_0x216c57<_0x2ad4cd['length'];_0x216c57++){_0x46100d=_[_0x5ef6('0x9c')](_0x1a9040,[_0x5ef6('0x2e'),_0x2ad4cd[_0x216c57]['name']]);if(_0x46100d[_0x5ef6('0x6')]){_0xa66e11={};_0xa66e11[_0x46100d[_0x5ef6('0x9d')]]=_0x2ad4cd[_0x216c57]['associatedResources'];_0x25907d[_0x5ef6('0x89')](_0xa66e11);}else{if(!_0x4a10f8[_0x5ef6('0x80')]['id'])_0x4a10f8[_0x5ef6('0x80')]['id']=[];_0x2ad4cd[_0x216c57][_0x5ef6('0xa')]['forEach'](function(_0xa124fd){_0x4a10f8[_0x5ef6('0x80')]['id'][_0x5ef6('0x89')](_0xa124fd);});}}}if(!_[_0x5ef6('0x8e')](_0x25907d)){_0x4a10f8['where']=_[_0x5ef6('0x9e')](_0x4a10f8[_0x5ef6('0x80')],{'$and':{'$or':_0x25907d}});}_0x4a10f8=_['merge']({},_0x4a10f8,_0x4837e0[_0x5ef6('0x9f')]);if(_0x118fe0&&!_0x118fe0[_0x5ef6('0xa0')]&&_0x3dc418['childModel']===_0x5ef6('0x72')){if(_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xa1')]){_0x4a10f8[_0x5ef6('0xa2')]=[{'all':!![]}];}return _0xa4353c[_0x3dc418[_0x5ef6('0x13')]][_0x5ef6('0x8')](_0x4a10f8)[_0x5ef6('0x9')](function(_0xf360bc){var _0x10a048=[];_0xf360bc[_0x5ef6('0xa3')](function(_0x19123f){var _0x2ed160;switch(_0x19123f['reportType']){case _0x5ef6('0xa4'):_0x2ed160=_[_0x5ef6('0x9c')](_0x118fe0[_0x5ef6('0xa')],function(_0x45d9fd){return _0x45d9fd['id']===_0x19123f[_0x5ef6('0x74')]&&_0x45d9fd['type']===_0x5ef6('0xa5');});break;case _0x5ef6('0xa6'):_0x2ed160=_['find'](_0x118fe0['associatedResources'],function(_0x1a33a4){return _0x1a33a4['id']===_0x19123f[_0x5ef6('0x74')]&&_0x1a33a4[_0x5ef6('0xe')]==='CustomReports';});break;}if(_0x2ed160)_0x10a048[_0x5ef6('0x89')](_0x19123f);});_0x2bb064['count']=_0x10a048['length'];_0x2bb064[_0x5ef6('0xa7')]=_0x10a048;return _0x2bb064;});}else{if(!_[_0x5ef6('0x8e')](_0x4837e0[_0x5ef6('0x84')]['ids'])){_0x4a10f8[_0x5ef6('0x80')]['id']=_0x4a10f8[_0x5ef6('0x80')]['id']?_[_0x5ef6('0x94')](_0x4a10f8[_0x5ef6('0x80')]['id'],_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xa8')]):_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xa8')];if(_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xa9')]){_0x4a10f8[_0x5ef6('0xaa')]=_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xa9')];}}if(_0x4837e0['query'][_0x5ef6('0xab')]){_0x4a10f8['where']=_[_0x5ef6('0x9e')](_0x4a10f8[_0x5ef6('0x80')],{'$and':_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xab')]});}return _0xa4353c[_0x3dc418[_0x5ef6('0x13')]]['count']({'where':_0x4a10f8['where']})[_0x5ef6('0x9')](function(_0xdb025){_0x2bb064[_0x5ef6('0xac')]=_0xdb025;if(_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xa1')]){if(_0x3dc418['childModel']==='CmContact'){_0x4a10f8[_0x5ef6('0xa2')]=[{'model':_0xa4353c['Tag'],'as':'Tags','attributes':['id','name','color'],'required':_0x4837e0['query'][_0x5ef6('0xad')]?!![]:![]},{'model':_0xa4353c['Tag'],'as':_0x5ef6('0xae'),'attributes':['id',_0x5ef6('0x2e'),'color'],'through':_0x4837e0['query'][_0x5ef6('0xad')]?{'attributes':[],'where':{'TagId':_0x4837e0[_0x5ef6('0x84')]['tag']||undefined}}:{},'required':_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xad')]?!![]:![]}];}else{_0x4a10f8['include']=[{'all':!![]}];}}return _0xa4353c[_0x3dc418[_0x5ef6('0x13')]]['findAll'](_0x4a10f8);})['then'](function(_0x43d82d){_0x2bb064['rows']=_0x43d82d;if(_0x121ecc===_0x5ef6('0x2d')&&_0x4837e0[_0x5ef6('0x84')][_0x5ef6('0xaf')]==='true'){var _0x5350f4=[];for(var _0x277556=0x0;_0x277556<_0x2bb064[_0x5ef6('0xa7')][_0x5ef6('0x88')];_0x277556++){_0x5350f4['push'](_0x185cf9(_0x5ef6('0xb0'),_0x2bb064['rows'][_0x277556]['dataValues']));_0x5350f4['push'](_0x185cf9(_0x5ef6('0xb1'),_0x2bb064[_0x5ef6('0xa7')][_0x277556][_0x5ef6('0xb2')]));_0x5350f4['push'](_0x185cf9(_0x5ef6('0xb3'),_0x2bb064['rows'][_0x277556][_0x5ef6('0xb2')]));_0x5350f4[_0x5ef6('0x89')](_0x185cf9('mail',_0x2bb064[_0x5ef6('0xa7')][_0x277556][_0x5ef6('0xb2')]));_0x5350f4['push'](_0x185cf9('openchannel',_0x2bb064[_0x5ef6('0xa7')][_0x277556]['dataValues']));_0x5350f4['push'](_0x185cf9('whatsapp',_0x2bb064[_0x5ef6('0xa7')][_0x277556][_0x5ef6('0xb2')]));}return Promise[_0x5ef6('0x8c')](_0x5350f4)[_0x5ef6('0x9')](function(){return _0x2bb064;});}return _0x2bb064;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9f08ae6..159b386 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 _0x3d3d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','stringify','code','error','message','UserProfile,\x20%s,\x20%s','result','catch','util','moment','randomstring'];(function(_0x29ecb0,_0x3c5ab2){var _0x966f2f=function(_0x35ceb4){while(--_0x35ceb4){_0x29ecb0['push'](_0x29ecb0['shift']());}};_0x966f2f(++_0x3c5ab2);}(_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});config['redis']=_[_0xd3d3('0xc')](config[_0xd3d3('0xd')],{'host':_0xd3d3('0xe'),'port':0x18eb});var socket=require(_0xd3d3('0xf'))(new Redis(config['redis']));require(_0xd3d3('0x10'))[_0xd3d3('0x11')](socket);function respondWithRpcPromise(_0x409e2c,_0x300cba,_0x53cb12){return new BPromise(function(_0x2c523f,_0x44599e){return client[_0xd3d3('0x12')](_0x409e2c,_0x53cb12)[_0xd3d3('0x13')](function(_0x1cd30a){logger[_0xd3d3('0x14')]('UserProfile,\x20%s,\x20%s',_0x300cba,_0xd3d3('0x15'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x300cba,'request\x20sent',JSON[_0xd3d3('0x16')](_0x1cd30a));if(_0x1cd30a['error']){if(_0x1cd30a['error'][_0xd3d3('0x17')]===0x1f4){logger[_0xd3d3('0x18')]('UserProfile,\x20%s,\x20%s',_0x300cba,_0x1cd30a[_0xd3d3('0x18')]['message']);return _0x44599e(_0x1cd30a['error'][_0xd3d3('0x19')]);}logger[_0xd3d3('0x18')](_0xd3d3('0x1a'),_0x300cba,_0x1cd30a[_0xd3d3('0x18')][_0xd3d3('0x19')]);return _0x2c523f(_0x1cd30a['error'][_0xd3d3('0x19')]);}else{logger[_0xd3d3('0x14')]('UserProfile,\x20%s,\x20%s',_0x300cba,'request\x20sent');_0x2c523f(_0x1cd30a[_0xd3d3('0x1b')][_0xd3d3('0x19')]);}})[_0xd3d3('0x1c')](function(_0x5f4031){logger[_0xd3d3('0x18')](_0xd3d3('0x1a'),_0x300cba,_0x5f4031);_0x44599e(_0x5f4031);});});} \ No newline at end of file +var _0x0a05=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0a05,0x9e));var _0x50a0=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0x0a05[_0x4e82ff];return _0x495205;};'use strict';var _=require(_0x50a0('0x0'));var util=require(_0x50a0('0x1'));var moment=require(_0x50a0('0x2'));var BPromise=require(_0x50a0('0x3'));var rs=require(_0x50a0('0x4'));var fs=require('fs');var Redis=require(_0x50a0('0x5'));var db=require(_0x50a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x50a0('0x7'))('rpc');var config=require(_0x50a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50a0('0x9')][_0x50a0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x50a0('0xb')],{'host':_0x50a0('0xc'),'port':0x18eb});var socket=require(_0x50a0('0xd'))(new Redis(config[_0x50a0('0xb')]));require('./userProfile.socket')[_0x50a0('0xe')](socket);function respondWithRpcPromise(_0x4bdc66,_0x41bd7b,_0x136e4b){return new BPromise(function(_0x39a17e,_0x4efc6b){return client[_0x50a0('0xf')](_0x4bdc66,_0x136e4b)['then'](function(_0x58080b){logger['info']('UserProfile,\x20%s,\x20%s',_0x41bd7b,_0x50a0('0x10'));logger[_0x50a0('0x11')](_0x50a0('0x12'),_0x41bd7b,_0x50a0('0x10'),JSON[_0x50a0('0x13')](_0x58080b));if(_0x58080b['error']){if(_0x58080b[_0x50a0('0x14')][_0x50a0('0x15')]===0x1f4){logger[_0x50a0('0x14')](_0x50a0('0x16'),_0x41bd7b,_0x58080b[_0x50a0('0x14')]['message']);return _0x4efc6b(_0x58080b['error']['message']);}logger['error'](_0x50a0('0x16'),_0x41bd7b,_0x58080b[_0x50a0('0x14')][_0x50a0('0x17')]);return _0x39a17e(_0x58080b[_0x50a0('0x14')][_0x50a0('0x17')]);}else{logger[_0x50a0('0x18')]('UserProfile,\x20%s,\x20%s',_0x41bd7b,'request\x20sent');_0x39a17e(_0x58080b[_0x50a0('0x19')][_0x50a0('0x17')]);}})[_0x50a0('0x1a')](function(_0x19bff7){logger[_0x50a0('0x14')]('UserProfile,\x20%s,\x20%s',_0x41bd7b,_0x19bff7);_0x4efc6b(_0x19bff7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fc7cc78..70c4610 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 _0xda1c=['length','userProfile:','update','removeListener'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xda1c,0xc6));var _0xcda1=function(_0x1f7971,_0xacefbf){_0x1f7971=_0x1f7971-0x0;var _0x14712f=_0xda1c[_0x1f7971];return _0x14712f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0xcda1('0x0')];function createListener(_0x36766a,_0x29e2c8){return function(_0x20f455){_0x29e2c8['emit'](_0x36766a,_0x20f455);};}function removeListener(_0x4bd019,_0x5dcf29){return function(){UserProfileEvents[_0xcda1('0x1')](_0x4bd019,_0x5dcf29);};}exports['register']=function(_0x4dacad){for(var _0x24a09b=0x0,_0x381d1c=events[_0xcda1('0x2')];_0x24a09b<_0x381d1c;_0x24a09b++){var _0x2768d9=events[_0x24a09b];var _0x793b36=createListener(_0xcda1('0x3')+_0x2768d9,_0x4dacad);UserProfileEvents['on'](_0x2768d9,_0x793b36);}}; \ No newline at end of file +var _0x63a6=['update','emit','removeListener','register','length','./userProfile.events','remove'];(function(_0x1d9472,_0x2d0f32){var _0x494db6=function(_0x6c0195){while(--_0x6c0195){_0x1d9472['push'](_0x1d9472['shift']());}};_0x494db6(++_0x2d0f32);}(_0x63a6,0x19b));var _0x663a=function(_0x3644b9,_0x5cd3a6){_0x3644b9=_0x3644b9-0x0;var _0x4d196d=_0x63a6[_0x3644b9];return _0x4d196d;};'use strict';var UserProfileEvents=require(_0x663a('0x0'));var events=['save',_0x663a('0x1'),_0x663a('0x2')];function createListener(_0x4212d9,_0x43ab72){return function(_0x125c30){_0x43ab72[_0x663a('0x3')](_0x4212d9,_0x125c30);};}function removeListener(_0x534ec7,_0x1ec901){return function(){UserProfileEvents[_0x663a('0x4')](_0x534ec7,_0x1ec901);};}exports[_0x663a('0x5')]=function(_0x2e79a2){for(var _0x51f828=0x0,_0x704671=events[_0x663a('0x6')];_0x51f828<_0x704671;_0x51f828++){var _0x26b39a=events[_0x51f828];var _0x523c01=createListener('userProfile:'+_0x26b39a,_0x2e79a2);UserProfileEvents['on'](_0x26b39a,_0x523c01);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index aeeb68b..4ffeac9 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 _0x6360=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x6360,0xf9));var _0x0636=function(_0x5bcae7,_0x41e7e9){_0x5bcae7=_0x5bcae7-0x0;var _0x59dbca=_0x6360[_0x5bcae7];return _0x59dbca;};'use strict';var multer=require('multer');var util=require(_0x0636('0x0'));var path=require(_0x0636('0x1'));var timeout=require(_0x0636('0x2'));var express=require(_0x0636('0x3'));var router=express['Router']();var fs_extra=require(_0x0636('0x4'));var auth=require(_0x0636('0x5'));var interaction=require(_0x0636('0x6'));var config=require(_0x0636('0x7'));var controller=require('./userProfileResource.controller');router[_0x0636('0x8')]('/',auth['isAuthenticated'](),controller[_0x0636('0x9')]);router[_0x0636('0x8')](_0x0636('0xa'),auth[_0x0636('0xb')](),controller[_0x0636('0xc')]);router[_0x0636('0x8')](_0x0636('0xd'),auth[_0x0636('0xb')](),controller['show']);router[_0x0636('0xe')]('/',auth[_0x0636('0xb')](),controller[_0x0636('0xf')]);router[_0x0636('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0636('0x11')]);router[_0x0636('0x12')](_0x0636('0xd'),auth['isAuthenticated'](),controller[_0x0636('0x13')]);module[_0x0636('0x14')]=router; \ No newline at end of file +var _0xdd39=['isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller'];(function(_0x41e14f,_0x1281e7){var _0x523440=function(_0x1bc6c2){while(--_0x1bc6c2){_0x41e14f['push'](_0x41e14f['shift']());}};_0x523440(++_0x1281e7);}(_0xdd39,0x75));var _0x9dd3=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xdd39[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x9dd3('0x0'));var util=require('util');var path=require(_0x9dd3('0x1'));var timeout=require(_0x9dd3('0x2'));var express=require(_0x9dd3('0x3'));var router=express[_0x9dd3('0x4')]();var fs_extra=require(_0x9dd3('0x5'));var auth=require(_0x9dd3('0x6'));var interaction=require(_0x9dd3('0x7'));var config=require('../../config/environment');var controller=require(_0x9dd3('0x8'));router['get']('/',auth[_0x9dd3('0x9')](),controller[_0x9dd3('0xa')]);router[_0x9dd3('0xb')](_0x9dd3('0xc'),auth[_0x9dd3('0x9')](),controller[_0x9dd3('0xd')]);router[_0x9dd3('0xb')](_0x9dd3('0xe'),auth[_0x9dd3('0x9')](),controller['show']);router['post']('/',auth[_0x9dd3('0x9')](),controller[_0x9dd3('0xf')]);router[_0x9dd3('0x10')]('/:id',auth[_0x9dd3('0x9')](),controller[_0x9dd3('0x11')]);router[_0x9dd3('0x12')]('/:id',auth[_0x9dd3('0x9')](),controller[_0x9dd3('0x13')]);module[_0x9dd3('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3dcfe63..7cf4839 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 _0xf42a=['sequelize','exports','STRING','INTEGER'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xf42a,0x19c));var _0xaf42=function(_0x12dc31,_0x363ec5){_0x12dc31=_0x12dc31-0x0;var _0xdce4ca=_0xf42a[_0x12dc31];return _0xdce4ca;};'use strict';var Sequelize=require(_0xaf42('0x0'));module[_0xaf42('0x1')]={'name':{'type':Sequelize[_0xaf42('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xaf42('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xaf42('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1131=['INTEGER','STRING','sequelize','exports'];(function(_0x4577fb,_0x44c995){var _0x3be79e=function(_0x280795){while(--_0x280795){_0x4577fb['push'](_0x4577fb['shift']());}};_0x3be79e(++_0x44c995);}(_0x1131,0x6a));var _0x1113=function(_0x1e488d,_0x95f81e){_0x1e488d=_0x1e488d-0x0;var _0x4e4f3b=_0x1131[_0x1e488d];return _0x4e4f3b;};'use strict';var Sequelize=require(_0x1113('0x0'));module[_0x1113('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1113('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1113('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 6ed7a9a..5161e16 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 _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file +var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','UserProfileResource','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x4fa65c,_0xbf7cea){var _0x34c9c1=function(_0x404aa6){while(--_0x404aa6){_0x4fa65c['push'](_0x4fa65c['shift']());}};_0x34c9c1(++_0xbf7cea);}(_0x2ef3,0xba));var _0x32ef=function(_0x33c8f6,_0x4a5883){_0x33c8f6=_0x33c8f6-0x0;var _0x230e87=_0x2ef3[_0x33c8f6];return _0x230e87;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['UserProfileResource'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['UserProfileResource'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['UserProfileResource']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5bba8b9..b20cbf6 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 _0x6085=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x47fd17,_0x4f7037){var _0x353a4b=function(_0x16badc){while(--_0x16badc){_0x47fd17['push'](_0x47fd17['shift']());}};_0x353a4b(++_0x4f7037);}(_0x6085,0x166));var _0x5608=function(_0x28e351,_0x3ec4d1){_0x28e351=_0x28e351-0x0;var _0x2bab4a=_0x6085[_0x28e351];return _0x2bab4a;};'use strict';var _=require(_0x5608('0x0'));var util=require(_0x5608('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5608('0x2'));var rp=require(_0x5608('0x3'));var fs=require('fs');var path=require(_0x5608('0x4'));var rimraf=require(_0x5608('0x5'));var config=require(_0x5608('0x6'));var attributes=require(_0x5608('0x7'));module[_0x5608('0x8')]=function(_0x56df35,_0x114ce3){return _0x56df35[_0x5608('0x9')](_0x5608('0xa'),attributes,{'tableName':_0x5608('0xb'),'paranoid':![],'indexes':[{'name':_0x5608('0xc'),'fields':[_0x5608('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f8e=['moment','bluebird','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger'];(function(_0x2a1cc2,_0x15fea0){var _0x20f8c4=function(_0x514fb0){while(--_0x514fb0){_0x2a1cc2['push'](_0x2a1cc2['shift']());}};_0x20f8c4(++_0x15fea0);}(_0x2f8e,0x89));var _0xe2f8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2f8e[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xe2f8('0x0'));var util=require(_0xe2f8('0x1'));var logger=require(_0xe2f8('0x2'))('api');var moment=require(_0xe2f8('0x3'));var BPromise=require(_0xe2f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe2f8('0x5'));var config=require(_0xe2f8('0x6'));var attributes=require('./userProfileResource.attributes');module[_0xe2f8('0x7')]=function(_0x54019c,_0x553df3){return _0x54019c[_0xe2f8('0x8')](_0xe2f8('0x9'),attributes,{'tableName':_0xe2f8('0xa'),'paranoid':![],'indexes':[{'name':_0xe2f8('0xb'),'fields':[_0xe2f8('0xc'),_0xe2f8('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 74d32fd..dbe2469 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 _0x93e9=['request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x1a14ce,_0x12507a){var _0x172e1c=function(_0x315065){while(--_0x315065){_0x1a14ce['push'](_0x1a14ce['shift']());}};_0x172e1c(++_0x12507a);}(_0x93e9,0xcc));var _0x993e=function(_0x2af004,_0x279c55){_0x2af004=_0x2af004-0x0;var _0x5c5442=_0x93e9[_0x2af004];return _0x5c5442;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});} \ No newline at end of file +var _0xd706=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','moment'];(function(_0x5899a8,_0x1cfcbc){var _0x1a5e8f=function(_0x9501e7){while(--_0x9501e7){_0x5899a8['push'](_0x5899a8['shift']());}};_0x1a5e8f(++_0x1cfcbc);}(_0xd706,0x1c6));var _0x6d70=function(_0x5c4fac,_0x5df874){_0x5c4fac=_0x5c4fac-0x0;var _0x60b81d=_0xd706[_0x5c4fac];return _0x60b81d;};'use strict';var _=require(_0x6d70('0x0'));var util=require('util');var moment=require(_0x6d70('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d70('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6d70('0x3'));var logger=require(_0x6d70('0x4'))(_0x6d70('0x5'));var config=require(_0x6d70('0x6'));var jayson=require(_0x6d70('0x7'));var client=jayson[_0x6d70('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29ab12,_0x5327ec,_0x2c30fc){return new BPromise(function(_0x3f9777,_0x583c81){return client[_0x6d70('0x9')](_0x29ab12,_0x2c30fc)['then'](function(_0x5febba){logger[_0x6d70('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x5327ec,_0x6d70('0xb'));logger[_0x6d70('0xc')](_0x6d70('0xd'),_0x5327ec,'request\x20sent',JSON[_0x6d70('0xe')](_0x5febba));if(_0x5febba[_0x6d70('0xf')]){if(_0x5febba[_0x6d70('0xf')]['code']===0x1f4){logger['error'](_0x6d70('0x10'),_0x5327ec,_0x5febba[_0x6d70('0xf')][_0x6d70('0x11')]);return _0x583c81(_0x5febba['error'][_0x6d70('0x11')]);}logger['error'](_0x6d70('0x10'),_0x5327ec,_0x5febba[_0x6d70('0xf')]['message']);return _0x3f9777(_0x5febba[_0x6d70('0xf')][_0x6d70('0x11')]);}else{logger[_0x6d70('0xa')](_0x6d70('0x10'),_0x5327ec,'request\x20sent');_0x3f9777(_0x5febba['result'][_0x6d70('0x11')]);}})[_0x6d70('0x12')](function(_0x4c8fe6){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5327ec,_0x4c8fe6);_0x583c81(_0x4c8fe6);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ef1710f..e51a93e 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 _0xf38b=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller'];(function(_0x22390f,_0x377090){var _0x29d641=function(_0x4c0eff){while(--_0x4c0eff){_0x22390f['push'](_0x22390f['shift']());}};_0x29d641(++_0x377090);}(_0xf38b,0x1db));var _0xbf38=function(_0x3d31af,_0x1b667d){_0x3d31af=_0x3d31af-0x0;var _0x29cd78=_0xf38b[_0x3d31af];return _0x29cd78;};'use strict';var multer=require(_0xbf38('0x0'));var util=require('util');var path=require(_0xbf38('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf38('0x2'));var router=express[_0xbf38('0x3')]();var fs_extra=require(_0xbf38('0x4'));var auth=require(_0xbf38('0x5'));var interaction=require(_0xbf38('0x6'));var config=require('../../config/environment');var controller=require(_0xbf38('0x7'));router[_0xbf38('0x8')]('/',auth[_0xbf38('0x9')](),controller[_0xbf38('0xa')]);router[_0xbf38('0x8')](_0xbf38('0xb'),auth['isAuthenticated'](),controller[_0xbf38('0xc')]);router[_0xbf38('0x8')](_0xbf38('0xd'),auth[_0xbf38('0x9')](),controller[_0xbf38('0xe')]);router[_0xbf38('0xf')]('/',auth[_0xbf38('0x9')](),controller[_0xbf38('0x10')]);router[_0xbf38('0x11')](_0xbf38('0xd'),auth[_0xbf38('0x9')](),controller[_0xbf38('0x12')]);router[_0xbf38('0x13')](_0xbf38('0xd'),auth[_0xbf38('0x9')](),controller[_0xbf38('0x14')]);module['exports']=router; \ No newline at end of file +var _0x86be=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','express'];(function(_0x385c74,_0x2f8212){var _0x4c28ed=function(_0x5517b1){while(--_0x5517b1){_0x385c74['push'](_0x385c74['shift']());}};_0x4c28ed(++_0x2f8212);}(_0x86be,0x129));var _0xe86b=function(_0x5cd619,_0x1f2408){_0x5cd619=_0x5cd619-0x0;var _0x328fcf=_0x86be[_0x5cd619];return _0x328fcf;};'use strict';var multer=require('multer');var util=require(_0xe86b('0x0'));var path=require('path');var timeout=require(_0xe86b('0x1'));var express=require(_0xe86b('0x2'));var router=express['Router']();var fs_extra=require(_0xe86b('0x3'));var auth=require(_0xe86b('0x4'));var interaction=require(_0xe86b('0x5'));var config=require(_0xe86b('0x6'));var controller=require(_0xe86b('0x7'));router[_0xe86b('0x8')]('/',auth[_0xe86b('0x9')](),controller[_0xe86b('0xa')]);router[_0xe86b('0x8')](_0xe86b('0xb'),auth['isAuthenticated'](),controller[_0xe86b('0xc')]);router[_0xe86b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe86b('0xd')]('/',auth['isAuthenticated'](),controller[_0xe86b('0xe')]);router[_0xe86b('0xf')](_0xe86b('0x10'),auth[_0xe86b('0x9')](),controller['update']);router[_0xe86b('0x11')](_0xe86b('0x10'),auth[_0xe86b('0x9')](),controller[_0xe86b('0x12')]);module[_0xe86b('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ca66560..f5d1a14 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 _0x69d3=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x69d3,0xda));var _0x369d=function(_0x53e41d,_0x472323){_0x53e41d=_0x53e41d-0x0;var _0x472353=_0x69d3[_0x53e41d];return _0x472353;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'name':{'type':Sequelize[_0x369d('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x369d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x369d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe38740){this['setDataValue']('crudPermissions',_0xe38740?_0xe38740[_0x369d('0x5')](''):[]);},'get':function(){return this[_0x369d('0x6')](_0x369d('0x7'))?this[_0x369d('0x6')](_0x369d('0x7'))[_0x369d('0x8')](''):[];}}}; \ No newline at end of file +var _0xbaf0=['split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x39325c,_0x4abcf0){var _0x103d35=function(_0xa33f76){while(--_0xa33f76){_0x39325c['push'](_0x39325c['shift']());}};_0x103d35(++_0x4abcf0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x232cc7){this[_0x0baf('0x4')](_0x0baf('0x5'),_0x232cc7?_0x232cc7[_0x0baf('0x6')](''):[]);},'get':function(){return this[_0x0baf('0x7')](_0x0baf('0x5'))?this[_0x0baf('0x7')](_0x0baf('0x5'))[_0x0baf('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5af3e71..d83cb36 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 _0x4cfd=['limit','count','set','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','UserProfileSection','includeAll','include','rows','show','catch','create','body','update','params','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','jsforce','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','json','offset','undefined'];(function(_0x3f3125,_0x3f49d2){var _0x28bf12=function(_0xb9d9cb){while(--_0xb9d9cb){_0x3f3125['push'](_0x3f3125['shift']());}};_0x28bf12(++_0x3f49d2);}(_0x4cfd,0x1ae));var _0xd4cf=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x4cfd[_0x1e081a];return _0x428209;};'use strict';var emlformat=require(_0xd4cf('0x0'));var rimraf=require(_0xd4cf('0x1'));var zipdir=require(_0xd4cf('0x2'));var jsonpatch=require(_0xd4cf('0x3'));var rp=require(_0xd4cf('0x4'));var moment=require(_0xd4cf('0x5'));var BPromise=require(_0xd4cf('0x6'));var Mustache=require('mustache');var util=require(_0xd4cf('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4cf('0x8'));var fs=require('fs');var fs_extra=require(_0xd4cf('0x9'));var _=require(_0xd4cf('0xa'));var squel=require(_0xd4cf('0xb'));var crypto=require('crypto');var jsforce=require(_0xd4cf('0xc'));var deskjs=require(_0xd4cf('0xd'));var toCsv=require(_0xd4cf('0xe'));var querystring=require(_0xd4cf('0xf'));var Papa=require('papaparse');var Redis=require(_0xd4cf('0x10'));var authService=require(_0xd4cf('0x11'));var qs=require(_0xd4cf('0x12'));var as=require(_0xd4cf('0x13'));var hardwareService=require(_0xd4cf('0x14'));var logger=require(_0xd4cf('0x15'))(_0xd4cf('0x16'));var utils=require(_0xd4cf('0x17'));var config=require(_0xd4cf('0x18'));var licenseUtil=require(_0xd4cf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1096c4,_0x1b06d9){_0x1b06d9=_0x1b06d9||0xcc;return function(_0x2698b8){if(_0x2698b8){return _0x1096c4[_0xd4cf('0x1a')](_0x1b06d9);}return _0x1096c4[_0xd4cf('0x1b')](_0x1b06d9)[_0xd4cf('0x1c')]();};}function respondWithResult(_0x337822,_0x57eca7){_0x57eca7=_0x57eca7||0xc8;return function(_0xbd6464){if(_0xbd6464){return _0x337822[_0xd4cf('0x1b')](_0x57eca7)[_0xd4cf('0x1d')](_0xbd6464);}};}function respondWithFilteredResult(_0x4e52c2,_0x17ae6a){return function(_0x521925){if(_0x521925){var _0x540f7e=typeof _0x17ae6a[_0xd4cf('0x1e')]===_0xd4cf('0x1f')&&typeof _0x17ae6a[_0xd4cf('0x20')]==='undefined';var _0x1fdf2d=_0x521925[_0xd4cf('0x21')];var _0x2a4a44=_0x540f7e?0x0:_0x17ae6a['offset'];var _0x3f597a=_0x540f7e?_0x521925[_0xd4cf('0x21')]:_0x17ae6a[_0xd4cf('0x1e')]+_0x17ae6a[_0xd4cf('0x20')];var _0x1ce630;if(_0x3f597a>=_0x1fdf2d){_0x3f597a=_0x1fdf2d;_0x1ce630=0xc8;}else{_0x1ce630=0xce;}_0x4e52c2[_0xd4cf('0x1b')](_0x1ce630);return _0x4e52c2[_0xd4cf('0x22')]('Content-Range',_0x2a4a44+'-'+_0x3f597a+'/'+_0x1fdf2d)[_0xd4cf('0x1d')](_0x521925);}return null;};}function patchUpdates(_0x53e119){return function(_0x54d9dd){try{jsonpatch[_0xd4cf('0x23')](_0x54d9dd,_0x53e119,!![]);}catch(_0x1a8149){return BPromise[_0xd4cf('0x24')](_0x1a8149);}return _0x54d9dd[_0xd4cf('0x25')]();};}function saveUpdates(_0x341070,_0x23b2e6){return function(_0x3b3127){if(_0x3b3127){return _0x3b3127['update'](_0x341070)[_0xd4cf('0x26')](function(_0x7105fc){return _0x7105fc;});}return null;};}function removeEntity(_0x11bf9f,_0x27566a){return function(_0x407e44){if(_0x407e44){return _0x407e44['destroy']()[_0xd4cf('0x26')](function(){_0x11bf9f[_0xd4cf('0x1b')](0xcc)[_0xd4cf('0x1c')]();});}};}function handleEntityNotFound(_0x3fdd64,_0x473410){return function(_0x2a6f71){if(!_0x2a6f71){_0x3fdd64[_0xd4cf('0x1a')](0x194);}return _0x2a6f71;};}function handleError(_0x212af0,_0x5faf0){_0x5faf0=_0x5faf0||0x1f4;return function(_0x3362a8){logger[_0xd4cf('0x27')](_0x3362a8[_0xd4cf('0x28')]);if(_0x3362a8[_0xd4cf('0x29')]){delete _0x3362a8['name'];}_0x212af0[_0xd4cf('0x1b')](_0x5faf0)[_0xd4cf('0x2a')](_0x3362a8);};}exports[_0xd4cf('0x2b')]=function(_0x2b8a95,_0x581a2a){var _0x297102={},_0x33875d={},_0x14502b={'count':0x0,'rows':[]};var _0x5cb2f7=_[_0xd4cf('0x2c')](db['UserProfileSection'][_0xd4cf('0x2d')],function(_0x123a76){return{'name':_0x123a76[_0xd4cf('0x2e')],'type':_0x123a76[_0xd4cf('0x2f')]['key']};});_0x33875d[_0xd4cf('0x30')]=_['map'](_0x5cb2f7,_0xd4cf('0x29'));_0x33875d[_0xd4cf('0x31')]=_[_0xd4cf('0x32')](_0x2b8a95[_0xd4cf('0x31')]);_0x33875d[_0xd4cf('0x33')]=_[_0xd4cf('0x34')](_0x33875d[_0xd4cf('0x30')],_0x33875d['query']);_0x297102[_0xd4cf('0x35')]=_[_0xd4cf('0x34')](_0x33875d[_0xd4cf('0x30')],qs[_0xd4cf('0x36')](_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x36')]));_0x297102['attributes']=_0x297102['attributes'][_0xd4cf('0x37')]?_0x297102[_0xd4cf('0x35')]:_0x33875d['model'];if(!_0x2b8a95[_0xd4cf('0x31')]['hasOwnProperty'](_0xd4cf('0x38'))){_0x297102[_0xd4cf('0x20')]=qs[_0xd4cf('0x20')](_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x20')]);_0x297102[_0xd4cf('0x1e')]=qs['offset'](_0x2b8a95['query'][_0xd4cf('0x1e')]);}_0x297102[_0xd4cf('0x39')]=qs[_0xd4cf('0x3a')](_0x2b8a95['query'][_0xd4cf('0x3a')]);_0x297102[_0xd4cf('0x3b')]=qs[_0xd4cf('0x33')](_[_0xd4cf('0x3c')](_0x2b8a95['query'],_0x33875d[_0xd4cf('0x33')]),_0x5cb2f7);if(_0x2b8a95['query'][_0xd4cf('0x3d')]){_0x297102[_0xd4cf('0x3b')]=_[_0xd4cf('0x3e')](_0x297102['where'],{'$or':_[_0xd4cf('0x2c')](_0x5cb2f7,function(_0x136408){if(_0x136408[_0xd4cf('0x2f')]!=='VIRTUAL'){var _0x249802={};_0x249802[_0x136408['name']]={'$like':'%'+_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x3d')]+'%'};return _0x249802;}})});}_0x297102=_[_0xd4cf('0x3e')]({},_0x297102,_0x2b8a95[_0xd4cf('0x3f')]);var _0x2c737c={'where':_0x297102[_0xd4cf('0x3b')]};return db[_0xd4cf('0x40')][_0xd4cf('0x21')](_0x2c737c)[_0xd4cf('0x26')](function(_0x1b01e1){_0x14502b['count']=_0x1b01e1;if(_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x41')]){_0x297102[_0xd4cf('0x42')]=[{'all':!![]}];}return db[_0xd4cf('0x40')]['findAll'](_0x297102);})[_0xd4cf('0x26')](function(_0x2fe468){_0x14502b[_0xd4cf('0x43')]=_0x2fe468;return _0x14502b;})[_0xd4cf('0x26')](respondWithFilteredResult(_0x581a2a,_0x297102))['catch'](handleError(_0x581a2a,null));};exports[_0xd4cf('0x44')]=function(_0x1b49fd,_0xdcf847){var _0x34c7ac={'raw':![],'where':{'id':_0x1b49fd['params']['id']}},_0x954289={};_0x954289['model']=_[_0xd4cf('0x32')](db[_0xd4cf('0x40')][_0xd4cf('0x2d')]);_0x954289[_0xd4cf('0x31')]=_[_0xd4cf('0x32')](_0x1b49fd[_0xd4cf('0x31')]);_0x954289['filters']=_[_0xd4cf('0x34')](_0x954289['model'],_0x954289[_0xd4cf('0x31')]);_0x34c7ac['attributes']=_[_0xd4cf('0x34')](_0x954289[_0xd4cf('0x30')],qs[_0xd4cf('0x36')](_0x1b49fd[_0xd4cf('0x31')][_0xd4cf('0x36')]));_0x34c7ac[_0xd4cf('0x35')]=_0x34c7ac[_0xd4cf('0x35')][_0xd4cf('0x37')]?_0x34c7ac[_0xd4cf('0x35')]:_0x954289[_0xd4cf('0x30')];if(_0x1b49fd['query']['includeAll']){_0x34c7ac['include']=[{'all':!![]}];}_0x34c7ac=_['merge']({},_0x34c7ac,_0x1b49fd['options']);return db[_0xd4cf('0x40')]['find'](_0x34c7ac)['then'](handleEntityNotFound(_0xdcf847,null))[_0xd4cf('0x26')](respondWithResult(_0xdcf847,null))[_0xd4cf('0x45')](handleError(_0xdcf847,null));};exports[_0xd4cf('0x46')]=function(_0x292707,_0x442cf2){return db[_0xd4cf('0x40')]['create'](_0x292707[_0xd4cf('0x47')],{})[_0xd4cf('0x26')](respondWithResult(_0x442cf2,0xc9))['catch'](handleError(_0x442cf2,null));};exports[_0xd4cf('0x48')]=function(_0x199c0f,_0x511f09){if(_0x199c0f[_0xd4cf('0x47')]['id']){delete _0x199c0f['body']['id'];}return db[_0xd4cf('0x40')]['find']({'where':{'id':_0x199c0f[_0xd4cf('0x49')]['id']}})[_0xd4cf('0x26')](handleEntityNotFound(_0x511f09,null))[_0xd4cf('0x26')](saveUpdates(_0x199c0f['body'],null))['then'](respondWithResult(_0x511f09,null))['catch'](handleError(_0x511f09,null));};exports[_0xd4cf('0x4a')]=function(_0x3739f7,_0x436e10){return db[_0xd4cf('0x40')][_0xd4cf('0x4b')]({'where':{'id':_0x3739f7[_0xd4cf('0x49')]['id']}})[_0xd4cf('0x26')](handleEntityNotFound(_0x436e10,null))[_0xd4cf('0x26')](removeEntity(_0x436e10,null))[_0xd4cf('0x45')](handleError(_0x436e10,null));};exports[_0xd4cf('0x4c')]=function(_0x3c577a,_0x4519fd){return db[_0xd4cf('0x40')][_0xd4cf('0x4c')]()['then'](respondWithResult(_0x4519fd,null))[_0xd4cf('0x45')](handleError(_0x4519fd,null));}; \ No newline at end of file +var _0x0b6a=['end','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','create','body','catch','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x296c65,_0x229e02){var _0x3e418f=function(_0x5c13b6){while(--_0x5c13b6){_0x296c65['push'](_0x296c65['shift']());}};_0x3e418f(++_0x229e02);}(_0x0b6a,0x10f));var _0xa0b6=function(_0x30bb48,_0x38b3b9){_0x30bb48=_0x30bb48-0x0;var _0xc2af13=_0x0b6a[_0x30bb48];return _0xc2af13;};'use strict';var emlformat=require(_0xa0b6('0x0'));var rimraf=require(_0xa0b6('0x1'));var zipdir=require(_0xa0b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa0b6('0x3'));var moment=require('moment');var BPromise=require(_0xa0b6('0x4'));var Mustache=require(_0xa0b6('0x5'));var util=require(_0xa0b6('0x6'));var path=require(_0xa0b6('0x7'));var sox=require(_0xa0b6('0x8'));var csv=require(_0xa0b6('0x9'));var ejs=require(_0xa0b6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa0b6('0xb'));var jsforce=require(_0xa0b6('0xc'));var deskjs=require(_0xa0b6('0xd'));var toCsv=require(_0xa0b6('0x9'));var querystring=require(_0xa0b6('0xe'));var Papa=require(_0xa0b6('0xf'));var Redis=require('ioredis');var authService=require(_0xa0b6('0x10'));var qs=require(_0xa0b6('0x11'));var as=require(_0xa0b6('0x12'));var hardwareService=require(_0xa0b6('0x13'));var logger=require(_0xa0b6('0x14'))(_0xa0b6('0x15'));var utils=require('../../config/utils');var config=require(_0xa0b6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0b6('0x17'))['db'];function respondWithStatusCode(_0x56356f,_0x1fe2ff){_0x1fe2ff=_0x1fe2ff||0xcc;return function(_0x1e758b){if(_0x1e758b){return _0x56356f[_0xa0b6('0x18')](_0x1fe2ff);}return _0x56356f['status'](_0x1fe2ff)[_0xa0b6('0x19')]();};}function respondWithResult(_0x32e88c,_0x3e6fee){_0x3e6fee=_0x3e6fee||0xc8;return function(_0x3db45b){if(_0x3db45b){return _0x32e88c[_0xa0b6('0x1a')](_0x3e6fee)[_0xa0b6('0x1b')](_0x3db45b);}};}function respondWithFilteredResult(_0x3e5f32,_0x17bf16){return function(_0x1cfae7){if(_0x1cfae7){var _0x34d590=typeof _0x17bf16[_0xa0b6('0x1c')]==='undefined'&&typeof _0x17bf16[_0xa0b6('0x1d')]===_0xa0b6('0x1e');var _0x2ab81b=_0x1cfae7[_0xa0b6('0x1f')];var _0x45c7e8=_0x34d590?0x0:_0x17bf16[_0xa0b6('0x1c')];var _0x1f0fd3=_0x34d590?_0x1cfae7[_0xa0b6('0x1f')]:_0x17bf16['offset']+_0x17bf16['limit'];var _0x47c14e;if(_0x1f0fd3>=_0x2ab81b){_0x1f0fd3=_0x2ab81b;_0x47c14e=0xc8;}else{_0x47c14e=0xce;}_0x3e5f32[_0xa0b6('0x1a')](_0x47c14e);return _0x3e5f32[_0xa0b6('0x20')]('Content-Range',_0x45c7e8+'-'+_0x1f0fd3+'/'+_0x2ab81b)[_0xa0b6('0x1b')](_0x1cfae7);}return null;};}function patchUpdates(_0x65145c){return function(_0x52553f){try{jsonpatch['apply'](_0x52553f,_0x65145c,!![]);}catch(_0x29398e){return BPromise[_0xa0b6('0x21')](_0x29398e);}return _0x52553f[_0xa0b6('0x22')]();};}function saveUpdates(_0x351f3a,_0x24d6f5){return function(_0x4f373a){if(_0x4f373a){return _0x4f373a[_0xa0b6('0x23')](_0x351f3a)[_0xa0b6('0x24')](function(_0x5744cc){return _0x5744cc;});}return null;};}function removeEntity(_0x526c8b,_0x343d80){return function(_0x433e0b){if(_0x433e0b){return _0x433e0b[_0xa0b6('0x25')]()[_0xa0b6('0x24')](function(){_0x526c8b[_0xa0b6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38fb64,_0x3a6d9a){return function(_0x11c5f3){if(!_0x11c5f3){_0x38fb64[_0xa0b6('0x18')](0x194);}return _0x11c5f3;};}function handleError(_0x5c1900,_0x55c362){_0x55c362=_0x55c362||0x1f4;return function(_0x1eab63){logger[_0xa0b6('0x26')](_0x1eab63[_0xa0b6('0x27')]);if(_0x1eab63[_0xa0b6('0x28')]){delete _0x1eab63[_0xa0b6('0x28')];}_0x5c1900['status'](_0x55c362)['send'](_0x1eab63);};}exports[_0xa0b6('0x29')]=function(_0x29f7a9,_0x3e3030){var _0x256405={},_0x40b84d={},_0x33133f={'count':0x0,'rows':[]};var _0x4778b3=_[_0xa0b6('0x2a')](db[_0xa0b6('0x2b')][_0xa0b6('0x2c')],function(_0x155c82){return{'name':_0x155c82[_0xa0b6('0x2d')],'type':_0x155c82[_0xa0b6('0x2e')][_0xa0b6('0x2f')]};});_0x40b84d[_0xa0b6('0x30')]=_['map'](_0x4778b3,'name');_0x40b84d['query']=_[_0xa0b6('0x31')](_0x29f7a9[_0xa0b6('0x32')]);_0x40b84d[_0xa0b6('0x33')]=_['intersection'](_0x40b84d[_0xa0b6('0x30')],_0x40b84d[_0xa0b6('0x32')]);_0x256405[_0xa0b6('0x34')]=_[_0xa0b6('0x35')](_0x40b84d[_0xa0b6('0x30')],qs[_0xa0b6('0x36')](_0x29f7a9[_0xa0b6('0x32')][_0xa0b6('0x36')]));_0x256405[_0xa0b6('0x34')]=_0x256405['attributes'][_0xa0b6('0x37')]?_0x256405[_0xa0b6('0x34')]:_0x40b84d[_0xa0b6('0x30')];if(!_0x29f7a9[_0xa0b6('0x32')][_0xa0b6('0x38')](_0xa0b6('0x39'))){_0x256405[_0xa0b6('0x1d')]=qs[_0xa0b6('0x1d')](_0x29f7a9['query'][_0xa0b6('0x1d')]);_0x256405[_0xa0b6('0x1c')]=qs[_0xa0b6('0x1c')](_0x29f7a9['query'][_0xa0b6('0x1c')]);}_0x256405[_0xa0b6('0x3a')]=qs['sort'](_0x29f7a9['query'][_0xa0b6('0x3b')]);_0x256405[_0xa0b6('0x3c')]=qs['filters'](_['pick'](_0x29f7a9[_0xa0b6('0x32')],_0x40b84d['filters']),_0x4778b3);if(_0x29f7a9[_0xa0b6('0x32')]['filter']){_0x256405[_0xa0b6('0x3c')]=_[_0xa0b6('0x3d')](_0x256405[_0xa0b6('0x3c')],{'$or':_[_0xa0b6('0x2a')](_0x4778b3,function(_0x4a969c){if(_0x4a969c[_0xa0b6('0x2e')]!==_0xa0b6('0x3e')){var _0x3bb548={};_0x3bb548[_0x4a969c[_0xa0b6('0x28')]]={'$like':'%'+_0x29f7a9[_0xa0b6('0x32')][_0xa0b6('0x3f')]+'%'};return _0x3bb548;}})});}_0x256405=_['merge']({},_0x256405,_0x29f7a9['options']);var _0x3d50b4={'where':_0x256405[_0xa0b6('0x3c')]};return db[_0xa0b6('0x2b')][_0xa0b6('0x1f')](_0x3d50b4)['then'](function(_0x2107c1){_0x33133f['count']=_0x2107c1;if(_0x29f7a9[_0xa0b6('0x32')][_0xa0b6('0x40')]){_0x256405[_0xa0b6('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0xa0b6('0x42')](_0x256405);})[_0xa0b6('0x24')](function(_0x36b4d3){_0x33133f[_0xa0b6('0x43')]=_0x36b4d3;return _0x33133f;})[_0xa0b6('0x24')](respondWithFilteredResult(_0x3e3030,_0x256405))['catch'](handleError(_0x3e3030,null));};exports['show']=function(_0x268d21,_0x79b83e){var _0x3d9e14={'raw':![],'where':{'id':_0x268d21[_0xa0b6('0x44')]['id']}},_0x5d3a1d={};_0x5d3a1d['model']=_[_0xa0b6('0x31')](db['UserProfileSection'][_0xa0b6('0x2c')]);_0x5d3a1d['query']=_['keys'](_0x268d21[_0xa0b6('0x32')]);_0x5d3a1d[_0xa0b6('0x33')]=_[_0xa0b6('0x35')](_0x5d3a1d[_0xa0b6('0x30')],_0x5d3a1d[_0xa0b6('0x32')]);_0x3d9e14[_0xa0b6('0x34')]=_[_0xa0b6('0x35')](_0x5d3a1d[_0xa0b6('0x30')],qs[_0xa0b6('0x36')](_0x268d21[_0xa0b6('0x32')]['fields']));_0x3d9e14[_0xa0b6('0x34')]=_0x3d9e14[_0xa0b6('0x34')][_0xa0b6('0x37')]?_0x3d9e14[_0xa0b6('0x34')]:_0x5d3a1d[_0xa0b6('0x30')];if(_0x268d21[_0xa0b6('0x32')][_0xa0b6('0x40')]){_0x3d9e14[_0xa0b6('0x41')]=[{'all':!![]}];}_0x3d9e14=_[_0xa0b6('0x3d')]({},_0x3d9e14,_0x268d21['options']);return db[_0xa0b6('0x2b')]['find'](_0x3d9e14)['then'](handleEntityNotFound(_0x79b83e,null))[_0xa0b6('0x24')](respondWithResult(_0x79b83e,null))['catch'](handleError(_0x79b83e,null));};exports[_0xa0b6('0x45')]=function(_0x510ee1,_0x11a6d4){return db[_0xa0b6('0x2b')][_0xa0b6('0x45')](_0x510ee1[_0xa0b6('0x46')],{})['then'](respondWithResult(_0x11a6d4,0xc9))[_0xa0b6('0x47')](handleError(_0x11a6d4,null));};exports[_0xa0b6('0x23')]=function(_0x23f23f,_0x26bd67){if(_0x23f23f[_0xa0b6('0x46')]['id']){delete _0x23f23f['body']['id'];}return db['UserProfileSection'][_0xa0b6('0x48')]({'where':{'id':_0x23f23f[_0xa0b6('0x44')]['id']}})[_0xa0b6('0x24')](handleEntityNotFound(_0x26bd67,null))[_0xa0b6('0x24')](saveUpdates(_0x23f23f[_0xa0b6('0x46')],null))[_0xa0b6('0x24')](respondWithResult(_0x26bd67,null))[_0xa0b6('0x47')](handleError(_0x26bd67,null));};exports[_0xa0b6('0x25')]=function(_0x3807ad,_0x233e35){return db[_0xa0b6('0x2b')][_0xa0b6('0x48')]({'where':{'id':_0x3807ad['params']['id']}})[_0xa0b6('0x24')](handleEntityNotFound(_0x233e35,null))[_0xa0b6('0x24')](removeEntity(_0x233e35,null))[_0xa0b6('0x47')](handleError(_0x233e35,null));};exports[_0xa0b6('0x49')]=function(_0x24360f,_0x343b43){return db[_0xa0b6('0x2b')][_0xa0b6('0x49')]()['then'](respondWithResult(_0x343b43,null))[_0xa0b6('0x47')](handleError(_0x343b43,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 02815a3..1a390ce 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 _0x5792=['./userProfileSection.attributes','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x506ffc,_0x1d5505){var _0x3a3e43=function(_0x54bf3f){while(--_0x54bf3f){_0x506ffc['push'](_0x506ffc['shift']());}};_0x3a3e43(++_0x1d5505);}(_0x5792,0x156));var _0x2579=function(_0x33419b,_0x5709f8){_0x33419b=_0x33419b-0x0;var _0x11475a=_0x5792[_0x33419b];return _0x11475a;};'use strict';var _=require(_0x2579('0x0'));var util=require(_0x2579('0x1'));var logger=require(_0x2579('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2579('0x3'));var rp=require(_0x2579('0x4'));var fs=require('fs');var path=require(_0x2579('0x5'));var rimraf=require(_0x2579('0x6'));var config=require(_0x2579('0x7'));var attributes=require(_0x2579('0x8'));module['exports']=function(_0x469e99,_0x526c03){return _0x469e99['define'](_0x2579('0x9'),attributes,{'tableName':_0x2579('0xa'),'paranoid':![],'indexes':[{'name':_0x2579('0xb'),'fields':[_0x2579('0xc'),_0x2579('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28cb=['./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0x28cb,0x19c));var _0xb28c=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x28cb[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xb28c('0x0'));var util=require(_0xb28c('0x1'));var logger=require('../../config/logger')(_0xb28c('0x2'));var moment=require('moment');var BPromise=require(_0xb28c('0x3'));var rp=require(_0xb28c('0x4'));var fs=require('fs');var path=require(_0xb28c('0x5'));var rimraf=require(_0xb28c('0x6'));var config=require(_0xb28c('0x7'));var attributes=require(_0xb28c('0x8'));module[_0xb28c('0x9')]=function(_0x29160d,_0x35e3e5){return _0x29160d[_0xb28c('0xa')](_0xb28c('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xb28c('0xc'),'fields':[_0xb28c('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6cc5aec..4e2ad65 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 _0xd578=['catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x270b86,_0x59265d){var _0xdb09ec=function(_0x320e9a){while(--_0x320e9a){_0x270b86['push'](_0x270b86['shift']());}};_0xdb09ec(++_0x59265d);}(_0xd578,0x1dd));var _0x8d57=function(_0x491a3b,_0x4c9b90){_0x491a3b=_0x491a3b-0x0;var _0xf8fee5=_0xd578[_0x491a3b];return _0xf8fee5;};'use strict';var _=require(_0x8d57('0x0'));var util=require(_0x8d57('0x1'));var moment=require(_0x8d57('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d57('0x3'));var fs=require('fs');var Redis=require(_0x8d57('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8d57('0x5'))(_0x8d57('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d57('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cb33d,_0x5e929c,_0x3ad031){return new BPromise(function(_0x2e84b7,_0x3f853f){return client['request'](_0x3cb33d,_0x3ad031)[_0x8d57('0x8')](function(_0x17737a){logger[_0x8d57('0x9')](_0x8d57('0xa'),_0x5e929c,_0x8d57('0xb'));logger[_0x8d57('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5e929c,_0x8d57('0xb'),JSON[_0x8d57('0xd')](_0x17737a));if(_0x17737a[_0x8d57('0xe')]){if(_0x17737a[_0x8d57('0xe')]['code']===0x1f4){logger[_0x8d57('0xe')](_0x8d57('0xa'),_0x5e929c,_0x17737a[_0x8d57('0xe')][_0x8d57('0xf')]);return _0x3f853f(_0x17737a[_0x8d57('0xe')][_0x8d57('0xf')]);}logger[_0x8d57('0xe')](_0x8d57('0xa'),_0x5e929c,_0x17737a[_0x8d57('0xe')]['message']);return _0x2e84b7(_0x17737a[_0x8d57('0xe')]['message']);}else{logger['info'](_0x8d57('0xa'),_0x5e929c,_0x8d57('0xb'));_0x2e84b7(_0x17737a['result'][_0x8d57('0xf')]);}})[_0x8d57('0x10')](function(_0x2e811e){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5e929c,_0x2e811e);_0x3f853f(_0x2e811e);});});} \ No newline at end of file +var _0x8abd=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x5858fc,_0x137b73){var _0xc3f6f8=function(_0x21708f){while(--_0x21708f){_0x5858fc['push'](_0x5858fc['shift']());}};_0xc3f6f8(++_0x137b73);}(_0x8abd,0xef));var _0xd8ab=function(_0x5f3b7b,_0x2edabd){_0x5f3b7b=_0x5f3b7b-0x0;var _0x339c5e=_0x8abd[_0x5f3b7b];return _0x339c5e;};'use strict';var _=require(_0xd8ab('0x0'));var util=require(_0xd8ab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8ab('0x2'));var db=require(_0xd8ab('0x3'))['db'];var utils=require(_0xd8ab('0x4'));var logger=require(_0xd8ab('0x5'))(_0xd8ab('0x6'));var config=require('../../config/environment');var jayson=require(_0xd8ab('0x7'));var client=jayson[_0xd8ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x672cd7,_0x354373,_0x1b0e93){return new BPromise(function(_0x2e22f2,_0x3c9fa7){return client[_0xd8ab('0x9')](_0x672cd7,_0x1b0e93)['then'](function(_0x3b9dcd){logger[_0xd8ab('0xa')](_0xd8ab('0xb'),_0x354373,_0xd8ab('0xc'));logger['debug'](_0xd8ab('0xd'),_0x354373,_0xd8ab('0xc'),JSON[_0xd8ab('0xe')](_0x3b9dcd));if(_0x3b9dcd[_0xd8ab('0xf')]){if(_0x3b9dcd[_0xd8ab('0xf')][_0xd8ab('0x10')]===0x1f4){logger[_0xd8ab('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x354373,_0x3b9dcd[_0xd8ab('0xf')][_0xd8ab('0x11')]);return _0x3c9fa7(_0x3b9dcd[_0xd8ab('0xf')][_0xd8ab('0x11')]);}logger[_0xd8ab('0xf')](_0xd8ab('0xb'),_0x354373,_0x3b9dcd[_0xd8ab('0xf')]['message']);return _0x2e22f2(_0x3b9dcd[_0xd8ab('0xf')][_0xd8ab('0x11')]);}else{logger[_0xd8ab('0xa')](_0xd8ab('0xb'),_0x354373,_0xd8ab('0xc'));_0x2e22f2(_0x3b9dcd[_0xd8ab('0x12')][_0xd8ab('0x11')]);}})[_0xd8ab('0x13')](function(_0x4e0563){logger[_0xd8ab('0xf')](_0xd8ab('0xb'),_0x354373,_0x4e0563);_0x3c9fa7(_0x4e0563);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 90c8060..a2deb07 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x335c97,_0x485355){var _0x36ac8e=function(_0x582562){while(--_0x582562){_0x335c97['push'](_0x335c97['shift']());}};_0x36ac8e(++_0x485355);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x299bf9,_0x936294){var _0x2d4756=function(_0x33550d){while(--_0x33550d){_0x299bf9['push'](_0x299bf9['shift']());}};_0x2d4756(++_0x936294);}(_0x70e0,0x17b));var _0x070e=function(_0x1c4bf4,_0x181db3){_0x1c4bf4=_0x1c4bf4-0x0;var _0x11080d=_0x70e0[_0x1c4bf4];return _0x11080d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9bc050b..38d4d9f 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 _0x98a0=['INTEGER'];(function(_0x455974,_0x490f95){var _0x4356f0=function(_0x1b8600){while(--_0x1b8600){_0x455974['push'](_0x455974['shift']());}};_0x4356f0(++_0x490f95);}(_0x98a0,0x7c));var _0x098a=function(_0x1fa2ac,_0x3157f5){_0x1fa2ac=_0x1fa2ac-0x0;var _0x5d701c=_0x98a0[_0x1fa2ac];return _0x5d701c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x098a('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5df9=['exports','INTEGER'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0x5df9,0xea));var _0x95df=function(_0x95398e,_0xe34089){_0x95398e=_0x95398e-0x0;var _0x2e4b66=_0x5df9[_0x95398e];return _0x2e4b66;};'use strict';var Sequelize=require('sequelize');module[_0x95df('0x0')]={'penalty':{'type':Sequelize[_0x95df('0x1')],'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 897e805..6120e12 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 _0x0af5=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ede29,_0x32fd20){var _0x2f6fd9=function(_0x5a39e2){while(--_0x5a39e2){_0x3ede29['push'](_0x3ede29['shift']());}};_0x2f6fd9(++_0x32fd20);}(_0x0af5,0x158));var _0x50af=function(_0x5234ae,_0x5ea986){_0x5234ae=_0x5234ae-0x0;var _0x45ba62=_0x0af5[_0x5234ae];return _0x45ba62;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var logger=require(_0x50af('0x1'))(_0x50af('0x2'));var moment=require(_0x50af('0x3'));var BPromise=require(_0x50af('0x4'));var rp=require(_0x50af('0x5'));var fs=require('fs');var path=require(_0x50af('0x6'));var rimraf=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var attributes=require(_0x50af('0x9'));module[_0x50af('0xa')]=function(_0xe37b1,_0x5e94f8){return _0xe37b1['define'](_0x50af('0xb'),attributes,{'tableName':_0x50af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccb=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x1d60aa,_0x13f780){var _0x15d69c=function(_0x24f0d8){while(--_0x24f0d8){_0x1d60aa['push'](_0x1d60aa['shift']());}};_0x15d69c(++_0x13f780);}(_0x4ccb,0x196));var _0xb4cc=function(_0x47331d,_0x4f1394){_0x47331d=_0x47331d-0x0;var _0x218da2=_0x4ccb[_0x47331d];return _0x218da2;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var logger=require(_0xb4cc('0x2'))('api');var moment=require(_0xb4cc('0x3'));var BPromise=require(_0xb4cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4cc('0x5'));var rimraf=require(_0xb4cc('0x6'));var config=require(_0xb4cc('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xb4cc('0x8')]=function(_0x2181b2,_0x1e19dd){return _0x2181b2['define'](_0xb4cc('0x9'),attributes,{'tableName':_0xb4cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 0d89bf1..add0aae 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 _0xad22=['UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','UserSmsQueue,\x20%s,\x20%s','debug'];(function(_0x59b576,_0x3cda9d){var _0x2c65b2=function(_0x2ce0aa){while(--_0x2ce0aa){_0x59b576['push'](_0x59b576['shift']());}};_0x2c65b2(++_0x3cda9d);}(_0xad22,0x120));var _0x2ad2=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xad22[_0x420f2a];return _0x28f802;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ad2('0x0'));var BPromise=require(_0x2ad2('0x1'));var rs=require(_0x2ad2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ad2('0x3'))['db'];var utils=require(_0x2ad2('0x4'));var logger=require('../../config/logger')(_0x2ad2('0x5'));var config=require(_0x2ad2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2ad2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5b0f,_0x50d968,_0x9727b3){return new BPromise(function(_0x3aefe6,_0x59ac79){return client[_0x2ad2('0x8')](_0x1b5b0f,_0x9727b3)[_0x2ad2('0x9')](function(_0x4690ae){logger['info'](_0x2ad2('0xa'),_0x50d968,'request\x20sent');logger[_0x2ad2('0xb')](_0x2ad2('0xc'),_0x50d968,_0x2ad2('0xd'),JSON[_0x2ad2('0xe')](_0x4690ae));if(_0x4690ae[_0x2ad2('0xf')]){if(_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x10')]===0x1f4){logger[_0x2ad2('0xf')](_0x2ad2('0xa'),_0x50d968,_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x11')]);return _0x59ac79(_0x4690ae['error'][_0x2ad2('0x11')]);}logger['error'](_0x2ad2('0xa'),_0x50d968,_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x11')]);return _0x3aefe6(_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x11')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x50d968,_0x2ad2('0xd'));_0x3aefe6(_0x4690ae[_0x2ad2('0x12')][_0x2ad2('0x11')]);}})[_0x2ad2('0x13')](function(_0x36f01f){logger[_0x2ad2('0xf')](_0x2ad2('0xa'),_0x50d968,_0x36f01f);_0x59ac79(_0x36f01f);});});} \ No newline at end of file +var _0x8606=['../../config/logger','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x3eaf91,_0x550f66){var _0x5aa8b2=function(_0x3109da){while(--_0x3109da){_0x3eaf91['push'](_0x3eaf91['shift']());}};_0x5aa8b2(++_0x550f66);}(_0x8606,0xf2));var _0x6860=function(_0x4b4517,_0x5dbf6a){_0x4b4517=_0x4b4517-0x0;var _0x48278b=_0x8606[_0x4b4517];return _0x48278b;};'use strict';var _=require(_0x6860('0x0'));var util=require(_0x6860('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6860('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6860('0x3'))['db'];var utils=require(_0x6860('0x4'));var logger=require(_0x6860('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6860('0x6'));var client=jayson[_0x6860('0x7')][_0x6860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x659039,_0x125fc8,_0x265a65){return new BPromise(function(_0x3db030,_0x53fac3){return client['request'](_0x659039,_0x265a65)[_0x6860('0x9')](function(_0x2cc41e){logger[_0x6860('0xa')](_0x6860('0xb'),_0x125fc8,_0x6860('0xc'));logger[_0x6860('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x125fc8,'request\x20sent',JSON[_0x6860('0xe')](_0x2cc41e));if(_0x2cc41e[_0x6860('0xf')]){if(_0x2cc41e[_0x6860('0xf')]['code']===0x1f4){logger['error'](_0x6860('0xb'),_0x125fc8,_0x2cc41e[_0x6860('0xf')][_0x6860('0x10')]);return _0x53fac3(_0x2cc41e[_0x6860('0xf')][_0x6860('0x10')]);}logger[_0x6860('0xf')](_0x6860('0xb'),_0x125fc8,_0x2cc41e[_0x6860('0xf')][_0x6860('0x10')]);return _0x3db030(_0x2cc41e[_0x6860('0xf')]['message']);}else{logger[_0x6860('0xa')](_0x6860('0xb'),_0x125fc8,_0x6860('0xc'));_0x3db030(_0x2cc41e[_0x6860('0x11')][_0x6860('0x10')]);}})[_0x6860('0x12')](function(_0x1321f4){logger[_0x6860('0xf')](_0x6860('0xb'),_0x125fc8,_0x1321f4);_0x53fac3(_0x1321f4);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e806940..16a6f8c 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 _0x622d=['sequelize','exports','INTEGER'];(function(_0x5a51dc,_0x325229){var _0x5bf5cd=function(_0x130ca8){while(--_0x130ca8){_0x5a51dc['push'](_0x5a51dc['shift']());}};_0x5bf5cd(++_0x325229);}(_0x622d,0x189));var _0xd622=function(_0x4749cd,_0x5f4501){_0x4749cd=_0x4749cd-0x0;var _0x21dd14=_0x622d[_0x4749cd];return _0x21dd14;};'use strict';var Sequelize=require(_0xd622('0x0'));module[_0xd622('0x1')]={'UserId':{'type':Sequelize[_0xd622('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd622('0x2')]}}; \ No newline at end of file +var _0xbe0d=['INTEGER','sequelize','exports'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xbe0d,0x12a));var _0xdbe0=function(_0x32dc1e,_0x353a10){_0x32dc1e=_0x32dc1e-0x0;var _0x5659c3=_0xbe0d[_0x32dc1e];return _0x5659c3;};'use strict';var Sequelize=require(_0xdbe0('0x0'));module[_0xdbe0('0x1')]={'UserId':{'type':Sequelize[_0xdbe0('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xdbe0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 37b9253..133ff21 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(_0x229ba2,_0x58b073){var _0x4dd06a=function(_0xe99dd0){while(--_0xe99dd0){_0x229ba2['push'](_0x229ba2['shift']());}};_0x4dd06a(++_0x58b073);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x2d033c,_0x120bba){var _0x5f033e=function(_0x4d5582){while(--_0x4d5582){_0x2d033c['push'](_0x2d033c['shift']());}};_0x5f033e(++_0x120bba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a5d1d62..dd1914c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x26f513,_0x57c063){var _0x7ab795=function(_0x45458c){while(--_0x45458c){_0x26f513['push'](_0x26f513['shift']());}};_0x7ab795(++_0x57c063);}(_0x70e0,0x17b));var _0x070e=function(_0x5e7549,_0x65f9b8){_0x5e7549=_0x5e7549-0x0;var _0x35862a=_0x70e0[_0x5e7549];return _0x35862a;};'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(_0x271523,_0x1909a9){var _0x2246ef=function(_0x1b3149){while(--_0x1b3149){_0x271523['push'](_0x271523['shift']());}};_0x2246ef(++_0x1909a9);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1cc66be..92ce8fd 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 _0x8483=['INTEGER','sequelize','exports'];(function(_0x13b3ea,_0x2a54ac){var _0x49f6d3=function(_0x5ef0ab){while(--_0x5ef0ab){_0x13b3ea['push'](_0x13b3ea['shift']());}};_0x49f6d3(++_0x2a54ac);}(_0x8483,0x1c9));var _0x3848=function(_0x5c9f58,_0xd151ba){_0x5c9f58=_0x5c9f58-0x0;var _0x4cb8e2=_0x8483[_0x5c9f58];return _0x4cb8e2;};'use strict';var Sequelize=require(_0x3848('0x0'));module[_0x3848('0x1')]={'penalty':{'type':Sequelize[_0x3848('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x03f5=['sequelize','exports','INTEGER'];(function(_0x342943,_0x210ea8){var _0x5d9e81=function(_0x101c45){while(--_0x101c45){_0x342943['push'](_0x342943['shift']());}};_0x5d9e81(++_0x210ea8);}(_0x03f5,0xc9));var _0x503f=function(_0x21fe11,_0x52f846){_0x21fe11=_0x21fe11-0x0;var _0x5eb704=_0x03f5[_0x21fe11];return _0x5eb704;};'use strict';var Sequelize=require(_0x503f('0x0'));module[_0x503f('0x1')]={'penalty':{'type':Sequelize[_0x503f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 3696c57..b2e6512 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 _0x31b8=['exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x1c3429,_0x11d159){var _0x1609bd=function(_0x5ce42c){while(--_0x5ce42c){_0x1c3429['push'](_0x1c3429['shift']());}};_0x1609bd(++_0x11d159);}(_0x31b8,0x137));var _0x831b=function(_0x4d953d,_0x4df7cc){_0x4d953d=_0x4d953d-0x0;var _0x1e30c9=_0x31b8[_0x4d953d];return _0x1e30c9;};'use strict';var _=require(_0x831b('0x0'));var util=require(_0x831b('0x1'));var logger=require(_0x831b('0x2'))(_0x831b('0x3'));var moment=require(_0x831b('0x4'));var BPromise=require(_0x831b('0x5'));var rp=require(_0x831b('0x6'));var fs=require('fs');var path=require(_0x831b('0x7'));var rimraf=require(_0x831b('0x8'));var config=require(_0x831b('0x9'));var attributes=require(_0x831b('0xa'));module[_0x831b('0xb')]=function(_0x4b3a6d,_0xf67f4a){return _0x4b3a6d['define'](_0x831b('0xc'),attributes,{'tableName':_0x831b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3693=['request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x3693,0x167));var _0x3369=function(_0x5c8972,_0x388c87){_0x5c8972=_0x5c8972-0x0;var _0x28c086=_0x3693[_0x5c8972];return _0x28c086;};'use strict';var _=require(_0x3369('0x0'));var util=require('util');var logger=require(_0x3369('0x1'))('api');var moment=require(_0x3369('0x2'));var BPromise=require(_0x3369('0x3'));var rp=require(_0x3369('0x4'));var fs=require('fs');var path=require(_0x3369('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3369('0x6'));module[_0x3369('0x7')]=function(_0x23ac26,_0x441514){return _0x23ac26[_0x3369('0x8')](_0x3369('0x9'),attributes,{'tableName':_0x3369('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 a69ad19..2bec8ce 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 _0x4729=['../../config/environment','jayson/promise','client','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2a53ad,_0x234135){var _0x31b3b6=function(_0x141ec6){while(--_0x141ec6){_0x2a53ad['push'](_0x2a53ad['shift']());}};_0x31b3b6(++_0x234135);}(_0x4729,0x1c7));var _0x9472=function(_0x193495,_0x454bad){_0x193495=_0x193495-0x0;var _0x4b8bf2=_0x4729[_0x193495];return _0x4b8bf2;};'use strict';var _=require(_0x9472('0x0'));var util=require(_0x9472('0x1'));var moment=require(_0x9472('0x2'));var BPromise=require(_0x9472('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9472('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9472('0x5'))(_0x9472('0x6'));var config=require(_0x9472('0x7'));var jayson=require(_0x9472('0x8'));var client=jayson[_0x9472('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e8ddc,_0x9e7d93,_0x45aabe){return new BPromise(function(_0x4c945c,_0x26c0d0){return client['request'](_0x5e8ddc,_0x45aabe)[_0x9472('0xa')](function(_0xc93157){logger[_0x9472('0xb')](_0x9472('0xc'),_0x9e7d93,'request\x20sent');logger[_0x9472('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x9e7d93,_0x9472('0xe'),JSON[_0x9472('0xf')](_0xc93157));if(_0xc93157[_0x9472('0x10')]){if(_0xc93157[_0x9472('0x10')][_0x9472('0x11')]===0x1f4){logger[_0x9472('0x10')](_0x9472('0xc'),_0x9e7d93,_0xc93157['error'][_0x9472('0x12')]);return _0x26c0d0(_0xc93157['error']['message']);}logger[_0x9472('0x10')](_0x9472('0xc'),_0x9e7d93,_0xc93157[_0x9472('0x10')][_0x9472('0x12')]);return _0x4c945c(_0xc93157[_0x9472('0x10')][_0x9472('0x12')]);}else{logger[_0x9472('0xb')](_0x9472('0xc'),_0x9e7d93,_0x9472('0xe'));_0x4c945c(_0xc93157[_0x9472('0x13')][_0x9472('0x12')]);}})[_0x9472('0x14')](function(_0x496816){logger[_0x9472('0x10')](_0x9472('0xc'),_0x9e7d93,_0x496816);_0x26c0d0(_0x496816);});});} \ No newline at end of file +var _0x9673=['then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x10e8b8,_0x35ca91){var _0x3dfa56=function(_0x647b62){while(--_0x647b62){_0x10e8b8['push'](_0x10e8b8['shift']());}};_0x3dfa56(++_0x35ca91);}(_0x9673,0x162));var _0x3967=function(_0x25eeea,_0x2f0da4){_0x25eeea=_0x25eeea-0x0;var _0x55b2b4=_0x9673[_0x25eeea];return _0x55b2b4;};'use strict';var _=require('lodash');var util=require(_0x3967('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3967('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3967('0x2'))('rpc');var config=require(_0x3967('0x3'));var jayson=require(_0x3967('0x4'));var client=jayson[_0x3967('0x5')][_0x3967('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1f1103,_0x1cfb41,_0x453059){return new BPromise(function(_0x12307e,_0x42044d){return client['request'](_0x1f1103,_0x453059)[_0x3967('0x7')](function(_0x5a878a){logger[_0x3967('0x8')]('UserVoiceQueue,\x20%s,\x20%s',_0x1cfb41,'request\x20sent');logger[_0x3967('0x9')](_0x3967('0xa'),_0x1cfb41,_0x3967('0xb'),JSON[_0x3967('0xc')](_0x5a878a));if(_0x5a878a[_0x3967('0xd')]){if(_0x5a878a[_0x3967('0xd')][_0x3967('0xe')]===0x1f4){logger[_0x3967('0xd')](_0x3967('0xf'),_0x1cfb41,_0x5a878a[_0x3967('0xd')][_0x3967('0x10')]);return _0x42044d(_0x5a878a[_0x3967('0xd')][_0x3967('0x10')]);}logger[_0x3967('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x1cfb41,_0x5a878a[_0x3967('0xd')][_0x3967('0x10')]);return _0x12307e(_0x5a878a[_0x3967('0xd')][_0x3967('0x10')]);}else{logger[_0x3967('0x8')](_0x3967('0xf'),_0x1cfb41,_0x3967('0xb'));_0x12307e(_0x5a878a[_0x3967('0x11')][_0x3967('0x10')]);}})[_0x3967('0x12')](function(_0x48543d){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1cfb41,_0x48543d);_0x42044d(_0x48543d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2906a0a..d295db3 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(_0x4f7588,_0x399e6b){var _0x535c70=function(_0x5c2bbb){while(--_0x5c2bbb){_0x4f7588['push'](_0x4f7588['shift']());}};_0x535c70(++_0x399e6b);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x10dcaa,_0x23bf52){var _0x40ce97=function(_0x4e9175){while(--_0x4e9175){_0x10dcaa['push'](_0x10dcaa['shift']());}};_0x40ce97(++_0x23bf52);}(_0x70e0,0x17b));var _0x070e=function(_0x320b38,_0x5f286c){_0x320b38=_0x320b38-0x0;var _0x3912ee=_0x70e0[_0x320b38];return _0x3912ee;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index dbb498e..371cbba 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 _0x737d=['INTEGER','Required\x20by\x20Asterisk','STRING','sequelize'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x737d,0x18b));var _0xd737=function(_0x5d49e4,_0x23d8d7){_0x5d49e4=_0x5d49e4-0x0;var _0x585f8e=_0x737d[_0x5d49e4];return _0x585f8e;};'use strict';var Sequelize=require(_0xd737('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd737('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd737('0x2')},'membername':{'type':Sequelize[_0xd737('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xd737('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xd737('0x2')},'penalty':{'type':Sequelize[_0xd737('0x1')](0xb),'defaultValue':0x0,'comment':_0xd737('0x2')},'paused':{'type':Sequelize[_0xd737('0x1')](0xb),'defaultValue':0x0,'comment':_0xd737('0x2')}}; \ No newline at end of file +var _0x206d=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x4d5906,_0x3d48a9){var _0x3dc528=function(_0x49870d){while(--_0x49870d){_0x4d5906['push'](_0x4d5906['shift']());}};_0x3dc528(++_0x3d48a9);}(_0x206d,0xe0));var _0xd206=function(_0x207641,_0x4d6851){_0x207641=_0x207641-0x0;var _0xfdecf5=_0x206d[_0x207641];return _0xfdecf5;};'use strict';var Sequelize=require(_0xd206('0x0'));module[_0xd206('0x1')]={'uniqueid':{'type':Sequelize[_0xd206('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd206('0x3')},'membername':{'type':Sequelize[_0xd206('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xd206('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xd206('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xd206('0x3')},'VoiceQueueId':{'type':Sequelize[_0xd206('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd206('0x5'),'comment':_0xd206('0x3')},'penalty':{'type':Sequelize[_0xd206('0x2')](0xb),'defaultValue':0x0,'comment':_0xd206('0x3')},'paused':{'type':Sequelize[_0xd206('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 464a699..482573a 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 _0xabd3=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','remove','emit'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0xabd3,0xde));var _0x3abd=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xabd3[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x3abd('0x0'));var UserVoiceQueueRt=require(_0x3abd('0x1'))['db'][_0x3abd('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3abd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3abd('0x4')};function emitEvent(_0x4f1400){return function(_0xeec56c,_0x2e21f7,_0x4259c5){UserVoiceQueueRtEvents[_0x3abd('0x5')](_0x4f1400+':'+_0xeec56c['id'],_0xeec56c);UserVoiceQueueRtEvents[_0x3abd('0x5')](_0x4f1400,_0xeec56c);_0x4259c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe58e=['remove','emit','hasOwnProperty','../../mysqldb','setMaxListeners','save'];(function(_0x5f26dd,_0x1df324){var _0x278333=function(_0x50cf12){while(--_0x50cf12){_0x5f26dd['push'](_0x5f26dd['shift']());}};_0x278333(++_0x1df324);}(_0xe58e,0x135));var _0xee58=function(_0x1f0eae,_0x105e56){_0x1f0eae=_0x1f0eae-0x0;var _0xb8473e=_0xe58e[_0x1f0eae];return _0xb8473e;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xee58('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xee58('0x1')](0x0);var events={'afterCreate':_0xee58('0x2'),'afterUpdate':'update','afterDestroy':_0xee58('0x3')};function emitEvent(_0x557d9a){return function(_0x10b91b,_0x1e37d5,_0x2dfa85){UserVoiceQueueRtEvents[_0xee58('0x4')](_0x557d9a+':'+_0x10b91b['id'],_0x10b91b);UserVoiceQueueRtEvents['emit'](_0x557d9a,_0x10b91b);_0x2dfa85(null);};}for(var e in events){if(events[_0xee58('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](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 5de6a64..264b15c 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 _0xcd10=['../../config/environment','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x52ea8c,_0x1750d0){var _0x108340=function(_0x48e839){while(--_0x48e839){_0x52ea8c['push'](_0x52ea8c['shift']());}};_0x108340(++_0x1750d0);}(_0xcd10,0x190));var _0x0cd1=function(_0x507702,_0x1dc552){_0x507702=_0x507702-0x0;var _0x314f81=_0xcd10[_0x507702];return _0x314f81;};'use strict';var _=require(_0x0cd1('0x0'));var util=require('util');var logger=require(_0x0cd1('0x1'))(_0x0cd1('0x2'));var moment=require(_0x0cd1('0x3'));var BPromise=require(_0x0cd1('0x4'));var rp=require(_0x0cd1('0x5'));var fs=require('fs');var path=require(_0x0cd1('0x6'));var rimraf=require(_0x0cd1('0x7'));var config=require(_0x0cd1('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x0cd1('0x9')]=function(_0x3a7c92,_0x3021b4){return _0x3a7c92[_0x0cd1('0xa')](_0x0cd1('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf501=['bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','moment'];(function(_0x3717e7,_0x284151){var _0x54ba91=function(_0x1dca47){while(--_0x1dca47){_0x3717e7['push'](_0x3717e7['shift']());}};_0x54ba91(++_0x284151);}(_0xf501,0x1ad));var _0x1f50=function(_0x4bcbde,_0x1cf3f9){_0x4bcbde=_0x4bcbde-0x0;var _0x3d0459=_0xf501[_0x4bcbde];return _0x3d0459;};'use strict';var _=require('lodash');var util=require(_0x1f50('0x0'));var logger=require(_0x1f50('0x1'))('api');var moment=require(_0x1f50('0x2'));var BPromise=require(_0x1f50('0x3'));var rp=require(_0x1f50('0x4'));var fs=require('fs');var path=require(_0x1f50('0x5'));var rimraf=require(_0x1f50('0x6'));var config=require(_0x1f50('0x7'));var attributes=require(_0x1f50('0x8'));module['exports']=function(_0x19b896,_0xed434c){return _0x19b896[_0x1f50('0x9')](_0x1f50('0xa'),attributes,{'tableName':_0x1f50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 3d0164f..5d84755 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 _0x4d68=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x4d68,0x1da));var _0x84d6=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x4d68[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var moment=require(_0x84d6('0x2'));var BPromise=require('bluebird');var rs=require(_0x84d6('0x3'));var fs=require('fs');var Redis=require(_0x84d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x84d6('0x5'));var logger=require(_0x84d6('0x6'))(_0x84d6('0x7'));var config=require(_0x84d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x84d6('0x9')][_0x84d6('0xa')]({'port':0x232a});config[_0x84d6('0xb')]=_[_0x84d6('0xc')](config[_0x84d6('0xb')],{'host':_0x84d6('0xd'),'port':0x18eb});var socket=require(_0x84d6('0xe'))(new Redis(config[_0x84d6('0xb')]));require(_0x84d6('0xf'))['register'](socket);function respondWithRpcPromise(_0x1eea98,_0x398c0d,_0x36b309){return new BPromise(function(_0x430032,_0x5669d8){return client[_0x84d6('0x10')](_0x1eea98,_0x36b309)['then'](function(_0x310e32){logger[_0x84d6('0x11')](_0x84d6('0x12'),_0x398c0d,_0x84d6('0x13'));logger[_0x84d6('0x14')](_0x84d6('0x15'),_0x398c0d,_0x84d6('0x13'),JSON[_0x84d6('0x16')](_0x310e32));if(_0x310e32['error']){if(_0x310e32[_0x84d6('0x17')][_0x84d6('0x18')]===0x1f4){logger[_0x84d6('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x398c0d,_0x310e32[_0x84d6('0x17')][_0x84d6('0x19')]);return _0x5669d8(_0x310e32['error'][_0x84d6('0x19')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x398c0d,_0x310e32['error'][_0x84d6('0x19')]);return _0x430032(_0x310e32[_0x84d6('0x17')]['message']);}else{logger[_0x84d6('0x11')](_0x84d6('0x12'),_0x398c0d,_0x84d6('0x13'));_0x430032(_0x310e32[_0x84d6('0x1a')][_0x84d6('0x19')]);}})[_0x84d6('0x1b')](function(_0x2988e1){logger[_0x84d6('0x17')](_0x84d6('0x12'),_0x398c0d,_0x2988e1);_0x5669d8(_0x2988e1);});});}exports[_0x84d6('0x1c')]=function(_0x1f31bd){var _0x1ff9cb=this;return new Promise(function(_0x52f36f,_0x3203c4){return db[_0x84d6('0x1d')][_0x84d6('0x1e')]({'raw':_0x1f31bd[_0x84d6('0x1f')]?_0x1f31bd[_0x84d6('0x1f')][_0x84d6('0x20')]===undefined?!![]:![]:!![],'where':_0x1f31bd[_0x84d6('0x1f')]?_0x1f31bd[_0x84d6('0x1f')]['where']||null:null,'attributes':[[db[_0x84d6('0x21')]['fn'](_0x84d6('0x22'),db[_0x84d6('0x21')]['fn']('IF',db[_0x84d6('0x21')]['literal'](_0x84d6('0x23')))),_0x84d6('0x24')]]})[_0x84d6('0x25')](function(_0x46f213){logger[_0x84d6('0x11')]('GetVoiceQueueRtPauses',_0x1f31bd);logger[_0x84d6('0x14')]('GetVoiceQueueRtPauses',_0x1f31bd,JSON[_0x84d6('0x16')](_0x46f213));_0x52f36f(_0x46f213);})['catch'](function(_0x2ac09d){logger[_0x84d6('0x17')](_0x84d6('0x1c'),_0x2ac09d[_0x84d6('0x19')],_0x1f31bd);_0x3203c4(_0x1ff9cb[_0x84d6('0x17')](0x1f4,_0x2ac09d['message']));});});}; \ No newline at end of file +var _0xe017=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','literal','outboundQueuePauses','debug','stringify','lodash','moment','bluebird','randomstring'];(function(_0x4ce6c2,_0x3f97e8){var _0x4ec8a3=function(_0x148e15){while(--_0x148e15){_0x4ce6c2['push'](_0x4ce6c2['shift']());}};_0x4ec8a3(++_0x3f97e8);}(_0xe017,0x98));var _0x7e01=function(_0x25951a,_0x4b3689){_0x25951a=_0x25951a-0x0;var _0x3d078d=_0xe017[_0x25951a];return _0x3d078d;};'use strict';var _=require(_0x7e01('0x0'));var util=require('util');var moment=require(_0x7e01('0x1'));var BPromise=require(_0x7e01('0x2'));var rs=require(_0x7e01('0x3'));var fs=require('fs');var Redis=require(_0x7e01('0x4'));var db=require(_0x7e01('0x5'))['db'];var utils=require(_0x7e01('0x6'));var logger=require(_0x7e01('0x7'))('rpc');var config=require(_0x7e01('0x8'));var jayson=require(_0x7e01('0x9'));var client=jayson[_0x7e01('0xa')][_0x7e01('0xb')]({'port':0x232a});config[_0x7e01('0xc')]=_[_0x7e01('0xd')](config[_0x7e01('0xc')],{'host':_0x7e01('0xe'),'port':0x18eb});var socket=require(_0x7e01('0xf'))(new Redis(config[_0x7e01('0xc')]));require(_0x7e01('0x10'))[_0x7e01('0x11')](socket);function respondWithRpcPromise(_0x1483ed,_0x2290ea,_0x2468c0){return new BPromise(function(_0x1f0ad5,_0x4aa071){return client[_0x7e01('0x12')](_0x1483ed,_0x2468c0)[_0x7e01('0x13')](function(_0xbc1e7f){logger[_0x7e01('0x14')](_0x7e01('0x15'),_0x2290ea,_0x7e01('0x16'));logger['debug'](_0x7e01('0x17'),_0x2290ea,_0x7e01('0x16'),JSON['stringify'](_0xbc1e7f));if(_0xbc1e7f[_0x7e01('0x18')]){if(_0xbc1e7f[_0x7e01('0x18')][_0x7e01('0x19')]===0x1f4){logger[_0x7e01('0x18')](_0x7e01('0x15'),_0x2290ea,_0xbc1e7f[_0x7e01('0x18')][_0x7e01('0x1a')]);return _0x4aa071(_0xbc1e7f[_0x7e01('0x18')][_0x7e01('0x1a')]);}logger[_0x7e01('0x18')](_0x7e01('0x15'),_0x2290ea,_0xbc1e7f[_0x7e01('0x18')]['message']);return _0x1f0ad5(_0xbc1e7f[_0x7e01('0x18')]['message']);}else{logger[_0x7e01('0x14')](_0x7e01('0x15'),_0x2290ea,_0x7e01('0x16'));_0x1f0ad5(_0xbc1e7f[_0x7e01('0x1b')][_0x7e01('0x1a')]);}})[_0x7e01('0x1c')](function(_0x4584f6){logger[_0x7e01('0x18')](_0x7e01('0x15'),_0x2290ea,_0x4584f6);_0x4aa071(_0x4584f6);});});}exports[_0x7e01('0x1d')]=function(_0x5ee759){var _0x3fc0f5=this;return new Promise(function(_0x4514ae,_0x5bd39a){return db[_0x7e01('0x1e')][_0x7e01('0x1f')]({'raw':_0x5ee759[_0x7e01('0x20')]?_0x5ee759[_0x7e01('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5ee759[_0x7e01('0x20')]?_0x5ee759[_0x7e01('0x20')][_0x7e01('0x21')]||null:null,'attributes':[[db[_0x7e01('0x22')]['fn']('COUNT',db[_0x7e01('0x22')]['fn']('IF',db[_0x7e01('0x22')][_0x7e01('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0x7e01('0x24')]]})[_0x7e01('0x13')](function(_0x6827dc){logger[_0x7e01('0x14')](_0x7e01('0x1d'),_0x5ee759);logger[_0x7e01('0x25')](_0x7e01('0x1d'),_0x5ee759,JSON[_0x7e01('0x26')](_0x6827dc));_0x4514ae(_0x6827dc);})['catch'](function(_0xbae603){logger[_0x7e01('0x18')]('GetVoiceQueueRtPauses',_0xbae603[_0x7e01('0x1a')],_0x5ee759);_0x5bd39a(_0x3fc0f5[_0x7e01('0x18')](0x1f4,_0xbae603[_0x7e01('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 415864b..72f3c32 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 _0xcedf=['update','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x29b35c,_0x2001c5){var _0x5ab131=function(_0x4afc0a){while(--_0x4afc0a){_0x29b35c['push'](_0x29b35c['shift']());}};_0x5ab131(++_0x2001c5);}(_0xcedf,0x1b6));var _0xfced=function(_0x504450,_0x3877d4){_0x504450=_0x504450-0x0;var _0x1089f5=_0xcedf[_0x504450];return _0x1089f5;};'use strict';var UserVoiceQueueRtEvents=require(_0xfced('0x0'));var events=[_0xfced('0x1'),_0xfced('0x2'),_0xfced('0x3')];function createListener(_0x59538d,_0x153f0f){return function(_0x2165b9){_0x153f0f['emit'](_0x59538d,_0x2165b9);};}function removeListener(_0x5b16af,_0x1dad76){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5b16af,_0x1dad76);};}exports[_0xfced('0x4')]=function(_0x5c2015){for(var _0x455382=0x0,_0x571725=events[_0xfced('0x5')];_0x455382<_0x571725;_0x455382++){var _0x5bd518=events[_0x455382];var _0x5c6588=createListener(_0xfced('0x6')+_0x5bd518,_0x5c2015);UserVoiceQueueRtEvents['on'](_0x5bd518,_0x5c6588);}}; \ No newline at end of file +var _0x0e4b=['./userVoiceQueueRt.events','save','remove','removeListener','length'];(function(_0x49c62f,_0x17d47c){var _0x1a03a2=function(_0x1b78a2){while(--_0x1b78a2){_0x49c62f['push'](_0x49c62f['shift']());}};_0x1a03a2(++_0x17d47c);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x32b615,_0x2a8b55){_0x32b615=_0x32b615-0x0;var _0x63f41a=_0x0e4b[_0x32b615];return _0x63f41a;};'use strict';var UserVoiceQueueRtEvents=require(_0xb0e4('0x0'));var events=[_0xb0e4('0x1'),_0xb0e4('0x2'),'update'];function createListener(_0x2f5a59,_0x502b33){return function(_0x4c9f71){_0x502b33['emit'](_0x2f5a59,_0x4c9f71);};}function removeListener(_0x538147,_0x79717e){return function(){UserVoiceQueueRtEvents[_0xb0e4('0x3')](_0x538147,_0x79717e);};}exports['register']=function(_0x45bdf2){for(var _0x3b56c3=0x0,_0x78e4ed=events[_0xb0e4('0x4')];_0x3b56c3<_0x78e4ed;_0x3b56c3++){var _0x35aa64=events[_0x3b56c3];var _0x57f45d=createListener('userVoiceQueueRt:'+_0x35aa64,_0x45bdf2);UserVoiceQueueRtEvents['on'](_0x35aa64,_0x57f45d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2b96350..84077fc 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x238533,_0x28d833){var _0x748145=function(_0x485d2e){while(--_0x485d2e){_0x238533['push'](_0x238533['shift']());}};_0x748145(++_0x28d833);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x47d31d,_0x20380f){var _0x3f0438=function(_0x122d5d){while(--_0x122d5d){_0x47d31d['push'](_0x47d31d['shift']());}};_0x3f0438(++_0x20380f);}(_0x70e0,0x17b));var _0x070e=function(_0x297282,_0xf2cee9){_0x297282=_0x297282-0x0;var _0x50500f=_0x70e0[_0x297282];return _0x50500f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index ed4aaa2..ed5df58 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 _0x19be=['INTEGER','sequelize','exports'];(function(_0x4201de,_0x43ac07){var _0x3fef97=function(_0x92694c){while(--_0x92694c){_0x4201de['push'](_0x4201de['shift']());}};_0x3fef97(++_0x43ac07);}(_0x19be,0x1de));var _0xe19b=function(_0x1de8da,_0x5e3998){_0x1de8da=_0x1de8da-0x0;var _0x5ec0ee=_0x19be[_0x1de8da];return _0x5ec0ee;};'use strict';var Sequelize=require(_0xe19b('0x0'));module[_0xe19b('0x1')]={'penalty':{'type':Sequelize[_0xe19b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6671=['INTEGER','sequelize','exports'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x6671,0x67));var _0x1667=function(_0x983519,_0x5a9441){_0x983519=_0x983519-0x0;var _0x40a7d4=_0x6671[_0x983519];return _0x40a7d4;};'use strict';var Sequelize=require(_0x1667('0x0'));module[_0x1667('0x1')]={'penalty':{'type':Sequelize[_0x1667('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index ed952b4..865c76a 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 _0x4ef6=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5a108a,_0x1d2d49){var _0x44cfb1=function(_0x516007){while(--_0x516007){_0x5a108a['push'](_0x5a108a['shift']());}};_0x44cfb1(++_0x1d2d49);}(_0x4ef6,0x75));var _0x64ef=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x4ef6[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0x64ef('0x0'));var util=require('util');var logger=require(_0x64ef('0x1'))(_0x64ef('0x2'));var moment=require(_0x64ef('0x3'));var BPromise=require(_0x64ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64ef('0x5'));var rimraf=require(_0x64ef('0x6'));var config=require(_0x64ef('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x64ef('0x8')]=function(_0x5646c0,_0x49b177){return _0x5646c0['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d5f=['user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x4b53a9,_0x4f7f61){var _0x311937=function(_0x897dbf){while(--_0x897dbf){_0x4b53a9['push'](_0x4b53a9['shift']());}};_0x311937(++_0x4f7f61);}(_0x1d5f,0xf8));var _0xf1d5=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x1d5f[_0x49052b];return _0x48c045;};'use strict';var _=require(_0xf1d5('0x0'));var util=require(_0xf1d5('0x1'));var logger=require(_0xf1d5('0x2'))('api');var moment=require(_0xf1d5('0x3'));var BPromise=require(_0xf1d5('0x4'));var rp=require(_0xf1d5('0x5'));var fs=require('fs');var path=require(_0xf1d5('0x6'));var rimraf=require(_0xf1d5('0x7'));var config=require('../../config/environment');var attributes=require(_0xf1d5('0x8'));module[_0xf1d5('0x9')]=function(_0x5b5e52,_0x4b744e){return _0x5b5e52[_0xf1d5('0xa')](_0xf1d5('0xb'),attributes,{'tableName':_0xf1d5('0xc'),'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 4cdf030..b7f67d8 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 _0xa701=['debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0xa701,0x188));var _0x1a70=function(_0x297c27,_0x2ca3e4){_0x297c27=_0x297c27-0x0;var _0x2a9997=_0xa701[_0x297c27];return _0x2a9997;};'use strict';var _=require(_0x1a70('0x0'));var util=require(_0x1a70('0x1'));var moment=require('moment');var BPromise=require(_0x1a70('0x2'));var rs=require(_0x1a70('0x3'));var fs=require('fs');var Redis=require(_0x1a70('0x4'));var db=require(_0x1a70('0x5'))['db'];var utils=require(_0x1a70('0x6'));var logger=require('../../config/logger')(_0x1a70('0x7'));var config=require(_0x1a70('0x8'));var jayson=require(_0x1a70('0x9'));var client=jayson['client'][_0x1a70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55c631,_0x3c844d,_0x49b3b4){return new BPromise(function(_0x3b741f,_0x4c1c9c){return client[_0x1a70('0xb')](_0x55c631,_0x49b3b4)[_0x1a70('0xc')](function(_0x40c3b4){logger[_0x1a70('0xd')](_0x1a70('0xe'),_0x3c844d,_0x1a70('0xf'));logger[_0x1a70('0x10')](_0x1a70('0x11'),_0x3c844d,_0x1a70('0xf'),JSON[_0x1a70('0x12')](_0x40c3b4));if(_0x40c3b4[_0x1a70('0x13')]){if(_0x40c3b4[_0x1a70('0x13')][_0x1a70('0x14')]===0x1f4){logger[_0x1a70('0x13')](_0x1a70('0xe'),_0x3c844d,_0x40c3b4[_0x1a70('0x13')]['message']);return _0x4c1c9c(_0x40c3b4['error']['message']);}logger[_0x1a70('0x13')](_0x1a70('0xe'),_0x3c844d,_0x40c3b4[_0x1a70('0x13')][_0x1a70('0x15')]);return _0x3b741f(_0x40c3b4[_0x1a70('0x13')]['message']);}else{logger['info'](_0x1a70('0xe'),_0x3c844d,_0x1a70('0xf'));_0x3b741f(_0x40c3b4[_0x1a70('0x16')][_0x1a70('0x15')]);}})[_0x1a70('0x17')](function(_0x8a970d){logger[_0x1a70('0x13')](_0x1a70('0xe'),_0x3c844d,_0x8a970d);_0x4c1c9c(_0x8a970d);});});} \ No newline at end of file +var _0xd4f2=['request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29e722,_0x33e8a7){var _0x5231ca=function(_0xdeada8){while(--_0xdeada8){_0x29e722['push'](_0x29e722['shift']());}};_0x5231ca(++_0x33e8a7);}(_0xd4f2,0x193));var _0x2d4f=function(_0x543dda,_0x2b6d79){_0x543dda=_0x543dda-0x0;var _0x570657=_0xd4f2[_0x543dda];return _0x570657;};'use strict';var _=require(_0x2d4f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4f('0x1'));var rs=require(_0x2d4f('0x2'));var fs=require('fs');var Redis=require(_0x2d4f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4f('0x4'));var logger=require(_0x2d4f('0x5'))(_0x2d4f('0x6'));var config=require(_0x2d4f('0x7'));var jayson=require(_0x2d4f('0x8'));var client=jayson[_0x2d4f('0x9')][_0x2d4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x509c74,_0x8748a8,_0x54f2b3){return new BPromise(function(_0x4ebb0b,_0x3f7656){return client[_0x2d4f('0xb')](_0x509c74,_0x54f2b3)[_0x2d4f('0xc')](function(_0x3ff357){logger[_0x2d4f('0xd')](_0x2d4f('0xe'),_0x8748a8,_0x2d4f('0xf'));logger[_0x2d4f('0x10')](_0x2d4f('0x11'),_0x8748a8,_0x2d4f('0xf'),JSON[_0x2d4f('0x12')](_0x3ff357));if(_0x3ff357[_0x2d4f('0x13')]){if(_0x3ff357[_0x2d4f('0x13')][_0x2d4f('0x14')]===0x1f4){logger[_0x2d4f('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x8748a8,_0x3ff357['error'][_0x2d4f('0x15')]);return _0x3f7656(_0x3ff357[_0x2d4f('0x13')][_0x2d4f('0x15')]);}logger[_0x2d4f('0x13')](_0x2d4f('0xe'),_0x8748a8,_0x3ff357[_0x2d4f('0x13')][_0x2d4f('0x15')]);return _0x4ebb0b(_0x3ff357[_0x2d4f('0x13')][_0x2d4f('0x15')]);}else{logger[_0x2d4f('0xd')](_0x2d4f('0xe'),_0x8748a8,'request\x20sent');_0x4ebb0b(_0x3ff357[_0x2d4f('0x16')][_0x2d4f('0x15')]);}})['catch'](function(_0x2fa285){logger[_0x2d4f('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x8748a8,_0x2fa285);_0x3f7656(_0x2fa285);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index dc898a9..19efe8f 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 _0xea89=['/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index'];(function(_0xd42bb1,_0x126627){var _0x2281c6=function(_0x3aa6b2){while(--_0x3aa6b2){_0xd42bb1['push'](_0xd42bb1['shift']());}};_0x2281c6(++_0x126627);}(_0xea89,0x1e2));var _0x9ea8=function(_0xf64e53,_0x4db24b){_0xf64e53=_0xf64e53-0x0;var _0x1e185e=_0xea89[_0xf64e53];return _0x1e185e;};'use strict';var multer=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var path=require(_0x9ea8('0x2'));var timeout=require(_0x9ea8('0x3'));var express=require(_0x9ea8('0x4'));var router=express['Router']();var fs_extra=require(_0x9ea8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ea8('0x6'));var config=require('../../config/environment');var controller=require(_0x9ea8('0x7'));router[_0x9ea8('0x8')]('/',auth[_0x9ea8('0x9')](),controller[_0x9ea8('0xa')]);router[_0x9ea8('0x8')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller['show']);router[_0x9ea8('0xc')]('/',auth[_0x9ea8('0x9')](),controller['create']);router[_0x9ea8('0xd')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller['update']);router[_0x9ea8('0xe')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller[_0x9ea8('0xf')]);module[_0x9ea8('0x10')]=router; \ No newline at end of file +var _0xa25a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0xa25a,0x160));var _0xaa25=function(_0x2d9746,_0x23ec17){_0x2d9746=_0x2d9746-0x0;var _0x1f9b51=_0xa25a[_0x2d9746];return _0x1f9b51;};'use strict';var multer=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var path=require(_0xaa25('0x2'));var timeout=require(_0xaa25('0x3'));var express=require(_0xaa25('0x4'));var router=express[_0xaa25('0x5')]();var fs_extra=require(_0xaa25('0x6'));var auth=require(_0xaa25('0x7'));var interaction=require(_0xaa25('0x8'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xaa25('0x9')]('/',auth[_0xaa25('0xa')](),controller['index']);router[_0xaa25('0x9')](_0xaa25('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaa25('0xc')]('/',auth[_0xaa25('0xa')](),controller['create']);router[_0xaa25('0xd')]('/:id',auth[_0xaa25('0xa')](),controller['update']);router[_0xaa25('0xe')](_0xaa25('0xb'),auth['isAuthenticated'](),controller[_0xaa25('0xf')]);module[_0xaa25('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 f4da27d..9460ea8 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 _0xa5df=['sequelize','exports','STRING','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa5df,0x190));var _0xfa5d=function(_0x45dfd3,_0x46506b){_0x45dfd3=_0x45dfd3-0x0;var _0x29d982=_0xa5df[_0x45dfd3];return _0x29d982;};'use strict';var Sequelize=require(_0xfa5d('0x0'));module[_0xfa5d('0x1')]={'name':{'type':Sequelize[_0xfa5d('0x2')],'unique':_0xfa5d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfa5d('0x2')]}}; \ No newline at end of file +var _0xb769=['sequelize','STRING','name'];(function(_0x3cce38,_0x5b4980){var _0x2ef508=function(_0x48d1d4){while(--_0x48d1d4){_0x3cce38['push'](_0x3cce38['shift']());}};_0x2ef508(++_0x5b4980);}(_0xb769,0x19e));var _0x9b76=function(_0x2ce45a,_0x1176de){_0x2ce45a=_0x2ce45a-0x0;var _0x45e11c=_0xb769[_0x2ce45a];return _0x45e11c;};'use strict';var Sequelize=require(_0x9b76('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b76('0x1')],'unique':_0x9b76('0x2'),'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 c8eb218..70ddf49 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 _0x1fd5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','update','then','Variables','UserProfileResource','destroy','name','send','index','map','Variable','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','catch','show','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','error','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x26f661,_0x5ba5f3){var _0x402db7=function(_0x59f632){while(--_0x59f632){_0x26f661['push'](_0x26f661['shift']());}};_0x402db7(++_0x5ba5f3);}(_0x1fd5,0x87));var _0x51fd=function(_0x3e8285,_0x1ff5e4){_0x3e8285=_0x3e8285-0x0;var _0xe21112=_0x1fd5[_0x3e8285];return _0xe21112;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51fd('0x0'));var zipdir=require(_0x51fd('0x1'));var jsonpatch=require(_0x51fd('0x2'));var rp=require('request-promise');var moment=require(_0x51fd('0x3'));var BPromise=require(_0x51fd('0x4'));var Mustache=require(_0x51fd('0x5'));var util=require('util');var path=require(_0x51fd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51fd('0x7'));var _=require(_0x51fd('0x8'));var squel=require(_0x51fd('0x9'));var crypto=require(_0x51fd('0xa'));var jsforce=require(_0x51fd('0xb'));var deskjs=require(_0x51fd('0xc'));var toCsv=require(_0x51fd('0xd'));var querystring=require('querystring');var Papa=require(_0x51fd('0xe'));var Redis=require(_0x51fd('0xf'));var authService=require(_0x51fd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51fd('0x11'));var hardwareService=require(_0x51fd('0x12'));var logger=require(_0x51fd('0x13'))(_0x51fd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51fd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f5f03,_0x593dad){_0x593dad=_0x593dad||0xcc;return function(_0x209f65){if(_0x209f65){return _0x1f5f03[_0x51fd('0x16')](_0x593dad);}return _0x1f5f03['status'](_0x593dad)[_0x51fd('0x17')]();};}function respondWithResult(_0x1581c0,_0x46b838){_0x46b838=_0x46b838||0xc8;return function(_0x2044f6){if(_0x2044f6){return _0x1581c0['status'](_0x46b838)[_0x51fd('0x18')](_0x2044f6);}};}function respondWithFilteredResult(_0x5f353a,_0x2845c6){return function(_0x2f7927){if(_0x2f7927){var _0x5ee231=typeof _0x2845c6[_0x51fd('0x19')]===_0x51fd('0x1a')&&typeof _0x2845c6['limit']===_0x51fd('0x1a');var _0xa3272e=_0x2f7927[_0x51fd('0x1b')];var _0x2bedde=_0x5ee231?0x0:_0x2845c6[_0x51fd('0x19')];var _0x11aa88=_0x5ee231?_0x2f7927[_0x51fd('0x1b')]:_0x2845c6['offset']+_0x2845c6[_0x51fd('0x1c')];var _0x295239;if(_0x11aa88>=_0xa3272e){_0x11aa88=_0xa3272e;_0x295239=0xc8;}else{_0x295239=0xce;}_0x5f353a[_0x51fd('0x1d')](_0x295239);return _0x5f353a['set'](_0x51fd('0x1e'),_0x2bedde+'-'+_0x11aa88+'/'+_0xa3272e)[_0x51fd('0x18')](_0x2f7927);}return null;};}function patchUpdates(_0x1b4059){return function(_0x282a0c){try{jsonpatch[_0x51fd('0x1f')](_0x282a0c,_0x1b4059,!![]);}catch(_0x1564e4){return BPromise['reject'](_0x1564e4);}return _0x282a0c['save']();};}function saveUpdates(_0x3f6b01,_0x199def){return function(_0x7fe8f7){if(_0x7fe8f7){return _0x7fe8f7[_0x51fd('0x20')](_0x3f6b01)[_0x51fd('0x21')](function(_0xdd79ba){return _0xdd79ba;});}return null;};}function removeEntity(_0x4e70ba,_0x430f88){return function(_0x110658){if(_0x110658){return _0x110658['destroy']()[_0x51fd('0x21')](function(){var _0x1491c8=_0x110658['get']({'plain':!![]});var _0x1f2092=_0x51fd('0x22');return db[_0x51fd('0x23')][_0x51fd('0x24')]({'where':{'type':_0x1f2092,'resourceId':_0x1491c8['id']}})['then'](function(){return _0x110658;});})[_0x51fd('0x21')](function(){_0x4e70ba['status'](0xcc)[_0x51fd('0x17')]();});}};}function handleEntityNotFound(_0x31dbd1,_0x272376){return function(_0x139abd){if(!_0x139abd){_0x31dbd1[_0x51fd('0x16')](0x194);}return _0x139abd;};}function handleError(_0x28d135,_0x2f56dd){_0x2f56dd=_0x2f56dd||0x1f4;return function(_0x5c1239){logger['error'](_0x5c1239['stack']);if(_0x5c1239[_0x51fd('0x25')]){delete _0x5c1239[_0x51fd('0x25')];}_0x28d135[_0x51fd('0x1d')](_0x2f56dd)[_0x51fd('0x26')](_0x5c1239);};}exports[_0x51fd('0x27')]=function(_0x2822d7,_0x237188){var _0x181d79={},_0x2412d4={},_0x2ccfe9={'count':0x0,'rows':[]};var _0x19720c=_[_0x51fd('0x28')](db[_0x51fd('0x29')][_0x51fd('0x2a')],function(_0x320a2f){return{'name':_0x320a2f[_0x51fd('0x2b')],'type':_0x320a2f[_0x51fd('0x2c')]['key']};});_0x2412d4[_0x51fd('0x2d')]=_[_0x51fd('0x28')](_0x19720c,_0x51fd('0x25'));_0x2412d4['query']=_['keys'](_0x2822d7[_0x51fd('0x2e')]);_0x2412d4[_0x51fd('0x2f')]=_[_0x51fd('0x30')](_0x2412d4[_0x51fd('0x2d')],_0x2412d4[_0x51fd('0x2e')]);_0x181d79[_0x51fd('0x31')]=_[_0x51fd('0x30')](_0x2412d4[_0x51fd('0x2d')],qs['fields'](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x32')]));_0x181d79['attributes']=_0x181d79[_0x51fd('0x31')][_0x51fd('0x33')]?_0x181d79[_0x51fd('0x31')]:_0x2412d4[_0x51fd('0x2d')];if(!_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x34')](_0x51fd('0x35'))){_0x181d79[_0x51fd('0x1c')]=qs[_0x51fd('0x1c')](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x1c')]);_0x181d79[_0x51fd('0x19')]=qs[_0x51fd('0x19')](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x19')]);}_0x181d79[_0x51fd('0x36')]=qs[_0x51fd('0x37')](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x37')]);_0x181d79['where']=qs[_0x51fd('0x2f')](_['pick'](_0x2822d7[_0x51fd('0x2e')],_0x2412d4[_0x51fd('0x2f')]),_0x19720c);if(_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x38')]){_0x181d79['where']=_[_0x51fd('0x39')](_0x181d79[_0x51fd('0x3a')],{'$or':_['map'](_0x19720c,function(_0x1aa409){if(_0x1aa409[_0x51fd('0x2c')]!==_0x51fd('0x3b')){var _0xe36862={};_0xe36862[_0x1aa409[_0x51fd('0x25')]]={'$like':'%'+_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x38')]+'%'};return _0xe36862;}})});}_0x181d79=_['merge']({},_0x181d79,_0x2822d7['options']);var _0x452e10={'where':_0x181d79[_0x51fd('0x3a')]};return db[_0x51fd('0x29')][_0x51fd('0x1b')](_0x452e10)['then'](function(_0x37f4e7){_0x2ccfe9[_0x51fd('0x1b')]=_0x37f4e7;if(_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x3c')]){_0x181d79[_0x51fd('0x3d')]=[{'all':!![]}];}return db[_0x51fd('0x29')]['findAll'](_0x181d79);})[_0x51fd('0x21')](function(_0x145cd2){_0x2ccfe9['rows']=_0x145cd2;return _0x2ccfe9;})[_0x51fd('0x21')](respondWithFilteredResult(_0x237188,_0x181d79))[_0x51fd('0x3e')](handleError(_0x237188,null));};exports[_0x51fd('0x3f')]=function(_0x1e6bf2,_0x3d68c2){var _0x9fc591={'raw':!![],'where':{'id':_0x1e6bf2[_0x51fd('0x40')]['id']}},_0x142749={};_0x142749[_0x51fd('0x2d')]=_[_0x51fd('0x41')](db[_0x51fd('0x29')][_0x51fd('0x2a')]);_0x142749[_0x51fd('0x2e')]=_[_0x51fd('0x41')](_0x1e6bf2[_0x51fd('0x2e')]);_0x142749['filters']=_[_0x51fd('0x30')](_0x142749[_0x51fd('0x2d')],_0x142749[_0x51fd('0x2e')]);_0x9fc591['attributes']=_[_0x51fd('0x30')](_0x142749[_0x51fd('0x2d')],qs[_0x51fd('0x32')](_0x1e6bf2[_0x51fd('0x2e')][_0x51fd('0x32')]));_0x9fc591[_0x51fd('0x31')]=_0x9fc591[_0x51fd('0x31')]['length']?_0x9fc591['attributes']:_0x142749[_0x51fd('0x2d')];if(_0x1e6bf2['query'][_0x51fd('0x3c')]){_0x9fc591[_0x51fd('0x3d')]=[{'all':!![]}];}_0x9fc591=_['merge']({},_0x9fc591,_0x1e6bf2[_0x51fd('0x42')]);return db[_0x51fd('0x29')]['find'](_0x9fc591)[_0x51fd('0x21')](handleEntityNotFound(_0x3d68c2,null))['then'](respondWithResult(_0x3d68c2,null))[_0x51fd('0x3e')](handleError(_0x3d68c2,null));};exports[_0x51fd('0x43')]=function(_0x24999d,_0x367ea8){return db[_0x51fd('0x29')]['create'](_0x24999d[_0x51fd('0x44')],{})[_0x51fd('0x21')](function(_0x5ce93a){var _0x5a119a=_0x24999d[_0x51fd('0x45')]['get']({'plain':!![]});if(!_0x5a119a)throw new Error(_0x51fd('0x46'));if(_0x5a119a['role']===_0x51fd('0x45')){var _0x1d4362=_0x5ce93a[_0x51fd('0x47')]({'plain':!![]});var _0x44070a=_0x51fd('0x22');return db[_0x51fd('0x48')]['find']({'where':{'name':_0x44070a,'userProfileId':_0x5a119a['userProfileId']},'raw':!![]})[_0x51fd('0x21')](function(_0x11b41b){if(_0x11b41b&&_0x11b41b[_0x51fd('0x49')]===0x0){return db['UserProfileResource'][_0x51fd('0x43')]({'name':_0x1d4362[_0x51fd('0x25')],'resourceId':_0x1d4362['id'],'type':_0x11b41b[_0x51fd('0x25')],'sectionId':_0x11b41b['id']},{})['then'](function(){return _0x5ce93a;});}else{return _0x5ce93a;}})['catch'](function(_0x61e9bb){logger[_0x51fd('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x61e9bb);throw _0x61e9bb;});}return _0x5ce93a;})['then'](respondWithResult(_0x367ea8,0xc9))[_0x51fd('0x3e')](handleError(_0x367ea8,null));};exports[_0x51fd('0x20')]=function(_0x41341e,_0x4338ab){if(_0x41341e['body']['id']){delete _0x41341e['body']['id'];}return db[_0x51fd('0x29')][_0x51fd('0x4b')]({'where':{'id':_0x41341e[_0x51fd('0x40')]['id']}})['then'](handleEntityNotFound(_0x4338ab,null))[_0x51fd('0x21')](saveUpdates(_0x41341e[_0x51fd('0x44')],null))[_0x51fd('0x21')](respondWithResult(_0x4338ab,null))['catch'](handleError(_0x4338ab,null));};exports[_0x51fd('0x24')]=function(_0x30af30,_0x5abea3){return db[_0x51fd('0x29')][_0x51fd('0x4b')]({'where':{'id':_0x30af30[_0x51fd('0x40')]['id']}})[_0x51fd('0x21')](handleEntityNotFound(_0x5abea3,null))[_0x51fd('0x21')](removeEntity(_0x5abea3,null))['catch'](handleError(_0x5abea3,null));}; \ No newline at end of file +var _0x9e85=['findAll','rows','catch','show','include','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','get','Variables','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x9e85,0x10b));var _0x59e8=function(_0x412587,_0x4ea099){_0x412587=_0x412587-0x0;var _0x2f7f2d=_0x9e85[_0x412587];return _0x2f7f2d;};'use strict';var emlformat=require(_0x59e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59e8('0x1'));var jsonpatch=require(_0x59e8('0x2'));var rp=require(_0x59e8('0x3'));var moment=require(_0x59e8('0x4'));var BPromise=require(_0x59e8('0x5'));var Mustache=require(_0x59e8('0x6'));var util=require('util');var path=require(_0x59e8('0x7'));var sox=require(_0x59e8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59e8('0x9'));var squel=require(_0x59e8('0xa'));var crypto=require(_0x59e8('0xb'));var jsforce=require(_0x59e8('0xc'));var deskjs=require(_0x59e8('0xd'));var toCsv=require(_0x59e8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x59e8('0xf'));var as=require(_0x59e8('0x10'));var hardwareService=require(_0x59e8('0x11'));var logger=require(_0x59e8('0x12'))(_0x59e8('0x13'));var utils=require('../../config/utils');var config=require(_0x59e8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x59e8('0x15'))['db'];function respondWithStatusCode(_0x36b718,_0x5fde97){_0x5fde97=_0x5fde97||0xcc;return function(_0x1bd565){if(_0x1bd565){return _0x36b718['sendStatus'](_0x5fde97);}return _0x36b718[_0x59e8('0x16')](_0x5fde97)[_0x59e8('0x17')]();};}function respondWithResult(_0x4a5861,_0x4ac182){_0x4ac182=_0x4ac182||0xc8;return function(_0x3cbba7){if(_0x3cbba7){return _0x4a5861[_0x59e8('0x16')](_0x4ac182)['json'](_0x3cbba7);}};}function respondWithFilteredResult(_0x1b0b3a,_0xd1a72){return function(_0x50659b){if(_0x50659b){var _0x579fdd=typeof _0xd1a72['offset']===_0x59e8('0x18')&&typeof _0xd1a72['limit']===_0x59e8('0x18');var _0x1a9eb0=_0x50659b[_0x59e8('0x19')];var _0x2cac1e=_0x579fdd?0x0:_0xd1a72[_0x59e8('0x1a')];var _0x12f3f9=_0x579fdd?_0x50659b[_0x59e8('0x19')]:_0xd1a72[_0x59e8('0x1a')]+_0xd1a72['limit'];var _0xbc89ff;if(_0x12f3f9>=_0x1a9eb0){_0x12f3f9=_0x1a9eb0;_0xbc89ff=0xc8;}else{_0xbc89ff=0xce;}_0x1b0b3a[_0x59e8('0x16')](_0xbc89ff);return _0x1b0b3a[_0x59e8('0x1b')](_0x59e8('0x1c'),_0x2cac1e+'-'+_0x12f3f9+'/'+_0x1a9eb0)[_0x59e8('0x1d')](_0x50659b);}return null;};}function patchUpdates(_0x3baad2){return function(_0x342e01){try{jsonpatch[_0x59e8('0x1e')](_0x342e01,_0x3baad2,!![]);}catch(_0x5a2deb){return BPromise[_0x59e8('0x1f')](_0x5a2deb);}return _0x342e01[_0x59e8('0x20')]();};}function saveUpdates(_0x297765,_0x51230f){return function(_0x5ccac5){if(_0x5ccac5){return _0x5ccac5['update'](_0x297765)[_0x59e8('0x21')](function(_0x70efb5){return _0x70efb5;});}return null;};}function removeEntity(_0x48cace,_0x22f71e){return function(_0x2e3ade){if(_0x2e3ade){return _0x2e3ade['destroy']()[_0x59e8('0x21')](function(){var _0x3ed12=_0x2e3ade[_0x59e8('0x22')]({'plain':!![]});var _0x14942c=_0x59e8('0x23');return db[_0x59e8('0x24')][_0x59e8('0x25')]({'where':{'type':_0x14942c,'resourceId':_0x3ed12['id']}})[_0x59e8('0x21')](function(){return _0x2e3ade;});})[_0x59e8('0x21')](function(){_0x48cace['status'](0xcc)[_0x59e8('0x17')]();});}};}function handleEntityNotFound(_0x458771,_0x1d68ea){return function(_0xd617de){if(!_0xd617de){_0x458771[_0x59e8('0x26')](0x194);}return _0xd617de;};}function handleError(_0x4e0679,_0xabd9f1){_0xabd9f1=_0xabd9f1||0x1f4;return function(_0x370be1){logger[_0x59e8('0x27')](_0x370be1[_0x59e8('0x28')]);if(_0x370be1[_0x59e8('0x29')]){delete _0x370be1[_0x59e8('0x29')];}_0x4e0679[_0x59e8('0x16')](_0xabd9f1)[_0x59e8('0x2a')](_0x370be1);};}exports[_0x59e8('0x2b')]=function(_0x53a091,_0x2e4c19){var _0x699c1e={},_0x59f9d2={},_0x461a80={'count':0x0,'rows':[]};var _0x4beefd=_[_0x59e8('0x2c')](db[_0x59e8('0x2d')][_0x59e8('0x2e')],function(_0x3b4990){return{'name':_0x3b4990[_0x59e8('0x2f')],'type':_0x3b4990[_0x59e8('0x30')][_0x59e8('0x31')]};});_0x59f9d2[_0x59e8('0x32')]=_[_0x59e8('0x2c')](_0x4beefd,_0x59e8('0x29'));_0x59f9d2[_0x59e8('0x33')]=_[_0x59e8('0x34')](_0x53a091[_0x59e8('0x33')]);_0x59f9d2[_0x59e8('0x35')]=_[_0x59e8('0x36')](_0x59f9d2['model'],_0x59f9d2['query']);_0x699c1e[_0x59e8('0x37')]=_['intersection'](_0x59f9d2[_0x59e8('0x32')],qs[_0x59e8('0x38')](_0x53a091[_0x59e8('0x33')][_0x59e8('0x38')]));_0x699c1e[_0x59e8('0x37')]=_0x699c1e[_0x59e8('0x37')][_0x59e8('0x39')]?_0x699c1e[_0x59e8('0x37')]:_0x59f9d2['model'];if(!_0x53a091[_0x59e8('0x33')][_0x59e8('0x3a')](_0x59e8('0x3b'))){_0x699c1e[_0x59e8('0x3c')]=qs['limit'](_0x53a091[_0x59e8('0x33')][_0x59e8('0x3c')]);_0x699c1e[_0x59e8('0x1a')]=qs[_0x59e8('0x1a')](_0x53a091[_0x59e8('0x33')]['offset']);}_0x699c1e[_0x59e8('0x3d')]=qs['sort'](_0x53a091[_0x59e8('0x33')][_0x59e8('0x3e')]);_0x699c1e[_0x59e8('0x3f')]=qs[_0x59e8('0x35')](_[_0x59e8('0x40')](_0x53a091[_0x59e8('0x33')],_0x59f9d2[_0x59e8('0x35')]),_0x4beefd);if(_0x53a091[_0x59e8('0x33')][_0x59e8('0x41')]){_0x699c1e['where']=_[_0x59e8('0x42')](_0x699c1e[_0x59e8('0x3f')],{'$or':_['map'](_0x4beefd,function(_0x362c5f){if(_0x362c5f['type']!==_0x59e8('0x43')){var _0x172e44={};_0x172e44[_0x362c5f[_0x59e8('0x29')]]={'$like':'%'+_0x53a091[_0x59e8('0x33')]['filter']+'%'};return _0x172e44;}})});}_0x699c1e=_[_0x59e8('0x42')]({},_0x699c1e,_0x53a091['options']);var _0x5a404b={'where':_0x699c1e[_0x59e8('0x3f')]};return db[_0x59e8('0x2d')][_0x59e8('0x19')](_0x5a404b)['then'](function(_0x393e56){_0x461a80[_0x59e8('0x19')]=_0x393e56;if(_0x53a091[_0x59e8('0x33')][_0x59e8('0x44')]){_0x699c1e['include']=[{'all':!![]}];}return db['Variable'][_0x59e8('0x45')](_0x699c1e);})['then'](function(_0x468872){_0x461a80[_0x59e8('0x46')]=_0x468872;return _0x461a80;})['then'](respondWithFilteredResult(_0x2e4c19,_0x699c1e))[_0x59e8('0x47')](handleError(_0x2e4c19,null));};exports[_0x59e8('0x48')]=function(_0x128053,_0x57736a){var _0x12ccab={'raw':!![],'where':{'id':_0x128053['params']['id']}},_0x1eb143={};_0x1eb143[_0x59e8('0x32')]=_[_0x59e8('0x34')](db[_0x59e8('0x2d')]['rawAttributes']);_0x1eb143[_0x59e8('0x33')]=_['keys'](_0x128053[_0x59e8('0x33')]);_0x1eb143[_0x59e8('0x35')]=_[_0x59e8('0x36')](_0x1eb143[_0x59e8('0x32')],_0x1eb143[_0x59e8('0x33')]);_0x12ccab[_0x59e8('0x37')]=_['intersection'](_0x1eb143['model'],qs['fields'](_0x128053[_0x59e8('0x33')][_0x59e8('0x38')]));_0x12ccab['attributes']=_0x12ccab['attributes'][_0x59e8('0x39')]?_0x12ccab[_0x59e8('0x37')]:_0x1eb143['model'];if(_0x128053[_0x59e8('0x33')][_0x59e8('0x44')]){_0x12ccab[_0x59e8('0x49')]=[{'all':!![]}];}_0x12ccab=_['merge']({},_0x12ccab,_0x128053['options']);return db[_0x59e8('0x2d')][_0x59e8('0x4a')](_0x12ccab)[_0x59e8('0x21')](handleEntityNotFound(_0x57736a,null))['then'](respondWithResult(_0x57736a,null))['catch'](handleError(_0x57736a,null));};exports[_0x59e8('0x4b')]=function(_0x317b51,_0x14d3ce){return db[_0x59e8('0x2d')][_0x59e8('0x4b')](_0x317b51[_0x59e8('0x4c')],{})[_0x59e8('0x21')](function(_0x5f439b){var _0x5b1ec9=_0x317b51['user'][_0x59e8('0x22')]({'plain':!![]});if(!_0x5b1ec9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b1ec9[_0x59e8('0x4d')]===_0x59e8('0x4e')){var _0x350b85=_0x5f439b[_0x59e8('0x22')]({'plain':!![]});var _0x2f099c=_0x59e8('0x23');return db[_0x59e8('0x4f')][_0x59e8('0x4a')]({'where':{'name':_0x2f099c,'userProfileId':_0x5b1ec9['userProfileId']},'raw':!![]})[_0x59e8('0x21')](function(_0x24198c){if(_0x24198c&&_0x24198c[_0x59e8('0x50')]===0x0){return db[_0x59e8('0x24')]['create']({'name':_0x350b85['name'],'resourceId':_0x350b85['id'],'type':_0x24198c[_0x59e8('0x29')],'sectionId':_0x24198c['id']},{})[_0x59e8('0x21')](function(){return _0x5f439b;});}else{return _0x5f439b;}})[_0x59e8('0x47')](function(_0xa44d4){logger[_0x59e8('0x27')](_0x59e8('0x51'),_0xa44d4);throw _0xa44d4;});}return _0x5f439b;})[_0x59e8('0x21')](respondWithResult(_0x14d3ce,0xc9))[_0x59e8('0x47')](handleError(_0x14d3ce,null));};exports[_0x59e8('0x52')]=function(_0x250cd0,_0x27179e){if(_0x250cd0[_0x59e8('0x4c')]['id']){delete _0x250cd0[_0x59e8('0x4c')]['id'];}return db['Variable'][_0x59e8('0x4a')]({'where':{'id':_0x250cd0[_0x59e8('0x53')]['id']}})[_0x59e8('0x21')](handleEntityNotFound(_0x27179e,null))[_0x59e8('0x21')](saveUpdates(_0x250cd0[_0x59e8('0x4c')],null))['then'](respondWithResult(_0x27179e,null))[_0x59e8('0x47')](handleError(_0x27179e,null));};exports['destroy']=function(_0x10d31e,_0x55e4b8){return db[_0x59e8('0x2d')][_0x59e8('0x4a')]({'where':{'id':_0x10d31e[_0x59e8('0x53')]['id']}})[_0x59e8('0x21')](handleEntityNotFound(_0x55e4b8,null))['then'](removeEntity(_0x55e4b8,null))[_0x59e8('0x47')](handleError(_0x55e4b8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d6b2cee..fd27081 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 _0x3ade=['moment','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','api'];(function(_0x51667b,_0x4409ec){var _0x3ec7ff=function(_0x265e31){while(--_0x265e31){_0x51667b['push'](_0x51667b['shift']());}};_0x3ec7ff(++_0x4409ec);}(_0x3ade,0x1d0));var _0xe3ad=function(_0x1c1777,_0x4f345b){_0x1c1777=_0x1c1777-0x0;var _0x1e634c=_0x3ade[_0x1c1777];return _0x1e634c;};'use strict';var _=require(_0xe3ad('0x0'));var util=require(_0xe3ad('0x1'));var logger=require(_0xe3ad('0x2'))(_0xe3ad('0x3'));var moment=require(_0xe3ad('0x4'));var BPromise=require('bluebird');var rp=require(_0xe3ad('0x5'));var fs=require('fs');var path=require(_0xe3ad('0x6'));var rimraf=require('rimraf');var config=require(_0xe3ad('0x7'));var attributes=require(_0xe3ad('0x8'));module[_0xe3ad('0x9')]=function(_0x4af002,_0x1a578c){return _0x4af002[_0xe3ad('0xa')](_0xe3ad('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3672=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables'];(function(_0x33eab7,_0x460154){var _0x535701=function(_0x40254e){while(--_0x40254e){_0x33eab7['push'](_0x33eab7['shift']());}};_0x535701(++_0x460154);}(_0x3672,0x134));var _0x2367=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x3672[_0x397f37];return _0x31cae6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2367('0x0'))(_0x2367('0x1'));var moment=require(_0x2367('0x2'));var BPromise=require('bluebird');var rp=require(_0x2367('0x3'));var fs=require('fs');var path=require(_0x2367('0x4'));var rimraf=require(_0x2367('0x5'));var config=require(_0x2367('0x6'));var attributes=require(_0x2367('0x7'));module['exports']=function(_0x3de739,_0x3a5940){return _0x3de739[_0x2367('0x8')](_0x2367('0x9'),attributes,{'tableName':_0x2367('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 53ac4f9..416139f 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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x3f7686,_0x20a6fc){var _0x28a7d4=function(_0x160ef0){while(--_0x160ef0){_0x3f7686['push'](_0x3f7686['shift']());}};_0x28a7d4(++_0x20a6fc);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x2dda4d,_0x46d702){var _0x4580f4=function(_0x2c1989){while(--_0x2c1989){_0x2dda4d['push'](_0x2dda4d['shift']());}};_0x4580f4(++_0x46d702);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4718fe,_0x1874f7){_0x4718fe=_0x4718fe-0x0;var _0xbf7d7f=_0x1cb9[_0x4718fe];return _0xbf7d7f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5568ae6..6ebaa57 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 _0x9837=['reset','/pull','/restart','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','/reset','canUpdate'];(function(_0x366daf,_0x56e78f){var _0x14d1d5=function(_0x46ff5d){while(--_0x46ff5d){_0x366daf['push'](_0x366daf['shift']());}};_0x14d1d5(++_0x56e78f);}(_0x9837,0x166));var _0x7983=function(_0x47bb77,_0x28a3b6){_0x47bb77=_0x47bb77-0x0;var _0x524a15=_0x9837[_0x47bb77];return _0x524a15;};'use strict';var express=require(_0x7983('0x0'));var router=express[_0x7983('0x1')]();var auth=require(_0x7983('0x2'));var controller=require(_0x7983('0x3'));router[_0x7983('0x4')]('/',controller[_0x7983('0x5')]);router[_0x7983('0x4')](_0x7983('0x6'),auth[_0x7983('0x7')](),auth['canUpdate'](),controller['fetch']);router[_0x7983('0x4')](_0x7983('0x8'),auth[_0x7983('0x7')](),auth[_0x7983('0x9')](),controller[_0x7983('0xa')]);router[_0x7983('0x4')](_0x7983('0xb'),auth[_0x7983('0x7')](),auth[_0x7983('0x9')](),controller['pull']);router[_0x7983('0x4')](_0x7983('0xc'),auth['isAuthenticated'](),controller[_0x7983('0xd')]);router[_0x7983('0x4')](_0x7983('0xe'),controller[_0x7983('0xf')]);module['exports']=router; \ No newline at end of file +var _0x36cd=['./version.controller','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','restart','migrations','exports','express','Router'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0x36cd,0xa3));var _0xd36c=function(_0x450b2a,_0x174591){_0x450b2a=_0x450b2a-0x0;var _0x37a7ff=_0x36cd[_0x450b2a];return _0x37a7ff;};'use strict';var express=require(_0xd36c('0x0'));var router=express[_0xd36c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd36c('0x2'));router[_0xd36c('0x3')]('/',controller[_0xd36c('0x4')]);router['get'](_0xd36c('0x5'),auth['isAuthenticated'](),auth[_0xd36c('0x6')](),controller[_0xd36c('0x7')]);router[_0xd36c('0x3')](_0xd36c('0x8'),auth[_0xd36c('0x9')](),auth[_0xd36c('0x6')](),controller['reset']);router[_0xd36c('0x3')](_0xd36c('0xa'),auth[_0xd36c('0x9')](),auth[_0xd36c('0x6')](),controller[_0xd36c('0xb')]);router[_0xd36c('0x3')]('/restart',auth['isAuthenticated'](),controller[_0xd36c('0xc')]);router['get']('/migrations',controller[_0xd36c('0xd')]);module[_0xd36c('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 3bbcc75..4b264e1 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 _0x607a=['motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','version','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart'];(function(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x607a,0x192));var _0xa607=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x607a[_0x4b369d];return _0x571a98;};'use strict';var Umzug=require(_0xa607('0x0'));var path=require(_0xa607('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xa607('0x2'));var exec=require(_0xa607('0x3'))[_0xa607('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0xa607('0x5'));var pm2=require(_0xa607('0x6'));var logger=require(_0xa607('0x7'))(_0xa607('0x8'));var git=require('simple-git')(config[_0xa607('0x9')]);exports['index']=function(_0x485a1b,_0x12f8ab){var _0x2a9368={'current':module[_0xa607('0xa')]['version'],'phonebar':0x2};if(_0x485a1b[_0xa607('0xb')]&&_0x485a1b['query'][_0xa607('0xc')]){return git[_0xa607('0xd')]()[_0xa607('0xe')](function(_0x3e6c8d,_0x1abffd){_0x2a9368[_0xa607('0xc')]=(_0x3e6c8d?module[_0xa607('0xa')]['version']:_0x1abffd[_0xa607('0xc')])||_0xa607('0xf');return _0x12f8ab[_0xa607('0x10')](0xc8)[_0xa607('0x11')](_0x2a9368);});}else{return _0x12f8ab[_0xa607('0x10')](0xc8)['json'](_0x2a9368);}};exports[_0xa607('0xd')]=function(_0x35d69f,_0x1ba210){return git[_0xa607('0xd')]([_0xa607('0x12'),'master'],function(_0x185010){if(_0x185010){logger[_0xa607('0x13')](_0x185010);return _0x1ba210[_0xa607('0x10')](0x1f4)[_0xa607('0x11')](_0x185010);}logger['info'](_0xa607('0x14'));return _0x1ba210[_0xa607('0x10')](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x15')});});};exports[_0xa607('0x16')]=function(_0x160e7b,_0x315657){return git[_0xa607('0x16')]([_0xa607('0x17'),_0xa607('0x18')],function(_0x597a88){if(_0x597a88){logger['error'](_0x597a88);return _0x315657['status'](0x1f4)['json'](_0x597a88);}logger[_0xa607('0x19')](_0xa607('0x1a'));return _0x315657['status'](0xc8)[_0xa607('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0xa607('0x1b')]=function(_0x595fbf,_0x1ac238){exec(_0xa607('0x1c'),function(_0x124a1b,_0x24a0be,_0x179afb){logger[_0xa607('0x19')](_0x24a0be);logger[_0xa607('0x19')](_0x179afb);if(_0x124a1b){logger['error'](_0x124a1b);return _0x1ac238[_0xa607('0x10')](0x1f4)[_0xa607('0x11')](_0x124a1b);}return _0x1ac238[_0xa607('0x10')](0xc8)['json']({'output':_0x24a0be});});};exports[_0xa607('0x1d')]=function(_0x37fc3c,_0x3df999){return pm2[_0xa607('0x1d')](_0xa607('0x1e'))[_0xa607('0x1f')](function(_0x149b4b){logger[_0xa607('0x19')](_0xa607('0x20'),_0x149b4b);return _0x3df999[_0xa607('0x10')](0xc8)['json']({'output':_0xa607('0x21')});})[_0xa607('0x22')](function(_0x60d6da){logger[_0xa607('0x13')](_0x60d6da);return _0x3df999[_0xa607('0x10')](0x1f4)['json'](_0x60d6da);});};exports[_0xa607('0x23')]=function(_0x58953e,_0x4d305e){var _0x531eeb=fs['readdirSync'](path[_0xa607('0x24')](config[_0xa607('0x9')],'server','migrations'));var _0x1e3ddc=[];for(var _0x3881f1=0x0;_0x3881f1<_0x531eeb[_0xa607('0x25')];_0x3881f1++){var _0x205bfa=_0x531eeb[_0x3881f1][_0xa607('0x26')](_0xa607('0x27'),'');if(compareVersions(module[_0xa607('0xa')][_0xa607('0x28')],_0x205bfa)===-0x1){_0x1e3ddc[_0xa607('0x29')](_0x205bfa);}}if(_0x1e3ddc[_0xa607('0x25')]){var _0x2277ee=_0x1e3ddc[_0xa607('0x2a')](compareVersions);var _0x78dcfb=new Umzug({'storage':_0xa607('0x2b'),'storageOptions':{'model':db[_0xa607('0x2c')],'modelName':'Migration','columnName':_0xa607('0x28')},'migrations':{'params':[db[_0xa607('0x2b')][_0xa607('0x2d')](),db[_0xa607('0x2b')][_0xa607('0x2e')],function(){throw new Error(_0xa607('0x2f'));}],'path':path[_0xa607('0x24')](config[_0xa607('0x9')],_0xa607('0x30'),_0xa607('0x23')),'pattern':/\.js$/}});_0x78dcfb['up']({'migrations':_[_0xa607('0x31')](_0x2277ee,function(_0xac146b){return _0xac146b+_0xa607('0x27');})})[_0xa607('0x1f')](function(){return _0x4d305e['status'](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x32')+module[_0xa607('0xa')][_0xa607('0x28')]+_0xa607('0x33')+_[_0xa607('0x34')](_0x2277ee),'migrations':_[_0xa607('0x24')](_0x2277ee)});})[_0xa607('0x22')](function(_0x349d20){if(_0x349d20 instanceof db['sequelize']['UniqueConstraintError']){return _0x4d305e[_0xa607('0x10')](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x35')});}else{return _0x4d305e['status'](0x1f4)[_0xa607('0x11')](_0x349d20);}});}else{return _0x4d305e['status'](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x35')});}}; \ No newline at end of file +var _0xf1c5=['--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','sequelize','Migration','constructor','join','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset'];(function(_0x4a7e2d,_0x5840a4){var _0x3dd463=function(_0x2978ab){while(--_0x2978ab){_0x4a7e2d['push'](_0x4a7e2d['shift']());}};_0x3dd463(++_0x5840a4);}(_0xf1c5,0x1db));var _0x5f1c=function(_0x3c1a29,_0x35fb6d){_0x3c1a29=_0x3c1a29-0x0;var _0x2cbb47=_0xf1c5[_0x3c1a29];return _0x2cbb47;};'use strict';var Umzug=require(_0x5f1c('0x0'));var path=require(_0x5f1c('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x5f1c('0x2'))(module,_0x5f1c('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x5f1c('0x4'))[_0x5f1c('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x5f1c('0x6'));var pm2=require(_0x5f1c('0x7'));var logger=require(_0x5f1c('0x8'))('update');var git=require('simple-git')(config[_0x5f1c('0x9')]);exports[_0x5f1c('0xa')]=function(_0x2c7c00,_0x18aa28){var _0x56c77b={'current':module[_0x5f1c('0xb')][_0x5f1c('0x3')],'phonebar':0x2};if(_0x2c7c00[_0x5f1c('0xc')]&&_0x2c7c00[_0x5f1c('0xc')][_0x5f1c('0xd')]){return git['fetch']()['tags'](function(_0x4eb3e8,_0x5af8a9){_0x56c77b[_0x5f1c('0xd')]=(_0x4eb3e8?module[_0x5f1c('0xb')][_0x5f1c('0x3')]:_0x5af8a9[_0x5f1c('0xd')])||_0x5f1c('0xe');return _0x18aa28[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')](_0x56c77b);});}else{return _0x18aa28['status'](0xc8)[_0x5f1c('0x10')](_0x56c77b);}};exports[_0x5f1c('0x11')]=function(_0x4e4e5c,_0x3b1e92){return git['fetch']([_0x5f1c('0x12'),_0x5f1c('0x13')],function(_0x45d76b){if(_0x45d76b){logger[_0x5f1c('0x14')](_0x45d76b);return _0x3b1e92[_0x5f1c('0xf')](0x1f4)[_0x5f1c('0x10')](_0x45d76b);}logger[_0x5f1c('0x15')](_0x5f1c('0x16'));return _0x3b1e92[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x17')});});};exports[_0x5f1c('0x18')]=function(_0x5b6198,_0x1ca9ef){return git[_0x5f1c('0x18')]([_0x5f1c('0x19'),'FETCH_HEAD'],function(_0x5d145f){if(_0x5d145f){logger[_0x5f1c('0x14')](_0x5d145f);return _0x1ca9ef[_0x5f1c('0xf')](0x1f4)['json'](_0x5d145f);}logger['info'](_0x5f1c('0x1a'));return _0x1ca9ef[_0x5f1c('0xf')](0xc8)['json']({'output':_0x5f1c('0x1b')});});};exports['pull']=function(_0x52c8c9,_0x415fd2){exec(_0x5f1c('0x1c'),function(_0x3657b7,_0x14327a,_0x17676d){logger[_0x5f1c('0x15')](_0x14327a);logger[_0x5f1c('0x15')](_0x17676d);if(_0x3657b7){logger[_0x5f1c('0x14')](_0x3657b7);return _0x415fd2[_0x5f1c('0xf')](0x1f4)['json'](_0x3657b7);}return _0x415fd2[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x14327a});});};exports['restart']=function(_0x309cb7,_0x16bd65){return pm2[_0x5f1c('0x1d')](_0x5f1c('0x1e'))[_0x5f1c('0x1f')](function(_0x27484d){logger[_0x5f1c('0x15')](_0x5f1c('0x20'),_0x27484d);return _0x16bd65[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x21')});})[_0x5f1c('0x22')](function(_0x299845){logger[_0x5f1c('0x14')](_0x299845);return _0x16bd65['status'](0x1f4)[_0x5f1c('0x10')](_0x299845);});};exports[_0x5f1c('0x23')]=function(_0x35cfe2,_0x52b2d2){var _0x5e774f=fs[_0x5f1c('0x24')](path['join'](config[_0x5f1c('0x9')],_0x5f1c('0x25'),_0x5f1c('0x23')));var _0x4c015d=[];for(var _0x48c10a=0x0;_0x48c10a<_0x5e774f[_0x5f1c('0x26')];_0x48c10a++){var _0x2aae90=_0x5e774f[_0x48c10a][_0x5f1c('0x27')]('.js','');if(compareVersions(module['exports'][_0x5f1c('0x3')],_0x2aae90)===-0x1){_0x4c015d['push'](_0x2aae90);}}if(_0x4c015d['length']){var _0x309993=_0x4c015d['sort'](compareVersions);var _0x121670=new Umzug({'storage':_0x5f1c('0x28'),'storageOptions':{'model':db['Migration'],'modelName':_0x5f1c('0x29'),'columnName':_0x5f1c('0x3')},'migrations':{'params':[db[_0x5f1c('0x28')]['getQueryInterface'](),db[_0x5f1c('0x28')][_0x5f1c('0x2a')],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[_0x5f1c('0x2b')](config[_0x5f1c('0x9')],_0x5f1c('0x25'),_0x5f1c('0x23')),'pattern':/\.js$/}});_0x121670['up']({'migrations':_['map'](_0x309993,function(_0x262f24){return _0x262f24+_0x5f1c('0x2c');})})['then'](function(){return _0x52b2d2[_0x5f1c('0xf')](0xc8)['json']({'output':_0x5f1c('0x2d')+module[_0x5f1c('0xb')]['version']+_0x5f1c('0x2e')+_[_0x5f1c('0x2f')](_0x309993),'migrations':_['join'](_0x309993)});})[_0x5f1c('0x22')](function(_0xad10f3){if(_0xad10f3 instanceof db[_0x5f1c('0x28')][_0x5f1c('0x30')]){return _0x52b2d2['status'](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x31')});}else{return _0x52b2d2[_0x5f1c('0xf')](0x1f4)[_0x5f1c('0x10')](_0xad10f3);}});}else{return _0x52b2d2[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4268559..e11f995 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 _0x3b1a=['util','path','express','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x4fa72d,_0x22ebbf){var _0x175aa3=function(_0x4afd9c){while(--_0x4afd9c){_0x4fa72d['push'](_0x4fa72d['shift']());}};_0x175aa3(++_0x22ebbf);}(_0x3b1a,0x18f));var _0xa3b1=function(_0x425c5b,_0x5a23a5){_0x425c5b=_0x425c5b-0x0;var _0x3ec47a=_0x3b1a[_0x425c5b];return _0x3ec47a;};'use strict';var multer=require(_0xa3b1('0x0'));var util=require(_0xa3b1('0x1'));var path=require(_0xa3b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3b1('0x3'));var router=express[_0xa3b1('0x4')]();var fs_extra=require(_0xa3b1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa3b1('0x6'));var controller=require(_0xa3b1('0x7'));router[_0xa3b1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa3b1('0x9'),auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xb')]);router[_0xa3b1('0x8')](_0xa3b1('0xc'),auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xd')]);router[_0xa3b1('0xe')]('/',auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xf')]);router['put'](_0xa3b1('0xc'),auth['isAuthenticated'](),controller[_0xa3b1('0x10')]);router[_0xa3b1('0x11')]('/:id',auth[_0xa3b1('0xa')](),controller[_0xa3b1('0x12')]);module[_0xa3b1('0x13')]=router; \ No newline at end of file +var _0x5ea8=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x20a69b,_0x6122a1){var _0x15b643=function(_0x3b2988){while(--_0x3b2988){_0x20a69b['push'](_0x20a69b['shift']());}};_0x15b643(++_0x6122a1);}(_0x5ea8,0x127));var _0x85ea=function(_0x2244be,_0x8cad71){_0x2244be=_0x2244be-0x0;var _0x1e63ba=_0x5ea8[_0x2244be];return _0x1e63ba;};'use strict';var multer=require('multer');var util=require(_0x85ea('0x0'));var path=require(_0x85ea('0x1'));var timeout=require(_0x85ea('0x2'));var express=require(_0x85ea('0x3'));var router=express[_0x85ea('0x4')]();var fs_extra=require(_0x85ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x85ea('0x6'));var config=require(_0x85ea('0x7'));var controller=require(_0x85ea('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x85ea('0x9')](_0x85ea('0xa'),auth['isAuthenticated'](),controller[_0x85ea('0xb')]);router['get'](_0x85ea('0xc'),auth[_0x85ea('0xd')](),controller[_0x85ea('0xe')]);router[_0x85ea('0xf')]('/',auth['isAuthenticated'](),controller[_0x85ea('0x10')]);router[_0x85ea('0x11')](_0x85ea('0xc'),auth[_0x85ea('0xd')](),controller[_0x85ea('0x12')]);router[_0x85ea('0x13')](_0x85ea('0xc'),auth['isAuthenticated'](),controller[_0x85ea('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 531921a..1b57c4e 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 _0x47d6=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x47d6,0x13f));var _0x647d=function(_0x1177cd,_0xec72e1){_0x1177cd=_0x1177cd-0x0;var _0x37d3cc=_0x47d6[_0x1177cd];return _0x37d3cc;};'use strict';var Sequelize=require(_0x647d('0x0'));module[_0x647d('0x1')]={'type':{'type':Sequelize[_0x647d('0x2')]},'uniqueid':{'type':Sequelize[_0x647d('0x2')]},'calleridnum':{'type':Sequelize[_0x647d('0x2')]},'calleridname':{'type':Sequelize[_0x647d('0x2')]},'queue':{'type':Sequelize[_0x647d('0x2')]},'interface':{'type':Sequelize[_0x647d('0x2')]},'membername':{'type':Sequelize[_0x647d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x647d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x647d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x647d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x647d('0x3')]},'agentdumpAt':{'type':Sequelize[_0x647d('0x3')]},'holdtime':{'type':Sequelize[_0x647d('0x4')]},'agentcomplete':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x647d('0x4')]},'agentacw':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x647d('0x4')]},'reason':{'type':Sequelize[_0x647d('0x2')]},'lastevent':{'type':Sequelize[_0x647d('0x2')]},'channel':{'type':Sequelize[_0x647d('0x2')]},'channelstate':{'type':Sequelize[_0x647d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x647d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x647d('0x2')]},'connectedlinename':{'type':Sequelize[_0x647d('0x2')]},'language':{'type':Sequelize[_0x647d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x647d('0x2')]},'priority':{'type':Sequelize[_0x647d('0x2')]},'destchannel':{'type':Sequelize[_0x647d('0x2')]},'destchannelstate':{'type':Sequelize[_0x647d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x647d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x647d('0x2')]},'destcalleridname':{'type':Sequelize[_0x647d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x647d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x647d('0x2')]},'destaccountcode':{'type':Sequelize[_0x647d('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x647d('0x2')]},'destpriority':{'type':Sequelize[_0x647d('0x2')]},'destuniqueid':{'type':Sequelize[_0x647d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x647d('0x2')],'comment':_0x647d('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x647d('0x2')]},'agententerreason':{'type':Sequelize[_0x647d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c8b=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x19511d,_0x27b9fc){var _0x3c6110=function(_0x1e8383){while(--_0x1e8383){_0x19511d['push'](_0x19511d['shift']());}};_0x3c6110(++_0x27b9fc);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x597594,_0xd0dde1){_0x597594=_0x597594-0x0;var _0x2c38d0=_0x3c8b[_0x597594];return _0x2c38d0;};'use strict';var Sequelize=require('sequelize');module[_0xb3c8('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb3c8('0x1')]},'calleridnum':{'type':Sequelize[_0xb3c8('0x1')]},'calleridname':{'type':Sequelize[_0xb3c8('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb3c8('0x1')]},'membername':{'type':Sequelize[_0xb3c8('0x1')]},'agentcalledAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentconnectAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentdumpAt':{'type':Sequelize[_0xb3c8('0x2')]},'holdtime':{'type':Sequelize[_0xb3c8('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb3c8('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb3c8('0x3')]},'agentacw':{'type':Sequelize[_0xb3c8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb3c8('0x1')]},'channelstate':{'type':Sequelize[_0xb3c8('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb3c8('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb3c8('0x1')]},'language':{'type':Sequelize[_0xb3c8('0x1')]},'accountcode':{'type':Sequelize[_0xb3c8('0x1')]},'context':{'type':Sequelize[_0xb3c8('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb3c8('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb3c8('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb3c8('0x1')]},'destcalleridname':{'type':Sequelize[_0xb3c8('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb3c8('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xb3c8('0x1')]},'destcontext':{'type':Sequelize[_0xb3c8('0x1')]},'destexten':{'type':Sequelize[_0xb3c8('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb3c8('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb3c8('0x1')]},'transfer':{'type':Sequelize[_0xb3c8('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb3c8('0x5')},'transferexten':{'type':Sequelize[_0xb3c8('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb3c8('0x1')]},'agententerreason':{'type':Sequelize[_0xb3c8('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 85b166e..c1b3fb7 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(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 a5ec42a..438e887 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 _0x8c46=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api','request-promise'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8c46,0x171));var _0x68c4=function(_0x50769b,_0x1428ce){_0x50769b=_0x50769b-0x0;var _0x144202=_0x8c46[_0x50769b];return _0x144202;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x68c4('0xa'),_0x68c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['request-promise','rimraf','../../config/environment','exports','define','uniqueid','destuniqueid','lodash','util','api','moment','bluebird'];(function(_0x2a9111,_0x544162){var _0x337760=function(_0xb23e9c){while(--_0xb23e9c){_0x2a9111['push'](_0x2a9111['shift']());}};_0x337760(++_0x544162);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4d34fd,_0x5a65d4){_0x4d34fd=_0x4d34fd-0x0;var _0x16e404=_0x9c5a[_0x4d34fd];return _0x16e404;};'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('./voiceAgentReport.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xa9c5('0xa'),_0xa9c5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 847faf9..89b2f1c 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 _0x50b5=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','VoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring'];(function(_0x4d86d3,_0x2e9f10){var _0x81b4c0=function(_0x5b6e60){while(--_0x5b6e60){_0x4d86d3['push'](_0x4d86d3['shift']());}};_0x81b4c0(++_0x2e9f10);}(_0x50b5,0x150));var _0x550b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x50b5[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x550b('0x0'));var util=require(_0x550b('0x1'));var moment=require(_0x550b('0x2'));var BPromise=require('bluebird');var rs=require(_0x550b('0x3'));var fs=require('fs');var Redis=require(_0x550b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x550b('0x5'));var logger=require(_0x550b('0x6'))(_0x550b('0x7'));var config=require(_0x550b('0x8'));var jayson=require(_0x550b('0x9'));var client=jayson[_0x550b('0xa')][_0x550b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x346ab7,_0x47bd82,_0x2b4f6c){return new BPromise(function(_0x14ff30,_0x33ad41){return client['request'](_0x346ab7,_0x2b4f6c)[_0x550b('0xc')](function(_0x32fcd9){logger[_0x550b('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x47bd82,_0x550b('0xe'));logger[_0x550b('0xf')](_0x550b('0x10'),_0x47bd82,'request\x20sent',JSON[_0x550b('0x11')](_0x32fcd9));if(_0x32fcd9['error']){if(_0x32fcd9[_0x550b('0x12')]['code']===0x1f4){logger[_0x550b('0x12')](_0x550b('0x13'),_0x47bd82,_0x32fcd9['error'][_0x550b('0x14')]);return _0x33ad41(_0x32fcd9[_0x550b('0x12')][_0x550b('0x14')]);}logger[_0x550b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x47bd82,_0x32fcd9['error'][_0x550b('0x14')]);return _0x14ff30(_0x32fcd9[_0x550b('0x12')][_0x550b('0x14')]);}else{logger['info'](_0x550b('0x13'),_0x47bd82,'request\x20sent');_0x14ff30(_0x32fcd9[_0x550b('0x15')][_0x550b('0x14')]);}})[_0x550b('0x16')](function(_0x1de8e4){logger[_0x550b('0x12')](_0x550b('0x13'),_0x47bd82,_0x1de8e4);_0x33ad41(_0x1de8e4);});});}exports[_0x550b('0x17')]=function(_0x430894){var _0x28d38e=this;return new Promise(function(_0x4f1eba,_0x1087d7){return db['VoiceAgentReport'][_0x550b('0x18')](_0x430894[_0x550b('0x19')],{'raw':_0x430894[_0x550b('0x1a')]?_0x430894[_0x550b('0x1a')][_0x550b('0x1b')]===undefined?!![]:![]:!![]})[_0x550b('0xc')](function(_0x305dbc){logger[_0x550b('0xd')](_0x550b('0x17'),_0x430894);logger[_0x550b('0xf')](_0x550b('0x17'),_0x430894,JSON[_0x550b('0x11')](_0x305dbc));_0x4f1eba(_0x305dbc);})['catch'](function(_0x3e8aba){logger[_0x550b('0x12')]('CreateVoiceAgentReport',_0x3e8aba[_0x550b('0x14')],_0x430894);_0x1087d7(_0x28d38e['error'](0x1f4,_0x3e8aba[_0x550b('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3e8788){var _0x29b915=this;return new Promise(function(_0x47ca4a,_0x23efed){return db[_0x550b('0x1c')][_0x550b('0x1d')](_0x3e8788[_0x550b('0x19')],{'raw':_0x3e8788[_0x550b('0x1a')]?_0x3e8788['options'][_0x550b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e8788['options']?_0x3e8788[_0x550b('0x1a')][_0x550b('0x1e')]||null:null,'attributes':_0x3e8788['options']?_0x3e8788['options'][_0x550b('0x1f')]||null:null,'limit':_0x3e8788[_0x550b('0x1a')]?_0x3e8788[_0x550b('0x1a')][_0x550b('0x20')]||null:null})[_0x550b('0xc')](function(_0x4c2cc3){logger[_0x550b('0xd')]('UpdateVoiceAgentReport',_0x3e8788);logger[_0x550b('0xf')](_0x550b('0x21'),_0x3e8788,JSON[_0x550b('0x11')](_0x4c2cc3));_0x47ca4a(_0x4c2cc3);})[_0x550b('0x16')](function(_0x1029c8){logger[_0x550b('0x12')](_0x550b('0x21'),_0x1029c8[_0x550b('0x14')],_0x3e8788);_0x23efed(_0x29b915['error'](0x1f4,_0x1029c8[_0x550b('0x14')]));});});}; \ No newline at end of file +var _0x8e0a=['client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x4f73a0,_0xad6e0a){var _0x1dab98=function(_0x9e43dc){while(--_0x9e43dc){_0x4f73a0['push'](_0x4f73a0['shift']());}};_0x1dab98(++_0xad6e0a);}(_0x8e0a,0x198));var _0xa8e0=function(_0x5afd65,_0x4102b3){_0x5afd65=_0x5afd65-0x0;var _0x2640c9=_0x8e0a[_0x5afd65];return _0x2640c9;};'use strict';var _=require(_0xa8e0('0x0'));var util=require(_0xa8e0('0x1'));var moment=require(_0xa8e0('0x2'));var BPromise=require(_0xa8e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa8e0('0x5'))(_0xa8e0('0x6'));var config=require('../../config/environment');var jayson=require(_0xa8e0('0x7'));var client=jayson[_0xa8e0('0x8')][_0xa8e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18f414,_0x380729,_0x233d40){return new BPromise(function(_0x298ab5,_0x230d2e){return client[_0xa8e0('0xa')](_0x18f414,_0x233d40)['then'](function(_0x1a6416){logger[_0xa8e0('0xb')](_0xa8e0('0xc'),_0x380729,_0xa8e0('0xd'));logger[_0xa8e0('0xe')](_0xa8e0('0xf'),_0x380729,_0xa8e0('0xd'),JSON[_0xa8e0('0x10')](_0x1a6416));if(_0x1a6416['error']){if(_0x1a6416['error'][_0xa8e0('0x11')]===0x1f4){logger[_0xa8e0('0x12')](_0xa8e0('0xc'),_0x380729,_0x1a6416['error'][_0xa8e0('0x13')]);return _0x230d2e(_0x1a6416[_0xa8e0('0x12')][_0xa8e0('0x13')]);}logger[_0xa8e0('0x12')](_0xa8e0('0xc'),_0x380729,_0x1a6416['error'][_0xa8e0('0x13')]);return _0x298ab5(_0x1a6416[_0xa8e0('0x12')]['message']);}else{logger[_0xa8e0('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x380729,_0xa8e0('0xd'));_0x298ab5(_0x1a6416['result']['message']);}})[_0xa8e0('0x14')](function(_0x31b110){logger[_0xa8e0('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x380729,_0x31b110);_0x230d2e(_0x31b110);});});}exports[_0xa8e0('0x15')]=function(_0x58797f){var _0x179efa=this;return new Promise(function(_0x1ff00b,_0x54628d){return db[_0xa8e0('0x16')][_0xa8e0('0x17')](_0x58797f[_0xa8e0('0x18')],{'raw':_0x58797f[_0xa8e0('0x19')]?_0x58797f['options'][_0xa8e0('0x1a')]===undefined?!![]:![]:!![]})[_0xa8e0('0x1b')](function(_0x7136f){logger[_0xa8e0('0xb')](_0xa8e0('0x15'),_0x58797f);logger['debug'](_0xa8e0('0x15'),_0x58797f,JSON[_0xa8e0('0x10')](_0x7136f));_0x1ff00b(_0x7136f);})[_0xa8e0('0x14')](function(_0x26705d){logger[_0xa8e0('0x12')]('CreateVoiceAgentReport',_0x26705d[_0xa8e0('0x13')],_0x58797f);_0x54628d(_0x179efa[_0xa8e0('0x12')](0x1f4,_0x26705d[_0xa8e0('0x13')]));});});};exports[_0xa8e0('0x1c')]=function(_0x325123){var _0x17cd54=this;return new Promise(function(_0x1abba7,_0x2a7e3d){return db['VoiceAgentReport'][_0xa8e0('0x1d')](_0x325123[_0xa8e0('0x18')],{'raw':_0x325123['options']?_0x325123[_0xa8e0('0x19')][_0xa8e0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325123['options']?_0x325123[_0xa8e0('0x19')][_0xa8e0('0x1e')]||null:null,'attributes':_0x325123[_0xa8e0('0x19')]?_0x325123[_0xa8e0('0x19')][_0xa8e0('0x1f')]||null:null,'limit':_0x325123['options']?_0x325123[_0xa8e0('0x19')]['limit']||null:null})[_0xa8e0('0x1b')](function(_0x44c640){logger['info'](_0xa8e0('0x1c'),_0x325123);logger[_0xa8e0('0xe')](_0xa8e0('0x1c'),_0x325123,JSON[_0xa8e0('0x10')](_0x44c640));_0x1abba7(_0x44c640);})[_0xa8e0('0x14')](function(_0x4b4b0e){logger[_0xa8e0('0x12')](_0xa8e0('0x1c'),_0x4b4b0e[_0xa8e0('0x13')],_0x325123);_0x2a7e3d(_0x17cd54[_0xa8e0('0x12')](0x1f4,_0x4b4b0e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5c145b2..e9c7263 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 _0x200e=['exports','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','/with-retry/:id','updateWithRetry','destroy'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0x200e,0x181));var _0xe200=function(_0x43d4a8,_0x4256ad){_0x43d4a8=_0x43d4a8-0x0;var _0x293b96=_0x200e[_0x43d4a8];return _0x293b96;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe200('0x0'));var controller=require(_0xe200('0x1'));router[_0xe200('0x2')]('/',auth[_0xe200('0x3')](),controller['index']);router[_0xe200('0x2')](_0xe200('0x4'),auth[_0xe200('0x3')](),controller[_0xe200('0x5')]);router[_0xe200('0x2')](_0xe200('0x6'),auth['isAuthenticated'](),controller[_0xe200('0x7')]);router[_0xe200('0x8')]('/',auth['isAuthenticated'](),controller[_0xe200('0x9')]);router[_0xe200('0xa')](_0xe200('0x6'),auth[_0xe200('0x3')](),controller[_0xe200('0xb')]);router[_0xe200('0xa')](_0xe200('0xc'),auth[_0xe200('0x3')](),controller[_0xe200('0xd')]);router['delete'](_0xe200('0x6'),auth[_0xe200('0x3')](),controller[_0xe200('0xe')]);module[_0xe200('0xf')]=router; \ No newline at end of file +var _0xa72c=['updateWithRetry','delete','destroy','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','describe','post','create','put','/:id','/with-retry/:id'];(function(_0x3bc298,_0x583d14){var _0x31bf58=function(_0x24563b){while(--_0x24563b){_0x3bc298['push'](_0x3bc298['shift']());}};_0x31bf58(++_0x583d14);}(_0xa72c,0x1d3));var _0xca72=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xa72c[_0x24061a];return _0x82054e;};'use strict';var express=require(_0xca72('0x0'));var router=express[_0xca72('0x1')]();var auth=require(_0xca72('0x2'));var controller=require(_0xca72('0x3'));router[_0xca72('0x4')]('/',auth[_0xca72('0x5')](),controller[_0xca72('0x6')]);router[_0xca72('0x4')]('/describe',auth[_0xca72('0x5')](),controller[_0xca72('0x7')]);router[_0xca72('0x4')]('/:id',auth[_0xca72('0x5')](),controller['show']);router[_0xca72('0x8')]('/',auth[_0xca72('0x5')](),controller[_0xca72('0x9')]);router[_0xca72('0xa')](_0xca72('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xca72('0xa')](_0xca72('0xc'),auth[_0xca72('0x5')](),controller[_0xca72('0xd')]);router[_0xca72('0xe')]('/:id',auth[_0xca72('0x5')](),controller[_0xca72('0xf')]);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 0c6f9c2..1a54866 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 _0x439f=['INTEGER','sequelize','STRING','ENUM','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x439f,0x1c3));var _0xf439=function(_0x2250da,_0xdb9fe6){_0x2250da=_0x2250da-0x0;var _0x573dc5=_0x439f[_0x2250da];return _0x573dc5;};'use strict';var Sequelize=require(_0xf439('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf439('0x1')]},'type':{'type':Sequelize[_0xf439('0x2')]('inbound','internal',_0xf439('0x3'),_0xf439('0x4'),_0xf439('0x5'),_0xf439('0x6'))},'tag':{'type':Sequelize[_0xf439('0x1')]},'accountcode':{'type':Sequelize[_0xf439('0x1')]},'source':{'type':Sequelize[_0xf439('0x1')]},'destination':{'type':Sequelize[_0xf439('0x1')]},'destinationcontext':{'type':Sequelize[_0xf439('0x1')]},'callerid':{'type':Sequelize[_0xf439('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xf439('0x1')]},'lastapplication':{'type':Sequelize[_0xf439('0x1')]},'lastdata':{'type':Sequelize[_0xf439('0x7')]},'starttime':{'type':Sequelize[_0xf439('0x8')]},'systemanswertime':{'type':Sequelize[_0xf439('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf439('0x8')]},'duration':{'type':Sequelize[_0xf439('0x9')]},'billableseconds':{'type':Sequelize[_0xf439('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf439('0x1')]},'amaflags':{'type':Sequelize[_0xf439('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xf439('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xf439('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xf439('0x1')]},'note':{'type':Sequelize[_0xf439('0x1')]},'prefix':{'type':Sequelize[_0xf439('0x1')]},'routeid':{'type':Sequelize[_0xf439('0x9')]},'sipcallid':{'type':Sequelize[_0xf439('0x1')]}}; \ No newline at end of file +var _0x5c13=['internal','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x467f66,_0x2d90ef){var _0x599584=function(_0x487cb5){while(--_0x487cb5){_0x467f66['push'](_0x467f66['shift']());}};_0x599584(++_0x2d90ef);}(_0x5c13,0x103));var _0x35c1=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x5c13[_0x28d18d];return _0x470640;};'use strict';var Sequelize=require(_0x35c1('0x0'));module[_0x35c1('0x1')]={'uniqueid':{'type':Sequelize[_0x35c1('0x2')]},'type':{'type':Sequelize[_0x35c1('0x3')](_0x35c1('0x4'),_0x35c1('0x5'),'outbound',_0x35c1('0x6'),_0x35c1('0x7'),'dialer')},'tag':{'type':Sequelize[_0x35c1('0x2')]},'accountcode':{'type':Sequelize[_0x35c1('0x2')]},'source':{'type':Sequelize[_0x35c1('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x35c1('0x2')]},'callerid':{'type':Sequelize[_0x35c1('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x35c1('0x2')]},'lastdata':{'type':Sequelize[_0x35c1('0x8')]},'starttime':{'type':Sequelize[_0x35c1('0x9')]},'systemanswertime':{'type':Sequelize[_0x35c1('0x9')]},'answertime':{'type':Sequelize[_0x35c1('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x35c1('0xa')]},'billableseconds':{'type':Sequelize[_0x35c1('0xa')]},'mohtime':{'type':Sequelize[_0x35c1('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x35c1('0x2')]},'userDisposition':{'type':Sequelize[_0x35c1('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x35c1('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x35c1('0x2')]},'note':{'type':Sequelize[_0x35c1('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x35c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c437572..800d4c2 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 _0xd7d1=['VoiceCallReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','fullname','alias','User','rows','catch','show','params','include','find','destroy','describe','user','update','body','updateWithRetry','uniqueid','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','stack','name','index','map'];(function(_0x24b13c,_0x2568fc){var _0x5377f6=function(_0x3a4232){while(--_0x3a4232){_0x24b13c['push'](_0x24b13c['shift']());}};_0x5377f6(++_0x2568fc);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x12827d,_0x22da9a){_0x12827d=_0x12827d-0x0;var _0x14d08c=_0xd7d1[_0x12827d];return _0x14d08c;};'use strict';var _=require(_0x1d7d('0x0'));var qs=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var db=require(_0x1d7d('0x4'))['db'];const promiseRetry=require(_0x1d7d('0x5'));function respondWithResult(_0x222e84,_0x27b5d8){_0x27b5d8=_0x27b5d8||0xc8;return function(_0x1ac097){if(_0x1ac097){return _0x222e84[_0x1d7d('0x6')](_0x27b5d8)[_0x1d7d('0x7')](_0x1ac097);}};}function respondWithFilteredResult(_0x1a2564,_0x14b2b9){return function(_0x5a8cf3){if(_0x5a8cf3){var _0x462ef8=typeof _0x14b2b9[_0x1d7d('0x8')]===_0x1d7d('0x9')&&typeof _0x14b2b9[_0x1d7d('0xa')]===_0x1d7d('0x9');var _0x268732=_0x5a8cf3[_0x1d7d('0xb')];var _0xa44223=_0x462ef8?0x0:_0x14b2b9[_0x1d7d('0x8')];var _0x8b258b=_0x462ef8?_0x5a8cf3[_0x1d7d('0xb')]:_0x14b2b9['offset']+_0x14b2b9[_0x1d7d('0xa')];var _0x4c6809;if(_0x8b258b>=_0x268732){_0x8b258b=_0x268732;_0x4c6809=0xc8;}else{_0x4c6809=0xce;}_0x1a2564[_0x1d7d('0x6')](_0x4c6809);return _0x1a2564[_0x1d7d('0xc')](_0x1d7d('0xd'),_0xa44223+'-'+_0x8b258b+'/'+_0x268732)[_0x1d7d('0x7')](_0x5a8cf3);}return null;};}function saveUpdates(_0x5c7445){return function(_0x11b83f){if(_0x11b83f){return _0x11b83f['update'](_0x5c7445)['then'](function(_0x19e6bc){return _0x19e6bc;});}return null;};}function removeEntity(_0x4049be){return function(_0x5dd438){if(_0x5dd438){return _0x5dd438['destroy']()[_0x1d7d('0xe')](function(){_0x4049be[_0x1d7d('0x6')](0xcc)[_0x1d7d('0xf')]();});}};}function handleEntityNotFound(_0x183fc6){return function(_0xeb05b3){if(!_0xeb05b3){_0x183fc6['sendStatus'](0x194);}return _0xeb05b3;};}function handleError(_0x28adf3,_0x1de6cc){_0x1de6cc=_0x1de6cc||0x1f4;return function(_0x51cbca){logger[_0x1d7d('0x10')](_0x51cbca[_0x1d7d('0x11')]);if(_0x51cbca[_0x1d7d('0x12')]){delete _0x51cbca[_0x1d7d('0x12')];}_0x28adf3[_0x1d7d('0x6')](_0x1de6cc)['send'](_0x51cbca);};}exports[_0x1d7d('0x13')]=function(_0x191024,_0x5cbb8f){var _0x495212={},_0x2406dd={},_0x1a5101={'count':0x0,'rows':[]};var _0x2a9f2b=_[_0x1d7d('0x14')](db[_0x1d7d('0x15')][_0x1d7d('0x16')],function(_0x54d401){return{'name':_0x54d401[_0x1d7d('0x17')],'type':_0x54d401[_0x1d7d('0x18')][_0x1d7d('0x19')]};});_0x2406dd['model']=_[_0x1d7d('0x14')](_0x2a9f2b,_0x1d7d('0x12'));_0x2406dd['query']=_['keys'](_0x191024[_0x1d7d('0x1a')]);_0x2406dd[_0x1d7d('0x1b')]=_[_0x1d7d('0x1c')](_0x2406dd['model'],_0x2406dd[_0x1d7d('0x1a')]);_0x495212[_0x1d7d('0x1d')]=_[_0x1d7d('0x1c')](_0x2406dd[_0x1d7d('0x1e')],qs['fields'](_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x1f')]));_0x495212['attributes']=_0x495212['attributes'][_0x1d7d('0x20')]?_0x495212['attributes']:_0x2406dd[_0x1d7d('0x1e')];if(!_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x21')](_0x1d7d('0x22'))){_0x495212[_0x1d7d('0xa')]=qs['limit'](_0x191024[_0x1d7d('0x1a')][_0x1d7d('0xa')]);_0x495212[_0x1d7d('0x8')]=qs['offset'](_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x8')]);}_0x495212[_0x1d7d('0x23')]=qs['sort'](_0x191024['query']['sort']);_0x495212[_0x1d7d('0x24')]=qs[_0x1d7d('0x1b')](_['pick'](_0x191024[_0x1d7d('0x1a')],_0x2406dd[_0x1d7d('0x1b')]),_0x2a9f2b);if(_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x25')]){_0x495212[_0x1d7d('0x24')]=_[_0x1d7d('0x26')](_0x495212[_0x1d7d('0x24')],{'$or':_[_0x1d7d('0x14')](_0x2a9f2b,function(_0xd701e1){if(_0xd701e1[_0x1d7d('0x18')]!=='VIRTUAL'){var _0x57c22e={};_0x57c22e[_0xd701e1[_0x1d7d('0x12')]]={'$like':'%'+_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x25')]+'%'};return _0x57c22e;}})});}_0x495212=_[_0x1d7d('0x26')]({},_0x495212,_0x191024[_0x1d7d('0x27')]);var _0x16d652={'where':_0x495212[_0x1d7d('0x24')]};return db[_0x1d7d('0x15')][_0x1d7d('0xb')](_0x16d652)['then'](function(_0x2ac533){_0x1a5101[_0x1d7d('0xb')]=_0x2ac533;if(_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x28')]){_0x495212['include']=[{'attributes':['id','name',_0x1d7d('0x29'),_0x1d7d('0x2a')],'model':db['User'],'as':_0x1d7d('0x2b')}];}return db[_0x1d7d('0x15')]['findAll'](_0x495212);})['then'](function(_0x26f81c){_0x1a5101[_0x1d7d('0x2c')]=_0x26f81c;return _0x1a5101;})[_0x1d7d('0xe')](respondWithFilteredResult(_0x5cbb8f,_0x495212))[_0x1d7d('0x2d')](handleError(_0x5cbb8f,null));};exports[_0x1d7d('0x2e')]=function(_0x3427eb,_0x46c796){var _0x37d003={'raw':!![],'where':{'id':_0x3427eb[_0x1d7d('0x2f')]['id']}},_0x405125={};_0x405125['model']=_['keys'](db['VoiceCallReport']['rawAttributes']);_0x405125[_0x1d7d('0x1a')]=_['keys'](_0x3427eb[_0x1d7d('0x1a')]);_0x405125[_0x1d7d('0x1b')]=_[_0x1d7d('0x1c')](_0x405125['model'],_0x405125[_0x1d7d('0x1a')]);_0x37d003[_0x1d7d('0x1d')]=_[_0x1d7d('0x1c')](_0x405125['model'],qs[_0x1d7d('0x1f')](_0x3427eb[_0x1d7d('0x1a')][_0x1d7d('0x1f')]));_0x37d003[_0x1d7d('0x1d')]=_0x37d003['attributes'][_0x1d7d('0x20')]?_0x37d003[_0x1d7d('0x1d')]:_0x405125[_0x1d7d('0x1e')];if(_0x3427eb[_0x1d7d('0x1a')]['includeAll']){_0x37d003[_0x1d7d('0x30')]=[{'all':!![]}];}_0x37d003=_['merge']({},_0x37d003,_0x3427eb[_0x1d7d('0x27')]);return db[_0x1d7d('0x15')][_0x1d7d('0x31')](_0x37d003)[_0x1d7d('0xe')](handleEntityNotFound(_0x46c796,null))[_0x1d7d('0xe')](respondWithResult(_0x46c796,null))['catch'](handleError(_0x46c796,null));};exports['create']=function(_0x33582a,_0xe57fa5){return db[_0x1d7d('0x15')]['create'](_0x33582a['body'],{})[_0x1d7d('0xe')](respondWithResult(_0xe57fa5,0xc9))['catch'](handleError(_0xe57fa5,null));};exports[_0x1d7d('0x32')]=function(_0x379e75,_0x1d1064){return db[_0x1d7d('0x15')][_0x1d7d('0x31')]({'where':{'id':_0x379e75[_0x1d7d('0x2f')]['id']}})[_0x1d7d('0xe')](handleEntityNotFound(_0x1d1064,null))['then'](removeEntity(_0x1d1064,null))[_0x1d7d('0x2d')](handleError(_0x1d1064,null));};exports[_0x1d7d('0x33')]=function(_0x49de57,_0x17c68b){return db[_0x1d7d('0x15')][_0x1d7d('0x33')]()[_0x1d7d('0xe')](respondWithResult(_0x17c68b,null))[_0x1d7d('0x2d')](handleError(_0x17c68b,null));};function findForUpdate(_0x464fb9){return db[_0x1d7d('0x15')][_0x1d7d('0x31')]({'where':{'uniqueid':_0x464fb9[_0x1d7d('0x2f')]['id'],'UserId':{'$or':[null,_0x464fb9[_0x1d7d('0x34')]['id']]}}});}exports[_0x1d7d('0x35')]=function(_0x13fca1,_0x52149b){if(_0x13fca1[_0x1d7d('0x36')]['uniqueid']){delete _0x13fca1[_0x1d7d('0x36')]['uniqueid'];}return findForUpdate(_0x13fca1)[_0x1d7d('0xe')](handleEntityNotFound(_0x52149b,null))[_0x1d7d('0xe')](saveUpdates(_0x13fca1[_0x1d7d('0x36')],null))[_0x1d7d('0xe')](respondWithResult(_0x52149b,null))['catch'](handleError(_0x52149b,null));};exports[_0x1d7d('0x37')]=function(_0x5535d4,_0x48cfe3,_0x3b47e1){if(_0x5535d4['body']['uniqueid']){delete _0x5535d4[_0x1d7d('0x36')][_0x1d7d('0x38')];}promiseRetry(function(_0x506564){return findForUpdate(_0x5535d4)[_0x1d7d('0xe')](function(_0x1383f9){if(_0x1383f9!==null){return _0x1383f9;}else{_0x506564(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x1d7d('0xe')](function(_0x2b9faa){if(!_0x2b9faa){return new Promise(function(_0xa64dbe){_0xa64dbe(handleEntityNotFound(_0x48cfe3)());});}else{return _0x2b9faa[_0x1d7d('0x35')](_0x5535d4['body'])['then'](function(_0x3f73eb){return respondWithResult(_0x48cfe3)(_0x3f73eb);});}},function(){handleEntityNotFound(_0x48cfe3)();});}; \ No newline at end of file +var _0x1c77=['update','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','status','json','undefined','limit','count','offset','Content-Range','then','destroy','sendStatus','error','stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','fullname','alias','User','rows','show','params','options','find','create','catch','describe','user','body','uniqueid','updateWithRetry','No\x20such\x20report'];(function(_0x5ca123,_0x4d9ed7){var _0x131a48=function(_0x1cce73){while(--_0x1cce73){_0x5ca123['push'](_0x5ca123['shift']());}};_0x131a48(++_0x4d9ed7);}(_0x1c77,0xed));var _0x71c7=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1c77[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var qs=require(_0x71c7('0x0'));var logger=require(_0x71c7('0x1'))(_0x71c7('0x2'));var db=require(_0x71c7('0x3'))['db'];const promiseRetry=require(_0x71c7('0x4'));function respondWithResult(_0x58a925,_0x29ab58){_0x29ab58=_0x29ab58||0xc8;return function(_0x37620a){if(_0x37620a){return _0x58a925[_0x71c7('0x5')](_0x29ab58)[_0x71c7('0x6')](_0x37620a);}};}function respondWithFilteredResult(_0x439807,_0x1ee344){return function(_0x2fb422){if(_0x2fb422){var _0x57fb10=typeof _0x1ee344['offset']===_0x71c7('0x7')&&typeof _0x1ee344[_0x71c7('0x8')]===_0x71c7('0x7');var _0x471bc6=_0x2fb422['count'];var _0x1f5fc9=_0x57fb10?0x0:_0x1ee344['offset'];var _0x51ac99=_0x57fb10?_0x2fb422[_0x71c7('0x9')]:_0x1ee344[_0x71c7('0xa')]+_0x1ee344[_0x71c7('0x8')];var _0x22147c;if(_0x51ac99>=_0x471bc6){_0x51ac99=_0x471bc6;_0x22147c=0xc8;}else{_0x22147c=0xce;}_0x439807[_0x71c7('0x5')](_0x22147c);return _0x439807['set'](_0x71c7('0xb'),_0x1f5fc9+'-'+_0x51ac99+'/'+_0x471bc6)[_0x71c7('0x6')](_0x2fb422);}return null;};}function saveUpdates(_0x389fd0){return function(_0x338028){if(_0x338028){return _0x338028['update'](_0x389fd0)[_0x71c7('0xc')](function(_0xaaa8ba){return _0xaaa8ba;});}return null;};}function removeEntity(_0x608fe){return function(_0x3d216e){if(_0x3d216e){return _0x3d216e[_0x71c7('0xd')]()[_0x71c7('0xc')](function(){_0x608fe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5493fc){return function(_0x26dfa3){if(!_0x26dfa3){_0x5493fc[_0x71c7('0xe')](0x194);}return _0x26dfa3;};}function handleError(_0x355b10,_0x1e3266){_0x1e3266=_0x1e3266||0x1f4;return function(_0x11403b){logger[_0x71c7('0xf')](_0x11403b[_0x71c7('0x10')]);if(_0x11403b['name']){delete _0x11403b[_0x71c7('0x11')];}_0x355b10[_0x71c7('0x5')](_0x1e3266)[_0x71c7('0x12')](_0x11403b);};}exports[_0x71c7('0x13')]=function(_0x19001c,_0x55f9f9){var _0x5596f7={},_0xbe59dc={},_0x1c2fc7={'count':0x0,'rows':[]};var _0x48e8e5=_['map'](db[_0x71c7('0x14')][_0x71c7('0x15')],function(_0x3ba31b){return{'name':_0x3ba31b[_0x71c7('0x16')],'type':_0x3ba31b[_0x71c7('0x17')][_0x71c7('0x18')]};});_0xbe59dc[_0x71c7('0x19')]=_['map'](_0x48e8e5,'name');_0xbe59dc[_0x71c7('0x1a')]=_[_0x71c7('0x1b')](_0x19001c[_0x71c7('0x1a')]);_0xbe59dc[_0x71c7('0x1c')]=_[_0x71c7('0x1d')](_0xbe59dc[_0x71c7('0x19')],_0xbe59dc[_0x71c7('0x1a')]);_0x5596f7[_0x71c7('0x1e')]=_[_0x71c7('0x1d')](_0xbe59dc[_0x71c7('0x19')],qs[_0x71c7('0x1f')](_0x19001c[_0x71c7('0x1a')][_0x71c7('0x1f')]));_0x5596f7[_0x71c7('0x1e')]=_0x5596f7['attributes'][_0x71c7('0x20')]?_0x5596f7['attributes']:_0xbe59dc[_0x71c7('0x19')];if(!_0x19001c[_0x71c7('0x1a')][_0x71c7('0x21')]('nolimit')){_0x5596f7['limit']=qs[_0x71c7('0x8')](_0x19001c[_0x71c7('0x1a')][_0x71c7('0x8')]);_0x5596f7[_0x71c7('0xa')]=qs[_0x71c7('0xa')](_0x19001c[_0x71c7('0x1a')][_0x71c7('0xa')]);}_0x5596f7['order']=qs[_0x71c7('0x22')](_0x19001c[_0x71c7('0x1a')]['sort']);_0x5596f7[_0x71c7('0x23')]=qs[_0x71c7('0x1c')](_[_0x71c7('0x24')](_0x19001c['query'],_0xbe59dc[_0x71c7('0x1c')]),_0x48e8e5);if(_0x19001c[_0x71c7('0x1a')][_0x71c7('0x25')]){_0x5596f7[_0x71c7('0x23')]=_[_0x71c7('0x26')](_0x5596f7[_0x71c7('0x23')],{'$or':_['map'](_0x48e8e5,function(_0x3727ba){if(_0x3727ba[_0x71c7('0x17')]!==_0x71c7('0x27')){var _0x38dfcb={};_0x38dfcb[_0x3727ba[_0x71c7('0x11')]]={'$like':'%'+_0x19001c[_0x71c7('0x1a')][_0x71c7('0x25')]+'%'};return _0x38dfcb;}})});}_0x5596f7=_[_0x71c7('0x26')]({},_0x5596f7,_0x19001c['options']);var _0x1024e9={'where':_0x5596f7['where']};return db[_0x71c7('0x14')][_0x71c7('0x9')](_0x1024e9)[_0x71c7('0xc')](function(_0x3265d5){_0x1c2fc7[_0x71c7('0x9')]=_0x3265d5;if(_0x19001c[_0x71c7('0x1a')][_0x71c7('0x28')]){_0x5596f7[_0x71c7('0x29')]=[{'attributes':['id',_0x71c7('0x11'),_0x71c7('0x2a'),_0x71c7('0x2b')],'model':db[_0x71c7('0x2c')],'as':'User'}];}return db['VoiceCallReport']['findAll'](_0x5596f7);})[_0x71c7('0xc')](function(_0x49da5d){_0x1c2fc7[_0x71c7('0x2d')]=_0x49da5d;return _0x1c2fc7;})[_0x71c7('0xc')](respondWithFilteredResult(_0x55f9f9,_0x5596f7))['catch'](handleError(_0x55f9f9,null));};exports[_0x71c7('0x2e')]=function(_0x1829d6,_0x19c54e){var _0x544e8b={'raw':!![],'where':{'id':_0x1829d6[_0x71c7('0x2f')]['id']}},_0x2156e1={};_0x2156e1[_0x71c7('0x19')]=_[_0x71c7('0x1b')](db[_0x71c7('0x14')][_0x71c7('0x15')]);_0x2156e1[_0x71c7('0x1a')]=_[_0x71c7('0x1b')](_0x1829d6[_0x71c7('0x1a')]);_0x2156e1['filters']=_['intersection'](_0x2156e1[_0x71c7('0x19')],_0x2156e1[_0x71c7('0x1a')]);_0x544e8b[_0x71c7('0x1e')]=_['intersection'](_0x2156e1[_0x71c7('0x19')],qs[_0x71c7('0x1f')](_0x1829d6[_0x71c7('0x1a')][_0x71c7('0x1f')]));_0x544e8b[_0x71c7('0x1e')]=_0x544e8b[_0x71c7('0x1e')]['length']?_0x544e8b[_0x71c7('0x1e')]:_0x2156e1[_0x71c7('0x19')];if(_0x1829d6[_0x71c7('0x1a')]['includeAll']){_0x544e8b[_0x71c7('0x29')]=[{'all':!![]}];}_0x544e8b=_['merge']({},_0x544e8b,_0x1829d6[_0x71c7('0x30')]);return db[_0x71c7('0x14')][_0x71c7('0x31')](_0x544e8b)['then'](handleEntityNotFound(_0x19c54e,null))[_0x71c7('0xc')](respondWithResult(_0x19c54e,null))['catch'](handleError(_0x19c54e,null));};exports[_0x71c7('0x32')]=function(_0x4b000f,_0x13bc6a){return db[_0x71c7('0x14')][_0x71c7('0x32')](_0x4b000f['body'],{})['then'](respondWithResult(_0x13bc6a,0xc9))[_0x71c7('0x33')](handleError(_0x13bc6a,null));};exports[_0x71c7('0xd')]=function(_0x18779f,_0x5d457a){return db[_0x71c7('0x14')]['find']({'where':{'id':_0x18779f[_0x71c7('0x2f')]['id']}})[_0x71c7('0xc')](handleEntityNotFound(_0x5d457a,null))['then'](removeEntity(_0x5d457a,null))[_0x71c7('0x33')](handleError(_0x5d457a,null));};exports[_0x71c7('0x34')]=function(_0x1289af,_0x3c4782){return db[_0x71c7('0x14')]['describe']()[_0x71c7('0xc')](respondWithResult(_0x3c4782,null))[_0x71c7('0x33')](handleError(_0x3c4782,null));};function findForUpdate(_0x2b0b84){return db['VoiceCallReport'][_0x71c7('0x31')]({'where':{'uniqueid':_0x2b0b84[_0x71c7('0x2f')]['id'],'UserId':{'$or':[null,_0x2b0b84[_0x71c7('0x35')]['id']]}}});}exports['update']=function(_0x3e8bba,_0x5241e1){if(_0x3e8bba[_0x71c7('0x36')][_0x71c7('0x37')]){delete _0x3e8bba[_0x71c7('0x36')][_0x71c7('0x37')];}return findForUpdate(_0x3e8bba)[_0x71c7('0xc')](handleEntityNotFound(_0x5241e1,null))[_0x71c7('0xc')](saveUpdates(_0x3e8bba[_0x71c7('0x36')],null))['then'](respondWithResult(_0x5241e1,null))[_0x71c7('0x33')](handleError(_0x5241e1,null));};exports[_0x71c7('0x38')]=function(_0x5728a3,_0x8735c,_0x2aa2cd){if(_0x5728a3[_0x71c7('0x36')][_0x71c7('0x37')]){delete _0x5728a3['body']['uniqueid'];}promiseRetry(function(_0x49ea38){return findForUpdate(_0x5728a3)[_0x71c7('0xc')](function(_0x5a7f01){if(_0x5a7f01!==null){return _0x5a7f01;}else{_0x49ea38(new Error(_0x71c7('0x39')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x1b8025){if(!_0x1b8025){return new Promise(function(_0x30e40a){_0x30e40a(handleEntityNotFound(_0x8735c)());});}else{return _0x1b8025[_0x71c7('0x3a')](_0x5728a3[_0x71c7('0x36')])['then'](function(_0x536534){return respondWithResult(_0x8735c)(_0x536534);});}},function(){handleEntityNotFound(_0x8735c)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e8ee89d..108688e 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 _0x1333=['api','bluebird','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x3a2d01,_0x441012){var _0x1f4816=function(_0x314a40){while(--_0x314a40){_0x3a2d01['push'](_0x3a2d01['shift']());}};_0x1f4816(++_0x441012);}(_0x1333,0x112));var _0x3133=function(_0x2d31bb,_0x155b01){_0x2d31bb=_0x2d31bb-0x0;var _0x1e7425=_0x1333[_0x2d31bb];return _0x1e7425;};'use strict';var _=require(_0x3133('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3133('0x1'));var moment=require('moment');var BPromise=require(_0x3133('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3133('0x3'));var rimraf=require(_0x3133('0x4'));var config=require('../../config/environment');var attributes=require(_0x3133('0x5'));module[_0x3133('0x6')]=function(_0x31d610,_0xda2a3c){return _0x31d610[_0x3133('0x7')](_0x3133('0x8'),attributes,{'tableName':_0x3133('0x9'),'paranoid':![],'indexes':[{'fields':[_0x3133('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc098=['util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x41cc84,_0x520547){var _0x1cb999=function(_0x547de0){while(--_0x547de0){_0x41cc84['push'](_0x41cc84['shift']());}};_0x1cb999(++_0x520547);}(_0xc098,0x12a));var _0x8c09=function(_0x14dc3e,_0x31715b){_0x14dc3e=_0x14dc3e-0x0;var _0x274f9e=_0xc098[_0x14dc3e];return _0x274f9e;};'use strict';var _=require(_0x8c09('0x0'));var util=require(_0x8c09('0x1'));var logger=require(_0x8c09('0x2'))(_0x8c09('0x3'));var moment=require(_0x8c09('0x4'));var BPromise=require(_0x8c09('0x5'));var rp=require(_0x8c09('0x6'));var fs=require('fs');var path=require(_0x8c09('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8c09('0x8'));module['exports']=function(_0x5015cf,_0x4d8981){return _0x5015cf[_0x8c09('0x9')](_0x8c09('0xa'),attributes,{'tableName':_0x8c09('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8c09('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 13b97ac..a8f94eb 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 _0x058a=['then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0xee7ed1,_0x19ccc1){var _0x342949=function(_0x2189fe){while(--_0x2189fe){_0xee7ed1['push'](_0xee7ed1['shift']());}};_0x342949(++_0x19ccc1);}(_0x058a,0x68));var _0xa058=function(_0x897c62,_0x3472d6){_0x897c62=_0x897c62-0x0;var _0x133bc9=_0x058a[_0x897c62];return _0x133bc9;};'use strict';var _=require(_0xa058('0x0'));var util=require(_0xa058('0x1'));var moment=require(_0xa058('0x2'));var BPromise=require(_0xa058('0x3'));var rs=require(_0xa058('0x4'));var fs=require('fs');var Redis=require(_0xa058('0x5'));var db=require(_0xa058('0x6'))['db'];var utils=require(_0xa058('0x7'));var logger=require(_0xa058('0x8'))('rpc');var config=require(_0xa058('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa058('0xa')][_0xa058('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f7ad5,_0x3d87d4,_0x58d948){return new BPromise(function(_0x26d62d,_0x384be4){return client[_0xa058('0xc')](_0x4f7ad5,_0x58d948)[_0xa058('0xd')](function(_0x40d2d5){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0xa058('0xe'));logger[_0xa058('0xf')](_0xa058('0x10'),_0x3d87d4,_0xa058('0xe'),JSON[_0xa058('0x11')](_0x40d2d5));if(_0x40d2d5[_0xa058('0x12')]){if(_0x40d2d5[_0xa058('0x12')]['code']===0x1f4){logger['error'](_0xa058('0x13'),_0x3d87d4,_0x40d2d5[_0xa058('0x12')]['message']);return _0x384be4(_0x40d2d5[_0xa058('0x12')]['message']);}logger[_0xa058('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0x40d2d5[_0xa058('0x12')][_0xa058('0x14')]);return _0x26d62d(_0x40d2d5[_0xa058('0x12')][_0xa058('0x14')]);}else{logger[_0xa058('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0xa058('0xe'));_0x26d62d(_0x40d2d5[_0xa058('0x16')][_0xa058('0x14')]);}})[_0xa058('0x17')](function(_0x26bda8){logger[_0xa058('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0x26bda8);_0x384be4(_0x26bda8);});});}exports[_0xa058('0x18')]=function(_0x4a6c6a){var _0x22acb9=this;return new Promise(function(_0x3a603a,_0x20295d){return db['VoiceCallReport'][_0xa058('0x19')]({'raw':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a[_0xa058('0x1a')][_0xa058('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a['options'][_0xa058('0x1c')]||null:null,'attributes':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a[_0xa058('0x1a')][_0xa058('0x1d')]||null:null,'limit':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a['options'][_0xa058('0x1e')]||null:null,'include':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a['options'][_0xa058('0x1f')]?_[_0xa058('0x20')](_0x4a6c6a[_0xa058('0x1a')][_0xa058('0x1f')],function(_0x4f070b){return{'model':db[_0x4f070b[_0xa058('0x21')]],'as':_0x4f070b['as'],'attributes':_0x4f070b[_0xa058('0x1d')],'include':_0x4f070b[_0xa058('0x1f')]?_[_0xa058('0x20')](_0x4f070b[_0xa058('0x1f')],function(_0xa42741){return{'model':db[_0xa42741[_0xa058('0x21')]],'as':_0xa42741['as'],'attributes':_0xa42741['attributes'],'include':_0xa42741[_0xa058('0x1f')]?_[_0xa058('0x20')](_0xa42741[_0xa058('0x1f')],function(_0x387175){return{'model':db[_0x387175[_0xa058('0x21')]],'as':_0x387175['as'],'attributes':_0x387175[_0xa058('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa058('0xd')](function(_0x2f7bd6){logger[_0xa058('0x15')]('GetVoiceCallReport',_0x4a6c6a);logger[_0xa058('0xf')]('GetVoiceCallReport',_0x4a6c6a,JSON[_0xa058('0x11')](_0x2f7bd6));_0x3a603a(_0x2f7bd6);})[_0xa058('0x17')](function(_0x537068){logger[_0xa058('0x12')](_0xa058('0x18'),_0x537068[_0xa058('0x14')],_0x4a6c6a);_0x20295d(_0x22acb9[_0xa058('0x12')](0x1f4,_0x537068[_0xa058('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x334ade){var _0x4bc29b=this;return new Promise(function(_0x5b3c37,_0x195469){return db[_0xa058('0x22')][_0xa058('0x23')](_0x334ade[_0xa058('0x24')],{'raw':_0x334ade[_0xa058('0x1a')]?_0x334ade[_0xa058('0x1a')][_0xa058('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x463556){logger[_0xa058('0x15')]('CreateVoiceCallReport',_0x334ade);logger[_0xa058('0xf')]('CreateVoiceCallReport',_0x334ade,JSON[_0xa058('0x11')](_0x463556));_0x5b3c37(_0x463556);})[_0xa058('0x17')](function(_0x1c50a0){logger[_0xa058('0x12')]('CreateVoiceCallReport',_0x1c50a0[_0xa058('0x14')],_0x334ade);_0x195469(_0x4bc29b['error'](0x1f4,_0x1c50a0[_0xa058('0x14')]));});});};exports[_0xa058('0x25')]=function(_0x5e65c1){var _0x321fbd=this;return new Promise(function(_0x3a84df,_0x5351af){return db[_0xa058('0x22')][_0xa058('0x26')](_0x5e65c1[_0xa058('0x24')],{'raw':_0x5e65c1[_0xa058('0x1a')]?_0x5e65c1[_0xa058('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e65c1[_0xa058('0x1a')]?_0x5e65c1[_0xa058('0x1a')]['where']||null:null,'attributes':_0x5e65c1[_0xa058('0x1a')]?_0x5e65c1['options'][_0xa058('0x1d')]||null:null,'limit':_0x5e65c1['options']?_0x5e65c1[_0xa058('0x1a')][_0xa058('0x1e')]||null:null})[_0xa058('0xd')](function(_0x85918a){logger[_0xa058('0x15')](_0xa058('0x25'),_0x5e65c1);logger[_0xa058('0xf')](_0xa058('0x25'),_0x5e65c1,JSON[_0xa058('0x11')](_0x85918a));_0x3a84df(_0x85918a);})['catch'](function(_0x552e7b){logger[_0xa058('0x12')]('UpdateVoiceCallReport',_0x552e7b['message'],_0x5e65c1);_0x5351af(_0x321fbd[_0xa058('0x12')](0x1f4,_0x552e7b[_0xa058('0x14')]));});});}; \ No newline at end of file +var _0xebce=['http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','attributes','limit','include','model','map','info','stringify','CreateVoiceCallReport','body','UpdateVoiceCallReport','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client'];(function(_0x26f616,_0x3e8f08){var _0x298682=function(_0x1665d1){while(--_0x1665d1){_0x26f616['push'](_0x26f616['shift']());}};_0x298682(++_0x3e8f08);}(_0xebce,0x83));var _0xeebc=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0xebce[_0x1b0597];return _0x2b6a2a;};'use strict';var _=require(_0xeebc('0x0'));var util=require(_0xeebc('0x1'));var moment=require(_0xeebc('0x2'));var BPromise=require(_0xeebc('0x3'));var rs=require(_0xeebc('0x4'));var fs=require('fs');var Redis=require(_0xeebc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeebc('0x6'))('rpc');var config=require(_0xeebc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeebc('0x8')][_0xeebc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31f2e1,_0x1caede,_0x54d6e6){return new BPromise(function(_0x310c46,_0x5d3382){return client[_0xeebc('0xa')](_0x31f2e1,_0x54d6e6)[_0xeebc('0xb')](function(_0x2dc164){logger['info'](_0xeebc('0xc'),_0x1caede,_0xeebc('0xd'));logger[_0xeebc('0xe')](_0xeebc('0xf'),_0x1caede,'request\x20sent',JSON['stringify'](_0x2dc164));if(_0x2dc164['error']){if(_0x2dc164['error'][_0xeebc('0x10')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x1caede,_0x2dc164[_0xeebc('0x11')][_0xeebc('0x12')]);return _0x5d3382(_0x2dc164['error']['message']);}logger[_0xeebc('0x11')](_0xeebc('0xc'),_0x1caede,_0x2dc164[_0xeebc('0x11')][_0xeebc('0x12')]);return _0x310c46(_0x2dc164[_0xeebc('0x11')][_0xeebc('0x12')]);}else{logger['info'](_0xeebc('0xc'),_0x1caede,'request\x20sent');_0x310c46(_0x2dc164['result'][_0xeebc('0x12')]);}})[_0xeebc('0x13')](function(_0x48759d){logger[_0xeebc('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x1caede,_0x48759d);_0x5d3382(_0x48759d);});});}exports[_0xeebc('0x14')]=function(_0x544852){var _0x269d75=this;return new Promise(function(_0x1e8175,_0x7c5f09){return db[_0xeebc('0x15')]['findAll']({'raw':_0x544852[_0xeebc('0x16')]?_0x544852[_0xeebc('0x16')][_0xeebc('0x17')]===undefined?!![]:![]:!![],'where':_0x544852['options']?_0x544852[_0xeebc('0x16')]['where']||null:null,'attributes':_0x544852[_0xeebc('0x16')]?_0x544852[_0xeebc('0x16')][_0xeebc('0x18')]||null:null,'limit':_0x544852['options']?_0x544852['options'][_0xeebc('0x19')]||null:null,'include':_0x544852['options']?_0x544852[_0xeebc('0x16')][_0xeebc('0x1a')]?_['map'](_0x544852['options']['include'],function(_0x407a56){return{'model':db[_0x407a56[_0xeebc('0x1b')]],'as':_0x407a56['as'],'attributes':_0x407a56['attributes'],'include':_0x407a56[_0xeebc('0x1a')]?_[_0xeebc('0x1c')](_0x407a56[_0xeebc('0x1a')],function(_0x106fbd){return{'model':db[_0x106fbd[_0xeebc('0x1b')]],'as':_0x106fbd['as'],'attributes':_0x106fbd[_0xeebc('0x18')],'include':_0x106fbd['include']?_[_0xeebc('0x1c')](_0x106fbd[_0xeebc('0x1a')],function(_0x122067){return{'model':db[_0x122067[_0xeebc('0x1b')]],'as':_0x122067['as'],'attributes':_0x122067[_0xeebc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeebc('0xb')](function(_0x328b68){logger[_0xeebc('0x1d')]('GetVoiceCallReport',_0x544852);logger['debug'](_0xeebc('0x14'),_0x544852,JSON[_0xeebc('0x1e')](_0x328b68));_0x1e8175(_0x328b68);})[_0xeebc('0x13')](function(_0x87afec){logger[_0xeebc('0x11')](_0xeebc('0x14'),_0x87afec[_0xeebc('0x12')],_0x544852);_0x7c5f09(_0x269d75[_0xeebc('0x11')](0x1f4,_0x87afec[_0xeebc('0x12')]));});});};exports[_0xeebc('0x1f')]=function(_0x40618d){var _0x1f2fec=this;return new Promise(function(_0x2a7f47,_0x69df9e){return db['VoiceCallReport']['create'](_0x40618d[_0xeebc('0x20')],{'raw':_0x40618d[_0xeebc('0x16')]?_0x40618d[_0xeebc('0x16')][_0xeebc('0x17')]===undefined?!![]:![]:!![]})[_0xeebc('0xb')](function(_0x5e35b8){logger[_0xeebc('0x1d')](_0xeebc('0x1f'),_0x40618d);logger['debug'](_0xeebc('0x1f'),_0x40618d,JSON[_0xeebc('0x1e')](_0x5e35b8));_0x2a7f47(_0x5e35b8);})[_0xeebc('0x13')](function(_0x534347){logger['error'](_0xeebc('0x1f'),_0x534347['message'],_0x40618d);_0x69df9e(_0x1f2fec[_0xeebc('0x11')](0x1f4,_0x534347['message']));});});};exports[_0xeebc('0x21')]=function(_0x59751a){var _0x5aad0e=this;return new Promise(function(_0x52aa19,_0xf641dd){return db[_0xeebc('0x15')]['update'](_0x59751a['body'],{'raw':_0x59751a[_0xeebc('0x16')]?_0x59751a[_0xeebc('0x16')][_0xeebc('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59751a[_0xeebc('0x16')]?_0x59751a[_0xeebc('0x16')][_0xeebc('0x22')]||null:null,'attributes':_0x59751a[_0xeebc('0x16')]?_0x59751a['options'][_0xeebc('0x18')]||null:null,'limit':_0x59751a[_0xeebc('0x16')]?_0x59751a[_0xeebc('0x16')][_0xeebc('0x19')]||null:null})[_0xeebc('0xb')](function(_0x241011){logger[_0xeebc('0x1d')](_0xeebc('0x21'),_0x59751a);logger[_0xeebc('0xe')](_0xeebc('0x21'),_0x59751a,JSON[_0xeebc('0x1e')](_0x241011));_0x52aa19(_0x241011);})[_0xeebc('0x13')](function(_0x5b8083){logger['error'](_0xeebc('0x21'),_0x5b8083[_0xeebc('0x12')],_0x59751a);_0xf641dd(_0x5aad0e[_0xeebc('0x11')](0x1f4,_0x5b8083[_0xeebc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 567f298..fb21a41 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 _0x131a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','create','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0x131a,0x13e));var _0xa131=function(_0x5c7c72,_0x544fea){_0x5c7c72=_0x5c7c72-0x0;var _0x5e430f=_0x131a[_0x5c7c72];return _0x5e430f;};'use strict';var multer=require(_0xa131('0x0'));var util=require('util');var path=require(_0xa131('0x1'));var timeout=require(_0xa131('0x2'));var express=require(_0xa131('0x3'));var router=express[_0xa131('0x4')]();var fs_extra=require(_0xa131('0x5'));var auth=require(_0xa131('0x6'));var interaction=require(_0xa131('0x7'));var config=require(_0xa131('0x8'));var controller=require(_0xa131('0x9'));router['get']('/',auth[_0xa131('0xa')](),controller[_0xa131('0xb')]);router[_0xa131('0xc')](_0xa131('0xd'),auth[_0xa131('0xa')](),controller[_0xa131('0xe')]);router['post']('/',auth[_0xa131('0xa')](),controller[_0xa131('0xf')]);router['put'](_0xa131('0xd'),auth['isAuthenticated'](),controller[_0xa131('0x10')]);router['delete']('/:id',auth[_0xa131('0xa')](),controller[_0xa131('0x11')]);module[_0xa131('0x12')]=router; \ No newline at end of file +var _0xe5d0=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id'];(function(_0xc10a58,_0x193366){var _0x1a3d79=function(_0x9fc77e){while(--_0x9fc77e){_0xc10a58['push'](_0xc10a58['shift']());}};_0x1a3d79(++_0x193366);}(_0xe5d0,0x81));var _0x0e5d=function(_0x3e80f0,_0x581b8f){_0x3e80f0=_0x3e80f0-0x0;var _0xe6bc48=_0xe5d0[_0x3e80f0];return _0xe6bc48;};'use strict';var multer=require(_0x0e5d('0x0'));var util=require(_0x0e5d('0x1'));var path=require('path');var timeout=require(_0x0e5d('0x2'));var express=require(_0x0e5d('0x3'));var router=express[_0x0e5d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e5d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e5d('0x6'));var controller=require(_0x0e5d('0x7'));router[_0x0e5d('0x8')]('/',auth['isAuthenticated'](),controller[_0x0e5d('0x9')]);router[_0x0e5d('0x8')](_0x0e5d('0xa'),auth[_0x0e5d('0xb')](),controller[_0x0e5d('0xc')]);router[_0x0e5d('0xd')]('/',auth[_0x0e5d('0xb')](),controller[_0x0e5d('0xe')]);router[_0x0e5d('0xf')](_0x0e5d('0xa'),auth[_0x0e5d('0xb')](),controller[_0x0e5d('0x10')]);router[_0x0e5d('0x11')]('/:id',auth[_0x0e5d('0xb')](),controller[_0x0e5d('0x12')]);module[_0x0e5d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2e61b06..f6eb28b 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 _0x90a5=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x38abb3,_0x1146e3){var _0x51cf98=function(_0x48c264){while(--_0x48c264){_0x38abb3['push'](_0x38abb3['shift']());}};_0x51cf98(++_0x1146e3);}(_0x90a5,0xb9));var _0x590a=function(_0x425526,_0x13871b){_0x425526=_0x425526-0x0;var _0x48f879=_0x90a5[_0x425526];return _0x48f879;};'use strict';var Sequelize=require(_0x590a('0x0'));module[_0x590a('0x1')]={'name':{'type':Sequelize[_0x590a('0x2')]},'prefix':{'type':Sequelize[_0x590a('0x2')],'unique':_0x590a('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x590a('0x2')],'set':function(_0x491183){this[_0x590a('0x4')](_0x590a('0x5'),_0x491183?_0x491183[_0x590a('0x6')](''):[]);},'get':function(){return this[_0x590a('0x7')](_0x590a('0x5'))?this[_0x590a('0x7')](_0x590a('0x5'))[_0x590a('0x8')](''):[];}},'auth':{'type':Sequelize[_0x590a('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x590a('0x2')]},'record':{'type':Sequelize[_0x590a('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x590a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16e2=['name','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x5968e8,_0x13cb0b){var _0xe9f013=function(_0x41c898){while(--_0x41c898){_0x5968e8['push'](_0x5968e8['shift']());}};_0xe9f013(++_0x13cb0b);}(_0x16e2,0xee));var _0x216e=function(_0x43979f,_0xe09f02){_0x43979f=_0x43979f-0x0;var _0x5ec65f=_0x16e2[_0x43979f];return _0x5ec65f;};'use strict';var Sequelize=require(_0x216e('0x0'));module[_0x216e('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x216e('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x216e('0x3')],'set':function(_0x408a4b){this[_0x216e('0x4')](_0x216e('0x5'),_0x408a4b?_0x408a4b[_0x216e('0x6')](''):[]);},'get':function(){return this[_0x216e('0x7')](_0x216e('0x5'))?this['getDataValue'](_0x216e('0x5'))[_0x216e('0x8')](''):[];}},'auth':{'type':Sequelize[_0x216e('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x216e('0x3')]},'record':{'type':Sequelize[_0x216e('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x216e('0x3')]},'description':{'type':Sequelize[_0x216e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 0bb25af..d10c1f3 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 _0xb07f=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','VoiceChanSpy','findAll','rows','catch','show','params','keys','length','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb07f,0x109));var _0xfb07=function(_0x5106c1,_0x53a8bd){_0x5106c1=_0x5106c1-0x0;var _0x3539fc=_0xb07f[_0x5106c1];return _0x3539fc;};'use strict';var emlformat=require(_0xfb07('0x0'));var rimraf=require(_0xfb07('0x1'));var zipdir=require(_0xfb07('0x2'));var jsonpatch=require(_0xfb07('0x3'));var rp=require(_0xfb07('0x4'));var moment=require(_0xfb07('0x5'));var BPromise=require(_0xfb07('0x6'));var Mustache=require(_0xfb07('0x7'));var util=require(_0xfb07('0x8'));var path=require(_0xfb07('0x9'));var sox=require(_0xfb07('0xa'));var csv=require('to-csv');var ejs=require(_0xfb07('0xb'));var fs=require('fs');var fs_extra=require(_0xfb07('0xc'));var _=require(_0xfb07('0xd'));var squel=require(_0xfb07('0xe'));var crypto=require(_0xfb07('0xf'));var jsforce=require(_0xfb07('0x10'));var deskjs=require(_0xfb07('0x11'));var toCsv=require(_0xfb07('0x12'));var querystring=require(_0xfb07('0x13'));var Papa=require(_0xfb07('0x14'));var Redis=require(_0xfb07('0x15'));var authService=require(_0xfb07('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb07('0x17'))(_0xfb07('0x18'));var utils=require('../../config/utils');var config=require(_0xfb07('0x19'));var licenseUtil=require(_0xfb07('0x1a'));var db=require(_0xfb07('0x1b'))['db'];function respondWithStatusCode(_0x13275d,_0x2ad2cf){_0x2ad2cf=_0x2ad2cf||0xcc;return function(_0x35fd11){if(_0x35fd11){return _0x13275d[_0xfb07('0x1c')](_0x2ad2cf);}return _0x13275d['status'](_0x2ad2cf)[_0xfb07('0x1d')]();};}function respondWithResult(_0x40bf71,_0x3c69db){_0x3c69db=_0x3c69db||0xc8;return function(_0x2c35e4){if(_0x2c35e4){return _0x40bf71[_0xfb07('0x1e')](_0x3c69db)[_0xfb07('0x1f')](_0x2c35e4);}};}function respondWithFilteredResult(_0x29cbae,_0x228e2a){return function(_0x2363d6){if(_0x2363d6){var _0x6a14e0=typeof _0x228e2a[_0xfb07('0x20')]===_0xfb07('0x21')&&typeof _0x228e2a[_0xfb07('0x22')]===_0xfb07('0x21');var _0x4ebcc3=_0x2363d6['count'];var _0x3e747e=_0x6a14e0?0x0:_0x228e2a[_0xfb07('0x20')];var _0x197f12=_0x6a14e0?_0x2363d6['count']:_0x228e2a[_0xfb07('0x20')]+_0x228e2a[_0xfb07('0x22')];var _0x527c4e;if(_0x197f12>=_0x4ebcc3){_0x197f12=_0x4ebcc3;_0x527c4e=0xc8;}else{_0x527c4e=0xce;}_0x29cbae['status'](_0x527c4e);return _0x29cbae[_0xfb07('0x23')](_0xfb07('0x24'),_0x3e747e+'-'+_0x197f12+'/'+_0x4ebcc3)[_0xfb07('0x1f')](_0x2363d6);}return null;};}function patchUpdates(_0x2c6c44){return function(_0x388995){try{jsonpatch[_0xfb07('0x25')](_0x388995,_0x2c6c44,!![]);}catch(_0x15e153){return BPromise[_0xfb07('0x26')](_0x15e153);}return _0x388995[_0xfb07('0x27')]();};}function saveUpdates(_0x578bb2,_0x45806a){return function(_0x56d0c4){if(_0x56d0c4){return _0x56d0c4[_0xfb07('0x28')](_0x578bb2)[_0xfb07('0x29')](function(_0x428c85){return _0x428c85;});}return null;};}function removeEntity(_0x301c1a,_0xb2063a){return function(_0x508d3b){if(_0x508d3b){return _0x508d3b[_0xfb07('0x2a')]()[_0xfb07('0x29')](function(){var _0x10835a=_0x508d3b[_0xfb07('0x2b')]({'plain':!![]});var _0x3b14fa=_0xfb07('0x2c');return db['UserProfileResource'][_0xfb07('0x2a')]({'where':{'type':_0x3b14fa,'resourceId':_0x10835a['id']}})[_0xfb07('0x29')](function(){return _0x508d3b;});})['then'](function(){_0x301c1a[_0xfb07('0x1e')](0xcc)[_0xfb07('0x1d')]();});}};}function handleEntityNotFound(_0xe813a7,_0x149ac0){return function(_0x46927a){if(!_0x46927a){_0xe813a7[_0xfb07('0x1c')](0x194);}return _0x46927a;};}function handleError(_0x20f01a,_0x24ff99){_0x24ff99=_0x24ff99||0x1f4;return function(_0x95f1d){logger[_0xfb07('0x2d')](_0x95f1d[_0xfb07('0x2e')]);if(_0x95f1d['name']){delete _0x95f1d[_0xfb07('0x2f')];}_0x20f01a[_0xfb07('0x1e')](_0x24ff99)[_0xfb07('0x30')](_0x95f1d);};}exports[_0xfb07('0x31')]=function(_0x5dd4c9,_0x46d57e){var _0xd5290c={},_0x4ce9a4={},_0x36da2a={'count':0x0,'rows':[]};var _0x5dc353=_[_0xfb07('0x32')](db['VoiceChanSpy'][_0xfb07('0x33')],function(_0x4a8d4c){return{'name':_0x4a8d4c[_0xfb07('0x34')],'type':_0x4a8d4c[_0xfb07('0x35')][_0xfb07('0x36')]};});_0x4ce9a4[_0xfb07('0x37')]=_[_0xfb07('0x32')](_0x5dc353,_0xfb07('0x2f'));_0x4ce9a4['query']=_['keys'](_0x5dd4c9[_0xfb07('0x38')]);_0x4ce9a4[_0xfb07('0x39')]=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],_0x4ce9a4['query']);_0xd5290c['attributes']=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3b')]));_0xd5290c[_0xfb07('0x3c')]=_0xd5290c['attributes']['length']?_0xd5290c['attributes']:_0x4ce9a4[_0xfb07('0x37')];if(!_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3d')](_0xfb07('0x3e'))){_0xd5290c['limit']=qs['limit'](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x22')]);_0xd5290c['offset']=qs['offset'](_0x5dd4c9['query'][_0xfb07('0x20')]);}_0xd5290c[_0xfb07('0x3f')]=qs['sort'](_0x5dd4c9['query'][_0xfb07('0x40')]);_0xd5290c[_0xfb07('0x41')]=qs[_0xfb07('0x39')](_[_0xfb07('0x42')](_0x5dd4c9[_0xfb07('0x38')],_0x4ce9a4['filters']),_0x5dc353);if(_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]){_0xd5290c[_0xfb07('0x41')]=_[_0xfb07('0x44')](_0xd5290c['where'],{'$or':_['map'](_0x5dc353,function(_0x2d40cb){if(_0x2d40cb[_0xfb07('0x35')]!==_0xfb07('0x45')){var _0xc5df59={};_0xc5df59[_0x2d40cb[_0xfb07('0x2f')]]={'$like':'%'+_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]+'%'};return _0xc5df59;}})});}_0xd5290c=_['merge']({},_0xd5290c,_0x5dd4c9['options']);var _0x44dafb={'where':_0xd5290c[_0xfb07('0x41')]};return db['VoiceChanSpy']['count'](_0x44dafb)[_0xfb07('0x29')](function(_0x20d682){_0x36da2a[_0xfb07('0x46')]=_0x20d682;if(_0x5dd4c9['query']['includeAll']){_0xd5290c[_0xfb07('0x47')]=[{'all':!![]}];}return db[_0xfb07('0x48')][_0xfb07('0x49')](_0xd5290c);})[_0xfb07('0x29')](function(_0xb87b68){_0x36da2a[_0xfb07('0x4a')]=_0xb87b68;return _0x36da2a;})[_0xfb07('0x29')](respondWithFilteredResult(_0x46d57e,_0xd5290c))[_0xfb07('0x4b')](handleError(_0x46d57e,null));};exports[_0xfb07('0x4c')]=function(_0x492f1b,_0x41df3f){var _0x12c588={'raw':![],'where':{'id':_0x492f1b[_0xfb07('0x4d')]['id']}},_0x3d6372={};_0x3d6372[_0xfb07('0x37')]=_[_0xfb07('0x4e')](db[_0xfb07('0x48')][_0xfb07('0x33')]);_0x3d6372[_0xfb07('0x38')]=_[_0xfb07('0x4e')](_0x492f1b['query']);_0x3d6372['filters']=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],_0x3d6372['query']);_0x12c588[_0xfb07('0x3c')]=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x492f1b[_0xfb07('0x38')]['fields']));_0x12c588['attributes']=_0x12c588[_0xfb07('0x3c')][_0xfb07('0x4f')]?_0x12c588[_0xfb07('0x3c')]:_0x3d6372[_0xfb07('0x37')];if(_0x492f1b[_0xfb07('0x38')][_0xfb07('0x50')]){_0x12c588[_0xfb07('0x47')]=[{'all':!![]}];}_0x12c588=_[_0xfb07('0x44')]({},_0x12c588,_0x492f1b[_0xfb07('0x51')]);return db[_0xfb07('0x48')]['find'](_0x12c588)['then'](handleEntityNotFound(_0x41df3f,null))['then'](respondWithResult(_0x41df3f,null))[_0xfb07('0x4b')](handleError(_0x41df3f,null));};exports['create']=function(_0x2397f8,_0x31cca8){return db[_0xfb07('0x48')][_0xfb07('0x52')](_0x2397f8[_0xfb07('0x53')],{})[_0xfb07('0x29')](function(_0x4d464e){var _0x3b2cce=_0x2397f8[_0xfb07('0x54')][_0xfb07('0x2b')]({'plain':!![]});if(!_0x3b2cce)throw new Error(_0xfb07('0x55'));if(_0x3b2cce[_0xfb07('0x56')]==='user'){var _0x3cfb89=_0x4d464e[_0xfb07('0x2b')]({'plain':!![]});var _0x40fa4a=_0xfb07('0x2c');return db[_0xfb07('0x57')]['find']({'where':{'name':_0x40fa4a,'userProfileId':_0x3b2cce[_0xfb07('0x58')]},'raw':!![]})[_0xfb07('0x29')](function(_0x38b30e){if(_0x38b30e&&_0x38b30e[_0xfb07('0x59')]===0x0){return db[_0xfb07('0x5a')]['create']({'name':_0x3cfb89[_0xfb07('0x2f')],'resourceId':_0x3cfb89['id'],'type':_0x38b30e[_0xfb07('0x2f')],'sectionId':_0x38b30e['id']},{})[_0xfb07('0x29')](function(){return _0x4d464e;});}else{return _0x4d464e;}})[_0xfb07('0x4b')](function(_0x4e597d){logger[_0xfb07('0x2d')](_0xfb07('0x5b'),_0x4e597d);throw _0x4e597d;});}return _0x4d464e;})[_0xfb07('0x29')](respondWithResult(_0x31cca8,0xc9))[_0xfb07('0x4b')](handleError(_0x31cca8,null));};exports[_0xfb07('0x28')]=function(_0x165628,_0x353b33){if(_0x165628[_0xfb07('0x53')]['id']){delete _0x165628[_0xfb07('0x53')]['id'];}return db[_0xfb07('0x48')]['find']({'where':{'id':_0x165628[_0xfb07('0x4d')]['id']}})['then'](handleEntityNotFound(_0x353b33,null))[_0xfb07('0x29')](saveUpdates(_0x165628[_0xfb07('0x53')],null))[_0xfb07('0x29')](respondWithResult(_0x353b33,null))[_0xfb07('0x4b')](handleError(_0x353b33,null));};exports[_0xfb07('0x2a')]=function(_0x7746bb,_0x1c76af){return db['VoiceChanSpy']['find']({'where':{'id':_0x7746bb['params']['id']}})[_0xfb07('0x29')](handleEntityNotFound(_0x1c76af,null))[_0xfb07('0x29')](removeEntity(_0x1c76af,null))[_0xfb07('0x4b')](handleError(_0x1c76af,null));}; \ No newline at end of file +var _0xad8a=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','name','send','map','VoiceChanSpy','rawAttributes','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','fields','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0xad8a,0xb0));var _0xaad8=function(_0x41e602,_0x4dca96){_0x41e602=_0x41e602-0x0;var _0x8cfc4c=_0xad8a[_0x41e602];return _0x8cfc4c;};'use strict';var emlformat=require(_0xaad8('0x0'));var rimraf=require(_0xaad8('0x1'));var zipdir=require(_0xaad8('0x2'));var jsonpatch=require(_0xaad8('0x3'));var rp=require(_0xaad8('0x4'));var moment=require('moment');var BPromise=require(_0xaad8('0x5'));var Mustache=require(_0xaad8('0x6'));var util=require(_0xaad8('0x7'));var path=require('path');var sox=require(_0xaad8('0x8'));var csv=require(_0xaad8('0x9'));var ejs=require(_0xaad8('0xa'));var fs=require('fs');var fs_extra=require(_0xaad8('0xb'));var _=require(_0xaad8('0xc'));var squel=require(_0xaad8('0xd'));var crypto=require(_0xaad8('0xe'));var jsforce=require(_0xaad8('0xf'));var deskjs=require(_0xaad8('0x10'));var toCsv=require(_0xaad8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaad8('0x11'));var authService=require(_0xaad8('0x12'));var qs=require(_0xaad8('0x13'));var as=require(_0xaad8('0x14'));var hardwareService=require(_0xaad8('0x15'));var logger=require(_0xaad8('0x16'))(_0xaad8('0x17'));var utils=require(_0xaad8('0x18'));var config=require(_0xaad8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xaad8('0x1a'))['db'];function respondWithStatusCode(_0x2a13fb,_0xed6744){_0xed6744=_0xed6744||0xcc;return function(_0x456b77){if(_0x456b77){return _0x2a13fb[_0xaad8('0x1b')](_0xed6744);}return _0x2a13fb[_0xaad8('0x1c')](_0xed6744)[_0xaad8('0x1d')]();};}function respondWithResult(_0x357bf6,_0x1c70d3){_0x1c70d3=_0x1c70d3||0xc8;return function(_0x4372fc){if(_0x4372fc){return _0x357bf6[_0xaad8('0x1c')](_0x1c70d3)[_0xaad8('0x1e')](_0x4372fc);}};}function respondWithFilteredResult(_0x28bf95,_0x5e4fbb){return function(_0x334c4d){if(_0x334c4d){var _0xb63cb3=typeof _0x5e4fbb['offset']===_0xaad8('0x1f')&&typeof _0x5e4fbb[_0xaad8('0x20')]===_0xaad8('0x1f');var _0xc17ada=_0x334c4d[_0xaad8('0x21')];var _0x3895e2=_0xb63cb3?0x0:_0x5e4fbb['offset'];var _0xfd8b0a=_0xb63cb3?_0x334c4d[_0xaad8('0x21')]:_0x5e4fbb['offset']+_0x5e4fbb[_0xaad8('0x20')];var _0x4c681e;if(_0xfd8b0a>=_0xc17ada){_0xfd8b0a=_0xc17ada;_0x4c681e=0xc8;}else{_0x4c681e=0xce;}_0x28bf95[_0xaad8('0x1c')](_0x4c681e);return _0x28bf95[_0xaad8('0x22')](_0xaad8('0x23'),_0x3895e2+'-'+_0xfd8b0a+'/'+_0xc17ada)[_0xaad8('0x1e')](_0x334c4d);}return null;};}function patchUpdates(_0x5cb39b){return function(_0x18b856){try{jsonpatch[_0xaad8('0x24')](_0x18b856,_0x5cb39b,!![]);}catch(_0x594681){return BPromise[_0xaad8('0x25')](_0x594681);}return _0x18b856[_0xaad8('0x26')]();};}function saveUpdates(_0x262e57,_0x5b4b61){return function(_0x5ba0fb){if(_0x5ba0fb){return _0x5ba0fb[_0xaad8('0x27')](_0x262e57)[_0xaad8('0x28')](function(_0x3930f0){return _0x3930f0;});}return null;};}function removeEntity(_0x15e0c6,_0x29ba69){return function(_0x1daacf){if(_0x1daacf){return _0x1daacf[_0xaad8('0x29')]()[_0xaad8('0x28')](function(){var _0x477d29=_0x1daacf[_0xaad8('0x2a')]({'plain':!![]});var _0x1bbac4=_0xaad8('0x2b');return db[_0xaad8('0x2c')][_0xaad8('0x29')]({'where':{'type':_0x1bbac4,'resourceId':_0x477d29['id']}})[_0xaad8('0x28')](function(){return _0x1daacf;});})['then'](function(){_0x15e0c6[_0xaad8('0x1c')](0xcc)[_0xaad8('0x1d')]();});}};}function handleEntityNotFound(_0x3f066f,_0x47b7a2){return function(_0x237c67){if(!_0x237c67){_0x3f066f[_0xaad8('0x1b')](0x194);}return _0x237c67;};}function handleError(_0x36b180,_0x1ca776){_0x1ca776=_0x1ca776||0x1f4;return function(_0x24c01d){logger['error'](_0x24c01d[_0xaad8('0x2d')]);if(_0x24c01d[_0xaad8('0x2e')]){delete _0x24c01d[_0xaad8('0x2e')];}_0x36b180[_0xaad8('0x1c')](_0x1ca776)[_0xaad8('0x2f')](_0x24c01d);};}exports['index']=function(_0x78c862,_0x4030ea){var _0x20ea82={},_0x22f47a={},_0x47ffb7={'count':0x0,'rows':[]};var _0x30b0e2=_[_0xaad8('0x30')](db[_0xaad8('0x31')][_0xaad8('0x32')],function(_0x254ee5){return{'name':_0x254ee5['fieldName'],'type':_0x254ee5[_0xaad8('0x33')][_0xaad8('0x34')]};});_0x22f47a['model']=_['map'](_0x30b0e2,_0xaad8('0x2e'));_0x22f47a[_0xaad8('0x35')]=_[_0xaad8('0x36')](_0x78c862[_0xaad8('0x35')]);_0x22f47a['filters']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],_0x22f47a['query']);_0x20ea82['attributes']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],qs['fields'](_0x78c862[_0xaad8('0x35')]['fields']));_0x20ea82['attributes']=_0x20ea82[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x20ea82['attributes']:_0x22f47a[_0xaad8('0x38')];if(!_0x78c862[_0xaad8('0x35')][_0xaad8('0x3b')](_0xaad8('0x3c'))){_0x20ea82['limit']=qs[_0xaad8('0x20')](_0x78c862[_0xaad8('0x35')][_0xaad8('0x20')]);_0x20ea82[_0xaad8('0x3d')]=qs[_0xaad8('0x3d')](_0x78c862[_0xaad8('0x35')]['offset']);}_0x20ea82[_0xaad8('0x3e')]=qs[_0xaad8('0x3f')](_0x78c862[_0xaad8('0x35')]['sort']);_0x20ea82[_0xaad8('0x40')]=qs[_0xaad8('0x41')](_[_0xaad8('0x42')](_0x78c862[_0xaad8('0x35')],_0x22f47a[_0xaad8('0x41')]),_0x30b0e2);if(_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]){_0x20ea82['where']=_[_0xaad8('0x44')](_0x20ea82[_0xaad8('0x40')],{'$or':_[_0xaad8('0x30')](_0x30b0e2,function(_0x25c0a4){if(_0x25c0a4[_0xaad8('0x33')]!==_0xaad8('0x45')){var _0x4e4081={};_0x4e4081[_0x25c0a4[_0xaad8('0x2e')]]={'$like':'%'+_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]+'%'};return _0x4e4081;}})});}_0x20ea82=_[_0xaad8('0x44')]({},_0x20ea82,_0x78c862['options']);var _0x543761={'where':_0x20ea82['where']};return db[_0xaad8('0x31')][_0xaad8('0x21')](_0x543761)[_0xaad8('0x28')](function(_0x5bb668){_0x47ffb7[_0xaad8('0x21')]=_0x5bb668;if(_0x78c862[_0xaad8('0x35')]['includeAll']){_0x20ea82[_0xaad8('0x46')]=[{'all':!![]}];}return db[_0xaad8('0x31')][_0xaad8('0x47')](_0x20ea82);})[_0xaad8('0x28')](function(_0x3933ac){_0x47ffb7[_0xaad8('0x48')]=_0x3933ac;return _0x47ffb7;})[_0xaad8('0x28')](respondWithFilteredResult(_0x4030ea,_0x20ea82))[_0xaad8('0x49')](handleError(_0x4030ea,null));};exports[_0xaad8('0x4a')]=function(_0xbd5191,_0x29432a){var _0x241ceb={'raw':![],'where':{'id':_0xbd5191['params']['id']}},_0x4b5b76={};_0x4b5b76['model']=_[_0xaad8('0x36')](db['VoiceChanSpy'][_0xaad8('0x32')]);_0x4b5b76['query']=_['keys'](_0xbd5191[_0xaad8('0x35')]);_0x4b5b76['filters']=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],_0x4b5b76[_0xaad8('0x35')]);_0x241ceb[_0xaad8('0x39')]=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],qs[_0xaad8('0x4b')](_0xbd5191[_0xaad8('0x35')][_0xaad8('0x4b')]));_0x241ceb[_0xaad8('0x39')]=_0x241ceb[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x241ceb[_0xaad8('0x39')]:_0x4b5b76[_0xaad8('0x38')];if(_0xbd5191[_0xaad8('0x35')]['includeAll']){_0x241ceb['include']=[{'all':!![]}];}_0x241ceb=_[_0xaad8('0x44')]({},_0x241ceb,_0xbd5191[_0xaad8('0x4c')]);return db[_0xaad8('0x31')]['find'](_0x241ceb)['then'](handleEntityNotFound(_0x29432a,null))[_0xaad8('0x28')](respondWithResult(_0x29432a,null))['catch'](handleError(_0x29432a,null));};exports[_0xaad8('0x4d')]=function(_0x1560ef,_0x313824){return db[_0xaad8('0x31')][_0xaad8('0x4d')](_0x1560ef[_0xaad8('0x4e')],{})[_0xaad8('0x28')](function(_0x23de0a){var _0xb19607=_0x1560ef['user'][_0xaad8('0x2a')]({'plain':!![]});if(!_0xb19607)throw new Error(_0xaad8('0x4f'));if(_0xb19607['role']===_0xaad8('0x50')){var _0x5e5ef1=_0x23de0a[_0xaad8('0x2a')]({'plain':!![]});var _0x15cb03=_0xaad8('0x2b');return db[_0xaad8('0x51')][_0xaad8('0x52')]({'where':{'name':_0x15cb03,'userProfileId':_0xb19607[_0xaad8('0x53')]},'raw':!![]})[_0xaad8('0x28')](function(_0x325a49){if(_0x325a49&&_0x325a49[_0xaad8('0x54')]===0x0){return db['UserProfileResource'][_0xaad8('0x4d')]({'name':_0x5e5ef1[_0xaad8('0x2e')],'resourceId':_0x5e5ef1['id'],'type':_0x325a49[_0xaad8('0x2e')],'sectionId':_0x325a49['id']},{})[_0xaad8('0x28')](function(){return _0x23de0a;});}else{return _0x23de0a;}})[_0xaad8('0x49')](function(_0x9bf893){logger['error'](_0xaad8('0x55'),_0x9bf893);throw _0x9bf893;});}return _0x23de0a;})[_0xaad8('0x28')](respondWithResult(_0x313824,0xc9))['catch'](handleError(_0x313824,null));};exports['update']=function(_0x33e743,_0x1202d4){if(_0x33e743[_0xaad8('0x4e')]['id']){delete _0x33e743[_0xaad8('0x4e')]['id'];}return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x33e743['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x1202d4,null))[_0xaad8('0x28')](saveUpdates(_0x33e743[_0xaad8('0x4e')],null))[_0xaad8('0x28')](respondWithResult(_0x1202d4,null))[_0xaad8('0x49')](handleError(_0x1202d4,null));};exports['destroy']=function(_0x5ddb77,_0x48edf6){return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x5ddb77['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x48edf6,null))[_0xaad8('0x28')](removeEntity(_0x48edf6,null))[_0xaad8('0x49')](handleError(_0x48edf6,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a4094dd..a0b252a 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 _0xcc57=['bluebird','from-sip','format','%s%s','prefix','system','push','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal','User','agent','catch','VoiceChanSpy','then','VoiceExtension','bulkCreate','destroy','lodash','util'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0xcc57,0x8a));var _0x7cc5=function(_0x201b53,_0x2536f9){_0x201b53=_0x201b53-0x0;var _0x3b2e6b=_0xcc57[_0x201b53];return _0x3b2e6b;};'use strict';var _=require(_0x7cc5('0x0'));var util=require(_0x7cc5('0x1'));var BPromise=require(_0x7cc5('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3da8f6,_0x34430f,_0x2c5aed){var _0x133075=0x1;var _0x3948ef=[];var _0x39c40f={'context':_0x34430f['context']||_0x7cc5('0x3'),'exten':util[_0x7cc5('0x4')](_0x7cc5('0x5'),_0x3da8f6[_0x7cc5('0x6')],_0x2c5aed),'type':_0x7cc5('0x7'),'isApp':![],'ChanSpyId':_0x3da8f6['id'],'UserId':_0x34430f['id']};_0x3948ef[_0x7cc5('0x8')](_['merge']({'app':'Set','appdata':util['format'](_0x7cc5('0x9'),_0x7cc5('0xa')),'priority':_0x133075++},_0x39c40f));if(_0x3da8f6[_0x7cc5('0xb')]){_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0xd'),'appdata':util[_0x7cc5('0x4')](_0x7cc5('0xe'),_0x3da8f6[_0x7cc5('0xf')]),'priority':_0x133075++},_0x39c40f));}if(_0x3da8f6[_0x7cc5('0x10')]){_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0x11'),'appdata':_0x3da8f6[_0x7cc5('0x12')],'priority':_0x133075++},_0x39c40f));}_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0x13'),'appdata':util[_0x7cc5('0x4')]('SIP/%s,%s',_0x34430f[_0x7cc5('0x14')],_0x3da8f6['options']?_0x3da8f6[_0x7cc5('0x15')][_0x7cc5('0x16')](''):''),'priority':_0x133075++},_0x39c40f));if(_0x3da8f6[_0x7cc5('0xb')]){_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0x17'),'priority':_0x133075++},_0x39c40f));}return _0x3948ef;};var getChanSpyApplications=function(_0x2001c7,_0x576f40){var _0x5e7c45=[];for(var _0x5dcd85=0x0,_0x4256e9=0x1;_0x5dcd85<_0x576f40[_0x7cc5('0x18')];_0x5dcd85++,_0x4256e9=0x1){_0x5e7c45=_0x5e7c45[_0x7cc5('0x19')](getUserApplications(_0x2001c7,_0x576f40[_0x5dcd85],_0x576f40[_0x5dcd85][_0x7cc5('0x1a')]));if(_0x576f40[_0x5dcd85][_0x7cc5('0x1a')]!=_0x576f40[_0x5dcd85][_0x7cc5('0x14')]){_0x5e7c45=_0x5e7c45[_0x7cc5('0x19')](getUserApplications(_0x2001c7,_0x576f40[_0x5dcd85],_0x576f40[_0x5dcd85][_0x7cc5('0x14')]));}}return _0x5e7c45;};var getChanSpyPromise=function(_0x3d9fba,_0x205318){return new BPromise(function(_0x362606,_0x3be72c){return _0x3d9fba[_0x7cc5('0x1b')]['findAll']({'attributes':['id',_0x7cc5('0x14'),_0x7cc5('0x1a')],'where':{'role':_0x7cc5('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x923798){if(_0x923798){return _0x362606(getChanSpyApplications(_0x205318,_0x923798));}return _0x362606([]);})[_0x7cc5('0x1d')](function(_0x2b541c){_0x3be72c(_0x2b541c);});});};module['exports']=function(_0x3d6d74,_0x202326){var _0x564581=_0x3d6d74['models'];return _0x3d6d74['define'](_0x7cc5('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d3bf1,_0x391072,_0x3e7e17){return getChanSpyPromise(_0x564581,_0x1d3bf1)[_0x7cc5('0x1f')](function(_0x3f4041){if(_0x3f4041&&_0x3f4041[_0x7cc5('0x18')]){return _0x564581['VoiceExtension']['bulkCreate'](_0x3f4041);}})[_0x7cc5('0x1f')](function(){_0x3e7e17();})[_0x7cc5('0x1d')](function(_0x4eb4d1){_0x3e7e17(_0x4eb4d1);});},'afterUpdate':function(_0x1d12ce,_0x175b9e,_0x1e0b91){return _0x564581[_0x7cc5('0x20')]['destroy']({'where':{'ChanSpyId':_0x1d12ce['id']}})[_0x7cc5('0x1f')](function(){return getChanSpyPromise(_0x564581,_0x1d12ce);})[_0x7cc5('0x1f')](function(_0x966ad5){if(_0x966ad5&&_0x966ad5[_0x7cc5('0x18')]){return _0x564581[_0x7cc5('0x20')][_0x7cc5('0x21')](_0x966ad5);}})['then'](function(){_0x1e0b91();})[_0x7cc5('0x1d')](function(_0xd95733){_0x1e0b91(_0xd95733);});},'afterDestroy':function(_0x21dece,_0x202c2c,_0x3e11fb){return _0x564581[_0x7cc5('0x20')][_0x7cc5('0x22')]({'where':{'ChanSpyId':_0x21dece['id']}})['then'](function(){_0x3e11fb();})['catch'](function(_0x38a7bb){_0x3e11fb(_0x38a7bb);});}}});}; \ No newline at end of file +var _0x30f9=['destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','catch','exports','models','VoiceChanSpy','bulkCreate','VoiceExtension'];(function(_0x765b92,_0xe062ac){var _0x55ac4c=function(_0x97c044){while(--_0x97c044){_0x765b92['push'](_0x765b92['shift']());}};_0x55ac4c(++_0xe062ac);}(_0x30f9,0x129));var _0x930f=function(_0x929c7e,_0x38c4cc){_0x929c7e=_0x929c7e-0x0;var _0x5de099=_0x30f9[_0x929c7e];return _0x5de099;};'use strict';var _=require('lodash');var util=require(_0x930f('0x0'));var BPromise=require(_0x930f('0x1'));var attributes=require(_0x930f('0x2'));var getUserApplications=function(_0x2f11ef,_0x13d7d2,_0x1dc68c){var _0x43b04a=0x1;var _0x52431e=[];var _0x2d1d82={'context':_0x13d7d2[_0x930f('0x3')]||_0x930f('0x4'),'exten':util[_0x930f('0x5')](_0x930f('0x6'),_0x2f11ef[_0x930f('0x7')],_0x1dc68c),'type':'system','isApp':![],'ChanSpyId':_0x2f11ef['id'],'UserId':_0x13d7d2['id']};_0x52431e[_0x930f('0x8')](_[_0x930f('0x9')]({'app':_0x930f('0xa'),'appdata':util[_0x930f('0x5')](_0x930f('0xb'),_0x930f('0xc')),'priority':_0x43b04a++},_0x2d1d82));if(_0x2f11ef[_0x930f('0xd')]){_0x52431e['push'](_[_0x930f('0x9')]({'app':_0x930f('0xe'),'appdata':util['format'](_0x930f('0xf'),_0x2f11ef[_0x930f('0x10')]),'priority':_0x43b04a++},_0x2d1d82));}if(_0x2f11ef['auth']){_0x52431e[_0x930f('0x8')](_[_0x930f('0x9')]({'app':_0x930f('0x11'),'appdata':_0x2f11ef[_0x930f('0x12')],'priority':_0x43b04a++},_0x2d1d82));}_0x52431e[_0x930f('0x8')](_[_0x930f('0x9')]({'app':_0x930f('0x13'),'appdata':util['format']('SIP/%s,%s',_0x13d7d2[_0x930f('0x14')],_0x2f11ef[_0x930f('0x15')]?_0x2f11ef[_0x930f('0x15')][_0x930f('0x16')](''):''),'priority':_0x43b04a++},_0x2d1d82));if(_0x2f11ef[_0x930f('0xd')]){_0x52431e[_0x930f('0x8')](_['merge']({'app':_0x930f('0x17'),'priority':_0x43b04a++},_0x2d1d82));}return _0x52431e;};var getChanSpyApplications=function(_0x564dff,_0x14aae5){var _0x2c03c4=[];for(var _0x3f0a8b=0x0,_0x1927f2=0x1;_0x3f0a8b<_0x14aae5[_0x930f('0x18')];_0x3f0a8b++,_0x1927f2=0x1){_0x2c03c4=_0x2c03c4[_0x930f('0x19')](getUserApplications(_0x564dff,_0x14aae5[_0x3f0a8b],_0x14aae5[_0x3f0a8b][_0x930f('0x1a')]));if(_0x14aae5[_0x3f0a8b][_0x930f('0x1a')]!=_0x14aae5[_0x3f0a8b]['name']){_0x2c03c4=_0x2c03c4['concat'](getUserApplications(_0x564dff,_0x14aae5[_0x3f0a8b],_0x14aae5[_0x3f0a8b][_0x930f('0x14')]));}}return _0x2c03c4;};var getChanSpyPromise=function(_0x4bcd93,_0x393e3e){return new BPromise(function(_0x19d4c9,_0x1eb71c){return _0x4bcd93[_0x930f('0x1b')][_0x930f('0x1c')]({'attributes':['id',_0x930f('0x14'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x930f('0x1d')](function(_0x3b3ed5){if(_0x3b3ed5){return _0x19d4c9(getChanSpyApplications(_0x393e3e,_0x3b3ed5));}return _0x19d4c9([]);})[_0x930f('0x1e')](function(_0x350ecd){_0x1eb71c(_0x350ecd);});});};module[_0x930f('0x1f')]=function(_0x13f4d5,_0x2cfc0b){var _0x181da2=_0x13f4d5[_0x930f('0x20')];return _0x13f4d5['define'](_0x930f('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf6743a,_0xac9dc2,_0x5854d8){return getChanSpyPromise(_0x181da2,_0xf6743a)[_0x930f('0x1d')](function(_0x55f031){if(_0x55f031&&_0x55f031[_0x930f('0x18')]){return _0x181da2['VoiceExtension'][_0x930f('0x22')](_0x55f031);}})[_0x930f('0x1d')](function(){_0x5854d8();})['catch'](function(_0x4d77f1){_0x5854d8(_0x4d77f1);});},'afterUpdate':function(_0x429072,_0x5b483f,_0x2b239c){return _0x181da2[_0x930f('0x23')][_0x930f('0x24')]({'where':{'ChanSpyId':_0x429072['id']}})[_0x930f('0x1d')](function(){return getChanSpyPromise(_0x181da2,_0x429072);})['then'](function(_0xaf11ec){if(_0xaf11ec&&_0xaf11ec[_0x930f('0x18')]){return _0x181da2[_0x930f('0x23')]['bulkCreate'](_0xaf11ec);}})['then'](function(){_0x2b239c();})['catch'](function(_0x20e9f4){_0x2b239c(_0x20e9f4);});},'afterDestroy':function(_0x4e304b,_0x3a3159,_0x2d9e9d){return _0x181da2[_0x930f('0x23')][_0x930f('0x24')]({'where':{'ChanSpyId':_0x4e304b['id']}})['then'](function(){_0x2d9e9d();})[_0x930f('0x1e')](function(_0x4f093e){_0x2d9e9d(_0x4f093e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b85c58d..0d1e91c 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 _0xb9a7=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0xb9a7,0x112));var _0x7b9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb9a7[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file +var _0x6a24=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x1d5087,_0x1b468a){var _0x582ab7=function(_0x2fae65){while(--_0x2fae65){_0x1d5087['push'](_0x1d5087['shift']());}};_0x582ab7(++_0x1b468a);}(_0x6a24,0xd1));var _0x46a2=function(_0x160817,_0x47a93a){_0x160817=_0x160817-0x0;var _0x4be375=_0x6a24[_0x160817];return _0x4be375;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ef8bdb3..bd6e520 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 _0xf1ce=['/:id','isAuthenticated','post','create','put','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf1ce,0x167));var _0xef1c=function(_0x30c201,_0x3acd9a){_0x30c201=_0x30c201-0x0;var _0x49c290=_0xf1ce[_0x30c201];return _0x49c290;};'use strict';var multer=require(_0xef1c('0x0'));var util=require(_0xef1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef1c('0x2')]();var fs_extra=require(_0xef1c('0x3'));var auth=require(_0xef1c('0x4'));var interaction=require(_0xef1c('0x5'));var config=require('../../config/environment');var controller=require(_0xef1c('0x6'));router[_0xef1c('0x7')]('/',auth['isAuthenticated'](),controller[_0xef1c('0x8')]);router[_0xef1c('0x7')](_0xef1c('0x9'),auth[_0xef1c('0xa')](),controller['show']);router[_0xef1c('0xb')]('/',auth[_0xef1c('0xa')](),controller[_0xef1c('0xc')]);router[_0xef1c('0xd')](_0xef1c('0x9'),auth[_0xef1c('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xef1c('0xe')]);module[_0xef1c('0xf')]=router; \ No newline at end of file +var _0xe338=['get','show','post','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated'];(function(_0x47932e,_0x2f4254){var _0x93ae4d=function(_0x2722ea){while(--_0x2722ea){_0x47932e['push'](_0x47932e['shift']());}};_0x93ae4d(++_0x2f4254);}(_0xe338,0x127));var _0x8e33=function(_0xdad5e3,_0x2cb400){_0xdad5e3=_0xdad5e3-0x0;var _0x414193=_0xe338[_0xdad5e3];return _0x414193;};'use strict';var multer=require(_0x8e33('0x0'));var util=require(_0x8e33('0x1'));var path=require(_0x8e33('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e33('0x3'));var router=express[_0x8e33('0x4')]();var fs_extra=require(_0x8e33('0x5'));var auth=require(_0x8e33('0x6'));var interaction=require(_0x8e33('0x7'));var config=require(_0x8e33('0x8'));var controller=require(_0x8e33('0x9'));router['get']('/',auth[_0x8e33('0xa')](),controller['index']);router[_0x8e33('0xb')]('/:id',auth[_0x8e33('0xa')](),controller[_0x8e33('0xc')]);router[_0x8e33('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8e33('0xe'),auth[_0x8e33('0xa')](),controller[_0x8e33('0xf')]);router[_0x8e33('0x10')]('/:id',auth[_0x8e33('0xa')](),controller['destroy']);module[_0x8e33('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 67dff16..7a09ffb 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 _0x2dbe=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2dbe,0x1bb));var _0xe2db=function(_0x26ce74,_0x3988a5){_0x26ce74=_0x26ce74-0x0;var _0x356ff5=_0x2dbe[_0x26ce74];return _0x356ff5;};'use strict';var Sequelize=require(_0xe2db('0x0'));module[_0xe2db('0x1')]={'name':{'type':Sequelize[_0xe2db('0x2')],'unique':_0xe2db('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe2db('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd707=['exports','STRING','sequelize'];(function(_0x1c2f30,_0x53b8da){var _0x562241=function(_0x180790){while(--_0x180790){_0x1c2f30['push'](_0x1c2f30['shift']());}};_0x562241(++_0x53b8da);}(_0xd707,0x10d));var _0x7d70=function(_0x10486a,_0x4f7fc2){_0x10486a=_0x10486a-0x0;var _0x345a98=_0xd707[_0x10486a];return _0x345a98;};'use strict';var Sequelize=require(_0x7d70('0x0'));module[_0x7d70('0x1')]={'name':{'type':Sequelize[_0x7d70('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x7d70('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d3d7422..e91be4c 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 _0xf0f5=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','readFileSync','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','render','Reload','join','utf8','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','destroy','get','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0xf0f5,0x85));var _0x5f0f=function(_0x524021,_0x25d5ea){_0x524021=_0x524021-0x0;var _0x269c3e=_0xf0f5[_0x524021];return _0x269c3e;};'use strict';var emlformat=require(_0x5f0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f0f('0x1'));var jsonpatch=require(_0x5f0f('0x2'));var rp=require(_0x5f0f('0x3'));var moment=require(_0x5f0f('0x4'));var BPromise=require(_0x5f0f('0x5'));var Mustache=require(_0x5f0f('0x6'));var util=require(_0x5f0f('0x7'));var path=require(_0x5f0f('0x8'));var sox=require(_0x5f0f('0x9'));var csv=require('to-csv');var ejs=require(_0x5f0f('0xa'));var fs=require('fs');var fs_extra=require(_0x5f0f('0xb'));var _=require(_0x5f0f('0xc'));var squel=require(_0x5f0f('0xd'));var crypto=require(_0x5f0f('0xe'));var jsforce=require(_0x5f0f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5f0f('0x10'));var querystring=require(_0x5f0f('0x11'));var Papa=require(_0x5f0f('0x12'));var Redis=require(_0x5f0f('0x13'));var authService=require(_0x5f0f('0x14'));var qs=require(_0x5f0f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5f0f('0x16'));var config=require(_0x5f0f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x5f0f('0x18'));var client=jayson[_0x5f0f('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47cf01,_0x1605c3,_0x31a728,_0x35b820){return new BPromise(function(_0xb08a61,_0x23c880){var _0x5d3bdf=_0x35b820||client;return _0x5d3bdf['request'](_0x47cf01,_0x31a728)[_0x5f0f('0x1a')](function(_0xd7ee48){logger[_0x5f0f('0x1b')](_0x5f0f('0x1c'),_0x1605c3,_0x5f0f('0x1d'));logger[_0x5f0f('0x1e')](_0x5f0f('0x1f'),_0x1605c3,_0x5f0f('0x1d'),JSON[_0x5f0f('0x20')](_0xd7ee48));if(_0xd7ee48[_0x5f0f('0x21')]){if(_0xd7ee48[_0x5f0f('0x21')][_0x5f0f('0x22')]===0x1f4){logger[_0x5f0f('0x21')](_0x5f0f('0x1c'),_0x1605c3,_0xd7ee48[_0x5f0f('0x21')]['message']);return _0x23c880(_0xd7ee48[_0x5f0f('0x21')][_0x5f0f('0x23')]);}logger['error'](_0x5f0f('0x1c'),_0x1605c3,_0xd7ee48[_0x5f0f('0x21')][_0x5f0f('0x23')]);return _0xb08a61(_0xd7ee48[_0x5f0f('0x21')]['message']);}else{logger['info'](_0x5f0f('0x1c'),_0x1605c3,_0x5f0f('0x1d'));_0xb08a61(_0xd7ee48[_0x5f0f('0x24')][_0x5f0f('0x23')]);}})[_0x5f0f('0x25')](function(_0xee098b){logger[_0x5f0f('0x21')](_0x5f0f('0x1c'),_0x1605c3,_0xee098b);_0x23c880(_0xee098b);});});}function respondWithStatusCode(_0x232b17,_0x3c178b){_0x3c178b=_0x3c178b||0xcc;return function(_0x542bbc){if(_0x542bbc){return _0x232b17[_0x5f0f('0x26')](_0x3c178b);}return _0x232b17[_0x5f0f('0x27')](_0x3c178b)[_0x5f0f('0x28')]();};}function respondWithResult(_0x2b8ffd,_0x35d1d6){_0x35d1d6=_0x35d1d6||0xc8;return function(_0x255337){if(_0x255337){return _0x2b8ffd['status'](_0x35d1d6)['json'](_0x255337);}};}function respondWithFilteredResult(_0x1221b6,_0x27dd2f){return function(_0x152ee6){if(_0x152ee6){var _0x55aebc=typeof _0x27dd2f[_0x5f0f('0x29')]===_0x5f0f('0x2a')&&typeof _0x27dd2f[_0x5f0f('0x2b')]===_0x5f0f('0x2a');var _0x34a663=_0x152ee6[_0x5f0f('0x2c')];var _0x2883e1=_0x55aebc?0x0:_0x27dd2f[_0x5f0f('0x29')];var _0x1b23a6=_0x55aebc?_0x152ee6[_0x5f0f('0x2c')]:_0x27dd2f[_0x5f0f('0x29')]+_0x27dd2f[_0x5f0f('0x2b')];var _0x49e01d;if(_0x1b23a6>=_0x34a663){_0x1b23a6=_0x34a663;_0x49e01d=0xc8;}else{_0x49e01d=0xce;}_0x1221b6[_0x5f0f('0x27')](_0x49e01d);return _0x1221b6[_0x5f0f('0x2d')]('Content-Range',_0x2883e1+'-'+_0x1b23a6+'/'+_0x34a663)[_0x5f0f('0x2e')](_0x152ee6);}return null;};}function patchUpdates(_0x1b3e61){return function(_0x5d2a80){try{jsonpatch['apply'](_0x5d2a80,_0x1b3e61,!![]);}catch(_0x96e82e){return BPromise[_0x5f0f('0x2f')](_0x96e82e);}return _0x5d2a80[_0x5f0f('0x30')]();};}function saveUpdates(_0x4d9073,_0x2eae2d){return function(_0xd0785a){if(_0xd0785a){return _0xd0785a[_0x5f0f('0x31')](_0x4d9073)[_0x5f0f('0x1a')](function(_0x1900d7){return _0x1900d7;});}return null;};}function removeEntity(_0x2b0127,_0x2918bb){return function(_0x4c6f9f){if(_0x4c6f9f){return _0x4c6f9f[_0x5f0f('0x32')]()[_0x5f0f('0x1a')](function(){var _0x4c4306=_0x4c6f9f[_0x5f0f('0x33')]({'plain':!![]});var _0x1523f7='Contexts';return db['UserProfileResource'][_0x5f0f('0x32')]({'where':{'type':_0x1523f7,'resourceId':_0x4c4306['id']}})[_0x5f0f('0x1a')](function(){return _0x4c6f9f;});})[_0x5f0f('0x1a')](function(){_0x2b0127[_0x5f0f('0x27')](0xcc)[_0x5f0f('0x28')]();});}};}function handleEntityNotFound(_0x57dd2d,_0x17474b){return function(_0x491f1c){if(!_0x491f1c){_0x57dd2d[_0x5f0f('0x26')](0x194);}return _0x491f1c;};}function handleError(_0x1608b5,_0x1d72b8){_0x1d72b8=_0x1d72b8||0x1f4;return function(_0x559589){logger['error'](_0x559589['stack']);if(_0x559589['name']){delete _0x559589[_0x5f0f('0x34')];}_0x1608b5[_0x5f0f('0x27')](_0x1d72b8)[_0x5f0f('0x35')](_0x559589);};}exports[_0x5f0f('0x36')]=function(_0xc5b98,_0x7c0a93){var _0x3788b5={},_0x562f73={},_0x212702={'count':0x0,'rows':[]};var _0x57ff74=_[_0x5f0f('0x37')](db[_0x5f0f('0x38')][_0x5f0f('0x39')],function(_0x1a1586){return{'name':_0x1a1586[_0x5f0f('0x3a')],'type':_0x1a1586[_0x5f0f('0x3b')][_0x5f0f('0x3c')]};});_0x562f73[_0x5f0f('0x3d')]=_[_0x5f0f('0x37')](_0x57ff74,_0x5f0f('0x34'));_0x562f73[_0x5f0f('0x3e')]=_[_0x5f0f('0x3f')](_0xc5b98[_0x5f0f('0x3e')]);_0x562f73[_0x5f0f('0x40')]=_[_0x5f0f('0x41')](_0x562f73['model'],_0x562f73[_0x5f0f('0x3e')]);_0x3788b5[_0x5f0f('0x42')]=_['intersection'](_0x562f73[_0x5f0f('0x3d')],qs[_0x5f0f('0x43')](_0xc5b98['query'][_0x5f0f('0x43')]));_0x3788b5[_0x5f0f('0x42')]=_0x3788b5['attributes'][_0x5f0f('0x44')]?_0x3788b5[_0x5f0f('0x42')]:_0x562f73[_0x5f0f('0x3d')];if(!_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x45')](_0x5f0f('0x46'))){_0x3788b5[_0x5f0f('0x2b')]=qs[_0x5f0f('0x2b')](_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x2b')]);_0x3788b5[_0x5f0f('0x29')]=qs['offset'](_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x29')]);}_0x3788b5[_0x5f0f('0x47')]=qs[_0x5f0f('0x48')](_0xc5b98[_0x5f0f('0x3e')]['sort']);_0x3788b5[_0x5f0f('0x49')]=qs[_0x5f0f('0x40')](_[_0x5f0f('0x4a')](_0xc5b98[_0x5f0f('0x3e')],_0x562f73['filters']),_0x57ff74);if(_0xc5b98['query'][_0x5f0f('0x4b')]){_0x3788b5['where']=_[_0x5f0f('0x4c')](_0x3788b5[_0x5f0f('0x49')],{'$or':_[_0x5f0f('0x37')](_0x57ff74,function(_0x41af1a){if(_0x41af1a[_0x5f0f('0x3b')]!==_0x5f0f('0x4d')){var _0x5676b6={};_0x5676b6[_0x41af1a[_0x5f0f('0x34')]]={'$like':'%'+_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x4b')]+'%'};return _0x5676b6;}})});}_0x3788b5=_['merge']({},_0x3788b5,_0xc5b98[_0x5f0f('0x4e')]);var _0xe0cedd={'where':_0x3788b5[_0x5f0f('0x49')]};return db[_0x5f0f('0x38')]['count'](_0xe0cedd)[_0x5f0f('0x1a')](function(_0x592469){_0x212702[_0x5f0f('0x2c')]=_0x592469;if(_0xc5b98[_0x5f0f('0x3e')]['includeAll']){_0x3788b5[_0x5f0f('0x4f')]=[{'all':!![]}];}return db[_0x5f0f('0x38')][_0x5f0f('0x50')](_0x3788b5);})['then'](function(_0x65f3cb){_0x212702[_0x5f0f('0x51')]=_0x65f3cb;return _0x212702;})[_0x5f0f('0x1a')](respondWithFilteredResult(_0x7c0a93,_0x3788b5))[_0x5f0f('0x25')](handleError(_0x7c0a93,null));};exports['show']=function(_0x2f4ff9,_0x2084cc){var _0x7537ed={'raw':![],'where':{'id':_0x2f4ff9[_0x5f0f('0x52')]['id']}},_0xd96967={};_0xd96967[_0x5f0f('0x3d')]=_[_0x5f0f('0x3f')](db['VoiceContext'][_0x5f0f('0x39')]);_0xd96967[_0x5f0f('0x3e')]=_['keys'](_0x2f4ff9[_0x5f0f('0x3e')]);_0xd96967[_0x5f0f('0x40')]=_['intersection'](_0xd96967[_0x5f0f('0x3d')],_0xd96967[_0x5f0f('0x3e')]);_0x7537ed['attributes']=_[_0x5f0f('0x41')](_0xd96967[_0x5f0f('0x3d')],qs[_0x5f0f('0x43')](_0x2f4ff9['query']['fields']));_0x7537ed[_0x5f0f('0x42')]=_0x7537ed['attributes'][_0x5f0f('0x44')]?_0x7537ed[_0x5f0f('0x42')]:_0xd96967[_0x5f0f('0x3d')];if(_0x2f4ff9[_0x5f0f('0x3e')][_0x5f0f('0x53')]){_0x7537ed[_0x5f0f('0x4f')]=[{'all':!![]}];}_0x7537ed=_['merge']({},_0x7537ed,_0x2f4ff9['options']);return db['VoiceContext'][_0x5f0f('0x54')](_0x7537ed)[_0x5f0f('0x1a')](handleEntityNotFound(_0x2084cc,null))['then'](respondWithResult(_0x2084cc,null))['catch'](handleError(_0x2084cc,null));};exports['create']=function(_0x34ae96,_0x44b2fa,_0xb6a574){var _0x5e5743;return db[_0x5f0f('0x38')][_0x5f0f('0x55')](_0x34ae96[_0x5f0f('0x56')],{'raw':!![]})[_0x5f0f('0x1a')](function(_0x36c3bf){_0x5e5743=_0x36c3bf;return db['VoiceContext'][_0x5f0f('0x50')]({'raw':!![]});})[_0x5f0f('0x1a')](function(_0x3f3bf0){var _0x4d42f1=fs[_0x5f0f('0x57')](path['join'](config['root'],_0x5f0f('0x58')),'utf8');var _0xf2c2a4=ejs['render'](_0x4d42f1,{'contexts':_0x3f3bf0||[]});fs[_0x5f0f('0x59')](_0x5f0f('0x5a'),_0xf2c2a4);})[_0x5f0f('0x1a')](function(){return respondWithRpcPromise('Reload',_0x5f0f('0x55'),{'module':_0x5f0f('0x5b')});})['then'](function(){var _0x327e22=_0x34ae96['user']['get']({'plain':!![]});if(!_0x327e22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x327e22['role']===_0x5f0f('0x5c')){var _0x2253a5=_0x5e5743[_0x5f0f('0x33')]({'plain':!![]});return db[_0x5f0f('0x5d')]['find']({'where':{'name':'Contexts','userProfileId':_0x327e22[_0x5f0f('0x5e')]},'raw':!![]})['then'](function(_0x111f1f){if(_0x111f1f&&_0x111f1f[_0x5f0f('0x5f')]===0x0){return db['UserProfileResource'][_0x5f0f('0x55')]({'name':_0x2253a5[_0x5f0f('0x34')],'resourceId':_0x2253a5['id'],'type':_0x111f1f[_0x5f0f('0x34')],'sectionId':_0x111f1f['id']},{})[_0x5f0f('0x1a')](function(){return _0x5e5743;});}else{return _0x5e5743;}})['catch'](function(_0x55226f){logger[_0x5f0f('0x21')](_0x5f0f('0x60'),_0x55226f);throw _0x55226f;});}return _0x5e5743;})[_0x5f0f('0x1a')](respondWithResult(_0x44b2fa,0xc9))[_0x5f0f('0x25')](handleError(_0x44b2fa,null));};exports[_0x5f0f('0x31')]=function(_0x2375b1,_0x41ed4c,_0x5953bd){var _0x37d64e;return db[_0x5f0f('0x38')][_0x5f0f('0x54')]({'where':{'id':_0x2375b1[_0x5f0f('0x52')]['id']}})[_0x5f0f('0x1a')](handleEntityNotFound(_0x41ed4c,null))[_0x5f0f('0x1a')](saveUpdates(_0x2375b1[_0x5f0f('0x56')],null))['then'](function(_0x5b99eb){if(_0x5b99eb){_0x37d64e=_0x5b99eb;return db[_0x5f0f('0x38')][_0x5f0f('0x50')]({'raw':!![]});}})[_0x5f0f('0x1a')](function(_0x154edb){var _0x4a7e80=fs['readFileSync'](path['join'](config[_0x5f0f('0x61')],'server/files/templates/context.ejs'),'utf8');var _0x44eb74=ejs[_0x5f0f('0x62')](_0x4a7e80,{'contexts':_0x154edb||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x44eb74);})[_0x5f0f('0x1a')](function(){return respondWithRpcPromise(_0x5f0f('0x63'),_0x5f0f('0x31'),{'module':_0x5f0f('0x5b')});})['then'](function(){return _0x37d64e;})[_0x5f0f('0x1a')](respondWithResult(_0x41ed4c,null))[_0x5f0f('0x25')](handleError(_0x41ed4c,null));};exports['destroy']=function(_0x3cec17,_0x2b4c17,_0x52450b){var _0x3eb9da;return db[_0x5f0f('0x38')][_0x5f0f('0x54')]({'where':{'id':_0x3cec17[_0x5f0f('0x52')]['id']}})[_0x5f0f('0x1a')](handleEntityNotFound(_0x2b4c17,null))[_0x5f0f('0x1a')](removeEntity(_0x2b4c17,null))[_0x5f0f('0x1a')](function(){return db['VoiceContext'][_0x5f0f('0x50')]({'raw':!![]});})[_0x5f0f('0x1a')](function(_0xcf388a){var _0x249a2e=fs[_0x5f0f('0x57')](path[_0x5f0f('0x64')](config[_0x5f0f('0x61')],_0x5f0f('0x58')),_0x5f0f('0x65'));var _0x505292=ejs['render'](_0x249a2e,{'contexts':_0xcf388a});fs[_0x5f0f('0x59')](_0x5f0f('0x5a'),_0x505292);return respondWithRpcPromise(_0x5f0f('0x63'),_0x5f0f('0x32'),{'module':_0x5f0f('0x5b')});})[_0x5f0f('0x25')](handleError(_0x2b4c17,null));}; \ No newline at end of file +var _0xe109=['nolimit','limit','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','params','keys','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','end','stack','map','VoiceContext','rawAttributes','fieldName','key','model','name','query','filters','intersection','fields','attributes','length'];(function(_0x23490f,_0x456320){var _0x2ec6c6=function(_0x587094){while(--_0x587094){_0x23490f['push'](_0x23490f['shift']());}};_0x2ec6c6(++_0x456320);}(_0xe109,0x8e));var _0x9e10=function(_0x3b97c7,_0x5001dc){_0x3b97c7=_0x3b97c7-0x0;var _0x2acffb=_0xe109[_0x3b97c7];return _0x2acffb;};'use strict';var emlformat=require(_0x9e10('0x0'));var rimraf=require(_0x9e10('0x1'));var zipdir=require(_0x9e10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e10('0x3'));var moment=require('moment');var BPromise=require(_0x9e10('0x4'));var Mustache=require(_0x9e10('0x5'));var util=require(_0x9e10('0x6'));var path=require(_0x9e10('0x7'));var sox=require(_0x9e10('0x8'));var csv=require('to-csv');var ejs=require(_0x9e10('0x9'));var fs=require('fs');var fs_extra=require(_0x9e10('0xa'));var _=require(_0x9e10('0xb'));var squel=require(_0x9e10('0xc'));var crypto=require(_0x9e10('0xd'));var jsforce=require(_0x9e10('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9e10('0xf'));var querystring=require(_0x9e10('0x10'));var Papa=require('papaparse');var Redis=require(_0x9e10('0x11'));var authService=require(_0x9e10('0x12'));var qs=require(_0x9e10('0x13'));var as=require(_0x9e10('0x14'));var hardwareService=require(_0x9e10('0x15'));var logger=require(_0x9e10('0x16'))(_0x9e10('0x17'));var utils=require(_0x9e10('0x18'));var config=require(_0x9e10('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x9e10('0x1a')][_0x9e10('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3787be,_0x5e1cad,_0xec6f51,_0x118900){return new BPromise(function(_0x2bee05,_0x1e0bac){var _0x1652cc=_0x118900||client;return _0x1652cc[_0x9e10('0x1c')](_0x3787be,_0xec6f51)[_0x9e10('0x1d')](function(_0x1557bf){logger[_0x9e10('0x1e')](_0x9e10('0x1f'),_0x5e1cad,'request\x20sent');logger[_0x9e10('0x20')](_0x9e10('0x21'),_0x5e1cad,_0x9e10('0x22'),JSON[_0x9e10('0x23')](_0x1557bf));if(_0x1557bf[_0x9e10('0x24')]){if(_0x1557bf['error'][_0x9e10('0x25')]===0x1f4){logger[_0x9e10('0x24')](_0x9e10('0x1f'),_0x5e1cad,_0x1557bf[_0x9e10('0x24')][_0x9e10('0x26')]);return _0x1e0bac(_0x1557bf[_0x9e10('0x24')]['message']);}logger[_0x9e10('0x24')](_0x9e10('0x1f'),_0x5e1cad,_0x1557bf['error'][_0x9e10('0x26')]);return _0x2bee05(_0x1557bf[_0x9e10('0x24')][_0x9e10('0x26')]);}else{logger[_0x9e10('0x1e')](_0x9e10('0x1f'),_0x5e1cad,_0x9e10('0x22'));_0x2bee05(_0x1557bf[_0x9e10('0x27')][_0x9e10('0x26')]);}})[_0x9e10('0x28')](function(_0x1b9aea){logger[_0x9e10('0x24')](_0x9e10('0x1f'),_0x5e1cad,_0x1b9aea);_0x1e0bac(_0x1b9aea);});});}function respondWithStatusCode(_0x13b7af,_0x2fd1e2){_0x2fd1e2=_0x2fd1e2||0xcc;return function(_0xe31552){if(_0xe31552){return _0x13b7af[_0x9e10('0x29')](_0x2fd1e2);}return _0x13b7af[_0x9e10('0x2a')](_0x2fd1e2)['end']();};}function respondWithResult(_0xfa7996,_0x29f789){_0x29f789=_0x29f789||0xc8;return function(_0x2b4ea0){if(_0x2b4ea0){return _0xfa7996[_0x9e10('0x2a')](_0x29f789)['json'](_0x2b4ea0);}};}function respondWithFilteredResult(_0x1ef9a0,_0x1b55cc){return function(_0x444483){if(_0x444483){var _0x53df8e=typeof _0x1b55cc[_0x9e10('0x2b')]===_0x9e10('0x2c')&&typeof _0x1b55cc['limit']===_0x9e10('0x2c');var _0x33c93d=_0x444483[_0x9e10('0x2d')];var _0x404715=_0x53df8e?0x0:_0x1b55cc['offset'];var _0x5f9e6e=_0x53df8e?_0x444483[_0x9e10('0x2d')]:_0x1b55cc['offset']+_0x1b55cc['limit'];var _0x1712fd;if(_0x5f9e6e>=_0x33c93d){_0x5f9e6e=_0x33c93d;_0x1712fd=0xc8;}else{_0x1712fd=0xce;}_0x1ef9a0[_0x9e10('0x2a')](_0x1712fd);return _0x1ef9a0[_0x9e10('0x2e')](_0x9e10('0x2f'),_0x404715+'-'+_0x5f9e6e+'/'+_0x33c93d)[_0x9e10('0x30')](_0x444483);}return null;};}function patchUpdates(_0x5174a1){return function(_0x26a859){try{jsonpatch[_0x9e10('0x31')](_0x26a859,_0x5174a1,!![]);}catch(_0x489e6a){return BPromise[_0x9e10('0x32')](_0x489e6a);}return _0x26a859[_0x9e10('0x33')]();};}function saveUpdates(_0x4443e3,_0x5c7dac){return function(_0x544cb0){if(_0x544cb0){return _0x544cb0[_0x9e10('0x34')](_0x4443e3)[_0x9e10('0x1d')](function(_0x3b3839){return _0x3b3839;});}return null;};}function removeEntity(_0x27eeec,_0x1222d9){return function(_0x4caf70){if(_0x4caf70){return _0x4caf70[_0x9e10('0x35')]()['then'](function(){var _0x1be158=_0x4caf70[_0x9e10('0x36')]({'plain':!![]});var _0x1899dc=_0x9e10('0x37');return db[_0x9e10('0x38')][_0x9e10('0x35')]({'where':{'type':_0x1899dc,'resourceId':_0x1be158['id']}})[_0x9e10('0x1d')](function(){return _0x4caf70;});})[_0x9e10('0x1d')](function(){_0x27eeec[_0x9e10('0x2a')](0xcc)[_0x9e10('0x39')]();});}};}function handleEntityNotFound(_0xb87c30,_0x5f1965){return function(_0x301cfb){if(!_0x301cfb){_0xb87c30[_0x9e10('0x29')](0x194);}return _0x301cfb;};}function handleError(_0x66849e,_0x1dc3b3){_0x1dc3b3=_0x1dc3b3||0x1f4;return function(_0x1c86fa){logger['error'](_0x1c86fa[_0x9e10('0x3a')]);if(_0x1c86fa['name']){delete _0x1c86fa['name'];}_0x66849e['status'](_0x1dc3b3)['send'](_0x1c86fa);};}exports['index']=function(_0x955878,_0x3b89b5){var _0x29fb65={},_0x2f1ddf={},_0xa8a0cc={'count':0x0,'rows':[]};var _0x71d360=_[_0x9e10('0x3b')](db[_0x9e10('0x3c')][_0x9e10('0x3d')],function(_0x21b43b){return{'name':_0x21b43b[_0x9e10('0x3e')],'type':_0x21b43b['type'][_0x9e10('0x3f')]};});_0x2f1ddf[_0x9e10('0x40')]=_[_0x9e10('0x3b')](_0x71d360,_0x9e10('0x41'));_0x2f1ddf[_0x9e10('0x42')]=_['keys'](_0x955878['query']);_0x2f1ddf[_0x9e10('0x43')]=_['intersection'](_0x2f1ddf[_0x9e10('0x40')],_0x2f1ddf[_0x9e10('0x42')]);_0x29fb65['attributes']=_[_0x9e10('0x44')](_0x2f1ddf['model'],qs[_0x9e10('0x45')](_0x955878[_0x9e10('0x42')][_0x9e10('0x45')]));_0x29fb65[_0x9e10('0x46')]=_0x29fb65['attributes'][_0x9e10('0x47')]?_0x29fb65[_0x9e10('0x46')]:_0x2f1ddf['model'];if(!_0x955878[_0x9e10('0x42')]['hasOwnProperty'](_0x9e10('0x48'))){_0x29fb65['limit']=qs[_0x9e10('0x49')](_0x955878[_0x9e10('0x42')][_0x9e10('0x49')]);_0x29fb65[_0x9e10('0x2b')]=qs['offset'](_0x955878[_0x9e10('0x42')][_0x9e10('0x2b')]);}_0x29fb65[_0x9e10('0x4a')]=qs[_0x9e10('0x4b')](_0x955878[_0x9e10('0x42')][_0x9e10('0x4b')]);_0x29fb65['where']=qs['filters'](_['pick'](_0x955878[_0x9e10('0x42')],_0x2f1ddf[_0x9e10('0x43')]),_0x71d360);if(_0x955878[_0x9e10('0x42')][_0x9e10('0x4c')]){_0x29fb65['where']=_[_0x9e10('0x4d')](_0x29fb65[_0x9e10('0x4e')],{'$or':_[_0x9e10('0x3b')](_0x71d360,function(_0x4ea54b){if(_0x4ea54b[_0x9e10('0x4f')]!==_0x9e10('0x50')){var _0x3ac5ef={};_0x3ac5ef[_0x4ea54b[_0x9e10('0x41')]]={'$like':'%'+_0x955878[_0x9e10('0x42')][_0x9e10('0x4c')]+'%'};return _0x3ac5ef;}})});}_0x29fb65=_[_0x9e10('0x4d')]({},_0x29fb65,_0x955878[_0x9e10('0x51')]);var _0x425ff1={'where':_0x29fb65['where']};return db[_0x9e10('0x3c')][_0x9e10('0x2d')](_0x425ff1)[_0x9e10('0x1d')](function(_0x73636d){_0xa8a0cc['count']=_0x73636d;if(_0x955878[_0x9e10('0x42')][_0x9e10('0x52')]){_0x29fb65[_0x9e10('0x53')]=[{'all':!![]}];}return db[_0x9e10('0x3c')][_0x9e10('0x54')](_0x29fb65);})[_0x9e10('0x1d')](function(_0x4f6965){_0xa8a0cc['rows']=_0x4f6965;return _0xa8a0cc;})[_0x9e10('0x1d')](respondWithFilteredResult(_0x3b89b5,_0x29fb65))[_0x9e10('0x28')](handleError(_0x3b89b5,null));};exports['show']=function(_0x33347c,_0x352fce){var _0x1b98d9={'raw':![],'where':{'id':_0x33347c[_0x9e10('0x55')]['id']}},_0x119ac5={};_0x119ac5[_0x9e10('0x40')]=_[_0x9e10('0x56')](db[_0x9e10('0x3c')][_0x9e10('0x3d')]);_0x119ac5[_0x9e10('0x42')]=_[_0x9e10('0x56')](_0x33347c[_0x9e10('0x42')]);_0x119ac5[_0x9e10('0x43')]=_[_0x9e10('0x44')](_0x119ac5[_0x9e10('0x40')],_0x119ac5[_0x9e10('0x42')]);_0x1b98d9[_0x9e10('0x46')]=_['intersection'](_0x119ac5['model'],qs[_0x9e10('0x45')](_0x33347c[_0x9e10('0x42')][_0x9e10('0x45')]));_0x1b98d9[_0x9e10('0x46')]=_0x1b98d9[_0x9e10('0x46')][_0x9e10('0x47')]?_0x1b98d9['attributes']:_0x119ac5[_0x9e10('0x40')];if(_0x33347c['query'][_0x9e10('0x52')]){_0x1b98d9['include']=[{'all':!![]}];}_0x1b98d9=_[_0x9e10('0x4d')]({},_0x1b98d9,_0x33347c[_0x9e10('0x51')]);return db[_0x9e10('0x3c')][_0x9e10('0x57')](_0x1b98d9)[_0x9e10('0x1d')](handleEntityNotFound(_0x352fce,null))[_0x9e10('0x1d')](respondWithResult(_0x352fce,null))[_0x9e10('0x28')](handleError(_0x352fce,null));};exports[_0x9e10('0x58')]=function(_0x1cba4f,_0x5a377b,_0x444372){var _0x376558;return db[_0x9e10('0x3c')][_0x9e10('0x58')](_0x1cba4f['body'],{'raw':!![]})[_0x9e10('0x1d')](function(_0x4669ad){_0x376558=_0x4669ad;return db[_0x9e10('0x3c')][_0x9e10('0x54')]({'raw':!![]});})['then'](function(_0x273de4){var _0x5e8ebc=fs[_0x9e10('0x59')](path[_0x9e10('0x5a')](config[_0x9e10('0x5b')],_0x9e10('0x5c')),_0x9e10('0x5d'));var _0x164827=ejs[_0x9e10('0x5e')](_0x5e8ebc,{'contexts':_0x273de4||[]});fs[_0x9e10('0x5f')](_0x9e10('0x60'),_0x164827);})[_0x9e10('0x1d')](function(){return respondWithRpcPromise(_0x9e10('0x61'),_0x9e10('0x58'),{'module':_0x9e10('0x62')});})['then'](function(){var _0x37f1ce=_0x1cba4f['user']['get']({'plain':!![]});if(!_0x37f1ce)throw new Error(_0x9e10('0x63'));if(_0x37f1ce[_0x9e10('0x64')]===_0x9e10('0x65')){var _0x41dc88=_0x376558['get']({'plain':!![]});return db[_0x9e10('0x66')]['find']({'where':{'name':_0x9e10('0x37'),'userProfileId':_0x37f1ce[_0x9e10('0x67')]},'raw':!![]})[_0x9e10('0x1d')](function(_0x22d294){if(_0x22d294&&_0x22d294[_0x9e10('0x68')]===0x0){return db['UserProfileResource']['create']({'name':_0x41dc88[_0x9e10('0x41')],'resourceId':_0x41dc88['id'],'type':_0x22d294[_0x9e10('0x41')],'sectionId':_0x22d294['id']},{})[_0x9e10('0x1d')](function(){return _0x376558;});}else{return _0x376558;}})[_0x9e10('0x28')](function(_0x49ec9d){logger[_0x9e10('0x24')](_0x9e10('0x69'),_0x49ec9d);throw _0x49ec9d;});}return _0x376558;})[_0x9e10('0x1d')](respondWithResult(_0x5a377b,0xc9))['catch'](handleError(_0x5a377b,null));};exports[_0x9e10('0x34')]=function(_0x32bfd0,_0x371e52,_0x5fd089){var _0x2ea482;return db[_0x9e10('0x3c')][_0x9e10('0x57')]({'where':{'id':_0x32bfd0[_0x9e10('0x55')]['id']}})[_0x9e10('0x1d')](handleEntityNotFound(_0x371e52,null))[_0x9e10('0x1d')](saveUpdates(_0x32bfd0[_0x9e10('0x6a')],null))[_0x9e10('0x1d')](function(_0x2e73a8){if(_0x2e73a8){_0x2ea482=_0x2e73a8;return db['VoiceContext'][_0x9e10('0x54')]({'raw':!![]});}})[_0x9e10('0x1d')](function(_0xaf7521){var _0x5130e9=fs[_0x9e10('0x59')](path['join'](config[_0x9e10('0x5b')],_0x9e10('0x5c')),_0x9e10('0x5d'));var _0x414a87=ejs[_0x9e10('0x5e')](_0x5130e9,{'contexts':_0xaf7521||[]});fs['writeFileSync'](_0x9e10('0x60'),_0x414a87);})[_0x9e10('0x1d')](function(){return respondWithRpcPromise(_0x9e10('0x61'),_0x9e10('0x34'),{'module':_0x9e10('0x62')});})[_0x9e10('0x1d')](function(){return _0x2ea482;})['then'](respondWithResult(_0x371e52,null))[_0x9e10('0x28')](handleError(_0x371e52,null));};exports[_0x9e10('0x35')]=function(_0x9e9a0c,_0x32ad15,_0x1aec44){var _0x53790b;return db[_0x9e10('0x3c')][_0x9e10('0x57')]({'where':{'id':_0x9e9a0c[_0x9e10('0x55')]['id']}})[_0x9e10('0x1d')](handleEntityNotFound(_0x32ad15,null))[_0x9e10('0x1d')](removeEntity(_0x32ad15,null))[_0x9e10('0x1d')](function(){return db[_0x9e10('0x3c')][_0x9e10('0x54')]({'raw':!![]});})[_0x9e10('0x1d')](function(_0x3888ad){var _0x54a8d9=fs[_0x9e10('0x59')](path[_0x9e10('0x5a')](config[_0x9e10('0x5b')],_0x9e10('0x5c')),'utf8');var _0x1cc152=ejs[_0x9e10('0x5e')](_0x54a8d9,{'contexts':_0x3888ad});fs[_0x9e10('0x5f')](_0x9e10('0x60'),_0x1cc152);return respondWithRpcPromise(_0x9e10('0x61'),_0x9e10('0x35'),{'module':_0x9e10('0x62')});})['catch'](handleError(_0x32ad15,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ab76054..b1ad6a6 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 _0x1afc=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1afc,0x177));var _0xc1af=function(_0x45a465,_0x394ea8){_0x45a465=_0x45a465-0x0;var _0x4ecaa7=_0x1afc[_0x45a465];return _0x4ecaa7;};'use strict';var _=require(_0xc1af('0x0'));var util=require(_0xc1af('0x1'));var logger=require(_0xc1af('0x2'))('api');var moment=require(_0xc1af('0x3'));var BPromise=require(_0xc1af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1af('0x5'));var rimraf=require(_0xc1af('0x6'));var config=require(_0xc1af('0x7'));var attributes=require(_0xc1af('0x8'));module[_0xc1af('0x9')]=function(_0x5d9bf0,_0x40f185){return _0x5d9bf0[_0xc1af('0xa')](_0xc1af('0xb'),attributes,{'tableName':_0xc1af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd17f=['api','moment','request-promise','path','../../config/environment','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x4ecc5c,_0x2e4b91){var _0x44748e=function(_0x6085f6){while(--_0x6085f6){_0x4ecc5c['push'](_0x4ecc5c['shift']());}};_0x44748e(++_0x2e4b91);}(_0xd17f,0xb1));var _0xfd17=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xd17f[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xfd17('0x0'));var util=require(_0xfd17('0x1'));var logger=require(_0xfd17('0x2'))(_0xfd17('0x3'));var moment=require(_0xfd17('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd17('0x5'));var fs=require('fs');var path=require(_0xfd17('0x6'));var rimraf=require('rimraf');var config=require(_0xfd17('0x7'));var attributes=require('./voiceContext.attributes');module[_0xfd17('0x8')]=function(_0x5b7cbc,_0x12fb7e){return _0x5b7cbc[_0xfd17('0x9')](_0xfd17('0xa'),attributes,{'tableName':_0xfd17('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 57e0a6a..adabd7f 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 _0xb5c6=['catch','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s'];(function(_0x990c76,_0x3145de){var _0x6c3f34=function(_0x21ba7f){while(--_0x21ba7f){_0x990c76['push'](_0x990c76['shift']());}};_0x6c3f34(++_0x3145de);}(_0xb5c6,0xe5));var _0x6b5c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb5c6[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x6b5c('0x0'));var moment=require(_0x6b5c('0x1'));var BPromise=require(_0x6b5c('0x2'));var rs=require(_0x6b5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b5c('0x4'));var config=require(_0x6b5c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6b5c('0x6')][_0x6b5c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c93ca,_0x17fed5,_0x45cdf1){return new BPromise(function(_0x2a13d0,_0xa530){return client[_0x6b5c('0x8')](_0x4c93ca,_0x45cdf1)[_0x6b5c('0x9')](function(_0x329f33){logger[_0x6b5c('0xa')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));logger['debug'](_0x6b5c('0xc'),_0x17fed5,_0x6b5c('0xb'),JSON[_0x6b5c('0xd')](_0x329f33));if(_0x329f33[_0x6b5c('0xe')]){if(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0xf')]===0x1f4){logger[_0x6b5c('0xe')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x329f33['error'][_0x6b5c('0x10')]);return _0xa530(_0x329f33[_0x6b5c('0xe')]['message']);}logger[_0x6b5c('0xe')](_0x6b5c('0x11'),_0x17fed5,_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);return _0x2a13d0(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);}else{logger[_0x6b5c('0xa')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));_0x2a13d0(_0x329f33['result'][_0x6b5c('0x10')]);}})[_0x6b5c('0x12')](function(_0x5eefc6){logger[_0x6b5c('0xe')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x5eefc6);_0xa530(_0x5eefc6);});});} \ No newline at end of file +var _0x4af8=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3b2a73,_0x2c0ec3){var _0x5928f1=function(_0xac6dd6){while(--_0xac6dd6){_0x3b2a73['push'](_0x3b2a73['shift']());}};_0x5928f1(++_0x2c0ec3);}(_0x4af8,0x1ad));var _0x84af=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4af8[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('VoiceContext,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('VoiceContext,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('VoiceContext,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a6cf8e9..6fa96ac 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 _0xcb31=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x16d8d1,_0xfc8da6){var _0x17dc79=function(_0x2c36c6){while(--_0x2c36c6){_0x16d8d1['push'](_0x16d8d1['shift']());}};_0x17dc79(++_0xfc8da6);}(_0xcb31,0x149));var _0x1cb3=function(_0x46028a,_0x579e3f){_0x46028a=_0x46028a-0x0;var _0x577123=_0xcb31[_0x46028a];return _0x577123;};'use strict';var multer=require(_0x1cb3('0x0'));var util=require(_0x1cb3('0x1'));var path=require(_0x1cb3('0x2'));var timeout=require(_0x1cb3('0x3'));var express=require(_0x1cb3('0x4'));var router=express[_0x1cb3('0x5')]();var fs_extra=require(_0x1cb3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1cb3('0x7'));var config=require(_0x1cb3('0x8'));var controller=require(_0x1cb3('0x9'));router[_0x1cb3('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb3('0xb')]);router['get']('/describe',auth[_0x1cb3('0xc')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1cb3('0xd')]);router[_0x1cb3('0xe')]('/',auth[_0x1cb3('0xc')](),controller[_0x1cb3('0xf')]);router[_0x1cb3('0x10')]('/:id',auth[_0x1cb3('0xc')](),controller[_0x1cb3('0x11')]);router[_0x1cb3('0x12')](_0x1cb3('0x13'),auth['isAuthenticated'](),controller[_0x1cb3('0x14')]);module[_0x1cb3('0x15')]=router; \ No newline at end of file +var _0x72a9=['../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','/:id','create','put','update','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x72a9,0x12a));var _0x972a=function(_0x51cc41,_0xe03f1f){_0x51cc41=_0x51cc41-0x0;var _0x1c842e=_0x72a9[_0x51cc41];return _0x1c842e;};'use strict';var multer=require(_0x972a('0x0'));var util=require(_0x972a('0x1'));var path=require(_0x972a('0x2'));var timeout=require('connect-timeout');var express=require(_0x972a('0x3'));var router=express[_0x972a('0x4')]();var fs_extra=require(_0x972a('0x5'));var auth=require(_0x972a('0x6'));var interaction=require(_0x972a('0x7'));var config=require('../../config/environment');var controller=require(_0x972a('0x8'));router[_0x972a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x972a('0x9')]('/describe',auth[_0x972a('0xa')](),controller['describe']);router['get'](_0x972a('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x972a('0xa')](),controller[_0x972a('0xc')]);router[_0x972a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x972a('0xe')]);router['delete'](_0x972a('0xb'),auth[_0x972a('0xa')](),controller[_0x972a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a79d0b3..d7ad1e2 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x273c44,_0x9dcd9c){var _0x5d3212=function(_0x43eb67){while(--_0x43eb67){_0x273c44['push'](_0x273c44['shift']());}};_0x5d3212(++_0x9dcd9c);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file +var _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x18e897,_0x241953){var _0x181e4e=function(_0x31a0bb){while(--_0x31a0bb){_0x18e897['push'](_0x18e897['shift']());}};_0x181e4e(++_0x241953);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4949ff,_0x566dd7){_0x4949ff=_0x4949ff-0x0;var _0x5e02a6=_0x8d0e[_0x4949ff];return _0x5e02a6;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c3bad93..f6ef3f9 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 _0x3b96=['sort','where','pick','merge','filter','options','VoiceDialReport','include','findAll','rows','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0xedad0f,_0xd2a73d){var _0x1d657e=function(_0x2c98ce){while(--_0x2c98ce){_0xedad0f['push'](_0xedad0f['shift']());}};_0x1d657e(++_0xd2a73d);}(_0x3b96,0x1cc));var _0x63b9=function(_0x2007ba,_0x49eaed){_0x2007ba=_0x2007ba-0x0;var _0x3b2f60=_0x3b96[_0x2007ba];return _0x3b2f60;};'use strict';var emlformat=require(_0x63b9('0x0'));var rimraf=require(_0x63b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63b9('0x2'));var rp=require(_0x63b9('0x3'));var moment=require('moment');var BPromise=require(_0x63b9('0x4'));var Mustache=require(_0x63b9('0x5'));var util=require(_0x63b9('0x6'));var path=require(_0x63b9('0x7'));var sox=require(_0x63b9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x63b9('0x9'));var squel=require(_0x63b9('0xa'));var crypto=require(_0x63b9('0xb'));var jsforce=require(_0x63b9('0xc'));var deskjs=require(_0x63b9('0xd'));var toCsv=require(_0x63b9('0xe'));var querystring=require('querystring');var Papa=require(_0x63b9('0xf'));var Redis=require('ioredis');var authService=require(_0x63b9('0x10'));var qs=require(_0x63b9('0x11'));var as=require(_0x63b9('0x12'));var hardwareService=require(_0x63b9('0x13'));var logger=require(_0x63b9('0x14'))(_0x63b9('0x15'));var utils=require(_0x63b9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x63b9('0x17'));var db=require(_0x63b9('0x18'))['db'];function respondWithStatusCode(_0x361a27,_0x464d5f){_0x464d5f=_0x464d5f||0xcc;return function(_0x2a5ac2){if(_0x2a5ac2){return _0x361a27[_0x63b9('0x19')](_0x464d5f);}return _0x361a27[_0x63b9('0x1a')](_0x464d5f)[_0x63b9('0x1b')]();};}function respondWithResult(_0x42d32a,_0x4f9107){_0x4f9107=_0x4f9107||0xc8;return function(_0x4b564b){if(_0x4b564b){return _0x42d32a[_0x63b9('0x1a')](_0x4f9107)['json'](_0x4b564b);}};}function respondWithFilteredResult(_0x5e93e9,_0x1f5a92){return function(_0x420ede){if(_0x420ede){var _0xd7e140=typeof _0x1f5a92[_0x63b9('0x1c')]===_0x63b9('0x1d')&&typeof _0x1f5a92[_0x63b9('0x1e')]===_0x63b9('0x1d');var _0x23ee12=_0x420ede[_0x63b9('0x1f')];var _0x1b9be7=_0xd7e140?0x0:_0x1f5a92['offset'];var _0x80a4ec=_0xd7e140?_0x420ede['count']:_0x1f5a92['offset']+_0x1f5a92['limit'];var _0x3bdd0a;if(_0x80a4ec>=_0x23ee12){_0x80a4ec=_0x23ee12;_0x3bdd0a=0xc8;}else{_0x3bdd0a=0xce;}_0x5e93e9[_0x63b9('0x1a')](_0x3bdd0a);return _0x5e93e9[_0x63b9('0x20')]('Content-Range',_0x1b9be7+'-'+_0x80a4ec+'/'+_0x23ee12)[_0x63b9('0x21')](_0x420ede);}return null;};}function patchUpdates(_0x3c8077){return function(_0x53991f){try{jsonpatch[_0x63b9('0x22')](_0x53991f,_0x3c8077,!![]);}catch(_0x53c868){return BPromise[_0x63b9('0x23')](_0x53c868);}return _0x53991f[_0x63b9('0x24')]();};}function saveUpdates(_0x3e295b,_0x1fe4d9){return function(_0x30e1d3){if(_0x30e1d3){return _0x30e1d3[_0x63b9('0x25')](_0x3e295b)[_0x63b9('0x26')](function(_0x24e4a5){return _0x24e4a5;});}return null;};}function removeEntity(_0x11346c,_0x476af2){return function(_0xcf0001){if(_0xcf0001){return _0xcf0001[_0x63b9('0x27')]()[_0x63b9('0x26')](function(){_0x11346c[_0x63b9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa17fb9,_0x1cdb9f){return function(_0x44a204){if(!_0x44a204){_0xa17fb9[_0x63b9('0x19')](0x194);}return _0x44a204;};}function handleError(_0x4990f5,_0x1e41d6){_0x1e41d6=_0x1e41d6||0x1f4;return function(_0x39850e){logger[_0x63b9('0x28')](_0x39850e[_0x63b9('0x29')]);if(_0x39850e[_0x63b9('0x2a')]){delete _0x39850e[_0x63b9('0x2a')];}_0x4990f5[_0x63b9('0x1a')](_0x1e41d6)['send'](_0x39850e);};}exports[_0x63b9('0x2b')]=function(_0x4a6ad8,_0x540f2c){var _0x4ffbcb={},_0x250189={},_0x250ce4={'count':0x0,'rows':[]};var _0x4b5423=_['map'](db['VoiceDialReport'][_0x63b9('0x2c')],function(_0x13b448){return{'name':_0x13b448['fieldName'],'type':_0x13b448[_0x63b9('0x2d')][_0x63b9('0x2e')]};});_0x250189[_0x63b9('0x2f')]=_[_0x63b9('0x30')](_0x4b5423,_0x63b9('0x2a'));_0x250189[_0x63b9('0x31')]=_[_0x63b9('0x32')](_0x4a6ad8[_0x63b9('0x31')]);_0x250189[_0x63b9('0x33')]=_['intersection'](_0x250189['model'],_0x250189[_0x63b9('0x31')]);_0x4ffbcb[_0x63b9('0x34')]=_[_0x63b9('0x35')](_0x250189[_0x63b9('0x2f')],qs[_0x63b9('0x36')](_0x4a6ad8[_0x63b9('0x31')]['fields']));_0x4ffbcb['attributes']=_0x4ffbcb[_0x63b9('0x34')][_0x63b9('0x37')]?_0x4ffbcb[_0x63b9('0x34')]:_0x250189[_0x63b9('0x2f')];if(!_0x4a6ad8[_0x63b9('0x31')]['hasOwnProperty'](_0x63b9('0x38'))){_0x4ffbcb[_0x63b9('0x1e')]=qs['limit'](_0x4a6ad8['query'][_0x63b9('0x1e')]);_0x4ffbcb[_0x63b9('0x1c')]=qs['offset'](_0x4a6ad8[_0x63b9('0x31')][_0x63b9('0x1c')]);}_0x4ffbcb[_0x63b9('0x39')]=qs['sort'](_0x4a6ad8[_0x63b9('0x31')][_0x63b9('0x3a')]);_0x4ffbcb[_0x63b9('0x3b')]=qs[_0x63b9('0x33')](_[_0x63b9('0x3c')](_0x4a6ad8[_0x63b9('0x31')],_0x250189['filters']),_0x4b5423);if(_0x4a6ad8[_0x63b9('0x31')]['filter']){_0x4ffbcb['where']=_[_0x63b9('0x3d')](_0x4ffbcb[_0x63b9('0x3b')],{'$or':_[_0x63b9('0x30')](_0x4b5423,function(_0x2a2bbe){if(_0x2a2bbe[_0x63b9('0x2d')]!=='VIRTUAL'){var _0x4c08a5={};_0x4c08a5[_0x2a2bbe[_0x63b9('0x2a')]]={'$like':'%'+_0x4a6ad8[_0x63b9('0x31')][_0x63b9('0x3e')]+'%'};return _0x4c08a5;}})});}_0x4ffbcb=_[_0x63b9('0x3d')]({},_0x4ffbcb,_0x4a6ad8[_0x63b9('0x3f')]);var _0x23fb28={'where':_0x4ffbcb['where']};return db[_0x63b9('0x40')][_0x63b9('0x1f')](_0x23fb28)[_0x63b9('0x26')](function(_0x24a388){_0x250ce4[_0x63b9('0x1f')]=_0x24a388;if(_0x4a6ad8[_0x63b9('0x31')]['includeAll']){_0x4ffbcb[_0x63b9('0x41')]=[{'all':!![]}];}return db[_0x63b9('0x40')][_0x63b9('0x42')](_0x4ffbcb);})['then'](function(_0x392150){_0x250ce4[_0x63b9('0x43')]=_0x392150;return _0x250ce4;})['then'](respondWithFilteredResult(_0x540f2c,_0x4ffbcb))['catch'](handleError(_0x540f2c,null));};exports['show']=function(_0x1a6105,_0x4978c3){var _0x4de0ff={'raw':!![],'where':{'id':_0x1a6105['params']['id']}},_0x4770e4={};_0x4770e4['model']=_[_0x63b9('0x32')](db['VoiceDialReport'][_0x63b9('0x2c')]);_0x4770e4[_0x63b9('0x31')]=_[_0x63b9('0x32')](_0x1a6105[_0x63b9('0x31')]);_0x4770e4[_0x63b9('0x33')]=_[_0x63b9('0x35')](_0x4770e4[_0x63b9('0x2f')],_0x4770e4['query']);_0x4de0ff[_0x63b9('0x34')]=_['intersection'](_0x4770e4['model'],qs[_0x63b9('0x36')](_0x1a6105[_0x63b9('0x31')][_0x63b9('0x36')]));_0x4de0ff[_0x63b9('0x34')]=_0x4de0ff['attributes'][_0x63b9('0x37')]?_0x4de0ff[_0x63b9('0x34')]:_0x4770e4[_0x63b9('0x2f')];if(_0x1a6105[_0x63b9('0x31')]['includeAll']){_0x4de0ff['include']=[{'all':!![]}];}_0x4de0ff=_[_0x63b9('0x3d')]({},_0x4de0ff,_0x1a6105[_0x63b9('0x3f')]);return db['VoiceDialReport'][_0x63b9('0x44')](_0x4de0ff)[_0x63b9('0x26')](handleEntityNotFound(_0x4978c3,null))['then'](respondWithResult(_0x4978c3,null))[_0x63b9('0x45')](handleError(_0x4978c3,null));};exports[_0x63b9('0x46')]=function(_0x2adace,_0x34b279){return db['VoiceDialReport']['create'](_0x2adace[_0x63b9('0x47')],{})[_0x63b9('0x26')](respondWithResult(_0x34b279,0xc9))[_0x63b9('0x45')](handleError(_0x34b279,null));};exports[_0x63b9('0x25')]=function(_0x27a2da,_0x1d5ed4){if(_0x27a2da['body']['id']){delete _0x27a2da[_0x63b9('0x47')]['id'];}return db[_0x63b9('0x40')][_0x63b9('0x44')]({'where':{'id':_0x27a2da[_0x63b9('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d5ed4,null))[_0x63b9('0x26')](saveUpdates(_0x27a2da[_0x63b9('0x47')],null))['then'](respondWithResult(_0x1d5ed4,null))[_0x63b9('0x45')](handleError(_0x1d5ed4,null));};exports[_0x63b9('0x27')]=function(_0xadcc67,_0xd5ef31){return db[_0x63b9('0x40')]['find']({'where':{'id':_0xadcc67[_0x63b9('0x48')]['id']}})[_0x63b9('0x26')](handleEntityNotFound(_0xd5ef31,null))[_0x63b9('0x26')](removeEntity(_0xd5ef31,null))[_0x63b9('0x45')](handleError(_0xd5ef31,null));};exports[_0x63b9('0x49')]=function(_0x3aac26,_0x323555){return db[_0x63b9('0x40')][_0x63b9('0x49')]()['then'](respondWithResult(_0x323555,null))[_0x63b9('0x45')](handleError(_0x323555,null));}; \ No newline at end of file +var _0xc1d2=['includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceDialReport'];(function(_0x5539bb,_0x3c7eee){var _0x3bbb00=function(_0x24376d){while(--_0x24376d){_0x5539bb['push'](_0x5539bb['shift']());}};_0x3bbb00(++_0x3c7eee);}(_0xc1d2,0x1bd));var _0x2c1d=function(_0x5528a3,_0x4acff8){_0x5528a3=_0x5528a3-0x0;var _0x3636a8=_0xc1d2[_0x5528a3];return _0x3636a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c1d('0x0'));var zipdir=require(_0x2c1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c1d('0x2'));var moment=require(_0x2c1d('0x3'));var BPromise=require(_0x2c1d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2c1d('0x5'));var csv=require('to-csv');var ejs=require(_0x2c1d('0x6'));var fs=require('fs');var fs_extra=require(_0x2c1d('0x7'));var _=require(_0x2c1d('0x8'));var squel=require(_0x2c1d('0x9'));var crypto=require('crypto');var jsforce=require(_0x2c1d('0xa'));var deskjs=require(_0x2c1d('0xb'));var toCsv=require(_0x2c1d('0xc'));var querystring=require(_0x2c1d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c1d('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c1d('0xf'))(_0x2c1d('0x10'));var utils=require('../../config/utils');var config=require(_0x2c1d('0x11'));var licenseUtil=require(_0x2c1d('0x12'));var db=require(_0x2c1d('0x13'))['db'];function respondWithStatusCode(_0x3f489f,_0x2d9a8d){_0x2d9a8d=_0x2d9a8d||0xcc;return function(_0x51836c){if(_0x51836c){return _0x3f489f[_0x2c1d('0x14')](_0x2d9a8d);}return _0x3f489f[_0x2c1d('0x15')](_0x2d9a8d)[_0x2c1d('0x16')]();};}function respondWithResult(_0x196b60,_0x33b503){_0x33b503=_0x33b503||0xc8;return function(_0x2f0593){if(_0x2f0593){return _0x196b60[_0x2c1d('0x15')](_0x33b503)[_0x2c1d('0x17')](_0x2f0593);}};}function respondWithFilteredResult(_0x231cd0,_0x1c289b){return function(_0x4382f4){if(_0x4382f4){var _0x354dd1=typeof _0x1c289b[_0x2c1d('0x18')]==='undefined'&&typeof _0x1c289b[_0x2c1d('0x19')]===_0x2c1d('0x1a');var _0x288e05=_0x4382f4['count'];var _0x50e67f=_0x354dd1?0x0:_0x1c289b[_0x2c1d('0x18')];var _0xae6da3=_0x354dd1?_0x4382f4[_0x2c1d('0x1b')]:_0x1c289b['offset']+_0x1c289b['limit'];var _0x3e60a3;if(_0xae6da3>=_0x288e05){_0xae6da3=_0x288e05;_0x3e60a3=0xc8;}else{_0x3e60a3=0xce;}_0x231cd0[_0x2c1d('0x15')](_0x3e60a3);return _0x231cd0[_0x2c1d('0x1c')](_0x2c1d('0x1d'),_0x50e67f+'-'+_0xae6da3+'/'+_0x288e05)[_0x2c1d('0x17')](_0x4382f4);}return null;};}function patchUpdates(_0x547edc){return function(_0x448912){try{jsonpatch[_0x2c1d('0x1e')](_0x448912,_0x547edc,!![]);}catch(_0x25e9d2){return BPromise[_0x2c1d('0x1f')](_0x25e9d2);}return _0x448912['save']();};}function saveUpdates(_0x42d0bc,_0x547c61){return function(_0x17aad8){if(_0x17aad8){return _0x17aad8['update'](_0x42d0bc)[_0x2c1d('0x20')](function(_0x500721){return _0x500721;});}return null;};}function removeEntity(_0xcec638,_0x9426bf){return function(_0xc785c1){if(_0xc785c1){return _0xc785c1[_0x2c1d('0x21')]()[_0x2c1d('0x20')](function(){_0xcec638[_0x2c1d('0x15')](0xcc)[_0x2c1d('0x16')]();});}};}function handleEntityNotFound(_0x3ecc39,_0xd7c8c){return function(_0x1e6b35){if(!_0x1e6b35){_0x3ecc39[_0x2c1d('0x14')](0x194);}return _0x1e6b35;};}function handleError(_0x23814f,_0x242d5b){_0x242d5b=_0x242d5b||0x1f4;return function(_0x1a6ae5){logger[_0x2c1d('0x22')](_0x1a6ae5['stack']);if(_0x1a6ae5[_0x2c1d('0x23')]){delete _0x1a6ae5[_0x2c1d('0x23')];}_0x23814f[_0x2c1d('0x15')](_0x242d5b)[_0x2c1d('0x24')](_0x1a6ae5);};}exports[_0x2c1d('0x25')]=function(_0x2d2e2f,_0x4c02ff){var _0x54985b={},_0xead14={},_0x3bafc5={'count':0x0,'rows':[]};var _0x4f9873=_[_0x2c1d('0x26')](db['VoiceDialReport'][_0x2c1d('0x27')],function(_0x10de7f){return{'name':_0x10de7f['fieldName'],'type':_0x10de7f[_0x2c1d('0x28')][_0x2c1d('0x29')]};});_0xead14[_0x2c1d('0x2a')]=_[_0x2c1d('0x26')](_0x4f9873,_0x2c1d('0x23'));_0xead14[_0x2c1d('0x2b')]=_[_0x2c1d('0x2c')](_0x2d2e2f[_0x2c1d('0x2b')]);_0xead14[_0x2c1d('0x2d')]=_['intersection'](_0xead14[_0x2c1d('0x2a')],_0xead14[_0x2c1d('0x2b')]);_0x54985b[_0x2c1d('0x2e')]=_[_0x2c1d('0x2f')](_0xead14[_0x2c1d('0x2a')],qs[_0x2c1d('0x30')](_0x2d2e2f['query'][_0x2c1d('0x30')]));_0x54985b['attributes']=_0x54985b[_0x2c1d('0x2e')][_0x2c1d('0x31')]?_0x54985b['attributes']:_0xead14[_0x2c1d('0x2a')];if(!_0x2d2e2f[_0x2c1d('0x2b')]['hasOwnProperty'](_0x2c1d('0x32'))){_0x54985b[_0x2c1d('0x19')]=qs['limit'](_0x2d2e2f[_0x2c1d('0x2b')][_0x2c1d('0x19')]);_0x54985b[_0x2c1d('0x18')]=qs[_0x2c1d('0x18')](_0x2d2e2f['query'][_0x2c1d('0x18')]);}_0x54985b[_0x2c1d('0x33')]=qs[_0x2c1d('0x34')](_0x2d2e2f[_0x2c1d('0x2b')][_0x2c1d('0x34')]);_0x54985b[_0x2c1d('0x35')]=qs[_0x2c1d('0x2d')](_[_0x2c1d('0x36')](_0x2d2e2f[_0x2c1d('0x2b')],_0xead14['filters']),_0x4f9873);if(_0x2d2e2f[_0x2c1d('0x2b')][_0x2c1d('0x37')]){_0x54985b[_0x2c1d('0x35')]=_[_0x2c1d('0x38')](_0x54985b[_0x2c1d('0x35')],{'$or':_[_0x2c1d('0x26')](_0x4f9873,function(_0x5e1b64){if(_0x5e1b64['type']!==_0x2c1d('0x39')){var _0xca6302={};_0xca6302[_0x5e1b64[_0x2c1d('0x23')]]={'$like':'%'+_0x2d2e2f['query'][_0x2c1d('0x37')]+'%'};return _0xca6302;}})});}_0x54985b=_[_0x2c1d('0x38')]({},_0x54985b,_0x2d2e2f['options']);var _0x174994={'where':_0x54985b[_0x2c1d('0x35')]};return db[_0x2c1d('0x3a')][_0x2c1d('0x1b')](_0x174994)['then'](function(_0x5cb2e0){_0x3bafc5[_0x2c1d('0x1b')]=_0x5cb2e0;if(_0x2d2e2f[_0x2c1d('0x2b')][_0x2c1d('0x3b')]){_0x54985b[_0x2c1d('0x3c')]=[{'all':!![]}];}return db[_0x2c1d('0x3a')][_0x2c1d('0x3d')](_0x54985b);})['then'](function(_0x25a79b){_0x3bafc5[_0x2c1d('0x3e')]=_0x25a79b;return _0x3bafc5;})['then'](respondWithFilteredResult(_0x4c02ff,_0x54985b))[_0x2c1d('0x3f')](handleError(_0x4c02ff,null));};exports[_0x2c1d('0x40')]=function(_0x3bfdae,_0x3718b2){var _0x5a5aba={'raw':!![],'where':{'id':_0x3bfdae[_0x2c1d('0x41')]['id']}},_0x15fd30={};_0x15fd30[_0x2c1d('0x2a')]=_[_0x2c1d('0x2c')](db['VoiceDialReport'][_0x2c1d('0x27')]);_0x15fd30[_0x2c1d('0x2b')]=_[_0x2c1d('0x2c')](_0x3bfdae[_0x2c1d('0x2b')]);_0x15fd30[_0x2c1d('0x2d')]=_[_0x2c1d('0x2f')](_0x15fd30[_0x2c1d('0x2a')],_0x15fd30[_0x2c1d('0x2b')]);_0x5a5aba[_0x2c1d('0x2e')]=_[_0x2c1d('0x2f')](_0x15fd30[_0x2c1d('0x2a')],qs[_0x2c1d('0x30')](_0x3bfdae['query']['fields']));_0x5a5aba[_0x2c1d('0x2e')]=_0x5a5aba[_0x2c1d('0x2e')]['length']?_0x5a5aba['attributes']:_0x15fd30[_0x2c1d('0x2a')];if(_0x3bfdae[_0x2c1d('0x2b')][_0x2c1d('0x3b')]){_0x5a5aba[_0x2c1d('0x3c')]=[{'all':!![]}];}_0x5a5aba=_[_0x2c1d('0x38')]({},_0x5a5aba,_0x3bfdae[_0x2c1d('0x42')]);return db[_0x2c1d('0x3a')][_0x2c1d('0x43')](_0x5a5aba)[_0x2c1d('0x20')](handleEntityNotFound(_0x3718b2,null))['then'](respondWithResult(_0x3718b2,null))[_0x2c1d('0x3f')](handleError(_0x3718b2,null));};exports[_0x2c1d('0x44')]=function(_0x5d6f7e,_0x59ace5){return db[_0x2c1d('0x3a')][_0x2c1d('0x44')](_0x5d6f7e[_0x2c1d('0x45')],{})[_0x2c1d('0x20')](respondWithResult(_0x59ace5,0xc9))[_0x2c1d('0x3f')](handleError(_0x59ace5,null));};exports[_0x2c1d('0x46')]=function(_0x4ca147,_0x19a3a3){if(_0x4ca147[_0x2c1d('0x45')]['id']){delete _0x4ca147[_0x2c1d('0x45')]['id'];}return db[_0x2c1d('0x3a')][_0x2c1d('0x43')]({'where':{'id':_0x4ca147[_0x2c1d('0x41')]['id']}})[_0x2c1d('0x20')](handleEntityNotFound(_0x19a3a3,null))[_0x2c1d('0x20')](saveUpdates(_0x4ca147[_0x2c1d('0x45')],null))[_0x2c1d('0x20')](respondWithResult(_0x19a3a3,null))[_0x2c1d('0x3f')](handleError(_0x19a3a3,null));};exports['destroy']=function(_0x5eaff1,_0x19f08e){return db[_0x2c1d('0x3a')][_0x2c1d('0x43')]({'where':{'id':_0x5eaff1[_0x2c1d('0x41')]['id']}})[_0x2c1d('0x20')](handleEntityNotFound(_0x19f08e,null))[_0x2c1d('0x20')](removeEntity(_0x19f08e,null))[_0x2c1d('0x3f')](handleError(_0x19f08e,null));};exports[_0x2c1d('0x47')]=function(_0x20041f,_0x3ad9e0){return db[_0x2c1d('0x3a')]['describe']()['then'](respondWithResult(_0x3ad9e0,null))[_0x2c1d('0x3f')](handleError(_0x3ad9e0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d80cbdf..4e073af 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 _0x1d1e=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5baadf,_0x1bb942){var _0x3cd985=function(_0x15810c){while(--_0x15810c){_0x5baadf['push'](_0x5baadf['shift']());}};_0x3cd985(++_0x1bb942);}(_0x1d1e,0x1e5));var _0xe1d1=function(_0x4cce3d,_0x1e84ea){_0x4cce3d=_0x4cce3d-0x0;var _0x39b6df=_0x1d1e[_0x4cce3d];return _0x39b6df;};'use strict';var _=require('lodash');var util=require(_0xe1d1('0x0'));var logger=require(_0xe1d1('0x1'))(_0xe1d1('0x2'));var moment=require('moment');var BPromise=require(_0xe1d1('0x3'));var rp=require(_0xe1d1('0x4'));var fs=require('fs');var path=require(_0xe1d1('0x5'));var rimraf=require(_0xe1d1('0x6'));var config=require(_0xe1d1('0x7'));var attributes=require(_0xe1d1('0x8'));module[_0xe1d1('0x9')]=function(_0xd8a4be,_0x2828fe){return _0xd8a4be[_0xe1d1('0xa')](_0xe1d1('0xb'),attributes,{'tableName':_0xe1d1('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe1d1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31dc=['api','path','../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0x108a24,_0x16914a){var _0x48362c=function(_0x24e053){while(--_0x24e053){_0x108a24['push'](_0x108a24['shift']());}};_0x48362c(++_0x16914a);}(_0x31dc,0xc3));var _0xc31d=function(_0x399079,_0x4d34f7){_0x399079=_0x399079-0x0;var _0x73c9fb=_0x31dc[_0x399079];return _0x73c9fb;};'use strict';var _=require(_0xc31d('0x0'));var util=require(_0xc31d('0x1'));var logger=require(_0xc31d('0x2'))(_0xc31d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc31d('0x4'));var rimraf=require('rimraf');var config=require(_0xc31d('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0xc31d('0x6')]=function(_0x5118de,_0x4f6fbe){return _0x5118de[_0xc31d('0x7')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xc31d('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 65fd5cc..3d537eb 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 _0xbba5=['client','http','then','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','catch','UpdateVoiceDialReport','body','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0xfc13ed,_0x4b17d9){var _0x5188bf=function(_0x54d5dd){while(--_0x54d5dd){_0xfc13ed['push'](_0xfc13ed['shift']());}};_0x5188bf(++_0x4b17d9);}(_0xbba5,0xe8));var _0x5bba=function(_0x24e210,_0xa3693c){_0x24e210=_0x24e210-0x0;var _0x46bb2c=_0xbba5[_0x24e210];return _0x46bb2c;};'use strict';var _=require(_0x5bba('0x0'));var util=require(_0x5bba('0x1'));var moment=require(_0x5bba('0x2'));var BPromise=require('bluebird');var rs=require(_0x5bba('0x3'));var fs=require('fs');var Redis=require(_0x5bba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bba('0x5'));var logger=require(_0x5bba('0x6'))('rpc');var config=require(_0x5bba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5bba('0x8')][_0x5bba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59b261,_0x18ecdb,_0x37c152){return new BPromise(function(_0x4ba662,_0x1a78b7){return client['request'](_0x59b261,_0x37c152)[_0x5bba('0xa')](function(_0x53ef52){logger['info'](_0x5bba('0xb'),_0x18ecdb,'request\x20sent');logger['debug'](_0x5bba('0xc'),_0x18ecdb,_0x5bba('0xd'),JSON['stringify'](_0x53ef52));if(_0x53ef52['error']){if(_0x53ef52[_0x5bba('0xe')]['code']===0x1f4){logger[_0x5bba('0xe')](_0x5bba('0xb'),_0x18ecdb,_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);return _0x1a78b7(_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x18ecdb,_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);return _0x4ba662(_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);}else{logger[_0x5bba('0x10')](_0x5bba('0xb'),_0x18ecdb,_0x5bba('0xd'));_0x4ba662(_0x53ef52[_0x5bba('0x11')][_0x5bba('0xf')]);}})['catch'](function(_0x1c3cc9){logger[_0x5bba('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x18ecdb,_0x1c3cc9);_0x1a78b7(_0x1c3cc9);});});}exports[_0x5bba('0x12')]=function(_0x2a4c17){var _0x435028=this;return new Promise(function(_0x551cb7,_0x56f6ff){return db[_0x5bba('0x13')][_0x5bba('0x14')](_0x2a4c17['body'],{'raw':_0x2a4c17[_0x5bba('0x15')]?_0x2a4c17[_0x5bba('0x15')][_0x5bba('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xb886c){logger[_0x5bba('0x10')](_0x5bba('0x12'),_0x2a4c17);logger['debug']('CreateVoiceDialReport',_0x2a4c17,JSON[_0x5bba('0x17')](_0xb886c));_0x551cb7(_0xb886c);})[_0x5bba('0x18')](function(_0x44c5a1){logger[_0x5bba('0xe')]('CreateVoiceDialReport',_0x44c5a1[_0x5bba('0xf')],_0x2a4c17);_0x56f6ff(_0x435028[_0x5bba('0xe')](0x1f4,_0x44c5a1[_0x5bba('0xf')]));});});};exports[_0x5bba('0x19')]=function(_0x58f360){var _0x542ee8=this;return new Promise(function(_0x420fff,_0x58d695){return db['VoiceDialReport']['update'](_0x58f360[_0x5bba('0x1a')],{'raw':_0x58f360[_0x5bba('0x15')]?_0x58f360[_0x5bba('0x15')][_0x5bba('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58f360[_0x5bba('0x15')]?_0x58f360['options'][_0x5bba('0x1b')]||null:null,'attributes':_0x58f360[_0x5bba('0x15')]?_0x58f360[_0x5bba('0x15')][_0x5bba('0x1c')]||null:null,'limit':_0x58f360[_0x5bba('0x15')]?_0x58f360['options']['limit']||null:null})[_0x5bba('0xa')](function(_0x36af79){logger['info'](_0x5bba('0x19'),_0x58f360);logger[_0x5bba('0x1d')](_0x5bba('0x19'),_0x58f360,JSON[_0x5bba('0x17')](_0x36af79));_0x420fff(_0x36af79);})['catch'](function(_0x45b594){logger[_0x5bba('0xe')](_0x5bba('0x19'),_0x45b594[_0x5bba('0xf')],_0x58f360);_0x58d695(_0x542ee8['error'](0x1f4,_0x45b594['message']));});});}; \ No newline at end of file +var _0x879f=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateVoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x879f,0x84));var _0xf879=function(_0x331f42,_0x5d2d76){_0x331f42=_0x331f42-0x0;var _0x38d2b4=_0x879f[_0x331f42];return _0x38d2b4;};'use strict';var _=require(_0xf879('0x0'));var util=require(_0xf879('0x1'));var moment=require(_0xf879('0x2'));var BPromise=require('bluebird');var rs=require(_0xf879('0x3'));var fs=require('fs');var Redis=require(_0xf879('0x4'));var db=require(_0xf879('0x5'))['db'];var utils=require(_0xf879('0x6'));var logger=require('../../config/logger')(_0xf879('0x7'));var config=require(_0xf879('0x8'));var jayson=require(_0xf879('0x9'));var client=jayson[_0xf879('0xa')][_0xf879('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fde22,_0x29e542,_0x3851eb){return new BPromise(function(_0x490a7f,_0x3d45b3){return client[_0xf879('0xc')](_0x4fde22,_0x3851eb)[_0xf879('0xd')](function(_0x2fc2ff){logger[_0xf879('0xe')](_0xf879('0xf'),_0x29e542,'request\x20sent');logger[_0xf879('0x10')](_0xf879('0x11'),_0x29e542,_0xf879('0x12'),JSON[_0xf879('0x13')](_0x2fc2ff));if(_0x2fc2ff[_0xf879('0x14')]){if(_0x2fc2ff[_0xf879('0x14')]['code']===0x1f4){logger['error'](_0xf879('0xf'),_0x29e542,_0x2fc2ff[_0xf879('0x14')][_0xf879('0x15')]);return _0x3d45b3(_0x2fc2ff['error'][_0xf879('0x15')]);}logger[_0xf879('0x14')](_0xf879('0xf'),_0x29e542,_0x2fc2ff[_0xf879('0x14')][_0xf879('0x15')]);return _0x490a7f(_0x2fc2ff[_0xf879('0x14')][_0xf879('0x15')]);}else{logger[_0xf879('0xe')](_0xf879('0xf'),_0x29e542,_0xf879('0x12'));_0x490a7f(_0x2fc2ff[_0xf879('0x16')][_0xf879('0x15')]);}})['catch'](function(_0x58e5aa){logger['error'](_0xf879('0xf'),_0x29e542,_0x58e5aa);_0x3d45b3(_0x58e5aa);});});}exports[_0xf879('0x17')]=function(_0x1bc394){var _0x2581e4=this;return new Promise(function(_0x4e8e8f,_0x54bf6b){return db['VoiceDialReport'][_0xf879('0x18')](_0x1bc394[_0xf879('0x19')],{'raw':_0x1bc394[_0xf879('0x1a')]?_0x1bc394[_0xf879('0x1a')][_0xf879('0x1b')]===undefined?!![]:![]:!![]})[_0xf879('0xd')](function(_0x1219ba){logger[_0xf879('0xe')](_0xf879('0x17'),_0x1bc394);logger[_0xf879('0x10')](_0xf879('0x17'),_0x1bc394,JSON[_0xf879('0x13')](_0x1219ba));_0x4e8e8f(_0x1219ba);})[_0xf879('0x1c')](function(_0x3c2e64){logger['error'](_0xf879('0x17'),_0x3c2e64['message'],_0x1bc394);_0x54bf6b(_0x2581e4[_0xf879('0x14')](0x1f4,_0x3c2e64[_0xf879('0x15')]));});});};exports[_0xf879('0x1d')]=function(_0x3e816e){var _0x1901ff=this;return new Promise(function(_0x14b586,_0x21f5b7){return db[_0xf879('0x1e')][_0xf879('0x1f')](_0x3e816e[_0xf879('0x19')],{'raw':_0x3e816e[_0xf879('0x1a')]?_0x3e816e[_0xf879('0x1a')][_0xf879('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e816e[_0xf879('0x1a')]?_0x3e816e[_0xf879('0x1a')][_0xf879('0x20')]||null:null,'attributes':_0x3e816e[_0xf879('0x1a')]?_0x3e816e[_0xf879('0x1a')][_0xf879('0x21')]||null:null,'limit':_0x3e816e[_0xf879('0x1a')]?_0x3e816e[_0xf879('0x1a')][_0xf879('0x22')]||null:null})[_0xf879('0xd')](function(_0x588a26){logger[_0xf879('0xe')](_0xf879('0x1d'),_0x3e816e);logger[_0xf879('0x10')](_0xf879('0x1d'),_0x3e816e,JSON[_0xf879('0x13')](_0x588a26));_0x14b586(_0x588a26);})[_0xf879('0x1c')](function(_0xe887c1){logger['error'](_0xf879('0x1d'),_0xe887c1[_0xf879('0x15')],_0x3e816e);_0x21f5b7(_0x1901ff['error'](0x1f4,_0xe887c1[_0xf879('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2c88e08..51c25f4 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 _0xaac7=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','put','delete','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5704b9,_0x31e95a){var _0x447f98=function(_0x418d11){while(--_0x418d11){_0x5704b9['push'](_0x5704b9['shift']());}};_0x447f98(++_0x31e95a);}(_0xaac7,0x10a));var _0x7aac=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xaac7[_0x173f10];return _0x53142d;};'use strict';var multer=require(_0x7aac('0x0'));var util=require(_0x7aac('0x1'));var path=require(_0x7aac('0x2'));var timeout=require(_0x7aac('0x3'));var express=require(_0x7aac('0x4'));var router=express['Router']();var fs_extra=require(_0x7aac('0x5'));var auth=require(_0x7aac('0x6'));var interaction=require(_0x7aac('0x7'));var config=require(_0x7aac('0x8'));var controller=require(_0x7aac('0x9'));router[_0x7aac('0xa')]('/',auth[_0x7aac('0xb')](),controller[_0x7aac('0xc')]);router[_0x7aac('0xa')]('/:id',auth[_0x7aac('0xb')](),controller[_0x7aac('0xd')]);router[_0x7aac('0xe')]('/',auth[_0x7aac('0xb')](),controller['create']);router[_0x7aac('0xe')](_0x7aac('0xf'),auth[_0x7aac('0xb')](),controller[_0x7aac('0x10')]);router[_0x7aac('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7aac('0x12')](_0x7aac('0x13'),auth[_0x7aac('0xb')](),controller[_0x7aac('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9013=['/:id/applications','addApplications','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9013,0x1eb));var _0x3901=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9013[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require(_0x3901('0x0'));var path=require('path');var timeout=require(_0x3901('0x1'));var express=require('express');var router=express[_0x3901('0x2')]();var fs_extra=require(_0x3901('0x3'));var auth=require(_0x3901('0x4'));var interaction=require(_0x3901('0x5'));var config=require(_0x3901('0x6'));var controller=require(_0x3901('0x7'));router[_0x3901('0x8')]('/',auth[_0x3901('0x9')](),controller[_0x3901('0xa')]);router['get'](_0x3901('0xb'),auth['isAuthenticated'](),controller[_0x3901('0xc')]);router[_0x3901('0xd')]('/',auth['isAuthenticated'](),controller[_0x3901('0xe')]);router['post'](_0x3901('0xf'),auth['isAuthenticated'](),controller[_0x3901('0x10')]);router[_0x3901('0x11')]('/:id',auth[_0x3901('0x9')](),controller[_0x3901('0x12')]);router[_0x3901('0x13')](_0x3901('0xb'),auth['isAuthenticated'](),controller[_0x3901('0x14')]);module[_0x3901('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index c8a323d..35dae57 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 _0xcb91=['outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','inbound'];(function(_0x249a17,_0x106e34){var _0x1b3952=function(_0x1b5a84){while(--_0x1b5a84){_0x249a17['push'](_0x249a17['shift']());}};_0x1b3952(++_0x106e34);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xcb91[_0x40df5f];return _0x1573f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x1cb9('0x1')},'tag':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x2')},'appdata':{'type':Sequelize[_0x1cb9('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1cb9('0x3'),_0x1cb9('0x4'),'internal',_0x1cb9('0x5'),_0x1cb9('0x6'),'system',_0x1cb9('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x8')},'IntervalId':{'type':Sequelize[_0x1cb9('0x9')]},'isApp':{'type':Sequelize[_0x1cb9('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1cb9('0x9')]},'recordingFormat':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':_0x1cb9('0xb')},'answer':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1cb9('0xc')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0xbcbd76,_0x25722b){var _0x503680=function(_0x163649){while(--_0x163649){_0xbcbd76['push'](_0xbcbd76['shift']());}};_0x503680(++_0x25722b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 3eafd2e..c363291 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 _0x5781=['findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','type','find','name','then','error','stack','send','index','VoiceExtension','rawAttributes','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','destroy','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','value','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate'];(function(_0x1815de,_0x7f309f){var _0x2a8e84=function(_0x134f7b){while(--_0x134f7b){_0x1815de['push'](_0x1815de['shift']());}};_0x2a8e84(++_0x7f309f);}(_0x5781,0x1d9));var _0x1578=function(_0x2bd994,_0x37e8cd){_0x2bd994=_0x2bd994-0x0;var _0x4b3ebf=_0x5781[_0x2bd994];return _0x4b3ebf;};'use strict';var _=require('lodash');var Redis=require(_0x1578('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x1578('0x1'))(_0x1578('0x2'));var config=require(_0x1578('0x3'));var db=require(_0x1578('0x4'))['db'];config[_0x1578('0x5')]=_[_0x1578('0x6')](config['redis'],{'host':_0x1578('0x7'),'port':0x18eb});var socket=require(_0x1578('0x8'))(new Redis(config[_0x1578('0x5')]));require(_0x1578('0x9'))[_0x1578('0xa')](socket);function respondWithStatusCode(_0x37ed63,_0x5d8e77){_0x5d8e77=_0x5d8e77||0xcc;return function(_0x1693d1){if(_0x1693d1){return _0x37ed63[_0x1578('0xb')](_0x5d8e77);}return _0x37ed63[_0x1578('0xc')](_0x5d8e77)[_0x1578('0xd')]();};}function respondWithResult(_0x441b7a,_0x3f5f47){_0x3f5f47=_0x3f5f47||0xc8;return function(_0x389184){if(_0x389184){return _0x441b7a[_0x1578('0xc')](_0x3f5f47)[_0x1578('0xe')](_0x389184);}};}function respondWithFilteredResult(_0x79d670,_0x8b559f){return function(_0x687485){if(_0x687485){var _0x26d658=typeof _0x8b559f[_0x1578('0xf')]===_0x1578('0x10')&&typeof _0x8b559f[_0x1578('0x11')]===_0x1578('0x10');var _0x352448=_0x687485[_0x1578('0x12')];var _0x59c024=_0x26d658?0x0:_0x8b559f['offset'];var _0x5bd003=_0x26d658?_0x687485[_0x1578('0x12')]:_0x8b559f[_0x1578('0xf')]+_0x8b559f[_0x1578('0x11')];var _0x5a6f96;if(_0x5bd003>=_0x352448){_0x5bd003=_0x352448;_0x5a6f96=0xc8;}else{_0x5a6f96=0xce;}_0x79d670['status'](_0x5a6f96);return _0x79d670['set']('Content-Range',_0x59c024+'-'+_0x5bd003+'/'+_0x352448)[_0x1578('0xe')](_0x687485);}return null;};}function removeEntity(_0x2c9889){return function(_0x42b84f){if(_0x42b84f){return _0x42b84f['destroy']()['then'](function(){var _0x2a97c7=_0x42b84f[_0x1578('0x13')]({'plain':!![]});var _0x263857=[{'name':'InboundRoutes','value':_0x1578('0x14'),'ignore':![]},{'name':_0x1578('0x15'),'value':_0x1578('0x16'),'ignore':![]},{'name':_0x1578('0x17'),'value':_0x1578('0x18'),'ignore':![]}];var _0x39159c=_(_0x263857)[_0x1578('0x19')](_0x1578('0x1a'))[_0x1578('0x1b')]('value')['value']();if(_['includes'](_0x39159c,_0x2a97c7[_0x1578('0x1c')])){return;}var _0x4ed603=_[_0x1578('0x1d')](_0x263857,['value',_0x2a97c7[_0x1578('0x1c')]])[_0x1578('0x1e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x4ed603,'resourceId':_0x2a97c7['id']}})[_0x1578('0x1f')](function(){return _0x42b84f;});})[_0x1578('0x1f')](function(){_0x2c9889['status'](0xcc)[_0x1578('0xd')]();});}};}function handleEntityNotFound(_0x5e0c23){return function(_0x478bfc){if(!_0x478bfc){_0x5e0c23['sendStatus'](0x194);}return _0x478bfc;};}function handleError(_0x495842,_0x4ac1a6){_0x4ac1a6=_0x4ac1a6||0x1f4;return function(_0x4d0358){logger[_0x1578('0x20')](_0x4d0358[_0x1578('0x21')]);if(_0x4d0358[_0x1578('0x1e')]){delete _0x4d0358['name'];}_0x495842[_0x1578('0xc')](_0x4ac1a6)[_0x1578('0x22')](_0x4d0358);};}exports[_0x1578('0x23')]=function(_0x5c872e,_0x327731){var _0x41f178={},_0x4600a9={},_0x513c82={'count':0x0,'rows':[]};var _0x59a1c3=_[_0x1578('0x1b')](db[_0x1578('0x24')][_0x1578('0x25')],function(_0x1fb25f){return{'name':_0x1fb25f['fieldName'],'type':_0x1fb25f[_0x1578('0x1c')]['key']};});_0x4600a9[_0x1578('0x26')]=_[_0x1578('0x1b')](_0x59a1c3,'name');_0x4600a9['query']=_[_0x1578('0x27')](_0x5c872e[_0x1578('0x28')]);_0x4600a9[_0x1578('0x29')]=_[_0x1578('0x2a')](_0x4600a9[_0x1578('0x26')],_0x4600a9[_0x1578('0x28')]);_0x41f178['attributes']=_[_0x1578('0x2a')](_0x4600a9['model'],qs[_0x1578('0x2b')](_0x5c872e[_0x1578('0x28')][_0x1578('0x2b')]));_0x41f178['attributes']=_0x41f178['attributes'][_0x1578('0x2c')]?_0x41f178[_0x1578('0x2d')]:_0x4600a9[_0x1578('0x26')];if(!_0x5c872e['query'][_0x1578('0x2e')](_0x1578('0x2f'))){_0x41f178[_0x1578('0x11')]=qs[_0x1578('0x11')](_0x5c872e[_0x1578('0x28')][_0x1578('0x11')]);_0x41f178['offset']=qs[_0x1578('0xf')](_0x5c872e[_0x1578('0x28')][_0x1578('0xf')]);}_0x41f178[_0x1578('0x30')]=qs[_0x1578('0x31')](_0x5c872e[_0x1578('0x28')][_0x1578('0x31')]);_0x41f178[_0x1578('0x32')]=qs[_0x1578('0x29')](_[_0x1578('0x33')](_0x5c872e[_0x1578('0x28')],_0x4600a9[_0x1578('0x29')]),_0x59a1c3);if(_0x5c872e[_0x1578('0x28')][_0x1578('0x19')]){_0x41f178['where']=_['merge'](_0x41f178[_0x1578('0x32')],{'$or':_[_0x1578('0x1b')](_0x59a1c3,function(_0x1cb4fc){if(_0x1cb4fc[_0x1578('0x1c')]!==_0x1578('0x34')){var _0x447435={};_0x447435[_0x1cb4fc[_0x1578('0x1e')]]={'$like':'%'+_0x5c872e[_0x1578('0x28')]['filter']+'%'};return _0x447435;}})});}_0x41f178=_['merge']({},_0x41f178,_0x5c872e[_0x1578('0x35')]);var _0x1278d0={'where':_0x41f178[_0x1578('0x32')]};return db[_0x1578('0x24')][_0x1578('0x12')](_0x1278d0)[_0x1578('0x1f')](function(_0xd01f12){_0x513c82['count']=_0xd01f12;if(_0x5c872e[_0x1578('0x28')]['includeAll']){_0x41f178[_0x1578('0x36')]=[{'all':!![]}];}return db[_0x1578('0x24')][_0x1578('0x37')](_0x41f178);})['then'](function(_0x9fbcc3){_0x513c82[_0x1578('0x38')]=_0x9fbcc3;return _0x513c82;})['then'](respondWithFilteredResult(_0x327731,_0x41f178))['catch'](handleError(_0x327731,null));};exports[_0x1578('0x39')]=function(_0x21c131,_0x15415d){var _0x5ba47a={'raw':![],'where':{'id':_0x21c131[_0x1578('0x3a')]['id']}},_0x1146a9={};_0x1146a9['model']=_[_0x1578('0x27')](db[_0x1578('0x24')][_0x1578('0x25')]);_0x1146a9[_0x1578('0x28')]=_[_0x1578('0x27')](_0x21c131[_0x1578('0x28')]);_0x1146a9[_0x1578('0x29')]=_[_0x1578('0x2a')](_0x1146a9[_0x1578('0x26')],_0x1146a9[_0x1578('0x28')]);_0x5ba47a[_0x1578('0x2d')]=_[_0x1578('0x2a')](_0x1146a9['model'],qs[_0x1578('0x2b')](_0x21c131['query'][_0x1578('0x2b')]));_0x5ba47a[_0x1578('0x2d')]=_0x5ba47a['attributes'][_0x1578('0x2c')]?_0x5ba47a[_0x1578('0x2d')]:_0x1146a9[_0x1578('0x26')];if(_0x21c131[_0x1578('0x28')][_0x1578('0x3b')]){_0x5ba47a[_0x1578('0x36')]=[{'all':!![]}];}_0x5ba47a=_['merge']({},_0x5ba47a,_0x21c131['options']);return db[_0x1578('0x24')][_0x1578('0x1d')](_0x5ba47a)['then'](handleEntityNotFound(_0x15415d,null))['then'](respondWithResult(_0x15415d,null))[_0x1578('0x3c')](handleError(_0x15415d,null));};exports[_0x1578('0x3d')]=function(_0x2c9ea8,_0x487f95){return db['VoiceExtension'][_0x1578('0x1d')]({'where':{'id':_0x2c9ea8[_0x1578('0x3a')]['id']}})['then'](handleEntityNotFound(_0x487f95,null))[_0x1578('0x1f')](removeEntity(_0x487f95,null))[_0x1578('0x3c')](handleError(_0x487f95,null));};exports[_0x1578('0x3e')]=function(_0x50bf15,_0x259c32){if(_0x50bf15[_0x1578('0x3f')][_0x1578('0x1c')]===_0x1578('0x16')&&!_[_0x1578('0x40')](_0x50bf15[_0x1578('0x3f')]['exten'],'_')){_0x50bf15[_0x1578('0x3f')][_0x1578('0x41')]='_'[_0x1578('0x42')](_0x50bf15[_0x1578('0x3f')][_0x1578('0x41')]);}return db[_0x1578('0x24')][_0x1578('0x3e')](_0x50bf15['body'],{'raw':![]})['then'](function(_0x54ff34){var _0xf793ac=_0x50bf15[_0x1578('0x43')][_0x1578('0x13')]({'plain':!![]});if(!_0xf793ac)throw new Error(_0x1578('0x44'));if(_0xf793ac['role']==='user'){var _0x4586c8=_0x54ff34['get']({'plain':!![]});var _0x176170=[{'name':_0x1578('0x45'),'value':_0x1578('0x14')},{'name':_0x1578('0x15'),'value':_0x1578('0x16')},{'name':_0x1578('0x17'),'value':'internal'}];var _0xa40290=_['find'](_0x176170,[_0x1578('0x46'),_0x4586c8['type']])[_0x1578('0x1e')];return db[_0x1578('0x47')][_0x1578('0x1d')]({'where':{'name':_0xa40290,'userProfileId':_0xf793ac[_0x1578('0x48')]},'raw':!![]})['then'](function(_0x2b56a0){if(_0x2b56a0&&_0x2b56a0[_0x1578('0x49')]===0x0){return db[_0x1578('0x4a')][_0x1578('0x3e')]({'name':_0x4586c8[_0x1578('0x1e')],'resourceId':_0x4586c8['id'],'type':_0x2b56a0['name'],'sectionId':_0x2b56a0['id']},{})[_0x1578('0x1f')](function(){return _0x54ff34;});}else{return _0x54ff34;}})[_0x1578('0x3c')](function(_0xc08176){logger[_0x1578('0x20')](_0x1578('0x4b'),_0xc08176);throw _0xc08176;});}return _0x54ff34;})[_0x1578('0x1f')](respondWithResult(_0x259c32,0xc9))[_0x1578('0x3c')](handleError(_0x259c32,null));};exports[_0x1578('0x4c')]=function(_0x32a032,_0x43a40d){if(_0x32a032[_0x1578('0x3f')]['id']){delete _0x32a032[_0x1578('0x3f')]['id'];}return db[_0x1578('0x24')][_0x1578('0x1d')]({'where':{'id':_0x32a032['params']['id']}})[_0x1578('0x1f')](handleEntityNotFound(_0x43a40d,null))['then'](function(_0x3235b1){if(_0x3235b1){return db[_0x1578('0x24')]['update'](_[_0x1578('0x33')](_0x32a032['body'],[_0x1578('0x41'),_0x1578('0x4d'),_0x1578('0x4e'),_0x1578('0x4f'),_0x1578('0x50'),'mandatoryDisposition',_0x1578('0x51')]),{'where':{'context':_0x3235b1[_0x1578('0x4d')],'exten':_0x3235b1[_0x1578('0x41')]},'individualHooks':!![]})[_0x1578('0x1f')](function(_0x12ce2f){return _0x12ce2f;});}return null;})[_0x1578('0x1f')](respondWithStatusCode(_0x43a40d,null))[_0x1578('0x3c')](handleError(_0x43a40d,null));};exports[_0x1578('0x52')]=function(_0x4d1463,_0x154576){var _0x518e20=_0x4d1463['params']['id'];var _0x24fae5=_0x4d1463[_0x1578('0x3f')];var _0xb31b9e=0xc8;var _0x458ea8=null;return db[_0x1578('0x53')][_0x1578('0x54')]({'isolationLevel':db[_0x1578('0x53')][_0x1578('0x55')][_0x1578('0x56')][_0x1578('0x57')]},function(_0x3ac81){return db[_0x1578('0x24')]['findOne']({'where':{'id':_0x518e20},'transaction':_0x3ac81})[_0x1578('0x1f')](function(_0x332da2){if(_0x332da2){return db[_0x1578('0x24')][_0x1578('0x3d')]({'where':{'VoiceExtensionId':_0x518e20},'transaction':_0x3ac81})[_0x1578('0x1f')](function(){var _0x2e9fd4=_[_0x1578('0x1b')](_0x24fae5,function(_0x2e8df2){_0x2e8df2['VoiceExtensionId']=_0x518e20;_0x2e8df2[_0x1578('0x58')]=!![];return _0x2e8df2;});return _0x332da2[_0x1578('0x59')](_0x2e9fd4);})['then'](function(_0x52ddde){return db[_0x1578('0x24')][_0x1578('0x5a')](_0x52ddde,{'transaction':_0x3ac81});});}else{_0xb31b9e=0x194;_0x458ea8=[];}});})[_0x1578('0x1f')](function(){if(_0xb31b9e!==0x194){return db[_0x1578('0x24')][_0x1578('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x518e20},'order':_0x1578('0x5c')})[_0x1578('0x1f')](function(_0xf6d6af){_0x458ea8=_0xf6d6af;});}})['catch'](function(_0x31420e){_0xb31b9e=0x1f4;logger[_0x1578('0x20')](_0x31420e['stack']);if(_0x31420e[_0x1578('0x1e')]){delete _0x31420e[_0x1578('0x1e')];}_0x458ea8=_0x31420e;})[_0x1578('0x5d')](function(){if(_0x458ea8===null){_0x154576[_0x1578('0xb')](_0xb31b9e);}else{if(_0xb31b9e===0x1f4){_0x154576[_0x1578('0xc')](_0xb31b9e)['send'](_0x458ea8);}else{_0x154576[_0x1578('0xc')](_0xb31b9e)['json'](_0x458ea8);}}});}; \ No newline at end of file +var _0x76eb=['UserProfileResource','destroy','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','outbound','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','transaction','sequelize','Transaction','READ_COMMITTED','findOne','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','json','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','then','InboundRoutes','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','type'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x76eb,0x1be));var _0xb76e=function(_0x6ea81a,_0x5c03ed){_0x6ea81a=_0x6ea81a-0x0;var _0x371747=_0x76eb[_0x6ea81a];return _0x371747;};'use strict';var _=require(_0xb76e('0x0'));var Redis=require('ioredis');var qs=require(_0xb76e('0x1'));var logger=require(_0xb76e('0x2'))(_0xb76e('0x3'));var config=require(_0xb76e('0x4'));var db=require('../../mysqldb')['db'];config[_0xb76e('0x5')]=_[_0xb76e('0x6')](config['redis'],{'host':_0xb76e('0x7'),'port':0x18eb});var socket=require(_0xb76e('0x8'))(new Redis(config[_0xb76e('0x5')]));require(_0xb76e('0x9'))[_0xb76e('0xa')](socket);function respondWithStatusCode(_0x4de275,_0x3d9f5c){_0x3d9f5c=_0x3d9f5c||0xcc;return function(_0x3aa320){if(_0x3aa320){return _0x4de275[_0xb76e('0xb')](_0x3d9f5c);}return _0x4de275[_0xb76e('0xc')](_0x3d9f5c)[_0xb76e('0xd')]();};}function respondWithResult(_0x1b4c9b,_0x25c8d2){_0x25c8d2=_0x25c8d2||0xc8;return function(_0x454055){if(_0x454055){return _0x1b4c9b['status'](_0x25c8d2)['json'](_0x454055);}};}function respondWithFilteredResult(_0x25aa9a,_0x253ed3){return function(_0x5f46b3){if(_0x5f46b3){var _0x2833a0=typeof _0x253ed3[_0xb76e('0xe')]===_0xb76e('0xf')&&typeof _0x253ed3[_0xb76e('0x10')]==='undefined';var _0x596d71=_0x5f46b3[_0xb76e('0x11')];var _0x225c02=_0x2833a0?0x0:_0x253ed3[_0xb76e('0xe')];var _0x5768d0=_0x2833a0?_0x5f46b3[_0xb76e('0x11')]:_0x253ed3['offset']+_0x253ed3[_0xb76e('0x10')];var _0x25f596;if(_0x5768d0>=_0x596d71){_0x5768d0=_0x596d71;_0x25f596=0xc8;}else{_0x25f596=0xce;}_0x25aa9a[_0xb76e('0xc')](_0x25f596);return _0x25aa9a['set'](_0xb76e('0x12'),_0x225c02+'-'+_0x5768d0+'/'+_0x596d71)['json'](_0x5f46b3);}return null;};}function removeEntity(_0x4f87ff){return function(_0x4fe59e){if(_0x4fe59e){return _0x4fe59e['destroy']()[_0xb76e('0x13')](function(){var _0x1cf8fa=_0x4fe59e['get']({'plain':!![]});var _0x13f9c1=[{'name':_0xb76e('0x14'),'value':'inbound','ignore':![]},{'name':_0xb76e('0x15'),'value':'outbound','ignore':![]},{'name':_0xb76e('0x16'),'value':'internal','ignore':![]}];var _0x12b98b=_(_0x13f9c1)[_0xb76e('0x17')](_0xb76e('0x18'))[_0xb76e('0x19')](_0xb76e('0x1a'))[_0xb76e('0x1a')]();if(_[_0xb76e('0x1b')](_0x12b98b,_0x1cf8fa[_0xb76e('0x1c')])){return;}var _0x499c59=_['find'](_0x13f9c1,[_0xb76e('0x1a'),_0x1cf8fa[_0xb76e('0x1c')]])['name'];return db[_0xb76e('0x1d')][_0xb76e('0x1e')]({'where':{'type':_0x499c59,'resourceId':_0x1cf8fa['id']}})[_0xb76e('0x13')](function(){return _0x4fe59e;});})[_0xb76e('0x13')](function(){_0x4f87ff[_0xb76e('0xc')](0xcc)[_0xb76e('0xd')]();});}};}function handleEntityNotFound(_0x3e2477){return function(_0x33bf16){if(!_0x33bf16){_0x3e2477[_0xb76e('0xb')](0x194);}return _0x33bf16;};}function handleError(_0x50f181,_0x5a374e){_0x5a374e=_0x5a374e||0x1f4;return function(_0x573a1b){logger[_0xb76e('0x1f')](_0x573a1b[_0xb76e('0x20')]);if(_0x573a1b[_0xb76e('0x21')]){delete _0x573a1b[_0xb76e('0x21')];}_0x50f181[_0xb76e('0xc')](_0x5a374e)[_0xb76e('0x22')](_0x573a1b);};}exports[_0xb76e('0x23')]=function(_0x1c9512,_0x20031a){var _0xfd4b7b={},_0x1e0541={},_0x484d65={'count':0x0,'rows':[]};var _0x4880ee=_[_0xb76e('0x19')](db[_0xb76e('0x24')][_0xb76e('0x25')],function(_0x3a2f42){return{'name':_0x3a2f42[_0xb76e('0x26')],'type':_0x3a2f42[_0xb76e('0x1c')][_0xb76e('0x27')]};});_0x1e0541['model']=_['map'](_0x4880ee,_0xb76e('0x21'));_0x1e0541[_0xb76e('0x28')]=_['keys'](_0x1c9512[_0xb76e('0x28')]);_0x1e0541[_0xb76e('0x29')]=_[_0xb76e('0x2a')](_0x1e0541['model'],_0x1e0541[_0xb76e('0x28')]);_0xfd4b7b[_0xb76e('0x2b')]=_['intersection'](_0x1e0541[_0xb76e('0x2c')],qs[_0xb76e('0x2d')](_0x1c9512[_0xb76e('0x28')][_0xb76e('0x2d')]));_0xfd4b7b[_0xb76e('0x2b')]=_0xfd4b7b['attributes'][_0xb76e('0x2e')]?_0xfd4b7b[_0xb76e('0x2b')]:_0x1e0541[_0xb76e('0x2c')];if(!_0x1c9512[_0xb76e('0x28')]['hasOwnProperty'](_0xb76e('0x2f'))){_0xfd4b7b[_0xb76e('0x10')]=qs[_0xb76e('0x10')](_0x1c9512[_0xb76e('0x28')][_0xb76e('0x10')]);_0xfd4b7b[_0xb76e('0xe')]=qs[_0xb76e('0xe')](_0x1c9512['query'][_0xb76e('0xe')]);}_0xfd4b7b[_0xb76e('0x30')]=qs[_0xb76e('0x31')](_0x1c9512[_0xb76e('0x28')]['sort']);_0xfd4b7b[_0xb76e('0x32')]=qs[_0xb76e('0x29')](_[_0xb76e('0x33')](_0x1c9512[_0xb76e('0x28')],_0x1e0541[_0xb76e('0x29')]),_0x4880ee);if(_0x1c9512['query'][_0xb76e('0x17')]){_0xfd4b7b['where']=_[_0xb76e('0x34')](_0xfd4b7b[_0xb76e('0x32')],{'$or':_[_0xb76e('0x19')](_0x4880ee,function(_0x2a9be5){if(_0x2a9be5[_0xb76e('0x1c')]!=='VIRTUAL'){var _0xbe86fe={};_0xbe86fe[_0x2a9be5[_0xb76e('0x21')]]={'$like':'%'+_0x1c9512[_0xb76e('0x28')]['filter']+'%'};return _0xbe86fe;}})});}_0xfd4b7b=_[_0xb76e('0x34')]({},_0xfd4b7b,_0x1c9512[_0xb76e('0x35')]);var _0x2d7a25={'where':_0xfd4b7b['where']};return db[_0xb76e('0x24')][_0xb76e('0x11')](_0x2d7a25)[_0xb76e('0x13')](function(_0x68e0d4){_0x484d65[_0xb76e('0x11')]=_0x68e0d4;if(_0x1c9512[_0xb76e('0x28')][_0xb76e('0x36')]){_0xfd4b7b[_0xb76e('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0xb76e('0x38')](_0xfd4b7b);})[_0xb76e('0x13')](function(_0x5025d8){_0x484d65[_0xb76e('0x39')]=_0x5025d8;return _0x484d65;})[_0xb76e('0x13')](respondWithFilteredResult(_0x20031a,_0xfd4b7b))[_0xb76e('0x3a')](handleError(_0x20031a,null));};exports[_0xb76e('0x3b')]=function(_0x2a3e28,_0xb1e629){var _0x15a164={'raw':![],'where':{'id':_0x2a3e28[_0xb76e('0x3c')]['id']}},_0x2aa9ad={};_0x2aa9ad[_0xb76e('0x2c')]=_[_0xb76e('0x3d')](db[_0xb76e('0x24')]['rawAttributes']);_0x2aa9ad[_0xb76e('0x28')]=_[_0xb76e('0x3d')](_0x2a3e28[_0xb76e('0x28')]);_0x2aa9ad[_0xb76e('0x29')]=_[_0xb76e('0x2a')](_0x2aa9ad[_0xb76e('0x2c')],_0x2aa9ad['query']);_0x15a164['attributes']=_[_0xb76e('0x2a')](_0x2aa9ad['model'],qs[_0xb76e('0x2d')](_0x2a3e28[_0xb76e('0x28')][_0xb76e('0x2d')]));_0x15a164[_0xb76e('0x2b')]=_0x15a164['attributes'][_0xb76e('0x2e')]?_0x15a164[_0xb76e('0x2b')]:_0x2aa9ad[_0xb76e('0x2c')];if(_0x2a3e28[_0xb76e('0x28')][_0xb76e('0x36')]){_0x15a164[_0xb76e('0x37')]=[{'all':!![]}];}_0x15a164=_['merge']({},_0x15a164,_0x2a3e28['options']);return db['VoiceExtension']['find'](_0x15a164)[_0xb76e('0x13')](handleEntityNotFound(_0xb1e629,null))[_0xb76e('0x13')](respondWithResult(_0xb1e629,null))[_0xb76e('0x3a')](handleError(_0xb1e629,null));};exports['destroy']=function(_0x36b85a,_0x42e6c3){return db[_0xb76e('0x24')][_0xb76e('0x3e')]({'where':{'id':_0x36b85a[_0xb76e('0x3c')]['id']}})[_0xb76e('0x13')](handleEntityNotFound(_0x42e6c3,null))['then'](removeEntity(_0x42e6c3,null))[_0xb76e('0x3a')](handleError(_0x42e6c3,null));};exports[_0xb76e('0x3f')]=function(_0x14978a,_0x1fac76){if(_0x14978a[_0xb76e('0x40')][_0xb76e('0x1c')]===_0xb76e('0x41')&&!_['startsWith'](_0x14978a[_0xb76e('0x40')][_0xb76e('0x42')],'_')){_0x14978a['body'][_0xb76e('0x42')]='_'[_0xb76e('0x43')](_0x14978a[_0xb76e('0x40')]['exten']);}return db[_0xb76e('0x24')][_0xb76e('0x3f')](_0x14978a[_0xb76e('0x40')],{'raw':![]})[_0xb76e('0x13')](function(_0x6195c7){var _0x4770ed=_0x14978a[_0xb76e('0x44')][_0xb76e('0x45')]({'plain':!![]});if(!_0x4770ed)throw new Error(_0xb76e('0x46'));if(_0x4770ed[_0xb76e('0x47')]===_0xb76e('0x44')){var _0x3cd63f=_0x6195c7[_0xb76e('0x45')]({'plain':!![]});var _0x23b596=[{'name':_0xb76e('0x14'),'value':_0xb76e('0x48')},{'name':_0xb76e('0x15'),'value':_0xb76e('0x41')},{'name':'InternalRoutes','value':_0xb76e('0x49')}];var _0x2b158d=_[_0xb76e('0x3e')](_0x23b596,[_0xb76e('0x1a'),_0x3cd63f[_0xb76e('0x1c')]])['name'];return db[_0xb76e('0x4a')][_0xb76e('0x3e')]({'where':{'name':_0x2b158d,'userProfileId':_0x4770ed[_0xb76e('0x4b')]},'raw':!![]})[_0xb76e('0x13')](function(_0x1ce8a5){if(_0x1ce8a5&&_0x1ce8a5[_0xb76e('0x4c')]===0x0){return db[_0xb76e('0x1d')][_0xb76e('0x3f')]({'name':_0x3cd63f[_0xb76e('0x21')],'resourceId':_0x3cd63f['id'],'type':_0x1ce8a5[_0xb76e('0x21')],'sectionId':_0x1ce8a5['id']},{})['then'](function(){return _0x6195c7;});}else{return _0x6195c7;}})[_0xb76e('0x3a')](function(_0x5bdec5){logger[_0xb76e('0x1f')](_0xb76e('0x4d'),_0x5bdec5);throw _0x5bdec5;});}return _0x6195c7;})[_0xb76e('0x13')](respondWithResult(_0x1fac76,0xc9))[_0xb76e('0x3a')](handleError(_0x1fac76,null));};exports[_0xb76e('0x4e')]=function(_0x58336e,_0x56c959){if(_0x58336e['body']['id']){delete _0x58336e[_0xb76e('0x40')]['id'];}return db[_0xb76e('0x24')]['find']({'where':{'id':_0x58336e[_0xb76e('0x3c')]['id']}})[_0xb76e('0x13')](handleEntityNotFound(_0x56c959,null))[_0xb76e('0x13')](function(_0x42871a){if(_0x42871a){return db[_0xb76e('0x24')][_0xb76e('0x4e')](_[_0xb76e('0x33')](_0x58336e['body'],[_0xb76e('0x42'),_0xb76e('0x4f'),'description',_0xb76e('0x50'),_0xb76e('0x51'),_0xb76e('0x52'),_0xb76e('0x53')]),{'where':{'context':_0x42871a['context'],'exten':_0x42871a[_0xb76e('0x42')]},'individualHooks':!![]})[_0xb76e('0x13')](function(_0x46d3b3){return _0x46d3b3;});}return null;})[_0xb76e('0x13')](respondWithStatusCode(_0x56c959,null))[_0xb76e('0x3a')](handleError(_0x56c959,null));};exports['addApplications']=function(_0xa71c62,_0x2c1196){var _0xf70fcb=_0xa71c62[_0xb76e('0x3c')]['id'];var _0x57eb19=_0xa71c62[_0xb76e('0x40')];var _0x95ac72=0xc8;var _0x2a238f=null;return db['sequelize'][_0xb76e('0x54')]({'isolationLevel':db[_0xb76e('0x55')][_0xb76e('0x56')]['ISOLATION_LEVELS'][_0xb76e('0x57')]},function(_0x3abb6d){return db['VoiceExtension'][_0xb76e('0x58')]({'where':{'id':_0xf70fcb},'transaction':_0x3abb6d})[_0xb76e('0x13')](function(_0x290670){if(_0x290670){return db[_0xb76e('0x24')][_0xb76e('0x1e')]({'where':{'VoiceExtensionId':_0xf70fcb},'transaction':_0x3abb6d})[_0xb76e('0x13')](function(){var _0x288539=_[_0xb76e('0x19')](_0x57eb19,function(_0x4c0d19){_0x4c0d19['VoiceExtensionId']=_0xf70fcb;_0x4c0d19[_0xb76e('0x59')]=!![];return _0x4c0d19;});return _0x290670[_0xb76e('0x5a')](_0x288539);})[_0xb76e('0x13')](function(_0x4d872c){return db[_0xb76e('0x24')]['bulkCreate'](_0x4d872c,{'transaction':_0x3abb6d});});}else{_0x95ac72=0x194;_0x2a238f=[];}});})[_0xb76e('0x13')](function(){if(_0x95ac72!==0x194){return db[_0xb76e('0x24')][_0xb76e('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xf70fcb},'order':_0xb76e('0x5c')})['then'](function(_0x4a6371){_0x2a238f=_0x4a6371;});}})[_0xb76e('0x3a')](function(_0x24e489){_0x95ac72=0x1f4;logger[_0xb76e('0x1f')](_0x24e489[_0xb76e('0x20')]);if(_0x24e489[_0xb76e('0x21')]){delete _0x24e489[_0xb76e('0x21')];}_0x2a238f=_0x24e489;})[_0xb76e('0x5d')](function(){if(_0x2a238f===null){_0x2c1196['sendStatus'](_0x95ac72);}else{if(_0x95ac72===0x1f4){_0x2c1196['status'](_0x95ac72)[_0xb76e('0x22')](_0x2a238f);}else{_0x2c1196[_0xb76e('0xc')](_0x95ac72)[_0xb76e('0x5e')](_0x2a238f);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6ada3fd..3ca0772 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 _0x3764=['update','emit','hook','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x40e5fd,_0x4e1c90){var _0x3fbd71=function(_0x3abdff){while(--_0x3abdff){_0x40e5fd['push'](_0x40e5fd['shift']());}};_0x3fbd71(++_0x4e1c90);}(_0x3764,0x1a7));var _0x4376=function(_0x3de123,_0x227df9){_0x3de123=_0x3de123-0x0;var _0x583817=_0x3764[_0x3de123];return _0x583817;};'use strict';var EventEmitter=require(_0x4376('0x0'));var VoiceExtension=require(_0x4376('0x1'))['db'][_0x4376('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4376('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4376('0x4'),'afterDestroy':'remove'};function emitEvent(_0x17a7cb){return function(_0x567e69,_0x51bec6,_0xc377ef){VoiceExtensionEvents['emit'](_0x17a7cb+':'+_0x567e69['id'],_0x567e69);VoiceExtensionEvents[_0x4376('0x5')](_0x17a7cb,_0x567e69);_0xc377ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x4376('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x0fa9=['exports','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2758ea,_0x14f2a0){var _0x14cac5=function(_0x1a7988){while(--_0x1a7988){_0x2758ea['push'](_0x2758ea['shift']());}};_0x14cac5(++_0x14f2a0);}(_0x0fa9,0x1de));var _0x90fa=function(_0x5a5bc6,_0x39e066){_0x5a5bc6=_0x5a5bc6-0x0;var _0x510ea1=_0x0fa9[_0x5a5bc6];return _0x510ea1;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x90fa('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x90fa('0x1')](0x0);var events={'afterCreate':_0x90fa('0x2'),'afterUpdate':_0x90fa('0x3'),'afterDestroy':_0x90fa('0x4')};function emitEvent(_0x5456fb){return function(_0x56009a,_0x44b84c,_0x10f839){VoiceExtensionEvents[_0x90fa('0x5')](_0x5456fb+':'+_0x56009a['id'],_0x56009a);VoiceExtensionEvents[_0x90fa('0x5')](_0x5456fb,_0x56009a);_0x10f839(null);};}for(var e in events){if(events[_0x90fa('0x6')](e)){var event=events[e];VoiceExtension[_0x90fa('0x7')](e,emitEvent(event));}}module[_0x90fa('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 12a8977..7d8c17f 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 _0xf9ca=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','models','type','Set','CDR(type)=','exten','push','inbound','CDR(routeid)=','context','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','timeout','options','split','length','name','trunk','param','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','then','*,*,*,*','intervals','toLowerCase','tag','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xf9ca,0x1d3));var _0xaf9c=function(_0x4f6e0c,_0x35ae78){_0x4f6e0c=_0x4f6e0c-0x0;var _0x207946=_0xf9ca[_0x4f6e0c];return _0x207946;};'use strict';var _=require('lodash');var attributes=require(_0xaf9c('0x0'));module['exports']=function(_0x31be64){var _0xbe164c=_0x31be64[_0xaf9c('0x1')];function _0x57f92d(_0x420366){var _0x55ed3d=0x2;var _0x3eef47=[{'type':_0x420366[_0xaf9c('0x2')],'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x4')+_0x420366['type'],'context':_0x420366['context'],'exten':_0x420366[_0xaf9c('0x5')],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']}];if(_0x420366['type']==='inbound'){_0x3eef47[_0xaf9c('0x6')]({'type':_0xaf9c('0x7'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x8')+_0x420366['id'],'context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366['exten'],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']});}_0x3eef47[_0xaf9c('0x6')]({'type':_0x420366['type'],'app':_0xaf9c('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366[_0xaf9c('0x5')],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']},{'type':_0x420366[_0xaf9c('0x2')],'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xa'),'context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366[_0xaf9c('0x5')],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']},{'type':_0x420366[_0xaf9c('0x2')],'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xb'),'context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366['exten'],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']});return _0x3eef47;}function _0x103447(_0x38e3ad){var _0x3d39ee=0x2;var _0x9b9e9c=[{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xd'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xe')+(_0x38e3ad[_0xaf9c('0xf')]?_0xaf9c('0x10')+_0x38e3ad['cutdigits']+'}':_0xaf9c('0x11')),'context':_0x38e3ad['context'],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':'Set','appdata':_0xaf9c('0x8')+_0x38e3ad['id'],'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x12'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d39ee+0x2)+_0xaf9c('0x13')+(_0x3d39ee+0x1)+')','context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad['exten'],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':'outbound','app':_0xaf9c('0x3'),'appdata':_0x38e3ad['cutdigits']?_0xaf9c('0x14')+_0x38e3ad['cutdigits']+'}':_0xaf9c('0x15'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad['exten'],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x16'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xa'),'context':_0x38e3ad['context'],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xb'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':'outbound','app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x17')+_0x38e3ad['id'],'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad['exten'],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']}];if(_0x38e3ad[_0xaf9c('0x18')](_0xaf9c('0x19'))&&_0x38e3ad[_0xaf9c('0x19')]!==_0xaf9c('0x1a')){_0x9b9e9c[_0xaf9c('0x6')]({'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x1b'),'context':_0x38e3ad['context'],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x38e3ad[_0xaf9c('0x19')]||'wav','context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']});}return _0x9b9e9c;}function _0xdd13a7(_0x3a97b9,_0x4782ed){var _0x22d085=[{'name':'trunk','param':0x0},{'name':_0xaf9c('0x1c'),'param':0x1},{'name':_0xaf9c('0x1d'),'param':0x2},{'name':'url','param':0x3}];var _0x32be0c={};var _0x1dc4f8=_0x4782ed[_0xaf9c('0x1e')](',');var _0x5a8d07=[];for(var _0x1943ab=0x0;_0x1943ab<_0x22d085[_0xaf9c('0x1f')];_0x1943ab++){switch(_0x22d085[_0x1943ab][_0xaf9c('0x20')]){case _0xaf9c('0x21'):_0x32be0c[_0xaf9c('0x21')]=_0x1dc4f8[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]['split']('/')[0x1];_0x32be0c['phone']=_0x1dc4f8[_0x22d085[_0x1943ab][_0xaf9c('0x22')]][_0xaf9c('0x1e')]('/')[0x2];_0x32be0c['prefix']=_0x32be0c[_0xaf9c('0x23')]?_0x32be0c['phone'][_0xaf9c('0x1e')]('$')[0x0]:undefined;_0x32be0c[_0xaf9c('0x23')]=_0x3a97b9[_0xaf9c('0xf')]?(_0x32be0c['prefix']||'')+_0xaf9c('0x10')+_0x3a97b9[_0xaf9c('0xf')]+'}':(_0x32be0c['prefix']||'')+'${EXTEN}';_0x5a8d07[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]=[_0xaf9c('0x24'),_0x32be0c[_0xaf9c('0x21')],_0x32be0c[_0xaf9c('0x23')]][_0xaf9c('0x25')]('/');break;case'options':_0x32be0c[_0xaf9c('0x1d')]=_0x1dc4f8[_0x22d085[_0x1943ab]['param']];if(_0x3a97b9[_0xaf9c('0x19')]!==_0xaf9c('0x1a')){if(_0x32be0c['options'][_0xaf9c('0x26')](_0xaf9c('0x27'))<0x0){_0x32be0c[_0xaf9c('0x1d')]+='U(xcally-mixmonitor-context)';}}else{_0x32be0c[_0xaf9c('0x1d')]=_0x32be0c[_0xaf9c('0x1d')]['replace']('U(xcally-mixmonitor-context)','');}_0x5a8d07[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]=_0x32be0c[_0xaf9c('0x1d')];break;default:_0x5a8d07[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]=_0x1dc4f8[_0x22d085[_0x1943ab][_0xaf9c('0x22')]];}}return _0x5a8d07[_0xaf9c('0x25')](',');}function _0x4673a8(_0x436136,_0x29e633,_0x3baca3){return new Promise(function(_0x43ac65,_0x66f266){var _0x5c7e62=[];if(_[_0xaf9c('0x28')](_0x29e633))return _0x43ac65(_0x5c7e62);_0xbe164c[_0xaf9c('0x29')][_0xaf9c('0x2a')]({'attributes':['id','interval',_0xaf9c('0x2b')],'raw':!![]})[_0xaf9c('0x2c')](function(_0x2b2ea7){for(var _0x2cfc1d=0x0,_0x1741f3=0x0;_0x2cfc1d<_0x29e633['length'];_0x2cfc1d++,_0x1741f3=0x0){var _0x3eecdc=_0x29e633[_0x2cfc1d];var _0x443786=[];var _0x227bc9=[];delete _0x3eecdc['id'];if(_0x3eecdc['interval']!==_0xaf9c('0x2d')){_0x3eecdc[_0xaf9c('0x2e')]=[_0x3eecdc['interval']];}else{_0x3eecdc[_0xaf9c('0x2e')]=_0x3eecdc[_0xaf9c('0x2b')]?_['map'](_['filter'](_0x2b2ea7,{'IntervalId':_0x3eecdc['IntervalId']}),'interval'):[];}_0x3eecdc[_0xaf9c('0x9')]=_0x436136[_0xaf9c('0x9')];_0x3eecdc['exten']=_0x436136[_0xaf9c('0x5')];if(_0x3eecdc['type'])_0x3eecdc[_0xaf9c('0x2')]=_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')]();if(_0x436136[_0xaf9c('0x2')]===_0xaf9c('0xc')){if(_0x3eecdc[_0xaf9c('0x18')](_0xaf9c('0x30'))&&_0x3eecdc[_0xaf9c('0x30')]&&_0x3eecdc[_0xaf9c('0x30')]!=='--'){_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')]['toLowerCase'](),'app':_0xaf9c('0x3'),'appdata':'CDR(tag)='+_0x3eecdc[_0xaf9c('0x30')],'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136['exten'],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3eecdc[_0xaf9c('0x31')]?_0xaf9c('0x32')+_0x3eecdc['callerID']+')':_0xaf9c('0x33')),'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}else{if(_0x3eecdc[_0xaf9c('0x18')](_0xaf9c('0x34'))){if(['queue',_0xaf9c('0x35')][_0xaf9c('0x36')](_0x3eecdc[_0xaf9c('0x37')]['toLowerCase']())&&_0x3eecdc[_0xaf9c('0x38')]!==_0xaf9c('0x39')){if(_0x3eecdc[_0xaf9c('0x34')]){_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')]['toLowerCase'](),'app':_0xaf9c('0x12'),'appdata':_0xaf9c('0x3a'),'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')]['length']+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x3b'),'context':_0x436136['context'],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc['intervals'][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}else{_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x12'),'appdata':_0xaf9c('0x3c'),'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x3d'),'context':_0x436136['context'],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}}}}for(var _0x176916=0x0;_0x176916<_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')];_0x176916++){var _0x4536a1=_0x3baca3+_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')];var _0x5f0938=_0x176916===_0x3eecdc['intervals'][_0xaf9c('0x1f')]-0x1?_0x3baca3+_0x443786['length']+_0x227bc9['length']+0x2:_0x3baca3+_0x176916+0x1;_0x443786['splice'](_0x176916,0x0,{'type':_0x436136[_0xaf9c('0x2')],'app':_0xaf9c('0x3e'),'appdata':_0x3eecdc['intervals'][_0x176916]+'?'+_0x436136[_0xaf9c('0x9')]+_0xaf9c('0x3f')+_0x4536a1+':'+_0x436136['context']+_0xaf9c('0x3f')+_0x5f0938,'exten':_0x436136[_0xaf9c('0x5')],'context':_0x436136[_0xaf9c('0x9')],'priority':_0x3baca3+_0x176916,'VoiceExtensionId':_0x436136['id']});}if(_0x3eecdc[_0xaf9c('0x38')]===_0xaf9c('0x40')){_0x3eecdc[_0xaf9c('0x41')]=_0xdd13a7(_0x436136,_0x3eecdc[_0xaf9c('0x41')]);}if(_0x3eecdc['appType']===_0xaf9c('0x42')){_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x43'),'context':_0x436136['context'],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc['intervals'][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}_0x3eecdc[_0xaf9c('0x44')]=_0x443786[_0xaf9c('0x1f')]?_[_0xaf9c('0x45')](_0x443786)[_0xaf9c('0x44')]+0x1:_0x3baca3;_0x5c7e62=_[_0xaf9c('0x46')](_0x5c7e62,_0x443786,[_0x3eecdc],_0x227bc9);_0x3baca3=_[_0xaf9c('0x45')](_0x5c7e62)['priority']+0x1;}return _0x43ac65(_0x5c7e62);})['catch'](function(_0x4c99e1){_0x66f266(_0x4c99e1);});});}return _0x31be64['define'](_0xaf9c('0x47'),attributes,{'tableName':_0xaf9c('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x374478){var _0x2a7645=this[_0xaf9c('0x49')]({'plain':!![]});var _0x25e2fd=_0x2a7645[_0xaf9c('0x2')]===_0xaf9c('0xc')?_0x103447(_0x2a7645):_0x57f92d(_0x2a7645);return _0x4673a8(_0x2a7645,_0x374478,_['last'](_0x25e2fd)[_0xaf9c('0x44')]+0x1)['then'](function(_0x3e6021){var _0x1bdd0f=_['concat'](_0x25e2fd,_0x3e6021);_0x1bdd0f[_0xaf9c('0x6')]({'type':_0x2a7645[_0xaf9c('0x2')],'app':_0xaf9c('0x4a'),'exten':_0x2a7645['exten'],'context':_0x2a7645[_0xaf9c('0x9')],'priority':_['last'](_0x1bdd0f)['priority']+0x1,'VoiceExtensionId':_0x2a7645['id']});return _0x1bdd0f;});}}});}; \ No newline at end of file +var _0x94b1=['options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','*,*,*,*','intervals','filter','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','includes','custom','ExecIf','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','get','concat','Hangup','lodash','exports','models','type','Set','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','context','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','length','name','param','split','phone','prefix'];(function(_0x2df4da,_0x2d68a5){var _0x2d66f2=function(_0x30dc30){while(--_0x30dc30){_0x2df4da['push'](_0x2df4da['shift']());}};_0x2d66f2(++_0x2d68a5);}(_0x94b1,0xbe));var _0x194b=function(_0x5bae89,_0x54ee3b){_0x5bae89=_0x5bae89-0x0;var _0x5d94cc=_0x94b1[_0x5bae89];return _0x5d94cc;};'use strict';var _=require(_0x194b('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x194b('0x1')]=function(_0x57b3fe){var _0x317663=_0x57b3fe[_0x194b('0x2')];function _0x4f7f3a(_0x237ce5){var _0x734a8d=0x2;var _0x39d0ec=[{'type':_0x237ce5[_0x194b('0x3')],'app':_0x194b('0x4'),'appdata':'CDR(type)='+_0x237ce5['type'],'context':_0x237ce5['context'],'exten':_0x237ce5['exten'],'priority':_0x734a8d++,'VoiceExtensionId':_0x237ce5['id']}];if(_0x237ce5[_0x194b('0x3')]===_0x194b('0x5')){_0x39d0ec[_0x194b('0x6')]({'type':'inbound','app':_0x194b('0x4'),'appdata':_0x194b('0x7')+_0x237ce5['id'],'context':_0x237ce5['context'],'exten':_0x237ce5[_0x194b('0x8')],'priority':_0x734a8d++,'VoiceExtensionId':_0x237ce5['id']});}_0x39d0ec[_0x194b('0x6')]({'type':_0x237ce5[_0x194b('0x3')],'app':'Set','appdata':_0x194b('0x9'),'context':_0x237ce5[_0x194b('0xa')],'exten':_0x237ce5[_0x194b('0x8')],'priority':_0x734a8d++,'VoiceExtensionId':_0x237ce5['id']},{'type':_0x237ce5[_0x194b('0x3')],'app':_0x194b('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x237ce5[_0x194b('0xa')],'exten':_0x237ce5[_0x194b('0x8')],'priority':_0x734a8d++,'VoiceExtensionId':_0x237ce5['id']},{'type':_0x237ce5['type'],'app':_0x194b('0x4'),'appdata':_0x194b('0xb'),'context':_0x237ce5[_0x194b('0xa')],'exten':_0x237ce5[_0x194b('0x8')],'priority':_0x734a8d++,'VoiceExtensionId':_0x237ce5['id']});return _0x39d0ec;}function _0xab1bdf(_0x25b34f){var _0x222888=0x2;var _0x167bf3=[{'type':_0x194b('0xc'),'app':_0x194b('0x4'),'appdata':_0x194b('0xd'),'context':_0x25b34f['context'],'exten':_0x25b34f[_0x194b('0x8')],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':_0x194b('0xc'),'app':'Set','appdata':'CDR(destination)='+(_0x25b34f['cutdigits']?_0x194b('0xe')+_0x25b34f['cutdigits']+'}':_0x194b('0xf')),'context':_0x25b34f[_0x194b('0xa')],'exten':_0x25b34f[_0x194b('0x8')],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':_0x194b('0xc'),'app':_0x194b('0x4'),'appdata':'CDR(routeid)='+_0x25b34f['id'],'context':_0x25b34f[_0x194b('0xa')],'exten':_0x25b34f[_0x194b('0x8')],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':'outbound','app':'ExecIf','appdata':_0x194b('0x10')+(_0x222888+0x2)+_0x194b('0x11')+(_0x222888+0x1)+')','context':_0x25b34f['context'],'exten':_0x25b34f['exten'],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':_0x194b('0xc'),'app':'Set','appdata':_0x25b34f[_0x194b('0x12')]?_0x194b('0x13')+_0x25b34f[_0x194b('0x12')]+'}':_0x194b('0x14'),'context':_0x25b34f[_0x194b('0xa')],'exten':_0x25b34f['exten'],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':_0x194b('0xc'),'app':_0x194b('0x4'),'appdata':_0x194b('0x9'),'context':_0x25b34f[_0x194b('0xa')],'exten':_0x25b34f['exten'],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':_0x194b('0xc'),'app':_0x194b('0x4'),'appdata':_0x194b('0x15'),'context':_0x25b34f[_0x194b('0xa')],'exten':_0x25b34f[_0x194b('0x8')],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':_0x194b('0xc'),'app':_0x194b('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x25b34f['context'],'exten':_0x25b34f[_0x194b('0x8')],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':'outbound','app':_0x194b('0x4'),'appdata':_0x194b('0x16')+_0x25b34f['id'],'context':_0x25b34f['context'],'exten':_0x25b34f['exten'],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']}];if(_0x25b34f[_0x194b('0x17')]('recordingFormat')&&_0x25b34f[_0x194b('0x18')]!==_0x194b('0x19')){_0x167bf3[_0x194b('0x6')]({'type':_0x194b('0xc'),'app':_0x194b('0x4'),'appdata':_0x194b('0x1a'),'context':_0x25b34f[_0x194b('0xa')],'exten':_0x25b34f['exten'],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']},{'type':'outbound','app':_0x194b('0x4'),'appdata':_0x194b('0x1b')+_0x25b34f[_0x194b('0x18')]||_0x194b('0x1c'),'context':_0x25b34f[_0x194b('0xa')],'exten':_0x25b34f[_0x194b('0x8')],'priority':_0x222888++,'VoiceExtensionId':_0x25b34f['id']});}return _0x167bf3;}function _0x201f6f(_0x4e2b88,_0x3b0dd0){var _0x49b45b=[{'name':_0x194b('0x1d'),'param':0x0},{'name':_0x194b('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0x194b('0x1f'),'param':0x3}];var _0x2a8f35={};var _0x1e2fa1=_0x3b0dd0['split'](',');var _0x3f69cd=[];for(var _0x25d66c=0x0;_0x25d66c<_0x49b45b[_0x194b('0x20')];_0x25d66c++){switch(_0x49b45b[_0x25d66c][_0x194b('0x21')]){case _0x194b('0x1d'):_0x2a8f35[_0x194b('0x1d')]=_0x1e2fa1[_0x49b45b[_0x25d66c][_0x194b('0x22')]][_0x194b('0x23')]('/')[0x1];_0x2a8f35['phone']=_0x1e2fa1[_0x49b45b[_0x25d66c][_0x194b('0x22')]][_0x194b('0x23')]('/')[0x2];_0x2a8f35['prefix']=_0x2a8f35[_0x194b('0x24')]?_0x2a8f35[_0x194b('0x24')][_0x194b('0x23')]('$')[0x0]:undefined;_0x2a8f35['phone']=_0x4e2b88[_0x194b('0x12')]?(_0x2a8f35[_0x194b('0x25')]||'')+'${EXTEN:'+_0x4e2b88['cutdigits']+'}':(_0x2a8f35[_0x194b('0x25')]||'')+_0x194b('0xf');_0x3f69cd[_0x49b45b[_0x25d66c][_0x194b('0x22')]]=['SIP',_0x2a8f35[_0x194b('0x1d')],_0x2a8f35[_0x194b('0x24')]]['join']('/');break;case'options':_0x2a8f35[_0x194b('0x26')]=_0x1e2fa1[_0x49b45b[_0x25d66c][_0x194b('0x22')]];if(_0x4e2b88[_0x194b('0x18')]!==_0x194b('0x19')){if(_0x2a8f35[_0x194b('0x26')][_0x194b('0x27')](_0x194b('0x28'))<0x0){_0x2a8f35[_0x194b('0x26')]+=_0x194b('0x28');}}else{_0x2a8f35[_0x194b('0x26')]=_0x2a8f35[_0x194b('0x26')][_0x194b('0x29')](_0x194b('0x28'),'');}_0x3f69cd[_0x49b45b[_0x25d66c][_0x194b('0x22')]]=_0x2a8f35[_0x194b('0x26')];break;default:_0x3f69cd[_0x49b45b[_0x25d66c]['param']]=_0x1e2fa1[_0x49b45b[_0x25d66c][_0x194b('0x22')]];}}return _0x3f69cd['join'](',');}function _0x4f00d5(_0x16e18b,_0x1dd87a,_0x4a92f4){return new Promise(function(_0x242eb5,_0x3c1506){var _0x44f3af=[];if(_[_0x194b('0x2a')](_0x1dd87a))return _0x242eb5(_0x44f3af);_0x317663[_0x194b('0x2b')]['findAll']({'attributes':['id',_0x194b('0x2c'),_0x194b('0x2d')],'raw':!![]})[_0x194b('0x2e')](function(_0x2aaf03){for(var _0x1a5652=0x0,_0x39b3c9=0x0;_0x1a5652<_0x1dd87a['length'];_0x1a5652++,_0x39b3c9=0x0){var _0x45615e=_0x1dd87a[_0x1a5652];var _0x1b5be7=[];var _0x5c974a=[];delete _0x45615e['id'];if(_0x45615e[_0x194b('0x2c')]!==_0x194b('0x2f')){_0x45615e[_0x194b('0x30')]=[_0x45615e[_0x194b('0x2c')]];}else{_0x45615e[_0x194b('0x30')]=_0x45615e[_0x194b('0x2d')]?_['map'](_[_0x194b('0x31')](_0x2aaf03,{'IntervalId':_0x45615e[_0x194b('0x2d')]}),'interval'):[];}_0x45615e[_0x194b('0xa')]=_0x16e18b[_0x194b('0xa')];_0x45615e[_0x194b('0x8')]=_0x16e18b[_0x194b('0x8')];if(_0x45615e['type'])_0x45615e[_0x194b('0x3')]=_0x45615e[_0x194b('0x3')]['toLowerCase']();if(_0x16e18b['type']===_0x194b('0xc')){if(_0x45615e['hasOwnProperty'](_0x194b('0x32'))&&_0x45615e[_0x194b('0x32')]&&_0x45615e['tag']!=='--'){_0x1b5be7[_0x194b('0x6')]({'type':_0x45615e[_0x194b('0x3')][_0x194b('0x33')](),'app':_0x194b('0x4'),'appdata':'CDR(tag)='+_0x45615e[_0x194b('0x32')],'context':_0x16e18b[_0x194b('0xa')],'exten':_0x16e18b[_0x194b('0x8')],'priority':_0x45615e[_0x194b('0x30')][_0x194b('0x20')]+_0x4a92f4+_0x39b3c9++,'VoiceExtensionId':_0x16e18b['id']});}_0x1b5be7['push']({'type':_0x45615e[_0x194b('0x3')][_0x194b('0x33')](),'app':'ExecIf','appdata':_0x194b('0x34')+(_0x45615e['callerID']?'Set(CALLERID(all)='+_0x45615e[_0x194b('0x35')]+')':_0x194b('0x36')),'context':_0x16e18b[_0x194b('0xa')],'exten':_0x16e18b[_0x194b('0x8')],'priority':_0x45615e[_0x194b('0x30')][_0x194b('0x20')]+_0x4a92f4+_0x39b3c9++,'VoiceExtensionId':_0x16e18b['id']});}else{if(_0x45615e[_0x194b('0x17')]('answer')){if([_0x194b('0x37'),'playback'][_0x194b('0x38')](_0x45615e['app'][_0x194b('0x33')]())&&_0x45615e['appType']!==_0x194b('0x39')){if(_0x45615e['answer']){_0x1b5be7[_0x194b('0x6')]({'type':_0x45615e[_0x194b('0x3')][_0x194b('0x33')](),'app':_0x194b('0x3a'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x16e18b[_0x194b('0xa')],'exten':_0x16e18b['exten'],'priority':_0x45615e[_0x194b('0x30')][_0x194b('0x20')]+_0x4a92f4+_0x39b3c9++,'VoiceExtensionId':_0x16e18b['id']});_0x1b5be7[_0x194b('0x6')]({'type':_0x45615e['type'][_0x194b('0x33')](),'app':_0x194b('0x4'),'appdata':_0x194b('0x3b'),'context':_0x16e18b['context'],'exten':_0x16e18b[_0x194b('0x8')],'priority':_0x45615e[_0x194b('0x30')][_0x194b('0x20')]+_0x4a92f4+_0x39b3c9++,'VoiceExtensionId':_0x16e18b['id']});}else{_0x1b5be7['push']({'type':_0x45615e['type'][_0x194b('0x33')](),'app':_0x194b('0x3a'),'appdata':_0x194b('0x3c'),'context':_0x16e18b[_0x194b('0xa')],'exten':_0x16e18b['exten'],'priority':_0x45615e[_0x194b('0x30')][_0x194b('0x20')]+_0x4a92f4+_0x39b3c9++,'VoiceExtensionId':_0x16e18b['id']});_0x1b5be7[_0x194b('0x6')]({'type':_0x45615e['type'][_0x194b('0x33')](),'app':_0x194b('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x16e18b['context'],'exten':_0x16e18b[_0x194b('0x8')],'priority':_0x45615e[_0x194b('0x30')][_0x194b('0x20')]+_0x4a92f4+_0x39b3c9++,'VoiceExtensionId':_0x16e18b['id']});}}}}for(var _0x3026de=0x0;_0x3026de<_0x45615e['intervals'][_0x194b('0x20')];_0x3026de++){var _0x417549=_0x4a92f4+_0x45615e[_0x194b('0x30')]['length'];var _0x21194a=_0x3026de===_0x45615e['intervals']['length']-0x1?_0x4a92f4+_0x1b5be7[_0x194b('0x20')]+_0x5c974a[_0x194b('0x20')]+0x2:_0x4a92f4+_0x3026de+0x1;_0x1b5be7[_0x194b('0x3d')](_0x3026de,0x0,{'type':_0x16e18b['type'],'app':_0x194b('0x3e'),'appdata':_0x45615e['intervals'][_0x3026de]+'?'+_0x16e18b[_0x194b('0xa')]+_0x194b('0x3f')+_0x417549+':'+_0x16e18b['context']+_0x194b('0x3f')+_0x21194a,'exten':_0x16e18b['exten'],'context':_0x16e18b[_0x194b('0xa')],'priority':_0x4a92f4+_0x3026de,'VoiceExtensionId':_0x16e18b['id']});}if(_0x45615e[_0x194b('0x40')]===_0x194b('0x41')){_0x45615e['appdata']=_0x201f6f(_0x16e18b,_0x45615e[_0x194b('0x42')]);}if(_0x45615e['appType']===_0x194b('0x43')){_0x1b5be7[_0x194b('0x6')]({'type':_0x45615e['type']['toLowerCase'](),'app':'Set','appdata':_0x194b('0x44'),'context':_0x16e18b['context'],'exten':_0x16e18b[_0x194b('0x8')],'priority':_0x45615e['intervals']['length']+_0x4a92f4+_0x39b3c9++,'VoiceExtensionId':_0x16e18b['id']});}_0x45615e[_0x194b('0x45')]=_0x1b5be7[_0x194b('0x20')]?_[_0x194b('0x46')](_0x1b5be7)[_0x194b('0x45')]+0x1:_0x4a92f4;_0x44f3af=_['concat'](_0x44f3af,_0x1b5be7,[_0x45615e],_0x5c974a);_0x4a92f4=_['last'](_0x44f3af)[_0x194b('0x45')]+0x1;}return _0x242eb5(_0x44f3af);})[_0x194b('0x47')](function(_0x444267){_0x3c1506(_0x444267);});});}return _0x57b3fe[_0x194b('0x48')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x29028f){var _0x48b4fe=this[_0x194b('0x49')]({'plain':!![]});var _0x5013f4=_0x48b4fe[_0x194b('0x3')]===_0x194b('0xc')?_0xab1bdf(_0x48b4fe):_0x4f7f3a(_0x48b4fe);return _0x4f00d5(_0x48b4fe,_0x29028f,_[_0x194b('0x46')](_0x5013f4)['priority']+0x1)[_0x194b('0x2e')](function(_0x46a5fe){var _0x2843bb=_[_0x194b('0x4a')](_0x5013f4,_0x46a5fe);_0x2843bb['push']({'type':_0x48b4fe[_0x194b('0x3')],'app':_0x194b('0x4b'),'exten':_0x48b4fe[_0x194b('0x8')],'context':_0x48b4fe[_0x194b('0xa')],'priority':_['last'](_0x2843bb)['priority']+0x1,'VoiceExtensionId':_0x48b4fe['id']});return _0x2843bb;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2a6cb45..10f36f1 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 _0xf3a7=['socket.io-emitter','./voiceExtension.socket','register','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','map','include','model','attributes','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x137219,_0x3042d3){var _0x4a1eac=function(_0x58be7f){while(--_0x58be7f){_0x137219['push'](_0x137219['shift']());}};_0x4a1eac(++_0x3042d3);}(_0xf3a7,0x99));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7f3a('0x0'));var moment=require(_0x7f3a('0x1'));var BPromise=require(_0x7f3a('0x2'));var rs=require(_0x7f3a('0x3'));var fs=require('fs');var Redis=require(_0x7f3a('0x4'));var db=require(_0x7f3a('0x5'))['db'];var utils=require(_0x7f3a('0x6'));var logger=require(_0x7f3a('0x7'))(_0x7f3a('0x8'));var config=require(_0x7f3a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7f3a('0xa')][_0x7f3a('0xb')]({'port':0x232a});config[_0x7f3a('0xc')]=_[_0x7f3a('0xd')](config[_0x7f3a('0xc')],{'host':_0x7f3a('0xe'),'port':0x18eb});var socket=require(_0x7f3a('0xf'))(new Redis(config['redis']));require(_0x7f3a('0x10'))[_0x7f3a('0x11')](socket);function respondWithRpcPromise(_0x59a5dc,_0x5abe24,_0x265fb7){return new BPromise(function(_0x2c9726,_0x5e8521){return client[_0x7f3a('0x12')](_0x59a5dc,_0x265fb7)['then'](function(_0x3d3c13){logger['info'](_0x7f3a('0x13'),_0x5abe24,_0x7f3a('0x14'));logger[_0x7f3a('0x15')](_0x7f3a('0x16'),_0x5abe24,_0x7f3a('0x14'),JSON[_0x7f3a('0x17')](_0x3d3c13));if(_0x3d3c13[_0x7f3a('0x18')]){if(_0x3d3c13[_0x7f3a('0x18')][_0x7f3a('0x19')]===0x1f4){logger['error'](_0x7f3a('0x13'),_0x5abe24,_0x3d3c13['error'][_0x7f3a('0x1a')]);return _0x5e8521(_0x3d3c13[_0x7f3a('0x18')][_0x7f3a('0x1a')]);}logger[_0x7f3a('0x18')](_0x7f3a('0x13'),_0x5abe24,_0x3d3c13[_0x7f3a('0x18')][_0x7f3a('0x1a')]);return _0x2c9726(_0x3d3c13['error'][_0x7f3a('0x1a')]);}else{logger[_0x7f3a('0x1b')]('VoiceExtension,\x20%s,\x20%s',_0x5abe24,_0x7f3a('0x14'));_0x2c9726(_0x3d3c13[_0x7f3a('0x1c')][_0x7f3a('0x1a')]);}})[_0x7f3a('0x1d')](function(_0x54f5e5){logger['error'](_0x7f3a('0x13'),_0x5abe24,_0x54f5e5);_0x5e8521(_0x54f5e5);});});}exports[_0x7f3a('0x1e')]=function(_0xf6d87c){var _0xfaedca=this;return new Promise(function(_0x3f5ad9,_0x48032d){return db[_0x7f3a('0x1f')][_0x7f3a('0x20')]({'raw':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')][_0x7f3a('0x22')]===undefined?!![]:![]:!![],'where':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')][_0x7f3a('0x23')]||null:null,'attributes':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')]['attributes']||null:null,'limit':_0xf6d87c['options']?_0xf6d87c['options'][_0x7f3a('0x24')]||null:null,'include':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')]['include']?_[_0x7f3a('0x25')](_0xf6d87c[_0x7f3a('0x21')][_0x7f3a('0x26')],function(_0x3479dc){return{'model':db[_0x3479dc[_0x7f3a('0x27')]],'as':_0x3479dc['as'],'attributes':_0x3479dc[_0x7f3a('0x28')],'include':_0x3479dc[_0x7f3a('0x26')]?_[_0x7f3a('0x25')](_0x3479dc[_0x7f3a('0x26')],function(_0x4a9dd1){return{'model':db[_0x4a9dd1[_0x7f3a('0x27')]],'as':_0x4a9dd1['as'],'attributes':_0x4a9dd1[_0x7f3a('0x28')],'include':_0x4a9dd1[_0x7f3a('0x26')]?_[_0x7f3a('0x25')](_0x4a9dd1[_0x7f3a('0x26')],function(_0x440e28){return{'model':db[_0x440e28[_0x7f3a('0x27')]],'as':_0x440e28['as'],'attributes':_0x440e28[_0x7f3a('0x28')]};}):[]};}):[]};}):[]:[]})[_0x7f3a('0x29')](function(_0x42c06a){logger[_0x7f3a('0x1b')](_0x7f3a('0x1e'),_0xf6d87c);logger[_0x7f3a('0x15')](_0x7f3a('0x1e'),_0xf6d87c,JSON['stringify'](_0x42c06a));_0x3f5ad9(_0x42c06a);})[_0x7f3a('0x1d')](function(_0x1e1420){logger['error']('GetVoiceExtension',_0x1e1420[_0x7f3a('0x1a')],_0xf6d87c);_0x48032d(_0xfaedca[_0x7f3a('0x18')](0x1f4,_0x1e1420[_0x7f3a('0x1a')]));});});}; \ No newline at end of file +var _0x3ca4=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x264eeb,_0xc05998){var _0xa45c83=function(_0x2a82d9){while(--_0x2a82d9){_0x264eeb['push'](_0x264eeb['shift']());}};_0xa45c83(++_0xc05998);}(_0x3ca4,0x17d));var _0x43ca=function(_0x1be3e6,_0x1cc35b){_0x1be3e6=_0x1be3e6-0x0;var _0x111a4c=_0x3ca4[_0x1be3e6];return _0x111a4c;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require(_0x43ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ca('0x3'));var db=require(_0x43ca('0x4'))['db'];var utils=require(_0x43ca('0x5'));var logger=require(_0x43ca('0x6'))(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var jayson=require(_0x43ca('0x9'));var client=jayson['client'][_0x43ca('0xa')]({'port':0x232a});config[_0x43ca('0xb')]=_[_0x43ca('0xc')](config[_0x43ca('0xb')],{'host':_0x43ca('0xd'),'port':0x18eb});var socket=require(_0x43ca('0xe'))(new Redis(config[_0x43ca('0xb')]));require(_0x43ca('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b61dd,_0x1dcd17,_0x134855){return new BPromise(function(_0x4d5516,_0x2facc9){return client['request'](_0x5b61dd,_0x134855)[_0x43ca('0x10')](function(_0x411a00){logger[_0x43ca('0x11')](_0x43ca('0x12'),_0x1dcd17,_0x43ca('0x13'));logger[_0x43ca('0x14')](_0x43ca('0x15'),_0x1dcd17,_0x43ca('0x13'),JSON[_0x43ca('0x16')](_0x411a00));if(_0x411a00['error']){if(_0x411a00[_0x43ca('0x17')][_0x43ca('0x18')]===0x1f4){logger['error'](_0x43ca('0x12'),_0x1dcd17,_0x411a00['error'][_0x43ca('0x19')]);return _0x2facc9(_0x411a00['error'][_0x43ca('0x19')]);}logger[_0x43ca('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1dcd17,_0x411a00[_0x43ca('0x17')][_0x43ca('0x19')]);return _0x4d5516(_0x411a00[_0x43ca('0x17')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x1dcd17,'request\x20sent');_0x4d5516(_0x411a00[_0x43ca('0x1a')][_0x43ca('0x19')]);}})[_0x43ca('0x1b')](function(_0x5296b9){logger[_0x43ca('0x17')](_0x43ca('0x12'),_0x1dcd17,_0x5296b9);_0x2facc9(_0x5296b9);});});}exports[_0x43ca('0x1c')]=function(_0x4a07cd){var _0x23ee82=this;return new Promise(function(_0x51cb85,_0x106d07){return db[_0x43ca('0x1d')][_0x43ca('0x1e')]({'raw':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x20')]===undefined?!![]:![]:!![],'where':_0x4a07cd[_0x43ca('0x1f')]?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x21')]||null:null,'attributes':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x22')]||null:null,'limit':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x23')]||null:null,'include':_0x4a07cd[_0x43ca('0x1f')]?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x24')]?_['map'](_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x24')],function(_0x29f2ee){return{'model':db[_0x29f2ee[_0x43ca('0x25')]],'as':_0x29f2ee['as'],'attributes':_0x29f2ee[_0x43ca('0x22')],'include':_0x29f2ee[_0x43ca('0x24')]?_[_0x43ca('0x26')](_0x29f2ee[_0x43ca('0x24')],function(_0x5aa57c){return{'model':db[_0x5aa57c['model']],'as':_0x5aa57c['as'],'attributes':_0x5aa57c['attributes'],'include':_0x5aa57c[_0x43ca('0x24')]?_[_0x43ca('0x26')](_0x5aa57c[_0x43ca('0x24')],function(_0x9d09b9){return{'model':db[_0x9d09b9[_0x43ca('0x25')]],'as':_0x9d09b9['as'],'attributes':_0x9d09b9[_0x43ca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x43ca('0x10')](function(_0x3f0b2b){logger['info'](_0x43ca('0x1c'),_0x4a07cd);logger['debug']('GetVoiceExtension',_0x4a07cd,JSON[_0x43ca('0x16')](_0x3f0b2b));_0x51cb85(_0x3f0b2b);})[_0x43ca('0x1b')](function(_0x313518){logger[_0x43ca('0x17')](_0x43ca('0x1c'),_0x313518['message'],_0x4a07cd);_0x106d07(_0x23ee82[_0x43ca('0x17')](0x1f4,_0x313518['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0a25e61..815555b 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x42b3ba,_0x165b31){var _0xcadf9a=function(_0x37eb65){while(--_0x37eb65){_0x42b3ba['push'](_0x42b3ba['shift']());}};_0xcadf9a(++_0x165b31);}(_0x1261,0x144));var _0x1126=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x1261[_0x2ca616];return _0x53155f;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x467e8e,_0x162852){var _0x16c2a5=function(_0x380795){while(--_0x380795){_0x467e8e['push'](_0x467e8e['shift']());}};_0x16c2a5(++_0x162852);}(_0xabce,0x103));var _0xeabc=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xabce[_0x5c351c];return _0x26f3b3;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1b722b4..8f77481 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 _0x66fa=['isAuthenticated','index','get','/:id','post','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a3634,_0x3a5fe7){var _0x2338c7=function(_0x5ee63d){while(--_0x5ee63d){_0x1a3634['push'](_0x1a3634['shift']());}};_0x2338c7(++_0x3a5fe7);}(_0x66fa,0x117));var _0xa66f=function(_0x43d9a6,_0x197d7b){_0x43d9a6=_0x43d9a6-0x0;var _0x522f70=_0x66fa[_0x43d9a6];return _0x522f70;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/messages',auth[_0xa66f('0x9')](),controller['getMessages']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0xf')]=router; \ No newline at end of file +var _0xeda8=['show','/:id/messages','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x644b45,_0x7aae74){var _0xe7a717=function(_0x548ba9){while(--_0x548ba9){_0x644b45['push'](_0x644b45['shift']());}};_0xe7a717(++_0x7aae74);}(_0xeda8,0x104));var _0x8eda=function(_0x3b37fd,_0xce6248){_0x3b37fd=_0x3b37fd-0x0;var _0x203025=_0xeda8[_0x3b37fd];return _0x203025;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')](_0x8eda('0x11'),auth['isAuthenticated'](),controller[_0x8eda('0x12')]);router['delete'](_0x8eda('0x11'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);module[_0x8eda('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 3559b57..0f96c54 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 _0x9242=['VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','STRING','from-voicemail','setDataValue','email','string','trim','yes','ENUM','TIMESTAMP','INTEGER'];(function(_0x4a29f1,_0x23e312){var _0xe71461=function(_0x552bff){while(--_0x552bff){_0x4a29f1['push'](_0x4a29f1['shift']());}};_0xe71461(++_0x23e312);}(_0x9242,0x1f3));var _0x2924=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x9242[_0x5f3de3];return _0x287e0d;};'use strict';var Sequelize=require(_0x2924('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2924('0x1')],'defaultValue':_0x2924('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x2924('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2924('0x1')]},'fullname':{'type':Sequelize[_0x2924('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x200a53){this[_0x2924('0x3')](_0x2924('0x4'),typeof _0x200a53===_0x2924('0x5')&&_0x200a53['trim']()?_0x200a53[_0x2924('0x6')]():null);}},'pager':{'type':Sequelize[_0x2924('0x1')]},'tz':{'type':Sequelize[_0x2924('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2924('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':_0x2924('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2924('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':_0x2924('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x2924('0x9')},'emailsubject':{'type':Sequelize[_0x2924('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x2924('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2924('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2924('0xb')],'get':function(){return this[_0x2924('0xc')](_0x2924('0xd'))+_0x2924('0xe')+this[_0x2924('0xc')]('mailbox');}}}; \ No newline at end of file +var _0x30b6=['setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x30b6,0x176));var _0x630b=function(_0x1e3885,_0x64212b){_0x1e3885=_0x1e3885-0x0;var _0x26e5a9=_0x30b6[_0x1e3885];return _0x26e5a9;};'use strict';var Sequelize=require('sequelize');module[_0x630b('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x630b('0x1')],'defaultValue':_0x630b('0x2'),'unique':_0x630b('0x3')},'mailbox':{'type':Sequelize[_0x630b('0x1')],'defaultValue':'','allowNull':![],'unique':_0x630b('0x3')},'password':{'type':Sequelize[_0x630b('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x630b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x413ff5){this[_0x630b('0x4')]('email',typeof _0x413ff5===_0x630b('0x5')&&_0x413ff5[_0x630b('0x6')]()?_0x413ff5[_0x630b('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x630b('0x1')],'defaultValue':_0x630b('0x7')},'attach':{'type':Sequelize[_0x630b('0x8')](_0x630b('0x9'),'no'),'defaultValue':_0x630b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x630b('0x9'),'no'),'defaultValue':_0x630b('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x630b('0x1')]},'callback':{'type':Sequelize[_0x630b('0x1')]},'review':{'type':Sequelize[_0x630b('0x8')](_0x630b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x630b('0x8')](_0x630b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x630b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x630b('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x630b('0x8')](_0x630b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x630b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x630b('0x9'),'no'),'defaultValue':_0x630b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x630b('0x8')](_0x630b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x630b('0x8')](_0x630b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x630b('0xb')},'emailsubject':{'type':Sequelize[_0x630b('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x630b('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x630b('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x630b('0xd')],'get':function(){return this[_0x630b('0xe')](_0x630b('0xf'))+_0x630b('0x10')+this[_0x630b('0xe')](_0x630b('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b61025c..5b3797d 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 _0xea28=['undefined','limit','count','reject','update','then','get','Voicemails','sendStatus','stack','name','send','index','map','VoiceMail','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','getMessages','VoiceMailMessage','rawAttributes','order','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x8f3c4,_0x1e4c2e){var _0x471ea2=function(_0x471bc2){while(--_0x471bc2){_0x8f3c4['push'](_0x8f3c4['shift']());}};_0x471ea2(++_0x1e4c2e);}(_0xea28,0x13a));var _0x8ea2=function(_0x3ed556,_0x4b0872){_0x3ed556=_0x3ed556-0x0;var _0x2d8b9f=_0xea28[_0x3ed556];return _0x2d8b9f;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['VoiceMail']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))[_0x8ea2('0x42')](handleError(_0x58674d,null));};exports[_0x8ea2('0x51')]=function(_0x3836c3,_0x36fda3,_0x5265e7){return db['VoiceMail']['findOne']({'where':{'id':_0x3836c3[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x36fda3,null))[_0x8ea2('0x23')](function(_0x2bbec0){var _0x57720d;var _0x11824e={},_0x2b8662={};_0x2b8662['model']=_[_0x8ea2('0x31')](db[_0x8ea2('0x52')][_0x8ea2('0x53')]);_0x2b8662[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x3836c3['query']);_0x2b8662['filters']=_['intersection'](_0x2b8662[_0x8ea2('0x2f')],_0x2b8662[_0x8ea2('0x30')]);_0x11824e[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x2b8662[_0x8ea2('0x2f')],qs['fields'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x11824e[_0x8ea2('0x32')]=_0x11824e[_0x8ea2('0x32')]['length']?_0x11824e[_0x8ea2('0x32')]:_0x2b8662['model'];if(!_0x3836c3[_0x8ea2('0x30')]['hasOwnProperty'](_0x8ea2('0x36'))){_0x11824e[_0x8ea2('0x1f')]=qs['limit'](_0x3836c3['query'][_0x8ea2('0x1f')]);_0x11824e['offset']=qs[_0x8ea2('0x1d')](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x11824e[_0x8ea2('0x54')]=qs['sort'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x37')]);_0x11824e[_0x8ea2('0x38')]=qs[_0x8ea2('0x3a')](_[_0x8ea2('0x39')](_0x3836c3[_0x8ea2('0x30')],_0x2b8662[_0x8ea2('0x3a')]));if(_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'$or':_['map'](_0x11824e[_0x8ea2('0x32')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]+'%'};return _0x4de6ba;})});}_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'mailboxuser':_0x2bbec0[_0x8ea2('0x55')]});_0x11824e=_[_0x8ea2('0x3c')]({},_0x11824e,_0x3836c3[_0x8ea2('0x3f')]);return db[_0x8ea2('0x52')]['findAndCountAll'](_0x11824e)[_0x8ea2('0x23')](respondWithFilteredResult(_0x36fda3,_0x11824e));})[_0x8ea2('0x42')](handleError(_0x36fda3,null));}; \ No newline at end of file +var _0xa902=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','nolimit','where','pick','filter','merge','type','VIRTUAL','options','VoiceMail','includeAll','findAll','rows','catch','show','include','find','create','role','UserProfileSection','error','body','params','getMessages','findOne','hasOwnProperty','sort','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x1a1991,_0x259415){var _0x36d178=function(_0x1e549c){while(--_0x1e549c){_0x1a1991['push'](_0x1a1991['shift']());}};_0x36d178(++_0x259415);}(_0xa902,0x8d));var _0x2a90=function(_0x3244f5,_0x2a9702){_0x3244f5=_0x3244f5-0x0;var _0x15d10d=_0xa902[_0x3244f5];return _0x15d10d;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){var _0x10a6dd=_0x4ed9e6[_0x2a90('0x27')]({'plain':!![]});var _0x2a212c=_0x2a90('0x28');return db[_0x2a90('0x29')][_0x2a90('0x26')]({'where':{'type':_0x2a212c,'resourceId':_0x10a6dd['id']}})['then'](function(){return _0x4ed9e6;});})[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x40c61a,_0x8544e5){return function(_0x5208d8){if(!_0x5208d8){_0x40c61a['sendStatus'](0x194);}return _0x5208d8;};}function handleError(_0x293765,_0x4ed64a){_0x4ed64a=_0x4ed64a||0x1f4;return function(_0x53391e){logger['error'](_0x53391e[_0x2a90('0x2a')]);if(_0x53391e[_0x2a90('0x2b')]){delete _0x53391e['name'];}_0x293765['status'](_0x4ed64a)[_0x2a90('0x2c')](_0x53391e);};}exports['index']=function(_0x35570e,_0x6892e1){var _0x3b580f={},_0x27b6b6={},_0xf18d11={'count':0x0,'rows':[]};var _0x11586c=_[_0x2a90('0x2d')](db['VoiceMail'][_0x2a90('0x2e')],function(_0x22b1f3){return{'name':_0x22b1f3[_0x2a90('0x2f')],'type':_0x22b1f3['type'][_0x2a90('0x30')]};});_0x27b6b6[_0x2a90('0x31')]=_[_0x2a90('0x2d')](_0x11586c,_0x2a90('0x2b'));_0x27b6b6['query']=_[_0x2a90('0x32')](_0x35570e[_0x2a90('0x33')]);_0x27b6b6[_0x2a90('0x34')]=_[_0x2a90('0x35')](_0x27b6b6[_0x2a90('0x31')],_0x27b6b6[_0x2a90('0x33')]);_0x3b580f['attributes']=_[_0x2a90('0x35')](_0x27b6b6[_0x2a90('0x31')],qs[_0x2a90('0x36')](_0x35570e[_0x2a90('0x33')]['fields']));_0x3b580f[_0x2a90('0x37')]=_0x3b580f[_0x2a90('0x37')]['length']?_0x3b580f[_0x2a90('0x37')]:_0x27b6b6[_0x2a90('0x31')];if(!_0x35570e['query']['hasOwnProperty'](_0x2a90('0x38'))){_0x3b580f[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x35570e['query'][_0x2a90('0x1d')]);_0x3b580f['offset']=qs[_0x2a90('0x1b')](_0x35570e['query'][_0x2a90('0x1b')]);}_0x3b580f['order']=qs['sort'](_0x35570e[_0x2a90('0x33')]['sort']);_0x3b580f[_0x2a90('0x39')]=qs[_0x2a90('0x34')](_[_0x2a90('0x3a')](_0x35570e['query'],_0x27b6b6[_0x2a90('0x34')]),_0x11586c);if(_0x35570e[_0x2a90('0x33')][_0x2a90('0x3b')]){_0x3b580f['where']=_[_0x2a90('0x3c')](_0x3b580f[_0x2a90('0x39')],{'$or':_[_0x2a90('0x2d')](_0x11586c,function(_0x580667){if(_0x580667[_0x2a90('0x3d')]!==_0x2a90('0x3e')){var _0x504643={};_0x504643[_0x580667[_0x2a90('0x2b')]]={'$like':'%'+_0x35570e[_0x2a90('0x33')][_0x2a90('0x3b')]+'%'};return _0x504643;}})});}_0x3b580f=_[_0x2a90('0x3c')]({},_0x3b580f,_0x35570e[_0x2a90('0x3f')]);var _0x3f2685={'where':_0x3b580f[_0x2a90('0x39')]};return db[_0x2a90('0x40')][_0x2a90('0x1e')](_0x3f2685)[_0x2a90('0x25')](function(_0x45b41c){_0xf18d11[_0x2a90('0x1e')]=_0x45b41c;if(_0x35570e[_0x2a90('0x33')][_0x2a90('0x41')]){_0x3b580f['include']=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x42')](_0x3b580f);})['then'](function(_0x1045bb){_0xf18d11[_0x2a90('0x43')]=_0x1045bb;return _0xf18d11;})[_0x2a90('0x25')](respondWithFilteredResult(_0x6892e1,_0x3b580f))[_0x2a90('0x44')](handleError(_0x6892e1,null));};exports[_0x2a90('0x45')]=function(_0x54b290,_0x145925){var _0x5c6d21={'raw':!![],'where':{'id':_0x54b290['params']['id']}},_0x4566a6={};_0x4566a6[_0x2a90('0x31')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')][_0x2a90('0x2e')]);_0x4566a6[_0x2a90('0x33')]=_[_0x2a90('0x32')](_0x54b290[_0x2a90('0x33')]);_0x4566a6['filters']=_['intersection'](_0x4566a6[_0x2a90('0x31')],_0x4566a6[_0x2a90('0x33')]);_0x5c6d21[_0x2a90('0x37')]=_[_0x2a90('0x35')](_0x4566a6[_0x2a90('0x31')],qs[_0x2a90('0x36')](_0x54b290[_0x2a90('0x33')][_0x2a90('0x36')]));_0x5c6d21['attributes']=_0x5c6d21[_0x2a90('0x37')]['length']?_0x5c6d21[_0x2a90('0x37')]:_0x4566a6[_0x2a90('0x31')];if(_0x54b290['query'][_0x2a90('0x41')]){_0x5c6d21[_0x2a90('0x46')]=[{'all':!![]}];}_0x5c6d21=_[_0x2a90('0x3c')]({},_0x5c6d21,_0x54b290[_0x2a90('0x3f')]);return db[_0x2a90('0x40')][_0x2a90('0x47')](_0x5c6d21)[_0x2a90('0x25')](handleEntityNotFound(_0x145925,null))['then'](respondWithResult(_0x145925,null))['catch'](handleError(_0x145925,null));};exports[_0x2a90('0x48')]=function(_0x2611d0,_0x42c890){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x2611d0['body'],{})['then'](function(_0x10505c){var _0x386e75=_0x2611d0['user']['get']({'plain':!![]});if(!_0x386e75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x386e75[_0x2a90('0x49')]==='user'){var _0x370da3=_0x10505c[_0x2a90('0x27')]({'plain':!![]});var _0x272d07=_0x2a90('0x28');return db[_0x2a90('0x4a')][_0x2a90('0x47')]({'where':{'name':_0x272d07,'userProfileId':_0x386e75['userProfileId']},'raw':!![]})[_0x2a90('0x25')](function(_0x46115e){if(_0x46115e&&_0x46115e['autoAssociation']===0x0){return db[_0x2a90('0x29')]['create']({'name':_0x370da3['name'],'resourceId':_0x370da3['id'],'type':_0x46115e[_0x2a90('0x2b')],'sectionId':_0x46115e['id']},{})[_0x2a90('0x25')](function(){return _0x10505c;});}else{return _0x10505c;}})['catch'](function(_0x4c0cb2){logger[_0x2a90('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c0cb2);throw _0x4c0cb2;});}return _0x10505c;})[_0x2a90('0x25')](respondWithResult(_0x42c890,0xc9))[_0x2a90('0x44')](handleError(_0x42c890,null));};exports['update']=function(_0x366429,_0x29bb7d){if(_0x366429[_0x2a90('0x4c')]['id']){delete _0x366429['body']['id'];}return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x366429['params']['id']}})['then'](handleEntityNotFound(_0x29bb7d,null))[_0x2a90('0x25')](saveUpdates(_0x366429[_0x2a90('0x4c')],null))['then'](respondWithResult(_0x29bb7d,null))[_0x2a90('0x44')](handleError(_0x29bb7d,null));};exports['destroy']=function(_0x1302b9,_0x5ab061){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x1302b9[_0x2a90('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ab061,null))['then'](removeEntity(_0x5ab061,null))['catch'](handleError(_0x5ab061,null));};exports[_0x2a90('0x4e')]=function(_0x37adad,_0x3793e5,_0x469d3c){return db[_0x2a90('0x40')][_0x2a90('0x4f')]({'where':{'id':_0x37adad[_0x2a90('0x4d')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3793e5,null))[_0x2a90('0x25')](function(_0x4f4dc6){var _0x18bb86;var _0x2442e1={},_0xb816a8={};_0xb816a8['model']=_['keys'](db['VoiceMailMessage'][_0x2a90('0x2e')]);_0xb816a8[_0x2a90('0x33')]=_[_0x2a90('0x32')](_0x37adad[_0x2a90('0x33')]);_0xb816a8[_0x2a90('0x34')]=_[_0x2a90('0x35')](_0xb816a8[_0x2a90('0x31')],_0xb816a8[_0x2a90('0x33')]);_0x2442e1[_0x2a90('0x37')]=_[_0x2a90('0x35')](_0xb816a8[_0x2a90('0x31')],qs[_0x2a90('0x36')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x36')]));_0x2442e1[_0x2a90('0x37')]=_0x2442e1[_0x2a90('0x37')]['length']?_0x2442e1[_0x2a90('0x37')]:_0xb816a8['model'];if(!_0x37adad[_0x2a90('0x33')][_0x2a90('0x50')](_0x2a90('0x38'))){_0x2442e1[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x1d')]);_0x2442e1['offset']=qs[_0x2a90('0x1b')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x1b')]);}_0x2442e1['order']=qs[_0x2a90('0x51')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x51')]);_0x2442e1[_0x2a90('0x39')]=qs['filters'](_[_0x2a90('0x3a')](_0x37adad['query'],_0xb816a8[_0x2a90('0x34')]));if(_0x37adad[_0x2a90('0x33')][_0x2a90('0x3b')]){_0x2442e1[_0x2a90('0x39')]=_[_0x2a90('0x3c')](_0x2442e1[_0x2a90('0x39')],{'$or':_['map'](_0x2442e1[_0x2a90('0x37')],function(_0x2347b6){var _0x120c17={};_0x120c17[_0x2347b6]={'$like':'%'+_0x37adad[_0x2a90('0x33')][_0x2a90('0x3b')]+'%'};return _0x120c17;})});}_0x2442e1[_0x2a90('0x39')]=_[_0x2a90('0x3c')](_0x2442e1[_0x2a90('0x39')],{'mailboxuser':_0x4f4dc6[_0x2a90('0x52')]});_0x2442e1=_['merge']({},_0x2442e1,_0x37adad[_0x2a90('0x3f')]);return db[_0x2a90('0x53')][_0x2a90('0x54')](_0x2442e1)['then'](respondWithFilteredResult(_0x3793e5,_0x2442e1));})[_0x2a90('0x44')](handleError(_0x3793e5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 117c16b..90de1dc 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 _0x8377=['./voiceMail.attributes','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1fcbe0,_0x5b43be){var _0xbcf95b=function(_0x1c631d){while(--_0x1c631d){_0x1fcbe0['push'](_0x1fcbe0['shift']());}};_0xbcf95b(++_0x5b43be);}(_0x8377,0xc9));var _0x7837=function(_0xd0ebcd,_0x37863c){_0xd0ebcd=_0xd0ebcd-0x0;var _0x1204fa=_0x8377[_0xd0ebcd];return _0x1204fa;};'use strict';var _=require(_0x7837('0x0'));var util=require(_0x7837('0x1'));var logger=require(_0x7837('0x2'))(_0x7837('0x3'));var moment=require(_0x7837('0x4'));var BPromise=require(_0x7837('0x5'));var rp=require(_0x7837('0x6'));var fs=require('fs');var path=require(_0x7837('0x7'));var rimraf=require(_0x7837('0x8'));var config=require('../../config/environment');var attributes=require(_0x7837('0x9'));module['exports']=function(_0x2a7057,_0x29105d){return _0x2a7057['define'](_0x7837('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x7837('0xb'),'fields':[_0x7837('0xc'),_0x7837('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcaeb=['mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceMail.attributes','define'];(function(_0x1bd2bb,_0x419bac){var _0x4fc650=function(_0x251e21){while(--_0x251e21){_0x1bd2bb['push'](_0x1bd2bb['shift']());}};_0x4fc650(++_0x419bac);}(_0xcaeb,0x17c));var _0xbcae=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xcaeb[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xbcae('0x0'));var util=require(_0xbcae('0x1'));var logger=require(_0xbcae('0x2'))(_0xbcae('0x3'));var moment=require(_0xbcae('0x4'));var BPromise=require('bluebird');var rp=require(_0xbcae('0x5'));var fs=require('fs');var path=require(_0xbcae('0x6'));var rimraf=require('rimraf');var config=require(_0xbcae('0x7'));var attributes=require(_0xbcae('0x8'));module['exports']=function(_0x402002,_0x1a8b08){return _0x402002[_0xbcae('0x9')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xbcae('0xa'),'fields':[_0xbcae('0xb'),_0xbcae('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3de5ba6..bc0da0e 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 _0xbcbb=['stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x46fe66,_0x4b0d58){var _0x4aff52=function(_0x20f329){while(--_0x20f329){_0x46fe66['push'](_0x46fe66['shift']());}};_0x4aff52(++_0x4b0d58);}(_0xbcbb,0x180));var _0xbbcb=function(_0x3a2fe5,_0x4f3adf){_0x3a2fe5=_0x3a2fe5-0x0;var _0x5aacd1=_0xbcbb[_0x3a2fe5];return _0x5aacd1;};'use strict';var _=require(_0xbbcb('0x0'));var util=require(_0xbbcb('0x1'));var moment=require(_0xbbcb('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbcb('0x3'));var fs=require('fs');var Redis=require(_0xbbcb('0x4'));var db=require(_0xbbcb('0x5'))['db'];var utils=require(_0xbbcb('0x6'));var logger=require('../../config/logger')(_0xbbcb('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbcb('0x8'));var client=jayson[_0xbbcb('0x9')][_0xbbcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x575394,_0x872e11,_0x461b7b){return new BPromise(function(_0xff318d,_0x40d49b){return client[_0xbbcb('0xb')](_0x575394,_0x461b7b)[_0xbbcb('0xc')](function(_0x37172c){logger['info'](_0xbbcb('0xd'),_0x872e11,_0xbbcb('0xe'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x872e11,_0xbbcb('0xe'),JSON[_0xbbcb('0xf')](_0x37172c));if(_0x37172c[_0xbbcb('0x10')]){if(_0x37172c[_0xbbcb('0x10')]['code']===0x1f4){logger['error'](_0xbbcb('0xd'),_0x872e11,_0x37172c[_0xbbcb('0x10')][_0xbbcb('0x11')]);return _0x40d49b(_0x37172c['error']['message']);}logger[_0xbbcb('0x10')](_0xbbcb('0xd'),_0x872e11,_0x37172c['error'][_0xbbcb('0x11')]);return _0xff318d(_0x37172c[_0xbbcb('0x10')][_0xbbcb('0x11')]);}else{logger['info'](_0xbbcb('0xd'),_0x872e11,_0xbbcb('0xe'));_0xff318d(_0x37172c[_0xbbcb('0x12')][_0xbbcb('0x11')]);}})['catch'](function(_0x42e00f){logger[_0xbbcb('0x10')](_0xbbcb('0xd'),_0x872e11,_0x42e00f);_0x40d49b(_0x42e00f);});});} \ No newline at end of file +var _0xe7d6=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','lodash','randomstring','ioredis'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xe7d6,0x153));var _0x6e7d=function(_0x15a176,_0xfea70a){_0x15a176=_0x15a176-0x0;var _0x157570=_0xe7d6[_0x15a176];return _0x157570;};'use strict';var _=require(_0x6e7d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e7d('0x1'));var fs=require('fs');var Redis=require(_0x6e7d('0x2'));var db=require(_0x6e7d('0x3'))['db'];var utils=require(_0x6e7d('0x4'));var logger=require(_0x6e7d('0x5'))(_0x6e7d('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e7d('0x7'));var client=jayson[_0x6e7d('0x8')][_0x6e7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46ba03,_0x5a401a,_0x131b45){return new BPromise(function(_0x2cc8ee,_0x4630ac){return client[_0x6e7d('0xa')](_0x46ba03,_0x131b45)[_0x6e7d('0xb')](function(_0x1b2b49){logger['info'](_0x6e7d('0xc'),_0x5a401a,_0x6e7d('0xd'));logger[_0x6e7d('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5a401a,_0x6e7d('0xd'),JSON[_0x6e7d('0xf')](_0x1b2b49));if(_0x1b2b49['error']){if(_0x1b2b49[_0x6e7d('0x10')]['code']===0x1f4){logger['error'](_0x6e7d('0xc'),_0x5a401a,_0x1b2b49[_0x6e7d('0x10')][_0x6e7d('0x11')]);return _0x4630ac(_0x1b2b49[_0x6e7d('0x10')]['message']);}logger[_0x6e7d('0x10')](_0x6e7d('0xc'),_0x5a401a,_0x1b2b49[_0x6e7d('0x10')][_0x6e7d('0x11')]);return _0x2cc8ee(_0x1b2b49[_0x6e7d('0x10')][_0x6e7d('0x11')]);}else{logger[_0x6e7d('0x12')]('VoiceMail,\x20%s,\x20%s',_0x5a401a,_0x6e7d('0xd'));_0x2cc8ee(_0x1b2b49['result'][_0x6e7d('0x11')]);}})['catch'](function(_0x2214c2){logger['error'](_0x6e7d('0xc'),_0x5a401a,_0x2214c2);_0x4630ac(_0x2214c2);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 32086d5..c81f379 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 _0x6055=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x6055,0xf2));var _0x5605=function(_0x4745e8,_0x1553cb){_0x4745e8=_0x4745e8-0x0;var _0x2f5b37=_0x6055[_0x4745e8];return _0x2f5b37;};'use strict';var multer=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var path=require('path');var timeout=require(_0x5605('0x2'));var express=require(_0x5605('0x3'));var router=express[_0x5605('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5605('0x5'));var controller=require(_0x5605('0x6'));router[_0x5605('0x7')]('/',auth[_0x5605('0x8')](),controller[_0x5605('0x9')]);router[_0x5605('0x7')](_0x5605('0xa'),auth['isAuthenticated'](),controller[_0x5605('0xb')]);router['get']('/:id/download',auth[_0x5605('0x8')](),controller[_0x5605('0xc')]);router[_0x5605('0xd')]('/',auth[_0x5605('0x8')](),controller[_0x5605('0xe')]);router[_0x5605('0xf')](_0x5605('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5605('0x10')](_0x5605('0xa'),auth[_0x5605('0x8')](),controller[_0x5605('0x11')]);module[_0x5605('0x12')]=router; \ No newline at end of file +var _0x7d17=['Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','download','delete','destroy','exports','multer','util','path'];(function(_0x4174ce,_0x340713){var _0x1d5a91=function(_0x297a2e){while(--_0x297a2e){_0x4174ce['push'](_0x4174ce['shift']());}};_0x1d5a91(++_0x340713);}(_0x7d17,0x1e7));var _0x77d1=function(_0x231102,_0x3049a5){_0x231102=_0x231102-0x0;var _0x30e0e4=_0x7d17[_0x231102];return _0x30e0e4;};'use strict';var multer=require(_0x77d1('0x0'));var util=require(_0x77d1('0x1'));var path=require(_0x77d1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77d1('0x3')]();var fs_extra=require(_0x77d1('0x4'));var auth=require(_0x77d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x77d1('0x6')]('/',auth['isAuthenticated'](),controller[_0x77d1('0x7')]);router[_0x77d1('0x6')](_0x77d1('0x8'),auth[_0x77d1('0x9')](),controller['show']);router[_0x77d1('0x6')]('/:id/download',auth[_0x77d1('0x9')](),controller[_0x77d1('0xa')]);router['post']('/',auth[_0x77d1('0x9')](),controller['create']);router['put']('/:id',auth[_0x77d1('0x9')](),controller['update']);router[_0x77d1('0xb')](_0x77d1('0x8'),auth['isAuthenticated'](),controller[_0x77d1('0xc')]);module[_0x77d1('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9011773..4288454 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 _0xa70a=['literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa70a,0x12d));var _0xaa70=function(_0x81117a,_0x5ebc90){_0x81117a=_0x81117a-0x0;var _0x5ca829=_0xa70a[_0x81117a];return _0x5ca829;};'use strict';var Sequelize=require(_0xaa70('0x0'));module[_0xaa70('0x1')]={'name':{'type':Sequelize[_0xaa70('0x2')],'get':function(_0x5c2e45){return this[_0xaa70('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xaa70('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xaa70('0x6')](_0xaa70('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'stamp':{'type':_0xaa70('0x8'),'defaultValue':Sequelize[_0xaa70('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x29b2=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','INTEGER','STRING','BLOB'];(function(_0x530293,_0x1dd369){var _0xcd14d3=function(_0x32951d){while(--_0x32951d){_0x530293['push'](_0x530293['shift']());}};_0xcd14d3(++_0x1dd369);}(_0x29b2,0x175));var _0x229b=function(_0x535047,_0x147551){_0x535047=_0x535047-0x0;var _0x3ab583=_0x29b2[_0x535047];return _0x3ab583;};'use strict';var Sequelize=require(_0x229b('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4738b3){return this[_0x229b('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x229b('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x229b('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x229b('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x229b('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x229b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x229b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x229b('0x4')](_0x229b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x229b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x229b('0x6'),'defaultValue':Sequelize[_0x229b('0x7')](_0x229b('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 1534935..082e653 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 _0x9f0c=['download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','name','send','VoiceMailMessage','type','key','model','differenceBy','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','catch','body'];(function(_0x2f1172,_0x5f5b26){var _0x58e374=function(_0x1a61fa){while(--_0x1a61fa){_0x2f1172['push'](_0x2f1172['shift']());}};_0x58e374(++_0x5f5b26);}(_0x9f0c,0x155));var _0xc9f0=function(_0x54c31f,_0x380def){_0x54c31f=_0x54c31f-0x0;var _0x101899=_0x9f0c[_0x54c31f];return _0x101899;};'use strict';var emlformat=require(_0xc9f0('0x0'));var rimraf=require(_0xc9f0('0x1'));var zipdir=require(_0xc9f0('0x2'));var jsonpatch=require(_0xc9f0('0x3'));var rp=require(_0xc9f0('0x4'));var moment=require(_0xc9f0('0x5'));var BPromise=require(_0xc9f0('0x6'));var Mustache=require('mustache');var util=require(_0xc9f0('0x7'));var path=require(_0xc9f0('0x8'));var sox=require('sox');var csv=require(_0xc9f0('0x9'));var ejs=require(_0xc9f0('0xa'));var fs=require('fs');var fs_extra=require(_0xc9f0('0xb'));var _=require(_0xc9f0('0xc'));var squel=require(_0xc9f0('0xd'));var crypto=require(_0xc9f0('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc9f0('0x9'));var querystring=require(_0xc9f0('0xf'));var Papa=require(_0xc9f0('0x10'));var Redis=require(_0xc9f0('0x11'));var authService=require(_0xc9f0('0x12'));var qs=require(_0xc9f0('0x13'));var as=require(_0xc9f0('0x14'));var hardwareService=require(_0xc9f0('0x15'));var logger=require(_0xc9f0('0x16'))('api');var utils=require(_0xc9f0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc9f0('0x18'))['db'];function respondWithStatusCode(_0x55a329,_0x1c1835){_0x1c1835=_0x1c1835||0xcc;return function(_0x3d7f41){if(_0x3d7f41){return _0x55a329[_0xc9f0('0x19')](_0x1c1835);}return _0x55a329[_0xc9f0('0x1a')](_0x1c1835)[_0xc9f0('0x1b')]();};}function respondWithResult(_0x1ba860,_0x336a37){_0x336a37=_0x336a37||0xc8;return function(_0x3fc56f){if(_0x3fc56f){return _0x1ba860[_0xc9f0('0x1a')](_0x336a37)['json'](_0x3fc56f);}};}function respondWithFilteredResult(_0x3adbfc,_0x4ae727){return function(_0x49a1a0){if(_0x49a1a0){var _0x11dc08=typeof _0x4ae727[_0xc9f0('0x1c')]==='undefined'&&typeof _0x4ae727['limit']===_0xc9f0('0x1d');var _0x5f4b01=_0x49a1a0[_0xc9f0('0x1e')];var _0x5b0ce9=_0x11dc08?0x0:_0x4ae727['offset'];var _0x488bb2=_0x11dc08?_0x49a1a0['count']:_0x4ae727['offset']+_0x4ae727[_0xc9f0('0x1f')];var _0x3c625c;if(_0x488bb2>=_0x5f4b01){_0x488bb2=_0x5f4b01;_0x3c625c=0xc8;}else{_0x3c625c=0xce;}_0x3adbfc[_0xc9f0('0x1a')](_0x3c625c);return _0x3adbfc['set'](_0xc9f0('0x20'),_0x5b0ce9+'-'+_0x488bb2+'/'+_0x5f4b01)[_0xc9f0('0x21')](_0x49a1a0);}return null;};}function patchUpdates(_0x4dcb72){return function(_0x1775c8){try{jsonpatch[_0xc9f0('0x22')](_0x1775c8,_0x4dcb72,!![]);}catch(_0x49e6cf){return BPromise['reject'](_0x49e6cf);}return _0x1775c8[_0xc9f0('0x23')]();};}function saveUpdates(_0xdcfd79,_0x20a1d9){return function(_0x308470){if(_0x308470){return _0x308470[_0xc9f0('0x24')](_0xdcfd79)[_0xc9f0('0x25')](function(_0x27e26){return _0x27e26;});}return null;};}function removeEntity(_0x5abc96,_0x286b05){return function(_0x5344a5){if(_0x5344a5){return _0x5344a5[_0xc9f0('0x26')]()['then'](function(){_0x5abc96[_0xc9f0('0x1a')](0xcc)[_0xc9f0('0x1b')]();});}};}function handleEntityNotFound(_0x24ca44,_0x133456){return function(_0x2628e){if(!_0x2628e){_0x24ca44[_0xc9f0('0x19')](0x194);}return _0x2628e;};}function handleError(_0x20044d,_0x39df0c){_0x39df0c=_0x39df0c||0x1f4;return function(_0x56279d){logger[_0xc9f0('0x27')](_0x56279d['stack']);if(_0x56279d['name']){delete _0x56279d[_0xc9f0('0x28')];}_0x20044d[_0xc9f0('0x1a')](_0x39df0c)[_0xc9f0('0x29')](_0x56279d);};}exports['index']=function(_0x585eeb,_0x55964c){var _0x2cb604={},_0x411a0c={},_0x483e6d={'count':0x0,'rows':[]};var _0x56a00f=_['map'](db[_0xc9f0('0x2a')]['rawAttributes'],function(_0xda5d67){return{'name':_0xda5d67['fieldName'],'type':_0xda5d67[_0xc9f0('0x2b')][_0xc9f0('0x2c')]};});_0x411a0c[_0xc9f0('0x2d')]=_[_0xc9f0('0x2e')](_[_0xc9f0('0x2f')](_0x56a00f,_0xc9f0('0x28')),[_0xc9f0('0x28')]);_0x411a0c[_0xc9f0('0x30')]=_['keys'](_0x585eeb[_0xc9f0('0x30')]);_0x411a0c['filters']=_[_0xc9f0('0x31')](_0x411a0c[_0xc9f0('0x2d')],_0x411a0c[_0xc9f0('0x30')]);_0x2cb604[_0xc9f0('0x32')]=_[_0xc9f0('0x31')](_0x411a0c[_0xc9f0('0x2d')],qs[_0xc9f0('0x33')](_0x585eeb['query'][_0xc9f0('0x33')]));_0x2cb604[_0xc9f0('0x32')]=_0x2cb604[_0xc9f0('0x32')][_0xc9f0('0x34')]?_0x2cb604[_0xc9f0('0x32')]:_0x411a0c[_0xc9f0('0x2d')];if(!_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x35')](_0xc9f0('0x36'))){_0x2cb604[_0xc9f0('0x1f')]=qs['limit'](_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x1f')]);_0x2cb604[_0xc9f0('0x1c')]=qs['offset'](_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x1c')]);}_0x2cb604[_0xc9f0('0x37')]=qs[_0xc9f0('0x38')](_0x585eeb['query'][_0xc9f0('0x38')]);_0x2cb604['where']=qs[_0xc9f0('0x39')](_[_0xc9f0('0x3a')](_0x585eeb[_0xc9f0('0x30')],_0x411a0c[_0xc9f0('0x39')]),_0x56a00f);if(_0x585eeb[_0xc9f0('0x30')]['filter']){_0x2cb604[_0xc9f0('0x3b')]=_[_0xc9f0('0x3c')](_0x2cb604[_0xc9f0('0x3b')],{'$or':_[_0xc9f0('0x2f')](_0x56a00f,function(_0xa163ba){if(_0xa163ba['type']!==_0xc9f0('0x3d')){var _0x4b2349={};_0x4b2349[_0xa163ba[_0xc9f0('0x28')]]={'$like':'%'+_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x3e')]+'%'};return _0x4b2349;}})});}_0x2cb604=_[_0xc9f0('0x3c')]({},_0x2cb604,_0x585eeb['options']);var _0x5092f6={'where':_0x2cb604['where']};return db[_0xc9f0('0x2a')]['count'](_0x5092f6)[_0xc9f0('0x25')](function(_0x59f386){_0x483e6d[_0xc9f0('0x1e')]=_0x59f386;if(_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x3f')]){_0x2cb604[_0xc9f0('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xc9f0('0x41')](_0x2cb604);})[_0xc9f0('0x25')](function(_0x5e904d){_0x483e6d['rows']=_0x5e904d;return _0x483e6d;})['then'](respondWithFilteredResult(_0x55964c,_0x2cb604))['catch'](handleError(_0x55964c,null));};exports[_0xc9f0('0x42')]=function(_0x55226e,_0x5733ef){var _0x6ce606={'raw':!![],'where':{'id':_0x55226e[_0xc9f0('0x43')]['id']}},_0x5af9f0={};_0x5af9f0[_0xc9f0('0x2d')]=_[_0xc9f0('0x44')](db[_0xc9f0('0x2a')][_0xc9f0('0x45')]);_0x5af9f0[_0xc9f0('0x30')]=_[_0xc9f0('0x44')](_0x55226e[_0xc9f0('0x30')]);_0x5af9f0[_0xc9f0('0x39')]=_[_0xc9f0('0x31')](_0x5af9f0[_0xc9f0('0x2d')],_0x5af9f0[_0xc9f0('0x30')]);_0x6ce606[_0xc9f0('0x32')]=_[_0xc9f0('0x31')](_0x5af9f0[_0xc9f0('0x2d')],qs[_0xc9f0('0x33')](_0x55226e[_0xc9f0('0x30')][_0xc9f0('0x33')]));_0x6ce606['attributes']=_0x6ce606[_0xc9f0('0x32')][_0xc9f0('0x34')]?_0x6ce606[_0xc9f0('0x32')]:_0x5af9f0['model'];if(_0x55226e[_0xc9f0('0x30')][_0xc9f0('0x3f')]){_0x6ce606[_0xc9f0('0x40')]=[{'all':!![]}];}_0x6ce606=_['merge']({},_0x6ce606,_0x55226e[_0xc9f0('0x46')]);return db[_0xc9f0('0x2a')][_0xc9f0('0x47')](_0x6ce606)[_0xc9f0('0x25')](handleEntityNotFound(_0x5733ef,null))['then'](respondWithResult(_0x5733ef,null))[_0xc9f0('0x48')](handleError(_0x5733ef,null));};exports['create']=function(_0x6c2d7c,_0x58cd77){return db[_0xc9f0('0x2a')]['create'](_0x6c2d7c['body'],{})[_0xc9f0('0x25')](respondWithResult(_0x58cd77,0xc9))[_0xc9f0('0x48')](handleError(_0x58cd77,null));};exports['update']=function(_0x595f9e,_0x4587a4){if(_0x595f9e[_0xc9f0('0x49')]['id']){delete _0x595f9e[_0xc9f0('0x49')]['id'];}return db[_0xc9f0('0x2a')][_0xc9f0('0x47')]({'where':{'id':_0x595f9e[_0xc9f0('0x43')]['id']}})[_0xc9f0('0x25')](handleEntityNotFound(_0x4587a4,null))[_0xc9f0('0x25')](saveUpdates(_0x595f9e[_0xc9f0('0x49')],null))[_0xc9f0('0x25')](respondWithResult(_0x4587a4,null))[_0xc9f0('0x48')](handleError(_0x4587a4,null));};exports[_0xc9f0('0x26')]=function(_0x31004c,_0x3a10c2){return db[_0xc9f0('0x2a')][_0xc9f0('0x47')]({'where':{'id':_0x31004c[_0xc9f0('0x43')]['id']}})[_0xc9f0('0x25')](handleEntityNotFound(_0x3a10c2,null))['then'](removeEntity(_0x3a10c2,null))[_0xc9f0('0x48')](handleError(_0x3a10c2,null));};exports[_0xc9f0('0x4a')]=function(_0x4dbce6,_0x293dd5,_0x1f105e){return db[_0xc9f0('0x2a')]['find']({'where':{'id':_0x4dbce6[_0xc9f0('0x43')]['id']},'attributes':['id',_0xc9f0('0x4b'),_0xc9f0('0x4c')]})[_0xc9f0('0x25')](handleEntityNotFound(_0x293dd5,null))[_0xc9f0('0x25')](function(_0x32c221){if(_0x32c221){if(!_0x32c221['recording']){throw new db[(_0xc9f0('0x4d'))][(_0xc9f0('0x4e'))](_0xc9f0('0x4f'));}var _0x8b7b12={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x32c221[_0xc9f0('0x4c')]){_0x8b7b12[_0xc9f0('0x50')]=_0xc9f0('0x51')+_0x32c221['msg_id']+_0xc9f0('0x52');}_0x293dd5['set'](_0x8b7b12);return _0x293dd5['send'](new Buffer(_0x32c221[_0xc9f0('0x4b')]));}})['catch'](handleError(_0x293dd5,null));}; \ No newline at end of file +var _0x0de5=['sort','pick','filter','where','type','VIRTUAL','merge','then','includeAll','include','findAll','rows','show','params','length','options','find','catch','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x2c1217,_0x18645c){var _0x7e522b=function(_0x4b2bfc){while(--_0x4b2bfc){_0x2c1217['push'](_0x2c1217['shift']());}};_0x7e522b(++_0x18645c);}(_0x0de5,0x11b));var _0x50de=function(_0x2678ad,_0x3aae00){_0x2678ad=_0x2678ad-0x0;var _0x402c47=_0x0de5[_0x2678ad];return _0x402c47;};'use strict';var emlformat=require(_0x50de('0x0'));var rimraf=require(_0x50de('0x1'));var zipdir=require(_0x50de('0x2'));var jsonpatch=require(_0x50de('0x3'));var rp=require(_0x50de('0x4'));var moment=require(_0x50de('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x50de('0x6'));var sox=require(_0x50de('0x7'));var csv=require(_0x50de('0x8'));var ejs=require(_0x50de('0x9'));var fs=require('fs');var fs_extra=require(_0x50de('0xa'));var _=require('lodash');var squel=require(_0x50de('0xb'));var crypto=require(_0x50de('0xc'));var jsforce=require(_0x50de('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x50de('0x8'));var querystring=require('querystring');var Papa=require(_0x50de('0xe'));var Redis=require(_0x50de('0xf'));var authService=require(_0x50de('0x10'));var qs=require(_0x50de('0x11'));var as=require(_0x50de('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x50de('0x13'));var utils=require(_0x50de('0x14'));var config=require(_0x50de('0x15'));var licenseUtil=require(_0x50de('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c774,_0x1cfd12){_0x1cfd12=_0x1cfd12||0xcc;return function(_0x134cf2){if(_0x134cf2){return _0x36c774[_0x50de('0x17')](_0x1cfd12);}return _0x36c774[_0x50de('0x18')](_0x1cfd12)['end']();};}function respondWithResult(_0x159b02,_0x165786){_0x165786=_0x165786||0xc8;return function(_0x50c128){if(_0x50c128){return _0x159b02[_0x50de('0x18')](_0x165786)['json'](_0x50c128);}};}function respondWithFilteredResult(_0x59da7c,_0x19716){return function(_0x3e4dd2){if(_0x3e4dd2){var _0x3c50b5=typeof _0x19716[_0x50de('0x19')]===_0x50de('0x1a')&&typeof _0x19716[_0x50de('0x1b')]===_0x50de('0x1a');var _0x3fbc13=_0x3e4dd2[_0x50de('0x1c')];var _0x81f41e=_0x3c50b5?0x0:_0x19716[_0x50de('0x19')];var _0x5f0f4b=_0x3c50b5?_0x3e4dd2[_0x50de('0x1c')]:_0x19716[_0x50de('0x19')]+_0x19716[_0x50de('0x1b')];var _0x1a299b;if(_0x5f0f4b>=_0x3fbc13){_0x5f0f4b=_0x3fbc13;_0x1a299b=0xc8;}else{_0x1a299b=0xce;}_0x59da7c[_0x50de('0x18')](_0x1a299b);return _0x59da7c[_0x50de('0x1d')]('Content-Range',_0x81f41e+'-'+_0x5f0f4b+'/'+_0x3fbc13)[_0x50de('0x1e')](_0x3e4dd2);}return null;};}function patchUpdates(_0x9f89d5){return function(_0x391064){try{jsonpatch[_0x50de('0x1f')](_0x391064,_0x9f89d5,!![]);}catch(_0x402d11){return BPromise[_0x50de('0x20')](_0x402d11);}return _0x391064['save']();};}function saveUpdates(_0x18511b,_0x4e9f79){return function(_0x4b03bf){if(_0x4b03bf){return _0x4b03bf[_0x50de('0x21')](_0x18511b)['then'](function(_0xa23f60){return _0xa23f60;});}return null;};}function removeEntity(_0x2a3137,_0x16f584){return function(_0x151022){if(_0x151022){return _0x151022['destroy']()['then'](function(){_0x2a3137[_0x50de('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bce06,_0x498fdc){return function(_0x1ba966){if(!_0x1ba966){_0x5bce06[_0x50de('0x17')](0x194);}return _0x1ba966;};}function handleError(_0x4662c7,_0x304793){_0x304793=_0x304793||0x1f4;return function(_0x4884dd){logger[_0x50de('0x22')](_0x4884dd[_0x50de('0x23')]);if(_0x4884dd[_0x50de('0x24')]){delete _0x4884dd[_0x50de('0x24')];}_0x4662c7[_0x50de('0x18')](_0x304793)[_0x50de('0x25')](_0x4884dd);};}exports['index']=function(_0x5085cc,_0x25f3c6){var _0x201697={},_0x14f6c9={},_0xb975dd={'count':0x0,'rows':[]};var _0x244699=_[_0x50de('0x26')](db[_0x50de('0x27')][_0x50de('0x28')],function(_0x1b6c55){return{'name':_0x1b6c55[_0x50de('0x29')],'type':_0x1b6c55['type'][_0x50de('0x2a')]};});_0x14f6c9[_0x50de('0x2b')]=_[_0x50de('0x2c')](_[_0x50de('0x26')](_0x244699,_0x50de('0x24')),['name']);_0x14f6c9[_0x50de('0x2d')]=_[_0x50de('0x2e')](_0x5085cc[_0x50de('0x2d')]);_0x14f6c9[_0x50de('0x2f')]=_['intersection'](_0x14f6c9['model'],_0x14f6c9[_0x50de('0x2d')]);_0x201697['attributes']=_[_0x50de('0x30')](_0x14f6c9[_0x50de('0x2b')],qs['fields'](_0x5085cc[_0x50de('0x2d')][_0x50de('0x31')]));_0x201697['attributes']=_0x201697[_0x50de('0x32')]['length']?_0x201697[_0x50de('0x32')]:_0x14f6c9[_0x50de('0x2b')];if(!_0x5085cc[_0x50de('0x2d')][_0x50de('0x33')](_0x50de('0x34'))){_0x201697[_0x50de('0x1b')]=qs[_0x50de('0x1b')](_0x5085cc[_0x50de('0x2d')][_0x50de('0x1b')]);_0x201697[_0x50de('0x19')]=qs[_0x50de('0x19')](_0x5085cc[_0x50de('0x2d')]['offset']);}_0x201697['order']=qs[_0x50de('0x35')](_0x5085cc['query'][_0x50de('0x35')]);_0x201697['where']=qs['filters'](_[_0x50de('0x36')](_0x5085cc[_0x50de('0x2d')],_0x14f6c9[_0x50de('0x2f')]),_0x244699);if(_0x5085cc[_0x50de('0x2d')][_0x50de('0x37')]){_0x201697[_0x50de('0x38')]=_['merge'](_0x201697[_0x50de('0x38')],{'$or':_['map'](_0x244699,function(_0x5a01e6){if(_0x5a01e6[_0x50de('0x39')]!==_0x50de('0x3a')){var _0x4680d6={};_0x4680d6[_0x5a01e6[_0x50de('0x24')]]={'$like':'%'+_0x5085cc['query'][_0x50de('0x37')]+'%'};return _0x4680d6;}})});}_0x201697=_[_0x50de('0x3b')]({},_0x201697,_0x5085cc['options']);var _0x267512={'where':_0x201697[_0x50de('0x38')]};return db['VoiceMailMessage'][_0x50de('0x1c')](_0x267512)[_0x50de('0x3c')](function(_0x3c4eed){_0xb975dd['count']=_0x3c4eed;if(_0x5085cc[_0x50de('0x2d')][_0x50de('0x3d')]){_0x201697[_0x50de('0x3e')]=[{'all':!![]}];}return db[_0x50de('0x27')][_0x50de('0x3f')](_0x201697);})['then'](function(_0x4b72de){_0xb975dd[_0x50de('0x40')]=_0x4b72de;return _0xb975dd;})[_0x50de('0x3c')](respondWithFilteredResult(_0x25f3c6,_0x201697))['catch'](handleError(_0x25f3c6,null));};exports[_0x50de('0x41')]=function(_0x390b28,_0x293b6){var _0x39a8cb={'raw':!![],'where':{'id':_0x390b28[_0x50de('0x42')]['id']}},_0x5b256d={};_0x5b256d[_0x50de('0x2b')]=_[_0x50de('0x2e')](db[_0x50de('0x27')]['rawAttributes']);_0x5b256d['query']=_[_0x50de('0x2e')](_0x390b28['query']);_0x5b256d['filters']=_[_0x50de('0x30')](_0x5b256d[_0x50de('0x2b')],_0x5b256d[_0x50de('0x2d')]);_0x39a8cb[_0x50de('0x32')]=_[_0x50de('0x30')](_0x5b256d[_0x50de('0x2b')],qs[_0x50de('0x31')](_0x390b28['query'][_0x50de('0x31')]));_0x39a8cb[_0x50de('0x32')]=_0x39a8cb[_0x50de('0x32')][_0x50de('0x43')]?_0x39a8cb[_0x50de('0x32')]:_0x5b256d[_0x50de('0x2b')];if(_0x390b28[_0x50de('0x2d')][_0x50de('0x3d')]){_0x39a8cb[_0x50de('0x3e')]=[{'all':!![]}];}_0x39a8cb=_['merge']({},_0x39a8cb,_0x390b28[_0x50de('0x44')]);return db[_0x50de('0x27')][_0x50de('0x45')](_0x39a8cb)[_0x50de('0x3c')](handleEntityNotFound(_0x293b6,null))[_0x50de('0x3c')](respondWithResult(_0x293b6,null))[_0x50de('0x46')](handleError(_0x293b6,null));};exports[_0x50de('0x47')]=function(_0x317da2,_0x35a6e2){return db[_0x50de('0x27')][_0x50de('0x47')](_0x317da2[_0x50de('0x48')],{})[_0x50de('0x3c')](respondWithResult(_0x35a6e2,0xc9))[_0x50de('0x46')](handleError(_0x35a6e2,null));};exports[_0x50de('0x21')]=function(_0x41ec0f,_0x2173a8){if(_0x41ec0f[_0x50de('0x48')]['id']){delete _0x41ec0f[_0x50de('0x48')]['id'];}return db[_0x50de('0x27')][_0x50de('0x45')]({'where':{'id':_0x41ec0f[_0x50de('0x42')]['id']}})[_0x50de('0x3c')](handleEntityNotFound(_0x2173a8,null))[_0x50de('0x3c')](saveUpdates(_0x41ec0f['body'],null))['then'](respondWithResult(_0x2173a8,null))[_0x50de('0x46')](handleError(_0x2173a8,null));};exports[_0x50de('0x49')]=function(_0x4c278f,_0x35a715){return db[_0x50de('0x27')][_0x50de('0x45')]({'where':{'id':_0x4c278f[_0x50de('0x42')]['id']}})[_0x50de('0x3c')](handleEntityNotFound(_0x35a715,null))[_0x50de('0x3c')](removeEntity(_0x35a715,null))['catch'](handleError(_0x35a715,null));};exports[_0x50de('0x4a')]=function(_0x1b2ad4,_0x21eea9,_0x561514){return db[_0x50de('0x27')][_0x50de('0x45')]({'where':{'id':_0x1b2ad4[_0x50de('0x42')]['id']},'attributes':['id',_0x50de('0x4b'),_0x50de('0x4c')]})[_0x50de('0x3c')](handleEntityNotFound(_0x21eea9,null))['then'](function(_0x515151){if(_0x515151){if(!_0x515151[_0x50de('0x4b')]){throw new db[(_0x50de('0x4d'))][(_0x50de('0x4e'))](_0x50de('0x4f'));}var _0x3d5532={'Content-Type':_0x50de('0x50'),'Content-Disposition':_0x50de('0x51')};if(_0x515151['msg_id']){_0x3d5532[_0x50de('0x52')]=_0x50de('0x53')+_0x515151['msg_id']+'.wav\x22';}_0x21eea9[_0x50de('0x1d')](_0x3d5532);return _0x21eea9[_0x50de('0x25')](new Buffer(_0x515151[_0x50de('0x4b')]));}})[_0x50de('0x46')](handleError(_0x21eea9,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 6e0544a..1df28d0 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 _0xf111=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x4a6a1a,_0x36d024){var _0x2b02f6=function(_0x2ea1f3){while(--_0x2ea1f3){_0x4a6a1a['push'](_0x4a6a1a['shift']());}};_0x2b02f6(++_0x36d024);}(_0xf111,0xb6));var _0x1f11=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xf111[_0x239dba];return _0x1ceb11;};'use strict';var _=require(_0x1f11('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1f11('0x1'));var moment=require(_0x1f11('0x2'));var BPromise=require(_0x1f11('0x3'));var rp=require(_0x1f11('0x4'));var fs=require('fs');var path=require(_0x1f11('0x5'));var rimraf=require(_0x1f11('0x6'));var config=require(_0x1f11('0x7'));var attributes=require(_0x1f11('0x8'));module[_0x1f11('0x9')]=function(_0x26f5d3,_0x536f35){return _0x26f5d3[_0x1f11('0xa')](_0x1f11('0xb'),attributes,{'tableName':_0x1f11('0xc'),'paranoid':![],'indexes':[{'name':_0x1f11('0xd'),'fields':[_0x1f11('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5af8=['lodash','util','api','moment','bluebird','request-promise','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x21c0de,_0x4a9720){var _0x32229e=function(_0x275c29){while(--_0x275c29){_0x21c0de['push'](_0x21c0de['shift']());}};_0x32229e(++_0x4a9720);}(_0x5af8,0x1c8));var _0x85af=function(_0x2a251e,_0x5e9c7a){_0x2a251e=_0x2a251e-0x0;var _0x10821b=_0x5af8[_0x2a251e];return _0x10821b;};'use strict';var _=require(_0x85af('0x0'));var util=require(_0x85af('0x1'));var logger=require('../../config/logger')(_0x85af('0x2'));var moment=require(_0x85af('0x3'));var BPromise=require(_0x85af('0x4'));var rp=require(_0x85af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85af('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x85af('0x7')]=function(_0x39514a,_0xc8b74d){return _0x39514a[_0x85af('0x8')](_0x85af('0x9'),attributes,{'tableName':_0x85af('0xa'),'paranoid':![],'indexes':[{'name':_0x85af('0xb'),'fields':[_0x85af('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index cacf4ca..400cdac 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 _0xf8ff=['message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x13c98a,_0x5ec21c){var _0x5e9cbf=function(_0x378e8c){while(--_0x378e8c){_0x13c98a['push'](_0x13c98a['shift']());}};_0x5e9cbf(++_0x5ec21c);}(_0xf8ff,0x1bb));var _0xff8f=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xf8ff[_0x13b7fd];return _0x32a74a;};'use strict';var _=require(_0xff8f('0x0'));var util=require('util');var moment=require(_0xff8f('0x1'));var BPromise=require(_0xff8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff8f('0x3'));var db=require(_0xff8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff8f('0x5'))(_0xff8f('0x6'));var config=require(_0xff8f('0x7'));var jayson=require(_0xff8f('0x8'));var client=jayson['client'][_0xff8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x266b8c,_0x285dce,_0x4d95ae){return new BPromise(function(_0x43e8db,_0x31bf68){return client[_0xff8f('0xa')](_0x266b8c,_0x4d95ae)[_0xff8f('0xb')](function(_0x2db775){logger[_0xff8f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x285dce,_0xff8f('0xd'));logger[_0xff8f('0xe')](_0xff8f('0xf'),_0x285dce,_0xff8f('0xd'),JSON[_0xff8f('0x10')](_0x2db775));if(_0x2db775[_0xff8f('0x11')]){if(_0x2db775[_0xff8f('0x11')]['code']===0x1f4){logger[_0xff8f('0x11')](_0xff8f('0x12'),_0x285dce,_0x2db775['error'][_0xff8f('0x13')]);return _0x31bf68(_0x2db775[_0xff8f('0x11')]['message']);}logger[_0xff8f('0x11')](_0xff8f('0x12'),_0x285dce,_0x2db775['error'][_0xff8f('0x13')]);return _0x43e8db(_0x2db775[_0xff8f('0x11')][_0xff8f('0x13')]);}else{logger['info'](_0xff8f('0x12'),_0x285dce,_0xff8f('0xd'));_0x43e8db(_0x2db775['result'][_0xff8f('0x13')]);}})[_0xff8f('0x14')](function(_0xf949b4){logger[_0xff8f('0x11')](_0xff8f('0x12'),_0x285dce,_0xf949b4);_0x31bf68(_0xf949b4);});});} \ No newline at end of file +var _0x3924=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x256fe1,_0x1041a8){var _0xcb9f71=function(_0x551ce5){while(--_0x551ce5){_0x256fe1['push'](_0x256fe1['shift']());}};_0xcb9f71(++_0x1041a8);}(_0x3924,0x1c6));var _0x4392=function(_0x29f252,_0x5ab003){_0x29f252=_0x29f252-0x0;var _0x4cab63=_0x3924[_0x29f252];return _0x4cab63;};'use strict';var _=require(_0x4392('0x0'));var util=require(_0x4392('0x1'));var moment=require(_0x4392('0x2'));var BPromise=require(_0x4392('0x3'));var rs=require(_0x4392('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4392('0x5'))['db'];var utils=require(_0x4392('0x6'));var logger=require(_0x4392('0x7'))(_0x4392('0x8'));var config=require(_0x4392('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4392('0xa')][_0x4392('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4544bc,_0x2414eb,_0x2de9fd){return new BPromise(function(_0x352170,_0x138fdd){return client[_0x4392('0xc')](_0x4544bc,_0x2de9fd)['then'](function(_0x5a795e){logger[_0x4392('0xd')](_0x4392('0xe'),_0x2414eb,_0x4392('0xf'));logger[_0x4392('0x10')](_0x4392('0x11'),_0x2414eb,_0x4392('0xf'),JSON[_0x4392('0x12')](_0x5a795e));if(_0x5a795e['error']){if(_0x5a795e['error']['code']===0x1f4){logger['error'](_0x4392('0xe'),_0x2414eb,_0x5a795e['error'][_0x4392('0x13')]);return _0x138fdd(_0x5a795e[_0x4392('0x14')][_0x4392('0x13')]);}logger[_0x4392('0x14')](_0x4392('0xe'),_0x2414eb,_0x5a795e['error'][_0x4392('0x13')]);return _0x352170(_0x5a795e[_0x4392('0x14')]['message']);}else{logger[_0x4392('0xd')](_0x4392('0xe'),_0x2414eb,_0x4392('0xf'));_0x352170(_0x5a795e[_0x4392('0x15')][_0x4392('0x13')]);}})[_0x4392('0x16')](function(_0x689fb1){logger[_0x4392('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x2414eb,_0x689fb1);_0x138fdd(_0x689fb1);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 759b9e8..10a8adc 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 _0xfbf1=['create','addSound','put','update','delete','destroy','exports','multer','express','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds','getSounds','post'];(function(_0x3f696b,_0x2a9051){var _0x57aa53=function(_0x4b46b3){while(--_0x4b46b3){_0x3f696b['push'](_0x3f696b['shift']());}};_0x57aa53(++_0x2a9051);}(_0xfbf1,0x139));var _0x1fbf=function(_0x32f2c7,_0x4bdbcc){_0x32f2c7=_0x32f2c7-0x0;var _0x17c296=_0xfbf1[_0x32f2c7];return _0x17c296;};'use strict';var multer=require(_0x1fbf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1fbf('0x1'));var router=express['Router']();var fs_extra=require(_0x1fbf('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1fbf('0x3'));var config=require('../../config/environment');var controller=require(_0x1fbf('0x4'));router[_0x1fbf('0x5')]('/',auth[_0x1fbf('0x6')](),controller['index']);router[_0x1fbf('0x5')](_0x1fbf('0x7'),auth[_0x1fbf('0x6')](),controller['show']);router[_0x1fbf('0x5')](_0x1fbf('0x8'),auth[_0x1fbf('0x6')](),controller[_0x1fbf('0x9')]);router[_0x1fbf('0xa')]('/',auth[_0x1fbf('0x6')](),controller[_0x1fbf('0xb')]);router['post'](_0x1fbf('0x8'),auth[_0x1fbf('0x6')](),controller[_0x1fbf('0xc')]);router[_0x1fbf('0xd')](_0x1fbf('0x7'),auth[_0x1fbf('0x6')](),controller[_0x1fbf('0xe')]);router[_0x1fbf('0xf')](_0x1fbf('0x7'),auth['isAuthenticated'](),controller[_0x1fbf('0x10')]);router[_0x1fbf('0xf')]('/:id/sounds/:id2',auth[_0x1fbf('0x6')](),controller['removeSound']);module[_0x1fbf('0x11')]=router; \ No newline at end of file +var _0x002a=['./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy','/:id/sounds/:id2','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e2670,_0x1a1067){var _0x4416dc=function(_0x4e7e5e){while(--_0x4e7e5e){_0x2e2670['push'](_0x2e2670['shift']());}};_0x4416dc(++_0x1a1067);}(_0x002a,0x120));var _0xa002=function(_0x4c10a5,_0x37491a){_0x4c10a5=_0x4c10a5-0x0;var _0x574eff=_0x002a[_0x4c10a5];return _0x574eff;};'use strict';var multer=require('multer');var util=require(_0xa002('0x0'));var path=require(_0xa002('0x1'));var timeout=require(_0xa002('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa002('0x3'));var interaction=require(_0xa002('0x4'));var config=require(_0xa002('0x5'));var controller=require(_0xa002('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa002('0x7')]);router[_0xa002('0x8')](_0xa002('0x9'),auth[_0xa002('0xa')](),controller[_0xa002('0xb')]);router['get'](_0xa002('0xc'),auth[_0xa002('0xa')](),controller[_0xa002('0xd')]);router[_0xa002('0xe')]('/',auth[_0xa002('0xa')](),controller[_0xa002('0xf')]);router['post'](_0xa002('0xc'),auth[_0xa002('0xa')](),controller['addSound']);router[_0xa002('0x10')](_0xa002('0x9'),auth['isAuthenticated'](),controller[_0xa002('0x11')]);router[_0xa002('0x12')](_0xa002('0x9'),auth[_0xa002('0xa')](),controller[_0xa002('0x13')]);router['delete'](_0xa002('0x14'),auth[_0xa002('0xa')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index aeab2fc..4cadcb7 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 _0xaacd=['exports','STRING','name','ENUM','custom','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xaacd,0x108));var _0xdaac=function(_0x26c791,_0x4a1f96){_0x26c791=_0x26c791-0x0;var _0x3dbf38=_0xaacd[_0x26c791];return _0x3dbf38;};'use strict';var Sequelize=require('sequelize');module[_0xdaac('0x0')]={'name':{'type':Sequelize[_0xdaac('0x1')],'allowNull':![],'unique':_0xdaac('0x2')},'mode':{'type':Sequelize[_0xdaac('0x3')](_0xdaac('0x4'),'files','mp3nb','quietmp3nb',_0xdaac('0x5'),_0xdaac('0x6')),'allowNull':!![],'defaultValue':_0xdaac('0x7')},'directory':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdaac('0x8')},'format':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'stamp':{'type':_0xdaac('0x9')},'defaultEntry':{'type':Sequelize[_0xdaac('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2547=['alpha','BOOLEAN','sequelize','exports','STRING','ENUM','custom','quietmp3','mp3'];(function(_0x5e320a,_0x805dfe){var _0x2feaa8=function(_0x6e6ccf){while(--_0x6e6ccf){_0x5e320a['push'](_0x5e320a['shift']());}};_0x2feaa8(++_0x805dfe);}(_0x2547,0xc8));var _0x7254=function(_0x13ecdc,_0x4f6aca){_0x13ecdc=_0x13ecdc-0x0;var _0x34f2d4=_0x2547[_0x13ecdc];return _0x34f2d4;};'use strict';var Sequelize=require(_0x7254('0x0'));module[_0x7254('0x1')]={'name':{'type':Sequelize[_0x7254('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x7254('0x3')](_0x7254('0x4'),'files','mp3nb','quietmp3nb',_0x7254('0x5'),_0x7254('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7254('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7254('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7254('0x2')],'allowNull':!![],'defaultValue':_0x7254('0x7')},'format':{'type':Sequelize[_0x7254('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x7254('0x8')],'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 41e8359..70c4fed 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 _0x1c5f=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','MusicOnHolds','error','name','send','index','VoiceMusicOnHold','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','catch','body','sequelize','transaction','mode','files','directory','join','server/files/moh','create','mkdirSync','0777','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','root','format','%s.%s','save_name','extname','symlinkSync','findOne','removeSound','id2','getSounds','hasOwnProperty','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto'];(function(_0xbd7690,_0x3fa1dd){var _0x2d16cf=function(_0x5956d3){while(--_0x5956d3){_0xbd7690['push'](_0xbd7690['shift']());}};_0x2d16cf(++_0x3fa1dd);}(_0x1c5f,0x143));var _0xf1c5=function(_0x3ee55f,_0x21736c){_0x3ee55f=_0x3ee55f-0x0;var _0x39367c=_0x1c5f[_0x3ee55f];return _0x39367c;};'use strict';var emlformat=require(_0xf1c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1c5('0x1'));var jsonpatch=require(_0xf1c5('0x2'));var rp=require(_0xf1c5('0x3'));var moment=require(_0xf1c5('0x4'));var BPromise=require(_0xf1c5('0x5'));var Mustache=require(_0xf1c5('0x6'));var util=require(_0xf1c5('0x7'));var path=require(_0xf1c5('0x8'));var sox=require('sox');var csv=require(_0xf1c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1c5('0xa'));var squel=require(_0xf1c5('0xb'));var crypto=require(_0xf1c5('0xc'));var jsforce=require(_0xf1c5('0xd'));var deskjs=require(_0xf1c5('0xe'));var toCsv=require(_0xf1c5('0x9'));var querystring=require(_0xf1c5('0xf'));var Papa=require(_0xf1c5('0x10'));var Redis=require('ioredis');var authService=require(_0xf1c5('0x11'));var qs=require(_0xf1c5('0x12'));var as=require(_0xf1c5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf1c5('0x14'));var config=require(_0xf1c5('0x15'));var licenseUtil=require(_0xf1c5('0x16'));var db=require(_0xf1c5('0x17'))['db'];function respondWithStatusCode(_0x9d8b12,_0x32201e){_0x32201e=_0x32201e||0xcc;return function(_0x5317dd){if(_0x5317dd){return _0x9d8b12[_0xf1c5('0x18')](_0x32201e);}return _0x9d8b12['status'](_0x32201e)[_0xf1c5('0x19')]();};}function respondWithResult(_0x305965,_0x2a249e){_0x2a249e=_0x2a249e||0xc8;return function(_0x4c1d26){if(_0x4c1d26){return _0x305965[_0xf1c5('0x1a')](_0x2a249e)[_0xf1c5('0x1b')](_0x4c1d26);}};}function respondWithFilteredResult(_0x1d4fc5,_0x40edf0){return function(_0x1432af){if(_0x1432af){var _0x15e6bb=typeof _0x40edf0[_0xf1c5('0x1c')]===_0xf1c5('0x1d')&&typeof _0x40edf0[_0xf1c5('0x1e')]===_0xf1c5('0x1d');var _0x75c476=_0x1432af[_0xf1c5('0x1f')];var _0x217367=_0x15e6bb?0x0:_0x40edf0['offset'];var _0x57590a=_0x15e6bb?_0x1432af['count']:_0x40edf0[_0xf1c5('0x1c')]+_0x40edf0[_0xf1c5('0x1e')];var _0xb8c057;if(_0x57590a>=_0x75c476){_0x57590a=_0x75c476;_0xb8c057=0xc8;}else{_0xb8c057=0xce;}_0x1d4fc5['status'](_0xb8c057);return _0x1d4fc5[_0xf1c5('0x20')]('Content-Range',_0x217367+'-'+_0x57590a+'/'+_0x75c476)['json'](_0x1432af);}return null;};}function patchUpdates(_0x5b33fc){return function(_0x1c39b1){try{jsonpatch[_0xf1c5('0x21')](_0x1c39b1,_0x5b33fc,!![]);}catch(_0x562e99){return BPromise[_0xf1c5('0x22')](_0x562e99);}return _0x1c39b1['save']();};}function saveUpdates(_0x526794,_0x1fbfa6){return function(_0x2df0d5){if(_0x2df0d5){return _0x2df0d5[_0xf1c5('0x23')](_0x526794)[_0xf1c5('0x24')](function(_0x406438){return _0x406438;});}return null;};}function removeEntity(_0x2ceee4,_0x4eb36e){return function(_0x3d4d99){if(_0x3d4d99){return _0x3d4d99[_0xf1c5('0x25')]()[_0xf1c5('0x24')](function(){var _0x1d95b5=_0x3d4d99[_0xf1c5('0x26')]({'plain':!![]});var _0x1c27c2=_0xf1c5('0x27');return db['UserProfileResource'][_0xf1c5('0x25')]({'where':{'type':_0x1c27c2,'resourceId':_0x1d95b5['id']}})[_0xf1c5('0x24')](function(){return _0x3d4d99;});})[_0xf1c5('0x24')](function(){_0x2ceee4[_0xf1c5('0x1a')](0xcc)[_0xf1c5('0x19')]();});}};}function handleEntityNotFound(_0x3a704d,_0x1acff6){return function(_0x334e6a){if(!_0x334e6a){_0x3a704d[_0xf1c5('0x18')](0x194);}return _0x334e6a;};}function handleError(_0x46702f,_0x3bae0b){_0x3bae0b=_0x3bae0b||0x1f4;return function(_0x3a3b97){logger[_0xf1c5('0x28')](_0x3a3b97['stack']);if(_0x3a3b97['name']){delete _0x3a3b97[_0xf1c5('0x29')];}_0x46702f[_0xf1c5('0x1a')](_0x3bae0b)[_0xf1c5('0x2a')](_0x3a3b97);};}exports[_0xf1c5('0x2b')]=function(_0xe1af38,_0x4b6e93){var _0x51ef4a={},_0x589ab8={},_0x428712={'count':0x0,'rows':[]};var _0x3295cd=_['map'](db[_0xf1c5('0x2c')]['rawAttributes'],function(_0x4abc95){return{'name':_0x4abc95[_0xf1c5('0x2d')],'type':_0x4abc95[_0xf1c5('0x2e')][_0xf1c5('0x2f')]};});_0x589ab8[_0xf1c5('0x30')]=_['map'](_0x3295cd,_0xf1c5('0x29'));_0x589ab8[_0xf1c5('0x31')]=_['keys'](_0xe1af38['query']);_0x589ab8['filters']=_[_0xf1c5('0x32')](_0x589ab8['model'],_0x589ab8[_0xf1c5('0x31')]);_0x51ef4a[_0xf1c5('0x33')]=_[_0xf1c5('0x32')](_0x589ab8[_0xf1c5('0x30')],qs[_0xf1c5('0x34')](_0xe1af38[_0xf1c5('0x31')]['fields']));_0x51ef4a[_0xf1c5('0x33')]=_0x51ef4a['attributes'][_0xf1c5('0x35')]?_0x51ef4a[_0xf1c5('0x33')]:_0x589ab8[_0xf1c5('0x30')];if(!_0xe1af38[_0xf1c5('0x31')]['hasOwnProperty']('nolimit')){_0x51ef4a['limit']=qs[_0xf1c5('0x1e')](_0xe1af38[_0xf1c5('0x31')]['limit']);_0x51ef4a['offset']=qs['offset'](_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x1c')]);}_0x51ef4a[_0xf1c5('0x36')]=qs[_0xf1c5('0x37')](_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x37')]);delete _0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x37')];_0x51ef4a[_0xf1c5('0x38')]=qs[_0xf1c5('0x39')](_[_0xf1c5('0x3a')](_0xe1af38[_0xf1c5('0x31')],_0x589ab8['filters']),_0x3295cd);if(_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x3b')]){_0x51ef4a[_0xf1c5('0x38')]=_['merge'](_0x51ef4a[_0xf1c5('0x38')],{'$or':_[_0xf1c5('0x3c')](_0x3295cd,function(_0x146291){if(_0x146291['type']!==_0xf1c5('0x3d')){var _0x251416={};_0x251416[_0x146291[_0xf1c5('0x29')]]={'$like':'%'+_0xe1af38['query'][_0xf1c5('0x3b')]+'%'};return _0x251416;}})});}_0x51ef4a=_[_0xf1c5('0x3e')]({},_0x51ef4a,_0xe1af38[_0xf1c5('0x3f')]);var _0x5d9c6c={'where':_0x51ef4a['where']};return db[_0xf1c5('0x2c')][_0xf1c5('0x1f')](_0x5d9c6c)['then'](function(_0x42b9dc){_0x428712['count']=_0x42b9dc;if(_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x40')]){_0x51ef4a['include']=[{'all':!![]}];}return db[_0xf1c5('0x2c')][_0xf1c5('0x41')](_0x51ef4a);})[_0xf1c5('0x24')](function(_0x20d454){_0x428712[_0xf1c5('0x42')]=_0x20d454;return _0x428712;})[_0xf1c5('0x24')](respondWithFilteredResult(_0x4b6e93,_0x51ef4a))['catch'](handleError(_0x4b6e93,null));};exports[_0xf1c5('0x43')]=function(_0x295d71,_0x38da48){var _0x42b126={'raw':![],'where':{'id':_0x295d71[_0xf1c5('0x44')]['id']}},_0x365efb={};_0x365efb[_0xf1c5('0x30')]=_[_0xf1c5('0x45')](db[_0xf1c5('0x2c')][_0xf1c5('0x46')]);_0x365efb['query']=_[_0xf1c5('0x45')](_0x295d71[_0xf1c5('0x31')]);_0x365efb[_0xf1c5('0x39')]=_['intersection'](_0x365efb[_0xf1c5('0x30')],_0x365efb[_0xf1c5('0x31')]);_0x42b126[_0xf1c5('0x33')]=_['intersection'](_0x365efb[_0xf1c5('0x30')],qs[_0xf1c5('0x34')](_0x295d71[_0xf1c5('0x31')][_0xf1c5('0x34')]));_0x42b126[_0xf1c5('0x33')]=_0x42b126['attributes']['length']?_0x42b126['attributes']:_0x365efb[_0xf1c5('0x30')];if(_0x295d71['query']['includeAll']){_0x42b126['include']=[{'all':!![]}];}_0x42b126=_[_0xf1c5('0x3e')]({},_0x42b126,_0x295d71['options']);return db[_0xf1c5('0x2c')]['find'](_0x42b126)[_0xf1c5('0x24')](handleEntityNotFound(_0x38da48,null))[_0xf1c5('0x24')](respondWithResult(_0x38da48,null))[_0xf1c5('0x47')](handleError(_0x38da48,null));};exports[_0xf1c5('0x23')]=function(_0x59779f,_0x2f3a1f){if(_0x59779f[_0xf1c5('0x48')]['id']){delete _0x59779f[_0xf1c5('0x48')]['id'];}return db[_0xf1c5('0x2c')]['find']({'where':{'id':_0x59779f[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](handleEntityNotFound(_0x2f3a1f,null))['then'](saveUpdates(_0x59779f['body'],null))['then'](respondWithResult(_0x2f3a1f,null))['catch'](handleError(_0x2f3a1f,null));};exports['create']=function(_0x172ae7,_0x1f1e75,_0xa249d0){return db[_0xf1c5('0x49')][_0xf1c5('0x4a')](function(_0x47e3a6){if(_0x172ae7['body'][_0xf1c5('0x4b')]===_0xf1c5('0x4c')){_0x172ae7[_0xf1c5('0x48')][_0xf1c5('0x4d')]=path[_0xf1c5('0x4e')](config['root'],_0xf1c5('0x4f'),_0x172ae7[_0xf1c5('0x48')][_0xf1c5('0x29')]);}return db[_0xf1c5('0x2c')][_0xf1c5('0x50')](_0x172ae7[_0xf1c5('0x48')],{'transaction':_0x47e3a6})[_0xf1c5('0x24')](function(_0x1362d8){if(_0x172ae7[_0xf1c5('0x48')][_0xf1c5('0x4b')]===_0xf1c5('0x4c')){fs[_0xf1c5('0x51')](_0x1362d8[_0xf1c5('0x4d')],parseInt(_0xf1c5('0x52'),0x8));}var _0x559f01=_0x172ae7[_0xf1c5('0x53')][_0xf1c5('0x26')]({'plain':!![]});if(!_0x559f01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x559f01[_0xf1c5('0x54')]===_0xf1c5('0x53')){var _0x3e2390=_0x1362d8[_0xf1c5('0x26')]({'plain':!![]});return db[_0xf1c5('0x55')][_0xf1c5('0x56')]({'where':{'name':_0xf1c5('0x27'),'userProfileId':_0x559f01[_0xf1c5('0x57')]},'raw':!![]})[_0xf1c5('0x24')](function(_0x43895c){if(_0x43895c&&_0x43895c[_0xf1c5('0x58')]===0x0){return db[_0xf1c5('0x59')]['create']({'name':_0x3e2390[_0xf1c5('0x29')],'resourceId':_0x3e2390['id'],'type':_0x43895c[_0xf1c5('0x29')],'sectionId':_0x43895c['id']},{})[_0xf1c5('0x24')](function(){return _0x1362d8;});}else{return _0x1362d8;}})[_0xf1c5('0x47')](function(_0x1ceb0e){logger[_0xf1c5('0x28')](_0xf1c5('0x5a'),_0x1ceb0e);});}return _0x1362d8;});})['then'](respondWithResult(_0x1f1e75,0xc9))[_0xf1c5('0x47')](handleError(_0x1f1e75,null));};exports['destroy']=function(_0x386580,_0x2df58c,_0x1090ca){var _0x36d6a5;return db[_0xf1c5('0x2c')][_0xf1c5('0x56')]({'where':{'id':_0x386580[_0xf1c5('0x44')]['id']}})['then'](function(_0x18a9b3){if(_0x18a9b3){return db[_0xf1c5('0x49')][_0xf1c5('0x4a')](function(_0x1bd28c){return _0x18a9b3[_0xf1c5('0x25')]({'transaction':_0x1bd28c,'raw':!![]})[_0xf1c5('0x24')](function(_0x25b891){if(_0x25b891['directory']){fs[_0xf1c5('0x5b')](_0x25b891[_0xf1c5('0x4d')])[_0xf1c5('0x5c')](function(_0x3d36d6){fs[_0xf1c5('0x5d')](path[_0xf1c5('0x4e')](_0x25b891[_0xf1c5('0x4d')],_0x3d36d6));});fs['rmdirSync'](_0x25b891[_0xf1c5('0x4d')]);}return _0x25b891;});})['catch'](function(_0x5b85d8){throw new db[(_0xf1c5('0x5e'))][(_0xf1c5('0x5f'))](_0x5b85d8[_0xf1c5('0x60')]);});}})[_0xf1c5('0x24')](handleEntityNotFound(_0x2df58c,null))[_0xf1c5('0x24')](removeEntity(_0x2df58c,null))[_0xf1c5('0x47')](handleError(_0x2df58c,null));};exports['addSound']=function(_0xb2e898,_0x3a31b9,_0x4ae14b){return db[_0xf1c5('0x49')]['transaction'](function(_0x3afcfa){var _0x2e2114;return db[_0xf1c5('0x2c')][_0xf1c5('0x56')]({'where':{'id':_0xb2e898[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](function(_0x2eff3d){if(_0x2eff3d){_0x2e2114=_0x2eff3d;return _0x2eff3d[_0xf1c5('0x61')](_0xb2e898[_0xf1c5('0x48')]['id'],{'transaction':_0x3afcfa});}})[_0xf1c5('0x24')](function(_0x3550c9){if(_0x3550c9){return db[_0xf1c5('0x62')]['findOne']({'where':{'id':_0xb2e898[_0xf1c5('0x48')]['id']},'attributes':['id',_0xf1c5('0x29'),'save_name',_0xf1c5('0x63'),'createdAt'],'raw':!![]});}})[_0xf1c5('0x24')](function(_0x5ed44e){if(_0x5ed44e){var _0x2aed40=path[_0xf1c5('0x4e')](config[_0xf1c5('0x64')],'server/files/sounds/converted',util[_0xf1c5('0x65')](_0xf1c5('0x66'),path['basename'](_0x5ed44e[_0xf1c5('0x67')],path[_0xf1c5('0x68')](_0x5ed44e['save_name'])),_0x5ed44e['converted_format']));var _0x4d9918=path[_0xf1c5('0x4e')](config[_0xf1c5('0x64')],_0xf1c5('0x4f'),_0x2e2114[_0xf1c5('0x29')],util[_0xf1c5('0x65')]('%s.%s',_0x5ed44e['name'],_0x5ed44e[_0xf1c5('0x63')]));fs[_0xf1c5('0x69')](_0x2aed40,_0x4d9918);return _0x5ed44e;}})[_0xf1c5('0x47')](function(_0x1a4bd6){throw new db[(_0xf1c5('0x5e'))][(_0xf1c5('0x5f'))](_0x1a4bd6['message']);});})[_0xf1c5('0x24')](handleEntityNotFound(_0x3a31b9,null))['then'](respondWithResult(_0x3a31b9,0xc9))['catch'](handleError(_0x3a31b9,null));};exports['removeSound']=function(_0x26a7e5,_0x5a0aa6,_0x39aa3c){return db['sequelize'][_0xf1c5('0x4a')](function(_0x49813d){var _0x5cd203;return db[_0xf1c5('0x2c')][_0xf1c5('0x6a')]({'where':{'id':_0x26a7e5[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](handleEntityNotFound(_0x5a0aa6,null))[_0xf1c5('0x24')](function(_0xef93b5){if(_0xef93b5){_0x5cd203=_0xef93b5;return _0xef93b5[_0xf1c5('0x6b')](_0x26a7e5[_0xf1c5('0x44')][_0xf1c5('0x6c')]);}})[_0xf1c5('0x24')](function(_0x4a1ea2){if(_0x4a1ea2){return db[_0xf1c5('0x62')]['findOne']({'where':{'id':_0x26a7e5['params']['id2']},'attributes':['id','name',_0xf1c5('0x67'),_0xf1c5('0x63'),'createdAt'],'raw':!![]});}})[_0xf1c5('0x24')](function(_0x5bffb2){if(_0x5bffb2){fs[_0xf1c5('0x5d')](path['join'](_0x5cd203[_0xf1c5('0x4d')],util[_0xf1c5('0x65')](_0xf1c5('0x66'),_0x5bffb2['name'],_0x5bffb2[_0xf1c5('0x63')])));return _0x5bffb2;}})[_0xf1c5('0x47')](function(_0x431317){throw new db['Sequelize']['ValidationError'](_0x431317[_0xf1c5('0x60')]);});})[_0xf1c5('0x24')](handleEntityNotFound(_0x5a0aa6,null))[_0xf1c5('0x24')](respondWithStatusCode(_0x5a0aa6,0xcc))[_0xf1c5('0x47')](handleError(_0x5a0aa6,null));};exports[_0xf1c5('0x6d')]=function(_0x462d88,_0x3cc00f,_0x393ce2){var _0x561799={};var _0x176739={};var _0x167854;var _0x15bada;return db[_0xf1c5('0x2c')][_0xf1c5('0x6a')]({'where':{'id':_0x462d88[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](handleEntityNotFound(_0x3cc00f,null))[_0xf1c5('0x24')](function(_0xff24fb){if(_0xff24fb){_0x167854=_0xff24fb;_0x176739[_0xf1c5('0x30')]=_[_0xf1c5('0x45')](db[_0xf1c5('0x62')][_0xf1c5('0x46')]);_0x176739[_0xf1c5('0x31')]=_[_0xf1c5('0x45')](_0x462d88[_0xf1c5('0x31')]);_0x176739[_0xf1c5('0x39')]=_[_0xf1c5('0x32')](_0x176739['model'],_0x176739[_0xf1c5('0x31')]);_0x561799[_0xf1c5('0x33')]=_[_0xf1c5('0x32')](_0x176739['model'],qs['fields'](_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x34')]));_0x561799[_0xf1c5('0x33')]=_0x561799[_0xf1c5('0x33')]['length']?_0x561799[_0xf1c5('0x33')]:_0x176739[_0xf1c5('0x30')];_0x561799[_0xf1c5('0x36')]=qs[_0xf1c5('0x37')](_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x37')]);_0x561799[_0xf1c5('0x38')]=qs[_0xf1c5('0x39')](_[_0xf1c5('0x3a')](_0x462d88[_0xf1c5('0x31')],_0x176739[_0xf1c5('0x39')]));if(_0x462d88[_0xf1c5('0x31')]['filter']){_0x561799[_0xf1c5('0x38')]=_[_0xf1c5('0x3e')](_0x561799[_0xf1c5('0x38')],{'$or':_[_0xf1c5('0x3c')](_0x561799[_0xf1c5('0x33')],function(_0x691596){var _0x26af9a={};_0x26af9a[_0x691596]={'$like':'%'+_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x3b')]+'%'};return _0x26af9a;})});}_0x561799=_[_0xf1c5('0x3e')]({},_0x561799,_0x462d88[_0xf1c5('0x3f')]);return _0x167854[_0xf1c5('0x6d')](_0x561799);}})['then'](function(_0x502ece){if(_0x502ece){_0x15bada=_0x502ece[_0xf1c5('0x35')];if(!_0x462d88['query'][_0xf1c5('0x6e')](_0xf1c5('0x6f'))){_0x561799[_0xf1c5('0x1e')]=qs[_0xf1c5('0x1e')](_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x1e')]);_0x561799['offset']=qs['offset'](_0x462d88['query'][_0xf1c5('0x1c')]);}return _0x167854[_0xf1c5('0x6d')](_0x561799);}})[_0xf1c5('0x24')](function(_0x115b28){if(_0x115b28){return _0x115b28?{'count':_0x15bada,'rows':_0x115b28}:null;}})['then'](respondWithResult(_0x3cc00f,null))[_0xf1c5('0x47')](handleError(_0x3cc00f,null));}; \ No newline at end of file +var _0x7a10=['count','limit','set','Content-Range','json','apply','reject','update','then','get','MusicOnHolds','destroy','end','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','include','findAll','rows','catch','show','params','includeAll','find','body','sequelize','transaction','mode','directory','join','root','create','files','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','getSounds','rimraf','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined'];(function(_0x342a64,_0x3e5526){var _0x268373=function(_0x31433a){while(--_0x31433a){_0x342a64['push'](_0x342a64['shift']());}};_0x268373(++_0x3e5526);}(_0x7a10,0x132));var _0x07a1=function(_0x32a2ed,_0xa032f0){_0x32a2ed=_0x32a2ed-0x0;var _0x29228f=_0x7a10[_0x32a2ed];return _0x29228f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x07a1('0x1'));var moment=require(_0x07a1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x07a1('0x3'));var util=require(_0x07a1('0x4'));var path=require(_0x07a1('0x5'));var sox=require(_0x07a1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07a1('0x7'));var _=require(_0x07a1('0x8'));var squel=require(_0x07a1('0x9'));var crypto=require(_0x07a1('0xa'));var jsforce=require(_0x07a1('0xb'));var deskjs=require(_0x07a1('0xc'));var toCsv=require(_0x07a1('0xd'));var querystring=require(_0x07a1('0xe'));var Papa=require(_0x07a1('0xf'));var Redis=require(_0x07a1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x07a1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07a1('0x12'));var logger=require(_0x07a1('0x13'))(_0x07a1('0x14'));var utils=require(_0x07a1('0x15'));var config=require(_0x07a1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f9926,_0x38626e){_0x38626e=_0x38626e||0xcc;return function(_0x37d127){if(_0x37d127){return _0x4f9926[_0x07a1('0x17')](_0x38626e);}return _0x4f9926['status'](_0x38626e)['end']();};}function respondWithResult(_0x2296c8,_0x4e3dd6){_0x4e3dd6=_0x4e3dd6||0xc8;return function(_0x3deef0){if(_0x3deef0){return _0x2296c8[_0x07a1('0x18')](_0x4e3dd6)['json'](_0x3deef0);}};}function respondWithFilteredResult(_0x40a7e4,_0x12c846){return function(_0x182467){if(_0x182467){var _0x3fac7c=typeof _0x12c846[_0x07a1('0x19')]===_0x07a1('0x1a')&&typeof _0x12c846['limit']===_0x07a1('0x1a');var _0x3f6133=_0x182467[_0x07a1('0x1b')];var _0x11e786=_0x3fac7c?0x0:_0x12c846[_0x07a1('0x19')];var _0x4005e4=_0x3fac7c?_0x182467[_0x07a1('0x1b')]:_0x12c846[_0x07a1('0x19')]+_0x12c846[_0x07a1('0x1c')];var _0x31e04d;if(_0x4005e4>=_0x3f6133){_0x4005e4=_0x3f6133;_0x31e04d=0xc8;}else{_0x31e04d=0xce;}_0x40a7e4[_0x07a1('0x18')](_0x31e04d);return _0x40a7e4[_0x07a1('0x1d')](_0x07a1('0x1e'),_0x11e786+'-'+_0x4005e4+'/'+_0x3f6133)[_0x07a1('0x1f')](_0x182467);}return null;};}function patchUpdates(_0x350b72){return function(_0x573bd8){try{jsonpatch[_0x07a1('0x20')](_0x573bd8,_0x350b72,!![]);}catch(_0x5b05a4){return BPromise[_0x07a1('0x21')](_0x5b05a4);}return _0x573bd8['save']();};}function saveUpdates(_0x2f5d3d,_0x289556){return function(_0x343df9){if(_0x343df9){return _0x343df9[_0x07a1('0x22')](_0x2f5d3d)[_0x07a1('0x23')](function(_0x3015a9){return _0x3015a9;});}return null;};}function removeEntity(_0x18ece2,_0xd726da){return function(_0x3dac7f){if(_0x3dac7f){return _0x3dac7f['destroy']()[_0x07a1('0x23')](function(){var _0x51ffcc=_0x3dac7f[_0x07a1('0x24')]({'plain':!![]});var _0x588f08=_0x07a1('0x25');return db['UserProfileResource'][_0x07a1('0x26')]({'where':{'type':_0x588f08,'resourceId':_0x51ffcc['id']}})[_0x07a1('0x23')](function(){return _0x3dac7f;});})[_0x07a1('0x23')](function(){_0x18ece2[_0x07a1('0x18')](0xcc)[_0x07a1('0x27')]();});}};}function handleEntityNotFound(_0x57e00d,_0x4f80af){return function(_0x4a4e65){if(!_0x4a4e65){_0x57e00d['sendStatus'](0x194);}return _0x4a4e65;};}function handleError(_0x40e94d,_0x58605d){_0x58605d=_0x58605d||0x1f4;return function(_0x14aa3c){logger[_0x07a1('0x28')](_0x14aa3c['stack']);if(_0x14aa3c['name']){delete _0x14aa3c[_0x07a1('0x29')];}_0x40e94d[_0x07a1('0x18')](_0x58605d)[_0x07a1('0x2a')](_0x14aa3c);};}exports[_0x07a1('0x2b')]=function(_0x44a205,_0x236175){var _0x4699ef={},_0x5424e6={},_0x44bc90={'count':0x0,'rows':[]};var _0x5eea40=_[_0x07a1('0x2c')](db[_0x07a1('0x2d')][_0x07a1('0x2e')],function(_0x5012f6){return{'name':_0x5012f6[_0x07a1('0x2f')],'type':_0x5012f6[_0x07a1('0x30')]['key']};});_0x5424e6[_0x07a1('0x31')]=_['map'](_0x5eea40,'name');_0x5424e6[_0x07a1('0x32')]=_[_0x07a1('0x33')](_0x44a205[_0x07a1('0x32')]);_0x5424e6[_0x07a1('0x34')]=_[_0x07a1('0x35')](_0x5424e6[_0x07a1('0x31')],_0x5424e6[_0x07a1('0x32')]);_0x4699ef['attributes']=_[_0x07a1('0x35')](_0x5424e6['model'],qs[_0x07a1('0x36')](_0x44a205[_0x07a1('0x32')][_0x07a1('0x36')]));_0x4699ef[_0x07a1('0x37')]=_0x4699ef['attributes'][_0x07a1('0x38')]?_0x4699ef['attributes']:_0x5424e6[_0x07a1('0x31')];if(!_0x44a205[_0x07a1('0x32')][_0x07a1('0x39')](_0x07a1('0x3a'))){_0x4699ef[_0x07a1('0x1c')]=qs['limit'](_0x44a205[_0x07a1('0x32')][_0x07a1('0x1c')]);_0x4699ef[_0x07a1('0x19')]=qs[_0x07a1('0x19')](_0x44a205[_0x07a1('0x32')][_0x07a1('0x19')]);}_0x4699ef[_0x07a1('0x3b')]=qs['sort'](_0x44a205[_0x07a1('0x32')][_0x07a1('0x3c')]);delete _0x44a205[_0x07a1('0x32')][_0x07a1('0x3c')];_0x4699ef['where']=qs[_0x07a1('0x34')](_[_0x07a1('0x3d')](_0x44a205[_0x07a1('0x32')],_0x5424e6[_0x07a1('0x34')]),_0x5eea40);if(_0x44a205[_0x07a1('0x32')][_0x07a1('0x3e')]){_0x4699ef['where']=_[_0x07a1('0x3f')](_0x4699ef[_0x07a1('0x40')],{'$or':_['map'](_0x5eea40,function(_0xcfbe9f){if(_0xcfbe9f[_0x07a1('0x30')]!=='VIRTUAL'){var _0xc704dc={};_0xc704dc[_0xcfbe9f[_0x07a1('0x29')]]={'$like':'%'+_0x44a205[_0x07a1('0x32')][_0x07a1('0x3e')]+'%'};return _0xc704dc;}})});}_0x4699ef=_[_0x07a1('0x3f')]({},_0x4699ef,_0x44a205[_0x07a1('0x41')]);var _0x35c929={'where':_0x4699ef[_0x07a1('0x40')]};return db['VoiceMusicOnHold'][_0x07a1('0x1b')](_0x35c929)['then'](function(_0x18933f){_0x44bc90[_0x07a1('0x1b')]=_0x18933f;if(_0x44a205['query']['includeAll']){_0x4699ef[_0x07a1('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x07a1('0x43')](_0x4699ef);})[_0x07a1('0x23')](function(_0xa2cd81){_0x44bc90[_0x07a1('0x44')]=_0xa2cd81;return _0x44bc90;})['then'](respondWithFilteredResult(_0x236175,_0x4699ef))[_0x07a1('0x45')](handleError(_0x236175,null));};exports[_0x07a1('0x46')]=function(_0x423caa,_0x3532ce){var _0x3ed949={'raw':![],'where':{'id':_0x423caa[_0x07a1('0x47')]['id']}},_0xc1febd={};_0xc1febd['model']=_[_0x07a1('0x33')](db[_0x07a1('0x2d')]['rawAttributes']);_0xc1febd[_0x07a1('0x32')]=_['keys'](_0x423caa['query']);_0xc1febd[_0x07a1('0x34')]=_[_0x07a1('0x35')](_0xc1febd[_0x07a1('0x31')],_0xc1febd['query']);_0x3ed949[_0x07a1('0x37')]=_['intersection'](_0xc1febd[_0x07a1('0x31')],qs['fields'](_0x423caa[_0x07a1('0x32')][_0x07a1('0x36')]));_0x3ed949[_0x07a1('0x37')]=_0x3ed949[_0x07a1('0x37')][_0x07a1('0x38')]?_0x3ed949[_0x07a1('0x37')]:_0xc1febd['model'];if(_0x423caa[_0x07a1('0x32')][_0x07a1('0x48')]){_0x3ed949[_0x07a1('0x42')]=[{'all':!![]}];}_0x3ed949=_[_0x07a1('0x3f')]({},_0x3ed949,_0x423caa[_0x07a1('0x41')]);return db[_0x07a1('0x2d')][_0x07a1('0x49')](_0x3ed949)[_0x07a1('0x23')](handleEntityNotFound(_0x3532ce,null))[_0x07a1('0x23')](respondWithResult(_0x3532ce,null))[_0x07a1('0x45')](handleError(_0x3532ce,null));};exports[_0x07a1('0x22')]=function(_0x231334,_0x357634){if(_0x231334['body']['id']){delete _0x231334[_0x07a1('0x4a')]['id'];}return db[_0x07a1('0x2d')][_0x07a1('0x49')]({'where':{'id':_0x231334[_0x07a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x357634,null))['then'](saveUpdates(_0x231334[_0x07a1('0x4a')],null))[_0x07a1('0x23')](respondWithResult(_0x357634,null))[_0x07a1('0x45')](handleError(_0x357634,null));};exports['create']=function(_0x3a78b6,_0xd4be5c,_0x4599ed){return db[_0x07a1('0x4b')][_0x07a1('0x4c')](function(_0x543227){if(_0x3a78b6[_0x07a1('0x4a')][_0x07a1('0x4d')]==='files'){_0x3a78b6[_0x07a1('0x4a')][_0x07a1('0x4e')]=path[_0x07a1('0x4f')](config[_0x07a1('0x50')],'server/files/moh',_0x3a78b6[_0x07a1('0x4a')]['name']);}return db[_0x07a1('0x2d')][_0x07a1('0x51')](_0x3a78b6[_0x07a1('0x4a')],{'transaction':_0x543227})[_0x07a1('0x23')](function(_0x42dc40){if(_0x3a78b6[_0x07a1('0x4a')][_0x07a1('0x4d')]===_0x07a1('0x52')){fs[_0x07a1('0x53')](_0x42dc40[_0x07a1('0x4e')],parseInt('0777',0x8));}var _0x4783b1=_0x3a78b6['user'][_0x07a1('0x24')]({'plain':!![]});if(!_0x4783b1)throw new Error(_0x07a1('0x54'));if(_0x4783b1['role']===_0x07a1('0x55')){var _0x2788af=_0x42dc40[_0x07a1('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x07a1('0x49')]({'where':{'name':_0x07a1('0x25'),'userProfileId':_0x4783b1[_0x07a1('0x56')]},'raw':!![]})[_0x07a1('0x23')](function(_0xf519e){if(_0xf519e&&_0xf519e[_0x07a1('0x57')]===0x0){return db[_0x07a1('0x58')][_0x07a1('0x51')]({'name':_0x2788af[_0x07a1('0x29')],'resourceId':_0x2788af['id'],'type':_0xf519e['name'],'sectionId':_0xf519e['id']},{})['then'](function(){return _0x42dc40;});}else{return _0x42dc40;}})[_0x07a1('0x45')](function(_0x13cdfe){logger[_0x07a1('0x28')](_0x07a1('0x59'),_0x13cdfe);});}return _0x42dc40;});})[_0x07a1('0x23')](respondWithResult(_0xd4be5c,0xc9))['catch'](handleError(_0xd4be5c,null));};exports[_0x07a1('0x26')]=function(_0x5ab8e5,_0x26fb03,_0x2c9aec){var _0x41da24;return db['VoiceMusicOnHold'][_0x07a1('0x49')]({'where':{'id':_0x5ab8e5['params']['id']}})[_0x07a1('0x23')](function(_0x2055e2){if(_0x2055e2){return db[_0x07a1('0x4b')][_0x07a1('0x4c')](function(_0x228104){return _0x2055e2[_0x07a1('0x26')]({'transaction':_0x228104,'raw':!![]})['then'](function(_0x458dbb){if(_0x458dbb[_0x07a1('0x4e')]){fs[_0x07a1('0x5a')](_0x458dbb[_0x07a1('0x4e')])[_0x07a1('0x5b')](function(_0x18d3b3){fs[_0x07a1('0x5c')](path[_0x07a1('0x4f')](_0x458dbb[_0x07a1('0x4e')],_0x18d3b3));});fs[_0x07a1('0x5d')](_0x458dbb[_0x07a1('0x4e')]);}return _0x458dbb;});})[_0x07a1('0x45')](function(_0x2ce035){throw new db[(_0x07a1('0x5e'))][(_0x07a1('0x5f'))](_0x2ce035[_0x07a1('0x60')]);});}})['then'](handleEntityNotFound(_0x26fb03,null))[_0x07a1('0x23')](removeEntity(_0x26fb03,null))[_0x07a1('0x45')](handleError(_0x26fb03,null));};exports[_0x07a1('0x61')]=function(_0x438331,_0x566328,_0x1bd860){return db[_0x07a1('0x4b')]['transaction'](function(_0x2c0ab3){var _0x3b41e2;return db[_0x07a1('0x2d')][_0x07a1('0x49')]({'where':{'id':_0x438331[_0x07a1('0x47')]['id']}})['then'](function(_0x566585){if(_0x566585){_0x3b41e2=_0x566585;return _0x566585[_0x07a1('0x61')](_0x438331[_0x07a1('0x4a')]['id'],{'transaction':_0x2c0ab3});}})[_0x07a1('0x23')](function(_0x244188){if(_0x244188){return db[_0x07a1('0x62')][_0x07a1('0x63')]({'where':{'id':_0x438331[_0x07a1('0x4a')]['id']},'attributes':['id','name',_0x07a1('0x64'),_0x07a1('0x65'),_0x07a1('0x66')],'raw':!![]});}})[_0x07a1('0x23')](function(_0xca0d0e){if(_0xca0d0e){var _0x4c7bf8=path[_0x07a1('0x4f')](config[_0x07a1('0x50')],_0x07a1('0x67'),util[_0x07a1('0x68')](_0x07a1('0x69'),path[_0x07a1('0x6a')](_0xca0d0e[_0x07a1('0x64')],path['extname'](_0xca0d0e[_0x07a1('0x64')])),_0xca0d0e[_0x07a1('0x65')]));var _0x1c442d=path[_0x07a1('0x4f')](config[_0x07a1('0x50')],'server/files/moh',_0x3b41e2['name'],util[_0x07a1('0x68')](_0x07a1('0x69'),_0xca0d0e[_0x07a1('0x29')],_0xca0d0e[_0x07a1('0x65')]));fs[_0x07a1('0x6b')](_0x4c7bf8,_0x1c442d);return _0xca0d0e;}})[_0x07a1('0x45')](function(_0x3149fd){throw new db[(_0x07a1('0x5e'))][(_0x07a1('0x5f'))](_0x3149fd['message']);});})['then'](handleEntityNotFound(_0x566328,null))[_0x07a1('0x23')](respondWithResult(_0x566328,0xc9))[_0x07a1('0x45')](handleError(_0x566328,null));};exports[_0x07a1('0x6c')]=function(_0x4a80b9,_0x4359b7,_0x29d446){return db[_0x07a1('0x4b')][_0x07a1('0x4c')](function(_0x347df8){var _0x197a1e;return db[_0x07a1('0x2d')][_0x07a1('0x63')]({'where':{'id':_0x4a80b9[_0x07a1('0x47')]['id']}})[_0x07a1('0x23')](handleEntityNotFound(_0x4359b7,null))['then'](function(_0x2b7093){if(_0x2b7093){_0x197a1e=_0x2b7093;return _0x2b7093[_0x07a1('0x6c')](_0x4a80b9[_0x07a1('0x47')][_0x07a1('0x6d')]);}})[_0x07a1('0x23')](function(_0x25e938){if(_0x25e938){return db['Sound']['findOne']({'where':{'id':_0x4a80b9[_0x07a1('0x47')]['id2']},'attributes':['id',_0x07a1('0x29'),'save_name',_0x07a1('0x65'),_0x07a1('0x66')],'raw':!![]});}})['then'](function(_0x51163e){if(_0x51163e){fs['unlinkSync'](path[_0x07a1('0x4f')](_0x197a1e[_0x07a1('0x4e')],util[_0x07a1('0x68')](_0x07a1('0x69'),_0x51163e[_0x07a1('0x29')],_0x51163e['converted_format'])));return _0x51163e;}})[_0x07a1('0x45')](function(_0xd41774){throw new db['Sequelize'][(_0x07a1('0x5f'))](_0xd41774[_0x07a1('0x60')]);});})[_0x07a1('0x23')](handleEntityNotFound(_0x4359b7,null))[_0x07a1('0x23')](respondWithStatusCode(_0x4359b7,0xcc))[_0x07a1('0x45')](handleError(_0x4359b7,null));};exports[_0x07a1('0x6e')]=function(_0x30b535,_0x318676,_0x1b7872){var _0xd0a3a9={};var _0x2f5a36={};var _0x4ae57a;var _0x319d90;return db[_0x07a1('0x2d')][_0x07a1('0x63')]({'where':{'id':_0x30b535['params']['id']}})[_0x07a1('0x23')](handleEntityNotFound(_0x318676,null))['then'](function(_0x1acc24){if(_0x1acc24){_0x4ae57a=_0x1acc24;_0x2f5a36[_0x07a1('0x31')]=_[_0x07a1('0x33')](db['Sound'][_0x07a1('0x2e')]);_0x2f5a36['query']=_[_0x07a1('0x33')](_0x30b535[_0x07a1('0x32')]);_0x2f5a36[_0x07a1('0x34')]=_[_0x07a1('0x35')](_0x2f5a36[_0x07a1('0x31')],_0x2f5a36[_0x07a1('0x32')]);_0xd0a3a9[_0x07a1('0x37')]=_[_0x07a1('0x35')](_0x2f5a36[_0x07a1('0x31')],qs['fields'](_0x30b535[_0x07a1('0x32')][_0x07a1('0x36')]));_0xd0a3a9[_0x07a1('0x37')]=_0xd0a3a9['attributes'][_0x07a1('0x38')]?_0xd0a3a9['attributes']:_0x2f5a36[_0x07a1('0x31')];_0xd0a3a9['order']=qs[_0x07a1('0x3c')](_0x30b535['query'][_0x07a1('0x3c')]);_0xd0a3a9[_0x07a1('0x40')]=qs[_0x07a1('0x34')](_[_0x07a1('0x3d')](_0x30b535[_0x07a1('0x32')],_0x2f5a36[_0x07a1('0x34')]));if(_0x30b535[_0x07a1('0x32')]['filter']){_0xd0a3a9[_0x07a1('0x40')]=_['merge'](_0xd0a3a9[_0x07a1('0x40')],{'$or':_['map'](_0xd0a3a9[_0x07a1('0x37')],function(_0x101fe9){var _0xdc2245={};_0xdc2245[_0x101fe9]={'$like':'%'+_0x30b535[_0x07a1('0x32')]['filter']+'%'};return _0xdc2245;})});}_0xd0a3a9=_[_0x07a1('0x3f')]({},_0xd0a3a9,_0x30b535[_0x07a1('0x41')]);return _0x4ae57a[_0x07a1('0x6e')](_0xd0a3a9);}})['then'](function(_0x4c28d4){if(_0x4c28d4){_0x319d90=_0x4c28d4[_0x07a1('0x38')];if(!_0x30b535[_0x07a1('0x32')]['hasOwnProperty'](_0x07a1('0x3a'))){_0xd0a3a9[_0x07a1('0x1c')]=qs['limit'](_0x30b535[_0x07a1('0x32')]['limit']);_0xd0a3a9[_0x07a1('0x19')]=qs['offset'](_0x30b535['query']['offset']);}return _0x4ae57a[_0x07a1('0x6e')](_0xd0a3a9);}})[_0x07a1('0x23')](function(_0x568af5){if(_0x568af5){return _0x568af5?{'count':_0x319d90,'rows':_0x568af5}:null;}})[_0x07a1('0x23')](respondWithResult(_0x318676,null))['catch'](handleError(_0x318676,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2693886..93eb754 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 _0x35a9=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a5d43,_0x5f01a5){var _0x2b572c=function(_0x35ebeb){while(--_0x35ebeb){_0x4a5d43['push'](_0x4a5d43['shift']());}};_0x2b572c(++_0x5f01a5);}(_0x35a9,0xdb));var _0x935a=function(_0x4513e9,_0x3e3553){_0x4513e9=_0x4513e9-0x0;var _0x431795=_0x35a9[_0x4513e9];return _0x431795;};'use strict';var _=require(_0x935a('0x0'));var util=require(_0x935a('0x1'));var logger=require(_0x935a('0x2'))(_0x935a('0x3'));var moment=require(_0x935a('0x4'));var BPromise=require(_0x935a('0x5'));var rp=require(_0x935a('0x6'));var fs=require('fs');var path=require(_0x935a('0x7'));var rimraf=require(_0x935a('0x8'));var config=require(_0x935a('0x9'));var attributes=require(_0x935a('0xa'));module[_0x935a('0xb')]=function(_0x3ad576,_0x13cf16){return _0x3ad576[_0x935a('0xc')](_0x935a('0xd'),attributes,{'tableName':_0x935a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c33=['path','rimraf','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5554f2,_0x35c6df){var _0x147bb0=function(_0x2bb398){while(--_0x2bb398){_0x5554f2['push'](_0x5554f2['shift']());}};_0x147bb0(++_0x35c6df);}(_0x2c33,0xea));var _0x32c3=function(_0x3b7f4e,_0x3ffd00){_0x3b7f4e=_0x3b7f4e-0x0;var _0x4852f0=_0x2c33[_0x3b7f4e];return _0x4852f0;};'use strict';var _=require(_0x32c3('0x0'));var util=require('util');var logger=require(_0x32c3('0x1'))(_0x32c3('0x2'));var moment=require(_0x32c3('0x3'));var BPromise=require(_0x32c3('0x4'));var rp=require(_0x32c3('0x5'));var fs=require('fs');var path=require(_0x32c3('0x6'));var rimraf=require(_0x32c3('0x7'));var config=require(_0x32c3('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x6373bb,_0x14baa8){return _0x6373bb[_0x32c3('0x9')](_0x32c3('0xa'),attributes,{'tableName':_0x32c3('0xb'),'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 b958c01..6a02423 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 _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(_0x2d939d,_0x26707a){var _0x149362=function(_0x323fa7){while(--_0x323fa7){_0x2d939d['push'](_0x2d939d['shift']());}};_0x149362(++_0x26707a);}(_0xedd9,0xfc));var _0x9edd=function(_0x52a742,_0x402e3d){_0x52a742=_0x52a742-0x0;var _0x47d29c=_0xedd9[_0x52a742];return _0x47d29c;};'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 +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x27ded9,_0x2a447a){var _0x53cd8c=function(_0x5b0e22){while(--_0x5b0e22){_0x27ded9['push'](_0x27ded9['shift']());}};_0x53cd8c(++_0x2a447a);}(_0x70e0,0x17b));var _0x070e=function(_0x2be0a3,_0x5a65c3){_0x2be0a3=_0x2be0a3-0x0;var _0x15fe40=_0x70e0[_0x2be0a3];return _0x15fe40;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b898da4..256218c 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9335=['post','create','addAgents','addTeams','update','destroy','removeAgents','delete','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x2d2abe,_0x15de0d){var _0x19ec3a=function(_0x3aea3f){while(--_0x3aea3f){_0x2d2abe['push'](_0x2d2abe['shift']());}};_0x19ec3a(++_0x15de0d);}(_0x9335,0xab));var _0x5933=function(_0x2b1072,_0xc2d76){_0x2b1072=_0x2b1072-0x0;var _0x268e4e=_0x9335[_0x2b1072];return _0x268e4e;};'use strict';var multer=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var path=require('path');var timeout=require(_0x5933('0x2'));var express=require(_0x5933('0x3'));var router=express[_0x5933('0x4')]();var fs_extra=require(_0x5933('0x5'));var auth=require(_0x5933('0x6'));var interaction=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var controller=require('./voicePrefix.controller');router[_0x5933('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5933('0x9')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller['describe']);router[_0x5933('0x9')](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0xd')]);router[_0x5933('0x9')](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0xf')]);router[_0x5933('0x9')](_0x5933('0x10'),auth[_0x5933('0xb')](),controller[_0x5933('0x11')]);router[_0x5933('0x12')]('/',auth['isAuthenticated'](),controller[_0x5933('0x13')]);router['post'](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0x14')]);router['post'](_0x5933('0x10'),auth['isAuthenticated'](),controller[_0x5933('0x15')]);router['put'](_0x5933('0xc'),auth['isAuthenticated'](),controller[_0x5933('0x16')]);router['delete'](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0x17')]);router['delete']('/:id/users',auth[_0x5933('0xb')](),controller[_0x5933('0x18')]);router[_0x5933('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5933('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x67d1=['describe','/:id','show','/:id/users','/:id/teams','getTeams','create','post','addAgents','addTeams','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe'];(function(_0x2e18c3,_0x4163cb){var _0x29878d=function(_0x467c1d){while(--_0x467c1d){_0x2e18c3['push'](_0x2e18c3['shift']());}};_0x29878d(++_0x4163cb);}(_0x67d1,0xdf));var _0x167d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x67d1[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x167d('0x0'));var util=require(_0x167d('0x1'));var path=require(_0x167d('0x2'));var timeout=require(_0x167d('0x3'));var express=require('express');var router=express[_0x167d('0x4')]();var fs_extra=require(_0x167d('0x5'));var auth=require(_0x167d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x167d('0x7')]('/',auth[_0x167d('0x8')](),controller[_0x167d('0x9')]);router[_0x167d('0x7')](_0x167d('0xa'),auth[_0x167d('0x8')](),controller[_0x167d('0xb')]);router['get'](_0x167d('0xc'),auth[_0x167d('0x8')](),controller[_0x167d('0xd')]);router[_0x167d('0x7')](_0x167d('0xe'),auth[_0x167d('0x8')](),controller['getAgents']);router[_0x167d('0x7')](_0x167d('0xf'),auth[_0x167d('0x8')](),controller[_0x167d('0x10')]);router['post']('/',auth[_0x167d('0x8')](),controller[_0x167d('0x11')]);router[_0x167d('0x12')](_0x167d('0xe'),auth[_0x167d('0x8')](),controller[_0x167d('0x13')]);router[_0x167d('0x12')](_0x167d('0xf'),auth[_0x167d('0x8')](),controller[_0x167d('0x14')]);router[_0x167d('0x15')](_0x167d('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x167d('0xc'),auth[_0x167d('0x8')](),controller[_0x167d('0x16')]);router[_0x167d('0x17')](_0x167d('0xe'),auth[_0x167d('0x8')](),controller[_0x167d('0x18')]);router['delete'](_0x167d('0xf'),auth[_0x167d('0x8')](),controller['removeTeams']);module[_0x167d('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 56c8094..a6b03f8 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 _0x82f1=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x10485c,_0x5c905b){var _0x2f4c1d=function(_0x21a55d){while(--_0x21a55d){_0x10485c['push'](_0x10485c['shift']());}};_0x2f4c1d(++_0x5c905b);}(_0x82f1,0x8f));var _0x182f=function(_0x5b5e91,_0x180334){_0x5b5e91=_0x5b5e91-0x0;var _0x1c269a=_0x82f1[_0x5b5e91];return _0x1c269a;};'use strict';var Sequelize=require(_0x182f('0x0'));module[_0x182f('0x1')]={'name':{'type':Sequelize[_0x182f('0x2')],'allowNull':![],'unique':_0x182f('0x3')},'prefix':{'type':Sequelize[_0x182f('0x4')],'get':function(_0x4b4aac){return _0x182f('0x5')+this[_0x182f('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x182f('0x2')]},'callerIdAll':{'type':Sequelize[_0x182f('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x182f('0x7')]}}; \ No newline at end of file +var _0x4a34=['name','VIRTUAL','system-','INTEGER','exports','STRING'];(function(_0x312e02,_0x5520ce){var _0x204e50=function(_0x111c65){while(--_0x111c65){_0x312e02['push'](_0x312e02['shift']());}};_0x204e50(++_0x5520ce);}(_0x4a34,0x148));var _0x44a3=function(_0x44da26,_0x26fa8a){_0x44da26=_0x44da26-0x0;var _0x1b0b44=_0x4a34[_0x44da26];return _0x1b0b44;};'use strict';var Sequelize=require('sequelize');module[_0x44a3('0x0')]={'name':{'type':Sequelize[_0x44a3('0x1')],'allowNull':![],'unique':_0x44a3('0x2')},'prefix':{'type':Sequelize[_0x44a3('0x3')],'get':function(_0x2bfe5a){return _0x44a3('0x4')+this['getDataValue'](_0x44a3('0x2'))+'-';}},'description':{'type':Sequelize[_0x44a3('0x1')]},'callerIdAll':{'type':Sequelize[_0x44a3('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x44a3('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 552c967..4f99a9c 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 _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x2a57a5,_0x795b7f){var _0x110fae=function(_0x2d39d4){while(--_0x2d39d4){_0x2a57a5['push'](_0x2a57a5['shift']());}};_0x110fae(++_0x795b7f);}(_0x2032,0xd9));var _0x2203=function(_0x44d9dc,_0x37f590){_0x44d9dc=_0x44d9dc-0x0;var _0x379386=_0x2032[_0x44d9dc];return _0x379386;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file +var _0xcf2f=['removeTeams','Team','User','select','field','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','VoicePrefix','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','find','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','description','appdata','prefix','Voice\x20Prefix','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','VoiceExtension','findById','addAgents','omit','ids','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','order','getTeams','findOne','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','forEach'];(function(_0x492809,_0x21a847){var _0x5c3967=function(_0x20d0e5){while(--_0x20d0e5){_0x492809['push'](_0x492809['shift']());}};_0x5c3967(++_0x21a847);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x40e808,_0x36061c){_0x40e808=_0x40e808-0x0;var _0x5c3154=_0xcf2f[_0x40e808];return _0x5c3154;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];config[_0xfcf2('0x19')]=_[_0xfcf2('0x1a')](config[_0xfcf2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcf2('0x1b'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0xc87ff4,_0x5ef004){_0x5ef004=_0x5ef004||0xcc;return function(_0x3aa6c0){if(_0x3aa6c0){return _0xc87ff4[_0xfcf2('0x1c')](_0x5ef004);}return _0xc87ff4[_0xfcf2('0x1d')](_0x5ef004)[_0xfcf2('0x1e')]();};}function respondWithResult(_0x315b2f,_0x44320d){_0x44320d=_0x44320d||0xc8;return function(_0x1de1e5){if(_0x1de1e5){return _0x315b2f['status'](_0x44320d)[_0xfcf2('0x1f')](_0x1de1e5);}};}function respondWithFilteredResult(_0x213125,_0x2a1865){return function(_0x581d78){if(_0x581d78){var _0xd87472=typeof _0x2a1865[_0xfcf2('0x20')]===_0xfcf2('0x21')&&typeof _0x2a1865[_0xfcf2('0x22')]===_0xfcf2('0x21');var _0x53c406=_0x581d78[_0xfcf2('0x23')];var _0x11c34f=_0xd87472?0x0:_0x2a1865['offset'];var _0x9a1d9f=_0xd87472?_0x581d78[_0xfcf2('0x23')]:_0x2a1865[_0xfcf2('0x20')]+_0x2a1865[_0xfcf2('0x22')];var _0x51e0b7;if(_0x9a1d9f>=_0x53c406){_0x9a1d9f=_0x53c406;_0x51e0b7=0xc8;}else{_0x51e0b7=0xce;}_0x213125[_0xfcf2('0x1d')](_0x51e0b7);return _0x213125[_0xfcf2('0x24')](_0xfcf2('0x25'),_0x11c34f+'-'+_0x9a1d9f+'/'+_0x53c406)[_0xfcf2('0x1f')](_0x581d78);}return null;};}function patchUpdates(_0x5afab5){return function(_0x3790ed){try{jsonpatch[_0xfcf2('0x26')](_0x3790ed,_0x5afab5,!![]);}catch(_0x232f6f){return BPromise['reject'](_0x232f6f);}return _0x3790ed[_0xfcf2('0x27')]();};}function saveUpdates(_0x151aa8,_0x5ddea1){return function(_0x3c3774){if(_0x3c3774){return _0x3c3774[_0xfcf2('0x28')](_0x151aa8)['then'](function(_0x1e6f14){return _0x1e6f14;});}return null;};}function removeEntity(_0x26bfcc,_0x1f0f07){return function(_0x21ca98){if(_0x21ca98){return _0x21ca98['destroy']()[_0xfcf2('0x29')](function(){var _0x448222=_0x21ca98[_0xfcf2('0x2a')]({'plain':!![]});var _0x3779ee=_0xfcf2('0x2b');return db[_0xfcf2('0x2c')][_0xfcf2('0x2d')]({'where':{'type':_0x3779ee,'resourceId':_0x448222['id']}})[_0xfcf2('0x29')](function(){return _0x21ca98;});})[_0xfcf2('0x29')](function(){_0x26bfcc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x695f31,_0x878504){return function(_0x3308c3){if(!_0x3308c3){_0x695f31['sendStatus'](0x194);}return _0x3308c3;};}function handleError(_0x560898,_0x598832){_0x598832=_0x598832||0x1f4;return function(_0x3ce9f8){logger[_0xfcf2('0x2e')](_0x3ce9f8[_0xfcf2('0x2f')]);if(_0x3ce9f8[_0xfcf2('0x30')]){delete _0x3ce9f8[_0xfcf2('0x30')];}_0x560898[_0xfcf2('0x1d')](_0x598832)[_0xfcf2('0x31')](_0x3ce9f8);};}exports['index']=function(_0x4796c4,_0xfc3b86){var _0x1acbea={},_0x147ed2={},_0xd76c56={'count':0x0,'rows':[]};var _0x4913fc=_['map'](db[_0xfcf2('0x32')]['rawAttributes'],function(_0x1f5117){return{'name':_0x1f5117[_0xfcf2('0x33')],'type':_0x1f5117['type'][_0xfcf2('0x34')]};});_0x147ed2[_0xfcf2('0x35')]=_[_0xfcf2('0x36')](_0x4913fc,_0xfcf2('0x30'));_0x147ed2[_0xfcf2('0x37')]=_[_0xfcf2('0x38')](_0x4796c4[_0xfcf2('0x37')]);_0x147ed2['filters']=_[_0xfcf2('0x39')](_0x147ed2[_0xfcf2('0x35')],_0x147ed2['query']);_0x1acbea[_0xfcf2('0x3a')]=_[_0xfcf2('0x39')](_0x147ed2['model'],qs[_0xfcf2('0x3b')](_0x4796c4[_0xfcf2('0x37')]['fields']));_0x1acbea[_0xfcf2('0x3a')]=_0x1acbea[_0xfcf2('0x3a')][_0xfcf2('0x3c')]?_0x1acbea[_0xfcf2('0x3a')]:_0x147ed2['model'];if(!_0x4796c4[_0xfcf2('0x37')][_0xfcf2('0x3d')](_0xfcf2('0x3e'))){_0x1acbea[_0xfcf2('0x22')]=qs[_0xfcf2('0x22')](_0x4796c4['query'][_0xfcf2('0x22')]);_0x1acbea[_0xfcf2('0x20')]=qs[_0xfcf2('0x20')](_0x4796c4[_0xfcf2('0x37')][_0xfcf2('0x20')]);}_0x1acbea['order']=qs[_0xfcf2('0x3f')](_0x4796c4['query'][_0xfcf2('0x3f')]);_0x1acbea[_0xfcf2('0x40')]=qs[_0xfcf2('0x41')](_[_0xfcf2('0x42')](_0x4796c4[_0xfcf2('0x37')],_0x147ed2['filters']),_0x4913fc);if(_0x4796c4[_0xfcf2('0x37')][_0xfcf2('0x43')]){_0x1acbea[_0xfcf2('0x40')]=_['merge'](_0x1acbea[_0xfcf2('0x40')],{'$or':_[_0xfcf2('0x36')](_0x4913fc,function(_0x45fb6f){if(_0x45fb6f[_0xfcf2('0x44')]!==_0xfcf2('0x45')){var _0x1d4942={};_0x1d4942[_0x45fb6f['name']]={'$like':'%'+_0x4796c4['query']['filter']+'%'};return _0x1d4942;}})});}_0x1acbea=_[_0xfcf2('0x46')]({},_0x1acbea,_0x4796c4[_0xfcf2('0x47')]);var _0x24802d={'where':_0x1acbea['where']};return db['VoicePrefix']['count'](_0x24802d)[_0xfcf2('0x29')](function(_0xab0747){_0xd76c56[_0xfcf2('0x23')]=_0xab0747;if(_0x4796c4[_0xfcf2('0x37')][_0xfcf2('0x48')]){_0x1acbea[_0xfcf2('0x49')]=[{'all':!![]}];}return db[_0xfcf2('0x32')][_0xfcf2('0x4a')](_0x1acbea);})[_0xfcf2('0x29')](function(_0x467ecd){_0xd76c56[_0xfcf2('0x4b')]=_0x467ecd;return _0xd76c56;})['then'](respondWithFilteredResult(_0xfc3b86,_0x1acbea))['catch'](handleError(_0xfc3b86,null));};exports[_0xfcf2('0x4c')]=function(_0x1ecba0,_0x4752d0){var _0x34283b={'raw':![],'where':{'id':_0x1ecba0[_0xfcf2('0x4d')]['id']}},_0x3bdfd3={};_0x3bdfd3[_0xfcf2('0x35')]=_[_0xfcf2('0x38')](db[_0xfcf2('0x32')][_0xfcf2('0x4e')]);_0x3bdfd3[_0xfcf2('0x37')]=_[_0xfcf2('0x38')](_0x1ecba0[_0xfcf2('0x37')]);_0x3bdfd3[_0xfcf2('0x41')]=_[_0xfcf2('0x39')](_0x3bdfd3[_0xfcf2('0x35')],_0x3bdfd3[_0xfcf2('0x37')]);_0x34283b['attributes']=_[_0xfcf2('0x39')](_0x3bdfd3[_0xfcf2('0x35')],qs['fields'](_0x1ecba0[_0xfcf2('0x37')]['fields']));_0x34283b[_0xfcf2('0x3a')]=_0x34283b[_0xfcf2('0x3a')][_0xfcf2('0x3c')]?_0x34283b[_0xfcf2('0x3a')]:_0x3bdfd3['model'];if(_0x1ecba0['query']['includeAll']){_0x34283b[_0xfcf2('0x49')]=[{'all':!![]}];}_0x34283b=_[_0xfcf2('0x46')]({},_0x34283b,_0x1ecba0[_0xfcf2('0x47')]);return db[_0xfcf2('0x32')]['find'](_0x34283b)[_0xfcf2('0x29')](handleEntityNotFound(_0x4752d0,null))[_0xfcf2('0x29')](respondWithResult(_0x4752d0,null))[_0xfcf2('0x4f')](handleError(_0x4752d0,null));};exports['destroy']=function(_0x1e3668,_0x21c836){return db[_0xfcf2('0x32')][_0xfcf2('0x50')]({'where':{'id':_0x1e3668[_0xfcf2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x21c836,null))[_0xfcf2('0x29')](removeEntity(_0x21c836,null))[_0xfcf2('0x4f')](handleError(_0x21c836,null));};exports[_0xfcf2('0x51')]=function(_0x42acb9,_0x17592d){return db[_0xfcf2('0x32')]['describe']()['then'](respondWithResult(_0x17592d,null))['catch'](handleError(_0x17592d,null));};exports[_0xfcf2('0x52')]=function(_0x9ddcd4,_0x5ecbf2){var _0x53058a;return db[_0xfcf2('0x53')][_0xfcf2('0x54')](function(_0x137a47){return db['VoicePrefix'][_0xfcf2('0x52')](_0x9ddcd4[_0xfcf2('0x55')],{'transaction':_0x137a47})['then'](function(_0x5aaf01){_0x53058a=_0x5aaf01[_0xfcf2('0x2a')]({'plain':!![]});return db['VoiceExtension'][_0xfcf2('0x50')]({'where':{'id':_0x53058a[_0xfcf2('0x56')]},'raw':!![]})['then'](function(_0x236b97){return createVoicePrefixExtensions(_0x53058a,_0x236b97,_0x137a47);});});})['then'](function(){var _0x26acdc=_0x9ddcd4['user'][_0xfcf2('0x2a')]({'plain':!![]});if(!_0x26acdc)throw new Error(_0xfcf2('0x57'));if(_0x26acdc[_0xfcf2('0x58')]==='user'){var _0x235b06=_0x53058a;return db[_0xfcf2('0x59')][_0xfcf2('0x50')]({'where':{'name':_0xfcf2('0x2b'),'userProfileId':_0x26acdc[_0xfcf2('0x5a')]},'raw':!![]})[_0xfcf2('0x29')](function(_0x445b17){if(_0x445b17&&_0x445b17['autoAssociation']===0x0){return db[_0xfcf2('0x2c')][_0xfcf2('0x52')]({'name':_0x235b06['name'],'resourceId':_0x235b06['id'],'type':_0x445b17[_0xfcf2('0x30')],'sectionId':_0x445b17['id']},{})[_0xfcf2('0x29')](function(){return _0x53058a;});}else{return _0x53058a;}})[_0xfcf2('0x4f')](function(_0xe3d645){logger['error'](_0xfcf2('0x5b'),_0xe3d645);throw _0xe3d645;});}return _0x53058a;})['then'](respondWithResult(_0x5ecbf2,null))[_0xfcf2('0x4f')](handleError(_0x5ecbf2,null));};function Extension(_0x17d449,_0x2d0696,_0x2eb6bd,_0x101e85){this[_0xfcf2('0x5c')]=_0xfcf2('0x5d');this['exten']=_0x17d449;this[_0xfcf2('0x5e')]=_0x2eb6bd;this[_0xfcf2('0x44')]='system';this[_0xfcf2('0x5f')]='Voice\x20Prefix\x20Extension';this['priority']=_0x2d0696;this[_0xfcf2('0x60')]=_0x101e85;}function createVoicePrefixExtensions(_0x375d6f,_0x98be70,_0xfef0e9){return new BPromise(function(_0x2fc657,_0x545dd7){var _0x2579de=new Extension(formatPrefixName(_0x375d6f[_0xfcf2('0x61')]),0x1,'NoOp',_0xfcf2('0x62'));_0x2579de[_0xfcf2('0x63')]=_0x375d6f['id'];return db['VoiceExtension'][_0xfcf2('0x52')](_0x2579de,{'transaction':_0xfef0e9})[_0xfcf2('0x29')](function(_0x326144){var _0x9efe34=_0x326144[_0xfcf2('0x2a')]({'plain':!![]});var _0x302852=_[_0xfcf2('0x36')](addVoicePrefixExtensions(_0x375d6f,_0x98be70),function(_0x5c28de){_0x5c28de[_0xfcf2('0x56')]=_0x9efe34['id'];_0x5c28de[_0xfcf2('0x63')]=_0x375d6f['id'];return _0x5c28de;});return db['VoiceExtension']['bulkCreate'](_0x302852,{'transaction':_0xfef0e9})['then'](function(_0x25acf7){if(!_0x25acf7){return _0x545dd7('Extensions\x20creation\x20failed');}else{return _0x2fc657(_0x25acf7);}})[_0xfcf2('0x4f')](function(_0x535d40){return _0x545dd7(_0x535d40);});});;});};function addVoicePrefixExtensions(_0x388721,_0x2ca9a1){var _0x48f654=[];var _0x51891d=formatPrefixName(_0x388721[_0xfcf2('0x61')]);_0x48f654[_0xfcf2('0x64')](new Extension(_0x51891d,0x2,_0xfcf2('0x65'),_0xfcf2('0x66')+_0x388721['name']));if(_0x388721[_0xfcf2('0x67')]){_0x48f654[_0xfcf2('0x64')](new Extension(_0x51891d,0x3,_0xfcf2('0x65'),_0xfcf2('0x68')+_0x388721['callerIdAll']));}else{_0x48f654['push'](new Extension(_0x51891d,0x3,'NoOp','No\x20callerid\x20available'));}_0x48f654[_0xfcf2('0x64')](new Extension(_0x51891d,0x4,_0xfcf2('0x69'),_0x2ca9a1['context']+','+_0xfcf2('0x6a')+(0x8+_0x388721[_0xfcf2('0x30')]['length'])+'}'+','+0x1));return _0x48f654;}function formatPrefixName(_0x2844b4){var _0x4a648d='_';for(var _0x51e8bd=0x0;_0x51e8bd<_0x2844b4[_0xfcf2('0x3c')];_0x51e8bd++){if(_0x2844b4[_0xfcf2('0x6b')](_0x51e8bd)=='-'){_0x4a648d+=_0x2844b4[_0xfcf2('0x6b')](_0x51e8bd);}else{_0x4a648d+='['+_0x2844b4['charAt'](_0x51e8bd)+']';}}_0x4a648d+='.';return _0x4a648d;}exports[_0xfcf2('0x28')]=function(_0x3b6232,_0x4ec509,_0x57d354){var _0x57c2d6=_0x3b6232[_0xfcf2('0x55')];_0x57c2d6[_0xfcf2('0x61')]=_0xfcf2('0x6c')+_0x57c2d6['name']+'-';return db[_0xfcf2('0x53')][_0xfcf2('0x54')](function(_0x451050){return db[_0xfcf2('0x32')][_0xfcf2('0x28')](_0x57c2d6,{'where':{'id':_0x57c2d6['id']},'transaction':_0x451050})[_0xfcf2('0x29')](function(){return db[_0xfcf2('0x6d')]['destroy']({'where':{'VoicePrefixId':_0x57c2d6['id']},'transaction':_0x451050})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x57c2d6[_0xfcf2('0x56')]},'raw':!![]})[_0xfcf2('0x29')](function(_0x2a30be){return createVoicePrefixExtensions(_0x57c2d6,_0x2a30be,_0x451050);});});});})['then'](function(){return db[_0xfcf2('0x32')][_0xfcf2('0x6e')](_0x57c2d6['id']);})['then'](respondWithResult(_0x4ec509,null))[_0xfcf2('0x4f')](handleError(_0x4ec509,null));};exports[_0xfcf2('0x6f')]=function(_0x16d2cf,_0x174142,_0x171c90){return db[_0xfcf2('0x32')]['find']({'where':{'id':_0x16d2cf['params']['id']}})[_0xfcf2('0x29')](handleEntityNotFound(_0x174142,null))[_0xfcf2('0x29')](function(_0x22e07b){if(_0x22e07b){return _0x22e07b['addAgents'](_0x16d2cf['body']['ids'],_[_0xfcf2('0x70')](_0x16d2cf[_0xfcf2('0x55')],['ids','id'])||{})['spread'](function(_0xce5424){for(var _0x3e42c2=0x0;_0x3e42c2<_0x16d2cf['body'][_0xfcf2('0x71')][_0xfcf2('0x3c')];_0x3e42c2+=0x1){socket['emit'](_0xfcf2('0x72'),{'UserId':Number(_0x16d2cf[_0xfcf2('0x55')]['ids'][_0x3e42c2]),'VoicePrefixId':Number(_0x16d2cf['params']['id'])});}return _0xce5424;});}})[_0xfcf2('0x29')](respondWithResult(_0x174142,null))['catch'](handleError(_0x174142,null));};exports[_0xfcf2('0x73')]=function(_0x1d0a3b,_0x2ec0c5,_0x61a297){return db[_0xfcf2('0x32')][_0xfcf2('0x50')]({'where':{'id':_0x1d0a3b['params']['id']}})[_0xfcf2('0x29')](handleEntityNotFound(_0x2ec0c5,null))[_0xfcf2('0x29')](function(_0xf1ef46){if(_0xf1ef46){return _0xf1ef46[_0xfcf2('0x73')](_0x1d0a3b[_0xfcf2('0x37')][_0xfcf2('0x71')])['then'](function(){if(_[_0xfcf2('0x74')](_0x1d0a3b[_0xfcf2('0x37')][_0xfcf2('0x71')])){for(var _0x4266f2=0x0;_0x4266f2<_0x1d0a3b['query']['ids'][_0xfcf2('0x3c')];_0x4266f2+=0x1){socket[_0xfcf2('0x75')](_0xfcf2('0x76'),{'UserId':Number(_0x1d0a3b[_0xfcf2('0x37')]['ids'][_0x4266f2]),'VoicePrefixId':Number(_0x1d0a3b[_0xfcf2('0x4d')]['id'])});}}else{socket['emit'](_0xfcf2('0x76'),{'UserId':Number(_0x1d0a3b[_0xfcf2('0x37')][_0xfcf2('0x71')]),'VoicePrefixId':Number(_0x1d0a3b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2ec0c5,null))[_0xfcf2('0x4f')](handleError(_0x2ec0c5,null));};exports[_0xfcf2('0x77')]=function(_0x26f450,_0x485b9,_0x52cbcb){var _0x3f95a5={};var _0x4eacee={};var _0xa295d3;var _0x14da0f;return db[_0xfcf2('0x32')]['findOne']({'where':{'id':_0x26f450['params']['id']}})['then'](handleEntityNotFound(_0x485b9,null))['then'](function(_0x3b25cb){if(_0x3b25cb){_0xa295d3=_0x3b25cb;_0x4eacee[_0xfcf2('0x35')]=_['keys'](db['User'][_0xfcf2('0x4e')]);_0x4eacee[_0xfcf2('0x37')]=_['keys'](_0x26f450[_0xfcf2('0x37')]);_0x4eacee[_0xfcf2('0x41')]=_['intersection'](_0x4eacee[_0xfcf2('0x35')],_0x4eacee[_0xfcf2('0x37')]);_0x3f95a5[_0xfcf2('0x3a')]=_[_0xfcf2('0x39')](_0x4eacee[_0xfcf2('0x35')],qs[_0xfcf2('0x3b')](_0x26f450[_0xfcf2('0x37')][_0xfcf2('0x3b')]));_0x3f95a5[_0xfcf2('0x3a')]=_0x3f95a5[_0xfcf2('0x3a')][_0xfcf2('0x3c')]?_0x3f95a5[_0xfcf2('0x3a')]:_0x4eacee[_0xfcf2('0x35')];_0x3f95a5[_0xfcf2('0x78')]=qs['sort'](_0x26f450[_0xfcf2('0x37')][_0xfcf2('0x3f')]);_0x3f95a5[_0xfcf2('0x40')]=qs[_0xfcf2('0x41')](_[_0xfcf2('0x42')](_0x26f450[_0xfcf2('0x37')],_0x4eacee[_0xfcf2('0x41')]));if(_0x26f450[_0xfcf2('0x37')][_0xfcf2('0x43')]){_0x3f95a5[_0xfcf2('0x40')]=_[_0xfcf2('0x46')](_0x3f95a5[_0xfcf2('0x40')],{'$or':_[_0xfcf2('0x36')](_0x3f95a5['attributes'],function(_0x5e03f0){var _0x4f640c={};_0x4f640c[_0x5e03f0]={'$like':'%'+_0x26f450[_0xfcf2('0x37')][_0xfcf2('0x43')]+'%'};return _0x4f640c;})});}_0x3f95a5=_[_0xfcf2('0x46')]({},_0x3f95a5,_0x26f450[_0xfcf2('0x47')]);return _0xa295d3[_0xfcf2('0x77')](_0x3f95a5);}})[_0xfcf2('0x29')](function(_0x2f8e66){if(_0x2f8e66){_0x14da0f=_0x2f8e66[_0xfcf2('0x3c')];if(!_0x26f450[_0xfcf2('0x37')][_0xfcf2('0x3d')](_0xfcf2('0x3e'))){_0x3f95a5[_0xfcf2('0x22')]=qs['limit'](_0x26f450[_0xfcf2('0x37')][_0xfcf2('0x22')]);_0x3f95a5[_0xfcf2('0x20')]=qs[_0xfcf2('0x20')](_0x26f450[_0xfcf2('0x37')][_0xfcf2('0x20')]);}return _0xa295d3[_0xfcf2('0x77')](_0x3f95a5);}})['then'](function(_0x192d7b){if(_0x192d7b){return _0x192d7b?{'count':_0x14da0f,'rows':_0x192d7b}:null;}})[_0xfcf2('0x29')](respondWithResult(_0x485b9,null))[_0xfcf2('0x4f')](handleError(_0x485b9,null));};exports[_0xfcf2('0x79')]=function(_0x3664b0,_0x2ee51b,_0x6dba54){var _0x5137d1={};var _0x10caf3={};var _0x26432f;var _0x11701f;return db[_0xfcf2('0x32')][_0xfcf2('0x7a')]({'where':{'id':_0x3664b0[_0xfcf2('0x4d')]['id']}})[_0xfcf2('0x29')](handleEntityNotFound(_0x2ee51b,null))['then'](function(_0x1061a7){if(_0x1061a7){_0x26432f=_0x1061a7;_0x10caf3[_0xfcf2('0x35')]=_[_0xfcf2('0x38')](db['Team'][_0xfcf2('0x4e')]);_0x10caf3['query']=_[_0xfcf2('0x38')](_0x3664b0[_0xfcf2('0x37')]);_0x10caf3['filters']=_[_0xfcf2('0x39')](_0x10caf3[_0xfcf2('0x35')],_0x10caf3[_0xfcf2('0x37')]);_0x5137d1[_0xfcf2('0x3a')]=_[_0xfcf2('0x39')](_0x10caf3['model'],qs[_0xfcf2('0x3b')](_0x3664b0[_0xfcf2('0x37')]['fields']));_0x5137d1[_0xfcf2('0x3a')]=_0x5137d1[_0xfcf2('0x3a')][_0xfcf2('0x3c')]?_0x5137d1['attributes']:_0x10caf3['model'];_0x5137d1[_0xfcf2('0x78')]=qs[_0xfcf2('0x3f')](_0x3664b0[_0xfcf2('0x37')][_0xfcf2('0x3f')]);_0x5137d1[_0xfcf2('0x40')]=qs['filters'](_['pick'](_0x3664b0[_0xfcf2('0x37')],_0x10caf3[_0xfcf2('0x41')]));if(_0x3664b0[_0xfcf2('0x37')][_0xfcf2('0x43')]){_0x5137d1['where']=_[_0xfcf2('0x46')](_0x5137d1['where'],{'$or':_[_0xfcf2('0x36')](_0x5137d1['attributes'],function(_0x2bb04c){var _0x4ef12e={};_0x4ef12e[_0x2bb04c]={'$like':'%'+_0x3664b0[_0xfcf2('0x37')]['filter']+'%'};return _0x4ef12e;})});}_0x5137d1=_[_0xfcf2('0x46')]({},_0x5137d1,_0x3664b0[_0xfcf2('0x47')]);return _0x26432f['getTeams'](_0x5137d1);}})[_0xfcf2('0x29')](function(_0x18995d){if(_0x18995d){_0x11701f=_0x18995d[_0xfcf2('0x3c')];if(!_0x3664b0[_0xfcf2('0x37')][_0xfcf2('0x3d')]('nolimit')){_0x5137d1['limit']=qs['limit'](_0x3664b0[_0xfcf2('0x37')][_0xfcf2('0x22')]);_0x5137d1['offset']=qs[_0xfcf2('0x20')](_0x3664b0['query']['offset']);}return _0x26432f['getTeams'](_0x5137d1);}})[_0xfcf2('0x29')](function(_0x23e7f4){if(_0x23e7f4){return _0x23e7f4?{'count':_0x11701f,'rows':_0x23e7f4}:null;}})[_0xfcf2('0x29')](respondWithResult(_0x2ee51b,null))[_0xfcf2('0x4f')](handleError(_0x2ee51b,null));};exports[_0xfcf2('0x7b')]=function(_0x39e2a3,_0x2e68ea,_0x2d3c0d){var _0x2af260=_0x39e2a3[_0xfcf2('0x55')][_0xfcf2('0x71')];var _0x3c7e2d;return db['Team'][_0xfcf2('0x4a')]({'where':{'id':_0x2af260},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfcf2('0x7c'),'attributes':['id',_0xfcf2('0x30'),_0xfcf2('0x7d'),_0xfcf2('0x7e'),'interface'],'raw':!![]}]})['then'](function(_0x521851){if(_0x521851){_0x3c7e2d=_0x521851;var _0x456185=_[_0xfcf2('0x7f')](_0x521851,function(_0x487590){var _0x471b3c=_0x487590[_0xfcf2('0x2a')]({'plain':!![]});return _0x471b3c[_0xfcf2('0x7c')];});return db[_0xfcf2('0x32')]['find']({'where':{'id':_0x39e2a3['params']['id']}})[_0xfcf2('0x29')](function(_0x597cd9){return db[_0xfcf2('0x53')][_0xfcf2('0x54')](function(_0x3d3616){return _0x597cd9[_0xfcf2('0x7b')](_0x2af260,{'transaction':_0x3d3616})['then'](function(){return BPromise[_0xfcf2('0x80')](_0x3c7e2d,function(_0x3353d2){return db[_0xfcf2('0x81')]['upsert']({'TeamId':_0x3353d2['id'],'VoicePrefixId':_0x39e2a3[_0xfcf2('0x4d')]['id']},{'transaction':_0x3d3616});});})[_0xfcf2('0x29')](function(){return BPromise[_0xfcf2('0x80')](_0x456185,function(_0x5b6950){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x5b6950['id'],'VoicePrefixId':_0x39e2a3[_0xfcf2('0x4d')]['id']},'transaction':_0x3d3616});});})[_0xfcf2('0x29')](function(){_0x456185[_0xfcf2('0x82')](function(_0x50be02){socket[_0xfcf2('0x75')]('userVoicePrefix:save',{'UserId':_0x50be02['id'],'VoicePrefixId':_0x597cd9['id']});});});});});}})[_0xfcf2('0x29')](respondWithStatusCode(_0x2e68ea,null))['catch'](handleError(_0x2e68ea,null));};exports[_0xfcf2('0x83')]=function(_0x20889c,_0x4f166b,_0x1e954f){return db[_0xfcf2('0x84')][_0xfcf2('0x4a')]({'where':{'id':_0x20889c[_0xfcf2('0x37')][_0xfcf2('0x71')]},'attributes':['id'],'include':[{'model':db[_0xfcf2('0x85')],'as':_0xfcf2('0x7c'),'attributes':['id'],'raw':!![]}]})[_0xfcf2('0x29')](handleEntityNotFound(_0x4f166b,null))['then'](function(_0x140aa4){var _0x402cb0=_[_0xfcf2('0x36')](_0x140aa4,'id');var _0x1dd3ce=[];var _0xfff48e=[];var _0x10a120=squel[_0xfcf2('0x86')]();_0x10a120[_0xfcf2('0x87')]('tq.TeamId')['from'](_0xfcf2('0x88'),'tq')['join'](_0xfcf2('0x89'),'ut',_0xfcf2('0x8a'))[_0xfcf2('0x40')]('VoicePrefixId\x20=\x20?',_0x20889c[_0xfcf2('0x4d')]['id']);for(var _0xd3cd6f=0x0;_0xd3cd6f<_0x140aa4['length'];_0xd3cd6f+=0x1){let _0x3291ac=_0x140aa4[_0xd3cd6f];for(var _0x469a9b=0x0;_0x469a9b<_0x3291ac[_0xfcf2('0x7c')][_0xfcf2('0x3c')];_0x469a9b+=0x1){let _0x4cdbd4=_0x3291ac[_0xfcf2('0x7c')][_0x469a9b];var _0x32a6e8=_0x10a120['clone']();_0x32a6e8[_0xfcf2('0x40')](_0xfcf2('0x8b'),_0x4cdbd4['id']);_0xfff48e[_0xfcf2('0x64')](db['sequelize']['query'](_0x32a6e8[_0xfcf2('0x8c')](),{'type':db['sequelize']['QueryTypes'][_0xfcf2('0x8d')]})[_0xfcf2('0x29')](function(_0x2e5d14){if(_0x2e5d14[_0xfcf2('0x3c')]===0x1){return _0x4cdbd4['id'];}else{var _0x306809=_[_0xfcf2('0x8e')](_[_0xfcf2('0x36')](_0x2e5d14,_0xfcf2('0x8f')),function(_0x7e30bd){return _[_0xfcf2('0x90')](_0x402cb0,_0x7e30bd);});if(_0x306809){return _0x4cdbd4['id'];}}}));}}return BPromise['all'](_0xfff48e)[_0xfcf2('0x29')](function(_0x445de1){_0x1dd3ce=_(_0x1dd3ce)[_0xfcf2('0x91')](_0x445de1)[_0xfcf2('0x92')]()[_0xfcf2('0x93')]();return db['VoicePrefix'][_0xfcf2('0x50')]({'where':{'id':_0x20889c[_0xfcf2('0x4d')]['id']}})['then'](function(_0x50b78a){return db[_0xfcf2('0x53')][_0xfcf2('0x54')](function(_0x314762){return _0x50b78a['removeTeams'](_0x20889c[_0xfcf2('0x37')]['ids'],{'transaction':_0x314762})[_0xfcf2('0x29')](function(){if(!_[_0xfcf2('0x94')](_0x1dd3ce)){return _0x50b78a[_0xfcf2('0x73')](_0x1dd3ce,{'transaction':_0x314762});}})['then'](function(){_0x1dd3ce[_0xfcf2('0x82')](function(_0x5bf3a2){socket['emit'](_0xfcf2('0x76'),{'UserId':_0x5bf3a2,'VoicePrefixId':_0x50b78a['id']});});});});});});})[_0xfcf2('0x29')](respondWithStatusCode(_0x4f166b,null))['catch'](handleError(_0x4f166b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index c32b0ed..73439c4 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 _0x00a2=['save','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2be720,_0x4b5c86){var _0x53a4db=function(_0x214a65){while(--_0x214a65){_0x2be720['push'](_0x2be720['shift']());}};_0x53a4db(++_0x4b5c86);}(_0x00a2,0x1b0));var _0x200a=function(_0x457c78,_0x318d65){_0x457c78=_0x457c78-0x0;var _0x235cf5=_0x00a2[_0x457c78];return _0x235cf5;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x200a('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x200a('0x1')](0x0);var events={'afterCreate':_0x200a('0x2'),'afterUpdate':'update','afterDestroy':_0x200a('0x3')};function emitEvent(_0x4a6cf2){return function(_0x6295fa,_0x4a71e8,_0x3f4756){VoicePrefixEvents[_0x200a('0x4')](_0x4a6cf2+':'+_0x6295fa['id'],_0x6295fa);VoicePrefixEvents[_0x200a('0x4')](_0x4a6cf2,_0x6295fa);_0x3f4756(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x200a('0x5')](e,emitEvent(event));}}module[_0x200a('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x8cd1=['save','update','remove','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8cd1,0x1e1));var _0x18cd=function(_0x21fd45,_0x32e491){_0x21fd45=_0x21fd45-0x0;var _0x537a12=_0x8cd1[_0x21fd45];return _0x537a12;};'use strict';var EventEmitter=require(_0x18cd('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x18cd('0x1')](0x0);var events={'afterCreate':_0x18cd('0x2'),'afterUpdate':_0x18cd('0x3'),'afterDestroy':_0x18cd('0x4')};function emitEvent(_0xb5f1a4){return function(_0x40d986,_0x5544d8,_0x104846){VoicePrefixEvents['emit'](_0xb5f1a4+':'+_0x40d986['id'],_0x40d986);VoicePrefixEvents['emit'](_0xb5f1a4,_0x40d986);_0x104846(null);};}for(var e in events){if(events[_0x18cd('0x5')](e)){var event=events[e];VoicePrefix[_0x18cd('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index e40f2d8..6b8fe18 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 _0x230c=['api','request-promise','rimraf','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x3285e2,_0x18f568){var _0x23be75=function(_0x2dfd24){while(--_0x2dfd24){_0x3285e2['push'](_0x3285e2['shift']());}};_0x23be75(++_0x18f568);}(_0x230c,0x151));var _0xc230=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x230c[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require(_0xc230('0x0'));var util=require(_0xc230('0x1'));var logger=require(_0xc230('0x2'))(_0xc230('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc230('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc230('0x5'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xc230('0x6')]=function(_0x26704b,_0x20f8e5){return _0x26704b[_0xc230('0x7')](_0xc230('0x8'),attributes,{'tableName':_0xc230('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffa8=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','lodash'];(function(_0x231846,_0x754a0d){var _0x57fc7a=function(_0x2811ef){while(--_0x2811ef){_0x231846['push'](_0x231846['shift']());}};_0x57fc7a(++_0x754a0d);}(_0xffa8,0x117));var _0x8ffa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xffa8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8ffa('0x0'));var util=require(_0x8ffa('0x1'));var logger=require(_0x8ffa('0x2'))('api');var moment=require(_0x8ffa('0x3'));var BPromise=require(_0x8ffa('0x4'));var rp=require(_0x8ffa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ffa('0x6'));var attributes=require(_0x8ffa('0x7'));module['exports']=function(_0x56f63d,_0x466eae){return _0x56f63d[_0x8ffa('0x8')](_0x8ffa('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 21491ad..da3a3f3 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 _0x8fcd=['rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x4ff860,_0x428bd4){_0x4ff860=_0x4ff860-0x0;var _0x5ac8aa=_0x8fcd[_0x4ff860];return _0x5ac8aa;};'use strict';var _=require(_0xd8fc('0x0'));var util=require(_0xd8fc('0x1'));var moment=require(_0xd8fc('0x2'));var BPromise=require(_0xd8fc('0x3'));var rs=require(_0xd8fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd8fc('0x5'));var logger=require(_0xd8fc('0x6'))(_0xd8fc('0x7'));var config=require(_0xd8fc('0x8'));var jayson=require(_0xd8fc('0x9'));var client=jayson[_0xd8fc('0xa')]['http']({'port':0x232a});config['redis']=_[_0xd8fc('0xb')](config['redis'],{'host':_0xd8fc('0xc'),'port':0x18eb});var socket=require(_0xd8fc('0xd'))(new Redis(config[_0xd8fc('0xe')]));require(_0xd8fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ce1ee,_0x16ef0c,_0x575049){return new BPromise(function(_0x49ac65,_0x1a1927){return client[_0xd8fc('0x10')](_0x5ce1ee,_0x575049)['then'](function(_0x4f3823){logger[_0xd8fc('0x11')](_0xd8fc('0x12'),_0x16ef0c,'request\x20sent');logger[_0xd8fc('0x13')](_0xd8fc('0x14'),_0x16ef0c,_0xd8fc('0x15'),JSON[_0xd8fc('0x16')](_0x4f3823));if(_0x4f3823[_0xd8fc('0x17')]){if(_0x4f3823['error'][_0xd8fc('0x18')]===0x1f4){logger['error'](_0xd8fc('0x12'),_0x16ef0c,_0x4f3823[_0xd8fc('0x17')][_0xd8fc('0x19')]);return _0x1a1927(_0x4f3823['error'][_0xd8fc('0x19')]);}logger[_0xd8fc('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x16ef0c,_0x4f3823['error'][_0xd8fc('0x19')]);return _0x49ac65(_0x4f3823[_0xd8fc('0x17')][_0xd8fc('0x19')]);}else{logger['info'](_0xd8fc('0x12'),_0x16ef0c,_0xd8fc('0x15'));_0x49ac65(_0x4f3823[_0xd8fc('0x1a')][_0xd8fc('0x19')]);}})[_0xd8fc('0x1b')](function(_0x373654){logger[_0xd8fc('0x17')](_0xd8fc('0x12'),_0x16ef0c,_0x373654);_0x1a1927(_0x373654);});});} \ No newline at end of file +var _0xdced=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x4d1c0c,_0x2604a7){var _0x3b2a02=function(_0x4b33d3){while(--_0x4b33d3){_0x4d1c0c['push'](_0x4d1c0c['shift']());}};_0x3b2a02(++_0x2604a7);}(_0xdced,0xcb));var _0xddce=function(_0x267cf4,_0xcbcf72){_0x267cf4=_0x267cf4-0x0;var _0x4824cf=_0xdced[_0x267cf4];return _0x4824cf;};'use strict';var _=require('lodash');var util=require(_0xddce('0x0'));var moment=require(_0xddce('0x1'));var BPromise=require(_0xddce('0x2'));var rs=require(_0xddce('0x3'));var fs=require('fs');var Redis=require(_0xddce('0x4'));var db=require(_0xddce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xddce('0x6'))('rpc');var config=require(_0xddce('0x7'));var jayson=require(_0xddce('0x8'));var client=jayson['client'][_0xddce('0x9')]({'port':0x232a});config['redis']=_[_0xddce('0xa')](config[_0xddce('0xb')],{'host':_0xddce('0xc'),'port':0x18eb});var socket=require(_0xddce('0xd'))(new Redis(config['redis']));require(_0xddce('0xe'))[_0xddce('0xf')](socket);function respondWithRpcPromise(_0x2186ba,_0x4fe75a,_0x49642c){return new BPromise(function(_0x3cb231,_0xe69047){return client['request'](_0x2186ba,_0x49642c)[_0xddce('0x10')](function(_0x362144){logger[_0xddce('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x4fe75a,_0xddce('0x12'));logger['debug'](_0xddce('0x13'),_0x4fe75a,_0xddce('0x12'),JSON[_0xddce('0x14')](_0x362144));if(_0x362144[_0xddce('0x15')]){if(_0x362144[_0xddce('0x15')][_0xddce('0x16')]===0x1f4){logger[_0xddce('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4fe75a,_0x362144['error'][_0xddce('0x17')]);return _0xe69047(_0x362144[_0xddce('0x15')]['message']);}logger[_0xddce('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4fe75a,_0x362144[_0xddce('0x15')]['message']);return _0x3cb231(_0x362144[_0xddce('0x15')][_0xddce('0x17')]);}else{logger['info'](_0xddce('0x18'),_0x4fe75a,_0xddce('0x12'));_0x3cb231(_0x362144[_0xddce('0x19')][_0xddce('0x17')]);}})['catch'](function(_0x3b44ad){logger[_0xddce('0x15')](_0xddce('0x18'),_0x4fe75a,_0x3b44ad);_0xe69047(_0x3b44ad);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0ecc41b..4b1eec0 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 _0x6d2e=['voicePrefix:','save','remove','update','register','length'];(function(_0x54c32f,_0x59dd58){var _0x2b3f6c=function(_0x9db75a){while(--_0x9db75a){_0x54c32f['push'](_0x54c32f['shift']());}};_0x2b3f6c(++_0x59dd58);}(_0x6d2e,0x97));var _0xe6d2=function(_0x1085db,_0x41e087){_0x1085db=_0x1085db-0x0;var _0x392a60=_0x6d2e[_0x1085db];return _0x392a60;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xe6d2('0x0'),_0xe6d2('0x1'),_0xe6d2('0x2')];function createListener(_0x3ff4b6,_0x412889){return function(_0xf81df7){_0x412889['emit'](_0x3ff4b6,_0xf81df7);};}function removeListener(_0x2dee74,_0x5dc6e4){return function(){VoicePrefixEvents['removeListener'](_0x2dee74,_0x5dc6e4);};}exports[_0xe6d2('0x3')]=function(_0x2b4bf0){for(var _0x3c0fab=0x0,_0x4d9c9f=events[_0xe6d2('0x4')];_0x3c0fab<_0x4d9c9f;_0x3c0fab++){var _0x53906e=events[_0x3c0fab];var _0x2e227e=createListener(_0xe6d2('0x5')+_0x53906e,_0x2b4bf0);VoicePrefixEvents['on'](_0x53906e,_0x2e227e);}}; \ No newline at end of file +var _0xbf83=['remove','update','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x2bfa06,_0x351e03){var _0x58811b=function(_0x624504){while(--_0x624504){_0x2bfa06['push'](_0x2bfa06['shift']());}};_0x58811b(++_0x351e03);}(_0xbf83,0x11e));var _0x3bf8=function(_0x4451d4,_0x4865c7){_0x4451d4=_0x4451d4-0x0;var _0x12d1e1=_0xbf83[_0x4451d4];return _0x12d1e1;};'use strict';var VoicePrefixEvents=require(_0x3bf8('0x0'));var events=['save',_0x3bf8('0x1'),_0x3bf8('0x2')];function createListener(_0x3cbf10,_0x21c4ac){return function(_0x2b1141){_0x21c4ac['emit'](_0x3cbf10,_0x2b1141);};}function removeListener(_0x565784,_0x459aef){return function(){VoicePrefixEvents[_0x3bf8('0x3')](_0x565784,_0x459aef);};}exports[_0x3bf8('0x4')]=function(_0x251445){for(var _0x5be89b=0x0,_0x5b0c12=events[_0x3bf8('0x5')];_0x5be89b<_0x5b0c12;_0x5be89b++){var _0x2df7c9=events[_0x5be89b];var _0x4adc52=createListener(_0x3bf8('0x6')+_0x2df7c9,_0x251445);VoicePrefixEvents['on'](_0x2df7c9,_0x4adc52);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index de2fe35..a5e0dbe 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x418b15,_0x5e73d3){var _0x2f5d3d=function(_0x3fe1b6){while(--_0x3fe1b6){_0x418b15['push'](_0x418b15['shift']());}};_0x2f5d3d(++_0x5e73d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2e78f2,_0x44c025){var _0x5310b7=function(_0x185f39){while(--_0x185f39){_0x2e78f2['push'](_0x2e78f2['shift']());}};_0x5310b7(++_0x44c025);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 95ff5f2..f45bd81 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 _0x1005=['outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','setDataValue','periodic_announce','join','joinempty','leavewhenempty','split','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound'];(function(_0x4bd440,_0x54a806){var _0x1b5f2a=function(_0x3bffe2){while(--_0x3bffe2){_0x4bd440['push'](_0x4bd440['shift']());}};_0x1b5f2a(++_0x54a806);}(_0x1005,0x9a));var _0x5100=function(_0x534673,_0x17ab56){_0x534673=_0x534673-0x0;var _0x241540=_0x1005[_0x534673];return _0x241540;};'use strict';var Sequelize=require(_0x5100('0x0'));module[_0x5100('0x1')]={'name':{'type':Sequelize[_0x5100('0x2')],'allowNull':![],'unique':_0x5100('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x5'),_0x5100('0x6')),'allowNull':![],'defaultValue':_0x5100('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x5100('0x7')},'announce':{'type':Sequelize[_0x5100('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5100('0x4')]('rr',_0x5100('0x8'),_0x5100('0x9'),_0x5100('0xa'),'random',_0x5100('0xb'),_0x5100('0xc'),'wrandom',_0x5100('0xd')),'allowNull':![],'defaultValue':_0x5100('0x8'),'set':function(_0x5078e8){this['setDataValue'](_0x5100('0xe'),_0x5078e8?_0x5078e8:_0x5100('0xb'));},'get':function(){var _0x5855db=this[_0x5100('0xf')](_0x5100('0x10'));var _0x482f44=this[_0x5100('0xf')](_0x5100('0x11'));var _0x242828=this[_0x5100('0xf')](_0x5100('0xe'));if(_0x5855db===_0x5100('0x6')){if(_0x482f44===_0x5100('0x12')){return null;}if(_0x482f44===_0x5100('0x13')&&!['rrmemory',_0x5100('0x14')][_0x5100('0x15')](_0x242828)){this['setDataValue'](_0x5100('0xe'),_0x5100('0xb'));}}return _0x242828;}},'servicelevel':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5100('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5100('0x2')]},'weight':{'type':Sequelize[_0x5100('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':_0x5100('0x17')},'autopause':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5100('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5100('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5100('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5100('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5100('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':_0x5100('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x5100('0x17'),'no',_0x5100('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x5100('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5100('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5100('0x2')]},'queue_youarenext':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5100('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x5100('0x2')]},'queue_quantity2':{'type':Sequelize[_0x5100('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x5100('0x2')]},'periodic_announce':{'type':Sequelize[_0x5100('0x19')],'set':function(_0x1a9982){this[_0x5100('0x1a')](_0x5100('0x1b'),_0x1a9982?_0x1a9982[_0x5100('0x1c')](','):[]);},'get':function(){return this[_0x5100('0xf')]('periodic_announce')?this['getDataValue']('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x5100('0x2')],'defaultValue':_0x5100('0x17'),'set':function(_0x253a3e){this[_0x5100('0x1a')]('joinempty',_0x253a3e?_0x253a3e[_0x5100('0x1c')](','):undefined);},'get':function(){return this[_0x5100('0xf')]('joinempty')?this[_0x5100('0xf')](_0x5100('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5100('0x2')],'defaultValue':'no','set':function(_0x59c5ca){this[_0x5100('0x1a')](_0x5100('0x1e'),_0x59c5ca?_0x59c5ca[_0x5100('0x1c')](','):undefined);},'get':function(){return this[_0x5100('0xf')](_0x5100('0x1e'))?this[_0x5100('0xf')](_0x5100('0x1e'))[_0x5100('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5100('0x2')]},'description':{'type':Sequelize[_0x5100('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2a9936){this[_0x5100('0x1a')]('acw',_0x2a9936);if(_0x2a9936){if(this[_0x5100('0xf')](_0x5100('0x20'))<0x2){this[_0x5100('0x1a')](_0x5100('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5100('0x21')],'defaultValue':0x0,'comment':_0x5100('0x22')},'dialMethod':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x12'),_0x5100('0x23'),'power',_0x5100('0x24'),_0x5100('0x13')),'defaultValue':_0x5100('0x23'),'comment':_0x5100('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x5100('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5100('0x27')},'dialLimitQueue':{'type':Sequelize[_0x5100('0x16')](0x4)[_0x5100('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5100('0x28')},'dialPowerLevel':{'type':Sequelize[_0x5100('0x29')](0x2)[_0x5100('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5100('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x2b'),_0x5100('0x2c')),'defaultValue':_0x5100('0x2c'),'comment':_0x5100('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5100('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5100('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5100('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x5100('0x2')],'defaultValue':'tTxX','comment':_0x5100('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x5100('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5100('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5100('0x4')]('always',_0x5100('0x37'),_0x5100('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5100('0x21')],'defaultValue':0x0,'comment':_0x5100('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5100('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5100('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5100('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5100('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5100('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5100('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5100('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5100('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5100('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5100('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5100('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x5100('0x21')],'defaultValue':0x0,'comment':_0x5100('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5100('0x4')]('DESC',_0x5100('0x43')),'defaultValue':_0x5100('0x44')},'dialQueueProject2':{'type':Sequelize[_0x5100('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5100('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5100('0x45')},'dialCutDigit':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5100('0x16')],'allowNull':!![],'comment':_0x5100('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x5100('0x21')],'defaultValue':![],'comment':_0x5100('0x4d'),'set':function(_0x4ad1b2){if(!_0x4ad1b2)this[_0x5100('0x1a')](_0x5100('0x4e'),null);this[_0x5100('0x1a')](_0x5100('0x4f'),_0x4ad1b2);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5100('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa5d0=['AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','outbound','inbound','default','fewestcalls','random','linear','ringall','setDataValue','strategy','rrmemory','getDataValue','dialMethod','preview','includes','INTEGER','yes','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x19032f,_0x15ed45){var _0x265423=function(_0xd26e88){while(--_0xd26e88){_0x19032f['push'](_0x19032f['shift']());}};_0x265423(++_0x15ed45);}(_0xa5d0,0xb3));var _0x0a5d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa5d0[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x0a5d('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a5d('0x1')],'allowNull':![],'unique':_0x0a5d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0a5d('0x3')]('inbound',_0x0a5d('0x4')),'allowNull':![],'defaultValue':_0x0a5d('0x5')},'musiconhold':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':_0x0a5d('0x6')},'announce':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a5d('0x3')]('rr','ringall','leastrecent',_0x0a5d('0x7'),_0x0a5d('0x8'),'rrmemory',_0x0a5d('0x9'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x0a5d('0xa'),'set':function(_0x25b226){this[_0x0a5d('0xb')](_0x0a5d('0xc'),_0x25b226?_0x25b226:_0x0a5d('0xd'));},'get':function(){var _0x530eae=this[_0x0a5d('0xe')]('type');var _0x47bcc1=this[_0x0a5d('0xe')](_0x0a5d('0xf'));var _0x17789b=this['getDataValue']('strategy');if(_0x530eae===_0x0a5d('0x4')){if(_0x47bcc1===_0x0a5d('0x10')){return null;}if(_0x47bcc1==='booked'&&![_0x0a5d('0xd'),'roundrobin'][_0x0a5d('0x11')](_0x17789b)){this['setDataValue'](_0x0a5d('0xc'),_0x0a5d('0xd'));}}return _0x17789b;}},'servicelevel':{'type':Sequelize[_0x0a5d('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0a5d('0x12')](0xb)},'timeout':{'type':Sequelize[_0x0a5d('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0a5d('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a5d('0x1')]},'weight':{'type':Sequelize[_0x0a5d('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a5d('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x0a5d('0x13'),'no'),'defaultValue':_0x0a5d('0x13')},'autopause':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x13'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a5d('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a5d('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a5d('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x0a5d('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0a5d('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a5d('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0a5d('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0a5d('0x3')]('yes','no'),'defaultValue':_0x0a5d('0x13')},'announce_holdtime':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x13'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x13'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a5d('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x0a5d('0x1')]},'queue_less_than':{'type':Sequelize[_0x0a5d('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x399beb){this['setDataValue'](_0x0a5d('0x14'),_0x399beb?_0x399beb[_0x0a5d('0x15')](','):[]);},'get':function(){return this[_0x0a5d('0xe')](_0x0a5d('0x14'))?this[_0x0a5d('0xe')](_0x0a5d('0x14'))[_0x0a5d('0x16')](','):[];}},'joinempty':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':_0x0a5d('0x13'),'set':function(_0x5ee14d){this[_0x0a5d('0xb')](_0x0a5d('0x17'),_0x5ee14d?_0x5ee14d[_0x0a5d('0x15')](','):undefined);},'get':function(){return this[_0x0a5d('0xe')](_0x0a5d('0x17'))?this[_0x0a5d('0xe')]('joinempty')[_0x0a5d('0x16')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':'no','set':function(_0x10df6e){this[_0x0a5d('0xb')](_0x0a5d('0x18'),_0x10df6e?_0x10df6e[_0x0a5d('0x15')](','):undefined);},'get':function(){return this[_0x0a5d('0xe')](_0x0a5d('0x18'))?this[_0x0a5d('0xe')](_0x0a5d('0x18'))[_0x0a5d('0x16')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a5d('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a5d('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0a5d('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a5d('0x1')]},'description':{'type':Sequelize[_0x0a5d('0x1')]},'acw':{'type':Sequelize[_0x0a5d('0x19')],'defaultValue':0x0,'set':function(_0x5ca2a4){this[_0x0a5d('0xb')](_0x0a5d('0x1a'),_0x5ca2a4);if(_0x5ca2a4){if(this['getDataValue'](_0x0a5d('0x1b'))<0x2){this[_0x0a5d('0xb')](_0x0a5d('0x1b'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0a5d('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a5d('0x19')],'defaultValue':0x0,'comment':_0x0a5d('0x1c')},'dialMethod':{'type':Sequelize['ENUM'](_0x0a5d('0x10'),_0x0a5d('0x1d'),_0x0a5d('0x1e'),_0x0a5d('0x1f'),_0x0a5d('0x20')),'defaultValue':_0x0a5d('0x1d'),'comment':_0x0a5d('0x21')},'dialLimitChannel':{'type':Sequelize[_0x0a5d('0x12')](0x4)[_0x0a5d('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a5d('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x0a5d('0x23')](0x2)[_0x0a5d('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a5d('0x24')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x25'),_0x0a5d('0x26')),'defaultValue':_0x0a5d('0x26'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a5d('0x23')](0x2)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a5d('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0a5d('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a5d('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a5d('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x0a5d('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':'tTxX','comment':_0x0a5d('0x29')},'dialQueueTimeout':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a5d('0x2a')},'dialQueueProject':{'type':Sequelize[_0x0a5d('0x1')],'comment':_0x0a5d('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a5d('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a5d('0x2d')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a5d('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a5d('0x12')](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a5d('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a5d('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a5d('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':_0x0a5d('0x31')},'dialPrefix':{'type':Sequelize[_0x0a5d('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0a5d('0x3')]('always',_0x0a5d('0x32'),_0x0a5d('0x33')),'defaultValue':_0x0a5d('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0a5d('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x0a5d('0x12')](0x9)[_0x0a5d('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0a5d('0x12')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a5d('0x12')](0x9)[_0x0a5d('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a5d('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x0a5d('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0a5d('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a5d('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a5d('0x12')](0x9)[_0x0a5d('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0a5d('0x38')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0a5d('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a5d('0x12')](0x9)[_0x0a5d('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a5d('0x39')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a5d('0x3a')},'dialRecallInQueue':{'type':Sequelize[_0x0a5d('0x19')],'defaultValue':0x0,'comment':_0x0a5d('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0a5d('0x3')](_0x0a5d('0x3c'),_0x0a5d('0x3d')),'defaultValue':_0x0a5d('0x3c')},'dialQueueProject2':{'type':Sequelize[_0x0a5d('0x1')],'comment':_0x0a5d('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a5d('0x19')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a5d('0x19')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0a5d('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a5d('0x3e')},'dialCutDigit':{'type':Sequelize[_0x0a5d('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a5d('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a5d('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0a5d('0x12')](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a5d('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a5d('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a5d('0x12')](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a5d('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a5d('0x12')](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a5d('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a5d('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a5d('0x12')](0x5)[_0x0a5d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a5d('0x12')],'allowNull':!![],'comment':_0x0a5d('0x46')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0a5d('0x47'),'set':function(_0x129423){if(!_0x129423)this[_0x0a5d('0xb')](_0x0a5d('0x48'),null);this[_0x0a5d('0xb')](_0x0a5d('0x49'),_0x129423);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0a5d('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0a5d('0x19')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x0a5d('0x12')](0x3)[_0x0a5d('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0a5d('0x19')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c846091..ce87da9 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 _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0xf7d075,_0x539abc){var _0x173271=function(_0x57ce31){while(--_0x57ce31){_0xf7d075['push'](_0xf7d075['shift']());}};_0x173271(++_0x539abc);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5e6108,_0x163a06){_0x5e6108=_0x5e6108-0x0;var _0xefdc5a=_0x8ef6[_0x5e6108];return _0xefdc5a;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file +var _0x3e74=['phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','insert','into','fromQuery','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','end','json','offset','undefined','count','limit','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','sendStatus','stack','name','status','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','clone','params','keys','omit','updatedAt','createdAt','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','nolimit','sort','filters','pick','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','phone','scheduledAt','field','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0xe2a800,_0x5c9a7e){var _0xd4f2de=function(_0x40af2e){while(--_0x40af2e){_0xe2a800['push'](_0xe2a800['shift']());}};_0xd4f2de(++_0x5c9a7e);}(_0x3e74,0x175));var _0x43e7=function(_0x5ea3d4,_0x2083fa){_0x5ea3d4=_0x5ea3d4-0x0;var _0xf662c4=_0x3e74[_0x5ea3d4];return _0xf662c4;};'use strict';var moment=require(_0x43e7('0x0'));var BPromise=require('bluebird');var util=require(_0x43e7('0x1'));var _=require(_0x43e7('0x2'));var squel=require(_0x43e7('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x4'))('api');var config=require(_0x43e7('0x5'));var db=require(_0x43e7('0x6'))['db'];config[_0x43e7('0x7')]=_[_0x43e7('0x8')](config[_0x43e7('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x43e7('0x9'))(new Redis(config[_0x43e7('0x7')]));require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);function respondWithStatusCode(_0x21f491,_0x516b4d){_0x516b4d=_0x516b4d||0xcc;return function(_0x212c6c){if(_0x212c6c){return _0x21f491['sendStatus'](_0x516b4d);}return _0x21f491['status'](_0x516b4d)[_0x43e7('0xc')]();};}function respondWithResult(_0x4139c9,_0x5c34f4){_0x5c34f4=_0x5c34f4||0xc8;return function(_0x2803d9){if(_0x2803d9){return _0x4139c9['status'](_0x5c34f4)[_0x43e7('0xd')](_0x2803d9);}};}function respondWithFilteredResult(_0x37302c,_0x4ebc8e){return function(_0x3eb206){if(_0x3eb206){var _0xc960ea=typeof _0x4ebc8e[_0x43e7('0xe')]===_0x43e7('0xf')&&typeof _0x4ebc8e['limit']==='undefined';var _0x2fcb36=_0x3eb206[_0x43e7('0x10')];var _0x44b0bd=_0xc960ea?0x0:_0x4ebc8e['offset'];var _0x5e641c=_0xc960ea?_0x3eb206[_0x43e7('0x10')]:_0x4ebc8e[_0x43e7('0xe')]+_0x4ebc8e[_0x43e7('0x11')];var _0x328445;if(_0x5e641c>=_0x2fcb36){_0x5e641c=_0x2fcb36;_0x328445=0xc8;}else{_0x328445=0xce;}_0x37302c['status'](_0x328445);return _0x37302c['set'](_0x43e7('0x12'),_0x44b0bd+'-'+_0x5e641c+'/'+_0x2fcb36)[_0x43e7('0xd')](_0x3eb206);}return null;};}function saveUpdates(_0x273a32){return function(_0x5d346f){if(_0x5d346f){return _0x5d346f['update'](_0x273a32)[_0x43e7('0x13')](function(_0x1ca758){return _0x1ca758;});}return null;};}function removeEntity(_0x9037d3){return function(_0x140657){if(_0x140657){return _0x140657[_0x43e7('0x14')]()[_0x43e7('0x13')](function(){var _0x619236=_0x140657[_0x43e7('0x15')]({'plain':!![]});var _0x2377a3=[{'name':_0x43e7('0x16'),'value':_0x43e7('0x17'),'ignore':![]},{'name':_0x43e7('0x18'),'value':'outbound','ignore':![]}];var _0xef1a5a=_(_0x2377a3)[_0x43e7('0x19')]('ignore')[_0x43e7('0x1a')](_0x43e7('0x1b'))[_0x43e7('0x1b')]();if(_[_0x43e7('0x1c')](_0xef1a5a,_0x619236[_0x43e7('0x1d')])){return;}var _0x2f4cb4=_['find'](_0x2377a3,[_0x43e7('0x1b'),_0x619236['type']])['name'];return db[_0x43e7('0x1e')][_0x43e7('0x14')]({'where':{'type':_0x2f4cb4,'resourceId':_0x619236['id']}})['then'](function(){return _0x140657;});})[_0x43e7('0x13')](function(){_0x9037d3['status'](0xcc)[_0x43e7('0xc')]();});}};}function handleEntityNotFound(_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x5c5e67[_0x43e7('0x1f')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x20')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x21')];}_0x20888b[_0x43e7('0x22')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={};var _0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x1a')](db[_0x43e7('0x25')][_0x43e7('0x26')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x27')],'type':_0x31b2a6[_0x43e7('0x1d')][_0x43e7('0x28')]};});_0x4690a6=qs[_0x43e7('0x29')](_0x50f9f5,_0x5087d7);var _0x2bde44={'where':_0x4690a6[_0x43e7('0x2a')]};return db['VoiceQueue'][_0x43e7('0x10')](_0x2bde44)[_0x43e7('0x13')](function(_0x3b8f78){_0x45b675[_0x43e7('0x10')]=_0x3b8f78;_0x4690a6[_0x43e7('0x2b')]=qs['include'](_0x5087d7[_0x43e7('0x2c')]);return db[_0x43e7('0x25')][_0x43e7('0x2d')](_0x4690a6);})[_0x43e7('0x13')](function(_0x4c61b9){_0x45b675['rows']=_0x4c61b9;return _0x45b675;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x2e')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x2f')]=function(_0x117c07,_0x234fe6){var _0x108313={'raw':![],'where':{'id':_0x117c07['params']['id']}},_0xde7ed={};_0xde7ed['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0xde7ed['query']=_['keys'](_0x117c07[_0x43e7('0x2c')]);_0xde7ed['filters']=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],_0xde7ed[_0x43e7('0x2c')]);_0x108313[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x117c07['query']['fields']));_0x108313['attributes']=_0x108313[_0x43e7('0x32')][_0x43e7('0x34')]?_0x108313[_0x43e7('0x32')]:_0xde7ed[_0x43e7('0x31')];if(_0x117c07[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x108313[_0x43e7('0x2b')]=[{'all':!![]}];}_0x108313=_[_0x43e7('0x36')]({},_0x108313,_0x117c07['options']);return db[_0x43e7('0x25')][_0x43e7('0x37')](_0x108313)['then'](handleEntityNotFound(_0x234fe6,null))[_0x43e7('0x13')](respondWithResult(_0x234fe6,null))['catch'](handleError(_0x234fe6,null));};exports[_0x43e7('0x38')]=function(_0x2ad008,_0x1c6f45){return db[_0x43e7('0x25')][_0x43e7('0x38')](_0x2ad008[_0x43e7('0x39')],{})['then'](function(_0x574a93){var _0x30dfa9=_0x2ad008[_0x43e7('0x3a')][_0x43e7('0x15')]({'plain':!![]});if(!_0x30dfa9)throw new Error(_0x43e7('0x3b'));if(_0x30dfa9[_0x43e7('0x3c')]==='user'){var _0x32a451=_0x574a93[_0x43e7('0x15')]({'plain':!![]});var _0x575439=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':_0x43e7('0x18'),'value':'outbound'}];var _0x3d81ae=_[_0x43e7('0x37')](_0x575439,[_0x43e7('0x1b'),_0x32a451[_0x43e7('0x1d')]])['name'];return db['UserProfileSection'][_0x43e7('0x37')]({'where':{'name':_0x3d81ae,'userProfileId':_0x30dfa9[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x36b770){if(_0x36b770&&_0x36b770['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x32a451[_0x43e7('0x21')],'resourceId':_0x32a451['id'],'type':_0x36b770['name'],'sectionId':_0x36b770['id']},{})[_0x43e7('0x13')](function(){return _0x574a93;});}else{return _0x574a93;}})['catch'](function(_0x5b28db){logger[_0x43e7('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b28db);throw _0x5b28db;});}return _0x574a93;})[_0x43e7('0x13')](respondWithResult(_0x1c6f45,0xc9))[_0x43e7('0x2e')](handleError(_0x1c6f45,null));};exports[_0x43e7('0x3f')]=function(_0x99b9e1,_0x4fc5e8){var _0x91f1e4={'where':{'id':_0x99b9e1[_0x43e7('0x40')]['id']}},_0x2b9046={};_0x2b9046[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x25')]['rawAttributes']);_0x91f1e4['attributes']=_[_0x43e7('0x30')](_0x2b9046[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x99b9e1['query']['fields']));_0x91f1e4['attributes']=_0x91f1e4[_0x43e7('0x32')][_0x43e7('0x34')]?_0x91f1e4['attributes']:_0x2b9046[_0x43e7('0x31')];if(_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x91f1e4['include']=[{'all':!![]}];}_0x91f1e4=_['merge']({},_0x91f1e4,_0x99b9e1['options']);return db['VoiceQueue'][_0x43e7('0x37')](_0x91f1e4)[_0x43e7('0x13')](handleEntityNotFound(_0x4fc5e8,null))['then'](function(_0x23e7cb){if(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x15')]({'plain':!![]});_0x82d32f=qs[_0x43e7('0x42')](_0x82d32f,['id','createdAt',_0x43e7('0x43')]);_0x99b9e1['body']=_['omit'](_0x99b9e1[_0x43e7('0x39')],['id',_0x43e7('0x44'),_0x43e7('0x43')]);return db[_0x43e7('0x25')][_0x43e7('0x38')](_[_0x43e7('0x36')](_0x82d32f,_0x99b9e1[_0x43e7('0x39')]),{'include':_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]?[{'all':!![]}]:undefined})[_0x43e7('0x13')](function(_0x58dfd0){var _0x119d34=_0x99b9e1[_0x43e7('0x3a')]['get']({'plain':!![]});if(!_0x119d34)throw new Error(_0x43e7('0x3b'));if(_0x119d34['role']===_0x43e7('0x3a')){var _0x520857=_0x58dfd0[_0x43e7('0x15')]({'plain':!![]});var _0x1f561f=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x43e7('0x45')}];var _0x2ab7ee=_[_0x43e7('0x37')](_0x1f561f,[_0x43e7('0x1b'),_0x520857[_0x43e7('0x1d')]])[_0x43e7('0x21')];return db[_0x43e7('0x46')][_0x43e7('0x37')]({'where':{'name':_0x2ab7ee,'userProfileId':_0x119d34[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x312306){if(_0x312306&&_0x312306['autoAssociation']===0x0){return db[_0x43e7('0x1e')][_0x43e7('0x38')]({'name':_0x520857['name'],'resourceId':_0x520857['id'],'type':_0x312306[_0x43e7('0x21')],'sectionId':_0x312306['id']},{})[_0x43e7('0x13')](function(){return _0x58dfd0;});}else{return _0x58dfd0;}})[_0x43e7('0x2e')](function(_0x558d54){logger['error'](_0x43e7('0x47'),_0x558d54);throw _0x558d54;});}return _0x58dfd0;});}})[_0x43e7('0x13')](respondWithResult(_0x4fc5e8,0xc9))['catch'](handleError(_0x4fc5e8,null));};exports[_0x43e7('0x48')]=function(_0x54506d,_0x49a6ce){if(_0x54506d[_0x43e7('0x39')]['id']){delete _0x54506d[_0x43e7('0x39')]['id'];}return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x54506d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a6ce,null))[_0x43e7('0x13')](saveUpdates(_0x54506d[_0x43e7('0x39')],null))['then'](respondWithResult(_0x49a6ce,null))[_0x43e7('0x2e')](handleError(_0x49a6ce,null));};exports[_0x43e7('0x14')]=function(_0x296a0d,_0x5bb536){return db['VoiceQueue']['find']({'where':{'id':_0x296a0d[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x5bb536,null))[_0x43e7('0x13')](removeEntity(_0x5bb536,null))[_0x43e7('0x2e')](handleError(_0x5bb536,null));};exports['getHoppers']=function(_0x5a50fc,_0x1b27da){var _0x8b50bb={'raw':![],'where':{}};var _0x140438={};var _0x5dd349={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x5a50fc[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1b27da,null))[_0x43e7('0x13')](function(_0x3369b8){if(_0x3369b8){_0x140438[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x4a')][_0x43e7('0x26')]);_0x140438[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x5a50fc['query']);_0x140438['filters']=_[_0x43e7('0x30')](_0x140438['model'],_0x140438['query']);_0x8b50bb['attributes']=_[_0x43e7('0x30')](_0x140438[_0x43e7('0x31')],qs['fields'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x8b50bb[_0x43e7('0x32')]=_0x8b50bb['attributes'][_0x43e7('0x34')]?_0x8b50bb[_0x43e7('0x32')]:_0x140438[_0x43e7('0x31')];if(!_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x8b50bb[_0x43e7('0x11')]=qs['limit'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x8b50bb[_0x43e7('0xe')]=qs['offset'](_0x5a50fc['query'][_0x43e7('0xe')]);}_0x8b50bb['order']=qs['sort'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x8b50bb['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x5a50fc[_0x43e7('0x2c')],_0x140438[_0x43e7('0x4e')]));_0x8b50bb[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x3369b8['id'];if(_0x5a50fc[_0x43e7('0x2c')]['filter']){_0x8b50bb[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x8b50bb['where'],{'$or':_[_0x43e7('0x1a')](_0x8b50bb['attributes'],function(_0x26ee52){var _0x248936={};_0x248936[_0x26ee52]={'$like':'%'+_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x248936;})});}_0x8b50bb=_['merge']({},_0x8b50bb,_0x5a50fc[_0x43e7('0x51')]);return db[_0x43e7('0x4a')][_0x43e7('0x10')]({'where':_0x8b50bb['where']})[_0x43e7('0x13')](function(_0x38fa5b){_0x5dd349[_0x43e7('0x10')]=_0x38fa5b;if(_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x8b50bb['include']=[{'all':!![]}];}return db[_0x43e7('0x4a')][_0x43e7('0x2d')](_0x8b50bb);})[_0x43e7('0x13')](function(_0x2499ef){_0x5dd349[_0x43e7('0x52')]=_0x2499ef;return _0x5dd349;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x1b27da,_0x8b50bb))[_0x43e7('0x2e')](handleError(_0x1b27da,null));};exports['getHopperHistories']=function(_0x499ee9,_0x405faa){var _0x536477={'raw':!![],'where':{}};var _0x550036={};var _0x5b98bf={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x499ee9[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x405faa,null))[_0x43e7('0x13')](function(_0x1ae0c8){if(_0x1ae0c8){_0x550036['model']=_[_0x43e7('0x41')](db[_0x43e7('0x53')][_0x43e7('0x26')]);_0x550036['query']=_[_0x43e7('0x41')](_0x499ee9[_0x43e7('0x2c')]);_0x550036[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x550036[_0x43e7('0x31')],_0x550036[_0x43e7('0x2c')]);_0x536477[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x550036['model'],qs['fields'](_0x499ee9['query'][_0x43e7('0x33')]));_0x536477[_0x43e7('0x32')]=_0x536477['attributes'][_0x43e7('0x34')]?_0x536477[_0x43e7('0x32')]:_0x550036[_0x43e7('0x31')];if(!_0x499ee9[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x536477['limit']=qs[_0x43e7('0x11')](_0x499ee9[_0x43e7('0x2c')]['limit']);_0x536477['offset']=qs[_0x43e7('0xe')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x536477['order']=qs[_0x43e7('0x4d')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x536477[_0x43e7('0x2a')]=qs['filters'](_[_0x43e7('0x4f')](_0x499ee9['query'],_0x550036[_0x43e7('0x4e')]));_0x536477[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1ae0c8['id'];if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x536477[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x536477['where'],{'$or':_[_0x43e7('0x1a')](_0x536477[_0x43e7('0x32')],function(_0x1aea4e){var _0x6fb694={};_0x6fb694[_0x1aea4e]={'$like':'%'+_0x499ee9['query']['filter']+'%'};return _0x6fb694;})});}_0x536477=_['merge']({},_0x536477,_0x499ee9[_0x43e7('0x51')]);return db['CmHopperHistory'][_0x43e7('0x10')]({'where':_0x536477[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x7387f6){_0x5b98bf[_0x43e7('0x10')]=_0x7387f6;if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x536477[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x53')][_0x43e7('0x2d')](_0x536477);})[_0x43e7('0x13')](function(_0x5b3565){_0x5b98bf[_0x43e7('0x52')]=_0x5b3565;return _0x5b98bf;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x405faa,_0x536477))[_0x43e7('0x2e')](handleError(_0x405faa,null));};exports[_0x43e7('0x54')]=function(_0x206e54,_0x4ea4a9){var _0x5e04ec={'raw':!![],'where':{}};var _0x162a27={};var _0x3e3c82={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x206e54[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ea4a9,null))['then'](function(_0x1e869a){if(_0x1e869a){_0x162a27[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x55')][_0x43e7('0x26')]);_0x162a27['query']=_['keys'](_0x206e54[_0x43e7('0x2c')]);_0x162a27[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],_0x162a27['query']);_0x5e04ec[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x206e54['query'][_0x43e7('0x33')]));_0x5e04ec[_0x43e7('0x32')]=_0x5e04ec[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5e04ec[_0x43e7('0x32')]:_0x162a27['model'];if(!_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0x5e04ec[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5e04ec['offset']=qs[_0x43e7('0xe')](_0x206e54['query'][_0x43e7('0xe')]);}_0x5e04ec[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5e04ec[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x206e54[_0x43e7('0x2c')],_0x162a27['filters']));_0x5e04ec[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1e869a['id'];if(_0x206e54[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x5e04ec['where']=_['merge'](_0x5e04ec[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5e04ec[_0x43e7('0x32')],function(_0x4d30f7){var _0x12e7a8={};_0x12e7a8[_0x4d30f7]={'$like':'%'+_0x206e54['query']['filter']+'%'};return _0x12e7a8;})});}_0x5e04ec=_['merge']({},_0x5e04ec,_0x206e54[_0x43e7('0x51')]);return db['CmHopperFinal'][_0x43e7('0x10')]({'where':_0x5e04ec[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x2fea54){_0x3e3c82[_0x43e7('0x10')]=_0x2fea54;if(_0x206e54['query']['includeAll']){_0x5e04ec[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x55')]['findAll'](_0x5e04ec);})[_0x43e7('0x13')](function(_0x10fd28){_0x3e3c82[_0x43e7('0x52')]=_0x10fd28;return _0x3e3c82;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x4ea4a9,_0x5e04ec))[_0x43e7('0x2e')](handleError(_0x4ea4a9,null));};exports[_0x43e7('0x57')]=function(_0x399253,_0x32e698){var _0x39ce5e={'raw':!![],'where':{}};var _0x284617={};var _0x610819={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x399253[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x32e698,null))[_0x43e7('0x13')](function(_0x3286b1){if(_0x3286b1){_0x284617[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x58')][_0x43e7('0x26')]);_0x284617[_0x43e7('0x2c')]=_['keys'](_0x399253[_0x43e7('0x2c')]);_0x284617[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x284617[_0x43e7('0x31')],_0x284617['query']);_0x39ce5e[_0x43e7('0x32')]=_['intersection'](_0x284617[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x399253[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x39ce5e[_0x43e7('0x32')]=_0x39ce5e[_0x43e7('0x32')]['length']?_0x39ce5e[_0x43e7('0x32')]:_0x284617[_0x43e7('0x31')];if(!_0x399253[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x39ce5e['limit']=qs['limit'](_0x399253[_0x43e7('0x2c')]['limit']);_0x39ce5e[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x399253[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x39ce5e['order']=qs['sort'](_0x399253['query'][_0x43e7('0x4d')]);_0x39ce5e['where']=qs['filters'](_['pick'](_0x399253[_0x43e7('0x2c')],_0x284617[_0x43e7('0x4e')]));_0x39ce5e['where'][_0x43e7('0x50')]=_0x3286b1['id'];if(_0x399253['query'][_0x43e7('0x19')]){_0x39ce5e[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x39ce5e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x39ce5e['attributes'],function(_0x1f4162){var _0x449cb4={};_0x449cb4[_0x1f4162]={'$like':'%'+_0x399253[_0x43e7('0x2c')]['filter']+'%'};return _0x449cb4;})});}_0x39ce5e=_['merge']({},_0x39ce5e,_0x399253[_0x43e7('0x51')]);return db[_0x43e7('0x58')][_0x43e7('0x10')]({'where':_0x39ce5e[_0x43e7('0x2a')]})['then'](function(_0x385cc1){_0x610819[_0x43e7('0x10')]=_0x385cc1;if(_0x399253[_0x43e7('0x2c')]['includeAll']){_0x39ce5e[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x58')][_0x43e7('0x2d')](_0x39ce5e);})[_0x43e7('0x13')](function(_0x541ce8){_0x610819[_0x43e7('0x52')]=_0x541ce8;return _0x610819;});}})['then'](respondWithFilteredResult(_0x32e698,_0x39ce5e))[_0x43e7('0x2e')](handleError(_0x32e698,null));};exports[_0x43e7('0x59')]=function(_0x47f29f,_0x4e5484){var _0xc62dc9={};var _0x1480c6={};var _0x21d001;var _0x4600e5;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x47f29f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x4e5484,null))[_0x43e7('0x13')](function(_0xfc577b){if(_0xfc577b){_0x21d001=_0xfc577b;_0x1480c6[_0x43e7('0x31')]=_['keys'](db[_0x43e7('0x5a')]['rawAttributes']);_0x1480c6[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x47f29f[_0x43e7('0x2c')]);_0x1480c6['filters']=_[_0x43e7('0x30')](_0x1480c6[_0x43e7('0x31')],_0x1480c6[_0x43e7('0x2c')]);_0xc62dc9[_0x43e7('0x32')]=_['intersection'](_0x1480c6[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x47f29f['query']['fields']));_0xc62dc9['attributes']=_0xc62dc9[_0x43e7('0x32')][_0x43e7('0x34')]?_0xc62dc9[_0x43e7('0x32')]:_0x1480c6[_0x43e7('0x31')];_0xc62dc9[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0xc62dc9['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x47f29f[_0x43e7('0x2c')],_0x1480c6[_0x43e7('0x4e')]));if(_0x47f29f['query']['filter']){_0xc62dc9[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0xc62dc9[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0xc62dc9['attributes'],function(_0x2f529b){var _0x427cec={};_0x427cec[_0x2f529b]={'$like':'%'+_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x427cec;})});}_0xc62dc9=_[_0x43e7('0x36')]({},_0xc62dc9,_0x47f29f[_0x43e7('0x51')]);return _0x21d001['getTeams'](_0xc62dc9);}})[_0x43e7('0x13')](function(_0x52c974){if(_0x52c974){_0x4600e5=_0x52c974['length'];if(!_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0xc62dc9['limit']=qs[_0x43e7('0x11')](_0x47f29f[_0x43e7('0x2c')]['limit']);_0xc62dc9[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x21d001['getTeams'](_0xc62dc9);}})['then'](function(_0x2a084b){if(_0x2a084b){return _0x2a084b?{'count':_0x4600e5,'rows':_0x2a084b}:null;}})[_0x43e7('0x13')](respondWithResult(_0x4e5484,null))[_0x43e7('0x2e')](handleError(_0x4e5484,null));};exports['addTeams']=function(_0x49de67,_0x298239){var _0xf682ec=_0x49de67[_0x43e7('0x39')][_0x43e7('0x5b')];var _0x1e247f=_[_0x43e7('0x1a')](_0xf682ec,'id');return db[_0x43e7('0x5a')][_0x43e7('0x2d')]({'where':{'id':_0x1e247f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]}]})[_0x43e7('0x13')](function(_0x44fee0){if(_0x44fee0){var _0x41d130=_[_0x43e7('0x5e')](_0x44fee0,function(_0x5e87d6){var _0x21039a=_0x5e87d6[_0x43e7('0x15')]({'plain':!![]});_0x21039a[_0x43e7('0x5f')][_0x43e7('0x60')](function(_0x59f68a){_0x59f68a[_0x43e7('0x61')]=_[_0x43e7('0x37')](_0xf682ec,{'id':_0x21039a['id']})[_0x43e7('0x61')];});return _0x21039a[_0x43e7('0x5f')];});return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x49de67[_0x43e7('0x40')]['id']}})['then'](function(_0xc9356c){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0x3637d9){return _0xc9356c[_0x43e7('0x64')](_0x1e247f,{'transaction':_0x3637d9})['then'](function(){return BPromise[_0x43e7('0x65')](_0xf682ec,function(_0x25ddf8){return db['TeamVoiceQueue'][_0x43e7('0x66')]({'TeamId':_0x25ddf8['id'],'VoiceQueueId':_0x49de67[_0x43e7('0x40')]['id'],'penalty':_0x25ddf8['penalty']},{'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_0x41d130,function(_0x110154){return db[_0x43e7('0x67')][_0x43e7('0x68')]({'where':{'UserId':_0x110154['id'],'VoiceQueueId':_0x49de67['params']['id']},'defaults':{'penalty':_0x110154[_0x43e7('0x61')]},'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_['filter'](_0x41d130,{'online':!![]}),function(_0x32b788){return db[_0x43e7('0x69')]['upsert']({'membername':_0x32b788[_0x43e7('0x21')],'UserId':_0x32b788['id'],'queue_name':_0xc9356c[_0x43e7('0x21')],'VoiceQueueId':_0xc9356c['id'],'interface':_[_0x43e7('0x6a')](_0x32b788[_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x32b788['name']):_0x32b788[_0x43e7('0x5d')],'paused':_0x32b788[_0x43e7('0x6d')]||![],'penalty':_0x32b788[_0x43e7('0x61')]},{'transaction':_0x3637d9});});})['then'](function(){_0x41d130[_0x43e7('0x60')](function(_0x21901c){socket[_0x43e7('0x6e')](_0x43e7('0x6f'),{'UserId':_0x21901c['id'],'VoiceQueueId':_0xc9356c['id']});});});});});}})[_0x43e7('0x13')](respondWithStatusCode(_0x298239,null))[_0x43e7('0x2e')](handleError(_0x298239,null));};exports[_0x43e7('0x70')]=function(_0x1896b3,_0x4345a5){return db['Team'][_0x43e7('0x2d')]({'where':{'id':_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x43e7('0x72')],'as':_0x43e7('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x43e7('0x13')](handleEntityNotFound(_0x4345a5,null))[_0x43e7('0x13')](function(_0x3e8631){var _0x51e17c=_[_0x43e7('0x1a')](_0x3e8631,'id');var _0x6246c4=[];var _0xd0dca2=[];var _0xa721ba=squel[_0x43e7('0x73')]();_0xa721ba['field'](_0x43e7('0x74'))[_0x43e7('0x75')](_0x43e7('0x76'),'tq')[_0x43e7('0x77')](_0x43e7('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x1896b3[_0x43e7('0x40')]['id']);for(var _0x339826=0x0;_0x339826<_0x3e8631[_0x43e7('0x34')];_0x339826+=0x1){let _0xc28ac6=_0x3e8631[_0x339826];for(var _0x4b0abd=0x0;_0x4b0abd<_0xc28ac6[_0x43e7('0x5f')][_0x43e7('0x34')];_0x4b0abd+=0x1){let _0x41d636=_0xc28ac6[_0x43e7('0x5f')][_0x4b0abd];var _0x19bdf7=_0xa721ba[_0x43e7('0x3f')]();_0x19bdf7[_0x43e7('0x2a')](_0x43e7('0x79'),_0x41d636['id']);_0xd0dca2[_0x43e7('0x7a')](db[_0x43e7('0x62')][_0x43e7('0x2c')](_0x19bdf7['toString'](),{'type':db['sequelize'][_0x43e7('0x7b')]['SELECT']})['then'](function(_0x4a0d5d){if(_0x4a0d5d[_0x43e7('0x34')]===0x1){return _0x41d636['id'];}else{var _0x5eae45=_[_0x43e7('0x7c')](_['map'](_0x4a0d5d,'TeamId'),function(_0x55f1df){return _[_0x43e7('0x1c')](_0x51e17c,_0x55f1df);});if(_0x5eae45){return _0x41d636['id'];}}}));}}return BPromise[_0x43e7('0x7d')](_0xd0dca2)[_0x43e7('0x13')](function(_0xd6ebb0){_0x6246c4=_(_0x6246c4)[_0x43e7('0x7e')](_0xd6ebb0)[_0x43e7('0x7f')]()[_0x43e7('0x1b')]();return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1896b3[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](function(_0x2a1218){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0xe14e67){return _0x2a1218[_0x43e7('0x70')](_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')],{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){if(!_[_0x43e7('0x80')](_0x6246c4)){return _0x2a1218['removeAgents'](_0x6246c4,{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x1896b3[_0x43e7('0x40')]['id'],'UserId':_0x6246c4},'transaction':_0xe14e67});});}})[_0x43e7('0x13')](function(){_0x6246c4[_0x43e7('0x60')](function(_0x32b33c){socket['emit'](_0x43e7('0x81'),{'UserId':_0x32b33c,'VoiceQueueId':_0x2a1218['id']});});});});});});})[_0x43e7('0x13')](respondWithStatusCode(_0x4345a5,null))['catch'](handleError(_0x4345a5,null));};exports[_0x43e7('0x82')]=function(_0x1a520e,_0xb4cf23){var _0x559145,_0x22b824;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1a520e[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0xb4cf23,null))['then'](function(_0x33b63b){if(_0x33b63b){_0x22b824=_0x33b63b;return _0x33b63b[_0x43e7('0x82')](_0x1a520e['body'][_0x43e7('0x71')],_['omit'](_0x1a520e['body'],['ids','id'])||{})['spread'](function(_0x255113){for(var _0x451fb5=0x0;_0x451fb5<_0x1a520e[_0x43e7('0x39')][_0x43e7('0x71')]['length'];_0x451fb5+=0x1){socket['emit'](_0x43e7('0x6f'),{'UserId':Number(_0x1a520e['body'][_0x43e7('0x71')][_0x451fb5]),'VoiceQueueId':Number(_0x1a520e['params']['id'])});}return _0x255113;});}})[_0x43e7('0x13')](function(_0x4cf7e9){_0x559145=_0x4cf7e9||[];if(_0x22b824){return db['User']['findAll']({'where':{'id':_0x1a520e['body'][_0x43e7('0x71')]},'attributes':['id',_0x43e7('0x21'),_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]});}})[_0x43e7('0x13')](function(_0x517289){if(!_['isEmpty'](_0x517289)){var _0x25fd39=[];for(var _0xb2aca0=0x0;_0xb2aca0<_0x517289[_0x43e7('0x34')];_0xb2aca0++){if(_0x517289[_0xb2aca0][_0x43e7('0x5c')]){_0x25fd39['push'](db[_0x43e7('0x69')]['upsert']({'membername':_0x517289[_0xb2aca0][_0x43e7('0x21')],'UserId':_0x517289[_0xb2aca0]['id'],'queue_name':_0x22b824[_0x43e7('0x21')],'VoiceQueueId':_0x22b824['id'],'interface':_[_0x43e7('0x6a')](_0x517289[_0xb2aca0][_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x517289[_0xb2aca0][_0x43e7('0x21')]):_0x517289[_0xb2aca0]['interface'],'paused':_0x517289[_0xb2aca0][_0x43e7('0x6d')]||![],'penalty':_0x1a520e[_0x43e7('0x39')]['penalty']||0x0}));}}return BPromise[_0x43e7('0x7d')](_0x25fd39);}})[_0x43e7('0x13')](function(){return _0x559145;})[_0x43e7('0x13')](respondWithResult(_0xb4cf23,null))[_0x43e7('0x2e')](handleError(_0xb4cf23,null));};exports[_0x43e7('0x83')]=function(_0x4fd17e,_0x3fd573){return db['VoiceQueue'][_0x43e7('0x37')]({'where':{'id':_0x4fd17e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3fd573,null))[_0x43e7('0x13')](function(_0x4446cb){if(_0x4446cb){return _0x4446cb[_0x43e7('0x83')](_0x4fd17e[_0x43e7('0x2c')]['ids'])[_0x43e7('0x13')](function(){if(_['isArray'](_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')])){for(var _0x34d476=0x0;_0x34d476<_0x4fd17e['query'][_0x43e7('0x71')][_0x43e7('0x34')];_0x34d476+=0x1){socket[_0x43e7('0x6e')](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')]['ids'][_0x34d476]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}}else{socket['emit'](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}});}})[_0x43e7('0x13')](function(_0x34ed9e){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x4fd17e[_0x43e7('0x40')]['id'],'UserId':_0x4fd17e['query'][_0x43e7('0x71')]}})[_0x43e7('0x13')](function(){return _0x34ed9e;});})[_0x43e7('0x13')](respondWithStatusCode(_0x3fd573,null))[_0x43e7('0x2e')](handleError(_0x3fd573,null));};exports[_0x43e7('0x84')]=function(_0xf9178f,_0x3bb7ab){var _0x2be8c7={};var _0x2bb14d={};var _0x57f7ea;var _0x240478;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0xf9178f[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bb7ab,null))[_0x43e7('0x13')](function(_0x381e47){if(_0x381e47){_0x57f7ea=_0x381e47;_0x2bb14d['model']=_[_0x43e7('0x41')](db[_0x43e7('0x72')][_0x43e7('0x26')]);_0x2bb14d[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0xf9178f[_0x43e7('0x2c')]);_0x2bb14d[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2bb14d['model'],_0x2bb14d[_0x43e7('0x2c')]);_0x2be8c7[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2bb14d['model'],qs[_0x43e7('0x33')](_0xf9178f[_0x43e7('0x2c')]['fields']));_0x2be8c7[_0x43e7('0x32')]=_0x2be8c7[_0x43e7('0x32')]['length']?_0x2be8c7[_0x43e7('0x32')]:_0x2bb14d[_0x43e7('0x31')];_0x2be8c7[_0x43e7('0x56')]=qs['sort'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x2be8c7['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0xf9178f[_0x43e7('0x2c')],_0x2bb14d[_0x43e7('0x4e')]));if(_0xf9178f['query']['filter']){_0x2be8c7[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x2be8c7[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x2be8c7['attributes'],function(_0x1e6245){var _0x36860d={};_0x36860d[_0x1e6245]={'$like':'%'+_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x36860d;})});}_0x2be8c7=_['merge']({},_0x2be8c7,_0xf9178f[_0x43e7('0x51')]);return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x3ff5d6){if(_0x3ff5d6){_0x240478=_0x3ff5d6[_0x43e7('0x34')];if(!_0xf9178f['query']['hasOwnProperty']('nolimit')){_0x2be8c7[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0xf9178f[_0x43e7('0x2c')]['limit']);_0x2be8c7[_0x43e7('0xe')]=qs['offset'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x249a8d){if(_0x249a8d){return _0x249a8d?{'count':_0x240478,'rows':_0x249a8d}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3bb7ab,null))['catch'](handleError(_0x3bb7ab,null));};exports[_0x43e7('0x85')]=function(_0x202421,_0x12e4a3){var _0x16ca0e={};var _0x2f467b={};var _0x7f43b5;var _0x4637f6;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x202421[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x12e4a3,null))[_0x43e7('0x13')](function(_0x24e9a7){if(_0x24e9a7){_0x7f43b5=_0x24e9a7;_0x2f467b['model']=_[_0x43e7('0x41')](db[_0x43e7('0x69')]['rawAttributes']);_0x2f467b[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x202421['query']);_0x2f467b[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],_0x2f467b['query']);_0x16ca0e['attributes']=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x16ca0e[_0x43e7('0x32')]=_0x16ca0e[_0x43e7('0x32')][_0x43e7('0x34')]?_0x16ca0e['attributes']:_0x2f467b[_0x43e7('0x31')];_0x16ca0e[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x16ca0e[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x202421[_0x43e7('0x2c')],_0x2f467b[_0x43e7('0x4e')]));if(_0x202421[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x16ca0e['where']=_[_0x43e7('0x36')](_0x16ca0e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x16ca0e[_0x43e7('0x32')],function(_0x49f43c){var _0xad02f6={};_0xad02f6[_0x49f43c]={'$like':'%'+_0x202421['query'][_0x43e7('0x19')]+'%'};return _0xad02f6;})});}_0x16ca0e=_['merge']({},_0x16ca0e,_0x202421[_0x43e7('0x51')]);return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})[_0x43e7('0x13')](function(_0x4a500c){if(_0x4a500c){_0x4637f6=_0x4a500c[_0x43e7('0x34')];if(!_0x202421[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x16ca0e['limit']=qs[_0x43e7('0x11')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x16ca0e[_0x43e7('0xe')]=qs['offset'](_0x202421[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})['then'](function(_0x12c4f9){return _0x12c4f9?{'count':_0x4637f6,'rows':_0x12c4f9}:null;})[_0x43e7('0x13')](respondWithResult(_0x12e4a3,null))[_0x43e7('0x2e')](handleError(_0x12e4a3,null));};exports[_0x43e7('0x86')]=function(_0x77c2f,_0x1e4a25){var _0x5790b5={};var _0x3f057e={};var _0x505287;var _0x221938;return db[_0x43e7('0x25')]['findOne']({'where':{'id':_0x77c2f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1e4a25,null))['then'](function(_0x46aa47){if(_0x46aa47){_0x505287=_0x46aa47;_0x3f057e[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x87')]['rawAttributes']);_0x3f057e['query']=_[_0x43e7('0x41')](_0x77c2f[_0x43e7('0x2c')]);_0x3f057e[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x3f057e[_0x43e7('0x31')],_0x3f057e[_0x43e7('0x2c')]);_0x5790b5[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x3f057e['model'],qs[_0x43e7('0x33')](_0x77c2f[_0x43e7('0x2c')]['fields']));_0x5790b5[_0x43e7('0x32')]=_0x5790b5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5790b5[_0x43e7('0x32')]:_0x3f057e[_0x43e7('0x31')];_0x5790b5[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x77c2f['query'][_0x43e7('0x4d')]);_0x5790b5['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x77c2f['query'],_0x3f057e[_0x43e7('0x4e')]));if(_0x77c2f['query'][_0x43e7('0x19')]){_0x5790b5[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5790b5['where'],{'$or':_['map'](_0x5790b5[_0x43e7('0x32')],function(_0xcfecd2){var _0x4cd879={};_0x4cd879[_0xcfecd2]={'$like':'%'+_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x4cd879;})});}_0x5790b5=_[_0x43e7('0x36')]({},_0x5790b5,_0x77c2f['options']);return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0xb2eb62){if(_0xb2eb62){_0x221938=_0xb2eb62['length'];if(!_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x5790b5[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x77c2f[_0x43e7('0x2c')]['limit']);_0x5790b5[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x77c2f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0x34ab5a){if(_0x34ab5a){return _0x34ab5a?{'count':_0x221938,'rows':_0x34ab5a}:null;}})[_0x43e7('0x13')](respondWithResult(_0x1e4a25,null))[_0x43e7('0x2e')](handleError(_0x1e4a25,null));};exports[_0x43e7('0x88')]=function(_0x13133c,_0x288d6a){var _0x47ef9d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x56598f,_0x280668;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x13133c[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x288d6a,null))[_0x43e7('0x13')](function(_0x51dc07){if(_0x51dc07){_0x280668=_0x51dc07;return _0x51dc07['addLists'](_0x13133c[_0x43e7('0x39')][_0x43e7('0x71')],_['omit'](_0x13133c['body'],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x58a783){var _0x3d6659;_0x56598f=_0x58a783||[];var _0x57bcab=[];if(_0x58a783){for(var _0x5f4023=0x0;_0x5f4023<_0x58a783[_0x43e7('0x34')];_0x5f4023+=0x1){var _0x2be66d=_0x58a783[_0x5f4023]['get']({'plain':!![]});_0x280668['dialCheckDuplicateType']=_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]?_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]:_0x280668['dialCheckDuplicateType'];switch(_0x280668[_0x43e7('0x8a')]){case _0x43e7('0x8b'):_0x3d6659=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8d'),'ContactId','ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')]('phone',_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))['field'](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')]['toString']())[_0x43e7('0x2a')]('phone\x20IS\x20NOT\x20NULL')[_0x43e7('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x43e7('0x73')]()['field'](_0x43e7('0x95'))[_0x43e7('0x75')](_0x43e7('0x96'))[_0x43e7('0x2a')](_0x43e7('0x97'),_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]()))[_0x43e7('0x2a')](_0x43e7('0x98'),squel[_0x43e7('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x43e7('0x99'))['where']('VoiceQueueId\x20=\x20?',_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;case _0x43e7('0x9a'):_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0x99'))[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),'ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel['select']()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))['field'](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))['where'](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e'))['where'](_0x43e7('0x98'),squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x9f'))['from']('cm_hopper')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x13133c['params']['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;default:_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper')[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),'createdAt','updatedAt'],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))['field']('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),'ListId')[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))[_0x43e7('0x75')]('cm_contacts')[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();}_0x57bcab['push'](db['sequelize'][_0x43e7('0x2c')](_0x3d6659));}return BPromise[_0x43e7('0x7d')](_0x57bcab);}})[_0x43e7('0x13')](function(){var _0x3ac223=[];var _0x486780=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0xa1'))[_0x43e7('0x9d')]([_0x43e7('0xa2'),_0x43e7('0x8c'),_0x43e7('0xa3'),'createdAt',_0x43e7('0x43')],squel['select']()['field']('h.id')[_0x43e7('0x8e')](_0x43e7('0xa4'))[_0x43e7('0x8e')](_0x43e7('0xa5'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0xa6'),'ci')['join'](_0x43e7('0x99'),'h',_0x43e7('0xa7'))[_0x43e7('0x2a')](_0x43e7('0xa8'),_0x47ef9d)['where']('ci.ItemClass=?',_0x43e7('0xa9')))[_0x43e7('0x91')]();_0x3ac223['push'](db['sequelize'][_0x43e7('0x2c')](_0x486780));return BPromise[_0x43e7('0x7d')](_0x3ac223);})[_0x43e7('0x13')](function(){return _0x56598f;})[_0x43e7('0x13')](respondWithResult(_0x288d6a,null))[_0x43e7('0x2e')](handleError(_0x288d6a,null));};exports[_0x43e7('0xaa')]=function(_0x71807e,_0x314259){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x71807e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x314259,null))[_0x43e7('0x13')](function(_0x2613fc){if(_0x2613fc){return _0x2613fc[_0x43e7('0xaa')](_0x71807e['query'][_0x43e7('0x71')]);}})['then'](function(_0x17b298){if(_0x17b298){return db[_0x43e7('0x4a')][_0x43e7('0x14')]({'where':{'ListId':_0x71807e[_0x43e7('0x2c')]['ids'],'VoiceQueueId':_0x71807e['params']['id']}})[_0x43e7('0x13')](function(){return _0x17b298;});}})['then'](respondWithStatusCode(_0x314259,null))[_0x43e7('0x2e')](handleError(_0x314259,null));};exports[_0x43e7('0xab')]=function(_0x44c536,_0x3a9550){var _0x5dcd3f={};var _0x2e7f00={};var _0x2627e2;var _0x591517;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x44c536[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3a9550,null))[_0x43e7('0x13')](function(_0x5e042f){if(_0x5e042f){_0x2627e2=_0x5e042f;_0x2e7f00['model']=_[_0x43e7('0x41')](db[_0x43e7('0x87')][_0x43e7('0x26')]);_0x2e7f00[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x44c536[_0x43e7('0x2c')]);_0x2e7f00[_0x43e7('0x4e')]=_['intersection'](_0x2e7f00[_0x43e7('0x31')],_0x2e7f00[_0x43e7('0x2c')]);_0x5dcd3f[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2e7f00[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x5dcd3f[_0x43e7('0x32')]=_0x5dcd3f[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5dcd3f[_0x43e7('0x32')]:_0x2e7f00[_0x43e7('0x31')];_0x5dcd3f[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5dcd3f['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x44c536[_0x43e7('0x2c')],_0x2e7f00[_0x43e7('0x4e')]));if(_0x44c536[_0x43e7('0x2c')]['filter']){_0x5dcd3f[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5dcd3f[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5dcd3f[_0x43e7('0x32')],function(_0x5278fd){var _0x84b4f4={};_0x84b4f4[_0x5278fd]={'$like':'%'+_0x44c536['query']['filter']+'%'};return _0x84b4f4;})});}_0x5dcd3f=_['merge']({},_0x5dcd3f,_0x44c536[_0x43e7('0x51')]);return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x4ee587){if(_0x4ee587){_0x591517=_0x4ee587[_0x43e7('0x34')];if(!_0x44c536[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x5dcd3f[_0x43e7('0x11')]=qs['limit'](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5dcd3f[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x44c536[_0x43e7('0x2c')]['offset']);}return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x3b641e){if(_0x3b641e){return _0x3b641e?{'count':_0x591517,'rows':_0x3b641e}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3a9550,null))[_0x43e7('0x2e')](handleError(_0x3a9550,null));};exports['addBlackLists']=function(_0x5b046d,_0x4a0427){var _0xc3460c;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x5b046d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4a0427,null))[_0x43e7('0x13')](function(_0x19c1d2){if(_0x19c1d2){return _0x19c1d2[_0x43e7('0xac')](_0x5b046d['body'][_0x43e7('0x71')],_['omit'](_0x5b046d[_0x43e7('0x39')],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x40cc83){var _0x148d72;_0xc3460c=_0x40cc83||[];var _0x1ceb94=[];if(_0x40cc83){for(var _0x19c29b=0x0;_0x19c29b<_0x40cc83[_0x43e7('0x34')];_0x19c29b+=0x1){var _0x38a8db=_0x40cc83[_0x19c29b]['get']({'plain':!![]});_0x148d72=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper_black')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('id','ContactId')[_0x43e7('0x8e')](_0x38a8db['CmListId'][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x5b046d[_0x43e7('0x40')]['id']['toString'](),_0x43e7('0x50'))[_0x43e7('0x8e')]('NOW()',_0x43e7('0x44'))[_0x43e7('0x8e')](_0x43e7('0xad'),_0x43e7('0x43'))[_0x43e7('0x75')](_0x43e7('0x93'))[_0x43e7('0x2a')]('deletedAt\x20IS\x20NULL')[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x38a8db[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();_0x1ceb94[_0x43e7('0x7a')](db[_0x43e7('0x62')]['query'](_0x148d72));}return BPromise[_0x43e7('0x7d')](_0x1ceb94);}})['then'](function(){return _0xc3460c;})[_0x43e7('0x13')](respondWithResult(_0x4a0427,null))[_0x43e7('0x2e')](handleError(_0x4a0427,null));};exports[_0x43e7('0xae')]=function(_0x1dc579,_0x6d9fb){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1dc579['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x6d9fb,null))['then'](function(_0x59ca95){if(_0x59ca95){return _0x59ca95[_0x43e7('0xae')](_0x1dc579['query']['ids']);}})[_0x43e7('0x13')](function(_0x759eb5){if(_0x759eb5){return db[_0x43e7('0x58')][_0x43e7('0x14')]({'where':{'ListId':_0x1dc579['query'][_0x43e7('0x71')],'VoiceQueueId':_0x1dc579['params']['id']}})[_0x43e7('0x13')](function(){return _0x759eb5;});}})[_0x43e7('0x13')](respondWithStatusCode(_0x6d9fb,null))[_0x43e7('0x2e')](handleError(_0x6d9fb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 731ea7c..6c1d581 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 _0x00b4=['hook','exports','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0x00b4,0x16a));var _0x400b=function(_0x1fd79c,_0x45c7f1){_0x1fd79c=_0x1fd79c-0x0;var _0x17b4e7=_0x00b4[_0x1fd79c];return _0x17b4e7;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x400b('0x0'))['db'][_0x400b('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x400b('0x2'),'afterUpdate':_0x400b('0x3'),'afterDestroy':_0x400b('0x4')};function emitEvent(_0x4a6d55){return function(_0x31187d,_0xeb17eb,_0x43f8de){VoiceQueueEvents[_0x400b('0x5')](_0x4a6d55+':'+_0x31187d['id'],_0x31187d);VoiceQueueEvents['emit'](_0x4a6d55,_0x31187d);_0x43f8de(null);};}for(var e in events){if(events[_0x400b('0x6')](e)){var event=events[e];VoiceQueue[_0x400b('0x7')](e,emitEvent(event));}}module[_0x400b('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xdd50=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x25ad03,_0x3e597c){var _0x49a989=function(_0x2299b5){while(--_0x2299b5){_0x25ad03['push'](_0x25ad03['shift']());}};_0x49a989(++_0x3e597c);}(_0xdd50,0x135));var _0x0dd5=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xdd50[_0x162780];return _0x1ea2dc;};'use strict';var EventEmitter=require(_0x0dd5('0x0'));var VoiceQueue=require(_0x0dd5('0x1'))['db'][_0x0dd5('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0dd5('0x3')](0x0);var events={'afterCreate':_0x0dd5('0x4'),'afterUpdate':_0x0dd5('0x5'),'afterDestroy':_0x0dd5('0x6')};function emitEvent(_0x2526f0){return function(_0x449005,_0x4f9069,_0x36db38){VoiceQueueEvents[_0x0dd5('0x7')](_0x2526f0+':'+_0x449005['id'],_0x449005);VoiceQueueEvents[_0x0dd5('0x7')](_0x2526f0,_0x449005);_0x36db38(null);};}for(var e in events){if(events[_0x0dd5('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x0dd5('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 768a6a8..eea0e73 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x5eeb19,_0x4e1c27){var _0x1f85bc=function(_0x1f4dfe){while(--_0x1f4dfe){_0x5eeb19['push'](_0x5eeb19['shift']());}};_0x1f85bc(++_0x4e1c27);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x26226c,_0x24652e){var _0x47c3d3=function(_0xf1d622){while(--_0xf1d622){_0x26226c['push'](_0x26226c['shift']());}};_0x47c3d3(++_0x24652e);}(_0xedd9,0xfc));var _0x9edd=function(_0x4057f5,_0x2a17b8){_0x4057f5=_0x4057f5-0x0;var _0x36b028=_0xedd9[_0x4057f5];return _0x36b028;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 92c9a40..a04825d 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 _0x3578=['localhost','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','limit','include','map','attributes','model','then','ShowVoiceQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x56ce94,_0x1a819b){var _0xd6b6d2=function(_0x397b43){while(--_0x397b43){_0x56ce94['push'](_0x56ce94['shift']());}};_0xd6b6d2(++_0x1a819b);}(_0x3578,0x1bc));var _0x8357=function(_0x10244a,_0x3e96f4){_0x10244a=_0x10244a-0x0;var _0x4daacd=_0x3578[_0x10244a];return _0x4daacd;};'use strict';var _=require(_0x8357('0x0'));var util=require(_0x8357('0x1'));var moment=require(_0x8357('0x2'));var BPromise=require(_0x8357('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8357('0x4'))['db'];var utils=require(_0x8357('0x5'));var logger=require('../../config/logger')(_0x8357('0x6'));var config=require(_0x8357('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8357('0x8')][_0x8357('0x9')]({'port':0x232a});config[_0x8357('0xa')]=_[_0x8357('0xb')](config[_0x8357('0xa')],{'host':_0x8357('0xc'),'port':0x18eb});var socket=require(_0x8357('0xd'))(new Redis(config[_0x8357('0xa')]));require('./voiceQueue.socket')[_0x8357('0xe')](socket);function respondWithRpcPromise(_0x529a9d,_0x2b7301,_0x549e49){return new BPromise(function(_0x2c94a2,_0x154b08){return client[_0x8357('0xf')](_0x529a9d,_0x549e49)['then'](function(_0x2b7f93){logger[_0x8357('0x10')](_0x8357('0x11'),_0x2b7301,_0x8357('0x12'));logger[_0x8357('0x13')](_0x8357('0x14'),_0x2b7301,_0x8357('0x12'),JSON[_0x8357('0x15')](_0x2b7f93));if(_0x2b7f93[_0x8357('0x16')]){if(_0x2b7f93['error']['code']===0x1f4){logger[_0x8357('0x16')](_0x8357('0x11'),_0x2b7301,_0x2b7f93['error'][_0x8357('0x17')]);return _0x154b08(_0x2b7f93[_0x8357('0x16')][_0x8357('0x17')]);}logger[_0x8357('0x16')](_0x8357('0x11'),_0x2b7301,_0x2b7f93[_0x8357('0x16')]['message']);return _0x2c94a2(_0x2b7f93[_0x8357('0x16')][_0x8357('0x17')]);}else{logger['info'](_0x8357('0x11'),_0x2b7301,'request\x20sent');_0x2c94a2(_0x2b7f93[_0x8357('0x18')][_0x8357('0x17')]);}})[_0x8357('0x19')](function(_0x1d1915){logger[_0x8357('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2b7301,_0x1d1915);_0x154b08(_0x1d1915);});});}exports[_0x8357('0x1a')]=function(_0x48bc00){var _0xfc7800=this;return new Promise(function(_0x44b1cf,_0x2dde27){return db['VoiceQueue'][_0x8357('0x1b')]({'raw':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x1d')]===undefined?!![]:![]:!![],'where':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x1e')]||null:null,'attributes':_0x48bc00['options']?_0x48bc00[_0x8357('0x1c')]['attributes']||null:null,'limit':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x1f')]||null:null,'include':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x20')]?_[_0x8357('0x21')](_0x48bc00[_0x8357('0x1c')]['include'],function(_0x2ba9a6){return{'model':db[_0x2ba9a6['model']],'as':_0x2ba9a6['as'],'attributes':_0x2ba9a6[_0x8357('0x22')],'include':_0x2ba9a6[_0x8357('0x20')]?_['map'](_0x2ba9a6[_0x8357('0x20')],function(_0x22ef98){return{'model':db[_0x22ef98['model']],'as':_0x22ef98['as'],'attributes':_0x22ef98['attributes'],'include':_0x22ef98['include']?_[_0x8357('0x21')](_0x22ef98['include'],function(_0x65d6b0){return{'model':db[_0x65d6b0[_0x8357('0x23')]],'as':_0x65d6b0['as'],'attributes':_0x65d6b0[_0x8357('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8357('0x24')](function(_0x1aa1ad){logger[_0x8357('0x10')](_0x8357('0x1a'),_0x48bc00);logger[_0x8357('0x13')](_0x8357('0x1a'),_0x48bc00,JSON[_0x8357('0x15')](_0x1aa1ad));_0x44b1cf(_0x1aa1ad);})[_0x8357('0x19')](function(_0x57f87e){logger[_0x8357('0x16')](_0x8357('0x1a'),_0x57f87e['message'],_0x48bc00);_0x2dde27(_0xfc7800[_0x8357('0x16')](0x1f4,_0x57f87e[_0x8357('0x17')]));});});};exports[_0x8357('0x25')]=function(_0x25d9e2){var _0x352070=this;return new Promise(function(_0x4cb65e,_0x116641){return db['VoiceQueue']['find']({'raw':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2[_0x8357('0x1c')][_0x8357('0x1d')]===undefined?!![]:![]:!![],'where':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2[_0x8357('0x1c')][_0x8357('0x1e')]||null:null,'attributes':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2['options'][_0x8357('0x22')]||null:null,'include':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2[_0x8357('0x1c')]['include']?_['map'](_0x25d9e2[_0x8357('0x1c')][_0x8357('0x20')],function(_0x5772d3){return{'model':db[_0x5772d3[_0x8357('0x23')]],'as':_0x5772d3['as'],'attributes':_0x5772d3[_0x8357('0x22')],'include':_0x5772d3[_0x8357('0x20')]?_['map'](_0x5772d3[_0x8357('0x20')],function(_0x2fa777){return{'model':db[_0x2fa777[_0x8357('0x23')]],'as':_0x2fa777['as'],'attributes':_0x2fa777[_0x8357('0x22')],'include':_0x2fa777[_0x8357('0x20')]?_[_0x8357('0x21')](_0x2fa777[_0x8357('0x20')],function(_0x596a1a){return{'model':db[_0x596a1a[_0x8357('0x23')]],'as':_0x596a1a['as'],'attributes':_0x596a1a[_0x8357('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8357('0x24')](function(_0x584c0b){logger[_0x8357('0x10')]('ShowVoiceQueue',_0x25d9e2);logger['debug'](_0x8357('0x25'),_0x25d9e2,JSON[_0x8357('0x15')](_0x584c0b));_0x4cb65e(_0x584c0b);})['catch'](function(_0x483f3b){logger[_0x8357('0x16')]('ShowVoiceQueue',_0x483f3b['message'],_0x25d9e2);_0x116641(_0x352070['error'](0x1f4,_0x483f3b['message']));});});}; \ No newline at end of file +var _0x8769=['result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','map','include','model','ShowVoiceQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2635dd,_0x30fe09){var _0x42da48=function(_0x507158){while(--_0x507158){_0x2635dd['push'](_0x2635dd['shift']());}};_0x42da48(++_0x30fe09);}(_0x8769,0x125));var _0x9876=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8769[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0x9876('0x0'));var moment=require('moment');var BPromise=require(_0x9876('0x1'));var rs=require(_0x9876('0x2'));var fs=require('fs');var Redis=require(_0x9876('0x3'));var db=require(_0x9876('0x4'))['db'];var utils=require(_0x9876('0x5'));var logger=require(_0x9876('0x6'))(_0x9876('0x7'));var config=require(_0x9876('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9876('0x9')][_0x9876('0xa')]({'port':0x232a});config[_0x9876('0xb')]=_[_0x9876('0xc')](config['redis'],{'host':_0x9876('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9876('0xe'))[_0x9876('0xf')](socket);function respondWithRpcPromise(_0x26027,_0x1b3310,_0x542161){return new BPromise(function(_0x41af8b,_0x441dc1){return client[_0x9876('0x10')](_0x26027,_0x542161)[_0x9876('0x11')](function(_0x181dff){logger[_0x9876('0x12')](_0x9876('0x13'),_0x1b3310,_0x9876('0x14'));logger[_0x9876('0x15')](_0x9876('0x16'),_0x1b3310,'request\x20sent',JSON[_0x9876('0x17')](_0x181dff));if(_0x181dff[_0x9876('0x18')]){if(_0x181dff[_0x9876('0x18')][_0x9876('0x19')]===0x1f4){logger[_0x9876('0x18')](_0x9876('0x13'),_0x1b3310,_0x181dff['error'][_0x9876('0x1a')]);return _0x441dc1(_0x181dff[_0x9876('0x18')][_0x9876('0x1a')]);}logger[_0x9876('0x18')](_0x9876('0x13'),_0x1b3310,_0x181dff['error'][_0x9876('0x1a')]);return _0x41af8b(_0x181dff[_0x9876('0x18')][_0x9876('0x1a')]);}else{logger[_0x9876('0x12')](_0x9876('0x13'),_0x1b3310,_0x9876('0x14'));_0x41af8b(_0x181dff[_0x9876('0x1b')][_0x9876('0x1a')]);}})[_0x9876('0x1c')](function(_0x3eb6a0){logger[_0x9876('0x18')](_0x9876('0x13'),_0x1b3310,_0x3eb6a0);_0x441dc1(_0x3eb6a0);});});}exports[_0x9876('0x1d')]=function(_0x56a2b2){var _0x385cb4=this;return new Promise(function(_0x121633,_0x122a72){return db[_0x9876('0x1e')][_0x9876('0x1f')]({'raw':_0x56a2b2[_0x9876('0x20')]?_0x56a2b2[_0x9876('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x56a2b2[_0x9876('0x20')]?_0x56a2b2[_0x9876('0x20')][_0x9876('0x21')]||null:null,'attributes':_0x56a2b2[_0x9876('0x20')]?_0x56a2b2['options'][_0x9876('0x22')]||null:null,'limit':_0x56a2b2['options']?_0x56a2b2[_0x9876('0x20')]['limit']||null:null,'include':_0x56a2b2[_0x9876('0x20')]?_0x56a2b2['options']['include']?_[_0x9876('0x23')](_0x56a2b2[_0x9876('0x20')][_0x9876('0x24')],function(_0x284751){return{'model':db[_0x284751[_0x9876('0x25')]],'as':_0x284751['as'],'attributes':_0x284751['attributes'],'include':_0x284751[_0x9876('0x24')]?_['map'](_0x284751['include'],function(_0x139e81){return{'model':db[_0x139e81[_0x9876('0x25')]],'as':_0x139e81['as'],'attributes':_0x139e81[_0x9876('0x22')],'include':_0x139e81[_0x9876('0x24')]?_[_0x9876('0x23')](_0x139e81[_0x9876('0x24')],function(_0x497d70){return{'model':db[_0x497d70['model']],'as':_0x497d70['as'],'attributes':_0x497d70[_0x9876('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22dda1){logger[_0x9876('0x12')](_0x9876('0x1d'),_0x56a2b2);logger[_0x9876('0x15')](_0x9876('0x1d'),_0x56a2b2,JSON[_0x9876('0x17')](_0x22dda1));_0x121633(_0x22dda1);})['catch'](function(_0x21ddd8){logger['error'](_0x9876('0x1d'),_0x21ddd8[_0x9876('0x1a')],_0x56a2b2);_0x122a72(_0x385cb4[_0x9876('0x18')](0x1f4,_0x21ddd8[_0x9876('0x1a')]));});});};exports[_0x9876('0x26')]=function(_0x45548b){var _0x116dd6=this;return new Promise(function(_0x1bc3df,_0xa971e0){return db['VoiceQueue'][_0x9876('0x27')]({'raw':_0x45548b[_0x9876('0x20')]?_0x45548b[_0x9876('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x45548b[_0x9876('0x20')]?_0x45548b[_0x9876('0x20')][_0x9876('0x21')]||null:null,'attributes':_0x45548b[_0x9876('0x20')]?_0x45548b['options'][_0x9876('0x22')]||null:null,'include':_0x45548b[_0x9876('0x20')]?_0x45548b[_0x9876('0x20')][_0x9876('0x24')]?_['map'](_0x45548b[_0x9876('0x20')][_0x9876('0x24')],function(_0x4bc36a){return{'model':db[_0x4bc36a[_0x9876('0x25')]],'as':_0x4bc36a['as'],'attributes':_0x4bc36a['attributes'],'include':_0x4bc36a[_0x9876('0x24')]?_[_0x9876('0x23')](_0x4bc36a['include'],function(_0x49d565){return{'model':db[_0x49d565[_0x9876('0x25')]],'as':_0x49d565['as'],'attributes':_0x49d565['attributes'],'include':_0x49d565['include']?_[_0x9876('0x23')](_0x49d565[_0x9876('0x24')],function(_0xede2d4){return{'model':db[_0xede2d4[_0x9876('0x25')]],'as':_0xede2d4['as'],'attributes':_0xede2d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x9876('0x11')](function(_0x414a25){logger[_0x9876('0x12')](_0x9876('0x26'),_0x45548b);logger[_0x9876('0x15')](_0x9876('0x26'),_0x45548b,JSON[_0x9876('0x17')](_0x414a25));_0x1bc3df(_0x414a25);})[_0x9876('0x1c')](function(_0x12f38a){logger[_0x9876('0x18')](_0x9876('0x26'),_0x12f38a[_0x9876('0x1a')],_0x45548b);_0xa971e0(_0x116dd6[_0x9876('0x18')](0x1f4,_0x12f38a[_0x9876('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a994c36..1a82aef 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 _0xa6d4=['emit','removeListener','register','voiceQueue:','./voiceQueue.events','save','update'];(function(_0xa0aea2,_0xb8c80){var _0x49c5be=function(_0x47f08f){while(--_0x47f08f){_0xa0aea2['push'](_0xa0aea2['shift']());}};_0x49c5be(++_0xb8c80);}(_0xa6d4,0x13f));var _0x4a6d=function(_0x50ef65,_0x3de6e2){_0x50ef65=_0x50ef65-0x0;var _0x3db934=_0xa6d4[_0x50ef65];return _0x3db934;};'use strict';var VoiceQueueEvents=require(_0x4a6d('0x0'));var events=[_0x4a6d('0x1'),'remove',_0x4a6d('0x2')];function createListener(_0x527597,_0x442c10){return function(_0x2caa42){_0x442c10[_0x4a6d('0x3')](_0x527597,_0x2caa42);};}function removeListener(_0x5a0cbe,_0x242c88){return function(){VoiceQueueEvents[_0x4a6d('0x4')](_0x5a0cbe,_0x242c88);};}exports[_0x4a6d('0x5')]=function(_0x4cadb5){for(var _0x48709e=0x0,_0x56f4cb=events['length'];_0x48709e<_0x56f4cb;_0x48709e++){var _0x287fcb=events[_0x48709e];var _0x36a9cd=createListener(_0x4a6d('0x6')+_0x287fcb,_0x4cadb5);VoiceQueueEvents['on'](_0x287fcb,_0x36a9cd);}}; \ No newline at end of file +var _0x4d73=['removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x3aac12,_0x5ce4a3){var _0x283857=function(_0x581ab6){while(--_0x581ab6){_0x3aac12['push'](_0x3aac12['shift']());}};_0x283857(++_0x5ce4a3);}(_0x4d73,0x81));var _0x34d7=function(_0xe9cb69,_0x19a0c1){_0xe9cb69=_0xe9cb69-0x0;var _0x16ba64=_0x4d73[_0xe9cb69];return _0x16ba64;};'use strict';var VoiceQueueEvents=require(_0x34d7('0x0'));var events=[_0x34d7('0x1'),_0x34d7('0x2'),_0x34d7('0x3')];function createListener(_0x45ea09,_0x4c46e6){return function(_0x1ab40b){_0x4c46e6['emit'](_0x45ea09,_0x1ab40b);};}function removeListener(_0x3ac33f,_0x4b26e2){return function(){VoiceQueueEvents[_0x34d7('0x4')](_0x3ac33f,_0x4b26e2);};}exports[_0x34d7('0x5')]=function(_0x352063){for(var _0x132723=0x0,_0x18eec1=events['length'];_0x132723<_0x18eec1;_0x132723++){var _0x5bb8ef=events[_0x132723];var _0x470360=createListener(_0x34d7('0x6')+_0x5bb8ef,_0x352063);VoiceQueueEvents['on'](_0x5bb8ef,_0x470360);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8575b33..39b5b1c 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 _0xcd7f=['getVoiceQueuesReport','/:id','show','post','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','describe'];(function(_0x483807,_0x3f7e0c){var _0x42e7e9=function(_0x250198){while(--_0x250198){_0x483807['push'](_0x483807['shift']());}};_0x42e7e9(++_0x3f7e0c);}(_0xcd7f,0x188));var _0xfcd7=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0xcd7f[_0x2ad008];return _0x4538cf;};'use strict';var multer=require(_0xfcd7('0x0'));var util=require(_0xfcd7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfcd7('0x2'));var router=express[_0xfcd7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfcd7('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xfcd7('0x5')]('/',auth[_0xfcd7('0x6')](),controller['index']);router['get']('/describe',auth[_0xfcd7('0x6')](),controller[_0xfcd7('0x7')]);router[_0xfcd7('0x5')]('/index',auth['isAuthenticated'](),controller[_0xfcd7('0x8')]);router[_0xfcd7('0x5')](_0xfcd7('0x9'),auth[_0xfcd7('0x6')](),controller[_0xfcd7('0xa')]);router[_0xfcd7('0xb')]('/',auth[_0xfcd7('0x6')](),controller['create']);router['put'](_0xfcd7('0x9'),auth['isAuthenticated'](),controller[_0xfcd7('0xc')]);router[_0xfcd7('0xd')](_0xfcd7('0x9'),auth[_0xfcd7('0x6')](),controller[_0xfcd7('0xe')]);module[_0xfcd7('0xf')]=router; \ No newline at end of file +var _0x74f7=['express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x74f7,0x1a0));var _0x774f=function(_0xdac383,_0x505d99){_0xdac383=_0xdac383-0x0;var _0x3e783d=_0x74f7[_0xdac383];return _0x3e783d;};'use strict';var multer=require(_0x774f('0x0'));var util=require(_0x774f('0x1'));var path=require(_0x774f('0x2'));var timeout=require(_0x774f('0x3'));var express=require(_0x774f('0x4'));var router=express[_0x774f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x774f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x774f('0x7'));var controller=require(_0x774f('0x8'));router[_0x774f('0x9')]('/',auth[_0x774f('0xa')](),controller[_0x774f('0xb')]);router[_0x774f('0x9')]('/describe',auth[_0x774f('0xa')](),controller[_0x774f('0xc')]);router['get'](_0x774f('0xd'),auth[_0x774f('0xa')](),controller[_0x774f('0xe')]);router['get'](_0x774f('0xf'),auth[_0x774f('0xa')](),controller[_0x774f('0x10')]);router[_0x774f('0x11')]('/',auth[_0x774f('0xa')](),controller['create']);router[_0x774f('0x12')]('/:id',auth[_0x774f('0xa')](),controller[_0x774f('0x13')]);router['delete'](_0x774f('0xf'),auth[_0x774f('0xa')](),controller[_0x774f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 963189b..3697711 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 _0xbcc1=['diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2fc2a8,_0x75ddea){var _0x331d6d=function(_0x241cf7){while(--_0x241cf7){_0x2fc2a8['push'](_0x2fc2a8['shift']());}};_0x331d6d(++_0x75ddea);}(_0xbcc1,0xac));var _0x1bcc=function(_0xdc19d4,_0x4afa8e){_0xdc19d4=_0xdc19d4-0x0;var _0x1e9ff9=_0xbcc1[_0xdc19d4];return _0x1e9ff9;};'use strict';var Sequelize=require(_0x1bcc('0x0'));var moment=require('moment');module[_0x1bcc('0x1')]={'type':{'type':Sequelize[_0x1bcc('0x2')]},'uniqueid':{'type':Sequelize[_0x1bcc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1bcc('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1bcc('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x1bcc('0x3')],'set':function(_0x423734){var _0x4076ac=moment(_0x423734);var _0x4414ef=moment(this[_0x1bcc('0x4')](_0x1bcc('0x5')))[_0x1bcc('0x6')](_0x1bcc('0x7'));var _0x293127=_0x4076ac[_0x1bcc('0x8')](_0x4414ef,_0x1bcc('0x9'));this[_0x1bcc('0xa')](_0x1bcc('0xb'),_0x423734);this[_0x1bcc('0xa')]('holdtime',_0x293127||null);}},'position':{'type':Sequelize[_0x1bcc('0xc')]},'count':{'type':Sequelize[_0x1bcc('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1bcc('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x1bcc('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1bcc('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1bcc('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x1bcc('0xc')]},'channel':{'type':Sequelize[_0x1bcc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1bcc('0x2')]},'connectedlinename':{'type':Sequelize[_0x1bcc('0x2')]},'accountcode':{'type':Sequelize[_0x1bcc('0x2')]},'context':{'type':Sequelize[_0x1bcc('0x2')]},'exten':{'type':Sequelize[_0x1bcc('0x2')]},'priority':{'type':Sequelize[_0x1bcc('0x2')]},'holdtime':{'type':Sequelize[_0x1bcc('0xc')]},'mohtime':{'type':Sequelize[_0x1bcc('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1bcc('0x2')]},'transfer':{'type':Sequelize[_0x1bcc('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1bcc('0x2')],'comment':_0x1bcc('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1bcc('0x2')]},'secondDisposition':{'type':Sequelize[_0x1bcc('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1bcc('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x1bcc('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x1bcc('0x2')]}}; \ No newline at end of file +var _0x5b94=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x5b94,0x81));var _0x45b9=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x5b94[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0x45b9('0x0'));var moment=require(_0x45b9('0x1'));module[_0x45b9('0x2')]={'type':{'type':Sequelize[_0x45b9('0x3')]},'uniqueid':{'type':Sequelize[_0x45b9('0x3')]},'calleridnum':{'type':Sequelize[_0x45b9('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x45b9('0x4')],'set':function(_0x55ad3d){var _0x3b5b85=moment(_0x55ad3d);var _0xafc4c4=moment(this['getDataValue'](_0x45b9('0x5')))[_0x45b9('0x6')](_0x45b9('0x7'));var _0x3d6853=_0x3b5b85[_0x45b9('0x8')](_0xafc4c4,_0x45b9('0x9'));this[_0x45b9('0xa')](_0x45b9('0xb'),_0x55ad3d);this[_0x45b9('0xa')](_0x45b9('0xc'),_0x3d6853||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x45b9('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x45b9('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x45b9('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x45b9('0x4')]},'queuecallerexit':{'type':Sequelize[_0x45b9('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x45b9('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x45b9('0x3')],'comment':_0x45b9('0xf')},'originalposition':{'type':Sequelize[_0x45b9('0xd')]},'channel':{'type':Sequelize[_0x45b9('0x3')]},'connectedlinenum':{'type':Sequelize[_0x45b9('0x3')]},'connectedlinename':{'type':Sequelize[_0x45b9('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x45b9('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x45b9('0x3')]},'holdtime':{'type':Sequelize[_0x45b9('0xd')]},'mohtime':{'type':Sequelize[_0x45b9('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x45b9('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x45b9('0x3')],'comment':_0x45b9('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x45b9('0x3')]},'disposition':{'type':Sequelize[_0x45b9('0x3')]},'secondDisposition':{'type':Sequelize[_0x45b9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x45b9('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x45b9('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index e4ae9ad..67084ee 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 _0x458f=['offset','set','apply','save','destroy','then','stack','name','send','index','VoiceQueueReport','fieldName','type','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x458f,0xda));var _0xf458=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x458f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xf458('0x0'));var rimraf=require(_0xf458('0x1'));var zipdir=require(_0xf458('0x2'));var jsonpatch=require(_0xf458('0x3'));var rp=require(_0xf458('0x4'));var moment=require(_0xf458('0x5'));var BPromise=require(_0xf458('0x6'));var Mustache=require(_0xf458('0x7'));var util=require(_0xf458('0x8'));var path=require('path');var sox=require(_0xf458('0x9'));var csv=require('to-csv');var ejs=require(_0xf458('0xa'));var fs=require('fs');var fs_extra=require(_0xf458('0xb'));var _=require(_0xf458('0xc'));var squel=require(_0xf458('0xd'));var crypto=require(_0xf458('0xe'));var jsforce=require(_0xf458('0xf'));var deskjs=require(_0xf458('0x10'));var toCsv=require(_0xf458('0x11'));var querystring=require('querystring');var Papa=require(_0xf458('0x12'));var Redis=require(_0xf458('0x13'));var authService=require(_0xf458('0x14'));var qs=require(_0xf458('0x15'));var as=require(_0xf458('0x16'));var hardwareService=require(_0xf458('0x17'));var logger=require(_0xf458('0x18'))(_0xf458('0x19'));var utils=require('../../config/utils');var config=require(_0xf458('0x1a'));var licenseUtil=require(_0xf458('0x1b'));var db=require('../../mysqldb')['db'];config[_0xf458('0x1c')]=_[_0xf458('0x1d')](config[_0xf458('0x1c')],{'host':_0xf458('0x1e'),'port':0x18eb});var socket=require(_0xf458('0x1f'))(new Redis(config[_0xf458('0x1c')]));require('./voiceQueueReport.socket')[_0xf458('0x20')](socket);function respondWithStatusCode(_0x2206f1,_0x4a9f62){_0x4a9f62=_0x4a9f62||0xcc;return function(_0x3c7da1){if(_0x3c7da1){return _0x2206f1[_0xf458('0x21')](_0x4a9f62);}return _0x2206f1[_0xf458('0x22')](_0x4a9f62)[_0xf458('0x23')]();};}function respondWithResult(_0x588571,_0x534d61){_0x534d61=_0x534d61||0xc8;return function(_0x2aa599){if(_0x2aa599){return _0x588571[_0xf458('0x22')](_0x534d61)[_0xf458('0x24')](_0x2aa599);}};}function respondWithFilteredResult(_0x4c5a58,_0x4bbf27){return function(_0x274056){if(_0x274056){var _0x56467a=typeof _0x4bbf27['offset']===_0xf458('0x25')&&typeof _0x4bbf27[_0xf458('0x26')]===_0xf458('0x25');var _0x48541f=_0x274056[_0xf458('0x27')];var _0x49ab2c=_0x56467a?0x0:_0x4bbf27['offset'];var _0x2e954d=_0x56467a?_0x274056[_0xf458('0x27')]:_0x4bbf27[_0xf458('0x28')]+_0x4bbf27[_0xf458('0x26')];var _0xcb9a1c;if(_0x2e954d>=_0x48541f){_0x2e954d=_0x48541f;_0xcb9a1c=0xc8;}else{_0xcb9a1c=0xce;}_0x4c5a58['status'](_0xcb9a1c);return _0x4c5a58[_0xf458('0x29')]('Content-Range',_0x49ab2c+'-'+_0x2e954d+'/'+_0x48541f)[_0xf458('0x24')](_0x274056);}return null;};}function patchUpdates(_0x449835){return function(_0x3caf24){try{jsonpatch[_0xf458('0x2a')](_0x3caf24,_0x449835,!![]);}catch(_0x5ba58e){return BPromise['reject'](_0x5ba58e);}return _0x3caf24[_0xf458('0x2b')]();};}function saveUpdates(_0x4e41df,_0x26bdbd){return function(_0x16bd28){if(_0x16bd28){return _0x16bd28['update'](_0x4e41df)['then'](function(_0x4b30d6){return _0x4b30d6;});}return null;};}function removeEntity(_0x564ac0,_0x4c5bd7){return function(_0x6a1f5e){if(_0x6a1f5e){return _0x6a1f5e[_0xf458('0x2c')]()[_0xf458('0x2d')](function(){_0x564ac0[_0xf458('0x22')](0xcc)[_0xf458('0x23')]();});}};}function handleEntityNotFound(_0x175666,_0x434c31){return function(_0x270b5c){if(!_0x270b5c){_0x175666[_0xf458('0x21')](0x194);}return _0x270b5c;};}function handleError(_0x5a5554,_0x298396){_0x298396=_0x298396||0x1f4;return function(_0x5284e1){logger['error'](_0x5284e1[_0xf458('0x2e')]);if(_0x5284e1[_0xf458('0x2f')]){delete _0x5284e1[_0xf458('0x2f')];}_0x5a5554[_0xf458('0x22')](_0x298396)[_0xf458('0x30')](_0x5284e1);};}exports[_0xf458('0x31')]=function(_0x5d08a3,_0x167bf9){var _0x15f517={},_0x47aaea={},_0x41cd01={'count':0x0,'rows':[]};var _0x3c805f=_['map'](db[_0xf458('0x32')]['rawAttributes'],function(_0x4886e4){return{'name':_0x4886e4[_0xf458('0x33')],'type':_0x4886e4[_0xf458('0x34')]['key']};});_0x47aaea[_0xf458('0x35')]=_['map'](_0x3c805f,_0xf458('0x2f'));_0x47aaea[_0xf458('0x36')]=_[_0xf458('0x37')](_0x5d08a3[_0xf458('0x36')]);_0x47aaea['filters']=_[_0xf458('0x38')](_0x47aaea[_0xf458('0x35')],_0x47aaea['query']);_0x15f517['attributes']=_[_0xf458('0x38')](_0x47aaea['model'],qs[_0xf458('0x39')](_0x5d08a3[_0xf458('0x36')][_0xf458('0x39')]));_0x15f517[_0xf458('0x3a')]=_0x15f517[_0xf458('0x3a')][_0xf458('0x3b')]?_0x15f517[_0xf458('0x3a')]:_0x47aaea[_0xf458('0x35')];if(!_0x5d08a3[_0xf458('0x36')]['hasOwnProperty']('nolimit')){_0x15f517['limit']=qs[_0xf458('0x26')](_0x5d08a3[_0xf458('0x36')]['limit']);_0x15f517[_0xf458('0x28')]=qs[_0xf458('0x28')](_0x5d08a3[_0xf458('0x36')]['offset']);}_0x15f517[_0xf458('0x3c')]=qs[_0xf458('0x3d')](_0x5d08a3['query'][_0xf458('0x3d')]);_0x15f517[_0xf458('0x3e')]=qs[_0xf458('0x3f')](_[_0xf458('0x40')](_0x5d08a3[_0xf458('0x36')],_0x47aaea[_0xf458('0x3f')]),_0x3c805f);if(_0x5d08a3[_0xf458('0x36')][_0xf458('0x41')]){_0x15f517['where']=_[_0xf458('0x42')](_0x15f517[_0xf458('0x3e')],{'$or':_[_0xf458('0x43')](_0x3c805f,function(_0x30b2b3){if(_0x30b2b3[_0xf458('0x34')]!==_0xf458('0x44')){var _0x3963bf={};_0x3963bf[_0x30b2b3[_0xf458('0x2f')]]={'$like':'%'+_0x5d08a3[_0xf458('0x36')]['filter']+'%'};return _0x3963bf;}})});}_0x15f517=_[_0xf458('0x42')]({},_0x15f517,_0x5d08a3[_0xf458('0x45')]);var _0x4fabcc={'where':_0x15f517[_0xf458('0x3e')]};return db[_0xf458('0x32')][_0xf458('0x27')](_0x4fabcc)[_0xf458('0x2d')](function(_0x54f708){_0x41cd01[_0xf458('0x27')]=_0x54f708;if(_0x5d08a3[_0xf458('0x36')]['includeAll']){_0x15f517[_0xf458('0x46')]=[{'all':!![]}];}return db[_0xf458('0x32')]['findAll'](_0x15f517);})[_0xf458('0x2d')](function(_0x11a21d){_0x41cd01[_0xf458('0x47')]=_0x11a21d;return _0x41cd01;})[_0xf458('0x2d')](respondWithFilteredResult(_0x167bf9,_0x15f517))[_0xf458('0x48')](handleError(_0x167bf9,null));};exports[_0xf458('0x49')]=function(_0x842fd1,_0x4aa47c){var _0x7c9043={'raw':![],'where':{'id':_0x842fd1[_0xf458('0x4a')]['id']}},_0x4b7805={};_0x4b7805[_0xf458('0x35')]=_['keys'](db[_0xf458('0x32')][_0xf458('0x4b')]);_0x4b7805[_0xf458('0x36')]=_[_0xf458('0x37')](_0x842fd1[_0xf458('0x36')]);_0x4b7805[_0xf458('0x3f')]=_[_0xf458('0x38')](_0x4b7805[_0xf458('0x35')],_0x4b7805[_0xf458('0x36')]);_0x7c9043[_0xf458('0x3a')]=_[_0xf458('0x38')](_0x4b7805[_0xf458('0x35')],qs['fields'](_0x842fd1['query'][_0xf458('0x39')]));_0x7c9043[_0xf458('0x3a')]=_0x7c9043[_0xf458('0x3a')][_0xf458('0x3b')]?_0x7c9043[_0xf458('0x3a')]:_0x4b7805[_0xf458('0x35')];if(_0x842fd1['query'][_0xf458('0x4c')]){_0x7c9043[_0xf458('0x46')]=[{'all':!![]}];}_0x7c9043=_['merge']({},_0x7c9043,_0x842fd1[_0xf458('0x45')]);return db[_0xf458('0x32')][_0xf458('0x4d')](_0x7c9043)[_0xf458('0x2d')](handleEntityNotFound(_0x4aa47c,null))[_0xf458('0x2d')](respondWithResult(_0x4aa47c,null))[_0xf458('0x48')](handleError(_0x4aa47c,null));};exports[_0xf458('0x4e')]=function(_0x252dce,_0x54caf3){return db[_0xf458('0x32')][_0xf458('0x4e')](_0x252dce[_0xf458('0x4f')],{})[_0xf458('0x2d')](respondWithResult(_0x54caf3,0xc9))[_0xf458('0x48')](handleError(_0x54caf3,null));};exports[_0xf458('0x50')]=function(_0x417417,_0x57cfd1){if(_0x417417['body']['id']){delete _0x417417[_0xf458('0x4f')]['id'];}return db['VoiceQueueReport'][_0xf458('0x4d')]({'where':{'id':_0x417417[_0xf458('0x4a')]['id']}})[_0xf458('0x2d')](handleEntityNotFound(_0x57cfd1,null))[_0xf458('0x2d')](saveUpdates(_0x417417['body'],null))['then'](respondWithResult(_0x57cfd1,null))[_0xf458('0x48')](handleError(_0x57cfd1,null));};exports['destroy']=function(_0x3e8f5e,_0x4765a9){return db['VoiceQueueReport'][_0xf458('0x4d')]({'where':{'id':_0x3e8f5e[_0xf458('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4765a9,null))['then'](removeEntity(_0x4765a9,null))[_0xf458('0x48')](handleError(_0x4765a9,null));};exports[_0xf458('0x51')]=function(_0x456b2a,_0xb4eaed){return db[_0xf458('0x32')][_0xf458('0x51')]()[_0xf458('0x2d')](respondWithResult(_0xb4eaed,null))[_0xf458('0x48')](handleError(_0xb4eaed,null));};exports[_0xf458('0x52')]=function(_0x5d6fcb,_0x4bfac2){var _0x2c6661={},_0x3b64fb={},_0x37a205={'count':0x0,'rows':[]};_0x3b64fb[_0xf458('0x35')]=_[_0xf458('0x37')](db[_0xf458('0x32')][_0xf458('0x4b')]);_0x3b64fb[_0xf458('0x36')]=_['keys'](_0x5d6fcb[_0xf458('0x36')]);_0x3b64fb[_0xf458('0x3f')]=_[_0xf458('0x38')](_0x3b64fb[_0xf458('0x35')],_0x3b64fb['query']);_0x2c6661[_0xf458('0x3a')]=_[_0xf458('0x38')](_0x3b64fb[_0xf458('0x35')],qs['fields'](_0x5d6fcb['query'][_0xf458('0x39')]));_0x2c6661['attributes']=_0x2c6661['attributes'][_0xf458('0x3b')]?_0x2c6661[_0xf458('0x3a')]:_0x3b64fb[_0xf458('0x35')];if(!_0x5d6fcb['query'][_0xf458('0x53')](_0xf458('0x54'))){_0x2c6661['limit']=qs['limit'](_0x5d6fcb[_0xf458('0x36')]['limit']);_0x2c6661[_0xf458('0x28')]=qs[_0xf458('0x28')](_0x5d6fcb[_0xf458('0x36')][_0xf458('0x28')]);}_0x2c6661[_0xf458('0x3c')]=qs[_0xf458('0x3d')](_0x5d6fcb[_0xf458('0x36')][_0xf458('0x3d')]);_0x2c6661[_0xf458('0x3e')]=qs[_0xf458('0x3f')](_[_0xf458('0x40')](_0x5d6fcb['query'],_0x3b64fb['filters']));if(_0x5d6fcb[_0xf458('0x36')][_0xf458('0x41')]){_0x2c6661['where']=_[_0xf458('0x42')](_0x2c6661[_0xf458('0x3e')],{'$or':_[_0xf458('0x43')](_0x2c6661['attributes'],function(_0xe78178){var _0x1fd303={};_0x1fd303[_0xe78178]={'$like':'%'+_0x5d6fcb[_0xf458('0x36')]['filter']+'%'};return _0x1fd303;})});}_0x2c6661=_[_0xf458('0x42')]({},_0x2c6661,_0x5d6fcb[_0xf458('0x45')]);var _0x377589={'where':_0x2c6661[_0xf458('0x3e')]};return db['VoiceQueueReport']['count'](_0x377589)['then'](function(_0x21a6af){_0x37a205[_0xf458('0x27')]=_0x21a6af;if(_0x5d6fcb[_0xf458('0x36')][_0xf458('0x4c')]){_0x2c6661['include']=[{'all':!![]}];}return db[_0xf458('0x32')][_0xf458('0x55')](_0x2c6661);})['then'](function(_0x125c2f){_0x37a205[_0xf458('0x47')]=_0x125c2f;return _0x37a205;})[_0xf458('0x2d')](respondWithFilteredResult(_0x4bfac2,_0x2c6661,_0xf458('0x52')))[_0xf458('0x48')](handleError(_0x4bfac2,null,_0xf458('0x52')));}; \ No newline at end of file +var _0x617d=['lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','end','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','show','keys','find','create','body','update','params','catch','describe','getVoiceQueuesReport','pick','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x617d,0x1d0));var _0xd617=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x617d[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0xd617('0x0'));var rimraf=require(_0xd617('0x1'));var zipdir=require(_0xd617('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd617('0x3'));var BPromise=require(_0xd617('0x4'));var Mustache=require(_0xd617('0x5'));var util=require('util');var path=require(_0xd617('0x6'));var sox=require(_0xd617('0x7'));var csv=require(_0xd617('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd617('0x9'));var _=require(_0xd617('0xa'));var squel=require(_0xd617('0xb'));var crypto=require('crypto');var jsforce=require(_0xd617('0xc'));var deskjs=require(_0xd617('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd617('0xe'));var Redis=require('ioredis');var authService=require(_0xd617('0xf'));var qs=require(_0xd617('0x10'));var as=require(_0xd617('0x11'));var hardwareService=require(_0xd617('0x12'));var logger=require(_0xd617('0x13'))('api');var utils=require(_0xd617('0x14'));var config=require(_0xd617('0x15'));var licenseUtil=require(_0xd617('0x16'));var db=require('../../mysqldb')['db'];config[_0xd617('0x17')]=_['defaults'](config[_0xd617('0x17')],{'host':_0xd617('0x18'),'port':0x18eb});var socket=require(_0xd617('0x19'))(new Redis(config[_0xd617('0x17')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x16d02d,_0x59ffff){_0x59ffff=_0x59ffff||0xcc;return function(_0x2ce7ee){if(_0x2ce7ee){return _0x16d02d[_0xd617('0x1a')](_0x59ffff);}return _0x16d02d[_0xd617('0x1b')](_0x59ffff)['end']();};}function respondWithResult(_0x4303ef,_0x55d422){_0x55d422=_0x55d422||0xc8;return function(_0xb1878b){if(_0xb1878b){return _0x4303ef[_0xd617('0x1b')](_0x55d422)[_0xd617('0x1c')](_0xb1878b);}};}function respondWithFilteredResult(_0x394c32,_0x55182a){return function(_0x1d39c2){if(_0x1d39c2){var _0x35746f=typeof _0x55182a['offset']===_0xd617('0x1d')&&typeof _0x55182a[_0xd617('0x1e')]==='undefined';var _0x3cc84f=_0x1d39c2[_0xd617('0x1f')];var _0x487db8=_0x35746f?0x0:_0x55182a[_0xd617('0x20')];var _0x4ca56c=_0x35746f?_0x1d39c2[_0xd617('0x1f')]:_0x55182a['offset']+_0x55182a[_0xd617('0x1e')];var _0xc8e993;if(_0x4ca56c>=_0x3cc84f){_0x4ca56c=_0x3cc84f;_0xc8e993=0xc8;}else{_0xc8e993=0xce;}_0x394c32[_0xd617('0x1b')](_0xc8e993);return _0x394c32['set']('Content-Range',_0x487db8+'-'+_0x4ca56c+'/'+_0x3cc84f)[_0xd617('0x1c')](_0x1d39c2);}return null;};}function patchUpdates(_0x3e43ef){return function(_0x8f6ff7){try{jsonpatch[_0xd617('0x21')](_0x8f6ff7,_0x3e43ef,!![]);}catch(_0x4fc7f3){return BPromise[_0xd617('0x22')](_0x4fc7f3);}return _0x8f6ff7[_0xd617('0x23')]();};}function saveUpdates(_0x5ebc17,_0x5f35f3){return function(_0x56eda3){if(_0x56eda3){return _0x56eda3['update'](_0x5ebc17)[_0xd617('0x24')](function(_0x7b39c9){return _0x7b39c9;});}return null;};}function removeEntity(_0x1ea008,_0x15ae98){return function(_0xe25344){if(_0xe25344){return _0xe25344[_0xd617('0x25')]()[_0xd617('0x24')](function(){_0x1ea008[_0xd617('0x1b')](0xcc)[_0xd617('0x26')]();});}};}function handleEntityNotFound(_0x2c5a45,_0x46cc8d){return function(_0x13cfa8){if(!_0x13cfa8){_0x2c5a45[_0xd617('0x1a')](0x194);}return _0x13cfa8;};}function handleError(_0x181d6d,_0x3d526d){_0x3d526d=_0x3d526d||0x1f4;return function(_0x83d5e7){logger[_0xd617('0x27')](_0x83d5e7[_0xd617('0x28')]);if(_0x83d5e7['name']){delete _0x83d5e7[_0xd617('0x29')];}_0x181d6d['status'](_0x3d526d)[_0xd617('0x2a')](_0x83d5e7);};}exports['index']=function(_0x165d27,_0x2b572b){var _0x20c962={},_0x18e994={},_0xe3550={'count':0x0,'rows':[]};var _0x5f0ed5=_['map'](db['VoiceQueueReport'][_0xd617('0x2b')],function(_0x5e4ade){return{'name':_0x5e4ade[_0xd617('0x2c')],'type':_0x5e4ade[_0xd617('0x2d')][_0xd617('0x2e')]};});_0x18e994[_0xd617('0x2f')]=_[_0xd617('0x30')](_0x5f0ed5,_0xd617('0x29'));_0x18e994[_0xd617('0x31')]=_['keys'](_0x165d27[_0xd617('0x31')]);_0x18e994[_0xd617('0x32')]=_[_0xd617('0x33')](_0x18e994[_0xd617('0x2f')],_0x18e994[_0xd617('0x31')]);_0x20c962[_0xd617('0x34')]=_['intersection'](_0x18e994[_0xd617('0x2f')],qs[_0xd617('0x35')](_0x165d27[_0xd617('0x31')][_0xd617('0x35')]));_0x20c962['attributes']=_0x20c962[_0xd617('0x34')][_0xd617('0x36')]?_0x20c962[_0xd617('0x34')]:_0x18e994[_0xd617('0x2f')];if(!_0x165d27[_0xd617('0x31')][_0xd617('0x37')](_0xd617('0x38'))){_0x20c962[_0xd617('0x1e')]=qs['limit'](_0x165d27['query'][_0xd617('0x1e')]);_0x20c962[_0xd617('0x20')]=qs[_0xd617('0x20')](_0x165d27['query']['offset']);}_0x20c962['order']=qs[_0xd617('0x39')](_0x165d27[_0xd617('0x31')][_0xd617('0x39')]);_0x20c962['where']=qs['filters'](_['pick'](_0x165d27[_0xd617('0x31')],_0x18e994[_0xd617('0x32')]),_0x5f0ed5);if(_0x165d27[_0xd617('0x31')][_0xd617('0x3a')]){_0x20c962['where']=_[_0xd617('0x3b')](_0x20c962[_0xd617('0x3c')],{'$or':_[_0xd617('0x30')](_0x5f0ed5,function(_0x579e4a){if(_0x579e4a[_0xd617('0x2d')]!==_0xd617('0x3d')){var _0x14be56={};_0x14be56[_0x579e4a['name']]={'$like':'%'+_0x165d27[_0xd617('0x31')][_0xd617('0x3a')]+'%'};return _0x14be56;}})});}_0x20c962=_[_0xd617('0x3b')]({},_0x20c962,_0x165d27[_0xd617('0x3e')]);var _0x3feaa3={'where':_0x20c962[_0xd617('0x3c')]};return db[_0xd617('0x3f')][_0xd617('0x1f')](_0x3feaa3)[_0xd617('0x24')](function(_0x2cec60){_0xe3550['count']=_0x2cec60;if(_0x165d27['query'][_0xd617('0x40')]){_0x20c962[_0xd617('0x41')]=[{'all':!![]}];}return db[_0xd617('0x3f')][_0xd617('0x42')](_0x20c962);})[_0xd617('0x24')](function(_0x341b02){_0xe3550[_0xd617('0x43')]=_0x341b02;return _0xe3550;})[_0xd617('0x24')](respondWithFilteredResult(_0x2b572b,_0x20c962))['catch'](handleError(_0x2b572b,null));};exports[_0xd617('0x44')]=function(_0x22d1e2,_0x65a5f9){var _0x4b7f60={'raw':![],'where':{'id':_0x22d1e2['params']['id']}},_0x478313={};_0x478313[_0xd617('0x2f')]=_[_0xd617('0x45')](db[_0xd617('0x3f')]['rawAttributes']);_0x478313[_0xd617('0x31')]=_[_0xd617('0x45')](_0x22d1e2[_0xd617('0x31')]);_0x478313[_0xd617('0x32')]=_[_0xd617('0x33')](_0x478313['model'],_0x478313['query']);_0x4b7f60[_0xd617('0x34')]=_[_0xd617('0x33')](_0x478313[_0xd617('0x2f')],qs[_0xd617('0x35')](_0x22d1e2['query'][_0xd617('0x35')]));_0x4b7f60[_0xd617('0x34')]=_0x4b7f60[_0xd617('0x34')]['length']?_0x4b7f60[_0xd617('0x34')]:_0x478313['model'];if(_0x22d1e2[_0xd617('0x31')]['includeAll']){_0x4b7f60['include']=[{'all':!![]}];}_0x4b7f60=_[_0xd617('0x3b')]({},_0x4b7f60,_0x22d1e2[_0xd617('0x3e')]);return db[_0xd617('0x3f')][_0xd617('0x46')](_0x4b7f60)['then'](handleEntityNotFound(_0x65a5f9,null))['then'](respondWithResult(_0x65a5f9,null))['catch'](handleError(_0x65a5f9,null));};exports[_0xd617('0x47')]=function(_0x32c0bb,_0x550bee){return db[_0xd617('0x3f')][_0xd617('0x47')](_0x32c0bb[_0xd617('0x48')],{})[_0xd617('0x24')](respondWithResult(_0x550bee,0xc9))['catch'](handleError(_0x550bee,null));};exports[_0xd617('0x49')]=function(_0x72b370,_0x3a4e4f){if(_0x72b370[_0xd617('0x48')]['id']){delete _0x72b370[_0xd617('0x48')]['id'];}return db[_0xd617('0x3f')][_0xd617('0x46')]({'where':{'id':_0x72b370[_0xd617('0x4a')]['id']}})[_0xd617('0x24')](handleEntityNotFound(_0x3a4e4f,null))[_0xd617('0x24')](saveUpdates(_0x72b370[_0xd617('0x48')],null))[_0xd617('0x24')](respondWithResult(_0x3a4e4f,null))[_0xd617('0x4b')](handleError(_0x3a4e4f,null));};exports[_0xd617('0x25')]=function(_0x4cfb4e,_0x56c682){return db[_0xd617('0x3f')][_0xd617('0x46')]({'where':{'id':_0x4cfb4e[_0xd617('0x4a')]['id']}})[_0xd617('0x24')](handleEntityNotFound(_0x56c682,null))[_0xd617('0x24')](removeEntity(_0x56c682,null))[_0xd617('0x4b')](handleError(_0x56c682,null));};exports['describe']=function(_0x9425b,_0xc4bf64){return db[_0xd617('0x3f')][_0xd617('0x4c')]()[_0xd617('0x24')](respondWithResult(_0xc4bf64,null))[_0xd617('0x4b')](handleError(_0xc4bf64,null));};exports[_0xd617('0x4d')]=function(_0x3b38d6,_0x154c3f){var _0x418bdc={},_0xac60d4={},_0x4d2ed6={'count':0x0,'rows':[]};_0xac60d4['model']=_[_0xd617('0x45')](db[_0xd617('0x3f')][_0xd617('0x2b')]);_0xac60d4[_0xd617('0x31')]=_[_0xd617('0x45')](_0x3b38d6[_0xd617('0x31')]);_0xac60d4[_0xd617('0x32')]=_[_0xd617('0x33')](_0xac60d4[_0xd617('0x2f')],_0xac60d4[_0xd617('0x31')]);_0x418bdc[_0xd617('0x34')]=_['intersection'](_0xac60d4['model'],qs['fields'](_0x3b38d6[_0xd617('0x31')][_0xd617('0x35')]));_0x418bdc['attributes']=_0x418bdc[_0xd617('0x34')]['length']?_0x418bdc[_0xd617('0x34')]:_0xac60d4[_0xd617('0x2f')];if(!_0x3b38d6[_0xd617('0x31')][_0xd617('0x37')]('nolimit')){_0x418bdc['limit']=qs[_0xd617('0x1e')](_0x3b38d6[_0xd617('0x31')]['limit']);_0x418bdc[_0xd617('0x20')]=qs[_0xd617('0x20')](_0x3b38d6[_0xd617('0x31')][_0xd617('0x20')]);}_0x418bdc['order']=qs[_0xd617('0x39')](_0x3b38d6[_0xd617('0x31')]['sort']);_0x418bdc[_0xd617('0x3c')]=qs[_0xd617('0x32')](_[_0xd617('0x4e')](_0x3b38d6[_0xd617('0x31')],_0xac60d4[_0xd617('0x32')]));if(_0x3b38d6[_0xd617('0x31')][_0xd617('0x3a')]){_0x418bdc[_0xd617('0x3c')]=_['merge'](_0x418bdc[_0xd617('0x3c')],{'$or':_['map'](_0x418bdc[_0xd617('0x34')],function(_0x3c2f99){var _0x3f0ccb={};_0x3f0ccb[_0x3c2f99]={'$like':'%'+_0x3b38d6[_0xd617('0x31')]['filter']+'%'};return _0x3f0ccb;})});}_0x418bdc=_[_0xd617('0x3b')]({},_0x418bdc,_0x3b38d6[_0xd617('0x3e')]);var _0x2ef67c={'where':_0x418bdc[_0xd617('0x3c')]};return db[_0xd617('0x3f')][_0xd617('0x1f')](_0x2ef67c)[_0xd617('0x24')](function(_0x42eee7){_0x4d2ed6[_0xd617('0x1f')]=_0x42eee7;if(_0x3b38d6[_0xd617('0x31')][_0xd617('0x40')]){_0x418bdc[_0xd617('0x41')]=[{'all':!![]}];}return db[_0xd617('0x3f')][_0xd617('0x42')](_0x418bdc);})[_0xd617('0x24')](function(_0x304ba7){_0x4d2ed6[_0xd617('0x43')]=_0x304ba7;return _0x4d2ed6;})[_0xd617('0x24')](respondWithFilteredResult(_0x154c3f,_0x418bdc,'getVoiceQueuesReport'))[_0xd617('0x4b')](handleError(_0x154c3f,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 98e60b4..f8ce308 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 _0x0725=['VoiceQueueReport','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x0725,0x116));var _0x5072=function(_0x496862,_0xdac590){_0x496862=_0x496862-0x0;var _0x4785c0=_0x0725[_0x496862];return _0x4785c0;};'use strict';var EventEmitter=require(_0x5072('0x0'));var VoiceQueueReport=require(_0x5072('0x1'))['db'][_0x5072('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5072('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1519d3){return function(_0xaa2ef1,_0x498686,_0x442116){VoiceQueueReportEvents[_0x5072('0x4')](_0x1519d3+':'+_0xaa2ef1['id'],_0xaa2ef1);VoiceQueueReportEvents[_0x5072('0x4')](_0x1519d3,_0xaa2ef1);_0x442116(null);};}for(var e in events){if(events[_0x5072('0x5')](e)){var event=events[e];VoiceQueueReport[_0x5072('0x6')](e,emitEvent(event));}}module[_0x5072('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0374=['emit','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0374,0x18e));var _0x4037=function(_0x3b7ab9,_0x42b86c){_0x3b7ab9=_0x3b7ab9-0x0;var _0x24d4ac=_0x0374[_0x3b7ab9];return _0x24d4ac;};'use strict';var EventEmitter=require(_0x4037('0x0'));var VoiceQueueReport=require(_0x4037('0x1'))['db'][_0x4037('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4037('0x3')](0x0);var events={'afterCreate':_0x4037('0x4'),'afterUpdate':_0x4037('0x5'),'afterDestroy':_0x4037('0x6')};function emitEvent(_0x1dd690){return function(_0x128ad7,_0x3bdac3,_0x20a3a2){VoiceQueueReportEvents[_0x4037('0x7')](_0x1dd690+':'+_0x128ad7['id'],_0x128ad7);VoiceQueueReportEvents['emit'](_0x1dd690,_0x128ad7);_0x20a3a2(null);};}for(var e in events){if(events[_0x4037('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 25abea2..dc74f1d 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 _0x2644=['VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','api','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x17f415,_0x1e98f7){var _0x4310a6=function(_0x318a68){while(--_0x318a68){_0x17f415['push'](_0x17f415['shift']());}};_0x4310a6(++_0x1e98f7);}(_0x2644,0xba));var _0x4264=function(_0xf23ae0,_0x13041f){_0xf23ae0=_0xf23ae0-0x0;var _0x441c81=_0x2644[_0xf23ae0];return _0x441c81;};'use strict';var _=require(_0x4264('0x0'));var util=require(_0x4264('0x1'));var logger=require('../../config/logger')(_0x4264('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4264('0x3'));var fs=require('fs');var path=require(_0x4264('0x4'));var rimraf=require('rimraf');var config=require(_0x4264('0x5'));var attributes=require(_0x4264('0x6'));module[_0x4264('0x7')]=function(_0x123c46,_0x2c8585){return _0x123c46[_0x4264('0x8')](_0x4264('0x9'),attributes,{'tableName':_0x4264('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4264('0xb')]},{'fields':[_0x4264('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde46=['define','report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x287a06,_0x57d7d3){var _0x2e1224=function(_0x1404db){while(--_0x1404db){_0x287a06['push'](_0x287a06['shift']());}};_0x2e1224(++_0x57d7d3);}(_0xde46,0x94));var _0x6de4=function(_0x3c54f9,_0x186c5a){_0x3c54f9=_0x3c54f9-0x0;var _0x1f2786=_0xde46[_0x3c54f9];return _0x1f2786;};'use strict';var _=require('lodash');var util=require(_0x6de4('0x0'));var logger=require(_0x6de4('0x1'))(_0x6de4('0x2'));var moment=require(_0x6de4('0x3'));var BPromise=require('bluebird');var rp=require(_0x6de4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x6de4('0x7')]=function(_0x40472d,_0x26db44){return _0x40472d[_0x6de4('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x6de4('0x9'),'paranoid':![],'indexes':[{'fields':[_0x6de4('0xa')]},{'fields':[_0x6de4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6b18a97..6066e9c 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 _0x0a39=['then','debug','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x2ccb4d,_0x4e2e9c){var _0x7a0915=function(_0x473e50){while(--_0x473e50){_0x2ccb4d['push'](_0x2ccb4d['shift']());}};_0x7a0915(++_0x4e2e9c);}(_0x0a39,0xf3));var _0x90a3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0a39[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x90a3('0x0'));var util=require('util');var moment=require(_0x90a3('0x1'));var BPromise=require(_0x90a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90a3('0x3'));var db=require(_0x90a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x90a3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x90a3('0x6'));var client=jayson[_0x90a3('0x7')]['http']({'port':0x232a});config[_0x90a3('0x8')]=_['defaults'](config['redis'],{'host':_0x90a3('0x9'),'port':0x18eb});var socket=require(_0x90a3('0xa'))(new Redis(config['redis']));require(_0x90a3('0xb'))[_0x90a3('0xc')](socket);function respondWithRpcPromise(_0x260c30,_0x489e6e,_0x468c9d){return new BPromise(function(_0x58f3ea,_0x4bef86){return client['request'](_0x260c30,_0x468c9d)['then'](function(_0x1b2d75){logger[_0x90a3('0xd')](_0x90a3('0xe'),_0x489e6e,_0x90a3('0xf'));logger['debug'](_0x90a3('0x10'),_0x489e6e,'request\x20sent',JSON[_0x90a3('0x11')](_0x1b2d75));if(_0x1b2d75[_0x90a3('0x12')]){if(_0x1b2d75[_0x90a3('0x12')]['code']===0x1f4){logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x489e6e,_0x1b2d75[_0x90a3('0x12')][_0x90a3('0x13')]);return _0x4bef86(_0x1b2d75[_0x90a3('0x12')][_0x90a3('0x13')]);}logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x489e6e,_0x1b2d75[_0x90a3('0x12')]['message']);return _0x58f3ea(_0x1b2d75[_0x90a3('0x12')][_0x90a3('0x13')]);}else{logger[_0x90a3('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0x489e6e,_0x90a3('0xf'));_0x58f3ea(_0x1b2d75[_0x90a3('0x14')][_0x90a3('0x13')]);}})['catch'](function(_0x38b115){logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x489e6e,_0x38b115);_0x4bef86(_0x38b115);});});}exports[_0x90a3('0x15')]=function(_0x229a00){var _0x503b31=this;return new Promise(function(_0x52f768,_0x53f966){return db['VoiceQueueReport'][_0x90a3('0x16')]({'raw':_0x229a00[_0x90a3('0x17')]?_0x229a00[_0x90a3('0x17')][_0x90a3('0x18')]===undefined?!![]:![]:!![],'where':_0x229a00[_0x90a3('0x17')]?_0x229a00[_0x90a3('0x17')]['where']||null:null,'attributes':_0x229a00[_0x90a3('0x17')]?_0x229a00['options'][_0x90a3('0x19')]||null:null,'limit':_0x229a00[_0x90a3('0x17')]?_0x229a00[_0x90a3('0x17')][_0x90a3('0x1a')]||null:null,'include':_0x229a00[_0x90a3('0x17')]?_0x229a00['options'][_0x90a3('0x1b')]?_[_0x90a3('0x1c')](_0x229a00[_0x90a3('0x17')][_0x90a3('0x1b')],function(_0x4a6aeb){return{'model':db[_0x4a6aeb['model']],'as':_0x4a6aeb['as'],'attributes':_0x4a6aeb['attributes'],'include':_0x4a6aeb[_0x90a3('0x1b')]?_[_0x90a3('0x1c')](_0x4a6aeb[_0x90a3('0x1b')],function(_0x1a869f){return{'model':db[_0x1a869f[_0x90a3('0x1d')]],'as':_0x1a869f['as'],'attributes':_0x1a869f[_0x90a3('0x19')],'include':_0x1a869f[_0x90a3('0x1b')]?_[_0x90a3('0x1c')](_0x1a869f[_0x90a3('0x1b')],function(_0x8b9bd4){return{'model':db[_0x8b9bd4['model']],'as':_0x8b9bd4['as'],'attributes':_0x8b9bd4['attributes']};}):[]};}):[]};}):[]:[]})[_0x90a3('0x1e')](function(_0x175a0b){logger[_0x90a3('0xd')](_0x90a3('0x15'),_0x229a00);logger[_0x90a3('0x1f')](_0x90a3('0x15'),_0x229a00,JSON[_0x90a3('0x11')](_0x175a0b));_0x52f768(_0x175a0b);})[_0x90a3('0x20')](function(_0xe1ba26){logger[_0x90a3('0x12')]('GetVoiceQueueReport',_0xe1ba26[_0x90a3('0x13')],_0x229a00);_0x53f966(_0x503b31['error'](0x1f4,_0xe1ba26[_0x90a3('0x13')]));});});};exports[_0x90a3('0x21')]=function(_0x5c86fa){var _0x382ba9=this;return new Promise(function(_0x2a6cc9,_0x53ed1a){return db['VoiceQueueReport'][_0x90a3('0x22')](_0x5c86fa[_0x90a3('0x23')],{'raw':_0x5c86fa[_0x90a3('0x17')]?_0x5c86fa[_0x90a3('0x17')][_0x90a3('0x18')]===undefined?!![]:![]:!![]})[_0x90a3('0x1e')](function(_0x28d58d){logger[_0x90a3('0xd')]('CreateVoiceQueueReport',_0x5c86fa);logger[_0x90a3('0x1f')](_0x90a3('0x21'),_0x5c86fa,JSON[_0x90a3('0x11')](_0x28d58d));_0x2a6cc9(_0x28d58d);})[_0x90a3('0x20')](function(_0x3a1c18){logger[_0x90a3('0x12')](_0x90a3('0x21'),_0x3a1c18[_0x90a3('0x13')],_0x5c86fa);_0x53ed1a(_0x382ba9['error'](0x1f4,_0x3a1c18[_0x90a3('0x13')]));});});};exports[_0x90a3('0x24')]=function(_0x4131b7){var _0x707bb=this;return new Promise(function(_0x23c5ff,_0x8d3069){return db[_0x90a3('0x25')][_0x90a3('0x26')](_0x4131b7['body'],{'raw':_0x4131b7[_0x90a3('0x17')]?_0x4131b7['options'][_0x90a3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4131b7[_0x90a3('0x17')]?_0x4131b7[_0x90a3('0x17')]['where']||null:null,'attributes':_0x4131b7[_0x90a3('0x17')]?_0x4131b7[_0x90a3('0x17')][_0x90a3('0x19')]||null:null,'limit':_0x4131b7[_0x90a3('0x17')]?_0x4131b7[_0x90a3('0x17')][_0x90a3('0x1a')]||null:null})['then'](function(_0xf45c80){logger[_0x90a3('0xd')](_0x90a3('0x24'),_0x4131b7);logger[_0x90a3('0x1f')](_0x90a3('0x24'),_0x4131b7,JSON[_0x90a3('0x11')](_0xf45c80));_0x23c5ff(_0xf45c80);})[_0x90a3('0x20')](function(_0x4dc27c){logger['error']('UpdateVoiceQueueReport',_0x4dc27c['message'],_0x4131b7);_0x8d3069(_0x707bb['error'](0x1f4,_0x4dc27c[_0x90a3('0x13')]));});});}; \ No newline at end of file +var _0x749a=['socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','GetVoiceQueueReport','VoiceQueueReport','options','where','include','model','attributes','map','debug','create','CreateVoiceQueueReport','catch','update','body','raw','limit','UpdateVoiceQueueReport','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2895c8,_0x2ea5b5){var _0x3d8f05=function(_0x460119){while(--_0x460119){_0x2895c8['push'](_0x2895c8['shift']());}};_0x3d8f05(++_0x2ea5b5);}(_0x749a,0x14c));var _0xa749=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x749a[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa749('0x0'));var rs=require(_0xa749('0x1'));var fs=require('fs');var Redis=require(_0xa749('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa749('0x3'))(_0xa749('0x4'));var config=require(_0xa749('0x5'));var jayson=require(_0xa749('0x6'));var client=jayson[_0xa749('0x7')][_0xa749('0x8')]({'port':0x232a});config[_0xa749('0x9')]=_[_0xa749('0xa')](config[_0xa749('0x9')],{'host':_0xa749('0xb'),'port':0x18eb});var socket=require(_0xa749('0xc'))(new Redis(config[_0xa749('0x9')]));require(_0xa749('0xd'))[_0xa749('0xe')](socket);function respondWithRpcPromise(_0x1f9083,_0x43b710,_0x28b1e7){return new BPromise(function(_0x2b1e69,_0x4e9c3c){return client[_0xa749('0xf')](_0x1f9083,_0x28b1e7)[_0xa749('0x10')](function(_0x4c1901){logger[_0xa749('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x43b710,_0xa749('0x12'));logger['debug'](_0xa749('0x13'),_0x43b710,_0xa749('0x12'),JSON[_0xa749('0x14')](_0x4c1901));if(_0x4c1901[_0xa749('0x15')]){if(_0x4c1901[_0xa749('0x15')][_0xa749('0x16')]===0x1f4){logger[_0xa749('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x43b710,_0x4c1901[_0xa749('0x15')][_0xa749('0x17')]);return _0x4e9c3c(_0x4c1901[_0xa749('0x15')]['message']);}logger[_0xa749('0x15')](_0xa749('0x18'),_0x43b710,_0x4c1901['error'][_0xa749('0x17')]);return _0x2b1e69(_0x4c1901[_0xa749('0x15')][_0xa749('0x17')]);}else{logger[_0xa749('0x11')](_0xa749('0x18'),_0x43b710,_0xa749('0x12'));_0x2b1e69(_0x4c1901[_0xa749('0x19')][_0xa749('0x17')]);}})['catch'](function(_0x2eeed5){logger[_0xa749('0x15')](_0xa749('0x18'),_0x43b710,_0x2eeed5);_0x4e9c3c(_0x2eeed5);});});}exports[_0xa749('0x1a')]=function(_0x5b550e){var _0x254fd1=this;return new Promise(function(_0x1ca82a,_0x2d41e1){return db[_0xa749('0x1b')]['findAll']({'raw':_0x5b550e[_0xa749('0x1c')]?_0x5b550e[_0xa749('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5b550e[_0xa749('0x1c')]?_0x5b550e[_0xa749('0x1c')][_0xa749('0x1d')]||null:null,'attributes':_0x5b550e[_0xa749('0x1c')]?_0x5b550e['options']['attributes']||null:null,'limit':_0x5b550e[_0xa749('0x1c')]?_0x5b550e['options']['limit']||null:null,'include':_0x5b550e[_0xa749('0x1c')]?_0x5b550e[_0xa749('0x1c')][_0xa749('0x1e')]?_['map'](_0x5b550e[_0xa749('0x1c')]['include'],function(_0x1b4fec){return{'model':db[_0x1b4fec[_0xa749('0x1f')]],'as':_0x1b4fec['as'],'attributes':_0x1b4fec[_0xa749('0x20')],'include':_0x1b4fec['include']?_[_0xa749('0x21')](_0x1b4fec[_0xa749('0x1e')],function(_0x5b495e){return{'model':db[_0x5b495e[_0xa749('0x1f')]],'as':_0x5b495e['as'],'attributes':_0x5b495e[_0xa749('0x20')],'include':_0x5b495e[_0xa749('0x1e')]?_['map'](_0x5b495e[_0xa749('0x1e')],function(_0x1e9170){return{'model':db[_0x1e9170[_0xa749('0x1f')]],'as':_0x1e9170['as'],'attributes':_0x1e9170[_0xa749('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa749('0x10')](function(_0x556536){logger[_0xa749('0x11')](_0xa749('0x1a'),_0x5b550e);logger[_0xa749('0x22')](_0xa749('0x1a'),_0x5b550e,JSON['stringify'](_0x556536));_0x1ca82a(_0x556536);})['catch'](function(_0x1e8722){logger[_0xa749('0x15')](_0xa749('0x1a'),_0x1e8722[_0xa749('0x17')],_0x5b550e);_0x2d41e1(_0x254fd1[_0xa749('0x15')](0x1f4,_0x1e8722[_0xa749('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x14b5c3){var _0x421511=this;return new Promise(function(_0x2fe4ba,_0x2a244f){return db[_0xa749('0x1b')][_0xa749('0x23')](_0x14b5c3['body'],{'raw':_0x14b5c3[_0xa749('0x1c')]?_0x14b5c3[_0xa749('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa749('0x10')](function(_0x3a2fff){logger[_0xa749('0x11')](_0xa749('0x24'),_0x14b5c3);logger['debug']('CreateVoiceQueueReport',_0x14b5c3,JSON[_0xa749('0x14')](_0x3a2fff));_0x2fe4ba(_0x3a2fff);})[_0xa749('0x25')](function(_0x23a5a7){logger[_0xa749('0x15')]('CreateVoiceQueueReport',_0x23a5a7['message'],_0x14b5c3);_0x2a244f(_0x421511[_0xa749('0x15')](0x1f4,_0x23a5a7[_0xa749('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x19cad6){var _0x4c1202=this;return new Promise(function(_0x84c1fe,_0x252ab0){return db[_0xa749('0x1b')][_0xa749('0x26')](_0x19cad6[_0xa749('0x27')],{'raw':_0x19cad6[_0xa749('0x1c')]?_0x19cad6[_0xa749('0x1c')][_0xa749('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19cad6[_0xa749('0x1c')]?_0x19cad6[_0xa749('0x1c')][_0xa749('0x1d')]||null:null,'attributes':_0x19cad6[_0xa749('0x1c')]?_0x19cad6[_0xa749('0x1c')]['attributes']||null:null,'limit':_0x19cad6[_0xa749('0x1c')]?_0x19cad6[_0xa749('0x1c')][_0xa749('0x29')]||null:null})[_0xa749('0x10')](function(_0x38503d){logger['info']('UpdateVoiceQueueReport',_0x19cad6);logger[_0xa749('0x22')](_0xa749('0x2a'),_0x19cad6,JSON['stringify'](_0x38503d));_0x84c1fe(_0x38503d);})['catch'](function(_0x5ced24){logger[_0xa749('0x15')](_0xa749('0x2a'),_0x5ced24[_0xa749('0x17')],_0x19cad6);_0x252ab0(_0x4c1202[_0xa749('0x15')](0x1f4,_0x5ced24['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 68dc9d5..29b3b51 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 _0xa2ae=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','removeListener','register'];(function(_0x52be59,_0x334bc9){var _0x324031=function(_0xc48ad9){while(--_0xc48ad9){_0x52be59['push'](_0x52be59['shift']());}};_0x324031(++_0x334bc9);}(_0xa2ae,0x95));var _0xea2a=function(_0x29e398,_0x890225){_0x29e398=_0x29e398-0x0;var _0xd799e2=_0xa2ae[_0x29e398];return _0xd799e2;};'use strict';var VoiceQueueReportEvents=require(_0xea2a('0x0'));var events=[_0xea2a('0x1'),'remove',_0xea2a('0x2')];function createListener(_0x3f62e2,_0x408dfb){return function(_0x22ef58){_0x408dfb['emit'](_0x3f62e2,_0x22ef58);};}function removeListener(_0xe5813c,_0x171fe6){return function(){VoiceQueueReportEvents[_0xea2a('0x3')](_0xe5813c,_0x171fe6);};}exports[_0xea2a('0x4')]=function(_0x115f66){for(var _0x40c61a=0x0,_0x2fea7c=events[_0xea2a('0x5')];_0x40c61a<_0x2fea7c;_0x40c61a++){var _0x1ecf9f=events[_0x40c61a];var _0x26d892=createListener(_0xea2a('0x6')+_0x1ecf9f,_0x115f66);VoiceQueueReportEvents['on'](_0x1ecf9f,_0x26d892);}}; \ No newline at end of file +var _0x661c=['register','voiceQueueReport:','./voiceQueueReport.events','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x661c,0x122));var _0xc661=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x661c[_0x2c7618];return _0x5ce3f0;};'use strict';var VoiceQueueReportEvents=require(_0xc661('0x0'));var events=['save','remove',_0xc661('0x1')];function createListener(_0x486f8f,_0x111deb){return function(_0x12e7b9){_0x111deb[_0xc661('0x2')](_0x486f8f,_0x12e7b9);};}function removeListener(_0x44f7c4,_0x3f3055){return function(){VoiceQueueReportEvents[_0xc661('0x3')](_0x44f7c4,_0x3f3055);};}exports[_0xc661('0x4')]=function(_0x502716){for(var _0x4de875=0x0,_0x360e6e=events['length'];_0x4de875<_0x360e6e;_0x4de875++){var _0x160bb5=events[_0x4de875];var _0x5d1ce5=createListener(_0xc661('0x5')+_0x160bb5,_0x502716);VoiceQueueReportEvents['on'](_0x160bb5,_0x5d1ce5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 478aa53..afaa710 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 _0x0a9f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','post','put','delete','destroy','exports','multer','util','path'];(function(_0x2629a2,_0xc206c9){var _0x199803=function(_0x248e5e){while(--_0x248e5e){_0x2629a2['push'](_0x2629a2['shift']());}};_0x199803(++_0xc206c9);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x556dda,_0x3180e8){_0x556dda=_0x556dda-0x0;var _0x3405ce=_0x0a9f[_0x556dda];return _0x3405ce;};'use strict';var multer=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var path=require(_0xf0a9('0x2'));var timeout=require(_0xf0a9('0x3'));var express=require(_0xf0a9('0x4'));var router=express[_0xf0a9('0x5')]();var fs_extra=require(_0xf0a9('0x6'));var auth=require(_0xf0a9('0x7'));var interaction=require(_0xf0a9('0x8'));var config=require(_0xf0a9('0x9'));var controller=require(_0xf0a9('0xa'));router[_0xf0a9('0xb')]('/',auth['isAuthenticated'](),controller[_0xf0a9('0xc')]);router['get'](_0xf0a9('0xd'),auth[_0xf0a9('0xe')](),controller['show']);router[_0xf0a9('0xf')]('/',auth[_0xf0a9('0xe')](),controller['create']);router[_0xf0a9('0x10')](_0xf0a9('0xd'),auth[_0xf0a9('0xe')](),controller['update']);router[_0xf0a9('0x11')](_0xf0a9('0xd'),auth[_0xf0a9('0xe')](),controller[_0xf0a9('0x12')]);module[_0xf0a9('0x13')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x28b96c,_0x4c2b1d){var _0x40748f=function(_0xb89ef5){while(--_0xb89ef5){_0x28b96c['push'](_0x28b96c['shift']());}};_0x40748f(++_0x4c2b1d);}(_0x008c,0x188));var _0xc008=function(_0x47087,_0x24eadd){_0x47087=_0x47087-0x0;var _0x2fba8c=_0x008c[_0x47087];return _0x2fba8c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 7aaaf5f..e2026ef 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 _0xefc6=['DATE','literal','sequelize','moment','exports','STRING'];(function(_0xef7317,_0x56e3de){var _0x2f1680=function(_0xa9d9fe){while(--_0xa9d9fe){_0xef7317['push'](_0xef7317['shift']());}};_0x2f1680(++_0x56e3de);}(_0xefc6,0x10a));var _0x6efc=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xefc6[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x6efc('0x0'));var moment=require(_0x6efc('0x1'));module[_0x6efc('0x2')]={'time':{'type':Sequelize[_0x6efc('0x3')]},'callid':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6efc('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x6efc('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x21af=['moment','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x40e5b3,_0x157dbb){var _0x41f089=function(_0x2f5f96){while(--_0x2f5f96){_0x40e5b3['push'](_0x40e5b3['shift']());}};_0x41f089(++_0x157dbb);}(_0x21af,0x19e));var _0xf21a=function(_0x455487,_0x42e00c){_0x455487=_0x455487-0x0;var _0x505576=_0x21af[_0x455487];return _0x505576;};'use strict';var Sequelize=require(_0xf21a('0x0'));var moment=require(_0xf21a('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xf21a('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf21a('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf21a('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf21a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf21a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf21a('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf21a('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xf21a('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index ce80ce7..78f128d 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 _0xf8f6=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','keys','includeAll','include','find','create','body','catch','update','params','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xf8f6,0x73));var _0x6f8f=function(_0xfab12e,_0x2905b0){_0xfab12e=_0xfab12e-0x0;var _0x1933bd=_0xf8f6[_0xfab12e];return _0x1933bd;};'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(_0x6f8f('0x0'));var moment=require(_0x6f8f('0x1'));var BPromise=require(_0x6f8f('0x2'));var Mustache=require(_0x6f8f('0x3'));var util=require(_0x6f8f('0x4'));var path=require(_0x6f8f('0x5'));var sox=require(_0x6f8f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f8f('0x7'));var squel=require(_0x6f8f('0x8'));var crypto=require(_0x6f8f('0x9'));var jsforce=require(_0x6f8f('0xa'));var deskjs=require(_0x6f8f('0xb'));var toCsv=require(_0x6f8f('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f8f('0xd'));var as=require(_0x6f8f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f8f('0xf'))(_0x6f8f('0x10'));var utils=require(_0x6f8f('0x11'));var config=require(_0x6f8f('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9074,_0x166564){_0x166564=_0x166564||0xcc;return function(_0x346455){if(_0x346455){return _0x3c9074[_0x6f8f('0x13')](_0x166564);}return _0x3c9074['status'](_0x166564)[_0x6f8f('0x14')]();};}function respondWithResult(_0xb9a3e9,_0x434bd3){_0x434bd3=_0x434bd3||0xc8;return function(_0x2722b0){if(_0x2722b0){return _0xb9a3e9[_0x6f8f('0x15')](_0x434bd3)[_0x6f8f('0x16')](_0x2722b0);}};}function respondWithFilteredResult(_0x4f478f,_0x31b61e){return function(_0x5d126d){if(_0x5d126d){var _0xf931f6=typeof _0x31b61e[_0x6f8f('0x17')]===_0x6f8f('0x18')&&typeof _0x31b61e[_0x6f8f('0x19')]===_0x6f8f('0x18');var _0x52490c=_0x5d126d[_0x6f8f('0x1a')];var _0x283be2=_0xf931f6?0x0:_0x31b61e[_0x6f8f('0x17')];var _0x4c266c=_0xf931f6?_0x5d126d[_0x6f8f('0x1a')]:_0x31b61e[_0x6f8f('0x17')]+_0x31b61e[_0x6f8f('0x19')];var _0x1a5390;if(_0x4c266c>=_0x52490c){_0x4c266c=_0x52490c;_0x1a5390=0xc8;}else{_0x1a5390=0xce;}_0x4f478f[_0x6f8f('0x15')](_0x1a5390);return _0x4f478f[_0x6f8f('0x1b')](_0x6f8f('0x1c'),_0x283be2+'-'+_0x4c266c+'/'+_0x52490c)[_0x6f8f('0x16')](_0x5d126d);}return null;};}function patchUpdates(_0x2e732f){return function(_0x1911c1){try{jsonpatch['apply'](_0x1911c1,_0x2e732f,!![]);}catch(_0x502f51){return BPromise[_0x6f8f('0x1d')](_0x502f51);}return _0x1911c1[_0x6f8f('0x1e')]();};}function saveUpdates(_0x272464,_0x125c2c){return function(_0x22d731){if(_0x22d731){return _0x22d731['update'](_0x272464)[_0x6f8f('0x1f')](function(_0x30efb5){return _0x30efb5;});}return null;};}function removeEntity(_0x59d8ce,_0x5487bf){return function(_0x58bd58){if(_0x58bd58){return _0x58bd58[_0x6f8f('0x20')]()[_0x6f8f('0x1f')](function(){_0x59d8ce[_0x6f8f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22fa35,_0x42fb36){return function(_0x1f7259){if(!_0x1f7259){_0x22fa35[_0x6f8f('0x13')](0x194);}return _0x1f7259;};}function handleError(_0x5a1be2,_0x1f373e){_0x1f373e=_0x1f373e||0x1f4;return function(_0x153868){logger[_0x6f8f('0x21')](_0x153868[_0x6f8f('0x22')]);if(_0x153868[_0x6f8f('0x23')]){delete _0x153868[_0x6f8f('0x23')];}_0x5a1be2['status'](_0x1f373e)[_0x6f8f('0x24')](_0x153868);};}exports['index']=function(_0x5410d4,_0x530d6a){var _0x2e1927={},_0x4e3afe={},_0x35cc48={'count':0x0,'rows':[]};var _0x9e138f=_[_0x6f8f('0x25')](db[_0x6f8f('0x26')][_0x6f8f('0x27')],function(_0x2f3676){return{'name':_0x2f3676['fieldName'],'type':_0x2f3676[_0x6f8f('0x28')][_0x6f8f('0x29')]};});_0x4e3afe[_0x6f8f('0x2a')]=_['map'](_0x9e138f,'name');_0x4e3afe[_0x6f8f('0x2b')]=_['keys'](_0x5410d4[_0x6f8f('0x2b')]);_0x4e3afe[_0x6f8f('0x2c')]=_['intersection'](_0x4e3afe[_0x6f8f('0x2a')],_0x4e3afe[_0x6f8f('0x2b')]);_0x2e1927['attributes']=_[_0x6f8f('0x2d')](_0x4e3afe[_0x6f8f('0x2a')],qs[_0x6f8f('0x2e')](_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x2e')]));_0x2e1927[_0x6f8f('0x2f')]=_0x2e1927[_0x6f8f('0x2f')][_0x6f8f('0x30')]?_0x2e1927['attributes']:_0x4e3afe[_0x6f8f('0x2a')];if(!_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x31')]('nolimit')){_0x2e1927['limit']=qs[_0x6f8f('0x19')](_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x19')]);_0x2e1927[_0x6f8f('0x17')]=qs[_0x6f8f('0x17')](_0x5410d4[_0x6f8f('0x2b')]['offset']);}_0x2e1927[_0x6f8f('0x32')]=qs[_0x6f8f('0x33')](_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x33')]);_0x2e1927[_0x6f8f('0x34')]=qs[_0x6f8f('0x2c')](_[_0x6f8f('0x35')](_0x5410d4[_0x6f8f('0x2b')],_0x4e3afe['filters']),_0x9e138f);if(_0x5410d4[_0x6f8f('0x2b')]['filter']){_0x2e1927[_0x6f8f('0x34')]=_[_0x6f8f('0x36')](_0x2e1927[_0x6f8f('0x34')],{'$or':_['map'](_0x9e138f,function(_0x5049ed){if(_0x5049ed[_0x6f8f('0x28')]!==_0x6f8f('0x37')){var _0x16a86f={};_0x16a86f[_0x5049ed[_0x6f8f('0x23')]]={'$like':'%'+_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x38')]+'%'};return _0x16a86f;}})});}_0x2e1927=_[_0x6f8f('0x36')]({},_0x2e1927,_0x5410d4[_0x6f8f('0x39')]);var _0x3cc7ce={'where':_0x2e1927[_0x6f8f('0x34')]};return db[_0x6f8f('0x26')][_0x6f8f('0x1a')](_0x3cc7ce)[_0x6f8f('0x1f')](function(_0x3f252b){_0x35cc48[_0x6f8f('0x1a')]=_0x3f252b;if(_0x5410d4[_0x6f8f('0x2b')]['includeAll']){_0x2e1927['include']=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x2e1927);})[_0x6f8f('0x1f')](function(_0x31d5c0){_0x35cc48['rows']=_0x31d5c0;return _0x35cc48;})[_0x6f8f('0x1f')](respondWithFilteredResult(_0x530d6a,_0x2e1927))['catch'](handleError(_0x530d6a,null));};exports['show']=function(_0x49ef97,_0x1eea67){var _0xf9a9fa={'raw':!![],'where':{'id':_0x49ef97['params']['id']}},_0x290098={};_0x290098[_0x6f8f('0x2a')]=_['keys'](db[_0x6f8f('0x26')][_0x6f8f('0x27')]);_0x290098[_0x6f8f('0x2b')]=_[_0x6f8f('0x3a')](_0x49ef97[_0x6f8f('0x2b')]);_0x290098['filters']=_[_0x6f8f('0x2d')](_0x290098[_0x6f8f('0x2a')],_0x290098['query']);_0xf9a9fa[_0x6f8f('0x2f')]=_[_0x6f8f('0x2d')](_0x290098['model'],qs[_0x6f8f('0x2e')](_0x49ef97[_0x6f8f('0x2b')]['fields']));_0xf9a9fa[_0x6f8f('0x2f')]=_0xf9a9fa[_0x6f8f('0x2f')][_0x6f8f('0x30')]?_0xf9a9fa[_0x6f8f('0x2f')]:_0x290098['model'];if(_0x49ef97[_0x6f8f('0x2b')][_0x6f8f('0x3b')]){_0xf9a9fa[_0x6f8f('0x3c')]=[{'all':!![]}];}_0xf9a9fa=_[_0x6f8f('0x36')]({},_0xf9a9fa,_0x49ef97['options']);return db[_0x6f8f('0x26')][_0x6f8f('0x3d')](_0xf9a9fa)['then'](handleEntityNotFound(_0x1eea67,null))[_0x6f8f('0x1f')](respondWithResult(_0x1eea67,null))['catch'](handleError(_0x1eea67,null));};exports[_0x6f8f('0x3e')]=function(_0x28eae6,_0x3c9cb0){return db[_0x6f8f('0x26')][_0x6f8f('0x3e')](_0x28eae6[_0x6f8f('0x3f')],{})[_0x6f8f('0x1f')](respondWithResult(_0x3c9cb0,0xc9))[_0x6f8f('0x40')](handleError(_0x3c9cb0,null));};exports[_0x6f8f('0x41')]=function(_0x2fd83d,_0x3a69ba){if(_0x2fd83d[_0x6f8f('0x3f')]['id']){delete _0x2fd83d['body']['id'];}return db[_0x6f8f('0x26')][_0x6f8f('0x3d')]({'where':{'id':_0x2fd83d[_0x6f8f('0x42')]['id']}})[_0x6f8f('0x1f')](handleEntityNotFound(_0x3a69ba,null))['then'](saveUpdates(_0x2fd83d[_0x6f8f('0x3f')],null))['then'](respondWithResult(_0x3a69ba,null))[_0x6f8f('0x40')](handleError(_0x3a69ba,null));};exports['destroy']=function(_0x4e7441,_0x3b427f){return db['VoiceQueuesLog'][_0x6f8f('0x3d')]({'where':{'id':_0x4e7441[_0x6f8f('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b427f,null))[_0x6f8f('0x1f')](removeEntity(_0x3b427f,null))[_0x6f8f('0x40')](handleError(_0x3b427f,null));}; \ No newline at end of file +var _0x16e4=['body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','save','update','then','destroy','end','sendStatus','stack','send','map','VoiceQueuesLog','fieldName','type','key','model','name','keys','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','create'];(function(_0x50720c,_0x13f3e0){var _0x3674cd=function(_0x4ae5e4){while(--_0x4ae5e4){_0x50720c['push'](_0x50720c['shift']());}};_0x3674cd(++_0x13f3e0);}(_0x16e4,0x1b2));var _0x416e=function(_0x574d70,_0x23cf22){_0x574d70=_0x574d70-0x0;var _0x4f9661=_0x16e4[_0x574d70];return _0x4f9661;};'use strict';var emlformat=require(_0x416e('0x0'));var rimraf=require(_0x416e('0x1'));var zipdir=require(_0x416e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x416e('0x3'));var BPromise=require(_0x416e('0x4'));var Mustache=require(_0x416e('0x5'));var util=require(_0x416e('0x6'));var path=require(_0x416e('0x7'));var sox=require('sox');var csv=require(_0x416e('0x8'));var ejs=require(_0x416e('0x9'));var fs=require('fs');var fs_extra=require(_0x416e('0xa'));var _=require(_0x416e('0xb'));var squel=require(_0x416e('0xc'));var crypto=require(_0x416e('0xd'));var jsforce=require(_0x416e('0xe'));var deskjs=require(_0x416e('0xf'));var toCsv=require(_0x416e('0x8'));var querystring=require(_0x416e('0x10'));var Papa=require(_0x416e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x416e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x416e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x416e('0x14'));var config=require(_0x416e('0x15'));var licenseUtil=require(_0x416e('0x16'));var db=require(_0x416e('0x17'))['db'];function respondWithStatusCode(_0x1abf7b,_0xae1088){_0xae1088=_0xae1088||0xcc;return function(_0x5d95cd){if(_0x5d95cd){return _0x1abf7b['sendStatus'](_0xae1088);}return _0x1abf7b[_0x416e('0x18')](_0xae1088)['end']();};}function respondWithResult(_0x2c925e,_0x2f6822){_0x2f6822=_0x2f6822||0xc8;return function(_0x56e38b){if(_0x56e38b){return _0x2c925e[_0x416e('0x18')](_0x2f6822)[_0x416e('0x19')](_0x56e38b);}};}function respondWithFilteredResult(_0x5482cf,_0x4f6004){return function(_0xa9138c){if(_0xa9138c){var _0x53ce4b=typeof _0x4f6004[_0x416e('0x1a')]===_0x416e('0x1b')&&typeof _0x4f6004[_0x416e('0x1c')]===_0x416e('0x1b');var _0x3b2ac3=_0xa9138c['count'];var _0x3c47ba=_0x53ce4b?0x0:_0x4f6004['offset'];var _0x5fafc6=_0x53ce4b?_0xa9138c[_0x416e('0x1d')]:_0x4f6004['offset']+_0x4f6004[_0x416e('0x1c')];var _0x92b3f9;if(_0x5fafc6>=_0x3b2ac3){_0x5fafc6=_0x3b2ac3;_0x92b3f9=0xc8;}else{_0x92b3f9=0xce;}_0x5482cf[_0x416e('0x18')](_0x92b3f9);return _0x5482cf[_0x416e('0x1e')]('Content-Range',_0x3c47ba+'-'+_0x5fafc6+'/'+_0x3b2ac3)[_0x416e('0x19')](_0xa9138c);}return null;};}function patchUpdates(_0x3df314){return function(_0x2c9c30){try{jsonpatch['apply'](_0x2c9c30,_0x3df314,!![]);}catch(_0x4cecdf){return BPromise['reject'](_0x4cecdf);}return _0x2c9c30[_0x416e('0x1f')]();};}function saveUpdates(_0x4e9374,_0x1fb710){return function(_0x750b28){if(_0x750b28){return _0x750b28[_0x416e('0x20')](_0x4e9374)[_0x416e('0x21')](function(_0x5a63eb){return _0x5a63eb;});}return null;};}function removeEntity(_0x50982d,_0x5e0a92){return function(_0x1ab03c){if(_0x1ab03c){return _0x1ab03c[_0x416e('0x22')]()['then'](function(){_0x50982d[_0x416e('0x18')](0xcc)[_0x416e('0x23')]();});}};}function handleEntityNotFound(_0x5d4cbc,_0x3fc3d1){return function(_0x182d16){if(!_0x182d16){_0x5d4cbc[_0x416e('0x24')](0x194);}return _0x182d16;};}function handleError(_0x16a953,_0x1871c1){_0x1871c1=_0x1871c1||0x1f4;return function(_0x5a9eaa){logger['error'](_0x5a9eaa[_0x416e('0x25')]);if(_0x5a9eaa['name']){delete _0x5a9eaa['name'];}_0x16a953[_0x416e('0x18')](_0x1871c1)[_0x416e('0x26')](_0x5a9eaa);};}exports['index']=function(_0x5b59ef,_0x42a690){var _0x4efe0e={},_0x319eb6={},_0xd53bfb={'count':0x0,'rows':[]};var _0x20ad00=_[_0x416e('0x27')](db[_0x416e('0x28')]['rawAttributes'],function(_0xf0e606){return{'name':_0xf0e606[_0x416e('0x29')],'type':_0xf0e606[_0x416e('0x2a')][_0x416e('0x2b')]};});_0x319eb6[_0x416e('0x2c')]=_[_0x416e('0x27')](_0x20ad00,_0x416e('0x2d'));_0x319eb6['query']=_[_0x416e('0x2e')](_0x5b59ef['query']);_0x319eb6['filters']=_[_0x416e('0x2f')](_0x319eb6[_0x416e('0x2c')],_0x319eb6[_0x416e('0x30')]);_0x4efe0e[_0x416e('0x31')]=_['intersection'](_0x319eb6[_0x416e('0x2c')],qs['fields'](_0x5b59ef['query']['fields']));_0x4efe0e[_0x416e('0x31')]=_0x4efe0e[_0x416e('0x31')][_0x416e('0x32')]?_0x4efe0e[_0x416e('0x31')]:_0x319eb6[_0x416e('0x2c')];if(!_0x5b59ef[_0x416e('0x30')][_0x416e('0x33')](_0x416e('0x34'))){_0x4efe0e[_0x416e('0x1c')]=qs[_0x416e('0x1c')](_0x5b59ef[_0x416e('0x30')][_0x416e('0x1c')]);_0x4efe0e[_0x416e('0x1a')]=qs[_0x416e('0x1a')](_0x5b59ef['query'][_0x416e('0x1a')]);}_0x4efe0e[_0x416e('0x35')]=qs[_0x416e('0x36')](_0x5b59ef['query'][_0x416e('0x36')]);_0x4efe0e['where']=qs[_0x416e('0x37')](_['pick'](_0x5b59ef[_0x416e('0x30')],_0x319eb6[_0x416e('0x37')]),_0x20ad00);if(_0x5b59ef['query'][_0x416e('0x38')]){_0x4efe0e[_0x416e('0x39')]=_[_0x416e('0x3a')](_0x4efe0e[_0x416e('0x39')],{'$or':_[_0x416e('0x27')](_0x20ad00,function(_0x2bbcff){if(_0x2bbcff[_0x416e('0x2a')]!==_0x416e('0x3b')){var _0x68e084={};_0x68e084[_0x2bbcff[_0x416e('0x2d')]]={'$like':'%'+_0x5b59ef[_0x416e('0x30')][_0x416e('0x38')]+'%'};return _0x68e084;}})});}_0x4efe0e=_[_0x416e('0x3a')]({},_0x4efe0e,_0x5b59ef[_0x416e('0x3c')]);var _0x3bceea={'where':_0x4efe0e[_0x416e('0x39')]};return db['VoiceQueuesLog'][_0x416e('0x1d')](_0x3bceea)[_0x416e('0x21')](function(_0x1ea114){_0xd53bfb[_0x416e('0x1d')]=_0x1ea114;if(_0x5b59ef[_0x416e('0x30')][_0x416e('0x3d')]){_0x4efe0e[_0x416e('0x3e')]=[{'all':!![]}];}return db[_0x416e('0x28')]['findAll'](_0x4efe0e);})[_0x416e('0x21')](function(_0x597d26){_0xd53bfb[_0x416e('0x3f')]=_0x597d26;return _0xd53bfb;})[_0x416e('0x21')](respondWithFilteredResult(_0x42a690,_0x4efe0e))[_0x416e('0x40')](handleError(_0x42a690,null));};exports[_0x416e('0x41')]=function(_0x1f7144,_0x55fb1e){var _0x4fb776={'raw':!![],'where':{'id':_0x1f7144[_0x416e('0x42')]['id']}},_0x2e9616={};_0x2e9616['model']=_[_0x416e('0x2e')](db[_0x416e('0x28')][_0x416e('0x43')]);_0x2e9616[_0x416e('0x30')]=_[_0x416e('0x2e')](_0x1f7144[_0x416e('0x30')]);_0x2e9616[_0x416e('0x37')]=_[_0x416e('0x2f')](_0x2e9616[_0x416e('0x2c')],_0x2e9616[_0x416e('0x30')]);_0x4fb776['attributes']=_[_0x416e('0x2f')](_0x2e9616[_0x416e('0x2c')],qs[_0x416e('0x44')](_0x1f7144[_0x416e('0x30')][_0x416e('0x44')]));_0x4fb776[_0x416e('0x31')]=_0x4fb776[_0x416e('0x31')][_0x416e('0x32')]?_0x4fb776[_0x416e('0x31')]:_0x2e9616[_0x416e('0x2c')];if(_0x1f7144[_0x416e('0x30')][_0x416e('0x3d')]){_0x4fb776[_0x416e('0x3e')]=[{'all':!![]}];}_0x4fb776=_[_0x416e('0x3a')]({},_0x4fb776,_0x1f7144[_0x416e('0x3c')]);return db[_0x416e('0x28')]['find'](_0x4fb776)['then'](handleEntityNotFound(_0x55fb1e,null))[_0x416e('0x21')](respondWithResult(_0x55fb1e,null))[_0x416e('0x40')](handleError(_0x55fb1e,null));};exports[_0x416e('0x45')]=function(_0x3980e5,_0x5b3055){return db[_0x416e('0x28')][_0x416e('0x45')](_0x3980e5[_0x416e('0x46')],{})[_0x416e('0x21')](respondWithResult(_0x5b3055,0xc9))['catch'](handleError(_0x5b3055,null));};exports['update']=function(_0x4125e8,_0x382cf7){if(_0x4125e8['body']['id']){delete _0x4125e8[_0x416e('0x46')]['id'];}return db[_0x416e('0x28')][_0x416e('0x47')]({'where':{'id':_0x4125e8[_0x416e('0x42')]['id']}})[_0x416e('0x21')](handleEntityNotFound(_0x382cf7,null))[_0x416e('0x21')](saveUpdates(_0x4125e8[_0x416e('0x46')],null))[_0x416e('0x21')](respondWithResult(_0x382cf7,null))[_0x416e('0x40')](handleError(_0x382cf7,null));};exports[_0x416e('0x22')]=function(_0x13a2eb,_0x17b0b1){return db[_0x416e('0x28')][_0x416e('0x47')]({'where':{'id':_0x13a2eb[_0x416e('0x42')]['id']}})['then'](handleEntityNotFound(_0x17b0b1,null))[_0x416e('0x21')](removeEntity(_0x17b0b1,null))['catch'](handleError(_0x17b0b1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index effdaa3..fec120f 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 _0xdc91=['api','moment','request-promise','path','rimraf','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event','lodash','util','../../config/logger'];(function(_0x53594d,_0xb372ae){var _0x3b2544=function(_0x33359f){while(--_0x33359f){_0x53594d['push'](_0x53594d['shift']());}};_0x3b2544(++_0xb372ae);}(_0xdc91,0x183));var _0x1dc9=function(_0x2ead66,_0x134456){_0x2ead66=_0x2ead66-0x0;var _0x6321e4=_0xdc91[_0x2ead66];return _0x6321e4;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var logger=require(_0x1dc9('0x2'))(_0x1dc9('0x3'));var moment=require(_0x1dc9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dc9('0x5'));var fs=require('fs');var path=require(_0x1dc9('0x6'));var rimraf=require(_0x1dc9('0x7'));var config=require('../../config/environment');var attributes=require(_0x1dc9('0x8'));module['exports']=function(_0x167133,_0x1a596b){return _0x167133[_0x1dc9('0x9')](_0x1dc9('0xa'),attributes,{'tableName':_0x1dc9('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x1dc9('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xa391=['util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','dtm'];(function(_0x375041,_0x218848){var _0x1c3b24=function(_0x16fdea){while(--_0x16fdea){_0x375041['push'](_0x375041['shift']());}};_0x1c3b24(++_0x218848);}(_0xa391,0x1ee));var _0x1a39=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xa391[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0x1a39('0x0'));var logger=require('../../config/logger')(_0x1a39('0x1'));var moment=require(_0x1a39('0x2'));var BPromise=require(_0x1a39('0x3'));var rp=require(_0x1a39('0x4'));var fs=require('fs');var path=require(_0x1a39('0x5'));var rimraf=require('rimraf');var config=require(_0x1a39('0x6'));var attributes=require(_0x1a39('0x7'));module[_0x1a39('0x8')]=function(_0x13e197,_0x408465){return _0x13e197[_0x1a39('0x9')](_0x1a39('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x1a39('0xb'),'fields':['event',_0x1a39('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 137d6c7..030a017 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 _0x8728=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x26369b,_0x13ecb8){var _0x67a398=function(_0x324bc7){while(--_0x324bc7){_0x26369b['push'](_0x26369b['shift']());}};_0x67a398(++_0x13ecb8);}(_0x8728,0x14a));var _0x8872=function(_0x498cbf,_0x2d9099){_0x498cbf=_0x498cbf-0x0;var _0x204c21=_0x8728[_0x498cbf];return _0x204c21;};'use strict';var _=require(_0x8872('0x0'));var util=require(_0x8872('0x1'));var moment=require('moment');var BPromise=require(_0x8872('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8872('0x3'));var db=require(_0x8872('0x4'))['db'];var utils=require(_0x8872('0x5'));var logger=require(_0x8872('0x6'))(_0x8872('0x7'));var config=require(_0x8872('0x8'));var jayson=require(_0x8872('0x9'));var client=jayson[_0x8872('0xa')][_0x8872('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb24383,_0x4d421a,_0x44c113){return new BPromise(function(_0x20bc33,_0x4068c1){return client['request'](_0xb24383,_0x44c113)[_0x8872('0xc')](function(_0x246e75){logger[_0x8872('0xd')](_0x8872('0xe'),_0x4d421a,_0x8872('0xf'));logger[_0x8872('0x10')](_0x8872('0x11'),_0x4d421a,_0x8872('0xf'),JSON['stringify'](_0x246e75));if(_0x246e75[_0x8872('0x12')]){if(_0x246e75[_0x8872('0x12')][_0x8872('0x13')]===0x1f4){logger[_0x8872('0x12')](_0x8872('0xe'),_0x4d421a,_0x246e75['error'][_0x8872('0x14')]);return _0x4068c1(_0x246e75[_0x8872('0x12')][_0x8872('0x14')]);}logger[_0x8872('0x12')](_0x8872('0xe'),_0x4d421a,_0x246e75[_0x8872('0x12')][_0x8872('0x14')]);return _0x20bc33(_0x246e75[_0x8872('0x12')][_0x8872('0x14')]);}else{logger[_0x8872('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4d421a,'request\x20sent');_0x20bc33(_0x246e75[_0x8872('0x15')]['message']);}})[_0x8872('0x16')](function(_0x3dffab){logger['error'](_0x8872('0xe'),_0x4d421a,_0x3dffab);_0x4068c1(_0x3dffab);});});} \ No newline at end of file +var _0x1b32=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x369187,_0x4c5966){var _0x3412de=function(_0x199a8e){while(--_0x199a8e){_0x369187['push'](_0x369187['shift']());}};_0x3412de(++_0x4c5966);}(_0x1b32,0x85));var _0x21b3=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1b32[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var moment=require(_0x21b3('0x1'));var BPromise=require(_0x21b3('0x2'));var rs=require(_0x21b3('0x3'));var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require(_0x21b3('0x9'));var jayson=require(_0x21b3('0xa'));var client=jayson[_0x21b3('0xb')][_0x21b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47516a,_0x21e881,_0x5c0f36){return new BPromise(function(_0x45b1b7,_0x5639eb){return client['request'](_0x47516a,_0x5c0f36)['then'](function(_0xd7a981){logger[_0x21b3('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x21e881,'request\x20sent');logger[_0x21b3('0xe')](_0x21b3('0xf'),_0x21e881,_0x21b3('0x10'),JSON['stringify'](_0xd7a981));if(_0xd7a981[_0x21b3('0x11')]){if(_0xd7a981[_0x21b3('0x11')][_0x21b3('0x12')]===0x1f4){logger[_0x21b3('0x11')](_0x21b3('0x13'),_0x21e881,_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);return _0x5639eb(_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);}logger['error'](_0x21b3('0x13'),_0x21e881,_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);return _0x45b1b7(_0xd7a981['error'][_0x21b3('0x14')]);}else{logger['info'](_0x21b3('0x13'),_0x21e881,'request\x20sent');_0x45b1b7(_0xd7a981[_0x21b3('0x15')][_0x21b3('0x14')]);}})[_0x21b3('0x16')](function(_0x4217d6){logger['error'](_0x21b3('0x13'),_0x21e881,_0x4217d6);_0x5639eb(_0x4217d6);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 476faa6..f095126 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 _0xb2e1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','/:id/transcribe','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x3ceac1,_0x15d3d9){var _0x14cc22=function(_0x31e403){while(--_0x31e403){_0x3ceac1['push'](_0x3ceac1['shift']());}};_0x14cc22(++_0x15d3d9);}(_0xb2e1,0x1bd));var _0x1b2e=function(_0x122415,_0xb08425){_0x122415=_0x122415-0x0;var _0x3ac79d=_0xb2e1[_0x122415];return _0x3ac79d;};'use strict';var multer=require(_0x1b2e('0x0'));var util=require('util');var path=require(_0x1b2e('0x1'));var timeout=require(_0x1b2e('0x2'));var express=require(_0x1b2e('0x3'));var router=express[_0x1b2e('0x4')]();var fs_extra=require(_0x1b2e('0x5'));var auth=require(_0x1b2e('0x6'));var interaction=require(_0x1b2e('0x7'));var config=require(_0x1b2e('0x8'));var controller=require(_0x1b2e('0x9'));router[_0x1b2e('0xa')]('/',auth[_0x1b2e('0xb')](),controller[_0x1b2e('0xc')]);router[_0x1b2e('0xa')](_0x1b2e('0xd'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0xe')]);router[_0x1b2e('0xa')](_0x1b2e('0xf'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x10')]);router['get'](_0x1b2e('0x11'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x12')]);router[_0x1b2e('0xa')](_0x1b2e('0x13'),controller[_0x1b2e('0x14')]);router[_0x1b2e('0xa')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x1b2e('0x15')]);router[_0x1b2e('0x16')]('/',auth[_0x1b2e('0xb')](),controller['create']);router[_0x1b2e('0x16')](_0x1b2e('0x17'),auth[_0x1b2e('0xb')](),controller['runTranscribe']);router[_0x1b2e('0x18')](_0x1b2e('0xf'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x19')]);router['delete'](_0x1b2e('0xf'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x1a')]);module[_0x1b2e('0x1b')]=router; \ No newline at end of file +var _0xed37=['/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','isAuthenticated','describe'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xed37,0x69));var _0x7ed3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xed37[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x7ed3('0x0'));var path=require(_0x7ed3('0x1'));var timeout=require(_0x7ed3('0x2'));var express=require('express');var router=express[_0x7ed3('0x3')]();var fs_extra=require(_0x7ed3('0x4'));var auth=require(_0x7ed3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x7ed3('0x6')]('/',auth['isAuthenticated'](),controller[_0x7ed3('0x7')]);router[_0x7ed3('0x6')]('/describe',auth[_0x7ed3('0x8')](),controller[_0x7ed3('0x9')]);router[_0x7ed3('0x6')](_0x7ed3('0xa'),auth['isAuthenticated'](),controller[_0x7ed3('0xb')]);router['get'](_0x7ed3('0xc'),auth[_0x7ed3('0x8')](),controller['download']);router[_0x7ed3('0x6')](_0x7ed3('0xd'),controller[_0x7ed3('0xe')]);router[_0x7ed3('0x6')](_0x7ed3('0xf'),auth[_0x7ed3('0x8')](),controller['downloadTranscribe']);router[_0x7ed3('0x10')]('/',auth['isAuthenticated'](),controller[_0x7ed3('0x11')]);router[_0x7ed3('0x10')]('/:id/transcribe',auth[_0x7ed3('0x8')](),controller['runTranscribe']);router[_0x7ed3('0x12')](_0x7ed3('0xa'),auth[_0x7ed3('0x8')](),controller[_0x7ed3('0x13')]);router[_0x7ed3('0x14')](_0x7ed3('0xa'),auth[_0x7ed3('0x8')](),controller[_0x7ed3('0x15')]);module[_0x7ed3('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1c596d5..f2e6d2d 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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 386d20c..13c4ee8 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 _0xee38=['find','params','describe','download','../../components/encryptor','type','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','MD5','sequelize','col','uniqueid','token','$and','push','recording','Sequelize','destroy','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','index','map','rawAttributes','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','keys','create','body','update'];(function(_0x40efe3,_0x51bf95){var _0x47c613=function(_0x1a9fec){while(--_0x1a9fec){_0x40efe3['push'](_0x40efe3['shift']());}};_0x47c613(++_0x51bf95);}(_0xee38,0xef));var _0x8ee3=function(_0x5bc37b,_0xc5e3fc){_0x5bc37b=_0x5bc37b-0x0;var _0x19e63e=_0xee38[_0x5bc37b];return _0x19e63e;};'use strict';var emlformat=require(_0x8ee3('0x0'));var rimraf=require(_0x8ee3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ee3('0x2'));var rp=require(_0x8ee3('0x3'));var moment=require(_0x8ee3('0x4'));var BPromise=require(_0x8ee3('0x5'));var Mustache=require(_0x8ee3('0x6'));var util=require(_0x8ee3('0x7'));var path=require(_0x8ee3('0x8'));var sox=require(_0x8ee3('0x9'));var csv=require('to-csv');var ejs=require(_0x8ee3('0xa'));var fs=require('fs');var fs_extra=require(_0x8ee3('0xb'));var _=require(_0x8ee3('0xc'));var squel=require(_0x8ee3('0xd'));var crypto=require(_0x8ee3('0xe'));var jsforce=require(_0x8ee3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ee3('0x10'));var Papa=require(_0x8ee3('0x11'));var AWS=require(_0x8ee3('0x12'));var uuidv4=require(_0x8ee3('0x13'));var Redis=require('ioredis');var authService=require(_0x8ee3('0x14'));var qs=require(_0x8ee3('0x15'));var as=require(_0x8ee3('0x16'));var hardwareService=require(_0x8ee3('0x17'));var logger=require(_0x8ee3('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x8ee3('0x19'));var licenseUtil=require(_0x8ee3('0x1a'));var db=require(_0x8ee3('0x1b'))['db'];function respondWithStatusCode(_0x227e7b,_0x3020e2){_0x3020e2=_0x3020e2||0xcc;return function(_0x1485de){if(_0x1485de){return _0x227e7b[_0x8ee3('0x1c')](_0x3020e2);}return _0x227e7b[_0x8ee3('0x1d')](_0x3020e2)[_0x8ee3('0x1e')]();};}function respondWithResult(_0x2f6a79,_0x3a6528){_0x3a6528=_0x3a6528||0xc8;return function(_0x3124a6){if(_0x3124a6){return _0x2f6a79[_0x8ee3('0x1d')](_0x3a6528)[_0x8ee3('0x1f')](_0x3124a6);}};}function respondWithFilteredResult(_0x281366,_0xe56161){return function(_0x596f6b){if(_0x596f6b){var _0x570d2e=typeof _0xe56161[_0x8ee3('0x20')]===_0x8ee3('0x21')&&typeof _0xe56161[_0x8ee3('0x22')]===_0x8ee3('0x21');var _0x51cc22=_0x596f6b[_0x8ee3('0x23')];var _0x2df956=_0x570d2e?0x0:_0xe56161['offset'];var _0x5964e0=_0x570d2e?_0x596f6b[_0x8ee3('0x23')]:_0xe56161[_0x8ee3('0x20')]+_0xe56161[_0x8ee3('0x22')];var _0x2b3126;if(_0x5964e0>=_0x51cc22){_0x5964e0=_0x51cc22;_0x2b3126=0xc8;}else{_0x2b3126=0xce;}_0x281366[_0x8ee3('0x1d')](_0x2b3126);return _0x281366[_0x8ee3('0x24')](_0x8ee3('0x25'),_0x2df956+'-'+_0x5964e0+'/'+_0x51cc22)[_0x8ee3('0x1f')](_0x596f6b);}return null;};}function patchUpdates(_0x231c92){return function(_0x53126f){try{jsonpatch[_0x8ee3('0x26')](_0x53126f,_0x231c92,!![]);}catch(_0x3abb57){return BPromise['reject'](_0x3abb57);}return _0x53126f[_0x8ee3('0x27')]();};}function saveUpdates(_0x1968cc,_0x203d26){return function(_0x2eed9d){if(_0x2eed9d){return _0x2eed9d['update'](_0x1968cc)[_0x8ee3('0x28')](function(_0x41efe7){return _0x41efe7;});}return null;};}function removeEntity(_0x31d696,_0x2f62fa){return function(_0x185e68){if(_0x185e68){return _0x185e68['destroy']()[_0x8ee3('0x28')](function(){_0x31d696[_0x8ee3('0x1d')](0xcc)[_0x8ee3('0x1e')]();});}};}function handleEntityNotFound(_0xfbe43e,_0x5dc526){return function(_0x2094e7){if(!_0x2094e7){_0xfbe43e[_0x8ee3('0x1c')](0x194);}return _0x2094e7;};}function handleError(_0x17f524,_0x51b1e2){_0x51b1e2=_0x51b1e2||0x1f4;return function(_0x14e509){logger[_0x8ee3('0x29')](_0x14e509[_0x8ee3('0x2a')]);if(_0x14e509[_0x8ee3('0x2b')]){delete _0x14e509[_0x8ee3('0x2b')];}_0x17f524[_0x8ee3('0x1d')](_0x51b1e2)['send'](_0x14e509);};}exports[_0x8ee3('0x2c')]=function(_0xf6ac8c,_0x2ae76d){var _0x28c80e={},_0x412878={},_0x4c593c={'count':0x0,'rows':[]};var _0x54d469=_[_0x8ee3('0x2d')](db['VoiceRecording'][_0x8ee3('0x2e')],function(_0x244c2c){return{'name':_0x244c2c['fieldName'],'type':_0x244c2c['type']['key']};});_0x412878[_0x8ee3('0x2f')]=_[_0x8ee3('0x30')](_[_0x8ee3('0x2d')](_0x54d469,_0x8ee3('0x2b')),[_0x8ee3('0x31')]);_0x412878[_0x8ee3('0x32')]=_['keys'](_0xf6ac8c[_0x8ee3('0x32')]);_0x412878[_0x8ee3('0x33')]=_[_0x8ee3('0x34')](_0x412878[_0x8ee3('0x2f')],_0x412878[_0x8ee3('0x32')]);_0x28c80e['attributes']=_[_0x8ee3('0x34')](_0x412878[_0x8ee3('0x2f')],qs['fields'](_0xf6ac8c['query'][_0x8ee3('0x35')]));_0x28c80e[_0x8ee3('0x36')]=_0x28c80e[_0x8ee3('0x36')][_0x8ee3('0x37')]?_0x28c80e['attributes']:_0x412878['model'];if(!_0xf6ac8c[_0x8ee3('0x32')][_0x8ee3('0x38')](_0x8ee3('0x39'))){_0x28c80e[_0x8ee3('0x22')]=qs[_0x8ee3('0x22')](_0xf6ac8c[_0x8ee3('0x32')][_0x8ee3('0x22')]);_0x28c80e[_0x8ee3('0x20')]=qs[_0x8ee3('0x20')](_0xf6ac8c[_0x8ee3('0x32')]['offset']);}_0x28c80e[_0x8ee3('0x3a')]=qs['sort'](_0xf6ac8c[_0x8ee3('0x32')]['sort']);_0x28c80e[_0x8ee3('0x3b')]=qs[_0x8ee3('0x33')](_[_0x8ee3('0x3c')](_0xf6ac8c['query'],_0x412878[_0x8ee3('0x33')]),_0x54d469);if(_0xf6ac8c[_0x8ee3('0x32')]['filter']){_0x28c80e[_0x8ee3('0x3b')]=_[_0x8ee3('0x3d')](_0x28c80e[_0x8ee3('0x3b')],{'$or':_['map'](_0x54d469,function(_0x2c6957){if(_0x2c6957['type']!==_0x8ee3('0x3e')){var _0x31d152={};_0x31d152[_0x2c6957[_0x8ee3('0x2b')]]={'$like':'%'+_0xf6ac8c['query']['filter']+'%'};return _0x31d152;}})});}_0x28c80e=_[_0x8ee3('0x3d')]({},_0x28c80e,_0xf6ac8c[_0x8ee3('0x3f')]);var _0x35b129={'where':_0x28c80e[_0x8ee3('0x3b')]};return db[_0x8ee3('0x40')][_0x8ee3('0x23')](_0x35b129)['then'](function(_0x32a11a){_0x4c593c[_0x8ee3('0x23')]=_0x32a11a;if(_0xf6ac8c[_0x8ee3('0x32')][_0x8ee3('0x41')]){_0x28c80e[_0x8ee3('0x42')]=[{'all':!![]}];}return db[_0x8ee3('0x40')][_0x8ee3('0x43')](_0x28c80e);})[_0x8ee3('0x28')](function(_0x1e0061){_0x4c593c[_0x8ee3('0x44')]=_0x1e0061;return _0x4c593c;})[_0x8ee3('0x28')](respondWithFilteredResult(_0x2ae76d,_0x28c80e))[_0x8ee3('0x45')](handleError(_0x2ae76d,null));};exports[_0x8ee3('0x46')]=function(_0x2b0625,_0x6ccbc1){var _0x619093={'raw':![],'where':{'id':_0x2b0625['params']['id']}},_0x186a6d={};_0x186a6d[_0x8ee3('0x2f')]=_[_0x8ee3('0x47')](db['VoiceRecording'][_0x8ee3('0x2e')]);_0x186a6d['query']=_['keys'](_0x2b0625[_0x8ee3('0x32')]);_0x186a6d['filters']=_['intersection'](_0x186a6d[_0x8ee3('0x2f')],_0x186a6d[_0x8ee3('0x32')]);_0x619093[_0x8ee3('0x36')]=_[_0x8ee3('0x34')](_0x186a6d[_0x8ee3('0x2f')],qs[_0x8ee3('0x35')](_0x2b0625[_0x8ee3('0x32')]['fields']));_0x619093[_0x8ee3('0x36')]=_0x619093[_0x8ee3('0x36')]['length']?_0x619093[_0x8ee3('0x36')]:_0x186a6d[_0x8ee3('0x2f')];if(_0x2b0625[_0x8ee3('0x32')][_0x8ee3('0x41')]){_0x619093[_0x8ee3('0x42')]=[{'all':!![]}];}_0x619093=_[_0x8ee3('0x3d')]({},_0x619093,_0x2b0625[_0x8ee3('0x3f')]);return db[_0x8ee3('0x40')]['find'](_0x619093)['then'](handleEntityNotFound(_0x6ccbc1,null))[_0x8ee3('0x28')](respondWithResult(_0x6ccbc1,null))[_0x8ee3('0x45')](handleError(_0x6ccbc1,null));};exports['create']=function(_0x332346,_0x4ba718){return db[_0x8ee3('0x40')][_0x8ee3('0x48')](_0x332346[_0x8ee3('0x49')],{})['then'](respondWithResult(_0x4ba718,0xc9))[_0x8ee3('0x45')](handleError(_0x4ba718,null));};exports[_0x8ee3('0x4a')]=function(_0x217ad6,_0x3345ef){if(_0x217ad6[_0x8ee3('0x49')]['id']){delete _0x217ad6['body']['id'];}return db[_0x8ee3('0x40')][_0x8ee3('0x4b')]({'where':{'id':_0x217ad6[_0x8ee3('0x4c')]['id']}})[_0x8ee3('0x28')](handleEntityNotFound(_0x3345ef,null))[_0x8ee3('0x28')](saveUpdates(_0x217ad6[_0x8ee3('0x49')],null))[_0x8ee3('0x28')](respondWithResult(_0x3345ef,null))[_0x8ee3('0x45')](handleError(_0x3345ef,null));};exports[_0x8ee3('0x4d')]=function(_0x262dd8,_0x2b1f6b){return db[_0x8ee3('0x40')][_0x8ee3('0x4d')]()['then'](respondWithResult(_0x2b1f6b,null))[_0x8ee3('0x45')](handleError(_0x2b1f6b,null));};exports[_0x8ee3('0x4e')]=function(_0x9294c3,_0x2e8b18,_0xc7d61a){var _0x37d1e7=require(_0x8ee3('0x4f'));var _0x3b8982=![];var _0x59a3ed={};if(_0x9294c3['query'][_0x8ee3('0x50')]&&_0x9294c3[_0x8ee3('0x32')]['type']==='uniqueid'){_0x59a3ed['uniqueid']=_0x9294c3[_0x8ee3('0x4c')]['id'];}else{_0x59a3ed['id']=_0x9294c3[_0x8ee3('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':_0x59a3ed,'attributes':['id',_0x8ee3('0x51')],'raw':!![]})[_0x8ee3('0x28')](handleEntityNotFound(_0x2e8b18,null))[_0x8ee3('0x28')](function(_0x19fb03){if(_0x19fb03){var _0x2a31bf=_0x19fb03['value'];var _0x274bf3=util['format'](_0x8ee3('0x52'),_0x2a31bf);if(fs[_0x8ee3('0x53')](_0x274bf3)){_0x3b8982=!![];return _0x37d1e7[_0x8ee3('0x54')](_0x274bf3,_0x2a31bf,config[_0x8ee3('0x55')]['recording'])[_0x8ee3('0x28')](function(){return _0x19fb03;});}return _0x19fb03;}})['then'](function(_0x4cc601){if(_0x4cc601){var _0x58e75f=_0x4cc601[_0x8ee3('0x51')];if(!fs['existsSync'](_0x58e75f)){throw new db['Sequelize'][(_0x8ee3('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x4cc601[_0x8ee3('0x57')]){return _0x2e8b18[_0x8ee3('0x4e')](_0x58e75f,_0x4cc601[_0x8ee3('0x57')]+path[_0x8ee3('0x58')](_0x58e75f),function(){if(_0x3b8982){fs[_0x8ee3('0x59')](_0x58e75f);}});}else{return _0x2e8b18[_0x8ee3('0x4e')](_0x58e75f,function(_0x147ce1){if(_0x3b8982){fs['unlink'](_0x58e75f);}});}}})[_0x8ee3('0x45')](function(_0x290f7a){if(_0x290f7a[_0x8ee3('0x5a')]===_0x8ee3('0x5b')){_0x2e8b18[_0x8ee3('0x1d')](0x194)[_0x8ee3('0x5c')](_0x8ee3('0x5d'));}else{return handleError(_0x2e8b18,null);}});};exports[_0x8ee3('0x5e')]=function(_0x486608,_0xc6c81c,_0x12cb73){var _0x401389=require(_0x8ee3('0x4f'));var _0x254a93=![];var _0x4152da={'$and':[db['sequelize'][_0x8ee3('0x3b')](db['sequelize']['fn'](_0x8ee3('0x5f'),db[_0x8ee3('0x60')][_0x8ee3('0x61')](_0x8ee3('0x62'))),_0x486608[_0x8ee3('0x32')][_0x8ee3('0x63')])]};if(_0x486608[_0x8ee3('0x32')][_0x8ee3('0x50')]&&_0x486608[_0x8ee3('0x32')]['type']==='uniqueid'){_0x4152da[_0x8ee3('0x64')][_0x8ee3('0x65')]({'uniqueid':_0x486608[_0x8ee3('0x4c')]['id']});}else{_0x4152da['$and'][_0x8ee3('0x65')]({'id':_0x486608[_0x8ee3('0x4c')]['id']});}return db[_0x8ee3('0x40')]['find']({'where':_0x4152da,'attributes':['id',_0x8ee3('0x51')],'raw':!![]})[_0x8ee3('0x28')](handleEntityNotFound(_0xc6c81c,null))['then'](function(_0x4e64c6){if(_0x4e64c6){var _0xd0d96b=util[_0x8ee3('0x31')]('%s.cypher',_0x4e64c6[_0x8ee3('0x51')]);if(fs[_0x8ee3('0x53')](_0xd0d96b)){_0x254a93=!![];return _0x401389['decryptFile'](_0xd0d96b,_0x4e64c6[_0x8ee3('0x51')],config[_0x8ee3('0x55')][_0x8ee3('0x66')])[_0x8ee3('0x28')](function(){return _0x4e64c6;});}return _0x4e64c6;}})['then'](function(_0x3bc2ae){if(_0x3bc2ae){if(!fs[_0x8ee3('0x53')](_0x3bc2ae['value'])){throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x5b'));}if(_0x3bc2ae[_0x8ee3('0x57')]){return _0xc6c81c['download'](_0x3bc2ae[_0x8ee3('0x51')],_0x3bc2ae[_0x8ee3('0x57')]+path[_0x8ee3('0x58')](_0x3bc2ae[_0x8ee3('0x51')]),function(){if(_0x254a93){fs[_0x8ee3('0x59')](_0x3bc2ae[_0x8ee3('0x51')]);}});}else{return _0xc6c81c[_0x8ee3('0x4e')](_0x3bc2ae[_0x8ee3('0x51')],function(_0x1d95e9){if(_0x254a93){fs[_0x8ee3('0x59')](_0x3bc2ae[_0x8ee3('0x51')]);}});}}})[_0x8ee3('0x45')](handleError(_0xc6c81c,null));};exports[_0x8ee3('0x68')]=function(_0x2c817a,_0x518906){return db[_0x8ee3('0x40')][_0x8ee3('0x4b')]({'where':{'id':_0x2c817a[_0x8ee3('0x4c')]['id']}})['then'](function(_0xf96cd1){if(_[_0x8ee3('0x69')](_0xf96cd1)){throw new ReferenceError(_0x8ee3('0x6a'));}return _0xf96cd1;})[_0x8ee3('0x28')](function(_0x1937df){var _0x4af1d0=_0x1937df[_0x8ee3('0x51')];logger[_0x8ee3('0x6b')]('cancellazione\x20fisica\x20documento\x20%s',_0x4af1d0);if(!_['isNil'](_0x1937df['value'])&&fs['existsSync'](_0x4af1d0)){logger[_0x8ee3('0x6b')]('File:\x20\x22'+_0x4af1d0+_0x8ee3('0x6c'));fs[_0x8ee3('0x6d')](_0x4af1d0);}_0x4af1d0=_0x4af1d0+_0x8ee3('0x6e');if(!_['isNil'](_0x1937df[_0x8ee3('0x51')])&&fs['existsSync'](_0x4af1d0)){logger[_0x8ee3('0x6b')](_0x8ee3('0x6f')+_0x4af1d0+_0x8ee3('0x6c'));fs[_0x8ee3('0x6d')](_0x4af1d0);}return _0x1937df;})[_0x8ee3('0x28')](function(_0x38bca7){if(!_0x38bca7)throw new InternalError();return _0x38bca7[_0x8ee3('0x68')]();})[_0x8ee3('0x28')](function(){_0x518906[_0x8ee3('0x1d')](0xcc)[_0x8ee3('0x1e')]();})[_0x8ee3('0x45')](handleError(_0x518906,null));};function getBucketslist(_0x5d73c8,_0x41e140,_0x804efd){return new Promise(function(_0x20812e,_0x1ad3de){var _0xe5d036=new AWS['S3']({'accessKeyId':_0x41e140,'secretAccessKey':_0x5d73c8,'region':_0x804efd});_0xe5d036[_0x8ee3('0x70')]({},function(_0x5063c9,_0xd56484){if(_0x5063c9){return _0x1ad3de(_0x5063c9);}else{return _0x20812e(_0xd56484);}});});}function createBucket(_0x4c602b,_0x28f772,_0xab142b,_0x274c9a){return new Promise(function(_0x5329d2,_0x3813b6){var _0x2d0ba2=new AWS['S3']({'accessKeyId':_0x28f772,'secretAccessKey':_0x4c602b,'region':_0xab142b});_0x2d0ba2[_0x8ee3('0x71')]({'Bucket':_0x274c9a},function(_0x581b52,_0x40c075){if(_0x581b52){return _0x3813b6(_0x581b52);}else{return _0x5329d2(_0x40c075);}});});}function uploadFile(_0x4681b5,_0x26b14f,_0x3f48eb,_0x2a559b,_0x1e93b5,_0x55c06b){return new Promise(function(_0x223cd8,_0x3df59d){var _0x24b9f3=new AWS['S3']({'accessKeyId':_0x26b14f,'secretAccessKey':_0x4681b5,'region':_0x3f48eb});_0x24b9f3[_0x8ee3('0x72')]({'Bucket':_0x2a559b,'Key':_0x1e93b5,'Body':_0x55c06b},function(_0x8cf704,_0x3404ca){if(_0x8cf704){return _0x3df59d(_0x8cf704);}else{return _0x223cd8(_0x3404ca);}});});}function startTranscribe(_0x1c9036,_0x5d85cd,_0x3464aa,_0x12e3c7,_0x11c774,_0xe5451c){return new Promise(function(_0x412240,_0x1558c4){var _0x5015bb=new AWS['TranscribeService']({'accessKeyId':_0x5d85cd,'secretAccessKey':_0x1c9036,'region':_0x3464aa});_0x5015bb[_0x8ee3('0x73')]({'TranscriptionJobName':_0x12e3c7,'LanguageCode':_0x11c774,'Media':{'MediaFileUri':_0xe5451c}},function(_0x2cae51,_0x4cef39){if(_0x2cae51){return _0x1558c4(_0x2cae51);}else{return _0x412240(_0x4cef39);}});});}function transcribe(_0x22ac38,_0x52c1cf,_0x1aca84,_0x28c0a4,_0x266f7c,_0x3c119d,_0x2ad548){return new Promise(function(_0x57185a,_0x2d04b8){var _0x5f3df0={};logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x74'),_0x22ac38,_0x266f7c));return uploadFile(_0x52c1cf,_0x1aca84,_0x28c0a4,_0x266f7c,path['basename'](_0x3c119d),fs[_0x8ee3('0x75')](_0x3c119d))[_0x8ee3('0x28')](function(_0xcffcbc){logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x76'),_0x22ac38,_0x266f7c,_0xcffcbc['Location']));_0x5f3df0['bucket']=_0xcffcbc[_0x8ee3('0x77')];_0x5f3df0[_0x8ee3('0x78')]=_0xcffcbc[_0x8ee3('0x79')];logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x22ac38));return startTranscribe(_0x52c1cf,_0x1aca84,_0x28c0a4,uuidv4(),_0x2ad548,_0xcffcbc[_0x8ee3('0x79')]);})[_0x8ee3('0x28')](function(_0x11439d){logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x7a'),_0x22ac38,_0x11439d[_0x8ee3('0x7b')][_0x8ee3('0x7c')]));_0x5f3df0[_0x8ee3('0x7d')]=_0x11439d[_0x8ee3('0x7b')][_0x8ee3('0x7c')];_0x5f3df0[_0x8ee3('0x7e')]=_0x11439d[_0x8ee3('0x7b')][_0x8ee3('0x7f')];return _0x57185a(_0x5f3df0);})[_0x8ee3('0x45')](function(_0x2ba52a){return _0x2d04b8(_0x2ba52a);});});}exports[_0x8ee3('0x80')]=function(_0x309348,_0x21ebe4,_0x1014e8){var _0x31abdd;var _0x5d0fbe;var _0x3e44eb;var _0x1bd7d9=require(_0x8ee3('0x4f'));return db[_0x8ee3('0x40')][_0x8ee3('0x81')]({'where':{'id':_0x309348['params']['id']}})['then'](function(_0x4bbcbc){if(_0x4bbcbc){var _0x554cca=util[_0x8ee3('0x31')](_0x8ee3('0x52'),_0x4bbcbc[_0x8ee3('0x51')]);if(fs[_0x8ee3('0x53')](_0x554cca)){cypher=!![];return _0x1bd7d9[_0x8ee3('0x54')](_0x554cca,_0x4bbcbc[_0x8ee3('0x51')],config['secrets'][_0x8ee3('0x66')])[_0x8ee3('0x28')](function(){return _0x4bbcbc;});}return _0x4bbcbc;}})[_0x8ee3('0x28')](function(_0x18cc83){if(!_0x18cc83){throw new db[(_0x8ee3('0x67'))]['ValidationError'](_0x8ee3('0x82'));}_0x5d0fbe=_0x18cc83;return db[_0x8ee3('0x83')]['findOne']({'where':{'id':0x1}});})[_0x8ee3('0x28')](handleEntityNotFound(_0x21ebe4,null))[_0x8ee3('0x28')](function(_0x6e0930){if(_0x6e0930){_0x31abdd=_0x6e0930;if(!_0x31abdd['transcribe']||!_0x31abdd[_0x8ee3('0x84')]||!_0x31abdd[_0x8ee3('0x85')]||!_0x31abdd['language']||!_0x31abdd['bucket']){throw new db['Sequelize'][(_0x8ee3('0x56'))](_0x8ee3('0x86'));}if(_0x309348[_0x8ee3('0x49')][_0x8ee3('0x87')]&&(!_0x31abdd[_0x8ee3('0x88')]||!_0x31abdd['sentimentAccountId']||!_0x31abdd['sentimentRegion']||!_0x31abdd[_0x8ee3('0x89')]||!_0x31abdd['bucket'])){throw new db['Sequelize'][(_0x8ee3('0x56'))](_0x8ee3('0x8a'));}return db[_0x8ee3('0x8b')][_0x8ee3('0x81')]({'where':{'id':_0x31abdd[_0x8ee3('0x84')]}});}})[_0x8ee3('0x28')](function(_0x65fcc4){if(!_0x65fcc4){throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x8c'));}if(!_0x65fcc4[_0x8ee3('0x8d')]||!_0x65fcc4[_0x8ee3('0x8e')]){throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x8f'));}_0x3e44eb=_0x65fcc4;return getBucketslist(_0x3e44eb['data1'],_0x3e44eb[_0x8ee3('0x8e')],_0x31abdd[_0x8ee3('0x85')]);})['then'](function(_0x5622db){if(_0x5622db&&_0x5622db['Buckets']){var _0x2e99e6=_[_0x8ee3('0x4b')](_0x5622db[_0x8ee3('0x90')],function(_0x22a84c){return _0x22a84c['Name']===_0x31abdd[_0x8ee3('0x91')];});if(!_0x2e99e6){logger['info'](util[_0x8ee3('0x31')](_0x8ee3('0x92'),_0x309348[_0x8ee3('0x4c')]['id'],_0x31abdd['bucket']));return createBucket(_0x3e44eb[_0x8ee3('0x8d')],_0x3e44eb[_0x8ee3('0x8e')],_0x31abdd[_0x8ee3('0x85')],_0x31abdd[_0x8ee3('0x91')]);}logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x93'),_0x309348['params']['id'],_0x31abdd['bucket']));return;}})[_0x8ee3('0x28')](function(_0x5c8914){if(_0x5d0fbe['transcribeStatus']===_0x8ee3('0x94')){return transcribe(_0x309348['params']['id'],_0x3e44eb['data1'],_0x3e44eb[_0x8ee3('0x8e')],_0x31abdd[_0x8ee3('0x85')],_0x31abdd[_0x8ee3('0x91')],_0x5d0fbe['value'],_0x31abdd[_0x8ee3('0x89')]);}else{logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x95'),_0x309348[_0x8ee3('0x4c')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x13b0e0){if(_0x13b0e0){_0x13b0e0['tempSentiment']=_0x309348['body'][_0x8ee3('0x87')];return _0x5d0fbe['updateAttributes'](_0x13b0e0);}})[_0x8ee3('0x28')](respondWithResult(_0x21ebe4,null))[_0x8ee3('0x45')](handleError(_0x21ebe4,null));};function writeFile(_0x485c6a,_0x32f62c){return new Promise(function(_0x42da2d,_0x4343e1){fs[_0x8ee3('0x96')](_0x32f62c,_0x485c6a,function(_0x4618b4,_0x7a6484){if(_0x4618b4){return _0x4343e1(_0x4618b4);}else{return _0x42da2d(_0x7a6484);}});});}exports[_0x8ee3('0x97')]=function(_0x485787,_0x1b0e35,_0x4e1e2f){return db[_0x8ee3('0x40')][_0x8ee3('0x81')]({'where':{'id':_0x485787['params']['id']}})[_0x8ee3('0x28')](handleEntityNotFound(_0x1b0e35))['then'](function(_0x4ea775){if(_0x4ea775&&_0x4ea775['fileText']){var _0x23c28c=_0x4ea775[_0x8ee3('0x98')];var _0x58a834=config[_0x8ee3('0x99')]+_0x8ee3('0x9a')+_0x4ea775['id']+_0x8ee3('0x9b');if(fs[_0x8ee3('0x53')](_0x58a834)){return _0x58a834;}return writeFile(_0x23c28c,_0x58a834)[_0x8ee3('0x28')](function(){return _0x58a834;});}else{throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x9c'));}})[_0x8ee3('0x28')](function(_0x577ec7){return _0x1b0e35[_0x8ee3('0x4e')](_0x577ec7);})[_0x8ee3('0x45')](handleError(_0x1b0e35));}; \ No newline at end of file +var _0x88fa=['model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','sequelize','MD5','col','token','push','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','sentimentAccountId','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','runSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','uuid/v4','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','key'];(function(_0x3a7a0c,_0x578870){var _0x50c433=function(_0xa6a4ec){while(--_0xa6a4ec){_0x3a7a0c['push'](_0x3a7a0c['shift']());}};_0x50c433(++_0x578870);}(_0x88fa,0x194));var _0xa88f=function(_0x139428,_0x487f6b){_0x139428=_0x139428-0x0;var _0x1a2ec4=_0x88fa[_0x139428];return _0x1a2ec4;};'use strict';var emlformat=require(_0xa88f('0x0'));var rimraf=require(_0xa88f('0x1'));var zipdir=require(_0xa88f('0x2'));var jsonpatch=require(_0xa88f('0x3'));var rp=require(_0xa88f('0x4'));var moment=require(_0xa88f('0x5'));var BPromise=require(_0xa88f('0x6'));var Mustache=require(_0xa88f('0x7'));var util=require(_0xa88f('0x8'));var path=require(_0xa88f('0x9'));var sox=require(_0xa88f('0xa'));var csv=require(_0xa88f('0xb'));var ejs=require(_0xa88f('0xc'));var fs=require('fs');var fs_extra=require(_0xa88f('0xd'));var _=require(_0xa88f('0xe'));var squel=require(_0xa88f('0xf'));var crypto=require(_0xa88f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xa88f('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa88f('0x12'));var AWS=require('aws-sdk');var uuidv4=require(_0xa88f('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa88f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa88f('0x15'));var logger=require(_0xa88f('0x16'))('api');var utils=require(_0xa88f('0x17'));var config=require(_0xa88f('0x18'));var licenseUtil=require(_0xa88f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53758a,_0x586942){_0x586942=_0x586942||0xcc;return function(_0x363659){if(_0x363659){return _0x53758a[_0xa88f('0x1a')](_0x586942);}return _0x53758a[_0xa88f('0x1b')](_0x586942)[_0xa88f('0x1c')]();};}function respondWithResult(_0x2bff60,_0x37120d){_0x37120d=_0x37120d||0xc8;return function(_0x550a89){if(_0x550a89){return _0x2bff60[_0xa88f('0x1b')](_0x37120d)[_0xa88f('0x1d')](_0x550a89);}};}function respondWithFilteredResult(_0x3cb864,_0x2b4bdb){return function(_0x4bdf11){if(_0x4bdf11){var _0x3af48e=typeof _0x2b4bdb[_0xa88f('0x1e')]===_0xa88f('0x1f')&&typeof _0x2b4bdb[_0xa88f('0x20')]===_0xa88f('0x1f');var _0x37dedc=_0x4bdf11[_0xa88f('0x21')];var _0xfd6162=_0x3af48e?0x0:_0x2b4bdb[_0xa88f('0x1e')];var _0x4bdd78=_0x3af48e?_0x4bdf11[_0xa88f('0x21')]:_0x2b4bdb[_0xa88f('0x1e')]+_0x2b4bdb['limit'];var _0xd316d8;if(_0x4bdd78>=_0x37dedc){_0x4bdd78=_0x37dedc;_0xd316d8=0xc8;}else{_0xd316d8=0xce;}_0x3cb864[_0xa88f('0x1b')](_0xd316d8);return _0x3cb864[_0xa88f('0x22')]('Content-Range',_0xfd6162+'-'+_0x4bdd78+'/'+_0x37dedc)[_0xa88f('0x1d')](_0x4bdf11);}return null;};}function patchUpdates(_0x4b395a){return function(_0x52d42b){try{jsonpatch['apply'](_0x52d42b,_0x4b395a,!![]);}catch(_0x45d35f){return BPromise[_0xa88f('0x23')](_0x45d35f);}return _0x52d42b[_0xa88f('0x24')]();};}function saveUpdates(_0x2bfa51,_0x35f940){return function(_0x530e3b){if(_0x530e3b){return _0x530e3b[_0xa88f('0x25')](_0x2bfa51)[_0xa88f('0x26')](function(_0x3b281f){return _0x3b281f;});}return null;};}function removeEntity(_0x3bd445,_0xcb1e4f){return function(_0x3a6fba){if(_0x3a6fba){return _0x3a6fba[_0xa88f('0x27')]()[_0xa88f('0x26')](function(){_0x3bd445[_0xa88f('0x1b')](0xcc)[_0xa88f('0x1c')]();});}};}function handleEntityNotFound(_0x1d063b,_0x203ba1){return function(_0x4e410e){if(!_0x4e410e){_0x1d063b[_0xa88f('0x1a')](0x194);}return _0x4e410e;};}function handleError(_0x28bab2,_0x5955bb){_0x5955bb=_0x5955bb||0x1f4;return function(_0x2ce9d0){logger[_0xa88f('0x28')](_0x2ce9d0[_0xa88f('0x29')]);if(_0x2ce9d0[_0xa88f('0x2a')]){delete _0x2ce9d0[_0xa88f('0x2a')];}_0x28bab2[_0xa88f('0x1b')](_0x5955bb)[_0xa88f('0x2b')](_0x2ce9d0);};}exports['index']=function(_0x49ee90,_0x246bcb){var _0x3acacc={},_0x5de0e9={},_0x2c94f9={'count':0x0,'rows':[]};var _0x5065d1=_[_0xa88f('0x2c')](db[_0xa88f('0x2d')][_0xa88f('0x2e')],function(_0x2c7b0e){return{'name':_0x2c7b0e[_0xa88f('0x2f')],'type':_0x2c7b0e['type'][_0xa88f('0x30')]};});_0x5de0e9[_0xa88f('0x31')]=_[_0xa88f('0x32')](_[_0xa88f('0x2c')](_0x5065d1,_0xa88f('0x2a')),[_0xa88f('0x33')]);_0x5de0e9[_0xa88f('0x34')]=_['keys'](_0x49ee90[_0xa88f('0x34')]);_0x5de0e9[_0xa88f('0x35')]=_[_0xa88f('0x36')](_0x5de0e9[_0xa88f('0x31')],_0x5de0e9[_0xa88f('0x34')]);_0x3acacc[_0xa88f('0x37')]=_['intersection'](_0x5de0e9[_0xa88f('0x31')],qs['fields'](_0x49ee90[_0xa88f('0x34')][_0xa88f('0x38')]));_0x3acacc[_0xa88f('0x37')]=_0x3acacc[_0xa88f('0x37')][_0xa88f('0x39')]?_0x3acacc[_0xa88f('0x37')]:_0x5de0e9[_0xa88f('0x31')];if(!_0x49ee90[_0xa88f('0x34')][_0xa88f('0x3a')]('nolimit')){_0x3acacc[_0xa88f('0x20')]=qs[_0xa88f('0x20')](_0x49ee90[_0xa88f('0x34')][_0xa88f('0x20')]);_0x3acacc[_0xa88f('0x1e')]=qs[_0xa88f('0x1e')](_0x49ee90[_0xa88f('0x34')][_0xa88f('0x1e')]);}_0x3acacc[_0xa88f('0x3b')]=qs[_0xa88f('0x3c')](_0x49ee90[_0xa88f('0x34')]['sort']);_0x3acacc[_0xa88f('0x3d')]=qs[_0xa88f('0x35')](_['pick'](_0x49ee90[_0xa88f('0x34')],_0x5de0e9[_0xa88f('0x35')]),_0x5065d1);if(_0x49ee90[_0xa88f('0x34')][_0xa88f('0x3e')]){_0x3acacc[_0xa88f('0x3d')]=_[_0xa88f('0x3f')](_0x3acacc[_0xa88f('0x3d')],{'$or':_[_0xa88f('0x2c')](_0x5065d1,function(_0x723842){if(_0x723842[_0xa88f('0x40')]!==_0xa88f('0x41')){var _0x2d269e={};_0x2d269e[_0x723842['name']]={'$like':'%'+_0x49ee90[_0xa88f('0x34')][_0xa88f('0x3e')]+'%'};return _0x2d269e;}})});}_0x3acacc=_[_0xa88f('0x3f')]({},_0x3acacc,_0x49ee90[_0xa88f('0x42')]);var _0x3197cc={'where':_0x3acacc['where']};return db[_0xa88f('0x2d')][_0xa88f('0x21')](_0x3197cc)[_0xa88f('0x26')](function(_0x3c4032){_0x2c94f9[_0xa88f('0x21')]=_0x3c4032;if(_0x49ee90[_0xa88f('0x34')][_0xa88f('0x43')]){_0x3acacc['include']=[{'all':!![]}];}return db[_0xa88f('0x2d')][_0xa88f('0x44')](_0x3acacc);})['then'](function(_0x5e9153){_0x2c94f9[_0xa88f('0x45')]=_0x5e9153;return _0x2c94f9;})[_0xa88f('0x26')](respondWithFilteredResult(_0x246bcb,_0x3acacc))[_0xa88f('0x46')](handleError(_0x246bcb,null));};exports[_0xa88f('0x47')]=function(_0x266094,_0x4c9130){var _0xd589ee={'raw':![],'where':{'id':_0x266094[_0xa88f('0x48')]['id']}},_0x1599bd={};_0x1599bd[_0xa88f('0x31')]=_[_0xa88f('0x49')](db[_0xa88f('0x2d')][_0xa88f('0x2e')]);_0x1599bd[_0xa88f('0x34')]=_[_0xa88f('0x49')](_0x266094['query']);_0x1599bd[_0xa88f('0x35')]=_[_0xa88f('0x36')](_0x1599bd[_0xa88f('0x31')],_0x1599bd[_0xa88f('0x34')]);_0xd589ee['attributes']=_['intersection'](_0x1599bd[_0xa88f('0x31')],qs['fields'](_0x266094[_0xa88f('0x34')][_0xa88f('0x38')]));_0xd589ee[_0xa88f('0x37')]=_0xd589ee[_0xa88f('0x37')][_0xa88f('0x39')]?_0xd589ee[_0xa88f('0x37')]:_0x1599bd[_0xa88f('0x31')];if(_0x266094[_0xa88f('0x34')][_0xa88f('0x43')]){_0xd589ee['include']=[{'all':!![]}];}_0xd589ee=_[_0xa88f('0x3f')]({},_0xd589ee,_0x266094[_0xa88f('0x42')]);return db[_0xa88f('0x2d')]['find'](_0xd589ee)[_0xa88f('0x26')](handleEntityNotFound(_0x4c9130,null))[_0xa88f('0x26')](respondWithResult(_0x4c9130,null))['catch'](handleError(_0x4c9130,null));};exports[_0xa88f('0x4a')]=function(_0x920502,_0x27d28d){return db[_0xa88f('0x2d')][_0xa88f('0x4a')](_0x920502[_0xa88f('0x4b')],{})[_0xa88f('0x26')](respondWithResult(_0x27d28d,0xc9))[_0xa88f('0x46')](handleError(_0x27d28d,null));};exports[_0xa88f('0x25')]=function(_0xa4dbd6,_0xae576f){if(_0xa4dbd6[_0xa88f('0x4b')]['id']){delete _0xa4dbd6[_0xa88f('0x4b')]['id'];}return db[_0xa88f('0x2d')][_0xa88f('0x4c')]({'where':{'id':_0xa4dbd6[_0xa88f('0x48')]['id']}})[_0xa88f('0x26')](handleEntityNotFound(_0xae576f,null))['then'](saveUpdates(_0xa4dbd6[_0xa88f('0x4b')],null))[_0xa88f('0x26')](respondWithResult(_0xae576f,null))[_0xa88f('0x46')](handleError(_0xae576f,null));};exports[_0xa88f('0x4d')]=function(_0xd45fce,_0x1c6d9d){return db[_0xa88f('0x2d')][_0xa88f('0x4d')]()[_0xa88f('0x26')](respondWithResult(_0x1c6d9d,null))[_0xa88f('0x46')](handleError(_0x1c6d9d,null));};exports[_0xa88f('0x4e')]=function(_0x1aa31e,_0x18fb1e,_0x1ba744){var _0x54d29e=require(_0xa88f('0x4f'));var _0x5a5c5f=![];var _0x2492f3={};if(_0x1aa31e['query']['type']&&_0x1aa31e[_0xa88f('0x34')]['type']===_0xa88f('0x50')){_0x2492f3[_0xa88f('0x50')]=_0x1aa31e[_0xa88f('0x48')]['id'];}else{_0x2492f3['id']=_0x1aa31e[_0xa88f('0x48')]['id'];}return db[_0xa88f('0x2d')]['find']({'where':_0x2492f3,'attributes':['id',_0xa88f('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x18fb1e,null))['then'](function(_0x236368){if(_0x236368){var _0xc21bbf=_0x236368[_0xa88f('0x51')];var _0x4dfdbd=util['format'](_0xa88f('0x52'),_0xc21bbf);if(fs[_0xa88f('0x53')](_0x4dfdbd)){_0x5a5c5f=!![];return _0x54d29e[_0xa88f('0x54')](_0x4dfdbd,_0xc21bbf,config[_0xa88f('0x55')][_0xa88f('0x56')])[_0xa88f('0x26')](function(){return _0x236368;});}return _0x236368;}})['then'](function(_0x5a354b){if(_0x5a354b){var _0x41ba8d=_0x5a354b[_0xa88f('0x51')];if(!fs['existsSync'](_0x41ba8d)){throw new db[(_0xa88f('0x57'))][(_0xa88f('0x58'))](_0xa88f('0x59'));}if(_0x5a354b[_0xa88f('0x5a')]){return _0x18fb1e['download'](_0x41ba8d,_0x5a354b[_0xa88f('0x5a')]+path['extname'](_0x41ba8d),function(){if(_0x5a5c5f){fs[_0xa88f('0x5b')](_0x41ba8d);}});}else{return _0x18fb1e['download'](_0x41ba8d,function(_0x56fec9){if(_0x5a5c5f){fs[_0xa88f('0x5b')](_0x41ba8d);}});}}})[_0xa88f('0x46')](function(_0x24a2e8){if(_0x24a2e8['message']==='VoiceRecording\x20not\x20found'){_0x18fb1e['status'](0x194)[_0xa88f('0x2b')](_0xa88f('0x5c'));}else{return handleError(_0x18fb1e,null);}});};exports[_0xa88f('0x5d')]=function(_0x355d4e,_0xc220b0,_0x2a42b3){var _0x41cca8=require('../../components/encryptor');var _0x447fad=![];var _0x121e5e={'$and':[db[_0xa88f('0x5e')][_0xa88f('0x3d')](db[_0xa88f('0x5e')]['fn'](_0xa88f('0x5f'),db[_0xa88f('0x5e')][_0xa88f('0x60')](_0xa88f('0x50'))),_0x355d4e['query'][_0xa88f('0x61')])]};if(_0x355d4e[_0xa88f('0x34')][_0xa88f('0x40')]&&_0x355d4e[_0xa88f('0x34')][_0xa88f('0x40')]===_0xa88f('0x50')){_0x121e5e['$and'][_0xa88f('0x62')]({'uniqueid':_0x355d4e['params']['id']});}else{_0x121e5e['$and'][_0xa88f('0x62')]({'id':_0x355d4e[_0xa88f('0x48')]['id']});}return db[_0xa88f('0x2d')][_0xa88f('0x4c')]({'where':_0x121e5e,'attributes':['id',_0xa88f('0x51')],'raw':!![]})[_0xa88f('0x26')](handleEntityNotFound(_0xc220b0,null))[_0xa88f('0x26')](function(_0x2531b9){if(_0x2531b9){var _0x576adf=util[_0xa88f('0x33')]('%s.cypher',_0x2531b9[_0xa88f('0x51')]);if(fs[_0xa88f('0x53')](_0x576adf)){_0x447fad=!![];return _0x41cca8[_0xa88f('0x54')](_0x576adf,_0x2531b9['value'],config['secrets'][_0xa88f('0x56')])[_0xa88f('0x26')](function(){return _0x2531b9;});}return _0x2531b9;}})[_0xa88f('0x26')](function(_0x17636c){if(_0x17636c){if(!fs['existsSync'](_0x17636c[_0xa88f('0x51')])){throw new db[(_0xa88f('0x57'))][(_0xa88f('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x17636c[_0xa88f('0x5a')]){return _0xc220b0[_0xa88f('0x4e')](_0x17636c[_0xa88f('0x51')],_0x17636c[_0xa88f('0x5a')]+path[_0xa88f('0x63')](_0x17636c[_0xa88f('0x51')]),function(){if(_0x447fad){fs['unlink'](_0x17636c[_0xa88f('0x51')]);}});}else{return _0xc220b0['download'](_0x17636c['value'],function(_0x1fad83){if(_0x447fad){fs[_0xa88f('0x5b')](_0x17636c['value']);}});}}})[_0xa88f('0x46')](handleError(_0xc220b0,null));};exports[_0xa88f('0x27')]=function(_0x1a34aa,_0x5b277a){return db[_0xa88f('0x2d')]['find']({'where':{'id':_0x1a34aa[_0xa88f('0x48')]['id']}})[_0xa88f('0x26')](function(_0x5da7ec){if(_[_0xa88f('0x64')](_0x5da7ec)){throw new ReferenceError(_0xa88f('0x65'));}return _0x5da7ec;})[_0xa88f('0x26')](function(_0x115eeb){var _0x515c5e=_0x115eeb['value'];logger[_0xa88f('0x66')](_0xa88f('0x67'),_0x515c5e);if(!_[_0xa88f('0x64')](_0x115eeb['value'])&&fs['existsSync'](_0x515c5e)){logger['info'](_0xa88f('0x68')+_0x515c5e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa88f('0x69')](_0x515c5e);}_0x515c5e=_0x515c5e+_0xa88f('0x6a');if(!_[_0xa88f('0x64')](_0x115eeb['value'])&&fs[_0xa88f('0x53')](_0x515c5e)){logger[_0xa88f('0x66')](_0xa88f('0x68')+_0x515c5e+_0xa88f('0x6b'));fs[_0xa88f('0x69')](_0x515c5e);}return _0x115eeb;})[_0xa88f('0x26')](function(_0x37472c){if(!_0x37472c)throw new InternalError();return _0x37472c[_0xa88f('0x27')]();})[_0xa88f('0x26')](function(){_0x5b277a[_0xa88f('0x1b')](0xcc)[_0xa88f('0x1c')]();})[_0xa88f('0x46')](handleError(_0x5b277a,null));};function getBucketslist(_0x1ec646,_0x589e94,_0x2dccbd){return new Promise(function(_0x54687e,_0x2de3f9){var _0x20d9ba=new AWS['S3']({'accessKeyId':_0x589e94,'secretAccessKey':_0x1ec646,'region':_0x2dccbd});_0x20d9ba[_0xa88f('0x6c')]({},function(_0x28437d,_0x4b1d45){if(_0x28437d){return _0x2de3f9(_0x28437d);}else{return _0x54687e(_0x4b1d45);}});});}function createBucket(_0x363593,_0x359f8b,_0x4c5fb2,_0x271779){return new Promise(function(_0x37447d,_0x57d25f){var _0x338577=new AWS['S3']({'accessKeyId':_0x359f8b,'secretAccessKey':_0x363593,'region':_0x4c5fb2});_0x338577[_0xa88f('0x6d')]({'Bucket':_0x271779},function(_0x26f6db,_0x989c99){if(_0x26f6db){return _0x57d25f(_0x26f6db);}else{return _0x37447d(_0x989c99);}});});}function uploadFile(_0x52a3fc,_0x38c7fc,_0x29d7fa,_0x2f2ad4,_0x56811b,_0x5eccec){return new Promise(function(_0x1ec298,_0x2fef4f){var _0x42b641=new AWS['S3']({'accessKeyId':_0x38c7fc,'secretAccessKey':_0x52a3fc,'region':_0x29d7fa});_0x42b641[_0xa88f('0x6e')]({'Bucket':_0x2f2ad4,'Key':_0x56811b,'Body':_0x5eccec},function(_0x59d1b6,_0x3da981){if(_0x59d1b6){return _0x2fef4f(_0x59d1b6);}else{return _0x1ec298(_0x3da981);}});});}function startTranscribe(_0x221f6e,_0x4927cf,_0x494bce,_0x1b6632,_0x32d782,_0x3d19d0){return new Promise(function(_0x220894,_0x33df45){var _0x3e4a69=new AWS[(_0xa88f('0x6f'))]({'accessKeyId':_0x4927cf,'secretAccessKey':_0x221f6e,'region':_0x494bce});_0x3e4a69['startTranscriptionJob']({'TranscriptionJobName':_0x1b6632,'LanguageCode':_0x32d782,'Media':{'MediaFileUri':_0x3d19d0}},function(_0x1bec82,_0x5f5299){if(_0x1bec82){return _0x33df45(_0x1bec82);}else{return _0x220894(_0x5f5299);}});});}function transcribe(_0x4dbbc6,_0x1d0835,_0x4b40be,_0x23b191,_0x5ace65,_0x2ef03d,_0x166cea){return new Promise(function(_0x23f1aa,_0x27979e){var _0x48babe={};logger[_0xa88f('0x66')](util[_0xa88f('0x33')](_0xa88f('0x70'),_0x4dbbc6,_0x5ace65));return uploadFile(_0x1d0835,_0x4b40be,_0x23b191,_0x5ace65,path['basename'](_0x2ef03d),fs['readFileSync'](_0x2ef03d))[_0xa88f('0x26')](function(_0x241413){logger[_0xa88f('0x66')](util['format'](_0xa88f('0x71'),_0x4dbbc6,_0x5ace65,_0x241413[_0xa88f('0x72')]));_0x48babe['bucket']=_0x241413[_0xa88f('0x73')];_0x48babe[_0xa88f('0x74')]=_0x241413[_0xa88f('0x72')];logger[_0xa88f('0x66')](util[_0xa88f('0x33')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4dbbc6));return startTranscribe(_0x1d0835,_0x4b40be,_0x23b191,uuidv4(),_0x166cea,_0x241413['Location']);})[_0xa88f('0x26')](function(_0x3ff543){logger[_0xa88f('0x66')](util[_0xa88f('0x33')](_0xa88f('0x75'),_0x4dbbc6,_0x3ff543[_0xa88f('0x76')][_0xa88f('0x77')]));_0x48babe[_0xa88f('0x78')]=_0x3ff543['TranscriptionJob'][_0xa88f('0x77')];_0x48babe[_0xa88f('0x79')]=_0x3ff543[_0xa88f('0x76')][_0xa88f('0x7a')];return _0x23f1aa(_0x48babe);})[_0xa88f('0x46')](function(_0x895092){return _0x27979e(_0x895092);});});}exports[_0xa88f('0x7b')]=function(_0x496e5a,_0x19ba08,_0x1bf8eb){var _0x7d47b6;var _0x4a6fef;var _0x281ffa;var _0x15c948=require('../../components/encryptor');return db[_0xa88f('0x2d')][_0xa88f('0x7c')]({'where':{'id':_0x496e5a[_0xa88f('0x48')]['id']}})[_0xa88f('0x26')](function(_0x281291){if(_0x281291){var _0x452355=util[_0xa88f('0x33')](_0xa88f('0x52'),_0x281291[_0xa88f('0x51')]);if(fs['existsSync'](_0x452355)){cypher=!![];return _0x15c948[_0xa88f('0x54')](_0x452355,_0x281291[_0xa88f('0x51')],config['secrets'][_0xa88f('0x56')])[_0xa88f('0x26')](function(){return _0x281291;});}return _0x281291;}})[_0xa88f('0x26')](function(_0x17fe00){if(!_0x17fe00){throw new db[(_0xa88f('0x57'))][(_0xa88f('0x58'))](_0xa88f('0x7d'));}_0x4a6fef=_0x17fe00;return db[_0xa88f('0x7e')][_0xa88f('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x19ba08,null))[_0xa88f('0x26')](function(_0x56538c){if(_0x56538c){_0x7d47b6=_0x56538c;if(!_0x7d47b6[_0xa88f('0x7f')]||!_0x7d47b6['transcribeAccountId']||!_0x7d47b6[_0xa88f('0x80')]||!_0x7d47b6[_0xa88f('0x81')]||!_0x7d47b6['bucket']){throw new db[(_0xa88f('0x57'))]['ValidationError'](_0xa88f('0x82'));}if(_0x496e5a[_0xa88f('0x4b')]['runSentiment']&&(!_0x7d47b6['sentiment']||!_0x7d47b6[_0xa88f('0x83')]||!_0x7d47b6['sentimentRegion']||!_0x7d47b6[_0xa88f('0x81')]||!_0x7d47b6['bucket'])){throw new db['Sequelize'][(_0xa88f('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xa88f('0x84')]['findOne']({'where':{'id':_0x7d47b6[_0xa88f('0x85')]}});}})['then'](function(_0x53182b){if(!_0x53182b){throw new db[(_0xa88f('0x57'))][(_0xa88f('0x58'))](_0xa88f('0x86'));}if(!_0x53182b[_0xa88f('0x87')]||!_0x53182b[_0xa88f('0x88')]){throw new db[(_0xa88f('0x57'))][(_0xa88f('0x58'))](_0xa88f('0x89'));}_0x281ffa=_0x53182b;return getBucketslist(_0x281ffa['data1'],_0x281ffa['data2'],_0x7d47b6[_0xa88f('0x80')]);})[_0xa88f('0x26')](function(_0x48b28e){if(_0x48b28e&&_0x48b28e[_0xa88f('0x8a')]){var _0x37f5f4=_[_0xa88f('0x4c')](_0x48b28e[_0xa88f('0x8a')],function(_0x4bbcb7){return _0x4bbcb7[_0xa88f('0x8b')]===_0x7d47b6['bucket'];});if(!_0x37f5f4){logger[_0xa88f('0x66')](util[_0xa88f('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x496e5a[_0xa88f('0x48')]['id'],_0x7d47b6[_0xa88f('0x8c')]));return createBucket(_0x281ffa[_0xa88f('0x87')],_0x281ffa[_0xa88f('0x88')],_0x7d47b6['transcribeRegion'],_0x7d47b6[_0xa88f('0x8c')]);}logger[_0xa88f('0x66')](util[_0xa88f('0x33')](_0xa88f('0x8d'),_0x496e5a[_0xa88f('0x48')]['id'],_0x7d47b6[_0xa88f('0x8c')]));return;}})[_0xa88f('0x26')](function(_0xfa5efe){if(_0x4a6fef[_0xa88f('0x79')]===_0xa88f('0x8e')){return transcribe(_0x496e5a[_0xa88f('0x48')]['id'],_0x281ffa[_0xa88f('0x87')],_0x281ffa['data2'],_0x7d47b6[_0xa88f('0x80')],_0x7d47b6['bucket'],_0x4a6fef[_0xa88f('0x51')],_0x7d47b6[_0xa88f('0x81')]);}else{logger['info'](util[_0xa88f('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x496e5a[_0xa88f('0x48')]['id']));return{'transcribeStatus':_0xa88f('0x8f')};}})['then'](function(_0x527953){if(_0x527953){_0x527953['tempSentiment']=_0x496e5a[_0xa88f('0x4b')][_0xa88f('0x90')];return _0x4a6fef['updateAttributes'](_0x527953);}})[_0xa88f('0x26')](respondWithResult(_0x19ba08,null))[_0xa88f('0x46')](handleError(_0x19ba08,null));};function writeFile(_0x4f29c9,_0x19e6cb){return new Promise(function(_0x1e1470,_0x3a7183){fs[_0xa88f('0x91')](_0x19e6cb,_0x4f29c9,function(_0x3cd045,_0x290b97){if(_0x3cd045){return _0x3a7183(_0x3cd045);}else{return _0x1e1470(_0x290b97);}});});}exports['downloadTranscribe']=function(_0x10cae2,_0x2488ea,_0x9d2055){return db[_0xa88f('0x2d')]['findOne']({'where':{'id':_0x10cae2['params']['id']}})[_0xa88f('0x26')](handleEntityNotFound(_0x2488ea))[_0xa88f('0x26')](function(_0x5e4d73){if(_0x5e4d73&&_0x5e4d73[_0xa88f('0x92')]){var _0x4d1e05=_0x5e4d73[_0xa88f('0x92')];var _0x222f52=config[_0xa88f('0x93')]+_0xa88f('0x94')+_0x5e4d73['id']+_0xa88f('0x95');if(fs[_0xa88f('0x53')](_0x222f52)){return _0x222f52;}return writeFile(_0x4d1e05,_0x222f52)[_0xa88f('0x26')](function(){return _0x222f52;});}else{throw new db[(_0xa88f('0x57'))]['ValidationError'](_0xa88f('0x96'));}})['then'](function(_0x5ab7a9){return _0x2488ea[_0xa88f('0x4e')](_0x5ab7a9);})[_0xa88f('0x46')](handleError(_0x2488ea));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 19edebc..60640db 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 _0x3b75=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0xf06a64,_0x1fc0c7){var _0x1d1206=function(_0x4a481f){while(--_0x4a481f){_0xf06a64['push'](_0xf06a64['shift']());}};_0x1d1206(++_0x1fc0c7);}(_0x3b75,0x144));var _0x53b7=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x3b75[_0x22e9fe];return _0x47cd19;};'use strict';var attributes=require(_0x53b7('0x0'));module[_0x53b7('0x1')]=function(_0x43da7f,_0x9db663){return _0x43da7f[_0x53b7('0x2')](_0x53b7('0x3'),attributes,{'tableName':_0x53b7('0x4'),'paranoid':![],'indexes':[{'name':_0x53b7('0x5'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0x53b7('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ed=['transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x34b57c,_0x97c5c9){var _0x2ac76b=function(_0x57bd89){while(--_0x57bd89){_0x34b57c['push'](_0x34b57c['shift']());}};_0x2ac76b(++_0x97c5c9);}(_0xe3ed,0x8d));var _0xde3e=function(_0x360f88,_0x283a44){_0x360f88=_0x360f88-0x0;var _0x229666=_0xe3ed[_0x360f88];return _0x229666;};'use strict';var attributes=require(_0xde3e('0x0'));module[_0xde3e('0x1')]=function(_0x175db2,_0x12f7b7){return _0x175db2[_0xde3e('0x2')](_0xde3e('0x3'),attributes,{'tableName':_0xde3e('0x4'),'paranoid':![],'indexes':[{'name':_0xde3e('0x5'),'fields':['uniqueid']},{'name':_0xde3e('0x6'),'fields':[_0xde3e('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 060bacd..604bd20 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 _0xdf55=['create','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','info','result','catch','UpdateVoiceRecording','update','options','raw','attributes','limit','debug','stringify','CreateVoiceRecording','findOne','callRecordingEncryption'];(function(_0x22b1ec,_0x5cb1be){var _0x48a2b4=function(_0x4607fd){while(--_0x4607fd){_0x22b1ec['push'](_0x22b1ec['shift']());}};_0x48a2b4(++_0x5cb1be);}(_0xdf55,0x83));var _0x5df5=function(_0x2afccc,_0x443a1a){_0x2afccc=_0x2afccc-0x0;var _0x485666=_0xdf55[_0x2afccc];return _0x485666;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['VoiceRecording'][_0x5df5('0x17')](_0xb7e1c2['body'],{'raw':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')]['where']||null:null,'attributes':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null})['then'](function(_0x2e99a1){logger[_0x5df5('0x13')](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x1c')]('UpdateVoiceRecording',_0xb7e1c2,JSON[_0x5df5('0x1d')](_0x2e99a1));_0x215d59(_0x2e99a1);})[_0x5df5('0x15')](function(_0x395f3e){logger['error']('UpdateVoiceRecording',_0x395f3e['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0x395f3e[_0x5df5('0x12')]));});});};exports[_0x5df5('0x1e')]=function(_0xa7f4b3){var _0x1baf52=this;return new Promise(function(_0x1fd83c,_0x210d20){var _0x28723e=require('../../components/encryptor');var _0x18bb61;return db['Setting'][_0x5df5('0x1f')]({'attributes':['id',_0x5df5('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3854d0){_0x18bb61=_0x3854d0;return db['VoiceRecording'][_0x5df5('0x21')](_0xa7f4b3['body']);})[_0x5df5('0xc')](function(_0x4afe36){if(_0x18bb61[_0x5df5('0x20')]&&fs['existsSync'](_0x4afe36[_0x5df5('0x22')])){var _0x47bebb=util[_0x5df5('0x23')]('%s.cypher',_0x4afe36[_0x5df5('0x22')]);return _0x28723e[_0x5df5('0x24')](_0x4afe36[_0x5df5('0x22')],_0x47bebb,config[_0x5df5('0x25')][_0x5df5('0x26')])[_0x5df5('0xc')](function(){fs[_0x5df5('0x27')](_0x4afe36['value']);logger['info'](_0x5df5('0x28'));return _0x4afe36;});}return _0x4afe36;})[_0x5df5('0xc')](function(_0x3bbd2b){logger[_0x5df5('0x13')](_0x5df5('0x1e'),_0xa7f4b3);logger[_0x5df5('0x1c')]('CreateVoiceRecording',_0xa7f4b3,JSON[_0x5df5('0x1d')](_0x3bbd2b));_0x1fd83c(_0x3bbd2b);})[_0x5df5('0x15')](function(_0x2f1001){logger[_0x5df5('0xf')]('CreateVoiceRecording',_0x2f1001[_0x5df5('0x12')],_0xa7f4b3);_0x210d20(_0x1baf52['error'](0x1f4,_0x2f1001[_0x5df5('0x12')]));});});}; \ No newline at end of file +var _0x2542=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UpdateVoiceRecording','update','body','options','raw','where','limit','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x1bc9fe,_0x1ccf60){var _0x5c9491=function(_0x31fc7a){while(--_0x31fc7a){_0x1bc9fe['push'](_0x1bc9fe['shift']());}};_0x5c9491(++_0x1ccf60);}(_0x2542,0x169));var _0x2254=function(_0x30f134,_0x257951){_0x30f134=_0x30f134-0x0;var _0x52af6e=_0x2542[_0x30f134];return _0x52af6e;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});}exports[_0x2254('0x16')]=function(_0x1ae11e){var _0x34f90e=this;return new Promise(function(_0x497724,_0x51b395){return db['VoiceRecording'][_0x2254('0x17')](_0x1ae11e[_0x2254('0x18')],{'raw':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')][_0x2254('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e['options'][_0x2254('0x1b')]||null:null,'attributes':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')]['attributes']||null:null,'limit':_0x1ae11e['options']?_0x1ae11e['options'][_0x2254('0x1c')]||null:null})[_0x2254('0xc')](function(_0xf88b56){logger['info']('UpdateVoiceRecording',_0x1ae11e);logger['debug']('UpdateVoiceRecording',_0x1ae11e,JSON['stringify'](_0xf88b56));_0x497724(_0xf88b56);})['catch'](function(_0x1aa71f){logger[_0x2254('0x14')](_0x2254('0x16'),_0x1aa71f[_0x2254('0x15')],_0x1ae11e);_0x51b395(_0x34f90e[_0x2254('0x14')](0x1f4,_0x1aa71f[_0x2254('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x4a8274){var _0x1ada42=this;return new Promise(function(_0x4f6877,_0x35608a){var _0x141dc5=require(_0x2254('0x1d'));var _0x3aa0bd;return db[_0x2254('0x1e')]['findOne']({'attributes':['id',_0x2254('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x2254('0xc')](function(_0x21285d){_0x3aa0bd=_0x21285d;return db[_0x2254('0x20')][_0x2254('0x21')](_0x4a8274[_0x2254('0x18')]);})[_0x2254('0xc')](function(_0x22e791){if(_0x3aa0bd[_0x2254('0x1f')]&&fs[_0x2254('0x22')](_0x22e791[_0x2254('0x23')])){var _0xad7774=util[_0x2254('0x24')](_0x2254('0x25'),_0x22e791[_0x2254('0x23')]);return _0x141dc5[_0x2254('0x26')](_0x22e791[_0x2254('0x23')],_0xad7774,config[_0x2254('0x27')][_0x2254('0x28')])['then'](function(){fs[_0x2254('0x29')](_0x22e791[_0x2254('0x23')]);logger[_0x2254('0xd')](_0x2254('0x2a'));return _0x22e791;});}return _0x22e791;})[_0x2254('0xc')](function(_0x1d275b){logger[_0x2254('0xd')](_0x2254('0x2b'),_0x4a8274);logger[_0x2254('0xf')]('CreateVoiceRecording',_0x4a8274,JSON[_0x2254('0x12')](_0x1d275b));_0x4f6877(_0x1d275b);})[_0x2254('0x2c')](function(_0x503540){logger[_0x2254('0x14')](_0x2254('0x2b'),_0x503540[_0x2254('0x15')],_0x4a8274);_0x35608a(_0x1ada42[_0x2254('0x14')](0x1f4,_0x503540['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 68915b2..0ac1a1f 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 _0x1d4a=['put','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x295642,_0x7b4dc5){var _0x3333db=function(_0x3a3377){while(--_0x3a3377){_0x295642['push'](_0x295642['shift']());}};_0x3333db(++_0x7b4dc5);}(_0x1d4a,0x146));var _0xa1d4=function(_0x9aa28b,_0x12180b){_0x9aa28b=_0x9aa28b-0x0;var _0x685b5e=_0x1d4a[_0x9aa28b];return _0x685b5e;};'use strict';var multer=require('multer');var util=require(_0xa1d4('0x0'));var path=require(_0xa1d4('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1d4('0x2'));var router=express[_0xa1d4('0x3')]();var fs_extra=require(_0xa1d4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa1d4('0x5'));var config=require('../../config/environment');var controller=require(_0xa1d4('0x6'));router[_0xa1d4('0x7')]('/',auth[_0xa1d4('0x8')](),controller[_0xa1d4('0x9')]);router['get'](_0xa1d4('0xa'),auth[_0xa1d4('0x8')](),controller[_0xa1d4('0xb')]);router[_0xa1d4('0x7')](_0xa1d4('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa1d4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa1d4('0xe')]('/:id',auth[_0xa1d4('0x8')](),controller['update']);router[_0xa1d4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa1d4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5240=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','destroy','exports','util','path'];(function(_0x213731,_0xaeb77){var _0x43ca86=function(_0x253097){while(--_0x253097){_0x213731['push'](_0x213731['shift']());}};_0x43ca86(++_0xaeb77);}(_0x5240,0x166));var _0x0524=function(_0x14bbf3,_0xca820f){_0x14bbf3=_0x14bbf3-0x0;var _0x1b280c=_0x5240[_0x14bbf3];return _0x1b280c;};'use strict';var multer=require('multer');var util=require(_0x0524('0x0'));var path=require(_0x0524('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0524('0x2'));var auth=require(_0x0524('0x3'));var interaction=require(_0x0524('0x4'));var config=require('../../config/environment');var controller=require(_0x0524('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x0524('0x6')]);router[_0x0524('0x7')](_0x0524('0x8'),auth[_0x0524('0x9')](),controller[_0x0524('0xa')]);router['get'](_0x0524('0xb'),auth[_0x0524('0x9')](),controller[_0x0524('0xc')]);router[_0x0524('0xd')]('/',auth[_0x0524('0x9')](),controller['create']);router['put'](_0x0524('0xb'),auth[_0x0524('0x9')](),controller[_0x0524('0xe')]);router[_0x0524('0xf')](_0x0524('0xb'),auth[_0x0524('0x9')](),controller[_0x0524('0x10')]);module[_0x0524('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 7b71d6c..17d4164 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 _0x2cdd=['ENUM','blind','STRING','Yes','exports'];(function(_0x5a4036,_0x1a3694){var _0x4bdec0=function(_0x2206a8){while(--_0x2206a8){_0x5a4036['push'](_0x5a4036['shift']());}};_0x4bdec0(++_0x1a3694);}(_0x2cdd,0xa9));var _0xd2cd=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x2cdd[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd2cd('0x0')]={'type':{'type':Sequelize[_0xd2cd('0x1')](_0xd2cd('0x2'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xd2cd('0x3')]},'transferercalleridname':{'type':Sequelize[_0xd2cd('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd2cd('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xd2cd('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xd2cd('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xd2cd('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xd2cd('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xd2cd('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xd2cd('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd2cd('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xd2cd('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xd2cd('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xd2cd('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xd2cd('0x4'),'No')},'context':{'type':Sequelize[_0xd2cd('0x3')]},'extension':{'type':Sequelize[_0xd2cd('0x3')]}}; \ No newline at end of file +var _0x98e4=['ENUM','blind','STRING','Yes','moment','exports'];(function(_0xc24f2a,_0x3b1d98){var _0x1c87fd=function(_0x2c8d9d){while(--_0x2c8d9d){_0xc24f2a['push'](_0xc24f2a['shift']());}};_0x1c87fd(++_0x3b1d98);}(_0x98e4,0x18a));var _0x498e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x98e4[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x498e('0x0'));module[_0x498e('0x1')]={'type':{'type':Sequelize[_0x498e('0x2')](_0x498e('0x3'),'attended')},'result':{'type':Sequelize[_0x498e('0x4')]},'transfererchannel':{'type':Sequelize[_0x498e('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x498e('0x4')]},'transferercalleridname':{'type':Sequelize[_0x498e('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x498e('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x498e('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x498e('0x4')]},'transferercontext':{'type':Sequelize[_0x498e('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x498e('0x4')]},'transfereechannel':{'type':Sequelize[_0x498e('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x498e('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x498e('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x498e('0x4')]},'transfereecontext':{'type':Sequelize[_0x498e('0x4')]},'transfereeexten':{'type':Sequelize[_0x498e('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x498e('0x4')]},'isexternal':{'type':Sequelize[_0x498e('0x2')](_0x498e('0x5'),'No')},'context':{'type':Sequelize[_0x498e('0x4')]},'extension':{'type':Sequelize[_0x498e('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b447d5c..8b045dd 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 _0x47b4=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','params','describe','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceTransferReport','fieldName'];(function(_0x3c3c20,_0x3d41e1){var _0x11fbd=function(_0x4c01f7){while(--_0x4c01f7){_0x3c3c20['push'](_0x3c3c20['shift']());}};_0x11fbd(++_0x3d41e1);}(_0x47b4,0x144));var _0x447b=function(_0x3a4425,_0x1de5cb){_0x3a4425=_0x3a4425-0x0;var _0x26976d=_0x47b4[_0x3a4425];return _0x26976d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x447b('0x0'));var rp=require(_0x447b('0x1'));var moment=require(_0x447b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x447b('0x3'));var sox=require(_0x447b('0x4'));var csv=require(_0x447b('0x5'));var ejs=require(_0x447b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x447b('0x7'));var squel=require(_0x447b('0x8'));var crypto=require(_0x447b('0x9'));var jsforce=require(_0x447b('0xa'));var deskjs=require(_0x447b('0xb'));var toCsv=require(_0x447b('0x5'));var querystring=require(_0x447b('0xc'));var Papa=require('papaparse');var Redis=require(_0x447b('0xd'));var authService=require(_0x447b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x447b('0xf'));var hardwareService=require(_0x447b('0x10'));var logger=require(_0x447b('0x11'))('api');var utils=require(_0x447b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x447b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16f47a,_0xdbb083){_0xdbb083=_0xdbb083||0xcc;return function(_0x5a62a3){if(_0x5a62a3){return _0x16f47a[_0x447b('0x14')](_0xdbb083);}return _0x16f47a[_0x447b('0x15')](_0xdbb083)[_0x447b('0x16')]();};}function respondWithResult(_0x24f492,_0x1f8dc3){_0x1f8dc3=_0x1f8dc3||0xc8;return function(_0x2f0f39){if(_0x2f0f39){return _0x24f492['status'](_0x1f8dc3)[_0x447b('0x17')](_0x2f0f39);}};}function respondWithFilteredResult(_0x3f0674,_0x4b4d64){return function(_0x531309){if(_0x531309){var _0x4cbd0b=typeof _0x4b4d64[_0x447b('0x18')]==='undefined'&&typeof _0x4b4d64[_0x447b('0x19')]==='undefined';var _0x560e39=_0x531309[_0x447b('0x1a')];var _0xbdab4d=_0x4cbd0b?0x0:_0x4b4d64['offset'];var _0x244fbc=_0x4cbd0b?_0x531309['count']:_0x4b4d64['offset']+_0x4b4d64[_0x447b('0x19')];var _0x579e0a;if(_0x244fbc>=_0x560e39){_0x244fbc=_0x560e39;_0x579e0a=0xc8;}else{_0x579e0a=0xce;}_0x3f0674['status'](_0x579e0a);return _0x3f0674[_0x447b('0x1b')]('Content-Range',_0xbdab4d+'-'+_0x244fbc+'/'+_0x560e39)[_0x447b('0x17')](_0x531309);}return null;};}function patchUpdates(_0x21d661){return function(_0x45a9d9){try{jsonpatch[_0x447b('0x1c')](_0x45a9d9,_0x21d661,!![]);}catch(_0x2ff583){return BPromise[_0x447b('0x1d')](_0x2ff583);}return _0x45a9d9[_0x447b('0x1e')]();};}function saveUpdates(_0x1c4197,_0x3cc690){return function(_0x3778ca){if(_0x3778ca){return _0x3778ca[_0x447b('0x1f')](_0x1c4197)['then'](function(_0x5ed61a){return _0x5ed61a;});}return null;};}function removeEntity(_0x413064,_0xdc7acc){return function(_0x3b5cf2){if(_0x3b5cf2){return _0x3b5cf2[_0x447b('0x20')]()[_0x447b('0x21')](function(){_0x413064[_0x447b('0x15')](0xcc)[_0x447b('0x16')]();});}};}function handleEntityNotFound(_0x368992,_0x54a8e8){return function(_0x24d669){if(!_0x24d669){_0x368992['sendStatus'](0x194);}return _0x24d669;};}function handleError(_0x1a7f9b,_0x33dfd6){_0x33dfd6=_0x33dfd6||0x1f4;return function(_0x21bd0a){logger[_0x447b('0x22')](_0x21bd0a[_0x447b('0x23')]);if(_0x21bd0a[_0x447b('0x24')]){delete _0x21bd0a[_0x447b('0x24')];}_0x1a7f9b['status'](_0x33dfd6)[_0x447b('0x25')](_0x21bd0a);};}exports['index']=function(_0x2a6fd7,_0x553640){var _0x2a71ff={},_0x37d8fc={},_0x4fc7b2={'count':0x0,'rows':[]};var _0x9bcfc4=_[_0x447b('0x26')](db[_0x447b('0x27')]['rawAttributes'],function(_0x104126){return{'name':_0x104126[_0x447b('0x28')],'type':_0x104126[_0x447b('0x29')][_0x447b('0x2a')]};});_0x37d8fc[_0x447b('0x2b')]=_[_0x447b('0x26')](_0x9bcfc4,'name');_0x37d8fc[_0x447b('0x2c')]=_[_0x447b('0x2d')](_0x2a6fd7['query']);_0x37d8fc[_0x447b('0x2e')]=_[_0x447b('0x2f')](_0x37d8fc[_0x447b('0x2b')],_0x37d8fc[_0x447b('0x2c')]);_0x2a71ff[_0x447b('0x30')]=_['intersection'](_0x37d8fc[_0x447b('0x2b')],qs[_0x447b('0x31')](_0x2a6fd7['query'][_0x447b('0x31')]));_0x2a71ff[_0x447b('0x30')]=_0x2a71ff['attributes']['length']?_0x2a71ff['attributes']:_0x37d8fc['model'];if(!_0x2a6fd7['query'][_0x447b('0x32')](_0x447b('0x33'))){_0x2a71ff[_0x447b('0x19')]=qs[_0x447b('0x19')](_0x2a6fd7[_0x447b('0x2c')][_0x447b('0x19')]);_0x2a71ff[_0x447b('0x18')]=qs[_0x447b('0x18')](_0x2a6fd7[_0x447b('0x2c')]['offset']);}_0x2a71ff[_0x447b('0x34')]=qs[_0x447b('0x35')](_0x2a6fd7[_0x447b('0x2c')][_0x447b('0x35')]);_0x2a71ff['where']=qs[_0x447b('0x2e')](_[_0x447b('0x36')](_0x2a6fd7[_0x447b('0x2c')],_0x37d8fc[_0x447b('0x2e')]),_0x9bcfc4);if(_0x2a6fd7['query']['filter']){_0x2a71ff[_0x447b('0x37')]=_[_0x447b('0x38')](_0x2a71ff[_0x447b('0x37')],{'$or':_[_0x447b('0x26')](_0x9bcfc4,function(_0x32f0ce){if(_0x32f0ce['type']!==_0x447b('0x39')){var _0x41b207={};_0x41b207[_0x32f0ce[_0x447b('0x24')]]={'$like':'%'+_0x2a6fd7[_0x447b('0x2c')][_0x447b('0x3a')]+'%'};return _0x41b207;}})});}_0x2a71ff=_['merge']({},_0x2a71ff,_0x2a6fd7[_0x447b('0x3b')]);var _0x5c76cd={'where':_0x2a71ff[_0x447b('0x37')]};return db[_0x447b('0x27')][_0x447b('0x1a')](_0x5c76cd)[_0x447b('0x21')](function(_0x20aa2e){_0x4fc7b2[_0x447b('0x1a')]=_0x20aa2e;if(_0x2a6fd7[_0x447b('0x2c')]['includeAll']){_0x2a71ff[_0x447b('0x3c')]=[{'all':!![]}];}return db[_0x447b('0x27')][_0x447b('0x3d')](_0x2a71ff);})[_0x447b('0x21')](function(_0x381b2b){_0x4fc7b2[_0x447b('0x3e')]=_0x381b2b;return _0x4fc7b2;})[_0x447b('0x21')](respondWithFilteredResult(_0x553640,_0x2a71ff))[_0x447b('0x3f')](handleError(_0x553640,null));};exports[_0x447b('0x40')]=function(_0x35aa51,_0x459510){var _0x34bb01={'raw':!![],'where':{'id':_0x35aa51['params']['id']}},_0x31f790={};_0x31f790[_0x447b('0x2b')]=_[_0x447b('0x2d')](db['VoiceTransferReport'][_0x447b('0x41')]);_0x31f790[_0x447b('0x2c')]=_[_0x447b('0x2d')](_0x35aa51['query']);_0x31f790['filters']=_[_0x447b('0x2f')](_0x31f790[_0x447b('0x2b')],_0x31f790[_0x447b('0x2c')]);_0x34bb01[_0x447b('0x30')]=_[_0x447b('0x2f')](_0x31f790[_0x447b('0x2b')],qs[_0x447b('0x31')](_0x35aa51[_0x447b('0x2c')][_0x447b('0x31')]));_0x34bb01['attributes']=_0x34bb01['attributes'][_0x447b('0x42')]?_0x34bb01[_0x447b('0x30')]:_0x31f790[_0x447b('0x2b')];if(_0x35aa51['query'][_0x447b('0x43')]){_0x34bb01[_0x447b('0x3c')]=[{'all':!![]}];}_0x34bb01=_['merge']({},_0x34bb01,_0x35aa51[_0x447b('0x3b')]);return db[_0x447b('0x27')][_0x447b('0x44')](_0x34bb01)[_0x447b('0x21')](handleEntityNotFound(_0x459510,null))[_0x447b('0x21')](respondWithResult(_0x459510,null))[_0x447b('0x3f')](handleError(_0x459510,null));};exports[_0x447b('0x45')]=function(_0x1255ad,_0x3e4e46){return db[_0x447b('0x27')][_0x447b('0x45')](_0x1255ad['body'],{})[_0x447b('0x21')](respondWithResult(_0x3e4e46,0xc9))['catch'](handleError(_0x3e4e46,null));};exports[_0x447b('0x1f')]=function(_0x1ad0e3,_0x5c7ed3){if(_0x1ad0e3[_0x447b('0x46')]['id']){delete _0x1ad0e3['body']['id'];}return db['VoiceTransferReport'][_0x447b('0x44')]({'where':{'id':_0x1ad0e3[_0x447b('0x47')]['id']}})[_0x447b('0x21')](handleEntityNotFound(_0x5c7ed3,null))[_0x447b('0x21')](saveUpdates(_0x1ad0e3[_0x447b('0x46')],null))[_0x447b('0x21')](respondWithResult(_0x5c7ed3,null))['catch'](handleError(_0x5c7ed3,null));};exports['destroy']=function(_0x2720b,_0x4c03b1){return db[_0x447b('0x27')]['find']({'where':{'id':_0x2720b['params']['id']}})['then'](handleEntityNotFound(_0x4c03b1,null))[_0x447b('0x21')](removeEntity(_0x4c03b1,null))[_0x447b('0x3f')](handleError(_0x4c03b1,null));};exports[_0x447b('0x48')]=function(_0x23b027,_0x580801){return db[_0x447b('0x27')][_0x447b('0x48')]()[_0x447b('0x21')](respondWithResult(_0x580801,null))[_0x447b('0x3f')](handleError(_0x580801,null));}; \ No newline at end of file +var _0x568c=['catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','name','index','VoiceTransferReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','include'];(function(_0x494ee1,_0x1f18e1){var _0x1e0057=function(_0x4cbc1f){while(--_0x4cbc1f){_0x494ee1['push'](_0x494ee1['shift']());}};_0x1e0057(++_0x1f18e1);}(_0x568c,0x9a));var _0xc568=function(_0x59148c,_0x1a0310){_0x59148c=_0x59148c-0x0;var _0x1bebe1=_0x568c[_0x59148c];return _0x1bebe1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc568('0x0'));var zipdir=require(_0xc568('0x1'));var jsonpatch=require(_0xc568('0x2'));var rp=require(_0xc568('0x3'));var moment=require(_0xc568('0x4'));var BPromise=require(_0xc568('0x5'));var Mustache=require(_0xc568('0x6'));var util=require(_0xc568('0x7'));var path=require('path');var sox=require(_0xc568('0x8'));var csv=require(_0xc568('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc568('0xa'));var squel=require(_0xc568('0xb'));var crypto=require(_0xc568('0xc'));var jsforce=require(_0xc568('0xd'));var deskjs=require(_0xc568('0xe'));var toCsv=require(_0xc568('0x9'));var querystring=require(_0xc568('0xf'));var Papa=require(_0xc568('0x10'));var Redis=require(_0xc568('0x11'));var authService=require(_0xc568('0x12'));var qs=require(_0xc568('0x13'));var as=require(_0xc568('0x14'));var hardwareService=require(_0xc568('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc568('0x16'));var config=require(_0xc568('0x17'));var licenseUtil=require(_0xc568('0x18'));var db=require(_0xc568('0x19'))['db'];function respondWithStatusCode(_0x1a0ecd,_0x8babe2){_0x8babe2=_0x8babe2||0xcc;return function(_0x2c921d){if(_0x2c921d){return _0x1a0ecd['sendStatus'](_0x8babe2);}return _0x1a0ecd['status'](_0x8babe2)['end']();};}function respondWithResult(_0x26b9b6,_0x18988d){_0x18988d=_0x18988d||0xc8;return function(_0x2c86cf){if(_0x2c86cf){return _0x26b9b6['status'](_0x18988d)[_0xc568('0x1a')](_0x2c86cf);}};}function respondWithFilteredResult(_0x3dde40,_0x43a4cb){return function(_0x55d374){if(_0x55d374){var _0x55d5b0=typeof _0x43a4cb['offset']===_0xc568('0x1b')&&typeof _0x43a4cb[_0xc568('0x1c')]===_0xc568('0x1b');var _0x1bb00b=_0x55d374[_0xc568('0x1d')];var _0xcda501=_0x55d5b0?0x0:_0x43a4cb[_0xc568('0x1e')];var _0x2f0d00=_0x55d5b0?_0x55d374[_0xc568('0x1d')]:_0x43a4cb['offset']+_0x43a4cb[_0xc568('0x1c')];var _0x1f7d50;if(_0x2f0d00>=_0x1bb00b){_0x2f0d00=_0x1bb00b;_0x1f7d50=0xc8;}else{_0x1f7d50=0xce;}_0x3dde40[_0xc568('0x1f')](_0x1f7d50);return _0x3dde40[_0xc568('0x20')](_0xc568('0x21'),_0xcda501+'-'+_0x2f0d00+'/'+_0x1bb00b)[_0xc568('0x1a')](_0x55d374);}return null;};}function patchUpdates(_0x450202){return function(_0x28fa2f){try{jsonpatch[_0xc568('0x22')](_0x28fa2f,_0x450202,!![]);}catch(_0x5ef4ec){return BPromise[_0xc568('0x23')](_0x5ef4ec);}return _0x28fa2f[_0xc568('0x24')]();};}function saveUpdates(_0x28e756,_0x3b0983){return function(_0x50272e){if(_0x50272e){return _0x50272e[_0xc568('0x25')](_0x28e756)['then'](function(_0x30cfa4){return _0x30cfa4;});}return null;};}function removeEntity(_0x4f5516,_0x320a03){return function(_0x2d5144){if(_0x2d5144){return _0x2d5144[_0xc568('0x26')]()[_0xc568('0x27')](function(){_0x4f5516['status'](0xcc)[_0xc568('0x28')]();});}};}function handleEntityNotFound(_0x3b4f4e,_0x552a24){return function(_0x4e9e90){if(!_0x4e9e90){_0x3b4f4e[_0xc568('0x29')](0x194);}return _0x4e9e90;};}function handleError(_0x395588,_0x3930c1){_0x3930c1=_0x3930c1||0x1f4;return function(_0x2444c5){logger['error'](_0x2444c5['stack']);if(_0x2444c5[_0xc568('0x2a')]){delete _0x2444c5['name'];}_0x395588['status'](_0x3930c1)['send'](_0x2444c5);};}exports[_0xc568('0x2b')]=function(_0x444686,_0x4a92d6){var _0x4eddd8={},_0x31a27b={},_0x3179b9={'count':0x0,'rows':[]};var _0x2be271=_['map'](db[_0xc568('0x2c')][_0xc568('0x2d')],function(_0xd47b15){return{'name':_0xd47b15[_0xc568('0x2e')],'type':_0xd47b15['type']['key']};});_0x31a27b[_0xc568('0x2f')]=_[_0xc568('0x30')](_0x2be271,_0xc568('0x2a'));_0x31a27b[_0xc568('0x31')]=_[_0xc568('0x32')](_0x444686[_0xc568('0x31')]);_0x31a27b[_0xc568('0x33')]=_[_0xc568('0x34')](_0x31a27b[_0xc568('0x2f')],_0x31a27b[_0xc568('0x31')]);_0x4eddd8[_0xc568('0x35')]=_[_0xc568('0x34')](_0x31a27b[_0xc568('0x2f')],qs[_0xc568('0x36')](_0x444686[_0xc568('0x31')]['fields']));_0x4eddd8['attributes']=_0x4eddd8['attributes'][_0xc568('0x37')]?_0x4eddd8[_0xc568('0x35')]:_0x31a27b[_0xc568('0x2f')];if(!_0x444686[_0xc568('0x31')][_0xc568('0x38')](_0xc568('0x39'))){_0x4eddd8[_0xc568('0x1c')]=qs[_0xc568('0x1c')](_0x444686[_0xc568('0x31')]['limit']);_0x4eddd8['offset']=qs[_0xc568('0x1e')](_0x444686[_0xc568('0x31')][_0xc568('0x1e')]);}_0x4eddd8['order']=qs[_0xc568('0x3a')](_0x444686[_0xc568('0x31')]['sort']);_0x4eddd8[_0xc568('0x3b')]=qs[_0xc568('0x33')](_[_0xc568('0x3c')](_0x444686['query'],_0x31a27b[_0xc568('0x33')]),_0x2be271);if(_0x444686[_0xc568('0x31')][_0xc568('0x3d')]){_0x4eddd8['where']=_[_0xc568('0x3e')](_0x4eddd8[_0xc568('0x3b')],{'$or':_['map'](_0x2be271,function(_0x2eda75){if(_0x2eda75[_0xc568('0x3f')]!=='VIRTUAL'){var _0x5b7327={};_0x5b7327[_0x2eda75['name']]={'$like':'%'+_0x444686[_0xc568('0x31')][_0xc568('0x3d')]+'%'};return _0x5b7327;}})});}_0x4eddd8=_[_0xc568('0x3e')]({},_0x4eddd8,_0x444686[_0xc568('0x40')]);var _0x23c5d4={'where':_0x4eddd8[_0xc568('0x3b')]};return db[_0xc568('0x2c')][_0xc568('0x1d')](_0x23c5d4)[_0xc568('0x27')](function(_0x4d8509){_0x3179b9[_0xc568('0x1d')]=_0x4d8509;if(_0x444686[_0xc568('0x31')][_0xc568('0x41')]){_0x4eddd8['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xc568('0x42')](_0x4eddd8);})[_0xc568('0x27')](function(_0x4a9e20){_0x3179b9['rows']=_0x4a9e20;return _0x3179b9;})[_0xc568('0x27')](respondWithFilteredResult(_0x4a92d6,_0x4eddd8))['catch'](handleError(_0x4a92d6,null));};exports['show']=function(_0x14feaa,_0x4b565e){var _0x36b949={'raw':!![],'where':{'id':_0x14feaa['params']['id']}},_0x2ec7f3={};_0x2ec7f3[_0xc568('0x2f')]=_[_0xc568('0x32')](db[_0xc568('0x2c')][_0xc568('0x2d')]);_0x2ec7f3[_0xc568('0x31')]=_[_0xc568('0x32')](_0x14feaa[_0xc568('0x31')]);_0x2ec7f3['filters']=_[_0xc568('0x34')](_0x2ec7f3[_0xc568('0x2f')],_0x2ec7f3[_0xc568('0x31')]);_0x36b949[_0xc568('0x35')]=_[_0xc568('0x34')](_0x2ec7f3['model'],qs[_0xc568('0x36')](_0x14feaa['query'][_0xc568('0x36')]));_0x36b949[_0xc568('0x35')]=_0x36b949[_0xc568('0x35')][_0xc568('0x37')]?_0x36b949[_0xc568('0x35')]:_0x2ec7f3[_0xc568('0x2f')];if(_0x14feaa[_0xc568('0x31')][_0xc568('0x41')]){_0x36b949[_0xc568('0x43')]=[{'all':!![]}];}_0x36b949=_['merge']({},_0x36b949,_0x14feaa['options']);return db['VoiceTransferReport']['find'](_0x36b949)[_0xc568('0x27')](handleEntityNotFound(_0x4b565e,null))[_0xc568('0x27')](respondWithResult(_0x4b565e,null))[_0xc568('0x44')](handleError(_0x4b565e,null));};exports[_0xc568('0x45')]=function(_0xa8ec81,_0x546f68){return db[_0xc568('0x2c')][_0xc568('0x45')](_0xa8ec81['body'],{})[_0xc568('0x27')](respondWithResult(_0x546f68,0xc9))[_0xc568('0x44')](handleError(_0x546f68,null));};exports[_0xc568('0x25')]=function(_0x407dd1,_0x7d7050){if(_0x407dd1[_0xc568('0x46')]['id']){delete _0x407dd1[_0xc568('0x46')]['id'];}return db[_0xc568('0x2c')][_0xc568('0x47')]({'where':{'id':_0x407dd1[_0xc568('0x48')]['id']}})['then'](handleEntityNotFound(_0x7d7050,null))[_0xc568('0x27')](saveUpdates(_0x407dd1[_0xc568('0x46')],null))['then'](respondWithResult(_0x7d7050,null))[_0xc568('0x44')](handleError(_0x7d7050,null));};exports[_0xc568('0x26')]=function(_0x264fe0,_0x18798d){return db[_0xc568('0x2c')][_0xc568('0x47')]({'where':{'id':_0x264fe0[_0xc568('0x48')]['id']}})['then'](handleEntityNotFound(_0x18798d,null))[_0xc568('0x27')](removeEntity(_0x18798d,null))[_0xc568('0x44')](handleError(_0x18798d,null));};exports[_0xc568('0x49')]=function(_0x428879,_0x1aebf1){return db[_0xc568('0x2c')][_0xc568('0x49')]()[_0xc568('0x27')](respondWithResult(_0x1aebf1,null))['catch'](handleError(_0x1aebf1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c333703..085e2ef 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 _0x9977=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x9977,0x78));var _0x7997=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x9977[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x7997('0x0'));var util=require(_0x7997('0x1'));var logger=require(_0x7997('0x2'))(_0x7997('0x3'));var moment=require('moment');var BPromise=require(_0x7997('0x4'));var rp=require(_0x7997('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7997('0x6'));var config=require('../../config/environment');var attributes=require(_0x7997('0x7'));module[_0x7997('0x8')]=function(_0x105248,_0x4cc5e7){return _0x105248[_0x7997('0x9')](_0x7997('0xa'),attributes,{'tableName':_0x7997('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf40f=['exports','define','lodash','util','path','rimraf','../../config/environment'];(function(_0x414c37,_0x35e16d){var _0x2673c8=function(_0x352147){while(--_0x352147){_0x414c37['push'](_0x414c37['shift']());}};_0x2673c8(++_0x35e16d);}(_0xf40f,0x1e5));var _0xff40=function(_0x15cd2c,_0x5a9ad1){_0x15cd2c=_0x15cd2c-0x0;var _0x8c3b4f=_0xf40f[_0x15cd2c];return _0x8c3b4f;};'use strict';var _=require(_0xff40('0x0'));var util=require(_0xff40('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff40('0x2'));var rimraf=require(_0xff40('0x3'));var config=require(_0xff40('0x4'));var attributes=require('./voiceTransferReport.attributes');module[_0xff40('0x5')]=function(_0x1e9484,_0x1764bf){return _0x1e9484[_0xff40('0x6')]('VoiceTransferReport',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 7bef1d7..511222e 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 _0x424a=['error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','info','lodash','moment','bluebird','randomstring','../../config/logger','jayson/promise','http','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x424a,0x191));var _0xa424=function(_0x213a44,_0x3a9c9c){_0x213a44=_0x213a44-0x0;var _0x14851d=_0x424a[_0x213a44];return _0x14851d;};'use strict';var _=require(_0xa424('0x0'));var util=require('util');var moment=require(_0xa424('0x1'));var BPromise=require(_0xa424('0x2'));var rs=require(_0xa424('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa424('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa424('0x5'));var client=jayson['client'][_0xa424('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x36f839,_0x35fb9f,_0x113011){return new BPromise(function(_0x5218c1,_0x5e23ac){return client[_0xa424('0x7')](_0x36f839,_0x113011)['then'](function(_0x455f0b){logger['info'](_0xa424('0x8'),_0x35fb9f,_0xa424('0x9'));logger[_0xa424('0xa')](_0xa424('0xb'),_0x35fb9f,'request\x20sent',JSON[_0xa424('0xc')](_0x455f0b));if(_0x455f0b[_0xa424('0xd')]){if(_0x455f0b[_0xa424('0xd')]['code']===0x1f4){logger['error'](_0xa424('0x8'),_0x35fb9f,_0x455f0b[_0xa424('0xd')]['message']);return _0x5e23ac(_0x455f0b[_0xa424('0xd')][_0xa424('0xe')]);}logger[_0xa424('0xd')](_0xa424('0x8'),_0x35fb9f,_0x455f0b['error'][_0xa424('0xe')]);return _0x5218c1(_0x455f0b[_0xa424('0xd')][_0xa424('0xe')]);}else{logger['info'](_0xa424('0x8'),_0x35fb9f,_0xa424('0x9'));_0x5218c1(_0x455f0b[_0xa424('0xf')][_0xa424('0xe')]);}})[_0xa424('0x10')](function(_0x55c3b7){logger[_0xa424('0xd')](_0xa424('0x8'),_0x35fb9f,_0x55c3b7);_0x5e23ac(_0x55c3b7);});});}exports[_0xa424('0x11')]=function(_0x2344d0){var _0x5c1e2e=this;return new Promise(function(_0x47385e,_0x4ac8e8){return db[_0xa424('0x12')][_0xa424('0x13')](_0x2344d0[_0xa424('0x14')],{'raw':_0x2344d0['options']?_0x2344d0[_0xa424('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x33965){logger[_0xa424('0x16')](_0xa424('0x11'),_0x2344d0);logger['debug'](_0xa424('0x11'),_0x2344d0,JSON[_0xa424('0xc')](_0x33965));_0x47385e(_0x33965);})[_0xa424('0x10')](function(_0xcb08fd){logger[_0xa424('0xd')]('CreateVoiceTransferReport',_0xcb08fd[_0xa424('0xe')],_0x2344d0);_0x4ac8e8(_0x5c1e2e[_0xa424('0xd')](0x1f4,_0xcb08fd[_0xa424('0xe')]));});});}; \ No newline at end of file +var _0x3e8e=['http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceTransferReport,\x20%s,\x20%s','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x197ff9,_0x7e5c53){var _0x3ab0d1=function(_0x49ea15){while(--_0x49ea15){_0x197ff9['push'](_0x197ff9['shift']());}};_0x3ab0d1(++_0x7e5c53);}(_0x3e8e,0xba));var _0xe3e8=function(_0x4a0c6b,_0x26de7e){_0x4a0c6b=_0x4a0c6b-0x0;var _0x34c975=_0x3e8e[_0x4a0c6b];return _0x34c975;};'use strict';var _=require(_0xe3e8('0x0'));var util=require('util');var moment=require(_0xe3e8('0x1'));var BPromise=require('bluebird');var rs=require(_0xe3e8('0x2'));var fs=require('fs');var Redis=require(_0xe3e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe3e8('0x4'));var logger=require(_0xe3e8('0x5'))(_0xe3e8('0x6'));var config=require(_0xe3e8('0x7'));var jayson=require(_0xe3e8('0x8'));var client=jayson[_0xe3e8('0x9')][_0xe3e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33e64e,_0x556d04,_0x3eab12){return new BPromise(function(_0x5a9475,_0x3faae8){return client[_0xe3e8('0xb')](_0x33e64e,_0x3eab12)[_0xe3e8('0xc')](function(_0x212a25){logger[_0xe3e8('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x556d04,_0xe3e8('0xe'));logger[_0xe3e8('0xf')](_0xe3e8('0x10'),_0x556d04,'request\x20sent',JSON['stringify'](_0x212a25));if(_0x212a25[_0xe3e8('0x11')]){if(_0x212a25[_0xe3e8('0x11')][_0xe3e8('0x12')]===0x1f4){logger[_0xe3e8('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x556d04,_0x212a25[_0xe3e8('0x11')][_0xe3e8('0x13')]);return _0x3faae8(_0x212a25[_0xe3e8('0x11')]['message']);}logger[_0xe3e8('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x556d04,_0x212a25['error'][_0xe3e8('0x13')]);return _0x5a9475(_0x212a25[_0xe3e8('0x11')]['message']);}else{logger[_0xe3e8('0xd')](_0xe3e8('0x14'),_0x556d04,_0xe3e8('0xe'));_0x5a9475(_0x212a25['result'][_0xe3e8('0x13')]);}})[_0xe3e8('0x15')](function(_0x12959f){logger[_0xe3e8('0x11')](_0xe3e8('0x14'),_0x556d04,_0x12959f);_0x3faae8(_0x12959f);});});}exports['CreateVoiceTransferReport']=function(_0x1f4e75){var _0xefc375=this;return new Promise(function(_0x56030f,_0x3322e4){return db[_0xe3e8('0x16')][_0xe3e8('0x17')](_0x1f4e75[_0xe3e8('0x18')],{'raw':_0x1f4e75[_0xe3e8('0x19')]?_0x1f4e75[_0xe3e8('0x19')][_0xe3e8('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x54a445){logger['info'](_0xe3e8('0x1b'),_0x1f4e75);logger['debug']('CreateVoiceTransferReport',_0x1f4e75,JSON['stringify'](_0x54a445));_0x56030f(_0x54a445);})[_0xe3e8('0x15')](function(_0x59fd3b){logger[_0xe3e8('0x11')](_0xe3e8('0x1b'),_0x59fd3b[_0xe3e8('0x13')],_0x1f4e75);_0x3322e4(_0xefc375[_0xe3e8('0x11')](0x1f4,_0x59fd3b[_0xe3e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5abdcf8..dc313a3 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 _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x5e715c,_0x49a48f){var _0x3fed99=function(_0x13b3c4){while(--_0x13b3c4){_0x5e715c['push'](_0x5e715c['shift']());}};_0x3fed99(++_0x49a48f);}(_0x5b02,0xe9));var _0x25b0=function(_0x3df65a,_0x2964c1){_0x3df65a=_0x3df65a-0x0;var _0x29c280=_0x5b02[_0x3df65a];return _0x29c280;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0xcceb4e,_0x16b9cd){var _0x458bda=function(_0x2efa9c){while(--_0x2efa9c){_0xcceb4e['push'](_0xcceb4e['shift']());}};_0x458bda(++_0x16b9cd);}(_0x34e8,0x12c));var _0x834e=function(_0x22aa18,_0x4839df){_0x22aa18=_0x22aa18-0x0;var _0x20f7e2=_0x34e8[_0x22aa18];return _0x20f7e2;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1b8cf9e..6de1b82 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 _0x064a=['number','callNumber\x20is\x20required','string','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','error','stack','name','status','send','NotFound','code','message','result','catch','User','findOne','agent','then','filter','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','http','webbarapi','redis','localhost','socket.io-emitter','validate'];(function(_0x5c6c68,_0x44d361){var _0xa6fc9b=function(_0xb75388){while(--_0xb75388){_0x5c6c68['push'](_0x5c6c68['shift']());}};_0xa6fc9b(++_0x44d361);}(_0x064a,0x168));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0xa064('0x0'));var fs=require('fs');var _=require(_0xa064('0x1'));var db=require(_0xa064('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xa064('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xa064('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xa064('0x5'));var Redis=require('ioredis');config[_0xa064('0x6')]=_['defaults'](config[_0xa064('0x6')],{'host':_0xa064('0x7'),'port':0x18eb});var io=require(_0xa064('0x8'))(new Redis(config[_0xa064('0x6')]));var Schema=require(_0xa064('0x9'));var originateValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xa064('0xb')]},'callerId':{'type':_0xa064('0xc')},'callbackUrl':{'type':_0xa064('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]},'sessionId':{'type':_0xa064('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]},'sessionId':{'type':_0xa064('0xc'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xa064('0xc'),'required':[!![],_0xa064('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]},'sessionId':{'type':_0xa064('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa064('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]}});function emit(_0x91c28c,_0x283e22,_0x26f784){logger[_0xa064('0xf')](_0x91c28c,_0x283e22,JSON['stringify'](_0x26f784));io['to'](_0x91c28c)[_0xa064('0x10')](_0x283e22,_0x26f784);}function handleError(_0x14212d){return function(_0x259938){console[_0xa064('0x11')]('handleError:',_0x259938,_0x259938 instanceof RangeError);logger[_0xa064('0x12')](_0x259938[_0xa064('0x13')]);if(_0x259938 instanceof RangeError){if(_0x259938[_0xa064('0x14')]){delete _0x259938[_0xa064('0x14')];}_0x14212d[_0xa064('0x15')](0x194)[_0xa064('0x16')](_0x259938);}else{if(_0x259938[_0xa064('0x14')]){delete _0x259938[_0xa064('0x14')];}_0x14212d['status'](0x1f4)[_0xa064('0x16')](_0x259938);}};}function checkError(){return function(_0x9d9162){if(!_0x9d9162){throw new RangeError(_0xa064('0x17'));}return _0x9d9162;};}function respondWithRpcPromise(_0xe78199,_0x344507){return new BPromise(function(_0x337c4d,_0x4cd459){var _0x41e115=amiClient;return _0x41e115['request'](_0xe78199,_0x344507)['then'](function(_0x408eb2){if(_0x408eb2[_0xa064('0x12')]){if(_0x408eb2[_0xa064('0x12')][_0xa064('0x18')]===0x1f4){return _0x4cd459(_0x408eb2[_0xa064('0x12')][_0xa064('0x19')]);}return _0x337c4d(_0x408eb2[_0xa064('0x12')][_0xa064('0x19')]);}else{_0x337c4d(_0x408eb2[_0xa064('0x1a')]);}})[_0xa064('0x1b')](function(_0x48ae05){_0x4cd459(_0x48ae05);});});}function getAgent(_0x125076){return db[_0xa064('0x1c')][_0xa064('0x1d')]({'where':{'id':_0x125076,'role':_0xa064('0x1e')}})[_0xa064('0x1f')](checkError());}function getAgentCheckSession(_0x3c0b13,_0xdf0fc4){return new BPromise(function(_0x1c8993,_0x841e3b){var _0x49086e=respondWithRpcPromise('VoiceChannels');var _0x576bf7=getAgent(_0x3c0b13);Promise['all']([_0x49086e,_0x576bf7])[_0xa064('0x1f')](function(_0x2ac8f4){var _0x2deab0=_0x2ac8f4[0x0];var _0x20cc19=_0x2ac8f4[0x1];var _0x5ef378=_[_0xa064('0x20')](_0x2deab0['rows'],function(_0x58f7ee){return _0x58f7ee['UserId']==_0x20cc19['id']&&_0x58f7ee[_0xa064('0x21')]==_0xdf0fc4;});if(_0x5ef378[_0xa064('0x22')]==0x1){_0x1c8993(_0x20cc19);}else{_0x841e3b(new RangeError('sessionId\x20'+_0xdf0fc4+_0xa064('0x23')));}});});}exports[_0xa064('0x24')]=function(_0x1211b5,_0x23dabd){logger[_0xa064('0xf')](_0xa064('0x25'),_0x1211b5[_0xa064('0x26')]);var _0x22274c=originateValidation[_0xa064('0x9')](_0x1211b5['body']);if(_0x22274c['length']>0x0){return _0x23dabd['status'](0x190)[_0xa064('0x27')](_0x22274c);}var _0xcd96c4=_0x1211b5[_0xa064('0x26')][_0xa064('0x28')];var _0x21d86d=_0x1211b5[_0xa064('0x26')][_0xa064('0x29')];var _0x141a62=_0x1211b5[_0xa064('0x26')][_0xa064('0x2a')];var _0x260c29=_0x1211b5['body'][_0xa064('0x2b')];return getAgent(_0xcd96c4)['then'](function(_0x5b4405){logger['info'](_0xa064('0x2c'),_0x5b4405[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0x5b4405[_0xa064('0x14')]),_0xa064('0x2f'),{'callNumber':_0x21d86d,'callerId':_0x141a62,'callbackUrl':_0x260c29});return _0x23dabd['status'](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x30')});})[_0xa064('0x1b')](handleError(_0x23dabd));};exports['hangup']=function(_0x5da894,_0xe9ad38){logger[_0xa064('0xf')]('hangup\x20fired:',_0x5da894['body']);var _0x9d81ad=hangupValidation[_0xa064('0x9')](_0x5da894[_0xa064('0x26')]);if(_0x9d81ad[_0xa064('0x22')]>0x0){return _0xe9ad38[_0xa064('0x15')](0x190)['json'](_0x9d81ad);}var _0x534529=_0x5da894[_0xa064('0x26')][_0xa064('0x28')];var _0x1efe82=_0x5da894[_0xa064('0x26')][_0xa064('0x21')];return getAgent(_0x534529)[_0xa064('0x1f')](function(_0xbfe810){logger[_0xa064('0xf')](_0xa064('0x2c'),_0xbfe810[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0xbfe810[_0xa064('0x14')]),_0xa064('0x31'),{'sessionId':_0x1efe82});return _0xe9ad38['status'](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x32')});})[_0xa064('0x1b')](handleError(_0xe9ad38));};exports[_0xa064('0x33')]=function(_0x59fc5a,_0x6594a6){logger[_0xa064('0xf')](_0xa064('0x34'),_0x59fc5a['body']);var _0x146752=answerValidation[_0xa064('0x9')](_0x59fc5a[_0xa064('0x26')]);if(_0x146752[_0xa064('0x22')]>0x0){return _0x6594a6[_0xa064('0x15')](0x190)[_0xa064('0x27')](_0x146752);}var _0x3254a4=_0x59fc5a['body'][_0xa064('0x28')];var _0x18e297=_0x59fc5a[_0xa064('0x26')][_0xa064('0x21')];return getAgent(_0x3254a4)[_0xa064('0x1f')](function(_0x51e261){logger[_0xa064('0xf')](_0xa064('0x2c'),_0x51e261[_0xa064('0x14')]);emit(util['format']('user:%s',_0x51e261['name']),_0xa064('0x35'),{'sessionId':_0x18e297});return _0x6594a6[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x36')});})['catch'](handleError(_0x6594a6));};exports[_0xa064('0x37')]=function(_0xbd4158,_0x3b0211){logger['info'](_0xa064('0x38'),_0xbd4158[_0xa064('0x26')]);var _0x1d702b=holdValidation[_0xa064('0x9')](_0xbd4158[_0xa064('0x26')]);if(_0x1d702b['length']>0x0){return _0x3b0211[_0xa064('0x15')](0x190)[_0xa064('0x27')](_0x1d702b);}var _0x69cf27=_0xbd4158[_0xa064('0x26')][_0xa064('0x28')];var _0x5638b3=_0xbd4158[_0xa064('0x26')]['sessionId'];return getAgent(_0x69cf27)['then'](function(_0xa69a1f){logger[_0xa064('0xf')]('entityFound:',_0xa69a1f[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0xa69a1f[_0xa064('0x14')]),_0xa064('0x39'),{'sessionId':_0x5638b3});return _0x3b0211[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x3a')});})[_0xa064('0x1b')](handleError(_0x3b0211));};exports[_0xa064('0x3b')]=function(_0x24eead,_0x353f8a){logger[_0xa064('0xf')]('unhold\x20fired:',_0x24eead[_0xa064('0x26')]);var _0x4fde60=unholdValidation['validate'](_0x24eead[_0xa064('0x26')]);if(_0x4fde60['length']>0x0){return _0x353f8a['status'](0x190)[_0xa064('0x27')](_0x4fde60);}var _0x5cdc13=_0x24eead[_0xa064('0x26')]['userId'];var _0x364be6=_0x24eead[_0xa064('0x26')][_0xa064('0x21')];return getAgent(_0x5cdc13)['then'](function(_0x5d065b){logger[_0xa064('0xf')](_0xa064('0x2c'),_0x5d065b[_0xa064('0x14')]);emit(util['format']('user:%s',_0x5d065b[_0xa064('0x14')]),_0xa064('0x3c'),{'sessionId':_0x364be6});return _0x353f8a[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x3d')});})[_0xa064('0x1b')](handleError(_0x353f8a));};exports[_0xa064('0x3e')]=function(_0x4e76f2,_0x5da5ff){logger[_0xa064('0xf')](_0xa064('0x3f'),_0x5da5ff[_0xa064('0x26')]);var _0x3f705e=callsValidation[_0xa064('0x9')](_0x4e76f2[_0xa064('0x26')]);if(_0x3f705e[_0xa064('0x22')]>0x0){return _0x5da5ff[_0xa064('0x15')](0x190)[_0xa064('0x27')](_0x3f705e);}var _0x17fb2c=_0x4e76f2['body'][_0xa064('0x28')];var _0x1c5779=respondWithRpcPromise(_0xa064('0x40'));var _0x52e5bd=getAgent(_0x17fb2c);return Promise[_0xa064('0x41')]([_0x1c5779,_0x52e5bd])[_0xa064('0x1f')](function(_0x12398d){var _0x5479be=_0x12398d[0x0];var _0x2ad2b4=_0x12398d[0x1];var _0x245b00=_['filter'](_0x5479be['rows'],function(_0x115589){return _0x115589['UserId']==_0x2ad2b4['id'];});return _0x5da5ff[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'count':_0x245b00[_0xa064('0x22')],'rows':_0x245b00});})[_0xa064('0x1b')](handleError(_0x5da5ff));};exports[_0xa064('0x42')]=function(_0x5ab270,_0x8c7ea5){logger['info'](_0xa064('0x43'),_0x5ab270[_0xa064('0x26')]);var _0x193b67=conferenceValidation[_0xa064('0x9')](_0x5ab270[_0xa064('0x26')]);if(_0x193b67['length']>0x0){return _0x8c7ea5['status'](0x190)[_0xa064('0x27')](_0x193b67);}var _0x527be0=_0x5ab270['body'][_0xa064('0x28')];return getAgent(_0x527be0)[_0xa064('0x1f')](function(_0x42eb6e){logger['info'](_0xa064('0x2c'),_0x42eb6e[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0x42eb6e[_0xa064('0x14')]),'webbar:conference');return _0x8c7ea5[_0xa064('0x15')](0xc8)['json']({'error':![],'message':_0xa064('0x44')});})[_0xa064('0x1b')](handleError(_0x8c7ea5));};exports[_0xa064('0x45')]=function(_0x347820,_0x18d3a2){logger['info'](_0xa064('0x46'),_0x347820['body']);var _0x39dbec=transferValidation[_0xa064('0x9')](_0x347820[_0xa064('0x26')]);if(_0x39dbec[_0xa064('0x22')]>0x0){return _0x18d3a2['status'](0x190)[_0xa064('0x27')](_0x39dbec);}var _0x1fd3b6=_0x347820[_0xa064('0x26')][_0xa064('0x28')];var _0x50e8fd=_0x347820[_0xa064('0x26')][_0xa064('0x21')];var _0x27dbb8=_0x347820[_0xa064('0x26')][_0xa064('0x47')];return getAgent(_0x1fd3b6)[_0xa064('0x1f')](function(_0x528131){logger[_0xa064('0xf')]('entityFound:',_0x528131[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0x528131[_0xa064('0x14')]),_0xa064('0x48'),{'sessionId':_0x50e8fd,'transferNumber':_0x27dbb8});return _0x18d3a2[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x49')});})['catch'](handleError(_0x18d3a2));}; \ No newline at end of file +var _0x4f79=['error','stack','name','send','status','code','message','result','catch','findOne','agent','then','VoiceChannels','all','filter','rows','length','sessionId\x20','\x20not\x20found!','originate','body','validate','callerId','format','user:%s','json','hangup','userId','sessionId','entityFound:','answer\x20fired:','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','redis','defaults','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log'];(function(_0x3fdc9c,_0x5e9a27){var _0x479fa3=function(_0x6ba3f3){while(--_0x6ba3f3){_0x3fdc9c['push'](_0x3fdc9c['shift']());}};_0x479fa3(++_0x5e9a27);}(_0x4f79,0x1ce));var _0x94f7=function(_0x11af16,_0xfd7ef8){_0x11af16=_0x11af16-0x0;var _0x3ed42e=_0x4f79[_0x11af16];return _0x3ed42e;};'use strict';var path=require(_0x94f7('0x0'));var fs=require('fs');var _=require(_0x94f7('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x94f7('0x2'));var util=require(_0x94f7('0x3'));var BPromise=require(_0x94f7('0x4'));var jayson=require(_0x94f7('0x5'));var amiClient=jayson['client'][_0x94f7('0x6')]({'port':0x232a});var logger=require(_0x94f7('0x7'))(_0x94f7('0x8'));var Redis=require('ioredis');config[_0x94f7('0x9')]=_[_0x94f7('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x94f7('0xb'),'required':[!![],_0x94f7('0xc')]},'callNumber':{'type':_0x94f7('0xd'),'required':[!![],_0x94f7('0xe')]},'callerId':{'type':_0x94f7('0xd')},'callbackUrl':{'type':_0x94f7('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x94f7('0xb'),'required':[!![],_0x94f7('0xc')]},'sessionId':{'type':_0x94f7('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x94f7('0xb'),'required':[!![],_0x94f7('0xc')]},'sessionId':{'type':_0x94f7('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x94f7('0xd'),'required':[!![],_0x94f7('0xf')]},'transferNumber':{'type':_0x94f7('0xd'),'required':[!![],_0x94f7('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x94f7('0xb'),'required':[!![],_0x94f7('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x94f7('0xb'),'required':[!![],_0x94f7('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x94f7('0xb'),'required':[!![],_0x94f7('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x3ae81d,_0x24b0e9,_0xe4604b){logger[_0x94f7('0x11')](_0x3ae81d,_0x24b0e9,JSON[_0x94f7('0x12')](_0xe4604b));io['to'](_0x3ae81d)[_0x94f7('0x13')](_0x24b0e9,_0xe4604b);}function handleError(_0x2ec190){return function(_0x33aa0c){console[_0x94f7('0x14')]('handleError:',_0x33aa0c,_0x33aa0c instanceof RangeError);logger[_0x94f7('0x15')](_0x33aa0c[_0x94f7('0x16')]);if(_0x33aa0c instanceof RangeError){if(_0x33aa0c[_0x94f7('0x17')]){delete _0x33aa0c[_0x94f7('0x17')];}_0x2ec190['status'](0x194)[_0x94f7('0x18')](_0x33aa0c);}else{if(_0x33aa0c[_0x94f7('0x17')]){delete _0x33aa0c[_0x94f7('0x17')];}_0x2ec190[_0x94f7('0x19')](0x1f4)[_0x94f7('0x18')](_0x33aa0c);}};}function checkError(){return function(_0x48fcef){if(!_0x48fcef){throw new RangeError('NotFound');}return _0x48fcef;};}function respondWithRpcPromise(_0x267652,_0x22ea08){return new BPromise(function(_0x809a5f,_0x5441e5){var _0x50900d=amiClient;return _0x50900d['request'](_0x267652,_0x22ea08)['then'](function(_0x51b48a){if(_0x51b48a[_0x94f7('0x15')]){if(_0x51b48a[_0x94f7('0x15')][_0x94f7('0x1a')]===0x1f4){return _0x5441e5(_0x51b48a[_0x94f7('0x15')][_0x94f7('0x1b')]);}return _0x809a5f(_0x51b48a['error']['message']);}else{_0x809a5f(_0x51b48a[_0x94f7('0x1c')]);}})[_0x94f7('0x1d')](function(_0x5a1b4e){_0x5441e5(_0x5a1b4e);});});}function getAgent(_0x369440){return db['User'][_0x94f7('0x1e')]({'where':{'id':_0x369440,'role':_0x94f7('0x1f')}})[_0x94f7('0x20')](checkError());}function getAgentCheckSession(_0x28c826,_0x1a0d2a){return new BPromise(function(_0x1e5d25,_0x15d38d){var _0x32552c=respondWithRpcPromise(_0x94f7('0x21'));var _0x309f39=getAgent(_0x28c826);Promise[_0x94f7('0x22')]([_0x32552c,_0x309f39])['then'](function(_0x2b4785){var _0x2831ae=_0x2b4785[0x0];var _0x1a9edc=_0x2b4785[0x1];var _0x1db1a6=_[_0x94f7('0x23')](_0x2831ae[_0x94f7('0x24')],function(_0x432ac6){return _0x432ac6['UserId']==_0x1a9edc['id']&&_0x432ac6['sessionId']==_0x1a0d2a;});if(_0x1db1a6[_0x94f7('0x25')]==0x1){_0x1e5d25(_0x1a9edc);}else{_0x15d38d(new RangeError(_0x94f7('0x26')+_0x1a0d2a+_0x94f7('0x27')));}});});}exports[_0x94f7('0x28')]=function(_0xcca299,_0x39ae80){logger[_0x94f7('0x11')]('originate\x20fired:',_0xcca299[_0x94f7('0x29')]);var _0x4c67f4=originateValidation[_0x94f7('0x2a')](_0xcca299[_0x94f7('0x29')]);if(_0x4c67f4[_0x94f7('0x25')]>0x0){return _0x39ae80[_0x94f7('0x19')](0x190)['json'](_0x4c67f4);}var _0x34d13f=_0xcca299['body']['userId'];var _0x1d4e7f=_0xcca299['body']['callNumber'];var _0x4b5c37=_0xcca299[_0x94f7('0x29')][_0x94f7('0x2b')];var _0x4cb226=_0xcca299[_0x94f7('0x29')]['callbackUrl'];return getAgent(_0x34d13f)[_0x94f7('0x20')](function(_0x375efe){logger[_0x94f7('0x11')]('entityFound:',_0x375efe[_0x94f7('0x17')]);emit(util[_0x94f7('0x2c')](_0x94f7('0x2d'),_0x375efe[_0x94f7('0x17')]),'webbar:originate',{'callNumber':_0x1d4e7f,'callerId':_0x4b5c37,'callbackUrl':_0x4cb226});return _0x39ae80['status'](0xc8)[_0x94f7('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0x94f7('0x1d')](handleError(_0x39ae80));};exports[_0x94f7('0x2f')]=function(_0x29b422,_0xa8f530){logger[_0x94f7('0x11')]('hangup\x20fired:',_0x29b422['body']);var _0x9bd84f=hangupValidation[_0x94f7('0x2a')](_0x29b422[_0x94f7('0x29')]);if(_0x9bd84f['length']>0x0){return _0xa8f530[_0x94f7('0x19')](0x190)[_0x94f7('0x2e')](_0x9bd84f);}var _0x134b79=_0x29b422[_0x94f7('0x29')][_0x94f7('0x30')];var _0x40d0e4=_0x29b422['body'][_0x94f7('0x31')];return getAgent(_0x134b79)['then'](function(_0x43b852){logger[_0x94f7('0x11')](_0x94f7('0x32'),_0x43b852[_0x94f7('0x17')]);emit(util[_0x94f7('0x2c')]('user:%s',_0x43b852['name']),'webbar:hangup',{'sessionId':_0x40d0e4});return _0xa8f530[_0x94f7('0x19')](0xc8)[_0x94f7('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x94f7('0x1d')](handleError(_0xa8f530));};exports['answer']=function(_0x1b8f73,_0x4aeede){logger['info'](_0x94f7('0x33'),_0x1b8f73[_0x94f7('0x29')]);var _0x1e06dc=answerValidation[_0x94f7('0x2a')](_0x1b8f73[_0x94f7('0x29')]);if(_0x1e06dc[_0x94f7('0x25')]>0x0){return _0x4aeede[_0x94f7('0x19')](0x190)[_0x94f7('0x2e')](_0x1e06dc);}var _0x522d4d=_0x1b8f73['body'][_0x94f7('0x30')];var _0x1d22cf=_0x1b8f73[_0x94f7('0x29')][_0x94f7('0x31')];return getAgent(_0x522d4d)[_0x94f7('0x20')](function(_0x289ff1){logger[_0x94f7('0x11')](_0x94f7('0x32'),_0x289ff1['name']);emit(util[_0x94f7('0x2c')](_0x94f7('0x2d'),_0x289ff1[_0x94f7('0x17')]),'webbar:answer',{'sessionId':_0x1d22cf});return _0x4aeede[_0x94f7('0x19')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x94f7('0x1d')](handleError(_0x4aeede));};exports[_0x94f7('0x34')]=function(_0x2d645f,_0x2fe74e){logger['info'](_0x94f7('0x35'),_0x2d645f[_0x94f7('0x29')]);var _0x80f765=holdValidation[_0x94f7('0x2a')](_0x2d645f[_0x94f7('0x29')]);if(_0x80f765['length']>0x0){return _0x2fe74e[_0x94f7('0x19')](0x190)[_0x94f7('0x2e')](_0x80f765);}var _0x5a39e6=_0x2d645f['body'][_0x94f7('0x30')];var _0x2e3f35=_0x2d645f[_0x94f7('0x29')][_0x94f7('0x31')];return getAgent(_0x5a39e6)['then'](function(_0x20eb78){logger['info'](_0x94f7('0x32'),_0x20eb78[_0x94f7('0x17')]);emit(util['format'](_0x94f7('0x2d'),_0x20eb78[_0x94f7('0x17')]),_0x94f7('0x36'),{'sessionId':_0x2e3f35});return _0x2fe74e[_0x94f7('0x19')](0xc8)[_0x94f7('0x2e')]({'error':![],'message':_0x94f7('0x37')});})[_0x94f7('0x1d')](handleError(_0x2fe74e));};exports[_0x94f7('0x38')]=function(_0x5ca86f,_0x5015a7){logger[_0x94f7('0x11')](_0x94f7('0x39'),_0x5ca86f[_0x94f7('0x29')]);var _0x2dbdd0=unholdValidation[_0x94f7('0x2a')](_0x5ca86f['body']);if(_0x2dbdd0[_0x94f7('0x25')]>0x0){return _0x5015a7['status'](0x190)[_0x94f7('0x2e')](_0x2dbdd0);}var _0x559595=_0x5ca86f[_0x94f7('0x29')]['userId'];var _0x5cae9d=_0x5ca86f[_0x94f7('0x29')][_0x94f7('0x31')];return getAgent(_0x559595)[_0x94f7('0x20')](function(_0x1473a3){logger[_0x94f7('0x11')]('entityFound:',_0x1473a3[_0x94f7('0x17')]);emit(util[_0x94f7('0x2c')](_0x94f7('0x2d'),_0x1473a3[_0x94f7('0x17')]),_0x94f7('0x3a'),{'sessionId':_0x5cae9d});return _0x5015a7[_0x94f7('0x19')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x94f7('0x1d')](handleError(_0x5015a7));};exports[_0x94f7('0x3b')]=function(_0x412211,_0x1d1de5){logger[_0x94f7('0x11')](_0x94f7('0x3c'),_0x1d1de5[_0x94f7('0x29')]);var _0xb5b118=callsValidation[_0x94f7('0x2a')](_0x412211[_0x94f7('0x29')]);if(_0xb5b118[_0x94f7('0x25')]>0x0){return _0x1d1de5[_0x94f7('0x19')](0x190)['json'](_0xb5b118);}var _0x52f7ad=_0x412211[_0x94f7('0x29')][_0x94f7('0x30')];var _0x337b18=respondWithRpcPromise('VoiceChannels');var _0x143dc2=getAgent(_0x52f7ad);return Promise[_0x94f7('0x22')]([_0x337b18,_0x143dc2])[_0x94f7('0x20')](function(_0x28897b){var _0x3ccf88=_0x28897b[0x0];var _0xbf5b7d=_0x28897b[0x1];var _0x5b437a=_[_0x94f7('0x23')](_0x3ccf88['rows'],function(_0x7ef763){return _0x7ef763['UserId']==_0xbf5b7d['id'];});return _0x1d1de5[_0x94f7('0x19')](0xc8)[_0x94f7('0x2e')]({'count':_0x5b437a[_0x94f7('0x25')],'rows':_0x5b437a});})[_0x94f7('0x1d')](handleError(_0x1d1de5));};exports[_0x94f7('0x3d')]=function(_0x58b8f9,_0xa7031a){logger['info'](_0x94f7('0x3e'),_0x58b8f9[_0x94f7('0x29')]);var _0x10a7cf=conferenceValidation[_0x94f7('0x2a')](_0x58b8f9[_0x94f7('0x29')]);if(_0x10a7cf[_0x94f7('0x25')]>0x0){return _0xa7031a[_0x94f7('0x19')](0x190)[_0x94f7('0x2e')](_0x10a7cf);}var _0x489a98=_0x58b8f9['body']['userId'];return getAgent(_0x489a98)[_0x94f7('0x20')](function(_0x475eba){logger['info']('entityFound:',_0x475eba[_0x94f7('0x17')]);emit(util[_0x94f7('0x2c')](_0x94f7('0x2d'),_0x475eba[_0x94f7('0x17')]),_0x94f7('0x3f'));return _0xa7031a[_0x94f7('0x19')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x94f7('0x1d')](handleError(_0xa7031a));};exports[_0x94f7('0x40')]=function(_0x2169cd,_0x56924d){logger[_0x94f7('0x11')](_0x94f7('0x41'),_0x2169cd[_0x94f7('0x29')]);var _0x1b4a25=transferValidation[_0x94f7('0x2a')](_0x2169cd['body']);if(_0x1b4a25[_0x94f7('0x25')]>0x0){return _0x56924d[_0x94f7('0x19')](0x190)[_0x94f7('0x2e')](_0x1b4a25);}var _0x5c5aaf=_0x2169cd[_0x94f7('0x29')][_0x94f7('0x30')];var _0x3fa815=_0x2169cd[_0x94f7('0x29')][_0x94f7('0x31')];var _0x4803ef=_0x2169cd[_0x94f7('0x29')][_0x94f7('0x42')];return getAgent(_0x5c5aaf)[_0x94f7('0x20')](function(_0x46865d){logger[_0x94f7('0x11')](_0x94f7('0x32'),_0x46865d[_0x94f7('0x17')]);emit(util[_0x94f7('0x2c')]('user:%s',_0x46865d[_0x94f7('0x17')]),_0x94f7('0x43'),{'sessionId':_0x3fa815,'transferNumber':_0x4803ef});return _0x56924d[_0x94f7('0x19')](0xc8)[_0x94f7('0x2e')]({'error':![],'message':_0x94f7('0x44')});})[_0x94f7('0x1d')](handleError(_0x56924d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5937589..f675c8e 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 _0x7091=['put','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','Router','fs-extra','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send'];(function(_0x3615e1,_0x5d6f76){var _0x3189d4=function(_0x13cb1b){while(--_0x13cb1b){_0x3615e1['push'](_0x3615e1['shift']());}};_0x3189d4(++_0x5d6f76);}(_0x7091,0x1c1));var _0x1709=function(_0x5337c2,_0x8747e){_0x5337c2=_0x5337c2-0x0;var _0x5ef773=_0x7091[_0x5337c2];return _0x5ef773;};'use strict';var multer=require('multer');var util=require(_0x1709('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1709('0x1')]();var fs_extra=require(_0x1709('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1709('0x3'));router[_0x1709('0x4')]('/',auth[_0x1709('0x5')](),controller[_0x1709('0x6')]);router['get'](_0x1709('0x7'),auth[_0x1709('0x5')](),controller['describe']);router[_0x1709('0x4')](_0x1709('0x8'),auth[_0x1709('0x5')](),controller['show']);router[_0x1709('0x4')]('/:id/dispositions',auth[_0x1709('0x5')](),controller[_0x1709('0x9')]);router[_0x1709('0x4')](_0x1709('0xa'),auth[_0x1709('0x5')](),controller[_0x1709('0xb')]);router[_0x1709('0x4')](_0x1709('0xc'),auth[_0x1709('0x5')](),controller[_0x1709('0xd')]);router[_0x1709('0x4')](_0x1709('0xe'),auth[_0x1709('0x5')](),controller[_0x1709('0xf')]);router[_0x1709('0x10')]('/',auth[_0x1709('0x5')](),controller[_0x1709('0x11')]);router[_0x1709('0x10')](_0x1709('0x12'),auth['isAuthenticated'](),controller[_0x1709('0x13')]);router[_0x1709('0x10')](_0x1709('0xa'),auth[_0x1709('0x5')](),controller[_0x1709('0x14')]);router[_0x1709('0x10')](_0x1709('0xc'),auth[_0x1709('0x5')](),controller[_0x1709('0x15')]);router[_0x1709('0x10')](_0x1709('0xe'),auth['isAuthenticated'](),controller[_0x1709('0x16')]);router[_0x1709('0x10')](_0x1709('0x17'),controller[_0x1709('0x18')]);router[_0x1709('0x10')](_0x1709('0x19'),auth[_0x1709('0x5')](),controller[_0x1709('0x1a')]);router[_0x1709('0x1b')](_0x1709('0x8'),auth[_0x1709('0x5')](),controller[_0x1709('0x1c')]);router['delete'](_0x1709('0x8'),auth[_0x1709('0x5')](),controller['destroy']);router['delete'](_0x1709('0x12'),auth[_0x1709('0x5')](),controller[_0x1709('0x1d')]);router[_0x1709('0x1e')](_0x1709('0xa'),auth[_0x1709('0x5')](),controller[_0x1709('0x1f')]);router[_0x1709('0x1e')](_0x1709('0xc'),auth[_0x1709('0x5')](),controller[_0x1709('0x20')]);module[_0x1709('0x21')]=router; \ No newline at end of file +var _0x8504=['delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update'];(function(_0x479564,_0x1294c3){var _0x35f5f8=function(_0x368dff){while(--_0x368dff){_0x479564['push'](_0x479564['shift']());}};_0x35f5f8(++_0x1294c3);}(_0x8504,0xaf));var _0x4850=function(_0x23ad7b,_0x2cac4a){_0x23ad7b=_0x23ad7b-0x0;var _0x438d2a=_0x8504[_0x23ad7b];return _0x438d2a;};'use strict';var multer=require(_0x4850('0x0'));var util=require('util');var path=require(_0x4850('0x1'));var timeout=require(_0x4850('0x2'));var express=require('express');var router=express[_0x4850('0x3')]();var fs_extra=require(_0x4850('0x4'));var auth=require(_0x4850('0x5'));var interaction=require(_0x4850('0x6'));var config=require(_0x4850('0x7'));var controller=require(_0x4850('0x8'));router[_0x4850('0x9')]('/',auth[_0x4850('0xa')](),controller[_0x4850('0xb')]);router[_0x4850('0x9')]('/describe',auth[_0x4850('0xa')](),controller['describe']);router[_0x4850('0x9')](_0x4850('0xc'),auth[_0x4850('0xa')](),controller[_0x4850('0xd')]);router['get'](_0x4850('0xe'),auth[_0x4850('0xa')](),controller[_0x4850('0xf')]);router['get'](_0x4850('0x10'),auth[_0x4850('0xa')](),controller['getAnswers']);router[_0x4850('0x9')](_0x4850('0x11'),auth[_0x4850('0xa')](),controller[_0x4850('0x12')]);router[_0x4850('0x9')]('/:id/applications',auth[_0x4850('0xa')](),controller[_0x4850('0x13')]);router[_0x4850('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x4850('0xe'),auth[_0x4850('0xa')](),controller['addDisposition']);router['post'](_0x4850('0x10'),auth[_0x4850('0xa')](),controller[_0x4850('0x15')]);router[_0x4850('0x14')](_0x4850('0x11'),auth[_0x4850('0xa')](),controller[_0x4850('0x16')]);router[_0x4850('0x14')](_0x4850('0x17'),auth['isAuthenticated'](),controller[_0x4850('0x18')]);router[_0x4850('0x14')]('/:id/notify',controller[_0x4850('0x19')]);router['post'](_0x4850('0x1a'),auth[_0x4850('0xa')](),controller['send']);router[_0x4850('0x1b')](_0x4850('0xc'),auth['isAuthenticated'](),controller[_0x4850('0x1c')]);router[_0x4850('0x1d')](_0x4850('0xc'),auth['isAuthenticated'](),controller[_0x4850('0x1e')]);router[_0x4850('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4850('0x1f')]);router[_0x4850('0x1d')](_0x4850('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x4850('0x1d')](_0x4850('0x11'),auth[_0x4850('0xa')](),controller[_0x4850('0x20')]);module[_0x4850('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 28f6302..970393c 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 _0xbc48=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc48,0x97));var _0x8bc4=function(_0x327ef7,_0xda9a90){_0x327ef7=_0x327ef7-0x0;var _0x14289a=_0xbc48[_0x327ef7];return _0x14289a;};'use strict';var Sequelize=require(_0x8bc4('0x0'));var rs=require(_0x8bc4('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8bc4('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8bc4('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8bc4('0x3')]();}},'phone':{'type':Sequelize[_0x8bc4('0x2')]},'type':{'type':Sequelize[_0x8bc4('0x4')](_0x8bc4('0x5'),_0x8bc4('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8bc4('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8bc4('0x7')],'defaultValue':function(){return _0x8bc4('0x8');}},'notificationSound':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8bc4('0xa')],'comment':_0x8bc4('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![],'comment':_0x8bc4('0xc'),'set':function(_0x808402){if(!_0x808402){this[_0x8bc4('0xd')](_0x8bc4('0xe'),null);}this[_0x8bc4('0xd')](_0x8bc4('0xf'),_0x808402);}},'description':{'type':Sequelize[_0x8bc4('0x2')]}}; \ No newline at end of file +var _0x7112=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x125571,_0x37d17c){var _0x5eca5f=function(_0x5b7945){while(--_0x5b7945){_0x125571['push'](_0x125571['shift']());}};_0x5eca5f(++_0x37d17c);}(_0x7112,0x1d3));var _0x2711=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7112[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2711('0x0'));var rs=require('randomstring');module[_0x2711('0x1')]={'name':{'type':Sequelize[_0x2711('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2711('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x2711('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x2711('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2711('0x3'),_0x2711('0x4'))},'accountSid':{'type':Sequelize[_0x2711('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x2711('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2711('0x5')],'defaultValue':function(){return _0x2711('0x6');}},'notificationSound':{'type':Sequelize[_0x2711('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2711('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2711('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2711('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2711('0x8')],'comment':_0x2711('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2711('0x7')],'defaultValue':![],'comment':_0x2711('0xa'),'set':function(_0x11b865){if(!_0x11b865){this[_0x2711('0xb')](_0x2711('0xc'),null);}this[_0x2711('0xb')](_0x2711('0xd'),_0x11b865);}},'description':{'type':Sequelize[_0x2711('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 96c332b..03d6389 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 _0x1691=['findAndCountAll','priority','finally','send','json','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','stringify','code','error','message','info','request\x20sent','catch','sendStatus','status','offset','undefined','limit','count','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','params','Pause','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addAgents','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate'];(function(_0x4fde41,_0x2c1c5d){var _0x29a865=function(_0x466bbb){while(--_0x466bbb){_0x4fde41['push'](_0x4fde41['shift']());}};_0x29a865(++_0x2c1c5d);}(_0x1691,0x1ed));var _0x1169=function(_0x5c647a,_0x346e5f){_0x5c647a=_0x5c647a-0x0;var _0x3d11a0=_0x1691[_0x5c647a];return _0x3d11a0;};'use strict';var emlformat=require(_0x1169('0x0'));var rimraf=require(_0x1169('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1169('0x2'));var rp=require(_0x1169('0x3'));var moment=require(_0x1169('0x4'));var BPromise=require(_0x1169('0x5'));var Mustache=require(_0x1169('0x6'));var util=require(_0x1169('0x7'));var path=require(_0x1169('0x8'));var sox=require(_0x1169('0x9'));var csv=require('to-csv');var ejs=require(_0x1169('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1169('0xb'));var squel=require('squel');var crypto=require(_0x1169('0xc'));var jsforce=require(_0x1169('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1169('0xe'));var querystring=require(_0x1169('0xf'));var Papa=require(_0x1169('0x10'));var Redis=require(_0x1169('0x11'));var authService=require(_0x1169('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1169('0x13'));var hardwareService=require(_0x1169('0x14'));var logger=require('../../config/logger')(_0x1169('0x15'));var utils=require('../../config/utils');var config=require(_0x1169('0x16'));var licenseUtil=require(_0x1169('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1169('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1169('0x19'))(new Redis(config[_0x1169('0x18')]));require('./whatsappAccount.socket')[_0x1169('0x1a')](socket);var jayson=require(_0x1169('0x1b'));var client=jayson[_0x1169('0x1c')][_0x1169('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4fc690,_0x4c4b90,_0x34462b,_0x31a3e9){return new BPromise(function(_0x1be17b,_0x14d651){var _0x243481=_0x31a3e9||client;return _0x243481[_0x1169('0x1e')](_0x4fc690,_0x34462b)[_0x1169('0x1f')](function(_0x45bb3d){logger['info'](_0x1169('0x20'),_0x4c4b90,'request\x20sent');logger[_0x1169('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4c4b90,'request\x20sent',JSON[_0x1169('0x22')](_0x45bb3d));if(_0x45bb3d['error']){if(_0x45bb3d['error'][_0x1169('0x23')]===0x1f4){logger['error'](_0x1169('0x20'),_0x4c4b90,_0x45bb3d[_0x1169('0x24')][_0x1169('0x25')]);return _0x14d651(_0x45bb3d[_0x1169('0x24')][_0x1169('0x25')]);}logger[_0x1169('0x24')](_0x1169('0x20'),_0x4c4b90,_0x45bb3d[_0x1169('0x24')]['message']);return _0x1be17b(_0x45bb3d[_0x1169('0x24')][_0x1169('0x25')]);}else{logger[_0x1169('0x26')](_0x1169('0x20'),_0x4c4b90,_0x1169('0x27'));_0x1be17b(_0x45bb3d['result']['message']);}})[_0x1169('0x28')](function(_0x5e235c){logger[_0x1169('0x24')](_0x1169('0x20'),_0x4c4b90,_0x5e235c);_0x14d651(_0x5e235c);});});}function respondWithStatusCode(_0x4a8a41,_0x49afe4){_0x49afe4=_0x49afe4||0xcc;return function(_0x2b736d){if(_0x2b736d){return _0x4a8a41[_0x1169('0x29')](_0x49afe4);}return _0x4a8a41[_0x1169('0x2a')](_0x49afe4)['end']();};}function respondWithResult(_0x29c9c4,_0x3172c2){_0x3172c2=_0x3172c2||0xc8;return function(_0x494e2a){if(_0x494e2a){return _0x29c9c4['status'](_0x3172c2)['json'](_0x494e2a);}};}function respondWithFilteredResult(_0x4d89c7,_0xa60282){return function(_0x1c5499){if(_0x1c5499){var _0x316bc4=typeof _0xa60282[_0x1169('0x2b')]===_0x1169('0x2c')&&typeof _0xa60282[_0x1169('0x2d')]===_0x1169('0x2c');var _0x562b44=_0x1c5499['count'];var _0x40fa6d=_0x316bc4?0x0:_0xa60282[_0x1169('0x2b')];var _0x23f6a7=_0x316bc4?_0x1c5499[_0x1169('0x2e')]:_0xa60282[_0x1169('0x2b')]+_0xa60282[_0x1169('0x2d')];var _0x2dae81;if(_0x23f6a7>=_0x562b44){_0x23f6a7=_0x562b44;_0x2dae81=0xc8;}else{_0x2dae81=0xce;}_0x4d89c7['status'](_0x2dae81);return _0x4d89c7['set']('Content-Range',_0x40fa6d+'-'+_0x23f6a7+'/'+_0x562b44)['json'](_0x1c5499);}return null;};}function patchUpdates(_0x494748){return function(_0x205e53){try{jsonpatch[_0x1169('0x2f')](_0x205e53,_0x494748,!![]);}catch(_0x421c28){return BPromise['reject'](_0x421c28);}return _0x205e53[_0x1169('0x30')]();};}function saveUpdates(_0xba5292,_0x1906ea){return function(_0x17fdc1){if(_0x17fdc1){return _0x17fdc1[_0x1169('0x31')](_0xba5292)[_0x1169('0x1f')](function(_0x3dee8d){return _0x3dee8d;});}return null;};}function removeEntity(_0x13a2bd,_0x14e3ce){return function(_0x27e5d2){if(_0x27e5d2){return _0x27e5d2[_0x1169('0x32')]()['then'](function(){var _0x4ed2e0=_0x27e5d2[_0x1169('0x33')]({'plain':!![]});var _0x4e4afa=_0x1169('0x34');return db[_0x1169('0x35')][_0x1169('0x32')]({'where':{'type':_0x4e4afa,'resourceId':_0x4ed2e0['id']}})[_0x1169('0x1f')](function(){return _0x27e5d2;});})[_0x1169('0x1f')](function(){_0x13a2bd['status'](0xcc)[_0x1169('0x36')]();});}};}function handleEntityNotFound(_0x597877,_0x828b65){return function(_0x5b7e00){if(!_0x5b7e00){_0x597877[_0x1169('0x29')](0x194);}return _0x5b7e00;};}function handleError(_0x27ba64,_0x70dc21){_0x70dc21=_0x70dc21||0x1f4;return function(_0x102862){logger['error'](_0x102862[_0x1169('0x37')]);if(_0x102862[_0x1169('0x38')]){delete _0x102862[_0x1169('0x38')];}_0x27ba64['status'](_0x70dc21)['send'](_0x102862);};}exports[_0x1169('0x39')]=function(_0x10cdd1,_0xb5b441){var _0x405c13={'include':[{'model':db['Pause'],'as':_0x1169('0x3a')}]},_0xcd4f28={},_0x22a479={'count':0x0,'rows':[]};var _0x521a22=_[_0x1169('0x3b')](db[_0x1169('0x3c')]['rawAttributes'],function(_0x120815){return{'name':_0x120815[_0x1169('0x3d')],'type':_0x120815[_0x1169('0x3e')][_0x1169('0x3f')]};});_0xcd4f28['model']=_[_0x1169('0x3b')](_0x521a22,_0x1169('0x38'));_0xcd4f28['query']=_['keys'](_0x10cdd1[_0x1169('0x40')]);_0xcd4f28[_0x1169('0x41')]=_['intersection'](_0xcd4f28['model'],_0xcd4f28['query']);_0x405c13['attributes']=_[_0x1169('0x42')](_0xcd4f28[_0x1169('0x43')],qs[_0x1169('0x44')](_0x10cdd1[_0x1169('0x40')][_0x1169('0x44')]));_0x405c13[_0x1169('0x45')]=_0x405c13[_0x1169('0x45')][_0x1169('0x46')]?_0x405c13[_0x1169('0x45')]:_0xcd4f28[_0x1169('0x43')];if(!_0x10cdd1[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x405c13['limit']=qs[_0x1169('0x2d')](_0x10cdd1[_0x1169('0x40')][_0x1169('0x2d')]);_0x405c13[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x10cdd1['query']['offset']);}_0x405c13[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x10cdd1[_0x1169('0x40')][_0x1169('0x4a')]);_0x405c13[_0x1169('0x4b')]=qs['filters'](_['pick'](_0x10cdd1[_0x1169('0x40')],_0xcd4f28['filters']),_0x521a22);if(_0x10cdd1['query'][_0x1169('0x4c')]){_0x405c13[_0x1169('0x4b')]=_['merge'](_0x405c13[_0x1169('0x4b')],{'$or':_['map'](_0x521a22,function(_0x154993){if(_0x154993[_0x1169('0x3e')]!=='VIRTUAL'){var _0x1ca725={};_0x1ca725[_0x154993[_0x1169('0x38')]]={'$like':'%'+_0x10cdd1[_0x1169('0x40')]['filter']+'%'};return _0x1ca725;}})});}_0x405c13=_[_0x1169('0x4d')]({},_0x405c13,_0x10cdd1[_0x1169('0x4e')]);var _0x2de50c={'where':_0x405c13[_0x1169('0x4b')]};return db['WhatsappAccount'][_0x1169('0x2e')](_0x2de50c)[_0x1169('0x1f')](function(_0x3784dd){_0x22a479[_0x1169('0x2e')]=_0x3784dd;if(_0x10cdd1[_0x1169('0x40')][_0x1169('0x4f')]){_0x405c13[_0x1169('0x50')]=[{'all':!![]}];}return db[_0x1169('0x3c')][_0x1169('0x51')](_0x405c13);})[_0x1169('0x1f')](function(_0x142d34){_0x22a479['rows']=_0x142d34;return _0x22a479;})[_0x1169('0x1f')](respondWithFilteredResult(_0xb5b441,_0x405c13))[_0x1169('0x28')](handleError(_0xb5b441,null));};exports['show']=function(_0x29455b,_0x294ff3){var _0x8d4099={'raw':![],'where':{'id':_0x29455b[_0x1169('0x52')]['id']},'include':[{'model':db[_0x1169('0x53')],'as':_0x1169('0x3a')}]},_0x24efe7={};_0x24efe7[_0x1169('0x43')]=_[_0x1169('0x54')](db[_0x1169('0x3c')][_0x1169('0x55')]);_0x24efe7['query']=_[_0x1169('0x54')](_0x29455b[_0x1169('0x40')]);_0x24efe7[_0x1169('0x41')]=_[_0x1169('0x42')](_0x24efe7[_0x1169('0x43')],_0x24efe7[_0x1169('0x40')]);_0x8d4099[_0x1169('0x45')]=_[_0x1169('0x42')](_0x24efe7[_0x1169('0x43')],qs[_0x1169('0x44')](_0x29455b['query']['fields']));_0x8d4099[_0x1169('0x45')]=_0x8d4099[_0x1169('0x45')][_0x1169('0x46')]?_0x8d4099[_0x1169('0x45')]:_0x24efe7[_0x1169('0x43')];if(_0x29455b['query'][_0x1169('0x4f')]){_0x8d4099[_0x1169('0x50')]=[{'all':!![]}];}_0x8d4099=_[_0x1169('0x4d')]({},_0x8d4099,_0x29455b[_0x1169('0x4e')]);return db[_0x1169('0x3c')][_0x1169('0x56')](_0x8d4099)[_0x1169('0x1f')](handleEntityNotFound(_0x294ff3,null))[_0x1169('0x1f')](respondWithResult(_0x294ff3,null))['catch'](handleError(_0x294ff3,null));};exports[_0x1169('0x57')]=function(_0x247e23,_0x5c9d97){return db['WhatsappAccount'][_0x1169('0x57')](_0x247e23[_0x1169('0x58')],{})[_0x1169('0x1f')](function(_0x51979e){var _0x290c01=_0x247e23[_0x1169('0x59')]['get']({'plain':!![]});if(!_0x290c01)throw new Error(_0x1169('0x5a'));if(_0x290c01[_0x1169('0x5b')]===_0x1169('0x59')){var _0x8fadc8=_0x51979e[_0x1169('0x33')]({'plain':!![]});var _0x1e05db=_0x1169('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x1e05db,'userProfileId':_0x290c01[_0x1169('0x5c')]},'raw':!![]})[_0x1169('0x1f')](function(_0x15dfca){if(_0x15dfca&&_0x15dfca[_0x1169('0x5d')]===0x0){return db[_0x1169('0x35')][_0x1169('0x57')]({'name':_0x8fadc8[_0x1169('0x38')],'resourceId':_0x8fadc8['id'],'type':_0x15dfca[_0x1169('0x38')],'sectionId':_0x15dfca['id']},{})['then'](function(){return _0x51979e;});}else{return _0x51979e;}})[_0x1169('0x28')](function(_0x56d42a){logger[_0x1169('0x24')](_0x1169('0x5e'),_0x56d42a);throw _0x56d42a;});}return _0x51979e;})[_0x1169('0x1f')](respondWithResult(_0x5c9d97,0xc9))['catch'](handleError(_0x5c9d97,null));};exports['update']=function(_0x2cf9b7,_0x40c6f7){if(_0x2cf9b7[_0x1169('0x58')]['id']){delete _0x2cf9b7[_0x1169('0x58')]['id'];}return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x2cf9b7[_0x1169('0x52')]['id']},'include':[{'model':db[_0x1169('0x53')],'as':_0x1169('0x3a')}]})[_0x1169('0x1f')](handleEntityNotFound(_0x40c6f7,null))['then'](saveUpdates(_0x2cf9b7[_0x1169('0x58')],null))[_0x1169('0x1f')](respondWithResult(_0x40c6f7,null))[_0x1169('0x28')](handleError(_0x40c6f7,null));};exports[_0x1169('0x32')]=function(_0x5d2d08,_0x5726da){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x5d2d08['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x5726da,null))[_0x1169('0x1f')](removeEntity(_0x5726da,null))[_0x1169('0x28')](handleError(_0x5726da,null));};exports['describe']=function(_0x4bf570,_0x29cb25){return db[_0x1169('0x3c')][_0x1169('0x5f')]()[_0x1169('0x1f')](respondWithResult(_0x29cb25,null))[_0x1169('0x28')](handleError(_0x29cb25,null));};exports[_0x1169('0x60')]=function(_0x5cf6c7,_0x4ae5df,_0x3e0cb0){if(_0x5cf6c7[_0x1169('0x58')]['id']){delete _0x5cf6c7['body']['id'];}return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x5cf6c7['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x4ae5df,null))[_0x1169('0x1f')](function(_0x459051){if(_0x459051){_0x5cf6c7[_0x1169('0x58')][_0x1169('0x61')]=_0x459051['id'];return db[_0x1169('0x62')][_0x1169('0x57')](_0x5cf6c7['body']);}})['then'](respondWithResult(_0x4ae5df,null))['catch'](handleError(_0x4ae5df,null));};exports[_0x1169('0x63')]=function(_0x413414,_0x149ce7,_0xeed73){var _0x3ac07d={'raw':![],'where':{}};var _0xaa342c={};var _0x4e9bf9={'count':0x0,'rows':[]};return db[_0x1169('0x3c')][_0x1169('0x64')]({'where':{'id':_0x413414['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x149ce7,null))[_0x1169('0x1f')](function(_0x16d64b){if(_0x16d64b){_0xaa342c[_0x1169('0x43')]=_[_0x1169('0x54')](db[_0x1169('0x62')]['rawAttributes']);_0xaa342c[_0x1169('0x40')]=_[_0x1169('0x54')](_0x413414[_0x1169('0x40')]);_0xaa342c['filters']=_[_0x1169('0x42')](_0xaa342c['model'],_0xaa342c['query']);_0x3ac07d[_0x1169('0x45')]=_[_0x1169('0x42')](_0xaa342c[_0x1169('0x43')],qs['fields'](_0x413414[_0x1169('0x40')][_0x1169('0x44')]));_0x3ac07d[_0x1169('0x45')]=_0x3ac07d[_0x1169('0x45')][_0x1169('0x46')]?_0x3ac07d[_0x1169('0x45')]:_0xaa342c['model'];if(!_0x413414[_0x1169('0x40')]['hasOwnProperty']('nolimit')){_0x3ac07d[_0x1169('0x2d')]=qs[_0x1169('0x2d')](_0x413414[_0x1169('0x40')]['limit']);_0x3ac07d[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x413414[_0x1169('0x40')][_0x1169('0x2b')]);}_0x3ac07d[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x413414[_0x1169('0x40')]['sort']);_0x3ac07d[_0x1169('0x4b')]=qs[_0x1169('0x41')](_[_0x1169('0x65')](_0x413414[_0x1169('0x40')],_0xaa342c[_0x1169('0x41')]));_0x3ac07d[_0x1169('0x4b')][_0x1169('0x61')]=_0x16d64b['id'];if(_0x413414[_0x1169('0x40')][_0x1169('0x4c')]){_0x3ac07d[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x3ac07d[_0x1169('0x4b')],{'$or':_[_0x1169('0x3b')](_0x3ac07d[_0x1169('0x45')],function(_0x3cbce6){var _0x367373={};_0x367373[_0x3cbce6]={'$like':'%'+_0x413414['query'][_0x1169('0x4c')]+'%'};return _0x367373;})});}_0x3ac07d=_[_0x1169('0x4d')]({},_0x3ac07d,_0x413414[_0x1169('0x4e')]);return db[_0x1169('0x62')]['count']({'where':_0x3ac07d[_0x1169('0x4b')]})[_0x1169('0x1f')](function(_0x1585fe){_0x4e9bf9[_0x1169('0x2e')]=_0x1585fe;if(_0x413414['query'][_0x1169('0x4f')]){_0x3ac07d[_0x1169('0x50')]=[{'all':!![]}];}return db[_0x1169('0x62')][_0x1169('0x51')](_0x3ac07d);})['then'](function(_0x1a3c90){_0x4e9bf9['rows']=_0x1a3c90;return _0x4e9bf9;});}})[_0x1169('0x1f')](respondWithFilteredResult(_0x149ce7,_0x3ac07d))[_0x1169('0x28')](handleError(_0x149ce7,null));};exports[_0x1169('0x66')]=function(_0x19438e,_0x1a0439,_0x462b19){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x19438e[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x1a0439,null))['then'](function(_0x2a8b02){if(_0x2a8b02){return _0x2a8b02[_0x1169('0x66')](_0x19438e[_0x1169('0x40')][_0x1169('0x67')]);}})[_0x1169('0x1f')](respondWithStatusCode(_0x1a0439,null))[_0x1169('0x28')](handleError(_0x1a0439,null));};exports[_0x1169('0x68')]=function(_0x41f49d,_0x287caa,_0x20682f){if(_0x41f49d[_0x1169('0x58')]['id']){delete _0x41f49d[_0x1169('0x58')]['id'];}return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x41f49d[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x287caa,null))[_0x1169('0x1f')](function(_0x5489ad){if(_0x5489ad){_0x41f49d['body'][_0x1169('0x61')]=_0x5489ad['id'];return db[_0x1169('0x69')][_0x1169('0x57')](_0x41f49d[_0x1169('0x58')]);}})[_0x1169('0x1f')](respondWithResult(_0x287caa,null))['catch'](handleError(_0x287caa,null));};exports[_0x1169('0x6a')]=function(_0x4e7e6e,_0x54f154,_0x2f9fbc){var _0x1e98ee={'raw':![],'where':{}};var _0x2eb8b5={};var _0x5a093e={'count':0x0,'rows':[]};return db[_0x1169('0x3c')][_0x1169('0x64')]({'where':{'id':_0x4e7e6e[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x54f154,null))['then'](function(_0x22393c){if(_0x22393c){_0x2eb8b5[_0x1169('0x43')]=_[_0x1169('0x54')](db['CannedAnswer'][_0x1169('0x55')]);_0x2eb8b5['query']=_[_0x1169('0x54')](_0x4e7e6e[_0x1169('0x40')]);_0x2eb8b5['filters']=_['intersection'](_0x2eb8b5[_0x1169('0x43')],_0x2eb8b5['query']);_0x1e98ee[_0x1169('0x45')]=_[_0x1169('0x42')](_0x2eb8b5[_0x1169('0x43')],qs['fields'](_0x4e7e6e[_0x1169('0x40')][_0x1169('0x44')]));_0x1e98ee[_0x1169('0x45')]=_0x1e98ee[_0x1169('0x45')]['length']?_0x1e98ee[_0x1169('0x45')]:_0x2eb8b5['model'];if(!_0x4e7e6e[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x1e98ee[_0x1169('0x2d')]=qs['limit'](_0x4e7e6e['query'][_0x1169('0x2d')]);_0x1e98ee[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x4e7e6e[_0x1169('0x40')][_0x1169('0x2b')]);}_0x1e98ee[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x4e7e6e[_0x1169('0x40')]['sort']);_0x1e98ee[_0x1169('0x4b')]=qs[_0x1169('0x41')](_[_0x1169('0x65')](_0x4e7e6e[_0x1169('0x40')],_0x2eb8b5[_0x1169('0x41')]));_0x1e98ee[_0x1169('0x4b')][_0x1169('0x61')]=_0x22393c['id'];if(_0x4e7e6e[_0x1169('0x40')][_0x1169('0x4c')]){_0x1e98ee[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x1e98ee[_0x1169('0x4b')],{'$or':_[_0x1169('0x3b')](_0x1e98ee['attributes'],function(_0x1d4bfc){var _0x44b712={};_0x44b712[_0x1d4bfc]={'$like':'%'+_0x4e7e6e[_0x1169('0x40')][_0x1169('0x4c')]+'%'};return _0x44b712;})});}_0x1e98ee=_[_0x1169('0x4d')]({},_0x1e98ee,_0x4e7e6e[_0x1169('0x4e')]);return db['CannedAnswer'][_0x1169('0x2e')]({'where':_0x1e98ee[_0x1169('0x4b')]})[_0x1169('0x1f')](function(_0xe05b48){_0x5a093e['count']=_0xe05b48;if(_0x4e7e6e[_0x1169('0x40')]['includeAll']){_0x1e98ee[_0x1169('0x50')]=[{'all':!![]}];}return db[_0x1169('0x69')]['findAll'](_0x1e98ee);})[_0x1169('0x1f')](function(_0x424ccc){_0x5a093e[_0x1169('0x6b')]=_0x424ccc;return _0x5a093e;});}})[_0x1169('0x1f')](respondWithFilteredResult(_0x54f154,_0x1e98ee))[_0x1169('0x28')](handleError(_0x54f154,null));};exports[_0x1169('0x6c')]=function(_0x1380c8,_0x2cbd5d,_0x554dde){return db[_0x1169('0x3c')]['find']({'where':{'id':_0x1380c8[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x2cbd5d,null))[_0x1169('0x1f')](function(_0x1a11f9){if(_0x1a11f9){return _0x1a11f9[_0x1169('0x6c')](_0x1380c8[_0x1169('0x40')][_0x1169('0x67')]);}})['then'](respondWithStatusCode(_0x2cbd5d,null))['catch'](handleError(_0x2cbd5d,null));};exports[_0x1169('0x6d')]=function(_0x1e0f78,_0x27805f,_0x105ad1){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x1e0f78[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x27805f,null))['then'](function(_0x39a7b0){if(_0x39a7b0){return _0x39a7b0[_0x1169('0x6d')](_0x1e0f78[_0x1169('0x58')][_0x1169('0x67')],_['omit'](_0x1e0f78[_0x1169('0x58')],['ids','id'])||{})[_0x1169('0x6e')](function(_0x10c81e){for(var _0x295fa0=0x0;_0x295fa0<_0x1e0f78[_0x1169('0x58')]['ids'][_0x1169('0x46')];_0x295fa0+=0x1){socket[_0x1169('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x1e0f78['body']['ids'][_0x295fa0]),'WhatsappAccountId':Number(_0x1e0f78['params']['id'])});}return _0x10c81e;});}})[_0x1169('0x1f')](respondWithResult(_0x27805f,null))['catch'](handleError(_0x27805f,null));};exports[_0x1169('0x70')]=function(_0x501916,_0x81946a,_0x18b726){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x501916[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x81946a,null))[_0x1169('0x1f')](function(_0x5b6885){if(_0x5b6885){return _0x5b6885[_0x1169('0x70')](_0x501916[_0x1169('0x40')][_0x1169('0x67')])[_0x1169('0x1f')](function(){if(_['isArray'](_0x501916[_0x1169('0x40')][_0x1169('0x67')])){for(var _0x3831fb=0x0;_0x3831fb<_0x501916[_0x1169('0x40')][_0x1169('0x67')]['length'];_0x3831fb+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x501916[_0x1169('0x40')][_0x1169('0x67')][_0x3831fb]),'WhatsappAccountId':Number(_0x501916[_0x1169('0x52')]['id'])});}}else{socket['emit'](_0x1169('0x71'),{'UserId':Number(_0x501916[_0x1169('0x40')]['ids']),'WhatsappAccountId':Number(_0x501916[_0x1169('0x52')]['id'])});}});}})[_0x1169('0x1f')](respondWithStatusCode(_0x81946a,null))[_0x1169('0x28')](handleError(_0x81946a,null));};exports[_0x1169('0x72')]=function(_0x4133c1,_0x58d677,_0x178d31){var _0x175e44={};var _0xf5b5af={};var _0x464656;var _0xea3603;return db[_0x1169('0x3c')][_0x1169('0x64')]({'where':{'id':_0x4133c1[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x58d677,null))[_0x1169('0x1f')](function(_0x466d30){if(_0x466d30){_0x464656=_0x466d30;_0xf5b5af[_0x1169('0x43')]=_[_0x1169('0x54')](db['User'][_0x1169('0x55')]);_0xf5b5af[_0x1169('0x40')]=_[_0x1169('0x54')](_0x4133c1[_0x1169('0x40')]);_0xf5b5af[_0x1169('0x41')]=_[_0x1169('0x42')](_0xf5b5af[_0x1169('0x43')],_0xf5b5af[_0x1169('0x40')]);_0x175e44['attributes']=_[_0x1169('0x42')](_0xf5b5af[_0x1169('0x43')],qs[_0x1169('0x44')](_0x4133c1[_0x1169('0x40')]['fields']));_0x175e44[_0x1169('0x45')]=_0x175e44[_0x1169('0x45')][_0x1169('0x46')]?_0x175e44[_0x1169('0x45')]:_0xf5b5af['model'];_0x175e44[_0x1169('0x49')]=qs['sort'](_0x4133c1[_0x1169('0x40')][_0x1169('0x4a')]);_0x175e44[_0x1169('0x4b')]=qs[_0x1169('0x41')](_[_0x1169('0x65')](_0x4133c1[_0x1169('0x40')],_0xf5b5af[_0x1169('0x41')]));if(_0x4133c1[_0x1169('0x40')][_0x1169('0x4c')]){_0x175e44[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x175e44[_0x1169('0x4b')],{'$or':_['map'](_0x175e44[_0x1169('0x45')],function(_0x103c30){var _0x13b282={};_0x13b282[_0x103c30]={'$like':'%'+_0x4133c1[_0x1169('0x40')][_0x1169('0x4c')]+'%'};return _0x13b282;})});}_0x175e44=_['merge']({},_0x175e44,_0x4133c1['options']);return _0x464656[_0x1169('0x72')](_0x175e44);}})[_0x1169('0x1f')](function(_0xae13ec){if(_0xae13ec){_0xea3603=_0xae13ec[_0x1169('0x46')];if(!_0x4133c1[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x175e44[_0x1169('0x2d')]=qs[_0x1169('0x2d')](_0x4133c1[_0x1169('0x40')][_0x1169('0x2d')]);_0x175e44[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x4133c1[_0x1169('0x40')][_0x1169('0x2b')]);}return _0x464656['getAgents'](_0x175e44);}})[_0x1169('0x1f')](function(_0x66956c){if(_0x66956c){return _0x66956c?{'count':_0xea3603,'rows':_0x66956c}:null;}})['then'](respondWithResult(_0x58d677,null))['catch'](handleError(_0x58d677,null));};exports[_0x1169('0x73')]=function(_0x396f69,_0x5d1435){var _0x174927=_0x396f69[_0x1169('0x52')]['id'];var _0x4021af=_0x396f69[_0x1169('0x58')];var _0x576509=0xc8;var _0x2ccf16=null;return db[_0x1169('0x74')][_0x1169('0x75')]({'isolationLevel':db[_0x1169('0x74')][_0x1169('0x76')]['ISOLATION_LEVELS'][_0x1169('0x77')]},function(_0x48dd9d){return db['WhatsappAccount'][_0x1169('0x64')]({'where':{'id':_0x174927},'transaction':_0x48dd9d})[_0x1169('0x1f')](function(_0x5d7822){if(_0x5d7822){return db['WhatsappApplication'][_0x1169('0x32')]({'where':{'WhatsappAccountId':_0x174927},'transaction':_0x48dd9d})[_0x1169('0x1f')](function(){var _0x4b7732=_[_0x1169('0x3b')](_0x4021af,function(_0x114c63){_0x114c63[_0x1169('0x61')]=_0x174927;return _0x114c63;});return db[_0x1169('0x78')][_0x1169('0x79')](_0x4b7732,{'transaction':_0x48dd9d});});}else{_0x576509=0x194;_0x2ccf16=[];}});})['then'](function(){if(_0x576509!==0x194){return db[_0x1169('0x78')][_0x1169('0x7a')]({'where':{'WhatsappAccountId':_0x174927},'order':_0x1169('0x7b')})[_0x1169('0x1f')](function(_0x268f40){_0x2ccf16=_0x268f40;});}})['catch'](function(_0x24d704){_0x576509=0x1f4;logger['error'](_0x24d704[_0x1169('0x37')]);if(_0x24d704[_0x1169('0x38')]){delete _0x24d704[_0x1169('0x38')];}_0x2ccf16=_0x24d704;})[_0x1169('0x7c')](function(){if(_0x2ccf16===null){_0x5d1435[_0x1169('0x29')](_0x576509);}else{if(_0x576509===0x1f4){_0x5d1435[_0x1169('0x2a')](_0x576509)[_0x1169('0x7d')](_0x2ccf16);}else{_0x5d1435[_0x1169('0x2a')](_0x576509)[_0x1169('0x7e')](_0x2ccf16);}}});};exports[_0x1169('0x7f')]=function(_0x59a0dc,_0x8e28ea,_0x5c4e54){var _0x58b3c6={};var _0x109dc6={};var _0x489320;var _0x48702b;return db['WhatsappAccount'][_0x1169('0x64')]({'where':{'id':_0x59a0dc['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x8e28ea,null))[_0x1169('0x1f')](function(_0x56504e){if(_0x56504e){_0x489320=_0x56504e;_0x109dc6[_0x1169('0x43')]=_['keys'](db[_0x1169('0x78')][_0x1169('0x55')]);_0x109dc6['query']=_[_0x1169('0x54')](_0x59a0dc['query']);_0x109dc6[_0x1169('0x41')]=_['intersection'](_0x109dc6[_0x1169('0x43')],_0x109dc6[_0x1169('0x40')]);_0x58b3c6['attributes']=_[_0x1169('0x42')](_0x109dc6[_0x1169('0x43')],qs['fields'](_0x59a0dc[_0x1169('0x40')][_0x1169('0x44')]));_0x58b3c6['attributes']=_0x58b3c6[_0x1169('0x45')][_0x1169('0x46')]?_0x58b3c6[_0x1169('0x45')]:_0x109dc6[_0x1169('0x43')];_0x58b3c6[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x59a0dc['query'][_0x1169('0x4a')]);_0x58b3c6[_0x1169('0x4b')]=qs['filters'](_[_0x1169('0x65')](_0x59a0dc[_0x1169('0x40')],_0x109dc6['filters']));if(_0x59a0dc[_0x1169('0x40')]['filter']){_0x58b3c6[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x58b3c6[_0x1169('0x4b')],{'$or':_[_0x1169('0x3b')](_0x58b3c6['attributes'],function(_0x2fba80){var _0x25d715={};_0x25d715[_0x2fba80]={'$like':'%'+_0x59a0dc[_0x1169('0x40')]['filter']+'%'};return _0x25d715;})});}_0x58b3c6=_[_0x1169('0x4d')]({},_0x58b3c6,_0x59a0dc['options']);return _0x489320['getApplications'](_0x58b3c6);}})[_0x1169('0x1f')](function(_0x353cc7){if(_0x353cc7){_0x48702b=_0x353cc7['length'];if(!_0x59a0dc[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x58b3c6['limit']=qs[_0x1169('0x2d')](_0x59a0dc[_0x1169('0x40')][_0x1169('0x2d')]);_0x58b3c6[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x59a0dc[_0x1169('0x40')][_0x1169('0x2b')]);}return _0x489320[_0x1169('0x7f')](_0x58b3c6);}})[_0x1169('0x1f')](function(_0x3cddb3){if(_0x3cddb3){return _0x3cddb3?{'count':_0x48702b,'rows':_0x3cddb3}:null;}})[_0x1169('0x1f')](respondWithResult(_0x8e28ea,null))[_0x1169('0x28')](handleError(_0x8e28ea,null));};exports[_0x1169('0x80')]=function(_0xf1bf1f,_0xde0670,_0x1bb575){var _0x1585b2={'channel':_0x1169('0x81')};var _0x2a2473=[];var _0x422eda=[];var _0x309c66={};return db['WhatsappAccount'][_0x1169('0x56')]({'where':{'id':_0xf1bf1f[_0x1169('0x52')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1169('0x82')}]})[_0x1169('0x1f')](handleEntityNotFound(_0xde0670,null))[_0x1169('0x1f')](function(_0x54e769){_0x1585b2[_0x1169('0x83')]=_0x54e769;if(_0x1585b2[_0x1169('0x83')]&&_0x1585b2['account'][_0x1169('0x3e')]==='sinch'&&_0xf1bf1f['body'][_0x1169('0x84')]){if(_0xf1bf1f[_0x1169('0x58')][_0x1169('0x84')][_0x1169('0x46')]===0x0)return;if(_0xf1bf1f[_0x1169('0x58')][_0x1169('0x84')][0x0][_0x1169('0x85')]!==_0x1169('0x86'))return;return db[_0x1169('0x87')]['update']({'read':!![],'readAt':_0xf1bf1f[_0x1169('0x58')][_0x1169('0x84')][0x0][_0x1169('0x88')]},{'where':{'messageId':_0xf1bf1f[_0x1169('0x58')]['statuses'][0x0][_0x1169('0x89')]},'individualHooks':!![]})[_0x1169('0x1f')](function(_0x19aa5d){return _0xde0670['status'](0xc8)[_0x1169('0x7e')](_0x19aa5d);});}_0x1585b2[_0x1169('0x8a')]=_['orderBy'](_0x54e769[_0x1169('0x82')],[_0x1169('0x7b')],[_0x1169('0x8b')]);if(_0x1585b2[_0x1169('0x83')][_0x1169('0x82')]){delete _0x1585b2[_0x1169('0x83')][_0x1169('0x82')];}return db[_0x1169('0x8c')][_0x1169('0x5f')]()[_0x1169('0x1f')](function(_0xdee68c){if(!_0xdee68c){throw new db[(_0x1169('0x8d'))]['ValidationError'](_0x1169('0x8e'));}_0x2a2473=_[_0x1169('0x8f')](_[_0x1169('0x54')](_0xdee68c),[_0x1169('0x90'),_0x1169('0x91')]);_0x422eda=_['difference'](_[_0x1169('0x54')](_0xdee68c),[_0x1169('0x90'),_0x1169('0x91'),_0x1169('0x92'),_0x1169('0x93')]);_0x1585b2[_0x1169('0x58')]={'mapKey':_0x1169('0x94')};if(_0x1585b2[_0x1169('0x83')]&&_0x1585b2[_0x1169('0x83')][_0x1169('0x3e')]===_0x1169('0x95')){_0x1585b2[_0x1169('0x58')][_0x1169('0x96')]=_0xf1bf1f['body']['From'][_0x1169('0x97')](_0x1169('0x98'),'');_0x1585b2[_0x1169('0x58')][_0x1169('0x58')]=_0xf1bf1f[_0x1169('0x58')][_0x1169('0x99')];_0x1585b2[_0x1169('0x58')][_0x1169('0x9a')]=_0xf1bf1f['body'][_0x1169('0x9b')];}if(_0x1585b2[_0x1169('0x83')]&&_0x1585b2['account']['type']===_0x1169('0x9c')){_0x1585b2[_0x1169('0x58')]['from']=_0xf1bf1f[_0x1169('0x58')][_0x1169('0x9d')][0x0][_0x1169('0x96')];_0x1585b2[_0x1169('0x58')]['body']=_0xf1bf1f[_0x1169('0x58')]['notifications'][0x0][_0x1169('0x25')]['body'];_0x1585b2[_0x1169('0x58')][_0x1169('0x9a')]=_0xf1bf1f[_0x1169('0x58')]['notifications'][0x0][_0x1169('0x89')];}if(_0x1585b2[_0x1169('0x58')]['id']){delete _0x1585b2[_0x1169('0x58')]['id'];}if(_['isNil'](_0x1585b2['body'][_0x1169('0x96')])){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))](_0x1169('0x9f'));}if(_[_0x1169('0xa0')](_0x1585b2[_0x1169('0x58')][_0x1169('0x58')])||_0x1585b2['body'][_0x1169('0x58')]===''){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1169('0xa0')](_0x1585b2[_0x1169('0x58')][_0x1169('0xa1')])){throw new db['Sequelize'][(_0x1169('0x9e'))](_0x1169('0xa2')+_0x422eda);}if(!_[_0x1169('0xa3')](_0x422eda,_0x1585b2['body']['mapKey'])){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x422eda);}_0x309c66[_0x1585b2[_0x1169('0x58')][_0x1169('0xa1')]]=_0x1585b2[_0x1169('0x58')]['from'];return db['CmList'][_0x1169('0x56')]({'where':{'id':_0x1585b2[_0x1169('0x83')][_0x1169('0x93')]},'include':[{'model':db[_0x1169('0x8c')],'as':_0x1169('0xa4'),'where':_0x309c66,'limit':0x1,'order':[['updatedAt',_0x1169('0xa5')]]}]});})[_0x1169('0x1f')](handleEntityNotFound(_0xde0670,null))['then'](function(_0x2959ab){if(_0x2959ab){_0x1585b2[_0x1169('0xa6')]=_[_0x1169('0xa7')](_0x2959ab,[_0x1169('0xa4')]);if(_0x2959ab['Contacts'][_0x1169('0x46')]){return _0x2959ab[_0x1169('0xa4')][0x0];}var _0x49f190=_[_0x1169('0xa8')](_0x1585b2[_0x1169('0x58')],{'firstName':_0x1585b2[_0x1169('0x58')][_0x1169('0x96')],'ListId':_0x2959ab['id']});_0x49f190[_0x1585b2['body'][_0x1169('0xa1')]]=_0x1585b2[_0x1169('0x58')][_0x1169('0x96')];return db[_0x1169('0x8c')][_0x1169('0x57')](_0x49f190,{'fields':_0x2a2473,'raw':!![]});}})[_0x1169('0x1f')](handleEntityNotFound(_0xde0670,null))[_0x1169('0x1f')](function(_0x18306f){if(_0x18306f){_0x1585b2[_0x1169('0xa9')]=_0x18306f;var _0x1f5a11={'ContactId':_0x18306f['id'],'phone':_0x1585b2[_0x1169('0x58')][_0x1169('0x96')],'WhatsappAccountId':_0xf1bf1f[_0x1169('0x52')]['id']};var _0x251c3c={'ContactId':_0x18306f['id'],'WhatsappAccountId':_0xf1bf1f[_0x1169('0x52')]['id'],'closed':![]};return db[_0x1169('0xaa')][_0x1169('0x56')]({'where':_0x251c3c})[_0x1169('0x1f')](function(_0x226235){if(_0x226235){return[_0x226235,![]];}return db[_0x1169('0xaa')][_0x1169('0x57')](_0x1f5a11)[_0x1169('0x1f')](function(_0x508a91){return[_0x508a91,!![]];});});}})['spread'](function(_0x13d847,_0x5728b4){_0x1585b2[_0x1169('0xab')]=_0x13d847[_0x1169('0x33')]({'plain':!![]});_0x1585b2[_0x1169('0xab')]['created']=![];if(_0x5728b4){if(_0x1585b2[_0x1169('0x83')][_0x1169('0xac')]){_0x1585b2['applications'][_0x1169('0xad')]({'id':0x0,'priority':_0x1585b2[_0x1169('0x8a')][_0x1169('0x46')]+0x1,'app':_0x1169('0xae'),'appdata':_0x1169('0xaf'),'interval':'*,*,*,*'});}_0x1585b2[_0x1169('0xab')][_0x1169('0xb0')]=!![];}return db[_0x1169('0x87')]['create']({'phone':_0x1585b2[_0x1169('0x58')][_0x1169('0x96')],'messageId':_0x1585b2['body'][_0x1169('0x9a')],'body':_0x1585b2[_0x1169('0x58')][_0x1169('0x58')],'WhatsappAccountId':_0xf1bf1f[_0x1169('0x52')]['id'],'WhatsappInteractionId':_0x13d847['id'],'direction':'in','ContactId':_0x13d847[_0x1169('0xb1')],'AttachmentId':_0x1585b2['body'][_0x1169('0xb2')]});})['then'](function(_0xf2373f){_0x1585b2[_0x1169('0x25')]=_0xf2373f;if(!_0x1585b2['interaction']['UserId'])return;return db[_0x1169('0xb3')][_0x1169('0x56')]({'attributes':['id',_0x1169('0x38')],'where':{'id':_0x1585b2[_0x1169('0xab')][_0x1169('0xb4')]}});})['then'](function(_0x311764){if(_0x311764){_0x1585b2[_0x1169('0x8a')][_0x1169('0xb5')]({'id':0x0,'priority':0x0,'app':_0x1169('0xb6'),'appdata':_0x311764['name']+','+(_0x1585b2[_0x1169('0x83')][_0x1169('0xb7')]||0xa),'interval':'*,*,*,*'});}if(!_0x1585b2[_0x1169('0xab')][_0x1169('0xb8')])return;return db[_0x1169('0xb9')][_0x1169('0x56')]({'attributes':['id','name'],'where':{'id':_0x1585b2['interaction'][_0x1169('0xb8')]}});})[_0x1169('0x1f')](function(_0x50de0b){if(_0x50de0b){_0x1585b2['applications'][_0x1169('0xb5')]({'id':0x0,'priority':0x1,'app':_0x1169('0xba'),'appdata':_0x50de0b[_0x1169('0x38')]+','+(_0x1585b2[_0x1169('0x83')][_0x1169('0xbb')]||0x12c),'interval':_0x1169('0xbc')});}return respondWithRpcPromise(_0x1169('0xbd'),'startRouting',_0x1585b2);})[_0x1169('0x1f')](function(_0x1cf98a){if(_0x1cf98a){var _0x4a99f4=0xc8;var _0x20c04e=_0x1169('0xbe');logger[_0x1169('0x26')](_0x1169('0xbf'),_0x20c04e,_0x4a99f4,_0x1169('0xc0'));logger[_0x1169('0x21')](_0x1169('0xc1'),_0x20c04e,_0x4a99f4,_0x1169('0xc0'),JSON[_0x1169('0x22')](_0x1cf98a));if(_0x1585b2['account'][_0x1169('0x3e')]===_0x1169('0x95')){return _0xde0670[_0x1169('0x2a')](_0x4a99f4)[_0x1169('0xc2')](_0x1169('0xc3'),_0x1169('0xc4'))[_0x1169('0x7d')](_0x1169('0xc5'));}else{return _0xde0670[_0x1169('0x2a')](_0x4a99f4)[_0x1169('0x7e')](_0x1cf98a);}}});})[_0x1169('0x28')](handleError(_0xde0670,null));};exports[_0x1169('0x7d')]=function(_0x3765f2,_0x43379c,_0x51390c){var _0x52de63,_0x51c2cd,_0x133984;if(_[_0x1169('0xa0')](_0x3765f2[_0x1169('0x58')][_0x1169('0x58')])||_0x3765f2[_0x1169('0x58')][_0x1169('0x58')]===''){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))](_0x1169('0xc6'));}if(_['isNil'](_0x3765f2[_0x1169('0x58')]['to'])){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))](_0x1169('0xc7'));}_0x52de63=_0x3765f2[_0x1169('0x58')]['to'];return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x3765f2[_0x1169('0x52')]['id']},'include':[{'model':db[_0x1169('0xc8')],'as':_0x1169('0xc9'),'include':[{'model':db[_0x1169('0x8c')],'as':'Contacts','where':{'mobile':_0x52de63},'limit':0x1,'order':[[_0x1169('0x91'),_0x1169('0xa5')]]}]}]})[_0x1169('0x1f')](handleEntityNotFound(_0x43379c,null))['then'](function(_0x4ddd01){if(_0x4ddd01&&_0x4ddd01[_0x1169('0xc9')]){_0x51c2cd=_0x4ddd01[_0x1169('0x33')]({'plain':!![]});if(_0x51c2cd[_0x1169('0xc9')]&&_0x51c2cd[_0x1169('0xc9')][_0x1169('0xa4')][_0x1169('0x46')]){return _0x51c2cd[_0x1169('0xc9')][_0x1169('0xa4')][0x0];}return db[_0x1169('0x8c')][_0x1169('0x57')](_['defaults'](_0x3765f2[_0x1169('0x58')],{'firstName':_0x52de63,'mobile':_0x52de63,'phone':_0x52de63,'ListId':_0x51c2cd['ListId']}));}})[_0x1169('0x1f')](handleEntityNotFound(_0x43379c,null))[_0x1169('0x1f')](function(_0x52de55){if(_0x52de55){_0x133984=_0x52de55;return db[_0x1169('0xaa')][_0x1169('0x56')]({'where':{'ContactId':_0x133984['id'],'closed':![],'WhatsappAccountId':_0x51c2cd['id']}})[_0x1169('0x1f')](function(_0x23f1a9){if(_0x23f1a9){return[_0x23f1a9,![]];}return db['WhatsappInteraction'][_0x1169('0x57')]({'UserId':_0x3765f2[_0x1169('0x59')]['id'],'ContactId':_0x133984['id'],'WhatsappAccountId':_0x51c2cd['id'],'phone':_0x52de63,'firstMsgDirection':_0x1169('0xca'),'Messages':[_['merge'](_0x3765f2[_0x1169('0x58')],{'read':![],'body':_0x3765f2[_0x1169('0x58')][_0x1169('0x58')],'phone':_0x52de63,'WhatsappAccountId':_0x51c2cd['id'],'UserId':_0x3765f2[_0x1169('0x59')]['id'],'ContactId':_0x133984['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x1169('0x1f')](function(_0x49d17b){return[_0x49d17b,!![]];});});}})['spread'](function(_0x22d777,_0x50885f){if(_0x50885f){return _0x22d777;}return db['WhatsappMessage']['create'](_[_0x1169('0x4d')](_0x3765f2[_0x1169('0x58')],{'read':![],'body':_0x3765f2[_0x1169('0x58')][_0x1169('0x58')],'phone':_0x52de63,'WhatsappAccountId':_0x51c2cd['id'],'WhatsappInteractionId':_0x22d777['id'],'UserId':_0x3765f2[_0x1169('0x59')]['id'],'ContactId':_0x133984['id']}))['then'](function(_0x2e0b81){_0x22d777[_0x1169('0xcb')][_0x1169('0xcc')]=[];_0x22d777['dataValues']['Messages'][_0x1169('0xad')](_0x2e0b81[_0x1169('0xcb')]);return _0x22d777;});})[_0x1169('0x1f')](respondWithResult(_0x43379c,null))[_0x1169('0x28')](handleError(_0x43379c,null));}; \ No newline at end of file +var _0x10bf=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','type','key','model','intersection','query','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','WhatsappAccount','includeAll','include','findAll','params','keys','rawAttributes','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','ids','omit','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','findOne','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x10bf,0xf3));var _0xf10b=function(_0x7ec937,_0xbe3b08){_0x7ec937=_0x7ec937-0x0;var _0x150040=_0x10bf[_0x7ec937];return _0x150040;};'use strict';var emlformat=require(_0xf10b('0x0'));var rimraf=require(_0xf10b('0x1'));var zipdir=require(_0xf10b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf10b('0x3'));var BPromise=require(_0xf10b('0x4'));var Mustache=require(_0xf10b('0x5'));var util=require('util');var path=require(_0xf10b('0x6'));var sox=require(_0xf10b('0x7'));var csv=require('to-csv');var ejs=require(_0xf10b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf10b('0x9'));var crypto=require(_0xf10b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf10b('0xb'));var toCsv=require(_0xf10b('0xc'));var querystring=require(_0xf10b('0xd'));var Papa=require(_0xf10b('0xe'));var Redis=require(_0xf10b('0xf'));var authService=require(_0xf10b('0x10'));var qs=require(_0xf10b('0x11'));var as=require(_0xf10b('0x12'));var hardwareService=require(_0xf10b('0x13'));var logger=require('../../config/logger')(_0xf10b('0x14'));var utils=require('../../config/utils');var config=require(_0xf10b('0x15'));var licenseUtil=require(_0xf10b('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf10b('0x17')](config[_0xf10b('0x18')],{'host':_0xf10b('0x19'),'port':0x18eb});var socket=require(_0xf10b('0x1a'))(new Redis(config[_0xf10b('0x18')]));require('./whatsappAccount.socket')[_0xf10b('0x1b')](socket);var jayson=require(_0xf10b('0x1c'));var client=jayson[_0xf10b('0x1d')][_0xf10b('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x310c64,_0x3ed250,_0x5f1cf,_0x5de332){return new BPromise(function(_0x2e7c75,_0x43da5c){var _0x1cbdd8=_0x5de332||client;return _0x1cbdd8[_0xf10b('0x1f')](_0x310c64,_0x5f1cf)[_0xf10b('0x20')](function(_0x2ddf00){logger[_0xf10b('0x21')](_0xf10b('0x22'),_0x3ed250,_0xf10b('0x23'));logger[_0xf10b('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3ed250,_0xf10b('0x23'),JSON[_0xf10b('0x25')](_0x2ddf00));if(_0x2ddf00[_0xf10b('0x26')]){if(_0x2ddf00['error'][_0xf10b('0x27')]===0x1f4){logger[_0xf10b('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x3ed250,_0x2ddf00[_0xf10b('0x26')][_0xf10b('0x28')]);return _0x43da5c(_0x2ddf00[_0xf10b('0x26')][_0xf10b('0x28')]);}logger[_0xf10b('0x26')](_0xf10b('0x22'),_0x3ed250,_0x2ddf00[_0xf10b('0x26')][_0xf10b('0x28')]);return _0x2e7c75(_0x2ddf00['error'][_0xf10b('0x28')]);}else{logger[_0xf10b('0x21')](_0xf10b('0x22'),_0x3ed250,_0xf10b('0x23'));_0x2e7c75(_0x2ddf00[_0xf10b('0x29')][_0xf10b('0x28')]);}})[_0xf10b('0x2a')](function(_0x2c4c80){logger[_0xf10b('0x26')](_0xf10b('0x22'),_0x3ed250,_0x2c4c80);_0x43da5c(_0x2c4c80);});});}function respondWithStatusCode(_0x9c397a,_0x2fec72){_0x2fec72=_0x2fec72||0xcc;return function(_0x57f2fc){if(_0x57f2fc){return _0x9c397a[_0xf10b('0x2b')](_0x2fec72);}return _0x9c397a[_0xf10b('0x2c')](_0x2fec72)[_0xf10b('0x2d')]();};}function respondWithResult(_0x16bfc5,_0x1b6f55){_0x1b6f55=_0x1b6f55||0xc8;return function(_0x20c75a){if(_0x20c75a){return _0x16bfc5['status'](_0x1b6f55)[_0xf10b('0x2e')](_0x20c75a);}};}function respondWithFilteredResult(_0x502d44,_0x29bb4d){return function(_0x314e20){if(_0x314e20){var _0x276c2a=typeof _0x29bb4d[_0xf10b('0x2f')]===_0xf10b('0x30')&&typeof _0x29bb4d[_0xf10b('0x31')]===_0xf10b('0x30');var _0x189ca2=_0x314e20[_0xf10b('0x32')];var _0x553e57=_0x276c2a?0x0:_0x29bb4d[_0xf10b('0x2f')];var _0x4c62e3=_0x276c2a?_0x314e20['count']:_0x29bb4d['offset']+_0x29bb4d[_0xf10b('0x31')];var _0x2cf5e4;if(_0x4c62e3>=_0x189ca2){_0x4c62e3=_0x189ca2;_0x2cf5e4=0xc8;}else{_0x2cf5e4=0xce;}_0x502d44[_0xf10b('0x2c')](_0x2cf5e4);return _0x502d44['set']('Content-Range',_0x553e57+'-'+_0x4c62e3+'/'+_0x189ca2)['json'](_0x314e20);}return null;};}function patchUpdates(_0x1bbc73){return function(_0x515627){try{jsonpatch[_0xf10b('0x33')](_0x515627,_0x1bbc73,!![]);}catch(_0x161f46){return BPromise[_0xf10b('0x34')](_0x161f46);}return _0x515627[_0xf10b('0x35')]();};}function saveUpdates(_0x5b870d,_0x2ccc05){return function(_0x4265a0){if(_0x4265a0){return _0x4265a0[_0xf10b('0x36')](_0x5b870d)[_0xf10b('0x20')](function(_0x5805a0){return _0x5805a0;});}return null;};}function removeEntity(_0x3b7343,_0x501c5f){return function(_0x260450){if(_0x260450){return _0x260450[_0xf10b('0x37')]()[_0xf10b('0x20')](function(){var _0x5cbeaa=_0x260450['get']({'plain':!![]});var _0x5d37ec=_0xf10b('0x38');return db[_0xf10b('0x39')][_0xf10b('0x37')]({'where':{'type':_0x5d37ec,'resourceId':_0x5cbeaa['id']}})[_0xf10b('0x20')](function(){return _0x260450;});})[_0xf10b('0x20')](function(){_0x3b7343[_0xf10b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x304549,_0x28dc20){return function(_0x3922fb){if(!_0x3922fb){_0x304549[_0xf10b('0x2b')](0x194);}return _0x3922fb;};}function handleError(_0xa33eb3,_0x57cd54){_0x57cd54=_0x57cd54||0x1f4;return function(_0x2dd3c8){logger[_0xf10b('0x26')](_0x2dd3c8['stack']);if(_0x2dd3c8['name']){delete _0x2dd3c8[_0xf10b('0x3a')];}_0xa33eb3[_0xf10b('0x2c')](_0x57cd54)[_0xf10b('0x3b')](_0x2dd3c8);};}exports[_0xf10b('0x3c')]=function(_0x341ac5,_0x90036f){var _0x1412b2={'include':[{'model':db[_0xf10b('0x3d')],'as':_0xf10b('0x3e')}]},_0x2e471b={},_0x4ab125={'count':0x0,'rows':[]};var _0xc56dc6=_[_0xf10b('0x3f')](db['WhatsappAccount']['rawAttributes'],function(_0x958298){return{'name':_0x958298['fieldName'],'type':_0x958298[_0xf10b('0x40')][_0xf10b('0x41')]};});_0x2e471b[_0xf10b('0x42')]=_[_0xf10b('0x3f')](_0xc56dc6,'name');_0x2e471b['query']=_['keys'](_0x341ac5['query']);_0x2e471b['filters']=_[_0xf10b('0x43')](_0x2e471b['model'],_0x2e471b[_0xf10b('0x44')]);_0x1412b2[_0xf10b('0x45')]=_[_0xf10b('0x43')](_0x2e471b[_0xf10b('0x42')],qs['fields'](_0x341ac5[_0xf10b('0x44')][_0xf10b('0x46')]));_0x1412b2[_0xf10b('0x45')]=_0x1412b2['attributes'][_0xf10b('0x47')]?_0x1412b2[_0xf10b('0x45')]:_0x2e471b[_0xf10b('0x42')];if(!_0x341ac5[_0xf10b('0x44')]['hasOwnProperty'](_0xf10b('0x48'))){_0x1412b2[_0xf10b('0x31')]=qs[_0xf10b('0x31')](_0x341ac5[_0xf10b('0x44')][_0xf10b('0x31')]);_0x1412b2[_0xf10b('0x2f')]=qs[_0xf10b('0x2f')](_0x341ac5[_0xf10b('0x44')][_0xf10b('0x2f')]);}_0x1412b2[_0xf10b('0x49')]=qs['sort'](_0x341ac5[_0xf10b('0x44')][_0xf10b('0x4a')]);_0x1412b2['where']=qs[_0xf10b('0x4b')](_[_0xf10b('0x4c')](_0x341ac5['query'],_0x2e471b[_0xf10b('0x4b')]),_0xc56dc6);if(_0x341ac5[_0xf10b('0x44')][_0xf10b('0x4d')]){_0x1412b2[_0xf10b('0x4e')]=_[_0xf10b('0x4f')](_0x1412b2[_0xf10b('0x4e')],{'$or':_['map'](_0xc56dc6,function(_0x1b4907){if(_0x1b4907[_0xf10b('0x40')]!=='VIRTUAL'){var _0x3e22bd={};_0x3e22bd[_0x1b4907[_0xf10b('0x3a')]]={'$like':'%'+_0x341ac5[_0xf10b('0x44')][_0xf10b('0x4d')]+'%'};return _0x3e22bd;}})});}_0x1412b2=_[_0xf10b('0x4f')]({},_0x1412b2,_0x341ac5[_0xf10b('0x50')]);var _0x1eed7a={'where':_0x1412b2[_0xf10b('0x4e')]};return db[_0xf10b('0x51')][_0xf10b('0x32')](_0x1eed7a)[_0xf10b('0x20')](function(_0x356c3e){_0x4ab125['count']=_0x356c3e;if(_0x341ac5['query'][_0xf10b('0x52')]){_0x1412b2[_0xf10b('0x53')]=[{'all':!![]}];}return db[_0xf10b('0x51')][_0xf10b('0x54')](_0x1412b2);})['then'](function(_0x2834e0){_0x4ab125['rows']=_0x2834e0;return _0x4ab125;})[_0xf10b('0x20')](respondWithFilteredResult(_0x90036f,_0x1412b2))[_0xf10b('0x2a')](handleError(_0x90036f,null));};exports['show']=function(_0x40dbbe,_0x2f8ed0){var _0x3149af={'raw':![],'where':{'id':_0x40dbbe[_0xf10b('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xacf459={};_0xacf459[_0xf10b('0x42')]=_[_0xf10b('0x56')](db['WhatsappAccount'][_0xf10b('0x57')]);_0xacf459[_0xf10b('0x44')]=_[_0xf10b('0x56')](_0x40dbbe[_0xf10b('0x44')]);_0xacf459[_0xf10b('0x4b')]=_[_0xf10b('0x43')](_0xacf459[_0xf10b('0x42')],_0xacf459['query']);_0x3149af[_0xf10b('0x45')]=_[_0xf10b('0x43')](_0xacf459['model'],qs[_0xf10b('0x46')](_0x40dbbe[_0xf10b('0x44')]['fields']));_0x3149af[_0xf10b('0x45')]=_0x3149af['attributes']['length']?_0x3149af[_0xf10b('0x45')]:_0xacf459[_0xf10b('0x42')];if(_0x40dbbe[_0xf10b('0x44')][_0xf10b('0x52')]){_0x3149af[_0xf10b('0x53')]=[{'all':!![]}];}_0x3149af=_[_0xf10b('0x4f')]({},_0x3149af,_0x40dbbe[_0xf10b('0x50')]);return db['WhatsappAccount'][_0xf10b('0x58')](_0x3149af)[_0xf10b('0x20')](handleEntityNotFound(_0x2f8ed0,null))[_0xf10b('0x20')](respondWithResult(_0x2f8ed0,null))[_0xf10b('0x2a')](handleError(_0x2f8ed0,null));};exports[_0xf10b('0x59')]=function(_0x2486e6,_0x287c6a){return db[_0xf10b('0x51')][_0xf10b('0x59')](_0x2486e6['body'],{})[_0xf10b('0x20')](function(_0x364604){var _0x616ec6=_0x2486e6[_0xf10b('0x5a')][_0xf10b('0x5b')]({'plain':!![]});if(!_0x616ec6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x616ec6[_0xf10b('0x5c')]==='user'){var _0x4ec9d4=_0x364604['get']({'plain':!![]});var _0x4233fd=_0xf10b('0x38');return db[_0xf10b('0x5d')]['find']({'where':{'name':_0x4233fd,'userProfileId':_0x616ec6[_0xf10b('0x5e')]},'raw':!![]})[_0xf10b('0x20')](function(_0x57f4cd){if(_0x57f4cd&&_0x57f4cd[_0xf10b('0x5f')]===0x0){return db[_0xf10b('0x39')][_0xf10b('0x59')]({'name':_0x4ec9d4[_0xf10b('0x3a')],'resourceId':_0x4ec9d4['id'],'type':_0x57f4cd[_0xf10b('0x3a')],'sectionId':_0x57f4cd['id']},{})['then'](function(){return _0x364604;});}else{return _0x364604;}})['catch'](function(_0x19120d){logger['error'](_0xf10b('0x60'),_0x19120d);throw _0x19120d;});}return _0x364604;})[_0xf10b('0x20')](respondWithResult(_0x287c6a,0xc9))['catch'](handleError(_0x287c6a,null));};exports[_0xf10b('0x36')]=function(_0x56fc66,_0x22a66c){if(_0x56fc66[_0xf10b('0x61')]['id']){delete _0x56fc66['body']['id'];}return db[_0xf10b('0x51')][_0xf10b('0x58')]({'where':{'id':_0x56fc66[_0xf10b('0x55')]['id']},'include':[{'model':db[_0xf10b('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xf10b('0x20')](handleEntityNotFound(_0x22a66c,null))['then'](saveUpdates(_0x56fc66[_0xf10b('0x61')],null))[_0xf10b('0x20')](respondWithResult(_0x22a66c,null))[_0xf10b('0x2a')](handleError(_0x22a66c,null));};exports[_0xf10b('0x37')]=function(_0x9dcf03,_0x108114){return db[_0xf10b('0x51')]['find']({'where':{'id':_0x9dcf03[_0xf10b('0x55')]['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0x108114,null))[_0xf10b('0x20')](removeEntity(_0x108114,null))['catch'](handleError(_0x108114,null));};exports[_0xf10b('0x62')]=function(_0xd4c2b1,_0x4ba2f9){return db[_0xf10b('0x51')]['describe']()['then'](respondWithResult(_0x4ba2f9,null))['catch'](handleError(_0x4ba2f9,null));};exports[_0xf10b('0x63')]=function(_0x55658f,_0x451b7c,_0x591cfe){if(_0x55658f[_0xf10b('0x61')]['id']){delete _0x55658f[_0xf10b('0x61')]['id'];}return db[_0xf10b('0x51')][_0xf10b('0x58')]({'where':{'id':_0x55658f[_0xf10b('0x55')]['id']}})['then'](handleEntityNotFound(_0x451b7c,null))['then'](function(_0x568f96){if(_0x568f96){_0x55658f['body'][_0xf10b('0x64')]=_0x568f96['id'];return db[_0xf10b('0x65')][_0xf10b('0x59')](_0x55658f[_0xf10b('0x61')]);}})[_0xf10b('0x20')](respondWithResult(_0x451b7c,null))[_0xf10b('0x2a')](handleError(_0x451b7c,null));};exports[_0xf10b('0x66')]=function(_0x531a34,_0x424fc4,_0xe8a4d6){var _0x2fc185={'raw':![],'where':{}};var _0x546aa7={};var _0x3a4178={'count':0x0,'rows':[]};return db[_0xf10b('0x51')]['findOne']({'where':{'id':_0x531a34['params']['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0x424fc4,null))['then'](function(_0x250a7c){if(_0x250a7c){_0x546aa7['model']=_[_0xf10b('0x56')](db[_0xf10b('0x65')]['rawAttributes']);_0x546aa7['query']=_[_0xf10b('0x56')](_0x531a34[_0xf10b('0x44')]);_0x546aa7[_0xf10b('0x4b')]=_[_0xf10b('0x43')](_0x546aa7[_0xf10b('0x42')],_0x546aa7[_0xf10b('0x44')]);_0x2fc185[_0xf10b('0x45')]=_[_0xf10b('0x43')](_0x546aa7[_0xf10b('0x42')],qs[_0xf10b('0x46')](_0x531a34[_0xf10b('0x44')][_0xf10b('0x46')]));_0x2fc185['attributes']=_0x2fc185[_0xf10b('0x45')][_0xf10b('0x47')]?_0x2fc185[_0xf10b('0x45')]:_0x546aa7[_0xf10b('0x42')];if(!_0x531a34[_0xf10b('0x44')][_0xf10b('0x67')](_0xf10b('0x48'))){_0x2fc185['limit']=qs[_0xf10b('0x31')](_0x531a34[_0xf10b('0x44')][_0xf10b('0x31')]);_0x2fc185['offset']=qs[_0xf10b('0x2f')](_0x531a34['query']['offset']);}_0x2fc185[_0xf10b('0x49')]=qs[_0xf10b('0x4a')](_0x531a34['query'][_0xf10b('0x4a')]);_0x2fc185[_0xf10b('0x4e')]=qs[_0xf10b('0x4b')](_['pick'](_0x531a34[_0xf10b('0x44')],_0x546aa7[_0xf10b('0x4b')]));_0x2fc185[_0xf10b('0x4e')][_0xf10b('0x64')]=_0x250a7c['id'];if(_0x531a34['query']['filter']){_0x2fc185[_0xf10b('0x4e')]=_['merge'](_0x2fc185[_0xf10b('0x4e')],{'$or':_['map'](_0x2fc185[_0xf10b('0x45')],function(_0x360f89){var _0x1b3ef4={};_0x1b3ef4[_0x360f89]={'$like':'%'+_0x531a34[_0xf10b('0x44')]['filter']+'%'};return _0x1b3ef4;})});}_0x2fc185=_[_0xf10b('0x4f')]({},_0x2fc185,_0x531a34[_0xf10b('0x50')]);return db['Disposition'][_0xf10b('0x32')]({'where':_0x2fc185[_0xf10b('0x4e')]})[_0xf10b('0x20')](function(_0x4c1d1a){_0x3a4178[_0xf10b('0x32')]=_0x4c1d1a;if(_0x531a34[_0xf10b('0x44')][_0xf10b('0x52')]){_0x2fc185['include']=[{'all':!![]}];}return db[_0xf10b('0x65')]['findAll'](_0x2fc185);})[_0xf10b('0x20')](function(_0x2bdd7b){_0x3a4178[_0xf10b('0x68')]=_0x2bdd7b;return _0x3a4178;});}})[_0xf10b('0x20')](respondWithFilteredResult(_0x424fc4,_0x2fc185))['catch'](handleError(_0x424fc4,null));};exports[_0xf10b('0x69')]=function(_0xae7104,_0x4549eb,_0x51f49c){return db[_0xf10b('0x51')]['find']({'where':{'id':_0xae7104['params']['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0x4549eb,null))['then'](function(_0x756fa2){if(_0x756fa2){return _0x756fa2[_0xf10b('0x69')](_0xae7104[_0xf10b('0x44')]['ids']);}})[_0xf10b('0x20')](respondWithStatusCode(_0x4549eb,null))[_0xf10b('0x2a')](handleError(_0x4549eb,null));};exports[_0xf10b('0x6a')]=function(_0x27cb05,_0xab332a,_0x52b845){if(_0x27cb05[_0xf10b('0x61')]['id']){delete _0x27cb05[_0xf10b('0x61')]['id'];}return db[_0xf10b('0x51')][_0xf10b('0x58')]({'where':{'id':_0x27cb05[_0xf10b('0x55')]['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0xab332a,null))[_0xf10b('0x20')](function(_0x25f235){if(_0x25f235){_0x27cb05[_0xf10b('0x61')][_0xf10b('0x64')]=_0x25f235['id'];return db[_0xf10b('0x6b')]['create'](_0x27cb05[_0xf10b('0x61')]);}})[_0xf10b('0x20')](respondWithResult(_0xab332a,null))['catch'](handleError(_0xab332a,null));};exports[_0xf10b('0x6c')]=function(_0x2b47bf,_0x48041e,_0x2c088f){var _0x35b197={'raw':![],'where':{}};var _0x24be98={};var _0x5acc8b={'count':0x0,'rows':[]};return db[_0xf10b('0x51')]['findOne']({'where':{'id':_0x2b47bf[_0xf10b('0x55')]['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0x48041e,null))['then'](function(_0x3fff73){if(_0x3fff73){_0x24be98[_0xf10b('0x42')]=_[_0xf10b('0x56')](db[_0xf10b('0x6b')][_0xf10b('0x57')]);_0x24be98['query']=_[_0xf10b('0x56')](_0x2b47bf[_0xf10b('0x44')]);_0x24be98[_0xf10b('0x4b')]=_[_0xf10b('0x43')](_0x24be98[_0xf10b('0x42')],_0x24be98[_0xf10b('0x44')]);_0x35b197['attributes']=_[_0xf10b('0x43')](_0x24be98[_0xf10b('0x42')],qs[_0xf10b('0x46')](_0x2b47bf['query'][_0xf10b('0x46')]));_0x35b197[_0xf10b('0x45')]=_0x35b197[_0xf10b('0x45')][_0xf10b('0x47')]?_0x35b197['attributes']:_0x24be98['model'];if(!_0x2b47bf[_0xf10b('0x44')][_0xf10b('0x67')](_0xf10b('0x48'))){_0x35b197[_0xf10b('0x31')]=qs[_0xf10b('0x31')](_0x2b47bf[_0xf10b('0x44')][_0xf10b('0x31')]);_0x35b197[_0xf10b('0x2f')]=qs[_0xf10b('0x2f')](_0x2b47bf['query'][_0xf10b('0x2f')]);}_0x35b197[_0xf10b('0x49')]=qs['sort'](_0x2b47bf[_0xf10b('0x44')][_0xf10b('0x4a')]);_0x35b197[_0xf10b('0x4e')]=qs[_0xf10b('0x4b')](_[_0xf10b('0x4c')](_0x2b47bf[_0xf10b('0x44')],_0x24be98[_0xf10b('0x4b')]));_0x35b197['where'][_0xf10b('0x64')]=_0x3fff73['id'];if(_0x2b47bf[_0xf10b('0x44')]['filter']){_0x35b197[_0xf10b('0x4e')]=_[_0xf10b('0x4f')](_0x35b197[_0xf10b('0x4e')],{'$or':_[_0xf10b('0x3f')](_0x35b197[_0xf10b('0x45')],function(_0x24ee34){var _0x1ae210={};_0x1ae210[_0x24ee34]={'$like':'%'+_0x2b47bf[_0xf10b('0x44')][_0xf10b('0x4d')]+'%'};return _0x1ae210;})});}_0x35b197=_['merge']({},_0x35b197,_0x2b47bf[_0xf10b('0x50')]);return db[_0xf10b('0x6b')][_0xf10b('0x32')]({'where':_0x35b197['where']})[_0xf10b('0x20')](function(_0x252492){_0x5acc8b[_0xf10b('0x32')]=_0x252492;if(_0x2b47bf['query']['includeAll']){_0x35b197[_0xf10b('0x53')]=[{'all':!![]}];}return db[_0xf10b('0x6b')]['findAll'](_0x35b197);})[_0xf10b('0x20')](function(_0x144483){_0x5acc8b[_0xf10b('0x68')]=_0x144483;return _0x5acc8b;});}})[_0xf10b('0x20')](respondWithFilteredResult(_0x48041e,_0x35b197))['catch'](handleError(_0x48041e,null));};exports['removeAnswers']=function(_0x53424e,_0x3d4c64,_0x45e04a){return db['WhatsappAccount'][_0xf10b('0x58')]({'where':{'id':_0x53424e[_0xf10b('0x55')]['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0x3d4c64,null))[_0xf10b('0x20')](function(_0x5114cc){if(_0x5114cc){return _0x5114cc[_0xf10b('0x6d')](_0x53424e[_0xf10b('0x44')]['ids']);}})[_0xf10b('0x20')](respondWithStatusCode(_0x3d4c64,null))['catch'](handleError(_0x3d4c64,null));};exports[_0xf10b('0x6e')]=function(_0x27eda7,_0x246beb,_0x4742c5){return db[_0xf10b('0x51')]['find']({'where':{'id':_0x27eda7[_0xf10b('0x55')]['id']}})['then'](handleEntityNotFound(_0x246beb,null))[_0xf10b('0x20')](function(_0x853f6a){if(_0x853f6a){return _0x853f6a[_0xf10b('0x6e')](_0x27eda7[_0xf10b('0x61')][_0xf10b('0x6f')],_[_0xf10b('0x70')](_0x27eda7[_0xf10b('0x61')],[_0xf10b('0x6f'),'id'])||{})[_0xf10b('0x71')](function(_0x23e067){for(var _0x42c96e=0x0;_0x42c96e<_0x27eda7[_0xf10b('0x61')]['ids'][_0xf10b('0x47')];_0x42c96e+=0x1){socket['emit'](_0xf10b('0x72'),{'UserId':Number(_0x27eda7['body']['ids'][_0x42c96e]),'WhatsappAccountId':Number(_0x27eda7[_0xf10b('0x55')]['id'])});}return _0x23e067;});}})[_0xf10b('0x20')](respondWithResult(_0x246beb,null))[_0xf10b('0x2a')](handleError(_0x246beb,null));};exports[_0xf10b('0x73')]=function(_0x2b14d4,_0x58a2f1,_0x1eed77){return db[_0xf10b('0x51')][_0xf10b('0x58')]({'where':{'id':_0x2b14d4[_0xf10b('0x55')]['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0x58a2f1,null))['then'](function(_0x2d7bcf){if(_0x2d7bcf){return _0x2d7bcf[_0xf10b('0x73')](_0x2b14d4[_0xf10b('0x44')][_0xf10b('0x6f')])['then'](function(){if(_['isArray'](_0x2b14d4[_0xf10b('0x44')][_0xf10b('0x6f')])){for(var _0x5513cd=0x0;_0x5513cd<_0x2b14d4[_0xf10b('0x44')][_0xf10b('0x6f')][_0xf10b('0x47')];_0x5513cd+=0x1){socket[_0xf10b('0x74')](_0xf10b('0x75'),{'UserId':Number(_0x2b14d4['query'][_0xf10b('0x6f')][_0x5513cd]),'WhatsappAccountId':Number(_0x2b14d4[_0xf10b('0x55')]['id'])});}}else{socket[_0xf10b('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x2b14d4['query'][_0xf10b('0x6f')]),'WhatsappAccountId':Number(_0x2b14d4[_0xf10b('0x55')]['id'])});}});}})[_0xf10b('0x20')](respondWithStatusCode(_0x58a2f1,null))[_0xf10b('0x2a')](handleError(_0x58a2f1,null));};exports[_0xf10b('0x76')]=function(_0x3a611e,_0x2d5531,_0x1d435f){var _0x55644a={};var _0x4d88df={};var _0x5bb9b9;var _0x5be3c2;return db[_0xf10b('0x51')][_0xf10b('0x77')]({'where':{'id':_0x3a611e['params']['id']}})['then'](handleEntityNotFound(_0x2d5531,null))['then'](function(_0x3ffe69){if(_0x3ffe69){_0x5bb9b9=_0x3ffe69;_0x4d88df['model']=_[_0xf10b('0x56')](db['User'][_0xf10b('0x57')]);_0x4d88df[_0xf10b('0x44')]=_[_0xf10b('0x56')](_0x3a611e['query']);_0x4d88df[_0xf10b('0x4b')]=_[_0xf10b('0x43')](_0x4d88df[_0xf10b('0x42')],_0x4d88df[_0xf10b('0x44')]);_0x55644a[_0xf10b('0x45')]=_[_0xf10b('0x43')](_0x4d88df[_0xf10b('0x42')],qs[_0xf10b('0x46')](_0x3a611e[_0xf10b('0x44')]['fields']));_0x55644a[_0xf10b('0x45')]=_0x55644a[_0xf10b('0x45')][_0xf10b('0x47')]?_0x55644a[_0xf10b('0x45')]:_0x4d88df['model'];_0x55644a[_0xf10b('0x49')]=qs[_0xf10b('0x4a')](_0x3a611e[_0xf10b('0x44')][_0xf10b('0x4a')]);_0x55644a[_0xf10b('0x4e')]=qs[_0xf10b('0x4b')](_[_0xf10b('0x4c')](_0x3a611e[_0xf10b('0x44')],_0x4d88df[_0xf10b('0x4b')]));if(_0x3a611e[_0xf10b('0x44')]['filter']){_0x55644a[_0xf10b('0x4e')]=_[_0xf10b('0x4f')](_0x55644a['where'],{'$or':_['map'](_0x55644a[_0xf10b('0x45')],function(_0x239286){var _0x495723={};_0x495723[_0x239286]={'$like':'%'+_0x3a611e[_0xf10b('0x44')][_0xf10b('0x4d')]+'%'};return _0x495723;})});}_0x55644a=_[_0xf10b('0x4f')]({},_0x55644a,_0x3a611e[_0xf10b('0x50')]);return _0x5bb9b9[_0xf10b('0x76')](_0x55644a);}})[_0xf10b('0x20')](function(_0x350d71){if(_0x350d71){_0x5be3c2=_0x350d71[_0xf10b('0x47')];if(!_0x3a611e['query'][_0xf10b('0x67')](_0xf10b('0x48'))){_0x55644a[_0xf10b('0x31')]=qs[_0xf10b('0x31')](_0x3a611e[_0xf10b('0x44')]['limit']);_0x55644a[_0xf10b('0x2f')]=qs[_0xf10b('0x2f')](_0x3a611e[_0xf10b('0x44')]['offset']);}return _0x5bb9b9[_0xf10b('0x76')](_0x55644a);}})[_0xf10b('0x20')](function(_0x362fce){if(_0x362fce){return _0x362fce?{'count':_0x5be3c2,'rows':_0x362fce}:null;}})[_0xf10b('0x20')](respondWithResult(_0x2d5531,null))['catch'](handleError(_0x2d5531,null));};exports[_0xf10b('0x78')]=function(_0x34e213,_0x5f2e6a){var _0x11d131=_0x34e213['params']['id'];var _0x3b9366=_0x34e213[_0xf10b('0x61')];var _0xada668=0xc8;var _0x403fca=null;return db[_0xf10b('0x79')][_0xf10b('0x7a')]({'isolationLevel':db[_0xf10b('0x79')]['Transaction'][_0xf10b('0x7b')][_0xf10b('0x7c')]},function(_0x2c30fd){return db[_0xf10b('0x51')][_0xf10b('0x77')]({'where':{'id':_0x11d131},'transaction':_0x2c30fd})[_0xf10b('0x20')](function(_0x5ca138){if(_0x5ca138){return db[_0xf10b('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x11d131},'transaction':_0x2c30fd})[_0xf10b('0x20')](function(){var _0x59c055=_['map'](_0x3b9366,function(_0x4d3595){_0x4d3595['WhatsappAccountId']=_0x11d131;return _0x4d3595;});return db[_0xf10b('0x7d')]['bulkCreate'](_0x59c055,{'transaction':_0x2c30fd});});}else{_0xada668=0x194;_0x403fca=[];}});})[_0xf10b('0x20')](function(){if(_0xada668!==0x194){return db[_0xf10b('0x7d')][_0xf10b('0x7e')]({'where':{'WhatsappAccountId':_0x11d131},'order':_0xf10b('0x7f')})[_0xf10b('0x20')](function(_0x573474){_0x403fca=_0x573474;});}})['catch'](function(_0x1b6b84){_0xada668=0x1f4;logger[_0xf10b('0x26')](_0x1b6b84['stack']);if(_0x1b6b84[_0xf10b('0x3a')]){delete _0x1b6b84['name'];}_0x403fca=_0x1b6b84;})[_0xf10b('0x80')](function(){if(_0x403fca===null){_0x5f2e6a[_0xf10b('0x2b')](_0xada668);}else{if(_0xada668===0x1f4){_0x5f2e6a['status'](_0xada668)[_0xf10b('0x3b')](_0x403fca);}else{_0x5f2e6a[_0xf10b('0x2c')](_0xada668)[_0xf10b('0x2e')](_0x403fca);}}});};exports[_0xf10b('0x81')]=function(_0x42b523,_0x3dcdb4,_0x1fc0cb){var _0x486a5e={};var _0x1c09f0={};var _0xf665ee;var _0x5cc8f6;return db[_0xf10b('0x51')][_0xf10b('0x77')]({'where':{'id':_0x42b523['params']['id']}})[_0xf10b('0x20')](handleEntityNotFound(_0x3dcdb4,null))['then'](function(_0x49b507){if(_0x49b507){_0xf665ee=_0x49b507;_0x1c09f0['model']=_[_0xf10b('0x56')](db['WhatsappApplication'][_0xf10b('0x57')]);_0x1c09f0[_0xf10b('0x44')]=_[_0xf10b('0x56')](_0x42b523[_0xf10b('0x44')]);_0x1c09f0[_0xf10b('0x4b')]=_[_0xf10b('0x43')](_0x1c09f0[_0xf10b('0x42')],_0x1c09f0['query']);_0x486a5e['attributes']=_[_0xf10b('0x43')](_0x1c09f0[_0xf10b('0x42')],qs['fields'](_0x42b523[_0xf10b('0x44')][_0xf10b('0x46')]));_0x486a5e[_0xf10b('0x45')]=_0x486a5e[_0xf10b('0x45')][_0xf10b('0x47')]?_0x486a5e[_0xf10b('0x45')]:_0x1c09f0[_0xf10b('0x42')];_0x486a5e[_0xf10b('0x49')]=qs['sort'](_0x42b523[_0xf10b('0x44')][_0xf10b('0x4a')]);_0x486a5e['where']=qs[_0xf10b('0x4b')](_[_0xf10b('0x4c')](_0x42b523[_0xf10b('0x44')],_0x1c09f0['filters']));if(_0x42b523[_0xf10b('0x44')][_0xf10b('0x4d')]){_0x486a5e[_0xf10b('0x4e')]=_[_0xf10b('0x4f')](_0x486a5e[_0xf10b('0x4e')],{'$or':_[_0xf10b('0x3f')](_0x486a5e[_0xf10b('0x45')],function(_0x192ba9){var _0xf4ca65={};_0xf4ca65[_0x192ba9]={'$like':'%'+_0x42b523['query']['filter']+'%'};return _0xf4ca65;})});}_0x486a5e=_['merge']({},_0x486a5e,_0x42b523[_0xf10b('0x50')]);return _0xf665ee[_0xf10b('0x81')](_0x486a5e);}})[_0xf10b('0x20')](function(_0x3fbb5a){if(_0x3fbb5a){_0x5cc8f6=_0x3fbb5a[_0xf10b('0x47')];if(!_0x42b523[_0xf10b('0x44')][_0xf10b('0x67')](_0xf10b('0x48'))){_0x486a5e[_0xf10b('0x31')]=qs[_0xf10b('0x31')](_0x42b523[_0xf10b('0x44')][_0xf10b('0x31')]);_0x486a5e[_0xf10b('0x2f')]=qs[_0xf10b('0x2f')](_0x42b523['query']['offset']);}return _0xf665ee[_0xf10b('0x81')](_0x486a5e);}})[_0xf10b('0x20')](function(_0x39c205){if(_0x39c205){return _0x39c205?{'count':_0x5cc8f6,'rows':_0x39c205}:null;}})['then'](respondWithResult(_0x3dcdb4,null))[_0xf10b('0x2a')](handleError(_0x3dcdb4,null));};exports[_0xf10b('0x82')]=function(_0x324508,_0x5c34fd,_0x1b1e28){var _0x4ed1a2={'channel':'whatsapp'};var _0x5c4e64=[];var _0x13782d=[];var _0x1ba1fd={};return db[_0xf10b('0x51')]['find']({'where':{'id':_0x324508['params']['id']},'include':[{'model':db[_0xf10b('0x7d')],'as':_0xf10b('0x83')}]})[_0xf10b('0x20')](handleEntityNotFound(_0x5c34fd,null))[_0xf10b('0x20')](function(_0x4537e7){_0x4ed1a2[_0xf10b('0x84')]=_0x4537e7;if(_0x4ed1a2[_0xf10b('0x84')]&&_0x4ed1a2[_0xf10b('0x84')][_0xf10b('0x40')]===_0xf10b('0x85')&&_0x324508[_0xf10b('0x61')][_0xf10b('0x86')]){if(_0x324508['body'][_0xf10b('0x86')]['length']===0x0)return;if(_0x324508[_0xf10b('0x61')]['statuses'][0x0][_0xf10b('0x87')]!==_0xf10b('0x88'))return;return db[_0xf10b('0x89')][_0xf10b('0x36')]({'read':!![],'readAt':_0x324508[_0xf10b('0x61')]['statuses'][0x0][_0xf10b('0x8a')]},{'where':{'messageId':_0x324508[_0xf10b('0x61')]['statuses'][0x0][_0xf10b('0x8b')]},'individualHooks':!![]})[_0xf10b('0x20')](function(_0x46a36d){return _0x5c34fd['status'](0xc8)[_0xf10b('0x2e')](_0x46a36d);});}_0x4ed1a2['applications']=_[_0xf10b('0x8c')](_0x4537e7[_0xf10b('0x83')],[_0xf10b('0x7f')],[_0xf10b('0x8d')]);if(_0x4ed1a2[_0xf10b('0x84')][_0xf10b('0x83')]){delete _0x4ed1a2['account'][_0xf10b('0x83')];}return db[_0xf10b('0x8e')][_0xf10b('0x62')]()[_0xf10b('0x20')](function(_0x471766){if(!_0x471766){throw new db[(_0xf10b('0x8f'))][(_0xf10b('0x90'))]('no\x20available\x20attributes');}_0x5c4e64=_[_0xf10b('0x91')](_[_0xf10b('0x56')](_0x471766),[_0xf10b('0x92'),_0xf10b('0x93')]);_0x13782d=_[_0xf10b('0x91')](_['keys'](_0x471766),['createdAt',_0xf10b('0x93'),_0xf10b('0x94'),_0xf10b('0x95')]);_0x4ed1a2['body']={'mapKey':_0xf10b('0x96')};if(_0x4ed1a2[_0xf10b('0x84')]&&_0x4ed1a2[_0xf10b('0x84')][_0xf10b('0x40')]===_0xf10b('0x97')){_0x4ed1a2['body'][_0xf10b('0x98')]=_0x324508[_0xf10b('0x61')][_0xf10b('0x99')][_0xf10b('0x9a')](_0xf10b('0x9b'),'');_0x4ed1a2['body'][_0xf10b('0x61')]=_0x324508[_0xf10b('0x61')][_0xf10b('0x9c')];_0x4ed1a2[_0xf10b('0x61')]['messageId']=_0x324508[_0xf10b('0x61')][_0xf10b('0x9d')];}if(_0x4ed1a2[_0xf10b('0x84')]&&_0x4ed1a2[_0xf10b('0x84')][_0xf10b('0x40')]===_0xf10b('0x85')){_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x98')]=_0x324508[_0xf10b('0x61')][_0xf10b('0x9e')][0x0][_0xf10b('0x98')];_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x61')]=_0x324508['body']['notifications'][0x0][_0xf10b('0x28')]['body'];_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x9f')]=_0x324508[_0xf10b('0x61')][_0xf10b('0x9e')][0x0][_0xf10b('0x8b')];}if(_0x4ed1a2[_0xf10b('0x61')]['id']){delete _0x4ed1a2[_0xf10b('0x61')]['id'];}if(_[_0xf10b('0xa0')](_0x4ed1a2[_0xf10b('0x61')]['from'])){throw new db['Sequelize']['ValidationError'](_0xf10b('0xa1'));}if(_[_0xf10b('0xa0')](_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x61')])||_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x61')]===''){throw new db['Sequelize'][(_0xf10b('0x90'))](_0xf10b('0xa2'));}if(_[_0xf10b('0xa0')](_0x4ed1a2[_0xf10b('0x61')]['mapKey'])){throw new db[(_0xf10b('0x8f'))][(_0xf10b('0x90'))](_0xf10b('0xa3')+_0x13782d);}if(!_['includes'](_0x13782d,_0x4ed1a2[_0xf10b('0x61')]['mapKey'])){throw new db['Sequelize'][(_0xf10b('0x90'))](_0xf10b('0xa4')+_0x13782d);}_0x1ba1fd[_0x4ed1a2['body'][_0xf10b('0xa5')]]=_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x98')];return db[_0xf10b('0xa6')][_0xf10b('0x58')]({'where':{'id':_0x4ed1a2['account'][_0xf10b('0x95')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1ba1fd,'limit':0x1,'order':[[_0xf10b('0x93'),'DESC']]}]});})['then'](handleEntityNotFound(_0x5c34fd,null))[_0xf10b('0x20')](function(_0x219d9f){if(_0x219d9f){_0x4ed1a2[_0xf10b('0xa7')]=_[_0xf10b('0x70')](_0x219d9f,[_0xf10b('0xa8')]);if(_0x219d9f[_0xf10b('0xa8')][_0xf10b('0x47')]){return _0x219d9f[_0xf10b('0xa8')][0x0];}var _0x5365a4=_['defaults'](_0x4ed1a2[_0xf10b('0x61')],{'firstName':_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x98')],'ListId':_0x219d9f['id']});_0x5365a4[_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0xa5')]]=_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x98')];return db[_0xf10b('0x8e')][_0xf10b('0x59')](_0x5365a4,{'fields':_0x5c4e64,'raw':!![]});}})[_0xf10b('0x20')](handleEntityNotFound(_0x5c34fd,null))['then'](function(_0x265920){if(_0x265920){_0x4ed1a2[_0xf10b('0xa9')]=_0x265920;var _0x5dc52d={'ContactId':_0x265920['id'],'phone':_0x4ed1a2[_0xf10b('0x61')]['from'],'WhatsappAccountId':_0x324508[_0xf10b('0x55')]['id']};var _0x294c79={'ContactId':_0x265920['id'],'WhatsappAccountId':_0x324508[_0xf10b('0x55')]['id'],'closed':![]};return db[_0xf10b('0xaa')]['find']({'where':_0x294c79})[_0xf10b('0x20')](function(_0x2ffaba){if(_0x2ffaba){return[_0x2ffaba,![]];}return db[_0xf10b('0xaa')][_0xf10b('0x59')](_0x5dc52d)[_0xf10b('0x20')](function(_0x5dddcf){return[_0x5dddcf,!![]];});});}})['spread'](function(_0x9551b7,_0x1f9952){_0x4ed1a2['interaction']=_0x9551b7['get']({'plain':!![]});_0x4ed1a2[_0xf10b('0xab')]['created']=![];if(_0x1f9952){if(_0x4ed1a2[_0xf10b('0x84')][_0xf10b('0xac')]){_0x4ed1a2[_0xf10b('0xad')][_0xf10b('0xae')]({'id':0x0,'priority':_0x4ed1a2[_0xf10b('0xad')]['length']+0x1,'app':_0xf10b('0xaf'),'appdata':_0xf10b('0xb0'),'interval':_0xf10b('0xb1')});}_0x4ed1a2[_0xf10b('0xab')][_0xf10b('0xb2')]=!![];}return db['WhatsappMessage'][_0xf10b('0x59')]({'phone':_0x4ed1a2['body']['from'],'messageId':_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0x9f')],'body':_0x4ed1a2['body']['body'],'WhatsappAccountId':_0x324508[_0xf10b('0x55')]['id'],'WhatsappInteractionId':_0x9551b7['id'],'direction':'in','ContactId':_0x9551b7['ContactId'],'AttachmentId':_0x4ed1a2[_0xf10b('0x61')][_0xf10b('0xb3')]});})['then'](function(_0x20f647){_0x4ed1a2[_0xf10b('0x28')]=_0x20f647;if(!_0x4ed1a2[_0xf10b('0xab')][_0xf10b('0xb4')])return;return db[_0xf10b('0xb5')][_0xf10b('0x58')]({'attributes':['id',_0xf10b('0x3a')],'where':{'id':_0x4ed1a2[_0xf10b('0xab')][_0xf10b('0xb4')]}});})['then'](function(_0x58d47a){if(_0x58d47a){_0x4ed1a2['applications'][_0xf10b('0xb6')]({'id':0x0,'priority':0x0,'app':_0xf10b('0xb7'),'appdata':_0x58d47a['name']+','+(_0x4ed1a2['account'][_0xf10b('0xb8')]||0xa),'interval':_0xf10b('0xb1')});}if(!_0x4ed1a2[_0xf10b('0xab')][_0xf10b('0xb9')])return;return db[_0xf10b('0xba')][_0xf10b('0x58')]({'attributes':['id',_0xf10b('0x3a')],'where':{'id':_0x4ed1a2[_0xf10b('0xab')][_0xf10b('0xb9')]}});})['then'](function(_0x37543c){if(_0x37543c){_0x4ed1a2['applications'][_0xf10b('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x37543c['name']+','+(_0x4ed1a2['account'][_0xf10b('0xbb')]||0x12c),'interval':_0xf10b('0xb1')});}return respondWithRpcPromise(_0xf10b('0xbc'),_0xf10b('0xbd'),_0x4ed1a2);})[_0xf10b('0x20')](function(_0x19616f){if(_0x19616f){var _0x2ed186=0xc8;var _0x4b503c=_0xf10b('0xbe');logger[_0xf10b('0x21')](_0xf10b('0xbf'),_0x4b503c,_0x2ed186,_0xf10b('0xc0'));logger['debug'](_0xf10b('0xc1'),_0x4b503c,_0x2ed186,_0xf10b('0xc0'),JSON[_0xf10b('0x25')](_0x19616f));if(_0x4ed1a2[_0xf10b('0x84')]['type']==='twilio'){return _0x5c34fd[_0xf10b('0x2c')](_0x2ed186)[_0xf10b('0xc2')]('Content-Type',_0xf10b('0xc3'))[_0xf10b('0x3b')](_0xf10b('0xc4'));}else{return _0x5c34fd['status'](_0x2ed186)[_0xf10b('0x2e')](_0x19616f);}}});})[_0xf10b('0x2a')](handleError(_0x5c34fd,null));};exports[_0xf10b('0x3b')]=function(_0xa93ee,_0x553bfe,_0x53fd0d){var _0x1c8af8,_0xc15813,_0x7afb3e;if(_[_0xf10b('0xa0')](_0xa93ee[_0xf10b('0x61')][_0xf10b('0x61')])||_0xa93ee[_0xf10b('0x61')][_0xf10b('0x61')]===''){throw new db[(_0xf10b('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf10b('0xa0')](_0xa93ee[_0xf10b('0x61')]['to'])){throw new db['Sequelize'][(_0xf10b('0x90'))](_0xf10b('0xc5'));}_0x1c8af8=_0xa93ee[_0xf10b('0x61')]['to'];return db['WhatsappAccount'][_0xf10b('0x58')]({'where':{'id':_0xa93ee['params']['id']},'include':[{'model':db[_0xf10b('0xa6')],'as':'List','include':[{'model':db[_0xf10b('0x8e')],'as':_0xf10b('0xa8'),'where':{'mobile':_0x1c8af8},'limit':0x1,'order':[[_0xf10b('0x93'),_0xf10b('0xc6')]]}]}]})['then'](handleEntityNotFound(_0x553bfe,null))[_0xf10b('0x20')](function(_0x270fbe){if(_0x270fbe&&_0x270fbe[_0xf10b('0xc7')]){_0xc15813=_0x270fbe[_0xf10b('0x5b')]({'plain':!![]});if(_0xc15813[_0xf10b('0xc7')]&&_0xc15813[_0xf10b('0xc7')][_0xf10b('0xa8')][_0xf10b('0x47')]){return _0xc15813[_0xf10b('0xc7')][_0xf10b('0xa8')][0x0];}return db[_0xf10b('0x8e')][_0xf10b('0x59')](_['defaults'](_0xa93ee[_0xf10b('0x61')],{'firstName':_0x1c8af8,'mobile':_0x1c8af8,'phone':_0x1c8af8,'ListId':_0xc15813[_0xf10b('0x95')]}));}})[_0xf10b('0x20')](handleEntityNotFound(_0x553bfe,null))['then'](function(_0x393b98){if(_0x393b98){_0x7afb3e=_0x393b98;return db[_0xf10b('0xaa')]['find']({'where':{'ContactId':_0x7afb3e['id'],'closed':![],'WhatsappAccountId':_0xc15813['id']}})['then'](function(_0x5d1579){if(_0x5d1579){return[_0x5d1579,![]];}return db[_0xf10b('0xaa')]['create']({'UserId':_0xa93ee[_0xf10b('0x5a')]['id'],'ContactId':_0x7afb3e['id'],'WhatsappAccountId':_0xc15813['id'],'phone':_0x1c8af8,'firstMsgDirection':_0xf10b('0xc8'),'Messages':[_[_0xf10b('0x4f')](_0xa93ee[_0xf10b('0x61')],{'read':![],'body':_0xa93ee[_0xf10b('0x61')][_0xf10b('0x61')],'phone':_0x1c8af8,'WhatsappAccountId':_0xc15813['id'],'UserId':_0xa93ee[_0xf10b('0x5a')]['id'],'ContactId':_0x7afb3e['id']})]},{'include':[{'model':db[_0xf10b('0x89')],'as':_0xf10b('0xc9')}]})[_0xf10b('0x20')](function(_0x3ebc68){return[_0x3ebc68,!![]];});});}})[_0xf10b('0x71')](function(_0x3034e3,_0x49aae6){if(_0x49aae6){return _0x3034e3;}return db[_0xf10b('0x89')][_0xf10b('0x59')](_[_0xf10b('0x4f')](_0xa93ee['body'],{'read':![],'body':_0xa93ee[_0xf10b('0x61')][_0xf10b('0x61')],'phone':_0x1c8af8,'WhatsappAccountId':_0xc15813['id'],'WhatsappInteractionId':_0x3034e3['id'],'UserId':_0xa93ee[_0xf10b('0x5a')]['id'],'ContactId':_0x7afb3e['id']}))['then'](function(_0x1efc9f){_0x3034e3[_0xf10b('0xca')][_0xf10b('0xc9')]=[];_0x3034e3[_0xf10b('0xca')][_0xf10b('0xc9')][_0xf10b('0xae')](_0x1efc9f[_0xf10b('0xca')]);return _0x3034e3;});})[_0xf10b('0x20')](respondWithResult(_0x553bfe,null))[_0xf10b('0x2a')](handleError(_0x553bfe,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 122eeda..2dc337b 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 _0x49c5=['setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x49c5,0x97));var _0x549c=function(_0x17a871,_0x4a74dc){_0x17a871=_0x17a871-0x0;var _0x4b75fa=_0x49c5[_0x17a871];return _0x4b75fa;};'use strict';var EventEmitter=require(_0x549c('0x0'));var WhatsappAccount=require(_0x549c('0x1'))['db'][_0x549c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x549c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x305f76){return function(_0x307600,_0x81f0d7,_0x2be70c){WhatsappAccountEvents[_0x549c('0x4')](_0x305f76+':'+_0x307600['id'],_0x307600);WhatsappAccountEvents[_0x549c('0x4')](_0x305f76,_0x307600);_0x2be70c(null);};}for(var e in events){if(events[_0x549c('0x5')](e)){var event=events[e];WhatsappAccount[_0x549c('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x57b2=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x57b2,0x156));var _0x257b=function(_0x4477d7,_0xb93760){_0x4477d7=_0x4477d7-0x0;var _0x30ec2f=_0x57b2[_0x4477d7];return _0x30ec2f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x257b('0x0'))['db'][_0x257b('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x257b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x257b('0x3'),'afterDestroy':_0x257b('0x4')};function emitEvent(_0x577253){return function(_0x3411b8,_0xbd28ab,_0x105c3a){WhatsappAccountEvents[_0x257b('0x5')](_0x577253+':'+_0x3411b8['id'],_0x3411b8);WhatsappAccountEvents['emit'](_0x577253,_0x3411b8);_0x105c3a(null);};}for(var e in events){if(events[_0x257b('0x6')](e)){var event=events[e];WhatsappAccount[_0x257b('0x7')](e,emitEvent(event));}}module[_0x257b('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 6dc014f..1630f49 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 _0x773b=['define','WhatsappAccount','whatsapp_accounts','../../config/logger','api','bluebird','request-promise','path','./whatsappAccount.attributes'];(function(_0x21b74b,_0x543c76){var _0x518cc6=function(_0x5b3010){while(--_0x5b3010){_0x21b74b['push'](_0x21b74b['shift']());}};_0x518cc6(++_0x543c76);}(_0x773b,0x1f2));var _0xb773=function(_0x5abada,_0x461da6){_0x5abada=_0x5abada-0x0;var _0x445ffd=_0x773b[_0x5abada];return _0x445ffd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb773('0x0'))(_0xb773('0x1'));var moment=require('moment');var BPromise=require(_0xb773('0x2'));var rp=require(_0xb773('0x3'));var fs=require('fs');var path=require(_0xb773('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb773('0x5'));module['exports']=function(_0x1adf88,_0x19cff0){return _0x1adf88[_0xb773('0x6')](_0xb773('0x7'),attributes,{'tableName':_0xb773('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddd1=['request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x36782c,_0x38c321){var _0xd4e417=function(_0x105817){while(--_0x105817){_0x36782c['push'](_0x36782c['shift']());}};_0xd4e417(++_0x38c321);}(_0xddd1,0xf6));var _0x1ddd=function(_0x5526a1,_0x616341){_0x5526a1=_0x5526a1-0x0;var _0xc34d30=_0xddd1[_0x5526a1];return _0xc34d30;};'use strict';var _=require(_0x1ddd('0x0'));var util=require(_0x1ddd('0x1'));var logger=require(_0x1ddd('0x2'))(_0x1ddd('0x3'));var moment=require(_0x1ddd('0x4'));var BPromise=require(_0x1ddd('0x5'));var rp=require(_0x1ddd('0x6'));var fs=require('fs');var path=require(_0x1ddd('0x7'));var rimraf=require(_0x1ddd('0x8'));var config=require(_0x1ddd('0x9'));var attributes=require(_0x1ddd('0xa'));module[_0x1ddd('0xb')]=function(_0x580c9d,_0x1236f5){return _0x580c9d['define'](_0x1ddd('0xc'),attributes,{'tableName':_0x1ddd('0xd'),'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 9485593..780ecbf 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 _0x79bb=['ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','raw','where','attributes','include','map','model','then','ShowWhatsappAccount','util','moment','bluebird','randomstring'];(function(_0x2e850b,_0x186b89){var _0x5ccf6f=function(_0x21b84b){while(--_0x21b84b){_0x2e850b['push'](_0x2e850b['shift']());}};_0x5ccf6f(++_0x186b89);}(_0x79bb,0x1dd));var _0xb79b=function(_0x327dec,_0x4687f4){_0x327dec=_0x327dec-0x0;var _0x1052a8=_0x79bb[_0x327dec];return _0x1052a8;};'use strict';var _=require('lodash');var util=require(_0xb79b('0x0'));var moment=require(_0xb79b('0x1'));var BPromise=require(_0xb79b('0x2'));var rs=require(_0xb79b('0x3'));var fs=require('fs');var Redis=require(_0xb79b('0x4'));var db=require(_0xb79b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb79b('0x6'))(_0xb79b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb79b('0x8')][_0xb79b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb79b('0xa')],{'host':_0xb79b('0xb'),'port':0x18eb});var socket=require(_0xb79b('0xc'))(new Redis(config[_0xb79b('0xa')]));require(_0xb79b('0xd'))[_0xb79b('0xe')](socket);function respondWithRpcPromise(_0x509349,_0x420a37,_0x56a08c){return new BPromise(function(_0x3dcb96,_0x47f855){return client[_0xb79b('0xf')](_0x509349,_0x56a08c)['then'](function(_0x45bce6){logger[_0xb79b('0x10')](_0xb79b('0x11'),_0x420a37,_0xb79b('0x12'));logger[_0xb79b('0x13')](_0xb79b('0x14'),_0x420a37,_0xb79b('0x12'),JSON[_0xb79b('0x15')](_0x45bce6));if(_0x45bce6[_0xb79b('0x16')]){if(_0x45bce6[_0xb79b('0x16')][_0xb79b('0x17')]===0x1f4){logger['error'](_0xb79b('0x11'),_0x420a37,_0x45bce6['error'][_0xb79b('0x18')]);return _0x47f855(_0x45bce6[_0xb79b('0x16')]['message']);}logger[_0xb79b('0x16')](_0xb79b('0x11'),_0x420a37,_0x45bce6['error'][_0xb79b('0x18')]);return _0x3dcb96(_0x45bce6['error']['message']);}else{logger[_0xb79b('0x10')](_0xb79b('0x11'),_0x420a37,_0xb79b('0x12'));_0x3dcb96(_0x45bce6[_0xb79b('0x19')][_0xb79b('0x18')]);}})[_0xb79b('0x1a')](function(_0x33c1bd){logger[_0xb79b('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x420a37,_0x33c1bd);_0x47f855(_0x33c1bd);});});}exports['ShowWhatsappAccount']=function(_0x1af83e){var _0x1fdf75=this;return new Promise(function(_0x162cb2,_0x463eb3){return db['WhatsappAccount'][_0xb79b('0x1b')]({'raw':_0x1af83e[_0xb79b('0x1c')]?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x1d')]===undefined?!![]:![]:!![],'where':_0x1af83e['options']?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x1e')]||null:null,'attributes':_0x1af83e[_0xb79b('0x1c')]?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x1f')]||null:null,'include':_0x1af83e[_0xb79b('0x1c')]?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x20')]?_[_0xb79b('0x21')](_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x20')],function(_0xde77e0){return{'model':db[_0xde77e0['model']],'as':_0xde77e0['as'],'attributes':_0xde77e0['attributes'],'include':_0xde77e0['include']?_['map'](_0xde77e0[_0xb79b('0x20')],function(_0x3424c2){return{'model':db[_0x3424c2[_0xb79b('0x22')]],'as':_0x3424c2['as'],'attributes':_0x3424c2[_0xb79b('0x1f')],'include':_0x3424c2[_0xb79b('0x20')]?_[_0xb79b('0x21')](_0x3424c2[_0xb79b('0x20')],function(_0x33ae02){return{'model':db[_0x33ae02[_0xb79b('0x22')]],'as':_0x33ae02['as'],'attributes':_0x33ae02[_0xb79b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb79b('0x23')](function(_0x195fbf){logger['info'](_0xb79b('0x24'),_0x1af83e);logger[_0xb79b('0x13')](_0xb79b('0x24'),_0x1af83e,JSON[_0xb79b('0x15')](_0x195fbf));_0x162cb2(_0x195fbf);})[_0xb79b('0x1a')](function(_0x43c58b){logger[_0xb79b('0x16')](_0xb79b('0x24'),_0x43c58b[_0xb79b('0x18')],_0x1af83e);_0x463eb3(_0x1fdf75['error'](0x1f4,_0x43c58b['message']));});});}; \ No newline at end of file +var _0x315f=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowWhatsappAccount','options','raw','attributes','include','map','model','catch','lodash','util','moment','bluebird'];(function(_0x5be99c,_0x4fe833){var _0x4a84fa=function(_0x484182){while(--_0x484182){_0x5be99c['push'](_0x5be99c['shift']());}};_0x4a84fa(++_0x4fe833);}(_0x315f,0x1f4));var _0xf315=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x315f[_0x2af29a];return _0x5ef02f;};'use strict';var _=require(_0xf315('0x0'));var util=require(_0xf315('0x1'));var moment=require(_0xf315('0x2'));var BPromise=require(_0xf315('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf315('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf315('0x5'));var logger=require(_0xf315('0x6'))(_0xf315('0x7'));var config=require(_0xf315('0x8'));var jayson=require(_0xf315('0x9'));var client=jayson['client'][_0xf315('0xa')]({'port':0x232a});config['redis']=_[_0xf315('0xb')](config[_0xf315('0xc')],{'host':_0xf315('0xd'),'port':0x18eb});var socket=require(_0xf315('0xe'))(new Redis(config[_0xf315('0xc')]));require(_0xf315('0xf'))[_0xf315('0x10')](socket);function respondWithRpcPromise(_0x8f7399,_0x2f9fa5,_0x179eb5){return new BPromise(function(_0x205c1b,_0x1b58a6){return client[_0xf315('0x11')](_0x8f7399,_0x179eb5)[_0xf315('0x12')](function(_0x32ac47){logger[_0xf315('0x13')](_0xf315('0x14'),_0x2f9fa5,_0xf315('0x15'));logger[_0xf315('0x16')](_0xf315('0x17'),_0x2f9fa5,'request\x20sent',JSON['stringify'](_0x32ac47));if(_0x32ac47[_0xf315('0x18')]){if(_0x32ac47[_0xf315('0x18')][_0xf315('0x19')]===0x1f4){logger[_0xf315('0x18')](_0xf315('0x14'),_0x2f9fa5,_0x32ac47['error'][_0xf315('0x1a')]);return _0x1b58a6(_0x32ac47[_0xf315('0x18')][_0xf315('0x1a')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2f9fa5,_0x32ac47[_0xf315('0x18')][_0xf315('0x1a')]);return _0x205c1b(_0x32ac47[_0xf315('0x18')][_0xf315('0x1a')]);}else{logger[_0xf315('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x2f9fa5,'request\x20sent');_0x205c1b(_0x32ac47[_0xf315('0x1b')][_0xf315('0x1a')]);}})['catch'](function(_0x30c5cc){logger[_0xf315('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x2f9fa5,_0x30c5cc);_0x1b58a6(_0x30c5cc);});});}exports[_0xf315('0x1c')]=function(_0x39cabc){var _0x2c4615=this;return new Promise(function(_0x1948db,_0x4a8171){return db['WhatsappAccount']['find']({'raw':_0x39cabc[_0xf315('0x1d')]?_0x39cabc[_0xf315('0x1d')][_0xf315('0x1e')]===undefined?!![]:![]:!![],'where':_0x39cabc[_0xf315('0x1d')]?_0x39cabc[_0xf315('0x1d')]['where']||null:null,'attributes':_0x39cabc['options']?_0x39cabc['options'][_0xf315('0x1f')]||null:null,'include':_0x39cabc['options']?_0x39cabc[_0xf315('0x1d')][_0xf315('0x20')]?_[_0xf315('0x21')](_0x39cabc['options']['include'],function(_0x372e48){return{'model':db[_0x372e48[_0xf315('0x22')]],'as':_0x372e48['as'],'attributes':_0x372e48[_0xf315('0x1f')],'include':_0x372e48['include']?_['map'](_0x372e48['include'],function(_0x4d9919){return{'model':db[_0x4d9919[_0xf315('0x22')]],'as':_0x4d9919['as'],'attributes':_0x4d9919[_0xf315('0x1f')],'include':_0x4d9919[_0xf315('0x20')]?_[_0xf315('0x21')](_0x4d9919[_0xf315('0x20')],function(_0x6a014e){return{'model':db[_0x6a014e[_0xf315('0x22')]],'as':_0x6a014e['as'],'attributes':_0x6a014e[_0xf315('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32c1ec){logger['info']('ShowWhatsappAccount',_0x39cabc);logger[_0xf315('0x16')](_0xf315('0x1c'),_0x39cabc,JSON['stringify'](_0x32c1ec));_0x1948db(_0x32c1ec);})[_0xf315('0x23')](function(_0x48ee46){logger[_0xf315('0x18')](_0xf315('0x1c'),_0x48ee46[_0xf315('0x1a')],_0x39cabc);_0x4a8171(_0x2c4615[_0xf315('0x18')](0x1f4,_0x48ee46[_0xf315('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1770fbe..59fb1af 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 _0x612f=['register','length','./whatsappAccount.events','save','update','emit'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x612f,0xf2));var _0xf612=function(_0x1549ae,_0x4ea436){_0x1549ae=_0x1549ae-0x0;var _0x141302=_0x612f[_0x1549ae];return _0x141302;};'use strict';var WhatsappAccountEvents=require(_0xf612('0x0'));var events=[_0xf612('0x1'),'remove',_0xf612('0x2')];function createListener(_0x45aa8b,_0x16d4c5){return function(_0x54fab3){_0x16d4c5[_0xf612('0x3')](_0x45aa8b,_0x54fab3);};}function removeListener(_0x47ca2b,_0xc8684a){return function(){WhatsappAccountEvents['removeListener'](_0x47ca2b,_0xc8684a);};}exports[_0xf612('0x4')]=function(_0x293b7c){for(var _0xaf1a49=0x0,_0x555f5b=events[_0xf612('0x5')];_0xaf1a49<_0x555f5b;_0xaf1a49++){var _0xd44303=events[_0xaf1a49];var _0x25ff21=createListener('whatsappAccount:'+_0xd44303,_0x293b7c);WhatsappAccountEvents['on'](_0xd44303,_0x25ff21);}}; \ No newline at end of file +var _0x376e=['remove','update','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x2e27ac,_0x2b2f83){var _0x12af21=function(_0x2fcd8c){while(--_0x2fcd8c){_0x2e27ac['push'](_0x2e27ac['shift']());}};_0x12af21(++_0x2b2f83);}(_0x376e,0x106));var _0xe376=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x376e[_0x36c5b0];return _0xf19333;};'use strict';var WhatsappAccountEvents=require(_0xe376('0x0'));var events=[_0xe376('0x1'),_0xe376('0x2'),_0xe376('0x3')];function createListener(_0x50975b,_0x2b8eea){return function(_0x5ea2d4){_0x2b8eea['emit'](_0x50975b,_0x5ea2d4);};}function removeListener(_0x284261,_0x3337de){return function(){WhatsappAccountEvents['removeListener'](_0x284261,_0x3337de);};}exports['register']=function(_0xe5ded9){for(var _0x3f8f67=0x0,_0x23f537=events[_0xe376('0x4')];_0x3f8f67<_0x23f537;_0x3f8f67++){var _0x539a7=events[_0x3f8f67];var _0x1f6823=createListener(_0xe376('0x5')+_0x539a7,_0xe5ded9);WhatsappAccountEvents['on'](_0x539a7,_0x1f6823);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8db1e08..d546ea3 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 _0x5fb5=['Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x428a5f,_0x56c9cf){var _0x1a591b=function(_0x2f47d4){while(--_0x2f47d4){_0x428a5f['push'](_0x428a5f['shift']());}};_0x1a591b(++_0x56c9cf);}(_0x5fb5,0x1e2));var _0x55fb=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0x5fb5[_0x59f0dc];return _0x5b5445;};'use strict';var multer=require(_0x55fb('0x0'));var util=require(_0x55fb('0x1'));var path=require(_0x55fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x55fb('0x3'));var router=express[_0x55fb('0x4')]();var fs_extra=require(_0x55fb('0x5'));var auth=require(_0x55fb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x55fb('0x7')]('/',auth['isAuthenticated'](),controller[_0x55fb('0x8')]);router['get'](_0x55fb('0x9'),auth[_0x55fb('0xa')](),controller[_0x55fb('0xb')]);router[_0x55fb('0xc')]('/',auth[_0x55fb('0xa')](),controller[_0x55fb('0xd')]);router[_0x55fb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x55fb('0xf')]);router[_0x55fb('0x10')](_0x55fb('0x9'),auth[_0x55fb('0xa')](),controller[_0x55fb('0x11')]);module['exports']=router; \ No newline at end of file +var _0x97f3=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','/:id','show','post','create','put','delete','exports','util'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0x97f3,0xf6));var _0x397f=function(_0x4430d8,_0x51721e){_0x4430d8=_0x4430d8-0x0;var _0x487d95=_0x97f3[_0x4430d8];return _0x487d95;};'use strict';var multer=require('multer');var util=require(_0x397f('0x0'));var path=require(_0x397f('0x1'));var timeout=require(_0x397f('0x2'));var express=require(_0x397f('0x3'));var router=express[_0x397f('0x4')]();var fs_extra=require(_0x397f('0x5'));var auth=require(_0x397f('0x6'));var interaction=require(_0x397f('0x7'));var config=require(_0x397f('0x8'));var controller=require(_0x397f('0x9'));router['get']('/',auth[_0x397f('0xa')](),controller[_0x397f('0xb')]);router['get'](_0x397f('0xc'),auth[_0x397f('0xa')](),controller[_0x397f('0xd')]);router[_0x397f('0xe')]('/',auth[_0x397f('0xa')](),controller[_0x397f('0xf')]);router[_0x397f('0x10')](_0x397f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x397f('0x11')]('/:id',auth[_0x397f('0xa')](),controller['destroy']);module[_0x397f('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 84c0988..8afdcff 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 _0x7665=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x5bf6e4,_0x551cdd){var _0x4af264=function(_0x533a90){while(--_0x533a90){_0x5bf6e4['push'](_0x5bf6e4['shift']());}};_0x4af264(++_0x551cdd);}(_0x7665,0xc1));var _0x5766=function(_0x4e443a,_0x10c88a){_0x4e443a=_0x4e443a-0x0;var _0x1998f6=_0x7665[_0x4e443a];return _0x1998f6;};'use strict';var Sequelize=require(_0x5766('0x0'));module[_0x5766('0x1')]={'priority':{'type':Sequelize[_0x5766('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5766('0x3')],'allowNull':![],'defaultValue':_0x5766('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5766('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6d29=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x6d29,0x11a));var _0x96d2=function(_0x1daaa4,_0x2a13f8){_0x1daaa4=_0x1daaa4-0x0;var _0x4d6a11=_0x6d29[_0x1daaa4];return _0x4d6a11;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x96d2('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x96d2('0x1')],'allowNull':![],'defaultValue':_0x96d2('0x2')},'appdata':{'type':Sequelize[_0x96d2('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x96d2('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 42bd3a1..c6e717e 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 _0xb422=['sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','update','body','fast-json-patch','bluebird','util'];(function(_0x223704,_0x382bfa){var _0xe47fc6=function(_0x21d834){while(--_0x21d834){_0x223704['push'](_0x223704['shift']());}};_0xe47fc6(++_0x382bfa);}(_0xb422,0x85));var _0x2b42=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0xb422[_0x58ceb9];return _0x3d0ff5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b42('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b42('0x1'));var Mustache=require('mustache');var util=require(_0x2b42('0x2'));var path=require('path');var sox=require(_0x2b42('0x3'));var csv=require('to-csv');var ejs=require(_0x2b42('0x4'));var fs=require('fs');var fs_extra=require(_0x2b42('0x5'));var _=require(_0x2b42('0x6'));var squel=require('squel');var crypto=require(_0x2b42('0x7'));var jsforce=require(_0x2b42('0x8'));var deskjs=require(_0x2b42('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b42('0xa'));var Redis=require('ioredis');var authService=require(_0x2b42('0xb'));var qs=require(_0x2b42('0xc'));var as=require(_0x2b42('0xd'));var hardwareService=require(_0x2b42('0xe'));var logger=require('../../config/logger')(_0x2b42('0xf'));var utils=require(_0x2b42('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2b42('0x11'));var db=require(_0x2b42('0x12'))['db'];function respondWithStatusCode(_0x22272e,_0x176efa){_0x176efa=_0x176efa||0xcc;return function(_0x4b8a04){if(_0x4b8a04){return _0x22272e['sendStatus'](_0x176efa);}return _0x22272e[_0x2b42('0x13')](_0x176efa)[_0x2b42('0x14')]();};}function respondWithResult(_0x5dec9a,_0x232c58){_0x232c58=_0x232c58||0xc8;return function(_0x17d103){if(_0x17d103){return _0x5dec9a[_0x2b42('0x13')](_0x232c58)[_0x2b42('0x15')](_0x17d103);}};}function respondWithFilteredResult(_0x4cb695,_0xc7e610){return function(_0x84b092){if(_0x84b092){var _0x1b93d5=typeof _0xc7e610[_0x2b42('0x16')]===_0x2b42('0x17')&&typeof _0xc7e610['limit']===_0x2b42('0x17');var _0x11fdec=_0x84b092[_0x2b42('0x18')];var _0x3e3426=_0x1b93d5?0x0:_0xc7e610[_0x2b42('0x16')];var _0x3ab83c=_0x1b93d5?_0x84b092[_0x2b42('0x18')]:_0xc7e610[_0x2b42('0x16')]+_0xc7e610['limit'];var _0x22b8d6;if(_0x3ab83c>=_0x11fdec){_0x3ab83c=_0x11fdec;_0x22b8d6=0xc8;}else{_0x22b8d6=0xce;}_0x4cb695[_0x2b42('0x13')](_0x22b8d6);return _0x4cb695['set'](_0x2b42('0x19'),_0x3e3426+'-'+_0x3ab83c+'/'+_0x11fdec)['json'](_0x84b092);}return null;};}function patchUpdates(_0x38d41c){return function(_0x13422a){try{jsonpatch[_0x2b42('0x1a')](_0x13422a,_0x38d41c,!![]);}catch(_0x50fd94){return BPromise['reject'](_0x50fd94);}return _0x13422a[_0x2b42('0x1b')]();};}function saveUpdates(_0x24061b,_0x24ac96){return function(_0x2ee957){if(_0x2ee957){return _0x2ee957['update'](_0x24061b)[_0x2b42('0x1c')](function(_0x355859){return _0x355859;});}return null;};}function removeEntity(_0x5063b6,_0x2b9531){return function(_0x2e9aa1){if(_0x2e9aa1){return _0x2e9aa1[_0x2b42('0x1d')]()[_0x2b42('0x1c')](function(){_0x5063b6[_0x2b42('0x13')](0xcc)[_0x2b42('0x14')]();});}};}function handleEntityNotFound(_0x5367f0,_0x20ee74){return function(_0x319692){if(!_0x319692){_0x5367f0[_0x2b42('0x1e')](0x194);}return _0x319692;};}function handleError(_0x256fc9,_0x1d37b9){_0x1d37b9=_0x1d37b9||0x1f4;return function(_0x807625){logger[_0x2b42('0x1f')](_0x807625[_0x2b42('0x20')]);if(_0x807625[_0x2b42('0x21')]){delete _0x807625[_0x2b42('0x21')];}_0x256fc9[_0x2b42('0x13')](_0x1d37b9)['send'](_0x807625);};}exports['index']=function(_0x162efa,_0xcb30f5){var _0x8293e2={},_0x352ef7={},_0x4b43b0={'count':0x0,'rows':[]};var _0x286223=_[_0x2b42('0x22')](db[_0x2b42('0x23')]['rawAttributes'],function(_0x5588ce){return{'name':_0x5588ce[_0x2b42('0x24')],'type':_0x5588ce[_0x2b42('0x25')][_0x2b42('0x26')]};});_0x352ef7[_0x2b42('0x27')]=_['map'](_0x286223,_0x2b42('0x21'));_0x352ef7[_0x2b42('0x28')]=_[_0x2b42('0x29')](_0x162efa['query']);_0x352ef7[_0x2b42('0x2a')]=_[_0x2b42('0x2b')](_0x352ef7[_0x2b42('0x27')],_0x352ef7[_0x2b42('0x28')]);_0x8293e2[_0x2b42('0x2c')]=_[_0x2b42('0x2b')](_0x352ef7[_0x2b42('0x27')],qs[_0x2b42('0x2d')](_0x162efa[_0x2b42('0x28')][_0x2b42('0x2d')]));_0x8293e2[_0x2b42('0x2c')]=_0x8293e2['attributes'][_0x2b42('0x2e')]?_0x8293e2['attributes']:_0x352ef7['model'];if(!_0x162efa[_0x2b42('0x28')][_0x2b42('0x2f')]('nolimit')){_0x8293e2['limit']=qs['limit'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x30')]);_0x8293e2[_0x2b42('0x16')]=qs['offset'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x16')]);}_0x8293e2['order']=qs['sort'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x31')]);_0x8293e2[_0x2b42('0x32')]=qs['filters'](_[_0x2b42('0x33')](_0x162efa[_0x2b42('0x28')],_0x352ef7[_0x2b42('0x2a')]),_0x286223);if(_0x162efa[_0x2b42('0x28')][_0x2b42('0x34')]){_0x8293e2['where']=_[_0x2b42('0x35')](_0x8293e2[_0x2b42('0x32')],{'$or':_[_0x2b42('0x22')](_0x286223,function(_0x3971ee){if(_0x3971ee[_0x2b42('0x25')]!==_0x2b42('0x36')){var _0x45fb9f={};_0x45fb9f[_0x3971ee[_0x2b42('0x21')]]={'$like':'%'+_0x162efa[_0x2b42('0x28')][_0x2b42('0x34')]+'%'};return _0x45fb9f;}})});}_0x8293e2=_['merge']({},_0x8293e2,_0x162efa['options']);var _0x17b9b1={'where':_0x8293e2[_0x2b42('0x32')]};return db[_0x2b42('0x23')][_0x2b42('0x18')](_0x17b9b1)['then'](function(_0x1188d9){_0x4b43b0[_0x2b42('0x18')]=_0x1188d9;if(_0x162efa[_0x2b42('0x28')][_0x2b42('0x37')]){_0x8293e2[_0x2b42('0x38')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2b42('0x39')](_0x8293e2);})['then'](function(_0x35e745){_0x4b43b0[_0x2b42('0x3a')]=_0x35e745;return _0x4b43b0;})['then'](respondWithFilteredResult(_0xcb30f5,_0x8293e2))['catch'](handleError(_0xcb30f5,null));};exports[_0x2b42('0x3b')]=function(_0x10fad1,_0x4dc92e){var _0x5c525b={'raw':!![],'where':{'id':_0x10fad1[_0x2b42('0x3c')]['id']}},_0x3cc07e={};_0x3cc07e[_0x2b42('0x27')]=_[_0x2b42('0x29')](db[_0x2b42('0x23')][_0x2b42('0x3d')]);_0x3cc07e['query']=_[_0x2b42('0x29')](_0x10fad1[_0x2b42('0x28')]);_0x3cc07e['filters']=_[_0x2b42('0x2b')](_0x3cc07e[_0x2b42('0x27')],_0x3cc07e[_0x2b42('0x28')]);_0x5c525b[_0x2b42('0x2c')]=_[_0x2b42('0x2b')](_0x3cc07e[_0x2b42('0x27')],qs[_0x2b42('0x2d')](_0x10fad1[_0x2b42('0x28')][_0x2b42('0x2d')]));_0x5c525b[_0x2b42('0x2c')]=_0x5c525b[_0x2b42('0x2c')][_0x2b42('0x2e')]?_0x5c525b[_0x2b42('0x2c')]:_0x3cc07e[_0x2b42('0x27')];if(_0x10fad1[_0x2b42('0x28')]['includeAll']){_0x5c525b['include']=[{'all':!![]}];}_0x5c525b=_['merge']({},_0x5c525b,_0x10fad1[_0x2b42('0x3e')]);return db[_0x2b42('0x23')][_0x2b42('0x3f')](_0x5c525b)[_0x2b42('0x1c')](handleEntityNotFound(_0x4dc92e,null))[_0x2b42('0x1c')](respondWithResult(_0x4dc92e,null))[_0x2b42('0x40')](handleError(_0x4dc92e,null));};exports['create']=function(_0x11da42,_0x466e49){return db['WhatsappApplication'][_0x2b42('0x41')](_0x11da42['body'],{})[_0x2b42('0x1c')](respondWithResult(_0x466e49,0xc9))[_0x2b42('0x40')](handleError(_0x466e49,null));};exports[_0x2b42('0x42')]=function(_0x45fecd,_0x2890d2){if(_0x45fecd[_0x2b42('0x43')]['id']){delete _0x45fecd[_0x2b42('0x43')]['id'];}return db[_0x2b42('0x23')]['find']({'where':{'id':_0x45fecd[_0x2b42('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2890d2,null))[_0x2b42('0x1c')](saveUpdates(_0x45fecd[_0x2b42('0x43')],null))[_0x2b42('0x1c')](respondWithResult(_0x2890d2,null))['catch'](handleError(_0x2890d2,null));};exports[_0x2b42('0x1d')]=function(_0x3e09f3,_0x212b03){return db[_0x2b42('0x23')]['find']({'where':{'id':_0x3e09f3['params']['id']}})[_0x2b42('0x1c')](handleEntityNotFound(_0x212b03,null))[_0x2b42('0x1c')](removeEntity(_0x212b03,null))[_0x2b42('0x40')](handleError(_0x212b03,null));}; \ No newline at end of file +var _0x6829=['../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','set','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappApplication','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1ccc19,_0x2a5e47){var _0x393065=function(_0x1ffa38){while(--_0x1ffa38){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x393065(++_0x2a5e47);}(_0x6829,0x14c));var _0x9682=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6829[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x9682('0x0'));var rimraf=require(_0x9682('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9682('0x2'));var BPromise=require(_0x9682('0x3'));var Mustache=require(_0x9682('0x4'));var util=require(_0x9682('0x5'));var path=require(_0x9682('0x6'));var sox=require(_0x9682('0x7'));var csv=require(_0x9682('0x8'));var ejs=require(_0x9682('0x9'));var fs=require('fs');var fs_extra=require(_0x9682('0xa'));var _=require(_0x9682('0xb'));var squel=require(_0x9682('0xc'));var crypto=require(_0x9682('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9682('0xe'));var Papa=require(_0x9682('0xf'));var Redis=require('ioredis');var authService=require(_0x9682('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9682('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9682('0x12'))(_0x9682('0x13'));var utils=require(_0x9682('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9682('0x15'))['db'];function respondWithStatusCode(_0x1391c3,_0x57e123){_0x57e123=_0x57e123||0xcc;return function(_0x15663f){if(_0x15663f){return _0x1391c3['sendStatus'](_0x57e123);}return _0x1391c3[_0x9682('0x16')](_0x57e123)[_0x9682('0x17')]();};}function respondWithResult(_0x289d8b,_0x21451a){_0x21451a=_0x21451a||0xc8;return function(_0x30bfd7){if(_0x30bfd7){return _0x289d8b[_0x9682('0x16')](_0x21451a)[_0x9682('0x18')](_0x30bfd7);}};}function respondWithFilteredResult(_0xa26517,_0x1adcf8){return function(_0x13a1a9){if(_0x13a1a9){var _0x526391=typeof _0x1adcf8[_0x9682('0x19')]==='undefined'&&typeof _0x1adcf8[_0x9682('0x1a')]===_0x9682('0x1b');var _0x1f4971=_0x13a1a9['count'];var _0x1c73ee=_0x526391?0x0:_0x1adcf8['offset'];var _0x107291=_0x526391?_0x13a1a9['count']:_0x1adcf8[_0x9682('0x19')]+_0x1adcf8[_0x9682('0x1a')];var _0x57d4cf;if(_0x107291>=_0x1f4971){_0x107291=_0x1f4971;_0x57d4cf=0xc8;}else{_0x57d4cf=0xce;}_0xa26517[_0x9682('0x16')](_0x57d4cf);return _0xa26517[_0x9682('0x1c')]('Content-Range',_0x1c73ee+'-'+_0x107291+'/'+_0x1f4971)['json'](_0x13a1a9);}return null;};}function patchUpdates(_0x497ff7){return function(_0x3fca2b){try{jsonpatch['apply'](_0x3fca2b,_0x497ff7,!![]);}catch(_0x36230c){return BPromise[_0x9682('0x1d')](_0x36230c);}return _0x3fca2b['save']();};}function saveUpdates(_0x4650c9,_0x238361){return function(_0x1aacb6){if(_0x1aacb6){return _0x1aacb6[_0x9682('0x1e')](_0x4650c9)[_0x9682('0x1f')](function(_0x1c2eaf){return _0x1c2eaf;});}return null;};}function removeEntity(_0x738838,_0x40e927){return function(_0x107352){if(_0x107352){return _0x107352[_0x9682('0x20')]()['then'](function(){_0x738838[_0x9682('0x16')](0xcc)[_0x9682('0x17')]();});}};}function handleEntityNotFound(_0x88419f,_0x21a10b){return function(_0x39291f){if(!_0x39291f){_0x88419f['sendStatus'](0x194);}return _0x39291f;};}function handleError(_0x756fea,_0x1dbf57){_0x1dbf57=_0x1dbf57||0x1f4;return function(_0x44808c){logger[_0x9682('0x21')](_0x44808c[_0x9682('0x22')]);if(_0x44808c[_0x9682('0x23')]){delete _0x44808c['name'];}_0x756fea[_0x9682('0x16')](_0x1dbf57)[_0x9682('0x24')](_0x44808c);};}exports[_0x9682('0x25')]=function(_0x1d827e,_0x9e3d59){var _0x1fdb4d={},_0x176624={},_0x14d974={'count':0x0,'rows':[]};var _0x5f4294=_[_0x9682('0x26')](db['WhatsappApplication'][_0x9682('0x27')],function(_0x27d7f0){return{'name':_0x27d7f0['fieldName'],'type':_0x27d7f0['type']['key']};});_0x176624['model']=_[_0x9682('0x26')](_0x5f4294,'name');_0x176624[_0x9682('0x28')]=_[_0x9682('0x29')](_0x1d827e[_0x9682('0x28')]);_0x176624[_0x9682('0x2a')]=_['intersection'](_0x176624['model'],_0x176624[_0x9682('0x28')]);_0x1fdb4d[_0x9682('0x2b')]=_[_0x9682('0x2c')](_0x176624[_0x9682('0x2d')],qs[_0x9682('0x2e')](_0x1d827e['query']['fields']));_0x1fdb4d[_0x9682('0x2b')]=_0x1fdb4d[_0x9682('0x2b')][_0x9682('0x2f')]?_0x1fdb4d[_0x9682('0x2b')]:_0x176624[_0x9682('0x2d')];if(!_0x1d827e[_0x9682('0x28')][_0x9682('0x30')]('nolimit')){_0x1fdb4d[_0x9682('0x1a')]=qs[_0x9682('0x1a')](_0x1d827e[_0x9682('0x28')][_0x9682('0x1a')]);_0x1fdb4d[_0x9682('0x19')]=qs['offset'](_0x1d827e[_0x9682('0x28')]['offset']);}_0x1fdb4d[_0x9682('0x31')]=qs[_0x9682('0x32')](_0x1d827e[_0x9682('0x28')][_0x9682('0x32')]);_0x1fdb4d[_0x9682('0x33')]=qs[_0x9682('0x2a')](_[_0x9682('0x34')](_0x1d827e['query'],_0x176624[_0x9682('0x2a')]),_0x5f4294);if(_0x1d827e['query'][_0x9682('0x35')]){_0x1fdb4d['where']=_[_0x9682('0x36')](_0x1fdb4d[_0x9682('0x33')],{'$or':_[_0x9682('0x26')](_0x5f4294,function(_0x110fff){if(_0x110fff[_0x9682('0x37')]!==_0x9682('0x38')){var _0x123367={};_0x123367[_0x110fff[_0x9682('0x23')]]={'$like':'%'+_0x1d827e[_0x9682('0x28')][_0x9682('0x35')]+'%'};return _0x123367;}})});}_0x1fdb4d=_[_0x9682('0x36')]({},_0x1fdb4d,_0x1d827e['options']);var _0x30bdf0={'where':_0x1fdb4d[_0x9682('0x33')]};return db[_0x9682('0x39')][_0x9682('0x3a')](_0x30bdf0)[_0x9682('0x1f')](function(_0x479ac7){_0x14d974[_0x9682('0x3a')]=_0x479ac7;if(_0x1d827e[_0x9682('0x28')][_0x9682('0x3b')]){_0x1fdb4d['include']=[{'all':!![]}];}return db[_0x9682('0x39')][_0x9682('0x3c')](_0x1fdb4d);})[_0x9682('0x1f')](function(_0x240431){_0x14d974[_0x9682('0x3d')]=_0x240431;return _0x14d974;})[_0x9682('0x1f')](respondWithFilteredResult(_0x9e3d59,_0x1fdb4d))[_0x9682('0x3e')](handleError(_0x9e3d59,null));};exports[_0x9682('0x3f')]=function(_0x6e3eaa,_0x2d9b43){var _0x46b5c6={'raw':!![],'where':{'id':_0x6e3eaa[_0x9682('0x40')]['id']}},_0x3324b2={};_0x3324b2[_0x9682('0x2d')]=_[_0x9682('0x29')](db[_0x9682('0x39')]['rawAttributes']);_0x3324b2[_0x9682('0x28')]=_['keys'](_0x6e3eaa[_0x9682('0x28')]);_0x3324b2[_0x9682('0x2a')]=_[_0x9682('0x2c')](_0x3324b2['model'],_0x3324b2['query']);_0x46b5c6[_0x9682('0x2b')]=_[_0x9682('0x2c')](_0x3324b2[_0x9682('0x2d')],qs[_0x9682('0x2e')](_0x6e3eaa[_0x9682('0x28')][_0x9682('0x2e')]));_0x46b5c6[_0x9682('0x2b')]=_0x46b5c6['attributes'][_0x9682('0x2f')]?_0x46b5c6['attributes']:_0x3324b2[_0x9682('0x2d')];if(_0x6e3eaa[_0x9682('0x28')][_0x9682('0x3b')]){_0x46b5c6[_0x9682('0x41')]=[{'all':!![]}];}_0x46b5c6=_[_0x9682('0x36')]({},_0x46b5c6,_0x6e3eaa[_0x9682('0x42')]);return db[_0x9682('0x39')][_0x9682('0x43')](_0x46b5c6)['then'](handleEntityNotFound(_0x2d9b43,null))[_0x9682('0x1f')](respondWithResult(_0x2d9b43,null))[_0x9682('0x3e')](handleError(_0x2d9b43,null));};exports[_0x9682('0x44')]=function(_0x1d09a4,_0xd99414){return db[_0x9682('0x39')]['create'](_0x1d09a4[_0x9682('0x45')],{})[_0x9682('0x1f')](respondWithResult(_0xd99414,0xc9))[_0x9682('0x3e')](handleError(_0xd99414,null));};exports[_0x9682('0x1e')]=function(_0x3c79ce,_0x2cc99b){if(_0x3c79ce[_0x9682('0x45')]['id']){delete _0x3c79ce[_0x9682('0x45')]['id'];}return db[_0x9682('0x39')][_0x9682('0x43')]({'where':{'id':_0x3c79ce['params']['id']}})['then'](handleEntityNotFound(_0x2cc99b,null))['then'](saveUpdates(_0x3c79ce['body'],null))['then'](respondWithResult(_0x2cc99b,null))[_0x9682('0x3e')](handleError(_0x2cc99b,null));};exports[_0x9682('0x20')]=function(_0x731dd0,_0x5154c7){return db[_0x9682('0x39')][_0x9682('0x43')]({'where':{'id':_0x731dd0[_0x9682('0x40')]['id']}})['then'](handleEntityNotFound(_0x5154c7,null))[_0x9682('0x1f')](removeEntity(_0x5154c7,null))[_0x9682('0x3e')](handleError(_0x5154c7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5db2d4e..d237c49 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 _0x79d3=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x79d3,0x15f));var _0x379d=function(_0x413ff0,_0x1e782d){_0x413ff0=_0x413ff0-0x0;var _0x3826d4=_0x79d3[_0x413ff0];return _0x3826d4;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x379d('0xa'),'collate':_0x379d('0xb')});}; \ No newline at end of file +var _0x8ef6=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x587792,_0x2b1d7f){var _0x523116=function(_0x550fb7){while(--_0x550fb7){_0x587792['push'](_0x587792['shift']());}};_0x523116(++_0x2b1d7f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x454c6a,_0x263b07){_0x454c6a=_0x454c6a-0x0;var _0x1a3629=_0x8ef6[_0x454c6a];return _0x1a3629;};'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':!![],'charset':'utf8mb4','collate':_0x68ef('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 2b2cadd..7db5ade 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0xfd5a12,_0x3178ff){var _0x5ba1ad=function(_0x4032aa){while(--_0x4032aa){_0xfd5a12['push'](_0xfd5a12['shift']());}};_0x5ba1ad(++_0x3178ff);}(_0x0e85,0x7c));var _0x50e8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0e85[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file +var _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5bd4fc,_0x4fbd8c){var _0x14b56e=function(_0x361e5c){while(--_0x361e5c){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x14b56e(++_0x4fbd8c);}(_0xe14d,0x1ee));var _0xde14=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe14d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ac1e2ad..30fbbbd 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 _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0x7da7,0x10d));var _0x77da=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x7da7[_0x1305e3];return _0x1068e9;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x77da('0x7')]('/',auth[_0x77da('0x8')](),controller['index']);router[_0x77da('0x7')]('/describe',auth[_0x77da('0x8')](),controller[_0x77da('0x9')]);router[_0x77da('0x7')](_0x77da('0xa'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x7')](_0x77da('0xb'),auth[_0x77da('0x8')](),controller['getMessages']);router[_0x77da('0x7')](_0x77da('0xc'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);router['post']('/',auth[_0x77da('0x8')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x77da('0x10')]);router[_0x77da('0xf')]('/:id/tags',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x13')),controller['addTags']);router[_0x77da('0x14')]('/:id',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x15')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x16')),controller[_0x77da('0x17')]);router[_0x77da('0x18')](_0x77da('0x19'),auth[_0x77da('0x8')](),controller[_0x77da('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xfdbd=['getMessages','download','create','post','addMessage','/:id/tags','whatsapp','addTags','put','/:id','tracked','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','isAuthenticated','index','describe','get','show','/:id/messages'];(function(_0x45b403,_0x1a3b4b){var _0x4efa99=function(_0x36a426){while(--_0x36a426){_0x45b403['push'](_0x45b403['shift']());}};_0x4efa99(++_0x1a3b4b);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0xfdbd[_0xcda377];return _0x1c024f;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xd')](_0xdfdb('0xf'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0xd')]('/:id/download',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x11')]);router['post']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x12')]);router[_0xdfdb('0x13')](_0xdfdb('0xf'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x14')]);router[_0xdfdb('0x13')](_0xdfdb('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xdfdb('0x16'),'whatsappinteraction:addtags'),controller[_0xdfdb('0x17')]);router[_0xdfdb('0x18')](_0xdfdb('0x19'),auth[_0xdfdb('0xa')](),interaction[_0xdfdb('0x1a')](_0xdfdb('0x16'),'whatsappinteraction:update'),controller['update']);router[_0xdfdb('0x1b')](_0xdfdb('0x19'),auth[_0xdfdb('0xa')](),interaction['tracked'](_0xdfdb('0x16'),_0xdfdb('0x1c')),controller[_0xdfdb('0x1d')]);router[_0xdfdb('0x1b')](_0xdfdb('0x15'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x1e')]);module[_0xdfdb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fa1d0c3..2fd6ea0 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 _0xf3f9=['BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize','moment'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x3ffceb,_0x419f85){_0x3ffceb=_0x3ffceb-0x0;var _0x2ebaf0=_0xf3f9[_0x3ffceb];return _0x2ebaf0;};'use strict';var Sequelize=require(_0x9f3f('0x0'));var moment=require(_0x9f3f('0x1'));module['exports']={'closed':{'type':Sequelize[_0x9f3f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9f3f('0x3')]},'disposition':{'type':Sequelize[_0x9f3f('0x4')]},'secondDisposition':{'type':Sequelize[_0x9f3f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9f3f('0x4')]},'note':{'type':Sequelize[_0x9f3f('0x4')]},'phone':{'type':Sequelize[_0x9f3f('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f3f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9f3f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9f3f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9f3f('0x7')]}}; \ No newline at end of file +var _0xafcd=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0xafcd,0x157));var _0xdafc=function(_0x4f9478,_0x134ef3){_0x4f9478=_0x4f9478-0x0;var _0x3464c9=_0xafcd[_0x4f9478];return _0x3464c9;};'use strict';var Sequelize=require(_0xdafc('0x0'));var moment=require(_0xdafc('0x1'));module[_0xdafc('0x2')]={'closed':{'type':Sequelize[_0xdafc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdafc('0x4')]},'disposition':{'type':Sequelize[_0xdafc('0x5')]},'secondDisposition':{'type':Sequelize[_0xdafc('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdafc('0x5')]},'phone':{'type':Sequelize[_0xdafc('0x5')]},'read1stAt':{'type':Sequelize[_0xdafc('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xdafc('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdafc('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xdafc('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdafc('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdafc('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 3b4c19b..404288d 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 _0xa673=['ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','fieldName','type','key','getOptions','findAll','user','show','params','keys','WhatsappInteraction','rawAttributes','query','filters','intersection','attributes','fields','model','include','merge','options','find','catch','create','body','describe','addMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','secret','read','WhatsappAccount','Account','fullname','get','mkdirSync','Owner','createdAt','closedAt','disposition','Messages','Attachment','basename','existsSync','pipe','createWriteStream','direction','System','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','rimraf','zip-dir','moment','bluebird','util'];(function(_0x3eb03f,_0x3a2f91){var _0x56140c=function(_0x5bef45){while(--_0x5bef45){_0x3eb03f['push'](_0x3eb03f['shift']());}};_0x56140c(++_0x3a2f91);}(_0xa673,0x17b));var _0x3a67=function(_0x371761,_0x42a66f){_0x371761=_0x371761-0x0;var _0x279921=_0xa673[_0x371761];return _0x279921;};'use strict';var rimraf=require(_0x3a67('0x0'));var zipdir=require(_0x3a67('0x1'));var moment=require(_0x3a67('0x2'));var BPromise=require(_0x3a67('0x3'));var util=require(_0x3a67('0x4'));var path=require('path');var ejs=require(_0x3a67('0x5'));var fs=require('fs');var _=require(_0x3a67('0x6'));var Redis=require(_0x3a67('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x3a67('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x3a67('0x9'))(_0x3a67('0xa'));var config=require('../../config/environment');var db=require(_0x3a67('0xb'))['db'];config[_0x3a67('0xc')]=_['defaults'](config[_0x3a67('0xc')],{'host':_0x3a67('0xd'),'port':0x18eb});var socket=require(_0x3a67('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x3a67('0xf')](socket);function respondWithStatusCode(_0x27f828,_0x1884e2){_0x1884e2=_0x1884e2||0xcc;return function(_0x1774f4){if(_0x1774f4){return _0x27f828[_0x3a67('0x10')](_0x1884e2);}return _0x27f828[_0x3a67('0x11')](_0x1884e2)['end']();};}function respondWithResult(_0x5c7d72,_0x3b1caa){_0x3b1caa=_0x3b1caa||0xc8;return function(_0x54ea28){if(_0x54ea28){return _0x5c7d72['status'](_0x3b1caa)[_0x3a67('0x12')](_0x54ea28);}};}function respondWithFilteredResult(_0x56b816,_0x510f9a){return function(_0x32a77e){if(_0x32a77e){var _0x482768=typeof _0x510f9a[_0x3a67('0x13')]===_0x3a67('0x14')&&typeof _0x510f9a[_0x3a67('0x15')]==='undefined';var _0x3389e2=_0x32a77e[_0x3a67('0x16')];var _0x3d9244=_0x482768?0x0:_0x510f9a[_0x3a67('0x13')];var _0x58c7e5=_0x482768?_0x32a77e['count']:_0x510f9a[_0x3a67('0x13')]+_0x510f9a[_0x3a67('0x15')];var _0x29b88d;if(_0x58c7e5>=_0x3389e2){_0x58c7e5=_0x3389e2;_0x29b88d=0xc8;}else{_0x29b88d=0xce;}_0x56b816[_0x3a67('0x11')](_0x29b88d);return _0x56b816[_0x3a67('0x17')](_0x3a67('0x18'),_0x3d9244+'-'+_0x58c7e5+'/'+_0x3389e2)[_0x3a67('0x12')](_0x32a77e);}return null;};}function saveUpdates(_0x11ff72){return function(_0x1b7403){if(_0x1b7403){return _0x1b7403[_0x3a67('0x19')](_0x11ff72)[_0x3a67('0x1a')](function(_0x3ef811){return _0x3ef811;});}return null;};}function removeEntity(_0x3b4641){return function(_0x2b9813){if(_0x2b9813){return _0x2b9813[_0x3a67('0x1b')]()[_0x3a67('0x1a')](function(){_0x3b4641[_0x3a67('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7663cd){return function(_0x347f37){if(!_0x347f37){_0x7663cd[_0x3a67('0x10')](0x194);}return _0x347f37;};}function handleError(_0x1670d4,_0x98167f){_0x98167f=_0x98167f||0x1f4;return function(_0x5a48c9){logger[_0x3a67('0x1c')](_0x5a48c9['stack']);if(_0x5a48c9[_0x3a67('0x1d')]){delete _0x5a48c9[_0x3a67('0x1d')];}_0x1670d4[_0x3a67('0x11')](_0x98167f)[_0x3a67('0x1e')](_0x5a48c9);};}exports[_0x3a67('0x1f')]=function(_0x225481,_0x106f6d){var _0x4d9e7c={};var _0x306b0b=_[_0x3a67('0x20')](db['WhatsappInteraction']['rawAttributes'],function(_0x52b400){return{'name':_0x52b400[_0x3a67('0x21')],'type':_0x52b400[_0x3a67('0x22')][_0x3a67('0x23')]};});_0x4d9e7c=qs[_0x3a67('0x24')](_0x306b0b,_0x225481);return interaction[_0x3a67('0x25')]('whatsapp',_0x225481['query'],_0x225481[_0x3a67('0x26')],_0x4d9e7c,_0x306b0b)['then'](respondWithFilteredResult(_0x106f6d,_0x4d9e7c))['catch'](handleError(_0x106f6d,null));};exports[_0x3a67('0x27')]=function(_0x57c96c,_0x52a16f){var _0x2b72ad={'raw':![],'where':{'id':_0x57c96c[_0x3a67('0x28')]['id']}},_0x5074da={};_0x5074da['model']=_[_0x3a67('0x29')](db[_0x3a67('0x2a')][_0x3a67('0x2b')]);_0x5074da[_0x3a67('0x2c')]=_[_0x3a67('0x29')](_0x57c96c['query']);_0x5074da[_0x3a67('0x2d')]=_[_0x3a67('0x2e')](_0x5074da['model'],_0x5074da['query']);_0x2b72ad[_0x3a67('0x2f')]=_[_0x3a67('0x2e')](_0x5074da['model'],qs[_0x3a67('0x30')](_0x57c96c[_0x3a67('0x2c')]['fields']));_0x2b72ad[_0x3a67('0x2f')]=_0x2b72ad[_0x3a67('0x2f')]['length']?_0x2b72ad[_0x3a67('0x2f')]:_0x5074da[_0x3a67('0x31')];if(_0x57c96c[_0x3a67('0x2c')]['includeAll']){_0x2b72ad[_0x3a67('0x32')]=[{'all':!![]}];}_0x2b72ad=_[_0x3a67('0x33')]({},_0x2b72ad,_0x57c96c[_0x3a67('0x34')]);return db[_0x3a67('0x2a')][_0x3a67('0x35')](_0x2b72ad)[_0x3a67('0x1a')](handleEntityNotFound(_0x52a16f,null))['then'](respondWithResult(_0x52a16f,null))[_0x3a67('0x36')](handleError(_0x52a16f,null));};exports[_0x3a67('0x37')]=function(_0x53f921,_0x5a9d8a){return db[_0x3a67('0x2a')][_0x3a67('0x37')](_0x53f921[_0x3a67('0x38')],{})[_0x3a67('0x1a')](respondWithResult(_0x5a9d8a,0xc9))[_0x3a67('0x36')](handleError(_0x5a9d8a,null));};exports[_0x3a67('0x19')]=function(_0x150250,_0x291a8f){if(_0x150250[_0x3a67('0x38')]['id']){delete _0x150250['body']['id'];}return db[_0x3a67('0x2a')][_0x3a67('0x35')]({'where':{'id':_0x150250['params']['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x291a8f,null))['then'](saveUpdates(_0x150250[_0x3a67('0x38')],null))[_0x3a67('0x1a')](respondWithResult(_0x291a8f,null))[_0x3a67('0x36')](handleError(_0x291a8f,null));};exports[_0x3a67('0x1b')]=function(_0x13d997,_0x1d7cb7){return db['WhatsappInteraction']['find']({'where':{'id':_0x13d997[_0x3a67('0x28')]['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x1d7cb7,null))[_0x3a67('0x1a')](removeEntity(_0x1d7cb7,null))['catch'](handleError(_0x1d7cb7,null));};exports[_0x3a67('0x39')]=function(_0x2410c4,_0x589aa5){return db['WhatsappInteraction'][_0x3a67('0x39')]()[_0x3a67('0x1a')](respondWithResult(_0x589aa5,null))[_0x3a67('0x36')](handleError(_0x589aa5,null));};exports[_0x3a67('0x3a')]=function(_0x1e0eb8,_0x31a7fe){return db['WhatsappMessage'][_0x3a67('0x35')]({'where':{'id':_0x1e0eb8['params']['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x31a7fe,null))[_0x3a67('0x1a')](function(_0x3a63f4){if(_0x3a63f4){return _0x3a63f4[_0x3a67('0x3a')](_0x1e0eb8[_0x3a67('0x38')]['ids'],_[_0x3a67('0x3b')](_0x1e0eb8[_0x3a67('0x38')],[_0x3a67('0x3c'),'id'])||{});}})[_0x3a67('0x1a')](respondWithResult(_0x31a7fe,null))['catch'](handleError(_0x31a7fe,null));};exports[_0x3a67('0x3d')]=function(_0x55bd20,_0x22fe62){var _0xa7f41d={'raw':![],'where':{}};var _0x3a97b2={};var _0x24f703={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x3a67('0x3e')]({'where':{'id':_0x55bd20[_0x3a67('0x28')]['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x22fe62,null))['then'](function(_0x408c87){if(_0x408c87){_0x3a97b2[_0x3a67('0x31')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x3a97b2[_0x3a67('0x2c')]=_[_0x3a67('0x29')](_0x55bd20[_0x3a67('0x2c')]);_0x3a97b2[_0x3a67('0x2d')]=_[_0x3a67('0x2e')](_0x3a97b2[_0x3a67('0x31')],_0x3a97b2['query']);_0xa7f41d[_0x3a67('0x2f')]=_[_0x3a67('0x2e')](_0x3a97b2[_0x3a67('0x31')],qs[_0x3a67('0x30')](_0x55bd20[_0x3a67('0x2c')]['fields']));_0xa7f41d[_0x3a67('0x2f')]=_0xa7f41d[_0x3a67('0x2f')][_0x3a67('0x3f')]?_0xa7f41d[_0x3a67('0x2f')]:_0x3a97b2['model'];if(!_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x40')](_0x3a67('0x41'))){_0xa7f41d[_0x3a67('0x15')]=qs['limit'](_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x15')]);_0xa7f41d[_0x3a67('0x13')]=qs[_0x3a67('0x13')](_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x13')]);}_0xa7f41d[_0x3a67('0x42')]=qs[_0x3a67('0x43')](_0x55bd20['query'][_0x3a67('0x43')]);_0xa7f41d[_0x3a67('0x44')]=qs[_0x3a67('0x2d')](_[_0x3a67('0x45')](_0x55bd20[_0x3a67('0x2c')],_0x3a97b2[_0x3a67('0x2d')]));_0xa7f41d['where'][_0x3a67('0x46')]=_0x408c87['id'];if(_0x55bd20['query'][_0x3a67('0x47')]){_0xa7f41d[_0x3a67('0x44')]=_[_0x3a67('0x33')](_0xa7f41d[_0x3a67('0x44')],{'$or':_[_0x3a67('0x20')](_0xa7f41d[_0x3a67('0x2f')],function(_0x3e1f77){var _0x20e6e4={};_0x20e6e4[_0x3e1f77]={'$like':'%'+_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x47')]+'%'};return _0x20e6e4;})});}if(_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x48')]){var _0xeabbff=_0x55bd20[_0x3a67('0x2c')]['$gte'][_0x3a67('0x49')](',');var _0x417f77={};_0x417f77[_0xeabbff[0x0]]={'$gte':moment(_0xeabbff[0x1])[_0x3a67('0x4a')](_0x3a67('0x4b'))};_0xa7f41d['where']=_[_0x3a67('0x33')](_0xa7f41d[_0x3a67('0x44')],_0x417f77);}_0xa7f41d=_[_0x3a67('0x33')]({},_0xa7f41d,_0x55bd20[_0x3a67('0x34')]);return db[_0x3a67('0x4c')]['count']({'where':_0xa7f41d['where']})[_0x3a67('0x1a')](function(_0x443033){_0x24f703['count']=_0x443033;if(_0x55bd20[_0x3a67('0x2c')]['includeAll']){_0xa7f41d[_0x3a67('0x32')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3a67('0x25')](_0xa7f41d);})[_0x3a67('0x1a')](function(_0x3d3e4a){_0x24f703['rows']=_0x3d3e4a;return _0x24f703;});}})['then'](respondWithFilteredResult(_0x22fe62,_0xa7f41d))[_0x3a67('0x36')](handleError(_0x22fe62,null));};exports[_0x3a67('0x4d')]=function(_0xd69879,_0x451b43){return db[_0x3a67('0x2a')][_0x3a67('0x35')]({'where':{'id':_0xd69879[_0x3a67('0x28')]['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x451b43,null))[_0x3a67('0x1a')](function(_0x51915f){if(_0x51915f){return _0x51915f[_0x3a67('0x4e')](_0xd69879[_0x3a67('0x38')][_0x3a67('0x3c')],_[_0x3a67('0x3b')](_0xd69879[_0x3a67('0x38')],[_0x3a67('0x3c'),'id'])||{})['spread'](function(){return db[_0x3a67('0x4f')][_0x3a67('0x25')]({'attributes':['id',_0x3a67('0x1d'),_0x3a67('0x50')],'where':{'id':_0xd69879['body'][_0x3a67('0x3c')]}});})[_0x3a67('0x1a')](function(_0x1b22a3){socket[_0x3a67('0x51')](_0x3a67('0x52'),{'id':Number(_0xd69879[_0x3a67('0x28')]['id']),'tags':_0x1b22a3||[]});return{'id':Number(_0xd69879[_0x3a67('0x28')]['id']),'tags':_0x1b22a3||[]};});}})['then'](respondWithResult(_0x451b43,null))[_0x3a67('0x36')](handleError(_0x451b43,null));};exports['removeTags']=function(_0x463ad2,_0x1a83ec){return db['WhatsappInteraction'][_0x3a67('0x35')]({'where':{'id':_0x463ad2['params']['id']}})['then'](handleEntityNotFound(_0x1a83ec,null))[_0x3a67('0x1a')](function(_0x323de1){if(_0x323de1){return _0x323de1[_0x3a67('0x53')](_0x463ad2[_0x3a67('0x2c')][_0x3a67('0x3c')]);}})[_0x3a67('0x1a')](respondWithStatusCode(_0x1a83ec,null))[_0x3a67('0x36')](handleError(_0x1a83ec,null));};exports['download']=function(_0x40d725,_0x3e99b3){var _0x467aff=moment()[_0x3a67('0x54')]()[_0x3a67('0x55')]();var _0x30b560=path['join'](config[_0x3a67('0x56')],_0x3a67('0x57'),_0x3a67('0x58'),_0x3a67('0x59'));var _0x52a0cc=path[_0x3a67('0x5a')](config[_0x3a67('0x56')],_0x3a67('0x57'),_0x3a67('0x58'),_0x3a67('0x5b'));var _0x3f393a=path[_0x3a67('0x5a')](_0x30b560,_0x467aff);var _0x36c527=util['format'](_0x3a67('0x5c'),_0x40d725[_0x3a67('0x28')]['id'],_0x467aff);var _0x34c1e8=path['join'](_0x30b560,_0x36c527);var _0x528eca=[];_0x528eca['push']({'model':db[_0x3a67('0x5d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x528eca[_0x3a67('0x5e')]({'model':db[_0x3a67('0x5f')],'as':'Contact','attributes':['id',_0x3a67('0x60'),_0x3a67('0x61')],'raw':!![]});if(_0x40d725['query'][_0x3a67('0x5b')]){_0x528eca['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x293ab1=[{'model':db[_0x3a67('0x4c')],'as':'Messages','attributes':['id',_0x3a67('0x38'),'createdAt','direction',_0x3a67('0x62'),_0x3a67('0x63')],'include':_0x528eca}];_0x293ab1[_0x3a67('0x5e')]({'model':db[_0x3a67('0x64')],'as':_0x3a67('0x65'),'attributes':['id',_0x3a67('0x1d')]});_0x293ab1[_0x3a67('0x5e')]({'model':db[_0x3a67('0x5d')],'as':'Owner','attributes':['id',_0x3a67('0x66')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x40d725[_0x3a67('0x28')]['id']},'include':_0x293ab1})['then'](handleEntityNotFound(_0x3e99b3,null))[_0x3a67('0x1a')](function(_0x5e4ab5){if(_0x5e4ab5){var _0x583dc2=_0x5e4ab5[_0x3a67('0x67')]({'plain':!![]});fs[_0x3a67('0x68')](_0x3f393a);var _0x252e15={'channel':'Whatsapp','account':_0x583dc2[_0x3a67('0x65')][_0x3a67('0x1d')],'agent':_0x583dc2[_0x3a67('0x69')]?_0x583dc2[_0x3a67('0x69')][_0x3a67('0x66')]:'N.A.','createdAt':moment(_0x583dc2[_0x3a67('0x6a')])[_0x3a67('0x4a')](_0x3a67('0x4b'))[_0x3a67('0x55')](),'closedAt':_0x583dc2['closed']?moment(_0x583dc2[_0x3a67('0x6b')])[_0x3a67('0x4a')](_0x3a67('0x4b'))['toString']():'','disposition':_0x583dc2[_0x3a67('0x6c')],'messages':_(_0x583dc2[_0x3a67('0x6d')])[_0x3a67('0x47')]({'secret':![]})[_0x3a67('0x20')](function(_0x1c0496){if(_0x1c0496[_0x3a67('0x6e')]){var _0x3dabcb=path[_0x3a67('0x5a')](_0x52a0cc,_0x1c0496['Attachment'][_0x3a67('0x6f')]);if(fs[_0x3a67('0x70')](_0x3dabcb)){fs['createReadStream'](_0x3dabcb)[_0x3a67('0x71')](fs[_0x3a67('0x72')](path['join'](_0x3f393a,_0x1c0496[_0x3a67('0x6e')]['basename'])));}}return{'date':moment(_0x1c0496['createdAt'])[_0x3a67('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1c0496[_0x3a67('0x73')]==='out'?_0x1c0496[_0x3a67('0x5d')]?_0x1c0496['User']['fullname']:_0x3a67('0x74'):_0x1c0496[_0x3a67('0x75')][_0x3a67('0x60')]+(_0x1c0496[_0x3a67('0x75')]['lastName']?'\x20'+_0x1c0496[_0x3a67('0x75')][_0x3a67('0x61')]:''),'body':_0x1c0496['Attachment']?_0x1c0496[_0x3a67('0x6e')]['basename']:_0x1c0496[_0x3a67('0x38')],'direction':_0x1c0496[_0x3a67('0x73')]==='out'?'A':'C','secret':_0x1c0496['secret'],'read':_0x1c0496[_0x3a67('0x63')],'attachment':_0x1c0496[_0x3a67('0x6e')]};})[_0x3a67('0x76')]()};return ejs[_0x3a67('0x77')](path[_0x3a67('0x5a')](config[_0x3a67('0x56')],_0x3a67('0x57'),_0x3a67('0x78'),_0x3a67('0x79')),{'interaction':_0x252e15})[_0x3a67('0x1a')](function(_0x4878ba){var _0xf2b72e=path[_0x3a67('0x5a')](_0x3f393a,_0x3a67('0x7a')+_0x583dc2['id']+'-'+_0x467aff+_0x3a67('0x7b'));var _0x1c598e={'path':_0xf2b72e,'channel':'Whatsapp','interactionId':_0x583dc2['id']};return pdf[_0x3a67('0x7c')](_0x4878ba,_0x1c598e);})[_0x3a67('0x1a')](function(){return new BPromise(function(_0x3f3637,_0x11932a){zipdir(_0x3f393a,{'saveTo':_0x34c1e8},function(_0x2907c9,_0x2f08ce){if(_0x2907c9)return _0x11932a(_0x2907c9);return _0x3f3637(_0x2f08ce);});})[_0x3a67('0x1a')](function(){return new BPromise(function(_0x3c3277,_0x35df39){rimraf(_0x3f393a,function(_0x11c880){if(_0x11c880)_0x35df39(_0x11c880);return _0x3c3277();});});})[_0x3a67('0x1a')](function(){return _0x3e99b3[_0x3a67('0x7d')](_0x34c1e8,_0x36c527,function(_0xefc882){if(_0xefc882){console[_0x3a67('0x7e')](_0x3a67('0x7f'),_0xefc882);}else{fs['unlinkSync'](_0x34c1e8);}});});});}else{return _0x3e99b3['sendStatus'](0xc8);}})['catch'](handleError(_0x3e99b3,null));}; \ No newline at end of file +var _0xd868=['destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','update','body','describe','WhatsappMessage','addMessage','ids','getMessages','findOne','nolimit','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','views','transcript-','.pdf','log','err','unlinkSync','rimraf','moment','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','then'];(function(_0x15ad72,_0x17d169){var _0x1956fc=function(_0x5485f6){while(--_0x5485f6){_0x15ad72['push'](_0x15ad72['shift']());}};_0x1956fc(++_0x17d169);}(_0xd868,0x1ec));var _0x8d86=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xd868[_0x32d457];return _0x338386;};'use strict';var rimraf=require(_0x8d86('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8d86('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x8d86('0x2'));var ejs=require(_0x8d86('0x3'));var fs=require('fs');var _=require(_0x8d86('0x4'));var Redis=require('ioredis');var interaction=require(_0x8d86('0x5'));var qs=require(_0x8d86('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x8d86('0x7'))(_0x8d86('0x8'));var config=require(_0x8d86('0x9'));var db=require(_0x8d86('0xa'))['db'];config[_0x8d86('0xb')]=_[_0x8d86('0xc')](config[_0x8d86('0xb')],{'host':_0x8d86('0xd'),'port':0x18eb});var socket=require(_0x8d86('0xe'))(new Redis(config[_0x8d86('0xb')]));require(_0x8d86('0xf'))[_0x8d86('0x10')](socket);function respondWithStatusCode(_0x963eb8,_0xe8c382){_0xe8c382=_0xe8c382||0xcc;return function(_0xff34a6){if(_0xff34a6){return _0x963eb8[_0x8d86('0x11')](_0xe8c382);}return _0x963eb8[_0x8d86('0x12')](_0xe8c382)[_0x8d86('0x13')]();};}function respondWithResult(_0x57bfcf,_0x3dc834){_0x3dc834=_0x3dc834||0xc8;return function(_0x10c236){if(_0x10c236){return _0x57bfcf[_0x8d86('0x12')](_0x3dc834)['json'](_0x10c236);}};}function respondWithFilteredResult(_0x5d348a,_0x1f12df){return function(_0x454972){if(_0x454972){var _0x371c0b=typeof _0x1f12df[_0x8d86('0x14')]===_0x8d86('0x15')&&typeof _0x1f12df[_0x8d86('0x16')]==='undefined';var _0xb86a5b=_0x454972[_0x8d86('0x17')];var _0x37423b=_0x371c0b?0x0:_0x1f12df[_0x8d86('0x14')];var _0x58dde6=_0x371c0b?_0x454972[_0x8d86('0x17')]:_0x1f12df[_0x8d86('0x14')]+_0x1f12df[_0x8d86('0x16')];var _0x5f259e;if(_0x58dde6>=_0xb86a5b){_0x58dde6=_0xb86a5b;_0x5f259e=0xc8;}else{_0x5f259e=0xce;}_0x5d348a[_0x8d86('0x12')](_0x5f259e);return _0x5d348a[_0x8d86('0x18')](_0x8d86('0x19'),_0x37423b+'-'+_0x58dde6+'/'+_0xb86a5b)[_0x8d86('0x1a')](_0x454972);}return null;};}function saveUpdates(_0xfd211b){return function(_0x5b67a3){if(_0x5b67a3){return _0x5b67a3['update'](_0xfd211b)[_0x8d86('0x1b')](function(_0x4c626d){return _0x4c626d;});}return null;};}function removeEntity(_0xba33a1){return function(_0x5ba190){if(_0x5ba190){return _0x5ba190[_0x8d86('0x1c')]()['then'](function(){_0xba33a1[_0x8d86('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b375f){return function(_0x3f0c80){if(!_0x3f0c80){_0x1b375f[_0x8d86('0x11')](0x194);}return _0x3f0c80;};}function handleError(_0x54801c,_0x479646){_0x479646=_0x479646||0x1f4;return function(_0x107081){logger[_0x8d86('0x1d')](_0x107081[_0x8d86('0x1e')]);if(_0x107081['name']){delete _0x107081[_0x8d86('0x1f')];}_0x54801c[_0x8d86('0x12')](_0x479646)[_0x8d86('0x20')](_0x107081);};}exports[_0x8d86('0x21')]=function(_0x4414a4,_0x49b3be){var _0x2033f5={};var _0x1283e0=_[_0x8d86('0x22')](db[_0x8d86('0x23')][_0x8d86('0x24')],function(_0x43069e){return{'name':_0x43069e[_0x8d86('0x25')],'type':_0x43069e['type'][_0x8d86('0x26')]};});_0x2033f5=qs[_0x8d86('0x27')](_0x1283e0,_0x4414a4);return interaction[_0x8d86('0x28')]('whatsapp',_0x4414a4[_0x8d86('0x29')],_0x4414a4[_0x8d86('0x2a')],_0x2033f5,_0x1283e0)['then'](respondWithFilteredResult(_0x49b3be,_0x2033f5))[_0x8d86('0x2b')](handleError(_0x49b3be,null));};exports[_0x8d86('0x2c')]=function(_0x296574,_0x5f2313){var _0x3e9d9c={'raw':![],'where':{'id':_0x296574[_0x8d86('0x2d')]['id']}},_0x4ab109={};_0x4ab109[_0x8d86('0x2e')]=_[_0x8d86('0x2f')](db[_0x8d86('0x23')][_0x8d86('0x24')]);_0x4ab109['query']=_[_0x8d86('0x2f')](_0x296574[_0x8d86('0x29')]);_0x4ab109[_0x8d86('0x30')]=_[_0x8d86('0x31')](_0x4ab109[_0x8d86('0x2e')],_0x4ab109[_0x8d86('0x29')]);_0x3e9d9c[_0x8d86('0x32')]=_['intersection'](_0x4ab109[_0x8d86('0x2e')],qs[_0x8d86('0x33')](_0x296574[_0x8d86('0x29')][_0x8d86('0x33')]));_0x3e9d9c[_0x8d86('0x32')]=_0x3e9d9c[_0x8d86('0x32')][_0x8d86('0x34')]?_0x3e9d9c[_0x8d86('0x32')]:_0x4ab109[_0x8d86('0x2e')];if(_0x296574[_0x8d86('0x29')][_0x8d86('0x35')]){_0x3e9d9c['include']=[{'all':!![]}];}_0x3e9d9c=_[_0x8d86('0x36')]({},_0x3e9d9c,_0x296574[_0x8d86('0x37')]);return db[_0x8d86('0x23')][_0x8d86('0x38')](_0x3e9d9c)[_0x8d86('0x1b')](handleEntityNotFound(_0x5f2313,null))['then'](respondWithResult(_0x5f2313,null))[_0x8d86('0x2b')](handleError(_0x5f2313,null));};exports['create']=function(_0x5f458e,_0x1387a4){return db[_0x8d86('0x23')][_0x8d86('0x39')](_0x5f458e['body'],{})['then'](respondWithResult(_0x1387a4,0xc9))[_0x8d86('0x2b')](handleError(_0x1387a4,null));};exports[_0x8d86('0x3a')]=function(_0x489ab2,_0x26f329){if(_0x489ab2['body']['id']){delete _0x489ab2[_0x8d86('0x3b')]['id'];}return db['WhatsappInteraction'][_0x8d86('0x38')]({'where':{'id':_0x489ab2[_0x8d86('0x2d')]['id']}})[_0x8d86('0x1b')](handleEntityNotFound(_0x26f329,null))[_0x8d86('0x1b')](saveUpdates(_0x489ab2[_0x8d86('0x3b')],null))['then'](respondWithResult(_0x26f329,null))[_0x8d86('0x2b')](handleError(_0x26f329,null));};exports[_0x8d86('0x1c')]=function(_0x552392,_0x1f1261){return db[_0x8d86('0x23')][_0x8d86('0x38')]({'where':{'id':_0x552392[_0x8d86('0x2d')]['id']}})[_0x8d86('0x1b')](handleEntityNotFound(_0x1f1261,null))[_0x8d86('0x1b')](removeEntity(_0x1f1261,null))['catch'](handleError(_0x1f1261,null));};exports['describe']=function(_0x45c4a1,_0x3d2aa2){return db[_0x8d86('0x23')][_0x8d86('0x3c')]()[_0x8d86('0x1b')](respondWithResult(_0x3d2aa2,null))['catch'](handleError(_0x3d2aa2,null));};exports['addMessage']=function(_0x4cd248,_0x1ef492){return db[_0x8d86('0x3d')]['find']({'where':{'id':_0x4cd248[_0x8d86('0x2d')]['id']}})[_0x8d86('0x1b')](handleEntityNotFound(_0x1ef492,null))[_0x8d86('0x1b')](function(_0x4801d2){if(_0x4801d2){return _0x4801d2[_0x8d86('0x3e')](_0x4cd248[_0x8d86('0x3b')][_0x8d86('0x3f')],_['omit'](_0x4cd248[_0x8d86('0x3b')],[_0x8d86('0x3f'),'id'])||{});}})[_0x8d86('0x1b')](respondWithResult(_0x1ef492,null))['catch'](handleError(_0x1ef492,null));};exports[_0x8d86('0x40')]=function(_0x351426,_0x43f4d2){var _0x29d522={'raw':![],'where':{}};var _0x36a0a8={};var _0x4e89c3={'count':0x0,'rows':[]};return db[_0x8d86('0x23')][_0x8d86('0x41')]({'where':{'id':_0x351426[_0x8d86('0x2d')]['id']}})[_0x8d86('0x1b')](handleEntityNotFound(_0x43f4d2,null))['then'](function(_0x57b1e0){if(_0x57b1e0){_0x36a0a8['model']=_['keys'](db[_0x8d86('0x3d')][_0x8d86('0x24')]);_0x36a0a8['query']=_[_0x8d86('0x2f')](_0x351426[_0x8d86('0x29')]);_0x36a0a8[_0x8d86('0x30')]=_['intersection'](_0x36a0a8[_0x8d86('0x2e')],_0x36a0a8[_0x8d86('0x29')]);_0x29d522['attributes']=_[_0x8d86('0x31')](_0x36a0a8[_0x8d86('0x2e')],qs[_0x8d86('0x33')](_0x351426[_0x8d86('0x29')][_0x8d86('0x33')]));_0x29d522[_0x8d86('0x32')]=_0x29d522[_0x8d86('0x32')][_0x8d86('0x34')]?_0x29d522[_0x8d86('0x32')]:_0x36a0a8['model'];if(!_0x351426[_0x8d86('0x29')]['hasOwnProperty'](_0x8d86('0x42'))){_0x29d522['limit']=qs[_0x8d86('0x16')](_0x351426[_0x8d86('0x29')]['limit']);_0x29d522[_0x8d86('0x14')]=qs[_0x8d86('0x14')](_0x351426[_0x8d86('0x29')][_0x8d86('0x14')]);}_0x29d522['order']=qs[_0x8d86('0x43')](_0x351426[_0x8d86('0x29')][_0x8d86('0x43')]);_0x29d522[_0x8d86('0x44')]=qs[_0x8d86('0x30')](_[_0x8d86('0x45')](_0x351426['query'],_0x36a0a8[_0x8d86('0x30')]));_0x29d522['where']['WhatsappInteractionId']=_0x57b1e0['id'];if(_0x351426[_0x8d86('0x29')]['filter']){_0x29d522['where']=_[_0x8d86('0x36')](_0x29d522[_0x8d86('0x44')],{'$or':_[_0x8d86('0x22')](_0x29d522['attributes'],function(_0x59425e){var _0x2a7947={};_0x2a7947[_0x59425e]={'$like':'%'+_0x351426[_0x8d86('0x29')][_0x8d86('0x46')]+'%'};return _0x2a7947;})});}if(_0x351426[_0x8d86('0x29')][_0x8d86('0x47')]){var _0x5601c6=_0x351426[_0x8d86('0x29')][_0x8d86('0x47')][_0x8d86('0x48')](',');var _0x659f2d={};_0x659f2d[_0x5601c6[0x0]]={'$gte':moment(_0x5601c6[0x1])[_0x8d86('0x49')](_0x8d86('0x4a'))};_0x29d522[_0x8d86('0x44')]=_[_0x8d86('0x36')](_0x29d522[_0x8d86('0x44')],_0x659f2d);}_0x29d522=_[_0x8d86('0x36')]({},_0x29d522,_0x351426[_0x8d86('0x37')]);return db[_0x8d86('0x3d')][_0x8d86('0x17')]({'where':_0x29d522['where']})[_0x8d86('0x1b')](function(_0x10bec3){_0x4e89c3['count']=_0x10bec3;if(_0x351426[_0x8d86('0x29')]['includeAll']){_0x29d522[_0x8d86('0x4b')]=[{'all':!![]}];}return db[_0x8d86('0x3d')][_0x8d86('0x28')](_0x29d522);})[_0x8d86('0x1b')](function(_0x3fcf56){_0x4e89c3[_0x8d86('0x4c')]=_0x3fcf56;return _0x4e89c3;});}})[_0x8d86('0x1b')](respondWithFilteredResult(_0x43f4d2,_0x29d522))['catch'](handleError(_0x43f4d2,null));};exports[_0x8d86('0x4d')]=function(_0x1316d9,_0x344436){return db[_0x8d86('0x23')][_0x8d86('0x38')]({'where':{'id':_0x1316d9[_0x8d86('0x2d')]['id']}})[_0x8d86('0x1b')](handleEntityNotFound(_0x344436,null))[_0x8d86('0x1b')](function(_0x2f4d27){if(_0x2f4d27){return _0x2f4d27[_0x8d86('0x4e')](_0x1316d9[_0x8d86('0x3b')][_0x8d86('0x3f')],_['omit'](_0x1316d9['body'],[_0x8d86('0x3f'),'id'])||{})['spread'](function(){return db[_0x8d86('0x4f')]['findAll']({'attributes':['id',_0x8d86('0x1f'),_0x8d86('0x50')],'where':{'id':_0x1316d9['body']['ids']}});})['then'](function(_0x1f58ff){socket[_0x8d86('0x51')](_0x8d86('0x52'),{'id':Number(_0x1316d9['params']['id']),'tags':_0x1f58ff||[]});return{'id':Number(_0x1316d9[_0x8d86('0x2d')]['id']),'tags':_0x1f58ff||[]};});}})[_0x8d86('0x1b')](respondWithResult(_0x344436,null))[_0x8d86('0x2b')](handleError(_0x344436,null));};exports[_0x8d86('0x53')]=function(_0x3e3a8a,_0x16eade){return db['WhatsappInteraction']['find']({'where':{'id':_0x3e3a8a[_0x8d86('0x2d')]['id']}})[_0x8d86('0x1b')](handleEntityNotFound(_0x16eade,null))[_0x8d86('0x1b')](function(_0xd4be0c){if(_0xd4be0c){return _0xd4be0c['removeTags'](_0x3e3a8a[_0x8d86('0x29')][_0x8d86('0x3f')]);}})['then'](respondWithStatusCode(_0x16eade,null))['catch'](handleError(_0x16eade,null));};exports[_0x8d86('0x54')]=function(_0x59b692,_0x338e86){var _0x2cb4ef=moment()[_0x8d86('0x55')]()[_0x8d86('0x56')]();var _0x1aa60b=path[_0x8d86('0x57')](config[_0x8d86('0x58')],_0x8d86('0x59'),_0x8d86('0x5a'),_0x8d86('0x5b'));var _0x43cc63=path[_0x8d86('0x57')](config[_0x8d86('0x58')],_0x8d86('0x59'),_0x8d86('0x5a'),_0x8d86('0x5c'));var _0x534a03=path[_0x8d86('0x57')](_0x1aa60b,_0x2cb4ef);var _0x4e4ccf=util[_0x8d86('0x49')](_0x8d86('0x5d'),_0x59b692[_0x8d86('0x2d')]['id'],_0x2cb4ef);var _0x521ccf=path['join'](_0x1aa60b,_0x4e4ccf);var _0x1deb28=[];_0x1deb28[_0x8d86('0x5e')]({'model':db[_0x8d86('0x5f')],'as':_0x8d86('0x5f'),'attributes':['id','fullname'],'raw':!![]});_0x1deb28[_0x8d86('0x5e')]({'model':db[_0x8d86('0x60')],'as':_0x8d86('0x61'),'attributes':['id',_0x8d86('0x62'),_0x8d86('0x63')],'raw':!![]});if(_0x59b692['query'][_0x8d86('0x5c')]){_0x1deb28[_0x8d86('0x5e')]({'model':db[_0x8d86('0x64')],'as':_0x8d86('0x64'),'raw':!![]});}var _0x47385b=[{'model':db['WhatsappMessage'],'as':_0x8d86('0x65'),'attributes':['id','body',_0x8d86('0x66'),_0x8d86('0x67'),'secret',_0x8d86('0x68')],'include':_0x1deb28}];_0x47385b[_0x8d86('0x5e')]({'model':db[_0x8d86('0x69')],'as':_0x8d86('0x6a'),'attributes':['id',_0x8d86('0x1f')]});_0x47385b[_0x8d86('0x5e')]({'model':db['User'],'as':_0x8d86('0x6b'),'attributes':['id',_0x8d86('0x6c')]});return db[_0x8d86('0x23')][_0x8d86('0x38')]({'where':{'id':_0x59b692[_0x8d86('0x2d')]['id']},'include':_0x47385b})[_0x8d86('0x1b')](handleEntityNotFound(_0x338e86,null))['then'](function(_0x15223e){if(_0x15223e){var _0x576e09=_0x15223e[_0x8d86('0x6d')]({'plain':!![]});fs[_0x8d86('0x6e')](_0x534a03);var _0x3050cc={'channel':_0x8d86('0x6f'),'account':_0x576e09[_0x8d86('0x6a')][_0x8d86('0x1f')],'agent':_0x576e09[_0x8d86('0x6b')]?_0x576e09[_0x8d86('0x6b')][_0x8d86('0x6c')]:_0x8d86('0x70'),'createdAt':moment(_0x576e09['createdAt'])['format'](_0x8d86('0x4a'))[_0x8d86('0x56')](),'closedAt':_0x576e09[_0x8d86('0x71')]?moment(_0x576e09[_0x8d86('0x72')])['format'](_0x8d86('0x4a'))[_0x8d86('0x56')]():'','disposition':_0x576e09['disposition'],'messages':_(_0x576e09[_0x8d86('0x65')])[_0x8d86('0x46')]({'secret':![]})['map'](function(_0x37abd8){if(_0x37abd8[_0x8d86('0x64')]){var _0x56bbe8=path[_0x8d86('0x57')](_0x43cc63,_0x37abd8[_0x8d86('0x64')][_0x8d86('0x73')]);if(fs[_0x8d86('0x74')](_0x56bbe8)){fs[_0x8d86('0x75')](_0x56bbe8)[_0x8d86('0x76')](fs[_0x8d86('0x77')](path[_0x8d86('0x57')](_0x534a03,_0x37abd8['Attachment'][_0x8d86('0x73')])));}}return{'date':moment(_0x37abd8['createdAt'])[_0x8d86('0x49')](_0x8d86('0x4a'))[_0x8d86('0x56')](),'sender':_0x37abd8[_0x8d86('0x67')]===_0x8d86('0x78')?_0x37abd8[_0x8d86('0x5f')]?_0x37abd8[_0x8d86('0x5f')][_0x8d86('0x6c')]:_0x8d86('0x79'):_0x37abd8['Contact'][_0x8d86('0x62')]+(_0x37abd8[_0x8d86('0x61')][_0x8d86('0x63')]?'\x20'+_0x37abd8[_0x8d86('0x61')][_0x8d86('0x63')]:''),'body':_0x37abd8[_0x8d86('0x64')]?_0x37abd8['Attachment'][_0x8d86('0x73')]:_0x37abd8[_0x8d86('0x3b')],'direction':_0x37abd8[_0x8d86('0x67')]===_0x8d86('0x78')?'A':'C','secret':_0x37abd8['secret'],'read':_0x37abd8[_0x8d86('0x68')],'attachment':_0x37abd8[_0x8d86('0x64')]};})[_0x8d86('0x7a')]()};return ejs[_0x8d86('0x7b')](path[_0x8d86('0x57')](config[_0x8d86('0x58')],_0x8d86('0x59'),_0x8d86('0x7c'),'downloadInteraction.ejs'),{'interaction':_0x3050cc})['then'](function(_0x5139fd){var _0x328a0f=path[_0x8d86('0x57')](_0x534a03,_0x8d86('0x7d')+_0x576e09['id']+'-'+_0x2cb4ef+_0x8d86('0x7e'));var _0x18c463={'path':_0x328a0f,'channel':_0x8d86('0x6f'),'interactionId':_0x576e09['id']};return pdf['createPdfFromHTML'](_0x5139fd,_0x18c463);})[_0x8d86('0x1b')](function(){return new BPromise(function(_0x263259,_0xf55e2a){zipdir(_0x534a03,{'saveTo':_0x521ccf},function(_0x2bfbff,_0x4b5897){if(_0x2bfbff)return _0xf55e2a(_0x2bfbff);return _0x263259(_0x4b5897);});})[_0x8d86('0x1b')](function(){return new BPromise(function(_0x6e434a,_0x339572){rimraf(_0x534a03,function(_0x3c2516){if(_0x3c2516)_0x339572(_0x3c2516);return _0x6e434a();});});})[_0x8d86('0x1b')](function(){return _0x338e86[_0x8d86('0x54')](_0x521ccf,_0x4e4ccf,function(_0x149926){if(_0x149926){console[_0x8d86('0x7f')](_0x8d86('0x80'),_0x149926);}else{fs[_0x8d86('0x81')](_0x521ccf);}});});});}else{return _0x338e86[_0x8d86('0x11')](0xc8);}})[_0x8d86('0x2b')](handleError(_0x338e86,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f503db4..9ca2507 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 _0x76a3=['getUsers','then','Users','map','findAll','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x56b913,_0x3ddf4e){var _0x4d2bcf=function(_0x5994db){while(--_0x5994db){_0x56b913['push'](_0x56b913['shift']());}};_0x4d2bcf(++_0x3ddf4e);}(_0x76a3,0xf8));var _0x376a=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x76a3[_0x254b22];return _0x1279db;};'use strict';var EventEmitter=require(_0x376a('0x0'));var WhatsappInteraction=require(_0x376a('0x1'))['db'][_0x376a('0x2')];var WhatsappMessage=require(_0x376a('0x1'))['db'][_0x376a('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x376a('0x4')](0x0);var events={'afterCreate':_0x376a('0x5'),'afterUpdate':_0x376a('0x6'),'afterDestroy':_0x376a('0x7')};function emitEvent(_0x17f183){return function(_0x5b2249,_0x50b7b3,_0x19ea68){_0x5b2249[_0x376a('0x8')]({'attributes':['id'],'raw':!![]})[_0x376a('0x9')](function(_0x3cb57e){_0x5b2249['setDataValue'](_0x376a('0xa'),_0x3cb57e[_0x376a('0xb')](function(_0x249623){return{'id':_0x249623['id']};}));return WhatsappMessage[_0x376a('0xc')]({'where':{'WhatsappInteractionId':_0x5b2249['id'],'direction':'in','read':![]},'raw':!![]});})[_0x376a('0x9')](function(_0x15286f){_0x5b2249['setDataValue']('unreadMessages',_0x15286f['length']);WhatsappInteractionEvents[_0x376a('0xd')](_0x17f183+':'+_0x5b2249['id'],_0x5b2249);WhatsappInteractionEvents[_0x376a('0xd')](_0x17f183,_0x5b2249);_0x19ea68(null);})['catch'](_0x19ea68(null));};}for(var e in events){if(events[_0x376a('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x376a('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x878f=['remove','then','setDataValue','unreadMessages','emit','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update'];(function(_0x32af68,_0x2496e7){var _0x1ed280=function(_0x4a4013){while(--_0x4a4013){_0x32af68['push'](_0x32af68['shift']());}};_0x1ed280(++_0x2496e7);}(_0x878f,0x173));var _0xf878=function(_0x45dc00,_0x30b94f){_0x45dc00=_0x45dc00-0x0;var _0x24e3f7=_0x878f[_0x45dc00];return _0x24e3f7;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var WhatsappMessage=require(_0xf878('0x0'))['db'][_0xf878('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf878('0x3')](0x0);var events={'afterCreate':_0xf878('0x4'),'afterUpdate':_0xf878('0x5'),'afterDestroy':_0xf878('0x6')};function emitEvent(_0x240b48){return function(_0xcf1927,_0x27ae4d,_0x4bc9aa){_0xcf1927['getUsers']({'attributes':['id'],'raw':!![]})[_0xf878('0x7')](function(_0x62b420){_0xcf1927['setDataValue']('Users',_0x62b420['map'](function(_0x3329df){return{'id':_0x3329df['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xcf1927['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x307653){_0xcf1927[_0xf878('0x8')](_0xf878('0x9'),_0x307653['length']);WhatsappInteractionEvents[_0xf878('0xa')](_0x240b48+':'+_0xcf1927['id'],_0xcf1927);WhatsappInteractionEvents[_0xf878('0xa')](_0x240b48,_0xcf1927);_0x4bc9aa(null);})['catch'](_0x4bc9aa(null));};}for(var e in events){if(events[_0xf878('0xb')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf878('0xc')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 252554e..9f3631f 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 _0x3eae=['bluebird','request-promise','path','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api'];(function(_0x11029d,_0x342076){var _0x19d5e8=function(_0x38ba86){while(--_0x38ba86){_0x11029d['push'](_0x11029d['shift']());}};_0x19d5e8(++_0x342076);}(_0x3eae,0x66));var _0xe3ea=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x3eae[_0x24f326];return _0x488e2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3ea('0x0'))(_0xe3ea('0x1'));var moment=require('moment');var BPromise=require(_0xe3ea('0x2'));var rp=require(_0xe3ea('0x3'));var fs=require('fs');var path=require(_0xe3ea('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3ea('0x5'));module[_0xe3ea('0x6')]=function(_0x5a6fba,_0x271dff){return _0x5a6fba[_0xe3ea('0x7')]('WhatsappInteraction',attributes,{'tableName':_0xe3ea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47f24d,_0x42e89f,_0x3bed63){if(_0x47f24d[_0xe3ea('0x9')]('closed')){_0x47f24d[_0xe3ea('0xa')]=moment()[_0xe3ea('0xb')](_0xe3ea('0xc'));}_0x3bed63(null,_0x47f24d);}}});}; \ No newline at end of file +var _0x2e13=['changed','closed','closedAt','format','lodash','../../config/logger','moment','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x2e13,0x1b7));var _0x32e1=function(_0x2f41b0,_0x2984a8){_0x2f41b0=_0x2f41b0-0x0;var _0x55396b=_0x2e13[_0x2f41b0];return _0x55396b;};'use strict';var _=require(_0x32e1('0x0'));var util=require('util');var logger=require(_0x32e1('0x1'))('api');var moment=require(_0x32e1('0x2'));var BPromise=require('bluebird');var rp=require(_0x32e1('0x3'));var fs=require('fs');var path=require(_0x32e1('0x4'));var rimraf=require('rimraf');var config=require(_0x32e1('0x5'));var attributes=require(_0x32e1('0x6'));module[_0x32e1('0x7')]=function(_0x378dbe,_0x3815d8){return _0x378dbe[_0x32e1('0x8')](_0x32e1('0x9'),attributes,{'tableName':_0x32e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2577a4,_0x11b47d,_0x2532b8){if(_0x2577a4[_0x32e1('0xb')](_0x32e1('0xc'))){_0x2577a4[_0x32e1('0xd')]=moment()[_0x32e1('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2532b8(null,_0x2577a4);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9462f82..cfe24ce 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 _0xd667=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3414c2,_0x1d81f9){var _0x4db52e=function(_0x26c9c7){while(--_0x26c9c7){_0x3414c2['push'](_0x3414c2['shift']());}};_0x4db52e(++_0x1d81f9);}(_0xd667,0x187));var _0x7d66=function(_0x428496,_0x12e5a6){_0x428496=_0x428496-0x0;var _0x396ff1=_0xd667[_0x428496];return _0x396ff1;};'use strict';var _=require(_0x7d66('0x0'));var util=require(_0x7d66('0x1'));var moment=require(_0x7d66('0x2'));var BPromise=require(_0x7d66('0x3'));var rs=require(_0x7d66('0x4'));var fs=require('fs');var Redis=require(_0x7d66('0x5'));var db=require(_0x7d66('0x6'))['db'];var utils=require(_0x7d66('0x7'));var logger=require(_0x7d66('0x8'))(_0x7d66('0x9'));var config=require(_0x7d66('0xa'));var jayson=require(_0x7d66('0xb'));var client=jayson[_0x7d66('0xc')][_0x7d66('0xd')]({'port':0x232a});config[_0x7d66('0xe')]=_[_0x7d66('0xf')](config[_0x7d66('0xe')],{'host':_0x7d66('0x10'),'port':0x18eb});var socket=require(_0x7d66('0x11'))(new Redis(config[_0x7d66('0xe')]));require('./whatsappInteraction.socket')[_0x7d66('0x12')](socket);function respondWithRpcPromise(_0x30db65,_0x144cf4,_0x22ee96){return new BPromise(function(_0x2d4992,_0x25781b){return client[_0x7d66('0x13')](_0x30db65,_0x22ee96)[_0x7d66('0x14')](function(_0x4a9b39){logger[_0x7d66('0x15')](_0x7d66('0x16'),_0x144cf4,_0x7d66('0x17'));logger[_0x7d66('0x18')](_0x7d66('0x19'),_0x144cf4,_0x7d66('0x17'),JSON['stringify'](_0x4a9b39));if(_0x4a9b39[_0x7d66('0x1a')]){if(_0x4a9b39[_0x7d66('0x1a')][_0x7d66('0x1b')]===0x1f4){logger['error'](_0x7d66('0x16'),_0x144cf4,_0x4a9b39['error']['message']);return _0x25781b(_0x4a9b39[_0x7d66('0x1a')][_0x7d66('0x1c')]);}logger[_0x7d66('0x1a')](_0x7d66('0x16'),_0x144cf4,_0x4a9b39['error'][_0x7d66('0x1c')]);return _0x2d4992(_0x4a9b39['error']['message']);}else{logger[_0x7d66('0x15')](_0x7d66('0x16'),_0x144cf4,_0x7d66('0x17'));_0x2d4992(_0x4a9b39[_0x7d66('0x1d')][_0x7d66('0x1c')]);}})[_0x7d66('0x1e')](function(_0x19a707){logger['error'](_0x7d66('0x16'),_0x144cf4,_0x19a707);_0x25781b(_0x19a707);});});}exports[_0x7d66('0x1f')]=function(_0x4f7bc7){var _0x5920fb=this;return new Promise(function(_0x9fff4,_0xbc12b){return db['WhatsappInteraction'][_0x7d66('0x20')](_0x4f7bc7[_0x7d66('0x21')],{'raw':_0x4f7bc7[_0x7d66('0x22')]?_0x4f7bc7[_0x7d66('0x22')][_0x7d66('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7bc7[_0x7d66('0x22')]?_0x4f7bc7[_0x7d66('0x22')][_0x7d66('0x24')]||null:null,'attributes':_0x4f7bc7['options']?_0x4f7bc7['options'][_0x7d66('0x25')]||null:null,'limit':_0x4f7bc7[_0x7d66('0x22')]?_0x4f7bc7['options'][_0x7d66('0x26')]||null:null})[_0x7d66('0x14')](function(_0x20106a){logger[_0x7d66('0x15')](_0x7d66('0x1f'),_0x4f7bc7);logger[_0x7d66('0x18')]('UpdateWhatsappInteraction',_0x4f7bc7,JSON['stringify'](_0x20106a));_0x9fff4(_0x20106a);})[_0x7d66('0x1e')](function(_0x13417c){logger[_0x7d66('0x1a')](_0x7d66('0x1f'),_0x13417c['message'],_0x4f7bc7);_0xbc12b(_0x5920fb[_0x7d66('0x1a')](0x1f4,_0x13417c['message']));});});};exports[_0x7d66('0x27')]=function(_0x48fc9c){return new Promise(function(_0x9f212,_0x49ebb0){return db[_0x7d66('0x28')]['find']({'where':_0x48fc9c['options']?_0x48fc9c[_0x7d66('0x22')][_0x7d66('0x24')]||null:null})['then'](function(_0x3209ab){if(_0x3209ab){return _0x3209ab['addTags'](_0x48fc9c[_0x7d66('0x21')][_0x7d66('0x29')],_[_0x7d66('0x2a')](_0x48fc9c['body'],['ids','id'])||{});}})[_0x7d66('0x2b')](function(_0x2d5f9f){logger[_0x7d66('0x15')](_0x7d66('0x2c'),_0x48fc9c);logger['debug'](_0x7d66('0x2c'),_0x48fc9c,JSON['stringify'](_0x2d5f9f));_0x9f212(_0x2d5f9f);})[_0x7d66('0x1e')](function(_0x1ce09f){logger[_0x7d66('0x1a')](_0x7d66('0x2c'),_0x1ce09f[_0x7d66('0x1c')],_0x48fc9c);_0x49ebb0(_this['error'](0x1f4,_0x1ce09f['message']));});});}; \ No newline at end of file +var _0x2518=['addTags','omit','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','WhatsappInteraction','find'];(function(_0x506d58,_0x52939b){var _0x2e69f3=function(_0x3515dd){while(--_0x3515dd){_0x506d58['push'](_0x506d58['shift']());}};_0x2e69f3(++_0x52939b);}(_0x2518,0xe7));var _0x8251=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2518[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8251('0x0'));var util=require('util');var moment=require(_0x8251('0x1'));var BPromise=require(_0x8251('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8251('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8251('0x4'));var logger=require(_0x8251('0x5'))(_0x8251('0x6'));var config=require(_0x8251('0x7'));var jayson=require(_0x8251('0x8'));var client=jayson['client'][_0x8251('0x9')]({'port':0x232a});config[_0x8251('0xa')]=_[_0x8251('0xb')](config[_0x8251('0xa')],{'host':_0x8251('0xc'),'port':0x18eb});var socket=require(_0x8251('0xd'))(new Redis(config['redis']));require(_0x8251('0xe'))[_0x8251('0xf')](socket);function respondWithRpcPromise(_0x391723,_0x1423a7,_0x20f5de){return new BPromise(function(_0x1219f4,_0x3950bc){return client['request'](_0x391723,_0x20f5de)[_0x8251('0x10')](function(_0x2836c8){logger[_0x8251('0x11')](_0x8251('0x12'),_0x1423a7,_0x8251('0x13'));logger[_0x8251('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1423a7,_0x8251('0x13'),JSON[_0x8251('0x15')](_0x2836c8));if(_0x2836c8[_0x8251('0x16')]){if(_0x2836c8[_0x8251('0x16')][_0x8251('0x17')]===0x1f4){logger[_0x8251('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x1423a7,_0x2836c8[_0x8251('0x16')]['message']);return _0x3950bc(_0x2836c8[_0x8251('0x16')][_0x8251('0x18')]);}logger['error'](_0x8251('0x12'),_0x1423a7,_0x2836c8['error'][_0x8251('0x18')]);return _0x1219f4(_0x2836c8['error'][_0x8251('0x18')]);}else{logger[_0x8251('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x1423a7,_0x8251('0x13'));_0x1219f4(_0x2836c8[_0x8251('0x19')]['message']);}})[_0x8251('0x1a')](function(_0x3c7f71){logger['error'](_0x8251('0x12'),_0x1423a7,_0x3c7f71);_0x3950bc(_0x3c7f71);});});}exports[_0x8251('0x1b')]=function(_0xd5e6dc){var _0x3284a6=this;return new Promise(function(_0x14b990,_0x22cf00){return db['WhatsappInteraction'][_0x8251('0x1c')](_0xd5e6dc[_0x8251('0x1d')],{'raw':_0xd5e6dc[_0x8251('0x1e')]?_0xd5e6dc[_0x8251('0x1e')][_0x8251('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd5e6dc[_0x8251('0x1e')]?_0xd5e6dc[_0x8251('0x1e')][_0x8251('0x20')]||null:null,'attributes':_0xd5e6dc[_0x8251('0x1e')]?_0xd5e6dc[_0x8251('0x1e')]['attributes']||null:null,'limit':_0xd5e6dc[_0x8251('0x1e')]?_0xd5e6dc['options']['limit']||null:null})[_0x8251('0x10')](function(_0x1bcffc){logger[_0x8251('0x11')]('UpdateWhatsappInteraction',_0xd5e6dc);logger['debug'](_0x8251('0x1b'),_0xd5e6dc,JSON[_0x8251('0x15')](_0x1bcffc));_0x14b990(_0x1bcffc);})[_0x8251('0x1a')](function(_0x43c820){logger[_0x8251('0x16')](_0x8251('0x1b'),_0x43c820[_0x8251('0x18')],_0xd5e6dc);_0x22cf00(_0x3284a6[_0x8251('0x16')](0x1f4,_0x43c820['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x500364){return new Promise(function(_0x146102,_0x51ee64){return db[_0x8251('0x21')][_0x8251('0x22')]({'where':_0x500364[_0x8251('0x1e')]?_0x500364['options']['where']||null:null})[_0x8251('0x10')](function(_0x5a9942){if(_0x5a9942){return _0x5a9942[_0x8251('0x23')](_0x500364[_0x8251('0x1d')]['ids'],_[_0x8251('0x24')](_0x500364[_0x8251('0x1d')],['ids','id'])||{});}})['spread'](function(_0x2c5307){logger[_0x8251('0x11')](_0x8251('0x25'),_0x500364);logger['debug'](_0x8251('0x25'),_0x500364,JSON[_0x8251('0x15')](_0x2c5307));_0x146102(_0x2c5307);})[_0x8251('0x1a')](function(_0x376c4c){logger[_0x8251('0x16')](_0x8251('0x25'),_0x376c4c[_0x8251('0x18')],_0x500364);_0x51ee64(_this[_0x8251('0x16')](0x1f4,_0x376c4c[_0x8251('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5ea8a98..05f1014 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 _0xd384=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x5aa860,_0x132e3b){var _0x30de9e=function(_0x2979f0){while(--_0x2979f0){_0x5aa860['push'](_0x5aa860['shift']());}};_0x30de9e(++_0x132e3b);}(_0xd384,0x95));var _0x4d38=function(_0x2f9949,_0x408bfb){_0x2f9949=_0x2f9949-0x0;var _0x37e6d0=_0xd384[_0x2f9949];return _0x37e6d0;};'use strict';var WhatsappInteractionEvents=require(_0x4d38('0x0'));var events=[_0x4d38('0x1'),_0x4d38('0x2'),'update'];function createListener(_0x27d489,_0x32c03c){return function(_0x484c73){_0x32c03c[_0x4d38('0x3')](_0x27d489,_0x484c73);};}function removeListener(_0x100491,_0x3fab89){return function(){WhatsappInteractionEvents[_0x4d38('0x4')](_0x100491,_0x3fab89);};}exports['register']=function(_0x46de99){for(var _0x14ae7b=0x0,_0x28dce7=events[_0x4d38('0x5')];_0x14ae7b<_0x28dce7;_0x14ae7b++){var _0x363e70=events[_0x14ae7b];var _0xebf7e9=createListener(_0x4d38('0x6')+_0x363e70,_0x46de99);WhatsappInteractionEvents['on'](_0x363e70,_0xebf7e9);}}; \ No newline at end of file +var _0x9ffb=['./whatsappInteraction.events','save','remove','update','removeListener','register','whatsappInteraction:'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9ffb,0x1c7));var _0xb9ff=function(_0xb3a124,_0x4a91ec){_0xb3a124=_0xb3a124-0x0;var _0x31fa0e=_0x9ffb[_0xb3a124];return _0x31fa0e;};'use strict';var WhatsappInteractionEvents=require(_0xb9ff('0x0'));var events=[_0xb9ff('0x1'),_0xb9ff('0x2'),_0xb9ff('0x3')];function createListener(_0x455124,_0x30464d){return function(_0x2d7949){_0x30464d['emit'](_0x455124,_0x2d7949);};}function removeListener(_0x35a230,_0x5e9d88){return function(){WhatsappInteractionEvents[_0xb9ff('0x4')](_0x35a230,_0x5e9d88);};}exports[_0xb9ff('0x5')]=function(_0x135730){for(var _0x5284b3=0x0,_0x2c066b=events['length'];_0x5284b3<_0x2c066b;_0x5284b3++){var _0x54be1a=events[_0x5284b3];var _0x1cc4cb=createListener(_0xb9ff('0x6')+_0x54be1a,_0x135730);WhatsappInteractionEvents['on'](_0x54be1a,_0x1cc4cb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index eaf62ae..6acb5d6 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 _0x0738=['reject','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','accept','/:id/reject'];(function(_0x1e0bb9,_0x24088b){var _0x24901d=function(_0x2c280c){while(--_0x2c280c){_0x1e0bb9['push'](_0x1e0bb9['shift']());}};_0x24901d(++_0x24088b);}(_0x0738,0x108));var _0x8073=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0x0738[_0x842858];return _0x46c2a2;};'use strict';var multer=require('multer');var util=require(_0x8073('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8073('0x1'));var router=express[_0x8073('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8073('0x3'));var interaction=require(_0x8073('0x4'));var config=require(_0x8073('0x5'));var controller=require(_0x8073('0x6'));router['get']('/',auth[_0x8073('0x7')](),controller['index']);router[_0x8073('0x8')](_0x8073('0x9'),auth[_0x8073('0x7')](),controller[_0x8073('0xa')]);router[_0x8073('0x8')](_0x8073('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8073('0xc')]('/',auth[_0x8073('0x7')](),interaction[_0x8073('0xd')](_0x8073('0xe'),_0x8073('0xf')),controller[_0x8073('0x10')]);router[_0x8073('0xc')]('/:id/status',controller[_0x8073('0x11')]);router[_0x8073('0x12')](_0x8073('0xb'),auth[_0x8073('0x7')](),controller[_0x8073('0x13')]);router[_0x8073('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x8073('0x14')]);router[_0x8073('0x12')](_0x8073('0x15'),auth['isAuthenticated'](),controller[_0x8073('0x16')]);router[_0x8073('0x17')](_0x8073('0xb'),auth[_0x8073('0x7')](),controller[_0x8073('0x18')]);module[_0x8073('0x19')]=router; \ No newline at end of file +var _0xea85=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','post','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x546023,_0x10b724){var _0x535e2b=function(_0x22c3df){while(--_0x22c3df){_0x546023['push'](_0x546023['shift']());}};_0x535e2b(++_0x10b724);}(_0xea85,0x192));var _0x5ea8=function(_0x42361f,_0x57cb9d){_0x42361f=_0x42361f-0x0;var _0x3a54fc=_0xea85[_0x42361f];return _0x3a54fc;};'use strict';var multer=require(_0x5ea8('0x0'));var util=require(_0x5ea8('0x1'));var path=require(_0x5ea8('0x2'));var timeout=require(_0x5ea8('0x3'));var express=require(_0x5ea8('0x4'));var router=express[_0x5ea8('0x5')]();var fs_extra=require(_0x5ea8('0x6'));var auth=require(_0x5ea8('0x7'));var interaction=require(_0x5ea8('0x8'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x5ea8('0x9')]('/',auth[_0x5ea8('0xa')](),controller[_0x5ea8('0xb')]);router['get'](_0x5ea8('0xc'),auth['isAuthenticated'](),controller[_0x5ea8('0xd')]);router['get'](_0x5ea8('0xe'),auth['isAuthenticated'](),controller[_0x5ea8('0xf')]);router['post']('/',auth[_0x5ea8('0xa')](),interaction[_0x5ea8('0x10')](_0x5ea8('0x11'),_0x5ea8('0x12')),controller['create']);router[_0x5ea8('0x13')](_0x5ea8('0x14'),controller['status']);router[_0x5ea8('0x15')](_0x5ea8('0xe'),auth[_0x5ea8('0xa')](),controller[_0x5ea8('0x16')]);router[_0x5ea8('0x15')](_0x5ea8('0x17'),auth[_0x5ea8('0xa')](),controller['accept']);router['put'](_0x5ea8('0x18'),auth['isAuthenticated'](),controller[_0x5ea8('0x19')]);router[_0x5ea8('0x1a')](_0x5ea8('0xe'),auth[_0x5ea8('0xa')](),controller[_0x5ea8('0x1b')]);module[_0x5ea8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f1f5b65..7b051bb 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 _0x1625=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x50a99e,_0x3b8636){var _0x297630=function(_0x29496e){while(--_0x29496e){_0x50a99e['push'](_0x50a99e['shift']());}};_0x297630(++_0x3b8636);}(_0x1625,0xa7));var _0x5162=function(_0x332802,_0x11ce71){_0x332802=_0x332802-0x0;var _0x43f28a=_0x1625[_0x332802];return _0x43f28a;};'use strict';var Sequelize=require(_0x5162('0x0'));module['exports']={'body':{'type':Sequelize[_0x5162('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5162('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5162('0x3')]('in',_0x5162('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5162('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x5162('0x6')]},'secret':{'type':Sequelize[_0x5162('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5162('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5c85=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x305ecc,_0x179297){var _0x221150=function(_0x2e71ed){while(--_0x2e71ed){_0x305ecc['push'](_0x305ecc['shift']());}};_0x221150(++_0x179297);}(_0x5c85,0xc1));var _0x55c8=function(_0x11ab22,_0x3440a0){_0x11ab22=_0x11ab22-0x0;var _0x4c33a9=_0x5c85[_0x11ab22];return _0x4c33a9;};'use strict';var Sequelize=require(_0x55c8('0x0'));module[_0x55c8('0x1')]={'body':{'type':Sequelize[_0x55c8('0x2')](_0x55c8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x55c8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x55c8('0x5')]('in',_0x55c8('0x6')),'defaultValue':_0x55c8('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x55c8('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x55c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index edbac1f..0d9ade6 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 _0xbe85=['WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','messageId','MessageStatus','read','update','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','util','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','whatsapp-interactions','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','count','Content-Range','then','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','find','create','body','destroy','params','describe','accept','acceptMessage','reject','whatsapp','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','agent','fullname','email','internal','format','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xbe85,0x1b8));var _0x5be8=function(_0x444395,_0x4d6a71){_0x444395=_0x444395-0x0;var _0x331379=_0xbe85[_0x444395];return _0x331379;};'use strict';var util=require(_0x5be8('0x0'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0x5be8('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5be8('0x2'))(_0x5be8('0x3'));var config=require(_0x5be8('0x4'));var db=require(_0x5be8('0x5'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5be8('0x6'),'port':0x18eb});var socket=require(_0x5be8('0x7'))(new Redis(config[_0x5be8('0x8')]));require('./whatsappMessage.socket')[_0x5be8('0x9')](socket);var jayson=require(_0x5be8('0xa'));var client=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232c});var client9002=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232a});var interaction_log=require(_0x5be8('0x2'))(_0x5be8('0xd'));function respondWithRpcPromise(_0x2814f2,_0x2d04eb,_0x446140,_0x1ff1e5){return new Promise(function(_0x110ee9,_0x312306){var _0x361caa=_0x1ff1e5||client;return _0x361caa[_0x5be8('0xe')](_0x2814f2,_0x446140)['then'](function(_0x439a7d){logger[_0x5be8('0xf')](_0x5be8('0x10'),_0x2d04eb,_0x5be8('0x11'));logger[_0x5be8('0x12')](_0x5be8('0x13'),_0x2d04eb,_0x5be8('0x11'),JSON[_0x5be8('0x14')](_0x439a7d));if(_0x439a7d['error']){if(_0x439a7d[_0x5be8('0x15')][_0x5be8('0x16')]===0x1f4){logger[_0x5be8('0x15')](_0x5be8('0x10'),_0x2d04eb,_0x439a7d['error'][_0x5be8('0x17')]);return _0x312306(_0x439a7d[_0x5be8('0x15')][_0x5be8('0x17')]);}logger[_0x5be8('0x15')](_0x5be8('0x10'),_0x2d04eb,_0x439a7d[_0x5be8('0x15')]['message']);return _0x110ee9(_0x439a7d[_0x5be8('0x15')]['message']);}else{logger[_0x5be8('0xf')](_0x5be8('0x10'),_0x2d04eb,_0x5be8('0x11'));_0x110ee9(_0x439a7d[_0x5be8('0x18')][_0x5be8('0x17')]);}})['catch'](function(_0x22e64b){logger['error'](_0x5be8('0x10'),_0x2d04eb,_0x22e64b);_0x312306(_0x22e64b);});});}function respondWithResult(_0x2168df,_0x57ad71){_0x57ad71=_0x57ad71||0xc8;return function(_0x3b640c){if(_0x3b640c){return _0x2168df[_0x5be8('0x19')](_0x57ad71)[_0x5be8('0x1a')](_0x3b640c);}};}function respondWithFilteredResult(_0x24f7c2,_0x5afe86){return function(_0x3fd2d4){if(_0x3fd2d4){var _0x360343=typeof _0x5afe86[_0x5be8('0x1b')]===_0x5be8('0x1c')&&typeof _0x5afe86['limit']===_0x5be8('0x1c');var _0x442ae9=_0x3fd2d4[_0x5be8('0x1d')];var _0x392ad5=_0x360343?0x0:_0x5afe86['offset'];var _0x98d894=_0x360343?_0x3fd2d4['count']:_0x5afe86['offset']+_0x5afe86['limit'];var _0x16a0a6;if(_0x98d894>=_0x442ae9){_0x98d894=_0x442ae9;_0x16a0a6=0xc8;}else{_0x16a0a6=0xce;}_0x24f7c2[_0x5be8('0x19')](_0x16a0a6);return _0x24f7c2['set'](_0x5be8('0x1e'),_0x392ad5+'-'+_0x98d894+'/'+_0x442ae9)[_0x5be8('0x1a')](_0x3fd2d4);}return null;};}function saveUpdates(_0x34bf16){return function(_0x5a5530){if(_0x5a5530){return _0x5a5530['update'](_0x34bf16)['then'](function(_0x343f74){return _0x343f74;});}return null;};}function removeEntity(_0x2b149d){return function(_0x3aab78){if(_0x3aab78){return _0x3aab78['destroy']()[_0x5be8('0x1f')](function(){_0x2b149d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fca5){return function(_0x58509b){if(!_0x58509b){_0x40fca5['sendStatus'](0x194);}return _0x58509b;};}function handleError(_0x4130ca,_0x45e252){_0x45e252=_0x45e252||0x1f4;return function(_0x4c3b69){logger[_0x5be8('0x15')](_0x4c3b69[_0x5be8('0x20')]);if(_0x4c3b69[_0x5be8('0x21')]){delete _0x4c3b69['name'];}_0x4130ca[_0x5be8('0x19')](_0x45e252)[_0x5be8('0x22')](_0x4c3b69);};}exports[_0x5be8('0x23')]=function(_0x70b520,_0x5b8e75){var _0x56723f={},_0x280dbc={},_0x4a3edd={'count':0x0,'rows':[]};var _0x3bd21b=_[_0x5be8('0x24')](db[_0x5be8('0x25')][_0x5be8('0x26')],function(_0xbece99){return{'name':_0xbece99[_0x5be8('0x27')],'type':_0xbece99[_0x5be8('0x28')][_0x5be8('0x29')]};});_0x280dbc[_0x5be8('0x2a')]=_[_0x5be8('0x24')](_0x3bd21b,'name');_0x280dbc[_0x5be8('0x2b')]=_[_0x5be8('0x2c')](_0x70b520[_0x5be8('0x2b')]);_0x280dbc[_0x5be8('0x2d')]=_[_0x5be8('0x2e')](_0x280dbc[_0x5be8('0x2a')],_0x280dbc['query']);_0x56723f[_0x5be8('0x2f')]=_['intersection'](_0x280dbc['model'],qs[_0x5be8('0x30')](_0x70b520[_0x5be8('0x2b')]['fields']));_0x56723f['attributes']=_0x56723f[_0x5be8('0x2f')][_0x5be8('0x31')]?_0x56723f[_0x5be8('0x2f')]:_0x280dbc[_0x5be8('0x2a')];if(!_0x70b520[_0x5be8('0x2b')]['hasOwnProperty'](_0x5be8('0x32'))){_0x56723f[_0x5be8('0x33')]=qs[_0x5be8('0x33')](_0x70b520['query']['limit']);_0x56723f[_0x5be8('0x1b')]=qs[_0x5be8('0x1b')](_0x70b520['query'][_0x5be8('0x1b')]);}_0x56723f[_0x5be8('0x34')]=qs['sort'](_0x70b520[_0x5be8('0x2b')][_0x5be8('0x35')]);_0x56723f['where']=qs['filters'](_[_0x5be8('0x36')](_0x70b520[_0x5be8('0x2b')],_0x280dbc['filters']),_0x3bd21b);if(_0x70b520['query'][_0x5be8('0x37')]){_0x56723f[_0x5be8('0x38')]=_['merge'](_0x56723f[_0x5be8('0x38')],{'$or':_['map'](_0x3bd21b,function(_0x5c6d51){if(_0x5c6d51[_0x5be8('0x28')]!==_0x5be8('0x39')){var _0x545d5f={};_0x545d5f[_0x5c6d51[_0x5be8('0x21')]]={'$like':'%'+_0x70b520[_0x5be8('0x2b')][_0x5be8('0x37')]+'%'};return _0x545d5f;}})});}_0x56723f=_[_0x5be8('0x3a')]({},_0x56723f,_0x70b520[_0x5be8('0x3b')]);var _0x23476e={'where':_0x56723f[_0x5be8('0x38')]};return db[_0x5be8('0x25')]['count'](_0x23476e)['then'](function(_0x144c58){_0x4a3edd[_0x5be8('0x1d')]=_0x144c58;if(_0x70b520['query']['includeAll']){_0x56723f[_0x5be8('0x3c')]=[{'all':!![]}];}return db[_0x5be8('0x25')][_0x5be8('0x3d')](_0x56723f);})[_0x5be8('0x1f')](function(_0x421d8e){_0x4a3edd['rows']=_0x421d8e;return _0x4a3edd;})[_0x5be8('0x1f')](respondWithFilteredResult(_0x5b8e75,_0x56723f))[_0x5be8('0x3e')](handleError(_0x5b8e75,null));};exports[_0x5be8('0x3f')]=function(_0x39288e,_0x2448ec){var _0xc34b0c={'raw':!![],'where':{'id':_0x39288e['params']['id']}},_0xa859ba={};_0xa859ba[_0x5be8('0x2a')]=_[_0x5be8('0x2c')](db[_0x5be8('0x25')][_0x5be8('0x26')]);_0xa859ba[_0x5be8('0x2b')]=_[_0x5be8('0x2c')](_0x39288e[_0x5be8('0x2b')]);_0xa859ba[_0x5be8('0x2d')]=_[_0x5be8('0x2e')](_0xa859ba['model'],_0xa859ba[_0x5be8('0x2b')]);_0xc34b0c[_0x5be8('0x2f')]=_[_0x5be8('0x2e')](_0xa859ba[_0x5be8('0x2a')],qs[_0x5be8('0x30')](_0x39288e[_0x5be8('0x2b')][_0x5be8('0x30')]));_0xc34b0c[_0x5be8('0x2f')]=_0xc34b0c[_0x5be8('0x2f')][_0x5be8('0x31')]?_0xc34b0c[_0x5be8('0x2f')]:_0xa859ba[_0x5be8('0x2a')];if(_0x39288e[_0x5be8('0x2b')]['includeAll']){_0xc34b0c['include']=[{'all':!![]}];}_0xc34b0c=_[_0x5be8('0x3a')]({},_0xc34b0c,_0x39288e[_0x5be8('0x3b')]);return db[_0x5be8('0x25')][_0x5be8('0x40')](_0xc34b0c)[_0x5be8('0x1f')](handleEntityNotFound(_0x2448ec,null))['then'](respondWithResult(_0x2448ec,null))['catch'](handleError(_0x2448ec,null));};exports[_0x5be8('0x41')]=function(_0x429e82,_0x1e7a04){return db[_0x5be8('0x25')][_0x5be8('0x41')](_0x429e82['body'],{})[_0x5be8('0x1f')](respondWithResult(_0x1e7a04,0xc9))[_0x5be8('0x3e')](handleError(_0x1e7a04,null));};exports['update']=function(_0x4bf699,_0x3b3167){if(_0x4bf699[_0x5be8('0x42')]['id']){delete _0x4bf699[_0x5be8('0x42')]['id'];}return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x4bf699['params']['id']}})[_0x5be8('0x1f')](handleEntityNotFound(_0x3b3167,null))['then'](saveUpdates(_0x4bf699['body'],null))[_0x5be8('0x1f')](respondWithResult(_0x3b3167,null))['catch'](handleError(_0x3b3167,null));};exports[_0x5be8('0x43')]=function(_0x27eb36,_0x23d7d1){return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x27eb36[_0x5be8('0x44')]['id']}})['then'](handleEntityNotFound(_0x23d7d1,null))[_0x5be8('0x1f')](removeEntity(_0x23d7d1,null))[_0x5be8('0x3e')](handleError(_0x23d7d1,null));};exports['describe']=function(_0x3b4814,_0x322428){return db[_0x5be8('0x25')][_0x5be8('0x45')]()[_0x5be8('0x1f')](respondWithResult(_0x322428,null))[_0x5be8('0x3e')](handleError(_0x322428,null));};exports[_0x5be8('0x46')]=function(_0x3425d7,_0x4b6a7a){var _0x5a2b80='whatsapp';return interactionService[_0x5be8('0x47')](_0x3425d7,_0x5a2b80)[_0x5be8('0x1f')](respondWithResult(_0x4b6a7a,null))[_0x5be8('0x3e')](handleError(_0x4b6a7a,null));};exports[_0x5be8('0x48')]=function(_0x49d88d,_0x489a53){var _0x289c25={'agent':{},'channel':_0x5be8('0x49')};if(_0x49d88d[_0x5be8('0x42')]['id']){delete _0x49d88d[_0x5be8('0x42')]['id'];}_0x49d88d[_0x5be8('0x42')][_0x5be8('0x4a')]=_0x49d88d['body'][_0x5be8('0x4a')]||_0x49d88d[_0x5be8('0x4b')]['id'];_0x289c25['agent']['id']=_0x49d88d[_0x5be8('0x42')][_0x5be8('0x4a')];return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x49d88d[_0x5be8('0x44')]['id'],'UserId':null}})[_0x5be8('0x1f')](handleEntityNotFound(_0x489a53,null))[_0x5be8('0x1f')](function(_0xb025f){if(_0xb025f){_0x289c25[_0x5be8('0x17')]=_0xb025f[_0x5be8('0x4c')]({'plain':!![]});return db[_0x5be8('0x4d')][_0x5be8('0x40')]({'where':{'id':_0xb025f[_0x5be8('0x4e')]}});}return null;})['then'](handleEntityNotFound(_0x489a53,null))[_0x5be8('0x1f')](function(_0x23f72b){if(_0x23f72b){_0x289c25['interaction']=_0x23f72b[_0x5be8('0x4c')]({'plain':!![]});interaction_log[_0x5be8('0xf')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x49d88d[_0x5be8('0x4b')]['id'],_0x49d88d[_0x5be8('0x4b')][_0x5be8('0x21')],_0x49d88d['user'][_0x5be8('0x4f')],_0x289c25['interaction']['id'],_0x49d88d[_0x5be8('0x42')]?JSON[_0x5be8('0x14')](_0x49d88d[_0x5be8('0x42')]):'null');return respondWithRpcPromise(_0x5be8('0x50'),_0x5be8('0x51'),_0x289c25);}return null;})['then'](function(_0xbf9d2b){var _0x59e846=_0x5be8('0x52')+_0xbf9d2b[_0x5be8('0x17')][_0x5be8('0x53')];return db[_0x5be8('0x54')][_0x5be8('0x2b')](_0x59e846,{'type':db[_0x5be8('0x55')]['QueryTypes'][_0x5be8('0x56')],'raw':!![]})[_0x5be8('0x1f')](function(_0x1d7b30){return _0x1d7b30;});})[_0x5be8('0x1f')](function(_0x175cfe){if(_0x175cfe){_0x289c25['message'][_0x5be8('0x57')]=_0x175cfe[0x0];if(!_0x49d88d[_0x5be8('0x42')]['UserId'])return;return db['User'][_0x5be8('0x40')]({'where':{'id':_0x49d88d[_0x5be8('0x42')]['UserId'],'role':_0x5be8('0x58')},'attributes':['id',_0x5be8('0x21'),_0x5be8('0x59'),_0x5be8('0x5a'),_0x5be8('0x5b')],'raw':!![]});}return null;})['then'](function(_0x469f33){if(!_0x469f33)return null;_0x289c25[_0x5be8('0x17')][_0x5be8('0x58')]=_0x469f33;return _0x289c25;})[_0x5be8('0x1f')](function(_0x1d4892){if(_0x1d4892){_0x1d4892[_0x5be8('0x17')]['interface']=util[_0x5be8('0x5c')]('SIP/%s',_0x49d88d['user'][_0x5be8('0x21')]);_0x1d4892[_0x5be8('0x17')][_0x5be8('0x5d')]=_0x289c25['channel'];_0x1d4892[_0x5be8('0x17')][_0x5be8('0x5e')]=_0x289c25[_0x5be8('0x5d')];_0x1d4892['message'][_0x5be8('0x5f')]=_0x5be8('0x48');respondWithRpcPromise(_0x5be8('0x60'),_0x5be8('0x60'),{'event':_0x5be8('0x61'),'message':_0x1d4892[_0x5be8('0x17')]},client9002);return _0x289c25;}return null;})[_0x5be8('0x1f')](respondWithResult(_0x489a53,null))[_0x5be8('0x3e')](handleError(_0x489a53,null));};exports['status']=function(_0x3a483,_0x3199df){if(_0x3a483[_0x5be8('0x42')]['id']){delete _0x3a483[_0x5be8('0x42')]['id'];}var _0xd5814c;return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x3a483[_0x5be8('0x44')]['id']}})[_0x5be8('0x1f')](handleEntityNotFound(_0x3199df,null))[_0x5be8('0x1f')](function(_0x1241e9){if(_0x1241e9){_0xd5814c=_0x1241e9;return db[_0x5be8('0x62')][_0x5be8('0x40')]({'where':{'id':_0x1241e9[_0x5be8('0x63')]}});}})[_0x5be8('0x1f')](handleEntityNotFound(_0x3199df,null))[_0x5be8('0x1f')](function(_0x2e0aa1){if(_0x2e0aa1){logger[_0x5be8('0x12')](_0x5be8('0x64'),'status','received\x20delivery\x20report\x20from',_0x2e0aa1[_0x5be8('0x28')],util['inspect'](_0x3a483[_0x5be8('0x42')],{'showHidden':![],'depth':null}));switch(_0x2e0aa1[_0x5be8('0x28')]){case'twilio':if(_0x3a483['body'][_0x5be8('0x65')]&&_0x3a483[_0x5be8('0x42')][_0x5be8('0x65')]===_0xd5814c[_0x5be8('0x66')]&&_0x3a483[_0x5be8('0x42')]['MessageStatus']&&_0x3a483[_0x5be8('0x42')][_0x5be8('0x67')]===_0x5be8('0x68')){return _0xd5814c[_0x5be8('0x69')]({'read':!![]});}else{logger['error'](_0x5be8('0x6a'),_0x5be8('0x19'),'twilio',util[_0x5be8('0x6b')](_0x3a483[_0x5be8('0x42')],{'showHidden':![],'depth':null}));}break;}return _0xd5814c;}})[_0x5be8('0x1f')](respondWithResult(_0x3199df,null))[_0x5be8('0x3e')](handleError(_0x3199df,null));}; \ No newline at end of file +var _0x6477=['../../config/logger','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','update','end','sendStatus','stack','name','index','WhatsappMessage','rawAttributes','fieldName','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','map','type','VIRTUAL','options','includeAll','include','rows','show','find','create','body','params','destroy','describe','accept','whatsapp','acceptMessage','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','ioredis','../../components/interaction/service','api','../../mysqldb','socket.io-emitter','redis','register','jayson/promise','http'];(function(_0x3f7dad,_0x100f50){var _0x50122e=function(_0x315e00){while(--_0x315e00){_0x3f7dad['push'](_0x3f7dad['shift']());}};_0x50122e(++_0x100f50);}(_0x6477,0x13e));var _0x7647=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0x6477[_0x4e0026];return _0x3f8ee7;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0x7647('0x0'));var interactionService=require(_0x7647('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7647('0x2'));var config=require('../../config/environment');var db=require(_0x7647('0x3'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7647('0x4'))(new Redis(config[_0x7647('0x5')]));require('./whatsappMessage.socket')[_0x7647('0x6')](socket);var jayson=require(_0x7647('0x7'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x7647('0x8')]({'port':0x232a});var interaction_log=require(_0x7647('0x9'))('whatsapp-interactions');function respondWithRpcPromise(_0x238b95,_0x522877,_0x2bebd5,_0x2f054d){return new Promise(function(_0x41836a,_0x3b114a){var _0x38f8b0=_0x2f054d||client;return _0x38f8b0[_0x7647('0xa')](_0x238b95,_0x2bebd5)[_0x7647('0xb')](function(_0x99f2d){logger[_0x7647('0xc')](_0x7647('0xd'),_0x522877,_0x7647('0xe'));logger['debug'](_0x7647('0xf'),_0x522877,_0x7647('0xe'),JSON[_0x7647('0x10')](_0x99f2d));if(_0x99f2d['error']){if(_0x99f2d[_0x7647('0x11')][_0x7647('0x12')]===0x1f4){logger[_0x7647('0x11')](_0x7647('0xd'),_0x522877,_0x99f2d[_0x7647('0x11')][_0x7647('0x13')]);return _0x3b114a(_0x99f2d[_0x7647('0x11')][_0x7647('0x13')]);}logger[_0x7647('0x11')](_0x7647('0xd'),_0x522877,_0x99f2d[_0x7647('0x11')][_0x7647('0x13')]);return _0x41836a(_0x99f2d[_0x7647('0x11')][_0x7647('0x13')]);}else{logger['info'](_0x7647('0xd'),_0x522877,'request\x20sent');_0x41836a(_0x99f2d['result'][_0x7647('0x13')]);}})[_0x7647('0x14')](function(_0x109b85){logger[_0x7647('0x11')](_0x7647('0xd'),_0x522877,_0x109b85);_0x3b114a(_0x109b85);});});}function respondWithResult(_0x4c9517,_0x1554c8){_0x1554c8=_0x1554c8||0xc8;return function(_0x5c0af2){if(_0x5c0af2){return _0x4c9517[_0x7647('0x15')](_0x1554c8)[_0x7647('0x16')](_0x5c0af2);}};}function respondWithFilteredResult(_0x45f07c,_0x5aec61){return function(_0xd01f22){if(_0xd01f22){var _0x4d27d2=typeof _0x5aec61[_0x7647('0x17')]===_0x7647('0x18')&&typeof _0x5aec61[_0x7647('0x19')]==='undefined';var _0x46d2d9=_0xd01f22[_0x7647('0x1a')];var _0x578ad5=_0x4d27d2?0x0:_0x5aec61[_0x7647('0x17')];var _0x32712f=_0x4d27d2?_0xd01f22[_0x7647('0x1a')]:_0x5aec61[_0x7647('0x17')]+_0x5aec61[_0x7647('0x19')];var _0x274fa6;if(_0x32712f>=_0x46d2d9){_0x32712f=_0x46d2d9;_0x274fa6=0xc8;}else{_0x274fa6=0xce;}_0x45f07c[_0x7647('0x15')](_0x274fa6);return _0x45f07c[_0x7647('0x1b')]('Content-Range',_0x578ad5+'-'+_0x32712f+'/'+_0x46d2d9)[_0x7647('0x16')](_0xd01f22);}return null;};}function saveUpdates(_0x3233ff){return function(_0x29dda4){if(_0x29dda4){return _0x29dda4[_0x7647('0x1c')](_0x3233ff)['then'](function(_0x1828e5){return _0x1828e5;});}return null;};}function removeEntity(_0x36c185){return function(_0x19a40c){if(_0x19a40c){return _0x19a40c['destroy']()[_0x7647('0xb')](function(){_0x36c185[_0x7647('0x15')](0xcc)[_0x7647('0x1d')]();});}};}function handleEntityNotFound(_0x4be884){return function(_0xd22f51){if(!_0xd22f51){_0x4be884[_0x7647('0x1e')](0x194);}return _0xd22f51;};}function handleError(_0x2730ab,_0x304256){_0x304256=_0x304256||0x1f4;return function(_0x5cc2de){logger[_0x7647('0x11')](_0x5cc2de[_0x7647('0x1f')]);if(_0x5cc2de[_0x7647('0x20')]){delete _0x5cc2de['name'];}_0x2730ab[_0x7647('0x15')](_0x304256)['send'](_0x5cc2de);};}exports[_0x7647('0x21')]=function(_0x3d2f45,_0x5088d5){var _0x3ed650={},_0xa2fe63={},_0x160520={'count':0x0,'rows':[]};var _0x55827c=_['map'](db[_0x7647('0x22')][_0x7647('0x23')],function(_0x715526){return{'name':_0x715526[_0x7647('0x24')],'type':_0x715526['type'][_0x7647('0x25')]};});_0xa2fe63['model']=_['map'](_0x55827c,_0x7647('0x20'));_0xa2fe63['query']=_[_0x7647('0x26')](_0x3d2f45[_0x7647('0x27')]);_0xa2fe63['filters']=_[_0x7647('0x28')](_0xa2fe63['model'],_0xa2fe63[_0x7647('0x27')]);_0x3ed650[_0x7647('0x29')]=_[_0x7647('0x28')](_0xa2fe63[_0x7647('0x2a')],qs['fields'](_0x3d2f45[_0x7647('0x27')][_0x7647('0x2b')]));_0x3ed650[_0x7647('0x29')]=_0x3ed650[_0x7647('0x29')][_0x7647('0x2c')]?_0x3ed650[_0x7647('0x29')]:_0xa2fe63['model'];if(!_0x3d2f45['query'][_0x7647('0x2d')](_0x7647('0x2e'))){_0x3ed650[_0x7647('0x19')]=qs[_0x7647('0x19')](_0x3d2f45[_0x7647('0x27')][_0x7647('0x19')]);_0x3ed650[_0x7647('0x17')]=qs[_0x7647('0x17')](_0x3d2f45[_0x7647('0x27')][_0x7647('0x17')]);}_0x3ed650[_0x7647('0x2f')]=qs['sort'](_0x3d2f45['query'][_0x7647('0x30')]);_0x3ed650[_0x7647('0x31')]=qs[_0x7647('0x32')](_['pick'](_0x3d2f45[_0x7647('0x27')],_0xa2fe63[_0x7647('0x32')]),_0x55827c);if(_0x3d2f45[_0x7647('0x27')]['filter']){_0x3ed650['where']=_[_0x7647('0x33')](_0x3ed650[_0x7647('0x31')],{'$or':_[_0x7647('0x34')](_0x55827c,function(_0x1138c6){if(_0x1138c6[_0x7647('0x35')]!==_0x7647('0x36')){var _0x4219a2={};_0x4219a2[_0x1138c6['name']]={'$like':'%'+_0x3d2f45[_0x7647('0x27')]['filter']+'%'};return _0x4219a2;}})});}_0x3ed650=_[_0x7647('0x33')]({},_0x3ed650,_0x3d2f45[_0x7647('0x37')]);var _0x22ee92={'where':_0x3ed650[_0x7647('0x31')]};return db[_0x7647('0x22')][_0x7647('0x1a')](_0x22ee92)[_0x7647('0xb')](function(_0x3593b6){_0x160520[_0x7647('0x1a')]=_0x3593b6;if(_0x3d2f45[_0x7647('0x27')][_0x7647('0x38')]){_0x3ed650[_0x7647('0x39')]=[{'all':!![]}];}return db[_0x7647('0x22')]['findAll'](_0x3ed650);})[_0x7647('0xb')](function(_0x1fbb97){_0x160520[_0x7647('0x3a')]=_0x1fbb97;return _0x160520;})[_0x7647('0xb')](respondWithFilteredResult(_0x5088d5,_0x3ed650))[_0x7647('0x14')](handleError(_0x5088d5,null));};exports[_0x7647('0x3b')]=function(_0x319c29,_0x46b58c){var _0x245414={'raw':!![],'where':{'id':_0x319c29['params']['id']}},_0x366b23={};_0x366b23[_0x7647('0x2a')]=_['keys'](db[_0x7647('0x22')]['rawAttributes']);_0x366b23[_0x7647('0x27')]=_['keys'](_0x319c29[_0x7647('0x27')]);_0x366b23[_0x7647('0x32')]=_['intersection'](_0x366b23[_0x7647('0x2a')],_0x366b23['query']);_0x245414[_0x7647('0x29')]=_[_0x7647('0x28')](_0x366b23['model'],qs[_0x7647('0x2b')](_0x319c29[_0x7647('0x27')][_0x7647('0x2b')]));_0x245414['attributes']=_0x245414['attributes']['length']?_0x245414[_0x7647('0x29')]:_0x366b23[_0x7647('0x2a')];if(_0x319c29['query']['includeAll']){_0x245414[_0x7647('0x39')]=[{'all':!![]}];}_0x245414=_[_0x7647('0x33')]({},_0x245414,_0x319c29[_0x7647('0x37')]);return db[_0x7647('0x22')][_0x7647('0x3c')](_0x245414)[_0x7647('0xb')](handleEntityNotFound(_0x46b58c,null))[_0x7647('0xb')](respondWithResult(_0x46b58c,null))['catch'](handleError(_0x46b58c,null));};exports['create']=function(_0xef5987,_0x39bd95){return db[_0x7647('0x22')][_0x7647('0x3d')](_0xef5987['body'],{})[_0x7647('0xb')](respondWithResult(_0x39bd95,0xc9))[_0x7647('0x14')](handleError(_0x39bd95,null));};exports['update']=function(_0x34f4e9,_0x3b82af){if(_0x34f4e9[_0x7647('0x3e')]['id']){delete _0x34f4e9[_0x7647('0x3e')]['id'];}return db[_0x7647('0x22')][_0x7647('0x3c')]({'where':{'id':_0x34f4e9[_0x7647('0x3f')]['id']}})[_0x7647('0xb')](handleEntityNotFound(_0x3b82af,null))[_0x7647('0xb')](saveUpdates(_0x34f4e9['body'],null))[_0x7647('0xb')](respondWithResult(_0x3b82af,null))['catch'](handleError(_0x3b82af,null));};exports[_0x7647('0x40')]=function(_0x25c9b8,_0x211d49){return db[_0x7647('0x22')][_0x7647('0x3c')]({'where':{'id':_0x25c9b8[_0x7647('0x3f')]['id']}})['then'](handleEntityNotFound(_0x211d49,null))[_0x7647('0xb')](removeEntity(_0x211d49,null))[_0x7647('0x14')](handleError(_0x211d49,null));};exports[_0x7647('0x41')]=function(_0x1d8544,_0x47d0e0){return db['WhatsappMessage']['describe']()[_0x7647('0xb')](respondWithResult(_0x47d0e0,null))[_0x7647('0x14')](handleError(_0x47d0e0,null));};exports[_0x7647('0x42')]=function(_0x2e5150,_0x50e678){var _0x2816e7=_0x7647('0x43');return interactionService[_0x7647('0x44')](_0x2e5150,_0x2816e7)[_0x7647('0xb')](respondWithResult(_0x50e678,null))[_0x7647('0x14')](handleError(_0x50e678,null));};exports['reject']=function(_0x227150,_0x64ecb6){var _0x2a8997={'agent':{},'channel':_0x7647('0x43')};if(_0x227150['body']['id']){delete _0x227150[_0x7647('0x3e')]['id'];}_0x227150[_0x7647('0x3e')][_0x7647('0x45')]=_0x227150['body'][_0x7647('0x45')]||_0x227150[_0x7647('0x46')]['id'];_0x2a8997[_0x7647('0x47')]['id']=_0x227150[_0x7647('0x3e')]['UserId'];return db[_0x7647('0x22')][_0x7647('0x3c')]({'where':{'id':_0x227150['params']['id'],'UserId':null}})[_0x7647('0xb')](handleEntityNotFound(_0x64ecb6,null))['then'](function(_0x3d0e66){if(_0x3d0e66){_0x2a8997[_0x7647('0x13')]=_0x3d0e66[_0x7647('0x48')]({'plain':!![]});return db[_0x7647('0x49')]['find']({'where':{'id':_0x3d0e66[_0x7647('0x4a')]}});}return null;})[_0x7647('0xb')](handleEntityNotFound(_0x64ecb6,null))['then'](function(_0xe690e6){if(_0xe690e6){_0x2a8997[_0x7647('0x4b')]=_0xe690e6[_0x7647('0x48')]({'plain':!![]});interaction_log[_0x7647('0xc')](_0x7647('0x4c'),_0x227150[_0x7647('0x46')]['id'],_0x227150[_0x7647('0x46')][_0x7647('0x20')],_0x227150[_0x7647('0x46')][_0x7647('0x4d')],_0x2a8997['interaction']['id'],_0x227150['body']?JSON['stringify'](_0x227150[_0x7647('0x3e')]):_0x7647('0x4e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2a8997);}return null;})[_0x7647('0xb')](function(_0xeb5932){var _0x6fa7ca=_0x7647('0x4f')+_0xeb5932[_0x7647('0x13')][_0x7647('0x50')];return db[_0x7647('0x51')][_0x7647('0x27')](_0x6fa7ca,{'type':db[_0x7647('0x52')][_0x7647('0x53')][_0x7647('0x54')],'raw':!![]})[_0x7647('0xb')](function(_0x382e1b){return _0x382e1b;});})[_0x7647('0xb')](function(_0x398774){if(_0x398774){_0x2a8997[_0x7647('0x13')][_0x7647('0x55')]=_0x398774[0x0];if(!_0x227150[_0x7647('0x3e')][_0x7647('0x45')])return;return db[_0x7647('0x56')]['find']({'where':{'id':_0x227150[_0x7647('0x3e')][_0x7647('0x45')],'role':_0x7647('0x47')},'attributes':['id',_0x7647('0x20'),_0x7647('0x57'),_0x7647('0x58'),_0x7647('0x59')],'raw':!![]});}return null;})['then'](function(_0x939504){if(!_0x939504)return null;_0x2a8997['message'][_0x7647('0x47')]=_0x939504;return _0x2a8997;})[_0x7647('0xb')](function(_0x27003e){if(_0x27003e){_0x27003e[_0x7647('0x13')][_0x7647('0x5a')]=util[_0x7647('0x5b')](_0x7647('0x5c'),_0x227150[_0x7647('0x46')][_0x7647('0x20')]);_0x27003e[_0x7647('0x13')]['channel']=_0x2a8997[_0x7647('0x5d')];_0x27003e[_0x7647('0x13')][_0x7647('0x5e')]=_0x2a8997[_0x7647('0x5d')];_0x27003e[_0x7647('0x13')][_0x7647('0x5f')]=_0x7647('0x60');respondWithRpcPromise(_0x7647('0x61'),'EventManager',{'event':_0x7647('0x62'),'message':_0x27003e[_0x7647('0x13')]},client9002);return _0x2a8997;}return null;})['then'](respondWithResult(_0x64ecb6,null))[_0x7647('0x14')](handleError(_0x64ecb6,null));};exports['status']=function(_0x3f6778,_0x548746){if(_0x3f6778['body']['id']){delete _0x3f6778[_0x7647('0x3e')]['id'];}var _0x10c66b;return db[_0x7647('0x22')][_0x7647('0x3c')]({'where':{'id':_0x3f6778['params']['id']}})['then'](handleEntityNotFound(_0x548746,null))[_0x7647('0xb')](function(_0x4e8527){if(_0x4e8527){_0x10c66b=_0x4e8527;return db[_0x7647('0x63')][_0x7647('0x3c')]({'where':{'id':_0x4e8527[_0x7647('0x64')]}});}})[_0x7647('0xb')](handleEntityNotFound(_0x548746,null))[_0x7647('0xb')](function(_0x256654){if(_0x256654){logger[_0x7647('0x65')](_0x7647('0x66'),_0x7647('0x15'),_0x7647('0x67'),_0x256654[_0x7647('0x35')],util[_0x7647('0x68')](_0x3f6778[_0x7647('0x3e')],{'showHidden':![],'depth':null}));switch(_0x256654[_0x7647('0x35')]){case _0x7647('0x69'):if(_0x3f6778['body']['MessageSid']&&_0x3f6778[_0x7647('0x3e')]['MessageSid']===_0x10c66b['messageId']&&_0x3f6778[_0x7647('0x3e')][_0x7647('0x6a')]&&_0x3f6778[_0x7647('0x3e')][_0x7647('0x6a')]===_0x7647('0x6b')){return _0x10c66b[_0x7647('0x1c')]({'read':!![]});}else{logger[_0x7647('0x11')](_0x7647('0x6c'),_0x7647('0x15'),_0x7647('0x69'),util[_0x7647('0x68')](_0x3f6778[_0x7647('0x3e')],{'showHidden':![],'depth':null}));}break;}return _0x10c66b;}})['then'](respondWithResult(_0x548746,null))[_0x7647('0x14')](handleError(_0x548746,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 922eb60..26cc596 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 _0xee5b=['remove','emit','hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','update'];(function(_0x3d8680,_0x3ca47d){var _0x76dbf5=function(_0x2dd5c1){while(--_0x2dd5c1){_0x3d8680['push'](_0x3d8680['shift']());}};_0x76dbf5(++_0x3ca47d);}(_0xee5b,0x1f4));var _0xbee5=function(_0x51b783,_0x361cbd){_0x51b783=_0x51b783-0x0;var _0x2d478=_0xee5b[_0x51b783];return _0x2d478;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbee5('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbee5('0x3'),'afterDestroy':_0xbee5('0x4')};function emitEvent(_0x2eb857){return function(_0x210159,_0x4bd202,_0x5200b1){WhatsappMessageEvents[_0xbee5('0x5')](_0x2eb857+':'+_0x210159['id'],_0x210159);WhatsappMessageEvents[_0xbee5('0x5')](_0x2eb857,_0x210159);_0x5200b1(null);};}for(var e in events){if(events[_0xbee5('0x6')](e)){var event=events[e];WhatsappMessage[_0xbee5('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xeffd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners'];(function(_0x5f4abc,_0x1692ac){var _0x3c29a6=function(_0x46309e){while(--_0x46309e){_0x5f4abc['push'](_0x5f4abc['shift']());}};_0x3c29a6(++_0x1692ac);}(_0xeffd,0x6b));var _0xdeff=function(_0x1b577c,_0x4a181a){_0x1b577c=_0x1b577c-0x0;var _0x244bb1=_0xeffd[_0x1b577c];return _0x244bb1;};'use strict';var EventEmitter=require(_0xdeff('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xdeff('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xdeff('0x2')](0x0);var events={'afterCreate':_0xdeff('0x3'),'afterUpdate':_0xdeff('0x4'),'afterDestroy':_0xdeff('0x5')};function emitEvent(_0x4dac0){return function(_0x298274,_0x2881fd,_0x8315d4){WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0+':'+_0x298274['id'],_0x298274);WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0,_0x298274);_0x8315d4(null);};}for(var e in events){if(events[_0xdeff('0x7')](e)){var event=events[e];WhatsappMessage[_0xdeff('0x8')](e,emitEvent(event));}}module[_0xdeff('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d89063a..98777cc 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 _0x820b=['fti_whatsapp_messages','body','get','toLowerCase','direction','out','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x820b,0x190));var _0xb820=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x820b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb820('0x0'));var util=require('util');var logger=require(_0xb820('0x1'))('api');var moment=require(_0xb820('0x2'));var BPromise=require(_0xb820('0x3'));var rp=require('request-promise');var fetch=require(_0xb820('0x4'));var fs=require('fs');var path=require(_0xb820('0x5'));var rimraf=require('rimraf');var config=require(_0xb820('0x6'));var attributes=require(_0xb820('0x7'));module[_0xb820('0x8')]=function(_0x22e0cb,_0x3cc1b6){return _0x22e0cb[_0xb820('0x9')](_0xb820('0xa'),attributes,{'tableName':_0xb820('0xb'),'paranoid':![],'indexes':[{'name':_0xb820('0xc'),'fields':['messageId']},{'name':_0xb820('0xd'),'fields':[_0xb820('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48179a,_0x36f27d,_0x1574ec){var _0x345be8=_0x22e0cb['models'];var _0x1b5a61=_0x48179a[_0xb820('0xf')]({'plain':!![]});if(_0x1b5a61['direction'][_0xb820('0x10')]()==='in'||_0x1b5a61[_0xb820('0x11')]['toLowerCase']()===_0xb820('0x12')&&!_0x1b5a61['secret']&&!_[_0xb820('0x13')](_0x1b5a61[_0xb820('0x14')])){_0x345be8['WhatsappInteraction'][_0xb820('0x15')]({'where':{'id':_0x1b5a61[_0xb820('0x16')]}})[_0xb820('0x17')](function(_0x1414e2){if(_0x1414e2){_0x1414e2[_0xb820('0x18')]({'lastMsgAt':_0x1b5a61[_0xb820('0x19')],'lastMsgDirection':_0x1b5a61[_0xb820('0x11')][_0xb820('0x10')]()});}})[_0xb820('0x1a')](function(_0x199b12){console[_0xb820('0x1b')](_0x199b12);});}if(_0x1b5a61[_0xb820('0x11')]===_0xb820('0x12')&&!_0x1b5a61[_0xb820('0x1c')]){var _0x4a1698;_0x345be8[_0xb820('0x1d')][_0xb820('0x1e')]({'where':{'id':_0x1b5a61[_0xb820('0x1f')]},'raw':!![]})['then'](function(_0xf96975){_0x4a1698=_0xf96975;if(_0x4a1698&&_0x4a1698[_0xb820('0x20')]){switch(_0x4a1698['type']){case'twilio':var _0xea91dc=require('twilio');if(_0x4a1698[_0xb820('0x21')]&&_0x4a1698[_0xb820('0x22')]&&_0x4a1698[_0xb820('0x23')]){var _0x384609=new _0xea91dc(_0x4a1698[_0xb820('0x21')],_0x4a1698[_0xb820('0x22')]);_0x384609[_0xb820('0x24')][_0xb820('0x25')]({'body':_0x1b5a61[_0xb820('0xe')],'to':_0xb820('0x26')+_0x1b5a61[_0xb820('0x23')],'from':_0xb820('0x26')+_0x4a1698['phone'],'statusCallback':_0x4a1698[_0xb820('0x27')]+_0xb820('0x28')+_0x1b5a61['id']+'/status?token='+_0x4a1698[_0xb820('0x29')]})[_0xb820('0x17')](function(_0x12d640){if(_0x12d640[_0xb820('0x2a')]){return _0x48179a['update']({'messageId':_0x12d640[_0xb820('0x2a')]});}})['catch'](function(_0x50e4dd){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0xb820('0x2b')](_0x50e4dd,{'showHidden':![],'depth':null}));});}else{logger[_0xb820('0x1b')](_0xb820('0x2c'),_0xb820('0x2d'),_0xb820('0x2e'),_0xb820('0x2f'));}break;case _0xb820('0x30'):var _0x7eaa7f=_0x4a1698[_0xb820('0x21')];var _0x904ff8=_0x4a1698['authToken'];var _0x119939=_0x4a1698['baseUrl']+_0xb820('0x31')+_0x7eaa7f+_0xb820('0x32');var _0x14c7f2={'to':[_0x1b5a61[_0xb820('0x23')]],'message':{'type':'text','text':_0x1b5a61[_0xb820('0xe')]}};var _0x37e3bc={'method':_0xb820('0x33'),'uri':_0x119939,'headers':{'Authorization':_0xb820('0x34')+_0x904ff8,'Content-Type':_0xb820('0x35')},'body':_0x14c7f2,'json':!![]};rp(_0x37e3bc)[_0xb820('0x17')](function(_0x4aa942){if(_0x4aa942[_0xb820('0x36')][0x0]['message_id']){return _0x48179a[_0xb820('0x18')]({'messageId':_0x4aa942['statuses'][0x0]['message_id']});}})[_0xb820('0x1a')](function(_0x5ee3a1){logger['err'](_0xb820('0x37'),_0x5ee3a1);});break;}}})[_0xb820('0x38')](function(){_0x1574ec();});}else{_0x1574ec();}}},'charset':_0xb820('0x39'),'collate':_0xb820('0x3a')});}; \ No newline at end of file +var _0x18ed=['bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','error','secret','type','twilio','phone','authToken','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','api'];(function(_0x257bd0,_0x37b28b){var _0x118b8c=function(_0x2b6443){while(--_0x2b6443){_0x257bd0['push'](_0x257bd0['shift']());}};_0x118b8c(++_0x37b28b);}(_0x18ed,0xe6));var _0xd18e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x18ed[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd18e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd18e('0x1'));var moment=require('moment');var BPromise=require(_0xd18e('0x2'));var rp=require(_0xd18e('0x3'));var fetch=require(_0xd18e('0x4'));var fs=require('fs');var path=require(_0xd18e('0x5'));var rimraf=require(_0xd18e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd18e('0x7'));module[_0xd18e('0x8')]=function(_0x4e9444,_0x5d4bd0){return _0x4e9444[_0xd18e('0x9')](_0xd18e('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd18e('0xb')]},{'name':_0xd18e('0xc'),'fields':['body'],'type':_0xd18e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x435994,_0x51042b,_0x2d4bf8){var _0x13a1ff=_0x4e9444[_0xd18e('0xe')];var _0x26b9bd=_0x435994[_0xd18e('0xf')]({'plain':!![]});if(_0x26b9bd[_0xd18e('0x10')][_0xd18e('0x11')]()==='in'||_0x26b9bd['direction'][_0xd18e('0x11')]()===_0xd18e('0x12')&&!_0x26b9bd['secret']&&!_['isNil'](_0x26b9bd[_0xd18e('0x13')])){_0x13a1ff[_0xd18e('0x14')]['findOne']({'where':{'id':_0x26b9bd[_0xd18e('0x15')]}})[_0xd18e('0x16')](function(_0x569153){if(_0x569153){_0x569153[_0xd18e('0x17')]({'lastMsgAt':_0x26b9bd[_0xd18e('0x18')],'lastMsgDirection':_0x26b9bd['direction'][_0xd18e('0x11')]()});}})['catch'](function(_0x2c5032){console[_0xd18e('0x19')](_0x2c5032);});}if(_0x26b9bd[_0xd18e('0x10')]===_0xd18e('0x12')&&!_0x26b9bd[_0xd18e('0x1a')]){var _0x590b89;_0x13a1ff['WhatsappAccount']['find']({'where':{'id':_0x26b9bd['WhatsappAccountId']},'raw':!![]})[_0xd18e('0x16')](function(_0x2f97f3){_0x590b89=_0x2f97f3;if(_0x590b89&&_0x590b89[_0xd18e('0x1b')]){switch(_0x590b89['type']){case _0xd18e('0x1c'):var _0x1a9bb2=require(_0xd18e('0x1c'));if(_0x590b89['accountSid']&&_0x590b89['authToken']&&_0x590b89[_0xd18e('0x1d')]){var _0x420ad5=new _0x1a9bb2(_0x590b89['accountSid'],_0x590b89[_0xd18e('0x1e')]);_0x420ad5[_0xd18e('0x1f')][_0xd18e('0x20')]({'body':_0x26b9bd[_0xd18e('0x21')],'to':_0xd18e('0x22')+_0x26b9bd['phone'],'from':_0xd18e('0x22')+_0x590b89[_0xd18e('0x1d')],'statusCallback':_0x590b89[_0xd18e('0x23')]+_0xd18e('0x24')+_0x26b9bd['id']+_0xd18e('0x25')+_0x590b89[_0xd18e('0x26')]})[_0xd18e('0x16')](function(_0x3c8fbf){if(_0x3c8fbf[_0xd18e('0x27')]){return _0x435994[_0xd18e('0x17')]({'messageId':_0x3c8fbf[_0xd18e('0x27')]});}})['catch'](function(_0x9c3dd5){logger[_0xd18e('0x19')](_0xd18e('0x28'),_0xd18e('0x29'),_0xd18e('0x1c'),util['inspect'](_0x9c3dd5,{'showHidden':![],'depth':null}));});}else{logger[_0xd18e('0x19')](_0xd18e('0x28'),'afterCreate',_0xd18e('0x1c'),_0xd18e('0x2a'));}break;case _0xd18e('0x2b'):var _0x27f94f=_0x590b89[_0xd18e('0x2c')];var _0x3bc549=_0x590b89[_0xd18e('0x1e')];var _0x32893e=_0x590b89[_0xd18e('0x2d')]+'/whatsapp/v1/'+_0x27f94f+_0xd18e('0x2e');var _0x16f64b={'to':[_0x26b9bd['phone']],'message':{'type':_0xd18e('0x2f'),'text':_0x26b9bd['body']}};var _0x1d740c={'method':_0xd18e('0x30'),'uri':_0x32893e,'headers':{'Authorization':_0xd18e('0x31')+_0x3bc549,'Content-Type':_0xd18e('0x32')},'body':_0x16f64b,'json':!![]};rp(_0x1d740c)[_0xd18e('0x16')](function(_0x46047b){if(_0x46047b['statuses'][0x0]['message_id']){return _0x435994[_0xd18e('0x17')]({'messageId':_0x46047b[_0xd18e('0x33')][0x0][_0xd18e('0x34')]});}})[_0xd18e('0x35')](function(_0xbabf34){logger[_0xd18e('0x36')](_0xd18e('0x37'),_0xbabf34);});break;}}})[_0xd18e('0x38')](function(){_0x2d4bf8();});}else{_0x2d4bf8();}}},'charset':_0xd18e('0x39'),'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 80b2fc0..2068fd3 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 _0x5633=['catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x5633,0x1f2));var _0x3563=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x5633[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x3563('0x0'));var util=require(_0x3563('0x1'));var moment=require(_0x3563('0x2'));var BPromise=require(_0x3563('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3563('0x4'));var db=require(_0x3563('0x5'))['db'];var utils=require(_0x3563('0x6'));var logger=require(_0x3563('0x7'))(_0x3563('0x8'));var config=require('../../config/environment');var jayson=require(_0x3563('0x9'));var client=jayson[_0x3563('0xa')][_0x3563('0xb')]({'port':0x232a});config['redis']=_[_0x3563('0xc')](config[_0x3563('0xd')],{'host':_0x3563('0xe'),'port':0x18eb});var socket=require(_0x3563('0xf'))(new Redis(config[_0x3563('0xd')]));require(_0x3563('0x10'))[_0x3563('0x11')](socket);function respondWithRpcPromise(_0x266f29,_0x4e6e71,_0x3a5cb3){return new BPromise(function(_0x2ea60b,_0x3ab430){return client['request'](_0x266f29,_0x3a5cb3)['then'](function(_0x38be84){logger[_0x3563('0x12')](_0x3563('0x13'),_0x4e6e71,_0x3563('0x14'));logger['debug'](_0x3563('0x15'),_0x4e6e71,_0x3563('0x14'),JSON[_0x3563('0x16')](_0x38be84));if(_0x38be84[_0x3563('0x17')]){if(_0x38be84['error'][_0x3563('0x18')]===0x1f4){logger[_0x3563('0x17')](_0x3563('0x13'),_0x4e6e71,_0x38be84['error'][_0x3563('0x19')]);return _0x3ab430(_0x38be84[_0x3563('0x17')][_0x3563('0x19')]);}logger['error'](_0x3563('0x13'),_0x4e6e71,_0x38be84[_0x3563('0x17')][_0x3563('0x19')]);return _0x2ea60b(_0x38be84[_0x3563('0x17')][_0x3563('0x19')]);}else{logger[_0x3563('0x12')](_0x3563('0x13'),_0x4e6e71,_0x3563('0x14'));_0x2ea60b(_0x38be84[_0x3563('0x1a')][_0x3563('0x19')]);}})[_0x3563('0x1b')](function(_0x2bf635){logger[_0x3563('0x17')](_0x3563('0x13'),_0x4e6e71,_0x2bf635);_0x3ab430(_0x2bf635);});});}exports[_0x3563('0x1c')]=function(_0x25d14b){var _0x36e437=this;return new Promise(function(_0x2cc032,_0x11c62a){return db[_0x3563('0x1d')]['create'](_0x25d14b[_0x3563('0x1e')],{'raw':_0x25d14b[_0x3563('0x1f')]?_0x25d14b[_0x3563('0x1f')][_0x3563('0x20')]===undefined?!![]:![]:!![]})[_0x3563('0x21')](function(_0x26dc40){logger[_0x3563('0x12')](_0x3563('0x1c'),_0x25d14b);logger[_0x3563('0x22')](_0x3563('0x1c'),_0x25d14b,JSON[_0x3563('0x16')](_0x26dc40));_0x2cc032(_0x26dc40);})[_0x3563('0x1b')](function(_0x329bb6){logger[_0x3563('0x17')](_0x3563('0x1c'),_0x329bb6[_0x3563('0x19')],_0x25d14b);_0x11c62a(_0x36e437[_0x3563('0x17')](0x1f4,_0x329bb6[_0x3563('0x19')]));});});}; \ No newline at end of file +var _0x5d6c=['http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','request\x20sent','debug','stringify','WhatsappMessage,\x20%s,\x20%s','error','message','result','catch','WhatsappMessage','options','raw','then','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x5d6c,0xf5));var _0xc5d6=function(_0x10747e,_0x9f1892){_0x10747e=_0x10747e-0x0;var _0x37735f=_0x5d6c[_0x10747e];return _0x37735f;};'use strict';var _=require(_0xc5d6('0x0'));var util=require(_0xc5d6('0x1'));var moment=require(_0xc5d6('0x2'));var BPromise=require(_0xc5d6('0x3'));var rs=require(_0xc5d6('0x4'));var fs=require('fs');var Redis=require(_0xc5d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5d6('0x6'));var logger=require(_0xc5d6('0x7'))(_0xc5d6('0x8'));var config=require(_0xc5d6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc5d6('0xa')][_0xc5d6('0xb')]({'port':0x232a});config[_0xc5d6('0xc')]=_['defaults'](config['redis'],{'host':_0xc5d6('0xd'),'port':0x18eb});var socket=require(_0xc5d6('0xe'))(new Redis(config[_0xc5d6('0xc')]));require(_0xc5d6('0xf'))[_0xc5d6('0x10')](socket);function respondWithRpcPromise(_0x512efc,_0x54bf5a,_0x3a4319){return new BPromise(function(_0x3e6e07,_0x38e979){return client[_0xc5d6('0x11')](_0x512efc,_0x3a4319)['then'](function(_0xb7fab6){logger[_0xc5d6('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x54bf5a,_0xc5d6('0x13'));logger[_0xc5d6('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x54bf5a,_0xc5d6('0x13'),JSON[_0xc5d6('0x15')](_0xb7fab6));if(_0xb7fab6['error']){if(_0xb7fab6['error']['code']===0x1f4){logger['error'](_0xc5d6('0x16'),_0x54bf5a,_0xb7fab6[_0xc5d6('0x17')][_0xc5d6('0x18')]);return _0x38e979(_0xb7fab6[_0xc5d6('0x17')][_0xc5d6('0x18')]);}logger[_0xc5d6('0x17')](_0xc5d6('0x16'),_0x54bf5a,_0xb7fab6[_0xc5d6('0x17')][_0xc5d6('0x18')]);return _0x3e6e07(_0xb7fab6['error'][_0xc5d6('0x18')]);}else{logger['info'](_0xc5d6('0x16'),_0x54bf5a,_0xc5d6('0x13'));_0x3e6e07(_0xb7fab6[_0xc5d6('0x19')][_0xc5d6('0x18')]);}})[_0xc5d6('0x1a')](function(_0x4df785){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x54bf5a,_0x4df785);_0x38e979(_0x4df785);});});}exports['CreateWhatsappMessage']=function(_0x41e84f){var _0x13655f=this;return new Promise(function(_0x2584d9,_0x395c0b){return db[_0xc5d6('0x1b')]['create'](_0x41e84f['body'],{'raw':_0x41e84f['options']?_0x41e84f[_0xc5d6('0x1c')][_0xc5d6('0x1d')]===undefined?!![]:![]:!![]})[_0xc5d6('0x1e')](function(_0xeb482f){logger[_0xc5d6('0x12')]('CreateWhatsappMessage',_0x41e84f);logger[_0xc5d6('0x14')]('CreateWhatsappMessage',_0x41e84f,JSON[_0xc5d6('0x15')](_0xeb482f));_0x2584d9(_0xeb482f);})[_0xc5d6('0x1a')](function(_0x2557ae){logger[_0xc5d6('0x17')](_0xc5d6('0x1f'),_0x2557ae[_0xc5d6('0x18')],_0x41e84f);_0x395c0b(_0x13655f['error'](0x1f4,_0x2557ae[_0xc5d6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 4e91697..5b9bfe3 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 _0x2662=['register','whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener'];(function(_0x7e32e7,_0x38dd3b){var _0x549de2=function(_0x4a28c4){while(--_0x4a28c4){_0x7e32e7['push'](_0x7e32e7['shift']());}};_0x549de2(++_0x38dd3b);}(_0x2662,0x159));var _0x2266=function(_0x22890f,_0x4ffd4f){_0x22890f=_0x22890f-0x0;var _0x5cf0a3=_0x2662[_0x22890f];return _0x5cf0a3;};'use strict';var WhatsappMessageEvents=require(_0x2266('0x0'));var events=[_0x2266('0x1'),'remove',_0x2266('0x2')];function createListener(_0x284a85,_0xeff31e){return function(_0x41cd57){_0xeff31e[_0x2266('0x3')](_0x284a85,_0x41cd57);};}function removeListener(_0x4eafa8,_0x18234c){return function(){WhatsappMessageEvents[_0x2266('0x4')](_0x4eafa8,_0x18234c);};}exports[_0x2266('0x5')]=function(_0x12ee21){for(var _0x306e80=0x0,_0x430a2a=events['length'];_0x306e80<_0x430a2a;_0x306e80++){var _0x4862b8=events[_0x306e80];var _0xc57137=createListener(_0x2266('0x6')+_0x4862b8,_0x12ee21);WhatsappMessageEvents['on'](_0x4862b8,_0xc57137);}}; \ No newline at end of file +var _0x4b77=['removeListener','register','length','whatsappMessage:','remove','update','emit'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4b77,0x18c));var _0x74b7=function(_0x54efe8,_0x481776){_0x54efe8=_0x54efe8-0x0;var _0x1c305e=_0x4b77[_0x54efe8];return _0x1c305e;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x74b7('0x0'),_0x74b7('0x1')];function createListener(_0xf7222,_0x284da0){return function(_0x122db8){_0x284da0[_0x74b7('0x2')](_0xf7222,_0x122db8);};}function removeListener(_0xf030c5,_0x72f032){return function(){WhatsappMessageEvents[_0x74b7('0x3')](_0xf030c5,_0x72f032);};}exports[_0x74b7('0x4')]=function(_0x2fdd44){for(var _0x51a8dd=0x0,_0x17e99f=events[_0x74b7('0x5')];_0x51a8dd<_0x17e99f;_0x51a8dd++){var _0x2548ce=events[_0x51a8dd];var _0x21f5f3=createListener(_0x74b7('0x6')+_0x2548ce,_0x2fdd44);WhatsappMessageEvents['on'](_0x2548ce,_0x21f5f3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5247825..dd09ef7 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 _0x62fa=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','multer'];(function(_0x3b70ad,_0x4aa3b0){var _0x8bb384=function(_0x176bbf){while(--_0x176bbf){_0x3b70ad['push'](_0x3b70ad['shift']());}};_0x8bb384(++_0x4aa3b0);}(_0x62fa,0x1ec));var _0xa62f=function(_0x4a79fd,_0x429333){_0x4a79fd=_0x4a79fd-0x0;var _0xef2f88=_0x62fa[_0x4a79fd];return _0xef2f88;};'use strict';var multer=require(_0xa62f('0x0'));var util=require(_0xa62f('0x1'));var path=require(_0xa62f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa62f('0x3')]();var fs_extra=require(_0xa62f('0x4'));var auth=require(_0xa62f('0x5'));var interaction=require(_0xa62f('0x6'));var config=require(_0xa62f('0x7'));var controller=require('./whatsappQueue.controller');router[_0xa62f('0x8')]('/',auth[_0xa62f('0x9')](),controller[_0xa62f('0xa')]);router['get'](_0xa62f('0xb'),auth[_0xa62f('0x9')](),controller['describe']);router[_0xa62f('0x8')]('/:id',auth[_0xa62f('0x9')](),controller['show']);router[_0xa62f('0x8')](_0xa62f('0xc'),auth[_0xa62f('0x9')](),controller[_0xa62f('0xd')]);router[_0xa62f('0x8')](_0xa62f('0xe'),auth['isAuthenticated'](),controller[_0xa62f('0xf')]);router[_0xa62f('0x8')](_0xa62f('0x10'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x11')]);router[_0xa62f('0x12')]('/',auth[_0xa62f('0x9')](),controller[_0xa62f('0x13')]);router[_0xa62f('0x12')](_0xa62f('0xe'),auth['isAuthenticated'](),controller[_0xa62f('0x14')]);router['post'](_0xa62f('0x10'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x15')]);router[_0xa62f('0x16')](_0xa62f('0x17'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x18')]);router[_0xa62f('0x19')]('/:id',auth[_0xa62f('0x9')](),controller['destroy']);router['delete'](_0xa62f('0xe'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x1a')]);router['delete']('/:id/users',auth[_0xa62f('0x9')](),controller[_0xa62f('0x1b')]);module[_0xa62f('0x1c')]=router; \ No newline at end of file +var _0x6e02=['describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x1602ab,_0x2502a1){var _0x3321eb=function(_0x1be9d2){while(--_0x1be9d2){_0x1602ab['push'](_0x1602ab['shift']());}};_0x3321eb(++_0x2502a1);}(_0x6e02,0x13f));var _0x26e0=function(_0x3e25bc,_0x1b01f3){_0x3e25bc=_0x3e25bc-0x0;var _0x345958=_0x6e02[_0x3e25bc];return _0x345958;};'use strict';var multer=require(_0x26e0('0x0'));var util=require('util');var path=require(_0x26e0('0x1'));var timeout=require(_0x26e0('0x2'));var express=require(_0x26e0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x26e0('0x4'));var interaction=require(_0x26e0('0x5'));var config=require(_0x26e0('0x6'));var controller=require('./whatsappQueue.controller');router[_0x26e0('0x7')]('/',auth['isAuthenticated'](),controller[_0x26e0('0x8')]);router[_0x26e0('0x7')](_0x26e0('0x9'),auth[_0x26e0('0xa')](),controller[_0x26e0('0xb')]);router[_0x26e0('0x7')](_0x26e0('0xc'),auth['isAuthenticated'](),controller[_0x26e0('0xd')]);router[_0x26e0('0x7')]('/:id/members',auth[_0x26e0('0xa')](),controller[_0x26e0('0xe')]);router['get']('/:id/teams',auth[_0x26e0('0xa')](),controller[_0x26e0('0xf')]);router[_0x26e0('0x7')](_0x26e0('0x10'),auth[_0x26e0('0xa')](),controller[_0x26e0('0x11')]);router[_0x26e0('0x12')]('/',auth[_0x26e0('0xa')](),controller[_0x26e0('0x13')]);router[_0x26e0('0x12')](_0x26e0('0x14'),auth['isAuthenticated'](),controller[_0x26e0('0x15')]);router[_0x26e0('0x12')](_0x26e0('0x10'),auth['isAuthenticated'](),controller[_0x26e0('0x16')]);router[_0x26e0('0x17')](_0x26e0('0xc'),auth[_0x26e0('0xa')](),controller[_0x26e0('0x18')]);router[_0x26e0('0x19')](_0x26e0('0xc'),auth[_0x26e0('0xa')](),controller[_0x26e0('0x1a')]);router[_0x26e0('0x19')](_0x26e0('0x14'),auth[_0x26e0('0xa')](),controller[_0x26e0('0x1b')]);router['delete'](_0x26e0('0x10'),auth[_0x26e0('0xa')](),controller[_0x26e0('0x1c')]);module[_0x26e0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2fe139e..50b2a1b 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 _0xc2cc=['ENUM','beepall','exports','STRING','name'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xc2cc,0x70));var _0xcc2c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc2cc[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0xcc2c('0x0')]={'name':{'type':Sequelize[_0xcc2c('0x1')],'unique':_0xcc2c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc2c('0x3')]('rrmemory',_0xcc2c('0x4'),'roundrobin')},'description':{'type':Sequelize[_0xcc2c('0x1')]}}; \ No newline at end of file +var _0x0b40=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x0b40,0xba));var _0x00b4=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x0b40[_0x576d8a];return _0x3dc3ef;};'use strict';var Sequelize=require('sequelize');module[_0x00b4('0x0')]={'name':{'type':Sequelize[_0x00b4('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x00b4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x00b4('0x3')](_0x00b4('0x4'),_0x00b4('0x5'),_0x00b4('0x6'))},'description':{'type':Sequelize[_0x00b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a392172..7a8b783 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 _0x9aba=['addAgents','omit','userWhatsappQueue:remove','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','then','get','WhatsappQueues','destroy','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','filter','options','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','whatsappPause','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x9aba,0xf8));var _0xa9ab=function(_0x2d777c,_0x321c1f){_0x2d777c=_0x2d777c-0x0;var _0x44d238=_0x9aba[_0x2d777c];return _0x44d238;};'use strict';var BPromise=require(_0xa9ab('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xa9ab('0x1'));var Redis=require(_0xa9ab('0x2'));var qs=require(_0xa9ab('0x3'));var logger=require(_0xa9ab('0x4'))(_0xa9ab('0x5'));var config=require(_0xa9ab('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa9ab('0x7')](config[_0xa9ab('0x8')],{'host':_0xa9ab('0x9'),'port':0x18eb});var socket=require(_0xa9ab('0xa'))(new Redis(config[_0xa9ab('0x8')]));require('./whatsappQueue.socket')[_0xa9ab('0xb')](socket);function respondWithStatusCode(_0x5b27bc,_0x502111){_0x502111=_0x502111||0xcc;return function(_0x33b064){if(_0x33b064){return _0x5b27bc[_0xa9ab('0xc')](_0x502111);}return _0x5b27bc[_0xa9ab('0xd')](_0x502111)['end']();};}function respondWithResult(_0x5c3e71,_0x261c21){_0x261c21=_0x261c21||0xc8;return function(_0x283c35){if(_0x283c35){return _0x5c3e71['status'](_0x261c21)['json'](_0x283c35);}};}function respondWithFilteredResult(_0x1a0d26,_0x28e728){return function(_0x3ff50a){if(_0x3ff50a){var _0x48c094=typeof _0x28e728[_0xa9ab('0xe')]===_0xa9ab('0xf')&&typeof _0x28e728[_0xa9ab('0x10')]===_0xa9ab('0xf');var _0x1e0564=_0x3ff50a[_0xa9ab('0x11')];var _0x1d9660=_0x48c094?0x0:_0x28e728[_0xa9ab('0xe')];var _0x28c044=_0x48c094?_0x3ff50a['count']:_0x28e728[_0xa9ab('0xe')]+_0x28e728[_0xa9ab('0x10')];var _0x5a9bcc;if(_0x28c044>=_0x1e0564){_0x28c044=_0x1e0564;_0x5a9bcc=0xc8;}else{_0x5a9bcc=0xce;}_0x1a0d26[_0xa9ab('0xd')](_0x5a9bcc);return _0x1a0d26[_0xa9ab('0x12')](_0xa9ab('0x13'),_0x1d9660+'-'+_0x28c044+'/'+_0x1e0564)[_0xa9ab('0x14')](_0x3ff50a);}return null;};}function saveUpdates(_0x2ae035){return function(_0x3a5c7e){if(_0x3a5c7e){return _0x3a5c7e['update'](_0x2ae035)[_0xa9ab('0x15')](function(_0x2db314){return _0x2db314;});}return null;};}function removeEntity(_0x6a8dad){return function(_0x2b52d4){if(_0x2b52d4){return _0x2b52d4['destroy']()[_0xa9ab('0x15')](function(){var _0x2e7dd4=_0x2b52d4[_0xa9ab('0x16')]({'plain':!![]});var _0x2e176b=_0xa9ab('0x17');return db['UserProfileResource'][_0xa9ab('0x18')]({'where':{'type':_0x2e176b,'resourceId':_0x2e7dd4['id']}})[_0xa9ab('0x15')](function(){return _0x2b52d4;});})[_0xa9ab('0x15')](function(){_0x6a8dad[_0xa9ab('0xd')](0xcc)[_0xa9ab('0x19')]();});}};}function handleEntityNotFound(_0x4eaf8d){return function(_0x4dee42){if(!_0x4dee42){_0x4eaf8d[_0xa9ab('0xc')](0x194);}return _0x4dee42;};}function handleError(_0x353a8a,_0x13cd30){_0x13cd30=_0x13cd30||0x1f4;return function(_0x431532){logger[_0xa9ab('0x1a')](_0x431532[_0xa9ab('0x1b')]);if(_0x431532[_0xa9ab('0x1c')]){delete _0x431532[_0xa9ab('0x1c')];}_0x353a8a['status'](_0x13cd30)[_0xa9ab('0x1d')](_0x431532);};}exports[_0xa9ab('0x1e')]=function(_0x5af390,_0xa3df99){var _0x5b24ea={};var _0x1c3f5c={'count':0x0,'rows':[]};var _0x2b5ef7=_[_0xa9ab('0x1f')](db[_0xa9ab('0x20')][_0xa9ab('0x21')],function(_0x37ee5e){return{'name':_0x37ee5e[_0xa9ab('0x22')],'type':_0x37ee5e[_0xa9ab('0x23')][_0xa9ab('0x24')]};});_0x5b24ea=qs['getOptions'](_0x2b5ef7,_0x5af390);var _0x16761b={'where':_0x5b24ea[_0xa9ab('0x25')]};return db[_0xa9ab('0x20')][_0xa9ab('0x11')](_0x16761b)[_0xa9ab('0x15')](function(_0x23cb54){_0x1c3f5c['count']=_0x23cb54;_0x5b24ea[_0xa9ab('0x26')]=qs['include'](_0x5af390[_0xa9ab('0x27')]);return db[_0xa9ab('0x20')][_0xa9ab('0x28')](_0x5b24ea);})[_0xa9ab('0x15')](function(_0x41bdef){_0x1c3f5c[_0xa9ab('0x29')]=_0x41bdef;return _0x1c3f5c;})[_0xa9ab('0x15')](respondWithFilteredResult(_0xa3df99,_0x5b24ea))[_0xa9ab('0x2a')](handleError(_0xa3df99,null));};exports[_0xa9ab('0x2b')]=function(_0x594c84,_0x1da95a){var _0x2b6f71={'raw':!![],'where':{'id':_0x594c84[_0xa9ab('0x2c')]['id']}},_0x15a2bb={};_0x15a2bb[_0xa9ab('0x2d')]=_[_0xa9ab('0x2e')](db[_0xa9ab('0x20')][_0xa9ab('0x21')]);_0x15a2bb[_0xa9ab('0x27')]=_[_0xa9ab('0x2e')](_0x594c84[_0xa9ab('0x27')]);_0x15a2bb[_0xa9ab('0x2f')]=_['intersection'](_0x15a2bb['model'],_0x15a2bb['query']);_0x2b6f71[_0xa9ab('0x30')]=_[_0xa9ab('0x31')](_0x15a2bb['model'],qs[_0xa9ab('0x32')](_0x594c84['query'][_0xa9ab('0x32')]));_0x2b6f71[_0xa9ab('0x30')]=_0x2b6f71['attributes'][_0xa9ab('0x33')]?_0x2b6f71[_0xa9ab('0x30')]:_0x15a2bb[_0xa9ab('0x2d')];if(_0x594c84[_0xa9ab('0x27')][_0xa9ab('0x34')]){_0x2b6f71[_0xa9ab('0x26')]=[{'all':!![]}];}_0x2b6f71=_[_0xa9ab('0x35')]({},_0x2b6f71,_0x594c84['options']);return db[_0xa9ab('0x20')][_0xa9ab('0x36')](_0x2b6f71)[_0xa9ab('0x15')](handleEntityNotFound(_0x1da95a,null))['then'](respondWithResult(_0x1da95a,null))['catch'](handleError(_0x1da95a,null));};exports[_0xa9ab('0x37')]=function(_0x260bc8,_0x4c7a1a){return db[_0xa9ab('0x20')][_0xa9ab('0x37')](_0x260bc8[_0xa9ab('0x38')],{})[_0xa9ab('0x15')](function(_0x23766d){var _0x53c34b=_0x260bc8[_0xa9ab('0x39')][_0xa9ab('0x16')]({'plain':!![]});if(!_0x53c34b)throw new Error(_0xa9ab('0x3a'));if(_0x53c34b['role']===_0xa9ab('0x39')){var _0x9c3edc=_0x23766d[_0xa9ab('0x16')]({'plain':!![]});var _0x49bc65=_0xa9ab('0x17');return db[_0xa9ab('0x3b')][_0xa9ab('0x36')]({'where':{'name':_0x49bc65,'userProfileId':_0x53c34b[_0xa9ab('0x3c')]},'raw':!![]})['then'](function(_0x304af5){if(_0x304af5&&_0x304af5['autoAssociation']===0x0){return db[_0xa9ab('0x3d')][_0xa9ab('0x37')]({'name':_0x9c3edc[_0xa9ab('0x1c')],'resourceId':_0x9c3edc['id'],'type':_0x304af5[_0xa9ab('0x1c')],'sectionId':_0x304af5['id']},{})['then'](function(){return _0x23766d;});}else{return _0x23766d;}})[_0xa9ab('0x2a')](function(_0x558705){logger[_0xa9ab('0x1a')](_0xa9ab('0x3e'),_0x558705);throw _0x558705;});}return _0x23766d;})['then'](respondWithResult(_0x4c7a1a,0xc9))[_0xa9ab('0x2a')](handleError(_0x4c7a1a,null));};exports[_0xa9ab('0x3f')]=function(_0x78d834,_0xb97579){if(_0x78d834[_0xa9ab('0x38')]['id']){delete _0x78d834[_0xa9ab('0x38')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x78d834[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0xb97579,null))[_0xa9ab('0x15')](saveUpdates(_0x78d834[_0xa9ab('0x38')],null))[_0xa9ab('0x15')](respondWithResult(_0xb97579,null))['catch'](handleError(_0xb97579,null));};exports[_0xa9ab('0x18')]=function(_0x3cb2df,_0xb55479){return db['WhatsappQueue'][_0xa9ab('0x36')]({'where':{'id':_0x3cb2df[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0xb55479,null))[_0xa9ab('0x15')](removeEntity(_0xb55479,null))[_0xa9ab('0x2a')](handleError(_0xb55479,null));};exports[_0xa9ab('0x40')]=function(_0x235e39,_0x1d2b95){return db[_0xa9ab('0x20')][_0xa9ab('0x40')]()[_0xa9ab('0x15')](respondWithResult(_0x1d2b95,null))[_0xa9ab('0x2a')](handleError(_0x1d2b95,null));};exports[_0xa9ab('0x41')]=function(_0x294c8d,_0xe02981){var _0x47dbf4={'raw':!![],'where':{}},_0x425b2d={},_0x8c2199;return db['WhatsappQueue'][_0xa9ab('0x42')]({'where':{'id':_0x294c8d[_0xa9ab('0x2c')]['id']}})['then'](handleEntityNotFound(_0xe02981,null))[_0xa9ab('0x15')](function(_0x1516b9){if(_0x1516b9){_0x8c2199=_0x1516b9[_0xa9ab('0x16')]({'plain':!![]});_0x425b2d[_0xa9ab('0x2d')]=_[_0xa9ab('0x2e')](db[_0xa9ab('0x43')][_0xa9ab('0x21')]);_0x425b2d['query']=_[_0xa9ab('0x2e')](_0x294c8d[_0xa9ab('0x27')]);_0x425b2d[_0xa9ab('0x2f')]=_['intersection'](_0x425b2d[_0xa9ab('0x2d')],_0x425b2d['query']);_0x47dbf4[_0xa9ab('0x30')]=_[_0xa9ab('0x31')](_0x425b2d[_0xa9ab('0x2d')],qs['fields'](_0x294c8d['query'][_0xa9ab('0x32')]));_0x47dbf4[_0xa9ab('0x30')]=_0x47dbf4[_0xa9ab('0x30')][_0xa9ab('0x33')]?_0x47dbf4[_0xa9ab('0x30')]:_0x425b2d[_0xa9ab('0x2d')];if(!_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0x44')](_0xa9ab('0x45'))){_0x47dbf4[_0xa9ab('0x10')]=qs['limit'](_0x294c8d['query'][_0xa9ab('0x10')]);_0x47dbf4[_0xa9ab('0xe')]=qs[_0xa9ab('0xe')](_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0xe')]);}_0x47dbf4[_0xa9ab('0x46')]=qs['sort'](_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0x47')]);_0x47dbf4[_0xa9ab('0x25')]=qs['filters'](_[_0xa9ab('0x48')](_0x294c8d[_0xa9ab('0x27')],_0x425b2d[_0xa9ab('0x2f')]));_0x47dbf4[_0xa9ab('0x25')]['WhatsappQueueId']=_0x1516b9['id'];if(_0x294c8d[_0xa9ab('0x27')]['filter']){_0x47dbf4[_0xa9ab('0x25')]=_[_0xa9ab('0x35')](_0x47dbf4['where'],{'$or':_[_0xa9ab('0x1f')](_0x47dbf4[_0xa9ab('0x30')],function(_0x199651){var _0x326c25={};_0x326c25[_0x199651]={'$like':'%'+_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0x49')]+'%'};return _0x326c25;})});}_0x47dbf4=_[_0xa9ab('0x35')]({},_0x47dbf4,_0x294c8d[_0xa9ab('0x4a')]);return db[_0xa9ab('0x43')]['findAll'](_0x47dbf4);}})[_0xa9ab('0x15')](function(_0x55016f){if(_0x55016f){return db[_0xa9ab('0x4b')][_0xa9ab('0x4c')]({'where':{'id':_[_0xa9ab('0x1f')](_0x55016f,_0xa9ab('0x4d')),'role':_0xa9ab('0x4e')},'attributes':['id','name','whatsappPause',_0xa9ab('0x4f'),_0xa9ab('0x50')]});}})[_0xa9ab('0x15')](function(_0x2f36e8){if(_0x2f36e8){return{'count':_0x2f36e8['count'],'rows':_[_0xa9ab('0x1f')](_0x2f36e8[_0xa9ab('0x29')],function(_0x28967d){return{'membername':_0x28967d['name'],'UserId':_0x28967d['id'],'queue_name':_0x8c2199[_0xa9ab('0x1c')],'WhatsappQueueId':_0x8c2199['id'],'interface':util[_0xa9ab('0x51')](_0xa9ab('0x52'),'SIP',_0x28967d[_0xa9ab('0x1c')]),'penalty':0x0,'paused':_0x28967d[_0xa9ab('0x53')],'createdAt':_0x28967d[_0xa9ab('0x50')],'updatedAt':_0x28967d[_0xa9ab('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe02981,_0x47dbf4))['catch'](handleError(_0xe02981,null));};exports['getTeams']=function(_0x59a38f,_0x4e9521){var _0x3daef0={};var _0x200423={};var _0x4c7fa7;var _0x1f4751;return db['WhatsappQueue'][_0xa9ab('0x42')]({'where':{'id':_0x59a38f[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0x4e9521,null))[_0xa9ab('0x15')](function(_0x55d512){if(_0x55d512){_0x4c7fa7=_0x55d512;_0x200423[_0xa9ab('0x2d')]=_['keys'](db[_0xa9ab('0x54')][_0xa9ab('0x21')]);_0x200423['query']=_[_0xa9ab('0x2e')](_0x59a38f[_0xa9ab('0x27')]);_0x200423[_0xa9ab('0x2f')]=_['intersection'](_0x200423[_0xa9ab('0x2d')],_0x200423[_0xa9ab('0x27')]);_0x3daef0[_0xa9ab('0x30')]=_['intersection'](_0x200423[_0xa9ab('0x2d')],qs[_0xa9ab('0x32')](_0x59a38f[_0xa9ab('0x27')][_0xa9ab('0x32')]));_0x3daef0[_0xa9ab('0x30')]=_0x3daef0[_0xa9ab('0x30')][_0xa9ab('0x33')]?_0x3daef0[_0xa9ab('0x30')]:_0x200423[_0xa9ab('0x2d')];_0x3daef0[_0xa9ab('0x46')]=qs[_0xa9ab('0x47')](_0x59a38f[_0xa9ab('0x27')]['sort']);_0x3daef0[_0xa9ab('0x25')]=qs[_0xa9ab('0x2f')](_[_0xa9ab('0x48')](_0x59a38f[_0xa9ab('0x27')],_0x200423[_0xa9ab('0x2f')]));if(_0x59a38f[_0xa9ab('0x27')][_0xa9ab('0x49')]){_0x3daef0[_0xa9ab('0x25')]=_[_0xa9ab('0x35')](_0x3daef0[_0xa9ab('0x25')],{'$or':_[_0xa9ab('0x1f')](_0x3daef0[_0xa9ab('0x30')],function(_0x330869){var _0xc619a4={};_0xc619a4[_0x330869]={'$like':'%'+_0x59a38f[_0xa9ab('0x27')]['filter']+'%'};return _0xc619a4;})});}_0x3daef0=_[_0xa9ab('0x35')]({},_0x3daef0,_0x59a38f[_0xa9ab('0x4a')]);return _0x4c7fa7[_0xa9ab('0x55')](_0x3daef0);}})[_0xa9ab('0x15')](function(_0x15fa6d){if(_0x15fa6d){_0x1f4751=_0x15fa6d[_0xa9ab('0x33')];if(!_0x59a38f[_0xa9ab('0x27')]['hasOwnProperty'](_0xa9ab('0x45'))){_0x3daef0[_0xa9ab('0x10')]=qs[_0xa9ab('0x10')](_0x59a38f[_0xa9ab('0x27')]['limit']);_0x3daef0[_0xa9ab('0xe')]=qs[_0xa9ab('0xe')](_0x59a38f['query'][_0xa9ab('0xe')]);}return _0x4c7fa7[_0xa9ab('0x55')](_0x3daef0);}})[_0xa9ab('0x15')](function(_0x2712bd){if(_0x2712bd){return _0x2712bd?{'count':_0x1f4751,'rows':_0x2712bd}:null;}})[_0xa9ab('0x15')](respondWithResult(_0x4e9521,null))['catch'](handleError(_0x4e9521,null));};exports['addTeams']=function(_0x5a0b1e,_0x2a16b3){var _0x54bdfb=_0x5a0b1e[_0xa9ab('0x38')][_0xa9ab('0x56')];return db[_0xa9ab('0x54')][_0xa9ab('0x28')]({'where':{'id':_0x54bdfb},'attributes':['id'],'include':[{'model':db[_0xa9ab('0x4b')],'as':_0xa9ab('0x57'),'attributes':['id','name',_0xa9ab('0x58'),_0xa9ab('0x59'),_0xa9ab('0x5a')],'raw':!![]}]})['then'](function(_0x469122){if(_0x469122){var _0x3f10c2=_[_0xa9ab('0x5b')](_0x469122,function(_0x277a84){var _0xca05cf=_0x277a84[_0xa9ab('0x16')]({'plain':!![]});return _0xca05cf[_0xa9ab('0x57')];});return db[_0xa9ab('0x20')][_0xa9ab('0x36')]({'where':{'id':_0x5a0b1e['params']['id']}})[_0xa9ab('0x15')](function(_0x2ca55e){return db[_0xa9ab('0x5c')]['transaction'](function(_0x5a88bc){return _0x2ca55e[_0xa9ab('0x5d')](_0x54bdfb,{'transaction':_0x5a88bc})['then'](function(){return BPromise['each'](_0x3f10c2,function(_0x14c9b7){return db[_0xa9ab('0x43')][_0xa9ab('0x5e')]({'where':{'UserId':_0x14c9b7['id'],'WhatsappQueueId':_0x5a0b1e['params']['id']},'transaction':_0x5a88bc});});})['then'](function(){_0x3f10c2[_0xa9ab('0x5f')](function(_0x66561b){socket[_0xa9ab('0x60')](_0xa9ab('0x61'),{'UserId':_0x66561b['id'],'WhatsappQueueId':_0x2ca55e['id']});});});});});}})[_0xa9ab('0x15')](respondWithStatusCode(_0x2a16b3,null))[_0xa9ab('0x2a')](handleError(_0x2a16b3,null));};exports[_0xa9ab('0x62')]=function(_0x8299fd,_0x178223){return db['Team'][_0xa9ab('0x28')]({'where':{'id':_0x8299fd[_0xa9ab('0x27')][_0xa9ab('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa9ab('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa9ab('0x15')](handleEntityNotFound(_0x178223,null))[_0xa9ab('0x15')](function(_0x169aec){var _0x3f1dda=_[_0xa9ab('0x1f')](_0x169aec,'id');var _0xb35249=[];var _0x405ac2=[];var _0x3c4abf=squel['select']();_0x3c4abf[_0xa9ab('0x63')](_0xa9ab('0x64'))[_0xa9ab('0x65')]('team_has_whatsapp_queues','tq')[_0xa9ab('0x66')](_0xa9ab('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa9ab('0x25')]('WhatsappQueueId\x20=\x20?',_0x8299fd[_0xa9ab('0x2c')]['id']);for(var _0x13bdb6=0x0;_0x13bdb6<_0x169aec[_0xa9ab('0x33')];_0x13bdb6+=0x1){let _0x10cbf8=_0x169aec[_0x13bdb6];for(var _0x7b175d=0x0;_0x7b175d<_0x10cbf8[_0xa9ab('0x57')][_0xa9ab('0x33')];_0x7b175d+=0x1){let _0x147172=_0x10cbf8['Agents'][_0x7b175d];var _0x187dc2=_0x3c4abf[_0xa9ab('0x68')]();_0x187dc2[_0xa9ab('0x25')]('ut.UserId\x20=\x20?',_0x147172['id']);_0x405ac2[_0xa9ab('0x69')](db[_0xa9ab('0x5c')][_0xa9ab('0x27')](_0x187dc2[_0xa9ab('0x6a')](),{'type':db[_0xa9ab('0x5c')][_0xa9ab('0x6b')][_0xa9ab('0x6c')]})['then'](function(_0x37560d){if(_0x37560d['length']===0x1){return _0x147172['id'];}else{var _0x41e1f4=_[_0xa9ab('0x6d')](_['map'](_0x37560d,_0xa9ab('0x6e')),function(_0x51b560){return _[_0xa9ab('0x6f')](_0x3f1dda,_0x51b560);});if(_0x41e1f4){return _0x147172['id'];}}}));}}return BPromise[_0xa9ab('0x70')](_0x405ac2)[_0xa9ab('0x15')](function(_0x31a602){_0xb35249=_(_0xb35249)['union'](_0x31a602)[_0xa9ab('0x71')]()[_0xa9ab('0x72')]();return db['WhatsappQueue'][_0xa9ab('0x36')]({'where':{'id':_0x8299fd[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](function(_0x3f6337){return db[_0xa9ab('0x5c')][_0xa9ab('0x73')](function(_0x153fd4){return _0x3f6337[_0xa9ab('0x62')](_0x8299fd[_0xa9ab('0x27')][_0xa9ab('0x56')],{'transaction':_0x153fd4})[_0xa9ab('0x15')](function(){if(!_[_0xa9ab('0x74')](_0xb35249)){return _0x3f6337[_0xa9ab('0x75')](_0xb35249,{'transaction':_0x153fd4});}})[_0xa9ab('0x15')](function(){_0xb35249[_0xa9ab('0x5f')](function(_0x5741d4){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x5741d4,'WhatsappQueueId':_0x3f6337['id']});});});});});});})[_0xa9ab('0x15')](respondWithStatusCode(_0x178223,null))['catch'](handleError(_0x178223,null));};exports[_0xa9ab('0x76')]=function(_0x396eae,_0xf9c14){return db[_0xa9ab('0x20')]['find']({'where':{'id':_0x396eae[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0xf9c14,null))[_0xa9ab('0x15')](function(_0x4e303d){if(_0x4e303d){return _0x4e303d[_0xa9ab('0x76')](_0x396eae['body']['ids'],_[_0xa9ab('0x77')](_0x396eae['body'],[_0xa9ab('0x56'),'id'])||{})['spread'](function(_0x1118db){for(var _0x1b49f4=0x0;_0x1b49f4<_0x396eae[_0xa9ab('0x38')][_0xa9ab('0x56')][_0xa9ab('0x33')];_0x1b49f4+=0x1){socket[_0xa9ab('0x60')](_0xa9ab('0x61'),{'UserId':Number(_0x396eae[_0xa9ab('0x38')][_0xa9ab('0x56')][_0x1b49f4]),'WhatsappQueueId':Number(_0x396eae[_0xa9ab('0x2c')]['id'])});}return _0x1118db;});}})[_0xa9ab('0x15')](respondWithResult(_0xf9c14,null))[_0xa9ab('0x2a')](handleError(_0xf9c14,null));};exports[_0xa9ab('0x75')]=function(_0x545923,_0x1cb09e){return db[_0xa9ab('0x20')][_0xa9ab('0x36')]({'where':{'id':_0x545923[_0xa9ab('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1cb09e,null))[_0xa9ab('0x15')](function(_0x23062f){if(_0x23062f){return _0x23062f['removeAgents'](_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')])[_0xa9ab('0x15')](function(){if(_['isArray'](_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')])){for(var _0xf2bed2=0x0;_0xf2bed2<_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')]['length'];_0xf2bed2+=0x1){socket[_0xa9ab('0x60')](_0xa9ab('0x78'),{'UserId':Number(_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')][_0xf2bed2]),'WhatsappQueueId':Number(_0x545923[_0xa9ab('0x2c')]['id'])});}}else{socket[_0xa9ab('0x60')](_0xa9ab('0x78'),{'UserId':Number(_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')]),'WhatsappQueueId':Number(_0x545923[_0xa9ab('0x2c')]['id'])});}});}})[_0xa9ab('0x15')](respondWithStatusCode(_0x1cb09e,null))['catch'](handleError(_0x1cb09e,null));};exports[_0xa9ab('0x79')]=function(_0x1b222d,_0x572490){var _0x5d2699={};var _0x2aba34={};var _0x59093e;var _0x1f6cbc;return db[_0xa9ab('0x20')][_0xa9ab('0x42')]({'where':{'id':_0x1b222d[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0x572490,null))[_0xa9ab('0x15')](function(_0x3b0a6e){if(_0x3b0a6e){_0x59093e=_0x3b0a6e;_0x2aba34[_0xa9ab('0x2d')]=_[_0xa9ab('0x2e')](db[_0xa9ab('0x4b')]['rawAttributes']);_0x2aba34[_0xa9ab('0x27')]=_[_0xa9ab('0x2e')](_0x1b222d['query']);_0x2aba34['filters']=_[_0xa9ab('0x31')](_0x2aba34['model'],_0x2aba34['query']);_0x5d2699[_0xa9ab('0x30')]=_['intersection'](_0x2aba34[_0xa9ab('0x2d')],qs[_0xa9ab('0x32')](_0x1b222d['query'][_0xa9ab('0x32')]));_0x5d2699[_0xa9ab('0x30')]=_0x5d2699[_0xa9ab('0x30')]['length']?_0x5d2699[_0xa9ab('0x30')]:_0x2aba34[_0xa9ab('0x2d')];_0x5d2699[_0xa9ab('0x46')]=qs[_0xa9ab('0x47')](_0x1b222d[_0xa9ab('0x27')][_0xa9ab('0x47')]);_0x5d2699[_0xa9ab('0x25')]=qs[_0xa9ab('0x2f')](_[_0xa9ab('0x48')](_0x1b222d[_0xa9ab('0x27')],_0x2aba34[_0xa9ab('0x2f')]));if(_0x1b222d[_0xa9ab('0x27')]['filter']){_0x5d2699[_0xa9ab('0x25')]=_[_0xa9ab('0x35')](_0x5d2699[_0xa9ab('0x25')],{'$or':_[_0xa9ab('0x1f')](_0x5d2699[_0xa9ab('0x30')],function(_0x1d9a64){var _0x1194b3={};_0x1194b3[_0x1d9a64]={'$like':'%'+_0x1b222d[_0xa9ab('0x27')]['filter']+'%'};return _0x1194b3;})});}_0x5d2699=_[_0xa9ab('0x35')]({},_0x5d2699,_0x1b222d[_0xa9ab('0x4a')]);return _0x59093e[_0xa9ab('0x79')](_0x5d2699);}})[_0xa9ab('0x15')](function(_0x16d484){if(_0x16d484){_0x1f6cbc=_0x16d484['length'];if(!_0x1b222d['query'][_0xa9ab('0x44')](_0xa9ab('0x45'))){_0x5d2699[_0xa9ab('0x10')]=qs[_0xa9ab('0x10')](_0x1b222d[_0xa9ab('0x27')][_0xa9ab('0x10')]);_0x5d2699[_0xa9ab('0xe')]=qs['offset'](_0x1b222d['query']['offset']);}return _0x59093e[_0xa9ab('0x79')](_0x5d2699);}})[_0xa9ab('0x15')](function(_0x40a6d0){if(_0x40a6d0){return _0x40a6d0?{'count':_0x1f6cbc,'rows':_0x40a6d0}:null;}})['then'](respondWithResult(_0x572490,null))[_0xa9ab('0x2a')](handleError(_0x572490,null));}; \ No newline at end of file +var _0xf372=['User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','whatsappPause','getTeams','ids','online','voicePause','interface','flatMap','Agents','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','Team','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','isArray','userWhatsappQueue:remove','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','WhatsappQueues','error','stack','name','send','index','WhatsappQueue','fieldName','type','key','getOptions','where','include','query','findAll','show','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','params','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','filters','WhatsappQueueId','filter','merge','map','UserWhatsappQueue'];(function(_0x2ba179,_0x860aaa){var _0x487e3e=function(_0xcfd809){while(--_0xcfd809){_0x2ba179['push'](_0x2ba179['shift']());}};_0x487e3e(++_0x860aaa);}(_0xf372,0x12e));var _0x2f37=function(_0x58b392,_0x4f51b4){_0x58b392=_0x58b392-0x0;var _0x2a6c15=_0xf372[_0x58b392];return _0x2a6c15;};'use strict';var BPromise=require('bluebird');var util=require(_0x2f37('0x0'));var _=require(_0x2f37('0x1'));var squel=require(_0x2f37('0x2'));var Redis=require(_0x2f37('0x3'));var qs=require(_0x2f37('0x4'));var logger=require(_0x2f37('0x5'))(_0x2f37('0x6'));var config=require(_0x2f37('0x7'));var db=require(_0x2f37('0x8'))['db'];config['redis']=_[_0x2f37('0x9')](config['redis'],{'host':_0x2f37('0xa'),'port':0x18eb});var socket=require(_0x2f37('0xb'))(new Redis(config[_0x2f37('0xc')]));require(_0x2f37('0xd'))['register'](socket);function respondWithStatusCode(_0x4fb105,_0x1a6d18){_0x1a6d18=_0x1a6d18||0xcc;return function(_0x397b2d){if(_0x397b2d){return _0x4fb105[_0x2f37('0xe')](_0x1a6d18);}return _0x4fb105['status'](_0x1a6d18)[_0x2f37('0xf')]();};}function respondWithResult(_0x4c194c,_0x5c2fbb){_0x5c2fbb=_0x5c2fbb||0xc8;return function(_0x3a08f7){if(_0x3a08f7){return _0x4c194c[_0x2f37('0x10')](_0x5c2fbb)['json'](_0x3a08f7);}};}function respondWithFilteredResult(_0x33b9d4,_0x4aecb8){return function(_0x2eaf3d){if(_0x2eaf3d){var _0xe92f45=typeof _0x4aecb8[_0x2f37('0x11')]==='undefined'&&typeof _0x4aecb8['limit']===_0x2f37('0x12');var _0x5a606b=_0x2eaf3d[_0x2f37('0x13')];var _0x2fbe33=_0xe92f45?0x0:_0x4aecb8['offset'];var _0x173869=_0xe92f45?_0x2eaf3d[_0x2f37('0x13')]:_0x4aecb8['offset']+_0x4aecb8[_0x2f37('0x14')];var _0x304e5e;if(_0x173869>=_0x5a606b){_0x173869=_0x5a606b;_0x304e5e=0xc8;}else{_0x304e5e=0xce;}_0x33b9d4['status'](_0x304e5e);return _0x33b9d4[_0x2f37('0x15')](_0x2f37('0x16'),_0x2fbe33+'-'+_0x173869+'/'+_0x5a606b)['json'](_0x2eaf3d);}return null;};}function saveUpdates(_0x4bba1d){return function(_0x23ace7){if(_0x23ace7){return _0x23ace7[_0x2f37('0x17')](_0x4bba1d)['then'](function(_0x1c18fe){return _0x1c18fe;});}return null;};}function removeEntity(_0x474258){return function(_0x2cc770){if(_0x2cc770){return _0x2cc770[_0x2f37('0x18')]()[_0x2f37('0x19')](function(){var _0x450686=_0x2cc770[_0x2f37('0x1a')]({'plain':!![]});var _0x2a16bd=_0x2f37('0x1b');return db['UserProfileResource'][_0x2f37('0x18')]({'where':{'type':_0x2a16bd,'resourceId':_0x450686['id']}})[_0x2f37('0x19')](function(){return _0x2cc770;});})[_0x2f37('0x19')](function(){_0x474258[_0x2f37('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40bbd1){return function(_0x20ac2f){if(!_0x20ac2f){_0x40bbd1[_0x2f37('0xe')](0x194);}return _0x20ac2f;};}function handleError(_0x3a0fee,_0x5a14bd){_0x5a14bd=_0x5a14bd||0x1f4;return function(_0x34b82a){logger[_0x2f37('0x1c')](_0x34b82a[_0x2f37('0x1d')]);if(_0x34b82a[_0x2f37('0x1e')]){delete _0x34b82a[_0x2f37('0x1e')];}_0x3a0fee[_0x2f37('0x10')](_0x5a14bd)[_0x2f37('0x1f')](_0x34b82a);};}exports[_0x2f37('0x20')]=function(_0x332197,_0x440db9){var _0x1e0ce4={};var _0x44c9de={'count':0x0,'rows':[]};var _0x178083=_['map'](db[_0x2f37('0x21')]['rawAttributes'],function(_0x41d9eb){return{'name':_0x41d9eb[_0x2f37('0x22')],'type':_0x41d9eb[_0x2f37('0x23')][_0x2f37('0x24')]};});_0x1e0ce4=qs[_0x2f37('0x25')](_0x178083,_0x332197);var _0x32245b={'where':_0x1e0ce4[_0x2f37('0x26')]};return db[_0x2f37('0x21')]['count'](_0x32245b)[_0x2f37('0x19')](function(_0x5e1675){_0x44c9de['count']=_0x5e1675;_0x1e0ce4[_0x2f37('0x27')]=qs['include'](_0x332197[_0x2f37('0x28')]);return db['WhatsappQueue'][_0x2f37('0x29')](_0x1e0ce4);})[_0x2f37('0x19')](function(_0x3d369b){_0x44c9de['rows']=_0x3d369b;return _0x44c9de;})[_0x2f37('0x19')](respondWithFilteredResult(_0x440db9,_0x1e0ce4))['catch'](handleError(_0x440db9,null));};exports[_0x2f37('0x2a')]=function(_0x10f172,_0x4f0150){var _0x20fd9e={'raw':!![],'where':{'id':_0x10f172['params']['id']}},_0x4e6d2a={};_0x4e6d2a[_0x2f37('0x2b')]=_[_0x2f37('0x2c')](db[_0x2f37('0x21')][_0x2f37('0x2d')]);_0x4e6d2a[_0x2f37('0x28')]=_[_0x2f37('0x2c')](_0x10f172['query']);_0x4e6d2a['filters']=_[_0x2f37('0x2e')](_0x4e6d2a[_0x2f37('0x2b')],_0x4e6d2a[_0x2f37('0x28')]);_0x20fd9e[_0x2f37('0x2f')]=_[_0x2f37('0x2e')](_0x4e6d2a['model'],qs['fields'](_0x10f172[_0x2f37('0x28')][_0x2f37('0x30')]));_0x20fd9e[_0x2f37('0x2f')]=_0x20fd9e[_0x2f37('0x2f')][_0x2f37('0x31')]?_0x20fd9e[_0x2f37('0x2f')]:_0x4e6d2a[_0x2f37('0x2b')];if(_0x10f172['query'][_0x2f37('0x32')]){_0x20fd9e[_0x2f37('0x27')]=[{'all':!![]}];}_0x20fd9e=_['merge']({},_0x20fd9e,_0x10f172[_0x2f37('0x33')]);return db['WhatsappQueue'][_0x2f37('0x34')](_0x20fd9e)[_0x2f37('0x19')](handleEntityNotFound(_0x4f0150,null))[_0x2f37('0x19')](respondWithResult(_0x4f0150,null))[_0x2f37('0x35')](handleError(_0x4f0150,null));};exports[_0x2f37('0x36')]=function(_0x3cbd2c,_0x50cc47){return db['WhatsappQueue']['create'](_0x3cbd2c[_0x2f37('0x37')],{})[_0x2f37('0x19')](function(_0x3c6ade){var _0x209229=_0x3cbd2c[_0x2f37('0x38')][_0x2f37('0x1a')]({'plain':!![]});if(!_0x209229)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x209229[_0x2f37('0x39')]===_0x2f37('0x38')){var _0x163b1a=_0x3c6ade[_0x2f37('0x1a')]({'plain':!![]});var _0x2d58ff=_0x2f37('0x1b');return db[_0x2f37('0x3a')][_0x2f37('0x34')]({'where':{'name':_0x2d58ff,'userProfileId':_0x209229[_0x2f37('0x3b')]},'raw':!![]})[_0x2f37('0x19')](function(_0x1610a8){if(_0x1610a8&&_0x1610a8['autoAssociation']===0x0){return db[_0x2f37('0x3c')][_0x2f37('0x36')]({'name':_0x163b1a[_0x2f37('0x1e')],'resourceId':_0x163b1a['id'],'type':_0x1610a8[_0x2f37('0x1e')],'sectionId':_0x1610a8['id']},{})[_0x2f37('0x19')](function(){return _0x3c6ade;});}else{return _0x3c6ade;}})[_0x2f37('0x35')](function(_0x434103){logger[_0x2f37('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x434103);throw _0x434103;});}return _0x3c6ade;})[_0x2f37('0x19')](respondWithResult(_0x50cc47,0xc9))[_0x2f37('0x35')](handleError(_0x50cc47,null));};exports[_0x2f37('0x17')]=function(_0x27787d,_0xe45db5){if(_0x27787d[_0x2f37('0x37')]['id']){delete _0x27787d[_0x2f37('0x37')]['id'];}return db[_0x2f37('0x21')][_0x2f37('0x34')]({'where':{'id':_0x27787d[_0x2f37('0x3d')]['id']}})[_0x2f37('0x19')](handleEntityNotFound(_0xe45db5,null))[_0x2f37('0x19')](saveUpdates(_0x27787d[_0x2f37('0x37')],null))['then'](respondWithResult(_0xe45db5,null))[_0x2f37('0x35')](handleError(_0xe45db5,null));};exports['destroy']=function(_0x2cfaec,_0x4e8c07){return db[_0x2f37('0x21')][_0x2f37('0x34')]({'where':{'id':_0x2cfaec[_0x2f37('0x3d')]['id']}})[_0x2f37('0x19')](handleEntityNotFound(_0x4e8c07,null))[_0x2f37('0x19')](removeEntity(_0x4e8c07,null))[_0x2f37('0x35')](handleError(_0x4e8c07,null));};exports[_0x2f37('0x3e')]=function(_0x52373e,_0x4972d2){return db['WhatsappQueue'][_0x2f37('0x3e')]()[_0x2f37('0x19')](respondWithResult(_0x4972d2,null))['catch'](handleError(_0x4972d2,null));};exports[_0x2f37('0x3f')]=function(_0x4566c1,_0x31ddde){var _0x356fbd={'raw':!![],'where':{}},_0x3efee2={},_0x3c02dd;return db[_0x2f37('0x21')][_0x2f37('0x40')]({'where':{'id':_0x4566c1[_0x2f37('0x3d')]['id']}})['then'](handleEntityNotFound(_0x31ddde,null))[_0x2f37('0x19')](function(_0x5ef750){if(_0x5ef750){_0x3c02dd=_0x5ef750[_0x2f37('0x1a')]({'plain':!![]});_0x3efee2['model']=_[_0x2f37('0x2c')](db['UserWhatsappQueue'][_0x2f37('0x2d')]);_0x3efee2[_0x2f37('0x28')]=_[_0x2f37('0x2c')](_0x4566c1['query']);_0x3efee2['filters']=_[_0x2f37('0x2e')](_0x3efee2[_0x2f37('0x2b')],_0x3efee2[_0x2f37('0x28')]);_0x356fbd[_0x2f37('0x2f')]=_[_0x2f37('0x2e')](_0x3efee2[_0x2f37('0x2b')],qs[_0x2f37('0x30')](_0x4566c1[_0x2f37('0x28')]['fields']));_0x356fbd[_0x2f37('0x2f')]=_0x356fbd[_0x2f37('0x2f')][_0x2f37('0x31')]?_0x356fbd['attributes']:_0x3efee2['model'];if(!_0x4566c1[_0x2f37('0x28')][_0x2f37('0x41')](_0x2f37('0x42'))){_0x356fbd[_0x2f37('0x14')]=qs['limit'](_0x4566c1[_0x2f37('0x28')][_0x2f37('0x14')]);_0x356fbd[_0x2f37('0x11')]=qs[_0x2f37('0x11')](_0x4566c1[_0x2f37('0x28')][_0x2f37('0x11')]);}_0x356fbd[_0x2f37('0x43')]=qs[_0x2f37('0x44')](_0x4566c1[_0x2f37('0x28')][_0x2f37('0x44')]);_0x356fbd['where']=qs['filters'](_[_0x2f37('0x45')](_0x4566c1[_0x2f37('0x28')],_0x3efee2[_0x2f37('0x46')]));_0x356fbd[_0x2f37('0x26')][_0x2f37('0x47')]=_0x5ef750['id'];if(_0x4566c1[_0x2f37('0x28')][_0x2f37('0x48')]){_0x356fbd[_0x2f37('0x26')]=_[_0x2f37('0x49')](_0x356fbd[_0x2f37('0x26')],{'$or':_[_0x2f37('0x4a')](_0x356fbd['attributes'],function(_0x67890e){var _0x561e95={};_0x561e95[_0x67890e]={'$like':'%'+_0x4566c1[_0x2f37('0x28')][_0x2f37('0x48')]+'%'};return _0x561e95;})});}_0x356fbd=_[_0x2f37('0x49')]({},_0x356fbd,_0x4566c1[_0x2f37('0x33')]);return db[_0x2f37('0x4b')][_0x2f37('0x29')](_0x356fbd);}})['then'](function(_0x327572){if(_0x327572){return db[_0x2f37('0x4c')][_0x2f37('0x4d')]({'where':{'id':_[_0x2f37('0x4a')](_0x327572,_0x2f37('0x4e')),'role':_0x2f37('0x4f')},'attributes':['id','name','whatsappPause',_0x2f37('0x50'),_0x2f37('0x51')]});}})[_0x2f37('0x19')](function(_0x166690){if(_0x166690){return{'count':_0x166690[_0x2f37('0x13')],'rows':_[_0x2f37('0x4a')](_0x166690[_0x2f37('0x52')],function(_0xe17794){return{'membername':_0xe17794[_0x2f37('0x1e')],'UserId':_0xe17794['id'],'queue_name':_0x3c02dd[_0x2f37('0x1e')],'WhatsappQueueId':_0x3c02dd['id'],'interface':util[_0x2f37('0x53')](_0x2f37('0x54'),_0x2f37('0x55'),_0xe17794[_0x2f37('0x1e')]),'penalty':0x0,'paused':_0xe17794[_0x2f37('0x56')],'createdAt':_0xe17794[_0x2f37('0x51')],'updatedAt':_0xe17794[_0x2f37('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2f37('0x19')](respondWithFilteredResult(_0x31ddde,_0x356fbd))[_0x2f37('0x35')](handleError(_0x31ddde,null));};exports[_0x2f37('0x57')]=function(_0x128ede,_0x375c24){var _0x426fe6={};var _0x214124={};var _0x3a144f;var _0x5c17c0;return db[_0x2f37('0x21')][_0x2f37('0x40')]({'where':{'id':_0x128ede['params']['id']}})['then'](handleEntityNotFound(_0x375c24,null))['then'](function(_0x495392){if(_0x495392){_0x3a144f=_0x495392;_0x214124[_0x2f37('0x2b')]=_['keys'](db['Team']['rawAttributes']);_0x214124[_0x2f37('0x28')]=_['keys'](_0x128ede[_0x2f37('0x28')]);_0x214124[_0x2f37('0x46')]=_[_0x2f37('0x2e')](_0x214124[_0x2f37('0x2b')],_0x214124[_0x2f37('0x28')]);_0x426fe6[_0x2f37('0x2f')]=_['intersection'](_0x214124['model'],qs[_0x2f37('0x30')](_0x128ede[_0x2f37('0x28')][_0x2f37('0x30')]));_0x426fe6[_0x2f37('0x2f')]=_0x426fe6[_0x2f37('0x2f')][_0x2f37('0x31')]?_0x426fe6['attributes']:_0x214124[_0x2f37('0x2b')];_0x426fe6[_0x2f37('0x43')]=qs[_0x2f37('0x44')](_0x128ede[_0x2f37('0x28')][_0x2f37('0x44')]);_0x426fe6[_0x2f37('0x26')]=qs[_0x2f37('0x46')](_[_0x2f37('0x45')](_0x128ede[_0x2f37('0x28')],_0x214124['filters']));if(_0x128ede[_0x2f37('0x28')][_0x2f37('0x48')]){_0x426fe6[_0x2f37('0x26')]=_['merge'](_0x426fe6[_0x2f37('0x26')],{'$or':_[_0x2f37('0x4a')](_0x426fe6[_0x2f37('0x2f')],function(_0x54c912){var _0x54545e={};_0x54545e[_0x54c912]={'$like':'%'+_0x128ede[_0x2f37('0x28')][_0x2f37('0x48')]+'%'};return _0x54545e;})});}_0x426fe6=_['merge']({},_0x426fe6,_0x128ede[_0x2f37('0x33')]);return _0x3a144f[_0x2f37('0x57')](_0x426fe6);}})['then'](function(_0x18c9de){if(_0x18c9de){_0x5c17c0=_0x18c9de[_0x2f37('0x31')];if(!_0x128ede['query'][_0x2f37('0x41')]('nolimit')){_0x426fe6['limit']=qs[_0x2f37('0x14')](_0x128ede['query'][_0x2f37('0x14')]);_0x426fe6[_0x2f37('0x11')]=qs[_0x2f37('0x11')](_0x128ede[_0x2f37('0x28')][_0x2f37('0x11')]);}return _0x3a144f['getTeams'](_0x426fe6);}})[_0x2f37('0x19')](function(_0x10f737){if(_0x10f737){return _0x10f737?{'count':_0x5c17c0,'rows':_0x10f737}:null;}})[_0x2f37('0x19')](respondWithResult(_0x375c24,null))[_0x2f37('0x35')](handleError(_0x375c24,null));};exports['addTeams']=function(_0x5a8fd8,_0x791bea){var _0x1c51be=_0x5a8fd8['body'][_0x2f37('0x58')];return db['Team'][_0x2f37('0x29')]({'where':{'id':_0x1c51be},'attributes':['id'],'include':[{'model':db[_0x2f37('0x4c')],'as':'Agents','attributes':['id',_0x2f37('0x1e'),_0x2f37('0x59'),_0x2f37('0x5a'),_0x2f37('0x5b')],'raw':!![]}]})['then'](function(_0x3ee675){if(_0x3ee675){var _0x57025e=_[_0x2f37('0x5c')](_0x3ee675,function(_0x4a4235){var _0x59faf1=_0x4a4235[_0x2f37('0x1a')]({'plain':!![]});return _0x59faf1[_0x2f37('0x5d')];});return db[_0x2f37('0x21')]['find']({'where':{'id':_0x5a8fd8['params']['id']}})['then'](function(_0x3a9241){return db['sequelize'][_0x2f37('0x5e')](function(_0x52cf10){return _0x3a9241['addTeams'](_0x1c51be,{'transaction':_0x52cf10})['then'](function(){return BPromise['each'](_0x57025e,function(_0x211901){return db[_0x2f37('0x4b')][_0x2f37('0x5f')]({'where':{'UserId':_0x211901['id'],'WhatsappQueueId':_0x5a8fd8[_0x2f37('0x3d')]['id']},'transaction':_0x52cf10});});})[_0x2f37('0x19')](function(){_0x57025e[_0x2f37('0x60')](function(_0x3db9a4){socket[_0x2f37('0x61')](_0x2f37('0x62'),{'UserId':_0x3db9a4['id'],'WhatsappQueueId':_0x3a9241['id']});});});});});}})[_0x2f37('0x19')](respondWithStatusCode(_0x791bea,null))['catch'](handleError(_0x791bea,null));};exports['removeTeams']=function(_0x580a5c,_0x931026){return db[_0x2f37('0x63')][_0x2f37('0x29')]({'where':{'id':_0x580a5c[_0x2f37('0x28')][_0x2f37('0x58')]},'attributes':['id'],'include':[{'model':db[_0x2f37('0x4c')],'as':_0x2f37('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x2f37('0x19')](handleEntityNotFound(_0x931026,null))[_0x2f37('0x19')](function(_0x48e47f){var _0x546d64=_[_0x2f37('0x4a')](_0x48e47f,'id');var _0x42e9a3=[];var _0x2a9b22=[];var _0x38f294=squel[_0x2f37('0x64')]();_0x38f294['field'](_0x2f37('0x65'))[_0x2f37('0x66')](_0x2f37('0x67'),'tq')[_0x2f37('0x68')](_0x2f37('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2f37('0x6a'),_0x580a5c[_0x2f37('0x3d')]['id']);for(var _0x27e4c8=0x0;_0x27e4c8<_0x48e47f[_0x2f37('0x31')];_0x27e4c8+=0x1){let _0x112bcb=_0x48e47f[_0x27e4c8];for(var _0x105302=0x0;_0x105302<_0x112bcb[_0x2f37('0x5d')]['length'];_0x105302+=0x1){let _0x503a5a=_0x112bcb['Agents'][_0x105302];var _0x29004f=_0x38f294[_0x2f37('0x6b')]();_0x29004f[_0x2f37('0x26')](_0x2f37('0x6c'),_0x503a5a['id']);_0x2a9b22[_0x2f37('0x6d')](db[_0x2f37('0x6e')][_0x2f37('0x28')](_0x29004f['toString'](),{'type':db[_0x2f37('0x6e')]['QueryTypes'][_0x2f37('0x6f')]})[_0x2f37('0x19')](function(_0x5a9f22){if(_0x5a9f22['length']===0x1){return _0x503a5a['id'];}else{var _0x41a1e9=_[_0x2f37('0x70')](_[_0x2f37('0x4a')](_0x5a9f22,_0x2f37('0x71')),function(_0x2d7e27){return _[_0x2f37('0x72')](_0x546d64,_0x2d7e27);});if(_0x41a1e9){return _0x503a5a['id'];}}}));}}return BPromise[_0x2f37('0x73')](_0x2a9b22)[_0x2f37('0x19')](function(_0x28d945){_0x42e9a3=_(_0x42e9a3)[_0x2f37('0x74')](_0x28d945)[_0x2f37('0x75')]()[_0x2f37('0x76')]();return db[_0x2f37('0x21')][_0x2f37('0x34')]({'where':{'id':_0x580a5c[_0x2f37('0x3d')]['id']}})[_0x2f37('0x19')](function(_0x293d3c){return db[_0x2f37('0x6e')][_0x2f37('0x5e')](function(_0xe57f25){return _0x293d3c['removeTeams'](_0x580a5c[_0x2f37('0x28')][_0x2f37('0x58')],{'transaction':_0xe57f25})[_0x2f37('0x19')](function(){if(!_[_0x2f37('0x77')](_0x42e9a3)){return _0x293d3c[_0x2f37('0x78')](_0x42e9a3,{'transaction':_0xe57f25});}})[_0x2f37('0x19')](function(){_0x42e9a3['forEach'](function(_0x24fc53){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x24fc53,'WhatsappQueueId':_0x293d3c['id']});});});});});});})['then'](respondWithStatusCode(_0x931026,null))[_0x2f37('0x35')](handleError(_0x931026,null));};exports[_0x2f37('0x79')]=function(_0x51b56d,_0x3362ca){return db[_0x2f37('0x21')][_0x2f37('0x34')]({'where':{'id':_0x51b56d['params']['id']}})['then'](handleEntityNotFound(_0x3362ca,null))['then'](function(_0x5a4e45){if(_0x5a4e45){return _0x5a4e45[_0x2f37('0x79')](_0x51b56d['body']['ids'],_[_0x2f37('0x7a')](_0x51b56d[_0x2f37('0x37')],[_0x2f37('0x58'),'id'])||{})['spread'](function(_0x4bcf51){for(var _0x42384d=0x0;_0x42384d<_0x51b56d[_0x2f37('0x37')][_0x2f37('0x58')][_0x2f37('0x31')];_0x42384d+=0x1){socket[_0x2f37('0x61')](_0x2f37('0x62'),{'UserId':Number(_0x51b56d['body'][_0x2f37('0x58')][_0x42384d]),'WhatsappQueueId':Number(_0x51b56d[_0x2f37('0x3d')]['id'])});}return _0x4bcf51;});}})['then'](respondWithResult(_0x3362ca,null))[_0x2f37('0x35')](handleError(_0x3362ca,null));};exports[_0x2f37('0x78')]=function(_0x54ab2f,_0x57f721){return db[_0x2f37('0x21')][_0x2f37('0x34')]({'where':{'id':_0x54ab2f[_0x2f37('0x3d')]['id']}})[_0x2f37('0x19')](handleEntityNotFound(_0x57f721,null))[_0x2f37('0x19')](function(_0x500735){if(_0x500735){return _0x500735[_0x2f37('0x78')](_0x54ab2f[_0x2f37('0x28')][_0x2f37('0x58')])['then'](function(){if(_[_0x2f37('0x7b')](_0x54ab2f[_0x2f37('0x28')][_0x2f37('0x58')])){for(var _0x44c2b0=0x0;_0x44c2b0<_0x54ab2f[_0x2f37('0x28')][_0x2f37('0x58')][_0x2f37('0x31')];_0x44c2b0+=0x1){socket[_0x2f37('0x61')](_0x2f37('0x7c'),{'UserId':Number(_0x54ab2f[_0x2f37('0x28')][_0x2f37('0x58')][_0x44c2b0]),'WhatsappQueueId':Number(_0x54ab2f[_0x2f37('0x3d')]['id'])});}}else{socket['emit'](_0x2f37('0x7c'),{'UserId':Number(_0x54ab2f['query'][_0x2f37('0x58')]),'WhatsappQueueId':Number(_0x54ab2f[_0x2f37('0x3d')]['id'])});}});}})['then'](respondWithStatusCode(_0x57f721,null))[_0x2f37('0x35')](handleError(_0x57f721,null));};exports[_0x2f37('0x7d')]=function(_0x22e6dd,_0x159303){var _0x16abb2={};var _0xae938b={};var _0x354f8c;var _0x5dfd9e;return db[_0x2f37('0x21')][_0x2f37('0x40')]({'where':{'id':_0x22e6dd[_0x2f37('0x3d')]['id']}})[_0x2f37('0x19')](handleEntityNotFound(_0x159303,null))[_0x2f37('0x19')](function(_0x3285c3){if(_0x3285c3){_0x354f8c=_0x3285c3;_0xae938b[_0x2f37('0x2b')]=_[_0x2f37('0x2c')](db['User']['rawAttributes']);_0xae938b[_0x2f37('0x28')]=_[_0x2f37('0x2c')](_0x22e6dd[_0x2f37('0x28')]);_0xae938b[_0x2f37('0x46')]=_[_0x2f37('0x2e')](_0xae938b['model'],_0xae938b[_0x2f37('0x28')]);_0x16abb2[_0x2f37('0x2f')]=_['intersection'](_0xae938b[_0x2f37('0x2b')],qs[_0x2f37('0x30')](_0x22e6dd['query']['fields']));_0x16abb2['attributes']=_0x16abb2[_0x2f37('0x2f')]['length']?_0x16abb2['attributes']:_0xae938b[_0x2f37('0x2b')];_0x16abb2['order']=qs[_0x2f37('0x44')](_0x22e6dd[_0x2f37('0x28')][_0x2f37('0x44')]);_0x16abb2[_0x2f37('0x26')]=qs[_0x2f37('0x46')](_['pick'](_0x22e6dd['query'],_0xae938b['filters']));if(_0x22e6dd[_0x2f37('0x28')][_0x2f37('0x48')]){_0x16abb2[_0x2f37('0x26')]=_['merge'](_0x16abb2['where'],{'$or':_['map'](_0x16abb2[_0x2f37('0x2f')],function(_0x30ea17){var _0x3f054d={};_0x3f054d[_0x30ea17]={'$like':'%'+_0x22e6dd[_0x2f37('0x28')][_0x2f37('0x48')]+'%'};return _0x3f054d;})});}_0x16abb2=_[_0x2f37('0x49')]({},_0x16abb2,_0x22e6dd['options']);return _0x354f8c[_0x2f37('0x7d')](_0x16abb2);}})[_0x2f37('0x19')](function(_0x495a67){if(_0x495a67){_0x5dfd9e=_0x495a67[_0x2f37('0x31')];if(!_0x22e6dd[_0x2f37('0x28')][_0x2f37('0x41')]('nolimit')){_0x16abb2['limit']=qs['limit'](_0x22e6dd[_0x2f37('0x28')]['limit']);_0x16abb2[_0x2f37('0x11')]=qs[_0x2f37('0x11')](_0x22e6dd['query'][_0x2f37('0x11')]);}return _0x354f8c[_0x2f37('0x7d')](_0x16abb2);}})['then'](function(_0x3970fd){if(_0x3970fd){return _0x3970fd?{'count':_0x5dfd9e,'rows':_0x3970fd}:null;}})[_0x2f37('0x19')](respondWithResult(_0x159303,null))['catch'](handleError(_0x159303,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 02649f0..f27274e 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 _0x72e3=['exports','events','../../mysqldb','save','update','emit','hasOwnProperty'];(function(_0x5cfe5c,_0x252417){var _0x39d36c=function(_0x210288){while(--_0x210288){_0x5cfe5c['push'](_0x5cfe5c['shift']());}};_0x39d36c(++_0x252417);}(_0x72e3,0x19e));var _0x372e=function(_0x87ce60,_0xeb9bd7){_0x87ce60=_0x87ce60-0x0;var _0x1e8fd8=_0x72e3[_0x87ce60];return _0x1e8fd8;};'use strict';var EventEmitter=require(_0x372e('0x0'));var WhatsappQueue=require(_0x372e('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x372e('0x2'),'afterUpdate':_0x372e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x452883){return function(_0x40da06,_0x326100,_0xabffa5){WhatsappQueueEvents[_0x372e('0x4')](_0x452883+':'+_0x40da06['id'],_0x40da06);WhatsappQueueEvents[_0x372e('0x4')](_0x452883,_0x40da06);_0xabffa5(null);};}for(var e in events){if(events[_0x372e('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x372e('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf3c3=['exports','events','../../mysqldb','WhatsappQueue','save','update','emit','hasOwnProperty','hook'];(function(_0x4d9efa,_0x2c75d3){var _0x4601ef=function(_0x429728){while(--_0x429728){_0x4d9efa['push'](_0x4d9efa['shift']());}};_0x4601ef(++_0x2c75d3);}(_0xf3c3,0xf4));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3f3c('0x0'));var WhatsappQueue=require(_0x3f3c('0x1'))['db'][_0x3f3c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3f3c('0x3'),'afterUpdate':_0x3f3c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d4111){return function(_0x1e91fa,_0x123547,_0x450e61){WhatsappQueueEvents[_0x3f3c('0x5')](_0x3d4111+':'+_0x1e91fa['id'],_0x1e91fa);WhatsappQueueEvents['emit'](_0x3d4111,_0x1e91fa);_0x450e61(null);};}for(var e in events){if(events[_0x3f3c('0x6')](e)){var event=events[e];WhatsappQueue[_0x3f3c('0x7')](e,emitEvent(event));}}module[_0x3f3c('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ba94d71..6612be3 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 _0x3599=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3599,0xab));var _0x9359=function(_0x28b695,_0x84a381){_0x28b695=_0x28b695-0x0;var _0x5c308e=_0x3599[_0x28b695];return _0x5c308e;};'use strict';var _=require(_0x9359('0x0'));var util=require('util');var logger=require(_0x9359('0x1'))(_0x9359('0x2'));var moment=require('moment');var BPromise=require(_0x9359('0x3'));var rp=require(_0x9359('0x4'));var fs=require('fs');var path=require(_0x9359('0x5'));var rimraf=require(_0x9359('0x6'));var config=require(_0x9359('0x7'));var attributes=require(_0x9359('0x8'));module[_0x9359('0x9')]=function(_0x3f8f60,_0x1e84c6){return _0x3f8f60[_0x9359('0xa')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf329=['../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x59a42d,_0x1e7a3e){var _0x209f0d=function(_0x40f1d3){while(--_0x40f1d3){_0x59a42d['push'](_0x59a42d['shift']());}};_0x209f0d(++_0x1e7a3e);}(_0xf329,0xf7));var _0x9f32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf329[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9f32('0x0'));var util=require('util');var logger=require(_0x9f32('0x1'))(_0x9f32('0x2'));var moment=require(_0x9f32('0x3'));var BPromise=require(_0x9f32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f32('0x5'));var attributes=require(_0x9f32('0x6'));module[_0x9f32('0x7')]=function(_0x7f6bd2,_0x1acb9c){return _0x7f6bd2['define'](_0x9f32('0x8'),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 d94418f..2bf2df7 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 _0x4ddb=['../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','WhatsappQueue','options','where','attributes','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1b74b6,_0x3ee400){var _0x28e1f8=function(_0x132d79){while(--_0x132d79){_0x1b74b6['push'](_0x1b74b6['shift']());}};_0x28e1f8(++_0x3ee400);}(_0x4ddb,0x176));var _0xb4dd=function(_0x59a40c,_0x35999f){_0x59a40c=_0x59a40c-0x0;var _0x3cf340=_0x4ddb[_0x59a40c];return _0x3cf340;};'use strict';var _=require(_0xb4dd('0x0'));var util=require(_0xb4dd('0x1'));var moment=require(_0xb4dd('0x2'));var BPromise=require('bluebird');var rs=require(_0xb4dd('0x3'));var fs=require('fs');var Redis=require(_0xb4dd('0x4'));var db=require(_0xb4dd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4dd('0x6'))(_0xb4dd('0x7'));var config=require(_0xb4dd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb4dd('0x9')][_0xb4dd('0xa')]({'port':0x232a});config[_0xb4dd('0xb')]=_['defaults'](config[_0xb4dd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4dd('0xc'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xb4dd('0xd')](socket);function respondWithRpcPromise(_0x5660a9,_0x392607,_0x359528){return new BPromise(function(_0x5b7c8b,_0x28fc0e){return client[_0xb4dd('0xe')](_0x5660a9,_0x359528)[_0xb4dd('0xf')](function(_0x55bf14){logger[_0xb4dd('0x10')](_0xb4dd('0x11'),_0x392607,_0xb4dd('0x12'));logger[_0xb4dd('0x13')](_0xb4dd('0x14'),_0x392607,_0xb4dd('0x12'),JSON['stringify'](_0x55bf14));if(_0x55bf14['error']){if(_0x55bf14['error'][_0xb4dd('0x15')]===0x1f4){logger[_0xb4dd('0x16')](_0xb4dd('0x11'),_0x392607,_0x55bf14[_0xb4dd('0x16')][_0xb4dd('0x17')]);return _0x28fc0e(_0x55bf14[_0xb4dd('0x16')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x392607,_0x55bf14[_0xb4dd('0x16')][_0xb4dd('0x17')]);return _0x5b7c8b(_0x55bf14[_0xb4dd('0x16')][_0xb4dd('0x17')]);}else{logger[_0xb4dd('0x10')](_0xb4dd('0x11'),_0x392607,_0xb4dd('0x12'));_0x5b7c8b(_0x55bf14[_0xb4dd('0x18')]['message']);}})[_0xb4dd('0x19')](function(_0x5babac){logger[_0xb4dd('0x16')](_0xb4dd('0x11'),_0x392607,_0x5babac);_0x28fc0e(_0x5babac);});});}exports['GetWhatsappQueue']=function(_0x50dcc4){var _0x37630c=this;return new Promise(function(_0x55490f,_0x39a2d8){return db[_0xb4dd('0x1a')]['findAll']({'raw':_0x50dcc4[_0xb4dd('0x1b')]?_0x50dcc4['options']['raw']===undefined?!![]:![]:!![],'where':_0x50dcc4[_0xb4dd('0x1b')]?_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1c')]||null:null,'attributes':_0x50dcc4['options']?_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1d')]||null:null,'limit':_0x50dcc4[_0xb4dd('0x1b')]?_0x50dcc4[_0xb4dd('0x1b')]['limit']||null:null,'include':_0x50dcc4['options']?_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1e')]?_[_0xb4dd('0x1f')](_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1e')],function(_0x2a17d6){return{'model':db[_0x2a17d6[_0xb4dd('0x20')]],'as':_0x2a17d6['as'],'attributes':_0x2a17d6[_0xb4dd('0x1d')],'include':_0x2a17d6['include']?_[_0xb4dd('0x1f')](_0x2a17d6['include'],function(_0x59d15a){return{'model':db[_0x59d15a[_0xb4dd('0x20')]],'as':_0x59d15a['as'],'attributes':_0x59d15a[_0xb4dd('0x1d')],'include':_0x59d15a[_0xb4dd('0x1e')]?_['map'](_0x59d15a[_0xb4dd('0x1e')],function(_0x68a950){return{'model':db[_0x68a950[_0xb4dd('0x20')]],'as':_0x68a950['as'],'attributes':_0x68a950[_0xb4dd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb4dd('0xf')](function(_0x27334b){logger[_0xb4dd('0x10')](_0xb4dd('0x21'),_0x50dcc4);logger[_0xb4dd('0x13')](_0xb4dd('0x21'),_0x50dcc4,JSON[_0xb4dd('0x22')](_0x27334b));_0x55490f(_0x27334b);})[_0xb4dd('0x19')](function(_0x342549){logger[_0xb4dd('0x16')](_0xb4dd('0x21'),_0x342549[_0xb4dd('0x17')],_0x50dcc4);_0x39a2d8(_0x37630c[_0xb4dd('0x16')](0x1f4,_0x342549[_0xb4dd('0x17')]));});});};exports[_0xb4dd('0x23')]=function(_0x3305e4){var _0x5108a7=this;return new Promise(function(_0xfef2e,_0xb8d829){return db['WhatsappQueue'][_0xb4dd('0x24')]({'raw':_0x3305e4['options']?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x25')]===undefined?!![]:![]:!![],'where':_0x3305e4['options']?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x1c')]||null:null,'attributes':_0x3305e4[_0xb4dd('0x1b')]?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x1d')]||null:null,'include':_0x3305e4[_0xb4dd('0x1b')]?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x1e')]?_[_0xb4dd('0x1f')](_0x3305e4[_0xb4dd('0x1b')]['include'],function(_0x2852be){return{'model':db[_0x2852be['model']],'as':_0x2852be['as'],'attributes':_0x2852be[_0xb4dd('0x1d')],'include':_0x2852be['include']?_['map'](_0x2852be[_0xb4dd('0x1e')],function(_0x1f691c){return{'model':db[_0x1f691c[_0xb4dd('0x20')]],'as':_0x1f691c['as'],'attributes':_0x1f691c['attributes'],'include':_0x1f691c[_0xb4dd('0x1e')]?_[_0xb4dd('0x1f')](_0x1f691c[_0xb4dd('0x1e')],function(_0xbfd1a2){return{'model':db[_0xbfd1a2[_0xb4dd('0x20')]],'as':_0xbfd1a2['as'],'attributes':_0xbfd1a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4dd('0xf')](function(_0x3bfab8){logger[_0xb4dd('0x10')](_0xb4dd('0x23'),_0x3305e4);logger[_0xb4dd('0x13')](_0xb4dd('0x23'),_0x3305e4,JSON[_0xb4dd('0x22')](_0x3bfab8));_0xfef2e(_0x3bfab8);})[_0xb4dd('0x19')](function(_0x312498){logger[_0xb4dd('0x16')](_0xb4dd('0x23'),_0x312498[_0xb4dd('0x17')],_0x3305e4);_0xb8d829(_0x5108a7[_0xb4dd('0x16')](0x1f4,_0x312498[_0xb4dd('0x17')]));});});}; \ No newline at end of file +var _0x77f5=['request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','catch','find','raw','ShowWhatsappQueue','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x35ba2a,_0xc39fcc){var _0x45b749=function(_0x37e8af){while(--_0x37e8af){_0x35ba2a['push'](_0x35ba2a['shift']());}};_0x45b749(++_0xc39fcc);}(_0x77f5,0x1ce));var _0x577f=function(_0x1bc857,_0xc41a81){_0x1bc857=_0x1bc857-0x0;var _0x3a4adc=_0x77f5[_0x1bc857];return _0x3a4adc;};'use strict';var _=require('lodash');var util=require(_0x577f('0x0'));var moment=require(_0x577f('0x1'));var BPromise=require('bluebird');var rs=require(_0x577f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x577f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x577f('0x4'))('rpc');var config=require(_0x577f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x577f('0x6')][_0x577f('0x7')]({'port':0x232a});config['redis']=_[_0x577f('0x8')](config[_0x577f('0x9')],{'host':_0x577f('0xa'),'port':0x18eb});var socket=require(_0x577f('0xb'))(new Redis(config['redis']));require(_0x577f('0xc'))[_0x577f('0xd')](socket);function respondWithRpcPromise(_0x45e7c1,_0x24c8b2,_0x129d47){return new BPromise(function(_0x4f91ce,_0x45ad94){return client[_0x577f('0xe')](_0x45e7c1,_0x129d47)[_0x577f('0xf')](function(_0x45b8f7){logger[_0x577f('0x10')](_0x577f('0x11'),_0x24c8b2,_0x577f('0x12'));logger[_0x577f('0x13')](_0x577f('0x14'),_0x24c8b2,'request\x20sent',JSON[_0x577f('0x15')](_0x45b8f7));if(_0x45b8f7[_0x577f('0x16')]){if(_0x45b8f7['error'][_0x577f('0x17')]===0x1f4){logger[_0x577f('0x16')](_0x577f('0x11'),_0x24c8b2,_0x45b8f7[_0x577f('0x16')][_0x577f('0x18')]);return _0x45ad94(_0x45b8f7['error'][_0x577f('0x18')]);}logger['error'](_0x577f('0x11'),_0x24c8b2,_0x45b8f7[_0x577f('0x16')][_0x577f('0x18')]);return _0x4f91ce(_0x45b8f7['error'][_0x577f('0x18')]);}else{logger[_0x577f('0x10')](_0x577f('0x11'),_0x24c8b2,_0x577f('0x12'));_0x4f91ce(_0x45b8f7[_0x577f('0x19')][_0x577f('0x18')]);}})['catch'](function(_0x2df65b){logger[_0x577f('0x16')](_0x577f('0x11'),_0x24c8b2,_0x2df65b);_0x45ad94(_0x2df65b);});});}exports[_0x577f('0x1a')]=function(_0x834d0a){var _0x5e3a40=this;return new Promise(function(_0x41dec3,_0xe996d){return db[_0x577f('0x1b')][_0x577f('0x1c')]({'raw':_0x834d0a[_0x577f('0x1d')]?_0x834d0a['options']['raw']===undefined?!![]:![]:!![],'where':_0x834d0a[_0x577f('0x1d')]?_0x834d0a['options'][_0x577f('0x1e')]||null:null,'attributes':_0x834d0a[_0x577f('0x1d')]?_0x834d0a['options']['attributes']||null:null,'limit':_0x834d0a[_0x577f('0x1d')]?_0x834d0a[_0x577f('0x1d')][_0x577f('0x1f')]||null:null,'include':_0x834d0a[_0x577f('0x1d')]?_0x834d0a[_0x577f('0x1d')][_0x577f('0x20')]?_[_0x577f('0x21')](_0x834d0a[_0x577f('0x1d')][_0x577f('0x20')],function(_0x10f203){return{'model':db[_0x10f203[_0x577f('0x22')]],'as':_0x10f203['as'],'attributes':_0x10f203[_0x577f('0x23')],'include':_0x10f203['include']?_['map'](_0x10f203[_0x577f('0x20')],function(_0x1d00d6){return{'model':db[_0x1d00d6[_0x577f('0x22')]],'as':_0x1d00d6['as'],'attributes':_0x1d00d6[_0x577f('0x23')],'include':_0x1d00d6[_0x577f('0x20')]?_[_0x577f('0x21')](_0x1d00d6[_0x577f('0x20')],function(_0x41cb93){return{'model':db[_0x41cb93[_0x577f('0x22')]],'as':_0x41cb93['as'],'attributes':_0x41cb93['attributes']};}):[]};}):[]};}):[]:[]})[_0x577f('0xf')](function(_0x5bff6e){logger[_0x577f('0x10')](_0x577f('0x1a'),_0x834d0a);logger['debug']('GetWhatsappQueue',_0x834d0a,JSON[_0x577f('0x15')](_0x5bff6e));_0x41dec3(_0x5bff6e);})[_0x577f('0x24')](function(_0x2be2da){logger[_0x577f('0x16')](_0x577f('0x1a'),_0x2be2da[_0x577f('0x18')],_0x834d0a);_0xe996d(_0x5e3a40[_0x577f('0x16')](0x1f4,_0x2be2da[_0x577f('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x533fcb){var _0x416667=this;return new Promise(function(_0x528be9,_0x2b7c57){return db[_0x577f('0x1b')][_0x577f('0x25')]({'raw':_0x533fcb[_0x577f('0x1d')]?_0x533fcb[_0x577f('0x1d')][_0x577f('0x26')]===undefined?!![]:![]:!![],'where':_0x533fcb['options']?_0x533fcb[_0x577f('0x1d')][_0x577f('0x1e')]||null:null,'attributes':_0x533fcb[_0x577f('0x1d')]?_0x533fcb[_0x577f('0x1d')]['attributes']||null:null,'include':_0x533fcb[_0x577f('0x1d')]?_0x533fcb[_0x577f('0x1d')][_0x577f('0x20')]?_[_0x577f('0x21')](_0x533fcb[_0x577f('0x1d')][_0x577f('0x20')],function(_0x373dd9){return{'model':db[_0x373dd9['model']],'as':_0x373dd9['as'],'attributes':_0x373dd9[_0x577f('0x23')],'include':_0x373dd9[_0x577f('0x20')]?_[_0x577f('0x21')](_0x373dd9[_0x577f('0x20')],function(_0x2b226a){return{'model':db[_0x2b226a['model']],'as':_0x2b226a['as'],'attributes':_0x2b226a['attributes'],'include':_0x2b226a[_0x577f('0x20')]?_['map'](_0x2b226a[_0x577f('0x20')],function(_0x33324c){return{'model':db[_0x33324c[_0x577f('0x22')]],'as':_0x33324c['as'],'attributes':_0x33324c[_0x577f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x577f('0xf')](function(_0x3b4a7b){logger[_0x577f('0x10')]('ShowWhatsappQueue',_0x533fcb);logger[_0x577f('0x13')](_0x577f('0x27'),_0x533fcb,JSON['stringify'](_0x3b4a7b));_0x528be9(_0x3b4a7b);})[_0x577f('0x24')](function(_0x18f4c3){logger['error'](_0x577f('0x27'),_0x18f4c3['message'],_0x533fcb);_0x2b7c57(_0x416667[_0x577f('0x16')](0x1f4,_0x18f4c3[_0x577f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a2b6eb4..e130cfa 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 _0x5b1b=['update','removeListener','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x5b1b,0x1ca));var _0xb5b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b1b[_0x4a9fb1];return _0x348672;};'use strict';var WhatsappQueueEvents=require(_0xb5b1('0x0'));var events=[_0xb5b1('0x1'),'remove',_0xb5b1('0x2')];function createListener(_0x4a9aa9,_0x535e63){return function(_0x2eb46a){_0x535e63['emit'](_0x4a9aa9,_0x2eb46a);};}function removeListener(_0x5ea92d,_0x3e4452){return function(){WhatsappQueueEvents[_0xb5b1('0x3')](_0x5ea92d,_0x3e4452);};}exports['register']=function(_0x27e104){for(var _0x5d0fd3=0x0,_0x1bab63=events['length'];_0x5d0fd3<_0x1bab63;_0x5d0fd3++){var _0x2786ff=events[_0x5d0fd3];var _0x3a6ebd=createListener(_0xb5b1('0x4')+_0x2786ff,_0x27e104);WhatsappQueueEvents['on'](_0x2786ff,_0x3a6ebd);}}; \ No newline at end of file +var _0xa97b=['removeListener','whatsappQueue:','./whatsappQueue.events','remove','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa97b,0xe0));var _0xba97=function(_0x35de19,_0x231365){_0x35de19=_0x35de19-0x0;var _0x3044cb=_0xa97b[_0x35de19];return _0x3044cb;};'use strict';var WhatsappQueueEvents=require(_0xba97('0x0'));var events=['save',_0xba97('0x1'),_0xba97('0x2')];function createListener(_0x329231,_0x14716c){return function(_0x4dd149){_0x14716c[_0xba97('0x3')](_0x329231,_0x4dd149);};}function removeListener(_0xae46f8,_0x488a48){return function(){WhatsappQueueEvents[_0xba97('0x4')](_0xae46f8,_0x488a48);};}exports['register']=function(_0x50522a){for(var _0x3ab1f5=0x0,_0x3dafe8=events['length'];_0x3ab1f5<_0x3dafe8;_0x3ab1f5++){var _0x19ca63=events[_0x3ab1f5];var _0x4d0722=createListener(_0xba97('0x5')+_0x19ca63,_0x50522a);WhatsappQueueEvents['on'](_0x19ca63,_0x4d0722);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 37fb900..fd21ff1 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 _0xa978=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x3b78a7,_0x5dea18){var _0x38591d=function(_0x2b7c31){while(--_0x2b7c31){_0x3b78a7['push'](_0x3b78a7['shift']());}};_0x38591d(++_0x5dea18);}(_0xa978,0x145));var _0x8a97=function(_0x99b4c0,_0x3bc8a4){_0x99b4c0=_0x99b4c0-0x0;var _0x1eb122=_0xa978[_0x99b4c0];return _0x1eb122;};'use strict';var multer=require(_0x8a97('0x0'));var util=require(_0x8a97('0x1'));var path=require(_0x8a97('0x2'));var timeout=require(_0x8a97('0x3'));var express=require('express');var router=express[_0x8a97('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8a97('0x5'));var interaction=require(_0x8a97('0x6'));var config=require(_0x8a97('0x7'));var controller=require(_0x8a97('0x8'));router[_0x8a97('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a97('0xa')]);router[_0x8a97('0x9')](_0x8a97('0xb'),auth[_0x8a97('0xc')](),controller[_0x8a97('0xd')]);router[_0x8a97('0x9')](_0x8a97('0xe'),auth['isAuthenticated'](),controller[_0x8a97('0xf')]);router[_0x8a97('0x10')]('/',auth[_0x8a97('0xc')](),controller['create']);router[_0x8a97('0x11')](_0x8a97('0xe'),auth[_0x8a97('0xc')](),controller[_0x8a97('0x12')]);router[_0x8a97('0x13')](_0x8a97('0xe'),auth[_0x8a97('0xc')](),controller[_0x8a97('0x14')]);module[_0x8a97('0x15')]=router; \ No newline at end of file +var _0x887e=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','update','/:id','destroy','exports','multer','util'];(function(_0x5b871d,_0x4671ff){var _0x4b8829=function(_0x2b13b9){while(--_0x2b13b9){_0x5b871d['push'](_0x5b871d['shift']());}};_0x4b8829(++_0x4671ff);}(_0x887e,0x106));var _0xe887=function(_0x252670,_0x3ac39c){_0x252670=_0x252670-0x0;var _0x56c48f=_0x887e[_0x252670];return _0x56c48f;};'use strict';var multer=require(_0xe887('0x0'));var util=require(_0xe887('0x1'));var path=require(_0xe887('0x2'));var timeout=require(_0xe887('0x3'));var express=require(_0xe887('0x4'));var router=express['Router']();var fs_extra=require(_0xe887('0x5'));var auth=require(_0xe887('0x6'));var interaction=require(_0xe887('0x7'));var config=require(_0xe887('0x8'));var controller=require(_0xe887('0x9'));router['get']('/',auth[_0xe887('0xa')](),controller[_0xe887('0xb')]);router[_0xe887('0xc')](_0xe887('0xd'),auth[_0xe887('0xa')](),controller[_0xe887('0xe')]);router[_0xe887('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe887('0xf')]);router[_0xe887('0x10')]('/',auth[_0xe887('0xa')](),controller[_0xe887('0x11')]);router['put']('/:id',auth[_0xe887('0xa')](),controller[_0xe887('0x12')]);router['delete'](_0xe887('0x13'),auth[_0xe887('0xa')](),controller[_0xe887('0x14')]);module[_0xe887('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2bfb1f8..d4b5b5f 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(_0x5db28d,_0xb8f363){var _0x174e92=function(_0x112a1b){while(--_0x112a1b){_0x5db28d['push'](_0x5db28d['shift']());}};_0x174e92(++_0xb8f363);}(_0x7a54,0x106));var _0x47a5=function(_0x523ac5,_0xe1eb23){_0x523ac5=_0x523ac5-0x0;var _0x27bebe=_0x7a54[_0x523ac5];return _0x27bebe;};'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(_0x5b5f15,_0xf5fd1c){var _0x5cf302=function(_0x2be9f3){while(--_0x2be9f3){_0x5b5f15['push'](_0x5b5f15['shift']());}};_0x5cf302(++_0xf5fd1c);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 9d3495f..a992c7f 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 _0x4024=['rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x4024,0x89));var _0x4402=function(_0xda7f4f,_0x13c5c7){_0xda7f4f=_0xda7f4f-0x0;var _0x1b9e6e=_0x4024[_0xda7f4f];return _0x1b9e6e;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){_0x258d10['status'](0xcc)[_0x4402('0x15')]();});}};}function handleEntityNotFound(_0x4e1c04,_0x3733cd){return function(_0x5ab28d){if(!_0x5ab28d){_0x4e1c04[_0x4402('0x13')](0x194);}return _0x5ab28d;};}function handleError(_0x211424,_0x5a43d0){_0x5a43d0=_0x5a43d0||0x1f4;return function(_0x15c19f){logger['error'](_0x15c19f['stack']);if(_0x15c19f[_0x4402('0x21')]){delete _0x15c19f[_0x4402('0x21')];}_0x211424[_0x4402('0x14')](_0x5a43d0)[_0x4402('0x22')](_0x15c19f);};}exports[_0x4402('0x23')]=function(_0x514e41,_0x41de44){var _0x52e625={},_0x71da2f={},_0x1e2340={'count':0x0,'rows':[]};var _0x42dd32=_['map'](db[_0x4402('0x24')][_0x4402('0x25')],function(_0x316239){return{'name':_0x316239[_0x4402('0x26')],'type':_0x316239[_0x4402('0x27')][_0x4402('0x28')]};});_0x71da2f[_0x4402('0x29')]=_[_0x4402('0x2a')](_0x42dd32,_0x4402('0x21'));_0x71da2f[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x514e41['query']);_0x71da2f[_0x4402('0x2d')]=_['intersection'](_0x71da2f[_0x4402('0x29')],_0x71da2f['query']);_0x52e625[_0x4402('0x2e')]=_[_0x4402('0x2f')](_0x71da2f[_0x4402('0x29')],qs[_0x4402('0x30')](_0x514e41[_0x4402('0x2b')]['fields']));_0x52e625[_0x4402('0x2e')]=_0x52e625[_0x4402('0x2e')][_0x4402('0x31')]?_0x52e625['attributes']:_0x71da2f[_0x4402('0x29')];if(!_0x514e41[_0x4402('0x2b')]['hasOwnProperty'](_0x4402('0x32'))){_0x52e625[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x514e41[_0x4402('0x2b')][_0x4402('0x19')]);_0x52e625[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x514e41[_0x4402('0x2b')][_0x4402('0x17')]);}_0x52e625['order']=qs[_0x4402('0x33')](_0x514e41[_0x4402('0x2b')][_0x4402('0x33')]);_0x52e625['where']=qs[_0x4402('0x2d')](_[_0x4402('0x34')](_0x514e41['query'],_0x71da2f['filters']),_0x42dd32);if(_0x514e41[_0x4402('0x2b')][_0x4402('0x35')]){_0x52e625[_0x4402('0x36')]=_[_0x4402('0x37')](_0x52e625['where'],{'$or':_['map'](_0x42dd32,function(_0x4b0672){if(_0x4b0672[_0x4402('0x27')]!==_0x4402('0x38')){var _0xcbfa06={};_0xcbfa06[_0x4b0672[_0x4402('0x21')]]={'$like':'%'+_0x514e41['query'][_0x4402('0x35')]+'%'};return _0xcbfa06;}})});}_0x52e625=_[_0x4402('0x37')]({},_0x52e625,_0x514e41[_0x4402('0x39')]);var _0x57843d={'where':_0x52e625[_0x4402('0x36')]};return db['WhatsappQueueReport'][_0x4402('0x1a')](_0x57843d)[_0x4402('0x1f')](function(_0x5c74b1){_0x1e2340[_0x4402('0x1a')]=_0x5c74b1;if(_0x514e41['query'][_0x4402('0x3a')]){_0x52e625[_0x4402('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x4402('0x3c')](_0x52e625);})[_0x4402('0x1f')](function(_0x250f09){_0x1e2340[_0x4402('0x3d')]=_0x250f09;return _0x1e2340;})['then'](respondWithFilteredResult(_0x41de44,_0x52e625))['catch'](handleError(_0x41de44,null));};exports[_0x4402('0x3e')]=function(_0x47a3a3,_0x3a589b){var _0x2a6d78={'raw':!![],'where':{'id':_0x47a3a3[_0x4402('0x3f')]['id']}},_0xb9cf85={};_0xb9cf85[_0x4402('0x29')]=_[_0x4402('0x2c')](db[_0x4402('0x24')][_0x4402('0x25')]);_0xb9cf85[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x47a3a3['query']);_0xb9cf85[_0x4402('0x2d')]=_[_0x4402('0x2f')](_0xb9cf85['model'],_0xb9cf85[_0x4402('0x2b')]);_0x2a6d78[_0x4402('0x2e')]=_['intersection'](_0xb9cf85[_0x4402('0x29')],qs[_0x4402('0x30')](_0x47a3a3[_0x4402('0x2b')][_0x4402('0x30')]));_0x2a6d78[_0x4402('0x2e')]=_0x2a6d78['attributes'][_0x4402('0x31')]?_0x2a6d78[_0x4402('0x2e')]:_0xb9cf85[_0x4402('0x29')];if(_0x47a3a3[_0x4402('0x2b')][_0x4402('0x3a')]){_0x2a6d78[_0x4402('0x3b')]=[{'all':!![]}];}_0x2a6d78=_[_0x4402('0x37')]({},_0x2a6d78,_0x47a3a3[_0x4402('0x39')]);return db[_0x4402('0x24')][_0x4402('0x40')](_0x2a6d78)[_0x4402('0x1f')](handleEntityNotFound(_0x3a589b,null))['then'](respondWithResult(_0x3a589b,null))[_0x4402('0x41')](handleError(_0x3a589b,null));};exports['create']=function(_0xc45af6,_0x34ce00){return db['WhatsappQueueReport'][_0x4402('0x42')](_0xc45af6[_0x4402('0x43')],{})[_0x4402('0x1f')](respondWithResult(_0x34ce00,0xc9))[_0x4402('0x41')](handleError(_0x34ce00,null));};exports[_0x4402('0x1e')]=function(_0x2503eb,_0x5b094b){if(_0x2503eb[_0x4402('0x43')]['id']){delete _0x2503eb[_0x4402('0x43')]['id'];}return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x2503eb[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x5b094b,null))[_0x4402('0x1f')](saveUpdates(_0x2503eb[_0x4402('0x43')],null))[_0x4402('0x1f')](respondWithResult(_0x5b094b,null))['catch'](handleError(_0x5b094b,null));};exports['destroy']=function(_0x5ab12b,_0x4c2d2e){return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x5ab12b[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4c2d2e,null))['then'](removeEntity(_0x4c2d2e,null))[_0x4402('0x41')](handleError(_0x4c2d2e,null));};exports[_0x4402('0x44')]=function(_0x203b33,_0x2a4ea7){return db[_0x4402('0x24')][_0x4402('0x44')]()[_0x4402('0x1f')](respondWithResult(_0x2a4ea7,null))['catch'](handleError(_0x2a4ea7,null));}; \ No newline at end of file +var _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','error','name','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x365852,_0x5f15eb){var _0x34dc81=function(_0x4a1d9d){while(--_0x4a1d9d){_0x365852['push'](_0x365852['shift']());}};_0x34dc81(++_0x5f15eb);}(_0x5b12,0xa3));var _0x25b1=function(_0x1ba55c,_0xa4fc9){_0x1ba55c=_0x1ba55c-0x0;var _0x192957=_0x5b12[_0x1ba55c];return _0x192957;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['WhatsappQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4b67f95..99dc822 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 _0x4b7b=['exports','define','WhatsappQueueReport','uniqueid','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4b7b,0x16c));var _0xb4b7=function(_0x571a27,_0x2dcdfe){_0x571a27=_0x571a27-0x0;var _0x46aef0=_0x4b7b[_0x571a27];return _0x46aef0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb4b7('0x0'));var moment=require(_0xb4b7('0x1'));var BPromise=require(_0xb4b7('0x2'));var rp=require(_0xb4b7('0x3'));var fs=require('fs');var path=require(_0xb4b7('0x4'));var rimraf=require(_0xb4b7('0x5'));var config=require(_0xb4b7('0x6'));var attributes=require(_0xb4b7('0x7'));module[_0xb4b7('0x8')]=function(_0x58552c,_0x287bb0){return _0x58552c[_0xb4b7('0x9')](_0xb4b7('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb4b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59c6=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x310e05,_0x198e46){var _0x4daccc=function(_0x57478e){while(--_0x57478e){_0x310e05['push'](_0x310e05['shift']());}};_0x4daccc(++_0x198e46);}(_0x59c6,0xc9));var _0x659c=function(_0x4a8893,_0x38f6ee){_0x4a8893=_0x4a8893-0x0;var _0x2b6e06=_0x59c6[_0x4a8893];return _0x2b6e06;};'use strict';var _=require(_0x659c('0x0'));var util=require(_0x659c('0x1'));var logger=require(_0x659c('0x2'))(_0x659c('0x3'));var moment=require(_0x659c('0x4'));var BPromise=require(_0x659c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x659c('0x6'));var rimraf=require(_0x659c('0x7'));var config=require(_0x659c('0x8'));var attributes=require(_0x659c('0x9'));module[_0x659c('0xa')]=function(_0x15a6c6,_0x47ad27){return _0x15a6c6[_0x659c('0xb')](_0x659c('0xc'),attributes,{'tableName':_0x659c('0xd'),'paranoid':![],'indexes':[{'name':_0x659c('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c517dc1..aff5ca3 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 _0x0c49=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','moment'];(function(_0x32aa8b,_0x1041d1){var _0x1a8c56=function(_0x2f87f0){while(--_0x2f87f0){_0x32aa8b['push'](_0x32aa8b['shift']());}};_0x1a8c56(++_0x1041d1);}(_0x0c49,0x13e));var _0x90c4=function(_0x6ed7f7,_0x38aabf){_0x6ed7f7=_0x6ed7f7-0x0;var _0x7fd93=_0x0c49[_0x6ed7f7];return _0x7fd93;};'use strict';var _=require(_0x90c4('0x0'));var util=require('util');var moment=require(_0x90c4('0x1'));var BPromise=require(_0x90c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90c4('0x3'))['db'];var utils=require(_0x90c4('0x4'));var logger=require('../../config/logger')(_0x90c4('0x5'));var config=require(_0x90c4('0x6'));var jayson=require(_0x90c4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x146d97,_0x1e9126,_0x1e6a2e){return new BPromise(function(_0x2ebb33,_0x3f4b01){return client[_0x90c4('0x8')](_0x146d97,_0x1e6a2e)[_0x90c4('0x9')](function(_0xb9d0f2){logger[_0x90c4('0xa')](_0x90c4('0xb'),_0x1e9126,_0x90c4('0xc'));logger[_0x90c4('0xd')](_0x90c4('0xe'),_0x1e9126,'request\x20sent',JSON[_0x90c4('0xf')](_0xb9d0f2));if(_0xb9d0f2[_0x90c4('0x10')]){if(_0xb9d0f2['error'][_0x90c4('0x11')]===0x1f4){logger[_0x90c4('0x10')](_0x90c4('0xb'),_0x1e9126,_0xb9d0f2[_0x90c4('0x10')]['message']);return _0x3f4b01(_0xb9d0f2[_0x90c4('0x10')][_0x90c4('0x12')]);}logger[_0x90c4('0x10')](_0x90c4('0xb'),_0x1e9126,_0xb9d0f2[_0x90c4('0x10')][_0x90c4('0x12')]);return _0x2ebb33(_0xb9d0f2[_0x90c4('0x10')][_0x90c4('0x12')]);}else{logger[_0x90c4('0xa')](_0x90c4('0xb'),_0x1e9126,_0x90c4('0xc'));_0x2ebb33(_0xb9d0f2[_0x90c4('0x13')]['message']);}})[_0x90c4('0x14')](function(_0x20c44d){logger[_0x90c4('0x10')](_0x90c4('0xb'),_0x1e9126,_0x20c44d);_0x3f4b01(_0x20c44d);});});}exports[_0x90c4('0x15')]=function(_0x27acf7){var _0x468420=this;return new Promise(function(_0x2bfb43,_0x5c2765){return db[_0x90c4('0x16')][_0x90c4('0x17')](_0x27acf7[_0x90c4('0x18')],{'raw':_0x27acf7[_0x90c4('0x19')]?_0x27acf7[_0x90c4('0x19')][_0x90c4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2001af){logger[_0x90c4('0xa')](_0x90c4('0x15'),_0x27acf7);logger[_0x90c4('0xd')](_0x90c4('0x15'),_0x27acf7,JSON[_0x90c4('0xf')](_0x2001af));_0x2bfb43(_0x2001af);})[_0x90c4('0x14')](function(_0x9fd373){logger[_0x90c4('0x10')]('CreateWhatsappQueueReport',_0x9fd373[_0x90c4('0x12')],_0x27acf7);_0x5c2765(_0x468420[_0x90c4('0x10')](0x1f4,_0x9fd373[_0x90c4('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x555356){var _0x48b2b5=this;return new Promise(function(_0x3c3b40,_0x55ef2f){return db[_0x90c4('0x16')][_0x90c4('0x1b')](_0x555356[_0x90c4('0x18')],{'raw':_0x555356['options']?_0x555356[_0x90c4('0x19')][_0x90c4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555356['options']?_0x555356[_0x90c4('0x19')][_0x90c4('0x1c')]||null:null,'attributes':_0x555356[_0x90c4('0x19')]?_0x555356[_0x90c4('0x19')][_0x90c4('0x1d')]||null:null,'limit':_0x555356[_0x90c4('0x19')]?_0x555356['options'][_0x90c4('0x1e')]||null:null})['then'](function(_0x1a778a){logger[_0x90c4('0xa')](_0x90c4('0x1f'),_0x555356);logger['debug'](_0x90c4('0x1f'),_0x555356,JSON[_0x90c4('0xf')](_0x1a778a));_0x3c3b40(_0x1a778a);})[_0x90c4('0x14')](function(_0x48d25b){logger[_0x90c4('0x10')](_0x90c4('0x1f'),_0x48d25b[_0x90c4('0x12')],_0x555356);_0x55ef2f(_0x48b2b5['error'](0x1f4,_0x48d25b[_0x90c4('0x12')]));});});}; \ No newline at end of file +var _0x90f0=['raw','CreateWhatsappQueueReport','stringify','catch','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','WhatsappQueueReport','body','options'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x90f0,0x19f));var _0x090f=function(_0x430678,_0x50ccc2){_0x430678=_0x430678-0x0;var _0xca6e8b=_0x90f0[_0x430678];return _0xca6e8b;};'use strict';var _=require(_0x090f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x090f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x090f('0x2'));var logger=require('../../config/logger')(_0x090f('0x3'));var config=require(_0x090f('0x4'));var jayson=require(_0x090f('0x5'));var client=jayson[_0x090f('0x6')][_0x090f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x250ed1,_0x374e61,_0x46df1c){return new BPromise(function(_0x4b87b1,_0x2f0fe5){return client['request'](_0x250ed1,_0x46df1c)[_0x090f('0x8')](function(_0x42f840){logger[_0x090f('0x9')](_0x090f('0xa'),_0x374e61,_0x090f('0xb'));logger[_0x090f('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x374e61,_0x090f('0xb'),JSON['stringify'](_0x42f840));if(_0x42f840[_0x090f('0xd')]){if(_0x42f840[_0x090f('0xd')][_0x090f('0xe')]===0x1f4){logger['error'](_0x090f('0xa'),_0x374e61,_0x42f840[_0x090f('0xd')]['message']);return _0x2f0fe5(_0x42f840[_0x090f('0xd')][_0x090f('0xf')]);}logger['error'](_0x090f('0xa'),_0x374e61,_0x42f840[_0x090f('0xd')][_0x090f('0xf')]);return _0x4b87b1(_0x42f840[_0x090f('0xd')]['message']);}else{logger['info'](_0x090f('0xa'),_0x374e61,_0x090f('0xb'));_0x4b87b1(_0x42f840[_0x090f('0x10')][_0x090f('0xf')]);}})['catch'](function(_0x54d9f1){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x374e61,_0x54d9f1);_0x2f0fe5(_0x54d9f1);});});}exports['CreateWhatsappQueueReport']=function(_0x5e09a5){var _0x8537a3=this;return new Promise(function(_0x536dcd,_0x31d0f3){return db[_0x090f('0x11')]['create'](_0x5e09a5[_0x090f('0x12')],{'raw':_0x5e09a5['options']?_0x5e09a5[_0x090f('0x13')][_0x090f('0x14')]===undefined?!![]:![]:!![]})[_0x090f('0x8')](function(_0x48d8e0){logger[_0x090f('0x9')](_0x090f('0x15'),_0x5e09a5);logger[_0x090f('0xc')](_0x090f('0x15'),_0x5e09a5,JSON[_0x090f('0x16')](_0x48d8e0));_0x536dcd(_0x48d8e0);})[_0x090f('0x17')](function(_0x212104){logger['error'](_0x090f('0x15'),_0x212104[_0x090f('0xf')],_0x5e09a5);_0x31d0f3(_0x8537a3[_0x090f('0xd')](0x1f4,_0x212104[_0x090f('0xf')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x46993a){var _0x2a8a9e=this;return new Promise(function(_0x32f448,_0x4e0e19){return db[_0x090f('0x11')][_0x090f('0x18')](_0x46993a[_0x090f('0x12')],{'raw':_0x46993a[_0x090f('0x13')]?_0x46993a[_0x090f('0x13')][_0x090f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46993a['options']?_0x46993a['options'][_0x090f('0x19')]||null:null,'attributes':_0x46993a[_0x090f('0x13')]?_0x46993a[_0x090f('0x13')][_0x090f('0x1a')]||null:null,'limit':_0x46993a['options']?_0x46993a['options'][_0x090f('0x1b')]||null:null})[_0x090f('0x8')](function(_0x527d4d){logger[_0x090f('0x9')]('UpdateWhatsappQueueReport',_0x46993a);logger[_0x090f('0xc')](_0x090f('0x1c'),_0x46993a,JSON[_0x090f('0x16')](_0x527d4d));_0x32f448(_0x527d4d);})[_0x090f('0x17')](function(_0x48d397){logger[_0x090f('0xd')](_0x090f('0x1c'),_0x48d397[_0x090f('0xf')],_0x46993a);_0x4e0e19(_0x2a8a9e[_0x090f('0xd')](0x1f4,_0x48d397[_0x090f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3982650..b62ced9 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 _0x7667=['/describe','isAuthenticated','describe','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','index','get'];(function(_0xbfd9b8,_0x25772a){var _0x3f021=function(_0x5a55ef){while(--_0x5a55ef){_0xbfd9b8['push'](_0xbfd9b8['shift']());}};_0x3f021(++_0x25772a);}(_0x7667,0x19a));var _0x7766=function(_0x30d385,_0x74aea){_0x30d385=_0x30d385-0x0;var _0x4c594c=_0x7667[_0x30d385];return _0x4c594c;};'use strict';var multer=require(_0x7766('0x0'));var util=require('util');var path=require(_0x7766('0x1'));var timeout=require(_0x7766('0x2'));var express=require('express');var router=express[_0x7766('0x3')]();var fs_extra=require(_0x7766('0x4'));var auth=require(_0x7766('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7766('0x6'));var controller=require(_0x7766('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7766('0x8')]);router[_0x7766('0x9')](_0x7766('0xa'),auth[_0x7766('0xb')](),controller[_0x7766('0xc')]);router[_0x7766('0x9')]('/:id',auth[_0x7766('0xb')](),controller[_0x7766('0xd')]);router['post']('/',auth[_0x7766('0xb')](),controller[_0x7766('0xe')]);router[_0x7766('0xf')](_0x7766('0x10'),auth[_0x7766('0xb')](),controller[_0x7766('0x11')]);router['delete'](_0x7766('0x10'),auth[_0x7766('0xb')](),controller[_0x7766('0x12')]);module[_0x7766('0x13')]=router; \ No newline at end of file +var _0x81ca=['index','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x5e9580,_0x2f979c){var _0x58e0b0=function(_0xd5fd1){while(--_0xd5fd1){_0x5e9580['push'](_0x5e9580['shift']());}};_0x58e0b0(++_0x2f979c);}(_0x81ca,0xa4));var _0xa81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81ca[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa81c('0x0'));var util=require(_0xa81c('0x1'));var path=require(_0xa81c('0x2'));var timeout=require(_0xa81c('0x3'));var express=require(_0xa81c('0x4'));var router=express[_0xa81c('0x5')]();var fs_extra=require(_0xa81c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa81c('0x7'));var config=require(_0xa81c('0x8'));var controller=require(_0xa81c('0x9'));router[_0xa81c('0xa')]('/',auth[_0xa81c('0xb')](),controller[_0xa81c('0xc')]);router['get'](_0xa81c('0xd'),auth['isAuthenticated'](),controller[_0xa81c('0xe')]);router['get'](_0xa81c('0xf'),auth['isAuthenticated'](),controller[_0xa81c('0x10')]);router['post']('/',auth[_0xa81c('0xb')](),controller[_0xa81c('0x11')]);router[_0xa81c('0x12')]('/:id',auth[_0xa81c('0xb')](),controller[_0xa81c('0x13')]);router[_0xa81c('0x14')](_0xa81c('0xf'),auth['isAuthenticated'](),controller[_0xa81c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 68078f6..bd1944b 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 _0xc2da=['queue','DATE','sequelize','STRING','account'];(function(_0x315a14,_0x1e079b){var _0x505bec=function(_0x4f4ed9){while(--_0x4f4ed9){_0x315a14['push'](_0x315a14['shift']());}};_0x505bec(++_0x1e079b);}(_0xc2da,0x124));var _0xac2d=function(_0x526876,_0x2473ec){_0x526876=_0x526876-0x0;var _0x379ab5=_0xc2da[_0x526876];return _0x379ab5;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xac2d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xac2d('0x2'),'agent',_0xac2d('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xac2d('0x4')]}}; \ No newline at end of file +var _0x161a=['STRING','ENUM','agent','DATE'];(function(_0x193f69,_0x55d35e){var _0x270a75=function(_0xdbcec){while(--_0xdbcec){_0x193f69['push'](_0x193f69['shift']());}};_0x270a75(++_0x55d35e);}(_0x161a,0x140));var _0xa161=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x161a[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xa161('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xa161('0x1')]('account',_0xa161('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa161('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 58bb049..bd5b6de 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 _0xdd34=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','merge','where','options','WhatsappTransferReport','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xdd34,0x1db));var _0x4dd3=function(_0x424a38,_0x4b82f0){_0x424a38=_0x424a38-0x0;var _0x928447=_0xdd34[_0x424a38];return _0x928447;};'use strict';var emlformat=require(_0x4dd3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4dd3('0x1'));var rp=require('request-promise');var moment=require(_0x4dd3('0x2'));var BPromise=require(_0x4dd3('0x3'));var Mustache=require(_0x4dd3('0x4'));var util=require('util');var path=require(_0x4dd3('0x5'));var sox=require(_0x4dd3('0x6'));var csv=require(_0x4dd3('0x7'));var ejs=require(_0x4dd3('0x8'));var fs=require('fs');var fs_extra=require(_0x4dd3('0x9'));var _=require(_0x4dd3('0xa'));var squel=require(_0x4dd3('0xb'));var crypto=require(_0x4dd3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4dd3('0x7'));var querystring=require(_0x4dd3('0xd'));var Papa=require(_0x4dd3('0xe'));var Redis=require('ioredis');var authService=require(_0x4dd3('0xf'));var qs=require(_0x4dd3('0x10'));var as=require(_0x4dd3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4dd3('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4dd3('0x13'));var licenseUtil=require(_0x4dd3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b90e6,_0x555c2d){_0x555c2d=_0x555c2d||0xcc;return function(_0x283316){if(_0x283316){return _0x3b90e6[_0x4dd3('0x15')](_0x555c2d);}return _0x3b90e6[_0x4dd3('0x16')](_0x555c2d)[_0x4dd3('0x17')]();};}function respondWithResult(_0x2f12e9,_0x15adc1){_0x15adc1=_0x15adc1||0xc8;return function(_0x1c50b5){if(_0x1c50b5){return _0x2f12e9['status'](_0x15adc1)[_0x4dd3('0x18')](_0x1c50b5);}};}function respondWithFilteredResult(_0x3d0ee0,_0x546e77){return function(_0x18fc3e){if(_0x18fc3e){var _0x5a330a=typeof _0x546e77['offset']===_0x4dd3('0x19')&&typeof _0x546e77[_0x4dd3('0x1a')]===_0x4dd3('0x19');var _0x39895b=_0x18fc3e[_0x4dd3('0x1b')];var _0x12bc9b=_0x5a330a?0x0:_0x546e77[_0x4dd3('0x1c')];var _0x2d18fd=_0x5a330a?_0x18fc3e['count']:_0x546e77[_0x4dd3('0x1c')]+_0x546e77['limit'];var _0x58c46c;if(_0x2d18fd>=_0x39895b){_0x2d18fd=_0x39895b;_0x58c46c=0xc8;}else{_0x58c46c=0xce;}_0x3d0ee0['status'](_0x58c46c);return _0x3d0ee0[_0x4dd3('0x1d')](_0x4dd3('0x1e'),_0x12bc9b+'-'+_0x2d18fd+'/'+_0x39895b)[_0x4dd3('0x18')](_0x18fc3e);}return null;};}function patchUpdates(_0x4a1f6f){return function(_0x34c2c8){try{jsonpatch[_0x4dd3('0x1f')](_0x34c2c8,_0x4a1f6f,!![]);}catch(_0x15a108){return BPromise[_0x4dd3('0x20')](_0x15a108);}return _0x34c2c8[_0x4dd3('0x21')]();};}function saveUpdates(_0x3a18e1,_0x2ccd3c){return function(_0x2c5cd4){if(_0x2c5cd4){return _0x2c5cd4[_0x4dd3('0x22')](_0x3a18e1)[_0x4dd3('0x23')](function(_0x496eae){return _0x496eae;});}return null;};}function removeEntity(_0x2cb19a,_0x230915){return function(_0x480ca2){if(_0x480ca2){return _0x480ca2[_0x4dd3('0x24')]()[_0x4dd3('0x23')](function(){_0x2cb19a[_0x4dd3('0x16')](0xcc)[_0x4dd3('0x17')]();});}};}function handleEntityNotFound(_0x5a91ce,_0x5ba486){return function(_0x40577d){if(!_0x40577d){_0x5a91ce['sendStatus'](0x194);}return _0x40577d;};}function handleError(_0x1ee0f6,_0x2fecdc){_0x2fecdc=_0x2fecdc||0x1f4;return function(_0xcd086b){logger[_0x4dd3('0x25')](_0xcd086b['stack']);if(_0xcd086b[_0x4dd3('0x26')]){delete _0xcd086b[_0x4dd3('0x26')];}_0x1ee0f6[_0x4dd3('0x16')](_0x2fecdc)[_0x4dd3('0x27')](_0xcd086b);};}exports['index']=function(_0x49eb37,_0x164734){var _0x81fb1f={},_0x535189={},_0x2b2674={'count':0x0,'rows':[]};var _0x254e7a=_[_0x4dd3('0x28')](db['WhatsappTransferReport'][_0x4dd3('0x29')],function(_0x2a09ff){return{'name':_0x2a09ff[_0x4dd3('0x2a')],'type':_0x2a09ff['type'][_0x4dd3('0x2b')]};});_0x535189[_0x4dd3('0x2c')]=_[_0x4dd3('0x28')](_0x254e7a,_0x4dd3('0x26'));_0x535189[_0x4dd3('0x2d')]=_[_0x4dd3('0x2e')](_0x49eb37[_0x4dd3('0x2d')]);_0x535189[_0x4dd3('0x2f')]=_['intersection'](_0x535189[_0x4dd3('0x2c')],_0x535189[_0x4dd3('0x2d')]);_0x81fb1f['attributes']=_[_0x4dd3('0x30')](_0x535189[_0x4dd3('0x2c')],qs[_0x4dd3('0x31')](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x31')]));_0x81fb1f['attributes']=_0x81fb1f[_0x4dd3('0x32')]['length']?_0x81fb1f[_0x4dd3('0x32')]:_0x535189[_0x4dd3('0x2c')];if(!_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x33')]('nolimit')){_0x81fb1f[_0x4dd3('0x1a')]=qs[_0x4dd3('0x1a')](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x1a')]);_0x81fb1f[_0x4dd3('0x1c')]=qs['offset'](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x1c')]);}_0x81fb1f[_0x4dd3('0x34')]=qs[_0x4dd3('0x35')](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x35')]);_0x81fb1f['where']=qs[_0x4dd3('0x2f')](_['pick'](_0x49eb37[_0x4dd3('0x2d')],_0x535189['filters']),_0x254e7a);if(_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x36')]){_0x81fb1f['where']=_[_0x4dd3('0x37')](_0x81fb1f[_0x4dd3('0x38')],{'$or':_['map'](_0x254e7a,function(_0x482c87){if(_0x482c87['type']!=='VIRTUAL'){var _0x282254={};_0x282254[_0x482c87[_0x4dd3('0x26')]]={'$like':'%'+_0x49eb37['query'][_0x4dd3('0x36')]+'%'};return _0x282254;}})});}_0x81fb1f=_[_0x4dd3('0x37')]({},_0x81fb1f,_0x49eb37[_0x4dd3('0x39')]);var _0x19e61a={'where':_0x81fb1f[_0x4dd3('0x38')]};return db[_0x4dd3('0x3a')][_0x4dd3('0x1b')](_0x19e61a)[_0x4dd3('0x23')](function(_0x3a1831){_0x2b2674[_0x4dd3('0x1b')]=_0x3a1831;if(_0x49eb37['query'][_0x4dd3('0x3b')]){_0x81fb1f[_0x4dd3('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x4dd3('0x3d')](_0x81fb1f);})[_0x4dd3('0x23')](function(_0x441525){_0x2b2674['rows']=_0x441525;return _0x2b2674;})['then'](respondWithFilteredResult(_0x164734,_0x81fb1f))[_0x4dd3('0x3e')](handleError(_0x164734,null));};exports[_0x4dd3('0x3f')]=function(_0x8a3380,_0x27f578){var _0x4748e3={'raw':!![],'where':{'id':_0x8a3380[_0x4dd3('0x40')]['id']}},_0x1c39b6={};_0x1c39b6[_0x4dd3('0x2c')]=_[_0x4dd3('0x2e')](db[_0x4dd3('0x3a')][_0x4dd3('0x29')]);_0x1c39b6[_0x4dd3('0x2d')]=_[_0x4dd3('0x2e')](_0x8a3380[_0x4dd3('0x2d')]);_0x1c39b6[_0x4dd3('0x2f')]=_[_0x4dd3('0x30')](_0x1c39b6[_0x4dd3('0x2c')],_0x1c39b6[_0x4dd3('0x2d')]);_0x4748e3['attributes']=_['intersection'](_0x1c39b6[_0x4dd3('0x2c')],qs[_0x4dd3('0x31')](_0x8a3380[_0x4dd3('0x2d')][_0x4dd3('0x31')]));_0x4748e3[_0x4dd3('0x32')]=_0x4748e3[_0x4dd3('0x32')][_0x4dd3('0x41')]?_0x4748e3[_0x4dd3('0x32')]:_0x1c39b6[_0x4dd3('0x2c')];if(_0x8a3380[_0x4dd3('0x2d')]['includeAll']){_0x4748e3[_0x4dd3('0x3c')]=[{'all':!![]}];}_0x4748e3=_[_0x4dd3('0x37')]({},_0x4748e3,_0x8a3380[_0x4dd3('0x39')]);return db[_0x4dd3('0x3a')][_0x4dd3('0x42')](_0x4748e3)[_0x4dd3('0x23')](handleEntityNotFound(_0x27f578,null))[_0x4dd3('0x23')](respondWithResult(_0x27f578,null))[_0x4dd3('0x3e')](handleError(_0x27f578,null));};exports[_0x4dd3('0x43')]=function(_0x213a31,_0x436503){return db[_0x4dd3('0x3a')][_0x4dd3('0x43')](_0x213a31['body'],{})[_0x4dd3('0x23')](respondWithResult(_0x436503,0xc9))[_0x4dd3('0x3e')](handleError(_0x436503,null));};exports[_0x4dd3('0x22')]=function(_0xfa7551,_0x19299e){if(_0xfa7551[_0x4dd3('0x44')]['id']){delete _0xfa7551[_0x4dd3('0x44')]['id'];}return db['WhatsappTransferReport'][_0x4dd3('0x42')]({'where':{'id':_0xfa7551[_0x4dd3('0x40')]['id']}})[_0x4dd3('0x23')](handleEntityNotFound(_0x19299e,null))[_0x4dd3('0x23')](saveUpdates(_0xfa7551[_0x4dd3('0x44')],null))['then'](respondWithResult(_0x19299e,null))[_0x4dd3('0x3e')](handleError(_0x19299e,null));};exports['destroy']=function(_0x186856,_0x5c5a4a){return db[_0x4dd3('0x3a')][_0x4dd3('0x42')]({'where':{'id':_0x186856[_0x4dd3('0x40')]['id']}})[_0x4dd3('0x23')](handleEntityNotFound(_0x5c5a4a,null))[_0x4dd3('0x23')](removeEntity(_0x5c5a4a,null))['catch'](handleError(_0x5c5a4a,null));};exports[_0x4dd3('0x45')]=function(_0x13ed34,_0x4182af){return db[_0x4dd3('0x3a')][_0x4dd3('0x45')]()[_0x4dd3('0x23')](respondWithResult(_0x4182af,null))[_0x4dd3('0x3e')](handleError(_0x4182af,null));}; \ No newline at end of file +var _0x52c1=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe'];(function(_0x197853,_0x24487b){var _0x1cbb30=function(_0x53bab3){while(--_0x53bab3){_0x197853['push'](_0x197853['shift']());}};_0x1cbb30(++_0x24487b);}(_0x52c1,0x1ce));var _0x152c=function(_0x2a3981,_0x10b892){_0x2a3981=_0x2a3981-0x0;var _0x550274=_0x52c1[_0x2a3981];return _0x550274;};'use strict';var emlformat=require(_0x152c('0x0'));var rimraf=require(_0x152c('0x1'));var zipdir=require(_0x152c('0x2'));var jsonpatch=require(_0x152c('0x3'));var rp=require(_0x152c('0x4'));var moment=require(_0x152c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x152c('0x6'));var util=require('util');var path=require(_0x152c('0x7'));var sox=require('sox');var csv=require(_0x152c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x152c('0x9'));var squel=require('squel');var crypto=require(_0x152c('0xa'));var jsforce=require(_0x152c('0xb'));var deskjs=require(_0x152c('0xc'));var toCsv=require(_0x152c('0x8'));var querystring=require('querystring');var Papa=require(_0x152c('0xd'));var Redis=require(_0x152c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x152c('0xf'));var as=require(_0x152c('0x10'));var hardwareService=require(_0x152c('0x11'));var logger=require(_0x152c('0x12'))(_0x152c('0x13'));var utils=require(_0x152c('0x14'));var config=require(_0x152c('0x15'));var licenseUtil=require(_0x152c('0x16'));var db=require(_0x152c('0x17'))['db'];function respondWithStatusCode(_0x328bc9,_0x22a302){_0x22a302=_0x22a302||0xcc;return function(_0x5ccb20){if(_0x5ccb20){return _0x328bc9[_0x152c('0x18')](_0x22a302);}return _0x328bc9[_0x152c('0x19')](_0x22a302)[_0x152c('0x1a')]();};}function respondWithResult(_0x28e445,_0x40e453){_0x40e453=_0x40e453||0xc8;return function(_0xcbbf0d){if(_0xcbbf0d){return _0x28e445[_0x152c('0x19')](_0x40e453)[_0x152c('0x1b')](_0xcbbf0d);}};}function respondWithFilteredResult(_0x4ea81b,_0x2f36e7){return function(_0x3e3c6b){if(_0x3e3c6b){var _0xb25d47=typeof _0x2f36e7[_0x152c('0x1c')]==='undefined'&&typeof _0x2f36e7[_0x152c('0x1d')]===_0x152c('0x1e');var _0x22a09a=_0x3e3c6b[_0x152c('0x1f')];var _0xf85aae=_0xb25d47?0x0:_0x2f36e7['offset'];var _0x1cfda8=_0xb25d47?_0x3e3c6b[_0x152c('0x1f')]:_0x2f36e7[_0x152c('0x1c')]+_0x2f36e7[_0x152c('0x1d')];var _0x31a16b;if(_0x1cfda8>=_0x22a09a){_0x1cfda8=_0x22a09a;_0x31a16b=0xc8;}else{_0x31a16b=0xce;}_0x4ea81b[_0x152c('0x19')](_0x31a16b);return _0x4ea81b[_0x152c('0x20')](_0x152c('0x21'),_0xf85aae+'-'+_0x1cfda8+'/'+_0x22a09a)[_0x152c('0x1b')](_0x3e3c6b);}return null;};}function patchUpdates(_0xacb5f0){return function(_0x2a1921){try{jsonpatch[_0x152c('0x22')](_0x2a1921,_0xacb5f0,!![]);}catch(_0x24bfbc){return BPromise['reject'](_0x24bfbc);}return _0x2a1921[_0x152c('0x23')]();};}function saveUpdates(_0x47f252,_0x546f23){return function(_0x531ae8){if(_0x531ae8){return _0x531ae8['update'](_0x47f252)[_0x152c('0x24')](function(_0x3c6f01){return _0x3c6f01;});}return null;};}function removeEntity(_0x1dd9e6,_0x44b729){return function(_0x396dae){if(_0x396dae){return _0x396dae[_0x152c('0x25')]()[_0x152c('0x24')](function(){_0x1dd9e6[_0x152c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d305a,_0x161984){return function(_0x439b3f){if(!_0x439b3f){_0x5d305a[_0x152c('0x18')](0x194);}return _0x439b3f;};}function handleError(_0x42cc0e,_0x323116){_0x323116=_0x323116||0x1f4;return function(_0x196324){logger[_0x152c('0x26')](_0x196324[_0x152c('0x27')]);if(_0x196324['name']){delete _0x196324[_0x152c('0x28')];}_0x42cc0e[_0x152c('0x19')](_0x323116)[_0x152c('0x29')](_0x196324);};}exports['index']=function(_0x1ada12,_0x2bcaff){var _0x51fe4d={},_0x5a0ad7={},_0x62e97a={'count':0x0,'rows':[]};var _0x1ae53c=_[_0x152c('0x2a')](db[_0x152c('0x2b')][_0x152c('0x2c')],function(_0x57bed7){return{'name':_0x57bed7[_0x152c('0x2d')],'type':_0x57bed7[_0x152c('0x2e')]['key']};});_0x5a0ad7[_0x152c('0x2f')]=_[_0x152c('0x2a')](_0x1ae53c,_0x152c('0x28'));_0x5a0ad7[_0x152c('0x30')]=_[_0x152c('0x31')](_0x1ada12[_0x152c('0x30')]);_0x5a0ad7['filters']=_['intersection'](_0x5a0ad7['model'],_0x5a0ad7[_0x152c('0x30')]);_0x51fe4d[_0x152c('0x32')]=_[_0x152c('0x33')](_0x5a0ad7[_0x152c('0x2f')],qs[_0x152c('0x34')](_0x1ada12[_0x152c('0x30')][_0x152c('0x34')]));_0x51fe4d[_0x152c('0x32')]=_0x51fe4d[_0x152c('0x32')][_0x152c('0x35')]?_0x51fe4d[_0x152c('0x32')]:_0x5a0ad7[_0x152c('0x2f')];if(!_0x1ada12[_0x152c('0x30')][_0x152c('0x36')](_0x152c('0x37'))){_0x51fe4d[_0x152c('0x1d')]=qs[_0x152c('0x1d')](_0x1ada12['query'][_0x152c('0x1d')]);_0x51fe4d['offset']=qs[_0x152c('0x1c')](_0x1ada12[_0x152c('0x30')]['offset']);}_0x51fe4d[_0x152c('0x38')]=qs['sort'](_0x1ada12['query'][_0x152c('0x39')]);_0x51fe4d[_0x152c('0x3a')]=qs[_0x152c('0x3b')](_[_0x152c('0x3c')](_0x1ada12[_0x152c('0x30')],_0x5a0ad7[_0x152c('0x3b')]),_0x1ae53c);if(_0x1ada12[_0x152c('0x30')][_0x152c('0x3d')]){_0x51fe4d[_0x152c('0x3a')]=_['merge'](_0x51fe4d[_0x152c('0x3a')],{'$or':_[_0x152c('0x2a')](_0x1ae53c,function(_0x414de4){if(_0x414de4[_0x152c('0x2e')]!==_0x152c('0x3e')){var _0x24dbb8={};_0x24dbb8[_0x414de4[_0x152c('0x28')]]={'$like':'%'+_0x1ada12['query'][_0x152c('0x3d')]+'%'};return _0x24dbb8;}})});}_0x51fe4d=_[_0x152c('0x3f')]({},_0x51fe4d,_0x1ada12['options']);var _0x1e91c9={'where':_0x51fe4d[_0x152c('0x3a')]};return db[_0x152c('0x2b')][_0x152c('0x1f')](_0x1e91c9)['then'](function(_0xc10cfb){_0x62e97a['count']=_0xc10cfb;if(_0x1ada12[_0x152c('0x30')][_0x152c('0x40')]){_0x51fe4d[_0x152c('0x41')]=[{'all':!![]}];}return db[_0x152c('0x2b')][_0x152c('0x42')](_0x51fe4d);})[_0x152c('0x24')](function(_0x2e77dc){_0x62e97a[_0x152c('0x43')]=_0x2e77dc;return _0x62e97a;})[_0x152c('0x24')](respondWithFilteredResult(_0x2bcaff,_0x51fe4d))[_0x152c('0x44')](handleError(_0x2bcaff,null));};exports[_0x152c('0x45')]=function(_0x43cc4d,_0x1baff2){var _0x5588f9={'raw':!![],'where':{'id':_0x43cc4d[_0x152c('0x46')]['id']}},_0x197f15={};_0x197f15[_0x152c('0x2f')]=_[_0x152c('0x31')](db[_0x152c('0x2b')][_0x152c('0x2c')]);_0x197f15['query']=_['keys'](_0x43cc4d[_0x152c('0x30')]);_0x197f15[_0x152c('0x3b')]=_[_0x152c('0x33')](_0x197f15[_0x152c('0x2f')],_0x197f15[_0x152c('0x30')]);_0x5588f9[_0x152c('0x32')]=_[_0x152c('0x33')](_0x197f15[_0x152c('0x2f')],qs[_0x152c('0x34')](_0x43cc4d[_0x152c('0x30')][_0x152c('0x34')]));_0x5588f9[_0x152c('0x32')]=_0x5588f9[_0x152c('0x32')][_0x152c('0x35')]?_0x5588f9[_0x152c('0x32')]:_0x197f15['model'];if(_0x43cc4d[_0x152c('0x30')][_0x152c('0x40')]){_0x5588f9[_0x152c('0x41')]=[{'all':!![]}];}_0x5588f9=_[_0x152c('0x3f')]({},_0x5588f9,_0x43cc4d[_0x152c('0x47')]);return db[_0x152c('0x2b')][_0x152c('0x48')](_0x5588f9)[_0x152c('0x24')](handleEntityNotFound(_0x1baff2,null))[_0x152c('0x24')](respondWithResult(_0x1baff2,null))[_0x152c('0x44')](handleError(_0x1baff2,null));};exports[_0x152c('0x49')]=function(_0x41c045,_0x31bea9){return db[_0x152c('0x2b')][_0x152c('0x49')](_0x41c045[_0x152c('0x4a')],{})['then'](respondWithResult(_0x31bea9,0xc9))[_0x152c('0x44')](handleError(_0x31bea9,null));};exports[_0x152c('0x4b')]=function(_0x20be89,_0x52f860){if(_0x20be89['body']['id']){delete _0x20be89[_0x152c('0x4a')]['id'];}return db[_0x152c('0x2b')][_0x152c('0x48')]({'where':{'id':_0x20be89[_0x152c('0x46')]['id']}})[_0x152c('0x24')](handleEntityNotFound(_0x52f860,null))[_0x152c('0x24')](saveUpdates(_0x20be89[_0x152c('0x4a')],null))[_0x152c('0x24')](respondWithResult(_0x52f860,null))[_0x152c('0x44')](handleError(_0x52f860,null));};exports[_0x152c('0x25')]=function(_0x1536ef,_0x46b485){return db[_0x152c('0x2b')][_0x152c('0x48')]({'where':{'id':_0x1536ef[_0x152c('0x46')]['id']}})[_0x152c('0x24')](handleEntityNotFound(_0x46b485,null))[_0x152c('0x24')](removeEntity(_0x46b485,null))['catch'](handleError(_0x46b485,null));};exports['describe']=function(_0x2815ad,_0x424244){return db[_0x152c('0x2b')][_0x152c('0x4c')]()[_0x152c('0x24')](respondWithResult(_0x424244,null))[_0x152c('0x44')](handleError(_0x424244,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 9d8ac29..a21e6d0 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 _0x9248=['moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9248,0xc1));var _0x8924=function(_0x576e1a,_0x1b28cb){_0x576e1a=_0x576e1a-0x0;var _0x56d579=_0x9248[_0x576e1a];return _0x56d579;};'use strict';var _=require(_0x8924('0x0'));var util=require('util');var logger=require(_0x8924('0x1'))(_0x8924('0x2'));var moment=require(_0x8924('0x3'));var BPromise=require(_0x8924('0x4'));var rp=require(_0x8924('0x5'));var fs=require('fs');var path=require(_0x8924('0x6'));var rimraf=require(_0x8924('0x7'));var config=require('../../config/environment');var attributes=require(_0x8924('0x8'));module[_0x8924('0x9')]=function(_0x1e42fd,_0x33a962){return _0x1e42fd[_0x8924('0xa')](_0x8924('0xb'),attributes,{'tableName':_0x8924('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8924('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ec=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xe7ec,0xbd));var _0xce7e=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xe7ec[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0xce7e('0x0'));var util=require(_0xce7e('0x1'));var logger=require(_0xce7e('0x2'))('api');var moment=require(_0xce7e('0x3'));var BPromise=require(_0xce7e('0x4'));var rp=require(_0xce7e('0x5'));var fs=require('fs');var path=require(_0xce7e('0x6'));var rimraf=require(_0xce7e('0x7'));var config=require(_0xce7e('0x8'));var attributes=require(_0xce7e('0x9'));module[_0xce7e('0xa')]=function(_0x1db016,_0xdd7296){return _0x1db016[_0xce7e('0xb')](_0xce7e('0xc'),attributes,{'tableName':_0xce7e('0xd'),'paranoid':![],'indexes':[{'name':_0xce7e('0xe'),'fields':[_0xce7e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1d9a756..f547279 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 _0xe7d6=['client','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2238ba,_0xfeb953){var _0x33032f=function(_0x337e44){while(--_0x337e44){_0x2238ba['push'](_0x2238ba['shift']());}};_0x33032f(++_0xfeb953);}(_0xe7d6,0x14e));var _0x6e7d=function(_0x384cf4,_0x36d5f4){_0x384cf4=_0x384cf4-0x0;var _0x2918c7=_0xe7d6[_0x384cf4];return _0x2918c7;};'use strict';var _=require(_0x6e7d('0x0'));var util=require('util');var moment=require(_0x6e7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e7d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e7d('0x3'));var logger=require(_0x6e7d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e7d('0x5'));var client=jayson[_0x6e7d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54ff84,_0x45d3b1,_0x65ad3b){return new BPromise(function(_0x2a6083,_0x22b597){return client['request'](_0x54ff84,_0x65ad3b)['then'](function(_0x4672c8){logger[_0x6e7d('0x7')](_0x6e7d('0x8'),_0x45d3b1,_0x6e7d('0x9'));logger[_0x6e7d('0xa')](_0x6e7d('0xb'),_0x45d3b1,_0x6e7d('0x9'),JSON[_0x6e7d('0xc')](_0x4672c8));if(_0x4672c8['error']){if(_0x4672c8[_0x6e7d('0xd')]['code']===0x1f4){logger[_0x6e7d('0xd')](_0x6e7d('0x8'),_0x45d3b1,_0x4672c8[_0x6e7d('0xd')][_0x6e7d('0xe')]);return _0x22b597(_0x4672c8[_0x6e7d('0xd')][_0x6e7d('0xe')]);}logger[_0x6e7d('0xd')](_0x6e7d('0x8'),_0x45d3b1,_0x4672c8['error'][_0x6e7d('0xe')]);return _0x2a6083(_0x4672c8[_0x6e7d('0xd')]['message']);}else{logger[_0x6e7d('0x7')](_0x6e7d('0x8'),_0x45d3b1,_0x6e7d('0x9'));_0x2a6083(_0x4672c8[_0x6e7d('0xf')][_0x6e7d('0xe')]);}})[_0x6e7d('0x10')](function(_0x59d5dc){logger[_0x6e7d('0xd')](_0x6e7d('0x8'),_0x45d3b1,_0x59d5dc);_0x22b597(_0x59d5dc);});});} \ No newline at end of file +var _0x7a07=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x7a07,0x152));var _0x77a0=function(_0x33e729,_0x193483){_0x33e729=_0x33e729-0x0;var _0x42e68e=_0x7a07[_0x33e729];return _0x42e68e;};'use strict';var _=require(_0x77a0('0x0'));var util=require(_0x77a0('0x1'));var moment=require(_0x77a0('0x2'));var BPromise=require(_0x77a0('0x3'));var rs=require(_0x77a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77a0('0x5'))['db'];var utils=require(_0x77a0('0x6'));var logger=require(_0x77a0('0x7'))(_0x77a0('0x8'));var config=require(_0x77a0('0x9'));var jayson=require(_0x77a0('0xa'));var client=jayson[_0x77a0('0xb')][_0x77a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x575b7d,_0x5aaedd,_0x576877){return new BPromise(function(_0x3fc928,_0x16d141){return client[_0x77a0('0xd')](_0x575b7d,_0x576877)[_0x77a0('0xe')](function(_0x24ab31){logger['info'](_0x77a0('0xf'),_0x5aaedd,_0x77a0('0x10'));logger[_0x77a0('0x11')](_0x77a0('0x12'),_0x5aaedd,_0x77a0('0x10'),JSON[_0x77a0('0x13')](_0x24ab31));if(_0x24ab31['error']){if(_0x24ab31[_0x77a0('0x14')][_0x77a0('0x15')]===0x1f4){logger['error'](_0x77a0('0xf'),_0x5aaedd,_0x24ab31[_0x77a0('0x14')][_0x77a0('0x16')]);return _0x16d141(_0x24ab31[_0x77a0('0x14')][_0x77a0('0x16')]);}logger[_0x77a0('0x14')](_0x77a0('0xf'),_0x5aaedd,_0x24ab31['error'][_0x77a0('0x16')]);return _0x3fc928(_0x24ab31[_0x77a0('0x14')][_0x77a0('0x16')]);}else{logger[_0x77a0('0x17')](_0x77a0('0xf'),_0x5aaedd,_0x77a0('0x10'));_0x3fc928(_0x24ab31[_0x77a0('0x18')][_0x77a0('0x16')]);}})[_0x77a0('0x19')](function(_0xbe7f87){logger[_0x77a0('0x14')](_0x77a0('0xf'),_0x5aaedd,_0xbe7f87);_0x16d141(_0xbe7f87);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index dd01145..4b345a9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x975f=['./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','online','name','Offline\x20apps:','join','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config'];(function(_0x1acefc,_0x5da0bf){var _0x543527=function(_0x27040d){while(--_0x27040d){_0x1acefc['push'](_0x1acefc['shift']());}};_0x543527(++_0x5da0bf);}(_0x975f,0x109));var _0xf975=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x975f[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0xf975('0x0'));var db=require(_0xf975('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xf975('0x2'));var config=require(_0xf975('0x3'));var logger=require('./config/logger')(_0xf975('0x4'));var pm2=require(_0xf975('0x5'));var pm2Config=require(_0xf975('0x6'));var schedule=require(_0xf975('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xf975('0x8'));var transcribe=require(_0xf975('0x9'));var provider=require(_0xf975('0xa'));function main(){return db[_0xf975('0xb')]['sync']()[_0xf975('0xc')](function(){if(config[_0xf975('0xd')]){return seedDb[_0xf975('0xe')]();}})['then'](function(){return checkLicense[_0xf975('0xe')]();})[_0xf975('0xc')](function(){return rpc['listen']();})[_0xf975('0xc')](function(_0x13af53){logger[_0xf975('0xf')](_0x13af53);return chat[_0xf975('0x10')]();})[_0xf975('0xc')](function(){return whatsapp[_0xf975('0x10')]();})[_0xf975('0xc')](function(){return schedule['start']();})[_0xf975('0xc')](function(){return transcribe[_0xf975('0x10')]();})['then'](function(){return provider[_0xf975('0x10')]();})[_0xf975('0xc')](function(_0x12d0e8){logger[_0xf975('0xf')](_0x12d0e8);return pm2[_0xf975('0x10')](pm2Config);})[_0xf975('0xc')](function(_0xa84361){var _0x525e4a=_0xa84361[_0xf975('0x11')](function(_0x5e63c1){return typeof _0x5e63c1['exitCode']===_0xf975('0x12')&&_0x5e63c1[_0xf975('0x13')]>=0x0;});if(_0x525e4a[_0xf975('0x14')]>0x0){throw new Error(_0x525e4a[_0xf975('0x14')]+_0xf975('0x15')+_[_0xf975('0x16')](_0x525e4a,function(_0x2cffb6){return'\x22'+_0x2cffb6['pm2_env']['name']+'\x22';}));}logger[_0xf975('0xf')](_0xf975('0x17'),_[_0xf975('0x16')](_[_0xf975('0x11')](_0xa84361,{'status':_0xf975('0x18')}),_0xf975('0x19'))['join']());logger[_0xf975('0xf')](_0xf975('0x1a'),_[_0xf975('0x16')](_[_0xf975('0x11')](_0xa84361,function(_0x4fb599){return _0x4fb599['status']!==_0xf975('0x18');}),_0xf975('0x19'))[_0xf975('0x1b')]()||_0xf975('0x1c'));console[_0xf975('0x1d')]('App\x20Ready!');})[_0xf975('0x1e')](function(_0x2906ce){console[_0xf975('0x1d')](_0xf975('0x1f'),_0x2906ce);logger['error'](_0xf975('0x20'),_0x2906ce);process[_0xf975('0x21')](0x1);});}main(); \ No newline at end of file +var _0xaab2=['Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name'];(function(_0x2464d8,_0x3b55e4){var _0x366349=function(_0x2aec89){while(--_0x2aec89){_0x2464d8['push'](_0x2464d8['shift']());}};_0x366349(++_0x3b55e4);}(_0xaab2,0xca));var _0x2aab=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xaab2[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var db=require(_0x2aab('0x0'))['db'];var seedDb=require(_0x2aab('0x1'));var checkLicense=require(_0x2aab('0x2'));var rpc=require('./rpc');var config=require(_0x2aab('0x3'));var logger=require(_0x2aab('0x4'))(_0x2aab('0x5'));var pm2=require(_0x2aab('0x6'));var pm2Config=require(_0x2aab('0x7'));var schedule=require('./config/schedule');var chat=require(_0x2aab('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x2aab('0x9'));var provider=require(_0x2aab('0xa'));function main(){return db[_0x2aab('0xb')][_0x2aab('0xc')]()['then'](function(){if(config[_0x2aab('0xd')]){return seedDb[_0x2aab('0xe')]();}})[_0x2aab('0xf')](function(){return checkLicense[_0x2aab('0xe')]();})[_0x2aab('0xf')](function(){return rpc[_0x2aab('0x10')]();})['then'](function(_0x4e9ecb){logger[_0x2aab('0x11')](_0x4e9ecb);return chat[_0x2aab('0x12')]();})['then'](function(){return whatsapp[_0x2aab('0x12')]();})[_0x2aab('0xf')](function(){return schedule[_0x2aab('0x12')]();})['then'](function(){return transcribe[_0x2aab('0x12')]();})[_0x2aab('0xf')](function(){return provider[_0x2aab('0x12')]();})[_0x2aab('0xf')](function(_0xc03782){logger[_0x2aab('0x11')](_0xc03782);return pm2['start'](pm2Config);})['then'](function(_0x3039f1){var _0x4c062d=_0x3039f1['filter'](function(_0x135345){return typeof _0x135345[_0x2aab('0x13')]===_0x2aab('0x14')&&_0x135345[_0x2aab('0x13')]>=0x0;});if(_0x4c062d[_0x2aab('0x15')]>0x0){throw new Error(_0x4c062d[_0x2aab('0x15')]+_0x2aab('0x16')+_[_0x2aab('0x17')](_0x4c062d,function(_0x4ebce7){return'\x22'+_0x4ebce7[_0x2aab('0x18')][_0x2aab('0x19')]+'\x22';}));}logger[_0x2aab('0x11')](_0x2aab('0x1a'),_[_0x2aab('0x17')](_[_0x2aab('0x1b')](_0x3039f1,{'status':_0x2aab('0x1c')}),_0x2aab('0x19'))[_0x2aab('0x1d')]());logger[_0x2aab('0x11')](_0x2aab('0x1e'),_[_0x2aab('0x17')](_[_0x2aab('0x1b')](_0x3039f1,function(_0x1b4367){return _0x1b4367[_0x2aab('0x1f')]!==_0x2aab('0x1c');}),_0x2aab('0x19'))[_0x2aab('0x1d')]()||_0x2aab('0x20'));console[_0x2aab('0x21')]('App\x20Ready!');})[_0x2aab('0x22')](function(_0x78c4b5){console[_0x2aab('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x78c4b5);logger[_0x2aab('0x23')](_0x2aab('0x24'),_0x78c4b5);process[_0x2aab('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 59b1151..7775be8 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 _0x0fc2=['alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','use','headers','authorization','startsWith','Basic','User','find','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','util','secrets','session','role','fullname','name','email','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt'];(function(_0x49434f,_0x1d1eb5){var _0x246d04=function(_0xa0a69b){while(--_0xa0a69b){_0x49434f['push'](_0x49434f['shift']());}};_0x246d04(++_0x1d1eb5);}(_0x0fc2,0x70));var _0x20fc=function(_0x1833dc,_0x11b4cd){_0x1833dc=_0x1833dc-0x0;var _0x4905e0=_0x0fc2[_0x1833dc];return _0x4905e0;};'use strict';var db=require(_0x20fc('0x0'))['db'];var config=require(_0x20fc('0x1'));var hardwareConf=require(_0x20fc('0x2'));var licenseUtil=require(_0x20fc('0x3'));var encryptor=require(_0x20fc('0x4'));var _=require(_0x20fc('0x5'));var jwt=require(_0x20fc('0x6'));var expressJwt=require(_0x20fc('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0x20fc('0x8'));var crypto=require(_0x20fc('0x9'));var BPromise=require('bluebird');var util=require(_0x20fc('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x20fc('0xb')][_0x20fc('0xc')]});var userAttributes=['id',_0x20fc('0xd'),_0x20fc('0xe'),_0x20fc('0xf'),'internal',_0x20fc('0x10'),'userpic',_0x20fc('0x11'),_0x20fc('0x12'),_0x20fc('0x13'),'chatPause',_0x20fc('0x14'),_0x20fc('0x15'),_0x20fc('0x16'),_0x20fc('0x17'),_0x20fc('0x18'),_0x20fc('0x19'),_0x20fc('0x1a'),_0x20fc('0x1b'),_0x20fc('0x1c'),_0x20fc('0x1d'),_0x20fc('0x1e'),_0x20fc('0x1f'),'phoneBarAutoAnswer',_0x20fc('0x20'),_0x20fc('0x21'),_0x20fc('0x22'),'phoneBarEnableDtmfTone',_0x20fc('0x23'),_0x20fc('0x24'),_0x20fc('0x25'),_0x20fc('0x26'),_0x20fc('0x27'),_0x20fc('0x28'),_0x20fc('0x29'),_0x20fc('0x2a'),_0x20fc('0x2b'),_0x20fc('0x2c'),_0x20fc('0x2d'),_0x20fc('0x2e'),_0x20fc('0x2f'),_0x20fc('0x30'),'ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer',_0x20fc('0x31'),_0x20fc('0x32'),_0x20fc('0x33'),_0x20fc('0x34'),_0x20fc('0x35'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x20fc('0x36'),'faxAutoanswerDelay',_0x20fc('0x37'),'whatsappAutoanswerDelay',_0x20fc('0x38')];exports[_0x20fc('0x39')]=function(){return this[_0x20fc('0x3a')](!![])['use'](function(_0xd156fa,_0xff38d1,_0x20e865){if(_0xd156fa[_0x20fc('0x3b')]){_0x20e865();}else{return db[_0x20fc('0x3c')][_0x20fc('0x3d')]({'where':{'id':_0xd156fa[_0x20fc('0x3e')]['id']},'attributes':['id',_0x20fc('0x3f'),_0x20fc('0x40')],'raw':!![]})[_0x20fc('0x41')](function(_0xe8fe11){if(_0xe8fe11&&_0xe8fe11[_0x20fc('0x3f')]&&!_0xd156fa['query']['forceDownload']){return _0xff38d1[_0x20fc('0x42')](_0xe8fe11['disposition']===_0x20fc('0x43')?0x195:0x193)[_0x20fc('0x44')]({'message':_0xe8fe11['disposition']===_0x20fc('0x43')?_0x20fc('0x45'):'Forbidden.'});}else{_0x20e865();}})[_0x20fc('0x46')](function(_0xfcb781){_0x20e865(_0xfcb781);});}});};exports[_0x20fc('0x3a')]=function isAuthenticated(_0x19f50d){return compose()[_0x20fc('0x47')](function(_0x1317c4,_0x1943ee,_0x37c75c){var _0x46a9aa;if(_0x1317c4[_0x20fc('0x48')][_0x20fc('0x49')]){if(_[_0x20fc('0x4a')](_0x1317c4['headers'][_0x20fc('0x49')],_0x20fc('0x4b'))){var _0x76746d=basicAuth(_0x1317c4);db[_0x20fc('0x4c')][_0x20fc('0x4d')]({'where':{'name':_0x76746d['name']}})[_0x20fc('0x41')](function(_0x285567){if(!_0x285567||!_0x285567['authenticate'](_0x76746d['pass'])){return _0x1943ee[_0x20fc('0x42')](0x191)[_0x20fc('0x44')]({'message':_0x20fc('0x4e')});}_0x1317c4[_0x20fc('0x3b')]={'id':_0x285567['id']};_0x37c75c();})['catch'](function(_0x4e7ba4){_0x37c75c(_0x4e7ba4);});}else if(_['startsWith'](_0x1317c4[_0x20fc('0x48')][_0x20fc('0x49')],'Bearer')){validateJwt(_0x1317c4,_0x1943ee,_0x37c75c);}else{if(_0x19f50d){_0x37c75c();}else{return _0x1943ee[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':_0x20fc('0x4f')});}}}else if(_0x1317c4[_0x20fc('0x50')][_0x20fc('0x51')]){try{var _0x529976={'audience':hardwareConf[_0x20fc('0x52')](),'issuer':hardwareConf[_0x20fc('0x52')]()};verifyJwt(_0x1317c4['query'][_0x20fc('0x51')],_0x529976)[_0x20fc('0x41')](function(_0x22d044){return db[_0x20fc('0x4c')][_0x20fc('0x4d')]({'where':{'id':_0x22d044[_0x20fc('0x53')]}})[_0x20fc('0x41')](function(_0x341f2f){_0x46a9aa=_0x341f2f;return db[_0x20fc('0x54')][_0x20fc('0x3d')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})['then'](function(_0x301fd4){if(!_0x46a9aa||!_['isEqual'](_0x46a9aa[_0x20fc('0x55')],_0x22d044[_0x20fc('0x56')])){return _0x1943ee['status'](0x191)[_0x20fc('0x44')]({'message':_0x20fc('0x57')});}if(_0x46a9aa[_0x20fc('0x58')]){return _0x1943ee[_0x20fc('0x42')](0x191)['json']({'message':_0x20fc('0x59')});}if(_0x46a9aa[_0x20fc('0x5a')]){if(_0x301fd4[_0x20fc('0x5b')]>0x0){if(moment(_0x46a9aa[_0x20fc('0x5c')])[_0x20fc('0x5d')](_0x301fd4[_0x20fc('0x5b')],_0x20fc('0x5e'))>moment()){return _0x1943ee[_0x20fc('0x42')](0x191)[_0x20fc('0x44')]({'message':_0x20fc('0x59')});}}else{return _0x1943ee['status'](0x191)[_0x20fc('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1317c4[_0x20fc('0x3b')]={'id':_0x46a9aa['id']};_0x37c75c();});})[_0x20fc('0x46')](function(){return _0x1943ee[_0x20fc('0x42')](0x191)['json']({'message':_0x20fc('0x59')});});}catch(_0x55487a){_0x37c75c(_0x55487a);}}else if(_0x19f50d){_0x37c75c();}else{return _0x1943ee[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x4a3778,_0x5eae44,_0x6bc1f){if(_0x4a3778[_0x20fc('0x3b')]){db[_0x20fc('0x4c')]['find']({'where':{'id':_0x4a3778[_0x20fc('0x3b')]['id']},'attributes':userAttributes})['then'](function(_0x4d39c3){if(!_0x4d39c3){return _0x5eae44[_0x20fc('0x42')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4a3778[_0x20fc('0x3b')]=_0x4d39c3;_0x6bc1f();})[_0x20fc('0x46')](function(_0x2af610){_0x6bc1f(_0x2af610);});}else if(_0x19f50d){_0x6bc1f();}else{return _0x5eae44[_0x20fc('0x42')](0x194)['json']({'message':_0x20fc('0x5f')});}});};exports[_0x20fc('0x60')]=function canUpdate(){return compose()[_0x20fc('0x47')](function(_0x261e1a,_0x3f97b8,_0x168436){return licenseUtil[_0x20fc('0x61')]()[_0x20fc('0x41')](function(_0x5a535b){if(_0x5a535b[_0x20fc('0x62')]){_0x168436();}else{return _0x3f97b8[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':_0x20fc('0x63')});}})[_0x20fc('0x46')](function(_0x49f01e){_0x168436(_0x49f01e);});});};exports[_0x20fc('0x64')]=function isWebrtcLicence(){return compose()['use'](function(_0x542e6a,_0x1d1fed,_0xb1dcfa){return licenseUtil[_0x20fc('0x61')]()[_0x20fc('0x41')](function(_0x356b98){if(_0x356b98[_0x20fc('0x65')]){_0xb1dcfa();}else{return _0x1d1fed[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':'Forbidden'});}})[_0x20fc('0x46')](function(_0x48894a){_0xb1dcfa(_0x48894a);});});};exports[_0x20fc('0x66')]=function(_0x532e2c,_0xa7763c,_0x5bef1b){_0x532e2c['isMiddleware']=!![];return _0x5bef1b();};exports[_0x20fc('0x67')]=function signToken(_0x4af2b2){return signJwt(_0x4af2b2);};exports[_0x20fc('0x68')]=function(_0x7d3daa,_0x1a71b4){if(!_0x7d3daa[_0x20fc('0x3b')]){return _0x1a71b4[_0x20fc('0x42')](0x194)[_0x20fc('0x44')]({'message':_0x20fc('0x69')});}var _0x4a00d2={'payload':{'id':_0x7d3daa[_0x20fc('0x3b')]['id'],'role':_0x7d3daa[_0x20fc('0x3b')][_0x20fc('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a00d2)[_0x20fc('0x41')](function(_0x4d7510){_0x1a71b4[_0x20fc('0x6a')](_0x20fc('0x6b'),_0x4d7510);_0x1a71b4[_0x20fc('0x6c')]('/dashboards/general');})['catch'](function(_0x596b76){return _0x1a71b4[_0x20fc('0x42')](0x1f4)[_0x20fc('0x6d')](_0x596b76);});};exports[_0x20fc('0x6e')]=function(_0xf7e08b){if(_['isNil'](_0xf7e08b['apiKeyNonce'])||_[_0x20fc('0x6f')](_0xf7e08b['apiKeyIat'])){return null;}else{return createJwt(_0xf7e08b);}};exports[_0x20fc('0x70')]=function(_0x11639e){_0x11639e[_0x20fc('0x55')]=generateNonce();_0x11639e[_0x20fc('0x71')]=generateIssuedAt();return createJwt(_0x11639e);};exports['regenerateApiKey']=function(_0x4e9eb6,_0x31e402){var _0x11dac3=_0x4e9eb6[_0x20fc('0x50')][_0x20fc('0x51')];if(_0x11dac3){var _0x121e2b={'nonce':_0x31e402[_0x20fc('0x55')],'iat':_0x31e402[_0x20fc('0x71')],'audience':hardwareConf[_0x20fc('0x52')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x11dac3,_0x121e2b)[_0x20fc('0x41')](function(){return generateApiKey(_0x31e402);});}else{throw{'message':_0x20fc('0x72')};}};exports[_0x20fc('0x73')]=function(_0xc9aeb4){var _0x4671b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4671b2[_0x20fc('0x74')](_0xc9aeb4))throw new db[(_0x20fc('0x75'))]['ValidationError'](_0x20fc('0x76'));return;};exports[_0x20fc('0x77')]=function(_0x4a10a2,_0x1aba71,_0x32e029){var _0x289f8f=encryptor['decryptString'](_0x1aba71)[_0x20fc('0x78')](',');for(var _0x5a6fe0=0x0;_0x5a6fe0<_0x32e029;_0x5a6fe0++){if(!_0x289f8f[_0x5a6fe0])break;if(_0x4a10a2[_0x20fc('0x79')]()===_0x289f8f[_0x5a6fe0][_0x20fc('0x79')]()){var _0x4dade0=util[_0x20fc('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x32e029);if(_0x32e029===0x1){_0x4dade0=_0x20fc('0x7b');}throw new db[(_0x20fc('0x75'))]['ValidationError'](_0x4dade0);}}return;};exports[_0x20fc('0x7c')]=function(_0x233955,_0x374fce){var _0x50fd0a=_0x374fce?encryptor[_0x20fc('0x7d')](_0x374fce)[_0x20fc('0x78')](','):[];if(_0x50fd0a[_0x20fc('0x7e')]===0x5){_0x50fd0a[_0x20fc('0x7f')](-0x1,0x1);}_0x50fd0a[_0x20fc('0x80')](_0x233955);return encryptor[_0x20fc('0x81')](_0x50fd0a[_0x20fc('0x82')](','));};function signJwt(_0x3a5519){var _0x18c220=BPromise[_0x20fc('0x83')](jwt[_0x20fc('0x84')],{'context':jwt});var _0x18fc66=_0x3a5519[_0x20fc('0x85')]||config[_0x20fc('0xb')][_0x20fc('0xc')];return new BPromise(function(_0x56ea84,_0x49c140){_0x18c220(_0x3a5519[_0x20fc('0x86')],_0x18fc66,_0x3a5519[_0x20fc('0x87')])[_0x20fc('0x41')](function(_0x382009){_0x56ea84(_0x382009);})[_0x20fc('0x46')](function(_0x49302d){_0x49c140(_0x49302d);});});}function verifyJwt(_0x3fbeb8,_0x109700,_0x2f6b53){var _0x2d4093=BPromise['promisify'](jwt[_0x20fc('0x88')],{'context':jwt});var _0x5b4583=_0x2f6b53||config[_0x20fc('0xb')][_0x20fc('0xc')];return new BPromise(function(_0x91ed2f,_0xc5dfc2){_0x2d4093(_0x3fbeb8,_0x5b4583,_0x109700)[_0x20fc('0x41')](function(_0x3d066d){_0x91ed2f(_0x3d066d);})[_0x20fc('0x46')](function(_0x433a3f){_0xc5dfc2(_0x433a3f);});});}function generateNonce(){return crypto[_0x20fc('0x89')](0x10)['toString'](_0x20fc('0x8a'));}function generateIssuedAt(){return Math[_0x20fc('0x8b')](Date[_0x20fc('0x8c')]()/0x3e8)[_0x20fc('0x8d')]();}function createJwt(_0x3b63a3){var _0x33af05={'payload':{'iat':_0x3b63a3[_0x20fc('0x71')],'nonce':_0x3b63a3[_0x20fc('0x55')]},'options':{'algorithm':_0x20fc('0x8e'),'subject':_0x3b63a3['id'][_0x20fc('0x8d')](),'issuer':hardwareConf[_0x20fc('0x52')](),'audience':hardwareConf[_0x20fc('0x52')]()}};return signJwt(_0x33af05)[_0x20fc('0x41')](function(_0x444ea1){return{'iat':_0x3b63a3['apiKeyIat'],'nonce':_0x3b63a3[_0x20fc('0x55')],'token':_0x444ea1};});} \ No newline at end of file +var _0x67f4=['closed','disposition','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','then','authenticate','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isWebrtcLicence','webrtc','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secrets','session','payload','verify','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','util','moment','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','smsPause','openchannelPause','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isAuthenticated','use','ChatInteraction','findOne','params'];(function(_0x35ebdc,_0x3d4190){var _0x124fdb=function(_0x501b98){while(--_0x501b98){_0x35ebdc['push'](_0x35ebdc['shift']());}};_0x124fdb(++_0x3d4190);}(_0x67f4,0xdb));var _0x467f=function(_0x1020dc,_0x68d3d8){_0x1020dc=_0x1020dc-0x0;var _0x2fb69e=_0x67f4[_0x1020dc];return _0x2fb69e;};'use strict';var db=require(_0x467f('0x0'))['db'];var config=require(_0x467f('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x467f('0x2'));var encryptor=require(_0x467f('0x3'));var _=require(_0x467f('0x4'));var jwt=require(_0x467f('0x5'));var expressJwt=require(_0x467f('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x467f('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x467f('0x8'));var moment=require(_0x467f('0x9'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x467f('0xa'),_0x467f('0xb'),_0x467f('0xc'),_0x467f('0xd'),_0x467f('0xe'),_0x467f('0xf'),_0x467f('0x10'),_0x467f('0x11'),_0x467f('0x12'),_0x467f('0x13'),'mailPause','faxPause',_0x467f('0x14'),_0x467f('0x15'),'pauseType','showWebBar','lastLoginAt','lastPauseAt',_0x467f('0x16'),_0x467f('0x17'),'passwordResetAt',_0x467f('0x18'),_0x467f('0x19'),_0x467f('0x1a'),_0x467f('0x1b'),_0x467f('0x1c'),_0x467f('0x1d'),'phoneBarEnableSettings',_0x467f('0x1e'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x467f('0x1f'),_0x467f('0x20'),'userProfileId',_0x467f('0x21'),_0x467f('0x22'),_0x467f('0x23'),_0x467f('0x24'),_0x467f('0x25'),'downloadAttachments',_0x467f('0x26'),_0x467f('0x27'),'chatAutoanswer',_0x467f('0x28'),_0x467f('0x29'),_0x467f('0x2a'),_0x467f('0x2b'),_0x467f('0x2c'),_0x467f('0x2d'),_0x467f('0x2e'),_0x467f('0x2f'),_0x467f('0x30'),'whatsappAutoanswer',_0x467f('0x31'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this[_0x467f('0x32')](!![])[_0x467f('0x33')](function(_0x2e1622,_0x4e4134,_0x8820fd){if(_0x2e1622['user']){_0x8820fd();}else{return db[_0x467f('0x34')][_0x467f('0x35')]({'where':{'id':_0x2e1622[_0x467f('0x36')]['id']},'attributes':['id',_0x467f('0x37'),_0x467f('0x38')],'raw':!![]})['then'](function(_0x3e17c4){if(_0x3e17c4&&_0x3e17c4['closed']&&!_0x2e1622[_0x467f('0x39')][_0x467f('0x3a')]){return _0x4e4134[_0x467f('0x3b')](_0x3e17c4['disposition']===_0x467f('0x3c')?0x195:0x193)[_0x467f('0x3d')]({'message':_0x3e17c4[_0x467f('0x38')]===_0x467f('0x3c')?_0x467f('0x3e'):_0x467f('0x3f')});}else{_0x8820fd();}})[_0x467f('0x40')](function(_0x39e28f){_0x8820fd(_0x39e28f);});}});};exports[_0x467f('0x32')]=function isAuthenticated(_0x3652eb){return compose()[_0x467f('0x33')](function(_0x4a8b42,_0x3ac21d,_0x103570){var _0x52690b;if(_0x4a8b42[_0x467f('0x41')][_0x467f('0x42')]){if(_[_0x467f('0x43')](_0x4a8b42[_0x467f('0x41')][_0x467f('0x42')],_0x467f('0x44'))){var _0xc9cfb=basicAuth(_0x4a8b42);db[_0x467f('0x45')][_0x467f('0x46')]({'where':{'name':_0xc9cfb['name']}})[_0x467f('0x47')](function(_0x4b3173){if(!_0x4b3173||!_0x4b3173[_0x467f('0x48')](_0xc9cfb[_0x467f('0x49')])){return _0x3ac21d[_0x467f('0x3b')](0x191)['json']({'message':_0x467f('0x4a')});}_0x4a8b42[_0x467f('0x4b')]={'id':_0x4b3173['id']};_0x103570();})[_0x467f('0x40')](function(_0x50ff4b){_0x103570(_0x50ff4b);});}else if(_[_0x467f('0x43')](_0x4a8b42[_0x467f('0x41')][_0x467f('0x42')],_0x467f('0x4c'))){validateJwt(_0x4a8b42,_0x3ac21d,_0x103570);}else{if(_0x3652eb){_0x103570();}else{return _0x3ac21d[_0x467f('0x3b')](0x193)['json']({'message':_0x467f('0x4d')});}}}else if(_0x4a8b42[_0x467f('0x39')][_0x467f('0x4e')]){try{var _0x32b5c4={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x467f('0x4f')]()};verifyJwt(_0x4a8b42['query'][_0x467f('0x4e')],_0x32b5c4)['then'](function(_0x3cd186){return db[_0x467f('0x45')][_0x467f('0x46')]({'where':{'id':_0x3cd186[_0x467f('0x50')]}})['then'](function(_0x1ee31c){_0x52690b=_0x1ee31c;return db[_0x467f('0x51')][_0x467f('0x35')]({'where':{'id':0x1},'attributes':[_0x467f('0x52'),_0x467f('0x53')],'raw':!![]});})[_0x467f('0x47')](function(_0x153ed1){if(!_0x52690b||!_[_0x467f('0x54')](_0x52690b[_0x467f('0x55')],_0x3cd186[_0x467f('0x56')])){return _0x3ac21d['status'](0x191)[_0x467f('0x3d')]({'message':_0x467f('0x57')});}if(_0x52690b['disabled']){return _0x3ac21d[_0x467f('0x3b')](0x191)['json']({'message':_0x467f('0x58')});}if(_0x52690b[_0x467f('0x59')]){if(_0x153ed1[_0x467f('0x53')]>0x0){if(moment(_0x52690b['blockedAt'])[_0x467f('0x5a')](_0x153ed1['blockDuration'],_0x467f('0x5b'))>moment()){return _0x3ac21d[_0x467f('0x3b')](0x191)['json']({'message':_0x467f('0x58')});}}else{return _0x3ac21d[_0x467f('0x3b')](0x191)['json']({'message':_0x467f('0x58')});}}_0x4a8b42[_0x467f('0x4b')]={'id':_0x52690b['id']};_0x103570();});})[_0x467f('0x40')](function(){return _0x3ac21d[_0x467f('0x3b')](0x191)[_0x467f('0x3d')]({'message':_0x467f('0x58')});});}catch(_0x407cb9){_0x103570(_0x407cb9);}}else if(_0x3652eb){_0x103570();}else{return _0x3ac21d[_0x467f('0x3b')](0x193)[_0x467f('0x3d')]({'message':_0x467f('0x4d')});}})[_0x467f('0x33')](function(_0x3e03eb,_0x27260d,_0x2fd3a6){if(_0x3e03eb[_0x467f('0x4b')]){db[_0x467f('0x45')][_0x467f('0x46')]({'where':{'id':_0x3e03eb[_0x467f('0x4b')]['id']},'attributes':userAttributes})['then'](function(_0x48774b){if(!_0x48774b){return _0x27260d[_0x467f('0x3b')](0x194)[_0x467f('0x3d')]({'message':_0x467f('0x5c')});}_0x3e03eb[_0x467f('0x4b')]=_0x48774b;_0x2fd3a6();})[_0x467f('0x40')](function(_0x4c7c07){_0x2fd3a6(_0x4c7c07);});}else if(_0x3652eb){_0x2fd3a6();}else{return _0x27260d[_0x467f('0x3b')](0x194)[_0x467f('0x3d')]({'message':_0x467f('0x5d')});}});};exports[_0x467f('0x5e')]=function canUpdate(){return compose()[_0x467f('0x33')](function(_0x1f4cf7,_0x33493e,_0x41fe90){return licenseUtil[_0x467f('0x5f')]()[_0x467f('0x47')](function(_0x418f48){if(_0x418f48['update']){_0x41fe90();}else{return _0x33493e[_0x467f('0x3b')](0x193)['json']({'message':'Forbidden'});}})[_0x467f('0x40')](function(_0x13ff08){_0x41fe90(_0x13ff08);});});};exports[_0x467f('0x60')]=function isWebrtcLicence(){return compose()[_0x467f('0x33')](function(_0xd69529,_0x7060e3,_0x4d620a){return licenseUtil['getLicense']()['then'](function(_0x31dbd5){if(_0x31dbd5[_0x467f('0x61')]){_0x4d620a();}else{return _0x7060e3[_0x467f('0x3b')](0x193)[_0x467f('0x3d')]({'message':_0x467f('0x62')});}})[_0x467f('0x40')](function(_0x259030){_0x4d620a(_0x259030);});});};exports['isMiddleware']=function(_0x60ea42,_0x2f835b,_0x1062f5){_0x60ea42[_0x467f('0x63')]=!![];return _0x1062f5();};exports['signToken']=function signToken(_0x5f1848){return signJwt(_0x5f1848);};exports[_0x467f('0x64')]=function(_0x988214,_0x3667ab){if(!_0x988214[_0x467f('0x4b')]){return _0x3667ab[_0x467f('0x3b')](0x194)[_0x467f('0x3d')]({'message':_0x467f('0x65')});}var _0x42cb25={'payload':{'id':_0x988214[_0x467f('0x4b')]['id'],'role':_0x988214[_0x467f('0x4b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x42cb25)[_0x467f('0x47')](function(_0x28b8c4){_0x3667ab[_0x467f('0x66')](_0x467f('0x67'),_0x28b8c4);_0x3667ab[_0x467f('0x68')](_0x467f('0x69'));})['catch'](function(_0x544273){return _0x3667ab[_0x467f('0x3b')](0x1f4)[_0x467f('0x6a')](_0x544273);});};exports[_0x467f('0x6b')]=function(_0x527c22){if(_['isNil'](_0x527c22[_0x467f('0x55')])||_['isNil'](_0x527c22[_0x467f('0x6c')])){return null;}else{return createJwt(_0x527c22);}};exports[_0x467f('0x6d')]=function(_0x3e1442){_0x3e1442[_0x467f('0x55')]=generateNonce();_0x3e1442['apiKeyIat']=generateIssuedAt();return createJwt(_0x3e1442);};exports[_0x467f('0x6e')]=function(_0x560cbf,_0x285969){var _0x193344=_0x560cbf[_0x467f('0x39')][_0x467f('0x4e')];if(_0x193344){var _0x5efa1c={'nonce':_0x285969['apiKeyNonce'],'iat':_0x285969[_0x467f('0x6c')],'audience':hardwareConf[_0x467f('0x4f')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x193344,_0x5efa1c)[_0x467f('0x47')](function(){return generateApiKey(_0x285969);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x467f('0x6f')]=function(_0x5b11aa){var _0x1ca3e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1ca3e0[_0x467f('0x70')](_0x5b11aa))throw new db[(_0x467f('0x71'))][(_0x467f('0x72'))](_0x467f('0x73'));return;};exports[_0x467f('0x74')]=function(_0x226776,_0x177bbb,_0x24ed34){var _0x1d4bea=encryptor['decryptString'](_0x177bbb)[_0x467f('0x75')](',');for(var _0x5014b4=0x0;_0x5014b4<_0x24ed34;_0x5014b4++){if(!_0x1d4bea[_0x5014b4])break;if(_0x226776[_0x467f('0x76')]()===_0x1d4bea[_0x5014b4][_0x467f('0x76')]()){var _0x1e5ce4=util[_0x467f('0x77')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x24ed34);if(_0x24ed34===0x1){_0x1e5ce4=_0x467f('0x78');}throw new db[(_0x467f('0x71'))][(_0x467f('0x72'))](_0x1e5ce4);}}return;};exports[_0x467f('0x79')]=function(_0x3563db,_0x37dd7e){var _0x562b8f=_0x37dd7e?encryptor[_0x467f('0x7a')](_0x37dd7e)['split'](','):[];if(_0x562b8f[_0x467f('0x7b')]===0x5){_0x562b8f['splice'](-0x1,0x1);}_0x562b8f[_0x467f('0x7c')](_0x3563db);return encryptor[_0x467f('0x7d')](_0x562b8f[_0x467f('0x7e')](','));};function signJwt(_0x50af63){var _0x3cd989=BPromise[_0x467f('0x7f')](jwt[_0x467f('0x80')],{'context':jwt});var _0x16449b=_0x50af63['secret']||config[_0x467f('0x81')][_0x467f('0x82')];return new BPromise(function(_0x526132,_0x355f7f){_0x3cd989(_0x50af63[_0x467f('0x83')],_0x16449b,_0x50af63['options'])[_0x467f('0x47')](function(_0x37c746){_0x526132(_0x37c746);})['catch'](function(_0x23cba6){_0x355f7f(_0x23cba6);});});}function verifyJwt(_0x509883,_0x427a80,_0x246dfc){var _0x414b75=BPromise[_0x467f('0x7f')](jwt[_0x467f('0x84')],{'context':jwt});var _0x550427=_0x246dfc||config[_0x467f('0x81')][_0x467f('0x82')];return new BPromise(function(_0x177b61,_0x2bd3d4){_0x414b75(_0x509883,_0x550427,_0x427a80)[_0x467f('0x47')](function(_0x397048){_0x177b61(_0x397048);})[_0x467f('0x40')](function(_0x14d1e4){_0x2bd3d4(_0x14d1e4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x467f('0x85')](_0x467f('0x86'));}function generateIssuedAt(){return Math[_0x467f('0x87')](Date[_0x467f('0x88')]()/0x3e8)[_0x467f('0x85')]();}function createJwt(_0x4104c0){var _0x5dca89={'payload':{'iat':_0x4104c0[_0x467f('0x6c')],'nonce':_0x4104c0[_0x467f('0x55')]},'options':{'algorithm':'HS512','subject':_0x4104c0['id'][_0x467f('0x85')](),'issuer':hardwareConf[_0x467f('0x4f')](),'audience':hardwareConf[_0x467f('0x4f')]()}};return signJwt(_0x5dca89)[_0x467f('0x47')](function(_0x9f3751){return{'iat':_0x4104c0[_0x467f('0x6c')],'nonce':_0x4104c0[_0x467f('0x55')],'token':_0x9f3751};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index a5deb66..a7dc26a 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a80=['search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','count','User','rows','catch','describe','CmContact','startsWith','map','CmCustomField','findOne','slice','all','length','cf_','fieldType','type','keys','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x2a80,0xe3));var _0x02a8=function(_0x41434e,_0x57cbe5){_0x41434e=_0x41434e-0x0;var _0x2e570b=_0x2a80[_0x41434e];return _0x2e570b;};'use strict';var _=require(_0x02a8('0x0'));var sqlUtils=require(_0x02a8('0x1'));var db=require(_0x02a8('0x2'))['db'];exports[_0x02a8('0x3')]=function(_0x5053a7,_0x32deea,_0x2d3624,_0x33c53b){var _0xcac269={'count':0x0,'rows':[]};var _0x52117b=sqlUtils[_0x02a8('0x4')](_0x32deea,_0x5053a7);if(_0x52117b){return Promise[_0x02a8('0x5')](_0xcac269);}var _0x146eb8=sqlUtils[_0x02a8('0x6')]();var _0x559674={};var _0xc2aa44=![];var _0x542214=![];return Promise['resolve']()['then'](function(){if(_0x5053a7[_0x02a8('0x7')]){return sqlUtils[_0x02a8('0x8')](_0x5053a7[_0x02a8('0x7')],_0x33c53b);}else{return sqlUtils[_0x02a8('0x9')](_0x5053a7,_0x33c53b);}})[_0x02a8('0xa')](function(_0x441e70){_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xc')]);_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xd')]);_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xe')]);_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xf')][_0x02a8('0x10')]);_0x559674=_0x441e70[_0x02a8('0x11')];_0x542214=_0x441e70[_0x02a8('0xf')][_0x02a8('0x12')];return sqlUtils[_0x02a8('0x13')](_0x32deea,_0x5053a7,_0x542214);})[_0x02a8('0xa')](function(_0x39a26e){_0x146eb8[_0x02a8('0xb')](_0x39a26e);var _0x1603c8=_0x5053a7[_0x02a8('0x7')]?_0x559674['ids']:_0x5053a7[_0x02a8('0x14')];_0xc2aa44=_0x1603c8?!![]:![];return sqlUtils[_0x02a8('0x15')](_0x146eb8,_0x1603c8);})[_0x02a8('0xa')](function(_0x4c0448){_0xcac269[_0x02a8('0x16')]=_0x4c0448;if(_0xcac269['count']===0x0){return;}if(_0x5053a7[_0x02a8('0x17')]){_0x542214=!![];}return sqlUtils['buildContactsQuery'](_0x146eb8,_0x5053a7[_0x02a8('0xd')],_0x2d3624,_0xc2aa44,_0x559674['clause'],_0x542214);})[_0x02a8('0xa')](function(_0x302aeb){if(!_0x302aeb){return[];}return sqlUtils['getFilteredContacts'](_0x302aeb,_0x5053a7,_0x2d3624);})['then'](function(_0x374aae){_0xcac269[_0x02a8('0x18')]=_0x374aae;return _0xcac269;})[_0x02a8('0x19')](function(_0x5a8816){throw _0x5a8816;});};exports[_0x02a8('0x1a')]=function(){var _0x3713e5={};var _0x234e91=[];return db[_0x02a8('0x1b')][_0x02a8('0x1a')]()['then'](function(_0x125498){_0x3713e5=_0x125498;var _0x215092=Object['keys'](_0x3713e5)[_0x02a8('0xe')](function(_0x45dc45){return _[_0x02a8('0x1c')](_0x45dc45,'cf_')?_0x45dc45:undefined;});var _0x280be3=_0x215092[_0x02a8('0x1d')](function(_0x5e8b1c){return db[_0x02a8('0x1e')][_0x02a8('0x1f')]({'where':{'id':_0x5e8b1c[_0x02a8('0x20')](0x3)},'raw':!![]});});return Promise[_0x02a8('0x21')](_0x280be3);})[_0x02a8('0xa')](function(_0x5b4468){for(var _0x3ed136=0x0;_0x3ed136<_0x5b4468[_0x02a8('0x22')];_0x3ed136++){if(_0x5b4468[_0x3ed136]){var _0x478f8f=_0x02a8('0x23')+_0x5b4468[_0x3ed136]['id'];_0x3713e5[_0x478f8f][_0x02a8('0x24')]=_0x5b4468[_0x3ed136][_0x02a8('0x25')];}}_0x234e91=_[_0x02a8('0x1d')](Object[_0x02a8('0x26')](_0x3713e5),function(_0x11b8d8){return{'name':_0x11b8d8,'type':_0x3713e5[_0x11b8d8][_0x02a8('0x25')]};});return _0x234e91;})['catch'](function(_0x192596){throw _0x192596;});}; \ No newline at end of file +var _0xeefa=['resolve','search','parseAdvancedSearchFilter','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','then','ids','tag','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeefa,0xc7));var _0xaeef=function(_0x5d66eb,_0x5468e4){_0x5d66eb=_0x5d66eb-0x0;var _0x57e499=_0xeefa[_0x5d66eb];return _0x57e499;};'use strict';var _=require(_0xaeef('0x0'));var sqlUtils=require(_0xaeef('0x1'));var db=require(_0xaeef('0x2'))['db'];exports[_0xaeef('0x3')]=function(_0x247fe3,_0x208d64,_0x11de77,_0x31ce30){var _0x1176d8={'count':0x0,'rows':[]};var _0xfccb10=sqlUtils[_0xaeef('0x4')](_0x208d64,_0x247fe3);if(_0xfccb10){return Promise[_0xaeef('0x5')](_0x1176d8);}var _0x217227=sqlUtils['getContactsSubquery']();var _0x15f198={};var _0x222be4=![];var _0x54ac0b=![];return Promise[_0xaeef('0x5')]()['then'](function(){if(_0x247fe3[_0xaeef('0x6')]){return sqlUtils[_0xaeef('0x7')](_0x247fe3['search'],_0x31ce30);}else{return sqlUtils['parseQueryParameters'](_0x247fe3,_0x31ce30);}})['then'](function(_0x1a9d1c){_0x217227[_0xaeef('0x8')](_0x1a9d1c[_0xaeef('0x9')]);_0x217227[_0xaeef('0x8')](_0x1a9d1c[_0xaeef('0xa')]);_0x217227[_0xaeef('0x8')](_0x1a9d1c[_0xaeef('0xb')]);_0x217227[_0xaeef('0x8')](_0x1a9d1c[_0xaeef('0xc')][_0xaeef('0xd')]);_0x15f198=_0x1a9d1c[_0xaeef('0xe')];_0x54ac0b=_0x1a9d1c[_0xaeef('0xc')][_0xaeef('0xf')];return sqlUtils[_0xaeef('0x10')](_0x208d64,_0x247fe3,_0x54ac0b);})[_0xaeef('0x11')](function(_0x964a98){_0x217227[_0xaeef('0x8')](_0x964a98);var _0x410798=_0x247fe3['search']?_0x15f198[_0xaeef('0x12')]:_0x247fe3[_0xaeef('0x13')];_0x222be4=_0x410798?!![]:![];return sqlUtils['countFilteredContacts'](_0x217227,_0x410798);})['then'](function(_0x54b366){_0x1176d8['count']=_0x54b366;if(_0x1176d8['count']===0x0){return;}if(_0x247fe3['User']){_0x54ac0b=!![];}return sqlUtils[_0xaeef('0x14')](_0x217227,_0x247fe3[_0xaeef('0xa')],_0x11de77,_0x222be4,_0x15f198[_0xaeef('0xd')],_0x54ac0b);})[_0xaeef('0x11')](function(_0x18a853){if(!_0x18a853){return[];}return sqlUtils[_0xaeef('0x15')](_0x18a853,_0x247fe3,_0x11de77);})[_0xaeef('0x11')](function(_0x4bae73){_0x1176d8[_0xaeef('0x16')]=_0x4bae73;return _0x1176d8;})[_0xaeef('0x17')](function(_0x42d1d0){throw _0x42d1d0;});};exports[_0xaeef('0x18')]=function(){var _0x516848={};var _0xf16807=[];return db['CmContact'][_0xaeef('0x18')]()[_0xaeef('0x11')](function(_0x4a1c80){_0x516848=_0x4a1c80;var _0x39b61c=Object[_0xaeef('0x19')](_0x516848)[_0xaeef('0xb')](function(_0x3920e1){return _['startsWith'](_0x3920e1,_0xaeef('0x1a'))?_0x3920e1:undefined;});var _0x4426f7=_0x39b61c[_0xaeef('0x1b')](function(_0x587e2d){return db[_0xaeef('0x1c')][_0xaeef('0x1d')]({'where':{'id':_0x587e2d[_0xaeef('0x1e')](0x3)},'raw':!![]});});return Promise[_0xaeef('0x1f')](_0x4426f7);})[_0xaeef('0x11')](function(_0x53ff5a){for(var _0x556a75=0x0;_0x556a75<_0x53ff5a['length'];_0x556a75++){if(_0x53ff5a[_0x556a75]){var _0x32f56b=_0xaeef('0x1a')+_0x53ff5a[_0x556a75]['id'];_0x516848[_0x32f56b][_0xaeef('0x20')]=_0x53ff5a[_0x556a75][_0xaeef('0x21')];}}_0xf16807=_[_0xaeef('0x1b')](Object[_0xaeef('0x19')](_0x516848),function(_0x6b5d9d){return{'name':_0x6b5d9d,'type':_0x516848[_0x6b5d9d][_0xaeef('0x21')]};});return _0xf16807;})[_0xaeef('0x17')](function(_0x5d1ee9){throw _0x5d1ee9;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 4ae34ea..ecdb5e0 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf14e=['length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','value','start','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','push','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','tag','filter','role','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','DESC','order','subqry.','from','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','toString','Tags','clone','isEmpty','query','exports','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','ListId','CompanyId','createdAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split'];(function(_0x3903ef,_0x30063f){var _0x5a340b=function(_0x14ef71){while(--_0x14ef71){_0x3903ef['push'](_0x3903ef['shift']());}};_0x5a340b(++_0x30063f);}(_0xf14e,0x17e));var _0xef14=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xf14e[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var squel=require(_0xef14('0x0'));var as=require(_0xef14('0x1'));var qs=require(_0xef14('0x2'));var utils=require('../interaction/utils');var db=require(_0xef14('0x3'))['db'];function skipContactsQuery(_0x4ac2a3,_0x3fa614){var _0xe2d467=![];if(_0x4ac2a3['role']===_0xef14('0x4')&&!_0x3fa614[_0xef14('0x5')]&&!_0x3fa614['ListId']&&_0x3fa614['autocomplete']!=='true'){_0xe2d467=!![];}return _0xe2d467;}function getContactsSubquery(){return squel[_0xef14('0x6')]()['from'](_0xef14('0x7'),'c')[_0xef14('0x8')](_0xef14('0x9'));}function applyJoinClauses(_0x4fe9f4,_0x341839){var _0x4ca4ef=_0x341839?'c':_0xef14('0xa');_0x4fe9f4[_0xef14('0xb')]('cm_user_has_contacts','uc',_0xef14('0xc')+_0x4ca4ef+_0xef14('0xd'))[_0xef14('0xb')](_0xef14('0xe'),'ct','ct.CmContactId\x20=\x20'+_0x4ca4ef+'.id')['left_join']('tools_tags','t',_0xef14('0xf'));return _0x4fe9f4;}function addFieldsToQuery(_0x5dbc81,_0x5e9c6e,_0x3053e2,_0x1b8281,_0x2d869e){var _0x2f51c3=_0x2d869e?'c':'subqry';if(!_0x5e9c6e){_0x5e9c6e=['id',_0xef14('0x10'),_0xef14('0x11'),_0xef14('0x12'),_0xef14('0x13'),'fax','email',_0xef14('0x14'),_0xef14('0x15'),_0xef14('0x16'),'updatedAt',_0xef14('0x17'),_0xef14('0x18')];}else if(!_0x5e9c6e['includes']('id')){_0x5e9c6e['push']('id');}var _0x4121eb=_0x3053e2&&_0x2d869e||!_0x3053e2&&!_0x2d869e;if(_0x1b8281){_0x4121eb=_0x1b8281&&_0x2d869e||!_0x1b8281&&!_0x2d869e;}_0x5e9c6e[_0xef14('0x19')](function(_0x3e4a84){if(_0x3e4a84===_0xef14('0x18')){if(_0x4121eb){_0x5dbc81[_0xef14('0x1a')](_0xef14('0x1b'),_0x3e4a84);}else if(_0x3053e2||_0x1b8281){_0x5dbc81[_0xef14('0x1a')](_0x2f51c3+'.'+_0x3e4a84);}}else{_0x5dbc81[_0xef14('0x1a')](_0x2f51c3+'.'+_0x3e4a84);}});return _0x5dbc81;}function getSqlClauses(){var _0x4b0e64={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xef14('0x1c')](),'tags':{'clause':squel[_0xef14('0x1c')](),'ids':null},'user':{'clause':squel[_0xef14('0x1c')](),'skip':![]}};return _0x4b0e64;}function parseTagParameter(_0x5763d7){var _0x4882ed=squel[_0xef14('0x1c')]();if(_0x5763d7){var _0x4c2957=utils[_0xef14('0x1d')](_0x5763d7);_0x4c2957[_0xef14('0x19')](function(_0x4095a7){_0x4882ed['or'](_0xef14('0x1e'),'%,'+_0x4095a7+',%');});}return _0x4882ed;}function parseSearchFilter(_0x3c5978){var _0x177fa2=squel[_0xef14('0x1c')]();if(_0x3c5978){var _0x5841b8=_0x3c5978[_0xef14('0x1f')]('\x5c','\x5c\x5c')[_0xef14('0x1f')](/'/g,'\x27\x27');var _0x814907=qs[_0xef14('0x20')](_0x5841b8);if(_0x5841b8[_0xef14('0x21')]('\x20')[_0xef14('0x22')]>0x1){_0x177fa2['or'](_0xef14('0x23'),qs[_0xef14('0x24')](_0x5841b8,!![]),null);}else{if(qs[_0xef14('0x25')](_0x5841b8)){_0x177fa2['or'](_0xef14('0x26'),_0x814907+'%');_0x177fa2['or'](_0xef14('0x27'),_0x814907+'%');_0x177fa2['or']('c.mobile\x20LIKE\x20?',_0x814907+'%');_0x177fa2['or']('c.fax\x20LIKE\x20?',_0x814907+'%');}else if(qs['isEmail'](_0x5841b8)){_0x177fa2['or'](_0xef14('0x28'),_0x814907+'%');}else{_0x177fa2['or'](_0xef14('0x29'),'%'+_0x814907+'%');_0x177fa2['or'](_0xef14('0x2a'),'%'+_0x814907+'%');_0x177fa2['or'](_0xef14('0x28'),'%'+_0x814907+'%');}}}return _0x177fa2;}function parseAdvancedSearchFilter(_0x1f57dd,_0x45db24){var _0x2d848c=getSqlClauses();var _0x4ee379=as['parseSearch'](_0x1f57dd);var _0x353434=_0x4ee379[_0xef14('0x2b')];for(var _0x24fdc9=0x0;_0x24fdc9<_0x4ee379['conditions'][_0xef14('0x22')];_0x24fdc9++){var _0x37ce41=_0x4ee379[_0xef14('0x2c')][_0x24fdc9];var _0x11c211='c';var _0xd2e4ee=_[_0xef14('0x2d')](_0x45db24,[_0xef14('0x2e'),_0x37ce41[_0xef14('0x1a')]]);if(_0xd2e4ee){if(_0x37ce41[_0xef14('0x1a')]===_0xef14('0x2f')||_0xd2e4ee[_0xef14('0x30')]===_0xef14('0x31')){_0x37ce41[_0xef14('0x32')]=_0xef14('0x33');}var _0x3aa523=as[_0xef14('0x34')](_0x11c211,_0xd2e4ee[_0xef14('0x35')],_0x37ce41);_0x2d848c['default'][_0x353434](_0x3aa523['text'],_0x3aa523[_0xef14('0x36')][_0xef14('0x37')],_0x3aa523[_0xef14('0x36')][_0xef14('0x38')]);}else{if(_0x37ce41[_0xef14('0x1a')]===_0xef14('0x39')){var _0x4075d2=_0x37ce41[_0xef14('0x36')][_0xef14('0x21')](',')[_0xef14('0x3a')](function(_0xe265b7){return Number(_0xe265b7);});var _0x9aecbc=parseTagParameter(_0x4075d2);_0x2d848c[_0xef14('0x3b')][_0xef14('0x3c')][_0xef14('0x3d')](_0x9aecbc);_0x2d848c[_0xef14('0x3b')][_0xef14('0x3e')]=_0x4075d2;}else if(_0x37ce41[_0xef14('0x1a')]===_0xef14('0x3f')){_0x2d848c[_0xef14('0x40')][_0xef14('0x3c')][_0xef14('0x3d')](_0xef14('0x41'),_0x37ce41[_0xef14('0x36')]);_0x2d848c['user'][_0xef14('0x42')]=!![];}}}return _0x2d848c;}function parseModelFields(_0x5238a2,_0x50ea28){var _0xc823c3=squel[_0xef14('0x1c')]();var _0x1e6b45=_(_0x5238a2)[_0xef14('0x43')]()[_0xef14('0x3a')](function(_0x3d556d){return _[_0xef14('0x44')](_0x50ea28,[_0xef14('0x2e'),_0x3d556d])?_0x3d556d:undefined;})['compact']()[_0xef14('0x36')]();if(_0x5238a2[_0xef14('0x45')]){_0x1e6b45['push'](_0xef14('0x45'));}if(_0x5238a2[_0xef14('0x3f')]){_0x1e6b45[_0xef14('0x46')](_0xef14('0x3f'));}if(_0x1e6b45[_0xef14('0x22')]>0x0){_0x1e6b45[_0xef14('0x19')](function(_0x4384da){if(_0x4384da===_0xef14('0x14')){_0xc823c3[_0xef14('0x3d')](_0xef14('0x47'),[][_0xef14('0x48')](_0x5238a2[_0x4384da]));}else if(_0x4384da===_0xef14('0x45')){var _0x3ce8ac='%'+_0x5238a2[_0x4384da]+'%';_0xc823c3[_0xef14('0x3d')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3ce8ac);}else if(_0x4384da===_0xef14('0x3f')){_0xc823c3[_0xef14('0x3d')]('uc.UserId\x20=\x20?',_0x5238a2[_0x4384da]);}else{_0xc823c3[_0xef14('0x3d')]('c.'+_0x4384da+_0xef14('0x49'),_0x5238a2[_0x4384da]);}});}return _0xc823c3;}function parseQueryParameters(_0x41410e,_0x512df0){var _0x3ad054=getSqlClauses();return Promise[_0xef14('0x4a')]()[_0xef14('0x4b')](function(){return parseModelFields(_0x41410e,_0x512df0);})[_0xef14('0x4b')](function(_0x2db054){_0x3ad054['fields'][_0xef14('0x3d')](_0x2db054);return parseTagParameter(_0x41410e[_0xef14('0x4c')]);})['then'](function(_0x279fcf){_0x3ad054[_0xef14('0x3b')][_0xef14('0x3c')][_0xef14('0x3d')](_0x279fcf);return parseSearchFilter(_0x41410e[_0xef14('0x4d')]);})[_0xef14('0x4b')](function(_0x5aa577){_0x3ad054[_0xef14('0x4d')]=_0x5aa577;return _0x3ad054;});}function checkListsRestrictions(_0x38aa9d,_0x4356cf,_0x39b191){var _0x52c73d=squel[_0xef14('0x1c')]();return Promise[_0xef14('0x4a')]()['then'](function(){if(_0x4356cf[_0xef14('0x5')]&&_0x38aa9d[_0xef14('0x4e')]===_0xef14('0x4')&&!_0x39b191){return _0x38aa9d['getLists']({'attributes':['id'],'raw':!![]});}})[_0xef14('0x4b')](function(_0x377cf2){if(_0x377cf2){if(_0x377cf2[_0xef14('0x22')]===0x0){_0x52c73d['and'](_0xef14('0x4f'));}else{_0x52c73d[_0xef14('0x3d')]('c.ListId\x20IN\x20?',_[_0xef14('0x3a')](_0x377cf2,'id'));}}})[_0xef14('0x4b')](function(){return _0x52c73d;});}function buildContactsQuery(_0x255906,_0x629806,_0x455ce3,_0x88500a,_0x2b56ac,_0x2ed8a6){if(_0x629806){_0x629806=_0x455ce3[_0xef14('0x50')];}_0x255906=addFieldsToQuery(_0x255906,_0x629806,_0x88500a,_0x2ed8a6,!![]);var _0x5adb8f=squel['select']();_0x5adb8f=addFieldsToQuery(_0x5adb8f,_0x629806,_0x88500a,_0x2ed8a6,![]);if(_0x88500a||_0x2ed8a6){_0x255906=applyJoinClauses(_0x255906,!![]);_0x255906[_0xef14('0x51')](_0xef14('0x52'));if(_0x455ce3[_0xef14('0x53')]){_0x5adb8f[_0xef14('0x53')](_0x455ce3[_0xef14('0x53')]);}if(_0x455ce3[_0xef14('0x54')]){_0x5adb8f[_0xef14('0x54')](_0x455ce3[_0xef14('0x54')]);}}else{_0x5adb8f=applyJoinClauses(_0x5adb8f,![]);_0x5adb8f[_0xef14('0x51')](_0xef14('0x55'));if(_0x455ce3[_0xef14('0x53')]){_0x255906[_0xef14('0x53')](_0x455ce3[_0xef14('0x53')]);}if(_0x455ce3[_0xef14('0x54')]){_0x255906[_0xef14('0x54')](_0x455ce3[_0xef14('0x54')]);}}_0x5adb8f[_0xef14('0x56')](_0x2b56ac);if(_0x455ce3['order']){_0x455ce3['order'][_0xef14('0x19')](function(_0xc0b453){_0x255906['order']('c.'+_0xc0b453[0x0],_0xc0b453[0x1]===_0xef14('0x57')?![]:!![]);_0x5adb8f[_0xef14('0x58')](_0xef14('0x59')+_0xc0b453[0x0],_0xc0b453[0x1]==='DESC'?![]:!![]);});}_0x5adb8f[_0xef14('0x5a')](_0x255906,_0xef14('0xa'));return _0x5adb8f;}function getFilteredContacts(_0x2b4ce3){var _0x14f37e=[];return db[_0xef14('0x39')][_0xef14('0x5b')]({'attributes':['id',_0xef14('0x2e'),_0xef14('0x5c')],'raw':!![]})[_0xef14('0x4b')](function(_0x222e03){_0x14f37e=_[_0xef14('0x5d')](_0x222e03,'id');var _0x61fea8={'type':db[_0xef14('0x5e')]['QueryTypes'][_0xef14('0x5f')],'model':db[_0xef14('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xef14('0x61')]['query'](_0x2b4ce3[_0xef14('0x62')](),_0x61fea8);})[_0xef14('0x4b')](function(_0x1521ae){_0x1521ae[_0xef14('0x19')](function(_0x2d304a){if(_0x2d304a[_0xef14('0x18')]){_0x2d304a[_0xef14('0x63')]=[];_0x2d304a[_0xef14('0x18')]['split'](',')['forEach'](function(_0x28adac){_0x2d304a[_0xef14('0x63')][_0xef14('0x46')](_0x14f37e[_0x28adac]);});}delete _0x2d304a[_0xef14('0x18')];});return _0x1521ae;});}function countFilteredContacts(_0x514747,_0x476c9e){var _0x69f105=_0x514747[_0xef14('0x64')]();_0x69f105[_0xef14('0x1a')]('COUNT(*)');_0x69f105=applyJoinClauses(_0x69f105,!![]);_0x514747[_0xef14('0x51')](_0xef14('0x52'));var _0x474944=utils[_0xef14('0x1d')](_0x476c9e);if(!_[_0xef14('0x65')](_0x474944)){_0x69f105[_0xef14('0x8')]('t.id\x20IN\x20?',_0x474944);}var _0x34999e={'type':db[_0xef14('0x5e')]['QueryTypes'][_0xef14('0x5f')],'raw':!![]};return db[_0xef14('0x61')][_0xef14('0x66')](_0x69f105['toString'](),_0x34999e)[_0xef14('0x4b')](function(_0x5b2d8b){return _0x5b2d8b[0x0]['COUNT(*)'];});}module[_0xef14('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x2e55=['filter','search','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','Sequelize','QueryTypes','SELECT','query','toString','Tags','clone','COUNT(*)','t.id\x20IN\x20?','sequelize','lodash','squel','../parsers/advancedSearch','../../mysqldb','role','agent','ListId','autocomplete','true','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','text','value','start','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','skip','keys','compact','Contact','push','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2e55,0x15c));var _0x52e5=function(_0x802997,_0x5534a2){_0x802997=_0x802997-0x0;var _0x35c641=_0x2e55[_0x802997];return _0x35c641;};'use strict';var _=require(_0x52e5('0x0'));var squel=require(_0x52e5('0x1'));var as=require(_0x52e5('0x2'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x52e5('0x3'))['db'];function skipContactsQuery(_0x232cbf,_0x237110){var _0x31f8d5=![];if(_0x232cbf[_0x52e5('0x4')]===_0x52e5('0x5')&&!_0x237110['search']&&!_0x237110[_0x52e5('0x6')]&&_0x237110[_0x52e5('0x7')]!==_0x52e5('0x8')){_0x31f8d5=!![];}return _0x31f8d5;}function getContactsSubquery(){return squel['select']()['from'](_0x52e5('0x9'),'c')[_0x52e5('0xa')](_0x52e5('0xb'));}function applyJoinClauses(_0x180283,_0x55e04b){var _0x2beaea=_0x55e04b?'c':_0x52e5('0xc');_0x180283[_0x52e5('0xd')](_0x52e5('0xe'),'uc',_0x52e5('0xf')+_0x2beaea+_0x52e5('0x10'))[_0x52e5('0xd')](_0x52e5('0x11'),'ct',_0x52e5('0x12')+_0x2beaea+'.id')[_0x52e5('0xd')](_0x52e5('0x13'),'t',_0x52e5('0x14'));return _0x180283;}function addFieldsToQuery(_0xe10188,_0x19ef31,_0x270bd2,_0x1ac1dd,_0x3a9005){var _0xb13c0e=_0x3a9005?'c':_0x52e5('0xc');if(!_0x19ef31){_0x19ef31=['id',_0x52e5('0x15'),_0x52e5('0x16'),'phone',_0x52e5('0x17'),_0x52e5('0x18'),_0x52e5('0x19'),_0x52e5('0x6'),_0x52e5('0x1a'),_0x52e5('0x1b'),_0x52e5('0x1c'),_0x52e5('0x1d'),_0x52e5('0x1e')];}else if(!_0x19ef31['includes']('id')){_0x19ef31['push']('id');}var _0x36f2f1=_0x270bd2&&_0x3a9005||!_0x270bd2&&!_0x3a9005;if(_0x1ac1dd){_0x36f2f1=_0x1ac1dd&&_0x3a9005||!_0x1ac1dd&&!_0x3a9005;}_0x19ef31[_0x52e5('0x1f')](function(_0x52f1f5){if(_0x52f1f5===_0x52e5('0x1e')){if(_0x36f2f1){_0xe10188[_0x52e5('0x20')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x52f1f5);}else if(_0x270bd2||_0x1ac1dd){_0xe10188['field'](_0xb13c0e+'.'+_0x52f1f5);}}else{_0xe10188['field'](_0xb13c0e+'.'+_0x52f1f5);}});return _0xe10188;}function getSqlClauses(){var _0x12ba8c={'default':squel[_0x52e5('0x21')](),'fields':squel[_0x52e5('0x21')](),'filter':squel[_0x52e5('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x52e5('0x21')](),'skip':![]}};return _0x12ba8c;}function parseTagParameter(_0x58d6bb){var _0x8f620f=squel[_0x52e5('0x21')]();if(_0x58d6bb){var _0x2fa25e=utils[_0x52e5('0x22')](_0x58d6bb);_0x2fa25e['forEach'](function(_0x54e348){_0x8f620f['or'](_0x52e5('0x23'),'%,'+_0x54e348+',%');});}return _0x8f620f;}function parseSearchFilter(_0x375fc9){var _0x3a612e=squel[_0x52e5('0x21')]();if(_0x375fc9){var _0x4b1738=_0x375fc9['replace']('\x5c','\x5c\x5c')[_0x52e5('0x24')](/'/g,'\x27\x27');var _0x5a7653=qs['escapeLIKESpecialChars'](_0x4b1738);if(_0x4b1738[_0x52e5('0x25')]('\x20')[_0x52e5('0x26')]>0x1){_0x3a612e['or'](_0x52e5('0x27'),qs[_0x52e5('0x28')](_0x4b1738,!![]),null);}else{if(qs['isNumeric'](_0x4b1738)){_0x3a612e['or'](_0x52e5('0x29'),_0x5a7653+'%');_0x3a612e['or']('c.phone\x20LIKE\x20?',_0x5a7653+'%');_0x3a612e['or']('c.mobile\x20LIKE\x20?',_0x5a7653+'%');_0x3a612e['or'](_0x52e5('0x2a'),_0x5a7653+'%');}else if(qs[_0x52e5('0x2b')](_0x4b1738)){_0x3a612e['or'](_0x52e5('0x2c'),_0x5a7653+'%');}else{_0x3a612e['or']('c.firstName\x20LIKE\x20?','%'+_0x5a7653+'%');_0x3a612e['or'](_0x52e5('0x2d'),'%'+_0x5a7653+'%');_0x3a612e['or'](_0x52e5('0x2c'),'%'+_0x5a7653+'%');}}}return _0x3a612e;}function parseAdvancedSearchFilter(_0x538389,_0x97b877){var _0x49afe7=getSqlClauses();var _0x4f6e36=as[_0x52e5('0x2e')](_0x538389);var _0x2f466d=_0x4f6e36[_0x52e5('0x2f')];for(var _0x279ad7=0x0;_0x279ad7<_0x4f6e36['conditions']['length'];_0x279ad7++){var _0x2692c4=_0x4f6e36[_0x52e5('0x30')][_0x279ad7];var _0x4489='c';var _0x184c54=_[_0x52e5('0x31')](_0x97b877,[_0x52e5('0x32'),_0x2692c4[_0x52e5('0x20')]]);if(_0x184c54){if(_0x2692c4[_0x52e5('0x20')]===_0x52e5('0x33')||_0x184c54[_0x52e5('0x34')]===_0x52e5('0x35')){_0x2692c4['castTo']=_0x52e5('0x36');}var _0x53f335=as[_0x52e5('0x37')](_0x4489,_0x184c54[_0x52e5('0x38')],_0x2692c4);_0x49afe7[_0x52e5('0x39')][_0x2f466d](_0x53f335[_0x52e5('0x3a')],_0x53f335[_0x52e5('0x3b')][_0x52e5('0x3c')],_0x53f335[_0x52e5('0x3b')]['end']);}else{if(_0x2692c4['field']===_0x52e5('0x3d')){var _0x5439c7=_0x2692c4[_0x52e5('0x3b')][_0x52e5('0x25')](',')[_0x52e5('0x3e')](function(_0x275ef9){return Number(_0x275ef9);});var _0xdbb294=parseTagParameter(_0x5439c7);_0x49afe7[_0x52e5('0x3f')][_0x52e5('0x40')][_0x52e5('0x41')](_0xdbb294);_0x49afe7[_0x52e5('0x3f')][_0x52e5('0x42')]=_0x5439c7;}else if(_0x2692c4['field']===_0x52e5('0x43')){_0x49afe7['user'][_0x52e5('0x40')][_0x52e5('0x41')](_0x52e5('0x44'),_0x2692c4[_0x52e5('0x3b')]);_0x49afe7['user'][_0x52e5('0x45')]=!![];}}}return _0x49afe7;}function parseModelFields(_0x4810a4,_0x3f6012){var _0x35f8f6=squel[_0x52e5('0x21')]();var _0x3e6f09=_(_0x4810a4)[_0x52e5('0x46')]()[_0x52e5('0x3e')](function(_0x3e269d){return _['some'](_0x3f6012,['name',_0x3e269d])?_0x3e269d:undefined;})[_0x52e5('0x47')]()[_0x52e5('0x3b')]();if(_0x4810a4[_0x52e5('0x48')]){_0x3e6f09[_0x52e5('0x49')](_0x52e5('0x48'));}if(_0x4810a4[_0x52e5('0x43')]){_0x3e6f09[_0x52e5('0x49')](_0x52e5('0x43'));}if(_0x3e6f09[_0x52e5('0x26')]>0x0){_0x3e6f09[_0x52e5('0x1f')](function(_0x55e276){if(_0x55e276==='ListId'){_0x35f8f6[_0x52e5('0x41')]('c.ListId\x20IN\x20?',[]['concat'](_0x4810a4[_0x55e276]));}else if(_0x55e276===_0x52e5('0x48')){var _0xe1d2ab='%'+_0x4810a4[_0x55e276]+'%';_0x35f8f6['and'](_0x52e5('0x4a'),_0xe1d2ab);}else if(_0x55e276===_0x52e5('0x43')){_0x35f8f6[_0x52e5('0x41')](_0x52e5('0x44'),_0x4810a4[_0x55e276]);}else{_0x35f8f6[_0x52e5('0x41')]('c.'+_0x55e276+_0x52e5('0x4b'),_0x4810a4[_0x55e276]);}});}return _0x35f8f6;}function parseQueryParameters(_0x185f7b,_0x254aac){var _0x5d46be=getSqlClauses();return Promise[_0x52e5('0x4c')]()[_0x52e5('0x4d')](function(){return parseModelFields(_0x185f7b,_0x254aac);})[_0x52e5('0x4d')](function(_0x3041af){_0x5d46be[_0x52e5('0x4e')][_0x52e5('0x41')](_0x3041af);return parseTagParameter(_0x185f7b[_0x52e5('0x4f')]);})[_0x52e5('0x4d')](function(_0x52d991){_0x5d46be['tags'][_0x52e5('0x40')][_0x52e5('0x41')](_0x52d991);return parseSearchFilter(_0x185f7b[_0x52e5('0x50')]);})[_0x52e5('0x4d')](function(_0xa91862){_0x5d46be[_0x52e5('0x50')]=_0xa91862;return _0x5d46be;});}function checkListsRestrictions(_0x14b468,_0x47b70f,_0x36b4bc){var _0x509742=squel['expr']();return Promise[_0x52e5('0x4c')]()[_0x52e5('0x4d')](function(){if(_0x47b70f[_0x52e5('0x51')]&&_0x14b468['role']==='agent'&&!_0x36b4bc){return _0x14b468['getLists']({'attributes':['id'],'raw':!![]});}})[_0x52e5('0x4d')](function(_0x5a6305){if(_0x5a6305){if(_0x5a6305['length']===0x0){_0x509742['and'](_0x52e5('0x52'));}else{_0x509742[_0x52e5('0x41')]('c.ListId\x20IN\x20?',_[_0x52e5('0x3e')](_0x5a6305,'id'));}}})[_0x52e5('0x4d')](function(){return _0x509742;});}function buildContactsQuery(_0x5c096f,_0x47648a,_0xc956dc,_0x321a4a,_0x555e11,_0x44c7a4){if(_0x47648a){_0x47648a=_0xc956dc[_0x52e5('0x53')];}_0x5c096f=addFieldsToQuery(_0x5c096f,_0x47648a,_0x321a4a,_0x44c7a4,!![]);var _0x10b0ea=squel[_0x52e5('0x54')]();_0x10b0ea=addFieldsToQuery(_0x10b0ea,_0x47648a,_0x321a4a,_0x44c7a4,![]);if(_0x321a4a||_0x44c7a4){_0x5c096f=applyJoinClauses(_0x5c096f,!![]);_0x5c096f[_0x52e5('0x55')](_0x52e5('0x56'));if(_0xc956dc[_0x52e5('0x57')]){_0x10b0ea[_0x52e5('0x57')](_0xc956dc['limit']);}if(_0xc956dc['offset']){_0x10b0ea[_0x52e5('0x58')](_0xc956dc[_0x52e5('0x58')]);}}else{_0x10b0ea=applyJoinClauses(_0x10b0ea,![]);_0x10b0ea[_0x52e5('0x55')](_0x52e5('0x59'));if(_0xc956dc[_0x52e5('0x57')]){_0x5c096f[_0x52e5('0x57')](_0xc956dc[_0x52e5('0x57')]);}if(_0xc956dc[_0x52e5('0x58')]){_0x5c096f[_0x52e5('0x58')](_0xc956dc[_0x52e5('0x58')]);}}_0x10b0ea[_0x52e5('0x5a')](_0x555e11);if(_0xc956dc[_0x52e5('0x5b')]){_0xc956dc[_0x52e5('0x5b')][_0x52e5('0x1f')](function(_0x404d67){_0x5c096f['order']('c.'+_0x404d67[0x0],_0x404d67[0x1]===_0x52e5('0x5c')?![]:!![]);_0x10b0ea[_0x52e5('0x5b')](_0x52e5('0x5d')+_0x404d67[0x0],_0x404d67[0x1]===_0x52e5('0x5c')?![]:!![]);});}_0x10b0ea[_0x52e5('0x5e')](_0x5c096f,_0x52e5('0xc'));return _0x10b0ea;}function getFilteredContacts(_0x21f4f6){var _0x7a2d25=[];return db[_0x52e5('0x3d')][_0x52e5('0x5f')]({'attributes':['id',_0x52e5('0x32'),_0x52e5('0x60')],'raw':!![]})['then'](function(_0x448637){_0x7a2d25=_['keyBy'](_0x448637,'id');var _0x39cac4={'type':db[_0x52e5('0x61')][_0x52e5('0x62')][_0x52e5('0x63')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x52e5('0x64')](_0x21f4f6[_0x52e5('0x65')](),_0x39cac4);})[_0x52e5('0x4d')](function(_0x2cba67){_0x2cba67['forEach'](function(_0x2c33db){if(_0x2c33db[_0x52e5('0x1e')]){_0x2c33db[_0x52e5('0x66')]=[];_0x2c33db[_0x52e5('0x1e')][_0x52e5('0x25')](',')['forEach'](function(_0x335e2e){_0x2c33db[_0x52e5('0x66')][_0x52e5('0x49')](_0x7a2d25[_0x335e2e]);});}delete _0x2c33db[_0x52e5('0x1e')];});return _0x2cba67;});}function countFilteredContacts(_0x388e8d,_0x155f8a){var _0x2bceb4=_0x388e8d[_0x52e5('0x67')]();_0x2bceb4[_0x52e5('0x20')](_0x52e5('0x68'));_0x2bceb4=applyJoinClauses(_0x2bceb4,!![]);_0x388e8d[_0x52e5('0x55')](_0x52e5('0x56'));var _0x5a159e=utils[_0x52e5('0x22')](_0x155f8a);if(!_['isEmpty'](_0x5a159e)){_0x2bceb4[_0x52e5('0xa')](_0x52e5('0x69'),_0x5a159e);}var _0x3494da={'type':db['Sequelize']['QueryTypes'][_0x52e5('0x63')],'raw':!![]};return db[_0x52e5('0x6a')][_0x52e5('0x64')](_0x2bceb4['toString'](),_0x3494da)[_0x52e5('0x4d')](function(_0x1ec64b){return _0x1ec64b[0x0][_0x52e5('0x68')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index df011d4..3ebdefa 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 _0x8f7f=['secrets','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','update','binary','write','end','final','unlink','createReadStream','data','close','encryptString','secret','createCipher','base64','decryptString','createDecipher','utf8','crypto','bluebird','../../config/environment','../../config/logger'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x8f7f,0x167));var _0xf8f7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f7f[_0x2641f9];return _0x585741;};'use strict';var crypto=require(_0xf8f7('0x0'));var fs=require('fs');var BPromise=require(_0xf8f7('0x1'));var _=require('lodash');var config=require(_0xf8f7('0x2'));var logger=require(_0xf8f7('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf8f7('0x4')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xf8f7('0x5')};if(config['encrypt']&&config[_0xf8f7('0x6')][_0xf8f7('0x7')]){var isSupported=isAlgorithmSupported(config[_0xf8f7('0x6')][_0xf8f7('0x7')]);if(isSupported){fileOptions[_0xf8f7('0x7')]=config[_0xf8f7('0x6')][_0xf8f7('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf8f7('0x8')](',\x20');logger['error'](config[_0xf8f7('0x6')][_0xf8f7('0x7')],_0xf8f7('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x3c1214){return AES_SUPPORTED_RX[_0xf8f7('0xa')](_0x3c1214);}function getSupportedCiphers(){return crypto[_0xf8f7('0xb')]()[_0xf8f7('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x354e4b){return getSupportedCiphers()[_0xf8f7('0xd')](_0x354e4b)>-0x1;}function combineOptions(_0x4aa561){var _0x338dde={};for(var _0x29f6b8 in fileOptions){if(fileOptions[_0xf8f7('0xe')](_0x29f6b8)){_0x338dde[_0x29f6b8]=fileOptions[_0x29f6b8];}}if(_0x4aa561){for(var _0x8b9c98 in _0x4aa561){if(_0x4aa561[_0xf8f7('0xe')](_0x8b9c98)){_0x338dde[_0x8b9c98]=_0x4aa561[_0x8b9c98];}}}return _0x338dde;}exports[_0xf8f7('0xf')]=function(_0x278007,_0x40b359,_0xdf1965,_0xc968ea){return new BPromise(function(_0x31055e,_0x235789){_0xc968ea=combineOptions(_0xc968ea);var _0x1521bf=new Buffer(_0xdf1965);var _0x41d93e=fs['createReadStream'](_0x278007);var _0x178ec8=fs[_0xf8f7('0x10')](_0x40b359);var _0x248eeb=crypto['createCipher'](_0xc968ea[_0xf8f7('0x7')],_0x1521bf);_0x41d93e['on']('data',function(_0x327eda){var _0x4ed27c=new Buffer(_0x248eeb[_0xf8f7('0x11')](_0x327eda),_0xf8f7('0x12'));_0x178ec8[_0xf8f7('0x13')](_0x4ed27c);});_0x41d93e['on'](_0xf8f7('0x14'),function(){try{var _0x2ed140=new Buffer(_0x248eeb[_0xf8f7('0x15')](_0xf8f7('0x12')),'binary');_0x178ec8['write'](_0x2ed140);_0x178ec8[_0xf8f7('0x14')]();_0x178ec8['on']('close',function(){return _0x31055e(_0x40b359);});}catch(_0x4b932d){fs[_0xf8f7('0x16')](_0x40b359);return _0x235789(_0x4b932d);}});});};exports['decryptFile']=function(_0xc1c5f0,_0x2a477c,_0x25a76b,_0xf8fb9){return new BPromise(function(_0x3c1055,_0x261a66){_0xf8fb9=combineOptions(_0xf8fb9);var _0x416cb3=new Buffer(_0x25a76b);var _0x21de44=fs[_0xf8f7('0x17')](_0xc1c5f0);var _0x1e78f3=fs[_0xf8f7('0x10')](_0x2a477c);var _0x3ee44c=crypto['createDecipher'](_0xf8fb9['algorithm'],_0x416cb3);_0x21de44['on'](_0xf8f7('0x18'),function(_0x3a3082){var _0x42047a=new Buffer(_0x3ee44c[_0xf8f7('0x11')](_0x3a3082),_0xf8f7('0x12'));_0x1e78f3['write'](_0x42047a);});_0x21de44['on'](_0xf8f7('0x14'),function(){try{var _0x396246=new Buffer(_0x3ee44c[_0xf8f7('0x15')](_0xf8f7('0x12')),_0xf8f7('0x12'));_0x1e78f3[_0xf8f7('0x13')](_0x396246);_0x1e78f3[_0xf8f7('0x14')]();_0x1e78f3['on'](_0xf8f7('0x19'),function(){return _0x3c1055(_0x2a477c);});}catch(_0x33e061){fs[_0xf8f7('0x16')](_0x2a477c);return _0x261a66(_0x33e061);}});});};exports[_0xf8f7('0x1a')]=function(_0x360c7b,_0x1e7953,_0x29e264){var _0x2899f7=_0x29e264||stringOptions[_0xf8f7('0x7')];var _0x516fdc=_0x1e7953||stringOptions[_0xf8f7('0x1b')];var _0x225991=crypto[_0xf8f7('0x1c')](_0x2899f7,_0x516fdc);var _0x3bc97f=_0x225991[_0xf8f7('0x11')](_0x360c7b,'utf8',_0xf8f7('0x1d'));_0x3bc97f+=_0x225991['final'](_0xf8f7('0x1d'));return _0x3bc97f;};exports[_0xf8f7('0x1e')]=function(_0x599844,_0x5ef66a,_0x6cb9ff){var _0x117fa1=_0x6cb9ff||stringOptions[_0xf8f7('0x7')];var _0x2584be=_0x5ef66a||stringOptions[_0xf8f7('0x1b')];var _0x5e65ba=crypto[_0xf8f7('0x1f')](_0x117fa1,_0x2584be);var _0x29f16f=_0x5e65ba[_0xf8f7('0x11')](_0x599844,'base64',_0xf8f7('0x20'));_0x29f16f+=_0x5e65ba[_0xf8f7('0x15')](_0xf8f7('0x20'));return _0x29f16f;}; \ No newline at end of file +var _0xeaa7=['encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','write','end','final','binary','close','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/logger','app','secrets','session'];(function(_0x577ae7,_0x22cab4){var _0x223614=function(_0x5deedf){while(--_0x5deedf){_0x577ae7['push'](_0x577ae7['shift']());}};_0x223614(++_0x22cab4);}(_0xeaa7,0x14f));var _0x7eaa=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xeaa7[_0x1034ca];return _0x1a023a;};'use strict';var crypto=require(_0x7eaa('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x7eaa('0x1'));var config=require('../../config/environment');var logger=require(_0x7eaa('0x2'))(_0x7eaa('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7eaa('0x4')][_0x7eaa('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x7eaa('0x6')]&&config[_0x7eaa('0x6')][_0x7eaa('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x7eaa('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0x7eaa('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x7eaa('0x8')](config[_0x7eaa('0x6')][_0x7eaa('0x7')],_0x7eaa('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x21d7bd){return AES_SUPPORTED_RX[_0x7eaa('0xa')](_0x21d7bd);}function getSupportedCiphers(){return crypto[_0x7eaa('0xb')]()[_0x7eaa('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x4d300f){return getSupportedCiphers()[_0x7eaa('0xd')](_0x4d300f)>-0x1;}function combineOptions(_0x530ac7){var _0x320265={};for(var _0x16baad in fileOptions){if(fileOptions[_0x7eaa('0xe')](_0x16baad)){_0x320265[_0x16baad]=fileOptions[_0x16baad];}}if(_0x530ac7){for(var _0x5ea28a in _0x530ac7){if(_0x530ac7[_0x7eaa('0xe')](_0x5ea28a)){_0x320265[_0x5ea28a]=_0x530ac7[_0x5ea28a];}}}return _0x320265;}exports[_0x7eaa('0xf')]=function(_0x9067dc,_0x482a8e,_0xc0be3a,_0x340bca){return new BPromise(function(_0xf78ce3,_0x3c651e){_0x340bca=combineOptions(_0x340bca);var _0x3d56ec=new Buffer(_0xc0be3a);var _0x2c25c7=fs[_0x7eaa('0x10')](_0x9067dc);var _0x434b3e=fs[_0x7eaa('0x11')](_0x482a8e);var _0x167217=crypto[_0x7eaa('0x12')](_0x340bca[_0x7eaa('0x7')],_0x3d56ec);_0x2c25c7['on'](_0x7eaa('0x13'),function(_0x128c62){var _0x37b580=new Buffer(_0x167217['update'](_0x128c62),'binary');_0x434b3e[_0x7eaa('0x14')](_0x37b580);});_0x2c25c7['on'](_0x7eaa('0x15'),function(){try{var _0x3d7f12=new Buffer(_0x167217[_0x7eaa('0x16')](_0x7eaa('0x17')),_0x7eaa('0x17'));_0x434b3e[_0x7eaa('0x14')](_0x3d7f12);_0x434b3e['end']();_0x434b3e['on'](_0x7eaa('0x18'),function(){return _0xf78ce3(_0x482a8e);});}catch(_0x443d07){fs['unlink'](_0x482a8e);return _0x3c651e(_0x443d07);}});});};exports['decryptFile']=function(_0x598bf0,_0x37ef79,_0x37e21f,_0x12886e){return new BPromise(function(_0x2e5724,_0x23beb4){_0x12886e=combineOptions(_0x12886e);var _0x4c8af8=new Buffer(_0x37e21f);var _0x5c0a81=fs[_0x7eaa('0x10')](_0x598bf0);var _0xf47a61=fs['createWriteStream'](_0x37ef79);var _0x4e146b=crypto[_0x7eaa('0x19')](_0x12886e[_0x7eaa('0x7')],_0x4c8af8);_0x5c0a81['on'](_0x7eaa('0x13'),function(_0x423915){var _0x459183=new Buffer(_0x4e146b['update'](_0x423915),_0x7eaa('0x17'));_0xf47a61['write'](_0x459183);});_0x5c0a81['on'](_0x7eaa('0x15'),function(){try{var _0x51999b=new Buffer(_0x4e146b['final'](_0x7eaa('0x17')),_0x7eaa('0x17'));_0xf47a61[_0x7eaa('0x14')](_0x51999b);_0xf47a61[_0x7eaa('0x15')]();_0xf47a61['on']('close',function(){return _0x2e5724(_0x37ef79);});}catch(_0x5b45ae){fs['unlink'](_0x37ef79);return _0x23beb4(_0x5b45ae);}});});};exports[_0x7eaa('0x1a')]=function(_0x13b079,_0x40f11e,_0x2dc543){var _0x460b67=_0x2dc543||stringOptions[_0x7eaa('0x7')];var _0x2920de=_0x40f11e||stringOptions[_0x7eaa('0x1b')];var _0x1f709b=crypto[_0x7eaa('0x12')](_0x460b67,_0x2920de);var _0x528265=_0x1f709b['update'](_0x13b079,_0x7eaa('0x1c'),_0x7eaa('0x1d'));_0x528265+=_0x1f709b['final'](_0x7eaa('0x1d'));return _0x528265;};exports[_0x7eaa('0x1e')]=function(_0x2a7af2,_0x3a5a4d,_0x2a5709){var _0x72dfe6=_0x2a5709||stringOptions[_0x7eaa('0x7')];var _0x460e04=_0x3a5a4d||stringOptions[_0x7eaa('0x1b')];var _0x26c333=crypto['createDecipher'](_0x72dfe6,_0x460e04);var _0x2f4d4b=_0x26c333['update'](_0x2a7af2,_0x7eaa('0x1d'),_0x7eaa('0x1c'));_0x2f4d4b+=_0x26c333[_0x7eaa('0x16')](_0x7eaa('0x1c'));return _0x2f4d4b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 263397f..9dde896 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 _0xe2be=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0xe2be,0xd2));var _0xee2b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe2be[_0x110c3d];return _0x226d67;};'use strict';var util=require(_0xee2b('0x0'));var path=require('path');var _=require(_0xee2b('0x1'));var csv=require(_0xee2b('0x2'));var fs=require('fs');var BPromise=require(_0xee2b('0x3'));var zipdir=require(_0xee2b('0x4'));var rimraf=require(_0xee2b('0x5'));var db=require(_0xee2b('0x6'))['db'];var dbH=require('../../mysqldb')[_0xee2b('0x7')];var logger=require(_0xee2b('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xee2b('0x9')][0x2]);var QUERY=process[_0xee2b('0x9')][0x3];var PATH=process[_0xee2b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d9e3f,_0x4d59d5){var _0x53e1ba={'status':_0x5d9e3f};var _0x208042={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d59d5){_0x53e1ba[_0xee2b('0xa')]=_0x4d59d5;}return db['AnalyticExtractedReport']['update'](_0x53e1ba,_0x208042);}function main(){var _0x42070e=0x1388;var _0x387e57;logger['info'](util[_0xee2b('0xb')](_0xee2b('0xc'),EXTRACTED_REPORT_ID,_0xee2b('0xd')));return db[_0xee2b('0xe')][_0xee2b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xee2b('0x10'),_0xee2b('0x11')]})[_0xee2b('0x12')](function(_0x39dcb4){if(_0x39dcb4){_0x387e57=_0x39dcb4;_0x42070e=_0x387e57[_0xee2b('0x11')]||0x1388;}})[_0xee2b('0x12')](function(){return dbH[_0xee2b('0x13')][_0xee2b('0x14')](util['format'](_0xee2b('0x15'),QUERY),{'type':dbH[_0xee2b('0x13')][_0xee2b('0x16')][_0xee2b('0x17')]});})[_0xee2b('0x12')](function(_0x131205){if(!_0x131205[0x0]['num']){return analyticExtractedReport(_0xee2b('0x18'));}var _0x5cfe7b=[];var _0x1bbc82=0x0;if(_0x387e57[_0xee2b('0x10')]){if(_0x131205&&_0x131205[_0xee2b('0x19')]){var _0x3b47e1=_[_0xee2b('0x1a')](_0x131205[0x0][_0xee2b('0x1b')]/_0x42070e);var _0x5c4d36=Number['isInteger'](_0x131205[0x0][_0xee2b('0x1b')]/_0x42070e)?_0x131205[0x0][_0xee2b('0x1b')]%_0x42070e:0x0;_0x3b47e1[_0xee2b('0x1c')](function(_0x358381){if(_0x358381>0x0){_0x1bbc82+=_0x42070e;}_0x5cfe7b[_0xee2b('0x1d')](dbH[_0xee2b('0x13')][_0xee2b('0x14')](util['format'](_0xee2b('0x1e'),QUERY,_0x42070e,_0x1bbc82),{'type':dbH['sequelize'][_0xee2b('0x16')][_0xee2b('0x17')]}));});if(_0x5c4d36>0x0){_0x1bbc82+=_0x42070e;_0x5cfe7b[_0xee2b('0x1d')](dbH[_0xee2b('0x13')][_0xee2b('0x14')](util['format'](_0xee2b('0x1e'),QUERY,_0x5c4d36,_0x1bbc82),{'type':dbH[_0xee2b('0x13')][_0xee2b('0x16')][_0xee2b('0x17')]}));}}}else{_0x5cfe7b[_0xee2b('0x1d')](dbH[_0xee2b('0x13')][_0xee2b('0x14')](QUERY,{'type':dbH['sequelize'][_0xee2b('0x16')]['SELECT']}));}var _0x51570a=path[_0xee2b('0x1f')](PATH);var _0x4e81f9=path[_0xee2b('0x20')](PATH,'.csv');var _0x428a3e=_0x387e57[_0xee2b('0x10')]&&_0x5cfe7b['length']>0x1;var _0x126561=[];if(!fs[_0xee2b('0x21')](path[_0xee2b('0x22')](_0x51570a,_0x4e81f9))&&_0x428a3e){fs[_0xee2b('0x23')](path[_0xee2b('0x22')](_0x51570a,_0x4e81f9));}return BPromise['each'](_0x5cfe7b,function(_0x55ae52){_0x126561['push'](_0x55ae52);})[_0xee2b('0x12')](function(){for(var _0x158fde=0x0;_0x158fde<_0x126561[_0xee2b('0x19')];_0x158fde+=0x1){var _0x1f4a80;var _0x5f32fe=_0x126561[_0x158fde];if(_0x428a3e){_0x1f4a80=path[_0xee2b('0x22')](_0x51570a,_0x4e81f9,util[_0xee2b('0xb')](_0xee2b('0x24'),_0x4e81f9,_0x158fde,_0xee2b('0x25')));}else{_0x1f4a80=path[_0xee2b('0x22')](_0x51570a,util['format'](_0xee2b('0x26'),_0x4e81f9,_0xee2b('0x25')));}fs['writeFileSync'](_0x1f4a80,csv(_0x5f32fe));}})[_0xee2b('0x12')](function(){if(_0x428a3e){return new Promise(function(_0x358f59){zipdir(path[_0xee2b('0x22')](_0x51570a,_0x4e81f9),{'saveTo':path['join'](_0x51570a,util['format'](_0xee2b('0x26'),_0x4e81f9,_0xee2b('0x27')))},function(_0x237c80,_0x282144){rimraf(path[_0xee2b('0x22')](_0x51570a,_0x4e81f9),function(){});_0x358f59(_0xee2b('0x28'));});});}})[_0xee2b('0x12')](function(){logger['info'](util[_0xee2b('0xb')](_0xee2b('0x29'),EXTRACTED_REPORT_ID,_0xee2b('0xd')));return analyticExtractedReport(_0xee2b('0x2a'),_0x428a3e?util[_0xee2b('0xb')](_0xee2b('0x26'),_0x4e81f9,_0x428a3e?_0xee2b('0x27'):_0xee2b('0x25')):null);});})['catch'](function(_0x2c50a0){logger[_0xee2b('0x2b')](util[_0xee2b('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xee2b('0xd')),util[_0xee2b('0x2c')](_0x2c50a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xee2b('0x2d'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8df9=['split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','existsSync','join','mkdirSync','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0x8df9,0x174));var _0x98df=function(_0x201b2d,_0xb2146f){_0x201b2d=_0x201b2d-0x0;var _0x3e85d4=_0x8df9[_0x201b2d];return _0x3e85d4;};'use strict';var util=require(_0x98df('0x0'));var path=require(_0x98df('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x98df('0x2'));var rimraf=require('rimraf');var db=require(_0x98df('0x3'))['db'];var dbH=require(_0x98df('0x3'))[_0x98df('0x4')];var logger=require(_0x98df('0x5'))(_0x98df('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x98df('0x7')][0x2]);var QUERY=process[_0x98df('0x7')][0x3];var PATH=process[_0x98df('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x239881,_0x248ae9){var _0x414432={'status':_0x239881};var _0x4416d0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x248ae9){_0x414432['savename']=_0x248ae9;}return db[_0x98df('0x8')]['update'](_0x414432,_0x4416d0);}function main(){var _0x148c75=0x1388;var _0x4eaca9;logger[_0x98df('0x9')](util[_0x98df('0xa')](_0x98df('0xb'),EXTRACTED_REPORT_ID,_0x98df('0xc')));return db[_0x98df('0xd')][_0x98df('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x98df('0xf'),_0x98df('0x10')]})[_0x98df('0x11')](function(_0x300e09){if(_0x300e09){_0x4eaca9=_0x300e09;_0x148c75=_0x4eaca9['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x98df('0x12')][_0x98df('0x13')](util['format'](_0x98df('0x14'),QUERY),{'type':dbH[_0x98df('0x12')][_0x98df('0x15')][_0x98df('0x16')]});})[_0x98df('0x11')](function(_0x29fb19){if(!_0x29fb19[0x0][_0x98df('0x17')]){return analyticExtractedReport('Empty');}var _0x4251ea=[];var _0xa14b81=0x0;if(_0x4eaca9[_0x98df('0xf')]){if(_0x29fb19&&_0x29fb19[_0x98df('0x18')]){var _0x4f46f9=_[_0x98df('0x19')](_0x29fb19[0x0][_0x98df('0x17')]/_0x148c75);var _0x2640f2=Number[_0x98df('0x1a')](_0x29fb19[0x0]['num']/_0x148c75)?_0x29fb19[0x0]['num']%_0x148c75:0x0;_0x4f46f9[_0x98df('0x1b')](function(_0xb9c580){if(_0xb9c580>0x0){_0xa14b81+=_0x148c75;}_0x4251ea['push'](dbH[_0x98df('0x12')][_0x98df('0x13')](util[_0x98df('0xa')](_0x98df('0x1c'),QUERY,_0x148c75,_0xa14b81),{'type':dbH[_0x98df('0x12')][_0x98df('0x15')]['SELECT']}));});if(_0x2640f2>0x0){_0xa14b81+=_0x148c75;_0x4251ea[_0x98df('0x1d')](dbH[_0x98df('0x12')][_0x98df('0x13')](util[_0x98df('0xa')](_0x98df('0x1c'),QUERY,_0x2640f2,_0xa14b81),{'type':dbH[_0x98df('0x12')][_0x98df('0x15')][_0x98df('0x16')]}));}}}else{_0x4251ea['push'](dbH[_0x98df('0x12')][_0x98df('0x13')](QUERY,{'type':dbH[_0x98df('0x12')]['QueryTypes'][_0x98df('0x16')]}));}var _0x5325b1=path['dirname'](PATH);var _0x813740=path['basename'](PATH,'.csv');var _0x28c6e2=_0x4eaca9[_0x98df('0xf')]&&_0x4251ea['length']>0x1;var _0x145632=[];if(!fs[_0x98df('0x1e')](path[_0x98df('0x1f')](_0x5325b1,_0x813740))&&_0x28c6e2){fs[_0x98df('0x20')](path['join'](_0x5325b1,_0x813740));}return BPromise['each'](_0x4251ea,function(_0x36d598){_0x145632[_0x98df('0x1d')](_0x36d598);})[_0x98df('0x11')](function(){for(var _0x3b59b6=0x0;_0x3b59b6<_0x145632[_0x98df('0x18')];_0x3b59b6+=0x1){var _0x17f602;var _0x18bc42=_0x145632[_0x3b59b6];if(_0x28c6e2){_0x17f602=path[_0x98df('0x1f')](_0x5325b1,_0x813740,util[_0x98df('0xa')]('%s%d.%s',_0x813740,_0x3b59b6,_0x98df('0x21')));}else{_0x17f602=path[_0x98df('0x1f')](_0x5325b1,util[_0x98df('0xa')](_0x98df('0x22'),_0x813740,_0x98df('0x21')));}fs[_0x98df('0x23')](_0x17f602,csv(_0x18bc42));}})[_0x98df('0x11')](function(){if(_0x28c6e2){return new Promise(function(_0x48dd88){zipdir(path[_0x98df('0x1f')](_0x5325b1,_0x813740),{'saveTo':path[_0x98df('0x1f')](_0x5325b1,util[_0x98df('0xa')]('%s.%s',_0x813740,_0x98df('0x24')))},function(_0x38f1a3,_0x156e7c){rimraf(path['join'](_0x5325b1,_0x813740),function(){});_0x48dd88(_0x98df('0x25'));});});}})[_0x98df('0x11')](function(){logger[_0x98df('0x9')](util[_0x98df('0xa')](_0x98df('0x26'),EXTRACTED_REPORT_ID,_0x98df('0xc')));return analyticExtractedReport('Completed',_0x28c6e2?util[_0x98df('0xa')](_0x98df('0x22'),_0x813740,_0x28c6e2?_0x98df('0x24'):'csv'):null);});})[_0x98df('0x27')](function(_0x11a2a1){logger[_0x98df('0x9')](util['format'](_0x98df('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0x98df('0x29')](_0x11a2a1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x98df('0x2a'));})['finally'](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 4251e67..b3460b7 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 _0xed9f=['%s%d.%s','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','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.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','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','landscape','\x20/\x20','Arial','black','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','basename','existsSync','join','mkdirSync','each','createPdfKitDocument'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed9f,0xd1));var _0xfed9=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xed9f[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0xfed9('0x0'));var fs=require('fs');var util=require(_0xfed9('0x1'));var path=require(_0xfed9('0x2'));var moment=require(_0xfed9('0x3'));var htmlToPdfmake=require(_0xfed9('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xfed9('0x5'));var rimraf=require(_0xfed9('0x6'));var JSDOM=require('jsdom')[_0xfed9('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0xfed9('0x8'));var db=require(_0xfed9('0x9'))['db'];var dbH=require('../../mysqldb')[_0xfed9('0xa')];var logger=require(_0xfed9('0xb'))(_0xfed9('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xfed9('0xd')][0x2]);var QUERY=process[_0xfed9('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xfed9('0xd')][0x5];var FORMAT=_0xfed9('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b358e,_0x3da781){var _0x959843={'status':_0x2b358e};var _0x138be1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3da781){_0x959843['savename']=_0x3da781;}return db[_0xfed9('0xf')]['update'](_0x959843,_0x138be1);}function getHeaders(_0x5f5015){return _[_0xfed9('0x10')](_0x5f5015,function(_0x1078af){return{'text':_0x1078af,'style':_0xfed9('0x11')};});}function getRows(_0x20743c,_0x366025){return _[_0xfed9('0x10')](_0x366025,function(_0x1ba246){return _(_0x1ba246)[_0xfed9('0x12')](_0x20743c)['map'](function(_0x518263){return _0x518263?_[_0xfed9('0x13')](_0x518263):'';})[_0xfed9('0x14')]();});}function createTable(_0x1f915b,_0x57ece1){var _0x52223b={'widths':_[_0xfed9('0x15')](Array(_0x1f915b[_0xfed9('0x16')]),0x91),'heights':function(_0x5c0198){return _0x5c0198===0x0?_0xfed9('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1bf636=getHeaders(_0x1f915b);_0x52223b[_0xfed9('0x18')][_0xfed9('0x19')](_0x1bf636);var _0x5815d3=getRows(_0x1f915b,_0x57ece1);_0x52223b[_0xfed9('0x18')]=_0x52223b['body'][_0xfed9('0x1a')](_0x5815d3);return _0x52223b;}function createTables(_0x343be1){var _0x2db4f4=[];var _0x5830a3=_[_0xfed9('0x1b')](Object[_0xfed9('0x1c')](_0x343be1[0x0]),0x5);_0x5830a3[_0xfed9('0x1d')](function(_0x9be7b0){_0x2db4f4[_0xfed9('0x19')](createTable(_0x9be7b0,_0x343be1));});return _0x2db4f4;}function getPDFDocDefinition(_0x599b51){var _0x4cb463=util[_0xfed9('0x1e')](_0xfed9('0x1f'),NAME,EXTRACTED_REPORT[_0xfed9('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0xfed9('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xfed9('0x21')])['format'](FORMAT));var _0x55d094=[];for(var _0x73fee7=0x0;_0x73fee7<_0x599b51[_0xfed9('0x16')];_0x73fee7++){var _0x725efc=[];if(_0x73fee7===0x0){_0x725efc['push']({'text':_0x4cb463,'style':_0xfed9('0x22')});}var _0x371c7c={'table':_0x599b51[_0x73fee7]};if(_0x73fee7>0x0){_0x371c7c['pageBreak']='before';_0x371c7c['margin']=[0x0,0x46,0x0,0x0];}_0x725efc[_0xfed9('0x19')](_0x371c7c);_0x55d094[_0xfed9('0x19')](_0x725efc);}return{'pageSize':'A4','pageOrientation':_0xfed9('0x23'),'content':_0x55d094,'footer':function(_0x2f0a6e,_0x38700a){return{'text':_0x2f0a6e[_0xfed9('0x13')]()+_0xfed9('0x24')+_0x38700a,'style':'footer'};},'defaultStyle':{'font':_0xfed9('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xfed9('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1b69d1){var _0x17507b=0x1388;var _0x30c315;if(!_0x1b69d1[0x0][_0xfed9('0x27')]){return analyticExtractedReport(_0xfed9('0x28'));}return db[_0xfed9('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfed9('0x2a'),_0xfed9('0x2b')]})[_0xfed9('0x2c')](function(_0x4c1f2d){if(_0x4c1f2d){_0x30c315=_0x4c1f2d;_0x17507b=_0x30c315[_0xfed9('0x2b')]||0x3e8;}})['then'](function(){var _0x15dc5e=[];var _0xa4101c=0x0;if(_0x30c315[_0xfed9('0x2a')]){if(_0x1b69d1&&_0x1b69d1['length']){var _0x44bcb4=_[_0xfed9('0x2d')](_0x1b69d1[0x0][_0xfed9('0x27')]/_0x17507b);var _0x5b4c3b=Number[_0xfed9('0x2e')](_0x1b69d1[0x0][_0xfed9('0x27')]/_0x17507b)?_0x1b69d1[0x0][_0xfed9('0x27')]%_0x17507b:0x0;_0x44bcb4['forEach'](function(_0x2c6d31){if(_0x2c6d31>0x0){_0xa4101c+=_0x17507b;}_0x15dc5e[_0xfed9('0x19')](dbH['sequelize']['query'](util[_0xfed9('0x1e')](_0xfed9('0x2f'),QUERY,_0x17507b,_0xa4101c),{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')][_0xfed9('0x32')]}));});if(_0x5b4c3b>0x0){_0xa4101c+=_0x17507b;_0x15dc5e[_0xfed9('0x19')](dbH[_0xfed9('0x30')][_0xfed9('0x33')](util[_0xfed9('0x1e')](_0xfed9('0x2f'),QUERY,_0x5b4c3b,_0xa4101c),{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')][_0xfed9('0x32')]}));}}}else{_0x15dc5e[_0xfed9('0x19')](dbH[_0xfed9('0x30')][_0xfed9('0x33')](QUERY,{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')]['SELECT']}));}var _0x4da09c=path['dirname'](PATH);var _0x43554d=path[_0xfed9('0x34')](PATH,'.pdf');var _0x9378e6=_0x30c315['split']&&_0x15dc5e[_0xfed9('0x16')]>0x1;var _0x54b736=[];if(!fs[_0xfed9('0x35')](path[_0xfed9('0x36')](_0x4da09c,_0x43554d))&&_0x9378e6){fs[_0xfed9('0x37')](path[_0xfed9('0x36')](_0x4da09c,_0x43554d));}return BPromise[_0xfed9('0x38')](_0x15dc5e,function(_0x296f18){_0x54b736[_0xfed9('0x19')](_0x296f18);})[_0xfed9('0x2c')](function(){var _0x4ce398=[];for(var _0x486624=0x0;_0x486624<_0x54b736[_0xfed9('0x16')];_0x486624+=0x1){var _0x46c5e3=_0x54b736[_0x486624];var _0x2f159f=createTables(_['flatten'](_0x46c5e3));var _0x32517b;var _0x1cb32c=getPDFDocDefinition(_0x2f159f);var _0x2175b4=getPDFPrinter();var _0xc3698=_0x2175b4[_0xfed9('0x39')](_0x1cb32c);if(_0x9378e6){_0x32517b=path['join'](_0x4da09c,_0x43554d,util[_0xfed9('0x1e')](_0xfed9('0x3a'),_0x43554d,_0x486624,_0xfed9('0x3b')));}else{_0x32517b=path['join'](_0x4da09c,util[_0xfed9('0x1e')](_0xfed9('0x3c'),_0x43554d,_0xfed9('0x3b')));}_0x4ce398[_0xfed9('0x19')](writePDFDocument(_0xc3698,_0x32517b));}return Promise[_0xfed9('0x3d')](_0x4ce398);})['then'](function(){if(_0x9378e6){return new Promise(function(_0x5780cd){zipdir(path['join'](_0x4da09c,_0x43554d),{'saveTo':path[_0xfed9('0x36')](_0x4da09c,util[_0xfed9('0x1e')](_0xfed9('0x3c'),_0x43554d,_0xfed9('0x3e')))},function(){rimraf(path[_0xfed9('0x36')](_0x4da09c,_0x43554d),function(){});_0x5780cd(_0xfed9('0x3f'));});});}})[_0xfed9('0x2c')](function(){if(!_0x9378e6)return;rimraf(path[_0xfed9('0x36')](_0x4da09c,_0x43554d),function(){});})[_0xfed9('0x2c')](function(){logger[_0xfed9('0x40')](util['format'](_0xfed9('0x41'),EXTRACTED_REPORT_ID,_0xfed9('0x42')));return analyticExtractedReport(_0xfed9('0x43'),_0x9378e6?util[_0xfed9('0x1e')]('%s.%s',_0x43554d,_0x9378e6?_0xfed9('0x3e'):_0xfed9('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xfed9('0x1e')](_0xfed9('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xfed9('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2b512f){EXTRACTED_REPORT=_0x2b512f;return dbH['sequelize'][_0xfed9('0x33')](util[_0xfed9('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')]['SELECT']});})['then'](extractReport)[_0xfed9('0x45')](function(_0x48e60f){logger['info'](util[_0xfed9('0x1e')](_0xfed9('0x46'),EXTRACTED_REPORT_ID,_0xfed9('0x42')),util['inspect'](_0x48e60f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfed9('0x47'));})[_0xfed9('0x48')](function(){process[_0xfed9('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xe0dd36=new PdfPrinter({'Arial':{'normal':__dirname+_0xfed9('0x4a'),'bold':__dirname+_0xfed9('0x4b'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0xe0dd36;}function getPDFDocDefinitionFromHTML(_0xdadb62,_0x18d88a){var _0x28623c=util[_0xfed9('0x1e')](_0xfed9('0x4c'),_0x18d88a[_0xfed9('0x4d')],_0x18d88a[_0xfed9('0x4e')]);var _0x2b2c21=moment()[_0xfed9('0x1e')](_0xfed9('0x4f'))[_0xfed9('0x13')]();var _0x1e532a=htmlToPdfmake(_0xdadb62,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e532a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xfed9('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xfed9('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xfed9('0x50')}},'header':function(){return[{'text':_0xfed9('0x51'),'style':_0xfed9('0x22')}];},'footer':function(_0x397cff,_0x175d45){return[{'text':util[_0xfed9('0x1e')](_0xfed9('0x52'),_0x28623c,_0x397cff,_0x175d45,_0x2b2c21),'style':'footer'}];}};}function writePDFDocument(_0x339480,_0x3274cd){return new Promise(function(_0x448a51,_0x501b10){var _0x2d053c=_0x339480[_0xfed9('0x53')](fs[_0xfed9('0x54')](_0x3274cd));_0x2d053c['on'](_0xfed9('0x55'),function(){_0x448a51(_0xfed9('0x55'));});_0x2d053c['on'](_0xfed9('0x56'),function(_0x29528e){_0x501b10(_0x29528e);});_0x339480[_0xfed9('0x57')]();});}exports[_0xfed9('0x58')]=function(_0x24205d,_0x26347c){var _0x2879b8=getPDFPrinter();var _0x384240=getPDFDocDefinitionFromHTML(_0x24205d,_0x26347c);var _0x215190=_0x2879b8[_0xfed9('0x39')](_0x384240);return writePDFDocument(_0x215190,_0x26347c[_0xfed9('0x2')])['catch'](function(_0x5c8ca5){throw _0x5c8ca5;});}; \ No newline at end of file +var _0xe920=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','createPdfFromHTML','catch','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','length','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.pdf','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','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne'];(function(_0x2a2a69,_0x4918e6){var _0x4580b5=function(_0x5d46f){while(--_0x5d46f){_0x2a2a69['push'](_0x2a2a69['shift']());}};_0x4580b5(++_0x4918e6);}(_0xe920,0x13b));var _0x0e92=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xe920[_0x2d4421];return _0x2d3b01;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x0e92('0x0'));var path=require('path');var moment=require(_0x0e92('0x1'));var htmlToPdfmake=require(_0x0e92('0x2'));var PdfPrinter=require(_0x0e92('0x3'));var zipdir=require(_0x0e92('0x4'));var rimraf=require(_0x0e92('0x5'));var JSDOM=require(_0x0e92('0x6'))[_0x0e92('0x7')];var window=new JSDOM('')[_0x0e92('0x8')];var BPromise=require(_0x0e92('0x9'));var db=require(_0x0e92('0xa'))['db'];var dbH=require(_0x0e92('0xa'))[_0x0e92('0xb')];var logger=require(_0x0e92('0xc'))(_0x0e92('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0e92('0xe')][0x3];var PATH=process[_0x0e92('0xe')][0x4];var NAME=process[_0x0e92('0xe')][0x5];var FORMAT=_0x0e92('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1cca5a,_0x20b4b4){var _0x2ec4fc={'status':_0x1cca5a};var _0x2b2cc5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20b4b4){_0x2ec4fc[_0x0e92('0x10')]=_0x20b4b4;}return db['AnalyticExtractedReport'][_0x0e92('0x11')](_0x2ec4fc,_0x2b2cc5);}function getHeaders(_0x266b05){return _[_0x0e92('0x12')](_0x266b05,function(_0x1b292d){return{'text':_0x1b292d,'style':_0x0e92('0x13')};});}function getRows(_0x1e9fc0,_0x493d){return _[_0x0e92('0x12')](_0x493d,function(_0x2823fe){return _(_0x2823fe)[_0x0e92('0x14')](_0x1e9fc0)[_0x0e92('0x12')](function(_0x23005a){return _0x23005a?_[_0x0e92('0x15')](_0x23005a):'';})['value']();});}function createTable(_0x2a4c78,_0x1f971a){var _0x446bc={'widths':_['fill'](Array(_0x2a4c78[_0x0e92('0x16')]),0x91),'heights':function(_0x21ccc1){return _0x21ccc1===0x0?_0x0e92('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x30833a=getHeaders(_0x2a4c78);_0x446bc[_0x0e92('0x18')][_0x0e92('0x19')](_0x30833a);var _0x3e8866=getRows(_0x2a4c78,_0x1f971a);_0x446bc['body']=_0x446bc['body'][_0x0e92('0x1a')](_0x3e8866);return _0x446bc;}function createTables(_0x5c21b5){var _0x2705df=[];var _0x300539=_[_0x0e92('0x1b')](Object[_0x0e92('0x1c')](_0x5c21b5[0x0]),0x5);_0x300539[_0x0e92('0x1d')](function(_0x1f5d63){_0x2705df['push'](createTable(_0x1f5d63,_0x5c21b5));});return _0x2705df;}function getPDFDocDefinition(_0x5453ea){var _0x4c721f=util['format'](_0x0e92('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x0e92('0x1f')])[_0x0e92('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0x0e92('0x21')])[_0x0e92('0x20')](FORMAT));var _0x1aee10=[];for(var _0x5edd97=0x0;_0x5edd97<_0x5453ea['length'];_0x5edd97++){var _0xb8a94f=[];if(_0x5edd97===0x0){_0xb8a94f[_0x0e92('0x19')]({'text':_0x4c721f,'style':_0x0e92('0x22')});}var _0x981ae6={'table':_0x5453ea[_0x5edd97]};if(_0x5edd97>0x0){_0x981ae6[_0x0e92('0x23')]=_0x0e92('0x24');_0x981ae6[_0x0e92('0x25')]=[0x0,0x46,0x0,0x0];}_0xb8a94f[_0x0e92('0x19')](_0x981ae6);_0x1aee10['push'](_0xb8a94f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x1aee10,'footer':function(_0x5d99ae,_0xd0754f){return{'text':_0x5d99ae[_0x0e92('0x15')]()+_0x0e92('0x26')+_0xd0754f,'style':_0x0e92('0x27')};},'defaultStyle':{'font':_0x0e92('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0e92('0x29')},'footer':{'alignment':_0x0e92('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2291c2){var _0x198b50=0x1388;var _0x3c65f3;if(!_0x2291c2[0x0][_0x0e92('0x2b')]){return analyticExtractedReport(_0x0e92('0x2c'));}return db[_0x0e92('0x2d')][_0x0e92('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x4c2215){if(_0x4c2215){_0x3c65f3=_0x4c2215;_0x198b50=_0x3c65f3[_0x0e92('0x2f')]||0x3e8;}})[_0x0e92('0x30')](function(){var _0xbdab33=[];var _0x6f1cd1=0x0;if(_0x3c65f3[_0x0e92('0x31')]){if(_0x2291c2&&_0x2291c2[_0x0e92('0x16')]){var _0x1f5989=_[_0x0e92('0x32')](_0x2291c2[0x0][_0x0e92('0x2b')]/_0x198b50);var _0x5eb128=Number[_0x0e92('0x33')](_0x2291c2[0x0]['num']/_0x198b50)?_0x2291c2[0x0]['num']%_0x198b50:0x0;_0x1f5989[_0x0e92('0x1d')](function(_0x15aaaa){if(_0x15aaaa>0x0){_0x6f1cd1+=_0x198b50;}_0xbdab33[_0x0e92('0x19')](dbH[_0x0e92('0x34')][_0x0e92('0x35')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x198b50,_0x6f1cd1),{'type':dbH[_0x0e92('0x34')][_0x0e92('0x36')]['SELECT']}));});if(_0x5eb128>0x0){_0x6f1cd1+=_0x198b50;_0xbdab33[_0x0e92('0x19')](dbH[_0x0e92('0x34')][_0x0e92('0x35')](util[_0x0e92('0x20')](_0x0e92('0x37'),QUERY,_0x5eb128,_0x6f1cd1),{'type':dbH[_0x0e92('0x34')][_0x0e92('0x36')]['SELECT']}));}}}else{_0xbdab33[_0x0e92('0x19')](dbH[_0x0e92('0x34')][_0x0e92('0x35')](QUERY,{'type':dbH[_0x0e92('0x34')][_0x0e92('0x36')][_0x0e92('0x38')]}));}var _0x331fe2=path['dirname'](PATH);var _0x2c860b=path[_0x0e92('0x39')](PATH,_0x0e92('0x3a'));var _0x5a65c3=_0x3c65f3[_0x0e92('0x31')]&&_0xbdab33[_0x0e92('0x16')]>0x1;var _0x3696e2=[];if(!fs[_0x0e92('0x3b')](path[_0x0e92('0x3c')](_0x331fe2,_0x2c860b))&&_0x5a65c3){fs[_0x0e92('0x3d')](path[_0x0e92('0x3c')](_0x331fe2,_0x2c860b));}return BPromise[_0x0e92('0x3e')](_0xbdab33,function(_0xba0da0){_0x3696e2[_0x0e92('0x19')](_0xba0da0);})[_0x0e92('0x30')](function(){var _0x5a69ff=[];for(var _0x340287=0x0;_0x340287<_0x3696e2[_0x0e92('0x16')];_0x340287+=0x1){var _0x609394=_0x3696e2[_0x340287];var _0x1bdacf=createTables(_[_0x0e92('0x3f')](_0x609394));var _0x35f658;var _0x3caaf4=getPDFDocDefinition(_0x1bdacf);var _0x13bab2=getPDFPrinter();var _0x141f51=_0x13bab2[_0x0e92('0x40')](_0x3caaf4);if(_0x5a65c3){_0x35f658=path[_0x0e92('0x3c')](_0x331fe2,_0x2c860b,util[_0x0e92('0x20')](_0x0e92('0x41'),_0x2c860b,_0x340287,_0x0e92('0x42')));}else{_0x35f658=path[_0x0e92('0x3c')](_0x331fe2,util[_0x0e92('0x20')](_0x0e92('0x43'),_0x2c860b,_0x0e92('0x42')));}_0x5a69ff[_0x0e92('0x19')](writePDFDocument(_0x141f51,_0x35f658));}return Promise['all'](_0x5a69ff);})[_0x0e92('0x30')](function(){if(_0x5a65c3){return new Promise(function(_0xbc6382){zipdir(path[_0x0e92('0x3c')](_0x331fe2,_0x2c860b),{'saveTo':path['join'](_0x331fe2,util[_0x0e92('0x20')]('%s.%s',_0x2c860b,_0x0e92('0x44')))},function(){rimraf(path['join'](_0x331fe2,_0x2c860b),function(){});_0xbc6382(_0x0e92('0x45'));});});}})[_0x0e92('0x30')](function(){if(!_0x5a65c3)return;rimraf(path[_0x0e92('0x3c')](_0x331fe2,_0x2c860b),function(){});})['then'](function(){logger[_0x0e92('0x46')](util[_0x0e92('0x20')](_0x0e92('0x47'),EXTRACTED_REPORT_ID,_0x0e92('0x48')));return analyticExtractedReport(_0x0e92('0x49'),_0x5a65c3?util[_0x0e92('0x20')](_0x0e92('0x43'),_0x2c860b,_0x5a65c3?_0x0e92('0x44'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x0e92('0x4a'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x0e92('0x4b')][_0x0e92('0x4c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0e92('0x30')](function(_0x299c3d){EXTRACTED_REPORT=_0x299c3d;return dbH['sequelize']['query'](util[_0x0e92('0x20')](_0x0e92('0x4d'),QUERY),{'type':dbH[_0x0e92('0x34')][_0x0e92('0x36')][_0x0e92('0x38')]});})['then'](extractReport)['catch'](function(_0x1b1643){logger[_0x0e92('0x46')](util[_0x0e92('0x20')](_0x0e92('0x4e'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x1b1643,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0e92('0x4f'));})[_0x0e92('0x50')](function(){process[_0x0e92('0x51')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x300763=new PdfPrinter({'Arial':{'normal':__dirname+_0x0e92('0x52'),'bold':__dirname+_0x0e92('0x53'),'italics':__dirname+_0x0e92('0x54'),'bolditalics':__dirname+_0x0e92('0x55')}});return _0x300763;}function getPDFDocDefinitionFromHTML(_0x8e3aad,_0x1f7518){var _0x458089=util['format'](_0x0e92('0x56'),_0x1f7518[_0x0e92('0x57')],_0x1f7518[_0x0e92('0x58')]);var _0x5c92ed=moment()[_0x0e92('0x20')](_0x0e92('0x59'))[_0x0e92('0x15')]();var _0x5c7820=htmlToPdfmake(_0x8e3aad,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5c7820],'defaultStyle':{'font':_0x0e92('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x0e92('0x5a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x0e92('0x5a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0e92('0x5a')}},'header':function(){return[{'text':_0x0e92('0x5b'),'style':_0x0e92('0x22')}];},'footer':function(_0x9218ce,_0x2ad8cd){return[{'text':util[_0x0e92('0x20')](_0x0e92('0x5c'),_0x458089,_0x9218ce,_0x2ad8cd,_0x5c92ed),'style':_0x0e92('0x27')}];}};}function writePDFDocument(_0xa721bc,_0x274d99){return new Promise(function(_0x182aee,_0x10def3){var _0x34cb64=_0xa721bc[_0x0e92('0x5d')](fs['createWriteStream'](_0x274d99));_0x34cb64['on'](_0x0e92('0x5e'),function(){_0x182aee(_0x0e92('0x5e'));});_0x34cb64['on'](_0x0e92('0x5f'),function(_0x285653){_0x10def3(_0x285653);});_0xa721bc['end']();});}exports[_0x0e92('0x60')]=function(_0x12a8ba,_0x39457d){var _0x3e0ce8=getPDFPrinter();var _0x2ae46c=getPDFDocDefinitionFromHTML(_0x12a8ba,_0x39457d);var _0x1d455c=_0x3e0ce8[_0x0e92('0x40')](_0x2ae46c);return writePDFDocument(_0x1d455c,_0x39457d['path'])[_0x0e92('0x61')](function(_0x1a6c9a){throw _0x1a6c9a;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f7d38db..2129418 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 _0x29ce=['Empty','range','num','forEach','push','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','each','xlsx','join','%s.%s','writeFileSync','binary','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','XLSX','Setting','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT'];(function(_0x59e3eb,_0x113485){var _0x3ce496=function(_0x30a4fc){while(--_0x30a4fc){_0x59e3eb['push'](_0x59e3eb['shift']());}};_0x3ce496(++_0x113485);}(_0x29ce,0x1e7));var _0xe29c=function(_0x516f60,_0x2dc44d){_0x516f60=_0x516f60-0x0;var _0x583288=_0x29ce[_0x516f60];return _0x583288;};'use strict';var util=require(_0xe29c('0x0'));var path=require(_0xe29c('0x1'));var _=require(_0xe29c('0x2'));var fs=require('fs');var json2xls=require(_0xe29c('0x3'));var BPromise=require(_0xe29c('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xe29c('0x5'));var db=require(_0xe29c('0x6'))['db'];var dbH=require(_0xe29c('0x6'))[_0xe29c('0x7')];var logger=require(_0xe29c('0x8'))(_0xe29c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe29c('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe29c('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1534f6,_0x253159){var _0x53b4f4={'status':_0x1534f6};var _0x3d4ae1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x253159){_0x53b4f4['savename']=_0x253159;}return db[_0xe29c('0xb')][_0xe29c('0xc')](_0x53b4f4,_0x3d4ae1);}function main(){var _0xa4a1df=0x1388;var _0x40fdec;logger['info'](util[_0xe29c('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe29c('0xe')));return db[_0xe29c('0xf')][_0xe29c('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe29c('0x11'),_0xe29c('0x12')]})[_0xe29c('0x13')](function(_0x2f90df){if(_0x2f90df){_0x40fdec=_0x2f90df;_0xa4a1df=_0x40fdec['splitSizeXlsx']||0x1388;}})[_0xe29c('0x13')](function(){return dbH['sequelize']['query'](util[_0xe29c('0xd')](_0xe29c('0x14'),QUERY),{'type':dbH[_0xe29c('0x15')]['QueryTypes'][_0xe29c('0x16')]});})[_0xe29c('0x13')](function(_0x267a6e){if(!_0x267a6e[0x0]['num']){return analyticExtractedReport(_0xe29c('0x17'));}var _0x3654fb=[];var _0x3b7a12=0x0;if(_0x40fdec['split']){if(_0x267a6e&&_0x267a6e['length']){var _0x40362d=_[_0xe29c('0x18')](_0x267a6e[0x0][_0xe29c('0x19')]/_0xa4a1df);var _0x57f95a=Number['isInteger'](_0x267a6e[0x0][_0xe29c('0x19')]/_0xa4a1df)?_0x267a6e[0x0]['num']%_0xa4a1df:0x0;_0x40362d[_0xe29c('0x1a')](function(_0x16862c){if(_0x16862c>0x0){_0x3b7a12+=_0xa4a1df;}_0x3654fb[_0xe29c('0x1b')](dbH['sequelize'][_0xe29c('0x1c')](util[_0xe29c('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa4a1df,_0x3b7a12),{'type':dbH[_0xe29c('0x15')][_0xe29c('0x1d')][_0xe29c('0x16')]}));});if(_0x57f95a>0x0){_0x3b7a12+=_0xa4a1df;_0x3654fb[_0xe29c('0x1b')](dbH[_0xe29c('0x15')][_0xe29c('0x1c')](util['format'](_0xe29c('0x1e'),QUERY,_0x57f95a,_0x3b7a12),{'type':dbH[_0xe29c('0x15')][_0xe29c('0x1d')][_0xe29c('0x16')]}));}}}else{_0x3654fb[_0xe29c('0x1b')](dbH[_0xe29c('0x15')][_0xe29c('0x1c')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xe29c('0x16')]}));}var _0x4b8411=path[_0xe29c('0x1f')](PATH);var _0x46c6fd=path[_0xe29c('0x20')](PATH,'.xlsx');var _0x3419c1=_0x40fdec[_0xe29c('0x11')]&&_0x3654fb[_0xe29c('0x21')]>0x1;var _0x178716=[];if(!fs[_0xe29c('0x22')](path['join'](_0x4b8411,_0x46c6fd))&&_0x3419c1){fs['mkdirSync'](path['join'](_0x4b8411,_0x46c6fd));}return BPromise[_0xe29c('0x23')](_0x3654fb,function(_0x3a94e1){_0x178716[_0xe29c('0x1b')](_0x3a94e1);})['then'](function(){for(var _0x4b419d=0x0;_0x4b419d<_0x178716[_0xe29c('0x21')];_0x4b419d+=0x1){var _0x17abf0;var _0x582536=_0x178716[_0x4b419d];if(_0x3419c1){_0x17abf0=path['join'](_0x4b8411,_0x46c6fd,util[_0xe29c('0xd')]('%s%d.%s',_0x46c6fd,_0x4b419d,_0xe29c('0x24')));}else{_0x17abf0=path[_0xe29c('0x25')](_0x4b8411,util[_0xe29c('0xd')](_0xe29c('0x26'),_0x46c6fd,'xlsx'));}fs[_0xe29c('0x27')](_0x17abf0,json2xls(_0x582536),_0xe29c('0x28'));}})[_0xe29c('0x13')](function(){if(_0x3419c1){return new Promise(function(_0x528643){zipdir(path[_0xe29c('0x25')](_0x4b8411,_0x46c6fd),{'saveTo':path[_0xe29c('0x25')](_0x4b8411,util[_0xe29c('0xd')](_0xe29c('0x26'),_0x46c6fd,'zip'))},function(_0x2d06b7,_0x4089f9){rimraf(path['join'](_0x4b8411,_0x46c6fd),function(){});_0x528643(_0xe29c('0x29'));});});}})[_0xe29c('0x13')](function(){logger[_0xe29c('0x2a')](util['format'](_0xe29c('0x2b'),EXTRACTED_REPORT_ID,_0xe29c('0xe')));return analyticExtractedReport(_0xe29c('0x2c'),_0x3419c1?util[_0xe29c('0xd')](_0xe29c('0x26'),_0x46c6fd,_0x3419c1?_0xe29c('0x2d'):'xlsx'):null);});})[_0xe29c('0x2e')](function(_0x452b66){logger[_0xe29c('0x2a')](util[_0xe29c('0xd')](_0xe29c('0x2f'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xe29c('0x30')](_0x452b66,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe29c('0x31'));})['finally'](function(){process[_0xe29c('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2f2d=['savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT','num','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','writeFileSync','zip\x20finished','XLSX','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f2d,0x17f));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require(_0xd2f2('0x0'));var _=require(_0xd2f2('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xd2f2('0x2'));var zipdir=require(_0xd2f2('0x3'));var rimraf=require(_0xd2f2('0x4'));var db=require(_0xd2f2('0x5'))['db'];var dbH=require('../../mysqldb')[_0xd2f2('0x6')];var logger=require('../../config/logger')(_0xd2f2('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xd2f2('0x8')][0x2]);var QUERY=process[_0xd2f2('0x8')][0x3];var PATH=process[_0xd2f2('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x31141d,_0x54b4a6){var _0x5acd70={'status':_0x31141d};var _0x31ddb3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54b4a6){_0x5acd70[_0xd2f2('0x9')]=_0x54b4a6;}return db[_0xd2f2('0xa')][_0xd2f2('0xb')](_0x5acd70,_0x31ddb3);}function main(){var _0x5997bb=0x1388;var _0x363886;logger[_0xd2f2('0xc')](util[_0xd2f2('0xd')](_0xd2f2('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xd2f2('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd2f2('0x10'),_0xd2f2('0x11')]})[_0xd2f2('0x12')](function(_0x3a7bd4){if(_0x3a7bd4){_0x363886=_0x3a7bd4;_0x5997bb=_0x363886['splitSizeXlsx']||0x1388;}})[_0xd2f2('0x12')](function(){return dbH['sequelize'][_0xd2f2('0x13')](util[_0xd2f2('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd2f2('0x14')][_0xd2f2('0x15')][_0xd2f2('0x16')]});})[_0xd2f2('0x12')](function(_0x8c478c){if(!_0x8c478c[0x0][_0xd2f2('0x17')]){return analyticExtractedReport('Empty');}var _0x5b91eb=[];var _0x180c3a=0x0;if(_0x363886[_0xd2f2('0x10')]){if(_0x8c478c&&_0x8c478c['length']){var _0x1ccbe6=_[_0xd2f2('0x18')](_0x8c478c[0x0][_0xd2f2('0x17')]/_0x5997bb);var _0x3ce71e=Number['isInteger'](_0x8c478c[0x0][_0xd2f2('0x17')]/_0x5997bb)?_0x8c478c[0x0][_0xd2f2('0x17')]%_0x5997bb:0x0;_0x1ccbe6[_0xd2f2('0x19')](function(_0x122434){if(_0x122434>0x0){_0x180c3a+=_0x5997bb;}_0x5b91eb[_0xd2f2('0x1a')](dbH[_0xd2f2('0x14')][_0xd2f2('0x13')](util[_0xd2f2('0xd')](_0xd2f2('0x1b'),QUERY,_0x5997bb,_0x180c3a),{'type':dbH[_0xd2f2('0x14')]['QueryTypes']['SELECT']}));});if(_0x3ce71e>0x0){_0x180c3a+=_0x5997bb;_0x5b91eb[_0xd2f2('0x1a')](dbH['sequelize'][_0xd2f2('0x13')](util[_0xd2f2('0xd')](_0xd2f2('0x1b'),QUERY,_0x3ce71e,_0x180c3a),{'type':dbH[_0xd2f2('0x14')][_0xd2f2('0x15')][_0xd2f2('0x16')]}));}}}else{_0x5b91eb['push'](dbH[_0xd2f2('0x14')][_0xd2f2('0x13')](QUERY,{'type':dbH[_0xd2f2('0x14')][_0xd2f2('0x15')][_0xd2f2('0x16')]}));}var _0x1f4f7f=path[_0xd2f2('0x1c')](PATH);var _0x589696=path[_0xd2f2('0x1d')](PATH,_0xd2f2('0x1e'));var _0x8c1625=_0x363886[_0xd2f2('0x10')]&&_0x5b91eb['length']>0x1;var _0x47b9d4=[];if(!fs[_0xd2f2('0x1f')](path[_0xd2f2('0x20')](_0x1f4f7f,_0x589696))&&_0x8c1625){fs[_0xd2f2('0x21')](path[_0xd2f2('0x20')](_0x1f4f7f,_0x589696));}return BPromise[_0xd2f2('0x22')](_0x5b91eb,function(_0x4bf115){_0x47b9d4[_0xd2f2('0x1a')](_0x4bf115);})[_0xd2f2('0x12')](function(){for(var _0x594223=0x0;_0x594223<_0x47b9d4[_0xd2f2('0x23')];_0x594223+=0x1){var _0x26fbb9;var _0xf99f92=_0x47b9d4[_0x594223];if(_0x8c1625){_0x26fbb9=path[_0xd2f2('0x20')](_0x1f4f7f,_0x589696,util['format'](_0xd2f2('0x24'),_0x589696,_0x594223,_0xd2f2('0x25')));}else{_0x26fbb9=path[_0xd2f2('0x20')](_0x1f4f7f,util[_0xd2f2('0xd')](_0xd2f2('0x26'),_0x589696,'xlsx'));}fs[_0xd2f2('0x27')](_0x26fbb9,json2xls(_0xf99f92),'binary');}})[_0xd2f2('0x12')](function(){if(_0x8c1625){return new Promise(function(_0x334433){zipdir(path['join'](_0x1f4f7f,_0x589696),{'saveTo':path['join'](_0x1f4f7f,util['format'](_0xd2f2('0x26'),_0x589696,'zip'))},function(_0x85a479,_0x118318){rimraf(path['join'](_0x1f4f7f,_0x589696),function(){});_0x334433(_0xd2f2('0x28'));});});}})['then'](function(){logger['info'](util[_0xd2f2('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd2f2('0x29')));return analyticExtractedReport('Completed',_0x8c1625?util['format'](_0xd2f2('0x26'),_0x589696,_0x8c1625?_0xd2f2('0x2a'):_0xd2f2('0x25')):null);});})[_0xd2f2('0x2b')](function(_0x1a6f96){logger[_0xd2f2('0xc')](util[_0xd2f2('0xd')](_0xd2f2('0x2c'),EXTRACTED_REPORT_ID,_0xd2f2('0x29')),util[_0xd2f2('0x2d')](_0x1a6f96,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd2f2('0x2e'));})[_0xd2f2('0x2f')](function(){process[_0xd2f2('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 91106b7..3289f54 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 _0x315f=['context','VoiceExtensionId','CDR(routeid)=','outbound','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x315f,0x6c));var _0xf315=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0x315f[_0x1fcf1b];return _0x5d2952;};'use strict';var _=require(_0xf315('0x0'));var util=require('util');function rewrite(_0x349a1f,_0x38f65c){var _0x3c42c4=this;return _0x349a1f[_0xf315('0x1')][_0xf315('0x2')][_0xf315('0x3')]({'raw':!![]})[_0xf315('0x4')](function(_0x5d6648){_0x3c42c4['intervals']=_0x5d6648;return _0x349a1f['models'][_0xf315('0x5')][_0xf315('0x3')]({'where':{'IntervalId':_0x38f65c[_0xf315('0x6')]},'raw':!![]});})['then'](function(_0x5dac5e){return _0x349a1f[_0xf315('0x1')]['VoiceExtension'][_0xf315('0x3')]({'where':{'exten':{'$in':_[_0xf315('0x7')](_['map'](_0x5dac5e,_0xf315('0x8')))}},'order':[{'raw':_0xf315('0x9')}],'raw':!![]});})[_0xf315('0x4')](function(_0x4ed055){var _0x4a087b=_[_0xf315('0xa')](_0x4ed055,{'priority':'1'});var _0xde15c7=_['filter'](_0x4ed055,{'isApp':0x1});var _0x35500b=_['groupBy'](_0xde15c7,_0xf315('0x8'));var _0x404e0d=[_0xf315('0xb'),'playback'];var _0x311263=[];var _0x20ff2a=[];for(var _0x383feb in _0x35500b){if(_0x35500b[_0xf315('0xc')](_0x383feb)){_0x3c42c4[_0xf315('0xd')]=0x2;_0x3c42c4[_0xf315('0xe')]=[];_0x3c42c4[_0xf315('0xf')]=_[_0xf315('0x10')](_0x4a087b,{'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')]});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':util[_0xf315('0x14')](_0xf315('0x15'),_0x35500b[_0x383feb][0x0][_0xf315('0x12')]),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});if(_0x35500b[_0x383feb][0x0]['type']==='inbound'){_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x18')+_0x35500b[_0x383feb][0x0][_0xf315('0x17')],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});}else if(_0x35500b[_0x383feb][0x0][_0xf315('0x12')]===_0xf315('0x19')){if(_0x3c42c4[_0xf315('0xf')]){_0x3c42c4['extensions'][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':'CDR(destination)='+(_0x3c42c4['extension'][_0xf315('0x1a')]?'${EXTEN:'+_0x3c42c4[_0xf315('0xf')][_0xf315('0x1a')]+'}':'${EXTEN}'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0]['exten'],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});}_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0]['type'],'app':'Set','appdata':_0xf315('0x18')+_0x35500b[_0x383feb][0x0]['VoiceExtensionId'],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0]['exten'],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});var _0x5d2f17=_0x3c42c4['priority']++;_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5d2f17+0x2)+_0xf315('0x1c')+(_0x5d2f17+0x1)+')','context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x5d2f17,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});if(_0x3c42c4[_0xf315('0xf')]){_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0x3c42c4['extension'][_0xf315('0x1a')]?_0xf315('0x1d')+_0x3c42c4['extension'][_0xf315('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});}_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':'Set','appdata':_0xf315('0x1e')+_0x35500b[_0x383feb][0x0]['VoiceExtensionId'],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});if(_0x3c42c4[_0xf315('0xf')]&&_0x3c42c4[_0xf315('0xf')][_0xf315('0xc')](_0xf315('0x1f'))&&_0x3c42c4[_0xf315('0xf')][_0xf315('0x1f')]!==_0xf315('0x20')){_0x3c42c4[_0xf315('0xe')]['push']({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x21'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':'Set','appdata':_0xf315('0x22')+_0x3c42c4[_0xf315('0xf')][_0xf315('0x1f')]||_0xf315('0x23'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0]['exten'],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});}}_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0]['type'],'app':_0xf315('0x13'),'appdata':_0xf315('0x24'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x25'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x26'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});for(var _0x224af0=0x0,_0x1d3614=0x0;_0x224af0<_0x35500b[_0x383feb][_0xf315('0x27')];_0x224af0+=0x1,_0x1d3614=0x0){var _0x31c5e6=_0x35500b[_0x383feb][_0x224af0];if(_0x31c5e6[_0xf315('0x12')]){_0x31c5e6[_0xf315('0x12')]=_0x31c5e6[_0xf315('0x12')][_0xf315('0x28')]();}var _0x12c81f=[];var _0x16726b=[];delete _0x31c5e6['id'];delete _0x31c5e6['createdAt'];delete _0x31c5e6[_0xf315('0x29')];var _0x38d395=_0x31c5e6['interval']!=='*,*,*,*'?[_0x31c5e6[_0xf315('0x2a')]]:_0x31c5e6['IntervalId']?_[_0xf315('0x2b')](_[_0xf315('0xa')](_0x3c42c4['intervals'],{'IntervalId':_0x31c5e6[_0xf315('0x6')]}),_0xf315('0x2a')):[];if(_0x31c5e6[_0xf315('0xc')](_0xf315('0x2c'))){if(_0x31c5e6['tag']&&_0x31c5e6['tag']!=='--'){_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':'CDR(tag)='+_0x31c5e6[_0xf315('0x2c')],'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}}if(_0x31c5e6[_0xf315('0x12')]===_0xf315('0x19')&&_0x31c5e6[_0xf315('0xc')](_0xf315('0x2d'))){if(_0x31c5e6[_0xf315('0x2d')]){_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':_0xf315('0x2e')+_0x31c5e6[_0xf315('0x2d')]+')','context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6['exten'],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4['priority']+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}else{_0x12c81f['push']({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':_0xf315('0x2f'),'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}}if(_0x31c5e6[_0xf315('0xc')](_0xf315('0x30'))){if(_0x404e0d[_0xf315('0x31')](_0x31c5e6[_0xf315('0x32')][_0xf315('0x28')]())>=0x0&&_0x31c5e6[_0xf315('0x33')]!=='custom'){if(_0x31c5e6[_0xf315('0x30')]){_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4['priority']+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6['type'],'app':_0xf315('0x13'),'appdata':_0xf315('0x34'),'context':_0x31c5e6['context'],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}else{_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':_0xf315('0x35'),'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6['exten'],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4['priority']+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x36'),'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6['VoiceExtensionId']});}}}for(var _0x427776=0x0;_0x427776<_0x38d395[_0xf315('0x27')];_0x427776+=0x1){var _0x4ee2f5=_0x3c42c4[_0xf315('0xd')]+_0x38d395[_0xf315('0x27')];var _0x4a2db5=_0x427776===_0x38d395[_0xf315('0x27')]-0x1?_0x3c42c4[_0xf315('0xd')]+_0x12c81f['length']+_0x16726b[_0xf315('0x27')]+0x2:_0x3c42c4[_0xf315('0xd')]+_0x427776+0x1;_0x12c81f[_0xf315('0x37')](_0x427776,0x0,{'type':_0x31c5e6[_0xf315('0x12')],'app':'GotoIfTime','appdata':_0x38d395[_0x427776]+'?'+_0x31c5e6['context']+_0xf315('0x38')+_0x4ee2f5+':'+_0x31c5e6[_0xf315('0x16')]+_0xf315('0x38')+_0x4a2db5,'exten':_0x31c5e6[_0xf315('0x8')],'context':_0x31c5e6['context'],'priority':_0x3c42c4[_0xf315('0xd')]+_0x427776,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});}_0x31c5e6[_0xf315('0xd')]=_0x12c81f['length']?_[_0xf315('0x39')](_0x12c81f)['priority']+0x1:_0x3c42c4[_0xf315('0xd')];_0x3c42c4[_0xf315('0xd')]=(_0x16726b[_0xf315('0x27')]?_[_0xf315('0x39')](_0x16726b)['priority']:_0x31c5e6[_0xf315('0xd')])+0x1;_0x3c42c4[_0xf315('0xe')]=_[_0xf315('0x3a')](_0x3c42c4[_0xf315('0xe')],_0x12c81f,[_0x31c5e6],_0x16726b);}_0x3c42c4[_0xf315('0xe')]['push']({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x3b'),'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'priority':_0x3c42c4[_0xf315('0xd')],'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});_0x311263[_0xf315('0x11')](_0x35500b[_0x383feb][0x0][_0xf315('0x17')]);_0x20ff2a=_[_0xf315('0x3a')](_0x20ff2a,_0x3c42c4[_0xf315('0xe')]);}}return _0x349a1f[_0xf315('0x3c')](function(_0x23d021){return _0x349a1f[_0xf315('0x1')][_0xf315('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x311263}},'transaction':_0x23d021})[_0xf315('0x4')](function(_0x391766){return _0x349a1f[_0xf315('0x1')][_0xf315('0x5')][_0xf315('0x3d')](_[_0xf315('0x3e')](_0x20ff2a,'priority'),{'transaction':_0x23d021});});});})['catch'](function(_0x4b8290){console[_0xf315('0x3f')](_0x4b8290);});}exports[_0xf315('0x40')]=rewrite; \ No newline at end of file +var _0x3e3e=['answer','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','catch','error','lodash','util','Interval','findAll','then','intervals','VoiceExtension','IntervalId','models','uniq','filter','groupBy','exten','playback','hasOwnProperty','priority','find','extensions','push','format','CDR(type)=%s','type','VoiceExtensionId','inbound','Set','CDR(routeid)=','context','CDR(destination)=','extension','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','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','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x5c3c90,_0x5ba31e){var _0x1dff8b=function(_0x591fd1){while(--_0x591fd1){_0x5c3c90['push'](_0x5c3c90['shift']());}};_0x1dff8b(++_0x5ba31e);}(_0x3e3e,0x1c1));var _0xe3e3=function(_0x55c370,_0x589b90){_0x55c370=_0x55c370-0x0;var _0x4e59e8=_0x3e3e[_0x55c370];return _0x4e59e8;};'use strict';var _=require(_0xe3e3('0x0'));var util=require(_0xe3e3('0x1'));function rewrite(_0x3a2a93,_0x4d564c){var _0x30e788=this;return _0x3a2a93['models'][_0xe3e3('0x2')][_0xe3e3('0x3')]({'raw':!![]})[_0xe3e3('0x4')](function(_0x1f1896){_0x30e788[_0xe3e3('0x5')]=_0x1f1896;return _0x3a2a93['models'][_0xe3e3('0x6')][_0xe3e3('0x3')]({'where':{'IntervalId':_0x4d564c[_0xe3e3('0x7')]},'raw':!![]});})[_0xe3e3('0x4')](function(_0x2a6539){return _0x3a2a93[_0xe3e3('0x8')]['VoiceExtension'][_0xe3e3('0x3')]({'where':{'exten':{'$in':_[_0xe3e3('0x9')](_['map'](_0x2a6539,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xe3e3('0x4')](function(_0x422109){var _0x4d40d0=_[_0xe3e3('0xa')](_0x422109,{'priority':'1'});var _0x1b7f68=_[_0xe3e3('0xa')](_0x422109,{'isApp':0x1});var _0x3260b4=_[_0xe3e3('0xb')](_0x1b7f68,_0xe3e3('0xc'));var _0x47a6d8=['queue',_0xe3e3('0xd')];var _0x5eb8c4=[];var _0x570019=[];for(var _0x4a9be0 in _0x3260b4){if(_0x3260b4[_0xe3e3('0xe')](_0x4a9be0)){_0x30e788[_0xe3e3('0xf')]=0x2;_0x30e788['extensions']=[];_0x30e788['extension']=_[_0xe3e3('0x10')](_0x4d40d0,{'exten':_0x3260b4[_0x4a9be0][0x0]['exten']});_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0]['type'],'app':'Set','appdata':util[_0xe3e3('0x13')](_0xe3e3('0x14'),_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')]),'context':_0x3260b4[_0x4a9be0][0x0]['context'],'exten':_0x3260b4[_0x4a9be0][0x0]['exten'],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});if(_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')]===_0xe3e3('0x17')){_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':_0xe3e3('0x18'),'appdata':_0xe3e3('0x19')+_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')],'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0xc')],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});}else if(_0x3260b4[_0x4a9be0][0x0]['type']==='outbound'){if(_0x30e788['extension']){_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':_0xe3e3('0x18'),'appdata':_0xe3e3('0x1b')+(_0x30e788[_0xe3e3('0x1c')][_0xe3e3('0x1d')]?'${EXTEN:'+_0x30e788['extension'][_0xe3e3('0x1d')]+'}':'${EXTEN}'),'context':_0x3260b4[_0x4a9be0][0x0]['context'],'exten':_0x3260b4[_0x4a9be0][0x0]['exten'],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});}_0x30e788['extensions'][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0]['type'],'app':_0xe3e3('0x18'),'appdata':'CDR(routeid)='+_0x3260b4[_0x4a9be0][0x0]['VoiceExtensionId'],'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0]['exten'],'priority':_0x30e788['priority']++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0]['VoiceExtensionId']});var _0x39a56b=_0x30e788[_0xe3e3('0xf')]++;_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':'ExecIf','appdata':_0xe3e3('0x1e')+(_0x39a56b+0x2)+_0xe3e3('0x1f')+(_0x39a56b+0x1)+')','context':_0x3260b4[_0x4a9be0][0x0]['context'],'exten':_0x3260b4[_0x4a9be0][0x0]['exten'],'priority':_0x39a56b,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});if(_0x30e788[_0xe3e3('0x1c')]){_0x30e788[_0xe3e3('0x11')]['push']({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':'Set','appdata':_0x30e788['extension'][_0xe3e3('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x30e788[_0xe3e3('0x1c')][_0xe3e3('0x1d')]+'}':_0xe3e3('0x20'),'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0xc')],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0]['VoiceExtensionId']});}_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':_0xe3e3('0x18'),'appdata':_0xe3e3('0x21')+_0x3260b4[_0x4a9be0][0x0]['VoiceExtensionId'],'context':_0x3260b4[_0x4a9be0][0x0]['context'],'exten':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0xc')],'priority':_0x30e788['priority']++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});if(_0x30e788['extension']&&_0x30e788[_0xe3e3('0x1c')][_0xe3e3('0xe')](_0xe3e3('0x22'))&&_0x30e788[_0xe3e3('0x1c')]['recordingFormat']!==_0xe3e3('0x23')){_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':'Set','appdata':_0xe3e3('0x24'),'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0]['exten'],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});_0x30e788['extensions'][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0]['type'],'app':_0xe3e3('0x18'),'appdata':_0xe3e3('0x25')+_0x30e788[_0xe3e3('0x1c')]['recordingFormat']||_0xe3e3('0x26'),'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0xc')],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});}}_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0]['type'],'app':_0xe3e3('0x18'),'appdata':_0xe3e3('0x27'),'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0xc')],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0]['VoiceExtensionId']});_0x30e788['extensions'][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':'Set','appdata':_0xe3e3('0x28'),'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0xc')],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});_0x30e788['extensions'][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':'Set','appdata':_0xe3e3('0x29'),'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'exten':_0x3260b4[_0x4a9be0][0x0]['exten'],'priority':_0x30e788[_0xe3e3('0xf')]++,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0]['VoiceExtensionId']});for(var _0x134c44=0x0,_0x25c0a2=0x0;_0x134c44<_0x3260b4[_0x4a9be0][_0xe3e3('0x2a')];_0x134c44+=0x1,_0x25c0a2=0x0){var _0xdf2988=_0x3260b4[_0x4a9be0][_0x134c44];if(_0xdf2988[_0xe3e3('0x15')]){_0xdf2988[_0xe3e3('0x15')]=_0xdf2988['type'][_0xe3e3('0x2b')]();}var _0x5bfe81=[];var _0x3f47f7=[];delete _0xdf2988['id'];delete _0xdf2988[_0xe3e3('0x2c')];delete _0xdf2988[_0xe3e3('0x2d')];var _0x384560=_0xdf2988[_0xe3e3('0x2e')]!==_0xe3e3('0x2f')?[_0xdf2988[_0xe3e3('0x2e')]]:_0xdf2988['IntervalId']?_[_0xe3e3('0x30')](_[_0xe3e3('0xa')](_0x30e788[_0xe3e3('0x5')],{'IntervalId':_0xdf2988['IntervalId']}),_0xe3e3('0x2e')):[];if(_0xdf2988[_0xe3e3('0xe')](_0xe3e3('0x31'))){if(_0xdf2988[_0xe3e3('0x31')]&&_0xdf2988[_0xe3e3('0x31')]!=='--'){_0x5bfe81['push']({'type':_0xdf2988[_0xe3e3('0x15')],'app':_0xe3e3('0x18'),'appdata':_0xe3e3('0x32')+_0xdf2988[_0xe3e3('0x31')],'context':_0xdf2988[_0xe3e3('0x1a')],'exten':_0xdf2988[_0xe3e3('0xc')],'priority':_0x384560['length']+_0x30e788[_0xe3e3('0xf')]+_0x25c0a2++,'VoiceExtensionId':_0xdf2988[_0xe3e3('0x16')]});}}if(_0xdf2988[_0xe3e3('0x15')]===_0xe3e3('0x33')&&_0xdf2988[_0xe3e3('0xe')](_0xe3e3('0x34'))){if(_0xdf2988[_0xe3e3('0x34')]){_0x5bfe81[_0xe3e3('0x12')]({'type':_0xdf2988[_0xe3e3('0x15')],'app':_0xe3e3('0x35'),'appdata':_0xe3e3('0x36')+_0xdf2988['callerID']+')','context':_0xdf2988[_0xe3e3('0x1a')],'exten':_0xdf2988[_0xe3e3('0xc')],'priority':_0x384560[_0xe3e3('0x2a')]+_0x30e788[_0xe3e3('0xf')]+_0x25c0a2++,'VoiceExtensionId':_0xdf2988['VoiceExtensionId']});}else{_0x5bfe81[_0xe3e3('0x12')]({'type':_0xdf2988[_0xe3e3('0x15')],'app':_0xe3e3('0x35'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xdf2988[_0xe3e3('0x1a')],'exten':_0xdf2988[_0xe3e3('0xc')],'priority':_0x384560[_0xe3e3('0x2a')]+_0x30e788[_0xe3e3('0xf')]+_0x25c0a2++,'VoiceExtensionId':_0xdf2988[_0xe3e3('0x16')]});}}if(_0xdf2988['hasOwnProperty'](_0xe3e3('0x37'))){if(_0x47a6d8['indexOf'](_0xdf2988[_0xe3e3('0x38')]['toLowerCase']())>=0x0&&_0xdf2988['appType']!==_0xe3e3('0x39')){if(_0xdf2988['answer']){_0x5bfe81[_0xe3e3('0x12')]({'type':_0xdf2988['type'],'app':_0xe3e3('0x35'),'appdata':_0xe3e3('0x3a'),'context':_0xdf2988[_0xe3e3('0x1a')],'exten':_0xdf2988['exten'],'priority':_0x384560[_0xe3e3('0x2a')]+_0x30e788['priority']+_0x25c0a2++,'VoiceExtensionId':_0xdf2988['VoiceExtensionId']});_0x5bfe81[_0xe3e3('0x12')]({'type':_0xdf2988['type'],'app':_0xe3e3('0x18'),'appdata':_0xe3e3('0x3b'),'context':_0xdf2988[_0xe3e3('0x1a')],'exten':_0xdf2988['exten'],'priority':_0x384560['length']+_0x30e788['priority']+_0x25c0a2++,'VoiceExtensionId':_0xdf2988[_0xe3e3('0x16')]});}else{_0x5bfe81[_0xe3e3('0x12')]({'type':_0xdf2988[_0xe3e3('0x15')],'app':_0xe3e3('0x35'),'appdata':_0xe3e3('0x3c'),'context':_0xdf2988[_0xe3e3('0x1a')],'exten':_0xdf2988[_0xe3e3('0xc')],'priority':_0x384560['length']+_0x30e788['priority']+_0x25c0a2++,'VoiceExtensionId':_0xdf2988[_0xe3e3('0x16')]});_0x5bfe81['push']({'type':_0xdf2988[_0xe3e3('0x15')],'app':'Set','appdata':_0xe3e3('0x3d'),'context':_0xdf2988[_0xe3e3('0x1a')],'exten':_0xdf2988['exten'],'priority':_0x384560['length']+_0x30e788[_0xe3e3('0xf')]+_0x25c0a2++,'VoiceExtensionId':_0xdf2988[_0xe3e3('0x16')]});}}}for(var _0x2d578a=0x0;_0x2d578a<_0x384560[_0xe3e3('0x2a')];_0x2d578a+=0x1){var _0x331454=_0x30e788[_0xe3e3('0xf')]+_0x384560[_0xe3e3('0x2a')];var _0x5272ce=_0x2d578a===_0x384560[_0xe3e3('0x2a')]-0x1?_0x30e788[_0xe3e3('0xf')]+_0x5bfe81[_0xe3e3('0x2a')]+_0x3f47f7[_0xe3e3('0x2a')]+0x2:_0x30e788[_0xe3e3('0xf')]+_0x2d578a+0x1;_0x5bfe81[_0xe3e3('0x3e')](_0x2d578a,0x0,{'type':_0xdf2988[_0xe3e3('0x15')],'app':_0xe3e3('0x3f'),'appdata':_0x384560[_0x2d578a]+'?'+_0xdf2988['context']+_0xe3e3('0x40')+_0x331454+':'+_0xdf2988['context']+_0xe3e3('0x40')+_0x5272ce,'exten':_0xdf2988[_0xe3e3('0xc')],'context':_0xdf2988[_0xe3e3('0x1a')],'priority':_0x30e788[_0xe3e3('0xf')]+_0x2d578a,'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});}_0xdf2988[_0xe3e3('0xf')]=_0x5bfe81[_0xe3e3('0x2a')]?_['last'](_0x5bfe81)[_0xe3e3('0xf')]+0x1:_0x30e788[_0xe3e3('0xf')];_0x30e788[_0xe3e3('0xf')]=(_0x3f47f7['length']?_[_0xe3e3('0x41')](_0x3f47f7)[_0xe3e3('0xf')]:_0xdf2988[_0xe3e3('0xf')])+0x1;_0x30e788[_0xe3e3('0x11')]=_[_0xe3e3('0x42')](_0x30e788[_0xe3e3('0x11')],_0x5bfe81,[_0xdf2988],_0x3f47f7);}_0x30e788[_0xe3e3('0x11')][_0xe3e3('0x12')]({'type':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x15')],'app':_0xe3e3('0x43'),'exten':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0xc')],'context':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x1a')],'priority':_0x30e788[_0xe3e3('0xf')],'VoiceExtensionId':_0x3260b4[_0x4a9be0][0x0][_0xe3e3('0x16')]});_0x5eb8c4[_0xe3e3('0x12')](_0x3260b4[_0x4a9be0][0x0]['VoiceExtensionId']);_0x570019=_['concat'](_0x570019,_0x30e788[_0xe3e3('0x11')]);}}return _0x3a2a93[_0xe3e3('0x44')](function(_0x43902c){return _0x3a2a93[_0xe3e3('0x8')][_0xe3e3('0x6')][_0xe3e3('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x5eb8c4}},'transaction':_0x43902c})[_0xe3e3('0x4')](function(_0x4a2845){return _0x3a2a93['models'][_0xe3e3('0x6')]['bulkCreate'](_['sortBy'](_0x570019,_0xe3e3('0xf')),{'transaction':_0x43902c});});});})[_0xe3e3('0x46')](function(_0x2daf5a){console[_0xe3e3('0x47')](_0x2daf5a);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d4e5a71..9f0b2c9 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 _0x3ede=['resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','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','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','scheduledAt','cm_contacts','str','phone\x20IS\x20NOT\x20NULL','calleridnum','id\x20IN\x20?','VoiceQueue','findAll','outbound','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','BlackLists','dialCheckDuplicateType','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume'];(function(_0x3fed34,_0x3809be){var _0x49e89e=function(_0x334c5e){while(--_0x334c5e){_0x3fed34['push'](_0x3fed34['shift']());}};_0x49e89e(++_0x3809be);}(_0x3ede,0x1c3));var _0xe3ed=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x3ede[_0x2eea9a];return _0x1ec61e;};'use strict';var BPromise=require('bluebird');var util=require(_0xe3ed('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0xe3ed('0x1'));var Papa=require(_0xe3ed('0x2'));var Redis=require(_0xe3ed('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xe3ed('0x4'));var logger=require('../../../config/logger')('api');config['redis']=_[_0xe3ed('0x5')](config['redis'],{'host':_0xe3ed('0x6'),'port':0x18eb});var socket=require(_0xe3ed('0x7'))(new Redis(config[_0xe3ed('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xe3ed('0x9')](socket);try{if(!process[_0xe3ed('0xa')][0x2]||process[_0xe3ed('0xa')][0x2]===_0xe3ed('0xb')||process[_0xe3ed('0xa')][0x2]===_0xe3ed('0xc')){throw new Error(_0xe3ed('0xd'));}var FILEPATH=process[_0xe3ed('0xa')][0x2];if(!process[_0xe3ed('0xa')][0x3]||process[_0xe3ed('0xa')][0x3]===_0xe3ed('0xb')||process[_0xe3ed('0xa')][0x3]===_0xe3ed('0xc')||!process[_0xe3ed('0xa')][0x4]||process[_0xe3ed('0xa')][0x4]===_0xe3ed('0xb')||process['argv'][0x4]==='null'){throw new Error(_0xe3ed('0xe'));}var FIELDS=_['zipObject'](process[_0xe3ed('0xa')][0x3][_0xe3ed('0xf')](','),process[_0xe3ed('0xa')][0x4]['split'](','));if(!process[_0xe3ed('0xa')][0x5]||process['argv'][0x5]==='undefined'||process[_0xe3ed('0xa')][0x5]===_0xe3ed('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xe3ed('0xa')][0x6]!==_0xe3ed('0xc')?process[_0xe3ed('0xa')][0x6]:null;var DUPLICATES=process[_0xe3ed('0xa')][0x7]&&process[_0xe3ed('0xa')][0x7]!==_0xe3ed('0xb')&&process['argv'][0x7]!==_0xe3ed('0xc')?process[_0xe3ed('0xa')][0x7]:null;if(!process[_0xe3ed('0xa')][0x8]||process[_0xe3ed('0xa')][0x8]==='undefined'||process[_0xe3ed('0xa')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xe3ed('0xa')][0x8];}catch(_0x58561d){logger['error'](_0x58561d);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(_0x3d2f41,_0x2660f2,_0x443365,_0x3abb6a){var _0x2230b7={'message':_0x2660f2};_0x2230b7[_0x3d2f41]=!![];if(_0x443365){_0x2230b7[_0xe3ed('0x10')]=_0x443365;}if(_0x3abb6a){_0x2230b7[_0xe3ed('0x11')]=_0x3abb6a;}return _0x2230b7;}function isEmail(_0x3ab850){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))*$/[_0xe3ed('0x12')](_0x3ab850);}function checkRow(_0x576b3a,_0x4a949d,_0x4b17a3){return new BPromise(function(_0x30eec4,_0x3c48d7){if(_[_0xe3ed('0x13')](_0x576b3a)){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x15'),null,_0x4b17a3));}if(_0x576b3a[_0xe3ed('0x16')]&&_0x576b3a[_0xe3ed('0x16')]['length']){var _0x37f733=_[_0xe3ed('0x17')](_0x576b3a[_0xe3ed('0x16')],_0xe3ed('0x18'))[_0xe3ed('0x19')](';');return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0x37f733,null,_0x4b17a3));}var _0x16fa53={};for(var _0x4ef82d in FIELDS){if(FIELDS[_0xe3ed('0x1a')](_0x4ef82d)&&FIELDS[_0x4ef82d]){_0x16fa53[_0x4ef82d]=_0x576b3a[_0xe3ed('0x1b')][0x0][FIELDS[_0x4ef82d]]||_0x576b3a[_0xe3ed('0x1b')][0x0]['\ufeff'+FIELDS[_0x4ef82d]];}}if(!_0x16fa53[_0xe3ed('0x1c')]){return _0x3c48d7(handleCheckRowError('error',_0xe3ed('0x1d'),null,_0x4b17a3));}if(!_0x16fa53[_0xe3ed('0x1e')]){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x1f'),null,_0x4b17a3));}if(_0x16fa53['birthDate']){var _0x3c6f07=moment(_0x16fa53[_0xe3ed('0x20')],_0xe3ed('0x21'));if(!_0x3c6f07[_0xe3ed('0x22')]()){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x23'),null,_0x4b17a3));}}if(_0x16fa53[_0xe3ed('0x24')]){if(!isEmail(_0x16fa53[_0xe3ed('0x24')])){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x25'),null,_0x4b17a3));}}_0x16fa53[_0xe3ed('0x26')]=LISTID;_0x16fa53[_0xe3ed('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe3ed('0x28')]&&_0x4a949d){var _0xf99c18={};for(var _0xb45690=0x0,_0x246933=DUPLICATES[_0xe3ed('0x28')];_0xb45690<_0x246933;_0xb45690+=0x1){_0xf99c18[DUPLICATES[_0xb45690]]=_0x16fa53[DUPLICATES[_0xb45690]];}var _0x4870fa=_[_0xe3ed('0x29')](_0x4a949d,_0xf99c18);if(_0x4870fa){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x2a'),_0xe3ed('0x2b'),_0x4870fa,_0x4b17a3));}}return db[_0xe3ed('0x2c')][_0xe3ed('0x2d')](_0x16fa53,{'raw':!![],'hooks':![],'fields':_[_0xe3ed('0x2e')](_0x16fa53)})[_0xe3ed('0x2f')](function(_0x608489){if(DUPLICATES&&DUPLICATES[_0xe3ed('0x28')]&&_0x4a949d){_0x4a949d[_0xe3ed('0x30')](_['pick'](_0x16fa53,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x608489['id'];return _0x30eec4();})[_0xe3ed('0x31')](function(_0x5cf347){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x32')+(_0x5cf347[_0xe3ed('0x18')]||JSON[_0xe3ed('0x33')](_0x5cf347)),null,_0x4b17a3));});});}function checkHopper(){function _0x19864a(){return function(_0x23cbdf){logger[_0xe3ed('0x14')](_0xe3ed('0x34'),_0xe3ed('0x35'),util[_0xe3ed('0x36')](_0x23cbdf,{'showHidden':![],'depth':null}));};}var _0x34fbff=function(_0x4bcdce,_0x507611){var _0x2a96c2=squel['insert']()[_0xe3ed('0x37')](_0xe3ed('0x38'))[_0xe3ed('0x39')](['phone','scheduledAt',_0xe3ed('0x3a'),_0xe3ed('0x26'),_0x507611,_0xe3ed('0x3b'),_0xe3ed('0x3c')],squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'scheduledAt')[_0xe3ed('0x3e')]('id',_0xe3ed('0x3a'))[_0xe3ed('0x3e')](LISTID[_0xe3ed('0x40')](),_0xe3ed('0x26'))['field'](_0x4bcdce['id'][_0xe3ed('0x40')](),_0x507611)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3b'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')]('cm_contacts')[_0xe3ed('0x42')](_0xe3ed('0x43'))[_0xe3ed('0x42')](_0xe3ed('0x44'),LISTID[_0xe3ed('0x40')]())[_0xe3ed('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xe3ed('0x42')](_0xe3ed('0x45'),squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'))[_0xe3ed('0x41')](_0xe3ed('0x38'))[_0xe3ed('0x42')](_0x507611+_0xe3ed('0x46'),_0x4bcdce['id'][_0xe3ed('0x40')]())))[_0xe3ed('0x40')]();return _0x2a96c2;};var _0xf88546=function(_0x378a59,_0xe6697a){var _0x3758f1=squel[_0xe3ed('0x47')]()['into'](_0xe3ed('0x38'))[_0xe3ed('0x39')]([_0xe3ed('0x1e'),_0xe3ed('0x48'),_0xe3ed('0x3a'),_0xe3ed('0x26'),_0xe6697a,_0xe3ed('0x3b'),_0xe3ed('0x3c')],squel[_0xe3ed('0x3d')]()['field'](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'scheduledAt')[_0xe3ed('0x3e')]('id','ContactId')[_0xe3ed('0x3e')](LISTID['toString'](),_0xe3ed('0x26'))[_0xe3ed('0x3e')](_0x378a59['id'][_0xe3ed('0x40')](),_0xe6697a)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'createdAt')[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')](_0xe3ed('0x49'))[_0xe3ed('0x42')](_0xe3ed('0x43'))['where'](_0xe3ed('0x44'),LISTID[_0xe3ed('0x40')]())[_0xe3ed('0x42')]('id\x20IN\x20?',squel[_0xe3ed('0x4a')](hopperContacts))[_0xe3ed('0x42')](_0xe3ed('0x4b'))[_0xe3ed('0x42')](_0xe3ed('0x45'),squel[_0xe3ed('0x3d')]()['field'](_0xe3ed('0x4c'))['from']('cm_hopper_final')['where'](_0xe6697a+_0xe3ed('0x46'),_0x378a59['id'][_0xe3ed('0x40')]()))[_0xe3ed('0x42')](_0xe3ed('0x45'),squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'))[_0xe3ed('0x41')](_0xe3ed('0x38'))[_0xe3ed('0x42')](_0xe6697a+_0xe3ed('0x46'),_0x378a59['id']['toString']())))[_0xe3ed('0x40')]();return _0x3758f1;};function _0x580ce7(_0x37c374,_0xaa2246){var _0xf4ad4c=squel[_0xe3ed('0x47')]()[_0xe3ed('0x37')](_0xe3ed('0x38'))[_0xe3ed('0x39')]([_0xe3ed('0x1e'),_0xe3ed('0x48'),_0xe3ed('0x3a'),_0xe3ed('0x26'),_0xaa2246,'createdAt',_0xe3ed('0x3c')],squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x48'))[_0xe3ed('0x3e')]('id','ContactId')[_0xe3ed('0x3e')](LISTID[_0xe3ed('0x40')](),_0xe3ed('0x26'))[_0xe3ed('0x3e')](_0x37c374['id'][_0xe3ed('0x40')](),_0xaa2246)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3b'))['field'](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')]('cm_contacts')[_0xe3ed('0x42')](_0xe3ed('0x43'))[_0xe3ed('0x42')](_0xe3ed('0x44'),LISTID[_0xe3ed('0x40')]())[_0xe3ed('0x42')](_0xe3ed('0x4d'),squel[_0xe3ed('0x4a')](hopperContacts))[_0xe3ed('0x42')](_0xe3ed('0x4b')))[_0xe3ed('0x40')]();return _0xf4ad4c;}function _0x4d3f54(_0x22c3df,_0x4f3835){var _0x1786a0=squel[_0xe3ed('0x47')]()['into']('cm_hopper_black')['fromQuery']([_0xe3ed('0x1e'),_0xe3ed('0x3a'),_0xe3ed('0x26'),_0x4f3835,_0xe3ed('0x3b'),_0xe3ed('0x3c')],squel['select']()[_0xe3ed('0x3e')](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')]('id',_0xe3ed('0x3a'))[_0xe3ed('0x3e')](LISTID[_0xe3ed('0x40')](),_0xe3ed('0x26'))[_0xe3ed('0x3e')](_0x22c3df['id'][_0xe3ed('0x40')](),_0x4f3835)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'createdAt')[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')](_0xe3ed('0x49'))['where'](_0xe3ed('0x43'))[_0xe3ed('0x42')](_0xe3ed('0x44'),LISTID['toString']())[_0xe3ed('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xe3ed('0x42')](_0xe3ed('0x4b')))[_0xe3ed('0x40')]();return _0x1786a0;}return db[_0xe3ed('0x4e')][_0xe3ed('0x4f')]({'where':{'type':_0xe3ed('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xe3ed('0x51'),'where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x17ba2f){var _0x33b7e8=[];if(_0x17ba2f){var _0x2c5803;for(var _0x3450df=0x0,_0x375834;_0x3450df<_0x17ba2f[_0xe3ed('0x28')];_0x3450df+=0x1){_0x375834=_0x17ba2f[_0x3450df][_0xe3ed('0x52')]({'plain':!![]});switch(_0x375834['dialCheckDuplicateType']){case _0xe3ed('0x53'):_0x33b7e8['push'](db[_0xe3ed('0x54')]['query'](_0xf88546(_0x375834,_0xe3ed('0x55')))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;case _0xe3ed('0x56'):_0x33b7e8[_0xe3ed('0x30')](db['sequelize'][_0xe3ed('0x57')](_0x34fbff(_0x375834,'VoiceQueueId'))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;default:_0x33b7e8[_0xe3ed('0x30')](db['sequelize']['query'](_0x580ce7(_0x375834,_0xe3ed('0x55')))[_0xe3ed('0x2f')](function(){})['catch'](_0x19864a()));}}}return _0x33b7e8;})[_0xe3ed('0x58')]()[_0xe3ed('0x2f')](function(){return db['VoiceQueue'][_0xe3ed('0x4f')]({'where':{'type':_0xe3ed('0x50')},'attributes':['id'],'include':[{'model':db[_0xe3ed('0x59')],'as':_0xe3ed('0x5a'),'where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x24cf58){var _0x4df31d=[];if(_0x24cf58){var _0x4ca11c;for(var _0x2e40de=0x0,_0x3df811;_0x2e40de<_0x24cf58['length'];_0x2e40de+=0x1){_0x3df811=_0x24cf58[_0x2e40de][_0xe3ed('0x52')]({'plain':!![]});_0x4df31d['push'](db['sequelize'][_0xe3ed('0x57')](_0x4d3f54(_0x3df811,_0xe3ed('0x55')))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));}}return _0x4df31d;})[_0xe3ed('0x58')]();})[_0xe3ed('0x2f')](function(){return db['Campaign'][_0xe3ed('0x4f')]({'attributes':['id',_0xe3ed('0x5b')],'include':[{'model':db[_0xe3ed('0x59')],'as':'Lists','where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x1dc1d1){var _0x5c2b35=[];if(_0x1dc1d1){for(var _0x65ba85=0x0,_0x331218;_0x65ba85<_0x1dc1d1['length'];_0x65ba85+=0x1){_0x331218=_0x1dc1d1[_0x65ba85]['get']({'plain':!![]});switch(_0x331218['dialCheckDuplicateType']){case _0xe3ed('0x53'):_0x5c2b35['push'](db[_0xe3ed('0x54')]['query'](_0xf88546(_0x331218,'CampaignId'))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;case _0xe3ed('0x56'):_0x5c2b35[_0xe3ed('0x30')](db[_0xe3ed('0x54')][_0xe3ed('0x57')](_0x34fbff(_0x331218,_0xe3ed('0x5c')))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;default:_0x5c2b35[_0xe3ed('0x30')](db['sequelize'][_0xe3ed('0x57')](_0x580ce7(_0x331218,_0xe3ed('0x5c')))[_0xe3ed('0x2f')](function(){})['catch'](_0x19864a()));}}}return _0x5c2b35;})[_0xe3ed('0x58')]();})[_0xe3ed('0x2f')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0xe3ed('0x59')],'as':_0xe3ed('0x5a'),'where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x13e0e1){var _0x4703e3=[];if(_0x13e0e1){for(var _0x32b37b=0x0,_0x10419a;_0x32b37b<_0x13e0e1[_0xe3ed('0x28')];_0x32b37b+=0x1){_0x10419a=_0x13e0e1[_0x32b37b][_0xe3ed('0x52')]({'plain':!![]});_0x4703e3['push'](db[_0xe3ed('0x54')][_0xe3ed('0x57')](_0x4d3f54(_0x10419a,_0xe3ed('0x5c')))[_0xe3ed('0x2f')](function(){})['catch'](_0x19864a()));}}return _0x4703e3;})[_0xe3ed('0x58')]();})[_0xe3ed('0x31')](function(_0x3dbaa4){logger[_0xe3ed('0x14')](_0xe3ed('0x5d'),_0xe3ed('0x5e'),_0x3dbaa4['message']);});}var processPromises=function(_0x520aff){return BPromise['all'](promises)[_0xe3ed('0x2f')](function(_0x2e9e0c){})[_0xe3ed('0x31')](function(_0x5535ec){logger[_0xe3ed('0x14')](_0xe3ed('0x5f'),JSON[_0xe3ed('0x33')](_0x5535ec));})['finally'](function(){socket[_0xe3ed('0x60')](_0xe3ed('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x520aff){return _0x520aff[_0xe3ed('0x62')]();}});};var endCsv=function(){return BPromise[_0xe3ed('0x63')]()[_0xe3ed('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0xe3ed('0x2f')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe3ed('0x64')](FILEPATH);}catch(_0x2171a3){logger[_0xe3ed('0x14')](_0xe3ed('0x65'),JSON[_0xe3ed('0x33')](_0x2171a3));}finally{process[_0xe3ed('0x66')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xe3ed('0x67'));endCsv();});function main(){return BPromise[_0xe3ed('0x63')]()[_0xe3ed('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe3ed('0xf')](',');return db[_0xe3ed('0x2c')][_0xe3ed('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe3ed('0x2f')](function(_0x3c7afc){var _0x98da7d=fs[_0xe3ed('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x98da7d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1146fc,_0x3649b1){total+=0x1;var _0x58f964=total;promises['push'](checkRow(_0x1146fc,_0x3c7afc,_0x58f964)[_0xe3ed('0x2f')](function(){success+=0x1;})['catch'](function(_0x29796d){if(_0x29796d['error']){errors+=0x1;delete _0x29796d[_0xe3ed('0x14')];}else if(_0x29796d['duplicate']){duplicates+=0x1;delete _0x29796d['duplicate'];}rows['push'](_0x29796d);}));if(total%0xc8===0x0){_0x3649b1[_0xe3ed('0x69')]();return processPromises(_0x3649b1);}},'complete':function(){return processPromises()[_0xe3ed('0x2f')](function(){logger[_0xe3ed('0x6a')](_0xe3ed('0x6b'));endCsv();});},'error':function(_0x442f93,_0x5da77c){logger['info'](_0xe3ed('0x6c'),JSON[_0xe3ed('0x33')](_0x442f93));endCsv();}});})[_0xe3ed('0x31')](function(_0x49c6e7){logger[_0xe3ed('0x14')](_0xe3ed('0x6d'),JSON['stringify'](_0x49c6e7));});}main(); \ No newline at end of file +var _0x879f=['findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','VoiceQueueId','sequelize','query','all','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','length','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','inspect','into','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','fromQuery','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','insert','cm_hopper_black','VoiceQueue'];(function(_0x427ef2,_0x1b1ede){var _0xa27e46=function(_0x11573b){while(--_0x11573b){_0x427ef2['push'](_0x427ef2['shift']());}};_0xa27e46(++_0x1b1ede);}(_0x879f,0x171));var _0xf879=function(_0x2c064c,_0x2e865d){_0x2c064c=_0x2c064c-0x0;var _0x2361ad=_0x879f[_0x2c064c];return _0x2361ad;};'use strict';var BPromise=require(_0xf879('0x0'));var util=require(_0xf879('0x1'));var _=require(_0xf879('0x2'));var fs=require('fs');var squel=require(_0xf879('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xf879('0x4'))['db'];var config=require(_0xf879('0x5'));var logger=require(_0xf879('0x6'))('api');config[_0xf879('0x7')]=_[_0xf879('0x8')](config[_0xf879('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xf879('0x9'))(new Redis(config[_0xf879('0x7')]));require(_0xf879('0xa'))[_0xf879('0xb')](socket);try{if(!process[_0xf879('0xc')][0x2]||process[_0xf879('0xc')][0x2]==='undefined'||process[_0xf879('0xc')][0x2]===_0xf879('0xd')){throw new Error(_0xf879('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xf879('0xc')][0x3]||process[_0xf879('0xc')][0x3]===_0xf879('0xf')||process['argv'][0x3]===_0xf879('0xd')||!process[_0xf879('0xc')][0x4]||process[_0xf879('0xc')][0x4]===_0xf879('0xf')||process[_0xf879('0xc')][0x4]==='null'){throw new Error(_0xf879('0x10'));}var FIELDS=_['zipObject'](process[_0xf879('0xc')][0x3][_0xf879('0x11')](','),process[_0xf879('0xc')][0x4]['split'](','));if(!process[_0xf879('0xc')][0x5]||process[_0xf879('0xc')][0x5]==='undefined'||process[_0xf879('0xc')][0x5]==='null'){throw new Error(_0xf879('0x12'));}var LISTID=process[_0xf879('0xc')][0x5];var COMPANYID=process[_0xf879('0xc')][0x6]&&process[_0xf879('0xc')][0x6]!==_0xf879('0xf')&&process[_0xf879('0xc')][0x6]!=='null'?process[_0xf879('0xc')][0x6]:null;var DUPLICATES=process[_0xf879('0xc')][0x7]&&process['argv'][0x7]!==_0xf879('0xf')&&process[_0xf879('0xc')][0x7]!==_0xf879('0xd')?process[_0xf879('0xc')][0x7]:null;if(!process[_0xf879('0xc')][0x8]||process[_0xf879('0xc')][0x8]===_0xf879('0xf')||process[_0xf879('0xc')][0x8]===_0xf879('0xd')){throw new Error(_0xf879('0x13'));}var SOCKET_TIMESTAMP=process[_0xf879('0xc')][0x8];}catch(_0x517d8d){logger[_0xf879('0x14')](_0x517d8d);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(_0x27a629,_0x5182d6,_0x4a0e17,_0x1f68c3){var _0x46ac3c={'message':_0x5182d6};_0x46ac3c[_0x27a629]=!![];if(_0x4a0e17){_0x46ac3c[_0xf879('0x15')]=_0x4a0e17;}if(_0x1f68c3){_0x46ac3c[_0xf879('0x16')]=_0x1f68c3;}return _0x46ac3c;}function isEmail(_0x351e06){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))*$/[_0xf879('0x17')](_0x351e06);}function checkRow(_0xd7e823,_0xc8e09d,_0x34fe68){return new BPromise(function(_0x1fdb49,_0x4bf5da){if(_['isNil'](_0xd7e823)){return _0x4bf5da(handleCheckRowError(_0xf879('0x14'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x34fe68));}if(_0xd7e823['errors']&&_0xd7e823[_0xf879('0x18')][_0xf879('0x19')]){var _0x2432eb=_['map'](_0xd7e823[_0xf879('0x18')],'message')[_0xf879('0x1a')](';');return _0x4bf5da(handleCheckRowError(_0xf879('0x14'),_0x2432eb,null,_0x34fe68));}var _0x3984e4={};for(var _0x4e28b2 in FIELDS){if(FIELDS[_0xf879('0x1b')](_0x4e28b2)&&FIELDS[_0x4e28b2]){_0x3984e4[_0x4e28b2]=_0xd7e823[_0xf879('0x1c')][0x0][FIELDS[_0x4e28b2]]||_0xd7e823['data'][0x0]['\ufeff'+FIELDS[_0x4e28b2]];}}if(!_0x3984e4[_0xf879('0x1d')]){return _0x4bf5da(handleCheckRowError('error',_0xf879('0x1e'),null,_0x34fe68));}if(!_0x3984e4[_0xf879('0x1f')]){return _0x4bf5da(handleCheckRowError(_0xf879('0x14'),_0xf879('0x20'),null,_0x34fe68));}if(_0x3984e4[_0xf879('0x21')]){var _0x541866=moment(_0x3984e4[_0xf879('0x21')],_0xf879('0x22'));if(!_0x541866['isValid']()){return _0x4bf5da(handleCheckRowError(_0xf879('0x14'),_0xf879('0x23'),null,_0x34fe68));}}if(_0x3984e4[_0xf879('0x24')]){if(!isEmail(_0x3984e4[_0xf879('0x24')])){return _0x4bf5da(handleCheckRowError(_0xf879('0x14'),_0xf879('0x25'),null,_0x34fe68));}}_0x3984e4[_0xf879('0x26')]=LISTID;_0x3984e4[_0xf879('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xf879('0x19')]&&_0xc8e09d){var _0x1aab8c={};for(var _0x2cbcd9=0x0,_0x55f21f=DUPLICATES[_0xf879('0x19')];_0x2cbcd9<_0x55f21f;_0x2cbcd9+=0x1){_0x1aab8c[DUPLICATES[_0x2cbcd9]]=_0x3984e4[DUPLICATES[_0x2cbcd9]];}var _0x8c8635=_[_0xf879('0x28')](_0xc8e09d,_0x1aab8c);if(_0x8c8635){return _0x4bf5da(handleCheckRowError(_0xf879('0x29'),_0xf879('0x2a'),_0x8c8635,_0x34fe68));}}return db[_0xf879('0x2b')][_0xf879('0x2c')](_0x3984e4,{'raw':!![],'hooks':![],'fields':_[_0xf879('0x2d')](_0x3984e4)})[_0xf879('0x2e')](function(_0x5173e7){if(DUPLICATES&&DUPLICATES[_0xf879('0x19')]&&_0xc8e09d){_0xc8e09d[_0xf879('0x2f')](_[_0xf879('0x30')](_0x3984e4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5173e7['id'];return _0x1fdb49();})[_0xf879('0x31')](function(_0x1ced83){return _0x4bf5da(handleCheckRowError('error',_0xf879('0x32')+(_0x1ced83[_0xf879('0x33')]||JSON['stringify'](_0x1ced83)),null,_0x34fe68));});});}function checkHopper(){function _0x59a4dd(){return function(_0x5b1d86){logger[_0xf879('0x14')](_0xf879('0x34'),'checkHopper',util[_0xf879('0x35')](_0x5b1d86,{'showHidden':![],'depth':null}));};}var _0x7fa301=function(_0x2e2e0d,_0x3b0446){var _0x3c91ce=squel['insert']()[_0xf879('0x36')]('cm_hopper')['fromQuery']([_0xf879('0x1f'),_0xf879('0x37'),_0xf879('0x38'),'ListId',_0x3b0446,_0xf879('0x39'),_0xf879('0x3a')],squel[_0xf879('0x3b')]()['field'](_0xf879('0x1f'),_0xf879('0x1f'))[_0xf879('0x3c')](_0xf879('0x3d'),_0xf879('0x37'))[_0xf879('0x3c')]('id',_0xf879('0x38'))[_0xf879('0x3c')](LISTID['toString'](),'ListId')[_0xf879('0x3c')](_0x2e2e0d['id']['toString'](),_0x3b0446)[_0xf879('0x3c')]('NOW()','createdAt')[_0xf879('0x3c')](_0xf879('0x3d'),_0xf879('0x3a'))[_0xf879('0x3e')](_0xf879('0x3f'))[_0xf879('0x40')](_0xf879('0x41'))[_0xf879('0x40')]('ListId\x20=\x20?',LISTID[_0xf879('0x42')]())[_0xf879('0x40')](_0xf879('0x43'))[_0xf879('0x40')](_0xf879('0x44'),squel[_0xf879('0x3b')]()[_0xf879('0x3c')](_0xf879('0x1f'))[_0xf879('0x3e')](_0xf879('0x45'))[_0xf879('0x40')](_0x3b0446+_0xf879('0x46'),_0x2e2e0d['id'][_0xf879('0x42')]())))[_0xf879('0x42')]();return _0x3c91ce;};var _0x529078=function(_0x2d8fb3,_0x36212c){var _0x394595=squel['insert']()[_0xf879('0x36')]('cm_hopper')[_0xf879('0x47')]([_0xf879('0x1f'),_0xf879('0x37'),'ContactId',_0xf879('0x26'),_0x36212c,_0xf879('0x39'),_0xf879('0x3a')],squel['select']()[_0xf879('0x3c')]('phone',_0xf879('0x1f'))[_0xf879('0x3c')]('NOW()','scheduledAt')[_0xf879('0x3c')]('id','ContactId')['field'](LISTID['toString'](),_0xf879('0x26'))[_0xf879('0x3c')](_0x2d8fb3['id'][_0xf879('0x42')](),_0x36212c)[_0xf879('0x3c')]('NOW()','createdAt')[_0xf879('0x3c')]('NOW()',_0xf879('0x3a'))[_0xf879('0x3e')](_0xf879('0x3f'))['where'](_0xf879('0x41'))[_0xf879('0x40')](_0xf879('0x48'),LISTID[_0xf879('0x42')]())[_0xf879('0x40')](_0xf879('0x49'),squel[_0xf879('0x4a')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xf879('0x40')](_0xf879('0x44'),squel[_0xf879('0x3b')]()[_0xf879('0x3c')](_0xf879('0x4b'))['from']('cm_hopper_final')['where'](_0x36212c+_0xf879('0x46'),_0x2d8fb3['id'][_0xf879('0x42')]()))['where'](_0xf879('0x44'),squel[_0xf879('0x3b')]()[_0xf879('0x3c')](_0xf879('0x1f'))[_0xf879('0x3e')](_0xf879('0x45'))[_0xf879('0x40')](_0x36212c+_0xf879('0x46'),_0x2d8fb3['id'][_0xf879('0x42')]())))[_0xf879('0x42')]();return _0x394595;};function _0x580730(_0x4acfa7,_0x2a1c39){var _0x4a5c1c=squel[_0xf879('0x4c')]()[_0xf879('0x36')](_0xf879('0x45'))[_0xf879('0x47')](['phone',_0xf879('0x37'),_0xf879('0x38'),'ListId',_0x2a1c39,'createdAt',_0xf879('0x3a')],squel[_0xf879('0x3b')]()[_0xf879('0x3c')]('phone',_0xf879('0x1f'))['field']('NOW()','scheduledAt')[_0xf879('0x3c')]('id','ContactId')[_0xf879('0x3c')](LISTID[_0xf879('0x42')](),'ListId')['field'](_0x4acfa7['id'][_0xf879('0x42')](),_0x2a1c39)['field'](_0xf879('0x3d'),_0xf879('0x39'))[_0xf879('0x3c')](_0xf879('0x3d'),_0xf879('0x3a'))['from'](_0xf879('0x3f'))[_0xf879('0x40')](_0xf879('0x41'))[_0xf879('0x40')](_0xf879('0x48'),LISTID[_0xf879('0x42')]())[_0xf879('0x40')](_0xf879('0x49'),squel[_0xf879('0x4a')](hopperContacts))[_0xf879('0x40')](_0xf879('0x43')))[_0xf879('0x42')]();return _0x4a5c1c;}function _0x6585e2(_0x211a7b,_0x417b94){var _0x1585f4=squel[_0xf879('0x4c')]()['into'](_0xf879('0x4d'))[_0xf879('0x47')]([_0xf879('0x1f'),_0xf879('0x38'),_0xf879('0x26'),_0x417b94,_0xf879('0x39'),_0xf879('0x3a')],squel[_0xf879('0x3b')]()['field']('phone',_0xf879('0x1f'))[_0xf879('0x3c')]('id',_0xf879('0x38'))[_0xf879('0x3c')](LISTID[_0xf879('0x42')](),_0xf879('0x26'))[_0xf879('0x3c')](_0x211a7b['id'][_0xf879('0x42')](),_0x417b94)[_0xf879('0x3c')]('NOW()',_0xf879('0x39'))[_0xf879('0x3c')]('NOW()',_0xf879('0x3a'))[_0xf879('0x3e')](_0xf879('0x3f'))['where'](_0xf879('0x41'))[_0xf879('0x40')](_0xf879('0x48'),LISTID['toString']())[_0xf879('0x40')](_0xf879('0x49'),squel[_0xf879('0x4a')](hopperContacts))['where'](_0xf879('0x43')))['toString']();return _0x1585f4;}return db[_0xf879('0x4e')][_0xf879('0x4f')]({'where':{'type':_0xf879('0x50')},'attributes':['id',_0xf879('0x51')],'include':[{'model':db[_0xf879('0x52')],'as':_0xf879('0x53'),'where':{'id':LISTID}}]})[_0xf879('0x2e')](function(_0x5df461){var _0x19e2d2=[];if(_0x5df461){var _0x30a33f;for(var _0x4325c2=0x0,_0x199910;_0x4325c2<_0x5df461[_0xf879('0x19')];_0x4325c2+=0x1){_0x199910=_0x5df461[_0x4325c2][_0xf879('0x54')]({'plain':!![]});switch(_0x199910[_0xf879('0x51')]){case _0xf879('0x55'):_0x19e2d2[_0xf879('0x2f')](db['sequelize']['query'](_0x529078(_0x199910,_0xf879('0x56')))['then'](function(){})['catch'](_0x59a4dd()));break;case'onlyIfOpen':_0x19e2d2['push'](db[_0xf879('0x57')][_0xf879('0x58')](_0x7fa301(_0x199910,_0xf879('0x56')))['then'](function(){})[_0xf879('0x31')](_0x59a4dd()));break;default:_0x19e2d2['push'](db[_0xf879('0x57')][_0xf879('0x58')](_0x580730(_0x199910,'VoiceQueueId'))[_0xf879('0x2e')](function(){})[_0xf879('0x31')](_0x59a4dd()));}}}return _0x19e2d2;})[_0xf879('0x59')]()['then'](function(){return db[_0xf879('0x4e')]['findAll']({'where':{'type':_0xf879('0x50')},'attributes':['id'],'include':[{'model':db[_0xf879('0x52')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x309fe9){var _0x15cfb4=[];if(_0x309fe9){var _0x5acd63;for(var _0x53a852=0x0,_0x54c60b;_0x53a852<_0x309fe9[_0xf879('0x19')];_0x53a852+=0x1){_0x54c60b=_0x309fe9[_0x53a852][_0xf879('0x54')]({'plain':!![]});_0x15cfb4[_0xf879('0x2f')](db[_0xf879('0x57')][_0xf879('0x58')](_0x6585e2(_0x54c60b,'VoiceQueueId'))['then'](function(){})[_0xf879('0x31')](_0x59a4dd()));}}return _0x15cfb4;})[_0xf879('0x59')]();})[_0xf879('0x2e')](function(){return db[_0xf879('0x5a')]['findAll']({'attributes':['id',_0xf879('0x51')],'include':[{'model':db[_0xf879('0x52')],'as':_0xf879('0x53'),'where':{'id':LISTID}}]})[_0xf879('0x2e')](function(_0x151d00){var _0x2a0239=[];if(_0x151d00){for(var _0x2cf37f=0x0,_0x290b17;_0x2cf37f<_0x151d00['length'];_0x2cf37f+=0x1){_0x290b17=_0x151d00[_0x2cf37f]['get']({'plain':!![]});switch(_0x290b17[_0xf879('0x51')]){case'always':_0x2a0239[_0xf879('0x2f')](db[_0xf879('0x57')][_0xf879('0x58')](_0x529078(_0x290b17,_0xf879('0x5b')))[_0xf879('0x2e')](function(){})['catch'](_0x59a4dd()));break;case _0xf879('0x5c'):_0x2a0239[_0xf879('0x2f')](db[_0xf879('0x57')][_0xf879('0x58')](_0x7fa301(_0x290b17,_0xf879('0x5b')))[_0xf879('0x2e')](function(){})[_0xf879('0x31')](_0x59a4dd()));break;default:_0x2a0239[_0xf879('0x2f')](db[_0xf879('0x57')][_0xf879('0x58')](_0x580730(_0x290b17,'CampaignId'))[_0xf879('0x2e')](function(){})[_0xf879('0x31')](_0x59a4dd()));}}}return _0x2a0239;})[_0xf879('0x59')]();})[_0xf879('0x2e')](function(){return db[_0xf879('0x5a')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xf879('0x52')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xf879('0x2e')](function(_0x2491eb){var _0x428633=[];if(_0x2491eb){for(var _0x16c98d=0x0,_0xfb0647;_0x16c98d<_0x2491eb['length'];_0x16c98d+=0x1){_0xfb0647=_0x2491eb[_0x16c98d][_0xf879('0x54')]({'plain':!![]});_0x428633[_0xf879('0x2f')](db[_0xf879('0x57')][_0xf879('0x58')](_0x6585e2(_0xfb0647,_0xf879('0x5b')))[_0xf879('0x2e')](function(){})['catch'](_0x59a4dd()));}}return _0x428633;})[_0xf879('0x59')]();})[_0xf879('0x31')](function(_0x5418e3){logger['error'](_0xf879('0x5d'),_0xf879('0x5e'),_0x5418e3[_0xf879('0x33')]);});}var processPromises=function(_0x166a18){return BPromise[_0xf879('0x59')](promises)[_0xf879('0x2e')](function(_0x664d61){})[_0xf879('0x31')](function(_0x296fd4){logger['error'](_0xf879('0x5f'),JSON['stringify'](_0x296fd4));})[_0xf879('0x60')](function(){socket[_0xf879('0x61')](_0xf879('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x166a18){return _0x166a18[_0xf879('0x63')]();}});};var endCsv=function(){return BPromise[_0xf879('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xf879('0x61')](_0xf879('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x46849a){logger[_0xf879('0x14')](_0xf879('0x65'),JSON[_0xf879('0x66')](_0x46849a));}finally{process[_0xf879('0x67')](0x0);}});};process['on'](_0xf879('0x68'),function(){logger['info'](_0xf879('0x69'));endCsv();});function main(){return BPromise[_0xf879('0x64')]()[_0xf879('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xf879('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xf879('0x2e')](function(_0x2d9463){var _0x3bc121=fs[_0xf879('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xf879('0x6b')](_0x3bc121,{'header':!![],'skipEmptyLines':!![],'step':function(_0x244113,_0x3f9fe8){total+=0x1;var _0x23065c=total;promises['push'](checkRow(_0x244113,_0x2d9463,_0x23065c)[_0xf879('0x2e')](function(){success+=0x1;})[_0xf879('0x31')](function(_0x5e6d11){if(_0x5e6d11['error']){errors+=0x1;delete _0x5e6d11[_0xf879('0x14')];}else if(_0x5e6d11[_0xf879('0x29')]){duplicates+=0x1;delete _0x5e6d11[_0xf879('0x29')];}rows['push'](_0x5e6d11);}));if(total%0xc8===0x0){_0x3f9fe8[_0xf879('0x6c')]();return processPromises(_0x3f9fe8);}},'complete':function(){return processPromises()[_0xf879('0x2e')](function(){logger[_0xf879('0x6d')](_0xf879('0x6e'));endCsv();});},'error':function(_0x3c83f5,_0x2c0c82){logger[_0xf879('0x6d')]('CSV\x20parse\x20error',JSON['stringify'](_0x3c83f5));endCsv();}});})['catch'](function(_0x21cb06){logger[_0xf879('0x14')](_0xf879('0x6f'),JSON['stringify'](_0x21cb06));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 8902862..fb8fe52 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 _0xdcfb=['cm_hopper_additional_phones','CmHopperId','OrderBy','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','info','message','exit','query','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','spread','timezones','dialTimezone','utcOffset','offset','set','sequelize','main','stringify','send','binding','server/files/tmp','.csv','header','name','_description','writeFileSync','createReadStream','data','rows','errors','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','SystemRow','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','voice_queues','affectedRows','emit','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','length','split','isNil','filter','CmContactHasItem','findOne','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.createdAt','insert','cm_hopper_black','.CmListId','ListId\x20=\x20?','scheduledat','priority','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];(function(_0x110275,_0x3eb1a8){var _0x3aaf46=function(_0x47f832){while(--_0x47f832){_0x110275['push'](_0x110275['shift']());}};_0x3aaf46(++_0x3eb1a8);}(_0xdcfb,0x68));var _0xbdcf=function(_0x3fb150,_0x5e32ed){_0x3fb150=_0x3fb150-0x0;var _0x56f4a8=_0xdcfb[_0x3fb150];return _0x56f4a8;};'use strict';var fs=require('fs');var path=require(_0xbdcf('0x0'));var _=require(_0xbdcf('0x1'));var Papa=require(_0xbdcf('0x2'));var util=require(_0xbdcf('0x3'));var BPromise=require(_0xbdcf('0x4'));var moment=require('moment');var squel=require(_0xbdcf('0x5'));var Redis=require(_0xbdcf('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xbdcf('0x7'));var shared=require(_0xbdcf('0x8'));var logger=require(_0xbdcf('0x9'))(_0xbdcf('0xa'));config[_0xbdcf('0xb')]=_[_0xbdcf('0xc')](config[_0xbdcf('0xb')],{'host':_0xbdcf('0xd'),'port':0x18eb});var socket=require(_0xbdcf('0xe'))(new Redis(config[_0xbdcf('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xbdcf('0xf')](_0xbdcf('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xbdcf('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3fecb5){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3fecb5);}function selectNotIn(_0x5d3c40,_0x1c7581,_0x3f9fdb,_0x53c54,_0x20115e){return squel[_0xbdcf('0x11')]()[_0xbdcf('0x12')](_0xbdcf('0x13'))[_0xbdcf('0x14')](_0x53c54)['join'](_0x1c7581,null,_0x1c7581+'.id\x20=\x20'+_0x53c54+'.'+_0x3f9fdb)[_0xbdcf('0x15')](_0x53c54+'.'+_0x3f9fdb+_0xbdcf('0x16')+_0x5d3c40+'.'+_0x3f9fdb)[_0xbdcf('0x15')](_0x1c7581+_0xbdcf('0x17')+_0x20115e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x43dc1e,_0x111346){promisesAdditionalPhones=[];return db[_0xbdcf('0x18')][_0xbdcf('0x19')]({'raw':!![],'attributes':['id',_0xbdcf('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xbdcf('0x1b')](function(_0x48ba7e){if(_0x48ba7e!==null){var _0x1af2ca=[];for(var _0x516320=0x0;_0x516320<_0x48ba7e['length'];_0x516320++){var _0x575ee1=_0x48ba7e[_0x516320];_0x1af2ca[_0xbdcf('0x1c')](insertAdditionalPhones(_0x575ee1));}}Promise[_0xbdcf('0x1d')](_0x1af2ca)[_0xbdcf('0x1b')](function(){_0x43dc1e({'val':0x1});});});});}function insertAdditionalPhones(_0x35427a){return new Promise(function(_0x2b5a32,_0x56a5f3){var _0x8b94c3=_0x35427a[_0xbdcf('0x1a')];var _0x111756=_0x8b94c3['split'](';');var _0x2a7e5c=[];orderBy=0x0;for(var _0x45972d=0x0;_0x45972d<_0x111756[_0xbdcf('0x1e')];_0x45972d++){_0x2a7e5c[_0xbdcf('0x1c')](splitAdditionalPhone(_0x35427a['id'],_0x111756[_0x45972d]));}Promise['all'](_0x2a7e5c)[_0xbdcf('0x1b')](function(){_0x2b5a32({'val':_0x111756[_0xbdcf('0x1e')]});});});}function splitAdditionalPhone(_0x5e30cd,_0x5b16f0){return new Promise(function(_0x4af3ed,_0x1dadf2){var _0xc70ac=_0x5b16f0[_0xbdcf('0x1f')](':');var _0x5d1e70=_0xc70ac[0x0];var _0x5bd832=_0xc70ac[0x1];if(!_[_0xbdcf('0x20')](_0x5bd832)){var _0x4b42f7=_0x5bd832[_0xbdcf('0x1f')]('|');var _0x2262ab=[];for(var _0x8de2d4=0x0;_0x8de2d4<_0x4b42f7[_0xbdcf('0x1e')];_0x8de2d4++){if(_0x4b42f7[_0x8de2d4]!==''){var _0x47a788=_[_0xbdcf('0x21')](promisesAdditionalPhones,{'contactId':_0x5e30cd,'phone':_0x4b42f7[_0x8de2d4]});if(_0x47a788['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbdcf('0x1c')]({'contactId':_0x5e30cd,'contactTypeId':_0x5d1e70,'phone':_0x4b42f7[_0x8de2d4],'orderBy':orderBy});}}}_0x4af3ed({'ok':0x1});}else _0x4af3ed({'res':0x0});});}function createAdditionalPhone(_0x52ccf6,_0x790375,_0x329972,_0x82fa2f){var _0x19ad9c='';var _0x42184f='';var _0x13db54=_0x329972[_0xbdcf('0x1f')]('§');_0x19ad9c=_0x13db54[0x0];if(_0x13db54['length']==0x2)_0x42184f=_0x13db54[0x1];return new Promise(function(_0x4a5122,_0x2d20f0){return db[_0xbdcf('0x22')][_0xbdcf('0x23')]({'where':{'CmContactId':_0x52ccf6,'item':_0x19ad9c}})['then'](function(_0x5d4272){if(_0x5d4272){return db[_0xbdcf('0x22')]['update']({'ItemTypeId':_0x790375,'description':_0x42184f,'OrderBy':_0x82fa2f},{'where':{'CmContactId':_0x52ccf6,'item':_0x19ad9c}})[_0xbdcf('0x1b')](function(_0x502d9a){_0x4a5122({'res':'updated'});});}else{return db[_0xbdcf('0x22')][_0xbdcf('0x24')]({'CmContactId':_0x52ccf6,'item':_0x19ad9c,'description':_0x42184f,'ItemTypeId':_0x790375,'OrderBy':_0x82fa2f,'ItemClass':_0xbdcf('0x25')})[_0xbdcf('0x1b')](function(_0x4331c4){_0x4a5122({'res':_0xbdcf('0x26')});});}});});}function insertCmHopper(_0x2b0030,_0x533fa8,_0x41a6a4,_0x25abb0,_0x4c7684){var _0x446c34=[_0xbdcf('0x27'),_0xbdcf('0x28'),_0xbdcf('0x29'),'cm_contacts.ListId',_0x533fa8+'.'+_0x25abb0,'cm_contacts.createdAt',_0xbdcf('0x2a'),_0xbdcf('0x2b'),_0xbdcf('0x2c'),'\x22'+_0x4c7684+'\x22'];return squel['insert']()[_0xbdcf('0x2d')](_0xbdcf('0x2e'))[_0xbdcf('0x2f')]([_0xbdcf('0x13'),'scheduledat',_0xbdcf('0x30'),_0xbdcf('0x31'),_0x25abb0,_0xbdcf('0x32'),_0xbdcf('0x33'),'priority',_0xbdcf('0x34'),_0xbdcf('0x35')],squel['select']()[_0xbdcf('0x36')](_0x446c34)[_0xbdcf('0x14')](_0x533fa8)[_0xbdcf('0x37')](_0xbdcf('0x38'),null,_0xbdcf('0x39')+_0x533fa8+'.CmListId')['join'](_0x41a6a4,null,_0x41a6a4+_0xbdcf('0x3a')+_0x533fa8+'.'+_0x25abb0)['where'](_0x533fa8+_0xbdcf('0x3b'),_0x2b0030)[_0xbdcf('0x15')](_0xbdcf('0x3c'),NOW)[_0xbdcf('0x15')](_0xbdcf('0x3d'),selectNotIn(_0x533fa8,_0x41a6a4,_0x25abb0,_0xbdcf('0x2e'),[_0xbdcf('0x3e'),_0xbdcf('0x3f')]))[_0xbdcf('0x15')](_0xbdcf('0x3d'),selectNotIn(_0x533fa8,_0x41a6a4,_0x25abb0,'cm_hopper',[_0xbdcf('0x3e')])))[_0xbdcf('0x40')]();}function insertCmHopperBlack(_0x57abcb,_0xfa74f6,_0x5e63e0,_0x517fe7){var _0x45fad1=[_0xbdcf('0x27'),_0xbdcf('0x29'),_0xbdcf('0x41'),_0xfa74f6+'.'+_0x517fe7,_0xbdcf('0x42'),_0xbdcf('0x2a')];return squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x44'))[_0xbdcf('0x2f')](['phone',_0xbdcf('0x30'),_0xbdcf('0x31'),_0x517fe7,_0xbdcf('0x32'),_0xbdcf('0x33')],squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x45fad1)[_0xbdcf('0x14')](_0xfa74f6)[_0xbdcf('0x37')](_0xbdcf('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0xfa74f6+_0xbdcf('0x45'))[_0xbdcf('0x37')](_0x5e63e0,null,_0x5e63e0+'.id\x20=\x20'+_0xfa74f6+'.'+_0x517fe7)[_0xbdcf('0x15')](_0xfa74f6+'.CmListId\x20=\x20?',_0x57abcb)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbdcf('0x15')](_0xbdcf('0x3d'),squel[_0xbdcf('0x11')]()[_0xbdcf('0x12')](_0xbdcf('0x13'))[_0xbdcf('0x14')](_0xbdcf('0x44'))[_0xbdcf('0x15')](_0xbdcf('0x46'),_0x57abcb)[_0xbdcf('0x15')](_0x517fe7+_0xbdcf('0x16')+_0xfa74f6+'.'+_0x517fe7)))[_0xbdcf('0x40')]();}function insertTzCmHopper(_0x27ac4c,_0xde590f,_0x10f348,_0xf849c6,_0xe409f4,_0x18ae4f){var _0x53e9f3=[_0xbdcf('0x27'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x18ae4f+'.offset-cm_contacts.utcOffset\x20minute)',_0xbdcf('0x29'),'cm_contacts.ListId',_0xde590f+'.'+_0xf849c6,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xbdcf('0x2b'),_0xbdcf('0x2c'),'\x22'+_0xe409f4+'\x22'];var _0x3a8e36=squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x2e'))[_0xbdcf('0x2f')](['phone',_0xbdcf('0x47'),_0xbdcf('0x30'),'ListId',_0xf849c6,'createdAt',_0xbdcf('0x33'),_0xbdcf('0x48'),_0xbdcf('0x34'),_0xbdcf('0x35')],squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x53e9f3)[_0xbdcf('0x14')](_0xde590f)[_0xbdcf('0x37')]('cm_contacts',null,_0xbdcf('0x39')+_0xde590f+_0xbdcf('0x45'))['join'](_0x10f348,null,_0x10f348+'.id\x20=\x20'+_0xde590f+'.'+_0xf849c6)[_0xbdcf('0x37')](_0x18ae4f,null,_0x18ae4f+'.id\x20=\x20'+_0xde590f+'.'+_0xf849c6)['where'](_0xde590f+_0xbdcf('0x3b'),_0x27ac4c)['where'](_0xbdcf('0x3c'),NOW)['where'](_0xbdcf('0x3d'),selectNotIn(_0xde590f,_0x10f348,_0xf849c6,_0xbdcf('0x2e'),[_0xbdcf('0x3e'),'\x22onlyIfOpen\x22']))[_0xbdcf('0x15')](_0xbdcf('0x3d'),selectNotIn(_0xde590f,_0x10f348,_0xf849c6,_0xbdcf('0x2e'),['\x22always\x22'])))[_0xbdcf('0x40')]();return _0x3a8e36;}function insertTzCmHopperBlack(_0x403bef,_0x4aac2,_0x29408c,_0x448f22){var _0x73cd02=['cm_contacts.phone','cm_contacts.id',_0xbdcf('0x41'),_0x4aac2+'.'+_0x448f22,_0xbdcf('0x42'),_0xbdcf('0x2a')];return squel['insert']()[_0xbdcf('0x2d')]('cm_hopper_black')[_0xbdcf('0x2f')]([_0xbdcf('0x13'),_0xbdcf('0x30'),_0xbdcf('0x31'),_0x448f22,_0xbdcf('0x32'),'updatedAt'],squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x73cd02)[_0xbdcf('0x14')](_0x4aac2)[_0xbdcf('0x37')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4aac2+_0xbdcf('0x45'))[_0xbdcf('0x37')](_0x29408c,null,_0x29408c+'.id\x20=\x20'+_0x4aac2+'.'+_0x448f22)[_0xbdcf('0x15')](_0x4aac2+_0xbdcf('0x3b'),_0x403bef)[_0xbdcf('0x15')](_0xbdcf('0x3c'),NOW)[_0xbdcf('0x15')](_0xbdcf('0x3d'),squel[_0xbdcf('0x11')]()[_0xbdcf('0x12')]('phone')[_0xbdcf('0x14')](_0xbdcf('0x44'))[_0xbdcf('0x15')](_0xbdcf('0x46'),_0x403bef)[_0xbdcf('0x15')](_0x448f22+_0xbdcf('0x16')+_0x4aac2+'.'+_0x448f22)))['toString']();}function insertCmHopperAdditionalPhones(_0x5723ca){var _0x56ecbe=['cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xbdcf('0x49'),_0xbdcf('0x4a')];return squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x4b'))['fromQuery']([_0xbdcf('0x4c'),'phone',_0xbdcf('0x4d'),_0xbdcf('0x32'),_0xbdcf('0x33')],squel['select']()[_0xbdcf('0x36')](_0x56ecbe)[_0xbdcf('0x14')]('cm_hopper')['join'](_0xbdcf('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xbdcf('0x37')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xbdcf('0x15')](_0xbdcf('0x4e'),_0x5723ca)[_0xbdcf('0x15')](_0xbdcf('0x3c'),NOW))['toString']();}function insertCmContact(_0x47e5f4,_0x1496f9,_0x51fc20,_0x2c36d0){var _0x3550c4=_[_0xbdcf('0x4f')](_[_0xbdcf('0x50')](_0x2c36d0),[_0xbdcf('0x31'),_0xbdcf('0x51'),_0xbdcf('0x32'),_0xbdcf('0x33'),_0xbdcf('0x52')]);return squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x38'))[_0xbdcf('0x2f')](_0x3550c4,squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x3550c4)['from'](_0x1496f9)[_0xbdcf('0x15')]('('+_0x51fc20[_0xbdcf('0x37')](',')+_0xbdcf('0x53'),squel['select']()[_0xbdcf('0x36')](_0x51fc20)[_0xbdcf('0x14')](_0xbdcf('0x38'))[_0xbdcf('0x15')]('ListId\x20=\x20?',_0x47e5f4)[_0xbdcf('0x15')](_0xbdcf('0x54')))[_0xbdcf('0x15')]('id\x20IN\x20?',squel['select']()[_0xbdcf('0x12')]('MIN(id)','min_id')[_0xbdcf('0x14')](_0x1496f9)['group'](_0x51fc20['join'](','))))['toString']();}function handleStop(){logger[_0xbdcf('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3f2b11){logger['error'](_0x3f2b11[_0xbdcf('0x56')]);process[_0xbdcf('0x57')](0x1);}function handleError(_0x275fc0,_0x297075){stats['errors'][_0xbdcf('0x1c')]({'name':_0x297075['code'],'message':_0x297075['message'],'row':_0x275fc0});}function handleQuery(_0x2179bc){logger[_0xbdcf('0x55')](_0x2179bc);return db['sequelize'][_0xbdcf('0x58')](_0x2179bc)['spread'](function(_0x14ac7c){results[_0xbdcf('0x1c')](_0x14ac7c);})[_0xbdcf('0x59')](function(_0x1a9f9a){logger[_0xbdcf('0x5a')](_0x1a9f9a[_0xbdcf('0x56')]);});}function updateTzCampaigns(_0x5640e8){return new Promise(function(_0x5c4634,_0x2aeec6){var _0x1d5feb=squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')]([_0xbdcf('0x5b'),_0xbdcf('0x5c')])[_0xbdcf('0x14')](_0xbdcf('0x5d'))[_0xbdcf('0x37')](_0xbdcf('0x5e'),null,_0xbdcf('0x5f'))[_0xbdcf('0x15')](_0xbdcf('0x60')+_0x5640e8);db['sequelize'][_0xbdcf('0x58')](_0x1d5feb[_0xbdcf('0x40')]())['spread'](function(_0x5e4a7f){var _0x849ad=[];for(var _0x2c702f=0x0;_0x2c702f<_0x5e4a7f[_0xbdcf('0x1e')];_0x2c702f++){_0x849ad[_0xbdcf('0x1c')](getTimezoneData(_0x5e4a7f[_0x2c702f],tmp_campaigns));}BPromise['all'](_0x849ad)[_0xbdcf('0x1b')](function(){_0x5c4634({'val':0x1});});})[_0xbdcf('0x59')](function(_0x3954e4){logger[_0xbdcf('0x5a')](_0x3954e4[_0xbdcf('0x56')]);_0x5c4634({'val':0x0});});});}function updateTzVoiceQueues(_0x7344b){return new Promise(function(_0x3f4279,_0x5a2b22){var _0x4e42a0=squel[_0xbdcf('0x11')]()['fields'](['voice_queues.id',_0xbdcf('0x61')])[_0xbdcf('0x14')]('voice_queues')[_0xbdcf('0x37')]('voice_queues_has_cm_lists',null,_0xbdcf('0x62'))[_0xbdcf('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x7344b);db['sequelize'][_0xbdcf('0x58')](_0x4e42a0[_0xbdcf('0x40')]())[_0xbdcf('0x63')](function(_0x40f301){var _0x46bc1e=[];for(var _0x431934=0x0;_0x431934<_0x40f301[_0xbdcf('0x1e')];_0x431934++){_0x46bc1e['push'](getTimezoneData(_0x40f301[_0x431934],tmp_voice_queues));}BPromise[_0xbdcf('0x1d')](_0x46bc1e)['then'](function(){_0x3f4279({'val':0x1});});})['catch'](function(_0x5ebde1){logger[_0xbdcf('0x5a')](_0x5ebde1[_0xbdcf('0x56')]);_0x3f4279({'val':0x0});});});}function getTimezoneData(_0x308dd9,_0x46ee9b){return new Promise(function(_0x20c690,_0x29465){var _0x10f684=shared[_0xbdcf('0x64')];var _0xeba841=_0x10f684[_0x308dd9[_0xbdcf('0x65')]];if(_[_0xbdcf('0x20')](_0xeba841)){_0x20c690({'ret':0x1});}else{var _0x5975eb=_0xeba841[_0xbdcf('0x66')];var _0x21fc74=squel['insert']()[_0xbdcf('0x2d')](_0x46ee9b)['set']('id',_0x308dd9['id'])['set'](_0xbdcf('0x67'),_0x5975eb)[_0xbdcf('0x68')]('dialTimezone',_0x308dd9[_0xbdcf('0x65')])['toString']();return db[_0xbdcf('0x69')][_0xbdcf('0x58')](_0x21fc74)[_0xbdcf('0x63')](function(_0x45eac6){_0x20c690({'ret':0x1});})['catch'](function(_0x2d8d48){logger[_0xbdcf('0x5a')](_0x2d8d48[_0xbdcf('0x56')]);_0x29465({'ret':0x1});});}});}function handleTZQuery(_0x1c1f9e){logger['info'](_0x1c1f9e);return db[_0xbdcf('0x69')][_0xbdcf('0x58')](_0x1c1f9e)[_0xbdcf('0x63')](function(_0x1b7dc5){})[_0xbdcf('0x59')](function(_0x5bf211){logger['error'](_0x5bf211[_0xbdcf('0x56')]);});}function main(_0x4e6ccf,_0x447cc3,_0x184ec0,_0x506ae6){logger['info'](_0xbdcf('0x6a'),_0x4e6ccf,JSON[_0xbdcf('0x6b')](_0x447cc3));process[_0xbdcf('0x6c')]('start');var _0x32f026=_0x447cc3[_0xbdcf('0x6d')];var _0x4ecc5d=_['clone'](_0x32f026);var _0x4c2895=_0x447cc3['socket_timestamp'];var _0x526e0c=path[_0xbdcf('0x37')](config['root'],_0xbdcf('0x6e'),_0x4c2895+_0xbdcf('0x6f'));hasTZ=_[_0xbdcf('0x50')](_0x32f026)['includes'](_0xbdcf('0x65'));var _0x31206e=_[_0xbdcf('0x50')](_0x32f026)[_0xbdcf('0x37')]();logger[_0xbdcf('0x55')](_0xbdcf('0x70'),_0x31206e);db['ContactItemType'][_0xbdcf('0x19')]({'raw':!![],'attributes':['id','name']})[_0xbdcf('0x1b')](function(_0x511cf6){for(var _0x50cc8c=0x0;_0x50cc8c<_0x511cf6['length'];_0x50cc8c++){if(_0x511cf6[_0x50cc8c][_0xbdcf('0x71')]in _0x32f026){contactItemTypes[_0xbdcf('0x1c')](_0x511cf6[_0x50cc8c]);delete _0x4ecc5d[_0x511cf6[_0x50cc8c]['name']];hasAdditionalPhones=!![];}for(var _0x563729 in _0x32f026){if(_0x511cf6[_0x50cc8c]['name']+_0xbdcf('0x72')===_0x563729){phoneDescriptions[_0xbdcf('0x1c')]({'itemTypeId':_0x511cf6[_0x50cc8c]['id'],'description':_0x563729});delete _0x4ecc5d[_0x563729];}}}if(hasAdditionalPhones)_0x4ecc5d['AdditionalPhones']='';var _0x276b4e=_[_0xbdcf('0x50')](_0x4ecc5d)[_0xbdcf('0x37')]();logger['info'](_0xbdcf('0x70'),_0x276b4e);fs[_0xbdcf('0x73')](_0x526e0c,_0x276b4e+'\x0a');Papa['parse'](fs[_0xbdcf('0x74')](_0x4e6ccf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x34897b,_0x5e3e31){try{for(var _0x2aef42=0x0,_0x6004f0=[];_0x2aef42<_0x34897b[_0xbdcf('0x75')]['length'];_0x2aef42++){stats[_0xbdcf('0x76')]+=0x1;if(_0x34897b['errors'][_0x2aef42]){handleError(_0x34897b[_0xbdcf('0x75')][_0x2aef42],_0x34897b[_0xbdcf('0x77')][_0x2aef42]);}else{var _0x52e7ee=[];var _0x292a1d=[];var _0x18399e={};for(var _0x3e5c33 in _0x32f026){let _0x1474b2=contactItemTypes[_0xbdcf('0x78')](_0x43a8c=>_0x43a8c[_0xbdcf('0x71')]===_0x3e5c33);let _0x3169a4=contactItemTypes[_0xbdcf('0x78')](_0x107af0=>_0x107af0[_0xbdcf('0x71')]+_0xbdcf('0x72')===_0x3e5c33);if(_[_0xbdcf('0x20')](_0x1474b2)&&_['isNil'](_0x3169a4)){if(_0x32f026[_0xbdcf('0x79')](_0x3e5c33)){if(_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x3e5c33]]){var _0x1d633=_['trim'](_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x3e5c33]][_0xbdcf('0x7a')](/"/g,'\x27'));switch(_0x3e5c33){case'scheduledat':var _0x75e5c2=moment(_0x1d633,_0xbdcf('0x10'),!![]);if(_0x75e5c2[_0xbdcf('0x7b')]()){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x7c'));}break;case _0xbdcf('0x48'):var _0x1af364=parseInt(_0x1d633);_0x1d633=_[_0xbdcf('0x7d')](_0x1af364)||_0x1af364<0x0||_0x1af364>0x4?_0x506ae6?0x3:0x2:_0x1af364;_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');break;case _0xbdcf('0x34'):var _0x513511=parseInt(_0x1d633);if(_[_0xbdcf('0x7e')](_0x513511)&&_[_0xbdcf('0x7f')](_0x184ec0,_0x513511)){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x513511+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x80'));}break;case _0xbdcf('0x81'):if(isEmail(_0x1d633)){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x82'));}break;case _0xbdcf('0x83'):var _0x106e88=moment(_0x1d633,_0xbdcf('0x84'),!![]);if(_0x106e88[_0xbdcf('0x7b')]()){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x85'));}break;case _0xbdcf('0x65'):var _0x5e7b8e=shared['timezones'];var _0x5f165e=_0x5e7b8e[_0x1d633];if(!_[_0xbdcf('0x20')](_0x5f165e)){var _0xad4d7d=_0x5f165e['utcOffset'];_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0xad4d7d+'\x22');}break;default:_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}}else{switch(_0x3e5c33){case _0xbdcf('0x86'):case'phone':_0x52e7ee[_0xbdcf('0x1c')](_0x3e5c33+_0xbdcf('0x87'));break;default:_0x6004f0['push']('\x22\x22');}}}}else{var _0x453eaa='';if(!_[_0xbdcf('0x20')](_0x1474b2)){if(!_0x18399e['hasOwnProperty'](_0x1474b2['id'])){if(!_[_0xbdcf('0x20')](_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x3e5c33]])){var _0x1d633=_[_0xbdcf('0x88')](_0x34897b['data'][_0x2aef42][_0x32f026[_0x3e5c33]][_0xbdcf('0x7a')](/"/g,'\x27'));var _0x4f0f15=phoneDescriptions[_0xbdcf('0x78')](_0x17c83d=>_0x17c83d['itemTypeId']===_0x1474b2['id']);if(!_[_0xbdcf('0x20')](_0x4f0f15)){var _0x14f435=_[_0xbdcf('0x88')](_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x4f0f15['description']]][_0xbdcf('0x7a')](/"/g,'\x27'));if(!_[_0xbdcf('0x20')](_0x14f435))_0x1d633=_0x1d633+'§'+_0x14f435;}if(_0x453eaa=='')_0x453eaa=_0x1d633;else _0x453eaa+='|'+_0x1d633;}_0x292a1d['push'](_0x1474b2['id']+':'+_0x453eaa);_0x18399e[_0x1474b2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x6004f0['push']('\x22'+_0x292a1d['join'](';')+'\x22');}if(_0x52e7ee[_0xbdcf('0x1e')]){handleError(_0x34897b['data'][_0x2aef42],{'code':_0xbdcf('0x89'),'message':_0x52e7ee[_0xbdcf('0x37')]()});}else{fs['appendFileSync'](_0x526e0c,_0x6004f0['join']()+'\x0a');}_0x6004f0=[];}if(!(stats[_0xbdcf('0x76')]%0xc8)){socket['emit'](_0xbdcf('0x8a')+_0x4c2895,stats);stats['errors']=[];}}if(stopped){logger[_0xbdcf('0x55')](_0xbdcf('0x8b'));_0x5e3e31[_0xbdcf('0x8c')]();}}catch(_0x2c8c16){handleError(_0x34897b[_0xbdcf('0x75')][_0x2aef42],{'code':_0xbdcf('0x8d'),'message':_0x2c8c16['message']});logger[_0xbdcf('0x5a')](_0xbdcf('0x8e'),_0x2c8c16[_0xbdcf('0x56')]);}},'complete':function(){try{var _0x220b9f=[];var _0x26e9e2=[];var _0x336e47=_0xbdcf('0x38');if(_0x447cc3[_0xbdcf('0x8f')]&&_0x447cc3[_0xbdcf('0x8f')][_0xbdcf('0x1e')]){_0x336e47=_0xbdcf('0x90')+_0x4c2895;_0x220b9f['push'](_0xbdcf('0x91')+_0x336e47+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xbdcf('0x92')+_0x4c2895;tmp_voice_queues=_0xbdcf('0x93')+_0x4c2895;_0x26e9e2[_0xbdcf('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x26e9e2[_0xbdcf('0x1c')](_0xbdcf('0x91')+tmp_voice_queues+_0xbdcf('0x94'));BPromise[_0xbdcf('0x95')](_0x26e9e2,handleTZQuery)[_0xbdcf('0x1b')](function(_0x290e56){updateTzCampaigns(_0x447cc3[_0xbdcf('0x31')])['then'](function(_0x1241c9){updateTzVoiceQueues(_0x447cc3[_0xbdcf('0x31')])[_0xbdcf('0x1b')](function(_0x210168){if(hasTZ)_0x276b4e=_0x276b4e[_0xbdcf('0x7a')](_0xbdcf('0x65'),_0xbdcf('0x96'));var _0x5538fe=util['format']('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',_0x526e0c,_0x336e47,_0x276b4e,_0x447cc3['ListId'],_0x447cc3['CompanyId']||null,NOW,NOW);if(_[_0xbdcf('0x20')](_0x32f026[_0xbdcf('0x47')])){_0x5538fe+=_0xbdcf('0x97');}_0x220b9f[_0xbdcf('0x1c')](_0x5538fe);if(_0x447cc3[_0xbdcf('0x8f')]&&_0x447cc3[_0xbdcf('0x8f')][_0xbdcf('0x1e')]){_0x220b9f[_0xbdcf('0x1c')](insertCmContact(_0x447cc3[_0xbdcf('0x31')],_0x336e47,_0x447cc3[_0xbdcf('0x8f')],_0x32f026));_0x220b9f[_0xbdcf('0x1c')](_0xbdcf('0x98')+_0x336e47+';');}BPromise[_0xbdcf('0x95')](_0x220b9f,handleQuery)[_0xbdcf('0x1b')](function(_0x2c185c){BPromise[_0xbdcf('0x1d')]([handleAdditionalPhones()])[_0xbdcf('0x1b')](function(){_0x220b9f=[];for(var _0x1852cb=0x0;_0x1852cb\x20\x20');}var _0x221502=path[_0xbdcf('0x37')](config[_0xbdcf('0xa7')],_0xbdcf('0x6e'),process[_0xbdcf('0xa6')][0x2]);if(!fs[_0xbdcf('0xa8')](_0x221502)){throw new Error(_0xbdcf('0xa9'));}var _0x25983e={};try{_0x25983e=JSON[_0xbdcf('0xaa')](process['argv'][0x3]);if(!_0x25983e[_0xbdcf('0x6d')]){throw new Error(_0xbdcf('0xab'));}if(!_0x25983e[_0xbdcf('0x6d')][_0xbdcf('0x13')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x25983e[_0xbdcf('0x6d')][_0xbdcf('0x86')]){throw new Error(_0xbdcf('0xac'));}var _0x3baf7b=0x0;if(_0x25983e[_0xbdcf('0x6d')][_0xbdcf('0x34')]){_0x3baf7b=0x1;}if(!_0x25983e[_0xbdcf('0x31')]){throw new Error(_0xbdcf('0xad'));}}catch(_0x3c0619){throw new Error(_0xbdcf('0xae'));}var _0x3da068=[];try{_0x3da068=_[_0xbdcf('0xaf')](JSON[_0xbdcf('0xaa')](process['argv'][0x4]),'id');}catch(_0x7a6fb2){logger[_0xbdcf('0x55')](_0xbdcf('0xb0'));}main(_0x221502,_0x25983e,_0x3da068,_0x3baf7b);}validate();process['on'](_0xbdcf('0xb1'),handleStop);process['on'](_0xbdcf('0xb2'),handleUncaughtException); \ No newline at end of file +var _0x50e7=['start','clone','socket_timestamp','root','server/files/tmp','includes','header','ContactItemType','name','parse','createReadStream','data','rows','errors','find','_description','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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()','contactId','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','each','affectedRows','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','length','then','push','split','isNil','filter','findOne','update','updated','CmContactHasItem','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','createdAt','updatedAt','priority','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.updatedAt','phone','ContactId','ListId','cm_hopper_black','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','UserId','.CmListId\x20=\x20?','field','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','stringify'];(function(_0x17dc91,_0x315fbf){var _0x35491c=function(_0xf236cb){while(--_0xf236cb){_0x17dc91['push'](_0x17dc91['shift']());}};_0x35491c(++_0x315fbf);}(_0x50e7,0xf3));var _0x750e=function(_0x409b96,_0x1544b4){_0x409b96=_0x409b96-0x0;var _0x13f0b3=_0x50e7[_0x409b96];return _0x13f0b3;};'use strict';var fs=require('fs');var path=require(_0x750e('0x0'));var _=require(_0x750e('0x1'));var Papa=require(_0x750e('0x2'));var util=require(_0x750e('0x3'));var BPromise=require(_0x750e('0x4'));var moment=require(_0x750e('0x5'));var squel=require(_0x750e('0x6'));var Redis=require('ioredis');var db=require(_0x750e('0x7'))['db'];var config=require(_0x750e('0x8'));var shared=require(_0x750e('0x9'));var logger=require(_0x750e('0xa'))('import');config[_0x750e('0xb')]=_['defaults'](config['redis'],{'host':_0x750e('0xc'),'port':0x18eb});var socket=require(_0x750e('0xd'))(new Redis(config[_0x750e('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x750e('0xe')](_0x750e('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x750e('0xf'));function isEmail(_0x265218){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))*$/[_0x750e('0x10')](_0x265218);}function selectNotIn(_0x14e3e9,_0x3399b7,_0x18e4cc,_0x239d1e,_0x5750f2){return squel['select']()['field']('phone')[_0x750e('0x11')](_0x239d1e)[_0x750e('0x12')](_0x3399b7,null,_0x3399b7+'.id\x20=\x20'+_0x239d1e+'.'+_0x18e4cc)[_0x750e('0x13')](_0x239d1e+'.'+_0x18e4cc+_0x750e('0x14')+_0x14e3e9+'.'+_0x18e4cc)[_0x750e('0x13')](_0x3399b7+_0x750e('0x15')+_0x5750f2[_0x750e('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1d332e,_0x2b4ac8){promisesAdditionalPhones=[];return db['CmContact'][_0x750e('0x16')]({'raw':!![],'attributes':['id',_0x750e('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x30a1c4){if(_0x30a1c4!==null){var _0x52ebfa=[];for(var _0x2a89e7=0x0;_0x2a89e7<_0x30a1c4[_0x750e('0x18')];_0x2a89e7++){var _0x1daedc=_0x30a1c4[_0x2a89e7];_0x52ebfa['push'](insertAdditionalPhones(_0x1daedc));}}Promise['all'](_0x52ebfa)[_0x750e('0x19')](function(){_0x1d332e({'val':0x1});});});});}function insertAdditionalPhones(_0x2298fc){return new Promise(function(_0x2c6962,_0x2be4e1){var _0x4c6032=_0x2298fc[_0x750e('0x17')];var _0x41cf75=_0x4c6032['split'](';');var _0x1ef3fd=[];orderBy=0x0;for(var _0x163563=0x0;_0x163563<_0x41cf75[_0x750e('0x18')];_0x163563++){_0x1ef3fd[_0x750e('0x1a')](splitAdditionalPhone(_0x2298fc['id'],_0x41cf75[_0x163563]));}Promise['all'](_0x1ef3fd)['then'](function(){_0x2c6962({'val':_0x41cf75['length']});});});}function splitAdditionalPhone(_0x5bd2c0,_0x477e44){return new Promise(function(_0x13a206,_0x243dd0){var _0x52dc16=_0x477e44[_0x750e('0x1b')](':');var _0x2265ba=_0x52dc16[0x0];var _0x1193c9=_0x52dc16[0x1];if(!_[_0x750e('0x1c')](_0x1193c9)){var _0x3f2e53=_0x1193c9[_0x750e('0x1b')]('|');var _0xbc70e1=[];for(var _0x58a48a=0x0;_0x58a48a<_0x3f2e53['length'];_0x58a48a++){if(_0x3f2e53[_0x58a48a]!==''){var _0xd96037=_[_0x750e('0x1d')](promisesAdditionalPhones,{'contactId':_0x5bd2c0,'phone':_0x3f2e53[_0x58a48a]});if(_0xd96037[_0x750e('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x750e('0x1a')]({'contactId':_0x5bd2c0,'contactTypeId':_0x2265ba,'phone':_0x3f2e53[_0x58a48a],'orderBy':orderBy});}}}_0x13a206({'ok':0x1});}else _0x13a206({'res':0x0});});}function createAdditionalPhone(_0x333da6,_0x39413a,_0x385a55,_0x6dbc46){var _0x4dda80='';var _0x677fa3='';var _0x70218b=_0x385a55['split']('§');_0x4dda80=_0x70218b[0x0];if(_0x70218b['length']==0x2)_0x677fa3=_0x70218b[0x1];return new Promise(function(_0xc1d6e6,_0xb97be2){return db['CmContactHasItem'][_0x750e('0x1e')]({'where':{'CmContactId':_0x333da6,'item':_0x4dda80}})[_0x750e('0x19')](function(_0x355691){if(_0x355691){return db['CmContactHasItem'][_0x750e('0x1f')]({'ItemTypeId':_0x39413a,'description':_0x677fa3,'OrderBy':_0x6dbc46},{'where':{'CmContactId':_0x333da6,'item':_0x4dda80}})[_0x750e('0x19')](function(_0x36fac4){_0xc1d6e6({'res':_0x750e('0x20')});});}else{return db[_0x750e('0x21')]['create']({'CmContactId':_0x333da6,'item':_0x4dda80,'description':_0x677fa3,'ItemTypeId':_0x39413a,'OrderBy':_0x6dbc46,'ItemClass':'PHONE'})[_0x750e('0x19')](function(_0x285a1d){_0xc1d6e6({'res':_0x750e('0x22')});});}});});}function insertCmHopper(_0x3065e7,_0x5a4614,_0x252a47,_0x208b5f,_0x496096){var _0x3d1ae3=[_0x750e('0x23'),_0x750e('0x24'),_0x750e('0x25'),_0x750e('0x26'),_0x5a4614+'.'+_0x208b5f,_0x750e('0x27'),'cm_contacts.updatedAt','cm_contacts.priority',_0x750e('0x28'),'\x22'+_0x496096+'\x22'];return squel[_0x750e('0x29')]()[_0x750e('0x2a')](_0x750e('0x2b'))[_0x750e('0x2c')](['phone',_0x750e('0x2d'),'ContactId','ListId',_0x208b5f,_0x750e('0x2e'),_0x750e('0x2f'),_0x750e('0x30'),'UserId',_0x750e('0x31')],squel[_0x750e('0x32')]()[_0x750e('0x33')](_0x3d1ae3)['from'](_0x5a4614)[_0x750e('0x12')](_0x750e('0x34'),null,_0x750e('0x35')+_0x5a4614+_0x750e('0x36'))[_0x750e('0x12')](_0x252a47,null,_0x252a47+_0x750e('0x37')+_0x5a4614+'.'+_0x208b5f)['where'](_0x5a4614+'.CmListId\x20=\x20?',_0x3065e7)[_0x750e('0x13')](_0x750e('0x38'),NOW)[_0x750e('0x13')](_0x750e('0x39'),selectNotIn(_0x5a4614,_0x252a47,_0x208b5f,_0x750e('0x2b'),[_0x750e('0x3a'),'\x22onlyIfOpen\x22']))[_0x750e('0x13')](_0x750e('0x39'),selectNotIn(_0x5a4614,_0x252a47,_0x208b5f,_0x750e('0x2b'),[_0x750e('0x3a')])))[_0x750e('0x3b')]();}function insertCmHopperBlack(_0x15a39e,_0xbc8bf8,_0x4a5515,_0x52f595){var _0x2d58c5=[_0x750e('0x23'),_0x750e('0x25'),_0x750e('0x26'),_0xbc8bf8+'.'+_0x52f595,_0x750e('0x27'),_0x750e('0x3c')];return squel[_0x750e('0x29')]()[_0x750e('0x2a')]('cm_hopper_black')[_0x750e('0x2c')]([_0x750e('0x3d'),_0x750e('0x3e'),_0x750e('0x3f'),_0x52f595,_0x750e('0x2e'),'updatedAt'],squel['select']()[_0x750e('0x33')](_0x2d58c5)[_0x750e('0x11')](_0xbc8bf8)[_0x750e('0x12')](_0x750e('0x34'),null,_0x750e('0x35')+_0xbc8bf8+_0x750e('0x36'))[_0x750e('0x12')](_0x4a5515,null,_0x4a5515+_0x750e('0x37')+_0xbc8bf8+'.'+_0x52f595)[_0x750e('0x13')](_0xbc8bf8+'.CmListId\x20=\x20?',_0x15a39e)[_0x750e('0x13')](_0x750e('0x38'),NOW)[_0x750e('0x13')](_0x750e('0x39'),squel[_0x750e('0x32')]()['field'](_0x750e('0x3d'))[_0x750e('0x11')](_0x750e('0x40'))[_0x750e('0x13')](_0x750e('0x41'),_0x15a39e)[_0x750e('0x13')](_0x52f595+_0x750e('0x14')+_0xbc8bf8+'.'+_0x52f595)))['toString']();}function insertTzCmHopper(_0xeb7545,_0x1f3d8d,_0x2b70f5,_0x4e9c18,_0x3fa0c8,_0x5e7097){var _0x5ddca3=[_0x750e('0x23'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x5e7097+_0x750e('0x42'),'cm_contacts.id',_0x750e('0x26'),_0x1f3d8d+'.'+_0x4e9c18,'cm_contacts.createdAt',_0x750e('0x3c'),_0x750e('0x43'),_0x750e('0x28'),'\x22'+_0x3fa0c8+'\x22'];var _0x26d471=squel[_0x750e('0x29')]()[_0x750e('0x2a')](_0x750e('0x2b'))[_0x750e('0x2c')]([_0x750e('0x3d'),_0x750e('0x2d'),_0x750e('0x3e'),_0x750e('0x3f'),_0x4e9c18,_0x750e('0x2e'),_0x750e('0x2f'),_0x750e('0x30'),_0x750e('0x44'),_0x750e('0x31')],squel[_0x750e('0x32')]()[_0x750e('0x33')](_0x5ddca3)[_0x750e('0x11')](_0x1f3d8d)[_0x750e('0x12')]('cm_contacts',null,_0x750e('0x35')+_0x1f3d8d+_0x750e('0x36'))[_0x750e('0x12')](_0x2b70f5,null,_0x2b70f5+_0x750e('0x37')+_0x1f3d8d+'.'+_0x4e9c18)['join'](_0x5e7097,null,_0x5e7097+_0x750e('0x37')+_0x1f3d8d+'.'+_0x4e9c18)['where'](_0x1f3d8d+_0x750e('0x45'),_0xeb7545)[_0x750e('0x13')](_0x750e('0x38'),NOW)[_0x750e('0x13')](_0x750e('0x39'),selectNotIn(_0x1f3d8d,_0x2b70f5,_0x4e9c18,_0x750e('0x2b'),['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0x750e('0x39'),selectNotIn(_0x1f3d8d,_0x2b70f5,_0x4e9c18,_0x750e('0x2b'),[_0x750e('0x3a')])))['toString']();return _0x26d471;}function insertTzCmHopperBlack(_0x1ab5a2,_0xe55209,_0x4c5022,_0x3f22b3){var _0x362541=[_0x750e('0x23'),_0x750e('0x25'),'cm_contacts.ListId',_0xe55209+'.'+_0x3f22b3,'cm_contacts.createdAt',_0x750e('0x3c')];return squel['insert']()['into'](_0x750e('0x40'))[_0x750e('0x2c')](['phone',_0x750e('0x3e'),_0x750e('0x3f'),_0x3f22b3,_0x750e('0x2e'),_0x750e('0x2f')],squel[_0x750e('0x32')]()[_0x750e('0x33')](_0x362541)[_0x750e('0x11')](_0xe55209)[_0x750e('0x12')](_0x750e('0x34'),null,_0x750e('0x35')+_0xe55209+_0x750e('0x36'))[_0x750e('0x12')](_0x4c5022,null,_0x4c5022+'.id\x20=\x20'+_0xe55209+'.'+_0x3f22b3)[_0x750e('0x13')](_0xe55209+_0x750e('0x45'),_0x1ab5a2)[_0x750e('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x750e('0x13')](_0x750e('0x39'),squel[_0x750e('0x32')]()[_0x750e('0x46')](_0x750e('0x3d'))[_0x750e('0x11')](_0x750e('0x40'))[_0x750e('0x13')](_0x750e('0x41'),_0x1ab5a2)[_0x750e('0x13')](_0x3f22b3+'\x20=\x20'+_0xe55209+'.'+_0x3f22b3)))[_0x750e('0x3b')]();}function insertCmHopperAdditionalPhones(_0x5e1da8){var _0x3983fd=[_0x750e('0x47'),_0x750e('0x48'),_0x750e('0x49'),_0x750e('0x4a'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x750e('0x2a')](_0x750e('0x4b'))[_0x750e('0x2c')](['CmHopperId','phone',_0x750e('0x4c'),_0x750e('0x2e'),_0x750e('0x2f')],squel[_0x750e('0x32')]()[_0x750e('0x33')](_0x3983fd)['from'](_0x750e('0x2b'))[_0x750e('0x12')]('cm_contacts',null,_0x750e('0x4d'))[_0x750e('0x12')](_0x750e('0x4e'),null,_0x750e('0x4f'))[_0x750e('0x13')](_0x750e('0x50'),_0x5e1da8)[_0x750e('0x13')](_0x750e('0x38'),NOW))['toString']();}function insertCmContact(_0x6293b8,_0x2cfe61,_0x5d4a16,_0x5efaba){var _0x2c7c2b=_[_0x750e('0x51')](_[_0x750e('0x52')](_0x5efaba),[_0x750e('0x3f'),'CompanyId',_0x750e('0x2e'),_0x750e('0x2f'),_0x750e('0x53')]);return squel[_0x750e('0x29')]()['into'](_0x750e('0x34'))[_0x750e('0x2c')](_0x2c7c2b,squel[_0x750e('0x32')]()['fields'](_0x2c7c2b)[_0x750e('0x11')](_0x2cfe61)['where']('('+_0x5d4a16['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x750e('0x32')]()[_0x750e('0x33')](_0x5d4a16)['from'](_0x750e('0x34'))['where'](_0x750e('0x41'),_0x6293b8)[_0x750e('0x13')](_0x750e('0x54')))[_0x750e('0x13')](_0x750e('0x55'),squel[_0x750e('0x32')]()['field'](_0x750e('0x56'),_0x750e('0x57'))['from'](_0x2cfe61)[_0x750e('0x58')](_0x5d4a16[_0x750e('0x12')](','))))[_0x750e('0x3b')]();}function handleStop(){logger[_0x750e('0x59')](_0x750e('0x5a'));stopped=!![];}function handleUncaughtException(_0x26c0f1){logger[_0x750e('0x5b')](_0x26c0f1[_0x750e('0x5c')]);process[_0x750e('0x5d')](0x1);}function handleError(_0x1ea7f5,_0x1ad378){stats['errors'][_0x750e('0x1a')]({'name':_0x1ad378[_0x750e('0x5e')],'message':_0x1ad378[_0x750e('0x5c')],'row':_0x1ea7f5});}function handleQuery(_0x1a02c6){logger['info'](_0x1a02c6);return db[_0x750e('0x5f')][_0x750e('0x60')](_0x1a02c6)[_0x750e('0x61')](function(_0xfeb596){results['push'](_0xfeb596);})[_0x750e('0x62')](function(_0x18ba19){logger[_0x750e('0x5b')](_0x18ba19[_0x750e('0x5c')]);});}function updateTzCampaigns(_0x2463c9){return new Promise(function(_0x106bca,_0x1c3973){var _0x3843bb=squel['select']()[_0x750e('0x33')]([_0x750e('0x63'),_0x750e('0x64')])[_0x750e('0x11')](_0x750e('0x65'))[_0x750e('0x12')](_0x750e('0x66'),null,_0x750e('0x67'))[_0x750e('0x13')](_0x750e('0x68')+_0x2463c9);db[_0x750e('0x5f')]['query'](_0x3843bb[_0x750e('0x3b')]())[_0x750e('0x61')](function(_0x564279){var _0x166b1c=[];for(var _0x13f2ab=0x0;_0x13f2ab<_0x564279[_0x750e('0x18')];_0x13f2ab++){_0x166b1c[_0x750e('0x1a')](getTimezoneData(_0x564279[_0x13f2ab],tmp_campaigns));}BPromise[_0x750e('0x69')](_0x166b1c)[_0x750e('0x19')](function(){_0x106bca({'val':0x1});});})['catch'](function(_0x57cafd){logger[_0x750e('0x5b')](_0x57cafd[_0x750e('0x5c')]);_0x106bca({'val':0x0});});});}function updateTzVoiceQueues(_0x271ecb){return new Promise(function(_0x174bcc,_0x5bcf22){var _0xd7ef94=squel['select']()[_0x750e('0x33')]([_0x750e('0x6a'),_0x750e('0x6b')])['from'](_0x750e('0x6c'))['join'](_0x750e('0x6d'),null,_0x750e('0x6e'))[_0x750e('0x13')](_0x750e('0x6f')+_0x271ecb);db[_0x750e('0x5f')]['query'](_0xd7ef94[_0x750e('0x3b')]())[_0x750e('0x61')](function(_0x552900){var _0x4aabf2=[];for(var _0xdc91b8=0x0;_0xdc91b8<_0x552900[_0x750e('0x18')];_0xdc91b8++){_0x4aabf2['push'](getTimezoneData(_0x552900[_0xdc91b8],tmp_voice_queues));}BPromise[_0x750e('0x69')](_0x4aabf2)[_0x750e('0x19')](function(){_0x174bcc({'val':0x1});});})['catch'](function(_0x1cdd84){logger[_0x750e('0x5b')](_0x1cdd84['message']);_0x174bcc({'val':0x0});});});}function getTimezoneData(_0x3eae34,_0x1f501e){return new Promise(function(_0x3f5de1,_0x2d6d7f){var _0x2dee5e=shared[_0x750e('0x70')];var _0x2bf1db=_0x2dee5e[_0x3eae34[_0x750e('0x71')]];if(_[_0x750e('0x1c')](_0x2bf1db)){_0x3f5de1({'ret':0x1});}else{var _0x1f727f=_0x2bf1db[_0x750e('0x72')];var _0x2d1eef=squel[_0x750e('0x29')]()[_0x750e('0x2a')](_0x1f501e)[_0x750e('0x73')]('id',_0x3eae34['id'])[_0x750e('0x73')](_0x750e('0x74'),_0x1f727f)[_0x750e('0x73')](_0x750e('0x71'),_0x3eae34[_0x750e('0x71')])[_0x750e('0x3b')]();return db[_0x750e('0x5f')][_0x750e('0x60')](_0x2d1eef)[_0x750e('0x61')](function(_0x2479d6){_0x3f5de1({'ret':0x1});})['catch'](function(_0x2ea19a){logger['error'](_0x2ea19a[_0x750e('0x5c')]);_0x2d6d7f({'ret':0x1});});}});}function handleTZQuery(_0x1a3bec){logger[_0x750e('0x59')](_0x1a3bec);return db['sequelize'][_0x750e('0x60')](_0x1a3bec)[_0x750e('0x61')](function(_0x514c5f){})[_0x750e('0x62')](function(_0xcdb173){logger['error'](_0xcdb173[_0x750e('0x5c')]);});}function main(_0x12167d,_0x37d0d2,_0xe79b1c,_0xb9d894){logger[_0x750e('0x59')](_0x750e('0x75'),_0x12167d,JSON[_0x750e('0x76')](_0x37d0d2));process['send'](_0x750e('0x77'));var _0x124e3d=_0x37d0d2['binding'];var _0x1454ba=_[_0x750e('0x78')](_0x124e3d);var _0x223863=_0x37d0d2[_0x750e('0x79')];var _0x5753dc=path['join'](config[_0x750e('0x7a')],_0x750e('0x7b'),_0x223863+'.csv');hasTZ=_['keys'](_0x124e3d)[_0x750e('0x7c')]('dialTimezone');var _0x22e01d=_[_0x750e('0x52')](_0x124e3d)[_0x750e('0x12')]();logger[_0x750e('0x59')](_0x750e('0x7d'),_0x22e01d);db[_0x750e('0x7e')][_0x750e('0x16')]({'raw':!![],'attributes':['id',_0x750e('0x7f')]})[_0x750e('0x19')](function(_0x11b8aa){for(var _0x3125a5=0x0;_0x3125a5<_0x11b8aa[_0x750e('0x18')];_0x3125a5++){if(_0x11b8aa[_0x3125a5][_0x750e('0x7f')]in _0x124e3d){contactItemTypes[_0x750e('0x1a')](_0x11b8aa[_0x3125a5]);delete _0x1454ba[_0x11b8aa[_0x3125a5][_0x750e('0x7f')]];hasAdditionalPhones=!![];}for(var _0x38b8da in _0x124e3d){if(_0x11b8aa[_0x3125a5]['name']+'_description'===_0x38b8da){phoneDescriptions[_0x750e('0x1a')]({'itemTypeId':_0x11b8aa[_0x3125a5]['id'],'description':_0x38b8da});delete _0x1454ba[_0x38b8da];}}}if(hasAdditionalPhones)_0x1454ba['AdditionalPhones']='';var _0x87cd5c=_['keys'](_0x1454ba)[_0x750e('0x12')]();logger[_0x750e('0x59')]('header',_0x87cd5c);fs['writeFileSync'](_0x5753dc,_0x87cd5c+'\x0a');Papa[_0x750e('0x80')](fs[_0x750e('0x81')](_0x12167d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3f56cc,_0x23a718){try{for(var _0x3854d2=0x0,_0x4cca17=[];_0x3854d2<_0x3f56cc[_0x750e('0x82')]['length'];_0x3854d2++){stats[_0x750e('0x83')]+=0x1;if(_0x3f56cc[_0x750e('0x84')][_0x3854d2]){handleError(_0x3f56cc[_0x750e('0x82')][_0x3854d2],_0x3f56cc[_0x750e('0x84')][_0x3854d2]);}else{var _0x30edfb=[];var _0x14188a=[];var _0x1a03ff={};for(var _0x81c318 in _0x124e3d){let _0x699021=contactItemTypes[_0x750e('0x85')](_0x40125f=>_0x40125f[_0x750e('0x7f')]===_0x81c318);let _0x50fc95=contactItemTypes[_0x750e('0x85')](_0x3e1f8a=>_0x3e1f8a[_0x750e('0x7f')]+_0x750e('0x86')===_0x81c318);if(_[_0x750e('0x1c')](_0x699021)&&_['isNil'](_0x50fc95)){if(_0x124e3d[_0x750e('0x87')](_0x81c318)){if(_0x3f56cc[_0x750e('0x82')][_0x3854d2][_0x124e3d[_0x81c318]]){var _0x327fea=_[_0x750e('0x88')](_0x3f56cc['data'][_0x3854d2][_0x124e3d[_0x81c318]][_0x750e('0x89')](/"/g,'\x27'));switch(_0x81c318){case _0x750e('0x2d'):var _0x1a87f0=moment(_0x327fea,_0x750e('0xf'),!![]);if(_0x1a87f0[_0x750e('0x8a')]()){_0x4cca17[_0x750e('0x1a')]('\x22'+_0x327fea+'\x22');}else{_0x30edfb[_0x750e('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x750e('0x30'):var _0x29dcf5=parseInt(_0x327fea);_0x327fea=_[_0x750e('0x8b')](_0x29dcf5)||_0x29dcf5<0x0||_0x29dcf5>0x4?_0xb9d894?0x3:0x2:_0x29dcf5;_0x4cca17[_0x750e('0x1a')]('\x22'+_0x327fea+'\x22');break;case'UserId':var _0xccc114=parseInt(_0x327fea);if(_[_0x750e('0x8c')](_0xccc114)&&_[_0x750e('0x7c')](_0xe79b1c,_0xccc114)){_0x4cca17[_0x750e('0x1a')]('\x22'+_0xccc114+'\x22');}else{_0x30edfb[_0x750e('0x1a')](_0x750e('0x8d'));}break;case _0x750e('0x8e'):if(isEmail(_0x327fea)){_0x4cca17['push']('\x22'+_0x327fea+'\x22');}else{_0x30edfb['push']('email\x20wrong\x20format');}break;case _0x750e('0x8f'):var _0x36ad97=moment(_0x327fea,_0x750e('0x90'),!![]);if(_0x36ad97['isValid']()){_0x4cca17[_0x750e('0x1a')]('\x22'+_0x327fea+'\x22');}else{_0x30edfb[_0x750e('0x1a')](_0x750e('0x91'));}break;case _0x750e('0x71'):var _0x2ced87=shared[_0x750e('0x70')];var _0x8fa118=_0x2ced87[_0x327fea];if(!_['isNil'](_0x8fa118)){var _0x4dba8c=_0x8fa118[_0x750e('0x72')];_0x4cca17[_0x750e('0x1a')]('\x22'+_0x327fea+'\x22');_0x4cca17[_0x750e('0x1a')]('\x22'+_0x4dba8c+'\x22');}break;default:_0x4cca17['push']('\x22'+_0x327fea+'\x22');}}else{switch(_0x81c318){case _0x750e('0x92'):case'phone':_0x30edfb[_0x750e('0x1a')](_0x81c318+_0x750e('0x93'));break;default:_0x4cca17[_0x750e('0x1a')]('\x22\x22');}}}}else{var _0x369e02='';if(!_[_0x750e('0x1c')](_0x699021)){if(!_0x1a03ff[_0x750e('0x87')](_0x699021['id'])){if(!_[_0x750e('0x1c')](_0x3f56cc['data'][_0x3854d2][_0x124e3d[_0x81c318]])){var _0x327fea=_[_0x750e('0x88')](_0x3f56cc['data'][_0x3854d2][_0x124e3d[_0x81c318]][_0x750e('0x89')](/"/g,'\x27'));var _0x3898a3=phoneDescriptions['find'](_0x592b84=>_0x592b84[_0x750e('0x94')]===_0x699021['id']);if(!_[_0x750e('0x1c')](_0x3898a3)){var _0x2c911c=_[_0x750e('0x88')](_0x3f56cc[_0x750e('0x82')][_0x3854d2][_0x124e3d[_0x3898a3['description']]][_0x750e('0x89')](/"/g,'\x27'));if(!_[_0x750e('0x1c')](_0x2c911c))_0x327fea=_0x327fea+'§'+_0x2c911c;}if(_0x369e02=='')_0x369e02=_0x327fea;else _0x369e02+='|'+_0x327fea;}_0x14188a[_0x750e('0x1a')](_0x699021['id']+':'+_0x369e02);_0x1a03ff[_0x699021['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4cca17[_0x750e('0x1a')]('\x22'+_0x14188a[_0x750e('0x12')](';')+'\x22');}if(_0x30edfb['length']){handleError(_0x3f56cc[_0x750e('0x82')][_0x3854d2],{'code':_0x750e('0x95'),'message':_0x30edfb[_0x750e('0x12')]()});}else{fs[_0x750e('0x96')](_0x5753dc,_0x4cca17[_0x750e('0x12')]()+'\x0a');}_0x4cca17=[];}if(!(stats[_0x750e('0x83')]%0xc8)){socket[_0x750e('0x97')](_0x750e('0x98')+_0x223863,stats);stats[_0x750e('0x84')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x23a718[_0x750e('0x99')]();}}catch(_0x52875d){handleError(_0x3f56cc[_0x750e('0x82')][_0x3854d2],{'code':'SystemError','message':_0x52875d['message']});logger[_0x750e('0x5b')]('step',_0x52875d[_0x750e('0x5c')]);}},'complete':function(){try{var _0x4b4803=[];var _0x28b868=[];var _0x2c6cd3=_0x750e('0x34');if(_0x37d0d2[_0x750e('0x9a')]&&_0x37d0d2[_0x750e('0x9a')][_0x750e('0x18')]){_0x2c6cd3=_0x750e('0x9b')+_0x223863;_0x4b4803[_0x750e('0x1a')](_0x750e('0x9c')+_0x2c6cd3+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x223863;tmp_voice_queues=_0x750e('0x9d')+_0x223863;_0x28b868[_0x750e('0x1a')](_0x750e('0x9c')+tmp_campaigns+_0x750e('0x9e'));_0x28b868['push'](_0x750e('0x9c')+tmp_voice_queues+_0x750e('0x9e'));BPromise['each'](_0x28b868,handleTZQuery)[_0x750e('0x19')](function(_0xdfd5a8){updateTzCampaigns(_0x37d0d2[_0x750e('0x3f')])[_0x750e('0x19')](function(_0xcbe1a1){updateTzVoiceQueues(_0x37d0d2[_0x750e('0x3f')])[_0x750e('0x19')](function(_0x31524a){if(hasTZ)_0x87cd5c=_0x87cd5c['replace'](_0x750e('0x71'),'dialTimezone,utcOffset');var _0x52fda1=util[_0x750e('0xe')](_0x750e('0x9f'),_0x5753dc,_0x2c6cd3,_0x87cd5c,_0x37d0d2[_0x750e('0x3f')],_0x37d0d2[_0x750e('0xa0')]||null,NOW,NOW);if(_[_0x750e('0x1c')](_0x124e3d[_0x750e('0x2d')])){_0x52fda1+=_0x750e('0xa1');}_0x4b4803[_0x750e('0x1a')](_0x52fda1);if(_0x37d0d2['duplicates']&&_0x37d0d2[_0x750e('0x9a')]['length']){_0x4b4803[_0x750e('0x1a')](insertCmContact(_0x37d0d2[_0x750e('0x3f')],_0x2c6cd3,_0x37d0d2[_0x750e('0x9a')],_0x124e3d));_0x4b4803[_0x750e('0x1a')]('DROP\x20TABLE\x20'+_0x2c6cd3+';');}BPromise['each'](_0x4b4803,handleQuery)['then'](function(_0xecf02f){BPromise[_0x750e('0x69')]([handleAdditionalPhones()])[_0x750e('0x19')](function(){_0x4b4803=[];for(var _0x4bc91f=0x0;_0x4bc91f\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','updated','create','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','createdAt','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','cm_contacts','MIN(id)','min_id','group','Received\x20SIGINT','message','errors','code','info','spread','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','replace'];(function(_0x56f927,_0xdfcfa4){var _0x363231=function(_0x221598){while(--_0x221598){_0x56f927['push'](_0x56f927['shift']());}};_0x363231(++_0xdfcfa4);}(_0x5df3,0x15f));var _0x35df=function(_0x5d3306,_0x6e1379){_0x5d3306=_0x5d3306-0x0;var _0x6968f7=_0x5df3[_0x5d3306];return _0x6968f7;};'use strict';var fs=require('fs');var path=require(_0x35df('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x35df('0x1'));var BPromise=require(_0x35df('0x2'));var moment=require(_0x35df('0x3'));var squel=require(_0x35df('0x4'));var Redis=require(_0x35df('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x35df('0x6'))(_0x35df('0x7'));config[_0x35df('0x8')]=_['defaults'](config[_0x35df('0x8')],{'host':_0x35df('0x9'),'port':0x18eb});var socket=require(_0x35df('0xa'))(new Redis(config[_0x35df('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x35df('0xb')](_0x35df('0xc'));var tempTableName=_0x35df('0xd')+moment()[_0x35df('0xb')](_0x35df('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1654c5){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))*$/[_0x35df('0xf')](_0x1654c5);}function selectNotIn(_0x5f43e6,_0x4ad28f,_0x46efdd,_0x17ae6c,_0xaab2ea){return squel[_0x35df('0x10')]()[_0x35df('0x11')]('phone')[_0x35df('0x12')](_0x17ae6c)[_0x35df('0x13')](_0x4ad28f,null,_0x4ad28f+_0x35df('0x14')+_0x17ae6c+'.'+_0x46efdd)[_0x35df('0x15')](_0x17ae6c+'.'+_0x46efdd+_0x35df('0x16')+_0x5f43e6+'.'+_0x46efdd)[_0x35df('0x15')](_0x4ad28f+_0x35df('0x17')+_0xaab2ea[_0x35df('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x566c11,_0x321f32){promisesAdditionalPhones=[];promisesContact=[];return db[_0x35df('0x18')][_0x35df('0x19')](_0x35df('0x1a')+tempTableName)['spread'](function(_0x5228db){if(_0x5228db!==null){var _0x2e2d7a=[];for(var _0x232889=0x0;_0x232889<_0x5228db[_0x35df('0x1b')];_0x232889++){var _0x1a56b5=_0x5228db[_0x232889];if(!_[_0x35df('0x1c')](_0x1a56b5[_0x35df('0x1d')])){if(!_[_0x35df('0x1c')](_0x1a56b5[_0x35df('0x1e')]))_0x2e2d7a[_0x35df('0x1f')](insertAdditionalPhones(_0x1a56b5));promisesContact[_0x35df('0x1f')]({'contact':_0x1a56b5});}}}Promise[_0x35df('0x20')](_0x2e2d7a)[_0x35df('0x21')](function(){_0x566c11({'val':0x1});});})[_0x35df('0x22')](function(_0x5a445f){logger[_0x35df('0x23')](_0x5a445f['message']);});});}function insertAdditionalPhones(_0x4fd9c7){return new Promise(function(_0x3d7c4c,_0x5000cb){var _0x48727f=_0x4fd9c7[_0x35df('0x1e')];if(_[_0x35df('0x1c')](_0x48727f))_0x5000cb({'val':0x0});else{var _0x3c2dc2=_0x48727f[_0x35df('0x24')](';');var _0x47b575=[];orderBy=0x0;for(var _0x6c0ab0=0x0;_0x6c0ab0<_0x3c2dc2[_0x35df('0x1b')];_0x6c0ab0++){_0x47b575['push'](splitAdditionalPhone(_0x4fd9c7['id'],_0x3c2dc2[_0x6c0ab0]));}Promise[_0x35df('0x20')](_0x47b575)[_0x35df('0x21')](function(){_0x3d7c4c({'val':_0x3c2dc2[_0x35df('0x1b')]});});}});}function splitAdditionalPhone(_0x1546cb,_0x1c5f2a){return new Promise(function(_0x774389,_0x2d1009){var _0x37dd08=_0x1c5f2a[_0x35df('0x24')](':');var _0x24f173=_0x37dd08[0x0];var _0x15a8fd=_0x37dd08[0x1];if(_0x15a8fd!==''){var _0x713be5=_0x15a8fd[_0x35df('0x24')]('|');var _0x3875ae=[];for(var _0x7f9fe3=0x0;_0x7f9fe3<_0x713be5[_0x35df('0x1b')];_0x7f9fe3++){if(_0x713be5[_0x7f9fe3]!==''){var _0x5104f4=_[_0x35df('0x25')](promisesAdditionalPhones,{'contactId':_0x1546cb,'phone':_0x713be5[_0x7f9fe3]});if(_0x5104f4[_0x35df('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x35df('0x1f')]({'contactId':_0x1546cb,'contactTypeId':_0x24f173,'phone':_0x713be5[_0x7f9fe3],'orderBy':orderBy});}}}_0x774389({'ok':0x1});}else _0x774389({'res':0x0});});}function createAdditionalPhone(_0x492829,_0x399000,_0x510862,_0x2012d8){var _0xe285be='';var _0x27ce22='';var _0x553960=_0x510862[_0x35df('0x24')]('§');_0xe285be=_0x553960[0x0];if(_0x553960[_0x35df('0x1b')]==0x2)_0x27ce22=_0x553960[0x1];return new Promise(function(_0x230acf,_0x51cd66){return db[_0x35df('0x26')][_0x35df('0x27')]({'where':{'CmContactId':_0x492829,'item':_0xe285be}})[_0x35df('0x21')](function(_0x4a6673){if(_0x4a6673){return db[_0x35df('0x26')][_0x35df('0x28')]({'ItemTypeId':_0x399000,'description':_0x27ce22,'OrderBy':_0x2012d8},{'where':{'CmContactId':_0x492829,'item':_0xe285be}})[_0x35df('0x21')](function(_0x379040){_0x230acf({'res':_0x35df('0x29')});});}else{return db['CmContactHasItem'][_0x35df('0x2a')]({'CmContactId':_0x492829,'item':_0xe285be,'ItemTypeId':_0x399000,'description':_0x27ce22,'OrderBy':_0x2012d8,'ItemClass':'PHONE'})[_0x35df('0x21')](function(_0x74a9c2){_0x230acf({'res':'inserted'});});}});});}function updateContact(_0x1983df){return new Promise(function(_0x4dd48f,_0x4c204a){var _0x37d6c1=_0x1983df['id'];delete _0x1983df['id'];return db[_0x35df('0x2b')][_0x35df('0x28')](_0x1983df,{'where':{'id':_0x37d6c1}})[_0x35df('0x21')](function(_0x2426bb){updatedRows+=0x1;return db[_0x35df('0x2c')][_0x35df('0x28')]({'phone':_0x1983df[_0x35df('0x1d')]},{'where':{'ContactId':_0x37d6c1}})['then'](function(_0x32fd77){_0x4dd48f({'ret':'OK'});});});});}function insertCmHopper(_0x25c44b,_0x285cce,_0x4f10d1,_0x47e5f3,_0x2059ce){var _0x2d864e=[_0x35df('0x2d'),_0x35df('0x2e'),'cm_contacts.id',_0x35df('0x2f'),_0x285cce+'.'+_0x47e5f3,_0x35df('0x30'),'cm_contacts.updatedAt',_0x35df('0x31'),_0x35df('0x32'),'\x22'+_0x2059ce+'\x22'];return squel[_0x35df('0x33')]()[_0x35df('0x34')](_0x35df('0x35'))[_0x35df('0x36')]([_0x35df('0x1d'),'scheduledat',_0x35df('0x37'),_0x35df('0x38'),_0x47e5f3,'createdAt',_0x35df('0x39'),_0x35df('0x3a'),'UserId',_0x35df('0x3b')],squel['select']()[_0x35df('0x3c')](_0x2d864e)[_0x35df('0x12')](_0x285cce)[_0x35df('0x13')]('cm_contacts',null,_0x35df('0x3d')+_0x285cce+_0x35df('0x3e'))[_0x35df('0x13')](_0x4f10d1,null,_0x4f10d1+_0x35df('0x14')+_0x285cce+'.'+_0x47e5f3)['where'](_0x285cce+'.CmListId\x20=\x20?',_0x25c44b)[_0x35df('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x35df('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x285cce,_0x4f10d1,_0x47e5f3,_0x35df('0x35'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x35df('0x15')](_0x35df('0x3f'),selectNotIn(_0x285cce,_0x4f10d1,_0x47e5f3,_0x35df('0x35'),[_0x35df('0x40')])))[_0x35df('0x41')]();}function insertCmHopperBlack(_0x300cf6,_0x94d005,_0x260201,_0x206366){var _0x43bc57=[_0x35df('0x2d'),'cm_contacts.id','cm_contacts.ListId',_0x94d005+'.'+_0x206366,_0x35df('0x30'),_0x35df('0x42')];return squel[_0x35df('0x33')]()['into'](_0x35df('0x43'))[_0x35df('0x36')]([_0x35df('0x1d'),_0x35df('0x37'),_0x35df('0x38'),_0x206366,_0x35df('0x44'),_0x35df('0x39')],squel['select']()[_0x35df('0x3c')](_0x43bc57)[_0x35df('0x12')](_0x94d005)['join']('cm_contacts',null,_0x35df('0x3d')+_0x94d005+_0x35df('0x3e'))[_0x35df('0x13')](_0x260201,null,_0x260201+_0x35df('0x14')+_0x94d005+'.'+_0x206366)['where'](_0x94d005+'.CmListId\x20=\x20?',_0x300cf6)[_0x35df('0x15')](_0x35df('0x45'),NOW)[_0x35df('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x35df('0x10')]()[_0x35df('0x11')](_0x35df('0x1d'))['from'](_0x35df('0x43'))[_0x35df('0x15')](_0x35df('0x46'),_0x300cf6)[_0x35df('0x15')](_0x206366+_0x35df('0x47'),_0x94d005+'.'+_0x206366)))[_0x35df('0x41')]();}function insertCmHopperAdditionalPhones(_0x460307){var _0x45deac=[_0x35df('0x48'),_0x35df('0x49'),_0x35df('0x4a'),_0x35df('0x4b'),_0x35df('0x4c')];return squel[_0x35df('0x33')]()[_0x35df('0x34')]('cm_hopper_additional_phones')[_0x35df('0x36')]([_0x35df('0x4d'),'phone',_0x35df('0x4e'),'createdAt','updatedAt'],squel[_0x35df('0x10')]()[_0x35df('0x3c')](_0x45deac)[_0x35df('0x12')](_0x35df('0x35'))[_0x35df('0x13')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x35df('0x13')]('cm_contact_has_items',null,_0x35df('0x4f'))[_0x35df('0x15')](_0x35df('0x50'),_0x460307)[_0x35df('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x35df('0x41')]();}function insertCmContact(_0x10c8e9,_0x277ac6,_0x59727c,_0x554188){var _0x4936c0=_['concat'](_[_0x35df('0x51')](_0x554188),[_0x35df('0x38'),'CompanyId','createdAt',_0x35df('0x39')]);return squel[_0x35df('0x33')]()[_0x35df('0x34')](_0x35df('0x52'))[_0x35df('0x36')](_0x4936c0,squel['select']()[_0x35df('0x3c')](_0x4936c0)['from'](_0x277ac6)[_0x35df('0x15')]('('+_0x59727c[_0x35df('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x35df('0x10')]()[_0x35df('0x3c')](_0x59727c)[_0x35df('0x12')](_0x35df('0x52'))[_0x35df('0x15')](_0x35df('0x46'),_0x10c8e9))[_0x35df('0x15')]('id\x20IN\x20?',squel['select']()[_0x35df('0x11')](_0x35df('0x53'),_0x35df('0x54'))[_0x35df('0x12')](_0x277ac6)[_0x35df('0x55')](_0x59727c[_0x35df('0x13')](','))))[_0x35df('0x41')]();}function handleStop(){logger['info'](_0x35df('0x56'));stopped=!![];}function handleUncaughtException(_0x564ad4){logger[_0x35df('0x23')](_0x564ad4[_0x35df('0x57')]);process['exit'](0x1);}function handleError(_0x5a6160,_0x44397c){stats[_0x35df('0x58')]['push']({'name':_0x44397c[_0x35df('0x59')],'message':_0x44397c[_0x35df('0x57')],'row':_0x5a6160});}function handleQuery(_0x152b67){logger[_0x35df('0x5a')](_0x152b67);return db['sequelize'][_0x35df('0x19')](_0x152b67)[_0x35df('0x5b')](function(_0x249a49){results[_0x35df('0x1f')](_0x249a49);})[_0x35df('0x22')](function(_0x19c9d0){logger[_0x35df('0x23')](_0x19c9d0['message']);});}function main(_0x4078e4,_0x275ba2,_0x7cec0c,_0x15cb89){logger[_0x35df('0x5a')](_0x35df('0x5c'),_0x4078e4,JSON[_0x35df('0x5d')](_0x275ba2));process['send'](_0x35df('0x5e'));var _0x3b4305=_0x275ba2['binding'];var _0x4e2799=_[_0x35df('0x5f')](_0x3b4305);var _0x2a6c04=_0x275ba2[_0x35df('0x60')];var _0x1a9b23=path[_0x35df('0x13')](config[_0x35df('0x61')],_0x35df('0x62'),_0x2a6c04+_0x35df('0x63'));logger[_0x35df('0x5a')](_0x35df('0x64'),_0x275ba2);db[_0x35df('0x65')]['findAll']({'raw':!![],'attributes':['id',_0x35df('0x66')]})['then'](function(_0x39858c){for(var _0x5aacb5=0x0;_0x5aacb5<_0x39858c['length'];_0x5aacb5++){if(_0x39858c[_0x5aacb5][_0x35df('0x66')]in _0x3b4305){contactItemTypes[_0x35df('0x1f')](_0x39858c[_0x5aacb5]);delete _0x4e2799[_0x39858c[_0x5aacb5][_0x35df('0x66')]];hasAdditionalPhones=!![];}for(var _0x27ef1c in _0x3b4305){if(_0x39858c[_0x5aacb5]['name']+_0x35df('0x67')===_0x27ef1c){phoneDescriptions[_0x35df('0x1f')]({'itemTypeId':_0x39858c[_0x5aacb5]['id'],'description':_0x27ef1c});delete _0x4e2799[_0x27ef1c];}}}if(hasAdditionalPhones)_0x4e2799[_0x35df('0x1e')]='';var _0x36a8de=_[_0x35df('0x51')](_0x4e2799)['join']();logger[_0x35df('0x5a')](_0x35df('0x68'),_0x36a8de);fs[_0x35df('0x69')](_0x1a9b23,_0x36a8de+'\x0a');Papa[_0x35df('0x6a')](fs[_0x35df('0x6b')](_0x4078e4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30c3d9,_0x2d2014){try{for(var _0x3d18e4=0x0,_0x59f3f1=[];_0x3d18e4<_0x30c3d9[_0x35df('0x6c')][_0x35df('0x1b')];_0x3d18e4++){stats[_0x35df('0x6d')]+=0x1;if(_0x30c3d9[_0x35df('0x58')][_0x3d18e4]){handleError(_0x30c3d9['data'][_0x3d18e4],_0x30c3d9['errors'][_0x3d18e4]);}else{var _0x59cec0=[];var _0x3477ba=[];var _0x3f166d={};for(var _0x553134 in _0x3b4305){let _0x1491c9=contactItemTypes[_0x35df('0x6e')](_0x3bf689=>_0x3bf689[_0x35df('0x66')]===_0x553134);let _0x5769fc=contactItemTypes[_0x35df('0x6e')](_0xc3ac15=>_0xc3ac15['name']+_0x35df('0x67')===_0x553134);if(_[_0x35df('0x1c')](_0x1491c9)&&_['isNil'](_0x5769fc)){if(_0x3b4305[_0x35df('0x6f')](_0x553134)){if(_0x30c3d9[_0x35df('0x6c')][_0x3d18e4][_0x3b4305[_0x553134]]){var _0x182934=_[_0x35df('0x70')](_0x30c3d9[_0x35df('0x6c')][_0x3d18e4][_0x3b4305[_0x553134]]['replace'](/"/g,'\x27'));switch(_0x553134){case _0x35df('0x71'):var _0x10d6aa=moment(_0x182934,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x10d6aa[_0x35df('0x72')]()){_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x182934+'\x22');}else{_0x59cec0[_0x35df('0x1f')](_0x35df('0x73'));}break;case _0x35df('0x3a'):var _0x13ddf0=parseInt(_0x182934);_0x182934=_[_0x35df('0x74')](_0x13ddf0)||_0x13ddf0<0x0||_0x13ddf0>0x4?_0x15cb89?0x3:0x2:_0x13ddf0;_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x182934+'\x22');break;case _0x35df('0x75'):var _0xf80487=parseInt(_0x182934);if(_['isNumber'](_0xf80487)&&_[_0x35df('0x76')](_0x7cec0c,_0xf80487)){_0x59f3f1['push']('\x22'+_0xf80487+'\x22');}else{_0x59cec0['push'](_0x35df('0x77'));}break;case _0x35df('0x78'):if(isEmail(_0x182934)){_0x59f3f1['push']('\x22'+_0x182934+'\x22');}else{_0x59cec0['push']('email\x20wrong\x20format');}break;case _0x35df('0x79'):var _0x16190b=moment(_0x182934,_0x35df('0x7a'),!![]);if(_0x16190b[_0x35df('0x72')]()){_0x59f3f1['push']('\x22'+_0x182934+'\x22');}else{_0x59cec0['push'](_0x35df('0x7b'));}break;default:_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x182934+'\x22');}}else{switch(_0x553134){case _0x35df('0x7c'):case _0x35df('0x1d'):_0x59cec0[_0x35df('0x1f')](_0x553134+_0x35df('0x7d'));break;default:_0x59f3f1[_0x35df('0x1f')]('\x22\x22');}}}}else{var _0x5c0e95='';if(!_[_0x35df('0x1c')](_0x1491c9)){if(!_0x3f166d[_0x35df('0x6f')](_0x1491c9['id'])){for(var _0x37179a=0x0;_0x37179a<_0x3b4305[_0x553134][_0x35df('0x1b')];_0x37179a++){var _0x182934=_[_0x35df('0x70')](_0x30c3d9['data'][_0x3d18e4][_0x3b4305[_0x553134][_0x37179a]]['replace'](/"/g,'\x27'));var _0x4d9a1d=phoneDescriptions[_0x35df('0x6e')](_0x3fd908=>_0x3fd908[_0x35df('0x7e')]===_0x1491c9['id']);if(!_['isNil'](_0x4d9a1d)){var _0x15584c=_[_0x35df('0x70')](_0x30c3d9['data'][_0x3d18e4][_0x3b4305[_0x4d9a1d[_0x35df('0x7f')]][0x0]][_0x35df('0x80')](/"/g,'\x27'));if(!_['isNil'](_0x15584c))_0x182934=_0x182934+'§'+_0x15584c;}if(_0x5c0e95=='')_0x5c0e95=_0x182934;else _0x5c0e95+='|'+_0x182934;}_0x3477ba[_0x35df('0x1f')](_0x1491c9['id']+':'+_0x5c0e95);_0x3f166d[_0x1491c9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x3477ba[_0x35df('0x13')](';')+'\x22');}if(_0x59cec0[_0x35df('0x1b')]){handleError(_0x30c3d9[_0x35df('0x6c')][_0x3d18e4],{'code':_0x35df('0x81'),'message':_0x59cec0[_0x35df('0x13')]()});}else{fs[_0x35df('0x82')](_0x1a9b23,_0x59f3f1[_0x35df('0x13')]()+'\x0a');}_0x59f3f1=[];}if(!(stats[_0x35df('0x6d')]%0xc8)){socket[_0x35df('0x83')](_0x35df('0x84')+_0x2a6c04,stats);stats[_0x35df('0x58')]=[];}}if(stopped){logger[_0x35df('0x5a')](_0x35df('0x85'));_0x2d2014[_0x35df('0x86')]();}}catch(_0x50f9c1){handleError(_0x30c3d9[_0x35df('0x6c')][_0x3d18e4],{'code':'SystemError','message':_0x50f9c1[_0x35df('0x57')]});logger['error'](_0x35df('0x87'),_0x50f9c1['message']);}},'complete':function(){try{var _0x3f7e52=[];var _0x4d2dc8=tempTableName;_0x3f7e52[_0x35df('0x1f')](_0x35df('0x88')+_0x4d2dc8+_0x35df('0x89'));logger[_0x35df('0x5a')](_0x35df('0x8a'),contactItemTypes['length']);var _0x205717=util[_0x35df('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x1a9b23,_0x4d2dc8,_0x36a8de,_0x275ba2[_0x35df('0x38')],_0x275ba2[_0x35df('0x8b')]||null,NOW,NOW);if(_['isNil'](_0x3b4305[_0x35df('0x71')])){_0x205717+=',\x20scheduledAt\x20=\x20NOW()';}_0x3f7e52[_0x35df('0x1f')](_0x205717);BPromise[_0x35df('0x8c')](_0x3f7e52,handleQuery)[_0x35df('0x21')](function(_0x5cc6d6){BPromise[_0x35df('0x20')]([handleAdditionalPhones()])[_0x35df('0x21')](function(){_0x3f7e52=[];for(var _0x46e008=0x0;_0x46e008\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','push','catch','error','message','AdditionalPhones','then','split','filter','CmContactHasItem','findOne','update','updated','create','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','UserId','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','createdAt','cm_contacts','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','spread','main','stringify','start','binding','socket_timestamp','root','.csv','body','ContactItemType','name','header','writeFileSync','parse','createReadStream'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6888,0xd2));var _0x8688=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6888[_0x5d2803];return _0xdcad2c;};'use strict';var fs=require('fs');var path=require(_0x8688('0x0'));var _=require('lodash');var Papa=require(_0x8688('0x1'));var util=require(_0x8688('0x2'));var BPromise=require(_0x8688('0x3'));var moment=require(_0x8688('0x4'));var squel=require(_0x8688('0x5'));var Redis=require(_0x8688('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x8688('0x7'))(_0x8688('0x8'));config[_0x8688('0x9')]=_[_0x8688('0xa')](config[_0x8688('0x9')],{'host':_0x8688('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8688('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x8688('0xc')](_0x8688('0xd'));var tempTableName=_0x8688('0xe')+moment()[_0x8688('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x48758d){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))*$/[_0x8688('0xf')](_0x48758d);}function selectNotIn(_0xad37ed,_0x1fe67f,_0x1d60f6,_0x1847f1,_0x3a7f58){return squel[_0x8688('0x10')]()[_0x8688('0x11')](_0x8688('0x12'))['from'](_0x1847f1)[_0x8688('0x13')](_0x1fe67f,null,_0x1fe67f+_0x8688('0x14')+_0x1847f1+'.'+_0x1d60f6)[_0x8688('0x15')](_0x1847f1+'.'+_0x1d60f6+_0x8688('0x16')+_0xad37ed+'.'+_0x1d60f6)[_0x8688('0x15')](_0x1fe67f+_0x8688('0x17')+_0x3a7f58[_0x8688('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c4e32,_0x1c4e6c){promisesAdditionalPhones=[];promisesContact=[];return db[_0x8688('0x18')][_0x8688('0x19')](_0x8688('0x1a')+tempTableName)['spread'](function(_0x3a1c41){if(_0x3a1c41!==null){var _0x2e2ac8=[];for(var _0x251eab=0x0;_0x251eab<_0x3a1c41[_0x8688('0x1b')];_0x251eab++){var _0x5482d0=_0x3a1c41[_0x251eab];if(!_[_0x8688('0x1c')](_0x5482d0[_0x8688('0x12')])){if(!_['isNil'](_0x5482d0['AdditionalPhones']))_0x2e2ac8[_0x8688('0x1d')](insertAdditionalPhones(_0x5482d0));promisesContact[_0x8688('0x1d')]({'contact':_0x5482d0});}}}Promise['all'](_0x2e2ac8)['then'](function(){_0x1c4e32({'val':0x1});});})[_0x8688('0x1e')](function(_0x1043ad){logger[_0x8688('0x1f')](_0x1043ad[_0x8688('0x20')]);});});}function insertAdditionalPhones(_0x1b0ad1){return new Promise(function(_0x135727,_0x32073e){var _0x10d47b=_0x1b0ad1[_0x8688('0x21')];if(_['isNil'](_0x10d47b))_0x32073e({'val':0x0});else{var _0xa2a92=_0x10d47b['split'](';');var _0x32d195=[];orderBy=0x0;for(var _0x409cc7=0x0;_0x409cc7<_0xa2a92['length'];_0x409cc7++){_0x32d195[_0x8688('0x1d')](splitAdditionalPhone(_0x1b0ad1['id'],_0xa2a92[_0x409cc7]));}Promise['all'](_0x32d195)[_0x8688('0x22')](function(){_0x135727({'val':_0xa2a92[_0x8688('0x1b')]});});}});}function splitAdditionalPhone(_0x44ca43,_0x1da459){return new Promise(function(_0xd59b22,_0x1fac29){var _0x4e113a=_0x1da459[_0x8688('0x23')](':');var _0x4f5bfe=_0x4e113a[0x0];var _0x2a8d9e=_0x4e113a[0x1];if(_0x2a8d9e!==''){var _0x1447d8=_0x2a8d9e[_0x8688('0x23')]('|');var _0x2f2707=[];for(var _0x4d4b9c=0x0;_0x4d4b9c<_0x1447d8[_0x8688('0x1b')];_0x4d4b9c++){if(_0x1447d8[_0x4d4b9c]!==''){var _0x2930cd=_[_0x8688('0x24')](promisesAdditionalPhones,{'contactId':_0x44ca43,'phone':_0x1447d8[_0x4d4b9c]});if(_0x2930cd['length']==0x0){orderBy++;promisesAdditionalPhones[_0x8688('0x1d')]({'contactId':_0x44ca43,'contactTypeId':_0x4f5bfe,'phone':_0x1447d8[_0x4d4b9c],'orderBy':orderBy});}}}_0xd59b22({'ok':0x1});}else _0xd59b22({'res':0x0});});}function createAdditionalPhone(_0x3e15c3,_0x3f28ae,_0x5f4f7b,_0xed6020){var _0x5d249b='';var _0x4ab1fb='';var _0x47b088=_0x5f4f7b[_0x8688('0x23')]('§');_0x5d249b=_0x47b088[0x0];if(_0x47b088[_0x8688('0x1b')]==0x2)_0x4ab1fb=_0x47b088[0x1];return new Promise(function(_0x2a0335,_0x4f9cc2){return db[_0x8688('0x25')][_0x8688('0x26')]({'where':{'CmContactId':_0x3e15c3,'item':_0x5d249b}})[_0x8688('0x22')](function(_0x2fabfa){if(_0x2fabfa){return db[_0x8688('0x25')][_0x8688('0x27')]({'ItemTypeId':_0x3f28ae,'description':_0x4ab1fb,'OrderBy':_0xed6020},{'where':{'CmContactId':_0x3e15c3,'item':_0x5d249b}})[_0x8688('0x22')](function(_0x35f4a6){_0x2a0335({'res':_0x8688('0x28')});});}else{return db[_0x8688('0x25')][_0x8688('0x29')]({'CmContactId':_0x3e15c3,'item':_0x5d249b,'ItemTypeId':_0x3f28ae,'description':_0x4ab1fb,'OrderBy':_0xed6020,'ItemClass':'PHONE'})[_0x8688('0x22')](function(_0x4d8aa6){_0x2a0335({'res':_0x8688('0x2a')});});}});});}function updateContact(_0x287114){return new Promise(function(_0x49afeb,_0x3c9fd7){var _0x2854fc=_0x287114['id'];delete _0x287114['id'];return db['CmContact']['update'](_0x287114,{'where':{'id':_0x2854fc}})[_0x8688('0x22')](function(_0x15ceb6){updatedRows+=0x1;return db[_0x8688('0x2b')]['update']({'phone':_0x287114['phone']},{'where':{'ContactId':_0x2854fc}})[_0x8688('0x22')](function(_0x30c2a5){_0x49afeb({'ret':'OK'});});});});}function insertCmHopper(_0x2c20ab,_0x49775c,_0x50c23c,_0x1c313d,_0x2fd0a3){var _0x41db72=[_0x8688('0x2c'),_0x8688('0x2d'),_0x8688('0x2e'),_0x8688('0x2f'),_0x49775c+'.'+_0x1c313d,'cm_contacts.createdAt',_0x8688('0x30'),_0x8688('0x31'),'cm_contacts.UserId','\x22'+_0x2fd0a3+'\x22'];return squel[_0x8688('0x32')]()[_0x8688('0x33')](_0x8688('0x34'))[_0x8688('0x35')]([_0x8688('0x12'),_0x8688('0x36'),_0x8688('0x37'),_0x8688('0x38'),_0x1c313d,'createdAt',_0x8688('0x39'),'priority',_0x8688('0x3a'),'recallme'],squel[_0x8688('0x10')]()[_0x8688('0x3b')](_0x41db72)[_0x8688('0x3c')](_0x49775c)[_0x8688('0x13')]('cm_contacts',null,_0x8688('0x3d')+_0x49775c+_0x8688('0x3e'))[_0x8688('0x13')](_0x50c23c,null,_0x50c23c+'.id\x20=\x20'+_0x49775c+'.'+_0x1c313d)[_0x8688('0x15')](_0x49775c+_0x8688('0x3f'),_0x2c20ab)[_0x8688('0x15')](_0x8688('0x40'),NOW)[_0x8688('0x15')](_0x8688('0x41'),selectNotIn(_0x49775c,_0x50c23c,_0x1c313d,_0x8688('0x34'),[_0x8688('0x42'),_0x8688('0x43')]))[_0x8688('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x49775c,_0x50c23c,_0x1c313d,'cm_hopper',['\x22always\x22'])))[_0x8688('0x44')]();}function insertCmHopperBlack(_0x32e366,_0x3efd67,_0x2a9155,_0x38442e){var _0x1199a1=[_0x8688('0x2c'),'cm_contacts.id',_0x8688('0x2f'),_0x3efd67+'.'+_0x38442e,_0x8688('0x45'),_0x8688('0x30')];return squel['insert']()[_0x8688('0x33')](_0x8688('0x46'))[_0x8688('0x35')]([_0x8688('0x12'),_0x8688('0x37'),_0x8688('0x38'),_0x38442e,_0x8688('0x47'),_0x8688('0x39')],squel[_0x8688('0x10')]()[_0x8688('0x3b')](_0x1199a1)[_0x8688('0x3c')](_0x3efd67)[_0x8688('0x13')](_0x8688('0x48'),null,_0x8688('0x3d')+_0x3efd67+_0x8688('0x3e'))[_0x8688('0x13')](_0x2a9155,null,_0x2a9155+_0x8688('0x14')+_0x3efd67+'.'+_0x38442e)[_0x8688('0x15')](_0x3efd67+'.CmListId\x20=\x20?',_0x32e366)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8688('0x15')](_0x8688('0x41'),squel['select']()[_0x8688('0x11')]('phone')[_0x8688('0x3c')](_0x8688('0x46'))[_0x8688('0x15')](_0x8688('0x49'),_0x32e366)[_0x8688('0x15')](_0x38442e+'\x20=\x20?',_0x3efd67+'.'+_0x38442e)))['toString']();}function insertCmHopperAdditionalPhones(_0x18607e){var _0x2bef7c=[_0x8688('0x4a'),_0x8688('0x4b'),_0x8688('0x4c'),_0x8688('0x4d'),'cm_contact_has_items.updatedAt'];return squel[_0x8688('0x32')]()['into'](_0x8688('0x4e'))[_0x8688('0x35')](['CmHopperId','phone',_0x8688('0x4f'),'createdAt','updatedAt'],squel[_0x8688('0x10')]()[_0x8688('0x3b')](_0x2bef7c)[_0x8688('0x3c')](_0x8688('0x34'))[_0x8688('0x13')](_0x8688('0x48'),null,_0x8688('0x50'))[_0x8688('0x13')]('cm_contact_has_items',null,_0x8688('0x51'))[_0x8688('0x15')](_0x8688('0x52'),_0x18607e)[_0x8688('0x15')](_0x8688('0x40'),NOW))[_0x8688('0x44')]();}function insertCmContact(_0x7e9dca,_0x75454a,_0x8384e3,_0x4b1cb1){var _0x27a536=_[_0x8688('0x53')](_[_0x8688('0x54')](_0x4b1cb1),[_0x8688('0x38'),_0x8688('0x55'),_0x8688('0x47'),_0x8688('0x39')]);return squel[_0x8688('0x32')]()[_0x8688('0x33')](_0x8688('0x48'))[_0x8688('0x35')](_0x27a536,squel[_0x8688('0x10')]()[_0x8688('0x3b')](_0x27a536)[_0x8688('0x3c')](_0x75454a)[_0x8688('0x15')]('('+_0x8384e3['join'](',')+_0x8688('0x56'),squel[_0x8688('0x10')]()[_0x8688('0x3b')](_0x8384e3)[_0x8688('0x3c')](_0x8688('0x48'))[_0x8688('0x15')](_0x8688('0x49'),_0x7e9dca))[_0x8688('0x15')](_0x8688('0x57'),squel[_0x8688('0x10')]()[_0x8688('0x11')](_0x8688('0x58'),_0x8688('0x59'))[_0x8688('0x3c')](_0x75454a)[_0x8688('0x5a')](_0x8384e3[_0x8688('0x13')](','))))['toString']();}function handleStop(){logger[_0x8688('0x5b')](_0x8688('0x5c'));stopped=!![];}function handleUncaughtException(_0x9c0869){logger['error'](_0x9c0869[_0x8688('0x20')]);process[_0x8688('0x5d')](0x1);}function handleError(_0x5db495,_0x4e997d){stats[_0x8688('0x5e')][_0x8688('0x1d')]({'name':_0x4e997d['code'],'message':_0x4e997d[_0x8688('0x20')],'row':_0x5db495});}function handleQuery(_0x4fa289){logger[_0x8688('0x5b')](_0x4fa289);return db[_0x8688('0x18')]['query'](_0x4fa289)[_0x8688('0x5f')](function(_0x4c6e11){results['push'](_0x4c6e11);})[_0x8688('0x1e')](function(_0x3e60b0){logger[_0x8688('0x1f')](_0x3e60b0[_0x8688('0x20')]);});}function main(_0x2aec68,_0x5812c9,_0x314a9e,_0x191b9e){logger[_0x8688('0x5b')](_0x8688('0x60'),_0x2aec68,JSON[_0x8688('0x61')](_0x5812c9));process['send'](_0x8688('0x62'));var _0x1075d9=_0x5812c9[_0x8688('0x63')];var _0x50308a=_['clone'](_0x1075d9);var _0x44004b=_0x5812c9[_0x8688('0x64')];var _0x3cbd35=path[_0x8688('0x13')](config[_0x8688('0x65')],'server/files/tmp',_0x44004b+_0x8688('0x66'));logger['info'](_0x8688('0x67'),_0x5812c9);db[_0x8688('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x8688('0x69')]})[_0x8688('0x22')](function(_0x43262f){for(var _0x2f7334=0x0;_0x2f7334<_0x43262f['length'];_0x2f7334++){if(_0x43262f[_0x2f7334][_0x8688('0x69')]in _0x1075d9){contactItemTypes[_0x8688('0x1d')](_0x43262f[_0x2f7334]);delete _0x50308a[_0x43262f[_0x2f7334]['name']];hasAdditionalPhones=!![];}for(var _0x1924df in _0x1075d9){if(_0x43262f[_0x2f7334][_0x8688('0x69')]+'_description'===_0x1924df){phoneDescriptions['push']({'itemTypeId':_0x43262f[_0x2f7334]['id'],'description':_0x1924df});delete _0x50308a[_0x1924df];}}}if(hasAdditionalPhones)_0x50308a['AdditionalPhones']='';var _0x2b42d0=_[_0x8688('0x54')](_0x50308a)[_0x8688('0x13')]();logger[_0x8688('0x5b')](_0x8688('0x6a'),_0x2b42d0);fs[_0x8688('0x6b')](_0x3cbd35,_0x2b42d0+'\x0a');Papa[_0x8688('0x6c')](fs[_0x8688('0x6d')](_0x2aec68),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4cb86b,_0x12091c){try{for(var _0x36c420=0x0,_0x513210=[];_0x36c420<_0x4cb86b[_0x8688('0x6e')][_0x8688('0x1b')];_0x36c420++){stats[_0x8688('0x6f')]+=0x1;if(_0x4cb86b['errors'][_0x36c420]){handleError(_0x4cb86b[_0x8688('0x6e')][_0x36c420],_0x4cb86b['errors'][_0x36c420]);}else{var _0x5bf89c=[];var _0x3bf7f8=[];var _0x391b4a={};for(var _0x516824 in _0x1075d9){let _0x59014e=contactItemTypes[_0x8688('0x70')](_0x4a9ebc=>_0x4a9ebc[_0x8688('0x69')]===_0x516824);let _0x107688=contactItemTypes['find'](_0x5ca0ba=>_0x5ca0ba['name']+'_description'===_0x516824);if(_['isNil'](_0x59014e)&&_[_0x8688('0x1c')](_0x107688)){if(_0x1075d9[_0x8688('0x71')](_0x516824)){if(_0x4cb86b[_0x8688('0x6e')][_0x36c420][_0x1075d9[_0x516824]]){var _0x3f6385=_['trim'](_0x4cb86b[_0x8688('0x6e')][_0x36c420][_0x1075d9[_0x516824]][_0x8688('0x72')](/"/g,'\x27'));switch(_0x516824){case _0x8688('0x36'):var _0x5cf2df=moment(_0x3f6385,_0x8688('0xd'),!![]);if(_0x5cf2df[_0x8688('0x73')]()){_0x513210[_0x8688('0x1d')]('\x22'+_0x3f6385+'\x22');}else{_0x5bf89c[_0x8688('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x8688('0x74'):var _0xd76b1e=parseInt(_0x3f6385);_0x3f6385=_[_0x8688('0x75')](_0xd76b1e)||_0xd76b1e<0x0||_0xd76b1e>0x4?_0x191b9e?0x3:0x2:_0xd76b1e;_0x513210[_0x8688('0x1d')]('\x22'+_0x3f6385+'\x22');break;case'UserId':var _0x19d666=parseInt(_0x3f6385);if(_[_0x8688('0x76')](_0x19d666)&&_[_0x8688('0x77')](_0x314a9e,_0x19d666)){_0x513210['push']('\x22'+_0x19d666+'\x22');}else{_0x5bf89c[_0x8688('0x1d')](_0x8688('0x78'));}break;case _0x8688('0x79'):if(isEmail(_0x3f6385)){_0x513210['push']('\x22'+_0x3f6385+'\x22');}else{_0x5bf89c[_0x8688('0x1d')](_0x8688('0x7a'));}break;case _0x8688('0x7b'):var _0x52c4c9=moment(_0x3f6385,_0x8688('0x7c'),!![]);if(_0x52c4c9[_0x8688('0x73')]()){_0x513210[_0x8688('0x1d')]('\x22'+_0x3f6385+'\x22');}else{_0x5bf89c[_0x8688('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x513210['push']('\x22'+_0x3f6385+'\x22');}}else{switch(_0x516824){case _0x8688('0x7d'):case _0x8688('0x12'):_0x5bf89c[_0x8688('0x1d')](_0x516824+_0x8688('0x7e'));break;default:_0x513210[_0x8688('0x1d')]('\x22\x22');}}}}else{var _0x460d57='';if(!_[_0x8688('0x1c')](_0x59014e)){if(!_0x391b4a['hasOwnProperty'](_0x59014e['id'])){for(var _0x3049d2=0x0;_0x3049d2<_0x1075d9[_0x516824]['length'];_0x3049d2++){var _0x3f6385=_[_0x8688('0x7f')](_0x4cb86b['data'][_0x36c420][_0x1075d9[_0x516824][_0x3049d2]][_0x8688('0x72')](/"/g,'\x27'));var _0x3c4cf7=phoneDescriptions[_0x8688('0x70')](_0x4d2792=>_0x4d2792['itemTypeId']===_0x59014e['id']);if(!_[_0x8688('0x1c')](_0x3c4cf7)){var _0x185843=_[_0x8688('0x7f')](_0x4cb86b[_0x8688('0x6e')][_0x36c420][_0x1075d9[_0x3c4cf7[_0x8688('0x80')]][0x0]][_0x8688('0x72')](/"/g,'\x27'));if(!_[_0x8688('0x1c')](_0x185843))_0x3f6385=_0x3f6385+'§'+_0x185843;}if(_0x460d57=='')_0x460d57=_0x3f6385;else _0x460d57+='|'+_0x3f6385;}_0x3bf7f8[_0x8688('0x1d')](_0x59014e['id']+':'+_0x460d57);_0x391b4a[_0x59014e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x513210[_0x8688('0x1d')]('\x22'+_0x3bf7f8[_0x8688('0x13')](';')+'\x22');}if(_0x5bf89c[_0x8688('0x1b')]){handleError(_0x4cb86b['data'][_0x36c420],{'code':_0x8688('0x81'),'message':_0x5bf89c['join']()});}else{fs[_0x8688('0x82')](_0x3cbd35,_0x513210['join']()+'\x0a');}_0x513210=[];}if(!(stats['rows']%0xc8)){socket[_0x8688('0x83')]('contact:import:'+_0x44004b,stats);stats[_0x8688('0x5e')]=[];}}if(stopped){logger[_0x8688('0x5b')](_0x8688('0x84'));_0x12091c[_0x8688('0x85')]();}}catch(_0x26ec2d){handleError(_0x4cb86b['data'][_0x36c420],{'code':_0x8688('0x86'),'message':_0x26ec2d[_0x8688('0x20')]});logger[_0x8688('0x1f')](_0x8688('0x87'),_0x26ec2d[_0x8688('0x20')]);}},'complete':function(){try{var _0x33c88f=[];var _0x26733c=tempTableName;_0x33c88f[_0x8688('0x1d')](_0x8688('0x88')+_0x26733c+_0x8688('0x89'));logger[_0x8688('0x5b')](_0x8688('0x8a'),contactItemTypes[_0x8688('0x1b')]);var _0x5c3cef=util['format'](_0x8688('0x8b'),_0x3cbd35,_0x26733c,_0x2b42d0,_0x5812c9[_0x8688('0x38')],_0x5812c9['CompanyId']||null,NOW,NOW);if(_[_0x8688('0x1c')](_0x1075d9[_0x8688('0x36')])){_0x5c3cef+=_0x8688('0x8c');}_0x33c88f['push'](_0x5c3cef);BPromise['each'](_0x33c88f,handleQuery)['then'](function(_0x3e07f0){BPromise[_0x8688('0x8d')]([handleAdditionalPhones()])['then'](function(){_0x33c88f=[];for(var _0x3f0ba0=0x0;_0x3f0ba0\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','field','name','color','from','tools_tags','getInteractionFK','select','ui.','left_join','users','where','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf511,0x1bd));var _0x1f51=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0xf511[_0x4cefc3];return _0x1cc779;};'use strict';var _=require(_0x1f51('0x0'));var squel=require(_0x1f51('0x1'));var as=require(_0x1f51('0x2'));var qs=require(_0x1f51('0x3'));var updateInteraction=require(_0x1f51('0x4'))['updateInteraction'];var utils=require(_0x1f51('0x5'));var db=require(_0x1f51('0x6'))['db'];function skipInteractionsQuery(_0x3cc0a3,_0x313c8e,_0x2f29c5){var _0x3b7e0b=![];var _0x187795=utils[_0x1f51('0x7')](_0x3cc0a3);if(_0x313c8e[_0x1f51('0x8')]==='agent'&&!_0x2f29c5[_0x1f51('0x9')]&&!_0x2f29c5[_0x187795]){_0x3b7e0b=!![];}return _0x3b7e0b;}function getTagsQuery(){return squel['select']()[_0x1f51('0xa')]('id')['field'](_0x1f51('0xb'))[_0x1f51('0xa')](_0x1f51('0xc'))[_0x1f51('0xd')](_0x1f51('0xe'));}function getUsersQuery(_0x3dc930,_0x4e7894){var _0x12bb68=utils[_0x1f51('0xf')](_0x3dc930);var _0x10d927='user_has_'+_0x3dc930+'_interactions';var _0x4d8e5f=squel[_0x1f51('0x10')]()['field']('u.id')[_0x1f51('0xa')]('u.fullname')[_0x1f51('0xa')](_0x1f51('0x11')+_0x12bb68)[_0x1f51('0xd')](_0x10d927,'ui')[_0x1f51('0x12')](_0x1f51('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x4e7894['length']>0x0){_0x4d8e5f[_0x1f51('0x14')]('ui.'+_0x12bb68+_0x1f51('0x15'),_[_0x1f51('0x16')](_0x4e7894,'id'));}return _0x4d8e5f;}function getInteractionsQuery(_0x1eb728){var _0x225166=utils[_0x1f51('0x17')](_0x1eb728);var _0x5ae83e=utils['getAccountFK'](_0x1eb728);var _0x566b8c=utils[_0x1f51('0xf')](_0x1eb728);return squel[_0x1f51('0x10')]()[_0x1f51('0xd')](_0x225166[_0x1f51('0x18')],'i')[_0x1f51('0x12')]('cm_contacts','c',_0x1f51('0x19'))[_0x1f51('0x12')](_0x1f51('0x13'),'o',_0x1f51('0x1a'))[_0x1f51('0x12')](_0x225166[_0x1f51('0x1b')],'a',_0x1f51('0x1c')+_0x5ae83e)[_0x1f51('0x12')](_0x225166[_0x1f51('0x1d')],'me','me.'+_0x566b8c+_0x1f51('0x1e'))['left_join'](_0x225166[_0x1f51('0x1f')],'it',_0x1f51('0x20')+_0x566b8c+_0x1f51('0x1e'))[_0x1f51('0x12')](_0x1f51('0xe'),'t',_0x1f51('0x21'));}function getSqlClauses(){var _0x16da07={'body':squel[_0x1f51('0x22')](),'contact':squel[_0x1f51('0x22')](),'default':squel[_0x1f51('0x22')](),'fields':squel['expr'](),'filter':squel[_0x1f51('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0x1f51('0x22')](),'ids':null},'user':squel[_0x1f51('0x22')]()};return _0x16da07;}function parseTagParameter(_0x5aebb){var _0x1b73a3=squel[_0x1f51('0x22')]();if(_0x5aebb){var _0x5a9a45=utils[_0x1f51('0x23')](_0x5aebb);_0x5a9a45[_0x1f51('0x24')](function(_0x456a53){_0x1b73a3['or'](_0x1f51('0x25'),'%,'+_0x456a53+',%');});}return _0x1b73a3;}function parseReadParameter(_0x5f25a0){var _0x8a5583='';if(_0x5f25a0){_0x8a5583=_0x1f51('0x26');if(_0x5f25a0==='1'){_0x8a5583=_0x8a5583[_0x1f51('0x27')](_0x1f51('0x28'),'=');}else{_0x8a5583=_0x8a5583[_0x1f51('0x27')](_0x1f51('0x28'),'>');}}return _0x8a5583;}function parseSearchFilter(_0x3e6211,_0x8f4e9f){var _0x2d5a8a=squel[_0x1f51('0x22')]();if(_0x8f4e9f){var _0x5da69a=_0x8f4e9f[_0x1f51('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x4e9a5e=qs[_0x1f51('0x29')](_0x5da69a);if(qs[_0x1f51('0x2a')](_0x5da69a)){_0x2d5a8a['or'](_0x1f51('0x2b'),_0x4e9a5e+'%');if([_0x1f51('0x2c'),_0x1f51('0x2d')][_0x1f51('0x2e')](_0x3e6211)){_0x2d5a8a['or'](_0x1f51('0x2f'),_0x4e9a5e+'%');}else if(_0x3e6211===_0x1f51('0x30')){_0x2d5a8a['or']('i.fax\x20LIKE\x20?',_0x4e9a5e+'%');}else if(_0x3e6211===_0x1f51('0x31')){_0x2d5a8a['or'](_0x1f51('0x32'),_0x4e9a5e+'%');}}else if(_0x3e6211==='mail'&&qs['isEmail'](_0x5da69a)){_0x2d5a8a['or'](_0x1f51('0x33'),_0x4e9a5e+'%');}else{if(_0x3e6211===_0x1f51('0x34')){_0x2d5a8a['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1f51('0x35')](_0x5da69a,!![]))['or'](_0x1f51('0x36'),qs[_0x1f51('0x35')](_0x5da69a));}else if(_0x3e6211!==_0x1f51('0x30')){_0x2d5a8a['or'](_0x1f51('0x37'),qs[_0x1f51('0x35')](_0x5da69a));}_0x2d5a8a['or'](_0x1f51('0x38'),qs[_0x1f51('0x35')](_0x5da69a,!![]),null);}}return _0x2d5a8a;}function parseAdvancedSearchFilter(_0x34d9b4,_0x246548){var _0x249bcc=getSqlClauses();var _0x57f7f7=as[_0x1f51('0x39')](_0x34d9b4);var _0x439f6b=_0x57f7f7[_0x1f51('0x3a')];for(var _0xbf0610=0x0;_0xbf0610<_0x57f7f7['conditions'][_0x1f51('0x3b')];_0xbf0610++){var _0x11cc28=_0x57f7f7['conditions'][_0xbf0610];var _0x5f33bc='i';var _0x458e37=_['find'](_0x246548,[_0x1f51('0xb'),_0x11cc28[_0x1f51('0xa')]]);if(_0x458e37){var _0x92de2=as[_0x1f51('0x3c')](_0x5f33bc,_0x458e37[_0x1f51('0x3d')],_0x11cc28);_0x249bcc[_0x1f51('0x3e')][_0x439f6b](_0x92de2[_0x1f51('0x3f')],_0x92de2[_0x1f51('0x40')][_0x1f51('0x41')],_0x92de2[_0x1f51('0x40')][_0x1f51('0x42')]);}else{switch(_0x11cc28[_0x1f51('0xa')]){case _0x1f51('0x43'):var _0x401a2c=parseReadParameter(_0x11cc28[_0x1f51('0x40')]);_0x249bcc['read'][_0x1f51('0x44')](_0x401a2c);break;case'Contact':if(_0x11cc28[_0x1f51('0x45')]===_0x1f51('0x46')){if(_0x11cc28[_0x1f51('0x40')][_0x1f51('0x47')]('\x20')['length']>0x1){_0x249bcc[_0x1f51('0x48')][_0x439f6b](_0x1f51('0x38'),qs['getFullTextValue'](_0x11cc28['value'],!![]),null);}else{var _0x13a60f='%'+_0x11cc28[_0x1f51('0x40')]+'%';_0x249bcc['contact'][_0x439f6b](_0x1f51('0x49'),_0x13a60f,_0x13a60f,_0x13a60f);}}else{_0x458e37=_[_0x1f51('0x4a')](_0x246548,[_0x1f51('0xb'),_0x1f51('0x4b')]);_0x11cc28[_0x1f51('0xa')]='ContactId';_0x92de2=as[_0x1f51('0x3c')](_0x5f33bc,_0x458e37[_0x1f51('0x3d')],_0x11cc28);_0x249bcc[_0x1f51('0x48')][_0x439f6b](_0x92de2[_0x1f51('0x3f')],_0x92de2['value'][_0x1f51('0x41')],_0x92de2[_0x1f51('0x40')]['end']);}break;case _0x1f51('0x4c'):var _0x45b749=_0x11cc28['value'][_0x1f51('0x47')](',')[_0x1f51('0x16')](function(_0x264bc8){return Number(_0x264bc8);});var _0x57d968=parseTagParameter(_0x45b749);_0x249bcc['tags'][_0x1f51('0x4d')][_0x1f51('0x44')](_0x57d968);_0x249bcc[_0x1f51('0x4e')][_0x1f51('0x4f')]=_0x45b749;break;case _0x1f51('0x50'):if(_0x11cc28[_0x1f51('0x45')]===_0x1f51('0x46')){_0x249bcc['user'][_0x439f6b](_0x1f51('0x51'),'%'+_0x11cc28[_0x1f51('0x40')]+'%',null);}else{_0x458e37=_[_0x1f51('0x4a')](_0x246548,[_0x1f51('0xb'),_0x1f51('0x52')]);_0x11cc28[_0x1f51('0xa')]='UserId';_0x92de2=as[_0x1f51('0x3c')](_0x5f33bc,_0x458e37[_0x1f51('0x3d')],_0x11cc28);_0x249bcc['user'][_0x439f6b](_0x92de2['text'],_0x92de2[_0x1f51('0x40')]['start'],_0x92de2['value']['end']);}break;case _0x1f51('0x53'):case _0x1f51('0x54'):_0x92de2=as['buildExpression']('me',null,_0x11cc28);_0x249bcc['body'][_0x439f6b](_0x92de2[_0x1f51('0x3f')],_0x92de2['value'][_0x1f51('0x41')],_0x92de2[_0x1f51('0x40')][_0x1f51('0x42')]);break;}}}return _0x249bcc;}function parseModelFields(_0x2e2c5e,_0x11751b,_0xc49801){var _0x141083=utils['getAccountFK'](_0x2e2c5e);var _0x2162f3=squel[_0x1f51('0x22')]();var _0x352844=_(_0x11751b)[_0x1f51('0x55')]()[_0x1f51('0x16')](function(_0x1aeb3e){return _[_0x1f51('0x56')](_0xc49801,[_0x1f51('0xb'),_0x1aeb3e])?_0x1aeb3e:undefined;})[_0x1f51('0x57')]()['value']();if(_0x352844[_0x1f51('0x3b')]>0x0){_0x352844['forEach'](function(_0x77c7a4){if(_0x77c7a4===_0x141083){_0x2162f3[_0x1f51('0x44')]('i.'+_0x141083+_0x1f51('0x15'),[][_0x1f51('0x58')](_0x11751b[_0x77c7a4]));}else if(_0x77c7a4==='createdAt'){var _0x4a81ee=JSON['parse'](_0x11751b[_0x77c7a4])['$gte'];var _0x15e126=JSON[_0x1f51('0x59')](_0x11751b[_0x77c7a4])[_0x1f51('0x5a')];_0x2162f3['and'](_0x1f51('0x5b'),_0x4a81ee,_0x15e126);}else{if(_0x11751b[_0x77c7a4]===_0x1f51('0x5c')){_0x2162f3[_0x1f51('0x44')]('i.'+_0x77c7a4+_0x1f51('0x5d'));}else{_0x2162f3[_0x1f51('0x44')]('i.'+_0x77c7a4+_0x1f51('0x5e'),_0x11751b[_0x77c7a4]);}}});}return _0x2162f3;}function parseQueryParameters(_0x268cd0,_0x2ec6cc,_0x35a09a){var _0x1220d1=getSqlClauses();return Promise[_0x1f51('0x5f')]()['then'](function(){return parseModelFields(_0x268cd0,_0x2ec6cc,_0x35a09a);})[_0x1f51('0x60')](function(_0x256afd){_0x1220d1['fields']['and'](_0x256afd);return parseReadParameter(_0x2ec6cc['read']);})['then'](function(_0x318fc7){_0x1220d1[_0x1f51('0x61')][_0x1f51('0x44')](_0x318fc7);return parseTagParameter(_0x2ec6cc['tag']);})[_0x1f51('0x60')](function(_0x52f7be){_0x1220d1[_0x1f51('0x4e')][_0x1f51('0x4d')][_0x1f51('0x44')](_0x52f7be);return parseSearchFilter(_0x268cd0,_0x2ec6cc[_0x1f51('0x62')]);})[_0x1f51('0x60')](function(_0x54654d){_0x1220d1[_0x1f51('0x62')]=_0x54654d;return _0x1220d1;});}function checkAccountsRestrictions(_0x2c8c31,_0x298b70,_0x37eec5){var _0x24b8ad=utils[_0x1f51('0x7')](_0x2c8c31);var _0x19b1c0=_0x1f51('0x63')+_[_0x1f51('0x64')](_0x2c8c31)+(_0x2c8c31===_0x1f51('0x65')?'Websites':_0x1f51('0x66'));var _0x48b081=squel[_0x1f51('0x22')]();return Promise[_0x1f51('0x5f')]()[_0x1f51('0x60')](function(){if(_0x37eec5[_0x1f51('0x9')]&&_0x298b70['role']===_0x1f51('0x67')){return _0x298b70[_0x19b1c0]({'attributes':['id'],'raw':!![]});}})[_0x1f51('0x60')](function(_0xc46201){if(_0xc46201){if(_0xc46201[_0x1f51('0x3b')]===0x0){_0x48b081[_0x1f51('0x44')]('i.'+_0x24b8ad+_0x1f51('0x5d'));}else{_0x48b081[_0x1f51('0x44')]('i.'+_0x24b8ad+_0x1f51('0x15'),_[_0x1f51('0x16')](_0xc46201,'id'));}}else if(!_0x37eec5[_0x24b8ad]){_0x48b081[_0x1f51('0x44')]('i.'+_0x24b8ad+_0x1f51('0x68'));}})[_0x1f51('0x60')](function(){return _0x48b081;});}function getClosedOrderClause(_0x4bf4c9,_0x2c8e58){var _0x1e9dd8='';var _0x5a19d3=['i.thirdDisposition',_0x1f51('0x69'),_0x1f51('0x6a')];if(_0x4bf4c9===_0x1f51('0x34')){_0x5a19d3[_0x1f51('0x6b')](_0x1f51('0x6c'));}if(_0x2c8e58[_0x1f51('0x6d')]==='0'&&_0x4bf4c9==='mail'){_0x1e9dd8=_0x1f51('0x6c');}else{if(_0x2c8e58[_0x1f51('0x6d')]==='1'){_0x5a19d3[_0x1f51('0x6e')]();}_0x1e9dd8=_0x1f51('0x6f')+_0x5a19d3[_0x1f51('0x70')](',\x20')+')';}return _0x1e9dd8;}function getFilteredInteractions(_0x1aebaf,_0x3685a5,_0x2b10a3,_0x1c6776){var _0x29f00f=utils[_0x1f51('0xf')](_0x1aebaf);var _0xdf751c=_['capitalize'](_0x1aebaf)+_0x1f51('0x71');var _0x9b27bf=[];var _0x11308c=getTagsQuery();var _0x384fdf={'type':db[_0x1f51('0x72')][_0x1f51('0x73')][_0x1f51('0x74')],'raw':!![]};var _0x2e8c02=[];var _0x1a0572=[];return db[_0x1f51('0x75')][_0x1f51('0x76')](_0x11308c[_0x1f51('0x77')](),_0x384fdf)[_0x1f51('0x60')](function(_0x5d4bd4){_0x9b27bf=_['keyBy'](_0x5d4bd4,'id');_0x384fdf=_['merge'](_0x384fdf,{'model':db[_0xdf751c],'mapToModel':!![],'nest':!![]});if(_0x2b10a3[_0x1f51('0x78')]){_0x1c6776[_0x1f51('0x79')]['forEach'](function(_0x933a){_0x3685a5[_0x1f51('0xa')]('i.'+_0x933a);});}else{_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7a'),_0x1f51('0x43'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7b'),_0x1f51('0x7c'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7d'),_0x1f51('0x7e'));if(_0x1aebaf===_0x1f51('0x34')){_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7f'),_0x1f51('0x80'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x81'),'contactName');_0x3685a5[_0x1f51('0xa')]('i.id');_0x3685a5['field']('i.createdAt');_0x3685a5[_0x1f51('0xa')](_0x1f51('0x82'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x83'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x84'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x85'));_0x3685a5[_0x1f51('0xa')]('i.lastMsgAt');_0x3685a5[_0x1f51('0xa')](_0x1f51('0x86'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x87'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x6a'));_0x3685a5['field'](_0x1f51('0x69'));_0x3685a5['field']('i.thirdDisposition');_0x3685a5[_0x1f51('0xa')](_0x1f51('0x6c'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x88'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x89'));_0x3685a5['field'](_0x1f51('0x8a'));_0x3685a5['field'](_0x1f51('0x8b'));}else if(_0x1aebaf===_0x1f51('0x31')){_0x3685a5[_0x1f51('0xa')](_0x1f51('0x8c'),_0x1f51('0x8d'));}else{_0x3685a5[_0x1f51('0xa')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x1f51('0x8d'));}if(_0x1aebaf!==_0x1f51('0x34')){_0x3685a5['field'](_0x1f51('0x8e'));}_0x3685a5[_0x1f51('0xa')](_0x1f51('0x8f'),_0x1f51('0x90'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x91'),_0x1f51('0x92'));_0x3685a5[_0x1f51('0xa')]('c.email',_0x1f51('0x93'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x94'),_0x1f51('0x95'));_0x3685a5[_0x1f51('0xa')]('c.mobile',_0x1f51('0x96'));_0x3685a5[_0x1f51('0xa')]('c.fax',_0x1f51('0x97'));_0x3685a5[_0x1f51('0xa')]('o.fullname',_0x1f51('0x98'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x99'),_0x1f51('0x9a'));_0x3685a5['field'](_0x1f51('0x9b'),'TagIds');}if(_0x1c6776[_0x1f51('0x9c')]){_0x3685a5['limit'](_0x1c6776[_0x1f51('0x9c')]);}if(_0x1c6776['offset']){_0x3685a5['offset'](_0x1c6776['offset']);}return db['sequelize'][_0x1f51('0x76')](_0x3685a5[_0x1f51('0x77')](),_0x384fdf);})[_0x1f51('0x60')](function(_0x4a35e1){_0x2e8c02=_0x4a35e1;var _0x17adf2=getUsersQuery(_0x1aebaf,_0x2e8c02);return db[_0x1f51('0x75')][_0x1f51('0x76')](_0x17adf2[_0x1f51('0x77')](),_0x384fdf);})[_0x1f51('0x60')](function(_0x4c979c){_0x1a0572=_[_0x1f51('0x9d')](_0x4c979c,_0x29f00f);if(_0x1aebaf==='mail'){return db[_0x1f51('0x9e')][_0x1f51('0x9f')]({'attributes':[_0x1f51('0xa0')],'raw':!![]});}})[_0x1f51('0x60')](function(_0x24296e){var _0x27cd31=_0x24296e?_0x24296e[_0x1f51('0xa0')]:undefined;var _0x905047=_0x2e8c02[_0x1f51('0x16')](function(_0x285600){return updateInteraction(_0x285600,_0x9b27bf,_0x1a0572,_0x27cd31);});return Promise[_0x1f51('0xa1')](_0x905047);});}function countFilteredInteractions(_0x57418b,_0x1eb30f){var _0xda4c4e=_0x57418b[_0x1f51('0xa2')]();_0xda4c4e[_0x1f51('0xa')](_0x1f51('0xa3'));_0xda4c4e['field'](_0x1f51('0x7a'),_0x1f51('0x43'));var _0x34c4bb=utils['getSelectedTags'](_0x1eb30f);if(!_['isEmpty'](_0x34c4bb)){_0xda4c4e[_0x1f51('0x14')](_0x1f51('0xa4'),_0x34c4bb);}var _0x1495d7={'type':db[_0x1f51('0x72')][_0x1f51('0x73')][_0x1f51('0x74')],'raw':!![]};return db[_0x1f51('0x75')][_0x1f51('0x76')](_0xda4c4e[_0x1f51('0x77')](),_0x1495d7);}module[_0x1f51('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xcccd=['query','toString','groupBy','Setting','findOne','enableEmailPreview','all','clone','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','updateInteraction','./utils','getAccountFK','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','ui.','left_join','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','whatsapp','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','length','buildExpression','type','text','start','value','unreadMessages','read','and','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','end','Tag','tags','ids','$substring','user','find','UserId','body','plainBody','some','compact','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','clause','filter','get','capitalize','Websites','role','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.to','i.MailAccountId','i.UserId','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset'];(function(_0x29ecae,_0x4673fa){var _0x2b18cb=function(_0x4e7425){while(--_0x4e7425){_0x29ecae['push'](_0x29ecae['shift']());}};_0x2b18cb(++_0x4673fa);}(_0xcccd,0x147));var _0xdccc=function(_0x6afc9c,_0xf6b755){_0x6afc9c=_0x6afc9c-0x0;var _0x195d68=_0xcccd[_0x6afc9c];return _0x195d68;};'use strict';var _=require(_0xdccc('0x0'));var squel=require(_0xdccc('0x1'));var as=require(_0xdccc('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0xdccc('0x3')];var utils=require(_0xdccc('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x24f8b2,_0x205c55,_0x21adc3){var _0xf81ffe=![];var _0x3fd6d6=utils[_0xdccc('0x5')](_0x24f8b2);if(_0x205c55['role']==='agent'&&!_0x21adc3[_0xdccc('0x6')]&&!_0x21adc3[_0x3fd6d6]){_0xf81ffe=!![];}return _0xf81ffe;}function getTagsQuery(){return squel[_0xdccc('0x7')]()[_0xdccc('0x8')]('id')[_0xdccc('0x8')](_0xdccc('0x9'))[_0xdccc('0x8')](_0xdccc('0xa'))[_0xdccc('0xb')](_0xdccc('0xc'));}function getUsersQuery(_0x2fc2e9,_0x55c990){var _0x1b16c0=utils[_0xdccc('0xd')](_0x2fc2e9);var _0x388ee2=_0xdccc('0xe')+_0x2fc2e9+_0xdccc('0xf');var _0x2f6f44=squel[_0xdccc('0x7')]()['field']('u.id')[_0xdccc('0x8')]('u.fullname')['field'](_0xdccc('0x10')+_0x1b16c0)[_0xdccc('0xb')](_0x388ee2,'ui')[_0xdccc('0x11')]('users','u',_0xdccc('0x12'));if(_0x55c990['length']>0x0){_0x2f6f44[_0xdccc('0x13')](_0xdccc('0x10')+_0x1b16c0+_0xdccc('0x14'),_[_0xdccc('0x15')](_0x55c990,'id'));}return _0x2f6f44;}function getInteractionsQuery(_0x16fda9){var _0x5e77cb=utils['getInteractionsTables'](_0x16fda9);var _0x5d9d5b=utils[_0xdccc('0x5')](_0x16fda9);var _0x187daa=utils[_0xdccc('0xd')](_0x16fda9);return squel[_0xdccc('0x7')]()[_0xdccc('0xb')](_0x5e77cb[_0xdccc('0x16')],'i')[_0xdccc('0x11')](_0xdccc('0x17'),'c',_0xdccc('0x18'))[_0xdccc('0x11')](_0xdccc('0x19'),'o',_0xdccc('0x1a'))[_0xdccc('0x11')](_0x5e77cb[_0xdccc('0x1b')],'a','a.id\x20=\x20i.'+_0x5d9d5b)[_0xdccc('0x11')](_0x5e77cb[_0xdccc('0x1c')],'me',_0xdccc('0x1d')+_0x187daa+_0xdccc('0x1e'))[_0xdccc('0x11')](_0x5e77cb[_0xdccc('0x1f')],'it',_0xdccc('0x20')+_0x187daa+_0xdccc('0x1e'))[_0xdccc('0x11')](_0xdccc('0xc'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3d8629={'body':squel[_0xdccc('0x21')](),'contact':squel[_0xdccc('0x21')](),'default':squel['expr'](),'fields':squel[_0xdccc('0x21')](),'filter':squel['expr'](),'read':squel[_0xdccc('0x21')](),'tags':{'clause':squel[_0xdccc('0x21')](),'ids':null},'user':squel[_0xdccc('0x21')]()};return _0x3d8629;}function parseTagParameter(_0x4fbc44){var _0x4c192a=squel['expr']();if(_0x4fbc44){var _0x4ef99e=utils[_0xdccc('0x22')](_0x4fbc44);_0x4ef99e[_0xdccc('0x23')](function(_0x49cd5e){_0x4c192a['or'](_0xdccc('0x24'),'%,'+_0x49cd5e+',%');});}return _0x4c192a;}function parseReadParameter(_0x12c0fd){var _0x5b5f8b='';if(_0x12c0fd){_0x5b5f8b='unreadMessages\x20{OPERATOR}\x200';if(_0x12c0fd==='1'){_0x5b5f8b=_0x5b5f8b[_0xdccc('0x25')]('{OPERATOR}','=');}else{_0x5b5f8b=_0x5b5f8b[_0xdccc('0x25')](_0xdccc('0x26'),'>');}}return _0x5b5f8b;}function parseSearchFilter(_0x37c2ab,_0x509f96){var _0x33f699=squel[_0xdccc('0x21')]();if(_0x509f96){var _0x3ed1f7=_0x509f96[_0xdccc('0x25')]('\x5c','\x5c\x5c')[_0xdccc('0x25')](/'/g,'\x27\x27');var _0x36f9ef=qs['escapeLIKESpecialChars'](_0x3ed1f7);if(qs[_0xdccc('0x27')](_0x3ed1f7)){_0x33f699['or'](_0xdccc('0x28'),_0x36f9ef+'%');if(['sms',_0xdccc('0x29')]['includes'](_0x37c2ab)){_0x33f699['or'](_0xdccc('0x2a'),_0x36f9ef+'%');}else if(_0x37c2ab===_0xdccc('0x2b')){_0x33f699['or']('i.fax\x20LIKE\x20?',_0x36f9ef+'%');}else if(_0x37c2ab===_0xdccc('0x2c')){_0x33f699['or'](_0xdccc('0x2d'),_0x36f9ef+'%');}}else if(_0x37c2ab===_0xdccc('0x2e')&&qs[_0xdccc('0x2f')](_0x3ed1f7)){_0x33f699['or']('c.email\x20LIKE\x20?',_0x36f9ef+'%');}else{if(_0x37c2ab===_0xdccc('0x2e')){_0x33f699['or'](_0xdccc('0x30'),qs[_0xdccc('0x31')](_0x3ed1f7,!![]))['or'](_0xdccc('0x32'),qs[_0xdccc('0x31')](_0x3ed1f7));}else if(_0x37c2ab!=='fax'){_0x33f699['or'](_0xdccc('0x33'),qs['getFullTextValue'](_0x3ed1f7));}_0x33f699['or'](_0xdccc('0x34'),qs['getFullTextValue'](_0x3ed1f7,!![]),null);}}return _0x33f699;}function parseAdvancedSearchFilter(_0x33e9f0,_0x3ace54){var _0x1a5eb5=getSqlClauses();var _0x42245f=as['parseSearch'](_0x33e9f0);var _0x120998=_0x42245f[_0xdccc('0x35')];for(var _0x58468e=0x0;_0x58468e<_0x42245f[_0xdccc('0x36')][_0xdccc('0x37')];_0x58468e++){var _0x1162c3=_0x42245f['conditions'][_0x58468e];var _0x119dd8='i';var _0x8a74b6=_['find'](_0x3ace54,[_0xdccc('0x9'),_0x1162c3[_0xdccc('0x8')]]);if(_0x8a74b6){var _0x58ca45=as[_0xdccc('0x38')](_0x119dd8,_0x8a74b6[_0xdccc('0x39')],_0x1162c3);_0x1a5eb5['default'][_0x120998](_0x58ca45[_0xdccc('0x3a')],_0x58ca45['value'][_0xdccc('0x3b')],_0x58ca45[_0xdccc('0x3c')]['end']);}else{switch(_0x1162c3[_0xdccc('0x8')]){case _0xdccc('0x3d'):var _0x58b082=parseReadParameter(_0x1162c3[_0xdccc('0x3c')]);_0x1a5eb5[_0xdccc('0x3e')][_0xdccc('0x3f')](_0x58b082);break;case _0xdccc('0x40'):if(_0x1162c3[_0xdccc('0x41')]==='$substring'){if(_0x1162c3[_0xdccc('0x3c')][_0xdccc('0x42')]('\x20')['length']>0x1){_0x1a5eb5[_0xdccc('0x43')][_0x120998](_0xdccc('0x34'),qs[_0xdccc('0x31')](_0x1162c3[_0xdccc('0x3c')],!![]),null);}else{var _0x1def0d='%'+_0x1162c3[_0xdccc('0x3c')]+'%';_0x1a5eb5[_0xdccc('0x43')][_0x120998](_0xdccc('0x44'),_0x1def0d,_0x1def0d,_0x1def0d);}}else{_0x8a74b6=_['find'](_0x3ace54,['name',_0xdccc('0x45')]);_0x1162c3[_0xdccc('0x8')]=_0xdccc('0x45');_0x58ca45=as['buildExpression'](_0x119dd8,_0x8a74b6[_0xdccc('0x39')],_0x1162c3);_0x1a5eb5['contact'][_0x120998](_0x58ca45[_0xdccc('0x3a')],_0x58ca45['value']['start'],_0x58ca45['value'][_0xdccc('0x46')]);}break;case _0xdccc('0x47'):var _0x4f941e=_0x1162c3[_0xdccc('0x3c')][_0xdccc('0x42')](',')[_0xdccc('0x15')](function(_0x14855b){return Number(_0x14855b);});var _0x5417bf=parseTagParameter(_0x4f941e);_0x1a5eb5[_0xdccc('0x48')]['clause'][_0xdccc('0x3f')](_0x5417bf);_0x1a5eb5[_0xdccc('0x48')][_0xdccc('0x49')]=_0x4f941e;break;case'User':if(_0x1162c3[_0xdccc('0x41')]===_0xdccc('0x4a')){_0x1a5eb5[_0xdccc('0x4b')][_0x120998]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x1162c3[_0xdccc('0x3c')]+'%',null);}else{_0x8a74b6=_[_0xdccc('0x4c')](_0x3ace54,['name','UserId']);_0x1162c3[_0xdccc('0x8')]=_0xdccc('0x4d');_0x58ca45=as[_0xdccc('0x38')](_0x119dd8,_0x8a74b6['type'],_0x1162c3);_0x1a5eb5[_0xdccc('0x4b')][_0x120998](_0x58ca45[_0xdccc('0x3a')],_0x58ca45['value'][_0xdccc('0x3b')],_0x58ca45[_0xdccc('0x3c')]['end']);}break;case _0xdccc('0x4e'):case _0xdccc('0x4f'):_0x58ca45=as['buildExpression']('me',null,_0x1162c3);_0x1a5eb5[_0xdccc('0x4e')][_0x120998](_0x58ca45[_0xdccc('0x3a')],_0x58ca45[_0xdccc('0x3c')][_0xdccc('0x3b')],_0x58ca45[_0xdccc('0x3c')][_0xdccc('0x46')]);break;}}}return _0x1a5eb5;}function parseModelFields(_0x3eeae2,_0x1a45c8,_0x470b03){var _0x2873a5=utils[_0xdccc('0x5')](_0x3eeae2);var _0x55062a=squel[_0xdccc('0x21')]();var _0x4a3fbd=_(_0x1a45c8)['keys']()[_0xdccc('0x15')](function(_0x5743dd){return _[_0xdccc('0x50')](_0x470b03,[_0xdccc('0x9'),_0x5743dd])?_0x5743dd:undefined;})[_0xdccc('0x51')]()[_0xdccc('0x3c')]();if(_0x4a3fbd['length']>0x0){_0x4a3fbd[_0xdccc('0x23')](function(_0x41a32e){if(_0x41a32e===_0x2873a5){_0x55062a['and']('i.'+_0x2873a5+'\x20IN\x20?',[][_0xdccc('0x52')](_0x1a45c8[_0x41a32e]));}else if(_0x41a32e===_0xdccc('0x53')){var _0x221973=JSON[_0xdccc('0x54')](_0x1a45c8[_0x41a32e])[_0xdccc('0x55')];var _0x4673ba=JSON[_0xdccc('0x54')](_0x1a45c8[_0x41a32e])['$lte'];_0x55062a[_0xdccc('0x3f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x221973,_0x4673ba);}else{if(_0x1a45c8[_0x41a32e]===_0xdccc('0x56')){_0x55062a[_0xdccc('0x3f')]('i.'+_0x41a32e+_0xdccc('0x57'));}else{_0x55062a[_0xdccc('0x3f')]('i.'+_0x41a32e+_0xdccc('0x58'),_0x1a45c8[_0x41a32e]);}}});}return _0x55062a;}function parseQueryParameters(_0x35bcff,_0x423264,_0x1a5727){var _0x569e57=getSqlClauses();return Promise[_0xdccc('0x59')]()[_0xdccc('0x5a')](function(){return parseModelFields(_0x35bcff,_0x423264,_0x1a5727);})[_0xdccc('0x5a')](function(_0x4b2bd6){_0x569e57[_0xdccc('0x5b')][_0xdccc('0x3f')](_0x4b2bd6);return parseReadParameter(_0x423264[_0xdccc('0x3e')]);})[_0xdccc('0x5a')](function(_0x3b0d81){_0x569e57['read'][_0xdccc('0x3f')](_0x3b0d81);return parseTagParameter(_0x423264[_0xdccc('0x5c')]);})[_0xdccc('0x5a')](function(_0x469441){_0x569e57[_0xdccc('0x48')][_0xdccc('0x5d')][_0xdccc('0x3f')](_0x469441);return parseSearchFilter(_0x35bcff,_0x423264[_0xdccc('0x5e')]);})[_0xdccc('0x5a')](function(_0x4673ed){_0x569e57['filter']=_0x4673ed;return _0x569e57;});}function checkAccountsRestrictions(_0x4d54f0,_0x50c91d,_0x30e5ed){var _0x2cc71e=utils[_0xdccc('0x5')](_0x4d54f0);var _0xe5fabe=_0xdccc('0x5f')+_[_0xdccc('0x60')](_0x4d54f0)+(_0x4d54f0==='chat'?_0xdccc('0x61'):'Accounts');var _0x1bcd47=squel['expr']();return Promise[_0xdccc('0x59')]()['then'](function(){if(_0x30e5ed[_0xdccc('0x6')]&&_0x50c91d[_0xdccc('0x62')]===_0xdccc('0x63')){return _0x50c91d[_0xe5fabe]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3047a7){if(_0x3047a7){if(_0x3047a7[_0xdccc('0x37')]===0x0){_0x1bcd47[_0xdccc('0x3f')]('i.'+_0x2cc71e+'\x20IS\x20NULL');}else{_0x1bcd47['and']('i.'+_0x2cc71e+_0xdccc('0x14'),_[_0xdccc('0x15')](_0x3047a7,'id'));}}else if(!_0x30e5ed[_0x2cc71e]){_0x1bcd47[_0xdccc('0x3f')]('i.'+_0x2cc71e+_0xdccc('0x64'));}})[_0xdccc('0x5a')](function(){return _0x1bcd47;});}function getClosedOrderClause(_0x11089f,_0x4f5c20){var _0x2103c='';var _0x18ff34=[_0xdccc('0x65'),_0xdccc('0x66'),_0xdccc('0x67')];if(_0x11089f==='mail'){_0x18ff34[_0xdccc('0x68')]('i.substatus');}if(_0x4f5c20['closed']==='0'&&_0x11089f===_0xdccc('0x2e')){_0x2103c=_0xdccc('0x69');}else{if(_0x4f5c20['closed']==='1'){_0x18ff34[_0xdccc('0x6a')]();}_0x2103c=_0xdccc('0x6b')+_0x18ff34[_0xdccc('0x6c')](',\x20')+')';}return _0x2103c;}function getFilteredInteractions(_0x3c7e88,_0x4ec1d1,_0x15d177,_0x2822a4){var _0x372e19=utils['getInteractionFK'](_0x3c7e88);var _0x2b44b5=_[_0xdccc('0x60')](_0x3c7e88)+_0xdccc('0x6d');var _0x4829ba=[];var _0x169f55=getTagsQuery();var _0x1cfe26={'type':db[_0xdccc('0x6e')][_0xdccc('0x6f')][_0xdccc('0x70')],'raw':!![]};var _0xa0d620=[];var _0x2c62fc=[];return db[_0xdccc('0x71')]['query'](_0x169f55['toString'](),_0x1cfe26)[_0xdccc('0x5a')](function(_0x306542){_0x4829ba=_[_0xdccc('0x72')](_0x306542,'id');_0x1cfe26=_[_0xdccc('0x73')](_0x1cfe26,{'model':db[_0x2b44b5],'mapToModel':!![],'nest':!![]});if(_0x15d177['fields']){_0x2822a4[_0xdccc('0x74')][_0xdccc('0x23')](function(_0x4b51ed){_0x4ec1d1[_0xdccc('0x8')]('i.'+_0x4b51ed);});}else{_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x75'),_0xdccc('0x3d'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x76'),_0xdccc('0x77'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x78'),_0xdccc('0x79'));if(_0x3c7e88===_0xdccc('0x2e')){_0x4ec1d1['field'](_0xdccc('0x7a'),_0xdccc('0x7b'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x7c'),_0xdccc('0x7d'));_0x4ec1d1[_0xdccc('0x8')]('i.id');_0x4ec1d1['field']('i.createdAt');_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x7e'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x7f'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x80'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x81'));_0x4ec1d1[_0xdccc('0x8')]('i.lastMsgAt');_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x82'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x83'));_0x4ec1d1['field'](_0xdccc('0x67'));_0x4ec1d1[_0xdccc('0x8')]('i.secondDisposition');_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x65'));_0x4ec1d1['field'](_0xdccc('0x69'));_0x4ec1d1['field'](_0xdccc('0x84'));_0x4ec1d1[_0xdccc('0x8')]('i.ContactId');_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x85'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x86'));}else if(_0x3c7e88===_0xdccc('0x2c')){_0x4ec1d1[_0xdccc('0x8')]('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',_0xdccc('0x7d'));}else{_0x4ec1d1[_0xdccc('0x8')]('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',_0xdccc('0x7d'));}if(_0x3c7e88!==_0xdccc('0x2e')){_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x87'));}_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x88'),_0xdccc('0x89'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x8a'),_0xdccc('0x8b'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x8c'),'Contact.email');_0x4ec1d1['field']('c.phone','Contact.phone');_0x4ec1d1['field'](_0xdccc('0x8d'),'Contact.mobile');_0x4ec1d1['field'](_0xdccc('0x8e'),_0xdccc('0x8f'));_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x90'),_0xdccc('0x91'));_0x4ec1d1[_0xdccc('0x8')]('o.internal','Owner.internal');_0x4ec1d1[_0xdccc('0x8')](_0xdccc('0x92'),_0xdccc('0x93'));}if(_0x2822a4[_0xdccc('0x94')]){_0x4ec1d1[_0xdccc('0x94')](_0x2822a4[_0xdccc('0x94')]);}if(_0x2822a4[_0xdccc('0x95')]){_0x4ec1d1[_0xdccc('0x95')](_0x2822a4['offset']);}return db[_0xdccc('0x71')][_0xdccc('0x96')](_0x4ec1d1[_0xdccc('0x97')](),_0x1cfe26);})[_0xdccc('0x5a')](function(_0x4a509e){_0xa0d620=_0x4a509e;var _0x509cfc=getUsersQuery(_0x3c7e88,_0xa0d620);return db[_0xdccc('0x71')][_0xdccc('0x96')](_0x509cfc[_0xdccc('0x97')](),_0x1cfe26);})[_0xdccc('0x5a')](function(_0x2e108d){_0x2c62fc=_[_0xdccc('0x98')](_0x2e108d,_0x372e19);if(_0x3c7e88===_0xdccc('0x2e')){return db[_0xdccc('0x99')][_0xdccc('0x9a')]({'attributes':[_0xdccc('0x9b')],'raw':!![]});}})[_0xdccc('0x5a')](function(_0x389576){var _0x683170=_0x389576?_0x389576['enableEmailPreview']:undefined;var _0x5a5885=_0xa0d620[_0xdccc('0x15')](function(_0x2ba896){return updateInteraction(_0x2ba896,_0x4829ba,_0x2c62fc,_0x683170);});return Promise[_0xdccc('0x9c')](_0x5a5885);});}function countFilteredInteractions(_0x1ccec4,_0x1f01ea){var _0x34785e=_0x1ccec4[_0xdccc('0x9d')]();_0x34785e['field']('COUNT(*)');_0x34785e['field'](_0xdccc('0x75'),_0xdccc('0x3d'));var _0x130458=utils['getSelectedTags'](_0x1f01ea);if(!_['isEmpty'](_0x130458)){_0x34785e[_0xdccc('0x13')](_0xdccc('0x9e'),_0x130458);}var _0x27216e={'type':db[_0xdccc('0x6e')][_0xdccc('0x6f')][_0xdccc('0x70')],'raw':!![]};return db[_0xdccc('0x71')][_0xdccc('0x96')](_0x34785e['toString'](),_0x27216e);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 22dcafc..2bc00fc 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fd6=['waiting','talking','unmanaged','total','closed','disposition','UserId','answered','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','then','lodash','../../mysqldb','map','fullname','split','forEach'];(function(_0x427272,_0x5a5946){var _0x41252f=function(_0x3f0ffa){while(--_0x3f0ffa){_0x427272['push'](_0x427272['shift']());}};_0x41252f(++_0x5a5946);}(_0x6fd6,0x81));var _0x66fd=function(_0x59cca4,_0x25319f){_0x59cca4=_0x59cca4-0x0;var _0x543df0=_0x6fd6[_0x59cca4];return _0x543df0;};'use strict';var _=require(_0x66fd('0x0'));var db=require(_0x66fd('0x1'))['db'];function getInteractionUsers(_0x2636aa,_0x14afd9){return new Promise(function(_0x1023d5,_0x1785e1){try{var _0x1ead8f=[];if(_0x14afd9[_0x2636aa]){_0x1ead8f=_0x14afd9[_0x2636aa][_0x66fd('0x2')](function(_0xdde160){return{'id':_0xdde160['id'],'fullname':_0xdde160[_0x66fd('0x3')]};});}return _0x1023d5(_0x1ead8f);}catch(_0x1801f1){_0x1785e1(_0x1801f1);}});}function getInteractionTags(_0x5172f4,_0x3c8118){var _0x150d26=[];if(_0x5172f4){_0x5172f4[_0x66fd('0x4')](',')[_0x66fd('0x5')](function(_0x42d509){_0x150d26['push'](_0x3c8118[_0x42d509]);});}return _0x150d26;}function updateWaitingCounter(_0x49b0da){if(_0x49b0da[_0x66fd('0x6')]){_0x49b0da[_0x66fd('0x6')]-=0x1;}}function updateInteractionCounters(_0x2fe5a3){_0x2fe5a3[_0x66fd('0x6')]=0x0;_0x2fe5a3[_0x66fd('0x7')]=0x0;_0x2fe5a3['answered']=0x0;_0x2fe5a3[_0x66fd('0x8')]=0x0;_0x2fe5a3['abandoned']=0x0;_0x2fe5a3[_0x66fd('0x9')]=0x0;if(_0x2fe5a3[_0x66fd('0xa')]){if(_0x2fe5a3[_0x66fd('0xb')]==='abandoned'){_0x2fe5a3['abandoned']+=0x1;updateWaitingCounter(_0x2fe5a3);}if(_0x2fe5a3[_0x66fd('0xc')]){_0x2fe5a3[_0x66fd('0xd')]+=0x1;if(_0x2fe5a3[_0x66fd('0x7')]){_0x2fe5a3[_0x66fd('0x7')]-=0x1;}}else{if(_0x2fe5a3['disposition']){_0x2fe5a3[_0x66fd('0x8')]+=0x1;updateWaitingCounter(_0x2fe5a3);}}}else{if(!_0x2fe5a3[_0x66fd('0xc')]){_0x2fe5a3['waiting']+=0x1;}if(_0x2fe5a3[_0x66fd('0xc')]){_0x2fe5a3['talking']+=0x1;updateWaitingCounter(_0x2fe5a3);}}_0x2fe5a3[_0x66fd('0x9')]+=0x1;return _0x2fe5a3;}function getLastMessageText(_0x40756d){return db[_0x66fd('0xe')][_0x66fd('0xf')]({'where':{'$and':[{'MailInteractionId':_0x40756d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x66fd('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x66fd('0x11')],'order':_0x66fd('0x12'),'raw':!![]})['then'](function(_0x4ad6f7){if(_0x4ad6f7&&_0x4ad6f7['plainBody']){_0x40756d[_0x66fd('0x13')]=_[_0x66fd('0x14')](_0x4ad6f7['plainBody']);}return _0x40756d;})[_0x66fd('0x15')](function(_0x485017){throw _0x485017;});}exports[_0x66fd('0x16')]=function(_0x3eb32e,_0xb23f7a,_0x47be30,_0x52a731){return new Promise(function(_0x22b397,_0x1b4c36){return getInteractionUsers(_0x3eb32e['id'],_0x47be30)['then'](function(_0x8c9b94){_0x3eb32e[_0x66fd('0x17')]=_0x8c9b94;return getInteractionTags(_0x3eb32e[_0x66fd('0x18')],_0xb23f7a);})['then'](function(_0x2e24ee){_0x3eb32e[_0x66fd('0x19')]=_0x2e24ee;delete _0x3eb32e[_0x66fd('0x18')];return updateInteractionCounters(_0x3eb32e);})[_0x66fd('0x1a')](function(_0x24d564){if(_0x52a731){return getLastMessageText(_0x24d564);}else{return _0x24d564;}})[_0x66fd('0x1a')](function(_0x5582ea){_0x22b397(_0x5582ea);})[_0x66fd('0x15')](function(_0x31cd68){_0x1b4c36(_0x31cd68);});});}; \ No newline at end of file +var _0x2103=['push','waiting','talking','answered','abandoned','closed','disposition','unmanaged','UserId','total','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','forEach'];(function(_0x426751,_0x368e0b){var _0x2964af=function(_0x2070c1){while(--_0x2070c1){_0x426751['push'](_0x426751['shift']());}};_0x2964af(++_0x368e0b);}(_0x2103,0x1e2));var _0x3210=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2103[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3210('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4970c0,_0x245834){return new Promise(function(_0x21f857,_0xf500ac){try{var _0x2baf5d=[];if(_0x245834[_0x4970c0]){_0x2baf5d=_0x245834[_0x4970c0][_0x3210('0x1')](function(_0x11ddc3){return{'id':_0x11ddc3['id'],'fullname':_0x11ddc3[_0x3210('0x2')]};});}return _0x21f857(_0x2baf5d);}catch(_0x450ab7){_0xf500ac(_0x450ab7);}});}function getInteractionTags(_0x1db88c,_0x33bf4e){var _0x8452b1=[];if(_0x1db88c){_0x1db88c['split'](',')[_0x3210('0x3')](function(_0xfb0013){_0x8452b1[_0x3210('0x4')](_0x33bf4e[_0xfb0013]);});}return _0x8452b1;}function updateWaitingCounter(_0x4c239c){if(_0x4c239c['waiting']){_0x4c239c['waiting']-=0x1;}}function updateInteractionCounters(_0x394e9d){_0x394e9d[_0x3210('0x5')]=0x0;_0x394e9d[_0x3210('0x6')]=0x0;_0x394e9d[_0x3210('0x7')]=0x0;_0x394e9d['unmanaged']=0x0;_0x394e9d[_0x3210('0x8')]=0x0;_0x394e9d['total']=0x0;if(_0x394e9d[_0x3210('0x9')]){if(_0x394e9d[_0x3210('0xa')]===_0x3210('0x8')){_0x394e9d[_0x3210('0x8')]+=0x1;updateWaitingCounter(_0x394e9d);}if(_0x394e9d['UserId']){_0x394e9d[_0x3210('0x7')]+=0x1;if(_0x394e9d[_0x3210('0x6')]){_0x394e9d['talking']-=0x1;}}else{if(_0x394e9d[_0x3210('0xa')]){_0x394e9d[_0x3210('0xb')]+=0x1;updateWaitingCounter(_0x394e9d);}}}else{if(!_0x394e9d[_0x3210('0xc')]){_0x394e9d['waiting']+=0x1;}if(_0x394e9d['UserId']){_0x394e9d[_0x3210('0x6')]+=0x1;updateWaitingCounter(_0x394e9d);}}_0x394e9d[_0x3210('0xd')]+=0x1;return _0x394e9d;}function getLastMessageText(_0x529bb5){return db[_0x3210('0xe')][_0x3210('0xf')]({'where':{'$and':[{'MailInteractionId':_0x529bb5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x3210('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x3210('0x11')],'order':_0x3210('0x12'),'raw':!![]})[_0x3210('0x13')](function(_0x573d3a){if(_0x573d3a&&_0x573d3a[_0x3210('0x11')]){_0x529bb5[_0x3210('0x14')]=_[_0x3210('0x15')](_0x573d3a[_0x3210('0x11')]);}return _0x529bb5;})[_0x3210('0x16')](function(_0x105d88){throw _0x105d88;});}exports[_0x3210('0x17')]=function(_0x28f09e,_0x4f75bb,_0xb00a2c,_0x15250c){return new Promise(function(_0x3bb39d,_0x4af274){return getInteractionUsers(_0x28f09e['id'],_0xb00a2c)[_0x3210('0x13')](function(_0x2285a3){_0x28f09e[_0x3210('0x18')]=_0x2285a3;return getInteractionTags(_0x28f09e[_0x3210('0x19')],_0x4f75bb);})[_0x3210('0x13')](function(_0x34643c){_0x28f09e[_0x3210('0x1a')]=_0x34643c;delete _0x28f09e[_0x3210('0x19')];return updateInteractionCounters(_0x28f09e);})['then'](function(_0x376c6c){if(_0x15250c){return getLastMessageText(_0x376c6c);}else{return _0x376c6c;}})['then'](function(_0xdc31e8){_0x3bb39d(_0xdc31e8);})['catch'](function(_0x560ea1){_0x4af274(_0x560ea1);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index b858240..9ab4c13 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8fa=['chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','update','info','catch','toUpperCase','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions'];(function(_0x27fb36,_0x3ba193){var _0x45697f=function(_0x4b66c2){while(--_0x4b66c2){_0x27fb36['push'](_0x27fb36['shift']());}};_0x45697f(++_0x3ba193);}(_0xe8fa,0x17f));var _0xae8f=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xe8fa[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0xae8f('0x0'));var db=require(_0xae8f('0x1'))['db'];var loggers={'openchannel':require(_0xae8f('0x2'))(_0xae8f('0x3')),'mail':require(_0xae8f('0x2'))(_0xae8f('0x4')),'fax':require('../../config/logger')(_0xae8f('0x5')),'sms':require(_0xae8f('0x2'))(_0xae8f('0x6')),'chat':require(_0xae8f('0x2'))(_0xae8f('0x7')),'whatsapp':require(_0xae8f('0x2'))('whatsapp-interactions')};function getAccountFK(_0xb58773){return _[_0xae8f('0x8')](_0xb58773)+(_0xb58773===_0xae8f('0x9')?_0xae8f('0xa'):_0xae8f('0xb'))+'Id';}function getInteractionFK(_0x451e7c){return _[_0xae8f('0x8')](_0x451e7c)+_0xae8f('0xc');}function getInteractionId(_0x44110f,_0x16928f,_0x3d0023){if(_0x44110f&&_0x44110f[_[_0xae8f('0xd')](_0x3d0023)+'InteractionId']){return _0x44110f[_['upperFirst'](_0x3d0023)+'InteractionId'];}else if(_0x44110f&&_0x44110f['id']){return _0x44110f['id'];}else if(_0x16928f&&_0x16928f['id']){return _0x16928f['id'];}else{return _0xae8f('0xe');}}function getInteractionsTables(_0x21f5df){return{'accounts':_0x21f5df+'_'+(_0x21f5df===_0xae8f('0x9')?_0xae8f('0xf'):_0xae8f('0x10')),'interactions':_0x21f5df+_0xae8f('0x11'),'interactionsTags':_0x21f5df+_0xae8f('0x12'),'messages':_0x21f5df+_0xae8f('0x13'),'userInteractions':'user_has_'+_0x21f5df+_0xae8f('0x11')};}function getSelectedTags(_0x20191b){var _0x1aadb6=[];if(_0x20191b){_0x1aadb6=Array[_0xae8f('0x14')](_0x20191b)?_0x20191b:[_0x20191b];}return _0x1aadb6;}function log(_0x16105b,_0x3bc6dc,_0x5a2b42,_0x255b6d,_0x1ef838,_0x1326ea){loggers[_0x1ef838[_0xae8f('0x15')]()][_0x16105b](_0xae8f('0x16'),_0x1326ea['toUpperCase'](),_0x3bc6dc?_0x3bc6dc['id']:null,_0x3bc6dc?_0x3bc6dc[_0xae8f('0x17')]:null,_0x3bc6dc?_0x3bc6dc[_0xae8f('0x18')]:null,getInteractionId(_0x5a2b42,_0x255b6d,_0x1ef838),_0x5a2b42?JSON[_0xae8f('0x19')](_0x5a2b42):_0xae8f('0x1a'));}function updateUser(_0x3244af,_0x1beb49,_0x48f34b,_0xd7e8d2,_0x212d9f){db[_[_0xae8f('0xd')](_0xd7e8d2)+_0xae8f('0x1b')][_0xae8f('0x1c')]({'where':{'id':getInteractionId(_0x1beb49,_0x48f34b,_0xd7e8d2)}})[_0xae8f('0x1d')](function(_0x183d1d){if(_0x183d1d){return _0x183d1d[_0xae8f('0x1e')]({'UserId':_0x3244af?_0x3244af['id']:null});}})[_0xae8f('0x1d')](function(_0x3a8a99){if(_0x3a8a99){log(_0xae8f('0x1f'),_0x3244af,_0x1beb49,_0x48f34b,_0xd7e8d2,_0x212d9f);}})[_0xae8f('0x20')](function(){log('error',_0x3244af,_0x1beb49,_0x48f34b,_0xd7e8d2,_0x212d9f);});}function logAcceptMessage(_0x2c19b8,_0x1155d2,_0x2924a4,_0x5b14c5){var _0x5a1867=loggers[_0x2c19b8[_0xae8f('0x15')]()];var _0x70bd80=_0x1155d2['id'];var _0x3af725=_0x1155d2['name'];var _0xf5a57d=_0x1155d2['role'];var _0x865a7d=JSON[_0xae8f('0x19')](_0x5b14c5||null);_0x5a1867[_0xae8f('0x1f')]('['+_0x2c19b8[_0xae8f('0x21')]()+_0xae8f('0x22')+_0x70bd80+_0xae8f('0x23')+_0x3af725+_0xae8f('0x24')+_0xf5a57d+'\x20interaction='+_0x2924a4+_0xae8f('0x25')+_0x865a7d);}module[_0xae8f('0x26')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x826f=['null','findOne','info','catch','error','role','stringify','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20body=','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','isArray','toLowerCase','toUpperCase','name'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x826f,0xb4));var _0xf826=function(_0x3e26d0,_0x2c23c0){_0x3e26d0=_0x3e26d0-0x0;var _0x834695=_0x826f[_0x3e26d0];return _0x834695;};'use strict';var _=require(_0xf826('0x0'));var db=require(_0xf826('0x1'))['db'];var loggers={'openchannel':require(_0xf826('0x2'))(_0xf826('0x3')),'mail':require(_0xf826('0x2'))(_0xf826('0x4')),'fax':require(_0xf826('0x2'))(_0xf826('0x5')),'sms':require(_0xf826('0x2'))(_0xf826('0x6')),'chat':require(_0xf826('0x2'))(_0xf826('0x7')),'whatsapp':require('../../config/logger')(_0xf826('0x8'))};function getAccountFK(_0x16eb59){return _[_0xf826('0x9')](_0x16eb59)+(_0x16eb59===_0xf826('0xa')?_0xf826('0xb'):_0xf826('0xc'))+'Id';}function getInteractionFK(_0x375f99){return _[_0xf826('0x9')](_0x375f99)+'InteractionId';}function getInteractionId(_0x2a35f3,_0x47c93a,_0x1cf27a){if(_0x2a35f3&&_0x2a35f3[_[_0xf826('0xd')](_0x1cf27a)+_0xf826('0xe')]){return _0x2a35f3[_['upperFirst'](_0x1cf27a)+_0xf826('0xe')];}else if(_0x2a35f3&&_0x2a35f3['id']){return _0x2a35f3['id'];}else if(_0x47c93a&&_0x47c93a['id']){return _0x47c93a['id'];}else{return _0xf826('0xf');}}function getInteractionsTables(_0x2ac002){return{'accounts':_0x2ac002+'_'+(_0x2ac002===_0xf826('0xa')?_0xf826('0x10'):_0xf826('0x11')),'interactions':_0x2ac002+_0xf826('0x12'),'interactionsTags':_0x2ac002+_0xf826('0x13'),'messages':_0x2ac002+'_messages','userInteractions':'user_has_'+_0x2ac002+_0xf826('0x12')};}function getSelectedTags(_0x39f09a){var _0x538acc=[];if(_0x39f09a){_0x538acc=Array[_0xf826('0x14')](_0x39f09a)?_0x39f09a:[_0x39f09a];}return _0x538acc;}function log(_0x2184f8,_0x4e36d9,_0x1ae514,_0x39fa00,_0x8afcb,_0x133906){loggers[_0x8afcb[_0xf826('0x15')]()][_0x2184f8]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x133906[_0xf826('0x16')](),_0x4e36d9?_0x4e36d9['id']:null,_0x4e36d9?_0x4e36d9[_0xf826('0x17')]:null,_0x4e36d9?_0x4e36d9['role']:null,getInteractionId(_0x1ae514,_0x39fa00,_0x8afcb),_0x1ae514?JSON['stringify'](_0x1ae514):_0xf826('0x18'));}function updateUser(_0x5c011e,_0x213f6b,_0x50f08d,_0x10579f,_0x4359f1){db[_[_0xf826('0xd')](_0x10579f)+'Interaction'][_0xf826('0x19')]({'where':{'id':getInteractionId(_0x213f6b,_0x50f08d,_0x10579f)}})['then'](function(_0x40a7b5){if(_0x40a7b5){return _0x40a7b5['update']({'UserId':_0x5c011e?_0x5c011e['id']:null});}})['then'](function(_0x4bbe29){if(_0x4bbe29){log(_0xf826('0x1a'),_0x5c011e,_0x213f6b,_0x50f08d,_0x10579f,_0x4359f1);}})[_0xf826('0x1b')](function(){log(_0xf826('0x1c'),_0x5c011e,_0x213f6b,_0x50f08d,_0x10579f,_0x4359f1);});}function logAcceptMessage(_0xb79844,_0x457893,_0x33781d,_0x2cbd96){var _0x6f9398=loggers[_0xb79844['toLowerCase']()];var _0xea4938=_0x457893['id'];var _0x9aa7c5=_0x457893['name'];var _0x32f192=_0x457893[_0xf826('0x1d')];var _0xc02194=JSON[_0xf826('0x1e')](_0x2cbd96||null);_0x6f9398[_0xf826('0x1a')]('['+_0xb79844[_0xf826('0x16')]()+_0xf826('0x1f')+_0xea4938+_0xf826('0x20')+_0x9aa7c5+'\x20role='+_0x32f192+'\x20interaction='+_0x33781d+_0xf826('0x21')+_0xc02194);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 7c8d0f6..16b870b 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 _0xf8c4=['format','update','utf8','final','parse','License','findOne','then','count','User','isUserLimit','util','composable-middleware','../../mysqldb','data1','license','split','aes-256-ctr'];(function(_0x1efd6f,_0x539485){var _0x44c2d9=function(_0x59e226){while(--_0x59e226){_0x1efd6f['push'](_0x1efd6f['shift']());}};_0x44c2d9(++_0x539485);}(_0xf8c4,0x1a9));var _0x4f8c=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0xf8c4[_0x4492af];return _0x216729;};'use strict';var crypto=require('crypto');var util=require(_0x4f8c('0x0'));var compose=require(_0x4f8c('0x1'));var db=require(_0x4f8c('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xd934b1,_0x25db0f){if(_0xd934b1&&_0x25db0f){if(_0x25db0f[_0x4f8c('0x3')]&&_0x25db0f[_0x4f8c('0x4')]){var _0x53f4e1=_0x25db0f[_0x4f8c('0x3')];var _0x543f00=_0x25db0f[_0x4f8c('0x4')];var _0x4f4f97=_0x53f4e1[_0x4f8c('0x5')]('-')[0x4];var _0x5241a9=_0x53f4e1[_0x4f8c('0x5')]('-')[0x0];var _0x51bc78=crypto['createDecipher'](_0x4f8c('0x6'),util[_0x4f8c('0x7')]('%s:%s:%s',_0x4f4f97,_0x53f4e1,_0x5241a9));var _0x38d5b9=_0x51bc78[_0x4f8c('0x8')](_0x543f00,'base64',_0x4f8c('0x9'));_0x38d5b9+=_0x51bc78[_0x4f8c('0xa')](_0x4f8c('0x9'));var _0x1f869a=JSON[_0x4f8c('0xb')](_0x38d5b9);return _0x1f869a['hasOwnProperty'](_0xd934b1)?_0x1f869a[_0xd934b1]:null;}}return null;}function isLimit(_0x39bd19,_0x3347f4,_0x2a73e8,_0x55d1c5){var _0x2be9bd=_0x3347f4;return compose()['use'](function(_0x41bc01,_0x57a6e9,_0x4e0db4){return db[_0x4f8c('0xc')][_0x4f8c('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x4f8c('0xe')](function(_0xb411d2){var _0x1536be=getValueFromLicense(_0x39bd19,_0xb411d2);return _0x1536be?_0x1536be:_0x2be9bd;})[_0x4f8c('0xe')](function(_0x3825f0){_0x2be9bd=_0x3825f0;return _0x2a73e8[_0x4f8c('0xf')](_0x55d1c5);})[_0x4f8c('0xe')](function(_0xff0a82){if(_0xff0a82>=_0x2be9bd){return _0x57a6e9['status'](0x193)['json']({'message':util[_0x4f8c('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x39bd19)});}_0x4e0db4();})['catch'](function(_0x480534){_0x4e0db4(_0x480534);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4f8c('0x10')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x4f8c('0x11')]=isUserLimit; \ No newline at end of file +var _0x0093=['parse','hasOwnProperty','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','update','utf8'];(function(_0x36749d,_0x1c87cd){var _0x4cd973=function(_0x1d9b42){while(--_0x1d9b42){_0x36749d['push'](_0x36749d['shift']());}};_0x4cd973(++_0x1c87cd);}(_0x0093,0x1d7));var _0x3009=function(_0x2ecf1c,_0x4cfaa9){_0x2ecf1c=_0x2ecf1c-0x0;var _0x5ca267=_0x0093[_0x2ecf1c];return _0x5ca267;};'use strict';var crypto=require(_0x3009('0x0'));var util=require(_0x3009('0x1'));var compose=require(_0x3009('0x2'));var db=require(_0x3009('0x3'))['db'];var config=require(_0x3009('0x4'));function getValueFromLicense(_0x16c84d,_0x57105f){if(_0x16c84d&&_0x57105f){if(_0x57105f[_0x3009('0x5')]&&_0x57105f[_0x3009('0x6')]){var _0x477ab2=_0x57105f[_0x3009('0x5')];var _0x311ee1=_0x57105f['license'];var _0x1c94a5=_0x477ab2['split']('-')[0x4];var _0x33758d=_0x477ab2[_0x3009('0x7')]('-')[0x0];var _0x291793=crypto[_0x3009('0x8')](_0x3009('0x9'),util['format']('%s:%s:%s',_0x1c94a5,_0x477ab2,_0x33758d));var _0xdefa7=_0x291793[_0x3009('0xa')](_0x311ee1,'base64',_0x3009('0xb'));_0xdefa7+=_0x291793['final'](_0x3009('0xb'));var _0x52d8a0=JSON[_0x3009('0xc')](_0xdefa7);return _0x52d8a0[_0x3009('0xd')](_0x16c84d)?_0x52d8a0[_0x16c84d]:null;}}return null;}function isLimit(_0x399dae,_0x1532d7,_0x3f1c6c,_0x5e4b7a){var _0x430ca3=_0x1532d7;return compose()['use'](function(_0x1fbbcc,_0x585fa2,_0x5508a4){return db[_0x3009('0xe')][_0x3009('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x3009('0x10')](function(_0x4cf957){var _0x50b3e5=getValueFromLicense(_0x399dae,_0x4cf957);return _0x50b3e5?_0x50b3e5:_0x430ca3;})[_0x3009('0x10')](function(_0x58088a){_0x430ca3=_0x58088a;return _0x3f1c6c[_0x3009('0x11')](_0x5e4b7a);})[_0x3009('0x10')](function(_0x162742){if(_0x162742>=_0x430ca3){return _0x585fa2['status'](0x193)[_0x3009('0x12')]({'message':util['format'](_0x3009('0x13'),_0x399dae)});}_0x5508a4();})[_0x3009('0x14')](function(_0x555514){_0x5508a4(_0x555514);});});}function isUserLimit(){return isLimit(_0x3009('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x3009('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 787b963..90870a4 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 _0x93ad=['shift','match','indexOf','map','conditions','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','start','pop','utcOffset','minutes','seconds','lodash','moment','[$or]','replace','[$and]','split','length','slice','forEach'];(function(_0x24c80a,_0x3e2fb5){var _0x56a264=function(_0x17a311){while(--_0x17a311){_0x24c80a['push'](_0x24c80a['shift']());}};_0x56a264(++_0x3e2fb5);}(_0x93ad,0x123));var _0xd93a=function(_0x5bda3b,_0x41160f){_0x5bda3b=_0x5bda3b-0x0;var _0x431bb9=_0x93ad[_0x5bda3b];return _0x431bb9;};'use strict';var _=require(_0xd93a('0x0'));var moment=require(_0xd93a('0x1'));exports['parseSearch']=function(_0xde964c){var _0x58c06e={'conditions':[]};_0x58c06e['sqlOperator']=_['startsWith'](_0xde964c,_0xd93a('0x2'))?'or':'and';var _0x15cfa2=_0xde964c[_0xd93a('0x3')](_0xd93a('0x4'),'')[_0xd93a('0x3')](_0xd93a('0x2'),'')[_0xd93a('0x5')]('||');for(var _0x28ff28=0x0;_0x28ff28<_0x15cfa2[_0xd93a('0x6')];_0x28ff28++){var _0x46550c=_0x15cfa2[_0x28ff28][_0xd93a('0x5')](':=');var _0x4f7a6c=_0x46550c[0x0];var _0x42592e=_0x46550c[_0xd93a('0x7')](0x1);_0x42592e[_0xd93a('0x8')](function(_0xdbfab9){var _0x52953c=_0xdbfab9['split']('[')[_0xd93a('0x9')]();var _0xa56066=_0xdbfab9[_0xd93a('0xa')](/\[(.*?)\]/g);_0xa56066[_0xd93a('0x8')](function(_0x3f618b){var _0x29ea5a=_0x3f618b['split']('[')['filter'](function(_0x32c848){return _0x32c848[_0xd93a('0xb')](']')>-0x1;})[_0xd93a('0xc')](function(_0x4491b3){return _0x4491b3['split'](']')[0x0];})[0x0];_0x58c06e[_0xd93a('0xd')]['push']({'field':_0x4f7a6c,'operator':_0x52953c,'value':_0x29ea5a});});});}return _0x58c06e;};exports[_0xd93a('0xe')]=function(_0x44d8fb,_0x9289f7,_0x49499a){var _0x46d69d={};if(_0x9289f7===_0xd93a('0xf')){if(_0x49499a[_0xd93a('0x10')]==='$eq'){_0x49499a[_0xd93a('0x10')]=_0xd93a('0x11');_0x49499a[_0xd93a('0x12')]+=','+_0x49499a[_0xd93a('0x12')];}else if(_[_0xd93a('0x13')]([_0xd93a('0x14'),_0xd93a('0x15')],_0x49499a['operator'])){_0x49499a[_0xd93a('0x12')]=moment(_0x49499a[_0xd93a('0x12')])[_0xd93a('0x16')](0x1,'days')[_0xd93a('0x17')]('YYYY-MM-DD');}}if(_0x49499a[_0xd93a('0x18')]){_0x9289f7=_0x49499a[_0xd93a('0x18')];_0x46d69d[_0xd93a('0x19')]=_0xd93a('0x1a')+_0x44d8fb+'.'+_0x49499a[_0xd93a('0x1b')]+_0xd93a('0x1c')+_0x49499a[_0xd93a('0x18')]+')\x20'+parseOperator(_0x49499a[_0xd93a('0x10')]);}else{_0x46d69d[_0xd93a('0x19')]=_0x44d8fb+'.'+_0x49499a['field']+'\x20'+parseOperator(_0x49499a[_0xd93a('0x10')]);}if(_[_0xd93a('0x13')]([_0xd93a('0x1d'),_0xd93a('0x1e')],_0x49499a[_0xd93a('0x10')]))_0x46d69d[_0xd93a('0x19')]='('+_0x46d69d[_0xd93a('0x19')]+'\x20OR\x20'+_0x44d8fb+'.'+_0x49499a['field']+_0xd93a('0x1f');_0x46d69d[_0xd93a('0x12')]=parseValue(_0x9289f7,_0x49499a[_0xd93a('0x10')],_0x49499a[_0xd93a('0x12')]);return _0x46d69d;};function parseOperator(_0xa75fdc){var _0x2a1bee;switch(_0xa75fdc){case _0xd93a('0x20'):_0x2a1bee=_0xd93a('0x21');break;case _0xd93a('0x1e'):_0x2a1bee='NOT\x20IN\x20?';break;case _0xd93a('0x22'):_0x2a1bee=_0xd93a('0x23');break;case _0xd93a('0x1d'):_0x2a1bee='<>\x20?';break;case _0xd93a('0x24'):case _0xd93a('0x25'):case _0xd93a('0x26'):_0x2a1bee=_0xd93a('0x27');break;case _0xd93a('0x28'):_0x2a1bee=_0xd93a('0x29');break;case'$gt':_0x2a1bee=_0xd93a('0x2a');break;case _0xd93a('0x15'):_0x2a1bee='<=\x20?';break;case _0xd93a('0x2b'):_0x2a1bee=_0xd93a('0x2c');break;case _0xd93a('0x11'):_0x2a1bee='BETWEEN\x20?\x20AND\x20?';break;}return _0x2a1bee;}function parseValue(_0x1bef77,_0x55be73,_0x11fdf0){var _0x117797={'start':undefined,'end':undefined};switch(_0x55be73){case _0xd93a('0x20'):case _0xd93a('0x1e'):_0x117797[_0xd93a('0x2d')]=_0x11fdf0[_0xd93a('0x5')](',');break;case'$substring':_0x117797[_0xd93a('0x2d')]='%'+_0x11fdf0+'%';break;case _0xd93a('0x25'):_0x117797[_0xd93a('0x2d')]=_0x11fdf0+'%';break;case'$endsWith':_0x117797[_0xd93a('0x2d')]='%'+_0x11fdf0;break;case _0xd93a('0x11'):var _0xa1b6c0=_0x11fdf0[_0xd93a('0x5')](',');var _0x11fdf0=_0xa1b6c0[_0xd93a('0x9')]();var _0x9150e9=_0xa1b6c0[_0xd93a('0x2e')]();if(_0x1bef77===_0xd93a('0xf')){_0x11fdf0=moment(_0x11fdf0)[_0xd93a('0x2f')](0x0,!![])[_0xd93a('0x17')]();_0x9150e9=moment(_0x9150e9)['utcOffset'](0x0,!![])[_0xd93a('0x16')](0x17,'hours')[_0xd93a('0x16')](0x3b,_0xd93a('0x30'))[_0xd93a('0x16')](0x3b,_0xd93a('0x31'))[_0xd93a('0x17')]();}_0x117797={'start':_0x11fdf0,'end':_0x9150e9};break;default:_0x117797['start']=_0x11fdf0;break;}return _0x117797;} \ No newline at end of file +var _0x2bab=['>=\x20?','start','pop','utcOffset','hours','minutes','seconds','moment','parseSearch','and','replace','[$or]','split','length','forEach','shift','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','format','castTo','text','CAST(','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','<=\x20?','$gte'];(function(_0x5731ec,_0x47096b){var _0x3e43cf=function(_0x152f0c){while(--_0x152f0c){_0x5731ec['push'](_0x5731ec['shift']());}};_0x3e43cf(++_0x47096b);}(_0x2bab,0x106));var _0xb2ba=function(_0x41814c,_0x2c9372){_0x41814c=_0x41814c-0x0;var _0x3de490=_0x2bab[_0x41814c];return _0x3de490;};'use strict';var _=require('lodash');var moment=require(_0xb2ba('0x0'));exports[_0xb2ba('0x1')]=function(_0x402ef5){var _0x131b2f={'conditions':[]};_0x131b2f['sqlOperator']=_['startsWith'](_0x402ef5,'[$or]')?'or':_0xb2ba('0x2');var _0x5141d6=_0x402ef5['replace']('[$and]','')[_0xb2ba('0x3')](_0xb2ba('0x4'),'')[_0xb2ba('0x5')]('||');for(var _0x69a460=0x0;_0x69a460<_0x5141d6[_0xb2ba('0x6')];_0x69a460++){var _0x3c32d3=_0x5141d6[_0x69a460]['split'](':=');var _0x25b533=_0x3c32d3[0x0];var _0x1aa43e=_0x3c32d3['slice'](0x1);_0x1aa43e[_0xb2ba('0x7')](function(_0x1618bf){var _0x1ac563=_0x1618bf[_0xb2ba('0x5')]('[')[_0xb2ba('0x8')]();var _0x548d81=_0x1618bf['match'](/\[(.*?)\]/g);_0x548d81[_0xb2ba('0x7')](function(_0x5d4dd8){var _0x251ab3=_0x5d4dd8[_0xb2ba('0x5')]('[')[_0xb2ba('0x9')](function(_0xda68c6){return _0xda68c6[_0xb2ba('0xa')](']')>-0x1;})['map'](function(_0x408340){return _0x408340[_0xb2ba('0x5')](']')[0x0];})[0x0];_0x131b2f[_0xb2ba('0xb')][_0xb2ba('0xc')]({'field':_0x25b533,'operator':_0x1ac563,'value':_0x251ab3});});});}return _0x131b2f;};exports[_0xb2ba('0xd')]=function(_0x40e1c5,_0x3b99df,_0x265fa4){var _0xcd355f={};if(_0x3b99df===_0xb2ba('0xe')){if(_0x265fa4[_0xb2ba('0xf')]===_0xb2ba('0x10')){_0x265fa4[_0xb2ba('0xf')]=_0xb2ba('0x11');_0x265fa4[_0xb2ba('0x12')]+=','+_0x265fa4[_0xb2ba('0x12')];}else if(_[_0xb2ba('0x13')](['$gt',_0xb2ba('0x14')],_0x265fa4[_0xb2ba('0xf')])){_0x265fa4[_0xb2ba('0x12')]=moment(_0x265fa4[_0xb2ba('0x12')])[_0xb2ba('0x15')](0x1,'days')[_0xb2ba('0x16')]('YYYY-MM-DD');}}if(_0x265fa4[_0xb2ba('0x17')]){_0x3b99df=_0x265fa4['castTo'];_0xcd355f[_0xb2ba('0x18')]=_0xb2ba('0x19')+_0x40e1c5+'.'+_0x265fa4[_0xb2ba('0x1a')]+'\x20AS\x20'+_0x265fa4[_0xb2ba('0x17')]+')\x20'+parseOperator(_0x265fa4[_0xb2ba('0xf')]);}else{_0xcd355f['text']=_0x40e1c5+'.'+_0x265fa4[_0xb2ba('0x1a')]+'\x20'+parseOperator(_0x265fa4[_0xb2ba('0xf')]);}if(_[_0xb2ba('0x13')](['$ne',_0xb2ba('0x1b')],_0x265fa4[_0xb2ba('0xf')]))_0xcd355f[_0xb2ba('0x18')]='('+_0xcd355f[_0xb2ba('0x18')]+_0xb2ba('0x1c')+_0x40e1c5+'.'+_0x265fa4[_0xb2ba('0x1a')]+_0xb2ba('0x1d');_0xcd355f[_0xb2ba('0x12')]=parseValue(_0x3b99df,_0x265fa4['operator'],_0x265fa4[_0xb2ba('0x12')]);return _0xcd355f;};function parseOperator(_0x430492){var _0x21537c;switch(_0x430492){case _0xb2ba('0x1e'):_0x21537c=_0xb2ba('0x1f');break;case'$notIn':_0x21537c=_0xb2ba('0x20');break;case'$eq':_0x21537c=_0xb2ba('0x21');break;case _0xb2ba('0x22'):_0x21537c='<>\x20?';break;case _0xb2ba('0x23'):case _0xb2ba('0x24'):case _0xb2ba('0x25'):_0x21537c=_0xb2ba('0x26');break;case _0xb2ba('0x27'):_0x21537c=_0xb2ba('0x28');break;case _0xb2ba('0x29'):_0x21537c='>\x20?';break;case _0xb2ba('0x14'):_0x21537c=_0xb2ba('0x2a');break;case _0xb2ba('0x2b'):_0x21537c=_0xb2ba('0x2c');break;case'$between':_0x21537c='BETWEEN\x20?\x20AND\x20?';break;}return _0x21537c;}function parseValue(_0x39105d,_0x20ab66,_0x2c10d7){var _0x26a0c3={'start':undefined,'end':undefined};switch(_0x20ab66){case _0xb2ba('0x1e'):case _0xb2ba('0x1b'):_0x26a0c3[_0xb2ba('0x2d')]=_0x2c10d7[_0xb2ba('0x5')](',');break;case _0xb2ba('0x23'):_0x26a0c3[_0xb2ba('0x2d')]='%'+_0x2c10d7+'%';break;case _0xb2ba('0x24'):_0x26a0c3['start']=_0x2c10d7+'%';break;case'$endsWith':_0x26a0c3[_0xb2ba('0x2d')]='%'+_0x2c10d7;break;case _0xb2ba('0x11'):var _0x5a4ec0=_0x2c10d7[_0xb2ba('0x5')](',');var _0x2c10d7=_0x5a4ec0[_0xb2ba('0x8')]();var _0x5b68ba=_0x5a4ec0[_0xb2ba('0x2e')]();if(_0x39105d===_0xb2ba('0xe')){_0x2c10d7=moment(_0x2c10d7)[_0xb2ba('0x2f')](0x0,!![])[_0xb2ba('0x16')]();_0x5b68ba=moment(_0x5b68ba)[_0xb2ba('0x2f')](0x0,!![])['add'](0x17,_0xb2ba('0x30'))[_0xb2ba('0x15')](0x3b,_0xb2ba('0x31'))['add'](0x3b,_0xb2ba('0x32'))[_0xb2ba('0x16')]();}_0x26a0c3={'start':_0x2c10d7,'end':_0x5b68ba};break;default:_0x26a0c3[_0xb2ba('0x2d')]=_0x2c10d7;break;}return _0x26a0c3;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c86bbfc..f2035fc 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 _0xfae0=['name','uniqueid','isArray','split','offset','sort','map','indexOf','priority','cast','unsigned','col','omit','isString','length','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','{EXPR}','replace','push','join','getOptions','query','$id','intersection','attributes','fields','nolimit','limit','order','where','pick','object','filter','value','merge','type','lower','options','include','escapeLIKESpecialChars','sequelize','moment','../../mysqldb','parse','includes','keys','model','alias','raw','filters','isEmpty','forOwn','find','isPlainObject','format','$lte','YYYY-MM-DD','utc'];(function(_0x13cf5f,_0x5427f5){var _0x4c5537=function(_0x17432c){while(--_0x17432c){_0x13cf5f['push'](_0x13cf5f['shift']());}};_0x4c5537(++_0x5427f5);}(_0xfae0,0xab));var _0x0fae=function(_0x2eb35d,_0x4a7a45){_0x2eb35d=_0x2eb35d-0x0;var _0x1f9854=_0xfae0[_0x2eb35d];return _0x1f9854;};'use strict';var _=require('lodash');var sequelize=require(_0x0fae('0x0'));var moment=require(_0x0fae('0x1'));var db=require(_0x0fae('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xa9a45f){var _0x25c5e4=['ne'];try{var _0xefac5e=JSON[_0x0fae('0x3')](_0xa9a45f);var _0x3e1ee4=Object['keys'](_0xefac5e)[0x0];return _0x25c5e4[_0x0fae('0x4')](_0x3e1ee4);}catch(_0xdaab17){return![];}}function getOperatorValue(_0x44a444){var _0x4c5fa2=JSON[_0x0fae('0x3')](_0x44a444);var _0x1d5f0b=Object[_0x0fae('0x5')](_0x4c5fa2)[0x0];var _0x4716b9=_0x4c5fa2[_0x1d5f0b];return{['$'+_0x1d5f0b]:_0x4716b9};}function parseIncludeModel(_0x38567e){var _0x443055=JSON['parse'](_0x38567e);return{'model':db[_0x443055[_0x0fae('0x6')]],'as':_0x443055[_0x0fae('0x7')],'attributes':_0x443055['fields'],'raw':_0x443055[_0x0fae('0x8')]};}exports['fields']=function(_0x2d3301){var _0x224319=null;if(_0x2d3301){_0x224319=_0x2d3301['split'](',');}return _0x224319;};exports[_0x0fae('0x9')]=function(_0x5ed454,_0x3d83bb){var _0x5dfaed={};if(!_[_0x0fae('0xa')](_0x5ed454)){_[_0x0fae('0xb')](_0x5ed454,function(_0x4d595f,_0x41bdf4){try{if(_0x3d83bb){var _0x316179=_[_0x0fae('0xc')](_0x3d83bb,{'name':_0x41bdf4})||{};if(hasSequelizeOperator(_0x4d595f)){_0x5dfaed[_0x41bdf4]=getOperatorValue(_0x4d595f);}else if(_0x316179['type']==='DATE'&&_[_0x0fae('0xd')](_0x4d595f)){var _0x3c62ba=JSON[_0x0fae('0x3')](_0x4d595f);var _0x5b0f0f={'$gte':moment(moment(_0x3c62ba['$gte'])[_0x0fae('0xe')]('YYYY-MM-DD'))['utc']()[_0x0fae('0xe')](),'$lte':moment(moment(_0x3c62ba[_0x0fae('0xf')])[_0x0fae('0xe')](_0x0fae('0x10')))[_0x0fae('0x11')]()['subtract'](0x1,'s')[_0x0fae('0xe')]()};_0x5dfaed[_0x41bdf4]=_0x5b0f0f;}else if(_0x316179[_0x0fae('0x12')]===_0x0fae('0x13')){_0x5dfaed[_0x41bdf4]=_0x4d595f;}else{_0x5dfaed[_0x41bdf4]=_['isArray'](_0x4d595f)?_0x4d595f:JSON['parse'](_0x4d595f);}}else{_0x5dfaed[_0x41bdf4]=_[_0x0fae('0x14')](_0x4d595f)?_0x4d595f:JSON[_0x0fae('0x3')](_0x4d595f);}}catch(_0x57cd07){_0x5dfaed[_0x41bdf4]=_0x4d595f[_0x0fae('0x15')](',');}});}return _0x5dfaed;};exports['limit']=function(_0x34239a){_0x34239a=parseInt(_0x34239a,0xa);if(!_0x34239a||_0x34239a<0x0){_0x34239a=LIMIT_VALUE;}return _0x34239a;};exports[_0x0fae('0x16')]=function(_0x5d813d){_0x5d813d=parseInt(_0x5d813d,0xa);if(!_0x5d813d||_0x5d813d<0x0){_0x5d813d=0x0;}return _0x5d813d;};exports[_0x0fae('0x17')]=function(_0x133398){var _0x2b57d5,_0x4812e6=null;if(_0x133398){_0x2b57d5=_0x133398[_0x0fae('0x15')](',');_0x4812e6=_[_0x0fae('0x18')](_0x2b57d5,function(_0x33893e){if(_0x33893e[_0x0fae('0x19')]('-')===0x0){return[_0x33893e===_0x0fae('0x1a')?sequelize[_0x0fae('0x1b')](sequelize['col'](_0x0fae('0x1a')),_0x0fae('0x1c')):_0x33893e['substr'](0x1),'DESC'];}else{return[_0x33893e===_0x0fae('0x1a')?sequelize[_0x0fae('0x1b')](sequelize[_0x0fae('0x1d')](_0x0fae('0x1a')),_0x0fae('0x1c')):_0x33893e,'ASC'];}});}return _0x4812e6;};exports[_0x0fae('0x1e')]=function(_0x2adde9,_0x158aca){if(_['isEmpty'](_0x2adde9)){return _0x2adde9;}if(_[_0x0fae('0x14')](_0x2adde9)){for(var _0x5d3557=0x0;_0x5d3557<_0x2adde9['length'];_0x5d3557+=0x1){_0x2adde9[_0x5d3557]=this[_0x0fae('0x1e')](_0x2adde9[_0x5d3557],_0x158aca);}return _0x2adde9;}if(!_['isObject'](_0x2adde9)){return _0x2adde9;}if(_[_0x0fae('0x1f')](_0x158aca)){_0x158aca=[_0x158aca];}if(!_[_0x0fae('0x14')](_0x158aca)){return _0x2adde9;}for(var _0x20f332=0x0;_0x20f332<_0x158aca[_0x0fae('0x20')];_0x20f332+=0x1){_[_0x0fae('0x21')](_0x2adde9,_0x158aca[_0x20f332]);}for(var _0x1fa978 in _0x2adde9){if(_0x2adde9[_0x0fae('0x22')](_0x1fa978)){_0x2adde9[_0x1fa978]=this['omit'](_0x2adde9[_0x1fa978],_0x158aca);}}return _0x2adde9;};exports['isNumeric']=function(_0x4e32af){return _0x4e32af['match'](RegExp(_0x0fae('0x23')))?!![]:![];};exports[_0x0fae('0x24')]=function(_0x1d8b06){return _0x1d8b06[_0x0fae('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x0fae('0x26')]=function(_0x2e8232,_0x984a8c){var _0x5b03d0=[];var _0x3c3db3=/([^:]")"+/g;var _0x26de10=/[*<>~@-]/g;var _0x1692df=/[ `!@#$%^&*()_\-?~<>]/;var _0x3869b9=/[ ,]+/;var _0x5491e4=_0x984a8c?'\x22{EXPR}\x22':_0x0fae('0x27');if(_0x984a8c){_0x2e8232=_0x2e8232[_0x0fae('0x28')](_0x26de10,'\x20')['trim']();}_0x2e8232['split'](_0x3869b9)['forEach'](function(_0x477e03){_0x477e03=_0x477e03[_0x0fae('0x28')](_0x3c3db3,'$1');_0x477e03='+'+_0x477e03+'*';var _0x439ada=_0x477e03[_0x0fae('0x25')](_0x1692df);if(_0x439ada){_0x477e03='\x22'+_0x477e03+'\x22';}_0x5b03d0[_0x0fae('0x29')](_0x477e03);});_0x5491e4=_0x5491e4[_0x0fae('0x28')](_0x0fae('0x27'),_0x5b03d0[_0x0fae('0x2a')]('\x20'));return _0x5491e4;};exports[_0x0fae('0x2b')]=function(_0x3744b6,_0x5f2c9f,_0x4ef82e){var _0x1a31bd={},_0x4b8e8b={};if(_0x5f2c9f[_0x0fae('0x2c')]['$id']){_0x5f2c9f[_0x0fae('0x2c')]['id']=_0x5f2c9f['query'][_0x0fae('0x2d')];delete _0x5f2c9f['query'][_0x0fae('0x2d')];}_0x1a31bd['model']=_[_0x0fae('0x18')](_0x3744b6,_0x0fae('0x12'));_0x1a31bd['query']=_['keys'](_0x5f2c9f['query']);_0x1a31bd['filters']=_[_0x0fae('0x2e')](_0x1a31bd[_0x0fae('0x6')],_0x1a31bd[_0x0fae('0x2c')]);_0x4b8e8b[_0x0fae('0x2f')]=_[_0x0fae('0x2e')](_0x1a31bd['model'],this[_0x0fae('0x30')](_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x30')]));_0x4b8e8b['attributes']=_0x4b8e8b[_0x0fae('0x2f')][_0x0fae('0x20')]?_0x4b8e8b[_0x0fae('0x2f')]:_0x1a31bd['model'];if(!_0x5f2c9f[_0x0fae('0x2c')]['hasOwnProperty'](_0x0fae('0x31'))){_0x4b8e8b[_0x0fae('0x32')]=this[_0x0fae('0x32')](_0x5f2c9f[_0x0fae('0x2c')]['limit']);_0x4b8e8b[_0x0fae('0x16')]=this['offset'](_0x5f2c9f['query'][_0x0fae('0x16')]);}_0x4b8e8b[_0x0fae('0x33')]=this[_0x0fae('0x17')](_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x17')]);_0x4b8e8b[_0x0fae('0x34')]=this[_0x0fae('0x9')](_[_0x0fae('0x35')](_0x5f2c9f[_0x0fae('0x2c')],_0x1a31bd[_0x0fae('0x9')]),_0x3744b6);if(_0x5f2c9f[_0x0fae('0x2c')]['filter']){var _0x4714ce=_0x3744b6;var _0x282d69=_0x5f2c9f['query']['filter'];if(typeof _0x282d69===_0x0fae('0x36')){_0x4714ce=_[_0x0fae('0x37')](_0x3744b6,function(_0x2c651d){return _[_0x0fae('0x4')](_0x282d69['columns'],_0x2c651d[_0x0fae('0x12')]);});_0x282d69=_0x282d69[_0x0fae('0x38')];}_0x4b8e8b[_0x0fae('0x34')]=_[_0x0fae('0x39')](_0x4b8e8b[_0x0fae('0x34')],{'$or':_[_0x0fae('0x18')](_0x4714ce,function(_0x4b7a07){if(_0x4b7a07[_0x0fae('0x3a')]!=='VIRTUAL'){if(_0x4ef82e){return sequelize[_0x0fae('0x34')](sequelize['fn'](_0x0fae('0x3b'),sequelize[_0x0fae('0x1d')](_0x4b7a07[_0x0fae('0x12')])),{'$like':sequelize['fn'](_0x0fae('0x3b'),'%'+_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x37')]+'%')});}else{var _0x37a143={};_0x37a143[_0x4b7a07['name']]={'$like':'%'+_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x37')]+'%'};return _0x37a143;}}})});}_0x4b8e8b=_[_0x0fae('0x39')]({},_0x4b8e8b,_0x5f2c9f[_0x0fae('0x3c')]);return _0x4b8e8b;};exports['include']=function(_0x8347c3){var _0x57fb64=[];if(_0x8347c3['includeAll']){_0x57fb64['push']({'all':!![]});}else if(_0x8347c3[_0x0fae('0x3d')]){if(Array['isArray'](_0x8347c3[_0x0fae('0x3d')])){_0x57fb64=Object[_0x0fae('0x5')](_0x8347c3['include'])['map'](function(_0x84d9fa){return parseIncludeModel(_0x8347c3[_0x0fae('0x3d')][_0x84d9fa]);});}else{var _0x236f85=parseIncludeModel(_0x8347c3['include']);_0x57fb64[_0x0fae('0x29')](_0x236f85);}}return _0x57fb64;};exports[_0x0fae('0x3e')]=function(_0x1e200f){return _0x1e200f['replace'](/[%_^-]/g,function(_0x2d9c21){return'\x5c'+_0x2d9c21;});}; \ No newline at end of file +var _0x4d36=['keys','model','alias','fields','raw','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','forEach','push','join','getOptions','query','$id','name','attributes','nolimit','where','pick','filter','object','value','merge','VIRTUAL','lower','options','include','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','parse','includes'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4d36,0x15d));var _0x64d3=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x4d36[_0x14e9f0];return _0xa63f7e;};'use strict';var _=require(_0x64d3('0x0'));var sequelize=require(_0x64d3('0x1'));var moment=require(_0x64d3('0x2'));var db=require(_0x64d3('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x10abe4){var _0x239099=['ne'];try{var _0x2bf0c4=JSON[_0x64d3('0x4')](_0x10abe4);var _0x5b5f6e=Object['keys'](_0x2bf0c4)[0x0];return _0x239099[_0x64d3('0x5')](_0x5b5f6e);}catch(_0x5bd051){return![];}}function getOperatorValue(_0x2adf17){var _0x19d139=JSON[_0x64d3('0x4')](_0x2adf17);var _0x54e305=Object[_0x64d3('0x6')](_0x19d139)[0x0];var _0x1bb471=_0x19d139[_0x54e305];return{['$'+_0x54e305]:_0x1bb471};}function parseIncludeModel(_0x231a0f){var _0x128939=JSON[_0x64d3('0x4')](_0x231a0f);return{'model':db[_0x128939[_0x64d3('0x7')]],'as':_0x128939[_0x64d3('0x8')],'attributes':_0x128939[_0x64d3('0x9')],'raw':_0x128939[_0x64d3('0xa')]};}exports[_0x64d3('0x9')]=function(_0x4f805c){var _0x27fc55=null;if(_0x4f805c){_0x27fc55=_0x4f805c[_0x64d3('0xb')](',');}return _0x27fc55;};exports[_0x64d3('0xc')]=function(_0x5a5846,_0x42413c){var _0x160aab={};if(!_[_0x64d3('0xd')](_0x5a5846)){_['forOwn'](_0x5a5846,function(_0x5c8120,_0x38a193){try{if(_0x42413c){var _0x4cc2e7=_[_0x64d3('0xe')](_0x42413c,{'name':_0x38a193})||{};if(hasSequelizeOperator(_0x5c8120)){_0x160aab[_0x38a193]=getOperatorValue(_0x5c8120);}else if(_0x4cc2e7[_0x64d3('0xf')]===_0x64d3('0x10')&&_[_0x64d3('0x11')](_0x5c8120)){var _0x3697d2=JSON[_0x64d3('0x4')](_0x5c8120);var _0x3b0276={'$gte':moment(moment(_0x3697d2[_0x64d3('0x12')])[_0x64d3('0x13')](_0x64d3('0x14')))[_0x64d3('0x15')]()[_0x64d3('0x13')](),'$lte':moment(moment(_0x3697d2[_0x64d3('0x16')])[_0x64d3('0x13')](_0x64d3('0x14')))[_0x64d3('0x15')]()[_0x64d3('0x17')](0x1,'s')['format']()};_0x160aab[_0x38a193]=_0x3b0276;}else if(_0x4cc2e7['name']===_0x64d3('0x18')){_0x160aab[_0x38a193]=_0x5c8120;}else{_0x160aab[_0x38a193]=_[_0x64d3('0x19')](_0x5c8120)?_0x5c8120:JSON['parse'](_0x5c8120);}}else{_0x160aab[_0x38a193]=_[_0x64d3('0x19')](_0x5c8120)?_0x5c8120:JSON[_0x64d3('0x4')](_0x5c8120);}}catch(_0x4b5e91){_0x160aab[_0x38a193]=_0x5c8120[_0x64d3('0xb')](',');}});}return _0x160aab;};exports[_0x64d3('0x1a')]=function(_0x270a57){_0x270a57=parseInt(_0x270a57,0xa);if(!_0x270a57||_0x270a57<0x0){_0x270a57=LIMIT_VALUE;}return _0x270a57;};exports[_0x64d3('0x1b')]=function(_0xa0e697){_0xa0e697=parseInt(_0xa0e697,0xa);if(!_0xa0e697||_0xa0e697<0x0){_0xa0e697=0x0;}return _0xa0e697;};exports[_0x64d3('0x1c')]=function(_0x58bcd2){var _0x16e1ef,_0x12674a=null;if(_0x58bcd2){_0x16e1ef=_0x58bcd2[_0x64d3('0xb')](',');_0x12674a=_[_0x64d3('0x1d')](_0x16e1ef,function(_0x392163){if(_0x392163[_0x64d3('0x1e')]('-')===0x0){return[_0x392163==='priority'?sequelize[_0x64d3('0x1f')](sequelize[_0x64d3('0x20')](_0x64d3('0x21')),_0x64d3('0x22')):_0x392163[_0x64d3('0x23')](0x1),_0x64d3('0x24')];}else{return[_0x392163===_0x64d3('0x21')?sequelize[_0x64d3('0x1f')](sequelize['col'](_0x64d3('0x21')),_0x64d3('0x22')):_0x392163,'ASC'];}});}return _0x12674a;};exports[_0x64d3('0x25')]=function(_0x515329,_0x2051ea){if(_[_0x64d3('0xd')](_0x515329)){return _0x515329;}if(_[_0x64d3('0x19')](_0x515329)){for(var _0x38b9d9=0x0;_0x38b9d9<_0x515329[_0x64d3('0x26')];_0x38b9d9+=0x1){_0x515329[_0x38b9d9]=this[_0x64d3('0x25')](_0x515329[_0x38b9d9],_0x2051ea);}return _0x515329;}if(!_[_0x64d3('0x27')](_0x515329)){return _0x515329;}if(_[_0x64d3('0x28')](_0x2051ea)){_0x2051ea=[_0x2051ea];}if(!_[_0x64d3('0x19')](_0x2051ea)){return _0x515329;}for(var _0x495c8e=0x0;_0x495c8e<_0x2051ea['length'];_0x495c8e+=0x1){_[_0x64d3('0x29')](_0x515329,_0x2051ea[_0x495c8e]);}for(var _0x235624 in _0x515329){if(_0x515329[_0x64d3('0x2a')](_0x235624)){_0x515329[_0x235624]=this[_0x64d3('0x25')](_0x515329[_0x235624],_0x2051ea);}}return _0x515329;};exports[_0x64d3('0x2b')]=function(_0x2262a1){return _0x2262a1[_0x64d3('0x2c')](RegExp(_0x64d3('0x2d')))?!![]:![];};exports[_0x64d3('0x2e')]=function(_0x4d792e){return _0x4d792e[_0x64d3('0x2c')](/^\S+@\S+$/)?!![]:![];};exports[_0x64d3('0x2f')]=function(_0x33b429,_0x533104){var _0x47ce9b=[];var _0x1db2ab=/([^:]")"+/g;var _0x1193e9=/[*<>~@-]/g;var _0x47f4c2=/[ `!@#$%^&*()_\-?~<>]/;var _0x63f87=/[ ,]+/;var _0x21b94b=_0x533104?_0x64d3('0x30'):_0x64d3('0x31');if(_0x533104){_0x33b429=_0x33b429[_0x64d3('0x32')](_0x1193e9,'\x20')['trim']();}_0x33b429[_0x64d3('0xb')](_0x63f87)[_0x64d3('0x33')](function(_0x113bd7){_0x113bd7=_0x113bd7['replace'](_0x1db2ab,'$1');_0x113bd7='+'+_0x113bd7+'*';var _0x4a4431=_0x113bd7[_0x64d3('0x2c')](_0x47f4c2);if(_0x4a4431){_0x113bd7='\x22'+_0x113bd7+'\x22';}_0x47ce9b[_0x64d3('0x34')](_0x113bd7);});_0x21b94b=_0x21b94b[_0x64d3('0x32')]('{EXPR}',_0x47ce9b[_0x64d3('0x35')]('\x20'));return _0x21b94b;};exports[_0x64d3('0x36')]=function(_0x31bcca,_0x155c14,_0x387c85){var _0x19863f={},_0x28e19a={};if(_0x155c14[_0x64d3('0x37')][_0x64d3('0x38')]){_0x155c14[_0x64d3('0x37')]['id']=_0x155c14[_0x64d3('0x37')][_0x64d3('0x38')];delete _0x155c14['query']['$id'];}_0x19863f[_0x64d3('0x7')]=_[_0x64d3('0x1d')](_0x31bcca,_0x64d3('0x39'));_0x19863f['query']=_[_0x64d3('0x6')](_0x155c14[_0x64d3('0x37')]);_0x19863f[_0x64d3('0xc')]=_['intersection'](_0x19863f[_0x64d3('0x7')],_0x19863f[_0x64d3('0x37')]);_0x28e19a['attributes']=_['intersection'](_0x19863f['model'],this[_0x64d3('0x9')](_0x155c14[_0x64d3('0x37')][_0x64d3('0x9')]));_0x28e19a[_0x64d3('0x3a')]=_0x28e19a['attributes'][_0x64d3('0x26')]?_0x28e19a[_0x64d3('0x3a')]:_0x19863f[_0x64d3('0x7')];if(!_0x155c14[_0x64d3('0x37')][_0x64d3('0x2a')](_0x64d3('0x3b'))){_0x28e19a['limit']=this[_0x64d3('0x1a')](_0x155c14[_0x64d3('0x37')][_0x64d3('0x1a')]);_0x28e19a[_0x64d3('0x1b')]=this[_0x64d3('0x1b')](_0x155c14[_0x64d3('0x37')][_0x64d3('0x1b')]);}_0x28e19a['order']=this[_0x64d3('0x1c')](_0x155c14[_0x64d3('0x37')][_0x64d3('0x1c')]);_0x28e19a[_0x64d3('0x3c')]=this[_0x64d3('0xc')](_[_0x64d3('0x3d')](_0x155c14[_0x64d3('0x37')],_0x19863f[_0x64d3('0xc')]),_0x31bcca);if(_0x155c14[_0x64d3('0x37')][_0x64d3('0x3e')]){var _0x958eb9=_0x31bcca;var _0x80456=_0x155c14['query'][_0x64d3('0x3e')];if(typeof _0x80456===_0x64d3('0x3f')){_0x958eb9=_[_0x64d3('0x3e')](_0x31bcca,function(_0x404207){return _['includes'](_0x80456['columns'],_0x404207[_0x64d3('0x39')]);});_0x80456=_0x80456[_0x64d3('0x40')];}_0x28e19a[_0x64d3('0x3c')]=_[_0x64d3('0x41')](_0x28e19a['where'],{'$or':_['map'](_0x958eb9,function(_0x348f69){if(_0x348f69[_0x64d3('0xf')]!==_0x64d3('0x42')){if(_0x387c85){return sequelize[_0x64d3('0x3c')](sequelize['fn'](_0x64d3('0x43'),sequelize[_0x64d3('0x20')](_0x348f69[_0x64d3('0x39')])),{'$like':sequelize['fn'](_0x64d3('0x43'),'%'+_0x155c14[_0x64d3('0x37')]['filter']+'%')});}else{var _0x5aabb4={};_0x5aabb4[_0x348f69[_0x64d3('0x39')]]={'$like':'%'+_0x155c14[_0x64d3('0x37')][_0x64d3('0x3e')]+'%'};return _0x5aabb4;}}})});}_0x28e19a=_[_0x64d3('0x41')]({},_0x28e19a,_0x155c14[_0x64d3('0x44')]);return _0x28e19a;};exports[_0x64d3('0x45')]=function(_0x80af58){var _0x1050c9=[];if(_0x80af58['includeAll']){_0x1050c9['push']({'all':!![]});}else if(_0x80af58[_0x64d3('0x45')]){if(Array[_0x64d3('0x19')](_0x80af58[_0x64d3('0x45')])){_0x1050c9=Object[_0x64d3('0x6')](_0x80af58['include'])['map'](function(_0x1e1394){return parseIncludeModel(_0x80af58[_0x64d3('0x45')][_0x1e1394]);});}else{var _0x6840d9=parseIncludeModel(_0x80af58['include']);_0x1050c9['push'](_0x6840d9);}}return _0x1050c9;};exports[_0x64d3('0x46')]=function(_0x1192ed){return _0x1192ed[_0x64d3('0x32')](/[%_^-]/g,function(_0x2843a0){return'\x5c'+_0x2843a0;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index debe0c3..34fffff 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c01=['destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','value','filterAgentAttributes','role','faxStatusTime','faxCapacity','openchannelCapacity','whatsappCapacity','onhold','queue','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','chatPause','faxPause','mailPause','smsPause','whatsappPause','length','unknown','unavailable','ringing','isNil','idle','voicePause','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','filter','includes','resolve','User','name','openchannelPause','pauseType','find','globalStatus','catch','split','fields','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','fullname','validateSortParameter','toLowerCase','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1c01,0x190));var _0x11c0=function(_0x110a96,_0x178352){_0x110a96=_0x110a96-0x0;var _0x2dd9a9=_0x1c01[_0x110a96];return _0x2dd9a9;};'use strict';var _=require(_0x11c0('0x0'));var jayson=require(_0x11c0('0x1'));var db=require(_0x11c0('0x2'))['db'];var amiClient=jayson[_0x11c0('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x11c0('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x484b2c,_0x218e37){var _0x15f4c1=[_0x484b2c[_0x11c0('0x4')],_0x484b2c[_0x11c0('0x5')],_0x484b2c[_0x11c0('0x6')],_0x484b2c['openchannelPause'],_0x484b2c[_0x11c0('0x7')],_0x484b2c['voicePause'],_0x484b2c[_0x11c0('0x8')]];if(!_0x218e37)return _['every'](_0x15f4c1);var _0x127b2f=_['filter'](_0x15f4c1);return _0x127b2f[_0x11c0('0x9')]>0x0&&_0x127b2f['length']<_0x15f4c1['length']?!![]:![];}function isIdle(_0xba38f){return _0xba38f==='idle'||_0xba38f===_0x11c0('0xa')||_0xba38f===_0x11c0('0xb')||_0xba38f===_0x11c0('0xc')||_[_0x11c0('0xd')](_0xba38f);}function isAgentIdle(_0x3cc04b){if(_0x3cc04b['voiceStatus']!==_0x11c0('0xe')&&_0x3cc04b[_0x11c0('0xf')]){_0x3cc04b[_0x11c0('0x10')]=_0x11c0('0x11');return![];}return _['every']([_0x3cc04b['chatStatus'],_0x3cc04b[_0x11c0('0x12')],_0x3cc04b[_0x11c0('0x13')],_0x3cc04b[_0x11c0('0x14')],_0x3cc04b[_0x11c0('0x15')],_0x3cc04b[_0x11c0('0x10')],_0x3cc04b[_0x11c0('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x11c0('0x17')]('Agents',{})[_0x11c0('0x18')](function(_0x5da595){if(_0x5da595[_0x11c0('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x345389=_0x5da595[_0x11c0('0x1a')];return routingClient[_0x11c0('0x17')]('Agents',{})[_0x11c0('0x18')](function(_0xe9958e){if(_0xe9958e[_0x11c0('0x19')]){throw new Error(_0x11c0('0x1b'));}var _0x14c192=_0xe9958e[_0x11c0('0x1a')];return _['merge']({},_0x345389,_0x14c192);});})['catch'](function(_0x165860){throw _0x165860;});}exports[_0x11c0('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x369562){var _0x205f6a=_0x11c0('0xa');if(isAgentPaused(_0x369562))_0x205f6a=_0x11c0('0x11');else if(isAgentPaused(_0x369562,!![]))_0x205f6a=_0x11c0('0x1d');else if(isAgentIdle(_0x369562))_0x205f6a=_0x11c0('0xe');else _0x205f6a='busy';return _0x205f6a;}exports[_0x11c0('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x1f6ae1,_0x57b6bd){var _0x1d27dc=_[_0x11c0('0x1f')](_0x1f6ae1)?_0x1f6ae1:[_0x1f6ae1];var _0x303c1b=_[_0x11c0('0x20')](_0x57b6bd)+_0x11c0('0x21');var _0x4f8c9d=_[_0x11c0('0x22')](_0x1d27dc,function(_0x3c3dd7){return db[_0x303c1b][_0x11c0('0x23')]({'where':{'id':_0x3c3dd7}})[_0x11c0('0x18')](function(_0x5952dc){if(!_0x5952dc)return[];return _0x5952dc[_0x11c0('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x11c0('0x25')](_0x4f8c9d)[_0x11c0('0x18')](function(_0x5730a2){var _0x349ecc=_(_0x5730a2)[_0x11c0('0x26')]()['map']('id')['uniq']()['value']();return _0x349ecc;});}exports[_0x11c0('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x229427,_0x73df10,_0x1099fe){try{if(_0x73df10[_0x11c0('0x9')]>0x0){_0x229427=_0x229427[_0x11c0('0x28')](function(_0x3bf582){return _0x73df10[_0x11c0('0x29')](_0x3bf582['id']);});}var _0x2fbe0c=_0x229427['filter'](function(_0x1b9316){var _0x1059dc='busy';if(isAgentIdle(_0x1b9316)){_0x1059dc=_0x11c0('0xe');}return _0x1059dc===_0x1099fe;});return _[_0x11c0('0x22')](_0x2fbe0c,'id');}catch(_0x299d6d){throw _0x299d6d;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x50fd9e,_0x4540dc,_0x3c6f6e){return Promise[_0x11c0('0x2a')]()[_0x11c0('0x18')](function(){if(_0x4540dc['length']>0x0){_0x50fd9e=_0x50fd9e[_0x11c0('0x28')](function(_0x579c02){return _0x4540dc[_0x11c0('0x29')](_0x579c02['id']);});}return _0x50fd9e;})[_0x11c0('0x18')](function(){return db[_0x11c0('0x2b')]['findAll']({'attributes':['id',_0x11c0('0x2c'),'fullname',_0x11c0('0x4'),'faxPause',_0x11c0('0x6'),_0x11c0('0x2d'),_0x11c0('0x7'),_0x11c0('0xf'),_0x11c0('0x8'),_0x11c0('0x2e')],'where':{'id':{'$in':_['map'](_0x50fd9e,'id')}},'raw':!![]});})[_0x11c0('0x18')](function(_0x590e02){return _0x590e02[_0x11c0('0x22')](function(_0x569d0f){var _0x2b7ace=_[_0x11c0('0x2f')](_0x50fd9e,['id',_0x569d0f['id']]);var _0x480a3c=filterAgentAttributes(_0x2b7ace);_['merge'](_0x569d0f,_0x480a3c);_0x569d0f[_0x11c0('0x30')]=getAgentStatus(_0x569d0f);return _0x569d0f;});})['then'](function(_0x3a1e64){var _0x3e715e=sortAgentsByStatus(_0x3a1e64,_0x3c6f6e);return _[_0x11c0('0x22')](_0x3e715e,'id');})[_0x11c0('0x31')](function(_0xa0f6d4){throw _0xa0f6d4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x569b2e){var _0x1ffcea={'fields':[],'order':null};var _0x2b6f4c=_0x569b2e[_0x11c0('0x32')](',');_0x1ffcea[_0x11c0('0x33')]=_[_0x11c0('0x28')](_0x2b6f4c,function(_0x308e40){if(!_0x308e40[_0x11c0('0x29')](_0x11c0('0x30'))){return!![];}_0x1ffcea['order']=_[_0x11c0('0x34')](_0x308e40,'-')?_0x11c0('0x35'):'ASC';return![];});return _0x1ffcea;}exports[_0x11c0('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x4ef2fb){if(!_0x4ef2fb){_0x4ef2fb=_0x11c0('0x37');}if(_0x4ef2fb[_0x11c0('0x29')]('fullname')&&!_0x4ef2fb[_0x11c0('0x29')](_0x11c0('0x38'))){var _0x565818=_0x4ef2fb[_0x11c0('0x39')](0x0,_0x4ef2fb[_0x11c0('0x3a')](_0x11c0('0x3b')));_0x4ef2fb+=','+_0x565818+'internal';}return _0x4ef2fb;}exports[_0x11c0('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x58f530,_0x2645e9){var _0x50a00c=_0x58f530['sort'](function(_0x4659a5,_0x2e68f4){if(_0x4659a5[_0x11c0('0x30')]===_0x2e68f4[_0x11c0('0x30')]){if(_0x4659a5[_0x11c0('0x30')]===_0x11c0('0x11')){if(_0x2645e9===_0x11c0('0x35')){return(_0x4659a5[_0x11c0('0x2e')]||'')<(_0x2e68f4[_0x11c0('0x2e')]||'')||_0x4659a5['fullname'][_0x11c0('0x3d')]()>_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?0x1:-0x1;}else{return(_0x4659a5[_0x11c0('0x2e')]||'')<(_0x2e68f4['pauseType']||'')||_0x4659a5[_0x11c0('0x3b')][_0x11c0('0x3d')]()>_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?-0x1:0x1;}}else{if(_0x2645e9===_0x11c0('0x35')){return _0x4659a5[_0x11c0('0x3b')][_0x11c0('0x3d')]()<_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?0x1:-0x1;}else{return _0x4659a5[_0x11c0('0x3b')][_0x11c0('0x3d')]()<_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?-0x1:0x1;}}}else{if(_0x2645e9===_0x11c0('0x35')){return _0x4659a5[_0x11c0('0x30')]<_0x2e68f4[_0x11c0('0x30')]?0x1:-0x1;}else{return _0x4659a5[_0x11c0('0x30')]<_0x2e68f4[_0x11c0('0x30')]?-0x1:0x1;}}});return _0x50a00c;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x2979a4){var _0x60f728=[_0x11c0('0x3e'),'online',_0x11c0('0x3f'),_0x11c0('0x40'),_0x11c0('0x2e'),_0x11c0('0x40'),_0x11c0('0x38'),_0x11c0('0x41'),_0x11c0('0x4'),_0x11c0('0x2d'),_0x11c0('0x6'),'smsPause','whatsappPause',_0x11c0('0x5'),_0x11c0('0xf'),_0x11c0('0x42'),'openchannelCapacity',_0x11c0('0x43'),_0x11c0('0x44'),'whatsappCapacity','faxCapacity',_0x11c0('0x45'),_0x11c0('0x46'),'mailCurrentCapacity',_0x11c0('0x47'),_0x11c0('0x48'),_0x11c0('0x49'),_0x11c0('0x4a'),_0x11c0('0x14'),_0x11c0('0x13'),_0x11c0('0x15'),_0x11c0('0x16'),_0x11c0('0x12'),_0x11c0('0x10'),_0x11c0('0x4b'),'openchannelStatusTime',_0x11c0('0x4c'),_0x11c0('0x4d'),_0x11c0('0x4e'),'faxStatusTime',_0x11c0('0x4f'),'queue',_0x11c0('0x50'),_0x11c0('0x51'),_0x11c0('0x52'),_0x11c0('0x53')];var _0xb152c=['chatPause','openchannelPause',_0x11c0('0x6'),_0x11c0('0x7'),'whatsappPause',_0x11c0('0x5'),_0x11c0('0xf'),_0x11c0('0x54')];var _0x3615db=_(_0x2979a4)[_0x11c0('0x55')](_0xb152c)['pick'](_0x60f728)[_0x11c0('0x56')]();return _0x3615db;}exports[_0x11c0('0x57')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x11c0('0x2c'),'fullname',_0x11c0('0x58'),_0x11c0('0x38'),_0x11c0('0x54'),_0x11c0('0x30'),'userpic',_0x11c0('0x3f'),_0x11c0('0x2e'),_0x11c0('0x40'),'faxPause',_0x11c0('0x4'),_0x11c0('0x6'),_0x11c0('0x2d'),_0x11c0('0x7'),'voicePause',_0x11c0('0x8'),_0x11c0('0x4a'),'faxStatus','mailStatus',_0x11c0('0x14'),_0x11c0('0x15'),_0x11c0('0x10'),'whatsappStatus',_0x11c0('0x4b'),_0x11c0('0x59'),'mailStatusTime','openchannelStatusTime',_0x11c0('0x4d'),'voiceStatusTime',_0x11c0('0x4e'),_0x11c0('0x42'),_0x11c0('0x5a'),'mailCapacity',_0x11c0('0x5b'),_0x11c0('0x44'),_0x11c0('0x5c'),_0x11c0('0x45'),_0x11c0('0x49'),'mailCurrentCapacity',_0x11c0('0x46'),_0x11c0('0x47'),_0x11c0('0x48'),'phoneBarEnableScreenRecordingByAgent',_0x11c0('0x53'),'destconnectedlinenum',_0x11c0('0x5d'),_0x11c0('0x5e'),_0x11c0('0x51')];}exports[_0x11c0('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xb6da=['startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','filterAgentAttributes','name','role','mailCapacity','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','queue','lodash','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','length','idle','unavailable','voiceStatus','pause','every','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','error','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','unknown','*pause','busy','isArray','startCase','all','value','getAgentIdsByQueues','filter','includes','map','getAgentIdsByStatus','resolve','User','fullname','chatPause','pauseType','find','globalStatus','split','fields','order'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0xb6da,0x8e));var _0xab6d=function(_0x39424f,_0x5e11a4){_0x39424f=_0x39424f-0x0;var _0x43bdd8=_0xb6da[_0x39424f];return _0x43bdd8;};'use strict';var _=require(_0xab6d('0x0'));var jayson=require('jayson/promise');var db=require(_0xab6d('0x1'))['db'];var amiClient=jayson[_0xab6d('0x2')][_0xab6d('0x3')]({'port':0x232a});var routingClient=jayson[_0xab6d('0x2')][_0xab6d('0x3')]({'port':0x232c});function isAgentPaused(_0x1c0711,_0x2d6472){var _0x5a8924=[_0x1c0711['chatPause'],_0x1c0711[_0xab6d('0x4')],_0x1c0711[_0xab6d('0x5')],_0x1c0711[_0xab6d('0x6')],_0x1c0711[_0xab6d('0x7')],_0x1c0711[_0xab6d('0x8')],_0x1c0711[_0xab6d('0x9')]];if(!_0x2d6472)return _['every'](_0x5a8924);var _0x2e30f1=_['filter'](_0x5a8924);return _0x2e30f1[_0xab6d('0xa')]>0x0&&_0x2e30f1['length']<_0x5a8924['length']?!![]:![];}function isIdle(_0x18edc2){return _0x18edc2===_0xab6d('0xb')||_0x18edc2==='unknown'||_0x18edc2===_0xab6d('0xc')||_0x18edc2==='ringing'||_['isNil'](_0x18edc2);}function isAgentIdle(_0x1ad43c){if(_0x1ad43c[_0xab6d('0xd')]!==_0xab6d('0xb')&&_0x1ad43c[_0xab6d('0x8')]){_0x1ad43c[_0xab6d('0xd')]=_0xab6d('0xe');return![];}return _[_0xab6d('0xf')]([_0x1ad43c[_0xab6d('0x10')],_0x1ad43c['faxStatus'],_0x1ad43c[_0xab6d('0x11')],_0x1ad43c[_0xab6d('0x12')],_0x1ad43c[_0xab6d('0x13')],_0x1ad43c[_0xab6d('0xd')],_0x1ad43c[_0xab6d('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xab6d('0x15')]('Agents',{})[_0xab6d('0x16')](function(_0x3fb1da){if(_0x3fb1da[_0xab6d('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x24217a=_0x3fb1da[_0xab6d('0x18')];return routingClient[_0xab6d('0x15')](_0xab6d('0x19'),{})[_0xab6d('0x16')](function(_0x130cda){if(_0x130cda[_0xab6d('0x17')]){throw new Error(_0xab6d('0x1a'));}var _0x17d918=_0x130cda[_0xab6d('0x18')];return _[_0xab6d('0x1b')]({},_0x24217a,_0x17d918);});})[_0xab6d('0x1c')](function(_0x45acfa){throw _0x45acfa;});}exports[_0xab6d('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x130751){var _0x456d18=_0xab6d('0x1e');if(isAgentPaused(_0x130751))_0x456d18=_0xab6d('0xe');else if(isAgentPaused(_0x130751,!![]))_0x456d18=_0xab6d('0x1f');else if(isAgentIdle(_0x130751))_0x456d18='idle';else _0x456d18=_0xab6d('0x20');return _0x456d18;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x962b3a,_0x5ee10c){var _0x45db3a=_[_0xab6d('0x21')](_0x962b3a)?_0x962b3a:[_0x962b3a];var _0xb421bb=_[_0xab6d('0x22')](_0x5ee10c)+'Queue';var _0x398de3=_['map'](_0x45db3a,function(_0x18dcfa){return db[_0xb421bb]['findOne']({'where':{'id':_0x18dcfa}})[_0xab6d('0x16')](function(_0x31648c){if(!_0x31648c)return[];return _0x31648c['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xab6d('0x23')](_0x398de3)[_0xab6d('0x16')](function(_0x4a4160){var _0x17f810=_(_0x4a4160)['flatten']()['map']('id')['uniq']()[_0xab6d('0x24')]();return _0x17f810;});}exports[_0xab6d('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xab64e1,_0x161ab7,_0x193fc6){try{if(_0x161ab7[_0xab6d('0xa')]>0x0){_0xab64e1=_0xab64e1[_0xab6d('0x26')](function(_0x1f83fb){return _0x161ab7[_0xab6d('0x27')](_0x1f83fb['id']);});}var _0x1c788a=_0xab64e1[_0xab6d('0x26')](function(_0x30190e){var _0x2a348e=_0xab6d('0x20');if(isAgentIdle(_0x30190e)){_0x2a348e=_0xab6d('0xb');}return _0x2a348e===_0x193fc6;});return _[_0xab6d('0x28')](_0x1c788a,'id');}catch(_0x1737d9){throw _0x1737d9;}}exports[_0xab6d('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x399b8b,_0x162d67,_0x136c97){return Promise[_0xab6d('0x2a')]()[_0xab6d('0x16')](function(){if(_0x162d67[_0xab6d('0xa')]>0x0){_0x399b8b=_0x399b8b['filter'](function(_0x420b17){return _0x162d67['includes'](_0x420b17['id']);});}return _0x399b8b;})[_0xab6d('0x16')](function(){return db[_0xab6d('0x2b')]['findAll']({'attributes':['id','name',_0xab6d('0x2c'),_0xab6d('0x2d'),_0xab6d('0x4'),'mailPause',_0xab6d('0x6'),'smsPause',_0xab6d('0x8'),_0xab6d('0x9'),_0xab6d('0x2e')],'where':{'id':{'$in':_[_0xab6d('0x28')](_0x399b8b,'id')}},'raw':!![]});})[_0xab6d('0x16')](function(_0xd54011){return _0xd54011[_0xab6d('0x28')](function(_0x2768da){var _0x2c70a4=_[_0xab6d('0x2f')](_0x399b8b,['id',_0x2768da['id']]);var _0x2ad4d1=filterAgentAttributes(_0x2c70a4);_[_0xab6d('0x1b')](_0x2768da,_0x2ad4d1);_0x2768da[_0xab6d('0x30')]=getAgentStatus(_0x2768da);return _0x2768da;});})[_0xab6d('0x16')](function(_0x52ccea){var _0x51552e=sortAgentsByStatus(_0x52ccea,_0x136c97);return _[_0xab6d('0x28')](_0x51552e,'id');})[_0xab6d('0x1c')](function(_0x4442d8){throw _0x4442d8;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4f3f7c){var _0x4fac2a={'fields':[],'order':null};var _0x295806=_0x4f3f7c[_0xab6d('0x31')](',');_0x4fac2a[_0xab6d('0x32')]=_[_0xab6d('0x26')](_0x295806,function(_0x248a45){if(!_0x248a45[_0xab6d('0x27')](_0xab6d('0x30'))){return!![];}_0x4fac2a[_0xab6d('0x33')]=_[_0xab6d('0x34')](_0x248a45,'-')?_0xab6d('0x35'):_0xab6d('0x36');return![];});return _0x4fac2a;}exports[_0xab6d('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x2e107b){if(!_0x2e107b){_0x2e107b=_0xab6d('0x38');}if(_0x2e107b[_0xab6d('0x27')](_0xab6d('0x2c'))&&!_0x2e107b[_0xab6d('0x27')](_0xab6d('0x39'))){var _0x41833a=_0x2e107b[_0xab6d('0x3a')](0x0,_0x2e107b['indexOf'](_0xab6d('0x2c')));_0x2e107b+=','+_0x41833a+'internal';}return _0x2e107b;}exports[_0xab6d('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x2bd375,_0x51bb5b){var _0x1b43b4=_0x2bd375['sort'](function(_0x47cb1f,_0x8dbc9b){if(_0x47cb1f[_0xab6d('0x30')]===_0x8dbc9b[_0xab6d('0x30')]){if(_0x47cb1f['globalStatus']===_0xab6d('0xe')){if(_0x51bb5b===_0xab6d('0x35')){return(_0x47cb1f['pauseType']||'')<(_0x8dbc9b[_0xab6d('0x2e')]||'')||_0x47cb1f['fullname']['toLowerCase']()>_0x8dbc9b[_0xab6d('0x2c')][_0xab6d('0x3c')]()?0x1:-0x1;}else{return(_0x47cb1f[_0xab6d('0x2e')]||'')<(_0x8dbc9b[_0xab6d('0x2e')]||'')||_0x47cb1f[_0xab6d('0x2c')][_0xab6d('0x3c')]()>_0x8dbc9b['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x51bb5b==='DESC'){return _0x47cb1f[_0xab6d('0x2c')][_0xab6d('0x3c')]()<_0x8dbc9b[_0xab6d('0x2c')][_0xab6d('0x3c')]()?0x1:-0x1;}else{return _0x47cb1f[_0xab6d('0x2c')][_0xab6d('0x3c')]()<_0x8dbc9b[_0xab6d('0x2c')][_0xab6d('0x3c')]()?-0x1:0x1;}}}else{if(_0x51bb5b===_0xab6d('0x35')){return _0x47cb1f[_0xab6d('0x30')]<_0x8dbc9b[_0xab6d('0x30')]?0x1:-0x1;}else{return _0x47cb1f[_0xab6d('0x30')]<_0x8dbc9b[_0xab6d('0x30')]?-0x1:0x1;}}});return _0x1b43b4;}exports[_0xab6d('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x201ee5){var _0x43fc7f=[_0xab6d('0x3e'),_0xab6d('0x3f'),_0xab6d('0x40'),_0xab6d('0x41'),_0xab6d('0x2e'),_0xab6d('0x41'),_0xab6d('0x39'),_0xab6d('0x42'),_0xab6d('0x2d'),_0xab6d('0x6'),_0xab6d('0x5'),_0xab6d('0x7'),_0xab6d('0x9'),_0xab6d('0x4'),_0xab6d('0x8'),_0xab6d('0x43'),_0xab6d('0x44'),'mailCapacity',_0xab6d('0x45'),_0xab6d('0x46'),_0xab6d('0x47'),_0xab6d('0x48'),'openchannelCurrentCapacity',_0xab6d('0x49'),_0xab6d('0x4a'),_0xab6d('0x4b'),_0xab6d('0x4c'),_0xab6d('0x10'),_0xab6d('0x12'),_0xab6d('0x11'),'smsStatus','whatsappStatus',_0xab6d('0x4d'),_0xab6d('0xd'),_0xab6d('0x4e'),_0xab6d('0x4f'),_0xab6d('0x50'),_0xab6d('0x51'),_0xab6d('0x52'),_0xab6d('0x53'),_0xab6d('0x54'),'queue',_0xab6d('0x55'),_0xab6d('0x56'),_0xab6d('0x57'),'phoneBarEnableAutomaticScreenRecording'];var _0x5d6986=['chatPause',_0xab6d('0x6'),_0xab6d('0x5'),_0xab6d('0x7'),'whatsappPause','faxPause',_0xab6d('0x8'),_0xab6d('0x3f')];var _0x243cb1=_(_0x201ee5)[_0xab6d('0x58')](_0x5d6986)['pick'](_0x43fc7f)[_0xab6d('0x24')]();return _0x243cb1;}exports[_0xab6d('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xab6d('0x5a'),'fullname',_0xab6d('0x5b'),'internal',_0xab6d('0x3f'),_0xab6d('0x30'),_0xab6d('0x3e'),'lastLoginAt',_0xab6d('0x2e'),_0xab6d('0x41'),_0xab6d('0x4'),_0xab6d('0x2d'),_0xab6d('0x5'),_0xab6d('0x6'),_0xab6d('0x7'),_0xab6d('0x8'),'whatsappPause',_0xab6d('0x10'),_0xab6d('0x4d'),'mailStatus',_0xab6d('0x12'),_0xab6d('0x13'),_0xab6d('0xd'),_0xab6d('0x14'),_0xab6d('0x4e'),_0xab6d('0x53'),_0xab6d('0x50'),'openchannelStatusTime',_0xab6d('0x51'),_0xab6d('0x54'),'whatsappStatusTime',_0xab6d('0x43'),_0xab6d('0x47'),_0xab6d('0x5c'),_0xab6d('0x44'),_0xab6d('0x45'),_0xab6d('0x46'),_0xab6d('0x48'),_0xab6d('0x4c'),_0xab6d('0x49'),_0xab6d('0x5d'),_0xab6d('0x4a'),_0xab6d('0x4b'),_0xab6d('0x57'),_0xab6d('0x5e'),'destconnectedlinenum',_0xab6d('0x5f'),_0xab6d('0x60'),_0xab6d('0x56')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 7426bfd..170084c 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1dd=['loggedInDb','talking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','notInUse','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','then','result','getRealtimeQueues','inbound','concat','outbound','get'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xa1dd,0x66));var _0xda1d=function(_0x5803d2,_0x4e37aa){_0x5803d2=_0x5803d2-0x0;var _0x40b803=_0xa1dd[_0x5803d2];return _0x40b803;};'use strict';var _=require(_0xda1d('0x0'));var jayson=require(_0xda1d('0x1'));var util=require(_0xda1d('0x2'));var amiClient=jayson[_0xda1d('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xda1d('0x3')][_0xda1d('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xda1d('0x5'),_0xda1d('0x6'),_0xda1d('0x7'),_0xda1d('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xda1d('0x9'),_0xda1d('0xa'),'invalid','loggedInDb',_0xda1d('0xb'),'onHold','ringing',_0xda1d('0xc'),'talking',_0xda1d('0xd'),_0xda1d('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xda1d('0xf'),_0xda1d('0x10'),_0xda1d('0x11'),_0xda1d('0x12'),'dialActive',_0xda1d('0x13'),'Trunk',_0xda1d('0x14'),_0xda1d('0x15'),'erlangCalls',_0xda1d('0x16'),_0xda1d('0x17'),'erlangBusyFactor',_0xda1d('0x18'),_0xda1d('0x19'),_0xda1d('0x1a'),_0xda1d('0x1b'),_0xda1d('0x1c'),_0xda1d('0x1d'),_0xda1d('0x1e'),_0xda1d('0x1f'),'predictiveIntervalAvgHoldtime',_0xda1d('0x20')];function getRealtimeQueues(_0x5336fa,_0x4e107b){var _0xc5159b=_0x4e107b===_0xda1d('0x21')?amiClient:routingClient;return _0xc5159b[_0xda1d('0x22')](_['startCase'](_0x4e107b)+'Queues',_0x5336fa)[_0xda1d('0x23')](function(_0x4ec2cc){if(_0x4ec2cc['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4e107b));return _0x4ec2cc[_0xda1d('0x24')];})['catch'](function(_0x4db022){throw _0x4db022;});}exports[_0xda1d('0x25')]=getRealtimeQueues;function initializeQueues(_0x19e442,_0x59962c,_0x572db8,_0x46415a){var _0x270a57=DEFAULT_QUEUE_ATTRIBUTES;if(_0x572db8===_0xda1d('0x21')){if(_0x46415a===_0xda1d('0x26')){_0x270a57=_0x270a57[_0xda1d('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x46415a===_0xda1d('0x28')){_0x270a57=_0x270a57[_0xda1d('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x19e442['map'](function(_0x18a636){var _0x455694=_0x18a636[_0xda1d('0x29')]({'plain':!![]});_0x455694[_0xda1d('0x7')]=0x0;_0x455694[_0xda1d('0x2a')]=0x0;_0x455694[_0xda1d('0x6')]=0x0;_0x455694[_0xda1d('0x5')]=0x0;_0x455694[_0xda1d('0x8')]=0x0;if(_0x572db8===_0xda1d('0x21')){_0x455694[_0xda1d('0x2b')]=0x0;_0x455694[_0xda1d('0x9')]=0x0;if(_0x46415a===_0xda1d('0x28')){_0x455694[_0xda1d('0xf')]=0x0;_0x455694[_0xda1d('0x10')]=0x0;}}var _0x516ab5=_[_0xda1d('0x2c')](_0x59962c,['id',_0x455694['id']]);if(_0x516ab5){_[_0xda1d('0x2d')](_0x455694,_[_0xda1d('0x2e')](_0x516ab5,_0x270a57));}return _0x455694;});}exports[_0xda1d('0x2f')]=initializeQueues; \ No newline at end of file +var _0x684d=['loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','outbound','concat','map','get','paused','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','busy','inUse','invalid'];(function(_0x3612ca,_0x5ef7db){var _0x87d777=function(_0x5d7754){while(--_0x5d7754){_0x3612ca['push'](_0x3612ca['shift']());}};_0x87d777(++_0x5ef7db);}(_0x684d,0x186));var _0xd684=function(_0x5b8052,_0x455417){_0x5b8052=_0x5b8052-0x0;var _0x12da8a=_0x684d[_0x5b8052];return _0x12da8a;};'use strict';var _=require(_0xd684('0x0'));var jayson=require(_0xd684('0x1'));var util=require(_0xd684('0x2'));var amiClient=jayson[_0xd684('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xd684('0x3')][_0xd684('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xd684('0x5'),_0xd684('0x6'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xd684('0x7'),_0xd684('0x8'),_0xd684('0x9'),_0xd684('0xa'),'notInUse',_0xd684('0xb'),_0xd684('0xc'),_0xd684('0xd'),_0xd684('0xe'),_0xd684('0xf'),_0xd684('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xd684('0x11'),_0xd684('0x12'),_0xd684('0x13'),_0xd684('0x14'),'dialActive','dialMethod',_0xd684('0x15'),_0xd684('0x16'),_0xd684('0x17'),_0xd684('0x18'),_0xd684('0x19'),'erlangAbandonmentRate',_0xd684('0x1a'),_0xd684('0x1b'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xd684('0x1c'),_0xd684('0x1d'),_0xd684('0x1e'),_0xd684('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0xd684('0x20'),_0xd684('0x21')];function getRealtimeQueues(_0x5e2afc,_0x1fd887){var _0x5cf86e=_0x1fd887===_0xd684('0x22')?amiClient:routingClient;return _0x5cf86e[_0xd684('0x23')](_[_0xd684('0x24')](_0x1fd887)+_0xd684('0x25'),_0x5e2afc)['then'](function(_0x3679c7){if(_0x3679c7['error'])throw new Error(util[_0xd684('0x26')](_0xd684('0x27'),_0x1fd887));return _0x3679c7[_0xd684('0x28')];})['catch'](function(_0x1693df){throw _0x1693df;});}exports[_0xd684('0x29')]=getRealtimeQueues;function initializeQueues(_0x1cac9e,_0x3e9a8c,_0x11eeca,_0x4d3601){var _0x1f3043=DEFAULT_QUEUE_ATTRIBUTES;if(_0x11eeca===_0xd684('0x22')){if(_0x4d3601==='inbound'){_0x1f3043=_0x1f3043['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4d3601===_0xd684('0x2a')){_0x1f3043=_0x1f3043[_0xd684('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1cac9e[_0xd684('0x2c')](function(_0x2aba5a){var _0xea7dba=_0x2aba5a[_0xd684('0x2d')]({'plain':!![]});_0xea7dba[_0xd684('0x2e')]=0x0;_0xea7dba[_0xd684('0xa')]=0x0;_0xea7dba[_0xd684('0x6')]=0x0;_0xea7dba['available']=0x0;_0xea7dba['waiting']=0x0;if(_0x11eeca==='voice'){_0xea7dba['talking']=0x0;_0xea7dba[_0xd684('0x7')]=0x0;if(_0x4d3601===_0xd684('0x2a')){_0xea7dba[_0xd684('0x11')]=0x0;_0xea7dba['originated']=0x0;}}var _0x227411=_[_0xd684('0x2f')](_0x3e9a8c,['id',_0xea7dba['id']]);if(_0x227411){_[_0xd684('0x30')](_0xea7dba,_['pick'](_0x227411,_0x1f3043));}return _0xea7dba;});}exports[_0xd684('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 13949a7..b8baae2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 60c2c63..9a911fb 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 _0xc440=['IPv4','internal','concat','head','mac','00:00:00:00:00:00','getFirstInterface','cpus','map','model','join','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family'];(function(_0xee0fdb,_0x4aa492){var _0x4d7fbf=function(_0x22693d){while(--_0x22693d){_0xee0fdb['push'](_0xee0fdb['shift']());}};_0x4d7fbf(++_0x4aa492);}(_0xc440,0xc1));var _0x0c44=function(_0x2bb336,_0x4d2edf){_0x2bb336=_0x2bb336-0x0;var _0x412f98=_0xc440[_0x2bb336];return _0x412f98;};'use strict';var _=require(_0x0c44('0x0'));var os=require('os');var crypto=require(_0x0c44('0x1'));var machine=require(_0x0c44('0x2'));var exec=require(_0x0c44('0x3'))['execSync'];var config=require(_0x0c44('0x4'));function getInterfaces(){var _0x42a87f=[];var _0x1304ad=os[_0x0c44('0x5')]();var _0x3d80a8=_[_0x0c44('0x6')](_[_0x0c44('0x7')](_0x1304ad));for(var _0x232318=0x0;_0x232318<_0x3d80a8[_0x0c44('0x8')];_0x232318++){var _0x4bbc4d=_0x1304ad[_0x3d80a8[_0x232318]][_0x0c44('0x9')](function(_0x52668c){return _0x52668c[_0x0c44('0xa')]===_0x0c44('0xb')&&_0x52668c[_0x0c44('0xc')]===![];});_0x42a87f=_0x42a87f[_0x0c44('0xd')](_0x4bbc4d);}return _0x42a87f;}function getFirstInterface(){var _0x4577da=_[_0x0c44('0xe')](getInterfaces());return{'macAddress':_0x4577da&&_0x4577da[_0x0c44('0xf')]?_0x4577da[_0x0c44('0xf')]:_0x0c44('0x10'),'ipAddress':_0x4577da&&_0x4577da['address']?_0x4577da['address']:'127.0.0.1'};}exports[_0x0c44('0x11')]=getFirstInterface;function getCPUhash(){var _0x5f2fb5=_[_0x0c44('0x6')](os[_0x0c44('0x12')]()[_0x0c44('0x13')](function(_0x12568c){return _0x12568c[_0x0c44('0x14')];}))[_0x0c44('0x15')](':');return crypto['createHash']('md5')['update'](_0x5f2fb5)[_0x0c44('0x16')](_0x0c44('0x17'));}exports[_0x0c44('0x18')]=function(){var _0x2eed64=os[_0x0c44('0x19')]();var _0x362ca1=/[0-9a-f-]{36}/;if(config[_0x0c44('0x1a')]&&_0x362ca1[_0x0c44('0x1b')](config[_0x0c44('0x1a')])){return config[_0x0c44('0x1a')];}else if(_0x2eed64===_0x0c44('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x0c44('0x1d')})['replace']('\x0d\x0a','');}else{var _0x4dbf41=getFirstInterface();var _0x4a61e0=getCPUhash();var _0xadcf56=_0x4a61e0+'|'+os[_0x0c44('0x1e')]()+'|'+_0x4dbf41[_0x0c44('0x1f')]+'|'+_0x4dbf41[_0x0c44('0x20')];var _0x512a10=crypto['createHash']('md5')['update'](_0xadcf56)[_0x0c44('0x16')](_0x0c44('0x17'));return _0x512a10[_0x0c44('0x21')](0x0,0x8)+'-'+_0x512a10[_0x0c44('0x21')](0x8,0xc)+'-'+_0x512a10['substring'](0xc,0x10)+'-'+_0x512a10[_0x0c44('0x21')](0x10,0x14)+'-'+_0x512a10[_0x0c44('0x21')](0x14);}}; \ No newline at end of file +var _0x36a0=['address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','update','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','digest','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','head','mac','00:00:00:00:00:00'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x36a0,0x81));var _0x036a=function(_0xc5b35d,_0x142bdc){_0xc5b35d=_0xc5b35d-0x0;var _0x21fc93=_0x36a0[_0xc5b35d];return _0x21fc93;};'use strict';var _=require(_0x036a('0x0'));var os=require('os');var crypto=require(_0x036a('0x1'));var machine=require(_0x036a('0x2'));var exec=require('child_process')[_0x036a('0x3')];var config=require(_0x036a('0x4'));function getInterfaces(){var _0x33dae4=[];var _0x126301=os[_0x036a('0x5')]();var _0x39541c=_[_0x036a('0x6')](_[_0x036a('0x7')](_0x126301));for(var _0x20b740=0x0;_0x20b740<_0x39541c[_0x036a('0x8')];_0x20b740++){var _0x257fd1=_0x126301[_0x39541c[_0x20b740]]['filter'](function(_0x1b925f){return _0x1b925f[_0x036a('0x9')]===_0x036a('0xa')&&_0x1b925f[_0x036a('0xb')]===![];});_0x33dae4=_0x33dae4['concat'](_0x257fd1);}return _0x33dae4;}function getFirstInterface(){var _0x297ae8=_[_0x036a('0xc')](getInterfaces());return{'macAddress':_0x297ae8&&_0x297ae8[_0x036a('0xd')]?_0x297ae8['mac']:_0x036a('0xe'),'ipAddress':_0x297ae8&&_0x297ae8[_0x036a('0xf')]?_0x297ae8['address']:_0x036a('0x10')};}exports[_0x036a('0x11')]=getFirstInterface;function getCPUhash(){var _0xf0cb14=_[_0x036a('0x6')](os[_0x036a('0x12')]()[_0x036a('0x13')](function(_0x3281a3){return _0x3281a3[_0x036a('0x14')];}))[_0x036a('0x15')](':');return crypto['createHash'](_0x036a('0x16'))[_0x036a('0x17')](_0xf0cb14)['digest']('hex');}exports['getUuid']=function(){var _0x5db6b5=os[_0x036a('0x18')]();var _0x4c0f4c=/[0-9a-f-]{36}/;if(config[_0x036a('0x19')]&&_0x4c0f4c['test'](config['licenseToken'])){return config[_0x036a('0x19')];}else if(_0x5db6b5==='win32'){return exec(_0x036a('0x1a'),{'encoding':_0x036a('0x1b')})[_0x036a('0x1c')]('\x0d\x0a','');}else{var _0x502623=getFirstInterface();var _0x5eeb31=getCPUhash();var _0x514d08=_0x5eeb31+'|'+os[_0x036a('0x1d')]()+'|'+_0x502623[_0x036a('0x1e')]+'|'+_0x502623[_0x036a('0x1f')];var _0xc803b3=crypto[_0x036a('0x20')](_0x036a('0x16'))[_0x036a('0x17')](_0x514d08)[_0x036a('0x21')](_0x036a('0x22'));return _0xc803b3[_0x036a('0x23')](0x0,0x8)+'-'+_0xc803b3[_0x036a('0x23')](0x8,0xc)+'-'+_0xc803b3[_0x036a('0x23')](0xc,0x10)+'-'+_0xc803b3[_0x036a('0x23')](0x10,0x14)+'-'+_0xc803b3[_0x036a('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a9efcbe..2f12e09 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 _0xd896=['./hardware','../logger','license','https://www.xcallymotion.com','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','request-promise','../../mysqldb','../../components/encryptor'];(function(_0x1e1d31,_0x9b8d53){var _0x3ab3af=function(_0x461b0d){while(--_0x461b0d){_0x1e1d31['push'](_0x1e1d31['shift']());}};_0x3ab3af(++_0x9b8d53);}(_0xd896,0x15b));var _0x6d89=function(_0x549ddb,_0x15eeb1){_0x549ddb=_0x549ddb-0x0;var _0x222552=_0xd896[_0x549ddb];return _0x222552;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x6d89('0x0'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require(_0x6d89('0x1'))['db'];var encryptor=require(_0x6d89('0x2'));var hardware=require(_0x6d89('0x3'));var logger=require(_0x6d89('0x4'))(_0x6d89('0x5'));var HOST=_0x6d89('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xed9c5e){return new BPromise(function(_0x236bea,_0x3e3073){var _0x19a66f=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0xed9c5e,module[_0x6d89('0x7')][_0x6d89('0x8')]);if(oldToken){_0x19a66f=util[_0x6d89('0x9')](_0x6d89('0xa'),HOST,_0xed9c5e,module['exports'][_0x6d89('0x8')],oldToken);}var _0x4da00d={'uri':_0x19a66f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4da00d)[_0x6d89('0xb')](function(_0x19cb73){_0x236bea(_0x19cb73);})['catch'](function(_0xe44774){_0x3e3073(_0xe44774);});});}function manageLicense(_0x1c98d1,_0x1ebecd){var _0x4ddf5f=_0x1ebecd['get']({'plain':!![]});if(!isOldTokenSent&&_0x4ddf5f[_0x6d89('0xc')]!==_0x1c98d1&&!_0x4ddf5f[_0x6d89('0xd')]){oldToken=_0x4ddf5f['data1'];}httpRequest(_0x1c98d1)[_0x6d89('0xb')](function(_0x203078){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x203078['active']){isOldTokenSent=![];if(!_0x4ddf5f[_0x6d89('0x5')]&&_0x4ddf5f[_0x6d89('0x5')]!=_0x203078[_0x6d89('0x5')]||_0x4ddf5f[_0x6d89('0x5')]&&_0x4ddf5f['data2']){logger[_0x6d89('0xe')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4ddf5f['license']&&!_0x4ddf5f[_0x6d89('0xd')]&&_0x4ddf5f[_0x6d89('0x5')]!=_0x203078['license']){logger[_0x6d89('0xe')](_0x6d89('0xf'));}if(_0x4ddf5f[_0x6d89('0x5')]&&!_0x4ddf5f[_0x6d89('0xd')]&&_0x4ddf5f['license']==_0x203078['license']){return _0x1ebecd;}return _0x1ebecd[_0x6d89('0x10')]({'data1':_0x1c98d1,'data2':null,'license':_0x203078[_0x6d89('0x5')]});}else{if(_0x203078[_0x6d89('0x5')]||_0x4ddf5f[_0x6d89('0x5')]){if(!_0x4ddf5f[_0x6d89('0xd')]){if(_0x4ddf5f[_0x6d89('0xc')]==_0x1c98d1){GRAY_PERIOD_REASON=_0x6d89('0x11');logger[_0x6d89('0xe')](_0x6d89('0x12'));}else{GRAY_PERIOD_REASON=_0x6d89('0x13');logger[_0x6d89('0xe')](_0x6d89('0x14'),_0x4ddf5f['data1'],_0x1c98d1);}logger[_0x6d89('0xe')](_0x6d89('0x15'),GRAY_PERIOD_REASON[_0x6d89('0x16')](),moment()[_0x6d89('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x1ebecd['update']({'data2':encryptor['encryptString'](moment()[_0x6d89('0x9')](_0x6d89('0x17')))});}else{if(moment()[_0x6d89('0x18')](encryptor[_0x6d89('0x19')](_0x4ddf5f['data2']),_0x6d89('0x1a'))>DAYS){logger[_0x6d89('0xe')]('DEMO\x20START\x20AT\x20%s',moment()[_0x6d89('0x9')](_0x6d89('0x17')));isOldTokenSent=![];return _0x1ebecd['update']({'data1':_0x1c98d1,'data2':null,'license':null});}}}else{if(_0x4ddf5f[_0x6d89('0xc')]!=_0x1c98d1){logger['info'](_0x6d89('0x14'),_0x4ddf5f[_0x6d89('0xc')],_0x1c98d1);return _0x1ebecd[_0x6d89('0x10')]({'data1':_0x1c98d1,'data2':null,'license':null});}}}return _0x1ebecd;})[_0x6d89('0xb')](function(_0x14a9ba){_0x1ebecd=_0x14a9ba;})[_0x6d89('0x1b')](function(_0x2f140b){logger[_0x6d89('0x1c')](_0x2f140b[_0x6d89('0x1d')]);})[_0x6d89('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x6d89('0x1f')](),_0x1ebecd);},TIME);});}function defaultLicense(){var _0x54f520=hardware[_0x6d89('0x1f')]();if(_0x54f520){return db['License'][_0x6d89('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0x54f520}})[_0x6d89('0x21')](function(_0x57193f,_0x495139){logger[_0x6d89('0xe')](_0x6d89('0x22'),_0x54f520);manageLicense(_0x54f520,_0x57193f);})['catch'](function(_0x4cea7a){logger[_0x6d89('0x1c')](_0x4cea7a[_0x6d89('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xbc4a=['exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','data2','active','license','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbc4a,0x106));var _0xabc4=function(_0x268711,_0x151157){_0x268711=_0x268711-0x0;var _0x296608=_0xbc4a[_0x268711];return _0x296608;};'use strict';var util=require(_0xabc4('0x0'));var moment=require(_0xabc4('0x1'));var rp=require(_0xabc4('0x2'));var BPromise=require(_0xabc4('0x3'));var pkginfo=require(_0xabc4('0x4'))(module,_0xabc4('0x5'));var db=require(_0xabc4('0x6'))['db'];var encryptor=require(_0xabc4('0x7'));var hardware=require(_0xabc4('0x8'));var logger=require('../logger')('license');var HOST=_0xabc4('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4e9509){return new BPromise(function(_0x546bfd,_0x522fc4){var _0x320856=util['format'](_0xabc4('0xa'),HOST,_0x4e9509,module[_0xabc4('0xb')][_0xabc4('0x5')]);if(oldToken){_0x320856=util[_0xabc4('0xc')](_0xabc4('0xd'),HOST,_0x4e9509,module[_0xabc4('0xb')][_0xabc4('0x5')],oldToken);}var _0x3dadc2={'uri':_0x320856,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3dadc2)[_0xabc4('0xe')](function(_0x127f23){_0x546bfd(_0x127f23);})[_0xabc4('0xf')](function(_0x23d500){_0x522fc4(_0x23d500);});});}function manageLicense(_0x19b49e,_0x2a1660){var _0x5cb8f2=_0x2a1660['get']({'plain':!![]});if(!isOldTokenSent&&_0x5cb8f2[_0xabc4('0x10')]!==_0x19b49e&&!_0x5cb8f2[_0xabc4('0x11')]){oldToken=_0x5cb8f2['data1'];}httpRequest(_0x19b49e)[_0xabc4('0xe')](function(_0x1ab836){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1ab836[_0xabc4('0x12')]){isOldTokenSent=![];if(!_0x5cb8f2[_0xabc4('0x13')]&&_0x5cb8f2[_0xabc4('0x13')]!=_0x1ab836[_0xabc4('0x13')]||_0x5cb8f2[_0xabc4('0x13')]&&_0x5cb8f2[_0xabc4('0x11')]){logger[_0xabc4('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5cb8f2[_0xabc4('0x13')]&&!_0x5cb8f2[_0xabc4('0x11')]&&_0x5cb8f2[_0xabc4('0x13')]!=_0x1ab836[_0xabc4('0x13')]){logger[_0xabc4('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5cb8f2[_0xabc4('0x13')]&&!_0x5cb8f2[_0xabc4('0x11')]&&_0x5cb8f2[_0xabc4('0x13')]==_0x1ab836[_0xabc4('0x13')]){return _0x2a1660;}return _0x2a1660[_0xabc4('0x15')]({'data1':_0x19b49e,'data2':null,'license':_0x1ab836[_0xabc4('0x13')]});}else{if(_0x1ab836[_0xabc4('0x13')]||_0x5cb8f2[_0xabc4('0x13')]){if(!_0x5cb8f2[_0xabc4('0x11')]){if(_0x5cb8f2[_0xabc4('0x10')]==_0x19b49e){GRAY_PERIOD_REASON=_0xabc4('0x16');logger[_0xabc4('0x14')](_0xabc4('0x17'));}else{GRAY_PERIOD_REASON=_0xabc4('0x18');logger[_0xabc4('0x14')](_0xabc4('0x19'),_0x5cb8f2[_0xabc4('0x10')],_0x19b49e);}logger[_0xabc4('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xabc4('0x1a')](),moment()[_0xabc4('0xc')](_0xabc4('0x1b')));return _0x2a1660['update']({'data2':encryptor['encryptString'](moment()['format'](_0xabc4('0x1b')))});}else{if(moment()[_0xabc4('0x1c')](encryptor[_0xabc4('0x1d')](_0x5cb8f2[_0xabc4('0x11')]),_0xabc4('0x1e'))>DAYS){logger[_0xabc4('0x14')](_0xabc4('0x1f'),moment()[_0xabc4('0xc')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2a1660[_0xabc4('0x15')]({'data1':_0x19b49e,'data2':null,'license':null});}}}else{if(_0x5cb8f2[_0xabc4('0x10')]!=_0x19b49e){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5cb8f2[_0xabc4('0x10')],_0x19b49e);return _0x2a1660[_0xabc4('0x15')]({'data1':_0x19b49e,'data2':null,'license':null});}}}return _0x2a1660;})[_0xabc4('0xe')](function(_0x57a330){_0x2a1660=_0x57a330;})[_0xabc4('0xf')](function(_0x2bd14a){logger[_0xabc4('0x20')](_0x2bd14a[_0xabc4('0x21')]);})[_0xabc4('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xabc4('0x23')](),_0x2a1660);},TIME);});}function defaultLicense(){var _0x54bb64=hardware[_0xabc4('0x23')]();if(_0x54bb64){return db[_0xabc4('0x24')][_0xabc4('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x54bb64}})['spread'](function(_0x54a68d,_0x365b8c){logger[_0xabc4('0x14')](_0xabc4('0x26'),_0x54bb64);manageLicense(_0x54bb64,_0x54a68d);})[_0xabc4('0xf')](function(_0x150896){logger[_0xabc4('0x20')](_0x150896[_0xabc4('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 575f9f8..dbdb5b0 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 _0x04fc=['../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','User','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird'];(function(_0x59e5a4,_0x1e6cde){var _0x43d707=function(_0x239a6e){while(--_0x239a6e){_0x59e5a4['push'](_0x59e5a4['shift']());}};_0x43d707(++_0x1e6cde);}(_0x04fc,0x17d));var _0xc04f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x04fc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc04f('0x0'));var _=require('lodash');var moment=require(_0xc04f('0x1'));var BPromise=require(_0xc04f('0x2'));var hardware=require('./hardware');var encryptor=require(_0xc04f('0x3'));var db=require(_0xc04f('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':_0xc04f('0x5'),'machineUuid':hardware[_0xc04f('0x6')](),'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':_0xc04f('0x7'),'machineUuid':hardware[_0xc04f('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x349fd4){return new BPromise(function(_0x4e0bed,_0x5873db){return db[_0xc04f('0x8')][_0xc04f('0x9')](_[_0xc04f('0xa')](_0x349fd4,{'raw':!![],'where':{'id':0x1}}))[_0xc04f('0xb')](function(_0x4eeea9){return checkLicense(_0x4eeea9,null);})[_0xc04f('0xb')](function(_0x39398b){_0x4e0bed(_0x39398b);return;})[_0xc04f('0xc')](function(_0x33b9cc){_0x5873db(_0x33b9cc);});});}function checkLicense(_0x117090,_0x1140b9){if(!_0x117090){demoLicense[_0xc04f('0xd')]=_0x117090['data1'];return demoLicense;}try{var _0x50cc5f=_0x1140b9||_0x117090[_0xc04f('0xe')];if(_[_0xc04f('0xf')](_0x50cc5f)){throw new Error(_0xc04f('0x10'));}var _0xc1c5dd=_0x117090[_0xc04f('0x11')];var _0x8600d5=_0x117090[_0xc04f('0x12')];var _0x39ce8d=_0xc1c5dd[_0xc04f('0x13')]('-')[0x4];var _0x40936b=_0xc1c5dd['split']('-')[0x0];var _0xf906b9=encryptor[_0xc04f('0x14')](_0x50cc5f,util[_0xc04f('0x15')]('%s:%s:%s',_0x39ce8d,_0xc1c5dd,_0x40936b));var _0xc43d28=JSON['parse'](_0xf906b9);_0xc43d28[_0xc04f('0x16')]=![];_0xc43d28['uuid']=_0xc1c5dd;_0xc43d28[_0xc04f('0x17')]=hardware[_0xc04f('0x6')]();if(_0x8600d5){var _0xf75bff=encryptor[_0xc04f('0x14')](_0x8600d5);_0xc43d28[_0xc04f('0x18')]=_0xf75bff;_0xc43d28[_0xc04f('0x19')]=moment(_0xf75bff)[_0xc04f('0x1a')](0x7,_0xc04f('0x1b'))[_0xc04f('0x15')]();_0xc43d28['grayReason']=_0xc43d28[_0xc04f('0xd')]!=_0xc43d28['machineUuid']?_0xc04f('0x1c'):_0xc04f('0x1d');}return _0xc43d28;}catch(_0xbefbd1){breakingLicense[_0xc04f('0xd')]=_0x117090['data1'];breakingLicense[_0xc04f('0x1e')]=_0xbefbd1[_0xc04f('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x32fcbb,_0xe52227){getLicense()[_0xc04f('0xb')](function(_0x32d4f8){return db[_0xc04f('0x1f')][_0xc04f('0x20')]({'attributes':[_0xc04f('0x21'),[db['sequelize']['fn'](_0xc04f('0x22'),db[_0xc04f('0x23')][_0xc04f('0x24')](_0xc04f('0x21'))),_0xc04f('0x25')]],'group':_0xc04f('0x21'),'where':{'role':{'$or':[_0xc04f('0x26'),_0xc04f('0x27'),_0xc04f('0x28')]}},'raw':!![]})[_0xc04f('0xb')](function(_0x5d60e0){var _0x5dd0d7={'user':_0x32d4f8[_0xc04f('0x29')]||0x0,'telephone':_0x32d4f8[_0xc04f('0x2a')]||0x0};_0x5d60e0[_0xc04f('0x2b')](function(_0x2cea4){var _0x2d6cf8=_0x2cea4[_0xc04f('0x21')]===_0xc04f('0x26')?'user':_0x2cea4['role'];_0x5dd0d7[_0x2d6cf8]-=_0x2cea4[_0xc04f('0x25')];if(_0x5dd0d7[_0x2d6cf8]<0x0)_0x5dd0d7[_0x2d6cf8]=0x0;});_0x32fcbb(_0x5dd0d7);return;});})[_0xc04f('0xc')](function(_0x750d3){_0xe52227(_0x750d3);});});}function checkUserLimits(_0x3e0a17){return new BPromise(function(_0x163b84,_0x1c1955){getLimits()[_0xc04f('0xb')](function(_0x2ae69a){var _0x47b359=_[_0xc04f('0x2c')](_[_0xc04f('0x2d')](_0x3e0a17,_0xc04f('0x21')),[_0xc04f('0x26'),'user','telephone']);var _0x119177=(_0x47b359[_0xc04f('0x26')]||0x0)+(_0x47b359['user']||0x0);var _0x437914=_0x47b359['telephone']||0x0;if(_0x119177>_0x2ae69a['user'])return _0x1c1955(_0xc04f('0x2e'));if(_0x437914>_0x2ae69a[_0xc04f('0x28')])return _0x1c1955(_0xc04f('0x2f'));return _0x163b84();})['catch'](function(_0x29b1ac){_0x1c1955(_0x29b1ac);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xc9a2=['getUuid','deadline','days','grayReason','disabled','message','sequelize','COUNT','col','count','role','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid'];(function(_0x577fe9,_0x2a3fac){var _0x12524b=function(_0x1d82c3){while(--_0x1d82c3){_0x577fe9['push'](_0x577fe9['shift']());}};_0x12524b(++_0x2a3fac);}(_0xc9a2,0xf6));var _0x2c9a=function(_0x1220f9,_0x3732a0){_0x1220f9=_0x1220f9-0x0;var _0x2607b3=_0xc9a2[_0x1220f9];return _0x2607b3;};'use strict';var util=require(_0x2c9a('0x0'));var _=require(_0x2c9a('0x1'));var moment=require(_0x2c9a('0x2'));var BPromise=require('bluebird');var hardware=require(_0x2c9a('0x3'));var encryptor=require(_0x2c9a('0x4'));var db=require(_0x2c9a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2c9a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2c9a('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2c9a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2c9a('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x125906){return new BPromise(function(_0x4e2890,_0x3d72fb){return db['License'][_0x2c9a('0x9')](_[_0x2c9a('0xa')](_0x125906,{'raw':!![],'where':{'id':0x1}}))[_0x2c9a('0xb')](function(_0x5a60f2){return checkLicense(_0x5a60f2,null);})[_0x2c9a('0xb')](function(_0x424ab0){_0x4e2890(_0x424ab0);return;})[_0x2c9a('0xc')](function(_0x4dec6e){_0x3d72fb(_0x4dec6e);});});}function checkLicense(_0xa88a78,_0x2dd527){if(!_0xa88a78){demoLicense[_0x2c9a('0xd')]=_0xa88a78[_0x2c9a('0xe')];return demoLicense;}try{var _0x24df20=_0x2dd527||_0xa88a78[_0x2c9a('0xf')];if(_[_0x2c9a('0x10')](_0x24df20)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x593388=_0xa88a78[_0x2c9a('0xe')];var _0x4b1bc1=_0xa88a78['data2'];var _0x2ec0b7=_0x593388[_0x2c9a('0x11')]('-')[0x4];var _0x1243dc=_0x593388['split']('-')[0x0];var _0x3d58e8=encryptor[_0x2c9a('0x12')](_0x24df20,util[_0x2c9a('0x13')](_0x2c9a('0x14'),_0x2ec0b7,_0x593388,_0x1243dc));var _0x133358=JSON[_0x2c9a('0x15')](_0x3d58e8);_0x133358[_0x2c9a('0x16')]=![];_0x133358['uuid']=_0x593388;_0x133358[_0x2c9a('0x17')]=hardware[_0x2c9a('0x18')]();if(_0x4b1bc1){var _0x1e217d=encryptor[_0x2c9a('0x12')](_0x4b1bc1);_0x133358['gray']=_0x1e217d;_0x133358[_0x2c9a('0x19')]=moment(_0x1e217d)['add'](0x7,_0x2c9a('0x1a'))[_0x2c9a('0x13')]();_0x133358[_0x2c9a('0x1b')]=_0x133358[_0x2c9a('0xd')]!=_0x133358[_0x2c9a('0x17')]?'changed':_0x2c9a('0x1c');}return _0x133358;}catch(_0x1b74e3){breakingLicense['uuid']=_0xa88a78['data1'];breakingLicense[_0x2c9a('0x1d')]=_0x1b74e3[_0x2c9a('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2e973c,_0x407080){getLicense()['then'](function(_0x32d81b){return db['User']['findAll']({'attributes':['role',[db[_0x2c9a('0x1e')]['fn'](_0x2c9a('0x1f'),db[_0x2c9a('0x1e')][_0x2c9a('0x20')]('role')),_0x2c9a('0x21')]],'group':_0x2c9a('0x22'),'where':{'role':{'$or':[_0x2c9a('0x23'),_0x2c9a('0x24'),_0x2c9a('0x25')]}},'raw':!![]})['then'](function(_0x9e522d){var _0x1a396b={'user':_0x32d81b['users']||0x0,'telephone':_0x32d81b[_0x2c9a('0x26')]||0x0};_0x9e522d[_0x2c9a('0x27')](function(_0x4089ed){var _0x562cde=_0x4089ed['role']===_0x2c9a('0x23')?_0x2c9a('0x24'):_0x4089ed[_0x2c9a('0x22')];_0x1a396b[_0x562cde]-=_0x4089ed['count'];if(_0x1a396b[_0x562cde]<0x0)_0x1a396b[_0x562cde]=0x0;});_0x2e973c(_0x1a396b);return;});})[_0x2c9a('0xc')](function(_0x53d77e){_0x407080(_0x53d77e);});});}function checkUserLimits(_0x1e890c){return new BPromise(function(_0x888a11,_0x87baeb){getLimits()['then'](function(_0x2cbd92){var _0x3c0aaf=_[_0x2c9a('0x28')](_[_0x2c9a('0x29')](_0x1e890c,_0x2c9a('0x22')),['admin',_0x2c9a('0x24'),_0x2c9a('0x25')]);var _0x491d16=(_0x3c0aaf[_0x2c9a('0x23')]||0x0)+(_0x3c0aaf[_0x2c9a('0x24')]||0x0);var _0x428025=_0x3c0aaf[_0x2c9a('0x25')]||0x0;if(_0x491d16>_0x2cbd92[_0x2c9a('0x24')])return _0x87baeb(_0x2c9a('0x2a'));if(_0x428025>_0x2cbd92[_0x2c9a('0x25')])return _0x87baeb(_0x2c9a('0x2b'));return _0x888a11();})[_0x2c9a('0xc')](function(_0x3f8ea4){_0x87baeb(_0x3f8ea4);});});}module[_0x2c9a('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 105efe8..54a1f06 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 _0x36ee=['myappanuglar-secret','secret'];(function(_0x3f5640,_0x2cc66d){var _0x171259=function(_0x45166f){while(--_0x45166f){_0x3f5640['push'](_0x3f5640['shift']());}};_0x171259(++_0x2cc66d);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe36e('0x0'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe36e('0x1'),'DEBUG':''}; \ No newline at end of file +var _0x065e=['secret','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x065e,0x1a7));var _0xe065=function(_0x3af4ba,_0x22b29e){_0x3af4ba=_0x3af4ba-0x0;var _0x44a185=_0x065e[_0x3af4ba];return _0x44a185;};'use strict';module[_0xe065('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe065('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ae707f8..ad20db1 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21ac=['fileLogger','../utils/loggers'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x21ac,0x123));var _0xc21a=function(_0x4aaffc,_0x55b239){_0x4aaffc=_0x4aaffc-0x0;var _0x41bfdd=_0x21ac[_0x4aaffc];return _0x41bfdd;};'use strict';var fileLogger=require(_0xc21a('0x0'))[_0xc21a('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xbd9f=['fileLogger'];(function(_0x3c5e3c,_0x45963b){var _0x24a83f=function(_0x36f482){while(--_0x36f482){_0x3c5e3c['push'](_0x3c5e3c['shift']());}};_0x24a83f(++_0x45963b);}(_0xbd9f,0x19c));var _0xfbd9=function(_0x42ee1e,_0x3f1a64){_0x42ee1e=_0x42ee1e-0x0;var _0x1e21b8=_0xbd9f[_0x42ee1e];return _0x1e21b8;};'use strict';var fileLogger=require('../utils/loggers')[_0xfbd9('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 163043c..a9aff00 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 _0x13fa=['ami','join','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','legacy-libs','express','../../services/express/index.js'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x13fa,0x6b));var _0xa13f=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0x13fa[_0x57ee1d];return _0x12a933;};'use strict';var path=require(_0xa13f('0x0'));var cfg=require(_0xa13f('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg['root'],_0xa13f('0x2')))};var pm2config={'apps':[{'name':_0xa13f('0x3'),'script':path['join'](__dirname,_0xa13f('0x4')),'env':env},{'name':_0xa13f('0x5'),'script':path[_0xa13f('0x6')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xa13f('0x7'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xa13f('0x8'),'script':path['join'](__dirname,_0xa13f('0x9')),'env':env},{'name':_0xa13f('0xa'),'script':path[_0xa13f('0x6')](__dirname,_0xa13f('0xb')),'env':env},{'name':_0xa13f('0xc'),'script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0xa13f('0xd')]=pm2config; \ No newline at end of file +var _0xd2b1=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','legacy-libs','join','ami','email'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xd2b1,0xaa));var _0x1d2b=function(_0x524d77,_0x3489eb){_0x524d77=_0x524d77-0x0;var _0x4a3703=_0xd2b1[_0x524d77];return _0x4a3703;};'use strict';var path=require(_0x1d2b('0x0'));var cfg=require(_0x1d2b('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg['root'],_0x1d2b('0x2')))};var pm2config={'apps':[{'name':'express','script':path[_0x1d2b('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x1d2b('0x4'),'script':path[_0x1d2b('0x3')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x1d2b('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x1d2b('0x5'),'script':path[_0x1d2b('0x3')](__dirname,_0x1d2b('0x6')),'env':env},{'name':_0x1d2b('0x7'),'script':path['join'](__dirname,_0x1d2b('0x8')),'env':env},{'name':_0x1d2b('0x9'),'script':path[_0x1d2b('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x1d2b('0xa')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ae75c3c..6bd5245 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 _0x0979=['delete','./config','connect','then','start','stop','disconnect','restart','list','describe'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0979,0xdd));var _0x9097=function(_0x33f1f1,_0x3f2a10){_0x33f1f1=_0x33f1f1-0x0;var _0x3052d4=_0x0979[_0x33f1f1];return _0x3052d4;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x9097('0x0'));function connect(){return new BPromise(function(_0x2d1349,_0x2c616b){return pm2[_0x9097('0x1')](function(_0xcdd020){if(_0xcdd020){return _0x2c616b(_0xcdd020);}return _0x2d1349('connected');});});};exports['start']=function(_0x4702d6){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x4c2f71,_0x301ea0){return pm2[_0x9097('0x3')](_0x4702d6,function(_0x2999b5,_0x461ec2){if(_0x2999b5){return _0x301ea0(_0x2999b5);}pm2['disconnect']();return _0x4c2f71(_0x461ec2);});});});};exports[_0x9097('0x4')]=function(_0x3b333b){return connect()['then'](function(){return new BPromise(function(_0x53dcdd,_0x1be775){return pm2[_0x9097('0x4')](_0x3b333b,function(_0x4e1f23,_0x49324f){if(_0x4e1f23){return _0x1be775(_0x4e1f23);}pm2[_0x9097('0x5')]();return _0x53dcdd(_0x49324f);});});});};exports[_0x9097('0x6')]=function(_0x4452a4){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0xda5b63,_0x3ac4fa){return pm2[_0x9097('0x6')](_0x4452a4,function(_0xf24b86,_0x1ade91){if(_0xf24b86){return _0x3ac4fa(_0xf24b86);}pm2[_0x9097('0x5')]();return _0xda5b63(_0x1ade91);});});});};exports[_0x9097('0x7')]=function(){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x369947,_0x21681f){return pm2[_0x9097('0x7')](function(_0x566556,_0x3a2270){if(_0x566556){return _0x21681f(_0x566556);}pm2[_0x9097('0x5')]();return _0x369947(_0x3a2270);});});});};exports[_0x9097('0x8')]=function(_0x57fe62){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x5331f2,_0x360c1a){return pm2['describe'](_0x57fe62,function(_0x146fb0,_0x3fcd9b){if(_0x146fb0){return _0x360c1a(_0x146fb0);}pm2[_0x9097('0x5')]();return _0x5331f2(_0x3fcd9b);});});});};exports[_0x9097('0x9')]=function(_0x3cda79){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x5adfe2,_0x106e5e){return pm2[_0x9097('0x9')](_0x3cda79,function(_0x24b898,_0x3f0896){if(_0x24b898){return _0x106e5e(_0x24b898);}pm2['disconnect']();return _0x5adfe2(_0x3f0896);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x4bea79,_0x2fc163){return pm2['dump'](function(_0x11bd21){if(_0x11bd21){return _0x2fc163(_0x11bd21);}return _0x4bea79('saved');});});});}; \ No newline at end of file +var _0x4bb0=['start','disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','connect','connected','then'];(function(_0x4879e2,_0xcc5f6f){var _0x49e348=function(_0xfe943d){while(--_0xfe943d){_0x4879e2['push'](_0x4879e2['shift']());}};_0x49e348(++_0xcc5f6f);}(_0x4bb0,0x134));var _0x04bb=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x4bb0[_0x164af1];return _0x5d81a2;};'use strict';var pm2=require('pm2');var BPromise=require(_0x04bb('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x20505b,_0x387093){return pm2[_0x04bb('0x1')](function(_0x39745b){if(_0x39745b){return _0x387093(_0x39745b);}return _0x20505b(_0x04bb('0x2'));});});};exports['start']=function(_0x592b55){return connect()[_0x04bb('0x3')](function(){return new BPromise(function(_0x46657e,_0x39a69d){return pm2[_0x04bb('0x4')](_0x592b55,function(_0x1001ae,_0x415c58){if(_0x1001ae){return _0x39a69d(_0x1001ae);}pm2[_0x04bb('0x5')]();return _0x46657e(_0x415c58);});});});};exports[_0x04bb('0x6')]=function(_0x1d385c){return connect()[_0x04bb('0x3')](function(){return new BPromise(function(_0x2a483a,_0x2f04e5){return pm2[_0x04bb('0x6')](_0x1d385c,function(_0x331d98,_0x1244c8){if(_0x331d98){return _0x2f04e5(_0x331d98);}pm2[_0x04bb('0x5')]();return _0x2a483a(_0x1244c8);});});});};exports[_0x04bb('0x7')]=function(_0x416b32){return connect()['then'](function(){return new BPromise(function(_0x329b2a,_0x54568c){return pm2[_0x04bb('0x7')](_0x416b32,function(_0x54e11f,_0x382814){if(_0x54e11f){return _0x54568c(_0x54e11f);}pm2[_0x04bb('0x5')]();return _0x329b2a(_0x382814);});});});};exports[_0x04bb('0x8')]=function(){return connect()[_0x04bb('0x3')](function(){return new BPromise(function(_0x59771a,_0x168670){return pm2['list'](function(_0x4a6f67,_0x19d5b7){if(_0x4a6f67){return _0x168670(_0x4a6f67);}pm2[_0x04bb('0x5')]();return _0x59771a(_0x19d5b7);});});});};exports['describe']=function(_0x21a0e4){return connect()[_0x04bb('0x3')](function(){return new BPromise(function(_0x4166f6,_0x499689){return pm2[_0x04bb('0x9')](_0x21a0e4,function(_0x41a6d9,_0x1e4358){if(_0x41a6d9){return _0x499689(_0x41a6d9);}pm2[_0x04bb('0x5')]();return _0x4166f6(_0x1e4358);});});});};exports[_0x04bb('0xa')]=function(_0x2ca4b2){return connect()[_0x04bb('0x3')](function(){return new BPromise(function(_0x210849,_0x362a7c){return pm2['delete'](_0x2ca4b2,function(_0x2b983a,_0x445f5e){if(_0x2b983a){return _0x362a7c(_0x2b983a);}pm2[_0x04bb('0x5')]();return _0x210849(_0x445f5e);});});});};exports['dump']=function(){return connect()[_0x04bb('0x3')](function(){return new BPromise(function(_0x26aed1,_0x4034dd){return pm2[_0x04bb('0xb')](function(_0x920407){if(_0x920407){return _0x4034dd(_0x920407);}return _0x26aed1(_0x04bb('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 02aedbb..99e526c 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 _0xe520=['start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','subtract','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','then','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xe520,0x1f1));var _0x0e52=function(_0x4255e9,_0x1a9d71){_0x4255e9=_0x4255e9-0x0;var _0x245bff=_0xe520[_0x4255e9];return _0x245bff;};'use strict';var _=require('lodash');var moment=require(_0x0e52('0x0'));var Redis=require(_0x0e52('0x1'));var util=require(_0x0e52('0x2'));var config=require(_0x0e52('0x3'));var db=require(_0x0e52('0x4'))['db'];var logger=require(_0x0e52('0x5'))('schedule');config['redis']=_[_0x0e52('0x6')](config[_0x0e52('0x7')],{'host':_0x0e52('0x8'),'port':0x18eb});var io=require(_0x0e52('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x4dd65a=0x0;var _0x56eced=[];return db[_0x0e52('0xa')]['find']({'raw':!![],'attributes':['id',_0x0e52('0xb')],'where':{'id':0x1}})['then'](function(_0x3fc4d5){_0x4dd65a=_0x3fc4d5[_0x0e52('0xb')];if(_0x4dd65a){return db[_0x0e52('0xc')][_0x0e52('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0e52('0xe')](_0x3fc4d5[_0x0e52('0xb')],_0x0e52('0xf'))}}});}else{return[];}})['then'](function(_0xb2986e){if(_0xb2986e&&_0xb2986e['length']){_0x56eced=_[_0x0e52('0x10')](_0xb2986e||[],'id');logger['info'](_0x0e52('0x11'),_0x56eced[_0x0e52('0x12')]());return db[_0x0e52('0xc')][_0x0e52('0x13')]({'closeReason':'system','disposition':_0x0e52('0x14'),'closed':!![],'closedAt':moment()[_0x0e52('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x56eced}});}})[_0x0e52('0x16')](function(){if(_0x56eced&&_0x56eced[_0x0e52('0x17')]){logger[_0x0e52('0x18')](_0x0e52('0x19'),_0x56eced[_0x0e52('0x12')]());for(var _0x349ad9=0x0;_0x349ad9<_0x56eced[_0x0e52('0x17')];_0x349ad9++){io[_0x0e52('0x1a')](_0x0e52('0x1b'),{'id':_0x56eced[_0x349ad9],'closed':!![]});}}})[_0x0e52('0x1c')](function(_0x503758){logger[_0x0e52('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x503758?util['inspect'](_0x503758,{'showHidden':![],'depth':null}):'');});}exports[_0x0e52('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2016=['inspect','start','lodash','moment','../../config/environment','../logger','defaults','localhost','redis','Setting','chatTimeout','ChatInteraction','findAll','subtract','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x43d97b,_0x27951f){var _0x3ccced=function(_0x13bf1c){while(--_0x13bf1c){_0x43d97b['push'](_0x43d97b['shift']());}};_0x3ccced(++_0x27951f);}(_0x2016,0xa4));var _0x6201=function(_0x4f9f47,_0x25f7f9){_0x4f9f47=_0x4f9f47-0x0;var _0x2b27c0=_0x2016[_0x4f9f47];return _0x2b27c0;};'use strict';var _=require(_0x6201('0x0'));var moment=require(_0x6201('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x6201('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x6201('0x3'))('schedule');config['redis']=_[_0x6201('0x4')](config['redis'],{'host':_0x6201('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6201('0x6')]));function closeInteractions(){var _0x9efa20=0x0;var _0x36642a=[];return db[_0x6201('0x7')]['find']({'raw':!![],'attributes':['id',_0x6201('0x8')],'where':{'id':0x1}})['then'](function(_0x15065d){_0x9efa20=_0x15065d[_0x6201('0x8')];if(_0x9efa20){return db[_0x6201('0x9')][_0x6201('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6201('0xb')](_0x15065d[_0x6201('0x8')],'minutes')}}});}else{return[];}})[_0x6201('0xc')](function(_0x1515f3){if(_0x1515f3&&_0x1515f3[_0x6201('0xd')]){_0x36642a=_[_0x6201('0xe')](_0x1515f3||[],'id');logger[_0x6201('0xf')](_0x6201('0x10'),_0x36642a[_0x6201('0x11')]());return db[_0x6201('0x9')][_0x6201('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x6201('0x13'))},{'where':{'id':_0x36642a}});}})[_0x6201('0xc')](function(){if(_0x36642a&&_0x36642a[_0x6201('0xd')]){logger[_0x6201('0xf')](_0x6201('0x14'),_0x36642a['join']());for(var _0x57f7d2=0x0;_0x57f7d2<_0x36642a[_0x6201('0xd')];_0x57f7d2++){io[_0x6201('0x15')](_0x6201('0x16'),{'id':_0x36642a[_0x57f7d2],'closed':!![]});}}})[_0x6201('0x17')](function(_0x2bad69){logger['error'](_0x6201('0x18'),_0x2bad69?util[_0x6201('0x19')](_0x2bad69,{'showHidden':![],'depth':null}):'');});}exports[_0x6201('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 9b3de89..93ee965 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0d3=['exports'];(function(_0x527957,_0x5ddfb4){var _0x48b5c0=function(_0x4f8d5c){while(--_0x4f8d5c){_0x527957['push'](_0x527957['shift']());}};_0x48b5c0(++_0x5ddfb4);}(_0xa0d3,0xab));var _0x3a0d=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xa0d3[_0x999b85];return _0x1d7124;};'use strict';function start(){var _0x46a182=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x46a182['startAllRefreshIntervals']();}module[_0x3a0d('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xab0c=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x52fc60,_0x50de65){var _0x6ec100=function(_0x14c7d2){while(--_0x14c7d2){_0x52fc60['push'](_0x52fc60['shift']());}};_0x6ec100(++_0x50de65);}(_0xab0c,0xad));var _0xcab0=function(_0x2452cd,_0x3c90ae){_0x2452cd=_0x2452cd-0x0;var _0x4f63df=_0xab0c[_0x2452cd];return _0x4f63df;};'use strict';function start(){var _0xb8c6dc=require(_0xcab0('0x0'));return _0xb8c6dc[_0xcab0('0x1')]();}module[_0xcab0('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 3e401e5..f232f19 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 _0xa740=['Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','catch','case\x20loading','currentAttempt','retryOptions','job','data','operation','stop','case\x20completed','Unrecognized\x20status:','dataValues','Job\x20ID\x20','report\x20status:','sendMail','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','cron-job-manager','bluebird','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','user','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a'];(function(_0x1f1398,_0x5cbe5e){var _0xdabd3c=function(_0x5ba839){while(--_0x5ba839){_0x1f1398['push'](_0x1f1398['shift']());}};_0xdabd3c(++_0x5cbe5e);}(_0xa740,0x10b));var _0x0a74=function(_0x1dd4de,_0x189290){_0x1dd4de=_0x1dd4de-0x0;var _0xf23408=_0xa740[_0x1dd4de];return _0xf23408;};'use strict';var fs=require('fs');var util=require(_0x0a74('0x0'));var path=require(_0x0a74('0x1'));var _=require(_0x0a74('0x2'));var moment=require('moment');var CronJobManager=require(_0x0a74('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x0a74('0x4'));var logger=require('../logger')(_0x0a74('0x5'));var db=require(_0x0a74('0x6'))['db'];const retry=require(_0x0a74('0x7'));var analyticCustomReportController=require(_0x0a74('0x8'));var analyticDefaultReportController=require(_0x0a74('0x9'));var client=jayson['client'][_0x0a74('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1b7775){const _0x4d3a07={};if(typeof _0x1b7775===_0x0a74('0xb')){_0x4d3a07['id']=_0x1b7775;}return db[_0x0a74('0xc')][_0x0a74('0xd')]({'where':_0x4d3a07})[_0x0a74('0xe')](function(_0x318810){return _0x318810;})['catch'](function(_0x66d346){logger[_0x0a74('0xf')](_0x66d346);});}function handleSendEmail(_0x33e29e,_0x1cb695){logger[_0x0a74('0x10')](_0x0a74('0x11'),_0x33e29e[_0x0a74('0x12')]);var _0x5022b4=!![];var _0x1a8864=_0x33e29e[_0x0a74('0x13')][_0x0a74('0x14')]();var _0xf42250={'account':_0x1a8864,'message':{'from':util[_0x0a74('0x15')]('\x22%s\x22\x20<%s>',_0x33e29e[_0x0a74('0x13')][_0x0a74('0x16')],_0x33e29e['MailAccount'][_0x0a74('0x12')]||_0x33e29e[_0x0a74('0x13')][_0x0a74('0x17')][_0x0a74('0x18')]),'to':_0x33e29e[_0x0a74('0x12')],'cc':_0x33e29e['cc'],'bcc':_0x33e29e['bcc'],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x1cb695['name'],_0x33e29e[_0x0a74('0x19')],_0x33e29e[_0x0a74('0x1a')])}};var _0x89e4a=path[_0x0a74('0x1b')](__dirname,_0x0a74('0x1c'));var _0x3957c7=_0x1cb695[_0x0a74('0x1d')];var _0x5db1e3=util[_0x0a74('0x15')](_0x0a74('0x1e'),path[_0x0a74('0x1f')](_0x1cb695[_0x0a74('0x1d')],path[_0x0a74('0x20')](_0x1cb695[_0x0a74('0x1d')])),_0x0a74('0x21'));var _0x4c17f3=path[_0x0a74('0x1b')](_0x89e4a,_0x3957c7);var _0x3db459=path[_0x0a74('0x1b')](_0x89e4a,_0x5db1e3);if(fs[_0x0a74('0x22')](_0x4c17f3)){_0x1cb695['status']=_0x0a74('0x23');_0xf42250[_0x0a74('0x24')]['attachments']=[{'filename':_0x3957c7,'path':_0x4c17f3}];_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=util[_0x0a74('0x15')](_0x0a74('0x26'),JSON[_0x0a74('0x27')](_0x1cb695,null,0x2));}else if(fs[_0x0a74('0x22')](_0x3db459)){_0x1cb695['status']=_0x0a74('0x23');_0xf42250[_0x0a74('0x24')][_0x0a74('0x28')]=[{'filename':_0x5db1e3,'path':_0x3db459}];}else{if(_0x1cb695[_0x0a74('0x29')]==='Empty'){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x2a');if(!_0x33e29e[_0x0a74('0x2b')]){_0x5022b4=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x1cb695[_0x0a74('0x29')]===_0x0a74('0x2c')){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x2d');}else if(_0x1cb695[_0x0a74('0x29')]===_0x0a74('0x2e')){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x2f');}else if(_0x1cb695[_0x0a74('0x29')]===_0x0a74('0x30')){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x31');}else{logger['error'](_0x0a74('0x32'),_0x1cb695[_0x0a74('0x29')]);}}if(_0x5022b4){return client[_0x0a74('0x33')](_0x0a74('0x34'),_0xf42250)[_0x0a74('0xe')](function(_0xdf9647){if(_0xdf9647[_0x0a74('0xf')]){return logger[_0x0a74('0xf')](_0x0a74('0x35'),JSON[_0x0a74('0x27')](_0xdf9647));}return logger[_0x0a74('0x10')](_0x0a74('0x36'));})[_0x0a74('0x37')](function(_0x138794){return logger[_0x0a74('0xf')](_0x0a74('0x35'),JSON['stringify'](_0x138794));});}}function handleError(){return function(_0x328bcd){return logger[_0x0a74('0xf')](JSON['stringify'](_0x328bcd));};}function loading(_0x3e1e48){logger[_0x0a74('0x10')](_0x0a74('0x38'));if(_0x3e1e48[_0x0a74('0x39')]===_0x3e1e48[_0x0a74('0x3a')]['retries']){handleSendEmail(_0x3e1e48[_0x0a74('0x3b')],_0x3e1e48[_0x0a74('0x3c')]);_0x3e1e48[_0x0a74('0x3d')][_0x0a74('0x3e')]();}else{_0x3e1e48[_0x0a74('0x3d')][_0x0a74('0x7')]('still\x20loading');}}function completed(_0x1f492d){logger[_0x0a74('0x10')](_0x0a74('0x3f'));handleSendEmail(_0x1f492d[_0x0a74('0x3b')],_0x1f492d[_0x0a74('0x3c')]);_0x1f492d['operation']['stop']();}function empty(_0x21e9b6){logger[_0x0a74('0x10')]('case\x20empty');handleSendEmail(_0x21e9b6[_0x0a74('0x3b')],_0x21e9b6[_0x0a74('0x3c')]);_0x21e9b6[_0x0a74('0x3d')][_0x0a74('0x3e')]();}function failed(_0x3eca0b){logger[_0x0a74('0x10')]('case\x20failed');handleSendEmail(_0x3eca0b[_0x0a74('0x3b')],_0x3eca0b['data']);_0x3eca0b['operation']['stop']();}function urecognized(_0x472355){logger[_0x0a74('0xf')](_0x0a74('0x40'),_0x472355['entity'][_0x0a74('0x41')]['status']);_0x472355[_0x0a74('0x3d')][_0x0a74('0x3e')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xd9c336,_0x468fbe){const _0x3310b0={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0xdbc992=retry['operation'](_0x3310b0);_0xdbc992['attempt'](_0x17ef8f=>{logger[_0x0a74('0x10')](_0x0a74('0x42')+_0xd9c336['id']+'\x20Attempt\x20#:'+_0x17ef8f);try{getReportData(_0x468fbe['id'])['then'](function(_0x2a480c){_0x468fbe=_0x2a480c;logger['info'](_0x0a74('0x43'),_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]);if(!reportStatusStrategies[_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]]){logger[_0x0a74('0xf')](_0x0a74('0x43'),_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]);_0xdbc992[_0x0a74('0x7')]();}reportStatusStrategies[_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]]({'operation':_0xdbc992,'currentAttempt':_0x17ef8f,'retryOptions':_0x3310b0,'job':_0xd9c336,'data':_0x468fbe,'entity':_0x2a480c});});}catch(_0xfb9a5c){_0xdbc992['retry'](_0xfb9a5c);}});}function handleResult(_0x40d9ee){return function(_0x177e8b){if(_0x40d9ee[_0x0a74('0x44')]&&_0x40d9ee['MailAccount']&&_0x40d9ee['MailAccount'][_0x0a74('0x17')]&&!_[_0x0a74('0x45')](_0x40d9ee[_0x0a74('0x12')])){retryer(_0x40d9ee,_0x177e8b);}};}function handleJob(_0x9d867c){return function(){try{if(_['isNil'](_0x9d867c[_0x0a74('0x19')])){return logger[_0x0a74('0x10')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0a74('0x45')](_0x9d867c[_0x0a74('0x1a')])){return logger['info'](_0x0a74('0x46'));}var _0xcafd6c={'startDate':moment()[_0x0a74('0x47')](_0x9d867c['subtractNumber'],_0x9d867c[_0x0a74('0x1a')])['format'](_0x0a74('0x48')),'endDate':moment()[_0x0a74('0x15')](_0x0a74('0x48')),'type':_0x0a74('0x49'),'output':_0x9d867c['output'],'name':_0x9d867c['name']};if(!_[_0x0a74('0x45')](_0x9d867c[_0x0a74('0x4a')])){logger[_0x0a74('0x10')]('exec\x20defaul\x20report\x20id:%s',_0x9d867c[_0x0a74('0x4a')]);return analyticDefaultReportController['runReport']({'id':_0x9d867c['DefaultReportId']},_0xcafd6c)[_0x0a74('0xe')](handleResult(_0x9d867c))['catch'](handleError());}if(!_['isNil'](_0x9d867c[_0x0a74('0x4b')])){logger[_0x0a74('0x10')]('exec\x20custom\x20report\x20id:%s',_0x9d867c['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x9d867c[_0x0a74('0x4b')]},_0xcafd6c)['then'](handleResult(_0x9d867c))[_0x0a74('0x37')](handleError());}}catch(_0x222242){logger[_0x0a74('0xf')](JSON[_0x0a74('0x27')](_0x222242));}return logger[_0x0a74('0x10')](_0x0a74('0x4c'));};}function getJobs(_0x277118){var _0x290ac1={};if(_0x277118){_0x290ac1['id']=_0x277118;}return db[_0x0a74('0x4d')][_0x0a74('0x4e')]({'where':_0x290ac1,'include':[{'model':db[_0x0a74('0x13')],'attributes':['id',_0x0a74('0x16'),_0x0a74('0x12')],'include':[{'model':db['MailServerOut'],'as':_0x0a74('0x17'),'include':[{'model':db[_0x0a74('0x4f')],'as':'CloudProvider'}]}]}]})['then'](function(_0x1711be){var _0x45bfeb=_[_0x0a74('0x50')](manager[_0x0a74('0x51')]);var _0x3b8d4e=_[_0x0a74('0x52')](_0x1711be,function(_0x466cce){return _0x466cce['id'][_0x0a74('0x53')]();});var _0x12036a=_['keyBy'](_0x1711be,function(_0x3716c1){return _0x3716c1['id'][_0x0a74('0x53')]();});var _0x23ad82=_0x277118?_0x3b8d4e:_[_0x0a74('0x54')](_0x3b8d4e,_0x45bfeb);var _0x555f67=_[_0x0a74('0x55')](_0x3b8d4e,_0x45bfeb);var _0x50ccee=_[_0x0a74('0x54')](_0x45bfeb,_0x3b8d4e);var _0x4a9412;var _0x2684c3;for(_0x4a9412=0x0;_0x4a9412<_0x50ccee[_0x0a74('0x56')]&&!_0x277118;_0x4a9412+=0x1){_0x2684c3=_0x50ccee[_0x4a9412][_0x0a74('0x53')]();if(manager[_0x0a74('0x57')](_0x2684c3)){manager['stop'](_0x2684c3);manager[_0x0a74('0x58')](_0x2684c3);logger[_0x0a74('0x10')](_0x0a74('0x59'),_0x2684c3);}}logger[_0x0a74('0x10')](_0x0a74('0x5a'),JSON[_0x0a74('0x27')](_0x23ad82));for(_0x4a9412=0x0;_0x4a9412<_0x23ad82[_0x0a74('0x56')];_0x4a9412+=0x1){_0x2684c3=_0x23ad82[_0x4a9412]['toString']();if(_0x277118){logger[_0x0a74('0x10')](JSON[_0x0a74('0x27')](_0x12036a[_0x2684c3]));BPromise[_0x0a74('0x5b')]()[_0x0a74('0xe')](handleJob(_0x12036a[_0x2684c3]));logger[_0x0a74('0x10')](_0x0a74('0x5c'),_0x12036a[_0x2684c3]['name'],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}else if(_0x12036a[_0x2684c3][_0x0a74('0x5d')]&&_0x12036a[_0x2684c3][_0x0a74('0x5e')]&&moment()[_0x0a74('0x5f')](_0x12036a[_0x2684c3][_0x0a74('0x60')],_0x12036a[_0x2684c3][_0x0a74('0x61')])){manager[_0x0a74('0x62')](_0x2684c3,_0x12036a[_0x2684c3]['cron'],handleJob(_0x12036a[_0x2684c3]));manager[_0x0a74('0x63')](_0x2684c3);logger['info'](_0x0a74('0x64'),_0x12036a[_0x2684c3][_0x0a74('0x16')],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}else if(manager[_0x0a74('0x57')](_0x2684c3)){manager['stop'](_0x2684c3);manager['deleteJob'](_0x2684c3);logger['info'](_0x0a74('0x65'),_0x12036a[_0x2684c3][_0x0a74('0x16')],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}}for(_0x4a9412=0x0,_0x2684c3;_0x4a9412<_0x555f67[_0x0a74('0x56')]&&!_0x277118;_0x4a9412+=0x1){_0x2684c3=_0x555f67[_0x4a9412][_0x0a74('0x53')]();if(manager[_0x0a74('0x57')](_0x2684c3)){if(_0x12036a[_0x2684c3]['cron']&&_0x12036a[_0x2684c3]['active']&&moment()[_0x0a74('0x5f')](_0x12036a[_0x2684c3][_0x0a74('0x60')],_0x12036a[_0x2684c3]['endAt'])){manager[_0x0a74('0x66')](_0x2684c3,_0x12036a[_0x2684c3][_0x0a74('0x5d')],handleJob(_0x12036a[_0x2684c3]));logger['info'](_0x0a74('0x67'),_0x12036a[_0x2684c3][_0x0a74('0x16')],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}else{manager[_0x0a74('0x3e')](_0x2684c3);manager[_0x0a74('0x58')](_0x2684c3);logger[_0x0a74('0x10')]('stop\x20cron',_0x12036a[_0x2684c3]['name'],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}}}})[_0x0a74('0x37')](function(_0x3020ea){logger[_0x0a74('0xf')](JSON[_0x0a74('0x27')](_0x3020ea));});}exports[_0x0a74('0x68')]=function(_0x4eb810){return getJobs(_0x4eb810);};exports[_0x0a74('0x63')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd26b=['entity','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','CloudProvider','keys','jobs','toString','difference','intersection','exists','deleteJob','delete\x20cron','toRun','length','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','update\x20cron','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','retry','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','join','existsSync','status','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed'];(function(_0x1e85af,_0x337f72){var _0x59a1bf=function(_0x3665cf){while(--_0x3665cf){_0x1e85af['push'](_0x1e85af['shift']());}};_0x59a1bf(++_0x337f72);}(_0xd26b,0x1cd));var _0xbd26=function(_0x18cac8,_0x5aeeee){_0x18cac8=_0x18cac8-0x0;var _0x4844f3=_0xd26b[_0x18cac8];return _0x4844f3;};'use strict';var fs=require('fs');var util=require(_0xbd26('0x0'));var path=require(_0xbd26('0x1'));var _=require(_0xbd26('0x2'));var moment=require(_0xbd26('0x3'));var CronJobManager=require(_0xbd26('0x4'));var jayson=require(_0xbd26('0x5'));var BPromise=require(_0xbd26('0x6'));var logger=require('../logger')(_0xbd26('0x7'));var db=require(_0xbd26('0x8'))['db'];const retry=require(_0xbd26('0x9'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xbd26('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x377625){const _0x9c0747={};if(typeof _0x377625===_0xbd26('0xb')){_0x9c0747['id']=_0x377625;}return db[_0xbd26('0xc')][_0xbd26('0xd')]({'where':_0x9c0747})[_0xbd26('0xe')](function(_0x442cd4){return _0x442cd4;})[_0xbd26('0xf')](function(_0x127bed){logger[_0xbd26('0x10')](_0x127bed);});}function handleSendEmail(_0x1b6f32,_0x1695e6){logger[_0xbd26('0x11')](_0xbd26('0x12'),_0x1b6f32[_0xbd26('0x13')]);var _0x203c8c=!![];var _0x3e4e2d=_0x1b6f32[_0xbd26('0x14')][_0xbd26('0x15')]();var _0x492875={'account':_0x3e4e2d,'message':{'from':util[_0xbd26('0x16')](_0xbd26('0x17'),_0x1b6f32[_0xbd26('0x14')][_0xbd26('0x18')],_0x1b6f32['MailAccount'][_0xbd26('0x13')]||_0x1b6f32['MailAccount'][_0xbd26('0x19')][_0xbd26('0x1a')]),'to':_0x1b6f32[_0xbd26('0x13')],'cc':_0x1b6f32['cc'],'bcc':_0x1b6f32[_0xbd26('0x1b')],'subject':util['format'](_0xbd26('0x1c'),_0x1695e6[_0xbd26('0x18')],_0x1b6f32[_0xbd26('0x1d')],_0x1b6f32[_0xbd26('0x1e')])}};var _0x5ed252=path['join'](__dirname,_0xbd26('0x1f'));var _0x2979d1=_0x1695e6[_0xbd26('0x20')];var _0x592b70=util['format'](_0xbd26('0x21'),path[_0xbd26('0x22')](_0x1695e6[_0xbd26('0x20')],path[_0xbd26('0x23')](_0x1695e6['savename'])),'zip');var _0x40c631=path[_0xbd26('0x24')](_0x5ed252,_0x2979d1);var _0x2eb815=path[_0xbd26('0x24')](_0x5ed252,_0x592b70);if(fs[_0xbd26('0x25')](_0x40c631)){_0x1695e6[_0xbd26('0x26')]='Sent';_0x492875['message'][_0xbd26('0x27')]=[{'filename':_0x2979d1,'path':_0x40c631}];_0x492875[_0xbd26('0x28')][_0xbd26('0x29')]=util[_0xbd26('0x16')](_0xbd26('0x2a'),JSON[_0xbd26('0x2b')](_0x1695e6,null,0x2));}else if(fs[_0xbd26('0x25')](_0x2eb815)){_0x1695e6['status']='Sent';_0x492875[_0xbd26('0x28')][_0xbd26('0x27')]=[{'filename':_0x592b70,'path':_0x2eb815}];}else{if(_0x1695e6[_0xbd26('0x26')]===_0xbd26('0x2c')){_0x492875[_0xbd26('0x28')][_0xbd26('0x29')]=_0xbd26('0x2d');if(!_0x1b6f32['sendIfEmpty']){_0x203c8c=![];logger[_0xbd26('0x11')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x1695e6['status']==='Loading'){_0x492875['message']['text']=_0xbd26('0x2e');}else if(_0x1695e6[_0xbd26('0x26')]===_0xbd26('0x2f')){_0x492875[_0xbd26('0x28')]['text']=_0xbd26('0x30');}else if(_0x1695e6[_0xbd26('0x26')]===_0xbd26('0x31')){_0x492875[_0xbd26('0x28')]['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0xbd26('0x10')](_0xbd26('0x32'),_0x1695e6[_0xbd26('0x26')]);}}if(_0x203c8c){return client[_0xbd26('0x33')]('SendMail',_0x492875)[_0xbd26('0xe')](function(_0x5320e8){if(_0x5320e8[_0xbd26('0x10')]){return logger[_0xbd26('0x10')](_0xbd26('0x34'),JSON['stringify'](_0x5320e8));}return logger[_0xbd26('0x11')](_0xbd26('0x35'));})['catch'](function(_0x53ea73){return logger['error'](_0xbd26('0x34'),JSON['stringify'](_0x53ea73));});}}function handleError(){return function(_0x23651f){return logger[_0xbd26('0x10')](JSON['stringify'](_0x23651f));};}function loading(_0x3e2761){logger[_0xbd26('0x11')](_0xbd26('0x36'));if(_0x3e2761[_0xbd26('0x37')]===_0x3e2761[_0xbd26('0x38')][_0xbd26('0x39')]){handleSendEmail(_0x3e2761[_0xbd26('0x3a')],_0x3e2761[_0xbd26('0x3b')]);_0x3e2761[_0xbd26('0x3c')][_0xbd26('0x3d')]();}else{_0x3e2761[_0xbd26('0x3c')][_0xbd26('0x9')](_0xbd26('0x3e'));}}function completed(_0x48f897){logger[_0xbd26('0x11')](_0xbd26('0x3f'));handleSendEmail(_0x48f897[_0xbd26('0x3a')],_0x48f897[_0xbd26('0x3b')]);_0x48f897[_0xbd26('0x3c')]['stop']();}function empty(_0x1019df){logger[_0xbd26('0x11')]('case\x20empty');handleSendEmail(_0x1019df[_0xbd26('0x3a')],_0x1019df['data']);_0x1019df[_0xbd26('0x3c')][_0xbd26('0x3d')]();}function failed(_0xee3d66){logger[_0xbd26('0x11')]('case\x20failed');handleSendEmail(_0xee3d66[_0xbd26('0x3a')],_0xee3d66['data']);_0xee3d66[_0xbd26('0x3c')][_0xbd26('0x3d')]();}function urecognized(_0x8d0cef){logger[_0xbd26('0x10')]('Unrecognized\x20status:',_0x8d0cef[_0xbd26('0x40')]['dataValues'][_0xbd26('0x26')]);_0x8d0cef['operation'][_0xbd26('0x3d')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x494099,_0x154736){const _0x488fd1={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x31b5c1=retry['operation'](_0x488fd1);_0x31b5c1[_0xbd26('0x41')](_0x4349c0=>{logger['info'](_0xbd26('0x42')+_0x494099['id']+_0xbd26('0x43')+_0x4349c0);try{getReportData(_0x154736['id'])['then'](function(_0x3aa547){_0x154736=_0x3aa547;logger[_0xbd26('0x11')](_0xbd26('0x44'),_0x3aa547['dataValues'][_0xbd26('0x26')]);if(!reportStatusStrategies[_0x3aa547[_0xbd26('0x45')][_0xbd26('0x26')]]){logger[_0xbd26('0x10')]('report\x20status:',_0x3aa547['dataValues'][_0xbd26('0x26')]);_0x31b5c1[_0xbd26('0x9')]();}reportStatusStrategies[_0x3aa547['dataValues']['status']]({'operation':_0x31b5c1,'currentAttempt':_0x4349c0,'retryOptions':_0x488fd1,'job':_0x494099,'data':_0x154736,'entity':_0x3aa547});});}catch(_0x573a28){_0x31b5c1[_0xbd26('0x9')](_0x573a28);}});}function handleResult(_0x40753d){return function(_0x139599){if(_0x40753d[_0xbd26('0x46')]&&_0x40753d[_0xbd26('0x14')]&&_0x40753d[_0xbd26('0x14')]['Smtp']&&!_[_0xbd26('0x47')](_0x40753d['email'])){retryer(_0x40753d,_0x139599);}};}function handleJob(_0x22f1ab){return function(){try{if(_[_0xbd26('0x47')](_0x22f1ab[_0xbd26('0x1d')])){return logger[_0xbd26('0x11')](_0xbd26('0x48'));}if(_[_0xbd26('0x47')](_0x22f1ab[_0xbd26('0x1e')])){return logger[_0xbd26('0x11')](_0xbd26('0x49'));}var _0x42b753={'startDate':moment()[_0xbd26('0x4a')](_0x22f1ab['subtractNumber'],_0x22f1ab[_0xbd26('0x1e')])[_0xbd26('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xbd26('0x4b')),'type':'scheduled','output':_0x22f1ab[_0xbd26('0x4c')],'name':_0x22f1ab[_0xbd26('0x18')]};if(!_[_0xbd26('0x47')](_0x22f1ab['DefaultReportId'])){logger[_0xbd26('0x11')](_0xbd26('0x4d'),_0x22f1ab[_0xbd26('0x4e')]);return analyticDefaultReportController[_0xbd26('0x4f')]({'id':_0x22f1ab[_0xbd26('0x4e')]},_0x42b753)[_0xbd26('0xe')](handleResult(_0x22f1ab))[_0xbd26('0xf')](handleError());}if(!_[_0xbd26('0x47')](_0x22f1ab[_0xbd26('0x50')])){logger[_0xbd26('0x11')](_0xbd26('0x51'),_0x22f1ab[_0xbd26('0x50')]);return analyticCustomReportController[_0xbd26('0x4f')]({'id':_0x22f1ab[_0xbd26('0x50')]},_0x42b753)['then'](handleResult(_0x22f1ab))[_0xbd26('0xf')](handleError());}}catch(_0x23dac3){logger['error'](JSON[_0xbd26('0x2b')](_0x23dac3));}return logger[_0xbd26('0x11')](_0xbd26('0x52'));};}function getJobs(_0xdf2a60){var _0x4f19da={};if(_0xdf2a60){_0x4f19da['id']=_0xdf2a60;}return db['Schedule']['findAll']({'where':_0x4f19da,'include':[{'model':db['MailAccount'],'attributes':['id',_0xbd26('0x18'),_0xbd26('0x13')],'include':[{'model':db[_0xbd26('0x53')],'as':_0xbd26('0x19'),'include':[{'model':db['CloudProvider'],'as':_0xbd26('0x54')}]}]}]})[_0xbd26('0xe')](function(_0x3abc20){var _0x4bb17a=_[_0xbd26('0x55')](manager[_0xbd26('0x56')]);var _0x3816ad=_['map'](_0x3abc20,function(_0x33b33d){return _0x33b33d['id'][_0xbd26('0x57')]();});var _0x3807d6=_['keyBy'](_0x3abc20,function(_0x589f87){return _0x589f87['id']['toString']();});var _0x42127a=_0xdf2a60?_0x3816ad:_[_0xbd26('0x58')](_0x3816ad,_0x4bb17a);var _0x1e2023=_[_0xbd26('0x59')](_0x3816ad,_0x4bb17a);var _0x4c0f25=_[_0xbd26('0x58')](_0x4bb17a,_0x3816ad);var _0x286334;var _0x42e31e;for(_0x286334=0x0;_0x286334<_0x4c0f25['length']&&!_0xdf2a60;_0x286334+=0x1){_0x42e31e=_0x4c0f25[_0x286334]['toString']();if(manager[_0xbd26('0x5a')](_0x42e31e)){manager['stop'](_0x42e31e);manager[_0xbd26('0x5b')](_0x42e31e);logger[_0xbd26('0x11')](_0xbd26('0x5c'),_0x42e31e);}}logger[_0xbd26('0x11')](_0xbd26('0x5d'),JSON[_0xbd26('0x2b')](_0x42127a));for(_0x286334=0x0;_0x286334<_0x42127a[_0xbd26('0x5e')];_0x286334+=0x1){_0x42e31e=_0x42127a[_0x286334][_0xbd26('0x57')]();if(_0xdf2a60){logger[_0xbd26('0x11')](JSON[_0xbd26('0x2b')](_0x3807d6[_0x42e31e]));BPromise['resolve']()[_0xbd26('0xe')](handleJob(_0x3807d6[_0x42e31e]));logger[_0xbd26('0x11')](_0xbd26('0x5f'),_0x3807d6[_0x42e31e][_0xbd26('0x18')],_0x3807d6[_0x42e31e][_0xbd26('0x60')]);}else if(_0x3807d6[_0x42e31e][_0xbd26('0x60')]&&_0x3807d6[_0x42e31e][_0xbd26('0x61')]&&moment()[_0xbd26('0x62')](_0x3807d6[_0x42e31e][_0xbd26('0x63')],_0x3807d6[_0x42e31e][_0xbd26('0x64')])){manager[_0xbd26('0x65')](_0x42e31e,_0x3807d6[_0x42e31e][_0xbd26('0x60')],handleJob(_0x3807d6[_0x42e31e]));manager[_0xbd26('0x66')](_0x42e31e);logger[_0xbd26('0x11')](_0xbd26('0x67'),_0x3807d6[_0x42e31e][_0xbd26('0x18')],_0x3807d6[_0x42e31e][_0xbd26('0x60')]);}else if(manager[_0xbd26('0x5a')](_0x42e31e)){manager['stop'](_0x42e31e);manager[_0xbd26('0x5b')](_0x42e31e);logger[_0xbd26('0x11')]('stop\x20cron',_0x3807d6[_0x42e31e][_0xbd26('0x18')],_0x3807d6[_0x42e31e][_0xbd26('0x60')]);}}for(_0x286334=0x0,_0x42e31e;_0x286334<_0x1e2023[_0xbd26('0x5e')]&&!_0xdf2a60;_0x286334+=0x1){_0x42e31e=_0x1e2023[_0x286334][_0xbd26('0x57')]();if(manager[_0xbd26('0x5a')](_0x42e31e)){if(_0x3807d6[_0x42e31e][_0xbd26('0x60')]&&_0x3807d6[_0x42e31e][_0xbd26('0x61')]&&moment()[_0xbd26('0x62')](_0x3807d6[_0x42e31e][_0xbd26('0x63')],_0x3807d6[_0x42e31e][_0xbd26('0x64')])){manager['update'](_0x42e31e,_0x3807d6[_0x42e31e]['cron'],handleJob(_0x3807d6[_0x42e31e]));logger[_0xbd26('0x11')](_0xbd26('0x68'),_0x3807d6[_0x42e31e][_0xbd26('0x18')],_0x3807d6[_0x42e31e]['cron']);}else{manager[_0xbd26('0x3d')](_0x42e31e);manager[_0xbd26('0x5b')](_0x42e31e);logger[_0xbd26('0x11')]('stop\x20cron',_0x3807d6[_0x42e31e][_0xbd26('0x18')],_0x3807d6[_0x42e31e][_0xbd26('0x60')]);}}}})[_0xbd26('0xf')](function(_0x54c74b){logger[_0xbd26('0x10')](JSON[_0xbd26('0x2b')](_0x54c74b));});}exports['run']=function(_0xb48566){return getJobs(_0xb48566);};exports['start']=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 84aabee..ccf554d 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 _0x8eba=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','catch','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','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x333bbf,_0x46babc){var _0x24e3ff=function(_0x22cd7f){while(--_0x22cd7f){_0x333bbf['push'](_0x333bbf['shift']());}};_0x24e3ff(++_0x46babc);}(_0x8eba,0xc3));var _0xa8eb=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x8eba[_0x1cd47d];return _0x29d52f;};var _=require(_0xa8eb('0x0'));var AWS=require(_0xa8eb('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xa8eb('0x2'))['db'];var logger=require(_0xa8eb('0x3'))(_0xa8eb('0x4'));function getTranscriptionJob(_0x2cdf40,_0x52533a,_0x3a665b,_0x187bf0){return new Promise(function(_0x5abab9,_0x321f2f){var _0x5ece80=new AWS[(_0xa8eb('0x5'))]({'accessKeyId':_0x52533a,'secretAccessKey':_0x2cdf40,'region':_0x3a665b});_0x5ece80[_0xa8eb('0x6')]({'TranscriptionJobName':_0x187bf0},function(_0x509b54,_0x8b2ae9){if(_0x509b54){return _0x321f2f(_0x509b54);}else{return _0x5abab9(_0x8b2ae9);}});});}function sentiment(_0x5d6360,_0x21e416,_0x3010d0,_0x5eb605,_0x47032d){return new Promise(function(_0x796060,_0x3e45e7){var _0x4693d6=new AWS['Comprehend']({'accessKeyId':_0x21e416,'secretAccessKey':_0x5d6360,'region':_0x3010d0});_0x4693d6[_0xa8eb('0x7')]({'Text':_0x5eb605,'LanguageCode':_0x47032d['substring'](0x0,0x2)},function(_0x20a4ca,_0x501134){if(_0x20a4ca){return _0x3e45e7(_0x20a4ca);}else{return _0x796060(_0x501134);}});});}function checkTranscribeJob(_0x193a53,_0x47149c,_0x5b21fc){var _0x2c7cff;return new BPromise(function(_0x490c4f,_0x289ed3){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0xa'),_0x193a53['id'],_0x193a53['transcribeName']));return getTranscriptionJob(_0x5b21fc[_0xa8eb('0xb')],_0x5b21fc['data2'],_0x47149c[_0xa8eb('0xc')],_0x193a53[_0xa8eb('0xd')])[_0xa8eb('0xe')](function(_0x102a81){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0xf'),_0x193a53['id'],_0x193a53[_0xa8eb('0xd')],_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]));if(!_0x193a53['fileText']){switch(_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]){case _0xa8eb('0x12'):var _0x445cc6={'transcribeStatus':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')],'fileUri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri']};logger['info'](util['format'](_0xa8eb('0x14'),_0x193a53['id']));return rp({'uri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri'],'json':!![]})[_0xa8eb('0xe')](function(_0x1025ef){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x15'),_0x193a53['id']));if(_0x1025ef&&_0x1025ef[_0xa8eb('0x16')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xa8eb('0x18')]){_0x445cc6[_0xa8eb('0x19')]='';for(var _0xee9db2=0x0;_0xee9db2<_0x1025ef['results'][_0xa8eb('0x17')][_0xa8eb('0x18')];_0xee9db2++){_0x445cc6[_0xa8eb('0x19')]+=_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xee9db2]['transcript']+'';}}return _0x193a53[_0xa8eb('0x1a')](_0x445cc6);})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x1b'),_0x193a53['id']));if(!_0x193a53['tempSentiment']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x1d'));}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x23'));}if(!_0x445cc6[_0xa8eb('0x19')]){throw new Error(_0xa8eb('0x24'));}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db['CloudProvider'][_0xa8eb('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa8eb('0xe')](function(_0xdd5171){if(!_0xdd5171){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd5171[_0xa8eb('0xb')]||!_0xdd5171[_0xa8eb('0x26')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c7cff=_0xdd5171;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x445cc6['fileText'],_0x47149c[_0xa8eb('0x28')]);})['then'](function(_0x4a2a65){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x4a2a65[_0xa8eb('0x2a')],'sPositive':_0x4a2a65[_0xa8eb('0x2b')]['Positive'],'sNegative':_0x4a2a65['SentimentScore'][_0xa8eb('0x2c')],'sMixed':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2e')]});})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});case'FAILED':return _0x193a53[_0xa8eb('0x1a')]({'transcribeStatus':_0xa8eb('0x2f'),'failureReason':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x30')]})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});default:logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x31'),_0x193a53['id']));break;}}else{return BPromise['resolve']()[_0xa8eb('0xe')](function(){if(!_0x193a53[_0xa8eb('0x32')]){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db['Sequelize']['ValidationError'](_0xa8eb('0x23'));}if(!_0x193a53[_0xa8eb('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db[_0xa8eb('0x33')][_0xa8eb('0x25')]({'where':{'id':_settings[_0xa8eb('0x1f')]}});}})[_0xa8eb('0xe')](function(_0x141986){if(!_0x141986){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x34'));}if(!_0x141986[_0xa8eb('0xb')]||!_0x141986['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x2c7cff=_0x141986;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x193a53['fileText'],_0x47149c['language']);})[_0xa8eb('0xe')](function(_0x1548b5){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x1548b5[_0xa8eb('0x2a')],'sPositive':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x36')],'sNegative':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2c')],'sMixed':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x1548b5['SentimentScore'][_0xa8eb('0x2e')],'transcribeStatus':'COMPLETED'});})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x193a53['id']));_0x490c4f();});}})[_0xa8eb('0x37')](function(_0x1b3c2b){if(_0x1b3c2b){if(!_0x1b3c2b[_0xa8eb('0x38')]||_0x1b3c2b[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x9')](_0xa8eb('0x3b'),_0x193a53['id']),util[_0xa8eb('0x3c')](_0x1b3c2b,{'showHidden':![],'depth':null}));}}_0x490c4f();});});}function checkTranscribe(){var _0x54ae6b;var _0x481560;var _0x273fd0;return db[_0xa8eb('0x3d')][_0xa8eb('0x3e')]({'where':{'transcribeStatus':_0xa8eb('0x3f')}})['then'](function(_0x53dc8a){if(!_0x53dc8a||!_0x53dc8a['length']){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x40'));}_0x54ae6b=_0x53dc8a;return db[_0xa8eb('0x41')][_0xa8eb('0x25')]({'where':{'id':0x1}});})[_0xa8eb('0xe')](function(_0x31b4f7){if(!_0x31b4f7){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x42'));}_0x481560=_0x31b4f7;if(!_0x481560[_0xa8eb('0x4')]||!_0x481560[_0xa8eb('0x43')]||!_0x481560[_0xa8eb('0xc')]||!_0x481560[_0xa8eb('0x28')]||!_0x481560[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x44'));}return db[_0xa8eb('0x33')]['findOne']({'where':{'id':_0x481560['transcribeAccountId']}});})[_0xa8eb('0xe')](function(_0x5edfbe){if(!_0x5edfbe){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x34'));}if(!_0x5edfbe[_0xa8eb('0xb')]||!_0x5edfbe['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x273fd0=_0x5edfbe;var _0x1251cd=[];_0x54ae6b[_0xa8eb('0x45')](function(_0x3a52d2){_0x1251cd[_0xa8eb('0x46')](checkTranscribeJob(_0x3a52d2,_0x481560,_0x273fd0));});return BPromise[_0xa8eb('0x47')](_0x1251cd);})[_0xa8eb('0x37')](function(_0x18e535){if(_0x18e535){if(!_0x18e535[_0xa8eb('0x38')]||_0x18e535[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x3c')](_0x18e535,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe6d7=['IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','findOne','transcribeAccountId','transcribeRegion','forEach','push','all','SequelizeValidationError','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentimentRegion','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x2ced2c,_0x2aa7a5){_0x2ced2c=_0x2ced2c-0x0;var _0x1b10f6=_0xe6d7[_0x2ced2c];return _0x1b10f6;};var _=require('lodash');var AWS=require(_0x7e6d('0x0'));var rp=require('request-promise');var util=require(_0x7e6d('0x1'));var BPromise=require(_0x7e6d('0x2'));var db=require(_0x7e6d('0x3'))['db'];var logger=require(_0x7e6d('0x4'))('transcribe');function getTranscriptionJob(_0xcef693,_0x4edd64,_0x4b0ffd,_0x1c4de4){return new Promise(function(_0x23c09e,_0x4faafe){var _0x344697=new AWS[(_0x7e6d('0x5'))]({'accessKeyId':_0x4edd64,'secretAccessKey':_0xcef693,'region':_0x4b0ffd});_0x344697[_0x7e6d('0x6')]({'TranscriptionJobName':_0x1c4de4},function(_0x30eb06,_0x44d906){if(_0x30eb06){return _0x4faafe(_0x30eb06);}else{return _0x23c09e(_0x44d906);}});});}function sentiment(_0x285e8e,_0x215c69,_0x2ffe91,_0x456776,_0x544ba5){return new Promise(function(_0x4a01c2,_0x4147f9){var _0x3c892f=new AWS[(_0x7e6d('0x7'))]({'accessKeyId':_0x215c69,'secretAccessKey':_0x285e8e,'region':_0x2ffe91});_0x3c892f[_0x7e6d('0x8')]({'Text':_0x456776,'LanguageCode':_0x544ba5['substring'](0x0,0x2)},function(_0x3ef08e,_0x24b89b){if(_0x3ef08e){return _0x4147f9(_0x3ef08e);}else{return _0x4a01c2(_0x24b89b);}});});}function checkTranscribeJob(_0x5bc7b5,_0x314a07,_0x20ef11){var _0x39fc7d;return new BPromise(function(_0x3e47fc,_0x154045){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0xb'),_0x5bc7b5['id'],_0x5bc7b5[_0x7e6d('0xc')]));return getTranscriptionJob(_0x20ef11[_0x7e6d('0xd')],_0x20ef11['data2'],_0x314a07['transcribeRegion'],_0x5bc7b5[_0x7e6d('0xc')])[_0x7e6d('0xe')](function(_0x5ef607){logger[_0x7e6d('0x9')](util['format'](_0x7e6d('0xf'),_0x5bc7b5['id'],_0x5bc7b5[_0x7e6d('0xc')],_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x11')]));if(!_0x5bc7b5['fileText']){switch(_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x11')]){case'COMPLETED':var _0x201382={'transcribeStatus':_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x11')],'fileUri':_0x5ef607[_0x7e6d('0x10')]['Transcript'][_0x7e6d('0x12')]};logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x5bc7b5['id']));return rp({'uri':_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x13')][_0x7e6d('0x12')],'json':!![]})[_0x7e6d('0xe')](function(_0x554768){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0x14'),_0x5bc7b5['id']));if(_0x554768&&_0x554768['results']&&_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')]&&_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')][_0x7e6d('0x17')]){_0x201382[_0x7e6d('0x18')]='';for(var _0x3edbef=0x0;_0x3edbef<_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')][_0x7e6d('0x17')];_0x3edbef++){_0x201382[_0x7e6d('0x18')]+=_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')][_0x3edbef][_0x7e6d('0x19')]+'';}}return _0x5bc7b5[_0x7e6d('0x1a')](_0x201382);})[_0x7e6d('0xe')](function(){logger['info'](util['format'](_0x7e6d('0x1b'),_0x5bc7b5['id']));if(!_0x5bc7b5[_0x7e6d('0x1c')]){throw new db['Sequelize'][(_0x7e6d('0x1d'))](_0x7e6d('0x1e'));}if(!_0x314a07[_0x7e6d('0x1f')]||!_0x314a07[_0x7e6d('0x20')]||!_0x314a07['sentimentRegion']||!_0x314a07[_0x7e6d('0x21')]||!_0x314a07[_0x7e6d('0x22')]){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x24'));}if(!_0x201382[_0x7e6d('0x18')]){throw new Error(_0x7e6d('0x25'));}if(_0x314a07[_0x7e6d('0x20')]===_0x20ef11['id']){return _0x20ef11;}else{return db[_0x7e6d('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7e6d('0xe')](function(_0x159e7d){if(!_0x159e7d){throw new db['Sequelize']['ValidationError'](_0x7e6d('0x27'));}if(!_0x159e7d[_0x7e6d('0xd')]||!_0x159e7d['data2']){throw new db['Sequelize']['ValidationError'](_0x7e6d('0x28'));}_0x39fc7d=_0x159e7d;logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0x29'),_0x5bc7b5['id']));return sentiment(_0x39fc7d[_0x7e6d('0xd')],_0x39fc7d[_0x7e6d('0x2a')],_0x314a07['sentimentRegion'],_0x201382['fileText'],_0x314a07[_0x7e6d('0x21')]);})[_0x7e6d('0xe')](function(_0x1e4a5f){logger['info'](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bc7b5['id']));return _0x5bc7b5[_0x7e6d('0x1a')]({'sentiment':_0x1e4a5f[_0x7e6d('0x2b')],'sPositive':_0x1e4a5f[_0x7e6d('0x2c')][_0x7e6d('0x2d')],'sNegative':_0x1e4a5f[_0x7e6d('0x2c')][_0x7e6d('0x2e')],'sMixed':_0x1e4a5f[_0x7e6d('0x2c')][_0x7e6d('0x2f')],'sNeutral':_0x1e4a5f['SentimentScore'][_0x7e6d('0x30')]});})[_0x7e6d('0xe')](function(){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0x1b'),_0x5bc7b5['id']));_0x3e47fc();});case _0x7e6d('0x31'):return _0x5bc7b5['update']({'transcribeStatus':_0x7e6d('0x31'),'failureReason':_0x5ef607['TranscriptionJob']['FailureReason']})['then'](function(){logger['info'](util[_0x7e6d('0xa')](_0x7e6d('0x1b'),_0x5bc7b5['id']));_0x3e47fc();});default:logger[_0x7e6d('0x9')](util['format'](_0x7e6d('0x32'),_0x5bc7b5['id']));break;}}else{return BPromise[_0x7e6d('0x33')]()['then'](function(){if(!_0x5bc7b5['tempSentiment']){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x1e'));}if(!_0x314a07[_0x7e6d('0x1f')]||!_0x314a07[_0x7e6d('0x20')]||!_0x314a07[_0x7e6d('0x34')]||!_0x314a07['language']||!_0x314a07['bucket']){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x24'));}if(!_0x5bc7b5[_0x7e6d('0x18')]){throw new Error(_0x7e6d('0x25'));}if(_0x314a07[_0x7e6d('0x20')]===_0x20ef11['id']){return _0x20ef11;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x7e6d('0x20')]}});}})[_0x7e6d('0xe')](function(_0x4d6953){if(!_0x4d6953){throw new db['Sequelize'][(_0x7e6d('0x1d'))](_0x7e6d('0x27'));}if(!_0x4d6953[_0x7e6d('0xd')]||!_0x4d6953[_0x7e6d('0x2a')]){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x28'));}_0x39fc7d=_0x4d6953;logger['info'](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5bc7b5['id']));return sentiment(_0x39fc7d[_0x7e6d('0xd')],_0x39fc7d[_0x7e6d('0x2a')],_0x314a07[_0x7e6d('0x34')],_0x5bc7b5['fileText'],_0x314a07[_0x7e6d('0x21')]);})[_0x7e6d('0xe')](function(_0x474cac){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bc7b5['id']));return _0x5bc7b5[_0x7e6d('0x1a')]({'sentiment':_0x474cac['Sentiment'],'sPositive':_0x474cac['SentimentScore'][_0x7e6d('0x2d')],'sNegative':_0x474cac['SentimentScore'][_0x7e6d('0x2e')],'sMixed':_0x474cac['SentimentScore'][_0x7e6d('0x2f')],'sNeutral':_0x474cac[_0x7e6d('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x7e6d('0xe')](function(){logger['info'](util[_0x7e6d('0xa')](_0x7e6d('0x1b'),_0x5bc7b5['id']));_0x3e47fc();});}})[_0x7e6d('0x35')](function(_0x4d8f2c){if(_0x4d8f2c){if(!_0x4d8f2c[_0x7e6d('0x36')]||_0x4d8f2c[_0x7e6d('0x36')]!=='SequelizeValidationError'){logger[_0x7e6d('0x37')](util[_0x7e6d('0xa')](_0x7e6d('0x38'),_0x5bc7b5['id']),util[_0x7e6d('0x39')](_0x4d8f2c,{'showHidden':![],'depth':null}));}}_0x3e47fc();});});}function checkTranscribe(){var _0x20edeb;var _0x28c5db;var _0x541e20;return db[_0x7e6d('0x3a')][_0x7e6d('0x3b')]({'where':{'transcribeStatus':_0x7e6d('0x3c')}})[_0x7e6d('0xe')](function(_0x54157d){if(!_0x54157d||!_0x54157d['length']){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x3d'));}_0x20edeb=_0x54157d;return db['Setting'][_0x7e6d('0x3e')]({'where':{'id':0x1}});})[_0x7e6d('0xe')](function(_0xf8361a){if(!_0xf8361a){throw new db['Sequelize'][(_0x7e6d('0x1d'))]('Settings\x20not\x20available');}_0x28c5db=_0xf8361a;if(!_0x28c5db['transcribe']||!_0x28c5db[_0x7e6d('0x3f')]||!_0x28c5db[_0x7e6d('0x40')]||!_0x28c5db[_0x7e6d('0x21')]||!_0x28c5db[_0x7e6d('0x22')]){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x7e6d('0x26')][_0x7e6d('0x3e')]({'where':{'id':_0x28c5db[_0x7e6d('0x3f')]}});})[_0x7e6d('0xe')](function(_0x4ad938){if(!_0x4ad938){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x27'));}if(!_0x4ad938[_0x7e6d('0xd')]||!_0x4ad938[_0x7e6d('0x2a')]){throw new db[(_0x7e6d('0x23'))]['ValidationError'](_0x7e6d('0x28'));}_0x541e20=_0x4ad938;var _0x19f652=[];_0x20edeb[_0x7e6d('0x41')](function(_0x5a4c45){_0x19f652[_0x7e6d('0x42')](checkTranscribeJob(_0x5a4c45,_0x28c5db,_0x541e20));});return BPromise[_0x7e6d('0x43')](_0x19f652);})[_0x7e6d('0x35')](function(_0x18f572){if(_0x18f572){if(!_0x18f572['name']||_0x18f572[_0x7e6d('0x36')]!==_0x7e6d('0x44')){logger['error'](util[_0x7e6d('0x39')](_0x18f572,{'showHidden':![],'depth':null}));}}});}exports[_0x7e6d('0x45')]=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 0556d11..833160a 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 _0x1f60=['moment','util','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash'];(function(_0x4970ea,_0x3315e7){var _0xf34b5c=function(_0x2f1def){while(--_0x2f1def){_0x4970ea['push'](_0x4970ea['shift']());}};_0xf34b5c(++_0x3315e7);}(_0x1f60,0x1bf));var _0x01f6=function(_0x502df3,_0x4319a1){_0x502df3=_0x502df3-0x0;var _0x5eb274=_0x1f60[_0x502df3];return _0x5eb274;};'use strict';var _=require(_0x01f6('0x0'));var moment=require(_0x01f6('0x1'));var Redis=require('ioredis');var util=require(_0x01f6('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x01f6('0x3'))(_0x01f6('0x4'));config[_0x01f6('0x5')]=_[_0x01f6('0x6')](config[_0x01f6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x01f6('0x7'))(new Redis(config[_0x01f6('0x5')]));function closeInteractions(){var _0x122f5f=[];return db[_0x01f6('0x8')][_0x01f6('0x9')]({'raw':!![],'attributes':['id',_0x01f6('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x01f6('0xb')](0x18,_0x01f6('0xc'))}}})[_0x01f6('0xd')](function(_0x2934b4){if(_0x2934b4&&_0x2934b4[_0x01f6('0xe')]){_0x122f5f=_['map'](_0x2934b4||[],'id');logger[_0x01f6('0xf')](_0x01f6('0x10'),_0x122f5f[_0x01f6('0x11')]());return db[_0x01f6('0x8')][_0x01f6('0x12')]({'closeReason':'system','disposition':_0x01f6('0x13'),'closed':!![],'closedAt':moment()[_0x01f6('0x14')](_0x01f6('0x15'))},{'where':{'id':_0x122f5f}});}})[_0x01f6('0xd')](function(){if(_0x122f5f&&_0x122f5f[_0x01f6('0xe')]){logger[_0x01f6('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x122f5f[_0x01f6('0x11')]());for(var _0x1873b0=0x0;_0x1873b0<_0x122f5f[_0x01f6('0xe')];_0x1873b0++){io[_0x01f6('0x16')](_0x01f6('0x17'),{'id':_0x122f5f[_0x1873b0],'closed':!![]});}}})[_0x01f6('0x18')](function(_0x36e95c){logger[_0x01f6('0x19')](_0x01f6('0x1a'),_0x36e95c?util[_0x01f6('0x1b')](_0x36e95c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4327=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map'];(function(_0x21ab29,_0x5cceae){var _0xaac32=function(_0x1b939c){while(--_0x1b939c){_0x21ab29['push'](_0x21ab29['shift']());}};_0xaac32(++_0x5cceae);}(_0x4327,0x1dd));var _0x7432=function(_0x37a3f3,_0x663b49){_0x37a3f3=_0x37a3f3-0x0;var _0x4da923=_0x4327[_0x37a3f3];return _0x4da923;};'use strict';var _=require(_0x7432('0x0'));var moment=require('moment');var Redis=require(_0x7432('0x1'));var util=require(_0x7432('0x2'));var config=require(_0x7432('0x3'));var db=require(_0x7432('0x4'))['db'];var logger=require(_0x7432('0x5'))(_0x7432('0x6'));config[_0x7432('0x7')]=_[_0x7432('0x8')](config[_0x7432('0x7')],{'host':_0x7432('0x9'),'port':0x18eb});var io=require(_0x7432('0xa'))(new Redis(config[_0x7432('0x7')]));function closeInteractions(){var _0xb834ee=[];return db[_0x7432('0xb')][_0x7432('0xc')]({'raw':!![],'attributes':['id',_0x7432('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7432('0xe')](0x18,_0x7432('0xf'))}}})[_0x7432('0x10')](function(_0x49adaf){if(_0x49adaf&&_0x49adaf[_0x7432('0x11')]){_0xb834ee=_[_0x7432('0x12')](_0x49adaf||[],'id');logger[_0x7432('0x13')](_0x7432('0x14'),_0xb834ee[_0x7432('0x15')]());return db[_0x7432('0xb')][_0x7432('0x16')]({'closeReason':_0x7432('0x17'),'disposition':_0x7432('0x18'),'closed':!![],'closedAt':moment()[_0x7432('0x19')](_0x7432('0x1a'))},{'where':{'id':_0xb834ee}});}})[_0x7432('0x10')](function(){if(_0xb834ee&&_0xb834ee[_0x7432('0x11')]){logger[_0x7432('0x13')](_0x7432('0x1b'),_0xb834ee[_0x7432('0x15')]());for(var _0x490b1c=0x0;_0x490b1c<_0xb834ee['length'];_0x490b1c++){io[_0x7432('0x1c')]('whatsappInteraction:update',{'id':_0xb834ee[_0x490b1c],'closed':!![]});}}})['catch'](function(_0x6a4ab0){logger[_0x7432('0x1d')](_0x7432('0x1e'),_0x6a4ab0?util['inspect'](_0x6a4ab0,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index c2d06a3..834a04e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x214d=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','util'];(function(_0xb2ba86,_0x44bebd){var _0x51c55b=function(_0x392045){while(--_0x392045){_0xb2ba86['push'](_0xb2ba86['shift']());}};_0x51c55b(++_0x44bebd);}(_0x214d,0xf6));var _0xd214=function(_0x285d2a,_0x53a9d0){_0x285d2a=_0x285d2a-0x0;var _0x4e1869=_0x214d[_0x285d2a];return _0x4e1869;};'use strict';var util=require(_0xd214('0x0'));var db=require(_0xd214('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd214('0x2')]({'id':i,'firstName':_0xd214('0x3')+i,'lastName':_0xd214('0x4')+i,'phone':0xf879fb460+i,'email':_0xd214('0x5')+i+_0xd214('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd214('0x7')](),'updatedAt':Date[_0xd214('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xd214('0x3')+i,'lastName':_0xd214('0x4')+i,'phone':0xf879fb460+i,'email':_0xd214('0x5')+i+_0xd214('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd214('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd214('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd214('0x7')](),'updatedAt':Date[_0xd214('0x7')]()});}db[_0xd214('0x8')][_0xd214('0x9')]({'where':{}})[_0xd214('0xa')](function(){return db[_0xd214('0x8')][_0xd214('0xb')](contacts);})[_0xd214('0xa')](function(){console[_0xd214('0xc')](_0xd214('0xd'),_0xd214('0xe'));return db[_0xd214('0xf')][_0xd214('0x9')]({'where':{}});})[_0xd214('0xa')](function(){return db['CmHopper'][_0xd214('0xb')](hopper);})[_0xd214('0xa')](function(){console[_0xd214('0xc')](_0xd214('0xd'),_0xd214('0x10'));return db[_0xd214('0x8')]['bulkCreate'](contacts2);})[_0xd214('0xa')](function(){console[_0xd214('0xc')](_0xd214('0xd'),'contacts2');return db[_0xd214('0xf')]['bulkCreate'](hopper2);})['then'](function(){console[_0xd214('0xc')]('finished\x20populating',_0xd214('0x11'));})[_0xd214('0x12')](function(_0x870174){console[_0xd214('0xc')](_0x870174);}); \ No newline at end of file +var _0x2593=['now','Innocenzo','CmContact','destroy','then','bulkCreate','CmHopper','log','hopper1','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push','innocenzo.biondo','@xcally.com'];(function(_0x311666,_0x17b07d){var _0x2bc692=function(_0x200073){while(--_0x200073){_0x311666['push'](_0x311666['shift']());}};_0x2bc692(++_0x17b07d);}(_0x2593,0x187));var _0x3259=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x2593[_0x3f94f9];return _0x46f84f;};'use strict';var util=require(_0x3259('0x0'));var db=require(_0x3259('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3259('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3259('0x3')+i+_0x3259('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3259('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3259('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3259('0x5')](),'updatedAt':Date[_0x3259('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3259('0x2')]({'id':i,'firstName':_0x3259('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3259('0x3')+i+_0x3259('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3259('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3259('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3259('0x5')](),'updatedAt':Date[_0x3259('0x5')]()});}db[_0x3259('0x7')][_0x3259('0x8')]({'where':{}})[_0x3259('0x9')](function(){return db[_0x3259('0x7')][_0x3259('0xa')](contacts);})[_0x3259('0x9')](function(){console['log']('finished\x20populating','contacts1');return db[_0x3259('0xb')][_0x3259('0x8')]({'where':{}});})[_0x3259('0x9')](function(){return db['CmHopper'][_0x3259('0xa')](hopper);})[_0x3259('0x9')](function(){console[_0x3259('0xc')]('finished\x20populating',_0x3259('0xd'));return db['CmContact']['bulkCreate'](contacts2);})[_0x3259('0x9')](function(){console['log'](_0x3259('0xe'),_0x3259('0xf'));return db['CmHopper'][_0x3259('0xa')](hopper2);})[_0x3259('0x9')](function(){console[_0x3259('0xc')]('finished\x20populating',_0x3259('0x10'));})[_0x3259('0x11')](function(_0x9e0431){console[_0x3259('0xc')](_0x9e0431);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 2c8d3be..145bfa3 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e8d=['\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x44bcff,_0x425c81){var _0x3e4e7d=function(_0x348829){while(--_0x348829){_0x44bcff['push'](_0x44bcff['shift']());}};_0x3e4e7d(++_0x425c81);}(_0x0e8d,0x1a9));var _0xd0e8=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x0e8d[_0x11005e];return _0x29338f;};'use strict';var util=require(_0xd0e8('0x0'));var db=require(_0xd0e8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd0e8('0x2')]({'name':util[_0xd0e8('0x3')]('%s%s',_0xd0e8('0x4'),i),'fullname':util[_0xd0e8('0x3')](_0xd0e8('0x5'),_0xd0e8('0x4'),i),'email':util[_0xd0e8('0x3')](_0xd0e8('0x6'),'agent',i),'role':'agent','password':_0xd0e8('0x7'),'internal':0xfa0+i,'type':_0xd0e8('0x8'),'transport':['udp','ws','wss'],'disallow':[_0xd0e8('0x9')],'allow':[_0xd0e8('0xa')],'defaultuser':util[_0xd0e8('0x3')](_0xd0e8('0x5'),_0xd0e8('0x4'),i),'encryption':_0xd0e8('0xb'),'avpf':_0xd0e8('0xb'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xd0e8('0xb'),'dtlsverify':'no','dtlscertfile':_0xd0e8('0xc'),'dtlsprivatekey':_0xd0e8('0xd'),'dtlssetup':_0xd0e8('0xe'),'callerid':util['format'](_0xd0e8('0xf'),util[_0xd0e8('0x3')](_0xd0e8('0x5'),'agent',i),0xfa0+i)});}db['User'][_0xd0e8('0x10')](users)['then'](function(){console[_0xd0e8('0x11')](_0xd0e8('0x12'));})[_0xd0e8('0x13')](function(_0x2c1619){console['log'](_0x2c1619);}); \ No newline at end of file +var _0x303a=['\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x55af95,_0x4c0dd6){var _0x397e00=function(_0x31ce84){while(--_0x31ce84){_0x55af95['push'](_0x55af95['shift']());}};_0x397e00(++_0x4c0dd6);}(_0x303a,0x148));var _0xa303=function(_0x579fa4,_0x1911e0){_0x579fa4=_0x579fa4-0x0;var _0x514fa2=_0x303a[_0x579fa4];return _0x514fa2;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa303('0x0')]({'name':util[_0xa303('0x1')](_0xa303('0x2'),_0xa303('0x3'),i),'fullname':util[_0xa303('0x1')]('%s%s',_0xa303('0x3'),i),'email':util[_0xa303('0x1')](_0xa303('0x4'),'agent',i),'role':'agent','password':_0xa303('0x5'),'internal':0xfa0+i,'type':_0xa303('0x6'),'transport':[_0xa303('0x7'),'ws',_0xa303('0x8')],'disallow':[_0xa303('0x9')],'allow':[_0xa303('0xa')],'defaultuser':util['format'](_0xa303('0x2'),'agent',i),'encryption':_0xa303('0xb'),'avpf':'yes','force_avp':_0xa303('0xb'),'icesupport':_0xa303('0xb'),'dtlsenable':_0xa303('0xb'),'dtlsverify':'no','dtlscertfile':_0xa303('0xc'),'dtlsprivatekey':_0xa303('0xd'),'dtlssetup':'actpass','callerid':util[_0xa303('0x1')](_0xa303('0xe'),util[_0xa303('0x1')](_0xa303('0x2'),'agent',i),0xfa0+i)});}db[_0xa303('0xf')][_0xa303('0x10')](users)['then'](function(){console[_0xa303('0x11')](_0xa303('0x12'));})['catch'](function(_0x21cf53){console[_0xa303('0x11')](_0x21cf53);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 80e762b..4a3e9eb 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83d4=['push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','voice:inbound','VoiceQueues','FaxQueue','MailQueues','OpenchannelQueues','IvrCampaigns','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','nsp','lodash','../mysqldb','name','User','role','agent','type','ivr','findOne','autoAssociation','ChatQueues','FaxQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','where','telephone','format','%s:queue:%s','Agents','length','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','then','user:%s','admin','hasOwnProperty','include'];(function(_0x1ee2ae,_0x17c0eb){var _0x1780e5=function(_0x5c592b){while(--_0x5c592b){_0x1ee2ae['push'](_0x1ee2ae['shift']());}};_0x1780e5(++_0x17c0eb);}(_0x83d4,0xf1));var _0x483d=function(_0x59e18a,_0x43a94b){_0x59e18a=_0x59e18a-0x0;var _0x15434e=_0x83d4[_0x59e18a];return _0x15434e;};'use strict';var _=require(_0x483d('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x483d('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x483d('0x2')],'include':[{'as':'Agents','model':db[_0x483d('0x3')],'attributes':['id',_0x483d('0x2'),_0x483d('0x4')],'raw':!![],'where':{'role':_0x483d('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x483d('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x483d('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x483d('0x2')],'where':{'role':_0x483d('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x483d('0x2'),_0x483d('0x6')],'where':{'type':_0x483d('0x7')}};function getAssociatedResources(_0x29ace9,_0x2331a2,_0x2da88b){return db['UserProfileSection'][_0x483d('0x8')]({'where':{'name':_0x29ace9,'userProfileId':_0x2331a2},'raw':!![]})['then'](function(_0x404f5f){if(_0x404f5f){if(_0x404f5f[_0x483d('0x9')]){switch(_0x29ace9){case'VoiceQueues':case _0x483d('0xa'):case _0x483d('0xb'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x483d('0xc'):return db[_0x2da88b]['findAll'](queryQueues);case _0x483d('0xd'):return db[_0x2da88b][_0x483d('0xe')](queryTelephones);case _0x483d('0xf'):return db[_0x2da88b][_0x483d('0xe')](queryTrunks);case'IvrCampaigns':return db[_0x2da88b][_0x483d('0xe')](queryCampaigns);}}else{return db[_0x483d('0x10')][_0x483d('0xe')]({'attributes':[_0x483d('0x11')],'where':{'sectionId':_0x404f5f['id']},'raw':!![]})['then'](function(_0x1aed6d){if(_0x1aed6d){var _0x659927={'where':{'id':_['map'](_0x1aed6d,'resourceId')},'raw':!![]};switch(_0x2da88b){case'User':_0x659927[_0x483d('0x12')][_0x483d('0x4')]=_0x483d('0x13');break;case'Campaign':_0x659927[_0x483d('0x12')][_0x483d('0x6')]=_0x483d('0x7');break;}return db[_0x2da88b]['findAll'](_0x659927);}else{return[];}});}}else{return[];}})['then'](function(_0x273135){return _0x273135;});}function joinOrLeaveQueues(_0x3de114,_0x4f51dd,_0x579f8a,_0x227328){_0x3de114[_0x4f51dd](util[_0x483d('0x14')](_0x483d('0x15'),_0x579f8a,_0x227328[_0x483d('0x2')]));if(_0x227328[_0x483d('0x16')]){for(var _0x16f966=0x0;_0x16f966<_0x227328[_0x483d('0x16')][_0x483d('0x17')];_0x16f966+=0x1){_0x3de114[_0x4f51dd](util[_0x483d('0x14')]('user:%s',_0x227328['Agents'][_0x16f966]['name']));}}}function joinOrLeave(_0x52c579,_0x475731,_0x438189){var _0x43b7b6;if(_0x52c579[_0x483d('0x18')]['query']['id']){db['User'][_0x483d('0x19')]({'attributes':['id','name',_0x483d('0x4'),_0x483d('0x1a')],'where':{'id':_0x52c579[_0x483d('0x18')][_0x483d('0x1b')]['id']},'include':[{'model':db[_0x483d('0x1c')],'as':_0x483d('0x1d'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x483d('0x1e')],'as':_0x483d('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x483d('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x483d('0x21')],'as':_0x483d('0x22'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x483d('0x23'),'attributes':['id'],'raw':!![]}]})[_0x483d('0x24')](function(_0x24435a){if(_0x24435a){_0x43b7b6=_0x24435a;_0x52c579[_0x475731](util['format'](_0x483d('0x25'),_0x24435a[_0x483d('0x2')]));var _0x11483e=[];switch(_0x24435a[_0x483d('0x4')]){case _0x483d('0x26'):_0x52c579[_0x475731]('voice:inbound');_0x52c579[_0x475731]('voice:outbound');if(queryQueues[_0x483d('0x27')](_0x483d('0x28'))){delete queryQueues['include'];}_0x11483e[_0x483d('0x29')](db[_0x483d('0x2a')]['findAll'](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2b')][_0x483d('0xe')](queryQueues));_0x11483e['push'](db['FaxQueue'][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2c')][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2d')][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2e')][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2f')][_0x483d('0xe')](queryQueues));_0x11483e['push'](db[_0x483d('0x3')][_0x483d('0xe')](queryTelephones));_0x11483e[_0x483d('0x29')](db[_0x483d('0x30')][_0x483d('0xe')](queryTrunks));_0x11483e['push'](db[_0x483d('0x31')][_0x483d('0xe')](queryCampaigns));_0x11483e[_0x483d('0x29')](db[_0x483d('0x3')][_0x483d('0xe')](queryAgents));break;case'user':_0x52c579[_0x475731](_0x483d('0x32'));_0x52c579[_0x475731]('voice:outbound');_0x11483e['push'](getAssociatedResources(_0x483d('0x33'),_0x24435a['userProfileId'],_0x483d('0x2a')));_0x11483e['push'](getAssociatedResources(_0x483d('0xa'),_0x24435a[_0x483d('0x1a')],'ChatQueue'));_0x11483e[_0x483d('0x29')](getAssociatedResources('FaxQueues',_0x24435a[_0x483d('0x1a')],_0x483d('0x34')));_0x11483e[_0x483d('0x29')](getAssociatedResources('SmsQueues',_0x24435a[_0x483d('0x1a')],'SmsQueue'));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0x35'),_0x24435a[_0x483d('0x1a')],_0x483d('0x2d')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0x36'),_0x24435a[_0x483d('0x1a')],_0x483d('0x2e')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0xc'),_0x24435a[_0x483d('0x1a')],_0x483d('0x2f')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0xd'),_0x24435a['userProfileId'],_0x483d('0x3')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0xf'),_0x24435a[_0x483d('0x1a')],_0x483d('0x30')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0x37'),_0x24435a['userProfileId'],_0x483d('0x31')));_0x11483e['push'](db[_0x483d('0x3')][_0x483d('0xe')](queryAgents));break;case'agent':_0x52c579[_0x475731](_0x483d('0x32'));_0x52c579[_0x475731](_0x483d('0x38'));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x39')]({'attributes':['id','name']}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3a')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3b')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3c')]({'attributes':['id','name']}));_0x11483e['push'](_0x24435a[_0x483d('0x3d')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3e')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e['push'](_0x24435a[_0x483d('0x3f')]({'attributes':['id',_0x483d('0x2')]}));break;}return BPromise['all'](_0x11483e);}})[_0x483d('0x24')](function(_0xdc070a){if(_0xdc070a&&_0xdc070a[_0x483d('0x17')]){for(var _0x18b7e7=0x0;_0x18b7e7<_0xdc070a[_0x483d('0x17')];_0x18b7e7+=0x1){for(var _0x320530=0x0;_0x320530<_0xdc070a[_0x18b7e7][_0x483d('0x17')];_0x320530+=0x1){switch(_0x18b7e7){case 0x0:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x40'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x1:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x41'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x2:joinOrLeaveQueues(_0x52c579,_0x475731,'fax',_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x3:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x42'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x4:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x43'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x5:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x44'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x6:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x45'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x7:if(_0x43b7b6[_0x483d('0x4')]!=='agent')_0x52c579[_0x475731](util[_0x483d('0x14')](_0x483d('0x46'),_0xdc070a[_0x18b7e7][_0x320530]['name']));break;case 0x8:if(_0x43b7b6[_0x483d('0x4')]!==_0x483d('0x5'))_0x52c579[_0x475731](util['format']('trunk:%s',_0xdc070a[_0x18b7e7][_0x320530][_0x483d('0x2')]));break;case 0x9:if(_0x43b7b6[_0x483d('0x4')]!=='agent')_0x52c579[_0x475731](util[_0x483d('0x14')](_0x483d('0x47'),_0xdc070a[_0x18b7e7][_0x320530][_0x483d('0x6')],_0xdc070a[_0x18b7e7][_0x320530][_0x483d('0x2')]));break;case 0xa:_0x52c579[_0x475731](util[_0x483d('0x14')](_0x483d('0x25'),_0xdc070a[_0x18b7e7][_0x320530]['name']));break;}}}}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x558330=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x1d')],'id');return _0x43b7b6['removeChatInteractions'](_0x558330)[_0x483d('0x24')](function(){for(var _0x677e61=0x0;_0x677e61<_0x558330['length'];_0x677e61+=0x1){_0x438189[_0x483d('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x558330[_0x677e61]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x56c23d=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x4b')],'id');return _0x43b7b6[_0x483d('0x4c')](_0x56c23d)[_0x483d('0x24')](function(){for(var _0x4fbd75=0x0;_0x4fbd75<_0x56c23d[_0x483d('0x17')];_0x4fbd75+=0x1){_0x438189[_0x483d('0x4a')](_0x483d('0x4d'),{'MailInteractionId':Number(_0x56c23d[_0x4fbd75]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731==='leave'){var _0x1cb6b9=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x1f')],'id');return _0x43b7b6[_0x483d('0x4e')](_0x1cb6b9)[_0x483d('0x24')](function(){for(var _0x4c7836=0x0;_0x4c7836<_0x1cb6b9[_0x483d('0x17')];_0x4c7836+=0x1){_0x438189[_0x483d('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1cb6b9[_0x4c7836]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x3c501c=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x20')],'id');return _0x43b7b6[_0x483d('0x4f')](_0x3c501c)[_0x483d('0x24')](function(){for(var _0x1e17ec=0x0;_0x1e17ec<_0x3c501c[_0x483d('0x17')];_0x1e17ec+=0x1){_0x438189[_0x483d('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3c501c[_0x1e17ec]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x3b7537=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x22')],'id');return _0x43b7b6[_0x483d('0x50')](_0x3b7537)['then'](function(){for(var _0x53f07b=0x0;_0x53f07b<_0x3b7537[_0x483d('0x17')];_0x53f07b+=0x1){_0x438189[_0x483d('0x4a')](_0x483d('0x51'),{'OpenchannelInteractionId':Number(_0x3b7537[_0x53f07b]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731==='leave'){var _0x4ac1fd=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x23')],'id');return _0x43b7b6[_0x483d('0x52')](_0x4ac1fd)[_0x483d('0x24')](function(){for(var _0x21c494=0x0;_0x21c494<_0x4ac1fd['length'];_0x21c494+=0x1){_0x438189[_0x483d('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4ac1fd[_0x21c494]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x53')](function(_0x53736b){_0x52c579[_0x483d('0x54')](_0x53736b);});}}function onDisconnect(_0x50a46c,_0x143c7f){joinOrLeave(_0x50a46c,_0x483d('0x48'),_0x143c7f);}function onConnect(_0x3a72c6){joinOrLeave(_0x3a72c6,_0x483d('0x55'));}exports[_0x483d('0x56')]=function(_0xcf95f4){_0xcf95f4['on'](_0x483d('0x57'),function(_0x4d1452){_0x4d1452[_0x483d('0x58')](0x0);_0x4d1452[_0x483d('0x59')]=_0x4d1452[_0x483d('0x5a')][_0x483d('0x57')]['remoteAddress']+':'+_0x4d1452['request']['connection'][_0x483d('0x5b')];_0x4d1452[_0x483d('0x5c')]=new Date();_0x4d1452['log']=function(_0x3f002a){console[_0x483d('0x54')]('SocketIO\x20'+_0x4d1452[_0x483d('0x5d')]['name']+'['+_0x4d1452[_0x483d('0x59')]+']',_0x3f002a);};_0x4d1452['on']('disconnect',function(){onDisconnect(_0x4d1452,_0xcf95f4);_0x4d1452[_0x483d('0x54')]('DISCONNECTED');});onConnect(_0x4d1452);_0x4d1452[_0x483d('0x54')]('CONNECTED');});}; \ No newline at end of file +var _0xd5c8=['ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','userProfileId','MailQueue','Telephones','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','setMaxListeners','request','remoteAddress','connection','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','Campaign','where','format','%s:queue:%s','length','user:%s','handshake','query','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue'];(function(_0x247b9d,_0x48b509){var _0x28f208=function(_0x368c65){while(--_0x368c65){_0x247b9d['push'](_0x247b9d['shift']());}};_0x28f208(++_0x48b509);}(_0xd5c8,0x166));var _0x8d5c=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xd5c8[_0x1f1511];return _0x1d9ab8;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x8d5c('0x0'));var db=require(_0x8d5c('0x1'))['db'];var config=require(_0x8d5c('0x2'));var queryQueues={'attributes':['id',_0x8d5c('0x3')],'include':[{'as':_0x8d5c('0x4'),'model':db[_0x8d5c('0x5')],'attributes':['id',_0x8d5c('0x3'),_0x8d5c('0x6')],'raw':!![],'where':{'role':_0x8d5c('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8d5c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8d5c('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8d5c('0x3'),_0x8d5c('0x9')],'where':{'type':_0x8d5c('0xa')}};function getAssociatedResources(_0x5b392c,_0x4d4947,_0x18f9b6){return db['UserProfileSection'][_0x8d5c('0xb')]({'where':{'name':_0x5b392c,'userProfileId':_0x4d4947},'raw':!![]})[_0x8d5c('0xc')](function(_0x29737a){if(_0x29737a){if(_0x29737a[_0x8d5c('0xd')]){switch(_0x5b392c){case _0x8d5c('0xe'):case _0x8d5c('0xf'):case _0x8d5c('0x10'):case _0x8d5c('0x11'):case _0x8d5c('0x12'):case _0x8d5c('0x13'):case _0x8d5c('0x14'):return db[_0x18f9b6][_0x8d5c('0x15')](queryQueues);case'Telephones':return db[_0x18f9b6][_0x8d5c('0x15')](queryTelephones);case _0x8d5c('0x16'):return db[_0x18f9b6][_0x8d5c('0x15')](queryTrunks);case _0x8d5c('0x17'):return db[_0x18f9b6][_0x8d5c('0x15')](queryCampaigns);}}else{return db[_0x8d5c('0x18')][_0x8d5c('0x15')]({'attributes':[_0x8d5c('0x19')],'where':{'sectionId':_0x29737a['id']},'raw':!![]})['then'](function(_0x3146f4){if(_0x3146f4){var _0x144717={'where':{'id':_['map'](_0x3146f4,'resourceId')},'raw':!![]};switch(_0x18f9b6){case _0x8d5c('0x5'):_0x144717['where']['role']='telephone';break;case _0x8d5c('0x1a'):_0x144717[_0x8d5c('0x1b')][_0x8d5c('0x9')]=_0x8d5c('0xa');break;}return db[_0x18f9b6][_0x8d5c('0x15')](_0x144717);}else{return[];}});}}else{return[];}})[_0x8d5c('0xc')](function(_0x55a2e7){return _0x55a2e7;});}function joinOrLeaveQueues(_0x581eef,_0x51d5da,_0x4e4c5c,_0x379bfb){_0x581eef[_0x51d5da](util[_0x8d5c('0x1c')](_0x8d5c('0x1d'),_0x4e4c5c,_0x379bfb[_0x8d5c('0x3')]));if(_0x379bfb[_0x8d5c('0x4')]){for(var _0x9399ce=0x0;_0x9399ce<_0x379bfb[_0x8d5c('0x4')][_0x8d5c('0x1e')];_0x9399ce+=0x1){_0x581eef[_0x51d5da](util[_0x8d5c('0x1c')](_0x8d5c('0x1f'),_0x379bfb[_0x8d5c('0x4')][_0x9399ce]['name']));}}}function joinOrLeave(_0x2f067f,_0x2c74ab,_0x4c0cdf){var _0x251da8;if(_0x2f067f[_0x8d5c('0x20')][_0x8d5c('0x21')]['id']){db[_0x8d5c('0x5')]['find']({'attributes':['id',_0x8d5c('0x3'),_0x8d5c('0x6'),'userProfileId'],'where':{'id':_0x2f067f['handshake'][_0x8d5c('0x21')]['id']},'include':[{'model':db[_0x8d5c('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x8d5c('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8d5c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x8d5c('0x25')],'as':_0x8d5c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x8d5c('0x27')],'as':_0x8d5c('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x8d5c('0x29')],'as':_0x8d5c('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x8d5c('0xc')](function(_0x2c940f){if(_0x2c940f){_0x251da8=_0x2c940f;_0x2f067f[_0x2c74ab](util['format'](_0x8d5c('0x1f'),_0x2c940f[_0x8d5c('0x3')]));var _0x2aa708=[];switch(_0x2c940f['role']){case _0x8d5c('0x2b'):_0x2f067f[_0x2c74ab](_0x8d5c('0x2c'));_0x2f067f[_0x2c74ab](_0x8d5c('0x2d'));if(queryQueues[_0x8d5c('0x2e')](_0x8d5c('0x2f'))){delete queryQueues[_0x8d5c('0x2f')];}_0x2aa708[_0x8d5c('0x30')](db[_0x8d5c('0x31')][_0x8d5c('0x15')](queryQueues));_0x2aa708[_0x8d5c('0x30')](db[_0x8d5c('0x32')][_0x8d5c('0x15')](queryQueues));_0x2aa708[_0x8d5c('0x30')](db[_0x8d5c('0x33')][_0x8d5c('0x15')](queryQueues));_0x2aa708[_0x8d5c('0x30')](db[_0x8d5c('0x34')][_0x8d5c('0x15')](queryQueues));_0x2aa708['push'](db['MailQueue']['findAll'](queryQueues));_0x2aa708['push'](db[_0x8d5c('0x35')][_0x8d5c('0x15')](queryQueues));_0x2aa708[_0x8d5c('0x30')](db['WhatsappQueue'][_0x8d5c('0x15')](queryQueues));_0x2aa708[_0x8d5c('0x30')](db[_0x8d5c('0x5')][_0x8d5c('0x15')](queryTelephones));_0x2aa708['push'](db[_0x8d5c('0x36')]['findAll'](queryTrunks));_0x2aa708[_0x8d5c('0x30')](db[_0x8d5c('0x1a')]['findAll'](queryCampaigns));_0x2aa708[_0x8d5c('0x30')](db[_0x8d5c('0x5')][_0x8d5c('0x15')](queryAgents));break;case _0x8d5c('0x37'):_0x2f067f[_0x2c74ab](_0x8d5c('0x2c'));_0x2f067f[_0x2c74ab](_0x8d5c('0x2d'));_0x2aa708[_0x8d5c('0x30')](getAssociatedResources(_0x8d5c('0xe'),_0x2c940f[_0x8d5c('0x38')],_0x8d5c('0x31')));_0x2aa708[_0x8d5c('0x30')](getAssociatedResources(_0x8d5c('0xf'),_0x2c940f['userProfileId'],'ChatQueue'));_0x2aa708['push'](getAssociatedResources('FaxQueues',_0x2c940f['userProfileId'],_0x8d5c('0x33')));_0x2aa708[_0x8d5c('0x30')](getAssociatedResources('SmsQueues',_0x2c940f[_0x8d5c('0x38')],_0x8d5c('0x34')));_0x2aa708[_0x8d5c('0x30')](getAssociatedResources(_0x8d5c('0x12'),_0x2c940f[_0x8d5c('0x38')],_0x8d5c('0x39')));_0x2aa708['push'](getAssociatedResources('OpenchannelQueues',_0x2c940f[_0x8d5c('0x38')],_0x8d5c('0x35')));_0x2aa708[_0x8d5c('0x30')](getAssociatedResources(_0x8d5c('0x14'),_0x2c940f[_0x8d5c('0x38')],'WhatsappQueue'));_0x2aa708[_0x8d5c('0x30')](getAssociatedResources(_0x8d5c('0x3a'),_0x2c940f[_0x8d5c('0x38')],'User'));_0x2aa708['push'](getAssociatedResources(_0x8d5c('0x16'),_0x2c940f[_0x8d5c('0x38')],_0x8d5c('0x36')));_0x2aa708[_0x8d5c('0x30')](getAssociatedResources('IvrCampaigns',_0x2c940f['userProfileId'],'Campaign'));_0x2aa708['push'](db[_0x8d5c('0x5')][_0x8d5c('0x15')](queryAgents));break;case _0x8d5c('0x7'):_0x2f067f[_0x2c74ab](_0x8d5c('0x2c'));_0x2f067f[_0x2c74ab](_0x8d5c('0x2d'));_0x2aa708[_0x8d5c('0x30')](_0x2c940f['getVoiceQueues']({'attributes':['id',_0x8d5c('0x3')]}));_0x2aa708[_0x8d5c('0x30')](_0x2c940f[_0x8d5c('0x3b')]({'attributes':['id',_0x8d5c('0x3')]}));_0x2aa708[_0x8d5c('0x30')](_0x2c940f[_0x8d5c('0x3c')]({'attributes':['id',_0x8d5c('0x3')]}));_0x2aa708['push'](_0x2c940f[_0x8d5c('0x3d')]({'attributes':['id',_0x8d5c('0x3')]}));_0x2aa708['push'](_0x2c940f[_0x8d5c('0x3e')]({'attributes':['id','name']}));_0x2aa708[_0x8d5c('0x30')](_0x2c940f[_0x8d5c('0x3f')]({'attributes':['id',_0x8d5c('0x3')]}));_0x2aa708['push'](_0x2c940f[_0x8d5c('0x40')]({'attributes':['id',_0x8d5c('0x3')]}));break;}return BPromise[_0x8d5c('0x41')](_0x2aa708);}})[_0x8d5c('0xc')](function(_0x49ffe4){if(_0x49ffe4&&_0x49ffe4['length']){for(var _0x373262=0x0;_0x373262<_0x49ffe4[_0x8d5c('0x1e')];_0x373262+=0x1){for(var _0x4913b4=0x0;_0x4913b4<_0x49ffe4[_0x373262][_0x8d5c('0x1e')];_0x4913b4+=0x1){switch(_0x373262){case 0x0:joinOrLeaveQueues(_0x2f067f,_0x2c74ab,_0x8d5c('0x42'),_0x49ffe4[_0x373262][_0x4913b4]);break;case 0x1:joinOrLeaveQueues(_0x2f067f,_0x2c74ab,_0x8d5c('0x43'),_0x49ffe4[_0x373262][_0x4913b4]);break;case 0x2:joinOrLeaveQueues(_0x2f067f,_0x2c74ab,_0x8d5c('0x44'),_0x49ffe4[_0x373262][_0x4913b4]);break;case 0x3:joinOrLeaveQueues(_0x2f067f,_0x2c74ab,_0x8d5c('0x45'),_0x49ffe4[_0x373262][_0x4913b4]);break;case 0x4:joinOrLeaveQueues(_0x2f067f,_0x2c74ab,'mail',_0x49ffe4[_0x373262][_0x4913b4]);break;case 0x5:joinOrLeaveQueues(_0x2f067f,_0x2c74ab,_0x8d5c('0x46'),_0x49ffe4[_0x373262][_0x4913b4]);break;case 0x6:joinOrLeaveQueues(_0x2f067f,_0x2c74ab,_0x8d5c('0x47'),_0x49ffe4[_0x373262][_0x4913b4]);break;case 0x7:if(_0x251da8[_0x8d5c('0x6')]!==_0x8d5c('0x7'))_0x2f067f[_0x2c74ab](util[_0x8d5c('0x1c')](_0x8d5c('0x48'),_0x49ffe4[_0x373262][_0x4913b4][_0x8d5c('0x3')]));break;case 0x8:if(_0x251da8['role']!==_0x8d5c('0x7'))_0x2f067f[_0x2c74ab](util[_0x8d5c('0x1c')](_0x8d5c('0x49'),_0x49ffe4[_0x373262][_0x4913b4][_0x8d5c('0x3')]));break;case 0x9:if(_0x251da8[_0x8d5c('0x6')]!==_0x8d5c('0x7'))_0x2f067f[_0x2c74ab](util[_0x8d5c('0x1c')](_0x8d5c('0x4a'),_0x49ffe4[_0x373262][_0x4913b4][_0x8d5c('0x9')],_0x49ffe4[_0x373262][_0x4913b4][_0x8d5c('0x3')]));break;case 0xa:_0x2f067f[_0x2c74ab](util[_0x8d5c('0x1c')](_0x8d5c('0x1f'),_0x49ffe4[_0x373262][_0x4913b4][_0x8d5c('0x3')]));break;}}}}})['then'](function(){if(_0x2c74ab===_0x8d5c('0x4b')){var _0x3d1430=_[_0x8d5c('0x4c')](_0x251da8[_0x8d5c('0x4d')],'id');return _0x251da8['removeChatInteractions'](_0x3d1430)['then'](function(){for(var _0x1a3752=0x0;_0x1a3752<_0x3d1430[_0x8d5c('0x1e')];_0x1a3752+=0x1){_0x4c0cdf[_0x8d5c('0x4e')](_0x8d5c('0x4f'),{'ChatInteractionId':Number(_0x3d1430[_0x1a3752]),'UserId':Number(_0x251da8['id'])});}});}})['then'](function(){if(_0x2c74ab===_0x8d5c('0x4b')){var _0x3b33d3=_[_0x8d5c('0x4c')](_0x251da8[_0x8d5c('0x23')],'id');return _0x251da8[_0x8d5c('0x50')](_0x3b33d3)[_0x8d5c('0xc')](function(){for(var _0x3d3b20=0x0;_0x3d3b20<_0x3b33d3[_0x8d5c('0x1e')];_0x3d3b20+=0x1){_0x4c0cdf[_0x8d5c('0x4e')](_0x8d5c('0x51'),{'MailInteractionId':Number(_0x3b33d3[_0x3d3b20]),'UserId':Number(_0x251da8['id'])});}});}})[_0x8d5c('0xc')](function(){if(_0x2c74ab===_0x8d5c('0x4b')){var _0x1d9a08=_[_0x8d5c('0x4c')](_0x251da8[_0x8d5c('0x24')],'id');return _0x251da8[_0x8d5c('0x52')](_0x1d9a08)[_0x8d5c('0xc')](function(){for(var _0x430d74=0x0;_0x430d74<_0x1d9a08[_0x8d5c('0x1e')];_0x430d74+=0x1){_0x4c0cdf['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1d9a08[_0x430d74]),'UserId':Number(_0x251da8['id'])});}});}})[_0x8d5c('0xc')](function(){if(_0x2c74ab===_0x8d5c('0x4b')){var _0x2a280a=_[_0x8d5c('0x4c')](_0x251da8[_0x8d5c('0x26')],'id');return _0x251da8[_0x8d5c('0x53')](_0x2a280a)[_0x8d5c('0xc')](function(){for(var _0x450fbc=0x0;_0x450fbc<_0x2a280a[_0x8d5c('0x1e')];_0x450fbc+=0x1){_0x4c0cdf[_0x8d5c('0x4e')](_0x8d5c('0x54'),{'SmsInteractionId':Number(_0x2a280a[_0x450fbc]),'UserId':Number(_0x251da8['id'])});}});}})[_0x8d5c('0xc')](function(){if(_0x2c74ab===_0x8d5c('0x4b')){var _0xe8a602=_[_0x8d5c('0x4c')](_0x251da8[_0x8d5c('0x28')],'id');return _0x251da8[_0x8d5c('0x55')](_0xe8a602)[_0x8d5c('0xc')](function(){for(var _0x381ee2=0x0;_0x381ee2<_0xe8a602[_0x8d5c('0x1e')];_0x381ee2+=0x1){_0x4c0cdf[_0x8d5c('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xe8a602[_0x381ee2]),'UserId':Number(_0x251da8['id'])});}});}})[_0x8d5c('0xc')](function(){if(_0x2c74ab==='leave'){var _0x3500f0=_[_0x8d5c('0x4c')](_0x251da8[_0x8d5c('0x2a')],'id');return _0x251da8[_0x8d5c('0x56')](_0x3500f0)[_0x8d5c('0xc')](function(){for(var _0x5dfa4c=0x0;_0x5dfa4c<_0x3500f0['length'];_0x5dfa4c+=0x1){_0x4c0cdf[_0x8d5c('0x4e')](_0x8d5c('0x57'),{'WhatsappInteractionId':Number(_0x3500f0[_0x5dfa4c]),'UserId':Number(_0x251da8['id'])});}});}})[_0x8d5c('0x58')](function(_0x31531f){_0x2f067f['log'](_0x31531f);});}}function onDisconnect(_0x57e9f5,_0x238d9a){joinOrLeave(_0x57e9f5,_0x8d5c('0x4b'),_0x238d9a);}function onConnect(_0x2e3e2d){joinOrLeave(_0x2e3e2d,_0x8d5c('0x59'));}exports[_0x8d5c('0x5a')]=function(_0x1e5207){_0x1e5207['on']('connection',function(_0x33c8b5){_0x33c8b5[_0x8d5c('0x5b')](0x0);_0x33c8b5['address']=_0x33c8b5[_0x8d5c('0x5c')]['connection'][_0x8d5c('0x5d')]+':'+_0x33c8b5[_0x8d5c('0x5c')][_0x8d5c('0x5e')]['remotePort'];_0x33c8b5['connectedAt']=new Date();_0x33c8b5['log']=function(_0x5dd2d4){console[_0x8d5c('0x5f')](_0x8d5c('0x60')+_0x33c8b5[_0x8d5c('0x61')][_0x8d5c('0x3')]+'['+_0x33c8b5[_0x8d5c('0x62')]+']',_0x5dd2d4);};_0x33c8b5['on'](_0x8d5c('0x63'),function(){onDisconnect(_0x33c8b5,_0x1e5207);_0x33c8b5['log'](_0x8d5c('0x64'));});onConnect(_0x33c8b5);_0x33c8b5['log'](_0x8d5c('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a1243ce..894735a 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 _0x82d6=['MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','get','channel','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','then','contact','UserId','interface','name','incomingmessage','AfterCreateMessage','motionChannel','event','offlineMessage','query','Sequelize','format','SIP/%s','agent','AfterCreate','changed','closed','substatus','AfterUpdate','find','email','internal','default','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail'];(function(_0x116a7b,_0x521f29){var _0x224b13=function(_0x13c3c7){while(--_0x13c3c7){_0x116a7b['push'](_0x116a7b['shift']());}};_0x224b13(++_0x521f29);}(_0x82d6,0x1aa));var _0x682d=function(_0x53342c,_0x33d1cd){_0x53342c=_0x53342c-0x0;var _0x378eac=_0x82d6[_0x53342c];return _0x378eac;};'use strict';var util=require(_0x682d('0x0'));var db=require(_0x682d('0x1'))['db'];var jayson=require(_0x682d('0x2'));var logger=require(_0x682d('0x3'))(_0x682d('0x4'));var client=jayson[_0x682d('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0x682d('0x6'),'model':'ChatInteraction','event':_0x682d('0x7'),'condition':_0x682d('0x8'),'callback':afterCreate},{'channel':_0x682d('0x6'),'model':_0x682d('0x9'),'event':_0x682d('0xa'),'condition':_0x682d('0xb'),'callback':afterUpdate},{'channel':_0x682d('0x6'),'model':_0x682d('0xc'),'event':_0x682d('0x7'),'condition':_0x682d('0xd'),'callback':afterCreateMessage},{'channel':_0x682d('0x6'),'model':_0x682d('0xe'),'event':'afterCreate','condition':_0x682d('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0x682d('0xf'),'model':_0x682d('0x10'),'event':_0x682d('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x682d('0xf'),'model':_0x682d('0x10'),'event':_0x682d('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x682d('0x11'),'model':_0x682d('0x12'),'event':'afterCreate','condition':_0x682d('0x8'),'callback':afterCreate},{'channel':_0x682d('0x11'),'model':_0x682d('0x12'),'event':_0x682d('0xa'),'condition':_0x682d('0xb'),'callback':afterUpdate},{'channel':_0x682d('0x11'),'model':_0x682d('0x13'),'event':_0x682d('0x7'),'condition':_0x682d('0xd'),'callback':afterCreateMessage},{'channel':_0x682d('0x14'),'model':'FaxInteraction','event':_0x682d('0x7'),'condition':_0x682d('0x8'),'callback':afterCreate},{'channel':_0x682d('0x14'),'model':_0x682d('0x15'),'event':'afterUpdate','condition':_0x682d('0xb'),'callback':afterUpdate},{'channel':_0x682d('0x14'),'model':_0x682d('0x16'),'event':_0x682d('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x682d('0x17'),'model':_0x682d('0x18'),'event':_0x682d('0x7'),'condition':_0x682d('0x8'),'callback':afterCreate},{'channel':_0x682d('0x17'),'model':'MailInteraction','event':_0x682d('0xa'),'condition':_0x682d('0xb'),'callback':afterUpdate},{'channel':'Mail','model':_0x682d('0x19'),'event':_0x682d('0x7'),'condition':_0x682d('0xd'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterCreate','condition':_0x682d('0x8'),'callback':afterCreate},{'channel':_0x682d('0x1a'),'model':_0x682d('0x1b'),'event':_0x682d('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x682d('0x1a'),'model':_0x682d('0x1c'),'event':_0x682d('0x7'),'condition':_0x682d('0xd'),'callback':afterCreateMessage}];function request(_0x27296f){return client[_0x682d('0x1d')](_0x682d('0x1e'),_0x27296f)['then'](function(_0x33f1c4){logger[_0x682d('0x1f')](_0x682d('0x20'),_0x682d('0x1e'),_0x33f1c4);if(_0x33f1c4[_0x682d('0x21')]){if(_0x33f1c4['error'][_0x682d('0x22')]===0x1f4){logger[_0x682d('0x21')](_0x682d('0x20'),'EventManager',_0x33f1c4[_0x682d('0x21')]);}}})[_0x682d('0x23')](function(_0x1ebb6d){logger[_0x682d('0x21')](_0x682d('0x20'),_0x682d('0x1e'),_0x1ebb6d);});}function afterCreateMessage(_0x2e5265){return function(_0xabbc2f){_0xabbc2f=_0xabbc2f[_0x682d('0x24')]({'plain':!![]});_0xabbc2f[_0x682d('0x25')]=_0x2e5265;_0xabbc2f['motionChannel']=_0x2e5265;_0xabbc2f['event']=_0xabbc2f['direction'];Promise[_0x682d('0x26')]()['then'](function(){if(typeof _0xabbc2f[_0x682d('0x27')]===_0x682d('0x28'))return null;var _0x3c10ea=_0x682d('0x29')+_0xabbc2f[_0x682d('0x27')];return db[_0x682d('0x2a')]['query'](_0x3c10ea,{'type':db['Sequelize'][_0x682d('0x2b')][_0x682d('0x2c')],'raw':!![]});})[_0x682d('0x2d')](function(_0x497c3f){if(_0x497c3f){_0xabbc2f[_0x682d('0x2e')]=_0x497c3f[0x0];}if(typeof _0xabbc2f[_0x682d('0x2f')]==='undefined')return;return getAgent(_0xabbc2f['UserId']);})['then'](function(_0x3f117b){if(_0x3f117b){_0xabbc2f[_0x682d('0x30')]=util['format']('SIP/%s',_0x3f117b[_0x682d('0x31')]);_0xabbc2f['agent']=_0x3f117b;_0xabbc2f[_0x682d('0x25')]=_0x2e5265;return request({'event':_0x682d('0x32'),'message':_0xabbc2f});}else{return request({'event':'outgoingmessage','message':_0xabbc2f});}})[_0x682d('0x23')](function(_0x2d39be){logger['error'](_0x682d('0x20'),_0x682d('0x33'),_0x2d39be);});};}function afterCreateOfflineMessage(_0x440b81){return function(_0x5655a9){_0x5655a9=_0x5655a9[_0x682d('0x24')]({'plain':!![]});_0x5655a9[_0x682d('0x25')]=_0x440b81;_0x5655a9[_0x682d('0x34')]=_0x440b81;_0x5655a9[_0x682d('0x35')]=_0x682d('0x36');return request({'event':_0x5655a9[_0x682d('0x35')],'message':_0x5655a9});};}function afterCreate(_0xf3713b,_0xc647ba){return function(_0x36df62){var _0x3f1a2c=_0x36df62['get']({'plain':!![]});_0x3f1a2c[_0x682d('0x25')]=_0xf3713b;_0x3f1a2c['motionChannel']=_0xf3713b;_0x3f1a2c[_0x682d('0x35')]='opened';Promise[_0x682d('0x26')]()[_0x682d('0x2d')](function(){var _0xdc1ca9=_0x682d('0x29')+_0x3f1a2c['ContactId'];return db[_0x682d('0x2a')][_0x682d('0x37')](_0xdc1ca9,{'type':db[_0x682d('0x38')][_0x682d('0x2b')][_0x682d('0x2c')],'raw':!![]});})[_0x682d('0x2d')](function(_0x2ab35f){if(_0x2ab35f){_0x3f1a2c[_0x682d('0x2e')]=_0x2ab35f[0x0];}if(_0x3f1a2c[_0x682d('0x2f')]){return getAgent(_0x3f1a2c[_0x682d('0x2f')]);}return;})['then'](function(_0x2bc4fa){if(_0x2bc4fa){_0x3f1a2c[_0x682d('0x30')]=util[_0x682d('0x39')](_0x682d('0x3a'),_0x2bc4fa[_0x682d('0x31')]);_0x3f1a2c[_0x682d('0x3b')]=_0x2bc4fa;}return request({'event':_0xc647ba,'message':_0x3f1a2c});})['catch'](function(_0x2e9ffc){logger['error'](_0x682d('0x20'),_0x682d('0x3c'),_0x2e9ffc);});};}function afterUpdate(_0x56b7be){return function(_0x412ea5){var _0x5d5774=_0x412ea5[_0x682d('0x3d')](_0x682d('0x3e'))&&_0x412ea5[_0x682d('0x3e')];var _0xfda5dc=_0x412ea5[_0x682d('0x3d')](_0x682d('0x3f'));if(_0x5d5774||_0xfda5dc){var _0x333bea=_0x5d5774?'closedinteraction':_0x682d('0x3f');var _0x20b394=_0x412ea5[_0x682d('0x24')]({'plain':!![]});_0x20b394[_0x682d('0x25')]=_0x56b7be;_0x20b394[_0x682d('0x34')]=_0x56b7be;_0x20b394[_0x682d('0x35')]=_0x5d5774?_0x682d('0x3e'):'substatus';var _0x1d1ab6=_0x682d('0x29')+_0x20b394[_0x682d('0x27')];return db['sequelize'][_0x682d('0x37')](_0x1d1ab6,{'type':db[_0x682d('0x38')][_0x682d('0x2b')][_0x682d('0x2c')],'raw':!![]})[_0x682d('0x2d')](function(_0x2f8a62){if(_0x2f8a62){_0x20b394['contact']=_0x2f8a62[0x0];}if(typeof _0x20b394[_0x682d('0x2f')]==='undefined')return;return getAgent(_0x20b394[_0x682d('0x2f')]);})['then'](function(_0x45f87b){if(_0x45f87b){_0x20b394[_0x682d('0x30')]=util['format'](_0x682d('0x3a'),_0x45f87b[_0x682d('0x31')]);_0x20b394[_0x682d('0x3b')]=_0x45f87b;}return request({'event':_0x333bea,'message':_0x20b394});})[_0x682d('0x23')](function(_0x1c5e27){logger[_0x682d('0x21')](_0x682d('0x20'),_0x682d('0x40'),_0x1c5e27);});}};}function getAgent(_0x4a4f49){return db['User'][_0x682d('0x41')]({'where':{'id':_0x4a4f49},'attributes':['id',_0x682d('0x31'),'fullname',_0x682d('0x42'),_0x682d('0x43')],'raw':!![]})['then'](function(_0x1edd7f){return _0x1edd7f;});}exports[_0x682d('0x44')]=function(){for(var _0x3353d6=0x0;_0x3353d6=_0x56b687['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x30e99a(_0x174e02);})[_0xdb78('0x13')](function(_0x467a61){_0x2814df(_0x467a61);});});}; \ No newline at end of file +var _0x339f=['toLowerCase','includes','clearBlockUser','updateAttributes','role','User','count','agent','getLicense','then','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','whatsapp','openchannel','getChannels','isValidChannel'];(function(_0x3edbc9,_0x40b49d){var _0x3782f5=function(_0x2580ca){while(--_0x2580ca){_0x3edbc9['push'](_0x3edbc9['shift']());}};_0x3782f5(++_0x40b49d);}(_0x339f,0x7f));var _0xf339=function(_0xcda15e,_0x335064){_0xcda15e=_0xcda15e-0x0;var _0x79bc1=_0x339f[_0xcda15e];return _0x79bc1;};'use strict';var _=require(_0xf339('0x0'));var BPromise=require(_0xf339('0x1'));var db=require(_0xf339('0x2'))['db'];var util=require(_0xf339('0x3'));var channels=[_0xf339('0x4'),_0xf339('0x5'),'chat',_0xf339('0x6'),'sms',_0xf339('0x7'),_0xf339('0x8')];exports[_0xf339('0x9')]=function(){return channels;};exports[_0xf339('0xa')]=function(_0x122758){_0x122758=_0x122758[_0xf339('0xb')]();return _[_0xf339('0xc')](channels,_0x122758);};exports[_0xf339('0xd')]=function(_0x347ccf,_0x40c9dc,_0x41e916,_0xf21631){var _0x4def61={'loginAttempts':_0x40c9dc,'blocked':_0x41e916};if(!_['isUndefined'](_0xf21631)){_0x4def61['blockedAt']=_0xf21631;}return _0x347ccf[_0xf339('0xe')](_0x4def61);};exports['getLicense']=function(_0x50705e){return new BPromise(function(_0x116035,_0x5435c8){var _0x3c8cfa=0x0;if(_0x50705e[_0xf339('0xf')]!=='agent'){_0x116035(_0x50705e);}db[_0xf339('0x10')][_0xf339('0x11')]({'where':{'role':_0xf339('0x12'),'online':!![],'id':{'$ne':_0x50705e['id']}}})['then'](function(_0x1f2aea){_0x3c8cfa=_0x1f2aea;return util[_0xf339('0x13')]();})[_0xf339('0x14')](function(_0x2ac504){if(_0x2ac504&&_0x2ac504['agents']&&_0x3c8cfa>=_0x2ac504['agents']){throw Error(_0xf339('0x15'));}_0x116035(_0x50705e);})[_0xf339('0x16')](function(_0xd02201){_0x5435c8(_0xd02201);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 3c556f8..0501399 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a6e=['Internal\x20Server\x20Error','Error','inherits','Bad\x20Request','Forbidden','name','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict','error','stack','send','exports','../config/logger','message'];(function(_0x55e5ea,_0x3e471d){var _0x50ec12=function(_0x537505){while(--_0x537505){_0x55e5ea['push'](_0x55e5ea['shift']());}};_0x50ec12(++_0x3e471d);}(_0x7a6e,0x18d));var _0xe7a6=function(_0x14d19b,_0x5de038){_0x14d19b=_0x14d19b-0x0;var _0x455d60=_0x7a6e[_0x14d19b];return _0x455d60;};'use strict';var util=require('util');var logger=require(_0xe7a6('0x0'))('api');var APIError=function(_0x1db605,_0x5585a9){this[_0xe7a6('0x1')]=_0x1db605||_0xe7a6('0x2');this['name']=_0x5585a9||_0xe7a6('0x3');util[_0xe7a6('0x4')](APIError,Error);};var APIBadRequestError=function(_0x2eb006){this[_0xe7a6('0x1')]=_0x2eb006||_0xe7a6('0x5');this['name']=_0xe7a6('0x5');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3e7149){this['message']=_0x3e7149||_0xe7a6('0x6');this[_0xe7a6('0x7')]=_0xe7a6('0x6');util[_0xe7a6('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5f04dc){this[_0xe7a6('0x1')]=_0x5f04dc||_0xe7a6('0x8');this[_0xe7a6('0x7')]=_0xe7a6('0x9');util[_0xe7a6('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xbee56f){this[_0xe7a6('0x1')]=_0xbee56f||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xe7a6('0x7')]=_0xe7a6('0xa');this[_0xe7a6('0xb')]=0x193;this[_0xe7a6('0xc')]={'type':'OutOfInterval'};util[_0xe7a6('0x4')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4fedc4){this[_0xe7a6('0x1')]=_0x4fedc4||_0xe7a6('0xd');this[_0xe7a6('0x7')]=_0xe7a6('0xe');util[_0xe7a6('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x443910){switch(_0x443910){case'Bad\x20Request':return 0x190;case'Forbidden',_0xe7a6('0xa'):return 0x193;case _0xe7a6('0x9'):return 0x194;case _0xe7a6('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x117b33){if(_0x117b33===_0xe7a6('0xa'))return _0x117b33;return null;}function handleError(_0x5c876e){return function(_0x96a38e){logger[_0xe7a6('0xf')](_0x96a38e[_0xe7a6('0x10')]);var _0x14158e=getStatusCode(_0x96a38e[_0xe7a6('0x7')]);var _0x25f2d4=getCustomStatusMessage(_0x96a38e[_0xe7a6('0x7')]);if(_0x96a38e['name']){delete _0x96a38e[_0xe7a6('0x7')];}if(_0x25f2d4){_0x5c876e['statusMessage']=_0x25f2d4;}return _0x5c876e['status'](_0x14158e)[_0xe7a6('0x11')](_0x96a38e);};}module[_0xe7a6('0x12')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x779c=['api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','details','OutOfInterval','Conflict','Forbidden','Out\x20Of\x20Interval','error','stack','statusMessage','status','exports','util','../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x779c,0x112));var _0xc779=function(_0x486dc3,_0x45fa37){_0x486dc3=_0x486dc3-0x0;var _0x577217=_0x779c[_0x486dc3];return _0x577217;};'use strict';var util=require(_0xc779('0x0'));var logger=require(_0xc779('0x1'))(_0xc779('0x2'));var APIError=function(_0x22930d,_0x515f16){this['message']=_0x22930d||_0xc779('0x3');this[_0xc779('0x4')]=_0x515f16||_0xc779('0x5');util[_0xc779('0x6')](APIError,Error);};var APIBadRequestError=function(_0x24e1d9){this[_0xc779('0x7')]=_0x24e1d9||'Bad\x20Request';this[_0xc779('0x4')]=_0xc779('0x8');util[_0xc779('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x213c51){this[_0xc779('0x7')]=_0x213c51||'Forbidden';this['name']='Forbidden';util[_0xc779('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x11c759){this['message']=_0x11c759||_0xc779('0x9');this[_0xc779('0x4')]=_0xc779('0xa');util[_0xc779('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x8b123f){this[_0xc779('0x7')]=_0x8b123f||_0xc779('0xb');this[_0xc779('0x4')]='Out\x20Of\x20Interval';this[_0xc779('0xc')]=0x193;this[_0xc779('0xd')]={'type':_0xc779('0xe')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x2f8573){this[_0xc779('0x7')]=_0x2f8573||'Resource\x20Conflict';this['name']=_0xc779('0xf');util[_0xc779('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x1e9c83){switch(_0x1e9c83){case _0xc779('0x8'):return 0x190;case _0xc779('0x10'),_0xc779('0x11'):return 0x193;case _0xc779('0xa'):return 0x194;case _0xc779('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x155aa3){if(_0x155aa3===_0xc779('0x11'))return _0x155aa3;return null;}function handleError(_0x34e205){return function(_0x142976){logger[_0xc779('0x12')](_0x142976[_0xc779('0x13')]);var _0x35b513=getStatusCode(_0x142976[_0xc779('0x4')]);var _0x3286ee=getCustomStatusMessage(_0x142976[_0xc779('0x4')]);if(_0x142976[_0xc779('0x4')]){delete _0x142976[_0xc779('0x4')];}if(_0x3286ee){_0x34e205[_0xc779('0x14')]=_0x3286ee;}return _0x34e205[_0xc779('0x15')](_0x35b513)['send'](_0x142976);};}module[_0xc779('0x16')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5cb6652..de971e6 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfba1=['send','404','status','json'];(function(_0x4f9779,_0x52808a){var _0x13f3cc=function(_0x5d0136){while(--_0x5d0136){_0x4f9779['push'](_0x4f9779['shift']());}};_0x13f3cc(++_0x52808a);}(_0xfba1,0x1e5));var _0x1fba=function(_0x35ef08,_0x2cb5ef){_0x35ef08=_0x35ef08-0x0;var _0x198be4=_0xfba1[_0x35ef08];return _0x198be4;};'use strict';module['exports'][0x194]=function pageNotFound(_0x17e119,_0x49d344){var _0x92a962=_0x1fba('0x0');var _0x391b47=0x194;var _0x271b50={'status':_0x391b47};_0x49d344[_0x1fba('0x1')](_0x271b50[_0x1fba('0x1')]);_0x49d344['render'](_0x92a962,{},function(_0x3511cd,_0x249c69){if(_0x3511cd){return _0x49d344['status'](_0x271b50[_0x1fba('0x1')])[_0x1fba('0x2')](_0x271b50);}_0x49d344[_0x1fba('0x3')](_0x249c69);});}; \ No newline at end of file +var _0xb73b=['send','exports','render','status','json'];(function(_0x1213cf,_0x5344ff){var _0x4dd3bf=function(_0xbf90){while(--_0xbf90){_0x1213cf['push'](_0x1213cf['shift']());}};_0x4dd3bf(++_0x5344ff);}(_0xb73b,0x1eb));var _0xbb73=function(_0x81029e,_0x4b6d77){_0x81029e=_0x81029e-0x0;var _0x4b663a=_0xb73b[_0x81029e];return _0x4b663a;};'use strict';module[_0xbb73('0x0')][0x194]=function pageNotFound(_0x4c2692,_0x55b05e){var _0x35c93d='404';var _0x129215=0x194;var _0x37f6cf={'status':_0x129215};_0x55b05e['status'](_0x37f6cf['status']);_0x55b05e[_0xbb73('0x1')](_0x35c93d,{},function(_0x3482fb,_0x3641f9){if(_0x3482fb){return _0x55b05e[_0xbb73('0x2')](_0x37f6cf['status'])[_0xbb73('0x3')](_0x37f6cf);}_0x55b05e[_0xbb73('0x4')](_0x3641f9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5ca7134..0bcd202 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3958=['chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','CmList','cm_user_has_lists','Team','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','UserVoicePrefix','MailQueues','ChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueue','WhatsappQueues','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','VoiceExtension','Sound','Sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Lists','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','VoiceCallReport','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Answers','MailMessage','Interactions','MailApplication','Applications','Template','TemplateId','mandatoryDispositionPauseId','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Attachments','ChatOfflineMessageId','TagId','List','ListId','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','Interaction','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','Tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','CmContactId','JscriptySessionReport','JscriptySessions','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','Any','OneAny','Action','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperAdditionalPhone','Hopper','Trigger','AllConditions','AllCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','AccountId','Subjects','DescriptionId','FieldId','Subject','Description','Variable','VariableId','SubjectId','Descriptions','Field','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','Configurations','VtigerConfiguration','Dynamics365Configuration','Dynamics365Field','FreshsalesField','FromId','ToId','ProjectId','user_has_teams','team_has_mail_queues','team_has_chat_queues','team_has_whatsapp_queues','VoicePrefixes','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','Queues','voice_queues_has_cm_lists','UserProfileSections','userProfileId','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','sequelize','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','options','database','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','Recordings','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','belongsToMany','Groups'];(function(_0x18cfd4,_0x467d5a){var _0x826847=function(_0x11249d){while(--_0x11249d){_0x18cfd4['push'](_0x18cfd4['shift']());}};_0x826847(++_0x467d5a);}(_0x3958,0xe0));var _0x8395=function(_0x29792f,_0x5ab098){_0x29792f=_0x29792f-0x0;var _0x300e7b=_0x3958[_0x29792f];return _0x300e7b;};'use strict';var config=require(_0x8395('0x0'));var Sequelize=require(_0x8395('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x8395('0x2')]();config[_0x8395('0x1')]=_[_0x8395('0x3')](config[_0x8395('0x1')],{'database':_0x8395('0x4'),'username':_0x8395('0x5'),'password':_0x8395('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8395('0x7'),'dialectOptions':{'charset':_0x8395('0x8')},'logging':![],'timezone':timezone[_0x8395('0x9')](),'define':{'charset':_0x8395('0xa'),'collate':_0x8395('0xb')}}});config[_0x8395('0xc')]=_[_0x8395('0x3')](config[_0x8395('0xc')],{'database':_0x8395('0x4'),'username':_0x8395('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8395('0x7'),'dialectOptions':{'charset':_0x8395('0x8')},'logging':![],'timezone':timezone[_0x8395('0x9')](),'define':{'charset':_0x8395('0xa'),'collate':_0x8395('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8395('0x1')]['database'],config[_0x8395('0x1')]['username'],config['sequelize']['password'],config[_0x8395('0x1')][_0x8395('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8395('0xc')][_0x8395('0xe')],config[_0x8395('0xc')][_0x8395('0xf')],config[_0x8395('0xc')][_0x8395('0x10')],config[_0x8395('0xc')][_0x8395('0xd')])};db[_0x8395('0x11')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x13'));db[_0x8395('0x14')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x15'));db[_0x8395('0x16')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x17'));db[_0x8395('0x18')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8395('0x19')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x1a'));db[_0x8395('0x1b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x1c'));db[_0x8395('0x1d')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x1e'));db[_0x8395('0x1f')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceMail/voiceMail.model');db[_0x8395('0x20')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x21'));db['VoiceCallReport']=db[_0x8395('0x1')]['import'](_0x8395('0x22'));db[_0x8395('0x23')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x24'));db['VoiceAgentReport']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x8395('0x25')]=db['sequelize'][_0x8395('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x8395('0x26')]=db['sequelize'][_0x8395('0x12')]('../api/memberReport/memberReport.model');db[_0x8395('0x27')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x28'));db[_0x8395('0x29')]=db[_0x8395('0x1')]['import'](_0x8395('0x2a'));db[_0x8395('0x2b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x2c'));db[_0x8395('0x2d')]=db[_0x8395('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x8395('0x2e')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x2f'));db[_0x8395('0x30')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x31'));db[_0x8395('0x32')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x33'));db[_0x8395('0x34')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x35'));db[_0x8395('0x36')]=db['sequelize']['import'](_0x8395('0x37'));db[_0x8395('0x38')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x39'));db['MailServerIn']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x3a'));db[_0x8395('0x3b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x3c'));db[_0x8395('0x3d')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x3e'));db[_0x8395('0x3f')]=db[_0x8395('0x1')]['import'](_0x8395('0x40'));db['MailSubstatus']=db['sequelize']['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x8395('0x41')]=db['sequelize']['import'](_0x8395('0x42'));db['MailMessage']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x43'));db['MailApplication']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/mailApplication/mailApplication.model');db[_0x8395('0x44')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/mailQueueReport/mailQueueReport.model');db[_0x8395('0x45')]=db[_0x8395('0x1')]['import'](_0x8395('0x46'));db[_0x8395('0x47')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x48'));db['FaxAccount']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x49'));db[_0x8395('0x4a')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x4b'));db[_0x8395('0x4c')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x4d'));db[_0x8395('0x4e')]=db[_0x8395('0x1')]['import'](_0x8395('0x4f'));db[_0x8395('0x50')]=db['sequelize']['import'](_0x8395('0x51'));db['FaxQueueReport']=db[_0x8395('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x8395('0x52')]=db['sequelize'][_0x8395('0x12')]('../api/smsAccount/smsAccount.model');db[_0x8395('0x53')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x54'));db[_0x8395('0x55')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x56'));db[_0x8395('0x57')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0x8395('0x58')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x59'));db[_0x8395('0x5a')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x5b'));db[_0x8395('0x5c')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x5d'));db[_0x8395('0x5e')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x5f'));db[_0x8395('0x60')]=db[_0x8395('0x1')]['import'](_0x8395('0x61'));db['OpenchannelQueue']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x8395('0x62')]=db[_0x8395('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x8395('0x63')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x64'));db['ChatApplication']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x65'));db[_0x8395('0x66')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x67'));db[_0x8395('0x68')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x69'));db[_0x8395('0x6a')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x6b'));db['ChatQueue']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x6c'));db[_0x8395('0x6d')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/chatGroup/chatGroup.model');db[_0x8395('0x6e')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x8395('0x6f')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x70'));db['CmContact']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x71'));db[_0x8395('0x72')]=db[_0x8395('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x8395('0x73')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x74'));db[_0x8395('0x75')]=db[_0x8395('0x1')]['import'](_0x8395('0x76'));db[_0x8395('0x77')]=db[_0x8395('0x1')]['import'](_0x8395('0x78'));db[_0x8395('0x79')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x7a'));db[_0x8395('0x7b')]=db['sequelize']['import'](_0x8395('0x7c'));db['Action']=db['sequelize']['import'](_0x8395('0x7d'));db[_0x8395('0x7e')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x7f'));db[_0x8395('0x80')]=db[_0x8395('0x1')]['import'](_0x8395('0x81'));db[_0x8395('0x82')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x83'));db[_0x8395('0x84')]=db[_0x8395('0x1')]['import'](_0x8395('0x85'));db[_0x8395('0x86')]=db['sequelize']['import']('../api/interval/interval.model');db[_0x8395('0x87')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x88'));db[_0x8395('0x89')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x8a'));db[_0x8395('0x8b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x8c'));db[_0x8395('0x8d')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x8e'));db['Sound']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/sound/sound.model');db[_0x8395('0x8f')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x90'));db[_0x8395('0x91')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/contactItemType/contactItemType.model');db[_0x8395('0x92')]=db[_0x8395('0x1')]['import'](_0x8395('0x93'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x8395('0x12')](_0x8395('0x94'));db['Template']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x95'));db['Trigger']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x96'));db['Variable']=db[_0x8395('0x1')]['import'](_0x8395('0x97'));db[_0x8395('0x98')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x99'));db[_0x8395('0x9a')]=db['sequelize']['import'](_0x8395('0x9b'));db[_0x8395('0x9c')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x9d'));db[_0x8395('0x9e')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x9f'));db[_0x8395('0xa0')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xa1'));db[_0x8395('0xa2')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x8395('0x1')]['import'](_0x8395('0xa3'));db[_0x8395('0xa4')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xa5'));db[_0x8395('0xa6')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xa7'));db[_0x8395('0xa8')]=db['sequelize']['import'](_0x8395('0xa9'));db[_0x8395('0xaa')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xab'));db[_0x8395('0xac')]=db['sequelize'][_0x8395('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x8395('0xad')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xae'));db[_0x8395('0xaf')]=db['sequelize']['import'](_0x8395('0xb0'));db[_0x8395('0xb1')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xb2'));db[_0x8395('0xb3')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x8395('0xb4')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xb5'));db['ZohoConfiguration']=db['sequelize']['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x8395('0xb6')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xb7'));db['ZendeskAccount']=db[_0x8395('0x1')]['import'](_0x8395('0xb8'));db[_0x8395('0xb9')]=db[_0x8395('0x1')]['import'](_0x8395('0xba'));db[_0x8395('0xbb')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xbc'));db[_0x8395('0xbd')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xbe'));db['FreshdeskConfiguration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xbf'));db[_0x8395('0xc0')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x8395('0xc1')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xc2'));db['VtigerConfiguration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xc3'));db[_0x8395('0xc4')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xc5'));db[_0x8395('0xc6')]=db[_0x8395('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8395('0xc7')]=db[_0x8395('0x1')]['import'](_0x8395('0xc8'));db[_0x8395('0xc9')]=db['sequelize']['import'](_0x8395('0xca'));db[_0x8395('0xcb')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xcc'));db['Dynamics365Configuration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xcd'));db['Dynamics365Field']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x8395('0xce')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xcf'));db[_0x8395('0xd0')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd1'));db['FreshsalesField']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd2'));db['Integration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x99'));db[_0x8395('0xd3')]=db[_0x8395('0x1')]['import'](_0x8395('0xd4'));db[_0x8395('0xd5')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd6'));db[_0x8395('0xd7')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd8'));db[_0x8395('0xd9')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xda'));db[_0x8395('0xdb')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xdc'));db['JscriptySessionReport']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8395('0xdd')]=db['sequelize'][_0x8395('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x8395('0xde')]=db[_0x8395('0x1')]['import']('../api/squareReport/squareReport.model');db[_0x8395('0xdf')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xe0'));db[_0x8395('0xe1')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xe2'));db['Setting']=db['sequelize'][_0x8395('0x12')](_0x8395('0xe3'));db[_0x8395('0xe4')]=db['sequelize']['import'](_0x8395('0xe5'));db[_0x8395('0xe6')]=db['sequelize']['import'](_0x8395('0xe7'));db[_0x8395('0xe8')]=db[_0x8395('0x1')]['import'](_0x8395('0xe9'));db['SquareMessage']=db['sequelize'][_0x8395('0x12')](_0x8395('0xea'));db['Team']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xeb'));db[_0x8395('0xec')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xed'));db['Campaign']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xee'));db[_0x8395('0xef')]=db[_0x8395('0x1')]['import'](_0x8395('0xf0'));db[_0x8395('0xf1')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf2'));db['Plugin']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf3'));db[_0x8395('0xf4')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x8395('0xf5')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf6'));db[_0x8395('0xf7')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf8'));db[_0x8395('0xf9')]=db['sequelize']['import'](_0x8395('0xfa'));db['SmsTransferReport']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xfb'));db['CmList']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x8395('0xfc')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xfd'));db[_0x8395('0xfe')]=db[_0x8395('0x1')]['import'](_0x8395('0xff'));db[_0x8395('0x100')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x101'));db[_0x8395('0x102')]=db['sequelize']['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x8395('0x1')]['import'](_0x8395('0x103'));db['WhatsappApplication']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x104'));db[_0x8395('0x105')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x106'));db[_0x8395('0x107')]=db['sequelize']['import'](_0x8395('0x108'));db[_0x8395('0x109')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x10a'));db[_0x8395('0x10b')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0x8395('0x12')](_0x8395('0x10c'));db['CloudProvider']=db[_0x8395('0x1')]['import'](_0x8395('0x10d'));db['TeamVoiceQueue']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x10e'));db[_0x8395('0x10f')]=db[_0x8395('0x1')]['import'](_0x8395('0x110'));db['UserVoicePrefix']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x111'));db[_0x8395('0x112')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x113'));db[_0x8395('0x114')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x115'));db[_0x8395('0x11')][_0x8395('0x116')](db[_0x8395('0x1f')],{'as':_0x8395('0x1f'),'onDelete':_0x8395('0x117'),'foreignKey':'UserId'});db[_0x8395('0x11')][_0x8395('0x116')](db[_0x8395('0x112')],{'as':'userSetting','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x1b')],{'as':_0x8395('0x119'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x2b')],{'as':'VoiceQueuesRt','foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db['VoiceExtension'],{'as':_0x8395('0x11b'),'onDelete':'cascade','hooks':!![]});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x75')],{'as':_0x8395('0x11c'),'foreignKey':'UserId'});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x77')],{'as':_0x8395('0x11d'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x79')],{'as':_0x8395('0x79'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x5e')],{'as':_0x8395('0x11e'),'foreignKey':'UserId'});db['User'][_0x8395('0x11a')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x8395('0x118')});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x55')],{'as':_0x8395('0x11f'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db['FaxInteraction'],{'as':_0x8395('0x120'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x41')],{'as':_0x8395('0x121'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db['WhatsappInteraction'],{'as':_0x8395('0x122'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x102')],{'as':_0x8395('0x123'),'foreignKey':_0x8395('0x124')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':_0x8395('0x125'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x8395('0x11')]['belongsTo'](db[_0x8395('0xfc')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x6d')],{'as':_0x8395('0x127'),'through':_0x8395('0x128')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x129')],{'as':_0x8395('0x12a'),'through':_0x8395('0x12b')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x12c')],{'as':'Lists','through':_0x8395('0x12d')});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x12e')],{'through':'user_has_teams'});db['User'][_0x8395('0x126')](db['MailInteraction'],{'as':'MailInteractions','through':_0x8395('0x12f')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x66')],{'as':_0x8395('0x130'),'through':_0x8395('0x131')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x4c')],{'as':_0x8395('0x120'),'through':_0x8395('0x132')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x55')],{'as':_0x8395('0x11f'),'through':_0x8395('0x133')});db['User'][_0x8395('0x126')](db[_0x8395('0x5e')],{'as':_0x8395('0x11e'),'through':_0x8395('0x134')});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x105')],{'as':_0x8395('0x122'),'through':_0x8395('0x135')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x19')],{'as':_0x8395('0x136'),'through':_0x8395('0x2d'),'required':![]});db['User'][_0x8395('0x126')](db[_0x8395('0x137')],{'as':'VoicePrefixes','through':_0x8395('0x138'),'required':![]});db['User'][_0x8395('0x126')](db['MailQueue'],{'as':_0x8395('0x139'),'through':_0x8395('0x30'),'required':![]});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x13a')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x8395('0x11')][_0x8395('0x126')](db['FaxQueue'],{'as':_0x8395('0x13b'),'through':_0x8395('0x32'),'required':![]});db[_0x8395('0x11')][_0x8395('0x126')](db['SmsQueue'],{'as':_0x8395('0x13c'),'through':_0x8395('0x34'),'required':![]});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x13d')],{'as':'OpenchannelQueues','through':_0x8395('0x36'),'required':![]});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x13e')],{'as':_0x8395('0x13f'),'through':_0x8395('0x38'),'required':![]});db['User'][_0x8395('0x126')](db[_0x8395('0x12c')],{'through':'cm_user_has_lists'});db['User'][_0x8395('0x126')](db['ChatWebsite'],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x140')],{'as':'FaxAccounts','through':_0x8395('0x141')});db['User'][_0x8395('0x126')](db['MailAccount'],{'as':_0x8395('0x142'),'through':_0x8395('0x143')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x5a')],{'as':_0x8395('0x144'),'through':_0x8395('0x145')});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x52')],{'as':_0x8395('0x146'),'through':_0x8395('0x147')});db[_0x8395('0x11')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x8395('0x148'),'through':'user_has_whatsapp_accounts'});db[_0x8395('0x14')][_0x8395('0x11a')](db['VoiceExtension'],{'as':_0x8395('0x149'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x14a')});db[_0x8395('0x16')]['hasMany'](db[_0x8395('0x14b')],{'onDelete':_0x8395('0x117')});db[_0x8395('0x14b')][_0x8395('0x11a')](db[_0x8395('0x14b')],{'as':'Applications','onDelete':_0x8395('0x117')});db[_0x8395('0x18')][_0x8395('0x126')](db[_0x8395('0x14c')],{'as':_0x8395('0x14d'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x8395('0x11a')](db['UserVoiceQueueRt'],{'as':_0x8395('0x14e'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':_0x8395('0x125'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')][_0x8395('0x11a')](db['CmHopperFinal'],{'as':_0x8395('0x11c'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')]['hasMany'](db[_0x8395('0x77')],{'as':_0x8395('0x150'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')]['hasMany'](db[_0x8395('0x79')],{'as':_0x8395('0x79'),'foreignKey':_0x8395('0x14f')});db['VoiceQueue']['hasMany'](db[_0x8395('0x73')],{'as':_0x8395('0x151'),'foreignKey':'VoiceQueueId'});db[_0x8395('0x19')][_0x8395('0x11a')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x8395('0x19')]['belongsTo'](db[_0x8395('0x27')],{'as':_0x8395('0x27'),'foreignKey':_0x8395('0x152')});db[_0x8395('0x19')][_0x8395('0x153')](db[_0x8395('0x27')],{'as':_0x8395('0x154'),'foreignKey':_0x8395('0x155')});db[_0x8395('0x19')][_0x8395('0x153')](db[_0x8395('0x86')],{'as':_0x8395('0x86'),'foreignKey':_0x8395('0x156')});db['VoiceQueue']['belongsTo'](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8395('0x19')][_0x8395('0x126')](db[_0x8395('0x12c')],{'as':_0x8395('0x158'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x2d')});db['VoiceQueue'][_0x8395('0x126')](db[_0x8395('0x12e')],{'as':'Teams','through':_0x8395('0x15a')});db[_0x8395('0x19')][_0x8395('0x126')](db[_0x8395('0x12c')],{'as':_0x8395('0x15b'),'through':_0x8395('0x15c')});db[_0x8395('0x1b')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x11'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x1d')]['belongsTo'](db[_0x8395('0x11')],{'as':_0x8395('0x11'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x1f')]['hasMany'](db[_0x8395('0x20')],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x15e'),'sourceKey':_0x8395('0x15f')});db[_0x8395('0x20')][_0x8395('0x153')](db['VoiceMail'],{'foreignKey':_0x8395('0x15e'),'targetKey':_0x8395('0x15f')});db['VoiceCallReport'][_0x8395('0x11a')](db[_0x8395('0x25')],{'as':_0x8395('0x160'),'foreignKey':'uniqueid','constraints':![]});db[_0x8395('0x161')][_0x8395('0x11a')](db[_0x8395('0x162')],{'as':_0x8395('0x163'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x11'),'foreignKey':'UserId'});db['VoiceCallReport'][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['MailServerIn'][_0x8395('0x153')](db[_0x8395('0x3d')],{'as':_0x8395('0x3d'),'foreignKey':_0x8395('0x166')});db[_0x8395('0x167')][_0x8395('0x153')](db[_0x8395('0x168')],{'as':_0x8395('0x168'),'foreignKey':_0x8395('0x169'),'onDelete':_0x8395('0x16a')});db['MailServerOut']['belongsTo'](db[_0x8395('0x3d')],{'as':_0x8395('0x3d'),'foreignKey':_0x8395('0x166')});db[_0x8395('0x3b')]['belongsTo'](db['CloudProvider'],{'as':_0x8395('0x168'),'foreignKey':_0x8395('0x169'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x3d')][_0x8395('0x116')](db['MailServerIn'],{'as':_0x8395('0x16b'),'onDelete':'cascade'});db[_0x8395('0x3d')][_0x8395('0x116')](db[_0x8395('0x3b')],{'as':_0x8395('0x16c'),'onDelete':'cascade'});db[_0x8395('0x3d')]['hasMany'](db[_0x8395('0x82')],{'as':'Dispositions','foreignKey':_0x8395('0x166'),'onDelete':_0x8395('0x117')});db[_0x8395('0x3d')][_0x8395('0x11a')](db['CannedAnswer'],{'as':_0x8395('0x16d'),'foreignKey':_0x8395('0x166')});db[_0x8395('0x3d')][_0x8395('0x11a')](db[_0x8395('0x16e')],{'as':_0x8395('0x15d'),'foreignKey':'MailAccountId'});db[_0x8395('0x3d')][_0x8395('0x11a')](db['MailInteraction'],{'as':_0x8395('0x16f')});db[_0x8395('0x3d')]['hasMany'](db[_0x8395('0x170')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x166'),'onDelete':_0x8395('0x117')});db[_0x8395('0x3d')]['belongsTo'](db[_0x8395('0x12c')],{'as':'List','foreignKey':'ListId'});db[_0x8395('0x3d')][_0x8395('0x153')](db[_0x8395('0x172')],{'as':_0x8395('0x172'),'foreignKey':_0x8395('0x173')});db[_0x8395('0x3d')]['belongsTo'](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x3d')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x30')});db[_0x8395('0x3f')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':'team_has_mail_queues','as':_0x8395('0x175')});db[_0x8395('0x41')][_0x8395('0x11a')](db['MailMessage'],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x176')});db[_0x8395('0x41')][_0x8395('0x153')](db[_0x8395('0x3d')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x166')});db['MailInteraction'][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x41')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x41')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x179'),'as':'Tags'});db[_0x8395('0x41')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x179'),'as':_0x8395('0x17a')});db[_0x8395('0x41')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':'Users','through':_0x8395('0x12f'),'foreignKey':_0x8395('0x176')});db[_0x8395('0x16e')][_0x8395('0x11a')](db[_0x8395('0xf1')],{'as':_0x8395('0x17b'),'onDelete':_0x8395('0x117')});db[_0x8395('0x16e')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':'User'});db[_0x8395('0x16e')]['belongsTo'](db[_0x8395('0x129')],{'onDelete':'cascade','as':_0x8395('0x164')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x8395('0x16e')]['belongsTo'](db[_0x8395('0x3d')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x166')});db['MailMessage'][_0x8395('0x153')](db[_0x8395('0x62')],{'as':_0x8395('0x62'),'foreignKey':'ChatWebsiteId'});db[_0x8395('0x16e')]['belongsTo'](db[_0x8395('0x6a')],{'as':'ChatOfflineMessage','foreignKey':_0x8395('0x17c')});db['MailApplication']['belongsTo'](db[_0x8395('0x11')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x170')]['belongsTo'](db['MailQueue'],{'onDelete':_0x8395('0x16a')});db['MailApplication'][_0x8395('0x153')](db[_0x8395('0x3d')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x170')]['belongsTo'](db['Interval'],{'onDelete':_0x8395('0x16a'),'foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0x8395('0x8f')],{'onDelete':'restrict','foreignKey':_0x8395('0x17d')});db[_0x8395('0x44')][_0x8395('0x153')](db[_0x8395('0x3d')],{});db['MailQueueReport'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x44')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x44')]['belongsTo'](db[_0x8395('0x41')],{});db[_0x8395('0x44')]['belongsTo'](db[_0x8395('0x16e')],{});db[_0x8395('0x44')][_0x8395('0x153')](db[_0x8395('0x11')],{});db[_0x8395('0x44')][_0x8395('0x153')](db['MailQueue'],{});db[_0x8395('0x45')][_0x8395('0x11a')](db[_0x8395('0x47')],{'as':_0x8395('0x180'),'onDelete':_0x8395('0x117')});db[_0x8395('0x140')]['hasMany'](db[_0x8395('0x82')],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x182'),'onDelete':_0x8395('0x117')});db['FaxAccount'][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'FaxAccountId'});db[_0x8395('0x140')][_0x8395('0x11a')](db[_0x8395('0x4c')],{'as':_0x8395('0x16f')});db[_0x8395('0x140')]['hasMany'](db[_0x8395('0x4a')],{'as':'Applications','foreignKey':_0x8395('0x182'),'onDelete':'cascade'});db[_0x8395('0x140')][_0x8395('0x11a')](db[_0x8395('0x14b')],{'as':_0x8395('0x183'),'onDelete':'cascade'});db['FaxAccount'][_0x8395('0x11a')](db['FaxMessage'],{'as':'Messages'});db[_0x8395('0x140')]['belongsTo'](db[_0x8395('0x27')],{'as':_0x8395('0x27')});db[_0x8395('0x140')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f')});db['FaxAccount'][_0x8395('0x153')](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x140')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x141')});db[_0x8395('0x4a')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x4a')][_0x8395('0x153')](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication'][_0x8395('0x153')](db[_0x8395('0x140')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x4a')][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db[_0x8395('0x4c')][_0x8395('0x11a')](db['FaxMessage'],{'as':'Messages','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x184')});db[_0x8395('0x4c')]['belongsTo'](db['FaxAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x182')});db[_0x8395('0x4c')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x4c')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x4c')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x185'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x8395('0x8f')],{'through':'fax_interaction_has_tags','as':_0x8395('0x17a')});db['FaxInteraction'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x8395('0x4e')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'as':'User'});db[_0x8395('0x4e')][_0x8395('0x153')](db[_0x8395('0x4c')],{'as':_0x8395('0x187'),'foreignKey':_0x8395('0x184')});db[_0x8395('0x4e')][_0x8395('0x153')](db['CmContact'],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x4e')]['belongsTo'](db[_0x8395('0xf1')],{'as':_0x8395('0xf1'),'foreignKey':_0x8395('0x188')});db[_0x8395('0x4e')][_0x8395('0x153')](db[_0x8395('0x140')],{'as':'Account','foreignKey':_0x8395('0x182')});db[_0x8395('0x50')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x32')});db[_0x8395('0x50')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x189'),'as':_0x8395('0x175')});db[_0x8395('0x18a')][_0x8395('0x153')](db[_0x8395('0x140')],{});db[_0x8395('0x18a')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f')});db['FaxQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x8395('0x165')});db[_0x8395('0x18a')]['belongsTo'](db[_0x8395('0x4c')],{});db['FaxQueueReport'][_0x8395('0x153')](db[_0x8395('0x4e')],{});db['FaxQueueReport'][_0x8395('0x153')](db[_0x8395('0x11')],{});db['FaxQueueReport']['belongsTo'](db[_0x8395('0x50')],{});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x82')],{'as':'Dispositions','foreignKey':_0x8395('0x18b'),'onDelete':'cascade'});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':_0x8395('0x18b')});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x57')],{'as':_0x8395('0x15d'),'foreignKey':_0x8395('0x18b')});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x55')],{'as':_0x8395('0x16f')});db['SmsAccount'][_0x8395('0x11a')](db[_0x8395('0x53')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x18b'),'onDelete':_0x8395('0x117')});db[_0x8395('0x52')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f')});db[_0x8395('0x52')]['belongsTo'](db[_0x8395('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8395('0x52')][_0x8395('0x126')](db['User'],{'as':'Agents','through':_0x8395('0x147')});db[_0x8395('0x53')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':'restrict'});db[_0x8395('0x53')][_0x8395('0x153')](db[_0x8395('0x58')],{'onDelete':_0x8395('0x16a')});db['SmsApplication'][_0x8395('0x153')](db['SmsAccount'],{'onDelete':_0x8395('0x16a')});db['SmsApplication'][_0x8395('0x153')](db[_0x8395('0x86')],{'onDelete':'restrict','foreignKey':_0x8395('0x156')});db[_0x8395('0x53')][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db[_0x8395('0x55')][_0x8395('0x11a')](db[_0x8395('0x57')],{'as':_0x8395('0x15d'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x8395('0x55')][_0x8395('0x153')](db[_0x8395('0x52')],{'as':'Account','foreignKey':_0x8395('0x18b')});db[_0x8395('0x55')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':'Contact','foreignKey':_0x8395('0x165')});db[_0x8395('0x55')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x55')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x18c'),'as':_0x8395('0x18d')});db[_0x8395('0x55')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':'sms_interaction_has_tags','as':_0x8395('0x17a')});db[_0x8395('0x55')]['belongsToMany'](db['User'],{'as':_0x8395('0x186'),'through':_0x8395('0x133'),'foreignKey':_0x8395('0x18e')});db[_0x8395('0x57')]['belongsTo'](db[_0x8395('0x11')],{'as':_0x8395('0x11')});db['SmsMessage'][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x57')][_0x8395('0x153')](db['SmsInteraction'],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x187'),'foreignKey':_0x8395('0x18e')});db[_0x8395('0x57')][_0x8395('0x153')](db[_0x8395('0x52')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x18b')});db[_0x8395('0x58')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x8395('0x58')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x18f'),'as':_0x8395('0x175')});db[_0x8395('0x5a')]['hasMany'](db['Disposition'],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x190'),'onDelete':_0x8395('0x117')});db[_0x8395('0x5a')][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0x8395('0x5a')]['hasMany'](db[_0x8395('0x5e')],{'as':'Interactions','foreignKey':_0x8395('0x190')});db['OpenchannelAccount'][_0x8395('0x11a')](db[_0x8395('0x60')],{'as':_0x8395('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0x8395('0x5a')][_0x8395('0x11a')](db[_0x8395('0x5c')],{'as':'Applications','foreignKey':_0x8395('0x190'),'onDelete':'cascade'});db[_0x8395('0x5a')][_0x8395('0x153')](db['CmList'],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x5a')][_0x8395('0x153')](db['Pause'],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x5a')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x8395('0x5c')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x5c')][_0x8395('0x153')](db[_0x8395('0x13d')],{'onDelete':'restrict','foreignKey':_0x8395('0x191')});db[_0x8395('0x5c')][_0x8395('0x153')](db['OpenchannelAccount'],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x190')});db[_0x8395('0x5c')][_0x8395('0x153')](db[_0x8395('0x86')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x156')});db['OpenchannelApplication'][_0x8395('0x153')](db['Tag'],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db['OpenchannelInteraction'][_0x8395('0x11a')](db['OpenchannelMessage'],{'as':_0x8395('0x15d'),'onDelete':'cascade','foreignKey':_0x8395('0x192')});db[_0x8395('0x5e')]['belongsTo'](db[_0x8395('0x5a')],{'as':'Account','foreignKey':_0x8395('0x190')});db[_0x8395('0x5e')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x5e')][_0x8395('0x153')](db['User'],{'as':'Owner','foreignKey':_0x8395('0x118')});db[_0x8395('0x5e')]['belongsToMany'](db[_0x8395('0x8f')],{'through':_0x8395('0x193'),'as':_0x8395('0x18d')});db[_0x8395('0x5e')][_0x8395('0x126')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x8395('0x17a')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':'user_has_openchannel_interactions','foreignKey':_0x8395('0x192')});db['OpenchannelMessage'][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x11')});db[_0x8395('0x60')][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x60')][_0x8395('0x153')](db[_0x8395('0x5e')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x187'),'foreignKey':'OpenchannelInteractionId'});db[_0x8395('0x60')][_0x8395('0x153')](db['Attachment'],{'as':'Attachment','foreignKey':_0x8395('0x188')});db[_0x8395('0x60')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x190')});db[_0x8395('0x13d')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x36'),'foreignKey':_0x8395('0x191')});db[_0x8395('0x13d')][_0x8395('0x126')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x8395('0x175')});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x82')],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x194'),'onDelete':_0x8395('0x117')});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x6e')],{'as':_0x8395('0x195')});db[_0x8395('0x62')]['hasMany'](db[_0x8395('0x66')],{'as':'Interactions'});db[_0x8395('0x62')]['hasMany'](db[_0x8395('0x196')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x194'),'onDelete':'cascade'});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x68')],{'as':_0x8395('0x15d')});db['ChatWebsite'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x62')]['belongsTo'](db[_0x8395('0x86')],{'as':_0x8395('0x86'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x62')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db['ChatWebsite'][_0x8395('0x153')](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x8395('0x159'),'through':_0x8395('0x197')});db[_0x8395('0x63')]['belongsTo'](db['OpenchannelAccount'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x63')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['OpenchannelQueueReport'][_0x8395('0x153')](db[_0x8395('0x5e')],{});db[_0x8395('0x63')][_0x8395('0x153')](db[_0x8395('0x60')],{});db[_0x8395('0x63')][_0x8395('0x153')](db['User'],{});db[_0x8395('0x63')][_0x8395('0x153')](db[_0x8395('0x13d')],{});db[_0x8395('0x196')][_0x8395('0x153')](db['User'],{'as':_0x8395('0x198'),'foreignKey':_0x8395('0x118'),'onDelete':_0x8395('0x16a')});db['ChatApplication'][_0x8395('0x153')](db[_0x8395('0x13a')],{'as':_0x8395('0x199'),'foreignKey':_0x8395('0x19a'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x196')]['belongsTo'](db['ChatWebsite'],{'as':_0x8395('0x19b'),'foreignKey':_0x8395('0x194'),'onDelete':'restrict'});db['ChatApplication'][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db['ChatInteraction'][_0x8395('0x11a')](db['ChatMessage'],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x19c')});db[_0x8395('0x66')]['belongsTo'](db[_0x8395('0x62')],{'as':'Account','foreignKey':_0x8395('0x194')});db[_0x8395('0x66')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['ChatInteraction'][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x66')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x19d'),'as':_0x8395('0x18d')});db[_0x8395('0x66')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x19d'),'as':_0x8395('0x17a')});db[_0x8395('0x66')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':_0x8395('0x131'),'foreignKey':_0x8395('0x19c')});db[_0x8395('0x68')]['belongsTo'](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x11')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0x66')],{'onDelete':'cascade','as':_0x8395('0x187'),'foreignKey':_0x8395('0x19c')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0xf1')],{'as':_0x8395('0xf1'),'foreignKey':_0x8395('0x188')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0x62')],{'as':'Account','foreignKey':_0x8395('0x194')});db[_0x8395('0x6a')][_0x8395('0x11a')](db[_0x8395('0xf1')],{'as':_0x8395('0x17b'),'foreignKey':_0x8395('0x17c'),'onDelete':_0x8395('0x117'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['ChatOfflineMessage']['belongsTo'](db[_0x8395('0x62')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x194')});db[_0x8395('0x13a')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x2e'),'hooks':!![]});db[_0x8395('0x13a')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x8395('0x6d')][_0x8395('0x11a')](db[_0x8395('0xd7')],{'as':_0x8395('0x15d'),'foreignKey':_0x8395('0x19e'),'onDelete':_0x8395('0x117')});db['ChatGroup'][_0x8395('0x126')](db['User'],{'as':_0x8395('0x14e'),'through':_0x8395('0x128')});db['ChatProactiveAction'][_0x8395('0x153')](db[_0x8395('0x62')],{'as':_0x8395('0x19b'),'foreignKey':_0x8395('0x194')});db[_0x8395('0x6f')][_0x8395('0x11a')](db[_0x8395('0x129')],{'as':'Contacts','foreignKey':_0x8395('0x19f')});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x92')],{'as':'Phones','foreignKey':_0x8395('0x1a0')});db[_0x8395('0x129')][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':_0x8395('0x125'),'foreignKey':'ContactId'});db[_0x8395('0x129')][_0x8395('0x11a')](db['CmHopperFinal'],{'as':_0x8395('0x11c'),'foreignKey':_0x8395('0x165')});db['CmContact'][_0x8395('0x11a')](db['CmHopperHistory'],{'as':_0x8395('0x150'),'foreignKey':'ContactId'});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x79')],{'as':_0x8395('0x79'),'foreignKey':_0x8395('0x165')});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x1a1')],{'as':_0x8395('0x1a2'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x129')][_0x8395('0x11a')](db[_0x8395('0x5e')],{'as':_0x8395('0x11e'),'foreignKey':_0x8395('0x165'),'onDelete':'restrict'});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x66')],{'as':_0x8395('0x130'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x129')]['hasMany'](db['SmsInteraction'],{'as':_0x8395('0x11f'),'foreignKey':'ContactId','onDelete':_0x8395('0x16a')});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x4c')],{'as':_0x8395('0x120'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x129')][_0x8395('0x11a')](db[_0x8395('0x41')],{'as':_0x8395('0x121'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x129')][_0x8395('0x153')](db[_0x8395('0x6f')],{'as':'Company','foreignKey':_0x8395('0x19f')});db[_0x8395('0x129')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':'ListId','onDelete':_0x8395('0x117')});db['CmContact'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':_0x8395('0x12b')});db[_0x8395('0x129')]['belongsToMany'](db[_0x8395('0x8f')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x8395('0x129')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1a3'),'as':'ThroughTags'});db[_0x8395('0x72')][_0x8395('0x11a')](db['CmHopperAdditionalPhone'],{'as':_0x8395('0x1a4'),'foreignKey':_0x8395('0x1a5')});db['CmHopper']['belongsTo'](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x117')});db[_0x8395('0x72')]['belongsTo'](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f'),'onDelete':_0x8395('0x117')});db[_0x8395('0x72')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':'Agent','foreignKey':_0x8395('0x118')});db[_0x8395('0x72')][_0x8395('0x153')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x8395('0x14f'),'onDelete':'cascade'});db[_0x8395('0x72')][_0x8395('0x153')](db['Campaign'],{'as':_0x8395('0x1a6'),'foreignKey':'CampaignId','onDelete':_0x8395('0x117')});db[_0x8395('0x72')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x1a7')});db[_0x8395('0x73')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':'ContactId','onDelete':_0x8395('0x117')});db[_0x8395('0x73')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':'ListId','onDelete':_0x8395('0x117')});db[_0x8395('0x73')][_0x8395('0x153')](db[_0x8395('0x19')],{'as':_0x8395('0x199'),'foreignKey':_0x8395('0x14f'),'onDelete':_0x8395('0x117')});db[_0x8395('0x73')][_0x8395('0x153')](db['Campaign'],{'as':_0x8395('0x1a6'),'foreignKey':_0x8395('0x1a8'),'onDelete':_0x8395('0x117')});db[_0x8395('0x7e')][_0x8395('0x11a')](db[_0x8395('0x84')],{'as':{'plural':_0x8395('0x1a9'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x8395('0x7e')]['hasMany'](db[_0x8395('0x84')],{'as':{'plural':_0x8395('0x1aa'),'singular':_0x8395('0x1ab')},'foreignKey':'AutomationAnyId','onDelete':_0x8395('0x117'),'hooks':!![]});db['Automation'][_0x8395('0x11a')](db[_0x8395('0x1ac')],{'as':'Actions','foreignKey':_0x8395('0x1ad'),'onDelete':_0x8395('0x117'),'hooks':!![]});db[_0x8395('0x82')][_0x8395('0x11a')](db['Disposition'],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x1ae'),'onDelete':_0x8395('0x117')});db['Interval'][_0x8395('0x11a')](db[_0x8395('0x86')],{'as':_0x8395('0x1af'),'foreignKey':_0x8395('0x156'),'onDelete':_0x8395('0x117'),'hooks':!![],'required':![]});db[_0x8395('0x86')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x8395('0x156'),'onDelete':'restrict'});db[_0x8395('0x86')][_0x8395('0x11a')](db[_0x8395('0x170')],{'as':_0x8395('0x1b0'),'foreignKey':_0x8395('0x156')});db['Interval'][_0x8395('0x11a')](db[_0x8395('0x196')],{'as':_0x8395('0x1b1'),'foreignKey':_0x8395('0x156')});db['Interval'][_0x8395('0x11a')](db[_0x8395('0x4a')],{'as':_0x8395('0x1b2'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x86')][_0x8395('0x11a')](db[_0x8395('0x53')],{'as':_0x8395('0x1b3'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x8d')][_0x8395('0x153')](db[_0x8395('0x3d')],{});db[_0x8395('0x8d')][_0x8395('0x153')](db[_0x8395('0x9e')],{'foreignKey':_0x8395('0x1b4')});db['Schedule'][_0x8395('0x153')](db[_0x8395('0x9c')],{'foreignKey':_0x8395('0x1b5')});db[_0x8395('0x14c')]['belongsToMany'](db[_0x8395('0x18')],{'as':_0x8395('0x1b6'),'through':_0x8395('0x1b7'),'onDelete':'restrict'});db[_0x8395('0x8f')][_0x8395('0x126')](db['CmContact'],{'through':_0x8395('0x1a3')});db[_0x8395('0x8f')][_0x8395('0x126')](db['ChatInteraction'],{'through':_0x8395('0x19d')});db[_0x8395('0x8f')][_0x8395('0x126')](db[_0x8395('0x41')],{'through':_0x8395('0x179')});db[_0x8395('0x8f')][_0x8395('0x126')](db['SmsInteraction'],{'through':_0x8395('0x18c')});db[_0x8395('0x8f')][_0x8395('0x126')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x8395('0x8f')]['belongsToMany'](db[_0x8395('0x5e')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x8395('0x126')](db[_0x8395('0x105')],{'through':_0x8395('0x1b8')});db[_0x8395('0x92')]['belongsTo'](db[_0x8395('0x91')],{'as':_0x8395('0x1b9'),'foreignKey':_0x8395('0x1ba')});db[_0x8395('0x1bb')][_0x8395('0x153')](db[_0x8395('0x72')],{'as':_0x8395('0x1bc'),'foreignKey':_0x8395('0x1a5')});db[_0x8395('0x92')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x1a0')});db[_0x8395('0x1bd')]['hasMany'](db[_0x8395('0x84')],{'as':{'plural':_0x8395('0x1be'),'singular':_0x8395('0x1bf')},'foreignKey':'TriggerAllId','onDelete':_0x8395('0x117'),'hooks':!![]});db[_0x8395('0x1bd')][_0x8395('0x11a')](db['Condition'],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x8395('0x1c0'),'onDelete':_0x8395('0x117'),'hooks':!![]});db[_0x8395('0x1bd')][_0x8395('0x11a')](db[_0x8395('0x1ac')],{'as':_0x8395('0x1c1'),'foreignKey':_0x8395('0x1c2'),'onDelete':_0x8395('0x117'),'hooks':!![]});db['AnalyticCustomReport'][_0x8395('0x11a')](db[_0x8395('0x1c3')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1b5'),'hooks':!![]});db[_0x8395('0x9e')]['hasMany'](db[_0x8395('0x1c3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8395('0x1b4')});db[_0x8395('0xa2')][_0x8395('0x11a')](db[_0x8395('0x1c3')],{'as':_0x8395('0x1c4'),'onDelete':'cascade','foreignKey':_0x8395('0x1c5')});db['AnalyticFieldReport'][_0x8395('0x153')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x8395('0xa6')][_0x8395('0x11a')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db['SalesforceConfiguration']['hasMany'](db[_0x8395('0xaa')],{'as':_0x8395('0x1c7'),'onDelete':_0x8395('0x117'),'foreignKey':'SubjectId'});db[_0x8395('0xa8')]['hasMany'](db[_0x8395('0xaa')],{'as':'Descriptions','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xa8')][_0x8395('0x11a')](db[_0x8395('0xaa')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xa8')][_0x8395('0x153')](db[_0x8395('0xa6')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xaa')]['hasMany'](db['SalesforceField'],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db[_0x8395('0xaa')]['hasMany'](db[_0x8395('0xaa')],{'as':_0x8395('0x1cb'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x8395('0x11a')](db[_0x8395('0xaa')],{'as':'Field','foreignKey':_0x8395('0x1c9')});db[_0x8395('0xaa')][_0x8395('0x153')](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db[_0x8395('0xac')][_0x8395('0x11a')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x8395('0x11a')](db['SugarcrmField'],{'as':_0x8395('0x1c7'),'onDelete':'cascade','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xad')][_0x8395('0x11a')](db['SugarcrmField'],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db['SugarcrmConfiguration'][_0x8395('0x11a')](db[_0x8395('0xaf')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xad')][_0x8395('0x153')](db[_0x8395('0xac')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xaf')]['hasMany'](db[_0x8395('0xaf')],{'as':'Subject','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xaf')][_0x8395('0x11a')](db[_0x8395('0xaf')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xaf')][_0x8395('0x11a')](db[_0x8395('0xaf')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xaf')]['belongsTo'](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['DeskAccount'][_0x8395('0x11a')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb3')][_0x8395('0x11a')](db['DeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8395('0x1ce')});db['DeskConfiguration'][_0x8395('0x11a')](db[_0x8395('0xb4')],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xb3')][_0x8395('0x11a')](db['DeskField'],{'as':_0x8395('0x1c4'),'onDelete':'cascade','foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb3')]['belongsTo'](db[_0x8395('0xb1')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb3')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1d1')});db[_0x8395('0xb4')][_0x8395('0x11a')](db['DeskField'],{'as':'Subject','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xb4')][_0x8395('0x11a')](db[_0x8395('0xb4')],{'as':'Description','foreignKey':_0x8395('0x1c8')});db[_0x8395('0xb4')]['hasMany'](db[_0x8395('0xb4')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb4')][_0x8395('0x153')](db[_0x8395('0x1cc')],{'as':'Variable','foreignKey':_0x8395('0x1cd')});db[_0x8395('0x1d2')][_0x8395('0x11a')](db[_0x8395('0x1d3')],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1c7'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0x1d3')][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1d3')][_0x8395('0x11a')](db['ZohoField'],{'as':'Fields','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1d3')][_0x8395('0x153')](db[_0x8395('0x1d2')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb6')]['hasMany'](db[_0x8395('0xb6')],{'as':_0x8395('0x1ca'),'foreignKey':_0x8395('0x1ce')});db['ZohoField'][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db['ZohoField'][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb6')][_0x8395('0x153')](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db[_0x8395('0x1d4')][_0x8395('0x11a')](db[_0x8395('0xb9')],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb9')]['hasMany'](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xb9')][_0x8395('0x11a')](db[_0x8395('0xbb')],{'as':_0x8395('0x1cf'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xb9')][_0x8395('0x11a')](db[_0x8395('0xbb')],{'as':'Fields','foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb9')][_0x8395('0x153')](db[_0x8395('0x1d4')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db['ZendeskConfiguration'][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1d5')});db['ZendeskField']['hasMany'](db[_0x8395('0xbb')],{'as':'Subject','foreignKey':_0x8395('0x1ce')});db['ZendeskField'][_0x8395('0x11a')](db[_0x8395('0xbb')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db['ZendeskField']['hasMany'](db[_0x8395('0xbb')],{'as':'Field','foreignKey':'FieldId'});db[_0x8395('0xbb')][_0x8395('0x153')](db['Variable'],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db[_0x8395('0xbd')][_0x8395('0x11a')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8395('0x1c6')});db[_0x8395('0x1d6')][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1c7'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0x1d6')][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db['FreshdeskConfiguration']['hasMany'](db[_0x8395('0xc0')],{'as':_0x8395('0x1c4'),'onDelete':'cascade','foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1d6')][_0x8395('0x153')](db[_0x8395('0xbd')],{'as':_0x8395('0x177'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1d7')});db[_0x8395('0xc0')][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1cb'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1d0'),'foreignKey':'FieldId'});db[_0x8395('0xc0')]['belongsTo'](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['VtigerAccount'][_0x8395('0x11a')](db['VtigerConfiguration'],{'as':_0x8395('0x1d8'),'onDelete':'cascade','foreignKey':_0x8395('0x1c6')});db[_0x8395('0x1d9')]['hasMany'](db[_0x8395('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x8395('0x1d9')][_0x8395('0x11a')](db[_0x8395('0xc4')],{'as':_0x8395('0x1cf'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1d9')]['hasMany'](db[_0x8395('0xc4')],{'as':_0x8395('0x1c4'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1d9')]['belongsTo'](db[_0x8395('0xc1')],{'as':'Account','foreignKey':_0x8395('0x1c6')});db[_0x8395('0xc4')]['hasMany'](db[_0x8395('0xc4')],{'as':_0x8395('0x1ca'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0xc4')][_0x8395('0x11a')](db[_0x8395('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8395('0xc4')][_0x8395('0x11a')](db[_0x8395('0xc4')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xc4')][_0x8395('0x153')](db['Variable'],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['ServicenowAccount'][_0x8395('0x11a')](db[_0x8395('0xc7')],{'as':_0x8395('0x1d8'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db['ServicenowConfiguration']['hasMany'](db[_0x8395('0xc9')],{'as':_0x8395('0x1c7'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0xc7')][_0x8395('0x11a')](db[_0x8395('0xc9')],{'as':_0x8395('0x1cf'),'foreignKey':_0x8395('0x1c8')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x8395('0x1c4'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xc7')][_0x8395('0x153')](db[_0x8395('0xc6')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xc9')][_0x8395('0x11a')](db['ServicenowField'],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x8395('0x11a')](db[_0x8395('0xc9')],{'as':_0x8395('0x1cb'),'foreignKey':'DescriptionId'});db[_0x8395('0xc9')][_0x8395('0x11a')](db[_0x8395('0xc9')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db['ServicenowField'][_0x8395('0x153')](db['Variable'],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['Dynamics365Account'][_0x8395('0x11a')](db[_0x8395('0x1da')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8395('0x1c6')});db[_0x8395('0xcb')]['belongsTo'](db['CloudProvider'],{'as':_0x8395('0x168'),'foreignKey':_0x8395('0x169')});db[_0x8395('0x1da')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x8395('0x117'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1da')][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1da')][_0x8395('0x153')](db[_0x8395('0xcb')],{'as':'Account','foreignKey':_0x8395('0x1c6')});db[_0x8395('0x1db')]['hasMany'](db[_0x8395('0x1db')],{'as':_0x8395('0x1ca'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0x1db')][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1db')][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db['Dynamics365Field']['belongsTo'](db[_0x8395('0x1cc')],{'as':'Variable','foreignKey':_0x8395('0x1cd')});db[_0x8395('0xce')]['hasMany'](db[_0x8395('0xd0')],{'as':_0x8395('0x1d8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8395('0xd0')]['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1c7'),'foreignKey':'SubjectId'});db[_0x8395('0xd0')][_0x8395('0x11a')](db[_0x8395('0x1dc')],{'as':_0x8395('0x1cf'),'foreignKey':'DescriptionId'});db[_0x8395('0xd0')]['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1c4'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xd0')]['belongsTo'](db[_0x8395('0xce')],{'as':_0x8395('0x177'),'foreignKey':'AccountId'});db['FreshsalesField']['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x8395('0x11a')](db[_0x8395('0x1dc')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db['FreshsalesField']['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1dc')][_0x8395('0x153')](db['Variable'],{'as':'Variable','foreignKey':_0x8395('0x1cd')});db['ChatQueueReport']['belongsTo'](db[_0x8395('0x62')],{});db[_0x8395('0xd5')][_0x8395('0x153')](db['CmList'],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db['ChatQueueReport'][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0x8395('0x153')](db[_0x8395('0x66')],{});db[_0x8395('0xd5')][_0x8395('0x153')](db[_0x8395('0x68')],{});db['ChatQueueReport'][_0x8395('0x153')](db[_0x8395('0x11')],{});db[_0x8395('0xd5')][_0x8395('0x153')](db[_0x8395('0x13a')],{});db[_0x8395('0xd7')][_0x8395('0x153')](db['User'],{'onDelete':'cascade','foreignKey':_0x8395('0x1dd')});db[_0x8395('0xd7')]['belongsTo'](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1de')});db[_0x8395('0x1a1')]['hasMany'](db[_0x8395('0xdb')],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport'][_0x8395('0x11a')](db[_0x8395('0xd9')],{'foreignKey':'SessionId','onDelete':_0x8395('0x117')});db[_0x8395('0xdd')][_0x8395('0x153')](db['SmsAccount'],{});db['SmsQueueReport'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0xdd')]['belongsTo'](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0xdd')][_0x8395('0x153')](db['SmsInteraction'],{});db[_0x8395('0xdd')][_0x8395('0x153')](db[_0x8395('0x57')],{});db[_0x8395('0xdd')][_0x8395('0x153')](db['User'],{});db[_0x8395('0xdd')][_0x8395('0x153')](db['SmsQueue'],{});db[_0x8395('0xe1')]['hasMany'](db[_0x8395('0x1a1')],{'foreignKey':'ProjectId'});db[_0x8395('0xe1')]['hasMany'](db[_0x8395('0xdb')],{'foreignKey':_0x8395('0x1df')});db[_0x8395('0xe1')][_0x8395('0x11a')](db[_0x8395('0xd9')],{'foreignKey':_0x8395('0x1df')});db['Team']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x1e0')});db[_0x8395('0x12e')]['belongsToMany'](db[_0x8395('0x19')],{'through':_0x8395('0x15a'),'as':_0x8395('0x136')});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x3f')],{'through':_0x8395('0x1e1'),'as':_0x8395('0x139')});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x13a')],{'through':_0x8395('0x1e2'),'as':'ChatQueues'});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x50')],{'through':_0x8395('0x189'),'as':_0x8395('0x13b')});db[_0x8395('0x12e')]['belongsToMany'](db[_0x8395('0x58')],{'through':_0x8395('0x18f'),'as':_0x8395('0x13c')});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x13d')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x13e')],{'through':_0x8395('0x1e3'),'as':'WhatsappQueues'});db['Team'][_0x8395('0x126')](db[_0x8395('0x137')],{'through':_0x8395('0x10f'),'as':_0x8395('0x1e4')});db['Campaign'][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':'Hoppers','foreignKey':_0x8395('0x1a8')});db['Campaign']['hasMany'](db[_0x8395('0x75')],{'as':'HopperFinals','foreignKey':_0x8395('0x1a8')});db[_0x8395('0x1a6')]['hasMany'](db[_0x8395('0x77')],{'as':'HopperHistories','foreignKey':_0x8395('0x1a8')});db[_0x8395('0x1a6')][_0x8395('0x11a')](db[_0x8395('0x73')],{'as':_0x8395('0x151'),'foreignKey':'CampaignId'});db[_0x8395('0x1a6')]['belongsTo'](db[_0x8395('0x27')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x8395('0x1a6')]['belongsTo'](db[_0x8395('0x27')],{'as':_0x8395('0x154'),'foreignKey':_0x8395('0x155')});db[_0x8395('0x1a6')]['belongsTo'](db['Interval'],{'as':_0x8395('0x86'),'foreignKey':_0x8395('0x156')});db['Campaign'][_0x8395('0x153')](db['SquareProject'],{'as':_0x8395('0xe6'),'foreignKey':'SquareProjectId'});db[_0x8395('0x1a6')]['belongsToMany'](db[_0x8395('0x12c')],{'as':_0x8395('0x158'),'through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0x8395('0x12c')],{'as':'BlackLists','through':_0x8395('0x1e5')});db[_0x8395('0xf1')][_0x8395('0x153')](db[_0x8395('0x6a')],{'as':_0x8395('0x6a'),'foreignKey':_0x8395('0x17c')});db[_0x8395('0xf4')][_0x8395('0x153')](db['MailMessage'],{});db[_0x8395('0xf4')][_0x8395('0x153')](db[_0x8395('0x41')],{});db['MailTransferReport'][_0x8395('0x153')](db[_0x8395('0x3d')],{'foreignKey':'FromMailAccountId','as':_0x8395('0x1e6')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db['MailTransferReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e9'),'as':_0x8395('0x1ea')});db['MailTransferReport'][_0x8395('0x153')](db[_0x8395('0x3f')],{'foreignKey':_0x8395('0x1eb'),'as':_0x8395('0x1ec')});db[_0x8395('0xf4')]['belongsTo'](db[_0x8395('0x3d')],{'foreignKey':_0x8395('0x1ed'),'as':_0x8395('0x1ee')});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x68')],{});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x66')],{});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x62')],{'foreignKey':_0x8395('0x1ef'),'as':'FromAccount'});db[_0x8395('0xf5')]['belongsTo'](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db[_0x8395('0xf5')]['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e9'),'as':'ToAgent'});db[_0x8395('0xf5')][_0x8395('0x153')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x62')],{'foreignKey':_0x8395('0x1f0'),'as':_0x8395('0x1ee')});db[_0x8395('0xf7')][_0x8395('0x153')](db[_0x8395('0x4e')],{});db['FaxTransferReport'][_0x8395('0x153')](db[_0x8395('0x4c')],{});db[_0x8395('0xf7')][_0x8395('0x153')](db[_0x8395('0x140')],{'foreignKey':'FromFaxAccountId','as':_0x8395('0x1e6')});db[_0x8395('0xf7')][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db[_0x8395('0xf7')]['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e9'),'as':'ToAgent'});db[_0x8395('0xf7')]['belongsTo'](db[_0x8395('0x50')],{'foreignKey':_0x8395('0x1f1'),'as':_0x8395('0x1ec')});db[_0x8395('0xf7')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x8395('0x1f2'),'as':_0x8395('0x1ee')});db[_0x8395('0xf9')][_0x8395('0x153')](db['OpenchannelMessage'],{});db[_0x8395('0xf9')][_0x8395('0x153')](db[_0x8395('0x5e')],{});db[_0x8395('0xf9')][_0x8395('0x153')](db[_0x8395('0x5a')],{'foreignKey':_0x8395('0x1f3'),'as':_0x8395('0x1e6')});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e9'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x13d')],{'foreignKey':_0x8395('0x1f4'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x5a')],{'foreignKey':_0x8395('0x1f5'),'as':_0x8395('0x1ee')});db[_0x8395('0x1f6')][_0x8395('0x153')](db['SmsMessage'],{});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x55')],{});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x52')],{'foreignKey':_0x8395('0x1f7'),'as':_0x8395('0x1e6')});db['SmsTransferReport'][_0x8395('0x153')](db['User'],{'foreignKey':'FromUserId','as':_0x8395('0x1e8')});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e9'),'as':_0x8395('0x1ea')});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x58')],{'foreignKey':_0x8395('0x1f8'),'as':_0x8395('0x1ec')});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x52')],{'foreignKey':'ToSmsAccountId','as':_0x8395('0x1ee')});db[_0x8395('0x12c')][_0x8395('0x11a')](db['Disposition'],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x17f'),'onDelete':_0x8395('0x117')});db[_0x8395('0x12c')][_0x8395('0x11a')](db[_0x8395('0x7b')],{'as':'CustomFields','foreignKey':_0x8395('0x17f')});db[_0x8395('0x12c')][_0x8395('0x11a')](db[_0x8395('0x129')],{'as':_0x8395('0x12a'),'onDelete':_0x8395('0x117'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x8395('0x75')],{'as':_0x8395('0x11c'),'foreignKey':_0x8395('0x17f')});db['CmList']['hasMany'](db[_0x8395('0x77')],{'as':'HopperHistory','foreignKey':_0x8395('0x17f')});db[_0x8395('0x12c')][_0x8395('0x11a')](db[_0x8395('0x79')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x8395('0x12c')][_0x8395('0x126')](db[_0x8395('0x19')],{'as':_0x8395('0x1f9'),'through':_0x8395('0x1fa')});db['CmList']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x12d')});db[_0x8395('0x137')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x8395('0x137')]['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x138')});db[_0x8395('0x137')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x10f'),'as':'Teams'});db[_0x8395('0xfc')][_0x8395('0x11a')](db[_0x8395('0x11')],{'as':'Users','foreignKey':'userProfileId'});db[_0x8395('0xfc')]['hasMany'](db[_0x8395('0xfe')],{'as':_0x8395('0x1fb'),'foreignKey':_0x8395('0x1fc'),'onDelete':_0x8395('0x117')});db[_0x8395('0xfe')]['hasMany'](db[_0x8395('0x100')],{'as':_0x8395('0x1fd'),'foreignKey':_0x8395('0x1fe'),'onDelete':'cascade'});db['WhatsappAccount'][_0x8395('0x11a')](db[_0x8395('0x82')],{'as':_0x8395('0x181'),'foreignKey':'WhatsappAccountId','onDelete':_0x8395('0x117')});db[_0x8395('0x1ff')]['hasMany'](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'WhatsappAccountId'});db[_0x8395('0x1ff')][_0x8395('0x11a')](db[_0x8395('0x107')],{'as':_0x8395('0x15d'),'foreignKey':_0x8395('0x200')});db[_0x8395('0x1ff')]['hasMany'](db[_0x8395('0x105')],{'as':'Interactions'});db[_0x8395('0x1ff')]['hasMany'](db[_0x8395('0x201')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x200'),'onDelete':_0x8395('0x117')});db['WhatsappAccount'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db['WhatsappAccount'][_0x8395('0x153')](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x1ff')][_0x8395('0x126')](db['User'],{'as':_0x8395('0x159'),'through':_0x8395('0x202')});db['WhatsappApplication'][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x8395('0x153')](db[_0x8395('0x13e')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x201')][_0x8395('0x153')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x8395('0x201')][_0x8395('0x153')](db['Interval'],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x201')][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db[_0x8395('0x105')]['hasMany'](db[_0x8395('0x107')],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x203')});db[_0x8395('0x105')]['belongsTo'](db['WhatsappAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x200')});db[_0x8395('0x105')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':'ContactId'});db[_0x8395('0x105')][_0x8395('0x153')](db['User'],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x105')][_0x8395('0x126')](db['Tag'],{'through':_0x8395('0x1b8'),'as':'Tags'});db[_0x8395('0x105')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1b8'),'as':_0x8395('0x17a')});db[_0x8395('0x105')][_0x8395('0x126')](db['User'],{'as':_0x8395('0x186'),'through':_0x8395('0x135'),'foreignKey':_0x8395('0x203')});db[_0x8395('0x107')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':'User'});db[_0x8395('0x107')][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x107')][_0x8395('0x153')](db[_0x8395('0x105')],{'onDelete':_0x8395('0x117'),'as':'Interaction','foreignKey':_0x8395('0x203')});db[_0x8395('0x107')][_0x8395('0x153')](db['WhatsappAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x200')});db[_0x8395('0x109')][_0x8395('0x153')](db['WhatsappAccount'],{});db[_0x8395('0x109')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0x8395('0x153')](db['CmContact'],{'as':_0x8395('0x164'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x8395('0x153')](db[_0x8395('0x105')],{});db[_0x8395('0x109')][_0x8395('0x153')](db[_0x8395('0x13e')],{});db[_0x8395('0x109')][_0x8395('0x153')](db[_0x8395('0x107')],{});db['WhatsappQueueReport'][_0x8395('0x153')](db[_0x8395('0x11')],{});db[_0x8395('0x10b')][_0x8395('0x153')](db['WhatsappMessage'],{});db[_0x8395('0x10b')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x8395('0x10b')][_0x8395('0x153')](db[_0x8395('0x1ff')],{'foreignKey':_0x8395('0x204'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x8395('0x153')](db[_0x8395('0x1ff')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db['WhatsappTransferReport'][_0x8395('0x153')](db[_0x8395('0x13e')],{'foreignKey':_0x8395('0x205'),'as':_0x8395('0x1ec')});db[_0x8395('0x10b')]['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e9'),'as':_0x8395('0x1ea')});db['WhatsappQueue'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':'UserWhatsappQueue','foreignKey':_0x8395('0x206')});db[_0x8395('0x13e')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x1e3'),'as':_0x8395('0x175')});db[_0x8395('0x112')]['belongsTo'](db['User'],{'as':_0x8395('0x207'),'foreignKey':'UserId','onDelete':_0x8395('0x117'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x8395('0xcb')],{'as':_0x8395('0xcb'),'onDelete':'restrict'});db['CloudProvider'][_0x8395('0x116')](db[_0x8395('0x167')],{'as':_0x8395('0x16b'),'onDelete':_0x8395('0x16a')});db['CloudProvider'][_0x8395('0x116')](db[_0x8395('0x3b')],{'as':'Smtp','onDelete':_0x8395('0x16a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x57e9=['ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','cascade','UserId','hasOne','userSetting','Recordings','hasMany','UserVoiceQueueRt','Extensions','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','Hoppers','SET\x20NULL','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteraction','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','MailAccountId','CloudProviderId','Imap','Smtp','Dispositions','CannedAnswer','MailMessage','Applications','List','ListId','TemplateId','user_has_mail_accounts','ContactId','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Interaction','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','Interactions','Exntensions','user_has_fax_accounts','FaxApplication','FaxInteractionId','Account','fax_interaction_has_tags','Tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','Answers','Owner','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','Phones','CmContactId','Company','AdditionalPhones','CmHopperId','OwnerId','CampaignId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Intervals','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','cm_contact_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmContactHasItem','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Fields','Subject','Description','DescriptionId','Field','SugarcrmConfiguration','FieldId','VariableId','Descriptions','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','ChatQueueReport','ChatInternalMessage','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToUserId','ToFaxAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','sequelize','lodash','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','Action','Automation','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model'];(function(_0x5eb83e,_0x386039){var _0x2ba972=function(_0x324087){while(--_0x324087){_0x5eb83e['push'](_0x5eb83e['shift']());}};_0x2ba972(++_0x386039);}(_0x57e9,0x150));var _0x957e=function(_0xd2e92f,_0x3740e6){_0xd2e92f=_0xd2e92f-0x0;var _0x324d31=_0x57e9[_0xd2e92f];return _0x324d31;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x957e('0x0'));var _=require(_0x957e('0x1'));var jstz=require('jstz');var timezone=jstz[_0x957e('0x2')]();config[_0x957e('0x0')]=_[_0x957e('0x3')](config[_0x957e('0x0')],{'database':'motion2','username':_0x957e('0x4'),'password':_0x957e('0x5'),'options':{'host':_0x957e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x957e('0x7')},'logging':![],'timezone':timezone[_0x957e('0x8')](),'define':{'charset':_0x957e('0x9'),'collate':_0x957e('0xa')}}});config[_0x957e('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x957e('0xc'),'username':_0x957e('0x4'),'password':_0x957e('0x5'),'options':{'host':_0x957e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x957e('0x8')](),'define':{'charset':'utf8','collate':_0x957e('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x957e('0x0')][_0x957e('0xd')],config['sequelize'][_0x957e('0xe')],config[_0x957e('0x0')][_0x957e('0xf')],config[_0x957e('0x0')][_0x957e('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x957e('0xb')][_0x957e('0xd')],config[_0x957e('0xb')][_0x957e('0xe')],config[_0x957e('0xb')][_0x957e('0xf')],config[_0x957e('0xb')][_0x957e('0x10')])};db['User']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x12'));db[_0x957e('0x13')]=db[_0x957e('0x0')]['import'](_0x957e('0x14'));db[_0x957e('0x15')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/voiceContext/voiceContext.model');db[_0x957e('0x16')]=db[_0x957e('0x0')]['import']('../api/voiceExtension/voiceExtension.model');db[_0x957e('0x17')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x18'));db[_0x957e('0x19')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x1a'));db[_0x957e('0x1b')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x1c'));db[_0x957e('0x1d')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x1e'));db[_0x957e('0x1f')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x20'));db[_0x957e('0x21')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x22'));db[_0x957e('0x23')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x24'));db['VoiceDialReport']=db[_0x957e('0x0')]['import'](_0x957e('0x25'));db['VoiceAgentReport']=db[_0x957e('0x0')][_0x957e('0x11')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x957e('0x26')]=db['sequelize'][_0x957e('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0x957e('0x11')](_0x957e('0x27'));db[_0x957e('0x28')]=db['sequelize'][_0x957e('0x11')](_0x957e('0x29'));db[_0x957e('0x2a')]=db['sequelize'][_0x957e('0x11')](_0x957e('0x2b'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0x957e('0x2c'));db[_0x957e('0x2d')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x957e('0x2e')]=db['sequelize']['import'](_0x957e('0x2f'));db[_0x957e('0x30')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/userMailQueue/userMailQueue.model');db[_0x957e('0x31')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x32'));db[_0x957e('0x33')]=db[_0x957e('0x0')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x957e('0x34')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x35'));db[_0x957e('0x36')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x957e('0x37')]=db['sequelize']['import'](_0x957e('0x38'));db[_0x957e('0x39')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x3a'));db[_0x957e('0x3b')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x3c'));db[_0x957e('0x3d')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x3e'));db[_0x957e('0x3f')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x40'));db[_0x957e('0x41')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x42'));db['MailMessage']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x43'));db[_0x957e('0x44')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x45'));db[_0x957e('0x46')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x47'));db[_0x957e('0x48')]=db[_0x957e('0x0')]['import'](_0x957e('0x49'));db[_0x957e('0x4a')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0x957e('0x4b')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x4c'));db['FaxApplication']=db[_0x957e('0x0')]['import'](_0x957e('0x4d'));db['FaxInteraction']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x4e'));db[_0x957e('0x4f')]=db[_0x957e('0x0')]['import'](_0x957e('0x50'));db[_0x957e('0x51')]=db['sequelize']['import'](_0x957e('0x52'));db['FaxQueueReport']=db[_0x957e('0x0')][_0x957e('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0x957e('0x53')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x54'));db[_0x957e('0x55')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/smsApplication/smsApplication.model');db[_0x957e('0x56')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x57'));db[_0x957e('0x58')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x59'));db['SmsQueue']=db['sequelize']['import'](_0x957e('0x5a'));db['OpenchannelAccount']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x5b'));db[_0x957e('0x5c')]=db[_0x957e('0x0')]['import'](_0x957e('0x5d'));db[_0x957e('0x5e')]=db[_0x957e('0x0')]['import'](_0x957e('0x5f'));db[_0x957e('0x60')]=db[_0x957e('0x0')]['import'](_0x957e('0x61'));db['OpenchannelQueue']=db['sequelize'][_0x957e('0x11')]('../api/openchannelQueue/openchannelQueue.model');db[_0x957e('0x62')]=db['sequelize'][_0x957e('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0x957e('0x63')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x64'));db[_0x957e('0x65')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/chatInteraction/chatInteraction.model');db[_0x957e('0x66')]=db['sequelize'][_0x957e('0x11')]('../api/chatMessage/chatMessage.model');db[_0x957e('0x67')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x957e('0x68')]=db['sequelize'][_0x957e('0x11')](_0x957e('0x69'));db['ChatGroup']=db[_0x957e('0x0')]['import']('../api/chatGroup/chatGroup.model');db[_0x957e('0x6a')]=db['sequelize']['import'](_0x957e('0x6b'));db[_0x957e('0x6c')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x6d'));db[_0x957e('0x6e')]=db[_0x957e('0x0')]['import'](_0x957e('0x6f'));db[_0x957e('0x70')]=db[_0x957e('0x0')]['import'](_0x957e('0x71'));db[_0x957e('0x72')]=db['sequelize'][_0x957e('0x11')](_0x957e('0x73'));db['CmHopperFinal']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x74'));db[_0x957e('0x75')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x957e('0x76')]=db[_0x957e('0x0')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x957e('0x77')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0x957e('0x78')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/action/action.model');db[_0x957e('0x79')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/automation/automation.model');db['CannedAnswer']=db[_0x957e('0x0')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x957e('0x7a')]=db[_0x957e('0x0')]['import'](_0x957e('0x7b'));db[_0x957e('0x7c')]=db['sequelize'][_0x957e('0x11')]('../api/condition/condition.model');db[_0x957e('0x7d')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x7e'));db[_0x957e('0x7f')]=db[_0x957e('0x0')]['import'](_0x957e('0x80'));db[_0x957e('0x81')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x82'));db[_0x957e('0x83')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x957e('0x84')]=db[_0x957e('0x0')]['import'](_0x957e('0x85'));db[_0x957e('0x86')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x87'));db[_0x957e('0x88')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x89'));db[_0x957e('0x8a')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x8b'));db['CmContactHasItem']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x8c'));db[_0x957e('0x8d')]=db['sequelize'][_0x957e('0x11')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x957e('0x8e')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/template/template.model');db[_0x957e('0x8f')]=db['sequelize']['import'](_0x957e('0x90'));db[_0x957e('0x91')]=db['sequelize'][_0x957e('0x11')](_0x957e('0x92'));db[_0x957e('0x93')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x94'));db[_0x957e('0x95')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x96'));db['AnalyticDefaultReport']=db[_0x957e('0x0')][_0x957e('0x11')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x957e('0x97')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x98'));db[_0x957e('0x99')]=db['sequelize'][_0x957e('0x11')](_0x957e('0x9a'));db[_0x957e('0x9b')]=db[_0x957e('0x0')]['import'](_0x957e('0x9c'));db[_0x957e('0x9d')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x957e('0x9e')]=db['sequelize']['import'](_0x957e('0x9f'));db[_0x957e('0xa0')]=db[_0x957e('0x0')]['import'](_0x957e('0xa1'));db[_0x957e('0xa2')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xa3'));db[_0x957e('0xa4')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xa5'));db['SugarcrmConfiguration']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xa6'));db[_0x957e('0xa7')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xa8'));db[_0x957e('0xa9')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xaa'));db[_0x957e('0xab')]=db[_0x957e('0x0')]['import'](_0x957e('0xac'));db[_0x957e('0xad')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xae'));db[_0x957e('0xaf')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xb0'));db[_0x957e('0xb1')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xb2'));db[_0x957e('0xb3')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xb4'));db[_0x957e('0xb5')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xb6'));db['ZendeskConfiguration']=db[_0x957e('0x0')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x957e('0xb7')]=db[_0x957e('0x0')]['import'](_0x957e('0xb8'));db['FreshdeskAccount']=db['sequelize'][_0x957e('0x11')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x957e('0xb9')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xba'));db[_0x957e('0xbb')]=db[_0x957e('0x0')]['import'](_0x957e('0xbc'));db[_0x957e('0xbd')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xbe'));db[_0x957e('0xbf')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xc0'));db['VtigerField']=db['sequelize'][_0x957e('0x11')](_0x957e('0xc1'));db['ServicenowAccount']=db['sequelize'][_0x957e('0x11')](_0x957e('0xc2'));db[_0x957e('0xc3')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xc4'));db[_0x957e('0xc5')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xc6'));db[_0x957e('0xc7')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x957e('0xc8')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xc9'));db[_0x957e('0xca')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xcb'));db[_0x957e('0xcc')]=db[_0x957e('0x0')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x957e('0xcd')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x957e('0xce')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xcf'));db[_0x957e('0x93')]=db[_0x957e('0x0')]['import'](_0x957e('0x94'));db[_0x957e('0xd0')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xd1'));db['ChatQueueReport']=db['sequelize']['import'](_0x957e('0xd2'));db['ChatInternalMessage']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xd3'));db['JscriptyAnswerReport']=db['sequelize'][_0x957e('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x957e('0x0')][_0x957e('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x957e('0xd4')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xd5'));db[_0x957e('0xd6')]=db[_0x957e('0x0')]['import'](_0x957e('0xd7'));db['SquareReport']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xd8'));db[_0x957e('0xd9')]=db['sequelize'][_0x957e('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0x957e('0xda')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xdb'));db['Setting']=db['sequelize']['import'](_0x957e('0xdc'));db[_0x957e('0xdd')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xde'));db[_0x957e('0xdf')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xe0'));db[_0x957e('0xe1')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xe2'));db[_0x957e('0xe3')]=db['sequelize']['import'](_0x957e('0xe4'));db[_0x957e('0xe5')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xe6'));db['License']=db[_0x957e('0x0')][_0x957e('0x11')]('../api/license/license.model');db[_0x957e('0xe7')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xe8'));db[_0x957e('0xe9')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xea'));db[_0x957e('0xeb')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xec'));db['Plugin']=db['sequelize']['import']('../api/plugin/plugin.model');db[_0x957e('0xed')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xee'));db['ChatTransferReport']=db['sequelize'][_0x957e('0x11')](_0x957e('0xef'));db[_0x957e('0xf0')]=db[_0x957e('0x0')]['import'](_0x957e('0xf1'));db[_0x957e('0xf2')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xf3'));db['SmsTransferReport']=db[_0x957e('0x0')]['import'](_0x957e('0xf4'));db[_0x957e('0xf5')]=db[_0x957e('0x0')]['import'](_0x957e('0xf6'));db[_0x957e('0xf7')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0xf8'));db[_0x957e('0xf9')]=db['sequelize']['import'](_0x957e('0xfa'));db[_0x957e('0xfb')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0x957e('0xfc')]=db['sequelize'][_0x957e('0x11')](_0x957e('0xfd'));db[_0x957e('0xfe')]=db[_0x957e('0x0')]['import'](_0x957e('0xff'));db[_0x957e('0x100')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x101'));db[_0x957e('0x102')]=db['sequelize'][_0x957e('0x11')]('../api/whatsappApplication/whatsappApplication.model');db[_0x957e('0x103')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x104'));db[_0x957e('0x105')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x106'));db['WhatsappQueueReport']=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x107'));db[_0x957e('0x108')]=db['sequelize'][_0x957e('0x11')](_0x957e('0x109'));db[_0x957e('0x10a')]=db[_0x957e('0x0')][_0x957e('0x11')]('../api/whatsappQueue/whatsappQueue.model');db[_0x957e('0x10b')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x10c'));db[_0x957e('0x10d')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x10e'));db[_0x957e('0x10f')]=db[_0x957e('0x0')]['import'](_0x957e('0x110'));db[_0x957e('0x111')]=db['sequelize']['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x957e('0x112')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x113'));db[_0x957e('0x114')]=db[_0x957e('0x0')][_0x957e('0x11')](_0x957e('0x115'));db[_0x957e('0x116')]['hasOne'](db[_0x957e('0x1f')],{'as':_0x957e('0x1f'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')][_0x957e('0x119')](db['UserSetting'],{'as':_0x957e('0x11a'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')]['hasMany'](db[_0x957e('0x1b')],{'as':_0x957e('0x11b'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')][_0x957e('0x11c')](db[_0x957e('0x11d')],{'as':'VoiceQueuesRt','foreignKey':_0x957e('0x118')});db[_0x957e('0x116')][_0x957e('0x11c')](db[_0x957e('0x16')],{'as':_0x957e('0x11e'),'onDelete':_0x957e('0x117'),'hooks':!![]});db[_0x957e('0x116')][_0x957e('0x11c')](db[_0x957e('0x11f')],{'as':_0x957e('0x120'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')][_0x957e('0x11c')](db[_0x957e('0x75')],{'as':'HopperHistory','foreignKey':_0x957e('0x118')});db[_0x957e('0x116')][_0x957e('0x11c')](db[_0x957e('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x957e('0x118')});db[_0x957e('0x116')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x957e('0x121'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')]['hasMany'](db['ChatInteraction'],{'as':_0x957e('0x122'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')][_0x957e('0x11c')](db['SmsInteraction'],{'as':_0x957e('0x123'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')][_0x957e('0x11c')](db['FaxInteraction'],{'as':_0x957e('0x124'),'foreignKey':'UserId'});db[_0x957e('0x116')]['hasMany'](db['MailInteraction'],{'as':_0x957e('0x125'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')]['hasMany'](db['WhatsappInteraction'],{'as':_0x957e('0x126'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x116')]['hasMany'](db[_0x957e('0xfe')],{'as':'UserNotifications','foreignKey':_0x957e('0x127')});db[_0x957e('0x116')]['hasMany'](db[_0x957e('0x70')],{'as':_0x957e('0x128'),'foreignKey':_0x957e('0x118'),'onDelete':_0x957e('0x129')});db[_0x957e('0x116')][_0x957e('0x12a')](db[_0x957e('0xf9')],{'as':_0x957e('0xf9'),'foreignKey':'userProfileId'});db['User'][_0x957e('0x12b')](db[_0x957e('0x12c')],{'as':_0x957e('0x12d'),'through':_0x957e('0x12e')});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x6e')],{'as':'Contacts','through':_0x957e('0x12f')});db['User']['belongsToMany'](db[_0x957e('0xf5')],{'as':'Lists','through':_0x957e('0x130')});db[_0x957e('0x116')][_0x957e('0x12b')](db['Team'],{'through':_0x957e('0x131')});db[_0x957e('0x116')]['belongsToMany'](db['MailInteraction'],{'as':_0x957e('0x125'),'through':_0x957e('0x132')});db[_0x957e('0x116')]['belongsToMany'](db[_0x957e('0x65')],{'as':'ChatInteractions','through':_0x957e('0x133')});db['User']['belongsToMany'](db[_0x957e('0x134')],{'as':_0x957e('0x124'),'through':'user_has_fax_interactions'});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x56')],{'as':'SmsInteractions','through':_0x957e('0x135')});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x5e')],{'as':_0x957e('0x121'),'through':_0x957e('0x136')});db[_0x957e('0x116')][_0x957e('0x12b')](db['WhatsappInteraction'],{'as':_0x957e('0x126'),'through':_0x957e('0x137')});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x19')],{'as':_0x957e('0x138'),'through':_0x957e('0x2d'),'required':![]});db[_0x957e('0x116')]['belongsToMany'](db[_0x957e('0xf7')],{'as':_0x957e('0x139'),'through':'UserVoicePrefix','required':![]});db[_0x957e('0x116')][_0x957e('0x12b')](db['MailQueue'],{'as':_0x957e('0x13a'),'through':_0x957e('0x30'),'required':![]});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x68')],{'as':_0x957e('0x13b'),'through':_0x957e('0x2e'),'required':![],'hooks':!![]});db['User'][_0x957e('0x12b')](db[_0x957e('0x51')],{'as':_0x957e('0x13c'),'through':_0x957e('0x31'),'required':![]});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x13d')],{'as':_0x957e('0x13e'),'through':_0x957e('0x33'),'required':![]});db[_0x957e('0x116')]['belongsToMany'](db[_0x957e('0x13f')],{'as':_0x957e('0x140'),'through':_0x957e('0x34'),'required':![]});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x10a')],{'as':_0x957e('0x141'),'through':'UserWhatsappQueue','required':![]});db[_0x957e('0x116')]['belongsToMany'](db[_0x957e('0xf5')],{'through':_0x957e('0x130')});db[_0x957e('0x116')]['belongsToMany'](db[_0x957e('0x62')],{'as':_0x957e('0x142'),'through':_0x957e('0x143')});db[_0x957e('0x116')][_0x957e('0x12b')](db['FaxAccount'],{'as':_0x957e('0x144'),'through':'user_has_fax_accounts'});db['User'][_0x957e('0x12b')](db[_0x957e('0x3b')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db['User'][_0x957e('0x12b')](db[_0x957e('0x145')],{'as':'OpenchannelAccounts','through':_0x957e('0x146')});db[_0x957e('0x116')][_0x957e('0x12b')](db['SmsAccount'],{'as':_0x957e('0x147'),'through':_0x957e('0x148')});db[_0x957e('0x116')][_0x957e('0x12b')](db[_0x957e('0x100')],{'as':_0x957e('0x149'),'through':_0x957e('0x14a')});db[_0x957e('0x13')][_0x957e('0x11c')](db[_0x957e('0x16')],{'as':_0x957e('0x14b'),'onDelete':_0x957e('0x117'),'foreignKey':'ChanSpyId'});db[_0x957e('0x15')]['hasMany'](db[_0x957e('0x16')],{'onDelete':_0x957e('0x117')});db[_0x957e('0x16')][_0x957e('0x11c')](db[_0x957e('0x16')],{'as':'Applications','onDelete':'cascade'});db[_0x957e('0x17')]['belongsToMany'](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db[_0x957e('0x19')][_0x957e('0x11c')](db[_0x957e('0x11d')],{'as':_0x957e('0x14c'),'foreignKey':'VoiceQueueId'});db[_0x957e('0x19')][_0x957e('0x11c')](db['CmHopper'],{'as':_0x957e('0x128'),'foreignKey':'VoiceQueueId'});db[_0x957e('0x19')][_0x957e('0x11c')](db[_0x957e('0x11f')],{'as':_0x957e('0x120'),'foreignKey':_0x957e('0x14d')});db[_0x957e('0x19')][_0x957e('0x11c')](db[_0x957e('0x75')],{'as':_0x957e('0x14e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x957e('0x11c')](db[_0x957e('0x76')],{'as':_0x957e('0x76'),'foreignKey':_0x957e('0x14d')});db[_0x957e('0x19')][_0x957e('0x11c')](db['CmHopperBlack'],{'as':_0x957e('0x14f'),'foreignKey':_0x957e('0x14d')});db[_0x957e('0x19')][_0x957e('0x11c')](db[_0x957e('0xd4')],{'as':_0x957e('0x150'),'foreignKey':_0x957e('0x14d')});db[_0x957e('0x19')][_0x957e('0x12a')](db[_0x957e('0x28')],{'as':_0x957e('0x28'),'foreignKey':_0x957e('0x151')});db[_0x957e('0x19')][_0x957e('0x12a')](db[_0x957e('0x28')],{'as':_0x957e('0x152'),'foreignKey':_0x957e('0x153')});db[_0x957e('0x19')][_0x957e('0x12a')](db['Interval'],{'as':_0x957e('0x7d'),'foreignKey':_0x957e('0x154')});db['VoiceQueue'][_0x957e('0x12a')](db['Pause'],{'as':_0x957e('0x155'),'foreignKey':_0x957e('0x156')});db[_0x957e('0x19')][_0x957e('0x12b')](db['CmList'],{'as':_0x957e('0x157'),'through':_0x957e('0x158')});db[_0x957e('0x19')][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':_0x957e('0x159'),'through':_0x957e('0x2d')});db[_0x957e('0x19')][_0x957e('0x12b')](db[_0x957e('0xe5')],{'as':_0x957e('0x15a'),'through':'TeamVoiceQueue'});db[_0x957e('0x19')][_0x957e('0x12b')](db['CmList'],{'as':_0x957e('0x15b'),'through':_0x957e('0x15c')});db[_0x957e('0x1b')][_0x957e('0x12a')](db['User'],{'as':'User','foreignKey':_0x957e('0x118')});db[_0x957e('0x1d')]['belongsTo'](db[_0x957e('0x116')],{'as':_0x957e('0x116'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x1f')][_0x957e('0x11c')](db['VoiceMailMessage'],{'as':_0x957e('0x15d'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x15e'),'sourceKey':_0x957e('0x15f')});db[_0x957e('0x21')]['belongsTo'](db[_0x957e('0x1f')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db['VoiceCallReport'][_0x957e('0x11c')](db[_0x957e('0x26')],{'as':'QueueCalls','foreignKey':_0x957e('0x160'),'constraints':![]});db[_0x957e('0x23')][_0x957e('0x11c')](db['VoiceAgentReport'],{'as':_0x957e('0x161'),'foreignKey':_0x957e('0x160'),'constraints':![]});db[_0x957e('0x23')][_0x957e('0x12a')](db['User'],{'as':_0x957e('0x116'),'foreignKey':_0x957e('0x118')});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0x957e('0x162'),'foreignKey':'ContactId'});db[_0x957e('0x37')][_0x957e('0x12a')](db[_0x957e('0x3b')],{'as':_0x957e('0x3b'),'foreignKey':_0x957e('0x163')});db[_0x957e('0x37')]['belongsTo'](db[_0x957e('0x10b')],{'as':_0x957e('0x10b'),'foreignKey':_0x957e('0x164'),'onDelete':'restrict'});db[_0x957e('0x39')]['belongsTo'](db[_0x957e('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x957e('0x39')][_0x957e('0x12a')](db[_0x957e('0x10b')],{'as':_0x957e('0x10b'),'foreignKey':_0x957e('0x164'),'onDelete':'restrict'});db[_0x957e('0x3b')][_0x957e('0x119')](db[_0x957e('0x37')],{'as':_0x957e('0x165'),'onDelete':'cascade'});db['MailAccount'][_0x957e('0x119')](db[_0x957e('0x39')],{'as':_0x957e('0x166'),'onDelete':_0x957e('0x117')});db[_0x957e('0x3b')]['hasMany'](db['Disposition'],{'as':_0x957e('0x167'),'foreignKey':_0x957e('0x163'),'onDelete':'cascade'});db[_0x957e('0x3b')][_0x957e('0x11c')](db[_0x957e('0x168')],{'as':'Answers','foreignKey':_0x957e('0x163')});db['MailAccount']['hasMany'](db[_0x957e('0x169')],{'as':'Messages','foreignKey':_0x957e('0x163')});db[_0x957e('0x3b')][_0x957e('0x11c')](db[_0x957e('0x41')],{'as':'Interactions'});db[_0x957e('0x3b')][_0x957e('0x11c')](db[_0x957e('0x44')],{'as':_0x957e('0x16a'),'foreignKey':'MailAccountId','onDelete':_0x957e('0x117')});db[_0x957e('0x3b')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x3b')][_0x957e('0x12a')](db[_0x957e('0x8e')],{'as':_0x957e('0x8e'),'foreignKey':_0x957e('0x16d')});db[_0x957e('0x3b')][_0x957e('0x12a')](db[_0x957e('0x7f')],{'as':_0x957e('0x155'),'foreignKey':_0x957e('0x156')});db[_0x957e('0x3b')]['belongsToMany'](db[_0x957e('0x116')],{'as':_0x957e('0x159'),'through':_0x957e('0x16e')});db[_0x957e('0x3d')][_0x957e('0x12b')](db['User'],{'as':_0x957e('0x159'),'through':_0x957e('0x30')});db[_0x957e('0x3d')]['belongsToMany'](db[_0x957e('0xe5')],{'through':'team_has_mail_queues','as':_0x957e('0x15a')});db[_0x957e('0x41')]['hasMany'](db['MailMessage'],{'as':_0x957e('0x15d'),'onDelete':_0x957e('0x117'),'foreignKey':'MailInteractionId'});db[_0x957e('0x41')][_0x957e('0x12a')](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0x957e('0x41')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x41')][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':'Owner','foreignKey':_0x957e('0x118')});db[_0x957e('0x41')][_0x957e('0x12b')](db['Tag'],{'through':_0x957e('0x170'),'as':'Tags'});db[_0x957e('0x41')]['belongsToMany'](db[_0x957e('0x88')],{'through':_0x957e('0x170'),'as':_0x957e('0x171')});db[_0x957e('0x41')][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':_0x957e('0x172'),'through':_0x957e('0x132'),'foreignKey':_0x957e('0x173')});db['MailMessage']['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':_0x957e('0x116')});db[_0x957e('0x169')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'onDelete':_0x957e('0x117'),'as':'Contact'});db[_0x957e('0x169')][_0x957e('0x12a')](db[_0x957e('0x41')],{'as':_0x957e('0x174'),'foreignKey':_0x957e('0x173')});db[_0x957e('0x169')]['belongsTo'](db[_0x957e('0x3b')],{'as':'Account','foreignKey':_0x957e('0x163')});db[_0x957e('0x169')][_0x957e('0x12a')](db[_0x957e('0x62')],{'as':_0x957e('0x62'),'foreignKey':'ChatWebsiteId'});db[_0x957e('0x169')][_0x957e('0x12a')](db[_0x957e('0x67')],{'as':_0x957e('0x67'),'foreignKey':_0x957e('0x175')});db[_0x957e('0x44')]['belongsTo'](db[_0x957e('0x116')],{'onDelete':_0x957e('0x176')});db['MailApplication'][_0x957e('0x12a')](db[_0x957e('0x3d')],{'onDelete':_0x957e('0x176')});db[_0x957e('0x44')]['belongsTo'](db[_0x957e('0x3b')],{'onDelete':_0x957e('0x176')});db['MailApplication'][_0x957e('0x12a')](db[_0x957e('0x7d')],{'onDelete':_0x957e('0x176'),'foreignKey':'IntervalId'});db[_0x957e('0x44')]['belongsTo'](db['Tag'],{'onDelete':_0x957e('0x176'),'foreignKey':_0x957e('0x177')});db['MailQueueReport']['belongsTo'](db[_0x957e('0x3b')],{});db[_0x957e('0x46')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x46')]['belongsTo'](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x46')][_0x957e('0x12a')](db['MailInteraction'],{});db[_0x957e('0x46')][_0x957e('0x12a')](db[_0x957e('0x169')],{});db[_0x957e('0x46')][_0x957e('0x12a')](db[_0x957e('0x116')],{});db[_0x957e('0x46')][_0x957e('0x12a')](db[_0x957e('0x3d')],{});db[_0x957e('0x48')][_0x957e('0x11c')](db[_0x957e('0x4a')],{'as':_0x957e('0x178'),'onDelete':_0x957e('0x117')});db[_0x957e('0x4b')]['hasMany'](db[_0x957e('0x7a')],{'as':'Dispositions','foreignKey':_0x957e('0x179'),'onDelete':_0x957e('0x117')});db[_0x957e('0x4b')][_0x957e('0x11c')](db[_0x957e('0x168')],{'as':'Answers','foreignKey':_0x957e('0x179')});db[_0x957e('0x4b')][_0x957e('0x11c')](db['FaxInteraction'],{'as':_0x957e('0x17a')});db[_0x957e('0x4b')]['hasMany'](db['FaxApplication'],{'as':_0x957e('0x16a'),'foreignKey':_0x957e('0x179'),'onDelete':'cascade'});db[_0x957e('0x4b')][_0x957e('0x11c')](db[_0x957e('0x16')],{'as':_0x957e('0x17b'),'onDelete':_0x957e('0x117')});db[_0x957e('0x4b')]['hasMany'](db['FaxMessage'],{'as':_0x957e('0x15d')});db[_0x957e('0x4b')][_0x957e('0x12a')](db['Trunk'],{'as':'Trunk'});db[_0x957e('0x4b')]['belongsTo'](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x4b')][_0x957e('0x12a')](db[_0x957e('0x7f')],{'as':_0x957e('0x155'),'foreignKey':_0x957e('0x156')});db[_0x957e('0x4b')][_0x957e('0x12b')](db['User'],{'as':_0x957e('0x159'),'through':_0x957e('0x17c')});db[_0x957e('0x17d')][_0x957e('0x12a')](db[_0x957e('0x116')],{'onDelete':'restrict'});db[_0x957e('0x17d')][_0x957e('0x12a')](db[_0x957e('0x51')],{'onDelete':_0x957e('0x176')});db[_0x957e('0x17d')][_0x957e('0x12a')](db[_0x957e('0x4b')],{'onDelete':_0x957e('0x176')});db[_0x957e('0x17d')]['belongsTo'](db[_0x957e('0x88')],{'onDelete':'restrict','foreignKey':_0x957e('0x177')});db[_0x957e('0x134')]['hasMany'](db['FaxMessage'],{'as':'Messages','onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x17e')});db[_0x957e('0x134')][_0x957e('0x12a')](db['FaxAccount'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x179')});db[_0x957e('0x134')][_0x957e('0x12a')](db['CmContact'],{'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x134')][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':'Owner','foreignKey':'UserId'});db[_0x957e('0x134')][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':_0x957e('0x180'),'as':_0x957e('0x181')});db[_0x957e('0x134')][_0x957e('0x12b')](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x957e('0x134')][_0x957e('0x12b')](db['User'],{'as':_0x957e('0x172'),'through':'user_has_fax_interactions','foreignKey':_0x957e('0x17e')});db[_0x957e('0x4f')][_0x957e('0x12a')](db[_0x957e('0x116')],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x116')});db[_0x957e('0x4f')][_0x957e('0x12a')](db['FaxInteraction'],{'as':_0x957e('0x174'),'foreignKey':_0x957e('0x17e')});db[_0x957e('0x4f')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'onDelete':_0x957e('0x117'),'as':'Contact'});db['FaxMessage']['belongsTo'](db[_0x957e('0xeb')],{'as':'Attachment','foreignKey':_0x957e('0x182')});db[_0x957e('0x4f')]['belongsTo'](db['FaxAccount'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x179')});db['FaxQueue'][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':'Agents','through':_0x957e('0x31')});db[_0x957e('0x51')]['belongsToMany'](db[_0x957e('0xe5')],{'through':_0x957e('0x183'),'as':_0x957e('0x15a')});db[_0x957e('0x184')]['belongsTo'](db[_0x957e('0x4b')],{});db[_0x957e('0x184')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x184')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':'ContactId'});db[_0x957e('0x184')][_0x957e('0x12a')](db[_0x957e('0x134')],{});db[_0x957e('0x184')]['belongsTo'](db[_0x957e('0x4f')],{});db[_0x957e('0x184')][_0x957e('0x12a')](db['User'],{});db[_0x957e('0x184')][_0x957e('0x12a')](db['FaxQueue'],{});db[_0x957e('0x53')][_0x957e('0x11c')](db[_0x957e('0x7a')],{'as':_0x957e('0x167'),'foreignKey':_0x957e('0x185'),'onDelete':_0x957e('0x117')});db[_0x957e('0x53')][_0x957e('0x11c')](db['CannedAnswer'],{'as':_0x957e('0x186'),'foreignKey':_0x957e('0x185')});db[_0x957e('0x53')][_0x957e('0x11c')](db[_0x957e('0x58')],{'as':_0x957e('0x15d'),'foreignKey':_0x957e('0x185')});db[_0x957e('0x53')][_0x957e('0x11c')](db['SmsInteraction'],{'as':'Interactions'});db[_0x957e('0x53')][_0x957e('0x11c')](db[_0x957e('0x55')],{'as':'Applications','foreignKey':_0x957e('0x185'),'onDelete':_0x957e('0x117')});db[_0x957e('0x53')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x53')][_0x957e('0x12a')](db[_0x957e('0x7f')],{'as':_0x957e('0x155'),'foreignKey':_0x957e('0x156')});db[_0x957e('0x53')][_0x957e('0x12b')](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x957e('0x55')][_0x957e('0x12a')](db[_0x957e('0x116')],{'onDelete':_0x957e('0x176')});db[_0x957e('0x55')][_0x957e('0x12a')](db[_0x957e('0x13d')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0x957e('0x53')],{'onDelete':_0x957e('0x176')});db[_0x957e('0x55')][_0x957e('0x12a')](db[_0x957e('0x7d')],{'onDelete':_0x957e('0x176'),'foreignKey':_0x957e('0x154')});db[_0x957e('0x55')][_0x957e('0x12a')](db['Tag'],{'onDelete':_0x957e('0x176'),'foreignKey':_0x957e('0x177')});db[_0x957e('0x56')][_0x957e('0x11c')](db['SmsMessage'],{'as':'Messages','onDelete':_0x957e('0x117'),'foreignKey':'SmsInteractionId'});db[_0x957e('0x56')][_0x957e('0x12a')](db[_0x957e('0x53')],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x185')});db[_0x957e('0x56')]['belongsTo'](db['CmContact'],{'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x56')]['belongsTo'](db[_0x957e('0x116')],{'as':_0x957e('0x187'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x56')][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':_0x957e('0x188'),'as':'Tags'});db[_0x957e('0x56')][_0x957e('0x12b')](db['Tag'],{'through':_0x957e('0x188'),'as':_0x957e('0x171')});db['SmsInteraction']['belongsToMany'](db[_0x957e('0x116')],{'as':_0x957e('0x172'),'through':'user_has_sms_interactions','foreignKey':_0x957e('0x189')});db[_0x957e('0x58')][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':_0x957e('0x116')});db['SmsMessage'][_0x957e('0x12a')](db[_0x957e('0x6e')],{'onDelete':_0x957e('0x117'),'as':'Contact'});db[_0x957e('0x58')][_0x957e('0x12a')](db[_0x957e('0x56')],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x174'),'foreignKey':_0x957e('0x189')});db[_0x957e('0x58')][_0x957e('0x12a')](db['SmsAccount'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x185')});db[_0x957e('0x13d')][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':_0x957e('0x159'),'through':_0x957e('0x33'),'foreignKey':'SmsQueueId'});db[_0x957e('0x13d')][_0x957e('0x12b')](db[_0x957e('0xe5')],{'through':_0x957e('0x18a'),'as':_0x957e('0x15a')});db[_0x957e('0x145')][_0x957e('0x11c')](db[_0x957e('0x7a')],{'as':_0x957e('0x167'),'foreignKey':'OpenchannelAccountId','onDelete':_0x957e('0x117')});db[_0x957e('0x145')][_0x957e('0x11c')](db[_0x957e('0x168')],{'as':_0x957e('0x186'),'foreignKey':_0x957e('0x18b')});db['OpenchannelAccount']['hasMany'](db['OpenchannelInteraction'],{'as':_0x957e('0x17a'),'foreignKey':_0x957e('0x18b')});db[_0x957e('0x145')][_0x957e('0x11c')](db[_0x957e('0x60')],{'as':_0x957e('0x15d'),'foreignKey':_0x957e('0x18b')});db[_0x957e('0x145')][_0x957e('0x11c')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x957e('0x18b'),'onDelete':'cascade'});db[_0x957e('0x145')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':'List','foreignKey':_0x957e('0x16c')});db[_0x957e('0x145')][_0x957e('0x12a')](db[_0x957e('0x7f')],{'as':_0x957e('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x957e('0x145')][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':'Agents','through':_0x957e('0x146')});db['OpenchannelApplication'][_0x957e('0x12a')](db[_0x957e('0x116')],{'onDelete':_0x957e('0x176')});db[_0x957e('0x5c')][_0x957e('0x12a')](db[_0x957e('0x13f')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x957e('0x5c')][_0x957e('0x12a')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x957e('0x18b')});db['OpenchannelApplication']['belongsTo'](db[_0x957e('0x7d')],{'onDelete':_0x957e('0x176'),'foreignKey':_0x957e('0x154')});db[_0x957e('0x5c')][_0x957e('0x12a')](db[_0x957e('0x88')],{'onDelete':_0x957e('0x176'),'foreignKey':'TagId'});db[_0x957e('0x5e')][_0x957e('0x11c')](db[_0x957e('0x60')],{'as':_0x957e('0x15d'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x18c')});db[_0x957e('0x5e')][_0x957e('0x12a')](db['OpenchannelAccount'],{'as':_0x957e('0x17f'),'foreignKey':'OpenchannelAccountId'});db[_0x957e('0x5e')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':'ContactId'});db[_0x957e('0x5e')]['belongsTo'](db[_0x957e('0x116')],{'as':_0x957e('0x187'),'foreignKey':'UserId'});db[_0x957e('0x5e')][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':_0x957e('0x18d'),'as':_0x957e('0x181')});db[_0x957e('0x5e')][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':_0x957e('0x18d'),'as':_0x957e('0x171')});db[_0x957e('0x5e')][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':_0x957e('0x172'),'through':_0x957e('0x136'),'foreignKey':_0x957e('0x18c')});db[_0x957e('0x60')][_0x957e('0x12a')](db['User'],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x116')});db[_0x957e('0x60')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'onDelete':_0x957e('0x117'),'as':'Contact'});db[_0x957e('0x60')][_0x957e('0x12a')](db[_0x957e('0x5e')],{'onDelete':'cascade','as':_0x957e('0x174'),'foreignKey':_0x957e('0x18c')});db['OpenchannelMessage'][_0x957e('0x12a')](db[_0x957e('0xeb')],{'as':'Attachment','foreignKey':_0x957e('0x182')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x957e('0x18b')});db[_0x957e('0x13f')]['belongsToMany'](db[_0x957e('0x116')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x957e('0x13f')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x957e('0x62')][_0x957e('0x11c')](db['Disposition'],{'as':_0x957e('0x167'),'foreignKey':_0x957e('0x18e'),'onDelete':_0x957e('0x117')});db[_0x957e('0x62')][_0x957e('0x11c')](db['CannedAnswer'],{'as':_0x957e('0x186'),'foreignKey':_0x957e('0x18e')});db[_0x957e('0x62')][_0x957e('0x11c')](db[_0x957e('0x6a')],{'as':'ProactiveActions'});db['ChatWebsite']['hasMany'](db[_0x957e('0x65')],{'as':'Interactions'});db[_0x957e('0x62')]['hasMany'](db[_0x957e('0x18f')],{'as':_0x957e('0x16a'),'foreignKey':_0x957e('0x18e'),'onDelete':_0x957e('0x117')});db[_0x957e('0x62')][_0x957e('0x11c')](db[_0x957e('0x66')],{'as':_0x957e('0x15d')});db[_0x957e('0x62')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x62')][_0x957e('0x12a')](db[_0x957e('0x7d')],{'as':_0x957e('0x7d'),'foreignKey':_0x957e('0x154')});db['ChatWebsite'][_0x957e('0x12a')](db[_0x957e('0x3b')],{'as':_0x957e('0x3b'),'foreignKey':_0x957e('0x163')});db['ChatWebsite'][_0x957e('0x12a')](db[_0x957e('0x7f')],{'as':_0x957e('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x957e('0x62')][_0x957e('0x12b')](db['User'],{'as':_0x957e('0x159'),'through':_0x957e('0x143')});db[_0x957e('0x63')][_0x957e('0x12a')](db['OpenchannelAccount'],{});db[_0x957e('0x63')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x63')][_0x957e('0x12a')](db['CmContact'],{'as':'Contact','foreignKey':_0x957e('0x16f')});db['OpenchannelQueueReport'][_0x957e('0x12a')](db['OpenchannelInteraction'],{});db[_0x957e('0x63')][_0x957e('0x12a')](db[_0x957e('0x60')],{});db[_0x957e('0x63')][_0x957e('0x12a')](db[_0x957e('0x116')],{});db[_0x957e('0x63')][_0x957e('0x12a')](db[_0x957e('0x13f')],{});db[_0x957e('0x18f')][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':_0x957e('0x190'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x957e('0x18f')]['belongsTo'](db[_0x957e('0x68')],{'as':_0x957e('0x191'),'foreignKey':_0x957e('0x192'),'onDelete':_0x957e('0x176')});db[_0x957e('0x18f')][_0x957e('0x12a')](db[_0x957e('0x62')],{'as':_0x957e('0x193'),'foreignKey':_0x957e('0x18e'),'onDelete':_0x957e('0x176')});db[_0x957e('0x18f')][_0x957e('0x12a')](db[_0x957e('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x957e('0x65')][_0x957e('0x11c')](db[_0x957e('0x66')],{'as':_0x957e('0x15d'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x194')});db[_0x957e('0x65')][_0x957e('0x12a')](db['ChatWebsite'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x18e')});db[_0x957e('0x65')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':'ContactId'});db[_0x957e('0x65')][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':_0x957e('0x187'),'foreignKey':_0x957e('0x118')});db['ChatInteraction'][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':_0x957e('0x195'),'as':_0x957e('0x181')});db[_0x957e('0x65')][_0x957e('0x12b')](db['Tag'],{'through':_0x957e('0x195'),'as':_0x957e('0x171')});db['ChatInteraction'][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':'Users','through':_0x957e('0x133'),'foreignKey':'ChatInteractionId'});db[_0x957e('0x66')][_0x957e('0x12a')](db[_0x957e('0x116')],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x116')});db[_0x957e('0x66')]['belongsTo'](db[_0x957e('0x6e')],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x66')][_0x957e('0x12a')](db[_0x957e('0x65')],{'onDelete':_0x957e('0x117'),'as':'Interaction','foreignKey':_0x957e('0x194')});db[_0x957e('0x66')][_0x957e('0x12a')](db['Attachment'],{'as':_0x957e('0xeb'),'foreignKey':'AttachmentId'});db[_0x957e('0x66')][_0x957e('0x12a')](db[_0x957e('0x62')],{'as':'Account','foreignKey':_0x957e('0x18e')});db[_0x957e('0x67')][_0x957e('0x11c')](db[_0x957e('0xeb')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x957e('0x117'),'hooks':!![]});db[_0x957e('0x67')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x67')][_0x957e('0x12a')](db[_0x957e('0x62')],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x18e')});db['ChatQueue'][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':_0x957e('0x159'),'through':_0x957e('0x2e'),'hooks':!![]});db[_0x957e('0x68')][_0x957e('0x12b')](db[_0x957e('0xe5')],{'through':_0x957e('0x196'),'as':_0x957e('0x15a')});db[_0x957e('0x12c')][_0x957e('0x11c')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x957e('0x197'),'onDelete':_0x957e('0x117')});db[_0x957e('0x12c')][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':'Members','through':_0x957e('0x12e')});db[_0x957e('0x6a')]['belongsTo'](db[_0x957e('0x62')],{'as':_0x957e('0x193'),'foreignKey':'ChatWebsiteId'});db[_0x957e('0x6c')][_0x957e('0x11c')](db[_0x957e('0x6e')],{'as':'Contacts','foreignKey':_0x957e('0x198')});db[_0x957e('0x6e')]['hasMany'](db['CmContactHasItem'],{'as':_0x957e('0x199'),'foreignKey':_0x957e('0x19a')});db[_0x957e('0x6e')][_0x957e('0x11c')](db[_0x957e('0x70')],{'as':'Hoppers','foreignKey':_0x957e('0x16f')});db[_0x957e('0x6e')][_0x957e('0x11c')](db[_0x957e('0x11f')],{'as':_0x957e('0x120'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x6e')][_0x957e('0x11c')](db[_0x957e('0x75')],{'as':_0x957e('0x14e'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x6e')]['hasMany'](db[_0x957e('0x76')],{'as':_0x957e('0x76'),'foreignKey':'ContactId'});db[_0x957e('0x6e')][_0x957e('0x11c')](db[_0x957e('0xd4')],{'as':_0x957e('0x150'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x6e')][_0x957e('0x11c')](db[_0x957e('0x5e')],{'as':_0x957e('0x121'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x957e('0x6e')][_0x957e('0x11c')](db[_0x957e('0x65')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x957e('0x176')});db[_0x957e('0x6e')][_0x957e('0x11c')](db['SmsInteraction'],{'as':_0x957e('0x123'),'foreignKey':_0x957e('0x16f'),'onDelete':'restrict'});db[_0x957e('0x6e')]['hasMany'](db['FaxInteraction'],{'as':_0x957e('0x124'),'foreignKey':_0x957e('0x16f'),'onDelete':_0x957e('0x176')});db[_0x957e('0x6e')][_0x957e('0x11c')](db[_0x957e('0x41')],{'as':_0x957e('0x125'),'foreignKey':_0x957e('0x16f'),'onDelete':_0x957e('0x176')});db[_0x957e('0x6e')][_0x957e('0x12a')](db[_0x957e('0x6c')],{'as':_0x957e('0x19b'),'foreignKey':'CompanyId'});db[_0x957e('0x6e')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':'List','foreignKey':_0x957e('0x16c'),'onDelete':_0x957e('0x117')});db['CmContact'][_0x957e('0x12b')](db['User'],{'as':_0x957e('0x172'),'through':_0x957e('0x12f')});db['CmContact']['belongsToMany'](db[_0x957e('0x88')],{'as':_0x957e('0x181'),'through':'cm_contact_has_tags'});db[_0x957e('0x6e')][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':'cm_contact_has_tags','as':_0x957e('0x171')});db[_0x957e('0x70')]['hasMany'](db[_0x957e('0x8d')],{'as':_0x957e('0x19c'),'foreignKey':_0x957e('0x19d')});db[_0x957e('0x70')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':'Contact','foreignKey':_0x957e('0x16f'),'onDelete':'cascade'});db[_0x957e('0x70')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':'ListId','onDelete':_0x957e('0x117')});db['CmHopper']['belongsTo'](db[_0x957e('0x116')],{'as':_0x957e('0x190'),'foreignKey':_0x957e('0x118')});db[_0x957e('0x70')]['belongsTo'](db[_0x957e('0x19')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x957e('0x117')});db[_0x957e('0x70')]['belongsTo'](db[_0x957e('0xe7')],{'as':_0x957e('0xe7'),'foreignKey':'CampaignId','onDelete':_0x957e('0x117')});db[_0x957e('0x70')]['belongsTo'](db[_0x957e('0x116')],{'as':'Owner','foreignKey':_0x957e('0x19e')});db[_0x957e('0x72')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f'),'onDelete':_0x957e('0x117')});db[_0x957e('0x72')]['belongsTo'](db[_0x957e('0xf5')],{'as':'List','foreignKey':_0x957e('0x16c'),'onDelete':_0x957e('0x117')});db[_0x957e('0x72')]['belongsTo'](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x957e('0x14d'),'onDelete':'cascade'});db[_0x957e('0x72')][_0x957e('0x12a')](db[_0x957e('0xe7')],{'as':'Campaign','foreignKey':_0x957e('0x19f'),'onDelete':_0x957e('0x117')});db[_0x957e('0x79')][_0x957e('0x11c')](db[_0x957e('0x7c')],{'as':{'plural':'All','singular':_0x957e('0x1a0')},'foreignKey':_0x957e('0x1a1'),'onDelete':_0x957e('0x117'),'hooks':!![]});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':_0x957e('0x1a2'),'singular':_0x957e('0x1a3')},'foreignKey':_0x957e('0x1a4'),'onDelete':_0x957e('0x117'),'hooks':!![]});db[_0x957e('0x79')][_0x957e('0x11c')](db[_0x957e('0x78')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x957e('0x7a')][_0x957e('0x11c')](db[_0x957e('0x7a')],{'as':_0x957e('0x167'),'foreignKey':'ParentId','onDelete':_0x957e('0x117')});db[_0x957e('0x7d')][_0x957e('0x11c')](db[_0x957e('0x7d')],{'as':_0x957e('0x1a5'),'foreignKey':_0x957e('0x154'),'onDelete':_0x957e('0x117'),'hooks':!![],'required':![]});db[_0x957e('0x7d')]['hasMany'](db[_0x957e('0x16')],{'as':_0x957e('0x11e'),'foreignKey':_0x957e('0x154'),'onDelete':_0x957e('0x176')});db[_0x957e('0x7d')][_0x957e('0x11c')](db[_0x957e('0x44')],{'as':_0x957e('0x1a6'),'foreignKey':'IntervalId'});db[_0x957e('0x7d')]['hasMany'](db[_0x957e('0x18f')],{'as':_0x957e('0x1a7'),'foreignKey':'IntervalId'});db[_0x957e('0x7d')][_0x957e('0x11c')](db[_0x957e('0x17d')],{'as':_0x957e('0x1a8'),'foreignKey':_0x957e('0x154')});db[_0x957e('0x7d')][_0x957e('0x11c')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x957e('0x84')]['belongsTo'](db['MailAccount'],{});db[_0x957e('0x84')][_0x957e('0x12a')](db[_0x957e('0x1a9')],{'foreignKey':'DefaultReportId'});db[_0x957e('0x84')][_0x957e('0x12a')](db[_0x957e('0x1aa')],{'foreignKey':_0x957e('0x1ab')});db[_0x957e('0x86')]['belongsToMany'](db[_0x957e('0x17')],{'as':_0x957e('0x1ac'),'through':_0x957e('0x1ad'),'onDelete':_0x957e('0x176')});db[_0x957e('0x88')][_0x957e('0x12b')](db[_0x957e('0x6e')],{'through':_0x957e('0x1ae')});db[_0x957e('0x88')][_0x957e('0x12b')](db[_0x957e('0x65')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x957e('0x12b')](db[_0x957e('0x41')],{'through':_0x957e('0x170')});db[_0x957e('0x88')][_0x957e('0x12b')](db['SmsInteraction'],{'through':_0x957e('0x188')});db[_0x957e('0x88')][_0x957e('0x12b')](db[_0x957e('0x134')],{'through':_0x957e('0x180')});db[_0x957e('0x88')]['belongsToMany'](db[_0x957e('0x5e')],{'through':_0x957e('0x18d')});db['Tag']['belongsToMany'](db['WhatsappInteraction'],{'through':_0x957e('0x1af')});db['CmContactHasItem'][_0x957e('0x12a')](db[_0x957e('0x8a')],{'as':_0x957e('0x1b0'),'foreignKey':_0x957e('0x1b1')});db[_0x957e('0x8d')][_0x957e('0x12a')](db[_0x957e('0x70')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x957e('0x1b2')]['belongsTo'](db[_0x957e('0x6e')],{'as':'Contact','foreignKey':'CmContactId'});db['Trigger'][_0x957e('0x11c')](db['Condition'],{'as':{'plural':_0x957e('0x1b3'),'singular':_0x957e('0x1b4')},'foreignKey':_0x957e('0x1b5'),'onDelete':_0x957e('0x117'),'hooks':!![]});db[_0x957e('0x8f')]['hasMany'](db[_0x957e('0x7c')],{'as':{'plural':_0x957e('0x1b6'),'singular':_0x957e('0x1b7')},'foreignKey':_0x957e('0x1b8'),'onDelete':_0x957e('0x117'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x957e('0x78')],{'as':_0x957e('0x1b9'),'foreignKey':_0x957e('0x1ba'),'onDelete':'cascade','hooks':!![]});db[_0x957e('0x1aa')][_0x957e('0x11c')](db[_0x957e('0x9b')],{'as':'Fields','onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1ab'),'hooks':!![]});db[_0x957e('0x1a9')][_0x957e('0x11c')](db[_0x957e('0x9b')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x957e('0x1bb')});db['AnalyticMetric']['hasMany'](db[_0x957e('0x9b')],{'as':'Fields','onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1bc')});db[_0x957e('0x9b')]['belongsTo'](db[_0x957e('0x99')],{'foreignKey':_0x957e('0x1bc')});db['SalesforceAccount']['hasMany'](db[_0x957e('0xa0')],{'as':_0x957e('0x1bd'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db['SalesforceConfiguration'][_0x957e('0x11c')](db['SalesforceField'],{'as':_0x957e('0x1bf'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1c0')});db['SalesforceConfiguration'][_0x957e('0x11c')](db[_0x957e('0xa2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x957e('0xa0')][_0x957e('0x11c')](db[_0x957e('0xa2')],{'as':_0x957e('0x1c1'),'onDelete':_0x957e('0x117'),'foreignKey':'FieldId'});db[_0x957e('0xa0')][_0x957e('0x12a')](db[_0x957e('0x9e')],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1be')});db['SalesforceField'][_0x957e('0x11c')](db[_0x957e('0xa2')],{'as':_0x957e('0x1c2'),'foreignKey':_0x957e('0x1c0')});db['SalesforceField'][_0x957e('0x11c')](db[_0x957e('0xa2')],{'as':_0x957e('0x1c3'),'foreignKey':_0x957e('0x1c4')});db[_0x957e('0xa2')][_0x957e('0x11c')](db['SalesforceField'],{'as':_0x957e('0x1c5'),'foreignKey':'FieldId'});db[_0x957e('0xa2')][_0x957e('0x12a')](db[_0x957e('0x91')],{'as':_0x957e('0x91'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x957e('0x11c')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0x1c6')][_0x957e('0x11c')](db[_0x957e('0xa7')],{'as':_0x957e('0x1bf'),'onDelete':'cascade','foreignKey':_0x957e('0x1c0')});db[_0x957e('0x1c6')]['hasMany'](db[_0x957e('0xa7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x957e('0x1c4')});db['SugarcrmConfiguration'][_0x957e('0x11c')](db[_0x957e('0xa7')],{'as':_0x957e('0x1c1'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0x1c6')][_0x957e('0x12a')](db[_0x957e('0xa4')],{'as':'Account','foreignKey':_0x957e('0x1be')});db['SugarcrmField']['hasMany'](db[_0x957e('0xa7')],{'as':_0x957e('0x1c2'),'foreignKey':_0x957e('0x1c0')});db['SugarcrmField'][_0x957e('0x11c')](db[_0x957e('0xa7')],{'as':'Description','foreignKey':_0x957e('0x1c4')});db[_0x957e('0xa7')]['hasMany'](db[_0x957e('0xa7')],{'as':_0x957e('0x1c5'),'foreignKey':'FieldId'});db[_0x957e('0xa7')][_0x957e('0x12a')](db[_0x957e('0x91')],{'as':'Variable','foreignKey':_0x957e('0x1c8')});db[_0x957e('0xa9')][_0x957e('0x11c')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xab')][_0x957e('0x11c')](db[_0x957e('0xad')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x957e('0x1c0')});db[_0x957e('0xab')][_0x957e('0x11c')](db['DeskField'],{'as':_0x957e('0x1c9'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1c4')});db[_0x957e('0xab')][_0x957e('0x11c')](db[_0x957e('0xad')],{'as':_0x957e('0x1c1'),'onDelete':'cascade','foreignKey':_0x957e('0x1c7')});db[_0x957e('0xab')]['belongsTo'](db[_0x957e('0xa9')],{'as':_0x957e('0x17f'),'foreignKey':'AccountId'});db[_0x957e('0xab')][_0x957e('0x12b')](db['Tag'],{'through':_0x957e('0x1ca')});db[_0x957e('0xad')][_0x957e('0x11c')](db[_0x957e('0xad')],{'as':'Subject','foreignKey':_0x957e('0x1c0')});db[_0x957e('0xad')]['hasMany'](db[_0x957e('0xad')],{'as':_0x957e('0x1c3'),'foreignKey':_0x957e('0x1c4')});db[_0x957e('0xad')]['hasMany'](db[_0x957e('0xad')],{'as':_0x957e('0x1c5'),'foreignKey':_0x957e('0x1c7')});db['DeskField'][_0x957e('0x12a')](db['Variable'],{'as':_0x957e('0x91'),'foreignKey':'VariableId'});db[_0x957e('0xaf')][_0x957e('0x11c')](db[_0x957e('0xb1')],{'as':_0x957e('0x1bd'),'onDelete':_0x957e('0x117'),'foreignKey':'AccountId'});db[_0x957e('0xb1')][_0x957e('0x11c')](db['ZohoField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x957e('0x1c0')});db[_0x957e('0xb1')]['hasMany'](db[_0x957e('0xb3')],{'as':_0x957e('0x1c9'),'onDelete':_0x957e('0x117'),'foreignKey':'DescriptionId'});db[_0x957e('0xb1')][_0x957e('0x11c')](db[_0x957e('0xb3')],{'as':_0x957e('0x1c1'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xb1')][_0x957e('0x12a')](db['ZohoAccount'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xb3')][_0x957e('0x11c')](db[_0x957e('0xb3')],{'as':'Subject','foreignKey':_0x957e('0x1c0')});db[_0x957e('0xb3')][_0x957e('0x11c')](db[_0x957e('0xb3')],{'as':'Description','foreignKey':_0x957e('0x1c4')});db['ZohoField'][_0x957e('0x11c')](db[_0x957e('0xb3')],{'as':_0x957e('0x1c5'),'foreignKey':'FieldId'});db[_0x957e('0xb3')][_0x957e('0x12a')](db['Variable'],{'as':_0x957e('0x91'),'foreignKey':_0x957e('0x1c8')});db[_0x957e('0xb5')][_0x957e('0x11c')](db['ZendeskConfiguration'],{'as':_0x957e('0x1bd'),'onDelete':_0x957e('0x117'),'foreignKey':'AccountId'});db[_0x957e('0x1cb')][_0x957e('0x11c')](db[_0x957e('0xb7')],{'as':_0x957e('0x1bf'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x957e('0x11c')](db[_0x957e('0xb7')],{'as':_0x957e('0x1c9'),'foreignKey':_0x957e('0x1c4')});db[_0x957e('0x1cb')][_0x957e('0x11c')](db['ZendeskField'],{'as':_0x957e('0x1c1'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0x1cb')][_0x957e('0x12a')](db['ZendeskAccount'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0x1cb')][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':_0x957e('0x1cc')});db['ZendeskField'][_0x957e('0x11c')](db['ZendeskField'],{'as':_0x957e('0x1c2'),'foreignKey':'SubjectId'});db[_0x957e('0xb7')][_0x957e('0x11c')](db[_0x957e('0xb7')],{'as':'Description','foreignKey':_0x957e('0x1c4')});db[_0x957e('0xb7')]['hasMany'](db[_0x957e('0xb7')],{'as':_0x957e('0x1c5'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xb7')][_0x957e('0x12a')](db['Variable'],{'as':_0x957e('0x91'),'foreignKey':'VariableId'});db[_0x957e('0x1cd')][_0x957e('0x11c')](db[_0x957e('0xb9')],{'as':_0x957e('0x1bd'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xb9')][_0x957e('0x11c')](db[_0x957e('0xbb')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x957e('0x1c0')});db['FreshdeskConfiguration'][_0x957e('0x11c')](db['FreshdeskField'],{'as':_0x957e('0x1c9'),'onDelete':_0x957e('0x117'),'foreignKey':'DescriptionId'});db[_0x957e('0xb9')][_0x957e('0x11c')](db['FreshdeskField'],{'as':_0x957e('0x1c1'),'onDelete':'cascade','foreignKey':_0x957e('0x1c7')});db[_0x957e('0xb9')][_0x957e('0x12a')](db[_0x957e('0x1cd')],{'as':_0x957e('0x17f'),'foreignKey':'AccountId'});db[_0x957e('0xb9')]['belongsToMany'](db['Tag'],{'through':_0x957e('0x1ce')});db[_0x957e('0xbb')][_0x957e('0x11c')](db[_0x957e('0xbb')],{'as':_0x957e('0x1c2'),'foreignKey':_0x957e('0x1c0')});db[_0x957e('0xbb')][_0x957e('0x11c')](db[_0x957e('0xbb')],{'as':'Description','foreignKey':_0x957e('0x1c4')});db[_0x957e('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0x957e('0x1c5'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xbb')][_0x957e('0x12a')](db[_0x957e('0x91')],{'as':'Variable','foreignKey':_0x957e('0x1c8')});db[_0x957e('0xbd')][_0x957e('0x11c')](db[_0x957e('0xbf')],{'as':'Configurations','onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xbf')][_0x957e('0x11c')](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x957e('0xbf')]['hasMany'](db[_0x957e('0x1cf')],{'as':_0x957e('0x1c9'),'foreignKey':_0x957e('0x1c4')});db['VtigerConfiguration'][_0x957e('0x11c')](db['VtigerField'],{'as':_0x957e('0x1c1'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xbf')][_0x957e('0x12a')](db['VtigerAccount'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0x1cf')][_0x957e('0x11c')](db[_0x957e('0x1cf')],{'as':_0x957e('0x1c2'),'foreignKey':_0x957e('0x1c0')});db[_0x957e('0x1cf')][_0x957e('0x11c')](db[_0x957e('0x1cf')],{'as':'Description','foreignKey':_0x957e('0x1c4')});db[_0x957e('0x1cf')][_0x957e('0x11c')](db[_0x957e('0x1cf')],{'as':'Field','foreignKey':_0x957e('0x1c7')});db[_0x957e('0x1cf')]['belongsTo'](db[_0x957e('0x91')],{'as':_0x957e('0x91'),'foreignKey':_0x957e('0x1c8')});db[_0x957e('0x1d0')][_0x957e('0x11c')](db[_0x957e('0xc3')],{'as':_0x957e('0x1bd'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xc3')][_0x957e('0x11c')](db[_0x957e('0xc5')],{'as':_0x957e('0x1bf'),'foreignKey':_0x957e('0x1c0')});db[_0x957e('0xc3')]['hasMany'](db[_0x957e('0xc5')],{'as':_0x957e('0x1c9'),'foreignKey':_0x957e('0x1c4')});db['ServicenowConfiguration'][_0x957e('0x11c')](db[_0x957e('0xc5')],{'as':_0x957e('0x1c1'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xc3')]['belongsTo'](db[_0x957e('0x1d0')],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xc5')]['hasMany'](db[_0x957e('0xc5')],{'as':_0x957e('0x1c2'),'foreignKey':'SubjectId'});db[_0x957e('0xc5')][_0x957e('0x11c')](db['ServicenowField'],{'as':'Description','foreignKey':_0x957e('0x1c4')});db['ServicenowField'][_0x957e('0x11c')](db[_0x957e('0xc5')],{'as':_0x957e('0x1c5'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xc5')][_0x957e('0x12a')](db[_0x957e('0x91')],{'as':_0x957e('0x91'),'foreignKey':_0x957e('0x1c8')});db['Dynamics365Account'][_0x957e('0x11c')](db[_0x957e('0xc8')],{'as':_0x957e('0x1bd'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xc7')][_0x957e('0x12a')](db[_0x957e('0x10b')],{'as':_0x957e('0x10b'),'foreignKey':'CloudProviderId'});db[_0x957e('0xc8')][_0x957e('0x11c')](db['Dynamics365Field'],{'as':_0x957e('0x1bf'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1c0')});db[_0x957e('0xc8')][_0x957e('0x11c')](db[_0x957e('0xca')],{'as':_0x957e('0x1c9'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1c4')});db[_0x957e('0xc8')][_0x957e('0x11c')](db[_0x957e('0xca')],{'as':_0x957e('0x1c1'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xc8')]['belongsTo'](db[_0x957e('0xc7')],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xca')][_0x957e('0x11c')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x957e('0x1c0')});db[_0x957e('0xca')]['hasMany'](db[_0x957e('0xca')],{'as':_0x957e('0x1c3'),'foreignKey':_0x957e('0x1c4')});db[_0x957e('0xca')]['hasMany'](db[_0x957e('0xca')],{'as':_0x957e('0x1c5'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xca')][_0x957e('0x12a')](db[_0x957e('0x91')],{'as':_0x957e('0x91'),'foreignKey':_0x957e('0x1c8')});db['FreshsalesAccount'][_0x957e('0x11c')](db[_0x957e('0xcd')],{'as':_0x957e('0x1bd'),'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xcd')][_0x957e('0x11c')](db['FreshsalesField'],{'as':_0x957e('0x1bf'),'foreignKey':'SubjectId'});db[_0x957e('0xcd')]['hasMany'](db[_0x957e('0xce')],{'as':_0x957e('0x1c9'),'foreignKey':_0x957e('0x1c4')});db[_0x957e('0xcd')]['hasMany'](db[_0x957e('0xce')],{'as':_0x957e('0x1c1'),'foreignKey':_0x957e('0x1c7')});db[_0x957e('0xcd')][_0x957e('0x12a')](db[_0x957e('0xcc')],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1be')});db[_0x957e('0xce')][_0x957e('0x11c')](db[_0x957e('0xce')],{'as':_0x957e('0x1c2'),'foreignKey':_0x957e('0x1c0')});db[_0x957e('0xce')]['hasMany'](db[_0x957e('0xce')],{'as':'Description','foreignKey':_0x957e('0x1c4')});db[_0x957e('0xce')][_0x957e('0x11c')](db[_0x957e('0xce')],{'as':_0x957e('0x1c5'),'foreignKey':_0x957e('0x1c7')});db['FreshsalesField'][_0x957e('0x12a')](db[_0x957e('0x91')],{'as':_0x957e('0x91'),'foreignKey':_0x957e('0x1c8')});db[_0x957e('0x1d1')]['belongsTo'](db[_0x957e('0x62')],{});db[_0x957e('0x1d1')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':'List','foreignKey':_0x957e('0x16c')});db[_0x957e('0x1d1')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db['ChatQueueReport'][_0x957e('0x12a')](db[_0x957e('0x65')],{});db[_0x957e('0x1d1')][_0x957e('0x12a')](db[_0x957e('0x66')],{});db['ChatQueueReport']['belongsTo'](db[_0x957e('0x116')],{});db[_0x957e('0x1d1')][_0x957e('0x12a')](db[_0x957e('0x68')],{});db['ChatInternalMessage']['belongsTo'](db[_0x957e('0x116')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x957e('0x1d2')]['belongsTo'](db['User'],{'onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x1d3')});db[_0x957e('0xd4')][_0x957e('0x11c')](db[_0x957e('0x1d4')],{'foreignKey':_0x957e('0x1d5'),'onDelete':_0x957e('0x117')});db[_0x957e('0xd4')]['hasMany'](db[_0x957e('0x1d6')],{'foreignKey':_0x957e('0x1d5'),'onDelete':_0x957e('0x117')});db[_0x957e('0xd6')][_0x957e('0x12a')](db[_0x957e('0x53')],{});db['SmsQueueReport'][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':'List','foreignKey':_0x957e('0x16c')});db[_0x957e('0xd6')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':'Contact','foreignKey':_0x957e('0x16f')});db[_0x957e('0xd6')]['belongsTo'](db[_0x957e('0x56')],{});db['SmsQueueReport'][_0x957e('0x12a')](db[_0x957e('0x58')],{});db[_0x957e('0xd6')][_0x957e('0x12a')](db[_0x957e('0x116')],{});db[_0x957e('0xd6')][_0x957e('0x12a')](db[_0x957e('0x13d')],{});db[_0x957e('0xda')]['hasMany'](db[_0x957e('0xd4')],{'foreignKey':'ProjectId'});db[_0x957e('0xda')][_0x957e('0x11c')](db['JscriptyQuestionReport'],{'foreignKey':_0x957e('0x1d7')});db[_0x957e('0xda')]['hasMany'](db[_0x957e('0x1d6')],{'foreignKey':_0x957e('0x1d7')});db[_0x957e('0xe5')][_0x957e('0x12b')](db['User'],{'as':_0x957e('0x159'),'through':_0x957e('0x131')});db[_0x957e('0xe5')]['belongsToMany'](db[_0x957e('0x19')],{'through':'TeamVoiceQueue','as':_0x957e('0x138')});db[_0x957e('0xe5')][_0x957e('0x12b')](db[_0x957e('0x3d')],{'through':_0x957e('0x1d8'),'as':_0x957e('0x13a')});db[_0x957e('0xe5')]['belongsToMany'](db[_0x957e('0x68')],{'through':_0x957e('0x196'),'as':_0x957e('0x13b')});db[_0x957e('0xe5')][_0x957e('0x12b')](db[_0x957e('0x51')],{'through':_0x957e('0x183'),'as':_0x957e('0x13c')});db[_0x957e('0xe5')][_0x957e('0x12b')](db[_0x957e('0x13d')],{'through':_0x957e('0x18a'),'as':_0x957e('0x13e')});db[_0x957e('0xe5')][_0x957e('0x12b')](db[_0x957e('0x13f')],{'through':_0x957e('0x1d9'),'as':_0x957e('0x140')});db['Team'][_0x957e('0x12b')](db[_0x957e('0x10a')],{'through':_0x957e('0x1da'),'as':_0x957e('0x141')});db[_0x957e('0xe5')][_0x957e('0x12b')](db['VoicePrefix'],{'through':_0x957e('0x10f'),'as':_0x957e('0x139')});db['Campaign'][_0x957e('0x11c')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x957e('0x19f')});db['Campaign'][_0x957e('0x11c')](db['CmHopperFinal'],{'as':_0x957e('0x120'),'foreignKey':_0x957e('0x19f')});db[_0x957e('0xe7')][_0x957e('0x11c')](db[_0x957e('0x75')],{'as':'HopperHistories','foreignKey':_0x957e('0x19f')});db['Campaign'][_0x957e('0x11c')](db[_0x957e('0x72')],{'as':_0x957e('0x14f'),'foreignKey':_0x957e('0x19f')});db['Campaign'][_0x957e('0x12a')](db[_0x957e('0x28')],{'as':_0x957e('0x28'),'foreignKey':_0x957e('0x151')});db[_0x957e('0xe7')][_0x957e('0x12a')](db[_0x957e('0x28')],{'as':_0x957e('0x152'),'foreignKey':_0x957e('0x153')});db[_0x957e('0xe7')][_0x957e('0x12a')](db[_0x957e('0x7d')],{'as':_0x957e('0x7d'),'foreignKey':_0x957e('0x154')});db[_0x957e('0xe7')]['belongsTo'](db[_0x957e('0xdf')],{'as':_0x957e('0xdf'),'foreignKey':_0x957e('0x1db')});db[_0x957e('0xe7')]['belongsToMany'](db[_0x957e('0xf5')],{'as':_0x957e('0x157'),'through':_0x957e('0x1dc')});db['Campaign'][_0x957e('0x12b')](db[_0x957e('0xf5')],{'as':'BlackLists','through':_0x957e('0x1dd')});db[_0x957e('0xeb')][_0x957e('0x12a')](db[_0x957e('0x67')],{'as':_0x957e('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0x957e('0xed')]['belongsTo'](db[_0x957e('0x169')],{});db[_0x957e('0xed')][_0x957e('0x12a')](db[_0x957e('0x41')],{});db['MailTransferReport'][_0x957e('0x12a')](db[_0x957e('0x3b')],{'foreignKey':_0x957e('0x1de'),'as':'FromAccount'});db[_0x957e('0xed')][_0x957e('0x12a')](db['User'],{'foreignKey':_0x957e('0x1df'),'as':_0x957e('0x1e0')});db[_0x957e('0xed')]['belongsTo'](db[_0x957e('0x116')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x957e('0xed')][_0x957e('0x12a')](db[_0x957e('0x3d')],{'foreignKey':_0x957e('0x1e1'),'as':_0x957e('0x1e2')});db[_0x957e('0xed')]['belongsTo'](db[_0x957e('0x3b')],{'foreignKey':_0x957e('0x1e3'),'as':_0x957e('0x1e4')});db['ChatTransferReport'][_0x957e('0x12a')](db[_0x957e('0x66')],{});db[_0x957e('0x1e5')][_0x957e('0x12a')](db[_0x957e('0x65')],{});db['ChatTransferReport']['belongsTo'](db[_0x957e('0x62')],{'foreignKey':_0x957e('0x1e6'),'as':_0x957e('0x1e7')});db['ChatTransferReport'][_0x957e('0x12a')](db[_0x957e('0x116')],{'foreignKey':'FromUserId','as':_0x957e('0x1e0')});db[_0x957e('0x1e5')][_0x957e('0x12a')](db[_0x957e('0x116')],{'foreignKey':'ToUserId','as':_0x957e('0x1e8')});db['ChatTransferReport']['belongsTo'](db[_0x957e('0x68')],{'foreignKey':_0x957e('0x1e9'),'as':_0x957e('0x1e2')});db[_0x957e('0x1e5')][_0x957e('0x12a')](db['ChatWebsite'],{'foreignKey':_0x957e('0x1ea'),'as':'ToAccount'});db[_0x957e('0xf0')][_0x957e('0x12a')](db['FaxMessage'],{});db[_0x957e('0xf0')][_0x957e('0x12a')](db[_0x957e('0x134')],{});db[_0x957e('0xf0')][_0x957e('0x12a')](db['FaxAccount'],{'foreignKey':_0x957e('0x1eb'),'as':_0x957e('0x1e7')});db[_0x957e('0xf0')][_0x957e('0x12a')](db['User'],{'foreignKey':_0x957e('0x1df'),'as':_0x957e('0x1e0')});db['FaxTransferReport'][_0x957e('0x12a')](db[_0x957e('0x116')],{'foreignKey':_0x957e('0x1ec'),'as':_0x957e('0x1e8')});db['FaxTransferReport'][_0x957e('0x12a')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x957e('0x1e2')});db[_0x957e('0xf0')][_0x957e('0x12a')](db[_0x957e('0x4b')],{'foreignKey':_0x957e('0x1ed'),'as':_0x957e('0x1e4')});db[_0x957e('0xf2')][_0x957e('0x12a')](db[_0x957e('0x60')],{});db[_0x957e('0xf2')][_0x957e('0x12a')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x957e('0x12a')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x957e('0x1e7')});db['OpenchannelTransferReport'][_0x957e('0x12a')](db[_0x957e('0x116')],{'foreignKey':_0x957e('0x1df'),'as':_0x957e('0x1e0')});db[_0x957e('0xf2')]['belongsTo'](db[_0x957e('0x116')],{'foreignKey':_0x957e('0x1ec'),'as':_0x957e('0x1e8')});db[_0x957e('0xf2')][_0x957e('0x12a')](db[_0x957e('0x13f')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db['OpenchannelTransferReport'][_0x957e('0x12a')](db[_0x957e('0x145')],{'foreignKey':_0x957e('0x1ee'),'as':_0x957e('0x1e4')});db[_0x957e('0x1ef')][_0x957e('0x12a')](db[_0x957e('0x58')],{});db[_0x957e('0x1ef')][_0x957e('0x12a')](db[_0x957e('0x56')],{});db[_0x957e('0x1ef')][_0x957e('0x12a')](db[_0x957e('0x53')],{'foreignKey':_0x957e('0x1f0'),'as':'FromAccount'});db[_0x957e('0x1ef')]['belongsTo'](db['User'],{'foreignKey':_0x957e('0x1df'),'as':_0x957e('0x1e0')});db[_0x957e('0x1ef')][_0x957e('0x12a')](db[_0x957e('0x116')],{'foreignKey':_0x957e('0x1ec'),'as':_0x957e('0x1e8')});db[_0x957e('0x1ef')][_0x957e('0x12a')](db[_0x957e('0x13d')],{'foreignKey':'ToSmsQueueId','as':_0x957e('0x1e2')});db[_0x957e('0x1ef')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x957e('0x1f1'),'as':_0x957e('0x1e4')});db[_0x957e('0xf5')][_0x957e('0x11c')](db[_0x957e('0x7a')],{'as':'Dispositions','foreignKey':_0x957e('0x16c'),'onDelete':_0x957e('0x117')});db[_0x957e('0xf5')][_0x957e('0x11c')](db[_0x957e('0x77')],{'as':_0x957e('0x1f2'),'foreignKey':_0x957e('0x16c')});db['CmList'][_0x957e('0x11c')](db['CmContact'],{'as':'Contacts','onDelete':_0x957e('0x117'),'foreignKey':_0x957e('0x16c')});db['CmList'][_0x957e('0x11c')](db[_0x957e('0x11f')],{'as':_0x957e('0x120'),'foreignKey':'ListId'});db[_0x957e('0xf5')]['hasMany'](db[_0x957e('0x75')],{'as':_0x957e('0x1f3'),'foreignKey':_0x957e('0x16c')});db['CmList'][_0x957e('0x11c')](db[_0x957e('0x76')],{'as':_0x957e('0x76'),'foreignKey':_0x957e('0x16c')});db['CmList'][_0x957e('0x12b')](db[_0x957e('0x19')],{'as':_0x957e('0x1f4'),'through':_0x957e('0x158')});db['CmList'][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':_0x957e('0x159'),'through':_0x957e('0x130')});db[_0x957e('0xf7')]['hasMany'](db[_0x957e('0x16')],{'as':_0x957e('0x11e'),'onDelete':'cascade'});db[_0x957e('0xf7')][_0x957e('0x12b')](db['User'],{'as':_0x957e('0x159'),'through':_0x957e('0x111')});db[_0x957e('0xf7')][_0x957e('0x12b')](db[_0x957e('0xe5')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x957e('0xf9')][_0x957e('0x11c')](db[_0x957e('0x116')],{'as':_0x957e('0x172'),'foreignKey':_0x957e('0x1f5')});db[_0x957e('0xf9')][_0x957e('0x11c')](db[_0x957e('0xfb')],{'as':'UserProfileSections','foreignKey':_0x957e('0x1f5'),'onDelete':_0x957e('0x117')});db[_0x957e('0xfb')]['hasMany'](db[_0x957e('0xfc')],{'as':_0x957e('0x1f6'),'foreignKey':_0x957e('0x1f7'),'onDelete':_0x957e('0x117')});db[_0x957e('0x100')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x957e('0x1f8'),'onDelete':_0x957e('0x117')});db[_0x957e('0x100')][_0x957e('0x11c')](db[_0x957e('0x168')],{'as':_0x957e('0x186'),'foreignKey':_0x957e('0x1f8')});db[_0x957e('0x100')][_0x957e('0x11c')](db[_0x957e('0x105')],{'as':_0x957e('0x15d'),'foreignKey':_0x957e('0x1f8')});db[_0x957e('0x100')]['hasMany'](db['WhatsappInteraction'],{'as':_0x957e('0x17a')});db[_0x957e('0x100')][_0x957e('0x11c')](db['WhatsappApplication'],{'as':_0x957e('0x16a'),'foreignKey':'WhatsappAccountId','onDelete':_0x957e('0x117')});db[_0x957e('0x100')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x100')]['belongsTo'](db[_0x957e('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x957e('0x156')});db[_0x957e('0x100')]['belongsToMany'](db['User'],{'as':_0x957e('0x159'),'through':'user_has_whatsapp_accounts'});db[_0x957e('0x102')][_0x957e('0x12a')](db[_0x957e('0x116')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x957e('0x12a')](db['WhatsappQueue'],{'onDelete':_0x957e('0x176')});db['WhatsappApplication'][_0x957e('0x12a')](db['WhatsappAccount'],{'onDelete':_0x957e('0x176')});db[_0x957e('0x102')][_0x957e('0x12a')](db[_0x957e('0x7d')],{'onDelete':_0x957e('0x176'),'foreignKey':_0x957e('0x154')});db[_0x957e('0x102')][_0x957e('0x12a')](db[_0x957e('0x88')],{'onDelete':'restrict','foreignKey':_0x957e('0x177')});db['WhatsappInteraction'][_0x957e('0x11c')](db[_0x957e('0x105')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x957e('0x1f9')});db[_0x957e('0x103')]['belongsTo'](db['WhatsappAccount'],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1f8')});db[_0x957e('0x103')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'as':_0x957e('0x162'),'foreignKey':_0x957e('0x16f')});db[_0x957e('0x103')][_0x957e('0x12a')](db['User'],{'as':_0x957e('0x187'),'foreignKey':_0x957e('0x118')});db['WhatsappInteraction'][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':'whatsapp_interaction_has_tags','as':_0x957e('0x181')});db[_0x957e('0x103')][_0x957e('0x12b')](db[_0x957e('0x88')],{'through':_0x957e('0x1af'),'as':_0x957e('0x171')});db[_0x957e('0x103')][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':'Users','through':_0x957e('0x137'),'foreignKey':_0x957e('0x1f9')});db['WhatsappMessage'][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':_0x957e('0x116')});db[_0x957e('0x105')][_0x957e('0x12a')](db[_0x957e('0x6e')],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x162')});db[_0x957e('0x105')]['belongsTo'](db[_0x957e('0x103')],{'onDelete':_0x957e('0x117'),'as':_0x957e('0x174'),'foreignKey':_0x957e('0x1f9')});db[_0x957e('0x105')][_0x957e('0x12a')](db[_0x957e('0x100')],{'as':_0x957e('0x17f'),'foreignKey':_0x957e('0x1f8')});db['WhatsappQueueReport'][_0x957e('0x12a')](db['WhatsappAccount'],{});db[_0x957e('0x1fa')][_0x957e('0x12a')](db[_0x957e('0xf5')],{'as':_0x957e('0x16b'),'foreignKey':_0x957e('0x16c')});db[_0x957e('0x1fa')][_0x957e('0x12a')](db['CmContact'],{'as':_0x957e('0x162'),'foreignKey':'ContactId'});db[_0x957e('0x1fa')][_0x957e('0x12a')](db['WhatsappInteraction'],{});db[_0x957e('0x1fa')]['belongsTo'](db[_0x957e('0x10a')],{});db['WhatsappQueueReport'][_0x957e('0x12a')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x957e('0x12a')](db[_0x957e('0x116')],{});db[_0x957e('0x108')][_0x957e('0x12a')](db[_0x957e('0x105')],{});db['WhatsappTransferReport'][_0x957e('0x12a')](db[_0x957e('0x103')],{});db[_0x957e('0x108')][_0x957e('0x12a')](db[_0x957e('0x100')],{'foreignKey':'FromWhatsappAccountId','as':_0x957e('0x1e7')});db[_0x957e('0x108')]['belongsTo'](db[_0x957e('0x100')],{'foreignKey':_0x957e('0x1fb'),'as':_0x957e('0x1e4')});db[_0x957e('0x108')]['belongsTo'](db[_0x957e('0x10a')],{'foreignKey':_0x957e('0x1fc'),'as':_0x957e('0x1e2')});db[_0x957e('0x108')][_0x957e('0x12a')](db['User'],{'foreignKey':_0x957e('0x1df'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0x957e('0x116')],{'foreignKey':_0x957e('0x1ec'),'as':_0x957e('0x1e8')});db['WhatsappQueue'][_0x957e('0x12b')](db[_0x957e('0x116')],{'as':'Agents','through':_0x957e('0x36'),'foreignKey':_0x957e('0x1fd')});db[_0x957e('0x10a')]['belongsToMany'](db[_0x957e('0xe5')],{'through':_0x957e('0x1da'),'as':_0x957e('0x15a')});db[_0x957e('0x112')][_0x957e('0x12a')](db[_0x957e('0x116')],{'as':_0x957e('0x1fe'),'foreignKey':'UserId','onDelete':_0x957e('0x117'),'hooks':!![]});db[_0x957e('0x10b')][_0x957e('0x119')](db[_0x957e('0xc7')],{'as':_0x957e('0xc7'),'onDelete':_0x957e('0x176')});db['CloudProvider'][_0x957e('0x119')](db['MailServerIn'],{'as':_0x957e('0x165'),'onDelete':_0x957e('0x176')});db[_0x957e('0x10b')]['hasOne'](db[_0x957e('0x39')],{'as':_0x957e('0x166'),'onDelete':_0x957e('0x176')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index afbc591..315c14b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bd3=['./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.13.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','default','then','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','use','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/sound','/api/tags','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields'];(function(_0x40be79,_0x389794){var _0x28537f=function(_0x40a702){while(--_0x40a702){_0x40be79['push'](_0x40be79['shift']());}};_0x28537f(++_0x389794);}(_0x4bd3,0x174));var _0x34bd=function(_0x3fa85d,_0x20e177){_0x3fa85d=_0x3fa85d-0x0;var _0x5e3d1a=_0x4bd3[_0x3fa85d];return _0x5e3d1a;};'use strict';var path=require(_0x34bd('0x0'));var express=require('express');var errors=require(_0x34bd('0x1'));var config=require(_0x34bd('0x2'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x34bd('0x3')]=function(_0x44854a){return setupLoggers(_0x44854a)[_0x34bd('0x4')](function(){_0x44854a['use'](_0x34bd('0x5'),require(_0x34bd('0x6')));_0x44854a['use'](_0x34bd('0x7'),require(_0x34bd('0x8')));_0x44854a['use'](_0x34bd('0x9'),require(_0x34bd('0xa')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc'),require(_0x34bd('0xd')));_0x44854a[_0x34bd('0xb')]('/api/voice/mohs',require(_0x34bd('0xe')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf'),require(_0x34bd('0x10')));_0x44854a['use']('/api/voice/recordings',require(_0x34bd('0x11')));_0x44854a['use']('/api/screen/recordings',require(_0x34bd('0x12')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x13'),require(_0x34bd('0x14')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x15'),require(_0x34bd('0x16')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x17'),require('./api/voiceCallReport'));_0x44854a[_0x34bd('0xb')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x18'),require(_0x34bd('0x19')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1a'),require(_0x34bd('0x1b')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1c'),require(_0x34bd('0x1d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1e'),require('./api/trunk'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1f'),require(_0x34bd('0x20')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x21'),require(_0x34bd('0x22')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x23'),require(_0x34bd('0x24')));_0x44854a['use'](_0x34bd('0x25'),require(_0x34bd('0x26')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x27'),require(_0x34bd('0x28')));_0x44854a['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x44854a['use'](_0x34bd('0x29'),require('./api/mailMessage'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x2a'),require(_0x34bd('0x2b')));_0x44854a['use'](_0x34bd('0x2c'),require(_0x34bd('0x2d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x2e'),require('./api/dashboard'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x2f'),require(_0x34bd('0x30')));_0x44854a[_0x34bd('0xb')]('/api/fax/accounts',require(_0x34bd('0x31')));_0x44854a[_0x34bd('0xb')]('/api/fax/applications',require(_0x34bd('0x32')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x33'),require(_0x34bd('0x34')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x35'),require(_0x34bd('0x36')));_0x44854a['use'](_0x34bd('0x37'),require(_0x34bd('0x38')));_0x44854a['use']('/api/fax/reports/queue',require(_0x34bd('0x39')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x3a'),require('./api/smsAccount'));_0x44854a['use'](_0x34bd('0x3b'),require(_0x34bd('0x3c')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x3d'),require('./api/smsInteraction'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x3e'),require(_0x34bd('0x3f')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x40'),require(_0x34bd('0x41')));_0x44854a['use'](_0x34bd('0x42'),require('./api/openchannelAccount'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x43'),require(_0x34bd('0x44')));_0x44854a['use'](_0x34bd('0x45'),require(_0x34bd('0x46')));_0x44854a['use'](_0x34bd('0x47'),require(_0x34bd('0x48')));_0x44854a[_0x34bd('0xb')]('/api/openchannel/queues',require(_0x34bd('0x49')));_0x44854a[_0x34bd('0xb')]('/api/chat/websites',require(_0x34bd('0x4a')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x4b'),require(_0x34bd('0x4c')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x4d'),require('./api/chatApplication'));_0x44854a['use']('/api/chat/interactions',require(_0x34bd('0x4e')));_0x44854a[_0x34bd('0xb')]('/api/chat/messages',require('./api/chatMessage'));_0x44854a[_0x34bd('0xb')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x4f'),require(_0x34bd('0x50')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x51'),require('./api/chatGroup'));_0x44854a['use'](_0x34bd('0x52'),require('./api/chatProactiveAction'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x53'),require(_0x34bd('0x54')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x55'),require('./api/cmContact'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x56'),require(_0x34bd('0x57')));_0x44854a[_0x34bd('0xb')]('/api/cm/hopper_black',require(_0x34bd('0x58')));_0x44854a['use'](_0x34bd('0x59'),require(_0x34bd('0x5a')));_0x44854a['use'](_0x34bd('0x5b'),require('./api/cmHopperHistory'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x5c'),require(_0x34bd('0x5d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x5e'),require(_0x34bd('0x5f')));_0x44854a[_0x34bd('0xb')]('/api/automations',require('./api/automation'));_0x44854a['use'](_0x34bd('0x60'),require(_0x34bd('0x61')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x62'),require('./api/disposition'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x63'),require(_0x34bd('0x64')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x65'),require('./api/interval'));_0x44854a[_0x34bd('0xb')]('/api/pauses',require('./api/pause'));_0x44854a[_0x34bd('0xb')]('/api/cdr',require(_0x34bd('0x66')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x67'),require(_0x34bd('0x68')));_0x44854a[_0x34bd('0xb')]('/api/schedules',require('./api/schedule'));_0x44854a[_0x34bd('0xb')]('/api/sounds',require(_0x34bd('0x69')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x6a'),require('./api/tag'));_0x44854a['use']('/api/contact_item_types',require('./api/contactItemType'));_0x44854a[_0x34bd('0xb')]('/api/cm_contact_has_items',require(_0x34bd('0x6b')));_0x44854a['use'](_0x34bd('0x6c'),require(_0x34bd('0x6d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x6e'),require(_0x34bd('0x6f')));_0x44854a['use'](_0x34bd('0x70'),require(_0x34bd('0x71')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x72'),require(_0x34bd('0x73')));_0x44854a['use'](_0x34bd('0x74'),require(_0x34bd('0x75')));_0x44854a['use'](_0x34bd('0x76'),require(_0x34bd('0x77')));_0x44854a['use']('/api/analytics/custom_reports',require(_0x34bd('0x78')));_0x44854a['use']('/api/analytics/default_reports',require(_0x34bd('0x79')));_0x44854a[_0x34bd('0xb')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x44854a['use']('/api/analytics/metrics',require(_0x34bd('0x7a')));_0x44854a[_0x34bd('0xb')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x44854a['use'](_0x34bd('0x7b'),require(_0x34bd('0x7c')));_0x44854a['use'](_0x34bd('0x7d'),require(_0x34bd('0x7e')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x7f'),require(_0x34bd('0x80')));_0x44854a[_0x34bd('0xb')]('/api/integrations/salesforce/fields',require(_0x34bd('0x81')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x82'),require(_0x34bd('0x83')));_0x44854a['use'](_0x34bd('0x84'),require('./api/intSugarcrmConfiguration'));_0x44854a[_0x34bd('0xb')]('/api/integrations/sugarcrm/fields',require(_0x34bd('0x85')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x86'),require(_0x34bd('0x87')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x88'),require(_0x34bd('0x89')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x8a'),require(_0x34bd('0x8b')));_0x44854a[_0x34bd('0xb')]('/api/integrations/zoho/accounts',require(_0x34bd('0x8c')));_0x44854a['use'](_0x34bd('0x8d'),require('./api/intZohoConfiguration'));_0x44854a[_0x34bd('0xb')]('/api/integrations/zoho/fields',require(_0x34bd('0x8e')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x8f'),require(_0x34bd('0x90')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x91'),require(_0x34bd('0x92')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x93'),require(_0x34bd('0x94')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x95'),require(_0x34bd('0x96')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x97'),require('./api/intFreshdeskConfiguration'));_0x44854a['use'](_0x34bd('0x98'),require(_0x34bd('0x99')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x9a'),require(_0x34bd('0x9b')));_0x44854a['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x44854a['use'](_0x34bd('0x9c'),require(_0x34bd('0x9d')));_0x44854a['use'](_0x34bd('0x9e'),require(_0x34bd('0x9f')));_0x44854a[_0x34bd('0xb')]('/api/integrations/servicenow/configurations',require(_0x34bd('0xa0')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa1'),require(_0x34bd('0xa2')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa3'),require(_0x34bd('0xa4')));_0x44854a[_0x34bd('0xb')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x44854a[_0x34bd('0xb')]('/api/integrations/dynamics365/fields',require(_0x34bd('0xa5')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa6'),require('./api/intFreshsalesAccount'));_0x44854a['use'](_0x34bd('0xa7'),require(_0x34bd('0xa8')));_0x44854a[_0x34bd('0xb')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa9'),require(_0x34bd('0xaa')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xab'),require(_0x34bd('0xac')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xad'),require(_0x34bd('0xae')));_0x44854a['use']('/api/jscripty/answers/reports',require(_0x34bd('0xaf')));_0x44854a['use'](_0x34bd('0xb0'),require(_0x34bd('0xb1')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xb2'),require('./api/jscriptySessionReport'));_0x44854a['use'](_0x34bd('0xb3'),require(_0x34bd('0xb4')));_0x44854a[_0x34bd('0xb')]('/api/square/reports',require(_0x34bd('0xb5')));_0x44854a['use'](_0x34bd('0xb6'),require(_0x34bd('0xb7')));_0x44854a[_0x34bd('0xb')]('/api/jscripty/projects',require(_0x34bd('0xb8')));_0x44854a['use']('/api/settings',require(_0x34bd('0xb9')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xba'),require('./api/squareOdbc'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xbb'),require(_0x34bd('0xbc')));_0x44854a['use'](_0x34bd('0xbd'),require(_0x34bd('0xbe')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xbf'),require(_0x34bd('0xc0')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc1'),require(_0x34bd('0xc2')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc3'),require(_0x34bd('0xc4')));_0x44854a['use'](_0x34bd('0xc5'),require('./api/campaign'));_0x44854a[_0x34bd('0xb')]('/api/migrations',require(_0x34bd('0xc6')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc7'),require(_0x34bd('0xc8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc9'),require(_0x34bd('0xca')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xcb'),require(_0x34bd('0xcc')));_0x44854a['use']('/api/chat/reports/transfer',require(_0x34bd('0xcd')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xce'),require('./api/faxTransferReport'));_0x44854a['use']('/api/openchannel/reports/transfer',require(_0x34bd('0xcf')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xd0'),require(_0x34bd('0xd1')));_0x44854a[_0x34bd('0xb')]('/api/cm/lists',require(_0x34bd('0xd2')));_0x44854a['use'](_0x34bd('0xd3'),require(_0x34bd('0xd4')));_0x44854a['use'](_0x34bd('0xd5'),require('./api/userProfile'));_0x44854a[_0x34bd('0xb')]('/api/userProfile/sections',require(_0x34bd('0xd6')));_0x44854a['use'](_0x34bd('0xd7'),require(_0x34bd('0xd8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xd9'),require(_0x34bd('0xda')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xdb'),require(_0x34bd('0xdc')));_0x44854a['use'](_0x34bd('0xdd'),require(_0x34bd('0xde')));_0x44854a[_0x34bd('0xb')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x44854a['use'](_0x34bd('0xdf'),require(_0x34bd('0xe0')));_0x44854a['use'](_0x34bd('0xe1'),require('./api/whatsappQueueReport'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe2'),require(_0x34bd('0xe3')));_0x44854a['use'](_0x34bd('0xe4'),require('./api/whatsappQueue'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe5'),require(_0x34bd('0xe6')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe7'),require(_0x34bd('0xe8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe9'),require(_0x34bd('0xea')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xeb'),require(_0x34bd('0xec')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xed'),require('./api/authLocal'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xee'),require(_0x34bd('0xef')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf0'),require('./api/authActiveDirectory'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf1'),require(_0x34bd('0xf2')));_0x44854a[_0x34bd('0xb')]('/api/rpc',require(_0x34bd('0xf3')));_0x44854a['use']('/api/version',require('./api/version'));_0x44854a['use'](_0x34bd('0xf4'),require(_0x34bd('0xf5')));_0x44854a[_0x34bd('0xb')]('/api/pm2',require(_0x34bd('0xf6')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf7'),require(_0x34bd('0xf8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf9'),clientSideLogs);_0x44854a[_0x34bd('0xb')](_0x34bd('0xfa'),express[_0x34bd('0xfb')](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],'/apidoc')));_0x44854a['use'](_0x34bd('0xfe'),express['static'](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],_0x34bd('0xfe'))));_0x44854a[_0x34bd('0xb')](_0x34bd('0xff'),express[_0x34bd('0xfb')](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],'/demo')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x100'),express[_0x34bd('0xfb')](path['join'](config[_0x34bd('0xfd')],_0x34bd('0x101'),_0x34bd('0x102'))));_0x44854a[_0x34bd('0xb')]('/plugins',express[_0x34bd('0xfb')](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],_0x34bd('0x103'))));_0x44854a[_0x34bd('0x104')](_0x34bd('0x105'))[_0x34bd('0x106')](errors[0x194]);_0x44854a[_0x34bd('0x104')]('/*')[_0x34bd('0x106')](function(_0x3b95f6,_0x4b4347){_0x4b4347[_0x34bd('0x107')](path[_0x34bd('0x108')](_0x44854a[_0x34bd('0x106')](_0x34bd('0x109'))+_0x34bd('0x10a')));});return _0x44854a;});}; \ No newline at end of file +var _0x2da6=['/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/automation','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/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/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','get','route','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2da6,0x1dd));var _0x62da=function(_0x6a3595,_0x314812){_0x6a3595=_0x6a3595-0x0;var _0x38324d=_0x2da6[_0x6a3595];return _0x38324d;};'use strict';var path=require(_0x62da('0x0'));var express=require(_0x62da('0x1'));var errors=require(_0x62da('0x2'));var config=require(_0x62da('0x3'));var setupLoggers=require(_0x62da('0x4'))[_0x62da('0x5')];var clientSideLogs=require(_0x62da('0x6'));exports[_0x62da('0x7')]=function(_0x4c079d){return setupLoggers(_0x4c079d)['then'](function(){_0x4c079d[_0x62da('0x8')](_0x62da('0x9'),require(_0x62da('0xa')));_0x4c079d[_0x62da('0x8')](_0x62da('0xb'),require(_0x62da('0xc')));_0x4c079d[_0x62da('0x8')](_0x62da('0xd'),require(_0x62da('0xe')));_0x4c079d['use'](_0x62da('0xf'),require(_0x62da('0x10')));_0x4c079d[_0x62da('0x8')](_0x62da('0x11'),require('./api/voiceMusicOnHold'));_0x4c079d[_0x62da('0x8')](_0x62da('0x12'),require(_0x62da('0x13')));_0x4c079d[_0x62da('0x8')](_0x62da('0x14'),require('./api/voiceRecording'));_0x4c079d[_0x62da('0x8')](_0x62da('0x15'),require(_0x62da('0x16')));_0x4c079d[_0x62da('0x8')](_0x62da('0x17'),require('./api/voiceMail'));_0x4c079d['use'](_0x62da('0x18'),require(_0x62da('0x19')));_0x4c079d[_0x62da('0x8')](_0x62da('0x1a'),require(_0x62da('0x1b')));_0x4c079d[_0x62da('0x8')](_0x62da('0x1c'),require(_0x62da('0x1d')));_0x4c079d[_0x62da('0x8')](_0x62da('0x1e'),require(_0x62da('0x1f')));_0x4c079d[_0x62da('0x8')](_0x62da('0x20'),require(_0x62da('0x21')));_0x4c079d['use']('/api/members/reports',require(_0x62da('0x22')));_0x4c079d['use'](_0x62da('0x23'),require(_0x62da('0x24')));_0x4c079d[_0x62da('0x8')]('/api/voice/transfers/reports',require(_0x62da('0x25')));_0x4c079d['use'](_0x62da('0x26'),require(_0x62da('0x27')));_0x4c079d[_0x62da('0x8')](_0x62da('0x28'),require(_0x62da('0x29')));_0x4c079d[_0x62da('0x8')](_0x62da('0x2a'),require(_0x62da('0x2b')));_0x4c079d[_0x62da('0x8')]('/api/mail/substatuses',require(_0x62da('0x2c')));_0x4c079d[_0x62da('0x8')](_0x62da('0x2d'),require(_0x62da('0x2e')));_0x4c079d[_0x62da('0x8')](_0x62da('0x2f'),require(_0x62da('0x30')));_0x4c079d['use']('/api/mail/applications',require('./api/mailApplication'));_0x4c079d[_0x62da('0x8')](_0x62da('0x31'),require(_0x62da('0x32')));_0x4c079d[_0x62da('0x8')]('/api/dashboards',require(_0x62da('0x33')));_0x4c079d[_0x62da('0x8')]('/api/dashboards/items',require(_0x62da('0x34')));_0x4c079d[_0x62da('0x8')](_0x62da('0x35'),require('./api/faxAccount'));_0x4c079d[_0x62da('0x8')](_0x62da('0x36'),require(_0x62da('0x37')));_0x4c079d['use']('/api/fax/interactions',require(_0x62da('0x38')));_0x4c079d[_0x62da('0x8')](_0x62da('0x39'),require('./api/faxMessage'));_0x4c079d[_0x62da('0x8')](_0x62da('0x3a'),require(_0x62da('0x3b')));_0x4c079d[_0x62da('0x8')](_0x62da('0x3c'),require(_0x62da('0x3d')));_0x4c079d['use'](_0x62da('0x3e'),require('./api/smsAccount'));_0x4c079d[_0x62da('0x8')](_0x62da('0x3f'),require(_0x62da('0x40')));_0x4c079d[_0x62da('0x8')](_0x62da('0x41'),require(_0x62da('0x42')));_0x4c079d['use'](_0x62da('0x43'),require(_0x62da('0x44')));_0x4c079d[_0x62da('0x8')]('/api/sms/queues',require(_0x62da('0x45')));_0x4c079d[_0x62da('0x8')](_0x62da('0x46'),require('./api/openchannelAccount'));_0x4c079d[_0x62da('0x8')](_0x62da('0x47'),require('./api/openchannelApplication'));_0x4c079d[_0x62da('0x8')](_0x62da('0x48'),require('./api/openchannelInteraction'));_0x4c079d[_0x62da('0x8')](_0x62da('0x49'),require(_0x62da('0x4a')));_0x4c079d[_0x62da('0x8')](_0x62da('0x4b'),require(_0x62da('0x4c')));_0x4c079d[_0x62da('0x8')](_0x62da('0x4d'),require(_0x62da('0x4e')));_0x4c079d[_0x62da('0x8')](_0x62da('0x4f'),require(_0x62da('0x50')));_0x4c079d[_0x62da('0x8')](_0x62da('0x51'),require(_0x62da('0x52')));_0x4c079d[_0x62da('0x8')](_0x62da('0x53'),require('./api/chatInteraction'));_0x4c079d[_0x62da('0x8')]('/api/chat/messages',require(_0x62da('0x54')));_0x4c079d[_0x62da('0x8')](_0x62da('0x55'),require('./api/chatOfflineMessage'));_0x4c079d[_0x62da('0x8')](_0x62da('0x56'),require(_0x62da('0x57')));_0x4c079d[_0x62da('0x8')]('/api/chat/groups',require(_0x62da('0x58')));_0x4c079d[_0x62da('0x8')](_0x62da('0x59'),require(_0x62da('0x5a')));_0x4c079d[_0x62da('0x8')](_0x62da('0x5b'),require(_0x62da('0x5c')));_0x4c079d[_0x62da('0x8')](_0x62da('0x5d'),require('./api/cmContact'));_0x4c079d[_0x62da('0x8')](_0x62da('0x5e'),require('./api/cmHopper'));_0x4c079d[_0x62da('0x8')](_0x62da('0x5f'),require(_0x62da('0x60')));_0x4c079d[_0x62da('0x8')](_0x62da('0x61'),require(_0x62da('0x62')));_0x4c079d[_0x62da('0x8')](_0x62da('0x63'),require('./api/cmHopperHistory'));_0x4c079d['use']('/api/cm/custom_fields',require(_0x62da('0x64')));_0x4c079d['use'](_0x62da('0x65'),require('./api/action'));_0x4c079d['use']('/api/automations',require(_0x62da('0x66')));_0x4c079d[_0x62da('0x8')]('/api/canned_answers',require(_0x62da('0x67')));_0x4c079d['use'](_0x62da('0x68'),require('./api/disposition'));_0x4c079d['use'](_0x62da('0x69'),require(_0x62da('0x6a')));_0x4c079d[_0x62da('0x8')]('/api/intervals',require(_0x62da('0x6b')));_0x4c079d[_0x62da('0x8')](_0x62da('0x6c'),require(_0x62da('0x6d')));_0x4c079d[_0x62da('0x8')]('/api/cdr',require('./api/cdr'));_0x4c079d[_0x62da('0x8')](_0x62da('0x6e'),require(_0x62da('0x6f')));_0x4c079d[_0x62da('0x8')](_0x62da('0x70'),require('./api/schedule'));_0x4c079d['use'](_0x62da('0x71'),require(_0x62da('0x72')));_0x4c079d['use'](_0x62da('0x73'),require(_0x62da('0x74')));_0x4c079d[_0x62da('0x8')](_0x62da('0x75'),require(_0x62da('0x76')));_0x4c079d['use'](_0x62da('0x77'),require(_0x62da('0x78')));_0x4c079d[_0x62da('0x8')](_0x62da('0x79'),require(_0x62da('0x7a')));_0x4c079d[_0x62da('0x8')](_0x62da('0x7b'),require(_0x62da('0x7c')));_0x4c079d[_0x62da('0x8')]('/api/triggers',require(_0x62da('0x7d')));_0x4c079d[_0x62da('0x8')]('/api/variables',require('./api/variable'));_0x4c079d['use'](_0x62da('0x7e'),require(_0x62da('0x7f')));_0x4c079d[_0x62da('0x8')]('/api/integrations/reports',require(_0x62da('0x80')));_0x4c079d[_0x62da('0x8')](_0x62da('0x81'),require('./api/analyticCustomReport'));_0x4c079d[_0x62da('0x8')](_0x62da('0x82'),require(_0x62da('0x83')));_0x4c079d[_0x62da('0x8')]('/api/analytics/extracted_reports',require(_0x62da('0x84')));_0x4c079d[_0x62da('0x8')](_0x62da('0x85'),require(_0x62da('0x86')));_0x4c079d[_0x62da('0x8')](_0x62da('0x87'),require(_0x62da('0x88')));_0x4c079d[_0x62da('0x8')](_0x62da('0x89'),require('./api/analyticTreeReport'));_0x4c079d['use'](_0x62da('0x8a'),require('./api/intSalesforceAccount'));_0x4c079d['use']('/api/integrations/salesforce/configurations',require(_0x62da('0x8b')));_0x4c079d[_0x62da('0x8')](_0x62da('0x8c'),require('./api/intSalesforceField'));_0x4c079d[_0x62da('0x8')](_0x62da('0x8d'),require(_0x62da('0x8e')));_0x4c079d[_0x62da('0x8')]('/api/integrations/sugarcrm/configurations',require(_0x62da('0x8f')));_0x4c079d[_0x62da('0x8')](_0x62da('0x90'),require('./api/intSugarcrmField'));_0x4c079d[_0x62da('0x8')]('/api/integrations/desk/accounts',require(_0x62da('0x91')));_0x4c079d['use'](_0x62da('0x92'),require(_0x62da('0x93')));_0x4c079d[_0x62da('0x8')](_0x62da('0x94'),require(_0x62da('0x95')));_0x4c079d[_0x62da('0x8')](_0x62da('0x96'),require('./api/intZohoAccount'));_0x4c079d[_0x62da('0x8')](_0x62da('0x97'),require('./api/intZohoConfiguration'));_0x4c079d['use'](_0x62da('0x98'),require('./api/intZohoField'));_0x4c079d['use'](_0x62da('0x99'),require(_0x62da('0x9a')));_0x4c079d[_0x62da('0x8')](_0x62da('0x9b'),require(_0x62da('0x9c')));_0x4c079d[_0x62da('0x8')](_0x62da('0x9d'),require(_0x62da('0x9e')));_0x4c079d[_0x62da('0x8')](_0x62da('0x9f'),require(_0x62da('0xa0')));_0x4c079d['use']('/api/integrations/freshdesk/configurations',require(_0x62da('0xa1')));_0x4c079d[_0x62da('0x8')]('/api/integrations/freshdesk/fields',require(_0x62da('0xa2')));_0x4c079d[_0x62da('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x4c079d['use'](_0x62da('0xa3'),require(_0x62da('0xa4')));_0x4c079d['use'](_0x62da('0xa5'),require('./api/intVtigerField'));_0x4c079d[_0x62da('0x8')](_0x62da('0xa6'),require(_0x62da('0xa7')));_0x4c079d[_0x62da('0x8')](_0x62da('0xa8'),require('./api/intServicenowConfiguration'));_0x4c079d['use'](_0x62da('0xa9'),require('./api/intServicenowField'));_0x4c079d[_0x62da('0x8')](_0x62da('0xaa'),require('./api/intDynamics365Account'));_0x4c079d[_0x62da('0x8')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x4c079d['use']('/api/integrations/dynamics365/fields',require(_0x62da('0xab')));_0x4c079d[_0x62da('0x8')](_0x62da('0xac'),require(_0x62da('0xad')));_0x4c079d[_0x62da('0x8')](_0x62da('0xae'),require(_0x62da('0xaf')));_0x4c079d['use']('/api/integrations/freshsales/fields',require(_0x62da('0xb0')));_0x4c079d[_0x62da('0x8')](_0x62da('0xb1'),require('./api/network'));_0x4c079d[_0x62da('0x8')](_0x62da('0xb2'),require('./api/chatQueueReport'));_0x4c079d['use'](_0x62da('0xb3'),require(_0x62da('0xb4')));_0x4c079d[_0x62da('0x8')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x4c079d[_0x62da('0x8')](_0x62da('0xb5'),require(_0x62da('0xb6')));_0x4c079d['use'](_0x62da('0xb7'),require(_0x62da('0xb8')));_0x4c079d['use'](_0x62da('0xb9'),require(_0x62da('0xba')));_0x4c079d[_0x62da('0x8')](_0x62da('0xbb'),require(_0x62da('0xbc')));_0x4c079d[_0x62da('0x8')](_0x62da('0xbd'),require(_0x62da('0xbe')));_0x4c079d[_0x62da('0x8')](_0x62da('0xbf'),require('./api/jscriptyProject'));_0x4c079d[_0x62da('0x8')](_0x62da('0xc0'),require('./api/setting'));_0x4c079d['use'](_0x62da('0xc1'),require(_0x62da('0xc2')));_0x4c079d['use'](_0x62da('0xc3'),require(_0x62da('0xc4')));_0x4c079d[_0x62da('0x8')](_0x62da('0xc5'),require('./api/squareRecording'));_0x4c079d[_0x62da('0x8')](_0x62da('0xc6'),require(_0x62da('0xc7')));_0x4c079d[_0x62da('0x8')](_0x62da('0xc8'),require(_0x62da('0xc9')));_0x4c079d[_0x62da('0x8')](_0x62da('0xca'),require(_0x62da('0xcb')));_0x4c079d[_0x62da('0x8')](_0x62da('0xcc'),require(_0x62da('0xcd')));_0x4c079d[_0x62da('0x8')](_0x62da('0xce'),require(_0x62da('0xcf')));_0x4c079d[_0x62da('0x8')](_0x62da('0xd0'),require(_0x62da('0xd1')));_0x4c079d['use']('/api/plugins',require(_0x62da('0xd2')));_0x4c079d[_0x62da('0x8')](_0x62da('0xd3'),require(_0x62da('0xd4')));_0x4c079d['use']('/api/chat/reports/transfer',require(_0x62da('0xd5')));_0x4c079d[_0x62da('0x8')](_0x62da('0xd6'),require(_0x62da('0xd7')));_0x4c079d[_0x62da('0x8')](_0x62da('0xd8'),require(_0x62da('0xd9')));_0x4c079d[_0x62da('0x8')](_0x62da('0xda'),require('./api/smsTransferReport'));_0x4c079d[_0x62da('0x8')](_0x62da('0xdb'),require(_0x62da('0xdc')));_0x4c079d[_0x62da('0x8')](_0x62da('0xdd'),require('./api/voicePrefix'));_0x4c079d[_0x62da('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x4c079d['use'](_0x62da('0xde'),require(_0x62da('0xdf')));_0x4c079d['use'](_0x62da('0xe0'),require(_0x62da('0xe1')));_0x4c079d['use']('/api/userNotifications',require('./api/userNotification'));_0x4c079d[_0x62da('0x8')](_0x62da('0xe2'),require(_0x62da('0xe3')));_0x4c079d[_0x62da('0x8')](_0x62da('0xe4'),require('./api/whatsappApplication'));_0x4c079d['use']('/api/whatsapp/interactions',require(_0x62da('0xe5')));_0x4c079d[_0x62da('0x8')](_0x62da('0xe6'),require(_0x62da('0xe7')));_0x4c079d[_0x62da('0x8')](_0x62da('0xe8'),require(_0x62da('0xe9')));_0x4c079d[_0x62da('0x8')](_0x62da('0xea'),require('./api/whatsappTransferReport'));_0x4c079d[_0x62da('0x8')]('/api/whatsapp/queues',require(_0x62da('0xeb')));_0x4c079d[_0x62da('0x8')](_0x62da('0xec'),require(_0x62da('0xed')));_0x4c079d[_0x62da('0x8')](_0x62da('0xee'),require(_0x62da('0xef')));_0x4c079d[_0x62da('0x8')]('/api/user-settings',require(_0x62da('0xf0')));_0x4c079d[_0x62da('0x8')]('/api/mail_interaction_has_tags',require('./api/mailInteractionHasTag'));_0x4c079d[_0x62da('0x8')](_0x62da('0xf1'),require(_0x62da('0xf2')));_0x4c079d['use'](_0x62da('0xf3'),require(_0x62da('0xf4')));_0x4c079d[_0x62da('0x8')](_0x62da('0xf5'),require(_0x62da('0xf6')));_0x4c079d[_0x62da('0x8')]('/api/jira',require(_0x62da('0xf7')));_0x4c079d[_0x62da('0x8')](_0x62da('0xf8'),require(_0x62da('0xf9')));_0x4c079d[_0x62da('0x8')](_0x62da('0xfa'),require(_0x62da('0xfb')));_0x4c079d[_0x62da('0x8')]('/api/system',require(_0x62da('0xfc')));_0x4c079d[_0x62da('0x8')](_0x62da('0xfd'),require(_0x62da('0xfe')));_0x4c079d[_0x62da('0x8')](_0x62da('0xff'),require(_0x62da('0x100')));_0x4c079d['use'](_0x62da('0x101'),clientSideLogs);_0x4c079d[_0x62da('0x8')](_0x62da('0x102'),express[_0x62da('0x103')](path[_0x62da('0x104')](config['root'],_0x62da('0x102'))));_0x4c079d[_0x62da('0x8')](_0x62da('0x105'),express['static'](path['join'](config[_0x62da('0x106')],_0x62da('0x105'))));_0x4c079d['use']('/demo',express[_0x62da('0x103')](path[_0x62da('0x104')](config['root'],_0x62da('0x107'))));_0x4c079d[_0x62da('0x8')](_0x62da('0x108'),express[_0x62da('0x103')](path['join'](config[_0x62da('0x106')],_0x62da('0x109'),_0x62da('0x10a'))));_0x4c079d[_0x62da('0x8')](_0x62da('0x10b'),express[_0x62da('0x103')](path[_0x62da('0x104')](config[_0x62da('0x106')],_0x62da('0x10c'))));_0x4c079d['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x62da('0x10d')](errors[0x194]);_0x4c079d[_0x62da('0x10e')]('/*')['get'](function(_0x10caa6,_0x1dc6c3){_0x1dc6c3[_0x62da('0x10f')](path[_0x62da('0x110')](_0x4c079d['get'](_0x62da('0x111'))+_0x62da('0x112')));});return _0x4c079d;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 13290d2..6cd134d 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc550=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc'];(function(_0xd7e057,_0xd71681){var _0x4f8e85=function(_0x24f7c8){while(--_0x24f7c8){_0xd7e057['push'](_0xd7e057['shift']());}};_0x4f8e85(++_0xd71681);}(_0xc550,0x1f2));var _0x0c55=function(_0x58fe86,_0x19655f){_0x58fe86=_0x58fe86-0x0;var _0x3f0732=_0xc550[_0x58fe86];return _0x3f0732;};'use strict';var jayson=require(_0x0c55('0x0'));var _=require(_0x0c55('0x1'));var config=require(_0x0c55('0x2'));exports['listen']=function(){return new Promise(function(_0x5620e4,_0x242b88){var _0x524e00={};_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x4')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/voiceExtension/voiceExtension.rpc'));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x5')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x6')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x7')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x8')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x9')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xa')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/memberReport/memberReport.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xb')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xc')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xd')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xe')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0xf')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x10')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x11')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x12')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x13')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x14')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/faxAccount/faxAccount.rpc'));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x15')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x16')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x17')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/faxQueue/faxQueue.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x18')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x19')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1a')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1b')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1c')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1d')));_0x524e00=_['merge'](_0x524e00,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1e')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1f')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x20')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/chatInteraction/chatInteraction.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x21')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x22')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x23')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x24')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x25')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x26')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x27')));_0x524e00=_['merge'](_0x524e00,require('../api/interval/interval.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x28')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x29')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/template/template.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/trigger/trigger.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/variable/variable.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2a')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x2b')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x524e00=_['merge'](_0x524e00,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2c')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x2d')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2e')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2f')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x30')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x31')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/squareReport/squareReport.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x32')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x33')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x34')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x35')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x36')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x37')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x38')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/attachment/attachment.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x39')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3a')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3b')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3c')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3d')));var _0x4f5a29=jayson['server'](_0x524e00)[_0x0c55('0x3e')]();var _0x2afcb9=config[_0x0c55('0x3f')][_0x0c55('0x40')]||config['port']+0x1;var _0x965084=config[_0x0c55('0x3f')]['ip']||_0x0c55('0x41');_0x4f5a29['on'](_0x0c55('0x42'),function(_0x4d95c1){return _0x242b88(_0x4d95c1);});_0x4f5a29[_0x0c55('0x43')](_0x2afcb9,_0x965084,function(){console[_0x0c55('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x965084,_0x2afcb9);require(_0x0c55('0x45'))[_0x0c55('0x46')]();return _0x5620e4(_0x0c55('0x47')+_0x965084+':'+_0x2afcb9);});});}; \ No newline at end of file +var _0x3975=['../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc'];(function(_0x1468e7,_0x3cfcee){var _0x1d7e66=function(_0x190d46){while(--_0x190d46){_0x1468e7['push'](_0x1468e7['shift']());}};_0x1d7e66(++_0x3cfcee);}(_0x3975,0x197));var _0x5397=function(_0x43b0d2,_0x44d942){_0x43b0d2=_0x43b0d2-0x0;var _0x154a44=_0x3975[_0x43b0d2];return _0x154a44;};'use strict';var jayson=require(_0x5397('0x0'));var _=require(_0x5397('0x1'));var config=require('../config/environment');exports[_0x5397('0x2')]=function(){return new Promise(function(_0x5d2737,_0x4f2f47){var _0xee7ee0={};_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/user/user.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x4')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x5')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x6')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x7')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x8')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x9')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0xa')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0xb')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0xc')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0xd')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0xe')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0xf')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x10')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/mailInteraction/mailInteraction.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/mailMessage/mailMessage.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x11')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x12')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x13')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x14')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x15')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x16')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/faxQueue/faxQueue.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x17')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x18')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x19')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x1a')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/smsQueue/smsQueue.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x1b')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x1c')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x1d')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x1e')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x1f')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x20')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x21')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x22')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x23')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x24')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x25')));_0xee7ee0=_['merge'](_0xee7ee0,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x26')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x27')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x28')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x29')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x2a')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x2b')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x2c')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x2d')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x2e')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x2f')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x30')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/intDeskAccount/intDeskAccount.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x31')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x32')));_0xee7ee0=_['merge'](_0xee7ee0,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x33')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x34')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x35')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x36')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x37')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x38')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x39')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x3a')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x3b')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x3c')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x3d')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x3e')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x3f')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x40')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x41')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x42')));_0xee7ee0=_['merge'](_0xee7ee0,require(_0x5397('0x43')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require(_0x5397('0x44')));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xee7ee0=_[_0x5397('0x3')](_0xee7ee0,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x211a09=jayson[_0x5397('0x45')](_0xee7ee0)[_0x5397('0x46')]();var _0x52c40c=config[_0x5397('0x47')][_0x5397('0x48')]||config[_0x5397('0x48')]+0x1;var _0x45fe83=config[_0x5397('0x47')]['ip']||'localhost';_0x211a09['on']('error',function(_0x5aa48f){return _0x4f2f47(_0x5aa48f);});_0x211a09[_0x5397('0x2')](_0x52c40c,_0x45fe83,function(){console[_0x5397('0x49')](_0x5397('0x4a'),_0x45fe83,_0x52c40c);require(_0x5397('0x4b'))[_0x5397('0x4c')]();return _0x5d2737(_0x5397('0x4d')+_0x45fe83+':'+_0x52c40c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5baa2a1..81a22da 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 _0xf9f9=['setEncoding','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','sendRequest','sync','answer','prototype','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\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','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout'];(function(_0x55cdc5,_0x2b2297){var _0x29acd5=function(_0x405234){while(--_0x405234){_0x55cdc5['push'](_0x55cdc5['shift']());}};_0x29acd5(++_0x2b2297);}(_0xf9f9,0x16f));var _0x9f9f=function(_0x22ad6c,_0x32fe9f){_0x22ad6c=_0x22ad6c-0x0;var _0x1dc229=_0xf9f9[_0x22ad6c];return _0x1dc229;};'use strict';var util=require('util');var _=require(_0x9f9f('0x0'));var EventEmitter=require(_0x9f9f('0x1'))[_0x9f9f('0x2')];var AGIReply=require(_0x9f9f('0x3'));var AGIError=require(_0x9f9f('0x4'));function AGIChannel(_0x739f32){var _0x1d8be4=this,_0x424d97=new AGIReply(),_0x34c695=![],_0x4480d5={};EventEmitter[_0x9f9f('0x5')](_0x1d8be4);_0x739f32['setEncoding'](_0x9f9f('0x6'));_0x739f32[_0x9f9f('0x7')](0x8*0x3c*0x3c*0x3e8);_0x424d97[_0x9f9f('0x8')]('utf8');_0x424d97['on'](_0x9f9f('0x9'),function(_0x3ae152){for(var _0xbccdf4 in _0x3ae152){_0x1d8be4[_0xbccdf4]=_0x3ae152[_0xbccdf4];}_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0xb'));});_0x424d97['on'](_0x9f9f('0xc'),function(_0x4ee109){if(_0x4ee109['toLowerCase']()==_0x9f9f('0xd')){_0x1d8be4['emit'](_0x9f9f('0xd'));return;}if(_0x4ee109[_0x9f9f('0xe')](0x0,0xb)==_0x9f9f('0xf')){_0x34c695=!![];}if(_0x34c695){_0x4480d5['rx']+=_0x4ee109+'\x0a';if(_0x4ee109[_0x9f9f('0x10')](_0x9f9f('0x11'))!=-0x1){_0x34c695=![];}}else{_0x4480d5['rx']=_0x4ee109;}if(_0x34c695){return;}if(typeof _0x4480d5['cb']==_0x9f9f('0x12')){var _0x56b0f6=_0x4480d5['rx'][_0x9f9f('0xe')](0x0,0x3),_0xf3a834=null,_0x552379=null;_0x56b0f6=parseInt(_0x56b0f6);if(isNaN(_0x56b0f6)){_0x4480d5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x56b0f6!=0xc8){_0x4480d5['cb'](null,{'code':_0x56b0f6,'result':-0x1,'extra':'KO'});return;}_0xf3a834=_0x4480d5['rx']['substring'](0x4)[_0x9f9f('0x13')](_0x9f9f('0x14'),'');if(_0xf3a834[_0x9f9f('0x15')]('\x20')!=-0x1){_0xf3a834=_0xf3a834[_0x9f9f('0x16')](0x0,_0xf3a834[_0x9f9f('0x15')]('\x20'));}if(_[_0x9f9f('0x17')](_0xf3a834,'-1')){_0xf3a834=parseInt(_0xf3a834);}_0x552379=_0x4480d5['rx']['split']('\x20');if(_0x552379[_0x9f9f('0x18')]==0x3){_0x552379=_0x552379[0x2]['substring'](0x1,_0x552379[0x2][_0x9f9f('0x18')]-0x1);}else if(_0x552379[_0x9f9f('0x18')]>0x3){var _0x161525=/\((.+)\)/;var _0x1c9065=_0x4480d5['rx'][_0x9f9f('0x19')](_0x161525);if(_0x1c9065){_0x552379=_0x1c9065[0x1];}else{_0x552379=null;}}else{_0x552379=null;}_0x4480d5['cb'](null,{'code':_0x56b0f6,'result':_0xf3a834,'extra':_0x552379});}});_0x739f32['on'](_0x9f9f('0x1a'),function(_0x1fa920){_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x1fa920[_0x9f9f('0x1b')]));});_0x739f32['on'](_0x9f9f('0x1c'),function(){_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0x1c'),new AGIError(_0x9f9f('0x1d')));});_0x739f32['on'](_0x9f9f('0x1e'),function(){_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0x1e'),new AGIError(_0x9f9f('0x1f')));_0x739f32[_0x9f9f('0x20')]();});_0x739f32['pipe'](_0x424d97);this[_0x9f9f('0x21')]=function(_0x35a0be,_0xda50d3){var _0x35a0be=_0x35a0be||'',_0xda50d3=typeof _0xda50d3=='function'?_0xda50d3:new Function();_0x4480d5={'tx':_0x35a0be,'rx':'','cb':_0xda50d3};_0x739f32[_0x9f9f('0x22')](_0x35a0be+'\x0a');},this[_0x9f9f('0x1c')]=function(){_0x739f32['destroy']();};}util[_0x9f9f('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x9f9f('0x24')]=function(_0x55bcec){return this['command'][_0x9f9f('0x25')](this,_0x55bcec);};AGIChannel['prototype'][_0x9f9f('0x26')]=function(){return this[_0x9f9f('0x24')]('ANSWER');};AGIChannel[_0x9f9f('0x27')]['getData']=function(_0x40c53d,_0x577865,_0x43577b){_0x40c53d=_0x40c53d===undefined?'beep':_0x40c53d;_0x577865=_0x577865===undefined?'5':_0x577865;_0x43577b=_0x43577b===undefined?'1':_0x43577b;return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x29'),_0x40c53d,_0x577865*0x3e8,_0x43577b));};AGIChannel['prototype']['noop']=function(_0x2d2589){_0x2d2589=_0x2d2589||_0x9f9f('0x2a');return this[_0x9f9f('0x24')](util['format'](_0x9f9f('0x2b'),_0x2d2589));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x2c')]=function(_0x5cf66b,_0x286672){if(_[_0x9f9f('0x2d')](_0x286672)){return this['sendRequest'](util[_0x9f9f('0x28')](_0x9f9f('0x2e'),_0x5cf66b,_0x286672[_0x9f9f('0x2f')](',')));}return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')]('EXEC\x20%s\x20%s',_0x5cf66b,_0x286672));};AGIChannel['prototype'][_0x9f9f('0x30')]=function(_0x556a03){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x31'),_0x556a03));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x32')]=function(_0x347701){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x33'),_0x347701));};AGIChannel['prototype'][_0x9f9f('0x34')]=function(_0x35d56b){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x35'),_0x35d56b));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0xd')]=function(){return this[_0x9f9f('0x24')](_0x9f9f('0x36'));};AGIChannel['prototype'][_0x9f9f('0x37')]=function(_0x1f5aa7,_0x576e38){var _0x4ad749=_[_0x9f9f('0x38')](_0x576e38)||_[_0x9f9f('0x39')](_0x576e38)?_0x576e38[_0x9f9f('0x3a')]():_0x576e38;return this[_0x9f9f('0x24')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1f5aa7,_0x4ad749?_0x4ad749[_0x9f9f('0x3a')]()[_0x9f9f('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x3b')]=function(_0x458040,_0x2becd0){return this[_0x9f9f('0x24')](util['format'](_0x9f9f('0x3c'),_0x458040,_0x2becd0));};AGIChannel[_0x9f9f('0x27')]['sayDigits']=function(_0x27d236,_0x486f60){return this[_0x9f9f('0x24')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x27d236,_0x486f60));};AGIChannel['prototype']['sayPhonetic']=function(_0x38a2e6,_0x53c3e0){return this[_0x9f9f('0x24')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x38a2e6,_0x53c3e0));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x3d')]=function(_0x3a6fb7,_0x5422a4,_0x1808f0){_0x5422a4=_0x5422a4||this[_0x9f9f('0x3e')];_0x1808f0=_0x1808f0||0x1;this[_0x9f9f('0x30')](_0x3a6fb7);this[_0x9f9f('0x32')](_0x5422a4);this[_0x9f9f('0x34')](_0x1808f0);return this[_0x9f9f('0x3f')](util[_0x9f9f('0x28')](_0x9f9f('0x40'),_0x3a6fb7,_0x5422a4,_0x1808f0));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x41')]=function(_0x3449ba){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3449ba));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x42')]=function(_0xd5dba2,_0x5d0bc0,_0x5a648b,_0x53c678,_0x150e71,_0x128367){_0x5d0bc0=_0x5d0bc0||_0x9f9f('0x43');_0x5a648b=_0x5a648b||'';_0x53c678=_0x53c678===undefined?-0x1:_0x53c678==='-1'?-0x1:_0x53c678*0x3e8;_0x150e71=_0x150e71===undefined?'':'s='+_0x150e71;_0x128367=_0x128367?_0x9f9f('0x44'):'';return this[_0x9f9f('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0xd5dba2,_0x5d0bc0,_0x5a648b,_0x53c678,_0x128367,_0x150e71));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x45')]=function(_0x12a074,_0x7dec45){_0x7dec45=_0x7dec45||'';return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x46'),_0x12a074,_0x7dec45));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x47')]=function(_0x2004b3){return this['exec'](_0x9f9f('0x48'),_0x2004b3);};AGIChannel[_0x9f9f('0x27')]['wait']=function(_0x47281a){return this[_0x9f9f('0x2c')](_0x9f9f('0x49'),_0x47281a);};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x1a')]=function(_0x17ff5e,_0x3e5de5){this['noop'](util[_0x9f9f('0x28')](_0x9f9f('0x4a'),_0x17ff5e['id'],_0x17ff5e['label'],_0x3e5de5));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xc69b=['hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sync','sendRequest','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','setContext','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','util','events','./reply','./error','call','setEncoding','setTimeout','utf8','emit','ready','line','toLowerCase'];(function(_0x1d00f2,_0x465ed1){var _0x56707c=function(_0x2e00fc){while(--_0x2e00fc){_0x1d00f2['push'](_0x1d00f2['shift']());}};_0x56707c(++_0x465ed1);}(_0xc69b,0xcf));var _0xbc69=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0xc69b[_0x8afdd0];return _0x3de7ac;};'use strict';var util=require(_0xbc69('0x0'));var _=require('lodash');var EventEmitter=require(_0xbc69('0x1'))['EventEmitter'];var AGIReply=require(_0xbc69('0x2'));var AGIError=require(_0xbc69('0x3'));function AGIChannel(_0x300823){var _0x4aec7f=this,_0xdf60e4=new AGIReply(),_0x4ee44b=![],_0x59fd9b={};EventEmitter[_0xbc69('0x4')](_0x4aec7f);_0x300823[_0xbc69('0x5')]('utf8');_0x300823[_0xbc69('0x6')](0x8*0x3c*0x3c*0x3e8);_0xdf60e4[_0xbc69('0x5')](_0xbc69('0x7'));_0xdf60e4['on']('headers',function(_0xf39d7b){for(var _0x22e58c in _0xf39d7b){_0x4aec7f[_0x22e58c]=_0xf39d7b[_0x22e58c];}_0x4aec7f[_0xbc69('0x8')](_0xbc69('0x9'));});_0xdf60e4['on'](_0xbc69('0xa'),function(_0x57be21){if(_0x57be21[_0xbc69('0xb')]()==_0xbc69('0xc')){_0x4aec7f[_0xbc69('0x8')](_0xbc69('0xc'));return;}if(_0x57be21[_0xbc69('0xd')](0x0,0xb)=='520-Invalid'){_0x4ee44b=!![];}if(_0x4ee44b){_0x59fd9b['rx']+=_0x57be21+'\x0a';if(_0x57be21[_0xbc69('0xe')](_0xbc69('0xf'))!=-0x1){_0x4ee44b=![];}}else{_0x59fd9b['rx']=_0x57be21;}if(_0x4ee44b){return;}if(typeof _0x59fd9b['cb']==_0xbc69('0x10')){var _0x291173=_0x59fd9b['rx']['substring'](0x0,0x3),_0x4a875d=null,_0xcc1173=null;_0x291173=parseInt(_0x291173);if(isNaN(_0x291173)){_0x59fd9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xbc69('0x11')});return;}if(_0x291173!=0xc8){_0x59fd9b['cb'](null,{'code':_0x291173,'result':-0x1,'extra':'KO'});return;}_0x4a875d=_0x59fd9b['rx']['substring'](0x4)[_0xbc69('0x12')](_0xbc69('0x13'),'');if(_0x4a875d['indexOf']('\x20')!=-0x1){_0x4a875d=_0x4a875d['substr'](0x0,_0x4a875d[_0xbc69('0x14')]('\x20'));}if(_[_0xbc69('0x15')](_0x4a875d,'-1')){_0x4a875d=parseInt(_0x4a875d);}_0xcc1173=_0x59fd9b['rx'][_0xbc69('0x16')]('\x20');if(_0xcc1173[_0xbc69('0x17')]==0x3){_0xcc1173=_0xcc1173[0x2][_0xbc69('0xd')](0x1,_0xcc1173[0x2][_0xbc69('0x17')]-0x1);}else if(_0xcc1173[_0xbc69('0x17')]>0x3){var _0xe97147=/\((.+)\)/;var _0x38ee29=_0x59fd9b['rx']['match'](_0xe97147);if(_0x38ee29){_0xcc1173=_0x38ee29[0x1];}else{_0xcc1173=null;}}else{_0xcc1173=null;}_0x59fd9b['cb'](null,{'code':_0x291173,'result':_0x4a875d,'extra':_0xcc1173});}});_0x300823['on'](_0xbc69('0x18'),function(_0x3c941e){_0x4aec7f[_0xbc69('0x8')](_0xbc69('0x18'),new AGIError(_0xbc69('0x19'),_0x3c941e['code']));});_0x300823['on'](_0xbc69('0x1a'),function(){_0x4aec7f[_0xbc69('0x8')](_0xbc69('0x1a'),new AGIError(_0xbc69('0x1b')));});_0x300823['on'](_0xbc69('0x1c'),function(){_0x4aec7f[_0xbc69('0x8')]('timeout',new AGIError(_0xbc69('0x1d')));_0x300823[_0xbc69('0x1e')]();});_0x300823[_0xbc69('0x1f')](_0xdf60e4);this[_0xbc69('0x20')]=function(_0xedd028,_0x37fee1){var _0xedd028=_0xedd028||'',_0x37fee1=typeof _0x37fee1==_0xbc69('0x10')?_0x37fee1:new Function();_0x59fd9b={'tx':_0xedd028,'rx':'','cb':_0x37fee1};_0x300823[_0xbc69('0x21')](_0xedd028+'\x0a');},this[_0xbc69('0x1a')]=function(){_0x300823['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xbc69('0x22')]['sendRequest']=function(_0x3a9168){return this['command'][_0xbc69('0x23')](this,_0x3a9168);};AGIChannel[_0xbc69('0x22')]['answer']=function(){return this[_0xbc69('0x24')](_0xbc69('0x25'));};AGIChannel[_0xbc69('0x22')]['getData']=function(_0x2a7ee5,_0x4e99e9,_0xb0f5d1){_0x2a7ee5=_0x2a7ee5===undefined?_0xbc69('0x26'):_0x2a7ee5;_0x4e99e9=_0x4e99e9===undefined?'5':_0x4e99e9;_0xb0f5d1=_0xb0f5d1===undefined?'1':_0xb0f5d1;return this[_0xbc69('0x24')](util['format'](_0xbc69('0x27'),_0x2a7ee5,_0x4e99e9*0x3e8,_0xb0f5d1));};AGIChannel[_0xbc69('0x22')]['noop']=function(_0x1abd2e){_0x1abd2e=_0x1abd2e||_0xbc69('0x28');return this[_0xbc69('0x24')](util[_0xbc69('0x29')](_0xbc69('0x2a'),_0x1abd2e));};AGIChannel['prototype']['exec']=function(_0x2f07c5,_0x438eb6){if(_[_0xbc69('0x2b')](_0x438eb6)){return this[_0xbc69('0x24')](util[_0xbc69('0x29')](_0xbc69('0x2c'),_0x2f07c5,_0x438eb6[_0xbc69('0x2d')](',')));}return this[_0xbc69('0x24')](util[_0xbc69('0x29')](_0xbc69('0x2c'),_0x2f07c5,_0x438eb6));};AGIChannel[_0xbc69('0x22')]['setContext']=function(_0x35eaad){return this['sendRequest'](util['format'](_0xbc69('0x2e'),_0x35eaad));};AGIChannel[_0xbc69('0x22')][_0xbc69('0x2f')]=function(_0x47f328){return this['sendRequest'](util[_0xbc69('0x29')](_0xbc69('0x30'),_0x47f328));};AGIChannel[_0xbc69('0x22')]['setPriority']=function(_0x442e89){return this[_0xbc69('0x24')](util[_0xbc69('0x29')](_0xbc69('0x31'),_0x442e89));};AGIChannel[_0xbc69('0x22')][_0xbc69('0xc')]=function(){return this['sendRequest'](_0xbc69('0x32'));};AGIChannel[_0xbc69('0x22')][_0xbc69('0x33')]=function(_0x560911,_0xf71a39){var _0x2b6653=_[_0xbc69('0x34')](_0xf71a39)||_[_0xbc69('0x35')](_0xf71a39)?_0xf71a39[_0xbc69('0x36')]():_0xf71a39;return this['sendRequest'](util[_0xbc69('0x29')](_0xbc69('0x37'),_0x560911,_0x2b6653?_0x2b6653[_0xbc69('0x36')]()[_0xbc69('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xbc69('0x22')]['sayNumber']=function(_0x5ed4e6,_0x13161f){return this[_0xbc69('0x24')](util[_0xbc69('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x5ed4e6,_0x13161f));};AGIChannel[_0xbc69('0x22')][_0xbc69('0x38')]=function(_0x3fdda9,_0x3880ff){return this[_0xbc69('0x24')](util[_0xbc69('0x29')](_0xbc69('0x39'),_0x3fdda9,_0x3880ff));};AGIChannel['prototype']['sayPhonetic']=function(_0xac84b,_0x250f32){return this['sendRequest'](util[_0xbc69('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xac84b,_0x250f32));};AGIChannel[_0xbc69('0x22')]['continueAt']=function(_0x1ffb64,_0x4bb75e,_0x18c738){_0x4bb75e=_0x4bb75e||this[_0xbc69('0x3a')];_0x18c738=_0x18c738||0x1;this[_0xbc69('0x3b')](_0x1ffb64);this['setExtension'](_0x4bb75e);this['setPriority'](_0x18c738);return this[_0xbc69('0x3c')](util[_0xbc69('0x29')](_0xbc69('0x3d'),_0x1ffb64,_0x4bb75e,_0x18c738));};AGIChannel[_0xbc69('0x22')][_0xbc69('0x3e')]=function(_0x571443){return this[_0xbc69('0x24')](util[_0xbc69('0x29')](_0xbc69('0x3f'),_0x571443));};AGIChannel[_0xbc69('0x22')][_0xbc69('0x40')]=function(_0x2375e8,_0x5a305d,_0x5a06b0,_0x2283a2,_0x3748fa,_0x2aea4b){_0x5a305d=_0x5a305d||'wav';_0x5a06b0=_0x5a06b0||'';_0x2283a2=_0x2283a2===undefined?-0x1:_0x2283a2==='-1'?-0x1:_0x2283a2*0x3e8;_0x3748fa=_0x3748fa===undefined?'':'s='+_0x3748fa;_0x2aea4b=_0x2aea4b?_0xbc69('0x41'):'';return this[_0xbc69('0x24')](util[_0xbc69('0x29')](_0xbc69('0x42'),_0x2375e8,_0x5a305d,_0x5a06b0,_0x2283a2,_0x2aea4b,_0x3748fa));};AGIChannel[_0xbc69('0x22')][_0xbc69('0x43')]=function(_0x51f4d8,_0x5831b6){_0x5831b6=_0x5831b6||'';return this['sendRequest'](util[_0xbc69('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x51f4d8,_0x5831b6));};AGIChannel[_0xbc69('0x22')][_0xbc69('0x44')]=function(_0x5ef432){return this['exec'](_0xbc69('0x45'),_0x5ef432);};AGIChannel[_0xbc69('0x22')]['wait']=function(_0x198903){return this[_0xbc69('0x46')](_0xbc69('0x47'),_0x198903);};AGIChannel[_0xbc69('0x22')][_0xbc69('0x18')]=function(_0x9f0751,_0xc3978c){this[_0xbc69('0x3c')](util['format'](_0xbc69('0x48'),_0x9f0751['id'],_0x9f0751['label'],_0xc3978c));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 8e78759..d00d93d 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 _0xeb8e=['Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','name','util','Undefined\x20error.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4b9afb,_0x438bef){var _0x3397f7=function(_0x21997e){while(--_0x21997e){_0x4b9afb['push'](_0x4b9afb['shift']());}};_0x3397f7(++_0x438bef);}(_0xeb8e,0x89));var _0xeeb8=function(_0x52f7fc,_0x3868ec){_0x52f7fc=_0x52f7fc-0x0;var _0x4926df=_0xeb8e[_0x52f7fc];return _0x4926df;};'use strict';var util=require(_0xeeb8('0x0'));var error={'E_AGI_UNDEFINED':_0xeeb8('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xeeb8('0x2'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xeeb8('0x3'),'E_AGI_SOCKET_TIMEOUT':_0xeeb8('0x4'),'E_AGI_COMMAND_EMPTY':_0xeeb8('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xeeb8('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3b1373){var _0x3b1373=_0x3b1373||null,_0x17ce91=_0x17ce91||[],_0x562f75=0x1,_0x547df3='';if(!error[_0x3b1373]){_0x3b1373=_0xeeb8('0x7');}_0x17ce91[_0xeeb8('0x8')](error[_0x3b1373]);while(arguments[_0x562f75]){_0x17ce91[_0xeeb8('0x8')](arguments[_0x562f75]);_0x562f75++;}_0x547df3=util['format'][_0xeeb8('0x9')](util,_0x17ce91);this['message']=_0x547df3;this[_0xeeb8('0xa')]=_0x3b1373;}module['exports']=AGIError; \ No newline at end of file +var _0x0356=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x4aa6cb,_0x4b3912){var _0x300640=function(_0x29c0b7){while(--_0x29c0b7){_0x4aa6cb['push'](_0x4aa6cb['shift']());}};_0x300640(++_0x4b3912);}(_0x0356,0x175));var _0x6035=function(_0x22092b,_0xa418e){_0x22092b=_0x22092b-0x0;var _0xed9ef8=_0x0356[_0x22092b];return _0xed9ef8;};'use strict';var util=require(_0x6035('0x0'));var error={'E_AGI_UNDEFINED':_0x6035('0x1'),'E_AGI_ARGUMENT_PORT':_0x6035('0x2'),'E_AGI_SERVER_ERROR':_0x6035('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x6035('0x4'),'E_AGI_SOCKET_CLOSE':_0x6035('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x6035('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x6035('0x7')};function AGIError(_0x3bd83b){var _0x3bd83b=_0x3bd83b||null,_0x2247c9=_0x2247c9||[],_0x382303=0x1,_0xbc61bf='';if(!error[_0x3bd83b]){_0x3bd83b=_0x6035('0x8');}_0x2247c9[_0x6035('0x9')](error[_0x3bd83b]);while(arguments[_0x382303]){_0x2247c9['push'](arguments[_0x382303]);_0x382303++;}_0xbc61bf=util[_0x6035('0xa')][_0x6035('0xb')](util,_0x2247c9);this[_0x6035('0xc')]=_0xbc61bf;this[_0x6035('0xd')]=_0x3bd83b;}module[_0x6035('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 196a3f0..e50669d 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x993e=['EventEmitter','ioredis','redis','defaults','localhost','subscribe','agi','emit','error','message','parse','E_AGI_SERVER_ERROR','exports'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0x993e,0x1ba));var _0xe993=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x993e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xe993('0x0')];var Redis=require(_0xe993('0x1'));var AGIError=require('./error');var config=require('../../config/environment');config[_0xe993('0x2')]=_[_0xe993('0x3')](config[_0xe993('0x2')],{'host':_0xe993('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe993('0x2')]);sub[_0xe993('0x5')](_0xe993('0x6'),function(_0x194e68){if(_0x194e68)return eventEmitter[_0xe993('0x7')](_0xe993('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x194e68));});sub['on'](_0xe993('0x9'),function(_0x1e4b3d,_0x50c0b8){if(_0x1e4b3d!==_0xe993('0x6'))return;try{var _0x4134e4=JSON[_0xe993('0xa')](_0x50c0b8);eventEmitter[_0xe993('0x7')]('projectUpdate',_0x4134e4);}catch(_0x3e9513){eventEmitter[_0xe993('0x7')]('error',new AGIError(_0xe993('0xb'),_0x3e9513));}});module[_0xe993('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xe423=['parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','./error','../../config/environment','defaults','emit','error','message','agi'];(function(_0xbd18d4,_0x112df4){var _0xec2e4a=function(_0x451491){while(--_0x451491){_0xbd18d4['push'](_0xbd18d4['shift']());}};_0xec2e4a(++_0x112df4);}(_0xe423,0xba));var _0x3e42=function(_0x160d8b,_0x3ee1bb){_0x160d8b=_0x160d8b-0x0;var _0x23cd39=_0xe423[_0x160d8b];return _0x23cd39;};'use strict';var _=require(_0x3e42('0x0'));var EventEmitter=require(_0x3e42('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0x3e42('0x2'));var config=require(_0x3e42('0x3'));config['redis']=_[_0x3e42('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0xf43660){if(_0xf43660)return eventEmitter[_0x3e42('0x5')](_0x3e42('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0xf43660));});sub['on'](_0x3e42('0x7'),function(_0x382bd7,_0x4084ed){if(_0x382bd7!==_0x3e42('0x8'))return;try{var _0x4668a9=JSON[_0x3e42('0x9')](_0x4084ed);eventEmitter['emit'](_0x3e42('0xa'),_0x4668a9);}catch(_0x45caad){eventEmitter[_0x3e42('0x5')](_0x3e42('0x6'),new AGIError(_0x3e42('0xb'),_0x45caad));}});module[_0x3e42('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6e0d31f..2653612 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 _0x4c55=['traverseBFS','no\x20vertex\x20found','info','length','condition','split','agicommand','target','default','invalid','vswitch','condition\x20not\x20found','exports','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex'];(function(_0x19d422,_0xcb97a4){var _0x27576b=function(_0x44948f){while(--_0x44948f){_0x19d422['push'](_0x19d422['shift']());}};_0x27576b(++_0xcb97a4);}(_0x4c55,0x16c));var _0x54c5=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x4c55[_0x593752];return _0x4612be;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x54c5('0x0'));var verticesWithRetry=[_0x54c5('0x1'),_0x54c5('0x2'),_0x54c5('0x3')];var Graph=function(){this[_0x54c5('0x4')]={};this[_0x54c5('0x5')]={};this[_0x54c5('0x6')]=0x0;};Graph[_0x54c5('0x7')][_0x54c5('0x8')]=function(_0x4611a3){this[_0x54c5('0x4')][_0x4611a3['id']]=_0x4611a3;this[_0x54c5('0x5')][_0x4611a3['id']]=[];};Graph[_0x54c5('0x7')][_0x54c5('0x9')]=function(_0x15ffcc,_0xc8f484,_0x416995){this[_0x54c5('0x5')][_0x15ffcc][_0x54c5('0xa')]({'target':_0xc8f484,'condition':_0x416995});this[_0x54c5('0x6')]+=0x1;};Graph['prototype'][_0x54c5('0xb')]=function(){return _[_0x54c5('0xb')](this[_0x54c5('0x4')]);};Graph[_0x54c5('0x7')][_0x54c5('0xc')]=function(){return this[_0x54c5('0x6')];};Graph[_0x54c5('0x7')][_0x54c5('0xd')]=function(_0x1c7534){return this[_0x54c5('0x4')][_0x1c7534];};Graph[_0x54c5('0x7')][_0x54c5('0xe')]=function(_0x575eaa,_0x245292){if(!this[_0x54c5('0x4')][_0x575eaa]){return logger['info'](_0x54c5('0xf'));}var _0x148126=_0x245292(this['vertices'][_0x575eaa]);if(!_0x148126){return logger[_0x54c5('0x10')]('stop\x20traverse');}if(this['edges'][_0x575eaa][_0x54c5('0x11')]===0x0){return logger[_0x54c5('0x10')]('no\x20edge/s\x20available');}for(var _0x5e9be4=0x0,_0x27be40=[],_0xf62c4c=![];_0x5e9be4\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','find','handleNotFound','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','finally','./server','listening','connection','close','lodash','../../config/environment','../../config/logger','agi','./rpc','./project','EventEmitter','defaults','127.0.0.1','nextTick','stack','findIndex','deleted','push','error','env','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','then','hasOwnProperty','indexOf','agi_'];(function(_0x4f844b,_0xbe7cc7){var _0x19a8ae=function(_0x1c69fe){while(--_0x1c69fe){_0x4f844b['push'](_0x4f844b['shift']());}};_0x19a8ae(++_0xbe7cc7);}(_0xede6,0xc4));var _0x6ede=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xede6[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x6ede('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x6ede('0x1'));var logger=require(_0x6ede('0x2'))(_0x6ede('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x6ede('0x4'));var Project=require(_0x6ede('0x5'));var AGIEmitter=require('./events')[_0x6ede('0x6')];var projects=[];config[_0x6ede('0x3')]=_[_0x6ede('0x7')](config[_0x6ede('0x3')],{'ip':_0x6ede('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x156da3){process[_0x6ede('0x9')](function(){syncho(function(){try{setChannelVariables(_0x156da3);agiHandler(_0x156da3);}catch(_0x44cfa8){logger['error'](_0x44cfa8[_0x6ede('0xa')]);}});});}function projectUpdateHandler(_0x2659d6){try{var _0x25eb4f=_[_0x6ede('0xb')](projects,['id',_0x2659d6['id']]);if(_0x25eb4f>-0x1){if(_0x2659d6[_0x6ede('0xc')]===!![]){projects['splice'](_0x25eb4f,0x1);}else{projects[_0x25eb4f]=_0x2659d6;}}else{projects[_0x6ede('0xd')](_0x2659d6);}}catch(_0x22d906){logger[_0x6ede('0xe')](_0x22d906[_0x6ede('0xa')]);}}function listeningHandler(){var _0x33e06c=config[_0x6ede('0xf')]==='production'||![];console[_0x6ede('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6ede('0x3')][_0x6ede('0x11')]);logger[_0x6ede('0x12')](util[_0x6ede('0x13')](_0x6ede('0x14'),_0x33e06c?config[_0x6ede('0x3')]['ip']:'host.docker.internal',config[_0x6ede('0x3')][_0x6ede('0x11')]));}function errorHandler(_0x4bfe83){if(_0x4bfe83&&_0x4bfe83[_0x6ede('0x15')]&&_0x4bfe83[_0x6ede('0x16')]){logger[_0x6ede('0xe')](util[_0x6ede('0x13')](_0x6ede('0x17'),_0x4bfe83[_0x6ede('0x15')],_0x4bfe83[_0x6ede('0x16')]));}else{logger[_0x6ede('0xe')](util['format'](_0x6ede('0x18'),_0x4bfe83['stack']));}}function closeHandler(){logger[_0x6ede('0x12')](util[_0x6ede('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6ede('0x19')],this['calleridname'],this[_0x6ede('0x1a')],this[_0x6ede('0x1b')],this[_0x6ede('0x1c')]));try{createSquareReport(this);}catch(_0x184ee4){logger['error'](_0x184ee4['stack']);}}function timeoutHandler(){logger[_0x6ede('0x12')](util[_0x6ede('0x13')](_0x6ede('0x1d'),this['arg_1'],this['calleridname'],this[_0x6ede('0x1a')],this[_0x6ede('0x1b')],this[_0x6ede('0x1c')]));}function hangupHandler(){logger['info'](util[_0x6ede('0x13')](_0x6ede('0x1e'),this[_0x6ede('0x19')],this[_0x6ede('0x1f')],this[_0x6ede('0x1a')],this[_0x6ede('0x1b')],this[_0x6ede('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x3d3f80,_0x574bc9){rpc['createSquareReport'](_0x3d3f80)[_0x6ede('0x20')](function(_0x380935){if(_0x574bc9){_0x574bc9(null,_0x380935);}})['catch'](function(_0x4a64e9){if(_0x574bc9){_0x574bc9(null,_0x4a64e9);}});}function setChannelVariables(_0x38f728){for(var _0x58bf07 in _0x38f728){if(_0x38f728[_0x6ede('0x21')](_0x58bf07)){if(_0x58bf07[_0x6ede('0x22')](_0x6ede('0x23'))===0x0){_0x38f728[_0x58bf07[_0x6ede('0x24')](0x4)]=_0x38f728[_0x58bf07];delete _0x38f728[_0x58bf07];}}}}function agiHandler(_0x176752){logger[_0x6ede('0x25')](_0x6ede('0x26'),JSON[_0x6ede('0x27')](_0x176752,null,0x2));logger['info'](util[_0x6ede('0x13')](_0x6ede('0x28'),_0x176752[_0x6ede('0x19')],_0x176752['calleridname'],_0x176752[_0x6ede('0x1a')],_0x176752['dnid'],_0x176752[_0x6ede('0x1c')]));_0x176752['on'](_0x6ede('0xe'),errorHandler);_0x176752['on']('close',closeHandler);_0x176752['on'](_0x6ede('0x29'),timeoutHandler);_0x176752[_0x6ede('0x2a')]=![];_0x176752['on'](_0x6ede('0x2b'),hangupHandler);var _0x26d4e0=_[_0x6ede('0x2c')](projects,[_0x6ede('0x15'),_0x176752[_0x6ede('0x19')]]);if(!_0x26d4e0)return Project[_0x6ede('0x2d')](_0x176752);if(!_0x26d4e0['production'])return Project['handleUnpublished'](_0x176752);return Project[_0x6ede('0x2e')](_0x26d4e0,_0x176752);}function main(){var _0x249de2;return utilLicense['getLicense']()[_0x6ede('0x20')](function(_0x5e9af8){if(!_0x5e9af8)return;if(_0x5e9af8[_0x6ede('0x2f')]){if(_0x5e9af8['callysquare']&&_0x5e9af8[_0x6ede('0x30')]>0x0){logger['info'](util[_0x6ede('0x13')](_0x6ede('0x31'),_0x5e9af8['callysquare']));_0x249de2=_0x5e9af8[_0x6ede('0x30')];}else{logger[_0x6ede('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6ede('0x12')](_0x6ede('0x32'));_0x249de2=-0x1;}})['then'](function(){return Project[_0x6ede('0x33')]();})[_0x6ede('0x20')](function(_0x5caa97){projects=_0x5caa97;return;})[_0x6ede('0x34')](function(_0x533a26){logger[_0x6ede('0xe')]('[LICENSE]',_0x533a26[_0x6ede('0xa')]);})[_0x6ede('0x35')](function(){var _0x2c33b4=require(_0x6ede('0x36'))(config[_0x6ede('0x3')]['port'],config[_0x6ede('0x3')]['ip'],_0x249de2);_0x2c33b4['on'](_0x6ede('0xe'),errorHandler);_0x2c33b4['on'](_0x6ede('0x37'),listeningHandler);_0x2c33b4['on'](_0x6ede('0x38'),connectionHandler);_0x2c33b4['on'](_0x6ede('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0xb54f=['debug','variables','stringify','close','timeout','evtHangup','hangup','find','handleNotFound','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','splice','push','env','production','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','message','error','name','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','createSquareReport','then','catch','hasOwnProperty','agi_','substring'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xb54f,0x10b));var _0xfb54=function(_0x144433,_0x133ef2){_0x144433=_0x144433-0x0;var _0x8ed918=_0xb54f[_0x144433];return _0x8ed918;};'use strict';var _=require(_0xfb54('0x0'));var syncho=require(_0xfb54('0x1'));var util=require(_0xfb54('0x2'));var config=require(_0xfb54('0x3'));var logger=require(_0xfb54('0x4'))(_0xfb54('0x5'));var utilLicense=require(_0xfb54('0x6'));var rpc=require(_0xfb54('0x7'));var Project=require(_0xfb54('0x8'));var AGIEmitter=require('./events')[_0xfb54('0x9')];var projects=[];config[_0xfb54('0x5')]=_[_0xfb54('0xa')](config[_0xfb54('0x5')],{'ip':_0xfb54('0xb'),'port':0x11dd});AGIEmitter['on'](_0xfb54('0xc'),projectUpdateHandler);function connectionHandler(_0x2a20a4){process[_0xfb54('0xd')](function(){syncho(function(){try{setChannelVariables(_0x2a20a4);agiHandler(_0x2a20a4);}catch(_0x51b966){logger['error'](_0x51b966[_0xfb54('0xe')]);}});});}function projectUpdateHandler(_0x2091db){try{var _0x2d9a5d=_[_0xfb54('0xf')](projects,['id',_0x2091db['id']]);if(_0x2d9a5d>-0x1){if(_0x2091db[_0xfb54('0x10')]===!![]){projects[_0xfb54('0x11')](_0x2d9a5d,0x1);}else{projects[_0x2d9a5d]=_0x2091db;}}else{projects[_0xfb54('0x12')](_0x2091db);}}catch(_0x4b5192){logger['error'](_0x4b5192[_0xfb54('0xe')]);}}function listeningHandler(){var _0x273385=config[_0xfb54('0x13')]===_0xfb54('0x14')||![];console[_0xfb54('0x15')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xfb54('0x5')][_0xfb54('0x16')]);logger[_0xfb54('0x17')](util[_0xfb54('0x18')](_0xfb54('0x19'),_0x273385?config['agi']['ip']:_0xfb54('0x1a'),config[_0xfb54('0x5')][_0xfb54('0x16')]));}function errorHandler(_0x2ed015){if(_0x2ed015&&_0x2ed015['name']&&_0x2ed015[_0xfb54('0x1b')]){logger[_0xfb54('0x1c')](util[_0xfb54('0x18')]('[%s]\x20%s',_0x2ed015[_0xfb54('0x1d')],_0x2ed015[_0xfb54('0x1b')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0x2ed015['stack']));}}function closeHandler(){logger['info'](util['format'](_0xfb54('0x1e'),this[_0xfb54('0x1f')],this[_0xfb54('0x20')],this['callerid'],this[_0xfb54('0x21')],this[_0xfb54('0x22')]));try{createSquareReport(this);}catch(_0xee963b){logger[_0xfb54('0x1c')](_0xee963b[_0xfb54('0xe')]);}}function timeoutHandler(){logger[_0xfb54('0x17')](util[_0xfb54('0x18')](_0xfb54('0x23'),this[_0xfb54('0x1f')],this['calleridname'],this[_0xfb54('0x24')],this[_0xfb54('0x21')],this[_0xfb54('0x22')]));}function hangupHandler(){logger['info'](util[_0xfb54('0x18')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfb54('0x1f')],this[_0xfb54('0x20')],this[_0xfb54('0x24')],this['dnid'],this[_0xfb54('0x22')]));this['evtHangup']=!![];}function createSquareReport(_0xac7b4d,_0x3c5a28){rpc[_0xfb54('0x25')](_0xac7b4d)[_0xfb54('0x26')](function(_0xfc4b6c){if(_0x3c5a28){_0x3c5a28(null,_0xfc4b6c);}})[_0xfb54('0x27')](function(_0x128c8d){if(_0x3c5a28){_0x3c5a28(null,_0x128c8d);}});}function setChannelVariables(_0x44525c){for(var _0x3c12aa in _0x44525c){if(_0x44525c[_0xfb54('0x28')](_0x3c12aa)){if(_0x3c12aa['indexOf'](_0xfb54('0x29'))===0x0){_0x44525c[_0x3c12aa[_0xfb54('0x2a')](0x4)]=_0x44525c[_0x3c12aa];delete _0x44525c[_0x3c12aa];}}}}function agiHandler(_0x377d24){logger[_0xfb54('0x2b')](_0xfb54('0x2c'),JSON[_0xfb54('0x2d')](_0x377d24,null,0x2));logger[_0xfb54('0x17')](util[_0xfb54('0x18')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x377d24[_0xfb54('0x1f')],_0x377d24[_0xfb54('0x20')],_0x377d24[_0xfb54('0x24')],_0x377d24[_0xfb54('0x21')],_0x377d24[_0xfb54('0x22')]));_0x377d24['on'](_0xfb54('0x1c'),errorHandler);_0x377d24['on'](_0xfb54('0x2e'),closeHandler);_0x377d24['on'](_0xfb54('0x2f'),timeoutHandler);_0x377d24[_0xfb54('0x30')]=![];_0x377d24['on'](_0xfb54('0x31'),hangupHandler);var _0x166fc1=_[_0xfb54('0x32')](projects,[_0xfb54('0x1d'),_0x377d24[_0xfb54('0x1f')]]);if(!_0x166fc1)return Project[_0xfb54('0x33')](_0x377d24);if(!_0x166fc1['production'])return Project['handleUnpublished'](_0x377d24);return Project[_0xfb54('0x34')](_0x166fc1,_0x377d24);}function main(){var _0x528198;return utilLicense['getLicense']()[_0xfb54('0x26')](function(_0x710d21){if(!_0x710d21)return;if(_0x710d21[_0xfb54('0x35')]){if(_0x710d21[_0xfb54('0x36')]&&_0x710d21[_0xfb54('0x36')]>0x0){logger[_0xfb54('0x17')](util[_0xfb54('0x18')](_0xfb54('0x37'),_0x710d21[_0xfb54('0x36')]));_0x528198=_0x710d21[_0xfb54('0x36')];}else{logger[_0xfb54('0x17')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xfb54('0x17')](_0xfb54('0x38'));_0x528198=-0x1;}})['then'](function(){return Project[_0xfb54('0x39')]();})[_0xfb54('0x26')](function(_0x3726fa){projects=_0x3726fa;return;})[_0xfb54('0x27')](function(_0x17bff4){logger[_0xfb54('0x1c')]('[LICENSE]',_0x17bff4[_0xfb54('0xe')]);})[_0xfb54('0x3a')](function(){var _0x2d446b=require(_0xfb54('0x3b'))(config[_0xfb54('0x5')]['port'],config[_0xfb54('0x5')]['ip'],_0x528198);_0x2d446b['on']('error',errorHandler);_0x2d446b['on'](_0xfb54('0x3c'),listeningHandler);_0x2d446b['on'](_0xfb54('0x3d'),connectionHandler);_0x2d446b['on'](_0xfb54('0x2e'),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 8c19dac..f24330b 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 _0x5858=['SendMail','bluebird','http','request','error','message','result'];(function(_0x478125,_0x3eb48c){var _0x11b219=function(_0x46c6ee){while(--_0x46c6ee){_0x478125['push'](_0x478125['shift']());}};_0x11b219(++_0x3eb48c);}(_0x5858,0x119));var _0x8585=function(_0x1cb3e9,_0x87cf67){_0x1cb3e9=_0x1cb3e9-0x0;var _0x566802=_0x5858[_0x1cb3e9];return _0x566802;};'use strict';var BPromise=require(_0x8585('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8585('0x1')]({'port':0x232b});function request(_0xbe1dd8,_0x5c6707){return new BPromise(function(_0x55608e,_0x5437b1){return client[_0x8585('0x2')](_0xbe1dd8,_0x5c6707)['then'](function(_0x13603d){if(_0x13603d[_0x8585('0x3')]){return _0x5437b1(_0x13603d[_0x8585('0x3')][_0x8585('0x4')]);}else{return _0x55608e(_0x13603d[_0x8585('0x5')]);}})['catch'](function(_0x5f135c){return _0x5437b1(_0x5f135c);});});}exports['sendMailMessage']=function(_0x3c209d,_0x5b7b03){return request(_0x8585('0x6'),{'account':_0x3c209d,'message':_0x5b7b03});}; \ No newline at end of file +var _0x8f1d=['result','catch','client','request','then','error','message'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0x8f1d,0x8e));var _0xd8f1=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x8f1d[_0x36bff5];return _0x80ade5;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xd8f1('0x0')]['http']({'port':0x232b});function request(_0x4582c0,_0x11f5dc){return new BPromise(function(_0x100df5,_0x5593d2){return client[_0xd8f1('0x1')](_0x4582c0,_0x11f5dc)[_0xd8f1('0x2')](function(_0x22e26c){if(_0x22e26c[_0xd8f1('0x3')]){return _0x5593d2(_0x22e26c[_0xd8f1('0x3')][_0xd8f1('0x4')]);}else{return _0x100df5(_0x22e26c[_0xd8f1('0x5')]);}})[_0xd8f1('0x6')](function(_0x37e6ba){return _0x5593d2(_0x37e6ba);});});}exports['sendMailMessage']=function(_0x267023,_0xbf07cb){return request('SendMail',{'account':_0x267023,'message':_0xbf07cb});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 5d06f38..51baa97 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7eb9=['uniqueid','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','calleridname','dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid'];(function(_0x12034d,_0x6d4771){var _0x4fce64=function(_0x4eb8e8){while(--_0x4eb8e8){_0x12034d['push'](_0x12034d['shift']());}};_0x4fce64(++_0x6d4771);}(_0x7eb9,0x1c4));var _0x97eb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7eb9[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var moment=require(_0x97eb('0x0'));var parser=require(_0x97eb('0x1'));var util=require(_0x97eb('0x2'));var logger=require(_0x97eb('0x3'))(_0x97eb('0x4'));var rpc=require(_0x97eb('0x5'));var mailRpc=require(_0x97eb('0x6'));var Graph=require(_0x97eb('0x7'));var Vertices=require(_0x97eb('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x97eb('0x9')]()[_0x97eb('0xa')](function(_0x2559d6){logger[_0x97eb('0xb')](_0x97eb('0xc'),_0x2559d6[_0x97eb('0xd')]);return[];});}function addVertex(_0xe20f1,_0x588b42,_0x5b0d6e){_0x588b42[_0x97eb('0xe')]=_0x5b0d6e;if(_0x588b42[_0x97eb('0xf')](_0x97eb('0x10'))){_0x588b42['maxRetry']=parseInt(_0x588b42[_0x97eb('0x10')],0xa);}_0xe20f1[_0x97eb('0x11')](_[_0x97eb('0x12')](_0x588b42,_0x97eb('0x13')));}function initGraph(_0x36d163,_0x464518){var _0x4cc17b=new Graph();for(var _0xb1e440 in _0x36d163){if(_0x36d163['hasOwnProperty'](_0xb1e440)){if(_[_0x97eb('0x14')](_0x36d163[_0xb1e440])){for(var _0x2fdffc=0x0;_0x2fdffc<_0x36d163[_0xb1e440][_0x97eb('0x15')];_0x2fdffc+=0x1){addVertex(_0x4cc17b,_0x36d163[_0xb1e440][_0x2fdffc],_0xb1e440);}}else{addVertex(_0x4cc17b,_0x36d163[_0xb1e440],_0xb1e440);}}}for(var _0x452741=0x0;_0x452741<_0x464518['length'];_0x452741+=0x1){if(_0x464518[_0x452741][_0x97eb('0x16')]&&_0x464518[_0x452741]['target']){_0x4cc17b[_0x97eb('0x17')](_0x464518[_0x452741][_0x97eb('0x16')],_0x464518[_0x452741][_0x97eb('0x18')],_0x464518[_0x452741][_0x97eb('0x19')]);}}return _0x4cc17b;}function getRoot(_0x3a3b1f){return parser['toJson'](_0x3a3b1f,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x40571f){return util['inspect'](_0x40571f,{'showHidden':![],'depth':null});}function initialize(_0x334a9f,_0x4a82a8){var _0x36d59c=getRoot(_0x334a9f['production']);if(!_0x36d59c||!_0x36d59c[_0x97eb('0x1a')])return;var _0x3257b8,_0x22147c,_0x3015dd;logger[_0x97eb('0x1b')](_0x97eb('0x1c'),JSON['stringify'](_0x36d59c,null,0x2));_0x4a82a8[_0x97eb('0x1d')]=moment()['format'](_0x97eb('0x1e'));_0x3257b8=initGraph(_[_0x97eb('0x12')](_0x36d59c,'mxCell'),_0x36d59c[_0x97eb('0x13')]);_0x22147c=new Vertices(_0x4a82a8,rpc,mailRpc);logger[_0x97eb('0x1f')](util[_0x97eb('0x20')](_0x97eb('0x21'),_0x4a82a8[_0x97eb('0x22')],_0x4a82a8['calleridname'],_0x4a82a8[_0x97eb('0x23')],_0x4a82a8['dnid'],_0x4a82a8[_0x97eb('0x24')]));_0x3257b8[_0x97eb('0x25')](_0x36d59c['start']['id'],function(_0x40ccf7){try{_0x40ccf7=_0x22147c[_0x97eb('0x26')](_0x40ccf7);logger[_0x97eb('0x1b')](_0x97eb('0x27'),JSON[_0x97eb('0x28')](_0x40ccf7,null,0x2));if(_0x40ccf7['agicommand']===_0x97eb('0x29')){logger[_0x97eb('0x1f')](_0x97eb('0x2a'));_0x4a82a8[_0x97eb('0x2b')]=_0x40ccf7[_0x97eb('0x2b')]||_0x4a82a8[_0x97eb('0x2b')];_0x4a82a8[_0x97eb('0x2c')]=_0x40ccf7['extension'];_0x4a82a8['priority']=_0x40ccf7['priority']?_0x40ccf7[_0x97eb('0x2d')]-0x1:0x1;return null;}else if(_0x40ccf7&&_0x22147c[_0x40ccf7['agicommand']]){_0x3015dd=_0x22147c[_0x40ccf7[_0x97eb('0xe')]](_0x40ccf7);logger[_0x97eb('0x1f')](_0x97eb('0x2e'),JSON[_0x97eb('0x28')](_0x3015dd,null,0x2));if(_0x3015dd&&_0x3015dd[_0x97eb('0x2f')]===AGI_CODE_SUCCESS&&_0x3015dd[_0x97eb('0x30')]!==AGI_RESULT_ERROR&&!_0x4a82a8[_0x97eb('0x31')]){logger[_0x97eb('0x1b')](_0x97eb('0x2e'),inspect(_0x3015dd));return _[_0x97eb('0x32')](_0x3015dd[_0x97eb('0x30')])?null:_0x3015dd['result'][_0x97eb('0x33')]();}else{logger[_0x97eb('0xb')]('response',inspect(_0x3015dd));return null;}}else{logger[_0x97eb('0xb')](_0x97eb('0x34'));return null;}}catch(_0x13d05f){logger[_0x97eb('0xb')](_0x13d05f['stack']);return null;}});if(_0x36d59c[_0x97eb('0x35')]){logger['info'](util[_0x97eb('0x20')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4a82a8[_0x97eb('0x22')],_0x4a82a8[_0x97eb('0x36')],_0x4a82a8[_0x97eb('0x23')],_0x4a82a8[_0x97eb('0x37')],_0x4a82a8[_0x97eb('0x24')]));_0x3257b8['traverseBFS'](_0x36d59c[_0x97eb('0x35')]['id'],function(_0x2641b7){try{_0x2641b7=_0x22147c[_0x97eb('0x26')](_0x2641b7);logger[_0x97eb('0x1b')](_0x97eb('0x27'),JSON[_0x97eb('0x28')](_0x2641b7,null,0x2));if(_0x2641b7&&_0x22147c[_0x2641b7[_0x97eb('0xe')]]){_0x3015dd=_0x22147c[_0x2641b7[_0x97eb('0xe')]](_0x2641b7);if(_0x3015dd){logger[_0x97eb('0x1b')]('response',inspect(_0x3015dd));return _[_0x97eb('0x32')](_0x3015dd['result'])?null:_0x3015dd[_0x97eb('0x30')][_0x97eb('0x33')]();}else{logger[_0x97eb('0xb')](_0x97eb('0x2e'),inspect(_0x3015dd));return null;}}else{logger['error'](_0x97eb('0x34'));return null;}}catch(_0x4cedc1){logger['error'](_0x4cedc1['stack']);return null;}});}logger[_0x97eb('0x1f')](util[_0x97eb('0x20')](_0x97eb('0x38'),_0x4a82a8[_0x97eb('0x22')],_0x4a82a8[_0x97eb('0x36')],_0x4a82a8['callerid'],_0x4a82a8['dnid'],_0x4a82a8[_0x97eb('0x24')]));logger[_0x97eb('0x1f')](util[_0x97eb('0x20')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4a82a8[_0x97eb('0x2b')],_0x4a82a8['extension'],parseInt(_0x4a82a8[_0x97eb('0x2d')],0xa)+0x1));_0x4a82a8[_0x97eb('0x39')](_0x4a82a8[_0x97eb('0x2b')],_0x4a82a8['extension'],parseInt(_0x4a82a8['priority'],0xa)+0x1);_0x4a82a8['close']();}function handleNotFound(_0x23e706){logger[_0x97eb('0xb')](util[_0x97eb('0x20')](_0x97eb('0x3a'),_0x23e706['arg_1']));_0x23e706[_0x97eb('0x39')](_0x23e706[_0x97eb('0x2b')],_0x23e706[_0x97eb('0x2c')],parseInt(_0x23e706[_0x97eb('0x2d')],0xa)+0x1);_0x23e706[_0x97eb('0x3b')]();}function handleUnpublished(_0x27114f){logger[_0x97eb('0xb')](util[_0x97eb('0x20')](_0x97eb('0x3c'),_0x27114f['arg_1']));_0x27114f[_0x97eb('0x39')](_0x27114f[_0x97eb('0x2b')],_0x27114f[_0x97eb('0x2c')],parseInt(_0x27114f[_0x97eb('0x2d')],0xa)+0x1);_0x27114f[_0x97eb('0x3b')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xd0e6=['target','toJson','mxGraphModel','root','inspect','production','start','joinAt','format','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','stringify','code','evtHangup','isUndefined','result','toString','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','addEdge'];(function(_0x22a4c7,_0x5bfc59){var _0x1a7d98=function(_0x575370){while(--_0x575370){_0x22a4c7['push'](_0x22a4c7['shift']());}};_0x1a7d98(++_0x5bfc59);}(_0xd0e6,0x69));var _0x6d0e=function(_0x465533,_0x56ab66){_0x465533=_0x465533-0x0;var _0x49489b=_0xd0e6[_0x465533];return _0x49489b;};'use strict';var _=require(_0x6d0e('0x0'));var moment=require(_0x6d0e('0x1'));var parser=require(_0x6d0e('0x2'));var util=require('util');var logger=require(_0x6d0e('0x3'))(_0x6d0e('0x4'));var rpc=require(_0x6d0e('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x6d0e('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x6d0e('0x7')]()[_0x6d0e('0x8')](function(_0x320cd2){logger[_0x6d0e('0x9')](_0x6d0e('0xa'),_0x320cd2[_0x6d0e('0xb')]);return[];});}function addVertex(_0x393aa3,_0x1fcfdd,_0x5bc201){_0x1fcfdd['agicommand']=_0x5bc201;if(_0x1fcfdd[_0x6d0e('0xc')](_0x6d0e('0xd'))){_0x1fcfdd[_0x6d0e('0xe')]=parseInt(_0x1fcfdd[_0x6d0e('0xd')],0xa);}_0x393aa3[_0x6d0e('0xf')](_['omit'](_0x1fcfdd,_0x6d0e('0x10')));}function initGraph(_0x4bb412,_0x2ef837){var _0x2903d4=new Graph();for(var _0x5d50ff in _0x4bb412){if(_0x4bb412[_0x6d0e('0xc')](_0x5d50ff)){if(_[_0x6d0e('0x11')](_0x4bb412[_0x5d50ff])){for(var _0x5132df=0x0;_0x5132df<_0x4bb412[_0x5d50ff][_0x6d0e('0x12')];_0x5132df+=0x1){addVertex(_0x2903d4,_0x4bb412[_0x5d50ff][_0x5132df],_0x5d50ff);}}else{addVertex(_0x2903d4,_0x4bb412[_0x5d50ff],_0x5d50ff);}}}for(var _0x4bd73b=0x0;_0x4bd73b<_0x2ef837[_0x6d0e('0x12')];_0x4bd73b+=0x1){if(_0x2ef837[_0x4bd73b][_0x6d0e('0x13')]&&_0x2ef837[_0x4bd73b]['target']){_0x2903d4[_0x6d0e('0x14')](_0x2ef837[_0x4bd73b][_0x6d0e('0x13')],_0x2ef837[_0x4bd73b][_0x6d0e('0x15')],_0x2ef837[_0x4bd73b]['value']);}}return _0x2903d4;}function getRoot(_0x2669cb){return parser[_0x6d0e('0x16')](_0x2669cb,{'object':!![]})[_0x6d0e('0x17')][_0x6d0e('0x18')];}function inspect(_0x41b680){return util[_0x6d0e('0x19')](_0x41b680,{'showHidden':![],'depth':null});}function initialize(_0x4a2079,_0x3477f0){var _0x57379d=getRoot(_0x4a2079[_0x6d0e('0x1a')]);if(!_0x57379d||!_0x57379d[_0x6d0e('0x1b')])return;var _0x1b495a,_0x1ece70,_0xb81d2b;logger['debug'](_0x6d0e('0x18'),JSON['stringify'](_0x57379d,null,0x2));_0x3477f0[_0x6d0e('0x1c')]=moment()[_0x6d0e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b495a=initGraph(_[_0x6d0e('0x1e')](_0x57379d,'mxCell'),_0x57379d['mxCell']);_0x1ece70=new Vertices(_0x3477f0,rpc,mailRpc);logger[_0x6d0e('0x1f')](util[_0x6d0e('0x1d')](_0x6d0e('0x20'),_0x3477f0[_0x6d0e('0x21')],_0x3477f0[_0x6d0e('0x22')],_0x3477f0[_0x6d0e('0x23')],_0x3477f0[_0x6d0e('0x24')],_0x3477f0[_0x6d0e('0x25')]));_0x1b495a[_0x6d0e('0x26')](_0x57379d['start']['id'],function(_0x439343){try{_0x439343=_0x1ece70[_0x6d0e('0x27')](_0x439343);logger[_0x6d0e('0x28')]('vertex',JSON['stringify'](_0x439343,null,0x2));if(_0x439343[_0x6d0e('0x29')]===_0x6d0e('0x2a')){logger[_0x6d0e('0x1f')](_0x6d0e('0x2b'));_0x3477f0[_0x6d0e('0x2c')]=_0x439343[_0x6d0e('0x2c')]||_0x3477f0[_0x6d0e('0x2c')];_0x3477f0[_0x6d0e('0x2d')]=_0x439343['extension'];_0x3477f0['priority']=_0x439343[_0x6d0e('0x2e')]?_0x439343[_0x6d0e('0x2e')]-0x1:0x1;return null;}else if(_0x439343&&_0x1ece70[_0x439343[_0x6d0e('0x29')]]){_0xb81d2b=_0x1ece70[_0x439343[_0x6d0e('0x29')]](_0x439343);logger['info'](_0x6d0e('0x2f'),JSON[_0x6d0e('0x30')](_0xb81d2b,null,0x2));if(_0xb81d2b&&_0xb81d2b[_0x6d0e('0x31')]===AGI_CODE_SUCCESS&&_0xb81d2b['result']!==AGI_RESULT_ERROR&&!_0x3477f0[_0x6d0e('0x32')]){logger['debug']('response',inspect(_0xb81d2b));return _[_0x6d0e('0x33')](_0xb81d2b[_0x6d0e('0x34')])?null:_0xb81d2b[_0x6d0e('0x34')][_0x6d0e('0x35')]();}else{logger[_0x6d0e('0x9')](_0x6d0e('0x2f'),inspect(_0xb81d2b));return null;}}else{logger[_0x6d0e('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x27dbad){logger[_0x6d0e('0x9')](_0x27dbad['stack']);return null;}});if(_0x57379d[_0x6d0e('0x36')]){logger[_0x6d0e('0x1f')](util[_0x6d0e('0x1d')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3477f0[_0x6d0e('0x21')],_0x3477f0[_0x6d0e('0x22')],_0x3477f0['callerid'],_0x3477f0[_0x6d0e('0x24')],_0x3477f0[_0x6d0e('0x25')]));_0x1b495a[_0x6d0e('0x26')](_0x57379d[_0x6d0e('0x36')]['id'],function(_0x186a8c){try{_0x186a8c=_0x1ece70[_0x6d0e('0x27')](_0x186a8c);logger[_0x6d0e('0x28')](_0x6d0e('0x37'),JSON['stringify'](_0x186a8c,null,0x2));if(_0x186a8c&&_0x1ece70[_0x186a8c[_0x6d0e('0x29')]]){_0xb81d2b=_0x1ece70[_0x186a8c[_0x6d0e('0x29')]](_0x186a8c);if(_0xb81d2b){logger['debug'](_0x6d0e('0x2f'),inspect(_0xb81d2b));return _[_0x6d0e('0x33')](_0xb81d2b['result'])?null:_0xb81d2b[_0x6d0e('0x34')][_0x6d0e('0x35')]();}else{logger[_0x6d0e('0x9')](_0x6d0e('0x2f'),inspect(_0xb81d2b));return null;}}else{logger[_0x6d0e('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x17c1f6){logger[_0x6d0e('0x9')](_0x17c1f6['stack']);return null;}});}logger['info'](util['format'](_0x6d0e('0x38'),_0x3477f0[_0x6d0e('0x21')],_0x3477f0[_0x6d0e('0x22')],_0x3477f0[_0x6d0e('0x23')],_0x3477f0['dnid'],_0x3477f0['uniqueid']));logger[_0x6d0e('0x1f')](util[_0x6d0e('0x1d')](_0x6d0e('0x39'),_0x3477f0[_0x6d0e('0x2c')],_0x3477f0[_0x6d0e('0x2d')],parseInt(_0x3477f0['priority'],0xa)+0x1));_0x3477f0[_0x6d0e('0x3a')](_0x3477f0['context'],_0x3477f0[_0x6d0e('0x2d')],parseInt(_0x3477f0['priority'],0xa)+0x1);_0x3477f0[_0x6d0e('0x3b')]();}function handleNotFound(_0x21c915){logger[_0x6d0e('0x9')](util[_0x6d0e('0x1d')](_0x6d0e('0x3c'),_0x21c915[_0x6d0e('0x21')]));_0x21c915[_0x6d0e('0x3a')](_0x21c915[_0x6d0e('0x2c')],_0x21c915[_0x6d0e('0x2d')],parseInt(_0x21c915['priority'],0xa)+0x1);_0x21c915[_0x6d0e('0x3b')]();}function handleUnpublished(_0x2eacc2){logger['error'](util[_0x6d0e('0x1d')](_0x6d0e('0x3d'),_0x2eacc2[_0x6d0e('0x21')]));_0x2eacc2[_0x6d0e('0x3a')](_0x2eacc2[_0x6d0e('0x2c')],_0x2eacc2['extension'],parseInt(_0x2eacc2[_0x6d0e('0x2e')],0xa)+0x1);_0x2eacc2[_0x6d0e('0x3b')]();}module[_0x6d0e('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index e92a365..11d0e94 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 _0xd959=['headers','util','stream','Transform','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd959,0xd3));var _0x9d95=function(_0x1a7fd0,_0x30c701){_0x1a7fd0=_0x1a7fd0-0x0;var _0x3e23fa=_0xd959[_0x1a7fd0];return _0x3e23fa;};'use strict';var util=require(_0x9d95('0x0'));var Transform=require(_0x9d95('0x1'))[_0x9d95('0x2')];function AGIReply(_0x1a69d1){Transform['call'](this,_0x1a69d1);this[_0x9d95('0x3')]='';this[_0x9d95('0x4')]=![];}util[_0x9d95('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x46d03f,_0x4a246e,_0x1d3afa){var _0x4e94ee='\x0a',_0x1e4f68=['\x0a\x0a',_0x9d95('0x6')],_0x4e6126=-0x1,_0x203822=-0x1,_0x3a338f='',_0xe79021=0x0,_0x5a79de='',_0x5d8fa4='';this[_0x9d95('0x3')]+=_0x46d03f[_0x9d95('0x7')]();_0x5a79de=this['_localBuffer'];if(!this[_0x9d95('0x4')]){_0xe79021=0x0;while(_0x1e4f68[_0xe79021]){while((_0x203822=_0x5a79de[_0x9d95('0x8')](_0x1e4f68[_0xe79021]))!=-0x1){_0x3a338f=_0x1e4f68[_0xe79021];_0x5d8fa4=_0x5a79de[_0x9d95('0x9')](0x0,_0x203822);_0x5a79de=_0x5a79de['substring'](_0x203822+_0x3a338f[_0x9d95('0xa')]);var _0x203606=_0x5d8fa4['split'](_0x4e94ee),_0x41d216=0x0,_0x21bdb9={},_0x4cdc42='',_0x3b7efc='',_0xf2c7ce=-0x1;while(_0x203606[_0x41d216]){_0xf2c7ce=_0x203606[_0x41d216]['indexOf'](':');if(_0xf2c7ce!=-0x1){_0x4cdc42=_0x203606[_0x41d216][_0x9d95('0xb')](0x0,_0xf2c7ce)['trim']();_0x3b7efc=_0x203606[_0x41d216][_0x9d95('0xb')](_0xf2c7ce+0x1)[_0x9d95('0xc')]();if(_0x4cdc42[_0x9d95('0xa')]>0x0){_0x21bdb9[_0x4cdc42]=_0x3b7efc;}}else{}_0x41d216++;}this[_0x9d95('0xd')](_0x9d95('0xe'),_0x21bdb9);this[_0x9d95('0x4')]=!![];}_0xe79021++;}this[_0x9d95('0x3')]=_0x5a79de;}else{while((_0x4e6126=_0x5a79de['indexOf'](_0x4e94ee))!=-0x1){_0x5d8fa4=_0x5a79de['substring'](0x0,_0x4e6126);this[_0x9d95('0xd')]('line',_0x5d8fa4);_0x5a79de=_0x5a79de[_0x9d95('0x9')](_0x4e6126+_0x4e94ee['length']);}this['_localBuffer']=_0x5a79de;}_0x1d3afa();};module['exports']=AGIReply; \ No newline at end of file +var _0x7b22=['_inBody','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','split','slice','trim','emit','exports','util','call'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7b22,0x67));var _0x27b2=function(_0x1b5080,_0x3e7cc9){_0x1b5080=_0x1b5080-0x0;var _0x195c87=_0x7b22[_0x1b5080];return _0x195c87;};'use strict';var util=require(_0x27b2('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x1ef65a){Transform[_0x27b2('0x1')](this,_0x1ef65a);this['_localBuffer']='';this[_0x27b2('0x2')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x27b2('0x3')]=function(_0x4d39f2,_0x5548b3,_0x14e786){var _0x1db1bf='\x0a',_0x3cfc8b=['\x0a\x0a',_0x27b2('0x4')],_0x68faca=-0x1,_0x137a51=-0x1,_0x5d723b='',_0x4e59ea=0x0,_0x256728='',_0x5d4691='';this[_0x27b2('0x5')]+=_0x4d39f2[_0x27b2('0x6')]();_0x256728=this[_0x27b2('0x5')];if(!this['_inBody']){_0x4e59ea=0x0;while(_0x3cfc8b[_0x4e59ea]){while((_0x137a51=_0x256728[_0x27b2('0x7')](_0x3cfc8b[_0x4e59ea]))!=-0x1){_0x5d723b=_0x3cfc8b[_0x4e59ea];_0x5d4691=_0x256728[_0x27b2('0x8')](0x0,_0x137a51);_0x256728=_0x256728[_0x27b2('0x8')](_0x137a51+_0x5d723b[_0x27b2('0x9')]);var _0x45ce9a=_0x5d4691[_0x27b2('0xa')](_0x1db1bf),_0x15bfc5=0x0,_0x46a10d={},_0x5ab85c='',_0x56af60='',_0x4f55cd=-0x1;while(_0x45ce9a[_0x15bfc5]){_0x4f55cd=_0x45ce9a[_0x15bfc5][_0x27b2('0x7')](':');if(_0x4f55cd!=-0x1){_0x5ab85c=_0x45ce9a[_0x15bfc5][_0x27b2('0xb')](0x0,_0x4f55cd)['trim']();_0x56af60=_0x45ce9a[_0x15bfc5]['slice'](_0x4f55cd+0x1)[_0x27b2('0xc')]();if(_0x5ab85c[_0x27b2('0x9')]>0x0){_0x46a10d[_0x5ab85c]=_0x56af60;}}else{}_0x15bfc5++;}this[_0x27b2('0xd')]('headers',_0x46a10d);this[_0x27b2('0x2')]=!![];}_0x4e59ea++;}this[_0x27b2('0x5')]=_0x256728;}else{while((_0x68faca=_0x256728[_0x27b2('0x7')](_0x1db1bf))!=-0x1){_0x5d4691=_0x256728['substring'](0x0,_0x68faca);this['emit']('line',_0x5d4691);_0x256728=_0x256728[_0x27b2('0x8')](_0x68faca+_0x1db1bf[_0x27b2('0x9')]);}this[_0x27b2('0x5')]=_0x256728;}_0x14e786();};module[_0x27b2('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 4b49456..4298ccb 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 _0x0c02=['format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','then','error','getSquareProjects','GetSquareProjects','name','production','getSquareProject','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2'];(function(_0x3146f6,_0x437cde){var _0x4a509a=function(_0x4a8756){while(--_0x4a8756){_0x3146f6['push'](_0x3146f6['shift']());}};_0x4a509a(++_0x437cde);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x20c0('0x0'));var jayson=require(_0x20c0('0x1'));var client=jayson['client'][_0x20c0('0x2')]({'port':0x2329});function request(_0x5c8750,_0x454922){return new Promise(function(_0x6d03d0,_0x38022e){return client[_0x20c0('0x3')](_0x5c8750,_0x454922)[_0x20c0('0x4')](function(_0x1474f7){if(_0x1474f7[_0x20c0('0x5')]){return _0x38022e(_0x1474f7[_0x20c0('0x5')]['message']);}else{return _0x6d03d0(_0x1474f7['result']);}})['catch'](function(_0x4db532){return _0x38022e(_0x4db532);});});}exports[_0x20c0('0x6')]=function(){return request(_0x20c0('0x7'),{'options':{'raw':![],'attributes':['id',_0x20c0('0x8'),_0x20c0('0x9')]}});};exports[_0x20c0('0xa')]=function(_0xedd21d){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xedd21d},'attributes':['production']}});};exports['getMailAccountById']=function(_0x578592){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x578592},'include':[{'model':_0x20c0('0xb'),'as':_0x20c0('0xc'),'include':[{'model':_0x20c0('0xd'),'as':_0x20c0('0xd')}]}],'attributes':['id','name',_0x20c0('0xe')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5c9ee6){return request(_0x20c0('0xf'),{'options':{'where':{'id':_0x5c9ee6},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x10')]=function(_0x3b2bba){return request(_0x20c0('0x11'),{'options':{'where':{'id':_0x3b2bba},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x12')]=function(_0x105839){return request(_0x20c0('0x13'),{'options':{'where':{'id':_0x105839},'attributes':['name']}});};exports[_0x20c0('0x14')]=function(_0xc78626){return request(_0x20c0('0x15'),{'options':{'where':{'id':_0xc78626},'attributes':[_0x20c0('0x16')]}});};exports[_0x20c0('0x17')]=function(_0xeff5b9){return request('ShowUser',{'options':{'where':{'id':_0xeff5b9},'attributes':['name']}});};exports['getContactByPhone']=function(_0x10a921){return request(_0x20c0('0x18'),{'options':{'where':{'phone':_0x10a921[_0x20c0('0x19')]},'attributes':['id']}});};exports[_0x20c0('0x1a')]=function(_0x5b3725){return request(_0x20c0('0x1b'),{'options':{'where':{'id':_0x5b3725},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x1c')]=function(_0x5851eb){return request('ShowSound',{'options':{'where':{'id':_0x5851eb},'attributes':[_0x20c0('0x1d')]}});};exports[_0x20c0('0x1e')]=function(_0x1407d3){return request(_0x20c0('0x1f'),{'options':{'raw':![],'where':{'id':_0x1407d3},'include':[{'model':_0x20c0('0x20'),'as':'Intervals'}]}});};exports[_0x20c0('0x21')]=function(_0x28959a){return request(_0x20c0('0x22'),{'options':{'where':{'id':_0x28959a},'attributes':['id',_0x20c0('0x8')]}});};exports['createSmsMessage']=function(_0xfea1eb){return request(_0x20c0('0x23'),{'body':_0xfea1eb});};exports[_0x20c0('0x24')]=function(_0x114ff9){return request(_0x20c0('0x25'),{'body':_0x114ff9});};exports[_0x20c0('0x26')]=function(_0x14c676){return request('CreateSquareReport',{'body':_[_0x20c0('0x27')](_0x14c676,{'project_name':_0x14c676[_0x20c0('0x28')],'prev_project_name':_0x14c676[_0x20c0('0x29')]||'','is_subproject':_0x14c676[_0x20c0('0x29')]?!![]:![],'leaveAt':moment()[_0x20c0('0x2a')](_0x20c0('0x2b'))})});};exports['createSquareRecording']=function(_0x4e0cbb){return request(_0x20c0('0x2c'),{'body':_0x4e0cbb});};exports[_0x20c0('0x2d')]=function(_0x1e3790){return request('CreateSquareMessage',{'body':_0x1e3790});};exports[_0x20c0('0x2e')]=function(_0x25592b){return request(_0x20c0('0x2f'),{'options':{'raw':![],'where':{'phone':_0x25592b[_0x20c0('0x19')],'ListId':_0x25592b['ListId']}}})['then'](function(_0x29d8ee){if(_0x29d8ee){return _0x29d8ee;}return request(_0x20c0('0x30'),{'body':_0x25592b});});};exports[_0x20c0('0x31')]=function(_0xe961ad){return request(_0x20c0('0x32'),{'options':{'where':{'id':_0xe961ad},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x33')]=function(_0x40c0a7,_0x3ac0a4){return request(_0x20c0('0x34'),{'body':{'interface':_0x3ac0a4},'options':{'where':_0x40c0a7}});};exports[_0x20c0('0x35')]=function(_0x32448b,_0x1fef93,_0x45fa64){return request('PauseUser',{'body':{'type':_0x1fef93,'uniqueid':_0x45fa64},'options':{'where':_0x32448b}});};exports[_0x20c0('0x36')]=function(_0x1ad64f){return request(_0x20c0('0x37'),{'body':{},'options':{'where':_0x1ad64f}});};exports[_0x20c0('0x38')]=function(_0x59406e){return request(_0x20c0('0x39'),{'body':{},'options':{'where':_0x59406e}});}; \ No newline at end of file +var _0x4876=['createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','jayson/promise','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x6487('0x0'));var client=jayson['client']['http']({'port':0x2329});function request(_0x236189,_0x498e31){return new Promise(function(_0x43e7e8,_0x2bace9){return client[_0x6487('0x1')](_0x236189,_0x498e31)[_0x6487('0x2')](function(_0x57d99d){if(_0x57d99d[_0x6487('0x3')]){return _0x2bace9(_0x57d99d[_0x6487('0x3')]['message']);}else{return _0x43e7e8(_0x57d99d[_0x6487('0x4')]);}})[_0x6487('0x5')](function(_0x2df3c1){return _0x2bace9(_0x2df3c1);});});}exports[_0x6487('0x6')]=function(){return request(_0x6487('0x7'),{'options':{'raw':![],'attributes':['id',_0x6487('0x8'),_0x6487('0x9')]}});};exports[_0x6487('0xa')]=function(_0x5f8f96){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5f8f96},'attributes':[_0x6487('0x9')]}});};exports[_0x6487('0xb')]=function(_0x2ce7c4){return request(_0x6487('0xc'),{'options':{'raw':![],'where':{'id':_0x2ce7c4},'include':[{'model':_0x6487('0xd'),'as':_0x6487('0xe'),'include':[{'model':_0x6487('0xf'),'as':_0x6487('0xf')}]}],'attributes':['id','name',_0x6487('0x10')],'smtp':!![]}});};exports[_0x6487('0x11')]=function(_0x3ffa96){return request(_0x6487('0x12'),{'options':{'where':{'id':_0x3ffa96},'attributes':['name']}});};exports[_0x6487('0x13')]=function(_0x10f2e1){return request(_0x6487('0x14'),{'options':{'where':{'id':_0x10f2e1},'attributes':[_0x6487('0x8')]}});};exports['getVariableById']=function(_0x522154){return request(_0x6487('0x15'),{'options':{'where':{'id':_0x522154},'attributes':['name']}});};exports[_0x6487('0x16')]=function(_0x583f04){return request(_0x6487('0x17'),{'options':{'where':{'id':_0x583f04},'attributes':[_0x6487('0x18')]}});};exports[_0x6487('0x19')]=function(_0x26b2f2){return request(_0x6487('0x1a'),{'options':{'where':{'id':_0x26b2f2},'attributes':['name']}});};exports['getContactByPhone']=function(_0x5afb4a){return request(_0x6487('0x1b'),{'options':{'where':{'phone':_0x5afb4a[_0x6487('0x1c')]},'attributes':['id']}});};exports[_0x6487('0x1d')]=function(_0x424ae2){return request(_0x6487('0x1e'),{'options':{'where':{'id':_0x424ae2},'attributes':[_0x6487('0x8')]}});};exports[_0x6487('0x1f')]=function(_0x35543e){return request(_0x6487('0x20'),{'options':{'where':{'id':_0x35543e},'attributes':[_0x6487('0x21')]}});};exports[_0x6487('0x22')]=function(_0x2827a3){return request(_0x6487('0x23'),{'options':{'raw':![],'where':{'id':_0x2827a3},'include':[{'model':_0x6487('0x24'),'as':_0x6487('0x25')}]}});};exports[_0x6487('0x26')]=function(_0x3affe7){return request(_0x6487('0x27'),{'options':{'where':{'id':_0x3affe7},'attributes':['id',_0x6487('0x8')]}});};exports['createSmsMessage']=function(_0x58d269){return request(_0x6487('0x28'),{'body':_0x58d269});};exports['createSquareDetailsReport']=function(_0x57a2c4){return request(_0x6487('0x29'),{'body':_0x57a2c4});};exports[_0x6487('0x2a')]=function(_0x4ebd9d){return request(_0x6487('0x2b'),{'body':_[_0x6487('0x2c')](_0x4ebd9d,{'project_name':_0x4ebd9d[_0x6487('0x2d')],'prev_project_name':_0x4ebd9d[_0x6487('0x2e')]||'','is_subproject':_0x4ebd9d[_0x6487('0x2e')]?!![]:![],'leaveAt':moment()['format'](_0x6487('0x2f'))})});};exports['createSquareRecording']=function(_0x335bd8){return request('CreateSquareRecording',{'body':_0x335bd8});};exports['createSquareMessage']=function(_0x412056){return request(_0x6487('0x30'),{'body':_0x412056});};exports[_0x6487('0x31')]=function(_0x4c424a){return request(_0x6487('0x32'),{'options':{'raw':![],'where':{'phone':_0x4c424a[_0x6487('0x1c')],'ListId':_0x4c424a[_0x6487('0x33')]}}})[_0x6487('0x2')](function(_0x35b089){if(_0x35b089){return _0x35b089;}return request(_0x6487('0x34'),{'body':_0x4c424a});});};exports['getPauseById']=function(_0x2868d7){return request(_0x6487('0x35'),{'options':{'where':{'id':_0x2868d7},'attributes':['name']}});};exports[_0x6487('0x36')]=function(_0x2920a9,_0x3b59af){return request(_0x6487('0x37'),{'body':{'interface':_0x3b59af},'options':{'where':_0x2920a9}});};exports[_0x6487('0x38')]=function(_0x809bb8,_0x21aff9,_0x5d5bae){return request(_0x6487('0x39'),{'body':{'type':_0x21aff9,'uniqueid':_0x5d5bae},'options':{'where':_0x809bb8}});};exports['agentUnpause']=function(_0x2d320c){return request('UnpauseUser',{'body':{},'options':{'where':_0x2d320c}});};exports['agentLogout']=function(_0x4c2c75){return request('LogoutUser',{'body':{},'options':{'where':_0x4c2c75}});}; \ 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 bd313ae..3475086 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 _0xd046=['exports','./lex'];(function(_0x3c09ba,_0x357168){var _0x1e7de9=function(_0x25f851){while(--_0x25f851){_0x3c09ba['push'](_0x3c09ba['shift']());}};_0x1e7de9(++_0x357168);}(_0xd046,0x129));var _0x6d04=function(_0x504546,_0x23c419){_0x504546=_0x504546-0x0;var _0x22d39c=_0xd046[_0x504546];return _0x22d39c;};var polly=require('./polly');var lex=require(_0x6d04('0x0'));module[_0x6d04('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8506=['./lex'];(function(_0x4bbc8d,_0x8e07e3){var _0x2f8938=function(_0x15e112){while(--_0x15e112){_0x4bbc8d['push'](_0x4bbc8d['shift']());}};_0x2f8938(++_0x8e07e3);}(_0x8506,0xe8));var _0x6850=function(_0x548c3d,_0x4e69c7){_0x548c3d=_0x548c3d-0x0;var _0x476faa=_0x8506[_0x548c3d];return _0x476faa;};var polly=require('./polly');var lex=require(_0x6850('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 07e1e5f..ab25f5b 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 _0xa571=['exports','./lib/api'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xa571,0x107));var _0x1a57=function(_0x2a2424,_0x2c537b){_0x2a2424=_0x2a2424-0x0;var _0x3722a7=_0xa571[_0x2a2424];return _0x3722a7;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file +var _0xe5b5=['exports','./lib/api'];(function(_0x52be66,_0x4d1863){var _0x4037a6=function(_0x3c87cc){while(--_0x3c87cc){_0x52be66['push'](_0x52be66['shift']());}};_0x4037a6(++_0x4d1863);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0xe5b5[_0x2e7f96];return _0x315277;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ 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 b6d2d08..e9eb9cd 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(_0x4f04f4,_0xab5d45){var _0x18f560=function(_0x1eada4){while(--_0x1eada4){_0x4f04f4['push'](_0x4f04f4['shift']());}};_0x18f560(++_0xab5d45);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x88b6a5,_0x3583e7){var _0x48eccd=function(_0x1fef75){while(--_0x1fef75){_0x88b6a5['push'](_0x88b6a5['shift']());}};_0x48eccd(++_0x3583e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 90bc678..8513cd6 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 _0x7492=['./lib/api'];(function(_0xd9910e,_0x3afa81){var _0x2537e2=function(_0x13d716){while(--_0x13d716){_0xd9910e['push'](_0xd9910e['shift']());}};_0x2537e2(++_0x3afa81);}(_0x7492,0xad));var _0x2749=function(_0x124f16,_0x53e08e){_0x124f16=_0x124f16-0x0;var _0x3a5d62=_0x7492[_0x124f16];return _0x3a5d62;};'use strict';var polly=require(_0x2749('0x0'));module['exports']=function(_0x570012,_0x51a14f,_0x390b0b,_0xc6be38,_0x5eb9bb,_0x1d0d2e,_0x53a8e0){return polly(_0x570012,_0x51a14f,_0x390b0b,_0xc6be38,_0x5eb9bb,_0x1d0d2e,_0x53a8e0);}; \ No newline at end of file +var _0x7b35=['./lib/api','exports'];(function(_0x401ecb,_0x506ab7){var _0x543363=function(_0x1bca83){while(--_0x1bca83){_0x401ecb['push'](_0x401ecb['shift']());}};_0x543363(++_0x506ab7);}(_0x7b35,0x64));var _0x57b3=function(_0x2fa074,_0x3112a8){_0x2fa074=_0x2fa074-0x0;var _0x55c60f=_0x7b35[_0x2fa074];return _0x55c60f;};'use strict';var polly=require(_0x57b3('0x0'));module[_0x57b3('0x1')]=function(_0x271fa4,_0x52a80a,_0x240c2b,_0x48a267,_0x3bb1ba,_0x35f92b,_0x5342e2){return polly(_0x271fa4,_0x52a80a,_0x240c2b,_0x48a267,_0x3bb1ba,_0x35f92b,_0x5342e2);}; \ 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 0004799..a87fff2 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 _0x12c0=['Polly','text','bluebird','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x24c22c,_0x56ca7a){var _0x1a5654=function(_0x3cbdd3){while(--_0x3cbdd3){_0x24c22c['push'](_0x24c22c['shift']());}};_0x1a5654(++_0x56ca7a);}(_0x12c0,0x18e));var _0x012c=function(_0x471843,_0x1ead53){_0x471843=_0x471843-0x0;var _0x37945b=_0x12c0[_0x471843];return _0x37945b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x012c('0x0'));var rs=require('randomstring');var AWS=require(_0x012c('0x1'));function pollyResult(_0x97c038,_0x2c5126,_0x42115e){return new BPromise(function(_0x199857,_0x5a7581){_0x97c038['synthesizeSpeech'](_0x2c5126,function(_0x28cb2d,_0x4f0b9b){if(_0x28cb2d){_0x5a7581(_0x28cb2d);}else if(_0x4f0b9b){if(_0x4f0b9b[_0x012c('0x2')]instanceof Buffer){fs[_0x012c('0x3')](_0x42115e,_0x4f0b9b[_0x012c('0x2')],function(_0x1d7758){if(_0x1d7758){_0x5a7581(_0x1d7758);}else{_0x199857();}});}else{_0x5a7581(new Error(_0x012c('0x4')));}}else{_0x5a7581(new Error(_0x012c('0x5')));}});});}module[_0x012c('0x6')]=function(_0x4ce48d,_0x48649b,_0x37e85c,_0x2dca65,_0x2a7723,_0x2d8cc8,_0x290740){var _0x3bc8a2=new AWS[(_0x012c('0x7'))]({'accessKeyId':_0x4ce48d,'secretAccessKey':_0x48649b,'region':_0x37e85c});var _0x4d22ca={'Text':_0x2a7723,'TextType':_0x2d8cc8||_0x012c('0x8'),'OutputFormat':'mp3','VoiceId':_0x2dca65};return pollyResult(_0x3bc8a2,_0x4d22ca,_0x290740);}; \ No newline at end of file +var _0xa66e=['mp3','path','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x4893b1,_0x1ad5f0){var _0x1981a9=function(_0x2d19fa){while(--_0x2d19fa){_0x4893b1['push'](_0x4893b1['shift']());}};_0x1981a9(++_0x1ad5f0);}(_0xa66e,0xc1));var _0xea66=function(_0x368920,_0x321966){_0x368920=_0x368920-0x0;var _0x3ac9cc=_0xa66e[_0x368920];return _0x3ac9cc;};'use strict';var fs=require('fs');var path=require(_0xea66('0x0'));var BPromise=require('bluebird');var rs=require(_0xea66('0x1'));var AWS=require(_0xea66('0x2'));function pollyResult(_0x1289d3,_0x59b1f2,_0x34ed55){return new BPromise(function(_0x4c4fa8,_0x55fd1d){_0x1289d3['synthesizeSpeech'](_0x59b1f2,function(_0x21a2ac,_0x99eaf4){if(_0x21a2ac){_0x55fd1d(_0x21a2ac);}else if(_0x99eaf4){if(_0x99eaf4[_0xea66('0x3')]instanceof Buffer){fs[_0xea66('0x4')](_0x34ed55,_0x99eaf4['AudioStream'],function(_0x5e7e54){if(_0x5e7e54){_0x55fd1d(_0x5e7e54);}else{_0x4c4fa8();}});}else{_0x55fd1d(new Error(_0xea66('0x5')));}}else{_0x55fd1d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0xba373b,_0x128466,_0xd40dc6,_0x37a641,_0x4aed5b,_0x2cc045,_0x123b5d){var _0x291635=new AWS[(_0xea66('0x6'))]({'accessKeyId':_0xba373b,'secretAccessKey':_0x128466,'region':_0xd40dc6});var _0x43a25f={'Text':_0x4aed5b,'TextType':_0x2cc045||'text','OutputFormat':_0xea66('0x7'),'VoiceId':_0x37a641};return pollyResult(_0x291635,_0x43a25f,_0x123b5d);}; \ 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 2c8edff..273db22 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 _0xb544=['./lib/api'];(function(_0x148bcc,_0x58d6f7){var _0x3a60fb=function(_0x371331){while(--_0x371331){_0x148bcc['push'](_0x148bcc['shift']());}};_0x3a60fb(++_0x58d6f7);}(_0xb544,0xd5));var _0x4b54=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xb544[_0x1caf6a];return _0x1bf493;};'use strict';var asr=require(_0x4b54('0x0'));module['exports']=function(_0x2872f5,_0x193dfd,_0x31e514,_0x17081e){return asr(_0x2872f5,_0x193dfd,_0x31e514);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x378c76,_0x4b3d66,_0x221898,_0x23548d){return asr(_0x378c76,_0x4b3d66,_0x221898);}; \ 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 f06b7e8..4553cff 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 _0x1b73=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1b73,0x1d5));var _0x31b7=function(_0xc5f0a4,_0x2c6af4){_0xc5f0a4=_0xc5f0a4-0x0;var _0x21d1bb=_0x1b73[_0xc5f0a4];return _0x21d1bb;};'use strict';var url=require('url');var BPromise=require(_0x31b7('0x0'));var fs=require('fs');var host=_0x31b7('0x1');module[_0x31b7('0x2')]=function(_0x5c767e,_0x4bf5ae,_0x17c0ef){return new BPromise(function(_0x59e606,_0x40fef2){var _0x3682cc;if(typeof _0x5c767e!=='string'||_0x5c767e[_0x31b7('0x3')]===0x0){return _0x40fef2(_0x31b7('0x4'));}if(typeof _0x4bf5ae!==_0x31b7('0x5')||_0x4bf5ae['length']===0x0){return _0x40fef2(_0x31b7('0x6'));}if(typeof _0x17c0ef!==_0x31b7('0x7')&&(typeof _0x17c0ef!==_0x31b7('0x5')||_0x17c0ef[_0x31b7('0x3')]===0x0)){return _0x40fef2(_0x31b7('0x8'));}try{_0x3682cc=fs[_0x31b7('0x9')](_0x5c767e)[_0x31b7('0xa')]('base64');}catch(_0x268428){return _0x40fef2(_0x268428);}return _0x59e606({'method':_0x31b7('0xb'),'uri':host+_0x31b7('0xc')+_0x4bf5ae,'body':{'config':{'encoding':_0x31b7('0xd'),'sampleRateHertz':_0x31b7('0xe'),'languageCode':_0x17c0ef},'audio':{'content':_0x3682cc}},'json':!![]});});}; \ No newline at end of file +var _0xa902=['readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x448045,_0x54c154){var _0x428877=function(_0x4fce6f){while(--_0x4fce6f){_0x448045['push'](_0x448045['shift']());}};_0x428877(++_0x54c154);}(_0xa902,0x8d));var _0x2a90=function(_0xcc774e,_0x185115){_0xcc774e=_0xcc774e-0x0;var _0x4833e2=_0xa902[_0xcc774e];return _0x4833e2;};'use strict';var url=require(_0x2a90('0x0'));var BPromise=require(_0x2a90('0x1'));var fs=require('fs');var host=_0x2a90('0x2');module[_0x2a90('0x3')]=function(_0x1b4117,_0x4983a4,_0x2da982){return new BPromise(function(_0x5b4a40,_0x4961c2){var _0x169808;if(typeof _0x1b4117!==_0x2a90('0x4')||_0x1b4117[_0x2a90('0x5')]===0x0){return _0x4961c2(_0x2a90('0x6'));}if(typeof _0x4983a4!==_0x2a90('0x4')||_0x4983a4[_0x2a90('0x5')]===0x0){return _0x4961c2('key\x20should\x20be\x20a\x20string');}if(typeof _0x2da982!==_0x2a90('0x7')&&(typeof _0x2da982!=='string'||_0x2da982['length']===0x0)){return _0x4961c2(_0x2a90('0x8'));}try{_0x169808=fs[_0x2a90('0x9')](_0x1b4117)[_0x2a90('0xa')](_0x2a90('0xb'));}catch(_0x18a60e){return _0x4961c2(_0x18a60e);}return _0x5b4a40({'method':'POST','uri':host+_0x2a90('0xc')+_0x4983a4,'body':{'config':{'encoding':_0x2a90('0xd'),'sampleRateHertz':_0x2a90('0xe'),'languageCode':_0x2da982},'audio':{'content':_0x169808}},'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 dd41ecd..521cf70 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 _0x100f=['./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x100f,0x72));var _0xf100=function(_0x57b7d8,_0x26e29f){_0x57b7d8=_0x57b7d8-0x0;var _0x4f43b8=_0x100f[_0x57b7d8];return _0x4f43b8;};var asr=require(_0xf100('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9856=['exports','./asr'];(function(_0x9079ec,_0x3785ab){var _0x36bb39=function(_0x598fd8){while(--_0x598fd8){_0x9079ec['push'](_0x9079ec['shift']());}};_0x36bb39(++_0x3785ab);}(_0x9856,0x135));var _0x6985=function(_0x232d4b,_0x4ae477){_0x232d4b=_0x232d4b-0x0;var _0x3050e5=_0x9856[_0x232d4b];return _0x3050e5;};var asr=require(_0x6985('0x0'));module[_0x6985('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 b25a454..92be63c 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 _0x7f27=['queryText','responseId','intentDetectionConfidence','fulfillmentText','asr','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','nda','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','writeFileSync','base64','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','then','resolve','.mp3','audioContent','777','.wav','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','results','alternatives','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','status','code','metadata','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','languageCode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f27,0x195));var _0x77f2=function(_0x1e2e5a,_0x11296d){_0x1e2e5a=_0x1e2e5a-0x0;var _0x56a04e=_0x7f27[_0x1e2e5a];return _0x56a04e;};'use strict';var apiai=require(_0x77f2('0x0'));var BPromise=require(_0x77f2('0x1'));var dialogflow=require(_0x77f2('0x2'));var fs=require('fs');var http=require(_0x77f2('0x3'));var https=require('https');var md5=require('md5');var path=require(_0x77f2('0x4'));var querystring=require(_0x77f2('0x5'));var rp=require(_0x77f2('0x6'));var rs=require(_0x77f2('0x7'));var sox=require(_0x77f2('0x8'));var tts=require(_0x77f2('0x9'));var urlParse=require(_0x77f2('0xa'))[_0x77f2('0xb')];var util=require('util');var aws=require(_0x77f2('0xc'));var google=require(_0x77f2('0xd'));var sestek=require('./sestek');var tilde=require(_0x77f2('0xe'));var logger=require('../../../config/logger')(_0x77f2('0xf'));var ISPEECH_API=_0x77f2('0x10');function downloadFile(_0x2e6ea7,_0x2a76a2){return new BPromise(function(_0x7ef75,_0x34ca51){var _0x2b62cf=urlParse(_0x2e6ea7);var _0x4078a5=_0x2b62cf[_0x77f2('0x11')]===_0x77f2('0x12')?https:http;var _0x142928={'host':_0x2b62cf['host'],'path':_0x2b62cf[_0x77f2('0x4')],'headers':{'user-agent':_0x77f2('0x13')}};_0x4078a5[_0x77f2('0x14')](_0x142928,function(_0xb2e8e4){if(_0xb2e8e4[_0x77f2('0x15')]!==0xc8){logger[_0x77f2('0x16')](_0x77f2('0x17')+_0x2e6ea7+_0x77f2('0x18')+_0xb2e8e4[_0x77f2('0x15')]+'\x20('+_0xb2e8e4[_0x77f2('0x19')]+')');_0x34ca51(new Error('request\x20to\x20'+_0x2e6ea7+_0x77f2('0x18')+_0xb2e8e4[_0x77f2('0x15')]+'\x20('+_0xb2e8e4['statusMessage']+')'));return;}var _0x1e46a2=fs['createWriteStream'](_0x2a76a2);_0x1e46a2['on']('finish',function(){logger[_0x77f2('0x1a')]('finish\x20download\x20file');_0x1e46a2[_0x77f2('0x1b')](_0x7ef75);});_0x1e46a2['on'](_0x77f2('0x16'),function(_0x5b17c5){fs[_0x77f2('0x1c')](_0x2a76a2);logger[_0x77f2('0x16')](_0x77f2('0x1d'),_0x5b17c5);_0x34ca51(_0x5b17c5);});_0xb2e8e4[_0x77f2('0x1e')](_0x1e46a2);})['on'](_0x77f2('0x16'),function(_0x223e96){logger['error'](_0x223e96);_0x34ca51(_0x223e96);})[_0x77f2('0x1f')]();});}function uploadFile(_0xba2a58){return new BPromise(function(_0x4bae18,_0xf746ef){var _0x33a9ce=urlParse(_0xba2a58);var _0x27d037=_0x33a9ce[_0x77f2('0x11')]===_0x77f2('0x12')?https:http;var _0xe9e347={'host':_0x33a9ce['host'],'path':_0x33a9ce[_0x77f2('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x27d037[_0x77f2('0x14')](_0xe9e347,function(_0x1cb005){if(_0x1cb005[_0x77f2('0x15')]!==0xc8){_0xf746ef(new Error(_0x77f2('0x17')+_0xba2a58+_0x77f2('0x18')+_0x1cb005['statusCode']+'\x20('+_0x1cb005[_0x77f2('0x19')]+')'));return;}var _0x45c712='';_0x1cb005['on'](_0x77f2('0x20'),function(_0x16e7f3){_0x45c712+=_0x16e7f3;});_0x1cb005['on']('end',function(){_0x4bae18(_0x45c712);});})['on']('error',function(_0x2aa63f){_0xf746ef(_0x2aa63f);})[_0x77f2('0x1f')]();});}function convertFile(_0x5223e0,_0x12976d){return new BPromise(function(_0x1993ae,_0x25654c){var _0x51c91d=sox[_0x77f2('0x21')](_0x5223e0,_0x12976d,{'sampleRate':0x1f40,'format':_0x77f2('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51c91d['on'](_0x77f2('0x16'),function(_0x3b065c){logger[_0x77f2('0x16')](_0x77f2('0x23'),_0x3b065c);_0x25654c(_0x3b065c);});_0x51c91d['on'](_0x77f2('0x1f'),function(){logger['info'](_0x77f2('0x24'));_0x1993ae();});_0x51c91d[_0x77f2('0x25')]();});}function base64Decode(_0x1c224e,_0xdcb594){var _0x4c4759=path['resolve'](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+'.wav');fs[_0x77f2('0x28')](_0x4c4759,_0x1c224e,_0x77f2('0x29'));return convertFile(_0x4c4759,_0xdcb594)['then'](function(){try{fs[_0x77f2('0x1c')](_0x4c4759);fs['chmodSync'](_0xdcb594,'777');}catch(_0x54c7d9){logger[_0x77f2('0x16')](_0x54c7d9);}return _0xdcb594[_0x77f2('0x2a')]('.')[0x0];});}function base64Encode(_0x498787){var _0x546ded=fs[_0x77f2('0x2b')](_0x498787);return new Buffer(_0x546ded)[_0x77f2('0x2c')](_0x77f2('0x29'));}exports['googleCloudTTS']=function(_0x5c1c59,_0x127cb9,_0x2334f9,_0x3ad9df,_0x3b2dc6,_0x445019){var _0xce35e1,_0x4e60ed;var _0x5a63bf=_0x77f2('0x2d');var _0x231246=_0x77f2('0x2e')+_0x5c1c59;var _0x4ceffc={};if(_0x127cb9===_0x77f2('0x2f')){_0x4ceffc['input']={'ssml':_0x2334f9};}else{_0x4ceffc[_0x77f2('0x30')]={'text':_0x2334f9};};_0x4ceffc[_0x77f2('0x31')]={'languageCode':_0x3ad9df,'ssmlGender':_0x3b2dc6};_0x4ceffc['audioConfig']={'audioEncoding':_0x77f2('0x32'),'sampleRateHertz':0x1f40};var _0x2be2ab={'url':_0x5a63bf+'text:synthesize'+_0x231246,'method':'POST','json':!![],'body':_0x4ceffc};return rp(_0x2be2ab)[_0x77f2('0x33')](function(_0x5b0ad7){return new BPromise(function(_0x13f78c,_0x49a489){_0xce35e1=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x35'));var _0x309513=Buffer['from'](_0x5b0ad7[_0x77f2('0x36')],_0x77f2('0x29'));return fs['writeFile'](_0xce35e1,_0x309513,function(_0xa33d49){_0x49a489(_0xa33d49);},function(_0x2f2563){fs['chmodSync'](_0xce35e1,_0x77f2('0x37'));_0x13f78c(_0x2f2563);});});})[_0x77f2('0x33')](function(_0x33bcda){_0x4e60ed=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x38'));return convertFile(_0xce35e1,_0x4e60ed);})['then'](function(){try{fs['unlink'](_0xce35e1);fs[_0x77f2('0x39')](_0x4e60ed,_0x77f2('0x37'));}catch(_0x1e78a5){logger[_0x77f2('0x16')](_0x1e78a5);}logger[_0x77f2('0x1a')](_0x77f2('0x3a'),_0x4e60ed[_0x77f2('0x2a')]('.')[0x0]);return _0x4e60ed[_0x77f2('0x2a')]('.')[0x0];});};exports[_0x77f2('0x3b')]=function(_0x3ba700,_0x28a893){var _0x45a7b6=_0x77f2('0x3c');var _0x3b9abe,_0x3c0dfa;var _0x3ecbc2;var _0x6c2337={'encoding':_0x77f2('0x3d'),'method':_0x77f2('0x3e'),'timeout':0x2710,'url':_0x45a7b6,'headers':{'Content-Type':_0x77f2('0x3f')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x77f2('0x40'),JSON[_0x77f2('0x41')]([_0x3ba700,_0x28a893||'en',![],_0x77f2('0x42')]),null,_0x77f2('0x43')]]]))};return rp(_0x6c2337)['then'](function(_0x21c1a4){try{_0x3ecbc2=eval(_0x21c1a4['slice'](0x5))[0x0][0x2];}catch(_0x153dc5){throw new Error(_0x77f2('0x44')+_0x21c1a4[_0x77f2('0x20')]);}if(!_0x3ecbc2){if(_0x3ba700[_0x77f2('0x45')]>0xc8){throw new Error(_0x77f2('0x46'));}else{throw new Error(_0x77f2('0x47')+_0x28a893+_0x77f2('0x48'));}}try{_0x3ecbc2=eval(_0x3ecbc2)[0x0];}catch(_0x42322b){throw new Error(_0x77f2('0x44')+res['data']);}const _0x24e233=_0x3ecbc2;_0x3b9abe=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x35'));fs[_0x77f2('0x28')](_0x3b9abe,_0x3ecbc2,{'encoding':_0x77f2('0x29')});_0x3c0dfa=path[_0x77f2('0x34')](__dirname,'tmp',rs['generate'](0x4)+_0x77f2('0x38'));return convertFile(_0x3b9abe,_0x3c0dfa);})[_0x77f2('0x33')](function(){try{fs[_0x77f2('0x1c')](_0x3b9abe);fs[_0x77f2('0x39')](_0x3c0dfa,_0x77f2('0x37'));}catch(_0x216014){logger[_0x77f2('0x16')](_0x216014);}logger['info']('goggleTTS\x20path',_0x3c0dfa['split']('.')[0x0]);return _0x3c0dfa[_0x77f2('0x2a')]('.')[0x0];});};exports[_0x77f2('0x49')]=function(_0xaf2bbf,_0x3a8b6f,_0x259b33){return google['asr'](_0xaf2bbf,_0x3a8b6f,_0x259b33)[_0x77f2('0x33')](function(_0x3ddd9d){logger[_0x77f2('0x1a')](_0x3ddd9d['uri']);return rp(_0x3ddd9d);})[_0x77f2('0x33')](function(_0x4220c9){var _0x3f331d='';var _0x568093=0x0;try{fs[_0x77f2('0x1c')](_0xaf2bbf);}catch(_0x47803f){logger[_0x77f2('0x16')](_0x47803f);}if(_0x4220c9&&_0x4220c9[_0x77f2('0x4a')]){_0x3f331d=_0x4220c9[_0x77f2('0x4a')]['map'](function(_0x215310){return _0x215310&&_0x215310[_0x77f2('0x4b')][0x0]&&_0x215310[_0x77f2('0x4b')][0x0]['transcript']?_0x215310[_0x77f2('0x4b')][0x0]['transcript']:'';})[_0x77f2('0x4c')]('\x0a');_0x568093=_0x4220c9[_0x77f2('0x4a')][_0x77f2('0x4d')](function(_0x20d8ce){return _0x20d8ce&&_0x20d8ce[_0x77f2('0x4b')][0x0]&&_0x20d8ce[_0x77f2('0x4b')][0x0]['confidence']?_0x20d8ce[_0x77f2('0x4b')][0x0][_0x77f2('0x4e')]:0x0;})['join']('\x0a');}logger[_0x77f2('0x1a')](_0x77f2('0x4f'),_0x3f331d);logger[_0x77f2('0x1a')](_0x77f2('0x50'),_0x568093);return{'transcript':_0x3f331d,'confidence':_0x568093};})['catch'](function(_0x59eac3){logger[_0x77f2('0x16')](_0x77f2('0x51'),_0x59eac3[_0x77f2('0x15')],_0x59eac3[_0x77f2('0x52')],_0x59eac3[_0x77f2('0x53')]);});};exports['googleDialogflow']=function(_0x13c3fb,_0x1c32a2,_0x37e6fc,_0x4d5123){var _0x23951c=apiai(_0x1c32a2,{'language':_0x4d5123||'en'});return _0x23951c[_0x77f2('0x54')](_0x37e6fc,{'sessionId':md5(_0x13c3fb)})['then'](function(_0x5a638d){logger[_0x77f2('0x1a')](JSON[_0x77f2('0x41')](_0x5a638d));return{'source':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x56')],'resolvedQuery':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x57')],'action':_0x5a638d[_0x77f2('0x55')]['action'],'actionIncomplete':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x58')],'speech':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x59')]['speech'],'score':_0x5a638d[_0x77f2('0x55')]['score'],'statusCode':_0x5a638d[_0x77f2('0x5a')][_0x77f2('0x5b')],'endConversation':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x5c')]['endConversation']||![],'isFallbackIntent':_0x5a638d[_0x77f2('0x55')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x2081f4,_0xb1cfcc,_0x42bb4f,_0x32c635,_0x19b16f,_0x333899){var _0x4328fa=_0x32c635[_0x77f2('0x5d')](/\\n/g,'\x0a');var _0x25907a={'credentials':{'private_key':_0x4328fa,'client_email':_0x42bb4f}};var _0x2fefac=new dialogflow[(_0x77f2('0x5e'))](_0x25907a);var _0x1b5fce=_0x2fefac['sessionPath'](_0xb1cfcc,md5(_0x2081f4));var _0xa17879={'session':_0x1b5fce,'queryInput':{'text':{'text':_0x19b16f,'languageCode':_0x333899}}};return _0x2fefac[_0x77f2('0x5f')](_0xa17879)[_0x77f2('0x33')](function(_0x53257e){if(_0x53257e&&_0x53257e['length']){logger[_0x77f2('0x1a')](_0x77f2('0x60'),JSON[_0x77f2('0x41')](_0x53257e));var _0xc4c3ed=_0x53257e[0x0];if(_0xc4c3ed){var _0x1672f6={'action':_0xc4c3ed['queryResult'][_0x77f2('0x61')],'allRequiredParamsPresent':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x63')],'endConversation':_0xc4c3ed[_0x77f2('0x62')]['diagnosticInfo']&&_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x64')]['fields']?_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x64')][_0x77f2('0x65')][_0x77f2('0x66')]['boolValue']:![],'fulfillmentText':_0xc4c3ed[_0x77f2('0x62')]['fulfillmentText'],'intentName':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x67')]['name'],'intentDisplayName':_0xc4c3ed[_0x77f2('0x62')]['intent'][_0x77f2('0x68')],'isFallbackIntent':_0xc4c3ed['queryResult'][_0x77f2('0x67')][_0x77f2('0x69')],'languageCode':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x6a')],'queryText':_0xc4c3ed['queryResult'][_0x77f2('0x6b')],'responseId':_0xc4c3ed[_0x77f2('0x6c')],'score':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x6d')],'speech':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x6e')],'providerResponse':JSON[_0x77f2('0x41')](_0x53257e)};return _0x1672f6;}}});};exports['tildeASR']=function(_0xaa898c,_0x249c07,_0x152f85,_0x372271){return tilde[_0x77f2('0x6f')](_0xaa898c,_0x249c07,_0x152f85,_0x372271)[_0x77f2('0x33')](function(_0x361840){try{fs['unlink'](_0xaa898c);}catch(_0x38ad98){logger[_0x77f2('0x16')](_0x38ad98);}logger['info'](_0x77f2('0x70'),_0x361840[_0x77f2('0x71')]);logger['info'](_0x77f2('0x72'),_0x361840[_0x77f2('0x4e')]);return _0x361840;});};exports['awsPolly']=function(_0x45d94a,_0x127c37,_0x2d6142,_0x4c0102,_0x42f98b,_0x5b00c4){var _0xe784c6=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x35'));var _0x2bc2f6;return aws[_0x77f2('0x73')](_0x45d94a,_0x127c37,_0x2d6142,_0x4c0102,_0x42f98b,_0x5b00c4,_0xe784c6)[_0x77f2('0x33')](function(){_0x2bc2f6=path[_0x77f2('0x34')](__dirname,'tmp',rs[_0x77f2('0x27')](0x4)+_0x77f2('0x38'));return convertFile(_0xe784c6,_0x2bc2f6);})[_0x77f2('0x33')](function(){try{fs[_0x77f2('0x1c')](_0xe784c6);fs[_0x77f2('0x39')](_0x2bc2f6,_0x77f2('0x37'));}catch(_0x1f5002){logger[_0x77f2('0x16')](_0x1f5002);}return _0x2bc2f6[_0x77f2('0x2a')]('.')[0x0];});};exports['awsLex']=function(_0x3e3765,_0x247d66,_0x50066a,_0x2b1b1e,_0x403ace,_0x25d2c5){return aws[_0x77f2('0x74')](_0x3e3765,_0x247d66,_0x50066a,_0x2b1b1e,_0x403ace,_0x25d2c5)[_0x77f2('0x33')](function(_0x26eb5d){logger[_0x77f2('0x1a')](JSON[_0x77f2('0x41')](_0x26eb5d));return _0x26eb5d;});};exports[_0x77f2('0x75')]=function(_0xbd8df6,_0xd5132,_0x253789,_0x4457c4){var _0x1c4bc2=util['format'](_0x77f2('0x76'),ISPEECH_API,_0xbd8df6,encodeURIComponent(_0xd5132),_0x253789,_0x4457c4);var _0x2429ea=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs['generate'](0x4)+_0x77f2('0x35'));var _0x16c8e7;return downloadFile(_0x1c4bc2,_0x2429ea)['then'](function(){_0x16c8e7=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+'.wav');return convertFile(_0x2429ea,_0x16c8e7);})[_0x77f2('0x33')](function(){try{fs[_0x77f2('0x1c')](_0x2429ea);fs[_0x77f2('0x39')](_0x16c8e7,_0x77f2('0x37'));}catch(_0x2ae56a){logger[_0x77f2('0x16')](_0x2ae56a);}return _0x16c8e7[_0x77f2('0x2a')]('.')[0x0];});};exports[_0x77f2('0x77')]=function(_0x59d348,_0x44dfdb,_0x193fa9,_0x4fb392){var _0x5641b2=util[_0x77f2('0x78')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x44dfdb,_0x193fa9,base64Encode(_0x59d348),_0x4fb392?util[_0x77f2('0x78')]('model=%s',encodeURIComponent(_0x4fb392)):'freeform=3');return uploadFile(_0x5641b2)[_0x77f2('0x33')](function(_0x1271ff){return querystring[_0x77f2('0xb')](_0x1271ff);});};exports['sestekNDA']=function(_0x5cc467,_0x4bf71a){return sestek[_0x77f2('0x79')](_0x5cc467,_0x4bf71a)[_0x77f2('0x33')](function(_0xb4722f){logger['info'](JSON[_0x77f2('0x41')](_0xb4722f));var _0x5fa09d={'speech':_0xb4722f['text'],'action':_0xb4722f['channelData']?_0xb4722f[_0x77f2('0x7a')]['CustomAction']:undefined,'actiondata':_0xb4722f[_0x77f2('0x7a')]?_0xb4722f[_0x77f2('0x7a')][_0x77f2('0x7b')]:undefined};if(_0xb4722f['channelData']&&_0xb4722f[_0x77f2('0x7a')]['AudioFromTts']){return base64Decode(_0xb4722f[_0x77f2('0x7a')][_0x77f2('0x7c')][_0x77f2('0x7d')],path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x38')))[_0x77f2('0x33')](function(_0x101d72){_0x5fa09d[_0x77f2('0x7e')]=_0x101d72;return _0x5fa09d;});}return _0x5fa09d;});};exports[_0x77f2('0x7f')]=function(){return __dirname;}; \ No newline at end of file +var _0xd4de=['fulfillment','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','isFallback','languageCode','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','WHAT_EVER','request\x20to\x20','end','transcode','wav','error\x20convert','start','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','voice','audioConfig','MP3','text:synthesize','POST','resolve','tmp','generate','from','base64','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','action'];(function(_0x10b0c0,_0x2f5220){var _0x1e22bc=function(_0x2a9e00){while(--_0x2a9e00){_0x10b0c0['push'](_0x10b0c0['shift']());}};_0x1e22bc(++_0x2f5220);}(_0xd4de,0x1b5));var _0xed4d=function(_0x167d6b,_0x9f5fc1){_0x167d6b=_0x167d6b-0x0;var _0xe3bf22=_0xd4de[_0x167d6b];return _0xe3bf22;};'use strict';var apiai=require(_0xed4d('0x0'));var BPromise=require(_0xed4d('0x1'));var dialogflow=require(_0xed4d('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xed4d('0x3'));var path=require(_0xed4d('0x4'));var querystring=require(_0xed4d('0x5'));var rp=require(_0xed4d('0x6'));var rs=require(_0xed4d('0x7'));var sox=require('sox');var tts=require(_0xed4d('0x8'));var urlParse=require(_0xed4d('0x9'))[_0xed4d('0xa')];var util=require(_0xed4d('0xb'));var aws=require(_0xed4d('0xc'));var google=require(_0xed4d('0xd'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0xed4d('0xe'))(_0xed4d('0xf'));var ISPEECH_API=_0xed4d('0x10');function downloadFile(_0x5fd70f,_0x65aecb){return new BPromise(function(_0x48457f,_0x57f1ac){var _0x2b57e1=urlParse(_0x5fd70f);var _0x414ad4=_0x2b57e1[_0xed4d('0x11')]===_0xed4d('0x12')?https:http;var _0x1089de={'host':_0x2b57e1[_0xed4d('0x13')],'path':_0x2b57e1[_0xed4d('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x414ad4[_0xed4d('0x14')](_0x1089de,function(_0x3fb44d){if(_0x3fb44d[_0xed4d('0x15')]!==0xc8){logger['error']('request\x20to\x20'+_0x5fd70f+_0xed4d('0x16')+_0x3fb44d[_0xed4d('0x15')]+'\x20('+_0x3fb44d[_0xed4d('0x17')]+')');_0x57f1ac(new Error('request\x20to\x20'+_0x5fd70f+_0xed4d('0x16')+_0x3fb44d[_0xed4d('0x15')]+'\x20('+_0x3fb44d[_0xed4d('0x17')]+')'));return;}var _0x499a6e=fs[_0xed4d('0x18')](_0x65aecb);_0x499a6e['on']('finish',function(){logger[_0xed4d('0x19')](_0xed4d('0x1a'));_0x499a6e[_0xed4d('0x1b')](_0x48457f);});_0x499a6e['on'](_0xed4d('0x1c'),function(_0x5e5db7){fs[_0xed4d('0x1d')](_0x65aecb);logger[_0xed4d('0x1c')](_0xed4d('0x1e'),_0x5e5db7);_0x57f1ac(_0x5e5db7);});_0x3fb44d[_0xed4d('0x1f')](_0x499a6e);})['on']('error',function(_0x19542a){logger[_0xed4d('0x1c')](_0x19542a);_0x57f1ac(_0x19542a);})['end']();});}function uploadFile(_0x36008d){return new BPromise(function(_0x577c2c,_0x2197b6){var _0x3da6a2=urlParse(_0x36008d);var _0x1ae373=_0x3da6a2[_0xed4d('0x11')]===_0xed4d('0x12')?https:http;var _0x18fc98={'host':_0x3da6a2[_0xed4d('0x13')],'path':_0x3da6a2[_0xed4d('0x4')],'headers':{'user-agent':_0xed4d('0x20')}};_0x1ae373[_0xed4d('0x14')](_0x18fc98,function(_0x46eb08){if(_0x46eb08[_0xed4d('0x15')]!==0xc8){_0x2197b6(new Error(_0xed4d('0x21')+_0x36008d+_0xed4d('0x16')+_0x46eb08[_0xed4d('0x15')]+'\x20('+_0x46eb08[_0xed4d('0x17')]+')'));return;}var _0x596f99='';_0x46eb08['on']('data',function(_0x59b40b){_0x596f99+=_0x59b40b;});_0x46eb08['on'](_0xed4d('0x22'),function(){_0x577c2c(_0x596f99);});})['on']('error',function(_0x2f4b5f){_0x2197b6(_0x2f4b5f);})['end']();});}function convertFile(_0x14c10f,_0x1bd161){return new BPromise(function(_0x5f5138,_0xc1c594){var _0x4b1493=sox[_0xed4d('0x23')](_0x14c10f,_0x1bd161,{'sampleRate':0x1f40,'format':_0xed4d('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b1493['on'](_0xed4d('0x1c'),function(_0x365dd5){logger[_0xed4d('0x1c')](_0xed4d('0x25'),_0x365dd5);_0xc1c594(_0x365dd5);});_0x4b1493['on'](_0xed4d('0x22'),function(){logger['info']('finish\x20to\x20convert');_0x5f5138();});_0x4b1493[_0xed4d('0x26')]();});}function base64Decode(_0xa142a4,_0x3ff875){var _0x39a701=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xed4d('0x27'));fs[_0xed4d('0x28')](_0x39a701,_0xa142a4,'base64');return convertFile(_0x39a701,_0x3ff875)[_0xed4d('0x29')](function(){try{fs[_0xed4d('0x1d')](_0x39a701);fs[_0xed4d('0x2a')](_0x3ff875,_0xed4d('0x2b'));}catch(_0x258bf1){logger[_0xed4d('0x1c')](_0x258bf1);}return _0x3ff875[_0xed4d('0x2c')]('.')[0x0];});}function base64Encode(_0x3b940d){var _0x56c23b=fs[_0xed4d('0x2d')](_0x3b940d);return new Buffer(_0x56c23b)[_0xed4d('0x2e')]('base64');}exports[_0xed4d('0x2f')]=function(_0x22819a,_0x14bed6,_0x1f9f3b,_0x339675,_0x231585,_0x29d83d){var _0x55070a,_0x1e1758;var _0x50978e=_0xed4d('0x30');var _0x52fcb3=_0xed4d('0x31')+_0x22819a;var _0x1b3e39={};if(_0x14bed6==='ssml'){_0x1b3e39['input']={'ssml':_0x1f9f3b};}else{_0x1b3e39['input']={'text':_0x1f9f3b};};_0x1b3e39[_0xed4d('0x32')]={'languageCode':_0x339675,'ssmlGender':_0x231585};_0x1b3e39[_0xed4d('0x33')]={'audioEncoding':_0xed4d('0x34'),'sampleRateHertz':0x1f40};var _0x2e1cc9={'url':_0x50978e+_0xed4d('0x35')+_0x52fcb3,'method':_0xed4d('0x36'),'json':!![],'body':_0x1b3e39};return rp(_0x2e1cc9)[_0xed4d('0x29')](function(_0x4979a5){return new BPromise(function(_0x94eb4e,_0x635bf2){_0x55070a=path[_0xed4d('0x37')](__dirname,_0xed4d('0x38'),rs[_0xed4d('0x39')](0x4)+'.mp3');var _0x3040dd=Buffer[_0xed4d('0x3a')](_0x4979a5['audioContent'],_0xed4d('0x3b'));return fs[_0xed4d('0x3c')](_0x55070a,_0x3040dd,function(_0x59ca61){_0x635bf2(_0x59ca61);},function(_0x3ff3da){fs[_0xed4d('0x2a')](_0x55070a,'777');_0x94eb4e(_0x3ff3da);});});})[_0xed4d('0x29')](function(_0x47118c){_0x1e1758=path['resolve'](__dirname,_0xed4d('0x38'),rs['generate'](0x4)+_0xed4d('0x27'));return convertFile(_0x55070a,_0x1e1758);})[_0xed4d('0x29')](function(){try{fs[_0xed4d('0x1d')](_0x55070a);fs['chmodSync'](_0x1e1758,_0xed4d('0x2b'));}catch(_0x15a9bc){logger[_0xed4d('0x1c')](_0x15a9bc);}logger[_0xed4d('0x19')](_0xed4d('0x3d'),_0x1e1758[_0xed4d('0x2c')]('.')[0x0]);return _0x1e1758['split']('.')[0x0];});};exports['googleTTS']=function(_0x2c0432,_0x36e723){var _0x52ee10=_0xed4d('0x3e');var _0x327bc1,_0x315602;var _0x1f8743;var _0x252e23={'encoding':'utf8','method':_0xed4d('0x36'),'timeout':0x2710,'url':_0x52ee10,'headers':{'Content-Type':_0xed4d('0x3f')},'body':_0xed4d('0x40')+encodeURIComponent(JSON[_0xed4d('0x41')]([[[_0xed4d('0x42'),JSON['stringify']([_0x2c0432,_0x36e723||'en',![],_0xed4d('0x43')]),null,_0xed4d('0x44')]]]))};return rp(_0x252e23)[_0xed4d('0x29')](function(_0x51598d){try{_0x1f8743=eval(_0x51598d[_0xed4d('0x45')](0x5))[0x0][0x2];}catch(_0x19d308){throw new Error(_0xed4d('0x46')+_0x51598d[_0xed4d('0x47')]);}if(!_0x1f8743){if(_0x2c0432[_0xed4d('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xed4d('0x49')+_0x36e723+_0xed4d('0x4a'));}}try{_0x1f8743=eval(_0x1f8743)[0x0];}catch(_0x2d17dd){throw new Error(_0xed4d('0x46')+res[_0xed4d('0x47')]);}const _0x3295f7=_0x1f8743;_0x327bc1=path[_0xed4d('0x37')](__dirname,'tmp',rs['generate'](0x4)+_0xed4d('0x4b'));fs[_0xed4d('0x28')](_0x327bc1,_0x1f8743,{'encoding':_0xed4d('0x3b')});_0x315602=path[_0xed4d('0x37')](__dirname,_0xed4d('0x38'),rs[_0xed4d('0x39')](0x4)+_0xed4d('0x27'));return convertFile(_0x327bc1,_0x315602);})['then'](function(){try{fs[_0xed4d('0x1d')](_0x327bc1);fs[_0xed4d('0x2a')](_0x315602,_0xed4d('0x2b'));}catch(_0x371034){logger[_0xed4d('0x1c')](_0x371034);}logger[_0xed4d('0x19')]('goggleTTS\x20path',_0x315602[_0xed4d('0x2c')]('.')[0x0]);return _0x315602[_0xed4d('0x2c')]('.')[0x0];});};exports[_0xed4d('0x4c')]=function(_0x5064aa,_0x133365,_0x4f05a5){return google[_0xed4d('0x4d')](_0x5064aa,_0x133365,_0x4f05a5)[_0xed4d('0x29')](function(_0x1d5c36){logger[_0xed4d('0x19')](_0x1d5c36[_0xed4d('0x4e')]);return rp(_0x1d5c36);})[_0xed4d('0x29')](function(_0x2f58bb){var _0x257408='';var _0x5dd406=0x0;try{fs[_0xed4d('0x1d')](_0x5064aa);}catch(_0x4bdde9){logger[_0xed4d('0x1c')](_0x4bdde9);}if(_0x2f58bb&&_0x2f58bb['results']){_0x257408=_0x2f58bb[_0xed4d('0x4f')][_0xed4d('0x50')](function(_0x5a736a){return _0x5a736a&&_0x5a736a[_0xed4d('0x51')][0x0]&&_0x5a736a[_0xed4d('0x51')][0x0][_0xed4d('0x52')]?_0x5a736a['alternatives'][0x0][_0xed4d('0x52')]:'';})[_0xed4d('0x53')]('\x0a');_0x5dd406=_0x2f58bb[_0xed4d('0x4f')][_0xed4d('0x50')](function(_0x1031ab){return _0x1031ab&&_0x1031ab['alternatives'][0x0]&&_0x1031ab[_0xed4d('0x51')][0x0][_0xed4d('0x54')]?_0x1031ab['alternatives'][0x0][_0xed4d('0x54')]:0x0;})[_0xed4d('0x53')]('\x0a');}logger[_0xed4d('0x19')](_0xed4d('0x55'),_0x257408);logger[_0xed4d('0x19')](_0xed4d('0x56'),_0x5dd406);return{'transcript':_0x257408,'confidence':_0x5dd406};})[_0xed4d('0x57')](function(_0x4df858){logger[_0xed4d('0x1c')](_0xed4d('0x58'),_0x4df858[_0xed4d('0x15')],_0x4df858[_0xed4d('0x59')],_0x4df858['message']);});};exports[_0xed4d('0x5a')]=function(_0x567f8a,_0x2cceac,_0x3e8323,_0x1b30a9){var _0x278149=apiai(_0x2cceac,{'language':_0x1b30a9||'en'});return _0x278149[_0xed4d('0x5b')](_0x3e8323,{'sessionId':md5(_0x567f8a)})[_0xed4d('0x29')](function(_0x9fef64){logger[_0xed4d('0x19')](JSON[_0xed4d('0x41')](_0x9fef64));return{'source':_0x9fef64[_0xed4d('0x5c')][_0xed4d('0x5d')],'resolvedQuery':_0x9fef64[_0xed4d('0x5c')]['resolvedQuery'],'action':_0x9fef64['result'][_0xed4d('0x5e')],'actionIncomplete':_0x9fef64[_0xed4d('0x5c')]['actionIncomplete'],'speech':_0x9fef64['result'][_0xed4d('0x5f')]['speech'],'score':_0x9fef64[_0xed4d('0x5c')][_0xed4d('0x60')],'statusCode':_0x9fef64['status'][_0xed4d('0x61')],'endConversation':_0x9fef64['result'][_0xed4d('0x62')][_0xed4d('0x63')]||![],'isFallbackIntent':_0x9fef64['result'][_0xed4d('0x62')][_0xed4d('0x64')]};});};exports[_0xed4d('0x65')]=function(_0x24e8d9,_0x54eafe,_0x4753f6,_0x4607e6,_0x3751e2,_0x1f91e6){var _0x4e7c1f=_0x4607e6[_0xed4d('0x66')](/\\n/g,'\x0a');var _0x447d1c={'credentials':{'private_key':_0x4e7c1f,'client_email':_0x4753f6}};var _0x2b1a87=new dialogflow['SessionsClient'](_0x447d1c);var _0x50601c=_0x2b1a87[_0xed4d('0x67')](_0x54eafe,md5(_0x24e8d9));var _0x1b3e06={'session':_0x50601c,'queryInput':{'text':{'text':_0x3751e2,'languageCode':_0x1f91e6}}};return _0x2b1a87[_0xed4d('0x68')](_0x1b3e06)[_0xed4d('0x29')](function(_0x45c67e){if(_0x45c67e&&_0x45c67e[_0xed4d('0x48')]){logger[_0xed4d('0x19')]('Dialogflow\x20V2\x20response:',JSON[_0xed4d('0x41')](_0x45c67e));var _0x5cea58=_0x45c67e[0x0];if(_0x5cea58){var _0x22135e={'action':_0x5cea58[_0xed4d('0x69')][_0xed4d('0x5e')],'allRequiredParamsPresent':_0x5cea58[_0xed4d('0x69')][_0xed4d('0x6a')],'endConversation':_0x5cea58['queryResult'][_0xed4d('0x6b')]&&_0x5cea58[_0xed4d('0x69')][_0xed4d('0x6b')][_0xed4d('0x6c')]?_0x5cea58[_0xed4d('0x69')]['diagnosticInfo'][_0xed4d('0x6c')]['end_conversation'][_0xed4d('0x6d')]:![],'fulfillmentText':_0x5cea58[_0xed4d('0x69')][_0xed4d('0x6e')],'intentName':_0x5cea58['queryResult'][_0xed4d('0x6f')][_0xed4d('0x59')],'intentDisplayName':_0x5cea58['queryResult'][_0xed4d('0x6f')]['displayName'],'isFallbackIntent':_0x5cea58[_0xed4d('0x69')][_0xed4d('0x6f')][_0xed4d('0x70')],'languageCode':_0x5cea58[_0xed4d('0x69')][_0xed4d('0x71')],'queryText':_0x5cea58['queryResult']['queryText'],'responseId':_0x5cea58['responseId'],'score':_0x5cea58[_0xed4d('0x69')][_0xed4d('0x72')],'speech':_0x5cea58[_0xed4d('0x69')][_0xed4d('0x6e')],'providerResponse':JSON['stringify'](_0x45c67e)};return _0x22135e;}}});};exports['tildeASR']=function(_0x2d8488,_0x37b040,_0x4b9d53,_0x51997a){return tilde[_0xed4d('0x4d')](_0x2d8488,_0x37b040,_0x4b9d53,_0x51997a)['then'](function(_0x3ba103){try{fs[_0xed4d('0x1d')](_0x2d8488);}catch(_0x2faaa7){logger[_0xed4d('0x1c')](_0x2faaa7);}logger['info'](_0xed4d('0x73'),_0x3ba103[_0xed4d('0x52')]);logger[_0xed4d('0x19')]('Tilde\x20ASR\x20confidence',_0x3ba103[_0xed4d('0x54')]);return _0x3ba103;});};exports[_0xed4d('0x74')]=function(_0x476317,_0x3bac75,_0x4fdf02,_0x106512,_0x1b1514,_0x23b3e4){var _0x108517=path[_0xed4d('0x37')](__dirname,_0xed4d('0x38'),rs[_0xed4d('0x39')](0x4)+'.mp3');var _0x32351d;return aws[_0xed4d('0x75')](_0x476317,_0x3bac75,_0x4fdf02,_0x106512,_0x1b1514,_0x23b3e4,_0x108517)[_0xed4d('0x29')](function(){_0x32351d=path[_0xed4d('0x37')](__dirname,'tmp',rs[_0xed4d('0x39')](0x4)+_0xed4d('0x27'));return convertFile(_0x108517,_0x32351d);})[_0xed4d('0x29')](function(){try{fs[_0xed4d('0x1d')](_0x108517);fs[_0xed4d('0x2a')](_0x32351d,_0xed4d('0x2b'));}catch(_0x266939){logger[_0xed4d('0x1c')](_0x266939);}return _0x32351d[_0xed4d('0x2c')]('.')[0x0];});};exports[_0xed4d('0x76')]=function(_0x51e86d,_0x499a78,_0x1bdcbe,_0x3270d2,_0x12eaed,_0x4bfa7d){return aws[_0xed4d('0x77')](_0x51e86d,_0x499a78,_0x1bdcbe,_0x3270d2,_0x12eaed,_0x4bfa7d)[_0xed4d('0x29')](function(_0x5ec4c0){logger[_0xed4d('0x19')](JSON[_0xed4d('0x41')](_0x5ec4c0));return _0x5ec4c0;});};exports[_0xed4d('0x78')]=function(_0x174c9d,_0x31a55c,_0x4305fe,_0x56e0ac){var _0x5a1bc4=util[_0xed4d('0x79')](_0xed4d('0x7a'),ISPEECH_API,_0x174c9d,encodeURIComponent(_0x31a55c),_0x4305fe,_0x56e0ac);var _0xf19885=path[_0xed4d('0x37')](__dirname,_0xed4d('0x38'),rs[_0xed4d('0x39')](0x4)+_0xed4d('0x4b'));var _0x33a408;return downloadFile(_0x5a1bc4,_0xf19885)[_0xed4d('0x29')](function(){_0x33a408=path[_0xed4d('0x37')](__dirname,_0xed4d('0x38'),rs[_0xed4d('0x39')](0x4)+_0xed4d('0x27'));return convertFile(_0xf19885,_0x33a408);})[_0xed4d('0x29')](function(){try{fs[_0xed4d('0x1d')](_0xf19885);fs[_0xed4d('0x2a')](_0x33a408,_0xed4d('0x2b'));}catch(_0x5463aa){logger[_0xed4d('0x1c')](_0x5463aa);}return _0x33a408[_0xed4d('0x2c')]('.')[0x0];});};exports[_0xed4d('0x7b')]=function(_0x525766,_0xf2543c,_0x126202,_0x5bd965){var _0x264659=util[_0xed4d('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xf2543c,_0x126202,base64Encode(_0x525766),_0x5bd965?util[_0xed4d('0x79')]('model=%s',encodeURIComponent(_0x5bd965)):_0xed4d('0x7c'));return uploadFile(_0x264659)[_0xed4d('0x29')](function(_0x4d65c2){return querystring['parse'](_0x4d65c2);});};exports['sestekNDA']=function(_0x2adced,_0x549227){return sestek[_0xed4d('0x7d')](_0x2adced,_0x549227)[_0xed4d('0x29')](function(_0x55272d){logger[_0xed4d('0x19')](JSON[_0xed4d('0x41')](_0x55272d));var _0x5a9dc4={'speech':_0x55272d[_0xed4d('0x7e')],'action':_0x55272d[_0xed4d('0x7f')]?_0x55272d[_0xed4d('0x7f')][_0xed4d('0x80')]:undefined,'actiondata':_0x55272d['channelData']?_0x55272d[_0xed4d('0x7f')][_0xed4d('0x81')]:undefined};if(_0x55272d[_0xed4d('0x7f')]&&_0x55272d[_0xed4d('0x7f')][_0xed4d('0x82')]){return base64Decode(_0x55272d[_0xed4d('0x7f')]['AudioFromTts']['Data'],path[_0xed4d('0x37')](__dirname,_0xed4d('0x38'),rs[_0xed4d('0x39')](0x4)+_0xed4d('0x27')))[_0xed4d('0x29')](function(_0x5eada6){_0x5a9dc4[_0xed4d('0x83')]=_0x5eada6;return _0x5a9dc4;});}return _0x5a9dc4;});};exports[_0xed4d('0x84')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 3fb3138..8f34e03 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 _0x9763=['./nda'];(function(_0x45ce91,_0x1c8c8b){var _0xc17b51=function(_0x38527f){while(--_0x38527f){_0x45ce91['push'](_0x45ce91['shift']());}};_0xc17b51(++_0x1c8c8b);}(_0x9763,0x10c));var _0x3976=function(_0x27470d,_0x20ad27){_0x27470d=_0x27470d-0x0;var _0x2cab2b=_0x9763[_0x27470d];return _0x2cab2b;};var nda=require(_0x3976('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'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 ed89476..9e125b4 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 _0xb74d=['uniqueid','callerid','calleridname','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports','POST','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message'];(function(_0x2b9b86,_0x5943e7){var _0xca3f2d=function(_0x5c3b1f){while(--_0x5c3b1f){_0x2b9b86['push'](_0x2b9b86['shift']());}};_0xca3f2d(++_0x5943e7);}(_0xb74d,0x16e));var _0xdb74=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xb74d[_0x819464];return _0x49dcc0;};'use strict';var rp=require(_0xdb74('0x0'));var url=require('url');var logger=require(_0xdb74('0x1'))('agi');module[_0xdb74('0x2')]=function(_0x5700f0,_0x1ba155){var _0x30d1e5={'method':_0xdb74('0x3'),'uri':url['resolve'](_0x1ba155[_0xdb74('0x4')],_0xdb74('0x5')),'form':{'grant_type':_0xdb74('0x6'),'username':_0x1ba155['username'],'password':_0x1ba155['password']},'json':!![]};return rp(_0x30d1e5)[_0xdb74('0x7')](function(_0x4bf15e){var _0x3e44b7={'method':_0xdb74('0x3'),'uri':url['resolve'](_0x1ba155[_0xdb74('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1ba155[_0xdb74('0x9')]||_0xdb74('0xa'),'channelId':'Nda','conversation':{'id':_0x5700f0[_0xdb74('0xb')]},'from':{'id':_0x5700f0[_0xdb74('0xc')],'name':_0x5700f0[_0xdb74('0xd')]},'recipient':{'id':_0x5700f0['dnid'],'name':_0x5700f0['extension']},'text':_0x1ba155[_0xdb74('0xe')],'channelData':{}},'headers':{'Authorization':_0xdb74('0xf')+_0x4bf15e[_0xdb74('0x10')]},'json':!![]};if(_0x1ba155[_0xdb74('0x11')]){_0x3e44b7[_0xdb74('0x12')][_0xdb74('0x13')][_0xdb74('0x14')]=_0x1ba155[_0xdb74('0x11')];}if(_0x1ba155[_0xdb74('0x15')]=='1'){_0x3e44b7[_0xdb74('0x12')][_0xdb74('0x13')][_0xdb74('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdb74('0x17')};}if(_0x1ba155['custom_action']){_0x3e44b7[_0xdb74('0x12')][_0xdb74('0x13')][_0xdb74('0x18')]=_0x1ba155[_0xdb74('0x19')];if(_0x1ba155['custom_action_data']){_0x3e44b7['body'][_0xdb74('0x13')][_0xdb74('0x1a')]=_0x1ba155['custom_action_data'];}}logger[_0xdb74('0x1b')](JSON[_0xdb74('0x1c')](_0x3e44b7));return rp(_0x3e44b7);});}; \ No newline at end of file +var _0xbfa6=['dnid','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x1b999f,_0xada878){_0x1b999f=_0x1b999f-0x0;var _0x51d27a=_0xbfa6[_0x1b999f];return _0x51d27a;};'use strict';var rp=require(_0x6bfa('0x0'));var url=require(_0x6bfa('0x1'));var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0x2cae45,_0x10c0e2){var _0x72d347={'method':'POST','uri':url[_0x6bfa('0x2')](_0x10c0e2[_0x6bfa('0x3')],_0x6bfa('0x4')),'form':{'grant_type':_0x6bfa('0x5'),'username':_0x10c0e2[_0x6bfa('0x6')],'password':_0x10c0e2[_0x6bfa('0x5')]},'json':!![]};return rp(_0x72d347)[_0x6bfa('0x7')](function(_0x5b4337){var _0x1ad59f={'method':'POST','uri':url[_0x6bfa('0x2')](_0x10c0e2[_0x6bfa('0x8')],_0x6bfa('0x9')),'body':{'type':_0x10c0e2[_0x6bfa('0xa')]||_0x6bfa('0xb'),'channelId':_0x6bfa('0xc'),'conversation':{'id':_0x2cae45[_0x6bfa('0xd')]},'from':{'id':_0x2cae45[_0x6bfa('0xe')],'name':_0x2cae45[_0x6bfa('0xf')]},'recipient':{'id':_0x2cae45[_0x6bfa('0x10')],'name':_0x2cae45['extension']},'text':_0x10c0e2[_0x6bfa('0x11')],'channelData':{}},'headers':{'Authorization':_0x6bfa('0x12')+_0x5b4337[_0x6bfa('0x13')]},'json':!![]};if(_0x10c0e2['project']){_0x1ad59f[_0x6bfa('0x14')][_0x6bfa('0x15')][_0x6bfa('0x16')]=_0x10c0e2[_0x6bfa('0x17')];}if(_0x10c0e2[_0x6bfa('0x18')]=='1'){_0x1ad59f['body'][_0x6bfa('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6bfa('0x19')};}if(_0x10c0e2[_0x6bfa('0x1a')]){_0x1ad59f[_0x6bfa('0x14')][_0x6bfa('0x15')][_0x6bfa('0x1b')]=_0x10c0e2[_0x6bfa('0x1a')];if(_0x10c0e2[_0x6bfa('0x1c')]){_0x1ad59f[_0x6bfa('0x14')][_0x6bfa('0x15')]['CustomActionData']=_0x10c0e2[_0x6bfa('0x1c')];}}logger['info'](JSON[_0x6bfa('0x1d')](_0x1ad59f));return rp(_0x1ad59f);});}; \ 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 8661c44..acaaf8c 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 _0x793c=['./lib/api','exports'];(function(_0x276b4d,_0x37b351){var _0x1e9c0f=function(_0x18c230){while(--_0x18c230){_0x276b4d['push'](_0x276b4d['shift']());}};_0x1e9c0f(++_0x37b351);}(_0x793c,0xe8));var _0xc793=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x793c[_0x17928f];return _0x500b63;};'use strict';var asr=require(_0xc793('0x0'));module[_0xc793('0x1')]=function(_0x3e9e39,_0x3b7e28,_0x2de319,_0x58950d){return asr(_0x3e9e39,_0x3b7e28,_0x2de319,_0x58950d);}; \ No newline at end of file +var _0x2c0d=['./lib/api','exports'];(function(_0x408be,_0x11f61e){var _0x171e82=function(_0x3884fb){while(--_0x3884fb){_0x408be['push'](_0x408be['shift']());}};_0x171e82(++_0x11f61e);}(_0x2c0d,0x122));var _0xd2c0=function(_0x1191b6,_0x360a50){_0x1191b6=_0x1191b6-0x0;var _0x25f9fb=_0x2c0d[_0x1191b6];return _0x25f9fb;};'use strict';var asr=require(_0xd2c0('0x0'));module[_0xd2c0('0x1')]=function(_0x40b9a7,_0x31c211,_0x4cc5c1,_0xb53fbe){return asr(_0x40b9a7,_0x31c211,_0x4cc5c1,_0xb53fbe);}; \ 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 52a2c30..1202606 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 _0x9056=['agi','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','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x5f4deb,_0x5a46c3){var _0x1c8aa5=function(_0x2d8d4a){while(--_0x2d8d4a){_0x5f4deb['push'](_0x5f4deb['shift']());}};_0x1c8aa5(++_0x5a46c3);}(_0x9056,0xba));var _0x6905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9056[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var _=require(_0x6905('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6905('0x1'));var crypto=require(_0x6905('0x2'));var logger=require(_0x6905('0x3'))(_0x6905('0x4'));module['exports']=function(_0x4f38b3,_0x59c51e,_0x3486a7,_0x18f69a){return new BPromise(function(_0x50f6f4,_0x571c33){logger[_0x6905('0x5')]('Tilde\x20URI',_0x18f69a||_0x6905('0x6'));var _0x4d2158=new WebSocket(_0x18f69a||_0x6905('0x6'),{'perMessageDeflate':![]});var _0x20d8a1='';var _0x426f5b='0';var _0x1f552f='1';var _0x38a0b8=_0x6905('0x7');function _0x4ddf19(_0x101687){var _0x53f765=crypto[_0x6905('0x8')]('sha1');_0x53f765[_0x6905('0x9')](_0x101687);return _0x53f765[_0x6905('0xa')]('hex');}function _0x347955(){try{logger[_0x6905('0x5')](_0x6905('0xb'));var _0x462dc2=moment()[_0x6905('0xc')]();var _0x9b4b09=_0x4ddf19(_0x462dc2+_0x59c51e+_0x3486a7);_0x4d2158[_0x6905('0xd')](JSON[_0x6905('0xe')]({'appID':_0x59c51e,'timestamp':_0x462dc2,'appKey':_0x9b4b09}));var _0xb0463c=fs[_0x6905('0xf')](_0x4f38b3);_0xb0463c['on'](_0x6905('0x10'),function(_0x349fb0){_0x4d2158[_0x6905('0xd')](_0x349fb0);});_0xb0463c['on'](_0x6905('0x11'),function(){_0x4d2158[_0x6905('0xd')](_0x6905('0x12'));});}catch(_0x2d8dba){logger['error'](_0x6905('0x13'),JSON[_0x6905('0xe')](_0x2d8dba));_0x4d2158['terminate']();}}function _0x5c4ed3(_0x13276c){try{if(_0x13276c){var _0x4e8abe=JSON[_0x6905('0x14')](_0x13276c);switch(_0x4e8abe[_0x6905('0x15')]){case 0x0:if(_0x4e8abe['result']){if(_0x4e8abe[_0x6905('0x16')][_0x6905('0x17')]){logger[_0x6905('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x4e8abe['result']['hypotheses']));_0x20d8a1=_0x4e8abe[_0x6905('0x16')][_0x6905('0x18')][0x0][_0x6905('0x19')];_0x426f5b=_0x4e8abe['result'][_0x6905('0x18')][0x0][_0x6905('0x1a')];_0x1f552f='0';_0x38a0b8=_0x6905('0x1b');_0x4d2158[_0x6905('0x1c')]();}}break;case 0x1:logger[_0x6905('0x5')](_0x6905('0x7'));_0x1f552f='1';_0x38a0b8=_0x6905('0x7');break;case 0x2:logger['info'](_0x6905('0x1d'));_0x1f552f='2';_0x38a0b8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x6905('0x1e'));_0x1f552f='9';_0x38a0b8=_0x6905('0x1e');break;case 0xa:logger[_0x6905('0x5')](_0x6905('0x1f'));_0x1f552f='10';_0x38a0b8='Authentication\x20failed.';break;case 0xb:logger['info'](_0x6905('0x20'));_0x1f552f='11';_0x38a0b8=_0x6905('0x20');}}}catch(_0x28f848){logger['error'](_0x6905('0x21'),JSON[_0x6905('0xe')](_0x28f848));_0x4d2158[_0x6905('0x1c')]();}}function _0x4b9a59(){logger['info'](_0x6905('0x22'));_0x50f6f4({'transcript':_0x20d8a1,'confidence':_0x426f5b,'status':_0x1f552f,'status_message':_0x38a0b8});}function _0x5dafc2(_0x32f60f){logger['error'](_0x6905('0x23'));if(!_[_0x6905('0x24')](_0x32f60f)){logger['error'](_[_0x6905('0x25')](_0x32f60f)?JSON['stringify'](_0x32f60f):_0x32f60f);}}_0x4d2158['on']('open',_0x347955);_0x4d2158['on']('message',_0x5c4ed3);_0x4d2158['on']('close',_0x4b9a59);_0x4d2158['on']('error',_0x5dafc2);});}; \ No newline at end of file +var _0x6e08=['Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','terminate','parse','status','result','final'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e08,0x1ea));var _0x86e0=function(_0x1a1222,_0x11619d){_0x1a1222=_0x1a1222-0x0;var _0x5267c8=_0x6e08[_0x1a1222];return _0x5267c8;};'use strict';var BPromise=require(_0x86e0('0x0'));var _=require(_0x86e0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x86e0('0x2'));var crypto=require(_0x86e0('0x3'));var logger=require(_0x86e0('0x4'))(_0x86e0('0x5'));module[_0x86e0('0x6')]=function(_0x342f9c,_0x3fbef1,_0x425395,_0xe9be12){return new BPromise(function(_0x576b7d,_0x705abb){logger[_0x86e0('0x7')](_0x86e0('0x8'),_0xe9be12||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x532b4=new WebSocket(_0xe9be12||_0x86e0('0x9'),{'perMessageDeflate':![]});var _0x1dd431='';var _0x4b060f='0';var _0x35604c='1';var _0x48876d=_0x86e0('0xa');function _0x2515eb(_0x2a5242){var _0x18560d=crypto[_0x86e0('0xb')](_0x86e0('0xc'));_0x18560d[_0x86e0('0xd')](_0x2a5242);return _0x18560d[_0x86e0('0xe')](_0x86e0('0xf'));}function _0x4a634b(){try{logger[_0x86e0('0x7')](_0x86e0('0x10'));var _0x581256=moment()[_0x86e0('0x11')]();var _0x11a71a=_0x2515eb(_0x581256+_0x3fbef1+_0x425395);_0x532b4['send'](JSON[_0x86e0('0x12')]({'appID':_0x3fbef1,'timestamp':_0x581256,'appKey':_0x11a71a}));var _0x26fc1b=fs[_0x86e0('0x13')](_0x342f9c);_0x26fc1b['on'](_0x86e0('0x14'),function(_0x25e2d4){_0x532b4[_0x86e0('0x15')](_0x25e2d4);});_0x26fc1b['on'](_0x86e0('0x16'),function(){_0x532b4['send'](_0x86e0('0x17'));});}catch(_0x2b63ee){logger[_0x86e0('0x18')]('Tilde\x20ASR\x20send\x20error',JSON[_0x86e0('0x12')](_0x2b63ee));_0x532b4[_0x86e0('0x19')]();}}function _0x15b88c(_0x528c7f){try{if(_0x528c7f){var _0x3be2ad=JSON[_0x86e0('0x1a')](_0x528c7f);switch(_0x3be2ad[_0x86e0('0x1b')]){case 0x0:if(_0x3be2ad[_0x86e0('0x1c')]){if(_0x3be2ad[_0x86e0('0x1c')][_0x86e0('0x1d')]){logger[_0x86e0('0x7')](_0x86e0('0x1e'),JSON['stringify'](_0x3be2ad[_0x86e0('0x1c')][_0x86e0('0x1f')]));_0x1dd431=_0x3be2ad[_0x86e0('0x1c')][_0x86e0('0x1f')][0x0][_0x86e0('0x20')];_0x4b060f=_0x3be2ad[_0x86e0('0x1c')][_0x86e0('0x1f')][0x0][_0x86e0('0x21')];_0x35604c='0';_0x48876d=_0x86e0('0x22');_0x532b4[_0x86e0('0x19')]();}}break;case 0x1:logger[_0x86e0('0x7')](_0x86e0('0xa'));_0x35604c='1';_0x48876d=_0x86e0('0xa');break;case 0x2:logger[_0x86e0('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x35604c='2';_0x48876d=_0x86e0('0x23');break;case 0x9:logger[_0x86e0('0x7')](_0x86e0('0x24'));_0x35604c='9';_0x48876d=_0x86e0('0x24');break;case 0xa:logger['info']('Authentication\x20failed.');_0x35604c='10';_0x48876d='Authentication\x20failed.';break;case 0xb:logger[_0x86e0('0x7')](_0x86e0('0x25'));_0x35604c='11';_0x48876d=_0x86e0('0x25');}}}catch(_0x230017){logger['error'](_0x86e0('0x26'),JSON[_0x86e0('0x12')](_0x230017));_0x532b4[_0x86e0('0x19')]();}}function _0x2ab0b7(){logger[_0x86e0('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x576b7d({'transcript':_0x1dd431,'confidence':_0x4b060f,'status':_0x35604c,'status_message':_0x48876d});}function _0x5782b0(_0x431e15){logger[_0x86e0('0x18')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x431e15)){logger[_0x86e0('0x18')](_['isObject'](_0x431e15)?JSON[_0x86e0('0x12')](_0x431e15):_0x431e15);}}_0x532b4['on']('open',_0x4a634b);_0x532b4['on'](_0x86e0('0x27'),_0x15b88c);_0x532b4['on'](_0x86e0('0x16'),_0x2ab0b7);_0x532b4['on'](_0x86e0('0x18'),_0x5782b0);});}; \ 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 093d56b..5b6ee2b 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 _0x5d72=['exports','./asr'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x5d72,0xff));var _0x25d7=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0x5d72[_0x34bc94];return _0xee41e7;};var asr=require(_0x25d7('0x0'));module[_0x25d7('0x1')]={'asr':asr}; \ No newline at end of file +var _0x50e1=['./asr','exports'];(function(_0x42870e,_0x21bf62){var _0x360cd1=function(_0x40752b){while(--_0x40752b){_0x42870e['push'](_0x42870e['shift']());}};_0x360cd1(++_0x21bf62);}(_0x50e1,0x64));var _0x150e=function(_0x245b23,_0x4267ba){_0x245b23=_0x245b23-0x0;var _0x3cefaf=_0x50e1[_0x245b23];return _0x3cefaf;};var asr=require(_0x150e('0x0'));module[_0x150e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 65e63ac..c705806 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 197fef8..ca7fa9c 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 _0xf021=['callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','private_key','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','includes','clone','hasOwnProperty','isString','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','length','replaceAll','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','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','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_secret_access_key','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','generate','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','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','QUEUE','macro','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','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring','mustache','../../config/logger','agi','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','prototype','getVariable','rpc','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','createSquareRecording'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf021,0x18f));var _0x1f02=function(_0x59d12e,_0x1128ff){_0x59d12e=_0x59d12e-0x0;var _0x2f5ee4=_0xf021[_0x59d12e];return _0x2f5ee4;};'use strict';var fs=require('fs');var util=require(_0x1f02('0x0'));var _=require(_0x1f02('0x1'));var sh=require(_0x1f02('0x2'));var odbc=require(_0x1f02('0x3'))();var rs=require(_0x1f02('0x4'));var moment=require('moment');var Mustache=require(_0x1f02('0x5'));var rp=require('request-promise');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x1f02('0x8');var recursiveMapAttributes=['rawHeaders',_0x1f02('0x9')];var verticesWithRetry=[_0x1f02('0xa'),_0x1f02('0xb'),_0x1f02('0xc')];var AGIVertices=function(_0x1f1cec,_0x4ec071,_0x154f8a){this['channel']=_0x1f1cec;this['rpc']=_0x4ec071;this['mailRpc']=_0x154f8a;};AGIVertices[_0x1f02('0xd')][_0x1f02('0xe')]=function(_0x1a93ec,_0x19ee35){this[_0x1f02('0xf')]['getVariableById'](_0x1a93ec)[_0x1f02('0x10')](function(_0x395432){_0x19ee35(null,_0x395432?_0x395432[_0x1f02('0x11')]:![]);})['catch'](function(_0x24e9b8){_0x19ee35(_0x24e9b8);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x12')]=function(_0x567f8a,_0x5b12e8){this['rpc'][_0x1f02('0x13')](_0x567f8a)[_0x1f02('0x10')](function(_0x354ad1){_0x5b12e8(null,_0x354ad1?_0x354ad1[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x45bae1){_0x5b12e8(_0x45bae1);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x15')]=function(_0x4b76f7,_0x2e602d){this['rpc']['getSquareProjectById'](_0x4b76f7)['then'](function(_0x5f4e55){_0x2e602d(null,_0x5f4e55?_0x5f4e55[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x3033a2){_0x2e602d(_0x3033a2);});};AGIVertices['prototype'][_0x1f02('0x16')]=function(_0x2c5474,_0x356444){this[_0x1f02('0xf')]['getSquareOdbcById'](_0x2c5474)['then'](function(_0x221e0f){_0x356444(null,_0x221e0f?_0x221e0f[_0x1f02('0x17')]:![]);})['catch'](function(_0x5b399a){_0x356444(_0x5b399a);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x18')]=function(_0x2f637d,_0xbabbd7){this['rpc'][_0x1f02('0x19')](_0x2f637d)[_0x1f02('0x10')](function(_0x1ae73b){_0xbabbd7(null,_0x1ae73b?_0x1ae73b[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x134398){_0xbabbd7(_0x134398);});};AGIVertices[_0x1f02('0xd')]['getTrunk']=function(_0x29c784,_0x3a8c57){this['rpc'][_0x1f02('0x1a')](_0x29c784)[_0x1f02('0x10')](function(_0x575a86){_0x3a8c57(null,_0x575a86?_0x575a86['name']:![]);})[_0x1f02('0x14')](function(_0x36c8c1){_0x3a8c57(_0x36c8c1);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1b')]=function(_0x3f5c5e,_0x3f5577){var _0x297cf4=this;this['rpc']['getSoundById'](_0x3f5c5e)['then'](function(_0x3ef4bf){_0x3f5577(null,_0x3ef4bf?_0x297cf4[_0x1f02('0x1c')](_0x3ef4bf[_0x1f02('0x1d')]):![]);})['catch'](function(_0x5c2c42){_0x3f5577(_0x5c2c42);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1e')]=function(_0x1605cf,_0x433a1e){this[_0x1f02('0xf')][_0x1f02('0x1f')](_0x1605cf)[_0x1f02('0x10')](function(_0x23fa22){_0x433a1e(null,_0x23fa22?_0x23fa22:![]);})[_0x1f02('0x14')](function(_0x2869b0){_0x433a1e(_0x2869b0);});};AGIVertices['prototype'][_0x1f02('0x20')]=function(_0x5ab7a2,_0xa61d8f,_0x3b3b57){this[_0x1f02('0x21')][_0x1f02('0x20')](_0x5ab7a2,_0xa61d8f)[_0x1f02('0x10')](function(){_0x3b3b57(null);})[_0x1f02('0x14')](function(_0x58f332){_0x3b3b57(_0x58f332);});};AGIVertices['prototype'][_0x1f02('0x22')]=function(_0x15e655,_0x4da1ea){this[_0x1f02('0xf')]['getIntervalById'](_0x15e655)[_0x1f02('0x10')](function(_0x4e7add){if(_0x4e7add){if(_0x4e7add[_0x1f02('0x23')]){_0x4da1ea(null,[_0x4e7add['interval']]);}else{_0x4da1ea(null,_['map'](_0x4e7add[_0x1f02('0x24')],_0x1f02('0x25')));}}else{_0x4da1ea(null,![]);}})[_0x1f02('0x14')](function(_0x2b32c6){_0x4da1ea(_0x2b32c6);});};AGIVertices['prototype'][_0x1f02('0x1c')]=function(_0x2f0079){return util[_0x1f02('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x2f0079);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x27')]=function(_0x2a82fa,_0x390686,_0x4292b7){odbc[_0x1f02('0x28')](_0x2a82fa,function(_0x590e26){if(_0x590e26){logger[_0x1f02('0x29')](_0x1f02('0x2a'),_0x590e26);_0x4292b7(_0x590e26);}else{logger[_0x1f02('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x1f02('0x2c')](_0x390686,function(_0x4fa7a9,_0x1e4fe5){if(_0x4fa7a9){logger['info']('Error\x20executing\x20query\x20%s',_0x390686);_0x4292b7(_0x4fa7a9);}else{logger[_0x1f02('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x390686);odbc['close'](function(_0x3ec5bd){if(_0x3ec5bd){logger[_0x1f02('0x29')](_0x1f02('0x2d'),_0x3ec5bd);}_0x4292b7(null,_0x1e4fe5);});}});}});};AGIVertices[_0x1f02('0xd')]['getSmsAccount']=function(_0x2b48a3,_0x4c17ad){this[_0x1f02('0xf')][_0x1f02('0x2e')](_0x2b48a3)[_0x1f02('0x10')](function(_0x43e7bf){_0x4c17ad(null,_0x43e7bf?_0x43e7bf:![]);})[_0x1f02('0x14')](function(_0xa89533){_0x4c17ad(_0xa89533);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x2f')]=function(_0x26bb8d,_0x5e9371){this[_0x1f02('0xf')]['createSmsMessage'](_0x26bb8d)[_0x1f02('0x10')](function(_0x544301){_0x5e9371(null,_0x544301);})[_0x1f02('0x14')](function(_0x124c09){_0x5e9371(_0x124c09);});};AGIVertices[_0x1f02('0xd')]['createSquareDetailsReport']=function(_0x5938e1,_0x1c3f09,_0x1dc9cc){this[_0x1f02('0xf')][_0x1f02('0x30')]({'uniqueid':this[_0x1f02('0x31')][_0x1f02('0x32')],'node':_0x5938e1[_0x1f02('0x33')],'application':_0x5938e1[_0x1f02('0x34')],'data':_0x1c3f09||null,'project_name':this[_0x1f02('0x31')]['arg_1'],'callerid':this[_0x1f02('0x31')]['callerid']})['then'](function(_0xf59107){if(_0x1dc9cc){_0x1dc9cc(null,_0xf59107);}})['catch'](function(_0x584d9c){if(_0x1dc9cc){_0x1dc9cc(_0x584d9c);}});};AGIVertices[_0x1f02('0xd')]['createSquareRecording']=function(_0x4be37b,_0x46ba5a,_0x45450e,_0x5169dc){this[_0x1f02('0xf')][_0x1f02('0x35')]({'uniqueid':this[_0x1f02('0x31')][_0x1f02('0x32')],'callerid':this['channel'][_0x1f02('0x36')],'calleridname':this[_0x1f02('0x31')][_0x1f02('0x37')],'context':this[_0x1f02('0x31')][_0x1f02('0x38')],'extension':this[_0x1f02('0x31')][_0x1f02('0x39')],'priority':this[_0x1f02('0x31')][_0x1f02('0x3a')],'accountcode':this[_0x1f02('0x31')][_0x1f02('0x3b')],'dnid':this[_0x1f02('0x31')][_0x1f02('0x3c')],'projectName':this[_0x1f02('0x31')]['arg_1'],'saveName':_0x46ba5a,'filename':_0x4be37b[_0x1f02('0x3d')]||_0x46ba5a,'savePath':_0x45450e})['then'](function(_0x37759d){_0x5169dc(null,_0x37759d);})['catch'](function(_0x346d4f){_0x5169dc(_0x346d4f);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x3e')]=function(_0x32dac3,_0x40bf99,_0x1b8b61,_0x217d85,_0x2178b2){this[_0x1f02('0xf')][_0x1f02('0x3e')]({'uniqueid':this[_0x1f02('0x31')]['uniqueid'],'body':_0x32dac3,'direction':_0x40bf99,'providerName':_0x1b8b61,'providerResponse':_0x217d85})[_0x1f02('0x10')](function(_0x297957){if(_0x2178b2){_0x2178b2(null,_0x297957);}})[_0x1f02('0x14')](function(_0x102551){if(_0x2178b2){_0x2178b2(_0x102551);}});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x3f')]=function(_0x2201b4,_0x5f2409){this[_0x1f02('0xf')]['createCmContact']({'firstName':_[_0x1f02('0x40')](_0x2201b4[_0x1f02('0x11')])||_[_0x1f02('0x41')](_0x2201b4[_0x1f02('0x11')])?_0x1f02('0x42')+Math['random']():_0x2201b4[_0x1f02('0x11')],'lastName':_['isEmpty'](_0x2201b4[_0x1f02('0x43')])||_[_0x1f02('0x41')](_0x2201b4[_0x1f02('0x43')])?null:_0x2201b4[_0x1f02('0x43')],'phone':_0x2201b4[_0x1f02('0x44')],'ListId':_0x2201b4[_0x1f02('0x45')],'scheduledat':_0x2201b4[_0x1f02('0x46')],'callbackUniqueid':this[_0x1f02('0x31')][_0x1f02('0x32')],'tags':_0x1f02('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x2201b4['scheduledAt']['toString'](),'priority':_0x2201b4[_0x1f02('0x48')]})['then'](function(_0x238911){_0x5f2409(null,_0x238911);})[_0x1f02('0x14')](function(_0x587873){_0x5f2409(_0x587873);});};AGIVertices[_0x1f02('0xd')]['getPause']=function(_0x52e236,_0x4929be){this[_0x1f02('0xf')][_0x1f02('0x49')](_0x52e236)[_0x1f02('0x10')](function(_0x390df6){_0x4929be(null,_0x390df6?_0x390df6[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x5ea9a3){_0x4929be(_0x5ea9a3);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x4a')]=function(_0x496e3c,_0x5c2745,_0x2b0e0d){var _0x34e76e={'role':_0x1f02('0x4b')};_0x34e76e[_0x496e3c]=this['channel'][_0x1f02('0x36')];this['rpc'][_0x1f02('0x4a')](_0x34e76e,_0x5c2745,this['channel'][_0x1f02('0x32')])[_0x1f02('0x10')](function(_0xd7be3b){_0x2b0e0d(null,_[_0x1f02('0x41')](_0xd7be3b)?![]:!![]);})[_0x1f02('0x14')](function(_0x46674e){logger[_0x1f02('0x29')](_0x46674e);_0x2b0e0d(null,![]);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x4c')]=function(_0xdd0ac0,_0x3d4c6f){var _0x254bf4={'role':_0x1f02('0x4b')};_0x254bf4[_0xdd0ac0]=this[_0x1f02('0x31')][_0x1f02('0x36')];this[_0x1f02('0xf')][_0x1f02('0x4c')](_0x254bf4)[_0x1f02('0x10')](function(_0x245413){_0x3d4c6f(null,_[_0x1f02('0x41')](_0x245413)?![]:!![]);})['catch'](function(_0xf59e60){logger[_0x1f02('0x29')](_0xf59e60);_0x3d4c6f(null,![]);});};AGIVertices['prototype'][_0x1f02('0x4d')]=function(_0x9c04cf,_0x4a25d8){var _0x2b804e={'role':_0x1f02('0x4b')};_0x2b804e[_0x9c04cf]=this[_0x1f02('0x31')]['callerid'];this['rpc'][_0x1f02('0x4d')](_0x2b804e)[_0x1f02('0x10')](function(_0x1eabea){_0x4a25d8(null,_[_0x1f02('0x41')](_0x1eabea)?![]:!![]);})[_0x1f02('0x14')](function(_0x2f971c){logger[_0x1f02('0x29')](_0x2f971c);_0x4a25d8(null,![]);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x4e')]=function(_0x2ed1d7,_0x494aae){var _0x2cbb39={'role':'agent'};_0x2cbb39[_0x2ed1d7]=this['channel'][_0x1f02('0x36')];var _0xe7dde7=_0x2ed1d7!=_0x1f02('0x4f')?util[_0x1f02('0x26')](_0x1f02('0x50'),_0x1f02('0x51'),this[_0x1f02('0x31')][_0x1f02('0x36')]):undefined;this[_0x1f02('0xf')][_0x1f02('0x4e')](_0x2cbb39,_0xe7dde7)[_0x1f02('0x10')](function(_0x30deb9){_0x494aae(null,_[_0x1f02('0x41')](_0x30deb9)?![]:!![]);})['catch'](function(_0x5d4777){logger[_0x1f02('0x29')](_0x5d4777);_0x494aae(null,![]);});};AGIVertices[_0x1f02('0xd')]['shellCommand']=function(_0x554ec1,_0x5819fe){sh[_0x1f02('0x52')](_[_0x1f02('0x53')](_0x554ec1),function(_0x1b3bfd,_0x3ad421){var _0x34694a=_0x3ad421['replace'](/(\r\n|\n|\r)/gm,'');_0x5819fe(null,_0x34694a);});};AGIVertices[_0x1f02('0xd')]['googleCloudTTS']=function(_0x386df5,_0x4562c1){scripts[_0x1f02('0x54')](_0x386df5[_0x1f02('0x55')],_0x386df5[_0x1f02('0x56')]||_0x1f02('0x57'),_0x386df5[_0x1f02('0x57')],_0x386df5['languageCode']||_0x1f02('0x58'),_0x386df5[_0x1f02('0x59')]||_0x1f02('0x5a'),_0x386df5[_0x1f02('0x5b')]||_0x1f02('0x5c'))[_0x1f02('0x10')](function(_0xea49c1){_0x4562c1(null,_0xea49c1);})[_0x1f02('0x14')](function(_0x2d927f){_0x4562c1(_0x2d927f);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x5d')]=function(_0x48655c,_0x572965){scripts[_0x1f02('0x5d')](_0x48655c[_0x1f02('0x57')],_0x48655c[_0x1f02('0x5e')]||'en',0x1)[_0x1f02('0x10')](function(_0x1ea4b5){_0x572965(null,_0x1ea4b5);})[_0x1f02('0x14')](function(_0x4261f2){_0x572965(_0x4261f2);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x5f')]=function(_0xb9a76f,_0x1ef39a){var _0x3c6100={'uri':_0xb9a76f[_0x1f02('0x60')],'method':_0xb9a76f[_0x1f02('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xb9a76f[_0x1f02('0x62')])===_0x1f02('0x63')&&parseInt(_0xb9a76f[_0x1f02('0x62')])>=0x1?parseInt(_0xb9a76f[_0x1f02('0x62')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x1f02('0x64')],_0x3c6100[_0x1f02('0x61')]['toUpperCase']())){try{_0x3c6100[_0x1f02('0x65')]=_0xb9a76f[_0x1f02('0x9')]?JSON[_0x1f02('0x66')](_0xb9a76f[_0x1f02('0x9')]):{};}catch(_0x30eb49){logger[_0x1f02('0x29')](_0x1f02('0x67'),_0x30eb49);}}try{_0x3c6100[_0x1f02('0x68')]=_0xb9a76f['rawHeaders']?JSON[_0x1f02('0x66')](_0xb9a76f[_0x1f02('0x69')]):{};}catch(_0x5a719d){logger[_0x1f02('0x29')](_0x1f02('0x6a'),_0x5a719d);}if(_0xb9a76f[_0x1f02('0x6b')]){try{var _0xd0921b=require(_0xb9a76f[_0x1f02('0x6b')])[_0x1f02('0x6c')](this,_0x3c6100);_0x3c6100['uri']=Mustache[_0x1f02('0x6d')](_0xb9a76f[_0x1f02('0x60')],_0xd0921b,{},['$$','$$']);if(_0x3c6100['headers']){_0x3c6100[_0x1f02('0x68')]=JSON['parse'](Mustache[_0x1f02('0x6d')](JSON[_0x1f02('0x6e')](_0x3c6100[_0x1f02('0x68')]),_0xd0921b,{},['$$','$$']));}if(_0x3c6100[_0x1f02('0x65')]){_0x3c6100[_0x1f02('0x65')]=JSON[_0x1f02('0x66')](Mustache[_0x1f02('0x6d')](JSON[_0x1f02('0x6e')](_0x3c6100[_0x1f02('0x65')]),_0xd0921b,{},['$$','$$']));}}catch(_0x40b351){logger[_0x1f02('0x29')](_0x1f02('0x6f'),_0x40b351);}}rp(_0x3c6100)[_0x1f02('0x10')](function(_0x25f4d9){var _0x3af2fa={'statusCode':_0x25f4d9[_0x1f02('0x70')]||0xc8,'statusMessage':_0x25f4d9[_0x1f02('0x71')]||'OK','headers':_0x25f4d9[_0x1f02('0x68')]||{},'body':_0x25f4d9[_0x1f02('0x65')]||{}};_0x1ef39a(null,_0x3af2fa);})[_0x1f02('0x14')](function(_0x13a46f){var _0x257cb7={'statusCode':_0x13a46f[_0x1f02('0x70')]||0x1f4,'statusMessage':_0x13a46f[_0x1f02('0x72')]||_0x1f02('0x73'),'headers':_0x13a46f[_0x1f02('0x74')]['headers']||{},'body':_0x13a46f[_0x1f02('0x74')][_0x1f02('0x65')]||{}};_0x1ef39a(null,_0x257cb7);});};AGIVertices[_0x1f02('0xd')]['googleDialogflow']=function(_0x2c719a,_0x362548){scripts[_0x1f02('0x75')](this[_0x1f02('0x31')][_0x1f02('0x32')],_0x2c719a[_0x1f02('0x76')],_0x2c719a['text'],_0x2c719a['dialogflow_language']||'en')[_0x1f02('0x10')](function(_0x1c0c8d){_0x362548(null,_0x1c0c8d);})['catch'](function(_0x980ce1){_0x362548(_0x980ce1);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x77')]=function(_0x5d4b90,_0x127e74){scripts[_0x1f02('0x77')](this[_0x1f02('0x31')][_0x1f02('0x32')],_0x5d4b90['dialogflowV2_project_id'],_0x5d4b90['client_email'],_0x5d4b90[_0x1f02('0x78')],_0x5d4b90[_0x1f02('0x57')],_0x5d4b90['dialogflowV2_language']||'en')['then'](function(_0x169919){_0x127e74(null,_0x169919);})[_0x1f02('0x14')](function(_0x14dae8){_0x127e74(_0x14dae8);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x79')]=function(_0x5a18c7,_0x28ebe6){scripts['sestekNDA'](this[_0x1f02('0x31')],_0x5a18c7)[_0x1f02('0x10')](function(_0xd30f92){_0x28ebe6(null,_0xd30f92);})['catch'](function(_0x8046ae){_0x28ebe6(_0x8046ae);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7a')]=function(_0x55764d,_0x1eca0f){scripts[_0x1f02('0x7a')](_0x55764d[_0x1f02('0x76')],_0x55764d[_0x1f02('0x57')],_0x55764d['ispeech_tts_language']||_0x1f02('0x58'),_0x55764d['speed'])[_0x1f02('0x10')](function(_0x4939a1){_0x1eca0f(null,_0x4939a1);})[_0x1f02('0x14')](function(_0x5d794c){_0x1eca0f(_0x5d794c);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7b')]=function(_0x482def,_0x42feae,_0x21bae3){scripts[_0x1f02('0x7b')](_0x42feae,_0x482def[_0x1f02('0x76')],_0x482def[_0x1f02('0x7c')]||'en-US',this[_0x1f02('0x7d')](_0x482def[_0x1f02('0x7e')])?_0x482def[_0x1f02('0x7e')]:undefined)[_0x1f02('0x10')](function(_0x2198eb){_0x21bae3(null,_0x2198eb);})['catch'](function(_0x1149e8){_0x21bae3(_0x1149e8);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7f')]=function(_0x1baf5d,_0x4e2aab){scripts['awsPolly'](_0x1baf5d[_0x1f02('0x80')],_0x1baf5d['aws_secret_access_key'],_0x1baf5d[_0x1f02('0x81')],_0x1baf5d[_0x1f02('0x82')]||_0x1f02('0x83'),_0x1baf5d[_0x1f02('0x57')],_0x1baf5d[_0x1f02('0x84')]||_0x1f02('0x57'))[_0x1f02('0x10')](function(_0x262bd6){_0x4e2aab(null,_0x262bd6);})['catch'](function(_0x1507e4){_0x4e2aab(_0x1507e4);});};AGIVertices[_0x1f02('0xd')]['awsLex']=function(_0x49d155,_0x349423){scripts['awsLex'](this[_0x1f02('0x31')]['uniqueid'],_0x49d155[_0x1f02('0x80')],_0x49d155['aws_secret_access_key'],_0x49d155[_0x1f02('0x85')],_0x49d155[_0x1f02('0x57')],_0x49d155[_0x1f02('0x86')])['then'](function(_0x3cc8da){_0x349423(null,_0x3cc8da);})[_0x1f02('0x14')](function(_0x4bc0c4){_0x349423(_0x4bc0c4);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x87')]=function(_0x2a57e4,_0xe4f778,_0xe69c4a){scripts[_0x1f02('0x87')](_0xe4f778,_0x2a57e4[_0x1f02('0x76')],_0x2a57e4[_0x1f02('0x88')]||_0x1f02('0x58'))['then'](function(_0x1e1637){_0xe69c4a(null,_0x1e1637);})[_0x1f02('0x14')](function(_0x262f18){_0xe69c4a(_0x262f18);});};AGIVertices['prototype'][_0x1f02('0x89')]=function(_0x40a945,_0x23ad42,_0x1f9e2f){scripts[_0x1f02('0x89')](_0x23ad42,_0x40a945[_0x1f02('0x8a')],_0x40a945[_0x1f02('0x8b')],_0x40a945[_0x1f02('0x8c')])[_0x1f02('0x10')](function(_0x5da287){_0x1f9e2f(null,_0x5da287);})[_0x1f02('0x14')](function(_0x12a2ec){_0x1f9e2f(_0x12a2ec);});};AGIVertices[_0x1f02('0xd')]['clear']=function(_0x3b2a8f){var _0x5bc60a=_[_0x1f02('0x8d')](verticesWithRetry,_0x3b2a8f[_0x1f02('0x34')])?_0x3b2a8f:_[_0x1f02('0x8e')](_0x3b2a8f);for(var _0x32d4d1 in _0x5bc60a){if(_0x5bc60a[_0x1f02('0x8f')](_0x32d4d1)){if(_0x5bc60a[_0x32d4d1]&&_[_0x1f02('0x90')](_0x5bc60a[_0x32d4d1])){if(_['includes'](recursiveMapAttributes,_0x32d4d1)){_0x5bc60a[_0x32d4d1]=this['replaceObjectAllVariables'](_0x5bc60a[_0x32d4d1]);}else{_0x5bc60a[_0x32d4d1]=this[_0x1f02('0x91')](_0x5bc60a[_0x32d4d1]);}}}}return _0x5bc60a;};AGIVertices[_0x1f02('0xd')]['recursiveNodeIndex']=function(_0x31ecc1){for(var _0x3c0a13 in _0x31ecc1){if(_0x31ecc1[_0x1f02('0x8f')](_0x3c0a13)){if(_[_0x1f02('0x92')](_0x31ecc1[_0x3c0a13])){this[_0x1f02('0x93')](_0x31ecc1[_0x3c0a13]);}else if(_[_0x1f02('0x94')](_0x31ecc1[_0x3c0a13])){for(var _0x1aeee5=0x0;_0x1aeee5<_0x31ecc1[_0x3c0a13]['length'];_0x1aeee5++){this[_0x1f02('0x93')](_0x31ecc1[_0x3c0a13][_0x1aeee5]);}}else if(_['isString'](_0x31ecc1[_0x3c0a13])){_0x31ecc1[_0x3c0a13]=this[_0x1f02('0x91')](_0x31ecc1[_0x3c0a13]);}}}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x95')]=function(_0x9edbac,_0x1a790d){for(var _0x35cb3b in _0x9edbac){if(_0x9edbac[_0x1f02('0x8f')](_0x35cb3b)){if(_[_0x1f02('0x92')](_0x9edbac[_0x35cb3b])){if(!_[_0x1f02('0x40')](_0x9edbac[_0x35cb3b])){this[_0x1f02('0x95')](_0x9edbac[_0x35cb3b],util[_0x1f02('0x26')](_0x1f02('0x96'),_0x1a790d,_0x35cb3b));}}else if(_[_0x1f02('0x94')](_0x9edbac[_0x35cb3b])){for(var _0x1fcdbd=0x0;_0x1fcdbd<_0x9edbac[_0x35cb3b]['length'];_0x1fcdbd++){this['saveRestApiResult'](_0x9edbac[_0x35cb3b][_0x1fcdbd],util[_0x1f02('0x26')](_0x1f02('0x96'),_0x1a790d,_0x35cb3b+'['+_0x1fcdbd+']'));}}else{if(!_[_0x1f02('0x41')](_0x9edbac[_0x35cb3b])){this['channel'][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0x96'),_0x1a790d,_0x35cb3b),_0x9edbac[_0x35cb3b]);}}}}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x98')]=function(_0x15002d){try{var _0x2973de=JSON[_0x1f02('0x66')](_0x15002d);this[_0x1f02('0x93')](_0x2973de);return JSON[_0x1f02('0x6e')](_0x2973de);}catch(_0x406158){return this[_0x1f02('0x91')](_0x15002d);}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x91')]=function(_0x43936c){var _0x5e8066=_0x43936c[_0x1f02('0x99')]('{');for(var _0x4b484c=0x1;_0x4b484c<_0x5e8066[_0x1f02('0x9a')];_0x4b484c+=0x1){var _0x4bde90=_0x5e8066[_0x4b484c][_0x1f02('0x99')]('}');if(_0x4bde90['length']>0x1){_0x43936c=_0x43936c[_0x1f02('0x9b')]('{'+_0x4bde90[0x0]+'}',this[_0x1f02('0x31')][_0x1f02('0xe')](_0x4bde90[0x0])['extra']||_0x4bde90[0x0]);}}if(_0x5e8066[_0x1f02('0x9a')]===0x1){return _0x43936c[_0x1f02('0x9c')]();}return this['replaceAllVariables'](_0x43936c);};AGIVertices['prototype'][_0x1f02('0x9d')]=function(_0x9d3b77,_0x3ced2a){var _0x5d4ac1=this[_0x1f02('0x31')][_0x1f02('0xe')](_0x9d3b77);if(_0x5d4ac1[_0x1f02('0x9e')]===-0x1){return _0x5d4ac1;}logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x9f'),_0x3ced2a,_0x5d4ac1[_0x1f02('0xa0')]));return this[_0x1f02('0x31')][_0x1f02('0x97')](_0x3ced2a,_0x5d4ac1['extra']);};AGIVertices['prototype'][_0x1f02('0x7d')]=function(_0x2ee07e){return _0x2ee07e&&_0x2ee07e!=='0'&&_0x2ee07e!=='-1'&&_0x2ee07e!=='';};AGIVertices[_0x1f02('0xd')][_0x1f02('0xa1')]=function(_0x1ac192){this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x1ac192,'-');_0x1ac192[_0x1f02('0xa2')]=_0x1ac192[_0x1f02('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1f02('0xd')]['mrcpsynth']=function(_0x162c8d){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xa3'),_0x162c8d[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x162c8d[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}var _0x291876='\x22'+_0x162c8d[_0x1f02('0x57')]+'\x22';if(this[_0x1f02('0x7d')](_0x162c8d[_0x1f02('0x74')])){_0x291876+=','+_0x162c8d['options'];}var _0x23aa99=this[_0x1f02('0x31')][_0x1f02('0x52')]('MRCPSynth',_0x291876);if(_0x23aa99[_0x1f02('0x9e')]===-0x1){return _0x23aa99;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x291876));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xa6')]=function(_0x341e65){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0xa7'),_0x341e65[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x341e65[_0x1f02('0xa8')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20grammar\x20configured');}var _0x2a338d=_0x341e65[_0x1f02('0xa8')];if(this[_0x1f02('0x7d')](_0x341e65[_0x1f02('0x74')])){_0x2a338d+=','+_0x341e65['options'];}var _0x1e39a0=this[_0x1f02('0x31')]['exec']('MRCPRecog',_0x2a338d);if(_0x1e39a0[_0x1f02('0x9e')]===-0x1){return _0x1e39a0;}var _0x584b66=this[_0x1f02('0x9d')](_0x1f02('0xa9'),_0x1f02('0xaa'));if(_0x584b66[_0x1f02('0x9e')]===-0x1){return _0x584b66;}var _0x4a870c=this[_0x1f02('0x9d')]('RECOG_INPUT()',_0x1f02('0xab'));if(_0x4a870c[_0x1f02('0x9e')]===-0x1){return _0x4a870c;}var _0x27b592=this[_0x1f02('0x9d')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x27b592[_0x1f02('0x9e')]===-0x1){return _0x27b592;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0xac'),_0x2a338d));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7')]=function(_0x501e9b){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xad'),_0x501e9b[_0x1f02('0x33')]));return this['channel'][_0x1f02('0x7')]([_0x501e9b[_0x1f02('0xae')],_0x501e9b[_0x1f02('0xaf')]]);};AGIVertices[_0x1f02('0xd')][_0x1f02('0xb0')]=function(_0x55f769){logger['info'](util[_0x1f02('0x26')](_0x1f02('0xb1'),_0x55f769['label']));if(this[_0x1f02('0x7d')](_0x55f769[_0x1f02('0x62')])){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x55f769[_0x1f02('0x62')]));var _0x22e91e=this[_0x1f02('0x31')][_0x1f02('0xb2')](_0x55f769[_0x1f02('0x62')]);if(_0x22e91e['result']===-0x1){return _0x22e91e;}}return this[_0x1f02('0x31')][_0x1f02('0xb0')]();};AGIVertices['prototype'][_0x1f02('0x47')]=function(_0x3d514b){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3d514b[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x3d514b[_0x1f02('0x45')])){return this[_0x1f02('0x31')]['error'](_0x3d514b,_0x1f02('0xb3'));}_0x3d514b['scheduledAt']=moment();if(this['isConfigured'](_0x3d514b['delay'])){_0x3d514b[_0x1f02('0x46')]=moment()[_0x1f02('0xb4')](_0x3d514b[_0x1f02('0xb5')],_0x1f02('0xb6'));}if(!this[_0x1f02('0x7d')](_0x3d514b['callback_priority'])){_0x3d514b[_0x1f02('0x48')]=0x2;}this[_0x1f02('0x3f')]['sync'](this,_0x3d514b);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0xb7'),_0x3d514b[_0x1f02('0x44')],_0x3d514b[_0x1f02('0x45')],_0x3d514b[_0x1f02('0x46')]));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xb8')]=function(_0x3e96e8){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0xb9'),_0x3e96e8[_0x1f02('0x33')]));var _0x39b66a=this[_0x1f02('0x31')]['exec'](_0x3e96e8[_0x1f02('0xba')],_0x3e96e8['options']);if(_0x39b66a['result']===-0x1){return _0x39b66a;}return this['channel'][_0x1f02('0xa4')](util['format'](_0x1f02('0xbb'),_0x3e96e8[_0x1f02('0xba')],_0x3e96e8['options']));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xbc')]=function(_0x396416){logger['info'](util['format'](_0x1f02('0xbd'),_0x396416[_0x1f02('0x33')]));if(!this['isConfigured'](_0x396416['text'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20text\x20configured');}var _0x4ec7bd='\x22'+_0x396416[_0x1f02('0x57')]+'\x22';if(this['isConfigured'](_0x396416['options'])){_0x4ec7bd+=','+_0x396416[_0x1f02('0x74')];}var _0x8474c2=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xbe'),_0x4ec7bd);if(_0x8474c2['result']===-0x1){return _0x8474c2;}return this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0xbf'),_0x4ec7bd));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xc0')]=function(_0x2c7a77){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2c7a77[_0x1f02('0x33')]));if(!this['isConfigured'](_0x2c7a77[_0x1f02('0x57')])){return this['channel']['noop'](_0x1f02('0xa5'));}var _0x5b799e='\x22'+_0x2c7a77[_0x1f02('0x57')]+'\x22';if(this[_0x1f02('0x7d')](_0x2c7a77['options'])){_0x5b799e+=','+_0x2c7a77[_0x1f02('0x74')];}var _0x3fb1b1=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xbe'),_0x5b799e);if(_0x3fb1b1[_0x1f02('0x9e')]===-0x1){return _0x3fb1b1;}return this['channel'][_0x1f02('0xa4')](util['format'](_0x1f02('0xbf'),_0x5b799e));};AGIVertices[_0x1f02('0xd')]['lumenvoxasr']=function(_0x5f3d87){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5f3d87[_0x1f02('0x33')]));if(!this['isConfigured'](_0x5f3d87['grammar'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xc1'));}var _0x558918=_0x5f3d87[_0x1f02('0xa8')];if(this['isConfigured'](_0x5f3d87[_0x1f02('0x74')])){_0x558918+=','+_0x5f3d87[_0x1f02('0x74')];}var _0x16c042=this[_0x1f02('0x31')]['exec'](_0x1f02('0xc2'),_0x558918);if(_0x16c042['result']===-0x1){return _0x16c042;}var _0x25ad86=this[_0x1f02('0x9d')]('RECOG_CONFIDENCE()',_0x1f02('0xc3'));if(_0x25ad86[_0x1f02('0x9e')]===-0x1){return _0x25ad86;}var _0x4af053=this['getAndSetVariable'](_0x1f02('0xc4'),_0x1f02('0xc5'));if(_0x4af053['result']===-0x1){return _0x4af053;}var _0x49a520=this[_0x1f02('0x9d')](_0x1f02('0xc6'),_0x1f02('0xc7'));if(_0x49a520[_0x1f02('0x9e')]===-0x1){return _0x49a520;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xac'),_0x558918));};AGIVertices['prototype'][_0x1f02('0xc8')]=function(_0x41e41d){logger['info'](util[_0x1f02('0x26')](_0x1f02('0xc9'),_0x41e41d['label']));if(!this[_0x1f02('0x7d')](_0x41e41d[_0x1f02('0xa8')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xc1'));}var _0x51799f=_0x41e41d[_0x1f02('0xa8')];if(this['isConfigured'](_0x41e41d[_0x1f02('0x74')])){_0x51799f+=','+_0x41e41d[_0x1f02('0x74')];}var _0x2cd0a3=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xc2'),_0x51799f);if(_0x2cd0a3[_0x1f02('0x9e')]===-0x1){return _0x2cd0a3;}var _0x240f7e=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x240f7e['result']===-0x1){return _0x240f7e;}var _0x19b15a=this[_0x1f02('0x9d')](_0x1f02('0xc4'),_0x1f02('0xca'));if(_0x19b15a[_0x1f02('0x9e')]===-0x1){return _0x19b15a;}var _0x1d769b=this[_0x1f02('0x9d')](_0x1f02('0xc6'),_0x1f02('0xcb'));if(_0x1d769b['result']===-0x1){return _0x1d769b;}return this['channel'][_0x1f02('0xa4')](util['format'](_0x1f02('0xac'),_0x51799f));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xcc')]=function(_0x4a69b1){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xcd'),_0x4a69b1[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x4a69b1[_0x1f02('0xce')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x4a69b1,'no\x20database\x20selected');}var _0x1e52bb=this['getSquareOdbc']['sync'](this,_0x4a69b1[_0x1f02('0xce')]);if(!_0x1e52bb){return this['channel'][_0x1f02('0x29')](_0x4a69b1,_0x1f02('0xcf'));}if(!this[_0x1f02('0x7d')](_0x4a69b1[_0x1f02('0x2c')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x4a69b1,_0x1f02('0xd0'));}var _0x51e4a8=_0x4a69b1[_0x1f02('0x2c')][_0x1f02('0xd1')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0xd2'),_0x51e4a8));var _0xe9e2f6=this['getQueryOdbc'][_0x1f02('0x6c')](this,_0x1e52bb,_0x51e4a8);this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x4a69b1,_0x51e4a8);if(!this['isConfigured'](_0x4a69b1['variable_id'])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0xd3'));}var _0x1d1c89=this['getVariable']['sync'](this,_0x4a69b1[_0x1f02('0xd4')]);if(!_0x1d1c89){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x4a69b1,_0x1f02('0xd5'));}var _0x3aa39c=this;_0xe9e2f6[_0x1f02('0xd6')](function(_0x5a9223,_0x2872b8){Object[_0x1f02('0xd7')](_0x5a9223)['forEach'](function(_0x3fcc15){_0x3aa39c[_0x1f02('0x31')][_0x1f02('0x97')](util['format']('%s[%s][%s]',_0x1d1c89,_0x2872b8,_0x3fcc15),_0x5a9223[_0x3fcc15]);});});this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')]('%s_ROWS_COUNT',_0x1d1c89),_0xe9e2f6[_0x1f02('0x9a')]);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xd8'),_0x1d1c89));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xd9')]=function(_0x5035f9){logger['debug'](util['format'](_0x1f02('0xda'),_0x5035f9[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x5035f9[_0x1f02('0xdb')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x5035f9,_0x1f02('0xdc'));}var _0x25c421=this[_0x1f02('0x18')][_0x1f02('0x6c')](this,_0x5035f9[_0x1f02('0xdb')]);if(!_0x25c421){return this[_0x1f02('0x31')]['error'](_0x5035f9,_0x1f02('0xdd'));}var _0x205372=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xde'),[util[_0x1f02('0x26')](_0x1f02('0xdf'),_0x25c421),_0x5035f9['timeout'],_0x5035f9[_0x1f02('0xe0')],_0x5035f9[_0x1f02('0x60')]]);if(_0x205372[_0x1f02('0x9e')]===-0x1){return _0x205372;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xe1'),_0x1f02('0xde')));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xe2')]=function(_0x1f7276){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1f7276[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x1f7276['key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xe3'));}if(!this['isConfigured'](_0x1f7276[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this['channel'][_0x1f02('0xe4')]=!![];this[_0x1f02('0x30')](_0x1f7276);this[_0x1f02('0x3e')](_0x1f7276[_0x1f02('0x57')],'in','','');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xe5'),_0x1f7276['text']));var _0x9665c4=this[_0x1f02('0x75')]['sync'](this,_0x1f7276);if(_0x9665c4){for(var _0x15c2bf in _0x9665c4){if(_0x9665c4[_0x1f02('0x8f')](_0x15c2bf)){this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0xe6'),_0x15c2bf[_0x1f02('0xe7')]()),_0x9665c4[_0x15c2bf]);}}this[_0x1f02('0x3e')](_0x9665c4[_0x1f02('0xe8')],_0x1f02('0xe9'),_0x1f02('0xe2'),'');return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Dialogflow\x20Result\x20%s',_0x9665c4[_0x1f02('0xe8')]));}return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1f7276,_0x1f02('0xea'));};AGIVertices['prototype']['dialogflowV2']=function(_0x1ecd32){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xeb'),_0x1ecd32[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x1ecd32['dialogflowV2_project_id'])){return this['channel'][_0x1f02('0xa4')]('no\x20project_id\x20configured');}if(!this[_0x1f02('0x7d')](_0x1ecd32[_0x1f02('0xec')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xed'));}if(!this['isConfigured'](_0x1ecd32[_0x1f02('0x78')])){return this['channel'][_0x1f02('0xa4')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x1ecd32['dialogflowV2_language'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xee'));}if(!this['isConfigured'](_0x1ecd32[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')]['bot']=!![];this['createSquareDetailsReport'](_0x1ecd32);this['createSquareMessage'](_0x1ecd32['text'],'in','','');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x1ecd32[_0x1f02('0x57')]));var _0x1e5743=this['googleDialogflowV2']['sync'](this,_0x1ecd32);if(_0x1e5743){for(var _0x1b05b3 in _0x1e5743){if(_0x1e5743[_0x1f02('0x8f')](_0x1b05b3)){if(_0x1b05b3!==_0x1f02('0xef')){this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')]('DIALOGFLOW_%s',_0x1b05b3[_0x1f02('0xe7')]()),_0x1e5743[_0x1b05b3]);}}}this[_0x1f02('0x3e')](_0x1e5743[_0x1f02('0xe8')],_0x1f02('0xe9'),_0x1f02('0xf0'),_0x1e5743[_0x1f02('0xef')]);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0xf1'),_0x1e5743[_0x1f02('0xe8')]));}return this['channel'][_0x1f02('0x29')](_0x1ecd32,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x1f02('0xd')][_0x1f02('0xf2')]=function(_0x26f4c0){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xf3'),_0x26f4c0['label']));if(!this[_0x1f02('0x7d')](_0x26f4c0[_0x1f02('0xf4')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x26f4c0[_0x1f02('0xf5')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xf6'));}if(!this['isConfigured'](_0x26f4c0[_0x1f02('0xf7')])){return this['channel'][_0x1f02('0xa4')]('no\x20password\x20configured');}if(!this[_0x1f02('0x7d')](_0x26f4c0[_0x1f02('0xf8')])){return this[_0x1f02('0x31')]['noop'](_0x1f02('0xa5'));}this[_0x1f02('0x31')][_0x1f02('0xe4')]=!![];this[_0x1f02('0x30')](_0x26f4c0);this[_0x1f02('0x3e')](_0x26f4c0[_0x1f02('0x57')],'in','','');this['channel'][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Trying\x20SestekNDA:\x20%s',_0x26f4c0['text']));var _0x55aec4=this[_0x1f02('0x79')][_0x1f02('0x6c')](this,_0x26f4c0);if(_0x55aec4){for(var _0x361502 in _0x55aec4){if(_0x55aec4[_0x1f02('0x8f')](_0x361502)){this[_0x1f02('0x31')]['setVariable'](util[_0x1f02('0x26')]('SESTEK_NDA_%s',_0x361502[_0x1f02('0xe7')]()),_0x55aec4[_0x361502]);}}this[_0x1f02('0x3e')](_0x55aec4[_0x1f02('0xe8')],_0x1f02('0xe9'),_0x1f02('0xf2'),'');if(_0x55aec4[_0x1f02('0xf9')]){this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xfa'),_0x55aec4['audiofile']));var _0x258e30=this['channel']['streamFile'](_0x55aec4[_0x1f02('0xf9')]);try{fs[_0x1f02('0xfb')](_0x55aec4['audiofile']+_0x1f02('0xfc'));}catch(_0x496fec){logger['error'](_0x496fec);}return _0x258e30;}else{return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xfd'),_0x55aec4[_0x1f02('0xe8')]));}}return this[_0x1f02('0x31')]['error'](_0x26f4c0,_0x1f02('0xfe'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xff')]=function(_0x15a331){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x100'),_0x15a331[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')]('end');};AGIVertices['prototype'][_0x1f02('0x101')]=function(_0x1152b5){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x102'),_0x1152b5[_0x1f02('0x33')]));var _0xb4b4a5='';if(_0x1152b5[_0x1f02('0x103')]){if(!this[_0x1f02('0x7d')](_0x1152b5[_0x1f02('0x103')])){return this['channel']['error'](_0x1152b5,_0x1f02('0x104'));}else{var _0x271e0c=parseInt(_0x1152b5[_0x1f02('0x103')],0xa);if(isNaN(_0x271e0c)){_0xb4b4a5=_0x1152b5[_0x1f02('0x103')];}else{_0xb4b4a5=this['getTrunk']['sync'](this,_0x1152b5[_0x1f02('0x103')]);if(!_0xb4b4a5){return this[_0x1f02('0x31')]['error'](_0x1152b5,_0x1f02('0x105'));}}}}else if(_0x1152b5['trunk_name']){_0xb4b4a5=_0x1152b5['trunk_name'];}else{return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1152b5,_0x1f02('0x104'));}var _0x2e1024=this['channel'][_0x1f02('0x52')](_0x1f02('0xde'),[util[_0x1f02('0x26')](_0x1f02('0x106'),_0xb4b4a5,_0x1152b5[_0x1f02('0x44')]),_0x1152b5[_0x1f02('0x62')],_0x1152b5[_0x1f02('0xe0')],_0x1152b5[_0x1f02('0x60')]]);if(_0x2e1024['result']===-0x1){return _0x2e1024;}return this['channel']['noop'](util['format'](_0x1f02('0xe1'),_0x1f02('0xde')));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x107')]=function(_0x141a84){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x108'),_0x141a84[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x107'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xb')]=function(_0x36665a){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x109'),_0x36665a[_0x1f02('0x33')]));if(_0x36665a['retry']===0x0){return this[_0x1f02('0xa1')](_0x36665a);}_0x36665a[_0x1f02('0xa2')]-=0x1;if(!this[_0x1f02('0x7d')](_0x36665a[_0x1f02('0x10a')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x36665a,_0x1f02('0x10b'));}var _0x308f5a=this[_0x1f02('0x1b')]['sync'](this,_0x36665a['file_id']);if(!_0x308f5a){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x36665a,_0x1f02('0x10c'));}if(!this[_0x1f02('0x7d')](_0x36665a[_0x1f02('0xd4')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1f02('0xd3'));}var _0x4e2f04=this[_0x1f02('0x31')][_0x1f02('0x10d')](_0x308f5a,_0x36665a['response'],_0x36665a[_0x1f02('0x10e')]);var _0x64def1=_0x4e2f04[_0x1f02('0x9e')]?_0x4e2f04[_0x1f02('0x9e')][_0x1f02('0x9c')]():'';logger[_0x1f02('0x2b')](_0x1f02('0x10f'),JSON[_0x1f02('0x6e')](_0x4e2f04));if(_0x4e2f04[_0x1f02('0x9e')]===-0x1){this[_0x1f02('0x30')]['sync'](this,_0x36665a,_0x64def1);return _0x4e2f04;}else if(_0x4e2f04[_0x1f02('0xa0')]===_0x1f02('0x62')){_0x4e2f04[_0x1f02('0x9e')]=_0x64def1['length']>=parseInt(_0x36665a[_0x1f02('0x110')])?'x':'i';}else{_0x4e2f04[_0x1f02('0x9e')]=_0x64def1['length']>=parseInt(_0x36665a[_0x1f02('0x110')])&&_0x64def1[_0x1f02('0x9a')]<=parseInt(_0x36665a['maxdigit'])?'x':'i';}var _0x1d576b=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x36665a[_0x1f02('0xd4')]);if(!_0x1d576b){return this[_0x1f02('0x31')]['error'](_0x36665a,_0x1f02('0xd5'));}this[_0x1f02('0x31')][_0x1f02('0x97')](_0x1d576b,_0x64def1);if(this[_0x1f02('0x7d')](_0x36665a[_0x1f02('0x111')])){var _0xd5282d=parseInt(_0x36665a['hiddendigitsnum'],0xa);var _0x18e4b6=rs['generate']({'charset':'*','length':_0xd5282d});var _0x1109e4=_0x64def1['length'];if(_0x1109e4>0x0){if(_0x1109e4>_0xd5282d){this['createSquareDetailsReport'][_0x1f02('0x6c')](this,_0x36665a,_0x36665a[_0x1f02('0x112')]===_0x1f02('0x113')?_0x18e4b6+_0x64def1['substr'](_0xd5282d):_0x64def1[_0x1f02('0x114')](0x0,_0x1109e4-_0xd5282d)+_0x18e4b6);}else{this[_0x1f02('0x30')]['sync'](this,_0x36665a,rs['generate']({'charset':'*','length':_0x1109e4}));}}else{this[_0x1f02('0x30')]['sync'](this,_0x36665a,'');}}else{this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x36665a,_0x64def1);}return _0x4e2f04;};AGIVertices[_0x1f02('0xd')]['getsecretdigits']=function(_0x174a92){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x115'),_0x174a92[_0x1f02('0x33')]));return this[_0x1f02('0xb')](_0x174a92);};AGIVertices['prototype'][_0x1f02('0x116')]=function(_0x345f13){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x345f13[_0x1f02('0x33')]));this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x345f13,_0x345f13[_0x1f02('0x117')]);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x118'),_0x345f13[_0x1f02('0x117')]));};AGIVertices[_0x1f02('0xd')]['awspolly']=function(_0x85b43e){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x119'),_0x85b43e[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x85b43e['aws_access_key_id'])||!this[_0x1f02('0x7d')](_0x85b43e['aws_secret_access_key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x11a'));}if(!this[_0x1f02('0x7d')](_0x85b43e[_0x1f02('0x57')])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0xa5'));}this['channel']['noop'](util[_0x1f02('0x26')](_0x1f02('0x11b'),_0x85b43e[_0x1f02('0x57')]));var _0x834de6=this['awsPolly'][_0x1f02('0x6c')](this,_0x85b43e);if(_0x834de6){this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('aws\x20Polly\x20%s\x20file\x20created',_0x834de6));var _0x31c1d6=this[_0x1f02('0x31')][_0x1f02('0x11c')](_0x834de6);try{fs[_0x1f02('0xfb')](_0x834de6+_0x1f02('0xfc'));}catch(_0x2ccd72){logger[_0x1f02('0x29')](_0x2ccd72);}return _0x31c1d6;}return this['channel'][_0x1f02('0x29')](_0x85b43e,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x16a2f8){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x11d'),_0x16a2f8[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x16a2f8['aws_access_key_id'])||!this[_0x1f02('0x7d')](_0x16a2f8[_0x1f02('0x11e')])){return this[_0x1f02('0x31')]['noop'](_0x1f02('0x11a'));}if(!this[_0x1f02('0x7d')](_0x16a2f8[_0x1f02('0x86')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20bot\x20name\x20configured');}if(!this[_0x1f02('0x7d')](_0x16a2f8[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')][_0x1f02('0xe4')]=!![];this['createSquareDetailsReport'](_0x16a2f8);this[_0x1f02('0x3e')](_0x16a2f8[_0x1f02('0x57')],'in','','');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x11f'),_0x16a2f8[_0x1f02('0x57')]));var _0x6dee9b=this['awsLex'][_0x1f02('0x6c')](this,_0x16a2f8);if(_0x6dee9b){for(var _0x566cdb in _0x6dee9b){if(_0x6dee9b['hasOwnProperty'](_0x566cdb)&&_['isString'](_0x6dee9b[_0x566cdb])){this['channel'][_0x1f02('0x97')](util['format'](_0x1f02('0x120'),_0x566cdb[_0x1f02('0xe7')]()),_0x6dee9b[_0x566cdb]);}}if(_[_0x1f02('0x41')](_0x6dee9b[_0x1f02('0x72')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x1f02('0x3e')](_0x6dee9b[_0x1f02('0x72')],_0x1f02('0xe9'),_0x1f02('0x121'),'');return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x122'),_0x6dee9b['message']));}}return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x16a2f8,_0x1f02('0x123'));};AGIVertices[_0x1f02('0xd')]['googleasr']=function(_0x24d3b9){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x124'),_0x24d3b9[_0x1f02('0x33')],_0x24d3b9[_0x1f02('0x62')]));if(!this[_0x1f02('0x7d')](_0x24d3b9['key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20key\x20configured');}var _0x2860c1=_0x1f02('0x125');var _0x3753df=util[_0x1f02('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x1f02('0x126')](0x4));var _0x12f785=util['format'](_0x1f02('0x96'),_0x3753df,_0x2860c1);var _0x9a5e31=!![];if(_0x24d3b9['beep']===_0x1f02('0x127')){_0x9a5e31=![];}var _0x9a077e=this[_0x1f02('0x31')]['recordFile'](_0x3753df,_0x2860c1,_0x24d3b9[_0x1f02('0x128')],_0x24d3b9[_0x1f02('0x62')],undefined,_0x9a5e31);if(_0x9a077e['result']!==-0x1){this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0x129'),_0x12f785));var _0x30c50d=this[_0x1f02('0x87')][_0x1f02('0x6c')](this,_0x24d3b9,_0x12f785);if(_0x30c50d){for(var _0x10d3a1 in _0x30c50d){if(_0x30c50d[_0x1f02('0x8f')](_0x10d3a1)){this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')]('GOOGLE_ASR_%s',_0x10d3a1[_0x1f02('0xe7')]()),_0x30c50d[_0x10d3a1]);}}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x12a'),JSON[_0x1f02('0x6e')](_0x30c50d)));}}return _0x9a077e;};AGIVertices[_0x1f02('0xd')][_0x1f02('0x12b')]=function(_0xb3363a){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x12c'),_0xb3363a[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0xb3363a[_0x1f02('0x8a')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x12d'));}if(!this['isConfigured'](_0xb3363a[_0x1f02('0x8b')])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0x12e'));}var _0x3bcd5f=_0x1f02('0x125');var _0x188729=util[_0x1f02('0x26')](_0x1f02('0x12f'),FILES_PATH,rs[_0x1f02('0x126')](0x4));var _0x33c851=util[_0x1f02('0x26')](_0x1f02('0x96'),_0x188729,_0x3bcd5f);var _0x585503=!![];if(_0xb3363a[_0x1f02('0x130')]===_0x1f02('0x127')){_0x585503=![];}var _0x320a4b=this[_0x1f02('0x31')][_0x1f02('0x131')](_0x188729,_0x3bcd5f,_0xb3363a[_0x1f02('0x128')],_0xb3363a[_0x1f02('0x62')],undefined,_0x585503);if(_0x320a4b['result']!==-0x1){this['channel']['noop'](util[_0x1f02('0x26')](_0x1f02('0x132'),_0x33c851));var _0x4e6c62=this[_0x1f02('0x89')][_0x1f02('0x6c')](this,_0xb3363a,_0x33c851);if(_0x4e6c62){for(var _0x4ff839 in _0x4e6c62){if(_0x4e6c62[_0x1f02('0x8f')](_0x4ff839)){this[_0x1f02('0x31')]['setVariable'](util['format'](_0x1f02('0x133'),_0x4ff839['toUpperCase']()),_0x4e6c62[_0x4ff839]);}}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0x134'),JSON[_0x1f02('0x6e')](_0x4e6c62)));}}return _0x320a4b;};AGIVertices[_0x1f02('0xd')][_0x1f02('0x135')]=function(_0x2b7831){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x136'),_0x2b7831[_0x1f02('0x33')]));return this[_0x1f02('0x31')]['continueAt'](_0x2b7831[_0x1f02('0x38')],_0x2b7831['extension'],_0x2b7831[_0x1f02('0x3a')]);};AGIVertices['prototype'][_0x1f02('0x137')]=function(_0x1767e4){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x138'),_0x1767e4[_0x1f02('0x33')]));if(!this['isConfigured'](_0x1767e4[_0x1f02('0x139')])){return this[_0x1f02('0x31')]['error'](_0x1767e4,_0x1f02('0x13a'));}try{var _0x5614c2=eval(_0x1767e4['condition'])?_0x1f02('0x13b'):_0x1f02('0x13c');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x13d'),_0x1767e4[_0x1f02('0x139')],_0x5614c2));return{'code':0xc8,'result':_0x5614c2};}catch(_0x2c018f){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x21e6c2){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x13e'),_0x21e6c2[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x21e6c2[_0x1f02('0x13f')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x21e6c2,_0x1f02('0x140'));}var _0xc7868f=this[_0x1f02('0x22')]['sync'](this,_0x21e6c2[_0x1f02('0x13f')]);if(!_0xc7868f){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x21e6c2,'no\x20intervals\x20found');}for(var _0x4252a7=0x0;_0x4252a7<_0xc7868f[_0x1f02('0x9a')];_0x4252a7+=0x1){var _0x47d5de=this[_0x1f02('0x31')][_0x1f02('0xe')](util['format'](_0x1f02('0x141'),_0xc7868f[_0x4252a7]));if(_0x47d5de['result']===-0x1){return _0x47d5de;}logger['info'](util['format'](_0x1f02('0x142'),_0xc7868f[_0x4252a7],_0x47d5de['extra']));if(_0x47d5de[_0x1f02('0xa0')]===_0x1f02('0x13b')){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('IFTIME\x20%s\x20%s',_0xc7868f[_0x4252a7],'true'));this['channel'][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x142'),_0xc7868f[_0x4252a7],_0x1f02('0x13b')));return{'code':0xc8,'result':_0x1f02('0x13b')};}else{logger['info'](util[_0x1f02('0x26')](_0x1f02('0x142'),_0xc7868f[_0x4252a7],'false'));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x142'),_0xc7868f[_0x4252a7],_0x1f02('0x13c')));}}return{'code':0xc8,'result':_0x1f02('0x13c')};};AGIVertices[_0x1f02('0xd')][_0x1f02('0x143')]=function(_0x2c9ca2){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x144'),_0x2c9ca2[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0x143')]();};AGIVertices[_0x1f02('0xd')][_0x1f02('0x145')]=function(_0x414ee3){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x146'),_0x414ee3['label']));if(!this[_0x1f02('0x7d')](_0x414ee3['key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xe3'));}var _0x1d40be=_0x1f02('0x125');var _0x5b012e=util[_0x1f02('0x26')](_0x1f02('0x12f'),FILES_PATH,rs[_0x1f02('0x126')](0x4));var _0x572151=util[_0x1f02('0x26')](_0x1f02('0x96'),_0x5b012e,_0x1d40be);var _0x9e0038=!![];if(_0x414ee3[_0x1f02('0x130')]==='NOBEEP'){_0x9e0038=![];}var _0x5a6fec=this[_0x1f02('0x31')]['recordFile'](_0x5b012e,_0x1d40be,_0x414ee3[_0x1f02('0x128')],_0x414ee3[_0x1f02('0x62')],undefined,_0x9e0038);if(_0x5a6fec[_0x1f02('0x9e')]!==-0x1){this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format']('ispeech\x20%s\x20file\x20created',_0x572151));var _0x4898ab=this[_0x1f02('0x7b')][_0x1f02('0x6c')](this,_0x414ee3,_0x572151);if(_0x4898ab){for(var _0x38d9d3 in _0x4898ab){if(_0x4898ab[_0x1f02('0x8f')](_0x38d9d3)){this[_0x1f02('0x31')]['setVariable'](util[_0x1f02('0x26')](_0x1f02('0x147'),_0x38d9d3[_0x1f02('0xe7')]()),_0x4898ab[_0x38d9d3]);}}return this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0x148'),JSON[_0x1f02('0x6e')](_0x4898ab)));}}return _0x5a6fec;};AGIVertices[_0x1f02('0xd')]['ispeechtts']=function(_0x4a8978){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4a8978[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x4a8978[_0x1f02('0x76')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xe3'));}if(!this[_0x1f02('0x7d')](_0x4a8978[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20text\x20configured');}this['channel'][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x149'),_0x4a8978['text']));var _0x160f2b=this[_0x1f02('0x7a')][_0x1f02('0x6c')](this,_0x4a8978);if(_0x160f2b){this['channel']['noop'](util[_0x1f02('0x26')]('ispeech\x20%s\x20file\x20created',_0x160f2b));var _0x2fbb6c=this[_0x1f02('0x31')][_0x1f02('0x11c')](_0x160f2b,_0x4a8978[_0x1f02('0x128')]);try{fs[_0x1f02('0xfb')](_0x160f2b+_0x1f02('0xfc'));}catch(_0x4085fa){logger[_0x1f02('0x29')](_0x4085fa);}return _0x2fbb6c;}return this['channel'][_0x1f02('0x29')](_0x4a8978,_0x1f02('0x14a'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x14b')]=function(_0x541976){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x14c'),_0x541976[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x541976[_0x1f02('0x14d')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x541976,'no\x20find\x20by\x20configured');}logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x14e'),this['channel'][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));var _0x4ef577=this['agentLogin'][_0x1f02('0x6c')](this,_0x541976[_0x1f02('0x14d')]);if(_0x4ef577){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));this['channel']['noop'](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x14f')};}else{logger[_0x1f02('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x150'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x151')]=function(_0x5c4eb4){logger['info'](util[_0x1f02('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5c4eb4['label']));if(!this['isConfigured'](_0x5c4eb4['findBy'])){return this['channel'][_0x1f02('0x29')](_0x5c4eb4,_0x1f02('0x152'));}logger['info'](util[_0x1f02('0x26')](_0x1f02('0x14e'),this[_0x1f02('0x31')]['callerid'],_0x5c4eb4[_0x1f02('0x14d')]));var _0x4bd535=this[_0x1f02('0x4d')][_0x1f02('0x6c')](this,_0x5c4eb4[_0x1f02('0x14d')]);if(_0x4bd535){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x5c4eb4[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5c4eb4[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x14f')};}else{logger['info'](util['format'](_0x1f02('0x150'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x5c4eb4[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x5c4eb4['findBy']));return{'code':0xc8,'result':_0x1f02('0x154')};}};AGIVertices['prototype']['math']=function(_0x47197c){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x155'),_0x47197c[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x47197c[_0x1f02('0x156')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x47197c,_0x1f02('0x157'));}this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0x158'),_0x47197c[_0x1f02('0x156')]));var _0x40b22d=eval(_0x47197c[_0x1f02('0x156')]);if(!this['isConfigured'](_0x47197c[_0x1f02('0xd4')])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0xd3'));}var _0x219ffd=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x47197c[_0x1f02('0xd4')]);if(!_0x219ffd){return this['channel'][_0x1f02('0x29')](_0x47197c,'no\x20variable\x20found');}if(_[_0x1f02('0x94')](_0x40b22d)){var _0x2a936e=this;_0x40b22d[_0x1f02('0xd6')](function(_0x13f1a3,_0xa0cebe){_0x2a936e[_0x1f02('0x31')][_0x1f02('0x97')](util['format'](_0x1f02('0x159'),_0x219ffd,_0xa0cebe),_0x13f1a3);});return this[_0x1f02('0x31')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x219ffd));}else{return this[_0x1f02('0x31')][_0x1f02('0x97')](_0x219ffd,_0x40b22d);}};AGIVertices['prototype']['menu']=function(_0x1eaa43){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x15a'),_0x1eaa43[_0x1f02('0x33')]));if(_0x1eaa43[_0x1f02('0xa2')]===0x0){return this[_0x1f02('0xa1')](_0x1eaa43);}_0x1eaa43[_0x1f02('0xa2')]-=0x1;if(!this[_0x1f02('0x7d')](_0x1eaa43['file_id'])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1eaa43,_0x1f02('0x10b'));}var _0x2f2d3f=this[_0x1f02('0x1b')][_0x1f02('0x6c')](this,_0x1eaa43['file_id']);if(!_0x2f2d3f){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1eaa43,_0x1f02('0x10c'));}var _0x100748=this['channel'][_0x1f02('0x10d')](_0x2f2d3f,_0x1eaa43[_0x1f02('0x15b')],_0x1eaa43['digit']);var _0x2e55a8=_0x100748['result'];if(_0x100748['result']===-0x1){this[_0x1f02('0x30')]['sync'](this,_0x1eaa43,'-1');return _0x100748;}else if(_0x100748[_0x1f02('0xa0')]===_0x1f02('0x62')){_0x100748[_0x1f02('0x9e')]=_0x100748[_0x1f02('0x9e')][_0x1f02('0x9a')]>0x0?_0x100748['result']:'t';}else if(_['isEmpty'](_0x100748[_0x1f02('0x9e')])){_0x100748[_0x1f02('0x9e')]='#';_0x2e55a8='#';}if(!this[_0x1f02('0x7d')](_0x1eaa43['variable_id'])){this['channel'][_0x1f02('0xa4')](_0x1f02('0xd3'));}else{var _0x458575=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x1eaa43[_0x1f02('0xd4')]);if(!_0x458575){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1eaa43,_0x1f02('0xd5'));}this[_0x1f02('0x31')][_0x1f02('0x97')](_0x458575,_0x2e55a8);}this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x1eaa43,_0x2e55a8);return _0x100748;};AGIVertices[_0x1f02('0xd')][_0x1f02('0xa4')]=function(_0x5abfa8){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x15c'),_0x5abfa8[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x5abfa8[_0x1f02('0x15d')]||_0x5abfa8[_0x1f02('0x33')]);};AGIVertices[_0x1f02('0xd')]['pause']=function(_0x1a07ef){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x15e'),_0x1a07ef[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x1a07ef['findBy'])){return this['channel'][_0x1f02('0x29')](_0x1a07ef,_0x1f02('0x152'));}logger[_0x1f02('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));var _0x2bc745=this[_0x1f02('0x15f')][_0x1f02('0x6c')](this,_0x1a07ef[_0x1f02('0x160')]);var _0x200640=this[_0x1f02('0x4a')][_0x1f02('0x6c')](this,_0x1a07ef[_0x1f02('0x14d')],_0x2bc745);if(_0x200640){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')]['callerid'],_0x1a07ef[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x1f02('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x154')};}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x161')]=function(_0x427731){logger['info'](util[_0x1f02('0x26')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x427731['label']));if(!this['isConfigured'](_0x427731[_0x1f02('0x10a')])){return this['channel']['error'](_0x427731,_0x1f02('0x10b'));}var _0x1ef94a=this[_0x1f02('0x1b')][_0x1f02('0x6c')](this,_0x427731[_0x1f02('0x10a')]);if(!_0x1ef94a){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x427731,'no\x20file\x20audio\x20found');}var _0x3c8d12=this[_0x1f02('0x31')]['exec'](_0x1f02('0x162'),[_0x1ef94a,_0x427731[_0x1f02('0xe0')]]);if(_0x3c8d12['result']===-0x1){return _0x3c8d12;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Executed\x20command\x20%s\x20%s',_0x1f02('0x162'),_0x1ef94a));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x163')]=function(_0x477346){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x164'),_0x477346[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x477346[_0x1f02('0x165')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x477346,_0x1f02('0x166'));}var _0x222b77='';var _0x3df626=parseInt(_0x477346[_0x1f02('0x165')],0xa);if(isNaN(_0x3df626)){_0x222b77=_0x477346['queue_id'];}else{_0x222b77=this[_0x1f02('0x12')]['sync'](this,_0x477346[_0x1f02('0x165')]);if(!_0x222b77){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x477346,_0x1f02('0x167'));}}var _0x53c515='';if(this[_0x1f02('0x7d')](_0x477346[_0x1f02('0x10a')])){var _0x2a6b61=this[_0x1f02('0x1b')][_0x1f02('0x6c')](this,_0x477346[_0x1f02('0x10a')]);if(_0x2a6b61){_0x53c515=_0x2a6b61;}}this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x477346,_0x222b77);if(_0x477346[_0x1f02('0xe0')]['indexOf']('x')<0x0){_0x477346[_0x1f02('0xe0')]+='x';}if(_0x477346[_0x1f02('0xe0')][_0x1f02('0x168')]('X')<0x0){_0x477346['opts']+='X';}this['channel'][_0x1f02('0x97')](_0x1f02('0x169'),_0x222b77?_0x222b77[_0x1f02('0x16a')]():'');var _0x2be586=this[_0x1f02('0x31')]['exec'](_0x1f02('0x16b'),[_0x222b77,_0x477346[_0x1f02('0xe0')],_0x477346[_0x1f02('0x60')],_0x53c515,_0x477346[_0x1f02('0x62')],_0x477346[_0x1f02('0x7')],_0x477346[_0x1f02('0x16c')],_0x477346[_0x1f02('0x16d')],'',_0x477346[_0x1f02('0x16e')]]);if(_0x2be586[_0x1f02('0x9e')]===-0x1){return _0x2be586;}return this['channel'][_0x1f02('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0x1f02('0x16b'),_0x222b77));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x16f')]=function(_0xd01a3d){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x170'),_0xd01a3d['label']));var _0x49d028=_0xd01a3d[_0x1f02('0x171')]||_0x1f02('0x125');var _0x46c396=util[_0x1f02('0x26')](_0x1f02('0x172'),this[_0x1f02('0x31')]['uniqueid'],rs['generate'](0x5));var _0x104f90=util[_0x1f02('0x26')](_0x1f02('0x173'),FILES_PATH,_0x46c396,_0x49d028);var _0x1c34ab=util[_0x1f02('0x26')]('%s/recordings/%s',FILES_PATH,_0x46c396);this[_0x1f02('0x35')][_0x1f02('0x6c')](this,_0xd01a3d,_0x46c396,_0x104f90);this[_0x1f02('0x31')]['setVariable'](_0x1f02('0x174'),_0x46c396);logger[_0x1f02('0x2b')](_0x1f02('0x175'),_0x1c34ab,_0x49d028,_0xd01a3d[_0x1f02('0x176')],_0xd01a3d[_0x1f02('0x62')]);return this['channel'][_0x1f02('0x131')](_0x1c34ab,_0x49d028,_0xd01a3d[_0x1f02('0x176')],_0xd01a3d[_0x1f02('0x62')],undefined,!![]);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x177')]=function(_0x47a4cb){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x178'),_0x47a4cb[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x47a4cb[_0x1f02('0x60')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20url\x20configured');}var _0x4675c3=this['restAPI']['sync'](this,_0x47a4cb);logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x179'),util[_0x1f02('0x17a')](_0x4675c3,{'showHidden':![],'depth':null})));if(!this[_0x1f02('0x7d')](_0x47a4cb[_0x1f02('0xd4')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x522d10=this[_0x1f02('0xe')]['sync'](this,_0x47a4cb[_0x1f02('0xd4')]);if(!_0x522d10){return this['channel']['error'](_0x47a4cb,'no\x20variable\x20found');}this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0x17b'),_0x522d10),_0x4675c3[_0x1f02('0x70')]?_0x4675c3['statusCode']:_0x1f02('0x17c'));this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0x17d'),_0x522d10),_0x4675c3['statusMessage']?_0x4675c3[_0x1f02('0x71')]:'OK');if(_0x4675c3[_0x1f02('0x65')]){try{this[_0x1f02('0x95')](_0x4675c3[_0x1f02('0x65')],_0x522d10);}catch(_0x44d180){logger[_0x1f02('0x29')](util[_0x1f02('0x26')](_0x1f02('0x17e'),_0x522d10));}}return this[_0x1f02('0x31')]['noop'](util['format']('variable\x20%s\x20set',_0x522d10));};AGIVertices['prototype']['saydigits']=function(_0x4489bc){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x17f'),_0x4489bc['label']));return this['channel'][_0x1f02('0x180')](_0x4489bc[_0x1f02('0x181')][_0x1f02('0xd1')](/\s+/g,''),_0x4489bc['escape_digits']);};AGIVertices[_0x1f02('0xd')]['saynumber']=function(_0xd945e3){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x182'),_0xd945e3[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0x183')](_0xd945e3[_0x1f02('0x63')][_0x1f02('0xd1')](/\s+/g,''),_0xd945e3['escape_digits']);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x184')]=function(_0x4f31f4){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4f31f4[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0x185')](_0x4f31f4[_0x1f02('0x57')],_0x4f31f4[_0x1f02('0x176')]);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x186')]=function(_0x487acd){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x487acd[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x487acd[_0x1f02('0x187')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20mail\x20account\x20configured');}var _0x59c067=this['getMailAccount'][_0x1f02('0x6c')](this,_0x487acd[_0x1f02('0x187')]);if(!_0x59c067||!_0x59c067[_0x1f02('0x188')]){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x487acd,_0x1f02('0x189'));}var _0x53dddd={'from':util[_0x1f02('0x26')](_0x1f02('0x18a'),_0x59c067[_0x1f02('0x11')],_0x59c067[_0x1f02('0x18b')]||_0x59c067[_0x1f02('0x188')][_0x1f02('0x18c')]),'to':_0x487acd['to']||'','cc':_0x487acd['cc']||'','bcc':_0x487acd[_0x1f02('0x18d')]||'','subject':_0x487acd[_0x1f02('0x18e')],'html':_0x487acd[_0x1f02('0x57')],'text':_0x487acd[_0x1f02('0x57')]};if(this['isConfigured'](_0x487acd['template_id'])){}logger[_0x1f02('0x18f')]('sendMail\x20message',JSON['stringify'](_0x53dddd));this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x487acd,_0x487acd[_0x1f02('0x187')]);this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x190'),_0x59c067[_0x1f02('0x11')]));this[_0x1f02('0x20')][_0x1f02('0x6c')](this,_0x59c067[_0x1f02('0x191')],_0x53dddd);return this['channel'][_0x1f02('0xa4')](_0x1f02('0x192'));};AGIVertices['prototype'][_0x1f02('0x193')]=function(_0x53f733){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x53f733[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x194'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x195')]=function(_0x31c49e){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x196'),_0x31c49e[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x31c49e['sms_account_id'])){return this['channel']['noop'](_0x1f02('0x197'));}var _0x2c2b75=this['getSmsAccount']['sync'](this,_0x31c49e[_0x1f02('0x198')]);if(!_0x2c2b75){return this[_0x1f02('0x31')]['error'](_0x31c49e,_0x1f02('0x199'));}var _0xb276e={'body':_0x31c49e[_0x1f02('0x19a')],'phone':_0x31c49e['to']||'','SmsAccountId':_0x2c2b75['id']};logger['debug'](_0x1f02('0x19b'),JSON[_0x1f02('0x6e')](_0xb276e));this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x31c49e,_0x31c49e[_0x1f02('0x198')]);this[_0x1f02('0x31')]['noop'](util['format'](_0x1f02('0x19c'),_0x2c2b75[_0x1f02('0x11')]));this[_0x1f02('0x2f')][_0x1f02('0x6c')](this,_0xb276e);return this['channel'][_0x1f02('0xa4')](_0x1f02('0x19d'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x19e')]=function(_0x411f05){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x411f05[_0x1f02('0x33')]));if(!this['isConfigured'](_0x411f05[_0x1f02('0xd4')])){return this['channel'][_0x1f02('0x29')](_0x411f05,_0x1f02('0x19f'));}var _0x385d3c=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x411f05[_0x1f02('0xd4')]);if(!_0x385d3c){return this['channel']['error'](_0x411f05,_0x1f02('0xd5'));}return this['channel'][_0x1f02('0x97')](_0x385d3c,_0x411f05[_0x1f02('0x1a0')]);};AGIVertices[_0x1f02('0xd')]['start']=function(_0x46d4dc){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1a1'),_0x46d4dc['label']));this[_0x1f02('0x31')][_0x1f02('0xa4')]('START\x20CALLY\x20SQUARE');var _0x14cd84=this['channel'][_0x1f02('0xe')](_0x1f02('0x1a2'));if(!_[_0x1f02('0x40')](_0x14cd84[_0x1f02('0xa0')])){this['channel'][_0x1f02('0x32')]=_0x14cd84[_0x1f02('0xa0')];}if(_0x46d4dc[_0x1f02('0xb0')]===_0x1f02('0x1a3')){this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x1a4'));return this[_0x1f02('0x31')][_0x1f02('0xb0')]();}return this['channel'][_0x1f02('0xa4')](_0x1f02('0x1a5'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1a6')]=function(_0x299ac1){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x1a7'),_0x299ac1[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x299ac1[_0x1f02('0x1a8')])){return this['channel'][_0x1f02('0x29')](_0x299ac1,'no\x20subproject\x20selected');}var _0xb854e6=this[_0x1f02('0x15')][_0x1f02('0x6c')](this,_0x299ac1[_0x1f02('0x1a8')]);if(!this[_0x1f02('0x7d')](_0xb854e6)){return this['channel'][_0x1f02('0x29')](_0x299ac1,util[_0x1f02('0x26')](_0x1f02('0x1a9'),_0x299ac1[_0x1f02('0x1a8')]));}if(_0xb854e6===this['channel'][_0x1f02('0x1aa')]){return this[_0x1f02('0x31')]['error'](_0x299ac1,_0x1f02('0x1ab'));}this['createSquareDetailsReport'][_0x1f02('0x6c')](this,_0x299ac1,_0xb854e6);var _0x3ec105=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0x1ac'),util['format'](_0x1f02('0x1ad'),config[_0x1f02('0x7')][_0x1f02('0x1ae')]||_0x1f02('0x1af'),_0xb854e6,this[_0x1f02('0x31')]['arg_1']));if(_0x3ec105['result']===-0x1){return _0x3ec105;}return this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0xbb'),_0x1f02('0x1ac'),_0xb854e6));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1b0')]=function(_0x548b28){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x1b1'),_0x548b28[_0x1f02('0x33')]));var _0x4379d3=this[_0x1f02('0x1b2')][_0x1f02('0x6c')](this,_0x548b28[_0x1f02('0xae')]);this['createSquareDetailsReport'][_0x1f02('0x6c')](this,_0x548b28,_0x548b28[_0x1f02('0xae')]);if(this[_0x1f02('0x7d')](_0x548b28[_0x1f02('0xd4')])){var _0x15117a=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x548b28[_0x1f02('0xd4')]);if(_0x15117a){this['channel'][_0x1f02('0x97')](_0x15117a,_0x4379d3);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x548b28[_0x1f02('0xae')],_0x15117a));}}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x1b3'),_0x548b28[_0x1f02('0xae')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x21a2e1){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x1b4'),_0x21a2e1[_0x1f02('0x33')]));_0x21a2e1['text']=_0x21a2e1[_0x1f02('0x57')][_0x1f02('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1f02('0x7d')](_0x21a2e1[_0x1f02('0x55')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x1b5'));}if(!this[_0x1f02('0x7d')](_0x21a2e1['text'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0x1b6'),_0x21a2e1[_0x1f02('0x57')]));var _0x5846f7=this[_0x1f02('0x54')]['sync'](this,_0x21a2e1);if(_0x5846f7){this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5846f7));var _0x3f8295=this[_0x1f02('0x31')]['streamFile'](_0x5846f7);try{fs[_0x1f02('0xfb')](_0x5846f7+_0x1f02('0xfc'));}catch(_0x34ccc3){logger[_0x1f02('0x29')](_0x34ccc3);}return _0x3f8295;}return this['channel']['error'](_0x21a2e1,_0x1f02('0x1b7'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1b8')]=function(_0x4c6dda){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1b9'),_0x4c6dda[_0x1f02('0x33')]));_0x4c6dda['text']=_0x4c6dda['text'][_0x1f02('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4c6dda[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x1ba'),_0x4c6dda[_0x1f02('0x57')]));var _0x37a92b=this[_0x1f02('0x5d')][_0x1f02('0x6c')](this,_0x4c6dda);if(_0x37a92b){this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0x1bb'),_0x37a92b));var _0x318c58=this['channel'][_0x1f02('0x11c')](_0x37a92b);try{fs['unlink'](_0x37a92b+_0x1f02('0xfc'));}catch(_0x5d6c61){logger[_0x1f02('0x29')](_0x5d6c61);}return _0x318c58;}return this[_0x1f02('0x31')]['error'](_0x4c6dda,_0x1f02('0x1bc'));};AGIVertices['prototype']['unpause']=function(_0x41486a){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1bd'),_0x41486a[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x41486a[_0x1f02('0x14d')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x41486a,_0x1f02('0x152'));}logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x14e'),this['channel'][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));var _0x41ad3b=this[_0x1f02('0x4c')]['sync'](this,_0x41486a[_0x1f02('0x14d')]);if(_0x41ad3b){logger['info'](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x14f')};}else{logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x150'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));this[_0x1f02('0x31')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x154')};}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1be')]=function(_0x26532e){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1bf'),_0x26532e[_0x1f02('0x33')]));var _0x1808d6=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0x1c0'),[_0x26532e[_0x1f02('0x1c1')],_0x26532e['options']]);if(_0x1808d6['result']===-0x1){return _0x1808d6;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xbb'),_0x1f02('0x1c0'),_0x26532e[_0x1f02('0x1c1')]));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1c2')]=function(_0x56016f){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1c3'),_0x56016f[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x56016f['variable_id'])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x56016f,_0x1f02('0x19f'));}var _0x12ccdb=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x56016f[_0x1f02('0xd4')]);if(!_0x12ccdb){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x56016f,_0x1f02('0xd5'));}var _0x3ef629=this[_0x1f02('0x31')][_0x1f02('0xe')](_0x12ccdb);return{'code':0xc8,'result':_0x3ef629[_0x1f02('0xa0')]?_0x3ef629['extra']:'-'};};String[_0x1f02('0xd')][_0x1f02('0x9b')]=function(_0x2d9bf1,_0x1dddd3){return this[_0x1f02('0x99')](_0x2d9bf1)['join'](_0x1dddd3);};module[_0x1f02('0x1c4')]=AGIVertices; \ No newline at end of file +var _0x202c=['agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','scheduledAt','delay','add','minutes','callback_priority','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','getUser','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','test','mindigit','maxdigit','no\x20variable\x20found','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','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','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','%s/recordings/%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','PLAYBACK','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getTrunkById','getSound','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','toString','getPauseById','agentPause','agent','agentUnpause'];(function(_0x1f5ee3,_0x42d31b){var _0x2db824=function(_0xa3030b){while(--_0xa3030b){_0x1f5ee3['push'](_0x1f5ee3['shift']());}};_0x2db824(++_0x42d31b);}(_0x202c,0x178));var _0xc202=function(_0x50ade0,_0x27b006){_0x50ade0=_0x50ade0-0x0;var _0x28472e=_0x202c[_0x50ade0];return _0x28472e;};'use strict';var fs=require('fs');var util=require(_0xc202('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xc202('0x1'))();var rs=require(_0xc202('0x2'));var moment=require(_0xc202('0x3'));var Mustache=require('mustache');var rp=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xc202('0x8');var recursiveMapAttributes=[_0xc202('0x9'),'rawBody'];var verticesWithRetry=[_0xc202('0xa'),'getdigits',_0xc202('0xb')];var AGIVertices=function(_0x5978fe,_0x176cb7,_0x336fc8){this[_0xc202('0xc')]=_0x5978fe;this[_0xc202('0xd')]=_0x176cb7;this[_0xc202('0xe')]=_0x336fc8;};AGIVertices[_0xc202('0xf')][_0xc202('0x10')]=function(_0x1991a3,_0x630e57){this[_0xc202('0xd')][_0xc202('0x11')](_0x1991a3)['then'](function(_0x1523d4){_0x630e57(null,_0x1523d4?_0x1523d4[_0xc202('0x12')]:![]);})[_0xc202('0x13')](function(_0xbf3618){_0x630e57(_0xbf3618);});};AGIVertices[_0xc202('0xf')][_0xc202('0x14')]=function(_0x2c8128,_0x53600c){this[_0xc202('0xd')][_0xc202('0x15')](_0x2c8128)['then'](function(_0x4f0d94){_0x53600c(null,_0x4f0d94?_0x4f0d94['name']:![]);})[_0xc202('0x13')](function(_0x4a333c){_0x53600c(_0x4a333c);});};AGIVertices[_0xc202('0xf')]['getSquareProject']=function(_0x19af73,_0x1d580c){this[_0xc202('0xd')][_0xc202('0x16')](_0x19af73)[_0xc202('0x17')](function(_0x2419c5){_0x1d580c(null,_0x2419c5?_0x2419c5[_0xc202('0x12')]:![]);})['catch'](function(_0x16ec7c){_0x1d580c(_0x16ec7c);});};AGIVertices[_0xc202('0xf')][_0xc202('0x18')]=function(_0x5b2487,_0x504d94){this[_0xc202('0xd')][_0xc202('0x19')](_0x5b2487)[_0xc202('0x17')](function(_0x415b03){_0x504d94(null,_0x415b03?_0x415b03[_0xc202('0x1a')]:![]);})['catch'](function(_0x50a32f){_0x504d94(_0x50a32f);});};AGIVertices[_0xc202('0xf')]['getUser']=function(_0x3058d3,_0x372b31){this['rpc']['getUserById'](_0x3058d3)[_0xc202('0x17')](function(_0x582678){_0x372b31(null,_0x582678?_0x582678[_0xc202('0x12')]:![]);})[_0xc202('0x13')](function(_0x27f4cb){_0x372b31(_0x27f4cb);});};AGIVertices[_0xc202('0xf')][_0xc202('0x1b')]=function(_0x497a08,_0x59f84d){this[_0xc202('0xd')][_0xc202('0x1c')](_0x497a08)[_0xc202('0x17')](function(_0x4ff3e3){_0x59f84d(null,_0x4ff3e3?_0x4ff3e3[_0xc202('0x12')]:![]);})[_0xc202('0x13')](function(_0x541efc){_0x59f84d(_0x541efc);});};AGIVertices['prototype'][_0xc202('0x1d')]=function(_0x2f8011,_0xd88a43){var _0x6b291c=this;this[_0xc202('0xd')]['getSoundById'](_0x2f8011)[_0xc202('0x17')](function(_0x32f56c){_0xd88a43(null,_0x32f56c?_0x6b291c['getSoundPath'](_0x32f56c['save_name']):![]);})[_0xc202('0x13')](function(_0x278ef5){_0xd88a43(_0x278ef5);});};AGIVertices[_0xc202('0xf')][_0xc202('0x1e')]=function(_0x5c5423,_0x1f09cf){this[_0xc202('0xd')][_0xc202('0x1f')](_0x5c5423)['then'](function(_0x77f95a){_0x1f09cf(null,_0x77f95a?_0x77f95a:![]);})[_0xc202('0x13')](function(_0xf1fe4c){_0x1f09cf(_0xf1fe4c);});};AGIVertices[_0xc202('0xf')][_0xc202('0x20')]=function(_0x196394,_0x319945,_0x358b35){this[_0xc202('0xe')][_0xc202('0x20')](_0x196394,_0x319945)[_0xc202('0x17')](function(){_0x358b35(null);})[_0xc202('0x13')](function(_0x50c547){_0x358b35(_0x50c547);});};AGIVertices[_0xc202('0xf')][_0xc202('0x21')]=function(_0x12e11a,_0x5a59a4){this[_0xc202('0xd')]['getIntervalById'](_0x12e11a)[_0xc202('0x17')](function(_0x40a32a){if(_0x40a32a){if(_0x40a32a[_0xc202('0x22')]){_0x5a59a4(null,[_0x40a32a[_0xc202('0x23')]]);}else{_0x5a59a4(null,_[_0xc202('0x24')](_0x40a32a[_0xc202('0x25')],'interval'));}}else{_0x5a59a4(null,![]);}})[_0xc202('0x13')](function(_0x5087e3){_0x5a59a4(_0x5087e3);});};AGIVertices[_0xc202('0xf')]['getSoundPath']=function(_0x244489){return util[_0xc202('0x26')](_0xc202('0x27'),FILES_PATH,_0x244489);};AGIVertices['prototype'][_0xc202('0x28')]=function(_0x44ce00,_0x327278,_0x444a8d){odbc[_0xc202('0x29')](_0x44ce00,function(_0x2afa4e){if(_0x2afa4e){logger['error'](_0xc202('0x2a'),_0x2afa4e);_0x444a8d(_0x2afa4e);}else{logger[_0xc202('0x2b')](_0xc202('0x2c'));odbc['query'](_0x327278,function(_0x41e42b,_0x1741b7){if(_0x41e42b){logger[_0xc202('0x2b')](_0xc202('0x2d'),_0x327278);_0x444a8d(_0x41e42b);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x327278);odbc[_0xc202('0x2e')](function(_0x4caf1b){if(_0x4caf1b){logger[_0xc202('0x2f')](_0xc202('0x30'),_0x4caf1b);}_0x444a8d(null,_0x1741b7);});}});}});};AGIVertices[_0xc202('0xf')][_0xc202('0x31')]=function(_0x9dbdb,_0x126c62){this['rpc'][_0xc202('0x32')](_0x9dbdb)[_0xc202('0x17')](function(_0x3dc7c6){_0x126c62(null,_0x3dc7c6?_0x3dc7c6:![]);})[_0xc202('0x13')](function(_0x1d8a06){_0x126c62(_0x1d8a06);});};AGIVertices['prototype'][_0xc202('0x33')]=function(_0x40830d,_0x3afcbf){this[_0xc202('0xd')][_0xc202('0x33')](_0x40830d)['then'](function(_0x25d75f){_0x3afcbf(null,_0x25d75f);})['catch'](function(_0x477378){_0x3afcbf(_0x477378);});};AGIVertices['prototype'][_0xc202('0x34')]=function(_0x4393f3,_0x138a43,_0xaefd1a){this['rpc'][_0xc202('0x34')]({'uniqueid':this[_0xc202('0xc')][_0xc202('0x35')],'node':_0x4393f3[_0xc202('0x36')],'application':_0x4393f3[_0xc202('0x37')],'data':_0x138a43||null,'project_name':this[_0xc202('0xc')][_0xc202('0x38')],'callerid':this[_0xc202('0xc')][_0xc202('0x39')]})[_0xc202('0x17')](function(_0x263c95){if(_0xaefd1a){_0xaefd1a(null,_0x263c95);}})[_0xc202('0x13')](function(_0x157c2e){if(_0xaefd1a){_0xaefd1a(_0x157c2e);}});};AGIVertices[_0xc202('0xf')][_0xc202('0x3a')]=function(_0x461e2b,_0x19ba25,_0x2ab47f,_0x9f8ab3){this[_0xc202('0xd')]['createSquareRecording']({'uniqueid':this[_0xc202('0xc')][_0xc202('0x35')],'callerid':this[_0xc202('0xc')]['callerid'],'calleridname':this['channel']['calleridname'],'context':this[_0xc202('0xc')][_0xc202('0x3b')],'extension':this[_0xc202('0xc')][_0xc202('0x3c')],'priority':this[_0xc202('0xc')][_0xc202('0x3d')],'accountcode':this[_0xc202('0xc')][_0xc202('0x3e')],'dnid':this[_0xc202('0xc')][_0xc202('0x3f')],'projectName':this[_0xc202('0xc')][_0xc202('0x38')],'saveName':_0x19ba25,'filename':_0x461e2b[_0xc202('0x40')]||_0x19ba25,'savePath':_0x2ab47f})['then'](function(_0x33e70c){_0x9f8ab3(null,_0x33e70c);})[_0xc202('0x13')](function(_0x57855e){_0x9f8ab3(_0x57855e);});};AGIVertices[_0xc202('0xf')][_0xc202('0x41')]=function(_0x2864b6,_0x28f89f,_0x40f858,_0x5f5a19,_0x2250a6){this['rpc'][_0xc202('0x41')]({'uniqueid':this['channel'][_0xc202('0x35')],'body':_0x2864b6,'direction':_0x28f89f,'providerName':_0x40f858,'providerResponse':_0x5f5a19})[_0xc202('0x17')](function(_0x59cdec){if(_0x2250a6){_0x2250a6(null,_0x59cdec);}})[_0xc202('0x13')](function(_0x239cd){if(_0x2250a6){_0x2250a6(_0x239cd);}});};AGIVertices['prototype']['createCmContact']=function(_0x584b46,_0x2f063b){this['rpc'][_0xc202('0x42')]({'firstName':_[_0xc202('0x43')](_0x584b46[_0xc202('0x12')])||_[_0xc202('0x44')](_0x584b46[_0xc202('0x12')])?_0xc202('0x45')+Math[_0xc202('0x46')]():_0x584b46[_0xc202('0x12')],'lastName':_[_0xc202('0x43')](_0x584b46[_0xc202('0x47')])||_[_0xc202('0x44')](_0x584b46[_0xc202('0x47')])?null:_0x584b46[_0xc202('0x47')],'phone':_0x584b46['phone'],'ListId':_0x584b46[_0xc202('0x48')],'scheduledat':_0x584b46['scheduledAt'],'callbackUniqueid':this['channel'][_0xc202('0x35')],'tags':_0xc202('0x49'),'description':_0xc202('0x4a')+_0x584b46['scheduledAt'][_0xc202('0x4b')](),'priority':_0x584b46['callback_priority']})[_0xc202('0x17')](function(_0x19fd03){_0x2f063b(null,_0x19fd03);})['catch'](function(_0x2af59e){_0x2f063b(_0x2af59e);});};AGIVertices[_0xc202('0xf')]['getPause']=function(_0x2e1c26,_0x499e75){this[_0xc202('0xd')][_0xc202('0x4c')](_0x2e1c26)[_0xc202('0x17')](function(_0x1a06c5){_0x499e75(null,_0x1a06c5?_0x1a06c5[_0xc202('0x12')]:![]);})[_0xc202('0x13')](function(_0x15aa63){_0x499e75(_0x15aa63);});};AGIVertices['prototype'][_0xc202('0x4d')]=function(_0x3beb0a,_0x4e2e04,_0x2b3238){var _0x4860cf={'role':_0xc202('0x4e')};_0x4860cf[_0x3beb0a]=this['channel'][_0xc202('0x39')];this['rpc'][_0xc202('0x4d')](_0x4860cf,_0x4e2e04,this['channel']['uniqueid'])[_0xc202('0x17')](function(_0x1dc674){_0x2b3238(null,_[_0xc202('0x44')](_0x1dc674)?![]:!![]);})[_0xc202('0x13')](function(_0x2136c6){logger[_0xc202('0x2f')](_0x2136c6);_0x2b3238(null,![]);});};AGIVertices[_0xc202('0xf')][_0xc202('0x4f')]=function(_0x409845,_0x135797){var _0x4d9271={'role':_0xc202('0x4e')};_0x4d9271[_0x409845]=this[_0xc202('0xc')]['callerid'];this[_0xc202('0xd')][_0xc202('0x4f')](_0x4d9271)[_0xc202('0x17')](function(_0x3da9cc){_0x135797(null,_[_0xc202('0x44')](_0x3da9cc)?![]:!![]);})[_0xc202('0x13')](function(_0x18da36){logger[_0xc202('0x2f')](_0x18da36);_0x135797(null,![]);});};AGIVertices['prototype'][_0xc202('0x50')]=function(_0xde8b39,_0xb80bd){var _0x3095d2={'role':_0xc202('0x4e')};_0x3095d2[_0xde8b39]=this['channel'][_0xc202('0x39')];this[_0xc202('0xd')][_0xc202('0x50')](_0x3095d2)['then'](function(_0x7f638c){_0xb80bd(null,_['isNil'](_0x7f638c)?![]:!![]);})['catch'](function(_0x529f70){logger[_0xc202('0x2f')](_0x529f70);_0xb80bd(null,![]);});};AGIVertices[_0xc202('0xf')][_0xc202('0x51')]=function(_0xe05654,_0x5accab){var _0x33b027={'role':'agent'};_0x33b027[_0xe05654]=this[_0xc202('0xc')][_0xc202('0x39')];var _0x5bb7f8=_0xe05654!=_0xc202('0x52')?util[_0xc202('0x26')](_0xc202('0x53'),'LOCAL',this['channel']['callerid']):undefined;this[_0xc202('0xd')][_0xc202('0x51')](_0x33b027,_0x5bb7f8)['then'](function(_0x44d834){_0x5accab(null,_[_0xc202('0x44')](_0x44d834)?![]:!![]);})['catch'](function(_0x41011b){logger['error'](_0x41011b);_0x5accab(null,![]);});};AGIVertices[_0xc202('0xf')][_0xc202('0x54')]=function(_0x3ec443,_0x436c8e){sh[_0xc202('0x55')](_['trim'](_0x3ec443),function(_0x57a07f,_0x18ba97){var _0xb37022=_0x18ba97[_0xc202('0x56')](/(\r\n|\n|\r)/gm,'');_0x436c8e(null,_0xb37022);});};AGIVertices[_0xc202('0xf')][_0xc202('0x57')]=function(_0x5306a2,_0x4bb9ae){scripts[_0xc202('0x57')](_0x5306a2[_0xc202('0x58')],_0x5306a2[_0xc202('0x59')]||_0xc202('0x5a'),_0x5306a2[_0xc202('0x5a')],_0x5306a2[_0xc202('0x5b')]||'en-US',_0x5306a2['ssmlGender']||_0xc202('0x5c'),_0x5306a2[_0xc202('0x5d')]||_0xc202('0x5e'))['then'](function(_0x305a71){_0x4bb9ae(null,_0x305a71);})[_0xc202('0x13')](function(_0x4e8e14){_0x4bb9ae(_0x4e8e14);});};AGIVertices[_0xc202('0xf')][_0xc202('0x5f')]=function(_0x52e4b3,_0x2810a7){scripts[_0xc202('0x5f')](_0x52e4b3[_0xc202('0x5a')],_0x52e4b3[_0xc202('0x60')]||'en',0x1)[_0xc202('0x17')](function(_0x4fe933){_0x2810a7(null,_0x4fe933);})[_0xc202('0x13')](function(_0x5206f7){_0x2810a7(_0x5206f7);});};AGIVertices[_0xc202('0xf')][_0xc202('0x61')]=function(_0x585984,_0x2d149a){var _0x5b8a32={'uri':_0x585984[_0xc202('0x62')],'method':_0x585984[_0xc202('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x585984[_0xc202('0x64')])===_0xc202('0x65')&&parseInt(_0x585984['timeout'])>=0x1?parseInt(_0x585984[_0xc202('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xc202('0x66')]([_0xc202('0x67'),_0xc202('0x68')],_0x5b8a32[_0xc202('0x63')][_0xc202('0x69')]())){try{_0x5b8a32['body']=_0x585984[_0xc202('0x6a')]?JSON[_0xc202('0x6b')](_0x585984['rawBody']):{};}catch(_0x1f7734){logger[_0xc202('0x2f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1f7734);}}try{_0x5b8a32['headers']=_0x585984['rawHeaders']?JSON[_0xc202('0x6b')](_0x585984[_0xc202('0x9')]):{};}catch(_0x29278d){logger['error'](_0xc202('0x6c'),_0x29278d);}if(_0x585984[_0xc202('0x6d')]){try{var _0x570e36=require(_0x585984[_0xc202('0x6d')])[_0xc202('0x6e')](this,_0x5b8a32);_0x5b8a32['uri']=Mustache[_0xc202('0x6f')](_0x585984[_0xc202('0x62')],_0x570e36,{},['$$','$$']);if(_0x5b8a32[_0xc202('0x70')]){_0x5b8a32[_0xc202('0x70')]=JSON[_0xc202('0x6b')](Mustache[_0xc202('0x6f')](JSON[_0xc202('0x71')](_0x5b8a32[_0xc202('0x70')]),_0x570e36,{},['$$','$$']));}if(_0x5b8a32[_0xc202('0x72')]){_0x5b8a32[_0xc202('0x72')]=JSON[_0xc202('0x6b')](Mustache['render'](JSON[_0xc202('0x71')](_0x5b8a32[_0xc202('0x72')]),_0x570e36,{},['$$','$$']));}}catch(_0x48a098){logger[_0xc202('0x2f')](_0xc202('0x73'),_0x48a098);}}rp(_0x5b8a32)[_0xc202('0x17')](function(_0x2cf53b){var _0x3021fe={'statusCode':_0x2cf53b['statusCode']||0xc8,'statusMessage':_0x2cf53b[_0xc202('0x74')]||'OK','headers':_0x2cf53b['headers']||{},'body':_0x2cf53b[_0xc202('0x72')]||{}};_0x2d149a(null,_0x3021fe);})[_0xc202('0x13')](function(_0xc4a2df){var _0x541c76={'statusCode':_0xc4a2df['statusCode']||0x1f4,'statusMessage':_0xc4a2df[_0xc202('0x75')]||_0xc202('0x76'),'headers':_0xc4a2df[_0xc202('0x77')][_0xc202('0x70')]||{},'body':_0xc4a2df[_0xc202('0x77')][_0xc202('0x72')]||{}};_0x2d149a(null,_0x541c76);});};AGIVertices[_0xc202('0xf')][_0xc202('0x78')]=function(_0x80109,_0x1bf8b8){scripts[_0xc202('0x78')](this['channel']['uniqueid'],_0x80109[_0xc202('0x79')],_0x80109[_0xc202('0x5a')],_0x80109[_0xc202('0x7a')]||'en')[_0xc202('0x17')](function(_0x5e6e13){_0x1bf8b8(null,_0x5e6e13);})[_0xc202('0x13')](function(_0x48e6d2){_0x1bf8b8(_0x48e6d2);});};AGIVertices['prototype'][_0xc202('0x7b')]=function(_0x151976,_0x53e43a){scripts['googleDialogflowV2'](this['channel'][_0xc202('0x35')],_0x151976[_0xc202('0x7c')],_0x151976['client_email'],_0x151976[_0xc202('0x7d')],_0x151976[_0xc202('0x5a')],_0x151976[_0xc202('0x7e')]||'en')[_0xc202('0x17')](function(_0x49586b){_0x53e43a(null,_0x49586b);})[_0xc202('0x13')](function(_0x34136c){_0x53e43a(_0x34136c);});};AGIVertices[_0xc202('0xf')][_0xc202('0x7f')]=function(_0x57eb77,_0x2576e6){scripts['sestekNDA'](this['channel'],_0x57eb77)[_0xc202('0x17')](function(_0x2cfad2){_0x2576e6(null,_0x2cfad2);})[_0xc202('0x13')](function(_0x2215e4){_0x2576e6(_0x2215e4);});};AGIVertices[_0xc202('0xf')]['ispeechTTS']=function(_0x445835,_0x2d4335){scripts[_0xc202('0x80')](_0x445835['key'],_0x445835[_0xc202('0x5a')],_0x445835[_0xc202('0x81')]||_0xc202('0x82'),_0x445835['speed'])[_0xc202('0x17')](function(_0xf0b2a6){_0x2d4335(null,_0xf0b2a6);})[_0xc202('0x13')](function(_0x27fdb4){_0x2d4335(_0x27fdb4);});};AGIVertices['prototype'][_0xc202('0x83')]=function(_0x2febbe,_0x2ea4a4,_0x1ff46e){scripts['ispeechASR'](_0x2ea4a4,_0x2febbe[_0xc202('0x79')],_0x2febbe['ispeech_asr_language']||_0xc202('0x82'),this[_0xc202('0x84')](_0x2febbe[_0xc202('0x85')])?_0x2febbe['model']:undefined)[_0xc202('0x17')](function(_0xc3e1f6){_0x1ff46e(null,_0xc3e1f6);})[_0xc202('0x13')](function(_0x1f3700){_0x1ff46e(_0x1f3700);});};AGIVertices[_0xc202('0xf')][_0xc202('0x86')]=function(_0x252fd1,_0x53b135){scripts[_0xc202('0x86')](_0x252fd1[_0xc202('0x87')],_0x252fd1['aws_secret_access_key'],_0x252fd1[_0xc202('0x88')],_0x252fd1[_0xc202('0x89')]||_0xc202('0x8a'),_0x252fd1['text'],_0x252fd1[_0xc202('0x8b')]||_0xc202('0x5a'))['then'](function(_0x4a54be){_0x53b135(null,_0x4a54be);})[_0xc202('0x13')](function(_0xf3eda3){_0x53b135(_0xf3eda3);});};AGIVertices[_0xc202('0xf')][_0xc202('0x8c')]=function(_0xf2094a,_0x5d6e3a){scripts[_0xc202('0x8c')](this[_0xc202('0xc')][_0xc202('0x35')],_0xf2094a[_0xc202('0x87')],_0xf2094a[_0xc202('0x8d')],_0xf2094a[_0xc202('0x8e')],_0xf2094a['text'],_0xf2094a['aws_bot_name'])['then'](function(_0x3d7589){_0x5d6e3a(null,_0x3d7589);})[_0xc202('0x13')](function(_0x3c0488){_0x5d6e3a(_0x3c0488);});};AGIVertices[_0xc202('0xf')]['googleASR']=function(_0x4d49f1,_0x256ba7,_0x2fedab){scripts[_0xc202('0x8f')](_0x256ba7,_0x4d49f1[_0xc202('0x79')],_0x4d49f1[_0xc202('0x90')]||_0xc202('0x82'))[_0xc202('0x17')](function(_0x1633dc){_0x2fedab(null,_0x1633dc);})[_0xc202('0x13')](function(_0x449951){_0x2fedab(_0x449951);});};AGIVertices[_0xc202('0xf')][_0xc202('0x91')]=function(_0x3da638,_0x362376,_0x1f6d34){scripts[_0xc202('0x91')](_0x362376,_0x3da638[_0xc202('0x92')],_0x3da638[_0xc202('0x93')],_0x3da638[_0xc202('0x94')])[_0xc202('0x17')](function(_0x49b1ff){_0x1f6d34(null,_0x49b1ff);})[_0xc202('0x13')](function(_0x5e2627){_0x1f6d34(_0x5e2627);});};AGIVertices['prototype'][_0xc202('0x95')]=function(_0x5c22e9){var _0x50b3a6=_[_0xc202('0x66')](verticesWithRetry,_0x5c22e9[_0xc202('0x37')])?_0x5c22e9:_[_0xc202('0x96')](_0x5c22e9);for(var _0x3bbbde in _0x50b3a6){if(_0x50b3a6['hasOwnProperty'](_0x3bbbde)){if(_0x50b3a6[_0x3bbbde]&&_[_0xc202('0x97')](_0x50b3a6[_0x3bbbde])){if(_[_0xc202('0x66')](recursiveMapAttributes,_0x3bbbde)){_0x50b3a6[_0x3bbbde]=this[_0xc202('0x98')](_0x50b3a6[_0x3bbbde]);}else{_0x50b3a6[_0x3bbbde]=this[_0xc202('0x99')](_0x50b3a6[_0x3bbbde]);}}}}return _0x50b3a6;};AGIVertices[_0xc202('0xf')]['recursiveNodeIndex']=function(_0x232839){for(var _0x59bb81 in _0x232839){if(_0x232839[_0xc202('0x9a')](_0x59bb81)){if(_[_0xc202('0x9b')](_0x232839[_0x59bb81])){this[_0xc202('0x9c')](_0x232839[_0x59bb81]);}else if(_['isArray'](_0x232839[_0x59bb81])){for(var _0x4cf0fe=0x0;_0x4cf0fe<_0x232839[_0x59bb81][_0xc202('0x9d')];_0x4cf0fe++){this[_0xc202('0x9c')](_0x232839[_0x59bb81][_0x4cf0fe]);}}else if(_[_0xc202('0x97')](_0x232839[_0x59bb81])){_0x232839[_0x59bb81]=this[_0xc202('0x99')](_0x232839[_0x59bb81]);}}}};AGIVertices['prototype'][_0xc202('0x9e')]=function(_0x23e3f0,_0x593018){for(var _0x42996b in _0x23e3f0){if(_0x23e3f0[_0xc202('0x9a')](_0x42996b)){if(_[_0xc202('0x9b')](_0x23e3f0[_0x42996b])){if(!_[_0xc202('0x43')](_0x23e3f0[_0x42996b])){this[_0xc202('0x9e')](_0x23e3f0[_0x42996b],util[_0xc202('0x26')](_0xc202('0x9f'),_0x593018,_0x42996b));}}else if(_['isArray'](_0x23e3f0[_0x42996b])){for(var _0x3f388f=0x0;_0x3f388f<_0x23e3f0[_0x42996b][_0xc202('0x9d')];_0x3f388f++){this[_0xc202('0x9e')](_0x23e3f0[_0x42996b][_0x3f388f],util[_0xc202('0x26')](_0xc202('0x9f'),_0x593018,_0x42996b+'['+_0x3f388f+']'));}}else{if(!_[_0xc202('0x44')](_0x23e3f0[_0x42996b])){this['channel'][_0xc202('0xa0')](util['format']('%s.%s',_0x593018,_0x42996b),_0x23e3f0[_0x42996b]);}}}}};AGIVertices[_0xc202('0xf')]['replaceObjectAllVariables']=function(_0x41fc1b){try{var _0x11a5b9=JSON[_0xc202('0x6b')](_0x41fc1b);this[_0xc202('0x9c')](_0x11a5b9);return JSON[_0xc202('0x71')](_0x11a5b9);}catch(_0x17c92f){return this[_0xc202('0x99')](_0x41fc1b);}};AGIVertices[_0xc202('0xf')][_0xc202('0x99')]=function(_0x2a316d){var _0x1821f4=_0x2a316d['split']('{');for(var _0x75d217=0x1;_0x75d217<_0x1821f4[_0xc202('0x9d')];_0x75d217+=0x1){var _0x1aa90a=_0x1821f4[_0x75d217][_0xc202('0xa1')]('}');if(_0x1aa90a['length']>0x1){_0x2a316d=_0x2a316d[_0xc202('0xa2')]('{'+_0x1aa90a[0x0]+'}',this[_0xc202('0xc')]['getVariable'](_0x1aa90a[0x0])[_0xc202('0xa3')]||_0x1aa90a[0x0]);}}if(_0x1821f4[_0xc202('0x9d')]===0x1){return _0x2a316d[_0xc202('0x4b')]();}return this['replaceAllVariables'](_0x2a316d);};AGIVertices[_0xc202('0xf')][_0xc202('0xa4')]=function(_0x376430,_0x4a96b2){var _0x21b73b=this[_0xc202('0xc')]['getVariable'](_0x376430);if(_0x21b73b[_0xc202('0xa5')]===-0x1){return _0x21b73b;}logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0xa6'),_0x4a96b2,_0x21b73b[_0xc202('0xa3')]));return this[_0xc202('0xc')][_0xc202('0xa0')](_0x4a96b2,_0x21b73b['extra']);};AGIVertices[_0xc202('0xf')][_0xc202('0x84')]=function(_0xe9e152){return _0xe9e152&&_0xe9e152!=='0'&&_0xe9e152!=='-1'&&_0xe9e152!=='';};AGIVertices['prototype'][_0xc202('0xa7')]=function(_0x23c6e2){this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x23c6e2,'-');_0x23c6e2['retry']=_0x23c6e2['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xc202('0xa8')]=function(_0xa3293c){logger[_0xc202('0x2b')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xa3293c['label']));if(!this['isConfigured'](_0xa3293c[_0xc202('0x5a')])){return this[_0xc202('0xc')]['noop']('no\x20text\x20configured');}var _0x368594='\x22'+_0xa3293c[_0xc202('0x5a')]+'\x22';if(this[_0xc202('0x84')](_0xa3293c[_0xc202('0x77')])){_0x368594+=','+_0xa3293c[_0xc202('0x77')];}var _0xa58f72=this[_0xc202('0xc')]['exec'](_0xc202('0xa9'),_0x368594);if(_0xa58f72[_0xc202('0xa5')]===-0x1){return _0xa58f72;}return this[_0xc202('0xc')]['noop'](util[_0xc202('0x26')](_0xc202('0xaa'),_0x368594));};AGIVertices[_0xc202('0xf')][_0xc202('0xab')]=function(_0x5281d0){logger[_0xc202('0x2b')](util['format'](_0xc202('0xac'),_0x5281d0['label']));if(!this[_0xc202('0x84')](_0x5281d0['grammar'])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xae'));}var _0xcbbc03=_0x5281d0[_0xc202('0xaf')];if(this['isConfigured'](_0x5281d0[_0xc202('0x77')])){_0xcbbc03+=','+_0x5281d0[_0xc202('0x77')];}var _0x19f464=this['channel'][_0xc202('0x55')](_0xc202('0xb0'),_0xcbbc03);if(_0x19f464[_0xc202('0xa5')]===-0x1){return _0x19f464;}var _0x1a217c=this['getAndSetVariable'](_0xc202('0xb1'),_0xc202('0xb2'));if(_0x1a217c[_0xc202('0xa5')]===-0x1){return _0x1a217c;}var _0x2fe360=this['getAndSetVariable'](_0xc202('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x2fe360[_0xc202('0xa5')]===-0x1){return _0x2fe360;}var _0x2149da=this[_0xc202('0xa4')](_0xc202('0xb4'),_0xc202('0xb5'));if(_0x2149da['result']===-0x1){return _0x2149da;}return this[_0xc202('0xc')][_0xc202('0xad')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xcbbc03));};AGIVertices['prototype'][_0xc202('0x6')]=function(_0x4102b7){logger['info'](util['format'](_0xc202('0xb6'),_0x4102b7[_0xc202('0x36')]));return this[_0xc202('0xc')][_0xc202('0x6')]([_0x4102b7[_0xc202('0xb7')],_0x4102b7['args']]);};AGIVertices[_0xc202('0xf')][_0xc202('0xb8')]=function(_0xc2e3de){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0xb9'),_0xc2e3de['label']));if(this[_0xc202('0x84')](_0xc2e3de[_0xc202('0x64')])){logger['info'](util[_0xc202('0x26')](_0xc202('0xba'),_0xc2e3de['timeout']));var _0x335a41=this[_0xc202('0xc')]['wait'](_0xc2e3de['timeout']);if(_0x335a41[_0xc202('0xa5')]===-0x1){return _0x335a41;}}return this[_0xc202('0xc')][_0xc202('0xb8')]();};AGIVertices[_0xc202('0xf')][_0xc202('0x49')]=function(_0xcbe303){logger['info'](util[_0xc202('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xcbe303['label']));if(!this['isConfigured'](_0xcbe303[_0xc202('0x48')])){return this['channel'][_0xc202('0x2f')](_0xcbe303,'no\x20list\x20selected');}_0xcbe303[_0xc202('0xbb')]=moment();if(this[_0xc202('0x84')](_0xcbe303[_0xc202('0xbc')])){_0xcbe303[_0xc202('0xbb')]=moment()[_0xc202('0xbd')](_0xcbe303[_0xc202('0xbc')],_0xc202('0xbe'));}if(!this[_0xc202('0x84')](_0xcbe303[_0xc202('0xbf')])){_0xcbe303['callback_priority']=0x2;}this[_0xc202('0x42')][_0xc202('0x6e')](this,_0xcbe303);return this[_0xc202('0xc')]['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xcbe303[_0xc202('0xc0')],_0xcbe303['list_id'],_0xcbe303[_0xc202('0xbb')]));};AGIVertices[_0xc202('0xf')][_0xc202('0xc1')]=function(_0x10b474){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0xc2'),_0x10b474[_0xc202('0x36')]));var _0x30b4de=this[_0xc202('0xc')][_0xc202('0x55')](_0x10b474[_0xc202('0xc3')],_0x10b474[_0xc202('0x77')]);if(_0x30b4de[_0xc202('0xa5')]===-0x1){return _0x30b4de;}return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0xc4'),_0x10b474[_0xc202('0xc3')],_0x10b474[_0xc202('0x77')]));};AGIVertices[_0xc202('0xf')][_0xc202('0xc5')]=function(_0x678731){logger['info'](util[_0xc202('0x26')](_0xc202('0xc6'),_0x678731[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x678731[_0xc202('0x5a')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xc7'));}var _0x2ee8bc='\x22'+_0x678731[_0xc202('0x5a')]+'\x22';if(this[_0xc202('0x84')](_0x678731[_0xc202('0x77')])){_0x2ee8bc+=','+_0x678731['options'];}var _0xa0e26b=this['channel'][_0xc202('0x55')](_0xc202('0xa9'),_0x2ee8bc);if(_0xa0e26b['result']===-0x1){return _0xa0e26b;}return this[_0xc202('0xc')]['noop'](util['format'](_0xc202('0xaa'),_0x2ee8bc));};AGIVertices[_0xc202('0xf')][_0xc202('0xc8')]=function(_0x273612){logger[_0xc202('0x2b')](util['format'](_0xc202('0xc9'),_0x273612[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x273612[_0xc202('0x5a')])){return this['channel']['noop'](_0xc202('0xc7'));}var _0x4e6ac1='\x22'+_0x273612[_0xc202('0x5a')]+'\x22';if(this[_0xc202('0x84')](_0x273612[_0xc202('0x77')])){_0x4e6ac1+=','+_0x273612[_0xc202('0x77')];}var _0x5cea72=this[_0xc202('0xc')]['exec'](_0xc202('0xa9'),_0x4e6ac1);if(_0x5cea72[_0xc202('0xa5')]===-0x1){return _0x5cea72;}return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0xaa'),_0x4e6ac1));};AGIVertices[_0xc202('0xf')][_0xc202('0xca')]=function(_0xf611a8){logger['info'](util[_0xc202('0x26')](_0xc202('0xcb'),_0xf611a8['label']));if(!this[_0xc202('0x84')](_0xf611a8[_0xc202('0xaf')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xae'));}var _0x4dd23b=_0xf611a8['grammar'];if(this['isConfigured'](_0xf611a8[_0xc202('0x77')])){_0x4dd23b+=','+_0xf611a8[_0xc202('0x77')];}var _0x2b7562=this['channel']['exec']('MRCPRecog',_0x4dd23b);if(_0x2b7562[_0xc202('0xa5')]===-0x1){return _0x2b7562;}var _0x58a010=this[_0xc202('0xa4')](_0xc202('0xb1'),_0xc202('0xcc'));if(_0x58a010[_0xc202('0xa5')]===-0x1){return _0x58a010;}var _0x5b6f04=this[_0xc202('0xa4')](_0xc202('0xb3'),_0xc202('0xcd'));if(_0x5b6f04['result']===-0x1){return _0x5b6f04;}var _0x2505a1=this[_0xc202('0xa4')](_0xc202('0xb4'),'LUMENVOX_ASR_INSTANCE');if(_0x2505a1[_0xc202('0xa5')]===-0x1){return _0x2505a1;}return this[_0xc202('0xc')]['noop'](util[_0xc202('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4dd23b));};AGIVertices[_0xc202('0xf')]['sestekasr']=function(_0x239db0){logger[_0xc202('0x2b')](util['format'](_0xc202('0xce'),_0x239db0[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x239db0['grammar'])){return this['channel'][_0xc202('0xad')](_0xc202('0xae'));}var _0x2f8a82=_0x239db0[_0xc202('0xaf')];if(this['isConfigured'](_0x239db0[_0xc202('0x77')])){_0x2f8a82+=','+_0x239db0['options'];}var _0x3fda23=this[_0xc202('0xc')][_0xc202('0x55')](_0xc202('0xb0'),_0x2f8a82);if(_0x3fda23['result']===-0x1){return _0x3fda23;}var _0x2bc6b6=this[_0xc202('0xa4')]('RECOG_CONFIDENCE()',_0xc202('0xcf'));if(_0x2bc6b6[_0xc202('0xa5')]===-0x1){return _0x2bc6b6;}var _0x19cacf=this[_0xc202('0xa4')](_0xc202('0xb3'),_0xc202('0xd0'));if(_0x19cacf[_0xc202('0xa5')]===-0x1){return _0x19cacf;}var _0x20058f=this[_0xc202('0xa4')](_0xc202('0xb4'),_0xc202('0xd1'));if(_0x20058f[_0xc202('0xa5')]===-0x1){return _0x20058f;}return this['channel'][_0xc202('0xad')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2f8a82));};AGIVertices[_0xc202('0xf')][_0xc202('0xd2')]=function(_0x890ba6){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x890ba6['label']));if(!this[_0xc202('0x84')](_0x890ba6[_0xc202('0xd3')])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x890ba6,_0xc202('0xd4'));}var _0x18f2de=this['getSquareOdbc']['sync'](this,_0x890ba6[_0xc202('0xd3')]);if(!_0x18f2de){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x890ba6,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x890ba6[_0xc202('0xd5')])){return this[_0xc202('0xc')]['error'](_0x890ba6,_0xc202('0xd6'));}var _0x371589=_0x890ba6['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xc202('0xc')]['noop'](util['format'](_0xc202('0xd7'),_0x371589));var _0x2619ac=this[_0xc202('0x28')][_0xc202('0x6e')](this,_0x18f2de,_0x371589);this['createSquareDetailsReport']['sync'](this,_0x890ba6,_0x371589);if(!this[_0xc202('0x84')](_0x890ba6[_0xc202('0xd8')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xd9'));}var _0x59d166=this[_0xc202('0x10')][_0xc202('0x6e')](this,_0x890ba6[_0xc202('0xd8')]);if(!_0x59d166){return this['channel'][_0xc202('0x2f')](_0x890ba6,'no\x20variable\x20found');}var _0xf95d09=this;_0x2619ac[_0xc202('0xda')](function(_0x529069,_0x32184b){Object['keys'](_0x529069)[_0xc202('0xda')](function(_0xf7f4a1){_0xf95d09[_0xc202('0xc')][_0xc202('0xa0')](util['format']('%s[%s][%s]',_0x59d166,_0x32184b,_0xf7f4a1),_0x529069[_0xf7f4a1]);});});this[_0xc202('0xc')]['setVariable'](util[_0xc202('0x26')](_0xc202('0xdb'),_0x59d166),_0x2619ac[_0xc202('0x9d')]);return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0xdc'),_0x59d166));};AGIVertices[_0xc202('0xf')][_0xc202('0xdd')]=function(_0x23935f){logger[_0xc202('0xde')](util['format'](_0xc202('0xdf'),_0x23935f[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x23935f['sip_id'])){return this[_0xc202('0xc')]['error'](_0x23935f,'no\x20user\x20selected');}var _0x42b767=this[_0xc202('0xe0')][_0xc202('0x6e')](this,_0x23935f[_0xc202('0xe1')]);if(!_0x42b767){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x23935f,'no\x20user\x20found');}var _0x42789c=this[_0xc202('0xc')][_0xc202('0x55')](_0xc202('0xe2'),[util[_0xc202('0x26')](_0xc202('0xe3'),_0x42b767),_0x23935f[_0xc202('0x64')],_0x23935f[_0xc202('0xe4')],_0x23935f['url']]);if(_0x42789c[_0xc202('0xa5')]===-0x1){return _0x42789c;}return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0xe5'),_0xc202('0xe2')));};AGIVertices[_0xc202('0xf')][_0xc202('0xe6')]=function(_0x16047c){logger[_0xc202('0x2b')](util['format'](_0xc202('0xe7'),_0x16047c[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x16047c[_0xc202('0x79')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xe8'));}if(!this[_0xc202('0x84')](_0x16047c[_0xc202('0x5a')])){return this[_0xc202('0xc')]['noop'](_0xc202('0xc7'));}this[_0xc202('0xc')][_0xc202('0xe9')]=!![];this[_0xc202('0x34')](_0x16047c);this[_0xc202('0x41')](_0x16047c[_0xc202('0x5a')],'in','','');this['channel']['noop'](util[_0xc202('0x26')](_0xc202('0xea'),_0x16047c[_0xc202('0x5a')]));var _0x462685=this[_0xc202('0x78')][_0xc202('0x6e')](this,_0x16047c);if(_0x462685){for(var _0x619b3e in _0x462685){if(_0x462685[_0xc202('0x9a')](_0x619b3e)){this[_0xc202('0xc')][_0xc202('0xa0')](util[_0xc202('0x26')](_0xc202('0xeb'),_0x619b3e[_0xc202('0x69')]()),_0x462685[_0x619b3e]);}}this[_0xc202('0x41')](_0x462685['speech'],_0xc202('0xec'),_0xc202('0xe6'),'');return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0xed'),_0x462685[_0xc202('0xee')]));}return this[_0xc202('0xc')][_0xc202('0x2f')](_0x16047c,_0xc202('0xef'));};AGIVertices[_0xc202('0xf')][_0xc202('0xf0')]=function(_0xc03f8b){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0xf1'),_0xc03f8b[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0xc03f8b[_0xc202('0x7c')])){return this['channel'][_0xc202('0xad')](_0xc202('0xf2'));}if(!this[_0xc202('0x84')](_0xc03f8b['client_email'])){return this[_0xc202('0xc')]['noop'](_0xc202('0xf3'));}if(!this['isConfigured'](_0xc03f8b[_0xc202('0x7d')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xf4'));}if(!this[_0xc202('0x84')](_0xc03f8b['dialogflowV2_language'])){return this['channel']['noop'](_0xc202('0xf5'));}if(!this['isConfigured'](_0xc03f8b[_0xc202('0x5a')])){return this[_0xc202('0xc')]['noop']('no\x20text\x20configured');}this[_0xc202('0xc')][_0xc202('0xe9')]=!![];this['createSquareDetailsReport'](_0xc03f8b);this['createSquareMessage'](_0xc03f8b[_0xc202('0x5a')],'in','','');this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0xf6'),_0xc03f8b[_0xc202('0x5a')]));var _0x34f743=this[_0xc202('0x7b')][_0xc202('0x6e')](this,_0xc03f8b);if(_0x34f743){for(var _0x57f966 in _0x34f743){if(_0x34f743[_0xc202('0x9a')](_0x57f966)){if(_0x57f966!==_0xc202('0xf7')){this[_0xc202('0xc')][_0xc202('0xa0')](util[_0xc202('0x26')](_0xc202('0xeb'),_0x57f966[_0xc202('0x69')]()),_0x34f743[_0x57f966]);}}}this[_0xc202('0x41')](_0x34f743[_0xc202('0xee')],_0xc202('0xec'),'dialogflowV2',_0x34f743[_0xc202('0xf7')]);return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')]('DialogflowV2\x20Result\x20%s',_0x34f743['speech']));}return this['channel'][_0xc202('0x2f')](_0xc03f8b,_0xc202('0xf8'));};AGIVertices['prototype'][_0xc202('0xf9')]=function(_0x1fd98b){logger[_0xc202('0x2b')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1fd98b[_0xc202('0x36')]));if(!this['isConfigured'](_0x1fd98b['ndauth_url'])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xfa'));}if(!this[_0xc202('0x84')](_0x1fd98b[_0xc202('0xfb')])){return this[_0xc202('0xc')][_0xc202('0xad')]('no\x20username\x20configured');}if(!this[_0xc202('0x84')](_0x1fd98b[_0xc202('0xfc')])){return this[_0xc202('0xc')]['noop'](_0xc202('0xfd'));}if(!this['isConfigured'](_0x1fd98b['ndassistant_url'])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xc7'));}this[_0xc202('0xc')][_0xc202('0xe9')]=!![];this[_0xc202('0x34')](_0x1fd98b);this['createSquareMessage'](_0x1fd98b[_0xc202('0x5a')],'in','','');this[_0xc202('0xc')][_0xc202('0xad')](util['format'](_0xc202('0xfe'),_0x1fd98b['text']));var _0x2401ae=this[_0xc202('0x7f')][_0xc202('0x6e')](this,_0x1fd98b);if(_0x2401ae){for(var _0xed8eae in _0x2401ae){if(_0x2401ae[_0xc202('0x9a')](_0xed8eae)){this[_0xc202('0xc')][_0xc202('0xa0')](util[_0xc202('0x26')](_0xc202('0xff'),_0xed8eae[_0xc202('0x69')]()),_0x2401ae[_0xed8eae]);}}this[_0xc202('0x41')](_0x2401ae['speech'],_0xc202('0xec'),'sesteknda','');if(_0x2401ae[_0xc202('0x100')]){this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x2401ae[_0xc202('0x100')]));var _0x4c3e9a=this[_0xc202('0xc')][_0xc202('0x101')](_0x2401ae[_0xc202('0x100')]);try{fs['unlink'](_0x2401ae[_0xc202('0x100')]+_0xc202('0x102'));}catch(_0x4a1b1a){logger['error'](_0x4a1b1a);}return _0x4c3e9a;}else{return this[_0xc202('0xc')][_0xc202('0xad')](util['format']('SestekNDA\x20Result\x20%s',_0x2401ae[_0xc202('0xee')]));}}return this[_0xc202('0xc')][_0xc202('0x2f')](_0x1fd98b,_0xc202('0x103'));};AGIVertices['prototype'][_0xc202('0x104')]=function(_0x2f5fd7){logger['info'](util['format'](_0xc202('0x105'),_0x2f5fd7[_0xc202('0x36')]));return this['channel']['noop']('end');};AGIVertices[_0xc202('0xf')][_0xc202('0x106')]=function(_0x55325b){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x107'),_0x55325b[_0xc202('0x36')]));var _0x36d2ea='';if(_0x55325b[_0xc202('0x108')]){if(!this[_0xc202('0x84')](_0x55325b[_0xc202('0x108')])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x55325b,_0xc202('0x109'));}else{var _0x143ae9=parseInt(_0x55325b[_0xc202('0x108')],0xa);if(isNaN(_0x143ae9)){_0x36d2ea=_0x55325b[_0xc202('0x108')];}else{_0x36d2ea=this['getTrunk'][_0xc202('0x6e')](this,_0x55325b[_0xc202('0x108')]);if(!_0x36d2ea){return this['channel'][_0xc202('0x2f')](_0x55325b,_0xc202('0x10a'));}}}}else if(_0x55325b['trunk_name']){_0x36d2ea=_0x55325b[_0xc202('0x10b')];}else{return this['channel'][_0xc202('0x2f')](_0x55325b,_0xc202('0x109'));}var _0x27eff4=this[_0xc202('0xc')][_0xc202('0x55')](_0xc202('0xe2'),[util[_0xc202('0x26')](_0xc202('0x10c'),_0x36d2ea,_0x55325b[_0xc202('0xc0')]),_0x55325b[_0xc202('0x64')],_0x55325b[_0xc202('0xe4')],_0x55325b[_0xc202('0x62')]]);if(_0x27eff4[_0xc202('0xa5')]===-0x1){return _0x27eff4;}return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')]('Executed\x20command\x20%s',_0xc202('0xe2')));};AGIVertices[_0xc202('0xf')][_0xc202('0x10d')]=function(_0x5926bc){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x10e'),_0x5926bc[_0xc202('0x36')]));return this['channel'][_0xc202('0xad')]('finally');};AGIVertices[_0xc202('0xf')][_0xc202('0x10f')]=function(_0x34d347){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x110'),_0x34d347[_0xc202('0x36')]));if(_0x34d347[_0xc202('0x111')]===0x0){return this[_0xc202('0xa7')](_0x34d347);}_0x34d347['retry']-=0x1;if(!this['isConfigured'](_0x34d347[_0xc202('0x112')])){return this[_0xc202('0xc')]['error'](_0x34d347,_0xc202('0x113'));}var _0x586244=this['getSound'][_0xc202('0x6e')](this,_0x34d347[_0xc202('0x112')]);if(!_0x586244){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x34d347,_0xc202('0x114'));}if(!this['isConfigured'](_0x34d347[_0xc202('0xd8')])){return this[_0xc202('0xc')]['error'](_0xc202('0xd9'));}var _0x12b1c6=this[_0xc202('0xc')]['getData'](_0x586244,_0x34d347[_0xc202('0x115')],_0x34d347['maxdigit']);var _0x2281ed=_0x12b1c6['result']?_0x12b1c6[_0xc202('0xa5')][_0xc202('0x4b')]():'';logger[_0xc202('0x2b')](_0xc202('0x116'),JSON[_0xc202('0x71')](_0x12b1c6));if(_0x12b1c6[_0xc202('0xa5')]===-0x1){this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x34d347,_0x2281ed);return _0x12b1c6;}else if(_0x12b1c6['extra']===_0xc202('0x64')){_0x12b1c6[_0xc202('0xa5')]=_0x2281ed[_0xc202('0x9d')]>=parseInt(_0x34d347['mindigit'])?'x':'i';}else{_0x12b1c6[_0xc202('0xa5')]=_0x2281ed[_0xc202('0x9d')]>=parseInt(_0x34d347[_0xc202('0x117')])&&_0x2281ed[_0xc202('0x9d')]<=parseInt(_0x34d347[_0xc202('0x118')])?'x':'i';}var _0x6f55ae=this[_0xc202('0x10')]['sync'](this,_0x34d347[_0xc202('0xd8')]);if(!_0x6f55ae){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x34d347,_0xc202('0x119'));}this[_0xc202('0xc')][_0xc202('0xa0')](_0x6f55ae,_0x2281ed);if(this[_0xc202('0x84')](_0x34d347['hiddendigitsnum'])){var _0x30341e=parseInt(_0x34d347['hiddendigitsnum'],0xa);var _0x320c0c=rs[_0xc202('0x11a')]({'charset':'*','length':_0x30341e});var _0x2314bd=_0x2281ed[_0xc202('0x9d')];if(_0x2314bd>0x0){if(_0x2314bd>_0x30341e){this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x34d347,_0x34d347[_0xc202('0x11b')]==='first'?_0x320c0c+_0x2281ed[_0xc202('0x11c')](_0x30341e):_0x2281ed[_0xc202('0x11c')](0x0,_0x2314bd-_0x30341e)+_0x320c0c);}else{this['createSquareDetailsReport'][_0xc202('0x6e')](this,_0x34d347,rs[_0xc202('0x11a')]({'charset':'*','length':_0x2314bd}));}}else{this[_0xc202('0x34')]['sync'](this,_0x34d347,'');}}else{this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x34d347,_0x2281ed);}return _0x12b1c6;};AGIVertices[_0xc202('0xf')]['getsecretdigits']=function(_0x107dfd){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x11d'),_0x107dfd[_0xc202('0x36')]));return this[_0xc202('0x10f')](_0x107dfd);};AGIVertices['prototype'][_0xc202('0x11e')]=function(_0x390e13){logger[_0xc202('0x2b')](util['format'](_0xc202('0x11f'),_0x390e13[_0xc202('0x36')]));this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x390e13,_0x390e13[_0xc202('0x120')]);return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x121'),_0x390e13[_0xc202('0x120')]));};AGIVertices[_0xc202('0xf')][_0xc202('0x122')]=function(_0x10cb76){logger[_0xc202('0x2b')](util['format'](_0xc202('0x123'),_0x10cb76[_0xc202('0x36')]));if(!this['isConfigured'](_0x10cb76[_0xc202('0x87')])||!this['isConfigured'](_0x10cb76[_0xc202('0x8d')])){return this[_0xc202('0xc')][_0xc202('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xc202('0x84')](_0x10cb76[_0xc202('0x5a')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xc7'));}this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x124'),_0x10cb76[_0xc202('0x5a')]));var _0x21bb38=this[_0xc202('0x86')]['sync'](this,_0x10cb76);if(_0x21bb38){this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x125'),_0x21bb38));var _0x4fa995=this['channel'][_0xc202('0x101')](_0x21bb38);try{fs[_0xc202('0x126')](_0x21bb38+'.wav');}catch(_0x1cc966){logger[_0xc202('0x2f')](_0x1cc966);}return _0x4fa995;}return this['channel']['error'](_0x10cb76,_0xc202('0x127'));};AGIVertices['prototype'][_0xc202('0x128')]=function(_0x17fadb){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x129'),_0x17fadb[_0xc202('0x36')]));if(!this['isConfigured'](_0x17fadb[_0xc202('0x87')])||!this['isConfigured'](_0x17fadb[_0xc202('0x8d')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0x12a'));}if(!this[_0xc202('0x84')](_0x17fadb[_0xc202('0x12b')])){return this['channel'][_0xc202('0xad')](_0xc202('0x12c'));}if(!this['isConfigured'](_0x17fadb[_0xc202('0x5a')])){return this[_0xc202('0xc')][_0xc202('0xad')]('no\x20text\x20configured');}this['channel'][_0xc202('0xe9')]=!![];this[_0xc202('0x34')](_0x17fadb);this[_0xc202('0x41')](_0x17fadb[_0xc202('0x5a')],'in','','');this[_0xc202('0xc')]['noop'](util['format'](_0xc202('0x12d'),_0x17fadb[_0xc202('0x5a')]));var _0x2aeb83=this[_0xc202('0x8c')][_0xc202('0x6e')](this,_0x17fadb);if(_0x2aeb83){for(var _0x5d435e in _0x2aeb83){if(_0x2aeb83['hasOwnProperty'](_0x5d435e)&&_[_0xc202('0x97')](_0x2aeb83[_0x5d435e])){this['channel'][_0xc202('0xa0')](util[_0xc202('0x26')]('AWS_LEX_%s',_0x5d435e[_0xc202('0x69')]()),_0x2aeb83[_0x5d435e]);}}if(_[_0xc202('0x44')](_0x2aeb83[_0xc202('0x75')])){return this[_0xc202('0xc')]['noop'](_0xc202('0x12e'));}else{this[_0xc202('0x41')](_0x2aeb83['message'],_0xc202('0xec'),_0xc202('0x12f'),'');return this['channel'][_0xc202('0xad')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x2aeb83[_0xc202('0x75')]));}}return this['channel']['error'](_0x17fadb,_0xc202('0x130'));};AGIVertices[_0xc202('0xf')][_0xc202('0x131')]=function(_0xf1f3db){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x132'),_0xf1f3db[_0xc202('0x36')],_0xf1f3db[_0xc202('0x64')]));if(!this['isConfigured'](_0xf1f3db['key'])){return this[_0xc202('0xc')][_0xc202('0xad')]('no\x20key\x20configured');}var _0x45da3e=_0xc202('0x133');var _0x21bca1=util[_0xc202('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0xc202('0x11a')](0x4));var _0x1f1930=util[_0xc202('0x26')](_0xc202('0x9f'),_0x21bca1,_0x45da3e);var _0x23cfff=!![];if(_0xf1f3db[_0xc202('0x134')]===_0xc202('0x135')){_0x23cfff=![];}var _0x2ae67=this['channel'][_0xc202('0x136')](_0x21bca1,_0x45da3e,_0xf1f3db[_0xc202('0x137')],_0xf1f3db[_0xc202('0x64')],undefined,_0x23cfff);if(_0x2ae67['result']!==-0x1){this[_0xc202('0xc')]['noop'](util[_0xc202('0x26')](_0xc202('0x138'),_0x1f1930));var _0x153b5f=this[_0xc202('0x8f')][_0xc202('0x6e')](this,_0xf1f3db,_0x1f1930);if(_0x153b5f){for(var _0x19a462 in _0x153b5f){if(_0x153b5f['hasOwnProperty'](_0x19a462)){this[_0xc202('0xc')]['setVariable'](util[_0xc202('0x26')](_0xc202('0x139'),_0x19a462['toUpperCase']()),_0x153b5f[_0x19a462]);}}return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0xc202('0x71')](_0x153b5f)));}}return _0x2ae67;};AGIVertices['prototype'][_0xc202('0x13a')]=function(_0x4a1f01){logger[_0xc202('0x2b')](util['format'](_0xc202('0x13b'),_0x4a1f01[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x4a1f01['appid'])){return this[_0xc202('0xc')]['noop']('no\x20appid\x20configured');}if(!this[_0xc202('0x84')](_0x4a1f01[_0xc202('0x93')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0x13c'));}var _0x502ab3=_0xc202('0x133');var _0x4ecffc=util['format'](_0xc202('0x13d'),FILES_PATH,rs[_0xc202('0x11a')](0x4));var _0x3c5501=util['format'](_0xc202('0x9f'),_0x4ecffc,_0x502ab3);var _0x2b0a83=!![];if(_0x4a1f01['beep']===_0xc202('0x135')){_0x2b0a83=![];}var _0x34b0c0=this[_0xc202('0xc')][_0xc202('0x136')](_0x4ecffc,_0x502ab3,_0x4a1f01[_0xc202('0x137')],_0x4a1f01[_0xc202('0x64')],undefined,_0x2b0a83);if(_0x34b0c0[_0xc202('0xa5')]!==-0x1){this['channel'][_0xc202('0xad')](util[_0xc202('0x26')]('tilde\x20%s\x20file\x20created',_0x3c5501));var _0x2f8959=this[_0xc202('0x91')][_0xc202('0x6e')](this,_0x4a1f01,_0x3c5501);if(_0x2f8959){for(var _0x3b1ffb in _0x2f8959){if(_0x2f8959[_0xc202('0x9a')](_0x3b1ffb)){this['channel'][_0xc202('0xa0')](util['format']('TILDE_ASR_%s',_0x3b1ffb[_0xc202('0x69')]()),_0x2f8959[_0x3b1ffb]);}}return this[_0xc202('0xc')]['noop'](util[_0xc202('0x26')](_0xc202('0x13e'),JSON[_0xc202('0x71')](_0x2f8959)));}}return _0x34b0c0;};AGIVertices[_0xc202('0xf')][_0xc202('0x13f')]=function(_0x170c56){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x140'),_0x170c56[_0xc202('0x36')]));return this['channel'][_0xc202('0x141')](_0x170c56[_0xc202('0x3b')],_0x170c56[_0xc202('0x3c')],_0x170c56[_0xc202('0x3d')]);};AGIVertices[_0xc202('0xf')][_0xc202('0x142')]=function(_0x5a437e){logger['info'](util['format'](_0xc202('0x143'),_0x5a437e['label']));if(!this['isConfigured'](_0x5a437e[_0xc202('0x144')])){return this[_0xc202('0xc')]['error'](_0x5a437e,'no\x20condition\x20configured');}try{var _0x56a3ab=eval(_0x5a437e[_0xc202('0x144')])?'true':_0xc202('0x145');this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x146'),_0x5a437e[_0xc202('0x144')],_0x56a3ab));return{'code':0xc8,'result':_0x56a3ab};}catch(_0x415998){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc202('0xf')]['gotoiftime']=function(_0x121b79){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x147'),_0x121b79[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x121b79['interval_id'])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x121b79,_0xc202('0x148'));}var _0x1f3e6a=this[_0xc202('0x21')][_0xc202('0x6e')](this,_0x121b79[_0xc202('0x149')]);if(!_0x1f3e6a){return this[_0xc202('0xc')]['error'](_0x121b79,_0xc202('0x14a'));}for(var _0x5e2229=0x0;_0x5e2229<_0x1f3e6a[_0xc202('0x9d')];_0x5e2229+=0x1){var _0x4ecf46=this[_0xc202('0xc')][_0xc202('0x10')](util[_0xc202('0x26')](_0xc202('0x14b'),_0x1f3e6a[_0x5e2229]));if(_0x4ecf46[_0xc202('0xa5')]===-0x1){return _0x4ecf46;}logger['info'](util[_0xc202('0x26')](_0xc202('0x14c'),_0x1f3e6a[_0x5e2229],_0x4ecf46[_0xc202('0xa3')]));if(_0x4ecf46[_0xc202('0xa3')]===_0xc202('0x14d')){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('IFTIME\x20%s\x20%s',_0x1f3e6a[_0x5e2229],'true'));this['channel']['noop'](util[_0xc202('0x26')](_0xc202('0x14c'),_0x1f3e6a[_0x5e2229],_0xc202('0x14d')));return{'code':0xc8,'result':_0xc202('0x14d')};}else{logger[_0xc202('0x2b')](util[_0xc202('0x26')]('IFTIME\x20%s\x20%s',_0x1f3e6a[_0x5e2229],_0xc202('0x145')));this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')]('IFTIME\x20%s\x20%s',_0x1f3e6a[_0x5e2229],_0xc202('0x145')));}}return{'code':0xc8,'result':_0xc202('0x145')};};AGIVertices['prototype'][_0xc202('0x14e')]=function(_0x552768){logger[_0xc202('0x2b')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x552768[_0xc202('0x36')]));return this['channel']['hangup']();};AGIVertices[_0xc202('0xf')][_0xc202('0x14f')]=function(_0x1d4cb3){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1d4cb3['label']));if(!this[_0xc202('0x84')](_0x1d4cb3[_0xc202('0x79')])){return this['channel'][_0xc202('0xad')]('no\x20key\x20configured');}var _0x36a917='wav';var _0xffadce=util[_0xc202('0x26')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x7b768b=util[_0xc202('0x26')](_0xc202('0x9f'),_0xffadce,_0x36a917);var _0x2c9668=!![];if(_0x1d4cb3[_0xc202('0x134')]===_0xc202('0x135')){_0x2c9668=![];}var _0x3187ff=this['channel'][_0xc202('0x136')](_0xffadce,_0x36a917,_0x1d4cb3[_0xc202('0x137')],_0x1d4cb3['timeout'],undefined,_0x2c9668);if(_0x3187ff[_0xc202('0xa5')]!==-0x1){this[_0xc202('0xc')][_0xc202('0xad')](util['format'](_0xc202('0x150'),_0x7b768b));var _0x2aeaa6=this[_0xc202('0x83')][_0xc202('0x6e')](this,_0x1d4cb3,_0x7b768b);if(_0x2aeaa6){for(var _0x219902 in _0x2aeaa6){if(_0x2aeaa6['hasOwnProperty'](_0x219902)){this[_0xc202('0xc')]['setVariable'](util[_0xc202('0x26')](_0xc202('0x151'),_0x219902[_0xc202('0x69')]()),_0x2aeaa6[_0x219902]);}}return this['channel']['noop'](util[_0xc202('0x26')](_0xc202('0x152'),JSON[_0xc202('0x71')](_0x2aeaa6)));}}return _0x3187ff;};AGIVertices['prototype']['ispeechtts']=function(_0x1d1b81){logger['info'](util[_0xc202('0x26')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1d1b81[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x1d1b81[_0xc202('0x79')])){return this[_0xc202('0xc')][_0xc202('0xad')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x1d1b81[_0xc202('0x5a')])){return this['channel'][_0xc202('0xad')]('no\x20text\x20configured');}this['channel'][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x153'),_0x1d1b81[_0xc202('0x5a')]));var _0x4e055a=this[_0xc202('0x80')][_0xc202('0x6e')](this,_0x1d1b81);if(_0x4e055a){this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')]('ispeech\x20%s\x20file\x20created',_0x4e055a));var _0x5e01bf=this[_0xc202('0xc')][_0xc202('0x101')](_0x4e055a,_0x1d1b81[_0xc202('0x137')]);try{fs[_0xc202('0x126')](_0x4e055a+_0xc202('0x102'));}catch(_0x56dd14){logger['error'](_0x56dd14);}return _0x5e01bf;}return this['channel']['error'](_0x1d1b81,_0xc202('0x154'));};AGIVertices[_0xc202('0xf')][_0xc202('0x155')]=function(_0x410e73){logger['info'](util[_0xc202('0x26')](_0xc202('0x156'),_0x410e73[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x410e73['findBy'])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x410e73,_0xc202('0x157'));}logger[_0xc202('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc202('0xc')]['callerid'],_0x410e73[_0xc202('0x158')]));var _0x43a2de=this[_0xc202('0x51')][_0xc202('0x6e')](this,_0x410e73['findBy']);if(_0x43a2de){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x159'),this[_0xc202('0xc')][_0xc202('0x39')],_0x410e73['findBy']));this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x159'),this[_0xc202('0xc')][_0xc202('0x39')],_0x410e73[_0xc202('0x158')]));return{'code':0xc8,'result':_0xc202('0x15a')};}else{logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x15b'),this[_0xc202('0xc')][_0xc202('0x39')],_0x410e73[_0xc202('0x158')]));this['channel'][_0xc202('0xad')](util['format'](_0xc202('0x15b'),this[_0xc202('0xc')][_0xc202('0x39')],_0x410e73[_0xc202('0x158')]));return{'code':0xc8,'result':_0xc202('0x15c')};}};AGIVertices[_0xc202('0xf')][_0xc202('0x15d')]=function(_0x54152a){logger['info'](util[_0xc202('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x54152a[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x54152a['findBy'])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x54152a,_0xc202('0x157'));}logger[_0xc202('0x2b')](util['format'](_0xc202('0x15e'),this[_0xc202('0xc')]['callerid'],_0x54152a['findBy']));var _0x4ea2e1=this[_0xc202('0x50')]['sync'](this,_0x54152a[_0xc202('0x158')]);if(_0x4ea2e1){logger['info'](util[_0xc202('0x26')](_0xc202('0x159'),this[_0xc202('0xc')][_0xc202('0x39')],_0x54152a['findBy']));this['channel'][_0xc202('0xad')](util['format'](_0xc202('0x159'),this[_0xc202('0xc')][_0xc202('0x39')],_0x54152a[_0xc202('0x158')]));return{'code':0xc8,'result':_0xc202('0x15a')};}else{logger['info'](util[_0xc202('0x26')](_0xc202('0x15b'),this[_0xc202('0xc')][_0xc202('0x39')],_0x54152a[_0xc202('0x158')]));this[_0xc202('0xc')][_0xc202('0xad')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc202('0x39')],_0x54152a['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc202('0xf')][_0xc202('0x15f')]=function(_0x5f0263){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x160'),_0x5f0263[_0xc202('0x36')]));if(!this['isConfigured'](_0x5f0263[_0xc202('0x161')])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x5f0263,_0xc202('0x162'));}this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x163'),_0x5f0263[_0xc202('0x161')]));var _0x5dcf4b=eval(_0x5f0263[_0xc202('0x161')]);if(!this['isConfigured'](_0x5f0263[_0xc202('0xd8')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xd9'));}var _0x58524d=this[_0xc202('0x10')][_0xc202('0x6e')](this,_0x5f0263['variable_id']);if(!_0x58524d){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x5f0263,_0xc202('0x119'));}if(_['isArray'](_0x5dcf4b)){var _0x1e08c9=this;_0x5dcf4b[_0xc202('0xda')](function(_0x3a9829,_0x187306){_0x1e08c9[_0xc202('0xc')][_0xc202('0xa0')](util['format'](_0xc202('0x164'),_0x58524d,_0x187306),_0x3a9829);});return this['channel'][_0xc202('0xad')](util[_0xc202('0x26')]('variable\x20%s[key]\x20set',_0x58524d));}else{return this[_0xc202('0xc')][_0xc202('0xa0')](_0x58524d,_0x5dcf4b);}};AGIVertices[_0xc202('0xf')][_0xc202('0xa')]=function(_0x447efc){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x447efc[_0xc202('0x36')]));if(_0x447efc[_0xc202('0x111')]===0x0){return this[_0xc202('0xa7')](_0x447efc);}_0x447efc[_0xc202('0x111')]-=0x1;if(!this[_0xc202('0x84')](_0x447efc[_0xc202('0x112')])){return this['channel'][_0xc202('0x2f')](_0x447efc,'no\x20file\x20audio\x20selected');}var _0x111386=this['getSound'][_0xc202('0x6e')](this,_0x447efc[_0xc202('0x112')]);if(!_0x111386){return this['channel'][_0xc202('0x2f')](_0x447efc,_0xc202('0x114'));}var _0x50a57c=this['channel'][_0xc202('0x165')](_0x111386,_0x447efc[_0xc202('0x115')],_0x447efc[_0xc202('0x166')]);var _0x462300=_0x50a57c[_0xc202('0xa5')];if(_0x50a57c[_0xc202('0xa5')]===-0x1){this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x447efc,'-1');return _0x50a57c;}else if(_0x50a57c[_0xc202('0xa3')]===_0xc202('0x64')){_0x50a57c[_0xc202('0xa5')]=_0x50a57c[_0xc202('0xa5')][_0xc202('0x9d')]>0x0?_0x50a57c['result']:'t';}else if(_[_0xc202('0x43')](_0x50a57c[_0xc202('0xa5')])){_0x50a57c[_0xc202('0xa5')]='#';_0x462300='#';}if(!this[_0xc202('0x84')](_0x447efc['variable_id'])){this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xd9'));}else{var _0x45dd27=this[_0xc202('0x10')]['sync'](this,_0x447efc['variable_id']);if(!_0x45dd27){return this['channel']['error'](_0x447efc,'no\x20variable\x20found');}this[_0xc202('0xc')][_0xc202('0xa0')](_0x45dd27,_0x462300);}this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x447efc,_0x462300);return _0x50a57c;};AGIVertices['prototype']['noop']=function(_0x5eaf4d){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x167'),_0x5eaf4d['label']));return this['channel'][_0xc202('0xad')](_0x5eaf4d['output']||_0x5eaf4d[_0xc202('0x36')]);};AGIVertices[_0xc202('0xf')][_0xc202('0x168')]=function(_0x391be6){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x391be6['label']));if(!this[_0xc202('0x84')](_0x391be6[_0xc202('0x158')])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x391be6,_0xc202('0x157'));}logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x15e'),this['channel']['callerid'],_0x391be6[_0xc202('0x158')]));var _0x289d50=this[_0xc202('0x169')][_0xc202('0x6e')](this,_0x391be6[_0xc202('0x16a')]);var _0x1e62bf=this['agentPause'][_0xc202('0x6e')](this,_0x391be6[_0xc202('0x158')],_0x289d50);if(_0x1e62bf){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc202('0xc')][_0xc202('0x39')],_0x391be6[_0xc202('0x158')]));this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x159'),this[_0xc202('0xc')][_0xc202('0x39')],_0x391be6[_0xc202('0x158')]));return{'code':0xc8,'result':_0xc202('0x15a')};}else{logger[_0xc202('0x2b')](util[_0xc202('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc202('0xc')][_0xc202('0x39')],_0x391be6[_0xc202('0x158')]));this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x159'),this[_0xc202('0xc')][_0xc202('0x39')],_0x391be6['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['playback']=function(_0x197871){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x197871['label']));if(!this[_0xc202('0x84')](_0x197871[_0xc202('0x112')])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x197871,_0xc202('0x113'));}var _0x380004=this[_0xc202('0x1d')][_0xc202('0x6e')](this,_0x197871[_0xc202('0x112')]);if(!_0x380004){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x197871,'no\x20file\x20audio\x20found');}var _0x4de228=this['channel'][_0xc202('0x55')]('PLAYBACK',[_0x380004,_0x197871[_0xc202('0xe4')]]);if(_0x4de228[_0xc202('0xa5')]===-0x1){return _0x4de228;}return this[_0xc202('0xc')]['noop'](util[_0xc202('0x26')](_0xc202('0xc4'),_0xc202('0x16b'),_0x380004));};AGIVertices[_0xc202('0xf')]['queue']=function(_0x16bc08){logger['info'](util[_0xc202('0x26')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x16bc08[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x16bc08['queue_id'])){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x16bc08,_0xc202('0x16c'));}var _0x3d35c8='';var _0x120d03=parseInt(_0x16bc08[_0xc202('0x16d')],0xa);if(isNaN(_0x120d03)){_0x3d35c8=_0x16bc08['queue_id'];}else{_0x3d35c8=this[_0xc202('0x14')][_0xc202('0x6e')](this,_0x16bc08[_0xc202('0x16d')]);if(!_0x3d35c8){return this[_0xc202('0xc')]['error'](_0x16bc08,'no\x20queue\x20found');}}var _0x57dd3b='';if(this[_0xc202('0x84')](_0x16bc08[_0xc202('0x112')])){var _0x1c7f8c=this[_0xc202('0x1d')][_0xc202('0x6e')](this,_0x16bc08[_0xc202('0x112')]);if(_0x1c7f8c){_0x57dd3b=_0x1c7f8c;}}this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x16bc08,_0x3d35c8);if(_0x16bc08['opts'][_0xc202('0x16e')]('x')<0x0){_0x16bc08[_0xc202('0xe4')]+='x';}if(_0x16bc08[_0xc202('0xe4')][_0xc202('0x16e')]('X')<0x0){_0x16bc08['opts']+='X';}this[_0xc202('0xc')][_0xc202('0xa0')](_0xc202('0x16f'),_0x3d35c8?_0x3d35c8[_0xc202('0x170')]():'');var _0x2076e6=this[_0xc202('0xc')][_0xc202('0x55')](_0xc202('0x171'),[_0x3d35c8,_0x16bc08[_0xc202('0xe4')],_0x16bc08[_0xc202('0x62')],_0x57dd3b,_0x16bc08[_0xc202('0x64')],_0x16bc08[_0xc202('0x6')],_0x16bc08[_0xc202('0x172')],_0x16bc08['gosub'],'',_0x16bc08[_0xc202('0x173')]]);if(_0x2076e6[_0xc202('0xa5')]===-0x1){return _0x2076e6;}return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0xc4'),_0xc202('0x171'),_0x3d35c8));};AGIVertices['prototype'][_0xc202('0x174')]=function(_0x4979f9){logger['info'](util[_0xc202('0x26')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4979f9['label']));var _0x4e0529=_0x4979f9[_0xc202('0x175')]||_0xc202('0x133');var _0x4acebd=util['format'](_0xc202('0x176'),this[_0xc202('0xc')][_0xc202('0x35')],rs[_0xc202('0x11a')](0x5));var _0x4c99f2=util['format'](_0xc202('0x177'),FILES_PATH,_0x4acebd,_0x4e0529);var _0x5bf8b0=util[_0xc202('0x26')](_0xc202('0x13d'),FILES_PATH,_0x4acebd);this[_0xc202('0x3a')][_0xc202('0x6e')](this,_0x4979f9,_0x4acebd,_0x4c99f2);this[_0xc202('0xc')][_0xc202('0xa0')](_0xc202('0x178'),_0x4acebd);logger['info'](_0xc202('0x179'),_0x5bf8b0,_0x4e0529,_0x4979f9[_0xc202('0x17a')],_0x4979f9[_0xc202('0x64')]);return this['channel'][_0xc202('0x136')](_0x5bf8b0,_0x4e0529,_0x4979f9[_0xc202('0x17a')],_0x4979f9[_0xc202('0x64')],undefined,!![]);};AGIVertices[_0xc202('0xf')][_0xc202('0x17b')]=function(_0xbd6a30){logger['info'](util[_0xc202('0x26')](_0xc202('0x17c'),_0xbd6a30['label']));if(!this['isConfigured'](_0xbd6a30[_0xc202('0x62')])){return this[_0xc202('0xc')][_0xc202('0xad')]('no\x20url\x20configured');}var _0xcc8f77=this[_0xc202('0x61')][_0xc202('0x6e')](this,_0xbd6a30);logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x17d'),util['inspect'](_0xcc8f77,{'showHidden':![],'depth':null})));if(!this[_0xc202('0x84')](_0xbd6a30[_0xc202('0xd8')])){return this[_0xc202('0xc')][_0xc202('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x51728c=this[_0xc202('0x10')][_0xc202('0x6e')](this,_0xbd6a30[_0xc202('0xd8')]);if(!_0x51728c){return this[_0xc202('0xc')][_0xc202('0x2f')](_0xbd6a30,'no\x20variable\x20found');}this['channel'][_0xc202('0xa0')](util[_0xc202('0x26')](_0xc202('0x17e'),_0x51728c),_0xcc8f77[_0xc202('0x17f')]?_0xcc8f77[_0xc202('0x17f')]:_0xc202('0x180'));this['channel'][_0xc202('0xa0')](util[_0xc202('0x26')]('%s_STATUS_MESSAGE',_0x51728c),_0xcc8f77['statusMessage']?_0xcc8f77['statusMessage']:'OK');if(_0xcc8f77[_0xc202('0x72')]){try{this[_0xc202('0x9e')](_0xcc8f77[_0xc202('0x72')],_0x51728c);}catch(_0x75fbfb){logger['error'](util[_0xc202('0x26')](_0xc202('0x181'),_0x51728c));}}return this[_0xc202('0xc')][_0xc202('0xad')](util['format'](_0xc202('0xdc'),_0x51728c));};AGIVertices[_0xc202('0xf')][_0xc202('0x182')]=function(_0x13412a){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x183'),_0x13412a[_0xc202('0x36')]));return this[_0xc202('0xc')][_0xc202('0x184')](_0x13412a['digits'][_0xc202('0x56')](/\s+/g,''),_0x13412a['escape_digits']);};AGIVertices[_0xc202('0xf')]['saynumber']=function(_0x1c7542){logger['info'](util[_0xc202('0x26')](_0xc202('0x185'),_0x1c7542[_0xc202('0x36')]));return this[_0xc202('0xc')]['sayNumber'](_0x1c7542[_0xc202('0x65')][_0xc202('0x56')](/\s+/g,''),_0x1c7542[_0xc202('0x17a')]);};AGIVertices[_0xc202('0xf')][_0xc202('0x186')]=function(_0x5283f1){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x187'),_0x5283f1[_0xc202('0x36')]));return this[_0xc202('0xc')][_0xc202('0x188')](_0x5283f1[_0xc202('0x5a')],_0x5283f1[_0xc202('0x17a')]);};AGIVertices[_0xc202('0xf')][_0xc202('0x189')]=function(_0x1078d4){logger[_0xc202('0x2b')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1078d4['label']));if(!this['isConfigured'](_0x1078d4[_0xc202('0x18a')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0x18b'));}var _0x2b75f6=this[_0xc202('0x1e')][_0xc202('0x6e')](this,_0x1078d4[_0xc202('0x18a')]);if(!_0x2b75f6||!_0x2b75f6[_0xc202('0x18c')]){return this[_0xc202('0xc')]['error'](_0x1078d4,'no\x20mail\x20account\x20found');}var _0x56c86c={'from':util[_0xc202('0x26')](_0xc202('0x18d'),_0x2b75f6['name'],_0x2b75f6[_0xc202('0x18e')]||_0x2b75f6[_0xc202('0x18c')][_0xc202('0x18f')]),'to':_0x1078d4['to']||'','cc':_0x1078d4['cc']||'','bcc':_0x1078d4['bcc']||'','subject':_0x1078d4[_0xc202('0x190')],'html':_0x1078d4[_0xc202('0x5a')],'text':_0x1078d4[_0xc202('0x5a')]};if(this[_0xc202('0x84')](_0x1078d4[_0xc202('0x191')])){}logger[_0xc202('0xde')](_0xc202('0x192'),JSON[_0xc202('0x71')](_0x56c86c));this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x1078d4,_0x1078d4[_0xc202('0x18a')]);this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x193'),_0x2b75f6[_0xc202('0x12')]));this['sendMailMessage'][_0xc202('0x6e')](this,_0x2b75f6[_0xc202('0x194')],_0x56c86c);return this[_0xc202('0xc')]['noop'](_0xc202('0x195'));};AGIVertices[_0xc202('0xf')][_0xc202('0x196')]=function(_0x454af2){logger['info'](util[_0xc202('0x26')](_0xc202('0x197'),_0x454af2[_0xc202('0x36')]));return this['channel'][_0xc202('0xad')](_0xc202('0x198'));};AGIVertices[_0xc202('0xf')]['sendSMS']=function(_0xfdbafc){logger['info'](util['format'](_0xc202('0x199'),_0xfdbafc[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0xfdbafc[_0xc202('0x19a')])){return this[_0xc202('0xc')]['noop'](_0xc202('0x19b'));}var _0x1d3b3f=this[_0xc202('0x31')][_0xc202('0x6e')](this,_0xfdbafc['sms_account_id']);if(!_0x1d3b3f){return this[_0xc202('0xc')][_0xc202('0x2f')](_0xfdbafc,'no\x20sms\x20account\x20found');}var _0x3f71a3={'body':_0xfdbafc['sms_text'],'phone':_0xfdbafc['to']||'','SmsAccountId':_0x1d3b3f['id']};logger['debug'](_0xc202('0x19c'),JSON[_0xc202('0x71')](_0x3f71a3));this[_0xc202('0x34')][_0xc202('0x6e')](this,_0xfdbafc,_0xfdbafc[_0xc202('0x19a')]);this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x19d'),_0x1d3b3f[_0xc202('0x12')]));this[_0xc202('0x33')][_0xc202('0x6e')](this,_0x3f71a3);return this[_0xc202('0xc')]['noop'](_0xc202('0x19e'));};AGIVertices[_0xc202('0xf')][_0xc202('0x19f')]=function(_0x2cf60a){logger['info'](util[_0xc202('0x26')](_0xc202('0x1a0'),_0x2cf60a[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x2cf60a[_0xc202('0xd8')])){return this['channel'][_0xc202('0x2f')](_0x2cf60a,_0xc202('0x1a1'));}var _0x47114c=this['getVariable']['sync'](this,_0x2cf60a[_0xc202('0xd8')]);if(!_0x47114c){return this[_0xc202('0xc')][_0xc202('0x2f')](_0x2cf60a,_0xc202('0x119'));}return this[_0xc202('0xc')][_0xc202('0xa0')](_0x47114c,_0x2cf60a[_0xc202('0x1a2')]);};AGIVertices[_0xc202('0xf')][_0xc202('0x1a3')]=function(_0x4be5ec){logger[_0xc202('0x2b')](util['format'](_0xc202('0x1a4'),_0x4be5ec[_0xc202('0x36')]));this[_0xc202('0xc')][_0xc202('0xad')]('START\x20CALLY\x20SQUARE');var _0x24e237=this[_0xc202('0xc')][_0xc202('0x10')](_0xc202('0x1a5'));if(!_[_0xc202('0x43')](_0x24e237[_0xc202('0xa3')])){this[_0xc202('0xc')]['uniqueid']=_0x24e237[_0xc202('0xa3')];}if(_0x4be5ec[_0xc202('0xb8')]===_0xc202('0x1a6')){this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0x1a7'));return this['channel']['answer']();}return this['channel'][_0xc202('0xad')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xc202('0x1a8')]=function(_0x50dd62){logger[_0xc202('0x2b')](util['format'](_0xc202('0x1a9'),_0x50dd62[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x50dd62[_0xc202('0x1aa')])){return this[_0xc202('0xc')]['error'](_0x50dd62,_0xc202('0x1ab'));}var _0x30f5d4=this[_0xc202('0x1ac')][_0xc202('0x6e')](this,_0x50dd62[_0xc202('0x1aa')]);if(!this[_0xc202('0x84')](_0x30f5d4)){return this['channel']['error'](_0x50dd62,util['format'](_0xc202('0x1ad'),_0x50dd62[_0xc202('0x1aa')]));}if(_0x30f5d4===this[_0xc202('0xc')]['arg_1']){return this['channel'][_0xc202('0x2f')](_0x50dd62,_0xc202('0x1ae'));}this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x50dd62,_0x30f5d4);var _0x1c0496=this[_0xc202('0xc')]['exec']('AGI',util[_0xc202('0x26')](_0xc202('0x1af'),config[_0xc202('0x6')][_0xc202('0x1b0')]||_0xc202('0x1b1'),_0x30f5d4,this['channel'][_0xc202('0x38')]));if(_0x1c0496[_0xc202('0xa5')]===-0x1){return _0x1c0496;}return this[_0xc202('0xc')]['noop'](util[_0xc202('0x26')](_0xc202('0xc4'),'AGI',_0x30f5d4));};AGIVertices[_0xc202('0xf')][_0xc202('0x1b2')]=function(_0x4e6912){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4e6912['label']));var _0x437a73=this[_0xc202('0x54')][_0xc202('0x6e')](this,_0x4e6912['command']);this[_0xc202('0x34')][_0xc202('0x6e')](this,_0x4e6912,_0x4e6912['command']);if(this[_0xc202('0x84')](_0x4e6912[_0xc202('0xd8')])){var _0x374a84=this[_0xc202('0x10')]['sync'](this,_0x4e6912[_0xc202('0xd8')]);if(_0x374a84){this['channel'][_0xc202('0xa0')](_0x374a84,_0x437a73);return this[_0xc202('0xc')][_0xc202('0xad')](util['format'](_0xc202('0x1b3'),_0x4e6912[_0xc202('0xb7')],_0x374a84));}}return this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x1b4'),_0x4e6912['command']));};AGIVertices[_0xc202('0xf')][_0xc202('0x1b5')]=function(_0x86cb78){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x1b6'),_0x86cb78[_0xc202('0x36')]));_0x86cb78['text']=_0x86cb78[_0xc202('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc202('0x84')](_0x86cb78[_0xc202('0x58')])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0x1b7'));}if(!this['isConfigured'](_0x86cb78['text'])){return this[_0xc202('0xc')]['noop'](_0xc202('0xc7'));}this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x1b8'),_0x86cb78['text']));var _0x3ba813=this[_0xc202('0x57')][_0xc202('0x6e')](this,_0x86cb78);if(_0x3ba813){this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x1b9'),_0x3ba813));var _0x3066f0=this[_0xc202('0xc')][_0xc202('0x101')](_0x3ba813);try{fs['unlink'](_0x3ba813+_0xc202('0x102'));}catch(_0x4125d7){logger[_0xc202('0x2f')](_0x4125d7);}return _0x3066f0;}return this[_0xc202('0xc')][_0xc202('0x2f')](_0x86cb78,_0xc202('0x1ba'));};AGIVertices[_0xc202('0xf')][_0xc202('0x1bb')]=function(_0x3bc32a){logger['info'](util[_0xc202('0x26')](_0xc202('0x1bc'),_0x3bc32a[_0xc202('0x36')]));_0x3bc32a['text']=_0x3bc32a[_0xc202('0x5a')][_0xc202('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc202('0x84')](_0x3bc32a['text'])){return this[_0xc202('0xc')][_0xc202('0xad')](_0xc202('0xc7'));}this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x1bd'),_0x3bc32a['text']));var _0x19912d=this['googleTTS'][_0xc202('0x6e')](this,_0x3bc32a);if(_0x19912d){this[_0xc202('0xc')][_0xc202('0xad')](util['format'](_0xc202('0x1be'),_0x19912d));var _0x582e09=this[_0xc202('0xc')][_0xc202('0x101')](_0x19912d);try{fs['unlink'](_0x19912d+_0xc202('0x102'));}catch(_0x367f34){logger[_0xc202('0x2f')](_0x367f34);}return _0x582e09;}return this[_0xc202('0xc')][_0xc202('0x2f')](_0x3bc32a,_0xc202('0x1bf'));};AGIVertices[_0xc202('0xf')][_0xc202('0x1c0')]=function(_0xbdd258){logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x1c1'),_0xbdd258[_0xc202('0x36')]));if(!this['isConfigured'](_0xbdd258[_0xc202('0x158')])){return this['channel']['error'](_0xbdd258,'no\x20find\x20by\x20configured');}logger[_0xc202('0x2b')](util[_0xc202('0x26')](_0xc202('0x15e'),this['channel'][_0xc202('0x39')],_0xbdd258[_0xc202('0x158')]));var _0x4288df=this['agentUnpause'][_0xc202('0x6e')](this,_0xbdd258[_0xc202('0x158')]);if(_0x4288df){logger[_0xc202('0x2b')](util[_0xc202('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc202('0xc')][_0xc202('0x39')],_0xbdd258['findBy']));this['channel'][_0xc202('0xad')](util['format'](_0xc202('0x159'),this['channel'][_0xc202('0x39')],_0xbdd258['findBy']));return{'code':0xc8,'result':_0xc202('0x15a')};}else{logger['info'](util[_0xc202('0x26')](_0xc202('0x15b'),this['channel'][_0xc202('0x39')],_0xbdd258['findBy']));this[_0xc202('0xc')][_0xc202('0xad')](util[_0xc202('0x26')](_0xc202('0x15b'),this[_0xc202('0xc')][_0xc202('0x39')],_0xbdd258[_0xc202('0x158')]));return{'code':0xc8,'result':_0xc202('0x15c')};}};AGIVertices['prototype'][_0xc202('0x1c2')]=function(_0x413aa1){logger['info'](util[_0xc202('0x26')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x413aa1[_0xc202('0x36')]));var _0x20e41e=this['channel'][_0xc202('0x55')]('VOICEMAIL',[_0x413aa1[_0xc202('0x1c3')],_0x413aa1[_0xc202('0x77')]]);if(_0x20e41e[_0xc202('0xa5')]===-0x1){return _0x20e41e;}return this[_0xc202('0xc')]['noop'](util['format'](_0xc202('0xc4'),_0xc202('0x1c4'),_0x413aa1[_0xc202('0x1c3')]));};AGIVertices[_0xc202('0xf')][_0xc202('0x1c5')]=function(_0x2260ea){logger['info'](util[_0xc202('0x26')](_0xc202('0x1c6'),_0x2260ea[_0xc202('0x36')]));if(!this[_0xc202('0x84')](_0x2260ea[_0xc202('0xd8')])){return this['channel'][_0xc202('0x2f')](_0x2260ea,'no\x20variable\x20selected');}var _0x220824=this[_0xc202('0x10')][_0xc202('0x6e')](this,_0x2260ea[_0xc202('0xd8')]);if(!_0x220824){return this[_0xc202('0xc')]['error'](_0x2260ea,_0xc202('0x119'));}var _0x472a5a=this[_0xc202('0xc')][_0xc202('0x10')](_0x220824);return{'code':0xc8,'result':_0x472a5a[_0xc202('0xa3')]?_0x472a5a[_0xc202('0xa3')]:'-'};};String[_0xc202('0xf')]['replaceAll']=function(_0x116abd,_0x186a39){return this[_0xc202('0xa1')](_0x116abd)[_0xc202('0x1c7')](_0x186a39);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index cba4af6..307b454 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 _0x4821=['mandatoryDispositionPause','Action','agents','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','message','pauseType','saveUnpause','catch','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','ACW','mandatoryDisposition','name'];(function(_0x40460f,_0x4a19a5){var _0x6be019=function(_0xf4f830){while(--_0xf4f830){_0x40460f['push'](_0x40460f['shift']());}};_0x6be019(++_0x4a19a5);}(_0x4821,0xe3));var _0x1482=function(_0x39c50a,_0x3ae47f){_0x39c50a=_0x39c50a-0x0;var _0x1caa61=_0x4821[_0x39c50a];return _0x1caa61;};'use strict';var _=require(_0x1482('0x0'));var moment=require(_0x1482('0x1'));var ami=require(_0x1482('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x1482('0x3'));var RpcVoiceAgentReport=require(_0x1482('0x4'));function Acw(_0x26d204){this[_0x1482('0x5')]=_0x26d204[_0x1482('0x5')];this['agents']=_0x26d204['agents'];this[_0x1482('0x6')]=_0x26d204[_0x1482('0x6')];this['channels']={};ami['on']('agentconnect',this[_0x1482('0x7')][_0x1482('0x8')](this));ami['on'](_0x1482('0x9'),this[_0x1482('0xa')]['bind'](this));ami['on']('hangup',this[_0x1482('0xb')]['bind'](this));ami['on']('agentringnoanswer',this[_0x1482('0xc')]['bind'](this));ami['on'](_0x1482('0xd'),this[_0x1482('0xe')][_0x1482('0x8')](this));ami['on']('blindtransfer',this[_0x1482('0xf')][_0x1482('0x8')](this));ami['on'](_0x1482('0x10'),this['syncAgentConnectPreview'][_0x1482('0x8')](this));}function getDiff(_0x38f793){var _0x1c6840=moment()[_0x1482('0x11')](0x0);var _0x56f755=moment(_0x38f793)[_0x1482('0x11')](0x0);return _0x1c6840[_0x1482('0x12')](_0x56f755,_0x1482('0x13'));}Acw[_0x1482('0x14')][_0x1482('0x15')]=function(_0x5ed0c9,_0x52a1bd){var _0x1bb058=this;var _0x363867=getDiff(_0x1bb058[_0x1482('0x6')][_0x5ed0c9]['lastPauseAt']);clearTimeout(_0x1bb058[_0x1482('0x6')][_0x5ed0c9][_0x1482('0x16')]);_0x1bb058[_0x1482('0x6')][_0x5ed0c9][_0x1482('0x16')]=![];return RpcVoiceAgentReport[_0x1482('0x17')]({'acwtime':_0x363867},_0x1bb058[_0x1482('0x6')][_0x5ed0c9][_0x1482('0x18')],_0x5ed0c9)[_0x1482('0x19')](function(_0x4cb088){logger[_0x1482('0x1a')](_0x1482('0x1b'),_0x52a1bd,_0x363867,_0x4cb088);})['catch'](function(_0x2eaf8e){logger[_0x1482('0x1c')](_0x1482('0x1d'),_0x52a1bd,_0x2eaf8e);})[_0x1482('0x1e')](function(){delete _0x1bb058[_0x1482('0x6')][_0x5ed0c9];});};Acw[_0x1482('0x14')][_0x1482('0x1f')]=function(_0x592f58){try{var _0x3f5aff=this;var _0x557f73=this[_0x1482('0x20')][_0x592f58][_0x1482('0x21')];var _0x288930=this[_0x1482('0x20')][_0x592f58]['queue'];var _0x105cd9=this['voiceQueues'][_0x288930];var _0x1f7832=![];var _0x26ab6f=_0x1482('0x22');if(_0x105cd9[_0x1482('0x23')]&&_0x105cd9['mandatoryDispositionPause'][_0x1482('0x24')]){_0x1f7832=!![];_0x26ab6f=_0x105cd9[_0x1482('0x25')][_0x1482('0x24')];}return ami[_0x1482('0x26')]({'action':'QueuePause','interface':_0x557f73,'paused':!![],'reason':_0x26ab6f})[_0x1482('0x19')](function(){if(_0x3f5aff[_0x1482('0x27')][_0x557f73]){return RpcUser[_0x1482('0x28')](_0x3f5aff[_0x1482('0x27')][_0x557f73]['id'])[_0x1482('0x19')](function(_0x495c55){if(!_0x495c55||_0x495c55['voicePause']){logger['info'](_0x1482('0x29'),_0x592f58,_0x557f73,_0x288930);return;}logger[_0x1482('0x1a')](_0x1482('0x2a'),_0x592f58,_0x557f73,_0x288930);var _0x1048ef=_0x3f5aff[_0x1482('0x20')][_0x592f58][_0x1482('0x2b')]&&_0x3f5aff['channels'][_0x592f58]['destlinkedid']?_0x3f5aff[_0x1482('0x20')][_0x592f58][_0x1482('0x2c')]:_0x592f58;return RpcUser[_0x1482('0x2d')](_0x3f5aff['agents'][_0x557f73],_0x26ab6f,_0x1048ef)[_0x1482('0x19')](function(_0x3b9a9d){_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x2e')]-=0x1;_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x2f')]+=0x1;return _0x3b9a9d;});})[_0x1482('0x19')](function(_0x1e108a){if(_0x1f7832||!_0x1e108a){return;}_0x3f5aff['timers'][_0x557f73]={};logger[_0x1482('0x1a')](_0x1482('0x30'),_0x592f58,_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x31')],_0x557f73,_0x288930);_0x3f5aff[_0x1482('0x6')][_0x557f73]['timer']=setTimeout(_0x3f5aff[_0x1482('0x32')][_0x1482('0x8')](_0x3f5aff,_0x557f73),_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x31')]*0x3e8);_0x3f5aff[_0x1482('0x6')][_0x557f73][_0x1482('0x33')]=moment()[_0x1482('0x34')](_0x1482('0x35'));_0x3f5aff[_0x1482('0x6')][_0x557f73]['uniqueid']=_0x592f58;_0x3f5aff[_0x1482('0x6')][_0x557f73][_0x1482('0x36')]=_0x288930;_0x3f5aff[_0x1482('0x6')][_0x557f73][_0x1482('0x15')]=_0x3f5aff[_0x1482('0x15')][_0x1482('0x8')](_0x3f5aff,_0x557f73,_0x592f58);});}})['catch'](function(){logger[_0x1482('0x1c')](_0x1482('0x30'),_0x592f58,_0x3f5aff[_0x1482('0x5')][_0x288930]['acwTimeout'],_0x557f73,_0x288930);})[_0x1482('0x1e')](function(){delete _0x3f5aff[_0x1482('0x20')][_0x592f58];});}catch(_0x533974){logger[_0x1482('0x1c')]('[ACW][START]\x20%s',_0x533974[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0x32')]=function(_0x1b6f0c){try{var _0x1c5fb9=this;if(_0x1c5fb9[_0x1482('0x6')][_0x1b6f0c]){_0x1c5fb9[_0x1482('0x6')][_0x1b6f0c]['timer']=![];var _0x1668cf=_0x1c5fb9['timers'][_0x1b6f0c][_0x1482('0x18')];var _0x256e7f=_0x1c5fb9['timers'][_0x1b6f0c][_0x1482('0x36')];var _0x1e0f63=_0x1c5fb9['voiceQueues'][_0x256e7f][_0x1482('0x31')];logger[_0x1482('0x1a')]('[%s][TIMER][STOP][AGENT:%s]',_0x1668cf,_0x1b6f0c);RpcUser[_0x1482('0x28')](this[_0x1482('0x27')][_0x1b6f0c]['id'])[_0x1482('0x19')](function(_0x52eb0d){if(_0x52eb0d[_0x1482('0x38')]===_0x1482('0x22')){return RpcUser[_0x1482('0x39')](_0x1c5fb9[_0x1482('0x27')][_0x1b6f0c]);}});RpcVoiceAgentReport[_0x1482('0x17')]({'acwtime':_0x1e0f63,'agentacw':!![]},_0x1668cf,_0x1b6f0c)[_0x1482('0x19')](function(_0x472598){logger['info'](_0x1482('0x1b'),_0x1668cf,_0x1e0f63,_0x472598);})[_0x1482('0x3a')](function(_0x46c852){logger[_0x1482('0x1c')]('[%s][UPDATE][ERRORS:%s]',_0x1668cf,_0x46c852);});}else{logger[_0x1482('0x1c')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1b6f0c);if(_0x1c5fb9[_0x1482('0x6')]){logger[_0x1482('0x1a')](_0x1482('0x3b'),JSON['stringify'](_0x1c5fb9[_0x1482('0x6')]));}}}catch(_0x4940b5){logger[_0x1482('0x1c')](_0x1482('0x3c'),_0x4940b5['message']);}};Acw['prototype'][_0x1482('0x7')]=function(_0x1b31b7){try{if(this[_0x1482('0x5')][_0x1b31b7[_0x1482('0x36')]]&&(this[_0x1482('0x5')][_0x1b31b7[_0x1482('0x36')]][_0x1482('0x3d')]||this['voiceQueues'][_0x1b31b7[_0x1482('0x36')]][_0x1482('0x23')])){if(this['agents'][_0x1b31b7[_0x1482('0x21')]]){this[_0x1482('0x20')][_0x1b31b7[_0x1482('0x18')]]={'queue':_0x1b31b7[_0x1482('0x36')],'interface':_0x1b31b7[_0x1482('0x21')],'destlinkedid':_0x1b31b7[_0x1482('0x2c')]};}}}catch(_0x1e3be7){logger[_0x1482('0x1c')](_0x1482('0x3e'),_0x1e3be7['message']);}};Acw['prototype'][_0x1482('0x3f')]=function(_0x5a2e5c){try{if(this[_0x1482('0x5')][_0x5a2e5c[_0x1482('0x36')]]&&(this[_0x1482('0x5')][_0x5a2e5c[_0x1482('0x36')]]['acw']||this['voiceQueues'][_0x5a2e5c[_0x1482('0x36')]][_0x1482('0x23')])){if(this['agents'][_0x5a2e5c[_0x1482('0x21')]]){this[_0x1482('0x20')][_0x5a2e5c['uniqueid']]={'queue':_0x5a2e5c[_0x1482('0x36')],'interface':_0x5a2e5c[_0x1482('0x21')]};}}}catch(_0x50e1e9){logger[_0x1482('0x1c')](_0x1482('0x40'),_0x50e1e9[_0x1482('0x37')]);}};Acw[_0x1482('0x14')]['syncHangupRequest']=function(_0x7f6e96){try{if(this[_0x1482('0x20')][_0x7f6e96[_0x1482('0x18')]]&&_['isUndefined'](this[_0x1482('0x20')][_0x7f6e96[_0x1482('0x18')]][_0x1482('0x2b')])){logger[_0x1482('0x1a')](_0x1482('0x41'),_0x7f6e96[_0x1482('0x18')]);this['startAcw'](_0x7f6e96[_0x1482('0x18')]);}else if(this['channels'][_0x7f6e96[_0x1482('0x42')]]&&_['isUndefined'](this[_0x1482('0x20')][_0x7f6e96[_0x1482('0x42')]][_0x1482('0x2b')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x7f6e96[_0x1482('0x42')]);this[_0x1482('0x1f')](_0x7f6e96[_0x1482('0x42')]);}}catch(_0x1490b3){logger['error'](_0x1482('0x43'),_0x1490b3[_0x1482('0x37')]);}};Acw[_0x1482('0x14')]['syncHangup']=function(_0x50c61f){try{if(this['channels'][_0x50c61f['uniqueid']]&&this[_0x1482('0x20')][_0x50c61f[_0x1482('0x18')]][_0x1482('0x2b')]){logger[_0x1482('0x1a')](_0x1482('0x44'),_0x50c61f[_0x1482('0x18')]);this['startAcw'](_0x50c61f[_0x1482('0x18')]);}else if(this[_0x1482('0x20')][_0x50c61f[_0x1482('0x42')]]&&this['channels'][_0x50c61f['linkedid']][_0x1482('0x2b')]){logger[_0x1482('0x1a')](_0x1482('0x45'),_0x50c61f[_0x1482('0x42')]);this[_0x1482('0x1f')](_0x50c61f['linkedid']);}}catch(_0x74f4c3){logger[_0x1482('0x1c')](_0x1482('0x46'),_0x74f4c3[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0xe')]=function(_0x357123){try{if(!_[_0x1482('0x47')](this[_0x1482('0x20')][_0x357123[_0x1482('0x48')]])){this[_0x1482('0x1f')](_0x357123[_0x1482('0x48')]);if(this['channels'][_0x357123['secondtransfereruniqueid']]){this['channels'][_0x357123['secondtransfereruniqueid']][_0x1482('0x2b')]=!![];this['channels'][_0x357123[_0x1482('0x49')]]=this[_0x1482('0x20')][_0x357123[_0x1482('0x4a')]];this[_0x1482('0x4b')](_0x357123[_0x1482('0x4a')]);}}else if(!_[_0x1482('0x47')](this[_0x1482('0x20')][_0x357123[_0x1482('0x49')]])){this[_0x1482('0x1f')](_0x357123[_0x1482('0x49')]);if(this[_0x1482('0x20')][_0x357123[_0x1482('0x4c')]]){this[_0x1482('0x20')][_0x357123[_0x1482('0x4c')]][_0x1482('0x2b')]=!![];this['channels'][_0x357123[_0x1482('0x48')]]=this[_0x1482('0x20')][_0x357123[_0x1482('0x4c')]];this[_0x1482('0x4b')](_0x357123['origtransfereruniqueid']);}}}catch(_0x216d70){logger['error'](_0x1482('0x4d'),_0x216d70[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0xf')]=function(_0x20d24c){try{if(this[_0x1482('0x20')][_0x20d24c['transfereruniqueid']]){logger[_0x1482('0x1a')](_0x1482('0x4e'),JSON[_0x1482('0x4f')](_0x20d24c[_0x1482('0x50')]));this[_0x1482('0x1f')](_0x20d24c['transfereruniqueid']);}else if(this['channels'][_0x20d24c['transfererlinkedid']]){logger[_0x1482('0x1a')](_0x1482('0x51'),JSON['stringify'](_0x20d24c[_0x1482('0x52')]));this[_0x1482('0x1f')](_0x20d24c['transfererlinkedid']);}}catch(_0x3f0408){logger[_0x1482('0x1c')](_0x1482('0x53'),_0x3f0408['message']);}};Acw['prototype'][_0x1482('0xc')]=function(_0x49cb94){try{if(this[_0x1482('0x5')][_0x49cb94['queue']]&&this[_0x1482('0x5')][_0x49cb94['queue']]['autopause']===_0x1482('0x54')){if(this[_0x1482('0x27')][_0x49cb94[_0x1482('0x21')]]){logger['info'](_0x1482('0x55'),_0x49cb94['uniqueid'],_0x49cb94['interface'],_0x49cb94[_0x1482('0x36')]);return RpcUser[_0x1482('0x2d')](this[_0x1482('0x27')][_0x49cb94[_0x1482('0x21')]],_0x1482('0x56'),_0x49cb94[_0x1482('0x18')]);}}}catch(_0x10afa4){logger[_0x1482('0x1c')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x10afa4[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0x4b')]=function(_0x2b1e2c,_0x4c68e2=0x2710){if(this[_0x1482('0x20')][_0x2b1e2c]){setTimeout(()=>{delete this['channels'][_0x2b1e2c];},_0x4c68e2);}};module[_0x1482('0x57')]=Acw; \ No newline at end of file +var _0x20de=['acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','catch','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','syncAgentConnectPreview','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','startAcw','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','error','finally','queue','voiceQueues','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','available','paused','stopAcw'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x20de,0x12c));var _0xe20d=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x20de[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0xe20d('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0xe20d('0x1'))(_0xe20d('0x2'));var RpcUser=require(_0xe20d('0x3'));var RpcVoiceAgentReport=require(_0xe20d('0x4'));function Acw(_0x2eab52){this['voiceQueues']=_0x2eab52['voiceQueues'];this[_0xe20d('0x5')]=_0x2eab52[_0xe20d('0x5')];this[_0xe20d('0x6')]=_0x2eab52['timers'];this[_0xe20d('0x7')]={};ami['on'](_0xe20d('0x8'),this[_0xe20d('0x9')][_0xe20d('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on']('hangup',this['syncHangup'][_0xe20d('0xa')](this));ami['on'](_0xe20d('0xb'),this[_0xe20d('0xc')][_0xe20d('0xa')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xe20d('0xa')](this));ami['on'](_0xe20d('0xd'),this[_0xe20d('0xe')]['bind'](this));ami['on'](_0xe20d('0xf'),this['syncAgentConnectPreview'][_0xe20d('0xa')](this));}function getDiff(_0x3877d7){var _0x2972d7=moment()['milliseconds'](0x0);var _0x49cb8e=moment(_0x3877d7)[_0xe20d('0x10')](0x0);return _0x2972d7[_0xe20d('0x11')](_0x49cb8e,_0xe20d('0x12'));}Acw[_0xe20d('0x13')][_0xe20d('0x14')]=function(_0x3db7ef,_0x8fcfd9){var _0x254d01=this;var _0x159b68=getDiff(_0x254d01[_0xe20d('0x6')][_0x3db7ef][_0xe20d('0x15')]);clearTimeout(_0x254d01[_0xe20d('0x6')][_0x3db7ef][_0xe20d('0x16')]);_0x254d01[_0xe20d('0x6')][_0x3db7ef][_0xe20d('0x16')]=![];return RpcVoiceAgentReport[_0xe20d('0x17')]({'acwtime':_0x159b68},_0x254d01[_0xe20d('0x6')][_0x3db7ef]['uniqueid'],_0x3db7ef)[_0xe20d('0x18')](function(_0x3b3fbd){logger[_0xe20d('0x19')](_0xe20d('0x1a'),_0x8fcfd9,_0x159b68,_0x3b3fbd);})['catch'](function(_0x2995b9){logger[_0xe20d('0x1b')]('[%s][UPDATE][ERRORS:%s]',_0x8fcfd9,_0x2995b9);})[_0xe20d('0x1c')](function(){delete _0x254d01[_0xe20d('0x6')][_0x3db7ef];});};Acw[_0xe20d('0x13')]['startAcw']=function(_0x37aef8){try{var _0x11db98=this;var _0x22473e=this[_0xe20d('0x7')][_0x37aef8]['interface'];var _0x572d56=this[_0xe20d('0x7')][_0x37aef8][_0xe20d('0x1d')];var _0x94f141=this[_0xe20d('0x1e')][_0x572d56];var _0x16eb8a=![];var _0x4045a3=_0xe20d('0x1f');if(_0x94f141[_0xe20d('0x20')]&&_0x94f141['mandatoryDispositionPause'][_0xe20d('0x21')]){_0x16eb8a=!![];_0x4045a3=_0x94f141[_0xe20d('0x22')][_0xe20d('0x21')];}return ami[_0xe20d('0x23')]({'action':_0xe20d('0x24'),'interface':_0x22473e,'paused':!![],'reason':_0x4045a3})['then'](function(){if(_0x11db98[_0xe20d('0x5')][_0x22473e]){return RpcUser['getAgent'](_0x11db98[_0xe20d('0x5')][_0x22473e]['id'])[_0xe20d('0x18')](function(_0x4a016e){if(!_0x4a016e||_0x4a016e[_0xe20d('0x25')]){logger[_0xe20d('0x19')](_0xe20d('0x26'),_0x37aef8,_0x22473e,_0x572d56);return;}logger['info'](_0xe20d('0x27'),_0x37aef8,_0x22473e,_0x572d56);var _0x1ce105=_0x11db98[_0xe20d('0x7')][_0x37aef8]['attended']&&_0x11db98[_0xe20d('0x7')][_0x37aef8][_0xe20d('0x28')]?_0x11db98[_0xe20d('0x7')][_0x37aef8][_0xe20d('0x28')]:_0x37aef8;return RpcUser['savePause'](_0x11db98[_0xe20d('0x5')][_0x22473e],_0x4045a3,_0x1ce105)[_0xe20d('0x18')](function(_0x2867d7){_0x11db98[_0xe20d('0x1e')][_0x572d56][_0xe20d('0x29')]-=0x1;_0x11db98[_0xe20d('0x1e')][_0x572d56][_0xe20d('0x2a')]+=0x1;return _0x2867d7;});})[_0xe20d('0x18')](function(_0x2ef808){if(_0x16eb8a||!_0x2ef808){return;}_0x11db98[_0xe20d('0x6')][_0x22473e]={};logger[_0xe20d('0x19')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x37aef8,_0x11db98[_0xe20d('0x1e')][_0x572d56]['acwTimeout'],_0x22473e,_0x572d56);_0x11db98[_0xe20d('0x6')][_0x22473e][_0xe20d('0x16')]=setTimeout(_0x11db98[_0xe20d('0x2b')][_0xe20d('0xa')](_0x11db98,_0x22473e),_0x11db98[_0xe20d('0x1e')][_0x572d56][_0xe20d('0x2c')]*0x3e8);_0x11db98[_0xe20d('0x6')][_0x22473e][_0xe20d('0x15')]=moment()[_0xe20d('0x2d')](_0xe20d('0x2e'));_0x11db98[_0xe20d('0x6')][_0x22473e][_0xe20d('0x2f')]=_0x37aef8;_0x11db98[_0xe20d('0x6')][_0x22473e][_0xe20d('0x1d')]=_0x572d56;_0x11db98[_0xe20d('0x6')][_0x22473e]['updateAcw']=_0x11db98[_0xe20d('0x14')]['bind'](_0x11db98,_0x22473e,_0x37aef8);});}})[_0xe20d('0x30')](function(){logger[_0xe20d('0x1b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x37aef8,_0x11db98[_0xe20d('0x1e')][_0x572d56][_0xe20d('0x2c')],_0x22473e,_0x572d56);})['finally'](function(){delete _0x11db98[_0xe20d('0x7')][_0x37aef8];});}catch(_0x311cf9){logger[_0xe20d('0x1b')](_0xe20d('0x31'),_0x311cf9[_0xe20d('0x32')]);}};Acw[_0xe20d('0x13')][_0xe20d('0x2b')]=function(_0x5e633e){try{var _0x51d462=this;if(_0x51d462[_0xe20d('0x6')][_0x5e633e]){_0x51d462[_0xe20d('0x6')][_0x5e633e]['timer']=![];var _0x20f937=_0x51d462['timers'][_0x5e633e]['uniqueid'];var _0x1d302e=_0x51d462[_0xe20d('0x6')][_0x5e633e][_0xe20d('0x1d')];var _0x3e75be=_0x51d462[_0xe20d('0x1e')][_0x1d302e]['acwTimeout'];logger[_0xe20d('0x19')](_0xe20d('0x33'),_0x20f937,_0x5e633e);RpcUser[_0xe20d('0x34')](this['agents'][_0x5e633e]['id'])[_0xe20d('0x18')](function(_0x4fc020){if(_0x4fc020[_0xe20d('0x35')]===_0xe20d('0x1f')){return RpcUser[_0xe20d('0x36')](_0x51d462[_0xe20d('0x5')][_0x5e633e]);}});RpcVoiceAgentReport['update']({'acwtime':_0x3e75be,'agentacw':!![]},_0x20f937,_0x5e633e)[_0xe20d('0x18')](function(_0x25f232){logger[_0xe20d('0x19')]('[%s][UPDATE][ACWTIME:%s]',_0x20f937,_0x3e75be,_0x25f232);})[_0xe20d('0x30')](function(_0x259f00){logger[_0xe20d('0x1b')]('[%s][UPDATE][ERRORS:%s]',_0x20f937,_0x259f00);});}else{logger[_0xe20d('0x1b')](_0xe20d('0x37'),_0x5e633e);if(_0x51d462['timers']){logger[_0xe20d('0x19')](_0xe20d('0x38'),JSON[_0xe20d('0x39')](_0x51d462[_0xe20d('0x6')]));}}}catch(_0xcd1a26){logger[_0xe20d('0x1b')](_0xe20d('0x3a'),_0xcd1a26[_0xe20d('0x32')]);}};Acw[_0xe20d('0x13')]['syncAgentConnect']=function(_0x8a8bf2){try{if(this[_0xe20d('0x1e')][_0x8a8bf2[_0xe20d('0x1d')]]&&(this[_0xe20d('0x1e')][_0x8a8bf2['queue']][_0xe20d('0x2')]||this[_0xe20d('0x1e')][_0x8a8bf2[_0xe20d('0x1d')]]['mandatoryDisposition'])){if(this[_0xe20d('0x5')][_0x8a8bf2[_0xe20d('0x3b')]]){this[_0xe20d('0x7')][_0x8a8bf2[_0xe20d('0x2f')]]={'queue':_0x8a8bf2[_0xe20d('0x1d')],'interface':_0x8a8bf2[_0xe20d('0x3b')],'destlinkedid':_0x8a8bf2[_0xe20d('0x28')]};}}}catch(_0x27ded5){logger[_0xe20d('0x1b')]('[ACW][syncAgentConnect]\x20%s',_0x27ded5[_0xe20d('0x32')]);}};Acw[_0xe20d('0x13')][_0xe20d('0x3c')]=function(_0x9ce9c){try{if(this['voiceQueues'][_0x9ce9c['queue']]&&(this[_0xe20d('0x1e')][_0x9ce9c[_0xe20d('0x1d')]]['acw']||this[_0xe20d('0x1e')][_0x9ce9c[_0xe20d('0x1d')]][_0xe20d('0x20')])){if(this[_0xe20d('0x5')][_0x9ce9c[_0xe20d('0x3b')]]){this[_0xe20d('0x7')][_0x9ce9c[_0xe20d('0x2f')]]={'queue':_0x9ce9c[_0xe20d('0x1d')],'interface':_0x9ce9c[_0xe20d('0x3b')]};}}}catch(_0x258557){logger[_0xe20d('0x1b')]('[ACW][syncAgentConnectPreview]\x20%s',_0x258557[_0xe20d('0x32')]);}};Acw[_0xe20d('0x13')][_0xe20d('0x3d')]=function(_0x4597bb){try{if(this['channels'][_0x4597bb[_0xe20d('0x2f')]]&&_[_0xe20d('0x3e')](this[_0xe20d('0x7')][_0x4597bb['uniqueid']][_0xe20d('0x3f')])){logger[_0xe20d('0x19')]('[%s][HANGUP:UNIQUEID]',_0x4597bb[_0xe20d('0x2f')]);this['startAcw'](_0x4597bb['uniqueid']);}else if(this[_0xe20d('0x7')][_0x4597bb[_0xe20d('0x40')]]&&_[_0xe20d('0x3e')](this[_0xe20d('0x7')][_0x4597bb[_0xe20d('0x40')]]['attended'])){logger[_0xe20d('0x19')](_0xe20d('0x41'),_0x4597bb[_0xe20d('0x40')]);this[_0xe20d('0x42')](_0x4597bb['linkedid']);}}catch(_0x12ceb3){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x12ceb3['message']);}};Acw[_0xe20d('0x13')][_0xe20d('0x43')]=function(_0x2d4eb8){try{if(this[_0xe20d('0x7')][_0x2d4eb8['uniqueid']]&&this[_0xe20d('0x7')][_0x2d4eb8[_0xe20d('0x2f')]][_0xe20d('0x3f')]){logger[_0xe20d('0x19')](_0xe20d('0x44'),_0x2d4eb8[_0xe20d('0x2f')]);this[_0xe20d('0x42')](_0x2d4eb8[_0xe20d('0x2f')]);}else if(this['channels'][_0x2d4eb8[_0xe20d('0x40')]]&&this[_0xe20d('0x7')][_0x2d4eb8[_0xe20d('0x40')]][_0xe20d('0x3f')]){logger[_0xe20d('0x19')](_0xe20d('0x45'),_0x2d4eb8[_0xe20d('0x40')]);this[_0xe20d('0x42')](_0x2d4eb8[_0xe20d('0x40')]);}}catch(_0x21f556){logger[_0xe20d('0x1b')](_0xe20d('0x46'),_0x21f556[_0xe20d('0x32')]);}};Acw[_0xe20d('0x13')]['syncAttendedTransfer']=function(_0x2cfff7){try{if(!_['isNil'](this[_0xe20d('0x7')][_0x2cfff7['transfereeuniqueid']])){this[_0xe20d('0x42')](_0x2cfff7[_0xe20d('0x47')]);if(this[_0xe20d('0x7')][_0x2cfff7['secondtransfereruniqueid']]){this[_0xe20d('0x7')][_0x2cfff7[_0xe20d('0x48')]][_0xe20d('0x3f')]=!![];this[_0xe20d('0x7')][_0x2cfff7['transfertargetuniqueid']]=this[_0xe20d('0x7')][_0x2cfff7[_0xe20d('0x48')]];this[_0xe20d('0x49')](_0x2cfff7[_0xe20d('0x48')]);}}else if(!_['isNil'](this[_0xe20d('0x7')][_0x2cfff7['transfertargetuniqueid']])){this[_0xe20d('0x42')](_0x2cfff7['transfertargetuniqueid']);if(this['channels'][_0x2cfff7[_0xe20d('0x4a')]]){this[_0xe20d('0x7')][_0x2cfff7[_0xe20d('0x4a')]]['attended']=!![];this['channels'][_0x2cfff7[_0xe20d('0x47')]]=this['channels'][_0x2cfff7['origtransfereruniqueid']];this[_0xe20d('0x49')](_0x2cfff7[_0xe20d('0x4a')]);}}}catch(_0x5393a0){logger[_0xe20d('0x1b')](_0xe20d('0x4b'),_0x5393a0[_0xe20d('0x32')]);}};Acw['prototype'][_0xe20d('0xe')]=function(_0x2cba32){try{if(this[_0xe20d('0x7')][_0x2cba32['transfereruniqueid']]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xe20d('0x39')](_0x2cba32['transfereruniqueid']));this[_0xe20d('0x42')](_0x2cba32[_0xe20d('0x4c')]);}else if(this['channels'][_0x2cba32['transfererlinkedid']]){logger['info'](_0xe20d('0x4d'),JSON['stringify'](_0x2cba32[_0xe20d('0x4e')]));this[_0xe20d('0x42')](_0x2cba32[_0xe20d('0x4e')]);}}catch(_0x5e46fa){logger[_0xe20d('0x1b')](_0xe20d('0x4f'),_0x5e46fa[_0xe20d('0x32')]);}};Acw[_0xe20d('0x13')][_0xe20d('0xc')]=function(_0x3d3584){try{if(this[_0xe20d('0x1e')][_0x3d3584[_0xe20d('0x1d')]]&&this[_0xe20d('0x1e')][_0x3d3584[_0xe20d('0x1d')]][_0xe20d('0x50')]===_0xe20d('0x51')){if(this[_0xe20d('0x5')][_0x3d3584[_0xe20d('0x3b')]]){logger[_0xe20d('0x19')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3d3584[_0xe20d('0x2f')],_0x3d3584[_0xe20d('0x3b')],_0x3d3584['queue']);return RpcUser[_0xe20d('0x52')](this['agents'][_0x3d3584[_0xe20d('0x3b')]],_0xe20d('0x53'),_0x3d3584[_0xe20d('0x2f')]);}}}catch(_0x2df2b0){logger[_0xe20d('0x1b')](_0xe20d('0x54'),_0x2df2b0[_0xe20d('0x32')]);}};Acw[_0xe20d('0x13')][_0xe20d('0x49')]=function(_0x404944,_0x5e4ade=0x2710){if(this['channels'][_0x404944]){setTimeout(()=>{delete this[_0xe20d('0x7')][_0x404944];},_0x5e4ade);}};module[_0xe20d('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d165c28..feaf318 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 _0x4405=['bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','exports','asterisk-manager'];(function(_0x437fc7,_0x58370f){var _0x79fd67=function(_0x58c1e3){while(--_0x58c1e3){_0x437fc7['push'](_0x437fc7['shift']());}};_0x79fd67(++_0x58370f);}(_0x4405,0x1d3));var _0x5440=function(_0x8dc5bf,_0x1b6ca6){_0x8dc5bf=_0x8dc5bf-0x0;var _0x58837b=_0x4405[_0x8dc5bf];return _0x58837b;};'use strict';var Manager=require(_0x5440('0x0'));var BPromise=require(_0x5440('0x1'));var util=require(_0x5440('0x2'));var logger=require(_0x5440('0x3'))(_0x5440('0x4'));var config=require(_0x5440('0x5'));var ami=new Manager(config[_0x5440('0x6')][_0x5440('0x7')],config[_0x5440('0x6')]['ip'],config[_0x5440('0x6')]['username'],config[_0x5440('0x6')]['password'],!![]);ami[_0x5440('0x8')]();ami[_0x5440('0x9')]=BPromise[_0x5440('0xa')](ami[_0x5440('0xb')]);function error(_0x4ee82c){logger[_0x5440('0xc')](util['format'](_0x5440('0xd'),config['asterisk'][_0x5440('0xe')],config['asterisk']['ip'],config[_0x5440('0x6')]['port'],util[_0x5440('0xf')](_0x4ee82c,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x5440('0x6')][_0x5440('0xe')],config['asterisk']['ip'],config[_0x5440('0x6')][_0x5440('0x7')]));}ami[_0x5440('0x10')]=function(){return function(){return ami[_0x5440('0x9')]({'action':_0x5440('0x11')});};};ami[_0x5440('0x12')]=function(){return function(){return ami[_0x5440('0x9')]({'action':_0x5440('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x5440('0x14')});};};ami[_0x5440('0x15')]=function(){return function(){return ami[_0x5440('0x9')]({'action':'queuesummary'});};};ami[_0x5440('0x16')]=function(){return function(){return ami[_0x5440('0x9')]({'action':_0x5440('0x17')});};};function connect(){logger[_0x5440('0x18')](util[_0x5440('0x19')](_0x5440('0x1a'),config[_0x5440('0x6')][_0x5440('0xe')],config[_0x5440('0x6')]['ip'],config['asterisk'][_0x5440('0x7')]));ami[_0x5440('0x1b')](_0x5440('0xc'),error);ami[_0x5440('0x1b')](_0x5440('0x1c'),close);}ami['on'](_0x5440('0x1d'),connect);ami['on']('shutdown',function(_0x24a717){logger[_0x5440('0x18')](util[_0x5440('0x19')](_0x5440('0x1e'),config[_0x5440('0x6')]['username'],config[_0x5440('0x6')]['ip'],config['asterisk'][_0x5440('0x7')],util[_0x5440('0xf')](_0x24a717,![],null)));});ami['on'](_0x5440('0x1f'),function(){logger[_0x5440('0x18')](util[_0x5440('0x19')](_0x5440('0x20'),config[_0x5440('0x6')][_0x5440('0xe')],config[_0x5440('0x6')]['ip'],config[_0x5440('0x6')][_0x5440('0x7')]));return Promise[_0x5440('0x21')]()[_0x5440('0x22')](ami['actionSipShowRegistry']())['then'](ami[_0x5440('0x12')]())['then'](ami[_0x5440('0x23')]())[_0x5440('0x22')](ami[_0x5440('0x15')]())[_0x5440('0x22')](ami[_0x5440('0x16')]())[_0x5440('0x24')](function(_0x4a30a0){logger[_0x5440('0xc')](_0x5440('0x25'),util[_0x5440('0xf')](_0x4a30a0,{'showHidden':![],'depth':null}));});});ami[_0x5440('0x1b')]('error',error);ami[_0x5440('0x1b')](_0x5440('0x1c'),close);module[_0x5440('0x26')]=ami; \ No newline at end of file +var _0xcc7c=['then','catch','[ami.js][fullybooted]','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','port','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve'];(function(_0x1a68e4,_0x525fee){var _0x895960=function(_0x400842){while(--_0x400842){_0x1a68e4['push'](_0x1a68e4['shift']());}};_0x895960(++_0x525fee);}(_0xcc7c,0x176));var _0xccc7=function(_0x21e1ca,_0x1e7727){_0x21e1ca=_0x21e1ca-0x0;var _0x2e6a1a=_0xcc7c[_0x21e1ca];return _0x2e6a1a;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xccc7('0x0'));var util=require(_0xccc7('0x1'));var logger=require(_0xccc7('0x2'))(_0xccc7('0x3'));var config=require(_0xccc7('0x4'));var ami=new Manager(config[_0xccc7('0x5')]['port'],config[_0xccc7('0x5')]['ip'],config['asterisk'][_0xccc7('0x6')],config[_0xccc7('0x5')][_0xccc7('0x7')],!![]);ami['keepConnected']();ami[_0xccc7('0x8')]=BPromise[_0xccc7('0x9')](ami[_0xccc7('0xa')]);function error(_0xf174c2){logger[_0xccc7('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xccc7('0x6')],config['asterisk']['ip'],config[_0xccc7('0x5')]['port'],util['inspect'](_0xf174c2,![],null)));}function close(){logger[_0xccc7('0xb')](util[_0xccc7('0xc')](_0xccc7('0xd'),config[_0xccc7('0x5')][_0xccc7('0x6')],config[_0xccc7('0x5')]['ip'],config['asterisk']['port']));}ami[_0xccc7('0xe')]=function(){return function(){return ami[_0xccc7('0x8')]({'action':'sipshowregistry'});};};ami[_0xccc7('0xf')]=function(){return function(){return ami[_0xccc7('0x8')]({'action':'devicestatelist'});};};ami[_0xccc7('0x10')]=function(){return function(){return ami[_0xccc7('0x8')]({'action':_0xccc7('0x11')});};};ami[_0xccc7('0x12')]=function(){return function(){return ami['Action']({'action':_0xccc7('0x13')});};};ami[_0xccc7('0x14')]=function(){return function(){return ami['Action']({'action':_0xccc7('0x15')});};};function connect(){logger['info'](util[_0xccc7('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xccc7('0x5')]['username'],config[_0xccc7('0x5')]['ip'],config[_0xccc7('0x5')][_0xccc7('0x16')]));ami[_0xccc7('0x17')]('error',error);ami[_0xccc7('0x17')](_0xccc7('0x18'),close);}ami['on'](_0xccc7('0x19'),connect);ami['on'](_0xccc7('0x1a'),function(_0x5d64b4){logger[_0xccc7('0x1b')](util[_0xccc7('0xc')](_0xccc7('0x1c'),config['asterisk'][_0xccc7('0x6')],config[_0xccc7('0x5')]['ip'],config[_0xccc7('0x5')][_0xccc7('0x16')],util[_0xccc7('0x1d')](_0x5d64b4,![],null)));});ami['on'](_0xccc7('0x1e'),function(){logger['info'](util[_0xccc7('0xc')](_0xccc7('0x1f'),config['asterisk'][_0xccc7('0x6')],config[_0xccc7('0x5')]['ip'],config[_0xccc7('0x5')][_0xccc7('0x16')]));return Promise[_0xccc7('0x20')]()['then'](ami['actionSipShowRegistry']())[_0xccc7('0x21')](ami[_0xccc7('0xf')]())['then'](ami['actionSipPeerStatus']())[_0xccc7('0x21')](ami['actionQueueSummary']())['then'](ami[_0xccc7('0x14')]())[_0xccc7('0x22')](function(_0x3e7f0d){logger['error'](_0xccc7('0x23'),util[_0xccc7('0x1d')](_0x3e7f0d,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami['once']('close',close);module[_0xccc7('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 39bdb30..e12fb4c 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xcb91[_0x13ce0c];return _0x4388fb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x4d3681,_0x136f19){var _0x22c7ac=function(_0x3c6120){while(--_0x3c6120){_0x4d3681['push'](_0x4d3681['shift']());}};_0x22c7ac(++_0x136f19);}(_0xf4eb,0xec));var _0xbf4e=function(_0x55e05c,_0x2f522e){_0x55e05c=_0x55e05c-0x0;var _0x4e262b=_0xf4eb[_0x55e05c];return _0x4e262b;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index bb49e59..4b83435 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 _0x6bc9=['[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','[checkContactBlack]','getSeconds','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','originated','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','Contact','[actionOriginateIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','emptyContact','[actionOriginate]\x20','checkIsBlackList','[handlePower]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','countReScheduled','[actionOriginatePredictive]','--------\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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','is\x20not\x20active','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','content','true','Action','iftime\x20%s,%s','indexOf','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','\x20Interval\x20is\x20overtime:\x20','queue','uniqueId','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','CampaignId','Drop','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','ContactId','ListId','VoiceQueueId','[rescheduleContact][Abandoned]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','queueBooked','idHopper','run','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','finally','[booked][RR][finaly]','[booked][unlock2]','rescheduleContact','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','responsetime','response','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','[syncVarSet]','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','buildObj','countcongestionretry','countagentrejectretry','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','outboundAnswerAgiCallsDay','AnswerAGI','AGI','[syncHangup2]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','statusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','online','handlePreviewRecallNotifications','map','user:%s','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','enqueue','[clearZombieChannels]','[Dialer][checkChannel]','getVoiceQueueRtPauses','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','getCaller','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-CAMPAIGNID','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originate][error]','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject'];(function(_0x3e9d4b,_0x154bbe){var _0x51f812=function(_0x5e620e){while(--_0x5e620e){_0x3e9d4b['push'](_0x3e9d4b['shift']());}};_0x51f812(++_0x154bbe);}(_0x6bc9,0x6f));var _0x96bc=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x6bc9[_0x786e9];return _0x1f891b;};'use strict';var util=require(_0x96bc('0x0'));var _=require(_0x96bc('0x1'));var uuid=require(_0x96bc('0x2'));var moment=require(_0x96bc('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x96bc('0x4'));var hopperUtils=require(_0x96bc('0x5'));var ut=require('../preview/util/util');var config=require(_0x96bc('0x6'));var logger=require('../../../config/logger')(_0x96bc('0x7'));var loggerBooked=require(_0x96bc('0x8'))(_0x96bc('0x9'));var loggerPredictive=require(_0x96bc('0x8'))(_0x96bc('0xa'));var loggerPredictiveCalls=require(_0x96bc('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x96bc('0x8'))(_0x96bc('0xb'));var ami=require('../ami');config[_0x96bc('0xc')]=_[_0x96bc('0xd')](config[_0x96bc('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x96bc('0xe'))(new Redis(config[_0x96bc('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x96bc('0xf'));var RpcSetting=require(_0x96bc('0x10'));var Interval=require(_0x96bc('0x11'));var Action=require(_0x96bc('0x12'));var History=require(_0x96bc('0x13'));var Final=require(_0x96bc('0x14'));var AgentComplete=require(_0x96bc('0x15'));var QueueCallerAbandon=require(_0x96bc('0x16'));var Hangup=require(_0x96bc('0x17'));var ipAgi=process[_0x96bc('0x18')][_0x96bc('0x19')]||_0x96bc('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x96bc('0x1b')]['enqueue']=function(_0x124454){this[_0x96bc('0x1c')]=this[_0x96bc('0x1c')]?this[_0x96bc('0x1c')]['finally'](_0x124454):_0x124454();};function Dialer(_0x479235,_0x3a2dad){this[_0x96bc('0x1d')]=new Sequence();this[_0x96bc('0x1e')]=_0x3a2dad;this[_0x96bc('0x1f')]=_0x479235['voiceQueues'];this[_0x96bc('0x20')]=_0x479235[_0x96bc('0x20')];this[_0x96bc('0x21')]=_0x479235[_0x96bc('0x21')];this[_0x96bc('0x22')]=_0x479235[_0x96bc('0x22')];this[_0x96bc('0x23')]=config['maxNumberOriginate']||0x2;this[_0x96bc('0x24')]={};this['actions']={};this[_0x96bc('0x25')]={};this['uniqueId']={};this[_0x96bc('0x26')]={};this[_0x96bc('0x27')]={};this[_0x96bc('0x28')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};this[_0x96bc('0x29')]={};ami['on'](_0x96bc('0x2a'),this[_0x96bc('0x2b')][_0x96bc('0x2c')](this));ami['on'](_0x96bc('0x2d'),this[_0x96bc('0x2e')][_0x96bc('0x2c')](this));ami['on'](_0x96bc('0x2f'),this['syncOriginateResponse'][_0x96bc('0x2c')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x96bc('0x2c')](this));ami['on'](_0x96bc('0x30'),this[_0x96bc('0xb')]['bind'](this));ami['on'](_0x96bc('0x31'),this[_0x96bc('0x32')]['bind'](this));ami['on'](_0x96bc('0x33'),this['syncHangup']['bind'](this));ami['on'](_0x96bc('0x34'),this[_0x96bc('0x35')]['bind'](this));ami['on'](_0x96bc('0x36'),this[_0x96bc('0x37')][_0x96bc('0x2c')](this));ami['on']('queuemember',this['syncQueueMember'][_0x96bc('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x96bc('0x38')]['bind'](this));this[_0x96bc('0x39')]();this['loopClearZombieChannels']();RpcSetting[_0x96bc('0x3a')]()[_0x96bc('0x3b')](function(_0x173fef){previewRecallmeReminderInterval=_0x173fef[_0x96bc('0x3c')];});}function isNotNull(_0x52ef0a){return _0x52ef0a!==null&&!_[_0x96bc('0x3d')](_0x52ef0a);}function msgResponse(_0xd7d35a,_0x577c0f,_0xa5b8){return{'action':_0xd7d35a,'response':_0x577c0f,'message':_0xa5b8,'stack':_0xa5b8};}function emit(_0x1c9f87,_0x7c25e9,_0x27bea0){io['to'](_0x1c9f87)[_0x96bc('0x3e')](_0x7c25e9,_0x27bea0);}function emitOutboundVoiceQueueSummary(_0x29cec2){if(_0x29cec2[_0x96bc('0x3f')]===_0x96bc('0x40')){logger[_0x96bc('0x41')](_0x96bc('0x42'),util[_0x96bc('0x43')](_0x29cec2,{'showHidden':![],'depth':null}));emit(util[_0x96bc('0x44')](_0x96bc('0x45'),_0x29cec2['name']),'voice_queue:save',_0x29cec2);}}function checkGetDataPredictive(_0x12fc28){if(isNotNull(_0x12fc28)&&!_[_0x96bc('0x46')](_0x12fc28)){loggerPredictive['info'](_0x96bc('0x47'));loggerPredictive[_0x96bc('0x48')](_0x96bc('0x49'),_0x12fc28[_0x96bc('0x4a')]);loggerPredictive[_0x96bc('0x48')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12fc28[_0x96bc('0x4b')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x4c'),_0x12fc28[_0x96bc('0x4d')]);loggerPredictive['info'](_0x96bc('0x4e'),_0x12fc28[_0x96bc('0x4f')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x50'),_0x12fc28[_0x96bc('0x51')]);loggerPredictive['info'](_0x96bc('0x52'),_0x12fc28[_0x96bc('0x53')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));if(_0x12fc28[_0x96bc('0x4a')]>0x0){if(!_[_0x96bc('0x3d')](_0x12fc28['predictiveIntervalAvgTalktime'])&&_0x12fc28['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x96bc('0x55'));if(!_['isUndefined'](_0x12fc28[_0x96bc('0x51')])&&_0x12fc28[_0x96bc('0x51')]>0x0){return!![];}loggerPredictive['info'](_0x96bc('0x56'));}else{loggerPredictive[_0x96bc('0x48')](_0x96bc('0x57'));}}else{loggerPredictive['info'](_0x96bc('0x58'));}return![];}function mergeDataErlangB(_0x14b81d){return function(_0x21d2f3){loggerPredictive[_0x96bc('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x96bc('0x48')](_0x96bc('0x59'),_0x21d2f3['erlangCalls']);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x5a'),_0x21d2f3['erlangCallToSecond']);loggerPredictive[_0x96bc('0x48')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21d2f3['erlangAbandonmentRate']);loggerPredictive[_0x96bc('0x48')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21d2f3[_0x96bc('0x5b')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x5c'),_0x21d2f3[_0x96bc('0x5d')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));_[_0x96bc('0x5e')](_0x14b81d,_0x21d2f3);};}function ifInterval(_0x1ca088,_0x23b388){if(_[_0x96bc('0x3d')](_0x23b388)){return![];}return utils['getSeconds'](undefined,_0x23b388)<_0x1ca088*0x3c;}function clearPredictiveAttributes(_0x3b43de){if(_0x3b43de[_0x96bc('0x28')]){_0x3b43de[_0x96bc('0x28')]=undefined;loggerPredictive[_0x96bc('0x41')](_0x3b43de[_0x96bc('0x5f')],_0x96bc('0x60'));}if(_0x3b43de[_0x96bc('0x27')]){_0x3b43de[_0x96bc('0x27')]=undefined;loggerPredictive[_0x96bc('0x41')](_0x3b43de['name'],_0x96bc('0x61'));}if(_0x3b43de[_0x96bc('0x62')]){clearInterval(_0x3b43de['handlePredictive']);_0x3b43de[_0x96bc('0x62')]=undefined;loggerPredictive[_0x96bc('0x41')](_0x3b43de[_0x96bc('0x5f')],_0x96bc('0x63'));}}function loggerCatchPredictive(_0x2db083,_0x24ff5d){return function(_0x54637e){loggerPredictive[_0x96bc('0x64')](_0x24ff5d[_0x96bc('0x5f')],_0x2db083);loggerPredictive[_0x96bc('0x64')](_0x54637e['stack']);clearPredictiveAttributes(_0x24ff5d);};}function loggerCatch(_0x578525){return function(_0x577e7c){logger[_0x96bc('0x64')](_0x578525,util[_0x96bc('0x43')](_0x577e7c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x20529b){return function(_0xda6f41){if(isNotNull(_0xda6f41)&&isNotNull(_0xda6f41[0x0])){if(_0xda6f41[0x0][_0x96bc('0x65')]>0x0){_0x20529b['message']=utils[_0x96bc('0x66')][_0x96bc('0x67')];logger[_0x96bc('0x48')](_0x96bc('0x68')+_0x20529b[_0x96bc('0x5f')],_0xda6f41[0x0][_0x96bc('0x65')],_0x96bc('0x69'));}else{_0x20529b[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x6b')];logger[_0x96bc('0x48')](_0x96bc('0x6c')+_0x20529b[_0x96bc('0x5f')]);}}};}function createObjHistory(_0x10205c,_0x4dcd13,_0x307360,_0x58c4b3,_0x36ae1f){_0x10205c[_0x96bc('0x6a')]=_0x307360;var _0x25414a=new Action(_0x10205c,_0x4dcd13);var _0xe51053=new History(_0x25414a);_0xe51053['state']=_0x58c4b3;_0xe51053[_0x96bc('0x6d')]=_0x36ae1f;_0xe51053[_0x96bc('0x6e')]=_0x25414a[_0x96bc('0x6f')];return _0xe51053;}function unlockQueueStatus(_0x8ab052,_0x4af223){setTimeout(function(){if(_['isUndefined'](_0x8ab052[_0x96bc('0x70')])){loggerBooked[_0x96bc('0x64')](_0x96bc('0x71'),_0x4af223);}_0x8ab052[_0x96bc('0x70')]=!![];loggerBooked[_0x96bc('0x48')](_0x96bc('0x72'),_0x4af223,JSON[_0x96bc('0x73')](_[_0x96bc('0x74')](_0x8ab052,[_0x96bc('0x5f'),_0x96bc('0x70')])));},0x1f3);}function checkInterval(_0x5d5856){return function(){if(!isNotNull(_0x5d5856[_0x96bc('0x75')])){_0x5d5856[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x76')];throw _0x5d5856[_0x96bc('0x5f')]+_0x96bc('0x77');}if(!isNotNull(_0x5d5856[_0x96bc('0x75')][_0x96bc('0x78')])){_0x5d5856[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x76')];throw _0x5d5856[_0x96bc('0x5f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x5d5856[_0x96bc('0x75')][_0x96bc('0x78')]))){_0x5d5856[_0x96bc('0x6a')]=utils[_0x96bc('0x66')]['NULL_INTERVAL'];throw _0x5d5856[_0x96bc('0x5f')]+_0x96bc('0x77');}};}function checkIsIVRCampaignActive(_0x4123b8){return function(){if(!utils[_0x96bc('0x79')](_0x4123b8)){_0x4123b8[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x7a')];throw _0x4123b8[_0x96bc('0x5f')]+_0x96bc('0x7b');}};}function emitCampaignSummary(_0x4e6ca1){if(utils[_0x96bc('0x7c')](_0x4e6ca1)){emit(util[_0x96bc('0x44')](_0x96bc('0x7d'),_0x4e6ca1[_0x96bc('0x5f')]),_0x96bc('0x7e'),_0x4e6ca1);}}function loggerCatchQueueSummary(_0x122a86,_0x5a085a){return function(_0x4906f0){clearPredictiveAttributes(_0x5a085a);emitCampaignSummary(_0x5a085a);loggerSyncQueueSummary[_0x96bc('0x41')](_0x122a86,util[_0x96bc('0x43')](_0x4906f0,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x238f12){if(_0x238f12[_0x96bc('0x7f')]){if(_0x238f12['originated']===0x0){_0x238f12[_0x96bc('0x7f')]=![];_0x238f12['message']=utils[_0x96bc('0x66')][_0x96bc('0x7a')];loggerSyncQueueSummary[_0x96bc('0x41')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x238f12['name'],_0x96bc('0x80'));}else{_0x238f12[_0x96bc('0x6a')]=utils[_0x96bc('0x66')]['DISACTIVED'];loggerSyncQueueSummary[_0x96bc('0x41')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x238f12[_0x96bc('0x5f')],_0x96bc('0x81'));}emitCampaignSummary(_0x238f12);}}function myreject(_0x2fe3e6){return function(_0x401a4e){return _0x2fe3e6(msgResponse(_0x96bc('0x82'),_0x96bc('0x83'),JSON['stringify'](_0x401a4e)));};}Dialer[_0x96bc('0x1b')][_0x96bc('0x84')]=function(_0x567dac){return!_[_0x96bc('0x3d')](_0x567dac)&&_0x567dac&&!_[_0x96bc('0x3d')](_0x567dac[_0x96bc('0x5f')])&&!_[_0x96bc('0x3d')](_0x567dac[_0x96bc('0x85')])&&_0x567dac['active']&&(this[_0x96bc('0x22')][util[_0x96bc('0x44')](_0x96bc('0x86'),_0x567dac[_0x96bc('0x5f')])][_0x96bc('0x87')]===_0x96bc('0x88')||this[_0x96bc('0x22')][util[_0x96bc('0x44')](_0x96bc('0x86'),_0x567dac[_0x96bc('0x5f')])][_0x96bc('0x87')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x1cad87){var _0x149891=this;return function(){if(!_0x149891[_0x96bc('0x84')](_0x1cad87['Trunk'])){if(!_0x149891[_0x96bc('0x84')](_0x1cad87[_0x96bc('0x89')])){_0x1cad87[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x8a')];throw _0x1cad87[_0x96bc('0x5f')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x96bc('0x1b')][_0x96bc('0x8b')]=function(_0x5a7e4a,_0x556e28,_0xd53e5e,_0x4936e9){var _0x485141=this;return function(){var _0x3a5f1d=!![];return _0x485141[_0x96bc('0x8c')](_0x5a7e4a,_0x556e28,_0xd53e5e,_0x4936e9,_0x3a5f1d);};};Dialer[_0x96bc('0x1b')][_0x96bc('0x8d')]=function(_0x13157c,_0x59606b,_0x3d866f,_0xab0cc8){var _0x146ded=this;return function(){var _0x3a250d=![];return _0x146ded[_0x96bc('0x8c')](_0x13157c[_0x96bc('0x78')],_0x59606b,_0x3d866f,_0xab0cc8,_0x3a250d);};};Dialer[_0x96bc('0x1b')][_0x96bc('0x8c')]=function(_0x58a3bc,_0x16ca1b,_0x539e89,_0x5098b8,_0x38f400){var _0x6bbd2f=[];return new Promise(function(_0x13c592,_0x377328){if(!isNotNull(_0x58a3bc)){_0x5098b8[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x76')];return _0x377328(msgResponse(_0x96bc('0x8e'),_0x96bc('0x8f'),_0x539e89+_0x96bc('0x90')));}if(_['isEmpty'](_0x58a3bc)){_0x5098b8[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x91')];return _0x377328(msgResponse(_0x96bc('0x8e'),_0x96bc('0x8f'),_0x539e89+_0x96bc('0x92')));}if(_0x16ca1b&&_['isUndefined'](config[_0x96bc('0x93')][_0x16ca1b])){_0x5098b8[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x94')];return _0x377328(msgResponse(_0x96bc('0x8e'),'Failure',_0x539e89+_0x96bc('0x95')+_0x16ca1b));}if(_[_0x96bc('0x96')](_0x58a3bc)){for(var _0x4de6f2=0x0;_0x4de6f2<_0x58a3bc[_0x96bc('0x97')];_0x4de6f2+=0x1){_0x6bbd2f[_0x96bc('0x98')](ami['Action']({'action':_0x96bc('0x99'),'command':util['format']('iftime\x20%s,%s',_0x58a3bc[_0x4de6f2]['interval'],!_[_0x96bc('0x3d')](config[_0x96bc('0x93')][_0x16ca1b])?_0x16ca1b:'')})[_0x96bc('0x3b')](function(_0x4208c9){return _0x4208c9[_0x96bc('0x9a')]['indexOf'](_0x96bc('0x9b'))>=0x0;})['catch'](myreject(_0x377328)));}}else{_0x6bbd2f[_0x96bc('0x98')](ami[_0x96bc('0x9c')]({'action':'command','command':util[_0x96bc('0x44')](_0x96bc('0x9d'),_0x58a3bc,!_[_0x96bc('0x3d')](config[_0x96bc('0x93')][_0x16ca1b])?_0x16ca1b:'')})[_0x96bc('0x3b')](function(_0x5aeb8d){return _0x5aeb8d['content'][_0x96bc('0x9e')](_0x96bc('0x9b'))>=0x0;})[_0x96bc('0x9f')](myreject(_0x377328)));}Promise[_0x96bc('0xa0')](_0x6bbd2f)[_0x96bc('0x3b')](function(_0x4d3ab8){var _0x20449f=_[_0x96bc('0xa1')](_0x4d3ab8);if(_0x20449f){return _0x13c592(_0x20449f);}else{_0x5098b8[_0x96bc('0x6a')]=_0x38f400?utils[_0x96bc('0x66')][_0x96bc('0xa2')]:utils[_0x96bc('0x66')][_0x96bc('0xa3')];return _0x377328(msgResponse(_0x96bc('0xa4'),'Failure',_0x96bc('0xa5')+_0x38f400+'\x20'+_0x539e89+'\x20Interval\x20is\x20overtime:\x20'+util[_0x96bc('0x43')](_0x58a3bc,{'showHidden':![],'depth':null})+_0x96bc('0xa6')+_0x16ca1b));}})[_0x96bc('0x9f')](function(_0x569080){return _0x377328(msgResponse(_0x96bc('0x8e'),_0x96bc('0x8f'),JSON['stringify'](_0x569080)));});});};Dialer['prototype'][_0x96bc('0x39')]=function(){var _0x2d419f=this;return cmHopper[_0x96bc('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0x96bc('0x3b')](function(){setInterval(function(){_0x2d419f[_0x96bc('0xa8')]();},0x3e8);});};Dialer[_0x96bc('0x1b')][_0x96bc('0xa8')]=function(){var _0x510d09=this;var _0x284c44;for(var _0xaa38e1 in this[_0x96bc('0x20')]){if(typeof this['campaigns'][_0xaa38e1]!==_0x96bc('0xa9')){_0x284c44=this[_0x96bc('0x20')][_0xaa38e1];if(utils[_0x96bc('0x7c')](_0x284c44)&&utils[_0x96bc('0x79')](_0x284c44)){_0x284c44[_0x96bc('0x7f')]=!![];Promise[_0x96bc('0xaa')]()['then'](checkIsIVRCampaignActive(_0x284c44))[_0x96bc('0x3b')](checkInterval(_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0xab')](_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0x8b')](_0x284c44['dialGlobalInterval'],_0x284c44[_0x96bc('0xac')],_0x284c44[_0x96bc('0x5f')],_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0x8d')](_0x284c44[_0x96bc('0x75')],_0x284c44['dialTimezone'],_0x284c44[_0x96bc('0x5f')],_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0xad')](_0x284c44))[_0x96bc('0x9f')](loggerCatchQueueSummary('[syncCampaigns]',_0x284c44));}else{notSendMessagesCampaign(_0x284c44);}}}};Dialer[_0x96bc('0x1b')][_0x96bc('0xae')]=function(_0x30f79e){if(_0x30f79e[_0x96bc('0xaf')]!==_0x96bc('0xa')){clearPredictiveAttributes(_0x30f79e);}switch(_0x30f79e[_0x96bc('0xaf')]){case _0x96bc('0xb0'):this[_0x96bc('0xb1')](_0x30f79e,0x1);break;case _0x96bc('0xb2'):this[_0x96bc('0xb1')](_0x30f79e,_0x30f79e[_0x96bc('0xb3')]);break;case _0x96bc('0xa'):this['predictive'](_0x30f79e);break;case _0x96bc('0x9'):this['handlePower'](_0x30f79e,0x1);break;default:logger[_0x96bc('0x64')](_0x96bc('0xb4'),_0x30f79e[_0x96bc('0x5f')],_0x96bc('0xb5'));}};Dialer[_0x96bc('0x1b')]['ifTime']=function(_0x12368b,_0x2cd8ca){var _0x14c7f2=_0x12368b[_0x96bc('0xac')];var _0xd3d592=_0x2cd8ca?_0x12368b[_0x96bc('0xb6')]:_0x12368b[_0x96bc('0x75')][_0x96bc('0x78')];logger[_0x96bc('0xb7')](_0x96bc('0xb8'),_0xd3d592,_0x14c7f2,_0x12368b[_0x96bc('0x5f')],util[_0x96bc('0x44')]('Voice\x20Queue\x20%s\x20$s',_0x12368b[_0x96bc('0x5f')],_0x12368b['id']));var _0x13fd4b=null;return Interval['intervalIftime'](_0xd3d592,_0x14c7f2)[_0x96bc('0x3b')](function(_0x14a0c1){if(_0x14a0c1===!![]){return _0x14a0c1;}else{_0x12368b[_0x96bc('0x6a')]=_0x2cd8ca?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x96bc('0x66')][_0x96bc('0xa3')];_0x13fd4b=msgResponse(_0x96bc('0xa4'),_0x96bc('0x8f'),'Global:\x20'+_0x2cd8ca+'\x20'+_0x12368b[_0x96bc('0x5f')]+_0x96bc('0xb9')+util[_0x96bc('0x43')](_0xd3d592,{'showHidden':![],'depth':null})+_0x96bc('0xa6')+_0x14c7f2);}if(_0x13fd4b!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x13fd4b);_0x13fd4b['isGlobal']=_0x2cd8ca;throw _0x13fd4b;}})[_0x96bc('0x9f')](function(_0x2951b2){logger[_0x96bc('0x64')]('AMI\x20IfTime',_0x2951b2);throw msgResponse(_0x96bc('0x82'),'Error',util[_0x96bc('0x43')](_0x2951b2,{'showHidden':![],'depth':null}));});};Dialer[_0x96bc('0x1b')][_0x96bc('0x2b')]=function(_0x34921d){if(this[_0x96bc('0x1f')][_0x34921d[_0x96bc('0xba')]]){if(this[_0x96bc('0xbb')][_0x34921d['uniqueid']]&&this['uniqueId'][_0x34921d[_0x96bc('0xbc')]]['type']!==_0x96bc('0xbd')){utils[_0x96bc('0xbe')](this[_0x96bc('0x1f')][_0x34921d[_0x96bc('0xba')]],_0x96bc('0xbf'));this['uniqueId'][_0x34921d[_0x96bc('0xbc')]]['answertime']=moment()['format'](_0x96bc('0xc0'));}}};Dialer['prototype'][_0x96bc('0xc1')]=function(_0x3326fe){var _0x4aad27=this[_0x96bc('0xbb')][_0x3326fe['uniqueid']];if(this[_0x96bc('0x1f')][_0x3326fe[_0x96bc('0xba')]]){if(_0x4aad27&&_0x4aad27[_0x96bc('0x3f')]!=='ivr'){delete this[_0x96bc('0xbb')][_0x3326fe[_0x96bc('0xbc')]];this['voiceQueues'][_0x3326fe[_0x96bc('0xba')]][_0x96bc('0xc2')]+=0x1;var _0x453c68=new AgentComplete(_0x4aad27,_0x3326fe);if(_0x3326fe[_0x96bc('0xc3')]===_0x96bc('0xc4')){_0x453c68[_0x96bc('0xc5')]=this[_0x96bc('0x1f')][_0x3326fe[_0x96bc('0xba')]][_0x96bc('0xc6')]&&this[_0x96bc('0x1f')][_0x3326fe['queue']][_0x96bc('0xc7')]?moment()[_0x96bc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x96bc('0xc8')](_0x453c68)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xc9')));hopperUtils[_0x96bc('0xca')](_0x453c68)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xcb')));}}};Dialer[_0x96bc('0x1b')][_0x96bc('0x2e')]=function(_0x2ee9da){var _0xc12bd4=this[_0x96bc('0xbb')][_0x2ee9da[_0x96bc('0xbc')]];var _0x387297=this;var _0x5e24f4=![];var _0xc69518;var _0xb5a7c3;if(this[_0x96bc('0x1f')][_0x2ee9da['queue']]){if(_0xc12bd4&&_0xc12bd4[_0x96bc('0x3f')]!==_0x96bc('0xbd')){delete this['uniqueId'][_0x2ee9da[_0x96bc('0xbc')]];utils[_0x96bc('0xbe')](this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]],'[syncQueueCallerAbandon]');_0xc12bd4[_0x96bc('0xcc')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));var _0x4cd11e=new QueueCallerAbandon(_0xc12bd4,_0x2ee9da);if(utils['getSeconds'](_0xc12bd4['droptime'],_0xc12bd4['responsetime'])>=_0xc12bd4[_0x96bc('0xcd')]){this[_0x96bc('0x1f')][_0x2ee9da['queue']][_0x96bc('0x4d')]+=0x1;this[_0x96bc('0x1f')][_0x2ee9da['queue']][_0x96bc('0xce')]+=0x1;this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xcf')]+=0x1;_0x4cd11e[_0x96bc('0xd0')]=0xa;_0x4cd11e[_0x96bc('0x6d')]='Drop';_0x4cd11e['dropreason']='TIMEOUT';_0x4cd11e['agiafterat']=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xc6')]?moment()[_0x96bc('0x44')](_0x96bc('0xc0')):undefined;_0x4cd11e[_0x96bc('0xd1')]+=0x1;_0x4cd11e[_0x96bc('0xd2')]+=0x1;_0xc69518=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xd3')];_0xb5a7c3=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x96bc('0xd4')](_0x4cd11e,_0x4cd11e[_0x96bc('0xd0')],_0xc12bd4[_0x96bc('0xd5')])[_0x96bc('0x3b')](function(_0x1e1d0c){_0x5e24f4=_0x1e1d0c[_0x96bc('0xd6')]==0x1;if(_0x4cd11e[_0x96bc('0xd1')]>=_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xd7')]){_0x387297[_0x96bc('0xd8')](_0x4cd11e,_0x1e1d0c['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4cd11e[_0x96bc('0xd1')],'scheduledat':moment()[_0x96bc('0xd9')](_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xd3')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0xc12bd4['ContactId'],'ListId':_0xc12bd4['ListId'],'VoiceQueueId':_0xc12bd4['VoiceQueueId']||undefined,'CampaignId':_0xc12bd4[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch('[rescheduleContact][Drop]'));var _0x4d0b80=new History(_0x4cd11e);_0x4d0b80['state']=0xa;_0x4d0b80[_0x96bc('0x6d')]=_0x96bc('0xdc');_0x4d0b80[_0x96bc('0x6f')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));_0x4d0b80[_0x96bc('0x6e')]=_0x4d0b80[_0x96bc('0x6f')];_0x4d0b80[_0x96bc('0xdd')]=_0x4cd11e[_0x96bc('0xdd')];_0x4d0b80[_0x96bc('0xde')]=_0x4cd11e[_0x96bc('0xde')];hopperUtils[_0x96bc('0xc8')](_0x4d0b80)[_0x96bc('0x9f')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x96bc('0x3b')](function(){if(_0x5e24f4)hopperUtils[_0x96bc('0xdf')](_0x4cd11e,_0xc69518,_0xb5a7c3)[_0x96bc('0x3b')](function(){return 0x1;});});}else{this[_0x96bc('0x1f')][_0x2ee9da['queue']][_0x96bc('0x4f')]+=0x1;this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe0')]+=0x1;_0x4cd11e[_0x96bc('0xd0')]=0xb;_0x4cd11e[_0x96bc('0x6d')]=_0x96bc('0xe1');_0x4cd11e[_0x96bc('0xe2')]=_0x96bc('0xe3');_0x4cd11e[_0x96bc('0xe4')]+=0x1;_0x4cd11e['countglobal']+=0x1;_0xc69518=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe5')];_0xb5a7c3=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe6')];hopperUtils[_0x96bc('0xd4')](_0x4cd11e,_0x4cd11e[_0x96bc('0xd0')],_0xc12bd4[_0x96bc('0xd5')])['then'](function(_0x1cf4a6){if(_0x4cd11e[_0x96bc('0xe4')]>=_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe7')]){_0x387297[_0x96bc('0xd8')](_0x4cd11e,_0x1cf4a6[_0x96bc('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4cd11e[_0x96bc('0xe4')],'scheduledat':moment()[_0x96bc('0xd9')](_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]]['dialAbandonedRetryFrequency'],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0xc12bd4[_0x96bc('0xe8')],'ListId':_0xc12bd4[_0x96bc('0xe9')],'VoiceQueueId':_0xc12bd4[_0x96bc('0xea')]||undefined,'CampaignId':_0xc12bd4[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xeb')));var _0x4c06ab=new History(_0x4cd11e);_0x4c06ab['state']=0xb;_0x4c06ab[_0x96bc('0x6d')]='Abandoned';_0x4c06ab[_0x96bc('0x6f')]=moment()['format'](_0x96bc('0xc0'));_0x4c06ab[_0x96bc('0x6e')]=_0x4c06ab['starttime'];_0x4c06ab[_0x96bc('0xdd')]=_0x4cd11e['calleridname'];_0x4c06ab[_0x96bc('0xde')]=_0x4cd11e[_0x96bc('0xde')];hopperUtils[_0x96bc('0xc8')](_0x4c06ab)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x96bc('0x3b')](function(){if(_0x5e24f4)hopperUtils['swapAdditionalPhones'](_0x4cd11e,_0xc69518,_0xb5a7c3)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x96bc('0x35')]=function(_0x336f58){if(this['actions'][_0x336f58[_0x96bc('0xbc')]]){this[_0x96bc('0xec')][_0x336f58[_0x96bc('0xbc')]][_0x96bc('0xed')]=_0x336f58[_0x96bc('0xed')];}if(this[_0x96bc('0xbb')][_0x336f58['uniqueid']]){this[_0x96bc('0xbb')][_0x336f58[_0x96bc('0xbc')]][_0x96bc('0xed')]=_0x336f58[_0x96bc('0xed')];}};Dialer[_0x96bc('0x1b')][_0x96bc('0xee')]=function(_0x3997f0){if(!this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]]){return;}var _0x37f1aa=this[_0x96bc('0x1f')][this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xba')]][_0x96bc('0xf0')]||_0x96bc('0xf1');if(_0x37f1aa===_0x96bc('0xf2')){if(this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]]&&_['isNil'](this[_0x96bc('0xec')][_0x3997f0['actionid']][_0x96bc('0xf3')])&&_0x3997f0['status']==='1'&&_0x3997f0[_0x96bc('0xf4')]==='0'){if(this[_0x96bc('0x21')][_0x3997f0[_0x96bc('0xf5')]]){if(!this[_0x96bc('0x21')][_0x3997f0['stateinterface']][_0x96bc('0xf3')]){this[_0x96bc('0x21')][_0x3997f0[_0x96bc('0xf5')]]['locked']=!![];this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xf3')]=!![];this['actions'][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xf5')]=_0x3997f0[_0x96bc('0xf5')];}}}}else if(_0x37f1aa===_0x96bc('0xf1')){if(this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]]){if(this['agents'][_0x3997f0[_0x96bc('0xf5')]]){this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xf5')]=_0x3997f0['stateinterface'];if(_[_0x96bc('0xf6')](this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x3997f0['actionid']][_0x96bc('0xba')]])){this['queueBooked'][this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xba')]]=[];}this[_0x96bc('0xf7')][this['actions'][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xba')]][_0x96bc('0x98')](_[_0x96bc('0x5e')](_[_0x96bc('0x74')](this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]],[_0x96bc('0xf8'),_0x96bc('0xf5')]),{'status':_0x3997f0[_0x96bc('0x87')],'paused':_0x3997f0['paused']}));}}}};Dialer[_0x96bc('0x1b')][_0x96bc('0x38')]=function(_0x5ed70e){if(!this['actions'][_0x5ed70e['actionid']]){return;}var _0x46e78d=this;var _0x3cb487=this['voiceQueues'][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]['queue']];var _0x592004=_0x3cb487['strategy']||_0x96bc('0xf1');if(_0x592004===_0x96bc('0xf2')){if(this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]&&this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xf5')]){this[_0x96bc('0x1e')][_0x96bc('0xf9')](this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xf8')],this['actions'][_0x5ed70e[_0x96bc('0xef')]]['stateinterface'])['catch'](function(_0x1e89a6){logger[_0x96bc('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x96bc('0x43')](_0x1e89a6,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x96bc('0xbe')](_0x46e78d[_0x96bc('0x1f')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]],_0x96bc('0xfa'));_0x46e78d[_0x96bc('0x21')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]['stateinterface']][_0x96bc('0xf3')]=![];delete _0x46e78d[_0x96bc('0xec')][_0x5ed70e['actionid']];unlockQueueStatus(_0x3cb487);});}else{utils[_0x96bc('0xbe')](this['voiceQueues'][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]],_0x96bc('0xfa'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xe8')],'ListId':this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]['ListId'],'VoiceQueueId':this['actions'][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xea')]||undefined,'CampaignId':this['actions'][_0x5ed70e[_0x96bc('0xef')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x96bc('0xfb')));delete this['actions'][_0x5ed70e['actionid']];unlockQueueStatus(_0x3cb487);}}else if(_0x592004===_0x96bc('0xf1')){var _0x407e12;if(this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]&&!_[_0x96bc('0x46')](this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]])){if(this[_0x96bc('0xfc')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]){this[_0x96bc('0xfc')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]=this[_0x96bc('0xfc')][this['actions'][_0x5ed70e['actionid']][_0x96bc('0xba')]]?this[_0x96bc('0xfc')][this[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]]:this['queueBooked'][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]?this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]['_rr']||0x0:0x0;}this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]][_0x96bc('0xfd')]=this[_0x96bc('0xfc')][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]];for(var _0x2b6b4d=0x0;_0x2b6b4d=_0x3d6ab4[_0x96bc('0x124')]){_0x34d1a0[_0x96bc('0x125')](_0x312a48,_0x296df5,_0x5e4c5c,_0x96bc('0x126'));}else{if(_0x312a48[_0x96bc('0x120')]>=_0x3d6ab4[_0x96bc('0x127')]){_0x34d1a0[_0x96bc('0x128')](_0x312a48,_0x296df5,_0x5e4c5c,_0x96bc('0x129'));}else{hopperUtils[_0x96bc('0x106')]({'active':![],'countmachineretry':_0x312a48['countmachineretry'],'scheduledat':moment()[_0x96bc('0xd9')](_0x3d6ab4[_0x96bc('0x12a')],'minutes')[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x312a48[_0x96bc('0xe8')],'ListId':_0x312a48[_0x96bc('0xe9')],'VoiceQueueId':_0x312a48[_0x96bc('0xea')]||undefined,'CampaignId':_0x312a48[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x12b')));_0x296df5({'reschedule':0x1});}}});}if(_0x1142b8[_0x96bc('0x3f')]===_0x96bc('0xbd')&&this[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]][_0x96bc('0x11d')]&&_0xeed896[_0x96bc('0x113')]==='HANGUP'){delete this[_0x96bc('0xbb')][_0xeed896['uniqueid']];utils[_0x96bc('0xbe')](this['campaigns'][_0x1142b8[_0x96bc('0xba')]],'[syncVarSet]');_0x2c2bd6=new Hangup(_0x1142b8,_0xeed896);_0x2c2bd6[_0x96bc('0xd0')]=0x12;_0x2c2bd6[_0x96bc('0x6d')]=_0x96bc('0x115');_0x2c2bd6[_0x96bc('0x116')]='AMD';ami[_0x96bc('0x3e')](_0x96bc('0x118'),ut['buildObj'](_0x2c2bd6,'amd'));this[_0x96bc('0x11a')](_0x2c2bd6,_0x96bc('0x12c'),_0x96bc('0x12d'));}if(_0x1142b8[_0x96bc('0x3f')]==='ivr'&&this[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]][_0x96bc('0x11d')]&&_0xeed896[_0x96bc('0x113')]===_0x96bc('0x11e')){return new Promise(function(_0x326fa7,_0x521211){delete _0x34d1a0[_0x96bc('0xbb')][_0xeed896[_0x96bc('0xbc')]];utils['decrementOriginate'](_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]],'[syncVarSet]');_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]]['outboundAnswerCallsDay']+=0x1;_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x496783=_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]];var _0x3837b9=new Hangup(_0x1142b8,_0xeed896);_0x3837b9[_0x96bc('0xd0')]=0x13;_0x3837b9[_0x96bc('0x6d')]=_0x96bc('0x11f');_0x3837b9[_0x96bc('0x116')]=_0x96bc('0x117');_0x3837b9[_0x96bc('0x120')]+=0x1;_0x3837b9['countglobal']+=0x1;_0x3837b9[_0x96bc('0x119')]=!![];ami[_0x96bc('0x3e')](_0x96bc('0x118'),ut[_0x96bc('0x12e')](_0x3837b9,_0x96bc('0x119')));hopperUtils[_0x96bc('0xc8')](_0x3837b9)[_0x96bc('0x9f')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3837b9[_0x96bc('0x122')]+_0x3837b9[_0x96bc('0x12f')]+_0x3837b9[_0x96bc('0x123')]+_0x3837b9['countnosuchnumberretry']+_0x3837b9[_0x96bc('0xd1')]+_0x3837b9[_0x96bc('0xe4')]+_0x3837b9[_0x96bc('0x120')]+_0x3837b9[_0x96bc('0x130')]>=_0x496783['dialGlobalMaxRetry']){_0x34d1a0[_0x96bc('0x125')](_0x3837b9,_0x326fa7,_0x521211,'reason19\x20machine....');}else{if(_0x3837b9[_0x96bc('0x120')]>=_0x496783['dialMachineMaxRetry']){_0x34d1a0['createStateFinal'](_0x3837b9,_0x326fa7,_0x521211,_0x96bc('0x129'));}else{hopperUtils[_0x96bc('0x106')]({'active':![],'countmachineretry':_0x3837b9[_0x96bc('0x120')],'scheduledat':moment()[_0x96bc('0xd9')](_0x496783['dialMachineRetryFrequency'],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x3837b9[_0x96bc('0xe8')],'ListId':_0x3837b9[_0x96bc('0xe9')],'VoiceQueueId':_0x3837b9['VoiceQueueId']||undefined,'CampaignId':_0x3837b9[_0x96bc('0xdb')]||undefined})['catch'](loggerCatch(_0x96bc('0x12b')));_0x326fa7({'reschedule':0x1});}}});}}};Dialer[_0x96bc('0x1b')]['syncHangup']=function(_0x39d151){var _0x807451=this[_0x96bc('0xbb')][_0x39d151[_0x96bc('0xbc')]];var _0x383498;if(!_0x807451){return;}if(_0x807451[_0x96bc('0x3f')]===_0x96bc('0xbd')){delete this[_0x96bc('0xbb')][_0x39d151[_0x96bc('0xbc')]];utils[_0x96bc('0xbe')](this['campaigns'][_0x807451[_0x96bc('0xba')]],_0x96bc('0x131'));this[_0x96bc('0x20')][_0x807451['queue']][_0x96bc('0x132')]+=0x1;if(_0x39d151[_0x96bc('0x133')]===_0x96bc('0x134')){const _0xfa3caa=new AgentComplete(_0x807451,_0x39d151);_0xfa3caa[_0x96bc('0xdb')]=this[_0x96bc('0x20')][_0x807451[_0x96bc('0xba')]]['id'];hopperUtils[_0x96bc('0xc8')](_0xfa3caa)['catch'](loggerCatch(_0x96bc('0x135')));hopperUtils[_0x96bc('0xca')](_0xfa3caa)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x136')));}else{_0x383498=new Hangup(_0x807451,_0x39d151);hopperUtils['createHistory'](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x137')));hopperUtils[_0x96bc('0xca')](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x138')));}}else{if(isNotNull(this[_0x96bc('0x1f')][_0x807451['queue']][_0x96bc('0x139')])){delete this[_0x96bc('0xbb')][_0x39d151['uniqueid']];utils['decrementOriginate'](this[_0x96bc('0x1f')][_0x807451[_0x96bc('0xba')]],'[syncHangup]');this[_0x96bc('0x1f')][_0x807451['queue']][_0x96bc('0xc2')]+=0x1;this[_0x96bc('0x1f')][_0x807451[_0x96bc('0xba')]][_0x96bc('0x13a')]+=0x1;_0x383498=new Hangup(_0x807451,_0x39d151);_0x383498[_0x96bc('0xd0')]=0x10;_0x383498[_0x96bc('0x6d')]=_0x96bc('0x13b');_0x383498['membername']=_0x96bc('0x13c');hopperUtils['createHistory'](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x137')));hopperUtils[_0x96bc('0xca')](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x138')));}else{delete this[_0x96bc('0xbb')][_0x39d151[_0x96bc('0xbc')]];utils['decrementOriginate'](this['voiceQueues'][_0x807451[_0x96bc('0xba')]],_0x96bc('0x13d'));if(_0x39d151['cause-txt']===_0x96bc('0x134')){this[_0x96bc('0x1f')][_0x807451['queue']]['outboundAnswerCallsDay']+=0x1;const _0x16a747=new AgentComplete(_0x807451,_0x39d151);_0x16a747[_0x96bc('0xea')]=this[_0x96bc('0x1f')][_0x807451['queue']]['id'];hopperUtils[_0x96bc('0xc8')](_0x16a747)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xc9')));hopperUtils['moveContactManagedDialer'](_0x16a747)['catch'](loggerCatch(_0x96bc('0xcb')));}else{this[_0x96bc('0x1f')][_0x807451[_0x96bc('0xba')]][_0x96bc('0x13e')]+=0x1;_0x383498=new Hangup(_0x807451,_0x39d151);_0x383498[_0x96bc('0xd0')]=0xc;_0x383498[_0x96bc('0x6d')]=_0x39d151['cause-txt'];_0x383498[_0x96bc('0x116')]=_0x96bc('0x13f');hopperUtils['createHistory'](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x140')));hopperUtils[_0x96bc('0xca')](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x131')));}}}};Dialer['prototype'][_0x96bc('0xb')]=function(_0x2dccb8){var _0x5a82a6=this;if(!_0x5a82a6[_0x96bc('0x29')][_0x2dccb8['name']]){_0x5a82a6[_0x96bc('0x29')][_0x2dccb8[_0x96bc('0x5f')]]={'running':![]};}else if(_0x5a82a6['queuesSummary'][_0x2dccb8[_0x96bc('0x5f')]][_0x96bc('0x141')]===!![]){return;}else if(_0x5a82a6[_0x96bc('0x29')][_0x2dccb8[_0x96bc('0x5f')]][_0x96bc('0x141')]===![]){_0x5a82a6[_0x96bc('0x29')][_0x2dccb8[_0x96bc('0x5f')]][_0x96bc('0x141')]=!![];}var _0x5d3b8a=_0x5a82a6[_0x96bc('0x1f')][_0x2dccb8[_0x96bc('0x5f')]];var _0x354bcf=_0x5d3b8a[_0x96bc('0x6a')]!==utils['CAMPAIGN_STATUS'][_0x96bc('0x7a')];var _0x2fc91b=utils['isPreviewCampaign'](_0x5d3b8a);_0x5d3b8a[_0x96bc('0x142')]=utils['getQueueCampaignStatusMessage'](_0x5d3b8a,_0x5a82a6[_0x96bc('0x22')]);Promise[_0x96bc('0xaa')]()[_0x96bc('0x3b')](function(){if(_0x5d3b8a[_0x96bc('0x142')]===utils[_0x96bc('0x66')][_0x96bc('0x7a')]){if(_0x354bcf){clearPredictiveAttributes(_0x5d3b8a);_0x2dccb8[_0x96bc('0x27')]=undefined;_0x2dccb8[_0x96bc('0x28')]=undefined;}if(_0x5d3b8a[_0x96bc('0x142')]===utils[_0x96bc('0x66')]['INACTIVE']){_0x2dccb8['available']=0x0;_0x2dccb8['paused']=0x0;_0x2dccb8[_0x96bc('0x143')]=0x0;_0x2dccb8[_0x96bc('0x144')]=0x0;_0x2dccb8[_0x96bc('0x145')]=0x0;}}else if(_0x5d3b8a[_0x96bc('0x142')]===utils[_0x96bc('0x66')][_0x96bc('0x146')]&&!_0x2fc91b){return _0x5a82a6[_0x96bc('0x8e')](_0x5d3b8a,!![])[_0x96bc('0x3b')](function(){return _0x5a82a6['ifTime'](_0x5d3b8a,![]);})[_0x96bc('0x3b')](function(){return _0x5a82a6[_0x96bc('0xae')](_0x5d3b8a);})['catch'](function(_0x379c9e){loggerSyncQueueSummary['debug'](_0x96bc('0x147'),util[_0x96bc('0x43')](_0x379c9e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5d3b8a);});}else{clearPredictiveAttributes(_0x5d3b8a);}})[_0x96bc('0x3b')](function(){var _0x183997=_0x2dccb8[_0x96bc('0x148')](_0x5d3b8a);if(_0x183997||_0x5d3b8a[_0x96bc('0x149')]){_0x5d3b8a['queueSummaryCountersUpdated']=![];_0x2dccb8[_0x96bc('0x14a')](_0x5d3b8a);Object[_0x96bc('0x14b')](_0x5d3b8a,_0x2dccb8);emitOutboundVoiceQueueSummary(_0x2dccb8);}_0x5a82a6[_0x96bc('0x29')][_0x5d3b8a[_0x96bc('0x5f')]][_0x96bc('0x141')]=![];})[_0x96bc('0x9f')](function(_0x2bb3d9){logger[_0x96bc('0x64')](_0x96bc('0x147'),util['inspect'](_0x2bb3d9,{'showHidden':![],'depth':null}));_0x5a82a6['queuesSummary'][_0x5d3b8a[_0x96bc('0x5f')]][_0x96bc('0x141')]=![];});};Dialer[_0x96bc('0x1b')][_0x96bc('0x32')]=_[_0x96bc('0x14c')](function(){var _0x3f8add=_['filter'](this[_0x96bc('0x1f')],function(_0x4df443){return _0x4df443['dialPreviewRecallmeReminder'];});var _0x436d01=_['filter'](this[_0x96bc('0x21')],function(_0x2a877d){return _0x2a877d[_0x96bc('0x14d')]&&_0x2a877d[_0x96bc('0x87')]===_0x96bc('0x88');});if(_0x3f8add[_0x96bc('0x97')]>0x0&&_0x436d01[_0x96bc('0x97')]>0x0){return Promise['resolve']()[_0x96bc('0x3b')](cmHopper[_0x96bc('0x14e')](_[_0x96bc('0x14f')](_0x3f8add,'id'),previewRecallmeReminderInterval,_[_0x96bc('0x14f')](_0x436d01,'id')))[_0x96bc('0x3b')](function(_0x2a77fb){for(var _0xcc6511=0x0;_0xcc6511<_0x2a77fb['length'];_0xcc6511++){var _0x2f805b=_0x2a77fb[_0xcc6511]['Agent'][_0x96bc('0x5f')];if(_0x2f805b)io['to'](util[_0x96bc('0x44')](_0x96bc('0x150'),_0x2f805b))[_0x96bc('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x2a77fb[_0xcc6511]});}})[_0x96bc('0x9f')](function(_0x4008db){logger[_0x96bc('0x64')]('checkPreviewRecallReminder',_0x4008db);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x96bc('0x151')]=function(){var _0x17bb6a=this;setInterval(function(){_0x17bb6a[_0x96bc('0x152')](_0x17bb6a[_0x96bc('0xbb')],_0x96bc('0x153'));_0x17bb6a[_0x96bc('0x152')](_0x17bb6a[_0x96bc('0xec')],_0x96bc('0x154'));},0x32c8);};Dialer[_0x96bc('0x1b')][_0x96bc('0x152')]=function(_0xabd083,_0x36102c){var _0x46cadf=this;for(var _0x2120ad in _0xabd083){if(typeof _0xabd083[_0x2120ad]!==_0x96bc('0xa9')){this[_0x96bc('0x1d')][_0x96bc('0x155')](function(){if(!_[_0x96bc('0xf6')](_0xabd083[_0x2120ad])){return ami[_0x96bc('0x9c')]({'action':_0x96bc('0x87'),'channel':_0xabd083[_0x2120ad][_0x96bc('0xed')]})[_0x96bc('0x9f')](function(_0x303354){if(_0x303354[_0x96bc('0x6a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xabd083[_0x2120ad]&&_0xabd083[_0x2120ad][_0x96bc('0x3f')]!==_0x96bc('0xbd')){utils[_0x96bc('0xbe')](_0x46cadf['voiceQueues'][_0xabd083[_0x2120ad][_0x96bc('0xba')]],_0x96bc('0x156'));logger['error'](_0x96bc('0x157'),_0x36102c,_0x2120ad,_0xabd083[_0x2120ad][_0x96bc('0xba')]);delete _0xabd083[_0x2120ad];}if(_0xabd083[_0x2120ad]&&_0xabd083[_0x2120ad][_0x96bc('0x3f')]===_0x96bc('0xbd')){utils[_0x96bc('0xbe')](_0x46cadf[_0x96bc('0x20')][_0xabd083[_0x2120ad][_0x96bc('0xba')]],_0x96bc('0x156'));logger['error']('[Dialer][checkChannel][ivr]',_0x36102c,_0x2120ad,_0xabd083[_0x2120ad][_0x96bc('0xba')]);delete _0xabd083[_0x2120ad];}},0x2328);}});}});}}};Dialer['prototype'][_0x96bc('0x158')]=function(_0x31df34){return Promise[_0x96bc('0xaa')]()[_0x96bc('0x3b')](voiceQueueRt[_0x96bc('0x158')](_0x31df34))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype']['emptyContact']=function(_0x95b78c,_0x14ba33,_0x4954fc){var _0x3bc09f={'state':0x19,'statedesc':_0x96bc('0x159')};utils[_0x96bc('0xbe')](_0x14ba33,_0x96bc('0x15a')+_0x95b78c);this['saveInDb'](_[_0x96bc('0x5e')](_0x3bc09f,_[_0x96bc('0x74')](_0x4954fc,[_0x96bc('0xe8'),'ListId',_0x96bc('0x15b'),_0x96bc('0xea'),_0x96bc('0xdb')])),_0x96bc('0x15c'),_0x96bc('0x15a'));logger[_0x96bc('0x64')](_0x95b78c);};Dialer['prototype'][_0x96bc('0x11a')]=function(_0x44ae35,_0x17bf9a,_0x48037b){hopperUtils[_0x96bc('0xc8')](_0x44ae35)[_0x96bc('0x9f')](loggerCatch(_0x17bf9a));hopperUtils[_0x96bc('0xca')](_0x44ae35)[_0x96bc('0x9f')](loggerCatch(_0x48037b));};Dialer[_0x96bc('0x1b')][_0x96bc('0xd8')]=function(_0x58efd3,_0x149b33){hopperUtils[_0x96bc('0xc8')](_0x58efd3)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xc9')));if(_0x149b33==0x0){hopperUtils[_0x96bc('0xca')](_0x58efd3)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x15d')));}};Dialer[_0x96bc('0x1b')]['checkPreviewRecallReminder']=function(_0x48580a){return Promise[_0x96bc('0xaa')]()[_0x96bc('0x3b')](cmHopper[_0x96bc('0x14e')](_0x48580a['id'],previewRecallmeReminderInterval))[_0x96bc('0x3b')](function(_0x1d9c39){for(var _0x4cf4f3=0x0;_0x4cf4f3<_0x1d9c39[_0x96bc('0x97')];_0x4cf4f3++){var _0x11e215=_0x1d9c39[_0x4cf4f3]['Agent'][_0x96bc('0x5f')];if(_0x11e215)io['to'](util[_0x96bc('0x44')]('user:%s',_0x11e215))[_0x96bc('0x3e')](_0x96bc('0x15e'),{'hopper':_0x1d9c39[_0x4cf4f3]});}})['catch'](function(){});};Dialer[_0x96bc('0x1b')][_0x96bc('0xad')]=function(_0x230f41){var _0x4e92c7=this;return function(){_0x4e92c7[_0x96bc('0x15f')](_0x230f41);};};Dialer[_0x96bc('0x1b')][_0x96bc('0x160')]=function(_0x3e785b,_0x5aa91b){var _0x231dcb=this;var _0x1491e4=uuid['v4']();this[_0x96bc('0xec')][_0x1491e4]=new Action(_0x3e785b,_0x5aa91b,_0x1491e4);return new Promise(function(_0x29d2bd,_0x1bc16f){if(_[_0x96bc('0x3d')](_0x3e785b)&&typeof _0x3e785b!=='object'){return _0x1bc16f(msgResponse(_0x96bc('0x161'),_0x96bc('0x8f'),_0x96bc('0x162')));}if(_[_0x96bc('0x3d')](_0x5aa91b['phone'])||_0x5aa91b[_0x96bc('0x163')]===null){return _0x1bc16f(msgResponse(_0x96bc('0x161'),'Failure','contact\x20is\x20undefine'));}var _0x139dab={'XMD-CALLERID':_0x231dcb[_0x96bc('0xec')][_0x1491e4]['getCaller'](),'XMD-AGI':_0x3e785b['dialQueueProject']?util[_0x96bc('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3e785b['dialQueueProject']):_0x96bc('0x164'),'XMD-AGIAFTER':_0x3e785b[_0x96bc('0xc6')]?util[_0x96bc('0x44')](_0x96bc('0x165'),ipAgi,_0x3e785b[_0x96bc('0xc6')]):'NONE','XMD-QUEUE':utils[_0x96bc('0x166')](_0x3e785b)?util[_0x96bc('0x44')](_0x96bc('0x167'),_0x3e785b['name'],_0x3e785b['dialQueueOptions']||'',_0x3e785b['dialAgiAfterHangupAgent']?'c':'',_0x3e785b[_0x96bc('0xcd')]||0x3):_0x96bc('0x164'),'XMD-CONTACTID':_0x5aa91b[_0x96bc('0xe8')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x231dcb[_0x96bc('0xec')][_0x1491e4][_0x96bc('0x168')](),'XMD-AMD':_0x3e785b[_0x96bc('0x11d')]?_0x96bc('0x146'):_0x96bc('0x164'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3e785b[_0x96bc('0x11d')]){_0x139dab[_0x96bc('0x169')]=_0x3e785b['dialAMDInitialSilence']||0x9c4;_0x139dab[_0x96bc('0x16a')]=_0x3e785b[_0x96bc('0x16b')]||0x5dc;_0x139dab[_0x96bc('0x16c')]=_0x3e785b[_0x96bc('0x16d')]||0x320;_0x139dab[_0x96bc('0x16e')]=_0x3e785b['dialAMDTotalAnalysisTime']||0x1388;_0x139dab[_0x96bc('0x16f')]=_0x3e785b[_0x96bc('0x170')]||0x64;_0x139dab[_0x96bc('0x171')]=_0x3e785b[_0x96bc('0x172')]||0x32;_0x139dab[_0x96bc('0x173')]=_0x3e785b['dialAMDMaximumNumberOfWords']||0x3;_0x139dab['XMD-AMDSILENCETHRESHOLD']=_0x3e785b['dialAMDSilenceThreshold']||0x100;_0x139dab['XMD-AMDMAXIMUMWORDLENGTH']=_0x3e785b['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x96bc('0x166')](_0x3e785b)){_0x139dab['XMD-VOICEQUEUEID']=_0x5aa91b[_0x96bc('0xea')];}else{_0x139dab[_0x96bc('0x174')]=_0x5aa91b[_0x96bc('0xdb')];}var _0x55b36a=utils['setXMDContactVariables'](_0x5aa91b['Contact']);Object[_0x96bc('0x14b')](_0x139dab,_0x55b36a);var _0x45c0f2=_0x231dcb[_0x96bc('0x84')](_0x3e785b[_0x96bc('0x175')])?utils[_0x96bc('0x176')](_0x3e785b[_0x96bc('0x175')][_0x96bc('0x177')],_0x3e785b[_0x96bc('0x178')],_0x3e785b[_0x96bc('0x179')]>0x0?utils[_0x96bc('0x17a')](_0x3e785b[_0x96bc('0x17b')],_0x3e785b[_0x96bc('0x179')]):_0x3e785b[_0x96bc('0x17b')]):utils['getCallerId'](_[_0x96bc('0xf6')](_0x3e785b[_0x96bc('0x89')])?_0x3e785b[_0x96bc('0x175')][_0x96bc('0x177')]:_0x3e785b[_0x96bc('0x89')][_0x96bc('0x177')],_0x3e785b[_0x96bc('0x178')],_0x3e785b[_0x96bc('0x179')]>0x0?utils[_0x96bc('0x17a')](_0x3e785b[_0x96bc('0x17b')],_0x3e785b[_0x96bc('0x179')]):_0x3e785b[_0x96bc('0x17b')]);if(_0x45c0f2){_0x139dab[_0x96bc('0x17c')]=_0x231dcb[_0x96bc('0xec')][_0x1491e4][_0x96bc('0x17d')]=utils[_0x96bc('0x17e')](_0x45c0f2);_0x139dab[_0x96bc('0x17f')]=_0x5aa91b[_0x96bc('0x163')];}_0x3e785b['variables']=_0x139dab;return ami['Action']({'actionid':_0x1491e4,'action':_0x96bc('0x161'),'channel':_0x231dcb[_0x96bc('0x84')](_0x3e785b[_0x96bc('0x175')])?util['format'](_0x96bc('0x180'),_0x3e785b[_0x96bc('0x175')][_0x96bc('0x5f')],isNotNull(_0x3e785b['dialPrefix'])?_0x3e785b[_0x96bc('0x181')][_0x96bc('0x182')]()||'':'',_0x3e785b[_0x96bc('0x183')]>0x0?_0x5aa91b[_0x96bc('0x163')]['substring'](_0x3e785b[_0x96bc('0x183')]):_0x5aa91b[_0x96bc('0x163')]):util[_0x96bc('0x44')](_0x96bc('0x180'),_[_0x96bc('0xf6')](_0x3e785b[_0x96bc('0x89')])?_0x3e785b['Trunk'][_0x96bc('0x5f')]:_0x3e785b[_0x96bc('0x89')][_0x96bc('0x5f')],isNotNull(_0x3e785b['dialPrefix'])?_0x3e785b['dialPrefix'][_0x96bc('0x182')]()||'':'',_0x3e785b[_0x96bc('0x183')]>0x0?_0x5aa91b[_0x96bc('0x163')][_0x96bc('0x184')](_0x3e785b[_0x96bc('0x183')]):_0x5aa91b[_0x96bc('0x163')]),'callerid':_0x45c0f2,'Exten':_0x96bc('0x112'),'Context':'from-sip','Priority':'1','variable':_0x139dab,'timeout':(_0x3e785b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1491e4})[_0x96bc('0x3b')](function(_0x3b816d){return _0x29d2bd(_0x3b816d);})[_0x96bc('0x9f')](function(_0x22edc1){_0x3e785b['outboundOriginateFailureCallsDay']+=0x1;var _0x17afbb=new History(_0x231dcb['actions'][_0x1491e4]);logger[_0x96bc('0x64')](util['format']('[originateError]:\x20%s',JSON[_0x96bc('0x73')](_0x22edc1)));_0x17afbb[_0x96bc('0xd0')]=0xe;_0x17afbb[_0x96bc('0x6d')]='OriginateError';_0x17afbb[_0x96bc('0x6f')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));_0x17afbb[_0x96bc('0x6e')]=_0x17afbb[_0x96bc('0x6f')];hopperUtils['createHistory'](_0x17afbb)['catch'](loggerCatch(_0x96bc('0x185')));_0x231dcb[_0x96bc('0xca')](_0x17afbb)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x185')))['finally'](function(){delete _0x231dcb[_0x96bc('0xec')][_0x1491e4];return _0x1bc16f(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x96bc('0x186')]=function(_0x4fde62,_0x430d9f,_0x22befc){var _0x590cc3=new History(_0x430d9f);if(_0x590cc3[_0x96bc('0x122')]+_0x590cc3[_0x96bc('0x12f')]+_0x590cc3[_0x96bc('0x123')]+_0x590cc3['countnosuchnumberretry']+_0x590cc3['countdropretry']+_0x590cc3[_0x96bc('0xe4')]+_0x590cc3[_0x96bc('0x120')]+_0x590cc3['countagentrejectretry']>=_0x22befc[_0x96bc('0x124')]-0x1){return!![];}switch(_0x4fde62){case 0x3:if(_0x590cc3[_0x96bc('0x123')]>=_0x22befc['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x590cc3['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x22befc[_0x96bc('0x187')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x188')));break;case 0x5:if(_0x590cc3['countbusyretry']>=_0x22befc[_0x96bc('0x189')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x590cc3['countbusyretry']+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0x18a')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3['CampaignId']||undefined})['catch'](loggerCatch(_0x96bc('0x18b')));break;case 0x8:if(_0x590cc3['countcongestionretry']>=_0x22befc['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countcongestionretry':_0x590cc3[_0x96bc('0x12f')]+=0x1,'scheduledat':moment()['add'](_0x22befc[_0x96bc('0x18c')],_0x96bc('0xda'))[_0x96bc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x18d')));break;case 0x0:if(_0x590cc3[_0x96bc('0x18e')]>=_0x22befc[_0x96bc('0x18f')]-0x1){return!![];}else{hopperUtils[_0x96bc('0x106')]({'active':![],'countnosuchnumberretry':_0x590cc3[_0x96bc('0x18e')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0x190')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3['ListId'],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x590cc3[_0x96bc('0xd1')]>=_0x22befc['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x590cc3[_0x96bc('0xd1')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0xd3')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x191')));break;case 0xb:if(_0x590cc3['countabandonedretry']>=_0x22befc['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countabandonedretry':_0x590cc3[_0x96bc('0xe4')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0xe5')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xeb')));break;case 0x13:if(_0x590cc3['countmachineretry']>=_0x22befc[_0x96bc('0x127')]-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countmachineretry':_0x590cc3[_0x96bc('0x120')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0x12a')],_0x96bc('0xda'))[_0x96bc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x12b')));break;case 0x14:if(_0x590cc3[_0x96bc('0x130')]>=_0x22befc[_0x96bc('0x192')]-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countagentrejectretry':_0x590cc3[_0x96bc('0x130')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc['dialAgentRejectRetryFrequency'],_0x96bc('0xda'))['format'](_0x96bc('0xc0')),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})['catch'](loggerCatch(_0x96bc('0x193')));break;default:return!![];}};Dialer[_0x96bc('0x1b')][_0x96bc('0x10d')]=function(_0x2cddd6,_0x42e750,_0x3b709c){var _0xced859=this;var _0xf3140d=new History(_0x2cddd6);var _0x5762d5=![];var _0x431c93;var _0x1deb48;return new Promise(function(_0x3d6f95,_0x421cae){if(_[_0x96bc('0x3d')](_0x42e750)&&typeof _0x42e750!=='object'){return _0x421cae(msgResponse(_0x96bc('0x194'),_0x96bc('0x8f'),_0x96bc('0x195')));}if(_[_0x96bc('0x3d')](_0x3b709c)&&typeof _0x3b709c!=='object'){return _0x421cae(msgResponse(_0x96bc('0x194'),_0x96bc('0x8f'),'evt\x20is\x20undefine'));}hopperUtils[_0x96bc('0xd4')](_0xf3140d,_0x3b709c['reason'],_0x42e750)[_0x96bc('0x3b')](function(_0x53d31b){if(_0x53d31b[_0x96bc('0xd6')]==0x1)_0x5762d5=!![];switch(_0x3b709c[_0x96bc('0xc3')]){case'0':_0x42e750[_0x96bc('0x196')]+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x0;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x197');_0xf3140d['countnosuchnumberretry']+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;ami[_0x96bc('0x3e')](_0x96bc('0x198'),ut['buildObj'](_0x2cddd6,_0x96bc('0x199')));_0x431c93=_0x42e750[_0x96bc('0x190')];_0x1deb48=_0x42e750['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x121')));if(_0xced859['checkRetriveMax'](0x0,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countnosuchnumberretry']>=_0x42e750[_0x96bc('0x18f')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x19a'));}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x42e750['outboundNoAnswerCallsDay']+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x3;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x19b');_0xf3140d[_0x96bc('0x123')]+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;var _0x5eaa00=ut[_0x96bc('0x19c')](_0x2cddd6,_0x42e750);ami[_0x96bc('0x3e')](_0x96bc('0x19d'),_0x5eaa00);_0x431c93=_0x42e750['dialNoAnswerRetryFrequency'];_0x1deb48=_0x42e750[_0x96bc('0xe6')];hopperUtils['createHistory'](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x19e')));if(_0xced859[_0x96bc('0x186')](0x3,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countnoanswerretry']>=_0x42e750[_0x96bc('0x19f')]){_0xced859['createStateFinal'](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1a0'));}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1a0'));}}break;case'5':_0x42e750[_0x96bc('0x1a1')]+=0x1;_0xf3140d['state']=0x5;_0xf3140d['statedesc']=_0x96bc('0x1a2');_0xf3140d[_0x96bc('0x122')]+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;ami[_0x96bc('0x3e')](_0x96bc('0x1a3'),ut[_0x96bc('0x12e')](_0x2cddd6,'busy'));_0x431c93=_0x42e750[_0x96bc('0x18a')];_0x1deb48=_0x42e750[_0x96bc('0xe6')];hopperUtils[_0x96bc('0xc8')](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1a4')));if(_0xced859[_0x96bc('0x186')](0x5,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countbusyretry']>=_0x42e750[_0x96bc('0x189')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x205\x20busy');}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1a5'));}}break;case'8':_0x42e750['outboundCongestionCallsDay']+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x8;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x1a6');_0xf3140d['countcongestionretry']+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;_0x431c93=_0x42e750['dialCongestionRetryFrequency'];_0x1deb48=_0x42e750[_0x96bc('0xe6')];ami[_0x96bc('0x3e')](_0x96bc('0x1a7'),ut['buildObj'](_0x2cddd6,_0x96bc('0x1a8')));hopperUtils[_0x96bc('0xc8')](_0xf3140d)[_0x96bc('0x9f')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xced859['checkRetriveMax'](0x8,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d[_0x96bc('0x12f')]>=_0x42e750[_0x96bc('0x1a9')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x208\x20congestion');}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1aa'));}}break;case'11':_0x42e750[_0x96bc('0x1ab')]+=0x1;_0xf3140d['state']=0xb;_0xf3140d[_0x96bc('0x6d')]='Abandoned';_0xf3140d[_0x96bc('0xe4')]+=0x1;_0xf3140d['countglobal']+=0x1;_0x431c93=_0x42e750[_0x96bc('0xe5')];_0x1deb48=_0x42e750['callAdditionalPhoneAfterMin'];hopperUtils[_0x96bc('0xc8')](_0xf3140d)['catch'](loggerCatch(_0x96bc('0x1ac')));if(_0xced859[_0x96bc('0x186')](0xb,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d[_0x96bc('0xe4')]>=_0x42e750[_0x96bc('0xe7')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1ad'));}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1ad'));}}break;case'20':_0x42e750['outboundRejectCallsDay']+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x14;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x1ae');_0xf3140d[_0x96bc('0x130')]+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;_0x431c93=_0x42e750[_0x96bc('0x1af')];_0x1deb48=_0x42e750[_0x96bc('0xe6')];ami[_0x96bc('0x3e')](_0x96bc('0x1b0'),ut[_0x96bc('0x12e')](_0x2cddd6,'agentreject'));hopperUtils[_0x96bc('0xc8')](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1b1')));if(_0xced859[_0x96bc('0x186')](0x14,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d[_0x96bc('0x130')]>=_0x42e750[_0x96bc('0x192')]){_0xced859['createStateFinal'](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1b2'));}else{_0xced859['stateGlobal'](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x2020\x20agentreject');}}break;default:_0x42e750[_0x96bc('0x13e')]+=0x1;_0xf3140d[_0x96bc('0xd0')]=0xc;_0xf3140d[_0x96bc('0x6d')]=_0x3b709c[_0x96bc('0xc3')];_0x431c93=_0x42e750[_0x96bc('0x1af')];_0x1deb48=_0x42e750[_0x96bc('0xe6')];hopperUtils['createHistory'](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1b3')));if(_0xced859[_0x96bc('0x186')](_0x3b709c[_0x96bc('0xc3')],_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countbusyretry']+_0xf3140d[_0x96bc('0x12f')]+_0xf3140d[_0x96bc('0x123')]+_0xf3140d[_0x96bc('0x18e')]+_0xf3140d[_0x96bc('0xd1')]+_0xf3140d[_0x96bc('0xe4')]+_0xf3140d[_0x96bc('0x120')]+_0xf3140d[_0x96bc('0x130')]>=_0x42e750['dialGlobalMaxRetry']){_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x3b709c[_0x96bc('0xc3')]);}else{_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,_0x3b709c[_0x96bc('0xc3')]);}}}})['then'](function(){if(_0x5762d5){hopperUtils[_0x96bc('0xdf')](_0xf3140d,_0x431c93,_0x1deb48)['then'](function(){return _0x3d6f95(0x1);});}});});};Dialer[_0x96bc('0x1b')][_0x96bc('0x125')]=function(_0x2da9c4,_0x2b6d43,_0x64d830,_0x49e77b){var _0x3b0126=new Final(_0x2da9c4);_0x3b0126[_0x96bc('0xd0')]=0xf;_0x3b0126['statedesc']=_0x96bc('0x1b4');this[_0x96bc('0x128')](_0x3b0126,_0x2b6d43,_0x64d830,_0x49e77b);};Dialer[_0x96bc('0x1b')][_0x96bc('0x128')]=function(_0x4da542,_0xd68f72,_0x11945e,_0x476624){hopperUtils[_0x96bc('0xca')](_0x4da542)['then'](function(){return _0xd68f72(msgResponse(_0x96bc('0x194'),'Success',_0x476624));})['catch'](function(){return _0x11945e(msgResponse('[moveContactManagedDialer][0]',_0x96bc('0x8f'),'contact\x20not\x20moved'));});};Dialer[_0x96bc('0x1b')][_0x96bc('0xa')]=function(_0x39c071){var _0x4ad716=_0x39c071[_0x96bc('0x1b5')]/0x64;var _0x36b303=_0x39c071[_0x96bc('0xce')]/(_0x39c071[_0x96bc('0xce')]+_0x39c071['outboundAnswerCallsDay']);var _0x4cbb7b=Math[_0x96bc('0x1b6')](_0x39c071[_0x96bc('0x1b7')]*(_0x39c071['predictiveIntervalMaxThreshold']/0x64));var _0x6a9059=Math[_0x96bc('0x1b6')](_0x39c071[_0x96bc('0x1b7')]*(_0x39c071[_0x96bc('0x1b8')]/0x64));var _0x505311=_0x39c071[_0x96bc('0x1b9')]+_0x39c071[_0x96bc('0x144')];var _0x2f0997=Math[_0x96bc('0x1ba')](_0x39c071[_0x96bc('0x1bb')]*_0x39c071[_0x96bc('0x5d')]*_0x39c071[_0x96bc('0x1bc')]*_0x39c071['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x39c071[_0x96bc('0x28')])){if(!_[_0x96bc('0x3d')](_0x39c071[_0x96bc('0x27')])){_0x39c071[_0x96bc('0x27')]=undefined;loggerPredictive[_0x96bc('0x64')](_0x96bc('0x1bd'),_0x96bc('0x1be'));}if(!_['isUndefined'](_0x39c071[_0x96bc('0x62')])){loggerPredictive[_0x96bc('0x64')](_0x96bc('0x1bd'),_0x96bc('0x1bf'));clearInterval(_0x39c071['handlePredictive']);_0x39c071[_0x96bc('0x62')]=undefined;}_0x39c071[_0x96bc('0x28')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));loggerPredictive['info'](_0x39c071['name'],_0x96bc('0x1c0'),_0x39c071[_0x96bc('0x28')]);this[_0x96bc('0xb1')](_0x39c071,0x1);}else if(ifInterval(_0x39c071['dialPredictiveInterval'],_0x39c071[_0x96bc('0x28')])){this[_0x96bc('0xb1')](_0x39c071,0x1);loggerPredictiveCalls['info'](_0x96bc('0x1c1'),_0x39c071['startProgressive'],_0x39c071[_0x96bc('0x5f')]);_0x39c071['erlangCalls']=0x0;_0x39c071[_0x96bc('0xcf')]=0x0;}else if(_0x4ad716<_0x36b303&&_0x39c071[_0x96bc('0x1c2')]===_0x96bc('0x1c3')){clearPredictiveAttributes(_0x39c071);loggerPredictive['info'](_0x96bc('0x1c4'),_0x96bc('0x1c5'),_0x36b303,'startProgressive',_0x39c071[_0x96bc('0x5f')]);}else if(_0x2f0997<_0x39c071[_0x96bc('0xcf')]&&_0x39c071[_0x96bc('0x1c2')]===_0x96bc('0x1c3')){clearPredictiveAttributes(_0x39c071);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x1c6'),_0x96bc('0x1c7'),_0x2f0997,_0x96bc('0x1c8'),_0x39c071[_0x96bc('0xcf')],_0x96bc('0x28'),_0x39c071[_0x96bc('0x5f')]);}else if(!ifInterval(_0x39c071[_0x96bc('0x1c9')],_0x39c071['startProgressive'])&&_[_0x96bc('0x3d')](_0x39c071['startPredictive'])&&!_[_0x96bc('0x3d')](_0x39c071['startProgressive'])){_0x39c071[_0x96bc('0x27')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));loggerPredictive[_0x96bc('0x48')](_0x39c071['name'],_0x96bc('0x1ca'),_0x39c071[_0x96bc('0x27')]);hopperUtils['avgHandleTime'](_0x39c071[_0x96bc('0x1c9')])[_0x96bc('0x3b')](this[_0x96bc('0x1cb')](_0x39c071))[_0x96bc('0x3b')](mergeDataErlangB(_0x39c071))[_0x96bc('0x3b')](this[_0x96bc('0x1cc')](_0x39c071))[_0x96bc('0x9f')](loggerCatchPredictive(_0x96bc('0x1cd'),_0x39c071));}else if(!ifInterval(_0x39c071[_0x96bc('0x1c9')],_0x39c071[_0x96bc('0x27')])){_0x39c071['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x39c071[_0x96bc('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x96bc('0x48')](_0x39c071[_0x96bc('0x5f')],_0x96bc('0x1ce'),_0x39c071['startPredictive']);clearInterval(_0x39c071['handlePredictive']);_0x39c071[_0x96bc('0x62')]=undefined;hopperUtils[_0x96bc('0x1cf')](_0x39c071[_0x96bc('0x1c9')])['then'](this[_0x96bc('0x1cb')](_0x39c071))[_0x96bc('0x3b')](mergeDataErlangB(_0x39c071))[_0x96bc('0x3b')](this[_0x96bc('0x1cc')](_0x39c071))[_0x96bc('0x9f')](loggerCatchPredictive(_0x96bc('0x1d0'),_0x39c071));}else if(_0x39c071[_0x96bc('0x1b7')]&&_0x505311<_0x39c071[_0x96bc('0x1b7')]-_0x6a9059){clearPredictiveAttributes(_0x39c071);loggerPredictive[_0x96bc('0x48')](_0x39c071[_0x96bc('0x5f')],_0x96bc('0x1d1'),_0x505311,')\x20are\x20less\x20than\x20threshold\x20(',_0x39c071[_0x96bc('0x1b7')],'-',_0x6a9059,'=',_0x39c071[_0x96bc('0x1b7')]-_0x6a9059,')');}else if(_0x39c071['predictiveIntervalAvailable']&&_0x505311>_0x39c071[_0x96bc('0x1b7')]+_0x4cbb7b){clearPredictiveAttributes(_0x39c071);loggerPredictive[_0x96bc('0x48')](_0x39c071[_0x96bc('0x5f')],_0x96bc('0x1d1'),_0x505311,_0x96bc('0x1d2'),_0x39c071[_0x96bc('0x1b7')],'+',_0x4cbb7b,'=',_0x39c071[_0x96bc('0x1b7')]+_0x4cbb7b,')');}};Dialer[_0x96bc('0x1b')][_0x96bc('0x1cb')]=function(_0x2ed98f){var _0x3ca588=this;return function(_0x49a503){return new Promise(function(_0x3cd693,_0x40e895){_[_0x96bc('0x5e')](_0x2ed98f,_0x49a503[0x0]);if(checkGetDataPredictive(_0x49a503[0x0])){var _0x5975e5=_0x2ed98f[_0x96bc('0x1b7')]=_0x2ed98f[_0x96bc('0x144')]+_0x2ed98f[_0x96bc('0x1b9')];var _0x409525=_0x2ed98f['dialPredictiveInterval']*0x3c;var _0x7895f7=_0x49a503[0x0][_0x96bc('0x53')]+_0x49a503[0x0][_0x96bc('0x51')];var _0x4e3050=(_0x49a503[0x0][_0x96bc('0x4b')]+_0x49a503[0x0][_0x96bc('0x4d')]+_0x49a503[0x0][_0x96bc('0x4f')])/_0x49a503[0x0][_0x96bc('0x4a')];_0x2ed98f[_0x96bc('0x1bc')]=_0x4e3050>0x0?_0x4e3050:0x1;switch(_0x2ed98f[_0x96bc('0x1c2')]){case'dropRate':var _0x31020e=_0x2ed98f[_0x96bc('0x1b5')]/0x64;return _0x3ca588[_0x96bc('0x1d3')](_0x5975e5,_0x409525,_0x7895f7,_0x4e3050,_0x31020e)['then'](function(_0x45dbf3){return _0x3cd693(_0x45dbf3);});case _0x96bc('0x1d4'):var _0x369864=_0x2ed98f[_0x96bc('0x1b5')]/0x64;return _0x3ca588[_0x96bc('0x1d5')](_0x5975e5,_0x409525,_0x7895f7,_0x4e3050,_0x369864)['then'](function(_0x3f2704){return _0x3cd693(_0x3f2704);});default:return _0x40e895(msgResponse('[getDataPredictive]',_0x96bc('0x8f'),_0x96bc('0x1d6')));}}else{return _0x40e895(msgResponse(_0x96bc('0x1d7'),_0x96bc('0x8f'),'check\x20failure'));}});};};Dialer[_0x96bc('0x1b')][_0x96bc('0x1d8')]=function(_0x473b69){var _0x39635f=this;return function(_0xa69318){return new Promise(function(_0x579f88,_0x121884){_['merge'](_0x473b69,_0xa69318[0x0]);if(checkGetDataPredictive(_0xa69318[0x0])){loggerPredictive[_0x96bc('0x48')](JSON[_0x96bc('0x73')](_0xa69318[0x0]));if(_0x473b69['dialPredictiveOptimization']===_0x96bc('0x1c3')){return _0x39635f[_0x96bc('0x158')](_0x473b69['id'])['then'](function(_0x297aaf){var _0x392736=_0x473b69[_0x96bc('0x1d9')]-_0x297aaf[0x0][_0x96bc('0x1da')];var _0x1daf34=_0x473b69[_0x96bc('0x1c9')]*0x3c;var _0x411a3a=_0xa69318[0x0][_0x96bc('0x53')]+_0xa69318[0x0]['predictiveIntervalAvgHoldtime'];var _0xd433e9=(_0xa69318[0x0]['predictiveIntervalAnsweredCalls']+_0xa69318[0x0][_0x96bc('0x4d')]+_0xa69318[0x0][_0x96bc('0x4f')])/_0xa69318[0x0][_0x96bc('0x4a')];var _0x35e11f=_0x473b69[_0x96bc('0x1b5')]/0x64;_0x473b69[_0x96bc('0x1db')]=_0x297aaf[0x0][_0x96bc('0x1da')]||0x0;_0x473b69[_0x96bc('0x1bc')]=_0xd433e9>0x0?_0xd433e9:0x1;return _0x39635f[_0x96bc('0x1d3')](_0x392736,_0x1daf34,_0x411a3a,_0xd433e9,_0x35e11f);})['then'](function(_0x516b45){return _0x579f88(_0x516b45);})['catch'](function(_0x463c39){return _0x121884(msgResponse(_0x96bc('0x1dc'),_0x96bc('0x8f'),JSON[_0x96bc('0x73')](_0x463c39)));});}if(_0x473b69[_0x96bc('0x1c2')]===_0x96bc('0x1d4')){return _0x39635f['getVoiceQueueRtPauses'](_0x473b69['id'])['then'](function(_0x20b522){var _0x2f4ea2=_0x473b69[_0x96bc('0x1d9')]-_0x20b522[0x0][_0x96bc('0x1da')];var _0x27b7a9=_0x473b69[_0x96bc('0x1c9')]*0x3c;var _0x4f9884=_0xa69318[0x0][_0x96bc('0x53')]+_0xa69318[0x0][_0x96bc('0x51')];var _0x5c949a=(_0xa69318[0x0][_0x96bc('0x4b')]+_0xa69318[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xa69318[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xa69318[0x0]['predictiveIntervalTotalCalls'];var _0x66924a=_0x473b69[_0x96bc('0x1b5')]/0x64;_0x473b69[_0x96bc('0x1db')]=_0x20b522[0x0]['outboundQueuePauses']||0x0;_0x473b69['predictiveIntervalHitRate']=_0x5c949a>0x0?_0x5c949a:0x1;return _0x39635f[_0x96bc('0x1d5')](_0x2f4ea2,_0x27b7a9,_0x4f9884,_0x5c949a,_0x66924a);})[_0x96bc('0x3b')](function(_0x46e75f){return _0x579f88(_0x46e75f);})[_0x96bc('0x9f')](function(_0x2b3c6e){return _0x121884(msgResponse(_0x96bc('0x1dc'),_0x96bc('0x8f'),JSON[_0x96bc('0x73')](_0x2b3c6e)));});}}else{return _0x121884(msgResponse(_0x96bc('0x1d7'),_0x96bc('0x8f'),'check\x20failure'));}});};};Dialer[_0x96bc('0x1b')][_0x96bc('0x1cc')]=function(_0x28e861){var _0x2170ff=this;return function(){var _0x46ffb1=0x0;var _0x48bfdd=Math['floor'](_0x28e861['erlangCallToSecond']*0x3e8);if(_0x48bfdd>0x0){_0x48bfdd=_0x48bfdd<0x64?0x64:_0x48bfdd;loggerPredictive[_0x96bc('0x48')](_0x28e861[_0x96bc('0x5f')],_0x96bc('0x1dd'),_0x48bfdd,_0x96bc('0x1de'));_0x28e861[_0x96bc('0x62')]=setInterval(function(){_0x2170ff[_0x96bc('0x62')](_0x28e861);loggerPredictiveCalls[_0x96bc('0x48')](_0x96bc('0x1df'),_0x46ffb1+=0x1);},_0x48bfdd);}else{loggerPredictive[_0x96bc('0x48')](_0x28e861['name'],_0x96bc('0x1e0'));}};};Dialer[_0x96bc('0x1b')][_0x96bc('0x1e1')]=function(_0xe43189,_0x1e8130){var _0x1b6429=this;return function(_0x14f360){if(_[_0x96bc('0x46')](_0x14f360)){if(_[_0x96bc('0xf6')](_0x1e8130[_0x96bc('0x15b')])||!_0x1e8130[_0x96bc('0x1e2')]){if(_0xe43189['dialMethod']==='booked'){_0xe43189['queueStatusComplete']=_['isUndefined'](_0xe43189[_0x96bc('0x70')])?!![]:_0xe43189[_0x96bc('0x70')];var _0x518ad9=uuid['v4']();_0x1b6429[_0x96bc('0xec')][_0x518ad9]=new Action(_0xe43189,_0x1e8130,_0x518ad9);loggerBooked[_0x96bc('0x48')]('[booked][checkContactBlack]',_0x518ad9,'queueStatusComplete:\x20',JSON[_0x96bc('0x73')](_0xe43189[_0x96bc('0x70')]),_0x96bc('0x1e3'),_0xe43189[_0x96bc('0x5f')]);if(_0xe43189[_0x96bc('0x70')]){_0xe43189[_0x96bc('0x70')]=![];_0x1b6429[_0x96bc('0xf7')][_0x1b6429[_0x96bc('0xec')][_0x518ad9]['queue']]=[];ami[_0x96bc('0x9c')]({'actionid':_0x518ad9,'action':_0x96bc('0x1e4'),'queue':_0xe43189['name']})['catch'](function(){utils['decrementOriginate'](_0xe43189,'[checkContactBlack]');hopperUtils[_0x96bc('0x106')]({'active':![],'ContactId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xe8')],'ListId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xe9')],'VoiceQueueId':_0x1b6429['actions'][_0x518ad9][_0x96bc('0xea')]||undefined,'CampaignId':_0x1b6429['actions'][_0x518ad9][_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1e5')));delete _0x1b6429[_0x96bc('0xec')][_0x518ad9];});}else{loggerBooked['info'](_0x96bc('0x1e6'),JSON[_0x96bc('0x73')](_0xe43189[_0x96bc('0x70')]),_0x96bc('0x1e3'),_0xe43189['name']);utils[_0x96bc('0xbe')](_0xe43189,_0x96bc('0x1e7'));hopperUtils[_0x96bc('0x106')]({'active':![],'ContactId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xe8')],'ListId':_0x1b6429['actions'][_0x518ad9][_0x96bc('0xe9')],'VoiceQueueId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xea')]||undefined,'CampaignId':_0x1b6429[_0x96bc('0xec')][_0x518ad9]['CampaignId']||undefined})['catch'](loggerCatch(_0x96bc('0x1e5')));delete _0x1b6429[_0x96bc('0xec')][_0x518ad9];}}else{return _0x1b6429['actionOriginate'](_0xe43189,_0x1e8130);}}else{if(utils[_0x96bc('0x1e8')](undefined,_0x1e8130[_0x96bc('0x1e9')])<_0xe43189[_0x96bc('0x1ea')]*0x3c){if(_0x1e8130[_0x96bc('0x1eb')]&&!_0x1e8130[_0x96bc('0x1eb')][_0x96bc('0x1ec')]){_0x1b6429['preview'][_0x96bc('0xf9')](_0x1e8130['id'])['finally'](function(){utils['decrementOriginate'](_0xe43189,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x1e8130['id'],0x1)[_0x96bc('0x103')](function(){utils[_0x96bc('0xbe')](_0xe43189,'[checkContactBlack]');});}}else{_0xe43189[_0x96bc('0x1ed')]+=0x1;utils['decrementOriginate'](_0xe43189,_0x96bc('0x1e7'));if(_0xe43189[_0x96bc('0x1ee')]){hopperUtils[_0x96bc('0x106')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e8130['ContactId'],'ListId':_0x1e8130[_0x96bc('0xe9')],'VoiceQueueId':_0x1e8130[_0x96bc('0xea')]||undefined,'CampaignId':_0x1e8130[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1ef')));hopperUtils[_0x96bc('0xc8')](createObjHistory(_0xe43189,_0x1e8130,utils['CAMPAIGN_STATUS'][_0x96bc('0x1f0')],0x17,_0x96bc('0x1f1')))['catch'](loggerCatch(_0x96bc('0x1f2')));}else{_0x1b6429[_0x96bc('0x11a')](createObjHistory(_0xe43189,_0x1e8130,utils[_0x96bc('0x66')][_0x96bc('0x1f3')],0x16,_0x96bc('0x1f4')),_0x96bc('0x1f5'),_0x96bc('0x1f6'));}}}}else{_0xe43189['outboundBlacklistCallsDay']+=0x1;_0x1b6429[_0x96bc('0x11a')](createObjHistory(_0xe43189,_0x1e8130,utils['CAMPAIGN_STATUS'][_0x96bc('0x1f7')],0xd,'Blacklist'),_0x96bc('0x1f8'),'[Originate][MoveBlacklist]');throw _0x96bc('0x1f9');}};};Dialer[_0x96bc('0x1b')]['handleIvr']=function(_0x14db78){var _0x48a8bc=this;var _0x481f04=_0x14db78[_0x96bc('0x1fa')]-_0x14db78[_0x96bc('0x1fb')];emitCampaignSummary(_0x14db78);if(_0x481f04>0x0&&_0x14db78['temp']==0x0){if(_0x481f04>this[_0x96bc('0x23')]){_0x481f04=this[_0x96bc('0x23')];}_0x14db78[_0x96bc('0x1fc')]=0x1;hopperUtils[_0x96bc('0x1fd')](_0x14db78,_0x481f04)[_0x96bc('0x3b')](function(_0x76ba80){_0x14db78['temp']=0x0;if(_0x76ba80){if(!utils[_0x96bc('0x1fe')](_0x76ba80)){_0x14db78[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x6b')];logger[_0x96bc('0x48')](_0x96bc('0x1ff')+_0x14db78[_0x96bc('0x5f')]);}else{_0x14db78[_0x96bc('0x1fb')]+=_0x76ba80[_0x96bc('0x97')];_0x14db78[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x200')];for(var _0x9d84e0=0x0;_0x9d84e0<_0x76ba80[_0x96bc('0x97')];_0x9d84e0+=0x1){_0x14db78['ivrTotalCallsDays']+=0x1;if(_[_0x96bc('0xf6')](_0x76ba80[_0x9d84e0])||_[_0x96bc('0xf6')](_0x76ba80[_0x9d84e0][_0x96bc('0x201')])||_[_0x96bc('0xf6')](_0x76ba80[_0x9d84e0][_0x96bc('0x163')])){_0x48a8bc['emptyContact']('[actionOriginate]\x20',_0x14db78,_0x76ba80[_0x9d84e0]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x96bc('0x74')](_0x76ba80[_0x9d84e0],[_0x96bc('0xdb'),_0x96bc('0x163')]))[_0x96bc('0x3b')](_0x48a8bc[_0x96bc('0x1e1')](_0x14db78,_0x76ba80[_0x9d84e0]))['catch'](function(_0x18e192){logger[_0x96bc('0x64')](_0x96bc('0x202'),_0x18e192);utils[_0x96bc('0xbe')](_0x14db78,'[handleIvr]');});}}}}})[_0x96bc('0x9f')](function(_0x45a6c2){_0x14db78[_0x96bc('0x1fc')]=0x0;logger[_0x96bc('0x64')](_0x96bc('0x203'),_0x45a6c2);});}};Dialer[_0x96bc('0x1b')][_0x96bc('0xb1')]=function(_0x31d634,_0x50c92e){var _0x61a29a=this;var _0x2726c9=[];if(_0x50c92e<0x1||_0x31d634[_0x96bc('0xaf')]==='booked'){_0x50c92e=0x1;}var _0xc773bf=Math['floor'](_0x31d634[_0x96bc('0x1b9')]*_0x50c92e)-_0x31d634[_0x96bc('0x1fb')];if(_0x31d634[_0x96bc('0x204')]>0x0){var _0x1b709d=_0x31d634[_0x96bc('0x204')]-_0x31d634[_0x96bc('0x1fb')]-_0x31d634['talking']-_0x31d634['pTalking'];if(_0xc773bf>_0x1b709d){_0xc773bf=_0x1b709d;}}if(_0xc773bf>0x0&&_0x31d634[_0x96bc('0x1fc')]==0x0){if(_0x31d634[_0x96bc('0xaf')]===_0x96bc('0x9')){_0xc773bf=0x1;}if(_0xc773bf>this[_0x96bc('0x23')]){_0xc773bf=this['maxNumberOriginate'];}for(var _0x870856 in this[_0x96bc('0x21')]){if(typeof this[_0x96bc('0x21')][_0x870856]!==_0x96bc('0xa9')){if(this[_0x96bc('0x21')][_0x870856][_0x96bc('0xd0')]===_0x96bc('0x205')&&this['agents'][_0x870856][_0x96bc('0x87')]===_0x96bc('0x88')){_0x2726c9['push'](this['agents'][_0x870856]['id']);}}}_0x31d634[_0x96bc('0x1fc')]=0x1;hopperUtils[_0x96bc('0x206')](_0x31d634,_0x2726c9,_0xc773bf)[_0x96bc('0x3b')](function(_0x2b3062){_0x31d634[_0x96bc('0x1fc')]=0x0;if(_0x2b3062){if(!utils['checkContactEmpty'](_0x2b3062)){hopperUtils['countReScheduled'](_0x31d634)[_0x96bc('0x3b')](sendMessageReschedule(_0x31d634))[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x207')));}else{_0x31d634[_0x96bc('0x1fb')]+=_0x2b3062['length'];_0x31d634[_0x96bc('0x6a')]=_0x31d634[_0x96bc('0xaf')]===_0x96bc('0x9')?utils[_0x96bc('0x66')][_0x96bc('0x146')]:utils[_0x96bc('0x66')]['RUNNING'];for(var _0x49860f=0x0;_0x49860f<_0x2b3062['length'];_0x49860f+=0x1){if(_[_0x96bc('0xf6')](_0x2b3062[_0x49860f])||_[_0x96bc('0xf6')](_0x2b3062[_0x49860f][_0x96bc('0x201')])||_[_0x96bc('0xf6')](_0x2b3062[_0x49860f][_0x96bc('0x163')])){_0x61a29a[_0x96bc('0x208')](_0x96bc('0x209'),_0x31d634,_0x2b3062[_0x49860f]);}else{hopperUtils[_0x96bc('0x20a')](_['pick'](_0x2b3062[_0x49860f],[_0x96bc('0xea'),_0x96bc('0x163')]))[_0x96bc('0x3b')](_0x61a29a[_0x96bc('0x1e1')](_0x31d634,_0x2b3062[_0x49860f]))[_0x96bc('0x9f')](function(_0x3e13b6){logger[_0x96bc('0x64')]('[actionOriginate]',_0x3e13b6);utils['decrementOriginate'](_0x31d634,_0x96bc('0x20b'));});}}}}})[_0x96bc('0x9f')](function(_0x2a84ac){_0x31d634[_0x96bc('0x1fc')]=0x0;logger['error']('[getContactCampaign2]',_0x2a84ac);});}};Dialer[_0x96bc('0x1b')][_0x96bc('0x62')]=function(_0x10e22c){if(_0x10e22c[_0x96bc('0x204')]>0x0){var _0x22b697=_0x10e22c[_0x96bc('0x204')]-_0x10e22c['originated']-_0x10e22c['talking'];if(_0x22b697>0x0&&_0x10e22c[_0x96bc('0x1fc')]==0x0){this['tryOriginatePredictive'](_0x10e22c);}else{loggerPredictiveCalls[_0x96bc('0x48')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x10e22c);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x36f910){var _0x54bc0f=this;var _0x1684fe=[];_0x36f910[_0x96bc('0x1fb')]+=0x1;for(var _0x13bd0c in this[_0x96bc('0x21')]){if(typeof this['agents'][_0x13bd0c]!=='undefined'){if(this[_0x96bc('0x21')][_0x13bd0c][_0x96bc('0xd0')]===_0x96bc('0x205')&&this[_0x96bc('0x21')][_0x13bd0c][_0x96bc('0x87')]===_0x96bc('0x88')){_0x1684fe[_0x96bc('0x98')](this[_0x96bc('0x21')][_0x13bd0c]['id']);}}}_0x36f910[_0x96bc('0x1fc')]=0x1;return this[_0x96bc('0x206')](_0x36f910['id'],_0x1684fe,0x1,_0x36f910[_0x96bc('0x20c')],_0x36f910)[_0x96bc('0x3b')](function(_0x32622e){_0x36f910[_0x96bc('0x1fc')]=0x1;if(_0x32622e){if(!utils[_0x96bc('0x1fe')](_0x32622e)){utils[_0x96bc('0x20d')](_0x36f910,0x1,0x0);return hopperUtils[_0x96bc('0x20e')](_0x36f910)[_0x96bc('0x3b')](sendMessageReschedule(_0x36f910))[_0x96bc('0x9f')](loggerCatch('[countReScheduled]\x20'));}else{_0x36f910['message']=utils[_0x96bc('0x66')][_0x96bc('0x200')];if(_['isNil'](_0x32622e[0x0])||_[_0x96bc('0xf6')](_0x32622e[0x0]['Contact'])||_[_0x96bc('0xf6')](_0x32622e[0x0][_0x96bc('0x163')])){_0x54bc0f[_0x96bc('0x208')](_0x96bc('0x209'),_0x36f910,_0x32622e[0x0]);}else{return hopperUtils[_0x96bc('0x20a')](_[_0x96bc('0x74')](_0x32622e[0x0],[_0x96bc('0xea'),_0x96bc('0x163')]))[_0x96bc('0x3b')](_0x54bc0f[_0x96bc('0x1e1')](_0x36f910,_0x32622e[0x0]))[_0x96bc('0x9f')](function(_0x137728){logger['error']('[actionOriginatePredictive]',_0x137728);utils[_0x96bc('0xbe')](_0x36f910,_0x96bc('0x20f'));});}}}})[_0x96bc('0x9f')](function(_0x1b3168){_0x36f910[_0x96bc('0x1fc')]=0x0;logger[_0x96bc('0x64')]('[getContactCampaign2]',_0x1b3168);});};Dialer[_0x96bc('0x1b')][_0x96bc('0x1d3')]=function(_0x1bc18d,_0xd9946d,_0xc07bdd,_0x36699c,_0x24aa92,_0x1ff4e1){loggerPredictive[_0x96bc('0x48')](_0x96bc('0x210'));loggerPredictive[_0x96bc('0x48')](_0x96bc('0x211'),_0x1bc18d);loggerPredictive['info'](_0x96bc('0x212'),_0xd9946d);loggerPredictive['info'](_0x96bc('0x213'),_0xc07bdd);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x214'),_0x36699c);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24aa92);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));return new Promise(function(_0x41f64d,_0x48d8a8){if(_0x1bc18d<=0x0||isNaN(_0x1bc18d)){return _0x48d8a8(msgResponse(_0x96bc('0x215'),_0x96bc('0x83'),_0x96bc('0x216')+_0x1bc18d));}if(_0xc07bdd<=0x0||isNaN(_0xc07bdd)){return _0x48d8a8(msgResponse(_0x96bc('0x215'),_0x96bc('0x83'),_0x96bc('0x217')+_0xc07bdd));}if(_0x36699c<=0x0||isNaN(_0x36699c)){return _0x48d8a8(msgResponse('[abandonmentRate]',_0x96bc('0x83'),_0x96bc('0x218')+_0x36699c));}if(_0xd9946d<=0x0||isNaN(_0xd9946d)){return _0x48d8a8(msgResponse(_0x96bc('0x215'),_0x96bc('0x83'),_0x96bc('0x219')+_0xd9946d));}if(_0x24aa92<=0x0||isNaN(_0x24aa92)){return _0x48d8a8(msgResponse('[abandonmentRate]',_0x96bc('0x83'),_0x96bc('0x21a')+_0x24aa92));}_0x1ff4e1=_0x1ff4e1||0x0;var _0x56afca=0x1/_0xc07bdd;var _0x3b9a3d=0x0;var _0x40fec9=0x0;var _0x150659=0x0;var _0x2eb51d=0x0;for(var _0x28889b=0x0;_0x150659<_0x24aa92;_0x28889b+=0x1){_0x40fec9=_0x28889b/_0xd9946d;_0x3b9a3d=(_0x36699c*_0x40fec9+_0x1ff4e1)/_0x56afca;_0x150659=utils[_0x96bc('0x21b')](_0x3b9a3d,_0x1bc18d);_0x2eb51d=_0x3b9a3d/_0x1bc18d*(0x1-utils[_0x96bc('0x21b')](_0x3b9a3d,_0x1bc18d));}return _0x41f64d({'erlangCalls':_0x28889b,'erlangCallToSecond':_0xd9946d/_0x28889b,'erlangAbandonmentRate':_0x150659,'erlangBusyFactor':_0x2eb51d});});};Dialer[_0x96bc('0x1b')][_0x96bc('0x1d5')]=function(_0x8f92d3,_0xd9d67d,_0x238eb5,_0x409004,_0x2ff7db,_0x2e07d1){loggerPredictive[_0x96bc('0x48')](_0x96bc('0x21c'));loggerPredictive['info'](_0x96bc('0x211'),_0x8f92d3);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x212'),_0xd9d67d);loggerPredictive[_0x96bc('0x48')]('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',_0x238eb5);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x214'),_0x409004);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ff7db);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));return new Promise(function(_0x506aa8,_0x199ece){if(_0x8f92d3<=0x0||isNaN(_0x8f92d3)){return _0x199ece(msgResponse(_0x96bc('0x21d'),_0x96bc('0x83'),_0x96bc('0x216')+_0x8f92d3));}if(_0x238eb5<=0x0||isNaN(_0x238eb5)){return _0x199ece(msgResponse(_0x96bc('0x21d'),_0x96bc('0x83'),'Ts\x20=\x20'+_0x238eb5));}if(_0x409004<=0x0||isNaN(_0x409004)){return _0x199ece(msgResponse(_0x96bc('0x21d'),'Error',_0x96bc('0x218')+_0x409004));}if(_0xd9d67d<=0x0||isNaN(_0xd9d67d)){return _0x199ece(msgResponse(_0x96bc('0x21d'),_0x96bc('0x83'),_0x96bc('0x219')+_0xd9d67d));}if(_0x2ff7db<=0x0||isNaN(_0x2ff7db)){return _0x199ece(msgResponse('[busyFactor]',_0x96bc('0x83'),_0x96bc('0x21e')+_0x2ff7db));}_0x2e07d1=_0x2e07d1||0x0;var _0xe126c2=0x1/_0x238eb5;var _0x29a376=0x0;var _0x304070=0x0;var _0x14ab1a=0x0;var _0xe482f2=0x0;for(var _0x29ff68=0x0;_0xe482f2<_0x2ff7db;_0x29ff68+=0x1){_0x304070=_0x29ff68/_0xd9d67d;_0x29a376=(_0x409004*_0x304070+_0x2e07d1)/_0xe126c2;_0x14ab1a=utils[_0x96bc('0x21b')](_0x29a376,_0x8f92d3);_0xe482f2=_0x29a376/_0x8f92d3*(0x1-utils[_0x96bc('0x21b')](_0x29a376,_0x8f92d3));}return _0x506aa8({'erlangCalls':_0x29ff68,'erlangCallToSecond':_0xd9d67d/_0x29ff68,'erlangAbandonmentRate':_0x14ab1a,'erlangBusyFactor':_0xe482f2});});};module[_0x96bc('0x21f')]=Dialer; \ No newline at end of file +var _0xbeff=['[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalTotalCalls','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','getContactDialer','[countReScheduled]\x20','[actionOriginate]','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','undefined','not_inuse','checkContactLowerLimitOriginate','countReScheduled','[actionOriginatePredictive]','--------\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','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','isUndefined','emit','outbound','debug','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','active','SIP/%s','reachable','unmonitored','prototype','checkIsTrunkReachable','isTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','timezones','Failure','\x20Timezone\x20unknow\x20','isArray','push','command','interval','then','content','indexOf','true','catch','Action','iftime\x20%s,%s','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','type','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','countglobal','callAdditionalPhoneAfterMin','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','verifyAdditionalPhones','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','CampaignId','endtime','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','locked','status','paused','stateinterface','rrmemory','isNil','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countcongestionretry','dialMachineMaxRetry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncAgentCompleteIvr]','[syncHangup]','AnswerAGI','AGI','[syncHangupIvr]','[syncHangup2]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','syncQueueSummary','running','INACTIVE','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','enqueue','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','Agent','handleIvr','actionOriginate','object','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','TrunkBackup','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0xbeff,0x8e));var _0xfbef=function(_0x358ec6,_0x5006f1){_0x358ec6=_0x358ec6-0x0;var _0x219dee=_0xbeff[_0x358ec6];return _0x219dee;};'use strict';var util=require('util');var _=require(_0xfbef('0x0'));var uuid=require(_0xfbef('0x1'));var moment=require(_0xfbef('0x2'));var rr=require('rr');var Redis=require(_0xfbef('0x3'));var utils=require(_0xfbef('0x4'));var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require(_0xfbef('0x5'));var logger=require(_0xfbef('0x6'))(_0xfbef('0x7'));var loggerBooked=require(_0xfbef('0x6'))('booked');var loggerPredictive=require(_0xfbef('0x6'))(_0xfbef('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0xfbef('0x9'));var loggerSyncQueueSummary=require(_0xfbef('0x6'))('syncQueueSummary');var ami=require(_0xfbef('0xa'));config['redis']=_[_0xfbef('0xb')](config['redis'],{'host':_0xfbef('0xc'),'port':0x18eb});var io=require(_0xfbef('0xd'))(new Redis(config[_0xfbef('0xe')]));var cmHopper=require(_0xfbef('0xf'));var voiceQueueRt=require(_0xfbef('0x10'));var RpcSetting=require(_0xfbef('0x11'));var Interval=require(_0xfbef('0x12'));var Action=require(_0xfbef('0x13'));var History=require('./models/history');var Final=require(_0xfbef('0x14'));var AgentComplete=require(_0xfbef('0x15'));var QueueCallerAbandon=require(_0xfbef('0x16'));var Hangup=require(_0xfbef('0x17'));var ipAgi=process[_0xfbef('0x18')][_0xfbef('0x19')]||_0xfbef('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x58ec38){this['tail']=this[_0xfbef('0x1b')]?this[_0xfbef('0x1b')][_0xfbef('0x1c')](_0x58ec38):_0x58ec38();};function Dialer(_0x4d74eb,_0x1e9a88){this[_0xfbef('0x1d')]=new Sequence();this[_0xfbef('0x1e')]=_0x1e9a88;this[_0xfbef('0x1f')]=_0x4d74eb[_0xfbef('0x1f')];this[_0xfbef('0x20')]=_0x4d74eb['campaigns'];this['agents']=_0x4d74eb[_0xfbef('0x21')];this[_0xfbef('0x22')]=_0x4d74eb[_0xfbef('0x22')];this[_0xfbef('0x23')]=config['maxNumberOriginate']||0x2;this[_0xfbef('0x24')]={};this[_0xfbef('0x25')]={};this[_0xfbef('0x26')]={};this[_0xfbef('0x27')]={};this[_0xfbef('0x28')]={};this[_0xfbef('0x29')]={};this['startProgressive']={};this[_0xfbef('0x2a')]={};this[_0xfbef('0x2b')]={};this['queueBookedRR']={};this[_0xfbef('0x2c')]={};ami['on']('agentconnect',this[_0xfbef('0x2d')][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x2f'),this[_0xfbef('0x30')][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x31'),this['syncOriginateResponse'][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x32'),this[_0xfbef('0x33')][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x34'),this['syncQueueSummary'][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x35'),this[_0xfbef('0x36')][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x37'),this[_0xfbef('0x38')][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x39'),this[_0xfbef('0x3a')]['bind'](this));ami['on'](_0xfbef('0x3b'),this[_0xfbef('0x3c')][_0xfbef('0x2e')](this));ami['on'](_0xfbef('0x3d'),this[_0xfbef('0x3e')][_0xfbef('0x2e')](this));ami['on']('queuestatuscomplete',this[_0xfbef('0x3f')][_0xfbef('0x2e')](this));this[_0xfbef('0x40')]();this[_0xfbef('0x41')]();RpcSetting[_0xfbef('0x42')]()['then'](function(_0xf0cfd9){previewRecallmeReminderInterval=_0xf0cfd9['previewRecallmeReminderInterval'];});}function isNotNull(_0x396a05){return _0x396a05!==null&&!_[_0xfbef('0x43')](_0x396a05);}function msgResponse(_0x337a2b,_0x7d758b,_0x39e1e2){return{'action':_0x337a2b,'response':_0x7d758b,'message':_0x39e1e2,'stack':_0x39e1e2};}function emit(_0x161406,_0x533b96,_0x5b8a72){io['to'](_0x161406)[_0xfbef('0x44')](_0x533b96,_0x5b8a72);}function emitOutboundVoiceQueueSummary(_0xc730df){if(_0xc730df['type']===_0xfbef('0x45')){logger[_0xfbef('0x46')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xfbef('0x47')](_0xc730df,{'showHidden':![],'depth':null}));emit(util[_0xfbef('0x48')]('voice:queue:%s',_0xc730df[_0xfbef('0x49')]),_0xfbef('0x4a'),_0xc730df);}}function checkGetDataPredictive(_0x4cac01){if(isNotNull(_0x4cac01)&&!_[_0xfbef('0x4b')](_0x4cac01)){loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x4d'));loggerPredictive['info'](_0xfbef('0x4e'),_0x4cac01['predictiveIntervalTotalCalls']);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x4f'),_0x4cac01['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x50'),_0x4cac01['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x51'),_0x4cac01[_0xfbef('0x52')]);loggerPredictive[_0xfbef('0x4c')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4cac01[_0xfbef('0x53')]);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x54'),_0x4cac01[_0xfbef('0x55')]);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x56'));if(_0x4cac01['predictiveIntervalTotalCalls']>0x0){if(!_[_0xfbef('0x43')](_0x4cac01[_0xfbef('0x55')])&&_0x4cac01[_0xfbef('0x55')]>0x0){return!![];}loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x57'));if(!_[_0xfbef('0x43')](_0x4cac01['predictiveIntervalAvgHoldtime'])&&_0x4cac01[_0xfbef('0x53')]>0x0){return!![];}loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x58'));}else{loggerPredictive[_0xfbef('0x4c')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x59'));}return![];}function mergeDataErlangB(_0x421590){return function(_0x1b254e){loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x5a'));loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x5b'),_0x1b254e[_0xfbef('0x5c')]);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x5d'),_0x1b254e['erlangCallToSecond']);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x5e'),_0x1b254e[_0xfbef('0x5f')]);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x60'),_0x1b254e[_0xfbef('0x61')]);loggerPredictive[_0xfbef('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b254e[_0xfbef('0x5f')]);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x56'));_[_0xfbef('0x62')](_0x421590,_0x1b254e);};}function ifInterval(_0x250d7e,_0x4da96b){if(_[_0xfbef('0x43')](_0x4da96b)){return![];}return utils[_0xfbef('0x63')](undefined,_0x4da96b)<_0x250d7e*0x3c;}function clearPredictiveAttributes(_0x4795f2){if(_0x4795f2[_0xfbef('0x64')]){_0x4795f2[_0xfbef('0x64')]=undefined;loggerPredictive['debug'](_0x4795f2[_0xfbef('0x49')],_0xfbef('0x65'));}if(_0x4795f2['startPredictive']){_0x4795f2['startPredictive']=undefined;loggerPredictive[_0xfbef('0x46')](_0x4795f2[_0xfbef('0x49')],_0xfbef('0x66'));}if(_0x4795f2[_0xfbef('0x67')]){clearInterval(_0x4795f2[_0xfbef('0x67')]);_0x4795f2[_0xfbef('0x67')]=undefined;loggerPredictive[_0xfbef('0x46')](_0x4795f2[_0xfbef('0x49')],_0xfbef('0x68'));}}function loggerCatchPredictive(_0x5b3d4e,_0x3fa6c2){return function(_0x329079){loggerPredictive['error'](_0x3fa6c2['name'],_0x5b3d4e);loggerPredictive[_0xfbef('0x69')](_0x329079[_0xfbef('0x6a')]);clearPredictiveAttributes(_0x3fa6c2);};}function loggerCatch(_0x1d5109){return function(_0x4a9212){logger['error'](_0x1d5109,util['inspect'](_0x4a9212,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x57b80f){return function(_0x5ceeae){if(isNotNull(_0x5ceeae)&&isNotNull(_0x5ceeae[0x0])){if(_0x5ceeae[0x0][_0xfbef('0x6b')]>0x0){_0x57b80f['message']=utils[_0xfbef('0x6c')][_0xfbef('0x6d')];logger[_0xfbef('0x4c')](_0xfbef('0x6e')+_0x57b80f['name'],_0x5ceeae[0x0][_0xfbef('0x6b')],_0xfbef('0x6f'));}else{_0x57b80f[_0xfbef('0x70')]=utils[_0xfbef('0x6c')]['NO_AVAILABLE_CONTACTS'];logger[_0xfbef('0x4c')](_0xfbef('0x71')+_0x57b80f[_0xfbef('0x49')]);}}};}function createObjHistory(_0x46c617,_0x322e39,_0x39e1db,_0x11e698,_0xda0f84){_0x46c617['message']=_0x39e1db;var _0x363cb2=new Action(_0x46c617,_0x322e39);var _0x186670=new History(_0x363cb2);_0x186670[_0xfbef('0x72')]=_0x11e698;_0x186670[_0xfbef('0x73')]=_0xda0f84;_0x186670['endtime']=_0x363cb2['starttime'];return _0x186670;}function unlockQueueStatus(_0x28b000,_0x2f19df){setTimeout(function(){if(_[_0xfbef('0x43')](_0x28b000[_0xfbef('0x74')])){loggerBooked[_0xfbef('0x69')](_0xfbef('0x75'),_0x2f19df);}_0x28b000['queueStatusComplete']=!![];loggerBooked[_0xfbef('0x4c')](_0xfbef('0x76'),_0x2f19df,JSON[_0xfbef('0x77')](_[_0xfbef('0x78')](_0x28b000,[_0xfbef('0x49'),_0xfbef('0x74')])));},0x1f3);}function checkInterval(_0x342045){return function(){if(!isNotNull(_0x342045[_0xfbef('0x79')])){_0x342045[_0xfbef('0x70')]=utils[_0xfbef('0x6c')]['NULL_INTERVAL'];throw _0x342045[_0xfbef('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x342045[_0xfbef('0x79')]['Intervals'])){_0x342045['message']=utils[_0xfbef('0x6c')][_0xfbef('0x7a')];throw _0x342045[_0xfbef('0x49')]+_0xfbef('0x7b');}if(!isNotNull(_[_0xfbef('0x4b')](_0x342045[_0xfbef('0x79')][_0xfbef('0x7c')]))){_0x342045['message']=utils['CAMPAIGN_STATUS'][_0xfbef('0x7a')];throw _0x342045[_0xfbef('0x49')]+_0xfbef('0x7b');}};}function checkIsIVRCampaignActive(_0x43b092){return function(){if(!utils[_0xfbef('0x7d')](_0x43b092)){_0x43b092[_0xfbef('0x70')]=utils[_0xfbef('0x6c')]['INACTIVE'];throw _0x43b092['name']+_0xfbef('0x7e');}};}function emitCampaignSummary(_0x390864){if(utils[_0xfbef('0x7f')](_0x390864)){emit(util[_0xfbef('0x48')](_0xfbef('0x80'),_0x390864[_0xfbef('0x49')]),_0xfbef('0x81'),_0x390864);}}function loggerCatchQueueSummary(_0x5d9aa9,_0x433467){return function(_0x3fa58e){clearPredictiveAttributes(_0x433467);emitCampaignSummary(_0x433467);loggerSyncQueueSummary[_0xfbef('0x46')](_0x5d9aa9,util['inspect'](_0x3fa58e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4dea27){if(_0x4dea27[_0xfbef('0x82')]){if(_0x4dea27[_0xfbef('0x83')]===0x0){_0x4dea27[_0xfbef('0x82')]=![];_0x4dea27[_0xfbef('0x70')]=utils[_0xfbef('0x6c')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0xfbef('0x84'),_0x4dea27[_0xfbef('0x49')],_0xfbef('0x85'));}else{_0x4dea27[_0xfbef('0x70')]=utils[_0xfbef('0x6c')][_0xfbef('0x86')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4dea27[_0xfbef('0x49')],_0xfbef('0x87'));}emitCampaignSummary(_0x4dea27);}}function myreject(_0x3be612){return function(_0x90b29e){return _0x3be612(msgResponse(_0xfbef('0x88'),'Error',JSON[_0xfbef('0x77')](_0x90b29e)));};}Dialer['prototype']['isTrunkReachable']=function(_0x316e9a){return!_[_0xfbef('0x43')](_0x316e9a)&&_0x316e9a&&!_[_0xfbef('0x43')](_0x316e9a[_0xfbef('0x49')])&&!_[_0xfbef('0x43')](_0x316e9a[_0xfbef('0x89')])&&_0x316e9a[_0xfbef('0x89')]&&(this['trunks'][util[_0xfbef('0x48')](_0xfbef('0x8a'),_0x316e9a[_0xfbef('0x49')])]['status']===_0xfbef('0x8b')||this[_0xfbef('0x22')][util[_0xfbef('0x48')](_0xfbef('0x8a'),_0x316e9a[_0xfbef('0x49')])]['status']===_0xfbef('0x8c'));};Dialer[_0xfbef('0x8d')][_0xfbef('0x8e')]=function(_0x4f914c){var _0x43264e=this;return function(){if(!_0x43264e[_0xfbef('0x8f')](_0x4f914c[_0xfbef('0x90')])){if(!_0x43264e[_0xfbef('0x8f')](_0x4f914c['TrunkBackup'])){_0x4f914c[_0xfbef('0x70')]=utils[_0xfbef('0x6c')][_0xfbef('0x91')];throw _0x4f914c['name']+_0xfbef('0x92');}}};};Dialer['prototype'][_0xfbef('0x93')]=function(_0x56d1cd,_0x36ff42,_0x162ac9,_0xe5949c){var _0x56ec3a=this;return function(){var _0x5bb0b6=!![];return _0x56ec3a[_0xfbef('0x94')](_0x56d1cd,_0x36ff42,_0x162ac9,_0xe5949c,_0x5bb0b6);};};Dialer['prototype'][_0xfbef('0x95')]=function(_0x1b26a1,_0x3ff66b,_0x44f002,_0x5bf4bb){var _0xc247ae=this;return function(){var _0x1bc503=![];return _0xc247ae[_0xfbef('0x94')](_0x1b26a1[_0xfbef('0x7c')],_0x3ff66b,_0x44f002,_0x5bf4bb,_0x1bc503);};};Dialer[_0xfbef('0x8d')][_0xfbef('0x94')]=function(_0x105bc4,_0x57134a,_0x2e970b,_0x122811,_0x653ad0){var _0x27c49f=[];return new Promise(function(_0x10f540,_0x35a1ef){if(!isNotNull(_0x105bc4)){_0x122811[_0xfbef('0x70')]=utils[_0xfbef('0x6c')]['NULL_INTERVAL'];return _0x35a1ef(msgResponse('ifTime','Failure',_0x2e970b+_0xfbef('0x96')));}if(_[_0xfbef('0x4b')](_0x105bc4)){_0x122811[_0xfbef('0x70')]=utils[_0xfbef('0x6c')][_0xfbef('0x97')];return _0x35a1ef(msgResponse(_0xfbef('0x98'),'Failure',_0x2e970b+'\x20Intervals\x20is\x20empty\x20'));}if(_0x57134a&&_[_0xfbef('0x43')](config[_0xfbef('0x99')][_0x57134a])){_0x122811['message']=utils[_0xfbef('0x6c')]['UNKNOWN_TIMEZONE'];return _0x35a1ef(msgResponse('ifTime',_0xfbef('0x9a'),_0x2e970b+_0xfbef('0x9b')+_0x57134a));}if(_[_0xfbef('0x9c')](_0x105bc4)){for(var _0x29acc0=0x0;_0x29acc0<_0x105bc4['length'];_0x29acc0+=0x1){_0x27c49f[_0xfbef('0x9d')](ami['Action']({'action':_0xfbef('0x9e'),'command':util['format']('iftime\x20%s,%s',_0x105bc4[_0x29acc0][_0xfbef('0x9f')],!_[_0xfbef('0x43')](config[_0xfbef('0x99')][_0x57134a])?_0x57134a:'')})[_0xfbef('0xa0')](function(_0x42423c){return _0x42423c[_0xfbef('0xa1')][_0xfbef('0xa2')](_0xfbef('0xa3'))>=0x0;})[_0xfbef('0xa4')](myreject(_0x35a1ef)));}}else{_0x27c49f['push'](ami[_0xfbef('0xa5')]({'action':_0xfbef('0x9e'),'command':util['format'](_0xfbef('0xa6'),_0x105bc4,!_[_0xfbef('0x43')](config[_0xfbef('0x99')][_0x57134a])?_0x57134a:'')})[_0xfbef('0xa0')](function(_0xb2fc15){return _0xb2fc15[_0xfbef('0xa1')][_0xfbef('0xa2')](_0xfbef('0xa3'))>=0x0;})['catch'](myreject(_0x35a1ef)));}Promise[_0xfbef('0xa7')](_0x27c49f)[_0xfbef('0xa0')](function(_0x3a0446){var _0x56338b=_[_0xfbef('0xa8')](_0x3a0446);if(_0x56338b){return _0x10f540(_0x56338b);}else{_0x122811[_0xfbef('0x70')]=_0x653ad0?utils['CAMPAIGN_STATUS'][_0xfbef('0xa9')]:utils['CAMPAIGN_STATUS'][_0xfbef('0xaa')];return _0x35a1ef(msgResponse(_0xfbef('0xab'),_0xfbef('0x9a'),_0xfbef('0xac')+_0x653ad0+'\x20'+_0x2e970b+_0xfbef('0xad')+util[_0xfbef('0x47')](_0x105bc4,{'showHidden':![],'depth':null})+_0xfbef('0xae')+_0x57134a));}})['catch'](function(_0x41db4a){return _0x35a1ef(msgResponse(_0xfbef('0x98'),_0xfbef('0x9a'),JSON[_0xfbef('0x77')](_0x41db4a)));});});};Dialer[_0xfbef('0x8d')][_0xfbef('0x40')]=function(){var _0x5eb8ee=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xfbef('0xa0')](function(){setInterval(function(){_0x5eb8ee[_0xfbef('0xaf')]();},0x3e8);});};Dialer[_0xfbef('0x8d')]['syncCampaigns']=function(){var _0x45f69e=this;var _0x5bf961;for(var _0x42707e in this[_0xfbef('0x20')]){if(typeof this['campaigns'][_0x42707e]!=='undefined'){_0x5bf961=this[_0xfbef('0x20')][_0x42707e];if(utils['isIVRCampaign'](_0x5bf961)&&utils[_0xfbef('0x7d')](_0x5bf961)){_0x5bf961['sendMessageOneNotActive']=!![];Promise[_0xfbef('0xb0')]()['then'](checkIsIVRCampaignActive(_0x5bf961))['then'](checkInterval(_0x5bf961))[_0xfbef('0xa0')](_0x45f69e['checkIsTrunkReachable'](_0x5bf961))['then'](_0x45f69e[_0xfbef('0x93')](_0x5bf961[_0xfbef('0xb1')],_0x5bf961[_0xfbef('0xb2')],_0x5bf961['name'],_0x5bf961))[_0xfbef('0xa0')](_0x45f69e['checkIfTimeIntervals'](_0x5bf961[_0xfbef('0x79')],_0x5bf961['dialTimezone'],_0x5bf961[_0xfbef('0x49')],_0x5bf961))[_0xfbef('0xa0')](_0x45f69e[_0xfbef('0xb3')](_0x5bf961))[_0xfbef('0xa4')](loggerCatchQueueSummary(_0xfbef('0xb4'),_0x5bf961));}else{notSendMessagesCampaign(_0x5bf961);}}}};Dialer[_0xfbef('0x8d')][_0xfbef('0xb5')]=function(_0x3dc546){if(_0x3dc546['dialMethod']!==_0xfbef('0x8')){clearPredictiveAttributes(_0x3dc546);}switch(_0x3dc546[_0xfbef('0xb6')]){case'progressive':this[_0xfbef('0xb7')](_0x3dc546,0x1);break;case _0xfbef('0xb8'):this['handlePower'](_0x3dc546,_0x3dc546[_0xfbef('0xb9')]);break;case _0xfbef('0x8'):this[_0xfbef('0x8')](_0x3dc546);break;case _0xfbef('0xba'):this[_0xfbef('0xb7')](_0x3dc546,0x1);break;default:logger['error'](_0xfbef('0xbb'),_0x3dc546[_0xfbef('0x49')],_0xfbef('0xbc'));}};Dialer[_0xfbef('0x8d')][_0xfbef('0x98')]=function(_0x1f933e,_0x265dbe){var _0x470e0b=_0x1f933e[_0xfbef('0xb2')];var _0x3ed286=_0x265dbe?_0x1f933e[_0xfbef('0xb1')]:_0x1f933e[_0xfbef('0x79')][_0xfbef('0x7c')];logger[_0xfbef('0xbd')](_0xfbef('0xbe'),_0x3ed286,_0x470e0b,_0x1f933e[_0xfbef('0x49')],util[_0xfbef('0x48')](_0xfbef('0xbf'),_0x1f933e[_0xfbef('0x49')],_0x1f933e['id']));var _0xa419cb=null;return Interval[_0xfbef('0xc0')](_0x3ed286,_0x470e0b)[_0xfbef('0xa0')](function(_0xba8941){if(_0xba8941===!![]){return _0xba8941;}else{_0x1f933e[_0xfbef('0x70')]=_0x265dbe?utils[_0xfbef('0x6c')][_0xfbef('0xa9')]:utils[_0xfbef('0x6c')]['OVERTIME_INTERVAL'];_0xa419cb=msgResponse(_0xfbef('0xab'),'Failure',_0xfbef('0xac')+_0x265dbe+'\x20'+_0x1f933e['name']+_0xfbef('0xad')+util[_0xfbef('0x47')](_0x3ed286,{'showHidden':![],'depth':null})+_0xfbef('0xae')+_0x470e0b);}if(_0xa419cb!==null){logger[_0xfbef('0xbd')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0xa419cb);_0xa419cb[_0xfbef('0xc1')]=_0x265dbe;throw _0xa419cb;}})['catch'](function(_0x5d6d62){logger[_0xfbef('0x69')](_0xfbef('0xc2'),_0x5d6d62);throw msgResponse(_0xfbef('0x88'),_0xfbef('0xc3'),util[_0xfbef('0x47')](_0x5d6d62,{'showHidden':![],'depth':null}));});};Dialer[_0xfbef('0x8d')]['syncAgentConnect']=function(_0x4cf5fa){if(this[_0xfbef('0x1f')][_0x4cf5fa[_0xfbef('0xc4')]]){if(this['uniqueId'][_0x4cf5fa['uniqueid']]&&this[_0xfbef('0x27')][_0x4cf5fa[_0xfbef('0xc5')]][_0xfbef('0xc6')]!==_0xfbef('0xc7')){utils[_0xfbef('0xc8')](this[_0xfbef('0x1f')][_0x4cf5fa['queue']],_0xfbef('0xc9'));this['uniqueId'][_0x4cf5fa[_0xfbef('0xc5')]][_0xfbef('0xca')]=moment()[_0xfbef('0x48')](_0xfbef('0xcb'));}}};Dialer['prototype'][_0xfbef('0x33')]=function(_0x5ecb6a){var _0x251bbf=this[_0xfbef('0x27')][_0x5ecb6a[_0xfbef('0xc5')]];if(this[_0xfbef('0x1f')][_0x5ecb6a['queue']]){if(_0x251bbf&&_0x251bbf[_0xfbef('0xc6')]!==_0xfbef('0xc7')){delete this['uniqueId'][_0x5ecb6a[_0xfbef('0xc5')]];this[_0xfbef('0x1f')][_0x5ecb6a['queue']][_0xfbef('0xcc')]+=0x1;var _0x4e9d2b=new AgentComplete(_0x251bbf,_0x5ecb6a);if(_0x5ecb6a[_0xfbef('0xcd')]===_0xfbef('0xce')){_0x4e9d2b[_0xfbef('0xcf')]=this[_0xfbef('0x1f')][_0x5ecb6a[_0xfbef('0xc4')]]['dialQueueProject2']&&this[_0xfbef('0x1f')][_0x5ecb6a[_0xfbef('0xc4')]][_0xfbef('0xd0')]?moment()[_0xfbef('0x48')](_0xfbef('0xcb')):undefined;}hopperUtils[_0xfbef('0xd1')](_0x4e9d2b)['catch'](loggerCatch(_0xfbef('0xd2')));hopperUtils['moveContactManagedDialer'](_0x4e9d2b)['catch'](loggerCatch(_0xfbef('0xd3')));}}};Dialer[_0xfbef('0x8d')][_0xfbef('0x30')]=function(_0x1943e2){var _0x54671f=this[_0xfbef('0x27')][_0x1943e2[_0xfbef('0xc5')]];var _0x2a6722=this;var _0x3d328c=![];var _0xa23f56;var _0xe887ef;if(this['voiceQueues'][_0x1943e2['queue']]){if(_0x54671f&&_0x54671f[_0xfbef('0xc6')]!==_0xfbef('0xc7')){delete this[_0xfbef('0x27')][_0x1943e2[_0xfbef('0xc5')]];utils['decrementOriginate'](this[_0xfbef('0x1f')][_0x1943e2['queue']],_0xfbef('0xd4'));_0x54671f[_0xfbef('0xd5')]=moment()[_0xfbef('0x48')](_0xfbef('0xcb'));var _0x29e93c=new QueueCallerAbandon(_0x54671f,_0x1943e2);if(utils['getSeconds'](_0x54671f[_0xfbef('0xd5')],_0x54671f[_0xfbef('0xd6')])>=_0x54671f['dialQueueTimeout']){this['voiceQueues'][_0x1943e2['queue']][_0xfbef('0xd7')]+=0x1;this[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xd8')]+=0x1;this[_0xfbef('0x1f')][_0x1943e2['queue']][_0xfbef('0xd9')]+=0x1;_0x29e93c['state']=0xa;_0x29e93c[_0xfbef('0x73')]=_0xfbef('0xda');_0x29e93c[_0xfbef('0xdb')]=_0xfbef('0xdc');_0x29e93c[_0xfbef('0xcf')]=this[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xdd')]?moment()[_0xfbef('0x48')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x29e93c['countdropretry']+=0x1;_0x29e93c[_0xfbef('0xde')]+=0x1;_0xa23f56=this['voiceQueues'][_0x1943e2[_0xfbef('0xc4')]]['dialDropRetryFrequency'];_0xe887ef=this[_0xfbef('0x1f')][_0x1943e2['queue']][_0xfbef('0xdf')];hopperUtils['verifyAdditionalPhones'](_0x29e93c,_0x29e93c[_0xfbef('0x72')],_0x54671f[_0xfbef('0xe0')])[_0xfbef('0xa0')](function(_0x17dd53){_0x3d328c=_0x17dd53[_0xfbef('0xe1')]==0x1;if(_0x29e93c[_0xfbef('0xe2')]>=_0x2a6722[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xe3')]){_0x2a6722[_0xfbef('0xe4')](_0x29e93c,_0x17dd53[_0xfbef('0xe1')]);}else{hopperUtils[_0xfbef('0xe5')]({'active':![],'countdropretry':_0x29e93c[_0xfbef('0xe2')],'scheduledat':moment()[_0xfbef('0xe6')](_0x2a6722[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xe7')],_0xfbef('0xe8'))['format'](_0xfbef('0xcb')),'ContactId':_0x54671f[_0xfbef('0xe9')],'ListId':_0x54671f[_0xfbef('0xea')],'VoiceQueueId':_0x54671f[_0xfbef('0xeb')]||undefined,'CampaignId':_0x54671f['CampaignId']||undefined})[_0xfbef('0xa4')](loggerCatch(_0xfbef('0xec')));var _0x10818e=new History(_0x29e93c);_0x10818e[_0xfbef('0x72')]=0xa;_0x10818e[_0xfbef('0x73')]=_0xfbef('0xda');_0x10818e[_0xfbef('0xed')]=moment()['format'](_0xfbef('0xcb'));_0x10818e['endtime']=_0x10818e['starttime'];_0x10818e[_0xfbef('0xee')]=_0x29e93c[_0xfbef('0xee')];_0x10818e['calleridnum']=_0x29e93c[_0xfbef('0xef')];hopperUtils[_0xfbef('0xd1')](_0x10818e)['catch'](loggerCatch(_0xfbef('0xf0')));}})['then'](function(){if(_0x3d328c)hopperUtils[_0xfbef('0xf1')](_0x29e93c,_0xa23f56,_0xe887ef)[_0xfbef('0xa0')](function(){return 0x1;});});}else{this[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0x52')]+=0x1;this[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xf2')]+=0x1;_0x29e93c[_0xfbef('0x72')]=0xb;_0x29e93c[_0xfbef('0x73')]=_0xfbef('0xf3');_0x29e93c[_0xfbef('0xdb')]=_0xfbef('0xf4');_0x29e93c[_0xfbef('0xf5')]+=0x1;_0x29e93c[_0xfbef('0xde')]+=0x1;_0xa23f56=this[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]]['dialAbandonedRetryFrequency'];_0xe887ef=this['voiceQueues'][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xdf')];hopperUtils[_0xfbef('0xf6')](_0x29e93c,_0x29e93c['state'],_0x54671f['voiceQueue'])[_0xfbef('0xa0')](function(_0xf9de16){if(_0x29e93c['countabandonedretry']>=_0x2a6722['voiceQueues'][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xf7')]){_0x2a6722[_0xfbef('0xe4')](_0x29e93c,_0xf9de16[_0xfbef('0xe1')]);}else{hopperUtils[_0xfbef('0xe5')]({'active':![],'countabandonedretry':_0x29e93c[_0xfbef('0xf5')],'scheduledat':moment()[_0xfbef('0xe6')](_0x2a6722[_0xfbef('0x1f')][_0x1943e2[_0xfbef('0xc4')]][_0xfbef('0xf8')],'minutes')[_0xfbef('0x48')](_0xfbef('0xcb')),'ContactId':_0x54671f[_0xfbef('0xe9')],'ListId':_0x54671f[_0xfbef('0xea')],'VoiceQueueId':_0x54671f[_0xfbef('0xeb')]||undefined,'CampaignId':_0x54671f[_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x49b5cd=new History(_0x29e93c);_0x49b5cd[_0xfbef('0x72')]=0xb;_0x49b5cd['statedesc']=_0xfbef('0xf3');_0x49b5cd[_0xfbef('0xed')]=moment()[_0xfbef('0x48')](_0xfbef('0xcb'));_0x49b5cd[_0xfbef('0xfa')]=_0x49b5cd[_0xfbef('0xed')];_0x49b5cd[_0xfbef('0xee')]=_0x29e93c[_0xfbef('0xee')];_0x49b5cd[_0xfbef('0xef')]=_0x29e93c[_0xfbef('0xef')];hopperUtils['createHistory'](_0x49b5cd)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0xfb')));}})[_0xfbef('0xa0')](function(){if(_0x3d328c)hopperUtils['swapAdditionalPhones'](_0x29e93c,_0xa23f56,_0xe887ef)['then'](function(){return 0x1;});});}}}};Dialer[_0xfbef('0x8d')][_0xfbef('0x3a')]=function(_0x56de50){if(this[_0xfbef('0x25')][_0x56de50['uniqueid']]){this[_0xfbef('0x25')][_0x56de50[_0xfbef('0xc5')]]['channel']=_0x56de50[_0xfbef('0xfc')];}if(this[_0xfbef('0x27')][_0x56de50[_0xfbef('0xc5')]]){this['uniqueId'][_0x56de50[_0xfbef('0xc5')]][_0xfbef('0xfc')]=_0x56de50[_0xfbef('0xfc')];}};Dialer[_0xfbef('0x8d')][_0xfbef('0x3e')]=function(_0xb006bf){if(!this[_0xfbef('0x25')][_0xb006bf[_0xfbef('0xfd')]]){return;}var _0x46d682=this['voiceQueues'][this[_0xfbef('0x25')][_0xb006bf[_0xfbef('0xfd')]]['queue']][_0xfbef('0xfe')]||'rrmemory';if(_0x46d682===_0xfbef('0xff')){if(this[_0xfbef('0x25')][_0xb006bf['actionid']]&&_['isNil'](this[_0xfbef('0x25')][_0xb006bf[_0xfbef('0xfd')]][_0xfbef('0x100')])&&_0xb006bf[_0xfbef('0x101')]==='1'&&_0xb006bf[_0xfbef('0x102')]==='0'){if(this[_0xfbef('0x21')][_0xb006bf[_0xfbef('0x103')]]){if(!this['agents'][_0xb006bf[_0xfbef('0x103')]][_0xfbef('0x100')]){this[_0xfbef('0x21')][_0xb006bf[_0xfbef('0x103')]][_0xfbef('0x100')]=!![];this[_0xfbef('0x25')][_0xb006bf[_0xfbef('0xfd')]][_0xfbef('0x100')]=!![];this['actions'][_0xb006bf[_0xfbef('0xfd')]][_0xfbef('0x103')]=_0xb006bf['stateinterface'];}}}}else if(_0x46d682===_0xfbef('0x104')){if(this['actions'][_0xb006bf['actionid']]){if(this[_0xfbef('0x21')][_0xb006bf[_0xfbef('0x103')]]){this['actions'][_0xb006bf['actionid']][_0xfbef('0x103')]=_0xb006bf[_0xfbef('0x103')];if(_[_0xfbef('0x105')](this[_0xfbef('0x2b')][this[_0xfbef('0x25')][_0xb006bf[_0xfbef('0xfd')]][_0xfbef('0xc4')]])){this['queueBooked'][this['actions'][_0xb006bf[_0xfbef('0xfd')]][_0xfbef('0xc4')]]=[];}this[_0xfbef('0x2b')][this[_0xfbef('0x25')][_0xb006bf[_0xfbef('0xfd')]]['queue']][_0xfbef('0x9d')](_[_0xfbef('0x62')](_[_0xfbef('0x78')](this[_0xfbef('0x25')][_0xb006bf[_0xfbef('0xfd')]],[_0xfbef('0x106'),_0xfbef('0x103')]),{'status':_0xb006bf[_0xfbef('0x101')],'paused':_0xb006bf[_0xfbef('0x102')]}));}}}};Dialer['prototype'][_0xfbef('0x3f')]=function(_0x2c7f11){if(!this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]]){return;}var _0xd2f9aa=this;var _0x97be33=this[_0xfbef('0x1f')][this['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]];var _0x2a1db8=_0x97be33[_0xfbef('0xfe')]||'rrmemory';if(_0x2a1db8===_0xfbef('0xff')){if(this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]]&&this['actions'][_0x2c7f11[_0xfbef('0xfd')]]['stateinterface']){this[_0xfbef('0x1e')][_0xfbef('0x107')](this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]]['idHopper'],this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]]['stateinterface'])[_0xfbef('0xa4')](function(_0xdd1262){logger[_0xfbef('0x69')](_0xfbef('0x108'),util[_0xfbef('0x47')](_0xdd1262,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0xfbef('0xc8')](_0xd2f9aa['voiceQueues'][_0xd2f9aa['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]],_0xfbef('0x109'));_0xd2f9aa[_0xfbef('0x21')][_0xd2f9aa[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]]['stateinterface']][_0xfbef('0x100')]=![];delete _0xd2f9aa[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]];unlockQueueStatus(_0x97be33);});}else{utils[_0xfbef('0xc8')](this[_0xfbef('0x1f')][this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]],_0xfbef('0x109'));hopperUtils[_0xfbef('0xe5')]({'active':![],'ContactId':this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xe9')],'ListId':this['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xea')],'VoiceQueueId':this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xeb')]||undefined,'CampaignId':this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xf9')]||undefined})['catch'](loggerCatch(_0xfbef('0x10a')));delete this[_0xfbef('0x25')][_0x2c7f11['actionid']];unlockQueueStatus(_0x97be33);}}else if(_0x2a1db8==='rrmemory'){var _0x11a777;if(this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]]&&!_['isEmpty'](this[_0xfbef('0x2b')][this[_0xfbef('0x25')][_0x2c7f11['actionid']][_0xfbef('0xc4')]])){if(this[_0xfbef('0x10b')][_0xd2f9aa[_0xfbef('0x25')][_0x2c7f11['actionid']][_0xfbef('0xc4')]]){this['queueBookedRR'][_0xd2f9aa['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]]=this[_0xfbef('0x10b')][this['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]]?this['queueBookedRR'][this['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]]:this[_0xfbef('0x2b')][this['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]]?this['queueBooked'][this['actions'][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]][_0xfbef('0x10c')]||0x0:0x0;}this[_0xfbef('0x2b')][this[_0xfbef('0x25')][_0x2c7f11['actionid']][_0xfbef('0xc4')]][_0xfbef('0x10c')]=this['queueBookedRR'][this[_0xfbef('0x25')][_0x2c7f11[_0xfbef('0xfd')]][_0xfbef('0xc4')]];for(var _0x475f85=0x0;_0x475f85=_0x1d917b[_0xfbef('0x134')]){_0x23befd[_0xfbef('0x135')](_0x33d228,_0x301e73,_0x1ec34e,_0xfbef('0x136'));}else{if(_0x33d228['countmachineretry']>=_0x1d917b['dialMachineMaxRetry']){_0x23befd[_0xfbef('0x137')](_0x33d228,_0x301e73,_0x1ec34e,_0xfbef('0x138'));}else{hopperUtils[_0xfbef('0xe5')]({'active':![],'countmachineretry':_0x33d228[_0xfbef('0x12f')],'scheduledat':moment()[_0xfbef('0xe6')](_0x1d917b[_0xfbef('0x139')],'minutes')[_0xfbef('0x48')](_0xfbef('0xcb')),'ContactId':_0x33d228[_0xfbef('0xe9')],'ListId':_0x33d228['ListId'],'VoiceQueueId':_0x33d228[_0xfbef('0xeb')]||undefined,'CampaignId':_0x33d228[_0xfbef('0xf9')]||undefined})['catch'](loggerCatch(_0xfbef('0x13a')));_0x301e73({'reschedule':0x1});}}});}if(_0x3fd8a7[_0xfbef('0xc6')]===_0xfbef('0xc7')&&this[_0xfbef('0x20')][_0x3fd8a7[_0xfbef('0xc4')]][_0xfbef('0x120')]&&_0x24840a[_0xfbef('0x121')]===_0xfbef('0x122')){delete this[_0xfbef('0x27')][_0x24840a[_0xfbef('0xc5')]];utils['decrementOriginate'](this[_0xfbef('0x20')][_0x3fd8a7[_0xfbef('0xc4')]],_0xfbef('0x123'));_0x103245=new Hangup(_0x3fd8a7,_0x24840a);_0x103245[_0xfbef('0x72')]=0x12;_0x103245[_0xfbef('0x73')]=_0xfbef('0x13b');_0x103245[_0xfbef('0x125')]='AMD';ami[_0xfbef('0x44')](_0xfbef('0x127'),ut[_0xfbef('0x128')](_0x103245,_0xfbef('0x129')));this[_0xfbef('0x12a')](_0x103245,_0xfbef('0x13c'),_0xfbef('0x13d'));}if(_0x3fd8a7[_0xfbef('0xc6')]===_0xfbef('0xc7')&&this[_0xfbef('0x20')][_0x3fd8a7['queue']][_0xfbef('0x120')]&&_0x24840a[_0xfbef('0x121')]===_0xfbef('0x12d')){return new Promise(function(_0x5824cd,_0x357b34){delete _0x23befd[_0xfbef('0x27')][_0x24840a[_0xfbef('0xc5')]];utils[_0xfbef('0xc8')](_0x23befd['campaigns'][_0x3fd8a7[_0xfbef('0xc4')]],'[syncVarSet]');_0x23befd[_0xfbef('0x20')][_0x3fd8a7[_0xfbef('0xc4')]][_0xfbef('0xcc')]+=0x1;_0x23befd[_0xfbef('0x20')][_0x3fd8a7[_0xfbef('0xc4')]][_0xfbef('0x124')]+=0x1;var _0x309e6b=_0x23befd[_0xfbef('0x20')][_0x3fd8a7['queue']];var _0x369992=new Hangup(_0x3fd8a7,_0x24840a);_0x369992[_0xfbef('0x72')]=0x13;_0x369992['statedesc']=_0xfbef('0x12e');_0x369992[_0xfbef('0x125')]=_0xfbef('0x126');_0x369992[_0xfbef('0x12f')]+=0x1;_0x369992[_0xfbef('0xde')]+=0x1;_0x369992[_0xfbef('0x129')]=!![];ami['emit'](_0xfbef('0x127'),ut[_0xfbef('0x128')](_0x369992,_0xfbef('0x129')));hopperUtils['createHistory'](_0x369992)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x130')));if(_0x369992[_0xfbef('0x13e')]+_0x369992[_0xfbef('0x13f')]+_0x369992['countnoanswerretry']+_0x369992[_0xfbef('0x132')]+_0x369992[_0xfbef('0xe2')]+_0x369992['countabandonedretry']+_0x369992['countmachineretry']+_0x369992[_0xfbef('0x133')]>=_0x309e6b[_0xfbef('0x134')]){_0x23befd[_0xfbef('0x135')](_0x369992,_0x5824cd,_0x357b34,_0xfbef('0x136'));}else{if(_0x369992[_0xfbef('0x12f')]>=_0x309e6b[_0xfbef('0x140')]){_0x23befd[_0xfbef('0x137')](_0x369992,_0x5824cd,_0x357b34,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x369992[_0xfbef('0x12f')],'scheduledat':moment()[_0xfbef('0xe6')](_0x309e6b['dialMachineRetryFrequency'],_0xfbef('0xe8'))[_0xfbef('0x48')](_0xfbef('0xcb')),'ContactId':_0x369992[_0xfbef('0xe9')],'ListId':_0x369992[_0xfbef('0xea')],'VoiceQueueId':_0x369992['VoiceQueueId']||undefined,'CampaignId':_0x369992[_0xfbef('0xf9')]||undefined})['catch'](loggerCatch(_0xfbef('0x13a')));_0x5824cd({'reschedule':0x1});}}});}}};Dialer[_0xfbef('0x8d')][_0xfbef('0x38')]=function(_0x1e4650){var _0x2a878d=this[_0xfbef('0x27')][_0x1e4650[_0xfbef('0xc5')]];var _0x330d30;if(!_0x2a878d){return;}if(_0x2a878d[_0xfbef('0xc6')]==='ivr'){delete this['uniqueId'][_0x1e4650[_0xfbef('0xc5')]];utils[_0xfbef('0xc8')](this[_0xfbef('0x20')][_0x2a878d['queue']],'[syncHangup]');this[_0xfbef('0x20')][_0x2a878d[_0xfbef('0xc4')]][_0xfbef('0x141')]+=0x1;if(_0x1e4650[_0xfbef('0x142')]===_0xfbef('0x143')){const _0x45467d=new AgentComplete(_0x2a878d,_0x1e4650);_0x45467d[_0xfbef('0xf9')]=this[_0xfbef('0x20')][_0x2a878d['queue']]['id'];hopperUtils['createHistory'](_0x45467d)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x144')));hopperUtils[_0xfbef('0x145')](_0x45467d)['catch'](loggerCatch(_0xfbef('0x146')));}else{_0x330d30=new Hangup(_0x2a878d,_0x1e4650);hopperUtils[_0xfbef('0xd1')](_0x330d30)[_0xfbef('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x330d30)[_0xfbef('0xa4')](loggerCatch('[syncHangupIvr]'));}}else{if(isNotNull(this[_0xfbef('0x1f')][_0x2a878d[_0xfbef('0xc4')]]['dialQueueProject'])){delete this[_0xfbef('0x27')][_0x1e4650[_0xfbef('0xc5')]];utils[_0xfbef('0xc8')](this['voiceQueues'][_0x2a878d[_0xfbef('0xc4')]],_0xfbef('0x147'));this[_0xfbef('0x1f')][_0x2a878d[_0xfbef('0xc4')]][_0xfbef('0xcc')]+=0x1;this['voiceQueues'][_0x2a878d['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x330d30=new Hangup(_0x2a878d,_0x1e4650);_0x330d30[_0xfbef('0x72')]=0x10;_0x330d30['statedesc']=_0xfbef('0x148');_0x330d30[_0xfbef('0x125')]=_0xfbef('0x149');hopperUtils[_0xfbef('0xd1')](_0x330d30)[_0xfbef('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xfbef('0x145')](_0x330d30)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x14a')));}else{delete this[_0xfbef('0x27')][_0x1e4650[_0xfbef('0xc5')]];utils[_0xfbef('0xc8')](this[_0xfbef('0x1f')][_0x2a878d[_0xfbef('0xc4')]],_0xfbef('0x14b'));if(_0x1e4650['cause-txt']===_0xfbef('0x143')){this[_0xfbef('0x1f')][_0x2a878d[_0xfbef('0xc4')]]['outboundAnswerCallsDay']+=0x1;const _0x11936f=new AgentComplete(_0x2a878d,_0x1e4650);_0x11936f[_0xfbef('0xeb')]=this[_0xfbef('0x1f')][_0x2a878d[_0xfbef('0xc4')]]['id'];hopperUtils[_0xfbef('0xd1')](_0x11936f)['catch'](loggerCatch(_0xfbef('0xd2')));hopperUtils['moveContactManagedDialer'](_0x11936f)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0xd3')));}else{this['voiceQueues'][_0x2a878d[_0xfbef('0xc4')]][_0xfbef('0x14c')]+=0x1;_0x330d30=new Hangup(_0x2a878d,_0x1e4650);_0x330d30[_0xfbef('0x72')]=0xc;_0x330d30['statedesc']=_0x1e4650[_0xfbef('0x142')];_0x330d30['membername']=_0xfbef('0x14d');hopperUtils[_0xfbef('0xd1')](_0x330d30)['catch'](loggerCatch(_0xfbef('0x14e')));hopperUtils[_0xfbef('0x145')](_0x330d30)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x147')));}}}};Dialer['prototype'][_0xfbef('0x14f')]=function(_0x18c2d2){var _0x3f36a3=this;if(!_0x3f36a3['queuesSummary'][_0x18c2d2['name']]){_0x3f36a3[_0xfbef('0x2c')][_0x18c2d2[_0xfbef('0x49')]]={'running':![]};}else if(_0x3f36a3['queuesSummary'][_0x18c2d2[_0xfbef('0x49')]][_0xfbef('0x150')]===!![]){return;}else if(_0x3f36a3[_0xfbef('0x2c')][_0x18c2d2[_0xfbef('0x49')]][_0xfbef('0x150')]===![]){_0x3f36a3[_0xfbef('0x2c')][_0x18c2d2[_0xfbef('0x49')]]['running']=!![];}var _0x4a9408=_0x3f36a3[_0xfbef('0x1f')][_0x18c2d2[_0xfbef('0x49')]];var _0x1bc209=_0x4a9408[_0xfbef('0x70')]!==utils[_0xfbef('0x6c')][_0xfbef('0x151')];var _0x2b9592=utils[_0xfbef('0x152')](_0x4a9408);_0x4a9408[_0xfbef('0x153')]=utils['getQueueCampaignStatusMessage'](_0x4a9408,_0x3f36a3['trunks']);Promise['resolve']()[_0xfbef('0xa0')](function(){if(_0x4a9408[_0xfbef('0x153')]===utils['CAMPAIGN_STATUS'][_0xfbef('0x151')]){if(_0x1bc209){clearPredictiveAttributes(_0x4a9408);_0x18c2d2[_0xfbef('0x29')]=undefined;_0x18c2d2['startProgressive']=undefined;}if(_0x4a9408[_0xfbef('0x153')]===utils[_0xfbef('0x6c')]['INACTIVE']){_0x18c2d2[_0xfbef('0x154')]=0x0;_0x18c2d2['paused']=0x0;_0x18c2d2[_0xfbef('0x155')]=0x0;_0x18c2d2[_0xfbef('0x156')]=0x0;_0x18c2d2[_0xfbef('0x157')]=0x0;}}else if(_0x4a9408[_0xfbef('0x153')]===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x2b9592){return _0x3f36a3['ifTime'](_0x4a9408,!![])[_0xfbef('0xa0')](function(){return _0x3f36a3[_0xfbef('0x98')](_0x4a9408,![]);})[_0xfbef('0xa0')](function(){return _0x3f36a3[_0xfbef('0xb5')](_0x4a9408);})['catch'](function(_0x19ecca){loggerSyncQueueSummary['debug'](_0xfbef('0x158'),util['inspect'](_0x19ecca,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4a9408);});}else{clearPredictiveAttributes(_0x4a9408);}})['then'](function(){var _0x1eb489=_0x18c2d2[_0xfbef('0x159')](_0x4a9408);if(_0x1eb489||_0x4a9408[_0xfbef('0x15a')]){_0x4a9408['queueSummaryCountersUpdated']=![];_0x18c2d2[_0xfbef('0x15b')](_0x4a9408);Object[_0xfbef('0x15c')](_0x4a9408,_0x18c2d2);emitOutboundVoiceQueueSummary(_0x18c2d2);}_0x3f36a3['queuesSummary'][_0x4a9408[_0xfbef('0x49')]][_0xfbef('0x150')]=![];})[_0xfbef('0xa4')](function(_0x184045){logger[_0xfbef('0x69')]('[syncQueueSummary]',util[_0xfbef('0x47')](_0x184045,{'showHidden':![],'depth':null}));_0x3f36a3[_0xfbef('0x2c')][_0x4a9408[_0xfbef('0x49')]][_0xfbef('0x150')]=![];});};Dialer['prototype'][_0xfbef('0x36')]=_[_0xfbef('0x15d')](function(){var _0x908ee5=_[_0xfbef('0x15e')](this[_0xfbef('0x1f')],function(_0x9d6bf1){return _0x9d6bf1[_0xfbef('0x15f')];});var _0x57f5e6=_[_0xfbef('0x15e')](this[_0xfbef('0x21')],function(_0x1e9ca5){return _0x1e9ca5['online']&&_0x1e9ca5[_0xfbef('0x101')]===_0xfbef('0x8b');});if(_0x908ee5[_0xfbef('0x10d')]>0x0&&_0x57f5e6[_0xfbef('0x10d')]>0x0){return Promise[_0xfbef('0xb0')]()['then'](cmHopper[_0xfbef('0x160')](_[_0xfbef('0x161')](_0x908ee5,'id'),previewRecallmeReminderInterval,_[_0xfbef('0x161')](_0x57f5e6,'id')))['then'](function(_0x3ac295){for(var _0x203053=0x0;_0x203053<_0x3ac295[_0xfbef('0x10d')];_0x203053++){var _0x40456a=_0x3ac295[_0x203053]['Agent'][_0xfbef('0x49')];if(_0x40456a)io['to'](util[_0xfbef('0x48')](_0xfbef('0x162'),_0x40456a))[_0xfbef('0x44')]('user:dialPreviewRecallReminder',{'hopper':_0x3ac295[_0x203053]});}})[_0xfbef('0xa4')](function(_0x5d207e){logger[_0xfbef('0x69')](_0xfbef('0x163'),_0x5d207e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xfbef('0x8d')][_0xfbef('0x41')]=function(){var _0x3fa6d6=this;setInterval(function(){_0x3fa6d6[_0xfbef('0x164')](_0x3fa6d6[_0xfbef('0x27')],_0xfbef('0x165'));_0x3fa6d6['clearZombieChannels'](_0x3fa6d6['actions'],'[actions]');},0x32c8);};Dialer['prototype'][_0xfbef('0x164')]=function(_0x8b1b4e,_0x3f137a){var _0x275a91=this;for(var _0x383063 in _0x8b1b4e){if(typeof _0x8b1b4e[_0x383063]!=='undefined'){this[_0xfbef('0x1d')][_0xfbef('0x166')](function(){if(!_[_0xfbef('0x105')](_0x8b1b4e[_0x383063])){return ami[_0xfbef('0xa5')]({'action':'status','channel':_0x8b1b4e[_0x383063][_0xfbef('0xfc')]})[_0xfbef('0xa4')](function(_0x1f3271){if(_0x1f3271[_0xfbef('0x70')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x8b1b4e[_0x383063]&&_0x8b1b4e[_0x383063]['type']!==_0xfbef('0xc7')){utils[_0xfbef('0xc8')](_0x275a91[_0xfbef('0x1f')][_0x8b1b4e[_0x383063]['queue']],_0xfbef('0x167'));logger[_0xfbef('0x69')](_0xfbef('0x168'),_0x3f137a,_0x383063,_0x8b1b4e[_0x383063][_0xfbef('0xc4')]);delete _0x8b1b4e[_0x383063];}if(_0x8b1b4e[_0x383063]&&_0x8b1b4e[_0x383063][_0xfbef('0xc6')]===_0xfbef('0xc7')){utils[_0xfbef('0xc8')](_0x275a91['campaigns'][_0x8b1b4e[_0x383063][_0xfbef('0xc4')]],_0xfbef('0x167'));logger[_0xfbef('0x69')](_0xfbef('0x169'),_0x3f137a,_0x383063,_0x8b1b4e[_0x383063]['queue']);delete _0x8b1b4e[_0x383063];}},0x2328);}});}});}}};Dialer[_0xfbef('0x8d')][_0xfbef('0x16a')]=function(_0x5d9c19){return Promise[_0xfbef('0xb0')]()['then'](voiceQueueRt[_0xfbef('0x16a')](_0x5d9c19))['catch'](loggerCatch(_0xfbef('0x16b')));};Dialer[_0xfbef('0x8d')]['emptyContact']=function(_0x3ca4d8,_0x164c22,_0x1bcfbd){var _0x38310f={'state':0x19,'statedesc':_0xfbef('0x16c')};utils[_0xfbef('0xc8')](_0x164c22,'[emptyContact]'+_0x3ca4d8);this[_0xfbef('0x12a')](_['merge'](_0x38310f,_['pick'](_0x1bcfbd,[_0xfbef('0xe9'),_0xfbef('0xea'),_0xfbef('0x16d'),_0xfbef('0xeb'),'CampaignId'])),_0xfbef('0x16e'),_0xfbef('0x16f'));logger[_0xfbef('0x69')](_0x3ca4d8);};Dialer[_0xfbef('0x8d')][_0xfbef('0x12a')]=function(_0x223573,_0x3c96c8,_0x32b427){hopperUtils[_0xfbef('0xd1')](_0x223573)[_0xfbef('0xa4')](loggerCatch(_0x3c96c8));hopperUtils[_0xfbef('0x145')](_0x223573)[_0xfbef('0xa4')](loggerCatch(_0x32b427));};Dialer['prototype'][_0xfbef('0xe4')]=function(_0x419c09,_0x472761){hopperUtils[_0xfbef('0xd1')](_0x419c09)['catch'](loggerCatch(_0xfbef('0xd2')));if(_0x472761==0x0){hopperUtils['moveContactManagedDialer'](_0x419c09)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x170')));}};Dialer[_0xfbef('0x8d')][_0xfbef('0x163')]=function(_0x3f3c94){return Promise[_0xfbef('0xb0')]()['then'](cmHopper[_0xfbef('0x160')](_0x3f3c94['id'],previewRecallmeReminderInterval))['then'](function(_0x3f3c99){for(var _0x22e245=0x0;_0x22e245<_0x3f3c99[_0xfbef('0x10d')];_0x22e245++){var _0x4504ed=_0x3f3c99[_0x22e245][_0xfbef('0x171')][_0xfbef('0x49')];if(_0x4504ed)io['to'](util[_0xfbef('0x48')](_0xfbef('0x162'),_0x4504ed))[_0xfbef('0x44')]('user:dialPreviewRecallReminder',{'hopper':_0x3f3c99[_0x22e245]});}})[_0xfbef('0xa4')](function(){});};Dialer[_0xfbef('0x8d')][_0xfbef('0xb3')]=function(_0x1067c0){var _0x36ff56=this;return function(){_0x36ff56[_0xfbef('0x172')](_0x1067c0);};};Dialer[_0xfbef('0x8d')][_0xfbef('0x173')]=function(_0x565d29,_0x18eb75){var _0x5c3ed2=this;var _0x459bc6=uuid['v4']();this['actions'][_0x459bc6]=new Action(_0x565d29,_0x18eb75,_0x459bc6);return new Promise(function(_0x2d40c3,_0x4c367e){if(_[_0xfbef('0x43')](_0x565d29)&&typeof _0x565d29!==_0xfbef('0x174')){return _0x4c367e(msgResponse('originate',_0xfbef('0x9a'),'voiceQueue\x20is\x20undefine'));}if(_[_0xfbef('0x43')](_0x18eb75[_0xfbef('0x175')])||_0x18eb75[_0xfbef('0x175')]===null){return _0x4c367e(msgResponse(_0xfbef('0x176'),_0xfbef('0x9a'),_0xfbef('0x177')));}var _0x27708e={'XMD-CALLERID':_0x5c3ed2[_0xfbef('0x25')][_0x459bc6][_0xfbef('0x178')](),'XMD-AGI':_0x565d29['dialQueueProject']?util['format'](_0xfbef('0x179'),ipAgi,_0x565d29['dialQueueProject']):_0xfbef('0x17a'),'XMD-AGIAFTER':_0x565d29[_0xfbef('0xdd')]?util['format'](_0xfbef('0x179'),ipAgi,_0x565d29[_0xfbef('0xdd')]):'NONE','XMD-QUEUE':utils[_0xfbef('0x17b')](_0x565d29)?util['format'](_0xfbef('0x17c'),_0x565d29[_0xfbef('0x49')],_0x565d29['dialQueueOptions']||'',_0x565d29[_0xfbef('0xd0')]?'c':'',_0x565d29[_0xfbef('0x17d')]||0x3):'NONE','XMD-CONTACTID':_0x18eb75[_0xfbef('0xe9')],'XMD-CDRTYPE':_0xfbef('0x7'),'CALLERID(all)':_0x5c3ed2['actions'][_0x459bc6][_0xfbef('0x178')](),'XMD-AMD':_0x565d29[_0xfbef('0x120')]?_0xfbef('0x17e'):_0xfbef('0x17a'),'XMD-DESTINATION':_0xfbef('0x11f')};if(_0x565d29[_0xfbef('0x120')]){_0x27708e[_0xfbef('0x17f')]=_0x565d29[_0xfbef('0x180')]||0x9c4;_0x27708e[_0xfbef('0x181')]=_0x565d29[_0xfbef('0x182')]||0x5dc;_0x27708e[_0xfbef('0x183')]=_0x565d29[_0xfbef('0x184')]||0x320;_0x27708e[_0xfbef('0x185')]=_0x565d29['dialAMDTotalAnalysisTime']||0x1388;_0x27708e[_0xfbef('0x186')]=_0x565d29[_0xfbef('0x187')]||0x64;_0x27708e[_0xfbef('0x188')]=_0x565d29[_0xfbef('0x189')]||0x32;_0x27708e[_0xfbef('0x18a')]=_0x565d29[_0xfbef('0x18b')]||0x3;_0x27708e['XMD-AMDSILENCETHRESHOLD']=_0x565d29[_0xfbef('0x18c')]||0x100;_0x27708e[_0xfbef('0x18d')]=_0x565d29[_0xfbef('0x18e')]||0x1388;}if(utils['isOutboundQueue'](_0x565d29)){_0x27708e[_0xfbef('0x18f')]=_0x18eb75[_0xfbef('0xeb')];}else{_0x27708e[_0xfbef('0x190')]=_0x18eb75[_0xfbef('0xf9')];}var _0x440329=utils[_0xfbef('0x191')](_0x18eb75[_0xfbef('0x192')]);Object[_0xfbef('0x15c')](_0x27708e,_0x440329);var _0x275415=_0x5c3ed2[_0xfbef('0x8f')](_0x565d29['Trunk'])?utils['getCallerId'](_0x565d29[_0xfbef('0x90')][_0xfbef('0x193')],_0x565d29[_0xfbef('0x194')],_0x565d29['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x565d29[_0xfbef('0x195')],_0x565d29[_0xfbef('0x196')]):_0x565d29[_0xfbef('0x195')]):utils[_0xfbef('0x197')](_['isNil'](_0x565d29[_0xfbef('0x198')])?_0x565d29['Trunk'][_0xfbef('0x193')]:_0x565d29[_0xfbef('0x198')][_0xfbef('0x193')],_0x565d29[_0xfbef('0x194')],_0x565d29[_0xfbef('0x196')]>0x0?utils[_0xfbef('0x199')](_0x565d29[_0xfbef('0x195')],_0x565d29[_0xfbef('0x196')]):_0x565d29[_0xfbef('0x195')]);if(_0x275415){_0x27708e[_0xfbef('0x19a')]=_0x5c3ed2['actions'][_0x459bc6]['originatecalleridname']=utils[_0xfbef('0x19b')](_0x275415);_0x27708e[_0xfbef('0x19c')]=_0x18eb75[_0xfbef('0x175')];}_0x565d29[_0xfbef('0x19d')]=_0x27708e;return ami[_0xfbef('0xa5')]({'actionid':_0x459bc6,'action':'originate','channel':_0x5c3ed2[_0xfbef('0x8f')](_0x565d29[_0xfbef('0x90')])?util[_0xfbef('0x48')](_0xfbef('0x19e'),_0x565d29['Trunk'][_0xfbef('0x49')],isNotNull(_0x565d29[_0xfbef('0x19f')])?_0x565d29[_0xfbef('0x19f')][_0xfbef('0x1a0')]()||'':'',_0x565d29[_0xfbef('0x1a1')]>0x0?_0x18eb75['phone'][_0xfbef('0x1a2')](_0x565d29[_0xfbef('0x1a1')]):_0x18eb75['phone']):util[_0xfbef('0x48')](_0xfbef('0x19e'),_[_0xfbef('0x105')](_0x565d29[_0xfbef('0x198')])?_0x565d29[_0xfbef('0x90')][_0xfbef('0x49')]:_0x565d29[_0xfbef('0x198')]['name'],isNotNull(_0x565d29[_0xfbef('0x19f')])?_0x565d29[_0xfbef('0x19f')][_0xfbef('0x1a0')]()||'':'',_0x565d29[_0xfbef('0x1a1')]>0x0?_0x18eb75['phone'][_0xfbef('0x1a2')](_0x565d29[_0xfbef('0x1a1')]):_0x18eb75[_0xfbef('0x175')]),'callerid':_0x275415,'Exten':_0xfbef('0x11f'),'Context':_0xfbef('0x1a3'),'Priority':'1','variable':_0x27708e,'timeout':(_0x565d29[_0xfbef('0x1a4')]||0x1e)*0x3e8,'async':!![],'channelid':_0x459bc6})[_0xfbef('0xa0')](function(_0x90d3f){return _0x2d40c3(_0x90d3f);})[_0xfbef('0xa4')](function(_0x5d624d){_0x565d29[_0xfbef('0x1a5')]+=0x1;var _0x1e419b=new History(_0x5c3ed2['actions'][_0x459bc6]);logger[_0xfbef('0x69')](util[_0xfbef('0x48')](_0xfbef('0x1a6'),JSON[_0xfbef('0x77')](_0x5d624d)));_0x1e419b[_0xfbef('0x72')]=0xe;_0x1e419b['statedesc']=_0xfbef('0x1a7');_0x1e419b[_0xfbef('0xed')]=moment()[_0xfbef('0x48')](_0xfbef('0xcb'));_0x1e419b[_0xfbef('0xfa')]=_0x1e419b[_0xfbef('0xed')];hopperUtils[_0xfbef('0xd1')](_0x1e419b)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x1a8')));_0x5c3ed2['moveContactManagedDialer'](_0x1e419b)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x1a8')))[_0xfbef('0x1c')](function(){delete _0x5c3ed2[_0xfbef('0x25')][_0x459bc6];return _0x4c367e(msgResponse(_0xfbef('0x176'),_0xfbef('0xc3'),'originate\x20action\x20Error'));});});});};Dialer[_0xfbef('0x8d')][_0xfbef('0x1a9')]=function(_0x21a98b,_0x3c6ef7,_0x4ed3f1){var _0x8afc6a=new History(_0x3c6ef7);if(_0x8afc6a[_0xfbef('0x13e')]+_0x8afc6a[_0xfbef('0x13f')]+_0x8afc6a[_0xfbef('0x131')]+_0x8afc6a['countnosuchnumberretry']+_0x8afc6a[_0xfbef('0xe2')]+_0x8afc6a[_0xfbef('0xf5')]+_0x8afc6a[_0xfbef('0x12f')]+_0x8afc6a['countagentrejectretry']>=_0x4ed3f1[_0xfbef('0x134')]-0x1){return!![];}switch(_0x21a98b){case 0x3:if(_0x8afc6a['countnoanswerretry']>=_0x4ed3f1[_0xfbef('0x1aa')]-0x1){return!![];}hopperUtils[_0xfbef('0xe5')]({'active':![],'countnoanswerretry':_0x8afc6a[_0xfbef('0x131')]+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1['dialNoAnswerRetryFrequency'],_0xfbef('0xe8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8afc6a[_0xfbef('0xe9')],'ListId':_0x8afc6a['ListId'],'VoiceQueueId':_0x8afc6a[_0xfbef('0xeb')]||undefined,'CampaignId':_0x8afc6a[_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x1ab')));break;case 0x5:if(_0x8afc6a[_0xfbef('0x13e')]>=_0x4ed3f1[_0xfbef('0x1ac')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x8afc6a['countbusyretry']+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1[_0xfbef('0x1ad')],_0xfbef('0xe8'))[_0xfbef('0x48')](_0xfbef('0xcb')),'ContactId':_0x8afc6a['ContactId'],'ListId':_0x8afc6a['ListId'],'VoiceQueueId':_0x8afc6a[_0xfbef('0xeb')]||undefined,'CampaignId':_0x8afc6a[_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x8afc6a[_0xfbef('0x13f')]>=_0x4ed3f1[_0xfbef('0x1ae')]-0x1){return!![];}hopperUtils[_0xfbef('0xe5')]({'active':![],'countcongestionretry':_0x8afc6a[_0xfbef('0x13f')]+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1['dialCongestionRetryFrequency'],_0xfbef('0xe8'))[_0xfbef('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8afc6a[_0xfbef('0xe9')],'ListId':_0x8afc6a[_0xfbef('0xea')],'VoiceQueueId':_0x8afc6a['VoiceQueueId']||undefined,'CampaignId':_0x8afc6a['CampaignId']||undefined})[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x1af')));break;case 0x0:if(_0x8afc6a[_0xfbef('0x132')]>=_0x4ed3f1[_0xfbef('0x1b0')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x8afc6a[_0xfbef('0x132')]+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1[_0xfbef('0x1b1')],_0xfbef('0xe8'))['format'](_0xfbef('0xcb')),'ContactId':_0x8afc6a['ContactId'],'ListId':_0x8afc6a[_0xfbef('0xea')],'VoiceQueueId':_0x8afc6a['VoiceQueueId']||undefined,'CampaignId':_0x8afc6a[_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x8afc6a['countdropretry']>=_0x4ed3f1[_0xfbef('0xe3')]-0x1){return!![];}hopperUtils[_0xfbef('0xe5')]({'active':![],'countdropretry':_0x8afc6a[_0xfbef('0xe2')]+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1[_0xfbef('0xe7')],_0xfbef('0xe8'))[_0xfbef('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8afc6a[_0xfbef('0xe9')],'ListId':_0x8afc6a[_0xfbef('0xea')],'VoiceQueueId':_0x8afc6a[_0xfbef('0xeb')]||undefined,'CampaignId':_0x8afc6a[_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x8afc6a[_0xfbef('0xf5')]>=_0x4ed3f1[_0xfbef('0xf7')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x8afc6a[_0xfbef('0xf5')]+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1[_0xfbef('0xf8')],'minutes')[_0xfbef('0x48')](_0xfbef('0xcb')),'ContactId':_0x8afc6a[_0xfbef('0xe9')],'ListId':_0x8afc6a[_0xfbef('0xea')],'VoiceQueueId':_0x8afc6a[_0xfbef('0xeb')]||undefined,'CampaignId':_0x8afc6a[_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x1b2')));break;case 0x13:if(_0x8afc6a['countmachineretry']>=_0x4ed3f1['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xfbef('0xe5')]({'active':![],'countmachineretry':_0x8afc6a[_0xfbef('0x12f')]+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1['dialMachineRetryFrequency'],_0xfbef('0xe8'))['format'](_0xfbef('0xcb')),'ContactId':_0x8afc6a[_0xfbef('0xe9')],'ListId':_0x8afc6a['ListId'],'VoiceQueueId':_0x8afc6a[_0xfbef('0xeb')]||undefined,'CampaignId':_0x8afc6a[_0xfbef('0xf9')]||undefined})['catch'](loggerCatch(_0xfbef('0x13a')));break;case 0x14:if(_0x8afc6a[_0xfbef('0x133')]>=_0x4ed3f1[_0xfbef('0x1b3')]-0x1){return!![];}hopperUtils[_0xfbef('0xe5')]({'active':![],'countagentrejectretry':_0x8afc6a[_0xfbef('0x133')]+=0x1,'scheduledat':moment()[_0xfbef('0xe6')](_0x4ed3f1[_0xfbef('0x1b4')],_0xfbef('0xe8'))[_0xfbef('0x48')](_0xfbef('0xcb')),'ContactId':_0x8afc6a[_0xfbef('0xe9')],'ListId':_0x8afc6a['ListId'],'VoiceQueueId':_0x8afc6a['VoiceQueueId']||undefined,'CampaignId':_0x8afc6a['CampaignId']||undefined})['catch'](loggerCatch(_0xfbef('0x1b5')));break;default:return!![];}};Dialer[_0xfbef('0x8d')][_0xfbef('0x11b')]=function(_0xfc5042,_0x3792a7,_0x5740a1){var _0x533431=this;var _0x3980bd=new History(_0xfc5042);var _0x2c01cf=![];var _0x10229d;var _0x151db1;return new Promise(function(_0x5ea44a,_0xa9769c){if(_[_0xfbef('0x43')](_0x3792a7)&&typeof _0x3792a7!=='object'){return _0xa9769c(msgResponse(_0xfbef('0x1b6'),'Failure',_0xfbef('0x1b7')));}if(_[_0xfbef('0x43')](_0x5740a1)&&typeof _0x5740a1!==_0xfbef('0x174')){return _0xa9769c(msgResponse(_0xfbef('0x1b6'),_0xfbef('0x9a'),_0xfbef('0x1b8')));}hopperUtils[_0xfbef('0xf6')](_0x3980bd,_0x5740a1['reason'],_0x3792a7)[_0xfbef('0xa0')](function(_0x13e237){if(_0x13e237['additional']==0x1)_0x2c01cf=!![];switch(_0x5740a1[_0xfbef('0xcd')]){case'0':_0x3792a7['outboundNoSuchCallsDay']+=0x1;_0x3980bd[_0xfbef('0x72')]=0x0;_0x3980bd[_0xfbef('0x73')]='NoSuchNumber';_0x3980bd[_0xfbef('0x132')]+=0x1;_0x3980bd[_0xfbef('0xde')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0xfbef('0x128')](_0xfc5042,_0xfbef('0x1b9')));_0x10229d=_0x3792a7[_0xfbef('0x1b1')];_0x151db1=_0x3792a7[_0xfbef('0xdf')];hopperUtils[_0xfbef('0xd1')](_0x3980bd)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x130')));if(_0x533431[_0xfbef('0x1a9')](0x0,_0xfc5042,_0x3792a7)&&!_0x2c01cf){if(_0x3980bd[_0xfbef('0x132')]>=_0x3792a7[_0xfbef('0x1b0')]){_0x533431['createStateFinal'](_0x3980bd,_0x5ea44a,_0xa9769c,_0xfbef('0x1ba'));}else{_0x533431[_0xfbef('0x135')](_0x3980bd,_0x5ea44a,_0xa9769c,_0xfbef('0x1ba'));}}break;case'3':_0x3792a7[_0xfbef('0x1bb')]+=0x1;_0x3980bd['state']=0x3;_0x3980bd[_0xfbef('0x73')]=_0xfbef('0x1bc');_0x3980bd[_0xfbef('0x131')]+=0x1;_0x3980bd[_0xfbef('0xde')]+=0x1;var _0x3e06ae=ut[_0xfbef('0x1bd')](_0xfc5042,_0x3792a7);ami[_0xfbef('0x44')](_0xfbef('0x1be'),_0x3e06ae);_0x10229d=_0x3792a7['dialNoAnswerRetryFrequency'];_0x151db1=_0x3792a7['callAdditionalPhoneAfterMin'];hopperUtils[_0xfbef('0xd1')](_0x3980bd)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x533431[_0xfbef('0x1a9')](0x3,_0xfc5042,_0x3792a7)&&!_0x2c01cf){if(_0x3980bd[_0xfbef('0x131')]>=_0x3792a7[_0xfbef('0x1aa')]){_0x533431[_0xfbef('0x137')](_0x3980bd,_0x5ea44a,_0xa9769c,'reason\x203\x20ringing\x20no\x20answer');}else{_0x533431[_0xfbef('0x135')](_0x3980bd,_0x5ea44a,_0xa9769c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3792a7['outboundBusyCallsDay']+=0x1;_0x3980bd[_0xfbef('0x72')]=0x5;_0x3980bd[_0xfbef('0x73')]='Busy';_0x3980bd[_0xfbef('0x13e')]+=0x1;_0x3980bd[_0xfbef('0xde')]+=0x1;ami['emit'](_0xfbef('0x1bf'),ut[_0xfbef('0x128')](_0xfc5042,_0xfbef('0x1c0')));_0x10229d=_0x3792a7['dialBusyRetryFrequency'];_0x151db1=_0x3792a7['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3980bd)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x1c1')));if(_0x533431['checkRetriveMax'](0x5,_0xfc5042,_0x3792a7)&&!_0x2c01cf){if(_0x3980bd[_0xfbef('0x13e')]>=_0x3792a7['dialBusyMaxRetry']){_0x533431['createStateFinal'](_0x3980bd,_0x5ea44a,_0xa9769c,'reason\x205\x20busy');}else{_0x533431[_0xfbef('0x135')](_0x3980bd,_0x5ea44a,_0xa9769c,_0xfbef('0x1c2'));}}break;case'8':_0x3792a7[_0xfbef('0x1c3')]+=0x1;_0x3980bd['state']=0x8;_0x3980bd['statedesc']=_0xfbef('0x1c4');_0x3980bd[_0xfbef('0x13f')]+=0x1;_0x3980bd[_0xfbef('0xde')]+=0x1;_0x10229d=_0x3792a7[_0xfbef('0x1c5')];_0x151db1=_0x3792a7[_0xfbef('0xdf')];ami[_0xfbef('0x44')](_0xfbef('0x1c6'),ut['buildObj'](_0xfc5042,_0xfbef('0x1c7')));hopperUtils[_0xfbef('0xd1')](_0x3980bd)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x1c8')));if(_0x533431['checkRetriveMax'](0x8,_0xfc5042,_0x3792a7)&&!_0x2c01cf){if(_0x3980bd['countcongestionretry']>=_0x3792a7['dialCongestionMaxRetry']){_0x533431[_0xfbef('0x137')](_0x3980bd,_0x5ea44a,_0xa9769c,'reason\x208\x20congestion');}else{_0x533431['stateGlobal'](_0x3980bd,_0x5ea44a,_0xa9769c,'reason\x208\x20congestion');}}break;case'11':_0x3792a7[_0xfbef('0x1c9')]+=0x1;_0x3980bd[_0xfbef('0x72')]=0xb;_0x3980bd['statedesc']=_0xfbef('0xf3');_0x3980bd[_0xfbef('0xf5')]+=0x1;_0x3980bd['countglobal']+=0x1;_0x10229d=_0x3792a7[_0xfbef('0xf8')];_0x151db1=_0x3792a7[_0xfbef('0xdf')];hopperUtils['createHistory'](_0x3980bd)[_0xfbef('0xa4')](loggerCatch(_0xfbef('0xfb')));if(_0x533431[_0xfbef('0x1a9')](0xb,_0xfc5042,_0x3792a7)&&!_0x2c01cf){if(_0x3980bd[_0xfbef('0xf5')]>=_0x3792a7[_0xfbef('0xf7')]){_0x533431['createStateFinal'](_0x3980bd,_0x5ea44a,_0xa9769c,_0xfbef('0x1ca'));}else{_0x533431[_0xfbef('0x135')](_0x3980bd,_0x5ea44a,_0xa9769c,_0xfbef('0x1ca'));}}break;case'20':_0x3792a7[_0xfbef('0x1cb')]+=0x1;_0x3980bd[_0xfbef('0x72')]=0x14;_0x3980bd[_0xfbef('0x73')]=_0xfbef('0x1cc');_0x3980bd['countagentrejectretry']+=0x1;_0x3980bd[_0xfbef('0xde')]+=0x1;_0x10229d=_0x3792a7[_0xfbef('0x1b4')];_0x151db1=_0x3792a7[_0xfbef('0xdf')];ami[_0xfbef('0x44')]('custom:agentreject',ut[_0xfbef('0x128')](_0xfc5042,'agentreject'));hopperUtils[_0xfbef('0xd1')](_0x3980bd)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x533431[_0xfbef('0x1a9')](0x14,_0xfc5042,_0x3792a7)&&!_0x2c01cf){if(_0x3980bd[_0xfbef('0x133')]>=_0x3792a7['dialAgentRejectMaxRetry']){_0x533431[_0xfbef('0x137')](_0x3980bd,_0x5ea44a,_0xa9769c,'reason\x2020\x20agentreject');}else{_0x533431['stateGlobal'](_0x3980bd,_0x5ea44a,_0xa9769c,'reason\x2020\x20agentreject');}}break;default:_0x3792a7[_0xfbef('0x14c')]+=0x1;_0x3980bd['state']=0xc;_0x3980bd[_0xfbef('0x73')]=_0x5740a1[_0xfbef('0xcd')];_0x10229d=_0x3792a7[_0xfbef('0x1b4')];_0x151db1=_0x3792a7[_0xfbef('0xdf')];hopperUtils[_0xfbef('0xd1')](_0x3980bd)['catch'](loggerCatch(_0xfbef('0x1cd')));if(_0x533431[_0xfbef('0x1a9')](_0x5740a1[_0xfbef('0xcd')],_0xfc5042,_0x3792a7)&&!_0x2c01cf){if(_0x3980bd['countbusyretry']+_0x3980bd[_0xfbef('0x13f')]+_0x3980bd[_0xfbef('0x131')]+_0x3980bd['countnosuchnumberretry']+_0x3980bd[_0xfbef('0xe2')]+_0x3980bd[_0xfbef('0xf5')]+_0x3980bd[_0xfbef('0x12f')]+_0x3980bd['countagentrejectretry']>=_0x3792a7[_0xfbef('0x134')]){_0x533431['stateGlobal'](_0x3980bd,_0x5ea44a,_0xa9769c,_0x5740a1[_0xfbef('0xcd')]);}else{_0x533431[_0xfbef('0x137')](_0x3980bd,_0x5ea44a,_0xa9769c,_0x5740a1[_0xfbef('0xcd')]);}}}})['then'](function(){if(_0x2c01cf){hopperUtils[_0xfbef('0xf1')](_0x3980bd,_0x10229d,_0x151db1)['then'](function(){return _0x5ea44a(0x1);});}});});};Dialer[_0xfbef('0x8d')][_0xfbef('0x135')]=function(_0x1a7766,_0x58f614,_0x448a09,_0x480ecc){var _0x3bf872=new Final(_0x1a7766);_0x3bf872[_0xfbef('0x72')]=0xf;_0x3bf872['statedesc']=_0xfbef('0x1ce');this[_0xfbef('0x137')](_0x3bf872,_0x58f614,_0x448a09,_0x480ecc);};Dialer[_0xfbef('0x8d')][_0xfbef('0x137')]=function(_0x730d87,_0x2c27b7,_0x296fbf,_0x4a3701){hopperUtils['moveContactManagedDialer'](_0x730d87)['then'](function(){return _0x2c27b7(msgResponse('[callProgressDetecting]',_0xfbef('0x119'),_0x4a3701));})[_0xfbef('0xa4')](function(){return _0x296fbf(msgResponse('[moveContactManagedDialer][0]',_0xfbef('0x9a'),_0xfbef('0x1cf')));});};Dialer[_0xfbef('0x8d')]['predictive']=function(_0x3d5c9a){var _0x1ddcde=_0x3d5c9a['dialPredictiveOptimizationPercentage']/0x64;var _0x110faf=_0x3d5c9a[_0xfbef('0xd8')]/(_0x3d5c9a['outboundDropCallsDayTimeout']+_0x3d5c9a[_0xfbef('0xcc')]);var _0x17db60=Math[_0xfbef('0x1d0')](_0x3d5c9a[_0xfbef('0x1d1')]*(_0x3d5c9a['predictiveIntervalMaxThreshold']/0x64));var _0xa9ee8d=Math['round'](_0x3d5c9a['predictiveIntervalAvailable']*(_0x3d5c9a[_0xfbef('0x1d2')]/0x64));var _0x1b0a61=_0x3d5c9a[_0xfbef('0x154')]+_0x3d5c9a[_0xfbef('0x156')];var _0x431fca=Math[_0xfbef('0x1d3')](_0x3d5c9a[_0xfbef('0x5c')]*_0x3d5c9a[_0xfbef('0x5f')]*_0x3d5c9a[_0xfbef('0x1d4')]*_0x3d5c9a[_0xfbef('0x1d5')]);if(_[_0xfbef('0x43')](_0x3d5c9a[_0xfbef('0x64')])){if(!_[_0xfbef('0x43')](_0x3d5c9a[_0xfbef('0x29')])){_0x3d5c9a[_0xfbef('0x29')]=undefined;loggerPredictive['error'](_0xfbef('0x1d6'),_0xfbef('0x1d7'));}if(!_['isUndefined'](_0x3d5c9a['handlePredictive'])){loggerPredictive[_0xfbef('0x69')](_0xfbef('0x1d6'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3d5c9a[_0xfbef('0x67')]);_0x3d5c9a['handlePredictive']=undefined;}_0x3d5c9a[_0xfbef('0x64')]=moment()[_0xfbef('0x48')](_0xfbef('0xcb'));loggerPredictive[_0xfbef('0x4c')](_0x3d5c9a['name'],_0xfbef('0x1d8'),_0x3d5c9a[_0xfbef('0x64')]);this[_0xfbef('0xb7')](_0x3d5c9a,0x1);}else if(ifInterval(_0x3d5c9a[_0xfbef('0x1d9')],_0x3d5c9a[_0xfbef('0x64')])){this[_0xfbef('0xb7')](_0x3d5c9a,0x1);loggerPredictiveCalls['info'](_0xfbef('0x1da'),_0x3d5c9a['startProgressive'],_0x3d5c9a['name']);_0x3d5c9a[_0xfbef('0x5c')]=0x0;_0x3d5c9a[_0xfbef('0xd9')]=0x0;}else if(_0x1ddcde<_0x110faf&&_0x3d5c9a[_0xfbef('0x1db')]===_0xfbef('0x1dc')){clearPredictiveAttributes(_0x3d5c9a);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x1dd'),_0xfbef('0x1de'),_0x110faf,_0xfbef('0x64'),_0x3d5c9a[_0xfbef('0x49')]);}else if(_0x431fca<_0x3d5c9a[_0xfbef('0xd9')]&&_0x3d5c9a[_0xfbef('0x1db')]==='dropRate'){clearPredictiveAttributes(_0x3d5c9a);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x1df'),_0xfbef('0x1e0'),_0x431fca,_0xfbef('0x1e1'),_0x3d5c9a[_0xfbef('0xd9')],_0xfbef('0x64'),_0x3d5c9a[_0xfbef('0x49')]);}else if(!ifInterval(_0x3d5c9a[_0xfbef('0x1d9')],_0x3d5c9a[_0xfbef('0x64')])&&_[_0xfbef('0x43')](_0x3d5c9a['startPredictive'])&&!_[_0xfbef('0x43')](_0x3d5c9a[_0xfbef('0x64')])){_0x3d5c9a[_0xfbef('0x29')]=moment()[_0xfbef('0x48')](_0xfbef('0xcb'));loggerPredictive[_0xfbef('0x4c')](_0x3d5c9a[_0xfbef('0x49')],_0xfbef('0x1e2'),_0x3d5c9a[_0xfbef('0x29')]);hopperUtils[_0xfbef('0x1e3')](_0x3d5c9a[_0xfbef('0x1d9')])[_0xfbef('0xa0')](this[_0xfbef('0x1e4')](_0x3d5c9a))[_0xfbef('0xa0')](mergeDataErlangB(_0x3d5c9a))[_0xfbef('0xa0')](this[_0xfbef('0x1e5')](_0x3d5c9a))[_0xfbef('0xa4')](loggerCatchPredictive(_0xfbef('0x1e6'),_0x3d5c9a));}else if(!ifInterval(_0x3d5c9a['dialPredictiveInterval'],_0x3d5c9a[_0xfbef('0x29')])){_0x3d5c9a[_0xfbef('0xd9')]=0x0;_0x3d5c9a[_0xfbef('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfbef('0x4c')](_0x3d5c9a[_0xfbef('0x49')],'recalculate\x20predictive\x20at',_0x3d5c9a[_0xfbef('0x29')]);clearInterval(_0x3d5c9a[_0xfbef('0x67')]);_0x3d5c9a['handlePredictive']=undefined;hopperUtils[_0xfbef('0x1e3')](_0x3d5c9a[_0xfbef('0x1d9')])[_0xfbef('0xa0')](this[_0xfbef('0x1e4')](_0x3d5c9a))[_0xfbef('0xa0')](mergeDataErlangB(_0x3d5c9a))[_0xfbef('0xa0')](this['startMethodPredictive'](_0x3d5c9a))['catch'](loggerCatchPredictive(_0xfbef('0x1e7'),_0x3d5c9a));}else if(_0x3d5c9a['predictiveIntervalAvailable']&&_0x1b0a61<_0x3d5c9a[_0xfbef('0x1d1')]-_0xa9ee8d){clearPredictiveAttributes(_0x3d5c9a);loggerPredictive[_0xfbef('0x4c')](_0x3d5c9a['name'],_0xfbef('0x1e8'),_0x1b0a61,')\x20are\x20less\x20than\x20threshold\x20(',_0x3d5c9a[_0xfbef('0x1d1')],'-',_0xa9ee8d,'=',_0x3d5c9a['predictiveIntervalAvailable']-_0xa9ee8d,')');}else if(_0x3d5c9a['predictiveIntervalAvailable']&&_0x1b0a61>_0x3d5c9a['predictiveIntervalAvailable']+_0x17db60){clearPredictiveAttributes(_0x3d5c9a);loggerPredictive[_0xfbef('0x4c')](_0x3d5c9a[_0xfbef('0x49')],_0xfbef('0x1e8'),_0x1b0a61,_0xfbef('0x1e9'),_0x3d5c9a[_0xfbef('0x1d1')],'+',_0x17db60,'=',_0x3d5c9a[_0xfbef('0x1d1')]+_0x17db60,')');}};Dialer[_0xfbef('0x8d')][_0xfbef('0x1e4')]=function(_0x2b69f7){var _0x3ef859=this;return function(_0x140d10){return new Promise(function(_0x2f9044,_0x2b9728){_[_0xfbef('0x62')](_0x2b69f7,_0x140d10[0x0]);if(checkGetDataPredictive(_0x140d10[0x0])){var _0x80c754=_0x2b69f7['predictiveIntervalAvailable']=_0x2b69f7[_0xfbef('0x156')]+_0x2b69f7[_0xfbef('0x154')];var _0x3b34fe=_0x2b69f7[_0xfbef('0x1d9')]*0x3c;var _0x74af64=_0x140d10[0x0][_0xfbef('0x55')]+_0x140d10[0x0][_0xfbef('0x53')];var _0x3846ba=(_0x140d10[0x0][_0xfbef('0x1ea')]+_0x140d10[0x0][_0xfbef('0xd7')]+_0x140d10[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x140d10[0x0][_0xfbef('0x1eb')];_0x2b69f7[_0xfbef('0x1d4')]=_0x3846ba>0x0?_0x3846ba:0x1;switch(_0x2b69f7['dialPredictiveOptimization']){case _0xfbef('0x1dc'):var _0x54015b=_0x2b69f7[_0xfbef('0x1ec')]/0x64;return _0x3ef859[_0xfbef('0x1ed')](_0x80c754,_0x3b34fe,_0x74af64,_0x3846ba,_0x54015b)[_0xfbef('0xa0')](function(_0x41b28c){return _0x2f9044(_0x41b28c);});case _0xfbef('0x1ee'):var _0x2341f8=_0x2b69f7[_0xfbef('0x1ec')]/0x64;return _0x3ef859[_0xfbef('0x1ef')](_0x80c754,_0x3b34fe,_0x74af64,_0x3846ba,_0x2341f8)[_0xfbef('0xa0')](function(_0x489ed7){return _0x2f9044(_0x489ed7);});default:return _0x2b9728(msgResponse('[getDataPredictive]',_0xfbef('0x9a'),_0xfbef('0x1f0')));}}else{return _0x2b9728(msgResponse(_0xfbef('0x1f1'),_0xfbef('0x9a'),_0xfbef('0x1f2')));}});};};Dialer['prototype'][_0xfbef('0x1f3')]=function(_0x57e766){var _0x255713=this;return function(_0x38a2db){return new Promise(function(_0x17104,_0x1763df){_[_0xfbef('0x62')](_0x57e766,_0x38a2db[0x0]);if(checkGetDataPredictive(_0x38a2db[0x0])){loggerPredictive['info'](JSON[_0xfbef('0x77')](_0x38a2db[0x0]));if(_0x57e766['dialPredictiveOptimization']===_0xfbef('0x1dc')){return _0x255713['getVoiceQueueRtPauses'](_0x57e766['id'])[_0xfbef('0xa0')](function(_0x4ee4cd){var _0x28af39=_0x57e766['loggedIn']-_0x4ee4cd[0x0][_0xfbef('0x1f4')];var _0x185157=_0x57e766[_0xfbef('0x1d9')]*0x3c;var _0x4f1fb8=_0x38a2db[0x0]['predictiveIntervalAvgTalktime']+_0x38a2db[0x0][_0xfbef('0x53')];var _0x1a5e7c=(_0x38a2db[0x0][_0xfbef('0x1ea')]+_0x38a2db[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x38a2db[0x0][_0xfbef('0x52')])/_0x38a2db[0x0][_0xfbef('0x1eb')];var _0x1e0c1d=_0x57e766[_0xfbef('0x1ec')]/0x64;_0x57e766[_0xfbef('0x1f5')]=_0x4ee4cd[0x0][_0xfbef('0x1f4')]||0x0;_0x57e766[_0xfbef('0x1d4')]=_0x1a5e7c>0x0?_0x1a5e7c:0x1;return _0x255713[_0xfbef('0x1ed')](_0x28af39,_0x185157,_0x4f1fb8,_0x1a5e7c,_0x1e0c1d);})['then'](function(_0x25ecae){return _0x17104(_0x25ecae);})[_0xfbef('0xa4')](function(_0x3ec502){return _0x1763df(msgResponse(_0xfbef('0x1f6'),_0xfbef('0x9a'),JSON['stringify'](_0x3ec502)));});}if(_0x57e766['dialPredictiveOptimization']===_0xfbef('0x1ee')){return _0x255713[_0xfbef('0x16a')](_0x57e766['id'])[_0xfbef('0xa0')](function(_0x25a1e5){var _0x3acf38=_0x57e766['loggedIn']-_0x25a1e5[0x0]['outboundQueuePauses'];var _0xfe94b9=_0x57e766[_0xfbef('0x1d9')]*0x3c;var _0x2e056b=_0x38a2db[0x0][_0xfbef('0x55')]+_0x38a2db[0x0][_0xfbef('0x53')];var _0x2d2ea4=(_0x38a2db[0x0][_0xfbef('0x1ea')]+_0x38a2db[0x0][_0xfbef('0xd7')]+_0x38a2db[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x38a2db[0x0][_0xfbef('0x1eb')];var _0x166c9d=_0x57e766['dialPredictiveOptimizationPercentage']/0x64;_0x57e766[_0xfbef('0x1f5')]=_0x25a1e5[0x0][_0xfbef('0x1f4')]||0x0;_0x57e766['predictiveIntervalHitRate']=_0x2d2ea4>0x0?_0x2d2ea4:0x1;return _0x255713['busyFactor'](_0x3acf38,_0xfe94b9,_0x2e056b,_0x2d2ea4,_0x166c9d);})[_0xfbef('0xa0')](function(_0x4eed77){return _0x17104(_0x4eed77);})[_0xfbef('0xa4')](function(_0x3c6942){return _0x1763df(msgResponse(_0xfbef('0x1f6'),_0xfbef('0x9a'),JSON[_0xfbef('0x77')](_0x3c6942)));});}}else{return _0x1763df(msgResponse(_0xfbef('0x1f1'),_0xfbef('0x9a'),_0xfbef('0x1f2')));}});};};Dialer[_0xfbef('0x8d')][_0xfbef('0x1e5')]=function(_0x270aaa){var _0x42e44f=this;return function(){var _0xaec4d=0x0;var _0x1e255c=Math[_0xfbef('0x1d3')](_0x270aaa['erlangCallToSecond']*0x3e8);if(_0x1e255c>0x0){_0x1e255c=_0x1e255c<0x64?0x64:_0x1e255c;loggerPredictive[_0xfbef('0x4c')](_0x270aaa[_0xfbef('0x49')],_0xfbef('0x1f7'),_0x1e255c,_0xfbef('0x1f8'));_0x270aaa[_0xfbef('0x67')]=setInterval(function(){_0x42e44f[_0xfbef('0x67')](_0x270aaa);loggerPredictiveCalls['info'](_0xfbef('0x1f9'),_0xaec4d+=0x1);},_0x1e255c);}else{loggerPredictive[_0xfbef('0x4c')](_0x270aaa[_0xfbef('0x49')],_0xfbef('0x1fa'));}};};Dialer[_0xfbef('0x8d')][_0xfbef('0x1fb')]=function(_0x444238,_0x565bea){var _0x14cbad=this;return function(_0x22f506){if(_[_0xfbef('0x4b')](_0x22f506)){if(_[_0xfbef('0x105')](_0x565bea['UserId'])||!_0x565bea['recallme']){if(_0x444238[_0xfbef('0xb6')]===_0xfbef('0xba')){_0x444238[_0xfbef('0x74')]=_[_0xfbef('0x43')](_0x444238[_0xfbef('0x74')])?!![]:_0x444238[_0xfbef('0x74')];var _0x37694f=uuid['v4']();_0x14cbad[_0xfbef('0x25')][_0x37694f]=new Action(_0x444238,_0x565bea,_0x37694f);loggerBooked[_0xfbef('0x4c')](_0xfbef('0x1fc'),_0x37694f,_0xfbef('0x1fd'),JSON[_0xfbef('0x77')](_0x444238[_0xfbef('0x74')]),_0xfbef('0x1fe'),_0x444238[_0xfbef('0x49')]);if(_0x444238[_0xfbef('0x74')]){_0x444238[_0xfbef('0x74')]=![];_0x14cbad[_0xfbef('0x2b')][_0x14cbad[_0xfbef('0x25')][_0x37694f]['queue']]=[];ami['Action']({'actionid':_0x37694f,'action':_0xfbef('0x1ff'),'queue':_0x444238[_0xfbef('0x49')]})[_0xfbef('0xa4')](function(){utils[_0xfbef('0xc8')](_0x444238,_0xfbef('0x200'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x14cbad[_0xfbef('0x25')][_0x37694f][_0xfbef('0xe9')],'ListId':_0x14cbad[_0xfbef('0x25')][_0x37694f][_0xfbef('0xea')],'VoiceQueueId':_0x14cbad[_0xfbef('0x25')][_0x37694f][_0xfbef('0xeb')]||undefined,'CampaignId':_0x14cbad['actions'][_0x37694f][_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x14cbad[_0xfbef('0x25')][_0x37694f];});}else{loggerBooked[_0xfbef('0x4c')](_0xfbef('0x201'),JSON[_0xfbef('0x77')](_0x444238[_0xfbef('0x74')]),'Queue:\x20',_0x444238['name']);utils[_0xfbef('0xc8')](_0x444238,_0xfbef('0x200'));hopperUtils[_0xfbef('0xe5')]({'active':![],'ContactId':_0x14cbad['actions'][_0x37694f][_0xfbef('0xe9')],'ListId':_0x14cbad['actions'][_0x37694f][_0xfbef('0xea')],'VoiceQueueId':_0x14cbad['actions'][_0x37694f][_0xfbef('0xeb')]||undefined,'CampaignId':_0x14cbad[_0xfbef('0x25')][_0x37694f][_0xfbef('0xf9')]||undefined})['catch'](loggerCatch(_0xfbef('0x202')));delete _0x14cbad['actions'][_0x37694f];}}else{return _0x14cbad[_0xfbef('0x173')](_0x444238,_0x565bea);}}else{if(utils[_0xfbef('0x63')](undefined,_0x565bea[_0xfbef('0x203')])<_0x444238[_0xfbef('0x204')]*0x3c){if(_0x565bea[_0xfbef('0x171')]&&!_0x565bea['Agent'][_0xfbef('0x205')]){_0x14cbad[_0xfbef('0x1e')][_0xfbef('0x107')](_0x565bea['id'])[_0xfbef('0x1c')](function(){utils[_0xfbef('0xc8')](_0x444238,_0xfbef('0x200'));});}else{hopperUtils[_0xfbef('0x206')]({'active':![]},_0x565bea['id'],0x1)[_0xfbef('0x1c')](function(){utils[_0xfbef('0xc8')](_0x444238,_0xfbef('0x200'));});}}else{_0x444238['outboundReCallsDay']+=0x1;utils[_0xfbef('0xc8')](_0x444238,_0xfbef('0x200'));if(_0x444238[_0xfbef('0x207')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x565bea['ContactId'],'ListId':_0x565bea[_0xfbef('0xea')],'VoiceQueueId':_0x565bea[_0xfbef('0xeb')]||undefined,'CampaignId':_0x565bea[_0xfbef('0xf9')]||undefined})[_0xfbef('0xa4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xfbef('0xd1')](createObjHistory(_0x444238,_0x565bea,utils[_0xfbef('0x6c')][_0xfbef('0x208')],0x17,_0xfbef('0x209')))[_0xfbef('0xa4')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x14cbad['saveInDb'](createObjHistory(_0x444238,_0x565bea,utils[_0xfbef('0x6c')][_0xfbef('0x20a')],0x16,'RecallFailedTimeout'),_0xfbef('0x20b'),_0xfbef('0x20c'));}}}}else{_0x444238['outboundBlacklistCallsDay']+=0x1;_0x14cbad[_0xfbef('0x12a')](createObjHistory(_0x444238,_0x565bea,utils['CAMPAIGN_STATUS'][_0xfbef('0x20d')],0xd,'Blacklist'),_0xfbef('0x20e'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xfbef('0x8d')]['handleIvr']=function(_0x3bf0ec){var _0x4c00f6=this;var _0x5288ed=_0x3bf0ec[_0xfbef('0x20f')]-_0x3bf0ec[_0xfbef('0x83')];emitCampaignSummary(_0x3bf0ec);if(_0x5288ed>0x0&&_0x3bf0ec[_0xfbef('0x210')]==0x0){if(_0x5288ed>this['maxNumberOriginate']){_0x5288ed=this[_0xfbef('0x23')];}_0x3bf0ec['temp']=0x1;hopperUtils[_0xfbef('0x211')](_0x3bf0ec,_0x5288ed)[_0xfbef('0xa0')](function(_0x32faf4){_0x3bf0ec[_0xfbef('0x210')]=0x0;if(_0x32faf4){if(!utils[_0xfbef('0x212')](_0x32faf4)){_0x3bf0ec[_0xfbef('0x70')]=utils['CAMPAIGN_STATUS'][_0xfbef('0x213')];logger[_0xfbef('0x4c')](_0xfbef('0x214')+_0x3bf0ec[_0xfbef('0x49')]);}else{_0x3bf0ec[_0xfbef('0x83')]+=_0x32faf4[_0xfbef('0x10d')];_0x3bf0ec['message']=utils[_0xfbef('0x6c')][_0xfbef('0x215')];for(var _0x345e74=0x0;_0x345e74<_0x32faf4[_0xfbef('0x10d')];_0x345e74+=0x1){_0x3bf0ec['ivrTotalCallsDays']+=0x1;if(_[_0xfbef('0x105')](_0x32faf4[_0x345e74])||_[_0xfbef('0x105')](_0x32faf4[_0x345e74][_0xfbef('0x192')])||_[_0xfbef('0x105')](_0x32faf4[_0x345e74]['phone'])){_0x4c00f6[_0xfbef('0x216')](_0xfbef('0x217'),_0x3bf0ec,_0x32faf4[_0x345e74]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xfbef('0x78')](_0x32faf4[_0x345e74],[_0xfbef('0xf9'),_0xfbef('0x175')]))['then'](_0x4c00f6[_0xfbef('0x1fb')](_0x3bf0ec,_0x32faf4[_0x345e74]))['catch'](function(_0x2f7657){logger[_0xfbef('0x69')](_0xfbef('0x218'),_0x2f7657);utils[_0xfbef('0xc8')](_0x3bf0ec,_0xfbef('0x219'));});}}}}})['catch'](function(_0x512b1b){_0x3bf0ec[_0xfbef('0x210')]=0x0;logger[_0xfbef('0x69')](_0xfbef('0x21a'),_0x512b1b);});}};Dialer[_0xfbef('0x8d')][_0xfbef('0xb7')]=function(_0x4306e4,_0x44a6cc){var _0x1394a8=this;var _0x590fa9=[];if(_0x44a6cc<0x1||_0x4306e4[_0xfbef('0xb6')]===_0xfbef('0xba')){_0x44a6cc=0x1;}var _0x1b15b7=Math[_0xfbef('0x1d3')](_0x4306e4[_0xfbef('0x154')]*_0x44a6cc)-_0x4306e4[_0xfbef('0x83')];if(_0x4306e4['dialLimitQueue']>0x0){var _0x331aac=_0x4306e4[_0xfbef('0x21b')]-_0x4306e4[_0xfbef('0x83')]-_0x4306e4['talking']-_0x4306e4[_0xfbef('0x157')];if(_0x1b15b7>_0x331aac){_0x1b15b7=_0x331aac;}}if(_0x1b15b7>0x0&&_0x4306e4[_0xfbef('0x210')]==0x0){if(_0x4306e4[_0xfbef('0xb6')]===_0xfbef('0xba')){_0x1b15b7=0x1;}if(_0x1b15b7>this[_0xfbef('0x23')]){_0x1b15b7=this[_0xfbef('0x23')];}for(var _0x1d862a in this[_0xfbef('0x21')]){if(typeof this[_0xfbef('0x21')][_0x1d862a]!=='undefined'){if(this[_0xfbef('0x21')][_0x1d862a][_0xfbef('0x72')]==='not_inuse'&&this[_0xfbef('0x21')][_0x1d862a][_0xfbef('0x101')]===_0xfbef('0x8b')){_0x590fa9['push'](this[_0xfbef('0x21')][_0x1d862a]['id']);}}}_0x4306e4[_0xfbef('0x210')]=0x1;hopperUtils[_0xfbef('0x21c')](_0x4306e4,_0x590fa9,_0x1b15b7)[_0xfbef('0xa0')](function(_0x4f0047){_0x4306e4[_0xfbef('0x210')]=0x0;if(_0x4f0047){if(!utils[_0xfbef('0x212')](_0x4f0047)){hopperUtils['countReScheduled'](_0x4306e4)['then'](sendMessageReschedule(_0x4306e4))[_0xfbef('0xa4')](loggerCatch(_0xfbef('0x21d')));}else{_0x4306e4[_0xfbef('0x83')]+=_0x4f0047['length'];_0x4306e4[_0xfbef('0x70')]=_0x4306e4['dialMethod']==='booked'?utils[_0xfbef('0x6c')][_0xfbef('0x17e')]:utils['CAMPAIGN_STATUS'][_0xfbef('0x215')];for(var _0x1ebf12=0x0;_0x1ebf12<_0x4f0047['length'];_0x1ebf12+=0x1){if(_['isNil'](_0x4f0047[_0x1ebf12])||_[_0xfbef('0x105')](_0x4f0047[_0x1ebf12]['Contact'])||_[_0xfbef('0x105')](_0x4f0047[_0x1ebf12][_0xfbef('0x175')])){_0x1394a8[_0xfbef('0x216')](_0xfbef('0x217'),_0x4306e4,_0x4f0047[_0x1ebf12]);}else{hopperUtils['checkIsBlackList'](_[_0xfbef('0x78')](_0x4f0047[_0x1ebf12],[_0xfbef('0xeb'),'phone']))['then'](_0x1394a8[_0xfbef('0x1fb')](_0x4306e4,_0x4f0047[_0x1ebf12]))[_0xfbef('0xa4')](function(_0x178b9d){logger[_0xfbef('0x69')](_0xfbef('0x21e'),_0x178b9d);utils[_0xfbef('0xc8')](_0x4306e4,_0xfbef('0x21f'));});}}}}})[_0xfbef('0xa4')](function(_0x2fe597){_0x4306e4[_0xfbef('0x210')]=0x0;logger['error']('[getContactCampaign2]',_0x2fe597);});}};Dialer['prototype'][_0xfbef('0x67')]=function(_0x4e95ba){if(_0x4e95ba[_0xfbef('0x21b')]>0x0){var _0x490250=_0x4e95ba[_0xfbef('0x21b')]-_0x4e95ba[_0xfbef('0x83')]-_0x4e95ba[_0xfbef('0x156')];if(_0x490250>0x0&&_0x4e95ba[_0xfbef('0x210')]==0x0){this[_0xfbef('0x220')](_0x4e95ba);}else{loggerPredictiveCalls[_0xfbef('0x4c')](_0xfbef('0x221'));}}else{this[_0xfbef('0x220')](_0x4e95ba);}};Dialer[_0xfbef('0x8d')]['tryOriginatePredictive']=function(_0x2822e2){var _0x5ccefe=this;var _0x3cd258=[];_0x2822e2[_0xfbef('0x83')]+=0x1;for(var _0x48a66f in this[_0xfbef('0x21')]){if(typeof this[_0xfbef('0x21')][_0x48a66f]!==_0xfbef('0x222')){if(this[_0xfbef('0x21')][_0x48a66f][_0xfbef('0x72')]===_0xfbef('0x223')&&this[_0xfbef('0x21')][_0x48a66f][_0xfbef('0x101')]===_0xfbef('0x8b')){_0x3cd258[_0xfbef('0x9d')](this['agents'][_0x48a66f]['id']);}}}_0x2822e2['temp']=0x1;return this[_0xfbef('0x21c')](_0x2822e2['id'],_0x3cd258,0x1,_0x2822e2['dialOrderByScheduledAt'],_0x2822e2)[_0xfbef('0xa0')](function(_0x442ba8){_0x2822e2[_0xfbef('0x210')]=0x1;if(_0x442ba8){if(!utils[_0xfbef('0x212')](_0x442ba8)){utils[_0xfbef('0x224')](_0x2822e2,0x1,0x0);return hopperUtils[_0xfbef('0x225')](_0x2822e2)['then'](sendMessageReschedule(_0x2822e2))[_0xfbef('0xa4')](loggerCatch('[countReScheduled]\x20'));}else{_0x2822e2[_0xfbef('0x70')]=utils[_0xfbef('0x6c')][_0xfbef('0x215')];if(_[_0xfbef('0x105')](_0x442ba8[0x0])||_[_0xfbef('0x105')](_0x442ba8[0x0][_0xfbef('0x192')])||_[_0xfbef('0x105')](_0x442ba8[0x0][_0xfbef('0x175')])){_0x5ccefe[_0xfbef('0x216')](_0xfbef('0x217'),_0x2822e2,_0x442ba8[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xfbef('0x78')](_0x442ba8[0x0],[_0xfbef('0xeb'),_0xfbef('0x175')]))[_0xfbef('0xa0')](_0x5ccefe[_0xfbef('0x1fb')](_0x2822e2,_0x442ba8[0x0]))[_0xfbef('0xa4')](function(_0x55c351){logger[_0xfbef('0x69')]('[actionOriginatePredictive]',_0x55c351);utils[_0xfbef('0xc8')](_0x2822e2,_0xfbef('0x226'));});}}}})[_0xfbef('0xa4')](function(_0x48501a){_0x2822e2[_0xfbef('0x210')]=0x0;logger['error']('[getContactCampaign2]',_0x48501a);});};Dialer[_0xfbef('0x8d')][_0xfbef('0x1ed')]=function(_0x4822c5,_0x1e1da8,_0x1b511a,_0x313e7f,_0x51179e,_0x2706af){loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x227'));loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x228'),_0x4822c5);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x229'),_0x1e1da8);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x22a'),_0x1b511a);loggerPredictive['info'](_0xfbef('0x22b'),_0x313e7f);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x22c'),_0x51179e);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x56'));return new Promise(function(_0x4ea708,_0x285a0d){if(_0x4822c5<=0x0||isNaN(_0x4822c5)){return _0x285a0d(msgResponse('[abandonmentRate]','Error',_0xfbef('0x22d')+_0x4822c5));}if(_0x1b511a<=0x0||isNaN(_0x1b511a)){return _0x285a0d(msgResponse('[abandonmentRate]','Error',_0xfbef('0x22e')+_0x1b511a));}if(_0x313e7f<=0x0||isNaN(_0x313e7f)){return _0x285a0d(msgResponse(_0xfbef('0x22f'),'Error',_0xfbef('0x230')+_0x313e7f));}if(_0x1e1da8<=0x0||isNaN(_0x1e1da8)){return _0x285a0d(msgResponse(_0xfbef('0x22f'),'Error',_0xfbef('0x231')+_0x1e1da8));}if(_0x51179e<=0x0||isNaN(_0x51179e)){return _0x285a0d(msgResponse(_0xfbef('0x22f'),'Error',_0xfbef('0x232')+_0x51179e));}_0x2706af=_0x2706af||0x0;var _0x455537=0x1/_0x1b511a;var _0xd7bae8=0x0;var _0x28ba6c=0x0;var _0xe99387=0x0;var _0x37e5fa=0x0;for(var _0xbf12c4=0x0;_0xe99387<_0x51179e;_0xbf12c4+=0x1){_0x28ba6c=_0xbf12c4/_0x1e1da8;_0xd7bae8=(_0x313e7f*_0x28ba6c+_0x2706af)/_0x455537;_0xe99387=utils[_0xfbef('0x233')](_0xd7bae8,_0x4822c5);_0x37e5fa=_0xd7bae8/_0x4822c5*(0x1-utils[_0xfbef('0x233')](_0xd7bae8,_0x4822c5));}return _0x4ea708({'erlangCalls':_0xbf12c4,'erlangCallToSecond':_0x1e1da8/_0xbf12c4,'erlangAbandonmentRate':_0xe99387,'erlangBusyFactor':_0x37e5fa});});};Dialer['prototype'][_0xfbef('0x1ef')]=function(_0x5dfca8,_0x5ce7ac,_0x2a0ad4,_0x46e6db,_0x521dde,_0x4ed859){loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x234'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5dfca8);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x229'),_0x5ce7ac);loggerPredictive[_0xfbef('0x4c')]('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',_0x2a0ad4);loggerPredictive[_0xfbef('0x4c')]('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',_0x46e6db);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x235'),_0x521dde);loggerPredictive[_0xfbef('0x4c')](_0xfbef('0x56'));return new Promise(function(_0x598044,_0x275188){if(_0x5dfca8<=0x0||isNaN(_0x5dfca8)){return _0x275188(msgResponse(_0xfbef('0x236'),_0xfbef('0xc3'),'m\x20=\x20'+_0x5dfca8));}if(_0x2a0ad4<=0x0||isNaN(_0x2a0ad4)){return _0x275188(msgResponse(_0xfbef('0x236'),_0xfbef('0xc3'),_0xfbef('0x22e')+_0x2a0ad4));}if(_0x46e6db<=0x0||isNaN(_0x46e6db)){return _0x275188(msgResponse(_0xfbef('0x236'),'Error',_0xfbef('0x230')+_0x46e6db));}if(_0x5ce7ac<=0x0||isNaN(_0x5ce7ac)){return _0x275188(msgResponse('[busyFactor]','Error',_0xfbef('0x231')+_0x5ce7ac));}if(_0x521dde<=0x0||isNaN(_0x521dde)){return _0x275188(msgResponse(_0xfbef('0x236'),_0xfbef('0xc3'),_0xfbef('0x237')+_0x521dde));}_0x4ed859=_0x4ed859||0x0;var _0x43d39d=0x1/_0x2a0ad4;var _0x146ab5=0x0;var _0x18b1eb=0x0;var _0x42d595=0x0;var _0x16ea78=0x0;for(var _0x547393=0x0;_0x16ea78<_0x521dde;_0x547393+=0x1){_0x18b1eb=_0x547393/_0x5ce7ac;_0x146ab5=(_0x46e6db*_0x18b1eb+_0x4ed859)/_0x43d39d;_0x42d595=utils['erlangb'](_0x146ab5,_0x5dfca8);_0x16ea78=_0x146ab5/_0x5dfca8*(0x1-utils['erlangb'](_0x146ab5,_0x5dfca8));}return _0x598044({'erlangCalls':_0x547393,'erlangCallToSecond':_0x5ce7ac/_0x547393,'erlangAbandonmentRate':_0x42d595,'erlangBusyFactor':_0x16ea78});});};module[_0xfbef('0x238')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 01282c0..f465be8 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05b7=['number','queue','active','type','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','lastName'];(function(_0x126428,_0x36064f){var _0x4f8544=function(_0x38f987){while(--_0x38f987){_0x126428['push'](_0x126428['shift']());}};_0x4f8544(++_0x36064f);}(_0x05b7,0x1c3));var _0x705b=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x05b7[_0x2763f2];return _0x3ef471;};'use strict';var util=require(_0x705b('0x0'));var _=require(_0x705b('0x1'));var moment=require(_0x705b('0x2'));function checkNameSurname(_0x56b8fd,_0x42c613,_0x18da95){var _0xc8aa75='';if(!_['isNil'](_0x42c613)&&'string'===typeof _0x42c613){_0xc8aa75+=_0x42c613;}if(!_[_0x705b('0x3')](_0x18da95)&&_0x705b('0x4')===typeof _0x18da95){_0xc8aa75+='\x20'+_0x18da95;}if(_0xc8aa75!==''){return _0xc8aa75;}return _0x56b8fd;}function Action(_0x344092,_0x489be4,_0x1ed8bf){this[_0x705b('0x5')]=_0x344092;this[_0x705b('0x6')]=_0x1ed8bf||undefined;this[_0x705b('0x7')]=checkNameSurname(_0x489be4['Contact'][_0x705b('0x8')],_0x489be4[_0x705b('0x9')]['firstName'],_0x489be4['Contact'][_0x705b('0xa')]);this[_0x705b('0xb')]=_0x489be4[_0x705b('0x8')];this[_0x705b('0xc')]=_0x344092[_0x705b('0x7')];this['active']=_0x489be4[_0x705b('0xd')]||![];this[_0x705b('0xe')]=_0x344092['type'];this['dialQueueTimeout']=_0x344092['dialQueueTimeout']||0x3;this[_0x705b('0xf')]=_0x489be4['scheduledat'];this[_0x705b('0x10')]=_0x489be4[_0x705b('0x10')];this['countcongestionretry']=_0x489be4['countcongestionretry'];this[_0x705b('0x11')]=_0x489be4[_0x705b('0x11')];this['countnosuchnumberretry']=_0x489be4[_0x705b('0x12')];this[_0x705b('0x13')]=_0x489be4['countdropretry'];this[_0x705b('0x14')]=_0x489be4[_0x705b('0x14')];this['countmachineretry']=_0x489be4[_0x705b('0x15')];this['countagentrejectretry']=_0x489be4['countagentrejectretry'];this[_0x705b('0x16')]=_0x489be4[_0x705b('0x16')];this[_0x705b('0x17')]=_0x489be4[_0x705b('0x17')];this[_0x705b('0x18')]=_0x489be4['UserId'];this['VoiceQueueId']=_0x489be4[_0x705b('0x19')];this[_0x705b('0x1a')]=_0x489be4[_0x705b('0x1a')];this['idHopper']=_0x489be4['id'];this[_0x705b('0x1b')]=_0x489be4[_0x705b('0x9')][_0x705b('0x1c')]||'';this[_0x705b('0x1d')]=moment()[_0x705b('0x1e')](_0x705b('0x1f'));this[_0x705b('0x20')]=_0x489be4['callback'];this[_0x705b('0x21')]=_0x489be4[_0x705b('0x21')];this['callbackat']=_0x489be4[_0x705b('0x22')];this[_0x705b('0x23')]=_0x489be4[_0x705b('0x23')];this[_0x705b('0x24')]='';this['originatecalleridname']='';}Action[_0x705b('0x25')]['getCaller']=function(){return util['format'](_0x705b('0x26'),this[_0x705b('0x7')],this[_0x705b('0x5')][_0x705b('0x27')]>0x0?this[_0x705b('0xb')][_0x705b('0x28')](this[_0x705b('0x5')]['dialCutDigit']):this[_0x705b('0xb')]);};Action[_0x705b('0x25')]['getQueue']=function(){return this[_0x705b('0xc')];};module[_0x705b('0x29')]=Action; \ No newline at end of file +var _0xa9e0=['phone','firstName','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','prototype','getQueue','exports','util','lodash','moment','isNil','voiceQueue','uniqueid','Contact'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xa9e0,0x10d));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function checkNameSurname(_0x25b228,_0x5631da,_0x356de3){var _0x3f6e4b='';if(!_[_0x0a9e('0x3')](_0x5631da)&&'string'===typeof _0x5631da){_0x3f6e4b+=_0x5631da;}if(!_[_0x0a9e('0x3')](_0x356de3)&&'string'===typeof _0x356de3){_0x3f6e4b+='\x20'+_0x356de3;}if(_0x3f6e4b!==''){return _0x3f6e4b;}return _0x25b228;}function Action(_0x483484,_0x926db7,_0x1a1271){this[_0x0a9e('0x4')]=_0x483484;this[_0x0a9e('0x5')]=_0x1a1271||undefined;this['name']=checkNameSurname(_0x926db7[_0x0a9e('0x6')][_0x0a9e('0x7')],_0x926db7['Contact'][_0x0a9e('0x8')],_0x926db7['Contact'][_0x0a9e('0x9')]);this['number']=_0x926db7[_0x0a9e('0x7')];this[_0x0a9e('0xa')]=_0x483484[_0x0a9e('0xb')];this[_0x0a9e('0xc')]=_0x926db7[_0x0a9e('0xc')]||![];this[_0x0a9e('0xd')]=_0x483484[_0x0a9e('0xd')];this[_0x0a9e('0xe')]=_0x483484[_0x0a9e('0xe')]||0x3;this[_0x0a9e('0xf')]=_0x926db7['scheduledat'];this[_0x0a9e('0x10')]=_0x926db7[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x926db7[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x926db7[_0x0a9e('0x12')];this[_0x0a9e('0x13')]=_0x926db7[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x926db7['countdropretry'];this[_0x0a9e('0x15')]=_0x926db7[_0x0a9e('0x15')];this[_0x0a9e('0x16')]=_0x926db7[_0x0a9e('0x16')];this[_0x0a9e('0x17')]=_0x926db7[_0x0a9e('0x17')];this[_0x0a9e('0x18')]=_0x926db7[_0x0a9e('0x18')];this[_0x0a9e('0x19')]=_0x926db7['ListId'];this[_0x0a9e('0x1a')]=_0x926db7[_0x0a9e('0x1a')];this[_0x0a9e('0x1b')]=_0x926db7[_0x0a9e('0x1b')];this[_0x0a9e('0x1c')]=_0x926db7[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x926db7['id'];this['ContactFirstName']=_0x926db7[_0x0a9e('0x6')]['firstName']||'';this[_0x0a9e('0x1e')]=moment()['format'](_0x0a9e('0x1f'));this[_0x0a9e('0x20')]=_0x926db7['callback'];this[_0x0a9e('0x21')]=_0x926db7[_0x0a9e('0x21')];this[_0x0a9e('0x22')]=_0x926db7[_0x0a9e('0x22')];this['recallme']=_0x926db7[_0x0a9e('0x23')];this['originatecalleridnum']='';this[_0x0a9e('0x24')]='';}Action['prototype'][_0x0a9e('0x25')]=function(){return util[_0x0a9e('0x26')](_0x0a9e('0x27'),this[_0x0a9e('0xb')],this['voiceQueue'][_0x0a9e('0x28')]>0x0?this['number'][_0x0a9e('0x29')](this[_0x0a9e('0x4')][_0x0a9e('0x28')]):this[_0x0a9e('0x2a')]);};Action[_0x0a9e('0x2b')][_0x0a9e('0x2c')]=function(){return this[_0x0a9e('0xa')];};module[_0x0a9e('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 72352fc..d108789 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56e9=['state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x56e9,0x10c));var _0x956e=function(_0x16438a,_0x3544be){_0x16438a=_0x16438a-0x0;var _0x9d2e74=_0x56e9[_0x16438a];return _0x9d2e74;};'use strict';var moment=require(_0x956e('0x0'));var utils=require(_0x956e('0x1'));function AgentComplete(_0xe99a48,_0x46ca4c){this[_0x956e('0x2')]=0x4;this[_0x956e('0x3')]='Answer';this[_0x956e('0x4')]=_0xe99a48[_0x956e('0x4')];this['type']=_0xe99a48[_0x956e('0x5')];this[_0x956e('0x6')]=_0xe99a48[_0x956e('0x5')]===_0x956e('0x7')?_0x956e('0x8'):_0xe99a48[_0x956e('0x5')];this[_0x956e('0x9')]=_0xe99a48['countbusyretry'];this[_0x956e('0xa')]=_0xe99a48['countcongestionretry'];this['countnoanswerretry']=_0xe99a48[_0x956e('0xb')];this[_0x956e('0xc')]=_0xe99a48['countbusyretry']+_0xe99a48[_0x956e('0xa')]+_0xe99a48[_0x956e('0xb')]+_0xe99a48[_0x956e('0xd')]+_0xe99a48['countdropretry']+_0xe99a48[_0x956e('0xe')]+_0xe99a48['countmachineretry']+_0xe99a48[_0x956e('0xf')];this[_0x956e('0xd')]=_0xe99a48[_0x956e('0xd')];this['countdropretry']=_0xe99a48[_0x956e('0x10')];this[_0x956e('0xe')]=_0xe99a48[_0x956e('0xe')];this[_0x956e('0x11')]=_0xe99a48[_0x956e('0x11')];this[_0x956e('0xf')]=_0xe99a48[_0x956e('0xf')];this[_0x956e('0x12')]=_0x46ca4c['uniqueid'];this[_0x956e('0x13')]=_0xe99a48[_0x956e('0x14')];this[_0x956e('0x15')]=_0xe99a48[_0x956e('0x16')];this[_0x956e('0x17')]=_0xe99a48[_0x956e('0x17')];this[_0x956e('0x18')]=_0xe99a48[_0x956e('0x18')];this['answertime']=_0xe99a48[_0x956e('0x19')];this[_0x956e('0x1a')]=moment()['format'](_0x956e('0x1b'));this[_0x956e('0x1c')]=utils[_0x956e('0x1d')](_0xe99a48['responsetime'],_0xe99a48[_0x956e('0x17')]);this['holdtime']=utils[_0x956e('0x1d')](_0xe99a48[_0x956e('0x19')],_0xe99a48[_0x956e('0x18')]);this[_0x956e('0x1e')]=utils[_0x956e('0x1d')](this[_0x956e('0x1a')],_0xe99a48['answertime']);this['queue']=_0x46ca4c[_0x956e('0x8')];this[_0x956e('0x1f')]=_0x46ca4c[_0x956e('0x1f')];this[_0x956e('0x20')]=_0x46ca4c[_0x956e('0x20')];this['callback']=_0xe99a48['callback'];this[_0x956e('0x21')]=_0xe99a48[_0x956e('0x21')];this['callbackat']=_0xe99a48[_0x956e('0x22')];this['recallme']=_0xe99a48[_0x956e('0x23')];this[_0x956e('0x24')]=_0xe99a48[_0x956e('0x24')];this[_0x956e('0x25')]=_0xe99a48['ListId'];this[_0x956e('0x26')]=_0xe99a48[_0x956e('0x26')];this[_0x956e('0x27')]=_0xe99a48['VoiceQueueId'];this['CampaignId']=_0xe99a48[_0x956e('0x28')];this[_0x956e('0x29')]=_0xe99a48['originatecalleridnum']||'';this[_0x956e('0x2a')]=_0xe99a48[_0x956e('0x2a')]||'';this[_0x956e('0x2b')]=_0xe99a48[_0x956e('0x2b')];}module[_0x956e('0x2c')]=AgentComplete; \ No newline at end of file +var _0xbe3b=['countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x7d0b97,_0x2e5273){var _0x9d48e6=function(_0x9b36fe){while(--_0x9b36fe){_0x7d0b97['push'](_0x7d0b97['shift']());}};_0x9d48e6(++_0x2e5273);}(_0xbe3b,0x196));var _0xbbe3=function(_0x1900bd,_0x48a6b6){_0x1900bd=_0x1900bd-0x0;var _0x5c162e=_0xbe3b[_0x1900bd];return _0x5c162e;};'use strict';var moment=require(_0xbbe3('0x0'));var utils=require(_0xbbe3('0x1'));function AgentComplete(_0x9fb53f,_0x4917f3){this['state']=0x4;this[_0xbbe3('0x2')]='Answer';this[_0xbbe3('0x3')]=_0x9fb53f[_0xbbe3('0x3')];this['type']=_0x9fb53f[_0xbbe3('0x4')];this[_0xbbe3('0x5')]=_0x9fb53f[_0xbbe3('0x4')]===_0xbbe3('0x6')?_0xbbe3('0x7'):_0x9fb53f[_0xbbe3('0x4')];this[_0xbbe3('0x8')]=_0x9fb53f[_0xbbe3('0x8')];this['countcongestionretry']=_0x9fb53f[_0xbbe3('0x9')];this[_0xbbe3('0xa')]=_0x9fb53f[_0xbbe3('0xa')];this['countglobal']=_0x9fb53f['countbusyretry']+_0x9fb53f['countcongestionretry']+_0x9fb53f[_0xbbe3('0xa')]+_0x9fb53f[_0xbbe3('0xb')]+_0x9fb53f[_0xbbe3('0xc')]+_0x9fb53f[_0xbbe3('0xd')]+_0x9fb53f[_0xbbe3('0xe')]+_0x9fb53f[_0xbbe3('0xf')];this[_0xbbe3('0xb')]=_0x9fb53f['countnosuchnumberretry'];this[_0xbbe3('0xc')]=_0x9fb53f['countdropretry'];this[_0xbbe3('0xd')]=_0x9fb53f[_0xbbe3('0xd')];this[_0xbbe3('0xe')]=_0x9fb53f[_0xbbe3('0xe')];this[_0xbbe3('0xf')]=_0x9fb53f[_0xbbe3('0xf')];this[_0xbbe3('0x10')]=_0x4917f3['uniqueid'];this[_0xbbe3('0x11')]=_0x9fb53f[_0xbbe3('0x12')];this['calleridnum']=_0x9fb53f[_0xbbe3('0x13')];this[_0xbbe3('0x14')]=_0x9fb53f['starttime'];this['responsetime']=_0x9fb53f[_0xbbe3('0x15')];this[_0xbbe3('0x16')]=_0x9fb53f[_0xbbe3('0x16')];this[_0xbbe3('0x17')]=moment()[_0xbbe3('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0xbbe3('0x19')](_0x9fb53f['responsetime'],_0x9fb53f[_0xbbe3('0x14')]);this[_0xbbe3('0x1a')]=utils[_0xbbe3('0x19')](_0x9fb53f[_0xbbe3('0x16')],_0x9fb53f[_0xbbe3('0x15')]);this[_0xbbe3('0x1b')]=utils[_0xbbe3('0x19')](this['endtime'],_0x9fb53f[_0xbbe3('0x16')]);this[_0xbbe3('0x7')]=_0x4917f3[_0xbbe3('0x7')];this[_0xbbe3('0x1c')]=_0x4917f3[_0xbbe3('0x1c')];this[_0xbbe3('0x1d')]=_0x4917f3[_0xbbe3('0x1d')];this[_0xbbe3('0x1e')]=_0x9fb53f[_0xbbe3('0x1e')];this['callbackuniqueid']=_0x9fb53f[_0xbbe3('0x1f')];this[_0xbbe3('0x20')]=_0x9fb53f[_0xbbe3('0x20')];this[_0xbbe3('0x21')]=_0x9fb53f[_0xbbe3('0x21')];this[_0xbbe3('0x22')]=_0x9fb53f[_0xbbe3('0x22')];this[_0xbbe3('0x23')]=_0x9fb53f[_0xbbe3('0x23')];this[_0xbbe3('0x24')]=_0x9fb53f[_0xbbe3('0x24')];this[_0xbbe3('0x25')]=_0x9fb53f[_0xbbe3('0x25')];this[_0xbbe3('0x26')]=_0x9fb53f[_0xbbe3('0x26')];this[_0xbbe3('0x27')]=_0x9fb53f[_0xbbe3('0x27')]||'';this[_0xbbe3('0x28')]=_0x9fb53f['originatecalleridname']||'';this[_0xbbe3('0x29')]=_0x9fb53f[_0xbbe3('0x29')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index c0233b0..c197156 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4559=['scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid'];(function(_0x2c10b8,_0x5ed5a3){var _0x2a58f8=function(_0x1be8c0){while(--_0x1be8c0){_0x2c10b8['push'](_0x2c10b8['shift']());}};_0x2a58f8(++_0x5ed5a3);}(_0x4559,0x13a));var _0x9455=function(_0x2f0f28,_0x37df9c){_0x2f0f28=_0x2f0f28-0x0;var _0x13b38e=_0x4559[_0x2f0f28];return _0x13b38e;};'use strict';function Final(_0x56a3b3){this[_0x9455('0x0')]=_0x56a3b3[_0x9455('0x0')];this[_0x9455('0x1')]=_0x56a3b3['scheduledat'];this['type']=_0x56a3b3[_0x9455('0x2')];this['campaigntype']=_0x56a3b3[_0x9455('0x2')]===_0x9455('0x3')?_0x9455('0x4'):_0x56a3b3[_0x9455('0x2')];this[_0x9455('0x5')]=_0x56a3b3['countbusyretry'];this[_0x9455('0x6')]=_0x56a3b3[_0x9455('0x6')];this[_0x9455('0x7')]=_0x56a3b3[_0x9455('0x7')];this[_0x9455('0x8')]=_0x56a3b3[_0x9455('0x5')]+_0x56a3b3[_0x9455('0x6')]+_0x56a3b3[_0x9455('0x7')]+_0x56a3b3[_0x9455('0x9')]+_0x56a3b3['countdropretry']+_0x56a3b3[_0x9455('0xa')]+_0x56a3b3[_0x9455('0xb')]+_0x56a3b3['countagentrejectretry'];this['countnosuchnumberretry']=_0x56a3b3[_0x9455('0x9')];this[_0x9455('0xc')]=_0x56a3b3[_0x9455('0xc')];this[_0x9455('0xa')]=_0x56a3b3[_0x9455('0xa')];this['countmachineretry']=_0x56a3b3[_0x9455('0xb')];this[_0x9455('0xd')]=_0x56a3b3[_0x9455('0xd')];this[_0x9455('0x4')]=_0x56a3b3[_0x9455('0x4')];this['calleridname']=_0x56a3b3[_0x9455('0xe')];this['calleridnum']=_0x56a3b3[_0x9455('0xf')];this['starttime']=_0x56a3b3[_0x9455('0x10')];this['responsetime']=_0x56a3b3[_0x9455('0x11')];this[_0x9455('0x12')]=_0x56a3b3['responsetime'];this[_0x9455('0x13')]=_0x56a3b3[_0x9455('0x13')]||0x0;this[_0x9455('0x14')]=_0x56a3b3[_0x9455('0x14')]||0x0;this[_0x9455('0x15')]=_0x56a3b3[_0x9455('0x15')]||0x0;this[_0x9455('0x16')]=_0x56a3b3['callback'];this[_0x9455('0x17')]=_0x56a3b3[_0x9455('0x17')];this[_0x9455('0x18')]=_0x56a3b3[_0x9455('0x18')];this['recallme']=_0x56a3b3[_0x9455('0x19')];this['ContactId']=_0x56a3b3[_0x9455('0x1a')];this['ListId']=_0x56a3b3[_0x9455('0x1b')];this[_0x9455('0x1c')]=_0x56a3b3[_0x9455('0x1c')];this['VoiceQueueId']=_0x56a3b3[_0x9455('0x1d')];this[_0x9455('0x1e')]=_0x56a3b3['CampaignId'];this['originatecalleridnum']=_0x56a3b3['originatecalleridnum']||'';this[_0x9455('0x1f')]=_0x56a3b3['originatecalleridname']||'';this['state']=_0x56a3b3[_0x9455('0x20')];this['statedesc']=_0x56a3b3[_0x9455('0x21')];}module[_0x9455('0x22')]=Final; \ No newline at end of file +var _0x6a90=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x27eb3e,_0x8c3e94){var _0xc7a94=function(_0x44138c){while(--_0x44138c){_0x27eb3e['push'](_0x27eb3e['shift']());}};_0xc7a94(++_0x8c3e94);}(_0x6a90,0x1f0));var _0x06a9=function(_0x1544aa,_0x1e8576){_0x1544aa=_0x1544aa-0x0;var _0x557926=_0x6a90[_0x1544aa];return _0x557926;};'use strict';function Final(_0x162f75){this[_0x06a9('0x0')]=_0x162f75[_0x06a9('0x0')];this[_0x06a9('0x1')]=_0x162f75[_0x06a9('0x1')];this[_0x06a9('0x2')]=_0x162f75[_0x06a9('0x2')];this[_0x06a9('0x3')]=_0x162f75[_0x06a9('0x2')]==='outbound'?_0x06a9('0x4'):_0x162f75['type'];this[_0x06a9('0x5')]=_0x162f75[_0x06a9('0x5')];this[_0x06a9('0x6')]=_0x162f75[_0x06a9('0x6')];this[_0x06a9('0x7')]=_0x162f75[_0x06a9('0x7')];this['countglobal']=_0x162f75['countbusyretry']+_0x162f75[_0x06a9('0x6')]+_0x162f75[_0x06a9('0x7')]+_0x162f75['countnosuchnumberretry']+_0x162f75[_0x06a9('0x8')]+_0x162f75['countabandonedretry']+_0x162f75[_0x06a9('0x9')]+_0x162f75[_0x06a9('0xa')];this[_0x06a9('0xb')]=_0x162f75['countnosuchnumberretry'];this[_0x06a9('0x8')]=_0x162f75['countdropretry'];this[_0x06a9('0xc')]=_0x162f75[_0x06a9('0xc')];this[_0x06a9('0x9')]=_0x162f75['countmachineretry'];this['countagentrejectretry']=_0x162f75['countagentrejectretry'];this['queue']=_0x162f75[_0x06a9('0x4')];this['calleridname']=_0x162f75[_0x06a9('0xd')];this[_0x06a9('0xe')]=_0x162f75['calleridnum'];this[_0x06a9('0xf')]=_0x162f75[_0x06a9('0xf')];this[_0x06a9('0x10')]=_0x162f75['responsetime'];this[_0x06a9('0x11')]=_0x162f75[_0x06a9('0x10')];this[_0x06a9('0x12')]=_0x162f75[_0x06a9('0x12')]||0x0;this[_0x06a9('0x13')]=_0x162f75['holdtime']||0x0;this[_0x06a9('0x14')]=_0x162f75[_0x06a9('0x14')]||0x0;this[_0x06a9('0x15')]=_0x162f75['callback'];this[_0x06a9('0x16')]=_0x162f75[_0x06a9('0x16')];this[_0x06a9('0x17')]=_0x162f75[_0x06a9('0x17')];this['recallme']=_0x162f75[_0x06a9('0x18')];this[_0x06a9('0x19')]=_0x162f75[_0x06a9('0x19')];this['ListId']=_0x162f75[_0x06a9('0x1a')];this[_0x06a9('0x1b')]=_0x162f75[_0x06a9('0x1b')];this['VoiceQueueId']=_0x162f75[_0x06a9('0x1c')];this[_0x06a9('0x1d')]=_0x162f75['CampaignId'];this[_0x06a9('0x1e')]=_0x162f75[_0x06a9('0x1e')]||'';this[_0x06a9('0x1f')]=_0x162f75['originatecalleridname']||'';this[_0x06a9('0x20')]=_0x162f75[_0x06a9('0x20')];this[_0x06a9('0x21')]=_0x162f75[_0x06a9('0x21')];}module[_0x06a9('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 56e6e90..f48eb3a 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe905=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','talktime','membername','IVR'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xe905,0x147));var _0x5e90=function(_0x476ccf,_0x5cd3cf){_0x476ccf=_0x476ccf-0x0;var _0x223814=_0xe905[_0x476ccf];return _0x223814;};'use strict';var moment=require(_0x5e90('0x0'));var utils=require(_0x5e90('0x1'));function Hangup(_0x597595,_0x5c83fd){this['state']=0x4;this[_0x5e90('0x2')]='Answer';this[_0x5e90('0x3')]=_0x597595[_0x5e90('0x3')];this[_0x5e90('0x4')]=_0x597595[_0x5e90('0x4')];this[_0x5e90('0x5')]=_0x597595[_0x5e90('0x4')]===_0x5e90('0x6')?_0x5e90('0x7'):_0x597595[_0x5e90('0x4')];this[_0x5e90('0x8')]=_0x597595[_0x5e90('0x8')]||![];this[_0x5e90('0x9')]=_0x597595[_0x5e90('0x9')];this[_0x5e90('0xa')]=_0x597595[_0x5e90('0xa')];this[_0x5e90('0xb')]=_0x597595[_0x5e90('0xb')];this[_0x5e90('0xc')]=_0x597595[_0x5e90('0x9')]+_0x597595[_0x5e90('0xa')]+_0x597595[_0x5e90('0xb')]+_0x597595[_0x5e90('0xd')]+_0x597595[_0x5e90('0xe')]+_0x597595[_0x5e90('0xf')]+_0x597595[_0x5e90('0x10')]+_0x597595[_0x5e90('0x11')];this['countnosuchnumberretry']=_0x597595['countnosuchnumberretry'];this['countdropretry']=_0x597595[_0x5e90('0xe')];this[_0x5e90('0xf')]=_0x597595[_0x5e90('0xf')];this[_0x5e90('0x10')]=_0x597595['countmachineretry'];this[_0x5e90('0x11')]=_0x597595['countagentrejectretry'];this['uniqueid']=_0x5c83fd[_0x5e90('0x12')];this[_0x5e90('0x13')]=_0x597595[_0x5e90('0x14')];this[_0x5e90('0x15')]=_0x597595[_0x5e90('0x16')];this[_0x5e90('0x17')]=_0x597595['starttime'];this[_0x5e90('0x18')]=_0x597595[_0x5e90('0x18')];this[_0x5e90('0x19')]=moment()[_0x5e90('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5e90('0x1b')]=utils[_0x5e90('0x1c')](_0x597595[_0x5e90('0x18')],_0x597595[_0x5e90('0x17')]);this[_0x5e90('0x1d')]=0x0;this[_0x5e90('0x1e')]=utils[_0x5e90('0x1c')](this[_0x5e90('0x19')],_0x597595[_0x5e90('0x18')]);this[_0x5e90('0x7')]=_0x597595[_0x5e90('0x7')];this[_0x5e90('0x1f')]=_0x5e90('0x20');this[_0x5e90('0x21')]=_0x5c83fd[_0x5e90('0x22')];this[_0x5e90('0x23')]=_0x597595[_0x5e90('0x23')];this[_0x5e90('0x24')]=_0x597595[_0x5e90('0x24')];this['callbackat']=_0x597595[_0x5e90('0x25')];this[_0x5e90('0x26')]=_0x597595[_0x5e90('0x26')];this[_0x5e90('0x27')]=_0x597595[_0x5e90('0x27')];this['ListId']=_0x597595[_0x5e90('0x28')];this[_0x5e90('0x29')]=_0x597595[_0x5e90('0x29')];this[_0x5e90('0x2a')]=_0x597595[_0x5e90('0x2a')];this[_0x5e90('0x2b')]=_0x597595['CampaignId'];}module[_0x5e90('0x2c')]=Hangup; \ No newline at end of file +var _0xf836=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5e0e26,_0x1bdd5d){var _0x44af9c=function(_0x337801){while(--_0x337801){_0x5e0e26['push'](_0x5e0e26['shift']());}};_0x44af9c(++_0x1bdd5d);}(_0xf836,0x197));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x6f83('0x0'));var utils=require('../utils');function Hangup(_0x259f77,_0x4b4d67){this[_0x6f83('0x1')]=0x4;this[_0x6f83('0x2')]=_0x6f83('0x3');this[_0x6f83('0x4')]=_0x259f77['scheduledat'];this['type']=_0x259f77[_0x6f83('0x5')];this[_0x6f83('0x6')]=_0x259f77[_0x6f83('0x5')]===_0x6f83('0x7')?_0x6f83('0x8'):_0x259f77[_0x6f83('0x5')];this['amd']=_0x259f77[_0x6f83('0x9')]||![];this['countbusyretry']=_0x259f77[_0x6f83('0xa')];this[_0x6f83('0xb')]=_0x259f77[_0x6f83('0xb')];this['countnoanswerretry']=_0x259f77[_0x6f83('0xc')];this['countglobal']=_0x259f77[_0x6f83('0xa')]+_0x259f77['countcongestionretry']+_0x259f77[_0x6f83('0xc')]+_0x259f77[_0x6f83('0xd')]+_0x259f77[_0x6f83('0xe')]+_0x259f77['countabandonedretry']+_0x259f77[_0x6f83('0xf')]+_0x259f77[_0x6f83('0x10')];this[_0x6f83('0xd')]=_0x259f77['countnosuchnumberretry'];this[_0x6f83('0xe')]=_0x259f77[_0x6f83('0xe')];this['countabandonedretry']=_0x259f77[_0x6f83('0x11')];this[_0x6f83('0xf')]=_0x259f77[_0x6f83('0xf')];this[_0x6f83('0x10')]=_0x259f77[_0x6f83('0x10')];this[_0x6f83('0x12')]=_0x4b4d67[_0x6f83('0x12')];this['calleridname']=_0x259f77['name'];this[_0x6f83('0x13')]=_0x259f77[_0x6f83('0x14')];this[_0x6f83('0x15')]=_0x259f77[_0x6f83('0x15')];this[_0x6f83('0x16')]=_0x259f77[_0x6f83('0x16')];this[_0x6f83('0x17')]=moment()[_0x6f83('0x18')](_0x6f83('0x19'));this[_0x6f83('0x1a')]=utils[_0x6f83('0x1b')](_0x259f77[_0x6f83('0x16')],_0x259f77['starttime']);this['holdtime']=0x0;this[_0x6f83('0x1c')]=utils['getSeconds'](this[_0x6f83('0x17')],_0x259f77['responsetime']);this[_0x6f83('0x8')]=_0x259f77['queue'];this['membername']=_0x6f83('0x1d');this[_0x6f83('0x1e')]=_0x4b4d67[_0x6f83('0x1f')];this['callback']=_0x259f77[_0x6f83('0x20')];this[_0x6f83('0x21')]=_0x259f77[_0x6f83('0x21')];this['callbackat']=_0x259f77[_0x6f83('0x22')];this['recallme']=_0x259f77[_0x6f83('0x23')];this[_0x6f83('0x24')]=_0x259f77[_0x6f83('0x24')];this[_0x6f83('0x25')]=_0x259f77[_0x6f83('0x25')];this[_0x6f83('0x26')]=_0x259f77[_0x6f83('0x26')];this[_0x6f83('0x27')]=_0x259f77[_0x6f83('0x27')];this[_0x6f83('0x28')]=_0x259f77[_0x6f83('0x28')];}module[_0x6f83('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index bd5b8e7..8bf110b 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa846=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','endtime','getSeconds','holdtime'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0xa846,0x183));var _0x6a84=function(_0x244e2d,_0x302d40){_0x244e2d=_0x244e2d-0x0;var _0x3df084=_0xa846[_0x244e2d];return _0x3df084;};'use strict';var utils=require('../utils');function History(_0xf5eda8){this['uniqueid']=_0xf5eda8[_0x6a84('0x0')];this['scheduledat']=_0xf5eda8[_0x6a84('0x1')]||undefined;this[_0x6a84('0x2')]=_0xf5eda8['type'];this[_0x6a84('0x3')]=_0xf5eda8[_0x6a84('0x2')]===_0x6a84('0x4')?_0x6a84('0x5'):_0xf5eda8[_0x6a84('0x2')];this['countbusyretry']=_0xf5eda8['countbusyretry'];this['countcongestionretry']=_0xf5eda8['countcongestionretry'];this[_0x6a84('0x6')]=_0xf5eda8[_0x6a84('0x6')];this[_0x6a84('0x7')]=_0xf5eda8['countbusyretry']+_0xf5eda8[_0x6a84('0x8')]+_0xf5eda8[_0x6a84('0x6')]+_0xf5eda8[_0x6a84('0x9')]+_0xf5eda8[_0x6a84('0xa')]+_0xf5eda8[_0x6a84('0xb')]+_0xf5eda8[_0x6a84('0xc')]+_0xf5eda8['countagentrejectretry'];this[_0x6a84('0x9')]=_0xf5eda8[_0x6a84('0x9')];this[_0x6a84('0xa')]=_0xf5eda8[_0x6a84('0xa')];this[_0x6a84('0xb')]=_0xf5eda8['countabandonedretry'];this[_0x6a84('0xc')]=_0xf5eda8['countmachineretry'];this['countagentrejectretry']=_0xf5eda8[_0x6a84('0xd')];this['queue']=_0xf5eda8[_0x6a84('0x5')];this[_0x6a84('0xe')]=_0xf5eda8['name'];this['calleridnum']=_0xf5eda8[_0x6a84('0xf')];this['starttime']=_0xf5eda8[_0x6a84('0x10')];this[_0x6a84('0x11')]=_0xf5eda8[_0x6a84('0x11')];this[_0x6a84('0x12')]=_0xf5eda8['responsetime'];this['ringtime']=utils[_0x6a84('0x13')](_0xf5eda8[_0x6a84('0x11')],_0xf5eda8[_0x6a84('0x10')]);this[_0x6a84('0x14')]=0x0;this['talktime']=0x0;this[_0x6a84('0x15')]=_0xf5eda8[_0x6a84('0x15')];this[_0x6a84('0x16')]=_0xf5eda8[_0x6a84('0x16')];this[_0x6a84('0x17')]=_0xf5eda8[_0x6a84('0x17')];this[_0x6a84('0x18')]=_0xf5eda8[_0x6a84('0x18')];this[_0x6a84('0x19')]=_0xf5eda8[_0x6a84('0x19')];this[_0x6a84('0x1a')]=_0xf5eda8[_0x6a84('0x1a')];this[_0x6a84('0x1b')]=_0xf5eda8[_0x6a84('0x1b')];this['VoiceQueueId']=_0xf5eda8['VoiceQueueId'];this[_0x6a84('0x1c')]=_0xf5eda8[_0x6a84('0x1c')];this[_0x6a84('0x1d')]=_0xf5eda8[_0x6a84('0x1d')]||'';this[_0x6a84('0x1e')]=_0xf5eda8[_0x6a84('0x1e')]||'';this[_0x6a84('0x1f')]=_0xf5eda8[_0x6a84('0x1f')];this[_0x6a84('0x20')]=_0xf5eda8[_0x6a84('0x20')];}module[_0x6a84('0x21')]=History; \ No newline at end of file +var _0xd15b=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','endtime','getSeconds','holdtime'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xd15b,0x1e2));var _0xbd15=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd15b[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0xbd15('0x0'));function History(_0x5c69fb){this['uniqueid']=_0x5c69fb[_0xbd15('0x1')];this['scheduledat']=_0x5c69fb[_0xbd15('0x2')]||undefined;this[_0xbd15('0x3')]=_0x5c69fb[_0xbd15('0x3')];this[_0xbd15('0x4')]=_0x5c69fb[_0xbd15('0x3')]===_0xbd15('0x5')?_0xbd15('0x6'):_0x5c69fb[_0xbd15('0x3')];this['countbusyretry']=_0x5c69fb[_0xbd15('0x7')];this[_0xbd15('0x8')]=_0x5c69fb[_0xbd15('0x8')];this[_0xbd15('0x9')]=_0x5c69fb[_0xbd15('0x9')];this[_0xbd15('0xa')]=_0x5c69fb['countbusyretry']+_0x5c69fb[_0xbd15('0x8')]+_0x5c69fb['countnoanswerretry']+_0x5c69fb[_0xbd15('0xb')]+_0x5c69fb[_0xbd15('0xc')]+_0x5c69fb['countabandonedretry']+_0x5c69fb[_0xbd15('0xd')]+_0x5c69fb[_0xbd15('0xe')];this[_0xbd15('0xb')]=_0x5c69fb[_0xbd15('0xb')];this[_0xbd15('0xc')]=_0x5c69fb['countdropretry'];this['countabandonedretry']=_0x5c69fb['countabandonedretry'];this['countmachineretry']=_0x5c69fb[_0xbd15('0xd')];this[_0xbd15('0xe')]=_0x5c69fb[_0xbd15('0xe')];this[_0xbd15('0x6')]=_0x5c69fb[_0xbd15('0x6')];this[_0xbd15('0xf')]=_0x5c69fb[_0xbd15('0x10')];this[_0xbd15('0x11')]=_0x5c69fb['number'];this[_0xbd15('0x12')]=_0x5c69fb[_0xbd15('0x12')];this['responsetime']=_0x5c69fb['responsetime'];this[_0xbd15('0x13')]=_0x5c69fb['responsetime'];this['ringtime']=utils[_0xbd15('0x14')](_0x5c69fb['responsetime'],_0x5c69fb[_0xbd15('0x12')]);this[_0xbd15('0x15')]=0x0;this[_0xbd15('0x16')]=0x0;this[_0xbd15('0x17')]=_0x5c69fb[_0xbd15('0x17')];this[_0xbd15('0x18')]=_0x5c69fb['callbackuniqueid'];this[_0xbd15('0x19')]=_0x5c69fb[_0xbd15('0x19')];this[_0xbd15('0x1a')]=_0x5c69fb[_0xbd15('0x1a')];this[_0xbd15('0x1b')]=_0x5c69fb[_0xbd15('0x1b')];this[_0xbd15('0x1c')]=_0x5c69fb[_0xbd15('0x1c')];this[_0xbd15('0x1d')]=_0x5c69fb[_0xbd15('0x1d')];this[_0xbd15('0x1e')]=_0x5c69fb['VoiceQueueId'];this[_0xbd15('0x1f')]=_0x5c69fb['CampaignId'];this[_0xbd15('0x20')]=_0x5c69fb[_0xbd15('0x20')]||'';this['originatecalleridname']=_0x5c69fb[_0xbd15('0x21')]||'';this[_0xbd15('0x22')]=_0x5c69fb['state'];this[_0xbd15('0x23')]=_0x5c69fb[_0xbd15('0x23')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index bf406b7..df2c819 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66d8=['originatecalleridname','agiafterat','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x66d8,0x1a8));var _0x866d=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x66d8[_0x529f1c];return _0x4d57ab;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1c4921,_0xcde37d){this['scheduledat']=_0x1c4921[_0x866d('0x0')];this[_0x866d('0x1')]=_0x1c4921['type'];this[_0x866d('0x2')]=_0x1c4921[_0x866d('0x1')]==='outbound'?'queue':_0x1c4921[_0x866d('0x1')];this[_0x866d('0x3')]=_0x1c4921[_0x866d('0x3')];this[_0x866d('0x4')]=_0x1c4921[_0x866d('0x4')];this['countnoanswerretry']=_0x1c4921[_0x866d('0x5')];this[_0x866d('0x6')]=_0x1c4921['countbusyretry']+_0x1c4921[_0x866d('0x4')]+_0x1c4921[_0x866d('0x5')]+_0x1c4921[_0x866d('0x7')]+_0x1c4921[_0x866d('0x8')]+_0x1c4921[_0x866d('0x9')]+_0x1c4921[_0x866d('0xa')]+_0x1c4921[_0x866d('0xb')];this['countnosuchnumberretry']=_0x1c4921[_0x866d('0x7')];this['countdropretry']=_0x1c4921['countdropretry'];this[_0x866d('0x9')]=_0x1c4921[_0x866d('0x9')];this[_0x866d('0xa')]=_0x1c4921[_0x866d('0xa')];this[_0x866d('0xb')]=_0x1c4921[_0x866d('0xb')];this['uniqueid']=_0xcde37d[_0x866d('0xc')];this[_0x866d('0xd')]=_0x1c4921[_0x866d('0xe')];this[_0x866d('0xf')]=_0x1c4921[_0x866d('0x10')];this[_0x866d('0x11')]=_0x1c4921[_0x866d('0x11')];this['responsetime']=_0x1c4921[_0x866d('0x12')];this[_0x866d('0x13')]=_0x1c4921[_0x866d('0x13')];this[_0x866d('0x14')]=_0x1c4921[_0x866d('0x14')];this[_0x866d('0x15')]=this['droptime'];this[_0x866d('0x16')]=utils['getSeconds'](_0x1c4921[_0x866d('0x12')],_0x1c4921[_0x866d('0x11')]);this[_0x866d('0x17')]=utils[_0x866d('0x18')](this['droptime'],_0x1c4921['responsetime']);this['talktime']=0x0;this[_0x866d('0x19')]=_0xcde37d[_0x866d('0x19')];this[_0x866d('0x1a')]=_0xcde37d[_0x866d('0x1b')];this[_0x866d('0x1c')]=_0xcde37d[_0x866d('0x1c')];this[_0x866d('0x1d')]=_0x1c4921[_0x866d('0x1d')];this[_0x866d('0x1e')]=_0x1c4921[_0x866d('0x1e')];this[_0x866d('0x1f')]=_0x1c4921[_0x866d('0x1f')];this[_0x866d('0x20')]=_0x1c4921[_0x866d('0x20')];this['ContactId']=_0x1c4921['ContactId'];this[_0x866d('0x21')]=_0x1c4921[_0x866d('0x21')];this[_0x866d('0x22')]=_0x1c4921[_0x866d('0x22')];this[_0x866d('0x23')]=_0x1c4921[_0x866d('0x23')];this[_0x866d('0x24')]=_0x1c4921[_0x866d('0x24')];this[_0x866d('0x25')]=_0x1c4921[_0x866d('0x25')]||'';this[_0x866d('0x26')]=_0x1c4921[_0x866d('0x26')]||'';this[_0x866d('0x27')]=_0x1c4921[_0x866d('0x27')];this[_0x866d('0x28')]=_0x1c4921['state'];this[_0x866d('0x29')]=_0x1c4921[_0x866d('0x29')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x7ce8=['getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime'];(function(_0x8641a2,_0x4980f8){var _0x51b2c9=function(_0x1554dc){while(--_0x1554dc){_0x8641a2['push'](_0x8641a2['shift']());}};_0x51b2c9(++_0x4980f8);}(_0x7ce8,0xec));var _0x87ce=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x7ce8[_0x12b683];return _0xfb150b;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x547c75,_0xbb4ac3){this[_0x87ce('0x0')]=_0x547c75[_0x87ce('0x0')];this[_0x87ce('0x1')]=_0x547c75[_0x87ce('0x1')];this['campaigntype']=_0x547c75[_0x87ce('0x1')]===_0x87ce('0x2')?'queue':_0x547c75[_0x87ce('0x1')];this[_0x87ce('0x3')]=_0x547c75[_0x87ce('0x3')];this[_0x87ce('0x4')]=_0x547c75[_0x87ce('0x4')];this[_0x87ce('0x5')]=_0x547c75['countnoanswerretry'];this[_0x87ce('0x6')]=_0x547c75['countbusyretry']+_0x547c75[_0x87ce('0x4')]+_0x547c75[_0x87ce('0x5')]+_0x547c75['countnosuchnumberretry']+_0x547c75[_0x87ce('0x7')]+_0x547c75[_0x87ce('0x8')]+_0x547c75[_0x87ce('0x9')]+_0x547c75['countagentrejectretry'];this[_0x87ce('0xa')]=_0x547c75[_0x87ce('0xa')];this[_0x87ce('0x7')]=_0x547c75[_0x87ce('0x7')];this['countabandonedretry']=_0x547c75['countabandonedretry'];this[_0x87ce('0x9')]=_0x547c75['countmachineretry'];this[_0x87ce('0xb')]=_0x547c75['countagentrejectretry'];this[_0x87ce('0xc')]=_0xbb4ac3[_0x87ce('0xc')];this[_0x87ce('0xd')]=_0x547c75['name'];this[_0x87ce('0xe')]=_0x547c75[_0x87ce('0xf')];this[_0x87ce('0x10')]=_0x547c75['starttime'];this[_0x87ce('0x11')]=_0x547c75[_0x87ce('0x11')];this[_0x87ce('0x12')]=_0x547c75[_0x87ce('0x12')];this[_0x87ce('0x13')]=_0x547c75['dropreason'];this[_0x87ce('0x14')]=this[_0x87ce('0x12')];this[_0x87ce('0x15')]=utils[_0x87ce('0x16')](_0x547c75['responsetime'],_0x547c75[_0x87ce('0x10')]);this[_0x87ce('0x17')]=utils[_0x87ce('0x16')](this['droptime'],_0x547c75[_0x87ce('0x11')]);this[_0x87ce('0x18')]=0x0;this[_0x87ce('0x19')]=_0xbb4ac3[_0x87ce('0x19')];this[_0x87ce('0x1a')]=_0xbb4ac3['connectedlinename'];this[_0x87ce('0x1b')]=_0xbb4ac3[_0x87ce('0x1b')];this[_0x87ce('0x1c')]=_0x547c75[_0x87ce('0x1c')];this[_0x87ce('0x1d')]=_0x547c75[_0x87ce('0x1d')];this[_0x87ce('0x1e')]=_0x547c75[_0x87ce('0x1e')];this[_0x87ce('0x1f')]=_0x547c75[_0x87ce('0x1f')];this[_0x87ce('0x20')]=_0x547c75['ContactId'];this['ListId']=_0x547c75[_0x87ce('0x21')];this[_0x87ce('0x22')]=_0x547c75[_0x87ce('0x22')];this['VoiceQueueId']=_0x547c75[_0x87ce('0x23')];this['CampaignId']=_0x547c75[_0x87ce('0x24')];this[_0x87ce('0x25')]=_0x547c75[_0x87ce('0x25')]||'';this[_0x87ce('0x26')]=_0x547c75[_0x87ce('0x26')]||'';this[_0x87ce('0x27')]=_0x547c75['agiafterat'];this[_0x87ce('0x28')]=_0x547c75[_0x87ce('0x28')];this['statedesc']=_0x547c75[_0x87ce('0x29')];}module[_0x87ce('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 844a898..a0822f5 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6455=['[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x3a5460,_0x5c3b2d){var _0x480711=function(_0x97c56f){while(--_0x97c56f){_0x3a5460['push'](_0x3a5460['shift']());}};_0x480711(++_0x5c3b2d);}(_0x6455,0x97));var _0x5645=function(_0x117982,_0x20fb5e){_0x117982=_0x117982-0x0;var _0x2cbe41=_0x6455[_0x117982];return _0x2cbe41;};'use strict';var util=require(_0x5645('0x0'));var logger=require('../../../../config/logger')(_0x5645('0x1'));var cmHopper=require(_0x5645('0x2'));var cmHopperAdditionalPhone=require(_0x5645('0x3'));var cmHopperBlack=require(_0x5645('0x4'));var cmHopperHistory=require(_0x5645('0x5'));function inspectError(_0x35c21e){return util['inspect'](_0x35c21e,{'showHidden':![],'depth':null});}function getContactDialer(_0x233875,_0x29cefe,_0x282ef3){return cmHopper[_0x5645('0x6')](_0x233875['id'],_0x29cefe,_0x282ef3,_0x233875[_0x5645('0x7')])[_0x5645('0x8')](function(_0xa14a06){_0x233875[_0x5645('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0xa14a06));});}exports[_0x5645('0x6')]=getContactDialer;function getContactDialerIvr(_0x37c03a,_0x38c07a){return cmHopper[_0x5645('0xa')](_0x37c03a['id'],_0x38c07a,_0x37c03a[_0x5645('0x7')])[_0x5645('0x8')](function(_0x587c61){_0x37c03a[_0x5645('0x9')]=0x0;logger[_0x5645('0xb')](_0x5645('0xc'),inspectError(_0x587c61));});}exports[_0x5645('0xa')]=getContactDialerIvr;function countReScheduled(_0x5a6092){return cmHopper[_0x5645('0xd')](_0x5a6092)['catch'](function(_0x42f5cd){logger[_0x5645('0xb')](_0x5645('0xe'),inspectError(_0x42f5cd));});}exports[_0x5645('0xd')]=countReScheduled;function rescheduleContact(_0x2d982f){return cmHopper[_0x5645('0xf')](_0x2d982f)[_0x5645('0x8')](function(_0x2270a1){logger['error'](_0x5645('0x10'),inspectError(_0x2270a1));});}exports[_0x5645('0xf')]=rescheduleContact;function unlockContact(_0x25863f,_0x4cbd46,_0x4b3be6){return cmHopper[_0x5645('0x11')](_0x25863f,_0x4cbd46,_0x4b3be6)[_0x5645('0x8')](function(_0x511aed){logger[_0x5645('0xb')](_0x5645('0x12'),inspectError(_0x511aed));});}exports[_0x5645('0x11')]=unlockContact;function moveContactManagedDialer(_0x5179fd){return cmHopper[_0x5645('0x13')](_0x5179fd)[_0x5645('0x8')](function(_0x22a6cf){logger[_0x5645('0xb')]('[moveContactManagedDialer]',inspectError(_0x22a6cf));});}exports[_0x5645('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x52ac46){return cmHopperBlack['checkIsBlackList'](_0x52ac46)[_0x5645('0x8')](function(_0x1e2cba){logger[_0x5645('0xb')]('[checkIsBlackList]',inspectError(_0x1e2cba));});}exports[_0x5645('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x50ed38){return cmHopperBlack[_0x5645('0x15')](_0x50ed38)['catch'](function(_0x4f82d0){logger[_0x5645('0xb')]('[checkIsBlackListIvr]',inspectError(_0x4f82d0));});}exports[_0x5645('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x379cbd,_0x502c2e,_0x18680f){return cmHopperAdditionalPhone[_0x5645('0x16')](_0x379cbd,_0x502c2e,_0x18680f)[_0x5645('0x8')](function(_0x50fa82){logger[_0x5645('0xb')](_0x5645('0x17'),inspectError(_0x50fa82));});}exports[_0x5645('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x46b33a,_0x568fd6,_0x4bc484){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46b33a,_0x568fd6,_0x4bc484)['catch'](function(_0x472982){logger['error']('[swapAdditionalPhone]',inspectError(_0x472982));});}exports[_0x5645('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x12f43a){return cmHopperHistory[_0x5645('0x19')](_0x12f43a)[_0x5645('0x8')](function(_0x3a5c61){logger[_0x5645('0xb')](_0x5645('0x1a'),inspectError(_0x3a5c61));});}exports[_0x5645('0x19')]=avgHandleTime;function createHistory(_0x4493e6){return cmHopperHistory[_0x5645('0x1b')](_0x4493e6)[_0x5645('0x8')](function(_0x2154a7){logger[_0x5645('0xb')](_0x5645('0x1c'),inspectError(_0x2154a7));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x3e24=['[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','temp','countReScheduled'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x3e24,0x167));var _0x43e2=function(_0xa961c5,_0xdd9ef0){_0xa961c5=_0xa961c5-0x0;var _0x33e6bf=_0x3e24[_0xa961c5];return _0x33e6bf;};'use strict';var util=require(_0x43e2('0x0'));var logger=require(_0x43e2('0x1'))(_0x43e2('0x2'));var cmHopper=require(_0x43e2('0x3'));var cmHopperAdditionalPhone=require(_0x43e2('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x43e2('0x5'));function inspectError(_0x1ff04b){return util['inspect'](_0x1ff04b,{'showHidden':![],'depth':null});}function getContactDialer(_0x1dd127,_0x18629c,_0x1a89fc){return cmHopper[_0x43e2('0x6')](_0x1dd127['id'],_0x18629c,_0x1a89fc,_0x1dd127[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x23b2d8){_0x1dd127['temp']=0x0;logger[_0x43e2('0x9')](_0x43e2('0xa'),inspectError(_0x23b2d8));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1c96f9,_0x2fdf85){return cmHopper['getContactDialerIvr'](_0x1c96f9['id'],_0x2fdf85,_0x1c96f9[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x52146c){_0x1c96f9[_0x43e2('0xb')]=0x0;logger['error']('[getContactDialerIvr]',inspectError(_0x52146c));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x103220){return cmHopper[_0x43e2('0xc')](_0x103220)[_0x43e2('0x8')](function(_0x44781a){logger[_0x43e2('0x9')](_0x43e2('0xd'),inspectError(_0x44781a));});}exports[_0x43e2('0xc')]=countReScheduled;function rescheduleContact(_0x802e2d){return cmHopper[_0x43e2('0xe')](_0x802e2d)[_0x43e2('0x8')](function(_0x377097){logger[_0x43e2('0x9')]('[rescheduleContact]',inspectError(_0x377097));});}exports[_0x43e2('0xe')]=rescheduleContact;function unlockContact(_0x40fb7b,_0xb929b5,_0x2a0fb0){return cmHopper['unlockContact'](_0x40fb7b,_0xb929b5,_0x2a0fb0)['catch'](function(_0x241da2){logger[_0x43e2('0x9')](_0x43e2('0xf'),inspectError(_0x241da2));});}exports[_0x43e2('0x10')]=unlockContact;function moveContactManagedDialer(_0x105cb8){return cmHopper[_0x43e2('0x11')](_0x105cb8)[_0x43e2('0x8')](function(_0x15ecb5){logger[_0x43e2('0x9')](_0x43e2('0x12'),inspectError(_0x15ecb5));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3ee34c){return cmHopperBlack[_0x43e2('0x13')](_0x3ee34c)['catch'](function(_0x115c0a){logger['error'](_0x43e2('0x14'),inspectError(_0x115c0a));});}exports[_0x43e2('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1fac53){return cmHopperBlack[_0x43e2('0x15')](_0x1fac53)[_0x43e2('0x8')](function(_0x5ae97b){logger[_0x43e2('0x9')](_0x43e2('0x16'),inspectError(_0x5ae97b));});}exports[_0x43e2('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x52e361,_0x234a1d,_0x32f048){return cmHopperAdditionalPhone[_0x43e2('0x17')](_0x52e361,_0x234a1d,_0x32f048)[_0x43e2('0x8')](function(_0x4f20e6){logger[_0x43e2('0x9')](_0x43e2('0x18'),inspectError(_0x4f20e6));});}exports[_0x43e2('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3b7b22,_0x178223,_0x2a593e){return cmHopperAdditionalPhone[_0x43e2('0x19')](_0x3b7b22,_0x178223,_0x2a593e)[_0x43e2('0x8')](function(_0xd29b7b){logger[_0x43e2('0x9')](_0x43e2('0x1a'),inspectError(_0xd29b7b));});}exports[_0x43e2('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x52ed49){return cmHopperHistory[_0x43e2('0x1b')](_0x52ed49)[_0x43e2('0x8')](function(_0x545246){logger[_0x43e2('0x9')](_0x43e2('0x1c'),inspectError(_0x545246));});}exports[_0x43e2('0x1b')]=avgHandleTime;function createHistory(_0x404483){return cmHopperHistory[_0x43e2('0x1d')](_0x404483)['catch'](function(_0x42f495){logger[_0x43e2('0x9')](_0x43e2('0x1e'),inspectError(_0x42f495));});}exports[_0x43e2('0x1d')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 297e481..b194c6b 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7133=['extractCalleridName','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','XMD-','toUpperCase','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedInDb','paused','talking','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','Intervals','EMPTY_INTERVAL','SIP/','reachable','status','TrunkBackup','includes','pTalking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','waiting','INACTIVE','match'];(function(_0xb8aff9,_0x1c12ea){var _0x3038c5=function(_0x76a22e){while(--_0x76a22e){_0xb8aff9['push'](_0xb8aff9['shift']());}};_0x3038c5(++_0x1c12ea);}(_0x7133,0xc5));var _0x3713=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7133[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x3713('0x0'));var moment=require(_0x3713('0x1'));var util=require('util');var logger=require(_0x3713('0x2'))(_0x3713('0x3'));var timezones=require(_0x3713('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x3713('0x5'),'BLACKLIST':_0x3713('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x3713('0x7'),'EMPTY_INTERVAL':_0x3713('0x8'),'INACTIVE':_0x3713('0x9'),'NO_AGENTS_LOGGED':_0x3713('0xa'),'NO_AVAILABLE_CONTACTS':_0x3713('0xb'),'NULL_INTERVAL':_0x3713('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x3713('0xd'),'QUEUE_RECALL':_0x3713('0xe'),'RECALL_TIMEOUT':_0x3713('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x3713('0x10'),'UNREACHABLE_TRUNK':_0x3713('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x51f923){return _0x51f923[_0x3713('0x12')]==='preview';}exports[_0x3713('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x49243f){return _0x49243f[_0x3713('0x14')]===_0x3713('0x15');}exports[_0x3713('0x16')]=isIVRCampaign;function isOutboundQueue(_0x25846c){return _0x25846c['type']===_0x3713('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x559685){return _0x559685[_0x3713('0x18')];}exports[_0x3713('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3932be){return _0x3932be['active'];}exports[_0x3713('0x1a')]=isIVRCampaignActive;function getSeconds(_0x5d9962,_0x5199f0){var _0x4b6529=moment(_0x5d9962)[_0x3713('0x1b')](0x0);var _0x3c7668=moment(_0x5199f0)[_0x3713('0x1b')](0x0);return _0x4b6529[_0x3713('0x1c')](_0x3c7668,_0x3713('0x1d'));}exports[_0x3713('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x1a548c,_0x4d8416){var _0x238816=![];var _0x772831=_0x1a548c[_0x3713('0x12')]!==_0x4d8416[_0x3713('0x12')]||_0x1a548c[_0x3713('0x18')]!==_0x4d8416['dialActive']||_0x1a548c['message']!==_0x4d8416[_0x3713('0x1f')];var _0x2c2b71=_0x1a548c[_0x3713('0x20')]!==_0x4d8416[_0x3713('0x20')]||_0x1a548c['loggedIn']!==_0x4d8416['loggedIn']||_0x1a548c[_0x3713('0x21')]!==_0x4d8416['loggedInDb']||_0x1a548c[_0x3713('0x22')]!==_0x4d8416['paused']||_0x1a548c[_0x3713('0x23')]!==_0x4d8416[_0x3713('0x23')]||_0x1a548c['pTalking']!==_0x4d8416['pTalking']||_0x1a548c['waiting']!==_0x4d8416['waiting']||_0x1a548c[_0x3713('0x24')]!==_0x4d8416[_0x3713('0x24')]||_0x1a548c[_0x3713('0x25')]!==_0x4d8416[_0x3713('0x25')];if(_0x1a548c[_0x3713('0x26')]&&_0x4d8416['Trunk']){_0x238816=_0x1a548c[_0x3713('0x26')]['name']!==_0x4d8416[_0x3713('0x26')][_0x3713('0x27')]||_0x1a548c[_0x3713('0x26')][_0x3713('0x28')]!==_0x4d8416[_0x3713('0x26')][_0x3713('0x28')];}return _0x772831||_0x2c2b71||_0x238816;}exports[_0x3713('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xaaf3ef){var _0x1e8365=null;var _0x50b8ae=_0xaaf3ef[_0x3713('0x2a')];if(_[_0x3713('0x2b')](_0xaaf3ef[_0x3713('0x2c')])||_[_0x3713('0x2b')](_0xaaf3ef['Interval'])||_[_0x3713('0x2b')](_0xaaf3ef[_0x3713('0x2d')]['Intervals'])){_0x1e8365=CAMPAIGN_STATUS[_0x3713('0x2e')];}else if(_['isEmpty'](_0xaaf3ef['dialGlobalInterval'])||_['isEmpty'](_0xaaf3ef[_0x3713('0x2d')][_0x3713('0x2f')])){_0x1e8365=CAMPAIGN_STATUS[_0x3713('0x30')];}else if(_0x50b8ae&&!timezones[_0x50b8ae]){_0x1e8365=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x1e8365;}function checkAnyValidTrunk(_0x572d88,_0x330101){var _0x4cb271=null;var _0x47165a=_0x3713('0x31');var _0xde7104=[_0x3713('0x32'),'unmonitored'];var _0x46bf99=!![];if(_0x572d88[_0x3713('0x26')]&&_0x572d88[_0x3713('0x26')][_0x3713('0x28')]){_0x47165a+=_0x572d88[_0x3713('0x26')][_0x3713('0x27')];_0x4cb271=_0x330101[_0x47165a];_0x46bf99=_0xde7104['includes'](_0x4cb271[_0x3713('0x33')]);}else if(_0x572d88['TrunkBackup']&&_0x572d88[_0x3713('0x34')][_0x3713('0x28')]){_0x47165a+=_0x572d88['TrunkBackup'][_0x3713('0x27')];_0x4cb271=_0x330101[_0x47165a];_0x46bf99=_0xde7104[_0x3713('0x35')](_0x4cb271[_0x3713('0x33')]);}return _0x46bf99;}function getQueueCampaignStatusMessage(_0x5ace67,_0x2549ac){var _0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x5')];var _0x28d719=isPreviewCampaign(_0x5ace67);if(!isQueueCampaignActive(_0x5ace67)){if(_0x28d719){_0x11c1bc=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x5ace67['originated']===0x0&&_0x5ace67['talking']===0x0&&_0x5ace67['waiting']===0x0&&(_0x5ace67[_0x3713('0x36')]||0x0)===0x0){_0x11c1bc=CAMPAIGN_STATUS['INACTIVE'];}else{_0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x37')];}}}else if(_0x5ace67['loggedIn']===0x0){_0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x38')];}else if(!checkAnyValidTrunk(_0x5ace67,_0x2549ac)){_0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x39')];}else if(!isPreviewCampaign(_0x5ace67)){var _0x1830fc=checkAnyValidQueueCampaignInterval(_0x5ace67);if(_0x1830fc){_0x11c1bc=_0x1830fc;}}return _0x11c1bc;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1f36a9){var _0x5cfe31=CAMPAIGN_STATUS[_0x3713('0x37')];if(_0x1f36a9[_0x3713('0x25')]===0x0&&_0x1f36a9['talking']===0x0&&_0x1f36a9[_0x3713('0x3a')]===0x0&&(_0x1f36a9[_0x3713('0x36')]||0x0)===0x0){_0x5cfe31=CAMPAIGN_STATUS[_0x3713('0x3b')];}return _0x5cfe31;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4d1788){var _0x297ab4=_0x4d1788[_0x3713('0x3c')](/"(.*?)"/);return _0x297ab4?_0x297ab4[0x1]:_0x4d1788;}exports[_0x3713('0x3d')]=extractCalleridName;function getCallerId(_0x26f6a7,_0x26aa97,_0x96406e){if(!_[_0x3713('0x3e')](_0x96406e)&&typeof _0x96406e===_0x3713('0x3f')&&!_[_0x3713('0x40')](_0x96406e)){if(!_['isUndefined'](_0x26aa97)&&typeof _0x26aa97===_0x3713('0x3f')&&!_['isEmpty'](_0x26aa97)){return util[_0x3713('0x41')](_0x3713('0x42'),_0x26aa97,_0x96406e);}return util[_0x3713('0x41')](_0x3713('0x42'),_0x96406e,_0x96406e);}if(!_[_0x3713('0x3e')](_0x26f6a7)&&typeof _0x26f6a7==='string'&&!_[_0x3713('0x40')](_0x26f6a7)){return _0x26f6a7;}return _0x3713('0x43');}exports[_0x3713('0x44')]=getCallerId;function getCallerIdRandom(_0x27ebbe,_0x55ea9f){var _0x2deedb;var _0x14a06b;var _0x15e5c8;if(_0x55ea9f<=0x0){_0x55ea9f=0x1;}_0x2deedb=new RegExp(_0x3713('0x45')+_0x55ea9f+'}$');_0x14a06b=Math[_0x3713('0x46')](0xa,_0x55ea9f-0x1);_0x15e5c8=Math[_0x3713('0x46')](0xa,_0x55ea9f)-0x1;return util['format']('%s',_[_0x3713('0x47')](_0x27ebbe,_0x2deedb,_[_0x3713('0x48')](_0x14a06b,_0x15e5c8)[_0x3713('0x49')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x2907d6,_0x2e7a54){if(_0x2907d6[_0x3713('0x25')]&&_0x2907d6[_0x3713('0x25')]>0x0){_0x2907d6['originated']-=0x1;}else{logger[_0x3713('0x4a')](_0x3713('0x4b'),_0x2e7a54);}}exports[_0x3713('0x4c')]=decrementOriginate;function checkContactEmpty(_0x368173){return _0x368173&&_0x368173[_0x3713('0x4d')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x319dfe,_0x448314){if(_0x448314===0x0){return 0x0;}var _0x5e2f01=0x1;for(var _0x16795e=0x1;_0x16795e<=_0x448314;_0x16795e+=0x1){_0x5e2f01=0x1+_0x5e2f01*_0x16795e/_0x319dfe;}return 0x1/_0x5e2f01;}exports[_0x3713('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x45a0ca,_0x306dc4,_0x4eeae7){if(_0x306dc4>_0x4eeae7){for(var _0x1d8725=0x0;_0x1d8725<_0x306dc4-_0x4eeae7;_0x1d8725+=0x1){decrementOriginate(_0x45a0ca,_0x3713('0x4f'));}}}exports[_0x3713('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x98e00){var _0x1a1596={};var _0x3129e9=['id',_0x3713('0x51'),'tags',_0x3713('0x52')];const _0x22e4a3=0xfa;if(_0x98e00){for(var _0x1c608e in _0x98e00){if(typeof _0x98e00[_0x1c608e]!==_0x3713('0x53')){if(!_['isNil'](_0x98e00[_0x1c608e])&&!_0x3129e9['includes'](_0x1c608e)){if(_0x1c608e==='description'&&_0x98e00[_0x1c608e][_0x3713('0x4d')]>_0x22e4a3){_0x1a1596[_0x3713('0x54')+_0x1c608e[_0x3713('0x55')]()]=_0x98e00[_0x1c608e][_0x3713('0x49')]()['substring'](0x0,_0x22e4a3);}else{_0x1a1596['XMD-'+_0x1c608e['toUpperCase']()]=_0x98e00[_0x1c608e];}}}}}return _0x1a1596;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x471d=['checkContactEmpty','[checkContactLowerLimitOriginate]\x20','createdAt','tags','undefined','description','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','dialer','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','length'];(function(_0x4a88c7,_0x7ae69e){var _0x54f3c2=function(_0x464a5b){while(--_0x464a5b){_0x4a88c7['push'](_0x4a88c7['shift']());}};_0x54f3c2(++_0x7ae69e);}(_0x471d,0x1ef));var _0xd471=function(_0x386aa3,_0x5a6802){_0x386aa3=_0x386aa3-0x0;var _0x5b3dd2=_0x471d[_0x386aa3];return _0x5b3dd2;};'use strict';var _=require(_0xd471('0x0'));var moment=require(_0xd471('0x1'));var util=require(_0xd471('0x2'));var logger=require('../../../../config/logger')(_0xd471('0x3'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xd471('0x4'),'BLACKLIST':_0xd471('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xd471('0x6'),'DISACTIVED':_0xd471('0x7'),'EMPTY_INTERVAL':_0xd471('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xd471('0x9'),'NULL_INTERVAL':_0xd471('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xd471('0xb'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xd471('0xc'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xd471('0xd')};exports[_0xd471('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1f27d6){return _0x1f27d6[_0xd471('0xf')]===_0xd471('0x10');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x21079c){return _0x21079c[_0xd471('0x11')]===_0xd471('0x12');}exports[_0xd471('0x13')]=isIVRCampaign;function isOutboundQueue(_0x2a05d4){return _0x2a05d4[_0xd471('0x11')]===_0xd471('0x14');}exports[_0xd471('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x541f29){return _0x541f29['dialActive'];}exports[_0xd471('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3c390b){return _0x3c390b['active'];}exports[_0xd471('0x17')]=isIVRCampaignActive;function getSeconds(_0x319b5e,_0x578667){var _0xf7e4f=moment(_0x319b5e)[_0xd471('0x18')](0x0);var _0x19b11b=moment(_0x578667)[_0xd471('0x18')](0x0);return _0xf7e4f['diff'](_0x19b11b,_0xd471('0x19'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x1e64bc,_0x44de14){var _0xcd7326=![];var _0x383e75=_0x1e64bc[_0xd471('0xf')]!==_0x44de14[_0xd471('0xf')]||_0x1e64bc[_0xd471('0x1a')]!==_0x44de14[_0xd471('0x1a')]||_0x1e64bc['message']!==_0x44de14[_0xd471('0x1b')];var _0x5255bd=_0x1e64bc[_0xd471('0x1c')]!==_0x44de14[_0xd471('0x1c')]||_0x1e64bc[_0xd471('0x1d')]!==_0x44de14['loggedIn']||_0x1e64bc[_0xd471('0x1e')]!==_0x44de14[_0xd471('0x1e')]||_0x1e64bc[_0xd471('0x1f')]!==_0x44de14['paused']||_0x1e64bc[_0xd471('0x20')]!==_0x44de14[_0xd471('0x20')]||_0x1e64bc[_0xd471('0x21')]!==_0x44de14[_0xd471('0x21')]||_0x1e64bc[_0xd471('0x22')]!==_0x44de14[_0xd471('0x22')]||_0x1e64bc['inUse']!==_0x44de14['inUse']||_0x1e64bc[_0xd471('0x23')]!==_0x44de14[_0xd471('0x23')];if(_0x1e64bc[_0xd471('0x24')]&&_0x44de14[_0xd471('0x24')]){_0xcd7326=_0x1e64bc['Trunk'][_0xd471('0x25')]!==_0x44de14['Trunk'][_0xd471('0x25')]||_0x1e64bc[_0xd471('0x24')][_0xd471('0x26')]!==_0x44de14['Trunk'][_0xd471('0x26')];}return _0x383e75||_0x5255bd||_0xcd7326;}exports[_0xd471('0x27')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x572057){var _0x482d03=null;var _0x377b9b=_0x572057[_0xd471('0x28')];if(_[_0xd471('0x29')](_0x572057[_0xd471('0x2a')])||_['isNil'](_0x572057[_0xd471('0x2b')])||_['isNil'](_0x572057['Interval'][_0xd471('0x2c')])){_0x482d03=CAMPAIGN_STATUS[_0xd471('0x2d')];}else if(_[_0xd471('0x2e')](_0x572057['dialGlobalInterval'])||_[_0xd471('0x2e')](_0x572057[_0xd471('0x2b')][_0xd471('0x2c')])){_0x482d03=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x377b9b&&!timezones[_0x377b9b]){_0x482d03=CAMPAIGN_STATUS[_0xd471('0x2f')];}return _0x482d03;}function checkAnyValidTrunk(_0x5c6308,_0x87bea2){var _0x529980=null;var _0x31c4ed='SIP/';var _0x608397=[_0xd471('0x30'),_0xd471('0x31')];var _0x1eee3e=!![];if(_0x5c6308[_0xd471('0x24')]&&_0x5c6308[_0xd471('0x24')]['active']){_0x31c4ed+=_0x5c6308[_0xd471('0x24')][_0xd471('0x25')];_0x529980=_0x87bea2[_0x31c4ed];_0x1eee3e=_0x608397[_0xd471('0x32')](_0x529980['status']);}else if(_0x5c6308[_0xd471('0x33')]&&_0x5c6308['TrunkBackup'][_0xd471('0x26')]){_0x31c4ed+=_0x5c6308['TrunkBackup']['name'];_0x529980=_0x87bea2[_0x31c4ed];_0x1eee3e=_0x608397[_0xd471('0x32')](_0x529980[_0xd471('0x34')]);}return _0x1eee3e;}function getQueueCampaignStatusMessage(_0x43dee3,_0x3a5411){var _0x3efb5c=CAMPAIGN_STATUS[_0xd471('0x4')];var _0x25b553=isPreviewCampaign(_0x43dee3);if(!isQueueCampaignActive(_0x43dee3)){if(_0x25b553){_0x3efb5c=CAMPAIGN_STATUS[_0xd471('0x35')];}else{if(_0x43dee3[_0xd471('0x23')]===0x0&&_0x43dee3[_0xd471('0x20')]===0x0&&_0x43dee3['waiting']===0x0&&(_0x43dee3['pTalking']||0x0)===0x0){_0x3efb5c=CAMPAIGN_STATUS[_0xd471('0x35')];}else{_0x3efb5c=CAMPAIGN_STATUS[_0xd471('0x36')];}}}else if(_0x43dee3[_0xd471('0x1d')]===0x0){_0x3efb5c=CAMPAIGN_STATUS[_0xd471('0x37')];}else if(!checkAnyValidTrunk(_0x43dee3,_0x3a5411)){_0x3efb5c=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x43dee3)){var _0x56840c=checkAnyValidQueueCampaignInterval(_0x43dee3);if(_0x56840c){_0x3efb5c=_0x56840c;}}return _0x3efb5c;}exports[_0xd471('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x223752){var _0x259191=CAMPAIGN_STATUS[_0xd471('0x36')];if(_0x223752[_0xd471('0x23')]===0x0&&_0x223752[_0xd471('0x20')]===0x0&&_0x223752[_0xd471('0x22')]===0x0&&(_0x223752[_0xd471('0x21')]||0x0)===0x0){_0x259191=CAMPAIGN_STATUS[_0xd471('0x35')];}return _0x259191;}exports[_0xd471('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3d8b37){var _0x5cef35=_0x3d8b37[_0xd471('0x3a')](/"(.*?)"/);return _0x5cef35?_0x5cef35[0x1]:_0x3d8b37;}exports[_0xd471('0x3b')]=extractCalleridName;function getCallerId(_0x424251,_0x1f65d7,_0x579330){if(!_['isUndefined'](_0x579330)&&typeof _0x579330===_0xd471('0x3c')&&!_[_0xd471('0x2e')](_0x579330)){if(!_[_0xd471('0x3d')](_0x1f65d7)&&typeof _0x1f65d7==='string'&&!_['isEmpty'](_0x1f65d7)){return util['format'](_0xd471('0x3e'),_0x1f65d7,_0x579330);}return util[_0xd471('0x3f')](_0xd471('0x3e'),_0x579330,_0x579330);}if(!_['isUndefined'](_0x424251)&&typeof _0x424251===_0xd471('0x3c')&&!_['isEmpty'](_0x424251)){return _0x424251;}return'\x22\x22\x20<>';}exports[_0xd471('0x40')]=getCallerId;function getCallerIdRandom(_0x2b498c,_0x1b60f5){var _0x658556;var _0x43ac48;var _0x36e01c;if(_0x1b60f5<=0x0){_0x1b60f5=0x1;}_0x658556=new RegExp(_0xd471('0x41')+_0x1b60f5+'}$');_0x43ac48=Math[_0xd471('0x42')](0xa,_0x1b60f5-0x1);_0x36e01c=Math[_0xd471('0x42')](0xa,_0x1b60f5)-0x1;return util[_0xd471('0x3f')]('%s',_[_0xd471('0x43')](_0x2b498c,_0x658556,_[_0xd471('0x44')](_0x43ac48,_0x36e01c)[_0xd471('0x45')]()));}exports[_0xd471('0x46')]=getCallerIdRandom;function decrementOriginate(_0x33998c,_0x47e2c3){if(_0x33998c[_0xd471('0x23')]&&_0x33998c['originated']>0x0){_0x33998c[_0xd471('0x23')]-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value',_0x47e2c3);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x2382ba){return _0x2382ba&&_0x2382ba[_0xd471('0x47')]>0x0;}exports[_0xd471('0x48')]=checkContactEmpty;function erlangb(_0x34536a,_0x893ef1){if(_0x893ef1===0x0){return 0x0;}var _0x9f1596=0x1;for(var _0x95208e=0x1;_0x95208e<=_0x893ef1;_0x95208e+=0x1){_0x9f1596=0x1+_0x9f1596*_0x95208e/_0x34536a;}return 0x1/_0x9f1596;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x59d96a,_0xe83cff,_0x535c75){if(_0xe83cff>_0x535c75){for(var _0x1d9a9b=0x0;_0x1d9a9b<_0xe83cff-_0x535c75;_0x1d9a9b+=0x1){decrementOriginate(_0x59d96a,_0xd471('0x49'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x5bf566){var _0x233088={};var _0x4c160c=['id',_0xd471('0x4a'),_0xd471('0x4b'),'updatedAt'];const _0x454583=0xfa;if(_0x5bf566){for(var _0x5debb0 in _0x5bf566){if(typeof _0x5bf566[_0x5debb0]!==_0xd471('0x4c')){if(!_[_0xd471('0x29')](_0x5bf566[_0x5debb0])&&!_0x4c160c[_0xd471('0x32')](_0x5debb0)){if(_0x5debb0===_0xd471('0x4d')&&_0x5bf566[_0x5debb0][_0xd471('0x47')]>_0x454583){_0x233088[_0xd471('0x4e')+_0x5debb0[_0xd471('0x4f')]()]=_0x5bf566[_0x5debb0]['toString']()['substring'](0x0,_0x454583);}else{_0x233088['XMD-'+_0x5debb0['toUpperCase']()]=_0x5bf566[_0x5debb0];}}}}}return _0x233088;}exports[_0xd471('0x50')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7b8b03b..fae3d19 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(_0x17c01b,_0x427c27){var _0x4a9783=function(_0x1684b8){while(--_0x1684b8){_0x17c01b['push'](_0x17c01b['shift']());}};_0x4a9783(++_0x427c27);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var 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(_0x1301c7,_0x56366a){var _0x10795e=function(_0x1ebb1e){while(--_0x1ebb1e){_0x1301c7['push'](_0x1301c7['shift']());}};_0x10795e(++_0x56366a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 0f01e0c..999b22a 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 _0x1d33=['channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','context','from-voip-provider','exten','uniqueid','channel','name','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','value','channelstate','operation','status','localstationid','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','stringify','catch','error','\x20receiveFax\x20','syncOriginateResponse','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment'];(function(_0x51c129,_0x41657c){var _0x53e24c=function(_0x5c5ce5){while(--_0x5c5ce5){_0x51c129['push'](_0x51c129['shift']());}};_0x53e24c(++_0x41657c);}(_0x1d33,0x1cd));var _0x31d3=function(_0xb9bda1,_0x4f32e3){_0xb9bda1=_0xb9bda1-0x0;var _0x353bcc=_0x1d33[_0xb9bda1];return _0x353bcc;};'use strict';var util=require(_0x31d3('0x0'));var _=require(_0x31d3('0x1'));var BPromise=require(_0x31d3('0x2'));var uuid=require(_0x31d3('0x3'));var moment=require(_0x31d3('0x4'));var path=require(_0x31d3('0x5'));var tiff2pdf=require(_0x31d3('0x6'));var gs=require(_0x31d3('0x7'));var logger=require(_0x31d3('0x8'))('fax');var ami=require(_0x31d3('0x9'));var rpcDb=require(_0x31d3('0xa'));var Channel=require(_0x31d3('0xb'));var ut=require(_0x31d3('0xc'));var Action=require('./action');var faxAccount=require(_0x31d3('0xd'));var attachment=require(_0x31d3('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x34b7d2){this[_0x31d3('0xf')]={};this[_0x31d3('0x10')]=_0x34b7d2[_0x31d3('0x10')];this[_0x31d3('0x11')]=_0x34b7d2['trunks'];this[_0x31d3('0x12')]={};ami['on']('newchannel',this[_0x31d3('0x13')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x15'),this[_0x31d3('0x16')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x17'),this[_0x31d3('0x18')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x19'),this[_0x31d3('0x1a')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x1b'),this[_0x31d3('0x1c')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x1d'),this[_0x31d3('0x1e')][_0x31d3('0x14')](this));ami['on']('hangup',this[_0x31d3('0x1f')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x20'),this['syncOriginateResponse'][_0x31d3('0x14')](this));}Fax['prototype'][_0x31d3('0x13')]=function(_0x20f3d2){if(_0x20f3d2[_0x31d3('0x21')]===_0x31d3('0x22')){for(var _0x41e6f9 in this[_0x31d3('0x10')]){if(this[_0x31d3('0x10')]['hasOwnProperty'](_0x41e6f9)){if(_0x20f3d2[_0x31d3('0x23')]===this[_0x31d3('0x10')][_0x41e6f9]['localstationid']){this[_0x31d3('0xf')][_0x20f3d2[_0x31d3('0x24')]]={};this[_0x31d3('0xf')][_0x20f3d2[_0x31d3('0x24')]][_0x31d3('0x25')]=_0x20f3d2[_0x31d3('0x25')];this['channels'][_0x20f3d2[_0x31d3('0x24')]]['id']=this[_0x31d3('0x10')][_0x41e6f9]['id'];this[_0x31d3('0xf')][_0x20f3d2['uniqueid']][_0x31d3('0x26')]=this[_0x31d3('0x10')][_0x41e6f9][_0x31d3('0x26')];logger['info'](_0x20f3d2[_0x31d3('0x24')],_0x31d3('0x27'));}}}}if(this[_0x31d3('0x12')][_0x20f3d2[_0x31d3('0x24')]]){this['channels'][_0x20f3d2['uniqueid']]={};this[_0x31d3('0xf')][_0x20f3d2[_0x31d3('0x24')]][_0x31d3('0x25')]=_0x20f3d2[_0x31d3('0x25')];logger['info'](_0x20f3d2[_0x31d3('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x31d3('0x28')][_0x31d3('0x16')]=function(_0x2edf51){if(this[_0x31d3('0xf')][_0x2edf51['uniqueid']]){for(var _0x312231 in _0x2edf51[_0x31d3('0x29')]){if(_0x2edf51['variable'][_0x31d3('0x2a')](_0x312231)){this[_0x31d3('0xf')][_0x2edf51[_0x31d3('0x24')]][_0x312231]=_0x2edf51[_0x31d3('0x2b')];}}}};Fax[_0x31d3('0x28')]['syncNewState']=function(_0x5b99dc){if(this[_0x31d3('0xf')][_0x5b99dc[_0x31d3('0x24')]]){this['channels'][_0x5b99dc['uniqueid']][_0x31d3('0x2c')]=_0x5b99dc[_0x31d3('0x2c')];this['channels'][_0x5b99dc[_0x31d3('0x24')]]['channelstatedesc']=_0x5b99dc['channelstatedesc'];}};Fax[_0x31d3('0x28')][_0x31d3('0x1a')]=function(_0xd95f68){if(this[_0x31d3('0xf')][_0xd95f68[_0x31d3('0x24')]]){for(var _0x28e89c in _0xd95f68[_0x31d3('0x29')]){if(_0xd95f68['variable']['hasOwnProperty'](_0x28e89c)){this[_0x31d3('0xf')][_0xd95f68[_0x31d3('0x24')]][_0x28e89c]=_0xd95f68['value'];}}}};Fax[_0x31d3('0x28')][_0x31d3('0x1c')]=function(_0x1e03c9){if(this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]]){this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]][_0x31d3('0x2d')]=_0x1e03c9[_0x31d3('0x2d')];this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]]['status']=_0x1e03c9[_0x31d3('0x2e')];this[_0x31d3('0xf')][_0x1e03c9['uniqueid']][_0x31d3('0x2f')]=_0x1e03c9[_0x31d3('0x2f')];this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]][_0x31d3('0x30')]=_0x1e03c9[_0x31d3('0x30')];logger[_0x31d3('0x31')](_0x1e03c9['uniqueid'],_0x31d3('0x32'));}};Fax[_0x31d3('0x28')][_0x31d3('0x1e')]=function(_0x5ba853){var _0x3b2243=this;if(this['channels'][_0x5ba853[_0x31d3('0x24')]]){var _0x51ce54=this['channels'][_0x5ba853[_0x31d3('0x24')]]['id'];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x33')]=_0x5ba853['remotestationid'];this['channels'][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x34')]=_0x5ba853[_0x31d3('0x34')];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x2f')]=_0x5ba853[_0x31d3('0x2f')];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]]['resolution']=_0x5ba853[_0x31d3('0x35')];this['channels'][_0x5ba853[_0x31d3('0x24')]]['transferrate']=_0x5ba853['transferrate'];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]]['filename']=_0x5ba853['filename'];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x36')]=_0x5ba853['calleridnum'];if(this[_0x31d3('0xf')][_0x5ba853['uniqueid']][_0x31d3('0x34')]>0x0){tiff2pdf(_0x5ba853[_0x31d3('0x30')],_0x31d3('0x37'),function(_0x328716){logger[_0x31d3('0x31')](_0x5ba853[_0x31d3('0x24')],_0x31d3('0x38'),_0x328716[_0x31d3('0x39')]);attachment['create']({'name':path[_0x31d3('0x3a')](_0x5ba853[_0x31d3('0x30')])[_0x31d3('0x26')],'basename':path['parse'](_0x5ba853[_0x31d3('0x30')])[_0x31d3('0x26')]+_0x31d3('0x3b'),'type':_0x31d3('0x3c')})[_0x31d3('0x3d')](function(_0xff1084){faxAccount['notify'](_0x51ce54,{'from':_0x5ba853[_0x31d3('0x36')],'mapKey':'fax','body':path[_0x31d3('0x3a')](_0x5ba853[_0x31d3('0x30')])[_0x31d3('0x26')]+_0x31d3('0x3b'),'AttachmentId':_0xff1084['id']})['catch'](function(_0x1a0a81){logger['error'](_0x5ba853[_0x31d3('0x24')],'\x20notify\x20',JSON[_0x31d3('0x3e')](_0x1a0a81));});})[_0x31d3('0x3f')](function(_0x80ec03){logger[_0x31d3('0x40')](_0x5ba853[_0x31d3('0x24')],_0x31d3('0x41'),JSON['stringify'](_0x80ec03));});});}logger[_0x31d3('0x31')](_0x5ba853['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x31d3('0x28')][_0x31d3('0x42')]=function(_0x8c4d18){if(this[_0x31d3('0x12')][_0x8c4d18[_0x31d3('0x24')]]){_[_0x31d3('0x43')](this[_0x31d3('0xf')][_0x8c4d18[_0x31d3('0x24')]],_['pick'](_0x8c4d18,[_0x31d3('0x44'),_0x31d3('0x45')]));}};function updateStatus(_0x5a2dd8){if(_0x5a2dd8[_0x31d3('0x46')]){faxMessage[_0x31d3('0x47')](_0x5a2dd8[_0x31d3('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x31d3('0x3d')](function(_0x124b0d){ut[_0x31d3('0x48')](_0x31d3('0x49'),_0x124b0d);})['catch'](function(_0x55bcc1){ut['logger'](_0x31d3('0x4a'),_0x55bcc1);});}else{ut[_0x31d3('0x48')](_0x31d3('0x4b'));}}Fax[_0x31d3('0x28')][_0x31d3('0x4c')]=function(_0x5a4988,_0x1be217,_0x43f454){var _0x2f0343=this;var _0xd273a4={};if(_0x1be217){_0xd273a4={'read':_0x1be217};}else{_0xd273a4={'failMessage':_0x43f454};}if(this['actions'][_0x5a4988][_0x31d3('0x46')]){faxMessage[_0x31d3('0x47')](this['actions'][_0x5a4988][_0x31d3('0x46')],_0xd273a4)[_0x31d3('0x3d')](function(_0x161cdd){ut[_0x31d3('0x48')](_0x31d3('0x4d'),_0x161cdd);})[_0x31d3('0x3f')](function(_0x5c75de){ut[_0x31d3('0x48')](_0x31d3('0x4e'),_0x5c75de);})[_0x31d3('0x4f')](function(){delete _0x2f0343['channels'][_0x5a4988];delete _0x2f0343[_0x31d3('0x12')][_0x5a4988];});}else{ut['logger'](_0x31d3('0x50'));this[_0x31d3('0x51')](_0x5a4988);delete this['actions'][_0x5a4988];}};Fax[_0x31d3('0x28')][_0x31d3('0x1f')]=function(_0xf41e08){var _0x336792=this;if(this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]]){if(this[_0x31d3('0x12')][_0xf41e08[_0x31d3('0x24')]]){this[_0x31d3('0xf')][_0xf41e08['uniqueid']]['id']=this['actions'][_0xf41e08[_0x31d3('0x24')]]['id'];this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x26')]=this['actions'][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x26')];}logger['info'](_0xf41e08[_0x31d3('0x24')],this['actions'][_0xf41e08[_0x31d3('0x24')]]?'\x20hangup\x20sendFile\x20':_0x31d3('0x52'),JSON['stringify'](this[_0x31d3('0xf')][_0xf41e08['uniqueid']]));if(this[_0x31d3('0x12')][_0xf41e08[_0x31d3('0x24')]]){if(this['channels'][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x53')]>0x0&&this['channels'][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x1b')]===_0x31d3('0x54')){this['updateStatus'](_0xf41e08[_0x31d3('0x24')],!![]);}else{this[_0x31d3('0x4c')](_0xf41e08['uniqueid'],![],this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x55')]?_0x31d3('0x56')+this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x55')]:_0x31d3('0x57'));}}}};Fax[_0x31d3('0x28')][_0x31d3('0x58')]=function(_0x294cee){var _0x505cbe=this;return new BPromise(function(_0x383d17,_0x5a1c86){_0x505cbe[_0x31d3('0x59')](_0x294cee,_0x505cbe[_0x31d3('0x10')][_0x294cee[_0x31d3('0x5a')]])[_0x31d3('0x3d')](function(_0x47cac1){ut[_0x31d3('0x48')](_0x31d3('0x5b'),_0x47cac1);_0x383d17(ut[_0x31d3('0x39')](_0x31d3('0x5c')));})[_0x31d3('0x3f')](function(_0x4e6347){ut[_0x31d3('0x48')](_0x31d3('0x5d'),_0x4e6347);updateStatus(_0x294cee);_0x5a1c86(ut[_0x31d3('0x39')](_0x31d3('0x5e')));});});};Fax[_0x31d3('0x28')][_0x31d3('0x5f')]=function(_0x336f0c){var _0x328f43=this;return new BPromise(function(_0xc39caf,_0x2915bd){var _0x9ca93f=_0x328f43[_0x31d3('0x60')](_0x328f43[_0x31d3('0x10')][_0x336f0c[_0x31d3('0x5a')]][_0x31d3('0x61')],_0x336f0c);if(_0x9ca93f['isValid']){_0xc39caf(ut[_0x31d3('0x39')](_0x31d3('0x62')));}else{_0x2915bd(ut[_0x31d3('0x39')](_0x9ca93f[_0x31d3('0x39')]));}});};function originate(_0x177661,_0x410b1c,_0x488387){return new BPromise(function(_0x318af6,_0x4dc746){if(_0x488387){var _0x29494b=util[_0x31d3('0x63')](_0x31d3('0x64'),path[_0x31d3('0x3a')](_0x177661[_0x31d3('0x5')])['name'],_0x177661[_0x31d3('0x5')]);gs['execute'](_0x29494b)[_0x31d3('0x3d')](function(){_0x177661[_0x31d3('0x5')]=util[_0x31d3('0x63')](_0x31d3('0x65'),path['parse'](_0x177661[_0x31d3('0x5')])[_0x31d3('0x66')],path[_0x31d3('0x3a')](_0x177661[_0x31d3('0x5')])[_0x31d3('0x26')]);_0x410b1c[_0x31d3('0x67')]=_0x177661[_0x31d3('0x5')];ut[_0x31d3('0x48')](_0x31d3('0x68'),'');ami[_0x31d3('0x69')](ut[_0x31d3('0x6a')](_0x177661,_0x410b1c))[_0x31d3('0x3d')](function(_0x4a57eb){_0x318af6(_0x4a57eb);})[_0x31d3('0x3f')](function(_0x1826a3){_0x4dc746(_0x1826a3);});})[_0x31d3('0x3f')](function(_0x2c0b4a){_0x4dc746(_0x2c0b4a);});}else{ami[_0x31d3('0x69')](ut[_0x31d3('0x6a')](_0x177661,_0x410b1c))[_0x31d3('0x3d')](function(_0x599d2b){_0x318af6(_0x599d2b);})[_0x31d3('0x3f')](function(_0x11abde){_0x4dc746(_0x11abde);});}});}Fax[_0x31d3('0x28')][_0x31d3('0x59')]=function(_0x296231,_0x35979c){var _0x19f7c2=this;return new BPromise(function(_0x4c2393,_0x1df52d){var _0x518a40=uuid['v4']();var _0x53e864=ut[_0x31d3('0x6b')](_0x296231,_0x35979c);_0x19f7c2[_0x31d3('0x12')][_0x518a40]=new Action(_0x518a40,_0x35979c,_0x296231);var _0x2b54fd=_0x19f7c2[_0x31d3('0x12')][_0x518a40];if(path[_0x31d3('0x3a')](_0x296231['path'])[_0x31d3('0x6c')]===_0x31d3('0x3b')){originate(_0x2b54fd,_0x53e864,!![])[_0x31d3('0x3d')](function(_0x5baea0){_0x4c2393(_0x5baea0);})['catch'](function(_0x1f43cd){_0x1df52d(_0x1f43cd);});}else{originate(_0x2b54fd,_0x53e864,![])['then'](function(_0x3e5ea6){_0x4c2393(_0x3e5ea6);})[_0x31d3('0x3f')](function(_0xbe4ec0){_0x1df52d(_0xbe4ec0);});}});};Fax[_0x31d3('0x28')][_0x31d3('0x6d')]=function(_0x2cc28b){return!_['isNil'](_0x2cc28b)&&!_[_0x31d3('0x6e')](_0x2cc28b[_0x31d3('0x26')])&&!_['isNil'](_0x2cc28b['active'])&&_0x2cc28b['active']&&!_['isNil'](this[_0x31d3('0x11')][util[_0x31d3('0x63')]('SIP/%s',_0x2cc28b[_0x31d3('0x26')])])&&!_[_0x31d3('0x6e')](this['trunks'][util['format'](_0x31d3('0x6f'),_0x2cc28b['name'])][_0x31d3('0x2e')])&&(this['trunks'][util[_0x31d3('0x63')](_0x31d3('0x6f'),_0x2cc28b[_0x31d3('0x26')])][_0x31d3('0x2e')]===_0x31d3('0x70')||this[_0x31d3('0x11')][util[_0x31d3('0x63')]('SIP/%s',_0x2cc28b[_0x31d3('0x26')])][_0x31d3('0x2e')]==='unmonitored');};Fax[_0x31d3('0x28')][_0x31d3('0x60')]=function(_0x593b20,_0x50463b){if(!this['isTrunkReachable'](_0x593b20)){ut['logger'](_0x31d3('0x71'),_[_0x31d3('0x6e')](_0x593b20)?'':_0x593b20[_0x31d3('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x31d3('0x6e')](_0x50463b[_0x31d3('0x72')])){ut['logger'](_0x31d3('0x73'),JSON['stringify'](_0x50463b));return{'isValid':![],'message':_0x31d3('0x74')};}if(_[_0x31d3('0x6e')](_0x50463b[_0x31d3('0x5')])){ut[_0x31d3('0x48')](_0x31d3('0x75'),JSON['stringify'](_0x50463b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x31d3('0x76')};};Fax['prototype'][_0x31d3('0x51')]=function(_0x4c988f,_0x15c501=0x2710){if(this[_0x31d3('0xf')][_0x4c988f]){setTimeout(()=>{delete this['channels'][_0x4c988f];},_0x15c501);}};module['exports']=Fax; \ No newline at end of file +var _0x1304=['pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','fax','.pdf','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','status','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../ami','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','value','syncFaxStatus','operation','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum'];(function(_0x219632,_0x476c58){var _0x192b37=function(_0x53fa1){while(--_0x53fa1){_0x219632['push'](_0x219632['shift']());}};_0x192b37(++_0x476c58);}(_0x1304,0x131));var _0x4130=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1304[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x4130('0x0'));var _=require(_0x4130('0x1'));var BPromise=require(_0x4130('0x2'));var uuid=require(_0x4130('0x3'));var moment=require('moment');var path=require(_0x4130('0x4'));var tiff2pdf=require(_0x4130('0x5'));var gs=require(_0x4130('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x4130('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x4130('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x4130('0x9'));var attachment=require(_0x4130('0xa'));var faxMessage=require(_0x4130('0xb'));function Fax(_0x573462){this[_0x4130('0xc')]={};this['faxAccounts']=_0x573462[_0x4130('0xd')];this['trunks']=_0x573462[_0x4130('0xe')];this[_0x4130('0xf')]={};ami['on'](_0x4130('0x10'),this[_0x4130('0x11')][_0x4130('0x12')](this));ami['on']('varset',this[_0x4130('0x13')][_0x4130('0x12')](this));ami['on']('newstate',this[_0x4130('0x14')][_0x4130('0x12')](this));ami['on'](_0x4130('0x15'),this[_0x4130('0x16')][_0x4130('0x12')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x4130('0x17'),this['syncReceiveFax'][_0x4130('0x12')](this));ami['on'](_0x4130('0x18'),this[_0x4130('0x19')][_0x4130('0x12')](this));ami['on'](_0x4130('0x1a'),this[_0x4130('0x1b')][_0x4130('0x12')](this));}Fax['prototype'][_0x4130('0x11')]=function(_0x3f4bbd){if(_0x3f4bbd['context']===_0x4130('0x1c')){for(var _0x3b5952 in this[_0x4130('0xd')]){if(this['faxAccounts']['hasOwnProperty'](_0x3b5952)){if(_0x3f4bbd[_0x4130('0x1d')]===this[_0x4130('0xd')][_0x3b5952][_0x4130('0x1e')]){this[_0x4130('0xc')][_0x3f4bbd[_0x4130('0x1f')]]={};this['channels'][_0x3f4bbd[_0x4130('0x1f')]][_0x4130('0x20')]=_0x3f4bbd[_0x4130('0x20')];this[_0x4130('0xc')][_0x3f4bbd[_0x4130('0x1f')]]['id']=this[_0x4130('0xd')][_0x3b5952]['id'];this['channels'][_0x3f4bbd['uniqueid']][_0x4130('0x21')]=this[_0x4130('0xd')][_0x3b5952][_0x4130('0x21')];logger[_0x4130('0x22')](_0x3f4bbd[_0x4130('0x1f')],_0x4130('0x23'));}}}}if(this[_0x4130('0xf')][_0x3f4bbd[_0x4130('0x1f')]]){this[_0x4130('0xc')][_0x3f4bbd[_0x4130('0x1f')]]={};this[_0x4130('0xc')][_0x3f4bbd[_0x4130('0x1f')]]['channel']=_0x3f4bbd[_0x4130('0x20')];logger[_0x4130('0x22')](_0x3f4bbd[_0x4130('0x1f')],_0x4130('0x23'));}};Fax[_0x4130('0x24')][_0x4130('0x13')]=function(_0x260629){if(this[_0x4130('0xc')][_0x260629[_0x4130('0x1f')]]){for(var _0x566d73 in _0x260629['variable']){if(_0x260629[_0x4130('0x25')]['hasOwnProperty'](_0x566d73)){this['channels'][_0x260629['uniqueid']][_0x566d73]=_0x260629['value'];}}}};Fax[_0x4130('0x24')][_0x4130('0x14')]=function(_0x2fece4){if(this['channels'][_0x2fece4[_0x4130('0x1f')]]){this[_0x4130('0xc')][_0x2fece4[_0x4130('0x1f')]][_0x4130('0x26')]=_0x2fece4[_0x4130('0x26')];this[_0x4130('0xc')][_0x2fece4[_0x4130('0x1f')]][_0x4130('0x27')]=_0x2fece4[_0x4130('0x27')];}};Fax[_0x4130('0x24')][_0x4130('0x16')]=function(_0x89297){if(this[_0x4130('0xc')][_0x89297[_0x4130('0x1f')]]){for(var _0x1bcf2 in _0x89297[_0x4130('0x25')]){if(_0x89297['variable']['hasOwnProperty'](_0x1bcf2)){this[_0x4130('0xc')][_0x89297[_0x4130('0x1f')]][_0x1bcf2]=_0x89297[_0x4130('0x28')];}}}};Fax[_0x4130('0x24')][_0x4130('0x29')]=function(_0x553826){if(this[_0x4130('0xc')][_0x553826['uniqueid']]){this['channels'][_0x553826[_0x4130('0x1f')]][_0x4130('0x2a')]=_0x553826['operation'];this[_0x4130('0xc')][_0x553826[_0x4130('0x1f')]]['status']=_0x553826['status'];this['channels'][_0x553826[_0x4130('0x1f')]][_0x4130('0x1e')]=_0x553826[_0x4130('0x1e')];this[_0x4130('0xc')][_0x553826['uniqueid']]['filename']=_0x553826[_0x4130('0x2b')];logger[_0x4130('0x22')](_0x553826[_0x4130('0x1f')],_0x4130('0x2c'));}};Fax[_0x4130('0x24')]['syncReceiveFax']=function(_0x105b2f){var _0x1abd05=this;if(this[_0x4130('0xc')][_0x105b2f[_0x4130('0x1f')]]){var _0x5e56aa=this[_0x4130('0xc')][_0x105b2f['uniqueid']]['id'];this[_0x4130('0xc')][_0x105b2f[_0x4130('0x1f')]][_0x4130('0x2d')]=_0x105b2f[_0x4130('0x2d')];this[_0x4130('0xc')][_0x105b2f['uniqueid']]['pagestransferred']=_0x105b2f['pagestransferred'];this[_0x4130('0xc')][_0x105b2f[_0x4130('0x1f')]]['localstationid']=_0x105b2f[_0x4130('0x1e')];this[_0x4130('0xc')][_0x105b2f['uniqueid']][_0x4130('0x2e')]=_0x105b2f['resolution'];this['channels'][_0x105b2f[_0x4130('0x1f')]][_0x4130('0x2f')]=_0x105b2f['transferrate'];this[_0x4130('0xc')][_0x105b2f[_0x4130('0x1f')]][_0x4130('0x2b')]=_0x105b2f[_0x4130('0x2b')];this['channels'][_0x105b2f[_0x4130('0x1f')]][_0x4130('0x30')]=_0x105b2f[_0x4130('0x30')];if(this[_0x4130('0xc')][_0x105b2f[_0x4130('0x1f')]][_0x4130('0x31')]>0x0){tiff2pdf(_0x105b2f[_0x4130('0x2b')],_0x4130('0x32'),function(_0x476971){logger[_0x4130('0x22')](_0x105b2f[_0x4130('0x1f')],_0x4130('0x33'),_0x476971[_0x4130('0x34')]);attachment[_0x4130('0x35')]({'name':path[_0x4130('0x36')](_0x105b2f[_0x4130('0x2b')])[_0x4130('0x21')],'basename':path['parse'](_0x105b2f[_0x4130('0x2b')])[_0x4130('0x21')]+'.pdf','type':_0x4130('0x37')})['then'](function(_0x10507b){faxAccount['notify'](_0x5e56aa,{'from':_0x105b2f['calleridnum'],'mapKey':_0x4130('0x38'),'body':path[_0x4130('0x36')](_0x105b2f[_0x4130('0x2b')])[_0x4130('0x21')]+_0x4130('0x39'),'AttachmentId':_0x10507b['id']})['catch'](function(_0x2cd678){logger[_0x4130('0x3a')](_0x105b2f[_0x4130('0x1f')],_0x4130('0x3b'),JSON['stringify'](_0x2cd678));});})[_0x4130('0x3c')](function(_0x46408b){logger[_0x4130('0x3a')](_0x105b2f[_0x4130('0x1f')],_0x4130('0x3d'),JSON[_0x4130('0x3e')](_0x46408b));});});}logger[_0x4130('0x22')](_0x105b2f[_0x4130('0x1f')],_0x4130('0x3d'));}};Fax[_0x4130('0x24')][_0x4130('0x1b')]=function(_0x2e5ae9){if(this[_0x4130('0xf')][_0x2e5ae9[_0x4130('0x1f')]]){_[_0x4130('0x3f')](this[_0x4130('0xc')][_0x2e5ae9[_0x4130('0x1f')]],_[_0x4130('0x40')](_0x2e5ae9,[_0x4130('0x41'),_0x4130('0x42')]));}};function updateStatus(_0x1e9130){if(_0x1e9130[_0x4130('0x43')]){faxMessage['update'](_0x1e9130[_0x4130('0x43')],{'failMessage':_0x4130('0x44')})['then'](function(_0x493199){ut[_0x4130('0x45')]('[Fax][Message][Error][Updated]',_0x493199);})['catch'](function(_0x6e58f6){ut[_0x4130('0x45')]('[Fax][Message][Error][NoUpdate1]',_0x6e58f6);});}else{ut[_0x4130('0x45')](_0x4130('0x46'));}}Fax[_0x4130('0x24')][_0x4130('0x47')]=function(_0x2ab615,_0x41733a,_0x4c4334){var _0x410562=this;var _0x4ab9c3={};if(_0x41733a){_0x4ab9c3={'read':_0x41733a};}else{_0x4ab9c3={'failMessage':_0x4c4334};}if(this[_0x4130('0xf')][_0x2ab615][_0x4130('0x43')]){faxMessage[_0x4130('0x48')](this['actions'][_0x2ab615][_0x4130('0x43')],_0x4ab9c3)[_0x4130('0x49')](function(_0x43a6c0){ut[_0x4130('0x45')](_0x4130('0x4a'),_0x43a6c0);})[_0x4130('0x3c')](function(_0xece89e){ut['logger'](_0x4130('0x4b'),_0xece89e);})[_0x4130('0x4c')](function(){delete _0x410562['channels'][_0x2ab615];delete _0x410562[_0x4130('0xf')][_0x2ab615];});}else{ut[_0x4130('0x45')](_0x4130('0x4d'));this[_0x4130('0x4e')](_0x2ab615);delete this['actions'][_0x2ab615];}};Fax[_0x4130('0x24')][_0x4130('0x19')]=function(_0x22a635){var _0x3c96b2=this;if(this[_0x4130('0xc')][_0x22a635[_0x4130('0x1f')]]){if(this['actions'][_0x22a635['uniqueid']]){this[_0x4130('0xc')][_0x22a635[_0x4130('0x1f')]]['id']=this[_0x4130('0xf')][_0x22a635[_0x4130('0x1f')]]['id'];this[_0x4130('0xc')][_0x22a635[_0x4130('0x1f')]]['name']=this[_0x4130('0xf')][_0x22a635[_0x4130('0x1f')]][_0x4130('0x21')];}logger[_0x4130('0x22')](_0x22a635[_0x4130('0x1f')],this['actions'][_0x22a635[_0x4130('0x1f')]]?_0x4130('0x4f'):_0x4130('0x50'),JSON[_0x4130('0x3e')](this[_0x4130('0xc')][_0x22a635[_0x4130('0x1f')]]));if(this['actions'][_0x22a635[_0x4130('0x1f')]]){if(this[_0x4130('0xc')][_0x22a635[_0x4130('0x1f')]][_0x4130('0x51')]>0x0&&this[_0x4130('0xc')][_0x22a635[_0x4130('0x1f')]][_0x4130('0x52')]===_0x4130('0x53')){this[_0x4130('0x47')](_0x22a635[_0x4130('0x1f')],!![]);}else{this[_0x4130('0x47')](_0x22a635[_0x4130('0x1f')],![],this[_0x4130('0xc')][_0x22a635['uniqueid']][_0x4130('0x54')]?'SENDING\x20FAILED:\x20'+this[_0x4130('0xc')][_0x22a635['uniqueid']][_0x4130('0x54')]:_0x4130('0x55'));}}}};Fax[_0x4130('0x24')][_0x4130('0x56')]=function(_0x341067){var _0x384be4=this;return new BPromise(function(_0x1847d1,_0x59d3b3){_0x384be4[_0x4130('0x57')](_0x341067,_0x384be4[_0x4130('0xd')][_0x341067[_0x4130('0x58')]])[_0x4130('0x49')](function(_0x872f1c){ut[_0x4130('0x45')](_0x4130('0x59'),_0x872f1c);_0x1847d1(ut[_0x4130('0x34')]('Fax\x20received'));})[_0x4130('0x3c')](function(_0x273562){ut['logger'](_0x4130('0x5a'),_0x273562);updateStatus(_0x341067);_0x59d3b3(ut[_0x4130('0x34')](_0x4130('0x5b')));});});};Fax[_0x4130('0x24')][_0x4130('0x5c')]=function(_0x42452b){var _0x3fb289=this;return new BPromise(function(_0x1c6c30,_0x4c5a16){var _0x1dfbe3=_0x3fb289[_0x4130('0x5d')](_0x3fb289[_0x4130('0xd')][_0x42452b[_0x4130('0x58')]][_0x4130('0x5e')],_0x42452b);if(_0x1dfbe3[_0x4130('0x5f')]){_0x1c6c30(ut[_0x4130('0x34')](_0x4130('0x60')));}else{_0x4c5a16(ut[_0x4130('0x34')](_0x1dfbe3[_0x4130('0x34')]));}});};function originate(_0x14e4da,_0xe93622,_0x51b933){return new BPromise(function(_0xf338af,_0x1b6344){if(_0x51b933){var _0x24c16c=util[_0x4130('0x61')]('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[_0x4130('0x36')](_0x14e4da[_0x4130('0x4')])[_0x4130('0x21')],_0x14e4da['path']);gs[_0x4130('0x62')](_0x24c16c)[_0x4130('0x49')](function(){_0x14e4da[_0x4130('0x4')]=util[_0x4130('0x61')](_0x4130('0x63'),path['parse'](_0x14e4da['path'])[_0x4130('0x64')],path[_0x4130('0x36')](_0x14e4da[_0x4130('0x4')])[_0x4130('0x21')]);_0xe93622[_0x4130('0x65')]=_0x14e4da[_0x4130('0x4')];ut[_0x4130('0x45')](_0x4130('0x66'),'');ami[_0x4130('0x67')](ut[_0x4130('0x68')](_0x14e4da,_0xe93622))[_0x4130('0x49')](function(_0x52920b){_0xf338af(_0x52920b);})[_0x4130('0x3c')](function(_0x554035){_0x1b6344(_0x554035);});})[_0x4130('0x3c')](function(_0xd98ba9){_0x1b6344(_0xd98ba9);});}else{ami[_0x4130('0x67')](ut[_0x4130('0x68')](_0x14e4da,_0xe93622))[_0x4130('0x49')](function(_0x3418b3){_0xf338af(_0x3418b3);})['catch'](function(_0x2440de){_0x1b6344(_0x2440de);});}});}Fax[_0x4130('0x24')]['execOriginate']=function(_0x4d774f,_0x1ad093){var _0xbb22d6=this;return new BPromise(function(_0x3d9aca,_0x9d171b){var _0x598b34=uuid['v4']();var _0x5a6eb5=ut[_0x4130('0x69')](_0x4d774f,_0x1ad093);_0xbb22d6[_0x4130('0xf')][_0x598b34]=new Action(_0x598b34,_0x1ad093,_0x4d774f);var _0x6369f=_0xbb22d6[_0x4130('0xf')][_0x598b34];if(path[_0x4130('0x36')](_0x4d774f['path'])['ext']==='.pdf'){originate(_0x6369f,_0x5a6eb5,!![])['then'](function(_0x3b6c49){_0x3d9aca(_0x3b6c49);})[_0x4130('0x3c')](function(_0x541246){_0x9d171b(_0x541246);});}else{originate(_0x6369f,_0x5a6eb5,![])[_0x4130('0x49')](function(_0x500753){_0x3d9aca(_0x500753);})[_0x4130('0x3c')](function(_0x26a33a){_0x9d171b(_0x26a33a);});}});};Fax[_0x4130('0x24')][_0x4130('0x6a')]=function(_0x1b2e42){return!_[_0x4130('0x6b')](_0x1b2e42)&&!_[_0x4130('0x6b')](_0x1b2e42[_0x4130('0x21')])&&!_[_0x4130('0x6b')](_0x1b2e42[_0x4130('0x6c')])&&_0x1b2e42[_0x4130('0x6c')]&&!_[_0x4130('0x6b')](this['trunks'][util[_0x4130('0x61')](_0x4130('0x6d'),_0x1b2e42[_0x4130('0x21')])])&&!_[_0x4130('0x6b')](this[_0x4130('0xe')][util[_0x4130('0x61')](_0x4130('0x6d'),_0x1b2e42[_0x4130('0x21')])]['status'])&&(this[_0x4130('0xe')][util[_0x4130('0x61')](_0x4130('0x6d'),_0x1b2e42[_0x4130('0x21')])][_0x4130('0x6e')]==='reachable'||this[_0x4130('0xe')][util[_0x4130('0x61')](_0x4130('0x6d'),_0x1b2e42[_0x4130('0x21')])][_0x4130('0x6e')]===_0x4130('0x6f'));};Fax[_0x4130('0x24')][_0x4130('0x5d')]=function(_0xcd4daa,_0x1ff68e){if(!this[_0x4130('0x6a')](_0xcd4daa)){ut['logger'](_0x4130('0x70'),_[_0x4130('0x6b')](_0xcd4daa)?'':_0xcd4daa[_0x4130('0x21')]+_0x4130('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x1ff68e[_0x4130('0x38')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x1ff68e));return{'isValid':![],'message':_0x4130('0x72')};}if(_[_0x4130('0x6b')](_0x1ff68e[_0x4130('0x4')])){ut['logger'](_0x4130('0x73'),JSON[_0x4130('0x3e')](_0x1ff68e));return{'isValid':![],'message':_0x4130('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0x4130('0x24')][_0x4130('0x4e')]=function(_0x4664fc,_0x46f9f4=0x2710){if(this[_0x4130('0xc')][_0x4664fc]){setTimeout(()=>{delete this[_0x4130('0xc')][_0x4664fc];},_0x46f9f4);}};module[_0x4130('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 4a7b356..1d25d5a 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 _0x4169=['util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20'];(function(_0x4a79fa,_0xfc16ca){var _0x39a03d=function(_0x448439){while(--_0x448439){_0x4a79fa['push'](_0x4a79fa['shift']());}};_0x39a03d(++_0xfc16ca);}(_0x4169,0x1bc));var _0x9416=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4169[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x9416('0x0'));var BPromise=require(_0x9416('0x1'));var logger=require(_0x9416('0x2'))(_0x9416('0x3'));var _=require('lodash');var faxAccount=require(_0x9416('0x4'));function loggerCatch(_0x85b978){return function(_0x424cd2){logger[_0x9416('0x5')](_0x85b978,util[_0x9416('0x6')](_0x424cd2,{'showHidden':![],'depth':null}));};}exports[_0x9416('0x7')]=function(_0x5219f2,_0x5e0705){return BPromise[_0x9416('0x8')]()[_0x9416('0x9')](faxAccount[_0x9416('0x7')](_0x5219f2,_0x5e0705))[_0x9416('0xa')](loggerCatch(_0x9416('0xb')));}; \ No newline at end of file +var _0x4ade=['preview','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x6f03d8,_0x512b27){var _0x37bb14=function(_0x25aaac){while(--_0x25aaac){_0x6f03d8['push'](_0x6f03d8['shift']());}};_0x37bb14(++_0x512b27);}(_0x4ade,0x13c));var _0xe4ad=function(_0x1065f5,_0xd4dca){_0x1065f5=_0x1065f5-0x0;var _0x333a4d=_0x4ade[_0x1065f5];return _0x333a4d;};'use strict';var util=require(_0xe4ad('0x0'));var BPromise=require(_0xe4ad('0x1'));var logger=require(_0xe4ad('0x2'))(_0xe4ad('0x3'));var _=require('lodash');var faxAccount=require(_0xe4ad('0x4'));function loggerCatch(_0x199d04){return function(_0x51602b){logger[_0xe4ad('0x5')](_0x199d04,util[_0xe4ad('0x6')](_0x51602b,{'showHidden':![],'depth':null}));};}exports[_0xe4ad('0x7')]=function(_0x48e7e0,_0xd7e11e){return BPromise['resolve']()[_0xe4ad('0x8')](faxAccount['notify'](_0x48e7e0,_0xd7e11e))[_0xe4ad('0x9')](loggerCatch(_0xe4ad('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e23cb7d..11ceba0 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 _0xc65f=['info','Exec\x20gs','util','../../../../config/logger','fax','exec'];(function(_0x5ed9f0,_0x4b0b0a){var _0x5b817d=function(_0x34e73b){while(--_0x34e73b){_0x5ed9f0['push'](_0x5ed9f0['shift']());}};_0x5b817d(++_0x4b0b0a);}(_0xc65f,0x152));var _0xfc65=function(_0x4ba8f3,_0x40f5cc){_0x4ba8f3=_0x4ba8f3-0x0;var _0x4571c7=_0xc65f[_0x4ba8f3];return _0x4571c7;};'use strict';var util=require(_0xfc65('0x0'));var logger=require(_0xfc65('0x1'))(_0xfc65('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0xfc65('0x3')];exports['execute']=function(_0x2377ff){return new BPromise(function(_0x280543,_0x585398){exec(_0x2377ff,function(_0x435cbf,_0xdd27f,_0x56a2f4){logger[_0xfc65('0x4')]('Exec\x20gs',_0xdd27f);if(_0x435cbf){logger['info'](_0xfc65('0x5'),'\x20Error\x20:',util['inspect'](_0x435cbf,{'showHidden':![],'depth':null}),_0xdd27f,_0x56a2f4);_0x585398(_0x435cbf);}_0x280543(_0xdd27f);});});}; \ No newline at end of file +var _0x1f74=['child_process','execute','Exec\x20gs','info','inspect','../../../../config/logger','fax','bluebird'];(function(_0x1501fa,_0x377fc1){var _0x1f4dcd=function(_0x25beaf){while(--_0x25beaf){_0x1501fa['push'](_0x1501fa['shift']());}};_0x1f4dcd(++_0x377fc1);}(_0x1f74,0x13d));var _0x41f7=function(_0x302f85,_0x5bcca3){_0x302f85=_0x302f85-0x0;var _0x5ef7cb=_0x1f74[_0x302f85];return _0x5ef7cb;};'use strict';var util=require('util');var logger=require(_0x41f7('0x0'))(_0x41f7('0x1'));var BPromise=require(_0x41f7('0x2'));var exec=require(_0x41f7('0x3'))['exec'];exports[_0x41f7('0x4')]=function(_0x18ed91){return new BPromise(function(_0x9386cc,_0x2d47b2){exec(_0x18ed91,function(_0x48f632,_0x4ea0bb,_0x7d40f8){logger['info'](_0x41f7('0x5'),_0x4ea0bb);if(_0x48f632){logger[_0x41f7('0x6')](_0x41f7('0x5'),'\x20Error\x20:',util[_0x41f7('0x7')](_0x48f632,{'showHidden':![],'depth':null}),_0x4ea0bb,_0x7d40f8);_0x2d47b2(_0x48f632);}_0x9386cc(_0x4ea0bb);});});}; \ 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 3cf4fae..226f1b6 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 _0x4ac5=['localstationid','path','variablesAction','uniqueid','originate','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','message','info','inspect','ecm','minrate','format','\x22%s\x22','modem'];(function(_0x35e793,_0x2cd49e){var _0x4effe8=function(_0x215c03){while(--_0x215c03){_0x35e793['push'](_0x35e793['shift']());}};_0x4effe8(++_0x2cd49e);}(_0x4ac5,0x1ed));var _0x54ac=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0x4ac5[_0x25d4ee];return _0x214a35;};'use strict';var util=require(_0x54ac('0x0'));var _=require(_0x54ac('0x1'));var moment=require(_0x54ac('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x54ac('0x3')]=function(_0x58dbef){return{'message':_0x58dbef};};exports['logger']=function(_0x550cb6,_0x2ba68f){logger[_0x54ac('0x4')](_0x550cb6,util[_0x54ac('0x5')](_0x2ba68f,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4a518d,_0x408b97){var _0x59bc6a={'XMF-ECM':_0x408b97[_0x54ac('0x6')],'XMF-HEADERINFO':_0x408b97['headerinfo'],'XMF-MINRATE':_0x408b97[_0x54ac('0x7')],'XMF-MAXRATE':_0x408b97['maxrate'],'XMF-MODEM':util[_0x54ac('0x8')](_0x54ac('0x9'),_0x408b97[_0x54ac('0xa')]),'XMF-GATEWAY':_0x408b97['gateway'],'XMF-FAXDETECT':_0x408b97['faxdetect'],'XMF-T38TIMEOUT':_0x408b97['t38timeout'],'XMF-LOCALSTATIONID':_0x408b97[_0x54ac('0xb')],'XMF-PATH':_0x4a518d[_0x54ac('0xc')]};return _0x59bc6a;};exports[_0x54ac('0xd')]=function(_0x19e388,_0x221d39){return{'actionid':_0x19e388[_0x54ac('0xe')],'action':_0x54ac('0xf'),'channel':_0x19e388['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format'](_0x54ac('0x10'),_0x19e388[_0x54ac('0x11')]?_0x19e388[_0x54ac('0x11')]:'',_0x19e388[_0x54ac('0xb')]),'variable':_0x221d39,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19e388['uniqueid']};}; \ No newline at end of file +var _0x2fa3=['\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x2b25a1,_0x57543c){var _0x50fd42=function(_0x1f081d){while(--_0x1f081d){_0x2b25a1['push'](_0x2b25a1['shift']());}};_0x50fd42(++_0x57543c);}(_0x2fa3,0xf4));var _0x32fa=function(_0x543a27,_0x283777){_0x543a27=_0x543a27-0x0;var _0x5c6560=_0x2fa3[_0x543a27];return _0x5c6560;};'use strict';var util=require(_0x32fa('0x0'));var _=require(_0x32fa('0x1'));var moment=require(_0x32fa('0x2'));var logger=require(_0x32fa('0x3'))(_0x32fa('0x4'));exports[_0x32fa('0x5')]=function(_0xbf4515){return{'message':_0xbf4515};};exports[_0x32fa('0x6')]=function(_0x59343b,_0x5ff54b){logger[_0x32fa('0x7')](_0x59343b,util[_0x32fa('0x8')](_0x5ff54b,{'showHidden':![],'depth':null}));};exports[_0x32fa('0x9')]=function(_0xb88ee8,_0x3e5aaf){var _0x13d657={'XMF-ECM':_0x3e5aaf[_0x32fa('0xa')],'XMF-HEADERINFO':_0x3e5aaf[_0x32fa('0xb')],'XMF-MINRATE':_0x3e5aaf[_0x32fa('0xc')],'XMF-MAXRATE':_0x3e5aaf[_0x32fa('0xd')],'XMF-MODEM':util[_0x32fa('0xe')](_0x32fa('0xf'),_0x3e5aaf[_0x32fa('0x10')]),'XMF-GATEWAY':_0x3e5aaf[_0x32fa('0x11')],'XMF-FAXDETECT':_0x3e5aaf[_0x32fa('0x12')],'XMF-T38TIMEOUT':_0x3e5aaf['t38timeout'],'XMF-LOCALSTATIONID':_0x3e5aaf[_0x32fa('0x13')],'XMF-PATH':_0xb88ee8[_0x32fa('0x14')]};return _0x13d657;};exports['variablesAction']=function(_0x10b24a,_0x12628c){return{'actionid':_0x10b24a[_0x32fa('0x15')],'action':_0x32fa('0x16'),'channel':_0x10b24a[_0x32fa('0x17')],'Exten':_0x32fa('0x18'),'Context':_0x32fa('0x19'),'Priority':'1','callerid':util[_0x32fa('0xe')](_0x32fa('0x1a'),_0x10b24a[_0x32fa('0xb')]?_0x10b24a['headerinfo']:'',_0x10b24a[_0x32fa('0x13')]),'variable':_0x12628c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x10b24a[_0x32fa('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index fb03b37..2f478b7 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 _0x2f03=['initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','inspect','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','getVoiceQueues','getTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts'];(function(_0x4525b9,_0x5a0570){var _0x1474a9=function(_0x4be23f){while(--_0x4be23f){_0x4525b9['push'](_0x4525b9['shift']());}};_0x1474a9(++_0x5a0570);}(_0x2f03,0x1a7));var _0x32f0=function(_0x4fa077,_0x5b1fcd){_0x4fa077=_0x4fa077-0x0;var _0x1b799f=_0x2f03[_0x4fa077];return _0x1b799f;};'use strict';var util=require(_0x32f0('0x0'));var moment=require(_0x32f0('0x1'));var server=require(_0x32f0('0x2'));var Realtime=require(_0x32f0('0x3'));var Report=require('./report');var Acw=require(_0x32f0('0x4'));var Trigger=require(_0x32f0('0x5'));var Dialer=require(_0x32f0('0x6'));var Preview=require(_0x32f0('0x7'));var Fax=require(_0x32f0('0x8'));var user=require(_0x32f0('0x9'));var voiceQueue=require(_0x32f0('0xa'));var voiceQueueReport=require(_0x32f0('0xb'));var voiceCallReport=require(_0x32f0('0xc'));var trunk=require(_0x32f0('0xd'));var trigger=require(_0x32f0('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x32f0('0xf'));var campaign=require(_0x32f0('0x10'));var voiceExtension=require(_0x32f0('0x11'));var faxAccount=require(_0x32f0('0x12'));var zendesk=require(_0x32f0('0x13'));var salesforce=require(_0x32f0('0x14'));var sugarcrm=require(_0x32f0('0x15'));var freshdesk=require(_0x32f0('0x16'));var desk=require(_0x32f0('0x17'));var zoho=require(_0x32f0('0x18'));var vtiger=require(_0x32f0('0x19'));var freshsales=require(_0x32f0('0x1a'));var servicenow=require(_0x32f0('0x1b'));var dynamics365=require(_0x32f0('0x1c'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x32f0('0x1d'))(_0x32f0('0x1e'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x32f0('0x1f')](_0x32f0('0x20'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x32f0('0x1f')](_0x32f0('0x20'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x32f0('0x21')]()[_0x32f0('0x22')](user[_0x32f0('0x23')]())[_0x32f0('0x22')](realtime[_0x32f0('0x24')]())[_0x32f0('0x22')](user['getTelephones']())[_0x32f0('0x22')](realtime[_0x32f0('0x25')]())[_0x32f0('0x22')](trunk[_0x32f0('0x26')]())[_0x32f0('0x22')](realtime['initTrunks']())[_0x32f0('0x22')](voiceQueue[_0x32f0('0x27')]())['then'](realtime['initVoiceQueues']())[_0x32f0('0x22')](trigger[_0x32f0('0x28')]())['then'](realtime['initTriggers']())[_0x32f0('0x22')](template['getTemplates']())['then'](realtime['initTemplates']())[_0x32f0('0x22')](zendesk[_0x32f0('0x29')]())['then'](realtime[_0x32f0('0x2a')]())[_0x32f0('0x22')](salesforce[_0x32f0('0x2b')]())[_0x32f0('0x22')](realtime[_0x32f0('0x2c')]())[_0x32f0('0x22')](sugarcrm[_0x32f0('0x2d')]())['then'](realtime['initSugarcrmAccounts']())[_0x32f0('0x22')](freshdesk['getFreshdeskAccounts']())[_0x32f0('0x22')](realtime['initFreshdeskAccounts']())['then'](desk[_0x32f0('0x2e')]())[_0x32f0('0x22')](realtime[_0x32f0('0x2f')]())[_0x32f0('0x22')](zoho[_0x32f0('0x30')]())[_0x32f0('0x22')](realtime[_0x32f0('0x31')]())[_0x32f0('0x22')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0x32f0('0x22')](freshsales[_0x32f0('0x32')]())['then'](realtime[_0x32f0('0x33')]())[_0x32f0('0x22')](servicenow['getServicenowAccounts']())[_0x32f0('0x22')](realtime[_0x32f0('0x34')]())[_0x32f0('0x22')](dynamics365['getDynamics365Accounts']())[_0x32f0('0x22')](realtime[_0x32f0('0x35')]())[_0x32f0('0x22')](campaign['getCampaigns']())['then'](realtime[_0x32f0('0x36')]())[_0x32f0('0x22')](voiceExtension['getVoiceExtensions']())[_0x32f0('0x22')](realtime[_0x32f0('0x37')]())[_0x32f0('0x22')](faxAccount[_0x32f0('0x38')]())['then'](realtime['initFaxAccounts']())[_0x32f0('0x22')](function(){return realtime;});}function initParams(){return Promise[_0x32f0('0x21')]()['then'](voiceQueueReport[_0x32f0('0x39')]())[_0x32f0('0x22')](realtime[_0x32f0('0x3a')]())[_0x32f0('0x22')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x32f0('0x22')](realtime[_0x32f0('0x3b')]())[_0x32f0('0x22')](cmHopperHistory[_0x32f0('0x3c')]())[_0x32f0('0x22')](realtime['initCampaignHopperHistory']())[_0x32f0('0x22')](voiceCallReport['getVoiceCallReports']())[_0x32f0('0x22')](realtime[_0x32f0('0x3d')]())[_0x32f0('0x3e')](function(_0x4e5989){logger[_0x32f0('0x3f')](_0x32f0('0x40'),util['inspect'](_0x4e5989,{'showHidden':![],'depth':null}));});}function main(){return server[_0x32f0('0x41')](realtime,preview,fax)[_0x32f0('0x22')](function(){return initRealtime();})[_0x32f0('0x22')](function(){return initParams();})[_0x32f0('0x22')](function(){report[_0x32f0('0x42')]();setInterval(initRealtime,0x1388);})[_0x32f0('0x3e')](function(_0x1b6ca9){logger[_0x32f0('0x3f')]('[index.js][main]',util[_0x32f0('0x43')](_0x1b6ca9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x60d6=['initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','./realtime','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','getAgents','initAgents','then','initTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory'];(function(_0x269c0d,_0x1b043c){var _0x4d2301=function(_0xc13a0b){while(--_0xc13a0b){_0x269c0d['push'](_0x269c0d['shift']());}};_0x4d2301(++_0x1b043c);}(_0x60d6,0x154));var _0x660d=function(_0x2c97b5,_0x5764f2){_0x2c97b5=_0x2c97b5-0x0;var _0x2877b9=_0x60d6[_0x2c97b5];return _0x2877b9;};'use strict';var util=require(_0x660d('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x660d('0x1'));var Report=require(_0x660d('0x2'));var Acw=require(_0x660d('0x3'));var Trigger=require(_0x660d('0x4'));var Dialer=require('./dialer');var Preview=require(_0x660d('0x5'));var Fax=require('./fax');var user=require(_0x660d('0x6'));var voiceQueue=require(_0x660d('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x660d('0x8'));var template=require(_0x660d('0x9'));var cmHopperHistory=require(_0x660d('0xa'));var campaign=require(_0x660d('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x660d('0xc'));var freshdesk=require(_0x660d('0xd'));var desk=require(_0x660d('0xe'));var zoho=require(_0x660d('0xf'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x660d('0x10'));var servicenow=require(_0x660d('0x11'));var dynamics365=require(_0x660d('0x12'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x660d('0x13'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x660d('0x14')](_0x660d('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x660d('0x16')]()['then'](user[_0x660d('0x17')]())['then'](realtime[_0x660d('0x18')]())[_0x660d('0x19')](user['getTelephones']())[_0x660d('0x19')](realtime[_0x660d('0x1a')]())[_0x660d('0x19')](trunk[_0x660d('0x1b')]())[_0x660d('0x19')](realtime['initTrunks']())[_0x660d('0x19')](voiceQueue[_0x660d('0x1c')]())['then'](realtime['initVoiceQueues']())['then'](trigger[_0x660d('0x1d')]())['then'](realtime[_0x660d('0x1e')]())['then'](template[_0x660d('0x1f')]())['then'](realtime['initTemplates']())[_0x660d('0x19')](zendesk[_0x660d('0x20')]())[_0x660d('0x19')](realtime[_0x660d('0x21')]())['then'](salesforce[_0x660d('0x22')]())[_0x660d('0x19')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x660d('0x23')]())[_0x660d('0x19')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x660d('0x24')]())[_0x660d('0x19')](realtime[_0x660d('0x25')]())['then'](desk[_0x660d('0x26')]())['then'](realtime[_0x660d('0x27')]())['then'](zoho[_0x660d('0x28')]())[_0x660d('0x19')](realtime[_0x660d('0x29')]())[_0x660d('0x19')](vtiger[_0x660d('0x2a')]())[_0x660d('0x19')](realtime[_0x660d('0x2b')]())[_0x660d('0x19')](freshsales[_0x660d('0x2c')]())['then'](realtime['initFreshsalesAccounts']())[_0x660d('0x19')](servicenow[_0x660d('0x2d')]())[_0x660d('0x19')](realtime[_0x660d('0x2e')]())['then'](dynamics365[_0x660d('0x2f')]())['then'](realtime['initDynamics365Accounts']())[_0x660d('0x19')](campaign['getCampaigns']())['then'](realtime[_0x660d('0x30')]())[_0x660d('0x19')](voiceExtension[_0x660d('0x31')]())[_0x660d('0x19')](realtime[_0x660d('0x32')]())[_0x660d('0x19')](faxAccount[_0x660d('0x33')]())[_0x660d('0x19')](realtime['initFaxAccounts']())[_0x660d('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x660d('0x16')]()[_0x660d('0x19')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x660d('0x34')]())[_0x660d('0x19')](cmHopperHistory[_0x660d('0x35')]())[_0x660d('0x19')](realtime[_0x660d('0x36')]())[_0x660d('0x19')](cmHopperHistory[_0x660d('0x37')]())['then'](realtime[_0x660d('0x38')]())[_0x660d('0x19')](voiceCallReport[_0x660d('0x39')]())[_0x660d('0x19')](realtime[_0x660d('0x3a')]())[_0x660d('0x3b')](function(_0x203ce4){logger[_0x660d('0x3c')](_0x660d('0x3d'),util[_0x660d('0x3e')](_0x203ce4,{'showHidden':![],'depth':null}));});}function main(){return server[_0x660d('0x3f')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x660d('0x19')](function(){return initParams();})['then'](function(){report[_0x660d('0x40')]();setInterval(initRealtime,0x1388);})[_0x660d('0x3b')](function(_0x703cbb){logger[_0x660d('0x3c')](_0x660d('0x41'),util[_0x660d('0x3e')](_0x703cbb,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 87f83dd..9a733bd 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 _0x68ec=['md5','ioredis','../../../config/environment','redis','localhost','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','idle','statePause','toNumber','name','voiceStatusCallerIdNumber','stringify','format','user:%s','user:ami:update','omit','emit','user:presence','lodash','util'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x68ec,0x12e));var _0xc68e=function(_0xe56a81,_0x211068){_0xe56a81=_0xe56a81-0x0;var _0xde5222=_0x68ec[_0xe56a81];return _0xde5222;};'use strict';var _=require(_0xc68e('0x0'));var util=require(_0xc68e('0x1'));var moment=require('moment');var md5=require(_0xc68e('0x2'));var Redis=require(_0xc68e('0x3'));var config=require(_0xc68e('0x4'));config[_0xc68e('0x5')]=_['defaults'](config[_0xc68e('0x5')],{'host':_0xc68e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x4d2504){this['id']=_0x4d2504['id']||0x0;this['name']=_0x4d2504['name']||'';this['email']=_0x4d2504[_0xc68e('0x7')]||'';this['accountcode']=_0x4d2504[_0xc68e('0x8')]||'';this[_0xc68e('0x9')]=_0x4d2504['fullname']||'';this[_0xc68e('0xa')]='unknown';this[_0xc68e('0xb')]=0x0;this[_0xc68e('0xc')]=_0xc68e('0xd');this[_0xc68e('0xe')]='';this[_0xc68e('0xf')]='';this[_0xc68e('0x10')]='';this[_0xc68e('0x11')]='';this[_0xc68e('0x12')]=_0x4d2504[_0xc68e('0x12')]||![];this[_0xc68e('0x13')]='unknown';this[_0xc68e('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xc68e('0x15')]='';this[_0xc68e('0x16')]=![];this['local']=![];this['md5']='';}Agent[_0xc68e('0x17')][_0xc68e('0x18')]=function(_0xa4e8e5){var _0x1ceb7b;if(_0xa4e8e5&&_0xa4e8e5[_0xc68e('0xa')]){_0x1ceb7b=_0xa4e8e5['state'][_0xc68e('0x19')]();switch(_0x1ceb7b){case'not_inuse':_0x1ceb7b=_0xc68e('0x1a');break;case'inuse':_0x1ceb7b='talking';break;}}if(_0x1ceb7b&&this['voiceStatus']!==_0x1ceb7b||_0xa4e8e5[_0xc68e('0x1b')]){this[_0xc68e('0x14')]=_[_0xc68e('0x1c')](moment()['format']('x'));}if(_0x1ceb7b){this[_0xc68e('0x13')]=_0x1ceb7b;}var _0x2e8796={'id':this['id'],'name':this[_0xc68e('0x1d')],'email':this['email'],'accountcode':this[_0xc68e('0x8')],'fullname':this[_0xc68e('0x9')],'state':this[_0xc68e('0xa')],'stateTime':this[_0xc68e('0xb')],'status':this['status'],'address':this[_0xc68e('0xe')],'online':this[_0xc68e('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xc68e('0x14')],'voiceStatusCallerIdNumber':this[_0xc68e('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xc68e('0x11')],'onhold':this[_0xc68e('0x16')]};var _0x3253f3=md5(JSON[_0xc68e('0x1f')](_0x2e8796));if(this[_0xc68e('0x2')]!==_0x3253f3){this[_0xc68e('0x2')]=_0x3253f3;io['to'](util[_0xc68e('0x20')](_0xc68e('0x21'),_0x2e8796[_0xc68e('0x1d')]))['emit'](_0xc68e('0x22'),_[_0xc68e('0x23')](_0x2e8796,[_0xc68e('0x12')]));io[_0xc68e('0x24')](_0xc68e('0x25'),_0x2e8796);}};module['exports']=Agent; \ No newline at end of file +var _0x3003=['unknown','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','talking','statePause','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:ami:update','omit','user:presence','lodash','moment','md5','ioredis','redis','socket.io-emitter','name','email','accountcode','fullname','stateTime','status'];(function(_0x552b03,_0x48e023){var _0x14ab19=function(_0x58fb5e){while(--_0x58fb5e){_0x552b03['push'](_0x552b03['shift']());}};_0x14ab19(++_0x48e023);}(_0x3003,0x14a));var _0x3300=function(_0x4e036c,_0x24129f){_0x4e036c=_0x4e036c-0x0;var _0x1c14c8=_0x3003[_0x4e036c];return _0x1c14c8;};'use strict';var _=require(_0x3300('0x0'));var util=require('util');var moment=require(_0x3300('0x1'));var md5=require(_0x3300('0x2'));var Redis=require(_0x3300('0x3'));var config=require('../../../config/environment');config[_0x3300('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3300('0x5'))(new Redis(config[_0x3300('0x4')]));function Agent(_0x2d1705){this['id']=_0x2d1705['id']||0x0;this[_0x3300('0x6')]=_0x2d1705[_0x3300('0x6')]||'';this[_0x3300('0x7')]=_0x2d1705[_0x3300('0x7')]||'';this['accountcode']=_0x2d1705[_0x3300('0x8')]||'';this[_0x3300('0x9')]=_0x2d1705[_0x3300('0x9')]||'';this['state']='unknown';this[_0x3300('0xa')]=0x0;this[_0x3300('0xb')]=_0x3300('0xc');this[_0x3300('0xd')]='';this['phone']='';this[_0x3300('0xe')]='';this[_0x3300('0xf')]='';this[_0x3300('0x10')]=_0x2d1705[_0x3300('0x10')]||![];this[_0x3300('0x11')]=_0x3300('0xc');this[_0x3300('0x12')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x3300('0x13')]='';this[_0x3300('0x14')]=![];this[_0x3300('0x15')]=![];this[_0x3300('0x2')]='';}Agent[_0x3300('0x16')][_0x3300('0x17')]=function(_0x1423db){var _0x298810;if(_0x1423db&&_0x1423db[_0x3300('0x18')]){_0x298810=_0x1423db['state'][_0x3300('0x19')]();switch(_0x298810){case _0x3300('0x1a'):_0x298810=_0x3300('0x1b');break;case'inuse':_0x298810=_0x3300('0x1c');break;}}if(_0x298810&&this[_0x3300('0x11')]!==_0x298810||_0x1423db[_0x3300('0x1d')]){this[_0x3300('0x12')]=_['toNumber'](moment()[_0x3300('0x1e')]('x'));}if(_0x298810){this[_0x3300('0x11')]=_0x298810;}var _0x4f918d={'id':this['id'],'name':this[_0x3300('0x6')],'email':this['email'],'accountcode':this[_0x3300('0x8')],'fullname':this[_0x3300('0x9')],'state':this[_0x3300('0x18')],'stateTime':this[_0x3300('0xa')],'status':this['status'],'address':this[_0x3300('0xd')],'online':this[_0x3300('0x10')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3300('0x12')],'voiceStatusCallerIdNumber':this[_0x3300('0x1f')],'voiceStatusQueue':this[_0x3300('0x13')],'interface':this[_0x3300('0xf')],'onhold':this[_0x3300('0x14')]};var _0x2c6600=md5(JSON[_0x3300('0x20')](_0x4f918d));if(this['md5']!==_0x2c6600){this[_0x3300('0x2')]=_0x2c6600;io['to'](util['format'](_0x3300('0x21'),_0x4f918d[_0x3300('0x6')]))[_0x3300('0x22')](_0x3300('0x23'),_[_0x3300('0x24')](_0x4f918d,['online']));io[_0x3300('0x22')](_0x3300('0x25'),_0x4f918d);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 726c863..0959c25 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 _0xcb9a=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence'];(function(_0x392489,_0x5b9e38){var _0x460a04=function(_0x26fc58){while(--_0x26fc58){_0x392489['push'](_0x392489['shift']());}};_0x460a04(++_0x5b9e38);}(_0xcb9a,0x159));var _0xacb9=function(_0x5db2e5,_0x5ade38){_0x5db2e5=_0x5db2e5-0x0;var _0x40953f=_0xcb9a[_0x5db2e5];return _0x40953f;};'use strict';function Campaign(_0x4d19f5){this['id']=_0x4d19f5['id']||0x0;this['name']=_0x4d19f5['name']||'';this['type']=_0x4d19f5[_0xacb9('0x0')]||'campaign';this[_0xacb9('0x1')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xacb9('0x2')]=0x0;this['message']='';this[_0xacb9('0x3')]=!![];this[_0xacb9('0x4')]=_0x4d19f5[_0xacb9('0x4')];this[_0xacb9('0x5')]=_0x4d19f5[_0xacb9('0x5')];this[_0xacb9('0x6')]=_0x4d19f5[_0xacb9('0x6')]||null;this['dialGlobalInterval']=_0x4d19f5[_0xacb9('0x7')]?_0x4d19f5[_0xacb9('0x7')]:null;this['dialOriginateCallerIdName']=_0x4d19f5[_0xacb9('0x8')];this[_0xacb9('0x9')]=_0x4d19f5[_0xacb9('0x9')];this['dialOriginateTimeout']=_0x4d19f5[_0xacb9('0xa')]||0x1e;this[_0xacb9('0xb')]=_0x4d19f5['dialCongestionMaxRetry'];this[_0xacb9('0xc')]=_0x4d19f5[_0xacb9('0xc')];this['dialBusyMaxRetry']=_0x4d19f5[_0xacb9('0xd')];this[_0xacb9('0xe')]=_0x4d19f5[_0xacb9('0xe')];this['dialNoAnswerMaxRetry']=_0x4d19f5['dialNoAnswerMaxRetry'];this[_0xacb9('0xf')]=_0x4d19f5[_0xacb9('0xf')];this[_0xacb9('0x10')]=_0x4d19f5[_0xacb9('0x10')];this[_0xacb9('0x11')]=_0x4d19f5['dialNoSuchNumberMaxRetry']||0x3;this[_0xacb9('0x12')]=_0x4d19f5[_0xacb9('0x12')]||0x96;this['dialDropMaxRetry']=_0x4d19f5[_0xacb9('0x13')]||0x3;this[_0xacb9('0x14')]=_0x4d19f5['dialDropRetryFrequency']||0x96;this[_0xacb9('0x15')]=_0x4d19f5[_0xacb9('0x15')]||0x3;this[_0xacb9('0x16')]=_0x4d19f5[_0xacb9('0x16')]||0x96;this[_0xacb9('0x17')]=_0x4d19f5['dialMachineMaxRetry']||0x3;this[_0xacb9('0x18')]=_0x4d19f5[_0xacb9('0x18')]||0x96;this[_0xacb9('0x19')]=_0x4d19f5[_0xacb9('0x19')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4d19f5['dialAgentRejectRetryFrequency']||0x96;this[_0xacb9('0x1a')]=_0x4d19f5[_0xacb9('0x1a')]||_0xacb9('0x1b');this[_0xacb9('0x1c')]=_0x4d19f5[_0xacb9('0x1c')]||undefined;this[_0xacb9('0x1d')]=_0x4d19f5[_0xacb9('0x1d')]||undefined;this[_0xacb9('0x1e')]=_0x4d19f5['dialCutDigit']||undefined;this[_0xacb9('0x1f')]=_0x4d19f5[_0xacb9('0x1f')]?_0x4d19f5[_0xacb9('0x1f')]:undefined;this['Trunk']=_0x4d19f5[_0xacb9('0x20')]?_0x4d19f5[_0xacb9('0x20')]:undefined;this[_0xacb9('0x21')]=_0x4d19f5['Interval']?_0x4d19f5[_0xacb9('0x21')]:undefined;this[_0xacb9('0x22')]=_0x4d19f5[_0xacb9('0x22')]?_0x4d19f5[_0xacb9('0x22')]:undefined;this[_0xacb9('0x23')]=_0x4d19f5[_0xacb9('0x22')]?_0x4d19f5[_0xacb9('0x22')][_0xacb9('0x24')]:undefined;this['dialAMDActive']=_0x4d19f5[_0xacb9('0x25')]||![];this['dialAMDInitialSilence']=_0x4d19f5[_0xacb9('0x26')];this[_0xacb9('0x27')]=_0x4d19f5[_0xacb9('0x27')];this[_0xacb9('0x28')]=_0x4d19f5[_0xacb9('0x28')];this[_0xacb9('0x29')]=_0x4d19f5['dialAMDTotalAnalysisTime'];this[_0xacb9('0x2a')]=_0x4d19f5['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x4d19f5[_0xacb9('0x2b')];this[_0xacb9('0x2c')]=_0x4d19f5[_0xacb9('0x2c')];this[_0xacb9('0x2d')]=_0x4d19f5[_0xacb9('0x2d')];this['dialAMDMaximumWordLength']=_0x4d19f5[_0xacb9('0x2e')];}module[_0xacb9('0x2f')]=Campaign; \ No newline at end of file +var _0x2d7a=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x457a48,_0x1a119c){var _0x15a2e9=function(_0x43017a){while(--_0x43017a){_0x457a48['push'](_0x457a48['shift']());}};_0x15a2e9(++_0x1a119c);}(_0x2d7a,0xdd));var _0xa2d7=function(_0xe86606,_0x2804a3){_0xe86606=_0xe86606-0x0;var _0x7cbd97=_0x2d7a[_0xe86606];return _0x7cbd97;};'use strict';function Campaign(_0x28d7d1){this['id']=_0x28d7d1['id']||0x0;this['name']=_0x28d7d1[_0xa2d7('0x0')]||'';this[_0xa2d7('0x1')]=_0x28d7d1['type']||_0xa2d7('0x2');this[_0xa2d7('0x3')]=0x0;this[_0xa2d7('0x4')]=0x0;this[_0xa2d7('0x5')]=0x0;this[_0xa2d7('0x6')]=0x0;this[_0xa2d7('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0xa2d7('0x8')]=_0x28d7d1[_0xa2d7('0x8')];this[_0xa2d7('0x9')]=_0x28d7d1['limitCalls'];this[_0xa2d7('0xa')]=_0x28d7d1[_0xa2d7('0xa')]||null;this[_0xa2d7('0xb')]=_0x28d7d1[_0xa2d7('0xb')]?_0x28d7d1['dialGlobalInterval']:null;this[_0xa2d7('0xc')]=_0x28d7d1[_0xa2d7('0xc')];this[_0xa2d7('0xd')]=_0x28d7d1[_0xa2d7('0xd')];this[_0xa2d7('0xe')]=_0x28d7d1[_0xa2d7('0xe')]||0x1e;this[_0xa2d7('0xf')]=_0x28d7d1[_0xa2d7('0xf')];this[_0xa2d7('0x10')]=_0x28d7d1[_0xa2d7('0x10')];this[_0xa2d7('0x11')]=_0x28d7d1[_0xa2d7('0x11')];this[_0xa2d7('0x12')]=_0x28d7d1[_0xa2d7('0x12')];this[_0xa2d7('0x13')]=_0x28d7d1[_0xa2d7('0x13')];this[_0xa2d7('0x14')]=_0x28d7d1[_0xa2d7('0x14')];this['dialGlobalMaxRetry']=_0x28d7d1[_0xa2d7('0x15')];this[_0xa2d7('0x16')]=_0x28d7d1[_0xa2d7('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x28d7d1[_0xa2d7('0x17')]||0x96;this[_0xa2d7('0x18')]=_0x28d7d1[_0xa2d7('0x18')]||0x3;this['dialDropRetryFrequency']=_0x28d7d1[_0xa2d7('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x28d7d1[_0xa2d7('0x1a')]||0x3;this[_0xa2d7('0x1b')]=_0x28d7d1[_0xa2d7('0x1b')]||0x96;this[_0xa2d7('0x1c')]=_0x28d7d1['dialMachineMaxRetry']||0x3;this[_0xa2d7('0x1d')]=_0x28d7d1[_0xa2d7('0x1d')]||0x96;this[_0xa2d7('0x1e')]=_0x28d7d1[_0xa2d7('0x1e')]||0x3;this[_0xa2d7('0x1f')]=_0x28d7d1[_0xa2d7('0x1f')]||0x96;this[_0xa2d7('0x20')]=_0x28d7d1[_0xa2d7('0x20')]||'DESC';this[_0xa2d7('0x21')]=_0x28d7d1[_0xa2d7('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x28d7d1[_0xa2d7('0x22')]||undefined;this[_0xa2d7('0x23')]=_0x28d7d1[_0xa2d7('0x23')]||undefined;this['TrunkBackup']=_0x28d7d1['TrunkBackup']?_0x28d7d1[_0xa2d7('0x24')]:undefined;this[_0xa2d7('0x25')]=_0x28d7d1[_0xa2d7('0x25')]?_0x28d7d1[_0xa2d7('0x25')]:undefined;this[_0xa2d7('0x26')]=_0x28d7d1['Interval']?_0x28d7d1[_0xa2d7('0x26')]:undefined;this['SquareProject']=_0x28d7d1[_0xa2d7('0x27')]?_0x28d7d1[_0xa2d7('0x27')]:undefined;this['dialQueueProject']=_0x28d7d1[_0xa2d7('0x27')]?_0x28d7d1['SquareProject'][_0xa2d7('0x0')]:undefined;this[_0xa2d7('0x28')]=_0x28d7d1[_0xa2d7('0x28')]||![];this[_0xa2d7('0x29')]=_0x28d7d1[_0xa2d7('0x29')];this[_0xa2d7('0x2a')]=_0x28d7d1[_0xa2d7('0x2a')];this[_0xa2d7('0x2b')]=_0x28d7d1[_0xa2d7('0x2b')];this[_0xa2d7('0x2c')]=_0x28d7d1['dialAMDTotalAnalysisTime'];this[_0xa2d7('0x2d')]=_0x28d7d1[_0xa2d7('0x2d')];this[_0xa2d7('0x2e')]=_0x28d7d1[_0xa2d7('0x2e')];this[_0xa2d7('0x2f')]=_0x28d7d1['dialAMDMaximumNumberOfWords'];this[_0xa2d7('0x30')]=_0x28d7d1[_0xa2d7('0x30')];this[_0xa2d7('0x31')]=_0x28d7d1[_0xa2d7('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c799cc6..fe0a071 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 _0x26b2=['disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','abandoned','lastapplication','lastdata','holdtime','type','tag'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26b2,0xc5));var _0x226b=function(_0x159183,_0x56fa20){_0x159183=_0x159183-0x0;var _0x36e9d4=_0x26b2[_0x159183];return _0x36e9d4;};'use strict';function Channel(){this[_0x226b('0x0')]=null;this[_0x226b('0x1')]='';this[_0x226b('0x2')]='';this['calleridnum']=0x0;this[_0x226b('0x3')]='';this[_0x226b('0x4')]=undefined;this[_0x226b('0x5')]=undefined;this[_0x226b('0x6')]=0x0;this[_0x226b('0x7')]='';this[_0x226b('0x8')]=0x0;this[_0x226b('0x9')]=0x0;this[_0x226b('0xa')]=0x0;this[_0x226b('0xb')]=![];this['answertime']=null;this[_0x226b('0xc')]=null;this['unmanaged']=![];this[_0x226b('0xd')]=![];this[_0x226b('0xe')]='';this[_0x226b('0xf')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x226b('0x10')]=0x0;this[_0x226b('0x11')]=null;this[_0x226b('0x12')]=null;this[_0x226b('0x13')]=null;this[_0x226b('0x14')]=![];this[_0x226b('0x15')]=null;this['queue']=null;this[_0x226b('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x226b('0x17')]=undefined;this[_0x226b('0x18')]=undefined;this[_0x226b('0x19')]=0x0;}module[_0x226b('0x1a')]=Channel; \ No newline at end of file +var _0xbb59=['connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum'];(function(_0x13069a,_0x2a68e8){var _0x50d9ba=function(_0x1fdb61){while(--_0x1fdb61){_0x13069a['push'](_0x13069a['shift']());}};_0x50d9ba(++_0x2a68e8);}(_0xbb59,0xec));var _0x9bb5=function(_0x42dbce,_0x257134){_0x42dbce=_0x42dbce-0x0;var _0x18a97d=_0xbb59[_0x42dbce];return _0x18a97d;};'use strict';function Channel(){this[_0x9bb5('0x0')]=null;this[_0x9bb5('0x1')]='';this[_0x9bb5('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x9bb5('0x3')]=undefined;this[_0x9bb5('0x4')]=undefined;this[_0x9bb5('0x5')]=0x0;this[_0x9bb5('0x6')]='';this[_0x9bb5('0x7')]=0x0;this['linkedid']=0x0;this[_0x9bb5('0x8')]=0x0;this[_0x9bb5('0x9')]=![];this[_0x9bb5('0xa')]=null;this[_0x9bb5('0xb')]=null;this[_0x9bb5('0xc')]=![];this[_0x9bb5('0xd')]=![];this[_0x9bb5('0xe')]='';this[_0x9bb5('0xf')]='';this[_0x9bb5('0x10')]=0x0;this[_0x9bb5('0x11')]=0x0;this[_0x9bb5('0x12')]=0x0;this[_0x9bb5('0x13')]=null;this[_0x9bb5('0x14')]=null;this['disposition']=null;this[_0x9bb5('0x15')]=![];this[_0x9bb5('0x16')]=null;this[_0x9bb5('0x17')]=null;this[_0x9bb5('0x18')]=[];this[_0x9bb5('0x19')]=undefined;this[_0x9bb5('0x1a')]=undefined;this[_0x9bb5('0x1b')]=undefined;this[_0x9bb5('0x1c')]=0x0;}module[_0x9bb5('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 495dcfa..c1d959d 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 _0xde83=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x1c5164,_0x3556a4){var _0x12e023=function(_0x334429){while(--_0x334429){_0x1c5164['push'](_0x1c5164['shift']());}};_0x12e023(++_0x3556a4);}(_0xde83,0x1cf));var _0x3de8=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xde83[_0x379799];return _0x46e431;};'use strict';function DeskAccount(_0x4dee70){this['id']=_0x4dee70['id']||0x0;this[_0x3de8('0x0')]=_0x4dee70[_0x3de8('0x0')]||'';this[_0x3de8('0x1')]=_0x4dee70['username']||'';this['remoteUri']=_0x4dee70[_0x3de8('0x2')]||'';this[_0x3de8('0x3')]=_0x4dee70[_0x3de8('0x3')]||'';this['password']=_0x4dee70[_0x3de8('0x4')]||'';this[_0x3de8('0x5')]=_0x4dee70[_0x3de8('0x5')]||'';this[_0x3de8('0x6')]=_0x4dee70['consumerSecret']||'';this[_0x3de8('0x7')]=_0x4dee70[_0x3de8('0x7')]||'';this['tokenSecret']=_0x4dee70[_0x3de8('0x8')]||'';this['type']=_0x4dee70[_0x3de8('0x9')]||'';this[_0x3de8('0xa')]=_0x4dee70[_0x3de8('0xa')]||'';this[_0x3de8('0xb')]=_0x4dee70['Configurations']||{};}module[_0x3de8('0xc')]=DeskAccount; \ No newline at end of file +var _0x2e2e=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','consumerKey','consumerSecret','token'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x2e2e,0x1bd));var _0xe2e2=function(_0x49f466,_0x5b7ab9){_0x49f466=_0x49f466-0x0;var _0xf4957f=_0x2e2e[_0x49f466];return _0xf4957f;};'use strict';function DeskAccount(_0x3a9a32){this['id']=_0x3a9a32['id']||0x0;this[_0xe2e2('0x0')]=_0x3a9a32['name']||'';this[_0xe2e2('0x1')]=_0x3a9a32[_0xe2e2('0x1')]||'';this[_0xe2e2('0x2')]=_0x3a9a32[_0xe2e2('0x2')]||'';this['authType']=_0x3a9a32['authType']||'';this['password']=_0x3a9a32['password']||'';this[_0xe2e2('0x3')]=_0x3a9a32['consumerKey']||'';this[_0xe2e2('0x4')]=_0x3a9a32[_0xe2e2('0x4')]||'';this[_0xe2e2('0x5')]=_0x3a9a32[_0xe2e2('0x5')]||'';this['tokenSecret']=_0x3a9a32[_0xe2e2('0x6')]||'';this[_0xe2e2('0x7')]=_0x3a9a32[_0xe2e2('0x7')]||'';this[_0xe2e2('0x8')]=_0x3a9a32[_0xe2e2('0x8')]||'';this['Configurations']=_0x3a9a32[_0xe2e2('0x9')]||{};}module[_0xe2e2('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 3cfc8ee..461df30 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 _0x46c6=['remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x174959,_0x332b53){var _0x101dd9=function(_0x2671df){while(--_0x2671df){_0x174959['push'](_0x174959['shift']());}};_0x101dd9(++_0x332b53);}(_0x46c6,0x8c));var _0x646c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46c6[_0x4ae6ef];return _0x3cbb4e;};'use strict';function Dynamics365Account(_0x363abc){this['id']=_0x363abc['id']||0x0;this['name']=_0x363abc[_0x646c('0x0')]||'';this['username']=_0x363abc[_0x646c('0x1')]||'';this[_0x646c('0x2')]=_0x363abc[_0x646c('0x2')]||'';this[_0x646c('0x3')]=_0x363abc['remoteUri']||'';this['tenantId']=_0x363abc['tenantId']||'';this[_0x646c('0x4')]=_0x363abc[_0x646c('0x4')]||'';this[_0x646c('0x5')]=_0x363abc['clientSecret']||{};this[_0x646c('0x6')]=_0x363abc['serverUrl']||'';this[_0x646c('0x7')]=_0x363abc[_0x646c('0x7')]||![];this[_0x646c('0x8')]=_0x363abc[_0x646c('0x8')]||{};this['CloudProvider']=_0x363abc[_0x646c('0x9')]||{};}module[_0x646c('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x31cb=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x31cb,0x68));var _0xb31c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x31cb[_0x5ddb1c];return _0x354adc;};'use strict';function Dynamics365Account(_0x475921){this['id']=_0x475921['id']||0x0;this[_0xb31c('0x0')]=_0x475921[_0xb31c('0x0')]||'';this['username']=_0x475921[_0xb31c('0x1')]||'';this[_0xb31c('0x2')]=_0x475921[_0xb31c('0x2')]||'';this['remoteUri']=_0x475921[_0xb31c('0x3')]||'';this[_0xb31c('0x4')]=_0x475921[_0xb31c('0x4')]||'';this['clientId']=_0x475921[_0xb31c('0x5')]||'';this[_0xb31c('0x6')]=_0x475921[_0xb31c('0x6')]||{};this[_0xb31c('0x7')]=_0x475921[_0xb31c('0x7')]||'';this[_0xb31c('0x8')]=_0x475921[_0xb31c('0x8')]||![];this[_0xb31c('0x9')]=_0x475921[_0xb31c('0x9')]||{};this[_0xb31c('0xa')]=_0x475921[_0xb31c('0xa')]||{};}module[_0xb31c('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b1b3991..242c68d 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 _0xfebb=['tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfebb,0x65));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x179f0c){this['id']=_0x179f0c['id']||0x0;this['name']=_0x179f0c[_0xbfeb('0x0')]||'';this[_0xbfeb('0x1')]=_0x179f0c[_0xbfeb('0x1')];this['ecm']=_0x179f0c[_0xbfeb('0x2')];this[_0xbfeb('0x3')]=_0x179f0c[_0xbfeb('0x3')];this[_0xbfeb('0x4')]=_0x179f0c[_0xbfeb('0x4')];this['minrate']=_0x179f0c[_0xbfeb('0x5')]||0x960;this[_0xbfeb('0x6')]=_0x179f0c[_0xbfeb('0x6')]||0x3840;this[_0xbfeb('0x7')]=_0x179f0c[_0xbfeb('0x7')]||'v17,v27,v29';this[_0xbfeb('0x8')]=_0x179f0c[_0xbfeb('0x8')]||'no';this[_0xbfeb('0x9')]=_0x179f0c[_0xbfeb('0x9')]||'no';this['t38timeout']=_0x179f0c[_0xbfeb('0xa')]||0x1388;this[_0xbfeb('0xb')]=_0x179f0c[_0xbfeb('0xb')]||_0xbfeb('0xc');this[_0xbfeb('0xd')]=_0x179f0c[_0xbfeb('0xd')]?_0x179f0c[_0xbfeb('0xd')]:undefined;this[_0xbfeb('0xe')]=_0x179f0c[_0xbfeb('0xe')];this['key']=_0x179f0c['key'];}module[_0xbfeb('0xf')]=FaxAccount; \ No newline at end of file +var _0xcc81=['gateway','faxdetect','t38timeout','Trunk','ListId','key','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcc81,0x19c));var _0x1cc8=function(_0x4066c2,_0xad48e8){_0x4066c2=_0x4066c2-0x0;var _0x3870a0=_0xcc81[_0x4066c2];return _0x3870a0;};'use strict';function FaxAccount(_0x28e9cd){this['id']=_0x28e9cd['id']||0x0;this['name']=_0x28e9cd['name']||'';this[_0x1cc8('0x0')]=_0x28e9cd[_0x1cc8('0x0')];this[_0x1cc8('0x1')]=_0x28e9cd[_0x1cc8('0x1')];this[_0x1cc8('0x2')]=_0x28e9cd[_0x1cc8('0x2')];this['localstationid']=_0x28e9cd[_0x1cc8('0x3')];this[_0x1cc8('0x4')]=_0x28e9cd['minrate']||0x960;this[_0x1cc8('0x5')]=_0x28e9cd[_0x1cc8('0x5')]||0x3840;this[_0x1cc8('0x6')]=_0x28e9cd[_0x1cc8('0x6')]||_0x1cc8('0x7');this[_0x1cc8('0x8')]=_0x28e9cd[_0x1cc8('0x8')]||'no';this[_0x1cc8('0x9')]=_0x28e9cd[_0x1cc8('0x9')]||'no';this['t38timeout']=_0x28e9cd[_0x1cc8('0xa')]||0x1388;this['tech']=_0x28e9cd['tech']||'SIP';this[_0x1cc8('0xb')]=_0x28e9cd[_0x1cc8('0xb')]?_0x28e9cd['Trunk']:undefined;this[_0x1cc8('0xc')]=_0x28e9cd['ListId'];this[_0x1cc8('0xd')]=_0x28e9cd['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 418db7f..74b5e8a 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 _0x9c3e=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x3a96e2,_0x5ecb0f){var _0x2c1e1f=function(_0x1fc4b3){while(--_0x1fc4b3){_0x3a96e2['push'](_0x3a96e2['shift']());}};_0x2c1e1f(++_0x5ecb0f);}(_0x9c3e,0x1ed));var _0xe9c3=function(_0xdcfd77,_0x35df91){_0xdcfd77=_0xdcfd77-0x0;var _0x525851=_0x9c3e[_0xdcfd77];return _0x525851;};'use strict';function FreshdeskAccount(_0x12c6a4){this['id']=_0x12c6a4['id']||0x0;this[_0xe9c3('0x0')]=_0x12c6a4[_0xe9c3('0x0')]||'';this[_0xe9c3('0x1')]=_0x12c6a4[_0xe9c3('0x1')]||'';this[_0xe9c3('0x2')]=_0x12c6a4[_0xe9c3('0x3')]||'';this[_0xe9c3('0x4')]=_0x12c6a4[_0xe9c3('0x4')]||'';this['serverUrl']=_0x12c6a4[_0xe9c3('0x5')]||'';this['Configurations']=_0x12c6a4[_0xe9c3('0x6')]||{};}module[_0xe9c3('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x2e90=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x2e90,0x191));var _0x02e9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2e90[_0x3ab51d];return _0x29a04e;};'use strict';function FreshdeskAccount(_0x45e612){this['id']=_0x45e612['id']||0x0;this[_0x02e9('0x0')]=_0x45e612[_0x02e9('0x0')]||'';this['username']=_0x45e612[_0x02e9('0x1')]||'';this[_0x02e9('0x2')]=_0x45e612['token']||'';this['remoteUri']=_0x45e612[_0x02e9('0x3')]||'';this[_0x02e9('0x4')]=_0x45e612[_0x02e9('0x4')]||'';this['Configurations']=_0x45e612[_0x02e9('0x5')]||{};}module[_0x02e9('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 c8bd7b2..5085c49 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 _0x3561=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x52b758,_0x238dbf){var _0x5d75c6=function(_0x1e273f){while(--_0x1e273f){_0x52b758['push'](_0x52b758['shift']());}};_0x5d75c6(++_0x238dbf);}(_0x3561,0x94));var _0x1356=function(_0x3ea3c0,_0x219832){_0x3ea3c0=_0x3ea3c0-0x0;var _0xbe35f3=_0x3561[_0x3ea3c0];return _0xbe35f3;};'use strict';function FreshsalesAccount(_0x217c29){this['id']=_0x217c29['id']||0x0;this['name']=_0x217c29[_0x1356('0x0')]||'';this[_0x1356('0x1')]=_0x217c29[_0x1356('0x1')]||'';this[_0x1356('0x2')]=_0x217c29[_0x1356('0x3')]||'';this[_0x1356('0x4')]=_0x217c29[_0x1356('0x4')]||'';this[_0x1356('0x5')]=_0x217c29[_0x1356('0x5')]||'';this[_0x1356('0x6')]=_0x217c29[_0x1356('0x6')]||{};}module[_0x1356('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xafca=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4c67ab,_0x520352){var _0x2fc779=function(_0x14ba04){while(--_0x14ba04){_0x4c67ab['push'](_0x4c67ab['shift']());}};_0x2fc779(++_0x520352);}(_0xafca,0x1ef));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';function FreshsalesAccount(_0x2222f0){this['id']=_0x2222f0['id']||0x0;this['name']=_0x2222f0[_0xaafc('0x0')]||'';this[_0xaafc('0x1')]=_0x2222f0['username']||'';this['apiKey']=_0x2222f0[_0xaafc('0x2')]||'';this[_0xaafc('0x3')]=_0x2222f0[_0xaafc('0x3')]||'';this[_0xaafc('0x4')]=_0x2222f0[_0xaafc('0x4')]||'';this['Configurations']=_0x2222f0[_0xaafc('0x5')]||{};}module[_0xaafc('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 72dd59b..96b7c13 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 _0x40b6=['calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','motionChannel','mohtime','variables','type','inbound','uniqueid','calleridnum'];(function(_0x5a6aa7,_0xff2a57){var _0x316b32=function(_0x1019fc){while(--_0x1019fc){_0x5a6aa7['push'](_0x5a6aa7['shift']());}};_0x316b32(++_0xff2a57);}(_0x40b6,0x19c));var _0x640b=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x40b6[_0x2a276d];return _0x2914cd;};'use strict';function QueueReport(){this[_0x640b('0x0')]=_0x640b('0x1');this[_0x640b('0x2')]='';this[_0x640b('0x3')]='';this[_0x640b('0x4')]='';this['queue']='';this[_0x640b('0x5')]=null;this[_0x640b('0x6')]=null;this[_0x640b('0x7')]=0x1;this[_0x640b('0x8')]=0x1;this[_0x640b('0x9')]=![];this[_0x640b('0xa')]=null;this[_0x640b('0xb')]=![];this[_0x640b('0xc')]=null;this[_0x640b('0xd')]=![];this[_0x640b('0xe')]=null;this[_0x640b('0xf')]=0x1;this['channel']='';this[_0x640b('0x10')]='';this[_0x640b('0x11')]='';this['accountcode']='';this[_0x640b('0x12')]='';this[_0x640b('0x13')]='';this[_0x640b('0x14')]='';this[_0x640b('0x15')]=0x0;this[_0x640b('0x16')]=![];this['lastAssignedTo']='';this[_0x640b('0x17')]='voice';this[_0x640b('0x18')]=0x0;this[_0x640b('0x19')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xdfd1=['type','uniqueid','calleridname','queue','queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','exports'];(function(_0x22faf2,_0x52fdef){var _0xc9a607=function(_0xb1c29f){while(--_0xb1c29f){_0x22faf2['push'](_0x22faf2['shift']());}};_0xc9a607(++_0x52fdef);}(_0xdfd1,0x108));var _0x1dfd=function(_0x3529b5,_0x635273){_0x3529b5=_0x3529b5-0x0;var _0x59eee5=_0xdfd1[_0x3529b5];return _0x59eee5;};'use strict';function QueueReport(){this[_0x1dfd('0x0')]='inbound';this[_0x1dfd('0x1')]='';this['calleridnum']='';this[_0x1dfd('0x2')]='';this[_0x1dfd('0x3')]='';this[_0x1dfd('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x1dfd('0x5')]=0x1;this[_0x1dfd('0x6')]=![];this[_0x1dfd('0x7')]=null;this[_0x1dfd('0x8')]=![];this['queuecallercompleteAt']=null;this[_0x1dfd('0x9')]=![];this[_0x1dfd('0xa')]=null;this[_0x1dfd('0xb')]=0x1;this[_0x1dfd('0xc')]='';this[_0x1dfd('0xd')]='';this['connectedlinename']='';this['accountcode']='';this[_0x1dfd('0xe')]='';this[_0x1dfd('0xf')]='';this[_0x1dfd('0x10')]='';this[_0x1dfd('0x11')]=0x0;this[_0x1dfd('0x12')]=![];this[_0x1dfd('0x13')]='';this['motionChannel']=_0x1dfd('0x14');this[_0x1dfd('0x15')]=0x0;this[_0x1dfd('0x16')]={};}module[_0x1dfd('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 555f3f6..430cca7 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 _0xd29f=['name','username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x4cbf2e,_0x18774b){var _0x54c2aa=function(_0x4ed019){while(--_0x4ed019){_0x4cbf2e['push'](_0x4cbf2e['shift']());}};_0x54c2aa(++_0x18774b);}(_0xd29f,0xc6));var _0xfd29=function(_0x3399bb,_0x5e7c53){_0x3399bb=_0x3399bb-0x0;var _0x1afd51=_0xd29f[_0x3399bb];return _0x1afd51;};'use strict';function SalesforceAccount(_0x3f63fc){this['id']=_0x3f63fc['id']||0x0;this[_0xfd29('0x0')]=_0x3f63fc['name']||'';this['username']=_0x3f63fc[_0xfd29('0x1')]||'';this[_0xfd29('0x2')]=_0x3f63fc[_0xfd29('0x2')]||'';this[_0xfd29('0x3')]=_0x3f63fc[_0xfd29('0x3')]||'';this[_0xfd29('0x4')]=_0x3f63fc[_0xfd29('0x4')]||'';this['clientSecret']=_0x3f63fc['clientSecret']||'';this[_0xfd29('0x5')]=_0x3f63fc[_0xfd29('0x5')]||'';this[_0xfd29('0x6')]=_0x3f63fc['type']||_0xfd29('0x7');this[_0xfd29('0x8')]=_0x3f63fc[_0xfd29('0x8')]||'';this['Configurations']=_0x3f63fc[_0xfd29('0x9')]||{};}module[_0xfd29('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x1921=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0xc06684,_0x249e00){var _0x2d3063=function(_0x38c167){while(--_0x38c167){_0xc06684['push'](_0xc06684['shift']());}};_0x2d3063(++_0x249e00);}(_0x1921,0xe4));var _0x1192=function(_0x4c6be1,_0x45fe22){_0x4c6be1=_0x4c6be1-0x0;var _0x28e338=_0x1921[_0x4c6be1];return _0x28e338;};'use strict';function SalesforceAccount(_0x1396f2){this['id']=_0x1396f2['id']||0x0;this[_0x1192('0x0')]=_0x1396f2[_0x1192('0x0')]||'';this[_0x1192('0x1')]=_0x1396f2[_0x1192('0x1')]||'';this[_0x1192('0x2')]=_0x1396f2[_0x1192('0x2')]||'';this['password']=_0x1396f2[_0x1192('0x3')]||'';this[_0x1192('0x4')]=_0x1396f2['clientId']||'';this[_0x1192('0x5')]=_0x1396f2[_0x1192('0x5')]||'';this['securityToken']=_0x1396f2[_0x1192('0x6')]||'';this[_0x1192('0x7')]=_0x1396f2[_0x1192('0x7')]||_0x1192('0x8');this[_0x1192('0x9')]=_0x1396f2[_0x1192('0x9')]||'';this[_0x1192('0xa')]=_0x1396f2[_0x1192('0xa')]||{};}module[_0x1192('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 40f66d6..c780a1c 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 _0x81fb=['Configurations','exports','name','password','remoteUri','serverUrl'];(function(_0x42fb38,_0x41ad46){var _0x4dd8ba=function(_0x1cfa76){while(--_0x1cfa76){_0x42fb38['push'](_0x42fb38['shift']());}};_0x4dd8ba(++_0x41ad46);}(_0x81fb,0x164));var _0xb81f=function(_0x174b36,_0x40c21c){_0x174b36=_0x174b36-0x0;var _0x33f942=_0x81fb[_0x174b36];return _0x33f942;};'use strict';function ServicenowAccount(_0x571d89){this['id']=_0x571d89['id']||0x0;this[_0xb81f('0x0')]=_0x571d89[_0xb81f('0x0')]||'';this['username']=_0x571d89['username']||'';this[_0xb81f('0x1')]=_0x571d89['password']||'';this[_0xb81f('0x2')]=_0x571d89['remoteUri']||'';this[_0xb81f('0x3')]=_0x571d89['serverUrl']||'';this[_0xb81f('0x4')]=_0x571d89[_0xb81f('0x4')]||{};}module[_0xb81f('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xc042=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x35c2fc,_0xabea37){var _0x4727fd=function(_0x4eccfe){while(--_0x4eccfe){_0x35c2fc['push'](_0x35c2fc['shift']());}};_0x4727fd(++_0xabea37);}(_0xc042,0x133));var _0x2c04=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xc042[_0x12fc8d];return _0x3f9d04;};'use strict';function ServicenowAccount(_0xcc9ba3){this['id']=_0xcc9ba3['id']||0x0;this[_0x2c04('0x0')]=_0xcc9ba3[_0x2c04('0x0')]||'';this[_0x2c04('0x1')]=_0xcc9ba3[_0x2c04('0x1')]||'';this['password']=_0xcc9ba3['password']||'';this[_0x2c04('0x2')]=_0xcc9ba3[_0x2c04('0x2')]||'';this[_0x2c04('0x3')]=_0xcc9ba3[_0x2c04('0x3')]||'';this['Configurations']=_0xcc9ba3[_0x2c04('0x4')]||{};}module[_0x2c04('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 558d9f7..7b22f62 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 _0xd68d=['exports','name','username','password','serverUrl','Configurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd68d,0x7f));var _0xdd68=function(_0xb0ff1f,_0x34c0bd){_0xb0ff1f=_0xb0ff1f-0x0;var _0x486cf1=_0xd68d[_0xb0ff1f];return _0x486cf1;};'use strict';function SugarcrmAccount(_0x3cfe3d){this['id']=_0x3cfe3d['id']||0x0;this[_0xdd68('0x0')]=_0x3cfe3d['name']||'';this[_0xdd68('0x1')]=_0x3cfe3d[_0xdd68('0x1')]||'';this[_0xdd68('0x2')]=_0x3cfe3d[_0xdd68('0x2')]||'';this['remoteUri']=_0x3cfe3d['remoteUri']||'';this[_0xdd68('0x3')]=_0x3cfe3d[_0xdd68('0x3')]||'';this[_0xdd68('0x4')]=_0x3cfe3d[_0xdd68('0x4')]||{};}module[_0xdd68('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x2e14=['name','username','password','serverUrl'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x2e14,0x158));var _0x42e1=function(_0x1fec86,_0x422ed7){_0x1fec86=_0x1fec86-0x0;var _0x55e897=_0x2e14[_0x1fec86];return _0x55e897;};'use strict';function SugarcrmAccount(_0x249ee5){this['id']=_0x249ee5['id']||0x0;this[_0x42e1('0x0')]=_0x249ee5['name']||'';this[_0x42e1('0x1')]=_0x249ee5['username']||'';this[_0x42e1('0x2')]=_0x249ee5[_0x42e1('0x2')]||'';this['remoteUri']=_0x249ee5['remoteUri']||'';this[_0x42e1('0x3')]=_0x249ee5['serverUrl']||'';this['Configurations']=_0x249ee5['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 b6269de..f609fd8 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 _0x3c90=['exports','name','accountcode','state','unknown','status','address'];(function(_0x208f7c,_0x190e43){var _0x4715d5=function(_0x4fe521){while(--_0x4fe521){_0x208f7c['push'](_0x208f7c['shift']());}};_0x4715d5(++_0x190e43);}(_0x3c90,0xfd));var _0x03c9=function(_0x8fe0cc,_0x2831fd){_0x8fe0cc=_0x8fe0cc-0x0;var _0x532af3=_0x3c90[_0x8fe0cc];return _0x532af3;};'use strict';function Telephone(_0x278319){this['id']=_0x278319['id']||0x0;this[_0x03c9('0x0')]=_0x278319[_0x03c9('0x0')]||'';this[_0x03c9('0x1')]=_0x278319[_0x03c9('0x1')]||'';this[_0x03c9('0x2')]=_0x03c9('0x3');this['stateTime']=0x0;this[_0x03c9('0x4')]='unknown';this[_0x03c9('0x5')]='';}module[_0x03c9('0x6')]=Telephone; \ No newline at end of file +var _0x74b8=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x1d5353,_0xf7fff1){var _0x5632d4=function(_0x4aff7a){while(--_0x4aff7a){_0x1d5353['push'](_0x1d5353['shift']());}};_0x5632d4(++_0xf7fff1);}(_0x74b8,0x86));var _0x874b=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x74b8[_0x9df060];return _0x338dfe;};'use strict';function Telephone(_0x30e856){this['id']=_0x30e856['id']||0x0;this['name']=_0x30e856[_0x874b('0x0')]||'';this[_0x874b('0x1')]=_0x30e856[_0x874b('0x1')]||'';this[_0x874b('0x2')]=_0x874b('0x3');this[_0x874b('0x4')]=0x0;this[_0x874b('0x5')]=_0x874b('0x3');this[_0x874b('0x6')]='';}module[_0x874b('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0466785..148d897 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0xd854dc,_0x3d254b){var _0x1d3ac2=function(_0x2b6d3d){while(--_0x2b6d3d){_0xd854dc['push'](_0xd854dc['shift']());}};_0x1d3ac2(++_0x3d254b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0xb10b[_0x4f4c53];return _0x568ff1;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x1634fc,_0x359242){var _0x562ed5=function(_0x32b5c1){while(--_0x32b5c1){_0x1634fc['push'](_0x1634fc['shift']());}};_0x562ed5(++_0x359242);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b7fc7,_0x60f01e){_0x5b7fc7=_0x5b7fc7-0x0;var _0x3d0bd2=_0xb10b[_0x5b7fc7];return _0x3d0bd2;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index a9d684b..26e0aac 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 _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x1a85,0x178));var _0x51a8=function(_0x2ec7f2,_0xe24da3){_0x2ec7f2=_0x2ec7f2-0x0;var _0x29de00=_0x1a85[_0x2ec7f2];return _0x29de00;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 06a4aaf..0cdd43b 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 _0x9ab1=['active','name','unknown','stateTime','status','registry','host','refresh','stateRegistry','address','defaultuser','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9ab1,0x138));var _0x19ab=function(_0x29248e,_0x53ec76){_0x29248e=_0x29248e-0x0;var _0x41b128=_0x9ab1[_0x29248e];return _0x41b128;};'use strict';function Trunk(_0x513c97){this['id']=_0x513c97['id']||0x0;this[_0x19ab('0x0')]=_0x513c97[_0x19ab('0x0')]||![];this[_0x19ab('0x1')]=_0x513c97[_0x19ab('0x1')]||'';this['state']=_0x19ab('0x2');this[_0x19ab('0x3')]=0x0;this[_0x19ab('0x4')]=_0x19ab('0x2');this['registry']=_0x513c97[_0x19ab('0x5')]&&_0x513c97[_0x19ab('0x5')]['indexOf'](':')?_0x513c97[_0x19ab('0x5')]['split'](':')[0x0]:'';this[_0x19ab('0x6')]='';this['port']='';this['domain']='';this['domainport']='';this[_0x19ab('0x7')]='';this[_0x19ab('0x8')]='unknown';this['registrationtime']='';this[_0x19ab('0x9')]='';this[_0x19ab('0xa')]=_0x513c97['defaultuser']||'';}module[_0x19ab('0xb')]=Trunk; \ No newline at end of file +var _0x90ac=['stateTime','status','registry','host','domain','registrationtime','defaultuser','exports','active','name','state','unknown'];(function(_0x2ed81c,_0x40ebd2){var _0x26a18e=function(_0xf7e635){while(--_0xf7e635){_0x2ed81c['push'](_0x2ed81c['shift']());}};_0x26a18e(++_0x40ebd2);}(_0x90ac,0x1dc));var _0xc90a=function(_0x58f291,_0xf41bf9){_0x58f291=_0x58f291-0x0;var _0x403008=_0x90ac[_0x58f291];return _0x403008;};'use strict';function Trunk(_0x2965d6){this['id']=_0x2965d6['id']||0x0;this['active']=_0x2965d6[_0xc90a('0x0')]||![];this[_0xc90a('0x1')]=_0x2965d6[_0xc90a('0x1')]||'';this[_0xc90a('0x2')]=_0xc90a('0x3');this[_0xc90a('0x4')]=0x0;this[_0xc90a('0x5')]='unknown';this['registry']=_0x2965d6[_0xc90a('0x6')]&&_0x2965d6['registry']['indexOf'](':')?_0x2965d6[_0xc90a('0x6')]['split'](':')[0x0]:'';this[_0xc90a('0x7')]='';this['port']='';this[_0xc90a('0x8')]='';this['domainport']='';this['refresh']='';this['stateRegistry']='unknown';this[_0xc90a('0x9')]='';this['address']='';this[_0xc90a('0xa')]=_0x2965d6[_0xc90a('0xa')]||'';}module[_0xc90a('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index bf74e77..da3c730 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 _0x2a8a=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x4290b3,_0x48f454){var _0x2d12d9=function(_0x1ece14){while(--_0x1ece14){_0x4290b3['push'](_0x4290b3['shift']());}};_0x2d12d9(++_0x48f454);}(_0x2a8a,0x85));var _0xa2a8=function(_0x3b14eb,_0x5ed7ae){_0x3b14eb=_0x3b14eb-0x0;var _0x2ff419=_0x2a8a[_0x3b14eb];return _0x2ff419;};'use strict';function voiceExtension(_0x234396){this['id']=_0x234396['id']||0x0;this[_0xa2a8('0x0')]=_0x234396[_0xa2a8('0x0')]||'';this[_0xa2a8('0x1')]=_0x234396['recordingFormat']||_0xa2a8('0x2');this[_0xa2a8('0x3')]=_0x234396['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x59af=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x320058,_0x3f915f){var _0x1d3780=function(_0x361501){while(--_0x361501){_0x320058['push'](_0x320058['shift']());}};_0x1d3780(++_0x3f915f);}(_0x59af,0x13b));var _0xf59a=function(_0x24b066,_0x4356aa){_0x24b066=_0x24b066-0x0;var _0x594bd1=_0x59af[_0x24b066];return _0x594bd1;};'use strict';function voiceExtension(_0x496eb5){this['id']=_0x496eb5['id']||0x0;this[_0xf59a('0x0')]=_0x496eb5[_0xf59a('0x0')]||'';this[_0xf59a('0x1')]=_0x496eb5[_0xf59a('0x1')]||_0xf59a('0x2');this[_0xf59a('0x3')]=_0x496eb5['mandatoryDisposition']||![];}module[_0xf59a('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 3cc4860..9c2a81a 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 _0xbcba=['predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','monitor_format','type','total','answered','sumDuration','sumBillable','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls'];(function(_0x332f04,_0x30ba54){var _0x430424=function(_0x426142){while(--_0x426142){_0x332f04['push'](_0x332f04['shift']());}};_0x430424(++_0x30ba54);}(_0xbcba,0x198));var _0xabcb=function(_0x30dc94,_0x1fbf9f){_0x30dc94=_0x30dc94-0x0;var _0x270674=_0xbcba[_0x30dc94];return _0x270674;};'use strict';var monitorFormat={'wav':_0xabcb('0x0'),'wav49':_0xabcb('0x1'),'gsm':_0xabcb('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0xabcb('0x3'),'random':'random','ringall':_0xabcb('0x4'),'rr':_0xabcb('0x5'),'rrmemory':_0xabcb('0x6'),'rrordered':_0xabcb('0x7'),'wrandom':_0xabcb('0x8')};function VoiceQueue(_0x4231a2){this['id']=_0x4231a2['id']||0x0;this['name']=_0x4231a2['name']||'';this[_0xabcb('0x9')]=_0x4231a2[_0xabcb('0x9')]||'';this[_0xabcb('0xa')]=_0x4231a2[_0xabcb('0xa')]||'inbound';this['waiting']=0x0;this[_0xabcb('0xb')]=0x0;this[_0xabcb('0xc')]=0x0;this[_0xabcb('0xd')]=0x0;this['sumHoldTime']=0x0;this[_0xabcb('0xe')]=0x0;this['unmanaged']=0x0;this[_0xabcb('0xf')]=0x0;this[_0xabcb('0x10')]=0x0;this[_0xabcb('0x11')]=0x0;this[_0xabcb('0x12')]=0x0;this[_0xabcb('0x13')]=0x0;this[_0xabcb('0x14')]=0x0;this[_0xabcb('0x15')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0xabcb('0x16')]=0x0;this[_0xabcb('0x17')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0xabcb('0x18')]=_0x4231a2[_0xabcb('0x18')]||![];this[_0xabcb('0x19')]=_0x4231a2['acwTimeout']||0xa;this[_0xabcb('0x1a')]=_0x4231a2[_0xabcb('0x1a')]||'no';this[_0xabcb('0x1b')]=!![];this[_0xabcb('0x1c')]='';this[_0xabcb('0x1d')]='';this[_0xabcb('0x1e')]=0x0;this[_0xabcb('0x1f')]=0x0;this[_0xabcb('0x20')]=_0x4231a2[_0xabcb('0x20')]||null;this[_0xabcb('0x21')]=_0x4231a2['dialGlobalInterval']?_0x4231a2[_0xabcb('0x21')]:null;this[_0xabcb('0x22')]=_0x4231a2[_0xabcb('0x22')];this[_0xabcb('0x23')]=_0x4231a2[_0xabcb('0x23')]||_0xabcb('0x24');this['dialLimitChannel']=_0x4231a2[_0xabcb('0x25')]||0x0;this['dialLimitQueue']=_0x4231a2['dialLimitQueue']||0x0;this[_0xabcb('0x26')]=_0x4231a2[_0xabcb('0x26')]||0x1;this[_0xabcb('0x27')]=_0x4231a2[_0xabcb('0x27')]||_0xabcb('0x28');this[_0xabcb('0x29')]=_0x4231a2[_0xabcb('0x29')]||0.03;this[_0xabcb('0x2a')]=_0x4231a2['dialPredictiveInterval']||0x258;this[_0xabcb('0x2b')]=_0x4231a2['dialOriginateCallerIdName']||_0xabcb('0x2c');this['dialOriginateCallerIdNumber']=_0x4231a2[_0xabcb('0x2d')]||_0xabcb('0x2c');this['dialOriginateTimeout']=_0x4231a2[_0xabcb('0x2e')]||0x1e;this['dialQueueOptions']=_0x4231a2['dialQueueOptions']||_0xabcb('0x2f');this[_0xabcb('0x30')]=_0x4231a2['dialQueueTimeout']||0x3;this[_0xabcb('0x31')]=_0x4231a2[_0xabcb('0x31')]||undefined;this[_0xabcb('0x32')]=_0x4231a2['dialCongestionMaxRetry']||0x3;this[_0xabcb('0x33')]=_0x4231a2[_0xabcb('0x33')]||0x96;this[_0xabcb('0x34')]=_0x4231a2[_0xabcb('0x34')]||0x3;this[_0xabcb('0x35')]=_0x4231a2[_0xabcb('0x35')]||0x96;this['dialNoAnswerMaxRetry']=_0x4231a2[_0xabcb('0x36')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4231a2['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4231a2[_0xabcb('0x37')]||0x3;this[_0xabcb('0x38')]=_0x4231a2[_0xabcb('0x38')]||0x96;this[_0xabcb('0x39')]=_0x4231a2[_0xabcb('0x39')]||0x3;this[_0xabcb('0x3a')]=_0x4231a2[_0xabcb('0x3a')]||0x96;this[_0xabcb('0x3b')]=_0x4231a2[_0xabcb('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x4231a2['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x4231a2[_0xabcb('0x3c')]||0x3;this[_0xabcb('0x3d')]=_0x4231a2[_0xabcb('0x3d')]||0x96;this[_0xabcb('0x3e')]=_0x4231a2[_0xabcb('0x3e')]||0x3;this[_0xabcb('0x3f')]=_0x4231a2['dialAgentRejectRetryFrequency']||0x96;this[_0xabcb('0x40')]=_0x4231a2['callAdditionalPhoneAfterMin']||0x3;this[_0xabcb('0x41')]=_0x4231a2[_0xabcb('0x41')]||0x4;this['Trunk']=_0x4231a2[_0xabcb('0x42')]?_0x4231a2['Trunk']:undefined;this[_0xabcb('0x43')]=_0x4231a2[_0xabcb('0x43')]?_0x4231a2[_0xabcb('0x43')]:undefined;this[_0xabcb('0x44')]=_0x4231a2[_0xabcb('0x44')]||undefined;this['Interval']=_0x4231a2[_0xabcb('0x45')]?_0x4231a2[_0xabcb('0x45')]:undefined;this[_0xabcb('0x46')]=_0x4231a2['dialOrderByScheduledAt']||_0xabcb('0x47');this[_0xabcb('0x48')]=_0x4231a2[_0xabcb('0x48')]||undefined;this[_0xabcb('0x49')]=_0x4231a2[_0xabcb('0x49')]||undefined;this['strategy']=strategy[_0x4231a2[_0xabcb('0x4a')]];this[_0xabcb('0x4b')]=!![];this[_0xabcb('0x4c')]=_0x4231a2[_0xabcb('0x4c')]||![];this['dialAMDInitialSilence']=_0x4231a2[_0xabcb('0x4d')];this[_0xabcb('0x4e')]=_0x4231a2[_0xabcb('0x4e')];this[_0xabcb('0x4f')]=_0x4231a2[_0xabcb('0x4f')];this['dialAMDTotalAnalysisTime']=_0x4231a2[_0xabcb('0x50')];this[_0xabcb('0x51')]=_0x4231a2['dialAMDMinWordLength'];this[_0xabcb('0x52')]=_0x4231a2[_0xabcb('0x52')];this[_0xabcb('0x53')]=_0x4231a2[_0xabcb('0x53')];this[_0xabcb('0x54')]=_0x4231a2[_0xabcb('0x54')];this[_0xabcb('0x55')]=_0x4231a2[_0xabcb('0x55')];this[_0xabcb('0x56')]=0x0;this['pTalking']=0x0;this[_0xabcb('0x57')]=_0x4231a2['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xabcb('0x58')]=0x0;this[_0xabcb('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xabcb('0x5a')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xabcb('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xabcb('0x5c')]=0x0;this[_0xabcb('0x5d')]=0x0;this[_0xabcb('0x5e')]=0x0;this[_0xabcb('0x5f')]=0x0;this[_0xabcb('0x60')]=undefined;this[_0xabcb('0x61')]=undefined;this['handlePredictive']=undefined;this[_0xabcb('0x62')]=1.05;this[_0xabcb('0x63')]=0x0;this[_0xabcb('0x64')]=0x0;this[_0xabcb('0x65')]=0x0;this[_0xabcb('0x66')]=0x0;this[_0xabcb('0x67')]=0x0;this[_0xabcb('0x68')]=0x0;this[_0xabcb('0x69')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xabcb('0x6a')]=_0x4231a2[_0xabcb('0x6b')]||0x14;this[_0xabcb('0x6c')]=_0x4231a2[_0xabcb('0x6b')]||0xa;this[_0xabcb('0x6d')]=0x0;this[_0xabcb('0x6e')]=0x0;this[_0xabcb('0x6f')]=0x1;this[_0xabcb('0x70')]=0x0;this[_0xabcb('0x71')]=0x0;this[_0xabcb('0x72')]=0x0;this[_0xabcb('0x73')]=0x0;this[_0xabcb('0x74')]=_0x4231a2[_0xabcb('0x74')]||0x1e;this['dialRecallInQueue']=_0x4231a2[_0xabcb('0x75')]||![];this[_0xabcb('0x76')]=!!_0x4231a2[_0xabcb('0x76')]||![];this[_0xabcb('0x77')]=!!_0x4231a2[_0xabcb('0x77')]||![];this[_0xabcb('0x78')]=_0x4231a2[_0xabcb('0x78')]||undefined;this[_0xabcb('0x79')]=_0x4231a2[_0xabcb('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x4231a2[_0xabcb('0x7a')]||![];this[_0xabcb('0x9')]=monitorFormat[_0x4231a2[_0xabcb('0x9')]]?monitorFormat[_0x4231a2['monitor_format']]:undefined;this['mandatoryDisposition']=_0x4231a2[_0xabcb('0x7b')]||![];this['mandatoryDispositionPause']=_0x4231a2['mandatoryDispositionPause']?_0x4231a2[_0xabcb('0x7c')]:undefined;this[_0xabcb('0x7d')]=![];}module[_0xabcb('0x7e')]=VoiceQueue; \ No newline at end of file +var _0xcd59=['dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','busy','inUse','notInUse','onHold','paused','ringing','ringInUse','talking','unknown','acw','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber'];(function(_0x1ca3dc,_0x5d77cf){var _0x4c1ddc=function(_0x3a2236){while(--_0x3a2236){_0x1ca3dc['push'](_0x1ca3dc['shift']());}};_0x4c1ddc(++_0x5d77cf);}(_0xcd59,0x14b));var _0x9cd5=function(_0x5f4ce2,_0x42c469){_0x5f4ce2=_0x5f4ce2-0x0;var _0x219b5b=_0xcd59[_0x5f4ce2];return _0x219b5b;};'use strict';var monitorFormat={'wav':_0x9cd5('0x0'),'wav49':_0x9cd5('0x1'),'gsm':_0x9cd5('0x2')};var strategy={'fewestcalls':_0x9cd5('0x3'),'leastrecent':_0x9cd5('0x4'),'linear':_0x9cd5('0x5'),'random':'random','ringall':_0x9cd5('0x6'),'rr':_0x9cd5('0x7'),'rrmemory':_0x9cd5('0x8'),'rrordered':_0x9cd5('0x9'),'wrandom':_0x9cd5('0xa')};function VoiceQueue(_0x2db192){this['id']=_0x2db192['id']||0x0;this[_0x9cd5('0xb')]=_0x2db192[_0x9cd5('0xb')]||'';this[_0x9cd5('0xc')]=_0x2db192[_0x9cd5('0xc')]||'';this['type']=_0x2db192[_0x9cd5('0xd')]||_0x9cd5('0xe');this[_0x9cd5('0xf')]=0x0;this[_0x9cd5('0x10')]=0x0;this[_0x9cd5('0x11')]=0x0;this[_0x9cd5('0x12')]=0x0;this[_0x9cd5('0x13')]=0x0;this[_0x9cd5('0x14')]=0x0;this['unmanaged']=0x0;this[_0x9cd5('0x15')]=0x0;this[_0x9cd5('0x16')]=0x0;this[_0x9cd5('0x17')]=0x0;this[_0x9cd5('0x18')]=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x9cd5('0x19')]=0x0;this[_0x9cd5('0x1a')]=0x0;this[_0x9cd5('0x1b')]=0x0;this[_0x9cd5('0x1c')]=0x0;this[_0x9cd5('0x1d')]=0x0;this[_0x9cd5('0x1e')]=0x0;this['unavailable']=0x0;this[_0x9cd5('0x1f')]=0x0;this[_0x9cd5('0x20')]=_0x2db192[_0x9cd5('0x20')]||![];this['acwTimeout']=_0x2db192['acwTimeout']||0xa;this['autopause']=_0x2db192[_0x9cd5('0x21')]||'no';this[_0x9cd5('0x22')]=!![];this['message']='';this[_0x9cd5('0x23')]='';this[_0x9cd5('0x24')]=0x0;this[_0x9cd5('0x25')]=0x0;this['dialTimezone']=_0x2db192[_0x9cd5('0x26')]||null;this[_0x9cd5('0x27')]=_0x2db192[_0x9cd5('0x27')]?_0x2db192[_0x9cd5('0x27')]:null;this[_0x9cd5('0x28')]=_0x2db192[_0x9cd5('0x28')];this['dialMethod']=_0x2db192[_0x9cd5('0x29')]||_0x9cd5('0x2a');this[_0x9cd5('0x2b')]=_0x2db192[_0x9cd5('0x2b')]||0x0;this[_0x9cd5('0x2c')]=_0x2db192['dialLimitQueue']||0x0;this[_0x9cd5('0x2d')]=_0x2db192[_0x9cd5('0x2d')]||0x1;this[_0x9cd5('0x2e')]=_0x2db192[_0x9cd5('0x2e')]||_0x9cd5('0x2f');this[_0x9cd5('0x30')]=_0x2db192[_0x9cd5('0x30')]||0.03;this[_0x9cd5('0x31')]=_0x2db192[_0x9cd5('0x31')]||0x258;this['dialOriginateCallerIdName']=_0x2db192[_0x9cd5('0x32')]||_0x9cd5('0x33');this[_0x9cd5('0x34')]=_0x2db192[_0x9cd5('0x34')]||'anonymous';this[_0x9cd5('0x35')]=_0x2db192[_0x9cd5('0x35')]||0x1e;this[_0x9cd5('0x36')]=_0x2db192[_0x9cd5('0x36')]||_0x9cd5('0x37');this[_0x9cd5('0x38')]=_0x2db192[_0x9cd5('0x38')]||0x3;this['dialQueueProject']=_0x2db192[_0x9cd5('0x39')]||undefined;this[_0x9cd5('0x3a')]=_0x2db192[_0x9cd5('0x3a')]||0x3;this['dialCongestionRetryFrequency']=_0x2db192['dialCongestionRetryFrequency']||0x96;this[_0x9cd5('0x3b')]=_0x2db192['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x2db192[_0x9cd5('0x3c')]||0x96;this[_0x9cd5('0x3d')]=_0x2db192[_0x9cd5('0x3d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2db192[_0x9cd5('0x3e')]||0x96;this[_0x9cd5('0x3f')]=_0x2db192[_0x9cd5('0x3f')]||0x3;this[_0x9cd5('0x40')]=_0x2db192[_0x9cd5('0x40')]||0x96;this[_0x9cd5('0x41')]=_0x2db192[_0x9cd5('0x41')]||0x3;this[_0x9cd5('0x42')]=_0x2db192[_0x9cd5('0x42')]||0x96;this[_0x9cd5('0x43')]=_0x2db192[_0x9cd5('0x43')]||0x3;this[_0x9cd5('0x44')]=_0x2db192[_0x9cd5('0x44')]||0x96;this[_0x9cd5('0x45')]=_0x2db192['dialMachineMaxRetry']||0x3;this[_0x9cd5('0x46')]=_0x2db192[_0x9cd5('0x46')]||0x96;this['dialAgentRejectMaxRetry']=_0x2db192['dialAgentRejectMaxRetry']||0x3;this[_0x9cd5('0x47')]=_0x2db192[_0x9cd5('0x47')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2db192[_0x9cd5('0x48')]||0x3;this['dialGlobalMaxRetry']=_0x2db192['dialGlobalMaxRetry']||0x4;this[_0x9cd5('0x49')]=_0x2db192[_0x9cd5('0x49')]?_0x2db192[_0x9cd5('0x49')]:undefined;this[_0x9cd5('0x4a')]=_0x2db192['TrunkBackup']?_0x2db192[_0x9cd5('0x4a')]:undefined;this[_0x9cd5('0x4b')]=_0x2db192[_0x9cd5('0x4b')]||undefined;this['Interval']=_0x2db192[_0x9cd5('0x4c')]?_0x2db192[_0x9cd5('0x4c')]:undefined;this[_0x9cd5('0x4d')]=_0x2db192[_0x9cd5('0x4d')]||_0x9cd5('0x4e');this[_0x9cd5('0x4f')]=_0x2db192[_0x9cd5('0x4f')]||undefined;this[_0x9cd5('0x50')]=_0x2db192[_0x9cd5('0x50')]||undefined;this[_0x9cd5('0x51')]=strategy[_0x2db192[_0x9cd5('0x51')]];this['queueStatusComplete']=!![];this[_0x9cd5('0x52')]=_0x2db192['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2db192[_0x9cd5('0x53')];this[_0x9cd5('0x54')]=_0x2db192[_0x9cd5('0x54')];this[_0x9cd5('0x55')]=_0x2db192['dialAMDAfterGreetingSilence'];this[_0x9cd5('0x56')]=_0x2db192[_0x9cd5('0x56')];this[_0x9cd5('0x57')]=_0x2db192[_0x9cd5('0x57')];this['dialAMDBetweenWordsSilence']=_0x2db192[_0x9cd5('0x58')];this[_0x9cd5('0x59')]=_0x2db192[_0x9cd5('0x59')];this[_0x9cd5('0x5a')]=_0x2db192[_0x9cd5('0x5a')];this[_0x9cd5('0x5b')]=_0x2db192['dialAMDMaximumWordLength'];this[_0x9cd5('0x5c')]=0x0;this[_0x9cd5('0x5d')]=0x0;this[_0x9cd5('0x5e')]=_0x2db192[_0x9cd5('0x5e')];this[_0x9cd5('0x5f')]=0x0;this[_0x9cd5('0x60')]=0x0;this[_0x9cd5('0x61')]=0x0;this[_0x9cd5('0x62')]=0x0;this[_0x9cd5('0x63')]=0x0;this[_0x9cd5('0x64')]=0x0;this[_0x9cd5('0x65')]=0x0;this[_0x9cd5('0x66')]=0x0;this[_0x9cd5('0x67')]=0x0;this[_0x9cd5('0x68')]=0x0;this[_0x9cd5('0x69')]=0x0;this[_0x9cd5('0x6a')]=0x0;this[_0x9cd5('0x6b')]=0x0;this[_0x9cd5('0x6c')]=0x0;this['startProgressive']=undefined;this[_0x9cd5('0x6d')]=undefined;this['handlePredictive']=undefined;this[_0x9cd5('0x6e')]=1.05;this[_0x9cd5('0x6f')]=0x0;this[_0x9cd5('0x70')]=0x0;this[_0x9cd5('0x71')]=0x0;this[_0x9cd5('0x72')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x9cd5('0x73')]=0x0;this[_0x9cd5('0x74')]=0x0;this[_0x9cd5('0x75')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2db192[_0x9cd5('0x76')]||0x14;this[_0x9cd5('0x77')]=_0x2db192[_0x9cd5('0x76')]||0xa;this[_0x9cd5('0x78')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x9cd5('0x79')]=0x1;this[_0x9cd5('0x7a')]=0x0;this[_0x9cd5('0x7b')]=0x0;this[_0x9cd5('0x7c')]=0x0;this[_0x9cd5('0x7d')]=0x0;this[_0x9cd5('0x7e')]=_0x2db192[_0x9cd5('0x7e')]||0x1e;this[_0x9cd5('0x7f')]=_0x2db192[_0x9cd5('0x7f')]||![];this[_0x9cd5('0x80')]=!!_0x2db192[_0x9cd5('0x80')]||![];this[_0x9cd5('0x81')]=!!_0x2db192[_0x9cd5('0x81')]||![];this[_0x9cd5('0x82')]=_0x2db192[_0x9cd5('0x82')]||undefined;this[_0x9cd5('0x83')]=_0x2db192[_0x9cd5('0x83')]||![];this[_0x9cd5('0x84')]=_0x2db192['dialAgiAfterHangupAgent']||![];this[_0x9cd5('0xc')]=monitorFormat[_0x2db192[_0x9cd5('0xc')]]?monitorFormat[_0x2db192[_0x9cd5('0xc')]]:undefined;this[_0x9cd5('0x85')]=_0x2db192['mandatoryDisposition']||![];this[_0x9cd5('0x86')]=_0x2db192[_0x9cd5('0x86')]?_0x2db192['mandatoryDispositionPause']:undefined;this[_0x9cd5('0x87')]=![];}module[_0x9cd5('0x88')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 1df05a7..cb302c2 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe767=['statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','pTalking','sumBillable','name','strategy','abandoned','answered','available','busy','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message'];(function(_0x53ee38,_0x7ccc5c){var _0xa65ff7=function(_0x44707b){while(--_0x44707b){_0x53ee38['push'](_0x53ee38['shift']());}};_0xa65ff7(++_0x7ccc5c);}(_0xe767,0x11e));var _0x7e76=function(_0x1c3ade,_0x611c4c){_0x1c3ade=_0x1c3ade-0x0;var _0x1fbd3f=_0xe767[_0x1c3ade];return _0x1fbd3f;};'use strict';var INBOUND_COUNTERS=['available',_0x7e76('0x0'),_0x7e76('0x1'),_0x7e76('0x2'),_0x7e76('0x3'),_0x7e76('0x4'),_0x7e76('0x5')];var OUTBOUND_COUNTERS=['available','answered',_0x7e76('0x6'),'loggedIn',_0x7e76('0x1'),'originated',_0x7e76('0x7'),_0x7e76('0x8'),_0x7e76('0x9'),_0x7e76('0xa'),_0x7e76('0xb'),_0x7e76('0xc'),_0x7e76('0xd'),'outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused',_0x7e76('0xe'),_0x7e76('0x4'),_0x7e76('0xf'),'sumDuration','total',_0x7e76('0x5')];function VoiceQueueSummary(_0x5127bd){this['id']=_0x5127bd['id'];this[_0x7e76('0x10')]=_0x5127bd[_0x7e76('0x10')];this[_0x7e76('0x11')]=_0x5127bd['strategy'];this[_0x7e76('0x12')]=_0x5127bd[_0x7e76('0x12')]||0x0;this[_0x7e76('0x13')]=_0x5127bd[_0x7e76('0x13')]||0x0;this[_0x7e76('0x14')]=_0x5127bd[_0x7e76('0x14')]||0x0;this[_0x7e76('0x15')]=_0x5127bd[_0x7e76('0x15')]||0x0;this[_0x7e76('0x6')]=_0x5127bd[_0x7e76('0x6')]||0x0;this['invalid']=_0x5127bd[_0x7e76('0x16')]||0x0;this[_0x7e76('0x0')]=_0x5127bd[_0x7e76('0x0')]||0x0;this[_0x7e76('0x1')]=_0x5127bd['loggedInDb']||0x0;this[_0x7e76('0x17')]=_0x5127bd[_0x7e76('0x17')]||0x0;this[_0x7e76('0x18')]=_0x5127bd['notInUse']||0x0;this[_0x7e76('0x2')]=_0x5127bd[_0x7e76('0x2')]||0x0;this[_0x7e76('0x3')]=_0x5127bd['ringing']||0x0;this[_0x7e76('0x19')]=_0x5127bd[_0x7e76('0x19')];this['sumBillable']=_0x5127bd[_0x7e76('0xf')];this['sumDuration']=_0x5127bd[_0x7e76('0x1a')];this[_0x7e76('0x1b')]=_0x5127bd[_0x7e76('0x1b')]||0x0;this[_0x7e76('0x4')]=_0x5127bd[_0x7e76('0x4')]||0x0;this[_0x7e76('0x1c')]=_0x5127bd['total']||0x0;this[_0x7e76('0x1d')]=_0x5127bd['type'];this[_0x7e76('0x1e')]=_0x5127bd[_0x7e76('0x1e')]||0x0;this[_0x7e76('0x1f')]=_0x5127bd['unknown']||0x0;this[_0x7e76('0x20')]=_0x5127bd[_0x7e76('0x20')]||0x0;this['waiting']=_0x5127bd['waiting']||0x0;if(_0x5127bd['type']===_0x7e76('0x21')){this[_0x7e76('0xe')]=_0x5127bd[_0x7e76('0xe')]||0x0;this[_0x7e76('0x22')]=_0x5127bd[_0x7e76('0x22')];this['dialMethod']=_0x5127bd[_0x7e76('0x23')];this[_0x7e76('0x24')]=_0x5127bd[_0x7e76('0x24')];this[_0x7e76('0x25')]=_0x5127bd[_0x7e76('0x25')];this[_0x7e76('0x26')]=_0x5127bd[_0x7e76('0x26')];this['dialPrefix']=_0x5127bd[_0x7e76('0x27')];this['temp']=_0x5127bd[_0x7e76('0x28')];this['outboundAnswerAgiCallsDay']=_0x5127bd['outboundAnswerAgiCallsDay'];this[_0x7e76('0x8')]=_0x5127bd[_0x7e76('0x8')];this['outboundBlacklistCallsDay']=_0x5127bd[_0x7e76('0x9')];this['outboundBusyCallsDay']=_0x5127bd['outboundBusyCallsDay'];this[_0x7e76('0xb')]=_0x5127bd['outboundCongestionCallsDay'];this[_0x7e76('0x29')]=_0x5127bd[_0x7e76('0x29')];this[_0x7e76('0x2a')]=_0x5127bd[_0x7e76('0x2a')];this[_0x7e76('0x2b')]=_0x5127bd['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x5127bd[_0x7e76('0xc')];this['outboundNoSuchCallsDay']=_0x5127bd['outboundNoSuchCallsDay'];this[_0x7e76('0x2c')]=_0x5127bd[_0x7e76('0x2c')];this['outboundReCallsDay']=_0x5127bd[_0x7e76('0x2d')];this[_0x7e76('0x2e')]=_0x5127bd[_0x7e76('0x2e')];this[_0x7e76('0x2f')]=_0x5127bd[_0x7e76('0x2f')];this[_0x7e76('0x30')]=_0x5127bd['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x5127bd[_0x7e76('0x31')];this[_0x7e76('0x32')]=_0x5127bd[_0x7e76('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x5127bd[_0x7e76('0x33')];this[_0x7e76('0x34')]=_0x5127bd[_0x7e76('0x34')];this[_0x7e76('0x35')]=_0x5127bd[_0x7e76('0x35')];this[_0x7e76('0x36')]=_0x5127bd[_0x7e76('0x36')];this['predictiveIntervalHitRate']=_0x5127bd['predictiveIntervalHitRate'];this[_0x7e76('0x37')]=_0x5127bd[_0x7e76('0x37')];this[_0x7e76('0x38')]=_0x5127bd[_0x7e76('0x38')];this['predictiveIntervalAvailable']=_0x5127bd['predictiveIntervalAvailable'];this[_0x7e76('0x39')]=_0x5127bd[_0x7e76('0x39')];this[_0x7e76('0x3a')]=_0x5127bd['originated'];this[_0x7e76('0x3b')]=_0x5127bd[_0x7e76('0x3b')];this[_0x7e76('0x3c')]=_0x5127bd[_0x7e76('0x3c')];this['erlangAbandonmentRate']=_0x5127bd[_0x7e76('0x3d')];this['erlangBusyFactor']=_0x5127bd[_0x7e76('0x3e')];this[_0x7e76('0x3f')]=_0x5127bd[_0x7e76('0x3f')];this[_0x7e76('0x40')]=_0x5127bd[_0x7e76('0x40')];this['message']=_0x5127bd[_0x7e76('0x41')];this[_0x7e76('0x42')]=_0x5127bd[_0x7e76('0x42')];}if(_0x5127bd[_0x7e76('0x43')]){this[_0x7e76('0x43')]={'id':_0x5127bd[_0x7e76('0x43')]['id'],'name':_0x5127bd['Trunk']['name'],'active':_0x5127bd[_0x7e76('0x43')][_0x7e76('0x44')],'callerid':_0x5127bd[_0x7e76('0x43')][_0x7e76('0x45')]};}}VoiceQueueSummary[_0x7e76('0x46')][_0x7e76('0x47')]=function(_0x1cdc00,_0x281620,_0x3aa8ca,_0x2022f6){this[_0x7e76('0x1')]=0x0;this[_0x7e76('0x4')]=0x0;this['paused']=0x0;this[_0x7e76('0x1f')]=0x0;this[_0x7e76('0x18')]=0x0;this[_0x7e76('0x6')]=0x0;this[_0x7e76('0x15')]=0x0;this[_0x7e76('0x16')]=0x0;this['unavailable']=0x0;this[_0x7e76('0x3')]=0x0;this['ringInUse']=0x0;this[_0x7e76('0x17')]=0x0;if(_0x3aa8ca){if(_0x3aa8ca[_0x7e76('0x14')]){this[_0x7e76('0x14')]=Number(_0x3aa8ca[_0x7e76('0x14')]);}if(_0x3aa8ca[_0x7e76('0x48')]){this[_0x7e76('0x0')]=Number(_0x3aa8ca[_0x7e76('0x48')]);}if(_0x3aa8ca[_0x7e76('0x49')]){this[_0x7e76('0x5')]=Number(_0x3aa8ca[_0x7e76('0x49')]);}}for(var _0x3a04a4=0x0;_0x3a04a4<_0x1cdc00[_0x7e76('0x4a')];_0x3a04a4++){var _0x4e6641=_0x281620[_0x7e76('0x4b')+_0x1cdc00[_0x3a04a4][_0x7e76('0x10')]];if(_0x4e6641&&_0x4e6641[_0x7e76('0x4c')]){this[_0x7e76('0x1')]+=0x1;}if(_0x1cdc00[_0x3a04a4][_0x7e76('0x4d')]==='1'){this['talking']+=0x1;}if(_0x1cdc00[_0x3a04a4][_0x7e76('0x2')]==='1'&&!['2','7','8']['includes'](_0x1cdc00[_0x3a04a4]['status'])){this[_0x7e76('0x2')]+=0x1;}switch(_0x1cdc00[_0x3a04a4][_0x7e76('0x4e')]){case'0':this[_0x7e76('0x1f')]+=0x1;break;case'1':this[_0x7e76('0x18')]+=0x1;break;case'2':this[_0x7e76('0x6')]+=0x1;break;case'3':this[_0x7e76('0x15')]+=0x1;break;case'4':this[_0x7e76('0x16')]+=0x1;break;case'5':this[_0x7e76('0x1e')]+=0x1;break;case'6':this[_0x7e76('0x3')]+=0x1;break;case'7':this[_0x7e76('0x19')]+=0x1;break;case'8':this[_0x7e76('0x17')]+=0x1;break;}}if(this[_0x7e76('0x23')]===_0x7e76('0x4f')){var _0x36df82=Object[_0x7e76('0x50')](_0x2022f6);for(var _0x840be7=0x0;_0x840be7<_0x36df82[_0x7e76('0x4a')];_0x840be7++){var _0x2a99dc=_0x36df82[_0x840be7];var _0x518d45=_0x2022f6[_0x2a99dc];if(_0x518d45[_0x7e76('0x51')]===this[_0x7e76('0x10')]&&_0x518d45['type']===_0x7e76('0x52')&&_0x518d45[_0x7e76('0x53')]===_0x7e76('0x54')){this[_0x7e76('0x4')]+=0x1;}}if(this[_0x7e76('0x4')]>this[_0x7e76('0x6')]){this[_0x7e76('0x4')]=this[_0x7e76('0x6')];}this[_0x7e76('0xe')]=0x0;}return this;};VoiceQueueSummary[_0x7e76('0x46')][_0x7e76('0x55')]=function(_0x316840){var _0x33d6d3=![];if(_0x316840){_0x33d6d3=INBOUND_COUNTERS[_0x7e76('0x56')](function(_0x4a1265){return this[_0x4a1265]!==_0x316840[_0x4a1265];},this);}return _0x33d6d3;};VoiceQueueSummary[_0x7e76('0x46')]['compareToOutboundQueue']=function(_0x51daa0){var _0x4b16bb=![];var _0x53012a=![];var _0x125e7e=![];if(_0x51daa0){_0x4b16bb=this[_0x7e76('0x23')]!==_0x51daa0['dialMethod']||this[_0x7e76('0x22')]!==_0x51daa0[_0x7e76('0x22')]||this[_0x7e76('0x41')]!==_0x51daa0['message']||this[_0x7e76('0x42')]!==_0x51daa0[_0x7e76('0x42')];_0x53012a=OUTBOUND_COUNTERS[_0x7e76('0x56')](function(_0xa8b4e0){return this[_0xa8b4e0]!==_0x51daa0[_0xa8b4e0];},this);if(this[_0x7e76('0x43')]&&_0x51daa0[_0x7e76('0x43')]){_0x125e7e=this[_0x7e76('0x43')][_0x7e76('0x10')]!==_0x51daa0[_0x7e76('0x43')][_0x7e76('0x10')]||this[_0x7e76('0x43')][_0x7e76('0x44')]!==_0x51daa0[_0x7e76('0x43')][_0x7e76('0x44')];}}return _0x4b16bb||_0x53012a||_0x125e7e;};VoiceQueueSummary[_0x7e76('0x46')]['updateReportFromOutboundQueue']=function(_0x1b4247){this['answered']=_0x1b4247[_0x7e76('0x13')];this['message']=_0x1b4247[_0x7e76('0x41')];this[_0x7e76('0x42')]=_0x1b4247['statusMessage'];this[_0x7e76('0x3a')]=_0x1b4247[_0x7e76('0x3a')];this[_0x7e76('0x7')]=_0x1b4247['outboundAbandonedCallsDay'];this[_0x7e76('0x8')]=_0x1b4247[_0x7e76('0x8')];this[_0x7e76('0x9')]=_0x1b4247[_0x7e76('0x9')];this['outboundBusyCallsDay']=_0x1b4247[_0x7e76('0xa')];this[_0x7e76('0xb')]=_0x1b4247[_0x7e76('0xb')];this['outboundNoAnswerCallsDay']=_0x1b4247['outboundNoAnswerCallsDay'];this[_0x7e76('0xd')]=_0x1b4247['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1b4247[_0x7e76('0x2d')];this[_0x7e76('0x2e')]=_0x1b4247[_0x7e76('0x2e')];this[_0x7e76('0x2f')]=_0x1b4247[_0x7e76('0x2f')];this['sumBillable']=_0x1b4247[_0x7e76('0xf')];this['sumDuration']=_0x1b4247[_0x7e76('0x1a')];this[_0x7e76('0x1c')]=_0x1b4247['total'];if(this[_0x7e76('0x23')]==='preview'){this['pTalking']=_0x1b4247[_0x7e76('0xe')];}};module[_0x7e76('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0xf8bb=['available','loggedIn','loggedInDb','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundRejectCallsDay','paused','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','length','SIP/','online','incall','includes','status','booked','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','exports'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xf8bb,0x111));var _0xbf8b=function(_0x3c2700,_0x1aebb7){_0x3c2700=_0x3c2700-0x0;var _0x56b57c=_0xf8bb[_0x3c2700];return _0x56b57c;};'use strict';var INBOUND_COUNTERS=[_0xbf8b('0x0'),_0xbf8b('0x1'),_0xbf8b('0x2'),'paused',_0xbf8b('0x3'),_0xbf8b('0x4'),_0xbf8b('0x5')];var OUTBOUND_COUNTERS=[_0xbf8b('0x0'),_0xbf8b('0x6'),_0xbf8b('0x7'),_0xbf8b('0x1'),_0xbf8b('0x2'),_0xbf8b('0x8'),_0xbf8b('0x9'),_0xbf8b('0xa'),_0xbf8b('0xb'),_0xbf8b('0xc'),'outboundCongestionCallsDay',_0xbf8b('0xd'),'outboundNoSuchCallsDay','outboundReCallsDay',_0xbf8b('0xe'),'outboundUnknownCallsDay',_0xbf8b('0xf'),'pTalking',_0xbf8b('0x4'),_0xbf8b('0x10'),_0xbf8b('0x11'),_0xbf8b('0x12'),_0xbf8b('0x5')];function VoiceQueueSummary(_0x416471){this['id']=_0x416471['id'];this[_0xbf8b('0x13')]=_0x416471[_0xbf8b('0x13')];this['strategy']=_0x416471[_0xbf8b('0x14')];this[_0xbf8b('0x15')]=_0x416471['abandoned']||0x0;this[_0xbf8b('0x6')]=_0x416471[_0xbf8b('0x6')]||0x0;this[_0xbf8b('0x0')]=_0x416471[_0xbf8b('0x0')]||0x0;this[_0xbf8b('0x16')]=_0x416471[_0xbf8b('0x16')]||0x0;this[_0xbf8b('0x7')]=_0x416471[_0xbf8b('0x7')]||0x0;this[_0xbf8b('0x17')]=_0x416471[_0xbf8b('0x17')]||0x0;this['loggedIn']=_0x416471[_0xbf8b('0x1')]||0x0;this[_0xbf8b('0x2')]=_0x416471[_0xbf8b('0x2')]||0x0;this[_0xbf8b('0x18')]=_0x416471[_0xbf8b('0x18')]||0x0;this['notInUse']=_0x416471[_0xbf8b('0x19')]||0x0;this[_0xbf8b('0xf')]=_0x416471[_0xbf8b('0xf')]||0x0;this['ringing']=_0x416471[_0xbf8b('0x3')]||0x0;this[_0xbf8b('0x1a')]=_0x416471[_0xbf8b('0x1a')];this['sumBillable']=_0x416471[_0xbf8b('0x10')];this[_0xbf8b('0x11')]=_0x416471[_0xbf8b('0x11')];this[_0xbf8b('0x1b')]=_0x416471[_0xbf8b('0x1b')]||0x0;this[_0xbf8b('0x4')]=_0x416471['talking']||0x0;this['total']=_0x416471['total']||0x0;this[_0xbf8b('0x1c')]=_0x416471['type'];this[_0xbf8b('0x1d')]=_0x416471['unavailable']||0x0;this[_0xbf8b('0x1e')]=_0x416471['unknown']||0x0;this['unmanaged']=_0x416471[_0xbf8b('0x1f')]||0x0;this[_0xbf8b('0x5')]=_0x416471[_0xbf8b('0x5')]||0x0;if(_0x416471[_0xbf8b('0x1c')]===_0xbf8b('0x20')){this[_0xbf8b('0x21')]=_0x416471[_0xbf8b('0x21')]||0x0;this[_0xbf8b('0x22')]=_0x416471['dialActive'];this[_0xbf8b('0x23')]=_0x416471[_0xbf8b('0x23')];this[_0xbf8b('0x24')]=_0x416471[_0xbf8b('0x24')];this['dialOriginateCallerIdNumber']=_0x416471[_0xbf8b('0x25')];this[_0xbf8b('0x26')]=_0x416471['dialOriginateTimeout'];this[_0xbf8b('0x27')]=_0x416471[_0xbf8b('0x27')];this[_0xbf8b('0x28')]=_0x416471[_0xbf8b('0x28')];this[_0xbf8b('0x29')]=_0x416471[_0xbf8b('0x29')];this[_0xbf8b('0xa')]=_0x416471[_0xbf8b('0xa')];this[_0xbf8b('0xb')]=_0x416471[_0xbf8b('0xb')];this[_0xbf8b('0xc')]=_0x416471[_0xbf8b('0xc')];this[_0xbf8b('0x2a')]=_0x416471['outboundCongestionCallsDay'];this[_0xbf8b('0x2b')]=_0x416471[_0xbf8b('0x2b')];this[_0xbf8b('0x2c')]=_0x416471[_0xbf8b('0x2c')];this['outboundDropCallsDayTimeout']=_0x416471[_0xbf8b('0x2d')];this[_0xbf8b('0xd')]=_0x416471[_0xbf8b('0xd')];this[_0xbf8b('0x2e')]=_0x416471[_0xbf8b('0x2e')];this[_0xbf8b('0x2f')]=_0x416471[_0xbf8b('0x2f')];this[_0xbf8b('0x30')]=_0x416471[_0xbf8b('0x30')];this[_0xbf8b('0xe')]=_0x416471[_0xbf8b('0xe')];this[_0xbf8b('0x31')]=_0x416471['outboundUnknownCallsDay'];this[_0xbf8b('0x32')]=_0x416471['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x416471[_0xbf8b('0x33')];this[_0xbf8b('0x34')]=_0x416471[_0xbf8b('0x34')];this[_0xbf8b('0x35')]=_0x416471[_0xbf8b('0x35')];this['predictiveIntervalDroppedCallsTimeout']=_0x416471['predictiveIntervalDroppedCallsTimeout'];this[_0xbf8b('0x36')]=_0x416471[_0xbf8b('0x36')];this[_0xbf8b('0x37')]=_0x416471[_0xbf8b('0x37')];this[_0xbf8b('0x38')]=_0x416471[_0xbf8b('0x38')];this[_0xbf8b('0x39')]=_0x416471[_0xbf8b('0x39')];this[_0xbf8b('0x3a')]=_0x416471[_0xbf8b('0x3a')];this['predictiveIntervalAvailable']=_0x416471[_0xbf8b('0x3b')];this[_0xbf8b('0x3c')]=_0x416471['predictiveIntervalTotalCalls'];this[_0xbf8b('0x8')]=_0x416471[_0xbf8b('0x8')];this[_0xbf8b('0x3d')]=_0x416471[_0xbf8b('0x3d')];this[_0xbf8b('0x3e')]=_0x416471['erlangCallToSecond'];this[_0xbf8b('0x3f')]=_0x416471[_0xbf8b('0x3f')];this[_0xbf8b('0x40')]=_0x416471[_0xbf8b('0x40')];this[_0xbf8b('0x41')]=_0x416471[_0xbf8b('0x41')];this[_0xbf8b('0x42')]=_0x416471[_0xbf8b('0x42')];this[_0xbf8b('0x43')]=_0x416471['message'];this[_0xbf8b('0x44')]=_0x416471[_0xbf8b('0x44')];}if(_0x416471[_0xbf8b('0x45')]){this[_0xbf8b('0x45')]={'id':_0x416471[_0xbf8b('0x45')]['id'],'name':_0x416471[_0xbf8b('0x45')][_0xbf8b('0x13')],'active':_0x416471[_0xbf8b('0x45')]['active'],'callerid':_0x416471[_0xbf8b('0x45')][_0xbf8b('0x46')]};}}VoiceQueueSummary[_0xbf8b('0x47')][_0xbf8b('0x48')]=function(_0x238df1,_0x53e080,_0x4c1570,_0x16d660){this[_0xbf8b('0x2')]=0x0;this['talking']=0x0;this[_0xbf8b('0xf')]=0x0;this[_0xbf8b('0x1e')]=0x0;this[_0xbf8b('0x19')]=0x0;this[_0xbf8b('0x7')]=0x0;this[_0xbf8b('0x16')]=0x0;this[_0xbf8b('0x17')]=0x0;this['unavailable']=0x0;this[_0xbf8b('0x3')]=0x0;this[_0xbf8b('0x1a')]=0x0;this[_0xbf8b('0x18')]=0x0;if(_0x4c1570){if(_0x4c1570[_0xbf8b('0x0')]){this[_0xbf8b('0x0')]=Number(_0x4c1570['available']);}if(_0x4c1570[_0xbf8b('0x49')]){this[_0xbf8b('0x1')]=Number(_0x4c1570[_0xbf8b('0x49')]);}if(_0x4c1570['callers']){this['waiting']=Number(_0x4c1570['callers']);}}for(var _0x1fc1c3=0x0;_0x1fc1c3<_0x238df1[_0xbf8b('0x4a')];_0x1fc1c3++){var _0x58fd9d=_0x53e080[_0xbf8b('0x4b')+_0x238df1[_0x1fc1c3][_0xbf8b('0x13')]];if(_0x58fd9d&&_0x58fd9d[_0xbf8b('0x4c')]){this[_0xbf8b('0x2')]+=0x1;}if(_0x238df1[_0x1fc1c3][_0xbf8b('0x4d')]==='1'){this[_0xbf8b('0x4')]+=0x1;}if(_0x238df1[_0x1fc1c3][_0xbf8b('0xf')]==='1'&&!['2','7','8'][_0xbf8b('0x4e')](_0x238df1[_0x1fc1c3][_0xbf8b('0x4f')])){this[_0xbf8b('0xf')]+=0x1;}switch(_0x238df1[_0x1fc1c3][_0xbf8b('0x4f')]){case'0':this[_0xbf8b('0x1e')]+=0x1;break;case'1':this[_0xbf8b('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xbf8b('0x16')]+=0x1;break;case'4':this[_0xbf8b('0x17')]+=0x1;break;case'5':this[_0xbf8b('0x1d')]+=0x1;break;case'6':this[_0xbf8b('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xbf8b('0x18')]+=0x1;break;}}if(this[_0xbf8b('0x23')]===_0xbf8b('0x50')){var _0x506b4f=Object[_0xbf8b('0x51')](_0x16d660);for(var _0x2ee446=0x0;_0x2ee446<_0x506b4f[_0xbf8b('0x4a')];_0x2ee446++){var _0x5fc380=_0x506b4f[_0x2ee446];var _0x45df9e=_0x16d660[_0x5fc380];if(_0x45df9e[_0xbf8b('0x52')]===this['name']&&_0x45df9e['type']==='dialer'&&_0x45df9e[_0xbf8b('0x53')]===_0xbf8b('0x54')){this[_0xbf8b('0x4')]+=0x1;}}if(this['talking']>this['inUse']){this[_0xbf8b('0x4')]=this[_0xbf8b('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xbf8b('0x47')][_0xbf8b('0x55')]=function(_0x3774c0){var _0x10e395=![];if(_0x3774c0){_0x10e395=INBOUND_COUNTERS[_0xbf8b('0x56')](function(_0x83800){return this[_0x83800]!==_0x3774c0[_0x83800];},this);}return _0x10e395;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x1832d8){var _0x48f18e=![];var _0x845bbe=![];var _0x50cbcd=![];if(_0x1832d8){_0x48f18e=this['dialMethod']!==_0x1832d8[_0xbf8b('0x23')]||this[_0xbf8b('0x22')]!==_0x1832d8[_0xbf8b('0x22')]||this[_0xbf8b('0x43')]!==_0x1832d8[_0xbf8b('0x43')]||this[_0xbf8b('0x44')]!==_0x1832d8[_0xbf8b('0x44')];_0x845bbe=OUTBOUND_COUNTERS['some'](function(_0x38331b){return this[_0x38331b]!==_0x1832d8[_0x38331b];},this);if(this[_0xbf8b('0x45')]&&_0x1832d8[_0xbf8b('0x45')]){_0x50cbcd=this['Trunk'][_0xbf8b('0x13')]!==_0x1832d8[_0xbf8b('0x45')][_0xbf8b('0x13')]||this['Trunk'][_0xbf8b('0x57')]!==_0x1832d8['Trunk']['active'];}}return _0x48f18e||_0x845bbe||_0x50cbcd;};VoiceQueueSummary[_0xbf8b('0x47')][_0xbf8b('0x58')]=function(_0x24e672){this['answered']=_0x24e672[_0xbf8b('0x6')];this[_0xbf8b('0x43')]=_0x24e672['message'];this[_0xbf8b('0x44')]=_0x24e672['statusMessage'];this[_0xbf8b('0x8')]=_0x24e672['originated'];this[_0xbf8b('0x9')]=_0x24e672['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x24e672[_0xbf8b('0xa')];this[_0xbf8b('0xb')]=_0x24e672[_0xbf8b('0xb')];this[_0xbf8b('0xc')]=_0x24e672[_0xbf8b('0xc')];this[_0xbf8b('0x2a')]=_0x24e672[_0xbf8b('0x2a')];this[_0xbf8b('0xd')]=_0x24e672[_0xbf8b('0xd')];this[_0xbf8b('0x2e')]=_0x24e672[_0xbf8b('0x2e')];this[_0xbf8b('0x30')]=_0x24e672[_0xbf8b('0x30')];this[_0xbf8b('0xe')]=_0x24e672['outboundRejectCallsDay'];this[_0xbf8b('0x31')]=_0x24e672['outboundUnknownCallsDay'];this[_0xbf8b('0x10')]=_0x24e672[_0xbf8b('0x10')];this[_0xbf8b('0x11')]=_0x24e672[_0xbf8b('0x11')];this['total']=_0x24e672['total'];if(this[_0xbf8b('0x23')]===_0xbf8b('0x59')){this['pTalking']=_0x24e672[_0xbf8b('0x21')];}};module[_0xbf8b('0x5a')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 2e45669..12365f7 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 _0x6230=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0xd07917,_0x55c315){var _0x1bd13c=function(_0x198559){while(--_0x198559){_0xd07917['push'](_0xd07917['shift']());}};_0x1bd13c(++_0x55c315);}(_0x6230,0xcf));var _0x0623=function(_0x3bfbf5,_0x1cd670){_0x3bfbf5=_0x3bfbf5-0x0;var _0x3aaac9=_0x6230[_0x3bfbf5];return _0x3aaac9;};'use strict';function VtigerAccount(_0xf11eff){this['id']=_0xf11eff['id']||0x0;this[_0x0623('0x0')]=_0xf11eff[_0x0623('0x0')]||'';this[_0x0623('0x1')]=_0xf11eff[_0x0623('0x1')]||'';this[_0x0623('0x2')]=_0xf11eff[_0x0623('0x2')]||'';this[_0x0623('0x3')]=_0xf11eff[_0x0623('0x3')]||'';this[_0x0623('0x4')]=_0xf11eff[_0x0623('0x4')]||'';this[_0x0623('0x5')]=_0xf11eff[_0x0623('0x5')]||{};}module[_0x0623('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe2ef=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x1b3ee8,_0x1e7614){var _0xf0e6bf=function(_0x281366){while(--_0x281366){_0x1b3ee8['push'](_0x1b3ee8['shift']());}};_0xf0e6bf(++_0x1e7614);}(_0xe2ef,0x194));var _0xfe2e=function(_0xcff06,_0x18be73){_0xcff06=_0xcff06-0x0;var _0x105628=_0xe2ef[_0xcff06];return _0x105628;};'use strict';function VtigerAccount(_0xfe886d){this['id']=_0xfe886d['id']||0x0;this[_0xfe2e('0x0')]=_0xfe886d[_0xfe2e('0x0')]||'';this[_0xfe2e('0x1')]=_0xfe886d[_0xfe2e('0x1')]||'';this['accessKey']=_0xfe886d[_0xfe2e('0x2')]||'';this[_0xfe2e('0x3')]=_0xfe886d[_0xfe2e('0x3')]||'';this[_0xfe2e('0x4')]=_0xfe886d[_0xfe2e('0x4')]||'';this[_0xfe2e('0x5')]=_0xfe886d[_0xfe2e('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c2a91fe..20fa056 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 _0x53c8=['remoteUri','authType','integrationTab','serverUrl','Configurations','name','username','password','token'];(function(_0x449676,_0x4cd85f){var _0x16f528=function(_0x4dd9c3){while(--_0x4dd9c3){_0x449676['push'](_0x449676['shift']());}};_0x16f528(++_0x4cd85f);}(_0x53c8,0x1e2));var _0x853c=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x53c8[_0x235f49];return _0x551139;};'use strict';function ZendeskAccount(_0x3400ae){this['id']=_0x3400ae['id']||0x0;this[_0x853c('0x0')]=_0x3400ae[_0x853c('0x0')]||'';this[_0x853c('0x1')]=_0x3400ae['username']||'';this[_0x853c('0x2')]=_0x3400ae[_0x853c('0x2')]||'';this[_0x853c('0x3')]=_0x3400ae[_0x853c('0x3')]||'';this[_0x853c('0x4')]=_0x3400ae[_0x853c('0x4')]||'';this[_0x853c('0x5')]=_0x3400ae[_0x853c('0x5')]||'';this['type']=_0x3400ae['type']||_0x853c('0x6');this[_0x853c('0x7')]=_0x3400ae[_0x853c('0x7')]||'';this[_0x853c('0x8')]=_0x3400ae['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xee52=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xee52,0x121));var _0x2ee5=function(_0x1d344a,_0x578f90){_0x1d344a=_0x1d344a-0x0;var _0x2d6cd2=_0xee52[_0x1d344a];return _0x2d6cd2;};'use strict';function ZendeskAccount(_0x391c4a){this['id']=_0x391c4a['id']||0x0;this[_0x2ee5('0x0')]=_0x391c4a[_0x2ee5('0x0')]||'';this[_0x2ee5('0x1')]=_0x391c4a[_0x2ee5('0x1')]||'';this[_0x2ee5('0x2')]=_0x391c4a[_0x2ee5('0x2')]||'';this[_0x2ee5('0x3')]=_0x391c4a[_0x2ee5('0x3')]||'';this[_0x2ee5('0x4')]=_0x391c4a['remoteUri']||'';this[_0x2ee5('0x5')]=_0x391c4a[_0x2ee5('0x5')]||'';this['type']=_0x391c4a[_0x2ee5('0x6')]||_0x2ee5('0x7');this[_0x2ee5('0x8')]=_0x391c4a[_0x2ee5('0x8')]||'';this[_0x2ee5('0x9')]=_0x391c4a[_0x2ee5('0x9')]||{};}module[_0x2ee5('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 39ad2c3..8edc7fd 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 _0xe263=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x2f989f,_0x1f35f4){var _0x1f3617=function(_0x4b3570){while(--_0x4b3570){_0x2f989f['push'](_0x2f989f['shift']());}};_0x1f3617(++_0x1f35f4);}(_0xe263,0x193));var _0x3e26=function(_0x8f4a1f,_0x243855){_0x8f4a1f=_0x8f4a1f-0x0;var _0x4e6a4d=_0xe263[_0x8f4a1f];return _0x4e6a4d;};'use strict';function ZohoAccount(_0x357899){this['id']=_0x357899['id']||0x0;this[_0x3e26('0x0')]=_0x357899[_0x3e26('0x0')]||'';this[_0x3e26('0x1')]=_0x357899[_0x3e26('0x1')]||'';this[_0x3e26('0x2')]=_0x357899[_0x3e26('0x2')]||'';this[_0x3e26('0x3')]=_0x357899[_0x3e26('0x3')]||'';this[_0x3e26('0x4')]=_0x357899[_0x3e26('0x4')]||'';this[_0x3e26('0x5')]=_0x357899['clientSecret']||'';this[_0x3e26('0x6')]=_0x357899[_0x3e26('0x6')]||'';this[_0x3e26('0x7')]=_0x357899[_0x3e26('0x7')]||'';this[_0x3e26('0x8')]=_0x357899[_0x3e26('0x8')]||'';this['Configurations']=_0x357899[_0x3e26('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xc6a4=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc6a4,0x97));var _0x4c6a=function(_0x18f68b,_0x574b7b){_0x18f68b=_0x18f68b-0x0;var _0x2ae059=_0xc6a4[_0x18f68b];return _0x2ae059;};'use strict';function ZohoAccount(_0x246bc3){this['id']=_0x246bc3['id']||0x0;this[_0x4c6a('0x0')]=_0x246bc3[_0x4c6a('0x0')]||'';this[_0x4c6a('0x1')]=_0x246bc3[_0x4c6a('0x1')]||'';this[_0x4c6a('0x2')]=_0x246bc3[_0x4c6a('0x2')]||'';this[_0x4c6a('0x3')]=_0x246bc3[_0x4c6a('0x3')]||'';this['clientId']=_0x246bc3[_0x4c6a('0x4')]||'';this[_0x4c6a('0x5')]=_0x246bc3[_0x4c6a('0x5')]||'';this['serverUrl']=_0x246bc3[_0x4c6a('0x6')]||'';this[_0x4c6a('0x7')]=_0x246bc3[_0x4c6a('0x7')]||'';this['refreshToken']=_0x246bc3[_0x4c6a('0x8')]||'';this[_0x4c6a('0x9')]=_0x246bc3[_0x4c6a('0x9')]||{};}module[_0x4c6a('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1ceb46b..6ea747d 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 _0x36ee=['callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','exports','moment','isNil','string','idContact','name','type','queue','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe36e('0x0'));function checkNameSurname(_0x521ff3,_0xf6b517,_0x4018bf){var _0x36c9f6='';if(!_[_0xe36e('0x1')](_0xf6b517)&&_0xe36e('0x2')===typeof _0xf6b517){_0x36c9f6+=_0xf6b517;}if(!_[_0xe36e('0x1')](_0x4018bf)&&_0xe36e('0x2')===typeof _0x4018bf){_0x36c9f6+='\x20'+_0x4018bf;}if(_0x36c9f6!==''){return _0x36c9f6;}return _0x521ff3;}function Action(_0x3f29e1,_0x25a07d,_0x190404,_0x21be0b,_0x1aa596){this['uniqueid']=_0x190404||undefined;this[_0xe36e('0x3')]=_0x3f29e1['id'];this['queue']=_0x25a07d[_0xe36e('0x4')];this[_0xe36e('0x5')]=_0x25a07d[_0xe36e('0x5')];this['campaigntype']=_0xe36e('0x6');this['dialAnswer']=![];this[_0xe36e('0x7')]=_[_0xe36e('0x1')](_0x3f29e1[_0xe36e('0x8')])?undefined:_0x3f29e1[_0xe36e('0x8')][_0xe36e('0x4')];this[_0xe36e('0x9')]=this[_0xe36e('0x7')]?util[_0xe36e('0xa')]('SIP/%s',this[_0xe36e('0x7')]):_0x21be0b||undefined;this[_0xe36e('0xb')]=checkNameSurname(_0x3f29e1[_0xe36e('0xc')][_0xe36e('0xd')],_0x3f29e1['Contact'][_0xe36e('0xe')],_0x3f29e1['Contact']['lastName']);this[_0xe36e('0xf')]=_0x3f29e1[_0xe36e('0xf')]||![];this[_0xe36e('0x10')]=_0x3f29e1[_0xe36e('0xd')];this[_0xe36e('0x11')]=_0x3f29e1[_0xe36e('0x11')];this[_0xe36e('0x12')]=_0x3f29e1[_0xe36e('0x12')]||0x0;this[_0xe36e('0x13')]=_0x3f29e1[_0xe36e('0x13')]||0x0;this['countnoanswerretry']=_0x3f29e1[_0xe36e('0x14')]||0x0;this[_0xe36e('0x15')]=(_0x3f29e1['countbusyretry']||0x0)+(_0x3f29e1[_0xe36e('0x13')]||0x0)+(_0x3f29e1['countnoanswerretry']||0x0)+(_0x3f29e1[_0xe36e('0x16')]||0x0)+(_0x3f29e1[_0xe36e('0x17')]||0x0)+(_0x3f29e1['countabandonedretry']||0x0)+(_0x3f29e1[_0xe36e('0x18')]||0x0)+(_0x3f29e1[_0xe36e('0x19')]||0x0);this[_0xe36e('0x16')]=_0x3f29e1['countnosuchnumberretry']||0x0;this[_0xe36e('0x17')]=_0x3f29e1[_0xe36e('0x17')]||0x0;this[_0xe36e('0x1a')]=_0x3f29e1[_0xe36e('0x1a')]||0x0;this[_0xe36e('0x18')]=_0x3f29e1[_0xe36e('0x18')]||0x0;this['countagentrejectretry']=_0x3f29e1[_0xe36e('0x19')]||0x0;this[_0xe36e('0x1b')]=_0x3f29e1[_0xe36e('0x1b')];this[_0xe36e('0x1c')]=_0x3f29e1[_0xe36e('0x1c')];this['callbackat']=_0x3f29e1['callbackat'];this[_0xe36e('0x1d')]=_0x3f29e1[_0xe36e('0x1d')];this[_0xe36e('0x1e')]=_0x3f29e1[_0xe36e('0x1e')];this[_0xe36e('0x1f')]=_0x3f29e1[_0xe36e('0x1f')];this[_0xe36e('0x20')]=_['isNil'](_0x3f29e1[_0xe36e('0x8')])?_0x3f29e1[_0xe36e('0x20')]:_0x3f29e1[_0xe36e('0x8')]['id'];this[_0xe36e('0x21')]=_0x3f29e1['VoiceQueueId'];this[_0xe36e('0x22')]='';this['originatecalleridname']='';}Action[_0xe36e('0x23')]['getCaller']=function(){return util[_0xe36e('0xa')]('\x22%s\x22\x20<%s>',this[_0xe36e('0xb')],this['number']);};module[_0xe36e('0x24')]=Action; \ No newline at end of file +var _0x896e=['Contact','phone','firstName','lastName','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','queue','membername','Agent','format','SIP/%s','calleridname'];(function(_0xd93ce2,_0xa9a2d4){var _0x477511=function(_0x3b9f31){while(--_0x3b9f31){_0xd93ce2['push'](_0xd93ce2['shift']());}};_0x477511(++_0xa9a2d4);}(_0x896e,0x1e9));var _0xe896=function(_0x3903ca,_0x4f3e1d){_0x3903ca=_0x3903ca-0x0;var _0x3c5f38=_0x896e[_0x3903ca];return _0x3c5f38;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));function checkNameSurname(_0x229b59,_0x36085e,_0x26d296){var _0x2af995='';if(!_[_0xe896('0x3')](_0x36085e)&&_0xe896('0x4')===typeof _0x36085e){_0x2af995+=_0x36085e;}if(!_[_0xe896('0x3')](_0x26d296)&&_0xe896('0x4')===typeof _0x26d296){_0x2af995+='\x20'+_0x26d296;}if(_0x2af995!==''){return _0x2af995;}return _0x229b59;}function Action(_0x318a7b,_0x52ac80,_0x24c430,_0x7a0721,_0x3b902c){this[_0xe896('0x5')]=_0x24c430||undefined;this[_0xe896('0x6')]=_0x318a7b['id'];this['queue']=_0x52ac80[_0xe896('0x7')];this[_0xe896('0x8')]=_0x52ac80[_0xe896('0x8')];this['campaigntype']=_0xe896('0x9');this['dialAnswer']=![];this[_0xe896('0xa')]=_['isNil'](_0x318a7b[_0xe896('0xb')])?undefined:_0x318a7b[_0xe896('0xb')][_0xe896('0x7')];this['channelAgent']=this[_0xe896('0xa')]?util[_0xe896('0xc')](_0xe896('0xd'),this['membername']):_0x7a0721||undefined;this[_0xe896('0xe')]=checkNameSurname(_0x318a7b[_0xe896('0xf')][_0xe896('0x10')],_0x318a7b['Contact'][_0xe896('0x11')],_0x318a7b[_0xe896('0xf')][_0xe896('0x12')]);this['active']=_0x318a7b['active']||![];this[_0xe896('0x13')]=_0x318a7b[_0xe896('0x10')];this['scheduledat']=_0x318a7b['scheduledat'];this[_0xe896('0x14')]=_0x318a7b[_0xe896('0x14')]||0x0;this['countcongestionretry']=_0x318a7b[_0xe896('0x15')]||0x0;this['countnoanswerretry']=_0x318a7b[_0xe896('0x16')]||0x0;this[_0xe896('0x17')]=(_0x318a7b[_0xe896('0x14')]||0x0)+(_0x318a7b['countcongestionretry']||0x0)+(_0x318a7b[_0xe896('0x16')]||0x0)+(_0x318a7b[_0xe896('0x18')]||0x0)+(_0x318a7b[_0xe896('0x19')]||0x0)+(_0x318a7b[_0xe896('0x1a')]||0x0)+(_0x318a7b[_0xe896('0x1b')]||0x0)+(_0x318a7b[_0xe896('0x1c')]||0x0);this[_0xe896('0x18')]=_0x318a7b[_0xe896('0x18')]||0x0;this['countdropretry']=_0x318a7b[_0xe896('0x19')]||0x0;this['countabandonedretry']=_0x318a7b['countabandonedretry']||0x0;this[_0xe896('0x1b')]=_0x318a7b[_0xe896('0x1b')]||0x0;this[_0xe896('0x1c')]=_0x318a7b[_0xe896('0x1c')]||0x0;this['callback']=_0x318a7b[_0xe896('0x1d')];this['callbackuniqueid']=_0x318a7b['callbackuniqueid'];this[_0xe896('0x1e')]=_0x318a7b[_0xe896('0x1e')];this[_0xe896('0x1f')]=_0x318a7b[_0xe896('0x1f')];this[_0xe896('0x20')]=_0x318a7b[_0xe896('0x20')];this[_0xe896('0x21')]=_0x318a7b['ListId'];this[_0xe896('0x22')]=_[_0xe896('0x3')](_0x318a7b[_0xe896('0xb')])?_0x318a7b['UserId']:_0x318a7b[_0xe896('0xb')]['id'];this[_0xe896('0x23')]=_0x318a7b[_0xe896('0x23')];this[_0xe896('0x24')]='';this[_0xe896('0x25')]='';}Action[_0xe896('0x26')]['getCaller']=function(){return util[_0xe896('0xc')](_0xe896('0x27'),this[_0xe896('0xe')],this[_0xe896('0x28')]);};module[_0xe896('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 947ccba..f5e8644 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 _0x9643=['Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','[syncHangup][talking][cause]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','filterKey','keys','variable','value','error','transfertargetlinkedid','transfererlinkedid','exports','util','moment','preview','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','paused','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementTalking','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','linkedid','actioncountonusuch','idContact','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','mandatoryDisposition','channelAgent','uniqueid','buildObj','complete','outboundAnswerCallsDay','total','answered','Answer','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','incrementPreviewCounters','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','phone'];(function(_0x100053,_0x4129da){var _0x173aa0=function(_0x4df578){while(--_0x4df578){_0x100053['push'](_0x100053['shift']());}};_0x173aa0(++_0x4129da);}(_0x9643,0x197));var _0x3964=function(_0xe14f19,_0x4b9773){_0xe14f19=_0xe14f19-0x0;var _0x98c20f=_0x9643[_0xe14f19];return _0x98c20f;};'use strict';var util=require(_0x3964('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x3964('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3964('0x2'));var loggerAction=require(_0x3964('0x3'))(_0x3964('0x4'));var ami=require(_0x3964('0x5'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x3964('0x6'));var Action=require(_0x3964('0x7'));var ut=require(_0x3964('0x8'));var utils=require(_0x3964('0x9'));config[_0x3964('0xa')]=_['defaults'](config[_0x3964('0xa')],{'host':_0x3964('0xb'),'port':0x18eb});var io=require(_0x3964('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x3964('0xd')][_0x3964('0xe')]=function(_0x5750d3){this[_0x3964('0xf')]=this[_0x3964('0xf')]?this[_0x3964('0xf')][_0x3964('0x10')](_0x5750d3):_0x5750d3();};function Preview(_0x38dbb8){this[_0x3964('0x11')]=new Sequence();this[_0x3964('0x12')]=_0x38dbb8['voiceQueues'];this['trunks']=_0x38dbb8[_0x3964('0x13')];this[_0x3964('0x14')]={};this['agents']=_0x38dbb8[_0x3964('0x15')];this[_0x3964('0x16')]=0x0;ami['on'](_0x3964('0x17'),this[_0x3964('0x18')][_0x3964('0x19')](this));ami['on'](_0x3964('0x1a'),this[_0x3964('0x1b')][_0x3964('0x19')](this));ami['on'](_0x3964('0x1c'),this[_0x3964('0x1d')]['bind'](this));ami['on'](_0x3964('0x1e'),this[_0x3964('0x1f')][_0x3964('0x19')](this));ami['on']('newexten',this[_0x3964('0x20')][_0x3964('0x19')](this));ami['on'](_0x3964('0x21'),this[_0x3964('0x22')][_0x3964('0x19')](this));ami['on'](_0x3964('0x23'),this[_0x3964('0x24')]['bind'](this));ami['on'](_0x3964('0x25'),this[_0x3964('0x26')]['bind'](this));this[_0x3964('0x27')](this['campaignsPreview']);}function emit(_0x2b95c1,_0x8b7161,_0x462e45){io['to'](_0x2b95c1)[_0x3964('0x28')](_0x8b7161,_0x462e45);}function emitVoiceQueueChannelRemove(_0x340031){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3964('0x29')](_0x340031));emit(util[_0x3964('0x2a')]('voice:queue:%s',_0x340031[_0x3964('0x2b')]),_0x3964('0x2c'),_0x340031);io['emit'](_0x3964('0x2d'),_0x340031);}function notSendMessagesQueue(_0x187b04){if(_0x187b04['sendMessageOneNotActive']){if(_0x187b04[_0x3964('0x2e')]===0x0&&_0x187b04[_0x3964('0x2f')]===0x0){_0x187b04[_0x3964('0x30')]=![];_0x187b04['available']=0x0;_0x187b04[_0x3964('0x31')]=0x0;_0x187b04['message']=utils[_0x3964('0x32')]['INACTIVE'];ut[_0x3964('0x33')](_0x3964('0x34'),_0x187b04['name']+_0x3964('0x35'));}else{_0x187b04[_0x3964('0x36')]=utils[_0x3964('0x32')][_0x3964('0x37')];ut[_0x3964('0x33')](_0x3964('0x34'),_0x187b04[_0x3964('0x2b')]+'\x20is\x20deactivated');}}}Preview[_0x3964('0xd')][_0x3964('0x27')]=function(){var _0x5008fc=this;setInterval(function(){_0x5008fc[_0x3964('0x38')]();},0x7cf);};Preview['prototype'][_0x3964('0x38')]=function(){var _0x277f3d=this[_0x3964('0x12')];this[_0x3964('0x16')]+=0x1;for(var _0x54641e in _0x277f3d){if(_0x277f3d[_0x3964('0x39')](_0x54641e)&&(_0x277f3d[_0x54641e][_0x3964('0x3a')]===_0x3964('0x2')||_0x277f3d[_0x54641e]['dialMethod']===_0x3964('0x3b'))&&_0x277f3d[_0x54641e][_0x3964('0x3c')]==='outbound'){if(this[_0x3964('0x16')]>0x7){this[_0x3964('0x16')]=0x0;this[_0x3964('0x3d')]();}}if(_0x277f3d[_0x3964('0x39')](_0x54641e)&&_0x277f3d[_0x54641e]['dialMethod']==='preview'&&_0x277f3d[_0x54641e][_0x3964('0x3c')]==='outbound'){if(_0x277f3d[_0x54641e][_0x3964('0x3e')]){this[_0x3964('0x3f')](_0x277f3d[_0x54641e]);if(_0x277f3d[_0x54641e]['dialPreviewAutoRecallMe'])this[_0x3964('0x40')](_0x277f3d[_0x54641e]);}else{notSendMessagesQueue(_0x277f3d[_0x54641e]);}}}};Preview['prototype'][_0x3964('0x41')]=function(_0x2c8773){var _0x84fc5c=this;this[_0x3964('0x11')][_0x3964('0xe')](function(){if(!_['isNil'](_0x84fc5c[_0x3964('0x14')][_0x2c8773])){loggerAction[_0x3964('0x42')](_0x3964('0x43'),_0x2c8773,'Queue',_0x84fc5c['actions'][_0x2c8773][_0x3964('0x44')],'originated:\x20',JSON['stringify'](_0x84fc5c['campaignsPreview'][_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]][_0x3964('0x2e')]),_0x3964('0x45'),JSON[_0x3964('0x29')](_0x84fc5c[_0x3964('0x12')][_0x84fc5c['actions'][_0x2c8773]['queue']][_0x3964('0x2f')]),JSON['stringify'](_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x46')]),JSON[_0x3964('0x29')](_[_0x3964('0x47')](_0x84fc5c[_0x3964('0x14')][_0x2c8773],[_0x3964('0x48'),_0x3964('0x49'),_0x3964('0x4a'),_0x3964('0x4b')])));return ami[_0x3964('0x4c')]({'action':_0x3964('0x4d'),'channel':_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x4e')]})[_0x3964('0x4f')](function(_0xe85c95){if(_0xe85c95['message']===_0x3964('0x50')){setTimeout(function(){if(_0x84fc5c['actions'][_0x2c8773]){utils['decrementOriginate'](_0x84fc5c[_0x3964('0x12')][_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]],'[clearZombieChannel]');if(_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x46')]===!![]){ut[_0x3964('0x51')](_0x84fc5c[_0x3964('0x12')][_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]],'[clearZombieChannel]');ut[_0x3964('0x52')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c8773,_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]);}ut['loggerError'](_0x3964('0x53')+_0x2c8773,_0x84fc5c['actions'][_0x2c8773][_0x3964('0x44')]);delete _0x84fc5c['actions'][_0x2c8773];}},0x2328);}});}});};Preview[_0x3964('0xd')][_0x3964('0x3d')]=function(){var _0x3add97=this;loggerAction[_0x3964('0x42')](_0x3964('0x54'),_[_0x3964('0x55')](this[_0x3964('0x14')]));for(var _0x2200f4 in this[_0x3964('0x14')]){if(_0x3add97[_0x3964('0x14')][_0x3964('0x39')](_0x2200f4)){_0x3add97[_0x3964('0x41')](_0x2200f4);}}};Preview['prototype'][_0x3964('0x40')]=function(_0x28b1bb){var _0x155055=this;rpcDb[_0x3964('0x56')](_0x28b1bb['id'],ut[_0x3964('0x57')](this['agents']))[_0x3964('0x58')](function(_0x28133b){if(!_[_0x3964('0x59')](_0x28133b)){for(var _0xf9055=0x0;_0xf9055<_0x28133b['length'];_0xf9055+=0x1){if(ut[_0x3964('0x5a')](_0x28133b[_0xf9055][_0x3964('0x5b')])<_0x28b1bb[_0x3964('0x5c')]*0x3c){if(_0x28133b[_0xf9055][_0x3964('0x5d')]&&!_0x28133b[_0xf9055]['Agent']['voicePause']){_0x155055[_0x3964('0x5e')](_0x28133b[_0xf9055]['id'])[_0x3964('0x58')](ut[_0x3964('0x5f')]('[RecallMe]'))[_0x3964('0x4f')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x3964('0x60')](_0x28133b[_0xf9055]['id']);}}else{var _0x37eab9=new Action(_0x28133b[_0xf9055],_0x28b1bb);_0x37eab9[_0x3964('0x61')]=moment()[_0x3964('0x2a')](_0x3964('0x62'));_0x28b1bb[_0x3964('0x63')]+=0x1;ut[_0x3964('0x64')](_0x37eab9,0x17,'RecallInQueue');if(_0x28b1bb[_0x3964('0x65')]){rpcDb[_0x3964('0x66')](ut[_0x3964('0x67')](_0x28133b[_0xf9055]));rpcDb[_0x3964('0x68')](_0x37eab9,_0x3964('0x69'));}else{ut[_0x3964('0x64')](_0x37eab9,0x16,_0x3964('0x6a'));rpcDb[_0x3964('0x68')](_0x37eab9,_0x3964('0x6b'));rpcDb[_0x3964('0x6c')](_0x37eab9,_0x3964('0x6b'));}}}}})[_0x3964('0x4f')](ut[_0x3964('0x5f')]('[getContactRecallMe]'));};Preview[_0x3964('0xd')]['setMessage']=function(_0x59f224){_0x59f224['sendMessageOneNotActive']=!![];if(ut[_0x3964('0x6d')](_0x59f224[_0x3964('0x6e')])){_0x59f224['message']=utils[_0x3964('0x32')][_0x3964('0x6f')];}else if(!ut[_0x3964('0x70')](_0x59f224[_0x3964('0x3e')])){_0x59f224[_0x3964('0x36')]=utils['CAMPAIGN_STATUS'][_0x3964('0x71')];}else if(!this[_0x3964('0x72')](_0x59f224[_0x3964('0x73')])){if(!this['isTrunkReachable'](_0x59f224[_0x3964('0x74')])){_0x59f224[_0x3964('0x36')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x59f224[_0x3964('0x36')]=utils[_0x3964('0x32')][_0x3964('0x75')];}}else{_0x59f224['message']=utils[_0x3964('0x32')][_0x3964('0x75')];}};Preview[_0x3964('0xd')][_0x3964('0x76')]=function(_0x20f287,_0x4537c2,_0x3b5f84){var _0x52e5ee=this;var _0x1fb401=this[_0x3964('0x14')][_0x4537c2];var _0x53f111=this[_0x3964('0x12')][_0x1fb401['queue']];var _0x52b179;var _0x1c676d=![];var _0x1bf1c4=0x2;var _0x51fe3d=0x3;if(_0x53f111){switch(_0x3b5f84){case'1':_0x53f111[_0x3964('0x77')]+=0x1;_0x1fb401[_0x3964('0x78')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x0,'NoSuchNumber');ami[_0x3964('0x28')](_0x3964('0x7b'),ut['buildObj'](_0x1fb401,_0x3964('0x7c')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0x7d'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'0',_0x53f111)['then'](function(_0x245cc8){_0x1c676d=_0x245cc8[_0x3964('0x7f')]==0x1;_0x1bf1c4=_0x53f111[_0x3964('0x80')];_0x51fe3d=_0x53f111[_0x3964('0x81')];if(!_0x1c676d){if(ut['totalGlobal'](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0x85'));}else{if(_0x1fb401[_0x3964('0x78')]>=_0x53f111[_0x3964('0x86')]){rpcDb[_0x3964('0x6c')](_0x1fb401,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3964('0x87')](ut['scheduledAt'](_0x1fb401,_0x3964('0x78'),_0x53f111['dialNoSuchNumberRetryFrequency']),_0x1fb401['unlockAgent'],_0x1fb401[_0x3964('0x88')]);}}delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];}else{_0x1fb401[_0x3964('0x78')]++;logger['info'](_0x3964('0x8a'),_0x1fb401[_0x3964('0x78')]);logger['info']('id',_0x1fb401['idContact']);_0x52e5ee['incrementPreviewCounters']({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnosuchnumberretry':_0x1fb401[_0x3964('0x78')]}})[_0x3964('0x58')](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case'ANSWER':var _0x423d91=moment()['format'](_0x3964('0x62'));_0x1fb401['responsetime']=_0x423d91;_0x1fb401[_0x3964('0x8c')]=_0x423d91;_0x1fb401[_0x3964('0x46')]=!![];_0x53f111[_0x3964('0x2f')]+=0x1;logger[_0x3964('0x42')](_0x3964('0x8d'),_0x1fb401['uniqueid'],_0x3964('0x8e'),_0x53f111[_0x3964('0x2b')],_0x3964('0x45'),_0x53f111['pTalking']);ami[_0x3964('0x28')](_0x3964('0x8f'),ut['buildObj'](_0x1fb401,_0x3964('0x90'),this[_0x3964('0x12')][_0x1fb401['queue']]));if(_0x53f111['acw']||_0x53f111[_0x3964('0x91')]){ami[_0x3964('0x28')]('custom:agentConnectPreview',{'queue':_0x1fb401[_0x3964('0x44')],'interface':_0x1fb401[_0x3964('0x92')],'uniqueid':_0x1fb401[_0x3964('0x93')]});}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0x95'),this[_0x3964('0x12')][_0x1fb401['queue']]));emitVoiceQueueChannelRemove(ut[_0x3964('0x94')](_0x1fb401,_0x3964('0x95')));_0x53f111[_0x3964('0x96')]+=0x1;_0x53f111[_0x3964('0x97')]+=0x1;_0x53f111[_0x3964('0x98')]+=0x1;ut[_0x3964('0x51')](_0x53f111,'[16]');_0x1fb401['countglobal']=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x4,_0x3964('0x99'));rpcDb[_0x3964('0x68')](_0x1fb401,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x3964('0x6c')](_0x1fb401,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x3964('0x9a')](_0x1fb401);_0x53f111[_0x3964('0x9b')]+=_0x1fb401[_0x3964('0x9c')];_0x53f111[_0x3964('0x9d')]+=_0x1fb401[_0x3964('0x9c')];logger[_0x3964('0x42')](_0x3964('0x9e'),_0x1fb401['uniqueid'],_0x3964('0x8e'),_0x53f111[_0x3964('0x2b')],_0x3964('0x45'),_0x53f111[_0x3964('0x2f')]);delete this[_0x3964('0x14')][_0x20f287['linkedid']];break;case _0x3964('0x9f'):_0x53f111[_0x3964('0xa0')]+=0x1;_0x1fb401[_0x3964('0xa1')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x5,'Busy');_0x1bf1c4=_0x53f111[_0x3964('0xa2')];_0x51fe3d=_0x53f111[_0x3964('0x81')];ami[_0x3964('0x28')]('custom:agentbusy',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xa3')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xa4'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'5',_0x53f111)[_0x3964('0x58')](function(_0x157117){_0x1c676d=_0x157117[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,'Global');rpcDb['createCustomerFinal'](_0x52b179,_0x3964('0xa5'));}else{if(_0x1fb401[_0x3964('0xa1')]>=_0x53f111[_0x3964('0xa6')]){rpcDb[_0x3964('0x6c')](_0x1fb401,_0x3964('0xa4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1fb401,_0x3964('0xa1'),_0x53f111[_0x3964('0xa2')]),_0x1fb401[_0x3964('0xa7')],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401[_0x3964('0xa1')]++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countbusyretry':_0x1fb401[_0x3964('0xa1')]}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case _0x3964('0xaa'):_0x53f111[_0x3964('0xab')]+=0x1;_0x1fb401['countnoanswerretry']+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x3,_0x3964('0xac'));_0x1bf1c4=_0x53f111[_0x3964('0xad')];_0x51fe3d=_0x53f111['callAdditionalPhoneAfterMin'];var _0x541a8e=ut[_0x3964('0xae')](_0x1fb401,_0x53f111);ami['emit'](_0x3964('0xaf'),_0x541a8e);rpcDb[_0x3964('0x68')](_0x1fb401,'[callProgressDetectingCustomer][logNoAnswer]');_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'3',_0x53f111)[_0x3964('0x58')](function(_0x30f7d4){_0x1c676d=_0x30f7d4['additional']==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,'Global');rpcDb[_0x3964('0x6c')](_0x52b179,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x1fb401[_0x3964('0xb0')]>=_0x53f111[_0x3964('0xb1')]){rpcDb['createCustomerFinal'](_0x1fb401,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x3964('0x87')](ut[_0x3964('0xb2')](_0x1fb401,_0x3964('0xb0'),_0x53f111[_0x3964('0xad')]),_0x1fb401['unlockAgent'],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401['countnoanswerretry']++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case _0x3964('0xb3'):_0x53f111[_0x3964('0xb4')]+=0x1;_0x1fb401[_0x3964('0xb5')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x8,_0x3964('0xb6'));_0x1bf1c4=_0x53f111[_0x3964('0xb7')];_0x51fe3d=_0x53f111[_0x3964('0x81')];ami[_0x3964('0x28')]('custom:agentcongestion',ut[_0x3964('0x94')](_0x1fb401,'congestion'));rpcDb[_0x3964('0x68')](_0x1fb401,'[callProgressDetectingCustomer][logCongestion]');_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'8',_0x53f111)[_0x3964('0x58')](function(_0x22ba1d){_0x1c676d=_0x22ba1d[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut['totalGlobal'](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb['createCustomerFinal'](_0x52b179,_0x3964('0xb8'));}else{if(_0x1fb401['countcongestionretry']>=_0x53f111[_0x3964('0xb9')]){rpcDb['createCustomerFinal'](_0x1fb401,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3964('0x87')](ut[_0x3964('0xb2')](_0x1fb401,_0x3964('0xb5'),_0x53f111[_0x3964('0xa2')]),_0x1fb401['unlockAgent'],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401['countcongestionretry']++;_0x52e5ee['incrementPreviewCounters']({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countcongestionretry':_0x1fb401[_0x3964('0xb5')]}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case _0x3964('0xba'):_0x53f111[_0x3964('0xbb')]+=0x1;_0x1fb401[_0x3964('0xbc')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x14,'AgentReject');_0x1bf1c4=_0x53f111[_0x3964('0xbd')];_0x51fe3d=_0x53f111[_0x3964('0x81')];ami['emit']('custom:agentreject',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xbe')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xbf'));_0x52e5ee['verifyAdditionalPhones'](_0x1fb401,'20',_0x53f111)[_0x3964('0x58')](function(_0x4098aa){_0x1c676d=_0x4098aa['additional']==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0x14,_0x3964('0xc0'));rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0xc1'));}else{if(_0x1fb401[_0x3964('0xbc')]>=_0x53f111[_0x3964('0xc2')]){rpcDb[_0x3964('0x6c')](_0x1fb401,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3964('0x87')](ut[_0x3964('0xb2')](_0x1fb401,'countagentrejectretry',_0x53f111[_0x3964('0xbd')]),_0x1fb401[_0x3964('0xa7')],_0x1fb401['activeContact']);}}}else{_0x1fb401['countnoanswerretry']++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401['idContact'],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})[_0x3964('0x58')](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)['then'](function(){});});}});break;case'ABANDONED':_0x53f111[_0x3964('0xc3')]+=0x1;_0x1fb401[_0x3964('0xc4')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut['logCustomer'](_0x1fb401,0xb,_0x3964('0xc5'));rpcDb['createCustomerHistory'](_0x1fb401,_0x3964('0xc6'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'11',_0x53f111)['then'](function(_0x5b8815){_0x1c676d=_0x5b8815[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0xc6'));}else{if(_0x1fb401[_0x3964('0xc7')]>=_0x53f111[_0x3964('0xc8')]){rpcDb[_0x3964('0x6c')](_0x1fb401,_0x3964('0xc6'));}else{rpcDb[_0x3964('0x87')](ut['scheduledAt'](_0x1fb401,'countabandonedretry',_0x53f111[_0x3964('0xc9')]),_0x1fb401[_0x3964('0xa7')],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401[_0x3964('0xb0')]++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})[_0x3964('0x58')](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case'18':_0x53f111['outboundUnknownCallsDay']+=0x1;_0x1fb401[_0x3964('0xca')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x12,_0x20f287[_0x3964('0xcb')]||_0x20f287[_0x3964('0xcc')]);ami[_0x3964('0x28')](_0x3964('0xcd'),ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xce')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xcf'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'18',_0x53f111)[_0x3964('0x58')](function(_0x25b5fb){_0x1c676d=_0x25b5fb[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0x12,_0x3964('0x84'));rpcDb[_0x3964('0x6c')](_0x52b179,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x1fb401,_0x3964('0xcf'));}}else{_0x1fb401['countnoanswerretry']++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401['countnoanswerretry']}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)['then'](function(){});});}});delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];break;case'19':_0x53f111[_0x3964('0xd0')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut['logCustomer'](_0x1fb401,0x13,_0x20f287[_0x3964('0xcb')]||_0x20f287[_0x3964('0xcc')]);ami[_0x3964('0x28')]('custom:amd',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xce')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xd1'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'18',_0x53f111)[_0x3964('0x58')](function(_0x376b84){_0x1c676d=_0x376b84[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut['cloneAction'](_0x1fb401,0xf,'Global');rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0xd1'));}else{rpcDb['createCustomerFinal'](_0x1fb401,'[callProgressDetectingCustomer][machine]');}}else{_0x1fb401[_0x3964('0xb0')]++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})['then'](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];break;default:if(_0x1fb401[_0x3964('0x46')]){ut[_0x3964('0x51')](_0x53f111,_0x3964('0xd2'));ut[_0x3964('0x52')](_0x3964('0xd3')+_0x53f111['name'],_0x20f287);}_0x53f111[_0x3964('0xd0')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0xc,_0x20f287[_0x3964('0xcb')]||_0x20f287['dialstatus']);_0x1bf1c4=_0x53f111[_0x3964('0xbd')];_0x51fe3d=_0x53f111[_0x3964('0x81')];rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xd4'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'20',_0x53f111)[_0x3964('0x58')](function(_0x228ab7){_0x1c676d=_0x228ab7[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb['createCustomerFinal'](_0x52b179,_0x3964('0xd5'));}else{rpcDb[_0x3964('0x6c')](_0x1fb401,_0x3964('0xd5'));}delete this[_0x3964('0x14')][_0x20f287['linkedid']];}else{_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});}});}if(!(_0x1fb401['dialAnswer']&&_0x3b5f84==='16')){utils[_0x3964('0xd6')](_0x53f111,_0x3964('0xd7'));logger[_0x3964('0x42')](_0x3964('0xd8'),_0x1fb401[_0x3964('0x93')],_0x3964('0x8e'),_0x53f111[_0x3964('0x2b')],_0x3964('0xd9'),_0x53f111[_0x3964('0x2e')]);}if(_0x3b5f84!==_0x3964('0xda')){delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];delete this[_0x3964('0x14')][_0x20f287[_0x3964('0xdb')]];}_0x53f111[_0x3964('0xdc')]=!![];}};Preview[_0x3964('0xd')][_0x3964('0xdd')]=function(_0xb346ba,_0x4f40a4,_0x23f437){if(_[_0x3964('0xde')](_0x4f40a4)&&_0x3964('0xdf')!==typeof _0x4f40a4){return;}if(_['isUndefined'](_0x23f437)&&'object'!==typeof _0x23f437){return;}switch(_0x23f437[_0x3964('0xe0')]){case'0':ut[_0x3964('0xe1')](_0xb346ba,0x0,_0x3964('0xe2'));rpcDb[_0x3964('0xe3')](_0xb346ba,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3964('0xe1')](_0xb346ba,0x3,_0x3964('0xac'));rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe4'));break;case'5':ut[_0x3964('0xe1')](_0xb346ba,0x5,_0x3964('0xe5'));rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe6'));break;case'8':ut['logAgent'](_0xb346ba,0x8,_0x3964('0xb6'));rpcDb[_0x3964('0xe3')](_0xb346ba,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0xb346ba,0x16,'AnswerAGI');rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe7'));break;default:ut[_0x3964('0xe1')](_0xb346ba,0xc,_0x23f437[_0x3964('0xe0')]);rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe8'));}utils[_0x3964('0xd6')](_0x4f40a4,_0x3964('0xe9'));logger[_0x3964('0x42')]('[originated][decrement][callProgressDetectingAgent]',_0xb346ba['uniqueid'],_0x3964('0x8e'),_0x4f40a4[_0x3964('0x2b')],_0x3964('0xd9'),_0x4f40a4[_0x3964('0x2e')]);delete this[_0x3964('0x14')][_0xb346ba['uniqueid']];};Preview[_0x3964('0xd')]['verifyAdditionalPhones']=function(_0x1cf4aa,_0x3a384e,_0x3e8be0){return cmHopperAdditionalPhone[_0x3964('0x7e')](_0x1cf4aa,_0x3a384e,_0x3e8be0)[_0x3964('0x4f')](logger[_0x3964('0x42')](_0x3964('0xea')));};Preview[_0x3964('0xd')][_0x3964('0xa9')]=function(_0x3be601,_0x308b68,_0x23a388){return cmHopperAdditionalPhone[_0x3964('0xa9')](_0x3be601,_0x308b68,_0x23a388)['catch'](logger[_0x3964('0x42')](_0x3964('0xeb')));};Preview[_0x3964('0xd')][_0x3964('0xa8')]=function(_0x143555){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x3964('0xa8')](_0x143555))[_0x3964('0x4f')](logger[_0x3964('0x42')](_0x3964('0xec')));};Preview[_0x3964('0xd')]['checkInBlack']=function(_0x49c93f,_0x37c83e,_0x47554a,_0x5479c5,_0x23f371){var _0x3110e6=this;return new Promise(function(_0x4409d1,_0x4aaf2d){if(_['isNil'](_0x37c83e)||_['isNil'](_0x37c83e[_0x3964('0xed')])||_[_0x3964('0x59')](_0x37c83e[_0x3964('0xee')])||_[_0x3964('0x59')](_0x37c83e['VoiceQueueId'])){_0x4aaf2d(ut[_0x3964('0x36')](_0x3964('0xef'),_0x5479c5,_0x23f371));return;}var _0x150d6f=uuid['v4']();var _0x318bef=_0x3110e6[_0x3964('0x12')][_0x37c83e['Queue'][_0x3964('0x2b')]];var _0xf6d4d8=_0x47554a?_0x3110e6[_0x3964('0x15')][_0x47554a]['id']:undefined;_0x3110e6[_0x3964('0x14')][_0x150d6f]=new Action(_0x37c83e,_0x318bef,_0x150d6f,_0x47554a,_0xf6d4d8);var _0x67560d=_0x3110e6['actions'][_0x150d6f];_0x67560d[_0x3964('0xa7')]=_0x5479c5;_0x67560d['activeContact']=_0x23f371;_0x67560d['lookAgent']=_0x47554a;if(_['isEmpty'](_0x49c93f)){_0x3110e6[_0x3964('0xf0')](_0x67560d,_0x318bef,_0x37c83e,_0x47554a)[_0x3964('0x58')](function(_0x5d0478){logger[_0x3964('0x42')](_0x3964('0xf1'),'Queue:\x20'+_0x67560d[_0x3964('0x44')]+'\x20IdHopper:\x20'+_0x67560d[_0x3964('0x8b')],JSON['stringify'](_0x5d0478));ami[_0x3964('0x28')](_0x3964('0xf2'),ut[_0x3964('0x94')](_0x67560d,_0x3964('0xf3'),_0x3110e6['campaignsPreview'][_0x67560d['queue']]));_0x4409d1(ut[_0x3964('0x36')](_0x3964('0xf4')));})[_0x3964('0x4f')](function(_0x56a950){ut[_0x3964('0x33')](_0x3964('0xf5'),_0x56a950);_0x4aaf2d(ut[_0x3964('0x36')](_0x3964('0xf6'),_0x5479c5,_0x23f371));});}else{_0x318bef[_0x3964('0xf7')]+=0x1;ut[_0x3964('0xf8')](_0x67560d);rpcDb[_0x3964('0xf9')](_0x67560d,_0x3964('0xfa'));delete _0x3110e6[_0x3964('0x14')][_0x150d6f];_0x4aaf2d(ut[_0x3964('0x36')]('Contact\x20in\x20black\x20List',_0x5479c5,_0x23f371));}});};Preview['prototype'][_0x3964('0x72')]=function(_0x4319c1){return!_[_0x3964('0x59')](_0x4319c1)&&!_[_0x3964('0x59')](_0x4319c1[_0x3964('0x2b')])&&!_[_0x3964('0x59')](_0x4319c1[_0x3964('0xfb')])&&_0x4319c1['active']&&!_['isNil'](this['trunks'][util['format'](_0x3964('0xfc'),_0x4319c1[_0x3964('0x2b')])])&&!_[_0x3964('0x59')](this[_0x3964('0x13')][util[_0x3964('0x2a')](_0x3964('0xfc'),_0x4319c1[_0x3964('0x2b')])]['status'])&&(this['trunks'][util[_0x3964('0x2a')](_0x3964('0xfc'),_0x4319c1[_0x3964('0x2b')])][_0x3964('0x4d')]===_0x3964('0xfd')||this[_0x3964('0x13')][util[_0x3964('0x2a')]('SIP/%s',_0x4319c1['name'])][_0x3964('0x4d')]===_0x3964('0xfe'));};Preview[_0x3964('0xd')][_0x3964('0x5e')]=function(_0x3925a2,_0x27690c){return this['execRun'](_0x3925a2,_0x27690c)['then'](function(_0x3f30cd){return _[_0x3964('0x47')](_0x3f30cd,[_0x3964('0x36')]);})[_0x3964('0x4f')](function(_0x33ed18){if(_0x33ed18[_0x3964('0xff')]){rpcDb[_0x3964('0x100')](_0x3925a2);}if(_0x33ed18['active']){rpcDb[_0x3964('0x60')](_0x3925a2);}throw _[_0x3964('0x47')](_0x33ed18,[_0x3964('0x36')]);});};Preview[_0x3964('0xd')][_0x3964('0x101')]=function(_0x280b65,_0x4c6b61){var _0x4b2b39=this;var _0x2d4dc2,_0x45b277;return rpcDb[_0x3964('0x102')](_0x280b65)[_0x3964('0x58')](function(_0x5d4835){if(!_[_0x3964('0x59')](_0x5d4835[0x0])){_0x45b277=_0x5d4835[0x0][_0x3964('0x103')]?![]:!![];_0x2d4dc2=_0x5d4835[0x0][_0x3964('0x103')]?!![]:![];_0x2d4dc2=_0x4c6b61?!![]:_0x2d4dc2;}var _0x5b55e1=_0x4b2b39[_0x3964('0x104')](_0x5d4835);if(_0x5b55e1[_0x3964('0x105')]){rpcDb['checkIsBlackList'](_[_0x3964('0x47')](_0x5d4835[0x0],[_0x3964('0x4a'),_0x3964('0xee')]))[_0x3964('0x58')](function(_0x55255c){_0x4b2b39[_0x3964('0x106')](_0x55255c,_0x5d4835[0x0],_0x4c6b61,_0x45b277,_0x2d4dc2)[_0x3964('0x58')](function(_0x5bfe08){return _0x5bfe08;})['catch'](function(_0x590e1a){throw _0x590e1a;});})[_0x3964('0x4f')](function(_0xe31e3e){ut[_0x3964('0x33')](_0x3964('0x107'),_0xe31e3e);throw ut[_0x3964('0x36')](_0x3964('0x108'),_0x45b277,_0x2d4dc2);});}else{throw ut['message'](_0x5b55e1[_0x3964('0x36')],_0x45b277,_0x2d4dc2);}})[_0x3964('0x4f')](function(_0x2e4462){ut['logger'](_0x3964('0x109'),_0x2e4462);throw ut[_0x3964('0x36')](_0x3964('0x108'),![],!![]);});};Preview[_0x3964('0xd')][_0x3964('0x104')]=function(_0x223654){if(_[_0x3964('0x59')](_0x223654)||_[_0x3964('0x10a')](_0x223654)||!_[_0x3964('0x59')](_0x223654[0x0]['Agent'])&&_[_0x3964('0x59')](_0x223654[0x0][_0x3964('0x5d')]['name'])){ut['logger'](_0x3964('0x10b'),_0x223654);return{'isValid':![],'message':_0x3964('0x10c')};}var _0x56b0fc=this['campaignsPreview'][_0x223654[0x0][_0x3964('0x10d')][_0x3964('0x2b')]];_0x56b0fc[_0x3964('0x36')]=utils[_0x3964('0x32')]['ACTIVE'];if(_[_0x3964('0x59')](_0x56b0fc)){ut[_0x3964('0x33')](_0x3964('0x10e'),_0x56b0fc);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x56b0fc[_0x3964('0x73')])){ut[_0x3964('0x33')](_0x3964('0x10f'),_0x3964('0x110')+_0x56b0fc[_0x3964('0x2b')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x3964('0x72')](_0x56b0fc[_0x3964('0x74')])){ut[_0x3964('0x33')](_0x3964('0x10f'),_0x56b0fc['name']+_0x3964('0x111'));return{'isValid':![],'message':_0x3964('0x112')};}}if(!ut[_0x3964('0x70')](_0x56b0fc[_0x3964('0x3e')])){ut[_0x3964('0x33')](_0x3964('0x113'),_0x56b0fc['name']+_0x3964('0x114'));return{'isValid':![],'message':_0x3964('0x110')+_0x56b0fc['name']+_0x3964('0x114')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x3964('0xd')][_0x3964('0xf0')]=function(_0x3834b2,_0x382999,_0x1833ee,_0x58d881){var _0xcecd44=this;return new Promise(function(_0x515b0c,_0x33454f){var _0x1ff45a=_0x3834b2[_0x3964('0x93')];var _0x4defd7=_0xcecd44[_0x3964('0x72')](_0x382999[_0x3964('0x73')])?util['format'](_0x3964('0x115'),_0x382999[_0x3964('0x73')]['name'],_[_0x3964('0x59')](_0x382999[_0x3964('0x116')])?'':_0x382999['dialPrefix'][_0x3964('0x117')]()||'',_0x382999['dialCutDigit']>0x0?_0x1833ee[_0x3964('0xee')]['substring'](_0x382999[_0x3964('0x118')]):_0x1833ee[_0x3964('0xee')]):util[_0x3964('0x2a')](_0x3964('0x115'),_[_0x3964('0x59')](_0x382999['TrunkBackup'])?_0x382999['Trunk'][_0x3964('0x2b')]:_0x382999['TrunkBackup'][_0x3964('0x2b')],_['isNil'](_0x382999['dialPrefix'])?'':_0x382999['dialPrefix'][_0x3964('0x117')]()||'',_0x382999[_0x3964('0x118')]>0x0?_0x1833ee['phone'][_0x3964('0x119')](_0x382999[_0x3964('0x118')]):_0x1833ee['phone']);var _0x5dfafc=_0xcecd44[_0x3964('0x72')](_0x382999[_0x3964('0x73')])?ut[_0x3964('0x11a')](_0x382999['Trunk'][_0x3964('0x11b')],_0x382999[_0x3964('0x11c')],_0x382999[_0x3964('0x11d')]>0x0?ut[_0x3964('0x11e')](_0x382999[_0x3964('0x11f')],_0x382999['dialRandomLastDigitCallerIdNumber']):_0x382999['dialOriginateCallerIdNumber']):ut[_0x3964('0x11a')](_['isNil'](_0x382999[_0x3964('0x74')])?_0x382999[_0x3964('0x73')][_0x3964('0x11b')]:_0x382999[_0x3964('0x74')][_0x3964('0x11b')],_0x382999['dialOriginateCallerIdName'],_0x382999[_0x3964('0x11d')]>0x0?ut['getCallerIdRandom'](_0x382999[_0x3964('0x11f')],_0x382999[_0x3964('0x11d')]):_0x382999[_0x3964('0x11f')]);if(_0x5dfafc){_0x3834b2['originatecalleridname']=ut['extractCalleridName'](_0x5dfafc);_0x3834b2[_0x3964('0x120')]=ut[_0x3964('0x121')](_0x5dfafc);}var _0x2c2c0a=ut[_0x3964('0x122')](_0x382999,_0x1833ee,_0x4defd7,_0x5dfafc,_0x1ff45a,_0x3834b2);var _0x565d90=utils[_0x3964('0x123')](_0x1833ee[_0x3964('0xed')]);Object[_0x3964('0x124')](_0x2c2c0a,_0x565d90);_[_0x3964('0x125')](_0x3834b2,ut['toLowerVariables'](_0x2c2c0a));_0x3834b2['starttime']=moment()[_0x3964('0x2a')](_0x3964('0x62'));_0x382999[_0x3964('0x126')]=_0x2c2c0a;var _0x30d86e=ut['variablesAction'](_0x3834b2,_0x382999,_0x2c2c0a,_0x3834b2[_0x3964('0x88')],_0x58d881);return ami['Action'](_0x30d86e)[_0x3964('0x58')](function(_0x426f1f){_0x382999[_0x3964('0x2e')]+=0x1;logger[_0x3964('0x42')](_0x3964('0x127'),_0x1ff45a,_0x3964('0x8e'),_0x382999[_0x3964('0x2b')],_0x3964('0xd9'),_0x382999[_0x3964('0x2e')]);_0x515b0c(_0x426f1f);})[_0x3964('0x4f')](function(_0xfb9193){ut[_0x3964('0xe1')](_0x3834b2,0xe,_0x3964('0x128'));rpcDb['createAgentHistory'](_0x3834b2,_0x3964('0x129'));_0x33454f(_0xfb9193);});});};Preview['prototype'][_0x3964('0x20')]=function(_0x5e19f0){if(this[_0x3964('0x14')][_0x5e19f0[_0x3964('0x89')]]){this[_0x3964('0x14')][_0x5e19f0[_0x3964('0x89')]]['channel']=_0x5e19f0[_0x3964('0x4e')];}};Preview[_0x3964('0xd')][_0x3964('0x18')]=function(_0x407f4e){var _0x118ebf=this;var _0x5ddc2b=this[_0x3964('0x14')][_0x407f4e[_0x3964('0x12a')]];if(_0x5ddc2b){if(_0x5ddc2b[_0x3964('0x12b')]&&this['agents'][_0x5ddc2b[_0x3964('0x12b')]]){ut['logLookAgent'](_0x5ddc2b,this[_0x3964('0x15')][_0x5ddc2b[_0x3964('0x12b')]][_0x3964('0x2b')],this[_0x3964('0x15')][_0x5ddc2b[_0x3964('0x12b')]]['id']);}var _0x2f6737=_[_0x3964('0x12c')](_0x5ddc2b);_0x2f6737[_0x3964('0x12d')]=moment()['format'](_0x3964('0x62'));var _0x5e665=_0x118ebf['campaignsPreview'][_0x5ddc2b[_0x3964('0x44')]];if(ut[_0x3964('0x12e')](_0x407f4e[_0x3964('0x12f')])){if(_0x5ddc2b[_0x3964('0xa7')]){rpcDb['unlockContact'](_0x5ddc2b['idContact']);}if(_0x5ddc2b[_0x3964('0x88')]){rpcDb[_0x3964('0x60')](_0x5ddc2b['idContact']);}ami[_0x3964('0x28')](_0x3964('0x130'),ut[_0x3964('0x94')](_0x5ddc2b,_0x3964('0x131'),this[_0x3964('0x12')][_0x5ddc2b[_0x3964('0x44')]]));this[_0x3964('0xdd')](_0x2f6737,_0x5e665,_0x407f4e);}else{_0x5ddc2b[_0x3964('0x61')]=moment()[_0x3964('0x2a')](_0x3964('0x62'));ut[_0x3964('0xe1')](_0x2f6737,0x4,'Answer');rpcDb[_0x3964('0xe3')](_0x2f6737,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x3964('0xd')][_0x3964('0x1b')]=function(_0x1e8063){var _0x528ddb=this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]];var _0xf76852;if(_0x528ddb){_0xf76852=this[_0x3964('0x12')][_0x528ddb[_0x3964('0x44')]];logger[_0x3964('0x42')](_0x3964('0x132'),_0x1e8063[_0x3964('0x89')],_0x3964('0x8e'),_0xf76852[_0x3964('0x2b')],'pTalking:\x20',_0xf76852[_0x3964('0x2f')]);}if(this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]]&&_0x1e8063[_0x3964('0x89')]!==_0x1e8063[_0x3964('0x93')]){if(_0x1e8063['cause']==='16'&&this['actions'][_0x1e8063[_0x3964('0x89')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x1e8063,_0x1e8063[_0x3964('0x89')],_0x1e8063['cause']);}else if(this[_0x3964('0x14')][_0x1e8063['linkedid']][_0x3964('0x46')]){logger[_0x3964('0x42')](_0x3964('0x133'),_0x1e8063[_0x3964('0x89')],_0x1e8063['cause'],'\x20Queue',_0xf76852[_0x3964('0x2b')],'pTalking:\x20',_0xf76852[_0x3964('0x2f')]);this[_0x3964('0x76')](_0x1e8063,_0x1e8063[_0x3964('0x89')],_0x1e8063[_0x3964('0x134')]);}}else if(_0x528ddb&&_[_0x3964('0x59')](_0x528ddb[_0x3964('0x135')])&&_0xf76852[_0x3964('0x136')]&&_0x1e8063[_0x3964('0x89')]===_0x1e8063[_0x3964('0x93')]&&_[_0x3964('0x59')](_0x1e8063[_0x3964('0xe0')])&&_0x1e8063[_0x3964('0x134')]==='16'&&_0x1e8063[_0x3964('0x137')]==='6'&&_[_0x3964('0xde')](_0x528ddb[_0x3964('0x138')])){if(_0x528ddb[_0x3964('0xa7')]){rpcDb[_0x3964('0x100')](_0x528ddb[_0x3964('0x8b')]);}if(_0x528ddb[_0x3964('0x88')]){rpcDb[_0x3964('0x60')](_0x528ddb[_0x3964('0x8b')]);}_0x1e8063[_0x3964('0xe0')]='22';this['callProgressDetectingAgent'](_0x528ddb,_0xf76852,_0x1e8063);}else if(_0x528ddb&&_0x528ddb[_0x3964('0x138')]){if(_0x1e8063[_0x3964('0x134')]==='16'&&this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]][_0x3964('0x46')]){logger[_0x3964('0x42')](_0x3964('0x139'),_0x1e8063[_0x3964('0x89')],_0x1e8063['cause'],_0x3964('0x8e'),_0xf76852[_0x3964('0x2b')],'pTalking:\x20',_0xf76852['pTalking']);this['callProgressDetectingCustomer'](_0x1e8063,_0x1e8063['linkedid'],_0x1e8063['cause']);}else if(this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]][_0x3964('0x46')]){logger[_0x3964('0x42')](_0x3964('0x133'),_0x1e8063[_0x3964('0x89')],_0x1e8063[_0x3964('0x134')],_0x3964('0x8e'),_0xf76852[_0x3964('0x2b')],_0x3964('0x45'),_0xf76852[_0x3964('0x2f')]);this[_0x3964('0x76')](_0x1e8063,_0x1e8063[_0x3964('0x89')],_0x1e8063[_0x3964('0x134')]);}}};Preview[_0x3964('0xd')]['syncDialEnd']=function(_0x16ae3a){if(this[_0x3964('0x14')][_0x16ae3a[_0x3964('0xdb')]]&&_0x16ae3a['destlinkedid']!==_0x16ae3a['destuniqueid']){this[_0x3964('0x76')](_0x16ae3a,_0x16ae3a[_0x3964('0xdb')],_0x16ae3a[_0x3964('0xcc')]);}};Preview['prototype'][_0x3964('0x1d')]=function(_0xe7b123){if(this['actions'][_0xe7b123[_0x3964('0x89')]]&&_0xe7b123[_0x3964('0x89')]!==_0xe7b123[_0x3964('0x93')]&&!this['actions'][_0xe7b123['linkedid']][_0x3964('0x46')]){if(_0xe7b123[_0x3964('0x134')]==='1'){this[_0x3964('0x76')](_0xe7b123,_0xe7b123['linkedid'],_0xe7b123[_0x3964('0x134')]);}}};Preview[_0x3964('0xd')][_0x3964('0x13a')]=function(_0x4d6a5f,_0x29fc7c,_0x69d360){if(this['actions'][_0x4d6a5f]){if(_[_0x3964('0x59')](this[_0x3964('0x14')][_0x4d6a5f][_0x3964('0x126')])){this[_0x3964('0x14')][_0x4d6a5f][_0x3964('0x126')]={};}this[_0x3964('0x14')][_0x4d6a5f][_0x3964('0x126')][_0x29fc7c]=_0x69d360;}};Preview[_0x3964('0xd')]['syncVarSet']=function(_0x6fdeb6){try{if(!_[_0x3964('0x59')](_0x6fdeb6)){if(ut[_0x3964('0x13b')](_[_0x3964('0x13c')](_0x6fdeb6['variable'])[0x0])){this['addVariable'](_0x6fdeb6[_0x3964('0x93')],_[_0x3964('0x13c')](_0x6fdeb6[_0x3964('0x13d')])[0x0],_0x6fdeb6[_0x3964('0x13e')]);}}}catch(_0xab8dcc){logger[_0x3964('0x13f')]('[syncVarSet][Preview]',util['inspect'](_0xab8dcc,{'showHidden':![],'depth':null}));}};Preview[_0x3964('0xd')]['syncAttendedTransfer']=function(_0x115254){if(_0x115254){if(this[_0x3964('0x14')][_0x115254['transfertargetlinkedid']]){this[_0x3964('0x14')][_0x115254[_0x3964('0x140')]][_0x3964('0x138')]=!![];}}};Preview[_0x3964('0xd')]['syncBlindTransfer']=function(_0x4b9d99){if(_0x4b9d99){if(this[_0x3964('0x14')][_0x4b9d99[_0x3964('0x141')]]){this[_0x3964('0x14')][_0x4b9d99['transfererlinkedid']][_0x3964('0x138')]=!![];}}};module[_0x3964('0x142')]=Preview; \ No newline at end of file +var _0x295e=['dialOriginateCallerIdName','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','Contact','merge','toLowerVariables','starttime','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','blindtransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','loopCampaigns','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','campaignsPreview','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','additional','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','unlockAgent','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','incrementPreviewCounters','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','recallme','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','validateContact','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber'];(function(_0x5a14ba,_0x44fb9f){var _0x3305e4=function(_0x257f1c){while(--_0x257f1c){_0x5a14ba['push'](_0x5a14ba['shift']());}};_0x3305e4(++_0x44fb9f);}(_0x295e,0x178));var _0xe295=function(_0x258d1a,_0x4a0e6a){_0x258d1a=_0x258d1a-0x0;var _0x281c9a=_0x295e[_0x258d1a];return _0x281c9a;};'use strict';var util=require(_0xe295('0x0'));var _=require(_0xe295('0x1'));var uuid=require(_0xe295('0x2'));var moment=require(_0xe295('0x3'));var Redis=require(_0xe295('0x4'));var config=require(_0xe295('0x5'));var logger=require(_0xe295('0x6'))(_0xe295('0x7'));var loggerAction=require(_0xe295('0x6'))(_0xe295('0x8'));var ami=require(_0xe295('0x9'));var rpcDb=require(_0xe295('0xa'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xe295('0xb'));var utils=require('../dialer/utils');config[_0xe295('0xc')]=_[_0xe295('0xd')](config[_0xe295('0xc')],{'host':_0xe295('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe295('0xc')]));var Sequence=function(){};Sequence[_0xe295('0xf')][_0xe295('0x10')]=function(_0x157b6d){this[_0xe295('0x11')]=this[_0xe295('0x11')]?this['tail'][_0xe295('0x12')](_0x157b6d):_0x157b6d();};function Preview(_0x18d7a6){this[_0xe295('0x13')]=new Sequence();this['campaignsPreview']=_0x18d7a6[_0xe295('0x14')];this['trunks']=_0x18d7a6[_0xe295('0x15')];this[_0xe295('0x16')]={};this[_0xe295('0x17')]=_0x18d7a6['agents'];this[_0xe295('0x18')]=0x0;ami['on'](_0xe295('0x19'),this[_0xe295('0x1a')][_0xe295('0x1b')](this));ami['on'](_0xe295('0x1c'),this[_0xe295('0x1d')][_0xe295('0x1b')](this));ami['on'](_0xe295('0x1e'),this[_0xe295('0x1f')][_0xe295('0x1b')](this));ami['on'](_0xe295('0x20'),this[_0xe295('0x21')]['bind'](this));ami['on'](_0xe295('0x22'),this[_0xe295('0x23')][_0xe295('0x1b')](this));ami['on']('varset',this[_0xe295('0x24')]['bind'](this));ami['on'](_0xe295('0x25'),this['syncAttendedTransfer'][_0xe295('0x1b')](this));ami['on'](_0xe295('0x26'),this['syncBlindTransfer'][_0xe295('0x1b')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x274d6f,_0x13c730,_0x233e6b){io['to'](_0x274d6f)[_0xe295('0x27')](_0x13c730,_0x233e6b);}function emitVoiceQueueChannelRemove(_0x2d3008){logger[_0xe295('0x28')](_0xe295('0x29'),JSON[_0xe295('0x2a')](_0x2d3008));emit(util[_0xe295('0x2b')](_0xe295('0x2c'),_0x2d3008[_0xe295('0x2d')]),_0xe295('0x2e'),_0x2d3008);io['emit'](_0xe295('0x2f'),_0x2d3008);}function notSendMessagesQueue(_0x1db866){if(_0x1db866[_0xe295('0x30')]){if(_0x1db866[_0xe295('0x31')]===0x0&&_0x1db866[_0xe295('0x32')]===0x0){_0x1db866[_0xe295('0x30')]=![];_0x1db866[_0xe295('0x33')]=0x0;_0x1db866[_0xe295('0x34')]=0x0;_0x1db866[_0xe295('0x35')]=utils[_0xe295('0x36')][_0xe295('0x37')];ut[_0xe295('0x38')](_0xe295('0x39'),_0x1db866[_0xe295('0x2d')]+_0xe295('0x3a'));}else{_0x1db866[_0xe295('0x35')]=utils[_0xe295('0x36')]['DEACTIVATED'];ut[_0xe295('0x38')](_0xe295('0x39'),_0x1db866['name']+'\x20is\x20deactivated');}}}Preview[_0xe295('0xf')][_0xe295('0x3b')]=function(){var _0xef1ed7=this;setInterval(function(){_0xef1ed7[_0xe295('0x3c')]();},0x7cf);};Preview[_0xe295('0xf')]['syncCampaigns']=function(){var _0x3cdf6e=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x3210b4 in _0x3cdf6e){if(_0x3cdf6e['hasOwnProperty'](_0x3210b4)&&(_0x3cdf6e[_0x3210b4][_0xe295('0x3d')]===_0xe295('0x7')||_0x3cdf6e[_0x3210b4]['dialMethod']===_0xe295('0x3e'))&&_0x3cdf6e[_0x3210b4][_0xe295('0x3f')]===_0xe295('0x40')){if(this[_0xe295('0x18')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xe295('0x41')]();}}if(_0x3cdf6e[_0xe295('0x42')](_0x3210b4)&&_0x3cdf6e[_0x3210b4][_0xe295('0x3d')]===_0xe295('0x7')&&_0x3cdf6e[_0x3210b4][_0xe295('0x3f')]==='outbound'){if(_0x3cdf6e[_0x3210b4][_0xe295('0x43')]){this[_0xe295('0x44')](_0x3cdf6e[_0x3210b4]);if(_0x3cdf6e[_0x3210b4][_0xe295('0x45')])this[_0xe295('0x46')](_0x3cdf6e[_0x3210b4]);}else{notSendMessagesQueue(_0x3cdf6e[_0x3210b4]);}}}};Preview[_0xe295('0xf')][_0xe295('0x47')]=function(_0x51b654){var _0x3108af=this;this[_0xe295('0x13')][_0xe295('0x10')](function(){if(!_[_0xe295('0x48')](_0x3108af['actions'][_0x51b654])){loggerAction[_0xe295('0x28')](_0xe295('0x49'),_0x51b654,_0xe295('0x4a'),_0x3108af['actions'][_0x51b654][_0xe295('0x4b')],'originated:\x20',JSON[_0xe295('0x2a')](_0x3108af['campaignsPreview'][_0x3108af[_0xe295('0x16')][_0x51b654][_0xe295('0x4b')]]['originated']),_0xe295('0x4c'),JSON[_0xe295('0x2a')](_0x3108af[_0xe295('0x4d')][_0x3108af['actions'][_0x51b654]['queue']][_0xe295('0x32')]),JSON[_0xe295('0x2a')](_0x3108af[_0xe295('0x16')][_0x51b654][_0xe295('0x4e')]),JSON['stringify'](_[_0xe295('0x4f')](_0x3108af[_0xe295('0x16')][_0x51b654],[_0xe295('0x50'),_0xe295('0x51'),_0xe295('0x52'),_0xe295('0x53')])));return ami[_0xe295('0x54')]({'action':_0xe295('0x55'),'channel':_0x3108af[_0xe295('0x16')][_0x51b654][_0xe295('0x56')]})[_0xe295('0x57')](function(_0x5eeacc){if(_0x5eeacc[_0xe295('0x35')]===_0xe295('0x58')){setTimeout(function(){if(_0x3108af['actions'][_0x51b654]){utils[_0xe295('0x59')](_0x3108af[_0xe295('0x4d')][_0x3108af['actions'][_0x51b654]['queue']],_0xe295('0x5a'));if(_0x3108af[_0xe295('0x16')][_0x51b654][_0xe295('0x4e')]===!![]){ut[_0xe295('0x5b')](_0x3108af['campaignsPreview'][_0x3108af[_0xe295('0x16')][_0x51b654][_0xe295('0x4b')]],_0xe295('0x5a'));ut[_0xe295('0x5c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x51b654,_0x3108af[_0xe295('0x16')][_0x51b654][_0xe295('0x4b')]);}ut[_0xe295('0x5c')](_0xe295('0x5d')+_0x51b654,_0x3108af[_0xe295('0x16')][_0x51b654]['queue']);delete _0x3108af['actions'][_0x51b654];}},0x2328);}});}});};Preview[_0xe295('0xf')][_0xe295('0x41')]=function(){var _0xf5768d=this;loggerAction[_0xe295('0x28')](_0xe295('0x5e'),_[_0xe295('0x5f')](this[_0xe295('0x16')]));for(var _0x1a3a9e in this[_0xe295('0x16')]){if(_0xf5768d['actions'][_0xe295('0x42')](_0x1a3a9e)){_0xf5768d['clearZombieChannel'](_0x1a3a9e);}}};Preview[_0xe295('0xf')][_0xe295('0x46')]=function(_0x23af38){var _0x283339=this;rpcDb[_0xe295('0x60')](_0x23af38['id'],ut[_0xe295('0x61')](this['agents']))[_0xe295('0x62')](function(_0x5a6490){if(!_['isNil'](_0x5a6490)){for(var _0x3a89c8=0x0;_0x3a89c8<_0x5a6490[_0xe295('0x63')];_0x3a89c8+=0x1){if(ut[_0xe295('0x64')](_0x5a6490[_0x3a89c8][_0xe295('0x65')])<_0x23af38[_0xe295('0x66')]*0x3c){if(_0x5a6490[_0x3a89c8][_0xe295('0x67')]&&!_0x5a6490[_0x3a89c8][_0xe295('0x67')][_0xe295('0x68')]){_0x283339[_0xe295('0x69')](_0x5a6490[_0x3a89c8]['id'])[_0xe295('0x62')](ut[_0xe295('0x6a')](_0xe295('0x6b')))[_0xe295('0x57')](ut[_0xe295('0x6a')](_0xe295('0x6b')));}else{rpcDb[_0xe295('0x6c')](_0x5a6490[_0x3a89c8]['id']);}}else{var _0x4b07b3=new Action(_0x5a6490[_0x3a89c8],_0x23af38);_0x4b07b3['starttime']=moment()[_0xe295('0x2b')](_0xe295('0x6d'));_0x23af38[_0xe295('0x6e')]+=0x1;ut[_0xe295('0x6f')](_0x4b07b3,0x17,'RecallInQueue');if(_0x23af38[_0xe295('0x70')]){rpcDb[_0xe295('0x71')](ut[_0xe295('0x72')](_0x5a6490[_0x3a89c8]));rpcDb[_0xe295('0x73')](_0x4b07b3,_0xe295('0x74'));}else{ut[_0xe295('0x6f')](_0x4b07b3,0x16,_0xe295('0x75'));rpcDb[_0xe295('0x73')](_0x4b07b3,_0xe295('0x76'));rpcDb[_0xe295('0x77')](_0x4b07b3,_0xe295('0x76'));}}}}})[_0xe295('0x57')](ut[_0xe295('0x6a')](_0xe295('0x78')));};Preview['prototype'][_0xe295('0x44')]=function(_0x97a00f){_0x97a00f[_0xe295('0x30')]=!![];if(ut[_0xe295('0x79')](_0x97a00f[_0xe295('0x7a')])){_0x97a00f[_0xe295('0x35')]=utils['CAMPAIGN_STATUS'][_0xe295('0x7b')];}else if(!ut[_0xe295('0x7c')](_0x97a00f[_0xe295('0x43')])){_0x97a00f[_0xe295('0x35')]=utils['CAMPAIGN_STATUS'][_0xe295('0x37')];}else if(!this['isTrunkReachable'](_0x97a00f[_0xe295('0x7d')])){if(!this[_0xe295('0x7e')](_0x97a00f['TrunkBackup'])){_0x97a00f[_0xe295('0x35')]=utils[_0xe295('0x36')][_0xe295('0x7f')];}else{_0x97a00f[_0xe295('0x35')]=utils[_0xe295('0x36')][_0xe295('0x80')];}}else{_0x97a00f[_0xe295('0x35')]=utils[_0xe295('0x36')][_0xe295('0x80')];}};Preview[_0xe295('0xf')]['callProgressDetectingCustomer']=function(_0x22f6cf,_0x44870b,_0x44209d){var _0x5415d5=this;var _0x25ade8=this['actions'][_0x44870b];var _0x23d214=this[_0xe295('0x4d')][_0x25ade8[_0xe295('0x4b')]];var _0xbd3b56;var _0x43211f=![];var _0x184a6a=0x2;var _0x558173=0x3;if(_0x23d214){switch(_0x44209d){case'1':_0x23d214[_0xe295('0x81')]+=0x1;_0x25ade8[_0xe295('0x82')]+=0x1;_0x25ade8[_0xe295('0x83')]=ut[_0xe295('0x84')](_0x25ade8);ut['logCustomer'](_0x25ade8,0x0,_0xe295('0x85'));ami[_0xe295('0x27')]('custom:agentnosuchnumber',ut[_0xe295('0x86')](_0x25ade8,'nosuchnumber'));rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0x87'));_0x5415d5['verifyAdditionalPhones'](_0x25ade8,'0',_0x23d214)['then'](function(_0x52e199){_0x43211f=_0x52e199['additional']==0x1;_0x184a6a=_0x23d214[_0xe295('0x88')];_0x558173=_0x23d214[_0xe295('0x89')];if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0xf,_0xe295('0x8c'));rpcDb[_0xe295('0x77')](_0xbd3b56,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x25ade8['countnosuchnumberretry']>=_0x23d214['dialNoSuchNumberMaxRetry']){rpcDb[_0xe295('0x77')](_0x25ade8,_0xe295('0x8d'));}else{rpcDb[_0xe295('0x8e')](ut[_0xe295('0x8f')](_0x25ade8,'countnosuchnumberretry',_0x23d214[_0xe295('0x88')]),_0x25ade8['unlockAgent'],_0x25ade8[_0xe295('0x90')]);}}delete this[_0xe295('0x16')][_0x22f6cf[_0xe295('0x91')]];}else{_0x25ade8[_0xe295('0x82')]++;logger[_0xe295('0x28')](_0xe295('0x92'),_0x25ade8[_0xe295('0x82')]);logger['info']('id',_0x25ade8[_0xe295('0x93')]);_0x5415d5['incrementPreviewCounters']({'id':_0x25ade8['idContact'],'field':{'countnosuchnumberretry':_0x25ade8[_0xe295('0x82')]}})[_0xe295('0x62')](function(){_0x5415d5['swapAdditionalPhones'](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});});}});break;case _0xe295('0x94'):var _0x5c61d4=moment()['format'](_0xe295('0x6d'));_0x25ade8['responsetime']=_0x5c61d4;_0x25ade8[_0xe295('0x95')]=_0x5c61d4;_0x25ade8[_0xe295('0x4e')]=!![];_0x23d214[_0xe295('0x32')]+=0x1;logger['info'](_0xe295('0x96'),_0x25ade8[_0xe295('0x97')],'\x20Queue',_0x23d214['name'],_0xe295('0x4c'),_0x23d214[_0xe295('0x32')]);ami[_0xe295('0x27')](_0xe295('0x98'),ut[_0xe295('0x86')](_0x25ade8,_0xe295('0x99'),this['campaignsPreview'][_0x25ade8[_0xe295('0x4b')]]));if(_0x23d214[_0xe295('0x9a')]||_0x23d214['mandatoryDisposition']){ami['emit'](_0xe295('0x9b'),{'queue':_0x25ade8[_0xe295('0x4b')],'interface':_0x25ade8[_0xe295('0x9c')],'uniqueid':_0x25ade8[_0xe295('0x97')]});}break;case'16':ami[_0xe295('0x27')](_0xe295('0x9d'),ut[_0xe295('0x86')](_0x25ade8,_0xe295('0x9e'),this[_0xe295('0x4d')][_0x25ade8['queue']]));emitVoiceQueueChannelRemove(ut[_0xe295('0x86')](_0x25ade8,'complete'));_0x23d214[_0xe295('0x9f')]+=0x1;_0x23d214[_0xe295('0xa0')]+=0x1;_0x23d214[_0xe295('0xa1')]+=0x1;ut['decrementTalking'](_0x23d214,'[16]');_0x25ade8['countglobal']=ut[_0xe295('0x84')](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0x4,_0xe295('0xa2'));rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xa3'));rpcDb[_0xe295('0x77')](_0x25ade8,_0xe295('0xa4'));rpcDb['crateCustomerReportQueue'](_0x25ade8);_0x23d214[_0xe295('0xa5')]+=_0x25ade8[_0xe295('0xa6')];_0x23d214['sumBillable']+=_0x25ade8[_0xe295('0xa6')];logger[_0xe295('0x28')](_0xe295('0xa7'),_0x25ade8[_0xe295('0x97')],_0xe295('0xa8'),_0x23d214['name'],_0xe295('0x4c'),_0x23d214['pTalking']);delete this['actions'][_0x22f6cf[_0xe295('0x91')]];break;case _0xe295('0xa9'):_0x23d214['outboundBusyCallsDay']+=0x1;_0x25ade8['countbusyretry']+=0x1;_0x25ade8[_0xe295('0x83')]=ut[_0xe295('0x84')](_0x25ade8);ut['logCustomer'](_0x25ade8,0x5,_0xe295('0xaa'));_0x184a6a=_0x23d214[_0xe295('0xab')];_0x558173=_0x23d214[_0xe295('0x89')];ami[_0xe295('0x27')](_0xe295('0xac'),ut['buildObj'](_0x25ade8,_0xe295('0xad')));rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xae'));_0x5415d5[_0xe295('0xaf')](_0x25ade8,'5',_0x23d214)[_0xe295('0x62')](function(_0x18d06e){_0x43211f=_0x18d06e[_0xe295('0xb0')]==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0xf,_0xe295('0x8c'));rpcDb[_0xe295('0x77')](_0xbd3b56,_0xe295('0xb1'));}else{if(_0x25ade8[_0xe295('0xb2')]>=_0x23d214[_0xe295('0xb3')]){rpcDb['createCustomerFinal'](_0x25ade8,_0xe295('0xae'));}else{rpcDb[_0xe295('0x8e')](ut['scheduledAt'](_0x25ade8,_0xe295('0xb2'),_0x23d214[_0xe295('0xab')]),_0x25ade8[_0xe295('0xb4')],_0x25ade8[_0xe295('0x90')]);}}}else{_0x25ade8[_0xe295('0xb2')]++;_0x5415d5['incrementPreviewCounters']({'id':_0x25ade8[_0xe295('0x93')],'field':{'countbusyretry':_0x25ade8[_0xe295('0xb2')]}})[_0xe295('0x62')](function(){_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)['then'](function(){});});}});break;case _0xe295('0xb6'):_0x23d214[_0xe295('0xb7')]+=0x1;_0x25ade8[_0xe295('0xb8')]+=0x1;_0x25ade8[_0xe295('0x83')]=ut[_0xe295('0x84')](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0x3,_0xe295('0xb9'));_0x184a6a=_0x23d214[_0xe295('0xba')];_0x558173=_0x23d214[_0xe295('0x89')];var _0x236e92=ut[_0xe295('0xbb')](_0x25ade8,_0x23d214);ami[_0xe295('0x27')](_0xe295('0xbc'),_0x236e92);rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xbd'));_0x5415d5[_0xe295('0xaf')](_0x25ade8,'3',_0x23d214)[_0xe295('0x62')](function(_0xd45d69){_0x43211f=_0xd45d69[_0xe295('0xb0')]==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut['cloneAction'](_0x25ade8,0xf,_0xe295('0x8c'));rpcDb[_0xe295('0x77')](_0xbd3b56,_0xe295('0xbe'));}else{if(_0x25ade8[_0xe295('0xb8')]>=_0x23d214[_0xe295('0xbf')]){rpcDb[_0xe295('0x77')](_0x25ade8,_0xe295('0xbd'));}else{rpcDb[_0xe295('0x8e')](ut[_0xe295('0x8f')](_0x25ade8,_0xe295('0xb8'),_0x23d214[_0xe295('0xba')]),_0x25ade8[_0xe295('0xb4')],_0x25ade8[_0xe295('0x90')]);}}}else{_0x25ade8[_0xe295('0xb8')]++;_0x5415d5[_0xe295('0xc0')]({'id':_0x25ade8['idContact'],'field':{'countnoanswerretry':_0x25ade8[_0xe295('0xb8')]}})[_0xe295('0x62')](function(){_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});});}});break;case _0xe295('0xc1'):_0x23d214['outboundCongestionCallsDay']+=0x1;_0x25ade8[_0xe295('0xc2')]+=0x1;_0x25ade8['countglobal']=ut[_0xe295('0x84')](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0x8,_0xe295('0xc3'));_0x184a6a=_0x23d214[_0xe295('0xc4')];_0x558173=_0x23d214['callAdditionalPhoneAfterMin'];ami[_0xe295('0x27')](_0xe295('0xc5'),ut[_0xe295('0x86')](_0x25ade8,_0xe295('0xc6')));rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xc7'));_0x5415d5[_0xe295('0xaf')](_0x25ade8,'8',_0x23d214)[_0xe295('0x62')](function(_0x82d907){_0x43211f=_0x82d907[_0xe295('0xb0')]==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0xf,_0xe295('0x8c'));rpcDb[_0xe295('0x77')](_0xbd3b56,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x25ade8[_0xe295('0xc2')]>=_0x23d214[_0xe295('0xc8')]){rpcDb['createCustomerFinal'](_0x25ade8,_0xe295('0xc7'));}else{rpcDb[_0xe295('0x8e')](ut['scheduledAt'](_0x25ade8,_0xe295('0xc2'),_0x23d214[_0xe295('0xab')]),_0x25ade8[_0xe295('0xb4')],_0x25ade8[_0xe295('0x90')]);}}}else{_0x25ade8[_0xe295('0xc2')]++;_0x5415d5[_0xe295('0xc0')]({'id':_0x25ade8[_0xe295('0x93')],'field':{'countcongestionretry':_0x25ade8['countcongestionretry']}})[_0xe295('0x62')](function(){_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});});}});break;case _0xe295('0xc9'):_0x23d214[_0xe295('0xca')]+=0x1;_0x25ade8[_0xe295('0xcb')]+=0x1;_0x25ade8[_0xe295('0x83')]=ut[_0xe295('0x84')](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0x14,_0xe295('0xcc'));_0x184a6a=_0x23d214[_0xe295('0xcd')];_0x558173=_0x23d214[_0xe295('0x89')];ami['emit'](_0xe295('0xce'),ut[_0xe295('0x86')](_0x25ade8,_0xe295('0xcf')));rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xd0'));_0x5415d5[_0xe295('0xaf')](_0x25ade8,'20',_0x23d214)[_0xe295('0x62')](function(_0xa9bd74){_0x43211f=_0xa9bd74[_0xe295('0xb0')]==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0x14,_0xe295('0xcc'));rpcDb[_0xe295('0x77')](_0xbd3b56,_0xe295('0xd1'));}else{if(_0x25ade8[_0xe295('0xcb')]>=_0x23d214['dialAgentRejectMaxRetry']){rpcDb[_0xe295('0x77')](_0x25ade8,_0xe295('0xd1'));}else{rpcDb[_0xe295('0x8e')](ut[_0xe295('0x8f')](_0x25ade8,_0xe295('0xcb'),_0x23d214[_0xe295('0xcd')]),_0x25ade8['unlockAgent'],_0x25ade8['activeContact']);}}}else{_0x25ade8['countnoanswerretry']++;_0x5415d5[_0xe295('0xc0')]({'id':_0x25ade8[_0xe295('0x93')],'field':{'countnoanswerretry':_0x25ade8[_0xe295('0xb8')]}})[_0xe295('0x62')](function(){_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});});}});break;case _0xe295('0xd2'):_0x23d214['outboundAbandonedCallsDay']+=0x1;_0x25ade8[_0xe295('0xd3')]+=0x1;_0x25ade8['countglobal']=ut[_0xe295('0x84')](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0xb,_0xe295('0xd4'));rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xd5'));_0x5415d5['verifyAdditionalPhones'](_0x25ade8,'11',_0x23d214)[_0xe295('0x62')](function(_0xe641e1){_0x43211f=_0xe641e1[_0xe295('0xb0')]==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0xf,_0xe295('0x8c'));rpcDb[_0xe295('0x77')](_0xbd3b56,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x25ade8[_0xe295('0xd6')]>=_0x23d214[_0xe295('0xd7')]){rpcDb[_0xe295('0x77')](_0x25ade8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xe295('0x8e')](ut[_0xe295('0x8f')](_0x25ade8,'countabandonedretry',_0x23d214['dialAbandonedRetryFrequency']),_0x25ade8[_0xe295('0xb4')],_0x25ade8[_0xe295('0x90')]);}}}else{_0x25ade8[_0xe295('0xb8')]++;_0x5415d5[_0xe295('0xc0')]({'id':_0x25ade8['idContact'],'field':{'countnoanswerretry':_0x25ade8['countnoanswerretry']}})[_0xe295('0x62')](function(){_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});});}});break;case'18':_0x23d214[_0xe295('0xd8')]+=0x1;_0x25ade8[_0xe295('0xd9')]+=0x1;_0x25ade8[_0xe295('0x83')]=ut[_0xe295('0x84')](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0x12,_0x22f6cf[_0xe295('0xda')]||_0x22f6cf[_0xe295('0xdb')]);ami[_0xe295('0x27')](_0xe295('0xdc'),ut[_0xe295('0x86')](_0x25ade8,_0xe295('0xdd')));rpcDb[_0xe295('0x73')](_0x25ade8,'[callProgressDetectingCustomer][hangupInAMD]');_0x5415d5[_0xe295('0xaf')](_0x25ade8,'18',_0x23d214)[_0xe295('0x62')](function(_0x2dcfb8){_0x43211f=_0x2dcfb8['additional']==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0x12,'Global');rpcDb['createCustomerFinal'](_0xbd3b56,_0xe295('0xde'));}else{rpcDb[_0xe295('0x77')](_0x25ade8,_0xe295('0xde'));}}else{_0x25ade8[_0xe295('0xb8')]++;_0x5415d5['incrementPreviewCounters']({'id':_0x25ade8[_0xe295('0x93')],'field':{'countnoanswerretry':_0x25ade8[_0xe295('0xb8')]}})[_0xe295('0x62')](function(){_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});});}});delete this[_0xe295('0x16')][_0x22f6cf['linkedid']];break;case'19':_0x23d214['outboundUnknownCallsDay']+=0x1;_0x25ade8['countglobal']=ut['totalGlobal'](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0x13,_0x22f6cf[_0xe295('0xda')]||_0x22f6cf[_0xe295('0xdb')]);ami[_0xe295('0x27')](_0xe295('0xdc'),ut[_0xe295('0x86')](_0x25ade8,'amd'));rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xdf'));_0x5415d5['verifyAdditionalPhones'](_0x25ade8,'18',_0x23d214)[_0xe295('0x62')](function(_0x4ec936){_0x43211f=_0x4ec936['additional']==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214['dialGlobalMaxRetry']){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0xf,_0xe295('0x8c'));rpcDb[_0xe295('0x77')](_0xbd3b56,_0xe295('0xdf'));}else{rpcDb[_0xe295('0x77')](_0x25ade8,_0xe295('0xdf'));}}else{_0x25ade8['countnoanswerretry']++;_0x5415d5[_0xe295('0xc0')]({'id':_0x25ade8[_0xe295('0x93')],'field':{'countnoanswerretry':_0x25ade8['countnoanswerretry']}})[_0xe295('0x62')](function(){_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});});}});delete this[_0xe295('0x16')][_0x22f6cf[_0xe295('0x91')]];break;default:if(_0x25ade8[_0xe295('0x4e')]){ut['decrementTalking'](_0x23d214,_0xe295('0xe0'));ut[_0xe295('0x5c')](_0xe295('0xe1')+_0x23d214[_0xe295('0x2d')],_0x22f6cf);}_0x23d214['outboundUnknownCallsDay']+=0x1;_0x25ade8['countglobal']=ut[_0xe295('0x84')](_0x25ade8);ut[_0xe295('0x6f')](_0x25ade8,0xc,_0x22f6cf[_0xe295('0xda')]||_0x22f6cf[_0xe295('0xdb')]);_0x184a6a=_0x23d214[_0xe295('0xcd')];_0x558173=_0x23d214[_0xe295('0x89')];rpcDb[_0xe295('0x73')](_0x25ade8,_0xe295('0xe2'));_0x5415d5[_0xe295('0xaf')](_0x25ade8,'20',_0x23d214)[_0xe295('0x62')](function(_0x7e72f2){_0x43211f=_0x7e72f2[_0xe295('0xb0')]==0x1;if(!_0x43211f){if(ut[_0xe295('0x84')](_0x25ade8)>=_0x23d214[_0xe295('0x8a')]){_0xbd3b56=ut[_0xe295('0x8b')](_0x25ade8,0xf,_0xe295('0x8c'));rpcDb[_0xe295('0x77')](_0xbd3b56,_0xe295('0xe3'));}else{rpcDb['createCustomerFinal'](_0x25ade8,_0xe295('0xe3'));}delete this['actions'][_0x22f6cf[_0xe295('0x91')]];}else{_0x5415d5[_0xe295('0xb5')](_0x25ade8,_0x184a6a,_0x558173)[_0xe295('0x62')](function(){});}});}if(!(_0x25ade8[_0xe295('0x4e')]&&_0x44209d==='16')){utils[_0xe295('0x59')](_0x23d214,_0xe295('0xe4'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x25ade8[_0xe295('0x97')],_0xe295('0xa8'),_0x23d214[_0xe295('0x2d')],_0xe295('0xe5'),_0x23d214['originated']);}if(_0x44209d!==_0xe295('0x94')){delete this['actions'][_0x22f6cf[_0xe295('0x91')]];delete this[_0xe295('0x16')][_0x22f6cf[_0xe295('0xe6')]];}_0x23d214[_0xe295('0xe7')]=!![];}};Preview[_0xe295('0xf')][_0xe295('0xe8')]=function(_0x2d3183,_0x3831e3,_0x5e8a37){if(_[_0xe295('0xe9')](_0x3831e3)&&_0xe295('0xea')!==typeof _0x3831e3){return;}if(_[_0xe295('0xe9')](_0x5e8a37)&&_0xe295('0xea')!==typeof _0x5e8a37){return;}switch(_0x5e8a37[_0xe295('0xeb')]){case'0':ut[_0xe295('0xec')](_0x2d3183,0x0,_0xe295('0x85'));rpcDb[_0xe295('0xed')](_0x2d3183,_0xe295('0xee'));break;case'3':ut['logAgent'](_0x2d3183,0x3,_0xe295('0xb9'));rpcDb[_0xe295('0xed')](_0x2d3183,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xe295('0xec')](_0x2d3183,0x5,'Busy');rpcDb[_0xe295('0xed')](_0x2d3183,_0xe295('0xef'));break;case'8':ut[_0xe295('0xec')](_0x2d3183,0x8,'Congestion');rpcDb[_0xe295('0xed')](_0x2d3183,_0xe295('0xf0'));break;case'22':ut[_0xe295('0xec')](_0x2d3183,0x16,_0xe295('0xf1'));rpcDb['createAgentHistory'](_0x2d3183,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xe295('0xec')](_0x2d3183,0xc,_0x5e8a37[_0xe295('0xeb')]);rpcDb[_0xe295('0xed')](_0x2d3183,_0xe295('0xf0'));}utils['decrementOriginate'](_0x3831e3,_0xe295('0xf2'));logger['info'](_0xe295('0xf3'),_0x2d3183[_0xe295('0x97')],_0xe295('0xa8'),_0x3831e3[_0xe295('0x2d')],_0xe295('0xe5'),_0x3831e3[_0xe295('0x31')]);delete this[_0xe295('0x16')][_0x2d3183['uniqueid']];};Preview[_0xe295('0xf')][_0xe295('0xaf')]=function(_0x174700,_0x2ab016,_0xf9d4de){return cmHopperAdditionalPhone[_0xe295('0xaf')](_0x174700,_0x2ab016,_0xf9d4de)[_0xe295('0x57')](logger[_0xe295('0x28')]('[verifyAdditionalPhone]\x20'));};Preview['prototype']['swapAdditionalPhones']=function(_0x3bf887,_0x4c3294,_0x3620a4){return cmHopperAdditionalPhone[_0xe295('0xb5')](_0x3bf887,_0x4c3294,_0x3620a4)['catch'](logger[_0xe295('0x28')]('[swapAdditionalPhone]\x20'));};Preview['prototype']['incrementPreviewCounters']=function(_0x3b147e){return Promise['resolve']()[_0xe295('0x62')](cmHopperAdditionalPhone[_0xe295('0xc0')](_0x3b147e))[_0xe295('0x57')](logger[_0xe295('0x28')](_0xe295('0xf4')));};Preview[_0xe295('0xf')][_0xe295('0xf5')]=function(_0x13b8a2,_0x59af61,_0x2c8e1c,_0x51d454,_0x228165){var _0x185a08=this;return new Promise(function(_0x3aa126,_0x5f323c){if(_[_0xe295('0x48')](_0x59af61)||_[_0xe295('0x48')](_0x59af61['Contact'])||_['isNil'](_0x59af61[_0xe295('0xf6')])||_[_0xe295('0x48')](_0x59af61[_0xe295('0x52')])){_0x5f323c(ut[_0xe295('0x35')](_0xe295('0xf7'),_0x51d454,_0x228165));return;}var _0x269201=uuid['v4']();var _0x3c0ed7=_0x185a08['campaignsPreview'][_0x59af61[_0xe295('0x4a')][_0xe295('0x2d')]];var _0xfec6a4=_0x2c8e1c?_0x185a08[_0xe295('0x17')][_0x2c8e1c]['id']:undefined;_0x185a08['actions'][_0x269201]=new Action(_0x59af61,_0x3c0ed7,_0x269201,_0x2c8e1c,_0xfec6a4);var _0x500e92=_0x185a08[_0xe295('0x16')][_0x269201];_0x500e92[_0xe295('0xb4')]=_0x51d454;_0x500e92[_0xe295('0x90')]=_0x228165;_0x500e92[_0xe295('0xf8')]=_0x2c8e1c;if(_[_0xe295('0xf9')](_0x13b8a2)){_0x185a08[_0xe295('0xfa')](_0x500e92,_0x3c0ed7,_0x59af61,_0x2c8e1c)[_0xe295('0x62')](function(_0x1911b3){logger[_0xe295('0x28')](_0xe295('0xfb'),'Queue:\x20'+_0x500e92['queue']+_0xe295('0xfc')+_0x500e92[_0xe295('0x93')],JSON[_0xe295('0x2a')](_0x1911b3));ami[_0xe295('0x27')](_0xe295('0xfd'),ut[_0xe295('0x86')](_0x500e92,'called',_0x185a08[_0xe295('0x4d')][_0x500e92[_0xe295('0x4b')]]));_0x3aa126(ut[_0xe295('0x35')](_0xe295('0xfe')));})[_0xe295('0x57')](function(_0x36cf29){ut['logger'](_0xe295('0xff'),_0x36cf29);_0x5f323c(ut['message'](_0xe295('0x100'),_0x51d454,_0x228165));});}else{_0x3c0ed7['outboundBlacklistCallsDay']+=0x1;ut[_0xe295('0x101')](_0x500e92);rpcDb[_0xe295('0x102')](_0x500e92,'[Blacklist][error]');delete _0x185a08[_0xe295('0x16')][_0x269201];_0x5f323c(ut['message'](_0xe295('0x103'),_0x51d454,_0x228165));}});};Preview[_0xe295('0xf')][_0xe295('0x7e')]=function(_0x4bbaf8){return!_[_0xe295('0x48')](_0x4bbaf8)&&!_[_0xe295('0x48')](_0x4bbaf8['name'])&&!_[_0xe295('0x48')](_0x4bbaf8[_0xe295('0x104')])&&_0x4bbaf8[_0xe295('0x104')]&&!_[_0xe295('0x48')](this['trunks'][util['format'](_0xe295('0x105'),_0x4bbaf8['name'])])&&!_['isNil'](this[_0xe295('0x15')][util['format'](_0xe295('0x105'),_0x4bbaf8[_0xe295('0x2d')])][_0xe295('0x55')])&&(this['trunks'][util[_0xe295('0x2b')](_0xe295('0x105'),_0x4bbaf8[_0xe295('0x2d')])][_0xe295('0x55')]===_0xe295('0x106')||this['trunks'][util[_0xe295('0x2b')](_0xe295('0x105'),_0x4bbaf8[_0xe295('0x2d')])][_0xe295('0x55')]===_0xe295('0x107'));};Preview[_0xe295('0xf')][_0xe295('0x69')]=function(_0x397b4a,_0x172bd6){return this['execRun'](_0x397b4a,_0x172bd6)[_0xe295('0x62')](function(_0x3ae69e){return _['pick'](_0x3ae69e,[_0xe295('0x35')]);})[_0xe295('0x57')](function(_0x549ebd){if(_0x549ebd[_0xe295('0x108')]){rpcDb[_0xe295('0x109')](_0x397b4a);}if(_0x549ebd[_0xe295('0x104')]){rpcDb[_0xe295('0x6c')](_0x397b4a);}throw _[_0xe295('0x4f')](_0x549ebd,['message']);});};Preview[_0xe295('0xf')][_0xe295('0x10a')]=function(_0x36102e,_0xffb086){var _0x36dc1e=this;var _0x4a6463,_0x5d1053;return rpcDb['getContactPreview'](_0x36102e)[_0xe295('0x62')](function(_0x9092f6){if(!_[_0xe295('0x48')](_0x9092f6[0x0])){_0x5d1053=_0x9092f6[0x0][_0xe295('0x10b')]?![]:!![];_0x4a6463=_0x9092f6[0x0][_0xe295('0x10b')]?!![]:![];_0x4a6463=_0xffb086?!![]:_0x4a6463;}var _0x564cf9=_0x36dc1e['validateContact'](_0x9092f6);if(_0x564cf9[_0xe295('0x10c')]){rpcDb['checkIsBlackList'](_[_0xe295('0x4f')](_0x9092f6[0x0],['VoiceQueueId',_0xe295('0xf6')]))[_0xe295('0x62')](function(_0x391591){_0x36dc1e[_0xe295('0xf5')](_0x391591,_0x9092f6[0x0],_0xffb086,_0x5d1053,_0x4a6463)[_0xe295('0x62')](function(_0x377daa){return _0x377daa;})[_0xe295('0x57')](function(_0x3f0ecb){throw _0x3f0ecb;});})[_0xe295('0x57')](function(_0x4d6484){ut[_0xe295('0x38')](_0xe295('0x10d'),_0x4d6484);throw ut[_0xe295('0x35')](_0xe295('0x10e'),_0x5d1053,_0x4a6463);});}else{throw ut[_0xe295('0x35')](_0x564cf9[_0xe295('0x35')],_0x5d1053,_0x4a6463);}})['catch'](function(_0x4350fd){ut[_0xe295('0x38')]('[Preview][getContactPreview]',_0x4350fd);throw ut['message'](_0xe295('0x10e'),![],!![]);});};Preview[_0xe295('0xf')][_0xe295('0x10f')]=function(_0xc09b6a){if(_[_0xe295('0x48')](_0xc09b6a)||_[_0xe295('0xf9')](_0xc09b6a)||!_['isNil'](_0xc09b6a[0x0][_0xe295('0x67')])&&_['isNil'](_0xc09b6a[0x0][_0xe295('0x67')][_0xe295('0x2d')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0xc09b6a);return{'isValid':![],'message':_0xe295('0x110')};}var _0x3afea6=this['campaignsPreview'][_0xc09b6a[0x0][_0xe295('0x4a')][_0xe295('0x2d')]];_0x3afea6[_0xe295('0x35')]=utils[_0xe295('0x36')]['ACTIVE'];if(_[_0xe295('0x48')](_0x3afea6)){ut['logger'](_0xe295('0x111'),_0x3afea6);return{'isValid':![],'message':_0xe295('0x112')};}if(!this[_0xe295('0x7e')](_0x3afea6['Trunk'])){ut[_0xe295('0x38')](_0xe295('0x113'),'campaign\x20Name:\x20'+_0x3afea6[_0xe295('0x2d')]+_0xe295('0x114'));if(!this['isTrunkReachable'](_0x3afea6[_0xe295('0x115')])){ut[_0xe295('0x38')](_0xe295('0x113'),_0x3afea6[_0xe295('0x2d')]+_0xe295('0x116'));return{'isValid':![],'message':_0xe295('0x117')};}}if(!ut[_0xe295('0x7c')](_0x3afea6['dialActive'])){ut[_0xe295('0x38')](_0xe295('0x118'),_0x3afea6[_0xe295('0x2d')]+_0xe295('0x119'));return{'isValid':![],'message':_0xe295('0x11a')+_0x3afea6[_0xe295('0x2d')]+_0xe295('0x119')};}return{'isValid':!![],'message':_0xe295('0x11b')};};Preview[_0xe295('0xf')][_0xe295('0xfa')]=function(_0x1e1b15,_0x1a28ab,_0x514d22,_0x3b863b){var _0x738d2b=this;return new Promise(function(_0x3c24de,_0x32fd00){var _0x2a7451=_0x1e1b15[_0xe295('0x97')];var _0x58e8e1=_0x738d2b[_0xe295('0x7e')](_0x1a28ab['Trunk'])?util[_0xe295('0x2b')]('SIP/%s/%s%s',_0x1a28ab[_0xe295('0x7d')][_0xe295('0x2d')],_[_0xe295('0x48')](_0x1a28ab[_0xe295('0x11c')])?'':_0x1a28ab[_0xe295('0x11c')][_0xe295('0x11d')]()||'',_0x1a28ab['dialCutDigit']>0x0?_0x514d22[_0xe295('0xf6')][_0xe295('0x11e')](_0x1a28ab[_0xe295('0x11f')]):_0x514d22[_0xe295('0xf6')]):util[_0xe295('0x2b')](_0xe295('0x120'),_[_0xe295('0x48')](_0x1a28ab[_0xe295('0x115')])?_0x1a28ab[_0xe295('0x7d')][_0xe295('0x2d')]:_0x1a28ab[_0xe295('0x115')][_0xe295('0x2d')],_['isNil'](_0x1a28ab[_0xe295('0x11c')])?'':_0x1a28ab[_0xe295('0x11c')][_0xe295('0x11d')]()||'',_0x1a28ab[_0xe295('0x11f')]>0x0?_0x514d22['phone']['substring'](_0x1a28ab['dialCutDigit']):_0x514d22['phone']);var _0x512223=_0x738d2b[_0xe295('0x7e')](_0x1a28ab[_0xe295('0x7d')])?ut[_0xe295('0x121')](_0x1a28ab[_0xe295('0x7d')][_0xe295('0x122')],_0x1a28ab['dialOriginateCallerIdName'],_0x1a28ab[_0xe295('0x123')]>0x0?ut[_0xe295('0x124')](_0x1a28ab[_0xe295('0x125')],_0x1a28ab[_0xe295('0x123')]):_0x1a28ab[_0xe295('0x125')]):ut[_0xe295('0x121')](_[_0xe295('0x48')](_0x1a28ab[_0xe295('0x115')])?_0x1a28ab['Trunk'][_0xe295('0x122')]:_0x1a28ab[_0xe295('0x115')][_0xe295('0x122')],_0x1a28ab[_0xe295('0x126')],_0x1a28ab[_0xe295('0x123')]>0x0?ut['getCallerIdRandom'](_0x1a28ab[_0xe295('0x125')],_0x1a28ab[_0xe295('0x123')]):_0x1a28ab[_0xe295('0x125')]);if(_0x512223){_0x1e1b15[_0xe295('0x127')]=ut[_0xe295('0x128')](_0x512223);_0x1e1b15['originatecalleridnum']=ut[_0xe295('0x129')](_0x512223);}var _0x55e99a=ut[_0xe295('0x12a')](_0x1a28ab,_0x514d22,_0x58e8e1,_0x512223,_0x2a7451,_0x1e1b15);var _0x3f11fe=utils[_0xe295('0x12b')](_0x514d22[_0xe295('0x12c')]);Object['assign'](_0x55e99a,_0x3f11fe);_[_0xe295('0x12d')](_0x1e1b15,ut[_0xe295('0x12e')](_0x55e99a));_0x1e1b15[_0xe295('0x12f')]=moment()['format'](_0xe295('0x6d'));_0x1a28ab['variables']=_0x55e99a;var _0x1aed5f=ut[_0xe295('0x130')](_0x1e1b15,_0x1a28ab,_0x55e99a,_0x1e1b15[_0xe295('0x90')],_0x3b863b);return ami[_0xe295('0x54')](_0x1aed5f)[_0xe295('0x62')](function(_0x4fdc11){_0x1a28ab[_0xe295('0x31')]+=0x1;logger[_0xe295('0x28')](_0xe295('0x131'),_0x2a7451,_0xe295('0xa8'),_0x1a28ab[_0xe295('0x2d')],_0xe295('0xe5'),_0x1a28ab[_0xe295('0x31')]);_0x3c24de(_0x4fdc11);})[_0xe295('0x57')](function(_0x4f72f1){ut[_0xe295('0xec')](_0x1e1b15,0xe,'OriginateError');rpcDb[_0xe295('0xed')](_0x1e1b15,_0xe295('0x132'));_0x32fd00(_0x4f72f1);});});};Preview[_0xe295('0xf')]['syncNewExten']=function(_0xc6b32b){if(this['actions'][_0xc6b32b['linkedid']]){this[_0xe295('0x16')][_0xc6b32b[_0xe295('0x91')]][_0xe295('0x56')]=_0xc6b32b['channel'];}};Preview[_0xe295('0xf')][_0xe295('0x1a')]=function(_0x92b21b){var _0xf3a3e9=this;var _0x355e8c=this[_0xe295('0x16')][_0x92b21b[_0xe295('0x133')]];if(_0x355e8c){if(_0x355e8c[_0xe295('0xf8')]&&this[_0xe295('0x17')][_0x355e8c['lookAgent']]){ut[_0xe295('0x134')](_0x355e8c,this['agents'][_0x355e8c['lookAgent']]['name'],this[_0xe295('0x17')][_0x355e8c[_0xe295('0xf8')]]['id']);}var _0x11309f=_[_0xe295('0x135')](_0x355e8c);_0x11309f['responsetime']=moment()[_0xe295('0x2b')](_0xe295('0x6d'));var _0x481e62=_0xf3a3e9[_0xe295('0x4d')][_0x355e8c['queue']];if(ut[_0xe295('0x136')](_0x92b21b['response'])){if(_0x355e8c[_0xe295('0xb4')]){rpcDb['unlockContact'](_0x355e8c[_0xe295('0x93')]);}if(_0x355e8c[_0xe295('0x90')]){rpcDb[_0xe295('0x6c')](_0x355e8c[_0xe295('0x93')]);}ami['emit'](_0xe295('0x137'),ut[_0xe295('0x86')](_0x355e8c,'rejected',this[_0xe295('0x4d')][_0x355e8c[_0xe295('0x4b')]]));this[_0xe295('0xe8')](_0x11309f,_0x481e62,_0x92b21b);}else{_0x355e8c[_0xe295('0x12f')]=moment()[_0xe295('0x2b')](_0xe295('0x6d'));ut[_0xe295('0xec')](_0x11309f,0x4,_0xe295('0xa2'));rpcDb[_0xe295('0xed')](_0x11309f,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xe295('0xf')][_0xe295('0x1d')]=function(_0xbb0011){var _0x48ff1d=this['actions'][_0xbb0011['linkedid']];var _0x12b3b5;if(_0x48ff1d){_0x12b3b5=this[_0xe295('0x4d')][_0x48ff1d[_0xe295('0x4b')]];logger['info'](_0xe295('0x138'),_0xbb0011[_0xe295('0x91')],_0xe295('0xa8'),_0x12b3b5[_0xe295('0x2d')],'pTalking:\x20',_0x12b3b5[_0xe295('0x32')]);}if(this[_0xe295('0x16')][_0xbb0011[_0xe295('0x91')]]&&_0xbb0011[_0xe295('0x91')]!==_0xbb0011[_0xe295('0x97')]){if(_0xbb0011[_0xe295('0x139')]==='16'&&this[_0xe295('0x16')][_0xbb0011[_0xe295('0x91')]][_0xe295('0x4e')]){this[_0xe295('0x13a')](_0xbb0011,_0xbb0011[_0xe295('0x91')],_0xbb0011[_0xe295('0x139')]);}else if(this[_0xe295('0x16')][_0xbb0011['linkedid']][_0xe295('0x4e')]){logger[_0xe295('0x28')]('[syncHangup][talking][cause]',_0xbb0011[_0xe295('0x91')],_0xbb0011[_0xe295('0x139')],_0xe295('0xa8'),_0x12b3b5[_0xe295('0x2d')],_0xe295('0x4c'),_0x12b3b5[_0xe295('0x32')]);this['callProgressDetectingCustomer'](_0xbb0011,_0xbb0011[_0xe295('0x91')],_0xbb0011[_0xe295('0x139')]);}}else if(_0x48ff1d&&_[_0xe295('0x48')](_0x48ff1d[_0xe295('0x13b')])&&_0x12b3b5[_0xe295('0x13c')]&&_0xbb0011[_0xe295('0x91')]===_0xbb0011[_0xe295('0x97')]&&_[_0xe295('0x48')](_0xbb0011[_0xe295('0xeb')])&&_0xbb0011['cause']==='16'&&_0xbb0011[_0xe295('0x13d')]==='6'&&_[_0xe295('0xe9')](_0x48ff1d[_0xe295('0x13e')])){if(_0x48ff1d['unlockAgent']){rpcDb['unlockContact'](_0x48ff1d[_0xe295('0x93')]);}if(_0x48ff1d[_0xe295('0x90')]){rpcDb['disableContact'](_0x48ff1d[_0xe295('0x93')]);}_0xbb0011[_0xe295('0xeb')]='22';this[_0xe295('0xe8')](_0x48ff1d,_0x12b3b5,_0xbb0011);}else if(_0x48ff1d&&_0x48ff1d['transfer']){if(_0xbb0011[_0xe295('0x139')]==='16'&&this[_0xe295('0x16')][_0xbb0011[_0xe295('0x91')]][_0xe295('0x4e')]){logger[_0xe295('0x28')](_0xe295('0x13f'),_0xbb0011[_0xe295('0x91')],_0xbb0011[_0xe295('0x139')],_0xe295('0xa8'),_0x12b3b5[_0xe295('0x2d')],'pTalking:\x20',_0x12b3b5[_0xe295('0x32')]);this[_0xe295('0x13a')](_0xbb0011,_0xbb0011[_0xe295('0x91')],_0xbb0011[_0xe295('0x139')]);}else if(this['actions'][_0xbb0011[_0xe295('0x91')]][_0xe295('0x4e')]){logger[_0xe295('0x28')](_0xe295('0x140'),_0xbb0011[_0xe295('0x91')],_0xbb0011[_0xe295('0x139')],_0xe295('0xa8'),_0x12b3b5[_0xe295('0x2d')],_0xe295('0x4c'),_0x12b3b5['pTalking']);this['callProgressDetectingCustomer'](_0xbb0011,_0xbb0011[_0xe295('0x91')],_0xbb0011[_0xe295('0x139')]);}}};Preview[_0xe295('0xf')][_0xe295('0x21')]=function(_0x27cc0e){if(this[_0xe295('0x16')][_0x27cc0e['destlinkedid']]&&_0x27cc0e[_0xe295('0xe6')]!==_0x27cc0e[_0xe295('0x141')]){this[_0xe295('0x13a')](_0x27cc0e,_0x27cc0e[_0xe295('0xe6')],_0x27cc0e['dialstatus']);}};Preview['prototype'][_0xe295('0x1f')]=function(_0x59258d){if(this['actions'][_0x59258d[_0xe295('0x91')]]&&_0x59258d[_0xe295('0x91')]!==_0x59258d[_0xe295('0x97')]&&!this[_0xe295('0x16')][_0x59258d['linkedid']]['dialAnswer']){if(_0x59258d['cause']==='1'){this['callProgressDetectingCustomer'](_0x59258d,_0x59258d['linkedid'],_0x59258d[_0xe295('0x139')]);}}};Preview[_0xe295('0xf')][_0xe295('0x142')]=function(_0x84f903,_0x495bdc,_0x11eb67){if(this[_0xe295('0x16')][_0x84f903]){if(_['isNil'](this[_0xe295('0x16')][_0x84f903][_0xe295('0x143')])){this['actions'][_0x84f903][_0xe295('0x143')]={};}this[_0xe295('0x16')][_0x84f903][_0xe295('0x143')][_0x495bdc]=_0x11eb67;}};Preview['prototype'][_0xe295('0x24')]=function(_0x2924e2){try{if(!_['isNil'](_0x2924e2)){if(ut[_0xe295('0x144')](_[_0xe295('0x145')](_0x2924e2[_0xe295('0x146')])[0x0])){this[_0xe295('0x142')](_0x2924e2[_0xe295('0x97')],_[_0xe295('0x145')](_0x2924e2['variable'])[0x0],_0x2924e2[_0xe295('0x147')]);}}}catch(_0x25ada8){logger['error'](_0xe295('0x148'),util[_0xe295('0x149')](_0x25ada8,{'showHidden':![],'depth':null}));}};Preview[_0xe295('0xf')][_0xe295('0x14a')]=function(_0x5538e1){if(_0x5538e1){if(this['actions'][_0x5538e1[_0xe295('0x14b')]]){this[_0xe295('0x16')][_0x5538e1[_0xe295('0x14b')]][_0xe295('0x13e')]=!![];}}};Preview[_0xe295('0xf')][_0xe295('0x14c')]=function(_0x35bad1){if(_0x35bad1){if(this[_0xe295('0x16')][_0x35bad1[_0xe295('0x14d')]]){this[_0xe295('0x16')][_0x35bad1['transfererlinkedid']]['transfer']=!![];}}};module[_0xe295('0x14e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 56020f6..faa72a7 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 _0x2095=['createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','catch','[createHistory]\x20','resolve'];(function(_0x4571ce,_0xd51afc){var _0x4a9c6e=function(_0x1b8cc6){while(--_0x1b8cc6){_0x4571ce['push'](_0x4571ce['shift']());}};_0x4a9c6e(++_0xd51afc);}(_0x2095,0x1b6));var _0x5209=function(_0x3931d4,_0x18c56d){_0x3931d4=_0x3931d4-0x0;var _0x3cb411=_0x2095[_0x3931d4];return _0x3cb411;};'use strict';var util=require(_0x5209('0x0'));var BPromise=require(_0x5209('0x1'));var logger=require(_0x5209('0x2'))(_0x5209('0x3'));var cmHopper=require(_0x5209('0x4'));var cmHopperHistory=require(_0x5209('0x5'));var cmHopperBlack=require(_0x5209('0x6'));var agentReportPreview=require(_0x5209('0x7'));var voiceQueueReport=require(_0x5209('0x8'));function loggerCatch(_0x157979){return function(_0x5eb5f4){logger['error'](_0x157979,util['inspect'](_0x5eb5f4,{'showHidden':![],'depth':null}));};}function create(_0xf32cf0){return cmHopperHistory['createHistory'](_0xf32cf0)[_0x5209('0x9')](loggerCatch(_0x5209('0xa')));}function createAgent(_0x5b10ca){return BPromise[_0x5209('0xb')]()['then'](agentReportPreview[_0x5209('0xc')](_0x5b10ca))[_0x5209('0x9')](loggerCatch(_0x5209('0xa')));}function moveContact(_0x3e8d7f){return cmHopper['moveContactManagedDialer'](_0x3e8d7f,!![])['catch'](loggerCatch(_0x5209('0xd')));}exports[_0x5209('0xe')]=function(_0xafaccd){return cmHopperBlack['checkIsBlackList'](_0xafaccd)[_0x5209('0x9')](loggerCatch(_0x5209('0xf')));};exports['getContactPreview']=function(_0x4a9c3c){return BPromise[_0x5209('0xb')]()[_0x5209('0x10')](cmHopper['getContactPreview'](_0x4a9c3c))['catch'](loggerCatch(_0x5209('0x11')));};exports['createHistory']=function(_0x31c3ef,_0x21fb33){create(_0x31c3ef)['catch'](loggerCatch(_0x21fb33));moveContact(_0x31c3ef)['catch'](loggerCatch(_0x21fb33));};exports[_0x5209('0x12')]=function(_0x3acc9a,_0x2d3b5f){createAgent(_0x3acc9a)[_0x5209('0x9')](loggerCatch(_0x2d3b5f));};exports[_0x5209('0x13')]=function(_0xf4f10a,_0x31da9b){create(_0xf4f10a)[_0x5209('0x9')](loggerCatch(_0x31da9b));};exports['createCustomerFinal']=function(_0x11ca6c,_0x30562f){moveContact(_0x11ca6c)[_0x5209('0x9')](loggerCatch(_0x30562f));};exports['rescheduleContact']=function(_0x1edc52,_0x55555a,_0x358c9a){if(_0x55555a){_0x1edc52['UserId']=null;}if(_0x358c9a){_0x1edc52[_0x5209('0x14')]=![];}return cmHopper[_0x5209('0x15')](_0x1edc52)[_0x5209('0x9')](loggerCatch(_0x5209('0x16')));};exports['countReScheduled']=function(_0x592fac){return cmHopper[_0x5209('0x17')](_0x592fac)['catch'](loggerCatch(_0x5209('0x18')));};exports[_0x5209('0x19')]=function(_0x3c3982){return cmHopper['unlockContact']({'UserId':null},_0x3c3982,0x1)[_0x5209('0x9')](loggerCatch(_0x5209('0x1a')));};exports[_0x5209('0x1b')]=function(_0x2aff90){return cmHopper['unlockContact']({'active':![]},_0x2aff90,0x1)[_0x5209('0x9')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x63c49){var _0x189979={};_0x189979[_0x5209('0x1c')]=_0x63c49[_0x5209('0x1c')];_0x189979[_0x5209('0x1d')]=_0x63c49['uniqueid'];_0x189979[_0x5209('0x1e')]=_0x63c49[_0x5209('0x1e')];_0x189979[_0x5209('0x1f')]=_0x63c49[_0x5209('0x1f')];_0x189979[_0x5209('0x20')]=_0x63c49[_0x5209('0x20')];_0x189979[_0x5209('0x21')]=_0x63c49['answertime'];_0x189979[_0x5209('0x22')]=_0x63c49['answertime'];_0x189979['queuecallercomplete']=0x1;_0x189979[_0x5209('0x23')]=_0x63c49[_0x5209('0x24')];_0x189979[_0x5209('0x25')]=_0x63c49[_0x5209('0x26')];_0x189979[_0x5209('0x27')]='from-sip';_0x189979[_0x5209('0x28')]=_0x5209('0x29');_0x189979['holdtime']=0x0;_0x189979[_0x5209('0x2a')]=0x1;_0x189979[_0x5209('0x2b')]=_0x63c49[_0x5209('0x26')];_0x189979[_0x5209('0x2c')]=_0x5209('0x2d');return BPromise[_0x5209('0xb')]()[_0x5209('0x10')](voiceQueueReport[_0x5209('0x2e')](_0x189979))[_0x5209('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x5209('0x2f')]=function(_0xc557d4,_0x5761eb){return BPromise['resolve']()['then'](cmHopper[_0x5209('0x2f')](_0xc557d4,_0x5761eb))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x5209('0x30')]=function(_0x209f95){return cmHopper[_0x5209('0x15')](_0x209f95,!![],!![])[_0x5209('0x9')](loggerCatch(_0x5209('0x31')));}; \ No newline at end of file +var _0x39c6=['rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20'];(function(_0x4cdc7e,_0x24026a){var _0x33c8d8=function(_0x3b4b85){while(--_0x3b4b85){_0x4cdc7e['push'](_0x4cdc7e['shift']());}};_0x33c8d8(++_0x24026a);}(_0x39c6,0x15a));var _0x639c=function(_0x5a0f77,_0x3fa99f){_0x5a0f77=_0x5a0f77-0x0;var _0x1bdf5d=_0x39c6[_0x5a0f77];return _0x1bdf5d;};'use strict';var util=require(_0x639c('0x0'));var BPromise=require(_0x639c('0x1'));var logger=require('../../../config/logger')(_0x639c('0x2'));var cmHopper=require(_0x639c('0x3'));var cmHopperHistory=require(_0x639c('0x4'));var cmHopperBlack=require(_0x639c('0x5'));var agentReportPreview=require(_0x639c('0x6'));var voiceQueueReport=require(_0x639c('0x7'));function loggerCatch(_0x34f4b0){return function(_0x2c5ca0){logger['error'](_0x34f4b0,util['inspect'](_0x2c5ca0,{'showHidden':![],'depth':null}));};}function create(_0x2d4c32){return cmHopperHistory[_0x639c('0x8')](_0x2d4c32)[_0x639c('0x9')](loggerCatch(_0x639c('0xa')));}function createAgent(_0x570bb5){return BPromise[_0x639c('0xb')]()[_0x639c('0xc')](agentReportPreview['createHistory'](_0x570bb5))[_0x639c('0x9')](loggerCatch(_0x639c('0xa')));}function moveContact(_0x4c5433){return cmHopper[_0x639c('0xd')](_0x4c5433,!![])[_0x639c('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x639c('0xe')]=function(_0xd27f80){return cmHopperBlack[_0x639c('0xe')](_0xd27f80)[_0x639c('0x9')](loggerCatch(_0x639c('0xf')));};exports[_0x639c('0x10')]=function(_0x26fd69){return BPromise[_0x639c('0xb')]()[_0x639c('0xc')](cmHopper[_0x639c('0x10')](_0x26fd69))[_0x639c('0x9')](loggerCatch(_0x639c('0x11')));};exports[_0x639c('0x8')]=function(_0x3dc52d,_0x1b4aa8){create(_0x3dc52d)['catch'](loggerCatch(_0x1b4aa8));moveContact(_0x3dc52d)['catch'](loggerCatch(_0x1b4aa8));};exports['createAgentHistory']=function(_0x4b1e8e,_0x38685f){createAgent(_0x4b1e8e)[_0x639c('0x9')](loggerCatch(_0x38685f));};exports['createCustomerHistory']=function(_0x41d6e9,_0x549b33){create(_0x41d6e9)[_0x639c('0x9')](loggerCatch(_0x549b33));};exports['createCustomerFinal']=function(_0x2636f0,_0x2b62c6){moveContact(_0x2636f0)[_0x639c('0x9')](loggerCatch(_0x2b62c6));};exports[_0x639c('0x12')]=function(_0xfba658,_0xe331c3,_0x426ae3){if(_0xe331c3){_0xfba658[_0x639c('0x13')]=null;}if(_0x426ae3){_0xfba658[_0x639c('0x14')]=![];}return cmHopper[_0x639c('0x12')](_0xfba658)[_0x639c('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x639c('0x15')]=function(_0x59dda1){return cmHopper['countReScheduled'](_0x59dda1)[_0x639c('0x9')](loggerCatch(_0x639c('0x16')));};exports['unlockContact']=function(_0x45bccc){return cmHopper['unlockContact']({'UserId':null},_0x45bccc,0x1)[_0x639c('0x9')](loggerCatch(_0x639c('0x17')));};exports[_0x639c('0x18')]=function(_0x327865){return cmHopper['unlockContact']({'active':![]},_0x327865,0x1)[_0x639c('0x9')](loggerCatch('[activeContact]\x20'));};exports[_0x639c('0x19')]=function(_0x52210d){var _0x480ad6={};_0x480ad6[_0x639c('0x1a')]=_0x52210d[_0x639c('0x1a')];_0x480ad6[_0x639c('0x1b')]=_0x52210d[_0x639c('0x1b')];_0x480ad6[_0x639c('0x1c')]=_0x52210d[_0x639c('0x1c')];_0x480ad6['calleridname']=_0x52210d[_0x639c('0x1d')];_0x480ad6[_0x639c('0x1e')]=_0x52210d['queue'];_0x480ad6[_0x639c('0x1f')]=_0x52210d[_0x639c('0x20')];_0x480ad6[_0x639c('0x21')]=_0x52210d['answertime'];_0x480ad6[_0x639c('0x22')]=0x1;_0x480ad6[_0x639c('0x23')]=_0x52210d[_0x639c('0x24')];_0x480ad6[_0x639c('0x25')]=_0x52210d[_0x639c('0x26')];_0x480ad6[_0x639c('0x27')]=_0x639c('0x28');_0x480ad6['exten']=_0x639c('0x29');_0x480ad6[_0x639c('0x2a')]=0x0;_0x480ad6[_0x639c('0x2b')]=0x1;_0x480ad6['lastAssignedTo']=_0x52210d['membername'];_0x480ad6[_0x639c('0x2c')]=_0x639c('0x2d');return BPromise[_0x639c('0xb')]()['then'](voiceQueueReport[_0x639c('0x2e')](_0x480ad6))[_0x639c('0x9')](loggerCatch(_0x639c('0x2f')));};exports[_0x639c('0x30')]=function(_0x41d82a,_0x5da66c){return BPromise[_0x639c('0xb')]()['then'](cmHopper[_0x639c('0x30')](_0x41d82a,_0x5da66c))[_0x639c('0x9')](loggerCatch(_0x639c('0x31')));};exports[_0x639c('0x32')]=function(_0x391fcf){return cmHopper[_0x639c('0x12')](_0x391fcf,!![],!![])[_0x639c('0x9')](loggerCatch(_0x639c('0x33')));}; \ 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 cfe4ab9..9f15044 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 _0x9311=['motionChannel','voice','mandatoryDisposition','buildObj','not_inuse','status','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','type','campaigntype','calleridname','countcongestionretry','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','info','error','logger2','inspect','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','addVariables','Queue','name','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','logBlacklist','state','Blacklist','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','statedesc','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface'];(function(_0x11c85a,_0x279df0){var _0x51dad4=function(_0x3cff2d){while(--_0x3cff2d){_0x11c85a['push'](_0x11c85a['shift']());}};_0x51dad4(++_0x279df0);}(_0x9311,0x1b7));var _0x1931=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9311[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1931('0x0'));var _=require(_0x1931('0x1'));var moment=require(_0x1931('0x2'));var logger=require('../../../../config/logger')(_0x1931('0x3'));var ipAgi=process['env'][_0x1931('0x4')]||_0x1931('0x5');var utils=require(_0x1931('0x6'));exports[_0x1931('0x7')]=function(_0x47f618){return function(_0x16e047){logger['error'](_0x47f618,util['inspect'](_0x16e047,{'showHidden':![],'depth':null}));};};exports[_0x1931('0x8')]=function(_0x505c95,_0x64ca2d){logger[_0x1931('0x9')](_0x505c95,util['inspect'](_0x64ca2d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x200512,_0x4875b6){logger[_0x1931('0xa')](_0x200512,util['inspect'](_0x4875b6,{'showHidden':![],'depth':null}));};exports[_0x1931('0xb')]=function(_0x2edb3d){return function(_0x21a14f){logger[_0x1931('0x9')](_0x2edb3d,util[_0x1931('0xc')](_0x21a14f,{'showHidden':![],'depth':null}));};};exports[_0x1931('0xd')]=function(_0x3d7687,_0x12e945,_0x497bf4){return{'message':_0x3d7687,'unlock':_0x12e945,'active':_0x497bf4};};exports[_0x1931('0xe')]=function(_0x3ceabb,_0x10530e,_0x59b62e){if(!_[_0x1931('0xf')](_0x59b62e)&&_0x1931('0x10')===typeof _0x59b62e&&!_[_0x1931('0x11')](_0x59b62e)){if(!_['isUndefined'](_0x10530e)&&_0x1931('0x10')===typeof _0x10530e&&!_[_0x1931('0x11')](_0x10530e)){return util['format'](_0x1931('0x12'),_0x10530e,_0x59b62e);}return util[_0x1931('0x13')]('\x22%s\x22\x20<%s>',_0x59b62e,_0x59b62e);}if(!_[_0x1931('0xf')](_0x3ceabb)&&_0x1931('0x10')===typeof _0x3ceabb&&!_['isEmpty'](_0x3ceabb)){return _0x3ceabb;}return'\x22\x22\x20<>';};exports[_0x1931('0x14')]=function(_0x39d341){if(_['isNil'](_0x39d341)){return![];}return _0x39d341;};exports[_0x1931('0x15')]=function(_0x3c9e8c,_0x554b5e,_0x2ce25d,_0x1e3ff0,_0x536f71,_0x2605d1){var _0x380869={'XMD-QUEUE':_0x554b5e[_0x1931('0x16')]?_0x554b5e[_0x1931('0x16')][_0x1931('0x17')]:'','XMD-CALLERID':_0x1e3ff0,'XMD-CALLERID-PREVIEW':_0x2605d1?util[_0x1931('0x13')](_0x1931('0x12'),_0x2605d1['calleridname'],_0x2605d1['calleridnum']):_0x1e3ff0,'XMD-DIALID':_0x536f71,'XMD-CONTACTID':_0x554b5e['ContactId'],'XMD-CDRTYPE':_0x1931('0x18'),'CALLERID(all)':_0x1e3ff0,'XMD-VOICEQUEUEID':_0x554b5e[_0x1931('0x19')],'XMD-DIALCHANNEL':_0x2ce25d,'XMD-DIALTIMEOUT':_0x3c9e8c[_0x1931('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x1931('0x13')](_0x1931('0x1b'),_0x3c9e8c[_0x1931('0x1c')]?'g':'',_[_0x1931('0x11')](_0x3c9e8c[_0x1931('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3c9e8c[_0x1931('0x1e')]||'','XMD-AGI':_0x3c9e8c[_0x1931('0x1f')]?util[_0x1931('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c9e8c[_0x1931('0x1f')]):_0x1931('0x20'),'XMD-AGIAFTER':_0x3c9e8c['dialQueueProject2']?util[_0x1931('0x13')](_0x1931('0x21'),ipAgi,_0x3c9e8c[_0x1931('0x1c')]):_0x1931('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x2605d1?_0x2605d1[_0x1931('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2605d1?_0x2605d1['originatecalleridname']:'','XMD-DESTINATION':_0x1931('0x23'),'SIPADDHEADER':_0x1931('0x24')};if(!_[_0x1931('0x11')](_0x3c9e8c[_0x1931('0x1d')])){_0x380869[util[_0x1931('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3c9e8c['monitor_format'];_0x380869[util[_0x1931('0x13')]('%s',_0x1931('0x25'))]=_0x536f71;}return _0x380869;};exports[_0x1931('0x26')]=function(_0x38b642){var _0x273c45={};for(var _0x5dd116 in _0x38b642){if(_0x38b642[_0x1931('0x27')](_0x5dd116)){_0x273c45[util[_0x1931('0x13')]('%s',_['toLower'](_0x5dd116))]=_0x38b642[_0x5dd116];}}return{'variables':_0x273c45};};exports[_0x1931('0x28')]=function(_0x585502){var _0x123e82=moment()[_0x1931('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x585502[_0x1931('0x29')]=0xd;_0x585502['statedesc']=_0x1931('0x2a');_0x585502[_0x1931('0x2b')]=_0x123e82;_0x585502[_0x1931('0x2c')]=_0x123e82;_0x585502['endtime']=_0x123e82;};exports['logAgent']=function(_0x400d3d,_0x291b39,_0x1d33ac){var _0x953af8=moment()['format'](_0x1931('0x2d'));_0x400d3d[_0x1931('0x29')]=_0x291b39;_0x400d3d[_0x1931('0x2e')]=_0x1d33ac;_0x400d3d[_0x1931('0x2c')]=_0x953af8;_0x400d3d[_0x1931('0x2f')]=utils[_0x1931('0x30')](_0x400d3d[_0x1931('0x2c')],_0x400d3d[_0x1931('0x2b')]);};exports[_0x1931('0x31')]=function(_0x1e1e9c,_0xe282e4,_0xcc9849){_0x1e1e9c[_0x1931('0x32')]=_0xe282e4;_0x1e1e9c[_0x1931('0x33')]=_0xcc9849;};exports[_0x1931('0x34')]=function(_0x2c958e,_0x55855c,_0x5a354f){var _0x4fc927=moment()[_0x1931('0x13')](_0x1931('0x2d'));_0x2c958e[_0x1931('0x29')]=_0x55855c;_0x2c958e[_0x1931('0x2e')]=_0x5a354f;_0x2c958e[_0x1931('0x2c')]=_0x2c958e[_0x1931('0x2c')]?_0x2c958e[_0x1931('0x2c')]:_0x4fc927;_0x2c958e[_0x1931('0x35')]=_0x2c958e[_0x1931('0x35')]?_0x2c958e[_0x1931('0x35')]:_0x4fc927;_0x2c958e[_0x1931('0x2f')]=utils['getSeconds'](_0x2c958e[_0x1931('0x2c')]||0x0,_0x2c958e[_0x1931('0x2b')]||0x0);_0x2c958e[_0x1931('0x36')]=_0x2c958e[_0x1931('0x37')]?utils[_0x1931('0x30')](_0x2c958e[_0x1931('0x35')],_0x2c958e[_0x1931('0x37')]):0x0;};exports['isFailure']=function(_0x23f0bd){return _0x23f0bd==='Failure';};exports[_0x1931('0x38')]=function(_0x10cd2c,_0x2fd516,_0x528c83,_0x4a8bb5,_0x3c893f){var _0xaf7efb=_0x4a8bb5?_0x1931('0x39'):_0x10cd2c['calleridname'];_0xaf7efb=_0x3c893f?_0x1931('0x3a'):_0xaf7efb;return{'actionid':_0x10cd2c[_0x1931('0x3b')],'action':_0x1931('0x3c'),'channel':_0x10cd2c[_0x1931('0x3d')],'callerid':util['format'](_0x1931('0x12'),_0xaf7efb,_0x10cd2c[_0x1931('0x3e')]),'Exten':_0x1931('0x23'),'Context':'from-sip','Priority':'1','variable':_0x528c83,'timeout':(_0x2fd516[_0x1931('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x10cd2c[_0x1931('0x3b')]};};exports['totalGlobal']=function(_0xf8275c){return _0xf8275c[_0x1931('0x40')]+_0xf8275c['countcongestionretry']+_0xf8275c[_0x1931('0x41')]+_0xf8275c[_0x1931('0x42')]+_0xf8275c[_0x1931('0x43')];};exports[_0x1931('0x44')]=function(_0x92ee98){var _0x6cf8d0=_['clone'](_0x92ee98);_0x6cf8d0[_0x1931('0x29')]=0xf;_0x6cf8d0[_0x1931('0x2e')]=_0x1931('0x45');return _0x6cf8d0;};exports['scheduledAt']=function(_0x33a79d,_0x436748,_0x3241d1){var _0x2f4b6b={};_0x2f4b6b[_0x436748]=_0x33a79d[_0x436748];_0x2f4b6b[_0x1931('0x46')]=![];_0x2f4b6b[_0x1931('0x47')]=moment()[_0x1931('0x48')](_0x3241d1,'minutes')[_0x1931('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f4b6b[_0x1931('0x49')]=_0x33a79d[_0x1931('0x49')];_0x2f4b6b[_0x1931('0x4a')]=_0x33a79d['ListId'];_0x2f4b6b['VoiceQueueId']=_0x33a79d[_0x1931('0x19')]||undefined;return _0x2f4b6b;};exports[_0x1931('0x4b')]=function(_0x37f82d,_0x480c87){if(!_['isNil'](_0x37f82d)){if(_0x37f82d[_0x1931('0x4c')]>0x0){_0x37f82d['pTalking']-=0x1;}else{logger[_0x1931('0x9')](_0x480c87,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x1931('0xa')](_0x480c87,_0x1931('0x4d'));}};exports[_0x1931('0x4e')]=function(_0xa91a85){if(_0xa91a85<=0x0){return!![];}return![];};function buildObj(_0xec657,_0xbdb4f4,_0x33839f){_0xec657['lastevent']=_0xbdb4f4;_0xec657[_0x1931('0x17')]=_0xec657[_0x1931('0x4f')];_0xec657[_0x1931('0x50')]=_0xec657[_0x1931('0x3d')];_0xec657[_0x1931('0x51')]=_0x1931('0x52');if(_0x33839f){_0xec657[_0x1931('0x53')]=_0x33839f[_0x1931('0x53')];}return _0xec657;}exports[_0x1931('0x54')]=buildObj;exports['agentReadyId']=function(_0x5aaab3){var _0x299792=[];for(var _0x143e48 in _0x5aaab3){if(_0x5aaab3[_0x1931('0x27')](_0x143e48)){if(!_['isNil'](_0x5aaab3[_0x143e48])&&_0x5aaab3[_0x143e48][_0x1931('0x29')]===_0x1931('0x55')&&_0x5aaab3[_0x143e48][_0x1931('0x56')]==='reachable'){_0x299792[_0x1931('0x57')](_0x5aaab3[_0x143e48]['id']);}}}return _0x299792;};exports[_0x1931('0x58')]=function(_0x200bf5){var _0x421d1c=moment()['milliseconds'](0x0);var _0x577e7f=moment(_0x200bf5)[_0x1931('0x59')](0x0);return _0x421d1c[_0x1931('0x5a')](_0x577e7f,_0x1931('0x5b'));};exports['createBody']=function(_0x1d3075){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1d3075['ContactId'],'ListId':_0x1d3075['ListId'],'VoiceQueueId':_0x1d3075[_0x1931('0x19')]||undefined,'CampaignId':_0x1d3075[_0x1931('0x5c')]||undefined};};exports[_0x1931('0x5d')]=function(_0x4e9baf){if(_0x4e9baf===_0x1931('0x3b')||_0x4e9baf===_0x1931('0x5e')||_0x4e9baf==='queue'||_0x4e9baf===_0x1931('0x5f')||_0x4e9baf===_0x1931('0x60')||_0x4e9baf==='dialAnswer'||_0x4e9baf==='membername'||_0x4e9baf===_0x1931('0x3d')||_0x4e9baf===_0x1931('0x61')||_0x4e9baf==='active'||_0x4e9baf===_0x1931('0x3e')||_0x4e9baf==='scheduledat'||_0x4e9baf===_0x1931('0x40')||_0x4e9baf===_0x1931('0x62')||_0x4e9baf==='countnoanswerretry'||_0x4e9baf==='countglobal'||_0x4e9baf===_0x1931('0x63')||_0x4e9baf===_0x1931('0x64')||_0x4e9baf===_0x1931('0x65')||_0x4e9baf==='recallme'||_0x4e9baf===_0x1931('0x49')||_0x4e9baf===_0x1931('0x4a')||_0x4e9baf===_0x1931('0x33')||_0x4e9baf===_0x1931('0x19')||_0x4e9baf===_0x1931('0x66')||_0x4e9baf===_0x1931('0x67')||_0x4e9baf===_0x1931('0x68')||_0x4e9baf===_0x1931('0x69')||_0x4e9baf===_0x1931('0x6a')||_0x4e9baf===_0x1931('0x6b')||_0x4e9baf==='xmd-dialtimeout'||_0x4e9baf===_0x1931('0x6c')||_0x4e9baf==='xmd-dialid'||_0x4e9baf===_0x1931('0x6d')||_0x4e9baf==='xmd-contactid'||_0x4e9baf===_0x1931('0x6e')||_0x4e9baf==='xmd-callerid'||_0x4e9baf===_0x1931('0x6f')||_0x4e9baf==='xmd-agi'||_0x4e9baf===_0x1931('0x70')||_0x4e9baf===_0x1931('0x71')||_0x4e9baf==='rtpaudioqosjitter'||_0x4e9baf==='rtpaudioqosjitterbridged'||_0x4e9baf===_0x1931('0x72')||_0x4e9baf==='rtpaudioqoslossbridged'||_0x4e9baf===_0x1931('0x73')||_0x4e9baf===_0x1931('0x74')||_0x4e9baf===_0x1931('0x70')||_0x4e9baf===_0x1931('0x71')||_0x4e9baf===_0x1931('0x75')||_0x4e9baf==='rtpaudioqosjitterbridged'||_0x4e9baf===_0x1931('0x72')||_0x4e9baf===_0x1931('0x76')||_0x4e9baf===_0x1931('0x73')||_0x4e9baf===_0x1931('0x74')||_0x4e9baf===_0x1931('0x77')||_0x4e9baf==='bridgepvtcallid'||_0x4e9baf===_0x1931('0x29')||_0x4e9baf==='statedesc'){return![];}return!![];};exports[_0x1931('0x78')]=function(_0x199528,_0x15ff5c){var _0x1974a8,_0x52427c,_0x2a8f8a;if(_0x15ff5c<=0x0){_0x15ff5c=0x1;}_0x1974a8=new RegExp('\x5cw{0,'+_0x15ff5c+'}$');_0x52427c=Math[_0x1931('0x79')](0xa,_0x15ff5c-0x1);_0x2a8f8a=Math[_0x1931('0x79')](0xa,_0x15ff5c)-0x1;return util[_0x1931('0x13')]('%s',_[_0x1931('0x7a')](_0x199528,_0x1974a8,_[_0x1931('0x7b')](_0x52427c,_0x2a8f8a)));};exports['extractCalleridName']=function(_0x48e34d){var _0x20b378=_0x48e34d[_0x1931('0x7c')](/"(.*?)"/);return _0x20b378?_0x20b378[0x1]:_0x48e34d;};exports[_0x1931('0x7d')]=function(_0x361cc3){var _0x2d8fee=_0x361cc3[_0x1931('0x7c')](/<(.*?)>/);return _0x2d8fee?_0x2d8fee[0x1]:_0x361cc3;};function buildNoAnswerEventPayload(_0x4d8445,_0x1e1aee){var _0x43ecb1=buildObj(_0x4d8445,'noanswer');if(!_[_0x1931('0x11')](_0x1e1aee[_0x1931('0x7e')])){Object[_0x1931('0x7f')](_0x1e1aee[_0x1931('0x7e')])['forEach'](function(_0x50cf37){_0x43ecb1[_0x50cf37[_0x1931('0x80')]()]=_0x1e1aee[_0x1931('0x7e')][_0x50cf37];});}return _0x43ecb1;}exports[_0x1931('0x81')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xd42f=['inspect','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','UserId','logCustomer','endtime','talktime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes','ListId','decrementTalking','isNil','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','channelAgent','voice','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','filterKey','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','info'];(function(_0x15d9bc,_0x513b46){var _0x5868fe=function(_0x1696d0){while(--_0x1696d0){_0x15d9bc['push'](_0x15d9bc['shift']());}};_0x5868fe(++_0x513b46);}(_0xd42f,0x7b));var _0xfd42=function(_0x10dc0b,_0x1b63aa){_0x10dc0b=_0x10dc0b-0x0;var _0x318fea=_0xd42f[_0x10dc0b];return _0x318fea;};'use strict';var util=require('util');var _=require(_0xfd42('0x0'));var moment=require(_0xfd42('0x1'));var logger=require(_0xfd42('0x2'))(_0xfd42('0x3'));var ipAgi=process[_0xfd42('0x4')][_0xfd42('0x5')]||_0xfd42('0x6');var utils=require(_0xfd42('0x7'));exports[_0xfd42('0x8')]=function(_0x4e92f2){return function(_0x3fff42){logger['error'](_0x4e92f2,util['inspect'](_0x3fff42,{'showHidden':![],'depth':null}));};};exports[_0xfd42('0x9')]=function(_0x118c80,_0x380877){logger[_0xfd42('0xa')](_0x118c80,util[_0xfd42('0xb')](_0x380877,{'showHidden':![],'depth':null}));};exports[_0xfd42('0xc')]=function(_0x2fa0f5,_0x367532){logger[_0xfd42('0xd')](_0x2fa0f5,util['inspect'](_0x367532,{'showHidden':![],'depth':null}));};exports[_0xfd42('0xe')]=function(_0x1ea675){return function(_0x15c189){logger['info'](_0x1ea675,util['inspect'](_0x15c189,{'showHidden':![],'depth':null}));};};exports[_0xfd42('0xf')]=function(_0x4beb4f,_0x5e9f33,_0x35e960){return{'message':_0x4beb4f,'unlock':_0x5e9f33,'active':_0x35e960};};exports[_0xfd42('0x10')]=function(_0x2f674c,_0x277e6b,_0x3fc636){if(!_[_0xfd42('0x11')](_0x3fc636)&&_0xfd42('0x12')===typeof _0x3fc636&&!_['isEmpty'](_0x3fc636)){if(!_['isUndefined'](_0x277e6b)&&_0xfd42('0x12')===typeof _0x277e6b&&!_[_0xfd42('0x13')](_0x277e6b)){return util['format'](_0xfd42('0x14'),_0x277e6b,_0x3fc636);}return util[_0xfd42('0x15')](_0xfd42('0x14'),_0x3fc636,_0x3fc636);}if(!_[_0xfd42('0x11')](_0x2f674c)&&_0xfd42('0x12')===typeof _0x2f674c&&!_[_0xfd42('0x13')](_0x2f674c)){return _0x2f674c;}return _0xfd42('0x16');};exports[_0xfd42('0x17')]=function(_0x23c112){if(_['isNil'](_0x23c112)){return![];}return _0x23c112;};exports['addVariables']=function(_0x54608d,_0x21a045,_0x468053,_0x3e5450,_0x564fc7,_0x20b1d8){var _0x176f17={'XMD-QUEUE':_0x21a045['Queue']?_0x21a045[_0xfd42('0x18')][_0xfd42('0x19')]:'','XMD-CALLERID':_0x3e5450,'XMD-CALLERID-PREVIEW':_0x20b1d8?util[_0xfd42('0x15')](_0xfd42('0x14'),_0x20b1d8[_0xfd42('0x1a')],_0x20b1d8[_0xfd42('0x1b')]):_0x3e5450,'XMD-DIALID':_0x564fc7,'XMD-CONTACTID':_0x21a045[_0xfd42('0x1c')],'XMD-CDRTYPE':_0xfd42('0x1d'),'CALLERID(all)':_0x3e5450,'XMD-VOICEQUEUEID':_0x21a045[_0xfd42('0x1e')],'XMD-DIALCHANNEL':_0x468053,'XMD-DIALTIMEOUT':_0x54608d[_0xfd42('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xfd42('0x20'),_0x54608d[_0xfd42('0x21')]?'g':'',_[_0xfd42('0x13')](_0x54608d[_0xfd42('0x22')])?'':_0xfd42('0x23')),'XMD-DIALURL':_0x54608d['dialPreviewUrl']||'','XMD-AGI':_0x54608d[_0xfd42('0x24')]?util['format'](_0xfd42('0x25'),ipAgi,_0x54608d[_0xfd42('0x24')]):_0xfd42('0x26'),'XMD-AGIAFTER':_0x54608d[_0xfd42('0x21')]?util['format'](_0xfd42('0x25'),ipAgi,_0x54608d['dialQueueProject2']):_0xfd42('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x20b1d8?_0x20b1d8[_0xfd42('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x20b1d8?_0x20b1d8['originatecalleridname']:'','XMD-DESTINATION':_0xfd42('0x28'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xfd42('0x13')](_0x54608d[_0xfd42('0x22')])){_0x176f17[util[_0xfd42('0x15')]('%s',_0xfd42('0x29'))]=_0x54608d[_0xfd42('0x22')];_0x176f17[util[_0xfd42('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x564fc7;}return _0x176f17;};exports['toLowerVariables']=function(_0x179e81){var _0x25f071={};for(var _0x3aaef3 in _0x179e81){if(_0x179e81[_0xfd42('0x2a')](_0x3aaef3)){_0x25f071[util[_0xfd42('0x15')]('%s',_['toLower'](_0x3aaef3))]=_0x179e81[_0x3aaef3];}}return{'variables':_0x25f071};};exports['logBlacklist']=function(_0x1b638f){var _0x37685e=moment()[_0xfd42('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b638f[_0xfd42('0x2b')]=0xd;_0x1b638f[_0xfd42('0x2c')]=_0xfd42('0x2d');_0x1b638f[_0xfd42('0x2e')]=_0x37685e;_0x1b638f[_0xfd42('0x2f')]=_0x37685e;_0x1b638f['endtime']=_0x37685e;};exports[_0xfd42('0x30')]=function(_0x475714,_0x59b9df,_0x1d1cf9){var _0x110db0=moment()[_0xfd42('0x15')](_0xfd42('0x31'));_0x475714[_0xfd42('0x2b')]=_0x59b9df;_0x475714[_0xfd42('0x2c')]=_0x1d1cf9;_0x475714['responsetime']=_0x110db0;_0x475714[_0xfd42('0x32')]=utils[_0xfd42('0x33')](_0x475714[_0xfd42('0x2f')],_0x475714[_0xfd42('0x2e')]);};exports[_0xfd42('0x34')]=function(_0x1e09ae,_0x578114,_0x26a0b9){_0x1e09ae['membername']=_0x578114;_0x1e09ae[_0xfd42('0x35')]=_0x26a0b9;};exports[_0xfd42('0x36')]=function(_0x62a04d,_0x2d5e68,_0x13941b){var _0x884b8f=moment()['format'](_0xfd42('0x31'));_0x62a04d[_0xfd42('0x2b')]=_0x2d5e68;_0x62a04d[_0xfd42('0x2c')]=_0x13941b;_0x62a04d[_0xfd42('0x2f')]=_0x62a04d[_0xfd42('0x2f')]?_0x62a04d[_0xfd42('0x2f')]:_0x884b8f;_0x62a04d[_0xfd42('0x37')]=_0x62a04d[_0xfd42('0x37')]?_0x62a04d[_0xfd42('0x37')]:_0x884b8f;_0x62a04d[_0xfd42('0x32')]=utils[_0xfd42('0x33')](_0x62a04d[_0xfd42('0x2f')]||0x0,_0x62a04d['starttime']||0x0);_0x62a04d[_0xfd42('0x38')]=_0x62a04d['answertime']?utils[_0xfd42('0x33')](_0x62a04d[_0xfd42('0x37')],_0x62a04d['answertime']):0x0;};exports[_0xfd42('0x39')]=function(_0x152f68){return _0x152f68===_0xfd42('0x3a');};exports[_0xfd42('0x3b')]=function(_0x137836,_0x182e94,_0x4aad30,_0x2b6661,_0x174b1c){var _0x5bcc85=_0x2b6661?_0xfd42('0x3c'):_0x137836[_0xfd42('0x1a')];_0x5bcc85=_0x174b1c?'BOOKED':_0x5bcc85;return{'actionid':_0x137836[_0xfd42('0x3d')],'action':_0xfd42('0x3e'),'channel':_0x137836['channelAgent'],'callerid':util[_0xfd42('0x15')](_0xfd42('0x14'),_0x5bcc85,_0x137836['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xfd42('0x3f'),'Priority':'1','variable':_0x4aad30,'timeout':(_0x182e94[_0xfd42('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x137836[_0xfd42('0x3d')]};};exports['totalGlobal']=function(_0x2a397e){return _0x2a397e[_0xfd42('0x41')]+_0x2a397e[_0xfd42('0x42')]+_0x2a397e['countnoanswerretry']+_0x2a397e[_0xfd42('0x43')]+_0x2a397e[_0xfd42('0x44')];};exports[_0xfd42('0x45')]=function(_0x2fc345){var _0x52e302=_[_0xfd42('0x46')](_0x2fc345);_0x52e302['state']=0xf;_0x52e302['statedesc']='Global';return _0x52e302;};exports[_0xfd42('0x47')]=function(_0x514bdb,_0xa7f7d7,_0x370111){var _0x105542={};_0x105542[_0xa7f7d7]=_0x514bdb[_0xa7f7d7];_0x105542[_0xfd42('0x48')]=![];_0x105542[_0xfd42('0x49')]=moment()['add'](_0x370111,_0xfd42('0x4a'))[_0xfd42('0x15')](_0xfd42('0x31'));_0x105542[_0xfd42('0x1c')]=_0x514bdb[_0xfd42('0x1c')];_0x105542[_0xfd42('0x4b')]=_0x514bdb[_0xfd42('0x4b')];_0x105542[_0xfd42('0x1e')]=_0x514bdb[_0xfd42('0x1e')]||undefined;return _0x105542;};exports[_0xfd42('0x4c')]=function(_0x3566c4,_0x12134d){if(!_[_0xfd42('0x4d')](_0x3566c4)){if(_0x3566c4['pTalking']>0x0){_0x3566c4[_0xfd42('0x4e')]-=0x1;}else{logger['info'](_0x12134d,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xfd42('0xd')](_0x12134d,_0xfd42('0x4f'));}};exports['IsNotLoggedIn']=function(_0x534980){if(_0x534980<=0x0){return!![];}return![];};function buildObj(_0x443748,_0x36ee88,_0x427f9c){_0x443748[_0xfd42('0x50')]=_0x36ee88;_0x443748[_0xfd42('0x19')]=_0x443748[_0xfd42('0x51')];_0x443748[_0xfd42('0x52')]=_0x443748[_0xfd42('0x53')];_0x443748['motionChannel']=_0xfd42('0x54');if(_0x427f9c){_0x443748[_0xfd42('0x55')]=_0x427f9c['mandatoryDisposition'];}return _0x443748;}exports['buildObj']=buildObj;exports[_0xfd42('0x56')]=function(_0x30ec18){var _0x421a77=[];for(var _0x2b6a50 in _0x30ec18){if(_0x30ec18[_0xfd42('0x2a')](_0x2b6a50)){if(!_['isNil'](_0x30ec18[_0x2b6a50])&&_0x30ec18[_0x2b6a50][_0xfd42('0x2b')]===_0xfd42('0x57')&&_0x30ec18[_0x2b6a50][_0xfd42('0x58')]===_0xfd42('0x59')){_0x421a77['push'](_0x30ec18[_0x2b6a50]['id']);}}}return _0x421a77;};exports[_0xfd42('0x5a')]=function(_0x45644b){var _0x1b1d2c=moment()['milliseconds'](0x0);var _0x84376f=moment(_0x45644b)[_0xfd42('0x5b')](0x0);return _0x1b1d2c[_0xfd42('0x5c')](_0x84376f,_0xfd42('0x5d'));};exports['createBody']=function(_0x3539ee){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3539ee[_0xfd42('0x1c')],'ListId':_0x3539ee['ListId'],'VoiceQueueId':_0x3539ee[_0xfd42('0x1e')]||undefined,'CampaignId':_0x3539ee['CampaignId']||undefined};};exports[_0xfd42('0x5e')]=function(_0x3045de){if(_0x3045de==='uniqueid'||_0x3045de===_0xfd42('0x5f')||_0x3045de===_0xfd42('0x51')||_0x3045de==='type'||_0x3045de===_0xfd42('0x60')||_0x3045de===_0xfd42('0x61')||_0x3045de==='membername'||_0x3045de===_0xfd42('0x53')||_0x3045de===_0xfd42('0x1a')||_0x3045de===_0xfd42('0x48')||_0x3045de===_0xfd42('0x1b')||_0x3045de===_0xfd42('0x49')||_0x3045de===_0xfd42('0x41')||_0x3045de===_0xfd42('0x42')||_0x3045de==='countnoanswerretry'||_0x3045de===_0xfd42('0x62')||_0x3045de===_0xfd42('0x63')||_0x3045de===_0xfd42('0x64')||_0x3045de===_0xfd42('0x65')||_0x3045de==='recallme'||_0x3045de===_0xfd42('0x1c')||_0x3045de===_0xfd42('0x4b')||_0x3045de===_0xfd42('0x35')||_0x3045de===_0xfd42('0x1e')||_0x3045de===_0xfd42('0x66')||_0x3045de==='xmd-voicequeueid'||_0x3045de==='xmd-queue'||_0x3045de==='xmd-phone'||_0x3045de===_0xfd42('0x67')||_0x3045de===_0xfd42('0x68')||_0x3045de===_0xfd42('0x69')||_0x3045de==='xmd-dialoptions'||_0x3045de==='xmd-dialid'||_0x3045de===_0xfd42('0x6a')||_0x3045de==='xmd-contactid'||_0x3045de===_0xfd42('0x6b')||_0x3045de===_0xfd42('0x6c')||_0x3045de===_0xfd42('0x6d')||_0x3045de===_0xfd42('0x6e')||_0x3045de==='rtpaudioqos'||_0x3045de===_0xfd42('0x6f')||_0x3045de==='rtpaudioqosjitter'||_0x3045de===_0xfd42('0x70')||_0x3045de==='rtpaudioqosloss'||_0x3045de===_0xfd42('0x71')||_0x3045de===_0xfd42('0x72')||_0x3045de===_0xfd42('0x73')||_0x3045de===_0xfd42('0x74')||_0x3045de===_0xfd42('0x6f')||_0x3045de===_0xfd42('0x75')||_0x3045de===_0xfd42('0x70')||_0x3045de===_0xfd42('0x76')||_0x3045de===_0xfd42('0x71')||_0x3045de==='rtpaudioqosrtt'||_0x3045de===_0xfd42('0x73')||_0x3045de===_0xfd42('0x77')||_0x3045de===_0xfd42('0x78')||_0x3045de===_0xfd42('0x2b')||_0x3045de==='statedesc'){return![];}return!![];};exports[_0xfd42('0x79')]=function(_0x2de3b5,_0x41f639){var _0x32dbd3,_0x41f545,_0x200240;if(_0x41f639<=0x0){_0x41f639=0x1;}_0x32dbd3=new RegExp(_0xfd42('0x7a')+_0x41f639+'}$');_0x41f545=Math[_0xfd42('0x7b')](0xa,_0x41f639-0x1);_0x200240=Math['pow'](0xa,_0x41f639)-0x1;return util[_0xfd42('0x15')]('%s',_[_0xfd42('0x7c')](_0x2de3b5,_0x32dbd3,_[_0xfd42('0x7d')](_0x41f545,_0x200240)));};exports[_0xfd42('0x7e')]=function(_0x28eecc){var _0x34f561=_0x28eecc[_0xfd42('0x7f')](/"(.*?)"/);return _0x34f561?_0x34f561[0x1]:_0x28eecc;};exports[_0xfd42('0x80')]=function(_0x2c1a76){var _0x5cc655=_0x2c1a76[_0xfd42('0x7f')](/<(.*?)>/);return _0x5cc655?_0x5cc655[0x1]:_0x2c1a76;};function buildNoAnswerEventPayload(_0x211510,_0x13a325){var _0x500d3c=buildObj(_0x211510,'noanswer');if(!_[_0xfd42('0x13')](_0x13a325[_0xfd42('0x81')])){Object[_0xfd42('0x82')](_0x13a325[_0xfd42('0x81')])[_0xfd42('0x83')](function(_0x574a50){_0x500d3c[_0x574a50[_0xfd42('0x84')]()]=_0x13a325[_0xfd42('0x81')][_0x574a50];});}return _0x500d3c;}exports[_0xfd42('0x85')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 1de172e..8e23d71 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 _0x4cbe=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x4cbe,0xb7));var _0xe4cb=function(_0x4d0e8b,_0x25837e){_0x4d0e8b=_0x4d0e8b-0x0;var _0x1163d3=_0x4cbe[_0x4d0e8b];return _0x1163d3;};'use strict';exports[_0xe4cb('0x0')]={'queue':{'type':_0xe4cb('0x1'),'required':!![]},'interface':{'type':_0xe4cb('0x1'),'required':!![]},'membername':{'type':_0xe4cb('0x1'),'required':!![]},'penalty':{'type':_0xe4cb('0x2'),'required':![]},'paused':{'type':_0xe4cb('0x3'),'required':![]}};exports[_0xe4cb('0x4')]={'queue':{'type':_0xe4cb('0x1'),'required':!![]},'interface':{'type':_0xe4cb('0x1'),'required':!![]}};exports[_0xe4cb('0x5')]={'interface':{'type':_0xe4cb('0x1'),'required':!![]},'paused':{'type':_0xe4cb('0x3')},'reason':{'type':_0xe4cb('0x1'),'required':![]}};exports[_0xe4cb('0x6')]={'module':{'type':_0xe4cb('0x1'),'required':![]}};exports[_0xe4cb('0x7')]={'uniqueid':{'type':_0xe4cb('0x1'),'required':!![]}};exports[_0xe4cb('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xe4cb('0x1')},'mixmonitorid':{'type':_0xe4cb('0x1')}};exports[_0xe4cb('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe4cb('0xa')]={'uniqueid':{'type':_0xe4cb('0x1'),'required':!![]},'exten':{'type':_0xe4cb('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xdf17=['queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x4a2afd,_0x2ae789){var _0x5a0e13=function(_0x46931a){while(--_0x46931a){_0x4a2afd['push'](_0x4a2afd['shift']());}};_0x5a0e13(++_0x2ae789);}(_0xdf17,0x1bd));var _0x7df1=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xdf17[_0x164eca];return _0x2ce562;};'use strict';exports[_0x7df1('0x0')]={'queue':{'type':_0x7df1('0x1'),'required':!![]},'interface':{'type':_0x7df1('0x1'),'required':!![]},'membername':{'type':_0x7df1('0x1'),'required':!![]},'penalty':{'type':_0x7df1('0x2'),'required':![]},'paused':{'type':_0x7df1('0x3'),'required':![]}};exports[_0x7df1('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x7df1('0x1'),'required':!![]}};exports[_0x7df1('0x5')]={'interface':{'type':_0x7df1('0x1'),'required':!![]},'paused':{'type':_0x7df1('0x3')},'reason':{'type':_0x7df1('0x1'),'required':![]}};exports[_0x7df1('0x6')]={'module':{'type':_0x7df1('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7df1('0x1'),'required':!![]}};exports[_0x7df1('0x7')]={'uniqueid':{'type':_0x7df1('0x1'),'required':!![]},'filename':{'type':_0x7df1('0x1')},'format':{'type':_0x7df1('0x1')},'mixmonitorid':{'type':_0x7df1('0x1')}};exports[_0x7df1('0x8')]={'uniqueid':{'type':_0x7df1('0x1'),'required':!![]}};exports[_0x7df1('0x9')]={'uniqueid':{'type':_0x7df1('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x7df1('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f59bd93..a28087d 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x494ac7,_0x45a5ed){var _0x18f656=function(_0x57905a){while(--_0x57905a){_0x494ac7['push'](_0x494ac7['shift']());}};_0x18f656(++_0x45a5ed);}(_0xadb5,0xad));var _0x5adb=function(_0x4e33d4,_0x26726b){_0x4e33d4=_0x4e33d4-0x0;var _0x16e4cb=_0xadb5[_0x4e33d4];return _0x16e4cb;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x2cffbb,_0xfeb6d6){var _0x6602fe=function(_0x2bb7d2){while(--_0x2bb7d2){_0x2cffbb['push'](_0x2cffbb['shift']());}};_0x6602fe(++_0xfeb6d6);}(_0xdb28,0x106));var _0x8db2=function(_0xbdc0f2,_0x213ebd){_0xbdc0f2=_0xbdc0f2-0x0;var _0x254854=_0xdb28[_0xbdc0f2];return _0x254854;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 199d545..b7cba98 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0260=['mergeDBDataToRealtime','assign'];(function(_0x373202,_0x1a1fd4){var _0x5e90ab=function(_0x20da9b){while(--_0x20da9b){_0x373202['push'](_0x373202['shift']());}};_0x5e90ab(++_0x1a1fd4);}(_0x0260,0x125));var _0x0026=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x0260[_0x220f3f];return _0x1f170e;};'use strict';function mergeDBDataToRealtime(_0x18108e,_0x42004d){var _0x4c5404=Object[_0x0026('0x0')]({},_0x18108e);for(var _0x40e2b9 in _0x42004d){if(_0x4c5404['hasOwnProperty'](_0x40e2b9)){_0x4c5404[_0x40e2b9]=_0x42004d[_0x40e2b9];}}return _0x4c5404;}exports[_0x0026('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x959d=['assign','hasOwnProperty'];(function(_0x411fc1,_0x806999){var _0x226e34=function(_0x5309ff){while(--_0x5309ff){_0x411fc1['push'](_0x411fc1['shift']());}};_0x226e34(++_0x806999);}(_0x959d,0x7a));var _0xd959=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x959d[_0x32b122];return _0x4ad25a;};'use strict';function mergeDBDataToRealtime(_0x33328c,_0x3a0b92){var _0x5830d2=Object[_0xd959('0x0')]({},_0x33328c);for(var _0xf028d6 in _0x3a0b92){if(_0x5830d2[_0xd959('0x1')](_0xf028d6)){_0x5830d2[_0xf028d6]=_0x3a0b92[_0xf028d6];}}return _0x5830d2;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 3beeb4b..9b9b9d6 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 _0xf81e=['queuecallerexitAt','create','match','keys','length','getCallType','channel','split','getAgentByInternal','calleridnum','outbound','internal','destination','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','blindTransfer','type','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','exten','xcally-motion-dialer','isArray','forEach','voiceDialReport','Local','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','blindtransfer','attendedTransfer','findAgent','find','isNil','name','interface','format','accountcode','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit'];(function(_0xdfbc93,_0x31171b){var _0x24cdde=function(_0x515595){while(--_0x515595){_0xdfbc93['push'](_0xdfbc93['shift']());}};_0x24cdde(++_0x31171b);}(_0xf81e,0x1b3));var _0xef81=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf81e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xef81('0x0'));var moment=require('moment');var util=require(_0xef81('0x1'));var config=require(_0xef81('0x2'));var ami=require(_0xef81('0x3'));var RpcVoiceAgentReport=require(_0xef81('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xef81('0x5'));var RpcMemberReport=require(_0xef81('0x6'));var RpcVoiceQueueReport=require(_0xef81('0x7'));var RpcVoiceRecording=require(_0xef81('0x8'));var RpcVoiceTransferReport=require(_0xef81('0x9'));var VoiceQueueReport=require(_0xef81('0xa'));var VoiceCallReport=require(_0xef81('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xef81('0xc'));function Report(_0x491dc7){this['realtime']=_0x491dc7;this['agents']=_0x491dc7[_0xef81('0xd')];this[_0xef81('0xe')]=_0x491dc7[_0xef81('0xe')];}Report[_0xef81('0xf')][_0xef81('0x10')]=function(_0xd5793c){var _0x53db7c=new VoiceQueueReport(this[_0xef81('0x11')]);var _0x3a8b94=new VoiceAgentReport(this[_0xef81('0x11')]);var _0x75f3b9=new VoiceDialReport(this['realtime']);var _0x3fe40e=new VoiceCallReport(this[_0xef81('0x11')]);var _0x35d262=new UserReport(this['realtime']);if(config[_0xef81('0x12')]&&config[_0xef81('0x12')][_0xef81('0x13')]){ami['on'](_0xef81('0x14'),this[_0xef81('0x15')][_0xef81('0x16')](this));ami['on'](_0xef81('0x17'),this[_0xef81('0x18')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xef81('0x19')][_0xef81('0x16')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport']['bind'](this));ami['on'](_0xef81('0x1a'),this['blindTransfer'][_0xef81('0x16')](this));ami['on']('attendedtransfer',this[_0xef81('0x1b')][_0xef81('0x16')](this));}};Report['prototype'][_0xef81('0x1c')]=function(_0x5e6aaf){var _0x43a35f;_0x43a35f=_[_0xef81('0x1d')](this['agents'],function(_0x55854d){return _0x55854d['accountcode']==_0x5e6aaf||_0x55854d['name']==_0x5e6aaf;});if(_[_0xef81('0x1e')](_0x43a35f)){var _0x452ebd=_['find'](this[_0xef81('0xe')],function(_0x362cdc){return _0x362cdc['accountcode']==_0x5e6aaf||_0x362cdc[_0xef81('0x1f')]==_0x5e6aaf;});if(_0x452ebd){_0x43a35f=_[_0xef81('0x1d')](this[_0xef81('0xd')],function(_0xaee12f){return _0xaee12f[_0xef81('0x20')]==util[_0xef81('0x21')]('SIP/%s',_0x452ebd[_0xef81('0x1f')]);});}}return _0x43a35f;};Report[_0xef81('0xf')][_0xef81('0x15')]=function(_0x4377ac){for(var _0xbb9640=0x0;_0xbb9640<_0x4377ac['length'];_0xbb9640+=0x1){var _0x16c88c=this[_0xef81('0x1c')](_0x4377ac[_0xbb9640]['connectedlinenum']);if(_0x16c88c){_0x4377ac[_0xbb9640][_0xef81('0x22')]=_0x16c88c[_0xef81('0x22')];_0x4377ac[_0xbb9640]['assigned']=!![];_0x4377ac[_0xbb9640][_0xef81('0x23')]=_0x16c88c[_0xef81('0x1f')];_0x4377ac[_0xbb9640][_0xef81('0x20')]=_[_0xef81('0x1e')](_0x16c88c[_0xef81('0x20')])?util['format']('SIP/%s',_0x16c88c[_0xef81('0x1f')]):_0x16c88c[_0xef81('0x20')];if(_0x4377ac[_0xbb9640][_0xef81('0x24')]){_0x4377ac[_0xbb9640][_0xef81('0x25')]=moment()[_0xef81('0x21')](_0xef81('0x26'));}if(_0x4377ac[_0xbb9640][_0xef81('0x27')]){_0x4377ac[_0xbb9640][_0xef81('0x28')]=moment()[_0xef81('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xef81('0x15')](_0x4377ac[_0xbb9640]);}RpcVoiceQueueReport[_0xef81('0x29')](_0x4377ac[_0xbb9640]);}};function extractCalleridNumber(_0x29bc47){var _0x304aaf=_0x29bc47[_0xef81('0x2a')](/<(.*?)>/);return _0x304aaf?_0x304aaf[0x1]:_0x29bc47;}Report[_0xef81('0xf')]['getAgentByInternal']=function(_0x278637){for(var _0x11cb3e=0x0;_0x11cb3e','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','voiceAgentReport','isArray','forEach','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','accountcode','isNil','name','find','interface'];(function(_0x1190de,_0x5db7ae){var _0xe73db2=function(_0x4415be){while(--_0x4415be){_0x1190de['push'](_0x1190de['shift']());}};_0xe73db2(++_0x5db7ae);}(_0x4372,0x18f));var _0x2437=function(_0x48f791,_0x57dbd7){_0x48f791=_0x48f791-0x0;var _0x5ec5ea=_0x4372[_0x48f791];return _0x5ec5ea;};'use strict';var _=require(_0x2437('0x0'));var moment=require(_0x2437('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0x2437('0x2'));var RpcVoiceAgentReport=require(_0x2437('0x3'));var RpcVoiceCallReport=require(_0x2437('0x4'));var RpcVoiceDialReport=require(_0x2437('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x2437('0x6'));var RpcVoiceRecording=require(_0x2437('0x7'));var RpcVoiceTransferReport=require(_0x2437('0x8'));var VoiceQueueReport=require(_0x2437('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2437('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2437('0xb'));function Report(_0x2a75e5){this[_0x2437('0xc')]=_0x2a75e5;this[_0x2437('0xd')]=_0x2a75e5[_0x2437('0xd')];this[_0x2437('0xe')]=_0x2a75e5['telephones'];}Report[_0x2437('0xf')][_0x2437('0x10')]=function(_0x3f8639){var _0x44b415=new VoiceQueueReport(this[_0x2437('0xc')]);var _0x252bf3=new VoiceAgentReport(this[_0x2437('0xc')]);var _0x27c25d=new VoiceDialReport(this['realtime']);var _0x547ec4=new VoiceCallReport(this[_0x2437('0xc')]);var _0x510080=new UserReport(this['realtime']);if(config[_0x2437('0x11')]&&config['xdr'][_0x2437('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x2437('0x13')][_0x2437('0x14')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x2437('0x14')](this));ami['on'](_0x2437('0x15'),this['voiceAgentReport'][_0x2437('0x14')](this));ami['on'](_0x2437('0x16'),this[_0x2437('0x17')][_0x2437('0x14')](this));ami['on']('blindtransfer',this[_0x2437('0x18')]['bind'](this));ami['on']('attendedtransfer',this[_0x2437('0x19')]['bind'](this));}};Report[_0x2437('0xf')]['findAgent']=function(_0x56ab6d){var _0x3af60e;_0x3af60e=_['find'](this[_0x2437('0xd')],function(_0x4aeb4b){return _0x4aeb4b[_0x2437('0x1a')]==_0x56ab6d||_0x4aeb4b['name']==_0x56ab6d;});if(_[_0x2437('0x1b')](_0x3af60e)){var _0x4ba5e7=_['find'](this[_0x2437('0xe')],function(_0x2b6a32){return _0x2b6a32[_0x2437('0x1a')]==_0x56ab6d||_0x2b6a32[_0x2437('0x1c')]==_0x56ab6d;});if(_0x4ba5e7){_0x3af60e=_[_0x2437('0x1d')](this[_0x2437('0xd')],function(_0x7e2324){return _0x7e2324[_0x2437('0x1e')]==util[_0x2437('0x1f')](_0x2437('0x20'),_0x4ba5e7[_0x2437('0x1c')]);});}}return _0x3af60e;};Report[_0x2437('0xf')][_0x2437('0x13')]=function(_0x5f5812){for(var _0x40be4f=0x0;_0x40be4f<_0x5f5812[_0x2437('0x21')];_0x40be4f+=0x1){var _0x12b47e=this[_0x2437('0x22')](_0x5f5812[_0x40be4f][_0x2437('0x23')]);if(_0x12b47e){_0x5f5812[_0x40be4f][_0x2437('0x1a')]=_0x12b47e[_0x2437('0x1a')];_0x5f5812[_0x40be4f]['assigned']=!![];_0x5f5812[_0x40be4f]['lastAssignedTo']=_0x12b47e['name'];_0x5f5812[_0x40be4f][_0x2437('0x1e')]=_[_0x2437('0x1b')](_0x12b47e['interface'])?util[_0x2437('0x1f')]('SIP/%s',_0x12b47e['name']):_0x12b47e[_0x2437('0x1e')];if(_0x5f5812[_0x40be4f][_0x2437('0x24')]){_0x5f5812[_0x40be4f]['queuecallercompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5f5812[_0x40be4f][_0x2437('0x25')]){_0x5f5812[_0x40be4f][_0x2437('0x26')]=moment()[_0x2437('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x5f5812[_0x40be4f]);}RpcVoiceQueueReport[_0x2437('0x27')](_0x5f5812[_0x40be4f]);}};function extractCalleridNumber(_0x5c50ef){var _0x2e5e2b=_0x5c50ef[_0x2437('0x28')](/<(.*?)>/);return _0x2e5e2b?_0x2e5e2b[0x1]:_0x5c50ef;}Report[_0x2437('0xf')][_0x2437('0x29')]=function(_0x597d3e){for(var _0xb666a5=0x0;_0xb666a5{delete this[_0x80f8('0xb')][_0x1e895a];},_0x132382);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xb22a=['isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','queuecallerabandon','syncAgentComplete','varset','syncVarSet','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','emit','custom:agentcalled','user:%s','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','agentringnoanswer','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime'];(function(_0x23b70b,_0x827be7){var _0x69d657=function(_0x49decf){while(--_0x49decf){_0x23b70b['push'](_0x23b70b['shift']());}};_0x69d657(++_0x827be7);}(_0xb22a,0xb0));var _0xab22=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0xb22a[_0x26a818];return _0x5d8ca0;};'use strict';var _=require('lodash');var moment=require(_0xab22('0x0'));var util=require(_0xab22('0x1'));var Redis=require(_0xab22('0x2'));var config=require(_0xab22('0x3'));var logger=require(_0xab22('0x4'))('ami');var ami=require(_0xab22('0x5'));config[_0xab22('0x6')]=_[_0xab22('0x7')](config[_0xab22('0x6')],{'host':_0xab22('0x8'),'port':0x18eb});var io=require(_0xab22('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x48b376){this[_0xab22('0xa')]={};this['voiceChannels']=_0x48b376[_0xab22('0xa')];this['voiceQueues']=_0x48b376[_0xab22('0xb')];this[_0xab22('0xc')]=_0x48b376['agents'];this[_0xab22('0xd')]={};ami['on'](_0xab22('0xe'),this[_0xab22('0xf')][_0xab22('0x10')](this));ami['on']('agentconnect',this[_0xab22('0x11')][_0xab22('0x10')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xab22('0x12'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('agentcomplete',this[_0xab22('0x13')][_0xab22('0x10')](this));ami['on'](_0xab22('0x14'),this[_0xab22('0x15')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xab22('0x10')](this));ami['on'](_0xab22('0x16'),this[_0xab22('0x17')]['bind'](this));ami['on']('musiconholdstop',this[_0xab22('0x18')][_0xab22('0x10')](this));ami['on']('attendedtransfer',this[_0xab22('0x19')][_0xab22('0x10')](this));ami['on'](_0xab22('0x1a'),this[_0xab22('0x1b')][_0xab22('0x10')](this));}VoiceAgentReport[_0xab22('0x1c')]['emit']=function(_0x5d23b5,_0x1c02a6,_0x72802b){io['to'](_0x5d23b5)['emit'](_0x1c02a6,_0x72802b);};VoiceAgentReport[_0xab22('0x1c')]['isNotNull']=function(_0x4fc598){return _0x4fc598!==null&&!_[_0xab22('0x1d')](_0x4fc598);};VoiceAgentReport['prototype'][_0xab22('0xf')]=function(_0x931eb2){try{if(this[_0xab22('0x1e')](_0x931eb2)){logger[_0xab22('0x1f')](_0xab22('0x20'),_0x931eb2['uniqueid'],_0x931eb2[_0xab22('0x21')],_0x931eb2[_0xab22('0x22')]);logger[_0xab22('0x23')](_0xab22('0x24'),_0x931eb2[_0xab22('0x25')],util[_0xab22('0x26')](_0x931eb2,{'showHidden':![],'depth':null}));if(_[_0xab22('0x1d')](this[_0xab22('0xa')][_0x931eb2[_0xab22('0x25')]])){this['channels'][_0x931eb2[_0xab22('0x25')]]={};}var _0x765e5d=this[_0xab22('0xc')][_0x931eb2[_0xab22('0x27')]];var _0x7d0638=this[_0xab22('0xa')][_0x931eb2[_0xab22('0x25')]][_0x931eb2[_0xab22('0x22')]];var _0x3ad4ae=this[_0xab22('0xb')][_0x931eb2[_0xab22('0x28')]];var _0xc1f861=this[_0xab22('0xd')][_0x931eb2[_0xab22('0x25')]];if(_[_0xab22('0x1d')](_0x7d0638)){_0x7d0638={'agentcalledAt':moment()[_0xab22('0x29')](_0xab22('0x2a')),'lastevent':_0xab22('0x2b'),'mandatoryDisposition':_0x3ad4ae&&_0x3ad4ae['mandatoryDisposition']?_0x3ad4ae[_0xab22('0x2c')]:![],'type':_0x3ad4ae&&_0x3ad4ae['type']?_0x3ad4ae['type']:'inbound','variables':_0xc1f861,'motionChannel':'voice'};}Object[_0xab22('0x2d')](_0x7d0638,_[_0xab22('0x2e')](_0x931eb2,[_0xab22('0x2f'),_0xab22('0x30')]));this[_0xab22('0xa')][_0x931eb2[_0xab22('0x25')]][_0x931eb2[_0xab22('0x22')]]=_0x7d0638;logger[_0xab22('0x23')](_0xab22('0x31'),_0x931eb2[_0xab22('0x25')],util[_0xab22('0x26')](_0x7d0638,{'showHidden':![],'depth':null}));ami[_0xab22('0x32')](_0xab22('0x33'),_0x7d0638);var _0x2485a2={'id':_0x765e5d['id'],'calleridnum':_0x7d0638['calleridnum'],'queue':_0x7d0638[_0xab22('0x28')],'variables':_0x7d0638['variables'],'uniqueid':_0x931eb2[_0xab22('0x25')]};logger[_0xab22('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x931eb2[_0xab22('0x25')],util['inspect'](_0x2485a2,{'showHidden':![],'depth':null}));this[_0xab22('0x32')](util[_0xab22('0x29')](_0xab22('0x34'),_0x931eb2['membername']),'user:called',_0x2485a2);}}catch(_0x351307){logger[_0xab22('0x35')](_0xab22('0x36'),_0x931eb2[_0xab22('0x25')],util[_0xab22('0x26')](_0x351307,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')][_0xab22('0x11')]=function(_0x4da5a1){try{if(this[_0xab22('0x1e')](_0x4da5a1)){if(this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]]){for(var _0x2b67c7 in this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]]){if(this['channels'][_0x4da5a1['uniqueid']]['hasOwnProperty'](_0x2b67c7)){if(_0x4da5a1[_0xab22('0x22')]===_0x2b67c7){logger[_0xab22('0x1f')](_0xab22('0x37'),_0x4da5a1[_0xab22('0x25')],_0x4da5a1['membername'],_0x4da5a1[_0xab22('0x22')]);this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x38')]=moment()[_0xab22('0x29')](_0xab22('0x2a'));this[_0xab22('0xa')][_0x4da5a1['uniqueid']][_0x2b67c7][_0xab22('0x39')]=_0x4da5a1[_0xab22('0x39')];this['channels'][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x3a')]=_0x4da5a1['connectedlinenum'];this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7]['destchannelstate']=_0x4da5a1[_0xab22('0x3b')];this[_0xab22('0xa')][_0x4da5a1['uniqueid']][_0x2b67c7]['destchannelstatedesc']=_0x4da5a1[_0xab22('0x3c')];this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x3d')]=_0x4da5a1[_0xab22('0x3d')];this['channels'][_0x4da5a1['uniqueid']][_0x2b67c7][_0xab22('0x3e')]=_0xab22('0x3f');_[_0xab22('0x40')](this['agents'][_0x4da5a1[_0xab22('0x27')]],_[_0xab22('0x41')](_0x4da5a1,[_0xab22('0x28'),_0xab22('0x42')]));var _0x342b82=this[_0xab22('0xc')][_0x4da5a1[_0xab22('0x27')]];var _0x17fbf3={'id':_0x342b82['id'],'name':_0x342b82[_0xab22('0x43')],'agentconnected':!![],'destaccountcode':_0x342b82[_0xab22('0x44')],'destconnectedlinenum':this['channels'][_0x4da5a1['uniqueid']][_0x4da5a1[_0xab22('0x22')]][_0xab22('0x45')],'queue':this['channels'][_0x4da5a1[_0xab22('0x25')]][_0x4da5a1['destuniqueid']][_0xab22('0x28')],'uniqueid':this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]][_0x4da5a1['destuniqueid']]['uniqueid']};ami[_0xab22('0x32')](_0xab22('0x46'),this['channels'][_0x4da5a1['uniqueid']][_0x4da5a1[_0xab22('0x22')]]);this[_0xab22('0x32')](util[_0xab22('0x29')](_0xab22('0x34'),_0x4da5a1[_0xab22('0x21')]),_0xab22('0x47'),_0x17fbf3);}else if(!this['channels'][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x48')]&&!this['channels'][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x49')]){logger['info'](_0xab22('0x4a'),_0x4da5a1[_0xab22('0x25')],this['channels'][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x21')],_0x2b67c7);this['channels'][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x48')]=!![];this[_0xab22('0xa')][_0x4da5a1['uniqueid']][_0x2b67c7]['agentringnoanswerAt']=moment()[_0xab22('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xab22('0xa')][_0x4da5a1['uniqueid']][_0x2b67c7][_0xab22('0x4b')]=_0x4da5a1[_0xab22('0x22')];this[_0xab22('0xa')][_0x4da5a1['uniqueid']][_0x2b67c7][_0xab22('0x4c')]=_0x4da5a1[_0xab22('0x21')];this['channels'][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x3e')]=_0xab22('0x4d');this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7][_0xab22('0x4e')]='answered_elsewhere';logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x4da5a1[_0xab22('0x25')],util[_0xab22('0x26')](this[_0xab22('0xa')][_0x4da5a1['uniqueid']][_0x2b67c7],{'showHidden':![],'depth':null}));ami['emit'](_0xab22('0x4f'),this[_0xab22('0xa')][_0x4da5a1[_0xab22('0x25')]][_0x2b67c7]);}else{logger[_0xab22('0x23')](_0xab22('0x50'),_0x4da5a1['uniqueid']);}}}}}}catch(_0x24dd4f){logger[_0xab22('0x35')]('[%s][voiceAgentReport][agentconnect]',_0x4da5a1['uniqueid'],util[_0xab22('0x26')](_0x24dd4f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x43a610){try{if(this[_0xab22('0x1e')](_0x43a610)){logger[_0xab22('0x23')](_0xab22('0x51'),_0x43a610[_0xab22('0x25')],util[_0xab22('0x26')](_0x43a610,{'showHidden':![],'depth':null}));if(this['channels'][_0x43a610['uniqueid']]&&this[_0xab22('0xa')][_0x43a610[_0xab22('0x25')]][_0x43a610[_0xab22('0x22')]]){logger[_0xab22('0x1f')](_0xab22('0x52'),_0x43a610['uniqueid'],_0x43a610[_0xab22('0x21')],_0x43a610[_0xab22('0x22')]);var _0x1f5488=this[_0xab22('0xc')][_0x43a610['interface']];var _0x5cef3d=this[_0xab22('0xa')][_0x43a610['uniqueid']][_0x43a610[_0xab22('0x22')]];_0x5cef3d[_0xab22('0x48')]=!![];_0x5cef3d['agentringnoanswerAt']=moment()[_0xab22('0x29')](_0xab22('0x2a'));_0x5cef3d['lastevent']=_0xab22('0x53');_0x5cef3d[_0xab22('0x4e')]=_0xab22('0x53');var _0x2e683b={'id':_0x1f5488['id'],'name':_0x1f5488[_0xab22('0x43')],'queue':_0x5cef3d[_0xab22('0x28')],'uniqueid':_0x5cef3d['uniqueid']};logger[_0xab22('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x43a610['uniqueid'],util[_0xab22('0x26')](_0x2e683b,{'showHidden':![],'depth':null}));this[_0xab22('0x32')](util[_0xab22('0x29')](_0xab22('0x34'),_0x1f5488[_0xab22('0x43')]),_0xab22('0x54'),_0x2e683b);ami['emit'](_0xab22('0x55'),_0x5cef3d);this[_0xab22('0xa')][_0x43a610[_0xab22('0x25')]][_0x43a610[_0xab22('0x22')]]=Object['assign']({},_0x5cef3d);}}}catch(_0x7b6189){logger[_0xab22('0x35')](_0xab22('0x56'),_0x43a610[_0xab22('0x25')],util[_0xab22('0x26')](_0x7b6189,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')]['syncQueueCallerAbandon']=function(_0x1d718d){try{if(this[_0xab22('0x1e')](_0x1d718d)){logger[_0xab22('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x1d718d[_0xab22('0x25')],util[_0xab22('0x26')](_0x1d718d,{'showHidden':![],'depth':null}));if(this[_0xab22('0xa')][_0x1d718d[_0xab22('0x25')]]){for(var _0x32123d in this['channels'][_0x1d718d[_0xab22('0x25')]]){if(this[_0xab22('0xa')][_0x1d718d[_0xab22('0x25')]][_0xab22('0x57')](_0x32123d)&&!this[_0xab22('0xa')][_0x1d718d['uniqueid']][_0x32123d][_0xab22('0x48')]&&!this[_0xab22('0xa')][_0x1d718d[_0xab22('0x25')]][_0x32123d]['agentcomplete']){logger['info'](_0xab22('0x58'),_0x1d718d[_0xab22('0x25')],this['channels'][_0x1d718d[_0xab22('0x25')]][_0x32123d]['membername'],_0x32123d);this['channels'][_0x1d718d[_0xab22('0x25')]][_0x32123d][_0xab22('0x48')]=!![];this[_0xab22('0xa')][_0x1d718d['uniqueid']][_0x32123d][_0xab22('0x59')]=moment()[_0xab22('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xab22('0xa')][_0x1d718d[_0xab22('0x25')]][_0x32123d][_0xab22('0x3e')]='abandoned';this[_0xab22('0xa')][_0x1d718d[_0xab22('0x25')]][_0x32123d]['reason']=_0xab22('0x5a');logger[_0xab22('0x23')](_0xab22('0x5b'),_0x1d718d['uniqueid'],util['inspect'](this[_0xab22('0xa')][_0x1d718d[_0xab22('0x25')]][_0x32123d],{'showHidden':![],'depth':null}));ami[_0xab22('0x32')](_0xab22('0x5c'),this[_0xab22('0xa')][_0x1d718d[_0xab22('0x25')]][_0x32123d]);}}}}}catch(_0x3967f8){logger['error'](_0xab22('0x5d'),_0x1d718d[_0xab22('0x25')],util[_0xab22('0x26')](_0x3967f8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')]['syncAgentComplete']=function(_0x47f636){try{if(this[_0xab22('0x1e')](_0x47f636)){logger['debug'](_0xab22('0x5e'),_0x47f636[_0xab22('0x25')],util[_0xab22('0x26')](_0x47f636,{'showHidden':![],'depth':null}));if(this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]]){for(var _0x2bfca3 in this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]]){if(this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0xab22('0x57')](_0x2bfca3)){if(this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3]['agentconnectAt']&&!this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3][_0xab22('0x49')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x47f636[_0xab22('0x25')],this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3][_0xab22('0x21')],_0x2bfca3);this[_0xab22('0xa')][_0x47f636['uniqueid']][_0x2bfca3]['agentcomplete']=!![];this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3][_0xab22('0x5f')]=moment()[_0xab22('0x29')](_0xab22('0x2a'));this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3][_0xab22('0x3e')]=_0xab22('0x60');this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3][_0xab22('0x4e')]=_0x47f636[_0xab22('0x4e')]==_0xab22('0x61')?_0xab22('0x62'):_0x47f636[_0xab22('0x4e')];this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3][_0xab22('0x63')]=_0x47f636[_0xab22('0x63')];if(this[_0xab22('0xb')][_0x47f636[_0xab22('0x28')]]&&this[_0xab22('0xb')][_0x47f636[_0xab22('0x28')]]['acw']){this[_0xab22('0xa')][_0x47f636['uniqueid']][_0x2bfca3][_0xab22('0x64')]=this[_0xab22('0xb')][_0x47f636[_0xab22('0x28')]][_0xab22('0x65')];this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3][_0xab22('0x66')]=!![];}this[_0xab22('0xc')][_0x47f636[_0xab22('0x27')]]=_[_0xab22('0x2e')](this['agents'][_0x47f636[_0xab22('0x27')]],[_0xab22('0x28'),'destconnectedlinenum']);logger['debug'](_0xab22('0x67'),_0x47f636[_0xab22('0x25')],util[_0xab22('0x26')](this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3],{'showHidden':![],'depth':null}));ami[_0xab22('0x32')](_0xab22('0x68'),this[_0xab22('0xa')][_0x47f636[_0xab22('0x25')]][_0x2bfca3]);logger[_0xab22('0x23')](_0xab22('0x69'),_0x47f636[_0xab22('0x25')],util[_0xab22('0x26')]({'id':this[_0xab22('0xc')][_0x47f636['interface']]['id'],'destaccountcode':_0x47f636[_0xab22('0x6a')]},{'showHidden':![],'depth':null}));this[_0xab22('0x32')](util[_0xab22('0x29')](_0xab22('0x34'),_0x47f636[_0xab22('0x21')]),_0xab22('0x6b'),{'id':this[_0xab22('0xc')][_0x47f636[_0xab22('0x27')]]['id'],'destaccountcode':Number(_0x47f636[_0xab22('0x6a')])});}}}}}}catch(_0x1db440){logger[_0xab22('0x35')](_0xab22('0x6c'),_0x47f636[_0xab22('0x25')],util[_0xab22('0x26')](_0x1db440,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')]['syncVarSet']=function(_0x12acf0){try{if(this[_0xab22('0x1e')](_0x12acf0)){logger[_0xab22('0x23')](_0xab22('0x6d'),_0x12acf0[_0xab22('0x25')],util[_0xab22('0x26')](_0x12acf0,{'showHidden':![],'depth':null}));this[_0xab22('0x6e')](_0x12acf0['uniqueid'],_[_0xab22('0x6f')](_0x12acf0[_0xab22('0x70')])[0x0],_0x12acf0[_0xab22('0x71')]);if(this[_0xab22('0xa')][_0x12acf0[_0xab22('0x25')]]){for(var _0x410b6a in this[_0xab22('0xa')][_0x12acf0[_0xab22('0x25')]]){if(this[_0xab22('0xa')][_0x12acf0['uniqueid']][_0xab22('0x57')](_0x410b6a)){logger[_0xab22('0x1f')](_0xab22('0x72'),_0x12acf0[_0xab22('0x25')],_0x410b6a,_['keys'](_0x12acf0['variable'])[0x0],_0x12acf0[_0xab22('0x71')]);if(_[_0xab22('0x1d')](this[_0xab22('0xa')][_0x12acf0[_0xab22('0x25')]][_0x410b6a][_0xab22('0xd')])){this[_0xab22('0xa')][_0x12acf0[_0xab22('0x25')]][_0x410b6a][_0xab22('0xd')]={};}this[_0xab22('0xa')][_0x12acf0[_0xab22('0x25')]][_0x410b6a][_0xab22('0xd')]=this['variables'][_0x12acf0[_0xab22('0x25')]];}}}}}catch(_0x27a01f){logger['error'](_0xab22('0x73'),_0x12acf0[_0xab22('0x25')],util[_0xab22('0x26')](_0x27a01f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')][_0xab22('0x6e')]=function(_0x5a5663,_0x1aa785,_0x95e754){var _0x35fc70=[_0xab22('0x74'),'rtpaudioqosbridged',_0xab22('0x75'),_0xab22('0x76'),_0xab22('0x77'),_0xab22('0x78'),_0xab22('0x79'),_0xab22('0x7a'),_0xab22('0x7b'),_0xab22('0x7c'),'bridgepeer','bridgepvtcallid',_0xab22('0x7d'),'memberdynamic',_0xab22('0x7e'),_0xab22('0x7f'),'membername',_0xab22('0x80'),_0xab22('0x81')];if(!_[_0xab22('0x82')](_0x1aa785)&&!_['includes'](_0x35fc70,_0x1aa785)){if(_['isUndefined'](this['variables'][_0x5a5663])){this['variables'][_0x5a5663]={};}this[_0xab22('0xd')][_0x5a5663][_0x1aa785]=_0x95e754;}};VoiceAgentReport[_0xab22('0x1c')][_0xab22('0x83')]=function(_0x2bee65){try{if(this[_0xab22('0x1e')](_0x2bee65)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x2bee65['uniqueid'],util[_0xab22('0x26')](_0x2bee65,{'showHidden':![],'depth':null}));if(this[_0xab22('0xa')][_0x2bee65[_0xab22('0x25')]]){for(var _0x3fe58f in this[_0xab22('0xa')][_0x2bee65[_0xab22('0x25')]]){if(this['channels'][_0x2bee65[_0xab22('0x25')]][_0xab22('0x57')](_0x3fe58f)){if(this[_0xab22('0xa')][_0x2bee65['uniqueid']][_0x3fe58f][_0xab22('0x4e')]==_0xab22('0x61')&&this[_0xab22('0xa')][_0x2bee65[_0xab22('0x25')]][_0x3fe58f][_0xab22('0x49')]){logger['info'](_0xab22('0x84'),_0x2bee65[_0xab22('0x25')],_0x3fe58f);this[_0xab22('0xa')][_0x2bee65[_0xab22('0x25')]][_0x3fe58f]['agentcompleteAt']=moment()[_0xab22('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x2bee65[_0xab22('0x25')],util[_0xab22('0x26')](_[_0xab22('0x85')](this[_0xab22('0xa')][_0x2bee65[_0xab22('0x25')]]),{'showHidden':![],'depth':null}));ami[_0xab22('0x32')]('custom:voiceAgentReport',_[_0xab22('0x85')](this[_0xab22('0xa')][_0x2bee65[_0xab22('0x25')]]));this[_0xab22('0x86')](_0x2bee65[_0xab22('0x25')]);}if(this[_0xab22('0xd')][_0x2bee65[_0xab22('0x25')]]){delete this[_0xab22('0xd')][_0x2bee65[_0xab22('0x25')]];}}}catch(_0x5793f4){logger[_0xab22('0x35')](_0xab22('0x87'),_0x2bee65['uniqueid'],util[_0xab22('0x26')](_0x5793f4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xab22('0x19')]=function(_0x3773bd){try{if(this[_0xab22('0x1e')](_0x3773bd)){logger['debug'](_0xab22('0x88'),_0x3773bd[_0xab22('0x25')],util[_0xab22('0x26')](_0x3773bd,{'showHidden':![],'depth':null}));if(this['channels'][_0x3773bd[_0xab22('0x89')]]){for(var _0x5c566d in this[_0xab22('0xa')][_0x3773bd[_0xab22('0x89')]]){if(this[_0xab22('0xa')][_0x3773bd[_0xab22('0x89')]][_0xab22('0x57')](_0x5c566d)){if(_0x3773bd['origtransfereruniqueid']===_0x5c566d){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3773bd['uniqueid'],this[_0xab22('0xa')][_0x3773bd['transfereeuniqueid']][_0x5c566d][_0xab22('0x21')],_0x5c566d);var _0x22e17f=moment();this['channels'][_0x3773bd['transfereeuniqueid']][_0x5c566d][_0xab22('0x49')]=!![];this[_0xab22('0xa')][_0x3773bd['transfereeuniqueid']][_0x5c566d][_0xab22('0x5f')]=moment()['format'](_0xab22('0x2a'));this[_0xab22('0xa')][_0x3773bd[_0xab22('0x89')]][_0x5c566d][_0xab22('0x3e')]=_0xab22('0x60');this[_0xab22('0xa')][_0x3773bd[_0xab22('0x89')]][_0x5c566d]['reason']=_0xab22('0x61');this[_0xab22('0xa')][_0x3773bd[_0xab22('0x89')]][_0x5c566d][_0xab22('0x63')]=_0x22e17f['diff'](this[_0xab22('0xa')][_0x3773bd['transfereeuniqueid']][_0x5c566d][_0xab22('0x38')],_0xab22('0x8a'));}}}}if(this['channels'][_0x3773bd['secondtransfereruniqueid']]){var _0x21da39=this['channels'][_0x3773bd[_0xab22('0x8b')]];this[_0xab22('0xa')][_0x3773bd[_0xab22('0x8b')]]=this[_0xab22('0xa')][_0x3773bd[_0xab22('0x89')]];this[_0xab22('0xa')][_0x3773bd[_0xab22('0x89')]]=_0x21da39;}}}catch(_0x1f49c5){logger[_0xab22('0x35')](_0xab22('0x8c'),_0x3773bd[_0xab22('0x25')],util[_0xab22('0x26')](_0x1f49c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')][_0xab22('0x1b')]=function(_0xdcb675){try{if(this[_0xab22('0x1e')](_0xdcb675)){logger[_0xab22('0x23')](_0xab22('0x8d'),_0xdcb675[_0xab22('0x25')],util[_0xab22('0x26')](_0xdcb675,{'showHidden':![],'depth':null}));if(this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]]){for(var _0x70e5a0 in this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]]){if(this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0xab22('0x57')](_0x70e5a0)){if(_0xdcb675['transfereruniqueid']===_0x70e5a0){logger[_0xab22('0x1f')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xdcb675[_0xab22('0x25')],this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0x70e5a0]['membername'],_0x70e5a0);var _0x485f61=moment();this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0x70e5a0][_0xab22('0x49')]=!![];this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0x70e5a0][_0xab22('0x5f')]=_0x485f61;this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0x70e5a0][_0xab22('0x3e')]='complete';this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0x70e5a0]['reason']='transfer';this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0x70e5a0][_0xab22('0x63')]=_0x485f61[_0xab22('0x8e')](this[_0xab22('0xa')][_0xdcb675[_0xab22('0x89')]][_0x70e5a0][_0xab22('0x38')],_0xab22('0x8a'));}}}}}}catch(_0x3dc0eb){logger['error'](_0xab22('0x8f'),_0xdcb675['uniqueid'],util[_0xab22('0x26')](_0x3dc0eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')][_0xab22('0x17')]=function(_0x30aa31){var _0x34b3b2='';try{if(this['isNotNull'](_0x30aa31)){logger[_0xab22('0x23')](_0xab22('0x90'),_0x30aa31[_0xab22('0x25')],util[_0xab22('0x26')](_0x30aa31,{'showHidden':![],'depth':null}));if(_0x30aa31[_0xab22('0x91')]){_0x34b3b2=_0x30aa31[_0xab22('0x91')][_0xab22('0x92')](0x0,_0x30aa31['channel'][_0xab22('0x93')]('-'));if(this[_0xab22('0xc')][_0x34b3b2]){logger[_0xab22('0x1f')](_0xab22('0x94'),_0x30aa31['uniqueid'],_0x34b3b2);this[_0xab22('0xc')][_0x34b3b2][_0xab22('0x95')]=!![];}}}}catch(_0xf7f5f2){logger[_0xab22('0x35')]('[%s][voiceAgentReport][musiconholdstart]',_0x30aa31[_0xab22('0x25')],util[_0xab22('0x26')](_0xf7f5f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xab22('0x18')]=function(_0x13dce6){var _0x22c0cf='';try{if(this['isNotNull'](_0x13dce6)){logger[_0xab22('0x23')](_0xab22('0x96'),_0x13dce6[_0xab22('0x25')],util[_0xab22('0x26')](_0x13dce6,{'showHidden':![],'depth':null}));if(_0x13dce6[_0xab22('0x91')]){_0x22c0cf=_0x13dce6[_0xab22('0x91')][_0xab22('0x92')](0x0,_0x13dce6[_0xab22('0x91')]['lastIndexOf']('-'));if(this['agents'][_0x22c0cf]){logger[_0xab22('0x1f')](_0xab22('0x97'),_0x13dce6['uniqueid'],_0x22c0cf);this[_0xab22('0xc')][_0x22c0cf][_0xab22('0x95')]=![];}}}}catch(_0x6cc5f6){logger[_0xab22('0x35')](_0xab22('0x98'),_0x13dce6[_0xab22('0x25')],util[_0xab22('0x26')](_0x6cc5f6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xab22('0x1c')][_0xab22('0x86')]=function(_0x41ed23,_0x38ca3b=0x2710){if(this['channels'][_0x41ed23]){setTimeout(()=>{delete this[_0xab22('0xa')][_0x41ed23];},_0x38ca3b);}};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 da409a3..d8478b7 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 _0xaef4=['ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','error','inspect','prototype','syncNewCallerId','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','isUndefined','pick','keys','from-sip','channel','split','exten','xcally-motion-preview','connectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','context','starttime','disposition','toNumber','destconnectedlinenum','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','lastapplication','lastdata','startsWith','cdr(','match','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','holdtime','diff','connectedlinename','UserId','answered','answertime','destinationchannel','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','emit','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','deleteChannelAfterTimeout','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','transferToInternal','isEmpty','then','stopRecordingOnTransfer','catch','Action','finally','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','transfereecalleridnum','transfereruniqueid','BLIND','BlindTransfer','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xaef4,0x175));var _0x4aef=function(_0x50083f,_0x88b86c){_0x50083f=_0x50083f-0x0;var _0x49d660=_0xaef4[_0x50083f];return _0x49d660;};'use strict';var _=require('lodash');var moment=require(_0x4aef('0x0'));var util=require(_0x4aef('0x1'));var path=require(_0x4aef('0x2'));var Redis=require(_0x4aef('0x3'));var config=require(_0x4aef('0x4'));var logger=require(_0x4aef('0x5'))(_0x4aef('0x6'));var ami=require('../ami');var Channel=require(_0x4aef('0x7'));var RpcSetting=require(_0x4aef('0x8'));var applications=[_0x4aef('0x9'),_0x4aef('0xa'),_0x4aef('0xb'),_0x4aef('0xc'),_0x4aef('0xd'),_0x4aef('0xe')];var dispositions=[_0x4aef('0xf'),_0x4aef('0x10'),_0x4aef('0x10'),_0x4aef('0xf'),'NO\x20ANSWER',_0x4aef('0xf'),_0x4aef('0x11'),_0x4aef('0x12'),_0x4aef('0x10'),_0x4aef('0x10'),_0x4aef('0x10')];config[_0x4aef('0x13')]=_[_0x4aef('0x14')](config['redis'],{'host':_0x4aef('0x15'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x116470){this[_0x4aef('0x16')]=_0x116470[_0x4aef('0x16')];this['agents']=_0x116470[_0x4aef('0x17')];this['blindTransfers']={};ami['on'](_0x4aef('0x18'),this[_0x4aef('0x19')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x1b'),this[_0x4aef('0x19')][_0x4aef('0x1a')](this));ami['on']('newchannel',this[_0x4aef('0x1c')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x1d'),this[_0x4aef('0x1e')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x1f'),this[_0x4aef('0x20')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x21'),this[_0x4aef('0x22')]['bind'](this));ami['on'](_0x4aef('0x23'),this['syncNewCallerId'][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x24'),this[_0x4aef('0x25')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x4aef('0x27'),this[_0x4aef('0x28')][_0x4aef('0x1a')](this));try{logger[_0x4aef('0x29')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x451d9a){logger[_0x4aef('0x2a')]('[voiceCallReport][coreshowchannels]',util[_0x4aef('0x2b')](_0x451d9a,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x444dc7){return _0x444dc7!==null&&!_['isUndefined'](_0x444dc7);};VoiceCallReport['prototype']['emit']=function(_0x2d4662,_0x4e073e,_0x187599){io['to'](_0x2d4662)['emit'](_0x4e073e,_0x187599);};VoiceCallReport[_0x4aef('0x2c')][_0x4aef('0x2d')]=function(_0x4ac9b1){try{if(this[_0x4aef('0x2e')](_0x4ac9b1)){logger[_0x4aef('0x29')](_0x4aef('0x2f'),_0x4ac9b1['uniqueid'],_0x4ac9b1[_0x4aef('0x30')],_0x4ac9b1[_0x4aef('0x31')]);logger[_0x4aef('0x32')](_0x4aef('0x33'),_0x4ac9b1['uniqueid'],util[_0x4aef('0x2b')](_0x4ac9b1,{'showHidden':![],'depth':null}));if(_0x4ac9b1[_0x4aef('0x34')]===_0x4ac9b1[_0x4aef('0x35')]){if(!_[_0x4aef('0x36')](this[_0x4aef('0x16')][_0x4ac9b1[_0x4aef('0x34')]])){_['merge'](this[_0x4aef('0x16')][_0x4ac9b1[_0x4aef('0x34')]],_[_0x4aef('0x37')](_0x4ac9b1,_[_0x4aef('0x38')](this[_0x4aef('0x16')][_0x4ac9b1[_0x4aef('0x34')]])));}}if(_0x4ac9b1['context']===_0x4aef('0x39')){var _0x48a943=this[_0x4aef('0x17')][_0x4ac9b1[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]];if(_0x48a943){if(_0x4ac9b1[_0x4aef('0x3c')]==_0x4aef('0x3d')){_0x48a943['destconnectedlinenum']=_0x4ac9b1[_0x4aef('0x3e')];this['emit'](util[_0x4aef('0x3f')](_0x4aef('0x40'),_0x48a943['name']),_0x4aef('0x41'),{'id':_0x48a943['id'],'destaccountcode':_0x48a943[_0x4aef('0x42')],'destconnectedlinenum':_0x4ac9b1[_0x4aef('0x3e')]});}}}}}catch(_0x9513bb){logger[_0x4aef('0x2a')](_0x4aef('0x43'),_0x4ac9b1[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x9513bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4aef('0x2c')]['syncNewChannel']=function(_0x2fb79e){try{if(this['isNotNull'](_0x2fb79e)){logger[_0x4aef('0x32')](_0x4aef('0x44'),_0x2fb79e[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x2fb79e,{'showHidden':![],'depth':null}));if(this['channels'][_0x2fb79e['uniqueid']]){return;}if(_0x2fb79e[_0x4aef('0x3a')]===_0x4aef('0x45')){return;}if(_0x2fb79e['uniqueid']!==_0x2fb79e[_0x4aef('0x35')]&&!this[_0x4aef('0x46')][_0x2fb79e['linkedid']]){return;}logger[_0x4aef('0x29')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2fb79e[_0x4aef('0x34')],_0x2fb79e[_0x4aef('0x47')],_0x2fb79e[_0x4aef('0x3c')]);this[_0x4aef('0x16')][_0x2fb79e[_0x4aef('0x34')]]=new Channel();this[_0x4aef('0x16')][_0x2fb79e[_0x4aef('0x34')]][_0x4aef('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4aef('0x16')][_0x2fb79e['uniqueid']][_0x4aef('0x49')]=dispositions[_[_0x4aef('0x4a')](_0x2fb79e['channelstate'])];_['merge'](this[_0x4aef('0x16')][_0x2fb79e[_0x4aef('0x34')]],_['pick'](_0x2fb79e,_[_0x4aef('0x38')](this[_0x4aef('0x16')][_0x2fb79e['uniqueid']])));if(_0x2fb79e['context']===_0x4aef('0x39')){var _0x2363a4=this['agents'][_0x2fb79e[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]];if(_0x2363a4&&typeof _0x2363a4[_0x4aef('0x4b')]===_0x4aef('0x4c')){_0x2363a4[_0x4aef('0x4b')]=_0x2fb79e[_0x4aef('0x3c')];logger['debug'](_0x4aef('0x4d'),_0x2fb79e[_0x4aef('0x34')],util[_0x4aef('0x2b')]({'id':_0x2363a4['id'],'destaccountcode':_0x2363a4[_0x4aef('0x42')],'destconnectedlinenum':_0x2fb79e[_0x4aef('0x3c')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x4aef('0x3f')]('user:%s',_0x2363a4[_0x4aef('0x4e')]),_0x4aef('0x41'),{'id':_0x2363a4['id'],'destaccountcode':_0x2363a4[_0x4aef('0x42')],'destconnectedlinenum':_0x2fb79e[_0x4aef('0x3c')]});}}}}catch(_0x5d564c){logger['error'](_0x4aef('0x4f'),_0x2fb79e['uniqueid'],util['inspect'](_0x5d564c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4aef('0x19')]=function(_0x404bea){try{if(this['isNotNull'](_0x404bea)){logger[_0x4aef('0x32')](_0x4aef('0x50'),_0x404bea[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x404bea,{'showHidden':![],'depth':null}));if(_0x404bea[_0x4aef('0x3a')]===_0x4aef('0x45')||_0x404bea[_0x4aef('0x3c')]==='h')return;if(_0x404bea[_0x4aef('0x34')]===_0x404bea[_0x4aef('0x35')]||this['blindTransfers'][_0x404bea[_0x4aef('0x35')]]){_0x404bea[_0x4aef('0x51')]=_0x404bea[_0x4aef('0x51')]?_0x404bea[_0x4aef('0x51')][_0x4aef('0x52')]():undefined;_0x404bea[_0x4aef('0x53')]=_0x404bea[_0x4aef('0x54')]||_0x404bea[_0x4aef('0x53')];if(_0x404bea[_0x4aef('0x54')]&&_0x404bea[_0x4aef('0x51')]!==_0x4aef('0xa')){_0x404bea[_0x4aef('0x53')]=_0x404bea[_0x4aef('0x53')][_0x4aef('0x52')]();}logger[_0x4aef('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x404bea[_0x4aef('0x34')],_0x404bea['application'],_0x404bea['applicationdata']);if(_[_0x4aef('0x36')](this['channels'][_0x404bea[_0x4aef('0x34')]])){this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]]=new Channel();this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x4aef('0x48')]=_0x404bea[_0x4aef('0x55')]?moment()[_0x4aef('0x56')](moment[_0x4aef('0x55')](_0x404bea[_0x4aef('0x55')])[_0x4aef('0x57')](),_0x4aef('0x57'))[_0x4aef('0x3f')](_0x4aef('0x58')):moment()[_0x4aef('0x3f')](_0x4aef('0x58'));this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x4aef('0x49')]=_0x4aef('0xf');}_[_0x4aef('0x59')](this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]],_['pick'](_0x404bea,_[_0x4aef('0x38')](this['channels'][_0x404bea[_0x4aef('0x34')]])));if(_['includes'](applications,_0x404bea[_0x4aef('0x51')])){this['channels'][_0x404bea['uniqueid']][_0x4aef('0x5a')]=_0x404bea[_0x4aef('0x51')];this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x4aef('0x5b')]=_0x404bea['applicationdata'];if(_0x404bea[_0x4aef('0x51')]===_0x4aef('0x9')&&_[_0x4aef('0x5c')](_0x404bea[_0x4aef('0x53')][_0x4aef('0x52')](),_0x4aef('0x5d'))){var _0x4c0084=_0x404bea['applicationdata'][_0x4aef('0x3b')]('=');var _0x993eea=_0x4c0084[0x0][_0x4aef('0x52')]()[_0x4aef('0x5e')](/cdr\((.*)\)/);if(_0x993eea){if(_0x993eea[0x1]==='type'&&!_[_0x4aef('0x5f')](this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x993eea[0x1]]))return;this['channels'][_0x404bea[_0x4aef('0x34')]][_0x993eea[0x1]]=_0x4c0084[0x1];}}else if(_0x404bea[_0x4aef('0x51')]===_0x4aef('0xa')){this[_0x4aef('0x16')][_0x404bea['uniqueid']][_0x4aef('0xa')]=_0x404bea[_0x4aef('0x53')]['split'](',')[0x0];}}}}}catch(_0x459bd5){logger['error'](_0x4aef('0x60'),_0x404bea[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x459bd5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4aef('0x1e')]=function(_0x17e7d6){try{if(this[_0x4aef('0x2e')](_0x17e7d6)){logger['info'](_0x4aef('0x61'),_0x17e7d6[_0x4aef('0x34')],_0x17e7d6[_0x4aef('0x35')],_0x17e7d6['calleridname'],_0x17e7d6[_0x4aef('0x31')]);logger[_0x4aef('0x32')](_0x4aef('0x62'),_0x17e7d6[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x17e7d6,{'showHidden':![],'depth':null}));if(_0x17e7d6[_0x4aef('0x63')]!=='6')return;var _0x307c54=this[_0x4aef('0x17')][_0x17e7d6[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]];if(_0x17e7d6['uniqueid']!==_0x17e7d6[_0x4aef('0x35')]){var _0xe00502=moment();if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]){if(!this[_0x4aef('0x16')][_0x17e7d6['linkedid']]['answered']){this['channels'][_0x17e7d6[_0x4aef('0x35')]]['answered']=!![];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['answertime']=_0xe00502[_0x4aef('0x3f')](_0x4aef('0x58'));if(this['channels'][_0x17e7d6['linkedid']][_0x4aef('0x48')]){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x64')]=_0xe00502[_0x4aef('0x65')](this['channels'][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x48')],_0x4aef('0x57'));}}this['channels'][_0x17e7d6['linkedid']][_0x4aef('0x35')]=_0x17e7d6[_0x4aef('0x34')];if(_0x17e7d6['calleridnum']!==_0x4aef('0x3d')){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x3e')]=_0x17e7d6[_0x4aef('0x31')];}this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x66')]=_0x17e7d6[_0x4aef('0x30')];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['destinationchannel']=_0x17e7d6[_0x4aef('0x3a')];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x49')]=dispositions[_[_0x4aef('0x4a')](_0x17e7d6[_0x4aef('0x63')])];if(_0x307c54){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x67')]=_0x307c54['id'];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['membername']=_0x307c54[_0x4aef('0x4e')];}}if(this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]){if(!this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x68')]){this['channels'][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x68')]=!![];this[_0x4aef('0x16')][_0x17e7d6['uniqueid']][_0x4aef('0x69')]=_0xe00502[_0x4aef('0x3f')](_0x4aef('0x58'));if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x48')]){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x64')]=_0xe00502[_0x4aef('0x65')](this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x48')],_0x4aef('0x57'));}}if(_0x17e7d6['calleridnum']!==_0x4aef('0x3d')){this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]['connectedlinenum']=_0x17e7d6[_0x4aef('0x31')];}this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x66')]=_0x17e7d6[_0x4aef('0x30')];this[_0x4aef('0x16')][_0x17e7d6['uniqueid']][_0x4aef('0x6a')]=_0x17e7d6[_0x4aef('0x3a')];this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]['disposition']=dispositions[_[_0x4aef('0x4a')](_0x17e7d6['channelstate'])];}}else{if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]]){if(_0x307c54){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x67')]=_0x307c54['id'];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x6b')]=_0x307c54[_0x4aef('0x4e')];}}}if(_0x17e7d6[_0x4aef('0x47')]===_0x4aef('0x39')){if(_0x307c54){_0x307c54[_0x4aef('0x4b')]=_0x17e7d6[_0x4aef('0x3c')];var _0x15c2b8;if(this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]){_0x15c2b8=this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]['queue'];}else if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]){_0x15c2b8=this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['queue'];}_0x307c54[_0x4aef('0xa')]=_0x15c2b8;var _0x304a5f={'id':_0x307c54['id'],'name':_0x307c54[_0x4aef('0x4e')],'agentconnected':!![],'destaccountcode':_0x307c54[_0x4aef('0x42')],'destconnectedlinenum':_0x17e7d6[_0x4aef('0x3c')],'queue':_0x15c2b8||undefined,'uniqueid':_0x17e7d6[_0x4aef('0x35')]};logger['debug'](_0x4aef('0x6c'),_0x17e7d6[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x304a5f,{'showHidden':![],'depth':null}));this[_0x4aef('0x6d')](util[_0x4aef('0x3f')](_0x4aef('0x40'),_0x307c54[_0x4aef('0x4e')]),_0x4aef('0x41'),_0x304a5f);}}}}catch(_0x250f97){logger[_0x4aef('0x2a')](_0x4aef('0x6e'),_0x17e7d6[_0x4aef('0x34')],util['inspect'](_0x250f97,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4aef('0x2c')]['syncMixMonitorFilename']=function(_0x3d7d1c,_0xeba0c7){try{if(this[_0x4aef('0x16')][_0x3d7d1c]){logger[_0x4aef('0x29')](_0x4aef('0x6f'),_0x3d7d1c,_0xeba0c7);this[_0x4aef('0x16')][_0x3d7d1c][_0x4aef('0x70')]=!![];if(_[_0x4aef('0x71')](_0xeba0c7,_0x4aef('0x72'))){_0xeba0c7=_0xeba0c7['replace']('.wav49',_0x4aef('0x73'));}this[_0x4aef('0x16')][_0x3d7d1c][_0x4aef('0x74')]=_0xeba0c7;var _0x41f005=_[_0x4aef('0x75')](this['channels'][_0x3d7d1c][_0x4aef('0x76')],{'filename':_0xeba0c7});if(_['isNil'](_0x41f005)){this[_0x4aef('0x16')][_0x3d7d1c]['monitors']['push']({'filename':_0xeba0c7,'createdAt':moment()['format'](_0x4aef('0x58')),'mixmonitorid':'','status':'rec'});}}}catch(_0x43f17c){logger[_0x4aef('0x2a')]('[%s][voiceCallReport][mixMonitorFilename]',_0x3d7d1c,util[_0x4aef('0x2b')](_0x43f17c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4aef('0x2c')][_0x4aef('0x20')]=function(_0x550f06){try{if(this['isNotNull'](_0x550f06)){logger[_0x4aef('0x32')](_0x4aef('0x77'),_0x550f06['uniqueid'],util['inspect'](_0x550f06,{'showHidden':![],'depth':null}));if(this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]]&&_0x550f06['channel']!=_0x4aef('0x45')){if(this[_0x4aef('0x2e')](_0x550f06['variable'])){if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x79')])){logger[_0x4aef('0x29')](_0x4aef('0x7a'),_0x550f06['uniqueid'],_0x550f06['value']);this[_0x4aef('0x7b')](_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x7d')])){logger[_0x4aef('0x29')](_0x4aef('0x7e'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x31')]=_0x550f06['value'];}else if(this['isNotNull'](_0x550f06[_0x4aef('0x78')][_0x4aef('0x7f')])){logger[_0x4aef('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x80')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06['variable'][_0x4aef('0x81')])){logger[_0x4aef('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x82')]=_0x550f06[_0x4aef('0x7c')];}else if(this['isNotNull'](_0x550f06[_0x4aef('0x78')]['xmd-queue'])){logger[_0x4aef('0x29')](_0x4aef('0x83'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')][_0x4aef('0x3b')](',')[0x0]);this[_0x4aef('0x16')][_0x550f06['uniqueid']]['queue']=_0x550f06[_0x4aef('0x7c')][_0x4aef('0x3b')](',')[0x0];}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x550f06['uniqueid'],_0x550f06[_0x4aef('0x7c')]);this['channels'][_0x550f06['uniqueid']][_0x4aef('0x85')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06['variable'][_0x4aef('0x86')])){logger[_0x4aef('0x29')](_0x4aef('0x87'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x88')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06['variable'][_0x4aef('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x8a')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x8b')])){logger[_0x4aef('0x29')](_0x4aef('0x8c'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]]['queue']=_0x550f06[_0x4aef('0x7c')];}else if(this['isNotNull'](_0x550f06[_0x4aef('0x78')][_0x4aef('0x8d')])){logger[_0x4aef('0x29')](_0x4aef('0x8e'),_0x550f06['uniqueid'],_0x550f06['value']);this['channels'][_0x550f06[_0x4aef('0x34')]]['sipcalluniqueid']=_0x550f06['value'];}}}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x79')])){if(_0x550f06['value']){var _0x3a3f82=path['parse'](_0x550f06[_0x4aef('0x7c')])[_0x4aef('0x4e')];logger[_0x4aef('0x29')](_0x4aef('0x7a'),_0x3a3f82,_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x7b')](_0x3a3f82,_0x550f06[_0x4aef('0x7c')]);}}else if(this[_0x4aef('0x16')][_0x550f06['linkedid']]){if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')])){if(this['isNotNull'](_0x550f06[_0x4aef('0x78')][_0x4aef('0x8d')])){logger[_0x4aef('0x29')](_0x4aef('0x8e'),_0x550f06['linkedid'],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x35')]][_0x4aef('0x8f')]=_0x550f06[_0x4aef('0x7c')];}}}}}catch(_0x551bd0){logger[_0x4aef('0x2a')]('[%s][voiceCallReport][varset]',_0x550f06[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x551bd0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x8169c4){try{if(this[_0x4aef('0x2e')](_0x8169c4)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x8169c4['uniqueid'],util[_0x4aef('0x2b')](_0x8169c4,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x8169c4[_0x4aef('0x35')]]){if(this['channels'][this['blindTransfers'][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]]){this['channels'][this['blindTransfers'][_0x8169c4['linkedid']][_0x4aef('0x35')]][_0x4aef('0x34')]=_0x8169c4['uniqueid'];this['channels'][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]][_0x4aef('0x68')]=this[_0x4aef('0x16')][_0x8169c4['uniqueid']]['answered'];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]][_0x4aef('0x69')]=this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x69')];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['linkedid']][_0x4aef('0x6a')]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['linkedid']][_0x4aef('0x3a')];this['channels'][this[_0x4aef('0x46')][_0x8169c4['linkedid']][_0x4aef('0x35')]][_0x4aef('0x49')]=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x49')];this[_0x4aef('0x16')][_0x8169c4['uniqueid']]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]];this[_0x4aef('0x90')](this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]);}else if(this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]){this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['uniqueid']=[this[_0x4aef('0x16')][this['blindTransfers'][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['linkedid'],this['channels'][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]][_0x4aef('0x35')]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]][_0x4aef('0x34')]][0x0];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['uniqueid']][_0x4aef('0x68')]=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x68')];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4['linkedid']][_0x4aef('0x34')]][_0x4aef('0x69')]=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x69')];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['uniqueid']]['destinationchannel']=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['channel'];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['disposition']=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x49')];this[_0x4aef('0x16')][_0x8169c4['uniqueid']]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]);}}if(this[_0x4aef('0x16')][_0x8169c4['uniqueid']]){logger[_0x4aef('0x29')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x8169c4[_0x4aef('0x34')],_0x8169c4[_0x4aef('0x91')]);var _0x217e62=moment();this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x92')]=_0x217e62['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4aef('0x16')][_0x8169c4['uniqueid']][_0x4aef('0x55')]=_0x217e62[_0x4aef('0x65')](this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x48')],_0x4aef('0x57'));if(this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x68')]){this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x93')]=_0x217e62[_0x4aef('0x65')](this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x69')],_0x4aef('0x57'));this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x64')]=this['channels'][_0x8169c4['uniqueid']]['duration']-this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x93')];}if(_0x8169c4[_0x4aef('0x47')]===_0x4aef('0x39')){if(this[_0x4aef('0x17')][_0x8169c4['channel'][_0x4aef('0x3b')]('-')[0x0]]){this['agents'][_0x8169c4['channel']['split']('-')[0x0]]=_[_0x4aef('0x94')](this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')]['split']('-')[0x0]],[_0x4aef('0x4b')]);logger['debug'](_0x4aef('0x95'),_0x8169c4['uniqueid'],util[_0x4aef('0x2b')]({'id':this['agents'][_0x8169c4[_0x4aef('0x3a')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]][_0x4aef('0x42')]},{'showHidden':![],'depth':null}));this[_0x4aef('0x6d')](util['format'](_0x4aef('0x40'),this[_0x4aef('0x17')][_0x8169c4['channel'][_0x4aef('0x3b')]('-')[0x0]][_0x4aef('0x4e')]),_0x4aef('0x96'),{'id':this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]][_0x4aef('0x42')]});for(var _0x30745d=0x0;_0x30745d{delete this[_0x4aef('0x16')][_0x318a9e];},_0x211361);}};module[_0x4aef('0xc2')]=VoiceCallReport; \ No newline at end of file +var _0x9b9b=['parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','undefined','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transferType','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]','util','ioredis','../../../config/logger','../ami','../model/channel','../rpc/setting','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','bind','syncNewExten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','keys','context','channel','exten','destconnectedlinenum','format','user:%s','name','user:agentconnect','connectedlinenum','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','channelstate','from-sip','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','info','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','disposition','includes','lastdata','set','startsWith','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','toNumber','membername','xcally-motion-preview','calleridname','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid'];(function(_0x10ca6b,_0x4a501b){var _0x5186d1=function(_0x2d8518){while(--_0x2d8518){_0x10ca6b['push'](_0x10ca6b['shift']());}};_0x5186d1(++_0x4a501b);}(_0x9b9b,0xf3));var _0xb9b9=function(_0x20049b,_0x369c8b){_0x20049b=_0x20049b-0x0;var _0x35cc83=_0x9b9b[_0x20049b];return _0x35cc83;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xb9b9('0x0'));var path=require('path');var Redis=require(_0xb9b9('0x1'));var config=require('../../../config/environment');var logger=require(_0xb9b9('0x2'))('ami');var ami=require(_0xb9b9('0x3'));var Channel=require(_0xb9b9('0x4'));var RpcSetting=require(_0xb9b9('0x5'));var applications=['set',_0xb9b9('0x6'),_0xb9b9('0x7'),_0xb9b9('0x8'),_0xb9b9('0x9'),_0xb9b9('0xa')];var dispositions=[_0xb9b9('0xb'),_0xb9b9('0xc'),'FAILED',_0xb9b9('0xb'),_0xb9b9('0xb'),_0xb9b9('0xb'),_0xb9b9('0xd'),_0xb9b9('0xe'),_0xb9b9('0xc'),_0xb9b9('0xc'),_0xb9b9('0xc')];config['redis']=_[_0xb9b9('0xf')](config[_0xb9b9('0x10')],{'host':_0xb9b9('0x11'),'port':0x18eb});var io=require(_0xb9b9('0x12'))(new Redis(config[_0xb9b9('0x10')]));function VoiceCallReport(_0x4faa46){this[_0xb9b9('0x13')]=_0x4faa46[_0xb9b9('0x13')];this[_0xb9b9('0x14')]=_0x4faa46[_0xb9b9('0x14')];this[_0xb9b9('0x15')]={};ami['on'](_0xb9b9('0x16'),this['syncNewExten'][_0xb9b9('0x17')](this));ami['on']('newexten',this[_0xb9b9('0x18')][_0xb9b9('0x17')](this));ami['on'](_0xb9b9('0x19'),this[_0xb9b9('0x1a')][_0xb9b9('0x17')](this));ami['on']('newstate',this[_0xb9b9('0x1b')][_0xb9b9('0x17')](this));ami['on'](_0xb9b9('0x1c'),this[_0xb9b9('0x1d')][_0xb9b9('0x17')](this));ami['on'](_0xb9b9('0x1e'),this[_0xb9b9('0x1f')][_0xb9b9('0x17')](this));ami['on']('newcallerid',this[_0xb9b9('0x20')][_0xb9b9('0x17')](this));ami['on']('attendedtransfer',this[_0xb9b9('0x21')][_0xb9b9('0x17')](this));ami['on'](_0xb9b9('0x22'),this[_0xb9b9('0x23')][_0xb9b9('0x17')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xb9b9('0x17')](this));ami['on'](_0xb9b9('0x24'),this[_0xb9b9('0x25')][_0xb9b9('0x17')](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami[_0xb9b9('0x26')]();}catch(_0x5dd234){logger[_0xb9b9('0x27')](_0xb9b9('0x28'),util[_0xb9b9('0x29')](_0x5dd234,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xb9b9('0x2a')]=function(_0x2f9b8e){return _0x2f9b8e!==null&&!_[_0xb9b9('0x2b')](_0x2f9b8e);};VoiceCallReport[_0xb9b9('0x2c')][_0xb9b9('0x2d')]=function(_0x4beb7d,_0x52b437,_0x2bee12){io['to'](_0x4beb7d)[_0xb9b9('0x2d')](_0x52b437,_0x2bee12);};VoiceCallReport['prototype'][_0xb9b9('0x20')]=function(_0x142151){try{if(this[_0xb9b9('0x2a')](_0x142151)){logger['info'](_0xb9b9('0x2e'),_0x142151[_0xb9b9('0x2f')],_0x142151['calleridname'],_0x142151[_0xb9b9('0x30')]);logger[_0xb9b9('0x31')](_0xb9b9('0x32'),_0x142151[_0xb9b9('0x2f')],util[_0xb9b9('0x29')](_0x142151,{'showHidden':![],'depth':null}));if(_0x142151[_0xb9b9('0x2f')]===_0x142151['linkedid']){if(!_['isUndefined'](this[_0xb9b9('0x13')][_0x142151[_0xb9b9('0x2f')]])){_[_0xb9b9('0x33')](this['channels'][_0x142151[_0xb9b9('0x2f')]],_[_0xb9b9('0x34')](_0x142151,_[_0xb9b9('0x35')](this['channels'][_0x142151[_0xb9b9('0x2f')]])));}}if(_0x142151[_0xb9b9('0x36')]==='from-sip'){var _0x3c9a2b=this[_0xb9b9('0x14')][_0x142151[_0xb9b9('0x37')]['split']('-')[0x0]];if(_0x3c9a2b){if(_0x142151[_0xb9b9('0x38')]=='xcally-motion-preview'){_0x3c9a2b[_0xb9b9('0x39')]=_0x142151['connectedlinenum'];this['emit'](util[_0xb9b9('0x3a')](_0xb9b9('0x3b'),_0x3c9a2b[_0xb9b9('0x3c')]),_0xb9b9('0x3d'),{'id':_0x3c9a2b['id'],'destaccountcode':_0x3c9a2b['accountcode'],'destconnectedlinenum':_0x142151[_0xb9b9('0x3e')]});}}}}}catch(_0xe9cb43){logger[_0xb9b9('0x27')](_0xb9b9('0x3f'),_0x142151[_0xb9b9('0x2f')],util[_0xb9b9('0x29')](_0xe9cb43,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb9b9('0x2c')]['syncNewChannel']=function(_0x4110d4){try{if(this[_0xb9b9('0x2a')](_0x4110d4)){logger[_0xb9b9('0x31')](_0xb9b9('0x40'),_0x4110d4['uniqueid'],util[_0xb9b9('0x29')](_0x4110d4,{'showHidden':![],'depth':null}));if(this[_0xb9b9('0x13')][_0x4110d4[_0xb9b9('0x2f')]]){return;}if(_0x4110d4['channel']===_0xb9b9('0x41')){return;}if(_0x4110d4[_0xb9b9('0x2f')]!==_0x4110d4[_0xb9b9('0x42')]&&!this[_0xb9b9('0x15')][_0x4110d4[_0xb9b9('0x42')]]){return;}logger['info'](_0xb9b9('0x43'),_0x4110d4[_0xb9b9('0x2f')],_0x4110d4['context'],_0x4110d4['exten']);this[_0xb9b9('0x13')][_0x4110d4[_0xb9b9('0x2f')]]=new Channel();this[_0xb9b9('0x13')][_0x4110d4[_0xb9b9('0x2f')]][_0xb9b9('0x44')]=moment()[_0xb9b9('0x3a')](_0xb9b9('0x45'));this['channels'][_0x4110d4['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x4110d4[_0xb9b9('0x46')])];_[_0xb9b9('0x33')](this[_0xb9b9('0x13')][_0x4110d4[_0xb9b9('0x2f')]],_[_0xb9b9('0x34')](_0x4110d4,_['keys'](this[_0xb9b9('0x13')][_0x4110d4['uniqueid']])));if(_0x4110d4[_0xb9b9('0x36')]===_0xb9b9('0x47')){var _0x4cda08=this[_0xb9b9('0x14')][_0x4110d4[_0xb9b9('0x37')][_0xb9b9('0x48')]('-')[0x0]];if(_0x4cda08&&typeof _0x4cda08[_0xb9b9('0x39')]==='undefined'){_0x4cda08[_0xb9b9('0x39')]=_0x4110d4[_0xb9b9('0x38')];logger['debug'](_0xb9b9('0x49'),_0x4110d4[_0xb9b9('0x2f')],util[_0xb9b9('0x29')]({'id':_0x4cda08['id'],'destaccountcode':_0x4cda08['accountcode'],'destconnectedlinenum':_0x4110d4[_0xb9b9('0x38')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xb9b9('0x3a')](_0xb9b9('0x3b'),_0x4cda08[_0xb9b9('0x3c')]),_0xb9b9('0x3d'),{'id':_0x4cda08['id'],'destaccountcode':_0x4cda08[_0xb9b9('0x4a')],'destconnectedlinenum':_0x4110d4[_0xb9b9('0x38')]});}}}}catch(_0x494c4b){logger[_0xb9b9('0x27')](_0xb9b9('0x4b'),_0x4110d4[_0xb9b9('0x2f')],util[_0xb9b9('0x29')](_0x494c4b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb9b9('0x2c')]['syncNewExten']=function(_0x3ec867){try{if(this[_0xb9b9('0x2a')](_0x3ec867)){logger[_0xb9b9('0x31')](_0xb9b9('0x4c'),_0x3ec867[_0xb9b9('0x2f')],util['inspect'](_0x3ec867,{'showHidden':![],'depth':null}));if(_0x3ec867['channel']===_0xb9b9('0x41')||_0x3ec867['exten']==='h')return;if(_0x3ec867[_0xb9b9('0x2f')]===_0x3ec867[_0xb9b9('0x42')]||this[_0xb9b9('0x15')][_0x3ec867[_0xb9b9('0x42')]]){_0x3ec867[_0xb9b9('0x4d')]=_0x3ec867[_0xb9b9('0x4d')]?_0x3ec867[_0xb9b9('0x4d')][_0xb9b9('0x4e')]():undefined;_0x3ec867['applicationdata']=_0x3ec867[_0xb9b9('0x4f')]||_0x3ec867[_0xb9b9('0x50')];if(_0x3ec867['appdata']&&_0x3ec867[_0xb9b9('0x4d')]!==_0xb9b9('0x6')){_0x3ec867[_0xb9b9('0x50')]=_0x3ec867['applicationdata'][_0xb9b9('0x4e')]();}logger[_0xb9b9('0x51')](_0xb9b9('0x52'),_0x3ec867[_0xb9b9('0x2f')],_0x3ec867[_0xb9b9('0x4d')],_0x3ec867[_0xb9b9('0x50')]);if(_[_0xb9b9('0x2b')](this[_0xb9b9('0x13')][_0x3ec867[_0xb9b9('0x2f')]])){this[_0xb9b9('0x13')][_0x3ec867[_0xb9b9('0x2f')]]=new Channel();this[_0xb9b9('0x13')][_0x3ec867[_0xb9b9('0x2f')]][_0xb9b9('0x44')]=_0x3ec867['duration']?moment()[_0xb9b9('0x53')](moment[_0xb9b9('0x54')](_0x3ec867[_0xb9b9('0x54')])[_0xb9b9('0x55')](),_0xb9b9('0x55'))[_0xb9b9('0x3a')](_0xb9b9('0x45')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb9b9('0x13')][_0x3ec867[_0xb9b9('0x2f')]][_0xb9b9('0x56')]=_0xb9b9('0xb');}_[_0xb9b9('0x33')](this['channels'][_0x3ec867['uniqueid']],_[_0xb9b9('0x34')](_0x3ec867,_[_0xb9b9('0x35')](this[_0xb9b9('0x13')][_0x3ec867[_0xb9b9('0x2f')]])));if(_[_0xb9b9('0x57')](applications,_0x3ec867[_0xb9b9('0x4d')])){this[_0xb9b9('0x13')][_0x3ec867[_0xb9b9('0x2f')]]['lastapplication']=_0x3ec867['application'];this['channels'][_0x3ec867[_0xb9b9('0x2f')]][_0xb9b9('0x58')]=_0x3ec867[_0xb9b9('0x50')];if(_0x3ec867[_0xb9b9('0x4d')]===_0xb9b9('0x59')&&_[_0xb9b9('0x5a')](_0x3ec867['applicationdata'][_0xb9b9('0x4e')](),_0xb9b9('0x5b'))){var _0x410b91=_0x3ec867['applicationdata']['split']('=');var _0x1cc998=_0x410b91[0x0][_0xb9b9('0x4e')]()['match'](/cdr\((.*)\)/);if(_0x1cc998){if(_0x1cc998[0x1]===_0xb9b9('0x5c')&&!_[_0xb9b9('0x5d')](this[_0xb9b9('0x13')][_0x3ec867[_0xb9b9('0x2f')]][_0x1cc998[0x1]]))return;this['channels'][_0x3ec867[_0xb9b9('0x2f')]][_0x1cc998[0x1]]=_0x410b91[0x1];}}else if(_0x3ec867[_0xb9b9('0x4d')]==='queue'){this['channels'][_0x3ec867[_0xb9b9('0x2f')]][_0xb9b9('0x6')]=_0x3ec867['applicationdata'][_0xb9b9('0x48')](',')[0x0];}}}}}catch(_0x1c9928){logger['error'](_0xb9b9('0x5e'),_0x3ec867[_0xb9b9('0x2f')],util[_0xb9b9('0x29')](_0x1c9928,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb9b9('0x2c')]['syncNewState']=function(_0x5bb330){try{if(this[_0xb9b9('0x2a')](_0x5bb330)){logger[_0xb9b9('0x51')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x5bb330[_0xb9b9('0x2f')],_0x5bb330['linkedid'],_0x5bb330['calleridname'],_0x5bb330['calleridnum']);logger[_0xb9b9('0x31')](_0xb9b9('0x5f'),_0x5bb330[_0xb9b9('0x2f')],util['inspect'](_0x5bb330,{'showHidden':![],'depth':null}));if(_0x5bb330[_0xb9b9('0x46')]!=='6')return;var _0x5c496c=this[_0xb9b9('0x14')][_0x5bb330['channel'][_0xb9b9('0x48')]('-')[0x0]];if(_0x5bb330[_0xb9b9('0x2f')]!==_0x5bb330[_0xb9b9('0x42')]){var _0x1d7453=moment();if(this[_0xb9b9('0x13')][_0x5bb330['linkedid']]){if(!this['channels'][_0x5bb330[_0xb9b9('0x42')]][_0xb9b9('0x60')]){this['channels'][_0x5bb330[_0xb9b9('0x42')]]['answered']=!![];this[_0xb9b9('0x13')][_0x5bb330['linkedid']][_0xb9b9('0x61')]=_0x1d7453[_0xb9b9('0x3a')](_0xb9b9('0x45'));if(this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x42')]][_0xb9b9('0x44')]){this['channels'][_0x5bb330[_0xb9b9('0x42')]][_0xb9b9('0x62')]=_0x1d7453[_0xb9b9('0x63')](this[_0xb9b9('0x13')][_0x5bb330['linkedid']][_0xb9b9('0x44')],_0xb9b9('0x55'));}}this[_0xb9b9('0x13')][_0x5bb330['linkedid']][_0xb9b9('0x42')]=_0x5bb330[_0xb9b9('0x2f')];if(_0x5bb330[_0xb9b9('0x30')]!=='xcally-motion-preview'){this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x42')]][_0xb9b9('0x3e')]=_0x5bb330[_0xb9b9('0x30')];}this['channels'][_0x5bb330['linkedid']][_0xb9b9('0x64')]=_0x5bb330['calleridname'];this[_0xb9b9('0x13')][_0x5bb330['linkedid']][_0xb9b9('0x65')]=_0x5bb330[_0xb9b9('0x37')];this[_0xb9b9('0x13')][_0x5bb330['linkedid']]['disposition']=dispositions[_[_0xb9b9('0x66')](_0x5bb330[_0xb9b9('0x46')])];if(_0x5c496c){this[_0xb9b9('0x13')][_0x5bb330['linkedid']]['UserId']=_0x5c496c['id'];this['channels'][_0x5bb330['linkedid']][_0xb9b9('0x67')]=_0x5c496c[_0xb9b9('0x3c')];}}if(this['channels'][_0x5bb330[_0xb9b9('0x2f')]]){if(!this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x60')]){this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x60')]=!![];this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x61')]=_0x1d7453[_0xb9b9('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x44')]){this['channels'][_0x5bb330['uniqueid']][_0xb9b9('0x62')]=_0x1d7453['diff'](this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]]['starttime'],_0xb9b9('0x55'));}}if(_0x5bb330[_0xb9b9('0x30')]!==_0xb9b9('0x68')){this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x3e')]=_0x5bb330['calleridnum'];}this[_0xb9b9('0x13')][_0x5bb330['uniqueid']][_0xb9b9('0x64')]=_0x5bb330[_0xb9b9('0x69')];this[_0xb9b9('0x13')][_0x5bb330['uniqueid']][_0xb9b9('0x65')]=_0x5bb330[_0xb9b9('0x37')];this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x56')]=dispositions[_['toNumber'](_0x5bb330['channelstate'])];}}else{if(this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]]){if(_0x5c496c){this['channels'][_0x5bb330[_0xb9b9('0x2f')]]['UserId']=_0x5c496c['id'];this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x67')]=_0x5c496c[_0xb9b9('0x3c')];}}}if(_0x5bb330[_0xb9b9('0x36')]===_0xb9b9('0x47')){if(_0x5c496c){_0x5c496c[_0xb9b9('0x39')]=_0x5bb330[_0xb9b9('0x38')];var _0x11c1c7;if(this['channels'][_0x5bb330[_0xb9b9('0x2f')]]){_0x11c1c7=this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x2f')]][_0xb9b9('0x6')];}else if(this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x42')]]){_0x11c1c7=this[_0xb9b9('0x13')][_0x5bb330[_0xb9b9('0x42')]][_0xb9b9('0x6')];}_0x5c496c[_0xb9b9('0x6')]=_0x11c1c7;var _0x20aec3={'id':_0x5c496c['id'],'name':_0x5c496c['name'],'agentconnected':!![],'destaccountcode':_0x5c496c[_0xb9b9('0x4a')],'destconnectedlinenum':_0x5bb330[_0xb9b9('0x38')],'queue':_0x11c1c7||undefined,'uniqueid':_0x5bb330[_0xb9b9('0x42')]};logger['debug'](_0xb9b9('0x6a'),_0x5bb330[_0xb9b9('0x2f')],util['inspect'](_0x20aec3,{'showHidden':![],'depth':null}));this[_0xb9b9('0x2d')](util[_0xb9b9('0x3a')]('user:%s',_0x5c496c[_0xb9b9('0x3c')]),_0xb9b9('0x3d'),_0x20aec3);}}}}catch(_0x610bbf){logger[_0xb9b9('0x27')](_0xb9b9('0x6b'),_0x5bb330['uniqueid'],util[_0xb9b9('0x29')](_0x610bbf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb9b9('0x2c')][_0xb9b9('0x6c')]=function(_0x1179f4,_0x285c68){try{if(this['channels'][_0x1179f4]){logger[_0xb9b9('0x51')](_0xb9b9('0x6d'),_0x1179f4,_0x285c68);this[_0xb9b9('0x13')][_0x1179f4][_0xb9b9('0x6e')]=!![];if(_[_0xb9b9('0x6f')](_0x285c68,_0xb9b9('0x70'))){_0x285c68=_0x285c68[_0xb9b9('0x71')](_0xb9b9('0x70'),_0xb9b9('0x72'));}this[_0xb9b9('0x13')][_0x1179f4][_0xb9b9('0x73')]=_0x285c68;var _0x267c31=_['find'](this[_0xb9b9('0x13')][_0x1179f4]['monitors'],{'filename':_0x285c68});if(_[_0xb9b9('0x5d')](_0x267c31)){this[_0xb9b9('0x13')][_0x1179f4]['monitors'][_0xb9b9('0x74')]({'filename':_0x285c68,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xb9b9('0x75')});}}}catch(_0x19819a){logger[_0xb9b9('0x27')](_0xb9b9('0x76'),_0x1179f4,util[_0xb9b9('0x29')](_0x19819a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb9b9('0x2c')][_0xb9b9('0x1d')]=function(_0x12594f){try{if(this[_0xb9b9('0x2a')](_0x12594f)){logger[_0xb9b9('0x31')](_0xb9b9('0x77'),_0x12594f[_0xb9b9('0x2f')],util[_0xb9b9('0x29')](_0x12594f,{'showHidden':![],'depth':null}));if(this[_0xb9b9('0x13')][_0x12594f['uniqueid']]&&_0x12594f[_0xb9b9('0x37')]!=_0xb9b9('0x41')){if(this['isNotNull'](_0x12594f[_0xb9b9('0x78')])){if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')][_0xb9b9('0x79')])){logger[_0xb9b9('0x51')](_0xb9b9('0x7a'),_0x12594f[_0xb9b9('0x2f')],_0x12594f[_0xb9b9('0x7b')]);this['syncMixMonitorFilename'](_0x12594f[_0xb9b9('0x2f')],_0x12594f[_0xb9b9('0x7b')]);}else if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')]['xmd-phone'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x12594f['uniqueid'],_0x12594f['value']);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x2f')]][_0xb9b9('0x30')]=_0x12594f['value'];}else if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')][_0xb9b9('0x7c')])){logger['info'](_0xb9b9('0x7d'),_0x12594f['uniqueid'],_0x12594f[_0xb9b9('0x7b')]);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x2f')]][_0xb9b9('0x7e')]=_0x12594f[_0xb9b9('0x7b')];}else if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')]['xmd-cdrtype'])){logger[_0xb9b9('0x51')](_0xb9b9('0x7f'),_0x12594f['uniqueid'],_0x12594f[_0xb9b9('0x7b')]);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x2f')]][_0xb9b9('0x5c')]=_0x12594f[_0xb9b9('0x7b')];}else if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')][_0xb9b9('0x80')])){logger[_0xb9b9('0x51')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x12594f[_0xb9b9('0x2f')],_0x12594f[_0xb9b9('0x7b')][_0xb9b9('0x48')](',')[0x0]);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x2f')]][_0xb9b9('0x6')]=_0x12594f[_0xb9b9('0x7b')][_0xb9b9('0x48')](',')[0x0];}else if(this['isNotNull'](_0x12594f[_0xb9b9('0x78')][_0xb9b9('0x81')])){logger[_0xb9b9('0x51')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x12594f['uniqueid'],_0x12594f['value']);this['channels'][_0x12594f['uniqueid']][_0xb9b9('0x82')]=_0x12594f[_0xb9b9('0x7b')];}else if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')]['xmd-destination'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x12594f[_0xb9b9('0x2f')],_0x12594f[_0xb9b9('0x7b')]);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x2f')]]['destination']=_0x12594f['value'];}else if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')][_0xb9b9('0x83')])){logger['info'](_0xb9b9('0x84'),_0x12594f[_0xb9b9('0x2f')],_0x12594f[_0xb9b9('0x7b')]);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x2f')]][_0xb9b9('0x85')]=_0x12594f[_0xb9b9('0x7b')];}else if(this['isNotNull'](_0x12594f['variable']['xmcs-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x12594f[_0xb9b9('0x2f')],_0x12594f[_0xb9b9('0x7b')]);this[_0xb9b9('0x13')][_0x12594f['uniqueid']][_0xb9b9('0x6')]=_0x12594f[_0xb9b9('0x7b')];}else if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')][_0xb9b9('0x86')])){logger['info'](_0xb9b9('0x87'),_0x12594f[_0xb9b9('0x2f')],_0x12594f['value']);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x2f')]][_0xb9b9('0x88')]=_0x12594f[_0xb9b9('0x7b')];}}}else if(this[_0xb9b9('0x2a')](_0x12594f['variable'][_0xb9b9('0x79')])){if(_0x12594f[_0xb9b9('0x7b')]){var _0x1d4d31=path[_0xb9b9('0x89')](_0x12594f['value'])[_0xb9b9('0x3c')];logger[_0xb9b9('0x51')](_0xb9b9('0x7a'),_0x1d4d31,_0x12594f[_0xb9b9('0x7b')]);this[_0xb9b9('0x6c')](_0x1d4d31,_0x12594f['value']);}}else if(this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x42')]]){if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')])){if(this[_0xb9b9('0x2a')](_0x12594f[_0xb9b9('0x78')]['sipcallid'])){logger[_0xb9b9('0x51')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x12594f[_0xb9b9('0x42')],_0x12594f[_0xb9b9('0x7b')]);this[_0xb9b9('0x13')][_0x12594f[_0xb9b9('0x42')]][_0xb9b9('0x8a')]=_0x12594f['value'];}}}}}catch(_0x4212df){logger['error']('[%s][voiceCallReport][varset]',_0x12594f['uniqueid'],util[_0xb9b9('0x29')](_0x4212df,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb9b9('0x2c')][_0xb9b9('0x1f')]=function(_0x445535){try{if(this[_0xb9b9('0x2a')](_0x445535)){logger[_0xb9b9('0x31')](_0xb9b9('0x8b'),_0x445535[_0xb9b9('0x2f')],util[_0xb9b9('0x29')](_0x445535,{'showHidden':![],'depth':null}));if(this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]]){if(this['channels'][this['blindTransfers'][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x42')]]){this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]]['linkedid']][_0xb9b9('0x2f')]=_0x445535[_0xb9b9('0x2f')];this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535['linkedid']][_0xb9b9('0x42')]][_0xb9b9('0x60')]=this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]]['answered'];this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x42')]][_0xb9b9('0x61')]=this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]][_0xb9b9('0x61')];this['channels'][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x42')]][_0xb9b9('0x65')]=this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535['linkedid']][_0xb9b9('0x42')]][_0xb9b9('0x37')];this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]]['linkedid']][_0xb9b9('0x56')]=this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]][_0xb9b9('0x56')];this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]]=this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x42')]];this[_0xb9b9('0x8c')](this['blindTransfers'][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x42')]);}else if(this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x2f')]]){this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x2f')]]['uniqueid']=[this[_0xb9b9('0x13')][this['blindTransfers'][_0x445535['linkedid']][_0xb9b9('0x2f')]][_0xb9b9('0x42')],this['channels'][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]]['uniqueid']][_0xb9b9('0x42')]=this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535['linkedid']][_0xb9b9('0x2f')]][_0xb9b9('0x2f')]][0x0];this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x2f')]][_0xb9b9('0x60')]=this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]]['answered'];this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535['linkedid']][_0xb9b9('0x2f')]][_0xb9b9('0x61')]=this['channels'][_0x445535['uniqueid']][_0xb9b9('0x61')];this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x2f')]]['destinationchannel']=this['channels'][this['blindTransfers'][_0x445535['linkedid']]['uniqueid']][_0xb9b9('0x37')];this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]]['uniqueid']][_0xb9b9('0x56')]=this[_0xb9b9('0x13')][_0x445535['uniqueid']][_0xb9b9('0x56')];this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]]=this[_0xb9b9('0x13')][this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x2f')]];this['deleteChannelAfterTimeout'](this[_0xb9b9('0x15')][_0x445535[_0xb9b9('0x42')]][_0xb9b9('0x2f')]);}}if(this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]]){logger[_0xb9b9('0x51')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x445535[_0xb9b9('0x2f')],_0x445535[_0xb9b9('0x8d')]);var _0x50e25d=moment();this['channels'][_0x445535[_0xb9b9('0x2f')]][_0xb9b9('0x8e')]=_0x50e25d[_0xb9b9('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]]['duration']=_0x50e25d[_0xb9b9('0x63')](this[_0xb9b9('0x13')][_0x445535['uniqueid']][_0xb9b9('0x44')],_0xb9b9('0x55'));if(this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]][_0xb9b9('0x60')]){this[_0xb9b9('0x13')][_0x445535['uniqueid']]['billableseconds']=_0x50e25d[_0xb9b9('0x63')](this['channels'][_0x445535['uniqueid']][_0xb9b9('0x61')],_0xb9b9('0x55'));this['channels'][_0x445535[_0xb9b9('0x2f')]][_0xb9b9('0x62')]=this[_0xb9b9('0x13')][_0x445535[_0xb9b9('0x2f')]][_0xb9b9('0x54')]-this['channels'][_0x445535['uniqueid']][_0xb9b9('0x8f')];}if(_0x445535['context']===_0xb9b9('0x47')){if(this[_0xb9b9('0x14')][_0x445535[_0xb9b9('0x37')][_0xb9b9('0x48')]('-')[0x0]]){this['agents'][_0x445535[_0xb9b9('0x37')][_0xb9b9('0x48')]('-')[0x0]]=_[_0xb9b9('0x90')](this[_0xb9b9('0x14')][_0x445535[_0xb9b9('0x37')][_0xb9b9('0x48')]('-')[0x0]],[_0xb9b9('0x39')]);logger[_0xb9b9('0x31')](_0xb9b9('0x91'),_0x445535[_0xb9b9('0x2f')],util[_0xb9b9('0x29')]({'id':this[_0xb9b9('0x14')][_0x445535[_0xb9b9('0x37')][_0xb9b9('0x48')]('-')[0x0]]['id'],'destaccountcode':this[_0xb9b9('0x14')][_0x445535[_0xb9b9('0x37')][_0xb9b9('0x48')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xb9b9('0x2d')](util[_0xb9b9('0x3a')](_0xb9b9('0x3b'),this[_0xb9b9('0x14')][_0x445535['channel'][_0xb9b9('0x48')]('-')[0x0]][_0xb9b9('0x3c')]),_0xb9b9('0x92'),{'id':this[_0xb9b9('0x14')][_0x445535['channel'][_0xb9b9('0x48')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x445535['channel'][_0xb9b9('0x48')]('-')[0x0]][_0xb9b9('0x4a')]});for(var _0x3f6153=0x0;_0x3f6153{delete this['channels'][_0x31b1ca];},_0x13bbbe);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 7289b28..b66362a 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 _0x1f8d=['answertime','answered','diff','billableseconds','sumHoldTime','holdtime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','channel','lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','keys','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','membercalls','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','seconds','complete','total'];(function(_0x35e619,_0x44d9e4){var _0x826de2=function(_0xcf2df9){while(--_0xcf2df9){_0x35e619['push'](_0x35e619['shift']());}};_0x826de2(++_0x44d9e4);}(_0x1f8d,0x17a));var _0xd1f8=function(_0x1c2829,_0x205c81){_0x1c2829=_0x1c2829-0x0;var _0x27341b=_0x1f8d[_0x1c2829];return _0x27341b;};'use strict';var _=require(_0xd1f8('0x0'));var moment=require(_0xd1f8('0x1'));var util=require(_0xd1f8('0x2'));var Redis=require(_0xd1f8('0x3'));var config=require(_0xd1f8('0x4'));var logger=require(_0xd1f8('0x5'))('ami');var ami=require(_0xd1f8('0x6'));config[_0xd1f8('0x7')]=_[_0xd1f8('0x8')](config[_0xd1f8('0x7')],{'host':_0xd1f8('0x9'),'port':0x18eb});var io=require(_0xd1f8('0xa'))(new Redis(config[_0xd1f8('0x7')]));function VoiceDialReport(_0x3a6299){this[_0xd1f8('0xb')]=_0x3a6299[_0xd1f8('0xc')];this[_0xd1f8('0xd')]=_0x3a6299['outbound'];this[_0xd1f8('0xe')]={};this['variables']={};ami['on'](_0xd1f8('0xf'),this[_0xd1f8('0x10')][_0xd1f8('0x11')](this));ami['on']('dialend',this[_0xd1f8('0x12')][_0xd1f8('0x11')](this));ami['on'](_0xd1f8('0x13'),this[_0xd1f8('0x14')][_0xd1f8('0x11')](this));ami['on'](_0xd1f8('0x15'),this[_0xd1f8('0x16')]['bind'](this));}VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x18')]=function(_0x270773){return _0x270773!==null&&!_[_0xd1f8('0x19')](_0x270773);};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x1a')]=function(_0x4d22f0,_0x3a8555,_0x1b0265){io['to'](_0x4d22f0)['emit'](_0x3a8555,_0x1b0265);};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x10')]=function(_0x4fa69a){try{if(this[_0xd1f8('0x18')](_0x4fa69a)){logger[_0xd1f8('0x1b')](_0xd1f8('0x1c'),_0x4fa69a[_0xd1f8('0x1d')],util['inspect'](_0x4fa69a,{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]){_[_0xd1f8('0x1e')](this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]],{'starttime':moment()[_0xd1f8('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x4fa69a[_0xd1f8('0x20')]['substring'](0x0,_0x4fa69a[_0xd1f8('0x20')][_0xd1f8('0x21')]('-')),'membername':_0x4fa69a[_0xd1f8('0x20')][_0xd1f8('0x22')](_0x4fa69a[_0xd1f8('0x20')]['lastIndexOf']('/')+0x1,_0x4fa69a[_0xd1f8('0x20')][_0xd1f8('0x21')]('-'))},_[_0xd1f8('0x23')](_0x4fa69a,[_0xd1f8('0x24'),_0xd1f8('0x25')]));logger[_0xd1f8('0x26')](_0xd1f8('0x27'),_0x4fa69a['uniqueid'],this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]['membername'],this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]['interface']);logger[_0xd1f8('0x1b')](_0xd1f8('0x28'),_0x4fa69a['uniqueid'],util[_0xd1f8('0x29')](this['channels'][_0x4fa69a[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xe')][_0x4fa69a[_0xd1f8('0x1d')]])_[_0xd1f8('0x1e')](this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]],this[_0xd1f8('0xe')][_0x4fa69a[_0xd1f8('0x1d')]]);this[_0xd1f8('0x1a')]('voice:outbound',_0xd1f8('0x2a'),this['channels'][_0x4fa69a[_0xd1f8('0x1d')]]);logger[_0xd1f8('0x1b')](_0xd1f8('0x2b'),_0x4fa69a['uniqueid'],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x4fa69a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd1f8('0x1a')]('custom:dialbegin',this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]);}}}catch(_0x1e4665){logger[_0xd1f8('0x2c')](_0xd1f8('0x2d'),_0x4fa69a[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x1e4665,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')]['syncDialEnd']=function(_0x5226){try{if(this[_0xd1f8('0x18')](_0x5226)){logger[_0xd1f8('0x1b')](_0xd1f8('0x2e'),_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x5226,{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xb')][_0x5226['uniqueid']]){this['channels'][_0x5226['uniqueid']][_0xd1f8('0x2f')]=_0x5226[_0xd1f8('0x2f')];if(_0x5226[_0xd1f8('0x2f')]==='ANSWER'){this['channels'][_0x5226[_0xd1f8('0x1d')]]['connectedlinenum']=_0x5226[_0xd1f8('0x30')];this['channels'][_0x5226[_0xd1f8('0x1d')]][_0xd1f8('0x31')]=_0x5226[_0xd1f8('0x31')];this['channels'][_0x5226[_0xd1f8('0x1d')]]['answertime']=moment()[_0xd1f8('0x1f')](_0xd1f8('0x32'));this[_0xd1f8('0xb')][_0x5226[_0xd1f8('0x1d')]][_0xd1f8('0x33')]=_0xd1f8('0x34');logger[_0xd1f8('0x26')](_0xd1f8('0x35'),_0x5226[_0xd1f8('0x1d')],_0x5226[_0xd1f8('0x20')][_0xd1f8('0x22')](_0x5226[_0xd1f8('0x20')][_0xd1f8('0x21')]('/')+0x1,_0x5226[_0xd1f8('0x20')]['lastIndexOf']('-')));logger[_0xd1f8('0x1b')](_0xd1f8('0x36'),_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x5226[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd1f8('0x37'),this[_0xd1f8('0xb')][_0x5226['uniqueid']]);}logger[_0xd1f8('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this['channels'][_0x5226[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));this[_0xd1f8('0x1a')]('voice:outbound',_0xd1f8('0x2a'),this[_0xd1f8('0xb')][_0x5226[_0xd1f8('0x1d')]]);}}}catch(_0x3f3be9){logger['error']('[%s][voiceDialReport][dialend]',_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x3f3be9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x14')]=function(_0x19c9ba){try{if(this[_0xd1f8('0x18')](_0x19c9ba)){logger[_0xd1f8('0x1b')]('[%s][voiceDialReport][varset]\x20event:',_0x19c9ba[_0xd1f8('0x1d')],util['inspect'](_0x19c9ba,{'showHidden':![],'depth':null}));this['addVariable'](_0x19c9ba[_0xd1f8('0x1d')],_[_0xd1f8('0x38')](_0x19c9ba['variable'])[0x0],_0x19c9ba[_0xd1f8('0x39')]);if(this[_0xd1f8('0x18')](_0x19c9ba['variable'])&&this[_0xd1f8('0x18')](_0x19c9ba['variable']['outboundrouteid'])){if(_['isUndefined'](this[_0xd1f8('0xb')][_0x19c9ba['uniqueid']])){this[_0xd1f8('0xb')][_0x19c9ba[_0xd1f8('0x1d')]]={'routeId':_0x19c9ba[_0xd1f8('0x39')],'variables':this[_0xd1f8('0x3a')][_0x19c9ba['uniqueid']],'motionChannel':'voice'};logger[_0xd1f8('0x26')](_0xd1f8('0x3b'),_0x19c9ba['uniqueid'],_0x19c9ba[_0xd1f8('0x3c')]['outboundrouteid'],_[_0xd1f8('0x38')](_0x19c9ba[_0xd1f8('0x3c')])[0x0],_0x19c9ba['value']);logger['debug'](_0xd1f8('0x3d'),_0x19c9ba[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this['channels'][_0x19c9ba['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd1f8('0x1a')](_0xd1f8('0x3e'),_0xd1f8('0x2a'),this['channels'][_0x19c9ba[_0xd1f8('0x1d')]]);}}}}catch(_0x279153){logger[_0xd1f8('0x2c')](_0xd1f8('0x3f'),_0x19c9ba['uniqueid'],util[_0xd1f8('0x29')](_0x279153,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x40')]=function(_0x33db82,_0xb0e42d,_0x44c86d){var _0x572fb3=[_0xd1f8('0x41'),_0xd1f8('0x42'),_0xd1f8('0x43'),_0xd1f8('0x44'),_0xd1f8('0x45'),_0xd1f8('0x46'),'rtpaudioqosrtt',_0xd1f8('0x47'),_0xd1f8('0x48'),'sipuri','bridgepeer','bridgepvtcallid',_0xd1f8('0x49'),'memberdynamic',_0xd1f8('0x4a'),_0xd1f8('0x4b'),'membername','memberpenalty',_0xd1f8('0x4c')];if(!_['isNil'](_0xb0e42d)&&!_[_0xd1f8('0x4d')](_0x572fb3,_0xb0e42d)){if(_[_0xd1f8('0x19')](this[_0xd1f8('0x3a')][_0x33db82])){this[_0xd1f8('0x3a')][_0x33db82]={};}this['variables'][_0x33db82][_0xb0e42d]=_0x44c86d;}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x16')]=function(_0x48249c){try{if(this[_0xd1f8('0x18')](_0x48249c)){logger[_0xd1f8('0x1b')](_0xd1f8('0x4e'),_0x48249c[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x48249c,{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]){logger[_0xd1f8('0x26')](_0xd1f8('0x4f'),_0x48249c[_0xd1f8('0x1d')],_0x48249c['cause-txt']);this['channels'][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x50')]=moment()[_0xd1f8('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x51')]=moment(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x50')])['diff'](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x52')],_0xd1f8('0x53'));this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x33')]=_0xd1f8('0x54');this[_0xd1f8('0xd')][_0xd1f8('0x55')]+=0x1;if(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x56')]){this['outbound'][_0xd1f8('0x57')]+=0x1;this[_0xd1f8('0xb')][_0x48249c['uniqueid']]['holdtime']=moment(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x56')])[_0xd1f8('0x58')](this['channels'][_0x48249c['uniqueid']][_0xd1f8('0x52')],_0xd1f8('0x53'));this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x59')]=moment(this[_0xd1f8('0xb')][_0x48249c['uniqueid']]['endtime'])[_0xd1f8('0x58')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]['answertime'],_0xd1f8('0x53'));this[_0xd1f8('0xd')][_0xd1f8('0x5a')]+=this['channels'][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x5b')]||0x0;this['outbound'][_0xd1f8('0x5c')]+=this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x59')];}this['outbound']['sumDuration']+=this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]['duration'];logger['debug'](_0xd1f8('0x5d'),_0x48249c['uniqueid'],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd1f8('0x5e'),this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]);logger[_0xd1f8('0x1b')](_0xd1f8('0x5f'),_0x48249c[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xd1f8('0x1a')](_0xd1f8('0x60'),this['channels'][_0x48249c[_0xd1f8('0x1d')]]);logger[_0xd1f8('0x1b')](_0xd1f8('0x61'),_0x48249c[_0xd1f8('0x1d')],util['inspect'](this[_0xd1f8('0xb')][_0x48249c['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xd1f8('0x3e'),'voice_outbound:save',this[_0xd1f8('0xd')]);logger[_0xd1f8('0x26')](_0xd1f8('0x62'),JSON[_0xd1f8('0x63')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]));logger['debug'](_0xd1f8('0x64'),_0x48249c['uniqueid'],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));this['emit'](_0xd1f8('0x3e'),'voice_outbound_channel:remove',this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]);this[_0xd1f8('0x65')](_0x48249c[_0xd1f8('0x1d')]);}else if(this[_0xd1f8('0xb')][_0x48249c['linkedid']]){this['channels'][_0x48249c[_0xd1f8('0x66')]][_0xd1f8('0x1d')]=this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x66')]][_0xd1f8('0x67')];}if(this['variables'][_0x48249c[_0xd1f8('0x1d')]]){delete this[_0xd1f8('0x3a')][_0x48249c[_0xd1f8('0x1d')]];}}}catch(_0x197c21){logger[_0xd1f8('0x2c')]('[%s][voiceDialReport][hangup]',_0x48249c[_0xd1f8('0x1d')],util['inspect'](_0x197c21,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x68')]=function(_0x5f1234){try{if(this[_0xd1f8('0x18')](_0x5f1234)){logger[_0xd1f8('0x1b')](_0xd1f8('0x69'),_0x5f1234[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x5f1234,{'showHidden':![],'depth':null}));if(_0x5f1234[_0xd1f8('0x6a')][_0xd1f8('0x6b')]()===_0xd1f8('0x6c')){_0x5f1234[_0xd1f8('0x6d')]=(_0x5f1234['appdata']||_0x5f1234['applicationdata'])[_0xd1f8('0x6b')]();if(_[_0xd1f8('0x6e')](_0x5f1234[_0xd1f8('0x6d')],_0xd1f8('0x6f'))){if(_['isUndefined'](this['applications'][_0x5f1234['uniqueid']]))this[_0xd1f8('0xe')][_0x5f1234[_0xd1f8('0x1d')]]={};logger[_0xd1f8('0x26')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x5f1234[_0xd1f8('0x1d')],_0x5f1234[_0xd1f8('0x6a')],_0x5f1234[_0xd1f8('0x6d')]);var _0x51551a=_0x5f1234[_0xd1f8('0x6d')][_0xd1f8('0x70')]('=');var _0x16e2ef=_0x51551a[0x0][_0xd1f8('0x71')](/cdr\((.*)\)/);if(_0x16e2ef)this['applications'][_0x5f1234[_0xd1f8('0x1d')]][_0x16e2ef[0x1]]=_0x51551a[0x1];}}}}catch(_0x1ea98c){logger[_0xd1f8('0x2c')](_0xd1f8('0x72'),_0x5f1234[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x1ea98c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x65')]=function(_0x2d2438,_0x2ec88c=0x2710){if(this[_0xd1f8('0xb')][_0x2d2438]){setTimeout(()=>{delete this[_0xd1f8('0xb')][_0x2d2438];},_0x2ec88c);}};module[_0xd1f8('0x73')]=VoiceDialReport; \ No newline at end of file +var _0xb48c=['value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','isUndefined','variables','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','diff','starttime','seconds','complete','total','answertime','answered','holdtime','billableseconds','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','appdata','startsWith','applicationdata','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncVarSet','hangup','prototype','isNotNull','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','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','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable'];(function(_0x589126,_0x30969e){var _0x168788=function(_0x477d07){while(--_0x477d07){_0x589126['push'](_0x589126['shift']());}};_0x168788(++_0x30969e);}(_0xb48c,0x1aa));var _0xcb48=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb48c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcb48('0x0'));var moment=require(_0xcb48('0x1'));var util=require(_0xcb48('0x2'));var Redis=require(_0xcb48('0x3'));var config=require(_0xcb48('0x4'));var logger=require(_0xcb48('0x5'))('ami');var ami=require('../ami');config[_0xcb48('0x6')]=_['defaults'](config[_0xcb48('0x6')],{'host':_0xcb48('0x7'),'port':0x18eb});var io=require(_0xcb48('0x8'))(new Redis(config[_0xcb48('0x6')]));function VoiceDialReport(_0x39a776){this[_0xcb48('0x9')]=_0x39a776[_0xcb48('0xa')];this[_0xcb48('0xb')]=_0x39a776[_0xcb48('0xb')];this[_0xcb48('0xc')]={};this['variables']={};ami['on'](_0xcb48('0xd'),this[_0xcb48('0xe')][_0xcb48('0xf')](this));ami['on'](_0xcb48('0x10'),this['syncDialEnd']['bind'](this));ami['on']('varset',this[_0xcb48('0x11')][_0xcb48('0xf')](this));ami['on'](_0xcb48('0x12'),this['syncHangup']['bind'](this));}VoiceDialReport[_0xcb48('0x13')][_0xcb48('0x14')]=function(_0x1ea267){return _0x1ea267!==null&&!_['isUndefined'](_0x1ea267);};VoiceDialReport[_0xcb48('0x13')][_0xcb48('0x15')]=function(_0x1af951,_0x12e8bc,_0x1ddd1a){io['to'](_0x1af951)[_0xcb48('0x15')](_0x12e8bc,_0x1ddd1a);};VoiceDialReport[_0xcb48('0x13')]['syncDialBegin']=function(_0x4e0a3a){try{if(this[_0xcb48('0x14')](_0x4e0a3a)){logger[_0xcb48('0x16')](_0xcb48('0x17'),_0x4e0a3a[_0xcb48('0x18')],util[_0xcb48('0x19')](_0x4e0a3a,{'showHidden':![],'depth':null}));if(this[_0xcb48('0x9')][_0x4e0a3a[_0xcb48('0x18')]]){_[_0xcb48('0x1a')](this[_0xcb48('0x9')][_0x4e0a3a[_0xcb48('0x18')]],{'starttime':moment()[_0xcb48('0x1b')](_0xcb48('0x1c')),'lastevent':'called','interface':_0x4e0a3a['channel']['substring'](0x0,_0x4e0a3a[_0xcb48('0x1d')][_0xcb48('0x1e')]('-')),'membername':_0x4e0a3a[_0xcb48('0x1d')][_0xcb48('0x1f')](_0x4e0a3a['channel'][_0xcb48('0x1e')]('/')+0x1,_0x4e0a3a[_0xcb48('0x1d')][_0xcb48('0x1e')]('-'))},_['omit'](_0x4e0a3a,[_0xcb48('0x20'),_0xcb48('0x21')]));logger[_0xcb48('0x22')](_0xcb48('0x23'),_0x4e0a3a['uniqueid'],this['channels'][_0x4e0a3a[_0xcb48('0x18')]][_0xcb48('0x24')],this['channels'][_0x4e0a3a['uniqueid']][_0xcb48('0x25')]);logger[_0xcb48('0x16')](_0xcb48('0x26'),_0x4e0a3a[_0xcb48('0x18')],util[_0xcb48('0x19')](this[_0xcb48('0x9')][_0x4e0a3a[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x4e0a3a[_0xcb48('0x18')]])_[_0xcb48('0x1a')](this[_0xcb48('0x9')][_0x4e0a3a[_0xcb48('0x18')]],this[_0xcb48('0xc')][_0x4e0a3a['uniqueid']]);this[_0xcb48('0x15')](_0xcb48('0x27'),_0xcb48('0x28'),this['channels'][_0x4e0a3a[_0xcb48('0x18')]]);logger[_0xcb48('0x16')](_0xcb48('0x29'),_0x4e0a3a['uniqueid'],util['inspect'](this[_0xcb48('0x9')][_0x4e0a3a[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0xcb48('0x2a'),this[_0xcb48('0x9')][_0x4e0a3a['uniqueid']]);}}}catch(_0x3b3529){logger[_0xcb48('0x2b')](_0xcb48('0x2c'),_0x4e0a3a[_0xcb48('0x18')],util[_0xcb48('0x19')](_0x3b3529,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xcb48('0x2d')]=function(_0x4498cd){try{if(this['isNotNull'](_0x4498cd)){logger[_0xcb48('0x16')](_0xcb48('0x2e'),_0x4498cd[_0xcb48('0x18')],util[_0xcb48('0x19')](_0x4498cd,{'showHidden':![],'depth':null}));if(this[_0xcb48('0x9')][_0x4498cd['uniqueid']]){this[_0xcb48('0x9')][_0x4498cd[_0xcb48('0x18')]]['dialstatus']=_0x4498cd[_0xcb48('0x2f')];if(_0x4498cd[_0xcb48('0x2f')]===_0xcb48('0x30')){this[_0xcb48('0x9')][_0x4498cd['uniqueid']][_0xcb48('0x31')]=_0x4498cd[_0xcb48('0x31')];this[_0xcb48('0x9')][_0x4498cd[_0xcb48('0x18')]][_0xcb48('0x32')]=_0x4498cd[_0xcb48('0x32')];this[_0xcb48('0x9')][_0x4498cd[_0xcb48('0x18')]]['answertime']=moment()[_0xcb48('0x1b')](_0xcb48('0x1c'));this[_0xcb48('0x9')][_0x4498cd['uniqueid']][_0xcb48('0x33')]=_0xcb48('0x34');logger[_0xcb48('0x22')](_0xcb48('0x35'),_0x4498cd['uniqueid'],_0x4498cd[_0xcb48('0x1d')]['substring'](_0x4498cd['channel'][_0xcb48('0x1e')]('/')+0x1,_0x4498cd['channel'][_0xcb48('0x1e')]('-')));logger['debug'](_0xcb48('0x36'),_0x4498cd[_0xcb48('0x18')],util[_0xcb48('0x19')](this['channels'][_0x4498cd[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));ami[_0xcb48('0x15')](_0xcb48('0x37'),this[_0xcb48('0x9')][_0x4498cd[_0xcb48('0x18')]]);}logger[_0xcb48('0x16')](_0xcb48('0x38'),_0x4498cd[_0xcb48('0x18')],util[_0xcb48('0x19')](this[_0xcb48('0x9')][_0x4498cd[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));this[_0xcb48('0x15')](_0xcb48('0x27'),_0xcb48('0x28'),this[_0xcb48('0x9')][_0x4498cd[_0xcb48('0x18')]]);}}}catch(_0x14462e){logger[_0xcb48('0x2b')](_0xcb48('0x39'),_0x4498cd[_0xcb48('0x18')],util[_0xcb48('0x19')](_0x14462e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcb48('0x13')]['syncVarSet']=function(_0x4c6b95){try{if(this['isNotNull'](_0x4c6b95)){logger['debug'](_0xcb48('0x3a'),_0x4c6b95['uniqueid'],util[_0xcb48('0x19')](_0x4c6b95,{'showHidden':![],'depth':null}));this[_0xcb48('0x3b')](_0x4c6b95[_0xcb48('0x18')],_[_0xcb48('0x3c')](_0x4c6b95[_0xcb48('0x3d')])[0x0],_0x4c6b95[_0xcb48('0x3e')]);if(this[_0xcb48('0x14')](_0x4c6b95['variable'])&&this[_0xcb48('0x14')](_0x4c6b95[_0xcb48('0x3d')][_0xcb48('0x3f')])){if(_['isUndefined'](this[_0xcb48('0x9')][_0x4c6b95[_0xcb48('0x18')]])){this['channels'][_0x4c6b95[_0xcb48('0x18')]]={'routeId':_0x4c6b95[_0xcb48('0x3e')],'variables':this['variables'][_0x4c6b95[_0xcb48('0x18')]],'motionChannel':_0xcb48('0x40')};logger[_0xcb48('0x22')](_0xcb48('0x41'),_0x4c6b95[_0xcb48('0x18')],_0x4c6b95[_0xcb48('0x3d')][_0xcb48('0x3f')],_[_0xcb48('0x3c')](_0x4c6b95[_0xcb48('0x3d')])[0x0],_0x4c6b95[_0xcb48('0x3e')]);logger[_0xcb48('0x16')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4c6b95[_0xcb48('0x18')],util[_0xcb48('0x19')](this['channels'][_0x4c6b95[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));this[_0xcb48('0x15')](_0xcb48('0x27'),_0xcb48('0x28'),this[_0xcb48('0x9')][_0x4c6b95['uniqueid']]);}}}}catch(_0x3d6859){logger[_0xcb48('0x2b')](_0xcb48('0x42'),_0x4c6b95[_0xcb48('0x18')],util[_0xcb48('0x19')](_0x3d6859,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcb48('0x13')][_0xcb48('0x3b')]=function(_0x53c62e,_0xde8b30,_0x40ab35){var _0x1cb1b4=[_0xcb48('0x43'),_0xcb48('0x44'),_0xcb48('0x45'),'rtpaudioqosjitterbridged',_0xcb48('0x46'),_0xcb48('0x47'),_0xcb48('0x48'),_0xcb48('0x49'),'sipcallid','sipuri','bridgepeer',_0xcb48('0x4a'),'membercalls',_0xcb48('0x4b'),_0xcb48('0x4c'),_0xcb48('0x4d'),'membername',_0xcb48('0x4e'),'memberrealtime'];if(!_[_0xcb48('0x4f')](_0xde8b30)&&!_[_0xcb48('0x50')](_0x1cb1b4,_0xde8b30)){if(_[_0xcb48('0x51')](this[_0xcb48('0x52')][_0x53c62e])){this[_0xcb48('0x52')][_0x53c62e]={};}this[_0xcb48('0x52')][_0x53c62e][_0xde8b30]=_0x40ab35;}};VoiceDialReport[_0xcb48('0x13')]['syncHangup']=function(_0x4f33c1){try{if(this['isNotNull'](_0x4f33c1)){logger[_0xcb48('0x16')](_0xcb48('0x53'),_0x4f33c1[_0xcb48('0x18')],util[_0xcb48('0x19')](_0x4f33c1,{'showHidden':![],'depth':null}));if(this['channels'][_0x4f33c1[_0xcb48('0x18')]]){logger[_0xcb48('0x22')](_0xcb48('0x54'),_0x4f33c1[_0xcb48('0x18')],_0x4f33c1['cause-txt']);this['channels'][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x55')]=moment()[_0xcb48('0x1b')](_0xcb48('0x1c'));this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]]['duration']=moment(this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x55')])[_0xcb48('0x56')](this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x57')],_0xcb48('0x58'));this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]]['lastevent']=_0xcb48('0x59');this['outbound'][_0xcb48('0x5a')]+=0x1;if(this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x5b')]){this[_0xcb48('0xb')][_0xcb48('0x5c')]+=0x1;this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x5d')]=moment(this[_0xcb48('0x9')][_0x4f33c1['uniqueid']][_0xcb48('0x5b')])[_0xcb48('0x56')](this['channels'][_0x4f33c1['uniqueid']][_0xcb48('0x57')],_0xcb48('0x58'));this[_0xcb48('0x9')][_0x4f33c1['uniqueid']][_0xcb48('0x5e')]=moment(this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x55')])[_0xcb48('0x56')](this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x5b')],'seconds');this['outbound']['sumHoldTime']+=this['channels'][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x5d')]||0x0;this[_0xcb48('0xb')][_0xcb48('0x5f')]+=this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x5e')];}this[_0xcb48('0xb')][_0xcb48('0x60')]+=this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]][_0xcb48('0x61')];logger['debug'](_0xcb48('0x62'),_0x4f33c1[_0xcb48('0x18')],util[_0xcb48('0x19')](this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));ami[_0xcb48('0x15')](_0xcb48('0x63'),this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]]);logger['debug'](_0xcb48('0x64'),_0x4f33c1[_0xcb48('0x18')],util[_0xcb48('0x19')](this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));ami[_0xcb48('0x15')](_0xcb48('0x65'),this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]]);logger[_0xcb48('0x16')](_0xcb48('0x66'),_0x4f33c1[_0xcb48('0x18')],util[_0xcb48('0x19')](this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));this[_0xcb48('0x15')](_0xcb48('0x27'),_0xcb48('0x67'),this[_0xcb48('0xb')]);logger[_0xcb48('0x22')](_0xcb48('0x68'),JSON['stringify'](this['channels'][_0x4f33c1['uniqueid']]));logger[_0xcb48('0x16')](_0xcb48('0x69'),_0x4f33c1[_0xcb48('0x18')],util['inspect'](this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x18')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:remove',this['channels'][_0x4f33c1[_0xcb48('0x18')]]);this[_0xcb48('0x6a')](_0x4f33c1[_0xcb48('0x18')]);}else if(this['channels'][_0x4f33c1[_0xcb48('0x6b')]]){this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x6b')]][_0xcb48('0x18')]=this[_0xcb48('0x9')][_0x4f33c1[_0xcb48('0x6b')]][_0xcb48('0x6c')];}if(this[_0xcb48('0x52')][_0x4f33c1[_0xcb48('0x18')]]){delete this[_0xcb48('0x52')][_0x4f33c1[_0xcb48('0x18')]];}}}catch(_0x21e8b3){logger[_0xcb48('0x2b')](_0xcb48('0x6d'),_0x4f33c1['uniqueid'],util['inspect'](_0x21e8b3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x389842){try{if(this['isNotNull'](_0x389842)){logger[_0xcb48('0x16')](_0xcb48('0x6e'),_0x389842[_0xcb48('0x18')],util[_0xcb48('0x19')](_0x389842,{'showHidden':![],'depth':null}));if(_0x389842[_0xcb48('0x6f')][_0xcb48('0x70')]()===_0xcb48('0x71')){_0x389842['applicationdata']=(_0x389842[_0xcb48('0x72')]||_0x389842['applicationdata'])[_0xcb48('0x70')]();if(_[_0xcb48('0x73')](_0x389842[_0xcb48('0x74')],'cdr(')){if(_[_0xcb48('0x51')](this[_0xcb48('0xc')][_0x389842['uniqueid']]))this['applications'][_0x389842[_0xcb48('0x18')]]={};logger[_0xcb48('0x22')](_0xcb48('0x75'),_0x389842[_0xcb48('0x18')],_0x389842[_0xcb48('0x6f')],_0x389842[_0xcb48('0x74')]);var _0x489e05=_0x389842['applicationdata'][_0xcb48('0x76')]('=');var _0x2ab1f2=_0x489e05[0x0][_0xcb48('0x77')](/cdr\((.*)\)/);if(_0x2ab1f2)this['applications'][_0x389842[_0xcb48('0x18')]][_0x2ab1f2[0x1]]=_0x489e05[0x1];}}}}catch(_0x415faa){logger[_0xcb48('0x2b')](_0xcb48('0x78'),_0x389842['uniqueid'],util[_0xcb48('0x19')](_0x415faa,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcb48('0x13')][_0xcb48('0x6a')]=function(_0x34ad43,_0x442b6e=0x2710){if(this[_0xcb48('0x9')][_0x34ad43]){setTimeout(()=>{delete this[_0xcb48('0x9')][_0x34ad43];},_0x442b6e);}};module[_0xcb48('0x79')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index bc1884a..455da4d 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 _0x6fe1=['seconds','milliseconds','queuecallerjoinAt','ATTENDEDTRANSFER','total','answered','sumBillable','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','startsWith','application','split','match','[%s][voiceQueueReport][newexten]','exports','moment','util','../../../config/environment','ami','../ami','../model/voiceQueueSummary','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','realtime','agents','queueChannels','campaigns','summary','variables','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','queuecallerexit','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','emit','debug','format','queue','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_channel:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','name','createReport','compareToInboundQueue','assign','queuestatus','inbound','handleInboundQueueSummaryReport','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexitAt','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','value','variable','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','length','sumHoldTime','diff'];(function(_0x30f675,_0x1115ee){var _0x445bde=function(_0x1c1a0d){while(--_0x1c1a0d){_0x30f675['push'](_0x30f675['shift']());}};_0x445bde(++_0x1115ee);}(_0x6fe1,0x12b));var _0x16fe=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x6fe1[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require('lodash');var moment=require(_0x16fe('0x0'));var util=require(_0x16fe('0x1'));var Redis=require('ioredis');var config=require(_0x16fe('0x2'));var logger=require('../../../config/logger')(_0x16fe('0x3'));var ami=require(_0x16fe('0x4'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x16fe('0x5'));config['redis']=_['defaults'](config[_0x16fe('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x16fe('0x7'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x16fe('0x8')][_0x16fe('0x9')]=function(_0x470740){this[_0x16fe('0xa')]=this['tail']?this['tail'][_0x16fe('0xb')](_0x470740):_0x470740();};function VoiceQueueReport(_0x14fa31){this[_0x16fe('0xc')]=new Sequence();this['queueReports']={};this[_0x16fe('0xd')]=_0x14fa31;this['agents']=_0x14fa31[_0x16fe('0xe')];this['channels']=_0x14fa31[_0x16fe('0xf')];this['voiceQueues']=_0x14fa31['voiceQueues'];this[_0x16fe('0x10')]=_0x14fa31[_0x16fe('0x10')];this[_0x16fe('0x11')]=initializeSummary();this[_0x16fe('0x12')]={};ami['on']('queuesummary',this[_0x16fe('0x13')][_0x16fe('0x14')](this));ami['on']('queuesummarycomplete',this[_0x16fe('0x15')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x16'),this[_0x16fe('0x17')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x18'),this[_0x16fe('0x19')]['bind'](this));ami['on'](_0x16fe('0x1a'),this['syncQueueCallerJoin']['bind'](this));ami['on'](_0x16fe('0x1b'),this[_0x16fe('0x1c')]['bind'](this));ami['on'](_0x16fe('0x1d'),this[_0x16fe('0x1e')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x1f'),this[_0x16fe('0x20')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x21'),this[_0x16fe('0x22')][_0x16fe('0x14')](this));ami['on']('varset',this[_0x16fe('0x23')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x24'),this[_0x16fe('0x25')]['bind'](this));ami['on'](_0x16fe('0x26'),this[_0x16fe('0x27')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x28'),this['syncMusicOnHoldStart'][_0x16fe('0x14')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x29'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x16fe('0x2a'),this[_0x16fe('0x2b')]['bind'](this));this[_0x16fe('0x2c')]();this[_0x16fe('0x2d')]();}function clearChannels(_0x3925d5){if(!_[_0x16fe('0x2e')](_0x3925d5)){for(var _0x7c2df8 in _0x3925d5){if(_0x3925d5[_0x16fe('0x2f')](_0x7c2df8)){delete _0x3925d5[_0x7c2df8];}}}}function clearCampaigns(_0x2dc0ce){if(!_[_0x16fe('0x2e')](_0x2dc0ce)){for(var _0x1c32f7 in _0x2dc0ce){if(_0x2dc0ce['hasOwnProperty'](_0x1c32f7)){_0x2dc0ce[_0x1c32f7][_0x16fe('0x30')]=0x0;}}}}function clearVoiceQueues(_0x53adf9){if(!_[_0x16fe('0x2e')](_0x53adf9)){for(var _0xf08bf7 in _0x53adf9){if(_0x53adf9[_0x16fe('0x2f')](_0xf08bf7)){_0x53adf9[_0xf08bf7]['originated']=0x0;_0x53adf9[_0xf08bf7][_0x16fe('0x31')]=0x0;_0x53adf9[_0xf08bf7]['pTalking']=0x0;_0x53adf9[_0xf08bf7][_0x16fe('0x32')]=0x0;_0x53adf9[_0xf08bf7]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x14a530){if(!_[_0x16fe('0x2e')](_0x14a530)){for(var _0x150af6 in _0x14a530){if(_0x14a530['hasOwnProperty'](_0x150af6)){_0x14a530[_0x150af6][_0x16fe('0x33')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x137c78){return _0x137c78[_0x16fe('0x34')]||_0x137c78['queuecallerabandon']||_0x137c78['queuecallercomplete'];}VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x35')]=function(){var _0x2fdbab=this;for(var _0x3fa277 in this[_0x16fe('0x36')]){if(this[_0x16fe('0x36')][_0x16fe('0x2f')](_0x3fa277)&&!this[_0x16fe('0x36')][_0x3fa277][_0x16fe('0x37')]){this[_0x16fe('0xc')][_0x16fe('0x9')](function(){if(!_[_0x16fe('0x38')](_0x2fdbab[_0x16fe('0x36')][_0x3fa277])){return ami[_0x16fe('0x39')]({'action':_0x16fe('0x3a'),'channel':_0x2fdbab['channels'][_0x3fa277][_0x16fe('0x3b')]})[_0x16fe('0x3c')](function(_0x29ee23){if(_0x29ee23[_0x16fe('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2fdbab[_0x16fe('0x36')][_0x3fa277]){delete _0x2fdbab['channels'][_0x3fa277];logger[_0x16fe('0x3e')](_0x16fe('0x3f'),_0x3fa277,util[_0x16fe('0x40')](_0x29ee23,{'showHidden':![],'depth':null}));}if(_0x2fdbab[_0x16fe('0x41')][_0x3fa277]){delete _0x2fdbab[_0x16fe('0x41')][_0x3fa277];logger['error'](_0x16fe('0x42'),_0x3fa277,util[_0x16fe('0x40')](_0x29ee23,{'showHidden':![],'depth':null}));}if(_0x2fdbab[_0x16fe('0x12')][_0x3fa277]){delete _0x2fdbab[_0x16fe('0x12')][_0x3fa277];logger[_0x16fe('0x3e')](_0x16fe('0x43'),_0x3fa277,util[_0x16fe('0x40')](_0x29ee23,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x27')]=function(){logger[_0x16fe('0x3e')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0x16fe('0x44')](this['queueReports']);clearAgentBooked(this[_0x16fe('0xe')]);clearVoiceQueues(this[_0x16fe('0x45')]);clearCampaigns(this['campaigns']);this[_0x16fe('0x11')]=initializeSummary();};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x44')]=function(_0x2a6e44){var _0x4ed3da=this;if(!_[_0x16fe('0x2e')](_0x2a6e44)){for(var _0x49061e in _0x2a6e44){if(_0x2a6e44[_0x16fe('0x2f')](_0x49061e)){_0x4ed3da[_0x16fe('0x46')](_0x2a6e44[_0x49061e],'clearqueuereport');delete _0x2a6e44[_0x49061e];}}}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x47')]=function(_0x56ca99,_0x3febca,_0x23a101){io['to'](_0x56ca99)[_0x16fe('0x47')](_0x3febca,_0x23a101);};VoiceQueueReport[_0x16fe('0x8')]['emitVoiceQueueChannelSave']=function(_0x19dda7,_0x6e4dc6){logger[_0x16fe('0x48')]('[%s][voiceQueueReport]['+_0x6e4dc6+']\x20sending\x20voice_queue_channel:save\x20event:',_0x19dda7['uniqueid'],util[_0x16fe('0x40')](_0x19dda7,{'showHidden':![],'depth':null}));this[_0x16fe('0x47')](util[_0x16fe('0x49')]('voice:queue:%s',_0x19dda7[_0x16fe('0x4a')]),_0x16fe('0x4b'),_0x19dda7);io[_0x16fe('0x47')](_0x16fe('0x4c'),_0x19dda7);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x46')]=function(_0x4eef95,_0x108b43){logger[_0x16fe('0x48')](_0x16fe('0x4d')+_0x108b43+_0x16fe('0x4e'),_0x4eef95[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x4eef95,{'showHidden':![],'depth':null}));if(_0x4eef95['queuecallerexitreason']==='ATTENDEDTRANSFER'){return;}this[_0x16fe('0x47')](util['format']('voice:queue:%s',_0x4eef95[_0x16fe('0x4a')]),_0x16fe('0x50'),_0x4eef95);io[_0x16fe('0x47')]('voice_queue_presence:remove',_0x4eef95);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x51')]=function(_0x3cd5f7){if(_0x3cd5f7[_0x16fe('0x52')]==='inbound'){logger[_0x16fe('0x48')](_0x16fe('0x53'),util[_0x16fe('0x40')](_0x3cd5f7,{'showHidden':![],'depth':null}));this[_0x16fe('0x47')](util[_0x16fe('0x49')]('voice:queue:%s',_0x3cd5f7['name']),_0x16fe('0x54'),_0x3cd5f7);}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x55')]=function(_0x27d3c5){return _0x27d3c5!==null&&!_[_0x16fe('0x56')](_0x27d3c5);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x2d')]=function(){var _0x4bac8e=this;setInterval(function(){_0x4bac8e['clearZombieChannels']();ami[_0x16fe('0x39')]({'action':_0x16fe('0x57')})[_0x16fe('0x3c')](function(_0x2f5da2){logger[_0x16fe('0x3e')](_0x16fe('0x58'),util['inspect'](_0x2f5da2,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x2c')]=function(){var _0x270ee0=this;setInterval(function(){if(!_0x270ee0[_0x16fe('0x11')][_0x16fe('0x59')]){return ami[_0x16fe('0x39')]({'action':_0x16fe('0x5a')})[_0x16fe('0x5b')](function(_0x155e61){_0x270ee0[_0x16fe('0x11')]['id']=_0x155e61[_0x16fe('0x5c')];_0x270ee0[_0x16fe('0x11')][_0x16fe('0x59')]=!![];_0x270ee0[_0x16fe('0x11')]['queuestatus'][_0x155e61[_0x16fe('0x5c')]]={};})['catch'](function(_0x5a1a2e){logger[_0x16fe('0x3e')](_0x16fe('0x5d'),util[_0x16fe('0x40')](_0x5a1a2e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x5e')]=function(_0x2ef281,_0x3c8c10){var _0x171f81;if(this[_0x16fe('0x11')]&&this[_0x16fe('0x11')]['queues']&&this[_0x16fe('0x11')][_0x16fe('0x57')][_0x2ef281['name']]){_0x171f81=this[_0x16fe('0x11')][_0x16fe('0x57')][_0x2ef281[_0x16fe('0x5f')]]['summaryEvent'];}var _0x100b95=new VoiceQueueSummary(_0x2ef281);return _0x100b95[_0x16fe('0x60')](_0x3c8c10[_0x16fe('0xe')],this[_0x16fe('0xe')],_0x171f81,this[_0x16fe('0xd')][_0x16fe('0x36')]);};VoiceQueueReport[_0x16fe('0x8')]['handleInboundQueueSummaryReport']=function(_0x4168ae,_0x5b494c){var _0x41e59=this[_0x16fe('0x5e')](_0x4168ae,_0x5b494c);var _0x55ac58=![];_0x55ac58=_0x41e59[_0x16fe('0x61')](_0x4168ae);if(_0x55ac58){Object[_0x16fe('0x62')](_0x4168ae,_0x41e59);this[_0x16fe('0xd')][_0x16fe('0x45')][_0x4168ae[_0x16fe('0x5f')]]=_0x4168ae;this[_0x16fe('0x51')](_0x41e59);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x169135){var _0x407f6f=null;var _0x1ae1a4=this['summary']['id'];if(this[_0x16fe('0x11')][_0x16fe('0x63')][_0x1ae1a4]){_0x407f6f=this[_0x16fe('0x11')][_0x16fe('0x63')][_0x1ae1a4][_0x169135['actionid']];}if(!_0x407f6f){this['summary']=initializeSummary();return;}var _0x5a906c=this['voiceQueues'][_0x407f6f[_0x16fe('0x4a')]];if(_0x5a906c[_0x16fe('0x52')]===_0x16fe('0x64')){this[_0x16fe('0x65')](_0x5a906c,_0x407f6f);}else if(_0x5a906c['type']==='outbound'){var _0x101dea=this[_0x16fe('0x5e')](_0x5a906c,_0x407f6f);ami['emit'](_0x16fe('0x66'),_0x101dea);}this[_0x16fe('0x11')][_0x16fe('0x67')]-=0x1;var _0x4ca796=this[_0x16fe('0x11')]['statusRequests']>0x0?!![]:![];if(!_0x4ca796){return this['syncQueueSummaryComplete'](this[_0x16fe('0x11')][_0x16fe('0x68')]);}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x17')]=function(_0x24c6c9){var _0x3d9b22=this[_0x16fe('0x11')]['id'];if(this['summary']['queuestatus'][_0x3d9b22]&&this[_0x16fe('0x11')][_0x16fe('0x63')][_0x3d9b22][_0x24c6c9[_0x16fe('0x5c')]]){this[_0x16fe('0x11')][_0x16fe('0x63')][_0x3d9b22][_0x24c6c9['actionid']][_0x16fe('0xe')][_0x16fe('0x69')](_0x24c6c9);}};VoiceQueueReport[_0x16fe('0x8')]['syncQueueSummary']=function(_0x166b6f){var _0xae9606=this;try{if(this[_0x16fe('0x55')](_0x166b6f)&&this[_0x16fe('0x55')](_0x166b6f[_0x16fe('0x4a')])){logger[_0x16fe('0x48')](_0x16fe('0x6a'),util[_0x16fe('0x40')](_0x166b6f,{'showHidden':![],'depth':null}));var _0x22c357=this['voiceQueues'][_0x166b6f[_0x16fe('0x4a')]];if(_0x22c357){logger[_0x16fe('0x48')](_0x16fe('0x6b'),_0x22c357[_0x16fe('0x5f')]);this[_0x16fe('0x11')]['queues'][_0x22c357[_0x16fe('0x5f')]]={'summaryEvent':_0x166b6f};this['summary'][_0x16fe('0x67')]+=0x1;return ami[_0x16fe('0x39')]({'action':'queuestatus','queue':_0x22c357[_0x16fe('0x5f')]})[_0x16fe('0x5b')](function(_0x3245fe){if(!_0xae9606[_0x16fe('0x11')][_0x16fe('0x63')][_0x166b6f[_0x16fe('0x5c')]]){_0xae9606[_0x16fe('0x11')][_0x16fe('0x63')][_0x166b6f['actionid']]={};}_0xae9606[_0x16fe('0x11')][_0x16fe('0x63')][_0x166b6f[_0x16fe('0x5c')]][_0x3245fe[_0x16fe('0x5c')]]={'queue':_0x22c357[_0x16fe('0x5f')],'agents':[]};})['catch'](function(_0x4ca28a){throw _0x4ca28a;});}}}catch(_0x31b3ce){logger['error'](_0x16fe('0x5d'),util['inspect'](_0x31b3ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x15')]=function(_0x473dde){if(this[_0x16fe('0x11')]['statusRequests']>0x0){this['summary']['completeEvent']=_0x473dde;return;}logger[_0x16fe('0x48')](_0x16fe('0x6c'),util[_0x16fe('0x40')](_0x473dde,{'showHidden':![],'depth':null}));this[_0x16fe('0x11')]=initializeSummary();ami[_0x16fe('0x47')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x6d')]=function(_0x88f303){try{if(this[_0x16fe('0x55')](_0x88f303)){logger[_0x16fe('0x48')](_0x16fe('0x6e'),_0x88f303[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x88f303,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x16fe('0x41')][_0x88f303[_0x16fe('0x4f')]])){this[_0x16fe('0x41')][_0x88f303[_0x16fe('0x4f')]]=[];}if(_[_0x16fe('0x56')](this[_0x16fe('0x36')][_0x88f303[_0x16fe('0x4f')]])){this[_0x16fe('0x36')][_0x88f303[_0x16fe('0x4f')]]={};}var _0x12019a=new QueueReport();_0x12019a['queue']=_0x88f303[_0x16fe('0x4a')];_0x12019a[_0x16fe('0x52')]=this['voiceQueues'][_0x12019a['queue']]&&this[_0x16fe('0x45')][_0x12019a[_0x16fe('0x4a')]][_0x16fe('0x52')]?this[_0x16fe('0x45')][_0x12019a[_0x16fe('0x4a')]][_0x16fe('0x52')]||_0x16fe('0x64'):_0x16fe('0x64');_0x12019a['queuecallerjoinAt']=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));_0x12019a[_0x16fe('0x70')]=_0x88f303[_0x16fe('0x70')];_0x12019a['count']=_0x88f303[_0x16fe('0x71')];_0x12019a[_0x16fe('0x4f')]=_0x88f303[_0x16fe('0x4f')];logger[_0x16fe('0x72')](_0x16fe('0x73'),_0x12019a['queue'],_0x12019a['type']);Object[_0x16fe('0x62')](_0x12019a,_[_0x16fe('0x74')](_0x88f303,_[_0x16fe('0x75')](_0x12019a)));this[_0x16fe('0x41')][_0x88f303[_0x16fe('0x4f')]][_0x16fe('0x69')](_0x12019a);this[_0x16fe('0x36')][_0x88f303[_0x16fe('0x4f')]]=_0x12019a;this[_0x16fe('0x76')](_0x12019a,_0x16fe('0x1a'));}}catch(_0x116e02){logger[_0x16fe('0x3e')](_0x16fe('0x6e'),_0x88f303['uniqueid'],util[_0x16fe('0x40')](_0x116e02,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16fe('0x1c')]=function(_0x308f1a){try{if(this[_0x16fe('0x55')](_0x308f1a)){logger[_0x16fe('0x48')](_0x16fe('0x77'),_0x308f1a[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x308f1a,{'showHidden':![],'depth':null}));if(this[_0x16fe('0x41')][_0x308f1a[_0x16fe('0x4f')]]){var _0x576cad=_[_0x16fe('0x78')](this['queueReports'][_0x308f1a[_0x16fe('0x4f')]]);_0x576cad[_0x16fe('0x79')]=![];_0x576cad[_0x16fe('0x7a')]=null;_0x576cad['holdtime']=_0x308f1a[_0x16fe('0x7b')];_0x576cad['originalposition']=_0x308f1a[_0x16fe('0x7c')];_0x576cad[_0x16fe('0x1b')]=!![];_0x576cad['queuecallerabandonAt']=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));_0x576cad[_0x16fe('0x7d')]=_0x16fe('0x7e');_0x576cad[_0x16fe('0x7f')]=null;logger[_0x16fe('0x72')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x576cad[_0x16fe('0x4a')],_0x576cad[_0x16fe('0x52')]);this[_0x16fe('0x36')][_0x308f1a['uniqueid']]=_0x576cad;this[_0x16fe('0x46')](_0x576cad,_0x16fe('0x1b'));}}}catch(_0x4007fa){logger[_0x16fe('0x3e')](_0x16fe('0x77'),_0x308f1a['uniqueid'],util[_0x16fe('0x40')](_0x4007fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16fe('0x1e')]=function(_0x535d0f){try{if(this[_0x16fe('0x55')](_0x535d0f)){logger[_0x16fe('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x535d0f['uniqueid'],util['inspect'](_0x535d0f,{'showHidden':![],'depth':null}));if(this[_0x16fe('0x41')][_0x535d0f[_0x16fe('0x4f')]]){var _0x49e3a4=_[_0x16fe('0x78')](this['queueReports'][_0x535d0f[_0x16fe('0x4f')]]);_0x49e3a4[_0x16fe('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x49e3a4[_0x16fe('0x81')]=_0x535d0f['connectedlinenum'];_0x49e3a4[_0x16fe('0x82')]=_0x535d0f[_0x16fe('0x82')];logger[_0x16fe('0x72')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x49e3a4[_0x16fe('0x4a')],_0x49e3a4[_0x16fe('0x52')],_0x535d0f[_0x16fe('0x81')],_0x535d0f[_0x16fe('0x82')]);this[_0x16fe('0x36')][_0x535d0f[_0x16fe('0x4f')]]=_0x49e3a4;this[_0x16fe('0x76')](_0x49e3a4,_0x16fe('0x1d'));}}}catch(_0x105bca){logger[_0x16fe('0x3e')](_0x16fe('0x83'),_0x535d0f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x105bca,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16fe('0x22')]=function(_0x57259f){try{if(this[_0x16fe('0x55')](_0x57259f)){logger[_0x16fe('0x48')](_0x16fe('0x84'),_0x57259f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x57259f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x57259f[_0x16fe('0x4f')]]){var _0x3cbd22=_[_0x16fe('0x78')](this[_0x16fe('0x41')][_0x57259f[_0x16fe('0x4f')]]);_0x3cbd22['queuecallercomplete']=!![];_0x3cbd22[_0x16fe('0x7d')]=_0x16fe('0x85');logger['info'](_0x16fe('0x86'),_0x3cbd22[_0x16fe('0x4a')],_0x3cbd22[_0x16fe('0x52')]);}}}catch(_0xeeec1e){logger[_0x16fe('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x57259f[_0x16fe('0x4f')],util['inspect'](_0xeeec1e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x20')]=function(_0x5a6894){try{if(this[_0x16fe('0x55')](_0x5a6894)){logger[_0x16fe('0x48')](_0x16fe('0x87'),_0x5a6894[_0x16fe('0x4f')],util['inspect'](_0x5a6894,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5a6894[_0x16fe('0x4f')]]){var _0x48beb9=_[_0x16fe('0x78')](this['queueReports'][_0x5a6894[_0x16fe('0x4f')]]);_0x48beb9[_0x16fe('0x1b')]=![];_0x48beb9[_0x16fe('0x88')]=null;_0x48beb9[_0x16fe('0x89')]=!![];_0x48beb9[_0x16fe('0x7f')]=_0x5a6894[_0x16fe('0x8a')];_0x48beb9[_0x16fe('0x7b')]=_0x5a6894['holdtime'];_0x48beb9[_0x16fe('0x79')]=!![];_0x48beb9[_0x16fe('0x34')]=![];_0x48beb9[_0x16fe('0x8b')]=null;if(!_0x48beb9[_0x16fe('0x8c')]){if(_0x5a6894['reason']==_0x16fe('0x8c')){_0x48beb9['queuecallerexitreason']='COMPLETED';logger[_0x16fe('0x72')](_0x16fe('0x8d'),_0x48beb9[_0x16fe('0x4a')],_0x48beb9[_0x16fe('0x52')]);}else{if(_['startsWith'](_0x5a6894[_0x16fe('0x3b')]['toLowerCase'](),_0x16fe('0x8e'))){if(this[_0x16fe('0x41')][_0x5a6894[_0x16fe('0x8f')]]){var _0x4e3324=_['last'](this[_0x16fe('0x41')][_0x5a6894[_0x16fe('0x8f')]]);_0x4e3324['queuecallercomplete']=![];_0x4e3324[_0x16fe('0x34')]=!![];_0x4e3324['queuecallerexitAt']=moment(_0x48beb9['queuecallerjoinAt'])[_0x16fe('0x90')](_0x5a6894['holdtime'],'seconds')[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e3324[_0x16fe('0x7d')]=_0x16fe('0x91');_0x4e3324[_0x16fe('0x8c')]=!![];_0x4e3324[_0x16fe('0x92')]=_0x16fe('0x93');_0x4e3324[_0x16fe('0x94')]=_0x5a6894[_0x16fe('0x95')];_0x4e3324['transferuniqueid']=_0x5a6894[_0x16fe('0x4f')];logger[_0x16fe('0x72')](_0x16fe('0x96'),_0x4e3324[_0x16fe('0x4a')],_0x4e3324['type']);var _0x1a5ba9=this['queueReports'][_0x5a6894[_0x16fe('0x8f')]];this[_0x16fe('0x41')][_0x5a6894[_0x16fe('0x8f')]]=this['queueReports'][_0x5a6894['uniqueid']];this[_0x16fe('0x41')][_0x5a6894['uniqueid']]=_0x1a5ba9;}}else{_0x48beb9[_0x16fe('0x7d')]=_0x16fe('0x97')+_0x5a6894[_0x16fe('0x98')][_0x16fe('0x99')]();logger[_0x16fe('0x72')](_0x16fe('0x9a'),_0x48beb9['queue'],_0x48beb9[_0x16fe('0x52')],_0x48beb9['queuecallerexitreason']);}}}this[_0x16fe('0x36')][_0x5a6894[_0x16fe('0x4f')]]=_0x48beb9;}}}catch(_0x467626){logger[_0x16fe('0x3e')](_0x16fe('0x87'),_0x5a6894[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x467626,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x23')]=function(_0x199d8f){try{if(this['isNotNull'](_0x199d8f)){logger[_0x16fe('0x48')](_0x16fe('0x9b'),_0x199d8f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x199d8f,{'showHidden':![],'depth':null}));this[_0x16fe('0x9c')](_0x199d8f[_0x16fe('0x4f')],_[_0x16fe('0x75')](_0x199d8f['variable'])[0x0],_0x199d8f[_0x16fe('0x9d')]);if(this[_0x16fe('0x41')][_0x199d8f[_0x16fe('0x4f')]]){var _0x510dfb=_[_0x16fe('0x78')](this[_0x16fe('0x41')][_0x199d8f[_0x16fe('0x4f')]]);if(_0x510dfb){if(this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')])&&this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')]['queuestatus'])){switch(_0x199d8f[_0x16fe('0x9d')]){case'CONTINUE':_0x510dfb[_0x16fe('0x34')]=![];_0x510dfb[_0x16fe('0x8b')]=null;break;case'TIMEOUT':_0x510dfb[_0x16fe('0x9f')]='timeout';_0x510dfb[_0x16fe('0x34')]=!![];_0x510dfb[_0x16fe('0x8b')]=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));_0x510dfb[_0x16fe('0x80')]=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));logger[_0x16fe('0x48')](_0x16fe('0xa0'),_0x199d8f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x510dfb,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x510dfb);break;default:_0x510dfb['queuecallerexit']=!![];_0x510dfb[_0x16fe('0x8b')]=moment()[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x510dfb['queuecallerleaveAt']=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));}_0x510dfb[_0x16fe('0x1b')]=![];_0x510dfb[_0x16fe('0x88')]=null;_0x510dfb['queuecallerexitreason']=_0x199d8f['value'];this[_0x16fe('0x36')][_0x199d8f[_0x16fe('0x4f')]]=_0x510dfb;this[_0x16fe('0x46')](_0x510dfb,'varset');}else if(this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')])&&this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')]['queueposition'])){if(!_0x510dfb['queuecallerabandon']){_0x510dfb[_0x16fe('0x34')]=!![];_0x510dfb[_0x16fe('0x8b')]=moment()[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x510dfb[_0x16fe('0x7d')]='EXITWITHKEY';_0x510dfb[_0x16fe('0x80')]=moment()[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x16fe('0x36')][_0x199d8f[_0x16fe('0x4f')]]=_0x510dfb;}}logger[_0x16fe('0x72')](_0x16fe('0xa1'),_0x199d8f[_0x16fe('0x4f')],_0x510dfb['queue'],_0x510dfb[_0x16fe('0x52')],_['keys'](_0x199d8f['variable'])[0x0],_0x199d8f[_0x16fe('0x9d')]);_0x510dfb[_0x16fe('0x12')]=this[_0x16fe('0x12')][_0x199d8f[_0x16fe('0x4f')]];}}}}catch(_0x5040c0){logger['error'](_0x16fe('0x9b'),_0x199d8f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x5040c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x9c')]=function(_0x196048,_0x267579,_0x491820){var _0x162ce0=[_0x16fe('0xa2'),_0x16fe('0xa3'),_0x16fe('0xa4'),_0x16fe('0xa5'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x16fe('0xa6'),_0x16fe('0xa7'),'sipcallid',_0x16fe('0xa8'),_0x16fe('0xa9'),'bridgepvtcallid',_0x16fe('0xaa'),_0x16fe('0xab'),_0x16fe('0xac'),_0x16fe('0xad'),_0x16fe('0x8a'),_0x16fe('0xae'),_0x16fe('0xaf')];if(!_[_0x16fe('0x38')](_0x267579)&&!_['includes'](_0x162ce0,_0x267579)){if(_[_0x16fe('0x56')](this[_0x16fe('0x12')][_0x196048])){this['variables'][_0x196048]={};}this[_0x16fe('0x12')][_0x196048][_0x267579]=_0x491820;}};VoiceQueueReport[_0x16fe('0x8')]['handleHangup']=function(_0x3670ce,_0x39590b,_0x3369bc){try{var _0x4c48ad={};if(this[_0x16fe('0x41')][_0x3670ce]){for(var _0x1c3493=0x0;_0x1c3493{delete this[_0x16fe('0x36')][_0x3ba40d];},_0x1d0b9f);}};module[_0x16fe('0xee')]=VoiceQueueReport; \ No newline at end of file +var _0xda0f=['catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','error','[FullyBooted]\x20clear\x20realtime','prototype','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_channel:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','isNotNull','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','name','summaryEvent','handleInboundQueueSummaryReport','compareToInboundQueue','assign','queuestatus','outbound','custom:queuesummary','statusRequests','completeEvent','push','syncQueueSummary','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','position','count','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','info','queuecallerabandon','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','membername','queuecallerexit','reason','transfer','COMPLETED','startsWith','toLowerCase','local/','linkedid','last','queuecallerexitAt','FORWARDTRANSFER','transfertype','FORWARD','transferexten','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','value','variable','CONTINUE','TIMEOUT','lastevent','timeout','queuecallerleaveAt','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','length','seconds','sumDuration','milliseconds','total','answered','sumBillable','diff','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','cause','transferid','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','ATTENDEDTRANSFER','origtransfereruniqueid','transferuniqueid','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','application','set','applicationdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','fullybooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','queuecallercomplete','clearZombieChannels','Action','status','channel'];(function(_0x2ecb8b,_0x4d2942){var _0x4769c5=function(_0x159613){while(--_0x159613){_0x2ecb8b['push'](_0x2ecb8b['shift']());}};_0x4769c5(++_0x4d2942);}(_0xda0f,0x19b));var _0xfda0=function(_0x3c28e7,_0x169024){_0x3c28e7=_0x3c28e7-0x0;var _0x557b3a=_0xda0f[_0x3c28e7];return _0x557b3a;};'use strict';var _=require(_0xfda0('0x0'));var moment=require(_0xfda0('0x1'));var util=require(_0xfda0('0x2'));var Redis=require('ioredis');var config=require(_0xfda0('0x3'));var logger=require(_0xfda0('0x4'))(_0xfda0('0x5'));var ami=require('../ami');var QueueReport=require(_0xfda0('0x6'));var VoiceQueueSummary=require(_0xfda0('0x7'));config[_0xfda0('0x8')]=_[_0xfda0('0x9')](config[_0xfda0('0x8')],{'host':_0xfda0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfda0('0x8')]));var Sequence=function(){};Sequence['prototype'][_0xfda0('0xb')]=function(_0x37227b){this[_0xfda0('0xc')]=this['tail']?this[_0xfda0('0xc')][_0xfda0('0xd')](_0x37227b):_0x37227b();};function VoiceQueueReport(_0x612a7e){this[_0xfda0('0xe')]=new Sequence();this[_0xfda0('0xf')]={};this[_0xfda0('0x10')]=_0x612a7e;this[_0xfda0('0x11')]=_0x612a7e[_0xfda0('0x11')];this[_0xfda0('0x12')]=_0x612a7e[_0xfda0('0x13')];this[_0xfda0('0x14')]=_0x612a7e[_0xfda0('0x14')];this[_0xfda0('0x15')]=_0x612a7e[_0xfda0('0x15')];this[_0xfda0('0x16')]=initializeSummary();this[_0xfda0('0x17')]={};ami['on']('queuesummary',this['syncQueueSummary'][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x19'),this[_0xfda0('0x1a')][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x1b'),this[_0xfda0('0x1c')][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x1d'),this[_0xfda0('0x1e')][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x1f'),this[_0xfda0('0x20')]['bind'](this));ami['on']('queuecallerabandon',this[_0xfda0('0x21')][_0xfda0('0x18')](this));ami['on']('queuecallerleave',this[_0xfda0('0x22')][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x23'),this[_0xfda0('0x24')][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x25'),this[_0xfda0('0x26')][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x27'),this[_0xfda0('0x28')][_0xfda0('0x18')](this));ami['on']('hangup',this[_0xfda0('0x29')]['bind'](this));ami['on'](_0xfda0('0x2a'),this['syncFullyBooted'][_0xfda0('0x18')](this));ami['on']('musiconholdstart',this[_0xfda0('0x2b')][_0xfda0('0x18')](this));ami['on'](_0xfda0('0x2c'),this[_0xfda0('0x2d')]['bind'](this));ami['on'](_0xfda0('0x2e'),this[_0xfda0('0x2f')]['bind'](this));ami['on']('blindtransfer',this[_0xfda0('0x30')][_0xfda0('0x18')](this));this[_0xfda0('0x31')]();this[_0xfda0('0x32')]();}function clearChannels(_0x4416f3){if(!_[_0xfda0('0x33')](_0x4416f3)){for(var _0x212d68 in _0x4416f3){if(_0x4416f3[_0xfda0('0x34')](_0x212d68)){delete _0x4416f3[_0x212d68];}}}}function clearCampaigns(_0x244ea9){if(!_['isEmpty'](_0x244ea9)){for(var _0x120913 in _0x244ea9){if(_0x244ea9[_0xfda0('0x34')](_0x120913)){_0x244ea9[_0x120913][_0xfda0('0x35')]=0x0;}}}}function clearVoiceQueues(_0x2172f5){if(!_[_0xfda0('0x33')](_0x2172f5)){for(var _0x372443 in _0x2172f5){if(_0x2172f5[_0xfda0('0x34')](_0x372443)){_0x2172f5[_0x372443]['originated']=0x0;_0x2172f5[_0x372443][_0xfda0('0x36')]=0x0;_0x2172f5[_0x372443][_0xfda0('0x37')]=0x0;_0x2172f5[_0x372443][_0xfda0('0x38')]=0x0;_0x2172f5[_0x372443][_0xfda0('0x39')]=!![];}}}}function clearAgentBooked(_0x206b5b){if(!_[_0xfda0('0x33')](_0x206b5b)){for(var _0x29941b in _0x206b5b){if(_0x206b5b[_0xfda0('0x34')](_0x29941b)){_0x206b5b[_0x29941b]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x12cd7b){return _0x12cd7b['queuecallerexit']||_0x12cd7b['queuecallerabandon']||_0x12cd7b[_0xfda0('0x3a')];}VoiceQueueReport['prototype'][_0xfda0('0x3b')]=function(){var _0x3454b5=this;for(var _0x39874e in this['channels']){if(this[_0xfda0('0x12')][_0xfda0('0x34')](_0x39874e)&&!this[_0xfda0('0x12')][_0x39874e]['switch']){this['sequence'][_0xfda0('0xb')](function(){if(!_['isNil'](_0x3454b5[_0xfda0('0x12')][_0x39874e])){return ami[_0xfda0('0x3c')]({'action':_0xfda0('0x3d'),'channel':_0x3454b5[_0xfda0('0x12')][_0x39874e][_0xfda0('0x3e')]})[_0xfda0('0x3f')](function(_0x4e350f){if(_0x4e350f[_0xfda0('0x40')]===_0xfda0('0x41')){setTimeout(function(){if(_0x3454b5[_0xfda0('0x12')][_0x39874e]){delete _0x3454b5[_0xfda0('0x12')][_0x39874e];logger['error'](_0xfda0('0x42'),_0x39874e,util['inspect'](_0x4e350f,{'showHidden':![],'depth':null}));}if(_0x3454b5[_0xfda0('0xf')][_0x39874e]){delete _0x3454b5[_0xfda0('0xf')][_0x39874e];logger['error'](_0xfda0('0x43'),_0x39874e,util[_0xfda0('0x44')](_0x4e350f,{'showHidden':![],'depth':null}));}if(_0x3454b5[_0xfda0('0x17')][_0x39874e]){delete _0x3454b5[_0xfda0('0x17')][_0x39874e];logger['error'](_0xfda0('0x45'),_0x39874e,util['inspect'](_0x4e350f,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xfda0('0x46')]=function(){logger[_0xfda0('0x47')](_0xfda0('0x48'));clearChannels(this[_0xfda0('0x12')]);this['clearQueueReport'](this[_0xfda0('0xf')]);clearAgentBooked(this[_0xfda0('0x11')]);clearVoiceQueues(this[_0xfda0('0x14')]);clearCampaigns(this[_0xfda0('0x15')]);this['summary']=initializeSummary();};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x4a')]=function(_0x435daf){var _0x349058=this;if(!_[_0xfda0('0x33')](_0x435daf)){for(var _0x53ba4b in _0x435daf){if(_0x435daf[_0xfda0('0x34')](_0x53ba4b)){_0x349058[_0xfda0('0x4b')](_0x435daf[_0x53ba4b],'clearqueuereport');delete _0x435daf[_0x53ba4b];}}}};VoiceQueueReport['prototype'][_0xfda0('0x4c')]=function(_0x5214a5,_0x617d80,_0x217bbc){io['to'](_0x5214a5)[_0xfda0('0x4c')](_0x617d80,_0x217bbc);};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x4d')]=function(_0x598558,_0x161fc4){logger[_0xfda0('0x4e')](_0xfda0('0x4f')+_0x161fc4+_0xfda0('0x50'),_0x598558[_0xfda0('0x51')],util[_0xfda0('0x44')](_0x598558,{'showHidden':![],'depth':null}));this[_0xfda0('0x4c')](util[_0xfda0('0x52')](_0xfda0('0x53'),_0x598558[_0xfda0('0x54')]),_0xfda0('0x55'),_0x598558);io[_0xfda0('0x4c')]('voice_queue_presence:save',_0x598558);};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x4b')]=function(_0x4d6d86,_0x35bc66){logger['debug'](_0xfda0('0x4f')+_0x35bc66+_0xfda0('0x56'),_0x4d6d86['uniqueid'],util[_0xfda0('0x44')](_0x4d6d86,{'showHidden':![],'depth':null}));if(_0x4d6d86[_0xfda0('0x57')]==='ATTENDEDTRANSFER'){return;}this['emit'](util[_0xfda0('0x52')](_0xfda0('0x53'),_0x4d6d86[_0xfda0('0x54')]),_0xfda0('0x58'),_0x4d6d86);io['emit']('voice_queue_presence:remove',_0x4d6d86);};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x59')]=function(_0x3ff076){if(_0x3ff076[_0xfda0('0x5a')]===_0xfda0('0x5b')){logger[_0xfda0('0x4e')](_0xfda0('0x5c'),util[_0xfda0('0x44')](_0x3ff076,{'showHidden':![],'depth':null}));this[_0xfda0('0x4c')](util['format'](_0xfda0('0x53'),_0x3ff076['name']),'voice_queue:save',_0x3ff076);}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x5d')]=function(_0x3ea764){return _0x3ea764!==null&&!_['isUndefined'](_0x3ea764);};VoiceQueueReport[_0xfda0('0x49')]['loopQueueShow']=function(){var _0x1b9f12=this;setInterval(function(){_0x1b9f12[_0xfda0('0x3b')]();ami[_0xfda0('0x3c')]({'action':'queues'})[_0xfda0('0x3f')](function(_0x1cca66){logger[_0xfda0('0x47')](_0xfda0('0x5e'),util[_0xfda0('0x44')](_0x1cca66,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x31')]=function(){var _0x45909f=this;setInterval(function(){if(!_0x45909f['summary'][_0xfda0('0x5f')]){return ami['Action']({'action':_0xfda0('0x60')})[_0xfda0('0x61')](function(_0x232e91){_0x45909f[_0xfda0('0x16')]['id']=_0x232e91[_0xfda0('0x62')];_0x45909f[_0xfda0('0x16')]['isRunning']=!![];_0x45909f[_0xfda0('0x16')]['queuestatus'][_0x232e91['actionid']]={};})[_0xfda0('0x3f')](function(_0x7b18ad){logger[_0xfda0('0x47')](_0xfda0('0x63'),util['inspect'](_0x7b18ad,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xfda0('0x64')]=function(_0x42a001,_0x13918d){var _0x2c0f72;if(this[_0xfda0('0x16')]&&this[_0xfda0('0x16')][_0xfda0('0x65')]&&this[_0xfda0('0x16')][_0xfda0('0x65')][_0x42a001[_0xfda0('0x66')]]){_0x2c0f72=this[_0xfda0('0x16')][_0xfda0('0x65')][_0x42a001[_0xfda0('0x66')]][_0xfda0('0x67')];}var _0x1eed11=new VoiceQueueSummary(_0x42a001);return _0x1eed11['createReport'](_0x13918d['agents'],this[_0xfda0('0x11')],_0x2c0f72,this[_0xfda0('0x10')][_0xfda0('0x12')]);};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x68')]=function(_0x121fbf,_0x5f39d9){var _0x76947c=this[_0xfda0('0x64')](_0x121fbf,_0x5f39d9);var _0x563564=![];_0x563564=_0x76947c[_0xfda0('0x69')](_0x121fbf);if(_0x563564){Object[_0xfda0('0x6a')](_0x121fbf,_0x76947c);this['realtime'][_0xfda0('0x14')][_0x121fbf['name']]=_0x121fbf;this[_0xfda0('0x59')](_0x76947c);}};VoiceQueueReport['prototype'][_0xfda0('0x1e')]=function(_0x53167a){var _0x5a902e=null;var _0x12de68=this[_0xfda0('0x16')]['id'];if(this[_0xfda0('0x16')][_0xfda0('0x6b')][_0x12de68]){_0x5a902e=this[_0xfda0('0x16')][_0xfda0('0x6b')][_0x12de68][_0x53167a[_0xfda0('0x62')]];}if(!_0x5a902e){this['summary']=initializeSummary();return;}var _0x4e808c=this['voiceQueues'][_0x5a902e['queue']];if(_0x4e808c[_0xfda0('0x5a')]===_0xfda0('0x5b')){this[_0xfda0('0x68')](_0x4e808c,_0x5a902e);}else if(_0x4e808c['type']===_0xfda0('0x6c')){var _0x56f325=this[_0xfda0('0x64')](_0x4e808c,_0x5a902e);ami[_0xfda0('0x4c')](_0xfda0('0x6d'),_0x56f325);}this['summary']['statusRequests']-=0x1;var _0x166520=this[_0xfda0('0x16')][_0xfda0('0x6e')]>0x0?!![]:![];if(!_0x166520){return this[_0xfda0('0x1a')](this['summary'][_0xfda0('0x6f')]);}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x1c')]=function(_0x43e4da){var _0x1ae019=this[_0xfda0('0x16')]['id'];if(this['summary'][_0xfda0('0x6b')][_0x1ae019]&&this['summary'][_0xfda0('0x6b')][_0x1ae019][_0x43e4da[_0xfda0('0x62')]]){this[_0xfda0('0x16')][_0xfda0('0x6b')][_0x1ae019][_0x43e4da[_0xfda0('0x62')]]['agents'][_0xfda0('0x70')](_0x43e4da);}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x71')]=function(_0x1386fe){var _0x15bbc6=this;try{if(this[_0xfda0('0x5d')](_0x1386fe)&&this[_0xfda0('0x5d')](_0x1386fe[_0xfda0('0x54')])){logger[_0xfda0('0x4e')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xfda0('0x44')](_0x1386fe,{'showHidden':![],'depth':null}));var _0xce4a5c=this[_0xfda0('0x14')][_0x1386fe[_0xfda0('0x54')]];if(_0xce4a5c){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0xce4a5c[_0xfda0('0x66')]);this['summary'][_0xfda0('0x65')][_0xce4a5c[_0xfda0('0x66')]]={'summaryEvent':_0x1386fe};this['summary']['statusRequests']+=0x1;return ami[_0xfda0('0x3c')]({'action':_0xfda0('0x6b'),'queue':_0xce4a5c[_0xfda0('0x66')]})[_0xfda0('0x61')](function(_0x9989fd){if(!_0x15bbc6['summary']['queuestatus'][_0x1386fe[_0xfda0('0x62')]]){_0x15bbc6['summary'][_0xfda0('0x6b')][_0x1386fe[_0xfda0('0x62')]]={};}_0x15bbc6[_0xfda0('0x16')]['queuestatus'][_0x1386fe[_0xfda0('0x62')]][_0x9989fd[_0xfda0('0x62')]]={'queue':_0xce4a5c[_0xfda0('0x66')],'agents':[]};})[_0xfda0('0x3f')](function(_0x1e5240){throw _0x1e5240;});}}}catch(_0x4f8294){logger['error'](_0xfda0('0x63'),util[_0xfda0('0x44')](_0x4f8294,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfda0('0x1a')]=function(_0x481010){if(this[_0xfda0('0x16')]['statusRequests']>0x0){this[_0xfda0('0x16')][_0xfda0('0x6f')]=_0x481010;return;}logger[_0xfda0('0x4e')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xfda0('0x44')](_0x481010,{'showHidden':![],'depth':null}));this[_0xfda0('0x16')]=initializeSummary();ami['emit'](_0xfda0('0x72'),{});};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x20')]=function(_0xa73994){try{if(this[_0xfda0('0x5d')](_0xa73994)){logger[_0xfda0('0x4e')](_0xfda0('0x73'),_0xa73994['uniqueid'],util['inspect'](_0xa73994,{'showHidden':![],'depth':null}));if(_[_0xfda0('0x74')](this[_0xfda0('0xf')][_0xa73994['uniqueid']])){this[_0xfda0('0xf')][_0xa73994[_0xfda0('0x51')]]=[];}if(_[_0xfda0('0x74')](this[_0xfda0('0x12')][_0xa73994[_0xfda0('0x51')]])){this[_0xfda0('0x12')][_0xa73994[_0xfda0('0x51')]]={};}var _0x12de3f=new QueueReport();_0x12de3f[_0xfda0('0x54')]=_0xa73994[_0xfda0('0x54')];_0x12de3f['type']=this[_0xfda0('0x14')][_0x12de3f['queue']]&&this[_0xfda0('0x14')][_0x12de3f[_0xfda0('0x54')]][_0xfda0('0x5a')]?this[_0xfda0('0x14')][_0x12de3f[_0xfda0('0x54')]][_0xfda0('0x5a')]||_0xfda0('0x5b'):_0xfda0('0x5b');_0x12de3f[_0xfda0('0x75')]=moment()[_0xfda0('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x12de3f[_0xfda0('0x76')]=_0xa73994[_0xfda0('0x76')];_0x12de3f['count']=_0xa73994[_0xfda0('0x77')];_0x12de3f[_0xfda0('0x51')]=_0xa73994['uniqueid'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x12de3f[_0xfda0('0x54')],_0x12de3f[_0xfda0('0x5a')]);Object['assign'](_0x12de3f,_[_0xfda0('0x78')](_0xa73994,_[_0xfda0('0x79')](_0x12de3f)));this[_0xfda0('0xf')][_0xa73994[_0xfda0('0x51')]]['push'](_0x12de3f);this['channels'][_0xa73994[_0xfda0('0x51')]]=_0x12de3f;this[_0xfda0('0x4d')](_0x12de3f,_0xfda0('0x1f'));}}catch(_0x22f0b5){logger['error'](_0xfda0('0x73'),_0xa73994[_0xfda0('0x51')],util[_0xfda0('0x44')](_0x22f0b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x21')]=function(_0x5dffe2){try{if(this[_0xfda0('0x5d')](_0x5dffe2)){logger['debug'](_0xfda0('0x7a'),_0x5dffe2['uniqueid'],util[_0xfda0('0x44')](_0x5dffe2,{'showHidden':![],'depth':null}));if(this[_0xfda0('0xf')][_0x5dffe2['uniqueid']]){var _0x56f285=_['last'](this[_0xfda0('0xf')][_0x5dffe2[_0xfda0('0x51')]]);_0x56f285[_0xfda0('0x3a')]=![];_0x56f285[_0xfda0('0x7b')]=null;_0x56f285[_0xfda0('0x7c')]=_0x5dffe2['holdtime'];_0x56f285[_0xfda0('0x7d')]=_0x5dffe2[_0xfda0('0x7d')];_0x56f285['queuecallerabandon']=!![];_0x56f285['queuecallerabandonAt']=moment()[_0xfda0('0x52')](_0xfda0('0x7e'));_0x56f285[_0xfda0('0x57')]=_0xfda0('0x7f');_0x56f285[_0xfda0('0x80')]=null;logger[_0xfda0('0x81')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x56f285[_0xfda0('0x54')],_0x56f285[_0xfda0('0x5a')]);this[_0xfda0('0x12')][_0x5dffe2[_0xfda0('0x51')]]=_0x56f285;this['emitVoiceQueueChannelRemove'](_0x56f285,_0xfda0('0x82'));}}}catch(_0x5d752f){logger[_0xfda0('0x47')](_0xfda0('0x7a'),_0x5dffe2[_0xfda0('0x51')],util['inspect'](_0x5d752f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfda0('0x22')]=function(_0x4b2411){try{if(this[_0xfda0('0x5d')](_0x4b2411)){logger[_0xfda0('0x4e')](_0xfda0('0x83'),_0x4b2411[_0xfda0('0x51')],util[_0xfda0('0x44')](_0x4b2411,{'showHidden':![],'depth':null}));if(this[_0xfda0('0xf')][_0x4b2411[_0xfda0('0x51')]]){var _0xf6a7c0=_['last'](this['queueReports'][_0x4b2411[_0xfda0('0x51')]]);_0xf6a7c0['queuecallerleaveAt']=moment()[_0xfda0('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0xf6a7c0[_0xfda0('0x84')]=_0x4b2411[_0xfda0('0x84')];_0xf6a7c0[_0xfda0('0x85')]=_0x4b2411[_0xfda0('0x85')];logger[_0xfda0('0x81')](_0xfda0('0x86'),_0xf6a7c0['queue'],_0xf6a7c0[_0xfda0('0x5a')],_0x4b2411[_0xfda0('0x84')],_0x4b2411['connectedlinename']);this[_0xfda0('0x12')][_0x4b2411[_0xfda0('0x51')]]=_0xf6a7c0;this[_0xfda0('0x4d')](_0xf6a7c0,_0xfda0('0x87'));}}}catch(_0x1f109a){logger[_0xfda0('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x4b2411[_0xfda0('0x51')],util['inspect'](_0x1f109a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x26')]=function(_0x28c98a){try{if(this[_0xfda0('0x5d')](_0x28c98a)){logger[_0xfda0('0x4e')](_0xfda0('0x88'),_0x28c98a[_0xfda0('0x51')],util[_0xfda0('0x44')](_0x28c98a,{'showHidden':![],'depth':null}));if(this[_0xfda0('0xf')][_0x28c98a[_0xfda0('0x51')]]){var _0x26c588=_['last'](this[_0xfda0('0xf')][_0x28c98a['uniqueid']]);_0x26c588[_0xfda0('0x3a')]=!![];_0x26c588[_0xfda0('0x57')]=_0xfda0('0x89');logger[_0xfda0('0x81')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x26c588['queue'],_0x26c588[_0xfda0('0x5a')]);}}}catch(_0x59e5e2){logger[_0xfda0('0x47')](_0xfda0('0x88'),_0x28c98a[_0xfda0('0x51')],util[_0xfda0('0x44')](_0x59e5e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x24')]=function(_0x19b58f){try{if(this[_0xfda0('0x5d')](_0x19b58f)){logger['debug'](_0xfda0('0x8a'),_0x19b58f[_0xfda0('0x51')],util[_0xfda0('0x44')](_0x19b58f,{'showHidden':![],'depth':null}));if(this[_0xfda0('0xf')][_0x19b58f[_0xfda0('0x51')]]){var _0x2cdafd=_['last'](this[_0xfda0('0xf')][_0x19b58f[_0xfda0('0x51')]]);_0x2cdafd[_0xfda0('0x82')]=![];_0x2cdafd[_0xfda0('0x8b')]=null;_0x2cdafd['assigned']=!![];_0x2cdafd['lastAssignedTo']=_0x19b58f[_0xfda0('0x8c')];_0x2cdafd['holdtime']=_0x19b58f[_0xfda0('0x7c')];_0x2cdafd[_0xfda0('0x3a')]=!![];_0x2cdafd[_0xfda0('0x8d')]=![];_0x2cdafd['queuecallerexitAt']=null;if(!_0x2cdafd['transfer']){if(_0x19b58f[_0xfda0('0x8e')]==_0xfda0('0x8f')){_0x2cdafd[_0xfda0('0x57')]=_0xfda0('0x90');logger[_0xfda0('0x81')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2cdafd[_0xfda0('0x54')],_0x2cdafd['type']);}else{if(_[_0xfda0('0x91')](_0x19b58f[_0xfda0('0x3e')][_0xfda0('0x92')](),_0xfda0('0x93'))){if(this[_0xfda0('0xf')][_0x19b58f[_0xfda0('0x94')]]){var _0x90136a=_[_0xfda0('0x95')](this[_0xfda0('0xf')][_0x19b58f[_0xfda0('0x94')]]);_0x90136a[_0xfda0('0x3a')]=![];_0x90136a[_0xfda0('0x8d')]=!![];_0x90136a[_0xfda0('0x96')]=moment(_0x2cdafd[_0xfda0('0x75')])['add'](_0x19b58f['holdtime'],'seconds')[_0xfda0('0x52')](_0xfda0('0x7e'));_0x90136a[_0xfda0('0x57')]=_0xfda0('0x97');_0x90136a['transfer']=!![];_0x90136a[_0xfda0('0x98')]=_0xfda0('0x99');_0x90136a[_0xfda0('0x9a')]=_0x19b58f['destexten'];_0x90136a['transferuniqueid']=_0x19b58f[_0xfda0('0x51')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x90136a[_0xfda0('0x54')],_0x90136a[_0xfda0('0x5a')]);var _0x1a15e5=this[_0xfda0('0xf')][_0x19b58f[_0xfda0('0x94')]];this['queueReports'][_0x19b58f[_0xfda0('0x94')]]=this[_0xfda0('0xf')][_0x19b58f[_0xfda0('0x51')]];this['queueReports'][_0x19b58f[_0xfda0('0x51')]]=_0x1a15e5;}}else{_0x2cdafd[_0xfda0('0x57')]=_0xfda0('0x9b')+_0x19b58f[_0xfda0('0x8e')][_0xfda0('0x9c')]();logger[_0xfda0('0x81')](_0xfda0('0x9d'),_0x2cdafd['queue'],_0x2cdafd[_0xfda0('0x5a')],_0x2cdafd[_0xfda0('0x57')]);}}}this[_0xfda0('0x12')][_0x19b58f['uniqueid']]=_0x2cdafd;}}}catch(_0x3eb03c){logger[_0xfda0('0x47')](_0xfda0('0x8a'),_0x19b58f['uniqueid'],util[_0xfda0('0x44')](_0x3eb03c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0x28')]=function(_0x592b34){try{if(this['isNotNull'](_0x592b34)){logger[_0xfda0('0x4e')](_0xfda0('0x9e'),_0x592b34[_0xfda0('0x51')],util['inspect'](_0x592b34,{'showHidden':![],'depth':null}));this['addVariable'](_0x592b34[_0xfda0('0x51')],_[_0xfda0('0x79')](_0x592b34['variable'])[0x0],_0x592b34[_0xfda0('0x9f')]);if(this['queueReports'][_0x592b34[_0xfda0('0x51')]]){var _0x327d89=_[_0xfda0('0x95')](this[_0xfda0('0xf')][_0x592b34[_0xfda0('0x51')]]);if(_0x327d89){if(this[_0xfda0('0x5d')](_0x592b34[_0xfda0('0xa0')])&&this[_0xfda0('0x5d')](_0x592b34[_0xfda0('0xa0')][_0xfda0('0x6b')])){switch(_0x592b34[_0xfda0('0x9f')]){case _0xfda0('0xa1'):_0x327d89['queuecallerexit']=![];_0x327d89[_0xfda0('0x96')]=null;break;case _0xfda0('0xa2'):_0x327d89[_0xfda0('0xa3')]=_0xfda0('0xa4');_0x327d89[_0xfda0('0x8d')]=!![];_0x327d89[_0xfda0('0x96')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x327d89[_0xfda0('0xa5')]=moment()['format'](_0xfda0('0x7e'));logger[_0xfda0('0x4e')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x592b34[_0xfda0('0x51')],util[_0xfda0('0x44')](_0x327d89,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x327d89);break;default:_0x327d89[_0xfda0('0x8d')]=!![];_0x327d89[_0xfda0('0x96')]=moment()[_0xfda0('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x327d89[_0xfda0('0xa5')]=moment()[_0xfda0('0x52')]('YYYY-MM-DD\x20HH:mm:ss');}_0x327d89['queuecallerabandon']=![];_0x327d89[_0xfda0('0x8b')]=null;_0x327d89['queuecallerexitreason']=_0x592b34[_0xfda0('0x9f')];this[_0xfda0('0x12')][_0x592b34[_0xfda0('0x51')]]=_0x327d89;this[_0xfda0('0x4b')](_0x327d89,_0xfda0('0x27'));}else if(this[_0xfda0('0x5d')](_0x592b34['variable'])&&this[_0xfda0('0x5d')](_0x592b34[_0xfda0('0xa0')][_0xfda0('0xa6')])){if(!_0x327d89[_0xfda0('0x82')]){_0x327d89[_0xfda0('0x8d')]=!![];_0x327d89['queuecallerexitAt']=moment()['format'](_0xfda0('0x7e'));_0x327d89['queuecallerexitreason']=_0xfda0('0xa7');_0x327d89['queuecallerleaveAt']=moment()['format'](_0xfda0('0x7e'));this[_0xfda0('0x12')][_0x592b34[_0xfda0('0x51')]]=_0x327d89;}}logger[_0xfda0('0x81')](_0xfda0('0xa8'),_0x592b34['uniqueid'],_0x327d89['queue'],_0x327d89[_0xfda0('0x5a')],_[_0xfda0('0x79')](_0x592b34[_0xfda0('0xa0')])[0x0],_0x592b34[_0xfda0('0x9f')]);_0x327d89['variables']=this[_0xfda0('0x17')][_0x592b34['uniqueid']];}}}}catch(_0x42efff){logger[_0xfda0('0x47')](_0xfda0('0x9e'),_0x592b34[_0xfda0('0x51')],util['inspect'](_0x42efff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfda0('0x49')][_0xfda0('0xa9')]=function(_0x5bafc4,_0x2edd14,_0xd0ed11){var _0x59c6d6=['rtpaudioqos',_0xfda0('0xaa'),_0xfda0('0xab'),_0xfda0('0xac'),_0xfda0('0xad'),_0xfda0('0xae'),_0xfda0('0xaf'),'rtpaudioqosrttbridged',_0xfda0('0xb0'),_0xfda0('0xb1'),_0xfda0('0xb2'),_0xfda0('0xb3'),_0xfda0('0xb4'),_0xfda0('0xb5'),_0xfda0('0xb6'),_0xfda0('0xb7'),_0xfda0('0x8c'),_0xfda0('0xb8'),_0xfda0('0xb9')];if(!_[_0xfda0('0xba')](_0x2edd14)&&!_[_0xfda0('0xbb')](_0x59c6d6,_0x2edd14)){if(_[_0xfda0('0x74')](this[_0xfda0('0x17')][_0x5bafc4])){this[_0xfda0('0x17')][_0x5bafc4]={};}this[_0xfda0('0x17')][_0x5bafc4][_0x2edd14]=_0xd0ed11;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x4ebf47,_0x2ea494,_0x3c4f77){try{var _0x565bc0={};if(this['queueReports'][_0x4ebf47]){for(var _0x5ce471=0x0;_0x5ce471{delete this['channels'][_0x2eb3f9];},_0xeaee46);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index eaaf4df..742783a 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x282c=['Request','CreateReportAgentPreview','createHistory','queue'];(function(_0x4ae2c6,_0xb24392){var _0x4d521b=function(_0x543ff5){while(--_0x543ff5){_0x4ae2c6['push'](_0x4ae2c6['shift']());}};_0x4d521b(++_0xb24392);}(_0x282c,0x9e));var _0xc282=function(_0x3a0d65,_0x371f38){_0x3a0d65=_0x3a0d65-0x0;var _0xcb8c8e=_0x282c[_0x3a0d65];return _0xcb8c8e;};'use strict';var client=require('../client');exports[_0xc282('0x0')]=function(_0x59549a){return function(){_0x59549a['campaign']=_0x59549a[_0xc282('0x1')];return client[_0xc282('0x2')](_0xc282('0x3'),{'body':_0x59549a,'log':_0xc282('0x3')});};}; \ No newline at end of file +var _0x8807=['campaign','queue','Request','../client'];(function(_0x4d7c4e,_0xb2274a){var _0x1e99db=function(_0x250b66){while(--_0x250b66){_0x4d7c4e['push'](_0x4d7c4e['shift']());}};_0x1e99db(++_0xb2274a);}(_0x8807,0x16b));var _0x7880=function(_0x3230ab,_0x46eac4){_0x3230ab=_0x3230ab-0x0;var _0x486975=_0x8807[_0x3230ab];return _0x486975;};'use strict';var client=require(_0x7880('0x0'));exports['createHistory']=function(_0x454c3f){return function(){_0x454c3f[_0x7880('0x1')]=_0x454c3f[_0x7880('0x2')];return client[_0x7880('0x3')]('CreateReportAgentPreview',{'body':_0x454c3f,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 9bd24da..355005e 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94e6=['Request','CreateAttachment','../client'];(function(_0x314813,_0x2f5f74){var _0x3d7b4d=function(_0x268221){while(--_0x268221){_0x314813['push'](_0x314813['shift']());}};_0x3d7b4d(++_0x2f5f74);}(_0x94e6,0x194));var _0x694e=function(_0x5bb110,_0x4e6bb1){_0x5bb110=_0x5bb110-0x0;var _0x2d211c=_0x94e6[_0x5bb110];return _0x2d211c;};'use strict';var client=require(_0x694e('0x0'));exports['create']=function(_0x32423f){return client[_0x694e('0x1')](_0x694e('0x2'),{'body':_0x32423f,'log':_0x694e('0x2')});}; \ No newline at end of file +var _0xb63b=['Request','CreateAttachment','../client','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb63b,0x106));var _0xbb63=function(_0x4e2c78,_0x2266b1){_0x4e2c78=_0x4e2c78-0x0;var _0x4c61ad=_0xb63b[_0x4e2c78];return _0x4c61ad;};'use strict';var client=require(_0xbb63('0x0'));exports[_0xbb63('0x1')]=function(_0x23f918){return client[_0xbb63('0x2')](_0xbb63('0x3'),{'body':_0x23f918,'log':_0xbb63('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index a38313c..67749be 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x5044fa,_0x3ea92b){var _0x2427ae=function(_0x29db45){while(--_0x29db45){_0x5044fa['push'](_0x5044fa['shift']());}};_0x2427ae(++_0x3ea92b);}(_0x326f,0xd1));var _0xf326=function(_0x3acf84,_0x55fccf){_0x3acf84=_0x3acf84-0x0;var _0x1ab9c6=_0x326f[_0x3acf84];return _0x1ab9c6;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x37634e,_0x2dae9c){var _0x40a92e=function(_0x2d188e){while(--_0x2d188e){_0x37634e['push'](_0x37634e['shift']());}};_0x40a92e(++_0x2dae9c);}(_0xadb5,0xad));var _0x5adb=function(_0xf2e186,_0x316ee4){_0xf2e186=_0xf2e186-0x0;var _0xb05b91=_0xadb5[_0xf2e186];return _0xb05b91;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 04b92a0..a7a216d 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac7c=['createContact','getContacts','GetCmContact'];(function(_0x4c5770,_0x48b574){var _0x303251=function(_0x2be7a1){while(--_0x2be7a1){_0x4c5770['push'](_0x4c5770['shift']());}};_0x303251(++_0x48b574);}(_0xac7c,0x126));var _0xcac7=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0xac7c[_0x1a8ff0];return _0x3588bf;};'use strict';var client=require('../client');exports[_0xcac7('0x0')]=function(_0x14a247){return function(){return client['Request']('CreateCmContact',{'body':_0x14a247,'log':'CreateCmContact'});};};exports[_0xcac7('0x1')]=function(_0x376590){return function(){return client['Request'](_0xcac7('0x2'),{'options':_0x376590,'log':'GetCmContact'});};}; \ No newline at end of file +var _0xe263=['Request','CreateCmContact','getContacts','GetCmContact','../client'];(function(_0x4e0aea,_0x4756a9){var _0xc51393=function(_0x5f47bd){while(--_0x5f47bd){_0x4e0aea['push'](_0x4e0aea['shift']());}};_0xc51393(++_0x4756a9);}(_0xe263,0xdb));var _0x3e26=function(_0x10de46,_0x84d8b3){_0x10de46=_0x10de46-0x0;var _0x59e314=_0xe263[_0x10de46];return _0x59e314;};'use strict';var client=require(_0x3e26('0x0'));exports['createContact']=function(_0x3b09f3){return function(){return client[_0x3e26('0x1')](_0x3e26('0x2'),{'body':_0x3b09f3,'log':'CreateCmContact'});};};exports[_0x3e26('0x3')]=function(_0x16e206){return function(){return client['Request'](_0x3e26('0x4'),{'options':_0x16e206,'log':_0x3e26('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index d462074..84dc1c9 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x029b=['countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','name','Queue','getContactRecallMe','GetContactRecallMe','YYYY-MM-DD\x20HH:mm:ss','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','GetCmHopper','CmContact','updateContacts','Request','format','UpdateCmHopper','ListId','VoiceQueueId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','Contact','GetContactDialerIvr','moveContactManagedDialer','campaign','CampaignId','MoveContactManagedDialer','CountReScheduled'];(function(_0x23829c,_0x504b88){var _0x5b99e3=function(_0x38cf5a){while(--_0x38cf5a){_0x23829c['push'](_0x23829c['shift']());}};_0x5b99e3(++_0x504b88);}(_0x029b,0x66));var _0xb029=function(_0x472987,_0x4e9c48){_0x472987=_0x472987-0x0;var _0x340103=_0x029b[_0x472987];return _0x340103;};'use strict';var client=require(_0xb029('0x0'));var moment=require(_0xb029('0x1'));exports['getContacts']=function(_0x27c0b6,_0x2e71f6){return function(){return client['Request'](_0xb029('0x2'),{'options':{'where':{'VoiceQueueId':_0x27c0b6},'include':[{'model':_0xb029('0x3'),'as':'Contact'}],'limit':_0x2e71f6,'raw':![]},'log':'getCmHopper'});};};exports[_0xb029('0x4')]=function(_0x3f8fe4,_0x7836f0,_0x448fc5){return function(){return client[_0xb029('0x5')]('UpdateCmHopper',{'body':_0x3f8fe4,'options':{'where':{'VoiceQueueId':_0x7836f0,'scheduledat':{'$lte':moment()[_0xb029('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x448fc5},'log':_0xb029('0x7')});};};exports['rescheduleContact']=function(_0x2c3772){return client['Request'](_0xb029('0x7'),{'body':_0x2c3772,'options':{'where':{'ContactId':_0x2c3772['ContactId'],'ListId':_0x2c3772[_0xb029('0x8')],'VoiceQueueId':_0x2c3772[_0xb029('0x9')],'CampaignId':_0x2c3772['CampaignId']}},'log':_0xb029('0xa')});};exports[_0xb029('0xb')]=function(_0x2532d4,_0x3abf90,_0x4399d2){return function(){return client['Request'](_0xb029('0xc'),{'options':{'where':{'VoiceQueueId':_0x2532d4,'ListId':_0x3abf90,'ContactId':_0x4399d2}},'log':'DestroyCmHopper'});};};exports[_0xb029('0xd')]=function(_0x3d9ed9,_0x18e228,_0x8dfbf1,_0x5ce391){return client[_0xb029('0x5')](_0xb029('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3d9ed9,'active':![],'scheduledat':{'$lte':moment()[_0xb029('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x18e228}}]},'order':[[_0xb029('0xf'),_0xb029('0x10')],[_0xb029('0x11'),_0x5ce391],['id',_0xb029('0x12')]],'raw':!![],'limit':_0x8dfbf1},'log':_0xb029('0xe')});};exports[_0xb029('0x13')]=function(_0x185292,_0x1d54ff,_0x3f91cb){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x185292,'active':![],'scheduledat':{'$lte':moment()[_0xb029('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xb029('0x3'),'as':_0xb029('0x14')}],'order':[[_0xb029('0xf'),'DESC'],['scheduledat',_0x3f91cb],['id',_0xb029('0x12')]],'raw':!![],'limit':_0x1d54ff},'log':_0xb029('0x15')});};exports[_0xb029('0x16')]=function(_0x3381b2,_0x3c4396){_0x3381b2[_0xb029('0x17')]=_0x3381b2['queue'];return client['Request']('MoveContactManagedDialer',{'body':_0x3381b2,'options':{'where':{'ContactId':_0x3381b2['ContactId'],'ListId':_0x3381b2[_0xb029('0x8')],'VoiceQueueId':_0x3381b2[_0xb029('0x9')],'CampaignId':_0x3381b2[_0xb029('0x18')],'active':_0x3c4396?undefined:!![]}},'log':_0xb029('0x19')});};exports['countReScheduled']=function(_0x3642b5){return client[_0xb029('0x5')](_0xb029('0x1a'),{'options':{'where':{'VoiceQueueId':_0x3642b5['id']?_0x3642b5['id']||null:null}},'log':_0xb029('0x1b')});};exports[_0xb029('0x1c')]=function(_0x26bb54){return function(){return client[_0xb029('0x5')](_0xb029('0x1d'),{'options':{'where':{'id':_0x26bb54},'include':[{'model':_0xb029('0x3'),'as':_0xb029('0x14')},{'model':_0xb029('0x1e'),'as':_0xb029('0x1f'),'attributes':['id',_0xb029('0x20')]},{'model':'VoiceQueue','as':_0xb029('0x21'),'attributes':['id',_0xb029('0x20')]}],'raw':!![]},'log':'getCmHopper'});};};exports['unlockContact']=function(_0x112ce9,_0x3b030a,_0x334ce6){return client[_0xb029('0x5')](_0xb029('0x7'),{'body':_0x112ce9,'options':{'where':{'id':_0x3b030a},'limit':_0x334ce6},'log':'UpdateCmHopper'});};exports[_0xb029('0x22')]=function(_0x4a4100,_0x2b2d98){return function(){return client[_0xb029('0x5')](_0xb029('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4a4100,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0xb029('0x24'))},'UserId':{'$in':_0x2b2d98}},'order':[[_0xb029('0xf'),'DESC'],[_0xb029('0x11'),'DESC'],['id',_0xb029('0x12')]],'include':[{'model':'CmContact','as':_0xb029('0x14')},{'model':_0xb029('0x1e'),'as':_0xb029('0x1f'),'attributes':['id',_0xb029('0x20'),_0xb029('0x25')]}],'group':_0xb029('0x26'),'raw':!![]},'log':_0xb029('0xe')});};};exports[_0xb029('0x27')]=function(_0x4d5271,_0x2d87c1){return client[_0xb029('0x5')](_0xb029('0x28'),{'body':_0x4d5271,'options':_0x2d87c1||{},'log':'ResetActiveCalls'});};exports[_0xb029('0x29')]=function(_0x2b0f6b,_0x5f4688,_0x2f17b0){return function(){return client['Request'](_0xb029('0x2a'),{'body':{'where':{'voiceQueueIds':_0x2b0f6b,'interval':_0x5f4688,'availableAgentsIds':_0x2f17b0}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file +var _0x3c17=['GetCmHopper','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','VoiceQueueId','CampaignId','DestroyCmHopper','priority','scheduledat','GetContactDialer','getContactDialerIvr','DESC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','CmContact','User','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','ASC','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','Request'];(function(_0x5c568e,_0x47fcc3){var _0x5cd62c=function(_0x519739){while(--_0x519739){_0x5c568e['push'](_0x5c568e['shift']());}};_0x5cd62c(++_0x47fcc3);}(_0x3c17,0x1a1));var _0x73c1=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x3c17[_0x4d07cc];return _0x42de3b;};'use strict';var client=require(_0x73c1('0x0'));var moment=require('moment');exports[_0x73c1('0x1')]=function(_0x58a810,_0x1a088c){return function(){return client[_0x73c1('0x2')](_0x73c1('0x3'),{'options':{'where':{'VoiceQueueId':_0x58a810},'include':[{'model':'CmContact','as':_0x73c1('0x4')}],'limit':_0x1a088c,'raw':![]},'log':_0x73c1('0x5')});};};exports[_0x73c1('0x6')]=function(_0x64f862,_0x48c943,_0x382f82){return function(){return client['Request'](_0x73c1('0x7'),{'body':_0x64f862,'options':{'where':{'VoiceQueueId':_0x48c943,'scheduledat':{'$lte':moment()[_0x73c1('0x8')](_0x73c1('0x9'))}},'limit':_0x382f82},'log':'UpdateCmHopper'});};};exports['rescheduleContact']=function(_0x176227){return client[_0x73c1('0x2')](_0x73c1('0x7'),{'body':_0x176227,'options':{'where':{'ContactId':_0x176227[_0x73c1('0xa')],'ListId':_0x176227[_0x73c1('0xb')],'VoiceQueueId':_0x176227[_0x73c1('0xc')],'CampaignId':_0x176227[_0x73c1('0xd')]}},'log':'rescheduleContact'});};exports['destroyContact']=function(_0x1c712c,_0x81a06d,_0x16c616){return function(){return client[_0x73c1('0x2')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x1c712c,'ListId':_0x81a06d,'ContactId':_0x16c616}},'log':_0x73c1('0xe')});};};exports['getContactDialer']=function(_0x296ff0,_0x5f3799,_0x3a83ae,_0x3ecf5a){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x296ff0,'active':![],'scheduledat':{'$lte':moment()[_0x73c1('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x5f3799}}]},'order':[[_0x73c1('0xf'),'DESC'],[_0x73c1('0x10'),_0x3ecf5a],['id','ASC']],'raw':!![],'limit':_0x3a83ae},'log':_0x73c1('0x11')});};exports[_0x73c1('0x12')]=function(_0x39256e,_0x211c17,_0x8c0803){return client[_0x73c1('0x2')](_0x73c1('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x39256e,'active':![],'scheduledat':{'$lte':moment()[_0x73c1('0x8')](_0x73c1('0x9'))}},'include':[{'model':'CmContact','as':_0x73c1('0x4')}],'order':[[_0x73c1('0xf'),_0x73c1('0x13')],[_0x73c1('0x10'),_0x8c0803],['id','ASC']],'raw':!![],'limit':_0x211c17},'log':_0x73c1('0x14')});};exports[_0x73c1('0x15')]=function(_0x344fb5,_0x2e17e5){_0x344fb5[_0x73c1('0x16')]=_0x344fb5[_0x73c1('0x17')];return client[_0x73c1('0x2')](_0x73c1('0x18'),{'body':_0x344fb5,'options':{'where':{'ContactId':_0x344fb5['ContactId'],'ListId':_0x344fb5[_0x73c1('0xb')],'VoiceQueueId':_0x344fb5[_0x73c1('0xc')],'CampaignId':_0x344fb5[_0x73c1('0xd')],'active':_0x2e17e5?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0x73c1('0x19')]=function(_0x2ebfda){return client[_0x73c1('0x2')](_0x73c1('0x1a'),{'options':{'where':{'VoiceQueueId':_0x2ebfda['id']?_0x2ebfda['id']||null:null}},'log':_0x73c1('0x19')});};exports['getContactPreview']=function(_0x2b61bb){return function(){return client['Request']('GetCmHopperPreview',{'options':{'where':{'id':_0x2b61bb},'include':[{'model':_0x73c1('0x1b'),'as':_0x73c1('0x4')},{'model':_0x73c1('0x1c'),'as':_0x73c1('0x1d'),'attributes':['id',_0x73c1('0x1e')]},{'model':_0x73c1('0x1f'),'as':_0x73c1('0x20'),'attributes':['id',_0x73c1('0x1e')]}],'raw':!![]},'log':_0x73c1('0x5')});};};exports[_0x73c1('0x21')]=function(_0x22cc4f,_0x460b69,_0xf2bf43){return client[_0x73c1('0x2')]('UpdateCmHopper',{'body':_0x22cc4f,'options':{'where':{'id':_0x460b69},'limit':_0xf2bf43},'log':_0x73c1('0x7')});};exports[_0x73c1('0x22')]=function(_0x33b5bc,_0x153141){return function(){return client[_0x73c1('0x2')](_0x73c1('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x33b5bc,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x73c1('0x8')](_0x73c1('0x9'))},'UserId':{'$in':_0x153141}},'order':[[_0x73c1('0xf'),'DESC'],['scheduledat',_0x73c1('0x13')],['id',_0x73c1('0x24')]],'include':[{'model':_0x73c1('0x1b'),'as':_0x73c1('0x4')},{'model':'User','as':_0x73c1('0x1d'),'attributes':['id',_0x73c1('0x1e'),_0x73c1('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x73c1('0x11')});};};exports[_0x73c1('0x26')]=function(_0x5d0a84,_0x270f63){return client[_0x73c1('0x2')](_0x73c1('0x27'),{'body':_0x5d0a84,'options':_0x270f63||{},'log':'ResetActiveCalls'});};exports[_0x73c1('0x28')]=function(_0x407090,_0x359b2c,_0x770875){return function(){return client[_0x73c1('0x2')](_0x73c1('0x29'),{'body':{'where':{'voiceQueueIds':_0x407090,'interval':_0x359b2c,'availableAgentsIds':_0x770875}},'log':_0x73c1('0x28')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 22706df..f765c5f 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16b8=['VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x1b9e78,_0x2f63a6){var _0x24b3c6=function(_0x40b848){while(--_0x40b848){_0x1b9e78['push'](_0x1b9e78['shift']());}};_0x24b3c6(++_0x2f63a6);}(_0x16b8,0xe4));var _0x816b=function(_0x2b6e7c,_0xdb7ac4){_0x2b6e7c=_0x2b6e7c-0x0;var _0x29b018=_0x16b8[_0x2b6e7c];return _0x29b018;};'use strict';var client=require(_0x816b('0x0'));exports[_0x816b('0x1')]=function(_0x113b46,_0x14dbe3,_0x28f471){return client[_0x816b('0x2')](_0x816b('0x3'),{'body':_0x113b46,'reason':_0x14dbe3,'entity':_0x28f471,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x2fa1fe,_0x4ee089,_0x5ddf3d){return client[_0x816b('0x2')](_0x816b('0x4'),{'body':_0x2fa1fe,'duration':_0x4ee089,'waitTime':_0x5ddf3d,'log':'SwapAdditionalPhones'});};exports[_0x816b('0x5')]=function(_0x42f79f){return function(){return client[_0x816b('0x2')]('IncrementPreviewCounters',{'body':_0x42f79f,'log':_0x816b('0x6')});};}; \ No newline at end of file +var _0xbc1b=['Request','SwapAdditionalPhones','incrementPreviewCounters','../client','verifyAdditionalPhones','VerifyAdditionalPhones','swapAdditionalPhones'];(function(_0x5aca42,_0x58cd77){var _0x22e293=function(_0x266e28){while(--_0x266e28){_0x5aca42['push'](_0x5aca42['shift']());}};_0x22e293(++_0x58cd77);}(_0xbc1b,0x1df));var _0xbbc1=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xbc1b[_0xa79977];return _0x109f10;};'use strict';var client=require(_0xbbc1('0x0'));exports[_0xbbc1('0x1')]=function(_0x5283c5,_0x4ddc82,_0x444484){return client['Request'](_0xbbc1('0x2'),{'body':_0x5283c5,'reason':_0x4ddc82,'entity':_0x444484,'log':_0xbbc1('0x2')});};exports[_0xbbc1('0x3')]=function(_0x1c2679,_0x46d0f1,_0x1f5b95){return client[_0xbbc1('0x4')](_0xbbc1('0x5'),{'body':_0x1c2679,'duration':_0x46d0f1,'waitTime':_0x1f5b95,'log':_0xbbc1('0x5')});};exports[_0xbbc1('0x6')]=function(_0x43ed09){return function(){return client[_0xbbc1('0x4')]('IncrementPreviewCounters',{'body':_0x43ed09,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 23cbc02..20a111c 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6e1=['GetCmHopperBlack','VoiceQueueId','checkIsBlackListIvr','phone','GetCmHopperBlackIvr','checkIsBlackList','Request'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xc6e1,0x1b7));var _0x1c6e=function(_0x1d16cd,_0x4da176){_0x1d16cd=_0x1d16cd-0x0;var _0x57dbcd=_0xc6e1[_0x1d16cd];return _0x57dbcd;};'use strict';var client=require('../client');exports[_0x1c6e('0x0')]=function(_0x3ecfa9){return client[_0x1c6e('0x1')](_0x1c6e('0x2'),{'options':{'where':{'VoiceQueueId':_0x3ecfa9[_0x1c6e('0x3')],'phone':_0x3ecfa9['phone']},'raw':![]},'log':_0x1c6e('0x2')});};exports[_0x1c6e('0x4')]=function(_0x590804){return client[_0x1c6e('0x1')](_0x1c6e('0x2'),{'options':{'where':{'CampaignId':_0x590804['CampaignId'],'phone':_0x590804[_0x1c6e('0x5')]},'raw':![]},'log':_0x1c6e('0x6')});}; \ No newline at end of file +var _0x364e=['phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x364e,0x1d2));var _0xe364=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x364e[_0x256b72];return _0x2183e3;};'use strict';var client=require(_0xe364('0x0'));exports['checkIsBlackList']=function(_0x12704e){return client[_0xe364('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x12704e['VoiceQueueId'],'phone':_0x12704e[_0xe364('0x2')]},'raw':![]},'log':_0xe364('0x3')});};exports[_0xe364('0x4')]=function(_0x5bbafd){return client[_0xe364('0x1')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x5bbafd[_0xe364('0x5')],'phone':_0x5bbafd['phone']},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 12c34e0..0a99861 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc0d=['queue','Request','createContact'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xdc0d,0xbf));var _0xddc0=function(_0x14b3d8,_0x520f02){_0x14b3d8=_0x14b3d8-0x0;var _0x51f496=_0xdc0d[_0x14b3d8];return _0x51f496;};'use strict';var client=require('../client');exports[_0xddc0('0x0')]=function(_0x103ee8){return function(){_0x103ee8['campaign']=_0x103ee8[_0xddc0('0x1')];return client[_0xddc0('0x2')]('CreateCmHopperFinal',{'body':_0x103ee8,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0xc447=['Request','CreateCmHopperFinal','../client','createContact','campaign','queue'];(function(_0xcfb229,_0x472197){var _0x5983c0=function(_0x2caa67){while(--_0x2caa67){_0xcfb229['push'](_0xcfb229['shift']());}};_0x5983c0(++_0x472197);}(_0xc447,0x1dc));var _0x7c44=function(_0x212211,_0x21082c){_0x212211=_0x212211-0x0;var _0x58b1a0=_0xc447[_0x212211];return _0x58b1a0;};'use strict';var client=require(_0x7c44('0x0'));exports[_0x7c44('0x1')]=function(_0x1d84b9){return function(){_0x1d84b9[_0x7c44('0x2')]=_0x1d84b9[_0x7c44('0x3')];return client[_0x7c44('0x4')](_0x7c44('0x5'),{'body':_0x1d84b9,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index a044644..4378703 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14ec=['startOf','day','endOf','queue','getCampaignHopperHistory','ivr','GetCampaignHopperHistory','moment','campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x14ec,0xa7));var _0xc14e=function(_0x4e1cdc,_0x1c5782){_0x4e1cdc=_0x4e1cdc-0x0;var _0x3373f4=_0x14ec[_0x4e1cdc];return _0x3373f4;};'use strict';var client=require('../client');var moment=require(_0xc14e('0x0'));exports['createHistory']=function(_0xef44ca){_0xef44ca[_0xc14e('0x1')]=_0xef44ca['queue'];return client[_0xc14e('0x2')](_0xc14e('0x3'),{'body':_0xef44ca,'log':_0xc14e('0x3')});};exports[_0xc14e('0x4')]=function(_0x2ba9ad){return client[_0xc14e('0x2')](_0xc14e('0x5'),{'options':{'where':{'endtime':{'$between':[moment()[_0xc14e('0x6')](_0x2ba9ad,_0xc14e('0x7'))[_0xc14e('0x8')](_0xc14e('0x9')),moment()[_0xc14e('0x8')](_0xc14e('0x9'))]}},'raw':![]},'log':_0xc14e('0xa')});};exports[_0xc14e('0xb')]=function(){return function(){return client[_0xc14e('0x2')](_0xc14e('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xc14e('0xd')](_0xc14e('0xe'))[_0xc14e('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xc14e('0xf')](_0xc14e('0xe'))[_0xc14e('0x8')](_0xc14e('0x9'))]},'campaigntype':_0xc14e('0x10')},'raw':![]},'log':_0xc14e('0xc')});};};exports[_0xc14e('0x11')]=function(){return function(){return client[_0xc14e('0x2')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xc14e('0xd')](_0xc14e('0xe'))['format'](_0xc14e('0x9')),moment()[_0xc14e('0xf')]('day')[_0xc14e('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xc14e('0x12')},'raw':![]},'log':_0xc14e('0x13')});};}; \ No newline at end of file +var _0xd04b=['startOf','day','endOf','getCampaignHopperHistory','ivr','../client','moment','createHistory','campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory'];(function(_0x1f9c65,_0x5111f4){var _0x28899d=function(_0x185f87){while(--_0x185f87){_0x1f9c65['push'](_0x1f9c65['shift']());}};_0x28899d(++_0x5111f4);}(_0xd04b,0x145));var _0xbd04=function(_0x4da112,_0xa33442){_0x4da112=_0x4da112-0x0;var _0xc6337d=_0xd04b[_0x4da112];return _0xc6337d;};'use strict';var client=require(_0xbd04('0x0'));var moment=require(_0xbd04('0x1'));exports[_0xbd04('0x2')]=function(_0x5186f0){_0x5186f0[_0xbd04('0x3')]=_0x5186f0['queue'];return client[_0xbd04('0x4')](_0xbd04('0x5'),{'body':_0x5186f0,'log':_0xbd04('0x5')});};exports[_0xbd04('0x6')]=function(_0x36218a){return client[_0xbd04('0x4')](_0xbd04('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0xbd04('0x8')](_0x36218a,_0xbd04('0x9'))[_0xbd04('0xa')](_0xbd04('0xb')),moment()['format'](_0xbd04('0xb'))]}},'raw':![]},'log':_0xbd04('0xc')});};exports[_0xbd04('0xd')]=function(){return function(){return client[_0xbd04('0x4')](_0xbd04('0xe'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xbd04('0xf')](_0xbd04('0x10'))[_0xbd04('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xbd04('0x11')](_0xbd04('0x10'))[_0xbd04('0xa')](_0xbd04('0xb'))]},'campaigntype':'queue'},'raw':![]},'log':_0xbd04('0xe')});};};exports[_0xbd04('0x12')]=function(){return function(){return client[_0xbd04('0x4')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')['format'](_0xbd04('0xb')),moment()[_0xbd04('0x11')](_0xbd04('0x10'))['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xbd04('0x13')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 64094d2..8002c04 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30d6=['headerinfo','maxrate','modem','gateway','t38timeout','tech','TrunkId','Trunk','name','callerid','getFaxAccount','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','description','ecm'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x30d6,0x1b0));var _0x630d=function(_0x389a61,_0x20216c){_0x389a61=_0x389a61-0x0;var _0x1acde9=_0x30d6[_0x389a61];return _0x1acde9;};'use strict';var client=require(_0x630d('0x0'));exports[_0x630d('0x1')]=function(){return function(){return client['Request'](_0x630d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x630d('0x3'),_0x630d('0x4'),_0x630d('0x5'),'localstationid','minrate',_0x630d('0x6'),_0x630d('0x7'),_0x630d('0x8'),'faxdetect',_0x630d('0x9'),_0x630d('0xa'),_0x630d('0xb'),'ListId','key'],'include':[{'model':_0x630d('0xc'),'as':_0x630d('0xc'),'attributes':['id',_0x630d('0xd'),_0x630d('0xe'),'active']}]},'log':_0x630d('0xf')});};};exports[_0x630d('0x10')]=function(_0x2f88fb,_0x2c03da){return client[_0x630d('0x11')](_0x630d('0x12'),{'account':{'id':_0x2f88fb},'body':_0x2c03da,'log':_0x630d('0x12')});}; \ No newline at end of file +var _0x8af6=['TrunkId','ListId','key','Trunk','callerid','active','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','modem','faxdetect','t38timeout','tech'];(function(_0x11b34a,_0x182b68){var _0x2e6909=function(_0x18902c){while(--_0x18902c){_0x11b34a['push'](_0x11b34a['shift']());}};_0x2e6909(++_0x182b68);}(_0x8af6,0x76));var _0x68af=function(_0x1377cb,_0xef5a21){_0x1377cb=_0x1377cb-0x0;var _0x422ed8=_0x8af6[_0x1377cb];return _0x422ed8;};'use strict';var client=require(_0x68af('0x0'));exports[_0x68af('0x1')]=function(){return function(){return client[_0x68af('0x2')](_0x68af('0x3'),{'options':{'raw':![],'attributes':['id',_0x68af('0x4'),_0x68af('0x5'),_0x68af('0x6'),_0x68af('0x7'),_0x68af('0x8'),_0x68af('0x9'),'maxrate',_0x68af('0xa'),'gateway',_0x68af('0xb'),_0x68af('0xc'),_0x68af('0xd'),_0x68af('0xe'),_0x68af('0xf'),_0x68af('0x10')],'include':[{'model':_0x68af('0x11'),'as':'Trunk','attributes':['id','name',_0x68af('0x12'),_0x68af('0x13')]}]},'log':'getFaxAccount'});};};exports[_0x68af('0x14')]=function(_0x21b83b,_0x16399b){return client[_0x68af('0x2')](_0x68af('0x15'),{'account':{'id':_0x21b83b},'body':_0x16399b,'log':_0x68af('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 836a26d..ee352aa 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48d0=['Request','UpdateFaxMessage','../client'];(function(_0x4a8e42,_0x564a20){var _0x17aed3=function(_0x3e5339){while(--_0x3e5339){_0x4a8e42['push'](_0x4a8e42['shift']());}};_0x17aed3(++_0x564a20);}(_0x48d0,0x1a0));var _0x048d=function(_0x244d99,_0x590cba){_0x244d99=_0x244d99-0x0;var _0x305ce7=_0x48d0[_0x244d99];return _0x305ce7;};'use strict';var client=require(_0x048d('0x0'));exports['update']=function(_0x59ea05,_0x81f0e0){return client[_0x048d('0x1')](_0x048d('0x2'),{'body':_0x81f0e0,'options':{'where':{'AttachmentId':_0x59ea05}},'log':_0x048d('0x2')});}; \ No newline at end of file +var _0xe49b=['Request','UpdateFaxMessage','../client','update'];(function(_0x8a5b24,_0xb70d8b){var _0x39e7f5=function(_0x4baab3){while(--_0x4baab3){_0x8a5b24['push'](_0x8a5b24['shift']());}};_0x39e7f5(++_0xb70d8b);}(_0xe49b,0x6e));var _0xbe49=function(_0x2091b0,_0x2b20a2){_0x2091b0=_0x2091b0-0x0;var _0x2ced5f=_0xe49b[_0x2091b0];return _0x2ced5f;};'use strict';var client=require(_0xbe49('0x0'));exports[_0xbe49('0x1')]=function(_0x4cb5e3,_0x2a2d4b){return client[_0xbe49('0x2')]('UpdateFaxMessage',{'body':_0x2a2d4b,'options':{'where':{'AttachmentId':_0x4cb5e3}},'log':_0xbe49('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index cc2e8b6..4c0d910 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x264a=['content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField'];(function(_0x485034,_0x43f507){var _0x34e386=function(_0x520f8e){while(--_0x520f8e){_0x485034['push'](_0x485034['shift']());}};_0x34e386(++_0x43f507);}(_0x264a,0x135));var _0xa264=function(_0x3c564e,_0x2b8451){_0x3c564e=_0x3c564e-0x0;var _0x52491b=_0x264a[_0x3c564e];return _0x52491b;};'use strict';var client=require(_0xa264('0x0'));exports[_0xa264('0x1')]=function(){return function(_0x15071f){return client[_0xa264('0x2')](_0xa264('0x3'),{'options':{'raw':![],'attributes':['id',_0xa264('0x4'),_0xa264('0x5'),_0xa264('0x6'),_0xa264('0x7'),_0xa264('0x8'),_0xa264('0x9'),_0xa264('0xa'),_0xa264('0xb')],'include':[{'model':_0xa264('0xc'),'as':_0xa264('0xd'),'attributes':['id','name'],'include':[{'model':_0xa264('0xe'),'as':'Subjects','attributes':['id',_0xa264('0xa'),_0xa264('0xf'),_0xa264('0x10')],'include':[{'model':_0xa264('0x11'),'as':'Variable','attributes':['id',_0xa264('0x4')]}]},{'model':'DeskField','as':_0xa264('0x12'),'attributes':['id',_0xa264('0xa'),_0xa264('0xf'),_0xa264('0x13'),_0xa264('0x14'),_0xa264('0x15'),_0xa264('0x10')],'include':[{'model':'Variable','as':_0xa264('0x11'),'attributes':['id',_0xa264('0x4')]}]},{'model':_0xa264('0xe'),'as':_0xa264('0x16'),'attributes':['id',_0xa264('0xa'),_0xa264('0xf'),_0xa264('0x17'),'nameField',_0xa264('0x18'),_0xa264('0x10')],'include':[{'model':_0xa264('0x11'),'as':_0xa264('0x11'),'attributes':['id','name']}]},{'model':_0xa264('0x19'),'as':_0xa264('0x1a'),'attributes':['id',_0xa264('0x4')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0xffa4=['DeskField','Subjects','variableName','Variable','Descriptions','content','key','keyType','Fields','nameField','customField','Tag','Tags','../../client','getDeskAccounts','Request','name','description','username','password','remoteUri','type','DeskConfiguration','Configurations'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xffa4,0x115));var _0x4ffa=function(_0x19e38e,_0xb15cc7){_0x19e38e=_0x19e38e-0x0;var _0x14bec3=_0xffa4[_0x19e38e];return _0x14bec3;};'use strict';var client=require(_0x4ffa('0x0'));exports[_0x4ffa('0x1')]=function(){return function(_0x30e681){return client[_0x4ffa('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x4ffa('0x3'),_0x4ffa('0x4'),_0x4ffa('0x5'),_0x4ffa('0x6'),_0x4ffa('0x7'),'authType',_0x4ffa('0x8'),'serverUrl'],'include':[{'model':_0x4ffa('0x9'),'as':_0x4ffa('0xa'),'attributes':['id',_0x4ffa('0x3')],'include':[{'model':_0x4ffa('0xb'),'as':_0x4ffa('0xc'),'attributes':['id',_0x4ffa('0x8'),'content',_0x4ffa('0xd')],'include':[{'model':_0x4ffa('0xe'),'as':'Variable','attributes':['id','name']}]},{'model':_0x4ffa('0xb'),'as':_0x4ffa('0xf'),'attributes':['id','type',_0x4ffa('0x10'),_0x4ffa('0x11'),_0x4ffa('0x12'),'keyContent',_0x4ffa('0xd')],'include':[{'model':'Variable','as':_0x4ffa('0xe'),'attributes':['id',_0x4ffa('0x3')]}]},{'model':_0x4ffa('0xb'),'as':_0x4ffa('0x13'),'attributes':['id',_0x4ffa('0x8'),_0x4ffa('0x10'),'idField',_0x4ffa('0x14'),_0x4ffa('0x15'),'variableName'],'include':[{'model':_0x4ffa('0xe'),'as':_0x4ffa('0xe'),'attributes':['id',_0x4ffa('0x3')]}]},{'model':_0x4ffa('0x16'),'as':_0x4ffa('0x17'),'attributes':['id',_0x4ffa('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 0934a5b..7011f0e 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56bd=['keyType','keyContent','variableName','idField','nameField','customField','CloudProvider','data2','data5','getDynamics365Accounts','Request','name','username','password','remoteUri','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','type','content','Variable','Dynamics365Field','Descriptions','key'];(function(_0x598e64,_0x17bc90){var _0x3e4eba=function(_0x37dd02){while(--_0x37dd02){_0x598e64['push'](_0x598e64['shift']());}};_0x3e4eba(++_0x17bc90);}(_0x56bd,0xe9));var _0xd56b=function(_0x382e66,_0x30c3bf){_0x382e66=_0x382e66-0x0;var _0x5d6e4c=_0x56bd[_0x382e66];return _0x5d6e4c;};'use strict';var client=require('../../client');exports[_0xd56b('0x0')]=function(){return function(_0x2535c1){return client[_0xd56b('0x1')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xd56b('0x2'),_0xd56b('0x3'),_0xd56b('0x4'),_0xd56b('0x5'),'tenantId',_0xd56b('0x6'),_0xd56b('0x7'),_0xd56b('0x8'),_0xd56b('0x9'),_0xd56b('0xa')],'include':[{'model':_0xd56b('0xb'),'as':_0xd56b('0xc'),'attributes':['id','name',_0xd56b('0xd'),_0xd56b('0xe'),_0xd56b('0xf'),_0xd56b('0x10')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),'variableName'],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':_0xd56b('0x15'),'attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),_0xd56b('0x16'),_0xd56b('0x17'),_0xd56b('0x18'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':'Fields','attributes':['id',_0xd56b('0x11'),'content',_0xd56b('0x1a'),_0xd56b('0x1b'),_0xd56b('0x1c'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]}]},{'model':_0xd56b('0x1d'),'as':_0xd56b('0x1d'),'attributes':['id',_0xd56b('0x1e'),_0xd56b('0x1f'),'data7']}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file +var _0xd070=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','Variable','Descriptions','key','keyContent','variableName','nameField','customField','data2','data5','../../client','Request','GetDynamics365Account','name','username','password','remoteUri','tenantId'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd070,0x8e));var _0x0d07=function(_0x109e00,_0x386566){_0x109e00=_0x109e00-0x0;var _0x342ad5=_0xd070[_0x109e00];return _0x342ad5;};'use strict';var client=require(_0x0d07('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x1e39cf){return client[_0x0d07('0x1')](_0x0d07('0x2'),{'options':{'raw':![],'attributes':['id',_0x0d07('0x3'),_0x0d07('0x4'),_0x0d07('0x5'),_0x0d07('0x6'),_0x0d07('0x7'),_0x0d07('0x8'),_0x0d07('0x9'),_0x0d07('0xa'),'description',_0x0d07('0xb')],'include':[{'model':'Dynamics365Configuration','as':_0x0d07('0xc'),'attributes':['id',_0x0d07('0x3'),_0x0d07('0xd'),_0x0d07('0xe'),_0x0d07('0xf'),_0x0d07('0x10')],'include':[{'model':_0x0d07('0x11'),'as':_0x0d07('0x12'),'attributes':['id',_0x0d07('0x13'),_0x0d07('0x14'),'variableName'],'include':[{'model':'Variable','as':_0x0d07('0x15'),'attributes':['id',_0x0d07('0x3')]}]},{'model':'Dynamics365Field','as':_0x0d07('0x16'),'attributes':['id','type',_0x0d07('0x14'),_0x0d07('0x17'),'keyType',_0x0d07('0x18'),_0x0d07('0x19')],'include':[{'model':_0x0d07('0x15'),'as':_0x0d07('0x15'),'attributes':['id',_0x0d07('0x3')]}]},{'model':_0x0d07('0x11'),'as':'Fields','attributes':['id',_0x0d07('0x13'),'content','idField',_0x0d07('0x1a'),_0x0d07('0x1b'),_0x0d07('0x19')],'include':[{'model':_0x0d07('0x15'),'as':_0x0d07('0x15'),'attributes':['id','name']}]}]},{'model':'CloudProvider','as':'CloudProvider','attributes':['id',_0x0d07('0x1c'),_0x0d07('0x1d'),'data7']}]},'log':_0x0d07('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index f3099e5..6f175b1 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab75=['content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','name','username','apiKey','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type'];(function(_0x4cab7d,_0xce877){var _0x4e09cd=function(_0x1359d2){while(--_0x1359d2){_0x4cab7d['push'](_0x4cab7d['shift']());}};_0x4e09cd(++_0xce877);}(_0xab75,0x11f));var _0x5ab7=function(_0x4b14bb,_0x4a4b95){_0x4b14bb=_0x4b14bb-0x0;var _0xd720a0=_0xab75[_0x4b14bb];return _0xd720a0;};'use strict';var client=require(_0x5ab7('0x0'));exports[_0x5ab7('0x1')]=function(){return function(_0x2fc46f){return client['Request']('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x5ab7('0x2'),_0x5ab7('0x3'),_0x5ab7('0x4'),'remoteUri',_0x5ab7('0x5')],'include':[{'model':_0x5ab7('0x6'),'as':_0x5ab7('0x7'),'attributes':['id',_0x5ab7('0x2')],'include':[{'model':_0x5ab7('0x8'),'attributes':['id',_0x5ab7('0x2')]},{'model':_0x5ab7('0x9'),'as':_0x5ab7('0xa'),'attributes':['id',_0x5ab7('0xb'),_0x5ab7('0xc'),_0x5ab7('0xd')],'include':[{'model':'Variable','as':_0x5ab7('0xe'),'attributes':['id',_0x5ab7('0x2')]}]},{'model':'FreshdeskField','as':_0x5ab7('0xf'),'attributes':['id',_0x5ab7('0xb'),_0x5ab7('0xc'),_0x5ab7('0x10'),_0x5ab7('0x11'),'keyContent','variableName'],'include':[{'model':_0x5ab7('0xe'),'as':_0x5ab7('0xe'),'attributes':['id',_0x5ab7('0x2')]}]},{'model':_0x5ab7('0x9'),'as':_0x5ab7('0x12'),'attributes':['id',_0x5ab7('0xb'),_0x5ab7('0xc'),_0x5ab7('0x13'),_0x5ab7('0x14'),_0x5ab7('0x15'),_0x5ab7('0xd')],'include':[{'model':'Variable','as':_0x5ab7('0xe'),'attributes':['id',_0x5ab7('0x2')]}]}]}]},'log':_0x5ab7('0x16')});};}; \ No newline at end of file +var _0x2ca5=['name','remoteUri','serverUrl','FreshdeskConfiguration','type','content','variableName','Variable','FreshdeskField','key','keyType','keyContent','Fields','idField','nameField','customField','GetFreshdeskAccount','getFreshdeskAccounts','Request'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2ca5,0x108));var _0x52ca=function(_0x580409,_0x11a6e8){_0x580409=_0x580409-0x0;var _0x126a85=_0x2ca5[_0x580409];return _0x126a85;};'use strict';var client=require('../../client');exports[_0x52ca('0x0')]=function(){return function(_0x9dfdc){return client[_0x52ca('0x1')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x52ca('0x2'),'username','apiKey',_0x52ca('0x3'),_0x52ca('0x4')],'include':[{'model':_0x52ca('0x5'),'as':'Configurations','attributes':['id','name'],'include':[{'model':'Tag','attributes':['id',_0x52ca('0x2')]},{'model':'FreshdeskField','as':'Subjects','attributes':['id',_0x52ca('0x6'),_0x52ca('0x7'),_0x52ca('0x8')],'include':[{'model':_0x52ca('0x9'),'as':_0x52ca('0x9'),'attributes':['id',_0x52ca('0x2')]}]},{'model':_0x52ca('0xa'),'as':'Descriptions','attributes':['id',_0x52ca('0x6'),_0x52ca('0x7'),_0x52ca('0xb'),_0x52ca('0xc'),_0x52ca('0xd'),_0x52ca('0x8')],'include':[{'model':_0x52ca('0x9'),'as':_0x52ca('0x9'),'attributes':['id','name']}]},{'model':_0x52ca('0xa'),'as':_0x52ca('0xe'),'attributes':['id',_0x52ca('0x6'),_0x52ca('0x7'),_0x52ca('0xf'),_0x52ca('0x10'),_0x52ca('0x11'),_0x52ca('0x8')],'include':[{'model':_0x52ca('0x9'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x52ca('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index f36ca67..67c8991 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e4b=['getFreshsalesAccounts','GetFreshsalesAccount','serverUrl','FreshsalesConfiguration','name','FreshsalesField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','GetFreshsalesccount','../../client'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x46ba18,_0x51bcbd){_0x46ba18=_0x46ba18-0x0;var _0x68fc4a=_0x0e4b[_0x46ba18];return _0x68fc4a;};'use strict';var client=require(_0xb0e4('0x0'));exports[_0xb0e4('0x1')]=function(){return function(_0x65d4d1){return client['Request'](_0xb0e4('0x2'),{'options':{'raw':![],'attributes':['id','name','username','apiKey','remoteUri',_0xb0e4('0x3')],'include':[{'model':_0xb0e4('0x4'),'as':'Configurations','attributes':['id',_0xb0e4('0x5')],'include':[{'model':_0xb0e4('0x6'),'as':_0xb0e4('0x7'),'attributes':['id',_0xb0e4('0x8'),_0xb0e4('0x9'),'variableName'],'include':[{'model':'Variable','as':_0xb0e4('0xa'),'attributes':['id',_0xb0e4('0x5')]}]},{'model':_0xb0e4('0x6'),'as':_0xb0e4('0xb'),'attributes':['id',_0xb0e4('0x8'),_0xb0e4('0x9'),_0xb0e4('0xc'),_0xb0e4('0xd'),_0xb0e4('0xe'),_0xb0e4('0xf')],'include':[{'model':_0xb0e4('0xa'),'as':_0xb0e4('0xa'),'attributes':['id',_0xb0e4('0x5')]}]}]}]},'log':_0xb0e4('0x10')});};}; \ No newline at end of file +var _0xffd6=['variableName','Variable','FreshsalesField','key','keyType','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts','name','username','apiKey','serverUrl','FreshsalesConfiguration','Configurations','Subjects','type','content'];(function(_0x1a42bc,_0x34a88c){var _0x33fd2b=function(_0x2be72d){while(--_0x2be72d){_0x1a42bc['push'](_0x1a42bc['shift']());}};_0x33fd2b(++_0x34a88c);}(_0xffd6,0x97));var _0x6ffd=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0xffd6[_0xb875ee];return _0x4c7f3a;};'use strict';var client=require(_0x6ffd('0x0'));exports[_0x6ffd('0x1')]=function(){return function(_0x292378){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x6ffd('0x2'),_0x6ffd('0x3'),_0x6ffd('0x4'),'remoteUri',_0x6ffd('0x5')],'include':[{'model':_0x6ffd('0x6'),'as':_0x6ffd('0x7'),'attributes':['id',_0x6ffd('0x2')],'include':[{'model':'FreshsalesField','as':_0x6ffd('0x8'),'attributes':['id',_0x6ffd('0x9'),_0x6ffd('0xa'),_0x6ffd('0xb')],'include':[{'model':_0x6ffd('0xc'),'as':'Variable','attributes':['id',_0x6ffd('0x2')]}]},{'model':_0x6ffd('0xd'),'as':'Descriptions','attributes':['id',_0x6ffd('0x9'),_0x6ffd('0xa'),_0x6ffd('0xe'),_0x6ffd('0xf'),_0x6ffd('0x10'),_0x6ffd('0xb')],'include':[{'model':_0x6ffd('0xc'),'as':'Variable','attributes':['id',_0x6ffd('0x2')]}]}]}]},'log':_0x6ffd('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index f91cba4..f497ef5 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1bd=['getSalesforceAccounts','Request','GetSalesforceAccount','name','username','remoteUri','clientId','securityToken','serverUrl','type','Configurations','moduleSearch','moduleCreate','ticketType','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Variable','Descriptions','Fields'];(function(_0x356f38,_0x45756d){var _0x33a4c8=function(_0x3569d1){while(--_0x3569d1){_0x356f38['push'](_0x356f38['shift']());}};_0x33a4c8(++_0x45756d);}(_0xc1bd,0xd2));var _0xdc1b=function(_0x4106bd,_0x2ca0b0){_0x4106bd=_0x4106bd-0x0;var _0x13757f=_0xc1bd[_0x4106bd];return _0x13757f;};'use strict';var client=require('../../client');exports[_0xdc1b('0x0')]=function(){return function(_0x114a2e){return client[_0xdc1b('0x1')](_0xdc1b('0x2'),{'options':{'raw':![],'attributes':['id',_0xdc1b('0x3'),_0xdc1b('0x4'),'password',_0xdc1b('0x5'),_0xdc1b('0x6'),'clientSecret',_0xdc1b('0x7'),_0xdc1b('0x8'),_0xdc1b('0x9')],'include':[{'model':'SalesforceConfiguration','as':_0xdc1b('0xa'),'attributes':['id',_0xdc1b('0x3'),_0xdc1b('0xb'),_0xdc1b('0xc'),_0xdc1b('0xd'),'leadId',_0xdc1b('0xe'),_0xdc1b('0xf'),_0xdc1b('0x10')],'include':[{'model':_0xdc1b('0x11'),'as':'Subjects','include':[{'model':_0xdc1b('0x12'),'as':'Variable','attributes':['id',_0xdc1b('0x3')]}]},{'model':_0xdc1b('0x11'),'as':_0xdc1b('0x13'),'include':[{'model':_0xdc1b('0x12'),'as':'Variable','attributes':['id',_0xdc1b('0x3')]}]},{'model':_0xdc1b('0x11'),'as':_0xdc1b('0x14'),'include':[{'model':_0xdc1b('0x12'),'as':_0xdc1b('0x12'),'attributes':['id',_0xdc1b('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0x3423=['securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchLead','SalesforceField','Variable','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x381e58){return client[_0x3342('0x0')](_0x3342('0x1'),{'options':{'raw':![],'attributes':['id',_0x3342('0x2'),_0x3342('0x3'),_0x3342('0x4'),_0x3342('0x5'),_0x3342('0x6'),_0x3342('0x7'),_0x3342('0x8'),_0x3342('0x9'),_0x3342('0xa')],'include':[{'model':_0x3342('0xb'),'as':_0x3342('0xc'),'attributes':['id',_0x3342('0x2'),_0x3342('0xd'),_0x3342('0xe'),_0x3342('0xf'),_0x3342('0x10'),'additionalSearchAccount','additionalSearchContact',_0x3342('0x11')],'include':[{'model':'SalesforceField','as':'Subjects','include':[{'model':'Variable','as':'Variable','attributes':['id',_0x3342('0x2')]}]},{'model':_0x3342('0x12'),'as':'Descriptions','include':[{'model':_0x3342('0x13'),'as':'Variable','attributes':['id',_0x3342('0x2')]}]},{'model':_0x3342('0x12'),'as':'Fields','include':[{'model':_0x3342('0x13'),'as':_0x3342('0x13'),'attributes':['id',_0x3342('0x2')]}]}]}]},'log':_0x3342('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 9fe75f6..da08870 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['password','email','ServicenowConfiguration','name','Subjects','type','content','Variable','ServicenowField','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','username'];(function(_0x469382,_0x4b79bc){var _0x2ca948=function(_0x5dad0f){while(--_0x5dad0f){_0x469382['push'](_0x469382['shift']());}};_0x2ca948(++_0x4b79bc);}(_0xabce,0x103));var _0xeabc=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xabce[_0x45e98e];return _0x374dba;};'use strict';var client=require(_0xeabc('0x0'));exports[_0xeabc('0x1')]=function(){return function(_0x357cda){return client[_0xeabc('0x2')](_0xeabc('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0xeabc('0x4'),_0xeabc('0x5'),_0xeabc('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xeabc('0x7'),'as':'Configurations','attributes':['id',_0xeabc('0x8')],'include':[{'model':'ServicenowField','as':_0xeabc('0x9'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),'variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0xe'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),_0xeabc('0xf'),_0xeabc('0x10'),_0xeabc('0x11'),_0xeabc('0x12')],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0x13'),'attributes':['id','type',_0xeabc('0xb'),_0xeabc('0x14'),_0xeabc('0x15'),'customField','variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0x57ca=['type','variableName','Variable','Descriptions','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','getServicenowAccounts','GetServicenowAccount','name','description','username','password','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x57ca,0x108));var _0xa57c=function(_0xf4b5ec,_0x558d12){_0xf4b5ec=_0xf4b5ec-0x0;var _0x38cbc0=_0x57ca[_0xf4b5ec];return _0x38cbc0;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'email',_0xa57c('0x6'),_0xa57c('0x7')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0xa'),'as':_0xa57c('0xb'),'attributes':['id',_0xa57c('0xc'),'content',_0xa57c('0xd')],'include':[{'model':'Variable','as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':'ServicenowField','as':_0xa57c('0xf'),'attributes':['id','type',_0xa57c('0x10'),_0xa57c('0x11'),'keyType',_0xa57c('0x12'),'variableName'],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0xa'),'as':_0xa57c('0x13'),'attributes':['id','type',_0xa57c('0x10'),'idField',_0xa57c('0x14'),_0xa57c('0x15'),_0xa57c('0xd')],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 3d21d9d..4027518 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['SugarcrmField','Descriptions','keyType','keyContent','Fields','idField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','SugarcrmConfiguration','Configurations','Subjects','type','content','variableName','Variable'];(function(_0xef049b,_0x5a7819){var _0x4cec9a=function(_0x306b82){while(--_0x306b82){_0xef049b['push'](_0xef049b['shift']());}};_0x4cec9a(++_0x5a7819);}(_0x2ef3,0xba));var _0x32ef=function(_0x91a9d9,_0x3aee6f){_0x91a9d9=_0x91a9d9-0x0;var _0xe46fe2=_0x2ef3[_0x91a9d9];return _0xe46fe2;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(_0x47513a){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),'username',_0x32ef('0x5'),_0x32ef('0x6'),'serverUrl'],'include':[{'model':_0x32ef('0x7'),'as':_0x32ef('0x8'),'attributes':['id','name'],'include':[{'model':'SugarcrmField','as':_0x32ef('0x9'),'attributes':['id',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]},{'model':_0x32ef('0xe'),'as':_0x32ef('0xf'),'attributes':['id',_0x32ef('0xa'),'content','key',_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':'Variable','attributes':['id',_0x32ef('0x4')]}]},{'model':'SugarcrmField','as':_0x32ef('0x12'),'attributes':['id','type',_0x32ef('0xb'),_0x32ef('0x13'),'nameField','customField',_0x32ef('0xc')],'include':[{'model':'Variable','as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]}]}]},'log':_0x32ef('0x3')});};}; \ No newline at end of file +var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x4d2a6e,_0x185f42){var _0x2fa8bf=function(_0x48f9d4){while(--_0x48f9d4){_0x4d2a6e['push'](_0x4d2a6e['shift']());}};_0x2fa8bf(++_0x185f42);}(_0x0b0e,0x187));var _0xe0b0=function(_0x614ef4,_0x28a060){_0x614ef4=_0x614ef4-0x0;var _0x35e8e2=_0x0b0e[_0x614ef4];return _0x35e8e2;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index a651ae8..ebb0a73 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x834c=['Configurations','VtigerField','Subjects','type','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','idField','nameField','customField','Request','GetVtigerAccount','name','username','accessKey','serverUrl','VtigerConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x834c,0x143));var _0xc834=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x834c[_0x13ea00];return _0x1f7347;};'use strict';var client=require('../../client');exports['getVtigerAccounts']=function(){return function(_0x457dc4){return client[_0xc834('0x0')](_0xc834('0x1'),{'options':{'raw':![],'attributes':['id',_0xc834('0x2'),'description',_0xc834('0x3'),_0xc834('0x4'),'remoteUri',_0xc834('0x5')],'include':[{'model':_0xc834('0x6'),'as':_0xc834('0x7'),'attributes':['id',_0xc834('0x2')],'include':[{'model':_0xc834('0x8'),'as':_0xc834('0x9'),'attributes':['id',_0xc834('0xa'),'content',_0xc834('0xb')],'include':[{'model':'Variable','as':_0xc834('0xc'),'attributes':['id',_0xc834('0x2')]}]},{'model':_0xc834('0x8'),'as':_0xc834('0xd'),'attributes':['id',_0xc834('0xa'),_0xc834('0xe'),_0xc834('0xf'),_0xc834('0x10'),_0xc834('0x11'),_0xc834('0xb')],'include':[{'model':_0xc834('0xc'),'as':_0xc834('0xc'),'attributes':['id',_0xc834('0x2')]}]},{'model':'VtigerField','as':_0xc834('0x12'),'attributes':['id',_0xc834('0xa'),_0xc834('0xe'),_0xc834('0x13'),_0xc834('0x14'),_0xc834('0x15'),_0xc834('0xb')],'include':[{'model':'Variable','as':_0xc834('0xc'),'attributes':['id',_0xc834('0x2')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x6c8a=['Request','GetVtigerAccount','name','description','username','accessKey','serverUrl','VtigerConfiguration','VtigerField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','nameField','customField','../../client','getVtigerAccounts'];(function(_0x104b89,_0x5b9774){var _0x51a506=function(_0x2414bd){while(--_0x2414bd){_0x104b89['push'](_0x104b89['shift']());}};_0x51a506(++_0x5b9774);}(_0x6c8a,0xc4));var _0xa6c8=function(_0x19719c,_0x53efea){_0x19719c=_0x19719c-0x0;var _0xea6bec=_0x6c8a[_0x19719c];return _0xea6bec;};'use strict';var client=require(_0xa6c8('0x0'));exports[_0xa6c8('0x1')]=function(){return function(_0x4158b){return client[_0xa6c8('0x2')](_0xa6c8('0x3'),{'options':{'raw':![],'attributes':['id',_0xa6c8('0x4'),_0xa6c8('0x5'),_0xa6c8('0x6'),_0xa6c8('0x7'),'remoteUri',_0xa6c8('0x8')],'include':[{'model':_0xa6c8('0x9'),'as':'Configurations','attributes':['id',_0xa6c8('0x4')],'include':[{'model':_0xa6c8('0xa'),'as':_0xa6c8('0xb'),'attributes':['id',_0xa6c8('0xc'),_0xa6c8('0xd'),_0xa6c8('0xe')],'include':[{'model':_0xa6c8('0xf'),'as':_0xa6c8('0xf'),'attributes':['id','name']}]},{'model':'VtigerField','as':_0xa6c8('0x10'),'attributes':['id','type',_0xa6c8('0xd'),'key',_0xa6c8('0x11'),_0xa6c8('0x12'),_0xa6c8('0xe')],'include':[{'model':'Variable','as':_0xa6c8('0xf'),'attributes':['id','name']}]},{'model':'VtigerField','as':_0xa6c8('0x13'),'attributes':['id','type',_0xa6c8('0xd'),'idField',_0xa6c8('0x14'),_0xa6c8('0x15'),_0xa6c8('0xe')],'include':[{'model':_0xa6c8('0xf'),'as':'Variable','attributes':['id',_0xa6c8('0x4')]}]}]}]},'log':_0xa6c8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 689d3a8..78de0f9 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe89f=['Request','password','token','ZendeskConfiguration','Configurations','type','content','variableName','Variable','ZendeskField','Descriptions','key','keyType','keyContent','name','Fields','nameField','customField','GetZendeskAccount','../../client','getZendeskAccounts'];(function(_0x1dd9b7,_0x2cf490){var _0xc23314=function(_0x1622df){while(--_0x1622df){_0x1dd9b7['push'](_0x1dd9b7['shift']());}};_0xc23314(++_0x2cf490);}(_0xe89f,0xa6));var _0xfe89=function(_0x15de8b,_0xd383a3){_0x15de8b=_0x15de8b-0x0;var _0x1259ac=_0xe89f[_0x15de8b];return _0x1259ac;};'use strict';var client=require(_0xfe89('0x0'));exports[_0xfe89('0x1')]=function(){return function(_0x49ffe8){return client[_0xfe89('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id','name','username',_0xfe89('0x3'),_0xfe89('0x4'),'remoteUri','authType','serverUrl','type'],'include':[{'model':_0xfe89('0x5'),'as':_0xfe89('0x6'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id','name']},{'model':'ZendeskField','as':'Subjects','attributes':['id',_0xfe89('0x7'),_0xfe89('0x8'),_0xfe89('0x9')],'include':[{'model':_0xfe89('0xa'),'as':_0xfe89('0xa'),'attributes':['id','name']}]},{'model':_0xfe89('0xb'),'as':_0xfe89('0xc'),'attributes':['id',_0xfe89('0x7'),_0xfe89('0x8'),_0xfe89('0xd'),_0xfe89('0xe'),_0xfe89('0xf'),'variableName'],'include':[{'model':_0xfe89('0xa'),'as':'Variable','attributes':['id',_0xfe89('0x10')]}]},{'model':_0xfe89('0xb'),'as':_0xfe89('0x11'),'attributes':['id','type',_0xfe89('0x8'),'idField',_0xfe89('0x12'),_0xfe89('0x13'),_0xfe89('0x9')],'include':[{'model':_0xfe89('0xa'),'as':'Variable','attributes':['id',_0xfe89('0x10')]}]}]}]},'log':_0xfe89('0x14')});};}; \ No newline at end of file +var _0xab62=['Variable','key','keyType','keyContent','Fields','nameField','customField','../../client','Request','GetZendeskAccount','name','username','password','token','remoteUri','authType','serverUrl','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','type','content','variableName'];(function(_0x4dcd53,_0x1a97f4){var _0x4422ff=function(_0x12352b){while(--_0x12352b){_0x4dcd53['push'](_0x4dcd53['shift']());}};_0x4422ff(++_0x1a97f4);}(_0xab62,0xe8));var _0x2ab6=function(_0x4b5856,_0x4f7672){_0x4b5856=_0x4b5856-0x0;var _0x307f89=_0xab62[_0x4b5856];return _0x307f89;};'use strict';var client=require(_0x2ab6('0x0'));exports['getZendeskAccounts']=function(){return function(_0x3018b0){return client[_0x2ab6('0x1')](_0x2ab6('0x2'),{'options':{'raw':![],'attributes':['id',_0x2ab6('0x3'),_0x2ab6('0x4'),_0x2ab6('0x5'),_0x2ab6('0x6'),_0x2ab6('0x7'),_0x2ab6('0x8'),_0x2ab6('0x9'),'type'],'include':[{'model':_0x2ab6('0xa'),'as':_0x2ab6('0xb'),'attributes':['id','name'],'include':[{'model':_0x2ab6('0xc'),'attributes':['id','name']},{'model':_0x2ab6('0xd'),'as':_0x2ab6('0xe'),'attributes':['id',_0x2ab6('0xf'),_0x2ab6('0x10'),_0x2ab6('0x11')],'include':[{'model':_0x2ab6('0x12'),'as':_0x2ab6('0x12'),'attributes':['id','name']}]},{'model':_0x2ab6('0xd'),'as':'Descriptions','attributes':['id',_0x2ab6('0xf'),'content',_0x2ab6('0x13'),_0x2ab6('0x14'),_0x2ab6('0x15'),_0x2ab6('0x11')],'include':[{'model':_0x2ab6('0x12'),'as':_0x2ab6('0x12'),'attributes':['id',_0x2ab6('0x3')]}]},{'model':_0x2ab6('0xd'),'as':_0x2ab6('0x16'),'attributes':['id',_0x2ab6('0xf'),'content','idField',_0x2ab6('0x17'),_0x2ab6('0x18'),_0x2ab6('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x2ab6('0x3')]}]}]}]},'log':_0x2ab6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 61184b9..f2d5df0 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dfd=['moduleSearch','description','ZohoField','Subjects','type','content','variableName','Variable','keyType','keyContent','Fields','idField','nameField','customField','../../client','Request','GetZohoAccount','name','zone','clientId','clientSecret','code','ZohoConfiguration','Configurations','moduleCreate'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5dfd,0x19e));var _0xd5df=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x5dfd[_0x95942];return _0x6d7f81;};'use strict';var client=require(_0xd5df('0x0'));exports['getZohoAccounts']=function(){return function(_0x55dd04){return client[_0xd5df('0x1')](_0xd5df('0x2'),{'options':{'raw':![],'attributes':['id',_0xd5df('0x3'),'description','host',_0xd5df('0x4'),_0xd5df('0x5'),_0xd5df('0x6'),'serverUrl',_0xd5df('0x7'),'refreshToken'],'include':[{'model':_0xd5df('0x8'),'as':_0xd5df('0x9'),'attributes':['id',_0xd5df('0x3'),_0xd5df('0xa'),_0xd5df('0xb'),_0xd5df('0xc')],'include':[{'model':_0xd5df('0xd'),'as':_0xd5df('0xe'),'attributes':['id',_0xd5df('0xf'),_0xd5df('0x10'),_0xd5df('0x11')],'include':[{'model':_0xd5df('0x12'),'as':_0xd5df('0x12'),'attributes':['id','name']}]},{'model':'ZohoField','as':'Descriptions','attributes':['id',_0xd5df('0xf'),_0xd5df('0x10'),'key',_0xd5df('0x13'),_0xd5df('0x14'),_0xd5df('0x11')],'include':[{'model':_0xd5df('0x12'),'as':'Variable','attributes':['id',_0xd5df('0x3')]}]},{'model':_0xd5df('0xd'),'as':_0xd5df('0x15'),'attributes':['id',_0xd5df('0xf'),_0xd5df('0x10'),_0xd5df('0x16'),_0xd5df('0x17'),_0xd5df('0x18'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xd5df('0x3')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0x1178=['ZohoConfiguration','moduleCreate','moduleSearch','ZohoField','Subjects','type','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','idField','nameField','customField','../../client','getZohoAccounts','Request','name','description','host','clientId','clientSecret','serverUrl','refreshToken'];(function(_0x23baa6,_0x1cf1b){var _0xdaacd4=function(_0x5c8905){while(--_0x5c8905){_0x23baa6['push'](_0x23baa6['shift']());}};_0xdaacd4(++_0x1cf1b);}(_0x1178,0xce));var _0x8117=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1178[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x8117('0x0'));exports[_0x8117('0x1')]=function(){return function(_0x2a3d3f){return client[_0x8117('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x8117('0x3'),_0x8117('0x4'),_0x8117('0x5'),'zone',_0x8117('0x6'),_0x8117('0x7'),_0x8117('0x8'),'code',_0x8117('0x9')],'include':[{'model':_0x8117('0xa'),'as':'Configurations','attributes':['id',_0x8117('0x3'),_0x8117('0xb'),_0x8117('0xc'),_0x8117('0x4')],'include':[{'model':_0x8117('0xd'),'as':_0x8117('0xe'),'attributes':['id',_0x8117('0xf'),'content',_0x8117('0x10')],'include':[{'model':_0x8117('0x11'),'as':'Variable','attributes':['id',_0x8117('0x3')]}]},{'model':_0x8117('0xd'),'as':_0x8117('0x12'),'attributes':['id','type',_0x8117('0x13'),_0x8117('0x14'),_0x8117('0x15'),_0x8117('0x16'),'variableName'],'include':[{'model':_0x8117('0x11'),'as':_0x8117('0x11'),'attributes':['id',_0x8117('0x3')]}]},{'model':_0x8117('0xd'),'as':_0x8117('0x17'),'attributes':['id','type',_0x8117('0x13'),_0x8117('0x18'),_0x8117('0x19'),_0x8117('0x1a'),_0x8117('0x10')],'include':[{'model':_0x8117('0x11'),'as':'Variable','attributes':['id',_0x8117('0x3')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index c9349f5..c38b206 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc9=['isArray','every','number','string','map','length','interval','concat','IntervalIftime','dialer','../client','stack','replace','silly','intervalIftime\x20called\x20with'];(function(_0x140f31,_0x33b999){var _0x243a12=function(_0x5b9676){while(--_0x5b9676){_0x140f31['push'](_0x140f31['shift']());}};_0x243a12(++_0x33b999);}(_0xafc9,0x135));var _0x9afc=function(_0x84f510,_0x12e9cf){_0x84f510=_0x84f510-0x0;var _0x40341c=_0xafc9[_0x84f510];return _0x40341c;};var logger=require('../../../config/logger')(_0x9afc('0x0'));var client=require(_0x9afc('0x1'));function intervalIftime(_0x3bb162,_0x2d686c){const _0x2c0da4=new Error()[_0x9afc('0x2')][_0x9afc('0x3')](/^Error/,'')['trim']();logger[_0x9afc('0x4')](_0x9afc('0x5'),_0x3bb162,_0x2d686c,_0x2c0da4);const _0x183ac8=Array[_0x9afc('0x6')](_0x3bb162);if(!_0x3bb162||_0x183ac8&&_0x3bb162['length']===0x0){return Promise['resolve'](![]);}else{var _0x260669=[];var _0xb4884d=[];var _0x2e8905=_0x183ac8?_0x3bb162:[_0x3bb162];var _0xcf8784=_0x2e8905[_0x9afc('0x7')](function(_0x303058){return typeof _0x303058===_0x9afc('0x8');});var _0x1810e7=_0x2e8905[_0x9afc('0x7')](function(_0x294037){return typeof _0x294037===_0x9afc('0x9');});if(!_0xcf8784&&!_0x1810e7){_0x260669=_0x2e8905[_0x9afc('0xa')](function(_0x55a4e6){return _0x55a4e6['id'];});if(_0x260669[_0x9afc('0xb')]===0x0){_0xb4884d=_0x2e8905[_0x9afc('0xa')](function(_0x56f525){return _0x56f525[_0x9afc('0xc')];});}}else{if(_0xcf8784){_0x260669=_0x260669['concat'](_0x2e8905);}if(_0x1810e7){_0xb4884d=_0xb4884d[_0x9afc('0xd')](_0x2e8905);}}return client['Request'](_0x9afc('0xe'),{'intervalIds':_0x260669,'intervals':_0xb4884d,'timezone':_0x2d686c,'log':'IntervalIftime'});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file +var _0x1c71=['map','length','interval','concat','IntervalIftime','intervalIftime','dialer','../client','stack','trim','silly','intervalIftime\x20called\x20with','every','string'];(function(_0x3302c2,_0x4a60e5){var _0x258145=function(_0x30d0d0){while(--_0x30d0d0){_0x3302c2['push'](_0x3302c2['shift']());}};_0x258145(++_0x4a60e5);}(_0x1c71,0x19c));var _0x11c7=function(_0x3d0bf2,_0x5e7f22){_0x3d0bf2=_0x3d0bf2-0x0;var _0x3be65f=_0x1c71[_0x3d0bf2];return _0x3be65f;};var logger=require('../../../config/logger')(_0x11c7('0x0'));var client=require(_0x11c7('0x1'));function intervalIftime(_0x35530a,_0xfd517e){const _0x314ae4=new Error()[_0x11c7('0x2')]['replace'](/^Error/,'')[_0x11c7('0x3')]();logger[_0x11c7('0x4')](_0x11c7('0x5'),_0x35530a,_0xfd517e,_0x314ae4);const _0x292325=Array['isArray'](_0x35530a);if(!_0x35530a||_0x292325&&_0x35530a['length']===0x0){return Promise['resolve'](![]);}else{var _0x135cdb=[];var _0x11cd45=[];var _0x271150=_0x292325?_0x35530a:[_0x35530a];var _0x20a094=_0x271150[_0x11c7('0x6')](function(_0x504c26){return typeof _0x504c26==='number';});var _0x5a9e9b=_0x271150[_0x11c7('0x6')](function(_0x217828){return typeof _0x217828===_0x11c7('0x7');});if(!_0x20a094&&!_0x5a9e9b){_0x135cdb=_0x271150[_0x11c7('0x8')](function(_0x21e56c){return _0x21e56c['id'];});if(_0x135cdb[_0x11c7('0x9')]===0x0){_0x11cd45=_0x271150[_0x11c7('0x8')](function(_0x61964b){return _0x61964b[_0x11c7('0xa')];});}}else{if(_0x20a094){_0x135cdb=_0x135cdb[_0x11c7('0xb')](_0x271150);}if(_0x5a9e9b){_0x11cd45=_0x11cd45[_0x11c7('0xb')](_0x271150);}}return client['Request']('IntervalIftime',{'intervalIds':_0x135cdb,'intervals':_0x11cd45,'timezone':_0xfd517e,'log':_0x11c7('0xc')});}}exports[_0x11c7('0xd')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 51f29ec..dcc5e16 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf696=['uniqueid','voiceDialReport','Request','voice','membername','starttime','endtime','outbound','dialstring','moment','util','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber'];(function(_0x85cb49,_0x50a08a){var _0x52f463=function(_0x3e816b){while(--_0x3e816b){_0x85cb49['push'](_0x85cb49['shift']());}};_0x52f463(++_0x50a08a);}(_0xf696,0x10e));var _0x6f69=function(_0x4e7aa7,_0x3ed2b5){_0x4e7aa7=_0x4e7aa7-0x0;var _0x398c74=_0xf696[_0x4e7aa7];return _0x398c74;};'use strict';var moment=require(_0x6f69('0x0'));var _=require('lodash');var util=require(_0x6f69('0x1'));var client=require(_0x6f69('0x2'));exports[_0x6f69('0x3')]=function(_0x4fc3e6){var _0xc1d90f=_0x4fc3e6[_0x6f69('0x4')]||_0x4fc3e6['queuecallerexitAt'];return client['Request'](_0x6f69('0x5'),{'body':{'channel':'voice','membername':_0x4fc3e6[_0x6f69('0x6')],'interface':_['isNil'](_0x4fc3e6[_0x6f69('0x7')])?util[_0x6f69('0x8')](_0x6f69('0x9'),_0x4fc3e6['lastAssignedTo']):_0x4fc3e6[_0x6f69('0x7')],'type':_0x6f69('0xa'),'enterAt':_0x4fc3e6[_0x6f69('0xb')],'exitAt':_0xc1d90f,'duration':moment(_0xc1d90f)[_0x6f69('0xc')](_0x4fc3e6[_0x6f69('0xb')],_0x6f69('0xd')),'data1':'inbound','data2':_0x4fc3e6[_0x6f69('0xe')],'data3':_0x4fc3e6[_0x6f69('0xf')],'data4':null,'data5':_0x4fc3e6[_0x6f69('0x10')],'role':_0x6f69('0x11'),'internal':_0x4fc3e6[_0x6f69('0x12')]?_[_0x6f69('0x13')](_0x4fc3e6[_0x6f69('0x12')]):undefined,'uniqueid':_0x4fc3e6[_0x6f69('0x14')]},'log':'CreateMemberReport'});};exports[_0x6f69('0x15')]=function(_0x7b2d5a){return client[_0x6f69('0x16')](_0x6f69('0x5'),{'body':{'channel':_0x6f69('0x17'),'membername':_0x7b2d5a[_0x6f69('0x18')],'interface':_0x7b2d5a[_0x6f69('0x7')],'type':_0x6f69('0xa'),'enterAt':_0x7b2d5a[_0x6f69('0x19')],'exitAt':_0x7b2d5a['endtime'],'duration':moment(_0x7b2d5a[_0x6f69('0x1a')])['diff'](_0x7b2d5a['starttime'],'seconds')>=0x0?moment(_0x7b2d5a['endtime'])[_0x6f69('0xc')](_0x7b2d5a[_0x6f69('0x19')],'seconds'):null,'data1':_0x6f69('0x1b'),'data2':_0x7b2d5a[_0x6f69('0x12')],'data3':_0x7b2d5a['exten'],'data4':_0x7b2d5a[_0x6f69('0x1c')]||null,'role':_0x6f69('0x11'),'internal':_0x7b2d5a[_0x6f69('0x12')]?_[_0x6f69('0x13')](_0x7b2d5a[_0x6f69('0x12')]):undefined,'uniqueid':_0x7b2d5a[_0x6f69('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xb26c=['moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','diff','queuecallerleaveAt','calleridnum','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','seconds','dialstring'];(function(_0x15f7e2,_0x4588d1){var _0x285ad0=function(_0x1d9db2){while(--_0x1d9db2){_0x15f7e2['push'](_0x15f7e2['shift']());}};_0x285ad0(++_0x4588d1);}(_0xb26c,0x1ba));var _0xcb26=function(_0x8f0301,_0x484a41){_0x8f0301=_0x8f0301-0x0;var _0x5c9956=_0xb26c[_0x8f0301];return _0x5c9956;};'use strict';var moment=require(_0xcb26('0x0'));var _=require(_0xcb26('0x1'));var util=require('util');var client=require(_0xcb26('0x2'));exports[_0xcb26('0x3')]=function(_0x351348){var _0x4906dc=_0x351348[_0xcb26('0x4')]||_0x351348['queuecallerexitAt'];return client[_0xcb26('0x5')](_0xcb26('0x6'),{'body':{'channel':_0xcb26('0x7'),'membername':_0x351348[_0xcb26('0x8')],'interface':_[_0xcb26('0x9')](_0x351348[_0xcb26('0xa')])?util[_0xcb26('0xb')]('SIP/%s',_0x351348['lastAssignedTo']):_0x351348[_0xcb26('0xa')],'type':_0xcb26('0xc'),'enterAt':_0x351348['queuecallerleaveAt'],'exitAt':_0x4906dc,'duration':moment(_0x4906dc)[_0xcb26('0xd')](_0x351348[_0xcb26('0xe')],'seconds'),'data1':'inbound','data2':_0x351348[_0xcb26('0xf')],'data3':_0x351348['exten'],'data4':null,'data5':_0x351348[_0xcb26('0x10')],'role':_0xcb26('0x11'),'internal':_0x351348[_0xcb26('0x12')]?_[_0xcb26('0x13')](_0x351348[_0xcb26('0x12')]):undefined,'uniqueid':_0x351348[_0xcb26('0x14')]},'log':'CreateMemberReport'});};exports[_0xcb26('0x15')]=function(_0x3640c1){return client[_0xcb26('0x5')]('CreateMemberReport',{'body':{'channel':_0xcb26('0x7'),'membername':_0x3640c1['membername'],'interface':_0x3640c1[_0xcb26('0xa')],'type':'TALKING','enterAt':_0x3640c1[_0xcb26('0x16')],'exitAt':_0x3640c1[_0xcb26('0x17')],'duration':moment(_0x3640c1[_0xcb26('0x17')])[_0xcb26('0xd')](_0x3640c1[_0xcb26('0x16')],_0xcb26('0x18'))>=0x0?moment(_0x3640c1[_0xcb26('0x17')])['diff'](_0x3640c1[_0xcb26('0x16')],_0xcb26('0x18')):null,'data1':'outbound','data2':_0x3640c1['accountcode'],'data3':_0x3640c1['exten'],'data4':_0x3640c1[_0xcb26('0x19')]||null,'role':'agent','internal':_0x3640c1[_0xcb26('0x12')]?_[_0xcb26('0x13')](_0x3640c1[_0xcb26('0x12')]):undefined,'uniqueid':_0x3640c1[_0xcb26('0x14')]},'log':_0xcb26('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index deff401..b883b0b 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 _0xe235=['Request','ShowSetting','GetSettings','../client','getSettings'];(function(_0x3f95d2,_0x486845){var _0xa15508=function(_0x3b88ea){while(--_0x3b88ea){_0x3f95d2['push'](_0x3f95d2['shift']());}};_0xa15508(++_0x486845);}(_0xe235,0xe4));var _0x5e23=function(_0x3594d3,_0x521d3c){_0x3594d3=_0x3594d3-0x0;var _0x50a324=_0xe235[_0x3594d3];return _0x50a324;};'use strict';var client=require(_0x5e23('0x0'));exports[_0x5e23('0x1')]=function(){return client[_0x5e23('0x2')](_0x5e23('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x5e23('0x4')});}; \ No newline at end of file +var _0x8a9d=['ShowSetting','stopRecordingOnTransfer','GetSettings','../client','getSettings'];(function(_0x56342a,_0x3ab7c2){var _0x183399=function(_0x2bca3f){while(--_0x2bca3f){_0x56342a['push'](_0x56342a['shift']());}};_0x183399(++_0x3ab7c2);}(_0x8a9d,0x1ed));var _0xd8a9=function(_0x4a71f5,_0x401424){_0x4a71f5=_0x4a71f5-0x0;var _0x27162f=_0x8a9d[_0x4a71f5];return _0x27162f;};'use strict';var client=require(_0xd8a9('0x0'));exports[_0xd8a9('0x1')]=function(){return client['Request'](_0xd8a9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd8a9('0x3'),'previewRecallmeReminderInterval']},'log':_0xd8a9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1532d7e..c4bf8cb 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 _0xf34f=['../client','Request','name','html','GetTemplate'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf34f,0x64));var _0xff34=function(_0x1d3faa,_0x1aa218){_0x1d3faa=_0x1d3faa-0x0;var _0x230100=_0xf34f[_0x1d3faa];return _0x230100;};'use strict';var client=require(_0xff34('0x0'));exports['getTemplates']=function(_0x40eb8a){return function(_0x5c19c4){return client[_0xff34('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xff34('0x2'),_0xff34('0x3')]},'log':_0xff34('0x4')});};}; \ No newline at end of file +var _0xdb71=['GetTemplate','name','html'];(function(_0x345ff1,_0x20b64c){var _0x54d8ea=function(_0x4cd9f9){while(--_0x4cd9f9){_0x345ff1['push'](_0x345ff1['shift']());}};_0x54d8ea(++_0x20b64c);}(_0xdb71,0x150));var _0x1db7=function(_0x11c249,_0x4104a5){_0x11c249=_0x11c249-0x0;var _0x36a33d=_0xdb71[_0x11c249];return _0x36a33d;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x11e787){return function(_0x1a4458){return client['Request'](_0x1db7('0x0'),{'options':{'raw':!![],'attributes':['id',_0x1db7('0x1'),_0x1db7('0x2')]},'log':_0x1db7('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f9271d2..aa9ef23 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 _0x5667=['Condition','AllConditions','operator','value','AnyConditions','field','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x5667,0x18b));var _0x7566=function(_0x534f8b,_0x224e4d){_0x534f8b=_0x534f8b-0x0;var _0x4b9523=_0x5667[_0x534f8b];return _0x4b9523;};'use strict';var client=require(_0x7566('0x0'));exports[_0x7566('0x1')]=function(_0x357980){return function(_0x330dd8){return client['Request'](_0x7566('0x2'),{'options':{'raw':![],'attributes':['id',_0x7566('0x3'),_0x7566('0x4'),'status'],'include':[{'model':_0x7566('0x5'),'as':_0x7566('0x6'),'attributes':['id','field',_0x7566('0x7'),_0x7566('0x8')]},{'model':'Condition','as':_0x7566('0x9'),'attributes':['id',_0x7566('0xa'),_0x7566('0x7'),_0x7566('0x8')]},{'model':'Action','as':_0x7566('0xb'),'attributes':['id',_0x7566('0xc'),_0x7566('0xd'),_0x7566('0xe'),_0x7566('0xf'),_0x7566('0x10'),_0x7566('0x11'),_0x7566('0x12'),_0x7566('0x13')]}]},'log':_0x7566('0x2')});};}; \ No newline at end of file +var _0x7b5a=['GetTrigger','name','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data2','data3','data4','data5','data7','../client','Request'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x7b5a,0xc6));var _0xa7b5=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x7b5a[_0x34df4a];return _0x145c69;};'use strict';var client=require(_0xa7b5('0x0'));exports['getTriggers']=function(_0x43c36f){return function(_0x16dd75){return client[_0xa7b5('0x1')](_0xa7b5('0x2'),{'options':{'raw':![],'attributes':['id',_0xa7b5('0x3'),_0xa7b5('0x4'),_0xa7b5('0x5')],'include':[{'model':'Condition','as':_0xa7b5('0x6'),'attributes':['id',_0xa7b5('0x7'),_0xa7b5('0x8'),_0xa7b5('0x9')]},{'model':_0xa7b5('0xa'),'as':_0xa7b5('0xb'),'attributes':['id','field',_0xa7b5('0x8'),'value']},{'model':_0xa7b5('0xc'),'as':_0xa7b5('0xd'),'attributes':['id',_0xa7b5('0xe'),'data1',_0xa7b5('0xf'),_0xa7b5('0x10'),_0xa7b5('0x11'),_0xa7b5('0x12'),'data6',_0xa7b5('0x13')]}]},'log':_0xa7b5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c33570f..183ddc9 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 _0x7aaf=['name','defaultuser','../client'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x21e7b2,_0x2720f8){_0x21e7b2=_0x21e7b2-0x0;var _0x14e812=_0x7aaf[_0x21e7b2];return _0x14e812;};'use strict';var client=require(_0xf7aa('0x0'));exports['getTrunks']=function(_0x3e729f){return function(_0x32ab7c){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf7aa('0x1'),'registry',_0xf7aa('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xe489=['name','registry','../client','getTrunks','Request','GetTrunk'];(function(_0xbad2b4,_0x165d66){var _0x9304ef=function(_0x17aa50){while(--_0x17aa50){_0xbad2b4['push'](_0xbad2b4['shift']());}};_0x9304ef(++_0x165d66);}(_0xe489,0x9e));var _0x9e48=function(_0x3ea5fc,_0x435244){_0x3ea5fc=_0x3ea5fc-0x0;var _0x187859=_0xe489[_0x3ea5fc];return _0x187859;};'use strict';var client=require(_0x9e48('0x0'));exports[_0x9e48('0x1')]=function(_0x4cc45c){return function(_0x38c1c5){return client[_0x9e48('0x2')](_0x9e48('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9e48('0x4'),_0x9e48('0x5'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e43b3ae..cfd95a6 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe706,0xa3));var _0x6e70=function(_0x8e3507,_0x7c734c){_0x8e3507=_0x8e3507-0x0;var _0x48c52b=_0xe706[_0x8e3507];return _0x48c52b;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x14e29d,_0x5b578d){var _0x562327=function(_0x494430){while(--_0x494430){_0x14e29d['push'](_0x14e29d['shift']());}};_0x562327(++_0x5b578d);}(_0x70e0,0x17b));var _0x070e=function(_0x56d83d,_0x47237e){_0x56d83d=_0x56d83d-0x0;var _0x32153d=_0x70e0[_0x56d83d];return _0x32153d;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 9cff14a..712f24c 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 _0xb3a3=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x518b8f,_0x476de4){var _0x51cece=function(_0x13e53e){while(--_0x13e53e){_0x518b8f['push'](_0x518b8f['shift']());}};_0x51cece(++_0x476de4);}(_0xb3a3,0x73));var _0x3b3a=function(_0xd702f0,_0x50f40c){_0xd702f0=_0xd702f0-0x0;var _0x17bafd=_0xb3a3[_0xd702f0];return _0x17bafd;};'use strict';var client=require(_0x3b3a('0x0'));exports[_0x3b3a('0x1')]=function(_0xc0c452){return client[_0x3b3a('0x2')]('CreateVoiceAgentReport',{'body':_0xc0c452,'log':_0x3b3a('0x3')});};exports[_0x3b3a('0x4')]=function(_0x3cdad9,_0x2b763f,_0x4da3d1){return client[_0x3b3a('0x2')](_0x3b3a('0x5'),{'body':_0x3cdad9,'options':{'where':{'uniqueid':_0x2b763f,'interface':_0x4da3d1,'agentcomplete':!![]}},'log':_0x3b3a('0x5')});}; \ No newline at end of file +var _0x4ee8=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x18bac7,_0x582012){var _0x4c4045=function(_0x4065d9){while(--_0x4065d9){_0x18bac7['push'](_0x18bac7['shift']());}};_0x4c4045(++_0x582012);}(_0x4ee8,0xc8));var _0x84ee=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4ee8[_0x1deb03];return _0x189fe7;};'use strict';var client=require(_0x84ee('0x0'));exports['create']=function(_0x1eaa88){return client['Request']('CreateVoiceAgentReport',{'body':_0x1eaa88,'log':_0x84ee('0x1')});};exports['update']=function(_0x1119c2,_0x292419,_0x59fc8e){return client['Request'](_0x84ee('0x2'),{'body':_0x1119c2,'options':{'where':{'uniqueid':_0x292419,'interface':_0x59fc8e,'agentcomplete':!![]}},'log':_0x84ee('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2158e08..ced4720 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 _0x1f1d=['endOf','disposition','duration','billableseconds','moment','lodash','../client','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xd71a75,_0x51afd3){var _0x278bf9=function(_0x586b78){while(--_0x586b78){_0xd71a75['push'](_0xd71a75['shift']());}};_0x278bf9(++_0x51afd3);}(_0x1f1d,0x100));var _0xd1f1=function(_0x40060f,_0x5750eb){_0x40060f=_0x40060f-0x0;var _0x15ad40=_0x1f1d[_0x40060f];return _0x15ad40;};'use strict';var moment=require(_0xd1f1('0x0'));var util=require('util');var _=require(_0xd1f1('0x1'));var client=require(_0xd1f1('0x2'));exports['create']=function(_0x40f829){return client['Request'](_0xd1f1('0x3'),{'body':_[_0xd1f1('0x4')](_0x40f829,{'source':_0x40f829['calleridnum'],'destinationcontext':_0x40f829['context'],'callerid':_0x40f829[_0xd1f1('0x5')],'amaflags':_0xd1f1('0x6')}),'log':_0xd1f1('0x3')});};exports[_0xd1f1('0x7')]=function(){return function(){return client[_0xd1f1('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd1f1('0x9')],'createdAt':{'$between':[moment()[_0xd1f1('0xa')](_0xd1f1('0xb'))[_0xd1f1('0xc')](_0xd1f1('0xd')),moment()[_0xd1f1('0xe')]('day')[_0xd1f1('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xd1f1('0xf'),_0xd1f1('0x10'),_0xd1f1('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xbe4e=['util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment'];(function(_0x589cc8,_0x1b1980){var _0x4fabec=function(_0x43d6ff){while(--_0x43d6ff){_0x589cc8['push'](_0x589cc8['shift']());}};_0x4fabec(++_0x1b1980);}(_0xbe4e,0x68));var _0xebe4=function(_0x5dbe03,_0x2941ff){_0x5dbe03=_0x5dbe03-0x0;var _0x8f51a9=_0xbe4e[_0x5dbe03];return _0x8f51a9;};'use strict';var moment=require(_0xebe4('0x0'));var util=require(_0xebe4('0x1'));var _=require(_0xebe4('0x2'));var client=require(_0xebe4('0x3'));exports[_0xebe4('0x4')]=function(_0x466371){return client[_0xebe4('0x5')](_0xebe4('0x6'),{'body':_['merge'](_0x466371,{'source':_0x466371[_0xebe4('0x7')],'destinationcontext':_0x466371['context'],'callerid':_0x466371['callerid'],'amaflags':_0xebe4('0x8')}),'log':_0xebe4('0x6')});};exports[_0xebe4('0x9')]=function(){return function(){return client[_0xebe4('0x5')](_0xebe4('0xa'),{'options':{'where':{'type':[_0xebe4('0xb')],'createdAt':{'$between':[moment()[_0xebe4('0xc')](_0xebe4('0xd'))[_0xebe4('0xe')](_0xebe4('0xf')),moment()[_0xebe4('0x10')](_0xebe4('0xd'))[_0xebe4('0xe')](_0xebe4('0xf'))]}},'attributes':['type',_0xebe4('0x11'),_0xebe4('0x12'),_0xebe4('0x13')]},'log':_0xebe4('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 823299e..ca65509 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 _0x2498=['create','CreateVoiceDialReport','../client'];(function(_0x4e4228,_0x9c1d93){var _0x219955=function(_0x2f31d6){while(--_0x2f31d6){_0x4e4228['push'](_0x4e4228['shift']());}};_0x219955(++_0x9c1d93);}(_0x2498,0x158));var _0x8249=function(_0x279629,_0x233fde){_0x279629=_0x279629-0x0;var _0x26b2c4=_0x2498[_0x279629];return _0x26b2c4;};'use strict';var client=require(_0x8249('0x0'));exports[_0x8249('0x1')]=function(_0x18642a){return client['Request'](_0x8249('0x2'),{'body':_0x18642a,'log':_0x8249('0x2')});}; \ No newline at end of file +var _0x1c51=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1fdce6,_0x4412d9){var _0x36b546=function(_0x1bf3bb){while(--_0x1bf3bb){_0x1fdce6['push'](_0x1fdce6['shift']());}};_0x36b546(++_0x4412d9);}(_0x1c51,0x1a0));var _0x11c5=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x1c51[_0x5eef05];return _0x56d4b8;};'use strict';var client=require(_0x11c5('0x0'));exports[_0x11c5('0x1')]=function(_0x15669a){return client[_0x11c5('0x2')](_0x11c5('0x3'),{'body':_0x15669a,'log':_0x11c5('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 10a4614..4e422a0 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 _0x8eeb=['recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x266cac,_0x76b613){var _0x52ac0b=function(_0x31113b){while(--_0x31113b){_0x266cac['push'](_0x266cac['shift']());}};_0x52ac0b(++_0x76b613);}(_0x8eeb,0x183));var _0xb8ee=function(_0x3c0670,_0xde741a){_0x3c0670=_0x3c0670-0x0;var _0x5293ff=_0x8eeb[_0x3c0670];return _0x5293ff;};'use strict';var client=require(_0xb8ee('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xb8ee('0x1')](_0xb8ee('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xb8ee('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb8ee('0x4')});};}; \ No newline at end of file +var _0x26c2=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x26c2,0x130));var _0x226c=function(_0x3bbae2,_0x41da97){_0x3bbae2=_0x3bbae2-0x0;var _0x4d7b90=_0x26c2[_0x3bbae2];return _0x4d7b90;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x226c('0x0'),{'options':{'raw':!![],'attributes':['id',_0x226c('0x1'),_0x226c('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x226c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 34d6599..88b6dc2 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 _0x9d3f=['dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','type','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x1233cb,_0x5b57d8){var _0x53c66a=function(_0x1daa8b){while(--_0x1daa8b){_0x1233cb['push'](_0x1233cb['shift']());}};_0x53c66a(++_0x5b57d8);}(_0x9d3f,0x1b8));var _0xf9d3=function(_0x47cd1e,_0x350e38){_0x47cd1e=_0x47cd1e-0x0;var _0x10953e=_0x9d3f[_0x47cd1e];return _0x10953e;};'use strict';var client=require(_0xf9d3('0x0'));exports[_0xf9d3('0x1')]=function(){return function(){return client[_0xf9d3('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xf9d3('0x3'),_0xf9d3('0x4'),_0xf9d3('0x5'),'monitor_format',_0xf9d3('0x6'),'dialActive',_0xf9d3('0x7'),'dialLimitChannel','dialLimitQueue',_0xf9d3('0x8'),_0xf9d3('0x9'),_0xf9d3('0xa'),_0xf9d3('0xb'),_0xf9d3('0xc'),'dialOriginateCallerIdNumber',_0xf9d3('0xd'),'dialQueueOptions',_0xf9d3('0xe'),_0xf9d3('0xf'),'dialCongestionMaxRetry',_0xf9d3('0x10'),_0xf9d3('0x11'),_0xf9d3('0x12'),_0xf9d3('0x13'),_0xf9d3('0x14'),_0xf9d3('0x15'),_0xf9d3('0x16'),_0xf9d3('0x17'),_0xf9d3('0x18'),_0xf9d3('0x19'),_0xf9d3('0x1a'),_0xf9d3('0x1b'),_0xf9d3('0x1c'),_0xf9d3('0x1d'),_0xf9d3('0x1e'),_0xf9d3('0x1f'),_0xf9d3('0x20'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xf9d3('0x21'),_0xf9d3('0x22'),_0xf9d3('0x23'),'dialRecallInQueue',_0xf9d3('0x24'),_0xf9d3('0x25'),_0xf9d3('0x26'),_0xf9d3('0x27'),_0xf9d3('0x28'),_0xf9d3('0x29'),_0xf9d3('0x2a'),_0xf9d3('0x2b'),_0xf9d3('0x2c'),_0xf9d3('0x2d'),_0xf9d3('0x2e'),_0xf9d3('0x2f'),_0xf9d3('0x30'),_0xf9d3('0x31'),_0xf9d3('0x32'),'dialMachineRetryFrequency',_0xf9d3('0x33'),_0xf9d3('0x34'),_0xf9d3('0x35'),_0xf9d3('0x36'),_0xf9d3('0x37'),_0xf9d3('0x38'),_0xf9d3('0x39')],'include':[{'model':_0xf9d3('0x3a'),'as':'Trunk','attributes':['id',_0xf9d3('0x3b'),_0xf9d3('0x3c'),'active']},{'model':'Pause','as':_0xf9d3('0x3d'),'attributes':['id',_0xf9d3('0x3b')]},{'model':_0xf9d3('0x3a'),'as':_0xf9d3('0x3e'),'attributes':['id','name','callerid',_0xf9d3('0x3f')]},{'model':_0xf9d3('0x40'),'as':'Interval','attributes':['id',_0xf9d3('0x3b')],'include':[{'model':_0xf9d3('0x40'),'as':_0xf9d3('0x41'),'attributes':['id',_0xf9d3('0x3b'),'interval']}]}]},'log':_0xf9d3('0x1')});};}; \ No newline at end of file +var _0x649f=['name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk'];(function(_0x24d20d,_0x569a27){var _0x3a1048=function(_0x5679b7){while(--_0x5679b7){_0x24d20d['push'](_0x24d20d['shift']());}};_0x3a1048(++_0x569a27);}(_0x649f,0x8d));var _0xf649=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x649f[_0x1f36bb];return _0xaf97fa;};'use strict';var client=require(_0xf649('0x0'));exports[_0xf649('0x1')]=function(){return function(){return client[_0xf649('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xf649('0x3'),_0xf649('0x4'),_0xf649('0x5'),_0xf649('0x6'),'type',_0xf649('0x7'),_0xf649('0x8'),_0xf649('0x9'),'dialLimitQueue',_0xf649('0xa'),_0xf649('0xb'),_0xf649('0xc'),_0xf649('0xd'),_0xf649('0xe'),_0xf649('0xf'),'dialOriginateTimeout',_0xf649('0x10'),_0xf649('0x11'),'dialQueueProject',_0xf649('0x12'),_0xf649('0x13'),_0xf649('0x14'),_0xf649('0x15'),_0xf649('0x16'),_0xf649('0x17'),'dialGlobalMaxRetry',_0xf649('0x18'),'dialGlobalInterval',_0xf649('0x19'),_0xf649('0x1a'),_0xf649('0x1b'),_0xf649('0x1c'),_0xf649('0x1d'),'dialAMDAfterGreetingSilence',_0xf649('0x1e'),_0xf649('0x1f'),'dialAMDBetweenWordsSilence',_0xf649('0x20'),_0xf649('0x21'),_0xf649('0x22'),_0xf649('0x23'),_0xf649('0x24'),'dialRecallInQueue',_0xf649('0x25'),_0xf649('0x26'),_0xf649('0x27'),'dialQueueProject2',_0xf649('0x6'),_0xf649('0x28'),_0xf649('0x29'),_0xf649('0x2a'),_0xf649('0x2b'),_0xf649('0x2c'),_0xf649('0x2d'),'dialDropRetryFrequency',_0xf649('0x2e'),'dialAbandonedRetryFrequency',_0xf649('0x2f'),_0xf649('0x30'),_0xf649('0x31'),_0xf649('0x32'),_0xf649('0x33'),_0xf649('0x34'),_0xf649('0x35'),_0xf649('0x36'),_0xf649('0x37')],'include':[{'model':'Trunk','as':_0xf649('0x38'),'attributes':['id',_0xf649('0x39'),_0xf649('0x3a'),_0xf649('0x3b')]},{'model':_0xf649('0x3c'),'as':_0xf649('0x3d'),'attributes':['id',_0xf649('0x39')]},{'model':_0xf649('0x38'),'as':_0xf649('0x3e'),'attributes':['id',_0xf649('0x39'),_0xf649('0x3a'),_0xf649('0x3b')]},{'model':_0xf649('0x3f'),'as':_0xf649('0x3f'),'attributes':['id',_0xf649('0x39')],'include':[{'model':'Interval','as':_0xf649('0x40'),'attributes':['id',_0xf649('0x39'),_0xf649('0x41')]}]}]},'log':_0xf649('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 29c51c6..18a6aca 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(_0x33c44e,_0xd8b852){var _0x43be81=function(_0x23bede){while(--_0x23bede){_0x33c44e['push'](_0x33c44e['shift']());}};_0x43be81(++_0xd8b852);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x57e310,_0x36f474){var _0x1a0fc0=function(_0x3dd255){while(--_0x3dd255){_0x57e310['push'](_0x57e310['shift']());}};_0x1a0fc0(++_0x36f474);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 77dcb5d..43879ce 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 _0xc20e=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x3a0222,_0x291410){var _0x10de41=function(_0x4c9743){while(--_0x4c9743){_0x3a0222['push'](_0x3a0222['shift']());}};_0x10de41(++_0x291410);}(_0xc20e,0xdf));var _0xec20=function(_0x4dc988,_0x442649){_0x4dc988=_0x4dc988-0x0;var _0xbb6d68=_0xc20e[_0x4dc988];return _0xbb6d68;};'use strict';var client=require(_0xec20('0x0'));exports[_0xec20('0x1')]=function(_0x20a0cb){return function(){return client[_0xec20('0x2')](_0xec20('0x3'),{'options':{'where':{'VoiceQueueId':_0x20a0cb,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xd577=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x28e96c,_0x2d75ed){var _0x1db3d5=function(_0x101ebd){while(--_0x101ebd){_0x28e96c['push'](_0x28e96c['shift']());}};_0x1db3d5(++_0x2d75ed);}(_0xd577,0x18e));var _0x7d57=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0xd577[_0x51c52b];return _0x581ce3;};'use strict';var client=require('../client');exports[_0x7d57('0x0')]=function(_0x3e5098){return function(){return client[_0x7d57('0x1')](_0x7d57('0x2'),{'options':{'where':{'VoiceQueueId':_0x3e5098,'paused':!![]},'raw':!![]},'log':_0x7d57('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fb953c9..25ef2f2 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(_0x3b09c4,_0x199706){var _0x6c98c9=function(_0x43c76f){while(--_0x43c76f){_0x3b09c4['push'](_0x3b09c4['shift']());}};_0x6c98c9(++_0x199706);}(_0x7a54,0x106));var _0x47a5=function(_0x5e4a74,_0x3dcdb9){_0x5e4a74=_0x5e4a74-0x0;var _0x406401=_0x7a54[_0x5e4a74];return _0x406401;};'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(_0x1f9890,_0x52b7a8){var _0x225f13=function(_0x519f56){while(--_0x519f56){_0x1f9890['push'](_0x1f9890['shift']());}};_0x225f13(++_0x52b7a8);}(_0x7a54,0x106));var _0x47a5=function(_0x5ae9f0,_0x3b03f3){_0x5ae9f0=_0x5ae9f0-0x0;var _0x432ae0=_0x7a54[_0x5ae9f0];return _0x432ae0;};'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 563e677..119f1d1 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 _0xb0a5=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0xf3a8b5,_0x716ce){var _0x494211=function(_0x2c6c2e){while(--_0x2c6c2e){_0xf3a8b5['push'](_0xf3a8b5['shift']());}};_0x494211(++_0x716ce);}(_0xb0a5,0xfa));var _0x5b0a=function(_0x1b5f7a,_0x281348){_0x1b5f7a=_0x1b5f7a-0x0;var _0x205dd7=_0xb0a5[_0x1b5f7a];return _0x205dd7;};'use strict';var client=require(_0x5b0a('0x0'));exports[_0x5b0a('0x1')]={};exports[_0x5b0a('0x2')]=function(_0x24fa9b){return client[_0x5b0a('0x3')](_0x5b0a('0x4'),{'body':{'result':_0x24fa9b['result'],'transfererchannel':_0x24fa9b[_0x5b0a('0x5')],'transferercalleridnum':_0x24fa9b[_0x5b0a('0x6')],'transferercalleridname':_0x24fa9b[_0x5b0a('0x7')],'transfererconnectedlinenum':_0x24fa9b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x24fa9b[_0x5b0a('0x8')],'transfereraccountcode':_0x24fa9b[_0x5b0a('0x9')],'transferercontext':_0x24fa9b[_0x5b0a('0xa')],'transfererexten':_0x24fa9b[_0x5b0a('0xb')],'transfererlinkedid':_0x24fa9b[_0x5b0a('0xc')],'transfereechannel':_0x24fa9b[_0x5b0a('0xd')],'transfereecalleridnum':_0x24fa9b['transfereecalleridnum'],'transfereecalleridname':_0x24fa9b[_0x5b0a('0xe')],'transfereeconnectedlinenum':_0x24fa9b[_0x5b0a('0xf')],'transfereeconnectedlinename':_0x24fa9b['transfereeconnectedlinename'],'transfereeaccountcode':_0x24fa9b[_0x5b0a('0x10')],'transfereecontext':_0x24fa9b['transfereecontext'],'transfereeexten':_0x24fa9b[_0x5b0a('0x11')],'transfereelinkedid':_0x24fa9b[_0x5b0a('0x12')],'isexternal':_0x24fa9b[_0x5b0a('0x13')],'context':_0x24fa9b[_0x5b0a('0x14')],'extension':_0x24fa9b[_0x5b0a('0x15')],'type':_0x5b0a('0x16')},'log':_0x5b0a('0x4')});};exports['attendedTransfer']=function(_0x1e7761){return client[_0x5b0a('0x3')](_0x5b0a('0x4'),{'body':{'result':_0x1e7761[_0x5b0a('0x17')],'transfererchannel':_0x1e7761[_0x5b0a('0x18')],'transferercalleridnum':_0x1e7761['origtransferercalleridnum'],'transferercalleridname':_0x1e7761[_0x5b0a('0x19')],'transfererconnectedlinenum':_0x1e7761[_0x5b0a('0x1a')],'transfererconnectedlinename':_0x1e7761[_0x5b0a('0x1b')],'transfereraccountcode':_0x1e7761[_0x5b0a('0x1c')],'transferercontext':_0x1e7761[_0x5b0a('0x1d')],'transfererexten':_0x1e7761[_0x5b0a('0x1e')],'transfererlinkedid':_0x1e7761[_0x5b0a('0x1f')],'transfereechannel':_0x1e7761[_0x5b0a('0x20')],'transfereecalleridnum':_0x1e7761[_0x5b0a('0x21')],'transfereecalleridname':_0x1e7761['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1e7761[_0x5b0a('0x22')],'transfereeconnectedlinename':_0x1e7761[_0x5b0a('0x23')],'transfereeaccountcode':_0x1e7761[_0x5b0a('0x24')],'transfereecontext':_0x1e7761[_0x5b0a('0x25')],'transfereeexten':_0x1e7761['transfertargetexten'],'transfereelinkedid':_0x1e7761['transfertargetlinkedid'],'isexternal':_0x1e7761['isexternal'],'context':_0x1e7761[_0x5b0a('0x26')],'extension':_0x1e7761['origtransfererexten'],'type':_0x5b0a('0x27')},'log':_0x5b0a('0x4')});}; \ No newline at end of file +var _0x4f8e=['../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','context','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4f8e,0x130));var _0xe4f8=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x4f8e[_0xeff2c3];return _0x2cade6;};'use strict';var client=require(_0xe4f8('0x0'));exports[_0xe4f8('0x1')]={};exports[_0xe4f8('0x2')]=function(_0x443a40){return client[_0xe4f8('0x3')](_0xe4f8('0x4'),{'body':{'result':_0x443a40[_0xe4f8('0x5')],'transfererchannel':_0x443a40[_0xe4f8('0x6')],'transferercalleridnum':_0x443a40['transferercalleridnum'],'transferercalleridname':_0x443a40[_0xe4f8('0x7')],'transfererconnectedlinenum':_0x443a40[_0xe4f8('0x8')],'transfererconnectedlinename':_0x443a40[_0xe4f8('0x9')],'transfereraccountcode':_0x443a40[_0xe4f8('0xa')],'transferercontext':_0x443a40[_0xe4f8('0xb')],'transfererexten':_0x443a40['transfererexten'],'transfererlinkedid':_0x443a40[_0xe4f8('0xc')],'transfereechannel':_0x443a40[_0xe4f8('0xd')],'transfereecalleridnum':_0x443a40[_0xe4f8('0xe')],'transfereecalleridname':_0x443a40[_0xe4f8('0xf')],'transfereeconnectedlinenum':_0x443a40[_0xe4f8('0x10')],'transfereeconnectedlinename':_0x443a40[_0xe4f8('0x11')],'transfereeaccountcode':_0x443a40[_0xe4f8('0x12')],'transfereecontext':_0x443a40['transfereecontext'],'transfereeexten':_0x443a40['transfereeexten'],'transfereelinkedid':_0x443a40[_0xe4f8('0x13')],'isexternal':_0x443a40['isexternal'],'context':_0x443a40[_0xe4f8('0x14')],'extension':_0x443a40['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0xe4f8('0x15')]=function(_0x269db7){return client[_0xe4f8('0x3')](_0xe4f8('0x4'),{'body':{'result':_0x269db7[_0xe4f8('0x5')],'transfererchannel':_0x269db7[_0xe4f8('0x16')],'transferercalleridnum':_0x269db7[_0xe4f8('0x17')],'transferercalleridname':_0x269db7['origtransferercalleridname'],'transfererconnectedlinenum':_0x269db7[_0xe4f8('0x18')],'transfererconnectedlinename':_0x269db7[_0xe4f8('0x19')],'transfereraccountcode':_0x269db7[_0xe4f8('0x1a')],'transferercontext':_0x269db7[_0xe4f8('0x1b')],'transfererexten':_0x269db7['secondtransfererexten'],'transfererlinkedid':_0x269db7[_0xe4f8('0x1c')],'transfereechannel':_0x269db7['transfertargetchannel'],'transfereecalleridnum':_0x269db7['transfertargetcalleridnum'],'transfereecalleridname':_0x269db7['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x269db7[_0xe4f8('0x1d')],'transfereeconnectedlinename':_0x269db7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x269db7[_0xe4f8('0x1e')],'transfereecontext':_0x269db7[_0xe4f8('0x1f')],'transfereeexten':_0x269db7[_0xe4f8('0x20')],'transfereelinkedid':_0x269db7[_0xe4f8('0x21')],'isexternal':_0x269db7[_0xe4f8('0x22')],'context':_0x269db7[_0xe4f8('0x23')],'extension':_0x269db7[_0xe4f8('0x24')],'type':_0xe4f8('0x25')},'log':_0xe4f8('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 34d15b2..14a3d9b 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x267196,_0x213148){var _0x33fe71=function(_0x27f900){while(--_0x27f900){_0x267196['push'](_0x267196['shift']());}};_0x33fe71(++_0x213148);}(_0x7a54,0x106));var _0x47a5=function(_0xcbe108,_0x1ae22e){_0xcbe108=_0xcbe108-0x0;var _0x2d7668=_0x7a54[_0xcbe108];return _0x2d7668;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x748397,_0x26a9e4){var _0x14b357=function(_0xa63cbc){while(--_0xa63cbc){_0x748397['push'](_0x748397['shift']());}};_0x14b357(++_0x26a9e4);}(_0x7a54,0x106));var _0x47a5=function(_0x13e792,_0x19a914){_0x13e792=_0x13e792-0x0;var _0x417d8e=_0x7a54[_0x13e792];return _0x417d8e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 24ee422..671d2fa 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 _0xf88f=['push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','name','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xf88f,0x78));var _0xff88=function(_0x36cc1c,_0x3c6bbe){_0x36cc1c=_0x36cc1c-0x0;var _0xd87f4c=_0xf88f[_0x36cc1c];return _0xd87f4c;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var config=require(_0xff88('0x2'));var logger=require('../../../../config/logger')(_0xff88('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xff88('0x4')]=_[_0xff88('0x5')](config[_0xff88('0x4')],{'host':_0xff88('0x6'),'port':0x18eb});var io=require(_0xff88('0x7'))(new Redis(config[_0xff88('0x4')]));function emit(_0x3c209c,_0x51ff91,_0x21fd0a,_0x583acc,_0x4f9893){logger['info']('[CM][%s][%s]',_0x3c209c,_0x51ff91['id'],_0x21fd0a,_0x583acc,JSON['stringify'](_0x4f9893));io['to'](_0x21fd0a)[_0xff88('0x8')](_0x583acc,_0x4f9893);}exports['exec']=function(_0x1047e3,_0x113c89,_0x10d5cc,_0x20fb45){var _0x5e35c5,_0x13ebd6;var _0x58f3dd={};var _0x5ee5d0;var _0xb3e3e5=Number(_0x10d5cc[_0xff88('0x9')]);var _0x4abdf4=_0x10d5cc[_0xff88('0xa')]?Boolean(Number(_0x10d5cc[_0xff88('0xa')])):![];var _0x566d03;var _0x1e6cd5=![];if(!_[_0xff88('0xb')](_0x10d5cc[_0xff88('0xc')])){if(_0x10d5cc[_0xff88('0xc')]=='1')_0x1e6cd5=!![];}if(!_0x1e6cd5){if(_0x20fb45[_0xff88('0xd')]){_0x58f3dd['id']=_0x20fb45['xmd-contactid'];}}if(!_0x58f3dd['id']){_0x58f3dd[_0xff88('0xe')]=_0xb3e3e5;_0x566d03=_0x10d5cc[_0xff88('0xf')]&&_0x10d5cc[_0xff88('0xf')]!=='0'?_0x10d5cc[_0xff88('0xf')][_0xff88('0x10')](','):[_0xff88('0x11')];_0x58f3dd[_0xff88('0x12')]=_[_0xff88('0x13')](_0x566d03,function(_0x2cf132){var _0x44240f={};_0x44240f[_0x2cf132]=_0x20fb45[_0xff88('0x14')]?_0x20fb45[_0xff88('0x15')]:_0x20fb45[_0xff88('0x16')];return _0x44240f;});_0x5ee5d0=_0x20fb45[_0xff88('0x14')]?_0x20fb45[_0xff88('0x15')]:_0x20fb45[_0xff88('0x16')];}var _0x435d3d=['id',_0xff88('0x17'),_0xff88('0x18'),'phone','mobile',_0xff88('0x19'),'ListId',_0xff88('0x1a'),_0xff88('0x1b'),_0xff88('0x1c')];var _0x374a81=_[_0xff88('0x1d')](_0x435d3d,_0x566d03);BPromise[_0xff88('0x1e')]()['then'](cmContactRpc[_0xff88('0x1f')]({'attributes':_0x374a81,'where':_0x58f3dd,'phone':_0x5ee5d0}))[_0xff88('0x20')](function(_0x56ea4c){_0x13ebd6=_0x56ea4c;if(!_[_0xff88('0x21')](_0x13ebd6)){if(_0x13ebd6[_0xff88('0x22')]===0x1){_0x5e35c5=_0x13ebd6[0x0];logger[_0xff88('0x23')](_0xff88('0x24'),_0x20fb45[_0xff88('0x25')],_0x113c89['id'],_0x5e35c5['id']);}else{logger[_0xff88('0x23')](_0xff88('0x26'),_0x20fb45['uniqueid'],_0x113c89['id'],_[_0xff88('0x13')](_0x13ebd6,'id')['join'](','));}return;}else{logger[_0xff88('0x23')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x20fb45['uniqueid'],_0x113c89['id']);var _0xbbb0b7={'ListId':_0xb3e3e5};var _0x281a61=_0x10d5cc[_0xff88('0x27')]&&_0x10d5cc[_0xff88('0x27')]!=='0'?_0x10d5cc[_0xff88('0x27')]:_0xff88('0x11');if(_0x4abdf4){logger[_0xff88('0x23')](_0xff88('0x28'),_0x20fb45[_0xff88('0x25')],_0x113c89['id']);_0xbbb0b7[_0x281a61]=_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])?_0x20fb45[_0xff88('0x16')]:_0x20fb45[_0xff88('0x15')];if(_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])){_0xbbb0b7['firstName']=_0x20fb45[_0xff88('0x29')]&&_0x20fb45[_0xff88('0x29')]!==''?_0x20fb45['calleridname']:_0xff88('0x2a');}else{_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x2b')]&&_0x20fb45[_0xff88('0x2b')]!==''?_0x20fb45['destcalleridname']:_0xff88('0x2a');}return BPromise[_0xff88('0x1e')]()[_0xff88('0x20')](cmContactRpc[_0xff88('0x2c')](_0xbbb0b7))[_0xff88('0x20')](function(_0x55e375){_0x5e35c5=_0x55e375;_0x13ebd6[_0xff88('0x2d')](_0x55e375);if(_0x5e35c5){logger['info'](_0xff88('0x2e'),_0x20fb45[_0xff88('0x25')],_0x113c89['id'],_0x5e35c5['id']);}return;});}else{logger[_0xff88('0x23')](_0xff88('0x2f'),_0x20fb45[_0xff88('0x25')],_0x113c89['id']);_0xbbb0b7[_0x281a61]=_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])?_0x20fb45[_0xff88('0x16')]:_0x20fb45[_0xff88('0x15')];if(_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])){_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x29')]&&_0x20fb45[_0xff88('0x29')]!==_0xff88('0x30')?_0x20fb45[_0xff88('0x29')]:_0xff88('0x2a');}else{_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x2b')]&&_0x20fb45[_0xff88('0x2b')]!==_0xff88('0x30')?_0x20fb45[_0xff88('0x2b')]:_0xff88('0x2a');}_0x5e35c5=_0xbbb0b7;_0x13ebd6['push'](_0xbbb0b7);return;}}})[_0xff88('0x20')](function(){if(_0x1047e3){emit(_0x20fb45[_0xff88('0x25')],_0x113c89,util[_0xff88('0x31')]('user:%s',_0x1047e3[_0xff88('0x32')]),util['format'](_0xff88('0x33'),_0x10d5cc[_0xff88('0x34')][_0xff88('0x35')]()),{'evt':_[_0xff88('0x36')](_0x20fb45,{'autoCreate':_0x4abdf4}),'contact':_0x5e35c5===undefined?{}:_0x5e35c5,'contacts':_0x13ebd6[_0xff88('0x22')]===0x0?undefined:_0x13ebd6});}});}; \ No newline at end of file +var _0x5d30=['map','destcalleridnum','calleridnum','routeId','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split'];(function(_0xd1b4df,_0x118a9a){var _0x24b551=function(_0x438cfc){while(--_0x438cfc){_0xd1b4df['push'](_0xd1b4df['shift']());}};_0x24b551(++_0x118a9a);}(_0x5d30,0x135));var _0x05d3=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x5d30[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require(_0x05d3('0x0'));var BPromise=require(_0x05d3('0x1'));var Redis=require(_0x05d3('0x2'));var util=require(_0x05d3('0x3'));var config=require(_0x05d3('0x4'));var logger=require(_0x05d3('0x5'))(_0x05d3('0x6'));var cmContactRpc=require(_0x05d3('0x7'));config[_0x05d3('0x8')]=_[_0x05d3('0x9')](config[_0x05d3('0x8')],{'host':_0x05d3('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x05d3('0x8')]));function emit(_0x4ce3a6,_0x19ecad,_0x3da48b,_0x98b752,_0x26756a){logger[_0x05d3('0xb')]('[CM][%s][%s]',_0x4ce3a6,_0x19ecad['id'],_0x3da48b,_0x98b752,JSON[_0x05d3('0xc')](_0x26756a));io['to'](_0x3da48b)['emit'](_0x98b752,_0x26756a);}exports[_0x05d3('0xd')]=function(_0x1c27f2,_0x5e32d9,_0x478da1,_0x5a6b85){var _0x57194c,_0x3a81c2;var _0x388ae6={};var _0x2a6e3c;var _0x5b2c27=Number(_0x478da1['data1']);var _0x133b67=_0x478da1[_0x05d3('0xe')]?Boolean(Number(_0x478da1[_0x05d3('0xe')])):![];var _0x26208e;var _0x141651=![];if(!_[_0x05d3('0xf')](_0x478da1[_0x05d3('0x10')])){if(_0x478da1[_0x05d3('0x10')]=='1')_0x141651=!![];}if(!_0x141651){if(_0x5a6b85['xmd-contactid']){_0x388ae6['id']=_0x5a6b85[_0x05d3('0x11')];}}if(!_0x388ae6['id']){_0x388ae6[_0x05d3('0x12')]=_0x5b2c27;_0x26208e=_0x478da1[_0x05d3('0x13')]&&_0x478da1[_0x05d3('0x13')]!=='0'?_0x478da1[_0x05d3('0x13')][_0x05d3('0x14')](','):['phone'];_0x388ae6['$or']=_[_0x05d3('0x15')](_0x26208e,function(_0x118343){var _0x469e7b={};_0x469e7b[_0x118343]=_0x5a6b85['routeId']?_0x5a6b85[_0x05d3('0x16')]:_0x5a6b85[_0x05d3('0x17')];return _0x469e7b;});_0x2a6e3c=_0x5a6b85[_0x05d3('0x18')]?_0x5a6b85['destcalleridnum']:_0x5a6b85[_0x05d3('0x17')];}var _0x3e4822=['id','firstName',_0x05d3('0x19'),'phone',_0x05d3('0x1a'),_0x05d3('0x1b'),'ListId',_0x05d3('0x1c'),_0x05d3('0x1d'),_0x05d3('0x1e')];var _0x5a9952=_[_0x05d3('0x1f')](_0x3e4822,_0x26208e);BPromise[_0x05d3('0x20')]()[_0x05d3('0x21')](cmContactRpc['getContacts']({'attributes':_0x5a9952,'where':_0x388ae6,'phone':_0x2a6e3c}))[_0x05d3('0x21')](function(_0x454965){_0x3a81c2=_0x454965;if(!_[_0x05d3('0x22')](_0x3a81c2)){if(_0x3a81c2[_0x05d3('0x23')]===0x1){_0x57194c=_0x3a81c2[0x0];logger[_0x05d3('0xb')](_0x05d3('0x24'),_0x5a6b85[_0x05d3('0x25')],_0x5e32d9['id'],_0x57194c['id']);}else{logger[_0x05d3('0xb')](_0x05d3('0x26'),_0x5a6b85[_0x05d3('0x25')],_0x5e32d9['id'],_['map'](_0x3a81c2,'id')['join'](','));}return;}else{logger[_0x05d3('0xb')](_0x05d3('0x27'),_0x5a6b85[_0x05d3('0x25')],_0x5e32d9['id']);var _0x3cc1e2={'ListId':_0x5b2c27};var _0x262f01=_0x478da1[_0x05d3('0x28')]&&_0x478da1[_0x05d3('0x28')]!=='0'?_0x478da1[_0x05d3('0x28')]:_0x05d3('0x29');if(_0x133b67){logger[_0x05d3('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x5a6b85[_0x05d3('0x25')],_0x5e32d9['id']);_0x3cc1e2[_0x262f01]=_[_0x05d3('0xf')](_0x5a6b85['routeId'])?_0x5a6b85[_0x05d3('0x17')]:_0x5a6b85[_0x05d3('0x16')];if(_[_0x05d3('0xf')](_0x5a6b85[_0x05d3('0x18')])){_0x3cc1e2[_0x05d3('0x2a')]=_0x5a6b85[_0x05d3('0x2b')]&&_0x5a6b85['calleridname']!==_0x05d3('0x2c')?_0x5a6b85[_0x05d3('0x2b')]:_0x05d3('0x2d');}else{_0x3cc1e2[_0x05d3('0x2a')]=_0x5a6b85[_0x05d3('0x2e')]&&_0x5a6b85[_0x05d3('0x2e')]!==_0x05d3('0x2c')?_0x5a6b85['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0x05d3('0x21')](cmContactRpc[_0x05d3('0x2f')](_0x3cc1e2))[_0x05d3('0x21')](function(_0x4b7cc7){_0x57194c=_0x4b7cc7;_0x3a81c2[_0x05d3('0x30')](_0x4b7cc7);if(_0x57194c){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x5a6b85['uniqueid'],_0x5e32d9['id'],_0x57194c['id']);}return;});}else{logger['info'](_0x05d3('0x31'),_0x5a6b85['uniqueid'],_0x5e32d9['id']);_0x3cc1e2[_0x262f01]=_[_0x05d3('0xf')](_0x5a6b85[_0x05d3('0x18')])?_0x5a6b85[_0x05d3('0x17')]:_0x5a6b85['destcalleridnum'];if(_[_0x05d3('0xf')](_0x5a6b85[_0x05d3('0x18')])){_0x3cc1e2[_0x05d3('0x2a')]=_0x5a6b85[_0x05d3('0x2b')]&&_0x5a6b85[_0x05d3('0x2b')]!==_0x05d3('0x2c')?_0x5a6b85[_0x05d3('0x2b')]:_0x05d3('0x2d');}else{_0x3cc1e2[_0x05d3('0x2a')]=_0x5a6b85['destcalleridname']&&_0x5a6b85['destcalleridname']!==_0x05d3('0x2c')?_0x5a6b85[_0x05d3('0x2e')]:_0x05d3('0x2d');}_0x57194c=_0x3cc1e2;_0x3a81c2['push'](_0x3cc1e2);return;}}})['then'](function(){if(_0x1c27f2){emit(_0x5a6b85[_0x05d3('0x25')],_0x5e32d9,util['format']('user:%s',_0x1c27f2[_0x05d3('0x32')]),util[_0x05d3('0x33')](_0x05d3('0x34'),_0x478da1[_0x05d3('0x35')]['toLowerCase']()),{'evt':_[_0x05d3('0x36')](_0x5a6b85,{'autoCreate':_0x133b67}),'contact':_0x57194c===undefined?{}:_0x57194c,'contacts':_0x3a81c2[_0x05d3('0x23')]===0x0?undefined:_0x3a81c2});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e220b97..11cf91f 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 _0x3ed1=['url','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','debug','interface','checkTriggers','hasOwnProperty','status','merge','variables','Actions','length','action','contactmanager','motionbar','browser','data1','TemplateId','data2','render','html','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','winArguments','format','toLowerCase','jscripty','trigger:%s','user:%s','exec','integration','queue','routeId','urlforward','script','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','inspect','evt','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','exports','util','lodash'];(function(_0x49de51,_0x34b7c7){var _0x26b9fc=function(_0x582912){while(--_0x582912){_0x49de51['push'](_0x49de51['shift']());}};_0x26b9fc(++_0x34b7c7);}(_0x3ed1,0x83));var _0x13ed=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0x3ed1[_0x25b24a];return _0x224e68;};'use strict';var util=require(_0x13ed('0x0'));var _=require(_0x13ed('0x1'));var url=require(_0x13ed('0x2'));var Mustache=require('mustache');var Redis=require(_0x13ed('0x3'));var urlforward=require(_0x13ed('0x4'));var integration=require(_0x13ed('0x5'));var cmContact=require('./cmContact');var script=require(_0x13ed('0x6'));var config=require(_0x13ed('0x7'));var logger=require(_0x13ed('0x8'))(_0x13ed('0x9'));var ami=require('../ami');config[_0x13ed('0xa')]=_[_0x13ed('0xb')](config[_0x13ed('0xa')],{'host':_0x13ed('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x15bbb3,_0x389433){return _0x15bbb3==_0x389433;},'not_equals':function(_0x2c2110,_0x3fc110){return _0x2c2110!=_0x3fc110;}};var barAndWebActions=[_0x13ed('0xd'),_0x13ed('0x2'),_0x13ed('0xe')];function Trigger(_0x4524db){this[_0x13ed('0xf')]=_0x4524db[_0x13ed('0xf')];this[_0x13ed('0x10')]=_0x4524db[_0x13ed('0x10')];this[_0x13ed('0x11')]=_0x4524db[_0x13ed('0x11')];this[_0x13ed('0x12')]=_0x4524db[_0x13ed('0x12')];this[_0x13ed('0x13')]=_0x4524db[_0x13ed('0x13')];this['zendeskAccounts']=_0x4524db[_0x13ed('0x14')];this[_0x13ed('0x15')]=_0x4524db[_0x13ed('0x15')];this[_0x13ed('0x16')]=_0x4524db[_0x13ed('0x16')];this['sugarcrmAccounts']=_0x4524db['sugarcrmAccounts'];this[_0x13ed('0x17')]=_0x4524db[_0x13ed('0x17')];this[_0x13ed('0x18')]=_0x4524db[_0x13ed('0x18')];this[_0x13ed('0x19')]=_0x4524db[_0x13ed('0x19')];this[_0x13ed('0x1a')]=_0x4524db[_0x13ed('0x1a')];this[_0x13ed('0x1b')]=_0x4524db[_0x13ed('0x1b')];this[_0x13ed('0x1c')]=_0x4524db[_0x13ed('0x1c')];this[_0x13ed('0x1d')]={'zendesk':this[_0x13ed('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x13ed('0x1e')],'zoho':this[_0x13ed('0x17')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x13ed('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x13ed('0x1a')]};ami['on'](_0x13ed('0x1f'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x22'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x23'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x24'),this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x25'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x26'),this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x27'),this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x28'),this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x29'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x2a'),this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x2b'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x2c'),this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on']('custom:dialbegin',this[_0x13ed('0x2d')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x2e'),this[_0x13ed('0x2d')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x2f'),this[_0x13ed('0x2d')][_0x13ed('0x21')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x30'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x31'),this[_0x13ed('0x20')]['bind'](this));ami['on'](_0x13ed('0x32'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x33'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));ami['on'](_0x13ed('0x34'),this[_0x13ed('0x20')][_0x13ed('0x21')](this));}Trigger[_0x13ed('0x35')]['emit']=function(_0x14b41a,_0x25e4b8,_0x5beeb6){logger[_0x13ed('0x36')](_0x14b41a,_0x25e4b8,JSON[_0x13ed('0x37')](_0x5beeb6));io['to'](_0x14b41a)[_0x13ed('0x38')](_0x25e4b8,_0x5beeb6);};Trigger[_0x13ed('0x35')]['syncCustomEvent']=function(_0x70b3cd){var _0x29d4c4=_[_0x13ed('0x39')](_0x70b3cd);if(typeof _0x29d4c4[_0x13ed('0x3a')]===_0x13ed('0x3b')){_0x29d4c4[_0x13ed('0x3a')]=_0x13ed('0x3c');}logger[_0x13ed('0x3d')](_0x13ed('0x20'),util['inspect'](_0x29d4c4,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x29d4c4);};Trigger['prototype'][_0x13ed('0x2d')]=function(_0x55a119){if(this[_0x13ed('0x10')][_0x55a119[_0x13ed('0x3e')]]){this[_0x13ed('0x20')](_0x55a119);}};Trigger['prototype'][_0x13ed('0x3f')]=function(_0x2febec){var _0x276034;for(var _0x38e4bb in this[_0x13ed('0xf')]){if(this[_0x13ed('0xf')][_0x13ed('0x40')](_0x38e4bb)){if(this[_0x13ed('0xf')][_0x38e4bb][_0x13ed('0x41')]){_0x276034=this['checkTrigger'](this[_0x13ed('0xf')][_0x38e4bb],_0x2febec);if(_0x276034){_[_0x13ed('0x42')](_0x2febec,_0x2febec[_0x13ed('0x43')]);for(var _0x7de625=0x0,_0x1129e0,_0x264d69,_0x157b76;_0x7de6250x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x5935bb,_0x576d1d){var _0x1b883a=function(_0x2557c1){while(--_0x2557c1){_0x5935bb['push'](_0x5935bb['shift']());}};_0x1b883a(++_0x576d1d);}(_0x3e74,0x175));var _0x43e7=function(_0x4cfedf,_0x2adb3d){_0x4cfedf=_0x4cfedf-0x0;var _0x1ef90d=_0x3e74[_0x4cfedf];return _0x1ef90d;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 55d5392..669ae1f 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 _0x5feb=['%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','modernAuthentication','remoteUri','tenantId','CloudProvider','resolve','data5','POST','clientId','password','clientSecret','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','catch','outbound','calleridnum','contacts','/systemusers(','4.0','body','headers','substring','lastIndexOf','toLowerCase','telephone1','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','nameField','customField','indexOf','getString','Subjects','ticketType','phonecall','queue','callDirection','Descriptions','odata-entityid','ticketId','format'];(function(_0x417100,_0xbb639){var _0x471378=function(_0x502c08){while(--_0x502c08){_0x417100['push'](_0x417100['shift']());}};_0x471378(++_0xbb639);}(_0x5feb,0x19e));var _0xb5fe=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x5feb[_0x529abc];return _0x453afa;};'use strict';var _=require(_0xb5fe('0x0'));var rp=require(_0xb5fe('0x1'));var util=require(_0xb5fe('0x2'));var intUtil=require(_0xb5fe('0x3'));var md5=require(_0xb5fe('0x4'));var Redis=require(_0xb5fe('0x5'));var logger=require('../../../../config/logger')(_0xb5fe('0x6'));var config=require(_0xb5fe('0x7'));config['redis']=_[_0xb5fe('0x8')](config['redis'],{'host':_0xb5fe('0x9'),'port':0x18eb});var io=require(_0xb5fe('0xa'))(new Redis(config[_0xb5fe('0xb')]));function getAuthToken(_0x258696,_0x419d18,_0x5e6b16){if(_0x258696[_0xb5fe('0xc')]){_0x258696[_0xb5fe('0xd')]=_0x258696['CloudProvider']['data7'];_0x258696[_0xb5fe('0xe')]=_0x258696[_0xb5fe('0xf')]['data2'];return Promise[_0xb5fe('0x10')](_0x258696['CloudProvider'][_0xb5fe('0x11')]);}var _0x3c325={'method':_0xb5fe('0x12'),'uri':_0x419d18,'form':{'client_id':_0x258696[_0xb5fe('0x13')],'resource':_0x258696[_0xb5fe('0xd')],'username':_0x258696['username'],'password':_0x258696[_0xb5fe('0x14')],'grant_type':'password','client_secret':_0x258696[_0xb5fe('0x15')]},'json':!![]};return rp(_0x3c325)[_0xb5fe('0x16')](function(_0x4b377d){return _0x4b377d[_0xb5fe('0x17')];})['catch'](function(_0x4c6fb5){logger[_0xb5fe('0x18')]('['+[_0x5e6b16[_0xb5fe('0x19')]()]+']\x20Wrong\x20credentials!');return _0x4c6fb5[_0xb5fe('0x1a')];});}function getUser(_0x1689bd,_0x212250,_0x1f39ad,_0x59c51d,_0x47d1cf,_0x41752c){return new Promise(function(_0x468d03,_0x4bef47){return getAuthToken(_0x212250,_0x59c51d,_0x41752c)[_0xb5fe('0x16')](function(_0x13a6af){var _0x4b496d={'method':_0xb5fe('0x1b'),'uri':_0x47d1cf+_0xb5fe('0x1c'),'headers':{'Authorization':_0xb5fe('0x1d')+_0x13a6af,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b496d);})[_0xb5fe('0x16')](function(_0x242a7b){var _0x5a2f3e=_0x242a7b[_0xb5fe('0x1e')];var _0x532daa=![];var _0xe8bcc8=null;if(!_[_0xb5fe('0x1f')](_0x1f39ad)){if(intUtil['validateEmail'](_0x1f39ad[_0xb5fe('0x20')])){_0x1689bd['userEmail']=_0x1f39ad[_0xb5fe('0x20')];for(_0xe8bcc8=0x0;_0xe8bcc8<_0x5a2f3e[_0xb5fe('0x21')];_0xe8bcc8++){if(_0x5a2f3e[_0xe8bcc8][_0xb5fe('0x22')]===_0x1f39ad[_0xb5fe('0x20')]&&!_0x5a2f3e[_0xe8bcc8]['isdisabled']){_0x532daa=!![];logger[_0xb5fe('0x23')]('['+[_0x41752c['toUpperCase']()]+_0xb5fe('0x24')+_0x5a2f3e[_0xe8bcc8][_0xb5fe('0x25')]+'!');_0x1689bd['userId']=_0x5a2f3e[_0xe8bcc8]['systemuserid'];}}}}if(!_0x532daa){logger[_0xb5fe('0x23')]('['+[_0x41752c[_0xb5fe('0x19')]()]+_0xb5fe('0x26'));_0x1689bd[_0xb5fe('0x27')]=_0x212250[_0xb5fe('0x28')];for(_0xe8bcc8=0x0;_0xe8bcc8<_0x5a2f3e[_0xb5fe('0x21')];_0xe8bcc8++){if(_0x5a2f3e[_0xe8bcc8]['internalemailaddress']===_0x212250['username']){_0x1689bd[_0xb5fe('0x29')]=_0x5a2f3e[_0xe8bcc8]['systemuserid'];}}}_0x468d03(_0x1689bd);})[_0xb5fe('0x2a')](function(_0x891d72){_0x4bef47(_0x891d72[_0xb5fe('0x1a')]);});});}function createEndUser(_0x40ad88,_0x16d353,_0x496a45,_0x5e2815,_0x1d2dfa,_0x1161a7,_0xe8b19a){return new Promise(function(_0x4f6e1a,_0x575ceb){return getAuthToken(_0x16d353,_0x496a45,_0x1161a7)[_0xb5fe('0x16')](function(_0x4e9256){var _0x3c9c63=_0x1161a7['toLowerCase']()===_0xb5fe('0x2b')?_0x1d2dfa['destcalleridnum']:_0x1d2dfa[_0xb5fe('0x2c')];var _0x207a11={'method':_0xb5fe('0x12'),'uri':_0x5e2815+_0xb5fe('0x2d'),'body':{'fullname':_0x3c9c63,'firstname':_0x3c9c63,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb5fe('0x2e')+_0x40ad88[_0xb5fe('0x29')]+')'},'headers':{'Authorization':_0xb5fe('0x1d')+_0x4e9256,'OData-Version':_0xb5fe('0x2f')},'json':!![],'resolveWithFullResponse':!![]};_0x207a11[_0xb5fe('0x30')][_0xe8b19a]=_0x3c9c63;return rp(_0x207a11);})['then'](function(_0x3ef3f6){var _0x1c7173=_0x3ef3f6[_0xb5fe('0x31')]['odata-entityid'];var _0x2b1566=_0x1c7173[_0xb5fe('0x32')](_0x1c7173[_0xb5fe('0x33')]('(')+0x1,_0x1c7173[_0xb5fe('0x33')](')'));_0x40ad88['enduserId']=_0x2b1566;_0x4f6e1a(_0x40ad88);})[_0xb5fe('0x2a')](function(_0x14ddab){_0x575ceb(_0x14ddab[_0xb5fe('0x1a')]);});});}function getEndUser(_0x1995f8,_0x46e4b0,_0x396664,_0x23cb25,_0x8a8a8b,_0xa2d9ac,_0x96054f,_0x4060bf){var _0xa7556d=_0xa2d9ac[_0xb5fe('0x34')]()==='outbound'?_0x8a8a8b['destcalleridnum']:_0x8a8a8b[_0xb5fe('0x2c')];return getAuthToken(_0x46e4b0,_0x396664,_0xa2d9ac)[_0xb5fe('0x16')](function(_0x4eda7a){_0x4060bf=_0x4060bf?_0x4060bf:_0xb5fe('0x35');var _0x5137db={'method':_0xb5fe('0x1b'),'uri':_0x23cb25+'contacts?$select='+_0x4060bf+'&$filter='+_0x4060bf+_0xb5fe('0x36')+_0xa7556d[_0xb5fe('0x37')]('+',_0xb5fe('0x38'))+'\x27','headers':{'Authorization':_0xb5fe('0x1d')+_0x4eda7a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5137db);})[_0xb5fe('0x16')](function(_0x11b3ab){var _0x2a82b1=![];if(!_0x11b3ab)return _0x2a82b1;var _0x3a7875=_0x11b3ab[_0xb5fe('0x1e')];for(var _0x555097=0x0;_0x555097<_0x3a7875[_0xb5fe('0x21')];_0x555097++){if(_0x3a7875[_0x555097][_0x4060bf]===_0xa7556d){_0x2a82b1=!![];_0x1995f8[_0xb5fe('0x39')]=_0x3a7875[_0x555097][_0xb5fe('0x3a')];}}return _0x2a82b1;})['then'](function(_0x158e3b){if(_0x158e3b)return _0x1995f8;if(_0x96054f===_0xb5fe('0x3b')){logger[_0xb5fe('0x23')]('['+[_0xa2d9ac[_0xb5fe('0x19')]()]+_0xb5fe('0x3c'));return _0x1995f8;}return createEndUser(_0x1995f8,_0x46e4b0,_0x396664,_0x23cb25,_0x8a8a8b,_0xa2d9ac,_0x4060bf)[_0xb5fe('0x16')](function(_0x2a0390){logger[_0xb5fe('0x23')]('['+[_0xa2d9ac[_0xb5fe('0x19')]()]+']\x20Enduser\x20created!',_0x2a0390[_0xb5fe('0x39')]);return _0x2a0390;});});}function getCustomFields(_0x187940,_0x3201e7,_0x3c7b7d){var _0x24c864={};if(_0x187940[_0xb5fe('0x21')]>0x0){_[_0xb5fe('0x3d')](_0x187940,function(_0x285340){if(_['includes']([_0xb5fe('0x3e'),'picklist'],_0x285340['type'])&&_0x285340[_0xb5fe('0x3f')]&&!_0x285340[_0xb5fe('0x40')]){var _0x54b9b5=_0x285340['idField'][_0xb5fe('0x34')]();var _0x39bc3a=_0x54b9b5[_0xb5fe('0x32')](0x0,_0x54b9b5[_0xb5fe('0x41')]('_'));var _0x24bc4b=_0x54b9b5['substring'](_0x54b9b5[_0xb5fe('0x41')]('_')+0x1);if(_0x39bc3a===_0x3c7b7d){_0x24c864[_0x24bc4b]=_0x285340['content'];}}});}return _0x24c864;}function getTicket(_0xf69571,_0x412bfe,_0x477f4e,_0x3d67d3,_0x1210b1,_0x5f4ea8,_0x397384){return new Promise(function(_0x2a417d,_0x36dc2f){var _0x209544;return getAuthToken(_0x412bfe,_0x477f4e,_0x397384)[_0xb5fe('0x16')](function(_0x3216f6){if(_0x5f4ea8['ticketType']==='incident'){_0x209544={'method':_0xb5fe('0x12'),'uri':_0x3d67d3+'incidents','body':Object['assign']({},{'title':intUtil[_0xb5fe('0x42')](_0x5f4ea8[_0xb5fe('0x43')],_0x1210b1,'\x20'),'description':intUtil[_0xb5fe('0x42')](_0x5f4ea8['Descriptions'],_0x1210b1,'\x0a'),'customerid_contact@odata.bind':_0xf69571[_0xb5fe('0x39')]?'/contacts('+_0xf69571[_0xb5fe('0x39')]+')':undefined,'ownerid@odata.bind':_0xb5fe('0x2e')+_0xf69571[_0xb5fe('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x5f4ea8['Fields'],_0x1210b1,_0x5f4ea8[_0xb5fe('0x44')])),'headers':{'Authorization':_0xb5fe('0x1d')+_0x3216f6,'OData-Version':_0xb5fe('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5f4ea8[_0xb5fe('0x44')]===_0xb5fe('0x45')){var _0x3a725f=_0xf69571[_0xb5fe('0x39')]?[{'partyid_systemuser@odata.bind':_0xb5fe('0x2e')+_0xf69571[_0xb5fe('0x29')]+')','participationtypemask':_0xf69571['callDirection']===_0xb5fe('0x46')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xf69571[_0xb5fe('0x39')]+')','participationtypemask':_0xf69571[_0xb5fe('0x47')]===_0xb5fe('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xf69571['userId']+')','participationtypemask':_0xf69571[_0xb5fe('0x47')]===_0xb5fe('0x46')?0x2:0x1}];_0x209544={'method':'POST','uri':_0x3d67d3+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xb5fe('0x42')](_0x5f4ea8[_0xb5fe('0x43')],_0x1210b1,'\x20'),'phonenumber':String(_0x1210b1['calleridnum']),'description':intUtil[_0xb5fe('0x42')](_0x5f4ea8[_0xb5fe('0x48')],_0x1210b1,'\x0a'),'regardingobjectid_contact@odata.bind':_0xf69571['enduserId']?'/contacts('+_0xf69571[_0xb5fe('0x39')]+')':undefined,'ownerid@odata.bind':_0xb5fe('0x2e')+_0xf69571[_0xb5fe('0x29')]+')','directioncode':_0xf69571[_0xb5fe('0x47')]===_0xb5fe('0x46')?![]:!![],'phonecall_activity_parties':_0x3a725f},getCustomFields(_0x5f4ea8['Fields'],_0x1210b1,_0x5f4ea8[_0xb5fe('0x44')])),'headers':{'Authorization':_0xb5fe('0x1d')+_0x3216f6,'OData-Version':_0xb5fe('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x209544);})[_0xb5fe('0x16')](function(_0x580d96){var _0x11026a=_0x580d96['headers'][_0xb5fe('0x49')];var _0x5f569f=_0x11026a[_0xb5fe('0x32')](_0x11026a['lastIndexOf']('(')+0x1,_0x11026a[_0xb5fe('0x33')](')'));_0xf69571[_0xb5fe('0x4a')]=_0x5f569f;_0x2a417d(_0xf69571);})[_0xb5fe('0x2a')](function(_0x3ec38b){_0x36dc2f(_0x3ec38b['message']);});});}function emit(_0xfa4044,_0x3158fb,_0x41707d,_0x5e155c){var _0x2913ce={'uri':util[_0xb5fe('0x4b')](_0xb5fe('0x4c'),_0xfa4044,_0x41707d,_0x5e155c)};io['to'](util[_0xb5fe('0x4b')](_0xb5fe('0x4d'),_0x3158fb))[_0xb5fe('0x4e')](_0xb5fe('0x4f'),_0x2913ce);}exports['cs']=function(_0x1e6f57,_0x4b69ed,_0x73a87d,_0x29b282,_0x240eac,_0x5222eb,_0x16957d,_0x2e5071){var _0x1b8627={};_0x5222eb[_0xb5fe('0xd')]=_0x5222eb[_0xb5fe('0xc')]?intUtil[_0xb5fe('0x50')](_0x5222eb[_0xb5fe('0xf')][_0xb5fe('0x51')]):intUtil[_0xb5fe('0x50')](_0x5222eb['remoteUri']);_0x5222eb[_0xb5fe('0x52')]=intUtil[_0xb5fe('0x50')](_0x5222eb['serverUrl']);_0x1b8627['callDirection']=_0x2e5071===_0xb5fe('0x46')||_0x2e5071===_0xb5fe('0x53')?_0xb5fe('0x46'):_0xb5fe('0x2b');var _0x29bbee=_0x5222eb[_0xb5fe('0xc')]?util[_0xb5fe('0x4b')](_0xb5fe('0x54'),_0x5222eb[_0xb5fe('0xf')][_0xb5fe('0x51')]):util[_0xb5fe('0x4b')](_0xb5fe('0x54'),_0x5222eb[_0xb5fe('0xd')]);var _0x533d81=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x5222eb[_0xb5fe('0xe')]);var _0x2c91e3=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5222eb[_0xb5fe('0x52')],_0x4b69ed['uniqueid'],md5(_0x4b69ed[_0xb5fe('0x55')]));if(_0x240eac&&_0x240eac['monitor_format']){logger[_0xb5fe('0x23')](_0xb5fe('0x56'),_0xb5fe('0x57'));_0x4b69ed['recordingURL']=_0x2c91e3;}else if(_0x16957d&&_0x16957d[_0xb5fe('0x58')]&&_0x16957d[_0xb5fe('0x58')]!==_0xb5fe('0x59')){logger[_0xb5fe('0x23')](_0xb5fe('0x5a'),_0xb5fe('0x57'));_0x4b69ed[_0xb5fe('0x5b')]=_0x2c91e3;}else{_0x4b69ed[_0xb5fe('0x5b')]='';}return getUser(_0x1b8627,_0x5222eb,_0x29b282,_0x533d81,_0x29bbee,_0x2e5071)['then'](function(_0x23e09c){logger[_0xb5fe('0x23')]('['+_0x2e5071[_0xb5fe('0x19')]()+_0xb5fe('0x5c'),_0x23e09c[_0xb5fe('0x29')]);logger[_0xb5fe('0x23')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x23e09c[_0xb5fe('0x27')]);return getEndUser(_0x23e09c,_0x5222eb,_0x533d81,_0x29bbee,_0x4b69ed,_0x2e5071,_0x73a87d['moduleCreate'],_0x73a87d['additionalSearchContact']);})[_0xb5fe('0x16')](function(_0x39bb4c){logger[_0xb5fe('0x23')]('['+_0x2e5071['toUpperCase']()+_0xb5fe('0x5d'),_0x39bb4c[_0xb5fe('0x39')]);logger['info']('['+_0x2e5071[_0xb5fe('0x19')]()+_0xb5fe('0x5e'),_0x4b69ed[_0xb5fe('0x2c')]);return getTicket(_0x39bb4c,_0x5222eb,_0x533d81,_0x29bbee,_0x4b69ed,_0x73a87d,_0x2e5071);})[_0xb5fe('0x16')](function(_0x33c96c){logger['info'](util[_0xb5fe('0x4b')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x73a87d[_0xb5fe('0x44')],_0x33c96c[_0xb5fe('0x4a')]));logger[_0xb5fe('0x23')](util[_0xb5fe('0x4b')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20Call\x20direction:\x20%s',_0x2e5071));if(_0x2e5071!=='unmanaged'&&_0x73a87d[_0xb5fe('0x5f')]){logger[_0xb5fe('0x23')]('['+_0x2e5071[_0xb5fe('0x19')]()+']',_0xb5fe('0x60'));emit(_0x5222eb['remoteUri'],_0x29b282['name'],_0x73a87d['ticketType'],_0x33c96c[_0xb5fe('0x4a')]);}})['catch'](function(_0x394c24){logger[_0xb5fe('0x18')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x394c24[_0xb5fe('0x1a')]);console[_0xb5fe('0x18')](_0xb5fe('0x61'),_0x394c24);});}; \ No newline at end of file +var _0x856a=[']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','picklist','type','nameField','customField','idField','substring','indexOf','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','POST','clientId','password','then','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info'];(function(_0x5388dd,_0x553c23){var _0x188e32=function(_0x1ead03){while(--_0x1ead03){_0x5388dd['push'](_0x5388dd['shift']());}};_0x188e32(++_0x553c23);}(_0x856a,0x18d));var _0xa856=function(_0x4f74ea,_0x2a8f6c){_0x4f74ea=_0x4f74ea-0x0;var _0x12c3a5=_0x856a[_0x4f74ea];return _0x12c3a5;};'use strict';var _=require(_0xa856('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0xa856('0x1'));var md5=require(_0xa856('0x2'));var Redis=require('ioredis');var logger=require(_0xa856('0x3'))(_0xa856('0x4'));var config=require(_0xa856('0x5'));config['redis']=_[_0xa856('0x6')](config[_0xa856('0x7')],{'host':_0xa856('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x3b11bb,_0x38c444,_0x50d14c){if(_0x3b11bb[_0xa856('0x9')]){_0x3b11bb[_0xa856('0xa')]=_0x3b11bb[_0xa856('0xb')][_0xa856('0xc')];_0x3b11bb[_0xa856('0xd')]=_0x3b11bb['CloudProvider'][_0xa856('0xe')];return Promise[_0xa856('0xf')](_0x3b11bb[_0xa856('0xb')]['data5']);}var _0x38108f={'method':_0xa856('0x10'),'uri':_0x38c444,'form':{'client_id':_0x3b11bb[_0xa856('0x11')],'resource':_0x3b11bb[_0xa856('0xa')],'username':_0x3b11bb['username'],'password':_0x3b11bb[_0xa856('0x12')],'grant_type':'password','client_secret':_0x3b11bb['clientSecret']},'json':!![]};return rp(_0x38108f)[_0xa856('0x13')](function(_0x327319){return _0x327319[_0xa856('0x14')];})[_0xa856('0x15')](function(_0x37efa1){logger[_0xa856('0x16')]('['+[_0x50d14c[_0xa856('0x17')]()]+']\x20Wrong\x20credentials!');return _0x37efa1['message'];});}function getUser(_0x2a8efe,_0x4f9c98,_0xac0ea9,_0x5901cd,_0x19ed51,_0x321e7f){return new Promise(function(_0x2ecda6,_0x5256d6){return getAuthToken(_0x4f9c98,_0x5901cd,_0x321e7f)[_0xa856('0x13')](function(_0x2c1d8){var _0x44b361={'method':_0xa856('0x18'),'uri':_0x19ed51+_0xa856('0x19'),'headers':{'Authorization':_0xa856('0x1a')+_0x2c1d8,'OData-Version':_0xa856('0x1b')},'json':!![]};return rp(_0x44b361);})[_0xa856('0x13')](function(_0x1d0148){var _0x191f4c=_0x1d0148['value'];var _0xe7481f=![];var _0x5d422e=null;if(!_['isNil'](_0xac0ea9)){if(intUtil[_0xa856('0x1c')](_0xac0ea9[_0xa856('0x1d')])){_0x2a8efe[_0xa856('0x1e')]=_0xac0ea9[_0xa856('0x1d')];for(_0x5d422e=0x0;_0x5d422e<_0x191f4c[_0xa856('0x1f')];_0x5d422e++){if(_0x191f4c[_0x5d422e][_0xa856('0x20')]===_0xac0ea9[_0xa856('0x1d')]&&!_0x191f4c[_0x5d422e][_0xa856('0x21')]){_0xe7481f=!![];logger[_0xa856('0x22')]('['+[_0x321e7f['toUpperCase']()]+_0xa856('0x23')+_0x191f4c[_0x5d422e][_0xa856('0x24')]+'!');_0x2a8efe['userId']=_0x191f4c[_0x5d422e][_0xa856('0x24')];}}}}if(!_0xe7481f){logger[_0xa856('0x22')]('['+[_0x321e7f['toUpperCase']()]+_0xa856('0x25'));_0x2a8efe[_0xa856('0x1e')]=_0x4f9c98['username'];for(_0x5d422e=0x0;_0x5d422e<_0x191f4c[_0xa856('0x1f')];_0x5d422e++){if(_0x191f4c[_0x5d422e]['internalemailaddress']===_0x4f9c98[_0xa856('0x26')]){_0x2a8efe[_0xa856('0x27')]=_0x191f4c[_0x5d422e][_0xa856('0x24')];}}}_0x2ecda6(_0x2a8efe);})[_0xa856('0x15')](function(_0xa88737){_0x5256d6(_0xa88737[_0xa856('0x28')]);});});}function createEndUser(_0x15a96d,_0x6eebe9,_0x147699,_0x4ff80a,_0x589cea,_0x2d0f6f,_0x584449){return new Promise(function(_0x37eeff,_0x4a81b1){return getAuthToken(_0x6eebe9,_0x147699,_0x2d0f6f)['then'](function(_0x3d45ee){var _0x5110f7=_0x2d0f6f[_0xa856('0x29')]()===_0xa856('0x2a')?_0x589cea[_0xa856('0x2b')]:_0x589cea[_0xa856('0x2c')];var _0x520be5={'method':'POST','uri':_0x4ff80a+_0xa856('0x2d'),'body':{'fullname':_0x5110f7,'firstname':_0x5110f7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xa856('0x2e')+_0x15a96d['userId']+')'},'headers':{'Authorization':_0xa856('0x1a')+_0x3d45ee,'OData-Version':_0xa856('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x520be5[_0xa856('0x2f')][_0x584449]=_0x5110f7;return rp(_0x520be5);})['then'](function(_0x60c075){var _0xedb5ca=_0x60c075[_0xa856('0x30')][_0xa856('0x31')];var _0x36e10b=_0xedb5ca['substring'](_0xedb5ca[_0xa856('0x32')]('(')+0x1,_0xedb5ca[_0xa856('0x32')](')'));_0x15a96d[_0xa856('0x33')]=_0x36e10b;_0x37eeff(_0x15a96d);})['catch'](function(_0x47d532){_0x4a81b1(_0x47d532[_0xa856('0x28')]);});});}function getEndUser(_0x497bff,_0x38fa33,_0x2676e6,_0x5d9247,_0x3e3cb4,_0x360457,_0x9279fa,_0x2475d8){var _0x20a56c=_0x360457['toLowerCase']()===_0xa856('0x2a')?_0x3e3cb4[_0xa856('0x2b')]:_0x3e3cb4['calleridnum'];return getAuthToken(_0x38fa33,_0x2676e6,_0x360457)['then'](function(_0x30ab76){_0x2475d8=_0x2475d8?_0x2475d8:_0xa856('0x34');var _0x3c984d={'method':'GET','uri':_0x5d9247+_0xa856('0x35')+_0x2475d8+'&$filter='+_0x2475d8+_0xa856('0x36')+_0x20a56c[_0xa856('0x37')]('+',_0xa856('0x38'))+'\x27','headers':{'Authorization':_0xa856('0x1a')+_0x30ab76,'If-None-Match':null,'OData-Version':_0xa856('0x1b')},'json':!![]};return rp(_0x3c984d);})[_0xa856('0x13')](function(_0x52d665){var _0x490ba0=![];if(!_0x52d665)return _0x490ba0;var _0x3fb4d8=_0x52d665[_0xa856('0x39')];for(var _0x4728db=0x0;_0x4728db<_0x3fb4d8[_0xa856('0x1f')];_0x4728db++){if(_0x3fb4d8[_0x4728db][_0x2475d8]===_0x20a56c){_0x490ba0=!![];_0x497bff[_0xa856('0x33')]=_0x3fb4d8[_0x4728db]['contactid'];}}return _0x490ba0;})[_0xa856('0x13')](function(_0x5decd8){if(_0x5decd8)return _0x497bff;if(_0x9279fa===_0xa856('0x3a')){logger[_0xa856('0x22')]('['+[_0x360457[_0xa856('0x17')]()]+_0xa856('0x3b'));return _0x497bff;}return createEndUser(_0x497bff,_0x38fa33,_0x2676e6,_0x5d9247,_0x3e3cb4,_0x360457,_0x2475d8)['then'](function(_0x10a578){logger['info']('['+[_0x360457[_0xa856('0x17')]()]+']\x20Enduser\x20created!',_0x10a578['enduserId']);return _0x10a578;});});}function getCustomFields(_0x1f64ed,_0xa12bef,_0xa432c7){var _0x19812a={};if(_0x1f64ed[_0xa856('0x1f')]>0x0){_[_0xa856('0x3c')](_0x1f64ed,function(_0x5a6ba7){if(_['includes']([_0xa856('0x3d'),_0xa856('0x3e')],_0x5a6ba7[_0xa856('0x3f')])&&_0x5a6ba7[_0xa856('0x40')]&&!_0x5a6ba7[_0xa856('0x41')]){var _0xa0088f=_0x5a6ba7[_0xa856('0x42')][_0xa856('0x29')]();var _0x4c33e5=_0xa0088f[_0xa856('0x43')](0x0,_0xa0088f[_0xa856('0x44')]('_'));var _0x1f0f20=_0xa0088f['substring'](_0xa0088f[_0xa856('0x44')]('_')+0x1);if(_0x4c33e5===_0xa432c7){_0x19812a[_0x1f0f20]=_0x5a6ba7['content'];}}});}return _0x19812a;}function getTicket(_0x34138b,_0x4c88ee,_0x3fabe0,_0x371acb,_0x4f132e,_0x58419f,_0x547220){return new Promise(function(_0x15dff4,_0x4a045a){var _0x2c6147;return getAuthToken(_0x4c88ee,_0x3fabe0,_0x547220)[_0xa856('0x13')](function(_0x223b6c){if(_0x58419f['ticketType']===_0xa856('0x45')){_0x2c6147={'method':_0xa856('0x10'),'uri':_0x371acb+_0xa856('0x46'),'body':Object[_0xa856('0x47')]({},{'title':intUtil[_0xa856('0x48')](_0x58419f[_0xa856('0x49')],_0x4f132e,'\x20'),'description':intUtil[_0xa856('0x48')](_0x58419f[_0xa856('0x4a')],_0x4f132e,'\x0a'),'customerid_contact@odata.bind':_0x34138b[_0xa856('0x33')]?_0xa856('0x4b')+_0x34138b['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x34138b[_0xa856('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x58419f[_0xa856('0x4c')],_0x4f132e,_0x58419f[_0xa856('0x4d')])),'headers':{'Authorization':'Bearer\x20'+_0x223b6c,'OData-Version':_0xa856('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x58419f[_0xa856('0x4d')]==='phonecall'){var _0x11ef9e=_0x34138b['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x34138b[_0xa856('0x27')]+')','participationtypemask':_0x34138b[_0xa856('0x4e')]===_0xa856('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xa856('0x4b')+_0x34138b['enduserId']+')','participationtypemask':_0x34138b['callDirection']===_0xa856('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa856('0x2e')+_0x34138b[_0xa856('0x27')]+')','participationtypemask':_0x34138b['callDirection']===_0xa856('0x4f')?0x2:0x1}];_0x2c6147={'method':_0xa856('0x10'),'uri':_0x371acb+_0xa856('0x50'),'body':Object[_0xa856('0x47')]({},{'subject':intUtil[_0xa856('0x48')](_0x58419f['Subjects'],_0x4f132e,'\x20'),'phonenumber':String(_0x4f132e[_0xa856('0x2c')]),'description':intUtil['getString'](_0x58419f[_0xa856('0x4a')],_0x4f132e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x34138b[_0xa856('0x33')]?_0xa856('0x4b')+_0x34138b[_0xa856('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x34138b[_0xa856('0x27')]+')','directioncode':_0x34138b[_0xa856('0x4e')]===_0xa856('0x4f')?![]:!![],'phonecall_activity_parties':_0x11ef9e},getCustomFields(_0x58419f[_0xa856('0x4c')],_0x4f132e,_0x58419f[_0xa856('0x4d')])),'headers':{'Authorization':_0xa856('0x1a')+_0x223b6c,'OData-Version':_0xa856('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2c6147);})[_0xa856('0x13')](function(_0x39ee50){var _0x469ce1=_0x39ee50[_0xa856('0x30')][_0xa856('0x31')];var _0x3d01f0=_0x469ce1[_0xa856('0x43')](_0x469ce1[_0xa856('0x32')]('(')+0x1,_0x469ce1['lastIndexOf'](')'));_0x34138b[_0xa856('0x51')]=_0x3d01f0;_0x15dff4(_0x34138b);})[_0xa856('0x15')](function(_0x56bd67){_0x4a045a(_0x56bd67[_0xa856('0x28')]);});});}function emit(_0x297ec5,_0x16c9e0,_0x49159d,_0x75e79b){var _0x3dbb5d={'uri':util[_0xa856('0x52')](_0xa856('0x53'),_0x297ec5,_0x49159d,_0x75e79b)};io['to'](util[_0xa856('0x52')](_0xa856('0x54'),_0x16c9e0))[_0xa856('0x55')]('trigger:browser:url',_0x3dbb5d);}exports['cs']=function(_0x149a3a,_0x488881,_0x2ee9ea,_0x1face6,_0x47003,_0x2a68fb,_0x1b134d,_0x2fd126){var _0x5f0898={};_0x2a68fb[_0xa856('0xa')]=_0x2a68fb[_0xa856('0x9')]?intUtil['stripTrailingSlash'](_0x2a68fb['CloudProvider'][_0xa856('0xc')]):intUtil[_0xa856('0x56')](_0x2a68fb[_0xa856('0xa')]);_0x2a68fb[_0xa856('0x57')]=intUtil['stripTrailingSlash'](_0x2a68fb['serverUrl']);_0x5f0898[_0xa856('0x4e')]=_0x2fd126===_0xa856('0x4f')||_0x2fd126==='unmanaged'?_0xa856('0x4f'):_0xa856('0x2a');var _0x494a15=_0x2a68fb[_0xa856('0x9')]?util[_0xa856('0x52')](_0xa856('0x58'),_0x2a68fb[_0xa856('0xb')][_0xa856('0xc')]):util[_0xa856('0x52')](_0xa856('0x58'),_0x2a68fb['remoteUri']);var _0x3b5002=util[_0xa856('0x52')](_0xa856('0x59'),_0x2a68fb[_0xa856('0xd')]);var _0x47f294=util['format'](_0xa856('0x5a'),_0x2a68fb['serverUrl'],_0x488881[_0xa856('0x5b')],md5(_0x488881[_0xa856('0x5b')]));if(_0x47003&&_0x47003[_0xa856('0x5c')]){logger[_0xa856('0x22')](_0xa856('0x5d'),_0xa856('0x5e'));_0x488881[_0xa856('0x5f')]=_0x47f294;}else if(_0x1b134d&&_0x1b134d[_0xa856('0x60')]&&_0x1b134d[_0xa856('0x60')]!==_0xa856('0x61')){logger['info'](_0xa856('0x62'),_0xa856('0x5e'));_0x488881[_0xa856('0x5f')]=_0x47f294;}else{_0x488881[_0xa856('0x5f')]='';}return getUser(_0x5f0898,_0x2a68fb,_0x1face6,_0x3b5002,_0x494a15,_0x2fd126)[_0xa856('0x13')](function(_0x5456e8){logger[_0xa856('0x22')]('['+_0x2fd126[_0xa856('0x17')]()+_0xa856('0x63'),_0x5456e8['userId']);logger['info']('['+_0x2fd126['toUpperCase']()+_0xa856('0x64'),_0x5456e8[_0xa856('0x1e')]);return getEndUser(_0x5456e8,_0x2a68fb,_0x3b5002,_0x494a15,_0x488881,_0x2fd126,_0x2ee9ea['moduleCreate'],_0x2ee9ea[_0xa856('0x65')]);})[_0xa856('0x13')](function(_0x342f85){logger[_0xa856('0x22')]('['+_0x2fd126[_0xa856('0x17')]()+_0xa856('0x66'),_0x342f85[_0xa856('0x33')]);logger[_0xa856('0x22')]('['+_0x2fd126[_0xa856('0x17')]()+_0xa856('0x67'),_0x488881[_0xa856('0x2c')]);return getTicket(_0x342f85,_0x2a68fb,_0x3b5002,_0x494a15,_0x488881,_0x2ee9ea,_0x2fd126);})[_0xa856('0x13')](function(_0x3bd013){logger[_0xa856('0x22')](util['format']('['+_0x2fd126['toUpperCase']()+_0xa856('0x68'),_0x2ee9ea['ticketType'],_0x3bd013[_0xa856('0x51')]));logger['info'](util[_0xa856('0x52')]('['+_0x2fd126[_0xa856('0x17')]()+']\x20Call\x20direction:\x20%s',_0x2fd126));if(_0x2fd126!=='unmanaged'&&_0x2ee9ea[_0xa856('0x69')]){logger['info']('['+_0x2fd126[_0xa856('0x17')]()+']',_0xa856('0x6a'));emit(_0x2a68fb[_0xa856('0xa')],_0x1face6[_0xa856('0x6b')],_0x2ee9ea[_0xa856('0x4d')],_0x3bd013[_0xa856('0x51')]);}})[_0xa856('0x15')](function(_0x39a427){logger[_0xa856('0x16')]('['+_0x2fd126[_0xa856('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x39a427[_0xa856('0x28')]);console[_0xa856('0x16')]('Error\x20running\x20Dynamics365\x20integration',_0x39a427);});}; \ 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 b70f7e0..d6bcb12 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 _0xf30a=['localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','info','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','picklist','type','nameField','customField','content','includes','string','idField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','monitor_format','lastevent','toUpperCase','catch','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xf30a,0x11b));var _0xaf30=function(_0x29ccae,_0x5d6f15){_0x29ccae=_0x29ccae-0x0;var _0x1ab868=_0xf30a[_0x29ccae];return _0x1ab868;};'use strict';var _=require('lodash');var rp=require(_0xaf30('0x0'));var md5=require(_0xaf30('0x1'));var util=require(_0xaf30('0x2'));var Redis=require('ioredis');var intUtil=require(_0xaf30('0x3'));var config=require(_0xaf30('0x4'));var logger=require(_0xaf30('0x5'))('freshdesk');config[_0xaf30('0x6')]=_[_0xaf30('0x7')](config[_0xaf30('0x6')],{'host':_0xaf30('0x8'),'port':0x18eb});var io=require(_0xaf30('0x9'))(new Redis(config[_0xaf30('0x6')]));var headers={'Content-Type':_0xaf30('0xa'),'Accept':_0xaf30('0xa')};function emit(_0x50b0c9,_0x36f1e9,_0x3664dd){io['to'](_0x50b0c9)[_0xaf30('0xb')](_0x36f1e9,_0x3664dd);}function getTicket(_0x22de42,_0x4c4028,_0x83e3c2,_0x3dd5d6,_0x2a7506){logger['info'](_0xaf30('0xc'));var _0x3037ae=_[_0xaf30('0xd')]({'responder_id':_0x4c4028['id'],'requester_id':_0x83e3c2['id'],'name':util[_0xaf30('0xe')]('Caller\x20-\x20%s',_0x2a7506[_0xaf30('0xf')]),'phone':_0x2a7506[_0xaf30('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xaf30('0x11')](_0x3dd5d6[_0xaf30('0x12')],_0x2a7506,'\x20'),'description':intUtil[_0xaf30('0x11')](_0x3dd5d6[_0xaf30('0x13')],_0x2a7506,'
'),'tags':getTags(_0x3dd5d6[_0xaf30('0x14')],_0xaf30('0x15'))},getCustomFields(_0x3dd5d6[_0xaf30('0x16')],_0x2a7506));_0x3037ae[_0xaf30('0x17')]=_[_0xaf30('0x18')](_[_0xaf30('0x19')](_0x3037ae[_0xaf30('0x17')],'id'),_0xaf30('0x1a'));return request({'uri':util[_0xaf30('0xe')]('%s/api/v2/tickets',_0x22de42[_0xaf30('0x1b')]),'method':_0xaf30('0x1c'),'body':_0x3037ae})[_0xaf30('0x1d')](function(_0xa28d2a){logger['info'](_0xaf30('0x1e'));return _0xa28d2a;});}function getUser(_0xcf9047,_0x3a62ee){if(intUtil[_0xaf30('0x1f')](_0x3a62ee)){return request({'uri':util[_0xaf30('0xe')](_0xaf30('0x20'),_0xcf9047['remoteUri']),'qs':{'email':_0x3a62ee}})[_0xaf30('0x1d')](function(_0x3ef295){if(_0x3ef295[_0xaf30('0x21')]){logger['info'](_0xaf30('0x22'));return _[_0xaf30('0x23')](_0x3ef295,function(_0xb5be93){return _0xb5be93[_0xaf30('0x24')][_0xaf30('0x25')]===_0x3a62ee;});}else{logger[_0xaf30('0x26')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaf30('0xe')]('%s/api/v2/agents/me',_0xcf9047['remoteUri'])})[_0xaf30('0x1d')](function(_0xa2af42){logger[_0xaf30('0x26')](_0xaf30('0x27'));return _0xa2af42;});}});}else{logger['info'](_0xaf30('0x28'));return request({'uri':util[_0xaf30('0xe')](_0xaf30('0x29'),_0xcf9047[_0xaf30('0x1b')])})['then'](function(_0x44c9b1){logger[_0xaf30('0x26')](_0xaf30('0x27'));return _0x44c9b1;});}}function getEndUser(_0x56bb58,_0x4738a7,_0x3c9ea1){logger[_0xaf30('0x26')](_0xaf30('0x2a'),_0x3c9ea1);return request({'uri':util[_0xaf30('0xe')](_0xaf30('0x2b'),_0x56bb58[_0xaf30('0x1b')]),'qs':{'phone':_0x3c9ea1}})[_0xaf30('0x1d')](function(_0x23973a){if(_0x23973a[_0xaf30('0x21')]){logger['info'](_0xaf30('0x2c'));return _[_0xaf30('0x23')](_0x23973a,{'phone':_0x3c9ea1});}else{logger[_0xaf30('0x26')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xaf30('0x2b'),_0x56bb58[_0xaf30('0x1b')]),'method':_0xaf30('0x1c'),'body':{'name':_0x4738a7,'phone':_0x3c9ea1}})['then'](function(_0x264586){logger['info']('Enduser\x20created.');return _0x264586;});}});}function getAuth(_0x3bdad0){return util[_0xaf30('0xe')](_0xaf30('0x2d'),new Buffer(_0x3bdad0[_0xaf30('0x2e')]+':X')[_0xaf30('0x2f')](_0xaf30('0x30')));}function request(_0x976810){logger[_0xaf30('0x31')](_0xaf30('0x32'),JSON['stringify'](_0x976810));return rp(_['defaults'](_0x976810,{'method':_0xaf30('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x2095e5,_0x3cf814){var _0x38914b=[];if(_0x2095e5&&_0x2095e5[_0xaf30('0x21')]>0x0){_0x38914b=_[_0xaf30('0x34')](_0x2095e5,_0x3cf814);}return _0x38914b;}function getCustomFields(_0x34359c,_0x4a6dcc){var _0xce05c=[];var _0x5a7c94={'custom_fields':[]};if(_0x34359c['length']>0x0){_[_0xaf30('0x35')](_0x34359c,function(_0x291423){if(_['includes'](['string',_0xaf30('0x36')],_0x291423[_0xaf30('0x37')])&&_0x291423[_0xaf30('0x38')]&&!_0x291423[_0xaf30('0x39')]){_0x5a7c94[_0x291423['nameField']['toLowerCase']()]=_0x291423[_0xaf30('0x3a')][_0xaf30('0x2f')]();}else if(_[_0xaf30('0x3b')]([_0xaf30('0x3c'),_0xaf30('0x36')],_0x291423[_0xaf30('0x37')])&&_0x291423[_0xaf30('0x3d')]&&_0x291423['customField']){_0x5a7c94[_0xaf30('0x17')]['push']({'id':_0x291423[_0xaf30('0x3d')],'value':_0x291423[_0xaf30('0x3a')][_0xaf30('0x2f')]()});}else if(_0x291423[_0xaf30('0x37')]===_0xaf30('0x3e')&&_0x291423[_0xaf30('0x3f')]&&_0x291423[_0xaf30('0x3d')]&&_0x291423[_0xaf30('0x39')]){_0x4a6dcc[_0x291423[_0xaf30('0x3f')]]&&_0x5a7c94['custom_fields'][_0xaf30('0x40')]({'id':_0x291423[_0xaf30('0x3d')],'value':_0x4a6dcc[_0x291423[_0xaf30('0x3f')]]['toString']()});}else if(_0x291423['type']===_0xaf30('0x41')&&_0x291423[_0xaf30('0x42')]&&_0x291423['Variable']['name']&&_0x291423[_0xaf30('0x3d')]&&_0x291423[_0xaf30('0x39')]){_0x4a6dcc[_0x291423[_0xaf30('0x42')][_0xaf30('0x15')][_0xaf30('0x43')]()]&&_0x5a7c94[_0xaf30('0x17')]['push']({'id':_0x291423[_0xaf30('0x3d')],'value':_0x4a6dcc[_0x291423[_0xaf30('0x42')][_0xaf30('0x15')][_0xaf30('0x43')]()][_0xaf30('0x2f')]()});}});}return _0x5a7c94;}exports[_0xaf30('0x44')]=function(_0x16c26e,_0x59b98b,_0x17f2c6,_0x2b2cc1,_0x2c699a,_0x207546){var _0x50fe0d,_0x43854b;_0x207546[_0xaf30('0x1b')]=intUtil[_0xaf30('0x45')](_0x207546[_0xaf30('0x1b')]);_0x207546[_0xaf30('0x46')]=intUtil[_0xaf30('0x45')](_0x207546['serverUrl']);if(_0x2c699a&&_0x2c699a['monitor_format']){logger[_0xaf30('0x26')](_0xaf30('0x47'),'Recording\x20is\x20enabled!');_0x59b98b[_0xaf30('0x48')]=util['format'](_0xaf30('0x49'),_0x207546['serverUrl'],_0x59b98b[_0xaf30('0x4a')],md5(_0x59b98b[_0xaf30('0x4a')]));}else{_0x59b98b['recordingURL']='';}headers[_0xaf30('0x4b')]=getAuth(_0x207546);return getUser(_0x207546,_0x2b2cc1[_0xaf30('0x25')])[_0xaf30('0x1d')](function(_0x4f9d0e){_0x50fe0d=_0x4f9d0e;logger[_0xaf30('0x26')](_0xaf30('0x4c'),_0x50fe0d['id']);return getEndUser(_0x207546,_0x59b98b[_0xaf30('0xf')],_0x59b98b['calleridnum']);})[_0xaf30('0x1d')](function(_0xeec81d){_0x43854b=_0xeec81d;logger['info'](_0xaf30('0x4d'),_0x43854b['id']);return getTicket(_0x207546,_0x50fe0d,_0x43854b,_0x17f2c6,_0x59b98b);})[_0xaf30('0x1d')](function(_0x53f977){if(_0x53f977&&_0x53f977['id']){logger[_0xaf30('0x26')](_0xaf30('0x1e'));logger[_0xaf30('0x26')]('The\x20Ticket\x20ID\x20is:',_0x53f977['id']);logger[_0xaf30('0x26')](_0xaf30('0x47'),_0xaf30('0x4e'));emit(util[_0xaf30('0xe')](_0xaf30('0x4f'),_0x2b2cc1['name']),_0xaf30('0x50'),{'uri':util[_0xaf30('0xe')](_0xaf30('0x51'),_0x207546[_0xaf30('0x1b')],_0x53f977['id'])});}})['catch'](function(_0x4a4c95){logger[_0xaf30('0x52')](_0xaf30('0x47'),JSON[_0xaf30('0x53')](_0x4a4c95));});};exports[_0xaf30('0x54')]=function(_0x403487,_0x5809bb,_0x3f76ac,_0x31259a,_0x26e767,_0x4b3906,_0x42fa77){var _0x44935a,_0xfcc369;_0x4b3906[_0xaf30('0x1b')]=intUtil[_0xaf30('0x45')](_0x4b3906[_0xaf30('0x1b')]);_0x4b3906[_0xaf30('0x46')]=intUtil[_0xaf30('0x45')](_0x4b3906[_0xaf30('0x46')]);if(_0x42fa77&&_0x42fa77[_0xaf30('0x55')]&&_0x42fa77[_0xaf30('0x55')]!==_0xaf30('0x56')){logger[_0xaf30('0x26')](_0xaf30('0x57'),_0xaf30('0x58'));_0x5809bb[_0xaf30('0x48')]=util[_0xaf30('0xe')](_0xaf30('0x49'),_0x4b3906['serverUrl'],_0x5809bb['uniqueid'],md5(_0x5809bb[_0xaf30('0x4a')]));}headers[_0xaf30('0x4b')]=getAuth(_0x4b3906);return getUser(_0x4b3906,_0x31259a[_0xaf30('0x25')])[_0xaf30('0x1d')](function(_0x19c3cd){_0x44935a=_0x19c3cd;logger[_0xaf30('0x26')](_0xaf30('0x4c'),_0x44935a['id']);return getEndUser(_0x4b3906,_0x5809bb[_0xaf30('0x59')],_0x5809bb[_0xaf30('0x5a')]);})[_0xaf30('0x1d')](function(_0x410f30){_0xfcc369=_0x410f30;logger[_0xaf30('0x26')](_0xaf30('0x4d'),_0xfcc369['id']);return getTicket(_0x4b3906,_0x44935a,_0xfcc369,_0x3f76ac,_0x5809bb);})[_0xaf30('0x1d')](function(_0x2fcb13){if(_0x2fcb13&&_0x2fcb13['id']){logger[_0xaf30('0x26')](_0xaf30('0x1e'));logger[_0xaf30('0x26')](_0xaf30('0x5b'),_0x2fcb13['id']);logger[_0xaf30('0x26')](_0xaf30('0x57'),_0xaf30('0x4e'));emit(util['format'](_0xaf30('0x4f'),_0x31259a[_0xaf30('0x15')]),_0xaf30('0x50'),{'uri':util['format'](_0xaf30('0x51'),_0x4b3906[_0xaf30('0x1b')],_0x2fcb13['id'])});}})['catch'](function(_0x3ffcf4){logger[_0xaf30('0x52')](_0xaf30('0x57'),JSON[_0xaf30('0x53')](_0x3ffcf4));});};exports[_0xaf30('0x5c')]=function(_0x2e86c5,_0xe4b4e7,_0x3542ea,_0x3320b4,_0x19d900,_0x2f8cc9){var _0x3f9c44,_0x50ed0a;_0x2f8cc9[_0xaf30('0x1b')]=intUtil[_0xaf30('0x45')](_0x2f8cc9[_0xaf30('0x1b')]);_0x2f8cc9[_0xaf30('0x46')]=intUtil[_0xaf30('0x45')](_0x2f8cc9[_0xaf30('0x46')]);if(_0x19d900&&_0x19d900[_0xaf30('0x5d')]){logger[_0xaf30('0x26')]('['+_0xe4b4e7[_0xaf30('0x5e')][_0xaf30('0x5f')]()+']',_0xaf30('0x58'));_0xe4b4e7[_0xaf30('0x48')]=util[_0xaf30('0xe')](_0xaf30('0x49'),_0x2f8cc9[_0xaf30('0x46')],_0xe4b4e7[_0xaf30('0x4a')],md5(_0xe4b4e7[_0xaf30('0x4a')]));}else{_0xe4b4e7[_0xaf30('0x48')]='';}headers[_0xaf30('0x4b')]=getAuth(_0x2f8cc9);return getUser(_0x2f8cc9,'')[_0xaf30('0x1d')](function(_0x58bc35){_0x3f9c44=_0x58bc35;logger[_0xaf30('0x26')](_0xaf30('0x4c'),_0x3f9c44['id']);return getEndUser(_0x2f8cc9,_0xe4b4e7[_0xaf30('0xf')],_0xe4b4e7[_0xaf30('0x10')]);})[_0xaf30('0x1d')](function(_0x558df0){_0x50ed0a=_0x558df0;logger[_0xaf30('0x26')](_0xaf30('0x4d'),_0x50ed0a['id']);return getTicket(_0x2f8cc9,_0x3f9c44,_0x50ed0a,_0x3542ea,_0xe4b4e7);})[_0xaf30('0x1d')](function(_0x1e9c4e){if(_0x1e9c4e){logger[_0xaf30('0x26')](_0xaf30('0x1e'));logger[_0xaf30('0x26')](_0xaf30('0x5b'),_0x1e9c4e['id']);}})[_0xaf30('0x60')](function(_0x163a96){logger[_0xaf30('0x52')]('['+_0xe4b4e7['lastevent']['toUpperCase']()+']',JSON[_0xaf30('0x53')](_0x163a96));});}; \ No newline at end of file +var _0x4106=['value','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','Authorization','destcalleridname','[OUTBOUND]','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','md5','util','./util','../../../../config/logger','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4106,0x100));var _0x6410=function(_0xaea95a,_0x321f79){_0xaea95a=_0xaea95a-0x0;var _0x34942a=_0x4106[_0xaea95a];return _0x34942a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6410('0x0'));var util=require(_0x6410('0x1'));var Redis=require('ioredis');var intUtil=require(_0x6410('0x2'));var config=require('../../../../config/environment');var logger=require(_0x6410('0x3'))('freshdesk');config[_0x6410('0x4')]=_[_0x6410('0x5')](config[_0x6410('0x4')],{'host':_0x6410('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6410('0x4')]));var headers={'Content-Type':_0x6410('0x7'),'Accept':_0x6410('0x7')};function emit(_0x4c902d,_0x37b717,_0x1326da){io['to'](_0x4c902d)[_0x6410('0x8')](_0x37b717,_0x1326da);}function getTicket(_0x1878a4,_0x5dfe88,_0x2a5270,_0xc0533,_0x508bad){logger[_0x6410('0x9')](_0x6410('0xa'));var _0x3a9e09=_[_0x6410('0xb')]({'responder_id':_0x5dfe88['id'],'requester_id':_0x2a5270['id'],'name':util[_0x6410('0xc')](_0x6410('0xd'),_0x508bad[_0x6410('0xe')]),'phone':_0x508bad[_0x6410('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6410('0x10')](_0xc0533[_0x6410('0x11')],_0x508bad,'\x20'),'description':intUtil[_0x6410('0x10')](_0xc0533[_0x6410('0x12')],_0x508bad,_0x6410('0x13')),'tags':getTags(_0xc0533[_0x6410('0x14')],_0x6410('0x15'))},getCustomFields(_0xc0533[_0x6410('0x16')],_0x508bad));_0x3a9e09[_0x6410('0x17')]=_[_0x6410('0x18')](_[_0x6410('0x19')](_0x3a9e09[_0x6410('0x17')],'id'),_0x6410('0x1a'));return request({'uri':util[_0x6410('0xc')]('%s/api/v2/tickets',_0x1878a4[_0x6410('0x1b')]),'method':'POST','body':_0x3a9e09})['then'](function(_0x32a14b){logger[_0x6410('0x9')](_0x6410('0x1c'));return _0x32a14b;});}function getUser(_0xde8e79,_0x2c9f71){if(intUtil[_0x6410('0x1d')](_0x2c9f71)){return request({'uri':util[_0x6410('0xc')](_0x6410('0x1e'),_0xde8e79['remoteUri']),'qs':{'email':_0x2c9f71}})[_0x6410('0x1f')](function(_0x5acd66){if(_0x5acd66['length']){logger[_0x6410('0x9')](_0x6410('0x20'));return _[_0x6410('0x21')](_0x5acd66,function(_0x63b60c){return _0x63b60c[_0x6410('0x22')][_0x6410('0x23')]===_0x2c9f71;});}else{logger[_0x6410('0x9')](_0x6410('0x24'));return request({'uri':util[_0x6410('0xc')](_0x6410('0x25'),_0xde8e79[_0x6410('0x1b')])})[_0x6410('0x1f')](function(_0x562d7f){logger['info']('Admin\x20account\x20selected.');return _0x562d7f;});}});}else{logger['info'](_0x6410('0x26'));return request({'uri':util['format'](_0x6410('0x25'),_0xde8e79[_0x6410('0x1b')])})['then'](function(_0x3f88c7){logger[_0x6410('0x9')](_0x6410('0x27'));return _0x3f88c7;});}}function getEndUser(_0x5820e0,_0x551de0,_0x563bd0){logger['info']('Searching\x20enduser\x20with\x20phone',_0x563bd0);return request({'uri':util[_0x6410('0xc')](_0x6410('0x28'),_0x5820e0[_0x6410('0x1b')]),'qs':{'phone':_0x563bd0}})[_0x6410('0x1f')](function(_0x4e5839){if(_0x4e5839[_0x6410('0x29')]){logger[_0x6410('0x9')](_0x6410('0x2a'));return _[_0x6410('0x21')](_0x4e5839,{'phone':_0x563bd0});}else{logger[_0x6410('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x6410('0x28'),_0x5820e0[_0x6410('0x1b')]),'method':_0x6410('0x2b'),'body':{'name':_0x551de0,'phone':_0x563bd0}})[_0x6410('0x1f')](function(_0x533afa){logger[_0x6410('0x9')](_0x6410('0x2c'));return _0x533afa;});}});}function getAuth(_0x5d41af){return util[_0x6410('0xc')](_0x6410('0x2d'),new Buffer(_0x5d41af[_0x6410('0x2e')]+':X')[_0x6410('0x2f')](_0x6410('0x30')));}function request(_0x5ad003){logger['debug'](_0x6410('0x31'),JSON['stringify'](_0x5ad003));return rp(_[_0x6410('0x5')](_0x5ad003,{'method':_0x6410('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x326ba9,_0x144a0a){var _0x2f4c4a=[];if(_0x326ba9&&_0x326ba9['length']>0x0){_0x2f4c4a=_[_0x6410('0x33')](_0x326ba9,_0x144a0a);}return _0x2f4c4a;}function getCustomFields(_0x3304a1,_0x28c603){var _0x58c9f1=[];var _0x57bc14={'custom_fields':[]};if(_0x3304a1[_0x6410('0x29')]>0x0){_[_0x6410('0x34')](_0x3304a1,function(_0x3b5573){if(_[_0x6410('0x35')]([_0x6410('0x36'),_0x6410('0x37')],_0x3b5573[_0x6410('0x38')])&&_0x3b5573[_0x6410('0x39')]&&!_0x3b5573[_0x6410('0x3a')]){_0x57bc14[_0x3b5573[_0x6410('0x39')][_0x6410('0x3b')]()]=_0x3b5573[_0x6410('0x3c')][_0x6410('0x2f')]();}else if(_[_0x6410('0x35')]([_0x6410('0x36'),_0x6410('0x37')],_0x3b5573[_0x6410('0x38')])&&_0x3b5573[_0x6410('0x3d')]&&_0x3b5573[_0x6410('0x3a')]){_0x57bc14['custom_fields'][_0x6410('0x3e')]({'id':_0x3b5573[_0x6410('0x3d')],'value':_0x3b5573[_0x6410('0x3c')][_0x6410('0x2f')]()});}else if(_0x3b5573[_0x6410('0x38')]===_0x6410('0x3f')&&_0x3b5573[_0x6410('0x40')]&&_0x3b5573['idField']&&_0x3b5573['customField']){_0x28c603[_0x3b5573[_0x6410('0x40')]]&&_0x57bc14['custom_fields'][_0x6410('0x3e')]({'id':_0x3b5573[_0x6410('0x3d')],'value':_0x28c603[_0x3b5573[_0x6410('0x40')]][_0x6410('0x2f')]()});}else if(_0x3b5573[_0x6410('0x38')]===_0x6410('0x41')&&_0x3b5573['Variable']&&_0x3b5573[_0x6410('0x42')][_0x6410('0x15')]&&_0x3b5573[_0x6410('0x3d')]&&_0x3b5573[_0x6410('0x3a')]){_0x28c603[_0x3b5573[_0x6410('0x42')][_0x6410('0x15')]['toLowerCase']()]&&_0x57bc14[_0x6410('0x17')][_0x6410('0x3e')]({'id':_0x3b5573['idField'],'value':_0x28c603[_0x3b5573[_0x6410('0x42')][_0x6410('0x15')][_0x6410('0x3b')]()][_0x6410('0x2f')]()});}});}return _0x57bc14;}exports[_0x6410('0x43')]=function(_0x41467d,_0x41ebfa,_0x22ad00,_0x2c4c4c,_0x2f72a5,_0xd87bae){var _0x5a433e,_0x3b34ba;_0xd87bae['remoteUri']=intUtil[_0x6410('0x44')](_0xd87bae['remoteUri']);_0xd87bae[_0x6410('0x45')]=intUtil['stripTrailingSlash'](_0xd87bae[_0x6410('0x45')]);if(_0x2f72a5&&_0x2f72a5[_0x6410('0x46')]){logger['info'](_0x6410('0x47'),_0x6410('0x48'));_0x41ebfa[_0x6410('0x49')]=util[_0x6410('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd87bae['serverUrl'],_0x41ebfa[_0x6410('0x4a')],md5(_0x41ebfa[_0x6410('0x4a')]));}else{_0x41ebfa[_0x6410('0x49')]='';}headers['Authorization']=getAuth(_0xd87bae);return getUser(_0xd87bae,_0x2c4c4c['email'])[_0x6410('0x1f')](function(_0x34546f){_0x5a433e=_0x34546f;logger['info'](_0x6410('0x4b'),_0x5a433e['id']);return getEndUser(_0xd87bae,_0x41ebfa[_0x6410('0xe')],_0x41ebfa[_0x6410('0xf')]);})[_0x6410('0x1f')](function(_0x486d9b){_0x3b34ba=_0x486d9b;logger[_0x6410('0x9')](_0x6410('0x4c'),_0x3b34ba['id']);return getTicket(_0xd87bae,_0x5a433e,_0x3b34ba,_0x22ad00,_0x41ebfa);})[_0x6410('0x1f')](function(_0x5bf66c){if(_0x5bf66c&&_0x5bf66c['id']){logger['info'](_0x6410('0x1c'));logger[_0x6410('0x9')]('The\x20Ticket\x20ID\x20is:',_0x5bf66c['id']);logger[_0x6410('0x9')](_0x6410('0x47'),_0x6410('0x4d'));emit(util[_0x6410('0xc')](_0x6410('0x4e'),_0x2c4c4c['name']),_0x6410('0x4f'),{'uri':util[_0x6410('0xc')](_0x6410('0x50'),_0xd87bae[_0x6410('0x1b')],_0x5bf66c['id'])});}})[_0x6410('0x51')](function(_0x279f7a){logger[_0x6410('0x52')](_0x6410('0x47'),JSON[_0x6410('0x53')](_0x279f7a));});};exports[_0x6410('0x54')]=function(_0x2a545b,_0x3bea13,_0x38f913,_0x30a81a,_0x366a31,_0x48e39e,_0x506da9){var _0x150f73,_0xf59a60;_0x48e39e[_0x6410('0x1b')]=intUtil[_0x6410('0x44')](_0x48e39e['remoteUri']);_0x48e39e[_0x6410('0x45')]=intUtil[_0x6410('0x44')](_0x48e39e[_0x6410('0x45')]);if(_0x506da9&&_0x506da9[_0x6410('0x55')]&&_0x506da9[_0x6410('0x55')]!==_0x6410('0x56')){logger[_0x6410('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3bea13[_0x6410('0x49')]=util[_0x6410('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48e39e[_0x6410('0x45')],_0x3bea13[_0x6410('0x4a')],md5(_0x3bea13[_0x6410('0x4a')]));}headers[_0x6410('0x57')]=getAuth(_0x48e39e);return getUser(_0x48e39e,_0x30a81a[_0x6410('0x23')])[_0x6410('0x1f')](function(_0x47285d){_0x150f73=_0x47285d;logger['info'](_0x6410('0x4b'),_0x150f73['id']);return getEndUser(_0x48e39e,_0x3bea13[_0x6410('0x58')],_0x3bea13['destcalleridnum']);})[_0x6410('0x1f')](function(_0x48a292){_0xf59a60=_0x48a292;logger[_0x6410('0x9')](_0x6410('0x4c'),_0xf59a60['id']);return getTicket(_0x48e39e,_0x150f73,_0xf59a60,_0x38f913,_0x3bea13);})[_0x6410('0x1f')](function(_0x15965d){if(_0x15965d&&_0x15965d['id']){logger[_0x6410('0x9')]('Ticket\x20created!');logger[_0x6410('0x9')]('The\x20Ticket\x20ID\x20is:',_0x15965d['id']);logger['info'](_0x6410('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6410('0xc')]('user:%s',_0x30a81a[_0x6410('0x15')]),_0x6410('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x48e39e[_0x6410('0x1b')],_0x15965d['id'])});}})[_0x6410('0x51')](function(_0xf42719){logger[_0x6410('0x52')](_0x6410('0x59'),JSON[_0x6410('0x53')](_0xf42719));});};exports[_0x6410('0x5a')]=function(_0x321477,_0x1e3cda,_0x5bcb22,_0x3e9764,_0x2fa34f,_0x5e80d6){var _0x487f37,_0x42f540;_0x5e80d6[_0x6410('0x1b')]=intUtil[_0x6410('0x44')](_0x5e80d6[_0x6410('0x1b')]);_0x5e80d6[_0x6410('0x45')]=intUtil[_0x6410('0x44')](_0x5e80d6['serverUrl']);if(_0x2fa34f&&_0x2fa34f[_0x6410('0x46')]){logger[_0x6410('0x9')]('['+_0x1e3cda[_0x6410('0x5b')][_0x6410('0x5c')]()+']',_0x6410('0x48'));_0x1e3cda['recordingURL']=util[_0x6410('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e80d6['serverUrl'],_0x1e3cda[_0x6410('0x4a')],md5(_0x1e3cda['uniqueid']));}else{_0x1e3cda[_0x6410('0x49')]='';}headers[_0x6410('0x57')]=getAuth(_0x5e80d6);return getUser(_0x5e80d6,'')[_0x6410('0x1f')](function(_0x441eba){_0x487f37=_0x441eba;logger[_0x6410('0x9')](_0x6410('0x4b'),_0x487f37['id']);return getEndUser(_0x5e80d6,_0x1e3cda[_0x6410('0xe')],_0x1e3cda[_0x6410('0xf')]);})[_0x6410('0x1f')](function(_0x186b1f){_0x42f540=_0x186b1f;logger[_0x6410('0x9')](_0x6410('0x4c'),_0x42f540['id']);return getTicket(_0x5e80d6,_0x487f37,_0x42f540,_0x5bcb22,_0x1e3cda);})[_0x6410('0x1f')](function(_0x251212){if(_0x251212){logger['info']('Ticket\x20created!');logger[_0x6410('0x9')](_0x6410('0x5d'),_0x251212['id']);}})[_0x6410('0x51')](function(_0x3c814f){logger[_0x6410('0x52')]('['+_0x1e3cda[_0x6410('0x5b')]['toUpperCase']()+']',JSON[_0x6410('0x53')](_0x3c814f));});}; \ 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 7c12a39..e22e7ed 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 _0x1429=['none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20with\x20email','agentEmail','length','User\x20found:','userId','Admin\x20selected','userEmail','toUpperCase','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat'];(function(_0x27f865,_0x247b9a){var _0x5ae8ed=function(_0x183adb){while(--_0x183adb){_0x27f865['push'](_0x27f865['shift']());}};_0x5ae8ed(++_0x247b9a);}(_0x1429,0x1a0));var _0x9142=function(_0xf47bc8,_0x26ff25){_0xf47bc8=_0xf47bc8-0x0;var _0x11a792=_0x1429[_0xf47bc8];return _0x11a792;};'use strict';var _=require('lodash');var rp=require(_0x9142('0x0'));var md5=require(_0x9142('0x1'));var util=require(_0x9142('0x2'));var moment=require('moment');var Promise=require(_0x9142('0x3'));var Redis=require(_0x9142('0x4'));var intUtil=require('./util');var config=require(_0x9142('0x5'));var logger=require(_0x9142('0x6'))('freshsales');config[_0x9142('0x7')]=_['defaults'](config[_0x9142('0x7')],{'host':_0x9142('0x8'),'port':0x18eb});var io=require(_0x9142('0x9'))(new Redis(config[_0x9142('0x7')]));function getAdminId(_0x5a13e9,_0x3d5e07,_0x15dbbf,_0x101a0f){return new Promise(function(_0xa1d659,_0x14a112){var _0x221e3b=![];var _0x77d70c={'method':_0x9142('0xa'),'uri':_0x101a0f+_0x9142('0xb'),'json':!![]};_0x77d70c[_0x9142('0xc')]=_0x15dbbf;logger[_0x9142('0xd')](_0x9142('0xe'));return rp(_0x77d70c)[_0x9142('0xf')](function(_0x264f1e){if(_0x264f1e){var _0x2639f8=_0x264f1e[_0x9142('0x10')];var _0x4d9a9a=null;for(_0x4d9a9a=0x0;_0x4d9a9a<_0x2639f8['length'];_0x4d9a9a++){if(_0x2639f8[_0x4d9a9a][_0x9142('0x11')]===_0x5a13e9[_0x9142('0x12')]){_0x5a13e9[_0x9142('0x13')]=_0x2639f8[_0x4d9a9a]['id'];_0x221e3b=!![];}}if(_0x221e3b){logger['info']('Admin\x20found:',_0x5a13e9[_0x9142('0x13')]);_0xa1d659(_0x5a13e9);}else{_0x14a112({'statusCode':0x194,'message':_0x9142('0x14')});}}else{_0x14a112({'statusCode':0x194,'message':_0x9142('0x14')});}})[_0x9142('0x15')](function(_0x4e79a0){logger[_0x9142('0x16')]('['+[_0x3d5e07['toUpperCase']()]+']',_0x4e79a0[_0x9142('0x17')]);_0x14a112(_0x4e79a0);});});}function getUser(_0x55a2e3,_0x55d609,_0x1cffde){return function(_0x4a4f73){return new Promise(function(_0x27fff4,_0x317f4a){var _0x89eb76={'method':'GET','uri':_0x1cffde+_0x9142('0xb'),'json':!![]};_0x89eb76[_0x9142('0xc')]=_0x55d609;logger[_0x9142('0xd')]('Getting\x20user\x20list');return rp(_0x89eb76)['then'](function(_0x4770eb){if(_0x4770eb){var _0xaebedd=_0x4770eb['users'];var _0x69dd73=![];var _0x1075c7=null;if(_0x4a4f73['agentEmail']!==null){logger['info'](_0x9142('0x18'),_0x4a4f73[_0x9142('0x19')]);_0x4a4f73['userEmail']=_0x4a4f73[_0x9142('0x19')];for(_0x1075c7=0x0;_0x1075c7<_0xaebedd[_0x9142('0x1a')];_0x1075c7++){if(_0xaebedd[_0x1075c7][_0x9142('0x11')]===_0x4a4f73[_0x9142('0x19')]){_0x69dd73=!![];_0x4a4f73['userId']=_0xaebedd[_0x1075c7]['id'];logger[_0x9142('0xd')](_0x9142('0x1b'),_0x4a4f73[_0x9142('0x1c')]);}}}if(!_0x69dd73){logger[_0x9142('0xd')](_0x9142('0x1d'));_0x4a4f73[_0x9142('0x1e')]=_0x4a4f73[_0x9142('0x12')];_0x4a4f73['userId']=_0x4a4f73['adminId'];_0x69dd73=!![];}if(_0x69dd73){_0x27fff4(_0x4a4f73);}else{_0x317f4a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x317f4a({'statusCode':0x194,'message':_0x9142('0x14')});}})[_0x9142('0x15')](function(_0x579951){logger['error']('['+[_0x55a2e3[_0x9142('0x1f')]()]+']',_0x579951[_0x9142('0x17')]);_0x317f4a(_0x579951);});});};}function searchContact(_0x1cfc85,_0x5ba952,_0x387d3a,_0x32172a){return new Promise(function(_0x40a178,_0x1df23d){var _0x2bc321={'method':_0x9142('0xa'),'headers':_0x5ba952,'uri':_0x1cfc85+_0x9142('0x20')+_0x32172a+'&f='+_0x387d3a+_0x9142('0x21'),'json':!![]};rp(_0x2bc321)['then'](function(_0x5d37cb){var _0x32598c=_[_0x9142('0x22')](_0x5d37cb[_0x9142('0x23')]['contacts'],[_0x387d3a,_0x32172a]);_0x40a178(_0x32598c);})[_0x9142('0x15')](function(_0x457d91){_0x1df23d(_0x457d91);});});}function getEndUser(_0x210048,_0x268ee3,_0x5a47a7){return function(_0x27ea7f){return new Promise(function(_0x31b29a,_0x285177){logger['info'](util[_0x9142('0x24')](_0x9142('0x25'),_0x27ea7f['contactNumber']));searchContact(_0x5a47a7,_0x268ee3,_0x9142('0x26'),_0x27ea7f[_0x9142('0x27')])[_0x9142('0xf')](function(_0x3da510){if(_0x3da510){_0x27ea7f[_0x9142('0x28')]=_0x3da510['id'];logger[_0x9142('0xd')](_0x9142('0x29'),_0x27ea7f[_0x9142('0x28')]);return _0x31b29a(_0x27ea7f);}searchContact(_0x5a47a7,_0x268ee3,_0x9142('0x2a'),_0x27ea7f['contactNumber'])[_0x9142('0xf')](function(_0x21899e){if(_0x21899e){_0x27ea7f[_0x9142('0x28')]=_0x21899e['id'];logger[_0x9142('0xd')](_0x9142('0x2b'),_0x27ea7f[_0x9142('0x28')]);return _0x31b29a(_0x27ea7f);}createEndUser(_0x27ea7f,_0x210048,_0x268ee3,_0x5a47a7)[_0x9142('0xf')](function(_0x394424){logger[_0x9142('0xd')](_0x9142('0x2c'),_0x394424[_0x9142('0x28')]);return _0x31b29a(_0x394424);});});})[_0x9142('0x15')](function(_0x390a6c){_0x285177(_0x390a6c);});});};}function createEndUser(_0x2112c4,_0xda86c2,_0x485cda,_0x7194c7){return new Promise(function(_0xbf7258,_0x2e2285){var _0x6cc3ad=moment();var _0xaf1857={'method':_0x9142('0x2d'),'uri':_0x7194c7+_0x9142('0x2e'),'body':{'contact':{'last_name':_0x2112c4['contactNumber'],'work_number':_0x2112c4[_0x9142('0x27')],'mobile_number':_0x2112c4['contactNumber'],'owner_id':_0x2112c4[_0x9142('0x1c')],'created_at':_0x6cc3ad[_0x9142('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xaf1857[_0x9142('0xc')]=_0x485cda;logger[_0x9142('0xd')](_0x9142('0x2f'));return rp(_0xaf1857)[_0x9142('0xf')](function(_0x3e40c8){_0x2112c4['endUserId']=_0x3e40c8[_0x9142('0x30')]['id'];_0xbf7258(_0x2112c4);})[_0x9142('0x15')](function(_0x18790a){logger[_0x9142('0x16')]('['+[_0xda86c2['toUpperCase']()]+']',_0x18790a[_0x9142('0x17')]);_0x2e2285(_0x18790a[_0x9142('0x17')]);});});}function getTicket(_0x4a1f74,_0x216f6c,_0x27b8b6,_0xbf7229,_0x9247ef){return function(_0x21a058){logger[_0x9142('0xd')](_0x9142('0x31'));return new Promise(function(_0x3689c3,_0x17dc6f){var _0x515118=moment();var _0x42e33e={'method':_0x9142('0x2d'),'uri':_0x27b8b6+_0x9142('0x32'),'body':{'title':intUtil[_0x9142('0x33')](_0xbf7229[_0x9142('0x34')],_0x9247ef,'\x20'),'description':intUtil['getString'](_0xbf7229['Descriptions'],_0x9247ef,'\x0a'),'owner_id':_0x21a058['userId'],'creater_id':_0x21a058['adminId'],'targetable_id':_0x21a058[_0x9142('0x28')],'targetable_type':'Contact','created_at':_0x515118['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x515118['add'](0x1e,'m')[_0x9142('0x24')](_0x9142('0x35'))},'json':!![]};_0x42e33e[_0x9142('0xc')]=_0x216f6c;return rp(_0x42e33e)[_0x9142('0xf')](function(_0xe02f3b){_0x21a058['ticketId']=_0xe02f3b[_0x9142('0x36')]['id'];logger['info'](_0x9142('0x37'),_0x21a058[_0x9142('0x38')]);_0x3689c3(_0x21a058);})['catch'](function(_0x321824){logger['error']('['+[_0x4a1f74[_0x9142('0x1f')]()]+']',_0x321824[_0x9142('0x17')]);_0x17dc6f(_0x321824[_0x9142('0x17')]);});});};}function emit(_0x48f35b,_0x21fe8d,_0x1f6f56){var _0x2421ae={'uri':_0x48f35b+'/contacts/'+_0x1f6f56};io['to'](util[_0x9142('0x24')](_0x9142('0x39'),_0x21fe8d))[_0x9142('0x3a')](_0x9142('0x3b'),_0x2421ae);}exports['cs']=function(_0x228c5d,_0x3b0a07,_0x5e2b74,_0x1ad967,_0x5b9692,_0x1709f8,_0x54d139,_0x426011){var _0x505ead={};var _0x544957={'Authorization':_0x9142('0x3c')+_0x1709f8[_0x9142('0x3d')]};_0x1709f8[_0x9142('0x3e')]=intUtil['stripTrailingSlash'](_0x1709f8[_0x9142('0x3e')]);_0x1709f8[_0x9142('0x3f')]=intUtil['stripTrailingSlash'](_0x1709f8[_0x9142('0x3f')]);var _0x287018=_0x1709f8['remoteUri'];_0x505ead[_0x9142('0x12')]=_0x1709f8[_0x9142('0x40')];_0x505ead[_0x9142('0x27')]=_0x426011['toLowerCase']()===_0x9142('0x41')?_0x3b0a07[_0x9142('0x42')]:_0x3b0a07[_0x9142('0x43')];_0x505ead[_0x9142('0x44')]=_0x426011===_0x9142('0x45')||_0x426011==='unmanaged'?_0x9142('0x45'):'outbound';if(_0x1ad967){_0x505ead[_0x9142('0x19')]=_0x1ad967['email'];}var _0xd74b67=util[_0x9142('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1709f8['serverUrl'],_0x3b0a07[_0x9142('0x46')],md5(_0x3b0a07['uniqueid']));if(_0x5b9692&&_0x5b9692[_0x9142('0x47')]){logger[_0x9142('0xd')](_0x9142('0x48'),_0x9142('0x49'));_0x3b0a07[_0x9142('0x4a')]=_0xd74b67;}else if(_0x54d139&&_0x54d139[_0x9142('0x4b')]&&_0x54d139['recordingFormat']!==_0x9142('0x4c')){logger[_0x9142('0xd')](_0x9142('0x4d'),_0x9142('0x49'));_0x3b0a07[_0x9142('0x4a')]=_0xd74b67;}else{_0x3b0a07[_0x9142('0x4a')]='';}return getAdminId(_0x505ead,_0x426011,_0x544957,_0x287018)[_0x9142('0xf')](getUser(_0x426011,_0x544957,_0x287018))[_0x9142('0xf')](getEndUser(_0x426011,_0x544957,_0x287018))['then'](getTicket(_0x426011,_0x544957,_0x287018,_0x5e2b74,_0x3b0a07))[_0x9142('0xf')](function(_0x4faed3){logger[_0x9142('0xd')](util['format'](_0x9142('0x4e'),_0x4faed3[_0x9142('0x38')]));if(_0x426011!=='unmanaged'){logger[_0x9142('0xd')]('['+[_0x426011[_0x9142('0x1f')]()]+']',_0x9142('0x4f'));emit(_0x287018,_0x1ad967['name'],_0x4faed3[_0x9142('0x28')]);}})[_0x9142('0x15')](function(_0x96ce2d){logger[_0x9142('0x16')]('['+[_0x426011[_0x9142('0x1f')]()]+_0x9142('0x50'),util[_0x9142('0x51')](_0x96ce2d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xeee3=['name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','moment','bluebird','ioredis','../../../../config/logger','freshsales','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','then','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xeee3,0x19c));var _0x3eee=function(_0x36c750,_0x18675b){_0x36c750=_0x36c750-0x0;var _0x3df194=_0xeee3[_0x36c750];return _0x3df194;};'use strict';var _=require(_0x3eee('0x0'));var rp=require('request-promise');var md5=require(_0x3eee('0x1'));var util=require(_0x3eee('0x2'));var moment=require(_0x3eee('0x3'));var Promise=require(_0x3eee('0x4'));var Redis=require(_0x3eee('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x3eee('0x6'))(_0x3eee('0x7'));config[_0x3eee('0x8')]=_['defaults'](config[_0x3eee('0x8')],{'host':_0x3eee('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3eee('0x8')]));function getAdminId(_0x479cf0,_0x345cb5,_0x56a917,_0x3ad1a5){return new Promise(function(_0x5ede62,_0x21e467){var _0x5943f1=![];var _0x43b99e={'method':_0x3eee('0xa'),'uri':_0x3ad1a5+_0x3eee('0xb'),'json':!![]};_0x43b99e[_0x3eee('0xc')]=_0x56a917;logger[_0x3eee('0xd')](_0x3eee('0xe'));return rp(_0x43b99e)['then'](function(_0x42117c){if(_0x42117c){var _0xee667b=_0x42117c[_0x3eee('0xf')];var _0x5d5fd4=null;for(_0x5d5fd4=0x0;_0x5d5fd4<_0xee667b[_0x3eee('0x10')];_0x5d5fd4++){if(_0xee667b[_0x5d5fd4][_0x3eee('0x11')]===_0x479cf0['adminEmail']){_0x479cf0[_0x3eee('0x12')]=_0xee667b[_0x5d5fd4]['id'];_0x5943f1=!![];}}if(_0x5943f1){logger['info'](_0x3eee('0x13'),_0x479cf0[_0x3eee('0x12')]);_0x5ede62(_0x479cf0);}else{_0x21e467({'statusCode':0x194,'message':_0x3eee('0x14')});}}else{_0x21e467({'statusCode':0x194,'message':_0x3eee('0x14')});}})[_0x3eee('0x15')](function(_0x3dcf7e){logger[_0x3eee('0x16')]('['+[_0x345cb5[_0x3eee('0x17')]()]+']',_0x3dcf7e['message']);_0x21e467(_0x3dcf7e);});});}function getUser(_0x5319cc,_0x94a0ee,_0x1ad41c){return function(_0x24ca15){return new Promise(function(_0x40c59b,_0x38da02){var _0x1d1375={'method':_0x3eee('0xa'),'uri':_0x1ad41c+_0x3eee('0xb'),'json':!![]};_0x1d1375[_0x3eee('0xc')]=_0x94a0ee;logger[_0x3eee('0xd')]('Getting\x20user\x20list');return rp(_0x1d1375)['then'](function(_0x43dac1){if(_0x43dac1){var _0x27b2f1=_0x43dac1[_0x3eee('0xf')];var _0x27d455=![];var _0x2fb739=null;if(_0x24ca15[_0x3eee('0x18')]!==null){logger[_0x3eee('0xd')](_0x3eee('0x19'),_0x24ca15[_0x3eee('0x18')]);_0x24ca15[_0x3eee('0x1a')]=_0x24ca15['agentEmail'];for(_0x2fb739=0x0;_0x2fb739<_0x27b2f1['length'];_0x2fb739++){if(_0x27b2f1[_0x2fb739][_0x3eee('0x11')]===_0x24ca15[_0x3eee('0x18')]){_0x27d455=!![];_0x24ca15[_0x3eee('0x1b')]=_0x27b2f1[_0x2fb739]['id'];logger[_0x3eee('0xd')]('User\x20found:',_0x24ca15[_0x3eee('0x1b')]);}}}if(!_0x27d455){logger[_0x3eee('0xd')](_0x3eee('0x1c'));_0x24ca15[_0x3eee('0x1a')]=_0x24ca15['adminEmail'];_0x24ca15[_0x3eee('0x1b')]=_0x24ca15[_0x3eee('0x12')];_0x27d455=!![];}if(_0x27d455){_0x40c59b(_0x24ca15);}else{_0x38da02({'statusCode':0x194,'message':_0x3eee('0x14')});}}else{_0x38da02({'statusCode':0x194,'message':_0x3eee('0x14')});}})[_0x3eee('0x15')](function(_0x3f4a03){logger['error']('['+[_0x5319cc[_0x3eee('0x17')]()]+']',_0x3f4a03['message']);_0x38da02(_0x3f4a03);});});};}function searchContact(_0x11efe1,_0x467898,_0xa251d6,_0x38268e){return new Promise(function(_0x4221d3,_0x2eada7){var _0x477fd8={'method':_0x3eee('0xa'),'headers':_0x467898,'uri':_0x11efe1+_0x3eee('0x1d')+_0x38268e+_0x3eee('0x1e')+_0xa251d6+_0x3eee('0x1f'),'json':!![]};rp(_0x477fd8)['then'](function(_0x4083b3){var _0x13607f=_[_0x3eee('0x20')](_0x4083b3[_0x3eee('0x21')][_0x3eee('0x21')],[_0xa251d6,_0x38268e]);_0x4221d3(_0x13607f);})['catch'](function(_0xb0e885){_0x2eada7(_0xb0e885);});});}function getEndUser(_0x3cea32,_0x42d1d3,_0x2c9de1){return function(_0x585f31){return new Promise(function(_0x2265c0,_0x306977){logger[_0x3eee('0xd')](util[_0x3eee('0x22')](_0x3eee('0x23'),_0x585f31[_0x3eee('0x24')]));searchContact(_0x2c9de1,_0x42d1d3,'mobile_number',_0x585f31['contactNumber'])['then'](function(_0x2174d3){if(_0x2174d3){_0x585f31[_0x3eee('0x25')]=_0x2174d3['id'];logger[_0x3eee('0xd')](_0x3eee('0x26'),_0x585f31[_0x3eee('0x25')]);return _0x2265c0(_0x585f31);}searchContact(_0x2c9de1,_0x42d1d3,_0x3eee('0x27'),_0x585f31[_0x3eee('0x24')])[_0x3eee('0x28')](function(_0x8bc30d){if(_0x8bc30d){_0x585f31[_0x3eee('0x25')]=_0x8bc30d['id'];logger['info']('Contact\x20found\x20work_number:',_0x585f31[_0x3eee('0x25')]);return _0x2265c0(_0x585f31);}createEndUser(_0x585f31,_0x3cea32,_0x42d1d3,_0x2c9de1)[_0x3eee('0x28')](function(_0x5a17b3){logger[_0x3eee('0xd')]('Contact\x20created:',_0x5a17b3[_0x3eee('0x25')]);return _0x2265c0(_0x5a17b3);});});})[_0x3eee('0x15')](function(_0xcc4188){_0x306977(_0xcc4188);});});};}function createEndUser(_0x419396,_0x48085b,_0x14f573,_0x4eabe4){return new Promise(function(_0x2b40fc,_0x51573a){var _0x154494=moment();var _0x1f2688={'method':_0x3eee('0x29'),'uri':_0x4eabe4+_0x3eee('0x2a'),'body':{'contact':{'last_name':_0x419396[_0x3eee('0x24')],'work_number':_0x419396['contactNumber'],'mobile_number':_0x419396[_0x3eee('0x24')],'owner_id':_0x419396['userId'],'created_at':_0x154494[_0x3eee('0x22')](_0x3eee('0x2b'))}},'json':!![]};_0x1f2688['headers']=_0x14f573;logger[_0x3eee('0xd')](_0x3eee('0x2c'));return rp(_0x1f2688)[_0x3eee('0x28')](function(_0x1c4737){_0x419396['endUserId']=_0x1c4737[_0x3eee('0x2d')]['id'];_0x2b40fc(_0x419396);})[_0x3eee('0x15')](function(_0x5077bc){logger[_0x3eee('0x16')]('['+[_0x48085b[_0x3eee('0x17')]()]+']',_0x5077bc[_0x3eee('0x2e')]);_0x51573a(_0x5077bc['message']);});});}function getTicket(_0x2cc340,_0x111b9e,_0x550b75,_0x4b046d,_0x3c42e2){return function(_0x1af783){logger[_0x3eee('0xd')](_0x3eee('0x2f'));return new Promise(function(_0x1cef51,_0x14e713){var _0x2ee289=moment();var _0x5dba16={'method':'POST','uri':_0x550b75+_0x3eee('0x30'),'body':{'title':intUtil['getString'](_0x4b046d[_0x3eee('0x31')],_0x3c42e2,'\x20'),'description':intUtil[_0x3eee('0x32')](_0x4b046d[_0x3eee('0x33')],_0x3c42e2,'\x0a'),'owner_id':_0x1af783[_0x3eee('0x1b')],'creater_id':_0x1af783[_0x3eee('0x12')],'targetable_id':_0x1af783[_0x3eee('0x25')],'targetable_type':'Contact','created_at':_0x2ee289[_0x3eee('0x22')](_0x3eee('0x2b')),'due_date':_0x2ee289['add'](0x1e,'m')[_0x3eee('0x22')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5dba16[_0x3eee('0xc')]=_0x111b9e;return rp(_0x5dba16)[_0x3eee('0x28')](function(_0x24e908){_0x1af783[_0x3eee('0x34')]=_0x24e908[_0x3eee('0x35')]['id'];logger[_0x3eee('0xd')](_0x3eee('0x36'),_0x1af783['ticketId']);_0x1cef51(_0x1af783);})[_0x3eee('0x15')](function(_0x1ae925){logger['error']('['+[_0x2cc340[_0x3eee('0x17')]()]+']',_0x1ae925['message']);_0x14e713(_0x1ae925[_0x3eee('0x2e')]);});});};}function emit(_0x4ad394,_0x24fd3c,_0x8b43c5){var _0x511c42={'uri':_0x4ad394+_0x3eee('0x37')+_0x8b43c5};io['to'](util[_0x3eee('0x22')](_0x3eee('0x38'),_0x24fd3c))[_0x3eee('0x39')](_0x3eee('0x3a'),_0x511c42);}exports['cs']=function(_0x4aaa60,_0x309551,_0x6c4a49,_0x47b65f,_0x42f732,_0x3e7bdd,_0x357350,_0x5b5501){var _0x5a31fd={};var _0x3aad57={'Authorization':_0x3eee('0x3b')+_0x3e7bdd[_0x3eee('0x3c')]};_0x3e7bdd[_0x3eee('0x3d')]=intUtil['stripTrailingSlash'](_0x3e7bdd[_0x3eee('0x3d')]);_0x3e7bdd['serverUrl']=intUtil[_0x3eee('0x3e')](_0x3e7bdd[_0x3eee('0x3f')]);var _0x5259f8=_0x3e7bdd[_0x3eee('0x3d')];_0x5a31fd[_0x3eee('0x40')]=_0x3e7bdd[_0x3eee('0x41')];_0x5a31fd['contactNumber']=_0x5b5501[_0x3eee('0x42')]()===_0x3eee('0x43')?_0x309551[_0x3eee('0x44')]:_0x309551[_0x3eee('0x45')];_0x5a31fd[_0x3eee('0x46')]=_0x5b5501===_0x3eee('0x47')||_0x5b5501==='unmanaged'?_0x3eee('0x47'):_0x3eee('0x43');if(_0x47b65f){_0x5a31fd[_0x3eee('0x18')]=_0x47b65f[_0x3eee('0x11')];}var _0x4d4731=util[_0x3eee('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e7bdd[_0x3eee('0x3f')],_0x309551['uniqueid'],md5(_0x309551[_0x3eee('0x48')]));if(_0x42f732&&_0x42f732['monitor_format']){logger[_0x3eee('0xd')](_0x3eee('0x49'),_0x3eee('0x4a'));_0x309551['recordingURL']=_0x4d4731;}else if(_0x357350&&_0x357350[_0x3eee('0x4b')]&&_0x357350[_0x3eee('0x4b')]!==_0x3eee('0x4c')){logger['info']('[OUTBOUND]',_0x3eee('0x4a'));_0x309551[_0x3eee('0x4d')]=_0x4d4731;}else{_0x309551[_0x3eee('0x4d')]='';}return getAdminId(_0x5a31fd,_0x5b5501,_0x3aad57,_0x5259f8)[_0x3eee('0x28')](getUser(_0x5b5501,_0x3aad57,_0x5259f8))[_0x3eee('0x28')](getEndUser(_0x5b5501,_0x3aad57,_0x5259f8))[_0x3eee('0x28')](getTicket(_0x5b5501,_0x3aad57,_0x5259f8,_0x6c4a49,_0x309551))['then'](function(_0x2f1aaa){logger['info'](util[_0x3eee('0x22')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2f1aaa[_0x3eee('0x34')]));if(_0x5b5501!==_0x3eee('0x4e')){logger[_0x3eee('0xd')]('['+[_0x5b5501[_0x3eee('0x17')]()]+']',_0x3eee('0x4f'));emit(_0x5259f8,_0x47b65f[_0x3eee('0x50')],_0x2f1aaa[_0x3eee('0x25')]);}})[_0x3eee('0x15')](function(_0x159de5){logger[_0x3eee('0x16')]('['+[_0x5b5501[_0x3eee('0x17')]()]+_0x3eee('0x51'),util['inspect'](_0x159de5,{'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 b792169..f88f869 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 _0xd9c0=['./sugarcrm','./freshdesk','./zoho','./desk','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk'];(function(_0x223364,_0x4c94a9){var _0x3f627b=function(_0xc48ff9){while(--_0xc48ff9){_0x223364['push'](_0x223364['shift']());}};_0x3f627b(++_0x4c94a9);}(_0xd9c0,0xad));var _0x0d9c=function(_0x3b6450,_0x264ca0){_0x3b6450=_0x3b6450-0x0;var _0x1510ef=_0xd9c0[_0x3b6450];return _0x1510ef;};'use strict';var _=require('lodash');var util=require(_0x0d9c('0x0'));var zendesk=require(_0x0d9c('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x0d9c('0x2'));var freshdesk=require(_0x0d9c('0x3'));var zoho=require(_0x0d9c('0x4'));var desk=require(_0x0d9c('0x5'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x0d9c('0x6'),_0x0d9c('0x7'),_0x0d9c('0x8'),'freshdesk',_0x0d9c('0x9'),_0x0d9c('0xa'),_0x0d9c('0xb'),_0x0d9c('0xc'),_0x0d9c('0xd'),'servicenow'];exports['exec']=function(_0x4d67a5,_0x2d070c,_0x5ac85b,_0x4b4f14,_0x730bea,_0x5e0004){if(_0x5ac85b){if(_[_0x0d9c('0xe')](integrations,_0x4d67a5[_0x0d9c('0xf')][_0x0d9c('0x10')]())){try{var _0xe436d3=null;var _0x243f3e='';var _0x51fffa=_0x5ac85b[_0x4d67a5[_0x0d9c('0xf')][_0x0d9c('0x10')]()];if(_0x51fffa){var _0x504666=_0x51fffa[_0x4d67a5['data2']];if(_0x504666){var _0x29c7bc=_[_0x0d9c('0x11')](_0x504666[_0x0d9c('0x12')],{'id':parseInt(_0x4d67a5[_0x0d9c('0x13')],0xa)});if(_0x29c7bc){if(_0x4b4f14){if(_0x730bea&&_0x2d070c[_0x0d9c('0x14')]){_0x243f3e=_0x0d9c('0x14');}else if(_0x2d070c[_0x0d9c('0x15')]){_0x243f3e=_0x0d9c('0x16');}else{console[_0x0d9c('0x17')](_0x0d9c('0x18'),_0x2d070c);}}else{_0x243f3e=_0x0d9c('0x19');}switch(_0x4d67a5['data1'][_0x0d9c('0x10')]()){case'zendesk':zendesk[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case _0x0d9c('0x7'):salesforce[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'sugarcrm':sugarcrm[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case _0x0d9c('0x1a'):freshdesk[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'zoho':zoho[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case _0x0d9c('0xa'):desk[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'vtiger':vtiger[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'freshsales':freshsales['cs'](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004,_0x243f3e);break;case'servicenow':servicenow['cs'](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004,_0x243f3e);break;case _0x0d9c('0xc'):dynamics365['cs'](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004,_0x243f3e);break;default:console[_0x0d9c('0x17')](_0x0d9c('0x1b'));}}else{_0xe436d3=require(_0x0d9c('0x1c'))(_0x4d67a5['data1']['toLowerCase']());_0xe436d3[_0x0d9c('0x1d')](_0x0d9c('0x1e'),util[_0x0d9c('0x1f')](_0x0d9c('0x20'),_0x4d67a5['data1']['toLowerCase'](),_0x4d67a5[_0x0d9c('0x13')]));}}else{_0xe436d3=require(_0x0d9c('0x1c'))(_0x4d67a5['data1']['toLowerCase']());_0xe436d3[_0x0d9c('0x1d')](_0x0d9c('0x1e'),util[_0x0d9c('0x1f')](_0x0d9c('0x21'),_0x4d67a5[_0x0d9c('0xf')][_0x0d9c('0x10')](),_0x4d67a5[_0x0d9c('0x22')]));}}else{}}catch(_0x543983){console[_0x0d9c('0x1d')](_0x543983);}}}}; \ No newline at end of file +var _0xc529=['freshdesk','zoho','desk','dynamics365','freshsales','exec','includes','toLowerCase','data1','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','vtiger','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','./zendesk','./salesforce','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm'];(function(_0x5b4485,_0x5b61d9){var _0x2c3cc1=function(_0x5bb9b6){while(--_0x5bb9b6){_0x5b4485['push'](_0x5b4485['shift']());}};_0x2c3cc1(++_0x5b61d9);}(_0xc529,0x168));var _0x9c52=function(_0x18d9bb,_0x46e4ab){_0x18d9bb=_0x18d9bb-0x0;var _0x2dd06f=_0xc529[_0x18d9bb];return _0x2dd06f;};'use strict';var _=require(_0x9c52('0x0'));var util=require('util');var zendesk=require(_0x9c52('0x1'));var salesforce=require(_0x9c52('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x9c52('0x3'));var desk=require(_0x9c52('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x9c52('0x5'));var dynamics365=require(_0x9c52('0x6'));var freshsales=require(_0x9c52('0x7'));var integrations=[_0x9c52('0x8'),'salesforce',_0x9c52('0x9'),_0x9c52('0xa'),_0x9c52('0xb'),_0x9c52('0xc'),'vtiger',_0x9c52('0xd'),_0x9c52('0xe'),'servicenow'];exports[_0x9c52('0xf')]=function(_0x2995cc,_0x589171,_0x5b24c8,_0x29b781,_0x567440,_0x2eb5c9){if(_0x5b24c8){if(_[_0x9c52('0x10')](integrations,_0x2995cc['data1'][_0x9c52('0x11')]())){try{var _0x3b6afb=null;var _0x269acb='';var _0x1609b0=_0x5b24c8[_0x2995cc[_0x9c52('0x12')][_0x9c52('0x11')]()];if(_0x1609b0){var _0x2d944c=_0x1609b0[_0x2995cc[_0x9c52('0x13')]];if(_0x2d944c){var _0x84381=_[_0x9c52('0x14')](_0x2d944c['Configurations'],{'id':parseInt(_0x2995cc[_0x9c52('0x15')],0xa)});if(_0x84381){if(_0x29b781){if(_0x567440&&_0x589171['queue']){_0x269acb=_0x9c52('0x16');}else if(_0x589171[_0x9c52('0x17')]){_0x269acb=_0x9c52('0x18');}else{console[_0x9c52('0x19')](_0x9c52('0x1a'),_0x589171);}}else{_0x269acb=_0x9c52('0x1b');}switch(_0x2995cc[_0x9c52('0x12')][_0x9c52('0x11')]()){case _0x9c52('0x8'):zendesk[_0x269acb](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9);break;case _0x9c52('0x1c'):salesforce[_0x269acb](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9);break;case _0x9c52('0x9'):sugarcrm[_0x269acb](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9);break;case'freshdesk':freshdesk[_0x269acb](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9);break;case _0x9c52('0xb'):zoho[_0x269acb](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9);break;case'desk':desk[_0x269acb](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9);break;case _0x9c52('0x1d'):vtiger[_0x269acb](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9);break;case _0x9c52('0xe'):freshsales['cs'](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9,_0x269acb);break;case _0x9c52('0x1e'):servicenow['cs'](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9,_0x269acb);break;case'dynamics365':dynamics365['cs'](_0x2995cc,_0x589171,_0x84381,_0x29b781,_0x567440,_0x2d944c,_0x2eb5c9,_0x269acb);break;default:console[_0x9c52('0x19')](_0x9c52('0x1f'));}}else{_0x3b6afb=require(_0x9c52('0x20'))(_0x2995cc[_0x9c52('0x12')][_0x9c52('0x11')]());_0x3b6afb['error'](_0x9c52('0x21'),util[_0x9c52('0x22')](_0x9c52('0x23'),_0x2995cc[_0x9c52('0x12')][_0x9c52('0x11')](),_0x2995cc['data3']));}}else{_0x3b6afb=require(_0x9c52('0x20'))(_0x2995cc[_0x9c52('0x12')]['toLowerCase']());_0x3b6afb['error'](_0x9c52('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x2995cc[_0x9c52('0x12')][_0x9c52('0x11')](),_0x2995cc[_0x9c52('0x13')]));}}else{}}catch(_0x4df526){console[_0x9c52('0x24')](_0x4df526);}}}}; \ 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 6377030..565a4aa 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 _0x246e=['customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','outbound','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','lastevent','isNil','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','Task','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','validateEmail','sobject','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','cloneDeep','contact','first','Name','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.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','picklist','idField','content','variableName'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x246e,0x134));var _0xe246=function(_0x506c40,_0xaa4e4c){_0x506c40=_0x506c40-0x0;var _0x408832=_0x246e[_0x506c40];return _0x408832;};'use strict';var _=require('lodash');var rp=require(_0xe246('0x0'));var moment=require('moment');var BPromise=require(_0xe246('0x1'));var md5=require(_0xe246('0x2'));var jsforce=require(_0xe246('0x3'));var util=require('util');var Redis=require(_0xe246('0x4'));var intUtil=require(_0xe246('0x5'));var config=require(_0xe246('0x6'));var logger=require(_0xe246('0x7'))(_0xe246('0x8'));config[_0xe246('0x9')]=_['defaults'](config[_0xe246('0x9')],{'host':_0xe246('0xa'),'port':0x18eb});var io=require(_0xe246('0xb'))(new Redis(config[_0xe246('0x9')]));function emit(_0x37450f,_0x44cce9,_0xb606f7){io['to'](_0x37450f)[_0xe246('0xc')](_0x44cce9,_0xb606f7);}function getTicket(_0x55cfdb,_0x2bdd5e,_0x54a80b,_0x5d1b67,_0x73dbf4,_0x518bf2,_0xd44674,_0x2820a5){var _0x3b1bcb=Object[_0xe246('0xd')]({},{'OwnerId':_0x2bdd5e['id'],'Subject':intUtil['getString'](_0x5d1b67[_0xe246('0xe')],_0x73dbf4,'\x20'),'Description':intUtil[_0xe246('0xf')](_0x5d1b67[_0xe246('0x10')],_0x73dbf4,'\x0a')},getCustomFields(_0x518bf2,_0x73dbf4));if(_0x54a80b){if(_0x5d1b67[_0xe246('0x11')]===_0xe246('0x12')){_0x3b1bcb['ActivityDate']=moment['utc']();_0x3b1bcb[_0xe246('0x13')]=![];_0x3b1bcb[_0xe246('0x14')]=![];if(_0x54a80b[_0xe246('0x15')]==='contact'||_0x54a80b['endUserType']===_0xe246('0x16')){_0x3b1bcb[_0xe246('0x17')]=_0x54a80b['id'];}else if(_0x54a80b[_0xe246('0x15')]===_0xe246('0x18')){_0x3b1bcb[_0xe246('0x19')]=_0x54a80b['id'];}}else if(_0x5d1b67['ticketType']===_0xe246('0x1a')){if(_0x54a80b[_0xe246('0x15')]==='contact'){_0x3b1bcb[_0xe246('0x1b')]=_0x54a80b['id'];}else if(_0x54a80b[_0xe246('0x15')]===_0xe246('0x18')){_0x3b1bcb[_0xe246('0x1c')]=_0x54a80b['id'];}else if(_0x54a80b[_0xe246('0x15')]===_0xe246('0x16')&&_0x5d1b67[_0xe246('0x1d')]){_0x3b1bcb[_0x5d1b67[_0xe246('0x1d')]]=_0x54a80b['id'];}else{logger[_0xe246('0x1e')](_0xe246('0x1f'));}}}return _0xd44674['sobject'](_0x5d1b67[_0xe246('0x11')])['create'](_0x3b1bcb);}function getUser(_0x45bd40,_0x185850,_0x1a0707){if(!_['isNil'](_0x185850)&&intUtil[_0xe246('0x20')](_0x185850)){var _0x92d32={'Email':_0x185850};var _0x4c8bbd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1a0707[_0xe246('0x21')](_0xe246('0x22'))[_0xe246('0x23')](_0x92d32,_0x4c8bbd)['execute']()[_0xe246('0x24')](function(_0x26fc35){if(_0x26fc35[_0xe246('0x25')]){var _0x540e26=_[_0xe246('0x23')](_0x26fc35,function(_0x547bf4){return _0x547bf4[_0xe246('0x26')]===_0x185850;});if(_0x540e26){logger[_0xe246('0x1e')](_0xe246('0x27'),_0x185850);return BPromise[_0xe246('0x28')]({'id':_0x540e26['Id'],'name':_0x540e26['Name']});}}else{logger[_0xe246('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x185850);return _0x1a0707[_0xe246('0x29')]()[_0xe246('0x24')](function(_0x29da0e){return BPromise['resolve']({'id':_0x29da0e[_0xe246('0x2a')],'name':_0x29da0e['display_name']});});}});}else{logger[_0xe246('0x1e')](_0xe246('0x2b'),_0x185850);return _0x1a0707[_0xe246('0x29')]()['then'](function(_0x48265b){return BPromise['resolve']({'id':_0x48265b[_0xe246('0x2a')],'name':_0x48265b[_0xe246('0x2c')]});});}}function getEndUser(_0x41fc48,_0x299a31,_0x5c737e,_0xb05e18,_0x35bc20){var _0x1d8967={'$or':{'Phone':_0xb05e18}};var _0x36a9cd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe246('0x28')]()[_0xe246('0x24')](function(){logger[_0xe246('0x1e')](_0xe246('0x2d'),_0xb05e18,_0x299a31[_0xe246('0x2e')]);switch(_0x299a31[_0xe246('0x2e')]){case'contact_lead':var _0x40d21b=_['cloneDeep'](_0x1d8967);if(_0x299a31[_0xe246('0x2f')]){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x2f')]]=_0xb05e18;_['merge'](_0x40d21b[_0xe246('0x30')],_0x4a1fe9);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x31'))[_0xe246('0x23')](_0x40d21b,_0x36a9cd)[_0xe246('0x32')]()[_0xe246('0x24')](function(_0x4704e2){if(_0x4704e2&&_0x4704e2[_0xe246('0x25')]){return _0x4704e2;}else{var _0x5c6389=_['cloneDeep'](_0x1d8967);if(_0x299a31[_0xe246('0x33')]){var _0x45b5ae={};_0x45b5ae[_0x299a31['additionalSearchLead']]=_0xb05e18;_[_0xe246('0x34')](_0x5c6389['$or'],_0x45b5ae);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x35'))[_0xe246('0x23')](_0x5c6389,_0x36a9cd);}});case'account_contact_lead':var _0x252e7f=_['cloneDeep'](_0x1d8967);if(_0x299a31['additionalSearchAccount']){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x36')]]=_0xb05e18;_[_0xe246('0x34')](_0x252e7f['$or'],_0x4a1fe9);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x37'))['find'](_0x252e7f,_0x36a9cd)[_0xe246('0x32')]()['then'](function(_0x7d7b27){if(_0x7d7b27&&_0x7d7b27[_0xe246('0x25')]){return _0x7d7b27;}else{var _0x3a60fa=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31[_0xe246('0x2f')]){var _0x1f5005={};_0x1f5005[_0x299a31[_0xe246('0x2f')]]=_0xb05e18;_[_0xe246('0x34')](_0x3a60fa[_0xe246('0x30')],_0x1f5005);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x31'))[_0xe246('0x23')](_0x3a60fa,_0x36a9cd)[_0xe246('0x24')](function(_0x20401b){if(_0x20401b&&_0x20401b[_0xe246('0x25')]){return _0x20401b;}else{var _0x3b1ded=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31['additionalSearchLead']){var _0x489028={};_0x489028[_0x299a31[_0xe246('0x33')]]=_0xb05e18;_[_0xe246('0x34')](_0x3b1ded[_0xe246('0x30')],_0x489028);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x35'))['find'](_0x3b1ded,_0x36a9cd);}});}});case _0xe246('0x39'):var _0x40d21b=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31['additionalSearchContact']){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x2f')]]=_0xb05e18;_[_0xe246('0x34')](_0x40d21b['$or'],_0x4a1fe9);}return _0x35bc20[_0xe246('0x21')]('Contact')[_0xe246('0x23')](_0x40d21b,_0x36a9cd)[_0xe246('0x32')]();case'lead':var _0x84e839=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31[_0xe246('0x33')]){var _0x4a1fe9={};_0x4a1fe9[_0x299a31['additionalSearchLead']]=_0xb05e18;_['merge'](_0x84e839['$or'],_0x4a1fe9);}return _0x35bc20['sobject']('Lead')[_0xe246('0x23')](_0x84e839,_0x36a9cd);case'account':var _0x252e7f=_['cloneDeep'](_0x1d8967);if(_0x299a31[_0xe246('0x36')]){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x36')]]=_0xb05e18;_['merge'](_0x252e7f['$or'],_0x4a1fe9);}return _0x35bc20['sobject'](_0xe246('0x37'))[_0xe246('0x23')](_0x252e7f,_0x36a9cd);default:return null;}})['then'](function(_0x304452){if(_0x304452&&_0x304452[_0xe246('0x25')]){var _0x54157d=_[_0xe246('0x3a')](_0x304452);if(_0x54157d){return BPromise[_0xe246('0x28')]({'id':_0x54157d['Id'],'name':_0x54157d[_0xe246('0x3b')],'phone':_0x54157d['Phone'],'endUserType':_0x54157d[_0xe246('0x3c')][_0xe246('0x3d')][_0xe246('0x3e')]()});}}})['then'](function(_0x2ffd2e){if(_0x2ffd2e){logger[_0xe246('0x1e')](_0xe246('0x3f'),_0x2ffd2e[_0xe246('0x15')],_0xb05e18);return BPromise['resolve'](_0x2ffd2e);}else{logger[_0xe246('0x1e')](_0xe246('0x40'),_0xb05e18);var _0x25d94d={'Phone':_0xb05e18};if(_0x299a31[_0xe246('0x41')]){if(_0x299a31[_0xe246('0x41')]===_0xe246('0x39')){logger[_0xe246('0x1e')](_0xe246('0x42'),_0xb05e18,_0x299a31[_0xe246('0x41')]);_0x25d94d[_0xe246('0x43')]=_0x5c737e!==_0xe246('0x44')?_0x5c737e:util[_0xe246('0x45')](_0xe246('0x46'),_0xb05e18);}else if(_0x299a31['moduleCreate']===_0xe246('0x16')){logger[_0xe246('0x1e')](_0xe246('0x42'),_0xb05e18,_0x299a31[_0xe246('0x41')]);_0x25d94d[_0xe246('0x43')]=_0x5c737e!==_0xe246('0x44')?_0x5c737e:util['format'](_0xe246('0x46'),_0xb05e18);_0x25d94d[_0xe246('0x47')]=_0xe246('0x48');}else if(_0x299a31['moduleCreate']===_0xe246('0x18')){logger[_0xe246('0x1e')](_0xe246('0x42'),_0xb05e18,_0x299a31[_0xe246('0x41')]);_0x25d94d[_0xe246('0x3b')]=_0x5c737e!==_0xe246('0x44')?_0x5c737e:util[_0xe246('0x45')](_0xe246('0x46'),_0xb05e18);}else{return null;}}return _0x35bc20[_0xe246('0x21')](_[_0xe246('0x49')](_0x299a31[_0xe246('0x41')]))['create'](_0x25d94d)[_0xe246('0x24')](function(_0x42d240){return BPromise[_0xe246('0x28')]({'id':_0x42d240['id'],'endUserType':_0x299a31[_0xe246('0x41')]});});}});}function getCustomFields(_0xe3eaa4,_0x4eb86d){var _0x2b7a26={};if(_0xe3eaa4[_0xe246('0x25')]>0x0){_['forEach'](_0xe3eaa4,function(_0x329bde){if(_[_0xe246('0x4a')](['string',_0xe246('0x4b')],_0x329bde[_0xe246('0x3d')])&&_0x329bde[_0xe246('0x4c')]){_0x2b7a26[_0x329bde[_0xe246('0x4c')]]=_0x329bde[_0xe246('0x4d')]['toString']();}else if(_0x329bde[_0xe246('0x3d')]==='variable'&&_0x329bde[_0xe246('0x4e')]&&_0x329bde['idField']){_0x4eb86d[_0x329bde[_0xe246('0x4e')]]&&(_0x2b7a26[_0x329bde[_0xe246('0x4c')]]=_0x4eb86d[_0x329bde[_0xe246('0x4e')]]['toString']());}else if(_0x329bde[_0xe246('0x3d')]===_0xe246('0x4f')&&_0x329bde[_0xe246('0x50')]&&_0x329bde['Variable'][_0xe246('0x51')]&&_0x329bde[_0xe246('0x4c')]){_0x4eb86d[_0x329bde[_0xe246('0x50')][_0xe246('0x51')]['toLowerCase']()]&&(_0x2b7a26[_0x329bde['idField']]=_0x4eb86d[_0x329bde[_0xe246('0x50')]['name'][_0xe246('0x3e')]()]['toString']());}});}return _0x2b7a26;}function getConnection(_0xd7024e){var _0x5ccc18=_0xd7024e[_0xe246('0x52')][_0xe246('0x53')](_0xd7024e['securityToken']);var _0x1eab08=new jsforce[(_0xe246('0x54'))]({'oauth2':{'loginUrl':_0xd7024e[_0xe246('0x55')]||_0xe246('0x56'),'clientId':_0xd7024e[_0xe246('0x57')],'clientSecret':_0xd7024e[_0xe246('0x58')]}});return _0x1eab08[_0xe246('0x59')](_0xd7024e[_0xe246('0x5a')],_0x5ccc18)['then'](function(){logger[_0xe246('0x1e')](_0xe246('0x5b'));return _0x1eab08;});}exports['queue']=function(_0x34f737,_0x1fbf86,_0x34ce11,_0x10435e,_0x50ab69,_0x3a6ac4){var _0x15d665,_0x1b2788,_0x19429f,_0x333c8f;_0x3a6ac4[_0xe246('0x5c')]=intUtil[_0xe246('0x5d')](_0x3a6ac4[_0xe246('0x5c')]);_0x3a6ac4[_0xe246('0x55')]=intUtil[_0xe246('0x5d')](_0x3a6ac4[_0xe246('0x55')]);if(_0x50ab69&&_0x50ab69['monitor_format']){logger['info'](_0xe246('0x5e'),_0xe246('0x5f'));_0x1fbf86[_0xe246('0x60')]=util['format'](_0xe246('0x61'),_0x3a6ac4[_0xe246('0x5c')],_0x1fbf86[_0xe246('0x62')],md5(_0x1fbf86[_0xe246('0x62')]));}else{_0x1fbf86[_0xe246('0x60')]='';}return getConnection(_0x3a6ac4)[_0xe246('0x24')](function(_0x97b74c){_0x333c8f=_0x97b74c;return getUser(_0x3a6ac4,_0x10435e['email'],_0x333c8f);})[_0xe246('0x24')](function(_0x4f7a02){_0x15d665=_0x4f7a02;return getEndUser(_0x3a6ac4,_0x34ce11,_0x1fbf86[_0xe246('0x63')],_0x1fbf86[_0xe246('0x64')],_0x333c8f);})[_0xe246('0x24')](function(_0x28b824){_0x1b2788=_0x28b824;return getTicket(_0x3a6ac4,_0x15d665,_0x1b2788,_0x34ce11,_0x1fbf86,_0x34ce11['Fields'],_0x333c8f,_0xe246('0x65'));})[_0xe246('0x24')](function(_0x4ec902){_0x19429f=_0x4ec902;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x19429f['id']);logger[_0xe246('0x1e')](_0xe246('0x66'),_0x19429f['id'],_0x10435e[_0xe246('0x51')],_0x3a6ac4[_0xe246('0x3d')]);switch(_0x3a6ac4[_0xe246('0x3d')]){case _0xe246('0x67'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x10435e[_0xe246('0x51')]),_0xe246('0x69'),{'recordId':_0x19429f['id']});break;case _0xe246('0x6a'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x10435e['name']),_0xe246('0x6b'),{'uri':util[_0xe246('0x45')]('%s/%s/e',_0x333c8f[_0xe246('0x6c')],_0x19429f['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x5c9824){logger[_0xe246('0x6d')](_0xe246('0x5e'),_0x5c9824);});};exports[_0xe246('0x6e')]=function(_0x43b628,_0x1923be,_0x13bd5e,_0x1cb71c,_0x24eec4,_0x64d277,_0x4be172){var _0x30de20,_0x16c073,_0x1a92ac,_0x1820a1;_0x64d277[_0xe246('0x5c')]=intUtil['stripTrailingSlash'](_0x64d277[_0xe246('0x5c')]);_0x64d277[_0xe246('0x55')]=intUtil[_0xe246('0x5d')](_0x64d277[_0xe246('0x55')]);if(_0x4be172&&_0x4be172['recordingFormat']&&_0x4be172['recordingFormat']!==_0xe246('0x6f')){logger[_0xe246('0x1e')](_0xe246('0x70'),_0xe246('0x5f'));_0x1923be[_0xe246('0x60')]=util[_0xe246('0x45')](_0xe246('0x61'),_0x64d277['serverUrl'],_0x1923be[_0xe246('0x62')],md5(_0x1923be['uniqueid']));}return getConnection(_0x64d277)[_0xe246('0x24')](function(_0x4ee755){_0x1820a1=_0x4ee755;return getUser(_0x64d277,_0x1cb71c[_0xe246('0x71')],_0x1820a1);})[_0xe246('0x24')](function(_0x59d78c){_0x30de20=_0x59d78c;return getEndUser(_0x64d277,_0x13bd5e,_0x1923be[_0xe246('0x72')],_0x1923be[_0xe246('0x73')],_0x1820a1);})[_0xe246('0x24')](function(_0x46e5e0){_0x16c073=_0x46e5e0;return getTicket(_0x64d277,_0x30de20,_0x16c073,_0x13bd5e,_0x1923be,_0x13bd5e[_0xe246('0x74')],_0x1820a1,_0xe246('0x6e'));})[_0xe246('0x24')](function(_0x4e018f){_0x1a92ac=_0x4e018f;logger[_0xe246('0x1e')](_0xe246('0x75'),_0x1a92ac['id']);logger[_0xe246('0x1e')](_0xe246('0x76'),_0x1a92ac['id'],_0x1cb71c['name'],_0x64d277['type']);switch(_0x64d277[_0xe246('0x3d')]){case _0xe246('0x67'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x1cb71c['name']),_0xe246('0x69'),{'recordId':_0x1a92ac['id']});break;case _0xe246('0x6a'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x1cb71c['name']),_0xe246('0x6b'),{'uri':util['format'](_0xe246('0x77'),_0x1820a1[_0xe246('0x6c')],_0x1a92ac['id'])});break;default:logger['error'](_0xe246('0x70'),_0xe246('0x78'));}})[_0xe246('0x79')](function(_0x4a7fec){logger[_0xe246('0x6d')](_0xe246('0x70'),_0x4a7fec);});};exports[_0xe246('0x7a')]=function(_0x5bea84,_0xdb309c,_0xcef577,_0x369a0c,_0x5a047d,_0x4fe7ae){var _0x2fa3af,_0xaf37e7,_0x4894eb,_0x1b4f89;_0x4fe7ae[_0xe246('0x5c')]=intUtil[_0xe246('0x5d')](_0x4fe7ae[_0xe246('0x5c')]);_0x4fe7ae['remoteUri']=intUtil[_0xe246('0x5d')](_0x4fe7ae[_0xe246('0x55')]);if(_0x5a047d&&_0x5a047d[_0xe246('0x7b')]){logger[_0xe246('0x1e')]('['+_0xdb309c[_0xe246('0x7c')]['toUpperCase']()+']',_0xe246('0x5f'));_0xdb309c[_0xe246('0x60')]=util[_0xe246('0x45')](_0xe246('0x61'),_0x4fe7ae[_0xe246('0x5c')],_0xdb309c[_0xe246('0x62')],md5(_0xdb309c[_0xe246('0x62')]));}else{_0xdb309c['recordingURL']='';}return getConnection(_0x4fe7ae)[_0xe246('0x24')](function(_0x19eae6){_0x1b4f89=_0x19eae6;if(!_[_0xe246('0x7d')](_0x369a0c)){return getUser(_0x4fe7ae,_0x369a0c[_0xe246('0x51')],_0x1b4f89);}else{return getUser(_0x4fe7ae,null,_0x1b4f89);}})[_0xe246('0x24')](function(_0x5ecd13){_0x2fa3af=_0x5ecd13;return getEndUser(_0x4fe7ae,_0xcef577,_0xdb309c['calleridname'],_0xdb309c[_0xe246('0x64')],_0x1b4f89);})[_0xe246('0x24')](function(_0x2bc26a){_0xaf37e7=_0x2bc26a;return getTicket(_0x4fe7ae,_0x2fa3af,_0xaf37e7,_0xcef577,_0xdb309c,_0xcef577[_0xe246('0x74')],_0x1b4f89);})[_0xe246('0x24')](function(_0x4504b7){_0x4894eb=_0x4504b7;logger[_0xe246('0x1e')]('['+_0xdb309c[_0xe246('0x7c')][_0xe246('0x7e')]()+_0xe246('0x7f'),_0x4894eb['id']);logger[_0xe246('0x1e')]('['+_0xdb309c['lastevent'][_0xe246('0x7e')]()+_0xe246('0x80'),_0x4fe7ae[_0xe246('0x3d')]);})[_0xe246('0x79')](function(_0x31958d){logger['error']('['+_0xdb309c[_0xe246('0x7c')][_0xe246('0x7e')]()+']',_0x31958d);});}; \ No newline at end of file +var _0xb8dd=[']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','Task','ActivityDate','IsRecurrence','lead','WhoId','endUserType','account','ticketType','Case','contact','ContactId','AccountId','leadId','info','sobject','isNil','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','length','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','No\x20Company','create','forEach','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname'];(function(_0x5e2d7c,_0x5ace57){var _0x5bc9c5=function(_0x57f16b){while(--_0x57f16b){_0x5e2d7c['push'](_0x5e2d7c['shift']());}};_0x5bc9c5(++_0x5ace57);}(_0xb8dd,0x178));var _0xdb8d=function(_0x4d8524,_0x1e8925){_0x4d8524=_0x4d8524-0x0;var _0xbdb413=_0xb8dd[_0x4d8524];return _0xbdb413;};'use strict';var _=require(_0xdb8d('0x0'));var rp=require(_0xdb8d('0x1'));var moment=require(_0xdb8d('0x2'));var BPromise=require(_0xdb8d('0x3'));var md5=require(_0xdb8d('0x4'));var jsforce=require(_0xdb8d('0x5'));var util=require(_0xdb8d('0x6'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xdb8d('0x7'))('salesforce');config[_0xdb8d('0x8')]=_[_0xdb8d('0x9')](config[_0xdb8d('0x8')],{'host':_0xdb8d('0xa'),'port':0x18eb});var io=require(_0xdb8d('0xb'))(new Redis(config[_0xdb8d('0x8')]));function emit(_0x4cf743,_0x37a0fc,_0x1c216f){io['to'](_0x4cf743)[_0xdb8d('0xc')](_0x37a0fc,_0x1c216f);}function getTicket(_0x4627a6,_0x533322,_0x319289,_0x4ffd34,_0x44faa7,_0x44f47b,_0x54ff68,_0x25bec9){var _0x22c7ba=Object[_0xdb8d('0xd')]({},{'OwnerId':_0x533322['id'],'Subject':intUtil['getString'](_0x4ffd34[_0xdb8d('0xe')],_0x44faa7,'\x20'),'Description':intUtil['getString'](_0x4ffd34['Descriptions'],_0x44faa7,'\x0a')},getCustomFields(_0x44f47b,_0x44faa7));if(_0x319289){if(_0x4ffd34['ticketType']===_0xdb8d('0xf')){_0x22c7ba[_0xdb8d('0x10')]=moment['utc']();_0x22c7ba['IsReminderSet']=![];_0x22c7ba[_0xdb8d('0x11')]=![];if(_0x319289['endUserType']==='contact'||_0x319289['endUserType']===_0xdb8d('0x12')){_0x22c7ba[_0xdb8d('0x13')]=_0x319289['id'];}else if(_0x319289[_0xdb8d('0x14')]===_0xdb8d('0x15')){_0x22c7ba['WhatId']=_0x319289['id'];}}else if(_0x4ffd34[_0xdb8d('0x16')]===_0xdb8d('0x17')){if(_0x319289[_0xdb8d('0x14')]===_0xdb8d('0x18')){_0x22c7ba[_0xdb8d('0x19')]=_0x319289['id'];}else if(_0x319289['endUserType']===_0xdb8d('0x15')){_0x22c7ba[_0xdb8d('0x1a')]=_0x319289['id'];}else if(_0x319289[_0xdb8d('0x14')]===_0xdb8d('0x12')&&_0x4ffd34[_0xdb8d('0x1b')]){_0x22c7ba[_0x4ffd34[_0xdb8d('0x1b')]]=_0x319289['id'];}else{logger[_0xdb8d('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x54ff68[_0xdb8d('0x1d')](_0x4ffd34[_0xdb8d('0x16')])['create'](_0x22c7ba);}function getUser(_0x4331e5,_0x393015,_0x18fd9a){if(!_[_0xdb8d('0x1e')](_0x393015)&&intUtil[_0xdb8d('0x1f')](_0x393015)){var _0x2ff89c={'Email':_0x393015};var _0x2df153={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x18fd9a[_0xdb8d('0x1d')](_0xdb8d('0x20'))[_0xdb8d('0x21')](_0x2ff89c,_0x2df153)[_0xdb8d('0x22')]()[_0xdb8d('0x23')](function(_0x4b5e6a){if(_0x4b5e6a['length']){var _0x2b1573=_['find'](_0x4b5e6a,function(_0x40c232){return _0x40c232[_0xdb8d('0x24')]===_0x393015;});if(_0x2b1573){logger['info'](_0xdb8d('0x25'),_0x393015);return BPromise[_0xdb8d('0x26')]({'id':_0x2b1573['Id'],'name':_0x2b1573[_0xdb8d('0x27')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x393015);return _0x18fd9a[_0xdb8d('0x28')]()['then'](function(_0x1fd083){return BPromise[_0xdb8d('0x26')]({'id':_0x1fd083[_0xdb8d('0x29')],'name':_0x1fd083[_0xdb8d('0x2a')]});});}});}else{logger[_0xdb8d('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x393015);return _0x18fd9a[_0xdb8d('0x28')]()['then'](function(_0x4a96d6){return BPromise['resolve']({'id':_0x4a96d6[_0xdb8d('0x29')],'name':_0x4a96d6[_0xdb8d('0x2a')]});});}}function getEndUser(_0x474e4f,_0x4660bb,_0x1a1635,_0x4e7ed9,_0x137387){var _0x4278a8={'$or':{'Phone':_0x4e7ed9}};var _0x1e885d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdb8d('0x26')]()[_0xdb8d('0x23')](function(){logger[_0xdb8d('0x1c')](_0xdb8d('0x2b'),_0x4e7ed9,_0x4660bb[_0xdb8d('0x2c')]);switch(_0x4660bb[_0xdb8d('0x2c')]){case _0xdb8d('0x2d'):var _0x519201=_[_0xdb8d('0x2e')](_0x4278a8);if(_0x4660bb[_0xdb8d('0x2f')]){var _0x204f47={};_0x204f47[_0x4660bb['additionalSearchContact']]=_0x4e7ed9;_['merge'](_0x519201[_0xdb8d('0x30')],_0x204f47);}return _0x137387[_0xdb8d('0x1d')](_0xdb8d('0x31'))[_0xdb8d('0x21')](_0x519201,_0x1e885d)[_0xdb8d('0x22')]()['then'](function(_0x561a4e){if(_0x561a4e&&_0x561a4e[_0xdb8d('0x32')]){return _0x561a4e;}else{var _0x1578a4=_[_0xdb8d('0x2e')](_0x4278a8);if(_0x4660bb['additionalSearchLead']){var _0x3c4e9a={};_0x3c4e9a[_0x4660bb[_0xdb8d('0x33')]]=_0x4e7ed9;_[_0xdb8d('0x34')](_0x1578a4[_0xdb8d('0x30')],_0x3c4e9a);}return _0x137387[_0xdb8d('0x1d')](_0xdb8d('0x35'))[_0xdb8d('0x21')](_0x1578a4,_0x1e885d);}});case _0xdb8d('0x36'):var _0x480dee=_[_0xdb8d('0x2e')](_0x4278a8);if(_0x4660bb['additionalSearchAccount']){var _0x204f47={};_0x204f47[_0x4660bb[_0xdb8d('0x37')]]=_0x4e7ed9;_[_0xdb8d('0x34')](_0x480dee[_0xdb8d('0x30')],_0x204f47);}return _0x137387['sobject'](_0xdb8d('0x38'))[_0xdb8d('0x21')](_0x480dee,_0x1e885d)[_0xdb8d('0x22')]()[_0xdb8d('0x23')](function(_0x6c4198){if(_0x6c4198&&_0x6c4198[_0xdb8d('0x32')]){return _0x6c4198;}else{var _0x194cb2=_['cloneDeep'](_0x4278a8);if(_0x4660bb['additionalSearchContact']){var _0x253a4c={};_0x253a4c[_0x4660bb['additionalSearchContact']]=_0x4e7ed9;_[_0xdb8d('0x34')](_0x194cb2['$or'],_0x253a4c);}return _0x137387[_0xdb8d('0x1d')](_0xdb8d('0x31'))[_0xdb8d('0x21')](_0x194cb2,_0x1e885d)[_0xdb8d('0x23')](function(_0x2ae993){if(_0x2ae993&&_0x2ae993[_0xdb8d('0x32')]){return _0x2ae993;}else{var _0x38424b=_[_0xdb8d('0x2e')](_0x4278a8);if(_0x4660bb[_0xdb8d('0x33')]){var _0x3e7408={};_0x3e7408[_0x4660bb[_0xdb8d('0x33')]]=_0x4e7ed9;_[_0xdb8d('0x34')](_0x38424b[_0xdb8d('0x30')],_0x3e7408);}return _0x137387[_0xdb8d('0x1d')]('Lead')[_0xdb8d('0x21')](_0x38424b,_0x1e885d);}});}});case _0xdb8d('0x18'):var _0x519201=_[_0xdb8d('0x2e')](_0x4278a8);if(_0x4660bb[_0xdb8d('0x2f')]){var _0x204f47={};_0x204f47[_0x4660bb[_0xdb8d('0x2f')]]=_0x4e7ed9;_[_0xdb8d('0x34')](_0x519201[_0xdb8d('0x30')],_0x204f47);}return _0x137387[_0xdb8d('0x1d')](_0xdb8d('0x31'))[_0xdb8d('0x21')](_0x519201,_0x1e885d)[_0xdb8d('0x22')]();case'lead':var _0x5ef486=_['cloneDeep'](_0x4278a8);if(_0x4660bb[_0xdb8d('0x33')]){var _0x204f47={};_0x204f47[_0x4660bb['additionalSearchLead']]=_0x4e7ed9;_[_0xdb8d('0x34')](_0x5ef486['$or'],_0x204f47);}return _0x137387[_0xdb8d('0x1d')]('Lead')[_0xdb8d('0x21')](_0x5ef486,_0x1e885d);case _0xdb8d('0x15'):var _0x480dee=_[_0xdb8d('0x2e')](_0x4278a8);if(_0x4660bb[_0xdb8d('0x37')]){var _0x204f47={};_0x204f47[_0x4660bb[_0xdb8d('0x37')]]=_0x4e7ed9;_[_0xdb8d('0x34')](_0x480dee[_0xdb8d('0x30')],_0x204f47);}return _0x137387['sobject']('Account')[_0xdb8d('0x21')](_0x480dee,_0x1e885d);default:return null;}})[_0xdb8d('0x23')](function(_0x13369f){if(_0x13369f&&_0x13369f[_0xdb8d('0x32')]){var _0x240864=_[_0xdb8d('0x39')](_0x13369f);if(_0x240864){return BPromise['resolve']({'id':_0x240864['Id'],'name':_0x240864[_0xdb8d('0x27')],'phone':_0x240864[_0xdb8d('0x3a')],'endUserType':_0x240864[_0xdb8d('0x3b')][_0xdb8d('0x3c')][_0xdb8d('0x3d')]()});}}})[_0xdb8d('0x23')](function(_0x238c7b){if(_0x238c7b){logger[_0xdb8d('0x1c')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x238c7b[_0xdb8d('0x14')],_0x4e7ed9);return BPromise['resolve'](_0x238c7b);}else{logger[_0xdb8d('0x1c')](_0xdb8d('0x3e'),_0x4e7ed9);var _0x4421b8={'Phone':_0x4e7ed9};if(_0x4660bb[_0xdb8d('0x3f')]){if(_0x4660bb[_0xdb8d('0x3f')]==='contact'){logger[_0xdb8d('0x1c')](_0xdb8d('0x40'),_0x4e7ed9,_0x4660bb['moduleCreate']);_0x4421b8['LastName']=_0x1a1635!==_0xdb8d('0x41')?_0x1a1635:util[_0xdb8d('0x42')](_0xdb8d('0x43'),_0x4e7ed9);}else if(_0x4660bb[_0xdb8d('0x3f')]===_0xdb8d('0x12')){logger[_0xdb8d('0x1c')](_0xdb8d('0x40'),_0x4e7ed9,_0x4660bb[_0xdb8d('0x3f')]);_0x4421b8['LastName']=_0x1a1635!==_0xdb8d('0x41')?_0x1a1635:util[_0xdb8d('0x42')](_0xdb8d('0x43'),_0x4e7ed9);_0x4421b8['Company']=_0xdb8d('0x44');}else if(_0x4660bb['moduleCreate']===_0xdb8d('0x15')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4e7ed9,_0x4660bb[_0xdb8d('0x3f')]);_0x4421b8[_0xdb8d('0x27')]=_0x1a1635!==_0xdb8d('0x41')?_0x1a1635:util['format'](_0xdb8d('0x43'),_0x4e7ed9);}else{return null;}}return _0x137387[_0xdb8d('0x1d')](_['upperFirst'](_0x4660bb['moduleCreate']))[_0xdb8d('0x45')](_0x4421b8)['then'](function(_0x5ba09f){return BPromise['resolve']({'id':_0x5ba09f['id'],'endUserType':_0x4660bb[_0xdb8d('0x3f')]});});}});}function getCustomFields(_0x23ba73,_0x51b1ff){var _0x1600c3={};if(_0x23ba73[_0xdb8d('0x32')]>0x0){_[_0xdb8d('0x46')](_0x23ba73,function(_0x827e1d){if(_[_0xdb8d('0x47')]([_0xdb8d('0x48'),_0xdb8d('0x49')],_0x827e1d[_0xdb8d('0x3c')])&&_0x827e1d[_0xdb8d('0x4a')]){_0x1600c3[_0x827e1d[_0xdb8d('0x4a')]]=_0x827e1d[_0xdb8d('0x4b')][_0xdb8d('0x4c')]();}else if(_0x827e1d[_0xdb8d('0x3c')]==='variable'&&_0x827e1d[_0xdb8d('0x4d')]&&_0x827e1d[_0xdb8d('0x4a')]){_0x51b1ff[_0x827e1d['variableName']]&&(_0x1600c3[_0x827e1d[_0xdb8d('0x4a')]]=_0x51b1ff[_0x827e1d[_0xdb8d('0x4d')]]['toString']());}else if(_0x827e1d['type']===_0xdb8d('0x4e')&&_0x827e1d[_0xdb8d('0x4f')]&&_0x827e1d[_0xdb8d('0x4f')][_0xdb8d('0x50')]&&_0x827e1d['idField']){_0x51b1ff[_0x827e1d['Variable'][_0xdb8d('0x50')]['toLowerCase']()]&&(_0x1600c3[_0x827e1d[_0xdb8d('0x4a')]]=_0x51b1ff[_0x827e1d[_0xdb8d('0x4f')][_0xdb8d('0x50')]['toLowerCase']()][_0xdb8d('0x4c')]());}});}return _0x1600c3;}function getConnection(_0x1cb209){var _0x3fdbf0=_0x1cb209[_0xdb8d('0x51')][_0xdb8d('0x52')](_0x1cb209[_0xdb8d('0x53')]);var _0x485cd5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1cb209['remoteUri']||'https://login.salesforce.com','clientId':_0x1cb209[_0xdb8d('0x54')],'clientSecret':_0x1cb209[_0xdb8d('0x55')]}});return _0x485cd5[_0xdb8d('0x56')](_0x1cb209[_0xdb8d('0x57')],_0x3fdbf0)[_0xdb8d('0x23')](function(){logger[_0xdb8d('0x1c')]('Connection\x20established.');return _0x485cd5;});}exports[_0xdb8d('0x58')]=function(_0x2c4529,_0x5203a3,_0x2d423f,_0x37012e,_0x49ac2a,_0x415988){var _0x11cb16,_0x2d4c1b,_0x3ed08e,_0x1e2bfd;_0x415988[_0xdb8d('0x59')]=intUtil[_0xdb8d('0x5a')](_0x415988[_0xdb8d('0x59')]);_0x415988[_0xdb8d('0x5b')]=intUtil[_0xdb8d('0x5a')](_0x415988[_0xdb8d('0x5b')]);if(_0x49ac2a&&_0x49ac2a[_0xdb8d('0x5c')]){logger[_0xdb8d('0x1c')]('[QUEUE]',_0xdb8d('0x5d'));_0x5203a3[_0xdb8d('0x5e')]=util['format'](_0xdb8d('0x5f'),_0x415988[_0xdb8d('0x59')],_0x5203a3[_0xdb8d('0x60')],md5(_0x5203a3[_0xdb8d('0x60')]));}else{_0x5203a3[_0xdb8d('0x5e')]='';}return getConnection(_0x415988)['then'](function(_0x1205a2){_0x1e2bfd=_0x1205a2;return getUser(_0x415988,_0x37012e['email'],_0x1e2bfd);})[_0xdb8d('0x23')](function(_0x126e2b){_0x11cb16=_0x126e2b;return getEndUser(_0x415988,_0x2d423f,_0x5203a3['calleridname'],_0x5203a3[_0xdb8d('0x61')],_0x1e2bfd);})['then'](function(_0x109281){_0x2d4c1b=_0x109281;return getTicket(_0x415988,_0x11cb16,_0x2d4c1b,_0x2d423f,_0x5203a3,_0x2d423f[_0xdb8d('0x62')],_0x1e2bfd,_0xdb8d('0x58'));})[_0xdb8d('0x23')](function(_0x4034a2){_0x3ed08e=_0x4034a2;logger[_0xdb8d('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x3ed08e['id']);logger[_0xdb8d('0x1c')](_0xdb8d('0x63'),_0x3ed08e['id'],_0x37012e[_0xdb8d('0x50')],_0x415988[_0xdb8d('0x3c')]);switch(_0x415988[_0xdb8d('0x3c')]){case _0xdb8d('0x64'):emit(util[_0xdb8d('0x42')](_0xdb8d('0x65'),_0x37012e['name']),_0xdb8d('0x66'),{'recordId':_0x3ed08e['id']});break;case _0xdb8d('0x67'):emit(util['format']('user:%s',_0x37012e[_0xdb8d('0x50')]),'trigger:browser:url',{'uri':util['format'](_0xdb8d('0x68'),_0x1e2bfd[_0xdb8d('0x69')],_0x3ed08e['id'])});break;default:logger['error'](_0xdb8d('0x6a'));}})[_0xdb8d('0x6b')](function(_0x3a4c9f){logger[_0xdb8d('0x6c')](_0xdb8d('0x6d'),_0x3a4c9f);});};exports['outbound']=function(_0x46a5b1,_0x1d525f,_0x29772f,_0x51a16e,_0x196850,_0x287006,_0x305e62){var _0x34a740,_0x4ed93f,_0x3bf248,_0x3ff3ac;_0x287006['serverUrl']=intUtil[_0xdb8d('0x5a')](_0x287006[_0xdb8d('0x59')]);_0x287006[_0xdb8d('0x5b')]=intUtil[_0xdb8d('0x5a')](_0x287006['remoteUri']);if(_0x305e62&&_0x305e62[_0xdb8d('0x6e')]&&_0x305e62[_0xdb8d('0x6e')]!==_0xdb8d('0x6f')){logger['info'](_0xdb8d('0x70'),_0xdb8d('0x5d'));_0x1d525f[_0xdb8d('0x5e')]=util[_0xdb8d('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x287006[_0xdb8d('0x59')],_0x1d525f['uniqueid'],md5(_0x1d525f['uniqueid']));}return getConnection(_0x287006)['then'](function(_0x144caf){_0x3ff3ac=_0x144caf;return getUser(_0x287006,_0x51a16e[_0xdb8d('0x71')],_0x3ff3ac);})[_0xdb8d('0x23')](function(_0xf83e56){_0x34a740=_0xf83e56;return getEndUser(_0x287006,_0x29772f,_0x1d525f[_0xdb8d('0x72')],_0x1d525f[_0xdb8d('0x73')],_0x3ff3ac);})[_0xdb8d('0x23')](function(_0x42651b){_0x4ed93f=_0x42651b;return getTicket(_0x287006,_0x34a740,_0x4ed93f,_0x29772f,_0x1d525f,_0x29772f[_0xdb8d('0x62')],_0x3ff3ac,_0xdb8d('0x74'));})[_0xdb8d('0x23')](function(_0x4e969e){_0x3bf248=_0x4e969e;logger[_0xdb8d('0x1c')](_0xdb8d('0x75'),_0x3bf248['id']);logger[_0xdb8d('0x1c')](_0xdb8d('0x76'),_0x3bf248['id'],_0x51a16e[_0xdb8d('0x50')],_0x287006[_0xdb8d('0x3c')]);switch(_0x287006[_0xdb8d('0x3c')]){case _0xdb8d('0x64'):emit(util[_0xdb8d('0x42')]('user:%s',_0x51a16e[_0xdb8d('0x50')]),'trigger:salesforce:display',{'recordId':_0x3bf248['id']});break;case'newTab':emit(util[_0xdb8d('0x42')](_0xdb8d('0x65'),_0x51a16e['name']),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x3ff3ac[_0xdb8d('0x69')],_0x3bf248['id'])});break;default:logger[_0xdb8d('0x6c')](_0xdb8d('0x70'),_0xdb8d('0x77'));}})['catch'](function(_0x2961cf){logger['error'](_0xdb8d('0x70'),_0x2961cf);});};exports[_0xdb8d('0x78')]=function(_0x4977cd,_0x2caace,_0x3412e8,_0x5ab9e5,_0xe3af82,_0x5efc8c){var _0x5b1a51,_0x1a24de,_0x45fb50,_0x139bef;_0x5efc8c[_0xdb8d('0x59')]=intUtil[_0xdb8d('0x5a')](_0x5efc8c[_0xdb8d('0x59')]);_0x5efc8c[_0xdb8d('0x5b')]=intUtil[_0xdb8d('0x5a')](_0x5efc8c[_0xdb8d('0x5b')]);if(_0xe3af82&&_0xe3af82['monitor_format']){logger[_0xdb8d('0x1c')]('['+_0x2caace[_0xdb8d('0x79')][_0xdb8d('0x7a')]()+']',_0xdb8d('0x5d'));_0x2caace[_0xdb8d('0x5e')]=util[_0xdb8d('0x42')](_0xdb8d('0x5f'),_0x5efc8c['serverUrl'],_0x2caace[_0xdb8d('0x60')],md5(_0x2caace['uniqueid']));}else{_0x2caace['recordingURL']='';}return getConnection(_0x5efc8c)[_0xdb8d('0x23')](function(_0x1fec2a){_0x139bef=_0x1fec2a;if(!_[_0xdb8d('0x1e')](_0x5ab9e5)){return getUser(_0x5efc8c,_0x5ab9e5[_0xdb8d('0x50')],_0x139bef);}else{return getUser(_0x5efc8c,null,_0x139bef);}})[_0xdb8d('0x23')](function(_0x274405){_0x5b1a51=_0x274405;return getEndUser(_0x5efc8c,_0x3412e8,_0x2caace[_0xdb8d('0x7b')],_0x2caace['calleridnum'],_0x139bef);})[_0xdb8d('0x23')](function(_0x2e7da3){_0x1a24de=_0x2e7da3;return getTicket(_0x5efc8c,_0x5b1a51,_0x1a24de,_0x3412e8,_0x2caace,_0x3412e8['Fields'],_0x139bef);})[_0xdb8d('0x23')](function(_0x291684){_0x45fb50=_0x291684;logger[_0xdb8d('0x1c')]('['+_0x2caace['lastevent'][_0xdb8d('0x7a')]()+']\x20Ticket\x20%s\x20created.',_0x45fb50['id']);logger[_0xdb8d('0x1c')]('['+_0x2caace['lastevent'][_0xdb8d('0x7a')]()+_0xdb8d('0x7c'),_0x5efc8c['type']);})[_0xdb8d('0x6b')](function(_0x2e5cfc){logger[_0xdb8d('0x6c')]('['+_0x2caace['lastevent']['toUpperCase']()+']',_0x2e5cfc);});}; \ 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 8ac2468..6a58ab5 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 _0x4780=['true','userId','userEmail','adminEmail','],\x20getUser\x20crm','POST','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','error','forEach','includes','string','picklist','nameField','customField','content','toString','type','variable','variableName','idField','customVariable','Variable','name','toLowerCase',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active'];(function(_0x4b5290,_0xda09be){var _0x1342ac=function(_0x778062){while(--_0x778062){_0x4b5290['push'](_0x4b5290['shift']());}};_0x1342ac(++_0xda09be);}(_0x4780,0xbe));var _0x0478=function(_0x19d69c,_0x1619c2){_0x19d69c=_0x19d69c-0x0;var _0x2a3272=_0x4780[_0x19d69c];return _0x2a3272;};'use strict';var _=require(_0x0478('0x0'));var Promise=require(_0x0478('0x1'));var rp=require('request-promise');var util=require(_0x0478('0x2'));var md5=require(_0x0478('0x3'));var Redis=require('ioredis');var intUtil=require(_0x0478('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0478('0x5'))(_0x0478('0x6'));config[_0x0478('0x7')]=_[_0x0478('0x8')](config[_0x0478('0x7')],{'host':_0x0478('0x9'),'port':0x18eb});var io=require(_0x0478('0xa'))(new Redis(config['redis']));function getAdminUser(_0x240b4b,_0x52a056,_0x1ed3e4,_0x21f74,_0x22aa1b,_0x359739){return new Promise(function(_0x4f9a8f,_0x487a32){var _0x496ef7={'method':_0x0478('0xb'),'uri':_0x21f74+_0x0478('0xc')+'&'+_0x22aa1b+'&'+_0x359739,'auth':_0x52a056,'json':!![]};return rp(_0x496ef7)[_0x0478('0xd')](function(_0x5418db){if(_0x5418db['result']['length']>0x0){_0x1ed3e4[_0x0478('0xe')]=_0x5418db[_0x0478('0xf')][0x0][_0x0478('0x10')];}logger[_0x0478('0x11')]('['+[_0x240b4b['toUpperCase']()]+_0x0478('0x12'),_0x1ed3e4);_0x4f9a8f(_0x1ed3e4);})[_0x0478('0x13')](function(_0x1bd52f){logger['error']('['+[_0x240b4b[_0x0478('0x14')]()]+']',_0x1bd52f[_0x0478('0x15')]);_0x487a32(_0x1bd52f[_0x0478('0x15')]);});});}function getUser(_0x474aa9,_0x22e7d4,_0x195a9f,_0x210c49,_0x1a0e1e){return function(_0x56659a){logger[_0x0478('0x11')]('['+[_0x474aa9[_0x0478('0x14')]()]+_0x0478('0x16'),_0x56659a);return new Promise(function(_0x16f49e,_0x2cb597){if(intUtil[_0x0478('0x17')](_0x56659a['userEmail'])){var _0x21a42c={'method':_0x0478('0xb'),'uri':_0x195a9f+'sys_user?sysparm_query=email%3D'+_0x56659a['userEmail']+'&'+_0x210c49+'&'+_0x1a0e1e,'auth':_0x22e7d4,'json':!![]};logger[_0x0478('0x11')]('['+[_0x474aa9['toUpperCase']()]+_0x0478('0x18'),_0x21a42c);return rp(_0x21a42c)['then'](function(_0x511255){logger['info']('['+[_0x474aa9[_0x0478('0x14')]()]+_0x0478('0x19'),_0x511255);if(_0x511255[_0x0478('0xf')][_0x0478('0x1a')]>0x0&&String(_0x511255[_0x0478('0xf')][0x0][_0x0478('0x1b')])===_0x0478('0x1c')){_0x56659a[_0x0478('0x1d')]=_0x511255[_0x0478('0xf')][0x0]['sys_id'];}else{_0x56659a[_0x0478('0x1d')]=_0x56659a[_0x0478('0xe')];_0x56659a[_0x0478('0x1e')]=_0x56659a[_0x0478('0x1f')];}logger[_0x0478('0x11')]('['+[_0x474aa9[_0x0478('0x14')]()]+_0x0478('0x20'),_0x56659a);_0x16f49e(_0x56659a);})['catch'](function(_0x50a865){logger['error']('['+[_0x474aa9[_0x0478('0x14')]()]+']',_0x50a865[_0x0478('0x15')]);_0x2cb597(_0x50a865[_0x0478('0x15')]);});}else{logger[_0x0478('0x11')]('['+[_0x474aa9[_0x0478('0x14')]()]+']\x20using\x20admin\x20profile');_0x56659a[_0x0478('0x1d')]=_0x56659a[_0x0478('0xe')];_0x56659a[_0x0478('0x1e')]=_0x56659a[_0x0478('0x1f')];_0x16f49e(_0x56659a);}});};}function createEndUser(_0x24501e,_0x2522de,_0x36b6b1,_0xeb51d8,_0x5ba33e){logger['info']('['+[_0x24501e[_0x0478('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x36b6b1);return new Promise(function(_0x220995,_0x4b4b35){var _0x14f970={'method':_0x0478('0x21'),'uri':_0xeb51d8+_0x0478('0x22')+_0x5ba33e,'body':{'user_name':_0x36b6b1['endUserNumber'],'roles':_0x0478('0x23'),'first_name':_0x36b6b1['endUserNumber'],'active':_0x0478('0x1c'),'date_format':_0x0478('0x24'),'phone':_0x36b6b1[_0x0478('0x25')]},'auth':_0x2522de,'json':!![]};return rp(_0x14f970)[_0x0478('0xd')](function(_0x16f387){logger[_0x0478('0x11')]('['+[_0x24501e[_0x0478('0x14')]()]+_0x0478('0x26'),_0x16f387[_0x0478('0xf')]);_0x36b6b1[_0x0478('0x27')]=_0x16f387['result']['sys_id'];_0x220995(_0x36b6b1);})[_0x0478('0x13')](function(_0x56defb){logger['error']('['+[_0x24501e[_0x0478('0x14')]()]+']',_0x56defb[_0x0478('0x15')]);_0x4b4b35(_0x56defb[_0x0478('0x15')]);});});}function getEndUser(_0x56893b,_0x239d1a,_0x33530d,_0x4efc5e,_0x2ba9c4){return function(_0x3ab1ed){logger[_0x0478('0x11')]('['+[_0x56893b['toUpperCase']()]+_0x0478('0x28'),_0x3ab1ed);return new Promise(function(_0x3a68df,_0x2e1655){var _0x21d259={'method':_0x0478('0xb'),'uri':_0x33530d+_0x0478('0x29')+_0x3ab1ed[_0x0478('0x25')]+'&'+_0x4efc5e+'&'+_0x2ba9c4,'auth':_0x239d1a,'json':!![]};return rp(_0x21d259)[_0x0478('0xd')](function(_0x2a6d7a){if(_0x2a6d7a[_0x0478('0xf')]['length']>0x0){_0x3ab1ed[_0x0478('0x27')]=_0x2a6d7a[_0x0478('0xf')][0x0][_0x0478('0x10')];logger[_0x0478('0x11')]('['+[_0x56893b[_0x0478('0x14')]()]+'],\x20getEndUser\x20crm',_0x3ab1ed);_0x3a68df(_0x3ab1ed);}else{return createEndUser(_0x56893b,_0x239d1a,_0x3ab1ed,_0x33530d,_0x4efc5e)['then'](function(_0x429cb2){logger[_0x0478('0x11')]('['+[_0x56893b[_0x0478('0x14')]()]+_0x0478('0x2a'),_0x429cb2);_0x3a68df(_0x429cb2);});}})[_0x0478('0x13')](function(_0x37232f){logger[_0x0478('0x2b')]('['+[_0x56893b[_0x0478('0x14')]()]+']',_0x37232f[_0x0478('0x15')]);_0x2e1655(_0x37232f[_0x0478('0x15')]);});});};}function getCustomFields(_0x1f022a,_0x33d6f6){var _0x189723={};if(_0x1f022a[_0x0478('0x1a')]>0x0){_[_0x0478('0x2c')](_0x1f022a,function(_0xb793c5){if(_[_0x0478('0x2d')]([_0x0478('0x2e'),_0x0478('0x2f')],_0xb793c5['type'])&&_0xb793c5[_0x0478('0x30')]&&!_0xb793c5[_0x0478('0x31')]){_0x189723[_0xb793c5[_0x0478('0x30')]['toLowerCase']()]=_0xb793c5[_0x0478('0x32')][_0x0478('0x33')]();}else if(_[_0x0478('0x2d')]([_0x0478('0x2e'),_0x0478('0x2f')],_0xb793c5[_0x0478('0x34')])&&_0xb793c5['idField']&&_0xb793c5['customField']){_0x189723[_0xb793c5['idField']['toLowerCase']()]=_0xb793c5['content'][_0x0478('0x33')]();}else if(_0xb793c5[_0x0478('0x34')]===_0x0478('0x35')&&_0xb793c5[_0x0478('0x36')]&&_0xb793c5[_0x0478('0x37')]&&_0xb793c5['customField']){_0x189723[_0xb793c5[_0x0478('0x37')]['toLowerCase']()]=_0x33d6f6[_0xb793c5[_0x0478('0x36')]][_0x0478('0x33')]();}else if(_0xb793c5[_0x0478('0x34')]===_0x0478('0x38')&&_0xb793c5[_0x0478('0x39')]&&_0xb793c5['Variable'][_0x0478('0x3a')]&&_0xb793c5[_0x0478('0x37')]&&_0xb793c5[_0x0478('0x31')]){_0x189723[_0xb793c5[_0x0478('0x37')]['toLowerCase']()]=_0x33d6f6[_0xb793c5[_0x0478('0x39')][_0x0478('0x3a')][_0x0478('0x3b')]()][_0x0478('0x33')]();}});}return _0x189723;}function getTicket(_0x480406,_0x1476d4,_0x21bbc6,_0x367fc9,_0x38345c,_0x466256){return function(_0x52a75d){logger['info']('['+[_0x480406['toUpperCase']()]+_0x0478('0x3c'),_0x52a75d);return new Promise(function(_0x5e0781,_0x59efcc){var _0x57a422=_0x480406['toLowerCase']()==='outbound'?_0x52a75d[_0x0478('0x1d')]:_0x52a75d[_0x0478('0x27')];var _0x5bcdf6={'method':'POST','uri':_0x21bbc6+_0x0478('0x3d')+'?'+_0x466256,'body':Object[_0x0478('0x3e')]({},{'active':_0x0478('0x1c'),'caller_id':_0x57a422,'assigned_to':_0x52a75d[_0x0478('0x1d')],'short_description':intUtil[_0x0478('0x3f')](_0x367fc9['Subjects'],_0x38345c,'\x20'),'description':intUtil['getString'](_0x367fc9[_0x0478('0x40')],_0x38345c,'\x0a')},getCustomFields(_0x367fc9[_0x0478('0x41')],_0x38345c)),'auth':_0x1476d4,'json':!![]};return rp(_0x5bcdf6)['then'](function(_0x1f2883){logger['info']('['+[_0x480406['toUpperCase']()]+_0x0478('0x42'),_0x1f2883['result']);_0x52a75d[_0x0478('0x43')]=_0x1f2883['result'][_0x0478('0x10')];_0x52a75d['ticketNumber']=_0x1f2883[_0x0478('0xf')][_0x0478('0x44')];logger[_0x0478('0x11')]('['+[_0x480406[_0x0478('0x14')]()]+_0x0478('0x45'),_0x52a75d);_0x5e0781(_0x52a75d);})[_0x0478('0x13')](function(_0x3fe63c){logger[_0x0478('0x2b')]('['+[_0x480406['toUpperCase']()]+']',_0x3fe63c[_0x0478('0x15')]);_0x59efcc(_0x3fe63c['message']);});});};}function createRemoteTag(_0x1f3776,_0x2f3f42,_0x215529,_0xb3a1b0){return new Promise(function(_0x366f41,_0x53f0ce){var _0x32daca={'method':'POST','uri':_0x215529+_0x0478('0x46')+'?'+_0xb3a1b0,'body':{'short_description':_0x1f3776,'global':!![],'active':!![],'name':_0x1f3776},'auth':_0x2f3f42,'json':!![]};return rp(_0x32daca)[_0x0478('0xd')](function(_0x4fc2d2){var _0x27011d=_0x4fc2d2[_0x0478('0xf')][_0x0478('0x10')];_0x366f41(_0x27011d);});});}function getRemoteTag(_0x144ad1,_0x57d37a,_0x265ba0,_0x41f870,_0x567299){return new Promise(function(_0x7b4868,_0x31732c){var _0x288503={'method':_0x0478('0xb'),'uri':_0x265ba0+_0x0478('0x46')+_0x0478('0x47')+_0x144ad1+'&'+_0x41f870,'auth':_0x57d37a,'json':!![]};return rp(_0x288503)[_0x0478('0xd')](function(_0x3ad3b9){if(_0x3ad3b9[_0x0478('0xf')]['length']>0x0){var _0x1af063=_0x3ad3b9[_0x0478('0xf')][0x0][_0x0478('0x10')];_0x7b4868(_0x1af063);}else{return createRemoteTag(_0x144ad1,_0x57d37a,_0x265ba0,_0x41f870)[_0x0478('0xd')](function(_0x16b637){_0x7b4868(_0x16b637);});}});});}function assignTagToIncident(_0x142860,_0x4ef0b9,_0x404195,_0x5bf82e,_0x2a3081){return new Promise(function(_0x598c7a,_0xaf72d7){var _0x3a39e4={'method':_0x0478('0x21'),'uri':_0x404195+_0x0478('0x48')+'?'+_0x2a3081,'body':{'label':_0x142860,'table':'incident','id_type':'Incident','table_key':_0x5bf82e['ticketId'],'title':_0x0478('0x49')+_0x5bf82e[_0x0478('0x4a')],'id_display':_0x5bf82e[_0x0478('0x4a')]},'auth':_0x4ef0b9,'json':!![]};return rp(_0x3a39e4)[_0x0478('0xd')](function(_0x2a44b1){_0x598c7a();})['catch'](function(){_0x598c7a();});});}function manageTags(_0x5cdf96,_0x5c1799,_0x5d3341,_0x1adb5d,_0xfd3e97,_0x2bbf22,_0x81a1bc){return new Promise(function(_0x45a6ff,_0x2d9381){var _0x5d4662=[];_0x5c1799[_0x0478('0x2c')](function(_0x30af45){_0x5d4662['push'](getRemoteTag(_0x30af45,_0x5d3341,_0x1adb5d,_0x2bbf22,_0x81a1bc));});return Promise['all'](_0x5d4662)[_0x0478('0xd')](function(_0x527842){if(_0x527842[_0x0478('0x1a')]){logger[_0x0478('0x11')]('['+[_0x5cdf96['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x527842);var _0x1e6b30=[];_0x527842[_0x0478('0x2c')](function(_0xe697ed){_0x1e6b30[_0x0478('0x4b')](assignTagToIncident(_0xe697ed,_0x5d3341,_0x1adb5d,_0xfd3e97,_0x2bbf22));});return Promise[_0x0478('0x4c')](_0x1e6b30)[_0x0478('0xd')](function(){_0x45a6ff();})[_0x0478('0x13')](function(){_0x45a6ff();});}else{_0x45a6ff();}});});}function getTags(_0x4df7fa,_0xf06839,_0x3c1a45,_0x2dbc87,_0x585c3d,_0x1dc6c7){return function(_0x16b0a9){return new Promise(function(_0x1c3807,_0x79697b){var _0x455641=[];var _0xa27ccf=_0x2dbc87[_0x0478('0x4d')];if(_0xa27ccf&&_0xa27ccf['length']>0x0){_0x455641=_[_0x0478('0x4e')](_0xa27ccf,_0x0478('0x3a'));}if(_0x455641[_0x0478('0x1a')]>0x0){return manageTags(_0x4df7fa,_0x455641,_0xf06839,_0x3c1a45,_0x16b0a9,_0x585c3d,_0x1dc6c7)[_0x0478('0xd')](function(){_0x1c3807(_0x16b0a9);});}else{_0x1c3807(_0x16b0a9);}});};}function emit(_0x399c94,_0x27e127,_0x4668f3){var _0x119c8a=_0x0478('0x4f')+_0x0478('0x50')+_0x0478('0x51')+_0x0478('0x52');var _0x507a84={'uri':_0x399c94+_0x0478('0x53')+_0x4668f3+_0x119c8a};io['to'](util[_0x0478('0x54')]('user:%s',_0x27e127))['emit'](_0x0478('0x55'),_0x507a84);}exports['cs']=function(_0x470523,_0xa686e2,_0x41d33e,_0x27c2d4,_0x5aa7d8,_0x36c1af,_0x176a53,_0x1f4f01){var _0x551b9c={};var _0x3cf1e3={'user':_0x36c1af['username'],'pass':_0x36c1af[_0x0478('0x56')]};var _0x12b4c3=_0x0478('0x57');var _0x1b6794=_0x0478('0x58');_0x36c1af['remoteUri']=intUtil[_0x0478('0x59')](_0x36c1af[_0x0478('0x5a')]);_0x36c1af[_0x0478('0x5b')]=intUtil['stripTrailingSlash'](_0x36c1af[_0x0478('0x5b')]);var _0x52f954=util[_0x0478('0x54')](_0x0478('0x5c'),_0x36c1af[_0x0478('0x5a')]);_0x551b9c[_0x0478('0x1e')]=!_[_0x0478('0x5d')](_0x27c2d4)?_0x27c2d4[_0x0478('0x5e')]:null;_0x551b9c[_0x0478('0x1f')]=_0x36c1af[_0x0478('0x5e')];_0x551b9c[_0x0478('0x25')]=_0x1f4f01['toLowerCase']()===_0x0478('0x5f')?_0xa686e2[_0x0478('0x60')]:_0xa686e2['calleridnum'];_0x551b9c['callDirection']=_0x1f4f01===_0x0478('0x61')||_0x1f4f01===_0x0478('0x62')?_0x0478('0x61'):'outbound';var _0x2b8d83=util[_0x0478('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36c1af[_0x0478('0x5b')],_0xa686e2[_0x0478('0x63')],md5(_0xa686e2[_0x0478('0x63')]));if(_0x5aa7d8&&_0x5aa7d8[_0x0478('0x64')]){logger[_0x0478('0x11')]('[QUEUE]',_0x0478('0x65'));_0xa686e2[_0x0478('0x66')]=_0x2b8d83;}else if(_0x176a53&&_0x176a53[_0x0478('0x67')]&&_0x176a53[_0x0478('0x67')]!==_0x0478('0x68')){logger['info'](_0x0478('0x69'),_0x0478('0x65'));_0xa686e2[_0x0478('0x66')]=_0x2b8d83;}else{_0xa686e2[_0x0478('0x66')]='';}return getAdminUser(_0x1f4f01,_0x3cf1e3,_0x551b9c,_0x52f954,_0x1b6794,_0x12b4c3)['then'](getUser(_0x1f4f01,_0x3cf1e3,_0x52f954,_0x1b6794,_0x12b4c3))[_0x0478('0xd')](getEndUser(_0x1f4f01,_0x3cf1e3,_0x52f954,_0x1b6794,_0x12b4c3))['then'](getTicket(_0x1f4f01,_0x3cf1e3,_0x52f954,_0x41d33e,_0xa686e2,_0x1b6794))['then'](function(_0x50aa29){logger[_0x0478('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x50aa29[_0x0478('0x43')]));logger['info'](util[_0x0478('0x54')]('call\x20direction:\x20%s',_0x1f4f01));if(_0x1f4f01!==_0x0478('0x62')){logger[_0x0478('0x11')]('['+[_0x1f4f01[_0x0478('0x14')]()]+']',_0x0478('0x6a'));emit(_0x36c1af['remoteUri'],_0x27c2d4[_0x0478('0x3a')],_0x50aa29['ticketId']);}})[_0x0478('0x13')](function(_0x2ff1b6){logger[_0x0478('0x2b')]('['+[_0x1f4f01[_0x0478('0x14')]()]+_0x0478('0x6b'),util[_0x0478('0x6c')](_0x2ff1b6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7319=['label_entry','Incident','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','info','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','sys_id','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','picklist','type','nameField','customField','toLowerCase','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7319,0x1d8));var _0x9731=function(_0x5e7f9a,_0x30e4cf){_0x5e7f9a=_0x5e7f9a-0x0;var _0xadf9e3=_0x7319[_0x5e7f9a];return _0xadf9e3;};'use strict';var _=require(_0x9731('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require('util');var md5=require(_0x9731('0x1'));var Redis=require('ioredis');var intUtil=require(_0x9731('0x2'));var config=require(_0x9731('0x3'));var logger=require(_0x9731('0x4'))(_0x9731('0x5'));config[_0x9731('0x6')]=_[_0x9731('0x7')](config['redis'],{'host':_0x9731('0x8'),'port':0x18eb});var io=require(_0x9731('0x9'))(new Redis(config['redis']));function getAdminUser(_0x4634d0,_0x286f87,_0x249af0,_0x20a1d1,_0x46e54c,_0x811fad){return new Promise(function(_0x4646af,_0x3ad6a2){var _0x3458fc={'method':_0x9731('0xa'),'uri':_0x20a1d1+_0x9731('0xb')+'&'+_0x46e54c+'&'+_0x811fad,'auth':_0x286f87,'json':!![]};return rp(_0x3458fc)[_0x9731('0xc')](function(_0x4d651c){if(_0x4d651c['result']['length']>0x0){_0x249af0[_0x9731('0xd')]=_0x4d651c[_0x9731('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x4634d0[_0x9731('0xf')]()]+_0x9731('0x10'),_0x249af0);_0x4646af(_0x249af0);})[_0x9731('0x11')](function(_0x32fad2){logger[_0x9731('0x12')]('['+[_0x4634d0['toUpperCase']()]+']',_0x32fad2[_0x9731('0x13')]);_0x3ad6a2(_0x32fad2['message']);});});}function getUser(_0x4f3501,_0x323eab,_0x35169d,_0x441fcc,_0x54285d){return function(_0x4ec502){logger['info']('['+[_0x4f3501[_0x9731('0xf')]()]+_0x9731('0x14'),_0x4ec502);return new Promise(function(_0x46b3f8,_0x3c5c31){if(intUtil[_0x9731('0x15')](_0x4ec502[_0x9731('0x16')])){var _0x59cccf={'method':_0x9731('0xa'),'uri':_0x35169d+'sys_user?sysparm_query=email%3D'+_0x4ec502[_0x9731('0x16')]+'&'+_0x441fcc+'&'+_0x54285d,'auth':_0x323eab,'json':!![]};logger[_0x9731('0x17')]('['+[_0x4f3501[_0x9731('0xf')]()]+_0x9731('0x18'),_0x59cccf);return rp(_0x59cccf)['then'](function(_0x35ca4e){logger[_0x9731('0x17')]('['+[_0x4f3501[_0x9731('0xf')]()]+_0x9731('0x19'),_0x35ca4e);if(_0x35ca4e[_0x9731('0xe')][_0x9731('0x1a')]>0x0&&String(_0x35ca4e['result'][0x0]['active'])===_0x9731('0x1b')){_0x4ec502[_0x9731('0x1c')]=_0x35ca4e['result'][0x0][_0x9731('0x1d')];}else{_0x4ec502[_0x9731('0x1c')]=_0x4ec502['adminId'];_0x4ec502[_0x9731('0x16')]=_0x4ec502[_0x9731('0x1e')];}logger[_0x9731('0x17')]('['+[_0x4f3501[_0x9731('0xf')]()]+'],\x20getUser\x20crm',_0x4ec502);_0x46b3f8(_0x4ec502);})['catch'](function(_0x49bb46){logger[_0x9731('0x12')]('['+[_0x4f3501[_0x9731('0xf')]()]+']',_0x49bb46[_0x9731('0x13')]);_0x3c5c31(_0x49bb46[_0x9731('0x13')]);});}else{logger[_0x9731('0x17')]('['+[_0x4f3501['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x4ec502[_0x9731('0x1c')]=_0x4ec502[_0x9731('0xd')];_0x4ec502[_0x9731('0x16')]=_0x4ec502['adminEmail'];_0x46b3f8(_0x4ec502);}});};}function createEndUser(_0x273d4a,_0x25dcd3,_0x140cc5,_0x304e98,_0x15e507){logger[_0x9731('0x17')]('['+[_0x273d4a[_0x9731('0xf')]()]+_0x9731('0x1f'),_0x140cc5);return new Promise(function(_0x5f0d9b,_0x220fd0){var _0x5d78df={'method':_0x9731('0x20'),'uri':_0x304e98+'sys_user?'+_0x15e507,'body':{'user_name':_0x140cc5[_0x9731('0x21')],'roles':_0x9731('0x22'),'first_name':_0x140cc5[_0x9731('0x21')],'active':'true','date_format':_0x9731('0x23'),'phone':_0x140cc5[_0x9731('0x21')]},'auth':_0x25dcd3,'json':!![]};return rp(_0x5d78df)[_0x9731('0xc')](function(_0x2b3089){logger['info']('['+[_0x273d4a[_0x9731('0xf')]()]+_0x9731('0x24'),_0x2b3089[_0x9731('0xe')]);_0x140cc5[_0x9731('0x25')]=_0x2b3089[_0x9731('0xe')]['sys_id'];_0x5f0d9b(_0x140cc5);})['catch'](function(_0x59f0a5){logger[_0x9731('0x12')]('['+[_0x273d4a[_0x9731('0xf')]()]+']',_0x59f0a5[_0x9731('0x13')]);_0x220fd0(_0x59f0a5[_0x9731('0x13')]);});});}function getEndUser(_0x136c1b,_0x3b079d,_0x5e7ecd,_0x48fe51,_0x4051de){return function(_0xde9bc4){logger[_0x9731('0x17')]('['+[_0x136c1b[_0x9731('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0xde9bc4);return new Promise(function(_0x7fc65c,_0x2f9c1c){var _0x374780={'method':'GET','uri':_0x5e7ecd+'sys_user?sysparm_query=phone%3D'+_0xde9bc4[_0x9731('0x21')]+'&'+_0x48fe51+'&'+_0x4051de,'auth':_0x3b079d,'json':!![]};return rp(_0x374780)[_0x9731('0xc')](function(_0x54d05e){if(_0x54d05e[_0x9731('0xe')][_0x9731('0x1a')]>0x0){_0xde9bc4[_0x9731('0x25')]=_0x54d05e[_0x9731('0xe')][0x0][_0x9731('0x1d')];logger['info']('['+[_0x136c1b[_0x9731('0xf')]()]+_0x9731('0x26'),_0xde9bc4);_0x7fc65c(_0xde9bc4);}else{return createEndUser(_0x136c1b,_0x3b079d,_0xde9bc4,_0x5e7ecd,_0x48fe51)[_0x9731('0xc')](function(_0x391188){logger['info']('['+[_0x136c1b['toUpperCase']()]+_0x9731('0x27'),_0x391188);_0x7fc65c(_0x391188);});}})[_0x9731('0x11')](function(_0x2d1b7c){logger[_0x9731('0x12')]('['+[_0x136c1b[_0x9731('0xf')]()]+']',_0x2d1b7c['message']);_0x2f9c1c(_0x2d1b7c[_0x9731('0x13')]);});});};}function getCustomFields(_0x15c553,_0x1c77a6){var _0x504619={};if(_0x15c553[_0x9731('0x1a')]>0x0){_['forEach'](_0x15c553,function(_0x44d614){if(_['includes'](['string',_0x9731('0x28')],_0x44d614[_0x9731('0x29')])&&_0x44d614[_0x9731('0x2a')]&&!_0x44d614[_0x9731('0x2b')]){_0x504619[_0x44d614[_0x9731('0x2a')][_0x9731('0x2c')]()]=_0x44d614['content']['toString']();}else if(_[_0x9731('0x2d')]([_0x9731('0x2e'),_0x9731('0x28')],_0x44d614[_0x9731('0x29')])&&_0x44d614[_0x9731('0x2f')]&&_0x44d614[_0x9731('0x2b')]){_0x504619[_0x44d614[_0x9731('0x2f')]['toLowerCase']()]=_0x44d614[_0x9731('0x30')][_0x9731('0x31')]();}else if(_0x44d614[_0x9731('0x29')]===_0x9731('0x32')&&_0x44d614[_0x9731('0x33')]&&_0x44d614[_0x9731('0x2f')]&&_0x44d614['customField']){_0x504619[_0x44d614['idField'][_0x9731('0x2c')]()]=_0x1c77a6[_0x44d614['variableName']][_0x9731('0x31')]();}else if(_0x44d614[_0x9731('0x29')]===_0x9731('0x34')&&_0x44d614[_0x9731('0x35')]&&_0x44d614[_0x9731('0x35')][_0x9731('0x36')]&&_0x44d614[_0x9731('0x2f')]&&_0x44d614[_0x9731('0x2b')]){_0x504619[_0x44d614[_0x9731('0x2f')][_0x9731('0x2c')]()]=_0x1c77a6[_0x44d614['Variable'][_0x9731('0x36')][_0x9731('0x2c')]()][_0x9731('0x31')]();}});}return _0x504619;}function getTicket(_0x15dd97,_0x10d47e,_0x52e38e,_0x572ebd,_0x1d3c32,_0x14cc92){return function(_0x69ab05){logger['info']('['+[_0x15dd97['toUpperCase']()]+_0x9731('0x37'),_0x69ab05);return new Promise(function(_0xd84608,_0x2fab94){var _0x378cba=_0x15dd97[_0x9731('0x2c')]()===_0x9731('0x38')?_0x69ab05['userId']:_0x69ab05[_0x9731('0x25')];var _0x1e1fbb={'method':_0x9731('0x20'),'uri':_0x52e38e+_0x9731('0x39')+'?'+_0x14cc92,'body':Object[_0x9731('0x3a')]({},{'active':_0x9731('0x1b'),'caller_id':_0x378cba,'assigned_to':_0x69ab05[_0x9731('0x1c')],'short_description':intUtil[_0x9731('0x3b')](_0x572ebd['Subjects'],_0x1d3c32,'\x20'),'description':intUtil['getString'](_0x572ebd[_0x9731('0x3c')],_0x1d3c32,'\x0a')},getCustomFields(_0x572ebd[_0x9731('0x3d')],_0x1d3c32)),'auth':_0x10d47e,'json':!![]};return rp(_0x1e1fbb)[_0x9731('0xc')](function(_0x1cb1d0){logger[_0x9731('0x17')]('['+[_0x15dd97[_0x9731('0xf')]()]+_0x9731('0x3e'),_0x1cb1d0[_0x9731('0xe')]);_0x69ab05[_0x9731('0x3f')]=_0x1cb1d0[_0x9731('0xe')][_0x9731('0x1d')];_0x69ab05['ticketNumber']=_0x1cb1d0[_0x9731('0xe')][_0x9731('0x40')];logger[_0x9731('0x17')]('['+[_0x15dd97[_0x9731('0xf')]()]+_0x9731('0x41'),_0x69ab05);_0xd84608(_0x69ab05);})[_0x9731('0x11')](function(_0x15b9c3){logger[_0x9731('0x12')]('['+[_0x15dd97[_0x9731('0xf')]()]+']',_0x15b9c3[_0x9731('0x13')]);_0x2fab94(_0x15b9c3[_0x9731('0x13')]);});});};}function createRemoteTag(_0x25aa86,_0x52d2e1,_0xe2c02,_0x399a14){return new Promise(function(_0x2b6c2f,_0x2ebffe){var _0x163379={'method':_0x9731('0x20'),'uri':_0xe2c02+_0x9731('0x42')+'?'+_0x399a14,'body':{'short_description':_0x25aa86,'global':!![],'active':!![],'name':_0x25aa86},'auth':_0x52d2e1,'json':!![]};return rp(_0x163379)[_0x9731('0xc')](function(_0xd79e76){var _0x201f56=_0xd79e76[_0x9731('0xe')]['sys_id'];_0x2b6c2f(_0x201f56);});});}function getRemoteTag(_0x25ad43,_0x42a071,_0x2390b2,_0x9ac86a,_0x39e2ab){return new Promise(function(_0x3798f2,_0x289057){var _0xdfb10c={'method':_0x9731('0xa'),'uri':_0x2390b2+_0x9731('0x42')+_0x9731('0x43')+_0x25ad43+'&'+_0x9ac86a,'auth':_0x42a071,'json':!![]};return rp(_0xdfb10c)[_0x9731('0xc')](function(_0x580e2a){if(_0x580e2a[_0x9731('0xe')][_0x9731('0x1a')]>0x0){var _0x2144f5=_0x580e2a[_0x9731('0xe')][0x0]['sys_id'];_0x3798f2(_0x2144f5);}else{return createRemoteTag(_0x25ad43,_0x42a071,_0x2390b2,_0x9ac86a)['then'](function(_0x2eba30){_0x3798f2(_0x2eba30);});}});});}function assignTagToIncident(_0x4c413a,_0x17aac5,_0x5728e6,_0x364d81,_0x9033f4){return new Promise(function(_0x41f7bf,_0x37367b){var _0x1f27bb={'method':_0x9731('0x20'),'uri':_0x5728e6+_0x9731('0x44')+'?'+_0x9033f4,'body':{'label':_0x4c413a,'table':_0x9731('0x39'),'id_type':_0x9731('0x45'),'table_key':_0x364d81[_0x9731('0x3f')],'title':'Incident\x20-\x20'+_0x364d81[_0x9731('0x46')],'id_display':_0x364d81[_0x9731('0x46')]},'auth':_0x17aac5,'json':!![]};return rp(_0x1f27bb)[_0x9731('0xc')](function(_0x8909af){_0x41f7bf();})['catch'](function(){_0x41f7bf();});});}function manageTags(_0x46927f,_0x97a65e,_0x9f807b,_0x5f1f2a,_0x441aff,_0x49f636,_0x39121b){return new Promise(function(_0x5636c4,_0x161a18){var _0x57109d=[];_0x97a65e[_0x9731('0x47')](function(_0x25dade){_0x57109d[_0x9731('0x48')](getRemoteTag(_0x25dade,_0x9f807b,_0x5f1f2a,_0x49f636,_0x39121b));});return Promise[_0x9731('0x49')](_0x57109d)['then'](function(_0x277604){if(_0x277604[_0x9731('0x1a')]){logger[_0x9731('0x17')]('['+[_0x46927f[_0x9731('0xf')]()]+_0x9731('0x4a'),_0x277604);var _0x51ae91=[];_0x277604[_0x9731('0x47')](function(_0x4d6403){_0x51ae91[_0x9731('0x48')](assignTagToIncident(_0x4d6403,_0x9f807b,_0x5f1f2a,_0x441aff,_0x49f636));});return Promise[_0x9731('0x49')](_0x51ae91)[_0x9731('0xc')](function(){_0x5636c4();})['catch'](function(){_0x5636c4();});}else{_0x5636c4();}});});}function getTags(_0x4a773a,_0x5503a9,_0x3e8338,_0x2aae61,_0x569240,_0x5d7959){return function(_0x318295){return new Promise(function(_0x5c8f63,_0x52529f){var _0xa4f657=[];var _0x3612a4=_0x2aae61[_0x9731('0x4b')];if(_0x3612a4&&_0x3612a4[_0x9731('0x1a')]>0x0){_0xa4f657=_[_0x9731('0x4c')](_0x3612a4,_0x9731('0x36'));}if(_0xa4f657[_0x9731('0x1a')]>0x0){return manageTags(_0x4a773a,_0xa4f657,_0x5503a9,_0x3e8338,_0x318295,_0x569240,_0x5d7959)[_0x9731('0xc')](function(){_0x5c8f63(_0x318295);});}else{_0x5c8f63(_0x318295);}});};}function emit(_0x2aca8b,_0x587b03,_0x33e883){var _0x537dc9=_0x9731('0x4d')+_0x9731('0x4e')+_0x9731('0x4f')+_0x9731('0x50');var _0x1713a5={'uri':_0x2aca8b+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x33e883+_0x537dc9};io['to'](util[_0x9731('0x51')](_0x9731('0x52'),_0x587b03))[_0x9731('0x53')](_0x9731('0x54'),_0x1713a5);}exports['cs']=function(_0x14ffeb,_0x2401f9,_0x4811dd,_0x14db43,_0x2a8730,_0x3197f4,_0x28d82f,_0x41246b){var _0x1aa387={};var _0x18b18a={'user':_0x3197f4[_0x9731('0x55')],'pass':_0x3197f4[_0x9731('0x56')]};var _0x564e0f=_0x9731('0x57');var _0x4af01b=_0x9731('0x58');_0x3197f4[_0x9731('0x59')]=intUtil['stripTrailingSlash'](_0x3197f4[_0x9731('0x59')]);_0x3197f4[_0x9731('0x5a')]=intUtil[_0x9731('0x5b')](_0x3197f4[_0x9731('0x5a')]);var _0x32d29b=util[_0x9731('0x51')]('%s/api/now/table/',_0x3197f4[_0x9731('0x59')]);_0x1aa387[_0x9731('0x16')]=!_[_0x9731('0x5c')](_0x14db43)?_0x14db43[_0x9731('0x5d')]:null;_0x1aa387[_0x9731('0x1e')]=_0x3197f4[_0x9731('0x5d')];_0x1aa387[_0x9731('0x21')]=_0x41246b[_0x9731('0x2c')]()===_0x9731('0x38')?_0x2401f9[_0x9731('0x5e')]:_0x2401f9[_0x9731('0x5f')];_0x1aa387[_0x9731('0x60')]=_0x41246b===_0x9731('0x61')||_0x41246b===_0x9731('0x62')?'queue':_0x9731('0x38');var _0x3b5571=util[_0x9731('0x51')](_0x9731('0x63'),_0x3197f4[_0x9731('0x5a')],_0x2401f9[_0x9731('0x64')],md5(_0x2401f9[_0x9731('0x64')]));if(_0x2a8730&&_0x2a8730['monitor_format']){logger['info']('[QUEUE]',_0x9731('0x65'));_0x2401f9[_0x9731('0x66')]=_0x3b5571;}else if(_0x28d82f&&_0x28d82f[_0x9731('0x67')]&&_0x28d82f['recordingFormat']!==_0x9731('0x68')){logger[_0x9731('0x17')](_0x9731('0x69'),'Recording\x20is\x20enabled!');_0x2401f9[_0x9731('0x66')]=_0x3b5571;}else{_0x2401f9['recordingURL']='';}return getAdminUser(_0x41246b,_0x18b18a,_0x1aa387,_0x32d29b,_0x4af01b,_0x564e0f)[_0x9731('0xc')](getUser(_0x41246b,_0x18b18a,_0x32d29b,_0x4af01b,_0x564e0f))['then'](getEndUser(_0x41246b,_0x18b18a,_0x32d29b,_0x4af01b,_0x564e0f))[_0x9731('0xc')](getTicket(_0x41246b,_0x18b18a,_0x32d29b,_0x4811dd,_0x2401f9,_0x4af01b))[_0x9731('0xc')](function(_0x30117f){logger[_0x9731('0x17')](util[_0x9731('0x51')](_0x9731('0x6a'),_0x30117f['ticketId']));logger[_0x9731('0x17')](util[_0x9731('0x51')]('call\x20direction:\x20%s',_0x41246b));if(_0x41246b!==_0x9731('0x62')){logger[_0x9731('0x17')]('['+[_0x41246b[_0x9731('0xf')]()]+']',_0x9731('0x6b'));emit(_0x3197f4[_0x9731('0x59')],_0x14db43[_0x9731('0x36')],_0x30117f[_0x9731('0x3f')]);}})['catch'](function(_0x59f87c){logger[_0x9731('0x12')]('['+[_0x41246b[_0x9731('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x59f87c,{'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 4ede726..b63cef8 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 _0xc856=['user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','forEach','type','string','nameField','customField','idField','content','variable','custom_fields','Variable','toLowerCase','login','username','password','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','version','unmanaged','lastevent','calleridname','The\x20Ticket\x20ID\x20is:','catch','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','slice','replace','duration_hours','parent_id','Contacts','parent_name','length','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200'];(function(_0x52f2c1,_0x36459f){var _0x5d33c1=function(_0x56cc0a){while(--_0x56cc0a){_0x52f2c1['push'](_0x52f2c1['shift']());}};_0x5d33c1(++_0x36459f);}(_0xc856,0x13c));var _0x6c85=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xc856[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require('lodash');var rp=require(_0x6c85('0x0'));var BPromise=require(_0x6c85('0x1'));var md5=require(_0x6c85('0x2'));var util=require(_0x6c85('0x3'));var Redis=require(_0x6c85('0x4'));var intUtil=require(_0x6c85('0x5'));var config=require(_0x6c85('0x6'));var logger=require(_0x6c85('0x7'))(_0x6c85('0x8'));config[_0x6c85('0x9')]=_[_0x6c85('0xa')](config['redis'],{'host':_0x6c85('0xb'),'port':0x18eb});var io=require(_0x6c85('0xc'))(new Redis(config[_0x6c85('0x9')]));var def={'method':_0x6c85('0xd'),'json':!![]};function emit(_0x117b5f,_0x51663f,_0x43bcff){io['to'](_0x117b5f)[_0x6c85('0xe')](_0x51663f,_0x43bcff);}function getTicket(_0x2242b7,_0x15e384,_0x561010,_0x8b77b7,_0x57340a,_0x291cd9,_0x1deca3,_0x2b5a61){logger[_0x6c85('0xf')](_0x6c85('0x10'));var _0x82e2e8=new Date();var _0x58380e=[{'name':_0x6c85('0x11'),'value':intUtil[_0x6c85('0x12')](_0x8b77b7[_0x6c85('0x13')],_0x57340a,'\x20')},{'name':_0x6c85('0x14'),'value':_0x15e384['id']},{'name':_0x6c85('0x15'),'value':_0x15e384['id']},{'name':_0x6c85('0x16'),'value':intUtil[_0x6c85('0x12')](_0x8b77b7['Descriptions'],_0x57340a,'\x0a')},{'name':_0x6c85('0x17'),'value':_0x82e2e8['toISOString']()[_0x6c85('0x18')](0x0,0x13)[_0x6c85('0x19')]('T','\x20')},{'name':_0x6c85('0x1a'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x6c85('0x1b'),'value':_0x561010['id']},{'name':'parent_type','value':_0x6c85('0x1c')},{'name':_0x6c85('0x1d'),'value':_0x561010[_0x6c85('0x11')]},{'name':'direction','value':_0x2b5a61}];if(_0x291cd9[_0x6c85('0x1e')]){_['forEach'](_0x291cd9,function(_0x4a4303){if(_0x57340a[_0x4a4303[_0x6c85('0x1f')]]){_0x58380e[_0x6c85('0x20')]({'name':_0x4a4303['idField'],'value':_0x57340a[_0x4a4303[_0x6c85('0x1f')]]});}});}return request({'form':{'method':_0x6c85('0x21'),'input_type':'JSON','response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x1deca3['id'],'module_name':'Calls','name_value_list':_0x58380e})}});}function getAuth(_0x1cd682){return util[_0x6c85('0x24')](_0x6c85('0x25'),new Buffer(_0x1cd682[_0x6c85('0x26')]+':X')[_0x6c85('0x27')]('base64'));}function getServerInfo(_0x5247d2){return request({'form':{'method':_0x6c85('0x28'),'input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x5247d2['id']})}});}function getUser(_0x4fa86a,_0x54ad11,_0x22eca6){if(!_[_0x6c85('0x29')](_0x54ad11)){logger[_0x6c85('0xf')]('Getting\x20agent\x20with\x20name',_0x54ad11);return request({'form':{'method':'get_entry_list','input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON['stringify']({'session':_0x22eca6['id'],'module_name':_0x6c85('0x2a'),'query':util['format'](_0x6c85('0x2b'),_0x54ad11),'order_by':'','offset':'0','select_fields':['id',_0x6c85('0x11'),_0x6c85('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6c85('0x2d')](function(_0x4212d9){if(_0x4212d9[_0x6c85('0x2e')][_0x6c85('0x1e')]){var _0x18d8e5=_[_0x6c85('0x2f')](_0x4212d9[_0x6c85('0x2e')],function(_0x310dc1){return _0x310dc1[_0x6c85('0x30')][_0x6c85('0x2c')][_0x6c85('0x31')]===_0x54ad11;});if(_0x18d8e5){logger[_0x6c85('0xf')]('Agent\x20found!');return BPromise[_0x6c85('0x32')]({'id':_0x18d8e5[_0x6c85('0x30')]['id'][_0x6c85('0x31')],'name':_0x18d8e5[_0x6c85('0x30')][_0x6c85('0x11')]['value']});}}logger[_0x6c85('0xf')](_0x6c85('0x33'));return BPromise[_0x6c85('0x32')]({'id':_0x22eca6['name_value_list'][_0x6c85('0x34')]['value'],'name':_0x22eca6[_0x6c85('0x30')]['user_name'][_0x6c85('0x31')]});});}else{logger[_0x6c85('0xf')](_0x6c85('0x35'));return BPromise[_0x6c85('0x32')]({'id':_0x22eca6[_0x6c85('0x30')][_0x6c85('0x34')][_0x6c85('0x31')],'name':_0x22eca6['name_value_list'][_0x6c85('0x2c')][_0x6c85('0x31')]});}}function getEndUser(_0x51dd74,_0x1f15c7,_0x3cc1da,_0x20e72f){logger[_0x6c85('0xf')](_0x6c85('0x36'),_0x3cc1da);return request({'form':{'method':_0x6c85('0x37'),'input_type':'JSON','response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x20e72f['id'],'module_name':_0x6c85('0x1c'),'query':util[_0x6c85('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3cc1da),'order_by':'','offset':'0','select_fields':['id',_0x6c85('0x11'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x41f479){if(_0x41f479[_0x6c85('0x2e')][_0x6c85('0x1e')]){var _0x590378=_[_0x6c85('0x2f')](_0x41f479[_0x6c85('0x2e')],function(_0x536baa){return _0x536baa[_0x6c85('0x30')][_0x6c85('0x38')][_0x6c85('0x31')]===_0x3cc1da;});if(_0x590378){logger[_0x6c85('0xf')](_0x6c85('0x39'));return BPromise[_0x6c85('0x32')]({'id':_0x590378[_0x6c85('0x30')]['id']['value'],'name':_0x590378[_0x6c85('0x30')][_0x6c85('0x11')][_0x6c85('0x31')],'phone':_0x590378[_0x6c85('0x30')][_0x6c85('0x38')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x6c85('0x21'),'input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x20e72f['id'],'module_name':_0x6c85('0x1c'),'name_value_list':[{'name':_0x6c85('0x3a'),'value':_0x1f15c7!==_0x6c85('0x3b')?_0x1f15c7:util[_0x6c85('0x24')](_0x6c85('0x3c'),_0x3cc1da)},{'name':_0x6c85('0x38'),'value':_0x3cc1da}]})}})['then'](function(_0x4ac33e){logger['info'](_0x6c85('0x3d'));return BPromise[_0x6c85('0x32')]({'id':_0x4ac33e['id'],'name':_0x4ac33e[_0x6c85('0x2e')][_0x6c85('0x3a')][_0x6c85('0x31')],'phone':_0x4ac33e['entry_list'][_0x6c85('0x38')]['value']});});}});}function request(_0x32e6ae){logger[_0x6c85('0x3e')](_0x6c85('0x3f'),JSON['stringify'](_0x32e6ae));return rp(_[_0x6c85('0x40')](def,_0x32e6ae));}function getTags(_0x184709,_0x1834b4){var _0x437bbb=[];if(_0x184709&&_0x184709['length']>0x0){_0x437bbb=_['map'](_0x184709,_0x1834b4);}return _0x437bbb;}function getCustomFields(_0x4acbdd,_0x410c58){var _0x3ca430=[];var _0x4aa029={'custom_fields':[]};if(_0x4acbdd[_0x6c85('0x1e')]>0x0){_[_0x6c85('0x41')](_0x4acbdd,function(_0x3f7b77){if(_0x3f7b77[_0x6c85('0x42')]===_0x6c85('0x43')&&_0x3f7b77[_0x6c85('0x44')]&&!_0x3f7b77[_0x6c85('0x45')]){_0x4aa029[_0x3f7b77[_0x6c85('0x44')]['toLowerCase']()]=_0x3f7b77['content'][_0x6c85('0x27')]();}else if(_0x3f7b77[_0x6c85('0x42')]===_0x6c85('0x43')&&_0x3f7b77[_0x6c85('0x46')]&&_0x3f7b77['customField']){_0x4aa029['custom_fields'][_0x6c85('0x20')]({'id':_0x3f7b77['idField'],'value':_0x3f7b77[_0x6c85('0x47')][_0x6c85('0x27')]()});}else if(_0x3f7b77[_0x6c85('0x42')]===_0x6c85('0x48')&&_0x3f7b77[_0x6c85('0x1f')]&&_0x3f7b77[_0x6c85('0x46')]&&_0x3f7b77['customField']){_0x410c58[_0x3f7b77[_0x6c85('0x1f')]]&&_0x4aa029[_0x6c85('0x49')][_0x6c85('0x20')]({'id':_0x3f7b77[_0x6c85('0x46')],'value':_0x410c58[_0x3f7b77[_0x6c85('0x1f')]][_0x6c85('0x27')]()});}else if(_0x3f7b77[_0x6c85('0x42')]==='customVariable'&&_0x3f7b77[_0x6c85('0x4a')]&&_0x3f7b77[_0x6c85('0x4a')][_0x6c85('0x11')]&&_0x3f7b77['idField']&&_0x3f7b77['customField']){_0x410c58[_0x3f7b77[_0x6c85('0x4a')][_0x6c85('0x11')]['toLowerCase']()]&&_0x4aa029['custom_fields'][_0x6c85('0x20')]({'id':_0x3f7b77['idField'],'value':_0x410c58[_0x3f7b77[_0x6c85('0x4a')][_0x6c85('0x11')][_0x6c85('0x4b')]()][_0x6c85('0x27')]()});}});}return _0x4aa029;}function getConnection(_0x4dacc6){return request({'method':_0x6c85('0xd'),'form':{'method':_0x6c85('0x4c'),'input_type':'JSON','response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'user_auth':{'user_name':_0x4dacc6[_0x6c85('0x4d')],'password':_0x4dacc6[_0x6c85('0x4e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x6c85('0x2d')](function(_0x39d378){var _0x4b2838=_0x39d378;if(_0x4b2838['id']){def['sessionID']=_0x4b2838['id'];return BPromise['resolve'](_0x4b2838);}else{throw new Error(util[_0x6c85('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x4dacc6['id']));}});}function setRelationship(_0xcbbdfe,_0x15dd59,_0x36cab5,_0x262d35){return request({'form':{'method':_0x6c85('0x4f'),'input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0xcbbdfe['id'],'module_name':_0x6c85('0x50'),'module_id':_0x36cab5['id'],'link_field_name':_0x262d35,'related_ids':[_0x15dd59['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6c85('0x51')]=function(_0x1323b0,_0x563aee,_0x4cd2ff,_0x413402,_0x3fcb4b,_0x482468){var _0xb378fa,_0x3b1f2d,_0x34352e,_0x13e6cf;_0x482468['remoteUri']=intUtil[_0x6c85('0x52')](_0x482468[_0x6c85('0x53')]);_0x482468[_0x6c85('0x54')]=intUtil['stripTrailingSlash'](_0x482468[_0x6c85('0x54')]);def[_0x6c85('0x55')]=util[_0x6c85('0x24')](_0x6c85('0x56'),_0x482468['remoteUri']);if(_0x3fcb4b&&_0x3fcb4b[_0x6c85('0x57')]){logger['info'](_0x6c85('0x58'),_0x6c85('0x59'));_0x563aee[_0x6c85('0x5a')]=util[_0x6c85('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x482468[_0x6c85('0x54')],_0x563aee[_0x6c85('0x5b')],md5(_0x563aee[_0x6c85('0x5b')]));}else{_0x563aee['recordingURL']='';}return getConnection(_0x482468)['then'](function(_0x452244){_0x13e6cf=_0x452244;return getUser(_0x482468,_0x413402[_0x6c85('0x11')],_0x13e6cf);})[_0x6c85('0x2d')](function(_0x402ca5){_0xb378fa=_0x402ca5;logger[_0x6c85('0xf')](_0x6c85('0x5c'),_0xb378fa['id']);return getEndUser(_0x482468,_0x563aee['calleridname'],_0x563aee[_0x6c85('0x5d')],_0x13e6cf);})[_0x6c85('0x2d')](function(_0x5735ea){_0x3b1f2d=_0x5735ea;logger['info'](_0x6c85('0x5e'),_0x3b1f2d['id']);return getTicket(_0x482468,_0xb378fa,_0x3b1f2d,_0x4cd2ff,_0x563aee,_0x4cd2ff[_0x6c85('0x5f')],_0x13e6cf,'Inbound');})['then'](function(_0x57403f){_0x34352e=_0x57403f;logger[_0x6c85('0xf')](_0x6c85('0x60'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x34352e['id']);return setRelationship(_0x13e6cf,_0xb378fa,_0x34352e,_0x6c85('0x61'));})[_0x6c85('0x2d')](function(){return setRelationship(_0x13e6cf,_0x3b1f2d,_0x34352e,_0x6c85('0x62'));})['then'](function(){return getServerInfo(_0x13e6cf);})[_0x6c85('0x2d')](function(_0xfd04bb){var _0x40fb05=parseInt(_0xfd04bb['version'][_0x6c85('0x63')](0x0));var _0x522ee4=util['format'](_0x6c85('0x64'),_0x482468[_0x6c85('0x53')],_0x34352e['id']);if(_0x40fb05>0x6){_0x522ee4=util['format'](_0x6c85('0x65'),_0x482468[_0x6c85('0x53')],_0x34352e['id']);}logger[_0x6c85('0xf')](_0x6c85('0x58'),_0x6c85('0x66'));emit(util[_0x6c85('0x24')](_0x6c85('0x67'),_0x413402[_0x6c85('0x11')]),_0x6c85('0x68'),{'uri':_0x522ee4});})['catch'](function(_0x91ab11){logger[_0x6c85('0x69')](_0x6c85('0x58'),JSON[_0x6c85('0x23')](_0x91ab11));});};exports[_0x6c85('0x6a')]=function(_0x2b3c87,_0x3712dc,_0x495761,_0x30defe,_0x1f3d26,_0x465c43,_0x50ff7c){var _0x54e23a,_0x1e1c19,_0x2434bc,_0x59b071;_0x465c43[_0x6c85('0x53')]=intUtil['stripTrailingSlash'](_0x465c43[_0x6c85('0x53')]);_0x465c43[_0x6c85('0x54')]=intUtil['stripTrailingSlash'](_0x465c43['serverUrl']);def[_0x6c85('0x55')]=util['format'](_0x6c85('0x56'),_0x465c43[_0x6c85('0x53')]);if(_0x50ff7c&&_0x50ff7c[_0x6c85('0x6b')]&&_0x50ff7c['recordingFormat']!==_0x6c85('0x6c')){logger[_0x6c85('0xf')](_0x6c85('0x6d'),_0x6c85('0x59'));_0x3712dc[_0x6c85('0x5a')]=util[_0x6c85('0x24')](_0x6c85('0x6e'),_0x465c43['serverUrl'],_0x3712dc['uniqueid'],md5(_0x3712dc['uniqueid']));}return getConnection(_0x465c43)['then'](function(_0x4b7db5){_0x59b071=_0x4b7db5;return getUser(_0x465c43,_0x30defe['name'],_0x59b071);})['then'](function(_0x3b2929){_0x54e23a=_0x3b2929;logger[_0x6c85('0xf')](_0x6c85('0x5c'),_0x54e23a['id']);return getEndUser(_0x465c43,_0x3712dc[_0x6c85('0x6f')],_0x3712dc[_0x6c85('0x70')],_0x59b071);})['then'](function(_0x11dd2e){_0x1e1c19=_0x11dd2e;logger['info'](_0x6c85('0x5e'),_0x1e1c19['id']);return getTicket(_0x465c43,_0x54e23a,_0x1e1c19,_0x495761,_0x3712dc,_0x495761[_0x6c85('0x5f')],_0x59b071,'Outbound');})['then'](function(_0x132421){_0x2434bc=_0x132421;logger[_0x6c85('0xf')]('Ticket\x20created!');logger[_0x6c85('0xf')]('The\x20Ticket\x20ID\x20is:',_0x2434bc['id']);return setRelationship(_0x59b071,_0x54e23a,_0x2434bc,'users');})[_0x6c85('0x2d')](function(){return setRelationship(_0x59b071,_0x1e1c19,_0x2434bc,_0x6c85('0x62'));})[_0x6c85('0x2d')](function(){return getServerInfo(_0x59b071);})[_0x6c85('0x2d')](function(_0x1fe793){var _0x485ff5=parseInt(_0x1fe793[_0x6c85('0x71')]['charAt'](0x0));var _0x2e49ec=util['format'](_0x6c85('0x64'),_0x465c43[_0x6c85('0x53')],_0x2434bc['id']);if(_0x485ff5>0x6){_0x2e49ec=util[_0x6c85('0x24')](_0x6c85('0x65'),_0x465c43[_0x6c85('0x53')],_0x2434bc['id']);}logger[_0x6c85('0xf')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6c85('0x24')](_0x6c85('0x67'),_0x30defe[_0x6c85('0x11')]),_0x6c85('0x68'),{'uri':_0x2e49ec});})['catch'](function(_0x4036b4){logger[_0x6c85('0x69')](_0x6c85('0x6d'),JSON['stringify'](_0x4036b4));});};exports[_0x6c85('0x72')]=function(_0x96015f,_0x50ba8e,_0x1cfcd4,_0x1c9560,_0x3acac4,_0x30f7fa){var _0x122ee0,_0x1642da,_0x1b447e,_0x578a1e;_0x30f7fa[_0x6c85('0x53')]=intUtil[_0x6c85('0x52')](_0x30f7fa[_0x6c85('0x53')]);_0x30f7fa[_0x6c85('0x54')]=intUtil[_0x6c85('0x52')](_0x30f7fa[_0x6c85('0x54')]);def[_0x6c85('0x55')]=util[_0x6c85('0x24')]('%s/service/v4_1/rest.php',_0x30f7fa[_0x6c85('0x53')]);if(_0x3acac4&&_0x3acac4['monitor_format']){logger['info']('['+_0x50ba8e[_0x6c85('0x73')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x50ba8e[_0x6c85('0x5a')]=util[_0x6c85('0x24')](_0x6c85('0x6e'),_0x30f7fa[_0x6c85('0x54')],_0x50ba8e[_0x6c85('0x5b')],md5(_0x50ba8e[_0x6c85('0x5b')]));}else{_0x50ba8e[_0x6c85('0x5a')]='';}return getConnection(_0x30f7fa)['then'](function(_0x186bf9){_0x578a1e=_0x186bf9;if(!_[_0x6c85('0x29')](_0x1c9560)){return getUser(_0x30f7fa,_0x1c9560['name'],_0x578a1e);}else{return getUser(_0x30f7fa,null,_0x578a1e);}})['then'](function(_0x5834a2){_0x122ee0=_0x5834a2;logger['info'](_0x6c85('0x5c'),_0x122ee0['id']);return getEndUser(_0x30f7fa,_0x50ba8e[_0x6c85('0x74')],_0x50ba8e[_0x6c85('0x5d')],_0x578a1e);})['then'](function(_0xcf46bb){_0x1642da=_0xcf46bb;logger['info'](_0x6c85('0x5e'),_0x1642da['id']);return getTicket(_0x30f7fa,_0x122ee0,_0x1642da,_0x1cfcd4,_0x50ba8e,_0x1cfcd4['Fields'],_0x578a1e,'Inbound');})[_0x6c85('0x2d')](function(_0x58354f){_0x1b447e=_0x58354f;logger[_0x6c85('0xf')](_0x6c85('0x60'));logger[_0x6c85('0xf')](_0x6c85('0x75'),_0x1b447e['id']);return setRelationship(_0x578a1e,_0x122ee0,_0x1b447e,_0x6c85('0x61'));})[_0x6c85('0x2d')](function(){return setRelationship(_0x578a1e,_0x1642da,_0x1b447e,_0x6c85('0x62'));})[_0x6c85('0x2d')](function(){return getServerInfo(_0x578a1e);})[_0x6c85('0x76')](function(_0x4ba721){logger[_0x6c85('0x69')]('['+_0x50ba8e['lastevent'][_0x6c85('0x77')]()+']',JSON[_0x6c85('0x23')](_0x4ba721));});}; \ No newline at end of file +var _0xf5c1=['Descriptions','date_start','toISOString','duration_hours','parent_type','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','name_value_list','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','nameField','customField','content','string','custom_fields','customVariable','Variable','toLowerCase','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','stripTrailingSlash','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','contacts','user:%s','lastevent','toUpperCase','isNil','lodash','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','created_by','description'];(function(_0x48e6ae,_0x2e7632){var _0x2bb8dd=function(_0x21c257){while(--_0x21c257){_0x48e6ae['push'](_0x48e6ae['shift']());}};_0x2bb8dd(++_0x2e7632);}(_0xf5c1,0xd0));var _0x1f5c=function(_0x822a3f,_0x32fd83){_0x822a3f=_0x822a3f-0x0;var _0x1053e7=_0xf5c1[_0x822a3f];return _0x1053e7;};'use strict';var _=require(_0x1f5c('0x0'));var rp=require('request-promise');var BPromise=require(_0x1f5c('0x1'));var md5=require(_0x1f5c('0x2'));var util=require('util');var Redis=require(_0x1f5c('0x3'));var intUtil=require('./util');var config=require(_0x1f5c('0x4'));var logger=require(_0x1f5c('0x5'))(_0x1f5c('0x6'));config[_0x1f5c('0x7')]=_[_0x1f5c('0x8')](config[_0x1f5c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1f5c('0x9'))(new Redis(config['redis']));var def={'method':_0x1f5c('0xa'),'json':!![]};function emit(_0xaad025,_0x1d1d93,_0x376490){io['to'](_0xaad025)['emit'](_0x1d1d93,_0x376490);}function getTicket(_0xfa9ac,_0x2533f8,_0x327488,_0x456cb7,_0x4c7950,_0x4c827b,_0x3d9994,_0x5e167c){logger[_0x1f5c('0xb')]('Creating\x20new\x20ticket...');var _0x199525=new Date();var _0x16384c=[{'name':_0x1f5c('0xc'),'value':intUtil[_0x1f5c('0xd')](_0x456cb7[_0x1f5c('0xe')],_0x4c7950,'\x20')},{'name':_0x1f5c('0xf'),'value':_0x2533f8['id']},{'name':_0x1f5c('0x10'),'value':_0x2533f8['id']},{'name':_0x1f5c('0x11'),'value':intUtil['getString'](_0x456cb7[_0x1f5c('0x12')],_0x4c7950,'\x0a')},{'name':_0x1f5c('0x13'),'value':_0x199525[_0x1f5c('0x14')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x1f5c('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x327488['id']},{'name':_0x1f5c('0x16'),'value':'Contacts'},{'name':'parent_name','value':_0x327488[_0x1f5c('0xc')]},{'name':_0x1f5c('0x17'),'value':_0x5e167c}];if(_0x4c827b[_0x1f5c('0x18')]){_[_0x1f5c('0x19')](_0x4c827b,function(_0x11f913){if(_0x4c7950[_0x11f913[_0x1f5c('0x1a')]]){_0x16384c[_0x1f5c('0x1b')]({'name':_0x11f913[_0x1f5c('0x1c')],'value':_0x4c7950[_0x11f913[_0x1f5c('0x1a')]]});}});}return request({'form':{'method':_0x1f5c('0x1d'),'input_type':_0x1f5c('0x1e'),'response_type':'JSON','rest_data':JSON[_0x1f5c('0x1f')]({'session':_0x3d9994['id'],'module_name':_0x1f5c('0x20'),'name_value_list':_0x16384c})}});}function getAuth(_0x25e14a){return util[_0x1f5c('0x21')](_0x1f5c('0x22'),new Buffer(_0x25e14a['apiKey']+':X')[_0x1f5c('0x23')](_0x1f5c('0x24')));}function getServerInfo(_0xc0e92a){return request({'form':{'method':'get_server_info','input_type':_0x1f5c('0x1e'),'response_type':_0x1f5c('0x1e'),'rest_data':JSON[_0x1f5c('0x1f')]({'session':_0xc0e92a['id']})}});}function getUser(_0x18e621,_0x3a1e62,_0x5ea149){if(!_['isNil'](_0x3a1e62)){logger[_0x1f5c('0xb')](_0x1f5c('0x25'),_0x3a1e62);return request({'form':{'method':_0x1f5c('0x26'),'input_type':_0x1f5c('0x1e'),'response_type':_0x1f5c('0x1e'),'rest_data':JSON['stringify']({'session':_0x5ea149['id'],'module_name':_0x1f5c('0x27'),'query':util[_0x1f5c('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x3a1e62),'order_by':'','offset':'0','select_fields':['id',_0x1f5c('0xc'),_0x1f5c('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1f5c('0x29')](function(_0x3af294){if(_0x3af294[_0x1f5c('0x2a')]['length']){var _0x514e90=_[_0x1f5c('0x2b')](_0x3af294['entry_list'],function(_0xdbf0e8){return _0xdbf0e8[_0x1f5c('0x2c')][_0x1f5c('0x28')][_0x1f5c('0x2d')]===_0x3a1e62;});if(_0x514e90){logger[_0x1f5c('0xb')]('Agent\x20found!');return BPromise[_0x1f5c('0x2e')]({'id':_0x514e90[_0x1f5c('0x2c')]['id'][_0x1f5c('0x2d')],'name':_0x514e90[_0x1f5c('0x2c')]['name'][_0x1f5c('0x2d')]});}}logger[_0x1f5c('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1f5c('0x2e')]({'id':_0x5ea149['name_value_list'][_0x1f5c('0x2f')][_0x1f5c('0x2d')],'name':_0x5ea149['name_value_list'][_0x1f5c('0x28')][_0x1f5c('0x2d')]});});}else{logger['info'](_0x1f5c('0x30'));return BPromise['resolve']({'id':_0x5ea149['name_value_list'][_0x1f5c('0x2f')][_0x1f5c('0x2d')],'name':_0x5ea149[_0x1f5c('0x2c')][_0x1f5c('0x28')][_0x1f5c('0x2d')]});}}function getEndUser(_0x211cf6,_0x557580,_0x5290a8,_0x4b67e2){logger[_0x1f5c('0xb')](_0x1f5c('0x31'),_0x5290a8);return request({'form':{'method':_0x1f5c('0x26'),'input_type':'JSON','response_type':_0x1f5c('0x1e'),'rest_data':JSON['stringify']({'session':_0x4b67e2['id'],'module_name':'Contacts','query':util[_0x1f5c('0x21')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x5290a8),'order_by':'','offset':'0','select_fields':['id',_0x1f5c('0xc'),_0x1f5c('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1f5c('0x29')](function(_0x280e20){if(_0x280e20[_0x1f5c('0x2a')][_0x1f5c('0x18')]){var _0x48323b=_[_0x1f5c('0x2b')](_0x280e20['entry_list'],function(_0x431fed){return _0x431fed[_0x1f5c('0x2c')][_0x1f5c('0x32')][_0x1f5c('0x2d')]===_0x5290a8;});if(_0x48323b){logger['info'](_0x1f5c('0x33'));return BPromise[_0x1f5c('0x2e')]({'id':_0x48323b['name_value_list']['id'][_0x1f5c('0x2d')],'name':_0x48323b[_0x1f5c('0x2c')][_0x1f5c('0xc')]['value'],'phone':_0x48323b['name_value_list'][_0x1f5c('0x32')][_0x1f5c('0x2d')]});}}else{logger[_0x1f5c('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x1f5c('0x1e'),'response_type':_0x1f5c('0x1e'),'rest_data':JSON[_0x1f5c('0x1f')]({'session':_0x4b67e2['id'],'module_name':'Contacts','name_value_list':[{'name':_0x1f5c('0x34'),'value':_0x557580!==_0x1f5c('0x35')?_0x557580:util['format'](_0x1f5c('0x36'),_0x5290a8)},{'name':_0x1f5c('0x32'),'value':_0x5290a8}]})}})[_0x1f5c('0x29')](function(_0x4e4b95){logger['info'](_0x1f5c('0x37'));return BPromise[_0x1f5c('0x2e')]({'id':_0x4e4b95['id'],'name':_0x4e4b95[_0x1f5c('0x2a')][_0x1f5c('0x34')][_0x1f5c('0x2d')],'phone':_0x4e4b95['entry_list'][_0x1f5c('0x32')]['value']});});}});}function request(_0x1ae50b){logger[_0x1f5c('0x38')](_0x1f5c('0x39'),JSON[_0x1f5c('0x1f')](_0x1ae50b));return rp(_['merge'](def,_0x1ae50b));}function getTags(_0x4edc48,_0x566602){var _0x4cb093=[];if(_0x4edc48&&_0x4edc48[_0x1f5c('0x18')]>0x0){_0x4cb093=_[_0x1f5c('0x3a')](_0x4edc48,_0x566602);}return _0x4cb093;}function getCustomFields(_0x10aa00,_0x3f60d4){var _0x157577=[];var _0x7ca69d={'custom_fields':[]};if(_0x10aa00[_0x1f5c('0x18')]>0x0){_['forEach'](_0x10aa00,function(_0x1548ce){if(_0x1548ce[_0x1f5c('0x3b')]==='string'&&_0x1548ce[_0x1f5c('0x3c')]&&!_0x1548ce[_0x1f5c('0x3d')]){_0x7ca69d[_0x1548ce[_0x1f5c('0x3c')]['toLowerCase']()]=_0x1548ce[_0x1f5c('0x3e')][_0x1f5c('0x23')]();}else if(_0x1548ce[_0x1f5c('0x3b')]===_0x1f5c('0x3f')&&_0x1548ce[_0x1f5c('0x1c')]&&_0x1548ce['customField']){_0x7ca69d[_0x1f5c('0x40')]['push']({'id':_0x1548ce[_0x1f5c('0x1c')],'value':_0x1548ce[_0x1f5c('0x3e')][_0x1f5c('0x23')]()});}else if(_0x1548ce[_0x1f5c('0x3b')]==='variable'&&_0x1548ce[_0x1f5c('0x1a')]&&_0x1548ce[_0x1f5c('0x1c')]&&_0x1548ce[_0x1f5c('0x3d')]){_0x3f60d4[_0x1548ce[_0x1f5c('0x1a')]]&&_0x7ca69d[_0x1f5c('0x40')][_0x1f5c('0x1b')]({'id':_0x1548ce[_0x1f5c('0x1c')],'value':_0x3f60d4[_0x1548ce[_0x1f5c('0x1a')]][_0x1f5c('0x23')]()});}else if(_0x1548ce['type']===_0x1f5c('0x41')&&_0x1548ce['Variable']&&_0x1548ce[_0x1f5c('0x42')][_0x1f5c('0xc')]&&_0x1548ce[_0x1f5c('0x1c')]&&_0x1548ce[_0x1f5c('0x3d')]){_0x3f60d4[_0x1548ce[_0x1f5c('0x42')][_0x1f5c('0xc')][_0x1f5c('0x43')]()]&&_0x7ca69d[_0x1f5c('0x40')]['push']({'id':_0x1548ce[_0x1f5c('0x1c')],'value':_0x3f60d4[_0x1548ce[_0x1f5c('0x42')][_0x1f5c('0xc')]['toLowerCase']()]['toString']()});}});}return _0x7ca69d;}function getConnection(_0x12339a){return request({'method':'POST','form':{'method':_0x1f5c('0x44'),'input_type':_0x1f5c('0x1e'),'response_type':_0x1f5c('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x12339a[_0x1f5c('0x45')],'password':_0x12339a['password'],'encryption':_0x1f5c('0x46')},'application':_0x1f5c('0x47')})}})[_0x1f5c('0x29')](function(_0x420b45){var _0x22dca1=_0x420b45;if(_0x22dca1['id']){def[_0x1f5c('0x48')]=_0x22dca1['id'];return BPromise[_0x1f5c('0x2e')](_0x22dca1);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x12339a['id']));}});}function setRelationship(_0x4c2ee0,_0x4c7257,_0x56e535,_0x78fab8){return request({'form':{'method':'set_relationship','input_type':_0x1f5c('0x1e'),'response_type':_0x1f5c('0x1e'),'rest_data':JSON[_0x1f5c('0x1f')]({'session':_0x4c2ee0['id'],'module_name':_0x1f5c('0x20'),'module_id':_0x56e535['id'],'link_field_name':_0x78fab8,'related_ids':[_0x4c7257['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1f5c('0x49')]=function(_0x115609,_0x180e12,_0x2964fc,_0x25c918,_0x3cbf7d,_0x4966e2){var _0x2313fb,_0x183116,_0x57f889,_0x357f88;_0x4966e2['remoteUri']=intUtil[_0x1f5c('0x4a')](_0x4966e2[_0x1f5c('0x4b')]);_0x4966e2['serverUrl']=intUtil[_0x1f5c('0x4a')](_0x4966e2[_0x1f5c('0x4c')]);def[_0x1f5c('0x4d')]=util[_0x1f5c('0x21')]('%s/service/v4_1/rest.php',_0x4966e2['remoteUri']);if(_0x3cbf7d&&_0x3cbf7d[_0x1f5c('0x4e')]){logger[_0x1f5c('0xb')](_0x1f5c('0x4f'),_0x1f5c('0x50'));_0x180e12[_0x1f5c('0x51')]=util[_0x1f5c('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4966e2['serverUrl'],_0x180e12[_0x1f5c('0x52')],md5(_0x180e12[_0x1f5c('0x52')]));}else{_0x180e12[_0x1f5c('0x51')]='';}return getConnection(_0x4966e2)[_0x1f5c('0x29')](function(_0x32b376){_0x357f88=_0x32b376;return getUser(_0x4966e2,_0x25c918[_0x1f5c('0xc')],_0x357f88);})[_0x1f5c('0x29')](function(_0x3ded49){_0x2313fb=_0x3ded49;logger[_0x1f5c('0xb')](_0x1f5c('0x53'),_0x2313fb['id']);return getEndUser(_0x4966e2,_0x180e12[_0x1f5c('0x54')],_0x180e12[_0x1f5c('0x55')],_0x357f88);})['then'](function(_0x2cdd13){_0x183116=_0x2cdd13;logger[_0x1f5c('0xb')](_0x1f5c('0x56'),_0x183116['id']);return getTicket(_0x4966e2,_0x2313fb,_0x183116,_0x2964fc,_0x180e12,_0x2964fc[_0x1f5c('0x57')],_0x357f88,_0x1f5c('0x58'));})['then'](function(_0x36cd89){_0x57f889=_0x36cd89;logger[_0x1f5c('0xb')](_0x1f5c('0x59'));logger[_0x1f5c('0xb')](_0x1f5c('0x5a'),_0x57f889['id']);return setRelationship(_0x357f88,_0x2313fb,_0x57f889,_0x1f5c('0x5b'));})[_0x1f5c('0x29')](function(){return setRelationship(_0x357f88,_0x183116,_0x57f889,'contacts');})['then'](function(){return getServerInfo(_0x357f88);})[_0x1f5c('0x29')](function(_0x3f6936){var _0x4bd1eb=parseInt(_0x3f6936[_0x1f5c('0x5c')][_0x1f5c('0x5d')](0x0));var _0x254222=util[_0x1f5c('0x21')](_0x1f5c('0x5e'),_0x4966e2[_0x1f5c('0x4b')],_0x57f889['id']);if(_0x4bd1eb>0x6){_0x254222=util[_0x1f5c('0x21')](_0x1f5c('0x5f'),_0x4966e2['remoteUri'],_0x57f889['id']);}logger[_0x1f5c('0xb')](_0x1f5c('0x4f'),_0x1f5c('0x60'));emit(util[_0x1f5c('0x21')]('user:%s',_0x25c918[_0x1f5c('0xc')]),_0x1f5c('0x61'),{'uri':_0x254222});})[_0x1f5c('0x62')](function(_0x177b06){logger[_0x1f5c('0x63')](_0x1f5c('0x4f'),JSON[_0x1f5c('0x1f')](_0x177b06));});};exports[_0x1f5c('0x64')]=function(_0x28be78,_0x40a148,_0xf64477,_0x1d39f2,_0x241c86,_0x12dd92,_0x5548d4){var _0x309d92,_0x3315ee,_0x694a53,_0x445bec;_0x12dd92[_0x1f5c('0x4b')]=intUtil['stripTrailingSlash'](_0x12dd92['remoteUri']);_0x12dd92['serverUrl']=intUtil[_0x1f5c('0x4a')](_0x12dd92[_0x1f5c('0x4c')]);def[_0x1f5c('0x4d')]=util['format'](_0x1f5c('0x65'),_0x12dd92[_0x1f5c('0x4b')]);if(_0x5548d4&&_0x5548d4[_0x1f5c('0x66')]&&_0x5548d4['recordingFormat']!=='none'){logger[_0x1f5c('0xb')](_0x1f5c('0x67'),_0x1f5c('0x50'));_0x40a148[_0x1f5c('0x51')]=util[_0x1f5c('0x21')](_0x1f5c('0x68'),_0x12dd92[_0x1f5c('0x4c')],_0x40a148[_0x1f5c('0x52')],md5(_0x40a148[_0x1f5c('0x52')]));}return getConnection(_0x12dd92)[_0x1f5c('0x29')](function(_0x3d6b94){_0x445bec=_0x3d6b94;return getUser(_0x12dd92,_0x1d39f2[_0x1f5c('0xc')],_0x445bec);})[_0x1f5c('0x29')](function(_0x111d00){_0x309d92=_0x111d00;logger[_0x1f5c('0xb')]('The\x20User\x20ID\x20is:',_0x309d92['id']);return getEndUser(_0x12dd92,_0x40a148[_0x1f5c('0x69')],_0x40a148[_0x1f5c('0x6a')],_0x445bec);})['then'](function(_0x418cc6){_0x3315ee=_0x418cc6;logger[_0x1f5c('0xb')](_0x1f5c('0x56'),_0x3315ee['id']);return getTicket(_0x12dd92,_0x309d92,_0x3315ee,_0xf64477,_0x40a148,_0xf64477[_0x1f5c('0x57')],_0x445bec,_0x1f5c('0x6b'));})[_0x1f5c('0x29')](function(_0x2b921d){_0x694a53=_0x2b921d;logger['info'](_0x1f5c('0x59'));logger[_0x1f5c('0xb')](_0x1f5c('0x5a'),_0x694a53['id']);return setRelationship(_0x445bec,_0x309d92,_0x694a53,'users');})['then'](function(){return setRelationship(_0x445bec,_0x3315ee,_0x694a53,_0x1f5c('0x6c'));})[_0x1f5c('0x29')](function(){return getServerInfo(_0x445bec);})[_0x1f5c('0x29')](function(_0x4a0f85){var _0xa77b5=parseInt(_0x4a0f85[_0x1f5c('0x5c')][_0x1f5c('0x5d')](0x0));var _0x23a038=util['format'](_0x1f5c('0x5e'),_0x12dd92['remoteUri'],_0x694a53['id']);if(_0xa77b5>0x6){_0x23a038=util['format'](_0x1f5c('0x5f'),_0x12dd92['remoteUri'],_0x694a53['id']);}logger[_0x1f5c('0xb')](_0x1f5c('0x67'),_0x1f5c('0x60'));emit(util[_0x1f5c('0x21')](_0x1f5c('0x6d'),_0x1d39f2['name']),_0x1f5c('0x61'),{'uri':_0x23a038});})['catch'](function(_0xa928da){logger[_0x1f5c('0x63')](_0x1f5c('0x67'),JSON['stringify'](_0xa928da));});};exports['unmanaged']=function(_0x513175,_0x254d21,_0x33a5d4,_0x227f38,_0x37537b,_0x98845e){var _0x26029c,_0x52a12e,_0x435626,_0x53740b;_0x98845e[_0x1f5c('0x4b')]=intUtil['stripTrailingSlash'](_0x98845e[_0x1f5c('0x4b')]);_0x98845e['serverUrl']=intUtil[_0x1f5c('0x4a')](_0x98845e['serverUrl']);def[_0x1f5c('0x4d')]=util[_0x1f5c('0x21')](_0x1f5c('0x65'),_0x98845e[_0x1f5c('0x4b')]);if(_0x37537b&&_0x37537b[_0x1f5c('0x4e')]){logger['info']('['+_0x254d21[_0x1f5c('0x6e')][_0x1f5c('0x6f')]()+']','Recording\x20is\x20enabled!');_0x254d21['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x98845e[_0x1f5c('0x4c')],_0x254d21[_0x1f5c('0x52')],md5(_0x254d21[_0x1f5c('0x52')]));}else{_0x254d21[_0x1f5c('0x51')]='';}return getConnection(_0x98845e)['then'](function(_0x213ab1){_0x53740b=_0x213ab1;if(!_[_0x1f5c('0x70')](_0x227f38)){return getUser(_0x98845e,_0x227f38[_0x1f5c('0xc')],_0x53740b);}else{return getUser(_0x98845e,null,_0x53740b);}})[_0x1f5c('0x29')](function(_0x2a5ebd){_0x26029c=_0x2a5ebd;logger[_0x1f5c('0xb')]('The\x20User\x20ID\x20is:',_0x26029c['id']);return getEndUser(_0x98845e,_0x254d21[_0x1f5c('0x54')],_0x254d21['calleridnum'],_0x53740b);})[_0x1f5c('0x29')](function(_0x5714db){_0x52a12e=_0x5714db;logger[_0x1f5c('0xb')](_0x1f5c('0x56'),_0x52a12e['id']);return getTicket(_0x98845e,_0x26029c,_0x52a12e,_0x33a5d4,_0x254d21,_0x33a5d4['Fields'],_0x53740b,_0x1f5c('0x58'));})[_0x1f5c('0x29')](function(_0x3f4767){_0x435626=_0x3f4767;logger[_0x1f5c('0xb')](_0x1f5c('0x59'));logger[_0x1f5c('0xb')]('The\x20Ticket\x20ID\x20is:',_0x435626['id']);return setRelationship(_0x53740b,_0x26029c,_0x435626,_0x1f5c('0x5b'));})[_0x1f5c('0x29')](function(){return setRelationship(_0x53740b,_0x52a12e,_0x435626,'contacts');})['then'](function(){return getServerInfo(_0x53740b);})['catch'](function(_0x5c8ed7){logger['error']('['+_0x254d21[_0x1f5c('0x6e')][_0x1f5c('0x6f')]()+']',JSON[_0x1f5c('0x1f')](_0x5c8ed7));});}; \ 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 7ee9ae9..add969a 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 _0x0176=['%s:\x20%s','join','slice','lastIndexOf','validateEmail','lodash','util','length','sortBy','push','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','string','key','format','keyContent','keyType'];(function(_0x32f08e,_0x53860c){var _0x1300e5=function(_0x314c51){while(--_0x314c51){_0x32f08e['push'](_0x32f08e['shift']());}};_0x1300e5(++_0x53860c);}(_0x0176,0xdd));var _0x6017=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0176[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6017('0x0'));var util=require(_0x6017('0x1'));exports['getString']=function(_0x3de91a,_0x5185ff,_0x173a36){var _0x163f29=[];if(_0x3de91a[_0x6017('0x2')]>0x0){var _0x293fb7=_[_0x6017('0x3')](_0x3de91a,['id']);for(var _0x4fe62b=0x0;_0x4fe62b<_0x293fb7[_0x6017('0x2')];_0x4fe62b++){var _0x5a7fb9=_0x293fb7[_0x4fe62b];if(_0x5a7fb9['type']==='string'){_0x163f29[_0x6017('0x4')](_0x5a7fb9['content']);}else if(_0x5a7fb9[_0x6017('0x5')]===_0x6017('0x6')&&_0x5a7fb9['variableName']){_0x5185ff[_0x5a7fb9[_0x6017('0x7')]]&&_0x163f29[_0x6017('0x4')](_0x5185ff[_0x5a7fb9[_0x6017('0x7')]]['toString']());}else if(_0x5a7fb9[_0x6017('0x5')]===_0x6017('0x8')&&_0x5a7fb9[_0x6017('0x9')]&&_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]){_0x5185ff[_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')][_0x6017('0xb')]()]&&_0x163f29['push'](_0x5185ff[_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]['toLowerCase']()][_0x6017('0xc')]());}else if(_0x5a7fb9[_0x6017('0x5')]===_0x6017('0xd')){if(_0x5a7fb9['keyType']===_0x6017('0xe')&&_0x5a7fb9[_0x6017('0xf')]){_0x163f29['push'](util[_0x6017('0x10')]('%s:\x20%s',_0x5a7fb9['key'],_0x5a7fb9[_0x6017('0x11')]));}else if(_0x5a7fb9[_0x6017('0x12')]===_0x6017('0x6')&&_0x5a7fb9['variableName']&&_0x5a7fb9[_0x6017('0xf')]){_0x5185ff[_0x5a7fb9[_0x6017('0x7')]]&&_0x163f29[_0x6017('0x4')](util['format'](_0x6017('0x13'),_0x5a7fb9[_0x6017('0xf')],_0x5185ff[_0x5a7fb9['variableName']]));}else if(_0x5a7fb9[_0x6017('0x12')]==='customVariable'&&_0x5a7fb9[_0x6017('0x9')]&&_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]&&_0x5a7fb9['key']){_0x5185ff[_0x5a7fb9['Variable']['name'][_0x6017('0xb')]()]&&_0x163f29[_0x6017('0x4')](util[_0x6017('0x10')](_0x6017('0x13'),_0x5a7fb9[_0x6017('0xf')],_0x5185ff[_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]['toLowerCase']()]));}}}}return _0x163f29[_0x6017('0x14')](_0x173a36);};exports['stripTrailingSlash']=function(_0x455465){var _0x191a1d=_0x455465[_0x6017('0x15')](-0x1);if(_0x191a1d==='/'){_0x455465=_0x455465['substring'](0x0,_0x455465[_0x6017('0x16')](_0x191a1d));}return _0x455465;};exports[_0x6017('0x17')]=function(_0x57500e){if(!_['isNil'](_0x57500e)&&_0x57500e!==''){var _0x471c79=/^(([^<>()\[\]\\.,;:\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 _0x471c79['test'](String(_0x57500e)[_0x6017('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xec3d=['test','lodash','util','length','sortBy','type','string','variable','variableName','toString','customVariable','Variable','name','toLowerCase','push','keyValue','keyType','format','%s:\x20%s','key','keyContent','slice','substring','lastIndexOf','validateEmail'];(function(_0x455913,_0x2b7a92){var _0x3025b8=function(_0x3d754d){while(--_0x3d754d){_0x455913['push'](_0x455913['shift']());}};_0x3025b8(++_0x2b7a92);}(_0xec3d,0x12d));var _0xdec3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec3d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdec3('0x0'));var util=require(_0xdec3('0x1'));exports['getString']=function(_0x1fd933,_0x16acec,_0xb43823){var _0x1792a3=[];if(_0x1fd933[_0xdec3('0x2')]>0x0){var _0x547107=_[_0xdec3('0x3')](_0x1fd933,['id']);for(var _0x55c34f=0x0;_0x55c34f<_0x547107['length'];_0x55c34f++){var _0x30ef2a=_0x547107[_0x55c34f];if(_0x30ef2a[_0xdec3('0x4')]===_0xdec3('0x5')){_0x1792a3['push'](_0x30ef2a['content']);}else if(_0x30ef2a[_0xdec3('0x4')]===_0xdec3('0x6')&&_0x30ef2a[_0xdec3('0x7')]){_0x16acec[_0x30ef2a[_0xdec3('0x7')]]&&_0x1792a3['push'](_0x16acec[_0x30ef2a[_0xdec3('0x7')]][_0xdec3('0x8')]());}else if(_0x30ef2a[_0xdec3('0x4')]===_0xdec3('0x9')&&_0x30ef2a[_0xdec3('0xa')]&&_0x30ef2a[_0xdec3('0xa')]['name']){_0x16acec[_0x30ef2a[_0xdec3('0xa')][_0xdec3('0xb')][_0xdec3('0xc')]()]&&_0x1792a3[_0xdec3('0xd')](_0x16acec[_0x30ef2a['Variable'][_0xdec3('0xb')]['toLowerCase']()][_0xdec3('0x8')]());}else if(_0x30ef2a[_0xdec3('0x4')]===_0xdec3('0xe')){if(_0x30ef2a[_0xdec3('0xf')]===_0xdec3('0x5')&&_0x30ef2a['key']){_0x1792a3[_0xdec3('0xd')](util[_0xdec3('0x10')](_0xdec3('0x11'),_0x30ef2a[_0xdec3('0x12')],_0x30ef2a[_0xdec3('0x13')]));}else if(_0x30ef2a[_0xdec3('0xf')]===_0xdec3('0x6')&&_0x30ef2a['variableName']&&_0x30ef2a[_0xdec3('0x12')]){_0x16acec[_0x30ef2a[_0xdec3('0x7')]]&&_0x1792a3[_0xdec3('0xd')](util[_0xdec3('0x10')](_0xdec3('0x11'),_0x30ef2a[_0xdec3('0x12')],_0x16acec[_0x30ef2a[_0xdec3('0x7')]]));}else if(_0x30ef2a[_0xdec3('0xf')]==='customVariable'&&_0x30ef2a[_0xdec3('0xa')]&&_0x30ef2a[_0xdec3('0xa')][_0xdec3('0xb')]&&_0x30ef2a['key']){_0x16acec[_0x30ef2a[_0xdec3('0xa')]['name']['toLowerCase']()]&&_0x1792a3[_0xdec3('0xd')](util[_0xdec3('0x10')](_0xdec3('0x11'),_0x30ef2a[_0xdec3('0x12')],_0x16acec[_0x30ef2a[_0xdec3('0xa')][_0xdec3('0xb')][_0xdec3('0xc')]()]));}}}}return _0x1792a3['join'](_0xb43823);};exports['stripTrailingSlash']=function(_0x398d91){var _0x1c1ea8=_0x398d91[_0xdec3('0x14')](-0x1);if(_0x1c1ea8==='/'){_0x398d91=_0x398d91[_0xdec3('0x15')](0x0,_0x398d91[_0xdec3('0x16')](_0x1c1ea8));}return _0x398d91;};exports[_0xdec3('0x17')]=function(_0x5063f9){if(!_['isNil'](_0x5063f9)&&_0x5063f9!==''){var _0x430b1a=/^(([^<>()\[\]\\.,;:\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 _0x430b1a[_0xdec3('0x18')](String(_0x5063f9)[_0xdec3('0xc')]());}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 d3bac53..f5c4092 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 _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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 962b1b6..0fd48a8 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 _0xa255=['count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','%s:%s','username','password','%s/token:%s','base64','debug','[HTTP]','stringify','map','forEach','string','type','customField','toLowerCase','content','toString','custom_fields','push','variable','variableName','idField','customVariable','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','newTab','replace','unmanaged','monitor_format','lastevent','The\x20User\x20ID\x20is:','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xa255,0x12c));var _0x5a25=function(_0x536d70,_0xa88ce3){_0x536d70=_0x536d70-0x0;var _0x455ed3=_0xa255[_0x536d70];return _0x455ed3;};'use strict';var _=require(_0x5a25('0x0'));var rp=require(_0x5a25('0x1'));var md5=require(_0x5a25('0x2'));var util=require(_0x5a25('0x3'));var Redis=require(_0x5a25('0x4'));var intUtil=require(_0x5a25('0x5'));var config=require(_0x5a25('0x6'));var logger=require(_0x5a25('0x7'))('zendesk');config[_0x5a25('0x8')]=_[_0x5a25('0x9')](config[_0x5a25('0x8')],{'host':_0x5a25('0xa'),'port':0x18eb});var io=require(_0x5a25('0xb'))(new Redis(config[_0x5a25('0x8')]));function emit(_0x290a05,_0x15c184,_0x4cf01e){io['to'](_0x290a05)['emit'](_0x15c184,_0x4cf01e);}var headers={'Content-Type':_0x5a25('0xc'),'Accept':_0x5a25('0xc')};function getTicket(_0x391a16,_0x136e74,_0x1bad64,_0x1807bd,_0x29941c){logger[_0x5a25('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x5a25('0xe')](_0x5a25('0xf'),_0x391a16[_0x5a25('0x10')]),'method':_0x5a25('0x11'),'body':{'ticket':_[_0x5a25('0x12')]({'requester_id':_0x1bad64['id'],'submitter_id':_0x136e74?_0x136e74['id']:undefined,'assignee_id':_0x136e74?_0x136e74['id']:undefined,'tags':getTags(_0x1807bd[_0x5a25('0x13')],'name'),'subject':intUtil[_0x5a25('0x14')](_0x1807bd[_0x5a25('0x15')],_0x29941c,'\x20'),'description':intUtil[_0x5a25('0x14')](_0x1807bd[_0x5a25('0x16')],_0x29941c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1807bd[_0x5a25('0x16')],_0x29941c,'\x0a')}},getCustomFields(_0x1807bd[_0x5a25('0x17')],_0x29941c))}})[_0x5a25('0x18')](function(_0x431140){logger[_0x5a25('0xd')](_0x5a25('0x19'));return _0x431140[_0x5a25('0x1a')];});}function getUser(_0x42395c,_0x27257e){if(intUtil[_0x5a25('0x1b')](_0x27257e)){logger['info'](_0x5a25('0x1c'),_0x27257e);return request({'uri':util['format'](_0x5a25('0x1d'),_0x42395c['remoteUri']),'qs':{'query':util[_0x5a25('0xe')]('type:user\x20role:agent\x20email:%s',_0x27257e)}})[_0x5a25('0x18')](function(_0x554f43){if(_0x554f43[_0x5a25('0x1e')]){logger['info'](_0x5a25('0x1f'));return _['find'](_0x554f43[_0x5a25('0x20')],{'email':_0x27257e,'role':_0x5a25('0x21')});}else{logger['info'](_0x5a25('0x22'));return request({'uri':util[_0x5a25('0xe')]('%s/users/me.json',_0x42395c['remoteUri'])})[_0x5a25('0x18')](function(_0x13bee6){logger[_0x5a25('0xd')](_0x5a25('0x23'));return _0x13bee6[_0x5a25('0x24')];});}});}else{logger[_0x5a25('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x42395c['remoteUri'])})[_0x5a25('0x18')](function(_0x1c79c0){logger[_0x5a25('0xd')]('Admin\x20account\x20selected.');return _0x1c79c0[_0x5a25('0x24')];});}}function getEndUser(_0x127f0e,_0x4b9479,_0x2bea51){logger[_0x5a25('0xd')](_0x5a25('0x25'),_0x2bea51);return request({'uri':util['format'](_0x5a25('0x1d'),_0x127f0e['remoteUri']),'qs':{'query':util[_0x5a25('0xe')](_0x5a25('0x26'),_0x2bea51)}})[_0x5a25('0x18')](function(_0x4bf9b4){var _0x67c91b;if(_0x4bf9b4[_0x5a25('0x20')][_0x5a25('0x27')]){_0x4bf9b4[_0x5a25('0x20')]=_[_0x5a25('0x28')](_0x4bf9b4['results'],{'suspended':![],'role':_0x5a25('0x29')});if(_0x4bf9b4[_0x5a25('0x20')][_0x5a25('0x27')]){_0x67c91b=_[_0x5a25('0x2a')](_0x4bf9b4[_0x5a25('0x20')]);}}if(_0x67c91b){logger[_0x5a25('0xd')](_0x5a25('0x2b'));return _0x67c91b;}else{logger[_0x5a25('0xd')](_0x5a25('0x2c'));return request({'uri':util[_0x5a25('0xe')](_0x5a25('0x2d'),_0x127f0e[_0x5a25('0x10')]),'method':'POST','body':{'user':{'role':_0x5a25('0x29'),'name':util[_0x5a25('0xe')]('Caller\x20-\x20%s',_0x4b9479||_0x2bea51),'phone':_0x2bea51}}})['then'](function(_0x58c270){logger['info'](_0x5a25('0x2e'));return _0x58c270[_0x5a25('0x24')];});}});}function getAuth(_0x484897){var _0x23418b;if(_0x484897[_0x5a25('0x2f')]==='password'){_0x23418b=util[_0x5a25('0xe')](_0x5a25('0x30'),_0x484897[_0x5a25('0x31')],_0x484897[_0x5a25('0x32')]);}else if(_0x484897['authType']==='token'){_0x23418b=util[_0x5a25('0xe')](_0x5a25('0x33'),_0x484897['username'],_0x484897['token']);}return util[_0x5a25('0xe')]('Basic\x20%s',new Buffer(_0x23418b)['toString'](_0x5a25('0x34')));}function request(_0x531e06){logger[_0x5a25('0x35')](_0x5a25('0x36'),JSON[_0x5a25('0x37')](_0x531e06));return rp(_[_0x5a25('0x9')](_0x531e06,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2be5d7,_0x4dbb73){var _0x9eabdf=[];if(_0x2be5d7&&_0x2be5d7[_0x5a25('0x27')]>0x0){_0x9eabdf=_[_0x5a25('0x38')](_0x2be5d7,_0x4dbb73);}return _0x9eabdf;}function getCustomFields(_0x3460ac,_0x2fac06){var _0x4e19ac=[];var _0x239bf6={'custom_fields':[]};if(_0x3460ac[_0x5a25('0x27')]>0x0){_[_0x5a25('0x39')](_0x3460ac,function(_0x48d140){if(_['includes']([_0x5a25('0x3a'),'picklist'],_0x48d140[_0x5a25('0x3b')])&&_0x48d140['nameField']&&!_0x48d140[_0x5a25('0x3c')]){_0x239bf6[_0x48d140['nameField'][_0x5a25('0x3d')]()]=_0x48d140[_0x5a25('0x3e')][_0x5a25('0x3f')]();}else if(_['includes']([_0x5a25('0x3a'),'picklist'],_0x48d140[_0x5a25('0x3b')])&&_0x48d140['idField']&&_0x48d140[_0x5a25('0x3c')]){_0x239bf6[_0x5a25('0x40')][_0x5a25('0x41')]({'id':_0x48d140['idField'],'value':_0x48d140[_0x5a25('0x3e')][_0x5a25('0x3f')]()});}else if(_0x48d140[_0x5a25('0x3b')]===_0x5a25('0x42')&&_0x48d140[_0x5a25('0x43')]&&_0x48d140['idField']&&_0x48d140[_0x5a25('0x3c')]){_0x2fac06[_0x48d140[_0x5a25('0x43')]]&&_0x239bf6['custom_fields']['push']({'id':_0x48d140[_0x5a25('0x44')],'value':_0x2fac06[_0x48d140[_0x5a25('0x43')]]['toString']()});}else if(_0x48d140['type']===_0x5a25('0x45')&&_0x48d140[_0x5a25('0x46')]&&_0x48d140[_0x5a25('0x46')][_0x5a25('0x47')]&&_0x48d140[_0x5a25('0x44')]&&_0x48d140[_0x5a25('0x3c')]){_0x2fac06[_0x48d140[_0x5a25('0x46')]['name'][_0x5a25('0x3d')]()]&&_0x239bf6[_0x5a25('0x40')][_0x5a25('0x41')]({'id':_0x48d140['idField'],'value':_0x2fac06[_0x48d140[_0x5a25('0x46')]['name'][_0x5a25('0x3d')]()]['toString']()});}});}return _0x239bf6;}exports['queue']=function(_0x428746,_0x538dc1,_0x2a1401,_0x117797,_0x250e86,_0x5d9af2){var _0x55627c,_0x55e95b;_0x5d9af2[_0x5a25('0x10')]=intUtil[_0x5a25('0x48')](_0x5d9af2[_0x5a25('0x10')]);_0x5d9af2[_0x5a25('0x49')]=intUtil[_0x5a25('0x48')](_0x5d9af2[_0x5a25('0x49')]);if(_0x250e86&&_0x250e86['monitor_format']){logger[_0x5a25('0xd')](_0x5a25('0x4a'),_0x5a25('0x4b'));_0x538dc1[_0x5a25('0x4c')]=util[_0x5a25('0xe')](_0x5a25('0x4d'),_0x5d9af2['serverUrl'],_0x538dc1[_0x5a25('0x4e')],md5(_0x538dc1[_0x5a25('0x4e')]));}else{_0x538dc1[_0x5a25('0x4c')]='';}headers['Authorization']=getAuth(_0x5d9af2);return getUser(_0x5d9af2,_0x117797[_0x5a25('0x4f')])['then'](function(_0x14d7f9){_0x55627c=_0x14d7f9;logger['info']('The\x20User\x20ID\x20is:',_0x55627c['id']);return getEndUser(_0x5d9af2,_0x538dc1[_0x5a25('0x50')],_0x538dc1['calleridnum']);})[_0x5a25('0x18')](function(_0x39b779){_0x55e95b=_0x39b779;logger[_0x5a25('0xd')](_0x5a25('0x51'),_0x55e95b['id']);return getTicket(_0x5d9af2,_0x55627c,_0x55e95b,_0x2a1401,_0x538dc1);})[_0x5a25('0x18')](function(_0x5760d0){if(_0x5760d0){logger[_0x5a25('0xd')](_0x5a25('0x52'),_0x5760d0['id']);switch(_0x5d9af2[_0x5a25('0x3b')]){case _0x5a25('0x53'):logger['info'](_0x5a25('0x4a'),_0x5a25('0x54'));return request({'uri':util[_0x5a25('0xe')](_0x5a25('0x55'),_0x5d9af2[_0x5a25('0x10')],_0x55627c['id'],_0x5760d0['id']),'method':_0x5a25('0x11')});case'newTab':logger[_0x5a25('0xd')](_0x5a25('0x4a'),_0x5a25('0x56'));emit(util['format'](_0x5a25('0x57'),_0x117797[_0x5a25('0x47')]),_0x5a25('0x58'),{'uri':util[_0x5a25('0xe')](_0x5a25('0x59'),_0x5d9af2['remoteUri']['replace'](_0x5a25('0x5a'),''),_0x5760d0['id'])});break;default:logger[_0x5a25('0x5b')]('[QUEUE]',_0x5a25('0x5c'));}}})[_0x5a25('0x5d')](function(_0x2f19ee){logger[_0x5a25('0x5b')](_0x5a25('0x5e'),util[_0x5a25('0x5f')](_0x2f19ee,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x44d0d8,_0xdd7ba8,_0x32605a,_0x4401c7,_0x533d70,_0x31bc6b,_0x209083){var _0xbfae0a,_0x3aac7f;_0x31bc6b['remoteUri']=intUtil[_0x5a25('0x48')](_0x31bc6b[_0x5a25('0x10')]);_0x31bc6b['serverUrl']=intUtil['stripTrailingSlash'](_0x31bc6b[_0x5a25('0x49')]);if(_0x209083&&_0x209083[_0x5a25('0x60')]&&_0x209083[_0x5a25('0x60')]!=='none'){logger[_0x5a25('0xd')](_0x5a25('0x61'),_0x5a25('0x4b'));_0xdd7ba8['recordingURL']=util['format'](_0x5a25('0x4d'),_0x31bc6b[_0x5a25('0x49')],_0xdd7ba8['uniqueid'],md5(_0xdd7ba8[_0x5a25('0x4e')]));}headers[_0x5a25('0x62')]=getAuth(_0x31bc6b);return getUser(_0x31bc6b,_0x4401c7[_0x5a25('0x4f')])[_0x5a25('0x18')](function(_0x27afb7){_0xbfae0a=_0x27afb7;logger['info']('The\x20User\x20ID\x20is:',_0xbfae0a['id']);return getEndUser(_0x31bc6b,_0xdd7ba8[_0x5a25('0x63')],_0xdd7ba8[_0x5a25('0x64')]);})['then'](function(_0xcf65ec){_0x3aac7f=_0xcf65ec;logger[_0x5a25('0xd')](_0x5a25('0x51'),_0x3aac7f['id']);return getTicket(_0x31bc6b,_0xbfae0a,_0x3aac7f,_0x32605a,_0xdd7ba8);})['then'](function(_0x4d458d){if(_0x4d458d){logger[_0x5a25('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4d458d['id']);switch(_0x31bc6b[_0x5a25('0x3b')]){case _0x5a25('0x53'):logger[_0x5a25('0xd')](_0x5a25('0x61'),_0x5a25('0x54'));return request({'uri':util[_0x5a25('0xe')](_0x5a25('0x55'),_0x31bc6b['remoteUri'],_0xbfae0a['id'],_0x4d458d['id']),'method':_0x5a25('0x11')});case _0x5a25('0x65'):logger['info'](_0x5a25('0x61'),_0x5a25('0x56'));emit(util['format'](_0x5a25('0x57'),_0x4401c7['name']),_0x5a25('0x58'),{'uri':util[_0x5a25('0xe')](_0x5a25('0x59'),_0x31bc6b['remoteUri'][_0x5a25('0x66')](_0x5a25('0x5a'),''),_0x4d458d['id'])});break;default:logger[_0x5a25('0x5b')]('[OUTBOUND]',_0x5a25('0x5c'));}}})['catch'](function(_0x2a95fc){logger[_0x5a25('0x5b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2a95fc,{'showHidden':!![],'depth':null}));});};exports[_0x5a25('0x67')]=function(_0x393931,_0x45693c,_0x4dfd67,_0x5b668a,_0x5d3c96,_0x381111){var _0x1a166e,_0x521090;_0x381111['remoteUri']=intUtil[_0x5a25('0x48')](_0x381111['remoteUri']);_0x381111[_0x5a25('0x49')]=intUtil[_0x5a25('0x48')](_0x381111['serverUrl']);if(_0x5d3c96&&_0x5d3c96[_0x5a25('0x68')]){logger[_0x5a25('0xd')]('['+_0x45693c[_0x5a25('0x69')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x45693c[_0x5a25('0x4c')]=util[_0x5a25('0xe')](_0x5a25('0x4d'),_0x381111[_0x5a25('0x49')],_0x45693c[_0x5a25('0x4e')],md5(_0x45693c[_0x5a25('0x4e')]));}else{_0x45693c[_0x5a25('0x4c')]='';}headers[_0x5a25('0x62')]=getAuth(_0x381111);return getUser(_0x381111)['then'](function(_0x3976ed){_0x1a166e=_0x3976ed;logger['info'](_0x5a25('0x6a'),_0x1a166e['id']);return getEndUser(_0x381111,_0x45693c[_0x5a25('0x50')],_0x45693c[_0x5a25('0x6b')]);})[_0x5a25('0x18')](function(_0xae9d95){_0x521090=_0xae9d95;logger['info'](_0x5a25('0x51'),_0x521090['id']);return getTicket(_0x381111,_0x1a166e,_0x521090,_0x4dfd67,_0x45693c);})[_0x5a25('0x18')](function(_0x26bd0c){if(_0x26bd0c){logger[_0x5a25('0xd')](_0x5a25('0x52'),_0x26bd0c['id']);}})[_0x5a25('0x5d')](function(_0x22b580){logger[_0x5a25('0x5b')]('['+_0x45693c[_0x5a25('0x69')][_0x5a25('0x6c')]()+']'+_0x5a25('0x6d'),util[_0x5a25('0x5f')](_0x22b580,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0d23=['md5','util','ioredis','./util','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','emit','application/json','info','format','%s/tickets.json','POST','Tags','Subjects','Descriptions','getString','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','string','idField','push','variable','variableName','custom_fields','name','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','recordingFormat','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','request-promise'];(function(_0x3b4de2,_0x525d6b){var _0x530dfa=function(_0x562763){while(--_0x562763){_0x3b4de2['push'](_0x3b4de2['shift']());}};_0x530dfa(++_0x525d6b);}(_0x0d23,0x1ab));var _0x30d2=function(_0x5ae648,_0x20f5f3){_0x5ae648=_0x5ae648-0x0;var _0x127c45=_0x0d23[_0x5ae648];return _0x127c45;};'use strict';var _=require('lodash');var rp=require(_0x30d2('0x0'));var md5=require(_0x30d2('0x1'));var util=require(_0x30d2('0x2'));var Redis=require(_0x30d2('0x3'));var intUtil=require(_0x30d2('0x4'));var config=require(_0x30d2('0x5'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0x30d2('0x6')](config['redis'],{'host':_0x30d2('0x7'),'port':0x18eb});var io=require(_0x30d2('0x8'))(new Redis(config[_0x30d2('0x9')]));function emit(_0x1866c7,_0x1eef14,_0x2a0e6f){io['to'](_0x1866c7)[_0x30d2('0xa')](_0x1eef14,_0x2a0e6f);}var headers={'Content-Type':_0x30d2('0xb'),'Accept':_0x30d2('0xb')};function getTicket(_0x130734,_0x10fa75,_0x5a4f8c,_0x5db64b,_0x24f74c){logger[_0x30d2('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x30d2('0xd')](_0x30d2('0xe'),_0x130734['remoteUri']),'method':_0x30d2('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x5a4f8c['id'],'submitter_id':_0x10fa75?_0x10fa75['id']:undefined,'assignee_id':_0x10fa75?_0x10fa75['id']:undefined,'tags':getTags(_0x5db64b[_0x30d2('0x10')],'name'),'subject':intUtil['getString'](_0x5db64b[_0x30d2('0x11')],_0x24f74c,'\x20'),'description':intUtil['getString'](_0x5db64b[_0x30d2('0x12')],_0x24f74c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x30d2('0x13')](_0x5db64b[_0x30d2('0x12')],_0x24f74c,'\x0a')}},getCustomFields(_0x5db64b['Fields'],_0x24f74c))}})[_0x30d2('0x14')](function(_0x1a77f7){logger[_0x30d2('0xc')](_0x30d2('0x15'));return _0x1a77f7[_0x30d2('0x16')];});}function getUser(_0x2b922c,_0x47ec59){if(intUtil[_0x30d2('0x17')](_0x47ec59)){logger['info'](_0x30d2('0x18'),_0x47ec59);return request({'uri':util['format'](_0x30d2('0x19'),_0x2b922c[_0x30d2('0x1a')]),'qs':{'query':util[_0x30d2('0xd')]('type:user\x20role:agent\x20email:%s',_0x47ec59)}})[_0x30d2('0x14')](function(_0x2f0e1c){if(_0x2f0e1c[_0x30d2('0x1b')]){logger[_0x30d2('0xc')](_0x30d2('0x1c'));return _['find'](_0x2f0e1c[_0x30d2('0x1d')],{'email':_0x47ec59,'role':_0x30d2('0x1e')});}else{logger[_0x30d2('0xc')](_0x30d2('0x1f'));return request({'uri':util[_0x30d2('0xd')]('%s/users/me.json',_0x2b922c['remoteUri'])})[_0x30d2('0x14')](function(_0x5e7c50){logger[_0x30d2('0xc')](_0x30d2('0x20'));return _0x5e7c50[_0x30d2('0x21')];});}});}else{logger[_0x30d2('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x30d2('0xd')](_0x30d2('0x22'),_0x2b922c['remoteUri'])})[_0x30d2('0x14')](function(_0x28c188){logger[_0x30d2('0xc')](_0x30d2('0x20'));return _0x28c188[_0x30d2('0x21')];});}}function getEndUser(_0x1a8487,_0x23033b,_0xfb5559){logger[_0x30d2('0xc')](_0x30d2('0x23'),_0xfb5559);return request({'uri':util[_0x30d2('0xd')](_0x30d2('0x19'),_0x1a8487['remoteUri']),'qs':{'query':util[_0x30d2('0xd')]('type:user\x20role:end-user\x20phone:%s',_0xfb5559)}})[_0x30d2('0x14')](function(_0x584b60){var _0x547b05;if(_0x584b60['results'][_0x30d2('0x24')]){_0x584b60[_0x30d2('0x1d')]=_[_0x30d2('0x25')](_0x584b60['results'],{'suspended':![],'role':_0x30d2('0x26')});if(_0x584b60[_0x30d2('0x1d')]['length']){_0x547b05=_[_0x30d2('0x27')](_0x584b60[_0x30d2('0x1d')]);}}if(_0x547b05){logger[_0x30d2('0xc')]('Enduser\x20found!');return _0x547b05;}else{logger[_0x30d2('0xc')](_0x30d2('0x28'));return request({'uri':util[_0x30d2('0xd')](_0x30d2('0x29'),_0x1a8487['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x30d2('0xd')](_0x30d2('0x2a'),_0x23033b||_0xfb5559),'phone':_0xfb5559}}})[_0x30d2('0x14')](function(_0x34e002){logger['info'](_0x30d2('0x2b'));return _0x34e002[_0x30d2('0x21')];});}});}function getAuth(_0x2154dc){var _0x48b7dd;if(_0x2154dc[_0x30d2('0x2c')]===_0x30d2('0x2d')){_0x48b7dd=util[_0x30d2('0xd')](_0x30d2('0x2e'),_0x2154dc['username'],_0x2154dc['password']);}else if(_0x2154dc[_0x30d2('0x2c')]===_0x30d2('0x2f')){_0x48b7dd=util[_0x30d2('0xd')](_0x30d2('0x30'),_0x2154dc['username'],_0x2154dc['token']);}return util[_0x30d2('0xd')](_0x30d2('0x31'),new Buffer(_0x48b7dd)[_0x30d2('0x32')](_0x30d2('0x33')));}function request(_0x1eadfd){logger[_0x30d2('0x34')](_0x30d2('0x35'),JSON[_0x30d2('0x36')](_0x1eadfd));return rp(_[_0x30d2('0x6')](_0x1eadfd,{'method':_0x30d2('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x3833fe,_0x105be9){var _0x4a9ed3=[];if(_0x3833fe&&_0x3833fe[_0x30d2('0x24')]>0x0){_0x4a9ed3=_['map'](_0x3833fe,_0x105be9);}return _0x4a9ed3;}function getCustomFields(_0x1e25fb,_0xf6cfd3){var _0x355666=[];var _0x5a8a4d={'custom_fields':[]};if(_0x1e25fb[_0x30d2('0x24')]>0x0){_[_0x30d2('0x38')](_0x1e25fb,function(_0x45a8b9){if(_[_0x30d2('0x39')](['string',_0x30d2('0x3a')],_0x45a8b9[_0x30d2('0x3b')])&&_0x45a8b9['nameField']&&!_0x45a8b9[_0x30d2('0x3c')]){_0x5a8a4d[_0x45a8b9[_0x30d2('0x3d')][_0x30d2('0x3e')]()]=_0x45a8b9[_0x30d2('0x3f')]['toString']();}else if(_[_0x30d2('0x39')]([_0x30d2('0x40'),_0x30d2('0x3a')],_0x45a8b9[_0x30d2('0x3b')])&&_0x45a8b9[_0x30d2('0x41')]&&_0x45a8b9[_0x30d2('0x3c')]){_0x5a8a4d['custom_fields'][_0x30d2('0x42')]({'id':_0x45a8b9[_0x30d2('0x41')],'value':_0x45a8b9[_0x30d2('0x3f')][_0x30d2('0x32')]()});}else if(_0x45a8b9[_0x30d2('0x3b')]===_0x30d2('0x43')&&_0x45a8b9[_0x30d2('0x44')]&&_0x45a8b9['idField']&&_0x45a8b9[_0x30d2('0x3c')]){_0xf6cfd3[_0x45a8b9[_0x30d2('0x44')]]&&_0x5a8a4d[_0x30d2('0x45')][_0x30d2('0x42')]({'id':_0x45a8b9[_0x30d2('0x41')],'value':_0xf6cfd3[_0x45a8b9[_0x30d2('0x44')]][_0x30d2('0x32')]()});}else if(_0x45a8b9['type']==='customVariable'&&_0x45a8b9['Variable']&&_0x45a8b9['Variable'][_0x30d2('0x46')]&&_0x45a8b9[_0x30d2('0x41')]&&_0x45a8b9[_0x30d2('0x3c')]){_0xf6cfd3[_0x45a8b9[_0x30d2('0x47')][_0x30d2('0x46')][_0x30d2('0x3e')]()]&&_0x5a8a4d[_0x30d2('0x45')][_0x30d2('0x42')]({'id':_0x45a8b9['idField'],'value':_0xf6cfd3[_0x45a8b9[_0x30d2('0x47')][_0x30d2('0x46')][_0x30d2('0x3e')]()][_0x30d2('0x32')]()});}});}return _0x5a8a4d;}exports['queue']=function(_0x51bafb,_0x357160,_0xfec42e,_0x239cfc,_0x5464d9,_0x25efd3){var _0x46e85a,_0x246a9e;_0x25efd3['remoteUri']=intUtil[_0x30d2('0x48')](_0x25efd3[_0x30d2('0x1a')]);_0x25efd3[_0x30d2('0x49')]=intUtil['stripTrailingSlash'](_0x25efd3[_0x30d2('0x49')]);if(_0x5464d9&&_0x5464d9[_0x30d2('0x4a')]){logger[_0x30d2('0xc')](_0x30d2('0x4b'),_0x30d2('0x4c'));_0x357160['recordingURL']=util[_0x30d2('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25efd3[_0x30d2('0x49')],_0x357160[_0x30d2('0x4d')],md5(_0x357160[_0x30d2('0x4d')]));}else{_0x357160['recordingURL']='';}headers[_0x30d2('0x4e')]=getAuth(_0x25efd3);return getUser(_0x25efd3,_0x239cfc[_0x30d2('0x4f')])[_0x30d2('0x14')](function(_0xb1f126){_0x46e85a=_0xb1f126;logger[_0x30d2('0xc')](_0x30d2('0x50'),_0x46e85a['id']);return getEndUser(_0x25efd3,_0x357160[_0x30d2('0x51')],_0x357160[_0x30d2('0x52')]);})['then'](function(_0x50730c){_0x246a9e=_0x50730c;logger['info'](_0x30d2('0x53'),_0x246a9e['id']);return getTicket(_0x25efd3,_0x46e85a,_0x246a9e,_0xfec42e,_0x357160);})[_0x30d2('0x14')](function(_0x34ba9d){if(_0x34ba9d){logger[_0x30d2('0xc')](_0x30d2('0x54'),_0x34ba9d['id']);switch(_0x25efd3[_0x30d2('0x3b')]){case _0x30d2('0x55'):logger[_0x30d2('0xc')](_0x30d2('0x4b'),_0x30d2('0x56'));return request({'uri':util[_0x30d2('0xd')](_0x30d2('0x57'),_0x25efd3[_0x30d2('0x1a')],_0x46e85a['id'],_0x34ba9d['id']),'method':_0x30d2('0xf')});case _0x30d2('0x58'):logger[_0x30d2('0xc')](_0x30d2('0x4b'),_0x30d2('0x59'));emit(util[_0x30d2('0xd')](_0x30d2('0x5a'),_0x239cfc['name']),_0x30d2('0x5b'),{'uri':util[_0x30d2('0xd')](_0x30d2('0x5c'),_0x25efd3['remoteUri'][_0x30d2('0x5d')](_0x30d2('0x5e'),''),_0x34ba9d['id'])});break;default:logger[_0x30d2('0x5f')]('[QUEUE]',_0x30d2('0x60'));}}})['catch'](function(_0x1a0a68){logger[_0x30d2('0x5f')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x30d2('0x61')](_0x1a0a68,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5203ad,_0x2b0813,_0x40ad7d,_0x6e2a98,_0x3cd3e0,_0x2b2c16,_0x3abea6){var _0x126821,_0x477632;_0x2b2c16[_0x30d2('0x1a')]=intUtil[_0x30d2('0x48')](_0x2b2c16[_0x30d2('0x1a')]);_0x2b2c16['serverUrl']=intUtil[_0x30d2('0x48')](_0x2b2c16[_0x30d2('0x49')]);if(_0x3abea6&&_0x3abea6[_0x30d2('0x62')]&&_0x3abea6[_0x30d2('0x62')]!=='none'){logger[_0x30d2('0xc')]('[OUTBOUND]',_0x30d2('0x4c'));_0x2b0813[_0x30d2('0x63')]=util['format'](_0x30d2('0x64'),_0x2b2c16[_0x30d2('0x49')],_0x2b0813['uniqueid'],md5(_0x2b0813[_0x30d2('0x4d')]));}headers[_0x30d2('0x4e')]=getAuth(_0x2b2c16);return getUser(_0x2b2c16,_0x6e2a98['email'])['then'](function(_0x3d58c5){_0x126821=_0x3d58c5;logger[_0x30d2('0xc')](_0x30d2('0x50'),_0x126821['id']);return getEndUser(_0x2b2c16,_0x2b0813[_0x30d2('0x65')],_0x2b0813[_0x30d2('0x66')]);})[_0x30d2('0x14')](function(_0x46c014){_0x477632=_0x46c014;logger[_0x30d2('0xc')](_0x30d2('0x53'),_0x477632['id']);return getTicket(_0x2b2c16,_0x126821,_0x477632,_0x40ad7d,_0x2b0813);})[_0x30d2('0x14')](function(_0x1ff65a){if(_0x1ff65a){logger[_0x30d2('0xc')](_0x30d2('0x54'),_0x1ff65a['id']);switch(_0x2b2c16['type']){case _0x30d2('0x55'):logger['info'](_0x30d2('0x67'),_0x30d2('0x56'));return request({'uri':util['format'](_0x30d2('0x57'),_0x2b2c16[_0x30d2('0x1a')],_0x126821['id'],_0x1ff65a['id']),'method':_0x30d2('0xf')});case'newTab':logger[_0x30d2('0xc')](_0x30d2('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x30d2('0xd')](_0x30d2('0x5a'),_0x6e2a98['name']),_0x30d2('0x5b'),{'uri':util[_0x30d2('0xd')](_0x30d2('0x5c'),_0x2b2c16['remoteUri']['replace'](_0x30d2('0x5e'),''),_0x1ff65a['id'])});break;default:logger['error'](_0x30d2('0x67'),_0x30d2('0x60'));}}})['catch'](function(_0x16f8e8){logger[_0x30d2('0x5f')](_0x30d2('0x68'),util[_0x30d2('0x61')](_0x16f8e8,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x5df377,_0x50dd62,_0x2265bc,_0x3fb013,_0x154ac8,_0x2ca6c4){var _0x1c3295,_0x1828bc;_0x2ca6c4['remoteUri']=intUtil[_0x30d2('0x48')](_0x2ca6c4[_0x30d2('0x1a')]);_0x2ca6c4['serverUrl']=intUtil[_0x30d2('0x48')](_0x2ca6c4[_0x30d2('0x49')]);if(_0x154ac8&&_0x154ac8[_0x30d2('0x4a')]){logger[_0x30d2('0xc')]('['+_0x50dd62[_0x30d2('0x69')][_0x30d2('0x6a')]()+']',_0x30d2('0x4c'));_0x50dd62[_0x30d2('0x63')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ca6c4[_0x30d2('0x49')],_0x50dd62['uniqueid'],md5(_0x50dd62[_0x30d2('0x4d')]));}else{_0x50dd62[_0x30d2('0x63')]='';}headers[_0x30d2('0x4e')]=getAuth(_0x2ca6c4);return getUser(_0x2ca6c4)['then'](function(_0x5dcbdb){_0x1c3295=_0x5dcbdb;logger[_0x30d2('0xc')](_0x30d2('0x50'),_0x1c3295['id']);return getEndUser(_0x2ca6c4,_0x50dd62[_0x30d2('0x51')],_0x50dd62['calleridnum']);})[_0x30d2('0x14')](function(_0x5aa032){_0x1828bc=_0x5aa032;logger[_0x30d2('0xc')](_0x30d2('0x53'),_0x1828bc['id']);return getTicket(_0x2ca6c4,_0x1c3295,_0x1828bc,_0x2265bc,_0x50dd62);})['then'](function(_0x3ce4cf){if(_0x3ce4cf){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3ce4cf['id']);}})['catch'](function(_0x5edcbb){logger[_0x30d2('0x5f')]('['+_0x50dd62[_0x30d2('0x69')][_0x30d2('0x6a')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x30d2('0x61')](_0x5edcbb,{'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 6b2667b..1179489 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 _0xc2cc=['stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','email','Agent\x20found!','users','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','then','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','[QUEUE]','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','toUpperCase','request-promise','md5','util','moment','bluebird','../../../../config/logger','redis','localhost','debug','[HTTP]','stringify','length','string','picklist','type','idField','variable','variableName','toString','customVariable','name','toLowerCase','Variable','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','Failing\x20creating\x20the\x20access_token'];(function(_0x2cce4c,_0x1dfd1d){var _0x80f54d=function(_0x549e1f){while(--_0x549e1f){_0x2cce4c['push'](_0x2cce4c['shift']());}};_0x80f54d(++_0x1dfd1d);}(_0xc2cc,0x70));var _0xcc2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc2cc[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var rp=require(_0xcc2c('0x0'));var md5=require(_0xcc2c('0x1'));var util=require(_0xcc2c('0x2'));var intUtil=require('./util');var moment=require(_0xcc2c('0x3'));var Redis=require('ioredis');var BPromise=require(_0xcc2c('0x4'));var config=require('../../../../config/environment');var logger=require(_0xcc2c('0x5'))('zoho');config[_0xcc2c('0x6')]=_['defaults'](config['redis'],{'host':_0xcc2c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcc2c('0x6')]));function emit(_0x5a276f,_0x1d311f,_0x58c80c){io['to'](_0x5a276f)['emit'](_0x1d311f,_0x58c80c);}function request(_0x2bde97){logger[_0xcc2c('0x8')](_0xcc2c('0x9'),JSON[_0xcc2c('0xa')](_0x2bde97));return rp(_0x2bde97);}function getCustomFields(_0x2325be,_0x367881){var _0xb51804={};if(_0x2325be[_0xcc2c('0xb')]>0x0){_['forEach'](_0x2325be,function(_0x358306){if(_['includes']([_0xcc2c('0xc'),_0xcc2c('0xd')],_0x358306[_0xcc2c('0xe')])&&_0x358306[_0xcc2c('0xf')]){_0xb51804[_0x358306['idField']]=_0x358306['content']['toString']();}else if(_0x358306[_0xcc2c('0xe')]===_0xcc2c('0x10')&&_0x358306['variableName']&&_0x358306['idField']&&_0x367881[_0x358306[_0xcc2c('0x11')]]){_0xb51804[_0x358306['idField']]=_0x367881[_0x358306[_0xcc2c('0x11')]][_0xcc2c('0x12')]();}else if(_0x358306[_0xcc2c('0xe')]===_0xcc2c('0x13')&&_0x358306['Variable']&&_0x358306['Variable'][_0xcc2c('0x14')]&&_0x358306[_0xcc2c('0xf')]&&_0x367881[_0x358306['Variable'][_0xcc2c('0x14')][_0xcc2c('0x15')]()]){_0xb51804[_0x358306[_0xcc2c('0xf')]]=_0x367881[_0x358306[_0xcc2c('0x16')][_0xcc2c('0x14')][_0xcc2c('0x15')]()][_0xcc2c('0x12')]();}});}return _0xb51804;}function getName(_0x5a1f0a){if(_0x5a1f0a[_0xcc2c('0x17')]('\x20')>0x0){var _0x3acc89=_0x5a1f0a['split'](/ (.+)/);if(_0x3acc89[0x1]){return _0x3acc89;}}return[_0x5a1f0a,_0x5a1f0a];}var accountsTokens={};function getAccessToken(_0x4d22fe){return new Promise(function(_0x4a67f4,_0x15bbd6){if(!_['isNil'](accountsTokens[_0x4d22fe['id']])&&!_[_0xcc2c('0x18')](accountsTokens[_0x4d22fe['id']][_0xcc2c('0x19')])){if(moment()['isBefore'](accountsTokens[_0x4d22fe['id']][_0xcc2c('0x1a')])){_0x4a67f4(accountsTokens[_0x4d22fe['id']][_0xcc2c('0x19')]);}}var _0x5c7c53;switch(_0x4d22fe[_0xcc2c('0x1b')]){case'US':_0x5c7c53='https://accounts.zoho.com';break;case'AU':_0x5c7c53=_0xcc2c('0x1c');break;case'EU':_0x5c7c53='https://accounts.zoho.eu';break;case'IN':_0x5c7c53='https://accounts.zoho.in';break;case'CN':_0x5c7c53=_0xcc2c('0x1d');break;default:_0x5c7c53=_0xcc2c('0x1e');break;}var _0x5e491f={'method':_0xcc2c('0x1f'),'uri':_0x5c7c53+_0xcc2c('0x20'),'qs':{'refresh_token':_0x4d22fe[_0xcc2c('0x21')],'client_id':_0x4d22fe[_0xcc2c('0x22')],'client_secret':_0x4d22fe[_0xcc2c('0x23')],'grant_type':_0xcc2c('0x24')},'json':!![]};return rp(_0x5e491f)['then'](function(_0xaab877){accountsTokens[_0x4d22fe['id']]={'access_token':_0xaab877[_0xcc2c('0x19')],'expires_in':moment()[_0xcc2c('0x25')](_0xaab877[_0xcc2c('0x1a')],_0xcc2c('0x26'))};_0x4a67f4(_0xaab877['access_token']);})['catch'](function(_0x50c32b){logger['error'](_0xcc2c('0x27'),_0x50c32b[_0xcc2c('0x28')]);_0x15bbd6(_0x50c32b);});});}function getUser(_0x406515,_0x2c4ce9,_0x3ad1aa,_0x184de4){logger[_0xcc2c('0x29')](_0xcc2c('0x2a'));return request({'method':_0xcc2c('0x2b'),'uri':util[_0xcc2c('0x2c')](_0xcc2c('0x2d'),_0x2c4ce9),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xcc2c('0x2e')+_0x406515},'json':!![]})['then'](function(_0x4fd79f){if(_0x4fd79f['users']){var _0x31778c=-0x1;if(_[_0xcc2c('0x2f')](_0x4fd79f['users'])){if(!_['isNil'](_0x184de4)){_0x31778c=_[_0xcc2c('0x30')](_0x4fd79f['users'],function(_0x2b7e0c){return _0x2b7e0c[_0xcc2c('0x31')]===_0x184de4;});}if(_0x31778c>=0x0){logger[_0xcc2c('0x29')](_0xcc2c('0x32'));}else{logger[_0xcc2c('0x29')]('Using\x20the\x20admin\x20account!');_0x31778c=_['findIndex'](_0x4fd79f[_0xcc2c('0x33')],function(_0x12863b){return _0x12863b[_0xcc2c('0x34')][_0xcc2c('0x14')]===_0xcc2c('0x35');});}return _0x4fd79f['users'][_0x31778c];}else{if(_0x4fd79f[_0xcc2c('0x36')]['profile'][_0xcc2c('0x14')]===_0xcc2c('0x35')){logger['info'](_0xcc2c('0x37'));user=_0x4fd79f['user'];return user;}else{logger['error'](_0xcc2c('0x38'),JSON['stringify'](_0x4fd79f));throw new Error(_0xcc2c('0x39')+JSON[_0xcc2c('0xa')](_0x4fd79f));}}}else{logger[_0xcc2c('0x3a')]('The\x20failing\x20result\x20is',JSON[_0xcc2c('0xa')](_0x4fd79f));throw new Error(_0xcc2c('0x39')+JSON['stringify'](_0x4fd79f));}})[_0xcc2c('0x3b')](function(_0x5432fb){console[_0xcc2c('0x3a')](_0x5432fb);});}function getZohoUser(_0x4cb5de,_0x29e59f){return new BPromise(function(_0x1b9884,_0x10afa7){request(_0x4cb5de)['then'](function(_0x40509e){var _0x31349b=null;if(_0x40509e){_0x31349b=_0x40509e[_0xcc2c('0x3c')][0x0];_0x31349b[_0xcc2c('0x3d')]=_0x29e59f;}_0x1b9884(_0x31349b);})[_0xcc2c('0x3b')](function(_0xcd9a0b){_0x10afa7(_0xcd9a0b);});});}function createEndUser(_0x5ef1a5,_0x279744,_0x1b4514,_0xd6e808,_0x43afd6,_0x5b6ec6){var _0x1b4514=getName(_0x1b4514);return request({'method':_0xcc2c('0x1f'),'uri':_0xcc2c('0x3e')+_0x279744+_0xcc2c('0x3f')+_[_0xcc2c('0x40')](_0x5b6ec6[_0xcc2c('0x41')])+'s','body':{'data':[{'Last_Name':_0x1b4514[0x1],'First_Name':_0x1b4514[0x0],'Phone':_0xd6e808,'Owner':{'name':!_[_0xcc2c('0x18')](_0x43afd6[_0xcc2c('0x42')][_0xcc2c('0x14')])?_0x43afd6[_0xcc2c('0x42')]['name']:!_[_0xcc2c('0x18')](_0x43afd6[_0xcc2c('0x43')])?_0x43afd6['first_name']+'\x20'+_0x43afd6[_0xcc2c('0x44')]:_0x43afd6[_0xcc2c('0x44')],'id':_0x43afd6['id']}}]},'headers':{'Authorization':_0xcc2c('0x2e')+_0x5ef1a5},'json':!![]})[_0xcc2c('0x45')](function(_0x3a1a80){if(_0x3a1a80&&_0x3a1a80[_0xcc2c('0x3c')][0x0][_0xcc2c('0x46')]==='SUCCESS'){var _0x3c3f29=_0x3a1a80[_0xcc2c('0x3c')][0x0][_0xcc2c('0x47')];_0x3c3f29[_0xcc2c('0x3d')]=_[_0xcc2c('0x40')](_0x5b6ec6[_0xcc2c('0x41')])+'s';return _0x3c3f29;}logger[_0xcc2c('0x3a')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xcc2c('0x48')+JSON[_0xcc2c('0xa')](data));})[_0xcc2c('0x3b')](function(_0x10c07d){console[_0xcc2c('0x49')](_0xcc2c('0x4a'),_0x10c07d);});}function getEndUser(_0x14a522,_0x15f6f0,_0xe5a8db,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440){var _0x1659b3={'method':_0xcc2c('0x2b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x14a522},'json':!![]};switch(_0x5b1440[_0xcc2c('0x4b')]){case _0xcc2c('0x4c'):_0x1659b3[_0xcc2c('0x4d')]=_0xcc2c('0x3e')+_0x15f6f0+_0xcc2c('0x4e')+_0x496a0b+'))';return getZohoUser(_0x1659b3,'Contacts')['then'](function(_0x283d10){if(_0x283d10)return _0x283d10;_0x1659b3['uri']='https://www.zohoapis.'+_0x15f6f0+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x496a0b+'))';return getZohoUser(_0x1659b3,_0xcc2c('0x4f'))['then'](function(_0x4f9557){if(_0x4f9557)return _0x4f9557;if(_0x5b1440['moduleCreate']!='nothing'){return createEndUser(_0x14a522,_0x15f6f0,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440);}else{return{};}});});break;case'contact':_0x1659b3['uri']=_0xcc2c('0x3e')+_0x15f6f0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x496a0b+'))';return getZohoUser(_0x1659b3,_0xcc2c('0x50'))[_0xcc2c('0x45')](function(_0xcd6ccf){if(_0xcd6ccf)return _0xcd6ccf;if(_0x5b1440[_0xcc2c('0x41')]!='nothing'){return createEndUser(_0x14a522,_0x15f6f0,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440);}else{return{};}});break;case _0xcc2c('0x51'):_0x1659b3[_0xcc2c('0x4d')]=_0xcc2c('0x3e')+_0x15f6f0+_0xcc2c('0x52')+_0x496a0b+'))';return getZohoUser(_0x1659b3,'Leads')[_0xcc2c('0x45')](function(_0x8a4cb1){if(_0x8a4cb1)return _0x8a4cb1;if(_0x5b1440[_0xcc2c('0x41')]!=_0xcc2c('0x53')){return createEndUser(_0x14a522,_0x15f6f0,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440);}else{return{};}});break;}}function getCall(_0x3f7c9f,_0x18b223,_0x455f59,_0x19c04e,_0x113660,_0x298c2d,_0x19176e,_0x46d7e4){logger['info'](_0xcc2c('0x54'));var _0x275268={};_0x275268[_0xcc2c('0x55')]={'name':!_[_0xcc2c('0x18')](_0x19c04e['role'][_0xcc2c('0x14')])&&!_[_0xcc2c('0x18')](_0x19c04e[_0xcc2c('0x34')][_0xcc2c('0x14')])&&_0x19c04e[_0xcc2c('0x34')]['name']===_0xcc2c('0x56')?_0x19c04e[_0xcc2c('0x42')][_0xcc2c('0x14')]:!_['isNil'](_0x19c04e[_0xcc2c('0x43')])?_0x19c04e[_0xcc2c('0x43')]+'\x20'+_0x19c04e[_0xcc2c('0x44')]:_0x19c04e[_0xcc2c('0x44')],'id':_0x19c04e['id']};_0x275268[_0xcc2c('0x57')]=intUtil['getString'](_0x298c2d['Subjects'],_0x19176e,'\x20');_0x275268[_0xcc2c('0x58')]=intUtil['getString'](_0x298c2d[_0xcc2c('0x59')],_0x19176e,'\x0a');if(_0x113660[_0xcc2c('0x3d')]==='Contacts'){_0x275268[_0xcc2c('0x5a')]={'name':!_[_0xcc2c('0x18')](_0x113660[_0xcc2c('0x5b')])?_0x113660[_0xcc2c('0x5b')]:!_[_0xcc2c('0x18')](_0x113660['First_Name'])?_0x113660[_0xcc2c('0x5c')]+'\x20'+_0x113660[_0xcc2c('0x5d')]:_0x113660[_0xcc2c('0x5d')],'id':_0x113660['id']};}if(_0x113660[_0xcc2c('0x3d')]===_0xcc2c('0x4f')){_0x275268['What_Id']={'name':!_[_0xcc2c('0x18')](_0x113660[_0xcc2c('0x5b')])?_0x113660[_0xcc2c('0x5b')]:!_['isNil'](_0x113660[_0xcc2c('0x5c')])?_0x113660[_0xcc2c('0x5c')]+'\x20'+_0x113660[_0xcc2c('0x5d')]:_0x113660[_0xcc2c('0x5d')],'id':_0x113660['id']};_0x275268[_0xcc2c('0x5e')]=_[_0xcc2c('0x40')](_0x113660[_0xcc2c('0x3d')]);}if(_0x19176e['talktime']){_0x275268[_0xcc2c('0x5f')]=moment['utc'](parseInt(_0x19176e[_0xcc2c('0x60')])*0x3e8)[_0xcc2c('0x2c')](_0xcc2c('0x61'));}else if(_0x19176e[_0xcc2c('0x62')]&&_0x19176e[_0xcc2c('0x63')]){_0x275268[_0xcc2c('0x5f')]=moment[_0xcc2c('0x64')](moment(_0x19176e[_0xcc2c('0x63')],_0xcc2c('0x65'))['diff'](moment(_0x19176e[_0xcc2c('0x66')],_0xcc2c('0x65'))))['format'](_0xcc2c('0x61'));}switch(_0x19176e[_0xcc2c('0x67')]){case'called':_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x69');break;case _0xcc2c('0x6a'):case _0xcc2c('0x6b'):_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x6c');break;case _0xcc2c('0x6d'):_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x6e');break;case'abandoned':_0x275268['Call_Result']=_0xcc2c('0x6f');break;case _0xcc2c('0x70'):_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x71');default:}_0x275268[_0xcc2c('0x72')]=(_0x46d7e4===_0xcc2c('0x73')?moment(_0x19176e['starttime'])[_0xcc2c('0x2c')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x19176e['agentcalledAt'])[_0xcc2c('0x2c')](_0xcc2c('0x65')))||moment()['format'](_0xcc2c('0x65'));_0x275268[_0xcc2c('0x74')]=_0x46d7e4||_0xcc2c('0x75');_0x275268=_[_0xcc2c('0x76')](_0x275268,getCustomFields(_0x298c2d[_0xcc2c('0x77')],_0x19176e));return request({'method':_0xcc2c('0x1f'),'uri':_0xcc2c('0x3e')+_0x18b223+_0xcc2c('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3f7c9f},'body':{'data':[_0x275268]},'json':!![]})[_0xcc2c('0x45')](function(_0x16c8cf){if(_0x16c8cf&&_0x16c8cf[_0xcc2c('0x3c')][0x0][_0xcc2c('0x46')]==='SUCCESS'){logger[_0xcc2c('0x29')](_0xcc2c('0x79'));return{'id':_0x16c8cf['data'][0x0]['details']['id']};}})[_0xcc2c('0x3b')](function(_0x1e8121){logger['info'](_0xcc2c('0x7a'),_0x1e8121[_0xcc2c('0x28')]);console['log'](_0xcc2c('0x7a'),_0x1e8121);});}exports[_0xcc2c('0x7b')]=function(_0x57fce7,_0x3650a1,_0x2fb052,_0x583dad,_0x195be0,_0x4f1e89){var _0x56acdf,_0x4cfd41,_0x2b76fb;_0x4f1e89[_0xcc2c('0x7c')]=intUtil[_0xcc2c('0x7d')](_0x4f1e89[_0xcc2c('0x7c')]);_0x4f1e89[_0xcc2c('0x7e')]=intUtil['stripTrailingSlash'](_0x4f1e89[_0xcc2c('0x7e')]);if(_0x195be0&&_0x195be0[_0xcc2c('0x7f')]){logger[_0xcc2c('0x29')]('[QUEUE]',_0xcc2c('0x80'));_0x3650a1[_0xcc2c('0x81')]=_0x4f1e89[_0xcc2c('0x7e')]+'/api/voice/recordings/'+_0x3650a1[_0xcc2c('0x82')]+_0xcc2c('0x83')+md5(_0x3650a1['uniqueid']);}else{_0x3650a1[_0xcc2c('0x81')]='';}var _0x4ea3b8=_0x4f1e89[_0xcc2c('0x7c')]===_0xcc2c('0x84')?'eu':_0xcc2c('0x85');return getAccessToken(_0x4f1e89)[_0xcc2c('0x45')](function(_0x4dace2){_0x2b76fb=_0x4dace2;return getUser(_0x2b76fb,_0x4ea3b8,_0x4f1e89,_0x583dad[_0xcc2c('0x31')]);})['then'](function(_0xf9165a){_0x56acdf=_0xf9165a;logger[_0xcc2c('0x29')]('The\x20User\x20ID\x20is:',_0x56acdf['id']);return getEndUser(_0x2b76fb,_0x4ea3b8,_0x4f1e89,_0x3650a1[_0xcc2c('0x86')],_0x3650a1[_0xcc2c('0x87')],_0x56acdf,_0x2fb052);})[_0xcc2c('0x45')](function(_0x6bb1f6){_0x4cfd41=_0x6bb1f6;return getCall(_0x2b76fb,_0x4ea3b8,_0x4f1e89,_0x56acdf,_0x4cfd41,_0x2fb052,_0x3650a1,_0xcc2c('0x75'));})[_0xcc2c('0x45')](function(_0x29afbc){if(_0x29afbc){logger[_0xcc2c('0x29')]('The\x20Call\x20ID\x20is:',_0x29afbc['id']);logger[_0xcc2c('0x29')](_0xcc2c('0x88'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcc2c('0x2c')]('user:%s',_0x583dad[_0xcc2c('0x14')]),_0xcc2c('0x89'),{'uri':_0xcc2c('0x8a')+_0x4f1e89['host']+_0xcc2c('0x8b')+_0x29afbc['id']});}})['catch'](function(_0x376f43){logger['error'](_0xcc2c('0x88'),JSON[_0xcc2c('0xa')](_0x376f43));});};exports[_0xcc2c('0x73')]=function(_0x27913e,_0x5daf98,_0x498e63,_0x5124ac,_0x394097,_0x3336f4,_0x467409){var _0x5b7d0b,_0xcc89f0,_0x35f998;_0x3336f4[_0xcc2c('0x7c')]=intUtil[_0xcc2c('0x7d')](_0x3336f4['host']);_0x3336f4[_0xcc2c('0x7e')]=intUtil[_0xcc2c('0x7d')](_0x3336f4[_0xcc2c('0x7e')]);if(_0x467409&&_0x467409[_0xcc2c('0x8c')]&&_0x467409['recordingFormat']!==_0xcc2c('0x8d')){logger[_0xcc2c('0x29')](_0xcc2c('0x8e'),_0xcc2c('0x80'));_0x5daf98['recordingURL']=_0x3336f4[_0xcc2c('0x7e')]+_0xcc2c('0x8f')+_0x5daf98[_0xcc2c('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x5daf98['uniqueid']);}var _0x44c167=_0x3336f4['host']==='zoho.eu'?'eu':_0xcc2c('0x85');return getAccessToken(_0x3336f4)[_0xcc2c('0x45')](function(_0x595899){_0x35f998=_0x595899;return getUser(_0x35f998,_0x44c167,_0x3336f4,_0x5124ac[_0xcc2c('0x31')]);})[_0xcc2c('0x45')](function(_0x20e497){_0x5b7d0b=_0x20e497;logger[_0xcc2c('0x29')](_0xcc2c('0x90'),_0x5b7d0b['id']);return getEndUser(_0x35f998,_0x44c167,_0x3336f4,_0x5daf98[_0xcc2c('0x91')],_0x5daf98[_0xcc2c('0x92')],_0x5b7d0b,_0x498e63);})['then'](function(_0x545701){_0xcc89f0=_0x545701;return getCall(_0x35f998,_0x44c167,_0x3336f4,_0x5b7d0b,_0xcc89f0,_0x498e63,_0x5daf98,'Outbound');})[_0xcc2c('0x45')](function(_0x1b65c0){if(_0x1b65c0){logger[_0xcc2c('0x29')](_0xcc2c('0x93'),_0x1b65c0['id']);logger[_0xcc2c('0x29')]('[OUTBOUND]',_0xcc2c('0x94'));emit(util['format'](_0xcc2c('0x95'),_0x5124ac[_0xcc2c('0x14')]),_0xcc2c('0x89'),{'uri':_0xcc2c('0x8a')+_0x3336f4[_0xcc2c('0x7c')]+_0xcc2c('0x8b')+_0x1b65c0['id']});}})[_0xcc2c('0x3b')](function(_0x3d4e51){logger['error'](_0xcc2c('0x8e'),JSON[_0xcc2c('0xa')](_0x3d4e51));});};exports[_0xcc2c('0x96')]=function(_0x4bda0e,_0x51df89,_0x91f874,_0x53ec1f,_0xdd1c41,_0x2426dc){var _0xb77689,_0x581f5a,_0x545d4c;_0x2426dc[_0xcc2c('0x7c')]=intUtil[_0xcc2c('0x7d')](_0x2426dc[_0xcc2c('0x7c')]);_0x2426dc[_0xcc2c('0x7e')]=intUtil[_0xcc2c('0x7d')](_0x2426dc[_0xcc2c('0x7e')]);if(_0xdd1c41&&_0xdd1c41[_0xcc2c('0x7f')]){logger[_0xcc2c('0x29')]('['+_0x51df89[_0xcc2c('0x67')]['toUpperCase']()+']',_0xcc2c('0x80'));_0x51df89['recordingURL']=_0x2426dc[_0xcc2c('0x7e')]+_0xcc2c('0x8f')+_0x51df89[_0xcc2c('0x82')]+_0xcc2c('0x83')+md5(_0x51df89[_0xcc2c('0x82')]);}else{_0x51df89[_0xcc2c('0x81')]='';}var _0x8228d3=_0x2426dc[_0xcc2c('0x7c')]===_0xcc2c('0x84')?'eu':'com';return getAccessToken(_0x2426dc)[_0xcc2c('0x45')](function(_0x562592){_0x545d4c=_0x562592;return getUser(_0x545d4c,_0x8228d3,_0x2426dc);})[_0xcc2c('0x45')](function(_0x224575){_0xb77689=_0x224575;logger[_0xcc2c('0x29')](_0xcc2c('0x90'),_0xb77689['id']);return getEndUser(_0x545d4c,_0x8228d3,_0x2426dc,_0x51df89[_0xcc2c('0x86')],_0x51df89[_0xcc2c('0x87')],_0xb77689,_0x91f874);})['then'](function(_0x17073b){_0x581f5a=_0x17073b;return getCall(_0x545d4c,_0x8228d3,_0x2426dc,_0xb77689,_0x581f5a,_0x91f874,_0x51df89,_0xcc2c('0x75'));})[_0xcc2c('0x45')](function(_0x4c090d){if(_0x4c090d){logger['info'](_0xcc2c('0x93'),_0x4c090d['id']);}})['catch'](function(_0x49f68f){logger[_0xcc2c('0x3a')]('['+_0x51df89['lastevent'][_0xcc2c('0x97')]()+']',JSON[_0xcc2c('0xa')](_0x49f68f));});}; \ No newline at end of file +var _0x5a0a=['split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.eu','https://accounts.zoho.com.cn','refreshToken','clientId','add','seconds','catch','error','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','data','POST','https://www.zohoapis.','/crm/v2/','startCase','first_name','last_name','code','SUCCESS','details','enduserType','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','then','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Owner','role','administrator','Subject','Subjects','getString','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','diff','starttime','mm:ss','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','log','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','lastevent','toUpperCase','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','lodash','md5','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','name','toLowerCase'];(function(_0x4b5049,_0x4d00ad){var _0x2f2e38=function(_0x5b0217){while(--_0x5b0217){_0x4b5049['push'](_0x4b5049['shift']());}};_0x2f2e38(++_0x4d00ad);}(_0x5a0a,0x1a9));var _0xa5a0=function(_0x52209a,_0x28ea97){_0x52209a=_0x52209a-0x0;var _0xb43ac9=_0x5a0a[_0x52209a];return _0xb43ac9;};'use strict';var _=require(_0xa5a0('0x0'));var rp=require('request-promise');var md5=require(_0xa5a0('0x1'));var util=require('util');var intUtil=require(_0xa5a0('0x2'));var moment=require(_0xa5a0('0x3'));var Redis=require(_0xa5a0('0x4'));var BPromise=require(_0xa5a0('0x5'));var config=require(_0xa5a0('0x6'));var logger=require('../../../../config/logger')(_0xa5a0('0x7'));config['redis']=_[_0xa5a0('0x8')](config[_0xa5a0('0x9')],{'host':_0xa5a0('0xa'),'port':0x18eb});var io=require(_0xa5a0('0xb'))(new Redis(config[_0xa5a0('0x9')]));function emit(_0x2bb71e,_0x10f14e,_0x1a9d47){io['to'](_0x2bb71e)[_0xa5a0('0xc')](_0x10f14e,_0x1a9d47);}function request(_0x547e2d){logger['debug'](_0xa5a0('0xd'),JSON[_0xa5a0('0xe')](_0x547e2d));return rp(_0x547e2d);}function getCustomFields(_0x4f6e0e,_0x2d39fc){var _0x329553={};if(_0x4f6e0e[_0xa5a0('0xf')]>0x0){_[_0xa5a0('0x10')](_0x4f6e0e,function(_0x69ee7e){if(_[_0xa5a0('0x11')]([_0xa5a0('0x12'),_0xa5a0('0x13')],_0x69ee7e[_0xa5a0('0x14')])&&_0x69ee7e['idField']){_0x329553[_0x69ee7e[_0xa5a0('0x15')]]=_0x69ee7e[_0xa5a0('0x16')]['toString']();}else if(_0x69ee7e[_0xa5a0('0x14')]===_0xa5a0('0x17')&&_0x69ee7e[_0xa5a0('0x18')]&&_0x69ee7e[_0xa5a0('0x15')]&&_0x2d39fc[_0x69ee7e[_0xa5a0('0x18')]]){_0x329553[_0x69ee7e[_0xa5a0('0x15')]]=_0x2d39fc[_0x69ee7e[_0xa5a0('0x18')]][_0xa5a0('0x19')]();}else if(_0x69ee7e[_0xa5a0('0x14')]==='customVariable'&&_0x69ee7e['Variable']&&_0x69ee7e['Variable'][_0xa5a0('0x1a')]&&_0x69ee7e['idField']&&_0x2d39fc[_0x69ee7e['Variable'][_0xa5a0('0x1a')][_0xa5a0('0x1b')]()]){_0x329553[_0x69ee7e[_0xa5a0('0x15')]]=_0x2d39fc[_0x69ee7e['Variable']['name'][_0xa5a0('0x1b')]()][_0xa5a0('0x19')]();}});}return _0x329553;}function getName(_0x5b7e8e){if(_0x5b7e8e['indexOf']('\x20')>0x0){var _0x29710c=_0x5b7e8e[_0xa5a0('0x1c')](/ (.+)/);if(_0x29710c[0x1]){return _0x29710c;}}return[_0x5b7e8e,_0x5b7e8e];}var accountsTokens={};function getAccessToken(_0x3fd650){return new Promise(function(_0x44adf3,_0x3fdf1b){if(!_[_0xa5a0('0x1d')](accountsTokens[_0x3fd650['id']])&&!_['isNil'](accountsTokens[_0x3fd650['id']]['access_token'])){if(moment()[_0xa5a0('0x1e')](accountsTokens[_0x3fd650['id']][_0xa5a0('0x1f')])){_0x44adf3(accountsTokens[_0x3fd650['id']][_0xa5a0('0x20')]);}}var _0x40654c;switch(_0x3fd650[_0xa5a0('0x21')]){case'US':_0x40654c='https://accounts.zoho.com';break;case'AU':_0x40654c='https://accounts.zoho.com.au';break;case'EU':_0x40654c=_0xa5a0('0x22');break;case'IN':_0x40654c='https://accounts.zoho.in';break;case'CN':_0x40654c=_0xa5a0('0x23');break;default:_0x40654c=_0xa5a0('0x22');break;}var _0x48467d={'method':'POST','uri':_0x40654c+'/oauth/v2/token','qs':{'refresh_token':_0x3fd650[_0xa5a0('0x24')],'client_id':_0x3fd650[_0xa5a0('0x25')],'client_secret':_0x3fd650['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x48467d)['then'](function(_0x459f61){accountsTokens[_0x3fd650['id']]={'access_token':_0x459f61[_0xa5a0('0x20')],'expires_in':moment()[_0xa5a0('0x26')](_0x459f61[_0xa5a0('0x1f')],_0xa5a0('0x27'))};_0x44adf3(_0x459f61['access_token']);})[_0xa5a0('0x28')](function(_0x32e328){logger[_0xa5a0('0x29')]('Failing\x20creating\x20the\x20access_token',_0x32e328['stack']);_0x3fdf1b(_0x32e328);});});}function getUser(_0x1e7527,_0x40d634,_0x46873c,_0x528bd0){logger[_0xa5a0('0x2a')](_0xa5a0('0x2b'));return request({'method':_0xa5a0('0x2c'),'uri':util[_0xa5a0('0x2d')](_0xa5a0('0x2e'),_0x40d634),'qs':{'type':_0xa5a0('0x2f')},'headers':{'Authorization':_0xa5a0('0x30')+_0x1e7527},'json':!![]})['then'](function(_0x33cf11){if(_0x33cf11[_0xa5a0('0x31')]){var _0x2153a8=-0x1;if(_[_0xa5a0('0x32')](_0x33cf11[_0xa5a0('0x31')])){if(!_[_0xa5a0('0x1d')](_0x528bd0)){_0x2153a8=_[_0xa5a0('0x33')](_0x33cf11[_0xa5a0('0x31')],function(_0x1230d1){return _0x1230d1[_0xa5a0('0x34')]===_0x528bd0;});}if(_0x2153a8>=0x0){logger[_0xa5a0('0x2a')](_0xa5a0('0x35'));}else{logger[_0xa5a0('0x2a')]('Using\x20the\x20admin\x20account!');_0x2153a8=_['findIndex'](_0x33cf11['users'],function(_0x19c3f4){return _0x19c3f4[_0xa5a0('0x36')][_0xa5a0('0x1a')]===_0xa5a0('0x37');});}return _0x33cf11[_0xa5a0('0x31')][_0x2153a8];}else{if(_0x33cf11[_0xa5a0('0x38')][_0xa5a0('0x36')][_0xa5a0('0x1a')]==='Administrator'){logger[_0xa5a0('0x2a')](_0xa5a0('0x39'));user=_0x33cf11['user'];return user;}else{logger['error'](_0xa5a0('0x3a'),JSON[_0xa5a0('0xe')](_0x33cf11));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa5a0('0xe')](_0x33cf11));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xa5a0('0xe')](_0x33cf11));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa5a0('0xe')](_0x33cf11));}})[_0xa5a0('0x28')](function(_0x194de5){console[_0xa5a0('0x29')](_0x194de5);});}function getZohoUser(_0x58a801,_0x1ef1c6){return new BPromise(function(_0x2ca515,_0x957326){request(_0x58a801)['then'](function(_0x79066){var _0x561fe2=null;if(_0x79066){_0x561fe2=_0x79066[_0xa5a0('0x3b')][0x0];_0x561fe2['enduserType']=_0x1ef1c6;}_0x2ca515(_0x561fe2);})[_0xa5a0('0x28')](function(_0x159378){_0x957326(_0x159378);});});}function createEndUser(_0x4c8a12,_0x74dc07,_0x1a869b,_0x405d94,_0x57291a,_0x1938a5){var _0x1a869b=getName(_0x1a869b);return request({'method':_0xa5a0('0x3c'),'uri':_0xa5a0('0x3d')+_0x74dc07+_0xa5a0('0x3e')+_[_0xa5a0('0x3f')](_0x1938a5['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1a869b[0x1],'First_Name':_0x1a869b[0x0],'Phone':_0x405d94,'Owner':{'name':!_[_0xa5a0('0x1d')](_0x57291a['role'][_0xa5a0('0x1a')])?_0x57291a['role'][_0xa5a0('0x1a')]:!_[_0xa5a0('0x1d')](_0x57291a[_0xa5a0('0x40')])?_0x57291a[_0xa5a0('0x40')]+'\x20'+_0x57291a['last_name']:_0x57291a[_0xa5a0('0x41')],'id':_0x57291a['id']}}]},'headers':{'Authorization':_0xa5a0('0x30')+_0x4c8a12},'json':!![]})['then'](function(_0x451e61){if(_0x451e61&&_0x451e61[_0xa5a0('0x3b')][0x0][_0xa5a0('0x42')]===_0xa5a0('0x43')){var _0x14dfe2=_0x451e61[_0xa5a0('0x3b')][0x0][_0xa5a0('0x44')];_0x14dfe2[_0xa5a0('0x45')]=_[_0xa5a0('0x3f')](_0x1938a5[_0xa5a0('0x46')])+'s';return _0x14dfe2;}logger[_0xa5a0('0x29')]('The\x20failing\x20result\x20is',JSON[_0xa5a0('0xe')](data));throw new Error(_0xa5a0('0x47')+JSON[_0xa5a0('0xe')](data));})[_0xa5a0('0x28')](function(_0x3293de){console['log'](_0xa5a0('0x48'),_0x3293de);});}function getEndUser(_0x1fb8fe,_0x3fff0e,_0x1f3dfa,_0x407856,_0x5d89d0,_0x5362ef,_0x2ae180){var _0x237c8d={'method':_0xa5a0('0x2c'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1fb8fe},'json':!![]};switch(_0x2ae180[_0xa5a0('0x49')]){case _0xa5a0('0x4a'):_0x237c8d[_0xa5a0('0x4b')]=_0xa5a0('0x3d')+_0x3fff0e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5d89d0+'))';return getZohoUser(_0x237c8d,_0xa5a0('0x4c'))[_0xa5a0('0x4d')](function(_0x28b70d){if(_0x28b70d)return _0x28b70d;_0x237c8d[_0xa5a0('0x4b')]=_0xa5a0('0x3d')+_0x3fff0e+_0xa5a0('0x4e')+_0x5d89d0+'))';return getZohoUser(_0x237c8d,_0xa5a0('0x4f'))['then'](function(_0xcae8db){if(_0xcae8db)return _0xcae8db;if(_0x2ae180[_0xa5a0('0x46')]!='nothing'){return createEndUser(_0x1fb8fe,_0x3fff0e,_0x407856,_0x5d89d0,_0x5362ef,_0x2ae180);}else{return{};}});});break;case _0xa5a0('0x50'):_0x237c8d[_0xa5a0('0x4b')]=_0xa5a0('0x3d')+_0x3fff0e+_0xa5a0('0x51')+_0x5d89d0+'))';return getZohoUser(_0x237c8d,_0xa5a0('0x4c'))['then'](function(_0x287a76){if(_0x287a76)return _0x287a76;if(_0x2ae180['moduleCreate']!=_0xa5a0('0x52')){return createEndUser(_0x1fb8fe,_0x3fff0e,_0x407856,_0x5d89d0,_0x5362ef,_0x2ae180);}else{return{};}});break;case _0xa5a0('0x53'):_0x237c8d[_0xa5a0('0x4b')]=_0xa5a0('0x3d')+_0x3fff0e+_0xa5a0('0x4e')+_0x5d89d0+'))';return getZohoUser(_0x237c8d,_0xa5a0('0x4f'))[_0xa5a0('0x4d')](function(_0x246f6a){if(_0x246f6a)return _0x246f6a;if(_0x2ae180[_0xa5a0('0x46')]!=_0xa5a0('0x52')){return createEndUser(_0x1fb8fe,_0x3fff0e,_0x407856,_0x5d89d0,_0x5362ef,_0x2ae180);}else{return{};}});break;}}function getCall(_0x3ca5cd,_0x54364a,_0x59bb87,_0x49038d,_0x43b5bd,_0x2c442c,_0x91e054,_0x480b99){logger[_0xa5a0('0x2a')]('Creating\x20new\x20call...');var _0x955639={};_0x955639[_0xa5a0('0x54')]={'name':!_[_0xa5a0('0x1d')](_0x49038d[_0xa5a0('0x55')][_0xa5a0('0x1a')])&&!_[_0xa5a0('0x1d')](_0x49038d['profile'][_0xa5a0('0x1a')])&&_0x49038d['profile'][_0xa5a0('0x1a')]===_0xa5a0('0x56')?_0x49038d[_0xa5a0('0x55')]['name']:!_[_0xa5a0('0x1d')](_0x49038d[_0xa5a0('0x40')])?_0x49038d['first_name']+'\x20'+_0x49038d[_0xa5a0('0x41')]:_0x49038d[_0xa5a0('0x41')],'id':_0x49038d['id']};_0x955639[_0xa5a0('0x57')]=intUtil['getString'](_0x2c442c[_0xa5a0('0x58')],_0x91e054,'\x20');_0x955639['Description']=intUtil[_0xa5a0('0x59')](_0x2c442c[_0xa5a0('0x5a')],_0x91e054,'\x0a');if(_0x43b5bd[_0xa5a0('0x45')]===_0xa5a0('0x4c')){_0x955639[_0xa5a0('0x5b')]={'name':!_['isNil'](_0x43b5bd['Full_Name'])?_0x43b5bd['Full_Name']:!_[_0xa5a0('0x1d')](_0x43b5bd['First_Name'])?_0x43b5bd[_0xa5a0('0x5c')]+'\x20'+_0x43b5bd[_0xa5a0('0x5d')]:_0x43b5bd[_0xa5a0('0x5d')],'id':_0x43b5bd['id']};}if(_0x43b5bd[_0xa5a0('0x45')]===_0xa5a0('0x4f')){_0x955639[_0xa5a0('0x5e')]={'name':!_['isNil'](_0x43b5bd[_0xa5a0('0x5f')])?_0x43b5bd[_0xa5a0('0x5f')]:!_[_0xa5a0('0x1d')](_0x43b5bd[_0xa5a0('0x5c')])?_0x43b5bd[_0xa5a0('0x5c')]+'\x20'+_0x43b5bd[_0xa5a0('0x5d')]:_0x43b5bd[_0xa5a0('0x5d')],'id':_0x43b5bd['id']};_0x955639[_0xa5a0('0x60')]=_['startCase'](_0x43b5bd[_0xa5a0('0x45')]);}if(_0x91e054[_0xa5a0('0x61')]){_0x955639[_0xa5a0('0x62')]=moment[_0xa5a0('0x63')](parseInt(_0x91e054[_0xa5a0('0x61')])*0x3e8)[_0xa5a0('0x2d')]('mm:ss');}else if(_0x91e054[_0xa5a0('0x64')]&&_0x91e054[_0xa5a0('0x65')]){_0x955639['Call_Duration']=moment[_0xa5a0('0x63')](moment(_0x91e054[_0xa5a0('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0xa5a0('0x66')](moment(_0x91e054[_0xa5a0('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xa5a0('0x2d')](_0xa5a0('0x68'));}switch(_0x91e054['lastevent']){case _0xa5a0('0x69'):_0x955639[_0xa5a0('0x6a')]='Called';break;case _0xa5a0('0x6b'):case _0xa5a0('0x6c'):_0x955639[_0xa5a0('0x6a')]=_0xa5a0('0x6d');break;case _0xa5a0('0x6e'):_0x955639[_0xa5a0('0x6a')]=_0xa5a0('0x6f');break;case _0xa5a0('0x70'):_0x955639[_0xa5a0('0x6a')]=_0xa5a0('0x71');break;case'timeout':_0x955639['Call_Result']=_0xa5a0('0x72');default:}_0x955639['Call_Start_Time']=(_0x480b99===_0xa5a0('0x73')?moment(_0x91e054[_0xa5a0('0x67')])['format'](_0xa5a0('0x74')):moment(_0x91e054['agentcalledAt'])['format'](_0xa5a0('0x74')))||moment()[_0xa5a0('0x2d')](_0xa5a0('0x74'));_0x955639[_0xa5a0('0x75')]=_0x480b99||_0xa5a0('0x76');_0x955639=_[_0xa5a0('0x77')](_0x955639,getCustomFields(_0x2c442c[_0xa5a0('0x78')],_0x91e054));return request({'method':_0xa5a0('0x3c'),'uri':_0xa5a0('0x3d')+_0x54364a+_0xa5a0('0x79'),'headers':{'Authorization':_0xa5a0('0x30')+_0x3ca5cd},'body':{'data':[_0x955639]},'json':!![]})[_0xa5a0('0x4d')](function(_0x13a6d8){if(_0x13a6d8&&_0x13a6d8[_0xa5a0('0x3b')][0x0][_0xa5a0('0x42')]==='SUCCESS'){logger[_0xa5a0('0x2a')](_0xa5a0('0x7a'));return{'id':_0x13a6d8[_0xa5a0('0x3b')][0x0][_0xa5a0('0x44')]['id']};}})[_0xa5a0('0x28')](function(_0x4b77f7){logger[_0xa5a0('0x2a')](_0xa5a0('0x7b'),_0x4b77f7[_0xa5a0('0x7c')]);console[_0xa5a0('0x7d')](_0xa5a0('0x7b'),_0x4b77f7);});}exports['queue']=function(_0x35ffa2,_0x253108,_0x4e1864,_0x3b078f,_0x25d2f5,_0x2d3d61){var _0x3aee28,_0x57132a,_0x47c406;_0x2d3d61[_0xa5a0('0x7e')]=intUtil[_0xa5a0('0x7f')](_0x2d3d61[_0xa5a0('0x7e')]);_0x2d3d61[_0xa5a0('0x80')]=intUtil[_0xa5a0('0x7f')](_0x2d3d61['serverUrl']);if(_0x25d2f5&&_0x25d2f5['monitor_format']){logger[_0xa5a0('0x2a')](_0xa5a0('0x81'),'Recording\x20is\x20enabled!');_0x253108[_0xa5a0('0x82')]=_0x2d3d61[_0xa5a0('0x80')]+_0xa5a0('0x83')+_0x253108[_0xa5a0('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x253108[_0xa5a0('0x84')]);}else{_0x253108[_0xa5a0('0x82')]='';}var _0x5d7e1a=_0x2d3d61[_0xa5a0('0x7e')]===_0xa5a0('0x85')?'eu':_0xa5a0('0x86');return getAccessToken(_0x2d3d61)['then'](function(_0x30caa0){_0x47c406=_0x30caa0;return getUser(_0x47c406,_0x5d7e1a,_0x2d3d61,_0x3b078f['email']);})['then'](function(_0x4b2b7f){_0x3aee28=_0x4b2b7f;logger[_0xa5a0('0x2a')]('The\x20User\x20ID\x20is:',_0x3aee28['id']);return getEndUser(_0x47c406,_0x5d7e1a,_0x2d3d61,_0x253108['calleridname'],_0x253108[_0xa5a0('0x87')],_0x3aee28,_0x4e1864);})[_0xa5a0('0x4d')](function(_0x59e13e){_0x57132a=_0x59e13e;return getCall(_0x47c406,_0x5d7e1a,_0x2d3d61,_0x3aee28,_0x57132a,_0x4e1864,_0x253108,_0xa5a0('0x76'));})[_0xa5a0('0x4d')](function(_0x912db0){if(_0x912db0){logger[_0xa5a0('0x2a')]('The\x20Call\x20ID\x20is:',_0x912db0['id']);logger['info'](_0xa5a0('0x81'),_0xa5a0('0x88'));emit(util[_0xa5a0('0x2d')](_0xa5a0('0x89'),_0x3b078f[_0xa5a0('0x1a')]),_0xa5a0('0x8a'),{'uri':'https://crm.'+_0x2d3d61[_0xa5a0('0x7e')]+_0xa5a0('0x8b')+_0x912db0['id']});}})[_0xa5a0('0x28')](function(_0x56a069){logger[_0xa5a0('0x29')](_0xa5a0('0x81'),JSON['stringify'](_0x56a069));});};exports[_0xa5a0('0x73')]=function(_0x40feb0,_0x2d35c3,_0x50320b,_0x27bbf6,_0x3cb639,_0x4e2b99,_0x43c7fd){var _0x4542f5,_0x80c049,_0x2646e7;_0x4e2b99['host']=intUtil[_0xa5a0('0x7f')](_0x4e2b99[_0xa5a0('0x7e')]);_0x4e2b99[_0xa5a0('0x80')]=intUtil['stripTrailingSlash'](_0x4e2b99['serverUrl']);if(_0x43c7fd&&_0x43c7fd[_0xa5a0('0x8c')]&&_0x43c7fd[_0xa5a0('0x8c')]!==_0xa5a0('0x8d')){logger[_0xa5a0('0x2a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2d35c3[_0xa5a0('0x82')]=_0x4e2b99[_0xa5a0('0x80')]+_0xa5a0('0x83')+_0x2d35c3[_0xa5a0('0x84')]+_0xa5a0('0x8e')+md5(_0x2d35c3[_0xa5a0('0x84')]);}var _0x445ed2=_0x4e2b99['host']===_0xa5a0('0x85')?'eu':'com';return getAccessToken(_0x4e2b99)[_0xa5a0('0x4d')](function(_0x261bef){_0x2646e7=_0x261bef;return getUser(_0x2646e7,_0x445ed2,_0x4e2b99,_0x27bbf6[_0xa5a0('0x34')]);})[_0xa5a0('0x4d')](function(_0xacefc8){_0x4542f5=_0xacefc8;logger[_0xa5a0('0x2a')]('The\x20User\x20ID\x20is:',_0x4542f5['id']);return getEndUser(_0x2646e7,_0x445ed2,_0x4e2b99,_0x2d35c3[_0xa5a0('0x8f')],_0x2d35c3[_0xa5a0('0x90')],_0x4542f5,_0x50320b);})[_0xa5a0('0x4d')](function(_0x2c0106){_0x80c049=_0x2c0106;return getCall(_0x2646e7,_0x445ed2,_0x4e2b99,_0x4542f5,_0x80c049,_0x50320b,_0x2d35c3,_0xa5a0('0x91'));})[_0xa5a0('0x4d')](function(_0x3fffb2){if(_0x3fffb2){logger[_0xa5a0('0x2a')]('The\x20Call\x20ID\x20is:',_0x3fffb2['id']);logger[_0xa5a0('0x2a')](_0xa5a0('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa5a0('0x89'),_0x27bbf6[_0xa5a0('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x4e2b99[_0xa5a0('0x7e')]+_0xa5a0('0x8b')+_0x3fffb2['id']});}})['catch'](function(_0x5cff0d){logger[_0xa5a0('0x29')](_0xa5a0('0x92'),JSON[_0xa5a0('0xe')](_0x5cff0d));});};exports['unmanaged']=function(_0xf84c1c,_0x2f4484,_0x4790fa,_0x1040bd,_0x3597c4,_0x258af3){var _0x494a43,_0x339e9d,_0x342e93;_0x258af3['host']=intUtil[_0xa5a0('0x7f')](_0x258af3['host']);_0x258af3[_0xa5a0('0x80')]=intUtil[_0xa5a0('0x7f')](_0x258af3[_0xa5a0('0x80')]);if(_0x3597c4&&_0x3597c4['monitor_format']){logger[_0xa5a0('0x2a')]('['+_0x2f4484[_0xa5a0('0x93')][_0xa5a0('0x94')]()+']','Recording\x20is\x20enabled!');_0x2f4484[_0xa5a0('0x82')]=_0x258af3[_0xa5a0('0x80')]+'/api/voice/recordings/'+_0x2f4484[_0xa5a0('0x84')]+_0xa5a0('0x8e')+md5(_0x2f4484[_0xa5a0('0x84')]);}else{_0x2f4484[_0xa5a0('0x82')]='';}var _0x531cc1=_0x258af3[_0xa5a0('0x7e')]===_0xa5a0('0x85')?'eu':'com';return getAccessToken(_0x258af3)[_0xa5a0('0x4d')](function(_0x4aedd7){_0x342e93=_0x4aedd7;return getUser(_0x342e93,_0x531cc1,_0x258af3);})[_0xa5a0('0x4d')](function(_0x2bb7ba){_0x494a43=_0x2bb7ba;logger[_0xa5a0('0x2a')](_0xa5a0('0x95'),_0x494a43['id']);return getEndUser(_0x342e93,_0x531cc1,_0x258af3,_0x2f4484['calleridname'],_0x2f4484[_0xa5a0('0x87')],_0x494a43,_0x4790fa);})[_0xa5a0('0x4d')](function(_0x2eaafb){_0x339e9d=_0x2eaafb;return getCall(_0x342e93,_0x531cc1,_0x258af3,_0x494a43,_0x339e9d,_0x4790fa,_0x2f4484,_0xa5a0('0x76'));})[_0xa5a0('0x4d')](function(_0x3bbf7d){if(_0x3bbf7d){logger['info'](_0xa5a0('0x96'),_0x3bbf7d['id']);}})[_0xa5a0('0x28')](function(_0x1018c3){logger[_0xa5a0('0x29')]('['+_0x2f4484['lastevent'][_0xa5a0('0x94')]()+']',JSON['stringify'](_0x1018c3));});}; \ 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 c8e6616..aeac664 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 _0xa25b=['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','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x20a95d,_0x2ed7de){var _0xb10938=function(_0x4a6697){while(--_0x4a6697){_0x20a95d['push'](_0x20a95d['shift']());}};_0xb10938(++_0x2ed7de);}(_0xa25b,0x90));var _0xba25=function(_0x1a76a6,_0x5e0c2b){_0x1a76a6=_0x1a76a6-0x0;var _0x577740=_0xa25b[_0x1a76a6];return _0x577740;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0xba25('0x0'));var logger=require(_0xba25('0x1'))(_0xba25('0x2'));exports[_0xba25('0x3')]=function(_0x3339b0,_0x1d1ff9){var _0x1b98e2=_0x3339b0[_0xba25('0x4')]?_0x3339b0[_0xba25('0x4')]:_0xba25('0x5');var _0x43fc99=_0x3339b0[_0xba25('0x6')]?Mustache['render'](_0x3339b0[_0xba25('0x6')],_0x1d1ff9):_0x1d1ff9;sh[_0xba25('0x3')](_0x43fc99,function(_0x370363,_0x411bec,_0xb9fcd9){if(_0x370363!==0x0){logger[_0xba25('0x7')](util[_0xba25('0x8')](_0xba25('0x9'),_0x1b98e2,_0x43fc99,_0x370363,_0xb9fcd9));}else{logger[_0xba25('0xa')](util[_0xba25('0x8')](_0xba25('0xb'),_0x1b98e2,_0x43fc99,_0x411bec));}});}; \ No newline at end of file +var _0x89d3=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','exec','data2','data3','error'];(function(_0x3e47fc,_0x3f7bdd){var _0xc9ee78=function(_0x1eeaee){while(--_0x1eeaee){_0x3e47fc['push'](_0x3e47fc['shift']());}};_0xc9ee78(++_0x3f7bdd);}(_0x89d3,0x1bc));var _0x389d=function(_0x1a3917,_0x4f02ea){_0x1a3917=_0x1a3917-0x0;var _0x49172a=_0x89d3[_0x1a3917];return _0x49172a;};'use strict';var util=require('util');var sh=require(_0x389d('0x0'));var Mustache=require(_0x389d('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x389d('0x2')]=function(_0x37bb40,_0x3d73a4){var _0x19c2dd=_0x37bb40[_0x389d('0x3')]?_0x37bb40['data2']:'Script';var _0x4b7854=_0x37bb40['data3']?Mustache['render'](_0x37bb40[_0x389d('0x4')],_0x3d73a4):_0x3d73a4;sh[_0x389d('0x2')](_0x4b7854,function(_0x380940,_0x4b4b5f,_0x40e19c){if(_0x380940!==0x0){logger[_0x389d('0x5')](util[_0x389d('0x6')](_0x389d('0x7'),_0x19c2dd,_0x4b7854,_0x380940,_0x40e19c));}else{logger['info'](util['format'](_0x389d('0x8'),_0x19c2dd,_0x4b7854,_0x4b4b5f));}});}; \ 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 c35f45a..c2786a2 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 _0xc4ca=['mustache','../../../../config/logger','trigger','data1','toUpperCase','render','number','data5','headers','data6','error','stack','GET','POST','PUT','data7','parse','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','info','statusCode','name','message','request-promise','util'];(function(_0x5661cf,_0x3f6960){var _0x2d6c33=function(_0x497e6a){while(--_0x497e6a){_0x5661cf['push'](_0x5661cf['shift']());}};_0x2d6c33(++_0x3f6960);}(_0xc4ca,0x11e));var _0xac4c=function(_0x45d55a,_0x1adad5){_0x45d55a=_0x45d55a-0x0;var _0x3ff504=_0xc4ca[_0x45d55a];return _0x3ff504;};'use strict';var rp=require(_0xac4c('0x0'));var util=require(_0xac4c('0x1'));var _=require('lodash');var Mustache=require(_0xac4c('0x2'));var logger=require(_0xac4c('0x3'))(_0xac4c('0x4'));exports['exec']=function(_0x302222,_0x1ecae7){var _0x505dca,_0x4b3262;var _0x481bde={'method':_0x302222[_0xac4c('0x5')][_0xac4c('0x6')](),'uri':Mustache[_0xac4c('0x7')](_0x302222['data2'],_0x1ecae7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x302222['data5'])===_0xac4c('0x8')&&parseInt(_0x302222[_0xac4c('0x9')])>=0x1&&parseInt(_0x302222['data5'])<=0xa?parseInt(_0x302222[_0xac4c('0x9')])*0x3e8:0x5*0x3e8};try{_0x481bde[_0xac4c('0xa')]=_0x302222[_0xac4c('0xb')]?JSON['parse'](Mustache[_0xac4c('0x7')](_0x302222['data6'],_0x1ecae7)):{};}catch(_0x4d5d3e){logger[_0xac4c('0xc')](_0x4d5d3e[_0xac4c('0xd')]);}switch(_0x302222[_0xac4c('0x5')][_0xac4c('0x6')]()){case _0xac4c('0xe'):case'DELETE':_0x505dca=null;_0x481bde['qs']=_0x1ecae7;break;case _0xac4c('0xf'):case _0xac4c('0x10'):if(_0x302222[_0xac4c('0x11')]){try{_0x505dca=JSON[_0xac4c('0x12')](Mustache['render'](_0x302222['data7'],_0x1ecae7));_0x481bde[_0xac4c('0x13')]=_0x505dca;}catch(_0x3ee796){logger['error'](_0x3ee796['stack']);logger[_0xac4c('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x505dca=_0x1ecae7;_0x481bde[_0xac4c('0x13')]=_0x505dca;}break;}logger['info'](util[_0xac4c('0x14')](_0xac4c('0x15'),_0x302222['data1'],_0x302222[_0xac4c('0x16')],JSON[_0xac4c('0x17')](_0x481bde)));rp(_0x481bde)[_0xac4c('0x18')](function(_0x90ec0f){_0x505dca=!_[_0xac4c('0x19')](_0x505dca)?_0xac4c('0x1a')+_0x505dca:'';_0x4b3262=typeof _0x90ec0f[_0xac4c('0x13')]===_0xac4c('0x1b')?JSON[_0xac4c('0x17')](_0x90ec0f[_0xac4c('0x13')]):_0x90ec0f[_0xac4c('0x13')];logger[_0xac4c('0x1c')](util[_0xac4c('0x14')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x302222[_0xac4c('0x5')],_0x302222[_0xac4c('0x16')],_0x90ec0f[_0xac4c('0x1d')],_0x4b3262));})['catch'](function(_0x3a21a0){logger[_0xac4c('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x302222[_0xac4c('0x5')],_0x302222[_0xac4c('0x16')],_0x3a21a0[_0xac4c('0x1d')],_0x3a21a0[_0xac4c('0x1e')],_0x3a21a0[_0xac4c('0x1f')]));});}; \ No newline at end of file +var _0x9819=['object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','lodash','../../../../config/logger','trigger','exec','data1','render','data2','data5','headers','parse','data6','error','stack','POST','data7','body','format','stringify','isNil',',\x20request\x20body:\x20'];(function(_0x3ac94e,_0x5509c4){var _0x4b11e0=function(_0x17ff69){while(--_0x17ff69){_0x3ac94e['push'](_0x3ac94e['shift']());}};_0x4b11e0(++_0x5509c4);}(_0x9819,0x1c7));var _0x9981=function(_0x1d053c,_0xbf5dd5){_0x1d053c=_0x1d053c-0x0;var _0x4391ab=_0x9819[_0x1d053c];return _0x4391ab;};'use strict';var rp=require('request-promise');var util=require(_0x9981('0x0'));var _=require(_0x9981('0x1'));var Mustache=require('mustache');var logger=require(_0x9981('0x2'))(_0x9981('0x3'));exports[_0x9981('0x4')]=function(_0x3d82a7,_0xbee4db){var _0x44adb5,_0x801ef4;var _0x254b30={'method':_0x3d82a7[_0x9981('0x5')]['toUpperCase'](),'uri':Mustache[_0x9981('0x6')](_0x3d82a7[_0x9981('0x7')],_0xbee4db),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3d82a7[_0x9981('0x8')])==='number'&&parseInt(_0x3d82a7[_0x9981('0x8')])>=0x1&&parseInt(_0x3d82a7[_0x9981('0x8')])<=0xa?parseInt(_0x3d82a7[_0x9981('0x8')])*0x3e8:0x5*0x3e8};try{_0x254b30[_0x9981('0x9')]=_0x3d82a7['data6']?JSON[_0x9981('0xa')](Mustache['render'](_0x3d82a7[_0x9981('0xb')],_0xbee4db)):{};}catch(_0x8f1751){logger[_0x9981('0xc')](_0x8f1751[_0x9981('0xd')]);}switch(_0x3d82a7[_0x9981('0x5')]['toUpperCase']()){case'GET':case'DELETE':_0x44adb5=null;_0x254b30['qs']=_0xbee4db;break;case _0x9981('0xe'):case'PUT':if(_0x3d82a7[_0x9981('0xf')]){try{_0x44adb5=JSON[_0x9981('0xa')](Mustache[_0x9981('0x6')](_0x3d82a7[_0x9981('0xf')],_0xbee4db));_0x254b30[_0x9981('0x10')]=_0x44adb5;}catch(_0x316ae9){logger['error'](_0x316ae9[_0x9981('0xd')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x44adb5=_0xbee4db;_0x254b30[_0x9981('0x10')]=_0x44adb5;}break;}logger['info'](util[_0x9981('0x11')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3d82a7[_0x9981('0x5')],_0x3d82a7['data2'],JSON[_0x9981('0x12')](_0x254b30)));rp(_0x254b30)['then'](function(_0x55539f){_0x44adb5=!_[_0x9981('0x13')](_0x44adb5)?_0x9981('0x14')+_0x44adb5:'';_0x801ef4=typeof _0x55539f[_0x9981('0x10')]===_0x9981('0x15')?JSON[_0x9981('0x12')](_0x55539f[_0x9981('0x10')]):_0x55539f[_0x9981('0x10')];logger[_0x9981('0x16')](util[_0x9981('0x11')](_0x9981('0x17'),_0x3d82a7[_0x9981('0x5')],_0x3d82a7[_0x9981('0x7')],_0x55539f[_0x9981('0x18')],_0x801ef4));})[_0x9981('0x19')](function(_0x513c38){logger[_0x9981('0xc')](util[_0x9981('0x11')](_0x9981('0x1a'),_0x3d82a7[_0x9981('0x5')],_0x3d82a7[_0x9981('0x7')],_0x513c38[_0x9981('0x18')],_0x513c38[_0x9981('0x1b')],_0x513c38['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 0e0854c..d33ca86 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 _0x2741=['rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','debug','error'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x2741,0x18b));var _0x1274=function(_0x291abe,_0x50c04a){_0x291abe=_0x291abe-0x0;var _0x1a7fb6=_0x2741[_0x291abe];return _0x1a7fb6;};'use strict';var jayson=require(_0x1274('0x0'));var BPromise=require(_0x1274('0x1'));var logger=require(_0x1274('0x2'))(_0x1274('0x3'));var client=jayson[_0x1274('0x4')][_0x1274('0x5')]({'port':0x2329});client[_0x1274('0x6')]=function(_0x45f98f,_0x292a1d){return new BPromise(function(_0x1cc11a,_0x2eb413){return client[_0x1274('0x7')](_0x45f98f,_0x292a1d)['then'](function(_0x10dbfd){logger[_0x1274('0x8')]('rpc',_0x1274('0x3'),_0x45f98f,_0x292a1d,_0x10dbfd);if(_0x10dbfd['error']){logger[_0x1274('0x9')](_0x1274('0xa'),_0x1274('0x3'),_0x45f98f,_0x10dbfd[_0x1274('0x9')][_0x1274('0xb')],_0x292a1d);return _0x2eb413(_0x10dbfd['error']['message']);}else{return _0x1cc11a(_0x10dbfd[_0x1274('0xc')]);}})[_0x1274('0xd')](function(_0x5b9dc5){logger[_0x1274('0x9')](_0x1274('0xa'),_0x1274('0x3'),_0x45f98f,_0x5b9dc5,_0x292a1d);return _0x2eb413(_0x5b9dc5);});});};module[_0x1274('0xe')]=client; \ No newline at end of file +var _0xee6e=['exports','jayson/promise','bluebird','routing','Request','request','then','debug','rpc','error','message','result','catch'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xee6e,0xaa));var _0xeee6=function(_0x110b01,_0x3109ba){_0x110b01=_0x110b01-0x0;var _0x169a5b=_0xee6e[_0x110b01];return _0x169a5b;};'use strict';var jayson=require(_0xeee6('0x0'));var BPromise=require(_0xeee6('0x1'));var logger=require('../../config/logger')(_0xeee6('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0xeee6('0x3')]=function(_0x4f0c59,_0x44a461){return new BPromise(function(_0x7292e2,_0x5c99fa){return client[_0xeee6('0x4')](_0x4f0c59,_0x44a461)[_0xeee6('0x5')](function(_0x16e962){logger[_0xeee6('0x6')](_0xeee6('0x7'),_0xeee6('0x2'),_0x4f0c59,_0x44a461,_0x16e962);if(_0x16e962[_0xeee6('0x8')]){logger[_0xeee6('0x8')](_0xeee6('0x7'),_0xeee6('0x2'),_0x4f0c59,_0x16e962[_0xeee6('0x8')][_0xeee6('0x9')],_0x44a461);return _0x5c99fa(_0x16e962['error'][_0xeee6('0x9')]);}else{return _0x7292e2(_0x16e962[_0xeee6('0xa')]);}})[_0xeee6('0xb')](function(_0x2e0286){logger['error']('rpc',_0xeee6('0x2'),_0x4f0c59,_0x2e0286,_0x44a461);return _0x5c99fa(_0x2e0286);});});};module[_0xeee6('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9113cc9..692dc7c 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 _0xb0b2=['Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','catch'];(function(_0x135893,_0x513d45){var _0x53aca3=function(_0x54551c){while(--_0x54551c){_0x135893['push'](_0x135893['shift']());}};_0x53aca3(++_0x513d45);}(_0xb0b2,0x15f));var _0x2b0b=function(_0x5e8a6c,_0x493d1f){_0x5e8a6c=_0x5e8a6c-0x0;var _0x14b856=_0xb0b2[_0x5e8a6c];return _0x14b856;};'use strict';var server=require(_0x2b0b('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x2b0b('0x1'));var mailAccount=require(_0x2b0b('0x2'));var setting=require(_0x2b0b('0x3'));var logger=require(_0x2b0b('0x4'))(_0x2b0b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x2b0b('0x6')](mailAccount[_0x2b0b('0x7')]())[_0x2b0b('0x6')](realtime[_0x2b0b('0x8')]())['then'](function(){email[_0x2b0b('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2b0b('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0x2b0b('0x6')](function(){return setting[_0x2b0b('0xb')]();})['then'](function(_0x14fbcd){return setInterval(initRealtime,_0x14fbcd['loginMailFrequency']*0x3e8);})[_0x2b0b('0xc')](function(_0x45a1ca){logger['error'](_0x2b0b('0xd'),_0x45a1ca);});}main(); \ No newline at end of file +var _0xcebe=['catch','error','./server','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xcebe,0x80));var _0xeceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcebe[_0x3dd15e];return _0x231fd0;};'use strict';var server=require(_0xeceb('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xeceb('0x1'));var mailAccount=require(_0xeceb('0x2'));var setting=require('./rpc/setting');var logger=require(_0xeceb('0x3'))(_0xeceb('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xeceb('0x5')]()[_0xeceb('0x6')](mailAccount[_0xeceb('0x7')]())[_0xeceb('0x6')](realtime[_0xeceb('0x8')]())['then'](function(){email[_0xeceb('0x9')](realtime[_0xeceb('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xeceb('0x6')](function(){return initRealtime();})[_0xeceb('0x6')](function(){return setting[_0xeceb('0xb')]();})[_0xeceb('0x6')](function(_0x1abad7){return setInterval(initRealtime,_0x1abad7['loginMailFrequency']*0x3e8);})[_0xeceb('0xc')](function(_0x25a5ff){logger[_0xeceb('0xd')]('Email\x20service\x20initialization',_0x25a5ff);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ec41c29..6374e5a 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 _0x0a90=['ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','stringify','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','isNil','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','lastSync','verifySmtp','Smtp','verify','then','lodash','moment','bluebird','md5'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a90,0x17d));var _0x00a9=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x0a90[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x00a9('0x0'));var moment=require(_0x00a9('0x1'));var BPromise=require(_0x00a9('0x2'));var md5=require(_0x00a9('0x3'));var Redis=require(_0x00a9('0x4'));var config=require(_0x00a9('0x5'));var logger=require(_0x00a9('0x6'))(_0x00a9('0x7'));config[_0x00a9('0x8')]=_[_0x00a9('0x9')](config[_0x00a9('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x00a9('0x8')]));var EmailImap=require(_0x00a9('0xa'));var EmailSmtp=require(_0x00a9('0xb'));var mailAccount=require(_0x00a9('0xc'));var md5Accounts={};function EmailChannel(_0x228b73){logger[_0x00a9('0xd')]('start\x20email\x20channel');this[_0x00a9('0xe')]=_0x228b73[_0x00a9('0xe')];this[_0x00a9('0xf')]={};this[_0x00a9('0x10')]=new EmailSmtp();}EmailChannel[_0x00a9('0x11')][_0x00a9('0x12')]=function(_0x5c7f0c){var _0x2d7722=this[_0x00a9('0xe')][_0x5c7f0c];var _0x2a3919={'id':_0x2d7722['id'],'name':_0x2d7722[_0x00a9('0x13')],'key':_0x2d7722['key'],'active':_0x2d7722[_0x00a9('0x14')],'Imap':{'status':_0x2d7722[_0x00a9('0x15')][_0x00a9('0x16')],'messageStatus':_0x2d7722['Imap'][_0x00a9('0x17')],'total':_0x2d7722[_0x00a9('0x15')]['total']}};if(_['isNil'](md5Accounts[_0x5c7f0c])){md5Accounts[_0x5c7f0c]={};}var _0x12521d=md5(JSON[_0x00a9('0x18')](_0x2a3919));if(md5Accounts[_0x5c7f0c][_0x00a9('0x3')]!==_0x12521d){md5Accounts[_0x5c7f0c][_0x00a9('0x3')]=_0x12521d;io['emit']('mailAccount:update',_0x2a3919);}};EmailChannel['prototype'][_0x00a9('0x19')]=function(_0x27f779){for(var _0x3d776e in _0x27f779){if(_0x27f779[_0x00a9('0x1a')](_0x3d776e)){if(_0x27f779[_0x3d776e]['Imap']&&_0x27f779[_0x3d776e][_0x00a9('0x14')]){var _0x3b759f=_0x27f779[_0x3d776e][_0x00a9('0x15')];if(!_0x3b759f[_0x00a9('0x1b')]&&_0x27f779[_0x3d776e][_0x00a9('0x1c')]!==_0x00a9('0x1d'))_0x3b759f[_0x00a9('0x1b')]=_0x27f779[_0x3d776e]['provider'];if(!this[_0x00a9('0xf')][_0x00a9('0x1a')](_0x3b759f['id'])){this['imapAccounts'][_0x3b759f['id']]=new EmailImap(_0x3b759f,_0x27f779[_0x3d776e][_0x00a9('0x7')]);this[_0x00a9('0xf')][_0x3b759f['id']]['on'](_0x00a9('0x1e'),this[_0x00a9('0x1f')][_0x00a9('0x20')](this,_0x3d776e));this[_0x00a9('0xf')][_0x3b759f['id']]['on'](_0x00a9('0x7'),this[_0x00a9('0x21')][_0x00a9('0x20')](this,_0x3d776e));this[_0x00a9('0xf')][_0x3b759f['id']]['on'](_0x00a9('0x22'),this['handleImapEnd'][_0x00a9('0x20')](this,_0x3d776e));this['imapAccounts'][_0x3b759f['id']]['on'](_0x00a9('0x23'),this[_0x00a9('0x24')][_0x00a9('0x20')](this,_0x3d776e));}}else{if(_[_0x00a9('0x25')](this[_0x00a9('0xe')][_0x3d776e][_0x00a9('0x15')])){this[_0x00a9('0xe')][_0x3d776e][_0x00a9('0x15')]={};}this['mailAccounts'][_0x3d776e]['Imap'][_0x00a9('0x16')]=_0x00a9('0x26');this['mailAccounts'][_0x3d776e][_0x00a9('0x15')][_0x00a9('0x17')]='';this['emit'](_0x3d776e);}}}};EmailChannel[_0x00a9('0x11')][_0x00a9('0x1f')]=function(_0x68c8c5,_0x434fc8){if(this[_0x00a9('0xe')][_0x68c8c5]){this[_0x00a9('0xe')][_0x68c8c5][_0x00a9('0x15')][_0x00a9('0x16')]=_0x00a9('0x27');this['mailAccounts'][_0x68c8c5][_0x00a9('0x15')]['messageStatus']=_0x434fc8['name'];if(_0x434fc8[_0x00a9('0x28')]){this['mailAccounts'][_0x68c8c5][_0x00a9('0x15')][_0x00a9('0x29')]=_0x434fc8[_0x00a9('0x28')][_0x00a9('0x29')];}return this[_0x00a9('0x12')](_0x68c8c5);}};EmailChannel[_0x00a9('0x11')][_0x00a9('0x21')]=function(_0x41261f,_0x7bcb1e){logger[_0x00a9('0xd')](_0x00a9('0x2a'),_0x7bcb1e[_0x00a9('0x2b')],_0x7bcb1e[_0x00a9('0x2c')],_0x7bcb1e[_0x00a9('0x2d')],_0x41261f);if(this[_0x00a9('0xe')][_0x41261f]){return mailAccount[_0x00a9('0x2e')](_0x41261f,_0x7bcb1e)['then'](function(_0x1345ad){if(_0x1345ad){logger[_0x00a9('0xd')](_0x00a9('0x2f'));}})[_0x00a9('0x30')](function(_0xe727e8){logger[_0x00a9('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x00a9('0x18')](_0xe727e8));});}};EmailChannel[_0x00a9('0x11')][_0x00a9('0x31')]=function(_0x53faca){if(this[_0x00a9('0xe')][_0x53faca]&&this['mailAccounts'][_0x53faca][_0x00a9('0x15')]){if(this['imapAccounts'][this[_0x00a9('0xe')][_0x53faca][_0x00a9('0x15')]['id']]){delete this[_0x00a9('0xf')][this[_0x00a9('0xe')][_0x53faca]['Imap']['id']];}this[_0x00a9('0xe')][_0x53faca][_0x00a9('0x15')][_0x00a9('0x32')]=moment();this[_0x00a9('0x12')](_0x53faca);}};EmailChannel['prototype']['handleImapError']=function(_0x524fc1,_0x26548b){if(this['mailAccounts'][_0x524fc1]){this[_0x00a9('0xe')][_0x524fc1]['Imap'][_0x00a9('0x16')]='error';this[_0x00a9('0xe')][_0x524fc1]['Imap']['messageStatus']=_0x26548b;return this[_0x00a9('0x12')](_0x524fc1);}};EmailChannel[_0x00a9('0x11')]['sendMail']=function(_0x514b1a,_0x216018){return this[_0x00a9('0x10')]['send'](_0x514b1a,_0x216018);};EmailChannel['prototype'][_0x00a9('0x33')]=function(_0x2993ff){var _0x47a2fc=this;if(this['mailAccounts'][_0x2993ff['id']]){if(_[_0x00a9('0x25')](this['mailAccounts'][_0x2993ff['id']]['Smtp'])){this[_0x00a9('0xe')][_0x2993ff['id']]['Smtp']={};}this[_0x00a9('0xe')][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x32')]=moment();return new BPromise(function(_0x1eda4b,_0x389c91){return _0x47a2fc[_0x00a9('0x10')][_0x00a9('0x35')](_0x2993ff)[_0x00a9('0x36')](function(_0xb95676){_0x47a2fc[_0x00a9('0xe')][_0x2993ff['id']]['Smtp'][_0x00a9('0x16')]='verified';_0x47a2fc[_0x00a9('0xe')][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x17')]='';_0x47a2fc['emit'](_0x2993ff['id']);_0x1eda4b(_0xb95676);})[_0x00a9('0x30')](function(_0x3a7ebb){_0x47a2fc['mailAccounts'][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x16')]=_0x00a9('0x23');_0x47a2fc[_0x00a9('0xe')][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x17')]=_0x3a7ebb;_0x47a2fc[_0x00a9('0x12')](_0x2993ff['id']);_0x389c91(_0x3a7ebb);});});}return this[_0x00a9('0x10')][_0x00a9('0x35')](_0x2993ff);};module['exports']=EmailChannel; \ No newline at end of file +var _0x992d=['bind','end','error','handleImapError','disabled','messageStatus','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','verifySmtp','Smtp','verify','exports','lodash','moment','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','total','isNil','stringify','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x992d,0x12a));var _0xd992=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x992d[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xd992('0x0'));var moment=require(_0xd992('0x1'));var BPromise=require('bluebird');var md5=require(_0xd992('0x2'));var Redis=require(_0xd992('0x3'));var config=require('../../../config/environment');var logger=require(_0xd992('0x4'))(_0xd992('0x5'));config[_0xd992('0x6')]=_[_0xd992('0x7')](config['redis'],{'host':_0xd992('0x8'),'port':0x18eb});var io=require(_0xd992('0x9'))(new Redis(config[_0xd992('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xd992('0xa'));var mailAccount=require(_0xd992('0xb'));var md5Accounts={};function EmailChannel(_0x401295){logger['info'](_0xd992('0xc'));this[_0xd992('0xd')]=_0x401295[_0xd992('0xd')];this[_0xd992('0xe')]={};this[_0xd992('0xf')]=new EmailSmtp();}EmailChannel[_0xd992('0x10')][_0xd992('0x11')]=function(_0x1c94fb){var _0x37352d=this[_0xd992('0xd')][_0x1c94fb];var _0x1eaf3a={'id':_0x37352d['id'],'name':_0x37352d['name'],'key':_0x37352d[_0xd992('0x12')],'active':_0x37352d[_0xd992('0x13')],'Imap':{'status':_0x37352d[_0xd992('0x14')][_0xd992('0x15')],'messageStatus':_0x37352d[_0xd992('0x14')]['messageStatus'],'total':_0x37352d[_0xd992('0x14')][_0xd992('0x16')]}};if(_[_0xd992('0x17')](md5Accounts[_0x1c94fb])){md5Accounts[_0x1c94fb]={};}var _0x5a2f3b=md5(JSON[_0xd992('0x18')](_0x1eaf3a));if(md5Accounts[_0x1c94fb][_0xd992('0x2')]!==_0x5a2f3b){md5Accounts[_0x1c94fb][_0xd992('0x2')]=_0x5a2f3b;io['emit']('mailAccount:update',_0x1eaf3a);}};EmailChannel[_0xd992('0x10')][_0xd992('0x19')]=function(_0x2ad0cb){for(var _0x2a45c7 in _0x2ad0cb){if(_0x2ad0cb[_0xd992('0x1a')](_0x2a45c7)){if(_0x2ad0cb[_0x2a45c7][_0xd992('0x14')]&&_0x2ad0cb[_0x2a45c7]['active']){var _0x59c6c2=_0x2ad0cb[_0x2a45c7][_0xd992('0x14')];if(!_0x59c6c2['service']&&_0x2ad0cb[_0x2a45c7][_0xd992('0x1b')]!==_0xd992('0x1c'))_0x59c6c2[_0xd992('0x1d')]=_0x2ad0cb[_0x2a45c7][_0xd992('0x1b')];if(!this['imapAccounts']['hasOwnProperty'](_0x59c6c2['id'])){this['imapAccounts'][_0x59c6c2['id']]=new EmailImap(_0x59c6c2,_0x2ad0cb[_0x2a45c7][_0xd992('0x5')]);this['imapAccounts'][_0x59c6c2['id']]['on'](_0xd992('0x1e'),this[_0xd992('0x1f')]['bind'](this,_0x2a45c7));this[_0xd992('0xe')][_0x59c6c2['id']]['on']('email',this['handleImapEmail'][_0xd992('0x20')](this,_0x2a45c7));this['imapAccounts'][_0x59c6c2['id']]['on'](_0xd992('0x21'),this['handleImapEnd']['bind'](this,_0x2a45c7));this[_0xd992('0xe')][_0x59c6c2['id']]['on'](_0xd992('0x22'),this[_0xd992('0x23')][_0xd992('0x20')](this,_0x2a45c7));}}else{if(_['isNil'](this['mailAccounts'][_0x2a45c7][_0xd992('0x14')])){this[_0xd992('0xd')][_0x2a45c7]['Imap']={};}this[_0xd992('0xd')][_0x2a45c7]['Imap'][_0xd992('0x15')]=_0xd992('0x24');this['mailAccounts'][_0x2a45c7][_0xd992('0x14')][_0xd992('0x25')]='';this[_0xd992('0x11')](_0x2a45c7);}}}};EmailChannel['prototype'][_0xd992('0x1f')]=function(_0x51b9a4,_0x390b27){if(this[_0xd992('0xd')][_0x51b9a4]){this[_0xd992('0xd')][_0x51b9a4]['Imap']['status']=_0xd992('0x26');this[_0xd992('0xd')][_0x51b9a4][_0xd992('0x14')]['messageStatus']=_0x390b27[_0xd992('0x27')];if(_0x390b27[_0xd992('0x28')]){this['mailAccounts'][_0x51b9a4][_0xd992('0x14')][_0xd992('0x16')]=_0x390b27[_0xd992('0x28')][_0xd992('0x16')];}return this[_0xd992('0x11')](_0x51b9a4);}};EmailChannel[_0xd992('0x10')]['handleImapEmail']=function(_0x23aa69,_0x2a9f1c){logger['info'](_0xd992('0x29'),_0x2a9f1c[_0xd992('0x2a')],_0x2a9f1c[_0xd992('0x2b')],_0x2a9f1c['from'],_0x23aa69);if(this[_0xd992('0xd')][_0x23aa69]){return mailAccount[_0xd992('0x2c')](_0x23aa69,_0x2a9f1c)[_0xd992('0x2d')](function(_0xb32de4){if(_0xb32de4){logger[_0xd992('0x2e')](_0xd992('0x2f'));}})[_0xd992('0x30')](function(_0x256829){logger[_0xd992('0x22')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xd992('0x18')](_0x256829));});}};EmailChannel[_0xd992('0x10')]['handleImapEnd']=function(_0x499973){if(this[_0xd992('0xd')][_0x499973]&&this[_0xd992('0xd')][_0x499973][_0xd992('0x14')]){if(this[_0xd992('0xe')][this[_0xd992('0xd')][_0x499973][_0xd992('0x14')]['id']]){delete this[_0xd992('0xe')][this[_0xd992('0xd')][_0x499973][_0xd992('0x14')]['id']];}this[_0xd992('0xd')][_0x499973][_0xd992('0x14')][_0xd992('0x31')]=moment();this[_0xd992('0x11')](_0x499973);}};EmailChannel[_0xd992('0x10')][_0xd992('0x23')]=function(_0x5a36e3,_0x2b1af9){if(this[_0xd992('0xd')][_0x5a36e3]){this[_0xd992('0xd')][_0x5a36e3][_0xd992('0x14')][_0xd992('0x15')]=_0xd992('0x22');this[_0xd992('0xd')][_0x5a36e3][_0xd992('0x14')][_0xd992('0x25')]=_0x2b1af9;return this[_0xd992('0x11')](_0x5a36e3);}};EmailChannel['prototype'][_0xd992('0x32')]=function(_0x2a4b0b,_0x5ae055){return this[_0xd992('0xf')]['send'](_0x2a4b0b,_0x5ae055);};EmailChannel['prototype'][_0xd992('0x33')]=function(_0x52686f){var _0xe1f4bf=this;if(this[_0xd992('0xd')][_0x52686f['id']]){if(_['isNil'](this['mailAccounts'][_0x52686f['id']][_0xd992('0x34')])){this['mailAccounts'][_0x52686f['id']][_0xd992('0x34')]={};}this['mailAccounts'][_0x52686f['id']][_0xd992('0x34')][_0xd992('0x31')]=moment();return new BPromise(function(_0x11d0cb,_0x1aaa14){return _0xe1f4bf[_0xd992('0xf')]['verify'](_0x52686f)['then'](function(_0x281096){_0xe1f4bf[_0xd992('0xd')][_0x52686f['id']][_0xd992('0x34')][_0xd992('0x15')]='verified';_0xe1f4bf[_0xd992('0xd')][_0x52686f['id']][_0xd992('0x34')]['messageStatus']='';_0xe1f4bf[_0xd992('0x11')](_0x52686f['id']);_0x11d0cb(_0x281096);})[_0xd992('0x30')](function(_0x416f03){_0xe1f4bf[_0xd992('0xd')][_0x52686f['id']]['Smtp'][_0xd992('0x15')]=_0xd992('0x22');_0xe1f4bf[_0xd992('0xd')][_0x52686f['id']][_0xd992('0x34')][_0xd992('0x25')]=_0x416f03;_0xe1f4bf[_0xd992('0x11')](_0x52686f['id']);_0x1aaa14(_0x416f03);});});}return this[_0xd992('0xf')][_0xd992('0x35')](_0x52686f);};module[_0xd992('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 5cd6e28..3022d81 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 _0xad79=['\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','text','substring','parser','handleEnd','stringify','textCode','exports','lodash','imap','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','email','../../../config/environment','mailbox','account','getAccount','once','ready','handleReady','end','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','html','isNil','warn','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes,\x20email\x20size:\x20','\x20bytes'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xad79,0x1b3));var _0x9ad7=function(_0x10786c,_0x4a64c8){_0x10786c=_0x10786c-0x0;var _0x48c23f=_0xad79[_0x10786c];return _0x48c23f;};'use strict';var _=require(_0x9ad7('0x0'));var util=require('util');var Imap=require(_0x9ad7('0x1'));var simpleParser=require(_0x9ad7('0x2'))[_0x9ad7('0x3')];var Iconv=require(_0x9ad7('0x4'))['Iconv'];var EventEmitter=require(_0x9ad7('0x5'))[_0x9ad7('0x6')];var utils=require('./utils');var logger=require(_0x9ad7('0x7'))(_0x9ad7('0x8'));var config=require(_0x9ad7('0x9'));const MAX_HTML_BYTES_SIZE=config['emailMaxHTMLbytesLimit']||0xee6b2800;function EmailImap(_0x15dcd0,_0x437602){this[_0x9ad7('0xa')]=_0x15dcd0[_0x9ad7('0xa')];this[_0x9ad7('0xb')]=this[_0x9ad7('0xc')](_0x15dcd0,_0x437602);this[_0x9ad7('0x1')]=new Imap(this[_0x9ad7('0xb')]);this['imap'][_0x9ad7('0xd')](_0x9ad7('0xe'),this[_0x9ad7('0xf')]['bind'](this));this[_0x9ad7('0x1')][_0x9ad7('0xd')](_0x9ad7('0x10'),this['handleEnd'][_0x9ad7('0x11')](this));this[_0x9ad7('0x1')]['on'](_0x9ad7('0x12'),this[_0x9ad7('0x13')]['bind'](this));this[_0x9ad7('0x1')][_0x9ad7('0x14')]();}util[_0x9ad7('0x15')](EmailImap,EventEmitter);EmailImap[_0x9ad7('0x16')][_0x9ad7('0xc')]=function(_0x58450f,_0x378d98){var _0x47463c={'connTimeout':_0x58450f[_0x9ad7('0x17')]?_0x58450f[_0x9ad7('0x17')]*0x3e8:0x2710,'authTimeout':_0x58450f[_0x9ad7('0x18')]?_0x58450f[_0x9ad7('0x18')]*0x3e8:0x1388};if(_0x58450f['service']){_0x47463c[_0x9ad7('0x19')]=_0x58450f[_0x9ad7('0x19')];if(_0x58450f[_0x9ad7('0x1a')]){_0x47463c[_0x9ad7('0x1b')]=utils[_0x9ad7('0x1c')](_0x58450f[_0x9ad7('0x1d')][_0x9ad7('0x1e')],_0x58450f['user']);}else{_0x47463c[_0x9ad7('0x1f')]=_0x58450f[_0x9ad7('0x1f')];}}else{if(_0x58450f[_0x9ad7('0x20')]){_0x47463c[_0x9ad7('0x19')]=_0x58450f['user'];_0x47463c[_0x9ad7('0x1f')]=_0x58450f[_0x9ad7('0x1f')];}}_0x47463c['email']=_0x378d98||_0x58450f['user']||'anonymous@xcally.com';_0x47463c['host']=_0x58450f[_0x9ad7('0x21')];_0x47463c[_0x9ad7('0x22')]=_0x58450f[_0x9ad7('0x22')]||0x3e1;if(_0x58450f[_0x9ad7('0x23')]){_0x47463c[_0x9ad7('0x23')]=!![];}else{_0x47463c['tls']=![];_0x47463c[_0x9ad7('0x24')]=_0x9ad7('0x25');}return _0x47463c;};EmailImap[_0x9ad7('0x16')][_0x9ad7('0xf')]=function(){this[_0x9ad7('0x1')]['openBox'](this['mailbox'],![],this[_0x9ad7('0x26')][_0x9ad7('0x11')](this));};EmailImap['prototype'][_0x9ad7('0x26')]=function(_0x132087,_0xe3d4c8){if(_0x132087){this[_0x9ad7('0x13')](_0x132087,!![]);}else{this[_0x9ad7('0x27')](_0x9ad7('0x28'),_0xe3d4c8);this[_0x9ad7('0x29')]();}};EmailImap['prototype'][_0x9ad7('0x2a')]=function(_0x217c8f){if(_0x217c8f){this[_0x9ad7('0x13')](_0x217c8f,!![]);}else{this[_0x9ad7('0x1')][_0x9ad7('0x10')]();this['emit'](_0x9ad7('0x10'));}};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x29')]=function(){this['imap'][_0x9ad7('0x2b')](['UNSEEN'],this[_0x9ad7('0x2c')][_0x9ad7('0x11')](this));};EmailImap[_0x9ad7('0x16')]['handleReadUnseen']=function(_0x34f2d4,_0x98247b){if(_0x34f2d4){this[_0x9ad7('0x13')](_0x34f2d4,!![]);}else{if(_0x98247b[_0x9ad7('0x2d')]){try{var _0x40cf69=this[_0x9ad7('0x1')][_0x9ad7('0x2e')](_0x98247b['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x40cf69['on'](_0x9ad7('0x2f'),this[_0x9ad7('0x30')][_0x9ad7('0x11')](this));_0x40cf69['once'](_0x9ad7('0x12'),this[_0x9ad7('0x31')][_0x9ad7('0x11')](this));_0x40cf69['once'](_0x9ad7('0x10'),this[_0x9ad7('0x32')][_0x9ad7('0x11')](this));}catch(_0x5addf5){logger[_0x9ad7('0x12')](_0x9ad7('0x2c'),this['account']['email'],_0x5addf5);this[_0x9ad7('0x1')][_0x9ad7('0x33')](!![],this[_0x9ad7('0x2a')][_0x9ad7('0x11')](this));}}else{this[_0x9ad7('0x1')][_0x9ad7('0x33')](!![],this[_0x9ad7('0x2a')][_0x9ad7('0x11')](this));}}};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x30')]=function(_0x14e2f6){_0x14e2f6['on'](_0x9ad7('0x34'),this['handleMessageBody'][_0x9ad7('0x11')](this));_0x14e2f6[_0x9ad7('0xd')]('attributes',this[_0x9ad7('0x35')][_0x9ad7('0x11')](this));_0x14e2f6[_0x9ad7('0xd')](_0x9ad7('0x10'),this[_0x9ad7('0x36')][_0x9ad7('0x11')](this));};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x37')]=function(_0x5b7050){simpleParser(_0x5b7050,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x35')]=function(){};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x36')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x58fde4,_0xb1be00){if(_0x58fde4){logger[_0x9ad7('0x12')](_0x58fde4);}else{var _0x46f290=this;if(_0xb1be00['hasOwnProperty'](_0x9ad7('0x38'))){const _0x359bca=_0xb1be00[_0x9ad7('0x38')][_0x9ad7('0x2d')];if(!_[_0x9ad7('0x39')](_0x359bca)){if(MAX_HTML_BYTES_SIZE<_0x359bca){logger[_0x9ad7('0x3a')](_0x9ad7('0x3b')+MAX_HTML_BYTES_SIZE+_0x9ad7('0x3c')+_0xb1be00[_0x9ad7('0x38')][_0x9ad7('0x2d')]+_0x9ad7('0x3d'));const _0x590457=_0x9ad7('0x3e')+MAX_HTML_BYTES_SIZE+_0x9ad7('0x3f');if(_0xb1be00['hasOwnProperty'](_0x9ad7('0x40'))){const _0xa3ff2e=_0xb1be00[_0x9ad7('0x40')][_0x9ad7('0x41')](0x0,MAX_HTML_BYTES_SIZE);_0xb1be00[_0x9ad7('0x40')]=_0xa3ff2e+_0x590457;_0xb1be00[_0x9ad7('0x38')]=_0xa3ff2e+_0x590457;}else{const _0x5e52c9=_0xb1be00[_0x9ad7('0x38')][_0x9ad7('0x41')](0x0,MAX_HTML_BYTES_SIZE);_0xb1be00[_0x9ad7('0x38')]=_0x5e52c9+_0x590457;}}}}utils[_0x9ad7('0x42')](this[_0x9ad7('0xb')],_0xb1be00,function(_0x5d7a4f){_0x46f290['emit']('email',_0x5d7a4f);});}};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x32')]=function(){this[_0x9ad7('0x1')][_0x9ad7('0x33')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x31')]=function(_0x55cb78){this[_0x9ad7('0x13')](_0x55cb78);this[_0x9ad7('0x1')]['closeBox'](!![],this[_0x9ad7('0x2a')]['bind'](this));};EmailImap[_0x9ad7('0x16')][_0x9ad7('0x43')]=function(){this[_0x9ad7('0x27')](_0x9ad7('0x10'));};EmailImap['prototype'][_0x9ad7('0x13')]=function(_0x2f1530,_0xa3fddb){logger[_0x9ad7('0x12')](_0x9ad7('0x13'),this[_0x9ad7('0xb')][_0x9ad7('0x8')],JSON[_0x9ad7('0x44')](_0x2f1530));var _0x3c6076='';if(_0x2f1530){if(_0x2f1530[_0x9ad7('0x45')]){_0x3c6076=_0x2f1530[_0x9ad7('0x45')];}else{for(var _0x5cc7c6 in _0x2f1530){if(_0x2f1530['hasOwnProperty'](_0x5cc7c6)){_0x3c6076+=_['upperFirst'](_0x5cc7c6)+':\x20'+_0x2f1530[_0x5cc7c6]+'\x0a';}}}}if(_0xa3fddb){this['imap']['end']();this[_0x9ad7('0x27')](_0x9ad7('0x10'));}else{this[_0x9ad7('0x27')](_0x9ad7('0x12'),_0x3c6076);this[_0x9ad7('0x27')]('end');}};module[_0x9ad7('0x46')]=EmailImap; \ No newline at end of file +var _0x8026=['tls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','html','isNil','warn','\x20bytes,\x20email\x20size:\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','hasOwnProperty','substring','text','stringify','textCode','upperFirst','exports','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','../../../config/environment','mailbox','account','imap','ready','handleReady','once','end','handleEnd','bind','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8026,0x19e));var _0x6802=function(_0x3aba72,_0x1f4876){_0x3aba72=_0x3aba72-0x0;var _0x59b797=_0x8026[_0x3aba72];return _0x59b797;};'use strict';var _=require(_0x6802('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0x6802('0x1'))[_0x6802('0x2')];var Iconv=require(_0x6802('0x3'))[_0x6802('0x4')];var EventEmitter=require(_0x6802('0x5'))[_0x6802('0x6')];var utils=require(_0x6802('0x7'));var logger=require(_0x6802('0x8'))(_0x6802('0x9'));var config=require(_0x6802('0xa'));const MAX_HTML_BYTES_SIZE=config['emailMaxHTMLbytesLimit']||0xee6b2800;function EmailImap(_0x2611c1,_0x51106c){this['mailbox']=_0x2611c1[_0x6802('0xb')];this[_0x6802('0xc')]=this['getAccount'](_0x2611c1,_0x51106c);this[_0x6802('0xd')]=new Imap(this['account']);this[_0x6802('0xd')]['once'](_0x6802('0xe'),this[_0x6802('0xf')]['bind'](this));this[_0x6802('0xd')][_0x6802('0x10')](_0x6802('0x11'),this[_0x6802('0x12')][_0x6802('0x13')](this));this['imap']['on'](_0x6802('0x14'),this[_0x6802('0x15')][_0x6802('0x13')](this));this['imap']['connect']();}util[_0x6802('0x16')](EmailImap,EventEmitter);EmailImap[_0x6802('0x17')]['getAccount']=function(_0x198330,_0x5f1614){var _0x23bcaa={'connTimeout':_0x198330[_0x6802('0x18')]?_0x198330[_0x6802('0x18')]*0x3e8:0x2710,'authTimeout':_0x198330[_0x6802('0x19')]?_0x198330[_0x6802('0x19')]*0x3e8:0x1388};if(_0x198330[_0x6802('0x1a')]){_0x23bcaa[_0x6802('0x1b')]=_0x198330[_0x6802('0x1b')];if(_0x198330[_0x6802('0x1c')]){_0x23bcaa[_0x6802('0x1d')]=utils[_0x6802('0x1e')](_0x198330[_0x6802('0x1f')]['data5'],_0x198330[_0x6802('0x1b')]);}else{_0x23bcaa['password']=_0x198330[_0x6802('0x20')];}}else{if(_0x198330[_0x6802('0x21')]){_0x23bcaa[_0x6802('0x1b')]=_0x198330['user'];_0x23bcaa[_0x6802('0x20')]=_0x198330[_0x6802('0x20')];}}_0x23bcaa[_0x6802('0x9')]=_0x5f1614||_0x198330[_0x6802('0x1b')]||_0x6802('0x22');_0x23bcaa['host']=_0x198330[_0x6802('0x23')];_0x23bcaa['port']=_0x198330['port']||0x3e1;if(_0x198330[_0x6802('0x24')]){_0x23bcaa['tls']=!![];}else{_0x23bcaa[_0x6802('0x24')]=![];_0x23bcaa['autotls']=_0x6802('0x25');}return _0x23bcaa;};EmailImap[_0x6802('0x17')][_0x6802('0xf')]=function(){this['imap'][_0x6802('0x26')](this[_0x6802('0xb')],![],this[_0x6802('0x27')][_0x6802('0x13')](this));};EmailImap['prototype'][_0x6802('0x27')]=function(_0x53b7e2,_0x582597){if(_0x53b7e2){this[_0x6802('0x15')](_0x53b7e2,!![]);}else{this[_0x6802('0x28')](_0x6802('0x29'),_0x582597);this[_0x6802('0x2a')]();}};EmailImap[_0x6802('0x17')][_0x6802('0x2b')]=function(_0x1a0052){if(_0x1a0052){this[_0x6802('0x15')](_0x1a0052,!![]);}else{this[_0x6802('0xd')]['end']();this[_0x6802('0x28')](_0x6802('0x11'));}};EmailImap['prototype'][_0x6802('0x2a')]=function(){this[_0x6802('0xd')][_0x6802('0x2c')]([_0x6802('0x2d')],this[_0x6802('0x2e')][_0x6802('0x13')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x2a5e1f,_0x2134c5){if(_0x2a5e1f){this[_0x6802('0x15')](_0x2a5e1f,!![]);}else{if(_0x2134c5[_0x6802('0x2f')]){try{var _0x266568=this[_0x6802('0xd')][_0x6802('0x30')](_0x2134c5[_0x6802('0x31')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x266568['on'](_0x6802('0x32'),this[_0x6802('0x33')][_0x6802('0x13')](this));_0x266568[_0x6802('0x10')]('error',this[_0x6802('0x34')]['bind'](this));_0x266568[_0x6802('0x10')](_0x6802('0x11'),this[_0x6802('0x35')]['bind'](this));}catch(_0x247dfe){logger[_0x6802('0x14')](_0x6802('0x2e'),this[_0x6802('0xc')][_0x6802('0x9')],_0x247dfe);this[_0x6802('0xd')][_0x6802('0x36')](!![],this[_0x6802('0x2b')][_0x6802('0x13')](this));}}else{this[_0x6802('0xd')][_0x6802('0x36')](!![],this[_0x6802('0x2b')]['bind'](this));}}};EmailImap['prototype'][_0x6802('0x33')]=function(_0x39b1ff){_0x39b1ff['on'](_0x6802('0x37'),this[_0x6802('0x38')][_0x6802('0x13')](this));_0x39b1ff[_0x6802('0x10')](_0x6802('0x39'),this['handleMessageAttributes'][_0x6802('0x13')](this));_0x39b1ff[_0x6802('0x10')](_0x6802('0x11'),this[_0x6802('0x3a')][_0x6802('0x13')](this));};EmailImap[_0x6802('0x17')][_0x6802('0x38')]=function(_0x58589f){simpleParser(_0x58589f,{'Iconv':Iconv},this[_0x6802('0x3b')]['bind'](this));};EmailImap[_0x6802('0x17')][_0x6802('0x3c')]=function(){};EmailImap[_0x6802('0x17')]['handleMessageEnd']=function(){};EmailImap[_0x6802('0x17')]['handleSimpleParser']=function(_0x3ded6d,_0x1fd140){if(_0x3ded6d){logger[_0x6802('0x14')](_0x3ded6d);}else{var _0x49cefa=this;if(_0x1fd140['hasOwnProperty'](_0x6802('0x3d'))){const _0x181078=_0x1fd140[_0x6802('0x3d')][_0x6802('0x2f')];if(!_[_0x6802('0x3e')](_0x181078)){if(MAX_HTML_BYTES_SIZE<_0x181078){logger[_0x6802('0x3f')]('Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20'+MAX_HTML_BYTES_SIZE+_0x6802('0x40')+_0x1fd140[_0x6802('0x3d')][_0x6802('0x2f')]+_0x6802('0x41'));const _0x48b504=_0x6802('0x42')+MAX_HTML_BYTES_SIZE+_0x6802('0x43');if(_0x1fd140[_0x6802('0x44')]('text')){const _0x3781e4=_0x1fd140['text'][_0x6802('0x45')](0x0,MAX_HTML_BYTES_SIZE);_0x1fd140[_0x6802('0x46')]=_0x3781e4+_0x48b504;_0x1fd140[_0x6802('0x3d')]=_0x3781e4+_0x48b504;}else{const _0x468288=_0x1fd140['html'][_0x6802('0x45')](0x0,MAX_HTML_BYTES_SIZE);_0x1fd140[_0x6802('0x3d')]=_0x468288+_0x48b504;}}}}utils['parser'](this[_0x6802('0xc')],_0x1fd140,function(_0x1097f0){_0x49cefa[_0x6802('0x28')](_0x6802('0x9'),_0x1097f0);});}};EmailImap[_0x6802('0x17')][_0x6802('0x35')]=function(){this['imap']['closeBox'](!![],this[_0x6802('0x2b')]['bind'](this));};EmailImap[_0x6802('0x17')][_0x6802('0x34')]=function(_0x4654a5){this[_0x6802('0x15')](_0x4654a5);this['imap'][_0x6802('0x36')](!![],this[_0x6802('0x2b')][_0x6802('0x13')](this));};EmailImap[_0x6802('0x17')][_0x6802('0x12')]=function(){this[_0x6802('0x28')](_0x6802('0x11'));};EmailImap['prototype'][_0x6802('0x15')]=function(_0x1e4d7a,_0x4dc59a){logger[_0x6802('0x14')](_0x6802('0x15'),this['account']['email'],JSON[_0x6802('0x47')](_0x1e4d7a));var _0x74e53b='';if(_0x1e4d7a){if(_0x1e4d7a[_0x6802('0x48')]){_0x74e53b=_0x1e4d7a['textCode'];}else{for(var _0x33b43f in _0x1e4d7a){if(_0x1e4d7a['hasOwnProperty'](_0x33b43f)){_0x74e53b+=_[_0x6802('0x49')](_0x33b43f)+':\x20'+_0x1e4d7a[_0x33b43f]+'\x0a';}}}}if(_0x4dc59a){this[_0x6802('0xd')][_0x6802('0x11')]();this[_0x6802('0x28')](_0x6802('0x11'));}else{this[_0x6802('0x28')](_0x6802('0x14'),_0x74e53b);this['emit']('end');}};module[_0x6802('0x4a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 22a3453..e11650a 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 _0x3241=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','prototype','verify'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x3241,0x92));var _0x1324=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3241[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0x1324('0x0'));var inlineBase64=require(_0x1324('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x1324('0x2')]=function(_0x849ec8,_0x347327){return new Promise(function(_0x4c69c3,_0x4e3257){var _0x265f98=nodemailer[_0x1324('0x3')](_0x849ec8);_0x265f98[_0x1324('0x4')]('compile',inlineBase64());_0x265f98['sendMail'](_0x347327,function(_0x247e48,_0x5bd400){if(_0x247e48){_0x4e3257(_0x247e48['toString']());}else{_0x4c69c3(_0x5bd400);}});});};EmailSmtp[_0x1324('0x5')][_0x1324('0x6')]=function(_0x367b02){return new Promise(function(_0x143c21,_0x56e1a0){var _0x3775ad=nodemailer['createTransport'](_0x367b02);_0x3775ad['verify'](function(_0x54ad92,_0x39cef7){if(_0x54ad92){_0x56e1a0(_0x54ad92['toString']());}else{if(_0x39cef7){_0x143c21(_0x39cef7);}else{_0x56e1a0(_0x1324('0x7'));}}});});};module[_0x1324('0x8')]=EmailSmtp; \ No newline at end of file +var _0x7c58=['nodemailer-plugin-inline-base64','prototype','send','createTransport','sendMail','toString','verify','exports','nodemailer'];(function(_0xe0ca,_0x51dc5a){var _0x2cccb3=function(_0x5bb56a){while(--_0x5bb56a){_0xe0ca['push'](_0xe0ca['shift']());}};_0x2cccb3(++_0x51dc5a);}(_0x7c58,0x143));var _0x87c5=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x7c58[_0x3070dc];return _0x431489;};'use strict';var nodemailer=require(_0x87c5('0x0'));var inlineBase64=require(_0x87c5('0x1'));function EmailSmtp(){}EmailSmtp[_0x87c5('0x2')][_0x87c5('0x3')]=function(_0x4ca921,_0x1d7633){return new Promise(function(_0x24948c,_0x4d7af7){var _0x58a882=nodemailer[_0x87c5('0x4')](_0x4ca921);_0x58a882['use']('compile',inlineBase64());_0x58a882[_0x87c5('0x5')](_0x1d7633,function(_0x9c6e8f,_0x3c7164){if(_0x9c6e8f){_0x4d7af7(_0x9c6e8f[_0x87c5('0x6')]());}else{_0x24948c(_0x3c7164);}});});};EmailSmtp[_0x87c5('0x2')]['verify']=function(_0x218aca){return new Promise(function(_0x1f332a,_0x23638b){var _0xeaa1c2=nodemailer[_0x87c5('0x4')](_0x218aca);_0xeaa1c2[_0x87c5('0x7')](function(_0x244ce3,_0xfea98e){if(_0x244ce3){_0x23638b(_0x244ce3[_0x87c5('0x6')]());}else{if(_0xfea98e){_0x1f332a(_0xfea98e);}else{_0x23638b('Not\x20verifired');}}});});};module[_0x87c5('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9809aa8..35e93a8 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 _0xd654=['_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','toString','base64','lodash','moment','randomstring','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','test','html','replace','attachments','push','filename','_SRC'];(function(_0x2567c7,_0xf3cb9f){var _0x45fc2d=function(_0x1929f9){while(--_0x1929f9){_0x2567c7['push'](_0x2567c7['shift']());}};_0x45fc2d(++_0xf3cb9f);}(_0xd654,0xbb));var _0x4d65=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd654[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x4d65('0x0'));var moment=require(_0x4d65('0x1'));var random=require(_0x4d65('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x4d65('0x3'));var tnef=require('node-tnef');var logger=require(_0x4d65('0x4'))(_0x4d65('0x5'));var config=require(_0x4d65('0x6'));function getAddress(_0x5e5fe1){var _0x27fa5b=_[_0x4d65('0x7')](_0x5e5fe1[_0x4d65('0x8')]);return _0x27fa5b&&_0x27fa5b[_0x4d65('0x9')]?_0x27fa5b['address']:_0x4d65('0xa')+random[_0x4d65('0xb')](0x6)+_0x4d65('0xc');}function getFirstName(_0x31081d){var _0x1001c6=_[_0x4d65('0x7')](_0x31081d[_0x4d65('0x8')]);if(_0x1001c6&&_0x1001c6[_0x4d65('0xd')]){if(_0x1001c6['name']==_0x1001c6[_0x4d65('0x9')]){return _0x1001c6[_0x4d65('0xd')][_0x4d65('0xe')](0x0,_0x1001c6[_0x4d65('0xd')]['indexOf']('@'));}var _0x4d6974=_0x1001c6[_0x4d65('0xd')][_0x4d65('0xf')](/\s+/);return _0x4d6974[_0x4d65('0x10')]>0x1?_0x4d6974[_0x4d65('0x11')](0x0,-0x1)[_0x4d65('0x12')]('\x20'):_0x1001c6[_0x4d65('0xd')];}return _0x4d65('0x13');}function getLastName(_0x3b5da9){var _0x1dacd3=_[_0x4d65('0x7')](_0x3b5da9[_0x4d65('0x8')]);if(_0x1dacd3&&_0x1dacd3[_0x4d65('0xd')]){var _0x3139fa=_0x1dacd3[_0x4d65('0xd')][_0x4d65('0xf')](/\s+/);return _0x3139fa[_0x4d65('0x10')]>0x1?_0x3139fa[_0x4d65('0x14')]():'';}return'';}function getMails(_0x319c9c,_0x4d8011){var _0x3f9f02='';for(var _0xec97f1=0x0;_0xec97f1<_0x4d8011['value'][_0x4d65('0x10')];_0xec97f1+=0x1){if(_0x4d8011['value'][_0xec97f1][_0x4d65('0x9')]!==_0x319c9c){if(!_[_0x4d65('0x15')](_0x3f9f02)){_0x3f9f02+=',';}_0x3f9f02+=_0x4d8011['value'][_0xec97f1][_0x4d65('0xd')]||_0x4d8011[_0x4d65('0x8')][_0xec97f1]['address']||'';_0x3f9f02+='\x20<';_0x3f9f02+=_0x4d8011[_0x4d65('0x8')][_0xec97f1][_0x4d65('0x9')]?_0x4d8011['value'][_0xec97f1][_0x4d65('0x9')]:'anonymous'+random['generate'](0x6)+_0x4d65('0xc');_0x3f9f02+='>';}}return _0x3f9f02;}function parseEmail(_0x317c06,_0x746d97,_0x3e427f){if(_0x746d97['html']){var _0x3875d3=/)<[^<]*)*<\/script>/gi;while(_0x3875d3[_0x4d65('0x16')](_0x746d97[_0x4d65('0x17')])){_0x746d97[_0x4d65('0x17')]=_0x746d97[_0x4d65('0x17')][_0x4d65('0x18')](_0x3875d3,'');}if(_0x746d97['html']['includes']('{_0x5d660f[_0x4d65('0x1a')](_0xcee350[_0x4d65('0x1b')]);});var _0x3b6bd5=/]+>/g;var _0x39c83e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4ccfbe=_0x746d97[_0x4d65('0x17')][_0x4d65('0x18')](_0x39c83e,_0x4d65('0x1c'));var _0x557ca7=_0x4ccfbe[_0x4d65('0x18')](_0x3b6bd5,'_IMG');for(let _0x419437=0x0;_0x419437<_0x5d660f[_0x4d65('0x10')];_0x419437++){var _0x4df405=_0x557ca7['replace'](_0x4d65('0x1d'),_0x4d65('0x1e')+_0x5d660f[_0x419437]+_0x4d65('0x1f'));_0x557ca7=_0x4df405;}_0x746d97[_0x4d65('0x17')]=_0x557ca7;}_0x3e427f[_0x4d65('0x20')]=_0x746d97[_0x4d65('0x17')];}else{_0x3e427f[_0x4d65('0x20')]=_0x746d97[_0x4d65('0x21')];}if(_0x3e427f[_0x4d65('0x20')]){_0x3e427f[_0x4d65('0x20')]=_0x3e427f[_0x4d65('0x20')][_0x4d65('0x18')](/0x0){var _0x449eb5=[_0x4d65('0x31'),_0x4d65('0x32'),_0x4d65('0x33')];for(var _0x2f3733=0x0;_0x2f3733<_0x746d97['headerLines'][_0x4d65('0x10')];_0x2f3733++){var _0x43e361=_[_0x4d65('0x34')](_0x449eb5,_0x746d97['headerLines'][_0x2f3733]['line']);if(_0x43e361>=0x0){_0x3e427f[_0x4d65('0x35')]=!![];}}}return _0x3e427f;}exports[_0x4d65('0x36')]=function(_0x9f48e,_0x272009,_0x27c465){var _0x3a55cd={'from':getAddress(_0x272009[_0x4d65('0x37')]),'firstName':getFirstName(_0x272009[_0x4d65('0x37')]),'lastName':getLastName(_0x272009[_0x4d65('0x37')]),'mapKey':_0x4d65('0x5'),'message':{'from':getMails(_0x9f48e['email'],_0x272009[_0x4d65('0x37')]),'to':_0x9f48e['email'],'cc':'','subject':_0x272009[_0x4d65('0x38')]||'','messageId':_0x272009[_0x4d65('0x39')],'inReplyTo':_0x272009[_0x4d65('0x3a')],'sentAt':moment(_0x272009[_0x4d65('0x3b')])['format'](_0x4d65('0x3c')),'attach':![],'attachments':[]}};if(!_0x272009[_0x4d65('0x17')]&&!_0x272009[_0x4d65('0x21')]){var _0x1ddd79=_['filter'](_0x272009[_0x4d65('0x19')],{'contentType':_0x4d65('0x3d')});if(_0x1ddd79['length']){logger['info'](util['format'](_0x4d65('0x3e'),_0x272009[_0x4d65('0x39')]));tnef[_0x4d65('0x3f')](_[_0x4d65('0x40')](_0x1ddd79)[_0x4d65('0x2f')],function(_0x4747bb,_0x5daf51){if(_0x5daf51){_0x272009[_0x4d65('0x17')]=_0x5daf51['BodyHTML']||_0x4d65('0x41');if(_0x5daf51['Attachments']){for(var _0x45e9d1=0x0;_0x45e9d1<_0x5daf51[_0x4d65('0x42')][_0x4d65('0x10')];_0x45e9d1++){var _0x4fa2f1=_0x5daf51[_0x4d65('0x42')][_0x45e9d1];_0x3a55cd[_0x4d65('0x23')][_0x4d65('0x19')][_0x4d65('0x1a')]({'filename':_0x4fa2f1[_0x4d65('0x43')],'content':Buffer[_0x4d65('0x37')](_0x4fa2f1[_0x4d65('0x44')])});}}}_0x27c465(parseEmail(_0x9f48e,_0x272009,_0x3a55cd));});}else{_0x272009[_0x4d65('0x17')]=_0x4d65('0x41');_0x27c465(parseEmail(_0x9f48e,_0x272009,_0x3a55cd));}}else{_0x27c465(parseEmail(_0x9f48e,_0x272009,_0x3a55cd));}};exports[_0x4d65('0x45')]=function(_0x3865f6,_0x4723f5){var _0x1a623d=['user='+(_0x4723f5||''),'auth=Bearer\x20'+_0x3865f6,'',''];return Buffer[_0x4d65('0x37')](_0x1a623d[_0x4d65('0x12')](''),'utf-8')[_0x4d65('0x46')](_0x4d65('0x47'));}; \ No newline at end of file +var _0xc055=['parser','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','test','includes','0x1?_0x300119[_0x5c05('0x10')](0x0,-0x1)[_0x5c05('0x11')]('\x20'):_0xdfca61[_0x5c05('0xc')];}return _0x5c05('0x12');}function getLastName(_0x2252e5){var _0xeb729b=_[_0x5c05('0x6')](_0x2252e5[_0x5c05('0x7')]);if(_0xeb729b&&_0xeb729b[_0x5c05('0xc')]){var _0x5219e7=_0xeb729b[_0x5c05('0xc')][_0x5c05('0xe')](/\s+/);return _0x5219e7[_0x5c05('0xf')]>0x1?_0x5219e7[_0x5c05('0x13')]():'';}return'';}function getMails(_0x575fc9,_0x13510b){var _0x1a281d='';for(var _0x1deeab=0x0;_0x1deeab<_0x13510b[_0x5c05('0x7')][_0x5c05('0xf')];_0x1deeab+=0x1){if(_0x13510b[_0x5c05('0x7')][_0x1deeab][_0x5c05('0x8')]!==_0x575fc9){if(!_[_0x5c05('0x14')](_0x1a281d)){_0x1a281d+=',';}_0x1a281d+=_0x13510b[_0x5c05('0x7')][_0x1deeab]['name']||_0x13510b[_0x5c05('0x7')][_0x1deeab]['address']||'';_0x1a281d+='\x20<';_0x1a281d+=_0x13510b[_0x5c05('0x7')][_0x1deeab][_0x5c05('0x8')]?_0x13510b[_0x5c05('0x7')][_0x1deeab][_0x5c05('0x8')]:_0x5c05('0x9')+random[_0x5c05('0xa')](0x6)+_0x5c05('0xb');_0x1a281d+='>';}}return _0x1a281d;}function parseEmail(_0x8e4195,_0x241ae5,_0x20f186){if(_0x241ae5[_0x5c05('0x15')]){var _0x5521fd=/)<[^<]*)*<\/script>/gi;while(_0x5521fd[_0x5c05('0x16')](_0x241ae5[_0x5c05('0x15')])){_0x241ae5[_0x5c05('0x15')]=_0x241ae5[_0x5c05('0x15')]['replace'](_0x5521fd,'');}if(_0x241ae5[_0x5c05('0x15')][_0x5c05('0x17')](_0x5c05('0x18'))){var _0x38b272=[];_0x241ae5[_0x5c05('0x19')][_0x5c05('0x1a')](_0x37f639=>{_0x38b272[_0x5c05('0x1b')](_0x37f639[_0x5c05('0x1c')]);});var _0x1a16bc=/]+>/g;var _0x4cb0ec=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x297062=_0x241ae5[_0x5c05('0x15')][_0x5c05('0x1d')](_0x4cb0ec,_0x5c05('0x1e'));var _0x49b000=_0x297062[_0x5c05('0x1d')](_0x1a16bc,'_IMG');for(let _0x4dcc5b=0x0;_0x4dcc5b<_0x38b272[_0x5c05('0xf')];_0x4dcc5b++){var _0x4001f2=_0x49b000[_0x5c05('0x1d')](_0x5c05('0x1f'),'\x20[Attachment:\x20'+_0x38b272[_0x4dcc5b]+'\x20]');_0x49b000=_0x4001f2;}_0x241ae5[_0x5c05('0x15')]=_0x49b000;}_0x20f186[_0x5c05('0x20')]=_0x241ae5[_0x5c05('0x15')];}else{_0x20f186[_0x5c05('0x20')]=_0x241ae5['textAsHtml'];}if(_0x20f186[_0x5c05('0x20')]){_0x20f186[_0x5c05('0x20')]=_0x20f186[_0x5c05('0x20')]['replace'](/0x0){var _0x8611e4=[_0x5c05('0x32'),_0x5c05('0x33'),'Precedence:\x20auto_reply'];for(var _0x1a02b4=0x0;_0x1a02b4<_0x241ae5[_0x5c05('0x31')][_0x5c05('0xf')];_0x1a02b4++){var _0x1dfdfb=_['indexOf'](_0x8611e4,_0x241ae5['headerLines'][_0x1a02b4][_0x5c05('0x34')]);if(_0x1dfdfb>=0x0){_0x20f186[_0x5c05('0x35')]=!![];}}}return _0x20f186;}exports[_0x5c05('0x36')]=function(_0xf6707,_0x46ac71,_0x577591){var _0xe90953={'from':getAddress(_0x46ac71[_0x5c05('0x37')]),'firstName':getFirstName(_0x46ac71[_0x5c05('0x37')]),'lastName':getLastName(_0x46ac71['from']),'mapKey':_0x5c05('0x4'),'message':{'from':getMails(_0xf6707[_0x5c05('0x4')],_0x46ac71[_0x5c05('0x37')]),'to':_0xf6707['email'],'cc':'','subject':_0x46ac71[_0x5c05('0x38')]||'','messageId':_0x46ac71['messageId'],'inReplyTo':_0x46ac71[_0x5c05('0x39')],'sentAt':moment(_0x46ac71[_0x5c05('0x3a')])[_0x5c05('0x2a')](_0x5c05('0x3b')),'attach':![],'attachments':[]}};if(!_0x46ac71[_0x5c05('0x15')]&&!_0x46ac71[_0x5c05('0x3c')]){var _0x3169c4=_[_0x5c05('0x3d')](_0x46ac71[_0x5c05('0x19')],{'contentType':_0x5c05('0x3e')});if(_0x3169c4[_0x5c05('0xf')]){logger[_0x5c05('0x3f')](util[_0x5c05('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x46ac71[_0x5c05('0x40')]));tnef[_0x5c05('0x41')](_[_0x5c05('0x42')](_0x3169c4)['content'],function(_0x52fa54,_0x388d4d){if(_0x388d4d){_0x46ac71[_0x5c05('0x15')]=_0x388d4d[_0x5c05('0x43')]||_0x5c05('0x44');if(_0x388d4d[_0x5c05('0x45')]){for(var _0x59dab8=0x0;_0x59dab8<_0x388d4d[_0x5c05('0x45')]['length'];_0x59dab8++){var _0x3d2ce7=_0x388d4d[_0x5c05('0x45')][_0x59dab8];_0xe90953[_0x5c05('0x22')][_0x5c05('0x19')][_0x5c05('0x1b')]({'filename':_0x3d2ce7['Title'],'content':Buffer['from'](_0x3d2ce7[_0x5c05('0x46')])});}}}_0x577591(parseEmail(_0xf6707,_0x46ac71,_0xe90953));});}else{_0x46ac71['html']=_0x5c05('0x44');_0x577591(parseEmail(_0xf6707,_0x46ac71,_0xe90953));}}else{_0x577591(parseEmail(_0xf6707,_0x46ac71,_0xe90953));}};exports[_0x5c05('0x47')]=function(_0x430527,_0x35744e){var _0xc75681=[_0x5c05('0x48')+(_0x35744e||''),'auth=Bearer\x20'+_0x430527,'',''];return Buffer[_0x5c05('0x37')](_0xc75681[_0x5c05('0x11')](''),_0x5c05('0x49'))[_0x5c05('0x4a')](_0x5c05('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 38edcd5..c45b6da 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 _0xcbed=['SERV','active','Imap','Smtp','exports','name','Service','key'];(function(_0x2c4827,_0x3fc59e){var _0x683ad6=function(_0x3bab78){while(--_0x3bab78){_0x2c4827['push'](_0x2c4827['shift']());}};_0x683ad6(++_0x3fc59e);}(_0xcbed,0xbd));var _0xdcbe=function(_0x420a1c,_0x13ad25){_0x420a1c=_0x420a1c-0x0;var _0x3356c7=_0xcbed[_0x420a1c];return _0x3356c7;};'use strict';var _=require('lodash');function MailAccount(_0x5bb412){this['id']=_0x5bb412['id']||0x0;this[_0xdcbe('0x0')]=_0x5bb412[_0xdcbe('0x0')]||_0xdcbe('0x1');this[_0xdcbe('0x2')]=_0x5bb412['key']||_0xdcbe('0x3');this['active']=_0x5bb412[_0xdcbe('0x4')]||![];this[_0xdcbe('0x5')]=_0x5bb412['Imap']||[];this['Smtp']=_0x5bb412[_0xdcbe('0x6')]||[];}module[_0xdcbe('0x7')]=MailAccount; \ No newline at end of file +var _0xe2e6=['SERV','active','Imap','Smtp','exports','lodash','name','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2e6,0xfd));var _0x6e2e=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xe2e6[_0x1c5950];return _0x2b720a;};'use strict';var _=require(_0x6e2e('0x0'));function MailAccount(_0x8d38dd){this['id']=_0x8d38dd['id']||0x0;this[_0x6e2e('0x1')]=_0x8d38dd['name']||'Service';this['key']=_0x8d38dd[_0x6e2e('0x2')]||_0x6e2e('0x3');this[_0x6e2e('0x4')]=_0x8d38dd[_0x6e2e('0x4')]||![];this[_0x6e2e('0x5')]=_0x8d38dd[_0x6e2e('0x5')]||[];this[_0x6e2e('0x6')]=_0x8d38dd[_0x6e2e('0x6')]||[];}module[_0x6e2e('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 07adfd7..de8ffbb 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 _0x3992=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','exports','lodash','../model/mailAccount'];(function(_0x307bf6,_0x55bdd5){var _0x2878fc=function(_0x4fa44f){while(--_0x4fa44f){_0x307bf6['push'](_0x307bf6['shift']());}};_0x2878fc(++_0x55bdd5);}(_0x3992,0x15d));var _0x2399=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x3992[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x2399('0x0'));var MailAccount=require(_0x2399('0x1'));var Realtime=function(){this[_0x2399('0x2')]={};};function freeIsNotKey(_0x7aab56,_0x4741db,_0xea24ad){var _0xa0e3ea=_[_0x2399('0x3')](_0x7aab56,function(_0xa09fe6,_0x1576ca){return _0xa09fe6[_0xea24ad];});for(var _0x2993b9 in _0x4741db){if(_0x4741db[_0x2399('0x4')](_0x2993b9)){if(!_0xa0e3ea[_0x2993b9]){delete _0x4741db[_0x2993b9];}}}}Realtime[_0x2399('0x5')][_0x2399('0x6')]=function(_0x5aa4c5,_0x5ee482){for(var _0x277ef2 in _0x5ee482){if(_0x5aa4c5[_0x2399('0x4')](_0x277ef2)){_0x5aa4c5[_0x277ef2]=_0x5ee482[_0x277ef2];}}};Realtime[_0x2399('0x5')]['initMailAccounts']=function(){var _0x315a50=this;return function(_0xed823d){if(_0xed823d){freeIsNotKey(_0xed823d,_0x315a50[_0x2399('0x2')],'id');for(var _0x3cc5ac=0x0,_0x169fa4={},_0x567d7c={};_0x3cc5ac<_0xed823d[_0x2399('0x7')];_0x3cc5ac+=0x1){_0x169fa4=_0xed823d[_0x3cc5ac];if(_['isUndefined'](_0x315a50[_0x2399('0x2')][_0x169fa4['id']])){_0x315a50[_0x2399('0x2')][_0x169fa4['id']]=new MailAccount(_0x169fa4);}else{_['merge'](_0x315a50[_0x2399('0x2')][_0x169fa4['id']],_0x169fa4);}}}return _0x315a50[_0x2399('0x2')];};};module[_0x2399('0x8')]=Realtime; \ No newline at end of file +var _0x24a8=['lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x30ea23,_0x23c093){var _0x41514b=function(_0x16d4e6){while(--_0x16d4e6){_0x30ea23['push'](_0x30ea23['shift']());}};_0x41514b(++_0x23c093);}(_0x24a8,0x198));var _0x824a=function(_0x4513e6,_0x9f769f){_0x4513e6=_0x4513e6-0x0;var _0x188fec=_0x24a8[_0x4513e6];return _0x188fec;};'use strict';var _=require(_0x824a('0x0'));var MailAccount=require(_0x824a('0x1'));var Realtime=function(){this[_0x824a('0x2')]={};};function freeIsNotKey(_0x4ce3e5,_0x362f4b,_0x29b324){var _0x4c6ab9=_[_0x824a('0x3')](_0x4ce3e5,function(_0x3f3b2a,_0xeb57ec){return _0x3f3b2a[_0x29b324];});for(var _0x4553bf in _0x362f4b){if(_0x362f4b['hasOwnProperty'](_0x4553bf)){if(!_0x4c6ab9[_0x4553bf]){delete _0x362f4b[_0x4553bf];}}}}Realtime[_0x824a('0x4')][_0x824a('0x5')]=function(_0x13ad09,_0x4ea020){for(var _0x3f02bd in _0x4ea020){if(_0x13ad09[_0x824a('0x6')](_0x3f02bd)){_0x13ad09[_0x3f02bd]=_0x4ea020[_0x3f02bd];}}};Realtime['prototype'][_0x824a('0x7')]=function(){var _0x5eebfa=this;return function(_0x382e97){if(_0x382e97){freeIsNotKey(_0x382e97,_0x5eebfa[_0x824a('0x2')],'id');for(var _0x4e2f57=0x0,_0x4391a7={},_0x157b49={};_0x4e2f57<_0x382e97[_0x824a('0x8')];_0x4e2f57+=0x1){_0x4391a7=_0x382e97[_0x4e2f57];if(_[_0x824a('0x9')](_0x5eebfa[_0x824a('0x2')][_0x4391a7['id']])){_0x5eebfa['mailAccounts'][_0x4391a7['id']]=new MailAccount(_0x4391a7);}else{_[_0x824a('0xa')](_0x5eebfa[_0x824a('0x2')][_0x4391a7['id']],_0x4391a7);}}}return _0x5eebfa[_0x824a('0x2')];};};module[_0x824a('0xb')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index c171dc0..c5249a1 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 _0xb1ad=['key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','active'];(function(_0x5333ca,_0x441e75){var _0x316280=function(_0x37f0f9){while(--_0x37f0f9){_0x5333ca['push'](_0x5333ca['shift']());}};_0x316280(++_0x441e75);}(_0xb1ad,0x184));var _0xdb1a=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb1ad[_0x5037ab];return _0x512adb;};'use strict';var client=require(_0xdb1a('0x0'));exports[_0xdb1a('0x1')]=function(){return function(){return client[_0xdb1a('0x2')](_0xdb1a('0x3'),{'options':{'attributes':['id',_0xdb1a('0x4'),_0xdb1a('0x5'),'service',_0xdb1a('0x6'),_0xdb1a('0x7'),_0xdb1a('0x8'),_0xdb1a('0x9'),_0xdb1a('0xa')],'raw':![],'include':[{'model':_0xdb1a('0xb'),'as':_0xdb1a('0xc'),'include':[{'model':_0xdb1a('0xd'),'attributes':['id',_0xdb1a('0x4'),_0xdb1a('0xe'),_0xdb1a('0xf'),_0xdb1a('0x10')],'as':_0xdb1a('0xd')}]},{'model':_0xdb1a('0x11'),'as':_0xdb1a('0x12'),'include':[{'model':'CloudProvider','attributes':['id',_0xdb1a('0x4'),_0xdb1a('0xe'),'type','data5'],'as':'CloudProvider'}]}]},'log':_0xdb1a('0x13')});};};exports[_0xdb1a('0x14')]=function(_0x13082a,_0x18ce2c){return client[_0xdb1a('0x2')](_0xdb1a('0x15'),{'account':{'id':_0x13082a},'body':_0x18ce2c,'log':_0xdb1a('0x15')});}; \ No newline at end of file +var _0xa456=['Request','GetMailAccount','provider','service','email','key','ListId','TemplateId','MailServerIn','CloudProvider','name','type','data5','MailServerOut','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x4c23cc,_0x46193e){var _0x1b1dc2=function(_0x359f0d){while(--_0x359f0d){_0x4c23cc['push'](_0x4c23cc['shift']());}};_0x1b1dc2(++_0x46193e);}(_0xa456,0x142));var _0x6a45=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xa456[_0x4a3898];return _0x25ceb0;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(){return function(){return client[_0x6a45('0x2')](_0x6a45('0x3'),{'options':{'attributes':['id','name',_0x6a45('0x4'),_0x6a45('0x5'),_0x6a45('0x6'),'active',_0x6a45('0x7'),_0x6a45('0x8'),_0x6a45('0x9')],'raw':![],'include':[{'model':_0x6a45('0xa'),'as':'Imap','include':[{'model':_0x6a45('0xb'),'attributes':['id',_0x6a45('0xc'),_0x6a45('0x5'),_0x6a45('0xd'),_0x6a45('0xe')],'as':'CloudProvider'}]},{'model':_0x6a45('0xf'),'as':'Smtp','include':[{'model':_0x6a45('0xb'),'attributes':['id',_0x6a45('0xc'),_0x6a45('0x5'),_0x6a45('0xd'),_0x6a45('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x6a45('0x10')]=function(_0x465b59,_0x4b7f6d){return client['Request']('NotifyMailAccount',{'account':{'id':_0x465b59},'body':_0x4b7f6d,'log':_0x6a45('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 804007f..3efabf8 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 _0x578c=['loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x27e32e,_0x339fbd){var _0x10f599=function(_0x568ad4){while(--_0x568ad4){_0x27e32e['push'](_0x27e32e['shift']());}};_0x10f599(++_0x339fbd);}(_0x578c,0x18d));var _0xc578=function(_0x171d82,_0x2ea3b7){_0x171d82=_0x171d82-0x0;var _0x1f56b9=_0x578c[_0x171d82];return _0x1f56b9;};'use strict';var client=require(_0xc578('0x0'));exports[_0xc578('0x1')]=function(){return client[_0xc578('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc578('0x3')]},'log':_0xc578('0x4')});}; \ No newline at end of file +var _0x86c4=['Request','../client','getSettings'];(function(_0x535cac,_0x3a7a86){var _0x5df77b=function(_0x2c7e3b){while(--_0x2c7e3b){_0x535cac['push'](_0x535cac['shift']());}};_0x5df77b(++_0x3a7a86);}(_0x86c4,0x1b7));var _0x486c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x86c4[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0x486c('0x0'));exports[_0x486c('0x1')]=function(){return client[_0x486c('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 86ee48f..dab1333 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 1c92b18..09f9b98 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 _0x9d24=['defaults','localhost','adapter','../../config/triggers','default','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9d24,0x186));var _0x49d2=function(_0x2fbf97,_0x431ccd){_0x2fbf97=_0x2fbf97-0x0;var _0x12d97e=_0x9d24[_0x2fbf97];return _0x12d97e;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x49d2('0x0'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x49d2('0x1'));var app=express();var server=http['createServer'](app);server[_0x49d2('0x2')]=0xdbba0;if(sticky[_0x49d2('0x3')](server,config[_0x49d2('0x4')])){var socketio=require(_0x49d2('0x5'))(server,{'transports':[_0x49d2('0x6'),_0x49d2('0x7')]});config[_0x49d2('0x8')]=_[_0x49d2('0x9')](config[_0x49d2('0x8')],{'host':_0x49d2('0xa'),'port':0x18eb});socketio[_0x49d2('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0x49d2('0x8')]),'subClient':new Redis(config[_0x49d2('0x8')])}));require(_0x49d2('0xc'))[_0x49d2('0xd')]();require('../../config/socketio')['default'](socketio);require(_0x49d2('0xe'))[_0x49d2('0xd')](app);require(_0x49d2('0xf'))['default'](app);}else{server['once']('listening',function(){console[_0x49d2('0x10')](_0x49d2('0x11'),config[_0x49d2('0x4')]);});}exports=module[_0x49d2('0x12')]=app; \ No newline at end of file +var _0xfd6f=['timeout','listen','port','socket.io','websocket','polling','redis','localhost','socket.io-redis','../../config/socketio','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer'];(function(_0x834092,_0x429e9c){var _0x631023=function(_0x383d7d){while(--_0x383d7d){_0x834092['push'](_0x834092['shift']());}};_0x631023(++_0x429e9c);}(_0xfd6f,0xdf));var _0xffd6=function(_0x4e3e2b,_0xa036e7){_0x4e3e2b=_0x4e3e2b-0x0;var _0x189f87=_0xfd6f[_0x4e3e2b];return _0x189f87;};'use strict';var _=require(_0xffd6('0x0'));var http=require(_0xffd6('0x1'));var express=require(_0xffd6('0x2'));var sticky=require(_0xffd6('0x3'));var Redis=require(_0xffd6('0x4'));var config=require(_0xffd6('0x5'));var app=express();var server=http[_0xffd6('0x6')](app);server[_0xffd6('0x7')]=0xdbba0;if(sticky[_0xffd6('0x8')](server,config[_0xffd6('0x9')])){var socketio=require(_0xffd6('0xa'))(server,{'transports':[_0xffd6('0xb'),_0xffd6('0xc')]});config[_0xffd6('0xd')]=_['defaults'](config[_0xffd6('0xd')],{'host':_0xffd6('0xe'),'port':0x18eb});socketio['adapter'](require(_0xffd6('0xf'))({'pubClient':new Redis(config[_0xffd6('0xd')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0xffd6('0x10'))['default'](socketio);require('../../config/express')['default'](app);require('../../routes')[_0xffd6('0x11')](app);}else{server[_0xffd6('0x12')](_0xffd6('0x13'),function(){console[_0xffd6('0x14')](_0xffd6('0x15'),config[_0xffd6('0x9')]);});}exports=module[_0xffd6('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index a30707b..b97bed0 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 _0x5197=['rpc','message','result','jayson/promise','../../config/logger','client','http','Request','request','then','routing','error'];(function(_0x5cc892,_0x3b98d1){var _0x221b95=function(_0x308d79){while(--_0x308d79){_0x5cc892['push'](_0x5cc892['shift']());}};_0x221b95(++_0x3b98d1);}(_0x5197,0x9f));var _0x7519=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5197[_0x53ccf2];return _0x5a2964;};'use strict';var jayson=require(_0x7519('0x0'));var BPromise=require('bluebird');var logger=require(_0x7519('0x1'))('routing');var client=jayson[_0x7519('0x2')][_0x7519('0x3')]({'port':0x2329});client[_0x7519('0x4')]=function(_0x29e199,_0x37cbfe){return new BPromise(function(_0x5a73e6,_0x1751e0){return client[_0x7519('0x5')](_0x29e199,_0x37cbfe)[_0x7519('0x6')](function(_0xf3aa6d){logger['debug']('rpc',_0x7519('0x7'),_0x29e199,_0x37cbfe,_0xf3aa6d);if(_0xf3aa6d[_0x7519('0x8')]){logger[_0x7519('0x8')](_0x7519('0x9'),_0x7519('0x7'),_0x29e199,_0xf3aa6d[_0x7519('0x8')][_0x7519('0xa')],_0x37cbfe);return _0x1751e0(_0xf3aa6d[_0x7519('0x8')][_0x7519('0xa')]);}else{return _0x5a73e6(_0xf3aa6d[_0x7519('0xb')]);}})['catch'](function(_0x524653){logger[_0x7519('0x8')](_0x7519('0x9'),_0x7519('0x7'),_0x29e199,_0x524653,_0x37cbfe);return _0x1751e0(_0x524653);});});};module['exports']=client; \ No newline at end of file +var _0xe0f5=['Request','request','then','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0f5,0xa0));var _0x5e0f=function(_0xf433fa,_0x32e751){_0xf433fa=_0xf433fa-0x0;var _0x46c91a=_0xe0f5[_0xf433fa];return _0x46c91a;};'use strict';var jayson=require(_0x5e0f('0x0'));var BPromise=require(_0x5e0f('0x1'));var logger=require(_0x5e0f('0x2'))(_0x5e0f('0x3'));var client=jayson[_0x5e0f('0x4')]['http']({'port':0x2329});client[_0x5e0f('0x5')]=function(_0x189695,_0x364113){return new BPromise(function(_0x551c16,_0x1829ac){return client[_0x5e0f('0x6')](_0x189695,_0x364113)[_0x5e0f('0x7')](function(_0x510f0c){logger[_0x5e0f('0x8')]('rpc',_0x5e0f('0x3'),_0x189695,_0x364113,_0x510f0c);if(_0x510f0c[_0x5e0f('0x9')]){logger[_0x5e0f('0x9')](_0x5e0f('0xa'),_0x5e0f('0x3'),_0x189695,_0x510f0c[_0x5e0f('0x9')][_0x5e0f('0xb')],_0x364113);return _0x1829ac(_0x510f0c[_0x5e0f('0x9')][_0x5e0f('0xb')]);}else{return _0x551c16(_0x510f0c[_0x5e0f('0xc')]);}})[_0x5e0f('0xd')](function(_0x24603d){logger[_0x5e0f('0x9')](_0x5e0f('0xa'),_0x5e0f('0x3'),_0x189695,_0x24603d,_0x364113);return _0x1829ac(_0x24603d);});});};module[_0x5e0f('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index e24e8d5..f88e4ff 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 _0x9ec7=['bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log'];(function(_0xdd4497,_0x472810){var _0x164f5c=function(_0x100d33){while(--_0x100d33){_0xdd4497['push'](_0xdd4497['shift']());}};_0x164f5c(++_0x472810);}(_0x9ec7,0xe0));var _0x79ec=function(_0x13c419,_0x18a7b1){_0x13c419=_0x13c419-0x0;var _0x421bcd=_0x9ec7[_0x13c419];return _0x421bcd;};'use strict';var BPromise=require(_0x79ec('0x0'));var server=require(_0x79ec('0x1'));var Realtime=require(_0x79ec('0x2'));var user=require(_0x79ec('0x3'));var interval=require(_0x79ec('0x4'));var openchannelQueue=require(_0x79ec('0x5'));var chatQueue=require(_0x79ec('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x79ec('0x7'));var faxQueue=require(_0x79ec('0x8'));var whatsappQueue=require(_0x79ec('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x79ec('0xa')]()['then'](user['getAgents']())[_0x79ec('0xb')](realtime[_0x79ec('0xc')]())[_0x79ec('0xb')](interval[_0x79ec('0xd')]())['then'](realtime[_0x79ec('0xe')]())[_0x79ec('0xb')](openchannelQueue[_0x79ec('0xf')]())[_0x79ec('0xb')](realtime[_0x79ec('0x10')]())['then'](chatQueue[_0x79ec('0x11')]())[_0x79ec('0xb')](realtime[_0x79ec('0x12')]())[_0x79ec('0xb')](smsQueue['getSmsQueues']())[_0x79ec('0xb')](realtime[_0x79ec('0x13')]())[_0x79ec('0xb')](mailQueue[_0x79ec('0x14')]())[_0x79ec('0xb')](realtime[_0x79ec('0x15')]())['then'](faxQueue[_0x79ec('0x16')]())['then'](realtime[_0x79ec('0x17')]())[_0x79ec('0xb')](whatsappQueue[_0x79ec('0x18')]())['then'](realtime[_0x79ec('0x19')]())[_0x79ec('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x79ec('0xb')](function(_0x444406){return initRealtime();})[_0x79ec('0xb')](function(_0x4fcc85){return setInterval(initRealtime,0x1388);})[_0x79ec('0x1a')](function(_0x127e7a){console[_0x79ec('0x1b')](_0x127e7a);});}main(); \ No newline at end of file +var _0x40fa=['./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents','then','getIntervals','initIntervals','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','bluebird'];(function(_0x1f0add,_0x207660){var _0x323bb2=function(_0x176da5){while(--_0x176da5){_0x1f0add['push'](_0x1f0add['shift']());}};_0x323bb2(++_0x207660);}(_0x40fa,0x97));var _0xa40f=function(_0x171f31,_0x1df8f1){_0x171f31=_0x171f31-0x0;var _0x302876=_0x40fa[_0x171f31];return _0x302876;};'use strict';var BPromise=require(_0xa40f('0x0'));var server=require('./server');var Realtime=require(_0xa40f('0x1'));var user=require(_0xa40f('0x2'));var interval=require(_0xa40f('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xa40f('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xa40f('0x5'));var whatsappQueue=require(_0xa40f('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0xa40f('0x7')]())[_0xa40f('0x8')](realtime['initAgents']())[_0xa40f('0x8')](interval[_0xa40f('0x9')]())[_0xa40f('0x8')](realtime[_0xa40f('0xa')]())[_0xa40f('0x8')](openchannelQueue['getOpenchannelQueues']())[_0xa40f('0x8')](realtime[_0xa40f('0xb')]())[_0xa40f('0x8')](chatQueue['getChatQueues']())['then'](realtime[_0xa40f('0xc')]())[_0xa40f('0x8')](smsQueue['getSmsQueues']())[_0xa40f('0x8')](realtime[_0xa40f('0xd')]())['then'](mailQueue[_0xa40f('0xe')]())[_0xa40f('0x8')](realtime[_0xa40f('0xf')]())['then'](faxQueue[_0xa40f('0x10')]())[_0xa40f('0x8')](realtime[_0xa40f('0x11')]())[_0xa40f('0x8')](whatsappQueue['getWhatsappQueues']())[_0xa40f('0x8')](realtime[_0xa40f('0x12')]())[_0xa40f('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xa40f('0x8')](function(_0x3bb269){return initRealtime();})[_0xa40f('0x8')](function(_0x207950){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4e98df){console['log'](_0x4e98df);});}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 033e3d5..ca1a63d 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x19ebc9,_0x2a8bcd){var _0x54bb42=function(_0x2d3ee4){while(--_0x2d3ee4){_0x19ebc9['push'](_0x19ebc9['shift']());}};_0x54bb42(++_0x2a8bcd);}(_0x7a54,0x106));var _0x47a5=function(_0x456955,_0x523b2a){_0x456955=_0x456955-0x0;var _0x1060b0=_0x7a54[_0x456955];return _0x1060b0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x45d578,_0x5786e3){var _0x2c0f7b=function(_0x6f3897){while(--_0x6f3897){_0x45d578['push'](_0x45d578['shift']());}};_0x2c0f7b(++_0x5786e3);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ce2dc,_0x9098a1){_0x5ce2dc=_0x5ce2dc-0x0;var _0x4933a0=_0x2ef3[_0x5ce2dc];return _0x4933a0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d5c01ad..5dde711 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 _0xa872=['catch','sendMailMessage','SendMail','bluebird','client','http','request','error','message','result'];(function(_0x325064,_0x35482f){var _0x5d9b73=function(_0x5d064a){while(--_0x5d064a){_0x325064['push'](_0x325064['shift']());}};_0x5d9b73(++_0x35482f);}(_0xa872,0xcb));var _0x2a87=function(_0x1fcf36,_0x3f2539){_0x1fcf36=_0x1fcf36-0x0;var _0x44491f=_0xa872[_0x1fcf36];return _0x44491f;};'use strict';var BPromise=require(_0x2a87('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x2a87('0x1')][_0x2a87('0x2')]({'port':0x232b});function request(_0x352c6a,_0x2df47e){return new BPromise(function(_0x5416bb,_0x3f3323){return client[_0x2a87('0x3')](_0x352c6a,_0x2df47e)['then'](function(_0x1e58bd){if(_0x1e58bd[_0x2a87('0x4')]){return _0x3f3323(_0x1e58bd['error'][_0x2a87('0x5')]);}else{return _0x5416bb(_0x1e58bd[_0x2a87('0x6')]);}})[_0x2a87('0x7')](function(_0x5d6ea3){return _0x3f3323(_0x5d6ea3);});});}exports[_0x2a87('0x8')]=function(_0x1fd50d,_0x1cabf7){return request(_0x2a87('0x9'),{'account':_0x1fd50d,'message':_0x1cabf7});}; \ No newline at end of file +var _0x2d5a=['jayson/promise','client','http','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x5c0daf,_0x3c9d2a){var _0xb3579=function(_0x1e0508){while(--_0x1e0508){_0x5c0daf['push'](_0x5c0daf['shift']());}};_0xb3579(++_0x3c9d2a);}(_0x2d5a,0x190));var _0xa2d5=function(_0x420961,_0x10134b){_0x420961=_0x420961-0x0;var _0x47aa80=_0x2d5a[_0x420961];return _0x47aa80;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa2d5('0x0'));var client=jayson[_0xa2d5('0x1')][_0xa2d5('0x2')]({'port':0x232b});function request(_0x28fba5,_0x1f597e){return new BPromise(function(_0x16677e,_0xfd7437){return client['request'](_0x28fba5,_0x1f597e)[_0xa2d5('0x3')](function(_0x31b10b){if(_0x31b10b[_0xa2d5('0x4')]){return _0xfd7437(_0x31b10b[_0xa2d5('0x4')][_0xa2d5('0x5')]);}else{return _0x16677e(_0x31b10b[_0xa2d5('0x6')]);}})[_0xa2d5('0x7')](function(_0x29c732){return _0xfd7437(_0x29c732);});});}exports[_0xa2d5('0x8')]=function(_0x2da0c7,_0x332a55){return request(_0xa2d5('0x9'),{'account':_0x2da0c7,'message':_0x332a55});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c0ab052..d106a6e 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 _0x3e24=['emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','chatStatus','faxStatusTime','busy','openchannelWaitingInteractions','stringify'];(function(_0x1efc80,_0x9d5e3b){var _0x15248f=function(_0x2abfe3){while(--_0x2abfe3){_0x1efc80['push'](_0x1efc80['shift']());}};_0x15248f(++_0x9d5e3b);}(_0x3e24,0x167));var _0x43e2=function(_0x54a946,_0x30a84e){_0x54a946=_0x54a946-0x0;var _0x4484af=_0x3e24[_0x54a946];return _0x4484af;};'use strict';var _=require(_0x43e2('0x0'));var md5=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var Redis=require(_0x43e2('0x3'));var config=require(_0x43e2('0x4'));config['redis']=_[_0x43e2('0x5')](config[_0x43e2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x43e2('0x7'))(new Redis(config[_0x43e2('0x6')]));function Agent(_0x1a89fc){this['id']=_0x1a89fc['id']||0x0;this[_0x43e2('0x8')]=_0x1a89fc[_0x43e2('0x8')]||'';this[_0x43e2('0x9')]=_0x1a89fc[_0x43e2('0x9')]||!![];this['voicePause']=_0x1a89fc[_0x43e2('0xa')]||![];this[_0x43e2('0xb')]=_0x1a89fc['chatPause']||![];this[_0x43e2('0xc')]=_0x1a89fc[_0x43e2('0xc')]||![];this['faxPause']=_0x1a89fc[_0x43e2('0xd')]||![];this[_0x43e2('0xe')]=_0x1a89fc['smsPause']||![];this[_0x43e2('0xf')]=_0x1a89fc['openchannelPause']||![];this['chatStatus']='unknown';this[_0x43e2('0x10')]=0x0;this[_0x43e2('0x11')]=_0x1a89fc[_0x43e2('0x11')]||0x0;this[_0x43e2('0x12')]=0x0;this[_0x43e2('0x13')]=_0x43e2('0x14');this[_0x43e2('0x15')]=0x0;this[_0x43e2('0x16')]=_0x1a89fc[_0x43e2('0x16')]||0x0;this[_0x43e2('0x17')]=0x0;this[_0x43e2('0x18')]=_0x43e2('0x14');this['faxStatusTime']=0x0;this[_0x43e2('0x19')]=_0x1a89fc[_0x43e2('0x19')]||0x0;this[_0x43e2('0x1a')]=0x0;this[_0x43e2('0x1b')]='unknown';this['smsStatusTime']=0x0;this[_0x43e2('0x1c')]=_0x1a89fc[_0x43e2('0x1c')]||0x0;this[_0x43e2('0x1d')]=0x0;this[_0x43e2('0x1e')]=_0x43e2('0x14');this[_0x43e2('0x1f')]=0x0;this[_0x43e2('0x20')]=_0x1a89fc[_0x43e2('0x20')]||0x0;this[_0x43e2('0x21')]=0x0;this[_0x43e2('0x22')]='unknown';this[_0x43e2('0x23')]=0x0;this[_0x43e2('0x24')]=_0x1a89fc['openchannelCapacity']||0x0;this[_0x43e2('0x25')]=0x0;this['busy']=![];this[_0x43e2('0x26')]=undefined;this[_0x43e2('0x1')]='';this[_0x43e2('0x27')]={};this[_0x43e2('0x28')]={};this[_0x43e2('0x29')]={};this['openchannelWaitingInteractions']={};this[_0x43e2('0x2a')]={};this[_0x43e2('0x2b')]={};this[_0x43e2('0x2c')]();}Agent['prototype'][_0x43e2('0x2d')]=function(_0x32f048){if(this[_0x32f048+_0x43e2('0x2e')]>0x0){if(this[_0x32f048+_0x43e2('0x2f')]>0x0&&this[_0x32f048+'CurrentCapacity']>=this[_0x32f048+_0x43e2('0x2f')]){return _0x43e2('0x30');}else{return _0x43e2('0x31');}}else{return _0x43e2('0x32');}};Agent[_0x43e2('0x33')][_0x43e2('0x2c')]=function(){var _0x3ca16b=[_0x43e2('0x34'),_0x43e2('0x35'),_0x43e2('0x36'),_0x43e2('0x37'),_0x43e2('0x38'),'whatsapp'];for(var _0x430a0e=0x0;_0x430a0e<_0x3ca16b[_0x43e2('0x39')];_0x430a0e+=0x1){var _0x545246=this[_0x43e2('0x2d')](_0x3ca16b[_0x430a0e]);if(this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3a')]!==_0x545246){this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3b')]=_[_0x43e2('0x3c')](moment()[_0x43e2('0x3d')]('x'));}this[_0x3ca16b[_0x430a0e]+'Status']=_0x545246;}var _0x42f495={'id':this['id'],'name':this[_0x43e2('0x8')],'online':this[_0x43e2('0x9')],'voicePause':this[_0x43e2('0xa')],'chatPause':this[_0x43e2('0xb')],'mailPause':this[_0x43e2('0xc')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x43e2('0xf')],'chatStatus':this[_0x43e2('0x3e')],'chatStatusTime':this[_0x43e2('0x10')],'chatCapacity':this[_0x43e2('0x11')],'chatCurrentCapacity':this[_0x43e2('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x43e2('0x15')],'mailCapacity':this[_0x43e2('0x16')],'mailCurrentCapacity':this[_0x43e2('0x17')],'faxStatus':this[_0x43e2('0x18')],'faxStatusTime':this[_0x43e2('0x3f')],'faxCapacity':this[_0x43e2('0x19')],'faxCurrentCapacity':this[_0x43e2('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x43e2('0x1c')],'smsCurrentCapacity':this[_0x43e2('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x43e2('0x1f')],'whatsappCapacity':this[_0x43e2('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x43e2('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x43e2('0x40')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x43e2('0x27')],'faxWaitingInteractions':this[_0x43e2('0x28')],'mailWaitingInteractions':this[_0x43e2('0x29')],'openchannelWaitingInteractions':this[_0x43e2('0x41')],'smsWaitingInteractions':this[_0x43e2('0x2a')],'whatsappWaitingInteractions':this[_0x43e2('0x2b')]};var _0x1cf8e5=md5(JSON[_0x43e2('0x42')](_0x42f495));if(this[_0x43e2('0x1')]!==_0x1cf8e5){this[_0x43e2('0x1')]=_0x1cf8e5;io[_0x43e2('0x43')](_0x43e2('0x44'),_[_0x43e2('0x45')](_0x42f495,[_0x43e2('0x9')]));}};module[_0x43e2('0x46')]=Agent; \ No newline at end of file +var _0xffd6=['idle','mail','openchannel','fax','length','StatusTime','format','Status','chatStatusTime','chatCurrentCapacity','faxStatus','faxStatusTime','smsStatus','whatsappCurrentCapacity','openchannelStatus','busy','busyQueue','faxWaitingInteractions','whatsappWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','moment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity'];(function(_0x310aa9,_0x1c3915){var _0x211029=function(_0x2bd7e7){while(--_0x2bd7e7){_0x310aa9['push'](_0x310aa9['shift']());}};_0x211029(++_0x1c3915);}(_0xffd6,0x97));var _0x6ffd=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0xffd6[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x6ffd('0x0'));var md5=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6ffd('0x3')]=_[_0x6ffd('0x4')](config[_0x6ffd('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x6ffd('0x5'))(new Redis(config[_0x6ffd('0x3')]));function Agent(_0x3b8a46){this['id']=_0x3b8a46['id']||0x0;this[_0x6ffd('0x6')]=_0x3b8a46['name']||'';this[_0x6ffd('0x7')]=_0x3b8a46[_0x6ffd('0x7')]||!![];this[_0x6ffd('0x8')]=_0x3b8a46[_0x6ffd('0x8')]||![];this[_0x6ffd('0x9')]=_0x3b8a46['chatPause']||![];this[_0x6ffd('0xa')]=_0x3b8a46[_0x6ffd('0xa')]||![];this['faxPause']=_0x3b8a46[_0x6ffd('0xb')]||![];this[_0x6ffd('0xc')]=_0x3b8a46[_0x6ffd('0xc')]||![];this[_0x6ffd('0xd')]=_0x3b8a46[_0x6ffd('0xd')]||![];this[_0x6ffd('0xe')]=_0x6ffd('0xf');this['chatStatusTime']=0x0;this[_0x6ffd('0x10')]=_0x3b8a46[_0x6ffd('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x6ffd('0x11')]=_0x6ffd('0xf');this[_0x6ffd('0x12')]=0x0;this[_0x6ffd('0x13')]=_0x3b8a46['mailCapacity']||0x0;this[_0x6ffd('0x14')]=0x0;this['faxStatus']=_0x6ffd('0xf');this['faxStatusTime']=0x0;this[_0x6ffd('0x15')]=_0x3b8a46[_0x6ffd('0x15')]||0x0;this[_0x6ffd('0x16')]=0x0;this['smsStatus']=_0x6ffd('0xf');this[_0x6ffd('0x17')]=0x0;this[_0x6ffd('0x18')]=_0x3b8a46[_0x6ffd('0x18')]||0x0;this[_0x6ffd('0x19')]=0x0;this[_0x6ffd('0x1a')]=_0x6ffd('0xf');this[_0x6ffd('0x1b')]=0x0;this['whatsappCapacity']=_0x3b8a46[_0x6ffd('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x6ffd('0xf');this[_0x6ffd('0x1d')]=0x0;this['openchannelCapacity']=_0x3b8a46[_0x6ffd('0x1e')]||0x0;this[_0x6ffd('0x1f')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x6ffd('0x1')]='';this[_0x6ffd('0x20')]={};this['faxWaitingInteractions']={};this[_0x6ffd('0x21')]={};this[_0x6ffd('0x22')]={};this[_0x6ffd('0x23')]={};this['whatsappWaitingInteractions']={};this[_0x6ffd('0x24')]();}Agent[_0x6ffd('0x25')]['getChannelStatus']=function(_0x356c9c){if(this[_0x356c9c+_0x6ffd('0x26')]>0x0){if(this[_0x356c9c+'Capacity']>0x0&&this[_0x356c9c+_0x6ffd('0x26')]>=this[_0x356c9c+_0x6ffd('0x27')]){return _0x6ffd('0x28');}else{return'working';}}else{return _0x6ffd('0x29');}};Agent[_0x6ffd('0x25')][_0x6ffd('0x24')]=function(){var _0x4ae7ac=[_0x6ffd('0x2a'),'chat',_0x6ffd('0x2b'),_0x6ffd('0x2c'),'sms','whatsapp'];for(var _0x252201=0x0;_0x252201<_0x4ae7ac[_0x6ffd('0x2d')];_0x252201+=0x1){var _0x1934d4=this['getChannelStatus'](_0x4ae7ac[_0x252201]);if(this[_0x4ae7ac[_0x252201]+'Status']!==_0x1934d4){this[_0x4ae7ac[_0x252201]+_0x6ffd('0x2e')]=_['toNumber'](moment()[_0x6ffd('0x2f')]('x'));}this[_0x4ae7ac[_0x252201]+_0x6ffd('0x30')]=_0x1934d4;}var _0x51fdb6={'id':this['id'],'name':this[_0x6ffd('0x6')],'online':this[_0x6ffd('0x7')],'voicePause':this[_0x6ffd('0x8')],'chatPause':this[_0x6ffd('0x9')],'mailPause':this[_0x6ffd('0xa')],'smsPause':this[_0x6ffd('0xc')],'faxPause':this[_0x6ffd('0xb')],'openchannelPause':this[_0x6ffd('0xd')],'chatStatus':this[_0x6ffd('0xe')],'chatStatusTime':this[_0x6ffd('0x31')],'chatCapacity':this[_0x6ffd('0x10')],'chatCurrentCapacity':this[_0x6ffd('0x32')],'mailStatus':this[_0x6ffd('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x6ffd('0x33')],'faxStatusTime':this[_0x6ffd('0x34')],'faxCapacity':this[_0x6ffd('0x15')],'faxCurrentCapacity':this[_0x6ffd('0x16')],'smsStatus':this[_0x6ffd('0x35')],'smsStatusTime':this[_0x6ffd('0x17')],'smsCapacity':this[_0x6ffd('0x18')],'smsCurrentCapacity':this[_0x6ffd('0x19')],'whatsappStatus':this[_0x6ffd('0x1a')],'whatsappStatusTime':this[_0x6ffd('0x1b')],'whatsappCapacity':this[_0x6ffd('0x1c')],'whatsappCurrentCapacity':this[_0x6ffd('0x36')],'openchannelStatus':this[_0x6ffd('0x37')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x6ffd('0x1e')],'openchannelCurrentCapacity':this[_0x6ffd('0x1f')],'busy':this[_0x6ffd('0x38')],'busyQueue':this[_0x6ffd('0x39')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x6ffd('0x3a')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x6ffd('0x23')],'whatsappWaitingInteractions':this[_0x6ffd('0x3b')]};var _0x25bc7c=md5(JSON[_0x6ffd('0x3c')](_0x51fdb6));if(this['md5']!==_0x25bc7c){this[_0x6ffd('0x1')]=_0x25bc7c;io['emit'](_0x6ffd('0x3d'),_[_0x6ffd('0x3e')](_0x51fdb6,[_0x6ffd('0x7')]));}};module[_0x6ffd('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 92f5660..a66b7d3 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 _0x5c61=['available','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','localhost','redis','name','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','paused'];(function(_0x1978f8,_0x5dc5b0){var _0x285d93=function(_0x20656e){while(--_0x20656e){_0x1978f8['push'](_0x1978f8['shift']());}};_0x285d93(++_0x5dc5b0);}(_0x5c61,0x14b));var _0x15c6=function(_0x52f509,_0x9c2ff6){_0x52f509=_0x52f509-0x0;var _0x108ad4=_0x5c61[_0x52f509];return _0x108ad4;};'use strict';var _=require('lodash');var md5=require(_0x15c6('0x0'));var util=require(_0x15c6('0x1'));var Redis=require(_0x15c6('0x2'));var config=require(_0x15c6('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x15c6('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x15c6('0x5')]));function ChatQueue(_0x4f6cef){this['id']=_0x4f6cef['id']||0x0;this[_0x15c6('0x6')]=_0x4f6cef[_0x15c6('0x6')]||'';this['timeout']=_0x4f6cef['timeout']||0xa;this[_0x15c6('0x7')]=_0x4f6cef[_0x15c6('0x7')]||_0x15c6('0x8');this['Agents']=_0x4f6cef[_0x15c6('0x9')];this[_0x15c6('0xa')]={};this['waiting']=0x0;this[_0x15c6('0x0')]='';this[_0x15c6('0xb')]();this[_0x15c6('0xc')]();}ChatQueue[_0x15c6('0xd')][_0x15c6('0xb')]=function(){var _0x1c3559=this[_0x15c6('0xa')][_0x15c6('0xe')];this[_0x15c6('0xa')]=_[_0x15c6('0xf')](this[_0x15c6('0x9')],'id');this[_0x15c6('0xa')][_0x15c6('0xe')]=_0x1c3559;};ChatQueue[_0x15c6('0xd')]['updateRealtime']=function(){this[_0x15c6('0x10')]=0x0;this['paused']=0x0;for(var _0x3b7196=0x0;_0x3b7196=0x0?this[_0x15c6('0x14')]:0x0;var _0x30f9d5={'id':this['id'],'available':this['available'],'loggedIn':this[_0x15c6('0x10')],'name':this[_0x15c6('0x6')],'paused':this[_0x15c6('0x13')],'waiting':this[_0x15c6('0x15')]};var _0x2ef2ea=md5(JSON['stringify'](_0x30f9d5));if(this[_0x15c6('0x0')]!==_0x2ef2ea){this[_0x15c6('0x0')]=_0x2ef2ea;io['to'](util[_0x15c6('0x16')](_0x15c6('0x17'),_0x30f9d5[_0x15c6('0x6')]))[_0x15c6('0x18')](_0x15c6('0x19'),_0x30f9d5);}};module[_0x15c6('0x1a')]=ChatQueue; \ No newline at end of file +var _0x881b=['socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','map','_rr','paused','length','online','loggedIn','chatPause','available','stringify','chat:queue:%s','emit','exports','lodash','md5','../../../config/environment','redis','localhost'];(function(_0x41ae26,_0x32a2e8){var _0x321631=function(_0x42fd63){while(--_0x42fd63){_0x41ae26['push'](_0x41ae26['shift']());}};_0x321631(++_0x32a2e8);}(_0x881b,0x1f3));var _0xb881=function(_0x3118ee,_0x1c74c7){_0x3118ee=_0x3118ee-0x0;var _0x2004d2=_0x881b[_0x3118ee];return _0x2004d2;};'use strict';var _=require(_0xb881('0x0'));var md5=require(_0xb881('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xb881('0x2'));config[_0xb881('0x3')]=_['defaults'](config[_0xb881('0x3')],{'host':_0xb881('0x4'),'port':0x18eb});var io=require(_0xb881('0x5'))(new Redis(config[_0xb881('0x3')]));function ChatQueue(_0x2435cf){this['id']=_0x2435cf['id']||0x0;this[_0xb881('0x6')]=_0x2435cf['name']||'';this[_0xb881('0x7')]=_0x2435cf[_0xb881('0x7')]||0xa;this[_0xb881('0x8')]=_0x2435cf['strategy']||_0xb881('0x9');this[_0xb881('0xa')]=_0x2435cf[_0xb881('0xa')];this['mapAgentsId']={};this[_0xb881('0xb')]=0x0;this[_0xb881('0x1')]='';this['updateRouting']();this[_0xb881('0xc')]();}ChatQueue[_0xb881('0xd')][_0xb881('0xe')]=function(){var _0x2410d8=this['mapAgentsId']['_rr'];this[_0xb881('0xf')]=_[_0xb881('0x10')](this[_0xb881('0xa')],'id');this['mapAgentsId'][_0xb881('0x11')]=_0x2410d8;};ChatQueue[_0xb881('0xd')][_0xb881('0xc')]=function(){this['loggedIn']=0x0;this[_0xb881('0x12')]=0x0;for(var _0x2a21a9=0x0;_0x2a21a9=0x0?this[_0xb881('0x17')]:0x0;var _0x1b8e86={'id':this['id'],'available':this[_0xb881('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xb881('0x6')],'paused':this[_0xb881('0x12')],'waiting':this[_0xb881('0xb')]};var _0x42c488=md5(JSON[_0xb881('0x18')](_0x1b8e86));if(this['md5']!==_0x42c488){this[_0xb881('0x1')]=_0x42c488;io['to'](util['format'](_0xb881('0x19'),_0x1b8e86[_0xb881('0x6')]))[_0xb881('0x1a')]('chat_queue:save',_0x1b8e86);}};module[_0xb881('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 350f0c1..3d8071f 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 _0x8d80=['../../../config/environment','defaults','redis','name','timeout','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','faxPause','available','format','emit','fax_queue:save','exports','md5','util','ioredis'];(function(_0x28a600,_0x35f64a){var _0x24c0ed=function(_0x89051){while(--_0x89051){_0x28a600['push'](_0x28a600['shift']());}};_0x24c0ed(++_0x35f64a);}(_0x8d80,0x1f1));var _0x08d8=function(_0x5694d3,_0x2e3008){_0x5694d3=_0x5694d3-0x0;var _0x1ca96e=_0x8d80[_0x5694d3];return _0x1ca96e;};'use strict';var _=require('lodash');var md5=require(_0x08d8('0x0'));var util=require(_0x08d8('0x1'));var Redis=require(_0x08d8('0x2'));var config=require(_0x08d8('0x3'));config['redis']=_[_0x08d8('0x4')](config[_0x08d8('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x08d8('0x5')]));function FaxQueue(_0x57ba58){this['id']=_0x57ba58['id']||0x0;this[_0x08d8('0x6')]=_0x57ba58[_0x08d8('0x6')]||'';this[_0x08d8('0x7')]=_0x57ba58[_0x08d8('0x7')]||0xa;this['strategy']=_0x57ba58['strategy']||'beepall';this['Agents']=_0x57ba58[_0x08d8('0x8')];this['mapAgentsId']={};this[_0x08d8('0x9')]=0x0;this[_0x08d8('0x0')]='';this[_0x08d8('0xa')]();this[_0x08d8('0xb')]();}FaxQueue[_0x08d8('0xc')]['updateRouting']=function(){var _0x234ecc=this[_0x08d8('0xd')][_0x08d8('0xe')];this[_0x08d8('0xd')]=_['map'](this['Agents'],'id');this[_0x08d8('0xd')][_0x08d8('0xe')]=_0x234ecc;};FaxQueue['prototype'][_0x08d8('0xb')]=function(){this[_0x08d8('0xf')]=0x0;this[_0x08d8('0x10')]=0x0;for(var _0x1e3548=0x0;_0x1e3548=0x0?this[_0x08d8('0x14')]:0x0;var _0x2be2ff={'id':this['id'],'available':this[_0x08d8('0x14')],'loggedIn':this[_0x08d8('0xf')],'name':this[_0x08d8('0x6')],'paused':this[_0x08d8('0x10')],'waiting':this[_0x08d8('0x9')]};var _0x433b55=md5(JSON['stringify'](_0x2be2ff));if(this['md5']!==_0x433b55){this['md5']=_0x433b55;io['to'](util[_0x08d8('0x15')]('fax:queue:%s',_0x2be2ff[_0x08d8('0x6')]))[_0x08d8('0x16')](_0x08d8('0x17'),_0x2be2ff);}};module[_0x08d8('0x18')]=FaxQueue; \ No newline at end of file +var _0x73f1=['fax_queue:save','exports','lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','faxPause','available','stringify','fax:queue:%s','emit'];(function(_0x533d79,_0xfaa214){var _0x1a3128=function(_0x11beab){while(--_0x11beab){_0x533d79['push'](_0x533d79['shift']());}};_0x1a3128(++_0xfaa214);}(_0x73f1,0x152));var _0x173f=function(_0x5199f9,_0x36f12d){_0x5199f9=_0x5199f9-0x0;var _0x6f457c=_0x73f1[_0x5199f9];return _0x6f457c;};'use strict';var _=require(_0x173f('0x0'));var md5=require(_0x173f('0x1'));var util=require('util');var Redis=require(_0x173f('0x2'));var config=require('../../../config/environment');config[_0x173f('0x3')]=_['defaults'](config['redis'],{'host':_0x173f('0x4'),'port':0x18eb});var io=require(_0x173f('0x5'))(new Redis(config['redis']));function FaxQueue(_0x3b6484){this['id']=_0x3b6484['id']||0x0;this[_0x173f('0x6')]=_0x3b6484[_0x173f('0x6')]||'';this['timeout']=_0x3b6484[_0x173f('0x7')]||0xa;this[_0x173f('0x8')]=_0x3b6484[_0x173f('0x8')]||_0x173f('0x9');this[_0x173f('0xa')]=_0x3b6484[_0x173f('0xa')];this[_0x173f('0xb')]={};this[_0x173f('0xc')]=0x0;this[_0x173f('0x1')]='';this[_0x173f('0xd')]();this[_0x173f('0xe')]();}FaxQueue[_0x173f('0xf')]['updateRouting']=function(){var _0x26797c=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x173f('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x173f('0x11')]=_0x26797c;};FaxQueue[_0x173f('0xf')][_0x173f('0xe')]=function(){this[_0x173f('0x12')]=0x0;this[_0x173f('0x13')]=0x0;for(var _0x263036=0x0;_0x263036=0x0?this[_0x173f('0x16')]:0x0;var _0x37e188={'id':this['id'],'available':this[_0x173f('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x173f('0x6')],'paused':this['paused'],'waiting':this[_0x173f('0xc')]};var _0x555702=md5(JSON[_0x173f('0x17')](_0x37e188));if(this['md5']!==_0x555702){this[_0x173f('0x1')]=_0x555702;io['to'](util['format'](_0x173f('0x18'),_0x37e188[_0x173f('0x6')]))[_0x173f('0x19')](_0x173f('0x1a'),_0x37e188);}};module[_0x173f('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d5401f5..f2873d1 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 _0xecca=['Intervals','exports','name'];(function(_0xc564,_0x4e2158){var _0x53b573=function(_0x46801b){while(--_0x46801b){_0xc564['push'](_0xc564['shift']());}};_0x53b573(++_0x4e2158);}(_0xecca,0x152));var _0xaecc=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xecca[_0xd1d19a];return _0x52a79d;};'use strict';function Interval(_0x33fc92){this['id']=_0x33fc92['id']||0x0;this[_0xaecc('0x0')]=_0x33fc92[_0xaecc('0x0')]||'';this[_0xaecc('0x1')]=_0x33fc92[_0xaecc('0x1')]||{};}module[_0xaecc('0x2')]=Interval; \ No newline at end of file +var _0xc6fe=['Intervals','name'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xc6fe,0xb9));var _0xec6f=function(_0x367f4e,_0xc86c8e){_0x367f4e=_0x367f4e-0x0;var _0x45d16d=_0xc6fe[_0x367f4e];return _0x45d16d;};'use strict';function Interval(_0x2ec598){this['id']=_0x2ec598['id']||0x0;this[_0xec6f('0x0')]=_0x2ec598[_0xec6f('0x0')]||'';this[_0xec6f('0x1')]=_0x2ec598[_0xec6f('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 389674d..4a9541f 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 _0x434e=['available','format','mail:queue:%s','emit','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','map','_rr','prototype','loggedIn','online','mailPause','paused'];(function(_0x88ae65,_0x207bd0){var _0x8b6282=function(_0x4bdb47){while(--_0x4bdb47){_0x88ae65['push'](_0x88ae65['shift']());}};_0x8b6282(++_0x207bd0);}(_0x434e,0x1d8));var _0xe434=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x434e[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xe434('0x0'));var md5=require(_0xe434('0x1'));var util=require('util');var Redis=require(_0xe434('0x2'));var config=require(_0xe434('0x3'));config[_0xe434('0x4')]=_['defaults'](config[_0xe434('0x4')],{'host':_0xe434('0x5'),'port':0x18eb});var io=require(_0xe434('0x6'))(new Redis(config['redis']));function MailQueue(_0x3334a4){this['id']=_0x3334a4['id']||0x0;this[_0xe434('0x7')]=_0x3334a4[_0xe434('0x7')]||'';this[_0xe434('0x8')]=_0x3334a4[_0xe434('0x8')]||0xa;this[_0xe434('0x9')]=_0x3334a4[_0xe434('0x9')]||'beepall';this[_0xe434('0xa')]=_0x3334a4[_0xe434('0xa')];this[_0xe434('0xb')]={};this[_0xe434('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xe434('0xd')]();}MailQueue['prototype'][_0xe434('0xe')]=function(){var _0x67cf78=this[_0xe434('0xb')]['_rr'];this[_0xe434('0xb')]=_[_0xe434('0xf')](this[_0xe434('0xa')],'id');this[_0xe434('0xb')][_0xe434('0x10')]=_0x67cf78;};MailQueue[_0xe434('0x11')][_0xe434('0xd')]=function(){this[_0xe434('0x12')]=0x0;this['paused']=0x0;for(var _0x49989a=0x0;_0x49989a=0x0?this[_0xe434('0x16')]:0x0;var _0x42ea2e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe434('0x12')],'name':this[_0xe434('0x7')],'paused':this[_0xe434('0x15')],'waiting':this[_0xe434('0xc')]};var _0x12299d=md5(JSON['stringify'](_0x42ea2e));if(this[_0xe434('0x1')]!==_0x12299d){this[_0xe434('0x1')]=_0x12299d;io['to'](util[_0xe434('0x17')](_0xe434('0x18'),_0x42ea2e[_0xe434('0x7')]))[_0xe434('0x19')]('mail_queue:save',_0x42ea2e);}};module['exports']=MailQueue; \ No newline at end of file +var _0x1799=['Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','online','mailPause','available','loggedIn','stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x27dc23,_0x236265){var _0x489a42=function(_0x9e9cc){while(--_0x9e9cc){_0x27dc23['push'](_0x27dc23['shift']());}};_0x489a42(++_0x236265);}(_0x1799,0xa7));var _0x9179=function(_0x32ed8f,_0x4c7ee3){_0x32ed8f=_0x32ed8f-0x0;var _0x545bb3=_0x1799[_0x32ed8f];return _0x545bb3;};'use strict';var _=require(_0x9179('0x0'));var md5=require(_0x9179('0x1'));var util=require(_0x9179('0x2'));var Redis=require(_0x9179('0x3'));var config=require(_0x9179('0x4'));config['redis']=_[_0x9179('0x5')](config[_0x9179('0x6')],{'host':_0x9179('0x7'),'port':0x18eb});var io=require(_0x9179('0x8'))(new Redis(config[_0x9179('0x6')]));function MailQueue(_0x24c799){this['id']=_0x24c799['id']||0x0;this['name']=_0x24c799[_0x9179('0x9')]||'';this[_0x9179('0xa')]=_0x24c799[_0x9179('0xa')]||0xa;this['strategy']=_0x24c799[_0x9179('0xb')]||_0x9179('0xc');this[_0x9179('0xd')]=_0x24c799[_0x9179('0xd')];this['mapAgentsId']={};this[_0x9179('0xe')]=0x0;this[_0x9179('0x1')]='';this[_0x9179('0xf')]();this[_0x9179('0x10')]();}MailQueue[_0x9179('0x11')][_0x9179('0xf')]=function(){var _0x284c1e=this[_0x9179('0x12')][_0x9179('0x13')];this[_0x9179('0x12')]=_[_0x9179('0x14')](this[_0x9179('0xd')],'id');this['mapAgentsId'][_0x9179('0x13')]=_0x284c1e;};MailQueue[_0x9179('0x11')][_0x9179('0x10')]=function(){this['loggedIn']=0x0;this[_0x9179('0x15')]=0x0;for(var _0x3a9523=0x0;_0x3a9523=0x0?this[_0x9179('0x18')]:0x0;var _0x26bdc7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9179('0x19')],'name':this[_0x9179('0x9')],'paused':this[_0x9179('0x15')],'waiting':this[_0x9179('0xe')]};var _0xc57656=md5(JSON[_0x9179('0x1a')](_0x26bdc7));if(this[_0x9179('0x1')]!==_0xc57656){this[_0x9179('0x1')]=_0xc57656;io['to'](util['format'](_0x9179('0x1b'),_0x26bdc7['name']))[_0x9179('0x1c')](_0x9179('0x1d'),_0x26bdc7);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b6567ca..35bb42e 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x17d89e,_0x32606d){var _0x15731c=function(_0x159721){while(--_0x159721){_0x17d89e['push'](_0x17d89e['shift']());}};_0x15731c(++_0x32606d);}(_0x814b,0x1a2));var _0xb814=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x814b[_0x5d23be];return _0x4d60a9;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'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 738cd18..b1b86d7 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 _0xad36=['localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x302421,_0x226244){var _0x419e2a=function(_0xeaf2b5){while(--_0xeaf2b5){_0x302421['push'](_0x302421['shift']());}};_0x419e2a(++_0x226244);}(_0xad36,0x11c));var _0x6ad3=function(_0x5e40b6,_0x2193e9){_0x5e40b6=_0x5e40b6-0x0;var _0x3899c5=_0xad36[_0x5e40b6];return _0x3899c5;};'use strict';var _=require('lodash');var md5=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var Redis=require(_0x6ad3('0x2'));var config=require(_0x6ad3('0x3'));config[_0x6ad3('0x4')]=_[_0x6ad3('0x5')](config[_0x6ad3('0x4')],{'host':_0x6ad3('0x6'),'port':0x18eb});var io=require(_0x6ad3('0x7'))(new Redis(config['redis']));function SmsQueue(_0x2053e8){this['id']=_0x2053e8['id']||0x0;this[_0x6ad3('0x8')]=_0x2053e8[_0x6ad3('0x8')]||'';this[_0x6ad3('0x9')]=_0x2053e8['timeout']||0xa;this['strategy']=_0x2053e8['strategy']||'beepall';this[_0x6ad3('0xa')]=_0x2053e8[_0x6ad3('0xa')];this[_0x6ad3('0xb')]={};this[_0x6ad3('0xc')]=0x0;this[_0x6ad3('0x0')]='';this[_0x6ad3('0xd')]();this[_0x6ad3('0xe')]();}SmsQueue[_0x6ad3('0xf')][_0x6ad3('0xd')]=function(){var _0x4a47d0=this[_0x6ad3('0xb')][_0x6ad3('0x10')];this[_0x6ad3('0xb')]=_[_0x6ad3('0x11')](this[_0x6ad3('0xa')],'id');this[_0x6ad3('0xb')][_0x6ad3('0x10')]=_0x4a47d0;};SmsQueue[_0x6ad3('0xf')]['updateRealtime']=function(){this[_0x6ad3('0x12')]=0x0;this['paused']=0x0;for(var _0x14418f=0x0;_0x14418f=0x0?this['available']:0x0;var _0x358243={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6ad3('0x12')],'name':this[_0x6ad3('0x8')],'paused':this[_0x6ad3('0x16')],'waiting':this[_0x6ad3('0xc')]};var _0x5b20b1=md5(JSON['stringify'](_0x358243));if(this[_0x6ad3('0x0')]!==_0x5b20b1){this[_0x6ad3('0x0')]=_0x5b20b1;io['to'](util[_0x6ad3('0x18')](_0x6ad3('0x19'),_0x358243[_0x6ad3('0x8')]))[_0x6ad3('0x1a')](_0x6ad3('0x1b'),_0x358243);}};module[_0x6ad3('0x1c')]=SmsQueue; \ No newline at end of file +var _0xda55=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','name'];(function(_0x29f730,_0x23d7ed){var _0x189806=function(_0x2838a7){while(--_0x2838a7){_0x29f730['push'](_0x29f730['shift']());}};_0x189806(++_0x23d7ed);}(_0xda55,0x6d));var _0x5da5=function(_0x3d64cf,_0x30ed5f){_0x3d64cf=_0x3d64cf-0x0;var _0x5839fa=_0xda55[_0x3d64cf];return _0x5839fa;};'use strict';var _=require(_0x5da5('0x0'));var md5=require(_0x5da5('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5da5('0x2'));config[_0x5da5('0x3')]=_[_0x5da5('0x4')](config[_0x5da5('0x3')],{'host':_0x5da5('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5da5('0x3')]));function SmsQueue(_0x4b4010){this['id']=_0x4b4010['id']||0x0;this[_0x5da5('0x6')]=_0x4b4010['name']||'';this[_0x5da5('0x7')]=_0x4b4010[_0x5da5('0x7')]||0xa;this[_0x5da5('0x8')]=_0x4b4010[_0x5da5('0x8')]||_0x5da5('0x9');this[_0x5da5('0xa')]=_0x4b4010[_0x5da5('0xa')];this[_0x5da5('0xb')]={};this['waiting']=0x0;this[_0x5da5('0x1')]='';this[_0x5da5('0xc')]();this[_0x5da5('0xd')]();}SmsQueue[_0x5da5('0xe')][_0x5da5('0xc')]=function(){var _0x2a361c=this[_0x5da5('0xb')]['_rr'];this[_0x5da5('0xb')]=_[_0x5da5('0xf')](this['Agents'],'id');this[_0x5da5('0xb')][_0x5da5('0x10')]=_0x2a361c;};SmsQueue[_0x5da5('0xe')][_0x5da5('0xd')]=function(){this[_0x5da5('0x11')]=0x0;this[_0x5da5('0x12')]=0x0;for(var _0x481562=0x0;_0x481562=0x0?this[_0x5da5('0x15')]:0x0;var _0x3f7e98={'id':this['id'],'available':this[_0x5da5('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x5da5('0x6')],'paused':this[_0x5da5('0x12')],'waiting':this[_0x5da5('0x16')]};var _0x30cde5=md5(JSON[_0x5da5('0x17')](_0x3f7e98));if(this['md5']!==_0x30cde5){this[_0x5da5('0x1')]=_0x30cde5;io['to'](util[_0x5da5('0x18')](_0x5da5('0x19'),_0x3f7e98['name']))[_0x5da5('0x1a')](_0x5da5('0x1b'),_0x3f7e98);}};module[_0x5da5('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 adbd522..f5ec91e 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 _0xcfc4=['updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','redis','name','timeout','strategy','Agents','waiting'];(function(_0x819ce,_0xf25f51){var _0x1edcf0=function(_0x192389){while(--_0x192389){_0x819ce['push'](_0x819ce['shift']());}};_0x1edcf0(++_0xf25f51);}(_0xcfc4,0x187));var _0x4cfc=function(_0x139ac3,_0x1470e8){_0x139ac3=_0x139ac3-0x0;var _0x33e0a7=_0xcfc4[_0x139ac3];return _0x33e0a7;};'use strict';var _=require(_0x4cfc('0x0'));var md5=require(_0x4cfc('0x1'));var util=require('util');var Redis=require(_0x4cfc('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4cfc('0x3')]));function WhatsappQueue(_0x97a8b7){this['id']=_0x97a8b7['id']||0x0;this[_0x4cfc('0x4')]=_0x97a8b7[_0x4cfc('0x4')]||'';this[_0x4cfc('0x5')]=_0x97a8b7[_0x4cfc('0x5')]||0xa;this[_0x4cfc('0x6')]=_0x97a8b7[_0x4cfc('0x6')]||'beepall';this[_0x4cfc('0x7')]=_0x97a8b7['Agents'];this['mapAgentsId']={};this[_0x4cfc('0x8')]=0x0;this[_0x4cfc('0x1')]='';this[_0x4cfc('0x9')]();this[_0x4cfc('0xa')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x5ba6f5=this[_0x4cfc('0xb')][_0x4cfc('0xc')];this[_0x4cfc('0xb')]=_[_0x4cfc('0xd')](this['Agents'],'id');this['mapAgentsId'][_0x4cfc('0xc')]=_0x5ba6f5;};WhatsappQueue[_0x4cfc('0xe')][_0x4cfc('0xa')]=function(){this[_0x4cfc('0xf')]=0x0;this[_0x4cfc('0x10')]=0x0;for(var _0x35e79b=0x0;_0x35e79b=0x0?this['available']:0x0;var _0x55e383={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4cfc('0x8')]};var _0x188874=md5(JSON['stringify'](_0x55e383));if(this[_0x4cfc('0x1')]!==_0x188874){this[_0x4cfc('0x1')]=_0x188874;io['to'](util[_0x4cfc('0x15')](_0x4cfc('0x16'),_0x55e383[_0x4cfc('0x4')]))[_0x4cfc('0x17')]('whatsapp_queue:save',_0x55e383);}};module[_0x4cfc('0x18')]=WhatsappQueue; \ No newline at end of file +var _0xf669=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','available','stringify','format','emit','exports','lodash','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x58e2a5,_0x4e822c){var _0x440ba0=function(_0x375d68){while(--_0x375d68){_0x58e2a5['push'](_0x58e2a5['shift']());}};_0x440ba0(++_0x4e822c);}(_0xf669,0xd6));var _0x9f66=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf669[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9f66('0x0'));var md5=require(_0x9f66('0x1'));var util=require(_0x9f66('0x2'));var Redis=require('ioredis');var config=require(_0x9f66('0x3'));config['redis']=_[_0x9f66('0x4')](config[_0x9f66('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9f66('0x6'))(new Redis(config[_0x9f66('0x5')]));function WhatsappQueue(_0x158375){this['id']=_0x158375['id']||0x0;this[_0x9f66('0x7')]=_0x158375[_0x9f66('0x7')]||'';this[_0x9f66('0x8')]=_0x158375[_0x9f66('0x8')]||0xa;this['strategy']=_0x158375[_0x9f66('0x9')]||_0x9f66('0xa');this[_0x9f66('0xb')]=_0x158375['Agents'];this[_0x9f66('0xc')]={};this[_0x9f66('0xd')]=0x0;this['md5']='';this[_0x9f66('0xe')]();this[_0x9f66('0xf')]();}WhatsappQueue[_0x9f66('0x10')]['updateRouting']=function(){var _0x9477d9=this[_0x9f66('0xc')][_0x9f66('0x11')];this[_0x9f66('0xc')]=_[_0x9f66('0x12')](this['Agents'],'id');this[_0x9f66('0xc')][_0x9f66('0x11')]=_0x9477d9;};WhatsappQueue[_0x9f66('0x10')][_0x9f66('0xf')]=function(){this[_0x9f66('0x13')]=0x0;this['paused']=0x0;for(var _0x5342c5=0x0;_0x5342c5=0x0?this[_0x9f66('0x17')]:0x0;var _0x56f3df={'id':this['id'],'available':this[_0x9f66('0x17')],'loggedIn':this[_0x9f66('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x3165ad=md5(JSON[_0x9f66('0x18')](_0x56f3df));if(this[_0x9f66('0x1')]!==_0x3165ad){this[_0x9f66('0x1')]=_0x3165ad;io['to'](util[_0x9f66('0x19')]('whatsapp:queue:%s',_0x56f3df[_0x9f66('0x7')]))[_0x9f66('0x1a')]('whatsapp_queue:save',_0x56f3df);}};module[_0x9f66('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 639d2dd..9449506 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(_0x5a9980,_0x4c54a7){var _0x200d99=function(_0x280caf){while(--_0x280caf){_0x5a9980['push'](_0x5a9980['shift']());}};_0x200d99(++_0x4c54a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0xb10b[_0x3d6db1];return _0x5e1cc3;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ebb9834..5dc083b 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 _0x290b=['Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x1c1913,_0x1d1b59){var _0x3b352a=function(_0x1f97d0){while(--_0x1f97d0){_0x1c1913['push'](_0x1c1913['shift']());}};_0x3b352a(++_0x1d1b59);}(_0x290b,0x16a));var _0xb290=function(_0x3a4ff3,_0x87bf88){_0x3a4ff3=_0x3a4ff3-0x0;var _0x4d781c=_0x290b[_0x3a4ff3];return _0x4d781c;};'use strict';var client=require(_0xb290('0x0'));exports[_0xb290('0x1')]=function(_0x4b3355,_0x307b55){return client[_0xb290('0x2')](_0xb290('0x3'),{'body':_0x307b55,'options':{'where':{'id':_0x4b3355}},'log':_0xb290('0x4')});};exports[_0xb290('0x5')]=function(_0x540a78,_0x4301f){return client[_0xb290('0x2')]('AddTagsToChatInteraction',{'body':_0x4301f,'options':{'where':{'id':_0x540a78}},'log':_0xb290('0x6')});}; \ No newline at end of file +var _0xe776=['update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x3702f8,_0x5d2ca3){var _0x416857=function(_0x3215f7){while(--_0x3215f7){_0x3702f8['push'](_0x3702f8['shift']());}};_0x416857(++_0x5d2ca3);}(_0xe776,0x1b8));var _0x6e77=function(_0x3b7a53,_0x444dd7){_0x3b7a53=_0x3b7a53-0x0;var _0x163008=_0xe776[_0x3b7a53];return _0x163008;};'use strict';var client=require(_0x6e77('0x0'));exports[_0x6e77('0x1')]=function(_0x35c407,_0x1ade4e){return client[_0x6e77('0x2')](_0x6e77('0x3'),{'body':_0x1ade4e,'options':{'where':{'id':_0x35c407}},'log':'updateChatInteraction'});};exports[_0x6e77('0x4')]=function(_0x28090d,_0x3a4dbb){return client[_0x6e77('0x2')](_0x6e77('0x5'),{'body':_0x3a4dbb,'options':{'where':{'id':_0x28090d}},'log':_0x6e77('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 63cfe0e..4b113fc 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 _0xfa86=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x13700d,_0x5bfb92){var _0x451421=function(_0xf176f1){while(--_0xf176f1){_0x13700d['push'](_0x13700d['shift']());}};_0x451421(++_0x5bfb92);}(_0xfa86,0x118));var _0x6fa8=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0xfa86[_0x3074f3];return _0x53f112;};'use strict';var client=require('../client');exports[_0x6fa8('0x0')]=function(_0x3c4df2){return client[_0x6fa8('0x1')](_0x6fa8('0x2'),{'body':_0x3c4df2,'log':_0x6fa8('0x3')});}; \ No newline at end of file +var _0x9b74=['Request','CreateChatMessage','create'];(function(_0x4aa0a6,_0x594b34){var _0x2e402d=function(_0x362920){while(--_0x362920){_0x4aa0a6['push'](_0x4aa0a6['shift']());}};_0x2e402d(++_0x594b34);}(_0x9b74,0x71));var _0x49b7=function(_0x10e3c6,_0x38a9fa){_0x10e3c6=_0x10e3c6-0x0;var _0x163883=_0x9b74[_0x10e3c6];return _0x163883;};'use strict';var client=require('../client');exports[_0x49b7('0x0')]=function(_0x5d548d){return client[_0x49b7('0x1')](_0x49b7('0x2'),{'body':_0x5d548d,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ff3e0b5..2228412 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 _0x624c=['name','timeout','User','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x624c,0x1ee));var _0xc624=function(_0x497826,_0x164921){_0x497826=_0x497826-0x0;var _0x4b3ae6=_0x624c[_0x497826];return _0x4b3ae6;};'use strict';var client=require('../client');exports[_0xc624('0x0')]=function(){return function(){return client[_0xc624('0x1')](_0xc624('0x2'),{'options':{'raw':![],'attributes':['id',_0xc624('0x3'),_0xc624('0x4'),'strategy'],'include':[{'model':_0xc624('0x5'),'as':'Agents','attributes':['id',_0xc624('0x3'),'online',_0xc624('0x6')]}]},'log':_0xc624('0x0')});};}; \ No newline at end of file +var _0x46ed=['../client','getChatQueues','GetChatQueue','name','timeout','User','Agents','online','chatPause'];(function(_0x153faa,_0x75f2a){var _0x43c32a=function(_0x1c5721){while(--_0x1c5721){_0x153faa['push'](_0x153faa['shift']());}};_0x43c32a(++_0x75f2a);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0xd46e('0x0'));exports[_0xd46e('0x1')]=function(){return function(){return client['Request'](_0xd46e('0x2'),{'options':{'raw':![],'attributes':['id',_0xd46e('0x3'),_0xd46e('0x4'),'strategy'],'include':[{'model':_0xd46e('0x5'),'as':_0xd46e('0x6'),'attributes':['id','name',_0xd46e('0x7'),_0xd46e('0x8')]}]},'log':_0xd46e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 262b0d7..bdedd02 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 _0x1bca=['UpdateChatQueueReport','DESC','create','CreateChatQueueReport','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1bca,0xb6));var _0xa1bc=function(_0x55b6a6,_0x1f6235){_0x55b6a6=_0x55b6a6-0x0;var _0x4d7974=_0x1bca[_0x55b6a6];return _0x4d7974;};'use strict';var client=require('../client');exports[_0xa1bc('0x0')]=function(_0x4a2571){return client['Request'](_0xa1bc('0x1'),{'body':_0x4a2571,'log':'CreateChatQueueReport'});};exports[_0xa1bc('0x2')]=function(_0x1fa3d2,_0x3469ad){return client['Request'](_0xa1bc('0x3'),{'body':_0x3469ad,'options':{'where':{'uniqueid':_0x1fa3d2},'order':[['id',_0xa1bc('0x4')]],'limit':0x1},'log':_0xa1bc('0x3')});}; \ No newline at end of file +var _0x12c9=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x1fdcd4,_0x530442){var _0x148627=function(_0x436704){while(--_0x436704){_0x1fdcd4['push'](_0x1fdcd4['shift']());}};_0x148627(++_0x530442);}(_0x12c9,0x1c9));var _0x912c=function(_0x4d4f6d,_0x38b75b){_0x4d4f6d=_0x4d4f6d-0x0;var _0x5a040b=_0x12c9[_0x4d4f6d];return _0x5a040b;};'use strict';var client=require(_0x912c('0x0'));exports[_0x912c('0x1')]=function(_0x7a27c0){return client[_0x912c('0x2')](_0x912c('0x3'),{'body':_0x7a27c0,'log':'CreateChatQueueReport'});};exports[_0x912c('0x4')]=function(_0xcb7adc,_0x2c8059){return client[_0x912c('0x2')](_0x912c('0x5'),{'body':_0x2c8059,'options':{'where':{'uniqueid':_0xcb7adc},'order':[['id','DESC']],'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 dafbd27..70345ee 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x7a54,0x106));var _0x47a5=function(_0x45d7a6,_0x277ed6){_0x45d7a6=_0x45d7a6-0x0;var _0x3758e6=_0x7a54[_0x45d7a6];return _0x3758e6;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x527de0,_0x2c060f){var _0x56107c=function(_0x5dd248){while(--_0x5dd248){_0x527de0['push'](_0x527de0['shift']());}};_0x56107c(++_0x2c060f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3a5490a..65353bc 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 _0xaf9d=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x133db1,_0x3eaab6){var _0x5065b7=function(_0x526681){while(--_0x526681){_0x133db1['push'](_0x133db1['shift']());}};_0x5065b7(++_0x3eaab6);}(_0xaf9d,0xbf));var _0xdaf9=function(_0x9bd950,_0x4bfda0){_0x9bd950=_0x9bd950-0x0;var _0x73aaf9=_0xaf9d[_0x9bd950];return _0x73aaf9;};'use strict';var client=require('../client');exports[_0xdaf9('0x0')]=function(_0x5b4d99){return client[_0xdaf9('0x1')](_0xdaf9('0x2'),{'body':_0x5b4d99,'log':_0xdaf9('0x3')});}; \ No newline at end of file +var _0x8b58=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x20f867,_0x50aafd){var _0x13d7a4=function(_0xd528a2){while(--_0xd528a2){_0x20f867['push'](_0x20f867['shift']());}};_0x13d7a4(++_0x50aafd);}(_0x8b58,0xa2));var _0x88b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b58[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x2e7053){return client[_0x88b5('0x0')](_0x88b5('0x1'),{'body':_0x2e7053,'log':_0x88b5('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index ac528b5..3d50ef5 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 _0x860d=['online','../client','getFaxQueues','GetFaxQueue','name','strategy','User','Agents'];(function(_0x2331dc,_0x35bc39){var _0x32af23=function(_0x2564d6){while(--_0x2564d6){_0x2331dc['push'](_0x2331dc['shift']());}};_0x32af23(++_0x35bc39);}(_0x860d,0xf1));var _0xd860=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x860d[_0x592d48];return _0x5d789e;};'use strict';var client=require(_0xd860('0x0'));exports[_0xd860('0x1')]=function(){return function(){return client['Request'](_0xd860('0x2'),{'options':{'raw':![],'attributes':['id',_0xd860('0x3'),'timeout',_0xd860('0x4')],'include':[{'model':_0xd860('0x5'),'as':_0xd860('0x6'),'attributes':['id',_0xd860('0x3'),_0xd860('0x7'),'faxPause']}]},'log':_0xd860('0x1')});};}; \ No newline at end of file +var _0xfd5c=['name','strategy','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x53fcb5,_0x16077b){var _0x42cd34=function(_0x3f9125){while(--_0x3f9125){_0x53fcb5['push'](_0x53fcb5['shift']());}};_0x42cd34(++_0x16077b);}(_0xfd5c,0x134));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xcfd5('0x0'));exports[_0xcfd5('0x1')]=function(){return function(){return client[_0xcfd5('0x2')](_0xcfd5('0x3'),{'options':{'raw':![],'attributes':['id',_0xcfd5('0x4'),'timeout',_0xcfd5('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xcfd5('0x4'),_0xcfd5('0x6'),_0xcfd5('0x7')]}]},'log':_0xcfd5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 54e69f1..87ba117 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 _0x5650=['../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x51d780,_0x151f65){var _0x37ebad=function(_0x2ddda8){while(--_0x2ddda8){_0x51d780['push'](_0x51d780['shift']());}};_0x37ebad(++_0x151f65);}(_0x5650,0xd8));var _0x0565=function(_0x22395a,_0x4a4fd0){_0x22395a=_0x22395a-0x0;var _0x436c90=_0x5650[_0x22395a];return _0x436c90;};'use strict';var client=require(_0x0565('0x0'));exports[_0x0565('0x1')]=function(_0x4e13e0){return client[_0x0565('0x2')]('CreateFaxQueueReport',{'body':_0x4e13e0,'log':_0x0565('0x3')});};exports['update']=function(_0x2bb63a,_0x16dd62){return client[_0x0565('0x2')](_0x0565('0x4'),{'body':_0x16dd62,'options':{'where':{'uniqueid':_0x2bb63a},'order':[['id',_0x0565('0x5')]],'limit':0x1},'log':_0x0565('0x4')});}; \ No newline at end of file +var _0xffcf=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xffcf,0x180));var _0xfffc=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xffcf[_0xb833b1];return _0x1ab87a;};'use strict';var client=require(_0xfffc('0x0'));exports[_0xfffc('0x1')]=function(_0x580d82){return client[_0xfffc('0x2')]('CreateFaxQueueReport',{'body':_0x580d82,'log':_0xfffc('0x3')});};exports[_0xfffc('0x4')]=function(_0x8711ef,_0x218adf){return client[_0xfffc('0x2')](_0xfffc('0x5'),{'body':_0x218adf,'options':{'where':{'uniqueid':_0x8711ef},'order':[['id','DESC']],'limit':0x1},'log':_0xfffc('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 163a9c9..5c455c9 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 _0xfbb1=['name','Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x2642e9,_0x23363b){var _0x288933=function(_0x1d51ce){while(--_0x1d51ce){_0x2642e9['push'](_0x2642e9['shift']());}};_0x288933(++_0x23363b);}(_0xfbb1,0x73));var _0x1fbb=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0xfbb1[_0xe84805];return _0x398efd;};'use strict';var client=require(_0x1fbb('0x0'));exports[_0x1fbb('0x1')]=function(){return function(){return client[_0x1fbb('0x2')](_0x1fbb('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1fbb('0x4')],'include':[{'model':'Interval','as':_0x1fbb('0x5'),'attributes':['id',_0x1fbb('0x4'),_0x1fbb('0x6')]}]},'log':_0x1fbb('0x1')});};}; \ No newline at end of file +var _0xd5da=['name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x1d432d,_0x401149){var _0x338acb=function(_0x194623){while(--_0x194623){_0x1d432d['push'](_0x1d432d['shift']());}};_0x338acb(++_0x401149);}(_0xd5da,0x82));var _0xad5d=function(_0x3df45b,_0xe6e277){_0x3df45b=_0x3df45b-0x0;var _0x24f10b=_0xd5da[_0x3df45b];return _0x24f10b;};'use strict';var client=require(_0xad5d('0x0'));exports[_0xad5d('0x1')]=function(){return function(){return client[_0xad5d('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xad5d('0x3')],'include':[{'model':_0xad5d('0x4'),'as':_0xad5d('0x5'),'attributes':['id',_0xad5d('0x3'),_0xad5d('0x6')]}]},'log':_0xad5d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 50197e9..5735722 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 _0x0598=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','updateMailInteraction','addTags'];(function(_0x1279b3,_0x559152){var _0x322a62=function(_0x1fed17){while(--_0x1fed17){_0x1279b3['push'](_0x1279b3['shift']());}};_0x322a62(++_0x559152);}(_0x0598,0x92));var _0x8059=function(_0x33ba50,_0x45ac70){_0x33ba50=_0x33ba50-0x0;var _0x107458=_0x0598[_0x33ba50];return _0x107458;};'use strict';var client=require(_0x8059('0x0'));exports[_0x8059('0x1')]=function(_0x5c8253,_0x3386f0){return client['Request']('UpdateMailInteraction',{'body':_0x3386f0,'options':{'where':{'id':_0x5c8253}},'log':_0x8059('0x2')});};exports[_0x8059('0x3')]=function(_0x54b9a2,_0x54f42f){return client['Request'](_0x8059('0x4'),{'body':_0x54f42f,'options':{'where':{'id':_0x54b9a2}},'log':_0x8059('0x5')});}; \ No newline at end of file +var _0x4e2e=['UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','update','Request'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x4fd474,_0x168ebb){_0x4fd474=_0x4fd474-0x0;var _0x597b20=_0x4e2e[_0x4fd474];return _0x597b20;};'use strict';var client=require('../client');exports[_0xe4e2('0x0')]=function(_0x219d18,_0x2ae450){return client[_0xe4e2('0x1')](_0xe4e2('0x2'),{'body':_0x2ae450,'options':{'where':{'id':_0x219d18}},'log':_0xe4e2('0x3')});};exports['addTags']=function(_0xfd2203,_0x417dd4){return client[_0xe4e2('0x1')](_0xe4e2('0x4'),{'body':_0x417dd4,'options':{'where':{'id':_0xfd2203}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a1e03fa..26e3647 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 _0x1341=['create','createMailMessage'];(function(_0x58c5fe,_0x268459){var _0x6054ad=function(_0x14c7a3){while(--_0x14c7a3){_0x58c5fe['push'](_0x58c5fe['shift']());}};_0x6054ad(++_0x268459);}(_0x1341,0xda));var _0x1134=function(_0x2830a8,_0x2b349f){_0x2830a8=_0x2830a8-0x0;var _0x363f70=_0x1341[_0x2830a8];return _0x363f70;};'use strict';var client=require('../client');exports[_0x1134('0x0')]=function(_0x551ca9){return client['Request']('CreateMailMessage',{'body':_0x551ca9,'log':_0x1134('0x1')});}; \ No newline at end of file +var _0x2cc1=['Request','../client','create'];(function(_0x23099a,_0x2b5805){var _0x37d69c=function(_0xd2830e){while(--_0xd2830e){_0x23099a['push'](_0x23099a['shift']());}};_0x37d69c(++_0x2b5805);}(_0x2cc1,0x19c));var _0x12cc=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x2cc1[_0x284506];return _0x1e9ee5;};'use strict';var client=require(_0x12cc('0x0'));exports[_0x12cc('0x1')]=function(_0x47fa27){return client[_0x12cc('0x2')]('CreateMailMessage',{'body':_0x47fa27,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b2fa0f6..f4f91b1 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 _0x1313=['getMailQueues','../client','GetMailQueue','name','timeout','strategy','Agents','online'];(function(_0x2594a0,_0x2fcd63){var _0x30be9b=function(_0xc7375e){while(--_0xc7375e){_0x2594a0['push'](_0x2594a0['shift']());}};_0x30be9b(++_0x2fcd63);}(_0x1313,0x1e1));var _0x3131=function(_0xc8cb5c,_0x38355d){_0xc8cb5c=_0xc8cb5c-0x0;var _0x1fff99=_0x1313[_0xc8cb5c];return _0x1fff99;};'use strict';var client=require(_0x3131('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x3131('0x1'),{'options':{'raw':![],'attributes':['id',_0x3131('0x2'),_0x3131('0x3'),_0x3131('0x4')],'include':[{'model':'User','as':_0x3131('0x5'),'attributes':['id',_0x3131('0x2'),_0x3131('0x6'),'mailPause']}]},'log':_0x3131('0x7')});};}; \ No newline at end of file +var _0xa204=['GetMailQueue','name','User','Agents','online','getMailQueues','Request'];(function(_0x1bb6dd,_0xc72b43){var _0x34b2f0=function(_0x19cd7c){while(--_0x19cd7c){_0x1bb6dd['push'](_0x1bb6dd['shift']());}};_0x34b2f0(++_0xc72b43);}(_0xa204,0x101));var _0x4a20=function(_0x47f89d,_0x2039df){_0x47f89d=_0x47f89d-0x0;var _0x1d512a=_0xa204[_0x47f89d];return _0x1d512a;};'use strict';var client=require('../client');exports[_0x4a20('0x0')]=function(){return function(){return client[_0x4a20('0x1')](_0x4a20('0x2'),{'options':{'raw':![],'attributes':['id',_0x4a20('0x3'),'timeout','strategy'],'include':[{'model':_0x4a20('0x4'),'as':_0x4a20('0x5'),'attributes':['id','name',_0x4a20('0x6'),'mailPause']}]},'log':_0x4a20('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 2748cc0..89c2f00 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 _0xf86f=['../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x5e832c,_0x5c9cb1){var _0x4d7d1d=function(_0x30021c){while(--_0x30021c){_0x5e832c['push'](_0x5e832c['shift']());}};_0x4d7d1d(++_0x5c9cb1);}(_0xf86f,0x102));var _0xff86=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0xf86f[_0x534c8f];return _0x5a57f5;};'use strict';var client=require(_0xff86('0x0'));exports['create']=function(_0xfa983b){return client[_0xff86('0x1')](_0xff86('0x2'),{'body':_0xfa983b,'log':_0xff86('0x2')});};exports[_0xff86('0x3')]=function(_0x1008f2,_0x407c03){return client['Request'](_0xff86('0x4'),{'body':_0x407c03,'options':{'where':{'uniqueid':_0x1008f2},'order':[['id',_0xff86('0x5')]],'limit':0x1},'log':_0xff86('0x4')});}; \ No newline at end of file +var _0x0568=['Request','UpdateMailQueueReport','DESC','CreateMailQueueReport','update'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0x0568,0x120));var _0x8056=function(_0x1bcb46,_0x4226bc){_0x1bcb46=_0x1bcb46-0x0;var _0xfaf7e8=_0x0568[_0x1bcb46];return _0xfaf7e8;};'use strict';var client=require('../client');exports['create']=function(_0x282d12){return client['Request'](_0x8056('0x0'),{'body':_0x282d12,'log':_0x8056('0x0')});};exports[_0x8056('0x1')]=function(_0x56adf4,_0x4bdab9){return client[_0x8056('0x2')](_0x8056('0x3'),{'body':_0x4bdab9,'options':{'where':{'uniqueid':_0x56adf4},'order':[['id',_0x8056('0x4')]],'limit':0x1},'log':_0x8056('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ad756a4..83c9fe5 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 _0xdf51=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xdf51,0x11f));var _0x1df5=function(_0x4346c4,_0x53ac29){_0x4346c4=_0x4346c4-0x0;var _0x304289=_0xdf51[_0x4346c4];return _0x304289;};'use strict';var client=require(_0x1df5('0x0'));exports[_0x1df5('0x1')]=function(_0x47d107,_0x126dbe){return client[_0x1df5('0x2')](_0x1df5('0x3'),{'body':_0x126dbe,'options':{'where':{'id':_0x47d107}},'log':_0x1df5('0x4')});};exports['addTags']=function(_0x132b47,_0xe47a13){return client['Request'](_0x1df5('0x5'),{'body':_0xe47a13,'options':{'where':{'id':_0x132b47}},'log':_0x1df5('0x6')});}; \ No newline at end of file +var _0x0bb2=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x200b42,_0x398239){var _0x329fa9=function(_0x58eefc){while(--_0x58eefc){_0x200b42['push'](_0x200b42['shift']());}};_0x329fa9(++_0x398239);}(_0x0bb2,0x1e3));var _0x20bb=function(_0x1fdfcb,_0x544ed0){_0x1fdfcb=_0x1fdfcb-0x0;var _0x474e72=_0x0bb2[_0x1fdfcb];return _0x474e72;};'use strict';var client=require(_0x20bb('0x0'));exports[_0x20bb('0x1')]=function(_0x3a77ad,_0x51405a){return client[_0x20bb('0x2')](_0x20bb('0x3'),{'body':_0x51405a,'options':{'where':{'id':_0x3a77ad}},'log':_0x20bb('0x4')});};exports[_0x20bb('0x5')]=function(_0x43f5de,_0x1a978a){return client[_0x20bb('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x1a978a,'options':{'where':{'id':_0x43f5de}},'log':_0x20bb('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2e2693e..179683e 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 _0xdda9=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x446e63,_0x2ed366){var _0x5e615a=function(_0x5279e0){while(--_0x5279e0){_0x446e63['push'](_0x446e63['shift']());}};_0x5e615a(++_0x2ed366);}(_0xdda9,0x82));var _0x9dda=function(_0x24901e,_0x53f656){_0x24901e=_0x24901e-0x0;var _0xbb2191=_0xdda9[_0x24901e];return _0xbb2191;};'use strict';var client=require(_0x9dda('0x0'));exports[_0x9dda('0x1')]=function(_0x26671e){return client[_0x9dda('0x2')](_0x9dda('0x3'),{'body':_0x26671e,'log':_0x9dda('0x4')});}; \ No newline at end of file +var _0x46a7=['createOpenchannelMessage','../client','create','Request'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0x46a7,0x65));var _0x746a=function(_0x1a24f3,_0x554899){_0x1a24f3=_0x1a24f3-0x0;var _0x2cd732=_0x46a7[_0x1a24f3];return _0x2cd732;};'use strict';var client=require(_0x746a('0x0'));exports[_0x746a('0x1')]=function(_0x1212ec){return client[_0x746a('0x2')]('CreateOpenchannelMessage',{'body':_0x1212ec,'log':_0x746a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3f357b2..3b358dd 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 _0xb53b=['openchannelPause','getOpenchannelQueues','../client','Request','name','timeout','strategy','User','Agents'];(function(_0x5b2b9b,_0x1e3ed2){var _0x3a01cd=function(_0x37dd73){while(--_0x37dd73){_0x5b2b9b['push'](_0x5b2b9b['shift']());}};_0x3a01cd(++_0x1e3ed2);}(_0xb53b,0x1d6));var _0xbb53=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb53b[_0x34bc30];return _0x5706de;};'use strict';var client=require(_0xbb53('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xbb53('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xbb53('0x2'),_0xbb53('0x3'),_0xbb53('0x4')],'include':[{'model':_0xbb53('0x5'),'as':_0xbb53('0x6'),'attributes':['id',_0xbb53('0x2'),'online',_0xbb53('0x7')]}]},'log':_0xbb53('0x8')});};}; \ No newline at end of file +var _0x67c1=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents'];(function(_0x3e5150,_0x4b4463){var _0x28c8b5=function(_0x3bab8c){while(--_0x3bab8c){_0x3e5150['push'](_0x3e5150['shift']());}};_0x28c8b5(++_0x4b4463);}(_0x67c1,0x14c));var _0x167c=function(_0x2eb64f,_0x3f09b3){_0x2eb64f=_0x2eb64f-0x0;var _0x550bfc=_0x67c1[_0x2eb64f];return _0x550bfc;};'use strict';var client=require(_0x167c('0x0'));exports[_0x167c('0x1')]=function(){return function(){return client[_0x167c('0x2')](_0x167c('0x3'),{'options':{'raw':![],'attributes':['id',_0x167c('0x4'),'timeout',_0x167c('0x5')],'include':[{'model':_0x167c('0x6'),'as':_0x167c('0x7'),'attributes':['id',_0x167c('0x4'),_0x167c('0x8'),_0x167c('0x9')]}]},'log':_0x167c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1555d40..78410b8 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 _0xee64=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x5d8232,_0x156279){var _0x5daf30=function(_0x1ef696){while(--_0x1ef696){_0x5d8232['push'](_0x5d8232['shift']());}};_0x5daf30(++_0x156279);}(_0xee64,0x14d));var _0x4ee6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xee64[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x4ee6('0x0'));exports[_0x4ee6('0x1')]=function(_0x3ec814){return client[_0x4ee6('0x2')](_0x4ee6('0x3'),{'body':_0x3ec814,'log':_0x4ee6('0x3')});};exports[_0x4ee6('0x4')]=function(_0xfcc4c8,_0x10c172){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x10c172,'options':{'where':{'uniqueid':_0xfcc4c8},'order':[['id','DESC']],'limit':0x1},'log':_0x4ee6('0x5')});}; \ No newline at end of file +var _0x1b58=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x2f00dd,_0xd659bd){var _0x1bfa6c=function(_0x483ef3){while(--_0x483ef3){_0x2f00dd['push'](_0x2f00dd['shift']());}};_0x1bfa6c(++_0xd659bd);}(_0x1b58,0x184));var _0x81b5=function(_0x4e6b85,_0xecc5db){_0x4e6b85=_0x4e6b85-0x0;var _0x97233=_0x1b58[_0x4e6b85];return _0x97233;};'use strict';var client=require(_0x81b5('0x0'));exports[_0x81b5('0x1')]=function(_0x1372c7){return client[_0x81b5('0x2')](_0x81b5('0x3'),{'body':_0x1372c7,'log':_0x81b5('0x3')});};exports[_0x81b5('0x4')]=function(_0x1d4bec,_0x1bc460){return client[_0x81b5('0x2')](_0x81b5('0x5'),{'body':_0x1bc460,'options':{'where':{'uniqueid':_0x1d4bec},'order':[['id',_0x81b5('0x6')]],'limit':0x1},'log':_0x81b5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 34d1d6d..6fab8ba 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 _0x2821=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x2821,0xc3));var _0x1282=function(_0x14339d,_0x483dc3){_0x14339d=_0x14339d-0x0;var _0x515270=_0x2821[_0x14339d];return _0x515270;};'use strict';var client=require(_0x1282('0x0'));exports[_0x1282('0x1')]=function(_0x21120c,_0x24382c){return client[_0x1282('0x2')](_0x1282('0x3'),{'body':_0x24382c,'options':{'where':{'id':_0x21120c}},'log':'updateSmsInteraction'});};exports[_0x1282('0x4')]=function(_0x36f2c2,_0x4b7e46){return client[_0x1282('0x2')](_0x1282('0x5'),{'body':_0x4b7e46,'options':{'where':{'id':_0x36f2c2}},'log':_0x1282('0x6')});}; \ No newline at end of file +var _0x1af5=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x15915c,_0x1a843d){var _0x3c8ad8=function(_0x1c45b5){while(--_0x1c45b5){_0x15915c['push'](_0x15915c['shift']());}};_0x3c8ad8(++_0x1a843d);}(_0x1af5,0x17d));var _0x51af=function(_0x1ea650,_0x252788){_0x1ea650=_0x1ea650-0x0;var _0x3451f6=_0x1af5[_0x1ea650];return _0x3451f6;};'use strict';var client=require(_0x51af('0x0'));exports['update']=function(_0x45dbac,_0x26eee9){return client[_0x51af('0x1')](_0x51af('0x2'),{'body':_0x26eee9,'options':{'where':{'id':_0x45dbac}},'log':_0x51af('0x3')});};exports[_0x51af('0x4')]=function(_0x3e09ac,_0x1ef226){return client[_0x51af('0x1')](_0x51af('0x5'),{'body':_0x1ef226,'options':{'where':{'id':_0x3e09ac}},'log':_0x51af('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c54ab48..3ae9fca 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 _0xee58=['../client','Request','CreateSmsMessage'];(function(_0x542951,_0x11882b){var _0x5d6034=function(_0x3fa8bc){while(--_0x3fa8bc){_0x542951['push'](_0x542951['shift']());}};_0x5d6034(++_0x11882b);}(_0xee58,0x93));var _0x8ee5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xee58[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x8ee5('0x0'));exports['create']=function(_0x2264e6){return client[_0x8ee5('0x1')](_0x8ee5('0x2'),{'body':_0x2264e6,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x5df2=['create','Request','createSmsMessage'];(function(_0x5b3fae,_0x4b7557){var _0xfc0188=function(_0xefb0fe){while(--_0xefb0fe){_0x5b3fae['push'](_0x5b3fae['shift']());}};_0xfc0188(++_0x4b7557);}(_0x5df2,0x156));var _0x25df=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x5df2[_0x58e469];return _0x4c01c5;};'use strict';var client=require('../client');exports[_0x25df('0x0')]=function(_0x1a63e9){return client[_0x25df('0x1')]('CreateSmsMessage',{'body':_0x1a63e9,'log':_0x25df('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 8d335c2..70723f6 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x4e49d7,_0x36fc2d){var _0x1636d2=function(_0x147989){while(--_0x147989){_0x4e49d7['push'](_0x4e49d7['shift']());}};_0x1636d2(++_0x36fc2d);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x416dc1,_0x4b6eec){var _0x1c5e8a=function(_0x99a466){while(--_0x99a466){_0x416dc1['push'](_0x416dc1['shift']());}};_0x1c5e8a(++_0x4b6eec);}(_0xe706,0xa3));var _0x6e70=function(_0x1a3fe2,_0x553b71){_0x1a3fe2=_0x1a3fe2-0x0;var _0x490ee2=_0xe706[_0x1a3fe2];return _0x490ee2;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 4d70fec..8f0c77d 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2a0e80,_0x379250){var _0x5a3500=function(_0x59248f){while(--_0x59248f){_0x2a0e80['push'](_0x2a0e80['shift']());}};_0x5a3500(++_0x379250);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0xedd9,0xfc));var _0x9edd=function(_0x53ce7b,_0x165c0b){_0x53ce7b=_0x53ce7b-0x0;var _0x1448cd=_0xedd9[_0x53ce7b];return _0x1448cd;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6c6fc87..aab375b 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(_0x356165,_0xd928e){var _0x169c82=function(_0x4ac13b){while(--_0x4ac13b){_0x356165['push'](_0x356165['shift']());}};_0x169c82(++_0xd928e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x396832,_0x467a23){var _0x19504d=function(_0x3ebab0){while(--_0x3ebab0){_0x396832['push'](_0x396832['shift']());}};_0x19504d(++_0x467a23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 17bc988..98d3b72 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 _0x5d17=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x34358f,_0x3e021d){var _0x5c71c1=function(_0x1033bf){while(--_0x1033bf){_0x34358f['push'](_0x34358f['shift']());}};_0x5c71c1(++_0x3e021d);}(_0x5d17,0x114));var _0x75d1=function(_0xf93076,_0x1acb30){_0xf93076=_0xf93076-0x0;var _0x33d1da=_0x5d17[_0xf93076];return _0x33d1da;};'use strict';var client=require(_0x75d1('0x0'));exports[_0x75d1('0x1')]=function(_0x58fb6b,_0x5b3ed3){return client[_0x75d1('0x2')](_0x75d1('0x3'),{'body':_0x5b3ed3,'options':{'where':{'id':_0x58fb6b}},'log':_0x75d1('0x4')});};exports['addTags']=function(_0x177460,_0x45d03a){return client[_0x75d1('0x2')](_0x75d1('0x5'),{'body':_0x45d03a,'options':{'where':{'id':_0x177460}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xed54=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xed54,0xfc));var _0x4ed5=function(_0x2eda7e,_0x194ea5){_0x2eda7e=_0x2eda7e-0x0;var _0x6901b9=_0xed54[_0x2eda7e];return _0x6901b9;};'use strict';var client=require('../client');exports[_0x4ed5('0x0')]=function(_0x2c284e,_0x1ac6d6){return client[_0x4ed5('0x1')]('UpdateWhatsappInteraction',{'body':_0x1ac6d6,'options':{'where':{'id':_0x2c284e}},'log':_0x4ed5('0x2')});};exports[_0x4ed5('0x3')]=function(_0x5f4777,_0x5c6d8b){return client[_0x4ed5('0x1')](_0x4ed5('0x4'),{'body':_0x5c6d8b,'options':{'where':{'id':_0x5f4777}},'log':_0x4ed5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 7c0fdd7..d371b32 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 _0x1af2=['Request','CreateWhatsappMessage','../client','create'];(function(_0x11026e,_0x164422){var _0x334d99=function(_0x1c9568){while(--_0x1c9568){_0x11026e['push'](_0x11026e['shift']());}};_0x334d99(++_0x164422);}(_0x1af2,0xaa));var _0x21af=function(_0x285d29,_0x52c639){_0x285d29=_0x285d29-0x0;var _0x202256=_0x1af2[_0x285d29];return _0x202256;};'use strict';var client=require(_0x21af('0x0'));exports[_0x21af('0x1')]=function(_0xa949bf){return client[_0x21af('0x2')](_0x21af('0x3'),{'body':_0xa949bf,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xad6c=['../client','create','Request','CreateWhatsappMessage'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xad6c,0x1bc));var _0xcad6=function(_0x45c362,_0x36cbb8){_0x45c362=_0x45c362-0x0;var _0x5ec36b=_0xad6c[_0x45c362];return _0x5ec36b;};'use strict';var client=require(_0xcad6('0x0'));exports[_0xcad6('0x1')]=function(_0x2c8e6d){return client[_0xcad6('0x2')](_0xcad6('0x3'),{'body':_0x2c8e6d,'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 f261fef..7fa0d99 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 _0x0644=['Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x2e1058,_0x535e8c){var _0x3b9d5b=function(_0x4a0a92){while(--_0x4a0a92){_0x2e1058['push'](_0x2e1058['shift']());}};_0x3b9d5b(++_0x535e8c);}(_0x0644,0xfb));var _0x4064=function(_0x652385,_0x20b88c){_0x652385=_0x652385-0x0;var _0x1e6f24=_0x0644[_0x652385];return _0x1e6f24;};'use strict';var client=require(_0x4064('0x0'));exports[_0x4064('0x1')]=function(){return function(){return client[_0x4064('0x2')](_0x4064('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4064('0x4'),_0x4064('0x5')],'include':[{'model':_0x4064('0x6'),'as':_0x4064('0x7'),'attributes':['id',_0x4064('0x8'),_0x4064('0x9'),_0x4064('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x4d74=['../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','User','Agents','online','whatsappPause'];(function(_0x111165,_0x4f9303){var _0x64f7b6=function(_0x400882){while(--_0x400882){_0x111165['push'](_0x111165['shift']());}};_0x64f7b6(++_0x4f9303);}(_0x4d74,0x156));var _0x44d7=function(_0x56dc8c,_0x1b15ca){_0x56dc8c=_0x56dc8c-0x0;var _0x166838=_0x4d74[_0x56dc8c];return _0x166838;};'use strict';var client=require(_0x44d7('0x0'));exports[_0x44d7('0x1')]=function(){return function(){return client['Request'](_0x44d7('0x2'),{'options':{'raw':![],'attributes':['id',_0x44d7('0x3'),_0x44d7('0x4'),'strategy'],'include':[{'model':_0x44d7('0x5'),'as':_0x44d7('0x6'),'attributes':['id',_0x44d7('0x3'),_0x44d7('0x7'),_0x44d7('0x8')]}]},'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 7845736..7c49fb7 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 _0xfefd=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x4bedce,_0x265ebf){var _0x4fd2fb=function(_0x14122b){while(--_0x14122b){_0x4bedce['push'](_0x4bedce['shift']());}};_0x4fd2fb(++_0x265ebf);}(_0xfefd,0x16f));var _0xdfef=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0xfefd[_0x447ef1];return _0x3d72ec;};'use strict';var client=require(_0xdfef('0x0'));exports[_0xdfef('0x1')]=function(_0x6cfbdc){return client[_0xdfef('0x2')](_0xdfef('0x3'),{'body':_0x6cfbdc,'log':_0xdfef('0x3')});};exports[_0xdfef('0x4')]=function(_0x26ca01,_0x33b547){return client[_0xdfef('0x2')](_0xdfef('0x5'),{'body':_0x33b547,'options':{'where':{'uniqueid':_0x26ca01},'order':[['id',_0xdfef('0x6')]],'limit':0x1},'log':_0xdfef('0x5')});}; \ No newline at end of file +var _0xe34e=['update','UpdateWhatsappQueueReport','Request','CreateWhatsappQueueReport'];(function(_0x2048ed,_0x362430){var _0x113e6f=function(_0x1d7a8a){while(--_0x1d7a8a){_0x2048ed['push'](_0x2048ed['shift']());}};_0x113e6f(++_0x362430);}(_0xe34e,0x1c6));var _0xee34=function(_0x221cc7,_0x55c164){_0x221cc7=_0x221cc7-0x0;var _0x4a3d41=_0xe34e[_0x221cc7];return _0x4a3d41;};'use strict';var client=require('../client');exports['create']=function(_0x4cc68f){return client[_0xee34('0x0')](_0xee34('0x1'),{'body':_0x4cc68f,'log':_0xee34('0x1')});};exports[_0xee34('0x2')]=function(_0xb48a7c,_0x2b28ea){return client[_0xee34('0x0')](_0xee34('0x3'),{'body':_0x2b28ea,'options':{'where':{'uniqueid':_0xb48a7c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 63e3c1e..ecf97ed 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 _0xb96d=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','map','message','join','find','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','error','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string'];(function(_0x4cbf78,_0x206106){var _0x2ae4f8=function(_0x1dc531){while(--_0x1dc531){_0x4cbf78['push'](_0x4cbf78['shift']());}};_0x2ae4f8(++_0x206106);}(_0xb96d,0xbe));var _0xdb96=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xb96d[_0x52f1e6];return _0x21f104;};'use strict';var schema=require(_0xdb96('0x0'));var _=require(_0xdb96('0x1'));var util=require(_0xdb96('0x2'));var seqqueue=require(_0xdb96('0x3'));var logger=require(_0xdb96('0x4'))(_0xdb96('0x5'));var strategy=require(_0xdb96('0x6'));var queue=schema({'name':{'type':_0xdb96('0x7'),'required':!![],'message':_0xdb96('0x8')},'timeout':{'type':_0xdb96('0x9'),'message':_0xdb96('0xa')}});function writeLog(_0x57ab4e,_0x34fa92,_0x4ad0c3){return logger[_0xdb96('0xb')](util[_0xdb96('0xc')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x57ab4e,_0x34fa92['name'],_0x4ad0c3));}function handleFindAgent(_0x5b1c10){return function(_0x41fe31){return _0x41fe31[_0xdb96('0xd')][_0xdb96('0xe')]()===_0x5b1c10[_0xdb96('0xe')]();};}exports[_0xdb96('0xf')]=function(_0x3db835,_0x38f288,_0x19bc3d,_0x2a0d12){return function(_0x4d6b7c){try{var _0x168e69={'name':_0x38f288[0x0],'timeout':_0x38f288[0x1]};var _0xf2a2f0=queue[_0xdb96('0x0')](_0x168e69,{'typecast':!![]});if(_0xf2a2f0['length']){logger['error']('[%s][AGENT]\x20%s',_0x3db835,_[_0xdb96('0x10')](_0xf2a2f0,_0xdb96('0x11'))[_0xdb96('0x12')](',\x20'));_0x4d6b7c['stop']();}else{var _0x3ec420=_[_0xdb96('0x13')](_0x19bc3d['agents'],handleFindAgent(_0x168e69[_0xdb96('0xd')]));if(_0x3ec420){var _0x48211d=(_0x168e69[_0xdb96('0x14')]||0xa)*0x3e8;var _0x559d6e,_0x2e8694;var _0x4df8b0=seqqueue[_0xdb96('0x15')](_0x48211d);_0x4df8b0['id']=_0x3db835;_0x4df8b0[_0xdb96('0x16')]=_0x48211d;_0x4df8b0['channel']=_0x2a0d12[_0xdb96('0x17')];writeLog(_0x3db835,_0x3ec420,util['format']('START:%s',_0x48211d));_0x19bc3d[_0xdb96('0x18')][_0x3db835]['on'](_0xdb96('0x19'),function(){logger[_0xdb96('0xb')](_0xdb96('0x1a'),_0x3db835);clearTimeout(_0x2e8694);_0x2e8694=undefined;_0x4df8b0['close']();if(_0x19bc3d[_0xdb96('0x18')][_0x3db835]){delete _0x19bc3d['rules'][_0x3db835];}_0x4d6b7c['stop']();});_0x19bc3d[_0xdb96('0x18')][_0x3db835]['on'](_0xdb96('0x1b'),function(){if(_0x19bc3d[_0xdb96('0x18')][_0x3db835]){delete _0x19bc3d['rules'][_0x3db835];}});_0x2e8694=setTimeout(function(){logger[_0xdb96('0xb')]('[%s][AGENT]\x20ROUTING\x20END',_0x3db835);clearTimeout(_0x2e8694);_0x4df8b0['close']();_0x4d6b7c[_0xdb96('0x1c')]();},_0x48211d);strategy['agent'](_0x4df8b0,_0x3ec420,_0x19bc3d,_0x2a0d12);}else{logger['error'](_0xdb96('0x1d'),_0x3db835,_0x168e69[_0xdb96('0xd')]);_0x4d6b7c[_0xdb96('0x1e')]();}}}catch(_0x11433a){console['log'](_0x11433a);logger[_0xdb96('0x1f')](_0xdb96('0x20'),_0x3db835,_0x11433a['stack']);_0x4d6b7c['stop']();}};}; \ No newline at end of file +var _0x1e44=['stack','lodash','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','validate','error','map','join','stop','timeout','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x592d24,_0x51c3a0){var _0x1be055=function(_0x284b70){while(--_0x284b70){_0x592d24['push'](_0x592d24['shift']());}};_0x1be055(++_0x51c3a0);}(_0x1e44,0xe9));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require(_0x41e4('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x41e4('0x1'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x41e4('0x2'),'required':!![],'message':_0x41e4('0x3')},'timeout':{'type':_0x41e4('0x4'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x48ba6d,_0x8d1d1d,_0x30adc2){return logger[_0x41e4('0x5')](util[_0x41e4('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x48ba6d,_0x8d1d1d[_0x41e4('0x7')],_0x30adc2));}function handleFindAgent(_0x1f9960){return function(_0xb29e5d){return _0xb29e5d[_0x41e4('0x7')][_0x41e4('0x8')]()===_0x1f9960[_0x41e4('0x8')]();};}exports[_0x41e4('0x9')]=function(_0x3cf345,_0x1f70c1,_0x3bcd10,_0x52cf8c){return function(_0x1fadd6){try{var _0x1bdd87={'name':_0x1f70c1[0x0],'timeout':_0x1f70c1[0x1]};var _0x25bd71=queue[_0x41e4('0xa')](_0x1bdd87,{'typecast':!![]});if(_0x25bd71['length']){logger[_0x41e4('0xb')]('[%s][AGENT]\x20%s',_0x3cf345,_[_0x41e4('0xc')](_0x25bd71,'message')[_0x41e4('0xd')](',\x20'));_0x1fadd6[_0x41e4('0xe')]();}else{var _0x21eed1=_['find'](_0x3bcd10['agents'],handleFindAgent(_0x1bdd87[_0x41e4('0x7')]));if(_0x21eed1){var _0x184c37=(_0x1bdd87[_0x41e4('0xf')]||0xa)*0x3e8;var _0x36f624,_0xda9a47;var _0x182c1c=seqqueue[_0x41e4('0x10')](_0x184c37);_0x182c1c['id']=_0x3cf345;_0x182c1c[_0x41e4('0x11')]=_0x184c37;_0x182c1c[_0x41e4('0x12')]=_0x52cf8c[_0x41e4('0x12')];writeLog(_0x3cf345,_0x21eed1,util[_0x41e4('0x6')]('START:%s',_0x184c37));_0x3bcd10['rules'][_0x3cf345]['on'](_0x41e4('0x13'),function(){logger[_0x41e4('0x5')](_0x41e4('0x14'),_0x3cf345);clearTimeout(_0xda9a47);_0xda9a47=undefined;_0x182c1c[_0x41e4('0x15')]();if(_0x3bcd10[_0x41e4('0x16')][_0x3cf345]){delete _0x3bcd10['rules'][_0x3cf345];}_0x1fadd6[_0x41e4('0xe')]();});_0x3bcd10[_0x41e4('0x16')][_0x3cf345]['on'](_0x41e4('0x17'),function(){if(_0x3bcd10[_0x41e4('0x16')][_0x3cf345]){delete _0x3bcd10[_0x41e4('0x16')][_0x3cf345];}});_0xda9a47=setTimeout(function(){logger[_0x41e4('0x5')](_0x41e4('0x18'),_0x3cf345);clearTimeout(_0xda9a47);_0x182c1c[_0x41e4('0x15')]();_0x1fadd6[_0x41e4('0x19')]();},_0x184c37);strategy[_0x41e4('0x1a')](_0x182c1c,_0x21eed1,_0x3bcd10,_0x52cf8c);}else{logger[_0x41e4('0xb')](_0x41e4('0x1b'),_0x3cf345,_0x1bdd87[_0x41e4('0x7')]);_0x1fadd6[_0x41e4('0xe')]();}}}catch(_0x4ca94a){console['log'](_0x4ca94a);logger[_0x41e4('0xb')]('[%s][QUEUE]\x20%s',_0x3cf345,_0x4ca94a[_0x41e4('0x1c')]);_0x1fadd6['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 1539a9d..4eb0cd1 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 _0xff0c=['providerResponse','stringify','then','dialogState','Failed','lodash','moment','aws-sdk','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','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','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','created','isEmpty','getMustacheRender','Message','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','toString','postText'];(function(_0x262a68,_0x5a171b){var _0x3e0716=function(_0x4feaa5){while(--_0x4feaa5){_0x262a68['push'](_0x262a68['shift']());}};_0x3e0716(++_0x5a171b);}(_0xff0c,0x67));var _0xcff0=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xff0c[_0x29d2d2];return _0x3f6476;};'use strict';var _=require(_0xcff0('0x0'));var moment=require(_0xcff0('0x1'));var AWS=require(_0xcff0('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xcff0('0x3')),'openchannelMessage':require(_0xcff0('0x4')),'mailMessage':require(_0xcff0('0x5')),'smsMessage':require(_0xcff0('0x6')),'faxMessage':require(_0xcff0('0x7')),'whatsappMessage':require(_0xcff0('0x8'))};exports[_0xcff0('0x9')]=function(_0x241cfd,_0x21b7c3){return function(_0x3d6254){try{if(!_[_0xcff0('0xa')](this['interaction'][_0xcff0('0xb')])){logger[_0xcff0('0xc')](_0xcff0('0xd'),_0x241cfd,_0xcff0('0xe'));return _0x3d6254[_0xcff0('0xf')]();}var _0x3d96dd={'ContactId':this[_0xcff0('0x10')]['id'],'sentAt':moment()[_0xcff0('0x11')](_0xcff0('0x12')),'direction':'out'};if(this[_0xcff0('0x13')]===_0xcff0('0x14')||this[_0xcff0('0x13')]===_0xcff0('0x15')){_0x3d96dd[_0xcff0('0x16')]=this[_0xcff0('0x17')][_0xcff0('0x16')];}var _0x4bfe13=this[_0xcff0('0x13')];if(_0x4bfe13===_0xcff0('0x18')){_0x3d96dd[_0xcff0('0x19')]=this[_0xcff0('0x1a')]['id'];}else{_0x3d96dd[_['upperFirst'](_0x4bfe13)+_0xcff0('0x1b')]=this[_0xcff0('0x1a')]['id'];}_0x3d96dd[_[_0xcff0('0x1c')](_0x4bfe13)+'InteractionId']=this[_0xcff0('0x17')]['id'];if(this[_0xcff0('0x17')][_0xcff0('0x1d')]){var _0x566c00=_0x21b7c3[0x4];if(!_[_0xcff0('0x1e')](_0x566c00)){_0x3d96dd['body']=utils[_0xcff0('0x1f')](_0x566c00,this);return rpc[_0x4bfe13+_0xcff0('0x20')]['create'](_0x3d96dd)['then'](function(_0x3cd91c){logger[_0xcff0('0xc')](_0xcff0('0xd'),_0x241cfd,_0x3d96dd['body']);})['catch'](function(_0x295d09){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,JSON['stringify'](_0x295d09));})[_0xcff0('0x22')](function(){logger['info'](_0xcff0('0x23'),_0x241cfd);_0x3d6254[_0xcff0('0x24')]();});}else{logger['info'](_0xcff0('0x25'),_0x241cfd);_0x3d6254[_0xcff0('0x24')]();}}else{var _0x29aa1f=this;var _0x3eaf85=new AWS[(_0xcff0('0x26'))]({'accessKeyId':_0x21b7c3[0x0],'secretAccessKey':_0x21b7c3[0x1],'region':_0x21b7c3[0x2]});var _0x4c49b9={'botAlias':_0xcff0('0x27'),'botName':_0x21b7c3[0x3],'inputText':this[_0xcff0('0x28')][_0xcff0('0x29')],'userId':this[_0xcff0('0x13')]+':'+this[_0xcff0('0x17')]['id'][_0xcff0('0x2a')]()};_0x3eaf85[_0xcff0('0x2b')](_0x4c49b9,function(_0x22ce91,_0x4605d7){if(_0x22ce91){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,_0x22ce91[_0xcff0('0x28')]);_0x3d6254[_0xcff0('0xf')]();}else if(_0x4605d7&&_0x4605d7[_0xcff0('0x28')]){_0x29aa1f[_0xcff0('0x29')]['amazonlex']=_0x4605d7;_0x3d96dd['body']=_0x4605d7[_0xcff0('0x28')];_0x3d96dd['providerName']='amazonlex';_0x3d96dd[_0xcff0('0x2c')]=JSON[_0xcff0('0x2d')](_0x4605d7);return rpc[_0x4bfe13+_0xcff0('0x20')]['create'](_0x3d96dd)[_0xcff0('0x2e')](function(_0x8edb67){logger[_0xcff0('0xc')]('[%s][AMAZONLEX]\x20%s',_0x241cfd,_0x3d96dd[_0xcff0('0x29')]);if(_0x4605d7[_0xcff0('0x2f')]==_0xcff0('0x30')){_0x3d6254[_0xcff0('0xf')]();}else{_0x3d6254[_0xcff0('0x24')]();}})['catch'](function(_0x40f8fa){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,JSON['stringify'](_0x40f8fa));_0x3d6254[_0xcff0('0xf')]();});}else{_0x3d6254[_0xcff0('0xf')]();}});}}catch(_0x37b3c0){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,JSON[_0xcff0('0x2d')](_0x37b3c0));_0x3d6254[_0xcff0('0x24')]();}};}; \ No newline at end of file +var _0xad49=['Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','Message','create','then','info','body','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','next','amazonlex','providerName'];(function(_0x54d1a1,_0x46ea8a){var _0x38ced7=function(_0x3b2b3c){while(--_0x3b2b3c){_0x54d1a1['push'](_0x54d1a1['shift']());}};_0x38ced7(++_0x46ea8a);}(_0xad49,0xf6));var _0x9ad4=function(_0x2f4ff8,_0x16e214){_0x2f4ff8=_0x2f4ff8-0x0;var _0x4e876c=_0xad49[_0x2f4ff8];return _0x4e876c;};'use strict';var _=require(_0x9ad4('0x0'));var moment=require(_0x9ad4('0x1'));var AWS=require(_0x9ad4('0x2'));var utils=require('./utils');var logger=require(_0x9ad4('0x3'))(_0x9ad4('0x4'));var rpc={'chatMessage':require(_0x9ad4('0x5')),'openchannelMessage':require(_0x9ad4('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9ad4('0x7')),'faxMessage':require(_0x9ad4('0x8')),'whatsappMessage':require(_0x9ad4('0x9'))};exports['consequence']=function(_0x4c90be,_0x4b2b31){return function(_0x43a5e2){try{if(!_[_0x9ad4('0xa')](this['interaction'][_0x9ad4('0xb')])){logger['info'](_0x9ad4('0xc'),_0x4c90be,_0x9ad4('0xd'));return _0x43a5e2['next']();}var _0x4f17f3={'ContactId':this[_0x9ad4('0xe')]['id'],'sentAt':moment()[_0x9ad4('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9ad4('0x10')};if(this['channel']===_0x9ad4('0x11')||this[_0x9ad4('0x12')]===_0x9ad4('0x13')){_0x4f17f3[_0x9ad4('0x14')]=this[_0x9ad4('0x15')][_0x9ad4('0x14')];}var _0x185a54=this[_0x9ad4('0x12')];if(_0x185a54===_0x9ad4('0x16')){_0x4f17f3[_0x9ad4('0x17')]=this[_0x9ad4('0x18')]['id'];}else{_0x4f17f3[_[_0x9ad4('0x19')](_0x185a54)+_0x9ad4('0x1a')]=this['account']['id'];}_0x4f17f3[_[_0x9ad4('0x19')](_0x185a54)+'InteractionId']=this[_0x9ad4('0x15')]['id'];if(this[_0x9ad4('0x15')][_0x9ad4('0x1b')]){var _0x2306f0=_0x4b2b31[0x4];if(!_[_0x9ad4('0x1c')](_0x2306f0)){_0x4f17f3['body']=utils[_0x9ad4('0x1d')](_0x2306f0,this);return rpc[_0x185a54+_0x9ad4('0x1e')][_0x9ad4('0x1f')](_0x4f17f3)[_0x9ad4('0x20')](function(_0x1e50a0){logger[_0x9ad4('0x21')](_0x9ad4('0xc'),_0x4c90be,_0x4f17f3[_0x9ad4('0x22')]);})[_0x9ad4('0x23')](function(_0x4d0751){logger[_0x9ad4('0x24')](_0x9ad4('0xc'),_0x4c90be,JSON[_0x9ad4('0x25')](_0x4d0751));})['finally'](function(){logger[_0x9ad4('0x21')](_0x9ad4('0x26'),_0x4c90be);_0x43a5e2[_0x9ad4('0x27')]();});}else{logger['info'](_0x9ad4('0x28'),_0x4c90be);_0x43a5e2[_0x9ad4('0x27')]();}}else{var _0x32a3d4=this;var _0x1d6e4c=new AWS[(_0x9ad4('0x29'))]({'accessKeyId':_0x4b2b31[0x0],'secretAccessKey':_0x4b2b31[0x1],'region':_0x4b2b31[0x2]});var _0x3c84da={'botAlias':_0x9ad4('0x2a'),'botName':_0x4b2b31[0x3],'inputText':this[_0x9ad4('0x2b')][_0x9ad4('0x22')],'userId':this['channel']+':'+this['interaction']['id'][_0x9ad4('0x2c')]()};_0x1d6e4c['postText'](_0x3c84da,function(_0x39f8a0,_0x27d07d){if(_0x39f8a0){logger[_0x9ad4('0x24')]('[%s][AMAZONLEX]\x20%s',_0x4c90be,_0x39f8a0[_0x9ad4('0x2b')]);_0x43a5e2[_0x9ad4('0x2d')]();}else if(_0x27d07d&&_0x27d07d[_0x9ad4('0x2b')]){_0x32a3d4['body'][_0x9ad4('0x2e')]=_0x27d07d;_0x4f17f3[_0x9ad4('0x22')]=_0x27d07d[_0x9ad4('0x2b')];_0x4f17f3[_0x9ad4('0x2f')]='amazonlex';_0x4f17f3['providerResponse']=JSON[_0x9ad4('0x25')](_0x27d07d);return rpc[_0x185a54+_0x9ad4('0x1e')][_0x9ad4('0x1f')](_0x4f17f3)[_0x9ad4('0x20')](function(_0x2ce2bd){logger[_0x9ad4('0x21')](_0x9ad4('0xc'),_0x4c90be,_0x4f17f3[_0x9ad4('0x22')]);if(_0x27d07d['dialogState']==_0x9ad4('0x30')){_0x43a5e2[_0x9ad4('0x2d')]();}else{_0x43a5e2[_0x9ad4('0x27')]();}})['catch'](function(_0x3b170a){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4c90be,JSON[_0x9ad4('0x25')](_0x3b170a));_0x43a5e2[_0x9ad4('0x2d')]();});}else{_0x43a5e2['next']();}});}}catch(_0x4c41d5){logger['error'](_0x9ad4('0xc'),_0x4c90be,JSON['stringify'](_0x4c41d5));_0x43a5e2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index a5d8f9d..b431f85 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 _0xe53f=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','error','autoreplyExecuted','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:','Re:\x20','chat'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xe53f,0x131));var _0xfe53=function(_0x103d58,_0x435b2a){_0x103d58=_0x103d58-0x0;var _0x499c0e=_0xe53f[_0x103d58];return _0x499c0e;};'use strict';var _=require(_0xfe53('0x0'));var moment=require(_0xfe53('0x1'));var utils=require(_0xfe53('0x2'));var logger=require(_0xfe53('0x3'))(_0xfe53('0x4'));var rpc={'chatMessage':require(_0xfe53('0x5')),'openchannelMessage':require(_0xfe53('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfe53('0x7')),'whatsappMessage':require(_0xfe53('0x8')),'chatInteraction':require(_0xfe53('0x9')),'openchannelInteraction':require(_0xfe53('0xa')),'mailInteraction':require(_0xfe53('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xfe53('0xc')),'whatsappInteraction':require(_0xfe53('0xd'))};var mailRpc=require(_0xfe53('0xe'));exports['consequence']=function(_0x457869,_0x5d09b3,_0x127021,_0x27876e){return function(_0x578511){try{var _0x35c843=this['channel'];if(_0x35c843==='mail'&&_0x27876e[_0xfe53('0xf')]['isAutoreply']){logger[_0xfe53('0x10')]('[%s][AUTOREPLY]\x20%s',_0x457869,_0xfe53('0x11'));return _0x578511[_0xfe53('0x12')]();}if(_0x5d09b3[0x0]==='1'&&(_[_0xfe53('0x13')](this['interaction'][_0xfe53('0x14')])||!this[_0xfe53('0x15')][_0xfe53('0x14')])){logger['info'](_0xfe53('0x16'),_0x457869,'Autoreply\x20already\x20sent');return _0x578511[_0xfe53('0x12')]();}if(_0x5d09b3[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0xfe53('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x457869,_0xfe53('0x17'));return _0x578511[_0xfe53('0x12')]();}var _0x4a0e89={'ContactId':this[_0xfe53('0x18')]['id'],'sentAt':moment()[_0xfe53('0x19')](_0xfe53('0x1a')),'direction':_0xfe53('0x1b')};if(this[_0xfe53('0x1c')]==='mail'){_0x4a0e89[_0xfe53('0xf')]=utils[_0xfe53('0x1d')](_0x5d09b3[0x2],this);}else{_0x4a0e89[_0xfe53('0xf')]=utils[_0xfe53('0x1d')](_0x5d09b3[0x1],this);}if(this[_0xfe53('0x1e')]){_0x4a0e89['to']=this[_0xfe53('0x1e')][_0xfe53('0x1f')]||'';if(this[_0xfe53('0x1c')]===_0xfe53('0x20')&&_0x5d09b3[0x1]==='1'){_0x4a0e89['cc']=this['message']['cc']||'';}_0x4a0e89[_0xfe53('0x1f')]=this[_0xfe53('0x1e')]['to']||'';_0x4a0e89[_0xfe53('0x21')]=this[_0xfe53('0x1e')]['phone']||'';_0x4a0e89[_0xfe53('0x22')]=!![];if(this[_0xfe53('0x1e')]['subject']){_0x4a0e89['subject']='';_0x4a0e89[_0xfe53('0x23')]+=_[_0xfe53('0x24')](this['message'][_0xfe53('0x23')],_0xfe53('0x25'))?'':_0xfe53('0x26');_0x4a0e89[_0xfe53('0x23')]+=this[_0xfe53('0x1e')][_0xfe53('0x23')];}}if(this[_0xfe53('0x1c')]===_0xfe53('0x27')){_0x4a0e89[_0xfe53('0x28')]=this[_0xfe53('0x29')]['id'];}else{_0x4a0e89[_[_0xfe53('0x2a')](this[_0xfe53('0x1c')])+_0xfe53('0x2b')]=this['account']['id'];}_0x4a0e89[_['upperFirst'](this['channel'])+_0xfe53('0x2c')]=this[_0xfe53('0x15')]['id'];var _0x39f08a=this[_0xfe53('0x15')];if(rpc[this['channel']+_0xfe53('0x2d')]){if(this[_0xfe53('0x1c')]===_0xfe53('0x20')){_0x4a0e89[_0xfe53('0x2e')]=this[_0xfe53('0x1e')][_0xfe53('0x2f')];_0x4a0e89['html']=''+_['replace'](_0x4a0e89['body'],_0xfe53('0x30'),_0xfe53('0x31'))+_0xfe53('0x32');_0x4a0e89['headers']={'Auto-Submitted':_0xfe53('0x33'),'X-Auto-Response-Suppress':'All','Precedence':_0xfe53('0x34')};return mailRpc[_0xfe53('0x35')](this[_0xfe53('0x29')][_0xfe53('0x36')],_0x4a0e89)[_0xfe53('0x37')](function(_0x4cc280){logger[_0xfe53('0x10')](_0xfe53('0x38'),_0x457869);_0x4a0e89['messageId']=_0x4cc280[_0xfe53('0x1e')][_0xfe53('0x2f')];return rpc[_0x35c843+_0xfe53('0x2d')][_0xfe53('0x39')](_0x4a0e89);})['then'](function(_0x44e5d8){logger['info'](_0xfe53('0x16'),_0x457869,JSON[_0xfe53('0x3a')](_0x44e5d8));})['catch'](function(_0x5a1319){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x457869,JSON[_0xfe53('0x3a')](_0x5a1319));})[_0xfe53('0x3b')](function(){Promise[_0xfe53('0x3c')]()[_0xfe53('0x37')](function(){if(_0x5d09b3[0x0]!=='2'||_0x39f08a['autoreplyExecuted'])return;return rpc[_0x35c843+_0xfe53('0x3d')][_0xfe53('0x3e')](_0x39f08a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x53119f){logger[_0xfe53('0x10')](_0xfe53('0x3f'),_0x457869,JSON['stringify'](_0x53119f));})[_0xfe53('0x40')](function(_0x3fe404){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x457869,JSON[_0xfe53('0x3a')](_0x3fe404));});})[_0xfe53('0x37')](function(){_0x578511[_0xfe53('0x12')]();});});}else{return rpc[this['channel']+_0xfe53('0x2d')][_0xfe53('0x39')](_0x4a0e89)['then'](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x457869,_0x4a0e89[_0xfe53('0xf')]);})['catch'](function(_0x173469){logger[_0xfe53('0x41')]('[%s][AUTOREPLY]\x20%s',_0x457869,JSON[_0xfe53('0x3a')](_0x173469));})[_0xfe53('0x3b')](function(){Promise[_0xfe53('0x3c')]()[_0xfe53('0x37')](function(){if(_0x5d09b3[0x0]!=='2'||_0x39f08a[_0xfe53('0x42')])return;return rpc[_0x35c843+_0xfe53('0x3d')][_0xfe53('0x3e')](_0x39f08a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x19d75b){logger[_0xfe53('0x10')](_0xfe53('0x3f'),_0x457869,JSON[_0xfe53('0x3a')](_0x19d75b));})[_0xfe53('0x40')](function(_0x4b4b12){logger['error'](_0xfe53('0x43'),_0x457869,JSON['stringify'](_0x4b4b12));});})['then'](function(){_0x578511['next']();});});}}}catch(_0x3925d5){logger[_0xfe53('0x41')](_0xfe53('0x16'),_0x457869,JSON[_0xfe53('0x3a')](_0x3925d5));_0x578511[_0xfe53('0x44')]();}};}; \ No newline at end of file +var _0xcf56=['then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','mail','getMustacheRender','message','from','channel','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','inReplyTo','messageId','','replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xcf56,0x176));var _0x6cf5=function(_0x5868b8,_0x3cf12e){_0x5868b8=_0x5868b8-0x0;var _0x50f448=_0xcf56[_0x5868b8];return _0x50f448;};'use strict';var _=require(_0x6cf5('0x0'));var moment=require(_0x6cf5('0x1'));var utils=require(_0x6cf5('0x2'));var logger=require(_0x6cf5('0x3'))(_0x6cf5('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6cf5('0x5')),'mailMessage':require(_0x6cf5('0x6')),'smsMessage':require(_0x6cf5('0x7')),'faxMessage':require(_0x6cf5('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6cf5('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x6cf5('0xa')),'faxInteraction':require(_0x6cf5('0xb')),'whatsappInteraction':require(_0x6cf5('0xc'))};var mailRpc=require(_0x6cf5('0xd'));exports[_0x6cf5('0xe')]=function(_0x4f134f,_0x2429cb,_0x15b99d,_0x5108b8){return function(_0x45515d){try{var _0x4b7765=this['channel'];if(_0x4b7765==='mail'&&_0x5108b8[_0x6cf5('0xf')]['isAutoreply']){logger[_0x6cf5('0x10')](_0x6cf5('0x11'),_0x4f134f,_0x6cf5('0x12'));return _0x45515d[_0x6cf5('0x13')]();}if(_0x2429cb[0x0]==='1'&&(_['isNil'](this[_0x6cf5('0x14')]['created'])||!this['interaction'][_0x6cf5('0x15')])){logger[_0x6cf5('0x10')](_0x6cf5('0x11'),_0x4f134f,_0x6cf5('0x16'));return _0x45515d[_0x6cf5('0x13')]();}if(_0x2429cb[0x0]==='2'&&this[_0x6cf5('0x14')][_0x6cf5('0x17')]){logger['info'](_0x6cf5('0x18'),_0x4f134f,_0x6cf5('0x19'));return _0x45515d[_0x6cf5('0x13')]();}var _0x421168={'ContactId':this[_0x6cf5('0x1a')]['id'],'sentAt':moment()[_0x6cf5('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6cf5('0x1c')};if(this['channel']===_0x6cf5('0x1d')){_0x421168['body']=utils[_0x6cf5('0x1e')](_0x2429cb[0x2],this);}else{_0x421168[_0x6cf5('0xf')]=utils[_0x6cf5('0x1e')](_0x2429cb[0x1],this);}if(this[_0x6cf5('0x1f')]){_0x421168['to']=this[_0x6cf5('0x1f')][_0x6cf5('0x20')]||'';if(this[_0x6cf5('0x21')]===_0x6cf5('0x1d')&&_0x2429cb[0x1]==='1'){_0x421168['cc']=this[_0x6cf5('0x1f')]['cc']||'';}_0x421168[_0x6cf5('0x20')]=this[_0x6cf5('0x1f')]['to']||'';_0x421168['phone']=this['message'][_0x6cf5('0x22')]||'';_0x421168[_0x6cf5('0x23')]=!![];if(this['message'][_0x6cf5('0x24')]){_0x421168[_0x6cf5('0x24')]='';_0x421168[_0x6cf5('0x24')]+=_[_0x6cf5('0x25')](this[_0x6cf5('0x1f')][_0x6cf5('0x24')],_0x6cf5('0x26'))?'':_0x6cf5('0x27');_0x421168['subject']+=this[_0x6cf5('0x1f')][_0x6cf5('0x24')];}}if(this[_0x6cf5('0x21')]===_0x6cf5('0x28')){_0x421168[_0x6cf5('0x29')]=this['account']['id'];}else{_0x421168[_['upperFirst'](this[_0x6cf5('0x21')])+_0x6cf5('0x2a')]=this[_0x6cf5('0x2b')]['id'];}_0x421168[_[_0x6cf5('0x2c')](this[_0x6cf5('0x21')])+_0x6cf5('0x2d')]=this[_0x6cf5('0x14')]['id'];var _0x96f716=this[_0x6cf5('0x14')];if(rpc[this['channel']+'Message']){if(this[_0x6cf5('0x21')]===_0x6cf5('0x1d')){_0x421168[_0x6cf5('0x2e')]=this[_0x6cf5('0x1f')][_0x6cf5('0x2f')];_0x421168['html']=_0x6cf5('0x30')+_[_0x6cf5('0x31')](_0x421168[_0x6cf5('0xf')],_0x6cf5('0x32'),_0x6cf5('0x33'))+_0x6cf5('0x34');_0x421168[_0x6cf5('0x35')]={'Auto-Submitted':_0x6cf5('0x36'),'X-Auto-Response-Suppress':'All','Precedence':_0x6cf5('0x37')};return mailRpc[_0x6cf5('0x38')](this[_0x6cf5('0x2b')][_0x6cf5('0x39')],_0x421168)[_0x6cf5('0x3a')](function(_0x2c8fc7){logger[_0x6cf5('0x10')](_0x6cf5('0x3b'),_0x4f134f);_0x421168[_0x6cf5('0x2f')]=_0x2c8fc7[_0x6cf5('0x1f')][_0x6cf5('0x2f')];return rpc[_0x4b7765+'Message'][_0x6cf5('0x3c')](_0x421168);})[_0x6cf5('0x3a')](function(_0x4f6b78){logger[_0x6cf5('0x10')](_0x6cf5('0x11'),_0x4f134f,JSON[_0x6cf5('0x3d')](_0x4f6b78));})[_0x6cf5('0x3e')](function(_0xba2697){logger[_0x6cf5('0x3f')](_0x6cf5('0x40'),_0x4f134f,JSON[_0x6cf5('0x3d')](_0xba2697));})[_0x6cf5('0x41')](function(){Promise[_0x6cf5('0x42')]()[_0x6cf5('0x3a')](function(){if(_0x2429cb[0x0]!=='2'||_0x96f716[_0x6cf5('0x17')])return;return rpc[_0x4b7765+_0x6cf5('0x43')][_0x6cf5('0x44')](_0x96f716['id'],{'autoreplyExecuted':!![]})['then'](function(_0x15d9d9){logger[_0x6cf5('0x10')](_0x6cf5('0x18'),_0x4f134f,JSON[_0x6cf5('0x3d')](_0x15d9d9));})[_0x6cf5('0x3e')](function(_0x458ff6){logger[_0x6cf5('0x3f')](_0x6cf5('0x45'),_0x4f134f,JSON[_0x6cf5('0x3d')](_0x458ff6));});})['then'](function(){_0x45515d[_0x6cf5('0x13')]();});});}else{return rpc[this[_0x6cf5('0x21')]+_0x6cf5('0x46')]['create'](_0x421168)[_0x6cf5('0x3a')](function(){logger[_0x6cf5('0x10')](_0x6cf5('0x11'),_0x4f134f,_0x421168['body']);})['catch'](function(_0x480fa1){logger[_0x6cf5('0x3f')](_0x6cf5('0x11'),_0x4f134f,JSON[_0x6cf5('0x3d')](_0x480fa1));})['finally'](function(){Promise['resolve']()[_0x6cf5('0x3a')](function(){if(_0x2429cb[0x0]!=='2'||_0x96f716[_0x6cf5('0x17')])return;return rpc[_0x4b7765+_0x6cf5('0x43')][_0x6cf5('0x44')](_0x96f716['id'],{'autoreplyExecuted':!![]})[_0x6cf5('0x3a')](function(_0x557f3e){logger[_0x6cf5('0x10')](_0x6cf5('0x18'),_0x4f134f,JSON[_0x6cf5('0x3d')](_0x557f3e));})[_0x6cf5('0x3e')](function(_0x3dd896){logger[_0x6cf5('0x3f')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4f134f,JSON[_0x6cf5('0x3d')](_0x3dd896));});})['then'](function(){_0x45515d[_0x6cf5('0x13')]();});});}}}catch(_0x33044f){logger['error'](_0x6cf5('0x11'),_0x4f134f,JSON[_0x6cf5('0x3d')](_0x33044f));_0x45515d[_0x6cf5('0x47')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 4353b90..d5931fe 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6058=['../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x197c30,_0xbaa2ee){var _0x4ebaaf=function(_0x3d2d80){while(--_0x3d2d80){_0x197c30['push'](_0x197c30['shift']());}};_0x4ebaaf(++_0xbaa2ee);}(_0x6058,0x176));var _0x8605=function(_0x45e647,_0x2c482c){_0x45e647=_0x45e647-0x0;var _0x2deace=_0x6058[_0x45e647];return _0x2deace;};'use strict';var moment=require('moment');var logger=require(_0x8605('0x0'))(_0x8605('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8605('0x2')),'smsInteraction':require(_0x8605('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8605('0x4')),'whatsappInteraction':require(_0x8605('0x5'))};exports[_0x8605('0x6')]=function(_0x157020,_0x359290,_0xaad6be,_0xe0216a){return function(_0x1b508f){try{logger[_0x8605('0x7')](_0x8605('0x8'),_0x157020,_0x359290[0x0]);var _0x368309={'closed':0x1,'closedAt':moment()[_0x8605('0x9')](_0x8605('0xa')),'closeReason':_0x8605('0xb'),'disposition':_0x359290[0x0]};if(rpc[_0xe0216a[_0x8605('0xc')]+_0x8605('0xd')]){rpc[_0xe0216a['channel']+_0x8605('0xd')][_0x8605('0xe')](_0xe0216a[_0x8605('0xf')]['id'],_0x368309)['then'](function(_0x391dc1){logger['info'](_0x8605('0x10'),_0x157020,_0xe0216a[_0x8605('0xf')]['id']);})['catch'](function(_0x591acd){logger[_0x8605('0x11')](_0x8605('0x12'),_0x157020,JSON[_0x8605('0x13')](_0x591acd));})[_0x8605('0x14')](function(){_0x1b508f[_0x8605('0x15')]();});}}catch(_0x4215b4){logger[_0x8605('0x11')](_0x8605('0x12'),_0x157020,JSON[_0x8605('0x13')](_0x4215b4));_0x1b508f[_0x8605('0x15')]();}};}; \ No newline at end of file +var _0x1253=['catch','stringify','stop','error','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0x1253,0x18c));var _0x3125=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1253[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x3125('0x0'));var logger=require(_0x3125('0x1'))(_0x3125('0x2'));var rpc={'chatInteraction':require(_0x3125('0x3')),'openchannelInteraction':require(_0x3125('0x4')),'smsInteraction':require(_0x3125('0x5')),'mailInteraction':require(_0x3125('0x6')),'faxInteraction':require(_0x3125('0x7')),'whatsappInteraction':require(_0x3125('0x8'))};exports['consequence']=function(_0x23ee61,_0x5b81be,_0x5f5d7a,_0x3b2d71){return function(_0x237a87){try{logger[_0x3125('0x9')](_0x3125('0xa'),_0x23ee61,_0x5b81be[0x0]);var _0x165b6c={'closed':0x1,'closedAt':moment()[_0x3125('0xb')](_0x3125('0xc')),'closeReason':'system','disposition':_0x5b81be[0x0]};if(rpc[_0x3b2d71['channel']+_0x3125('0xd')]){rpc[_0x3b2d71['channel']+'Interaction'][_0x3125('0xe')](_0x3b2d71[_0x3125('0xf')]['id'],_0x165b6c)[_0x3125('0x10')](function(_0x3ed3ee){logger[_0x3125('0x9')](_0x3125('0x11'),_0x23ee61,_0x3b2d71[_0x3125('0xf')]['id']);})[_0x3125('0x12')](function(_0x33ad5d){logger['error']('[%s][CLOSE]\x20%s',_0x23ee61,JSON[_0x3125('0x13')](_0x33ad5d));})['finally'](function(){_0x237a87[_0x3125('0x14')]();});}}catch(_0x492140){logger[_0x3125('0x15')](_0x3125('0x16'),_0x23ee61,JSON[_0x3125('0x13')](_0x492140));_0x237a87['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index f724e22..bbff8a1 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c45=['UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','created','body','getMustacheRender','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','fulfillment','speech','dialogflow','providerResponse','endConversation','next','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction'];(function(_0x267a84,_0x4979cb){var _0x2587e4=function(_0x33608f){while(--_0x33608f){_0x267a84['push'](_0x267a84['shift']());}};_0x2587e4(++_0x4979cb);}(_0x6c45,0xb1));var _0x56c4=function(_0x508b96,_0x555714){_0x508b96=_0x508b96-0x0;var _0x5066d2=_0x6c45[_0x508b96];return _0x5066d2;};'use strict';var _=require(_0x56c4('0x0'));var moment=require(_0x56c4('0x1'));var apiai=require('apiai-promise');var md5=require(_0x56c4('0x2'));var utils=require(_0x56c4('0x3'));var logger=require(_0x56c4('0x4'))(_0x56c4('0x5'));var rpc={'chatMessage':require(_0x56c4('0x6')),'openchannelMessage':require(_0x56c4('0x7')),'mailMessage':require(_0x56c4('0x8')),'smsMessage':require(_0x56c4('0x9')),'faxMessage':require(_0x56c4('0xa')),'whatsappMessage':require(_0x56c4('0xb'))};exports[_0x56c4('0xc')]=function(_0x330e6,_0x1d0b9b){return function(_0x373748){try{if(!_[_0x56c4('0xd')](this[_0x56c4('0xe')][_0x56c4('0xf')])){logger[_0x56c4('0x10')](_0x56c4('0x11'),_0x330e6,_0x56c4('0x12'));return _0x373748['next']();}var _0x2533d7={'ContactId':this[_0x56c4('0x13')]['id'],'sentAt':moment()[_0x56c4('0x14')](_0x56c4('0x15')),'direction':'out'};if(this[_0x56c4('0x16')]===_0x56c4('0x17')||this[_0x56c4('0x16')]===_0x56c4('0x18')){_0x2533d7['phone']=this[_0x56c4('0xe')]['phone'];}var _0x512d7e=this[_0x56c4('0x16')];if(_0x512d7e===_0x56c4('0x19')){_0x2533d7[_0x56c4('0x1a')]=this[_0x56c4('0x1b')]['id'];}else{_0x2533d7[_[_0x56c4('0x1c')](_0x512d7e)+'AccountId']=this[_0x56c4('0x1b')]['id'];}_0x2533d7[_[_0x56c4('0x1c')](_0x512d7e)+'InteractionId']=this[_0x56c4('0xe')]['id'];if(this[_0x56c4('0xe')][_0x56c4('0x1d')]){var _0x2f0bb2=_0x1d0b9b[0x2];if(!_['isEmpty'](_0x2f0bb2)){_0x2533d7[_0x56c4('0x1e')]=utils[_0x56c4('0x1f')](_0x2f0bb2,this);return rpc[_0x512d7e+'Message'][_0x56c4('0x20')](_0x2533d7)[_0x56c4('0x21')](function(_0x110f71){logger[_0x56c4('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x2533d7[_0x56c4('0x1e')]);})[_0x56c4('0x22')](function(_0x279a1e){logger[_0x56c4('0x23')](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x279a1e));})['finally'](function(){logger['info'](_0x56c4('0x25'),_0x330e6);_0x373748[_0x56c4('0x26')]();});}else{logger['info'](_0x56c4('0x27'),_0x330e6);_0x373748[_0x56c4('0x26')]();}}else{var _0x10eae6=this;var _0x23b11e=apiai(_0x1d0b9b[0x0],{'language':_0x1d0b9b[0x1]||'en'});return _0x23b11e[_0x56c4('0x28')](this[_0x56c4('0x29')][_0x56c4('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0x56c4('0x21')](function(_0x3e1007){_0x10eae6[_0x56c4('0x1e')]['dialogflow']=_0x3e1007;_0x2533d7[_0x56c4('0x1e')]=_0x3e1007['result'][_0x56c4('0x2a')][_0x56c4('0x2b')];_0x2533d7['providerName']=_0x56c4('0x2c');_0x2533d7[_0x56c4('0x2d')]=JSON['stringify'](_0x3e1007);return rpc[_0x512d7e+'Message']['create'](_0x2533d7)[_0x56c4('0x21')](function(_0x2ac814){logger[_0x56c4('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x2533d7[_0x56c4('0x1e')]);if(_0x3e1007['result']['metadata'][_0x56c4('0x2e')]){_0x373748[_0x56c4('0x2f')]();}else{_0x373748[_0x56c4('0x26')]();}})[_0x56c4('0x22')](function(_0x3f9cc0){logger[_0x56c4('0x23')](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x3f9cc0));_0x373748['next']();});})[_0x56c4('0x22')](function(_0x388dee){logger[_0x56c4('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x388dee[_0x56c4('0x29')]);_0x373748[_0x56c4('0x2f')]();});}}catch(_0x3894ba){logger['error'](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x3894ba));_0x373748['stop']();}};}; \ No newline at end of file +var _0x29b7=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','Message','then','body','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerName','create','metadata','endConversation','catch','moment','apiai-promise','md5'];(function(_0x2e8604,_0x3a1d1a){var _0x266d1d=function(_0x4ca2e8){while(--_0x4ca2e8){_0x2e8604['push'](_0x2e8604['shift']());}};_0x266d1d(++_0x3a1d1a);}(_0x29b7,0x17d));var _0x729b=function(_0x1ca729,_0x256063){_0x1ca729=_0x1ca729-0x0;var _0x36a62e=_0x29b7[_0x1ca729];return _0x36a62e;};'use strict';var _=require('lodash');var moment=require(_0x729b('0x0'));var apiai=require(_0x729b('0x1'));var md5=require(_0x729b('0x2'));var utils=require(_0x729b('0x3'));var logger=require(_0x729b('0x4'))(_0x729b('0x5'));var rpc={'chatMessage':require(_0x729b('0x6')),'openchannelMessage':require(_0x729b('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x729b('0x8')),'faxMessage':require(_0x729b('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x729b('0xa')]=function(_0x161396,_0xf72e6d){return function(_0x2c4252){try{if(!_['isNil'](this[_0x729b('0xb')][_0x729b('0xc')])){logger[_0x729b('0xd')](_0x729b('0xe'),_0x161396,_0x729b('0xf'));return _0x2c4252[_0x729b('0x10')]();}var _0x491541={'ContactId':this[_0x729b('0x11')]['id'],'sentAt':moment()['format'](_0x729b('0x12')),'direction':_0x729b('0x13')};if(this[_0x729b('0x14')]==='sms'||this[_0x729b('0x14')]===_0x729b('0x15')){_0x491541[_0x729b('0x16')]=this[_0x729b('0xb')][_0x729b('0x16')];}var _0x55c87d=this[_0x729b('0x14')];if(_0x55c87d===_0x729b('0x17')){_0x491541['ChatWebsiteId']=this[_0x729b('0x18')]['id'];}else{_0x491541[_[_0x729b('0x19')](_0x55c87d)+_0x729b('0x1a')]=this[_0x729b('0x18')]['id'];}_0x491541[_[_0x729b('0x19')](_0x55c87d)+'InteractionId']=this['interaction']['id'];if(this[_0x729b('0xb')][_0x729b('0x1b')]){var _0x26e0cb=_0xf72e6d[0x2];if(!_[_0x729b('0x1c')](_0x26e0cb)){_0x491541['body']=utils[_0x729b('0x1d')](_0x26e0cb,this);return rpc[_0x55c87d+_0x729b('0x1e')]['create'](_0x491541)[_0x729b('0x1f')](function(_0x36a23e){logger[_0x729b('0xd')](_0x729b('0xe'),_0x161396,_0x491541[_0x729b('0x20')]);})['catch'](function(_0x3d69f1){logger[_0x729b('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x161396,JSON[_0x729b('0x22')](_0x3d69f1));})[_0x729b('0x23')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x161396);_0x2c4252[_0x729b('0x24')]();});}else{logger[_0x729b('0xd')](_0x729b('0x25'),_0x161396);_0x2c4252[_0x729b('0x24')]();}}else{var _0x31d58f=this;var _0x257290=apiai(_0xf72e6d[0x0],{'language':_0xf72e6d[0x1]||'en'});return _0x257290[_0x729b('0x26')](this[_0x729b('0x27')]['body'],{'sessionId':md5(this[_0x729b('0xb')]['id'])})[_0x729b('0x1f')](function(_0x261c6f){_0x31d58f[_0x729b('0x20')][_0x729b('0x28')]=_0x261c6f;_0x491541['body']=_0x261c6f[_0x729b('0x29')][_0x729b('0x2a')]['speech'];_0x491541[_0x729b('0x2b')]='dialogflow';_0x491541['providerResponse']=JSON[_0x729b('0x22')](_0x261c6f);return rpc[_0x55c87d+_0x729b('0x1e')][_0x729b('0x2c')](_0x491541)[_0x729b('0x1f')](function(_0xcf03ba){logger['info'](_0x729b('0xe'),_0x161396,_0x491541[_0x729b('0x20')]);if(_0x261c6f[_0x729b('0x29')][_0x729b('0x2d')][_0x729b('0x2e')]){_0x2c4252[_0x729b('0x10')]();}else{_0x2c4252[_0x729b('0x24')]();}})[_0x729b('0x2f')](function(_0x537572){logger[_0x729b('0x21')](_0x729b('0xe'),_0x161396,JSON[_0x729b('0x22')](_0x537572));_0x2c4252['next']();});})[_0x729b('0x2f')](function(_0x277962){logger[_0x729b('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x161396,_0x277962[_0x729b('0x27')]);_0x2c4252[_0x729b('0x10')]();});}}catch(_0x4c8d98){logger[_0x729b('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x161396,JSON[_0x729b('0x22')](_0x4c8d98));_0x2c4252[_0x729b('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index be1bc98..ca4d85e 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf771=['isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','stop','message','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','replace','SessionsClient','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT'];(function(_0xd8303e,_0x4ae9af){var _0x2054e5=function(_0x4ab76a){while(--_0x4ab76a){_0xd8303e['push'](_0xd8303e['shift']());}};_0x2054e5(++_0x4ae9af);}(_0xf771,0x1ed));var _0x1f77=function(_0x5d8b46,_0x47b560){_0x5d8b46=_0x5d8b46-0x0;var _0x43808b=_0xf771[_0x5d8b46];return _0x43808b;};'use strict';var _=require(_0x1f77('0x0'));var dialogflow=require(_0x1f77('0x1'));var md5=require(_0x1f77('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x1f77('0x3'))(_0x1f77('0x4'));var utils=require(_0x1f77('0x5'));var rpc={'chatMessage':require(_0x1f77('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1f77('0x7')),'smsMessage':require(_0x1f77('0x8')),'faxMessage':require(_0x1f77('0x9')),'whatsappMessage':require(_0x1f77('0xa'))};function createMessage(_0x15751b,_0x999e6a,_0x56c153,_0x19b64b){return new Promise(function(_0x51c1ec,_0x2bc784){var _0x360616=_[_0x1f77('0xb')](_0x56c153);_0x360616[_0x1f77('0xc')]=_0x19b64b;return rpc[_0x999e6a+'Message'][_0x1f77('0xd')](_0x360616)[_0x1f77('0xe')](function(){logger[_0x1f77('0xf')](_0x1f77('0x10'),_0x15751b,_0x360616[_0x1f77('0xc')]);_0x51c1ec();})['catch'](function(_0x249120){logger[_0x1f77('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x15751b,JSON[_0x1f77('0x12')](_0x249120));_0x2bc784(_0x249120);});});}exports['consequence']=function(_0x389b34,_0x812171){return function(_0xc820dc){try{if(!_[_0x1f77('0x13')](this[_0x1f77('0x14')]['UserId'])){logger[_0x1f77('0xf')](_0x1f77('0x10'),_0x389b34,_0x1f77('0x15'));return _0xc820dc[_0x1f77('0x16')]();}var _0x3c3d83={'ContactId':this[_0x1f77('0x17')]['id'],'sentAt':moment()[_0x1f77('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1f77('0x19')};if(this[_0x1f77('0x1a')]===_0x1f77('0x1b')||this[_0x1f77('0x1a')]===_0x1f77('0x1c')){_0x3c3d83['phone']=this[_0x1f77('0x14')][_0x1f77('0x1d')];}var _0x5795ac=this[_0x1f77('0x1a')];if(_0x5795ac===_0x1f77('0x1e')){_0x3c3d83['ChatWebsiteId']=this[_0x1f77('0x1f')]['id'];}else{_0x3c3d83[_[_0x1f77('0x20')](_0x5795ac)+_0x1f77('0x21')]=this[_0x1f77('0x1f')]['id'];}_0x3c3d83[_['upperFirst'](_0x5795ac)+_0x1f77('0x22')]=this[_0x1f77('0x14')]['id'];if(this[_0x1f77('0x14')][_0x1f77('0x23')]){var _0xd45485=_0x812171[0x4];if(!_[_0x1f77('0x24')](_0xd45485)){_0x3c3d83[_0x1f77('0xc')]=utils[_0x1f77('0x25')](_0xd45485,this);return rpc[_0x5795ac+_0x1f77('0x26')][_0x1f77('0xd')](_0x3c3d83)[_0x1f77('0xe')](function(_0x1fb9ee){logger[_0x1f77('0xf')](_0x1f77('0x10'),_0x389b34,_0x3c3d83[_0x1f77('0xc')]);})[_0x1f77('0x27')](function(_0x2a8648){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x389b34,JSON[_0x1f77('0x12')](_0x2a8648));})[_0x1f77('0x28')](function(){logger[_0x1f77('0xf')](_0x1f77('0x29'),_0x389b34);_0xc820dc['stop']();});}else{logger[_0x1f77('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x389b34);_0xc820dc['stop']();}}else{var _0x4b9646=this;var _0x2d7d9b=_0x812171[0x2][_0x1f77('0x2a')](/\\n/g,'\x0a');var _0x1acfe1={'credentials':{'private_key':_0x2d7d9b,'client_email':_0x812171[0x1]}};var _0x4b7b6d=new dialogflow[(_0x1f77('0x2b'))](_0x1acfe1);var _0x55d55a=_0x4b7b6d['sessionPath'](_0x812171[0x0],md5(_0x4b9646[_0x1f77('0x14')]['id']));var _0x5d9c6a={'session':_0x55d55a,'queryInput':{'text':{'text':_0x4b9646['message']['body'],'languageCode':_0x812171[0x3]||'en'}}};return _0x4b7b6d['detectIntent'](_0x5d9c6a)[_0x1f77('0xe')](function(_0x230638){if(_0x230638&&_0x230638[_0x1f77('0x2c')]){_0x4b9646['body'][_0x1f77('0x2d')]=_0x230638;var _0x3bf1d3=_0x230638[0x0];var _0x3eb62b=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')]&&_0x3bf1d3['queryResult'][_0x1f77('0x2f')][_0x1f77('0x30')]?_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')][_0x1f77('0x30')]['end_conversation'][_0x1f77('0x31')]:![];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_ACTION']=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x32')];_0x4b9646['body'][_0x1f77('0x33')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x34')];_0x4b9646['body'][_0x1f77('0x35')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')]&&_0x3bf1d3[_0x1f77('0x2e')]['diagnosticInfo'][_0x1f77('0x30')]?_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')][_0x1f77('0x30')][_0x1f77('0x36')][_0x1f77('0x31')]:![];_0x4b9646[_0x1f77('0xc')][_0x1f77('0x37')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x38')]['name'];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x38')][_0x1f77('0x39')];_0x4b9646[_0x1f77('0xc')][_0x1f77('0x3a')]=_0x3bf1d3[_0x1f77('0x2e')]['intent'][_0x1f77('0x3b')];_0x4b9646[_0x1f77('0xc')][_0x1f77('0x3c')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x3d')];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_QUERYTEXT']=_0x3bf1d3[_0x1f77('0x2e')]['queryText'];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_SCORE']=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x3e')];_0x3c3d83['providerName']='dialogflowV2';_0x3c3d83[_0x1f77('0x3f')]=JSON[_0x1f77('0x12')](_0x230638);var _0x4bf975=[];for(var _0x29513a=0x0;_0x29513a<_0x230638[_0x1f77('0x2c')];_0x29513a++){var _0x56132e=_0x230638[_0x29513a];if(_0x56132e&&_0x56132e[_0x1f77('0x2e')]&&_0x56132e[_0x1f77('0x2e')][_0x1f77('0x40')]){_0x4bf975[_0x1f77('0x41')](createMessage(_0x389b34,_0x5795ac,_0x3c3d83,_0x56132e[_0x1f77('0x2e')][_0x1f77('0x40')]));}}return Promise[_0x1f77('0x42')](_0x4bf975)[_0x1f77('0xe')](function(){if(_0x3eb62b){_0xc820dc[_0x1f77('0x16')]();}else{_0xc820dc[_0x1f77('0x43')]();}})[_0x1f77('0x27')](function(_0x2ccfb0){logger[_0x1f77('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x389b34,JSON['stringify'](_0x2ccfb0));_0xc820dc[_0x1f77('0x16')]();});}})[_0x1f77('0x27')](function(_0x144013){logger[_0x1f77('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x389b34,_0x144013[_0x1f77('0x44')],_0x144013['stack']);_0xc820dc[_0x1f77('0x16')]();});}}catch(_0x59ab42){logger['error'](_0x1f77('0x10'),_0x389b34,JSON[_0x1f77('0x12')](_0x59ab42));_0xc820dc['stop']();}};}; \ No newline at end of file +var _0x2d4e=['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','isEmpty','stringify','finally','stop','SessionsClient','sessionPath','message','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION'];(function(_0x104c21,_0x532fce){var _0x500985=function(_0x446dd5){while(--_0x446dd5){_0x104c21['push'](_0x104c21['shift']());}};_0x500985(++_0x532fce);}(_0x2d4e,0x1b7));var _0xe2d4=function(_0x2c7e61,_0x595fec){_0x2c7e61=_0x2c7e61-0x0;var _0x859bbe=_0x2d4e[_0x2c7e61];return _0x859bbe;};'use strict';var _=require(_0xe2d4('0x0'));var dialogflow=require(_0xe2d4('0x1'));var md5=require(_0xe2d4('0x2'));var moment=require(_0xe2d4('0x3'));var Promise=require(_0xe2d4('0x4'));var logger=require(_0xe2d4('0x5'))(_0xe2d4('0x6'));var utils=require(_0xe2d4('0x7'));var rpc={'chatMessage':require(_0xe2d4('0x8')),'openchannelMessage':require(_0xe2d4('0x9')),'mailMessage':require(_0xe2d4('0xa')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe2d4('0xb')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2cad04,_0x540cc8,_0x438af0,_0x289ecb){return new Promise(function(_0x1ce124,_0x2f1c2e){var _0x545933=_[_0xe2d4('0xc')](_0x438af0);_0x545933[_0xe2d4('0xd')]=_0x289ecb;return rpc[_0x540cc8+_0xe2d4('0xe')][_0xe2d4('0xf')](_0x545933)[_0xe2d4('0x10')](function(){logger[_0xe2d4('0x11')](_0xe2d4('0x12'),_0x2cad04,_0x545933[_0xe2d4('0xd')]);_0x1ce124();})[_0xe2d4('0x13')](function(_0x5ab2b9){logger[_0xe2d4('0x14')](_0xe2d4('0x12'),_0x2cad04,JSON['stringify'](_0x5ab2b9));_0x2f1c2e(_0x5ab2b9);});});}exports[_0xe2d4('0x15')]=function(_0x2a0cb1,_0x3ba583){return function(_0x534482){try{if(!_[_0xe2d4('0x16')](this[_0xe2d4('0x17')]['UserId'])){logger[_0xe2d4('0x11')](_0xe2d4('0x12'),_0x2a0cb1,_0xe2d4('0x18'));return _0x534482[_0xe2d4('0x19')]();}var _0xc46ed6={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe2d4('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe2d4('0x1b')};if(this[_0xe2d4('0x1c')]===_0xe2d4('0x1d')||this[_0xe2d4('0x1c')]===_0xe2d4('0x1e')){_0xc46ed6[_0xe2d4('0x1f')]=this['interaction']['phone'];}var _0x10a392=this[_0xe2d4('0x1c')];if(_0x10a392===_0xe2d4('0x20')){_0xc46ed6[_0xe2d4('0x21')]=this['account']['id'];}else{_0xc46ed6[_[_0xe2d4('0x22')](_0x10a392)+'AccountId']=this[_0xe2d4('0x23')]['id'];}_0xc46ed6[_[_0xe2d4('0x22')](_0x10a392)+_0xe2d4('0x24')]=this[_0xe2d4('0x17')]['id'];if(this[_0xe2d4('0x17')]['created']){var _0x2fd626=_0x3ba583[0x4];if(!_[_0xe2d4('0x25')](_0x2fd626)){_0xc46ed6['body']=utils['getMustacheRender'](_0x2fd626,this);return rpc[_0x10a392+'Message'][_0xe2d4('0xf')](_0xc46ed6)[_0xe2d4('0x10')](function(_0x202914){logger[_0xe2d4('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x2a0cb1,_0xc46ed6[_0xe2d4('0xd')]);})[_0xe2d4('0x13')](function(_0xe496ed){logger[_0xe2d4('0x14')](_0xe2d4('0x12'),_0x2a0cb1,JSON[_0xe2d4('0x26')](_0xe496ed));})[_0xe2d4('0x27')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2a0cb1);_0x534482[_0xe2d4('0x28')]();});}else{logger[_0xe2d4('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2a0cb1);_0x534482[_0xe2d4('0x28')]();}}else{var _0x5eb52d=this;var _0x5864e3=_0x3ba583[0x2]['replace'](/\\n/g,'\x0a');var _0x297ae2={'credentials':{'private_key':_0x5864e3,'client_email':_0x3ba583[0x1]}};var _0x4824be=new dialogflow[(_0xe2d4('0x29'))](_0x297ae2);var _0x53cc38=_0x4824be[_0xe2d4('0x2a')](_0x3ba583[0x0],md5(_0x5eb52d[_0xe2d4('0x17')]['id']));var _0x542515={'session':_0x53cc38,'queryInput':{'text':{'text':_0x5eb52d[_0xe2d4('0x2b')][_0xe2d4('0xd')],'languageCode':_0x3ba583[0x3]||'en'}}};return _0x4824be['detectIntent'](_0x542515)[_0xe2d4('0x10')](function(_0x5313d3){if(_0x5313d3&&_0x5313d3[_0xe2d4('0x2c')]){_0x5eb52d[_0xe2d4('0xd')]['dialogflowV2']=_0x5313d3;var _0x3c710a=_0x5313d3[0x0];var _0x361313=_0x3c710a[_0xe2d4('0x2d')]['diagnosticInfo']&&_0x3c710a['queryResult'][_0xe2d4('0x2e')][_0xe2d4('0x2f')]?_0x3c710a[_0xe2d4('0x2d')][_0xe2d4('0x2e')][_0xe2d4('0x2f')][_0xe2d4('0x30')][_0xe2d4('0x31')]:![];_0x5eb52d[_0xe2d4('0xd')][_0xe2d4('0x32')]=_0x3c710a[_0xe2d4('0x2d')]['action'];_0x5eb52d[_0xe2d4('0xd')][_0xe2d4('0x33')]=_0x3c710a[_0xe2d4('0x2d')][_0xe2d4('0x34')];_0x5eb52d['body'][_0xe2d4('0x35')]=_0x3c710a[_0xe2d4('0x2d')]['diagnosticInfo']&&_0x3c710a['queryResult']['diagnosticInfo'][_0xe2d4('0x2f')]?_0x3c710a[_0xe2d4('0x2d')][_0xe2d4('0x2e')][_0xe2d4('0x2f')][_0xe2d4('0x30')][_0xe2d4('0x31')]:![];_0x5eb52d[_0xe2d4('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x3c710a[_0xe2d4('0x2d')][_0xe2d4('0x36')][_0xe2d4('0x37')];_0x5eb52d[_0xe2d4('0xd')][_0xe2d4('0x38')]=_0x3c710a[_0xe2d4('0x2d')]['intent']['displayName'];_0x5eb52d[_0xe2d4('0xd')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3c710a[_0xe2d4('0x2d')][_0xe2d4('0x36')][_0xe2d4('0x39')];_0x5eb52d[_0xe2d4('0xd')][_0xe2d4('0x3a')]=_0x3c710a[_0xe2d4('0x2d')][_0xe2d4('0x3b')];_0x5eb52d[_0xe2d4('0xd')][_0xe2d4('0x3c')]=_0x3c710a[_0xe2d4('0x2d')][_0xe2d4('0x3d')];_0x5eb52d['body'][_0xe2d4('0x3e')]=_0x3c710a['queryResult'][_0xe2d4('0x3f')];_0xc46ed6[_0xe2d4('0x40')]='dialogflowV2';_0xc46ed6[_0xe2d4('0x41')]=JSON[_0xe2d4('0x26')](_0x5313d3);var _0x4173a6=[];for(var _0x4d8f1d=0x0;_0x4d8f1d<_0x5313d3['length'];_0x4d8f1d++){var _0x51efcd=_0x5313d3[_0x4d8f1d];if(_0x51efcd&&_0x51efcd[_0xe2d4('0x2d')]&&_0x51efcd[_0xe2d4('0x2d')][_0xe2d4('0x42')]){_0x4173a6[_0xe2d4('0x43')](createMessage(_0x2a0cb1,_0x10a392,_0xc46ed6,_0x51efcd['queryResult'][_0xe2d4('0x42')]));}}return Promise[_0xe2d4('0x44')](_0x4173a6)['then'](function(){if(_0x361313){_0x534482[_0xe2d4('0x19')]();}else{_0x534482['stop']();}})[_0xe2d4('0x13')](function(_0x20b4cd){logger[_0xe2d4('0x14')](_0xe2d4('0x12'),_0x2a0cb1,JSON[_0xe2d4('0x26')](_0x20b4cd));_0x534482['next']();});}})[_0xe2d4('0x13')](function(_0xdb2574){logger[_0xe2d4('0x14')](_0xe2d4('0x12'),_0x2a0cb1,_0xdb2574[_0xe2d4('0x2b')],_0xdb2574[_0xe2d4('0x45')]);_0x534482['next']();});}}catch(_0x32819a){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x2a0cb1,JSON[_0xe2d4('0x26')](_0x32819a));_0x534482[_0xe2d4('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 4686db4..3ea41db 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x763e=['consequence','fromString','getMustacheRender','replace','length','error','map','message','join','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','string','number'];(function(_0x5071f8,_0x24ac1d){var _0x59feff=function(_0x53c6e0){while(--_0x53c6e0){_0x5071f8['push'](_0x5071f8['shift']());}};_0x59feff(++_0x24ac1d);}(_0x763e,0x67));var _0xe763=function(_0x1c1f57,_0x4f8f7b){_0x1c1f57=_0x1c1f57-0x0;var _0x2cd7a4=_0x763e[_0x1c1f57];return _0x2cd7a4;};'use strict';var schema=require(_0xe763('0x0'));var _=require('lodash');var htmlToText=require(_0xe763('0x1'));var utils=require(_0xe763('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xe763('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xe763('0x4'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xe763('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xe763('0x5')]=function(_0x9d5554,_0x1f2f62){return function(_0x2a69b6){try{var _0x534d07={'condition':htmlToText[_0xe763('0x6')](utils[_0xe763('0x7')](_0x1f2f62[0x0],this),{'wordwrap':![]})[_0xe763('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1f2f62[0x1],'priorityFalse':_0x1f2f62[0x2]};var _0x75df9=gotoif[_0xe763('0x0')](_0x534d07,{'typecast':!![]});if(_0x75df9[_0xe763('0x9')]){logger[_0xe763('0xa')]('[%s][GOTOIF]\x20%s',_0x9d5554,_[_0xe763('0xb')](_0x75df9,_0xe763('0xc'))[_0xe763('0xd')](',\x20'));_0x2a69b6['stop']();}else{try{var _0x5a53eb=eval('('+_0x534d07[_0xe763('0xe')]+')');var _0x46ace5=_0x5a53eb?_0x534d07['priorityTrue']:_0x534d07[_0xe763('0xf')];logger['info'](_0xe763('0x10'),_0x9d5554,_0x534d07[_0xe763('0xe')],_0x5a53eb,_0x46ace5||'next');if(_0x46ace5){var _0x1090e5=_[_0xe763('0x11')](_0x2a69b6[_0xe763('0x12')](),{'p':_0x46ace5});if(_0x1090e5>=0x0){logger[_0xe763('0x13')](_0xe763('0x14'),_0x9d5554,_0x46ace5||_0xe763('0x15'),_0x1090e5);_0x2a69b6[_0xe763('0x15')](_0x1090e5);}else{logger[_0xe763('0x13')](_0xe763('0x16'),_0x9d5554,_0x46ace5||'next');_0x2a69b6[_0xe763('0x17')]();}}else{_0x2a69b6[_0xe763('0x15')]();}}catch(_0x2de120){logger[_0xe763('0xa')](_0xe763('0x18'),_0x9d5554,_0x2de120[_0xe763('0xc')]);_0x2a69b6[_0xe763('0x17')]();}}}catch(_0x48d1d8){logger['error'](_0xe763('0x19'),_0x9d5554,JSON[_0xe763('0x1a')](_0x48d1d8));_0x2a69b6[_0xe763('0x17')]();}};}; \ No newline at end of file +var _0x5e02=['[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','./utils','../../../../config/logger','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error'];(function(_0x188ac3,_0x2d6e71){var _0x4c82ca=function(_0x20d7a7){while(--_0x20d7a7){_0x188ac3['push'](_0x188ac3['shift']());}};_0x4c82ca(++_0x2d6e71);}(_0x5e02,0x11f));var _0x25e0=function(_0x286386,_0x1293a2){_0x286386=_0x286386-0x0;var _0x1d7821=_0x5e02[_0x286386];return _0x1d7821;};'use strict';var schema=require('validate');var _=require(_0x25e0('0x0'));var htmlToText=require('html-to-text');var utils=require(_0x25e0('0x1'));var logger=require(_0x25e0('0x2'))(_0x25e0('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x25e0('0x4'),'message':_0x25e0('0x5')},'priorityFalse':{'type':'number','message':_0x25e0('0x6')}});exports[_0x25e0('0x7')]=function(_0x19a66e,_0x446eb6){return function(_0x4d5e90){try{var _0x675403={'condition':htmlToText[_0x25e0('0x8')](utils[_0x25e0('0x9')](_0x446eb6[0x0],this),{'wordwrap':![]})[_0x25e0('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x446eb6[0x1],'priorityFalse':_0x446eb6[0x2]};var _0x5504b6=gotoif[_0x25e0('0xb')](_0x675403,{'typecast':!![]});if(_0x5504b6['length']){logger[_0x25e0('0xc')](_0x25e0('0xd'),_0x19a66e,_[_0x25e0('0xe')](_0x5504b6,'message')[_0x25e0('0xf')](',\x20'));_0x4d5e90[_0x25e0('0x10')]();}else{try{var _0x1c8bef=eval('('+_0x675403[_0x25e0('0x11')]+')');var _0x11448e=_0x1c8bef?_0x675403[_0x25e0('0x12')]:_0x675403[_0x25e0('0x13')];logger['info'](_0x25e0('0x14'),_0x19a66e,_0x675403[_0x25e0('0x11')],_0x1c8bef,_0x11448e||'next');if(_0x11448e){var _0x36cf86=_[_0x25e0('0x15')](_0x4d5e90[_0x25e0('0x16')](),{'p':_0x11448e});if(_0x36cf86>=0x0){logger[_0x25e0('0x17')](_0x25e0('0x18'),_0x19a66e,_0x11448e||_0x25e0('0x19'),_0x36cf86);_0x4d5e90['next'](_0x36cf86);}else{logger['info'](_0x25e0('0x1a'),_0x19a66e,_0x11448e||_0x25e0('0x19'));_0x4d5e90[_0x25e0('0x10')]();}}else{_0x4d5e90[_0x25e0('0x19')]();}}catch(_0xb98090){logger['error'](_0x25e0('0x1b'),_0x19a66e,_0xb98090[_0x25e0('0x1c')]);_0x4d5e90[_0x25e0('0x10')]();}}}catch(_0x183b14){logger[_0x25e0('0xc')](_0x25e0('0xd'),_0x19a66e,JSON[_0x25e0('0x1d')](_0x183b14));_0x4d5e90[_0x25e0('0x10')]();}};}; \ 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 b87fb1e..742fd75 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 _0x5b74=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x4648ad,_0x21e389){var _0x504c94=function(_0x5078fa){while(--_0x5078fa){_0x4648ad['push'](_0x4648ad['shift']());}};_0x504c94(++_0x21e389);}(_0x5b74,0x1a4));var _0x45b7=function(_0x39d330,_0x462470){_0x39d330=_0x39d330-0x0;var _0x23b39e=_0x5b74[_0x39d330];return _0x23b39e;};'use strict';var schema=require(_0x45b7('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x45b7('0x1'));var gotop=schema({'priority':{'type':_0x45b7('0x2'),'required':!![],'message':_0x45b7('0x3')}});exports['consequence']=function(_0xf6f4ec,_0x515022){return function(_0x5ebc8f){try{var _0xcad2db={'priority':_0x515022[0x0]};var _0x4ad3c5=gotop[_0x45b7('0x0')](_0xcad2db,{'typecast':!![]});if(_0x4ad3c5['length']){logger[_0x45b7('0x4')](_0x45b7('0x5'),_0xf6f4ec,_[_0x45b7('0x6')](_0x4ad3c5,_0x45b7('0x7'))[_0x45b7('0x8')](',\x20'));_0x5ebc8f['stop']();}else{logger[_0x45b7('0x9')](_0x45b7('0xa'),_0xf6f4ec,_0xcad2db[_0x45b7('0xb')]);if(_0xcad2db[_0x45b7('0xb')]){var _0x242483=_['findIndex'](_0x5ebc8f[_0x45b7('0xc')](),{'p':_0xcad2db[_0x45b7('0xb')]});if(_0x242483>=0x0){logger['info'](_0x45b7('0xd'),_0xf6f4ec,_0xcad2db[_0x45b7('0xb')]||_0x45b7('0xe'),_0x242483);_0x5ebc8f[_0x45b7('0xe')](_0x242483);}else{logger[_0x45b7('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xf6f4ec,_0xcad2db['priority']||'next');_0x5ebc8f[_0x45b7('0xf')]();}}else{_0x5ebc8f[_0x45b7('0xe')]();}}}catch(_0xef2528){logger['error'](_0x45b7('0x5'),_0xf6f4ec,JSON['stringify'](_0xef2528));_0x5ebc8f[_0x45b7('0xf')]();}};}; \ No newline at end of file +var _0x0a6b=['priority','next','error','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','message','join','stop','info'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x0a6b,0x65));var _0xb0a6=function(_0x5ca1db,_0x338203){_0x5ca1db=_0x5ca1db-0x0;var _0x4f08d7=_0x0a6b[_0x5ca1db];return _0x4f08d7;};'use strict';var schema=require(_0xb0a6('0x0'));var _=require('lodash');var logger=require(_0xb0a6('0x1'))(_0xb0a6('0x2'));var gotop=schema({'priority':{'type':_0xb0a6('0x3'),'required':!![],'message':_0xb0a6('0x4')}});exports['consequence']=function(_0x455112,_0x165c87){return function(_0x5caf76){try{var _0x1e1fa0={'priority':_0x165c87[0x0]};var _0x45c838=gotop[_0xb0a6('0x0')](_0x1e1fa0,{'typecast':!![]});if(_0x45c838[_0xb0a6('0x5')]){logger['error'](_0xb0a6('0x6'),_0x455112,_['map'](_0x45c838,_0xb0a6('0x7'))[_0xb0a6('0x8')](',\x20'));_0x5caf76[_0xb0a6('0x9')]();}else{logger[_0xb0a6('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x455112,_0x1e1fa0[_0xb0a6('0xb')]);if(_0x1e1fa0[_0xb0a6('0xb')]){var _0x427a9d=_['findIndex'](_0x5caf76['rules'](),{'p':_0x1e1fa0[_0xb0a6('0xb')]});if(_0x427a9d>=0x0){logger[_0xb0a6('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x455112,_0x1e1fa0[_0xb0a6('0xb')]||'next',_0x427a9d);_0x5caf76[_0xb0a6('0xc')](_0x427a9d);}else{logger[_0xb0a6('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x455112,_0x1e1fa0[_0xb0a6('0xb')]||_0xb0a6('0xc'));_0x5caf76[_0xb0a6('0x9')]();}}else{_0x5caf76[_0xb0a6('0xc')]();}}}catch(_0xc742b2){logger[_0xb0a6('0xd')](_0xb0a6('0x6'),_0x455112,JSON['stringify'](_0xc742b2));_0x5caf76[_0xb0a6('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index b2d13b5..69b4229 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 _0xfac9=['Message','create','then','[%s][MESSAGE]\x20%s','body','next','error','stop','lodash','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','ChatWebsiteId','account','upperFirst','channel','InteractionId','interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfac9,0x1d0));var _0x9fac=function(_0x872e27,_0x5c0eaa){_0x872e27=_0x872e27-0x0;var _0x4a7db7=_0xfac9[_0x872e27];return _0x4a7db7;};'use strict';var _=require(_0x9fac('0x0'));var utils=require('./utils');var logger=require(_0x9fac('0x1'))(_0x9fac('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9fac('0x3')),'mailMessage':require(_0x9fac('0x4')),'smsMessage':require(_0x9fac('0x5')),'faxMessage':require(_0x9fac('0x6')),'whatsappMessage':require(_0x9fac('0x7'))};exports[_0x9fac('0x8')]=function(_0x2229b4,_0x437b69){return function(_0x170fa6){try{var _0x30c675={'body':utils[_0x9fac('0x9')](_0x437b69[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x30c675[_0x9fac('0xa')]=this[_0x9fac('0xb')]['id'];}else{_0x30c675[_[_0x9fac('0xc')](this[_0x9fac('0xd')])+'AccountId']=this[_0x9fac('0xb')]['id'];}_0x30c675[_[_0x9fac('0xc')](this[_0x9fac('0xd')])+_0x9fac('0xe')]=this[_0x9fac('0xf')]['id'];if(rpc[this['channel']+_0x9fac('0x10')]){return rpc[this[_0x9fac('0xd')]+_0x9fac('0x10')][_0x9fac('0x11')](_0x30c675)[_0x9fac('0x12')](function(_0x514912){logger['info'](_0x9fac('0x13'),_0x2229b4,_0x30c675[_0x9fac('0x14')]);_0x170fa6[_0x9fac('0x15')]();})['catch'](function(_0x56eb73){logger[_0x9fac('0x16')]('[%s][MESSAGE]\x20%s',_0x2229b4,JSON['stringify'](_0x56eb73));_0x170fa6[_0x9fac('0x17')]();});}}catch(_0x44d24e){logger[_0x9fac('0x16')](_0x9fac('0x13'),_0x2229b4,JSON['stringify'](_0x44d24e));_0x170fa6[_0x9fac('0x17')]();}};}; \ No newline at end of file +var _0x6215=['error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch'];(function(_0x20d952,_0x935281){var _0x1563b4=function(_0x22ca8c){while(--_0x22ca8c){_0x20d952['push'](_0x20d952['shift']());}};_0x1563b4(++_0x935281);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var utils=require(_0x5621('0x1'));var logger=require(_0x5621('0x2'))('routing');var rpc={'chatMessage':require(_0x5621('0x3')),'openchannelMessage':require(_0x5621('0x4')),'mailMessage':require(_0x5621('0x5')),'smsMessage':require(_0x5621('0x6')),'faxMessage':require(_0x5621('0x7')),'whatsappMessage':require(_0x5621('0x8'))};exports['consequence']=function(_0x571050,_0x52f3c6){return function(_0x5ae3af){try{var _0x431e77={'body':utils[_0x5621('0x9')](_0x52f3c6[0x0],this),'ContactId':this[_0x5621('0xa')]['id']};if(this[_0x5621('0xb')]===_0x5621('0xc')){_0x431e77['ChatWebsiteId']=this[_0x5621('0xd')]['id'];}else{_0x431e77[_[_0x5621('0xe')](this[_0x5621('0xb')])+_0x5621('0xf')]=this['account']['id'];}_0x431e77[_[_0x5621('0xe')](this[_0x5621('0xb')])+_0x5621('0x10')]=this['interaction']['id'];if(rpc[this[_0x5621('0xb')]+_0x5621('0x11')]){return rpc[this[_0x5621('0xb')]+_0x5621('0x11')][_0x5621('0x12')](_0x431e77)[_0x5621('0x13')](function(_0xac5caf){logger[_0x5621('0x14')](_0x5621('0x15'),_0x571050,_0x431e77[_0x5621('0x16')]);_0x5ae3af['next']();})[_0x5621('0x17')](function(_0x1067c0){logger[_0x5621('0x18')]('[%s][MESSAGE]\x20%s',_0x571050,JSON[_0x5621('0x19')](_0x1067c0));_0x5ae3af[_0x5621('0x1a')]();});}}catch(_0x555e21){logger[_0x5621('0x18')](_0x5621('0x15'),_0x571050,JSON[_0x5621('0x19')](_0x555e21));_0x5ae3af[_0x5621('0x1a')]();}};}; \ 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 ec09f01..78859b9 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 _0x8205=['next','error','stop','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x8205,0x12f));var _0x5820=function(_0x32e2c6,_0x285891){_0x32e2c6=_0x32e2c6-0x0;var _0x5c203f=_0x8205[_0x32e2c6];return _0x5c203f;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5820('0x0'));exports[_0x5820('0x1')]=function(_0x596947,_0x1b9b46){return function(_0x1bfdb7){try{logger['info'](_0x5820('0x2'),_0x596947,utils['getMustacheRender'](_0x1b9b46[0x0],this));_0x1bfdb7[_0x5820('0x3')]();}catch(_0x248f63){logger[_0x5820('0x4')]('[%s][NOOP]\x20%s',_0x596947,JSON['stringify'](_0x248f63));_0x1bfdb7[_0x5820('0x5')]();}};}; \ No newline at end of file +var _0x819a=['../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','./utils'];(function(_0x100827,_0x49215d){var _0x1e6245=function(_0x5e55dc){while(--_0x5e55dc){_0x100827['push'](_0x100827['shift']());}};_0x1e6245(++_0x49215d);}(_0x819a,0x1d7));var _0xa819=function(_0x5b95f2,_0x2adb49){_0x5b95f2=_0x5b95f2-0x0;var _0x376b33=_0x819a[_0x5b95f2];return _0x376b33;};'use strict';var utils=require(_0xa819('0x0'));var logger=require(_0xa819('0x1'))(_0xa819('0x2'));exports[_0xa819('0x3')]=function(_0x9ba990,_0x5e0453){return function(_0x19ed34){try{logger['info'](_0xa819('0x4'),_0x9ba990,utils[_0xa819('0x5')](_0x5e0453[0x0],this));_0x19ed34[_0xa819('0x6')]();}catch(_0x56398e){logger['error'](_0xa819('0x4'),_0x9ba990,JSON[_0xa819('0x7')](_0x56398e));_0x19ed34['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 2cfe306..929f121 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 _0x4200=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','from','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','timeout','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','queue','joinAt','clone','account','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4200,0x188));var _0x0420=function(_0x2d1b36,_0x5ce609){_0x2d1b36=_0x2d1b36-0x0;var _0x3f6b14=_0x4200[_0x2d1b36];return _0x3f6b14;};'use strict';var schema=require(_0x0420('0x0'));var _=require(_0x0420('0x1'));var util=require(_0x0420('0x2'));var seqqueue=require(_0x0420('0x3'));var moment=require(_0x0420('0x4'));var Redis=require(_0x0420('0x5'));var config=require(_0x0420('0x6'));var logger=require(_0x0420('0x7'))(_0x0420('0x8'));var strategy=require('./strategy');config[_0x0420('0x9')]=_[_0x0420('0xa')](config[_0x0420('0x9')],{'host':_0x0420('0xb'),'port':0x18eb});var io=require(_0x0420('0xc'))(new Redis(config['redis']));var attributes=['id',_0x0420('0xd'),'account',_0x0420('0xe'),'from',_0x0420('0xf')];function emit(_0x192b70,_0x50eb31,_0xd82ab3){io['to'](_0x192b70)['emit'](_0x50eb31,_0xd82ab3);}function emitChannelQueueInteraction(_0x4b3904,_0x27bf8b,_0x474842,_0x45cec6,_0x5a88d4,_0x4b43dc,_0x12609e,_0x12c730){var _0x18cd48=_[_0x0420('0x10')](_0x474842);_0x18cd48[_0x0420('0xd')]=_0x12c730;_0x18cd48[_0x0420('0xe')]=_0x27bf8b;_0x18cd48[_0x0420('0x11')]=_0x45cec6;_0x18cd48['id']=_0x5a88d4;if(_0x4b43dc){attributes[_0x0420('0x12')](_[_0x0420('0x13')](_0x4b3904)+'InteractionId');_0x12609e[util[_0x0420('0x14')](_0x0420('0x15'),_0x4b3904)][_0x5a88d4]=_[_0x0420('0x16')](_0x18cd48,attributes);}else{delete _0x12609e[util[_0x0420('0x14')]('%sQueuesWaitingInteractions',_0x4b3904)][_0x5a88d4];}emit(util[_0x0420('0x14')](_0x0420('0x17'),_0x4b3904,_0x27bf8b),util[_0x0420('0x14')](_0x0420('0x18'),_0x4b3904,_0x4b43dc?_0x0420('0x19'):_0x0420('0x1a')),_['pick'](_0x18cd48,attributes));}var rpc={'openchannelQueueReport':require(_0x0420('0x1b')),'mailQueueReport':require(_0x0420('0x1c')),'chatQueueReport':require(_0x0420('0x1d')),'smsQueueReport':require(_0x0420('0x1e')),'faxQueueReport':require(_0x0420('0x1f')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x0420('0x20')),'faxInteraction':require(_0x0420('0x21')),'mailInteraction':require(_0x0420('0x22')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0420('0x23')),'whatsappInteraction':require(_0x0420('0x24'))};var queue=schema({'name':{'type':_0x0420('0x25'),'required':!![],'message':_0x0420('0x26')},'timeout':{'type':_0x0420('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2e05b6,_0x4c75dd,_0x49a230,_0x4c4c51){if(_0x2e05b6&&_0x4c75dd&&_0x49a230){_0x4c75dd[_0x0420('0x28')]+=0x1;var _0x19c9f4={'uniqueid':_0x2e05b6,'from':_0x49a230[_0x0420('0x29')]?_0x49a230[_0x0420('0x29')][_0x0420('0x2a')]:'','joinAt':moment()[_0x0420('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x49a230['contact']?_0x49a230[_0x0420('0x2b')]['id']:null,'ListId':_0x49a230[_0x0420('0x2c')]?_0x49a230['list']['id']:null};_0x19c9f4[_['upperFirst'](_0x49a230['channel'])+'QueueId']=_0x4c75dd['id']||null;_0x19c9f4[_[_0x0420('0x2d')](_0x49a230[_0x0420('0x2e')])+_0x0420('0x2f')]=_0x49a230[_0x0420('0x30')]?_0x49a230[_0x0420('0x30')]['id']:null;_0x19c9f4[_['upperFirst'](_0x49a230['channel'])+_0x0420('0x31')]=_0x49a230[_0x0420('0x32')]?_0x49a230[_0x0420('0x32')]['id']:null;_0x19c9f4[_[_0x0420('0x2d')](_0x49a230[_0x0420('0x2e')])+(_0x49a230[_0x0420('0x2e')]!==_0x0420('0x33')?_0x0420('0x34'):_0x0420('0x35'))]=_0x49a230[_0x0420('0x11')]?_0x49a230[_0x0420('0x11')]['id']:null;logger[_0x0420('0x36')](util[_0x0420('0x14')](_0x0420('0x37'),_0x2e05b6,_0x4c75dd[_0x0420('0x38')]));emitChannelQueueInteraction(_0x49a230[_0x0420('0x2e')],_0x4c75dd[_0x0420('0x38')],_0x19c9f4,_0x49a230['account']['name'],_0x49a230[_0x0420('0x32')]['id'],!![],_0x4c4c51,_0x4c75dd['id']);if(rpc[_0x49a230[_0x0420('0x2e')]+_0x0420('0x39')]){return rpc[_0x49a230[_0x0420('0x2e')]+_0x0420('0x39')]['create'](_0x19c9f4)[_0x0420('0x3a')](function(_0x309298){logger['error'](_0x0420('0x3b'),_0x309298);});}}}function stopRouting(_0x43992c,_0x57fbbb,_0x46b030,_0x13e8a1){if(_0x43992c&&_0x57fbbb){_0x57fbbb['waiting']-=0x1;var _0x111e44={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x0420('0x14')](_0x0420('0x3c')),'reason':_0x0420('0x3d')};logger[_0x0420('0x36')](util[_0x0420('0x14')](_0x0420('0x3e'),_0x43992c,_0x57fbbb['name']));emitChannelQueueInteraction(_0x46b030[_0x0420('0x2e')],_0x57fbbb[_0x0420('0x38')],_0x46b030[_0x0420('0x29')],_0x46b030['account'][_0x0420('0x38')],_0x46b030[_0x0420('0x32')]['id'],![],_0x13e8a1,_0x57fbbb['id']);return rpc[_0x46b030[_0x0420('0x2e')]+_0x0420('0x3f')]['update'](_0x46b030[_0x0420('0x30')]['id'],{'queueId':_0x57fbbb['id']})['then'](function(){if(rpc[_0x46b030[_0x0420('0x2e')]+_0x0420('0x39')]){return rpc[_0x46b030[_0x0420('0x2e')]+_0x0420('0x39')][_0x0420('0x40')](_0x43992c,_0x111e44)[_0x0420('0x3a')](function(_0x3a3b54){logger['error']('update\x20queue\x20report',_0x3a3b54);});}});}}function endRouting(_0x2a8b06,_0x36294c,_0x2cfa78,_0x412fcf){if(_0x2a8b06&&_0x36294c){_0x36294c[_0x0420('0x28')]-=0x1;var _0x13ba3b={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0420('0x14')](_0x0420('0x3c')),'reason':_0x0420('0x41')};logger[_0x0420('0x36')](util[_0x0420('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x2a8b06,_0x36294c[_0x0420('0x38')]));emitChannelQueueInteraction(_0x2cfa78['channel'],_0x36294c['name'],_0x2cfa78[_0x0420('0x29')],_0x2cfa78[_0x0420('0x11')][_0x0420('0x38')],_0x2cfa78[_0x0420('0x32')]['id'],![],_0x412fcf);if(rpc[_0x2cfa78[_0x0420('0x2e')]+'QueueReport']){return rpc[_0x2cfa78[_0x0420('0x2e')]+_0x0420('0x39')][_0x0420('0x40')](_0x2a8b06,_0x13ba3b)[_0x0420('0x3a')](function(_0x62641e){logger[_0x0420('0x42')]('update\x20queue\x20report',_0x62641e);});}}}function handleFindQueue(_0x5d3554){return function(_0x3a32fd){return _0x3a32fd['name'][_0x0420('0x43')]()===_0x5d3554[_0x0420('0x43')]();};}exports[_0x0420('0x44')]=function(_0x4a65e5,_0xc7129c,_0x435487,_0x19dff9){return function(_0x1c5669){try{var _0x367dea={'name':_0xc7129c[0x0],'timeout':_0xc7129c[0x1]};var _0x41fa58=queue['validate'](_0x367dea,{'typecast':!![]});if(_0x41fa58[_0x0420('0x45')]){logger[_0x0420('0x42')](_0x0420('0x46'),_0x4a65e5,_[_0x0420('0x47')](_0x41fa58,'message')[_0x0420('0x48')](',\x20'));_0x1c5669[_0x0420('0x49')]();}else{var _0x19783e=_[_0x0420('0x4a')](_0x435487[_0x19dff9[_0x0420('0x2e')]+_0x0420('0x4b')],handleFindQueue(_0x367dea[_0x0420('0x38')]));if(_0x19783e){startRouting(_0x4a65e5,_0x19783e,_0x19dff9,_0x435487);var _0x32e1aa=(_0x19783e[_0x0420('0x41')]||0xa)*0x3e8;var _0x516e0d=(_0x367dea[_0x0420('0x41')]||0x14)*0x3e8;var _0x4d6431;if(_0x32e1aa>_0x516e0d){_0x516e0d=_0x32e1aa;}var _0x425e50=seqqueue['createQueue'](_0x32e1aa);_0x425e50['id']=_0x4a65e5;_0x425e50[_0x0420('0x4c')]=_0x32e1aa;_0x425e50[_0x0420('0x4d')]=_0x516e0d;_0x425e50[_0x0420('0x2e')]=_0x19dff9[_0x0420('0x2e')];_0x435487[_0x0420('0x4e')][_0x4a65e5]['on']('end',function(){logger[_0x0420('0x36')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4a65e5);stopRouting(_0x4a65e5,_0x19783e,_0x19dff9,_0x435487);clearTimeout(_0x4d6431);_0x4d6431=undefined;_0x425e50[_0x0420('0x4f')](!![]);if(_0x435487['rules'][_0x4a65e5]){delete _0x435487[_0x0420('0x4e')][_0x4a65e5];}_0x1c5669[_0x0420('0x49')]();});_0x435487['rules'][_0x4a65e5]['on']('complete',function(){if(_0x435487[_0x0420('0x4e')][_0x4a65e5]){delete _0x435487['rules'][_0x4a65e5];}});_0x4d6431=setTimeout(function(){logger[_0x0420('0x36')](_0x0420('0x50'),_0x4a65e5);endRouting(_0x4a65e5,_0x19783e,_0x19dff9,_0x435487);clearTimeout(_0x4d6431);_0x425e50['close'](!![]);_0x1c5669[_0x0420('0x51')]();},_0x516e0d);switch(_0x19783e[_0x0420('0x52')]){case _0x0420('0x53'):strategy['rrmemory'](_0x425e50,_0x19783e,_0x435487,_0x19dff9);break;default:strategy['beepall'](_0x425e50,_0x19783e,_0x435487,_0x19dff9);}}else{logger[_0x0420('0x42')](_0x0420('0x54'),_0x4a65e5,_0x367dea[_0x0420('0x38')]);_0x1c5669[_0x0420('0x49')]();}}}catch(_0x5e8174){logger[_0x0420('0x42')]('[%s][QUEUE]\x20%s',_0x4a65e5,_0x5e8174[_0x0420('0x55')]);_0x1c5669['stop']();}};}; \ No newline at end of file +var _0x8b35=['name','message','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','socket.io-emitter','account','queue','from','joinAt','emit','clone','queue_id','push','capitalize','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x8b35,0x17a));var _0x58b3=function(_0x3e1efa,_0x548431){_0x3e1efa=_0x3e1efa-0x0;var _0x12ab20=_0x8b35[_0x3e1efa];return _0x12ab20;};'use strict';var schema=require(_0x58b3('0x0'));var _=require(_0x58b3('0x1'));var util=require(_0x58b3('0x2'));var seqqueue=require(_0x58b3('0x3'));var moment=require(_0x58b3('0x4'));var Redis=require('ioredis');var config=require(_0x58b3('0x5'));var logger=require(_0x58b3('0x6'))(_0x58b3('0x7'));var strategy=require(_0x58b3('0x8'));config[_0x58b3('0x9')]=_['defaults'](config[_0x58b3('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x58b3('0xa'))(new Redis(config['redis']));var attributes=['id','queue_id',_0x58b3('0xb'),_0x58b3('0xc'),_0x58b3('0xd'),_0x58b3('0xe')];function emit(_0x446e8d,_0x3f2c8c,_0x585163){io['to'](_0x446e8d)[_0x58b3('0xf')](_0x3f2c8c,_0x585163);}function emitChannelQueueInteraction(_0xfa89c1,_0x5ee1c8,_0x1f9606,_0x272223,_0x399b0b,_0x5b3bc5,_0xa7f202,_0x4b777d){var _0x1cec9a=_[_0x58b3('0x10')](_0x1f9606);_0x1cec9a[_0x58b3('0x11')]=_0x4b777d;_0x1cec9a[_0x58b3('0xc')]=_0x5ee1c8;_0x1cec9a[_0x58b3('0xb')]=_0x272223;_0x1cec9a['id']=_0x399b0b;if(_0x5b3bc5){attributes[_0x58b3('0x12')](_[_0x58b3('0x13')](_0xfa89c1)+'InteractionId');_0xa7f202[util[_0x58b3('0x14')](_0x58b3('0x15'),_0xfa89c1)][_0x399b0b]=_['pick'](_0x1cec9a,attributes);}else{delete _0xa7f202[util[_0x58b3('0x14')](_0x58b3('0x15'),_0xfa89c1)][_0x399b0b];}emit(util['format']('%s:queue:%s',_0xfa89c1,_0x5ee1c8),util[_0x58b3('0x14')](_0x58b3('0x16'),_0xfa89c1,_0x5b3bc5?_0x58b3('0x17'):_0x58b3('0x18')),_['pick'](_0x1cec9a,attributes));}var rpc={'openchannelQueueReport':require(_0x58b3('0x19')),'mailQueueReport':require(_0x58b3('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x58b3('0x1b')),'faxQueueReport':require(_0x58b3('0x1c')),'whatsappQueueReport':require(_0x58b3('0x1d')),'chatInteraction':require(_0x58b3('0x1e')),'faxInteraction':require(_0x58b3('0x1f')),'mailInteraction':require(_0x58b3('0x20')),'openchannelInteraction':require(_0x58b3('0x21')),'smsInteraction':require(_0x58b3('0x22')),'whatsappInteraction':require(_0x58b3('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x58b3('0x24')},'timeout':{'type':_0x58b3('0x25'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x25df48,_0x32da06,_0xd1a9b,_0x53778e){if(_0x25df48&&_0x32da06&&_0xd1a9b){_0x32da06[_0x58b3('0x26')]+=0x1;var _0x30b679={'uniqueid':_0x25df48,'from':_0xd1a9b['body']?_0xd1a9b[_0x58b3('0x27')][_0x58b3('0xd')]:'','joinAt':moment()[_0x58b3('0x14')](_0x58b3('0x28')),'ContactId':_0xd1a9b[_0x58b3('0x29')]?_0xd1a9b[_0x58b3('0x29')]['id']:null,'ListId':_0xd1a9b[_0x58b3('0x2a')]?_0xd1a9b['list']['id']:null};_0x30b679[_[_0x58b3('0x2b')](_0xd1a9b[_0x58b3('0x2c')])+_0x58b3('0x2d')]=_0x32da06['id']||null;_0x30b679[_[_0x58b3('0x2b')](_0xd1a9b[_0x58b3('0x2c')])+'InteractionId']=_0xd1a9b['interaction']?_0xd1a9b[_0x58b3('0x2e')]['id']:null;_0x30b679[_[_0x58b3('0x2b')](_0xd1a9b['channel'])+'MessageId']=_0xd1a9b['message']?_0xd1a9b['message']['id']:null;_0x30b679[_['upperFirst'](_0xd1a9b[_0x58b3('0x2c')])+(_0xd1a9b[_0x58b3('0x2c')]!==_0x58b3('0x2f')?_0x58b3('0x30'):_0x58b3('0x31'))]=_0xd1a9b[_0x58b3('0xb')]?_0xd1a9b[_0x58b3('0xb')]['id']:null;logger[_0x58b3('0x32')](util[_0x58b3('0x14')](_0x58b3('0x33'),_0x25df48,_0x32da06[_0x58b3('0x34')]));emitChannelQueueInteraction(_0xd1a9b[_0x58b3('0x2c')],_0x32da06[_0x58b3('0x34')],_0x30b679,_0xd1a9b['account']['name'],_0xd1a9b[_0x58b3('0x35')]['id'],!![],_0x53778e,_0x32da06['id']);if(rpc[_0xd1a9b[_0x58b3('0x2c')]+_0x58b3('0x36')]){return rpc[_0xd1a9b[_0x58b3('0x2c')]+_0x58b3('0x36')]['create'](_0x30b679)[_0x58b3('0x37')](function(_0x1404da){logger[_0x58b3('0x38')](_0x58b3('0x39'),_0x1404da);});}}}function stopRouting(_0x3b9c5c,_0x198a7d,_0x410e3f,_0x4bcef9){if(_0x3b9c5c&&_0x198a7d){_0x198a7d[_0x58b3('0x26')]-=0x1;var _0x3e2230={'leaveAt':moment()['format'](_0x58b3('0x28')),'acceptAt':moment()[_0x58b3('0x14')](_0x58b3('0x28')),'reason':_0x58b3('0x3a')};logger[_0x58b3('0x32')](util[_0x58b3('0x14')](_0x58b3('0x3b'),_0x3b9c5c,_0x198a7d[_0x58b3('0x34')]));emitChannelQueueInteraction(_0x410e3f[_0x58b3('0x2c')],_0x198a7d[_0x58b3('0x34')],_0x410e3f[_0x58b3('0x27')],_0x410e3f[_0x58b3('0xb')][_0x58b3('0x34')],_0x410e3f['message']['id'],![],_0x4bcef9,_0x198a7d['id']);return rpc[_0x410e3f['channel']+_0x58b3('0x3c')][_0x58b3('0x3d')](_0x410e3f[_0x58b3('0x2e')]['id'],{'queueId':_0x198a7d['id']})[_0x58b3('0x3e')](function(){if(rpc[_0x410e3f[_0x58b3('0x2c')]+'QueueReport']){return rpc[_0x410e3f['channel']+'QueueReport'][_0x58b3('0x3d')](_0x3b9c5c,_0x3e2230)[_0x58b3('0x37')](function(_0x34b165){logger[_0x58b3('0x38')](_0x58b3('0x3f'),_0x34b165);});}});}}function endRouting(_0x27928c,_0x80de2f,_0x46c4a3,_0x210c33){if(_0x27928c&&_0x80de2f){_0x80de2f['waiting']-=0x1;var _0x1bd861={'leaveAt':moment()[_0x58b3('0x14')](_0x58b3('0x28')),'exitAt':moment()[_0x58b3('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x58b3('0x40')};logger['info'](util[_0x58b3('0x14')](_0x58b3('0x41'),_0x27928c,_0x80de2f[_0x58b3('0x34')]));emitChannelQueueInteraction(_0x46c4a3[_0x58b3('0x2c')],_0x80de2f[_0x58b3('0x34')],_0x46c4a3[_0x58b3('0x27')],_0x46c4a3[_0x58b3('0xb')][_0x58b3('0x34')],_0x46c4a3[_0x58b3('0x35')]['id'],![],_0x210c33);if(rpc[_0x46c4a3[_0x58b3('0x2c')]+_0x58b3('0x36')]){return rpc[_0x46c4a3[_0x58b3('0x2c')]+_0x58b3('0x36')][_0x58b3('0x3d')](_0x27928c,_0x1bd861)[_0x58b3('0x37')](function(_0xd3a7ad){logger['error'](_0x58b3('0x3f'),_0xd3a7ad);});}}}function handleFindQueue(_0xe32085){return function(_0x3e9a00){return _0x3e9a00[_0x58b3('0x34')][_0x58b3('0x42')]()===_0xe32085[_0x58b3('0x42')]();};}exports[_0x58b3('0x43')]=function(_0x377c0b,_0x36658f,_0x79caa4,_0x2321b4){return function(_0x2e21cb){try{var _0x3331b6={'name':_0x36658f[0x0],'timeout':_0x36658f[0x1]};var _0x41d726=queue[_0x58b3('0x0')](_0x3331b6,{'typecast':!![]});if(_0x41d726[_0x58b3('0x44')]){logger[_0x58b3('0x38')]('[%s][QUEUE]\x20%s',_0x377c0b,_[_0x58b3('0x45')](_0x41d726,_0x58b3('0x35'))['join'](',\x20'));_0x2e21cb[_0x58b3('0x46')]();}else{var _0x37a500=_[_0x58b3('0x47')](_0x79caa4[_0x2321b4[_0x58b3('0x2c')]+_0x58b3('0x48')],handleFindQueue(_0x3331b6['name']));if(_0x37a500){startRouting(_0x377c0b,_0x37a500,_0x2321b4,_0x79caa4);var _0x383743=(_0x37a500[_0x58b3('0x40')]||0xa)*0x3e8;var _0x205118=(_0x3331b6[_0x58b3('0x40')]||0x14)*0x3e8;var _0x530666;if(_0x383743>_0x205118){_0x205118=_0x383743;}var _0x357225=seqqueue[_0x58b3('0x49')](_0x383743);_0x357225['id']=_0x377c0b;_0x357225[_0x58b3('0x4a')]=_0x383743;_0x357225[_0x58b3('0x4b')]=_0x205118;_0x357225[_0x58b3('0x2c')]=_0x2321b4[_0x58b3('0x2c')];_0x79caa4[_0x58b3('0x4c')][_0x377c0b]['on']('end',function(){logger[_0x58b3('0x32')](_0x58b3('0x4d'),_0x377c0b);stopRouting(_0x377c0b,_0x37a500,_0x2321b4,_0x79caa4);clearTimeout(_0x530666);_0x530666=undefined;_0x357225[_0x58b3('0x4e')](!![]);if(_0x79caa4[_0x58b3('0x4c')][_0x377c0b]){delete _0x79caa4['rules'][_0x377c0b];}_0x2e21cb[_0x58b3('0x46')]();});_0x79caa4[_0x58b3('0x4c')][_0x377c0b]['on'](_0x58b3('0x4f'),function(){if(_0x79caa4[_0x58b3('0x4c')][_0x377c0b]){delete _0x79caa4[_0x58b3('0x4c')][_0x377c0b];}});_0x530666=setTimeout(function(){logger[_0x58b3('0x32')](_0x58b3('0x50'),_0x377c0b);endRouting(_0x377c0b,_0x37a500,_0x2321b4,_0x79caa4);clearTimeout(_0x530666);_0x357225[_0x58b3('0x4e')](!![]);_0x2e21cb['next']();},_0x205118);switch(_0x37a500[_0x58b3('0x51')]){case _0x58b3('0x52'):strategy['rrmemory'](_0x357225,_0x37a500,_0x79caa4,_0x2321b4);break;default:strategy[_0x58b3('0x53')](_0x357225,_0x37a500,_0x79caa4,_0x2321b4);}}else{logger[_0x58b3('0x38')](_0x58b3('0x54'),_0x377c0b,_0x3331b6[_0x58b3('0x34')]);_0x2e21cb[_0x58b3('0x46')]();}}}catch(_0x1ac9ca){logger[_0x58b3('0x38')]('[%s][QUEUE]\x20%s',_0x377c0b,_0x1ac9ca[_0x58b3('0x55')]);_0x2e21cb[_0x58b3('0x46')]();}};}; \ 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 2536ff8..62dc608 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 _0x0a9a=['writeLog','STOP','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','handleTimeout','bind','timeout','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','push','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification'];(function(_0x46b9bf,_0x3c9e5d){var _0xe4b4ac=function(_0x59da47){while(--_0x59da47){_0x46b9bf['push'](_0x46b9bf['shift']());}};_0xe4b4ac(++_0x3c9e5d);}(_0x0a9a,0x183));var _0xa0a9=function(_0x48ba23,_0x45401b){_0x48ba23=_0x48ba23-0x0;var _0x4d39ef=_0x0a9a[_0x48ba23];return _0x4d39ef;};'use strict';var _=require('lodash');var uuid=require(_0xa0a9('0x0'));var util=require('./util');var logger=require(_0xa0a9('0x1'))(_0xa0a9('0x2'));var Agent=function(_0x34801b,_0x49162f,_0x4ba993,_0x317a94){this[_0xa0a9('0x3')]=uuid['v4']();this['squeue']=_0x34801b;this[_0xa0a9('0x4')]=_0x49162f;this[_0xa0a9('0x5')]=_0x4ba993;this[_0xa0a9('0x2')]=_0x317a94;this[_0xa0a9('0x6')]['push'](this[_0xa0a9('0x7')]['bind'](this),this[_0xa0a9('0x8')][_0xa0a9('0x9')](this));this[_0xa0a9('0x6')]['on'](_0xa0a9('0xa'),this['handleTimeout'][_0xa0a9('0x9')](this));this[_0xa0a9('0x6')]['on']('drained',this['handleDrained'][_0xa0a9('0x9')](this));};Agent[_0xa0a9('0xb')]['push']=function(){this[_0xa0a9('0x6')]['push'](this[_0xa0a9('0x7')]['bind'](this),this[_0xa0a9('0x8')][_0xa0a9('0x9')](this));};Agent[_0xa0a9('0xb')][_0xa0a9('0xc')]=function(){this[_0xa0a9('0x8')](!![]);};Agent['prototype'][_0xa0a9('0x7')]=function(){logger[_0xa0a9('0xd')](_0xa0a9('0xe'),this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);if(_[_0xa0a9('0xf')](this['realtime'][_0xa0a9('0x10')][this['agent']['id']])){logger['debug'](_0xa0a9('0x11'),this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);setTimeout(this[_0xa0a9('0x12')]['bind'](this),0x3e8);}else{if(this[_0xa0a9('0x2')][_0xa0a9('0x13')]||util[_0xa0a9('0x14')](this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this['agent']['id']],this[_0xa0a9('0x6')][_0xa0a9('0x15')],![])){this['realtime']['agents'][this[_0xa0a9('0x4')]['id']][_0xa0a9('0x16')]=!![];this[_0xa0a9('0x5')]['agents'][this[_0xa0a9('0x4')]['id']]['busyQueue']=undefined;util[_0xa0a9('0x17')](this['realtime'],this[_0xa0a9('0x2')],this[_0xa0a9('0x4')],this[_0xa0a9('0x6')][_0xa0a9('0x15')]);util['showNotification'](this[_0xa0a9('0x3')],this['squeue']['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],null,this[_0xa0a9('0x2')]);util['writeLog'](this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],'RINGING'+(this[_0xa0a9('0x2')][_0xa0a9('0x13')]?_0xa0a9('0x18'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);setTimeout(this[_0xa0a9('0x12')][_0xa0a9('0x9')](this),0x3e8);}}};Agent[_0xa0a9('0xb')][_0xa0a9('0x8')]=function(_0x2386c9){if(_[_0xa0a9('0xf')](this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']])){return logger['debug'](_0xa0a9('0x11'),this[_0xa0a9('0x6')]['id'],this['agent']['id']);}else{logger[_0xa0a9('0xd')](_0xa0a9('0x19'),this['squeue']['id'],this['agent']['id']);util[_0xa0a9('0x1a')](this['notificationId'],this['squeue']['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],null,this[_0xa0a9('0x2')]);this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']]['busy']=![];this[_0xa0a9('0x5')][_0xa0a9('0x10')][this['agent']['id']][_0xa0a9('0x1b')]=undefined;util[_0xa0a9('0x1c')](this[_0xa0a9('0x5')],this['routing'],this['agent'],this[_0xa0a9('0x6')][_0xa0a9('0x15')]);util[_0xa0a9('0x1d')](this[_0xa0a9('0x6')]['id'],this['realtime'][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],_0x2386c9?_0xa0a9('0x1e'):'TIMEOUT');}if(!_0x2386c9){setTimeout(this[_0xa0a9('0x12')][_0xa0a9('0x9')](this),0x3e8);}};function agent(_0x4e121e,_0x53dfd1,_0x3ae735,_0x2ed673){return new Agent(_0x4e121e,_0x53dfd1,_0x3ae735,_0x2ed673);}module[_0xa0a9('0x1f')]=agent; \ No newline at end of file +var _0x6c7b=['saveWaitingNotification','showNotification','notificationId','RINGING','isNil','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','routing','squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue'];(function(_0x1285b7,_0x4f16c5){var _0x3c3475=function(_0xda5052){while(--_0xda5052){_0x1285b7['push'](_0x1285b7['shift']());}};_0x3c3475(++_0x4f16c5);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x56242d,_0x1dd061){_0x56242d=_0x56242d-0x0;var _0x5d7033=_0x6c7b[_0x56242d];return _0x5d7033;};'use strict';var _=require(_0xb6c7('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')(_0xb6c7('0x1'));var Agent=function(_0x5528b3,_0x2b678a,_0x438aa8,_0x35674b){this['notificationId']=uuid['v4']();this[_0xb6c7('0x2')]=_0x5528b3;this[_0xb6c7('0x3')]=_0x2b678a;this[_0xb6c7('0x4')]=_0x438aa8;this[_0xb6c7('0x1')]=_0x35674b;this[_0xb6c7('0x2')]['push'](this[_0xb6c7('0x5')][_0xb6c7('0x6')](this),this[_0xb6c7('0x7')][_0xb6c7('0x6')](this));this[_0xb6c7('0x2')]['on'](_0xb6c7('0x8'),this[_0xb6c7('0x7')][_0xb6c7('0x6')](this));this['squeue']['on']('drained',this[_0xb6c7('0x9')][_0xb6c7('0x6')](this));};Agent[_0xb6c7('0xa')][_0xb6c7('0xb')]=function(){this[_0xb6c7('0x2')][_0xb6c7('0xb')](this[_0xb6c7('0x5')]['bind'](this),this[_0xb6c7('0x7')][_0xb6c7('0x6')](this));};Agent[_0xb6c7('0xa')][_0xb6c7('0x9')]=function(){this[_0xb6c7('0x7')](!![]);};Agent[_0xb6c7('0xa')][_0xb6c7('0x5')]=function(){logger['debug'](_0xb6c7('0xc'),this['squeue']['id'],this['agent']['id']);if(_['isNil'](this[_0xb6c7('0x4')]['agents'][this[_0xb6c7('0x3')]['id']])){logger[_0xb6c7('0xd')](_0xb6c7('0xe'),this[_0xb6c7('0x2')]['id'],this[_0xb6c7('0x3')]['id']);setTimeout(this[_0xb6c7('0xb')][_0xb6c7('0x6')](this),0x3e8);}else{if(this[_0xb6c7('0x1')][_0xb6c7('0xf')]||util[_0xb6c7('0x10')](this[_0xb6c7('0x2')]['id'],this[_0xb6c7('0x4')][_0xb6c7('0x11')][this['agent']['id']],this[_0xb6c7('0x2')][_0xb6c7('0x12')],![])){this['realtime'][_0xb6c7('0x11')][this['agent']['id']][_0xb6c7('0x13')]=!![];this['realtime'][_0xb6c7('0x11')][this['agent']['id']][_0xb6c7('0x14')]=undefined;util[_0xb6c7('0x15')](this['realtime'],this[_0xb6c7('0x1')],this[_0xb6c7('0x3')],this[_0xb6c7('0x2')][_0xb6c7('0x12')]);util[_0xb6c7('0x16')](this[_0xb6c7('0x17')],this['squeue']['id'],this[_0xb6c7('0x4')][_0xb6c7('0x11')][this[_0xb6c7('0x3')]['id']],null,this[_0xb6c7('0x1')]);util['writeLog'](this[_0xb6c7('0x2')]['id'],this[_0xb6c7('0x4')]['agents'][this[_0xb6c7('0x3')]['id']],_0xb6c7('0x18')+(this[_0xb6c7('0x1')][_0xb6c7('0xf')]?':FORCED':''));}else{logger[_0xb6c7('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xb6c7('0x2')]['id'],this[_0xb6c7('0x3')]['id']);setTimeout(this[_0xb6c7('0xb')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x438dc3){if(_[_0xb6c7('0x19')](this[_0xb6c7('0x4')][_0xb6c7('0x11')][this[_0xb6c7('0x3')]['id']])){return logger[_0xb6c7('0xd')](_0xb6c7('0xe'),this[_0xb6c7('0x2')]['id'],this[_0xb6c7('0x3')]['id']);}else{logger[_0xb6c7('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xb6c7('0x2')]['id'],this['agent']['id']);util[_0xb6c7('0x1a')](this[_0xb6c7('0x17')],this[_0xb6c7('0x2')]['id'],this[_0xb6c7('0x4')][_0xb6c7('0x11')][this['agent']['id']],null,this['routing']);this['realtime'][_0xb6c7('0x11')][this[_0xb6c7('0x3')]['id']]['busy']=![];this[_0xb6c7('0x4')][_0xb6c7('0x11')][this['agent']['id']][_0xb6c7('0x14')]=undefined;util[_0xb6c7('0x1b')](this[_0xb6c7('0x4')],this[_0xb6c7('0x1')],this[_0xb6c7('0x3')],this[_0xb6c7('0x2')]['channel']);util[_0xb6c7('0x1c')](this[_0xb6c7('0x2')]['id'],this[_0xb6c7('0x4')][_0xb6c7('0x11')][this[_0xb6c7('0x3')]['id']],_0x438dc3?_0xb6c7('0x1d'):_0xb6c7('0x1e'));}if(!_0x438dc3){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x3bae95,_0x2c59e1,_0x33afa6,_0x3bbc90){return new Agent(_0x3bae95,_0x2c59e1,_0x33afa6,_0x3bbc90);}module[_0xb6c7('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 8791b76..05959da 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 _0x184a=['hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','push','handleRun','bind','timeout','handleTimeout','handleDrained','prototype','isNil','queue','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','routing','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x184a,0x12d));var _0xa184=function(_0x2bf152,_0x51dd42){_0x2bf152=_0x2bf152-0x0;var _0x340ef6=_0x184a[_0x2bf152];return _0x340ef6;};'use strict';var _=require('lodash');var uuid=require(_0xa184('0x0'));var util=require(_0xa184('0x1'));var logger=require(_0xa184('0x2'))('routing');var Beepall=function(_0x3c351a,_0x24a5c1,_0x829a61,_0x271337){this[_0xa184('0x3')]=uuid['v4']();this[_0xa184('0x4')]=_0x3c351a;this['queue']=_0x24a5c1;this[_0xa184('0x5')]=_0x829a61;this['routing']=_0x271337;this[_0xa184('0x4')][_0xa184('0x6')](this[_0xa184('0x7')][_0xa184('0x8')](this),this['handleTimeout'][_0xa184('0x8')](this));this[_0xa184('0x4')]['on'](_0xa184('0x9'),this[_0xa184('0xa')][_0xa184('0x8')](this));this[_0xa184('0x4')]['on']('drained',this[_0xa184('0xb')][_0xa184('0x8')](this));};Beepall[_0xa184('0xc')][_0xa184('0x6')]=function(){this[_0xa184('0x4')]['push'](this['handleRun'][_0xa184('0x8')](this),this[_0xa184('0xa')][_0xa184('0x8')](this));};Beepall[_0xa184('0xc')][_0xa184('0xb')]=function(){this[_0xa184('0xa')](!![]);};Beepall[_0xa184('0xc')][_0xa184('0x7')]=function(){var _0x5c64f6=!![];if(!_[_0xa184('0xd')](this[_0xa184('0xe')])&&!_[_0xa184('0xd')](this[_0xa184('0xe')][_0xa184('0xf')])&&this[_0xa184('0xe')]['Agents'][_0xa184('0x10')]>0x0){for(var _0x56b447=0x0,_0x4c7837;_0x56b4470x0){for(var _0x42cd65=0x0,_0x2e6d14;_0x42cd650x0&&_0x2642e5[_0x395a47+'CurrentCapacity']>=_0x2642e5[_0x395a47+_0x73f7('0x24')]){writeLog(_0x43c2b7,_0x2642e5,_0x395a47[_0x73f7('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x73f7('0x26')]=function(_0x5a661d,_0x145b7d,_0x14c1c8,_0x3c7939,_0x29db80){return sendNotification(!![],_0x5a661d,_0x145b7d,_0x14c1c8,_0x3c7939,_0x29db80);};exports[_0x73f7('0x27')]=function(_0x389b03,_0x22d87e,_0x1b0c07,_0x50ad07,_0x34265b){return sendNotification(![],_0x389b03,_0x22d87e,_0x1b0c07,_0x50ad07,_0x34265b);};exports[_0x73f7('0x28')]=function(_0x2247ff,_0x330b0d,_0x4318e1){var _0x25445e=_0x330b0d['interaction'][_0x73f7('0x29')];if(!_0x25445e&&_0x4318e1){_0x25445e=_0x4318e1['id'];}var _0xa59252=_[_0x73f7('0x2a')](_0x2247ff[_0x330b0d[_0x73f7('0x2b')]+_0x73f7('0x2c')],function(_0x4d2464){var _0xe4d0ab=_[_0x73f7('0x2d')](_0x330b0d[_0x73f7('0x2b')])+_0x73f7('0x2e');return _0x4d2464[_0xe4d0ab]===_0x330b0d['interaction']['id'];});if(!_0xa59252&&_0x25445e&&_0x2247ff[_0x73f7('0x2f')][_0x25445e]){_0xa59252=_[_0x73f7('0x2a')](_0x2247ff[_0x73f7('0x2f')][_0x25445e][_0x330b0d[_0x73f7('0x2b')]+_0x73f7('0x30')],function(_0x153c02){return _0x153c02['id']===_0x330b0d[_0x73f7('0x31')]['id'];});}return _0xa59252;};exports[_0x73f7('0x32')]=function(_0x2cf695,_0x14a676,_0x18e277,_0x371d7d){if(_0x18e277&&_0x18e277['id']&&_0x2cf695[_0x73f7('0x2f')]&&_0x2cf695['agents'][_0x18e277['id']]){_0x2cf695[_0x73f7('0x2f')][_0x18e277['id']][_0x371d7d+_0x73f7('0x30')][_0x14a676[_0x73f7('0x13')]['id']]={'id':_0x14a676[_0x73f7('0x31')]['id']};}};exports[_0x73f7('0x33')]=function(_0x235826,_0x49fb49,_0x1d997e,_0x5ea9f5){if(_0x1d997e&&_0x1d997e['id']&&_0x235826[_0x73f7('0x2f')]&&_0x235826[_0x73f7('0x2f')][_0x1d997e['id']]){delete _0x235826[_0x73f7('0x2f')][_0x1d997e['id']][_0x5ea9f5+'WaitingInteractions'][_0x49fb49[_0x73f7('0x13')]['id']];}};exports[_0x73f7('0x34')]=writeLog; \ No newline at end of file +var _0x9a66=['saveWaitingNotification','message','writeLog','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','socket.io-emitter','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','format','user:%s','name','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','QueuesWaitingInteractions','capitalize','channel','InteractionId','agents','some','WaitingInteractions','interaction'];(function(_0x3e081e,_0x1d15b0){var _0x3115ff=function(_0x58b355){while(--_0x58b355){_0x3e081e['push'](_0x3e081e['shift']());}};_0x3115ff(++_0x1d15b0);}(_0x9a66,0xfd));var _0x69a6=function(_0x519bac,_0x5e4af1){_0x519bac=_0x519bac-0x0;var _0x571631=_0x9a66[_0x519bac];return _0x571631;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x69a6('0x0'));var Redis=require(_0x69a6('0x1'));var config=require(_0x69a6('0x2'));var logger=require('../../../../../config/logger')(_0x69a6('0x3'));config[_0x69a6('0x4')]=_[_0x69a6('0x5')](config[_0x69a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x69a6('0x6'))(new Redis(config['redis']));function sendNotification(_0x72e421,_0x5c9954,_0x4e4e1c,_0x2f57ae,_0x3b182a,_0x4619ec){var _0x47fa82=_0x4619ec||{};var _0x20c023=_0x4e4e1c[_0x69a6('0x7')]('.');var _0x56c184={'uniqueid':_0x5c9954,'channel':_0x20c023[0x0],'id':_0x20c023[0x1],'title':_0x20c023[0x0]+_0x69a6('0x8'),'interactionId':_0x20c023[0x2],'queue':_0x3b182a?_0x3b182a['name']:null,'sound':_0x47fa82[_0x69a6('0x9')][_0x69a6('0xa')],'shake':_0x47fa82[_0x69a6('0x9')][_0x69a6('0xb')]};try{if(!_0x47fa82[_0x69a6('0xc')]){_0x47fa82['body']={};}if(_0x3b182a){_0x47fa82[_0x69a6('0xc')][_0x69a6('0xd')]=_0x3b182a;}else if(_0x47fa82[_0x69a6('0xc')]['queue']){delete _0x47fa82[_0x69a6('0xc')][_0x69a6('0xd')];}_0x56c184[_0x69a6('0xe')]=utils[_0x69a6('0xf')](_0x47fa82[_0x69a6('0x9')][_0x69a6('0x10')],_0x47fa82);}catch(_0x241b09){_0x56c184[_0x69a6('0xe')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x69a6('0x11')](util['format'](_0x69a6('0x12'),_0x5c9954,_0x241b09['message']));}io['to'](util[_0x69a6('0x13')](_0x69a6('0x14'),_0x2f57ae[_0x69a6('0x15')]))[_0x69a6('0x16')](util[_0x69a6('0x13')](_0x69a6('0x17'),_0x72e421?_0x69a6('0x18'):'remove'),_0x56c184);}function writeLog(_0x3dc7a0,_0x170d97,_0x1ccf8f){return logger[_0x69a6('0x19')](util[_0x69a6('0x13')](_0x69a6('0x1a'),_0x3dc7a0,_0x170d97[_0x69a6('0x15')],_0x1ccf8f));}exports[_0x69a6('0x1b')]=function(_0x30a017,_0x2f1c30,_0x5b32a5,_0x1e99ec){if(_0x2f1c30[_0x69a6('0x1c')]){writeLog(_0x30a017,_0x2f1c30,_0x69a6('0x1d'));return![];}if(!_0x2f1c30['online']){writeLog(_0x30a017,_0x2f1c30,_0x69a6('0x1e'));return![];}if(_0x2f1c30[_0x5b32a5+'Pause']){writeLog(_0x30a017,_0x2f1c30,_0x69a6('0x1f'));return![];}if(_0x1e99ec&&_0x2f1c30['hasOwnProperty'](_0x5b32a5+_0x69a6('0x20'))&&_0x2f1c30[_0x69a6('0x21')](_0x5b32a5+_0x69a6('0x22'))){if(_0x2f1c30[_0x5b32a5+'Capacity']>0x0&&_0x2f1c30[_0x5b32a5+_0x69a6('0x22')]>=_0x2f1c30[_0x5b32a5+_0x69a6('0x20')]){writeLog(_0x30a017,_0x2f1c30,_0x5b32a5[_0x69a6('0x23')]()+_0x69a6('0x24'));return![];}}return!![];};exports[_0x69a6('0x25')]=function(_0x2a241f,_0x1c3830,_0x433c5b,_0x475c09,_0x401bb4){return sendNotification(!![],_0x2a241f,_0x1c3830,_0x433c5b,_0x475c09,_0x401bb4);};exports[_0x69a6('0x26')]=function(_0x156ed0,_0x24ffd8,_0x3f9841,_0x4a0c11,_0x42385e){return sendNotification(![],_0x156ed0,_0x24ffd8,_0x3f9841,_0x4a0c11,_0x42385e);};exports['checkWaitingNotifications']=function(_0x3fa9ae,_0x33c315,_0x50ff8f){var _0x46aa22=_0x33c315['interaction']['UserId'];if(!_0x46aa22&&_0x50ff8f){_0x46aa22=_0x50ff8f['id'];}var _0x3a5291=_['some'](_0x3fa9ae[_0x33c315['channel']+_0x69a6('0x27')],function(_0x4b7748){var _0x1e2300=_[_0x69a6('0x28')](_0x33c315[_0x69a6('0x29')])+_0x69a6('0x2a');return _0x4b7748[_0x1e2300]===_0x33c315['interaction']['id'];});if(!_0x3a5291&&_0x46aa22&&_0x3fa9ae[_0x69a6('0x2b')][_0x46aa22]){_0x3a5291=_[_0x69a6('0x2c')](_0x3fa9ae['agents'][_0x46aa22][_0x33c315['channel']+_0x69a6('0x2d')],function(_0x37d310){return _0x37d310['id']===_0x33c315[_0x69a6('0x2e')]['id'];});}return _0x3a5291;};exports[_0x69a6('0x2f')]=function(_0x59b3fd,_0x36c494,_0x4d49d9,_0x577d16){if(_0x4d49d9&&_0x4d49d9['id']&&_0x59b3fd['agents']&&_0x59b3fd['agents'][_0x4d49d9['id']]){_0x59b3fd['agents'][_0x4d49d9['id']][_0x577d16+_0x69a6('0x2d')][_0x36c494[_0x69a6('0x30')]['id']]={'id':_0x36c494['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x390ef0,_0x496ce7,_0x344d6b,_0x14af93){if(_0x344d6b&&_0x344d6b['id']&&_0x390ef0[_0x69a6('0x2b')]&&_0x390ef0[_0x69a6('0x2b')][_0x344d6b['id']]){delete _0x390ef0['agents'][_0x344d6b['id']][_0x14af93+_0x69a6('0x2d')][_0x496ce7[_0x69a6('0x30')]['id']];}};exports[_0x69a6('0x31')]=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 2ebea96..50f1b08 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 _0x525e=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x46c0a5,_0x2f8b01){var _0x194043=function(_0x1fdba5){while(--_0x1fdba5){_0x46c0a5['push'](_0x46c0a5['shift']());}};_0x194043(++_0x2f8b01);}(_0x525e,0x78));var _0xe525=function(_0x1d6c7e,_0x3c044a){_0x1d6c7e=_0x1d6c7e-0x0;var _0x342331=_0x525e[_0x1d6c7e];return _0x342331;};'use strict';var schema=require(_0xe525('0x0'));var sh=require(_0xe525('0x1'));var _=require(_0xe525('0x2'));var utils=require(_0xe525('0x3'));var logger=require(_0xe525('0x4'))(_0xe525('0x5'));var system=schema({'command':{'type':_0xe525('0x6'),'required':!![],'message':_0xe525('0x7')}});exports['consequence']=function(_0x3d7c66,_0x424039){return function(_0x2c287f){try{var _0x59a6b6={'command':_0x424039[0x0]};var _0x4c68a3=system[_0xe525('0x0')](_0x59a6b6,{'typecast':!![]});if(_0x4c68a3['length']){logger[_0xe525('0x8')](_0xe525('0x9'),_0x3d7c66,_[_0xe525('0xa')](_0x4c68a3,_0xe525('0xb'))[_0xe525('0xc')](',\x20'));logger[_0xe525('0xd')](_0xe525('0xe'),_0x3d7c66);_0x2c287f['next']();}else{var _0x28b499=this;var _0x9b637b=utils[_0xe525('0xf')](_0x424039[0x0],this);logger[_0xe525('0xd')](_0xe525('0x10'),_0x3d7c66,_0x9b637b);sh['exec'](_[_0xe525('0x11')](_0x9b637b),function(_0x1974bb,_0x1bd593){logger[_0xe525('0xd')](_0xe525('0x12'),_0x3d7c66,_0x1974bb);if(_0x1974bb==0x0){var _0x1faf27=_0x1bd593[_0xe525('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xe525('0x14')](_0x424039[0x1])||_[_0xe525('0x15')](_0x424039[0x1])){logger[_0xe525('0xd')](_0xe525('0x16'),_0x3d7c66);_0x28b499['body'][_0x424039[0x1]]=_0x1faf27;}else{logger[_0xe525('0xd')](_0xe525('0x17'),_0x3d7c66,_0x424039[0x1],_0x1faf27);_0x28b499[_0xe525('0x18')][_0x424039[0x1]]=_0x1faf27;}}_0x2c287f['next']();});}}catch(_0x2488b7){logger[_0xe525('0x8')](_0xe525('0x9'),_0x3d7c66,_[_0xe525('0x19')](_0x2488b7)?JSON[_0xe525('0x1a')](_0x2488b7):_0x2488b7);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3d7c66);_0x2c287f[_0xe525('0x1b')]();}};}; \ No newline at end of file +var _0x71f8=['isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x1cd52c,_0x5ee5cb){var _0xbdf8bb=function(_0x53878e){while(--_0x53878e){_0x1cd52c['push'](_0x1cd52c['shift']());}};_0xbdf8bb(++_0x5ee5cb);}(_0x71f8,0x1ae));var _0x871f=function(_0x534185,_0x1e880f){_0x534185=_0x534185-0x0;var _0xd10ee2=_0x71f8[_0x534185];return _0xd10ee2;};'use strict';var schema=require(_0x871f('0x0'));var sh=require(_0x871f('0x1'));var _=require(_0x871f('0x2'));var utils=require('./utils');var logger=require(_0x871f('0x3'))(_0x871f('0x4'));var system=schema({'command':{'type':_0x871f('0x5'),'required':!![],'message':_0x871f('0x6')}});exports[_0x871f('0x7')]=function(_0x36e883,_0x132b4d){return function(_0x1fe377){try{var _0x427dac={'command':_0x132b4d[0x0]};var _0x2e7c5b=system[_0x871f('0x0')](_0x427dac,{'typecast':!![]});if(_0x2e7c5b[_0x871f('0x8')]){logger[_0x871f('0x9')](_0x871f('0xa'),_0x36e883,_[_0x871f('0xb')](_0x2e7c5b,'message')[_0x871f('0xc')](',\x20'));logger[_0x871f('0xd')](_0x871f('0xe'),_0x36e883);_0x1fe377[_0x871f('0xf')]();}else{var _0x5cc1c5=this;var _0x5c4e17=utils['getMustacheRender'](_0x132b4d[0x0],this);logger[_0x871f('0xd')](_0x871f('0x10'),_0x36e883,_0x5c4e17);sh['exec'](_[_0x871f('0x11')](_0x5c4e17),function(_0x254f63,_0x4ae9ac){logger[_0x871f('0xd')](_0x871f('0x12'),_0x36e883,_0x254f63);if(_0x254f63==0x0){var _0xc70dd7=_0x4ae9ac[_0x871f('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x871f('0x14')](_0x132b4d[0x1])||_['isEmpty'](_0x132b4d[0x1])){logger['info'](_0x871f('0x15'),_0x36e883);_0x5cc1c5[_0x871f('0x16')][_0x132b4d[0x1]]=_0xc70dd7;}else{logger[_0x871f('0xd')](_0x871f('0x17'),_0x36e883,_0x132b4d[0x1],_0xc70dd7);_0x5cc1c5[_0x871f('0x16')][_0x132b4d[0x1]]=_0xc70dd7;}}_0x1fe377[_0x871f('0xf')]();});}}catch(_0x272fd3){logger['error'](_0x871f('0xa'),_0x36e883,_[_0x871f('0x18')](_0x272fd3)?JSON['stringify'](_0x272fd3):_0x272fd3);logger['info'](_0x871f('0xe'),_0x36e883);_0x1fe377['next']();}};}; \ 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 1e27091..8a06468 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 _0xc6b6=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','[%s][TAG]\x20%s','isObject','next','lodash','../../rpc/openchannelInteraction'];(function(_0x28f323,_0x1ca4c9){var _0x53f649=function(_0x220945){while(--_0x220945){_0x28f323['push'](_0x28f323['shift']());}};_0x53f649(++_0x1ca4c9);}(_0xc6b6,0x1ae));var _0x6c6b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc6b6[_0x19950b];return _0x3c6b41;};'use strict';var schema=require('validate');var _=require(_0x6c6b('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6c6b('0x1')),'smsInteraction':require(_0x6c6b('0x2')),'mailInteraction':require(_0x6c6b('0x3')),'faxInteraction':require(_0x6c6b('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x6c6b('0x5'));var tag=schema({'tag':{'type':_0x6c6b('0x6'),'required':!![],'message':_0x6c6b('0x7')}});exports[_0x6c6b('0x8')]=function(_0x4f6131,_0x561d3d,_0x198030,_0x35652f){return function(_0x5a3592){try{var _0x586ae8={'tag':_0x561d3d[0x0]};var _0x1408f0=tag['validate'](_0x586ae8,{'typecast':!![]});if(_0x1408f0[_0x6c6b('0x9')]){logger[_0x6c6b('0xa')]('[%s][TAG]\x20%s',_0x4f6131,_[_0x6c6b('0xb')](_0x1408f0,_0x6c6b('0xc'))['join'](',\x20'));logger[_0x6c6b('0xd')](_0x6c6b('0xe'),_0x4f6131);_0x5a3592['next']();}else{var _0x132237={'ids':[_0x561d3d[0x0]]};if(rpc[_0x35652f[_0x6c6b('0xf')]+'Interaction']){rpc[_0x35652f[_0x6c6b('0xf')]+_0x6c6b('0x10')][_0x6c6b('0x11')](_0x35652f[_0x6c6b('0x12')]['id'],_0x132237)[_0x6c6b('0x13')](function(_0x4c3558){logger[_0x6c6b('0xd')](_0x6c6b('0x14'),_0x4f6131,_0x561d3d[0x1],_0x35652f['channel'],_0x35652f['interaction']['id']);})[_0x6c6b('0x15')](function(_0x2251a7){logger[_0x6c6b('0xa')]('[%s][TAG]\x20%s',_0x4f6131,JSON[_0x6c6b('0x16')](_0x2251a7));logger[_0x6c6b('0xd')](_0x6c6b('0xe'),_0x4f6131);})[_0x6c6b('0x17')](function(){_0x5a3592['next']();});}}}catch(_0x1ef0d2){logger[_0x6c6b('0xa')](_0x6c6b('0x18'),_0x4f6131,_[_0x6c6b('0x19')](_0x1ef0d2)?JSON[_0x6c6b('0x16')](_0x1ef0d2):_0x1ef0d2);logger[_0x6c6b('0xd')](_0x6c6b('0xe'),_0x4f6131);_0x5a3592[_0x6c6b('0x1a')]();}};}; \ No newline at end of file +var _0xdf8d=['isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','consequence','length','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','catch','error','stringify','finally'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf8d,0xb0));var _0xddf8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xdf8d[_0x46698a];return _0x356db0;};'use strict';var schema=require('validate');var _=require(_0xddf8('0x0'));var rpc={'chatInteraction':require(_0xddf8('0x1')),'openchannelInteraction':require(_0xddf8('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xddf8('0x3')),'faxInteraction':require(_0xddf8('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xddf8('0x5'));var tag=schema({'tag':{'type':_0xddf8('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xddf8('0x7')]=function(_0x37ad09,_0x1577bf,_0x5cfbd5,_0x77324f){return function(_0x3e206b){try{var _0xd2958c={'tag':_0x1577bf[0x0]};var _0x219d04=tag['validate'](_0xd2958c,{'typecast':!![]});if(_0x219d04[_0xddf8('0x8')]){logger['error'](_0xddf8('0x9'),_0x37ad09,_['map'](_0x219d04,_0xddf8('0xa'))[_0xddf8('0xb')](',\x20'));logger['info'](_0xddf8('0xc'),_0x37ad09);_0x3e206b[_0xddf8('0xd')]();}else{var _0xad5d78={'ids':[_0x1577bf[0x0]]};if(rpc[_0x77324f[_0xddf8('0xe')]+'Interaction']){rpc[_0x77324f['channel']+_0xddf8('0xf')][_0xddf8('0x10')](_0x77324f[_0xddf8('0x11')]['id'],_0xad5d78)[_0xddf8('0x12')](function(_0x4bda3f){logger[_0xddf8('0x13')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x37ad09,_0x1577bf[0x1],_0x77324f[_0xddf8('0xe')],_0x77324f[_0xddf8('0x11')]['id']);})[_0xddf8('0x14')](function(_0x191320){logger[_0xddf8('0x15')](_0xddf8('0x9'),_0x37ad09,JSON[_0xddf8('0x16')](_0x191320));logger[_0xddf8('0x13')](_0xddf8('0xc'),_0x37ad09);})[_0xddf8('0x17')](function(){_0x3e206b['next']();});}}}catch(_0x31a213){logger['error']('[%s][TAG]\x20%s',_0x37ad09,_[_0xddf8('0x18')](_0x31a213)?JSON['stringify'](_0x31a213):_0x31a213);logger[_0xddf8('0x13')](_0xddf8('0xc'),_0x37ad09);_0x3e206b[_0xddf8('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 5d2eb8f..96f85a4 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8be2=['includes','push','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','logged','channelId=','&serviceId=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8be2,0x1c8));var _0x28be=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0x8be2[_0x127c7b];return _0x1708eb;};'use strict';var rp=require(_0x28be('0x0'));var logger=require('../../../../config/logger')(_0x28be('0x1'));var _=require(_0x28be('0x2'));var arr=[];exports[_0x28be('0x3')]=function(_0x4833fe,_0x902b65){return function(_0x358415){var _0x74e122=_0x902b65[0xa];var _0x1f60ef=_0x902b65[0xb];var _0x398d07=_0x902b65[0xc];var _0x213fa7=_0x902b65[0xd];var _0x1659ee=_0x902b65[0xe];var _0xec07ef=_0x902b65[0xf][_0x28be('0x4')](/\n/g,_0x28be('0x5'));var _0x53862d=_0x902b65[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x28be('0x6')](_0x1f60ef)){arr[_0x28be('0x7')](_0x1f60ef);var _0x53dee9=_0x902b65[0x3];var _0x547490=_0x902b65[0x4];var _0x15fbce=_0x902b65[0x1];var _0x3d69a0=_0x902b65[0x0];var _0x3e6e41={};_0x3e6e41['urlOnAnswer']=_0x902b65[0x8]+_0x28be('0x8')+_0x398d07+'|'+_0x74e122+'|'+_0x213fa7+'|'+_0x1f60ef+'|'+_0x1659ee;_0x3e6e41[_0x28be('0x9')]=_0x902b65[0x7]+_0x28be('0x8')+_0x398d07+'|'+_0x74e122+'|'+_0x213fa7+'|'+_0x1f60ef+'|'+_0x1659ee+'|'+_0xec07ef+'|'+_0x53862d;_0x3e6e41[_0x28be('0xa')]=_0x902b65[0x9];var _0x286af0={};_0x286af0[_0x28be('0xb')]=_0x28be('0xc');_0x286af0[_0x28be('0xd')]=_0x28be('0xe');var _0x1b73f9=[];_0x1b73f9['push'](_0x902b65[0x2]);_0x1b73f9[_0x28be('0x7')](_0x902b65[0x5]);_0x1b73f9['push'](_0x902b65[0x6]);_0x286af0[_0x28be('0xf')]=_0x1b73f9;_0x286af0['id']=0x1;var _0x10835f=JSON[_0x28be('0x10')](_0x286af0);var _0x1dfdb0={'encoding':_0x28be('0x11'),'method':_0x28be('0x12'),'timeout':0x2710,'url':_0x53dee9,'headers':{'Content-Type':_0x28be('0x13')},'body':_0x10835f};return rp(_0x1dfdb0)[_0x28be('0x14')](function(_0x2aa8d8){const _0x372e97=JSON['parse'](_0x2aa8d8);if(!_0x372e97['result'][_0x28be('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x2c8ae8=_0x1f60ef;var _0x9c6623=_0x28be('0x16')+_0x15fbce+_0x28be('0x17')+_0x3d69a0+'&sessionId='+_0x2c8ae8+'&data='+JSON[_0x28be('0x10')](_0x3e6e41);var _0x1e3bcd=_0x547490+'?'+_0x9c6623;return rp(_0x1e3bcd);})[_0x28be('0x14')](function(_0x5a09d5){logger['info'](_0x28be('0x18'),_0x4833fe,_0x5a09d5);_0x358415[_0x28be('0x19')]();})[_0x28be('0x1a')](function(_0x24a9ac){logger[_0x28be('0x1b')](_0x28be('0x1c'),_0x4833fe,_[_0x28be('0x1d')](_0x24a9ac)?JSON[_0x28be('0x10')](_0x24a9ac):_0x24a9ac);_0x358415[_0x28be('0x19')]();});}else{logger[_0x28be('0x1e')](_0x28be('0x1f'),_0x4833fe);_0x358415[_0x28be('0x20')]();}};}; \ No newline at end of file +var _0x8982=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','consequence','\x20-\x20','push','urlOnAnswer','?params=','jsonrpc','2.0','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x8982,0x104));var _0x2898=function(_0x24303d,_0x3ab9f1){_0x24303d=_0x24303d-0x0;var _0x5116d3=_0x8982[_0x24303d];return _0x5116d3;};'use strict';var rp=require(_0x2898('0x0'));var logger=require(_0x2898('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0x2898('0x2')]=function(_0x4a3eb3,_0x55bf3e){return function(_0x151924){var _0x292923=_0x55bf3e[0xa];var _0x286af9=_0x55bf3e[0xb];var _0x5dc273=_0x55bf3e[0xc];var _0x4418cb=_0x55bf3e[0xd];var _0x2ea7e9=_0x55bf3e[0xe];var _0x338a85=_0x55bf3e[0xf]['replace'](/\n/g,_0x2898('0x3'));var _0xe6e1c=_0x55bf3e[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x286af9)){arr[_0x2898('0x4')](_0x286af9);var _0x4f43a1=_0x55bf3e[0x3];var _0xeec55c=_0x55bf3e[0x4];var _0x510540=_0x55bf3e[0x1];var _0x45db6e=_0x55bf3e[0x0];var _0x5427b3={};_0x5427b3[_0x2898('0x5')]=_0x55bf3e[0x8]+_0x2898('0x6')+_0x5dc273+'|'+_0x292923+'|'+_0x4418cb+'|'+_0x286af9+'|'+_0x2ea7e9;_0x5427b3['urlOnRing']=_0x55bf3e[0x7]+_0x2898('0x6')+_0x5dc273+'|'+_0x292923+'|'+_0x4418cb+'|'+_0x286af9+'|'+_0x2ea7e9+'|'+_0x338a85+'|'+_0xe6e1c;_0x5427b3['title']=_0x55bf3e[0x9];var _0x73ecee={};_0x73ecee[_0x2898('0x7')]=_0x2898('0x8');_0x73ecee['method']=_0x2898('0x9');var _0x58006d=[];_0x58006d[_0x2898('0x4')](_0x55bf3e[0x2]);_0x58006d['push'](_0x55bf3e[0x5]);_0x58006d['push'](_0x55bf3e[0x6]);_0x73ecee[_0x2898('0xa')]=_0x58006d;_0x73ecee['id']=0x1;var _0x2e1733=JSON[_0x2898('0xb')](_0x73ecee);var _0x3df397={'encoding':_0x2898('0xc'),'method':_0x2898('0xd'),'timeout':0x2710,'url':_0x4f43a1,'headers':{'Content-Type':_0x2898('0xe')},'body':_0x2e1733};return rp(_0x3df397)[_0x2898('0xf')](function(_0x341b35){const _0x5383e3=JSON[_0x2898('0x10')](_0x341b35);if(!_0x5383e3[_0x2898('0x11')][_0x2898('0x12')]){throw new Error(_0x2898('0x13'));}var _0x492870=_0x286af9;var _0x329bef=_0x2898('0x14')+_0x510540+'&serviceId='+_0x45db6e+_0x2898('0x15')+_0x492870+_0x2898('0x16')+JSON[_0x2898('0xb')](_0x5427b3);var _0x1f804b=_0xeec55c+'?'+_0x329bef;return rp(_0x1f804b);})[_0x2898('0xf')](function(_0x3240dc){logger[_0x2898('0x17')](_0x2898('0x18'),_0x4a3eb3,_0x3240dc);_0x151924['stop']();})[_0x2898('0x19')](function(_0x1079ca){logger[_0x2898('0x1a')](_0x2898('0x1b'),_0x4a3eb3,_['isObject'](_0x1079ca)?JSON[_0x2898('0xb')](_0x1079ca):_0x1079ca);_0x151924[_0x2898('0x1c')]();});}else{logger['info'](_0x2898('0x1d'),_0x4a3eb3);_0x151924[_0x2898('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index c9198bc..29de5ad 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x18d016,_0x244c4d){var _0x290c9b=function(_0x39cac9){while(--_0x39cac9){_0x18d016['push'](_0x18d016['shift']());}};_0x290c9b(++_0x244c4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x5bc9bd,_0x59ce48){var _0x4fe1aa=function(_0x3d29bd){while(--_0x3d29bd){_0x5bc9bd['push'](_0x5bc9bd['shift']());}};_0x4fe1aa(++_0x59ce48);}(_0xe706,0xa3));var _0x6e70=function(_0xfa3280,_0x42246f){_0xfa3280=_0xfa3280-0x0;var _0x1d6b04=_0xe706[_0xfa3280];return _0x1d6b04;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 82029fd..bfd0d95 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 _0xc16d=['http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','listen','rules','message','interaction','checkWaitingNotifications','isArray','applications','existsSync','.js','app','toLowerCase','autoreply','split','channel','mail','push','length','join','slice','dialogflow','dialogflowv2','appdata','amazonlex','tag','tvox','getMustacheRender','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','updateRealtime','find','chatQueues','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server'];(function(_0x236a97,_0x2da25a){var _0x4b2fba=function(_0x280ed1){while(--_0x280ed1){_0x236a97['push'](_0x236a97['shift']());}};_0x4b2fba(++_0x2da25a);}(_0xc16d,0x145));var _0xdc16=function(_0x7e3f56,_0x1566e9){_0x7e3f56=_0x7e3f56-0x0;var _0x5758c4=_0xc16d[_0x7e3f56];return _0x5758c4;};'use strict';var _=require(_0xdc16('0x0'));var util=require(_0xdc16('0x1'));var path=require(_0xdc16('0x2'));var fs=require('fs');var jayson=require(_0xdc16('0x3'));var BPromise=require(_0xdc16('0x4'));var utils=require(_0xdc16('0x5'));var sUtils=require(_0xdc16('0x6'));var logger=require('../../../config/logger')(_0xdc16('0x7'));var rpc={'openchannelQueueReport':require(_0xdc16('0x8')),'mailQueueReport':require(_0xdc16('0x9')),'chatQueueReport':require(_0xdc16('0xa')),'smsQueueReport':require(_0xdc16('0xb')),'faxQueueReport':require(_0xdc16('0xc')),'whatsappQueueReport':require(_0xdc16('0xd'))};var RuleEngine=require(_0xdc16('0xe'));function getId(_0x281789,_0x473d25,_0x25bde7){return util[_0xdc16('0xf')](_0xdc16('0x10'),_0x281789,_0x473d25||0x0,_0x25bde7||0x0);}function getIntervals(_0x1c9639,_0x368d23){var _0x430bdc=[];if(!_['isNil'](_0x368d23[_0xdc16('0x11')])&&!_[_0xdc16('0x12')](_0x1c9639[_0x368d23[_0xdc16('0x11')]])&&!_[_0xdc16('0x12')](_0x1c9639[_0x368d23['IntervalId']][_0xdc16('0x13')])){_0x430bdc=_[_0xdc16('0x14')](_0x1c9639[_0x368d23[_0xdc16('0x11')]][_0xdc16('0x13')],'interval');}else if(!_[_0xdc16('0x12')](_0x368d23['interval'])){_0x430bdc=[_0x368d23['interval']];}return _0x430bdc;}exports[_0xdc16('0x15')]=function(_0x50d023){_0x50d023[_0xdc16('0x16')]={};return new BPromise(function(_0x42b482,_0x1a9f4f){var _0x5677a4={'Start':function(_0xd7ff38){var _0x5a2b26=this;return new Promise(function(_0x33d3e7,_0x13742b){if(_0xd7ff38){try{var _0x67b9b0=[];var _0x396bed=getId(_0xd7ff38['channel'],_0xd7ff38[_0xdc16('0x17')]?_0xd7ff38[_0xdc16('0x17')]['id']:0x0,_0xd7ff38['interaction']?_0xd7ff38[_0xdc16('0x18')]['id']:0x0);var _0x3bf134=sUtils[_0xdc16('0x19')](_0x50d023,_0xd7ff38);if(_0xd7ff38['transfer']||!_0x3bf134&&_0xd7ff38['applications']&&_[_0xdc16('0x1a')](_0xd7ff38[_0xdc16('0x1b')])&&_0xd7ff38[_0xdc16('0x1b')]['length']){for(var _0x4b1afb=0x0;_0x4b1afb<_0xd7ff38['applications']['length'];_0x4b1afb+=0x1){var _0x192f74=_0xd7ff38[_0xdc16('0x1b')][_0x4b1afb];if(fs[_0xdc16('0x1c')](path['join'](__dirname,'applications',_0x192f74['app']+_0xdc16('0x1d')))){var _0x50d974=[];switch(_0x192f74[_0xdc16('0x1e')][_0xdc16('0x1f')]()){case _0xdc16('0x20'):var _0x4ae7fc=_0x192f74['appdata'][_0xdc16('0x21')](',');if(_0xd7ff38[_0xdc16('0x22')]===_0xdc16('0x23')){_0x50d974[_0xdc16('0x24')](_0x4ae7fc[0x0]);_0x50d974['push'](_0x4ae7fc[0x1]);_0x50d974['push'](_0x4ae7fc['slice'](0x2,_0x4ae7fc[_0xdc16('0x25')])[_0xdc16('0x26')](','));}else{_0x50d974[_0xdc16('0x24')](_0x4ae7fc[0x0]);_0x50d974[_0xdc16('0x24')](_0x4ae7fc[_0xdc16('0x27')](0x1,_0x4ae7fc[_0xdc16('0x25')])[_0xdc16('0x26')](','));}break;case _0xdc16('0x28'):var _0x5c8970=_0x192f74['appdata'][_0xdc16('0x21')](',');_0x50d974[_0xdc16('0x24')](_0x5c8970[0x0]);_0x50d974['push'](_0x5c8970[0x1]);_0x50d974[_0xdc16('0x24')](_0x5c8970['slice'](0x2,_0x5c8970[_0xdc16('0x25')])[_0xdc16('0x26')](','));break;case _0xdc16('0x29'):var _0x4c1592=_0x192f74[_0xdc16('0x2a')][_0xdc16('0x21')](',');_0x50d974[_0xdc16('0x24')](_0x4c1592[0x0]);_0x50d974['push'](_0x4c1592[0x1]);_0x50d974[_0xdc16('0x24')](_0x4c1592[0x2]);_0x50d974[_0xdc16('0x24')](_0x4c1592[0x3]);_0x50d974[_0xdc16('0x24')](_0x4c1592['slice'](0x4,_0x4c1592[_0xdc16('0x25')])[_0xdc16('0x26')](','));break;case _0xdc16('0x2b'):var _0x273359=_0x192f74[_0xdc16('0x2a')]['split'](',');_0x50d974[_0xdc16('0x24')](_0x273359[0x0]);_0x50d974[_0xdc16('0x24')](_0x273359[0x1]);_0x50d974[_0xdc16('0x24')](_0x273359[0x2]);_0x50d974[_0xdc16('0x24')](_0x273359[0x3]);_0x50d974[_0xdc16('0x24')](_0x273359['slice'](0x4,_0x273359[_0xdc16('0x25')])[_0xdc16('0x26')](','));break;case _0xdc16('0x17'):_0x50d974['push'](_0x192f74[_0xdc16('0x2a')]);break;case _0xdc16('0x2c'):_0x50d974[_0xdc16('0x24')](_0x192f74['TagId']);_0x50d974[_0xdc16('0x24')](_0x192f74['appdata']);break;case _0xdc16('0x2d'):var _0x195811=utils[_0xdc16('0x2e')](_0xd7ff38['account']['notificationTemplate'],_0xd7ff38);var _0x55cfb2=_0x192f74['appdata'][_0xdc16('0x21')](',');_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x0]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x1]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x2]);_0x50d974['push'](_0x55cfb2[0x3]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x4]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x5]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x6]);_0x50d974['push'](_0x55cfb2[0x7]);_0x50d974['push'](_0x55cfb2[0x8]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x9]);_0x50d974['push'](_0x55cfb2[0xa]);_0x50d974[_0xdc16('0x24')](_0xd7ff38[_0xdc16('0x18')]['id']);_0x50d974[_0xdc16('0x24')](_0xd7ff38[_0xdc16('0x17')]['id']);_0x50d974[_0xdc16('0x24')](_0x192f74[_0xdc16('0x2f')]);_0x50d974[_0xdc16('0x24')](_0xd7ff38['interaction'][_0xdc16('0x30')]);_0x50d974['push'](_0xd7ff38['body'][_0xdc16('0x31')]);_0x50d974['push'](_0x195811);break;default:_0x50d974=_['isNil'](_0x192f74[_0xdc16('0x2a')])?[]:_0x192f74[_0xdc16('0x2a')][_0xdc16('0x21')](',');}var _0x177c30={'id':util[_0xdc16('0xf')](_0xdc16('0x32'),_0x396bed,_0x192f74['id'],_0x192f74[_0xdc16('0x1e')]),'condition':require('./interval')[_0xdc16('0x33')](_0x396bed,getIntervals(_0x50d023['intervals'],_0x192f74),_0x50d023),'consequence':require(_0xdc16('0x34')+_0x192f74['app'])['consequence'](_0x396bed,_0x50d974,_0x50d023,_0xd7ff38),'p':_0x192f74[_0xdc16('0x35')]||0x0};logger[_0xdc16('0x36')](_0xdc16('0x37'),_0x177c30['id'],_0xdc16('0x38'),getIntervals(_0x50d023[_0xdc16('0x39')],_0x192f74)[_0xdc16('0x26')](_0xdc16('0x3a')));_0x67b9b0['push'](_0x177c30);}else{logger['error'](_0xdc16('0x3b'),path[_0xdc16('0x26')](__dirname,_0xdc16('0x1b'),_0x192f74[_0xdc16('0x1e')]+_0xdc16('0x1d')));}}_0x50d023[_0xdc16('0x16')][_0x396bed]=new RuleEngine(_0x67b9b0);_0x50d023[_0xdc16('0x16')][_0x396bed][_0xdc16('0x3c')](_0xd7ff38,function(_0x1d9c7e){logger[_0xdc16('0x36')](_0xdc16('0x3d'),JSON[_0xdc16('0x3e')](_0x1d9c7e[_0xdc16('0x3f')]));if(_0x50d023[_0xdc16('0x16')][_0x396bed]){_0x50d023[_0xdc16('0x16')][_0x396bed][_0xdc16('0x40')]('complete');}});return _0x33d3e7({'code':0xc8,'message':_0xd7ff38});}else{if(_0x3bf134){logger[_0xdc16('0x36')](util['format']('Skipped\x20routing\x20for\x20%s',_0x396bed));}else{logger[_0xdc16('0x36')](_0xdc16('0x41'));}return _0x33d3e7({'code':0xc8,'message':_0xd7ff38});}}catch(_0x16ca3d){logger[_0xdc16('0x42')](_0x16ca3d[_0xdc16('0x43')]);return _0x13742b(_0x5a2b26[_0xdc16('0x42')](0x1f4,_0x16ca3d));}}return _0x13742b(_0xdc16('0x44'));});},'AcceptMessage':function(_0x3be11b){var _0x2752d4=this;return new Promise(function(_0x5c74b3,_0x3b48a5){if(_0x3be11b[_0xdc16('0x45')]&&_0x3be11b[_0xdc16('0x45')]['id']){if(_0x50d023[_0xdc16('0x46')][_0x3be11b[_0xdc16('0x45')]['id']]){_0x50d023[_0xdc16('0x46')][_0x3be11b[_0xdc16('0x45')]['id']]['busy']=![];_0x50d023[_0xdc16('0x46')][_0x3be11b[_0xdc16('0x45')]['id']][_0xdc16('0x47')]=undefined;}}if(_0x3be11b['message']&&_0x3be11b[_0xdc16('0x17')]['id']){try{var _0x215840=getId(_0x3be11b[_0xdc16('0x22')],_0x3be11b['message']?_0x3be11b[_0xdc16('0x17')]['id']:0x0,_0x3be11b[_0xdc16('0x18')]?_0x3be11b['interaction']['id']:0x0);if(_0x50d023[_0xdc16('0x16')][_0x215840]){_0x50d023['rules'][_0x215840][_0xdc16('0x40')](_0xdc16('0x48'));if(rpc[_0x3be11b[_0xdc16('0x22')]+_0xdc16('0x49')]){rpc[_0x3be11b[_0xdc16('0x22')]+_0xdc16('0x49')][_0xdc16('0x4a')](_0x215840,{'UserId':_0x3be11b[_0xdc16('0x17')][_0xdc16('0x4b')]})[_0xdc16('0x4c')](function(){logger[_0xdc16('0x42')](_0xdc16('0x4d'));});}}return _0x5c74b3({'code':0xc8,'message':_0x3be11b});}catch(_0x8e36b0){logger['error'](_0x8e36b0['stack']);return _0x3b48a5(_0x2752d4[_0xdc16('0x42')](0x1f4,_0x8e36b0));}}logger[_0xdc16('0x42')](_0xdc16('0x4e'));return _0x3b48a5(_0x2752d4[_0xdc16('0x42')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x566859){var _0x34486b=this;return new Promise(function(_0x547cb2,_0x1ca4c6){if(_0x566859[_0xdc16('0x45')]&&_0x566859['agent']['id']){try{if(_0x50d023[_0xdc16('0x46')][_0x566859[_0xdc16('0x45')]['id']]){_0x50d023[_0xdc16('0x46')][_0x566859['agent']['id']][_0xdc16('0x4f')]=![];_0x50d023[_0xdc16('0x46')][_0x566859['agent']['id']]['busyQueue']=undefined;}return _0x547cb2({'code':0xc8,'message':_0x566859});}catch(_0x2afc62){logger[_0xdc16('0x42')](_0x2afc62[_0xdc16('0x43')]);return _0x1ca4c6(_0x34486b[_0xdc16('0x42')](0x1f4,_0x2afc62));}}logger['error'](_0xdc16('0x4e'));return _0x1ca4c6(_0x34486b[_0xdc16('0x42')](0x1f4,_0xdc16('0x4e')));});},'AbandonInteraction':function(_0x4d5982){var _0x3fd969=this;return new Promise(function(_0x4ac056,_0x5a4d32){if(_0x4d5982['channel']&&_0x4d5982[_0xdc16('0x18')]&&_0x4d5982[_0xdc16('0x18')]['id']){try{var _0x525a38=getId(_0x4d5982[_0xdc16('0x22')],_0x4d5982['message']?_0x4d5982[_0xdc16('0x17')]['id']:0x0,_0x4d5982[_0xdc16('0x18')]?_0x4d5982[_0xdc16('0x18')]['id']:0x0);if(_0x50d023[_0xdc16('0x16')][_0x525a38]){_0x50d023[_0xdc16('0x16')][_0x525a38][_0xdc16('0x40')](_0xdc16('0x48'));}return _0x4ac056({'code':0xc8,'message':_0x4d5982});}catch(_0x2be044){logger[_0xdc16('0x42')](_0x2be044['stack']);return _0x5a4d32(_0x3fd969[_0xdc16('0x42')](0x1f4,_0x2be044));}}logger[_0xdc16('0x42')]('message\x20is\x20empty');return _0x5a4d32(_0x3fd969[_0xdc16('0x42')](0x1f4,_0xdc16('0x4e')));});},'AgentCapacity':function(_0x13efba){var _0x429dcc=this;return new Promise(function(_0x574ce2,_0x59369c){if(_0x50d023[_0xdc16('0x46')][_0xdc16('0x50')](_0x13efba['id'])){for(var _0x108cc0 in _0x13efba['capacity']){if(_0x13efba[_0xdc16('0x51')]['hasOwnProperty'](_0x108cc0)){if(_0x50d023[_0xdc16('0x46')][_0x13efba['id']][_0xdc16('0x50')](_0x108cc0+'CurrentCapacity')){_0x50d023['agents'][_0x13efba['id']][_0x108cc0+'CurrentCapacity']=parseInt(_0x13efba[_0xdc16('0x51')][_0x108cc0],0xa);}}}_0x50d023[_0xdc16('0x46')][_0x13efba['id']][_0xdc16('0x52')]();return _0x574ce2({'code':0xc8,'message':_0x50d023['agents'][_0x13efba['id']]});}else{return _0x59369c(_0x429dcc['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xff094c){return new Promise(function(_0x4a5ee0){var _0x5f0b0c=_['values'](_0x50d023[_0xdc16('0x46')]);if(_0xff094c&&_0xff094c['id']){var _0x31d406=_[_0xdc16('0x53')](_0x5f0b0c,function(_0x5dfe00){return _0x5dfe00['id']===_0xff094c['id'];});_0x4a5ee0(_0x31d406);}else{_0x4a5ee0({'count':_0x5f0b0c[_0xdc16('0x25')],'rows':_0x5f0b0c});}});},'ChatQueues':function(){return new Promise(function(_0xa05a59){var _0x5d7a1b=[];for(var _0x198702 in _0x50d023['chatQueues']){if(_0x50d023[_0xdc16('0x54')][_0xdc16('0x50')](_0x198702)){var _0x1d1ade=_0x50d023['chatQueues'][_0x198702];var _0x103da2={'id':_0x1d1ade['id'],'available':_0x1d1ade['available'],'loggedIn':_0x1d1ade[_0xdc16('0x55')],'name':_0x1d1ade[_0xdc16('0x56')],'paused':_0x1d1ade[_0xdc16('0x57')],'waiting':_0x1d1ade['waiting']};_0x5d7a1b[_0xdc16('0x24')](_0x103da2);}}_0xa05a59({'count':_0x5d7a1b[_0xdc16('0x25')],'rows':_0x5d7a1b});});},'MailQueues':function(){return new Promise(function(_0x25f2ea){var _0x581680=[];for(var _0x3bd55f in _0x50d023[_0xdc16('0x58')]){if(_0x50d023['mailQueues'][_0xdc16('0x50')](_0x3bd55f)){var _0x4c8cef=_0x50d023['mailQueues'][_0x3bd55f];var _0xe09ab6={'id':_0x4c8cef['id'],'available':_0x4c8cef['available'],'loggedIn':_0x4c8cef['loggedIn'],'name':_0x4c8cef[_0xdc16('0x56')],'paused':_0x4c8cef[_0xdc16('0x57')],'waiting':_0x4c8cef[_0xdc16('0x59')]};_0x581680[_0xdc16('0x24')](_0xe09ab6);}}_0x25f2ea({'count':_0x581680[_0xdc16('0x25')],'rows':_0x581680});});},'OpenchannelQueues':function(){return new Promise(function(_0x353e5f){var _0x310782=[];for(var _0x3c2004 in _0x50d023[_0xdc16('0x5a')]){if(_0x50d023['openchannelQueues'][_0xdc16('0x50')](_0x3c2004)){var _0xcf9b91=_0x50d023[_0xdc16('0x5a')][_0x3c2004];var _0x52936d={'id':_0xcf9b91['id'],'available':_0xcf9b91[_0xdc16('0x5b')],'loggedIn':_0xcf9b91['loggedIn'],'name':_0xcf9b91[_0xdc16('0x56')],'paused':_0xcf9b91[_0xdc16('0x57')],'waiting':_0xcf9b91['waiting']};_0x310782[_0xdc16('0x24')](_0x52936d);}}_0x353e5f({'count':_0x310782['length'],'rows':_0x310782});});},'SmsQueues':function(){return new Promise(function(_0x59d40a){var _0x1abfff=[];for(var _0x5b903e in _0x50d023[_0xdc16('0x5c')]){if(_0x50d023[_0xdc16('0x5c')][_0xdc16('0x50')](_0x5b903e)){var _0xca7bf=_0x50d023[_0xdc16('0x5c')][_0x5b903e];var _0x196c64={'id':_0xca7bf['id'],'available':_0xca7bf[_0xdc16('0x5b')],'loggedIn':_0xca7bf[_0xdc16('0x55')],'name':_0xca7bf[_0xdc16('0x56')],'paused':_0xca7bf['paused'],'waiting':_0xca7bf[_0xdc16('0x59')]};_0x1abfff[_0xdc16('0x24')](_0x196c64);}}_0x59d40a({'count':_0x1abfff[_0xdc16('0x25')],'rows':_0x1abfff});});},'FaxQueues':function(){return new Promise(function(_0x437e01){var _0x2616ee=[];for(var _0x15cd22 in _0x50d023[_0xdc16('0x5d')]){if(_0x50d023[_0xdc16('0x5d')][_0xdc16('0x50')](_0x15cd22)){var _0x1ae0d9=_0x50d023[_0xdc16('0x5d')][_0x15cd22];var _0x3e3ea0={'id':_0x1ae0d9['id'],'available':_0x1ae0d9[_0xdc16('0x5b')],'loggedIn':_0x1ae0d9[_0xdc16('0x55')],'name':_0x1ae0d9['name'],'paused':_0x1ae0d9[_0xdc16('0x57')],'waiting':_0x1ae0d9[_0xdc16('0x59')]};_0x2616ee['push'](_0x3e3ea0);}}_0x437e01({'count':_0x2616ee[_0xdc16('0x25')],'rows':_0x2616ee});});},'WhatsappQueues':function(){return new Promise(function(_0x31f744){var _0x1fa2af=[];for(var _0xe558f4 in _0x50d023['whatsappQueues']){if(_0x50d023[_0xdc16('0x5e')][_0xdc16('0x50')](_0xe558f4)){var _0x4231f7=_0x50d023[_0xdc16('0x5e')][_0xe558f4];var _0x2ddc92={'id':_0x4231f7['id'],'available':_0x4231f7['available'],'loggedIn':_0x4231f7[_0xdc16('0x55')],'name':_0x4231f7[_0xdc16('0x56')],'paused':_0x4231f7['paused'],'waiting':_0x4231f7[_0xdc16('0x59')]};_0x1fa2af[_0xdc16('0x24')](_0x2ddc92);}}_0x31f744({'count':_0x1fa2af['length'],'rows':_0x1fa2af});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2fdd17){var _0x2f7562=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x60')]);_0x2fdd17({'count':_0x2f7562['length'],'rows':_0x2f7562});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1d6431){var _0x3144d0=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x61')]);_0x1d6431({'count':_0x3144d0[_0xdc16('0x25')],'rows':_0x3144d0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1c08c1){var _0x3e511a=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x62')]);_0x1c08c1({'count':_0x3e511a['length'],'rows':_0x3e511a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1da234){var _0x2eb600=_['values'](_0x50d023[_0xdc16('0x63')]);_0x1da234({'count':_0x2eb600[_0xdc16('0x25')],'rows':_0x2eb600});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5f4d1b){var _0x4232f5=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x64')]);_0x5f4d1b({'count':_0x4232f5['length'],'rows':_0x4232f5});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x40d199){var _0x58e345=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x65')]);_0x40d199({'count':_0x58e345['length'],'rows':_0x58e345});});}};var _0x44c503=jayson[_0xdc16('0x66')](_0x5677a4)[_0xdc16('0x67')]();_0x44c503['on'](_0xdc16('0x42'),function(_0x16fb5b){logger[_0xdc16('0x42')](JSON['stringify'](_0x16fb5b));return _0x1a9f4f(_0x16fb5b);});_0x44c503[_0xdc16('0x15')](0x232c,_0xdc16('0x68'),function(){console['log'](_0xdc16('0x69'),0x232c);return _0x42b482(_0xdc16('0x6a')+0x232c);});});}; \ No newline at end of file +var _0x31b5=['updateRealtime','agent\x20not\x20found','find','chatQueues','available','name','paused','mailQueues','loggedIn','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','interaction','checkWaitingNotifications','transfer','isArray','applications','length','app','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','message','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','.js','execute','Applications\x20executed','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','capacity','hasOwnProperty','CurrentCapacity'];(function(_0x16dcbd,_0x1f2ab6){var _0x1b03ee=function(_0x4adfee){while(--_0x4adfee){_0x16dcbd['push'](_0x16dcbd['shift']());}};_0x1b03ee(++_0x1f2ab6);}(_0x31b5,0x159));var _0x531b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x31b5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x531b('0x0'));var util=require(_0x531b('0x1'));var path=require(_0x531b('0x2'));var fs=require('fs');var jayson=require(_0x531b('0x3'));var BPromise=require(_0x531b('0x4'));var utils=require(_0x531b('0x5'));var sUtils=require('./applications/strategy/util');var logger=require(_0x531b('0x6'))(_0x531b('0x7'));var rpc={'openchannelQueueReport':require(_0x531b('0x8')),'mailQueueReport':require(_0x531b('0x9')),'chatQueueReport':require(_0x531b('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x531b('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x531b('0xc'));function getId(_0x513a12,_0x3c4230,_0x353a64){return util[_0x531b('0xd')](_0x531b('0xe'),_0x513a12,_0x3c4230||0x0,_0x353a64||0x0);}function getIntervals(_0x442a35,_0x5bf8e1){var _0x5a1479=[];if(!_[_0x531b('0xf')](_0x5bf8e1['IntervalId'])&&!_[_0x531b('0xf')](_0x442a35[_0x5bf8e1['IntervalId']])&&!_['isNil'](_0x442a35[_0x5bf8e1[_0x531b('0x10')]][_0x531b('0x11')])){_0x5a1479=_[_0x531b('0x12')](_0x442a35[_0x5bf8e1[_0x531b('0x10')]][_0x531b('0x11')],_0x531b('0x13'));}else if(!_[_0x531b('0xf')](_0x5bf8e1['interval'])){_0x5a1479=[_0x5bf8e1[_0x531b('0x13')]];}return _0x5a1479;}exports['listen']=function(_0x3d7155){_0x3d7155[_0x531b('0x14')]={};return new BPromise(function(_0x55129f,_0x184149){var _0x1f63b3={'Start':function(_0x26512d){var _0x535c1b=this;return new Promise(function(_0x5500e1,_0x2c8924){if(_0x26512d){try{var _0x3b56eb=[];var _0x467c70=getId(_0x26512d[_0x531b('0x15')],_0x26512d['message']?_0x26512d['message']['id']:0x0,_0x26512d['interaction']?_0x26512d[_0x531b('0x16')]['id']:0x0);var _0x1c1165=sUtils[_0x531b('0x17')](_0x3d7155,_0x26512d);if(_0x26512d[_0x531b('0x18')]||!_0x1c1165&&_0x26512d['applications']&&_[_0x531b('0x19')](_0x26512d[_0x531b('0x1a')])&&_0x26512d[_0x531b('0x1a')]['length']){for(var _0xf48f45=0x0;_0xf48f45<_0x26512d[_0x531b('0x1a')][_0x531b('0x1b')];_0xf48f45+=0x1){var _0x30aab9=_0x26512d[_0x531b('0x1a')][_0xf48f45];if(fs['existsSync'](path['join'](__dirname,_0x531b('0x1a'),_0x30aab9[_0x531b('0x1c')]+'.js'))){var _0x24f438=[];switch(_0x30aab9[_0x531b('0x1c')][_0x531b('0x1d')]()){case _0x531b('0x1e'):var _0x4ec527=_0x30aab9[_0x531b('0x1f')][_0x531b('0x20')](',');if(_0x26512d[_0x531b('0x15')]===_0x531b('0x21')){_0x24f438['push'](_0x4ec527[0x0]);_0x24f438[_0x531b('0x22')](_0x4ec527[0x1]);_0x24f438[_0x531b('0x22')](_0x4ec527[_0x531b('0x23')](0x2,_0x4ec527[_0x531b('0x1b')])[_0x531b('0x24')](','));}else{_0x24f438[_0x531b('0x22')](_0x4ec527[0x0]);_0x24f438[_0x531b('0x22')](_0x4ec527[_0x531b('0x23')](0x1,_0x4ec527['length'])[_0x531b('0x24')](','));}break;case _0x531b('0x25'):var _0x2a631c=_0x30aab9[_0x531b('0x1f')][_0x531b('0x20')](',');_0x24f438[_0x531b('0x22')](_0x2a631c[0x0]);_0x24f438[_0x531b('0x22')](_0x2a631c[0x1]);_0x24f438['push'](_0x2a631c[_0x531b('0x23')](0x2,_0x2a631c[_0x531b('0x1b')])[_0x531b('0x24')](','));break;case'dialogflowv2':var _0x55a437=_0x30aab9['appdata']['split'](',');_0x24f438['push'](_0x55a437[0x0]);_0x24f438['push'](_0x55a437[0x1]);_0x24f438[_0x531b('0x22')](_0x55a437[0x2]);_0x24f438[_0x531b('0x22')](_0x55a437[0x3]);_0x24f438['push'](_0x55a437[_0x531b('0x23')](0x4,_0x55a437[_0x531b('0x1b')])[_0x531b('0x24')](','));break;case'amazonlex':var _0x453db2=_0x30aab9['appdata']['split'](',');_0x24f438[_0x531b('0x22')](_0x453db2[0x0]);_0x24f438[_0x531b('0x22')](_0x453db2[0x1]);_0x24f438[_0x531b('0x22')](_0x453db2[0x2]);_0x24f438[_0x531b('0x22')](_0x453db2[0x3]);_0x24f438['push'](_0x453db2['slice'](0x4,_0x453db2[_0x531b('0x1b')])['join'](','));break;case _0x531b('0x26'):_0x24f438[_0x531b('0x22')](_0x30aab9[_0x531b('0x1f')]);break;case _0x531b('0x27'):_0x24f438[_0x531b('0x22')](_0x30aab9[_0x531b('0x28')]);_0x24f438[_0x531b('0x22')](_0x30aab9[_0x531b('0x1f')]);break;case _0x531b('0x29'):var _0x583897=utils[_0x531b('0x2a')](_0x26512d[_0x531b('0x2b')][_0x531b('0x2c')],_0x26512d);var _0x1c1017=_0x30aab9[_0x531b('0x1f')][_0x531b('0x20')](',');_0x24f438['push'](_0x1c1017[0x0]);_0x24f438['push'](_0x1c1017[0x1]);_0x24f438[_0x531b('0x22')](_0x1c1017[0x2]);_0x24f438[_0x531b('0x22')](_0x1c1017[0x3]);_0x24f438[_0x531b('0x22')](_0x1c1017[0x4]);_0x24f438['push'](_0x1c1017[0x5]);_0x24f438[_0x531b('0x22')](_0x1c1017[0x6]);_0x24f438['push'](_0x1c1017[0x7]);_0x24f438[_0x531b('0x22')](_0x1c1017[0x8]);_0x24f438[_0x531b('0x22')](_0x1c1017[0x9]);_0x24f438[_0x531b('0x22')](_0x1c1017[0xa]);_0x24f438[_0x531b('0x22')](_0x26512d[_0x531b('0x16')]['id']);_0x24f438[_0x531b('0x22')](_0x26512d[_0x531b('0x26')]['id']);_0x24f438[_0x531b('0x22')](_0x30aab9['ChatWebsiteId']);_0x24f438[_0x531b('0x22')](_0x26512d['interaction'][_0x531b('0x2d')]);_0x24f438[_0x531b('0x22')](_0x26512d[_0x531b('0x2e')][_0x531b('0x2e')]);_0x24f438['push'](_0x583897);break;default:_0x24f438=_[_0x531b('0xf')](_0x30aab9[_0x531b('0x1f')])?[]:_0x30aab9[_0x531b('0x1f')][_0x531b('0x20')](',');}var _0x4ab0e8={'id':util[_0x531b('0xd')]('%s:%s:%s',_0x467c70,_0x30aab9['id'],_0x30aab9[_0x531b('0x1c')]),'condition':require(_0x531b('0x2f'))['condition'](_0x467c70,getIntervals(_0x3d7155[_0x531b('0x30')],_0x30aab9),_0x3d7155),'consequence':require(_0x531b('0x31')+_0x30aab9[_0x531b('0x1c')])[_0x531b('0x32')](_0x467c70,_0x24f438,_0x3d7155,_0x26512d),'p':_0x30aab9[_0x531b('0x33')]||0x0};logger[_0x531b('0x34')](_0x531b('0x35'),_0x4ab0e8['id'],_0x531b('0x36'),getIntervals(_0x3d7155[_0x531b('0x30')],_0x30aab9)[_0x531b('0x24')](_0x531b('0x37')));_0x3b56eb['push'](_0x4ab0e8);}else{logger[_0x531b('0x38')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x531b('0x24')](__dirname,_0x531b('0x1a'),_0x30aab9['app']+_0x531b('0x39')));}}_0x3d7155[_0x531b('0x14')][_0x467c70]=new RuleEngine(_0x3b56eb);_0x3d7155[_0x531b('0x14')][_0x467c70][_0x531b('0x3a')](_0x26512d,function(_0x19eacd){logger['info'](_0x531b('0x3b'),JSON['stringify'](_0x19eacd[_0x531b('0x3c')]));if(_0x3d7155['rules'][_0x467c70]){_0x3d7155[_0x531b('0x14')][_0x467c70]['emit'](_0x531b('0x3d'));}});return _0x5500e1({'code':0xc8,'message':_0x26512d});}else{if(_0x1c1165){logger[_0x531b('0x34')](util['format']('Skipped\x20routing\x20for\x20%s',_0x467c70));}else{logger[_0x531b('0x34')](_0x531b('0x3e'));}return _0x5500e1({'code':0xc8,'message':_0x26512d});}}catch(_0x598eb9){logger[_0x531b('0x38')](_0x598eb9[_0x531b('0x3f')]);return _0x2c8924(_0x535c1b[_0x531b('0x38')](0x1f4,_0x598eb9));}}return _0x2c8924(_0x531b('0x40'));});},'AcceptMessage':function(_0x5d4f6d){var _0x302d16=this;return new Promise(function(_0x375bcf,_0x566dba){if(_0x5d4f6d[_0x531b('0x41')]&&_0x5d4f6d['agent']['id']){if(_0x3d7155[_0x531b('0x42')][_0x5d4f6d[_0x531b('0x41')]['id']]){_0x3d7155[_0x531b('0x42')][_0x5d4f6d['agent']['id']][_0x531b('0x43')]=![];_0x3d7155['agents'][_0x5d4f6d['agent']['id']]['busyQueue']=undefined;}}if(_0x5d4f6d[_0x531b('0x26')]&&_0x5d4f6d[_0x531b('0x26')]['id']){try{var _0x18011f=getId(_0x5d4f6d[_0x531b('0x15')],_0x5d4f6d['message']?_0x5d4f6d['message']['id']:0x0,_0x5d4f6d['interaction']?_0x5d4f6d[_0x531b('0x16')]['id']:0x0);if(_0x3d7155[_0x531b('0x14')][_0x18011f]){_0x3d7155['rules'][_0x18011f][_0x531b('0x44')]('end');if(rpc[_0x5d4f6d[_0x531b('0x15')]+_0x531b('0x45')]){rpc[_0x5d4f6d[_0x531b('0x15')]+_0x531b('0x45')][_0x531b('0x46')](_0x18011f,{'UserId':_0x5d4f6d[_0x531b('0x26')][_0x531b('0x47')]})[_0x531b('0x48')](function(){logger[_0x531b('0x38')](_0x531b('0x49'));});}}return _0x375bcf({'code':0xc8,'message':_0x5d4f6d});}catch(_0x20b0e5){logger[_0x531b('0x38')](_0x20b0e5[_0x531b('0x3f')]);return _0x566dba(_0x302d16[_0x531b('0x38')](0x1f4,_0x20b0e5));}}logger[_0x531b('0x38')]('message\x20is\x20empty');return _0x566dba(_0x302d16[_0x531b('0x38')](0x1f4,_0x531b('0x4a')));});},'RejectMessage':function(_0x563e74){var _0x36975f=this;return new Promise(function(_0x401067,_0x4948da){if(_0x563e74[_0x531b('0x41')]&&_0x563e74['agent']['id']){try{if(_0x3d7155[_0x531b('0x42')][_0x563e74['agent']['id']]){_0x3d7155['agents'][_0x563e74['agent']['id']][_0x531b('0x43')]=![];_0x3d7155[_0x531b('0x42')][_0x563e74[_0x531b('0x41')]['id']][_0x531b('0x4b')]=undefined;}return _0x401067({'code':0xc8,'message':_0x563e74});}catch(_0x9e6b5a){logger['error'](_0x9e6b5a[_0x531b('0x3f')]);return _0x4948da(_0x36975f[_0x531b('0x38')](0x1f4,_0x9e6b5a));}}logger['error'](_0x531b('0x4a'));return _0x4948da(_0x36975f[_0x531b('0x38')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3802c2){var _0x1e4b31=this;return new Promise(function(_0x10c19c,_0x3d75d9){if(_0x3802c2[_0x531b('0x15')]&&_0x3802c2[_0x531b('0x16')]&&_0x3802c2[_0x531b('0x16')]['id']){try{var _0xf57bf9=getId(_0x3802c2[_0x531b('0x15')],_0x3802c2[_0x531b('0x26')]?_0x3802c2[_0x531b('0x26')]['id']:0x0,_0x3802c2[_0x531b('0x16')]?_0x3802c2[_0x531b('0x16')]['id']:0x0);if(_0x3d7155['rules'][_0xf57bf9]){_0x3d7155[_0x531b('0x14')][_0xf57bf9]['emit']('end');}return _0x10c19c({'code':0xc8,'message':_0x3802c2});}catch(_0x298eed){logger[_0x531b('0x38')](_0x298eed['stack']);return _0x3d75d9(_0x1e4b31[_0x531b('0x38')](0x1f4,_0x298eed));}}logger[_0x531b('0x38')]('message\x20is\x20empty');return _0x3d75d9(_0x1e4b31[_0x531b('0x38')](0x1f4,_0x531b('0x4a')));});},'AgentCapacity':function(_0x34fb3f){var _0x243494=this;return new Promise(function(_0x363fb9,_0x433822){if(_0x3d7155[_0x531b('0x42')]['hasOwnProperty'](_0x34fb3f['id'])){for(var _0x37446c in _0x34fb3f[_0x531b('0x4c')]){if(_0x34fb3f['capacity'][_0x531b('0x4d')](_0x37446c)){if(_0x3d7155[_0x531b('0x42')][_0x34fb3f['id']]['hasOwnProperty'](_0x37446c+_0x531b('0x4e'))){_0x3d7155['agents'][_0x34fb3f['id']][_0x37446c+_0x531b('0x4e')]=parseInt(_0x34fb3f[_0x531b('0x4c')][_0x37446c],0xa);}}}_0x3d7155[_0x531b('0x42')][_0x34fb3f['id']][_0x531b('0x4f')]();return _0x363fb9({'code':0xc8,'message':_0x3d7155['agents'][_0x34fb3f['id']]});}else{return _0x433822(_0x243494[_0x531b('0x38')](0x1f4,_0x531b('0x50')));}});},'Agents':function(_0x4a4fe0){return new Promise(function(_0x5a3c06){var _0x225f65=_['values'](_0x3d7155[_0x531b('0x42')]);if(_0x4a4fe0&&_0x4a4fe0['id']){var _0x5dd4b3=_[_0x531b('0x51')](_0x225f65,function(_0x16d56d){return _0x16d56d['id']===_0x4a4fe0['id'];});_0x5a3c06(_0x5dd4b3);}else{_0x5a3c06({'count':_0x225f65[_0x531b('0x1b')],'rows':_0x225f65});}});},'ChatQueues':function(){return new Promise(function(_0x1774da){var _0x295796=[];for(var _0xaf5fae in _0x3d7155[_0x531b('0x52')]){if(_0x3d7155[_0x531b('0x52')][_0x531b('0x4d')](_0xaf5fae)){var _0x492e0e=_0x3d7155[_0x531b('0x52')][_0xaf5fae];var _0x26bd6d={'id':_0x492e0e['id'],'available':_0x492e0e[_0x531b('0x53')],'loggedIn':_0x492e0e['loggedIn'],'name':_0x492e0e[_0x531b('0x54')],'paused':_0x492e0e[_0x531b('0x55')],'waiting':_0x492e0e['waiting']};_0x295796[_0x531b('0x22')](_0x26bd6d);}}_0x1774da({'count':_0x295796[_0x531b('0x1b')],'rows':_0x295796});});},'MailQueues':function(){return new Promise(function(_0xfb4496){var _0xb91b85=[];for(var _0x1873dc in _0x3d7155['mailQueues']){if(_0x3d7155[_0x531b('0x56')][_0x531b('0x4d')](_0x1873dc)){var _0x5163de=_0x3d7155[_0x531b('0x56')][_0x1873dc];var _0x48537c={'id':_0x5163de['id'],'available':_0x5163de[_0x531b('0x53')],'loggedIn':_0x5163de[_0x531b('0x57')],'name':_0x5163de[_0x531b('0x54')],'paused':_0x5163de[_0x531b('0x55')],'waiting':_0x5163de['waiting']};_0xb91b85[_0x531b('0x22')](_0x48537c);}}_0xfb4496({'count':_0xb91b85[_0x531b('0x1b')],'rows':_0xb91b85});});},'OpenchannelQueues':function(){return new Promise(function(_0x53dff5){var _0xd43616=[];for(var _0x4387ce in _0x3d7155['openchannelQueues']){if(_0x3d7155[_0x531b('0x58')][_0x531b('0x4d')](_0x4387ce)){var _0x5191cd=_0x3d7155['openchannelQueues'][_0x4387ce];var _0xad29a8={'id':_0x5191cd['id'],'available':_0x5191cd[_0x531b('0x53')],'loggedIn':_0x5191cd[_0x531b('0x57')],'name':_0x5191cd[_0x531b('0x54')],'paused':_0x5191cd[_0x531b('0x55')],'waiting':_0x5191cd[_0x531b('0x59')]};_0xd43616['push'](_0xad29a8);}}_0x53dff5({'count':_0xd43616[_0x531b('0x1b')],'rows':_0xd43616});});},'SmsQueues':function(){return new Promise(function(_0x5de89c){var _0x1ebde4=[];for(var _0x3ffeb2 in _0x3d7155['smsQueues']){if(_0x3d7155[_0x531b('0x5a')][_0x531b('0x4d')](_0x3ffeb2)){var _0x77fbad=_0x3d7155[_0x531b('0x5a')][_0x3ffeb2];var _0x37ff7e={'id':_0x77fbad['id'],'available':_0x77fbad[_0x531b('0x53')],'loggedIn':_0x77fbad[_0x531b('0x57')],'name':_0x77fbad['name'],'paused':_0x77fbad[_0x531b('0x55')],'waiting':_0x77fbad[_0x531b('0x59')]};_0x1ebde4[_0x531b('0x22')](_0x37ff7e);}}_0x5de89c({'count':_0x1ebde4[_0x531b('0x1b')],'rows':_0x1ebde4});});},'FaxQueues':function(){return new Promise(function(_0x49750d){var _0x495179=[];for(var _0x1e8144 in _0x3d7155[_0x531b('0x5b')]){if(_0x3d7155[_0x531b('0x5b')][_0x531b('0x4d')](_0x1e8144)){var _0x30f782=_0x3d7155['faxQueues'][_0x1e8144];var _0x1395eb={'id':_0x30f782['id'],'available':_0x30f782[_0x531b('0x53')],'loggedIn':_0x30f782['loggedIn'],'name':_0x30f782[_0x531b('0x54')],'paused':_0x30f782[_0x531b('0x55')],'waiting':_0x30f782[_0x531b('0x59')]};_0x495179[_0x531b('0x22')](_0x1395eb);}}_0x49750d({'count':_0x495179[_0x531b('0x1b')],'rows':_0x495179});});},'WhatsappQueues':function(){return new Promise(function(_0x22aa24){var _0x2215b6=[];for(var _0x19b206 in _0x3d7155['whatsappQueues']){if(_0x3d7155['whatsappQueues'][_0x531b('0x4d')](_0x19b206)){var _0x4ab5fa=_0x3d7155[_0x531b('0x5c')][_0x19b206];var _0x2588df={'id':_0x4ab5fa['id'],'available':_0x4ab5fa[_0x531b('0x53')],'loggedIn':_0x4ab5fa[_0x531b('0x57')],'name':_0x4ab5fa[_0x531b('0x54')],'paused':_0x4ab5fa[_0x531b('0x55')],'waiting':_0x4ab5fa[_0x531b('0x59')]};_0x2215b6[_0x531b('0x22')](_0x2588df);}}_0x22aa24({'count':_0x2215b6[_0x531b('0x1b')],'rows':_0x2215b6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4f80ec){var _0x5a73d5=_[_0x531b('0x5d')](_0x3d7155[_0x531b('0x5e')]);_0x4f80ec({'count':_0x5a73d5[_0x531b('0x1b')],'rows':_0x5a73d5});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5f80d1){var _0x28a27a=_['values'](_0x3d7155[_0x531b('0x5f')]);_0x5f80d1({'count':_0x28a27a[_0x531b('0x1b')],'rows':_0x28a27a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x43e6ff){var _0x25ed58=_[_0x531b('0x5d')](_0x3d7155[_0x531b('0x60')]);_0x43e6ff({'count':_0x25ed58[_0x531b('0x1b')],'rows':_0x25ed58});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5c1cf1){var _0x2bf022=_[_0x531b('0x5d')](_0x3d7155[_0x531b('0x61')]);_0x5c1cf1({'count':_0x2bf022[_0x531b('0x1b')],'rows':_0x2bf022});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x51ba77){var _0x53065a=_[_0x531b('0x5d')](_0x3d7155[_0x531b('0x62')]);_0x51ba77({'count':_0x53065a[_0x531b('0x1b')],'rows':_0x53065a});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x58f300){var _0x1b8e5d=_[_0x531b('0x5d')](_0x3d7155[_0x531b('0x63')]);_0x58f300({'count':_0x1b8e5d[_0x531b('0x1b')],'rows':_0x1b8e5d});});}};var _0x3d68f4=jayson[_0x531b('0x64')](_0x1f63b3)[_0x531b('0x65')]();_0x3d68f4['on']('error',function(_0x1b7f01){logger[_0x531b('0x38')](JSON['stringify'](_0x1b7f01));return _0x184149(_0x1b7f01);});_0x3d68f4['listen'](0x232c,_0x531b('0x66'),function(){console[_0x531b('0x67')](_0x531b('0x68'),0x232c);return _0x55129f(_0x531b('0x69')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d8a6521..d7f0f60 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 _0x8667=['../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stop','util','bluebird','jayson/promise','lodash'];(function(_0xfe70ca,_0x331c02){var _0x2fa44e=function(_0x262695){while(--_0x262695){_0xfe70ca['push'](_0xfe70ca['shift']());}};_0x2fa44e(++_0x331c02);}(_0x8667,0xf4));var _0x7866=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8667[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x7866('0x0'));var BPromise=require(_0x7866('0x1'));var jayson=require(_0x7866('0x2'));var _=require(_0x7866('0x3'));var logger=require(_0x7866('0x4'))(_0x7866('0x5'));var client=jayson[_0x7866('0x6')][_0x7866('0x7')]({'port':0x232a});function request(_0x36f7b0,_0x39ff39){return new BPromise(function(_0x193554,_0x2842e1){return client[_0x7866('0x8')](_0x36f7b0,_0x39ff39)[_0x7866('0x9')](function(_0x19ebd4){if(_0x19ebd4[_0x7866('0xa')]){return _0x2842e1(_0x19ebd4[_0x7866('0xa')][_0x7866('0xb')]);}else{return _0x193554(_0x19ebd4[_0x7866('0xc')]);}})[_0x7866('0xd')](function(_0x2cf41a){return _0x2842e1(_0x2cf41a);});});}exports[_0x7866('0xe')]=function(_0x7ecf02,_0x5945af,_0x2a108f){return function(_0x5a1442){if(_0x2a108f[_0x7866('0xf')]&&!_0x2a108f[_0x7866('0xf')][_0x7ecf02]){logger[_0x7866('0x10')](_0x7866('0x11'),_0x7ecf02);return _0x5a1442['stop']();}var _0x330a2c=[];for(var _0x406c84=0x0;_0x406c84<_0x5945af['length'];_0x406c84+=0x1){_0x330a2c[_0x7866('0x12')](request(_0x7866('0x13'),{'command':util[_0x7866('0x14')](_0x7866('0x15'),_0x5945af[_0x406c84])})['then'](function(_0x42b940){return _0x42b940&&_0x42b940[_0x7866('0xb')]&&_0x42b940[_0x7866('0xb')]['indexOf'](_0x7866('0x16'))>=0x0?!![]:![];})[_0x7866('0xd')](function(){logger['error'](_0x7866('0x17'),_0x7ecf02,_0x5945af[_0x406c84]);}));}BPromise[_0x7866('0x18')](_0x330a2c)[_0x7866('0x9')](function(_0x15186f){var _0x3dd0db=_[_0x7866('0x19')](_0x15186f);logger[_0x7866('0x10')](_0x7866('0x1a'),_0x7ecf02,_0x5945af[_0x7866('0x1b')](_0x7866('0x1c')),_0x3dd0db);_0x5a1442[_0x7866('0x1d')](_0x3dd0db);})['catch'](function(_0x156aa9){logger[_0x7866('0xa')](_0x7866('0x1a'),_0x7ecf02,_0x5945af[_0x7866('0x1b')](_0x7866('0x1c')),_0x156aa9['stack']);_0x5a1442[_0x7866('0x1e')]();});};}; \ No newline at end of file +var _0x1c7f=['jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack'];(function(_0x5a0c55,_0x1182cc){var _0x410d99=function(_0x1c4fa4){while(--_0x1c4fa4){_0x5a0c55['push'](_0x5a0c55['shift']());}};_0x410d99(++_0x1182cc);}(_0x1c7f,0x1e0));var _0xf1c7=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x1c7f[_0x480bc8];return _0x28c245;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xf1c7('0x0'));var _=require('lodash');var logger=require(_0xf1c7('0x1'))(_0xf1c7('0x2'));var client=jayson[_0xf1c7('0x3')][_0xf1c7('0x4')]({'port':0x232a});function request(_0x2624f8,_0x2a3be1){return new BPromise(function(_0x5b5c9f,_0x2541eb){return client[_0xf1c7('0x5')](_0x2624f8,_0x2a3be1)[_0xf1c7('0x6')](function(_0x293bf5){if(_0x293bf5[_0xf1c7('0x7')]){return _0x2541eb(_0x293bf5[_0xf1c7('0x7')][_0xf1c7('0x8')]);}else{return _0x5b5c9f(_0x293bf5[_0xf1c7('0x9')]);}})[_0xf1c7('0xa')](function(_0xc98d3f){return _0x2541eb(_0xc98d3f);});});}exports[_0xf1c7('0xb')]=function(_0x480ae4,_0x42828e,_0x41c0c0){return function(_0x42150e){if(_0x41c0c0[_0xf1c7('0xc')]&&!_0x41c0c0[_0xf1c7('0xc')][_0x480ae4]){logger[_0xf1c7('0xd')](_0xf1c7('0xe'),_0x480ae4);return _0x42150e[_0xf1c7('0xf')]();}var _0x4b3c13=[];for(var _0x44ede6=0x0;_0x44ede6<_0x42828e['length'];_0x44ede6+=0x1){_0x4b3c13[_0xf1c7('0x10')](request(_0xf1c7('0x11'),{'command':util[_0xf1c7('0x12')](_0xf1c7('0x13'),_0x42828e[_0x44ede6])})[_0xf1c7('0x6')](function(_0xb56f49){return _0xb56f49&&_0xb56f49[_0xf1c7('0x8')]&&_0xb56f49[_0xf1c7('0x8')][_0xf1c7('0x14')](_0xf1c7('0x15'))>=0x0?!![]:![];})[_0xf1c7('0xa')](function(){logger[_0xf1c7('0x7')](_0xf1c7('0x16'),_0x480ae4,_0x42828e[_0x44ede6]);}));}BPromise[_0xf1c7('0x17')](_0x4b3c13)[_0xf1c7('0x6')](function(_0x3c42bd){var _0x463fbc=_[_0xf1c7('0x18')](_0x3c42bd);logger[_0xf1c7('0xd')](_0xf1c7('0x19'),_0x480ae4,_0x42828e[_0xf1c7('0x1a')]('\x20|\x20'),_0x463fbc);_0x42150e[_0xf1c7('0x1b')](_0x463fbc);})[_0xf1c7('0xa')](function(_0x3aed0f){logger[_0xf1c7('0x7')](_0xf1c7('0x19'),_0x480ae4,_0x42828e[_0xf1c7('0x1a')](_0xf1c7('0x1c')),_0x3aed0f[_0xf1c7('0x1d')]);_0x42150e['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 5afcf29..b406ee2 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 _0x2e54=['connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','error','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2c330e,_0x527a5e){_0x2c330e=_0x2c330e-0x0;var _0x496a48=_0x2e54[_0x2c330e];return _0x496a48;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x216de4,_0x23f008){utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x3'),_0x216de4[_0x42e5('0x4')],_0x216de4[_0x42e5('0x5')],_0x216de4['queue'],_0x216de4[_0x42e5('0x6')],_0x216de4[_0x42e5('0x7')],_0x216de4[_0x42e5('0x8')],_0x216de4['connectedlinenum'],_0x216de4[_0x42e5('0x9')]));if(_0x216de4['queue']){utils[_0x42e5('0xa')](_0x216de4['queue'])[_0x42e5('0xb')](function(_0x224b11){if(_0x224b11){_0x216de4[_0x42e5('0xc')]=_0x224b11[_0x42e5('0xc')];_0x216de4[_0x42e5('0xd')]=_0x216de4[_0x42e5('0xe')]?_0x224b11[_0x42e5('0xf')]:![];_0x216de4[_0x42e5('0x10')]=_0x216de4[_0x42e5('0xd')]?_0x224b11['acwTimeout']:0x0;}utils[_0x42e5('0x11')](_0x42e5('0x12'),_0x216de4);});}else{utils['request'](_0x42e5('0x12'),_0x216de4);}if(_0x23f008){delete transfers[_0x216de4[_0x42e5('0x4')]];}else{delete agents[_0x216de4[_0x42e5('0x13')]];}}exports[_0x42e5('0x14')]=function(_0x144fb4){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x16'),_0x144fb4[_0x42e5('0x4')]),_0x144fb4);agents[_0x144fb4[_0x42e5('0x13')]]=_0x144fb4;agents[_0x144fb4['destuniqueid']][_0x42e5('0x17')]=utils[_0x42e5('0x18')]();agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x19');agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x1a')]=null;agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x1b')]=null;utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x1c'),_0x144fb4[_0x42e5('0x4')],agents[_0x144fb4[_0x42e5('0x13')]]['membername'],_0x144fb4[_0x42e5('0x13')]));}catch(_0x4a129e){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x16'),_0x144fb4['uniqueid']),_0x4a129e);}};exports[_0x42e5('0x1d')]=function(_0x39a3e2){try{if(!_[_0x42e5('0x1e')](agents[_0x39a3e2[_0x42e5('0x13')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x1f'),_0x39a3e2['uniqueid']),_0x39a3e2);utils['info'](util[_0x42e5('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x39a3e2[_0x42e5('0x4')],agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x6')],_0x39a3e2[_0x42e5('0x13')]));agents[_0x39a3e2[_0x42e5('0x13')]]['agentringnoanswer']=!![];agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x20')]=utils[_0x42e5('0x18')]();agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x9')]='timeout';agents[_0x39a3e2['destuniqueid']][_0x42e5('0x21')]='timeout';agents[_0x39a3e2['destuniqueid']][_0x42e5('0x22')]=_0x39a3e2['ringtime']?parseInt(_0x39a3e2[_0x42e5('0x23')])/0x3e8:0x0;agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x24')]=0x0;unanswered[_0x42e5('0x25')](_0x39a3e2[_0x42e5('0x13')]);}}catch(_0x2f1edc){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x1f'),_0x39a3e2[_0x42e5('0x4')]),_0x2f1edc);}};exports[_0x42e5('0x26')]=function(_0x1d22ba){try{_[_0x42e5('0x27')](agents,function(_0x383e97,_0x282cbf){if(_0x383e97[_0x42e5('0x4')]==_0x1d22ba[_0x42e5('0x4')]&&!_[_0x42e5('0x28')](unanswered,_0x383e97[_0x42e5('0x13')])){utils[_0x42e5('0x15')](util['format'](_0x42e5('0x29'),_0x1d22ba[_0x42e5('0x4')]),_0x1d22ba);utils[_0x42e5('0x1')](util[_0x42e5('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1d22ba['uniqueid'],_0x383e97[_0x42e5('0x6')],_0x383e97['destuniqueid']));_0x383e97[_0x42e5('0x1d')]=!![];_0x383e97['agentringnoanswerAt']=utils[_0x42e5('0x18')]();_0x383e97[_0x42e5('0x9')]=_0x42e5('0x2a');_0x383e97['reason']=_0x42e5('0x2a');_0x383e97[_0x42e5('0x22')]=_0x1d22ba['holdtime'];_0x383e97[_0x42e5('0x24')]=0x0;writeDB(_0x383e97);}});}catch(_0x57558d){utils[_0x42e5('0x2b')](util[_0x42e5('0x2')](_0x42e5('0x29'),_0x1d22ba[_0x42e5('0x4')]),_0x57558d);}};exports[_0x42e5('0x2c')]=function(_0x41f891){try{if(agents[_0x41f891[_0x42e5('0x13')]]){utils['debug'](util['format'](_0x42e5('0x2d'),_0x41f891[_0x42e5('0x4')]),_0x41f891);utils[_0x42e5('0x1')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x41f891['uniqueid'],agents[_0x41f891['destuniqueid']][_0x42e5('0x6')],_0x41f891[_0x42e5('0x13')]));agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x2e')]=utils[_0x42e5('0x18')]();agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x1a')]=_0x41f891[_0x42e5('0x1a')];agents[_0x41f891['destuniqueid']][_0x42e5('0x1b')]=_0x41f891['connectedlinename'];agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x22')]=_0x41f891[_0x42e5('0x23')];agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x2f');_[_0x42e5('0x27')](agents,function(_0x5ab9b8,_0x20f372){if(_0x5ab9b8[_0x42e5('0x13')]!=_0x41f891['destuniqueid']&&_0x5ab9b8[_0x42e5('0x4')]==_0x41f891['uniqueid']){_0x5ab9b8['talktime']=0x0;_0x5ab9b8['holdtime']=_0x41f891[_0x42e5('0x23')];_0x5ab9b8[_0x42e5('0x1d')]=!![];_0x5ab9b8[_0x42e5('0x20')]=utils[_0x42e5('0x18')]();_0x5ab9b8[_0x42e5('0x9')]=_0x42e5('0x30');_0x5ab9b8[_0x42e5('0x21')]='answered_elsewhere';_0x5ab9b8[_0x42e5('0x31')]=_0x41f891[_0x42e5('0x13')];_0x5ab9b8['answeredelsewheremembername']=_0x41f891[_0x42e5('0x6')];writeDB(_0x5ab9b8);}});}}catch(_0x1c697a){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x2d'),_0x41f891[_0x42e5('0x4')]),_0x1c697a);}};exports[_0x42e5('0xe')]=function(_0x424304){try{if(!_['isNil'](agents[_0x424304[_0x42e5('0x13')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x32'),_0x424304['uniqueid']),_0x424304);utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x33'),_0x424304[_0x42e5('0x4')],agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x6')],_0x424304[_0x42e5('0x13')]));agents[_0x424304[_0x42e5('0x13')]]['agentcomplete']=!![];agents[_0x424304[_0x42e5('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x24')]=utils[_0x42e5('0x34')](agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x35')],agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x2e')]);agents[_0x424304['destuniqueid']][_0x42e5('0x21')]=_0x424304[_0x42e5('0x21')];agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x36');writeDB(agents[_0x424304[_0x42e5('0x13')]]);}}catch(_0x3d910a){utils[_0x42e5('0x2b')](util['format'](_0x42e5('0x32'),_0x424304[_0x42e5('0x4')]),_0x3d910a);}};exports[_0x42e5('0x37')]=function(_0x48757e){try{if(!_[_0x42e5('0x1e')](agents[_0x48757e[_0x42e5('0x38')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x39'),_0x48757e['uniqueid']),_0x48757e);utils[_0x42e5('0x1')](util['format'](_0x42e5('0x3a'),_0x48757e[_0x42e5('0x4')],agents[_0x48757e[_0x42e5('0x38')]]['membername'],agents[_0x48757e['transfereruniqueid']]['uniqueid']));agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3b')]=!![];agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3c')]='blind';agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3d')]=_0x48757e[_0x42e5('0x3e')];agents[_0x48757e['transfereruniqueid']][_0x42e5('0x3f')]=agents[_0x48757e['transfereruniqueid']][_0x42e5('0x4')];}}catch(_0x2583cd){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x39'),_0x48757e[_0x42e5('0x4')]),_0x2583cd);}};exports[_0x42e5('0x40')]=function(_0x24682c){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x41'),_0x24682c[_0x42e5('0x42')]),_0x24682c);if(_0x24682c[_0x42e5('0x42')]==_0x24682c['origtransfererlinkedid']){if(!_[_0x42e5('0x1e')](agents[_0x24682c[_0x42e5('0x43')]])){utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x44'),_0x24682c['origtransfereruniqueid'],agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x6')]));agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3b')]=!![];agents[_0x24682c['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3d')]=_0x24682c['origtransfererexten'];agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3f')]=_0x24682c[_0x42e5('0x42')];}if(_0x24682c[_0x42e5('0x45')]&&agents[_0x24682c[_0x42e5('0x45')]]){agents[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x46')]=0x1;transfers[_0x24682c[_0x42e5('0x45')]]=_[_0x42e5('0x47')](agents[_0x24682c['transfereeuniqueid']]);transfers[_0x24682c[_0x42e5('0x45')]]['calleridnum']=agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x8')];transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x48')]=agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x48')];transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x17')]=utils[_0x42e5('0x18')]();transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x2e')]=utils['now']();transfers[_0x24682c[_0x42e5('0x45')]]['holdtime']=0x0;transfers[_0x24682c[_0x42e5('0x45')]]['agententerreason']=0x2;}}else if(_0x24682c[_0x42e5('0x43')]==_0x24682c[_0x42e5('0x49')]){if(!_['isNil'](agents[_0x24682c[_0x42e5('0x42')]])){utils[_0x42e5('0x1')](util['format'](_0x42e5('0x44'),_0x24682c[_0x42e5('0x42')],agents[_0x24682c['origtransfereruniqueid']][_0x42e5('0x6')]));agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x3b')]=!![];agents[_0x24682c['origtransfereruniqueid']][_0x42e5('0x3c')]=_0x42e5('0x4a');agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x3d')]=_0x24682c['secondtransfererexten'];agents[_0x24682c[_0x42e5('0x42')]]['transferuniqueid']=_0x24682c[_0x42e5('0x43')];}if(_0x24682c[_0x42e5('0x4b')]&&agents[_0x24682c[_0x42e5('0x4b')]]){agents[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x46')]=0x1;transfers[_0x24682c[_0x42e5('0x4b')]]=_[_0x42e5('0x47')](agents[_0x24682c['transfertargetuniqueid']]);transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x8')]=agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x8')];transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x48')]=agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x48')];transfers[_0x24682c[_0x42e5('0x4b')]]['agentcalledAt']=utils[_0x42e5('0x18')]();transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x2e')]=utils[_0x42e5('0x18')]();transfers[_0x24682c['transfertargetuniqueid']][_0x42e5('0x22')]=0x0;transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x46')]=0x2;}}}catch(_0x3a0942){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x24682c[_0x42e5('0x42')]),_0x3a0942);}};exports[_0x42e5('0x4c')]=function(_0x8c7c57){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x4d'),_0x8c7c57[_0x42e5('0x4')]),_0x8c7c57);if(agents[_0x8c7c57[_0x42e5('0x4')]]&&agents[_0x8c7c57[_0x42e5('0x4')]]['reason']===_0x42e5('0x4e')){if(_0x8c7c57[_0x42e5('0x4f')]==='21'){agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]=_0x42e5('0x50');agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]=_0x42e5('0x50');}utils['info'](util['format'](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],agents[_0x8c7c57['uniqueid']]['membername'],agents[_0x8c7c57['uniqueid']][_0x42e5('0x21')],agents[_0x8c7c57[_0x42e5('0x4')]]['lastevent']));writeDB(agents[_0x8c7c57[_0x42e5('0x4')]]);var _0x3603df=unanswered['indexOf'](_0x8c7c57[_0x42e5('0x4')]);if(_0x3603df>-0x1){unanswered[_0x42e5('0x52')](_0x3603df,0x1);}}if(transfers[_0x8c7c57['uniqueid']]){transfers[_0x8c7c57[_0x42e5('0x4')]]['agentcomplete']=!![];transfers[_0x8c7c57['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x24')]=utils['diffTime'](transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x35')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]);transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]='agent';transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]='complete';utils['info'](util[_0x42e5('0x2')](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x6')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')],transfers[_0x8c7c57['uniqueid']]['lastevent']));writeDB(transfers[_0x8c7c57['uniqueid']],!![]);}if(agents[_0x8c7c57['uniqueid']]&&agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]){agents[_0x8c7c57['uniqueid']][_0x42e5('0xe')]=!![];agents[_0x8c7c57['uniqueid']][_0x42e5('0x35')]=utils[_0x42e5('0x18')]();agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x24')]=utils[_0x42e5('0x34')](agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x35')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]);agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]=agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x3b')]?_0x42e5('0x3b'):_0x42e5('0x53');agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]=_0x42e5('0x36');utils['info'](util[_0x42e5('0x2')](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x6')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')],agents[_0x8c7c57[_0x42e5('0x4')]]['lastevent']));writeDB(agents[_0x8c7c57[_0x42e5('0x4')]]);}}catch(_0x5777c2){utils[_0x42e5('0x2b')](util[_0x42e5('0x2')](_0x42e5('0x4d'),_0x8c7c57['uniqueid']),_0x5777c2);}}; \ No newline at end of file +var _0x5423=['info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentcomplete','acw','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5423,0xe3));var _0x3542=function(_0x2e4344,_0x4ae3b0){_0x2e4344=_0x2e4344-0x0;var _0x34fe55=_0x5423[_0x2e4344];return _0x34fe55;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x331a98,_0x457909){utils['info'](util[_0x3542('0x2')](_0x3542('0x3'),_0x331a98[_0x3542('0x4')],_0x331a98[_0x3542('0x5')],_0x331a98['queue'],_0x331a98[_0x3542('0x6')],_0x331a98[_0x3542('0x7')],_0x331a98[_0x3542('0x8')],_0x331a98[_0x3542('0x9')],_0x331a98[_0x3542('0xa')]));if(_0x331a98['queue']){utils['getVoiceQueueByName'](_0x331a98[_0x3542('0xb')])[_0x3542('0xc')](function(_0x53ece9){if(_0x53ece9){_0x331a98[_0x3542('0xd')]=_0x53ece9[_0x3542('0xd')];_0x331a98['agentacw']=_0x331a98[_0x3542('0xe')]?_0x53ece9[_0x3542('0xf')]:![];_0x331a98['acwtime']=_0x331a98[_0x3542('0x10')]?_0x53ece9[_0x3542('0x11')]:0x0;}utils[_0x3542('0x12')](_0x3542('0x13'),_0x331a98);});}else{utils[_0x3542('0x12')](_0x3542('0x13'),_0x331a98);}if(_0x457909){delete transfers[_0x331a98[_0x3542('0x4')]];}else{delete agents[_0x331a98[_0x3542('0x14')]];}}exports[_0x3542('0x15')]=function(_0x1a9062){try{utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x17'),_0x1a9062['uniqueid']),_0x1a9062);agents[_0x1a9062[_0x3542('0x14')]]=_0x1a9062;agents[_0x1a9062['destuniqueid']][_0x3542('0x18')]=utils[_0x3542('0x19')]();agents[_0x1a9062[_0x3542('0x14')]]['lastevent']=_0x3542('0x1a');agents[_0x1a9062[_0x3542('0x14')]][_0x3542('0x9')]=null;agents[_0x1a9062['destuniqueid']][_0x3542('0x1b')]=null;utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x1d'),_0x1a9062['uniqueid'],agents[_0x1a9062[_0x3542('0x14')]]['membername'],_0x1a9062[_0x3542('0x14')]));}catch(_0x369e0c){utils['error'](util[_0x3542('0x2')](_0x3542('0x17'),_0x1a9062[_0x3542('0x4')]),_0x369e0c);}};exports[_0x3542('0x1e')]=function(_0x212950){try{if(!_['isNil'](agents[_0x212950['destuniqueid']])){utils['debug'](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]',_0x212950[_0x3542('0x4')]),_0x212950);utils['info'](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x212950['uniqueid'],agents[_0x212950[_0x3542('0x14')]][_0x3542('0x6')],_0x212950['destuniqueid']));agents[_0x212950['destuniqueid']][_0x3542('0x1e')]=!![];agents[_0x212950['destuniqueid']][_0x3542('0x1f')]=utils[_0x3542('0x19')]();agents[_0x212950[_0x3542('0x14')]][_0x3542('0xa')]=_0x3542('0x20');agents[_0x212950[_0x3542('0x14')]][_0x3542('0x21')]=_0x3542('0x20');agents[_0x212950[_0x3542('0x14')]][_0x3542('0x22')]=_0x212950[_0x3542('0x23')]?parseInt(_0x212950[_0x3542('0x23')])/0x3e8:0x0;agents[_0x212950[_0x3542('0x14')]][_0x3542('0x24')]=0x0;unanswered[_0x3542('0x25')](_0x212950[_0x3542('0x14')]);}}catch(_0x303412){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]',_0x212950[_0x3542('0x4')]),_0x303412);}};exports[_0x3542('0x27')]=function(_0x2aec76){try{_['forIn'](agents,function(_0x402c97,_0xc6f23b){if(_0x402c97[_0x3542('0x4')]==_0x2aec76[_0x3542('0x4')]&&!_['includes'](unanswered,_0x402c97['destuniqueid'])){utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x28'),_0x2aec76[_0x3542('0x4')]),_0x2aec76);utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x29'),_0x2aec76['uniqueid'],_0x402c97['membername'],_0x402c97[_0x3542('0x14')]));_0x402c97['agentringnoanswer']=!![];_0x402c97['agentringnoanswerAt']=utils[_0x3542('0x19')]();_0x402c97['lastevent']='abandoned';_0x402c97[_0x3542('0x21')]=_0x3542('0x2a');_0x402c97[_0x3542('0x22')]=_0x2aec76['holdtime'];_0x402c97[_0x3542('0x24')]=0x0;writeDB(_0x402c97);}});}catch(_0x49b523){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][queuecallerabandon]',_0x2aec76[_0x3542('0x4')]),_0x49b523);}};exports['agentconnect']=function(_0x204e5e){try{if(agents[_0x204e5e[_0x3542('0x14')]]){utils[_0x3542('0x16')](util['format'](_0x3542('0x2b'),_0x204e5e['uniqueid']),_0x204e5e);utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x2c'),_0x204e5e[_0x3542('0x4')],agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x6')],_0x204e5e[_0x3542('0x14')]));agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x2d')]=utils[_0x3542('0x19')]();agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x9')]=_0x204e5e[_0x3542('0x9')];agents[_0x204e5e['destuniqueid']][_0x3542('0x1b')]=_0x204e5e['connectedlinename'];agents[_0x204e5e['destuniqueid']][_0x3542('0x22')]=_0x204e5e[_0x3542('0x23')];agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0xa')]=_0x3542('0x2e');_[_0x3542('0x2f')](agents,function(_0xc7f13c,_0x42e87a){if(_0xc7f13c['destuniqueid']!=_0x204e5e[_0x3542('0x14')]&&_0xc7f13c['uniqueid']==_0x204e5e[_0x3542('0x4')]){_0xc7f13c[_0x3542('0x24')]=0x0;_0xc7f13c['holdtime']=_0x204e5e[_0x3542('0x23')];_0xc7f13c[_0x3542('0x1e')]=!![];_0xc7f13c['agentringnoanswerAt']=utils[_0x3542('0x19')]();_0xc7f13c[_0x3542('0xa')]='answered_elsewhere';_0xc7f13c[_0x3542('0x21')]=_0x3542('0x30');_0xc7f13c[_0x3542('0x31')]=_0x204e5e[_0x3542('0x14')];_0xc7f13c[_0x3542('0x32')]=_0x204e5e[_0x3542('0x6')];writeDB(_0xc7f13c);}});}}catch(_0x2b54b9){utils['error'](util['format'](_0x3542('0x2b'),_0x204e5e[_0x3542('0x4')]),_0x2b54b9);}};exports[_0x3542('0xe')]=function(_0xdeebd3){try{if(!_[_0x3542('0x33')](agents[_0xdeebd3['destuniqueid']])){utils[_0x3542('0x16')](util['format'](_0x3542('0x34'),_0xdeebd3[_0x3542('0x4')]),_0xdeebd3);utils[_0x3542('0x1c')](util['format'](_0x3542('0x35'),_0xdeebd3[_0x3542('0x4')],agents[_0xdeebd3['destuniqueid']][_0x3542('0x6')],_0xdeebd3[_0x3542('0x14')]));agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0xe')]=!![];agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x36')]=utils[_0x3542('0x19')]();agents[_0xdeebd3[_0x3542('0x14')]]['talktime']=utils['diffTime'](agents[_0xdeebd3['destuniqueid']][_0x3542('0x36')],agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x2d')]);agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x21')]=_0xdeebd3[_0x3542('0x21')];agents[_0xdeebd3[_0x3542('0x14')]]['lastevent']=_0x3542('0x37');writeDB(agents[_0xdeebd3[_0x3542('0x14')]]);}}catch(_0x3da43e){utils[_0x3542('0x26')](util['format'](_0x3542('0x34'),_0xdeebd3[_0x3542('0x4')]),_0x3da43e);}};exports['blindtransfer']=function(_0x528f8c){try{if(!_[_0x3542('0x33')](agents[_0x528f8c[_0x3542('0x38')]])){utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x39'),_0x528f8c[_0x3542('0x4')]),_0x528f8c);utils[_0x3542('0x1c')](util['format'](_0x3542('0x3a'),_0x528f8c[_0x3542('0x4')],agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x6')],agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x4')]));agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x3b')]=!![];agents[_0x528f8c[_0x3542('0x38')]]['transfertype']='blind';agents[_0x528f8c[_0x3542('0x38')]]['transferexten']=_0x528f8c['extension'];agents[_0x528f8c['transfereruniqueid']][_0x3542('0x3c')]=agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x4')];}}catch(_0x48cfc4){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][blindtransfer]',_0x528f8c[_0x3542('0x4')]),_0x48cfc4);}};exports[_0x3542('0x3d')]=function(_0x442000){try{utils[_0x3542('0x16')](util[_0x3542('0x2')]('[%s][agents][attendedtransfer]',_0x442000[_0x3542('0x3e')]),_0x442000);if(_0x442000[_0x3542('0x3e')]==_0x442000[_0x3542('0x3f')]){if(!_[_0x3542('0x33')](agents[_0x442000[_0x3542('0x40')]])){utils['info'](util['format'](_0x3542('0x41'),_0x442000[_0x3542('0x3e')],agents[_0x442000[_0x3542('0x40')]]['membername']));agents[_0x442000[_0x3542('0x40')]][_0x3542('0x3b')]=!![];agents[_0x442000[_0x3542('0x40')]][_0x3542('0x42')]=_0x3542('0x43');agents[_0x442000['secondtransfereruniqueid']]['transferexten']=_0x442000[_0x3542('0x44')];agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x3c')]=_0x442000[_0x3542('0x3e')];}if(_0x442000['transfereeuniqueid']&&agents[_0x442000[_0x3542('0x45')]]){agents[_0x442000[_0x3542('0x45')]][_0x3542('0x46')]=0x1;transfers[_0x442000[_0x3542('0x45')]]=_[_0x3542('0x47')](agents[_0x442000['transfereeuniqueid']]);transfers[_0x442000['transfereeuniqueid']][_0x3542('0x8')]=agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x8')];transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x48')]=agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x48')];transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x18')]=utils[_0x3542('0x19')]();transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x2d')]=utils['now']();transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x22')]=0x0;transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x46')]=0x2;}}else if(_0x442000[_0x3542('0x40')]==_0x442000[_0x3542('0x49')]){if(!_['isNil'](agents[_0x442000[_0x3542('0x3e')]])){utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x41'),_0x442000['origtransfereruniqueid'],agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x6')]));agents[_0x442000['origtransfereruniqueid']]['transfer']=!![];agents[_0x442000[_0x3542('0x3e')]]['transfertype']=_0x3542('0x43');agents[_0x442000['origtransfereruniqueid']]['transferexten']=_0x442000[_0x3542('0x4a')];agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x3c')]=_0x442000[_0x3542('0x40')];}if(_0x442000[_0x3542('0x4b')]&&agents[_0x442000[_0x3542('0x4b')]]){agents[_0x442000[_0x3542('0x4b')]]['agententerreason']=0x1;transfers[_0x442000[_0x3542('0x4b')]]=_[_0x3542('0x47')](agents[_0x442000[_0x3542('0x4b')]]);transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x8')]=agents[_0x442000['origtransfereruniqueid']][_0x3542('0x8')];transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x48')]=agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x48')];transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x18')]=utils['now']();transfers[_0x442000[_0x3542('0x4b')]]['agentconnectAt']=utils[_0x3542('0x19')]();transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x22')]=0x0;transfers[_0x442000[_0x3542('0x4b')]]['agententerreason']=0x2;}}}catch(_0x47c624){utils['error'](util[_0x3542('0x2')](_0x3542('0x4c'),_0x442000[_0x3542('0x3e')]),_0x47c624);}};exports[_0x3542('0x4d')]=function(_0x1ebe3a){try{utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x4e'),_0x1ebe3a[_0x3542('0x4')]),_0x1ebe3a);if(agents[_0x1ebe3a['uniqueid']]&&agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]===_0x3542('0x20')){if(_0x1ebe3a[_0x3542('0x4f')]==='21'){agents[_0x1ebe3a[_0x3542('0x4')]]['reason']='rejected';agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xa')]='rejected';}utils[_0x3542('0x1c')](util['format'](_0x3542('0x50'),_0x1ebe3a['uniqueid'],agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x6')],agents[_0x1ebe3a['uniqueid']]['reason'],agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]));writeDB(agents[_0x1ebe3a['uniqueid']]);var _0x16159f=unanswered[_0x3542('0x51')](_0x1ebe3a['uniqueid']);if(_0x16159f>-0x1){unanswered[_0x3542('0x52')](_0x16159f,0x1);}}if(transfers[_0x1ebe3a[_0x3542('0x4')]]){transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcomplete']=!![];transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcompleteAt']=utils[_0x3542('0x19')]();transfers[_0x1ebe3a['uniqueid']][_0x3542('0x24')]=utils[_0x3542('0x53')](transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcompleteAt'],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x2d')]);transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]='agent';transfers[_0x1ebe3a['uniqueid']][_0x3542('0xa')]=_0x3542('0x37');utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x50'),_0x1ebe3a[_0x3542('0x4')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x6')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xa')]));writeDB(transfers[_0x1ebe3a[_0x3542('0x4')]],!![]);}if(agents[_0x1ebe3a[_0x3542('0x4')]]&&agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x2d')]){agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xe')]=!![];agents[_0x1ebe3a['uniqueid']][_0x3542('0x36')]=utils[_0x3542('0x19')]();agents[_0x1ebe3a['uniqueid']]['talktime']=utils[_0x3542('0x53')](agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x36')],agents[_0x1ebe3a[_0x3542('0x4')]]['agentconnectAt']);agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]=agents[_0x1ebe3a['uniqueid']][_0x3542('0x3b')]?'transfer':_0x3542('0x54');agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]=_0x3542('0x37');utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x50'),_0x1ebe3a[_0x3542('0x4')],agents[_0x1ebe3a[_0x3542('0x4')]]['membername'],agents[_0x1ebe3a[_0x3542('0x4')]]['reason'],agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]));writeDB(agents[_0x1ebe3a[_0x3542('0x4')]]);}}catch(_0x2c6f2b){utils[_0x3542('0x26')](util['format'](_0x3542('0x4e'),_0x1ebe3a[_0x3542('0x4')]),_0x2c6f2b);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b60a85d..021bace 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 _0xa8cd=['hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','destination','\x22\x20<','variable','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','uniqueid','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','format','[%s][calls][newchannel]','OutgoingSpoolFailed','context','calleridnum','exten','channel','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber'];(function(_0x419654,_0x27ca4b){var _0x3d69ea=function(_0x13d8a8){while(--_0x13d8a8){_0x419654['push'](_0x419654['shift']());}};_0x3d69ea(++_0x27ca4b);}(_0xa8cd,0xa3));var _0xda8c=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xa8cd[_0x57add2];return _0x4e3670;};'use strict';var _=require('lodash');var util=require(_0xda8c('0x0'));var utils=require(_0xda8c('0x1'));var dispositions=[_0xda8c('0x2'),_0xda8c('0x3'),_0xda8c('0x3'),_0xda8c('0x2'),_0xda8c('0x2'),_0xda8c('0x2'),_0xda8c('0x4'),'BUSY','FAILED',_0xda8c('0x3'),_0xda8c('0x3')];var channels={};function writeDB(_0xa00ddb){utils[_0xda8c('0x5')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xa00ddb[_0xda8c('0x6')],_0xa00ddb['channel'],_0xa00ddb['queue'],_0xa00ddb['membername'],_0xa00ddb[_0xda8c('0x7')],_0xa00ddb['calleridnum'],_0xa00ddb[_0xda8c('0x8')],_0xa00ddb['lastevent']));if(_0xa00ddb[_0xda8c('0x9')]){utils[_0xda8c('0xa')](_0xa00ddb['accountcode'])[_0xda8c('0xb')](function(_0x3ff2ad){if(_0x3ff2ad){_0xa00ddb[_0xda8c('0xc')]=_0x3ff2ad['id'];}utils[_0xda8c('0xd')](_0xda8c('0xe'),_0xa00ddb);});}else{utils['request'](_0xda8c('0xe'),_0xa00ddb);}if(channels[_0xa00ddb[_0xda8c('0x6')]]){delete channels[_0xa00ddb['uniqueid']];}}exports['newchannel']=function(_0x32ee61){try{utils['debug'](util[_0xda8c('0xf')](_0xda8c('0x10'),_0x32ee61[_0xda8c('0x6')]),_0x32ee61);if(_0x32ee61['uniqueid']==_0x32ee61['linkedid']&&_0x32ee61['channel']!=_0xda8c('0x11')){utils[_0xda8c('0x5')](util[_0xda8c('0xf')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x32ee61[_0xda8c('0x6')],_0x32ee61[_0xda8c('0x12')],_0x32ee61['exten']));channels[_0x32ee61[_0xda8c('0x6')]]={'uniqueid':_0x32ee61[_0xda8c('0x6')],'accountcode':_0x32ee61[_0xda8c('0x9')],'source':_0x32ee61[_0xda8c('0x13')],'destination':_0x32ee61[_0xda8c('0x14')],'destinationcontext':_0x32ee61[_0xda8c('0x12')],'channel':_0x32ee61[_0xda8c('0x15')],'starttime':utils[_0xda8c('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xda8c('0x2'),'amaflags':_0xda8c('0x17')};}}catch(_0x9b9c5f){utils[_0xda8c('0x18')](util[_0xda8c('0xf')](_0xda8c('0x10'),_0x32ee61['uniqueid']),_0x9b9c5f);}};exports[_0xda8c('0x19')]=function(_0x11c931){try{utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x1b'),_0x11c931[_0xda8c('0x6')]),_0x11c931);if(!_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x6')]])&&_0x11c931[_0xda8c('0x1d')]==0x6){utils['info'](util[_0xda8c('0xf')](_0xda8c('0x1e'),_0x11c931['uniqueid'],_0x11c931[_0xda8c('0x12')],_0x11c931['channel']));if(_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x6')]][_0xda8c('0x1f')])){channels[_0x11c931[_0xda8c('0x6')]][_0xda8c('0x1f')]=utils['now']();}}else if(!_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x20')]])&&_0x11c931[_0xda8c('0x1d')]==0x6&&_0x11c931['context']!=_0xda8c('0x21')){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x22'),_0x11c931[_0xda8c('0x6')],_0x11c931[_0xda8c('0x20')],_0x11c931[_0xda8c('0x12')],_0x11c931[_0xda8c('0x15')]));channels[_0x11c931[_0xda8c('0x20')]]['accountcode']=_0x11c931['accountcode'];channels[_0x11c931[_0xda8c('0x20')]][_0xda8c('0x23')]=_0x11c931[_0xda8c('0x15')];if(_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x20')]][_0xda8c('0x24')])){channels[_0x11c931['linkedid']][_0xda8c('0x24')]=utils[_0xda8c('0x16')]();}channels[_0x11c931['linkedid']][_0xda8c('0x25')]=dispositions[_[_0xda8c('0x26')](_0x11c931[_0xda8c('0x1d')])]||_0xda8c('0x4');}}catch(_0x56b475){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][newstate]',_0x11c931[_0xda8c('0x6')]),_0x56b475);}};exports[_0xda8c('0x27')]=function(_0x547115){try{if(!_[_0xda8c('0x1c')](channels[_0x547115[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x28'),_0x547115[_0xda8c('0x6')]),_0x547115);if(_[_0xda8c('0x1c')](channels[_0x547115['uniqueid']][_0xda8c('0x29')])){channels[_0x547115[_0xda8c('0x6')]]['callerid']=_0x547115['calleridname']+'\x20<'+_0x547115['calleridnum']+'>';}utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x2a'),_0x547115[_0xda8c('0x6')],channels[_0x547115[_0xda8c('0x6')]]['callerid'],_0x547115[_0xda8c('0x2b')]));channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x2c')]=utils[_0xda8c('0x16')]();channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x2d')]=utils['diffTime'](channels[_0x547115['uniqueid']]['endtime'],channels[_0x547115[_0xda8c('0x6')]]['starttime']);channels[_0x547115[_0xda8c('0x6')]]['billableseconds']=channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x24')]?utils[_0xda8c('0x2e')](channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x2c')],channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x24')]):0x0;writeDB(channels[_0x547115[_0xda8c('0x6')]]);}}catch(_0x3e55fe){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][hangup]',_0x547115[_0xda8c('0x6')]),_0x3e55fe);}};exports['attendedtransfer']=function(_0x4a1926){try{if(!_[_0xda8c('0x1c')](channels[_0x4a1926[_0xda8c('0x2f')]])){utils['debug'](util['format'](_0xda8c('0x30'),_0x4a1926[_0xda8c('0x31')]),_0x4a1926);if(channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x15')]==_0x4a1926[_0xda8c('0x32')]){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x33'),_0x4a1926[_0xda8c('0x31')],_0x4a1926[_0xda8c('0x2f')],_0x4a1926[_0xda8c('0x34')]));channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x23')]=_0x4a1926[_0xda8c('0x34')];channels[_0x4a1926['localtwolinkedid']]['userfield']=_0xda8c('0x35');}else if(channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x15')]=_0x4a1926[_0xda8c('0x36')]){utils[_0xda8c('0x5')](util['format'](_0xda8c('0x33'),_0x4a1926[_0xda8c('0x31')],_0x4a1926[_0xda8c('0x2f')],_0x4a1926['origtransfererchannel']));channels[_0x4a1926['localtwolinkedid']][_0xda8c('0x23')]=_0x4a1926[_0xda8c('0x37')];channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x38')]='_attended';}}}catch(_0x4763a7){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][attendedtransfer]',_0x4a1926[_0xda8c('0x31')]),_0x4763a7);}};exports[_0xda8c('0x39')]=function(_0xa67a8){try{if(!_[_0xda8c('0x1c')](channels[_0xa67a8[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x3a'),_0xa67a8[_0xda8c('0x6')]),_0xa67a8);channels[_0xa67a8[_0xda8c('0x6')]][_0xda8c('0x3b')]=utils[_0xda8c('0x16')]();utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x3c'),_0xa67a8[_0xda8c('0x6')],channels[_0xa67a8[_0xda8c('0x6')]][_0xda8c('0x3b')]));}}catch(_0x3e219b){utils['error'](util[_0xda8c('0xf')]('[%s][calls][musiconholdstart]',_0xa67a8[_0xda8c('0x6')]),_0x3e219b);}};exports['musiconholdstop']=function(_0x46007e){try{if(!_[_0xda8c('0x1c')](channels[_0x46007e[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x3d'),_0x46007e[_0xda8c('0x6')]),_0x46007e);if(!_[_0xda8c('0x1c')](channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3b')])){channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3e')]+=utils[_0xda8c('0x2e')](utils[_0xda8c('0x16')](),channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3b')]);utils['info'](util[_0xda8c('0xf')](_0xda8c('0x3f'),_0x46007e[_0xda8c('0x6')],channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3e')]));delete channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3b')];}}}catch(_0x4cc0e8){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][musiconholdstop]',_0x46007e[_0xda8c('0x6')]),_0x4cc0e8);}};exports[_0xda8c('0x40')]=function(_0x5839b9){try{if(!_[_0xda8c('0x1c')](channels[_0x5839b9[_0xda8c('0x6')]])){utils['debug'](util[_0xda8c('0xf')]('[%s][calls][varset]',_0x5839b9['uniqueid']),_0x5839b9);if(!_[_0xda8c('0x1c')](_0x5839b9['variable'][_0xda8c('0x41')])){utils['info'](util['format'](_0xda8c('0x42'),_0x5839b9['uniqueid'],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x44')]=_0x5839b9[_0xda8c('0x43')];}if(!_[_0xda8c('0x1c')](_0x5839b9['variable']['xmd-phone'])){utils['info'](util[_0xda8c('0xf')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5839b9[_0xda8c('0x6')],_0x5839b9['value']));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x45')]=_0x5839b9['value'];channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x29')]='\x22'+_0x5839b9[_0xda8c('0x43')]+_0xda8c('0x46')+_0x5839b9[_0xda8c('0x43')]+'>';}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')]['xmd-callerid-preview'])||!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x48')])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5839b9[_0xda8c('0x6')],!_[_0xda8c('0x1c')](_0x5839b9['variable'][_0xda8c('0x49')])?'xmd-callerid-preview':_0xda8c('0x48'),_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9['uniqueid']][_0xda8c('0x29')]=_0x5839b9[_0xda8c('0x43')];}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x4a')])||!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x4b')])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x4c'),_0x5839b9[_0xda8c('0x6')],!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')]['xmd-queue'])?_0xda8c('0x4a'):'xmcs-queue',_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x4d')]=_0xda8c('0x4e');channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x4f')]=_0x5839b9[_0xda8c('0x43')];channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x50')]=!![];}if(!_[_0xda8c('0x1c')](_0x5839b9['variable']['xmd-contactid'])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5839b9['uniqueid'],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x51')]=_0x5839b9[_0xda8c('0x43')];}if(!_['isNil'](_0x5839b9[_0xda8c('0x47')]['xmd-cdrtype'])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x52'),_0x5839b9[_0xda8c('0x6')],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]]['type']=_0x5839b9['value'];}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')]['outboundrouteid'])){utils['info'](util[_0xda8c('0xf')](_0xda8c('0x53'),_0x5839b9['uniqueid'],_0x5839b9['value']));channels[_0x5839b9['uniqueid']][_0xda8c('0x54')]=_0x5839b9[_0xda8c('0x43')];}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x55')])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x56'),_0x5839b9[_0xda8c('0x6')],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x55')]=_0x5839b9[_0xda8c('0x43')];}}}catch(_0x282919){utils[_0xda8c('0x18')](util[_0xda8c('0xf')](_0xda8c('0x57'),_0x5839b9[_0xda8c('0x6')]),_0x282919);}};exports['newexten']=function(_0x161670){try{if(!_['isNil'](channels[_0x161670[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')]('[%s][calls][newexten]',_0x161670[_0xda8c('0x6')]),_0x161670);utils[_0xda8c('0x5')](util['format'](_0xda8c('0x58'),_0x161670[_0xda8c('0x6')],_0x161670['application'],_0x161670[_0xda8c('0x59')]));if(_0x161670['application'][_0xda8c('0x5a')]()==_0xda8c('0x5b')&&_['startsWith'](_0x161670[_0xda8c('0x59')]['toLowerCase'](),_0xda8c('0x5c'))){var _0x440b16=_0x161670['appdata'][_0xda8c('0x5d')]('=');var _0x58c2aa=_0x440b16[0x0][_0xda8c('0x5e')](_0x440b16[0x0]['lastIndexOf']('(')+0x1,_0x440b16[0x0][_0xda8c('0x5f')](')'));var _0x239974=_0x440b16[0x1];channels[_0x161670[_0xda8c('0x6')]][_0x58c2aa]=_0x239974;}if(!_[_0xda8c('0x60')]([_0xda8c('0x27'),_0xda8c('0x61'),_0xda8c('0x62'),_0xda8c('0x5b'),_0xda8c('0x63')],_0x161670['application']['toLowerCase']())){channels[_0x161670['uniqueid']][_0xda8c('0x4d')]=_0x161670['application'];channels[_0x161670['uniqueid']][_0xda8c('0x4f')]=_0x161670['appdata'];}}}catch(_0x22a464){utils[_0xda8c('0x18')](util[_0xda8c('0xf')](_0xda8c('0x64'),_0x161670[_0xda8c('0x6')]),_0x22a464);}}; \ No newline at end of file +var _0xe22d=['info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','[%s][calls][newstate]','hangup','debug','[%s][calls][hangup]','callerid','cause-txt','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','application','lastapplication','lastdata','util','./utils','NO\x20ANSWER','FAILED','ANSWERED'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe22d,0x139));var _0xde22=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe22d[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xde22('0x0'));var utils=require(_0xde22('0x1'));var dispositions=[_0xde22('0x2'),_0xde22('0x3'),'FAILED',_0xde22('0x2'),_0xde22('0x2'),_0xde22('0x2'),_0xde22('0x4'),'BUSY',_0xde22('0x3'),_0xde22('0x3'),_0xde22('0x3')];var channels={};function writeDB(_0x408129){utils[_0xde22('0x5')](util['format'](_0xde22('0x6'),_0x408129['uniqueid'],_0x408129[_0xde22('0x7')],_0x408129[_0xde22('0x8')],_0x408129['membername'],_0x408129[_0xde22('0x9')],_0x408129[_0xde22('0xa')],_0x408129[_0xde22('0xb')],_0x408129['lastevent']));if(_0x408129[_0xde22('0xc')]){utils['getUserByInternal'](_0x408129[_0xde22('0xc')])[_0xde22('0xd')](function(_0x312a45){if(_0x312a45){_0x408129[_0xde22('0xe')]=_0x312a45['id'];}utils[_0xde22('0xf')](_0xde22('0x10'),_0x408129);});}else{utils[_0xde22('0xf')](_0xde22('0x10'),_0x408129);}if(channels[_0x408129[_0xde22('0x11')]]){delete channels[_0x408129[_0xde22('0x11')]];}}exports[_0xde22('0x12')]=function(_0x4252d7){try{utils['debug'](util[_0xde22('0x13')](_0xde22('0x14'),_0x4252d7[_0xde22('0x11')]),_0x4252d7);if(_0x4252d7['uniqueid']==_0x4252d7[_0xde22('0x15')]&&_0x4252d7[_0xde22('0x7')]!=_0xde22('0x16')){utils['info'](util['format'](_0xde22('0x17'),_0x4252d7['uniqueid'],_0x4252d7[_0xde22('0x18')],_0x4252d7[_0xde22('0x19')]));channels[_0x4252d7[_0xde22('0x11')]]={'uniqueid':_0x4252d7['uniqueid'],'accountcode':_0x4252d7[_0xde22('0xc')],'source':_0x4252d7[_0xde22('0xa')],'destination':_0x4252d7[_0xde22('0x19')],'destinationcontext':_0x4252d7[_0xde22('0x18')],'channel':_0x4252d7[_0xde22('0x7')],'starttime':utils[_0xde22('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xde22('0x1b')};}}catch(_0x222152){utils[_0xde22('0x1c')](util[_0xde22('0x13')](_0xde22('0x14'),_0x4252d7[_0xde22('0x11')]),_0x222152);}};exports['newstate']=function(_0x3aa012){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x3aa012['uniqueid']),_0x3aa012);if(!_[_0xde22('0x1d')](channels[_0x3aa012[_0xde22('0x11')]])&&_0x3aa012[_0xde22('0x1e')]==0x6){utils[_0xde22('0x5')](util[_0xde22('0x13')](_0xde22('0x1f'),_0x3aa012[_0xde22('0x11')],_0x3aa012[_0xde22('0x18')],_0x3aa012[_0xde22('0x7')]));if(_[_0xde22('0x1d')](channels[_0x3aa012[_0xde22('0x11')]][_0xde22('0x20')])){channels[_0x3aa012[_0xde22('0x11')]][_0xde22('0x20')]=utils['now']();}}else if(!_[_0xde22('0x1d')](channels[_0x3aa012['linkedid']])&&_0x3aa012[_0xde22('0x1e')]==0x6&&_0x3aa012[_0xde22('0x18')]!='transfer'){utils[_0xde22('0x5')](util['format'](_0xde22('0x21'),_0x3aa012[_0xde22('0x11')],_0x3aa012['linkedid'],_0x3aa012[_0xde22('0x18')],_0x3aa012[_0xde22('0x7')]));channels[_0x3aa012[_0xde22('0x15')]][_0xde22('0xc')]=_0x3aa012[_0xde22('0xc')];channels[_0x3aa012[_0xde22('0x15')]][_0xde22('0x22')]=_0x3aa012[_0xde22('0x7')];if(_[_0xde22('0x1d')](channels[_0x3aa012[_0xde22('0x15')]][_0xde22('0x23')])){channels[_0x3aa012[_0xde22('0x15')]][_0xde22('0x23')]=utils[_0xde22('0x1a')]();}channels[_0x3aa012[_0xde22('0x15')]][_0xde22('0x24')]=dispositions[_['toNumber'](_0x3aa012[_0xde22('0x1e')])]||_0xde22('0x4');}}catch(_0x2bca75){utils[_0xde22('0x1c')](util['format'](_0xde22('0x25'),_0x3aa012[_0xde22('0x11')]),_0x2bca75);}};exports[_0xde22('0x26')]=function(_0x5c5680){try{if(!_['isNil'](channels[_0x5c5680[_0xde22('0x11')]])){utils[_0xde22('0x27')](util[_0xde22('0x13')](_0xde22('0x28'),_0x5c5680['uniqueid']),_0x5c5680);if(_[_0xde22('0x1d')](channels[_0x5c5680[_0xde22('0x11')]][_0xde22('0x29')])){channels[_0x5c5680[_0xde22('0x11')]]['callerid']=_0x5c5680['calleridname']+'\x20<'+_0x5c5680['calleridnum']+'>';}utils[_0xde22('0x5')](util[_0xde22('0x13')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x5c5680['uniqueid'],channels[_0x5c5680[_0xde22('0x11')]][_0xde22('0x29')],_0x5c5680[_0xde22('0x2a')]));channels[_0x5c5680[_0xde22('0x11')]][_0xde22('0x2b')]=utils[_0xde22('0x1a')]();channels[_0x5c5680[_0xde22('0x11')]]['duration']=utils[_0xde22('0x2c')](channels[_0x5c5680['uniqueid']][_0xde22('0x2b')],channels[_0x5c5680[_0xde22('0x11')]][_0xde22('0x2d')]);channels[_0x5c5680[_0xde22('0x11')]][_0xde22('0x2e')]=channels[_0x5c5680[_0xde22('0x11')]][_0xde22('0x23')]?utils[_0xde22('0x2c')](channels[_0x5c5680[_0xde22('0x11')]][_0xde22('0x2b')],channels[_0x5c5680[_0xde22('0x11')]]['answertime']):0x0;writeDB(channels[_0x5c5680['uniqueid']]);}}catch(_0x20c93d){utils['error'](util[_0xde22('0x13')](_0xde22('0x28'),_0x5c5680[_0xde22('0x11')]),_0x20c93d);}};exports[_0xde22('0x2f')]=function(_0x31806e){try{if(!_[_0xde22('0x1d')](channels[_0x31806e[_0xde22('0x30')]])){utils[_0xde22('0x27')](util[_0xde22('0x13')](_0xde22('0x31'),_0x31806e['origtransfereruniqueid']),_0x31806e);if(channels[_0x31806e[_0xde22('0x30')]][_0xde22('0x7')]==_0x31806e[_0xde22('0x32')]){utils['info'](util[_0xde22('0x13')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x31806e[_0xde22('0x33')],_0x31806e[_0xde22('0x30')],_0x31806e[_0xde22('0x34')]));channels[_0x31806e[_0xde22('0x30')]][_0xde22('0x22')]=_0x31806e[_0xde22('0x34')];channels[_0x31806e[_0xde22('0x30')]][_0xde22('0x35')]=_0xde22('0x36');}else if(channels[_0x31806e[_0xde22('0x30')]]['channel']=_0x31806e[_0xde22('0x37')]){utils['info'](util[_0xde22('0x13')](_0xde22('0x38'),_0x31806e[_0xde22('0x33')],_0x31806e[_0xde22('0x30')],_0x31806e[_0xde22('0x39')]));channels[_0x31806e[_0xde22('0x30')]][_0xde22('0x22')]=_0x31806e[_0xde22('0x39')];channels[_0x31806e[_0xde22('0x30')]][_0xde22('0x35')]=_0xde22('0x36');}}}catch(_0x45d590){utils[_0xde22('0x1c')](util[_0xde22('0x13')]('[%s][calls][attendedtransfer]',_0x31806e['origtransfereruniqueid']),_0x45d590);}};exports[_0xde22('0x3a')]=function(_0x5ddc26){try{if(!_[_0xde22('0x1d')](channels[_0x5ddc26[_0xde22('0x11')]])){utils['debug'](util[_0xde22('0x13')]('[%s][calls][musiconholdstart]',_0x5ddc26[_0xde22('0x11')]),_0x5ddc26);channels[_0x5ddc26[_0xde22('0x11')]][_0xde22('0x3b')]=utils['now']();utils[_0xde22('0x5')](util['format'](_0xde22('0x3c'),_0x5ddc26[_0xde22('0x11')],channels[_0x5ddc26[_0xde22('0x11')]][_0xde22('0x3b')]));}}catch(_0x2b0142){utils[_0xde22('0x1c')](util[_0xde22('0x13')](_0xde22('0x3d'),_0x5ddc26['uniqueid']),_0x2b0142);}};exports['musiconholdstop']=function(_0xa230){try{if(!_[_0xde22('0x1d')](channels[_0xa230['uniqueid']])){utils['debug'](util[_0xde22('0x13')](_0xde22('0x3e'),_0xa230[_0xde22('0x11')]),_0xa230);if(!_[_0xde22('0x1d')](channels[_0xa230['uniqueid']][_0xde22('0x3b')])){channels[_0xa230['uniqueid']][_0xde22('0x3f')]+=utils['diffTime'](utils[_0xde22('0x1a')](),channels[_0xa230[_0xde22('0x11')]]['musiconholdstartAt']);utils['info'](util[_0xde22('0x13')](_0xde22('0x40'),_0xa230[_0xde22('0x11')],channels[_0xa230[_0xde22('0x11')]]['mohtime']));delete channels[_0xa230[_0xde22('0x11')]][_0xde22('0x3b')];}}}catch(_0xbf9824){utils['error'](util['format']('[%s][calls][musiconholdstop]',_0xa230['uniqueid']),_0xbf9824);}};exports[_0xde22('0x41')]=function(_0x27de7b){try{if(!_['isNil'](channels[_0x27de7b[_0xde22('0x11')]])){utils[_0xde22('0x27')](util[_0xde22('0x13')](_0xde22('0x42'),_0x27de7b['uniqueid']),_0x27de7b);if(!_[_0xde22('0x1d')](_0x27de7b[_0xde22('0x43')][_0xde22('0x44')])){utils[_0xde22('0x5')](util[_0xde22('0x13')](_0xde22('0x45'),_0x27de7b['uniqueid'],_0x27de7b[_0xde22('0x46')]));channels[_0x27de7b['uniqueid']][_0xde22('0x47')]=_0x27de7b['value'];}if(!_['isNil'](_0x27de7b[_0xde22('0x43')][_0xde22('0x48')])){utils[_0xde22('0x5')](util[_0xde22('0x13')](_0xde22('0x49'),_0x27de7b[_0xde22('0x11')],_0x27de7b['value']));channels[_0x27de7b[_0xde22('0x11')]]['destination']=_0x27de7b[_0xde22('0x46')];channels[_0x27de7b['uniqueid']]['callerid']='\x22'+_0x27de7b[_0xde22('0x46')]+'\x22\x20<'+_0x27de7b[_0xde22('0x46')]+'>';}if(!_[_0xde22('0x1d')](_0x27de7b['variable'][_0xde22('0x4a')])||!_[_0xde22('0x1d')](_0x27de7b[_0xde22('0x43')][_0xde22('0x4b')])){utils[_0xde22('0x5')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x27de7b[_0xde22('0x11')],!_[_0xde22('0x1d')](_0x27de7b[_0xde22('0x43')][_0xde22('0x4a')])?_0xde22('0x4a'):_0xde22('0x4b'),_0x27de7b[_0xde22('0x46')]));channels[_0x27de7b[_0xde22('0x11')]][_0xde22('0x29')]=_0x27de7b[_0xde22('0x46')];}if(!_['isNil'](_0x27de7b[_0xde22('0x43')][_0xde22('0x4c')])||!_['isNil'](_0x27de7b[_0xde22('0x43')][_0xde22('0x4d')])){utils['info'](util['format'](_0xde22('0x4e'),_0x27de7b['uniqueid'],!_[_0xde22('0x1d')](_0x27de7b[_0xde22('0x43')][_0xde22('0x4c')])?'xmd-queue':_0xde22('0x4d'),_0x27de7b[_0xde22('0x46')]));channels[_0x27de7b['uniqueid']]['lastapplication']=_0xde22('0x4f');channels[_0x27de7b[_0xde22('0x11')]]['lastdata']=_0x27de7b['value'];channels[_0x27de7b[_0xde22('0x11')]]['queue']=!![];}if(!_[_0xde22('0x1d')](_0x27de7b['variable']['xmd-contactid'])){utils[_0xde22('0x5')](util[_0xde22('0x13')](_0xde22('0x50'),_0x27de7b['uniqueid'],_0x27de7b[_0xde22('0x46')]));channels[_0x27de7b[_0xde22('0x11')]][_0xde22('0x51')]=_0x27de7b[_0xde22('0x46')];}if(!_[_0xde22('0x1d')](_0x27de7b[_0xde22('0x43')][_0xde22('0x52')])){utils[_0xde22('0x5')](util[_0xde22('0x13')](_0xde22('0x53'),_0x27de7b[_0xde22('0x11')],_0x27de7b[_0xde22('0x46')]));channels[_0x27de7b[_0xde22('0x11')]][_0xde22('0x54')]=_0x27de7b[_0xde22('0x46')];}if(!_[_0xde22('0x1d')](_0x27de7b[_0xde22('0x43')][_0xde22('0x55')])){utils[_0xde22('0x5')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x27de7b['uniqueid'],_0x27de7b[_0xde22('0x46')]));channels[_0x27de7b[_0xde22('0x11')]][_0xde22('0x56')]=_0x27de7b[_0xde22('0x46')];}if(!_['isNil'](_0x27de7b[_0xde22('0x43')][_0xde22('0x57')])){utils[_0xde22('0x5')](util[_0xde22('0x13')](_0xde22('0x58'),_0x27de7b[_0xde22('0x11')],_0x27de7b[_0xde22('0x46')]));channels[_0x27de7b[_0xde22('0x11')]][_0xde22('0x57')]=_0x27de7b[_0xde22('0x46')];}}}catch(_0x4f636d){utils[_0xde22('0x1c')](util[_0xde22('0x13')](_0xde22('0x42'),_0x27de7b[_0xde22('0x11')]),_0x4f636d);}};exports[_0xde22('0x59')]=function(_0x23a651){try{if(!_[_0xde22('0x1d')](channels[_0x23a651['uniqueid']])){utils['debug'](util['format'](_0xde22('0x5a'),_0x23a651['uniqueid']),_0x23a651);utils[_0xde22('0x5')](util['format'](_0xde22('0x5b'),_0x23a651[_0xde22('0x11')],_0x23a651['application'],_0x23a651[_0xde22('0x5c')]));if(_0x23a651['application'][_0xde22('0x5d')]()==_0xde22('0x5e')&&_[_0xde22('0x5f')](_0x23a651[_0xde22('0x5c')]['toLowerCase'](),_0xde22('0x60'))){var _0x56e562=_0x23a651['appdata'][_0xde22('0x61')]('=');var _0x422fc5=_0x56e562[0x0][_0xde22('0x62')](_0x56e562[0x0][_0xde22('0x63')]('(')+0x1,_0x56e562[0x0]['lastIndexOf'](')'));var _0x433c01=_0x56e562[0x1];channels[_0x23a651['uniqueid']][_0x422fc5]=_0x433c01;}if(!_[_0xde22('0x64')]([_0xde22('0x26'),_0xde22('0x65'),_0xde22('0x66'),_0xde22('0x5e'),'gotoif'],_0x23a651[_0xde22('0x67')][_0xde22('0x5d')]())){channels[_0x23a651['uniqueid']][_0xde22('0x68')]=_0x23a651['application'];channels[_0x23a651[_0xde22('0x11')]][_0xde22('0x69')]=_0x23a651['appdata'];}}}catch(_0x48547b){utils[_0xde22('0x1c')](util[_0xde22('0x13')](_0xde22('0x5a'),_0x23a651[_0xde22('0x11')]),_0x48547b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b081085..6ea37bb 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 _0x255f=['error','[core]\x20error','close','[core]\x20close','./utils','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x5aa6d6,_0x19d2fd){var _0x118a38=function(_0x4bbc0a){while(--_0x4bbc0a){_0x5aa6d6['push'](_0x5aa6d6['shift']());}};_0x118a38(++_0x19d2fd);}(_0x255f,0xea));var _0xf255=function(_0x314a36,_0x321e32){_0x314a36=_0x314a36-0x0;var _0x1172ef=_0x255f[_0x314a36];return _0x1172ef;};'use strict';var utils=require(_0xf255('0x0'));exports['connect']=function(){utils[_0xf255('0x1')]('[core]\x20connected');};exports[_0xf255('0x2')]=function(){utils[_0xf255('0x1')](_0xf255('0x3'));};exports[_0xf255('0x4')]=function(){utils[_0xf255('0x1')](_0xf255('0x5'));};exports[_0xf255('0x6')]=function(_0x4d445a){utils['error'](_0xf255('0x7'),_0x4d445a);};exports[_0xf255('0x8')]=function(){utils[_0xf255('0x1')](_0xf255('0x9'));};exports['managerevent']=function(_0x6731a5){}; \ No newline at end of file +var _0x15a8=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','managerevent','./utils'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x15a8,0x6d));var _0x815a=function(_0x7b575e,_0x12dc3e){_0x7b575e=_0x7b575e-0x0;var _0x5a03e3=_0x15a8[_0x7b575e];return _0x5a03e3;};'use strict';var utils=require(_0x815a('0x0'));exports[_0x815a('0x1')]=function(){utils[_0x815a('0x2')](_0x815a('0x3'));};exports[_0x815a('0x4')]=function(){utils[_0x815a('0x2')](_0x815a('0x5'));};exports[_0x815a('0x6')]=function(){utils[_0x815a('0x2')]('[core]\x20fullybooted');};exports[_0x815a('0x7')]=function(_0x314f67){utils[_0x815a('0x7')](_0x815a('0x8'),_0x314f67);};exports[_0x815a('0x9')]=function(){utils[_0x815a('0x2')]('[core]\x20close');};exports[_0x815a('0xa')]=function(_0x58738b){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d11c499..0d33fb3 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 _0xf9b2=['toLowerCase','set','startsWith','cdr(routeid)','split','error','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','diffTime','endtime','holdtime','starttime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','calleridnum','connectedlinenum','request','uniqueid','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0x54887d,_0x28f067){var _0x4965d8=function(_0x2c3a82){while(--_0x2c3a82){_0x54887d['push'](_0x54887d['shift']());}};_0x4965d8(++_0x28f067);}(_0xf9b2,0xea));var _0x2f9b=function(_0x41dc7f,_0x4553fa){_0x41dc7f=_0x41dc7f-0x0;var _0x4f20af=_0xf9b2[_0x41dc7f];return _0x4f20af;};'use strict';var _=require(_0x2f9b('0x0'));var util=require(_0x2f9b('0x1'));var utils=require(_0x2f9b('0x2'));var dials={};function writeDB(_0x345c2a){utils['info'](util[_0x2f9b('0x3')](_0x2f9b('0x4'),_0x345c2a['uniqueid'],_0x345c2a['channel'],_0x345c2a['dialstring'],_0x345c2a[_0x2f9b('0x5')],_0x345c2a[_0x2f9b('0x6')],_0x345c2a['dialstatus']));utils[_0x2f9b('0x7')]('CreateVoiceDialReport',_0x345c2a);delete dials[_0x345c2a[_0x2f9b('0x8')]];}exports[_0x2f9b('0x9')]=function(_0x4cecf3){try{utils[_0x2f9b('0xa')](util['format'](_0x2f9b('0xb'),_0x4cecf3[_0x2f9b('0x8')]),_0x4cecf3);utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0xd'),_0x4cecf3[_0x2f9b('0x8')],_0x4cecf3[_0x2f9b('0xe')],_0x4cecf3[_0x2f9b('0xf')]));if(_0x4cecf3['application'][_0x2f9b('0x10')]()==_0x2f9b('0x11')&&_[_0x2f9b('0x12')](_0x4cecf3[_0x2f9b('0xf')][_0x2f9b('0x10')](),_0x2f9b('0x13'))){var _0x456464=_0x4cecf3['appdata'][_0x2f9b('0x14')]('=');dials[_0x4cecf3['uniqueid']]={'routeId':_0x456464[0x1]};}}catch(_0x44ae55){utils[_0x2f9b('0x15')](util['format'](_0x2f9b('0xb'),_0x4cecf3['uniqueid']),_0x44ae55);}};exports['varset']=function(_0x5bf817){try{utils[_0x2f9b('0xa')](util[_0x2f9b('0x3')]('[%s][dials][varset]',_0x5bf817['uniqueid']),_0x5bf817);if(!_[_0x2f9b('0x16')](_0x5bf817[_0x2f9b('0x17')][_0x2f9b('0x18')])){utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x19'),_0x5bf817[_0x2f9b('0x8')],_0x5bf817[_0x2f9b('0x1a')]));dials[_0x5bf817[_0x2f9b('0x8')]]={'routeId':_0x5bf817[_0x2f9b('0x1a')]};}}catch(_0x32cc17){utils[_0x2f9b('0x15')](util['format'](_0x2f9b('0x1b'),_0x5bf817['uniqueid']),_0x32cc17);}};exports[_0x2f9b('0x1c')]=function(_0x57d363){try{if(!_['isNil'](dials[_0x57d363[_0x2f9b('0x8')]])){utils[_0x2f9b('0xa')](util[_0x2f9b('0x3')](_0x2f9b('0x1d'),_0x57d363['uniqueid']),_0x57d363);dials[_0x57d363['uniqueid']]=_[_0x2f9b('0x1e')](dials[_0x57d363['uniqueid']],_0x57d363);dials[_0x57d363['uniqueid']]['starttime']=utils[_0x2f9b('0x1f')]();dials[_0x57d363['uniqueid']]['lastevent']=_0x2f9b('0x20');utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x21'),_0x57d363[_0x2f9b('0x8')],dials[_0x57d363[_0x2f9b('0x8')]]['starttime']));}}catch(_0x45b55a){utils[_0x2f9b('0x15')](util[_0x2f9b('0x3')](_0x2f9b('0x1d'),_0x57d363[_0x2f9b('0x8')]),_0x45b55a);}};exports['dialend']=function(_0x40c277){try{if(!_['isNil'](dials[_0x40c277[_0x2f9b('0x8')]])){utils[_0x2f9b('0xa')](util[_0x2f9b('0x3')]('[%s][dials][dialend]',_0x40c277[_0x2f9b('0x8')]),_0x40c277);dials[_0x40c277[_0x2f9b('0x8')]]['dialstatus']=_0x40c277[_0x2f9b('0x22')];if(_0x40c277[_0x2f9b('0x22')]==_0x2f9b('0x23')){dials[_0x40c277[_0x2f9b('0x8')]]=_[_0x2f9b('0x1e')](dials[_0x40c277[_0x2f9b('0x8')]],_0x40c277);dials[_0x40c277[_0x2f9b('0x8')]][_0x2f9b('0x24')]=utils['now']();dials[_0x40c277[_0x2f9b('0x8')]]['lastevent']=_0x2f9b('0x25');utils['info'](util[_0x2f9b('0x3')](_0x2f9b('0x26'),_0x40c277[_0x2f9b('0x8')],_0x40c277['dialstatus'],dials[_0x40c277[_0x2f9b('0x8')]][_0x2f9b('0x24')]));}else{utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x27'),_0x40c277['uniqueid'],_0x40c277[_0x2f9b('0x22')]));}}}catch(_0x4ec5e1){utils['error'](util[_0x2f9b('0x3')](_0x2f9b('0x28'),_0x40c277['uniqueid']),_0x4ec5e1);}};exports[_0x2f9b('0x29')]=function(_0x118947){try{if(!_[_0x2f9b('0x16')](dials[_0x118947[_0x2f9b('0x8')]])){utils[_0x2f9b('0xa')](util['format'](_0x2f9b('0x2a'),_0x118947[_0x2f9b('0x8')]),_0x118947);utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x2b'),_0x118947[_0x2f9b('0x8')],_0x118947[_0x2f9b('0x5')],_0x118947['calleridname'],_0x118947[_0x2f9b('0x2c')]));dials[_0x118947[_0x2f9b('0x8')]]=_['assign'](dials[_0x118947[_0x2f9b('0x8')]],{'endtime':utils[_0x2f9b('0x1f')](),'lastevent':'complete'});dials[_0x118947[_0x2f9b('0x8')]]['duration']=utils[_0x2f9b('0x2d')](dials[_0x118947['uniqueid']][_0x2f9b('0x2e')],dials[_0x118947['uniqueid']]['starttime']);dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x2f')]=utils[_0x2f9b('0x2d')](dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x24')]||dials[_0x118947['uniqueid']][_0x2f9b('0x2e')],dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x30')]);dials[_0x118947['uniqueid']][_0x2f9b('0x31')]=dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x24')]?utils[_0x2f9b('0x2d')](dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x2e')],dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x24')]):0x0;writeDB(dials[_0x118947[_0x2f9b('0x8')]]);}}catch(_0x393c08){utils[_0x2f9b('0x15')](util['format'](_0x2f9b('0x2a'),_0x118947['uniqueid']),_0x393c08);}}; \ No newline at end of file +var _0xc850=['format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','endtime','holdtime','diffTime','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]'];(function(_0x1a2a13,_0x2bd2a6){var _0x366506=function(_0x5cffa9){while(--_0x5cffa9){_0x1a2a13['push'](_0x1a2a13['shift']());}};_0x366506(++_0x2bd2a6);}(_0xc850,0x189));var _0x0c85=function(_0x34bcce,_0x3b1cf0){_0x34bcce=_0x34bcce-0x0;var _0x799430=_0xc850[_0x34bcce];return _0x799430;};'use strict';var _=require(_0x0c85('0x0'));var util=require(_0x0c85('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x5f3baf){utils[_0x0c85('0x2')](util['format'](_0x0c85('0x3'),_0x5f3baf[_0x0c85('0x4')],_0x5f3baf[_0x0c85('0x5')],_0x5f3baf[_0x0c85('0x6')],_0x5f3baf[_0x0c85('0x7')],_0x5f3baf[_0x0c85('0x8')],_0x5f3baf[_0x0c85('0x9')]));utils[_0x0c85('0xa')](_0x0c85('0xb'),_0x5f3baf);delete dials[_0x5f3baf['uniqueid']];}exports[_0x0c85('0xc')]=function(_0x1f5ffc){try{utils[_0x0c85('0xd')](util['format'](_0x0c85('0xe'),_0x1f5ffc[_0x0c85('0x4')]),_0x1f5ffc);utils[_0x0c85('0x2')](util[_0x0c85('0xf')](_0x0c85('0x10'),_0x1f5ffc[_0x0c85('0x4')],_0x1f5ffc[_0x0c85('0x11')],_0x1f5ffc[_0x0c85('0x12')]));if(_0x1f5ffc[_0x0c85('0x11')][_0x0c85('0x13')]()=='set'&&_[_0x0c85('0x14')](_0x1f5ffc[_0x0c85('0x12')][_0x0c85('0x13')](),_0x0c85('0x15'))){var _0x1b2ee8=_0x1f5ffc[_0x0c85('0x12')][_0x0c85('0x16')]('=');dials[_0x1f5ffc['uniqueid']]={'routeId':_0x1b2ee8[0x1]};}}catch(_0x3b8d37){utils[_0x0c85('0x17')](util[_0x0c85('0xf')](_0x0c85('0xe'),_0x1f5ffc[_0x0c85('0x4')]),_0x3b8d37);}};exports[_0x0c85('0x18')]=function(_0x2b6abf){try{utils['debug'](util[_0x0c85('0xf')](_0x0c85('0x19'),_0x2b6abf['uniqueid']),_0x2b6abf);if(!_['isNil'](_0x2b6abf['variable'][_0x0c85('0x1a')])){utils[_0x0c85('0x2')](util[_0x0c85('0xf')](_0x0c85('0x1b'),_0x2b6abf[_0x0c85('0x4')],_0x2b6abf[_0x0c85('0x1c')]));dials[_0x2b6abf['uniqueid']]={'routeId':_0x2b6abf[_0x0c85('0x1c')]};}}catch(_0x6d887d){utils[_0x0c85('0x17')](util['format'](_0x0c85('0x19'),_0x2b6abf['uniqueid']),_0x6d887d);}};exports['dialbegin']=function(_0x52bff4){try{if(!_[_0x0c85('0x1d')](dials[_0x52bff4['uniqueid']])){utils['debug'](util['format'](_0x0c85('0x1e'),_0x52bff4['uniqueid']),_0x52bff4);dials[_0x52bff4[_0x0c85('0x4')]]=_[_0x0c85('0x1f')](dials[_0x52bff4[_0x0c85('0x4')]],_0x52bff4);dials[_0x52bff4[_0x0c85('0x4')]][_0x0c85('0x20')]=utils[_0x0c85('0x21')]();dials[_0x52bff4[_0x0c85('0x4')]][_0x0c85('0x22')]=_0x0c85('0x23');utils[_0x0c85('0x2')](util['format'](_0x0c85('0x24'),_0x52bff4[_0x0c85('0x4')],dials[_0x52bff4[_0x0c85('0x4')]][_0x0c85('0x20')]));}}catch(_0x561829){utils[_0x0c85('0x17')](util[_0x0c85('0xf')]('[%s][dials][dialbegin]',_0x52bff4['uniqueid']),_0x561829);}};exports[_0x0c85('0x25')]=function(_0x5c29fb){try{if(!_[_0x0c85('0x1d')](dials[_0x5c29fb['uniqueid']])){utils[_0x0c85('0xd')](util[_0x0c85('0xf')]('[%s][dials][dialend]',_0x5c29fb[_0x0c85('0x4')]),_0x5c29fb);dials[_0x5c29fb[_0x0c85('0x4')]][_0x0c85('0x9')]=_0x5c29fb[_0x0c85('0x9')];if(_0x5c29fb[_0x0c85('0x9')]=='ANSWER'){dials[_0x5c29fb[_0x0c85('0x4')]]=_[_0x0c85('0x1f')](dials[_0x5c29fb[_0x0c85('0x4')]],_0x5c29fb);dials[_0x5c29fb[_0x0c85('0x4')]][_0x0c85('0x26')]=utils[_0x0c85('0x21')]();dials[_0x5c29fb['uniqueid']]['lastevent']=_0x0c85('0x27');utils[_0x0c85('0x2')](util['format'](_0x0c85('0x28'),_0x5c29fb[_0x0c85('0x4')],_0x5c29fb['dialstatus'],dials[_0x5c29fb[_0x0c85('0x4')]][_0x0c85('0x26')]));}else{utils[_0x0c85('0x2')](util[_0x0c85('0xf')]('[%s][dials][dialend]\x20dialstatus:%s',_0x5c29fb[_0x0c85('0x4')],_0x5c29fb['dialstatus']));}}}catch(_0x2b1ba5){utils[_0x0c85('0x17')](util[_0x0c85('0xf')](_0x0c85('0x29'),_0x5c29fb[_0x0c85('0x4')]),_0x2b1ba5);}};exports[_0x0c85('0x2a')]=function(_0x448139){try{if(!_[_0x0c85('0x1d')](dials[_0x448139[_0x0c85('0x4')]])){utils[_0x0c85('0xd')](util['format'](_0x0c85('0x2b'),_0x448139[_0x0c85('0x4')]),_0x448139);utils['info'](util['format'](_0x0c85('0x2c'),_0x448139[_0x0c85('0x4')],_0x448139['calleridnum'],_0x448139['calleridname'],_0x448139[_0x0c85('0x2d')]));dials[_0x448139[_0x0c85('0x4')]]=_[_0x0c85('0x1f')](dials[_0x448139[_0x0c85('0x4')]],{'endtime':utils[_0x0c85('0x21')](),'lastevent':_0x0c85('0x2e')});dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x2f')]=utils['diffTime'](dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x30')],dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x20')]);dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x31')]=utils[_0x0c85('0x32')](dials[_0x448139['uniqueid']][_0x0c85('0x26')]||dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x30')],dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x20')]);dials[_0x448139[_0x0c85('0x4')]]['billableseconds']=dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x26')]?utils[_0x0c85('0x32')](dials[_0x448139[_0x0c85('0x4')]][_0x0c85('0x30')],dials[_0x448139['uniqueid']][_0x0c85('0x26')]):0x0;writeDB(dials[_0x448139[_0x0c85('0x4')]]);}}catch(_0x448f09){utils[_0x0c85('0x17')](util[_0x0c85('0xf')](_0x0c85('0x2b'),_0x448139[_0x0c85('0x4')]),_0x448f09);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b8dbb87..40475cb 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 _0x5a75=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','asterisk','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x5a75,0x1af));var _0x55a7=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x5a75[_0x4f08dd];return _0x3017ee;};var AsteriskManager=require(_0x55a7('0x0'));var config=require('../../config/environment');var utils=require(_0x55a7('0x1'));var util=require(_0x55a7('0x2'));var isXDREnabled=config['xdr']&&config[_0x55a7('0x3')][_0x55a7('0x4')]?!config[_0x55a7('0x3')]['disabled']:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x55a7('0x3')]&&config[_0x55a7('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x55a7('0x5')]['port'],config[_0x55a7('0x5')]['ip'],config[_0x55a7('0x5')]['username'],config[_0x55a7('0x5')][_0x55a7('0x6')],!![]);ami[_0x55a7('0x7')]();if(!isXDREnabled){utils[_0x55a7('0x8')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x55a7('0x8')](_0x55a7('0x9'));}else{var agents=require(_0x55a7('0xa'));var calls=require(_0x55a7('0xb'));var queues=require(_0x55a7('0xc'));var recordings=require(_0x55a7('0xd'));var members=require(_0x55a7('0xe'));var dials=require(_0x55a7('0xf'));var transfers=require(_0x55a7('0x10'));var core=require(_0x55a7('0x11'));ami['on'](_0x55a7('0x12'),core['connect']);ami['on'](_0x55a7('0x13'),core[_0x55a7('0x13')]);ami['on'](_0x55a7('0x14'),core['fullybooted']);ami['on'](_0x55a7('0x15'),core['error']);ami['on'](_0x55a7('0x16'),core[_0x55a7('0x16')]);ami['on'](_0x55a7('0x17'),core[_0x55a7('0x17')]);ami['on'](_0x55a7('0x18'),function(_0x1edccc){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x1b'),_0x1edccc['device']),_0x1edccc);members[_0x55a7('0x18')](_0x1edccc);}catch(_0xf0db0c){utils[_0x55a7('0x15')](util['format'](_0x55a7('0x1b'),_0x1edccc[_0x55a7('0x1c')]),_0xf0db0c);}});ami['on'](_0x55a7('0x1d'),function(_0x6dd328){try{utils['debug'](util['format'](_0x55a7('0x1e'),_0x6dd328[_0x55a7('0x1f')]),_0x6dd328);agents[_0x55a7('0x1d')](_0x6dd328);}catch(_0x2ed9de){utils['error'](util[_0x55a7('0x1a')](_0x55a7('0x1e'),_0x6dd328['uniqueid']),_0x2ed9de);}});ami['on']('agentringnoanswer',function(_0x5b874e){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')]('[%s][index][agentringnoanswer]',_0x5b874e[_0x55a7('0x1f')]),_0x5b874e);agents[_0x55a7('0x20')](_0x5b874e);}catch(_0x4070f5){utils['error'](util['format'](_0x55a7('0x21'),_0x5b874e['uniqueid']),_0x4070f5);}});ami['on'](_0x55a7('0x22'),function(_0x33616a){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x23'),_0x33616a[_0x55a7('0x1f')]),_0x33616a);agents[_0x55a7('0x22')](_0x33616a);queues[_0x55a7('0x22')](_0x33616a);}catch(_0x5d8bb2){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x23'),_0x33616a[_0x55a7('0x1f')]),_0x5d8bb2);}});ami['on'](_0x55a7('0x24'),function(_0x44a294){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x25'),_0x44a294[_0x55a7('0x1f')]),_0x44a294);agents[_0x55a7('0x24')](_0x44a294);queues[_0x55a7('0x24')](_0x44a294);members[_0x55a7('0x24')](_0x44a294);}catch(_0x291cad){utils[_0x55a7('0x15')](util['format']('[%s][index][agentcomplete]',_0x44a294[_0x55a7('0x1f')]),_0x291cad);}});ami['on']('queuecallerabandon',function(_0x421ca8){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')]('[%s][index][queuecallerabandon]',_0x421ca8[_0x55a7('0x1f')]),_0x421ca8);agents['queuecallerabandon'](_0x421ca8);queues[_0x55a7('0x26')](_0x421ca8);}catch(_0x4912aa){utils['error'](util[_0x55a7('0x1a')](_0x55a7('0x27'),_0x421ca8[_0x55a7('0x1f')]),_0x4912aa);}});ami['on'](_0x55a7('0x28'),function(_0x47941e){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x29'),_0x47941e[_0x55a7('0x1f')]),_0x47941e);queues['queuecallerjoin'](_0x47941e);recordings['queuecallerjoin'](_0x47941e);}catch(_0xddd70d){utils['error'](util['format'](_0x55a7('0x29'),_0x47941e[_0x55a7('0x1f')]),_0xddd70d);}});ami['on']('queuecallerleave',function(_0x2cd2bf){try{utils['debug'](util[_0x55a7('0x1a')](_0x55a7('0x2a'),_0x2cd2bf[_0x55a7('0x1f')]),_0x2cd2bf);queues[_0x55a7('0x2b')](_0x2cd2bf);}catch(_0x51ac6e){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')]('[%s][index][queuecallerleave]',_0x2cd2bf[_0x55a7('0x1f')]),_0x51ac6e);}});ami['on'](_0x55a7('0x2c'),function(_0x4375ef){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x2d'),_0x4375ef[_0x55a7('0x1f')]),_0x4375ef);queues[_0x55a7('0x2c')](_0x4375ef);calls[_0x55a7('0x2c')](_0x4375ef);}catch(_0x73911d){utils[_0x55a7('0x15')](util['format']('[%s][index][musiconholdstart]',_0x4375ef[_0x55a7('0x1f')]),_0x73911d);}});ami['on']('musiconholdstop',function(_0x295bfb){try{utils[_0x55a7('0x19')](util['format'](_0x55a7('0x2e'),_0x295bfb['uniqueid']),_0x295bfb);queues[_0x55a7('0x2f')](_0x295bfb);calls[_0x55a7('0x2f')](_0x295bfb);}catch(_0x281e0a){utils[_0x55a7('0x15')](util['format'](_0x55a7('0x2e'),_0x295bfb[_0x55a7('0x1f')]),_0x281e0a);}});ami['on'](_0x55a7('0x30'),function(_0x2dbbf8){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x31'),_0x2dbbf8[_0x55a7('0x1f')]),_0x2dbbf8);calls[_0x55a7('0x30')](_0x2dbbf8);recordings['newstate'](_0x2dbbf8);}catch(_0x232b43){utils['error'](util[_0x55a7('0x1a')](_0x55a7('0x31'),_0x2dbbf8[_0x55a7('0x1f')]),_0x232b43);}});ami['on'](_0x55a7('0x32'),function(_0x21c5ef){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x33'),_0x21c5ef[_0x55a7('0x1f')]),_0x21c5ef);calls['hangup'](_0x21c5ef);recordings[_0x55a7('0x32')](_0x21c5ef);dials[_0x55a7('0x32')](_0x21c5ef);agents['hangup'](_0x21c5ef);queues['hangup'](_0x21c5ef);}catch(_0x4b4e03){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x33'),_0x21c5ef[_0x55a7('0x1f')]),_0x4b4e03);}});ami['on']('cdr',function(_0x175b08){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x34'),_0x175b08['uniqueid']),_0x175b08);members['cdr'](_0x175b08);}catch(_0x2e4fab){utils['error'](util['format'](_0x55a7('0x34'),_0x175b08[_0x55a7('0x1f')]),_0x2e4fab);}});ami['on'](_0x55a7('0x35'),function(_0x775b31){try{utils['debug'](util['format'](_0x55a7('0x36'),_0x775b31[_0x55a7('0x1f')]),_0x775b31);queues[_0x55a7('0x35')](_0x775b31);agents[_0x55a7('0x35')](_0x775b31);transfers[_0x55a7('0x35')](_0x775b31);}catch(_0x5bc7bd){utils['error'](util['format'](_0x55a7('0x36'),_0x775b31[_0x55a7('0x1f')]),_0x5bc7bd);}});ami['on']('attendedtransfer',function(_0x19898c){try{utils[_0x55a7('0x19')](util['format'](_0x55a7('0x37'),_0x19898c[_0x55a7('0x38')]),_0x19898c);queues['attendedtransfer'](_0x19898c);transfers[_0x55a7('0x39')](_0x19898c);agents[_0x55a7('0x39')](_0x19898c);calls[_0x55a7('0x39')](_0x19898c);}catch(_0x52727d){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x37'),_0x19898c[_0x55a7('0x38')]),_0x52727d);}});ami['on'](_0x55a7('0x3a'),function(_0x2f3728){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x3b'),_0x2f3728[_0x55a7('0x1f')]),_0x2f3728);queues['varset'](_0x2f3728);recordings[_0x55a7('0x3a')](_0x2f3728);calls[_0x55a7('0x3a')](_0x2f3728);dials['varset'](_0x2f3728);}catch(_0x2cb7e1){utils[_0x55a7('0x15')](util['format'](_0x55a7('0x3b'),_0x2f3728[_0x55a7('0x1f')]),_0x2cb7e1);}});ami['on']('newexten',function(_0x2bfef9){try{utils['debug'](util['format'](_0x55a7('0x3c'),_0x2bfef9[_0x55a7('0x1f')]),_0x2bfef9);calls[_0x55a7('0x3d')](_0x2bfef9);recordings[_0x55a7('0x3d')](_0x2bfef9);dials['newexten'](_0x2bfef9);}catch(_0x107420){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x3c'),_0x2bfef9['uniqueid']),_0x107420);}});ami['on'](_0x55a7('0x3e'),function(_0x42654c){try{utils['debug'](util[_0x55a7('0x1a')](_0x55a7('0x3f'),_0x42654c['uniqueid']),_0x42654c);calls[_0x55a7('0x3e')](_0x42654c);recordings[_0x55a7('0x3e')](_0x42654c);}catch(_0x5cf039){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')]('[%s][index][newchannel]',_0x42654c[_0x55a7('0x1f')]),_0x5cf039);}});ami['on']('dialbegin',function(_0x322326){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x40'),_0x322326[_0x55a7('0x1f')]),_0x322326);dials[_0x55a7('0x41')](_0x322326);}catch(_0x5b2039){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x42'),_0x322326[_0x55a7('0x1f')]),_0x5b2039);}});ami['on'](_0x55a7('0x43'),function(_0x2e64f9){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')]('[%s][index][dialend]',_0x2e64f9[_0x55a7('0x1f')]),_0x2e64f9);dials['dialend'](_0x2e64f9);}catch(_0x3d9bf6){utils['error'](util['format'](_0x55a7('0x44'),_0x2e64f9[_0x55a7('0x1f')]),_0x3d9bf6);}});} \ No newline at end of file +var _0x0641=['[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','xdr','disabled','env','production','local','port','asterisk','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin'];(function(_0x3909fe,_0x1843ea){var _0xc60c08=function(_0xd40c){while(--_0xd40c){_0x3909fe['push'](_0x3909fe['shift']());}};_0xc60c08(++_0x1843ea);}(_0x0641,0x157));var _0x1064=function(_0x5e3fee,_0x3e96e5){_0x5e3fee=_0x5e3fee-0x0;var _0x2b43a6=_0x0641[_0x5e3fee];return _0x2b43a6;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1064('0x0'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0x1064('0x1')]&&config[_0x1064('0x1')][_0x1064('0x2')]?!config[_0x1064('0x1')]['disabled']:!![];var isProduction=config[_0x1064('0x3')]===_0x1064('0x4')||![];var isLocalAsterisk=config[_0x1064('0x1')]&&config['xdr'][_0x1064('0x5')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x1064('0x6')],config[_0x1064('0x7')]['ip'],config[_0x1064('0x7')]['username'],config[_0x1064('0x7')]['password'],!![]);ami[_0x1064('0x8')]();if(!isXDREnabled){utils[_0x1064('0x9')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x1064('0x9')](_0x1064('0xa'));}else{var agents=require(_0x1064('0xb'));var calls=require(_0x1064('0xc'));var queues=require(_0x1064('0xd'));var recordings=require(_0x1064('0xe'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x1064('0xf'));var core=require(_0x1064('0x10'));ami['on'](_0x1064('0x11'),core[_0x1064('0x11')]);ami['on'](_0x1064('0x12'),core['shutdown']);ami['on']('fullybooted',core[_0x1064('0x13')]);ami['on'](_0x1064('0x14'),core[_0x1064('0x14')]);ami['on']('close',core[_0x1064('0x15')]);ami['on']('managerevent',core[_0x1064('0x16')]);ami['on'](_0x1064('0x17'),function(_0x207860){try{utils['debug'](util['format'](_0x1064('0x18'),_0x207860[_0x1064('0x19')]),_0x207860);members[_0x1064('0x17')](_0x207860);}catch(_0x417dee){utils[_0x1064('0x14')](util[_0x1064('0x1a')](_0x1064('0x18'),_0x207860[_0x1064('0x19')]),_0x417dee);}});ami['on'](_0x1064('0x1b'),function(_0x62702c){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x1d'),_0x62702c['uniqueid']),_0x62702c);agents[_0x1064('0x1b')](_0x62702c);}catch(_0x2d22d7){utils[_0x1064('0x14')](util['format'](_0x1064('0x1d'),_0x62702c[_0x1064('0x1e')]),_0x2d22d7);}});ami['on'](_0x1064('0x1f'),function(_0xe0de76){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x20'),_0xe0de76[_0x1064('0x1e')]),_0xe0de76);agents[_0x1064('0x1f')](_0xe0de76);}catch(_0x3caa27){utils[_0x1064('0x14')](util['format'](_0x1064('0x20'),_0xe0de76[_0x1064('0x1e')]),_0x3caa27);}});ami['on']('agentconnect',function(_0x583fd8){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x21'),_0x583fd8[_0x1064('0x1e')]),_0x583fd8);agents['agentconnect'](_0x583fd8);queues[_0x1064('0x22')](_0x583fd8);}catch(_0x2bad1f){utils[_0x1064('0x14')](util['format'](_0x1064('0x21'),_0x583fd8[_0x1064('0x1e')]),_0x2bad1f);}});ami['on'](_0x1064('0x23'),function(_0x594f4a){try{utils[_0x1064('0x1c')](util['format'](_0x1064('0x24'),_0x594f4a[_0x1064('0x1e')]),_0x594f4a);agents[_0x1064('0x23')](_0x594f4a);queues[_0x1064('0x23')](_0x594f4a);members[_0x1064('0x23')](_0x594f4a);}catch(_0xa687d4){utils['error'](util[_0x1064('0x1a')](_0x1064('0x24'),_0x594f4a[_0x1064('0x1e')]),_0xa687d4);}});ami['on'](_0x1064('0x25'),function(_0x3642ef){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x26'),_0x3642ef[_0x1064('0x1e')]),_0x3642ef);agents['queuecallerabandon'](_0x3642ef);queues[_0x1064('0x25')](_0x3642ef);}catch(_0x2f5a32){utils[_0x1064('0x14')](util['format'](_0x1064('0x26'),_0x3642ef['uniqueid']),_0x2f5a32);}});ami['on'](_0x1064('0x27'),function(_0x59b394){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x28'),_0x59b394[_0x1064('0x1e')]),_0x59b394);queues['queuecallerjoin'](_0x59b394);recordings[_0x1064('0x27')](_0x59b394);}catch(_0x317e6b){utils[_0x1064('0x14')](util['format'](_0x1064('0x28'),_0x59b394[_0x1064('0x1e')]),_0x317e6b);}});ami['on'](_0x1064('0x29'),function(_0x17741a){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')]('[%s][index][queuecallerleave]',_0x17741a[_0x1064('0x1e')]),_0x17741a);queues[_0x1064('0x29')](_0x17741a);}catch(_0x3c2397){utils['error'](util[_0x1064('0x1a')](_0x1064('0x2a'),_0x17741a['uniqueid']),_0x3c2397);}});ami['on'](_0x1064('0x2b'),function(_0x52d57a){try{utils['debug'](util['format'](_0x1064('0x2c'),_0x52d57a[_0x1064('0x1e')]),_0x52d57a);queues[_0x1064('0x2b')](_0x52d57a);calls[_0x1064('0x2b')](_0x52d57a);}catch(_0x3a5cb2){utils['error'](util[_0x1064('0x1a')](_0x1064('0x2c'),_0x52d57a[_0x1064('0x1e')]),_0x3a5cb2);}});ami['on'](_0x1064('0x2d'),function(_0x4b53da){try{utils[_0x1064('0x1c')](util['format']('[%s][index][musiconholdstop]',_0x4b53da[_0x1064('0x1e')]),_0x4b53da);queues[_0x1064('0x2d')](_0x4b53da);calls[_0x1064('0x2d')](_0x4b53da);}catch(_0x4e532d){utils[_0x1064('0x14')](util[_0x1064('0x1a')](_0x1064('0x2e'),_0x4b53da[_0x1064('0x1e')]),_0x4e532d);}});ami['on'](_0x1064('0x2f'),function(_0x3e8653){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x30'),_0x3e8653[_0x1064('0x1e')]),_0x3e8653);calls[_0x1064('0x2f')](_0x3e8653);recordings[_0x1064('0x2f')](_0x3e8653);}catch(_0x59b85f){utils[_0x1064('0x14')](util[_0x1064('0x1a')](_0x1064('0x30'),_0x3e8653[_0x1064('0x1e')]),_0x59b85f);}});ami['on'](_0x1064('0x31'),function(_0x2172c0){try{utils[_0x1064('0x1c')](util['format'](_0x1064('0x32'),_0x2172c0[_0x1064('0x1e')]),_0x2172c0);calls[_0x1064('0x31')](_0x2172c0);recordings[_0x1064('0x31')](_0x2172c0);dials['hangup'](_0x2172c0);agents[_0x1064('0x31')](_0x2172c0);queues[_0x1064('0x31')](_0x2172c0);}catch(_0x28bd41){utils[_0x1064('0x14')](util[_0x1064('0x1a')](_0x1064('0x32'),_0x2172c0[_0x1064('0x1e')]),_0x28bd41);}});ami['on']('cdr',function(_0x331ada){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x33'),_0x331ada['uniqueid']),_0x331ada);members['cdr'](_0x331ada);}catch(_0x312ff7){utils[_0x1064('0x14')](util[_0x1064('0x1a')](_0x1064('0x33'),_0x331ada['uniqueid']),_0x312ff7);}});ami['on'](_0x1064('0x34'),function(_0x320159){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x35'),_0x320159['uniqueid']),_0x320159);queues[_0x1064('0x34')](_0x320159);agents[_0x1064('0x34')](_0x320159);transfers[_0x1064('0x34')](_0x320159);}catch(_0x41fe53){utils['error'](util[_0x1064('0x1a')]('[%s][index][blindtransfer]',_0x320159['uniqueid']),_0x41fe53);}});ami['on'](_0x1064('0x36'),function(_0x3ef9d6){try{utils['debug'](util[_0x1064('0x1a')](_0x1064('0x37'),_0x3ef9d6[_0x1064('0x38')]),_0x3ef9d6);queues[_0x1064('0x36')](_0x3ef9d6);transfers['attendedtransfer'](_0x3ef9d6);agents['attendedtransfer'](_0x3ef9d6);calls[_0x1064('0x36')](_0x3ef9d6);}catch(_0x180e82){utils[_0x1064('0x14')](util['format'](_0x1064('0x37'),_0x3ef9d6[_0x1064('0x38')]),_0x180e82);}});ami['on']('varset',function(_0x2d0063){try{utils['debug'](util['format'](_0x1064('0x39'),_0x2d0063[_0x1064('0x1e')]),_0x2d0063);queues[_0x1064('0x3a')](_0x2d0063);recordings[_0x1064('0x3a')](_0x2d0063);calls[_0x1064('0x3a')](_0x2d0063);dials[_0x1064('0x3a')](_0x2d0063);}catch(_0x1b80a6){utils[_0x1064('0x14')](util[_0x1064('0x1a')](_0x1064('0x39'),_0x2d0063[_0x1064('0x1e')]),_0x1b80a6);}});ami['on'](_0x1064('0x3b'),function(_0x482bb2){try{utils['debug'](util[_0x1064('0x1a')](_0x1064('0x3c'),_0x482bb2['uniqueid']),_0x482bb2);calls[_0x1064('0x3b')](_0x482bb2);recordings[_0x1064('0x3b')](_0x482bb2);dials[_0x1064('0x3b')](_0x482bb2);}catch(_0x5412c8){utils['error'](util[_0x1064('0x1a')]('[%s][index][newexten]',_0x482bb2['uniqueid']),_0x5412c8);}});ami['on'](_0x1064('0x3d'),function(_0x501890){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')](_0x1064('0x3e'),_0x501890[_0x1064('0x1e')]),_0x501890);calls[_0x1064('0x3d')](_0x501890);recordings[_0x1064('0x3d')](_0x501890);}catch(_0x286842){utils[_0x1064('0x14')](util['format'](_0x1064('0x3e'),_0x501890[_0x1064('0x1e')]),_0x286842);}});ami['on']('dialbegin',function(_0x151668){try{utils[_0x1064('0x1c')](util['format'](_0x1064('0x3f'),_0x151668['uniqueid']),_0x151668);dials[_0x1064('0x40')](_0x151668);}catch(_0x42acdf){utils[_0x1064('0x14')](util['format'](_0x1064('0x41'),_0x151668['uniqueid']),_0x42acdf);}});ami['on'](_0x1064('0x42'),function(_0x2dd56a){try{utils[_0x1064('0x1c')](util[_0x1064('0x1a')]('[%s][index][dialend]',_0x2dd56a[_0x1064('0x1e')]),_0x2dd56a);dials['dialend'](_0x2dd56a);}catch(_0x52e508){utils[_0x1064('0x14')](util[_0x1064('0x1a')](_0x1064('0x43'),_0x2dd56a[_0x1064('0x1e')]),_0x52e508);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 337734e..f6064fb 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 _0x8f69=['isNil','exitAt','now','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','source','error','lodash','util','./utils','Queue:','info','uniqueid','channel','data2','membername','type','getUserByInterface','interface','then','internal','request','CreateMemberReport','split','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','[%s][members][devicestatechange]','device','state','INUSE','BUSY','TALKING','agent','NOT_INUSE'];(function(_0x4f6cc2,_0x406ed8){var _0x3c56b3=function(_0x5a6cfb){while(--_0x5a6cfb){_0x4f6cc2['push'](_0x4f6cc2['shift']());}};_0x3c56b3(++_0x406ed8);}(_0x8f69,0xfa));var _0x98f6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8f69[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x98f6('0x0'));var util=require(_0x98f6('0x1'));var utils=require(_0x98f6('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x98f6('0x3')];function writeDB(_0x2641ae){utils[_0x98f6('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2641ae[_0x98f6('0x5')],_0x2641ae['interface'],_0x2641ae[_0x98f6('0x6')],_0x2641ae[_0x98f6('0x7')],_0x2641ae[_0x98f6('0x8')],_0x2641ae[_0x98f6('0x9')]));if(_0x2641ae['interface']){utils[_0x98f6('0xa')](_0x2641ae[_0x98f6('0xb')])[_0x98f6('0xc')](function(_0x1055c9){if(_0x1055c9){_0x2641ae[_0x98f6('0x8')]=_0x1055c9['name'];_0x2641ae[_0x98f6('0xd')]=_0x1055c9[_0x98f6('0xd')];utils[_0x98f6('0xe')](_0x98f6('0xf'),_0x2641ae);}else{utils['getUserByName'](_0x2641ae[_0x98f6('0xb')][_0x98f6('0x10')]('/')[0x1])[_0x98f6('0xc')](function(_0x5c997b){if(_0x5c997b){_0x2641ae[_0x98f6('0x8')]=_0x5c997b['name'];_0x2641ae[_0x98f6('0xd')]=_0x5c997b['internal'];utils[_0x98f6('0xe')](_0x98f6('0xf'),_0x2641ae);}});}})[_0x98f6('0x11')](function(_0x537c00){utils['error'](util['format'](_0x98f6('0x12'),_0x2641ae[_0x98f6('0x5')]),_0x537c00);});}delete members[_0x2641ae[_0x98f6('0xb')]];}function startsWith(_0x274fed,_0x44dfb2){return _[_0x98f6('0x13')](_0x274fed,function(_0x19b67c){return _[_0x98f6('0x14')](_0x44dfb2,_0x19b67c);});}exports[_0x98f6('0x15')]=function(_0x2a7ded){try{utils[_0x98f6('0x16')](util[_0x98f6('0x17')](_0x98f6('0x18'),members[_0x2a7ded[_0x98f6('0x19')]]?members[_0x2a7ded[_0x98f6('0x19')]]['uniqueid']:_0x2a7ded[_0x98f6('0x19')]),_0x2a7ded);utils[_0x98f6('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x2a7ded[_0x98f6('0x19')]]?members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x5')]:_0x2a7ded[_0x98f6('0x19')],_0x2a7ded[_0x98f6('0x1a')],_0x2a7ded[_0x98f6('0x19')]));switch(_0x2a7ded['state']){case _0x98f6('0x1b'):case _0x98f6('0x1c'):if(!startsWith(exclude,_0x2a7ded[_0x98f6('0x19')])){members[_0x2a7ded['device']]={'channel':'voice','interface':_0x2a7ded[_0x98f6('0x19')],'type':_0x98f6('0x1d'),'enterAt':utils['now'](),'role':_0x98f6('0x1e')};}break;case _0x98f6('0x1f'):if(!_[_0x98f6('0x20')](members[_0x2a7ded[_0x98f6('0x19')]])){members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x21')]=utils[_0x98f6('0x22')]();members[_0x2a7ded[_0x98f6('0x19')]]['duration']=utils[_0x98f6('0x23')](members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x21')],members[_0x2a7ded[_0x98f6('0x19')]]['enterAt']);if(members[_0x2a7ded['device']]['uniqueid']){writeDB(members[_0x2a7ded['device']]);}}break;default:break;}}catch(_0x224c13){utils['error'](util[_0x98f6('0x17')](_0x98f6('0x18'),members[_0x2a7ded[_0x98f6('0x19')]]?members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x5')]:_0x2a7ded[_0x98f6('0x19')]),_0x224c13);}};exports[_0x98f6('0x24')]=function(_0x5877ea){try{if(!_[_0x98f6('0x20')](members[_0x5877ea['interface']])){utils[_0x98f6('0x16')](util[_0x98f6('0x17')](_0x98f6('0x25'),_0x5877ea['uniqueid']),_0x5877ea);utils[_0x98f6('0x4')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5877ea[_0x98f6('0x5')],_0x5877ea[_0x98f6('0xb')],_0x5877ea[_0x98f6('0x26')]));members[_0x5877ea[_0x98f6('0xb')]]=_[_0x98f6('0x27')](members[_0x5877ea['interface']],{'data4':_0x5877ea[_0x98f6('0x26')],'uniqueid':_0x5877ea[_0x98f6('0x5')]});}}catch(_0x28ad97){utils['error'](util[_0x98f6('0x17')]('[%s][members][agentcomplete]',_0x5877ea['uniqueid']),_0x28ad97);}};exports[_0x98f6('0x28')]=function(_0x4e27c8){try{utils[_0x98f6('0x16')](util[_0x98f6('0x17')]('[%s][members][cdr]',_0x4e27c8['uniqueid']),_0x4e27c8);if(_0x4e27c8[_0x98f6('0x6')]){var _0x1c3cea=_0x4e27c8['channel'][_0x98f6('0x10')]('-')[0x0];if(!_[_0x98f6('0x20')](members[_0x1c3cea])){members[_0x1c3cea]=_[_0x98f6('0x27')](members[_0x1c3cea],{'data1':members[_0x1c3cea][_0x98f6('0x29')]||_0x4e27c8[_0x98f6('0x9')],'data2':members[_0x1c3cea][_0x98f6('0x7')]||_0x4e27c8['source'],'data3':members[_0x1c3cea][_0x98f6('0x2a')]||_0x4e27c8[_0x98f6('0x2b')],'uniqueid':members[_0x1c3cea][_0x98f6('0x5')]||_0x4e27c8[_0x98f6('0x5')]});utils[_0x98f6('0x4')](util['format'](_0x98f6('0x2c'),_0x4e27c8['uniqueid'],members[_0x1c3cea][_0x98f6('0x29')],members[_0x1c3cea]['data2'],members[_0x1c3cea]['data3']));if(members[_0x1c3cea][_0x98f6('0x21')]){writeDB(members[_0x1c3cea]);}}}if(_0x4e27c8['destinationchannel']){var _0x597b08=_0x4e27c8['destinationchannel'][_0x98f6('0x10')]('-')[0x0];if(!_[_0x98f6('0x20')](members[_0x597b08])){members[_0x597b08]=_['assign'](members[_0x597b08],{'data1':members[_0x597b08][_0x98f6('0x29')]||_0x4e27c8['type'],'data2':members[_0x597b08][_0x98f6('0x7')]||_0x4e27c8[_0x98f6('0x2d')],'data3':members[_0x597b08]['data3']||_0x4e27c8['destination'],'uniqueid':members[_0x597b08][_0x98f6('0x5')]||_0x4e27c8['uniqueid']});utils['info'](util[_0x98f6('0x17')](_0x98f6('0x2c'),_0x4e27c8['uniqueid'],members[_0x597b08][_0x98f6('0x29')],members[_0x597b08][_0x98f6('0x7')],members[_0x597b08][_0x98f6('0x2a')]));if(members[_0x597b08]['exitAt']){writeDB(members[_0x597b08]);}}}}catch(_0x5701eb){utils[_0x98f6('0x2e')](util[_0x98f6('0x17')]('[%s][members][cdr]',_0x4e27c8[_0x98f6('0x5')]),_0x5701eb);}}; \ No newline at end of file +var _0x581a=['[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','uniqueid','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','channel','data1','data3','destination','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','info','format','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','debug'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x581a,0x127));var _0xa581=function(_0x2f4a68,_0x561a0f){_0x2f4a68=_0x2f4a68-0x0;var _0x176f12=_0x581a[_0x2f4a68];return _0x176f12;};'use strict';var _=require(_0xa581('0x0'));var util=require(_0xa581('0x1'));var utils=require('./utils');var members={};var exclude=[_0xa581('0x2'),_0xa581('0x3')];function writeDB(_0xbe2ff0){utils[_0xa581('0x4')](util[_0xa581('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0xbe2ff0['uniqueid'],_0xbe2ff0[_0xa581('0x6')],_0xbe2ff0['channel'],_0xbe2ff0[_0xa581('0x7')],_0xbe2ff0[_0xa581('0x8')],_0xbe2ff0[_0xa581('0x9')]));if(_0xbe2ff0[_0xa581('0x6')]){utils[_0xa581('0xa')](_0xbe2ff0[_0xa581('0x6')])[_0xa581('0xb')](function(_0x2b5763){if(_0x2b5763){_0xbe2ff0[_0xa581('0x8')]=_0x2b5763[_0xa581('0xc')];_0xbe2ff0[_0xa581('0xd')]=_0x2b5763['internal'];utils[_0xa581('0xe')](_0xa581('0xf'),_0xbe2ff0);}else{utils[_0xa581('0x10')](_0xbe2ff0[_0xa581('0x6')][_0xa581('0x11')]('/')[0x1])[_0xa581('0xb')](function(_0x41494e){if(_0x41494e){_0xbe2ff0['membername']=_0x41494e[_0xa581('0xc')];_0xbe2ff0[_0xa581('0xd')]=_0x41494e[_0xa581('0xd')];utils[_0xa581('0xe')](_0xa581('0xf'),_0xbe2ff0);}});}})['catch'](function(_0x38e03d){utils[_0xa581('0x12')](util[_0xa581('0x5')](_0xa581('0x13'),_0xbe2ff0['uniqueid']),_0x38e03d);});}delete members[_0xbe2ff0['interface']];}function startsWith(_0x57d86e,_0x27bf02){return _[_0xa581('0x14')](_0x57d86e,function(_0x35669d){return _[_0xa581('0x15')](_0x27bf02,_0x35669d);});}exports['devicestatechange']=function(_0x2aa492){try{utils[_0xa581('0x16')](util[_0xa581('0x5')](_0xa581('0x17'),members[_0x2aa492[_0xa581('0x18')]]?members[_0x2aa492[_0xa581('0x18')]]['uniqueid']:_0x2aa492['device']),_0x2aa492);utils[_0xa581('0x4')](util[_0xa581('0x5')](_0xa581('0x19'),members[_0x2aa492['device']]?members[_0x2aa492[_0xa581('0x18')]][_0xa581('0x1a')]:_0x2aa492[_0xa581('0x18')],_0x2aa492[_0xa581('0x1b')],_0x2aa492[_0xa581('0x18')]));switch(_0x2aa492[_0xa581('0x1b')]){case _0xa581('0x1c'):case _0xa581('0x1d'):if(!startsWith(exclude,_0x2aa492[_0xa581('0x18')])){members[_0x2aa492[_0xa581('0x18')]]={'channel':_0xa581('0x1e'),'interface':_0x2aa492[_0xa581('0x18')],'type':_0xa581('0x1f'),'enterAt':utils['now'](),'role':_0xa581('0x20')};}break;case _0xa581('0x21'):if(!_[_0xa581('0x22')](members[_0x2aa492[_0xa581('0x18')]])){members[_0x2aa492[_0xa581('0x18')]][_0xa581('0x23')]=utils[_0xa581('0x24')]();members[_0x2aa492[_0xa581('0x18')]][_0xa581('0x25')]=utils[_0xa581('0x26')](members[_0x2aa492[_0xa581('0x18')]][_0xa581('0x23')],members[_0x2aa492[_0xa581('0x18')]][_0xa581('0x27')]);if(members[_0x2aa492[_0xa581('0x18')]][_0xa581('0x1a')]){writeDB(members[_0x2aa492['device']]);}}break;default:break;}}catch(_0x2ab39d){utils[_0xa581('0x12')](util[_0xa581('0x5')]('[%s][members][devicestatechange]',members[_0x2aa492[_0xa581('0x18')]]?members[_0x2aa492[_0xa581('0x18')]][_0xa581('0x1a')]:_0x2aa492[_0xa581('0x18')]),_0x2ab39d);}};exports[_0xa581('0x28')]=function(_0x595bf1){try{if(!_[_0xa581('0x22')](members[_0x595bf1['interface']])){utils[_0xa581('0x16')](util['format'](_0xa581('0x29'),_0x595bf1[_0xa581('0x1a')]),_0x595bf1);utils[_0xa581('0x4')](util[_0xa581('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x595bf1[_0xa581('0x1a')],_0x595bf1[_0xa581('0x6')],_0x595bf1[_0xa581('0x2a')]));members[_0x595bf1['interface']]=_[_0xa581('0x2b')](members[_0x595bf1[_0xa581('0x6')]],{'data4':_0x595bf1[_0xa581('0x2a')],'uniqueid':_0x595bf1[_0xa581('0x1a')]});}}catch(_0x3aecc6){utils['error'](util[_0xa581('0x5')](_0xa581('0x29'),_0x595bf1[_0xa581('0x1a')]),_0x3aecc6);}};exports[_0xa581('0x2c')]=function(_0x54960f){try{utils[_0xa581('0x16')](util[_0xa581('0x5')](_0xa581('0x2d'),_0x54960f[_0xa581('0x1a')]),_0x54960f);if(_0x54960f['channel']){var _0x6a8894=_0x54960f[_0xa581('0x2e')][_0xa581('0x11')]('-')[0x0];if(!_['isNil'](members[_0x6a8894])){members[_0x6a8894]=_['assign'](members[_0x6a8894],{'data1':members[_0x6a8894][_0xa581('0x2f')]||_0x54960f[_0xa581('0x9')],'data2':members[_0x6a8894]['data2']||_0x54960f['source'],'data3':members[_0x6a8894][_0xa581('0x30')]||_0x54960f[_0xa581('0x31')],'uniqueid':members[_0x6a8894]['uniqueid']||_0x54960f[_0xa581('0x1a')]});utils[_0xa581('0x4')](util[_0xa581('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x54960f['uniqueid'],members[_0x6a8894][_0xa581('0x2f')],members[_0x6a8894][_0xa581('0x7')],members[_0x6a8894][_0xa581('0x30')]));if(members[_0x6a8894][_0xa581('0x23')]){writeDB(members[_0x6a8894]);}}}if(_0x54960f[_0xa581('0x32')]){var _0x22d331=_0x54960f[_0xa581('0x32')][_0xa581('0x11')]('-')[0x0];if(!_[_0xa581('0x22')](members[_0x22d331])){members[_0x22d331]=_[_0xa581('0x2b')](members[_0x22d331],{'data1':members[_0x22d331][_0xa581('0x2f')]||_0x54960f[_0xa581('0x9')],'data2':members[_0x22d331]['data2']||_0x54960f[_0xa581('0x33')],'data3':members[_0x22d331][_0xa581('0x30')]||_0x54960f[_0xa581('0x31')],'uniqueid':members[_0x22d331][_0xa581('0x1a')]||_0x54960f[_0xa581('0x1a')]});utils['info'](util[_0xa581('0x5')](_0xa581('0x34'),_0x54960f[_0xa581('0x1a')],members[_0x22d331][_0xa581('0x2f')],members[_0x22d331][_0xa581('0x7')],members[_0x22d331][_0xa581('0x30')]));if(members[_0x22d331]['exitAt']){writeDB(members[_0x22d331]);}}}}catch(_0x312ce1){utils['error'](util[_0xa581('0x5')]('[%s][members][cdr]',_0x54960f['uniqueid']),_0x312ce1);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 28b08b4..501dbc9 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 _0x76e7=['queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','queuecallerabandonAt','now','EXITWITHKEY','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','destaccountcode','lastAssignedTo','membername','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','calleridnum','accountcode','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','debug','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE'];(function(_0x1ba3b9,_0x5c7c8d){var _0xdfa965=function(_0x735e7c){while(--_0x735e7c){_0x1ba3b9['push'](_0x1ba3b9['shift']());}};_0xdfa965(++_0x5c7c8d);}(_0x76e7,0xa5));var _0x776e=function(_0xb58bc2,_0x3fff5f){_0xb58bc2=_0xb58bc2-0x0;var _0x3902d6=_0x76e7[_0xb58bc2];return _0x3902d6;};'use strict';var _=require(_0x776e('0x0'));var util=require('util');var utils=require(_0x776e('0x1'));var queues={};function writeDB(_0x5403cc){utils['info'](util[_0x776e('0x2')](_0x776e('0x3'),_0x5403cc['uniqueid'],_0x5403cc[_0x776e('0x4')],_0x5403cc['queue'],_0x5403cc['lastAssignedTo'],_0x5403cc[_0x776e('0x5')],_0x5403cc[_0x776e('0x6')],_0x5403cc['queuecallerexitreason']));if(_0x5403cc[_0x776e('0x7')]){utils[_0x776e('0x8')](_0x5403cc['queue'])[_0x776e('0x9')](function(_0x22e0ce){if(_0x22e0ce){_0x5403cc['type']=_0x22e0ce[_0x776e('0xa')];}utils['request']('CreateVoiceQueueReport',_0x5403cc);});}else{utils['request'](_0x776e('0xb'),_0x5403cc);}if(_0x5403cc['transfereduniqueid']){delete queues[_0x5403cc['transfereduniqueid']];}else{delete queues[_0x5403cc[_0x776e('0xc')]];}}exports[_0x776e('0xd')]=function(_0xdf2052){try{utils['debug'](util[_0x776e('0x2')](_0x776e('0xe'),_0xdf2052[_0x776e('0xc')]),_0xdf2052);utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x10'),_0xdf2052[_0x776e('0xc')],_0xdf2052[_0x776e('0x7')],_0xdf2052[_0x776e('0x11')]));queues[_0xdf2052['uniqueid']]=_[_0x776e('0x12')](_0xdf2052,{'originalposition':_0xdf2052[_0x776e('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5a57f0){utils[_0x776e('0x13')](util['format'](_0x776e('0xe'),_0xdf2052['uniqueid']),_0x5a57f0);}};exports[_0x776e('0x14')]=function(_0x2eecc7){try{if(!_[_0x776e('0x15')](queues[_0x2eecc7[_0x776e('0xc')]])){utils[_0x776e('0x16')](util[_0x776e('0x2')]('[%s][queues][hangup]',_0x2eecc7[_0x776e('0xc')]),_0x2eecc7);if(queues[_0x2eecc7[_0x776e('0xc')]]['queuecallerleaveAt']){if(!queues[_0x2eecc7[_0x776e('0xc')]]['queuecallerabandon']&&!queues[_0x2eecc7['uniqueid']][_0x776e('0x17')]){queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x18')]=!![];queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x19')]=utils['now']();queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1a')]=_0x776e('0x1b');}utils[_0x776e('0xf')](util['format'](_0x776e('0x1c'),_0x2eecc7['uniqueid'],queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1d')],queues[_0x2eecc7[_0x776e('0xc')]]['queuecallerexitreason']));writeDB(queues[_0x2eecc7[_0x776e('0xc')]]);}else if(queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1e')]){utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x1f'),_0x2eecc7['uniqueid'],queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1d')],queues[_0x2eecc7[_0x776e('0xc')]]['transfereduniqueid']));queues[queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1e')]]=queues[_0x2eecc7[_0x776e('0xc')]];queues[queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1e')]][_0x776e('0x20')]=0x2;delete queues[_0x2eecc7[_0x776e('0xc')]];}}}catch(_0x2f69a1){utils[_0x776e('0x13')](util['format'](_0x776e('0x21'),_0x2eecc7[_0x776e('0xc')]),_0x2f69a1);}};exports[_0x776e('0x22')]=function(_0x497515){try{utils[_0x776e('0x16')](util['format'](_0x776e('0x23'),_0x497515[_0x776e('0xc')]),_0x497515);if(!_[_0x776e('0x15')](_0x497515[_0x776e('0x24')][_0x776e('0x25')])&&_0x497515[_0x776e('0x26')][_0x776e('0x27')]()!==_0x776e('0x28')){if(!_[_0x776e('0x15')](queues[_0x497515[_0x776e('0xc')]])){queues[_0x497515[_0x776e('0xc')]]['queuecallerabandon']=![];queues[_0x497515[_0x776e('0xc')]]['queuecallerabandonAt']=null;queues[_0x497515['uniqueid']]['queuecallerexit']=!![];queues[_0x497515[_0x776e('0xc')]][_0x776e('0x29')]=utils['now']();queues[_0x497515[_0x776e('0xc')]][_0x776e('0x1a')]=_0x497515[_0x776e('0x26')][_0x776e('0x27')]();utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x2a'),_0x497515[_0x776e('0xc')],queues[_0x497515['uniqueid']][_0x776e('0x1d')],_0x497515['value'],queues[_0x497515['uniqueid']][_0x776e('0x1a')]));writeDB(queues[_0x497515[_0x776e('0xc')]]);}}else if(!_[_0x776e('0x15')](_0x497515[_0x776e('0x24')]['queueposition'])){if(!_[_0x776e('0x15')](queues[_0x497515[_0x776e('0xc')]])&&!queues[_0x497515[_0x776e('0xc')]][_0x776e('0x2b')]){queues[_0x497515[_0x776e('0xc')]]['queuecallerabandon']=![];queues[_0x497515['uniqueid']][_0x776e('0x2c')]=null;queues[_0x497515['uniqueid']][_0x776e('0x17')]=!![];queues[_0x497515[_0x776e('0xc')]][_0x776e('0x29')]=utils[_0x776e('0x2d')]();queues[_0x497515['uniqueid']]['queuecallerexitreason']=_0x776e('0x2e');utils[_0x776e('0xf')](util[_0x776e('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x497515['uniqueid'],queues[_0x497515['uniqueid']][_0x776e('0x1d')],_0x497515[_0x776e('0x26')],queues[_0x497515['uniqueid']][_0x776e('0x1a')]));}}}catch(_0x359bf0){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x23'),_0x497515['uniqueid']),_0x359bf0);}};exports[_0x776e('0x2b')]=function(_0x18b16c){try{if(!_['isNil'](queues[_0x18b16c[_0x776e('0xc')]])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x18b16c[_0x776e('0xc')]),_0x18b16c);queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x17')]=![];queues[_0x18b16c[_0x776e('0xc')]]['queuecallerexitAt']=null;queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x2b')]=!![];queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x2c')]=utils[_0x776e('0x2d')]();queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x1a')]='ABANDONED';utils['info'](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x18b16c['uniqueid'],queues[_0x18b16c['uniqueid']]['name'],queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x1a')]));}}catch(_0x93043){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x2f'),_0x18b16c[_0x776e('0xc')]),_0x93043);}};exports[_0x776e('0x30')]=function(_0xfc7e40){try{if(!_[_0x776e('0x15')](queues[_0xfc7e40[_0x776e('0xc')]])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x31'),_0xfc7e40['uniqueid']),_0xfc7e40);utils[_0x776e('0xf')](util[_0x776e('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xfc7e40[_0x776e('0xc')],queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x1d')],_0xfc7e40[_0x776e('0x32')],_0xfc7e40[_0x776e('0x33')]));queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x30')]=!![];queues[_0xfc7e40['uniqueid']][_0x776e('0x34')]=utils[_0x776e('0x2d')]();queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x35')]=utils[_0x776e('0x36')](queues[_0xfc7e40['uniqueid']][_0x776e('0x34')],queues[_0xfc7e40[_0x776e('0xc')]]['queuecallerjoinAt']);queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x11')]=_0xfc7e40[_0x776e('0x11')];queues[_0xfc7e40[_0x776e('0xc')]]['count']=_0xfc7e40['count'];queues[_0xfc7e40[_0x776e('0xc')]]['connectedlinenum']=_0xfc7e40[_0x776e('0x32')];queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x33')]=_0xfc7e40[_0x776e('0x33')];}}catch(_0x3abea7){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x31'),_0xfc7e40['uniqueid']),_0x3abea7);}};exports['agentconnect']=function(_0xb56f11){try{if(!_[_0x776e('0x15')](queues[_0xb56f11['uniqueid']])){utils['debug'](util[_0x776e('0x2')]('[%s][queues][agentconnect]',_0xb56f11[_0x776e('0xc')]),_0xb56f11);utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x37'),_0xb56f11[_0x776e('0xc')],queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x1d')],_0xb56f11['membername'],_0xb56f11['destaccountcode']));queues[_0xb56f11['uniqueid']][_0x776e('0x2b')]=![];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x2b')]=![];queues[_0xb56f11[_0x776e('0xc')]]['queuecallerabandonAt']=null;queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x17')]=![];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x1a')]=null;queues[_0xb56f11['uniqueid']][_0x776e('0x29')]=null;queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x38')]=!![];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x6')]=_0xb56f11[_0x776e('0x39')];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x3a')]=_0xb56f11[_0x776e('0x3b')];}}catch(_0x40f1fe){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x3c'),_0xb56f11['uniqueid']),_0x40f1fe);}};exports['agentcomplete']=function(_0x2c6569){try{if(!_[_0x776e('0x15')](queues[_0x2c6569[_0x776e('0xc')]])){if(queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x34')]){utils['debug'](util['format'](_0x776e('0x3d'),_0x2c6569[_0x776e('0xc')]),_0x2c6569);queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x2b')]=![];queues[_0x2c6569['uniqueid']][_0x776e('0x2b')]=![];queues[_0x2c6569[_0x776e('0xc')]]['queuecallerabandonAt']=null;queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x17')]=![];queues[_0x2c6569['uniqueid']][_0x776e('0x29')]=null;queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x38')]=!![];queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x3a')]=_0x2c6569[_0x776e('0x3b')];queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x18')]=!![];queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x19')]=utils['now']();if(_0x2c6569[_0x776e('0x3e')]=='transfer'){if(!queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x3f')]){queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1a')]='TRANSFER';}}else{queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1a')]=_0x776e('0x40')+_0x2c6569[_0x776e('0x3e')][_0x776e('0x27')]();}utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x41'),_0x2c6569[_0x776e('0xc')],queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1d')],_0x2c6569[_0x776e('0x3b')],queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1a')]));writeDB(queues[_0x2c6569[_0x776e('0xc')]]);}}}catch(_0x111e92){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x3d'),_0x2c6569[_0x776e('0xc')]),_0x111e92);}};exports[_0x776e('0x42')]=function(_0x4cac06){try{if(!_['isNil'](queues[_0x4cac06[_0x776e('0x43')]])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x44'),_0x4cac06[_0x776e('0xc')]),_0x4cac06);queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x3f')]=!![];queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x45')]=_0x776e('0x46');queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x47')]=_0x4cac06[_0x776e('0x48')];queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x49')]=_0x4cac06['transfereeuniqueid'];queues[_0x4cac06['transfereeuniqueid']][_0x776e('0x1a')]=_0x776e('0x4a');utils['info'](util['format'](_0x776e('0x4b'),_0x4cac06['uniqueid'],queues[_0x4cac06['transfereeuniqueid']][_0x776e('0x1d')],_0x4cac06[_0x776e('0x43')],_0x4cac06['extension']));}}catch(_0x3eb0be){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x4cac06[_0x776e('0xc')]),_0x3eb0be);}};exports[_0x776e('0x4c')]=function(_0x36f6a6){try{utils[_0x776e('0x16')](util[_0x776e('0x2')]('[%s][queues][attendedtransfer]',_0x36f6a6[_0x776e('0x4d')]),_0x36f6a6);if(_0x36f6a6[_0x776e('0x4d')]==_0x36f6a6[_0x776e('0x4e')]){if(!_['isNil'](queues[_0x36f6a6['secondtransfererlinkedid']])){utils['info'](util[_0x776e('0x2')](_0x776e('0x4f'),_0x36f6a6['origtransfereruniqueid'],queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x1d')],_0x36f6a6['origtransfererexten']));queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x3f')]=!![];queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x45')]='ATTENDED';queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x47')]=_0x36f6a6[_0x776e('0x51')];queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x49')]=_0x36f6a6[_0x776e('0x4d')];queues[_0x36f6a6['secondtransfererlinkedid']][_0x776e('0x1a')]=_0x776e('0x52');}if(!_['isNil'](queues[_0x36f6a6[_0x776e('0x4e')]])){if(_0x36f6a6[_0x776e('0x53')]&&queues[_0x36f6a6[_0x776e('0x53')]]){queues[_0x36f6a6[_0x776e('0x53')]]['queuecallerenterreason']=0x1;queues[_0x36f6a6[_0x776e('0x43')]]=_['clone'](queues[_0x36f6a6[_0x776e('0x53')]]);queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x1e')]=_0x36f6a6[_0x776e('0x54')];queues[_0x36f6a6['transfereeuniqueid']][_0x776e('0x20')]=0x2;queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x5')]=queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x5')];queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x55')]=queues[_0x36f6a6['secondtransfererlinkedid']][_0x776e('0x55')];queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x56')]=utils[_0x776e('0x2d')]();queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x34')]=utils[_0x776e('0x2d')]();queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x35')]=0x0;queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x57')]=0x0;utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x58'),_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x1d')],queues[_0x36f6a6[_0x776e('0x43')]]['calleridnum'],queues[_0x36f6a6[_0x776e('0x43')]]['calleridname']));}else{utils[_0x776e('0xf')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x1d')],_0x36f6a6[_0x776e('0x50')]));queues[_0x36f6a6['origtransfererlinkedid']][_0x776e('0x1e')]=_0x36f6a6[_0x776e('0x50')];}}}else if(_0x36f6a6[_0x776e('0x59')]==_0x36f6a6[_0x776e('0x50')]){if(!_['isNil'](queues[_0x36f6a6[_0x776e('0x4e')]])){utils[_0x776e('0xf')](util['format'](_0x776e('0x5a'),_0x36f6a6['origtransfereruniqueid'],queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x1d')],_0x36f6a6[_0x776e('0x59')],_0x36f6a6[_0x776e('0x5b')]));queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x3f')]=!![];queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x45')]='ATTENDED';queues[_0x36f6a6['origtransfererlinkedid']][_0x776e('0x47')]=_0x36f6a6[_0x776e('0x5b')];queues[_0x36f6a6['origtransfererlinkedid']][_0x776e('0x49')]=_0x36f6a6[_0x776e('0x59')];queues[_0x36f6a6[_0x776e('0x4e')]]['queuecallerexitreason']=_0x776e('0x52');}if(!_['isNil'](queues[_0x36f6a6['secondtransfererlinkedid']])){if(_0x36f6a6['transfertargetlinkedid']&&queues[_0x36f6a6[_0x776e('0x5c')]]){queues[_0x36f6a6['transfertargetlinkedid']][_0x776e('0x20')]=0x1;queues[_0x36f6a6[_0x776e('0x54')]]=_[_0x776e('0x5d')](queues[_0x36f6a6['transfertargetlinkedid']]);queues[_0x36f6a6[_0x776e('0x54')]]['transfereduniqueid']=_0x36f6a6[_0x776e('0x54')];queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x20')]=0x2;queues[_0x36f6a6['transfertargetuniqueid']][_0x776e('0x5')]=queues[_0x36f6a6['origtransfererlinkedid']]['calleridnum'];queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x55')]=queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x55')];queues[_0x36f6a6['transfertargetuniqueid']][_0x776e('0x56')]=utils['now']();queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x34')]=utils[_0x776e('0x2d')]();queues[_0x36f6a6[_0x776e('0x54')]]['holdtime']=0x0;queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x57')]=0x0;utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x5e'),_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x1d')],queues[_0x36f6a6['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x36f6a6[_0x776e('0x54')]]['calleridnum'],queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x55')]));}else{utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x5f'),_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x50')]]['name'],_0x36f6a6['origtransfererlinkedid']));queues[_0x36f6a6['secondtransfererlinkedid']][_0x776e('0x1e')]=_0x36f6a6[_0x776e('0x4e')];}}}}catch(_0x3c2b3f){utils['error'](util['format'](_0x776e('0x60'),_0x36f6a6[_0x776e('0x4d')]),_0x3c2b3f);}};exports['musiconholdstart']=function(_0x119a81){try{if(!_[_0x776e('0x15')](queues[_0x119a81['uniqueid']])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x61'),_0x119a81[_0x776e('0xc')]),_0x119a81);queues[_0x119a81['uniqueid']][_0x776e('0x62')]=utils[_0x776e('0x2d')]();utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x63'),_0x119a81[_0x776e('0xc')],queues[_0x119a81['uniqueid']][_0x776e('0x1d')],queues[_0x119a81[_0x776e('0xc')]][_0x776e('0x62')]));}}catch(_0x16f0d0){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x61'),_0x119a81[_0x776e('0xc')]),_0x16f0d0);}};exports[_0x776e('0x64')]=function(_0x173cbf){try{if(!_[_0x776e('0x15')](queues[_0x173cbf[_0x776e('0xc')]])){if(!_[_0x776e('0x15')](queues[_0x173cbf[_0x776e('0xc')]]['musiconholdstartAt'])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x65'),_0x173cbf['uniqueid']),_0x173cbf);queues[_0x173cbf['uniqueid']][_0x776e('0x57')]+=utils[_0x776e('0x36')](utils[_0x776e('0x2d')](),queues[_0x173cbf[_0x776e('0xc')]]['musiconholdstartAt']);utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x66'),_0x173cbf['uniqueid'],queues[_0x173cbf[_0x776e('0xc')]]['name'],queues[_0x173cbf[_0x776e('0xc')]][_0x776e('0x57')]));delete queues[_0x173cbf['uniqueid']]['musiconholdstartAt'];}}}catch(_0x53e44e){utils['error'](util[_0x776e('0x2')](_0x776e('0x65'),_0x173cbf[_0x776e('0xc')]),_0x53e44e);}}; \ No newline at end of file +var _0x8491=['transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','error','hangup','isNil','[%s][queues][hangup]','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]','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','holdtime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype'];(function(_0xbc13e1,_0x14d88b){var _0xa87f5a=function(_0x11ea58){while(--_0x11ea58){_0xbc13e1['push'](_0xbc13e1['shift']());}};_0xa87f5a(++_0x14d88b);}(_0x8491,0x14e));var _0x1849=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8491[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x1849('0x0'));var util=require('util');var utils=require(_0x1849('0x1'));var queues={};function writeDB(_0x3ee59d){utils[_0x1849('0x2')](util[_0x1849('0x3')](_0x1849('0x4'),_0x3ee59d[_0x1849('0x5')],_0x3ee59d[_0x1849('0x6')],_0x3ee59d[_0x1849('0x7')],_0x3ee59d[_0x1849('0x8')],_0x3ee59d[_0x1849('0x9')],_0x3ee59d[_0x1849('0xa')],_0x3ee59d[_0x1849('0xb')]));if(_0x3ee59d[_0x1849('0x7')]){utils['getVoiceQueueByName'](_0x3ee59d[_0x1849('0x7')])['then'](function(_0x4ef765){if(_0x4ef765){_0x3ee59d[_0x1849('0xc')]=_0x4ef765[_0x1849('0xc')];}utils[_0x1849('0xd')](_0x1849('0xe'),_0x3ee59d);});}else{utils[_0x1849('0xd')](_0x1849('0xe'),_0x3ee59d);}if(_0x3ee59d[_0x1849('0xf')]){delete queues[_0x3ee59d[_0x1849('0xf')]];}else{delete queues[_0x3ee59d['uniqueid']];}}exports[_0x1849('0x10')]=function(_0x1a2252){try{utils[_0x1849('0x11')](util['format']('[%s][queues][queuecallerjoin]',_0x1a2252['uniqueid']),_0x1a2252);utils[_0x1849('0x2')](util[_0x1849('0x3')](_0x1849('0x12'),_0x1a2252[_0x1849('0x5')],_0x1a2252[_0x1849('0x7')],_0x1a2252['position']));queues[_0x1a2252[_0x1849('0x5')]]=_[_0x1849('0x13')](_0x1a2252,{'originalposition':_0x1a2252[_0x1849('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x192aa1){utils[_0x1849('0x15')](util[_0x1849('0x3')]('[%s][queues][queuecallerjoin]',_0x1a2252[_0x1849('0x5')]),_0x192aa1);}};exports[_0x1849('0x16')]=function(_0x2fde0b){try{if(!_[_0x1849('0x17')](queues[_0x2fde0b[_0x1849('0x5')]])){utils[_0x1849('0x11')](util[_0x1849('0x3')](_0x1849('0x18'),_0x2fde0b['uniqueid']),_0x2fde0b);if(queues[_0x2fde0b[_0x1849('0x5')]]['queuecallerleaveAt']){if(!queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0x19')]&&!queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0x1a')]){queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0x1b')]=!![];queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0x1c')]=utils['now']();queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0xb')]=_0x1849('0x1d');}utils['info'](util[_0x1849('0x3')](_0x1849('0x1e'),_0x2fde0b[_0x1849('0x5')],queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0x1f')],queues[_0x2fde0b[_0x1849('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x2fde0b[_0x1849('0x5')]]);}else if(queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0xf')]){utils['info'](util[_0x1849('0x3')](_0x1849('0x20'),_0x2fde0b[_0x1849('0x5')],queues[_0x2fde0b['uniqueid']][_0x1849('0x1f')],queues[_0x2fde0b[_0x1849('0x5')]]['transfereduniqueid']));queues[queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0xf')]]=queues[_0x2fde0b['uniqueid']];queues[queues[_0x2fde0b[_0x1849('0x5')]][_0x1849('0xf')]][_0x1849('0x21')]=0x2;delete queues[_0x2fde0b[_0x1849('0x5')]];}}}catch(_0x247ea6){utils[_0x1849('0x15')](util[_0x1849('0x3')](_0x1849('0x18'),_0x2fde0b[_0x1849('0x5')]),_0x247ea6);}};exports[_0x1849('0x22')]=function(_0x5afaa3){try{utils[_0x1849('0x11')](util['format'](_0x1849('0x23'),_0x5afaa3[_0x1849('0x5')]),_0x5afaa3);if(!_['isNil'](_0x5afaa3['variable'][_0x1849('0x24')])&&_0x5afaa3['value'][_0x1849('0x25')]()!==_0x1849('0x26')){if(!_['isNil'](queues[_0x5afaa3[_0x1849('0x5')]])){queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x19')]=![];queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x27')]=null;queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x1a')]=!![];queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x28')]=utils[_0x1849('0x29')]();queues[_0x5afaa3['uniqueid']]['queuecallerexitreason']=_0x5afaa3[_0x1849('0x2a')][_0x1849('0x25')]();utils[_0x1849('0x2')](util[_0x1849('0x3')](_0x1849('0x2b'),_0x5afaa3[_0x1849('0x5')],queues[_0x5afaa3['uniqueid']][_0x1849('0x1f')],_0x5afaa3['value'],queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0xb')]));writeDB(queues[_0x5afaa3['uniqueid']]);}}else if(!_[_0x1849('0x17')](_0x5afaa3[_0x1849('0x2c')]['queueposition'])){if(!_[_0x1849('0x17')](queues[_0x5afaa3[_0x1849('0x5')]])&&!queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x19')]){queues[_0x5afaa3['uniqueid']]['queuecallerabandon']=![];queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x27')]=null;queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x1a')]=!![];queues[_0x5afaa3[_0x1849('0x5')]]['queuecallerexitAt']=utils[_0x1849('0x29')]();queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0xb')]='EXITWITHKEY';utils[_0x1849('0x2')](util[_0x1849('0x3')](_0x1849('0x2d'),_0x5afaa3[_0x1849('0x5')],queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0x1f')],_0x5afaa3[_0x1849('0x2a')],queues[_0x5afaa3[_0x1849('0x5')]][_0x1849('0xb')]));}}}catch(_0x1baca3){utils[_0x1849('0x15')](util[_0x1849('0x3')](_0x1849('0x23'),_0x5afaa3[_0x1849('0x5')]),_0x1baca3);}};exports[_0x1849('0x19')]=function(_0xcf8b42){try{if(!_[_0x1849('0x17')](queues[_0xcf8b42['uniqueid']])){utils[_0x1849('0x11')](util['format'](_0x1849('0x2e'),_0xcf8b42[_0x1849('0x5')]),_0xcf8b42);queues[_0xcf8b42[_0x1849('0x5')]][_0x1849('0x1a')]=![];queues[_0xcf8b42[_0x1849('0x5')]][_0x1849('0x28')]=null;queues[_0xcf8b42[_0x1849('0x5')]][_0x1849('0x19')]=!![];queues[_0xcf8b42['uniqueid']][_0x1849('0x27')]=utils[_0x1849('0x29')]();queues[_0xcf8b42[_0x1849('0x5')]][_0x1849('0xb')]=_0x1849('0x2f');utils['info'](util['format'](_0x1849('0x30'),_0xcf8b42['uniqueid'],queues[_0xcf8b42[_0x1849('0x5')]][_0x1849('0x1f')],queues[_0xcf8b42[_0x1849('0x5')]][_0x1849('0xb')]));}}catch(_0xec78bb){utils['error'](util[_0x1849('0x3')](_0x1849('0x2e'),_0xcf8b42['uniqueid']),_0xec78bb);}};exports[_0x1849('0x31')]=function(_0x59012b){try{if(!_[_0x1849('0x17')](queues[_0x59012b[_0x1849('0x5')]])){utils[_0x1849('0x11')](util['format'](_0x1849('0x32'),_0x59012b['uniqueid']),_0x59012b);utils[_0x1849('0x2')](util[_0x1849('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x59012b[_0x1849('0x5')],queues[_0x59012b[_0x1849('0x5')]][_0x1849('0x1f')],_0x59012b['connectedlinenum'],_0x59012b['connectedlinename']));queues[_0x59012b['uniqueid']]['queuecallerleave']=!![];queues[_0x59012b[_0x1849('0x5')]]['queuecallerleaveAt']=utils[_0x1849('0x29')]();queues[_0x59012b['uniqueid']][_0x1849('0x33')]=utils['diffTime'](queues[_0x59012b[_0x1849('0x5')]][_0x1849('0x34')],queues[_0x59012b[_0x1849('0x5')]][_0x1849('0x35')]);queues[_0x59012b[_0x1849('0x5')]]['position']=_0x59012b[_0x1849('0x14')];queues[_0x59012b[_0x1849('0x5')]][_0x1849('0x36')]=_0x59012b[_0x1849('0x36')];queues[_0x59012b[_0x1849('0x5')]][_0x1849('0x37')]=_0x59012b[_0x1849('0x37')];queues[_0x59012b[_0x1849('0x5')]][_0x1849('0x38')]=_0x59012b[_0x1849('0x38')];}}catch(_0x130cde){utils[_0x1849('0x15')](util[_0x1849('0x3')](_0x1849('0x32'),_0x59012b[_0x1849('0x5')]),_0x130cde);}};exports[_0x1849('0x39')]=function(_0x25ab18){try{if(!_[_0x1849('0x17')](queues[_0x25ab18['uniqueid']])){utils[_0x1849('0x11')](util['format'](_0x1849('0x3a'),_0x25ab18[_0x1849('0x5')]),_0x25ab18);utils[_0x1849('0x2')](util[_0x1849('0x3')](_0x1849('0x3b'),_0x25ab18[_0x1849('0x5')],queues[_0x25ab18[_0x1849('0x5')]]['name'],_0x25ab18[_0x1849('0x3c')],_0x25ab18[_0x1849('0x3d')]));queues[_0x25ab18['uniqueid']][_0x1849('0x19')]=![];queues[_0x25ab18[_0x1849('0x5')]]['queuecallerabandon']=![];queues[_0x25ab18['uniqueid']][_0x1849('0x27')]=null;queues[_0x25ab18['uniqueid']]['queuecallerexit']=![];queues[_0x25ab18[_0x1849('0x5')]][_0x1849('0xb')]=null;queues[_0x25ab18[_0x1849('0x5')]][_0x1849('0x28')]=null;queues[_0x25ab18[_0x1849('0x5')]][_0x1849('0x3e')]=!![];queues[_0x25ab18['uniqueid']][_0x1849('0xa')]=_0x25ab18[_0x1849('0x3d')];queues[_0x25ab18['uniqueid']][_0x1849('0x8')]=_0x25ab18[_0x1849('0x3c')];}}catch(_0x48ca9c){utils['error'](util[_0x1849('0x3')]('[%s][queues][agentconnect]',_0x25ab18[_0x1849('0x5')]),_0x48ca9c);}};exports[_0x1849('0x3f')]=function(_0x4c147a){try{if(!_['isNil'](queues[_0x4c147a['uniqueid']])){if(queues[_0x4c147a[_0x1849('0x5')]][_0x1849('0x34')]){utils[_0x1849('0x11')](util[_0x1849('0x3')](_0x1849('0x40'),_0x4c147a[_0x1849('0x5')]),_0x4c147a);queues[_0x4c147a['uniqueid']]['queuecallerabandon']=![];queues[_0x4c147a[_0x1849('0x5')]][_0x1849('0x19')]=![];queues[_0x4c147a[_0x1849('0x5')]][_0x1849('0x27')]=null;queues[_0x4c147a['uniqueid']][_0x1849('0x1a')]=![];queues[_0x4c147a[_0x1849('0x5')]]['queuecallerexitAt']=null;queues[_0x4c147a[_0x1849('0x5')]][_0x1849('0x3e')]=!![];queues[_0x4c147a[_0x1849('0x5')]]['lastAssignedTo']=_0x4c147a[_0x1849('0x3c')];queues[_0x4c147a['uniqueid']][_0x1849('0x1b')]=!![];queues[_0x4c147a[_0x1849('0x5')]][_0x1849('0x1c')]=utils[_0x1849('0x29')]();if(_0x4c147a[_0x1849('0x41')]=='transfer'){if(!queues[_0x4c147a[_0x1849('0x5')]][_0x1849('0x42')]){queues[_0x4c147a[_0x1849('0x5')]]['queuecallerexitreason']=_0x1849('0x43');}}else{queues[_0x4c147a[_0x1849('0x5')]][_0x1849('0xb')]=_0x1849('0x44')+_0x4c147a[_0x1849('0x41')]['toUpperCase']();}utils['info'](util[_0x1849('0x3')](_0x1849('0x45'),_0x4c147a[_0x1849('0x5')],queues[_0x4c147a['uniqueid']][_0x1849('0x1f')],_0x4c147a[_0x1849('0x3c')],queues[_0x4c147a['uniqueid']][_0x1849('0xb')]));writeDB(queues[_0x4c147a['uniqueid']]);}}}catch(_0xe503be){utils[_0x1849('0x15')](util[_0x1849('0x3')](_0x1849('0x40'),_0x4c147a[_0x1849('0x5')]),_0xe503be);}};exports[_0x1849('0x46')]=function(_0x34d25d){try{if(!_[_0x1849('0x17')](queues[_0x34d25d[_0x1849('0x47')]])){utils[_0x1849('0x11')](util['format'](_0x1849('0x48'),_0x34d25d[_0x1849('0x5')]),_0x34d25d);queues[_0x34d25d[_0x1849('0x47')]][_0x1849('0x42')]=!![];queues[_0x34d25d[_0x1849('0x47')]][_0x1849('0x49')]='BLIND';queues[_0x34d25d[_0x1849('0x47')]][_0x1849('0x4a')]=_0x34d25d['extension'];queues[_0x34d25d[_0x1849('0x47')]][_0x1849('0x4b')]=_0x34d25d[_0x1849('0x47')];queues[_0x34d25d['transfereeuniqueid']]['queuecallerexitreason']=_0x1849('0x4c');utils[_0x1849('0x2')](util[_0x1849('0x3')](_0x1849('0x4d'),_0x34d25d[_0x1849('0x5')],queues[_0x34d25d[_0x1849('0x47')]][_0x1849('0x1f')],_0x34d25d[_0x1849('0x47')],_0x34d25d['extension']));}}catch(_0x5c3c96){utils[_0x1849('0x15')](util[_0x1849('0x3')](_0x1849('0x48'),_0x34d25d[_0x1849('0x5')]),_0x5c3c96);}};exports[_0x1849('0x4e')]=function(_0x1669e6){try{utils[_0x1849('0x11')](util['format'](_0x1849('0x4f'),_0x1669e6[_0x1849('0x50')]),_0x1669e6);if(_0x1669e6[_0x1849('0x50')]==_0x1669e6[_0x1849('0x51')]){if(!_[_0x1849('0x17')](queues[_0x1669e6[_0x1849('0x52')]])){utils['info'](util[_0x1849('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1669e6[_0x1849('0x50')],queues[_0x1669e6[_0x1849('0x52')]][_0x1849('0x1f')],_0x1669e6[_0x1849('0x53')]));queues[_0x1669e6['secondtransfererlinkedid']][_0x1849('0x42')]=!![];queues[_0x1669e6['secondtransfererlinkedid']]['transfertype']=_0x1849('0x54');queues[_0x1669e6[_0x1849('0x52')]][_0x1849('0x4a')]=_0x1669e6[_0x1849('0x53')];queues[_0x1669e6[_0x1849('0x52')]][_0x1849('0x4b')]=_0x1669e6['origtransfereruniqueid'];queues[_0x1669e6[_0x1849('0x52')]][_0x1849('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x1849('0x17')](queues[_0x1669e6['origtransfererlinkedid']])){if(_0x1669e6[_0x1849('0x55')]&&queues[_0x1669e6[_0x1849('0x55')]]){queues[_0x1669e6[_0x1849('0x55')]][_0x1849('0x21')]=0x1;queues[_0x1669e6[_0x1849('0x47')]]=_[_0x1849('0x56')](queues[_0x1669e6['transfereelinkedid']]);queues[_0x1669e6['transfereeuniqueid']][_0x1849('0xf')]=_0x1669e6['transfertargetuniqueid'];queues[_0x1669e6[_0x1849('0x47')]][_0x1849('0x21')]=0x2;queues[_0x1669e6['transfereeuniqueid']][_0x1849('0x9')]=queues[_0x1669e6[_0x1849('0x52')]]['calleridnum'];queues[_0x1669e6[_0x1849('0x47')]]['calleridname']=queues[_0x1669e6[_0x1849('0x52')]][_0x1849('0x57')];queues[_0x1669e6['transfereeuniqueid']][_0x1849('0x35')]=utils['now']();queues[_0x1669e6[_0x1849('0x47')]][_0x1849('0x34')]=utils[_0x1849('0x29')]();queues[_0x1669e6[_0x1849('0x47')]][_0x1849('0x33')]=0x0;queues[_0x1669e6[_0x1849('0x47')]][_0x1849('0x58')]=0x0;utils[_0x1849('0x2')](util[_0x1849('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1669e6[_0x1849('0x50')],queues[_0x1669e6[_0x1849('0x47')]]['name'],queues[_0x1669e6[_0x1849('0x47')]]['calleridnum'],queues[_0x1669e6[_0x1849('0x47')]][_0x1849('0x57')]));}else{utils[_0x1849('0x2')](util['format'](_0x1849('0x59'),_0x1669e6['origtransfereruniqueid'],queues[_0x1669e6[_0x1849('0x51')]][_0x1849('0x1f')],_0x1669e6[_0x1849('0x52')]));queues[_0x1669e6[_0x1849('0x51')]][_0x1849('0xf')]=_0x1669e6[_0x1849('0x52')];}}}else if(_0x1669e6[_0x1849('0x5a')]==_0x1669e6[_0x1849('0x52')]){if(!_['isNil'](queues[_0x1669e6[_0x1849('0x51')]])){utils[_0x1849('0x2')](util['format'](_0x1849('0x5b'),_0x1669e6['origtransfereruniqueid'],queues[_0x1669e6['origtransfererlinkedid']][_0x1849('0x1f')],_0x1669e6['secondtransfereruniqueid'],_0x1669e6[_0x1849('0x5c')]));queues[_0x1669e6[_0x1849('0x51')]][_0x1849('0x42')]=!![];queues[_0x1669e6['origtransfererlinkedid']][_0x1849('0x49')]='ATTENDED';queues[_0x1669e6[_0x1849('0x51')]][_0x1849('0x4a')]=_0x1669e6[_0x1849('0x5c')];queues[_0x1669e6['origtransfererlinkedid']]['transferuniqueid']=_0x1669e6['secondtransfereruniqueid'];queues[_0x1669e6[_0x1849('0x51')]][_0x1849('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x1849('0x17')](queues[_0x1669e6['secondtransfererlinkedid']])){if(_0x1669e6['transfertargetlinkedid']&&queues[_0x1669e6['transfertargetlinkedid']]){queues[_0x1669e6[_0x1849('0x5d')]][_0x1849('0x21')]=0x1;queues[_0x1669e6[_0x1849('0x5e')]]=_[_0x1849('0x56')](queues[_0x1669e6[_0x1849('0x5d')]]);queues[_0x1669e6[_0x1849('0x5e')]][_0x1849('0xf')]=_0x1669e6[_0x1849('0x5e')];queues[_0x1669e6['transfertargetuniqueid']][_0x1849('0x21')]=0x2;queues[_0x1669e6[_0x1849('0x5e')]][_0x1849('0x9')]=queues[_0x1669e6[_0x1849('0x51')]][_0x1849('0x9')];queues[_0x1669e6['transfertargetuniqueid']][_0x1849('0x57')]=queues[_0x1669e6['origtransfererlinkedid']]['calleridname'];queues[_0x1669e6[_0x1849('0x5e')]][_0x1849('0x35')]=utils['now']();queues[_0x1669e6[_0x1849('0x5e')]]['queuecallerleaveAt']=utils[_0x1849('0x29')]();queues[_0x1669e6[_0x1849('0x5e')]]['holdtime']=0x0;queues[_0x1669e6[_0x1849('0x5e')]][_0x1849('0x58')]=0x0;utils['info'](util[_0x1849('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1669e6[_0x1849('0x50')],queues[_0x1669e6[_0x1849('0x5e')]][_0x1849('0x1f')],queues[_0x1669e6[_0x1849('0x5e')]][_0x1849('0xf')],queues[_0x1669e6['transfertargetuniqueid']]['calleridnum'],queues[_0x1669e6[_0x1849('0x5e')]][_0x1849('0x57')]));}else{utils['info'](util[_0x1849('0x3')](_0x1849('0x59'),_0x1669e6['origtransfereruniqueid'],queues[_0x1669e6['secondtransfererlinkedid']][_0x1849('0x1f')],_0x1669e6['origtransfererlinkedid']));queues[_0x1669e6[_0x1849('0x52')]][_0x1849('0xf')]=_0x1669e6[_0x1849('0x51')];}}}}catch(_0x10131e){utils[_0x1849('0x15')](util[_0x1849('0x3')]('[%s][queues][attendedtransfer]',_0x1669e6[_0x1849('0x50')]),_0x10131e);}};exports[_0x1849('0x5f')]=function(_0x120214){try{if(!_[_0x1849('0x17')](queues[_0x120214[_0x1849('0x5')]])){utils[_0x1849('0x11')](util[_0x1849('0x3')](_0x1849('0x60'),_0x120214[_0x1849('0x5')]),_0x120214);queues[_0x120214[_0x1849('0x5')]][_0x1849('0x61')]=utils[_0x1849('0x29')]();utils[_0x1849('0x2')](util[_0x1849('0x3')](_0x1849('0x62'),_0x120214[_0x1849('0x5')],queues[_0x120214[_0x1849('0x5')]]['name'],queues[_0x120214['uniqueid']][_0x1849('0x61')]));}}catch(_0x3440d2){utils[_0x1849('0x15')](util[_0x1849('0x3')]('[%s][queues][musiconholdstart]',_0x120214[_0x1849('0x5')]),_0x3440d2);}};exports['musiconholdstop']=function(_0x3fa106){try{if(!_['isNil'](queues[_0x3fa106[_0x1849('0x5')]])){if(!_['isNil'](queues[_0x3fa106['uniqueid']][_0x1849('0x61')])){utils[_0x1849('0x11')](util[_0x1849('0x3')]('[%s][queues][musiconholdstop]',_0x3fa106[_0x1849('0x5')]),_0x3fa106);queues[_0x3fa106[_0x1849('0x5')]][_0x1849('0x58')]+=utils[_0x1849('0x63')](utils[_0x1849('0x29')](),queues[_0x3fa106[_0x1849('0x5')]]['musiconholdstartAt']);utils['info'](util[_0x1849('0x3')](_0x1849('0x64'),_0x3fa106[_0x1849('0x5')],queues[_0x3fa106[_0x1849('0x5')]][_0x1849('0x1f')],queues[_0x3fa106[_0x1849('0x5')]][_0x1849('0x58')]));delete queues[_0x3fa106[_0x1849('0x5')]]['musiconholdstartAt'];}}}catch(_0x413c09){utils[_0x1849('0x15')](util[_0x1849('0x3')](_0x1849('0x65'),_0x3fa106[_0x1849('0x5')]),_0x413c09);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c8f205c..e12c6d6 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 _0x3b46=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','exten','context','channel','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','variable','mixmonitor_filename'];(function(_0x2596c6,_0x3be92f){var _0x2e5b0c=function(_0x4159a7){while(--_0x4159a7){_0x2596c6['push'](_0x2596c6['shift']());}};_0x2e5b0c(++_0x3be92f);}(_0x3b46,0x118));var _0x63b4=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x3b46[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0x63b4('0x0'));var util=require(_0x63b4('0x1'));var utils=require(_0x63b4('0x2'));var recordings={};function writeDB(_0x435d72){utils[_0x63b4('0x3')](util[_0x63b4('0x4')](_0x63b4('0x5'),_0x435d72[_0x63b4('0x6')]));if(_0x435d72['accountcode']){utils[_0x63b4('0x7')](_0x435d72[_0x63b4('0x8')])['then'](function(_0x5b08c6){if(_0x5b08c6){_0x435d72[_0x63b4('0x9')]=_0x5b08c6['name'];_0x435d72[_0x63b4('0xa')]=_0x5b08c6['id'];}utils[_0x63b4('0xb')](_0x63b4('0xc'),_0x435d72);});}else{utils[_0x63b4('0xb')](_0x63b4('0xc'),_0x435d72);}}exports['newchannel']=function(_0x2eed79){try{utils[_0x63b4('0xd')](util[_0x63b4('0x4')](_0x63b4('0xe'),_0x2eed79[_0x63b4('0x6')]),_0x2eed79);if(_0x2eed79[_0x63b4('0x6')]==_0x2eed79[_0x63b4('0xf')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2eed79[_0x63b4('0x6')],_0x2eed79['context'],_0x2eed79[_0x63b4('0x10')]));recordings[_0x2eed79[_0x63b4('0x6')]]={'uniqueid':_0x2eed79['uniqueid'],'accountcode':_0x2eed79[_0x63b4('0x8')],'exten':_0x2eed79['exten'],'context':_0x2eed79[_0x63b4('0x11')],'channel':_0x2eed79[_0x63b4('0x12')],'monitors':[]};}}catch(_0x4bb5db){utils['error'](util[_0x63b4('0x4')]('[%s][recordings][newchannel]',_0x2eed79['uniqueid']),_0x4bb5db);}};exports[_0x63b4('0x13')]=function(_0x27de14){try{utils[_0x63b4('0xd')](util['format']('[%s][recordings][newstate]',_0x27de14[_0x63b4('0x6')]),_0x27de14);if(!_[_0x63b4('0x14')](recordings[_0x27de14['uniqueid']])&&_0x27de14[_0x63b4('0x15')]==0x6){utils[_0x63b4('0x3')](util[_0x63b4('0x4')](_0x63b4('0x16'),_0x27de14[_0x63b4('0x6')],_0x27de14[_0x63b4('0x11')],_0x27de14['channel']));}else if(!_[_0x63b4('0x14')](recordings[_0x27de14[_0x63b4('0xf')]])&&_0x27de14[_0x63b4('0x15')]==0x6&&_0x27de14[_0x63b4('0x11')]!=_0x63b4('0x17')){utils[_0x63b4('0x3')](util['format'](_0x63b4('0x18'),_0x27de14[_0x63b4('0x6')],_0x27de14[_0x63b4('0xf')],_0x27de14[_0x63b4('0x11')],_0x27de14[_0x63b4('0x12')]));recordings[_0x27de14[_0x63b4('0xf')]][_0x63b4('0x8')]=_0x27de14[_0x63b4('0x8')];}}catch(_0x3e798b){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x1a'),_0x27de14['uniqueid']),_0x3e798b);}};exports[_0x63b4('0x1b')]=function(_0x101502){try{if(!_[_0x63b4('0x14')](_0x101502[_0x63b4('0x1c')])&&!_[_0x63b4('0x14')](_0x101502[_0x63b4('0x1c')][_0x63b4('0x1d')])){utils[_0x63b4('0xd')](util['format'](_0x63b4('0x1e'),_0x101502[_0x63b4('0x6')]),_0x101502);utils[_0x63b4('0x3')](util['format'](_0x63b4('0x1f'),_0x101502[_0x63b4('0x6')],_0x101502[_0x63b4('0x1c')],_0x101502[_0x63b4('0x20')]));if(_[_0x63b4('0x21')](_0x101502[_0x63b4('0x20')],_0x63b4('0x22'))){_0x101502[_0x63b4('0x20')]=_0x101502[_0x63b4('0x20')][_0x63b4('0x23')]('.wav49',_0x63b4('0x24'));}if(recordings[_0x101502[_0x63b4('0xf')]]){var _0x148bf2=_[_0x63b4('0x25')](recordings[_0x101502['linkedid']][_0x63b4('0x26')],{'value':_0x101502[_0x63b4('0x20')]});if(_[_0x63b4('0x14')](_0x148bf2)){recordings[_0x101502[_0x63b4('0xf')]][_0x63b4('0x26')]['push']({'value':_0x101502[_0x63b4('0x20')]});}}}}catch(_0x166ba0){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x1e'),_0x101502[_0x63b4('0x6')]),_0x166ba0);}};exports['hangup']=function(_0x3ba531){try{if(!_[_0x63b4('0x14')](recordings[_0x3ba531[_0x63b4('0x6')]])){utils[_0x63b4('0xd')](util['format']('[%s][recordings][hangup]',_0x3ba531[_0x63b4('0x6')]),_0x3ba531);utils['info'](util['format'](_0x63b4('0x27'),_0x3ba531[_0x63b4('0x6')],_0x3ba531[_0x63b4('0x28')],_0x3ba531[_0x63b4('0x29')],_0x3ba531[_0x63b4('0x2a')]));recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x28')]=_0x3ba531['calleridnum'];recordings[_0x3ba531[_0x63b4('0x6')]]['calleridname']=_0x3ba531[_0x63b4('0x29')];recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2b')]=_0x3ba531[_0x63b4('0x2b')];recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2c')]=_0x3ba531[_0x63b4('0x2c')];if(recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2d')]==_0x63b4('0x2e')&&recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x8')]){recordings[_0x3ba531['uniqueid']]['connectedlinenum']=recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x8')];recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2c')]='';}recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x26')]['forEach'](function(_0x65c556){var _0x1355b7=_['clone'](recordings[_0x3ba531[_0x63b4('0x6')]]);_0x1355b7[_0x63b4('0x20')]=_0x65c556[_0x63b4('0x20')];writeDB(_0x1355b7);});delete recordings[_0x3ba531['uniqueid']];}}catch(_0x53438f){utils[_0x63b4('0x19')](util[_0x63b4('0x4')]('[%s][recordings][hangup]',_0x3ba531[_0x63b4('0x6')]),_0x53438f);}};exports['newexten']=function(_0x127b21){try{if(!_['isNil'](recordings[_0x127b21['uniqueid']])){utils['debug'](util[_0x63b4('0x4')](_0x63b4('0x2f'),_0x127b21[_0x63b4('0x6')]),_0x127b21);utils[_0x63b4('0x3')](util[_0x63b4('0x4')](_0x63b4('0x30'),_0x127b21[_0x63b4('0x6')],_0x127b21[_0x63b4('0x31')],_0x127b21[_0x63b4('0x32')]));if(_0x127b21[_0x63b4('0x31')][_0x63b4('0x33')]()==_0x63b4('0x34')&&_[_0x63b4('0x35')](_0x127b21[_0x63b4('0x32')][_0x63b4('0x33')](),_0x63b4('0x36'))){var _0x4cee78=_0x127b21[_0x63b4('0x32')][_0x63b4('0x37')]('=');var _0x361c5c=_0x4cee78[0x0][_0x63b4('0x38')](_0x4cee78[0x0][_0x63b4('0x39')]('(')+0x1,_0x4cee78[0x0][_0x63b4('0x39')](')'));var _0x54826b=_0x4cee78[0x1];recordings[_0x127b21['uniqueid']][_0x361c5c]=_0x54826b;}}}catch(_0x1eeec5){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x2f'),_0x127b21[_0x63b4('0x6')]),_0x1eeec5);}};exports[_0x63b4('0x3a')]=function(_0x1a0c4d){try{if(!_[_0x63b4('0x14')](recordings[_0x1a0c4d[_0x63b4('0x6')]])){utils[_0x63b4('0xd')](util[_0x63b4('0x4')](_0x63b4('0x3b'),_0x1a0c4d[_0x63b4('0x6')]),_0x1a0c4d);utils['info'](util[_0x63b4('0x4')](_0x63b4('0x3c'),_0x1a0c4d[_0x63b4('0x6')],_0x1a0c4d[_0x63b4('0x3d')]));recordings[_0x1a0c4d['uniqueid']][_0x63b4('0x3d')]=_0x1a0c4d[_0x63b4('0x3d')];}}catch(_0xe3751d){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x3b'),_0x1a0c4d[_0x63b4('0x6')]),_0xe3751d);}}; \ No newline at end of file +var _0x5057=['toLowerCase','set','startsWith','appdata','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','context','exten','error','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','application'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0x5057,0x1e2));var _0x7505=function(_0x1dc2fb,_0x52ff71){_0x1dc2fb=_0x1dc2fb-0x0;var _0x4a9cd5=_0x5057[_0x1dc2fb];return _0x4a9cd5;};'use strict';var _=require(_0x7505('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x1f72b){utils[_0x7505('0x1')](util[_0x7505('0x2')](_0x7505('0x3'),_0x1f72b[_0x7505('0x4')]));if(_0x1f72b[_0x7505('0x5')]){utils[_0x7505('0x6')](_0x1f72b['accountcode'])[_0x7505('0x7')](function(_0x2b77c3){if(_0x2b77c3){_0x1f72b['membername']=_0x2b77c3[_0x7505('0x8')];_0x1f72b[_0x7505('0x9')]=_0x2b77c3['id'];}utils[_0x7505('0xa')](_0x7505('0xb'),_0x1f72b);});}else{utils[_0x7505('0xa')]('CreateVoiceRecording',_0x1f72b);}}exports[_0x7505('0xc')]=function(_0x2834b5){try{utils['debug'](util[_0x7505('0x2')](_0x7505('0xd'),_0x2834b5[_0x7505('0x4')]),_0x2834b5);if(_0x2834b5['uniqueid']==_0x2834b5['linkedid']){utils[_0x7505('0x1')](util[_0x7505('0x2')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2834b5['uniqueid'],_0x2834b5[_0x7505('0xe')],_0x2834b5[_0x7505('0xf')]));recordings[_0x2834b5[_0x7505('0x4')]]={'uniqueid':_0x2834b5[_0x7505('0x4')],'accountcode':_0x2834b5[_0x7505('0x5')],'exten':_0x2834b5['exten'],'context':_0x2834b5[_0x7505('0xe')],'channel':_0x2834b5['channel'],'monitors':[]};}}catch(_0x3c1356){utils[_0x7505('0x10')](util[_0x7505('0x2')](_0x7505('0xd'),_0x2834b5[_0x7505('0x4')]),_0x3c1356);}};exports[_0x7505('0x11')]=function(_0x555823){try{utils[_0x7505('0x12')](util[_0x7505('0x2')](_0x7505('0x13'),_0x555823[_0x7505('0x4')]),_0x555823);if(!_[_0x7505('0x14')](recordings[_0x555823[_0x7505('0x4')]])&&_0x555823[_0x7505('0x15')]==0x6){utils[_0x7505('0x1')](util[_0x7505('0x2')](_0x7505('0x16'),_0x555823[_0x7505('0x4')],_0x555823['context'],_0x555823[_0x7505('0x17')]));}else if(!_[_0x7505('0x14')](recordings[_0x555823[_0x7505('0x18')]])&&_0x555823[_0x7505('0x15')]==0x6&&_0x555823[_0x7505('0xe')]!=_0x7505('0x19')){utils[_0x7505('0x1')](util['format'](_0x7505('0x1a'),_0x555823[_0x7505('0x4')],_0x555823[_0x7505('0x18')],_0x555823['context'],_0x555823[_0x7505('0x17')]));recordings[_0x555823['linkedid']][_0x7505('0x5')]=_0x555823[_0x7505('0x5')];}}catch(_0x3b0ead){utils[_0x7505('0x10')](util[_0x7505('0x2')](_0x7505('0x13'),_0x555823[_0x7505('0x4')]),_0x3b0ead);}};exports['varset']=function(_0x248060){try{if(!_['isNil'](_0x248060[_0x7505('0x1b')])&&!_[_0x7505('0x14')](_0x248060[_0x7505('0x1b')]['mixmonitor_filename'])){utils[_0x7505('0x12')](util[_0x7505('0x2')](_0x7505('0x1c'),_0x248060[_0x7505('0x4')]),_0x248060);utils[_0x7505('0x1')](util[_0x7505('0x2')](_0x7505('0x1d'),_0x248060[_0x7505('0x4')],_0x248060[_0x7505('0x1b')],_0x248060[_0x7505('0x1e')]));if(_['endsWith'](_0x248060[_0x7505('0x1e')],_0x7505('0x1f'))){_0x248060['value']=_0x248060[_0x7505('0x1e')][_0x7505('0x20')](_0x7505('0x1f'),'.WAV');}if(recordings[_0x248060[_0x7505('0x18')]]){var _0x54aa53=_[_0x7505('0x21')](recordings[_0x248060[_0x7505('0x18')]][_0x7505('0x22')],{'value':_0x248060[_0x7505('0x1e')]});if(_['isNil'](_0x54aa53)){recordings[_0x248060[_0x7505('0x18')]][_0x7505('0x22')][_0x7505('0x23')]({'value':_0x248060[_0x7505('0x1e')]});}}}}catch(_0xff27d2){utils[_0x7505('0x10')](util[_0x7505('0x2')](_0x7505('0x1c'),_0x248060['uniqueid']),_0xff27d2);}};exports[_0x7505('0x24')]=function(_0x4dbfb2){try{if(!_[_0x7505('0x14')](recordings[_0x4dbfb2[_0x7505('0x4')]])){utils[_0x7505('0x12')](util[_0x7505('0x2')](_0x7505('0x25'),_0x4dbfb2[_0x7505('0x4')]),_0x4dbfb2);utils['info'](util[_0x7505('0x2')](_0x7505('0x26'),_0x4dbfb2[_0x7505('0x4')],_0x4dbfb2[_0x7505('0x27')],_0x4dbfb2[_0x7505('0x28')],_0x4dbfb2['cause-txt']));recordings[_0x4dbfb2['uniqueid']]['calleridnum']=_0x4dbfb2['calleridnum'];recordings[_0x4dbfb2[_0x7505('0x4')]][_0x7505('0x28')]=_0x4dbfb2[_0x7505('0x28')];recordings[_0x4dbfb2[_0x7505('0x4')]]['connectedlinenum']=_0x4dbfb2[_0x7505('0x29')];recordings[_0x4dbfb2[_0x7505('0x4')]][_0x7505('0x2a')]=_0x4dbfb2[_0x7505('0x2a')];if(recordings[_0x4dbfb2[_0x7505('0x4')]][_0x7505('0x2b')]=='outbound'&&recordings[_0x4dbfb2[_0x7505('0x4')]][_0x7505('0x5')]){recordings[_0x4dbfb2[_0x7505('0x4')]][_0x7505('0x29')]=recordings[_0x4dbfb2[_0x7505('0x4')]][_0x7505('0x5')];recordings[_0x4dbfb2['uniqueid']]['connectedlinename']='';}recordings[_0x4dbfb2[_0x7505('0x4')]][_0x7505('0x22')][_0x7505('0x2c')](function(_0x57271e){var _0x1899ba=_[_0x7505('0x2d')](recordings[_0x4dbfb2[_0x7505('0x4')]]);_0x1899ba[_0x7505('0x1e')]=_0x57271e['value'];writeDB(_0x1899ba);});delete recordings[_0x4dbfb2[_0x7505('0x4')]];}}catch(_0x115789){utils[_0x7505('0x10')](util['format'](_0x7505('0x25'),_0x4dbfb2[_0x7505('0x4')]),_0x115789);}};exports[_0x7505('0x2e')]=function(_0x1226d2){try{if(!_[_0x7505('0x14')](recordings[_0x1226d2[_0x7505('0x4')]])){utils['debug'](util[_0x7505('0x2')](_0x7505('0x2f'),_0x1226d2[_0x7505('0x4')]),_0x1226d2);utils['info'](util[_0x7505('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1226d2['uniqueid'],_0x1226d2[_0x7505('0x30')],_0x1226d2['appdata']));if(_0x1226d2[_0x7505('0x30')][_0x7505('0x31')]()==_0x7505('0x32')&&_[_0x7505('0x33')](_0x1226d2[_0x7505('0x34')][_0x7505('0x31')](),_0x7505('0x35'))){var _0x8bdfe1=_0x1226d2[_0x7505('0x34')]['split']('=');var _0x4185d3=_0x8bdfe1[0x0]['substring'](_0x8bdfe1[0x0][_0x7505('0x36')]('(')+0x1,_0x8bdfe1[0x0][_0x7505('0x36')](')'));var _0x550860=_0x8bdfe1[0x1];recordings[_0x1226d2['uniqueid']][_0x4185d3]=_0x550860;}}}catch(_0x5cb869){utils[_0x7505('0x10')](util[_0x7505('0x2')](_0x7505('0x2f'),_0x1226d2[_0x7505('0x4')]),_0x5cb869);}};exports[_0x7505('0x37')]=function(_0x12d56c){try{if(!_[_0x7505('0x14')](recordings[_0x12d56c[_0x7505('0x4')]])){utils[_0x7505('0x12')](util[_0x7505('0x2')](_0x7505('0x38'),_0x12d56c[_0x7505('0x4')]),_0x12d56c);utils[_0x7505('0x1')](util['format'](_0x7505('0x39'),_0x12d56c[_0x7505('0x4')],_0x12d56c['queue']));recordings[_0x12d56c[_0x7505('0x4')]][_0x7505('0x3a')]=_0x12d56c[_0x7505('0x3a')];}}catch(_0x46ac72){utils['error'](util[_0x7505('0x2')](_0x7505('0x38'),_0x12d56c[_0x7505('0x4')]),_0x46ac72);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 517522b..fa4254b 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 _0xe99a=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xe99a,0x1d7));var _0xae99=function(_0x55a838,_0x36f0e3){_0x55a838=_0x55a838-0x0;var _0x246ad2=_0xe99a[_0x55a838];return _0x246ad2;};'use strict';var _=require(_0xae99('0x0'));var util=require(_0xae99('0x1'));var utils=require(_0xae99('0x2'));function writeDB(_0x881a04){utils[_0xae99('0x3')](util[_0xae99('0x4')](_0xae99('0x5'),_0x881a04[_0xae99('0x6')]===_0xae99('0x7')?_0x881a04[_0xae99('0x8')]:_0x881a04[_0xae99('0x9')],_0x881a04[_0xae99('0x6')]));utils[_0xae99('0xa')](_0xae99('0xb'),_0x881a04);}exports[_0xae99('0xc')]=function(_0x361d2d){try{utils['debug'](util['format'](_0xae99('0xd'),_0x361d2d['uniqueid']),_0x361d2d);utils['info'](util[_0xae99('0x4')](_0xae99('0xe'),_0x361d2d[_0xae99('0x9')],_0x361d2d[_0xae99('0xf')],_0x361d2d[_0xae99('0x10')],_0x361d2d[_0xae99('0x11')],_0x361d2d[_0xae99('0x12')]));_0x361d2d['type']=_0xae99('0x13');writeDB(_0x361d2d);}catch(_0x349bd3){utils['error'](util[_0xae99('0x4')](_0xae99('0xd'),_0x361d2d['uniqueid']),_0x349bd3);}};exports[_0xae99('0x14')]=function(_0x484834){try{utils['debug'](util[_0xae99('0x4')](_0xae99('0x15'),_0x484834['origtransfereruniqueid']),_0x484834);utils['info'](util[_0xae99('0x4')](_0xae99('0x16'),_0x484834['origtransfereruniqueid'],_0x484834['origtransferercalleridnum'],_0x484834[_0xae99('0x17')],_0x484834[_0xae99('0x18')],_0x484834[_0xae99('0x19')]));_0x484834=_[_0xae99('0x1a')](_0x484834,{'transfererchannel':_0x484834[_0xae99('0x1b')],'transferercalleridnum':_0x484834['origtransferercalleridnum'],'transferercalleridname':_0x484834['origtransferercalleridname'],'transfererconnectedlinenum':_0x484834['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x484834[_0xae99('0x1c')],'transfereraccountcode':_0x484834['origtransfereraccountcode'],'transferercontext':_0x484834[_0xae99('0x1d')],'transfererexten':_0x484834[_0xae99('0x1e')],'transfererlinkedid':_0x484834[_0xae99('0x1f')],'context':_0x484834['origtransferercontext'],'extension':_0x484834[_0xae99('0x20')],'type':_0xae99('0x7')});if(_[_0xae99('0x21')](_0x484834['transfereechannel'])){_0x484834=_[_0xae99('0x1a')](_0x484834,{'transfereechannel':_0x484834[_0xae99('0x22')],'transfereecalleridnum':_0x484834[_0xae99('0x18')],'transfereecalleridname':_0x484834[_0xae99('0x19')],'transfereeconnectedlinenum':_0x484834[_0xae99('0x23')],'transfereeconnectedlinename':_0x484834[_0xae99('0x24')],'transfereeaccountcode':_0x484834[_0xae99('0x25')],'transfereecontext':_0x484834[_0xae99('0x26')],'transfereeexten':_0x484834[_0xae99('0x27')],'transfereelinkedid':_0x484834['transfertargetlinkedid']});}writeDB(_0x484834);}catch(_0x11d846){utils[_0xae99('0x28')](util[_0xae99('0x4')](_0xae99('0x15'),_0x484834[_0xae99('0x8')]),_0x11d846);}}; \ No newline at end of file +var _0x890f=['request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid'];(function(_0x3af580,_0x25e78a){var _0x3e086c=function(_0x8e3516){while(--_0x8e3516){_0x3af580['push'](_0x3af580['shift']());}};_0x3e086c(++_0x25e78a);}(_0x890f,0x1db));var _0xf890=function(_0x3de01a,_0xcc1fd4){_0x3de01a=_0x3de01a-0x0;var _0x43f31e=_0x890f[_0x3de01a];return _0x43f31e;};'use strict';var _=require(_0xf890('0x0'));var util=require('util');var utils=require(_0xf890('0x1'));function writeDB(_0x1b77ea){utils[_0xf890('0x2')](util[_0xf890('0x3')](_0xf890('0x4'),_0x1b77ea[_0xf890('0x5')]===_0xf890('0x6')?_0x1b77ea[_0xf890('0x7')]:_0x1b77ea[_0xf890('0x8')],_0x1b77ea[_0xf890('0x5')]));utils[_0xf890('0x9')](_0xf890('0xa'),_0x1b77ea);}exports[_0xf890('0xb')]=function(_0x1e3a0d){try{utils[_0xf890('0xc')](util['format'](_0xf890('0xd'),_0x1e3a0d[_0xf890('0x8')]),_0x1e3a0d);utils['info'](util[_0xf890('0x3')](_0xf890('0xe'),_0x1e3a0d['uniqueid'],_0x1e3a0d['transferercalleridnum'],_0x1e3a0d[_0xf890('0xf')],_0x1e3a0d[_0xf890('0x10')],_0x1e3a0d[_0xf890('0x11')]));_0x1e3a0d[_0xf890('0x5')]=_0xf890('0x12');writeDB(_0x1e3a0d);}catch(_0x905f39){utils[_0xf890('0x13')](util[_0xf890('0x3')](_0xf890('0xd'),_0x1e3a0d[_0xf890('0x8')]),_0x905f39);}};exports[_0xf890('0x14')]=function(_0x4aa404){try{utils['debug'](util[_0xf890('0x3')](_0xf890('0x15'),_0x4aa404[_0xf890('0x7')]),_0x4aa404);utils[_0xf890('0x2')](util[_0xf890('0x3')](_0xf890('0x16'),_0x4aa404['origtransfereruniqueid'],_0x4aa404[_0xf890('0x17')],_0x4aa404[_0xf890('0x18')],_0x4aa404['transfertargetcalleridnum'],_0x4aa404[_0xf890('0x19')]));_0x4aa404=_[_0xf890('0x1a')](_0x4aa404,{'transfererchannel':_0x4aa404[_0xf890('0x1b')],'transferercalleridnum':_0x4aa404[_0xf890('0x17')],'transferercalleridname':_0x4aa404[_0xf890('0x18')],'transfererconnectedlinenum':_0x4aa404[_0xf890('0x1c')],'transfererconnectedlinename':_0x4aa404[_0xf890('0x1d')],'transfereraccountcode':_0x4aa404[_0xf890('0x1e')],'transferercontext':_0x4aa404[_0xf890('0x1f')],'transfererexten':_0x4aa404[_0xf890('0x20')],'transfererlinkedid':_0x4aa404[_0xf890('0x21')],'context':_0x4aa404[_0xf890('0x22')],'extension':_0x4aa404[_0xf890('0x23')],'type':_0xf890('0x6')});if(_['isNil'](_0x4aa404[_0xf890('0x24')])){_0x4aa404=_[_0xf890('0x1a')](_0x4aa404,{'transfereechannel':_0x4aa404[_0xf890('0x25')],'transfereecalleridnum':_0x4aa404[_0xf890('0x26')],'transfereecalleridname':_0x4aa404[_0xf890('0x19')],'transfereeconnectedlinenum':_0x4aa404['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4aa404[_0xf890('0x27')],'transfereeaccountcode':_0x4aa404[_0xf890('0x28')],'transfereecontext':_0x4aa404[_0xf890('0x29')],'transfereeexten':_0x4aa404[_0xf890('0x2a')],'transfereelinkedid':_0x4aa404[_0xf890('0x2b')]});}writeDB(_0x4aa404);}catch(_0x52454a){utils[_0xf890('0x13')](util[_0xf890('0x3')](_0xf890('0x15'),_0x4aa404['origtransfereruniqueid']),_0x52454a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ba344f1..333fc94 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 _0xc991=['result','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','name','then','[utils][getUser]\x20where:%s','stringify','length'];(function(_0x104ac0,_0x43e235){var _0x1b9f18=function(_0x2ac92f){while(--_0x2ac92f){_0x104ac0['push'](_0x104ac0['shift']());}};_0x1b9f18(++_0x43e235);}(_0xc991,0xfc));var _0x1c99=function(_0x183381,_0x541447){_0x183381=_0x183381-0x0;var _0x2d3b77=_0xc991[_0x183381];return _0x2d3b77;};'use strict';var BPromise=require(_0x1c99('0x0'));var jayson=require(_0x1c99('0x1'));var moment=require('moment');var util=require(_0x1c99('0x2'));var client=jayson['client'][_0x1c99('0x3')]({'port':0x2329});var logger=require(_0x1c99('0x4'))('xdr');exports['info']=function(_0x3eae7f,_0x2e581b){logger[_0x1c99('0x5')](_0x3eae7f,_0x2e581b?util['inspect'](_0x2e581b,{'showHidden':![],'depth':null}):'');};exports[_0x1c99('0x6')]=function(_0x561f40,_0x2d714e){logger[_0x1c99('0x6')](_0x561f40,_0x2d714e?util[_0x1c99('0x7')](_0x2d714e,{'showHidden':![],'depth':null}):'');};exports[_0x1c99('0x8')]=function(_0x28645d,_0x566bde){logger[_0x1c99('0x8')](_0x28645d,_0x566bde?util[_0x1c99('0x7')](_0x566bde,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x47fbb5,_0x462afc){return client[_0x1c99('0x9')](_0x47fbb5,{'body':_0x462afc})['then'](function(_0x560ccd){logger[_0x1c99('0x6')](_0x1c99('0xa'),_0x47fbb5,_0x560ccd?util[_0x1c99('0x7')](_0x560ccd,{'showHidden':![],'depth':null}):'');})[_0x1c99('0xb')](function(_0xcb2ced){logger[_0x1c99('0x8')](_0x1c99('0xa'),_0x47fbb5,_0xcb2ced?util[_0x1c99('0x7')](_0xcb2ced,{'showHidden':![],'depth':null}):'');});};function getUser(_0x24f4cd){return client[_0x1c99('0x9')](_0x1c99('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x1c99('0xd'),'interface'],'where':_0x24f4cd,'limit':0x1}})[_0x1c99('0xe')](function(_0x13d2f3){logger['debug'](_0x1c99('0xf'),JSON[_0x1c99('0x10')](_0x24f4cd),_0x13d2f3?util[_0x1c99('0x7')](_0x13d2f3,{'showHidden':![],'depth':null}):'');return _0x13d2f3['result'][_0x1c99('0x11')]?_0x13d2f3[_0x1c99('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x23aef0){return new BPromise(function(_0x1ff07f,_0x505e6d){if(_0x23aef0){return getUser({'internal':_0x23aef0})[_0x1c99('0xe')](function(_0x39a8a6){logger[_0x1c99('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x23aef0,_0x39a8a6?'found':_0x1c99('0x13'));return _0x1ff07f(_0x39a8a6);})['catch'](function(_0x2974e2){logger['error'](_0x1c99('0x14'),_0x2974e2?util[_0x1c99('0x7')](_0x2974e2,{'showHidden':![],'depth':null}):'');return _0x1ff07f(null);});}return _0x1ff07f(null);});};exports[_0x1c99('0x15')]=function(_0x3d6a61){return new BPromise(function(_0x4b420d,_0x516d9d){if(_0x3d6a61){return getUser({'interface':_0x3d6a61})['then'](function(_0x440ec5){logger[_0x1c99('0x5')](_0x1c99('0x16'),_0x3d6a61,_0x440ec5?_0x1c99('0x17'):_0x1c99('0x13'));return _0x4b420d(_0x440ec5);})[_0x1c99('0xb')](function(_0x2504a9){logger[_0x1c99('0x8')]('[utils][getUserByInterface]',_0x2504a9?util[_0x1c99('0x7')](_0x2504a9,{'showHidden':![],'depth':null}):'');return _0x4b420d(null);});}return _0x4b420d(null);});};exports[_0x1c99('0x18')]=function(_0x364e95){return new BPromise(function(_0x4764b5,_0x52bd5d){if(_0x364e95){return getUser({'name':_0x364e95})[_0x1c99('0xe')](function(_0x513c23){logger[_0x1c99('0x5')](_0x1c99('0x19'),_0x364e95,_0x513c23?'found':_0x1c99('0x13'));return _0x4764b5(_0x513c23);})['catch'](function(_0x1d6c5e){logger['error']('[utils][getUserByName]',_0x1d6c5e?util[_0x1c99('0x7')](_0x1d6c5e,{'showHidden':![],'depth':null}):'');return _0x4764b5(null);});}return _0x4764b5(null);});};exports['getVoiceQueueByName']=function(_0x349bcc){return new BPromise(function(_0x4b1095,_0x24e61e){if(_0x349bcc){return client[_0x1c99('0x9')](_0x1c99('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x1c99('0xd'),_0x1c99('0x1b'),_0x1c99('0x1c'),_0x1c99('0x1d')],'where':{'name':_0x349bcc},'limit':0x1}})[_0x1c99('0xe')](function(_0x2b93e4){logger['debug'](_0x1c99('0x1e'),_0x349bcc,_0x2b93e4?util['inspect'](_0x2b93e4,{'showHidden':![],'depth':null}):'');logger[_0x1c99('0x5')](_0x1c99('0x1f'),_0x349bcc,_0x2b93e4?_0x1c99('0x17'):_0x1c99('0x13'));return _0x4b1095(_0x2b93e4[_0x1c99('0x12')]['length']?_0x2b93e4[_0x1c99('0x12')][0x0]:null);})[_0x1c99('0xb')](function(_0xc80968){logger[_0x1c99('0x8')](_0x1c99('0x20'),_0xc80968?util['inspect'](_0xc80968,{'showHidden':![],'depth':null}):'');return _0x4b1095(null);});}return _0x4b1095(null);});};exports[_0x1c99('0x21')]=function(_0xd8e696,_0x24a431){return moment(_0xd8e696)[_0x1c99('0x22')](_0x24a431,'seconds')['format'](_0x1c99('0x23'));};exports[_0x1c99('0x24')]=function(_0x3ab34b,_0x2416a8){return moment(_0x3ab34b)[_0x1c99('0x25')](_0x2416a8,_0x1c99('0x26'))[_0x1c99('0x27')](_0x1c99('0x23'));};exports[_0x1c99('0x28')]=function(_0x5a9dba,_0x39fda0){return moment(_0x5a9dba)[_0x1c99('0x29')](moment(_0x39fda0),_0x1c99('0x26'));};exports[_0x1c99('0x2a')]=function(_0x36c432,_0x14a852){return parseInt(_0x36c432,0xa)+parseInt(_0x14a852,0xa);};exports['now']=function(){return moment()[_0x1c99('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1c99('0x2b')]=function(_0xd3dbab,_0x3aa42b){if(_0x3aa42b){return moment(_0xd3dbab)['isAfter'](_0x3aa42b);}return!![];};exports['isBefore']=function(_0x409f96,_0x2409da){if(_0x2409da){return moment(_0x409f96)[_0x1c99('0x2c')](_0x2409da);}else if(_0x409f96){return!![];}return![];}; \ No newline at end of file +var _0x6659=['GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','seconds','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName'];(function(_0x69ede,_0x3f8e97){var _0x13e7e1=function(_0x314100){while(--_0x314100){_0x69ede['push'](_0x69ede['shift']());}};_0x13e7e1(++_0x3f8e97);}(_0x6659,0x169));var _0x9665=function(_0xe78192,_0x34ec90){_0xe78192=_0xe78192-0x0;var _0x12a23f=_0x6659[_0xe78192];return _0x12a23f;};'use strict';var BPromise=require(_0x9665('0x0'));var jayson=require(_0x9665('0x1'));var moment=require(_0x9665('0x2'));var util=require(_0x9665('0x3'));var client=jayson[_0x9665('0x4')][_0x9665('0x5')]({'port':0x2329});var logger=require(_0x9665('0x6'))(_0x9665('0x7'));exports['info']=function(_0x791c11,_0x224039){logger[_0x9665('0x8')](_0x791c11,_0x224039?util[_0x9665('0x9')](_0x224039,{'showHidden':![],'depth':null}):'');};exports[_0x9665('0xa')]=function(_0x3b36f8,_0x585ec6){logger[_0x9665('0xa')](_0x3b36f8,_0x585ec6?util[_0x9665('0x9')](_0x585ec6,{'showHidden':![],'depth':null}):'');};exports[_0x9665('0xb')]=function(_0x432ad9,_0x2a3374){logger[_0x9665('0xb')](_0x432ad9,_0x2a3374?util[_0x9665('0x9')](_0x2a3374,{'showHidden':![],'depth':null}):'');};exports[_0x9665('0xc')]=function(_0x36cac1,_0x1fc5b8){return client[_0x9665('0xc')](_0x36cac1,{'body':_0x1fc5b8})[_0x9665('0xd')](function(_0x5a8bc0){logger[_0x9665('0xa')]('[utils][request]\x20name:%s',_0x36cac1,_0x5a8bc0?util[_0x9665('0x9')](_0x5a8bc0,{'showHidden':![],'depth':null}):'');})[_0x9665('0xe')](function(_0x42e483){logger[_0x9665('0xb')]('[utils][request]\x20name:%s',_0x36cac1,_0x42e483?util[_0x9665('0x9')](_0x42e483,{'showHidden':![],'depth':null}):'');});};function getUser(_0xf02127){return client[_0x9665('0xc')](_0x9665('0xf'),{'options':{'raw':!![],'attributes':['id',_0x9665('0x10'),_0x9665('0x11'),_0x9665('0x12')],'where':_0xf02127,'limit':0x1}})['then'](function(_0x24c60b){logger['debug'](_0x9665('0x13'),JSON['stringify'](_0xf02127),_0x24c60b?util['inspect'](_0x24c60b,{'showHidden':![],'depth':null}):'');return _0x24c60b[_0x9665('0x14')]['length']?_0x24c60b['result'][0x0]:null;});}exports[_0x9665('0x15')]=function(_0x2f24b9){return new BPromise(function(_0x4f38e6,_0x532ac9){if(_0x2f24b9){return getUser({'internal':_0x2f24b9})[_0x9665('0xd')](function(_0x9d1b70){logger[_0x9665('0x8')](_0x9665('0x16'),_0x2f24b9,_0x9d1b70?_0x9665('0x17'):_0x9665('0x18'));return _0x4f38e6(_0x9d1b70);})[_0x9665('0xe')](function(_0x349200){logger[_0x9665('0xb')]('[utils][getUserByInternal]',_0x349200?util[_0x9665('0x9')](_0x349200,{'showHidden':![],'depth':null}):'');return _0x4f38e6(null);});}return _0x4f38e6(null);});};exports[_0x9665('0x19')]=function(_0x117090){return new BPromise(function(_0x2bcb9d,_0x8362b2){if(_0x117090){return getUser({'interface':_0x117090})[_0x9665('0xd')](function(_0x5effbb){logger[_0x9665('0x8')](_0x9665('0x1a'),_0x117090,_0x5effbb?_0x9665('0x17'):_0x9665('0x18'));return _0x2bcb9d(_0x5effbb);})[_0x9665('0xe')](function(_0x1d11c9){logger[_0x9665('0xb')]('[utils][getUserByInterface]',_0x1d11c9?util[_0x9665('0x9')](_0x1d11c9,{'showHidden':![],'depth':null}):'');return _0x2bcb9d(null);});}return _0x2bcb9d(null);});};exports[_0x9665('0x1b')]=function(_0x36a597){return new BPromise(function(_0x4903d9,_0x137654){if(_0x36a597){return getUser({'name':_0x36a597})[_0x9665('0xd')](function(_0x56847b){logger['info'](_0x9665('0x1c'),_0x36a597,_0x56847b?_0x9665('0x17'):_0x9665('0x18'));return _0x4903d9(_0x56847b);})[_0x9665('0xe')](function(_0x4bb048){logger[_0x9665('0xb')](_0x9665('0x1d'),_0x4bb048?util['inspect'](_0x4bb048,{'showHidden':![],'depth':null}):'');return _0x4903d9(null);});}return _0x4903d9(null);});};exports[_0x9665('0x1e')]=function(_0x13ede4){return new BPromise(function(_0x1873e4,_0xac6037){if(_0x13ede4){return client[_0x9665('0xc')](_0x9665('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x9665('0x11'),'type',_0x9665('0x20'),_0x9665('0x21')],'where':{'name':_0x13ede4},'limit':0x1}})['then'](function(_0x40c13b){logger[_0x9665('0xa')](_0x9665('0x22'),_0x13ede4,_0x40c13b?util[_0x9665('0x9')](_0x40c13b,{'showHidden':![],'depth':null}):'');logger[_0x9665('0x8')](_0x9665('0x23'),_0x13ede4,_0x40c13b?_0x9665('0x17'):_0x9665('0x18'));return _0x1873e4(_0x40c13b[_0x9665('0x14')][_0x9665('0x24')]?_0x40c13b[_0x9665('0x14')][0x0]:null);})[_0x9665('0xe')](function(_0x40f445){logger[_0x9665('0xb')](_0x9665('0x25'),_0x40f445?util[_0x9665('0x9')](_0x40f445,{'showHidden':![],'depth':null}):'');return _0x1873e4(null);});}return _0x1873e4(null);});};exports[_0x9665('0x26')]=function(_0x153f10,_0x49af4f){return moment(_0x153f10)[_0x9665('0x27')](_0x49af4f,'seconds')[_0x9665('0x28')](_0x9665('0x29'));};exports[_0x9665('0x2a')]=function(_0x185c9c,_0x253440){return moment(_0x185c9c)[_0x9665('0x2b')](_0x253440,'seconds')[_0x9665('0x28')](_0x9665('0x29'));};exports[_0x9665('0x2c')]=function(_0x17ea82,_0x12758a){return moment(_0x17ea82)['diff'](moment(_0x12758a),_0x9665('0x2d'));};exports['sumTime']=function(_0x41ed34,_0x286ef4){return parseInt(_0x41ed34,0xa)+parseInt(_0x286ef4,0xa);};exports[_0x9665('0x2e')]=function(){return moment()[_0x9665('0x28')](_0x9665('0x29'));};exports[_0x9665('0x2f')]=function(_0xdb4230,_0x39e30d){if(_0x39e30d){return moment(_0xdb4230)[_0x9665('0x2f')](_0x39e30d);}return!![];};exports[_0x9665('0x30')]=function(_0x1a0388,_0x5afd07){if(_0x5afd07){return moment(_0x1a0388)[_0x9665('0x30')](_0x5afd07);}else if(_0x1a0388){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 6d745a2..5ad7509 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefc7=['api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','connection','name','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','ensureDir','then','user','no-user','timestamp','catch','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefc7,0x14f));var _0x7efc=function(_0x557b98,_0xcd3e1f){_0x557b98=_0x557b98-0x0;var _0x1c08f0=_0xefc7[_0x557b98];return _0x1c08f0;};var fs=require(_0x7efc('0x0'));var _=require(_0x7efc('0x1'));var ewinston=require(_0x7efc('0x2'));var path=require(_0x7efc('0x3'));var util=require(_0x7efc('0x4'));var fileLogger=require(_0x7efc('0x5'))['fileLogger'];var safeTemplate=require(_0x7efc('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x7efc('0x7'))[_0x7efc('0x8')];function ClientSideLogger(){function _0x142aca(_0x325e96){var _0x554f47=path['join'](_0x7efc('0x9'),_0x7efc('0xa'),_0x7efc('0xb'));var _0x526f9c=path[_0x7efc('0xc')](_0x7efc('0xd'),_0x325e96[_0x7efc('0xe')]+'-'+_0x325e96['name']);return fs[_0x7efc('0xf')](path[_0x7efc('0xc')](_0x554f47,_0x526f9c))[_0x7efc('0x10')](function(){var _0x2b9aae=fileLogger(_0x7efc('0xd'),path[_0x7efc('0xc')](_0x554f47,_0x526f9c));return _0x2b9aae;})['catch'](function(_0x148521){throw _0x148521;});}this[_0x7efc('0xa')]=function(_0x1f9912,_0x2e4bdb,_0x2a3c67,_0x4e8dc9){return _0x142aca(_0x1f9912['user'])[_0x7efc('0x10')](function(_0x3edc44){var _0x1831a2=_0x3edc44[_0x2e4bdb];return _0x1831a2;})[_0x7efc('0x10')](function(_0x948d17){var _0x5255bb=_0x1f9912[_0x7efc('0x11')]?_0x1f9912[_0x7efc('0x11')]['id']:_0x7efc('0x12');var _0x1e64d9=_0x4e8dc9['data'];var _0x17018e=_0x4e8dc9[_0x7efc('0x13')];var _0x21a6c9=new Date(Number(_0x17018e));return _0x948d17(_0x5255bb,_0x21a6c9,_0x2a3c67,_0x1e64d9);})[_0x7efc('0x14')](function(_0x21ced6){fileLogger(_0x7efc('0xd'))[_0x7efc('0x15')](_0x21ced6);});};}function setupLoggers(_0x6a8e1){return new Promise(function(_0x40d0be){var _0x5b4499=new ClientSideLogger();var _0x1f5856=fileLogger(_0x7efc('0x16'));var _0xa713a2=fileLogger(_0x7efc('0x17'));_0x6a8e1[_0x7efc('0x18')](_0x7efc('0x19'),_0x5b4499);_0x6a8e1[_0x7efc('0x1a')](ewinston[_0x7efc('0x1b')]({'winstonInstance':_0x1f5856,'meta':![],'statusLevels':!![],'msg':function(_0x3c1d69,_0x20bf8b){var _0x42f207=_0x7efc('0x1c');if(!_[_0x7efc('0x1d')](_0x3c1d69[_0x7efc('0x1e')])){_0x42f207+=_0x7efc('0x1f');var _0x5bdad9=_0x3c1d69[_0x7efc('0x1e')];maskSensitiveData(_0x5bdad9);}return safeTemplate(util['format'](_0x42f207,_0x3c1d69['method'],_0x3c1d69[_0x7efc('0x20')][_0x7efc('0x21')]?_0x3c1d69['headers'][_0x7efc('0x21')]:_0x3c1d69['connection'][_0x7efc('0x22')]||_0x3c1d69['ip'],_0x3c1d69[_0x7efc('0x23')],_0x20bf8b[_0x7efc('0x24')],_0x20bf8b[_0x7efc('0x25')],_0x3c1d69[_0x7efc('0x11')]?_0x3c1d69[_0x7efc('0x11')]['id']:null,_0x3c1d69['user']?_0x3c1d69[_0x7efc('0x11')]['name']:null,_0x3c1d69[_0x7efc('0x11')]?_0x3c1d69['user'][_0x7efc('0xe')]:null,_0x5bdad9?util[_0x7efc('0x26')](_0x5bdad9,![],null):''));}}));_0x6a8e1[_0x7efc('0x1a')](ewinston[_0x7efc('0x1b')]({'winstonInstance':_0xa713a2,'meta':![],'statusLevels':!![],'msg':function(_0xf627a1,_0x2ac158){var _0x53f1f0=_0x7efc('0x27');if(_0xf627a1['body']&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x28')]&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x29')]){_0x53f1f0=_0x7efc('0x2a');}return util[_0x7efc('0x2b')](_0x53f1f0,_0xf627a1[_0x7efc('0x2c')],_0xf627a1[_0x7efc('0x20')][_0x7efc('0x21')]?_0xf627a1[_0x7efc('0x20')][_0x7efc('0x21')]:_0xf627a1[_0x7efc('0x2d')][_0x7efc('0x22')]||_0xf627a1['ip'],_0xf627a1[_0x7efc('0x23')],_0x2ac158[_0x7efc('0x24')],_0x2ac158['responseTime'],_0xf627a1['user']?_0xf627a1[_0x7efc('0x11')]['id']:null,_0xf627a1[_0x7efc('0x11')]?_0xf627a1[_0x7efc('0x11')][_0x7efc('0x2e')]:null,_0xf627a1[_0x7efc('0x11')]?_0xf627a1[_0x7efc('0x11')]['role']:null,_0xf627a1[_0x7efc('0x1e')]&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x28')]?_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x28')]:_0x7efc('0x2f'),_0xf627a1[_0x7efc('0x1e')]&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x29')]?_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x29')]:'',_0xf627a1['body']&&_0xf627a1['body'][_0x7efc('0x30')]?_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x30')]:'');},'ignoreRoute':function(_0x1fb77f){var _0x16369a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x16369a[_0x7efc('0x31')](_0x1fb77f[_0x7efc('0x23')]);}}));return _0x40d0be();});}exports[_0x7efc('0x32')]=setupLoggers; \ No newline at end of file +var _0x4f3d=['fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','ensureDir','then','catch','user','timestamp','error','set','client-side-logger','use','logger','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','other','agent_name','test','setupLoggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f3d,0x1cc));var _0xd4f3=function(_0x32b307,_0x4485f8){_0x32b307=_0x32b307-0x0;var _0x5ead1c=_0x4f3d[_0x32b307];return _0x5ead1c;};var fs=require(_0xd4f3('0x0'));var _=require(_0xd4f3('0x1'));var ewinston=require(_0xd4f3('0x2'));var path=require(_0xd4f3('0x3'));var util=require(_0xd4f3('0x4'));var fileLogger=require(_0xd4f3('0x5'))[_0xd4f3('0x6')];var safeTemplate=require(_0xd4f3('0x7'))['safeTemplate'];var maskSensitiveData=require(_0xd4f3('0x8'))[_0xd4f3('0x9')];function ClientSideLogger(){function _0x6a5a9f(_0x42e0f8){var _0x2b00e3=path[_0xd4f3('0xa')](_0xd4f3('0xb'),_0xd4f3('0xc'),'xcally');var _0x2d0ad9=path[_0xd4f3('0xa')](_0xd4f3('0xd'),_0x42e0f8[_0xd4f3('0xe')]+'-'+_0x42e0f8[_0xd4f3('0xf')]);return fs[_0xd4f3('0x10')](path[_0xd4f3('0xa')](_0x2b00e3,_0x2d0ad9))[_0xd4f3('0x11')](function(){var _0x2fe0aa=fileLogger(_0xd4f3('0xd'),path[_0xd4f3('0xa')](_0x2b00e3,_0x2d0ad9));return _0x2fe0aa;})[_0xd4f3('0x12')](function(_0x2bd0f6){throw _0x2bd0f6;});}this[_0xd4f3('0xc')]=function(_0x398a3e,_0x291d6b,_0x477b07,_0x58e472){return _0x6a5a9f(_0x398a3e['user'])['then'](function(_0x501a31){var _0x3da69e=_0x501a31[_0x291d6b];return _0x3da69e;})['then'](function(_0x2306e5){var _0x3ca3be=_0x398a3e[_0xd4f3('0x13')]?_0x398a3e[_0xd4f3('0x13')]['id']:'no-user';var _0x5c5903=_0x58e472['data'];var _0x2c8dd7=_0x58e472[_0xd4f3('0x14')];var _0x1982b6=new Date(Number(_0x2c8dd7));return _0x2306e5(_0x3ca3be,_0x1982b6,_0x477b07,_0x5c5903);})[_0xd4f3('0x12')](function(_0x10489f){fileLogger(_0xd4f3('0xd'))[_0xd4f3('0x15')](_0x10489f);});};}function setupLoggers(_0xd8dc81){return new Promise(function(_0x54ea6e){var _0x1728d6=new ClientSideLogger();var _0x2ba35f=fileLogger('api');var _0x26194d=fileLogger('auth');_0xd8dc81[_0xd4f3('0x16')](_0xd4f3('0x17'),_0x1728d6);_0xd8dc81[_0xd4f3('0x18')](ewinston[_0xd4f3('0x19')]({'winstonInstance':_0x2ba35f,'meta':![],'statusLevels':!![],'msg':function(_0x47b0c6,_0x5e731f){var _0x2faefa='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xd4f3('0x1a')](_0x47b0c6[_0xd4f3('0x1b')])){_0x2faefa+='\x20body=%s';var _0x3e2abb=_0x47b0c6[_0xd4f3('0x1b')];maskSensitiveData(_0x3e2abb);}return safeTemplate(util[_0xd4f3('0x1c')](_0x2faefa,_0x47b0c6['method'],_0x47b0c6[_0xd4f3('0x1d')][_0xd4f3('0x1e')]?_0x47b0c6[_0xd4f3('0x1d')][_0xd4f3('0x1e')]:_0x47b0c6[_0xd4f3('0x1f')][_0xd4f3('0x20')]||_0x47b0c6['ip'],_0x47b0c6[_0xd4f3('0x21')],_0x5e731f[_0xd4f3('0x22')],_0x5e731f[_0xd4f3('0x23')],_0x47b0c6[_0xd4f3('0x13')]?_0x47b0c6['user']['id']:null,_0x47b0c6[_0xd4f3('0x13')]?_0x47b0c6[_0xd4f3('0x13')][_0xd4f3('0xf')]:null,_0x47b0c6[_0xd4f3('0x13')]?_0x47b0c6[_0xd4f3('0x13')][_0xd4f3('0xe')]:null,_0x3e2abb?util[_0xd4f3('0x24')](_0x3e2abb,![],null):''));}}));_0xd8dc81[_0xd4f3('0x18')](ewinston[_0xd4f3('0x19')]({'winstonInstance':_0x26194d,'meta':![],'statusLevels':!![],'msg':function(_0x4de0ae,_0x2c5653){var _0x353bb4=_0xd4f3('0x25');if(_0x4de0ae['body']&&_0x4de0ae[_0xd4f3('0x1b')][_0xd4f3('0x26')]&&_0x4de0ae[_0xd4f3('0x1b')][_0xd4f3('0x27')]){_0x353bb4=_0xd4f3('0x28');}return util['format'](_0x353bb4,_0x4de0ae[_0xd4f3('0x29')],_0x4de0ae[_0xd4f3('0x1d')][_0xd4f3('0x1e')]?_0x4de0ae['headers'][_0xd4f3('0x1e')]:_0x4de0ae[_0xd4f3('0x1f')]['remoteAddress']||_0x4de0ae['ip'],_0x4de0ae['url'],_0x2c5653['statusCode'],_0x2c5653[_0xd4f3('0x23')],_0x4de0ae[_0xd4f3('0x13')]?_0x4de0ae[_0xd4f3('0x13')]['id']:null,_0x4de0ae[_0xd4f3('0x13')]?_0x4de0ae[_0xd4f3('0x13')][_0xd4f3('0xf')]:null,_0x4de0ae[_0xd4f3('0x13')]?_0x4de0ae[_0xd4f3('0x13')][_0xd4f3('0xe')]:null,_0x4de0ae[_0xd4f3('0x1b')]&&_0x4de0ae['body']['device']?_0x4de0ae[_0xd4f3('0x1b')]['device']:_0xd4f3('0x2a'),_0x4de0ae[_0xd4f3('0x1b')]&&_0x4de0ae[_0xd4f3('0x1b')][_0xd4f3('0x27')]?_0x4de0ae[_0xd4f3('0x1b')][_0xd4f3('0x27')]:'',_0x4de0ae[_0xd4f3('0x1b')]&&_0x4de0ae['body'][_0xd4f3('0x2b')]?_0x4de0ae[_0xd4f3('0x1b')]['agent_name']:'');},'ignoreRoute':function(_0x39cddc){var _0x15358c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x15358c[_0xd4f3('0x2c')](_0x39cddc[_0xd4f3('0x21')]);}}));return _0x54ea6e();});}exports[_0xd4f3('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index e995024..066919c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x043a=['isValid','split','map','locale','weekdaysShort','indexOf','slice','exports','circularDoWInterval','toLowerCase','concat','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','includes','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','isMoment','length','iftime','lodash','moment-timezone','Interval\x20string\x20not\x20valid','Date\x20not\x20valid'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0x043a,0xe0));var _0xa043=function(_0xca7b54,_0xeae67e){_0xca7b54=_0xca7b54-0x0;var _0xb913b8=_0x043a[_0xca7b54];return _0xb913b8;};var _=require(_0xa043('0x0'));var moment=require(_0xa043('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x38a297){return _0x38a297['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa043('0x2');var EINVALID_DATE=_0xa043('0x3');function throwIfDateNotValid(_0x1f6e2d){if(!_0x1f6e2d[_0xa043('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4a7fd0){var _0x312a11=_0x4a7fd0[_0xa043('0x5')](':')[_0xa043('0x6')](function(_0x13cf80){return parseInt(_0x13cf80,0xa);});var _0x4e13b1=_0x312a11[0x0];var _0x3bfce9=_0x312a11[0x1];if(_0x4e13b1<0x0||_0x4e13b1>0x17||_0x3bfce9<0x0||_0x3bfce9>0x3b){throw new Error(EINVALID_DATE);}return[_0x4e13b1,_0x3bfce9];}function circularDoWInterval(_0x1b86f2,_0x419ee3){if(_0x1b86f2===_0x419ee3){return[_0x1b86f2];}else{var _0x29fda4=moment[_0xa043('0x7')]();moment[_0xa043('0x7')]('en');var _0x54db2f=moment[_0xa043('0x8')]()[_0xa043('0x6')](function(_0x43da2a){return _0x43da2a['toLowerCase']();});moment[_0xa043('0x7')](_0x29fda4);var _0x3f47e9=_0x54db2f[_0xa043('0x9')](_0x1b86f2);var _0x44182e=_0x54db2f[_0xa043('0x9')](_0x419ee3);if(_0x44182e>_0x3f47e9){return _0x54db2f[_0xa043('0xa')](_0x3f47e9,_0x44182e+0x1);}else{var _0x150e13=_0x54db2f['slice'](0x0,_0x44182e+0x1);var _0x288630=_0x54db2f[_0xa043('0xa')](_0x3f47e9);return _0x288630['concat'](_0x150e13);}}}module[_0xa043('0xb')][_0xa043('0xc')]=circularDoWInterval;function circularMonthInterval(_0x22a3dc,_0x52c5b9){if(_0x22a3dc===_0x52c5b9){return[_0x22a3dc];}else{var _0x137f7a=moment[_0xa043('0x7')]();moment['locale']('en');var _0xf9c66f=moment['monthsShort']()[_0xa043('0x6')](function(_0x406398){return _0x406398[_0xa043('0xd')]();});moment['locale'](_0x137f7a);var _0x59632f=_0xf9c66f['indexOf'](_0x22a3dc);var _0x4ab671=_0xf9c66f[_0xa043('0x9')](_0x52c5b9);if(_0x4ab671>_0x59632f){return _0xf9c66f[_0xa043('0xa')](_0x59632f,_0x4ab671+0x1);}else{var _0x1c8d05=_0xf9c66f['slice'](0x0,_0x4ab671+0x1);var _0x578eb6=_0xf9c66f[_0xa043('0xa')](_0x59632f);return _0x578eb6[_0xa043('0xe')](_0x1c8d05);}}}module[_0xa043('0xb')][_0xa043('0xf')]=circularMonthInterval;function parseDom(_0x59292d){var _0xdef9f=parseInt(_0x59292d,0xa);if(_0xdef9f<0x1||_0xdef9f>0x1f){throw new Error(EINVALID_DATE);}return _0xdef9f;}function timeCompare(_0x57a603,_0x54e85f,_0x239952){var _0x1b5853=_0x57a603['clone']();var _0xb81e22=extractTime(_0x54e85f);var _0x3158bc=_0xb81e22[0x0];var _0x500fd7=_0xb81e22[0x1];var _0x46b95e=_0x57a603[_0xa043('0x10')]()[_0xa043('0x11')](_0x3158bc)[_0xa043('0x12')](_0x500fd7);throwIfDateNotValid(_0x46b95e);var _0x59cfe4=extractTime(_0x239952);var _0x393a3c=_0x59cfe4[0x0];var _0x306eba=_0x59cfe4[0x1];var _0xbbbc4e=_0x57a603[_0xa043('0x10')]()[_0xa043('0x11')](_0x393a3c)['minutes'](_0x306eba);throwIfDateNotValid(_0xbbbc4e);if(_0xbbbc4e[_0xa043('0x13')](_0x46b95e)){var _0x2153ad=_0x1b5853['clone']()[_0xa043('0x14')](_0xa043('0x15'));var _0x52aa1e=_0x1b5853[_0xa043('0x10')]()[_0xa043('0x16')]('day');return _0x1b5853[_0xa043('0x17')](_0x46b95e,_0x52aa1e,undefined,'[]')||_0x1b5853[_0xa043('0x17')](_0x2153ad,_0xbbbc4e,undefined,'[]');}else{return _0x1b5853[_0xa043('0x17')](_0x46b95e,_0xbbbc4e,undefined,'[]');}}module[_0xa043('0xb')][_0xa043('0x18')]=timeCompare;function dowCompare(_0x480183,_0x588383,_0x2ef55a){var _0x29cf4d=_0x480183[_0xa043('0x7')]('en')[_0xa043('0x19')]('ddd')[_0xa043('0xd')]();return circularDoWInterval(_0x588383,_0x2ef55a)[_0xa043('0x1a')](_0x29cf4d);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x5e33a5,_0x1295bc,_0xd42c3e){var _0x17b840=_0x5e33a5[_0xa043('0x1b')]();if(_0x1295bc===_0xd42c3e){return _0x17b840===_0x1295bc;}else{var _0x4ae269=_0x5e33a5[_0xa043('0x1c')]();var _0x2e0a28=_0x1295bc<_0xd42c3e;let _0x3cbeca=![];var _0x22a8a3=0x0;var _0x2ed3f1=0x0;if(_0x2e0a28){_0x22a8a3=Math[_0xa043('0x1d')](0x1,_0x1295bc);_0x2ed3f1=Math[_0xa043('0x1e')](_0xd42c3e,_0x4ae269);_0x3cbeca=_0x17b840>=_0x22a8a3&&_0x17b840<=_0x2ed3f1;}else{_0x22a8a3=Math[_0xa043('0x1e')](_0x1295bc,_0x4ae269);_0x2ed3f1=Math[_0xa043('0x1d')](0x1,_0xd42c3e);_0x3cbeca=_0x17b840>=_0x22a8a3||_0x17b840<=_0x2ed3f1;}return _0x3cbeca;}}module['exports'][_0xa043('0x1f')]=domCompare;function monthCompare(_0x283a28,_0x44f496,_0x5d596f){var _0x1bad58=_0x283a28['locale']('en')[_0xa043('0x19')](_0xa043('0x20'))[_0xa043('0xd')]();return circularMonthInterval(_0x44f496,_0x5d596f)[_0xa043('0x1a')](_0x1bad58);}module[_0xa043('0xb')][_0xa043('0x21')]=monthCompare;function iftime(_0xca7b81,_0x255bf0=moment['tz'][_0xa043('0x22')](),_0x538fe8=moment()){if(!validateRx['test'](_0xca7b81)){throw new Error(EINVALID_STRING);}else{var _0x4fa169=(moment[_0xa043('0x23')](_0x538fe8)?_0x538fe8[_0xa043('0x10')]():moment(_0x538fe8))['tz'](_0x255bf0)['locale']('en');throwIfDateNotValid(_0x4fa169);var _0x2d60a4=_0xca7b81['split'](',');var _0x16b6c6=_0x2d60a4[0x0];var _0x570e71=_0x2d60a4[0x1];var _0xe80d6c=_0x2d60a4[0x2];var _0x59bd5f=_0x2d60a4[0x3];let _0xd3f052=!![];if(_0x16b6c6!=='*'){var _0x46f049=_0x16b6c6[_0xa043('0x5')]('-');var _0x457e04=_['padStart'](_0x46f049[0x0],0x5,'0');var _0x1fe40f=_0x46f049['length']===0x2?_['padStart'](_0x46f049[0x1],0x5,'0'):_0x457e04;_0xd3f052=timeCompare(_0x4fa169,_0x457e04,_0x1fe40f);}let _0x4e0488=!![];if(_0x570e71!=='*'){var _0x15ccd2=_0x570e71[_0xa043('0x5')]('-');var _0x13b0db=_0x15ccd2[0x0];var _0x5504b3=_0x15ccd2[_0xa043('0x24')]===0x2?_0x15ccd2[0x1]:_0x13b0db;_0x4e0488=dowCompare(_0x4fa169,_0x13b0db,_0x5504b3);}let _0x14ca1c=!![];if(_0xe80d6c!=='*'){var _0x4d2a09=_0xe80d6c[_0xa043('0x5')]('-');var _0x14b40a=parseDom(_0x4d2a09[0x0]);var _0x5d6ca5=_0x4d2a09[_0xa043('0x24')]===0x2?parseDom(_0x4d2a09[0x1]):_0x14b40a;_0x14ca1c=domCompare(_0x4fa169,_0x14b40a,_0x5d6ca5);}let _0x48f569=!![];if(_0x59bd5f!=='*'){var _0x5441a5=_0x59bd5f[_0xa043('0x5')]('-');var _0x5e2c20=_0x5441a5[0x0];var _0x406772=_0x5441a5[_0xa043('0x24')]===0x2?_0x5441a5[0x1]:_0x5441a5[0x0];_0x48f569=monthCompare(_0x4fa169,_0x5e2c20,_0x406772);}return _0xd3f052&&_0x4e0488&&_0x14ca1c&&_0x48f569;}}module[_0xa043('0xb')][_0xa043('0x25')]=iftime; \ No newline at end of file +var _0x497f=['exports','circularDoWInterval','locale','concat','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','format','includes','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','padStart','length','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','toLowerCase','indexOf','slice'];(function(_0x1fee83,_0x101fab){var _0x4f5863=function(_0x275342){while(--_0x275342){_0x1fee83['push'](_0x1fee83['shift']());}};_0x4f5863(++_0x101fab);}(_0x497f,0x8c));var _0xf497=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x497f[_0x2b10c6];return _0x3789d2;};var _=require(_0xf497('0x0'));var moment=require(_0xf497('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xf497('0x2')](function(_0x320a7e){return _0x320a7e[_0xf497('0x3')];})[_0xf497('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf497('0x5');var EINVALID_DATE=_0xf497('0x6');function throwIfDateNotValid(_0x30d6e0){if(!_0x30d6e0[_0xf497('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3b6b24){var _0x126363=_0x3b6b24[_0xf497('0x8')](':')['map'](function(_0x274468){return parseInt(_0x274468,0xa);});var _0x1b30af=_0x126363[0x0];var _0x1add07=_0x126363[0x1];if(_0x1b30af<0x0||_0x1b30af>0x17||_0x1add07<0x0||_0x1add07>0x3b){throw new Error(EINVALID_DATE);}return[_0x1b30af,_0x1add07];}function circularDoWInterval(_0x59dbf7,_0x3dbc8f){if(_0x59dbf7===_0x3dbc8f){return[_0x59dbf7];}else{var _0x316f69=moment['locale']();moment['locale']('en');var _0x34c169=moment['weekdaysShort']()[_0xf497('0x2')](function(_0x24a95b){return _0x24a95b[_0xf497('0x9')]();});moment['locale'](_0x316f69);var _0x22a546=_0x34c169[_0xf497('0xa')](_0x59dbf7);var _0x3a32a4=_0x34c169[_0xf497('0xa')](_0x3dbc8f);if(_0x3a32a4>_0x22a546){return _0x34c169['slice'](_0x22a546,_0x3a32a4+0x1);}else{var _0x4d9768=_0x34c169['slice'](0x0,_0x3a32a4+0x1);var _0x5a70a3=_0x34c169[_0xf497('0xb')](_0x22a546);return _0x5a70a3['concat'](_0x4d9768);}}}module[_0xf497('0xc')][_0xf497('0xd')]=circularDoWInterval;function circularMonthInterval(_0x11aa0d,_0x4c63d2){if(_0x11aa0d===_0x4c63d2){return[_0x11aa0d];}else{var _0x3b375e=moment[_0xf497('0xe')]();moment[_0xf497('0xe')]('en');var _0x2cafa2=moment['monthsShort']()[_0xf497('0x2')](function(_0xfe7045){return _0xfe7045['toLowerCase']();});moment['locale'](_0x3b375e);var _0xbcfc13=_0x2cafa2['indexOf'](_0x11aa0d);var _0x33177b=_0x2cafa2['indexOf'](_0x4c63d2);if(_0x33177b>_0xbcfc13){return _0x2cafa2[_0xf497('0xb')](_0xbcfc13,_0x33177b+0x1);}else{var _0x233239=_0x2cafa2[_0xf497('0xb')](0x0,_0x33177b+0x1);var _0x480350=_0x2cafa2[_0xf497('0xb')](_0xbcfc13);return _0x480350[_0xf497('0xf')](_0x233239);}}}module[_0xf497('0xc')][_0xf497('0x10')]=circularMonthInterval;function parseDom(_0x665b17){var _0x1bbd05=parseInt(_0x665b17,0xa);if(_0x1bbd05<0x1||_0x1bbd05>0x1f){throw new Error(EINVALID_DATE);}return _0x1bbd05;}function timeCompare(_0x493ad4,_0x26d287,_0x15ad68){var _0x3f5122=_0x493ad4[_0xf497('0x11')]();var _0xd08810=extractTime(_0x26d287);var _0x178dd5=_0xd08810[0x0];var _0xbdceaa=_0xd08810[0x1];var _0x128b73=_0x493ad4['clone']()[_0xf497('0x12')](_0x178dd5)['minutes'](_0xbdceaa);throwIfDateNotValid(_0x128b73);var _0x1ae05a=extractTime(_0x15ad68);var _0x43f71e=_0x1ae05a[0x0];var _0x2769d2=_0x1ae05a[0x1];var _0x131252=_0x493ad4[_0xf497('0x11')]()[_0xf497('0x12')](_0x43f71e)[_0xf497('0x13')](_0x2769d2);throwIfDateNotValid(_0x131252);if(_0x131252[_0xf497('0x14')](_0x128b73)){var _0x11e09d=_0x3f5122['clone']()[_0xf497('0x15')](_0xf497('0x16'));var _0x180e04=_0x3f5122[_0xf497('0x11')]()[_0xf497('0x17')](_0xf497('0x16'));return _0x3f5122[_0xf497('0x18')](_0x128b73,_0x180e04,undefined,'[]')||_0x3f5122[_0xf497('0x18')](_0x11e09d,_0x131252,undefined,'[]');}else{return _0x3f5122[_0xf497('0x18')](_0x128b73,_0x131252,undefined,'[]');}}module[_0xf497('0xc')]['timeCompare']=timeCompare;function dowCompare(_0x49a5a7,_0x4e1394,_0x46dd6f){var _0x135c10=_0x49a5a7['locale']('en')[_0xf497('0x19')]('ddd')[_0xf497('0x9')]();return circularDoWInterval(_0x4e1394,_0x46dd6f)[_0xf497('0x1a')](_0x135c10);}module[_0xf497('0xc')]['dowCompare']=dowCompare;function domCompare(_0x276858,_0x5a8e7d,_0x573b9c){var _0x2f8422=_0x276858[_0xf497('0x1b')]();if(_0x5a8e7d===_0x573b9c){return _0x2f8422===_0x5a8e7d;}else{var _0x8c43ea=_0x276858[_0xf497('0x1c')]();var _0x532ba9=_0x5a8e7d<_0x573b9c;let _0x2cadb0=![];var _0x497fdf=0x0;var _0x459e08=0x0;if(_0x532ba9){_0x497fdf=Math[_0xf497('0x1d')](0x1,_0x5a8e7d);_0x459e08=Math['min'](_0x573b9c,_0x8c43ea);_0x2cadb0=_0x2f8422>=_0x497fdf&&_0x2f8422<=_0x459e08;}else{_0x497fdf=Math[_0xf497('0x1e')](_0x5a8e7d,_0x8c43ea);_0x459e08=Math['max'](0x1,_0x573b9c);_0x2cadb0=_0x2f8422>=_0x497fdf||_0x2f8422<=_0x459e08;}return _0x2cadb0;}}module['exports'][_0xf497('0x1f')]=domCompare;function monthCompare(_0x15cc3f,_0x4f22f9,_0x2cb0ea){var _0x47eb8b=_0x15cc3f[_0xf497('0xe')]('en')[_0xf497('0x19')](_0xf497('0x20'))[_0xf497('0x9')]();return circularMonthInterval(_0x4f22f9,_0x2cb0ea)[_0xf497('0x1a')](_0x47eb8b);}module[_0xf497('0xc')][_0xf497('0x21')]=monthCompare;function iftime(_0x14bc5d,_0x182a93=moment['tz'][_0xf497('0x22')](),_0x191acf=moment()){if(!validateRx[_0xf497('0x23')](_0x14bc5d)){throw new Error(EINVALID_STRING);}else{var _0x257e82=(moment['isMoment'](_0x191acf)?_0x191acf['clone']():moment(_0x191acf))['tz'](_0x182a93)[_0xf497('0xe')]('en');throwIfDateNotValid(_0x257e82);var _0x345bb9=_0x14bc5d[_0xf497('0x8')](',');var _0x1667c8=_0x345bb9[0x0];var _0x4f66c4=_0x345bb9[0x1];var _0x32a603=_0x345bb9[0x2];var _0x1f4bb0=_0x345bb9[0x3];let _0xf3a6b2=!![];if(_0x1667c8!=='*'){var _0x29540a=_0x1667c8[_0xf497('0x8')]('-');var _0x15bf3f=_[_0xf497('0x24')](_0x29540a[0x0],0x5,'0');var _0x52d8a7=_0x29540a[_0xf497('0x25')]===0x2?_[_0xf497('0x24')](_0x29540a[0x1],0x5,'0'):_0x15bf3f;_0xf3a6b2=timeCompare(_0x257e82,_0x15bf3f,_0x52d8a7);}let _0x63f022=!![];if(_0x4f66c4!=='*'){var _0x306398=_0x4f66c4[_0xf497('0x8')]('-');var _0x2db0e4=_0x306398[0x0];var _0x214d20=_0x306398['length']===0x2?_0x306398[0x1]:_0x2db0e4;_0x63f022=dowCompare(_0x257e82,_0x2db0e4,_0x214d20);}let _0x27a48b=!![];if(_0x32a603!=='*'){var _0x3615e6=_0x32a603[_0xf497('0x8')]('-');var _0x3e4197=parseDom(_0x3615e6[0x0]);var _0x4da6cd=_0x3615e6[_0xf497('0x25')]===0x2?parseDom(_0x3615e6[0x1]):_0x3e4197;_0x27a48b=domCompare(_0x257e82,_0x3e4197,_0x4da6cd);}let _0x1d352b=!![];if(_0x1f4bb0!=='*'){var _0x37e31a=_0x1f4bb0['split']('-');var _0x1824ae=_0x37e31a[0x0];var _0x260174=_0x37e31a['length']===0x2?_0x37e31a[0x1]:_0x37e31a[0x0];_0x1d352b=monthCompare(_0x257e82,_0x1824ae,_0x260174);}return _0xf3a6b2&&_0x63f022&&_0x27a48b&&_0x1d352b;}}module[_0xf497('0xc')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index bb483fc..84cecf8 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe419=['winston','../config/environment','debugLevel','info','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe419,0xf3));var _0x9e41=function(_0x13bd5f,_0x24020d){_0x13bd5f=_0x13bd5f-0x0;var _0x99ef07=_0xe419[_0x13bd5f];return _0x99ef07;};'use strict';var path=require(_0x9e41('0x0'));var util=require(_0x9e41('0x1'));var moment=require(_0x9e41('0x2'));var winston=require(_0x9e41('0x3'));var config=require(_0x9e41('0x4'));var debugLevel=config[_0x9e41('0x5')]?config['debugLevel']['toLowerCase']():_0x9e41('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x9e41('0x7'),'warn':_0x9e41('0x8'),'info':_0x9e41('0x9'),'print':_0x9e41('0xa'),'success':'bold\x20green','http':'gray','verbose':_0x9e41('0xb'),'debug':_0x9e41('0xc'),'silly':_0x9e41('0xd')};winston[_0x9e41('0xe')](XC_LOG_COLORS);function getLogFileName(_0x1eab5d,_0x2e0068,_0x14fe1d){var _0x329533=_0x1eab5d||_0x9e41('0xf');return path[_0x9e41('0x10')](_0x329533,util[_0x9e41('0x11')](_0x9e41('0x12'),_0x2e0068,_0x14fe1d));}function formatter(_0x4d4daa,_0x5e3a1e){_0x5e3a1e[_0x9e41('0x13')]=_0x5e3a1e[_0x9e41('0x13')][_0x9e41('0x14')](/@@{/g,_0x9e41('0x15'))['replace'](/}@@/g,_0x9e41('0x16'))[_0x9e41('0x14')](/@{/g,'{{')[_0x9e41('0x14')](/}@/g,'}}');return util['format'](_0x9e41('0x17'),moment()[_0x9e41('0x11')](_0x9e41('0x18')),_0x5e3a1e['level']['toUpperCase'](),_0x4d4daa,_0x5e3a1e[_0x9e41('0x13')]);}function fileFormat(_0x3cb8a5,_0x5c8532){_0x5c8532[_0x9e41('0x13')]=_0x5c8532['message'][_0x9e41('0x14')](/@@{/g,'{{{')[_0x9e41('0x14')](/}@@/g,_0x9e41('0x16'))[_0x9e41('0x14')](/@{/g,'{{')[_0x9e41('0x14')](/}@/g,'}}');var _0x41d2ff=_0x5c8532['meta']&&Object[_0x9e41('0x19')](_0x5c8532[_0x9e41('0x1a')])[_0x9e41('0x1b')]?'\x0a\x09'+JSON[_0x9e41('0x1c')](_0x5c8532[_0x9e41('0x1a')]):'';return util[_0x9e41('0x11')](_0x9e41('0x1d'),moment()[_0x9e41('0x11')](_0x9e41('0x18')),_0x5c8532[_0x9e41('0x1e')][_0x9e41('0x1f')](),_0x3cb8a5,_0x5c8532['message'],_0x41d2ff);}function consoleLogger(){var _0x1c5bc8=new winston[(_0x9e41('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9e41('0x21'))][(_0x9e41('0x22'))]({'level':_0x9e41('0x23'),'json':![],'formatter':function(_0x2b84ae){return formatter('',_0x2b84ae);}})]});return _0x1c5bc8;}function fileLogger(_0x3f67ff,_0x23bce7){var _0x43c406=new winston[(_0x9e41('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9e41('0x21'))][(_0x9e41('0x24'))]({'name':util[_0x9e41('0x11')](_0x9e41('0x25'),_0x3f67ff,'error'),'filename':getLogFileName(_0x23bce7,_0x3f67ff,_0x9e41('0x26')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x12138e){return fileFormat(_0x3f67ff,_0x12138e);}}),new winston[(_0x9e41('0x21'))][(_0x9e41('0x24'))]({'name':util['format'](_0x9e41('0x25'),_0x3f67ff,debugLevel),'filename':getLogFileName(_0x23bce7,_0x3f67ff,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x466c3c){return fileFormat(_0x3f67ff,_0x466c3c);}}),new winston[(_0x9e41('0x21'))][(_0x9e41('0x22'))]({'level':'warn','json':![],'formatter':function(_0x3fa551){return fileFormat(_0x3f67ff,_0x3fa551);}})]});return _0x43c406;}exports[_0x9e41('0x27')]=consoleLogger;exports[_0x9e41('0x28')]=fileLogger; \ No newline at end of file +var _0x24c2=['level','transports','Logger','File','%s-%s','error','Console','warn','consoleLogger','path','moment','winston','../config/environment','debugLevel','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','{{{','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x181a10,_0x5f5610){var _0xeba620=function(_0x39e408){while(--_0x39e408){_0x181a10['push'](_0x181a10['shift']());}};_0xeba620(++_0x5f5610);}(_0x24c2,0xa5));var _0x224c=function(_0x28727b,_0x167b25){_0x28727b=_0x28727b-0x0;var _0x2200c7=_0x24c2[_0x28727b];return _0x2200c7;};'use strict';var path=require(_0x224c('0x0'));var util=require('util');var moment=require(_0x224c('0x1'));var winston=require(_0x224c('0x2'));var config=require(_0x224c('0x3'));var debugLevel=config[_0x224c('0x4')]?config['debugLevel']['toLowerCase']():_0x224c('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x224c('0x6'),'error':'red','warn':_0x224c('0x7'),'info':_0x224c('0x8'),'print':_0x224c('0x9'),'success':_0x224c('0xa'),'http':'gray','verbose':_0x224c('0xb'),'debug':_0x224c('0xc'),'silly':_0x224c('0xd')};winston[_0x224c('0xe')](XC_LOG_COLORS);function getLogFileName(_0x20df1b,_0x539697,_0x3cdd93){var _0x5c9f9e=_0x20df1b||_0x224c('0xf');return path[_0x224c('0x10')](_0x5c9f9e,util[_0x224c('0x11')](_0x224c('0x12'),_0x539697,_0x3cdd93));}function formatter(_0x5e7ca4,_0x455b5f){_0x455b5f['message']=_0x455b5f['message'][_0x224c('0x13')](/@@{/g,'{{{')[_0x224c('0x13')](/}@@/g,_0x224c('0x14'))[_0x224c('0x13')](/@{/g,'{{')[_0x224c('0x13')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x224c('0x11')](_0x224c('0x15')),_0x455b5f['level'][_0x224c('0x16')](),_0x5e7ca4,_0x455b5f[_0x224c('0x17')]);}function fileFormat(_0x593e94,_0x4224d6){_0x4224d6[_0x224c('0x17')]=_0x4224d6[_0x224c('0x17')][_0x224c('0x13')](/@@{/g,_0x224c('0x18'))[_0x224c('0x13')](/}@@/g,_0x224c('0x14'))[_0x224c('0x13')](/@{/g,'{{')[_0x224c('0x13')](/}@/g,'}}');var _0x42d615=_0x4224d6[_0x224c('0x19')]&&Object[_0x224c('0x1a')](_0x4224d6[_0x224c('0x19')])[_0x224c('0x1b')]?'\x0a\x09'+JSON[_0x224c('0x1c')](_0x4224d6['meta']):'';return util[_0x224c('0x11')](_0x224c('0x1d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x4224d6[_0x224c('0x1e')][_0x224c('0x16')](),_0x593e94,_0x4224d6['message'],_0x42d615);}function consoleLogger(){var _0x264da3=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x224c('0x1f'))]['Console']({'level':'warn','json':![],'formatter':function(_0x3a58d9){return formatter('',_0x3a58d9);}})]});return _0x264da3;}function fileLogger(_0x47ed31,_0x50e67f){var _0x4d0369=new winston[(_0x224c('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x224c('0x21'))]({'name':util[_0x224c('0x11')](_0x224c('0x22'),_0x47ed31,_0x224c('0x23')),'filename':getLogFileName(_0x50e67f,_0x47ed31,_0x224c('0x23')),'level':_0x224c('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48ed7d){return fileFormat(_0x47ed31,_0x48ed7d);}}),new winston[(_0x224c('0x1f'))]['File']({'name':util[_0x224c('0x11')](_0x224c('0x22'),_0x47ed31,debugLevel),'filename':getLogFileName(_0x50e67f,_0x47ed31,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x287488){return fileFormat(_0x47ed31,_0x287488);}}),new winston[(_0x224c('0x1f'))][(_0x224c('0x24'))]({'level':_0x224c('0x25'),'json':![],'formatter':function(_0xa7c0ee){return fileFormat(_0x47ed31,_0xa7c0ee);}})]});return _0x4d0369;}exports[_0x224c('0x26')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index be6e6d7..921f321 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdb28,0x106));var _0x8db2=function(_0x981e2d,_0x6898cd){_0x981e2d=_0x981e2d-0x0;var _0x2899f4=_0xdb28[_0x981e2d];return _0x2899f4;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x2f0eaa,_0xe8104a){_0x2f0eaa=_0x2f0eaa-0x0;var _0x4d49f8=_0x7a54[_0x2f0eaa];return _0x4d49f8;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 1913aab..f833322 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['exports','\x5c$&'];(function(_0x1fdce1,_0x3d8bbd){var _0x4b89f7=function(_0x5b1e2a){while(--_0x5b1e2a){_0x1fdce1['push'](_0x1fdce1['shift']());}};_0x4b89f7(++_0x3d8bbd);}(_0xf494,0x1c6));var _0x4f49=function(_0x3938df,_0x2b8d75){_0x3938df=_0x3938df-0x0;var _0x1bdca1=_0xf494[_0x3938df];return _0x1bdca1;};module[_0x4f49('0x0')]={'escapeRegExp'(_0x32e808,_0x3063f3=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x32e808['replace'](_0x3063f3,_0x4f49('0x1'));}}; \ No newline at end of file +var _0x57ca=['\x5c$&'];(function(_0x171e4d,_0x4f2493){var _0x2d2bf4=function(_0x3a74cc){while(--_0x3a74cc){_0x171e4d['push'](_0x171e4d['shift']());}};_0x2d2bf4(++_0x4f2493);}(_0x57ca,0x108));var _0xa57c=function(_0x361945,_0x5a1358){_0x361945=_0x361945-0x0;var _0x14e349=_0x57ca[_0x361945];return _0x14e349;};module['exports']={'escapeRegExp'(_0x29cc65,_0x4ad696=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x29cc65['replace'](_0x4ad696,_0xa57c('0x0'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index a13ac66..caf5c64 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x1a3737,_0x3aa3a7){var _0x475b5e=function(_0x3d13ce){while(--_0x3d13ce){_0x1a3737['push'](_0x1a3737['shift']());}};_0x475b5e(++_0x3aa3a7);}(_0xb688,0xcf));var _0x8b68=function(_0x315f3d,_0x3b296e){_0x315f3d=_0x315f3d-0x0;var _0x3f359f=_0xb688[_0x315f3d];return _0x3f359f;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x39c8c5){return _0x39c8c5==='{{'?_0x8b68('0x0'):_0x8b68('0x1');}function safeTemplate(_0x1080e8){var _0x23bbaa=_0x1080e8;if(typeof _0x1080e8===_0x8b68('0x2')){_0x23bbaa=_0x1080e8['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8b68('0x3')](_0x1080e8)){_0x23bbaa=_0x1080e8[_0x8b68('0x4')](function(_0x30f33d){return safeTemplate(_0x30f33d);});}else if(_[_0x8b68('0x5')](_0x1080e8)){_0x23bbaa=Object['keys'](_0x1080e8)[_0x8b68('0x6')](function(_0x57ee56,_0x37677d){_0x57ee56[_0x37677d]=safeTemplate(_0x1080e8[_0x37677d]);return _0x57ee56;},{});}return _0x23bbaa;}module[_0x8b68('0x7')][_0x8b68('0x8')]=safeTemplate; \ No newline at end of file +var _0x0b0e=['safeTemplate','lodash','{\x20{\x20','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x1e520a,_0x2745f4){var _0x57272b=function(_0x4d9aa5){while(--_0x4d9aa5){_0x1e520a['push'](_0x1e520a['shift']());}};_0x57272b(++_0x2745f4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5e6cb8,_0x1d1eb5){_0x5e6cb8=_0x5e6cb8-0x0;var _0x41754f=_0x0b0e[_0x5e6cb8];return _0x41754f;};var _=require(_0xe0b0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x503596){return _0x503596==='{{'?_0xe0b0('0x1'):'\x20}\x20}';}function safeTemplate(_0x7e5a8a){var _0xdf715e=_0x7e5a8a;if(typeof _0x7e5a8a===_0xe0b0('0x2')){_0xdf715e=_0x7e5a8a[_0xe0b0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe0b0('0x4')](_0x7e5a8a)){_0xdf715e=_0x7e5a8a[_0xe0b0('0x5')](function(_0x399e67){return safeTemplate(_0x399e67);});}else if(_[_0xe0b0('0x6')](_0x7e5a8a)){_0xdf715e=Object[_0xe0b0('0x7')](_0x7e5a8a)[_0xe0b0('0x8')](function(_0x219b1c,_0x5cf9cc){_0x219b1c[_0x5cf9cc]=safeTemplate(_0x7e5a8a[_0x5cf9cc]);return _0x219b1c;},{});}return _0xdf715e;}module['exports'][_0xe0b0('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 3e5e86a..4827704 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd93e=['then','readJSON','updated','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','string','env','NODE_PATH','pathExists'];(function(_0x5e99ff,_0x5e7a57){var _0xf9d4b5=function(_0x11d64e){while(--_0x11d64e){_0x5e99ff['push'](_0x5e99ff['shift']());}};_0xf9d4b5(++_0x5e7a57);}(_0xd93e,0x74));var _0xed93=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd93e[_0x321bb2];return _0x9c12ed;};var fs=require(_0xed93('0x0'));var path=require(_0xed93('0x1'));var config=require(_0xed93('0x2'));var root=config[_0xed93('0x3')];var APP_JSON_PATH=path[_0xed93('0x4')](root,_0xed93('0x5'));var NODEPATH=path[_0xed93('0x4')](root,_0xed93('0x6'));function setLegacyLibsNodeEnvPath(_0x328fc8){let _0x357b29=![];if(Array[_0xed93('0x7')](_0x328fc8[_0xed93('0x8')])){var _0x234fcc=_0x328fc8[_0xed93('0x8')][_0xed93('0x9')](function(_0x1cd9d9){return _0x1cd9d9[_0xed93('0xa')]===_0xed93('0xb');});if(_0x234fcc>-0x1){var _0x55927d=_0x328fc8[_0xed93('0x8')][_0x234fcc];if(typeof _0x55927d['env']['NODE_PATH']!==_0xed93('0xc')){_0x55927d[_0xed93('0xd')][_0xed93('0xe')]=NODEPATH;_0x357b29=!![];}}return{'appConfig':_0x328fc8,'updated':_0x357b29};}}function updateAppConfig(_0x2d61c0){return fs[_0xed93('0xf')](APP_JSON_PATH)[_0xed93('0x10')](function(_0x5cb213){if(_0x5cb213){return fs[_0xed93('0x11')](APP_JSON_PATH)[_0xed93('0x10')](function(_0x5991d7){var _0x1c3bd7=setLegacyLibsNodeEnvPath(_0x5991d7);if(_0x1c3bd7[_0xed93('0x12')]){_0x2d61c0[_0xed93('0x13')](_0xed93('0x14'));return fs['writeJSON'](APP_JSON_PATH,_0x5991d7,{'spaces':0x2});}else{return Promise[_0xed93('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xed93('0x15')]=updateAppConfig; \ No newline at end of file +var _0xad67=['fs-extra','path','root','resolve','legacy-libs','apps','name','NODE_PATH','env','then','Updating\x20app.json','writeJSON'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0xad67,0x15c));var _0x7ad6=function(_0x16066e,_0x31e151){_0x16066e=_0x16066e-0x0;var _0x52a12e=_0xad67[_0x16066e];return _0x52a12e;};var fs=require(_0x7ad6('0x0'));var path=require(_0x7ad6('0x1'));var config=require('../config/environment');var root=config[_0x7ad6('0x2')];var APP_JSON_PATH=path[_0x7ad6('0x3')](root,'server/app.json');var NODEPATH=path[_0x7ad6('0x3')](root,_0x7ad6('0x4'));function setLegacyLibsNodeEnvPath(_0x5cfaf5){let _0x426cf0=![];if(Array['isArray'](_0x5cfaf5[_0x7ad6('0x5')])){var _0x22ea83=_0x5cfaf5[_0x7ad6('0x5')]['findIndex'](function(_0x255ef5){return _0x255ef5[_0x7ad6('0x6')]==='motion2';});if(_0x22ea83>-0x1){var _0x58ec9f=_0x5cfaf5[_0x7ad6('0x5')][_0x22ea83];if(typeof _0x58ec9f['env'][_0x7ad6('0x7')]!=='string'){_0x58ec9f[_0x7ad6('0x8')][_0x7ad6('0x7')]=NODEPATH;_0x426cf0=!![];}}return{'appConfig':_0x5cfaf5,'updated':_0x426cf0};}}function updateAppConfig(_0x10cb24){return fs['pathExists'](APP_JSON_PATH)[_0x7ad6('0x9')](function(_0x347271){if(_0x347271){return fs['readJSON'](APP_JSON_PATH)[_0x7ad6('0x9')](function(_0x41605e){var _0xc91be7=setLegacyLibsNodeEnvPath(_0x41605e);if(_0xc91be7['updated']){_0x10cb24['info'](_0x7ad6('0xa'));return fs[_0x7ad6('0xb')](APP_JSON_PATH,_0x41605e,{'spaces':0x2});}else{return Promise[_0x7ad6('0x3')]();}});}else{return Promise[_0x7ad6('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file